From 28c76922080d57cc2ea6ac3a9ea2476f0a2edaf0 Mon Sep 17 00:00:00 2001 From: Andrea Bianco Date: Sun, 31 Oct 2021 19:52:21 +0100 Subject: [PATCH] Built motion from commit a8fc54dc.|2.5.37 --- 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 +- .../authActiveDirectory.controller.js | 2 +- server/api/authActiveDirectory/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.events.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/safe-template.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/tvox.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 +- 1156 files changed, 1156 insertions(+), 1156 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f377ada..5992fe2 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-31T18:22:11.872Z", + "time": "2021-10-31T18:41:03.692Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index cada34d..60de990 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-31T18:22:11.872Z", + "time": "2021-10-31T18:41:03.692Z", "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 afb49cf..cd140d0 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 _0x192f=['action','STRING','contactManager','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x18c627,_0x926f18){var _0x1e9cbf=function(_0x63fb22){while(--_0x63fb22){_0x18c627['push'](_0x18c627['shift']());}};_0x1e9cbf(++_0x926f18);}(_0x192f,0x19a));var _0xf192=function(_0x25c00b,_0x39ee52){_0x25c00b=_0x25c00b-0x0;var _0x55bdac=_0x192f[_0x25c00b];return _0x55bdac;};'use strict';var Sequelize=require(_0xf192('0x0'));module[_0xf192('0x1')]={'name':{'type':Sequelize[_0xf192('0x2')],'get':function(_0x2942d9){return this[_0xf192('0x3')](_0xf192('0x4'));}},'action':{'type':Sequelize[_0xf192('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xf192('0x6'),'integration','motionbar','jscripty',_0xf192('0x7'),_0xf192('0x8'),'bot',_0xf192('0x9')]],'msg':_0xf192('0xa')}},'comment':_0xf192('0xa')},'data1':{'type':Sequelize[_0xf192('0x5')](0x1000),'comment':_0xf192('0xb')},'data2':{'type':Sequelize[_0xf192('0x5')](0x1000),'comment':_0xf192('0xc')},'data3':{'type':Sequelize[_0xf192('0x5')](0x1000),'comment':_0xf192('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xf192('0xe')},'data5':{'type':Sequelize[_0xf192('0x5')](0x1000),'comments':_0xf192('0xf')},'data6':{'type':Sequelize[_0xf192('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xf192('0x10')],'comments':_0xf192('0x11')}}; \ No newline at end of file +var _0x7eff=['urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','exports','VIRTUAL','action','STRING','contactManager','integration'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf7ef('0x0')]={'name':{'type':Sequelize[_0xf7ef('0x1')],'get':function(_0x2d6db5){return this['getDataValue'](_0xf7ef('0x2'));}},'action':{'type':Sequelize[_0xf7ef('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xf7ef('0x4'),_0xf7ef('0x5'),'motionbar','jscripty',_0xf7ef('0x6'),_0xf7ef('0x7'),_0xf7ef('0x8'),_0xf7ef('0x9')]],'msg':_0xf7ef('0xa')}},'comment':_0xf7ef('0xa')},'data1':{'type':Sequelize[_0xf7ef('0x3')](0x1000),'comment':_0xf7ef('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xf7ef('0xc')},'data3':{'type':Sequelize[_0xf7ef('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xf7ef('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xf7ef('0xd')},'data6':{'type':Sequelize['STRING'],'comments':_0xf7ef('0xe')},'data7':{'type':Sequelize['TEXT'],'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 f119300..aa0ef07 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 _0x29de=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','update','body','Action','find','params','catch','eml-format'];(function(_0x28059d,_0x16255b){var _0x41d60f=function(_0x4ad065){while(--_0x4ad065){_0x28059d['push'](_0x28059d['shift']());}};_0x41d60f(++_0x16255b);}(_0x29de,0xcb));var _0xe29d=function(_0x4842f5,_0x2a668f){_0x4842f5=_0x4842f5-0x0;var _0x178dc0=_0x29de[_0x4842f5];return _0x178dc0;};'use strict';var emlformat=require(_0xe29d('0x0'));var rimraf=require(_0xe29d('0x1'));var zipdir=require(_0xe29d('0x2'));var jsonpatch=require(_0xe29d('0x3'));var rp=require(_0xe29d('0x4'));var moment=require(_0xe29d('0x5'));var BPromise=require(_0xe29d('0x6'));var Mustache=require(_0xe29d('0x7'));var util=require(_0xe29d('0x8'));var path=require(_0xe29d('0x9'));var sox=require(_0xe29d('0xa'));var csv=require(_0xe29d('0xb'));var ejs=require(_0xe29d('0xc'));var fs=require('fs');var fs_extra=require(_0xe29d('0xd'));var _=require(_0xe29d('0xe'));var squel=require(_0xe29d('0xf'));var crypto=require('crypto');var jsforce=require(_0xe29d('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe29d('0x11'));var Papa=require(_0xe29d('0x12'));var Redis=require(_0xe29d('0x13'));var authService=require(_0xe29d('0x14'));var qs=require(_0xe29d('0x15'));var as=require(_0xe29d('0x16'));var hardwareService=require(_0xe29d('0x17'));var logger=require(_0xe29d('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xe29d('0x19'));var licenseUtil=require(_0xe29d('0x1a'));var db=require(_0xe29d('0x1b'))['db'];function respondWithStatusCode(_0x3e17ac,_0x5a2c18){_0x5a2c18=_0x5a2c18||0xcc;return function(_0x4500f4){if(_0x4500f4){return _0x3e17ac[_0xe29d('0x1c')](_0x5a2c18);}return _0x3e17ac[_0xe29d('0x1d')](_0x5a2c18)[_0xe29d('0x1e')]();};}function respondWithResult(_0x1567df,_0x5dd582){_0x5dd582=_0x5dd582||0xc8;return function(_0x4204b5){if(_0x4204b5){return _0x1567df[_0xe29d('0x1d')](_0x5dd582)['json'](_0x4204b5);}};}function respondWithFilteredResult(_0x16d7f2,_0x2ed486){return function(_0x330e5a){if(_0x330e5a){var _0x2cccb3=typeof _0x2ed486[_0xe29d('0x1f')]===_0xe29d('0x20')&&typeof _0x2ed486[_0xe29d('0x21')]===_0xe29d('0x20');var _0x552f75=_0x330e5a[_0xe29d('0x22')];var _0x673324=_0x2cccb3?0x0:_0x2ed486[_0xe29d('0x1f')];var _0xac895d=_0x2cccb3?_0x330e5a[_0xe29d('0x22')]:_0x2ed486[_0xe29d('0x1f')]+_0x2ed486[_0xe29d('0x21')];var _0x421b04;if(_0xac895d>=_0x552f75){_0xac895d=_0x552f75;_0x421b04=0xc8;}else{_0x421b04=0xce;}_0x16d7f2['status'](_0x421b04);return _0x16d7f2[_0xe29d('0x23')](_0xe29d('0x24'),_0x673324+'-'+_0xac895d+'/'+_0x552f75)[_0xe29d('0x25')](_0x330e5a);}return null;};}function patchUpdates(_0x34f311){return function(_0x57f8e9){try{jsonpatch[_0xe29d('0x26')](_0x57f8e9,_0x34f311,!![]);}catch(_0x2a1866){return BPromise[_0xe29d('0x27')](_0x2a1866);}return _0x57f8e9['save']();};}function saveUpdates(_0x226da3,_0x4efae5){return function(_0x37000c){if(_0x37000c){return _0x37000c['update'](_0x226da3)[_0xe29d('0x28')](function(_0x3f1158){return _0x3f1158;});}return null;};}function removeEntity(_0x5e8c14,_0x48f71c){return function(_0x5b94ed){if(_0x5b94ed){return _0x5b94ed[_0xe29d('0x29')]()['then'](function(){_0x5e8c14[_0xe29d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c1977,_0x4c7512){return function(_0x21a9eb){if(!_0x21a9eb){_0x9c1977[_0xe29d('0x1c')](0x194);}return _0x21a9eb;};}function handleError(_0x159d05,_0x288794){_0x288794=_0x288794||0x1f4;return function(_0x10be72){logger[_0xe29d('0x2a')](_0x10be72[_0xe29d('0x2b')]);if(_0x10be72[_0xe29d('0x2c')]){delete _0x10be72[_0xe29d('0x2c')];}_0x159d05['status'](_0x288794)['send'](_0x10be72);};}exports[_0xe29d('0x2d')]=function(_0x4d3fcd,_0x3af7c0){if(_0x4d3fcd[_0xe29d('0x2e')]['id']){delete _0x4d3fcd[_0xe29d('0x2e')]['id'];}return db[_0xe29d('0x2f')][_0xe29d('0x30')]({'where':{'id':_0x4d3fcd[_0xe29d('0x31')]['id']}})['then'](handleEntityNotFound(_0x3af7c0,null))[_0xe29d('0x28')](saveUpdates(_0x4d3fcd['body'],null))[_0xe29d('0x28')](respondWithResult(_0x3af7c0,null))[_0xe29d('0x32')](handleError(_0x3af7c0,null));};exports[_0xe29d('0x29')]=function(_0x17ab61,_0x5bb4e6){return db[_0xe29d('0x2f')][_0xe29d('0x30')]({'where':{'id':_0x17ab61['params']['id']}})[_0xe29d('0x28')](handleEntityNotFound(_0x5bb4e6,null))[_0xe29d('0x28')](removeEntity(_0x5bb4e6,null))[_0xe29d('0x32')](handleError(_0x5bb4e6,null));}; \ No newline at end of file +var _0x19d4=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','update','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0xb89ac4,_0x29849a){var _0x2a26b4=function(_0x2ada35){while(--_0x2ada35){_0xb89ac4['push'](_0xb89ac4['shift']());}};_0x2a26b4(++_0x29849a);}(_0x19d4,0x110));var _0x419d=function(_0x4c13a0,_0x3ba38a){_0x4c13a0=_0x4c13a0-0x0;var _0x37dbb5=_0x19d4[_0x4c13a0];return _0x37dbb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x419d('0x0'));var zipdir=require(_0x419d('0x1'));var jsonpatch=require(_0x419d('0x2'));var rp=require('request-promise');var moment=require(_0x419d('0x3'));var BPromise=require(_0x419d('0x4'));var Mustache=require(_0x419d('0x5'));var util=require(_0x419d('0x6'));var path=require(_0x419d('0x7'));var sox=require(_0x419d('0x8'));var csv=require(_0x419d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x419d('0xa'));var _=require(_0x419d('0xb'));var squel=require(_0x419d('0xc'));var crypto=require(_0x419d('0xd'));var jsforce=require(_0x419d('0xe'));var deskjs=require(_0x419d('0xf'));var toCsv=require(_0x419d('0x9'));var querystring=require(_0x419d('0x10'));var Papa=require(_0x419d('0x11'));var Redis=require(_0x419d('0x12'));var authService=require(_0x419d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x419d('0x14'));var hardwareService=require(_0x419d('0x15'));var logger=require('../../config/logger')(_0x419d('0x16'));var utils=require('../../config/utils');var config=require(_0x419d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32fdb9,_0x140b5d){_0x140b5d=_0x140b5d||0xcc;return function(_0x3d75b6){if(_0x3d75b6){return _0x32fdb9[_0x419d('0x18')](_0x140b5d);}return _0x32fdb9[_0x419d('0x19')](_0x140b5d)[_0x419d('0x1a')]();};}function respondWithResult(_0x477e64,_0xf105c3){_0xf105c3=_0xf105c3||0xc8;return function(_0xac5823){if(_0xac5823){return _0x477e64[_0x419d('0x19')](_0xf105c3)[_0x419d('0x1b')](_0xac5823);}};}function respondWithFilteredResult(_0x335d07,_0x4a6ae0){return function(_0x2a3804){if(_0x2a3804){var _0x3d4c4c=typeof _0x4a6ae0[_0x419d('0x1c')]===_0x419d('0x1d')&&typeof _0x4a6ae0['limit']===_0x419d('0x1d');var _0x6f12da=_0x2a3804[_0x419d('0x1e')];var _0x1af614=_0x3d4c4c?0x0:_0x4a6ae0[_0x419d('0x1c')];var _0x1294fb=_0x3d4c4c?_0x2a3804['count']:_0x4a6ae0[_0x419d('0x1c')]+_0x4a6ae0[_0x419d('0x1f')];var _0x448c8f;if(_0x1294fb>=_0x6f12da){_0x1294fb=_0x6f12da;_0x448c8f=0xc8;}else{_0x448c8f=0xce;}_0x335d07['status'](_0x448c8f);return _0x335d07[_0x419d('0x20')](_0x419d('0x21'),_0x1af614+'-'+_0x1294fb+'/'+_0x6f12da)['json'](_0x2a3804);}return null;};}function patchUpdates(_0x529d59){return function(_0x483ce9){try{jsonpatch[_0x419d('0x22')](_0x483ce9,_0x529d59,!![]);}catch(_0x1f7b9c){return BPromise[_0x419d('0x23')](_0x1f7b9c);}return _0x483ce9[_0x419d('0x24')]();};}function saveUpdates(_0x1ba2cc,_0x305b26){return function(_0x9a8dd4){if(_0x9a8dd4){return _0x9a8dd4['update'](_0x1ba2cc)[_0x419d('0x25')](function(_0x39ca43){return _0x39ca43;});}return null;};}function removeEntity(_0x81763d,_0x590e36){return function(_0x3b425e){if(_0x3b425e){return _0x3b425e[_0x419d('0x26')]()['then'](function(){_0x81763d[_0x419d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353d70,_0x1784c7){return function(_0x877122){if(!_0x877122){_0x353d70[_0x419d('0x18')](0x194);}return _0x877122;};}function handleError(_0x45f565,_0xa7bd59){_0xa7bd59=_0xa7bd59||0x1f4;return function(_0xaabd64){logger['error'](_0xaabd64['stack']);if(_0xaabd64[_0x419d('0x27')]){delete _0xaabd64[_0x419d('0x27')];}_0x45f565[_0x419d('0x19')](_0xa7bd59)[_0x419d('0x28')](_0xaabd64);};}exports[_0x419d('0x29')]=function(_0x5aa0f6,_0x522cf9){if(_0x5aa0f6[_0x419d('0x2a')]['id']){delete _0x5aa0f6[_0x419d('0x2a')]['id'];}return db[_0x419d('0x2b')][_0x419d('0x2c')]({'where':{'id':_0x5aa0f6[_0x419d('0x2d')]['id']}})[_0x419d('0x25')](handleEntityNotFound(_0x522cf9,null))[_0x419d('0x25')](saveUpdates(_0x5aa0f6[_0x419d('0x2a')],null))['then'](respondWithResult(_0x522cf9,null))['catch'](handleError(_0x522cf9,null));};exports['destroy']=function(_0x25ca8a,_0x261a86){return db['Action'][_0x419d('0x2c')]({'where':{'id':_0x25ca8a[_0x419d('0x2d')]['id']}})[_0x419d('0x25')](handleEntityNotFound(_0x261a86,null))['then'](removeEntity(_0x261a86,null))[_0x419d('0x2e')](handleError(_0x261a86,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index e9df471..58ee0a4 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 _0x3276=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','tools_actions','lodash'];(function(_0x30ffc9,_0x2b08ab){var _0x7f22a9=function(_0x2a3f34){while(--_0x2a3f34){_0x30ffc9['push'](_0x30ffc9['shift']());}};_0x7f22a9(++_0x2b08ab);}(_0x3276,0xc7));var _0x6327=function(_0x1c03c2,_0x512c06){_0x1c03c2=_0x1c03c2-0x0;var _0x4d8b73=_0x3276[_0x1c03c2];return _0x4d8b73;};'use strict';var _=require(_0x6327('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6327('0x1'));var moment=require(_0x6327('0x2'));var BPromise=require(_0x6327('0x3'));var rp=require(_0x6327('0x4'));var fs=require('fs');var path=require(_0x6327('0x5'));var rimraf=require(_0x6327('0x6'));var config=require(_0x6327('0x7'));var attributes=require('./action.attributes');module['exports']=function(_0x10b982,_0x37adde){return _0x10b982[_0x6327('0x8')]('Action',attributes,{'tableName':_0x6327('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe007=['lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./action.attributes'];(function(_0x32076a,_0x1b8c0c){var _0x382196=function(_0x42e557){while(--_0x42e557){_0x32076a['push'](_0x32076a['shift']());}};_0x382196(++_0x1b8c0c);}(_0xe007,0xe7));var _0x7e00=function(_0x4448e2,_0x215d51){_0x4448e2=_0x4448e2-0x0;var _0x1b5648=_0xe007[_0x4448e2];return _0x1b5648;};'use strict';var _=require(_0x7e00('0x0'));var util=require('util');var logger=require(_0x7e00('0x1'))(_0x7e00('0x2'));var moment=require('moment');var BPromise=require(_0x7e00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e00('0x4'));var config=require(_0x7e00('0x5'));var attributes=require(_0x7e00('0x6'));module['exports']=function(_0x4db8c2,_0x5c0c13){return _0x4db8c2['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 85eec8f..08ed9c8 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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1cb9,0x14e));var _0x91cb=function(_0x20092e,_0x394907){_0x20092e=_0x20092e-0x0;var _0x161c0e=_0x1cb9[_0x20092e];return _0x161c0e;};'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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2bae5f,_0x8ac4f7){var _0x3714e5=function(_0x59397e){while(--_0x59397e){_0x2bae5f['push'](_0x2bae5f['shift']());}};_0x3714e5(++_0x8ac4f7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5fc3[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8e4bbd6..77ff1f8 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 _0x45b2=['express','Router','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','delete','destroy','multer','util','path','connect-timeout'];(function(_0xb83515,_0x15f73b){var _0x57dc1f=function(_0x55b921){while(--_0x55b921){_0xb83515['push'](_0xb83515['shift']());}};_0x57dc1f(++_0x15f73b);}(_0x45b2,0x6c));var _0x245b=function(_0x4dd37a,_0x1ab586){_0x4dd37a=_0x4dd37a-0x0;var _0x4e3f21=_0x45b2[_0x4dd37a];return _0x4e3f21;};'use strict';var multer=require(_0x245b('0x0'));var util=require(_0x245b('0x1'));var path=require(_0x245b('0x2'));var timeout=require(_0x245b('0x3'));var express=require(_0x245b('0x4'));var router=express[_0x245b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x245b('0x6'));var interaction=require(_0x245b('0x7'));var config=require('../../config/environment');var controller=require(_0x245b('0x8'));router[_0x245b('0x9')](_0x245b('0xa'),auth[_0x245b('0xb')](),controller['update']);router[_0x245b('0xc')](_0x245b('0xa'),auth[_0x245b('0xb')](),controller[_0x245b('0xd')]);module['exports']=router; \ No newline at end of file +var _0x6f18=['/:id','isAuthenticated','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','put'];(function(_0x1872bb,_0x139eff){var _0x8566be=function(_0x1c663c){while(--_0x1c663c){_0x1872bb['push'](_0x1872bb['shift']());}};_0x8566be(++_0x139eff);}(_0x6f18,0x1e6));var _0x86f1=function(_0x197825,_0x3d056e){_0x197825=_0x197825-0x0;var _0x3714b3=_0x6f18[_0x197825];return _0x3714b3;};'use strict';var multer=require(_0x86f1('0x0'));var util=require(_0x86f1('0x1'));var path=require(_0x86f1('0x2'));var timeout=require('connect-timeout');var express=require(_0x86f1('0x3'));var router=express[_0x86f1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86f1('0x5'));var config=require(_0x86f1('0x6'));var controller=require('./action.controller');router[_0x86f1('0x7')](_0x86f1('0x8'),auth[_0x86f1('0x9')](),controller[_0x86f1('0xa')]);router[_0x86f1('0xb')](_0x86f1('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x86f1('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3f57c50..958f834 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(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0xf494,0x1c6));var _0x4f49=function(_0x439af5,_0x267b72){_0x439af5=_0x439af5-0x0;var _0x49e8b2=_0xf494[_0x439af5];return _0x49e8b2;};'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 _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5c139d,_0x3ccbb4){_0x5c139d=_0x5c139d-0x0;var _0x1ca9a5=_0xdc97[_0x5c139d];return _0x1ca9a5;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f8036ce..abd9ba2 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 _0x40d5=['SELECT','left_join','MIN(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','alias','output','web','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','run','runReport','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DESC','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','QueryTypes'];(function(_0x1d3cf5,_0x30b143){var _0x2bf198=function(_0x313d81){while(--_0x313d81){_0x1d3cf5['push'](_0x1d3cf5['shift']());}};_0x2bf198(++_0x30b143);}(_0x40d5,0x15d));var _0x540d=function(_0x52ba3d,_0x3ce09c){_0x52ba3d=_0x52ba3d-0x0;var _0x968ee9=_0x40d5[_0x52ba3d];return _0x968ee9;};'use strict';var emlformat=require(_0x540d('0x0'));var rimraf=require(_0x540d('0x1'));var zipdir=require(_0x540d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x540d('0x3'));var BPromise=require(_0x540d('0x4'));var Mustache=require(_0x540d('0x5'));var util=require(_0x540d('0x6'));var path=require(_0x540d('0x7'));var sox=require(_0x540d('0x8'));var csv=require('to-csv');var ejs=require(_0x540d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x540d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x540d('0xb'));var deskjs=require(_0x540d('0xc'));var toCsv=require(_0x540d('0xd'));var querystring=require(_0x540d('0xe'));var Papa=require('papaparse');var Redis=require(_0x540d('0xf'));var authService=require(_0x540d('0x10'));var qs=require(_0x540d('0x11'));var as=require(_0x540d('0x12'));var hardwareService=require(_0x540d('0x13'));var logger=require('../../config/logger')(_0x540d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x540d('0x15'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x29d354,_0x162fe5){_0x162fe5=_0x162fe5||0xcc;return function(_0x3c2ea7){if(_0x3c2ea7){return _0x29d354['sendStatus'](_0x162fe5);}return _0x29d354[_0x540d('0x16')](_0x162fe5)[_0x540d('0x17')]();};}function respondWithResult(_0x51cac9,_0x3743bf){_0x3743bf=_0x3743bf||0xc8;return function(_0x5c0b76){if(_0x5c0b76){return _0x51cac9[_0x540d('0x16')](_0x3743bf)[_0x540d('0x18')](_0x5c0b76);}};}function respondWithFilteredResult(_0x5a8241,_0x10cfa5){return function(_0xdd93c6){if(_0xdd93c6){var _0x1ede95=typeof _0x10cfa5[_0x540d('0x19')]===_0x540d('0x1a')&&typeof _0x10cfa5[_0x540d('0x1b')]===_0x540d('0x1a');var _0x15c737=_0xdd93c6[_0x540d('0x1c')];var _0x5d30a0=_0x1ede95?0x0:_0x10cfa5[_0x540d('0x19')];var _0x10d40c=_0x1ede95?_0xdd93c6['count']:_0x10cfa5[_0x540d('0x19')]+_0x10cfa5[_0x540d('0x1b')];var _0x135ff2;if(_0x10d40c>=_0x15c737){_0x10d40c=_0x15c737;_0x135ff2=0xc8;}else{_0x135ff2=0xce;}_0x5a8241['status'](_0x135ff2);return _0x5a8241[_0x540d('0x1d')](_0x540d('0x1e'),_0x5d30a0+'-'+_0x10d40c+'/'+_0x15c737)['json'](_0xdd93c6);}return null;};}function patchUpdates(_0x5e7a2a){return function(_0x3403b2){try{jsonpatch[_0x540d('0x1f')](_0x3403b2,_0x5e7a2a,!![]);}catch(_0x4ebfc8){return BPromise[_0x540d('0x20')](_0x4ebfc8);}return _0x3403b2[_0x540d('0x21')]();};}function saveUpdates(_0x8cb779,_0x4c40fc){return function(_0x15d44f){if(_0x15d44f){return _0x15d44f[_0x540d('0x22')](_0x8cb779)[_0x540d('0x23')](function(_0x293e97){return _0x293e97;});}return null;};}function removeEntity(_0x569fca,_0x4e987c){return function(_0x79953d){if(_0x79953d){return _0x79953d[_0x540d('0x24')]()[_0x540d('0x23')](function(){var _0x2a51d2=_0x79953d['get']({'plain':!![]});var _0x4c6809=_0x540d('0x25');return db[_0x540d('0x26')][_0x540d('0x24')]({'where':{'type':_0x4c6809,'resourceId':_0x2a51d2['id']}})[_0x540d('0x23')](function(){return _0x79953d;});})['then'](function(){_0x569fca[_0x540d('0x16')](0xcc)[_0x540d('0x17')]();});}};}function handleEntityNotFound(_0x8c2263,_0x50f188){return function(_0x55e282){if(!_0x55e282){_0x8c2263[_0x540d('0x27')](0x194);}return _0x55e282;};}function handleError(_0x1d5b33,_0x3486b9){_0x3486b9=_0x3486b9||0x1f4;return function(_0x390343){logger[_0x540d('0x28')](_0x390343[_0x540d('0x29')]);if(_0x390343[_0x540d('0x2a')]){delete _0x390343['name'];}_0x1d5b33[_0x540d('0x16')](_0x3486b9)[_0x540d('0x2b')](_0x390343);};}exports[_0x540d('0x2c')]=function(_0x5cc913,_0x3260f4){var _0x1537e8={},_0x55d5ce={},_0x97e67a={'count':0x0,'rows':[]};var _0x12fa6b=_[_0x540d('0x2d')](db[_0x540d('0x2e')][_0x540d('0x2f')],function(_0x492445){return{'name':_0x492445['fieldName'],'type':_0x492445[_0x540d('0x30')][_0x540d('0x31')]};});_0x55d5ce['model']=_['map'](_0x12fa6b,_0x540d('0x2a'));_0x55d5ce['query']=_['keys'](_0x5cc913[_0x540d('0x32')]);_0x55d5ce[_0x540d('0x33')]=_[_0x540d('0x34')](_0x55d5ce[_0x540d('0x35')],_0x55d5ce[_0x540d('0x32')]);_0x1537e8[_0x540d('0x36')]=_[_0x540d('0x34')](_0x55d5ce[_0x540d('0x35')],qs[_0x540d('0x37')](_0x5cc913[_0x540d('0x32')]['fields']));_0x1537e8['attributes']=_0x1537e8['attributes'][_0x540d('0x38')]?_0x1537e8[_0x540d('0x36')]:_0x55d5ce['model'];if(!_0x5cc913[_0x540d('0x32')][_0x540d('0x39')]('nolimit')){_0x1537e8[_0x540d('0x1b')]=qs['limit'](_0x5cc913[_0x540d('0x32')][_0x540d('0x1b')]);_0x1537e8[_0x540d('0x19')]=qs[_0x540d('0x19')](_0x5cc913['query'][_0x540d('0x19')]);}_0x1537e8[_0x540d('0x3a')]=qs[_0x540d('0x3b')](_0x5cc913['query'][_0x540d('0x3b')]);_0x1537e8[_0x540d('0x3c')]=qs['filters'](_[_0x540d('0x3d')](_0x5cc913[_0x540d('0x32')],_0x55d5ce['filters']),_0x12fa6b);if(_0x5cc913[_0x540d('0x32')][_0x540d('0x3e')]){_0x1537e8[_0x540d('0x3c')]=_[_0x540d('0x3f')](_0x1537e8[_0x540d('0x3c')],{'$or':_['map'](_0x12fa6b,function(_0x3d9520){if(_0x3d9520[_0x540d('0x30')]!=='VIRTUAL'){var _0x2dd08={};_0x2dd08[_0x3d9520[_0x540d('0x2a')]]={'$like':'%'+_0x5cc913[_0x540d('0x32')]['filter']+'%'};return _0x2dd08;}})});}_0x1537e8=_[_0x540d('0x3f')]({},_0x1537e8,_0x5cc913[_0x540d('0x40')]);var _0x560289={'where':_0x1537e8['where']};return db[_0x540d('0x2e')][_0x540d('0x1c')](_0x560289)[_0x540d('0x23')](function(_0x36f639){_0x97e67a[_0x540d('0x1c')]=_0x36f639;if(_0x5cc913['query'][_0x540d('0x41')]){_0x1537e8[_0x540d('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x540d('0x43')](_0x1537e8);})['then'](function(_0x530f14){_0x97e67a['rows']=_0x530f14;return _0x97e67a;})[_0x540d('0x23')](respondWithFilteredResult(_0x3260f4,_0x1537e8))[_0x540d('0x44')](handleError(_0x3260f4,null));};exports[_0x540d('0x45')]=function(_0x158a35,_0x5b4116){var _0x4f830e={'raw':![],'where':{'id':_0x158a35[_0x540d('0x46')]['id']}},_0x351b0a={};_0x351b0a[_0x540d('0x35')]=_[_0x540d('0x47')](db[_0x540d('0x2e')][_0x540d('0x2f')]);_0x351b0a[_0x540d('0x32')]=_[_0x540d('0x47')](_0x158a35['query']);_0x351b0a[_0x540d('0x33')]=_[_0x540d('0x34')](_0x351b0a[_0x540d('0x35')],_0x351b0a[_0x540d('0x32')]);_0x4f830e[_0x540d('0x36')]=_[_0x540d('0x34')](_0x351b0a[_0x540d('0x35')],qs['fields'](_0x158a35['query']['fields']));_0x4f830e['attributes']=_0x4f830e[_0x540d('0x36')][_0x540d('0x38')]?_0x4f830e['attributes']:_0x351b0a['model'];if(_0x158a35['query']['includeAll']){_0x4f830e[_0x540d('0x42')]=[{'all':!![]}];}_0x4f830e=_['merge']({},_0x4f830e,_0x158a35[_0x540d('0x40')]);return db['AnalyticCustomReport']['find'](_0x4f830e)[_0x540d('0x23')](handleEntityNotFound(_0x5b4116,null))[_0x540d('0x23')](respondWithResult(_0x5b4116,null))['catch'](handleError(_0x5b4116,null));};exports[_0x540d('0x48')]=function(_0x3b4d3f,_0x303de4){return db['AnalyticCustomReport'][_0x540d('0x48')](_0x3b4d3f['body'],{})['then'](function(_0x2df393){var _0x83c19e=_0x3b4d3f[_0x540d('0x49')][_0x540d('0x4a')]({'plain':!![]});if(!_0x83c19e)throw new Error(_0x540d('0x4b'));if(_0x83c19e[_0x540d('0x4c')]===_0x540d('0x49')){var _0x37e324=_0x2df393[_0x540d('0x4a')]({'plain':!![]});var _0x15aac8=_0x540d('0x4d');return db['UserProfileSection'][_0x540d('0x4e')]({'where':{'name':_0x15aac8,'userProfileId':_0x83c19e[_0x540d('0x4f')]},'raw':!![]})[_0x540d('0x23')](function(_0xd07efa){if(_0xd07efa&&_0xd07efa['autoAssociation']===0x0){return db[_0x540d('0x26')][_0x540d('0x48')]({'name':_0x37e324[_0x540d('0x2a')],'resourceId':_0x37e324['id'],'type':_0x540d('0x25'),'sectionId':_0xd07efa['id']},{})[_0x540d('0x23')](function(){return _0x2df393;});}else{return _0x2df393;}})[_0x540d('0x44')](function(_0x5359a0){logger['error'](_0x540d('0x50'),_0x5359a0);throw _0x5359a0;});}return _0x2df393;})[_0x540d('0x23')](respondWithResult(_0x303de4,0xc9))[_0x540d('0x44')](handleError(_0x303de4,null));};exports[_0x540d('0x22')]=function(_0x2e2dc3,_0x11af65){if(_0x2e2dc3['body']['id']){delete _0x2e2dc3[_0x540d('0x51')]['id'];}return db[_0x540d('0x2e')]['find']({'where':{'id':_0x2e2dc3[_0x540d('0x46')]['id']}})[_0x540d('0x23')](handleEntityNotFound(_0x11af65,null))['then'](saveUpdates(_0x2e2dc3[_0x540d('0x51')],null))['then'](respondWithResult(_0x11af65,null))[_0x540d('0x44')](handleError(_0x11af65,null));};exports[_0x540d('0x24')]=function(_0x1d0316,_0x1c31ac){return db[_0x540d('0x2e')][_0x540d('0x4e')]({'where':{'id':_0x1d0316[_0x540d('0x46')]['id']}})[_0x540d('0x23')](handleEntityNotFound(_0x1c31ac,null))[_0x540d('0x23')](removeEntity(_0x1c31ac,null))[_0x540d('0x44')](handleError(_0x1c31ac,null));};exports[_0x540d('0x52')]=function(_0x189ffc,_0x447426){var _0x43f32e=0xa;var _0x28a7aa=[_0x540d('0x53'),'left_join',_0x540d('0x54'),_0x540d('0x55')];var _0x2be5f5={'SUM':_0x540d('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x540d('0x57'),'MAX':_0x540d('0x58'),'MIN':'MIN(%s)','AVG':_0x540d('0x59'),'GROUP_CONCAT':_0x540d('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x540d('0x5b')};var _0xf0952b={'SEC_TO_TIME':_0x540d('0x5c'),'DATE':_0x540d('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0x540d('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5584d7=function(_0x286c79){return!_[_0x540d('0x5f')]([_0x540d('0x60'),_0x540d('0x61'),_0x540d('0x62'),_0x540d('0x63')],_0x286c79);};var _0x5968e0=function(_0xfae43c){if(!_0xfae43c||!_0xfae43c[_0x540d('0x64')][_0x540d('0x38')]){return'';}for(var _0x5e8ffb='(',_0x3cd8=0x0;_0x3cd8<_0xfae43c[_0x540d('0x64')][_0x540d('0x38')];_0x3cd8+=0x1){_0x3cd8>0x0&&(_0x5e8ffb+='\x20'+_0xfae43c[_0x540d('0x65')]+'\x20');_0x5e8ffb+=_0xfae43c['rules'][_0x3cd8][_0x540d('0x66')]?_0x5968e0(_0xfae43c[_0x540d('0x64')][_0x3cd8][_0x540d('0x66')]):_0xfae43c[_0x540d('0x64')][_0x3cd8][_0x540d('0x67')]+'\x20'+_0xfae43c[_0x540d('0x64')][_0x3cd8][_0x540d('0x68')]+(_0x5584d7(_0xfae43c['rules'][_0x3cd8]['condition'])?'\x20'+_0xfae43c[_0x540d('0x64')][_0x3cd8][_0x540d('0x69')]:'');}return _0x5e8ffb+')';};var _0x1a03cb={'where':{'id':_0x189ffc[_0x540d('0x46')]['id']}},_0x47c126,_0x4554a5,_0x127eb5,_0x341a87,_0x278bae;_0x1a03cb=_['merge']({},_0x1a03cb,_0x189ffc[_0x540d('0x40')]);return db['AnalyticCustomReport'][_0x540d('0x4e')](_0x1a03cb)[_0x540d('0x23')](function(_0x4341be){if(_0x4341be){_0x47c126=_0x4341be;return _0x4341be[_0x540d('0x6a')]();}return null;})['then'](function(_0x352e67){if(_0x352e67){if(!_0x352e67['length']){throw new db[(_0x540d('0x6b'))][(_0x540d('0x6c'))](_0x540d('0x6d'),0x193);}_0x4554a5=_0x352e67;return db[_0x540d('0x6e')][_0x540d('0x43')]({'raw':!![]});}return null;})[_0x540d('0x23')](function(_0x388856){if(_0x388856){_0x127eb5=_[_0x540d('0x6f')](_0x388856,'id');var _0x3fdd15;var _0x18f354=squel[_0x540d('0x70')]();_0x18f354[_0x540d('0x71')](_0x47c126[_0x540d('0x72')]);for(var _0x3dbe15=0x0;_0x3dbe15<_0x4554a5[_0x540d('0x38')];_0x3dbe15+=0x1){_0x3fdd15=_0x4554a5[_0x3dbe15][_0x540d('0x73')]?_0x127eb5[_0x4554a5[_0x3dbe15][_0x540d('0x73')]][_0x540d('0x74')]:_0x4554a5[_0x3dbe15][_0x540d('0x67')];_0x3fdd15=_0x4554a5[_0x3dbe15][_0x540d('0x75')]?_[_0x540d('0x76')](_0x2be5f5[_0x4554a5[_0x3dbe15][_0x540d('0x75')]],'%s',_0x3fdd15):_0x3fdd15;_0x3fdd15=_0x4554a5[_0x3dbe15]['format']?_[_0x540d('0x76')](_0xf0952b[_0x4554a5[_0x3dbe15][_0x540d('0x77')]],'%s',_0x3fdd15):_0x3fdd15;if(_0x4554a5[_0x3dbe15][_0x540d('0x78')]){_0x18f354[_0x540d('0x66')](_0x3fdd15);}_0x4554a5[_0x3dbe15][_0x540d('0x79')]&&_0x18f354[_0x540d('0x3a')](_0x3fdd15,_0x4554a5[_0x3dbe15][_0x540d('0x79')]==='DESC'?![]:!![]);_0x18f354['field'](_0x3fdd15,_0x4554a5[_0x3dbe15]['alias']||_0x3fdd15);}if(_0x47c126[_0x540d('0x7a')]){_0x47c126[_0x540d('0x7a')]=JSON['parse'](_0x47c126[_0x540d('0x7a')]);for(var _0x8653ae=0x0;_0x8653ae<_0x47c126[_0x540d('0x7a')][_0x540d('0x38')];_0x8653ae+=0x1){if(_0x47c126[_0x540d('0x7a')][_0x8653ae][_0x540d('0x30')]&&_[_0x540d('0x5f')](_0x28a7aa,_0x47c126[_0x540d('0x7a')][_0x8653ae][_0x540d('0x30')])&&_0x47c126['joins'][_0x8653ae][_0x540d('0x7b')]&&_0x47c126[_0x540d('0x7a')][_0x8653ae]['foreignTable']&&_0x47c126[_0x540d('0x7a')][_0x8653ae][_0x540d('0x7c')]){_0x18f354[_0x47c126[_0x540d('0x7a')][_0x8653ae][_0x540d('0x30')]](_0x47c126[_0x540d('0x7a')][_0x8653ae][_0x540d('0x7d')],null,util[_0x540d('0x77')](_0x540d('0x7e'),_0x47c126[_0x540d('0x72')],_0x47c126[_0x540d('0x7a')][_0x8653ae][_0x540d('0x7b')],_0x47c126[_0x540d('0x7a')][_0x8653ae][_0x540d('0x7d')],_0x47c126[_0x540d('0x7a')][_0x8653ae][_0x540d('0x7c')]));}}}if(_0x47c126[_0x540d('0x7f')]){_0x47c126[_0x540d('0x7f')]=JSON[_0x540d('0x80')](_0x47c126[_0x540d('0x7f')]);_0x18f354['where'](_0x5968e0(_0x47c126['conditions'][_0x540d('0x66')]));}_0x278bae=_0x18f354[_0x540d('0x81')]();_0x18f354['limit'](_0x43f32e);_0x18f354['offset'](0x0);logger[_0x540d('0x82')](_0x540d('0x83'),_0x18f354['toString']());return dbH[_0x540d('0x84')][_0x540d('0x32')](_0x18f354['toString'](),{'type':dbH[_0x540d('0x84')][_0x540d('0x85')][_0x540d('0x86')]});}})['then'](respondWithResult(_0x447426,null))['catch'](handleError(_0x447426,null));};function runReport(_0x20dc00,_0xfaf1d9,_0x57b064){var _0x24570f=_0xfaf1d9[_0x540d('0x2a')];var _0x4125a4=0xa;var _0x1b15b4=[_0x540d('0x53'),_0x540d('0x87'),_0x540d('0x54'),'cross_join'];var _0x5c1267={'SUM':_0x540d('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x540d('0x57'),'MAX':_0x540d('0x58'),'MIN':_0x540d('0x88'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x540d('0x5b')};var _0x5bb860={'SEC_TO_TIME':_0x540d('0x5c'),'DATE':_0x540d('0x5d'),'HOUR':_0x540d('0x89'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x540d('0x8a')};var _0xbe9886=function(_0x20fed0){return!_[_0x540d('0x5f')](['IS\x20NULL',_0x540d('0x61'),'IS\x20EMPTY',_0x540d('0x63')],_0x20fed0);};var _0x324f14=function(_0xb40bc){if(!_0xb40bc||!_0xb40bc['rules'][_0x540d('0x38')]){return'';}for(var _0x2c0d8f='(',_0x384afe=0x0;_0x384afe<_0xb40bc[_0x540d('0x64')]['length'];_0x384afe+=0x1){_0x384afe>0x0&&(_0x2c0d8f+='\x20'+_0xb40bc[_0x540d('0x65')]+'\x20');_0x2c0d8f+=_0xb40bc[_0x540d('0x64')][_0x384afe][_0x540d('0x66')]?_0x324f14(_0xb40bc[_0x540d('0x64')][_0x384afe][_0x540d('0x66')]):_0xb40bc[_0x540d('0x64')][_0x384afe][_0x540d('0x67')]+'\x20'+_0xb40bc[_0x540d('0x64')][_0x384afe][_0x540d('0x68')]+(_0xbe9886(_0xb40bc[_0x540d('0x64')][_0x384afe][_0x540d('0x68')])?'\x20'+_0xb40bc['rules'][_0x384afe][_0x540d('0x69')]:'');}return _0x2c0d8f+')';};var _0x2493be={'where':{'id':_0x20dc00['id']}},_0x29bdfc,_0x12ca50,_0xd5f074,_0x341c12,_0x2576e5;_0x2493be=_[_0x540d('0x3f')]({},_0x2493be,_0x57b064);return db[_0x540d('0x2e')][_0x540d('0x4e')](_0x2493be)['then'](function(_0x2fae17){if(_0x2fae17){_0x29bdfc=_0x2fae17;return _0x2fae17[_0x540d('0x6a')]();}return null;})['then'](function(_0xe3cd02){if(_0xe3cd02){if(!_0xe3cd02[_0x540d('0x38')]){throw new db[(_0x540d('0x6b'))]['ValidationErrorItem'](_0x540d('0x6d'),0x193);}_0x12ca50=_0xe3cd02;return db[_0x540d('0x6e')][_0x540d('0x43')]({'raw':!![]});}return null;})[_0x540d('0x23')](function(_0x538071){if(_0x538071){_0xd5f074=_[_0x540d('0x6f')](_0x538071,'id');var _0x37a39d;var _0x568aae=squel[_0x540d('0x70')]();_0x568aae['from'](_0x29bdfc[_0x540d('0x72')]);for(var _0x10bd5a=0x0;_0x10bd5a<_0x12ca50[_0x540d('0x38')];_0x10bd5a+=0x1){_0x37a39d=_0x12ca50[_0x10bd5a][_0x540d('0x73')]?_0xd5f074[_0x12ca50[_0x10bd5a][_0x540d('0x73')]]['metric']:_0x12ca50[_0x10bd5a]['field'];_0x37a39d=_0x12ca50[_0x10bd5a][_0x540d('0x75')]?_[_0x540d('0x76')](_0x5c1267[_0x12ca50[_0x10bd5a][_0x540d('0x75')]],'%s',_0x37a39d):_0x37a39d;_0x37a39d=_0x12ca50[_0x10bd5a][_0x540d('0x77')]?_[_0x540d('0x76')](_0x5bb860[_0x12ca50[_0x10bd5a][_0x540d('0x77')]],'%s',_0x37a39d):_0x37a39d;if(_0x12ca50[_0x10bd5a][_0x540d('0x78')]){_0x568aae[_0x540d('0x66')](_0x37a39d);}_0x12ca50[_0x10bd5a][_0x540d('0x79')]&&_0x568aae[_0x540d('0x3a')](_0x37a39d,_0x12ca50[_0x10bd5a][_0x540d('0x79')]==='DESC'?![]:!![]);_0x568aae[_0x540d('0x67')](_0x37a39d,_0x12ca50[_0x10bd5a][_0x540d('0x8b')]||_0x37a39d);}if(_0x29bdfc[_0x540d('0x7a')]){_0x29bdfc[_0x540d('0x7a')]=JSON[_0x540d('0x80')](_0x29bdfc[_0x540d('0x7a')]);for(var _0x54b9dc=0x0;_0x54b9dc<_0x29bdfc[_0x540d('0x7a')]['length'];_0x54b9dc+=0x1){if(_0x29bdfc['joins'][_0x54b9dc][_0x540d('0x30')]&&_[_0x540d('0x5f')](_0x1b15b4,_0x29bdfc['joins'][_0x54b9dc]['type'])&&_0x29bdfc['joins'][_0x54b9dc][_0x540d('0x7b')]&&_0x29bdfc[_0x540d('0x7a')][_0x54b9dc][_0x540d('0x7d')]&&_0x29bdfc[_0x540d('0x7a')][_0x54b9dc][_0x540d('0x7c')]){_0x568aae[_0x29bdfc[_0x540d('0x7a')][_0x54b9dc][_0x540d('0x30')]](_0x29bdfc[_0x540d('0x7a')][_0x54b9dc]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x29bdfc[_0x540d('0x72')],_0x29bdfc['joins'][_0x54b9dc][_0x540d('0x7b')],_0x29bdfc[_0x540d('0x7a')][_0x54b9dc]['foreignTable'],_0x29bdfc[_0x540d('0x7a')][_0x54b9dc]['foreignKey']));}}}if(_0x29bdfc[_0x540d('0x7f')]){_0x29bdfc['conditions']=JSON['parse'](_0x29bdfc[_0x540d('0x7f')]);_0x568aae[_0x540d('0x3c')](_0x324f14(_0x29bdfc[_0x540d('0x7f')][_0x540d('0x66')]));}_0x2576e5=_0x568aae[_0x540d('0x81')]();_0x568aae['limit'](_0x4125a4);_0x568aae[_0x540d('0x19')](0x0);return;}})['then'](function(){if(_0xfaf1d9[_0x540d('0x8c')]===_0x540d('0x8d')){return null;}var _0x40e6ed=_[_0x540d('0x3f')](_0xfaf1d9,{'name':_0xfaf1d9['fullPath']||_0xfaf1d9[_0x540d('0x2a')]||_0x29bdfc[_0x540d('0x2a')],'basename':_0x24570f,'savename':util[_0x540d('0x77')]('%s-%s.%s',_0xfaf1d9['name']||_0x29bdfc['name'],require(_0x540d('0x8e'))[_0x540d('0x8f')](0x4),_0xfaf1d9[_0x540d('0x8c')]||'csv'),'reportId':_0x29bdfc['id'],'reportType':_0x540d('0x90')});return db[_0x540d('0x91')][_0x540d('0x48')](_0x40e6ed,{'raw':!![]});})['then'](function(_0x1c7f8c){if(_0x29bdfc[_0x540d('0x72')]===_0x540d('0x92')){_0x2576e5['where'](_0x29bdfc[_0x540d('0x72')]+_0x540d('0x93'),_0xfaf1d9[_0x540d('0x94')],_0xfaf1d9['endDate']);}else{_0x2576e5['where'](_0x29bdfc[_0x540d('0x72')]+_0x540d('0x95'),_0xfaf1d9[_0x540d('0x94')],_0xfaf1d9['endDate']);}if(_0x1c7f8c){logger[_0x540d('0x96')](_0x540d('0x97'),_0x2576e5[_0x540d('0x98')]());require(_0x540d('0x99'))[_0x540d('0x9a')](path[_0x540d('0x53')](__dirname,_0x540d('0x9b'),_0x1c7f8c[_0x540d('0x8c')]),[_0x1c7f8c['id'],_0x2576e5[_0x540d('0x98')](),path[_0x540d('0x53')](__dirname,'../../files/reports',_0x1c7f8c['savename']),_0x24570f]);return _0x1c7f8c;}else{var _0xd1925a=squel['select']();_0xd1925a[_0x540d('0x71')]('('+_0x2576e5[_0x540d('0x98')]()+')','countTable');_0xd1925a[_0x540d('0x67')]('COUNT(*)',_0x540d('0x1c'));_0x2576e5[_0x540d('0x1b')](_0xfaf1d9[_0x540d('0x1b')]||_0x4125a4);_0x2576e5[_0x540d('0x19')](_0xfaf1d9[_0x540d('0x19')]||0x0);return dbH[_0x540d('0x84')]['query'](_0xd1925a['toString'](),{'type':dbH['sequelize'][_0x540d('0x85')][_0x540d('0x86')]})['then'](function(_0x482a83){if(!_0x482a83[_0x540d('0x38')]){_0x341c12=0x0;}else{_0x341c12=_0x482a83[0x0][_0x540d('0x1c')]||0x0;}return dbH[_0x540d('0x84')][_0x540d('0x32')](_0x2576e5[_0x540d('0x98')](),{'type':dbH[_0x540d('0x84')][_0x540d('0x85')][_0x540d('0x86')]});})[_0x540d('0x23')](function(_0x5231cf){return{'rows':_0x5231cf||[],'count':_0x341c12};});}});}exports[_0x540d('0x9c')]=function(_0x12c0bf,_0x2fe582){return runReport(_0x12c0bf[_0x540d('0x46')],_0x12c0bf[_0x540d('0x32')],_0x12c0bf[_0x540d('0x40')])[_0x540d('0x23')](respondWithResult(_0x2fe582,null))[_0x540d('0x44')](handleError(_0x2fe582,null));};exports[_0x540d('0x9d')]=runReport;exports[_0x540d('0x32')]=function(_0x6ef6e3,_0x536eaa){var _0x432fa7=0xa;var _0x4bca59=[_0x540d('0x53'),_0x540d('0x87'),'right_join','cross_join'];var _0x388957={'SUM':'SUM(%s)','COUNT':_0x540d('0x9e'),'COUNT DISTINCT':_0x540d('0x57'),'MAX':'MAX(%s)','MIN':_0x540d('0x88'),'AVG':_0x540d('0x59'),'GROUP_CONCAT':_0x540d('0x5a'),'GROUP_CONCAT ASC':_0x540d('0x9f'),'GROUP_CONCAT DESC':_0x540d('0x5b')};var _0x3a9378={'SEC_TO_TIME':_0x540d('0x5c'),'DATE':_0x540d('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0x540d('0x5e'),'UNIX_TIMESTAMP':_0x540d('0x8a')};var _0x37b140=function(_0x13df3d){return!_[_0x540d('0x5f')]([_0x540d('0x60'),_0x540d('0x61'),_0x540d('0x62'),_0x540d('0x63')],_0x13df3d);};var _0x148e0f=function(_0x323417){if(!_0x323417||!_0x323417[_0x540d('0x64')][_0x540d('0x38')]){return'';}for(var _0x19c5d5='(',_0x4307f1=0x0;_0x4307f1<_0x323417['rules'][_0x540d('0x38')];_0x4307f1+=0x1){_0x4307f1>0x0&&(_0x19c5d5+='\x20'+_0x323417[_0x540d('0x65')]+'\x20');_0x19c5d5+=_0x323417['rules'][_0x4307f1][_0x540d('0x66')]?_0x148e0f(_0x323417[_0x540d('0x64')][_0x4307f1][_0x540d('0x66')]):_0x323417[_0x540d('0x64')][_0x4307f1][_0x540d('0x67')]+'\x20'+_0x323417['rules'][_0x4307f1][_0x540d('0x68')]+(_0x37b140(_0x323417[_0x540d('0x64')][_0x4307f1][_0x540d('0x68')])?'\x20'+_0x323417[_0x540d('0x64')][_0x4307f1][_0x540d('0x69')]:'');}return _0x19c5d5+')';};var _0x5985a7={'where':{'id':_0x6ef6e3[_0x540d('0x46')]['id']}},_0x4adaa6,_0x10a8d6,_0x310246,_0xf39d80,_0x71d64;_0x5985a7=_[_0x540d('0x3f')]({},_0x5985a7,_0x6ef6e3[_0x540d('0x40')]);return db['AnalyticCustomReport'][_0x540d('0x4e')](_0x5985a7)['then'](function(_0x640245){if(_0x640245){_0x4adaa6=_0x640245;return _0x640245[_0x540d('0x6a')]();}return null;})[_0x540d('0x23')](function(_0x2b240e){if(_0x2b240e){if(!_0x2b240e[_0x540d('0x38')]){throw new db['Sequelize']['ValidationErrorItem'](_0x540d('0x6d'),0x193);}_0x10a8d6=_0x2b240e;return db[_0x540d('0x6e')][_0x540d('0x43')]({'raw':!![]});}return null;})[_0x540d('0x23')](function(_0x440894){if(_0x440894){_0x310246=_[_0x540d('0x6f')](_0x440894,'id');var _0x453b4c;var _0x40fe07=squel[_0x540d('0x70')]();_0x40fe07[_0x540d('0x71')](_0x4adaa6['table']);for(var _0x432234=0x0;_0x432234<_0x10a8d6['length'];_0x432234+=0x1){_0x453b4c=_0x10a8d6[_0x432234][_0x540d('0x73')]?_0x310246[_0x10a8d6[_0x432234]['MetricId']][_0x540d('0x74')]:_0x10a8d6[_0x432234][_0x540d('0x67')];_0x453b4c=_0x10a8d6[_0x432234][_0x540d('0x75')]?_[_0x540d('0x76')](_0x388957[_0x10a8d6[_0x432234]['function']],'%s',_0x453b4c):_0x453b4c;_0x453b4c=_0x10a8d6[_0x432234][_0x540d('0x77')]?_[_0x540d('0x76')](_0x3a9378[_0x10a8d6[_0x432234][_0x540d('0x77')]],'%s',_0x453b4c):_0x453b4c;if(_0x10a8d6[_0x432234][_0x540d('0x78')]){_0x40fe07[_0x540d('0x66')](_0x453b4c);}_0x10a8d6[_0x432234][_0x540d('0x79')]&&_0x40fe07['order'](_0x453b4c,_0x10a8d6[_0x432234][_0x540d('0x79')]===_0x540d('0xa0')?![]:!![]);_0x40fe07[_0x540d('0x67')](_0x453b4c,_0x10a8d6[_0x432234][_0x540d('0x8b')]||_0x453b4c);}if(_0x4adaa6[_0x540d('0x7a')]){_0x4adaa6['joins']=JSON['parse'](_0x4adaa6['joins']);for(var _0x3e1582=0x0;_0x3e1582<_0x4adaa6[_0x540d('0x7a')]['length'];_0x3e1582+=0x1){if(_0x4adaa6[_0x540d('0x7a')][_0x3e1582][_0x540d('0x30')]&&_['includes'](_0x4bca59,_0x4adaa6[_0x540d('0x7a')][_0x3e1582][_0x540d('0x30')])&&_0x4adaa6[_0x540d('0x7a')][_0x3e1582]['parentKey']&&_0x4adaa6[_0x540d('0x7a')][_0x3e1582]['foreignTable']&&_0x4adaa6['joins'][_0x3e1582][_0x540d('0x7c')]){_0x40fe07[_0x4adaa6[_0x540d('0x7a')][_0x3e1582][_0x540d('0x30')]](_0x4adaa6[_0x540d('0x7a')][_0x3e1582][_0x540d('0x7d')],null,util[_0x540d('0x77')](_0x540d('0x7e'),_0x4adaa6[_0x540d('0x72')],_0x4adaa6['joins'][_0x3e1582]['parentKey'],_0x4adaa6['joins'][_0x3e1582][_0x540d('0x7d')],_0x4adaa6[_0x540d('0x7a')][_0x3e1582][_0x540d('0x7c')]));}}}if(_0x4adaa6[_0x540d('0x7f')]){_0x4adaa6[_0x540d('0x7f')]=JSON[_0x540d('0x80')](_0x4adaa6[_0x540d('0x7f')]);_0x40fe07[_0x540d('0x3c')](_0x148e0f(_0x4adaa6[_0x540d('0x7f')]['group']));}_0x71d64=_0x40fe07[_0x540d('0x81')]();_0x40fe07[_0x540d('0x1b')](_0x432fa7);_0x40fe07[_0x540d('0x19')](0x0);logger[_0x540d('0x82')](_0x540d('0x83'),_0x40fe07['toString']());return dbH['sequelize'][_0x540d('0x32')](_0x40fe07[_0x540d('0x98')](),{'type':dbH[_0x540d('0x84')]['QueryTypes'][_0x540d('0x86')]});}})[_0x540d('0x23')](function(){return{'sql':_0x71d64[_0x540d('0x98')]()};})[_0x540d('0x23')](respondWithResult(_0x536eaa,null))[_0x540d('0x44')](handleError(_0x536eaa,null));}; \ No newline at end of file +var _0xdb8d=['bluebird','util','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','map','filter','merge','includeAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','CustomReports','preview','join','left_join','COUNT(%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)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','options','getFields','ValidationErrorItem','AnalyticMetric','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','right_join','cross_join','SUM(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','Sequelize','select','function','output','web','fullPath','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','fork','../../files/reports','savename','countTable','SELECT','QueryTypes','runReport','Please\x20insert\x20at\x20least\x20one\x20field','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xbcf185,_0x251002){var _0x2ae4de=function(_0x26f5d2){while(--_0x26f5d2){_0xbcf185['push'](_0xbcf185['shift']());}};_0x2ae4de(++_0x251002);}(_0xdb8d,0x136));var _0xddb8=function(_0x28bcbc,_0x30ec21){_0x28bcbc=_0x28bcbc-0x0;var _0x3a814e=_0xdb8d[_0x28bcbc];return _0x3a814e;};'use strict';var emlformat=require(_0xddb8('0x0'));var rimraf=require(_0xddb8('0x1'));var zipdir=require(_0xddb8('0x2'));var jsonpatch=require(_0xddb8('0x3'));var rp=require(_0xddb8('0x4'));var moment=require(_0xddb8('0x5'));var BPromise=require(_0xddb8('0x6'));var Mustache=require('mustache');var util=require(_0xddb8('0x7'));var path=require('path');var sox=require(_0xddb8('0x8'));var csv=require('to-csv');var ejs=require(_0xddb8('0x9'));var fs=require('fs');var fs_extra=require(_0xddb8('0xa'));var _=require('lodash');var squel=require(_0xddb8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xddb8('0xd'));var Papa=require(_0xddb8('0xe'));var Redis=require(_0xddb8('0xf'));var authService=require(_0xddb8('0x10'));var qs=require(_0xddb8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xddb8('0x12'));var utils=require('../../config/utils');var config=require(_0xddb8('0x13'));var licenseUtil=require(_0xddb8('0x14'));var db=require(_0xddb8('0x15'))['db'];var dbH=require(_0xddb8('0x15'))[_0xddb8('0x16')];function respondWithStatusCode(_0x10cb5d,_0x1a0087){_0x1a0087=_0x1a0087||0xcc;return function(_0x102fea){if(_0x102fea){return _0x10cb5d[_0xddb8('0x17')](_0x1a0087);}return _0x10cb5d[_0xddb8('0x18')](_0x1a0087)[_0xddb8('0x19')]();};}function respondWithResult(_0x1d328c,_0x535010){_0x535010=_0x535010||0xc8;return function(_0x41e27a){if(_0x41e27a){return _0x1d328c[_0xddb8('0x18')](_0x535010)[_0xddb8('0x1a')](_0x41e27a);}};}function respondWithFilteredResult(_0x14bf86,_0x3ccd41){return function(_0x197da8){if(_0x197da8){var _0x4ad260=typeof _0x3ccd41[_0xddb8('0x1b')]==='undefined'&&typeof _0x3ccd41[_0xddb8('0x1c')]===_0xddb8('0x1d');var _0x55c8dc=_0x197da8['count'];var _0x540ad3=_0x4ad260?0x0:_0x3ccd41[_0xddb8('0x1b')];var _0x53b88f=_0x4ad260?_0x197da8[_0xddb8('0x1e')]:_0x3ccd41[_0xddb8('0x1b')]+_0x3ccd41['limit'];var _0x601cf6;if(_0x53b88f>=_0x55c8dc){_0x53b88f=_0x55c8dc;_0x601cf6=0xc8;}else{_0x601cf6=0xce;}_0x14bf86['status'](_0x601cf6);return _0x14bf86['set'](_0xddb8('0x1f'),_0x540ad3+'-'+_0x53b88f+'/'+_0x55c8dc)['json'](_0x197da8);}return null;};}function patchUpdates(_0x4b2ced){return function(_0x35d7d5){try{jsonpatch['apply'](_0x35d7d5,_0x4b2ced,!![]);}catch(_0x43b8f6){return BPromise[_0xddb8('0x20')](_0x43b8f6);}return _0x35d7d5[_0xddb8('0x21')]();};}function saveUpdates(_0x33bea7,_0x21b663){return function(_0xf20cd6){if(_0xf20cd6){return _0xf20cd6[_0xddb8('0x22')](_0x33bea7)[_0xddb8('0x23')](function(_0x4a4a94){return _0x4a4a94;});}return null;};}function removeEntity(_0x410a07,_0x50f303){return function(_0x6b8550){if(_0x6b8550){return _0x6b8550[_0xddb8('0x24')]()['then'](function(){var _0xedaaff=_0x6b8550[_0xddb8('0x25')]({'plain':!![]});var _0xa3411c='CustomReports';return db[_0xddb8('0x26')][_0xddb8('0x24')]({'where':{'type':_0xa3411c,'resourceId':_0xedaaff['id']}})[_0xddb8('0x23')](function(){return _0x6b8550;});})['then'](function(){_0x410a07[_0xddb8('0x18')](0xcc)[_0xddb8('0x19')]();});}};}function handleEntityNotFound(_0x5cf747,_0x2dd540){return function(_0x25ca12){if(!_0x25ca12){_0x5cf747[_0xddb8('0x17')](0x194);}return _0x25ca12;};}function handleError(_0x527462,_0x41577f){_0x41577f=_0x41577f||0x1f4;return function(_0x14bed6){logger[_0xddb8('0x27')](_0x14bed6[_0xddb8('0x28')]);if(_0x14bed6['name']){delete _0x14bed6[_0xddb8('0x29')];}_0x527462[_0xddb8('0x18')](_0x41577f)['send'](_0x14bed6);};}exports[_0xddb8('0x2a')]=function(_0xfd64b5,_0x521757){var _0xf0dc9d={},_0x4efe56={},_0x110614={'count':0x0,'rows':[]};var _0xfd41ca=_['map'](db[_0xddb8('0x2b')][_0xddb8('0x2c')],function(_0x244c9c){return{'name':_0x244c9c['fieldName'],'type':_0x244c9c[_0xddb8('0x2d')][_0xddb8('0x2e')]};});_0x4efe56[_0xddb8('0x2f')]=_['map'](_0xfd41ca,_0xddb8('0x29'));_0x4efe56[_0xddb8('0x30')]=_['keys'](_0xfd64b5[_0xddb8('0x30')]);_0x4efe56[_0xddb8('0x31')]=_[_0xddb8('0x32')](_0x4efe56[_0xddb8('0x2f')],_0x4efe56['query']);_0xf0dc9d[_0xddb8('0x33')]=_[_0xddb8('0x32')](_0x4efe56[_0xddb8('0x2f')],qs[_0xddb8('0x34')](_0xfd64b5[_0xddb8('0x30')]['fields']));_0xf0dc9d[_0xddb8('0x33')]=_0xf0dc9d[_0xddb8('0x33')][_0xddb8('0x35')]?_0xf0dc9d[_0xddb8('0x33')]:_0x4efe56['model'];if(!_0xfd64b5[_0xddb8('0x30')]['hasOwnProperty']('nolimit')){_0xf0dc9d[_0xddb8('0x1c')]=qs[_0xddb8('0x1c')](_0xfd64b5['query'][_0xddb8('0x1c')]);_0xf0dc9d[_0xddb8('0x1b')]=qs['offset'](_0xfd64b5[_0xddb8('0x30')]['offset']);}_0xf0dc9d[_0xddb8('0x36')]=qs[_0xddb8('0x37')](_0xfd64b5[_0xddb8('0x30')]['sort']);_0xf0dc9d[_0xddb8('0x38')]=qs['filters'](_[_0xddb8('0x39')](_0xfd64b5[_0xddb8('0x30')],_0x4efe56[_0xddb8('0x31')]),_0xfd41ca);if(_0xfd64b5[_0xddb8('0x30')]['filter']){_0xf0dc9d['where']=_['merge'](_0xf0dc9d['where'],{'$or':_[_0xddb8('0x3a')](_0xfd41ca,function(_0x5fdaeb){if(_0x5fdaeb['type']!=='VIRTUAL'){var _0xffa075={};_0xffa075[_0x5fdaeb[_0xddb8('0x29')]]={'$like':'%'+_0xfd64b5[_0xddb8('0x30')][_0xddb8('0x3b')]+'%'};return _0xffa075;}})});}_0xf0dc9d=_[_0xddb8('0x3c')]({},_0xf0dc9d,_0xfd64b5['options']);var _0x21884c={'where':_0xf0dc9d[_0xddb8('0x38')]};return db['AnalyticCustomReport'][_0xddb8('0x1e')](_0x21884c)[_0xddb8('0x23')](function(_0xbf27ef){_0x110614[_0xddb8('0x1e')]=_0xbf27ef;if(_0xfd64b5[_0xddb8('0x30')][_0xddb8('0x3d')]){_0xf0dc9d['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0xf0dc9d);})[_0xddb8('0x23')](function(_0x2b4b47){_0x110614[_0xddb8('0x3e')]=_0x2b4b47;return _0x110614;})[_0xddb8('0x23')](respondWithFilteredResult(_0x521757,_0xf0dc9d))[_0xddb8('0x3f')](handleError(_0x521757,null));};exports[_0xddb8('0x40')]=function(_0x3a89b8,_0x1e8bd1){var _0x395b51={'raw':![],'where':{'id':_0x3a89b8[_0xddb8('0x41')]['id']}},_0x4e5786={};_0x4e5786[_0xddb8('0x2f')]=_['keys'](db['AnalyticCustomReport'][_0xddb8('0x2c')]);_0x4e5786[_0xddb8('0x30')]=_[_0xddb8('0x42')](_0x3a89b8[_0xddb8('0x30')]);_0x4e5786['filters']=_[_0xddb8('0x32')](_0x4e5786[_0xddb8('0x2f')],_0x4e5786[_0xddb8('0x30')]);_0x395b51[_0xddb8('0x33')]=_[_0xddb8('0x32')](_0x4e5786['model'],qs[_0xddb8('0x34')](_0x3a89b8['query'][_0xddb8('0x34')]));_0x395b51[_0xddb8('0x33')]=_0x395b51['attributes'][_0xddb8('0x35')]?_0x395b51['attributes']:_0x4e5786[_0xddb8('0x2f')];if(_0x3a89b8['query'][_0xddb8('0x3d')]){_0x395b51[_0xddb8('0x43')]=[{'all':!![]}];}_0x395b51=_['merge']({},_0x395b51,_0x3a89b8['options']);return db[_0xddb8('0x2b')]['find'](_0x395b51)['then'](handleEntityNotFound(_0x1e8bd1,null))[_0xddb8('0x23')](respondWithResult(_0x1e8bd1,null))[_0xddb8('0x3f')](handleError(_0x1e8bd1,null));};exports[_0xddb8('0x44')]=function(_0x1bede5,_0xd6b198){return db[_0xddb8('0x2b')][_0xddb8('0x44')](_0x1bede5[_0xddb8('0x45')],{})[_0xddb8('0x23')](function(_0x26b648){var _0x5bfca9=_0x1bede5[_0xddb8('0x46')][_0xddb8('0x25')]({'plain':!![]});if(!_0x5bfca9)throw new Error(_0xddb8('0x47'));if(_0x5bfca9[_0xddb8('0x48')]===_0xddb8('0x46')){var _0xd807f7=_0x26b648[_0xddb8('0x25')]({'plain':!![]});var _0x354766=_0xddb8('0x49');return db[_0xddb8('0x4a')][_0xddb8('0x4b')]({'where':{'name':_0x354766,'userProfileId':_0x5bfca9['userProfileId']},'raw':!![]})['then'](function(_0x5e4ab6){if(_0x5e4ab6&&_0x5e4ab6[_0xddb8('0x4c')]===0x0){return db[_0xddb8('0x26')]['create']({'name':_0xd807f7[_0xddb8('0x29')],'resourceId':_0xd807f7['id'],'type':_0xddb8('0x4d'),'sectionId':_0x5e4ab6['id']},{})['then'](function(){return _0x26b648;});}else{return _0x26b648;}})['catch'](function(_0x4566bd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4566bd);throw _0x4566bd;});}return _0x26b648;})[_0xddb8('0x23')](respondWithResult(_0xd6b198,0xc9))[_0xddb8('0x3f')](handleError(_0xd6b198,null));};exports[_0xddb8('0x22')]=function(_0x44c962,_0x4a5000){if(_0x44c962['body']['id']){delete _0x44c962[_0xddb8('0x45')]['id'];}return db[_0xddb8('0x2b')][_0xddb8('0x4b')]({'where':{'id':_0x44c962['params']['id']}})[_0xddb8('0x23')](handleEntityNotFound(_0x4a5000,null))['then'](saveUpdates(_0x44c962[_0xddb8('0x45')],null))[_0xddb8('0x23')](respondWithResult(_0x4a5000,null))[_0xddb8('0x3f')](handleError(_0x4a5000,null));};exports['destroy']=function(_0x5a99c3,_0xd8e2b8){return db[_0xddb8('0x2b')]['find']({'where':{'id':_0x5a99c3['params']['id']}})[_0xddb8('0x23')](handleEntityNotFound(_0xd8e2b8,null))[_0xddb8('0x23')](removeEntity(_0xd8e2b8,null))['catch'](handleError(_0xd8e2b8,null));};exports[_0xddb8('0x4e')]=function(_0x300749,_0x5da048){var _0x5cfbb2=0xa;var _0x4687bd=[_0xddb8('0x4f'),_0xddb8('0x50'),'right_join','cross_join'];var _0xcee83={'SUM':'SUM(%s)','COUNT':_0xddb8('0x51'),'COUNT DISTINCT':_0xddb8('0x52'),'MAX':_0xddb8('0x53'),'MIN':_0xddb8('0x54'),'AVG':_0xddb8('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xddb8('0x56'),'GROUP_CONCAT DESC':_0xddb8('0x57')};var _0x13bc0e={'SEC_TO_TIME':_0xddb8('0x58'),'DATE':_0xddb8('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xddb8('0x5a'),'UNIX_TIMESTAMP':_0xddb8('0x5b')};var _0x46318a=function(_0x3d61cf){return!_[_0xddb8('0x5c')]([_0xddb8('0x5d'),_0xddb8('0x5e'),'IS\x20EMPTY',_0xddb8('0x5f')],_0x3d61cf);};var _0x1d18fc=function(_0x2c9222){if(!_0x2c9222||!_0x2c9222[_0xddb8('0x60')][_0xddb8('0x35')]){return'';}for(var _0x266de0='(',_0x3d19ba=0x0;_0x3d19ba<_0x2c9222[_0xddb8('0x60')][_0xddb8('0x35')];_0x3d19ba+=0x1){_0x3d19ba>0x0&&(_0x266de0+='\x20'+_0x2c9222[_0xddb8('0x61')]+'\x20');_0x266de0+=_0x2c9222[_0xddb8('0x60')][_0x3d19ba][_0xddb8('0x62')]?_0x1d18fc(_0x2c9222[_0xddb8('0x60')][_0x3d19ba][_0xddb8('0x62')]):_0x2c9222[_0xddb8('0x60')][_0x3d19ba][_0xddb8('0x63')]+'\x20'+_0x2c9222['rules'][_0x3d19ba][_0xddb8('0x64')]+(_0x46318a(_0x2c9222['rules'][_0x3d19ba]['condition'])?'\x20'+_0x2c9222[_0xddb8('0x60')][_0x3d19ba]['value']:'');}return _0x266de0+')';};var _0x499fa7={'where':{'id':_0x300749[_0xddb8('0x41')]['id']}},_0x2c7f9b,_0x49fb8a,_0x249d0f,_0x1e46a9,_0x581fcd;_0x499fa7=_[_0xddb8('0x3c')]({},_0x499fa7,_0x300749[_0xddb8('0x65')]);return db[_0xddb8('0x2b')][_0xddb8('0x4b')](_0x499fa7)[_0xddb8('0x23')](function(_0x26e13e){if(_0x26e13e){_0x2c7f9b=_0x26e13e;return _0x26e13e[_0xddb8('0x66')]();}return null;})['then'](function(_0x13afac){if(_0x13afac){if(!_0x13afac['length']){throw new db['Sequelize'][(_0xddb8('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x49fb8a=_0x13afac;return db[_0xddb8('0x68')][_0xddb8('0x69')]({'raw':!![]});}return null;})[_0xddb8('0x23')](function(_0x4c7b47){if(_0x4c7b47){_0x249d0f=_[_0xddb8('0x6a')](_0x4c7b47,'id');var _0x3b9c15;var _0x5dbbc4=squel['select']();_0x5dbbc4[_0xddb8('0x6b')](_0x2c7f9b[_0xddb8('0x6c')]);for(var _0x5e10a8=0x0;_0x5e10a8<_0x49fb8a[_0xddb8('0x35')];_0x5e10a8+=0x1){_0x3b9c15=_0x49fb8a[_0x5e10a8][_0xddb8('0x6d')]?_0x249d0f[_0x49fb8a[_0x5e10a8][_0xddb8('0x6d')]][_0xddb8('0x6e')]:_0x49fb8a[_0x5e10a8]['field'];_0x3b9c15=_0x49fb8a[_0x5e10a8]['function']?_[_0xddb8('0x6f')](_0xcee83[_0x49fb8a[_0x5e10a8]['function']],'%s',_0x3b9c15):_0x3b9c15;_0x3b9c15=_0x49fb8a[_0x5e10a8][_0xddb8('0x70')]?_[_0xddb8('0x6f')](_0x13bc0e[_0x49fb8a[_0x5e10a8][_0xddb8('0x70')]],'%s',_0x3b9c15):_0x3b9c15;if(_0x49fb8a[_0x5e10a8][_0xddb8('0x71')]){_0x5dbbc4[_0xddb8('0x62')](_0x3b9c15);}_0x49fb8a[_0x5e10a8]['orderBy']&&_0x5dbbc4['order'](_0x3b9c15,_0x49fb8a[_0x5e10a8][_0xddb8('0x72')]===_0xddb8('0x73')?![]:!![]);_0x5dbbc4['field'](_0x3b9c15,_0x49fb8a[_0x5e10a8][_0xddb8('0x74')]||_0x3b9c15);}if(_0x2c7f9b[_0xddb8('0x75')]){_0x2c7f9b[_0xddb8('0x75')]=JSON[_0xddb8('0x76')](_0x2c7f9b[_0xddb8('0x75')]);for(var _0x20f548=0x0;_0x20f548<_0x2c7f9b['joins'][_0xddb8('0x35')];_0x20f548+=0x1){if(_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x2d')]&&_[_0xddb8('0x5c')](_0x4687bd,_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x2d')])&&_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x77')]&&_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x78')]&&_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x79')]){_0x5dbbc4[_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x2d')]](_0x2c7f9b['joins'][_0x20f548][_0xddb8('0x78')],null,util[_0xddb8('0x70')](_0xddb8('0x7a'),_0x2c7f9b[_0xddb8('0x6c')],_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x77')],_0x2c7f9b[_0xddb8('0x75')][_0x20f548]['foreignTable'],_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x79')]));}}}if(_0x2c7f9b[_0xddb8('0x7b')]){_0x2c7f9b[_0xddb8('0x7b')]=JSON[_0xddb8('0x76')](_0x2c7f9b[_0xddb8('0x7b')]);_0x5dbbc4['where'](_0x1d18fc(_0x2c7f9b[_0xddb8('0x7b')][_0xddb8('0x62')]));}_0x581fcd=_0x5dbbc4[_0xddb8('0x7c')]();_0x5dbbc4[_0xddb8('0x1c')](_0x5cfbb2);_0x5dbbc4[_0xddb8('0x1b')](0x0);logger[_0xddb8('0x7d')]('Limited\x20Query:',_0x5dbbc4[_0xddb8('0x7e')]());return dbH[_0xddb8('0x7f')]['query'](_0x5dbbc4[_0xddb8('0x7e')](),{'type':dbH[_0xddb8('0x7f')]['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x5da048,null))[_0xddb8('0x3f')](handleError(_0x5da048,null));};function runReport(_0x20bc25,_0x2a8df5,_0x6eee1d){var _0xccb1f8=_0x2a8df5[_0xddb8('0x29')];var _0x536385=0xa;var _0x4bedd2=[_0xddb8('0x4f'),'left_join',_0xddb8('0x80'),_0xddb8('0x81')];var _0x451711={'SUM':_0xddb8('0x82'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xddb8('0x52'),'MAX':_0xddb8('0x53'),'MIN':_0xddb8('0x54'),'AVG':_0xddb8('0x55'),'GROUP_CONCAT':_0xddb8('0x83'),'GROUP_CONCAT ASC':_0xddb8('0x56'),'GROUP_CONCAT DESC':_0xddb8('0x57')};var _0x571a0b={'SEC_TO_TIME':_0xddb8('0x58'),'DATE':_0xddb8('0x59'),'HOUR':_0xddb8('0x84'),'ROUND':_0xddb8('0x5a'),'UNIX_TIMESTAMP':_0xddb8('0x5b')};var _0x505259=function(_0x2fc2b6){return!_[_0xddb8('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xddb8('0x5f')],_0x2fc2b6);};var _0x2849a3=function(_0x3a515c){if(!_0x3a515c||!_0x3a515c[_0xddb8('0x60')][_0xddb8('0x35')]){return'';}for(var _0x59fb1a='(',_0x510ab8=0x0;_0x510ab8<_0x3a515c['rules'][_0xddb8('0x35')];_0x510ab8+=0x1){_0x510ab8>0x0&&(_0x59fb1a+='\x20'+_0x3a515c[_0xddb8('0x61')]+'\x20');_0x59fb1a+=_0x3a515c[_0xddb8('0x60')][_0x510ab8]['group']?_0x2849a3(_0x3a515c['rules'][_0x510ab8][_0xddb8('0x62')]):_0x3a515c[_0xddb8('0x60')][_0x510ab8][_0xddb8('0x63')]+'\x20'+_0x3a515c[_0xddb8('0x60')][_0x510ab8][_0xddb8('0x64')]+(_0x505259(_0x3a515c[_0xddb8('0x60')][_0x510ab8][_0xddb8('0x64')])?'\x20'+_0x3a515c['rules'][_0x510ab8][_0xddb8('0x85')]:'');}return _0x59fb1a+')';};var _0x51f9a7={'where':{'id':_0x20bc25['id']}},_0x5af679,_0xd28dde,_0x3eae35,_0x5a86ca,_0x11a881;_0x51f9a7=_[_0xddb8('0x3c')]({},_0x51f9a7,_0x6eee1d);return db[_0xddb8('0x2b')][_0xddb8('0x4b')](_0x51f9a7)['then'](function(_0x2119bf){if(_0x2119bf){_0x5af679=_0x2119bf;return _0x2119bf[_0xddb8('0x66')]();}return null;})['then'](function(_0x4c504b){if(_0x4c504b){if(!_0x4c504b[_0xddb8('0x35')]){throw new db[(_0xddb8('0x86'))][(_0xddb8('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xd28dde=_0x4c504b;return db[_0xddb8('0x68')]['findAll']({'raw':!![]});}return null;})[_0xddb8('0x23')](function(_0x331385){if(_0x331385){_0x3eae35=_[_0xddb8('0x6a')](_0x331385,'id');var _0x8a6a29;var _0x495596=squel[_0xddb8('0x87')]();_0x495596[_0xddb8('0x6b')](_0x5af679['table']);for(var _0x4a0e66=0x0;_0x4a0e66<_0xd28dde[_0xddb8('0x35')];_0x4a0e66+=0x1){_0x8a6a29=_0xd28dde[_0x4a0e66]['MetricId']?_0x3eae35[_0xd28dde[_0x4a0e66][_0xddb8('0x6d')]][_0xddb8('0x6e')]:_0xd28dde[_0x4a0e66][_0xddb8('0x63')];_0x8a6a29=_0xd28dde[_0x4a0e66]['function']?_[_0xddb8('0x6f')](_0x451711[_0xd28dde[_0x4a0e66][_0xddb8('0x88')]],'%s',_0x8a6a29):_0x8a6a29;_0x8a6a29=_0xd28dde[_0x4a0e66][_0xddb8('0x70')]?_[_0xddb8('0x6f')](_0x571a0b[_0xd28dde[_0x4a0e66][_0xddb8('0x70')]],'%s',_0x8a6a29):_0x8a6a29;if(_0xd28dde[_0x4a0e66]['groupBy']){_0x495596['group'](_0x8a6a29);}_0xd28dde[_0x4a0e66][_0xddb8('0x72')]&&_0x495596[_0xddb8('0x36')](_0x8a6a29,_0xd28dde[_0x4a0e66][_0xddb8('0x72')]===_0xddb8('0x73')?![]:!![]);_0x495596[_0xddb8('0x63')](_0x8a6a29,_0xd28dde[_0x4a0e66][_0xddb8('0x74')]||_0x8a6a29);}if(_0x5af679[_0xddb8('0x75')]){_0x5af679[_0xddb8('0x75')]=JSON[_0xddb8('0x76')](_0x5af679[_0xddb8('0x75')]);for(var _0x320c52=0x0;_0x320c52<_0x5af679[_0xddb8('0x75')][_0xddb8('0x35')];_0x320c52+=0x1){if(_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x2d')]&&_[_0xddb8('0x5c')](_0x4bedd2,_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x2d')])&&_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x77')]&&_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x78')]&&_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x79')]){_0x495596[_0x5af679['joins'][_0x320c52][_0xddb8('0x2d')]](_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5af679[_0xddb8('0x6c')],_0x5af679['joins'][_0x320c52][_0xddb8('0x77')],_0x5af679[_0xddb8('0x75')][_0x320c52]['foreignTable'],_0x5af679[_0xddb8('0x75')][_0x320c52]['foreignKey']));}}}if(_0x5af679[_0xddb8('0x7b')]){_0x5af679[_0xddb8('0x7b')]=JSON['parse'](_0x5af679[_0xddb8('0x7b')]);_0x495596[_0xddb8('0x38')](_0x2849a3(_0x5af679[_0xddb8('0x7b')][_0xddb8('0x62')]));}_0x11a881=_0x495596[_0xddb8('0x7c')]();_0x495596[_0xddb8('0x1c')](_0x536385);_0x495596[_0xddb8('0x1b')](0x0);return;}})[_0xddb8('0x23')](function(){if(_0x2a8df5[_0xddb8('0x89')]===_0xddb8('0x8a')){return null;}var _0x9305df=_[_0xddb8('0x3c')](_0x2a8df5,{'name':_0x2a8df5[_0xddb8('0x8b')]||_0x2a8df5['name']||_0x5af679[_0xddb8('0x29')],'basename':_0xccb1f8,'savename':util[_0xddb8('0x70')]('%s-%s.%s',_0x2a8df5['name']||_0x5af679[_0xddb8('0x29')],require(_0xddb8('0x8c'))[_0xddb8('0x8d')](0x4),_0x2a8df5[_0xddb8('0x89')]||_0xddb8('0x8e')),'reportId':_0x5af679['id'],'reportType':'custom'});return db[_0xddb8('0x8f')]['create'](_0x9305df,{'raw':!![]});})[_0xddb8('0x23')](function(_0x308d58){if(_0x5af679[_0xddb8('0x6c')]===_0xddb8('0x90')){_0x11a881[_0xddb8('0x38')](_0x5af679['table']+_0xddb8('0x91'),_0x2a8df5['startDate'],_0x2a8df5['endDate']);}else{_0x11a881[_0xddb8('0x38')](_0x5af679[_0xddb8('0x6c')]+_0xddb8('0x92'),_0x2a8df5['startDate'],_0x2a8df5[_0xddb8('0x93')]);}if(_0x308d58){logger['info'](_0xddb8('0x94'),_0x11a881[_0xddb8('0x7e')]());require('child_process')[_0xddb8('0x95')](path[_0xddb8('0x4f')](__dirname,'../../components/export/',_0x308d58[_0xddb8('0x89')]),[_0x308d58['id'],_0x11a881[_0xddb8('0x7e')](),path['join'](__dirname,_0xddb8('0x96'),_0x308d58[_0xddb8('0x97')]),_0xccb1f8]);return _0x308d58;}else{var _0x4ae690=squel[_0xddb8('0x87')]();_0x4ae690[_0xddb8('0x6b')]('('+_0x11a881['toString']()+')',_0xddb8('0x98'));_0x4ae690[_0xddb8('0x63')]('COUNT(*)',_0xddb8('0x1e'));_0x11a881[_0xddb8('0x1c')](_0x2a8df5['limit']||_0x536385);_0x11a881[_0xddb8('0x1b')](_0x2a8df5['offset']||0x0);return dbH[_0xddb8('0x7f')][_0xddb8('0x30')](_0x4ae690[_0xddb8('0x7e')](),{'type':dbH['sequelize']['QueryTypes'][_0xddb8('0x99')]})[_0xddb8('0x23')](function(_0x2a7ec8){if(!_0x2a7ec8[_0xddb8('0x35')]){_0x5a86ca=0x0;}else{_0x5a86ca=_0x2a7ec8[0x0]['count']||0x0;}return dbH[_0xddb8('0x7f')]['query'](_0x11a881[_0xddb8('0x7e')](),{'type':dbH[_0xddb8('0x7f')][_0xddb8('0x9a')][_0xddb8('0x99')]});})[_0xddb8('0x23')](function(_0x3ae5b5){return{'rows':_0x3ae5b5||[],'count':_0x5a86ca};});}});}exports['run']=function(_0x146b04,_0x272099){return runReport(_0x146b04[_0xddb8('0x41')],_0x146b04[_0xddb8('0x30')],_0x146b04['options'])['then'](respondWithResult(_0x272099,null))[_0xddb8('0x3f')](handleError(_0x272099,null));};exports[_0xddb8('0x9b')]=runReport;exports[_0xddb8('0x30')]=function(_0x2a5eee,_0x3ba098){var _0x1a358a=0xa;var _0x165889=[_0xddb8('0x4f'),'left_join',_0xddb8('0x80'),_0xddb8('0x81')];var _0x32c8a0={'SUM':'SUM(%s)','COUNT':_0xddb8('0x51'),'COUNT DISTINCT':_0xddb8('0x52'),'MAX':_0xddb8('0x53'),'MIN':_0xddb8('0x54'),'AVG':_0xddb8('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xddb8('0x56'),'GROUP_CONCAT DESC':_0xddb8('0x57')};var _0x447262={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xddb8('0x84'),'ROUND':_0xddb8('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x186959=function(_0x235fdf){return!_[_0xddb8('0x5c')]([_0xddb8('0x5d'),_0xddb8('0x5e'),'IS\x20EMPTY',_0xddb8('0x5f')],_0x235fdf);};var _0x57c5e7=function(_0x24c753){if(!_0x24c753||!_0x24c753[_0xddb8('0x60')][_0xddb8('0x35')]){return'';}for(var _0x55c730='(',_0xc18a60=0x0;_0xc18a60<_0x24c753[_0xddb8('0x60')][_0xddb8('0x35')];_0xc18a60+=0x1){_0xc18a60>0x0&&(_0x55c730+='\x20'+_0x24c753[_0xddb8('0x61')]+'\x20');_0x55c730+=_0x24c753['rules'][_0xc18a60]['group']?_0x57c5e7(_0x24c753[_0xddb8('0x60')][_0xc18a60][_0xddb8('0x62')]):_0x24c753['rules'][_0xc18a60]['field']+'\x20'+_0x24c753[_0xddb8('0x60')][_0xc18a60][_0xddb8('0x64')]+(_0x186959(_0x24c753[_0xddb8('0x60')][_0xc18a60][_0xddb8('0x64')])?'\x20'+_0x24c753['rules'][_0xc18a60][_0xddb8('0x85')]:'');}return _0x55c730+')';};var _0x22a463={'where':{'id':_0x2a5eee['params']['id']}},_0x43cb18,_0x3be3c0,_0x156524,_0x24b040,_0x2a7200;_0x22a463=_[_0xddb8('0x3c')]({},_0x22a463,_0x2a5eee['options']);return db[_0xddb8('0x2b')][_0xddb8('0x4b')](_0x22a463)[_0xddb8('0x23')](function(_0x50fccd){if(_0x50fccd){_0x43cb18=_0x50fccd;return _0x50fccd[_0xddb8('0x66')]();}return null;})['then'](function(_0xb58b86){if(_0xb58b86){if(!_0xb58b86[_0xddb8('0x35')]){throw new db[(_0xddb8('0x86'))]['ValidationErrorItem'](_0xddb8('0x9c'),0x193);}_0x3be3c0=_0xb58b86;return db[_0xddb8('0x68')][_0xddb8('0x69')]({'raw':!![]});}return null;})[_0xddb8('0x23')](function(_0x3ddddd){if(_0x3ddddd){_0x156524=_[_0xddb8('0x6a')](_0x3ddddd,'id');var _0x3553c8;var _0x37342e=squel[_0xddb8('0x87')]();_0x37342e[_0xddb8('0x6b')](_0x43cb18[_0xddb8('0x6c')]);for(var _0x3fbd7c=0x0;_0x3fbd7c<_0x3be3c0[_0xddb8('0x35')];_0x3fbd7c+=0x1){_0x3553c8=_0x3be3c0[_0x3fbd7c][_0xddb8('0x6d')]?_0x156524[_0x3be3c0[_0x3fbd7c][_0xddb8('0x6d')]]['metric']:_0x3be3c0[_0x3fbd7c][_0xddb8('0x63')];_0x3553c8=_0x3be3c0[_0x3fbd7c][_0xddb8('0x88')]?_[_0xddb8('0x6f')](_0x32c8a0[_0x3be3c0[_0x3fbd7c]['function']],'%s',_0x3553c8):_0x3553c8;_0x3553c8=_0x3be3c0[_0x3fbd7c][_0xddb8('0x70')]?_[_0xddb8('0x6f')](_0x447262[_0x3be3c0[_0x3fbd7c]['format']],'%s',_0x3553c8):_0x3553c8;if(_0x3be3c0[_0x3fbd7c][_0xddb8('0x71')]){_0x37342e[_0xddb8('0x62')](_0x3553c8);}_0x3be3c0[_0x3fbd7c][_0xddb8('0x72')]&&_0x37342e['order'](_0x3553c8,_0x3be3c0[_0x3fbd7c][_0xddb8('0x72')]===_0xddb8('0x73')?![]:!![]);_0x37342e[_0xddb8('0x63')](_0x3553c8,_0x3be3c0[_0x3fbd7c][_0xddb8('0x74')]||_0x3553c8);}if(_0x43cb18[_0xddb8('0x75')]){_0x43cb18[_0xddb8('0x75')]=JSON[_0xddb8('0x76')](_0x43cb18[_0xddb8('0x75')]);for(var _0x27eb61=0x0;_0x27eb61<_0x43cb18[_0xddb8('0x75')]['length'];_0x27eb61+=0x1){if(_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x2d')]&&_[_0xddb8('0x5c')](_0x165889,_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x2d')])&&_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x77')]&&_0x43cb18['joins'][_0x27eb61]['foreignTable']&&_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x79')]){_0x37342e[_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x2d')]](_0x43cb18['joins'][_0x27eb61]['foreignTable'],null,util[_0xddb8('0x70')](_0xddb8('0x7a'),_0x43cb18[_0xddb8('0x6c')],_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x77')],_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x78')],_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x79')]));}}}if(_0x43cb18['conditions']){_0x43cb18['conditions']=JSON['parse'](_0x43cb18[_0xddb8('0x7b')]);_0x37342e[_0xddb8('0x38')](_0x57c5e7(_0x43cb18['conditions']['group']));}_0x2a7200=_0x37342e[_0xddb8('0x7c')]();_0x37342e['limit'](_0x1a358a);_0x37342e[_0xddb8('0x1b')](0x0);logger['debug'](_0xddb8('0x9d'),_0x37342e[_0xddb8('0x7e')]());return dbH[_0xddb8('0x7f')][_0xddb8('0x30')](_0x37342e[_0xddb8('0x7e')](),{'type':dbH[_0xddb8('0x7f')][_0xddb8('0x9a')]['SELECT']});}})['then'](function(){return{'sql':_0x2a7200[_0xddb8('0x7e')]()};})[_0xddb8('0x23')](respondWithResult(_0x3ba098,null))[_0xddb8('0x3f')](handleError(_0x3ba098,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 86ccb84..9975069 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 _0x8305=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x246a11,_0x5c68a6){var _0x593d4d=function(_0x94e370){while(--_0x94e370){_0x246a11['push'](_0x246a11['shift']());}};_0x593d4d(++_0x5c68a6);}(_0x8305,0x15a));var _0x5830=function(_0x1acf79,_0x2cb20f){_0x1acf79=_0x1acf79-0x0;var _0x262ef9=_0x8305[_0x1acf79];return _0x262ef9;};'use strict';var _=require(_0x5830('0x0'));var util=require(_0x5830('0x1'));var logger=require(_0x5830('0x2'))(_0x5830('0x3'));var moment=require(_0x5830('0x4'));var BPromise=require(_0x5830('0x5'));var rp=require(_0x5830('0x6'));var fs=require('fs');var path=require(_0x5830('0x7'));var rimraf=require(_0x5830('0x8'));var config=require(_0x5830('0x9'));var attributes=require(_0x5830('0xa'));module[_0x5830('0xb')]=function(_0x2fa5b0,_0x34b8a3){return _0x2fa5b0[_0x5830('0xc')](_0x5830('0xd'),attributes,{'tableName':_0x5830('0xe'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x674d=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x674d,0x1c5));var _0xd674=function(_0xf47939,_0x124b6a){_0xf47939=_0xf47939-0x0;var _0x5f1ec1=_0x674d[_0xf47939];return _0x5f1ec1;};'use strict';var _=require(_0xd674('0x0'));var util=require(_0xd674('0x1'));var logger=require(_0xd674('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd674('0x3'));var rp=require(_0xd674('0x4'));var fs=require('fs');var path=require(_0xd674('0x5'));var rimraf=require(_0xd674('0x6'));var config=require(_0xd674('0x7'));var attributes=require(_0xd674('0x8'));module[_0xd674('0x9')]=function(_0x451e4f,_0x26ec5d){return _0x451e4f[_0xd674('0xa')](_0xd674('0xb'),attributes,{'tableName':_0xd674('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 efeed80..a9aa098 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 _0xd117=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4bf9aa,_0xafa1ec){var _0x1db38a=function(_0x44540e){while(--_0x44540e){_0x4bf9aa['push'](_0x4bf9aa['shift']());}};_0x1db38a(++_0xafa1ec);}(_0xd117,0xf0));var _0x7d11=function(_0x3dda0f,_0x5b9902){_0x3dda0f=_0x3dda0f-0x0;var _0x1b0488=_0xd117[_0x3dda0f];return _0x1b0488;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d11('0x4'));var db=require(_0x7d11('0x5'))['db'];var utils=require(_0x7d11('0x6'));var logger=require('../../config/logger')(_0x7d11('0x7'));var config=require(_0x7d11('0x8'));var jayson=require(_0x7d11('0x9'));var client=jayson[_0x7d11('0xa')][_0x7d11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11a04f,_0x424f63,_0xc0a984){return new BPromise(function(_0x18cbff,_0xa6f121){return client['request'](_0x11a04f,_0xc0a984)[_0x7d11('0xc')](function(_0x1cd3c6){logger[_0x7d11('0xd')](_0x7d11('0xe'),_0x424f63,'request\x20sent');logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x424f63,_0x7d11('0x11'),JSON[_0x7d11('0x12')](_0x1cd3c6));if(_0x1cd3c6[_0x7d11('0x13')]){if(_0x1cd3c6['error'][_0x7d11('0x14')]===0x1f4){logger[_0x7d11('0x13')](_0x7d11('0xe'),_0x424f63,_0x1cd3c6[_0x7d11('0x13')]['message']);return _0xa6f121(_0x1cd3c6['error'][_0x7d11('0x15')]);}logger[_0x7d11('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x424f63,_0x1cd3c6['error'][_0x7d11('0x15')]);return _0x18cbff(_0x1cd3c6['error'][_0x7d11('0x15')]);}else{logger[_0x7d11('0xd')](_0x7d11('0xe'),_0x424f63,'request\x20sent');_0x18cbff(_0x1cd3c6[_0x7d11('0x16')][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x1fb132){logger[_0x7d11('0x13')](_0x7d11('0xe'),_0x424f63,_0x1fb132);_0xa6f121(_0x1fb132);});});} \ No newline at end of file +var _0x1147=['client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x54bbf0,_0x218cef){var _0x1e54ac=function(_0x31a233){while(--_0x31a233){_0x54bbf0['push'](_0x54bbf0['shift']());}};_0x1e54ac(++_0x218cef);}(_0x1147,0x12a));var _0x7114=function(_0x18ec8d,_0xe7f6be){_0x18ec8d=_0x18ec8d-0x0;var _0x2b162e=_0x1147[_0x18ec8d];return _0x2b162e;};'use strict';var _=require('lodash');var util=require(_0x7114('0x0'));var moment=require(_0x7114('0x1'));var BPromise=require(_0x7114('0x2'));var rs=require(_0x7114('0x3'));var fs=require('fs');var Redis=require(_0x7114('0x4'));var db=require(_0x7114('0x5'))['db'];var utils=require(_0x7114('0x6'));var logger=require('../../config/logger')(_0x7114('0x7'));var config=require(_0x7114('0x8'));var jayson=require(_0x7114('0x9'));var client=jayson[_0x7114('0xa')][_0x7114('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24b175,_0xb5170f,_0x172977){return new BPromise(function(_0x4fc97d,_0xd6da87){return client[_0x7114('0xc')](_0x24b175,_0x172977)[_0x7114('0xd')](function(_0x38f9dd){logger['info'](_0x7114('0xe'),_0xb5170f,_0x7114('0xf'));logger[_0x7114('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xb5170f,'request\x20sent',JSON[_0x7114('0x11')](_0x38f9dd));if(_0x38f9dd['error']){if(_0x38f9dd['error']['code']===0x1f4){logger[_0x7114('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xb5170f,_0x38f9dd[_0x7114('0x12')][_0x7114('0x13')]);return _0xd6da87(_0x38f9dd[_0x7114('0x12')][_0x7114('0x13')]);}logger[_0x7114('0x12')](_0x7114('0xe'),_0xb5170f,_0x38f9dd[_0x7114('0x12')][_0x7114('0x13')]);return _0x4fc97d(_0x38f9dd['error']['message']);}else{logger['info'](_0x7114('0xe'),_0xb5170f,_0x7114('0xf'));_0x4fc97d(_0x38f9dd[_0x7114('0x14')][_0x7114('0x13')]);}})[_0x7114('0x15')](function(_0xb0b9a6){logger[_0x7114('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xb5170f,_0xb0b9a6);_0xd6da87(_0xb0b9a6);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 54aa3ae..d77e840 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 _0x27a9=['fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','/:id/query','post','create','update','/:id','destroy','multer','util','path','connect-timeout','Router'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x27a9,0x119));var _0x927a=function(_0x1bf8b1,_0x1b11cd){_0x1bf8b1=_0x1bf8b1-0x0;var _0x37fb94=_0x27a9[_0x1bf8b1];return _0x37fb94;};'use strict';var multer=require(_0x927a('0x0'));var util=require(_0x927a('0x1'));var path=require(_0x927a('0x2'));var timeout=require(_0x927a('0x3'));var express=require('express');var router=express[_0x927a('0x4')]();var fs_extra=require(_0x927a('0x5'));var auth=require(_0x927a('0x6'));var interaction=require(_0x927a('0x7'));var config=require('../../config/environment');var controller=require(_0x927a('0x8'));router[_0x927a('0x9')]('/',auth[_0x927a('0xa')](),controller[_0x927a('0xb')]);router['get']('/:id',auth[_0x927a('0xa')](),controller[_0x927a('0xc')]);router['get'](_0x927a('0xd'),auth[_0x927a('0xa')](),controller[_0x927a('0xe')]);router[_0x927a('0x9')](_0x927a('0xf'),auth[_0x927a('0xa')](),controller['run']);router[_0x927a('0x9')](_0x927a('0x10'),auth[_0x927a('0xa')](),controller['query']);router[_0x927a('0x11')]('/',auth[_0x927a('0xa')](),controller[_0x927a('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x927a('0x13')]);router['delete'](_0x927a('0x14'),auth[_0x927a('0xa')](),controller[_0x927a('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd676=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','post','create','put'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xd676,0x76));var _0x6d67=function(_0xaefa77,_0x34c56d){_0xaefa77=_0xaefa77-0x0;var _0x159f15=_0xd676[_0xaefa77];return _0x159f15;};'use strict';var multer=require(_0x6d67('0x0'));var util=require('util');var path=require(_0x6d67('0x1'));var timeout=require(_0x6d67('0x2'));var express=require(_0x6d67('0x3'));var router=express['Router']();var fs_extra=require(_0x6d67('0x4'));var auth=require(_0x6d67('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6d67('0x6'));var controller=require(_0x6d67('0x7'));router[_0x6d67('0x8')]('/',auth[_0x6d67('0x9')](),controller[_0x6d67('0xa')]);router[_0x6d67('0x8')](_0x6d67('0xb'),auth[_0x6d67('0x9')](),controller[_0x6d67('0xc')]);router[_0x6d67('0x8')](_0x6d67('0xd'),auth['isAuthenticated'](),controller[_0x6d67('0xe')]);router[_0x6d67('0x8')]('/:id/run',auth[_0x6d67('0x9')](),controller[_0x6d67('0xf')]);router[_0x6d67('0x8')](_0x6d67('0x10'),auth[_0x6d67('0x9')](),controller['query']);router[_0x6d67('0x11')]('/',auth['isAuthenticated'](),controller[_0x6d67('0x12')]);router[_0x6d67('0x13')](_0x6d67('0xb'),auth['isAuthenticated'](),controller[_0x6d67('0x14')]);router[_0x6d67('0x15')](_0x6d67('0xb'),auth[_0x6d67('0x9')](),controller[_0x6d67('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 51c8207..a423f21 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 _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0x5075,0x73));var _0x5507=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x5075[_0x1911ed];return _0x11edaa;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2eb2=['TEXT','exports','STRING'];(function(_0x39194a,_0x10366c){var _0x21af77=function(_0x6e421b){while(--_0x6e421b){_0x39194a['push'](_0x39194a['shift']());}};_0x21af77(++_0x10366c);}(_0x2eb2,0x19f));var _0x22eb=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2eb2[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c71d77b..7fb311f 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 _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x3588ef,_0x2bca77){var _0x891e61=function(_0x3f9dec){while(--_0x3f9dec){_0x3588ef['push'](_0x3588ef['shift']());}};_0x891e61(++_0x2bca77);}(_0x31f0,0xb7));var _0x031f=function(_0x4b7a17,_0x2e992f){_0x4b7a17=_0x4b7a17-0x0;var _0x19088d=_0x31f0[_0x4b7a17];return _0x19088d;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file +var _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x4c8dfa,_0xd9c68b){var _0x2ec23b=function(_0x3e151b){while(--_0x3e151b){_0x4c8dfa['push'](_0x4c8dfa['shift']());}};_0x2ec23b(++_0xd9c68b);}(_0x46ed,0x168));var _0xd46e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x46ed[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 9f47184..6168eab 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 _0x9ac9=['bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','api','moment'];(function(_0xf67b48,_0x879184){var _0x1f1f25=function(_0x938741){while(--_0x938741){_0xf67b48['push'](_0xf67b48['shift']());}};_0x1f1f25(++_0x879184);}(_0x9ac9,0xa2));var _0x99ac=function(_0x89e14f,_0x253300){_0x89e14f=_0x89e14f-0x0;var _0x360088=_0x9ac9[_0x89e14f];return _0x360088;};'use strict';var _=require(_0x99ac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x99ac('0x1'));var moment=require(_0x99ac('0x2'));var BPromise=require(_0x99ac('0x3'));var rp=require(_0x99ac('0x4'));var fs=require('fs');var path=require(_0x99ac('0x5'));var rimraf=require('rimraf');var config=require(_0x99ac('0x6'));var attributes=require(_0x99ac('0x7'));module['exports']=function(_0x156fed,_0x11e410){return _0x156fed[_0x99ac('0x8')](_0x99ac('0x9'),attributes,{'tableName':_0x99ac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefcd=['analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport'];(function(_0x3539ba,_0x16846e){var _0x10b176=function(_0x36a5a5){while(--_0x36a5a5){_0x3539ba['push'](_0x3539ba['shift']());}};_0x10b176(++_0x16846e);}(_0xefcd,0xb7));var _0xdefc=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xefcd[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xdefc('0x0'));var util=require('util');var logger=require(_0xdefc('0x1'))(_0xdefc('0x2'));var moment=require(_0xdefc('0x3'));var BPromise=require(_0xdefc('0x4'));var rp=require(_0xdefc('0x5'));var fs=require('fs');var path=require(_0xdefc('0x6'));var rimraf=require(_0xdefc('0x7'));var config=require(_0xdefc('0x8'));var attributes=require(_0xdefc('0x9'));module['exports']=function(_0x4ead0f,_0x2b40b6){return _0x4ead0f[_0xdefc('0xa')](_0xdefc('0xb'),attributes,{'tableName':_0xdefc('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 4f8d551..977874d 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 _0x123a=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x123a,0xbf));var _0xa123=function(_0x55a440,_0x5dacbc){_0x55a440=_0x55a440-0x0;var _0x1561b9=_0x123a[_0x55a440];return _0x1561b9;};'use strict';var _=require(_0xa123('0x0'));var util=require(_0xa123('0x1'));var moment=require(_0xa123('0x2'));var BPromise=require('bluebird');var rs=require(_0xa123('0x3'));var fs=require('fs');var Redis=require(_0xa123('0x4'));var db=require(_0xa123('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa123('0x6'))(_0xa123('0x7'));var config=require(_0xa123('0x8'));var jayson=require(_0xa123('0x9'));var client=jayson[_0xa123('0xa')][_0xa123('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ca97d,_0x308284,_0x143999){return new BPromise(function(_0xa01cf3,_0x2c1f08){return client[_0xa123('0xc')](_0x2ca97d,_0x143999)[_0xa123('0xd')](function(_0x51d5a1){logger[_0xa123('0xe')](_0xa123('0xf'),_0x308284,_0xa123('0x10'));logger[_0xa123('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x308284,_0xa123('0x10'),JSON[_0xa123('0x12')](_0x51d5a1));if(_0x51d5a1[_0xa123('0x13')]){if(_0x51d5a1[_0xa123('0x13')][_0xa123('0x14')]===0x1f4){logger[_0xa123('0x13')](_0xa123('0xf'),_0x308284,_0x51d5a1[_0xa123('0x13')][_0xa123('0x15')]);return _0x2c1f08(_0x51d5a1[_0xa123('0x13')][_0xa123('0x15')]);}logger[_0xa123('0x13')](_0xa123('0xf'),_0x308284,_0x51d5a1[_0xa123('0x13')][_0xa123('0x15')]);return _0xa01cf3(_0x51d5a1[_0xa123('0x13')][_0xa123('0x15')]);}else{logger['info'](_0xa123('0xf'),_0x308284,'request\x20sent');_0xa01cf3(_0x51d5a1[_0xa123('0x16')][_0xa123('0x15')]);}})[_0xa123('0x17')](function(_0x4d5545){logger[_0xa123('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x308284,_0x4d5545);_0x2c1f08(_0x4d5545);});});} \ No newline at end of file +var _0x1807=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','ioredis'];(function(_0x41294a,_0x2c4e3e){var _0x3231f1=function(_0x3a2c38){while(--_0x3a2c38){_0x41294a['push'](_0x41294a['shift']());}};_0x3231f1(++_0x2c4e3e);}(_0x1807,0xb9));var _0x7180=function(_0x2feffe,_0x104382){_0x2feffe=_0x2feffe-0x0;var _0x190bb3=_0x1807[_0x2feffe];return _0x190bb3;};'use strict';var _=require(_0x7180('0x0'));var util=require(_0x7180('0x1'));var moment=require(_0x7180('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7180('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7180('0x4'));var logger=require(_0x7180('0x5'))('rpc');var config=require(_0x7180('0x6'));var jayson=require(_0x7180('0x7'));var client=jayson['client'][_0x7180('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c11d0,_0x18ac74,_0x5aa8a9){return new BPromise(function(_0x100e63,_0x22628c){return client[_0x7180('0x9')](_0x5c11d0,_0x5aa8a9)[_0x7180('0xa')](function(_0x452644){logger['info'](_0x7180('0xb'),_0x18ac74,_0x7180('0xc'));logger[_0x7180('0xd')](_0x7180('0xe'),_0x18ac74,_0x7180('0xc'),JSON[_0x7180('0xf')](_0x452644));if(_0x452644[_0x7180('0x10')]){if(_0x452644[_0x7180('0x10')]['code']===0x1f4){logger[_0x7180('0x10')](_0x7180('0xb'),_0x18ac74,_0x452644[_0x7180('0x10')][_0x7180('0x11')]);return _0x22628c(_0x452644[_0x7180('0x10')][_0x7180('0x11')]);}logger[_0x7180('0x10')](_0x7180('0xb'),_0x18ac74,_0x452644[_0x7180('0x10')][_0x7180('0x11')]);return _0x100e63(_0x452644[_0x7180('0x10')][_0x7180('0x11')]);}else{logger[_0x7180('0x12')](_0x7180('0xb'),_0x18ac74,'request\x20sent');_0x100e63(_0x452644[_0x7180('0x13')][_0x7180('0x11')]);}})[_0x7180('0x14')](function(_0x5a1a3c){logger[_0x7180('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x18ac74,_0x5a1a3c);_0x22628c(_0x5a1a3c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index afe9638..dfbb907 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 _0x7a7d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','/:id/run','query','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x266c74,_0x1f219c){var _0x4c2afe=function(_0x2b9cd3){while(--_0x2b9cd3){_0x266c74['push'](_0x266c74['shift']());}};_0x4c2afe(++_0x1f219c);}(_0x7a7d,0x165));var _0xd7a7=function(_0x104ffe,_0x4babd3){_0x104ffe=_0x104ffe-0x0;var _0x5b6831=_0x7a7d[_0x104ffe];return _0x5b6831;};'use strict';var multer=require('multer');var util=require(_0xd7a7('0x0'));var path=require(_0xd7a7('0x1'));var timeout=require(_0xd7a7('0x2'));var express=require(_0xd7a7('0x3'));var router=express['Router']();var fs_extra=require(_0xd7a7('0x4'));var auth=require(_0xd7a7('0x5'));var interaction=require(_0xd7a7('0x6'));var config=require(_0xd7a7('0x7'));var controller=require(_0xd7a7('0x8'));router['get']('/',auth[_0xd7a7('0x9')](),controller['index']);router[_0xd7a7('0xa')](_0xd7a7('0xb'),auth['isAuthenticated'](),controller[_0xd7a7('0xc')]);router['get'](_0xd7a7('0xd'),auth[_0xd7a7('0x9')](),controller[_0xd7a7('0xe')]);router['get'](_0xd7a7('0xf'),auth[_0xd7a7('0x9')](),controller['run']);router[_0xd7a7('0xa')]('/:id/query',auth['isAuthenticated'](),controller[_0xd7a7('0x10')]);router[_0xd7a7('0x11')]('/',auth['isAuthenticated'](),controller[_0xd7a7('0x12')]);router[_0xd7a7('0x13')](_0xd7a7('0xb'),auth[_0xd7a7('0x9')](),controller[_0xd7a7('0x14')]);router[_0xd7a7('0x15')](_0xd7a7('0xb'),auth[_0xd7a7('0x9')](),controller[_0xd7a7('0x16')]);module[_0xd7a7('0x17')]=router; \ No newline at end of file +var _0x524a=['index','/:id','/:id/preview','isAuthenticated','/:id/run','run','/:id/query','query','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x59f79c,_0x5b7ac2){var _0x16eb4f=function(_0x282450){while(--_0x282450){_0x59f79c['push'](_0x59f79c['shift']());}};_0x16eb4f(++_0x5b7ac2);}(_0x524a,0xa4));var _0xa524=function(_0x29026c,_0x5a1f6f){_0x29026c=_0x29026c-0x0;var _0x1be1d9=_0x524a[_0x29026c];return _0x1be1d9;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require(_0xa524('0x4'));var router=express[_0xa524('0x5')]();var fs_extra=require(_0xa524('0x6'));var auth=require(_0xa524('0x7'));var interaction=require(_0xa524('0x8'));var config=require(_0xa524('0x9'));var controller=require(_0xa524('0xa'));router[_0xa524('0xb')]('/',auth['isAuthenticated'](),controller[_0xa524('0xc')]);router[_0xa524('0xb')](_0xa524('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa524('0xb')](_0xa524('0xe'),auth[_0xa524('0xf')](),controller['preview']);router[_0xa524('0xb')](_0xa524('0x10'),auth[_0xa524('0xf')](),controller[_0xa524('0x11')]);router[_0xa524('0xb')](_0xa524('0x12'),auth['isAuthenticated'](),controller[_0xa524('0x13')]);router['post']('/',auth[_0xa524('0xf')](),controller['create']);router['put'](_0xa524('0xd'),auth[_0xa524('0xf')](),controller['update']);router[_0xa524('0x14')](_0xa524('0xd'),auth[_0xa524('0xf')](),controller[_0xa524('0x15')]);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 671e678..c90a300 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 _0xe866=['INTEGER','UNSIGNED','moment','exports','STRING','csv','pdf','DATE','Loading','ENUM','manual','scheduled'];(function(_0xc7acfd,_0x39622d){var _0x1d89c4=function(_0x4dbe6a){while(--_0x4dbe6a){_0xc7acfd['push'](_0xc7acfd['shift']());}};_0x1d89c4(++_0x39622d);}(_0xe866,0x16a));var _0x6e86=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe866[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6e86('0x0'));module[_0x6e86('0x1')]={'name':{'type':Sequelize[_0x6e86('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x6e86('0x3'),_0x6e86('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x6e86('0x3')},'savename':{'type':Sequelize[_0x6e86('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6e86('0x5')]},'endDate':{'type':Sequelize[_0x6e86('0x5')]},'status':{'type':Sequelize[_0x6e86('0x2')],'defaultValue':_0x6e86('0x6')},'type':{'type':Sequelize[_0x6e86('0x7')](_0x6e86('0x8'),_0x6e86('0x9')),'allowNull':![],'defaultValue':_0x6e86('0x8')},'reportId':{'type':Sequelize[_0x6e86('0xa')](0xb)[_0x6e86('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2b9e=['DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','exports','STRING','csv','pdf','xlsx'];(function(_0x185bcc,_0x816a57){var _0x855416=function(_0x2afea4){while(--_0x2afea4){_0x185bcc['push'](_0x185bcc['shift']());}};_0x855416(++_0x816a57);}(_0x2b9e,0x126));var _0xe2b9=function(_0x59562d,_0x3413ed){_0x59562d=_0x59562d-0x0;var _0x2b618e=_0x2b9e[_0x59562d];return _0x2b618e;};'use strict';var Sequelize=require(_0xe2b9('0x0'));var moment=require('moment');module[_0xe2b9('0x1')]={'name':{'type':Sequelize[_0xe2b9('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xe2b9('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xe2b9('0x3'),_0xe2b9('0x4'),_0xe2b9('0x5')),'allowNull':![],'defaultValue':_0xe2b9('0x3')},'savename':{'type':Sequelize[_0xe2b9('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe2b9('0x6')]},'endDate':{'type':Sequelize[_0xe2b9('0x6')]},'status':{'type':Sequelize[_0xe2b9('0x2')],'defaultValue':_0xe2b9('0x7')},'type':{'type':Sequelize[_0xe2b9('0x8')](_0xe2b9('0x9'),_0xe2b9('0xa')),'allowNull':![],'defaultValue':_0xe2b9('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xe2b9('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e24f7a1..9d0ff16 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 _0xcca5=['filter','merge','options','includeAll','findAll','keys','include','find','catch','create','body','user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','basename','output','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','limit','count','offset','set','Content-Range','save','update','destroy','get','then','end','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x712393,_0x5ba83a){var _0xc2c9b9=function(_0x20ed98){while(--_0x20ed98){_0x712393['push'](_0x712393['shift']());}};_0xc2c9b9(++_0x5ba83a);}(_0xcca5,0x18d));var _0x5cca=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0xcca5[_0x421c56];return _0x49b244;};'use strict';var emlformat=require(_0x5cca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5cca('0x1'));var jsonpatch=require(_0x5cca('0x2'));var rp=require('request-promise');var moment=require(_0x5cca('0x3'));var BPromise=require(_0x5cca('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5cca('0x5'));var sox=require(_0x5cca('0x6'));var csv=require(_0x5cca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5cca('0x8'));var _=require(_0x5cca('0x9'));var squel=require(_0x5cca('0xa'));var crypto=require(_0x5cca('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5cca('0xc'));var toCsv=require(_0x5cca('0x7'));var querystring=require(_0x5cca('0xd'));var Papa=require(_0x5cca('0xe'));var Redis=require(_0x5cca('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5cca('0x10'));var as=require(_0x5cca('0x11'));var hardwareService=require(_0x5cca('0x12'));var logger=require('../../config/logger')(_0x5cca('0x13'));var utils=require(_0x5cca('0x14'));var config=require(_0x5cca('0x15'));var licenseUtil=require(_0x5cca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d55df,_0x3dab37){_0x3dab37=_0x3dab37||0xcc;return function(_0x55dd7c){if(_0x55dd7c){return _0x3d55df[_0x5cca('0x17')](_0x3dab37);}return _0x3d55df[_0x5cca('0x18')](_0x3dab37)['end']();};}function respondWithResult(_0x3bb3e8,_0x587d7c){_0x587d7c=_0x587d7c||0xc8;return function(_0x53ef7f){if(_0x53ef7f){return _0x3bb3e8[_0x5cca('0x18')](_0x587d7c)['json'](_0x53ef7f);}};}function respondWithFilteredResult(_0x4e34d6,_0x2e84a7){return function(_0x61a4fa){if(_0x61a4fa){var _0x547e97=typeof _0x2e84a7['offset']==='undefined'&&typeof _0x2e84a7[_0x5cca('0x19')]==='undefined';var _0x17b327=_0x61a4fa[_0x5cca('0x1a')];var _0x10621f=_0x547e97?0x0:_0x2e84a7[_0x5cca('0x1b')];var _0x2dd30e=_0x547e97?_0x61a4fa['count']:_0x2e84a7['offset']+_0x2e84a7[_0x5cca('0x19')];var _0x372fee;if(_0x2dd30e>=_0x17b327){_0x2dd30e=_0x17b327;_0x372fee=0xc8;}else{_0x372fee=0xce;}_0x4e34d6['status'](_0x372fee);return _0x4e34d6[_0x5cca('0x1c')](_0x5cca('0x1d'),_0x10621f+'-'+_0x2dd30e+'/'+_0x17b327)['json'](_0x61a4fa);}return null;};}function patchUpdates(_0x18000e){return function(_0x914c0a){try{jsonpatch['apply'](_0x914c0a,_0x18000e,!![]);}catch(_0x18915c){return BPromise['reject'](_0x18915c);}return _0x914c0a[_0x5cca('0x1e')]();};}function saveUpdates(_0x5c771d,_0x393a7f){return function(_0x1accd8){if(_0x1accd8){return _0x1accd8[_0x5cca('0x1f')](_0x5c771d)['then'](function(_0xbffbb6){return _0xbffbb6;});}return null;};}function removeEntity(_0xadf43f,_0x5525e6){return function(_0x54c003){if(_0x54c003){return _0x54c003[_0x5cca('0x20')]()['then'](function(){var _0xf42d96=_0x54c003[_0x5cca('0x21')]({'plain':!![]});var _0x287fdf='ExtractedReports';return db['UserProfileResource'][_0x5cca('0x20')]({'where':{'type':_0x287fdf,'resourceId':_0xf42d96['id']}})[_0x5cca('0x22')](function(){return _0x54c003;});})[_0x5cca('0x22')](function(){_0xadf43f[_0x5cca('0x18')](0xcc)[_0x5cca('0x23')]();});}};}function handleEntityNotFound(_0x45a349,_0xaa80c){return function(_0x45b077){if(!_0x45b077){_0x45a349[_0x5cca('0x17')](0x194);}return _0x45b077;};}function handleError(_0x171c83,_0x59c5a7){_0x59c5a7=_0x59c5a7||0x1f4;return function(_0x1a4e30){logger[_0x5cca('0x24')](_0x1a4e30[_0x5cca('0x25')]);if(_0x1a4e30[_0x5cca('0x26')]){delete _0x1a4e30[_0x5cca('0x26')];}_0x171c83[_0x5cca('0x18')](_0x59c5a7)[_0x5cca('0x27')](_0x1a4e30);};}exports[_0x5cca('0x28')]=function(_0xf68d9a,_0x52c4c7){var _0x21fcbe={},_0x59c5b9={},_0xd48cb={'count':0x0,'rows':[]};var _0x14fbb0=_['map'](db[_0x5cca('0x29')][_0x5cca('0x2a')],function(_0x5ed5f7){return{'name':_0x5ed5f7[_0x5cca('0x2b')],'type':_0x5ed5f7[_0x5cca('0x2c')][_0x5cca('0x2d')]};});_0x59c5b9[_0x5cca('0x2e')]=_[_0x5cca('0x2f')](_0x14fbb0,_0x5cca('0x26'));_0x59c5b9[_0x5cca('0x30')]=_['keys'](_0xf68d9a[_0x5cca('0x30')]);_0x59c5b9[_0x5cca('0x31')]=_[_0x5cca('0x32')](_0x59c5b9[_0x5cca('0x2e')],_0x59c5b9[_0x5cca('0x30')]);_0x21fcbe[_0x5cca('0x33')]=_[_0x5cca('0x32')](_0x59c5b9[_0x5cca('0x2e')],qs[_0x5cca('0x34')](_0xf68d9a[_0x5cca('0x30')][_0x5cca('0x34')]));_0x21fcbe[_0x5cca('0x33')]=_0x21fcbe['attributes'][_0x5cca('0x35')]?_0x21fcbe[_0x5cca('0x33')]:_0x59c5b9[_0x5cca('0x2e')];if(!_0xf68d9a[_0x5cca('0x30')]['hasOwnProperty']('nolimit')){_0x21fcbe[_0x5cca('0x19')]=qs[_0x5cca('0x19')](_0xf68d9a['query'][_0x5cca('0x19')]);_0x21fcbe[_0x5cca('0x1b')]=qs['offset'](_0xf68d9a[_0x5cca('0x30')]['offset']);}_0x21fcbe[_0x5cca('0x36')]=qs[_0x5cca('0x37')](_0xf68d9a[_0x5cca('0x30')][_0x5cca('0x37')]);_0x21fcbe[_0x5cca('0x38')]=qs[_0x5cca('0x31')](_[_0x5cca('0x39')](_0xf68d9a[_0x5cca('0x30')],_0x59c5b9[_0x5cca('0x31')]),_0x14fbb0);if(_0xf68d9a['query'][_0x5cca('0x3a')]){_0x21fcbe[_0x5cca('0x38')]=_['merge'](_0x21fcbe['where'],{'$or':_[_0x5cca('0x2f')](_0x14fbb0,function(_0x1cfe51){if(_0x1cfe51[_0x5cca('0x2c')]!=='VIRTUAL'){var _0x4764ec={};_0x4764ec[_0x1cfe51['name']]={'$like':'%'+_0xf68d9a['query'][_0x5cca('0x3a')]+'%'};return _0x4764ec;}})});}_0x21fcbe=_[_0x5cca('0x3b')]({},_0x21fcbe,_0xf68d9a[_0x5cca('0x3c')]);var _0x55519e={'where':_0x21fcbe['where']};return db[_0x5cca('0x29')][_0x5cca('0x1a')](_0x55519e)['then'](function(_0x27e4c9){_0xd48cb[_0x5cca('0x1a')]=_0x27e4c9;if(_0xf68d9a[_0x5cca('0x30')][_0x5cca('0x3d')]){_0x21fcbe['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x5cca('0x3e')](_0x21fcbe);})[_0x5cca('0x22')](function(_0x5b698b){_0xd48cb['rows']=_0x5b698b;return _0xd48cb;})['then'](respondWithFilteredResult(_0x52c4c7,_0x21fcbe))['catch'](handleError(_0x52c4c7,null));};exports['show']=function(_0x459cd1,_0x5139d4){var _0x2d6ab9={'raw':!![],'where':{'id':_0x459cd1['params']['id']}},_0x112c38={};_0x112c38['model']=_['keys'](db[_0x5cca('0x29')][_0x5cca('0x2a')]);_0x112c38[_0x5cca('0x30')]=_[_0x5cca('0x3f')](_0x459cd1[_0x5cca('0x30')]);_0x112c38[_0x5cca('0x31')]=_[_0x5cca('0x32')](_0x112c38[_0x5cca('0x2e')],_0x112c38['query']);_0x2d6ab9[_0x5cca('0x33')]=_[_0x5cca('0x32')](_0x112c38[_0x5cca('0x2e')],qs['fields'](_0x459cd1['query'][_0x5cca('0x34')]));_0x2d6ab9[_0x5cca('0x33')]=_0x2d6ab9[_0x5cca('0x33')][_0x5cca('0x35')]?_0x2d6ab9['attributes']:_0x112c38[_0x5cca('0x2e')];if(_0x459cd1[_0x5cca('0x30')][_0x5cca('0x3d')]){_0x2d6ab9[_0x5cca('0x40')]=[{'all':!![]}];}_0x2d6ab9=_[_0x5cca('0x3b')]({},_0x2d6ab9,_0x459cd1[_0x5cca('0x3c')]);return db[_0x5cca('0x29')][_0x5cca('0x41')](_0x2d6ab9)[_0x5cca('0x22')](handleEntityNotFound(_0x5139d4,null))[_0x5cca('0x22')](respondWithResult(_0x5139d4,null))[_0x5cca('0x42')](handleError(_0x5139d4,null));};exports[_0x5cca('0x43')]=function(_0x50ce66,_0x1fd7eb){return db['AnalyticExtractedReport']['create'](_0x50ce66[_0x5cca('0x44')],{})['then'](function(_0x2263a1){var _0x233b26=_0x50ce66[_0x5cca('0x45')][_0x5cca('0x21')]({'plain':!![]});if(!_0x233b26)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x233b26[_0x5cca('0x46')]===_0x5cca('0x45')){var _0x439dcc=_0x2263a1['get']({'plain':!![]});var _0x1636f9=_0x5cca('0x47');return db[_0x5cca('0x48')][_0x5cca('0x41')]({'where':{'name':_0x1636f9,'userProfileId':_0x233b26[_0x5cca('0x49')]},'raw':!![]})[_0x5cca('0x22')](function(_0x4b3709){if(_0x4b3709&&_0x4b3709[_0x5cca('0x4a')]===0x0){return db[_0x5cca('0x4b')][_0x5cca('0x43')]({'name':_0x439dcc['name'],'resourceId':_0x439dcc['id'],'type':_0x4b3709[_0x5cca('0x26')],'sectionId':_0x4b3709['id']},{})['then'](function(){return _0x2263a1;});}else{return _0x2263a1;}})['catch'](function(_0x4b8923){logger[_0x5cca('0x24')](_0x5cca('0x4c'),_0x4b8923);throw _0x4b8923;});}return _0x2263a1;})[_0x5cca('0x22')](respondWithResult(_0x1fd7eb,0xc9))[_0x5cca('0x42')](handleError(_0x1fd7eb,null));};exports['update']=function(_0x43e7bf,_0x587990){if(_0x43e7bf['body']['id']){delete _0x43e7bf[_0x5cca('0x44')]['id'];}return db[_0x5cca('0x29')][_0x5cca('0x41')]({'where':{'id':_0x43e7bf[_0x5cca('0x4d')]['id']}})[_0x5cca('0x22')](handleEntityNotFound(_0x587990,null))[_0x5cca('0x22')](saveUpdates(_0x43e7bf[_0x5cca('0x44')],null))[_0x5cca('0x22')](respondWithResult(_0x587990,null))['catch'](handleError(_0x587990,null));};exports[_0x5cca('0x20')]=function(_0x315ff0,_0x313d10){return db['AnalyticExtractedReport'][_0x5cca('0x41')]({'where':{'id':_0x315ff0[_0x5cca('0x4d')]['id']}})[_0x5cca('0x22')](handleEntityNotFound(_0x313d10,null))[_0x5cca('0x22')](removeEntity(_0x313d10,null))[_0x5cca('0x42')](handleError(_0x313d10,null));};exports['download']=function(_0x1ae74c,_0xc1dfb6,_0x2104d4){return db[_0x5cca('0x29')][_0x5cca('0x41')]({'where':{'id':_0x1ae74c['params']['id']},'attributes':['name','basename',_0x5cca('0x4e'),'output'],'raw':!![]})[_0x5cca('0x22')](handleEntityNotFound(_0xc1dfb6,null))[_0x5cca('0x22')](function(_0x480efc){if(_0x480efc){if(!fs[_0x5cca('0x4f')](path[_0x5cca('0x50')](config[_0x5cca('0x51')],_0x5cca('0x52'),_0x480efc[_0x5cca('0x4e')]))){throw new db[(_0x5cca('0x53'))][(_0x5cca('0x54'))](_0x5cca('0x55'));}if(_0x1ae74c[_0x5cca('0x30')][_0x5cca('0x56')]){return _0xc1dfb6[_0x5cca('0x17')](0xc8);}return _0xc1dfb6[_0x5cca('0x57')](path[_0x5cca('0x50')](config[_0x5cca('0x51')],_0x5cca('0x52'),_0x480efc[_0x5cca('0x4e')]),util[_0x5cca('0x58')]('%s.%s',_0x480efc[_0x5cca('0x59')]||_0x480efc['name'],_0x480efc[_0x5cca('0x5a')]['toLowerCase']()));}})[_0x5cca('0x42')](handleError(_0xc1dfb6,null));}; \ No newline at end of file +var _0x2ede=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','ExtractedReports','UserProfileResource','destroy','end','stack','name','send','index','AnalyticExtractedReport','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','user','role','UserProfileSection'];(function(_0x396eb7,_0x5ad2b4){var _0x3621e2=function(_0xb0526){while(--_0xb0526){_0x396eb7['push'](_0x396eb7['shift']());}};_0x3621e2(++_0x5ad2b4);}(_0x2ede,0xd6));var _0xe2ed=function(_0x41016d,_0x10a6d9){_0x41016d=_0x41016d-0x0;var _0x3e9b26=_0x2ede[_0x41016d];return _0x3e9b26;};'use strict';var emlformat=require(_0xe2ed('0x0'));var rimraf=require(_0xe2ed('0x1'));var zipdir=require(_0xe2ed('0x2'));var jsonpatch=require(_0xe2ed('0x3'));var rp=require(_0xe2ed('0x4'));var moment=require(_0xe2ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe2ed('0x6'));var util=require(_0xe2ed('0x7'));var path=require(_0xe2ed('0x8'));var sox=require(_0xe2ed('0x9'));var csv=require(_0xe2ed('0xa'));var ejs=require(_0xe2ed('0xb'));var fs=require('fs');var fs_extra=require(_0xe2ed('0xc'));var _=require(_0xe2ed('0xd'));var squel=require(_0xe2ed('0xe'));var crypto=require(_0xe2ed('0xf'));var jsforce=require(_0xe2ed('0x10'));var deskjs=require(_0xe2ed('0x11'));var toCsv=require(_0xe2ed('0xa'));var querystring=require(_0xe2ed('0x12'));var Papa=require(_0xe2ed('0x13'));var Redis=require(_0xe2ed('0x14'));var authService=require(_0xe2ed('0x15'));var qs=require(_0xe2ed('0x16'));var as=require(_0xe2ed('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe2ed('0x18'));var utils=require(_0xe2ed('0x19'));var config=require(_0xe2ed('0x1a'));var licenseUtil=require(_0xe2ed('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x79810,_0x3aa8a0){_0x3aa8a0=_0x3aa8a0||0xcc;return function(_0x3cd1ab){if(_0x3cd1ab){return _0x79810[_0xe2ed('0x1c')](_0x3aa8a0);}return _0x79810[_0xe2ed('0x1d')](_0x3aa8a0)['end']();};}function respondWithResult(_0x36fb97,_0xb62891){_0xb62891=_0xb62891||0xc8;return function(_0xa74cac){if(_0xa74cac){return _0x36fb97['status'](_0xb62891)[_0xe2ed('0x1e')](_0xa74cac);}};}function respondWithFilteredResult(_0x16eabe,_0x1abe83){return function(_0xcca6ea){if(_0xcca6ea){var _0x15ad52=typeof _0x1abe83[_0xe2ed('0x1f')]===_0xe2ed('0x20')&&typeof _0x1abe83[_0xe2ed('0x21')]===_0xe2ed('0x20');var _0x3d4780=_0xcca6ea[_0xe2ed('0x22')];var _0xcd51dd=_0x15ad52?0x0:_0x1abe83['offset'];var _0x532cc9=_0x15ad52?_0xcca6ea[_0xe2ed('0x22')]:_0x1abe83[_0xe2ed('0x1f')]+_0x1abe83['limit'];var _0x3630b6;if(_0x532cc9>=_0x3d4780){_0x532cc9=_0x3d4780;_0x3630b6=0xc8;}else{_0x3630b6=0xce;}_0x16eabe[_0xe2ed('0x1d')](_0x3630b6);return _0x16eabe['set'](_0xe2ed('0x23'),_0xcd51dd+'-'+_0x532cc9+'/'+_0x3d4780)['json'](_0xcca6ea);}return null;};}function patchUpdates(_0x232f43){return function(_0x175898){try{jsonpatch[_0xe2ed('0x24')](_0x175898,_0x232f43,!![]);}catch(_0x3cb660){return BPromise[_0xe2ed('0x25')](_0x3cb660);}return _0x175898[_0xe2ed('0x26')]();};}function saveUpdates(_0x365c49,_0xdaf86e){return function(_0x447142){if(_0x447142){return _0x447142['update'](_0x365c49)['then'](function(_0x58263d){return _0x58263d;});}return null;};}function removeEntity(_0x3d490a,_0x3d37a2){return function(_0x256604){if(_0x256604){return _0x256604['destroy']()[_0xe2ed('0x27')](function(){var _0x4dd9fa=_0x256604[_0xe2ed('0x28')]({'plain':!![]});var _0x574897=_0xe2ed('0x29');return db[_0xe2ed('0x2a')][_0xe2ed('0x2b')]({'where':{'type':_0x574897,'resourceId':_0x4dd9fa['id']}})[_0xe2ed('0x27')](function(){return _0x256604;});})[_0xe2ed('0x27')](function(){_0x3d490a[_0xe2ed('0x1d')](0xcc)[_0xe2ed('0x2c')]();});}};}function handleEntityNotFound(_0xa163cb,_0x49438a){return function(_0x57cc10){if(!_0x57cc10){_0xa163cb[_0xe2ed('0x1c')](0x194);}return _0x57cc10;};}function handleError(_0x2d86a0,_0x12735d){_0x12735d=_0x12735d||0x1f4;return function(_0x265c7f){logger['error'](_0x265c7f[_0xe2ed('0x2d')]);if(_0x265c7f['name']){delete _0x265c7f[_0xe2ed('0x2e')];}_0x2d86a0['status'](_0x12735d)[_0xe2ed('0x2f')](_0x265c7f);};}exports[_0xe2ed('0x30')]=function(_0x5eea10,_0xfd0bd1){var _0x4a25a1={},_0x2de984={},_0x5795d1={'count':0x0,'rows':[]};var _0x13ec36=_['map'](db[_0xe2ed('0x31')][_0xe2ed('0x32')],function(_0x593bce){return{'name':_0x593bce['fieldName'],'type':_0x593bce['type'][_0xe2ed('0x33')]};});_0x2de984[_0xe2ed('0x34')]=_[_0xe2ed('0x35')](_0x13ec36,'name');_0x2de984[_0xe2ed('0x36')]=_['keys'](_0x5eea10[_0xe2ed('0x36')]);_0x2de984[_0xe2ed('0x37')]=_[_0xe2ed('0x38')](_0x2de984[_0xe2ed('0x34')],_0x2de984[_0xe2ed('0x36')]);_0x4a25a1[_0xe2ed('0x39')]=_[_0xe2ed('0x38')](_0x2de984['model'],qs[_0xe2ed('0x3a')](_0x5eea10[_0xe2ed('0x36')][_0xe2ed('0x3a')]));_0x4a25a1[_0xe2ed('0x39')]=_0x4a25a1[_0xe2ed('0x39')][_0xe2ed('0x3b')]?_0x4a25a1[_0xe2ed('0x39')]:_0x2de984[_0xe2ed('0x34')];if(!_0x5eea10['query'][_0xe2ed('0x3c')]('nolimit')){_0x4a25a1[_0xe2ed('0x21')]=qs[_0xe2ed('0x21')](_0x5eea10['query'][_0xe2ed('0x21')]);_0x4a25a1['offset']=qs[_0xe2ed('0x1f')](_0x5eea10[_0xe2ed('0x36')]['offset']);}_0x4a25a1[_0xe2ed('0x3d')]=qs[_0xe2ed('0x3e')](_0x5eea10[_0xe2ed('0x36')][_0xe2ed('0x3e')]);_0x4a25a1[_0xe2ed('0x3f')]=qs[_0xe2ed('0x37')](_['pick'](_0x5eea10[_0xe2ed('0x36')],_0x2de984[_0xe2ed('0x37')]),_0x13ec36);if(_0x5eea10[_0xe2ed('0x36')][_0xe2ed('0x40')]){_0x4a25a1[_0xe2ed('0x3f')]=_[_0xe2ed('0x41')](_0x4a25a1[_0xe2ed('0x3f')],{'$or':_[_0xe2ed('0x35')](_0x13ec36,function(_0x2874d3){if(_0x2874d3['type']!==_0xe2ed('0x42')){var _0xb0c99f={};_0xb0c99f[_0x2874d3['name']]={'$like':'%'+_0x5eea10['query'][_0xe2ed('0x40')]+'%'};return _0xb0c99f;}})});}_0x4a25a1=_['merge']({},_0x4a25a1,_0x5eea10[_0xe2ed('0x43')]);var _0xf29842={'where':_0x4a25a1[_0xe2ed('0x3f')]};return db['AnalyticExtractedReport'][_0xe2ed('0x22')](_0xf29842)[_0xe2ed('0x27')](function(_0x68a763){_0x5795d1[_0xe2ed('0x22')]=_0x68a763;if(_0x5eea10[_0xe2ed('0x36')]['includeAll']){_0x4a25a1[_0xe2ed('0x44')]=[{'all':!![]}];}return db[_0xe2ed('0x31')][_0xe2ed('0x45')](_0x4a25a1);})[_0xe2ed('0x27')](function(_0x54a027){_0x5795d1[_0xe2ed('0x46')]=_0x54a027;return _0x5795d1;})[_0xe2ed('0x27')](respondWithFilteredResult(_0xfd0bd1,_0x4a25a1))['catch'](handleError(_0xfd0bd1,null));};exports['show']=function(_0x30df70,_0x1d7c55){var _0x55e329={'raw':!![],'where':{'id':_0x30df70[_0xe2ed('0x47')]['id']}},_0x57ab32={};_0x57ab32[_0xe2ed('0x34')]=_[_0xe2ed('0x48')](db['AnalyticExtractedReport']['rawAttributes']);_0x57ab32['query']=_['keys'](_0x30df70[_0xe2ed('0x36')]);_0x57ab32[_0xe2ed('0x37')]=_[_0xe2ed('0x38')](_0x57ab32[_0xe2ed('0x34')],_0x57ab32[_0xe2ed('0x36')]);_0x55e329['attributes']=_[_0xe2ed('0x38')](_0x57ab32[_0xe2ed('0x34')],qs['fields'](_0x30df70[_0xe2ed('0x36')]['fields']));_0x55e329[_0xe2ed('0x39')]=_0x55e329[_0xe2ed('0x39')]['length']?_0x55e329[_0xe2ed('0x39')]:_0x57ab32[_0xe2ed('0x34')];if(_0x30df70[_0xe2ed('0x36')][_0xe2ed('0x49')]){_0x55e329['include']=[{'all':!![]}];}_0x55e329=_[_0xe2ed('0x41')]({},_0x55e329,_0x30df70[_0xe2ed('0x43')]);return db['AnalyticExtractedReport'][_0xe2ed('0x4a')](_0x55e329)[_0xe2ed('0x27')](handleEntityNotFound(_0x1d7c55,null))[_0xe2ed('0x27')](respondWithResult(_0x1d7c55,null))[_0xe2ed('0x4b')](handleError(_0x1d7c55,null));};exports[_0xe2ed('0x4c')]=function(_0x4ac112,_0x43e106){return db[_0xe2ed('0x31')][_0xe2ed('0x4c')](_0x4ac112['body'],{})[_0xe2ed('0x27')](function(_0x5e9679){var _0x476cc9=_0x4ac112[_0xe2ed('0x4d')][_0xe2ed('0x28')]({'plain':!![]});if(!_0x476cc9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x476cc9[_0xe2ed('0x4e')]===_0xe2ed('0x4d')){var _0x3b4040=_0x5e9679[_0xe2ed('0x28')]({'plain':!![]});var _0x2f1797='ExtractedReports';return db[_0xe2ed('0x4f')][_0xe2ed('0x4a')]({'where':{'name':_0x2f1797,'userProfileId':_0x476cc9[_0xe2ed('0x50')]},'raw':!![]})[_0xe2ed('0x27')](function(_0x3016b0){if(_0x3016b0&&_0x3016b0[_0xe2ed('0x51')]===0x0){return db[_0xe2ed('0x2a')]['create']({'name':_0x3b4040[_0xe2ed('0x2e')],'resourceId':_0x3b4040['id'],'type':_0x3016b0[_0xe2ed('0x2e')],'sectionId':_0x3016b0['id']},{})[_0xe2ed('0x27')](function(){return _0x5e9679;});}else{return _0x5e9679;}})[_0xe2ed('0x4b')](function(_0x3011af){logger[_0xe2ed('0x52')](_0xe2ed('0x53'),_0x3011af);throw _0x3011af;});}return _0x5e9679;})[_0xe2ed('0x27')](respondWithResult(_0x43e106,0xc9))[_0xe2ed('0x4b')](handleError(_0x43e106,null));};exports['update']=function(_0x4614a1,_0x37b040){if(_0x4614a1[_0xe2ed('0x54')]['id']){delete _0x4614a1[_0xe2ed('0x54')]['id'];}return db[_0xe2ed('0x31')][_0xe2ed('0x4a')]({'where':{'id':_0x4614a1[_0xe2ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x37b040,null))[_0xe2ed('0x27')](saveUpdates(_0x4614a1[_0xe2ed('0x54')],null))[_0xe2ed('0x27')](respondWithResult(_0x37b040,null))[_0xe2ed('0x4b')](handleError(_0x37b040,null));};exports[_0xe2ed('0x2b')]=function(_0x1a172a,_0x17aaae){return db[_0xe2ed('0x31')][_0xe2ed('0x4a')]({'where':{'id':_0x1a172a[_0xe2ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x17aaae,null))[_0xe2ed('0x27')](removeEntity(_0x17aaae,null))[_0xe2ed('0x4b')](handleError(_0x17aaae,null));};exports['download']=function(_0xaabf48,_0x121d5f,_0x4a613e){return db[_0xe2ed('0x31')][_0xe2ed('0x4a')]({'where':{'id':_0xaabf48['params']['id']},'attributes':[_0xe2ed('0x2e'),_0xe2ed('0x55'),_0xe2ed('0x56'),'output'],'raw':!![]})[_0xe2ed('0x27')](handleEntityNotFound(_0x121d5f,null))[_0xe2ed('0x27')](function(_0x3d7009){if(_0x3d7009){if(!fs[_0xe2ed('0x57')](path[_0xe2ed('0x58')](config[_0xe2ed('0x59')],_0xe2ed('0x5a'),_0x3d7009[_0xe2ed('0x56')]))){throw new db[(_0xe2ed('0x5b'))][(_0xe2ed('0x5c'))](_0xe2ed('0x5d'));}if(_0xaabf48[_0xe2ed('0x36')]['exists']){return _0x121d5f[_0xe2ed('0x1c')](0xc8);}return _0x121d5f['download'](path[_0xe2ed('0x58')](config[_0xe2ed('0x59')],_0xe2ed('0x5a'),_0x3d7009[_0xe2ed('0x56')]),util[_0xe2ed('0x5e')](_0xe2ed('0x5f'),_0x3d7009[_0xe2ed('0x55')]||_0x3d7009[_0xe2ed('0x2e')],_0x3d7009[_0xe2ed('0x60')][_0xe2ed('0x61')]()));}})[_0xe2ed('0x4b')](handleError(_0x121d5f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7498f63..41df33f 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 _0xdd3e=['util','api','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','analytics_extracted_reports','lodash'];(function(_0x5295c6,_0x226c81){var _0x9dcf96=function(_0x5272aa){while(--_0x5272aa){_0x5295c6['push'](_0x5295c6['shift']());}};_0x9dcf96(++_0x226c81);}(_0xdd3e,0xe9));var _0xedd3=function(_0x1ca903,_0x197849){_0x1ca903=_0x1ca903-0x0;var _0x25826f=_0xdd3e[_0x1ca903];return _0x25826f;};'use strict';var _=require(_0xedd3('0x0'));var util=require(_0xedd3('0x1'));var logger=require('../../config/logger')(_0xedd3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xedd3('0x3'));var fs=require('fs');var path=require(_0xedd3('0x4'));var rimraf=require(_0xedd3('0x5'));var config=require('../../config/environment');var attributes=require(_0xedd3('0x6'));module[_0xedd3('0x7')]=function(_0x5b2e39,_0x24b572){return _0x5b2e39['define']('AnalyticExtractedReport',attributes,{'tableName':_0xedd3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c40=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util'];(function(_0x7e1db7,_0x1da70f){var _0xc82fa0=function(_0x23b276){while(--_0x23b276){_0x7e1db7['push'](_0x7e1db7['shift']());}};_0xc82fa0(++_0x1da70f);}(_0x5c40,0xa7));var _0x05c4=function(_0x385510,_0x476690){_0x385510=_0x385510-0x0;var _0x5b5e1f=_0x5c40[_0x385510];return _0x5b5e1f;};'use strict';var _=require(_0x05c4('0x0'));var util=require(_0x05c4('0x1'));var logger=require('../../config/logger')(_0x05c4('0x2'));var moment=require(_0x05c4('0x3'));var BPromise=require(_0x05c4('0x4'));var rp=require(_0x05c4('0x5'));var fs=require('fs');var path=require(_0x05c4('0x6'));var rimraf=require(_0x05c4('0x7'));var config=require(_0x05c4('0x8'));var attributes=require(_0x05c4('0x9'));module[_0x05c4('0xa')]=function(_0x2e2842,_0x3e5fac){return _0x2e2842[_0x05c4('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x05c4('0xc'),'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 291dc11..34310f2 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 _0xd654=['catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x280170,_0x211c74){var _0x3fc209=function(_0x35c2d8){while(--_0x35c2d8){_0x280170['push'](_0x280170['shift']());}};_0x3fc209(++_0x211c74);}(_0xd654,0x15a));var _0x4d65=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd654[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4d65('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4d65('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d65('0x2'));var db=require(_0x4d65('0x3'))['db'];var utils=require(_0x4d65('0x4'));var logger=require(_0x4d65('0x5'))(_0x4d65('0x6'));var config=require(_0x4d65('0x7'));var jayson=require(_0x4d65('0x8'));var client=jayson[_0x4d65('0x9')][_0x4d65('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c71cc,_0x4ad314,_0x20413e){return new BPromise(function(_0x333acd,_0x4b1e8b){return client[_0x4d65('0xb')](_0x4c71cc,_0x20413e)[_0x4d65('0xc')](function(_0x150de3){logger[_0x4d65('0xd')](_0x4d65('0xe'),_0x4ad314,_0x4d65('0xf'));logger[_0x4d65('0x10')](_0x4d65('0x11'),_0x4ad314,_0x4d65('0xf'),JSON[_0x4d65('0x12')](_0x150de3));if(_0x150de3[_0x4d65('0x13')]){if(_0x150de3[_0x4d65('0x13')][_0x4d65('0x14')]===0x1f4){logger[_0x4d65('0x13')](_0x4d65('0xe'),_0x4ad314,_0x150de3[_0x4d65('0x13')][_0x4d65('0x15')]);return _0x4b1e8b(_0x150de3[_0x4d65('0x13')][_0x4d65('0x15')]);}logger[_0x4d65('0x13')](_0x4d65('0xe'),_0x4ad314,_0x150de3[_0x4d65('0x13')]['message']);return _0x333acd(_0x150de3[_0x4d65('0x13')]['message']);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ad314,_0x4d65('0xf'));_0x333acd(_0x150de3['result']['message']);}})[_0x4d65('0x16')](function(_0x1da44c){logger[_0x4d65('0x13')](_0x4d65('0xe'),_0x4ad314,_0x1da44c);_0x4b1e8b(_0x1da44c);});});} \ No newline at end of file +var _0x849e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','../../mysqldb'];(function(_0x53ad9c,_0x448a91){var _0x51a477=function(_0x1cc81e){while(--_0x1cc81e){_0x53ad9c['push'](_0x53ad9c['shift']());}};_0x51a477(++_0x448a91);}(_0x849e,0xf4));var _0xe849=function(_0x3c8366,_0x46df4c){_0x3c8366=_0x3c8366-0x0;var _0xae08f1=_0x849e[_0x3c8366];return _0xae08f1;};'use strict';var _=require(_0xe849('0x0'));var util=require(_0xe849('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe849('0x2'))['db'];var utils=require(_0xe849('0x3'));var logger=require(_0xe849('0x4'))(_0xe849('0x5'));var config=require(_0xe849('0x6'));var jayson=require(_0xe849('0x7'));var client=jayson[_0xe849('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19965f,_0x316fda,_0x527092){return new BPromise(function(_0x254c1d,_0x1a666e){return client[_0xe849('0x9')](_0x19965f,_0x527092)['then'](function(_0x5154e2){logger[_0xe849('0xa')](_0xe849('0xb'),_0x316fda,_0xe849('0xc'));logger[_0xe849('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x316fda,_0xe849('0xc'),JSON[_0xe849('0xe')](_0x5154e2));if(_0x5154e2[_0xe849('0xf')]){if(_0x5154e2[_0xe849('0xf')][_0xe849('0x10')]===0x1f4){logger[_0xe849('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x316fda,_0x5154e2['error'][_0xe849('0x11')]);return _0x1a666e(_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);}logger[_0xe849('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x316fda,_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);return _0x254c1d(_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);}else{logger[_0xe849('0xa')](_0xe849('0xb'),_0x316fda,_0xe849('0xc'));_0x254c1d(_0x5154e2['result'][_0xe849('0x11')]);}})[_0xe849('0x12')](function(_0x26db49){logger[_0xe849('0xf')](_0xe849('0xb'),_0x316fda,_0x26db49);_0x1a666e(_0x26db49);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 767b868..aed7f8f 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 _0x9a5d=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','download','create','/:id','update','delete'];(function(_0x3ee952,_0x565e0f){var _0xc0c8b1=function(_0x57e219){while(--_0x57e219){_0x3ee952['push'](_0x3ee952['shift']());}};_0xc0c8b1(++_0x565e0f);}(_0x9a5d,0x122));var _0xd9a5=function(_0x488ebb,_0x232137){_0x488ebb=_0x488ebb-0x0;var _0x1c1a33=_0x9a5d[_0x488ebb];return _0x1c1a33;};'use strict';var multer=require(_0xd9a5('0x0'));var util=require(_0xd9a5('0x1'));var path=require(_0xd9a5('0x2'));var timeout=require(_0xd9a5('0x3'));var express=require('express');var router=express[_0xd9a5('0x4')]();var fs_extra=require(_0xd9a5('0x5'));var auth=require(_0xd9a5('0x6'));var interaction=require(_0xd9a5('0x7'));var config=require(_0xd9a5('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xd9a5('0x9')]('/',auth[_0xd9a5('0xa')](),controller['index']);router[_0xd9a5('0x9')]('/:id',auth[_0xd9a5('0xa')](),controller['show']);router[_0xd9a5('0x9')]('/:id/download',auth[_0xd9a5('0xa')](),controller[_0xd9a5('0xb')]);router['post']('/',auth[_0xd9a5('0xa')](),controller[_0xd9a5('0xc')]);router['put'](_0xd9a5('0xd'),auth[_0xd9a5('0xa')](),controller[_0xd9a5('0xe')]);router[_0xd9a5('0xf')]('/:id',auth[_0xd9a5('0xa')](),controller[_0xd9a5('0x10')]);module[_0xd9a5('0x11')]=router; \ No newline at end of file +var _0xe440=['./analyticExtractedReport.controller','get','index','/:id','show','isAuthenticated','download','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x248a08,_0x43eaa0){var _0x16f178=function(_0x2e4e18){while(--_0x2e4e18){_0x248a08['push'](_0x248a08['shift']());}};_0x16f178(++_0x43eaa0);}(_0xe440,0xdd));var _0x0e44=function(_0x182bdd,_0x43bad3){_0x182bdd=_0x182bdd-0x0;var _0x156cf4=_0xe440[_0x182bdd];return _0x156cf4;};'use strict';var multer=require(_0x0e44('0x0'));var util=require(_0x0e44('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e44('0x2'));var router=express['Router']();var fs_extra=require(_0x0e44('0x3'));var auth=require(_0x0e44('0x4'));var interaction=require(_0x0e44('0x5'));var config=require(_0x0e44('0x6'));var controller=require(_0x0e44('0x7'));router[_0x0e44('0x8')]('/',auth['isAuthenticated'](),controller[_0x0e44('0x9')]);router[_0x0e44('0x8')](_0x0e44('0xa'),auth['isAuthenticated'](),controller[_0x0e44('0xb')]);router[_0x0e44('0x8')]('/:id/download',auth[_0x0e44('0xc')](),controller[_0x0e44('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0e44('0xe')]('/:id',auth[_0x0e44('0xc')](),controller[_0x0e44('0xf')]);router[_0x0e44('0x10')](_0x0e44('0xa'),auth[_0x0e44('0xc')](),controller[_0x0e44('0x11')]);module[_0x0e44('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index b9057a1..6e83e9c 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 _0x0da5=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x2806d5,_0x32d3bb){var _0x3b7418=function(_0xed4bd4){while(--_0xed4bd4){_0x2806d5['push'](_0x2806d5['shift']());}};_0x3b7418(++_0x32d3bb);}(_0x0da5,0xc4));var _0x50da=function(_0x35d564,_0x15f604){_0x35d564=_0x35d564-0x0;var _0x3c10d5=_0x0da5[_0x35d564];return _0x3c10d5;};'use strict';var Sequelize=require(_0x50da('0x0'));module['exports']={'field':{'type':Sequelize[_0x50da('0x1')]},'alias':{'type':Sequelize[_0x50da('0x2')]},'function':{'type':Sequelize[_0x50da('0x2')]},'format':{'type':Sequelize[_0x50da('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x50da('0x2')]},'custom':{'type':Sequelize[_0x50da('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x19fd=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4d6674,_0x23734a){var _0x4fcd4d=function(_0x2df1c9){while(--_0x2df1c9){_0x4d6674['push'](_0x4d6674['shift']());}};_0x4fcd4d(++_0x23734a);}(_0x19fd,0x10e));var _0xd19f=function(_0x59e229,_0x130f86){_0x59e229=_0x59e229-0x0;var _0x7f5d6b=_0x19fd[_0x59e229];return _0x7f5d6b;};'use strict';var Sequelize=require(_0xd19f('0x0'));module[_0xd19f('0x1')]={'field':{'type':Sequelize[_0xd19f('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xd19f('0x3')]},'format':{'type':Sequelize[_0xd19f('0x3')]},'groupBy':{'type':Sequelize[_0xd19f('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd19f('0x3')]},'custom':{'type':Sequelize[_0xd19f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 8917c32..ec6a862 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 _0x7758=['to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','options','includeAll','include','AnalyticFieldReport','findAll','params','intersection','merge','find','catch','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x4d6ba0,_0x533048){var _0x34b9c2=function(_0x237641){while(--_0x237641){_0x4d6ba0['push'](_0x4d6ba0['shift']());}};_0x34b9c2(++_0x533048);}(_0x7758,0x186));var _0x8775=function(_0x20c0f3,_0x102e80){_0x20c0f3=_0x20c0f3-0x0;var _0x44da4c=_0x7758[_0x20c0f3];return _0x44da4c;};'use strict';var emlformat=require(_0x8775('0x0'));var rimraf=require(_0x8775('0x1'));var zipdir=require(_0x8775('0x2'));var jsonpatch=require(_0x8775('0x3'));var rp=require(_0x8775('0x4'));var moment=require(_0x8775('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8775('0x6'));var util=require(_0x8775('0x7'));var path=require(_0x8775('0x8'));var sox=require(_0x8775('0x9'));var csv=require(_0x8775('0xa'));var ejs=require(_0x8775('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8775('0xc'));var squel=require(_0x8775('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8775('0xe'));var toCsv=require(_0x8775('0xa'));var querystring=require(_0x8775('0xf'));var Papa=require(_0x8775('0x10'));var Redis=require(_0x8775('0x11'));var authService=require(_0x8775('0x12'));var qs=require(_0x8775('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8775('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8775('0x15'));var licenseUtil=require(_0x8775('0x16'));var db=require(_0x8775('0x17'))['db'];function respondWithStatusCode(_0x4137f8,_0x421290){_0x421290=_0x421290||0xcc;return function(_0x40d95e){if(_0x40d95e){return _0x4137f8[_0x8775('0x18')](_0x421290);}return _0x4137f8['status'](_0x421290)[_0x8775('0x19')]();};}function respondWithResult(_0x18be74,_0x2d9dd1){_0x2d9dd1=_0x2d9dd1||0xc8;return function(_0x49e1a9){if(_0x49e1a9){return _0x18be74[_0x8775('0x1a')](_0x2d9dd1)['json'](_0x49e1a9);}};}function respondWithFilteredResult(_0xecd658,_0x354a7){return function(_0x283232){if(_0x283232){var _0x1be825=typeof _0x354a7[_0x8775('0x1b')]===_0x8775('0x1c')&&typeof _0x354a7['limit']===_0x8775('0x1c');var _0x4da989=_0x283232[_0x8775('0x1d')];var _0x3daa9b=_0x1be825?0x0:_0x354a7[_0x8775('0x1b')];var _0x1a2b54=_0x1be825?_0x283232[_0x8775('0x1d')]:_0x354a7[_0x8775('0x1b')]+_0x354a7['limit'];var _0x5cb104;if(_0x1a2b54>=_0x4da989){_0x1a2b54=_0x4da989;_0x5cb104=0xc8;}else{_0x5cb104=0xce;}_0xecd658[_0x8775('0x1a')](_0x5cb104);return _0xecd658['set'](_0x8775('0x1e'),_0x3daa9b+'-'+_0x1a2b54+'/'+_0x4da989)[_0x8775('0x1f')](_0x283232);}return null;};}function patchUpdates(_0xf16add){return function(_0x4284c9){try{jsonpatch[_0x8775('0x20')](_0x4284c9,_0xf16add,!![]);}catch(_0x4a1560){return BPromise[_0x8775('0x21')](_0x4a1560);}return _0x4284c9[_0x8775('0x22')]();};}function saveUpdates(_0x1af5f9,_0x4d9a64){return function(_0x471963){if(_0x471963){return _0x471963[_0x8775('0x23')](_0x1af5f9)['then'](function(_0x3a2302){return _0x3a2302;});}return null;};}function removeEntity(_0x54715e,_0x4bf51e){return function(_0x9c76cd){if(_0x9c76cd){return _0x9c76cd[_0x8775('0x24')]()[_0x8775('0x25')](function(){_0x54715e[_0x8775('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x526e6b,_0x1a04ce){return function(_0x2c0d9e){if(!_0x2c0d9e){_0x526e6b[_0x8775('0x18')](0x194);}return _0x2c0d9e;};}function handleError(_0xb94a37,_0x15c566){_0x15c566=_0x15c566||0x1f4;return function(_0xed8b5f){logger[_0x8775('0x26')](_0xed8b5f[_0x8775('0x27')]);if(_0xed8b5f[_0x8775('0x28')]){delete _0xed8b5f[_0x8775('0x28')];}_0xb94a37[_0x8775('0x1a')](_0x15c566)[_0x8775('0x29')](_0xed8b5f);};}exports[_0x8775('0x2a')]=function(_0x3dacdd,_0x1b1ab7){var _0x40005c={},_0x51a12c={},_0x22996f={'count':0x0,'rows':[]};var _0x239267=_[_0x8775('0x2b')](db['AnalyticFieldReport'][_0x8775('0x2c')],function(_0xd890f8){return{'name':_0xd890f8['fieldName'],'type':_0xd890f8[_0x8775('0x2d')]['key']};});_0x51a12c[_0x8775('0x2e')]=_[_0x8775('0x2b')](_0x239267,_0x8775('0x28'));_0x51a12c['query']=_[_0x8775('0x2f')](_0x3dacdd[_0x8775('0x30')]);_0x51a12c[_0x8775('0x31')]=_['intersection'](_0x51a12c[_0x8775('0x2e')],_0x51a12c[_0x8775('0x30')]);_0x40005c[_0x8775('0x32')]=_['intersection'](_0x51a12c[_0x8775('0x2e')],qs['fields'](_0x3dacdd[_0x8775('0x30')][_0x8775('0x33')]));_0x40005c[_0x8775('0x32')]=_0x40005c[_0x8775('0x32')][_0x8775('0x34')]?_0x40005c[_0x8775('0x32')]:_0x51a12c[_0x8775('0x2e')];if(!_0x3dacdd[_0x8775('0x30')][_0x8775('0x35')]('nolimit')){_0x40005c[_0x8775('0x36')]=qs[_0x8775('0x36')](_0x3dacdd[_0x8775('0x30')][_0x8775('0x36')]);_0x40005c[_0x8775('0x1b')]=qs['offset'](_0x3dacdd[_0x8775('0x30')]['offset']);}_0x40005c[_0x8775('0x37')]=qs[_0x8775('0x38')](_0x3dacdd[_0x8775('0x30')]['sort']);_0x40005c[_0x8775('0x39')]=qs[_0x8775('0x31')](_[_0x8775('0x3a')](_0x3dacdd['query'],_0x51a12c[_0x8775('0x31')]),_0x239267);if(_0x3dacdd['query'][_0x8775('0x3b')]){_0x40005c[_0x8775('0x39')]=_['merge'](_0x40005c[_0x8775('0x39')],{'$or':_['map'](_0x239267,function(_0x1c8854){if(_0x1c8854['type']!=='VIRTUAL'){var _0x56031f={};_0x56031f[_0x1c8854[_0x8775('0x28')]]={'$like':'%'+_0x3dacdd['query'][_0x8775('0x3b')]+'%'};return _0x56031f;}})});}_0x40005c=_['merge']({},_0x40005c,_0x3dacdd[_0x8775('0x3c')]);var _0x1f1072={'where':_0x40005c[_0x8775('0x39')]};return db['AnalyticFieldReport'][_0x8775('0x1d')](_0x1f1072)[_0x8775('0x25')](function(_0x574d1c){_0x22996f[_0x8775('0x1d')]=_0x574d1c;if(_0x3dacdd[_0x8775('0x30')][_0x8775('0x3d')]){_0x40005c[_0x8775('0x3e')]=[{'all':!![]}];}return db[_0x8775('0x3f')][_0x8775('0x40')](_0x40005c);})[_0x8775('0x25')](function(_0x135413){_0x22996f['rows']=_0x135413;return _0x22996f;})['then'](respondWithFilteredResult(_0x1b1ab7,_0x40005c))['catch'](handleError(_0x1b1ab7,null));};exports['show']=function(_0x46d303,_0x42249c){var _0x561b6b={'raw':![],'where':{'id':_0x46d303[_0x8775('0x41')]['id']}},_0x5cd9a1={};_0x5cd9a1[_0x8775('0x2e')]=_['keys'](db['AnalyticFieldReport'][_0x8775('0x2c')]);_0x5cd9a1[_0x8775('0x30')]=_[_0x8775('0x2f')](_0x46d303['query']);_0x5cd9a1['filters']=_['intersection'](_0x5cd9a1[_0x8775('0x2e')],_0x5cd9a1[_0x8775('0x30')]);_0x561b6b[_0x8775('0x32')]=_[_0x8775('0x42')](_0x5cd9a1[_0x8775('0x2e')],qs['fields'](_0x46d303[_0x8775('0x30')][_0x8775('0x33')]));_0x561b6b[_0x8775('0x32')]=_0x561b6b['attributes'][_0x8775('0x34')]?_0x561b6b[_0x8775('0x32')]:_0x5cd9a1[_0x8775('0x2e')];if(_0x46d303[_0x8775('0x30')]['includeAll']){_0x561b6b[_0x8775('0x3e')]=[{'all':!![]}];}_0x561b6b=_[_0x8775('0x43')]({},_0x561b6b,_0x46d303[_0x8775('0x3c')]);return db[_0x8775('0x3f')][_0x8775('0x44')](_0x561b6b)[_0x8775('0x25')](handleEntityNotFound(_0x42249c,null))[_0x8775('0x25')](respondWithResult(_0x42249c,null))[_0x8775('0x45')](handleError(_0x42249c,null));};exports[_0x8775('0x46')]=function(_0x20fe26,_0x22d535){return db['AnalyticFieldReport'][_0x8775('0x46')](_0x20fe26['body'],{})[_0x8775('0x25')](respondWithResult(_0x22d535,0xc9))[_0x8775('0x45')](handleError(_0x22d535,null));};exports[_0x8775('0x47')]=function(_0x187965,_0x300289){return db[_0x8775('0x3f')][_0x8775('0x47')](_0x187965[_0x8775('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x300289,0xc9))[_0x8775('0x45')](handleError(_0x300289,null));};exports['update']=function(_0x2f4bf3,_0xc1e771){if(_0x2f4bf3[_0x8775('0x48')]['id']){delete _0x2f4bf3[_0x8775('0x48')]['id'];}return db[_0x8775('0x3f')][_0x8775('0x44')]({'where':{'id':_0x2f4bf3[_0x8775('0x41')]['id']}})['then'](handleEntityNotFound(_0xc1e771,null))[_0x8775('0x25')](saveUpdates(_0x2f4bf3['body'],null))[_0x8775('0x25')](respondWithResult(_0xc1e771,null))['catch'](handleError(_0xc1e771,null));};exports[_0x8775('0x24')]=function(_0x50f091,_0x2bb135){return db['AnalyticFieldReport'][_0x8775('0x44')]({'where':{'id':_0x50f091[_0x8775('0x41')]['id']}})[_0x8775('0x25')](handleEntityNotFound(_0x2bb135,null))[_0x8775('0x25')](removeEntity(_0x2bb135,null))['catch'](handleError(_0x2bb135,null));};exports[_0x8775('0x49')]=function(_0x2b3b15,_0x3a3ace){return db[_0x8775('0x3f')][_0x8775('0x24')]({'where':{'id':_0x2b3b15[_0x8775('0x30')][_0x8775('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3a3ace,0xcc))[_0x8775('0x45')](handleError(_0x3a3ace,null));};exports[_0x8775('0x4b')]=function(_0x28bf82,_0x310315,_0x45966d){return db[_0x8775('0x4c')][_0x8775('0x4d')]({'where':{'id':_0x28bf82[_0x8775('0x41')]['id']}})[_0x8775('0x25')](handleEntityNotFound(_0x310315,null))[_0x8775('0x25')](function(_0x4a2765){if(_0x4a2765){return db['sequelize'][_0x8775('0x4e')](function(_0x194dfa){return db[_0x8775('0x3f')][_0x8775('0x24')]({'where':{'CustomReportId':_0x28bf82[_0x8775('0x41')]['id']},'transaction':_0x194dfa})[_0x8775('0x25')](function(_0x479ceb){var _0x206c64=_[_0x8775('0x2b')](_0x28bf82['body'],function(_0x33957d){delete _0x33957d['id'];_0x33957d[_0x8775('0x4f')]=_0x28bf82[_0x8775('0x41')]['id'];return _0x33957d;});return db[_0x8775('0x3f')]['bulkCreate'](_0x206c64,{'transaction':_0x194dfa});});})['then'](function(){return db[_0x8775('0x3f')]['findAll']({'where':{'CustomReportId':_0x28bf82[_0x8775('0x41')]['id']}});});}})['then'](respondWithResult(_0x310315,null))[_0x8775('0x45')](handleError(_0x310315,null));}; \ No newline at end of file +var _0xa694=['create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','sequelize','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x3b0966,_0x3fc4ca){var _0x18e6b0=function(_0x535058){while(--_0x535058){_0x3b0966['push'](_0x3b0966['shift']());}};_0x18e6b0(++_0x3fc4ca);}(_0xa694,0x153));var _0x4a69=function(_0xe8e923,_0x1cf325){_0xe8e923=_0xe8e923-0x0;var _0x2ab28c=_0xa694[_0xe8e923];return _0x2ab28c;};'use strict';var emlformat=require(_0x4a69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a69('0x1'));var jsonpatch=require(_0x4a69('0x2'));var rp=require(_0x4a69('0x3'));var moment=require(_0x4a69('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4a69('0x5'));var util=require(_0x4a69('0x6'));var path=require(_0x4a69('0x7'));var sox=require(_0x4a69('0x8'));var csv=require('to-csv');var ejs=require(_0x4a69('0x9'));var fs=require('fs');var fs_extra=require(_0x4a69('0xa'));var _=require(_0x4a69('0xb'));var squel=require(_0x4a69('0xc'));var crypto=require(_0x4a69('0xd'));var jsforce=require(_0x4a69('0xe'));var deskjs=require(_0x4a69('0xf'));var toCsv=require(_0x4a69('0x10'));var querystring=require(_0x4a69('0x11'));var Papa=require(_0x4a69('0x12'));var Redis=require(_0x4a69('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4a69('0x14'));var as=require(_0x4a69('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a69('0x16'))('api');var utils=require(_0x4a69('0x17'));var config=require(_0x4a69('0x18'));var licenseUtil=require(_0x4a69('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b62df,_0x356b54){_0x356b54=_0x356b54||0xcc;return function(_0x3398a7){if(_0x3398a7){return _0x2b62df['sendStatus'](_0x356b54);}return _0x2b62df[_0x4a69('0x1a')](_0x356b54)[_0x4a69('0x1b')]();};}function respondWithResult(_0x1ae675,_0x3e13cf){_0x3e13cf=_0x3e13cf||0xc8;return function(_0x3a02c9){if(_0x3a02c9){return _0x1ae675['status'](_0x3e13cf)[_0x4a69('0x1c')](_0x3a02c9);}};}function respondWithFilteredResult(_0x1f305b,_0x5d7abb){return function(_0x9ff15f){if(_0x9ff15f){var _0x27445d=typeof _0x5d7abb[_0x4a69('0x1d')]===_0x4a69('0x1e')&&typeof _0x5d7abb[_0x4a69('0x1f')]===_0x4a69('0x1e');var _0x32dc26=_0x9ff15f[_0x4a69('0x20')];var _0x31f51e=_0x27445d?0x0:_0x5d7abb[_0x4a69('0x1d')];var _0x3df39f=_0x27445d?_0x9ff15f[_0x4a69('0x20')]:_0x5d7abb[_0x4a69('0x1d')]+_0x5d7abb[_0x4a69('0x1f')];var _0xa8d12;if(_0x3df39f>=_0x32dc26){_0x3df39f=_0x32dc26;_0xa8d12=0xc8;}else{_0xa8d12=0xce;}_0x1f305b[_0x4a69('0x1a')](_0xa8d12);return _0x1f305b[_0x4a69('0x21')](_0x4a69('0x22'),_0x31f51e+'-'+_0x3df39f+'/'+_0x32dc26)[_0x4a69('0x1c')](_0x9ff15f);}return null;};}function patchUpdates(_0x309656){return function(_0x331c97){try{jsonpatch[_0x4a69('0x23')](_0x331c97,_0x309656,!![]);}catch(_0x1ade6f){return BPromise[_0x4a69('0x24')](_0x1ade6f);}return _0x331c97[_0x4a69('0x25')]();};}function saveUpdates(_0x4edca4,_0x2f7085){return function(_0x4ccec0){if(_0x4ccec0){return _0x4ccec0[_0x4a69('0x26')](_0x4edca4)[_0x4a69('0x27')](function(_0x583e05){return _0x583e05;});}return null;};}function removeEntity(_0x1ae83a,_0x52c886){return function(_0x2c4676){if(_0x2c4676){return _0x2c4676[_0x4a69('0x28')]()[_0x4a69('0x27')](function(){_0x1ae83a[_0x4a69('0x1a')](0xcc)[_0x4a69('0x1b')]();});}};}function handleEntityNotFound(_0x11b8d9,_0x497a22){return function(_0x2144de){if(!_0x2144de){_0x11b8d9[_0x4a69('0x29')](0x194);}return _0x2144de;};}function handleError(_0x5b01ad,_0xcd1af1){_0xcd1af1=_0xcd1af1||0x1f4;return function(_0x305eb1){logger['error'](_0x305eb1['stack']);if(_0x305eb1[_0x4a69('0x2a')]){delete _0x305eb1['name'];}_0x5b01ad['status'](_0xcd1af1)[_0x4a69('0x2b')](_0x305eb1);};}exports[_0x4a69('0x2c')]=function(_0x34e36b,_0x436f08){var _0x3ff847={},_0x2d487c={},_0xad11cf={'count':0x0,'rows':[]};var _0xfe4538=_[_0x4a69('0x2d')](db[_0x4a69('0x2e')]['rawAttributes'],function(_0x283eb7){return{'name':_0x283eb7[_0x4a69('0x2f')],'type':_0x283eb7[_0x4a69('0x30')][_0x4a69('0x31')]};});_0x2d487c[_0x4a69('0x32')]=_[_0x4a69('0x2d')](_0xfe4538,_0x4a69('0x2a'));_0x2d487c['query']=_[_0x4a69('0x33')](_0x34e36b[_0x4a69('0x34')]);_0x2d487c['filters']=_[_0x4a69('0x35')](_0x2d487c[_0x4a69('0x32')],_0x2d487c[_0x4a69('0x34')]);_0x3ff847[_0x4a69('0x36')]=_[_0x4a69('0x35')](_0x2d487c[_0x4a69('0x32')],qs[_0x4a69('0x37')](_0x34e36b[_0x4a69('0x34')]['fields']));_0x3ff847[_0x4a69('0x36')]=_0x3ff847['attributes'][_0x4a69('0x38')]?_0x3ff847[_0x4a69('0x36')]:_0x2d487c[_0x4a69('0x32')];if(!_0x34e36b[_0x4a69('0x34')]['hasOwnProperty'](_0x4a69('0x39'))){_0x3ff847[_0x4a69('0x1f')]=qs[_0x4a69('0x1f')](_0x34e36b[_0x4a69('0x34')][_0x4a69('0x1f')]);_0x3ff847[_0x4a69('0x1d')]=qs[_0x4a69('0x1d')](_0x34e36b[_0x4a69('0x34')][_0x4a69('0x1d')]);}_0x3ff847[_0x4a69('0x3a')]=qs[_0x4a69('0x3b')](_0x34e36b[_0x4a69('0x34')]['sort']);_0x3ff847[_0x4a69('0x3c')]=qs['filters'](_[_0x4a69('0x3d')](_0x34e36b[_0x4a69('0x34')],_0x2d487c[_0x4a69('0x3e')]),_0xfe4538);if(_0x34e36b[_0x4a69('0x34')][_0x4a69('0x3f')]){_0x3ff847[_0x4a69('0x3c')]=_[_0x4a69('0x40')](_0x3ff847[_0x4a69('0x3c')],{'$or':_[_0x4a69('0x2d')](_0xfe4538,function(_0x22baf5){if(_0x22baf5[_0x4a69('0x30')]!==_0x4a69('0x41')){var _0x4e6de6={};_0x4e6de6[_0x22baf5['name']]={'$like':'%'+_0x34e36b[_0x4a69('0x34')]['filter']+'%'};return _0x4e6de6;}})});}_0x3ff847=_[_0x4a69('0x40')]({},_0x3ff847,_0x34e36b[_0x4a69('0x42')]);var _0x4ba11f={'where':_0x3ff847[_0x4a69('0x3c')]};return db[_0x4a69('0x2e')][_0x4a69('0x20')](_0x4ba11f)[_0x4a69('0x27')](function(_0x778d34){_0xad11cf[_0x4a69('0x20')]=_0x778d34;if(_0x34e36b[_0x4a69('0x34')][_0x4a69('0x43')]){_0x3ff847[_0x4a69('0x44')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4a69('0x45')](_0x3ff847);})[_0x4a69('0x27')](function(_0x8ac1c0){_0xad11cf[_0x4a69('0x46')]=_0x8ac1c0;return _0xad11cf;})['then'](respondWithFilteredResult(_0x436f08,_0x3ff847))[_0x4a69('0x47')](handleError(_0x436f08,null));};exports[_0x4a69('0x48')]=function(_0x5bee9f,_0x23ffbe){var _0x19a05f={'raw':![],'where':{'id':_0x5bee9f[_0x4a69('0x49')]['id']}},_0x7370f1={};_0x7370f1[_0x4a69('0x32')]=_[_0x4a69('0x33')](db[_0x4a69('0x2e')][_0x4a69('0x4a')]);_0x7370f1[_0x4a69('0x34')]=_[_0x4a69('0x33')](_0x5bee9f[_0x4a69('0x34')]);_0x7370f1[_0x4a69('0x3e')]=_[_0x4a69('0x35')](_0x7370f1[_0x4a69('0x32')],_0x7370f1['query']);_0x19a05f[_0x4a69('0x36')]=_['intersection'](_0x7370f1['model'],qs[_0x4a69('0x37')](_0x5bee9f['query'][_0x4a69('0x37')]));_0x19a05f[_0x4a69('0x36')]=_0x19a05f[_0x4a69('0x36')][_0x4a69('0x38')]?_0x19a05f[_0x4a69('0x36')]:_0x7370f1[_0x4a69('0x32')];if(_0x5bee9f[_0x4a69('0x34')][_0x4a69('0x43')]){_0x19a05f[_0x4a69('0x44')]=[{'all':!![]}];}_0x19a05f=_['merge']({},_0x19a05f,_0x5bee9f[_0x4a69('0x42')]);return db[_0x4a69('0x2e')][_0x4a69('0x4b')](_0x19a05f)[_0x4a69('0x27')](handleEntityNotFound(_0x23ffbe,null))['then'](respondWithResult(_0x23ffbe,null))['catch'](handleError(_0x23ffbe,null));};exports['create']=function(_0x15880c,_0x42643){return db['AnalyticFieldReport'][_0x4a69('0x4c')](_0x15880c['body'],{})['then'](respondWithResult(_0x42643,0xc9))[_0x4a69('0x47')](handleError(_0x42643,null));};exports[_0x4a69('0x4d')]=function(_0x5397c4,_0x1e94b3){return db['AnalyticFieldReport'][_0x4a69('0x4d')](_0x5397c4[_0x4a69('0x4e')],{'raw':![],'individualHooks':!![]})[_0x4a69('0x27')](respondWithResult(_0x1e94b3,0xc9))[_0x4a69('0x47')](handleError(_0x1e94b3,null));};exports[_0x4a69('0x26')]=function(_0x482655,_0x4149a6){if(_0x482655[_0x4a69('0x4e')]['id']){delete _0x482655[_0x4a69('0x4e')]['id'];}return db[_0x4a69('0x2e')][_0x4a69('0x4b')]({'where':{'id':_0x482655['params']['id']}})[_0x4a69('0x27')](handleEntityNotFound(_0x4149a6,null))[_0x4a69('0x27')](saveUpdates(_0x482655[_0x4a69('0x4e')],null))[_0x4a69('0x27')](respondWithResult(_0x4149a6,null))[_0x4a69('0x47')](handleError(_0x4149a6,null));};exports['destroy']=function(_0x50be0b,_0x325b0a){return db['AnalyticFieldReport']['find']({'where':{'id':_0x50be0b[_0x4a69('0x49')]['id']}})[_0x4a69('0x27')](handleEntityNotFound(_0x325b0a,null))[_0x4a69('0x27')](removeEntity(_0x325b0a,null))[_0x4a69('0x47')](handleError(_0x325b0a,null));};exports[_0x4a69('0x4f')]=function(_0x108f1e,_0x16ae16){return db[_0x4a69('0x2e')][_0x4a69('0x28')]({'where':{'id':_0x108f1e['query'][_0x4a69('0x50')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x16ae16,0xcc))[_0x4a69('0x47')](handleError(_0x16ae16,null));};exports['addFields']=function(_0x16ebd6,_0x52ee6c,_0x30d304){return db[_0x4a69('0x51')]['findOne']({'where':{'id':_0x16ebd6[_0x4a69('0x49')]['id']}})[_0x4a69('0x27')](handleEntityNotFound(_0x52ee6c,null))[_0x4a69('0x27')](function(_0x5c7b07){if(_0x5c7b07){return db[_0x4a69('0x52')]['transaction'](function(_0x1319b7){return db['AnalyticFieldReport'][_0x4a69('0x28')]({'where':{'CustomReportId':_0x16ebd6['params']['id']},'transaction':_0x1319b7})[_0x4a69('0x27')](function(_0x403d2c){var _0x3a4ac1=_[_0x4a69('0x2d')](_0x16ebd6[_0x4a69('0x4e')],function(_0x2f0cfb){delete _0x2f0cfb['id'];_0x2f0cfb['CustomReportId']=_0x16ebd6[_0x4a69('0x49')]['id'];return _0x2f0cfb;});return db['AnalyticFieldReport'][_0x4a69('0x4d')](_0x3a4ac1,{'transaction':_0x1319b7});});})['then'](function(){return db[_0x4a69('0x2e')][_0x4a69('0x45')]({'where':{'CustomReportId':_0x16ebd6[_0x4a69('0x49')]['id']}});});}})[_0x4a69('0x27')](respondWithResult(_0x52ee6c,null))[_0x4a69('0x47')](handleError(_0x52ee6c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d581921..c9f53bd 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 _0x2550=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x1d3707,_0x20f724){var _0x3f8c7a=function(_0x509397){while(--_0x509397){_0x1d3707['push'](_0x1d3707['shift']());}};_0x3f8c7a(++_0x20f724);}(_0x2550,0x114));var _0x0255=function(_0x6a05c4,_0x20eb0e){_0x6a05c4=_0x6a05c4-0x0;var _0x77b7c7=_0x2550[_0x6a05c4];return _0x77b7c7;};'use strict';var _=require(_0x0255('0x0'));var util=require(_0x0255('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0255('0x2'));var BPromise=require(_0x0255('0x3'));var rp=require(_0x0255('0x4'));var fs=require('fs');var path=require(_0x0255('0x5'));var rimraf=require(_0x0255('0x6'));var config=require(_0x0255('0x7'));var attributes=require(_0x0255('0x8'));module[_0x0255('0x9')]=function(_0x347545,_0x458638){return _0x347545[_0x0255('0xa')](_0x0255('0xb'),attributes,{'tableName':_0x0255('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d15=['define','analytics_report_fields','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports'];(function(_0x48708a,_0x224103){var _0x1c596e=function(_0x5b73d4){while(--_0x5b73d4){_0x48708a['push'](_0x48708a['shift']());}};_0x1c596e(++_0x224103);}(_0x8d15,0x1ee));var _0x58d1=function(_0x2df588,_0x318219){_0x2df588=_0x2df588-0x0;var _0x2871a9=_0x8d15[_0x2df588];return _0x2871a9;};'use strict';var _=require(_0x58d1('0x0'));var util=require(_0x58d1('0x1'));var logger=require('../../config/logger')(_0x58d1('0x2'));var moment=require(_0x58d1('0x3'));var BPromise=require(_0x58d1('0x4'));var rp=require(_0x58d1('0x5'));var fs=require('fs');var path=require(_0x58d1('0x6'));var rimraf=require(_0x58d1('0x7'));var config=require('../../config/environment');var attributes=require(_0x58d1('0x8'));module[_0x58d1('0x9')]=function(_0x67f943,_0x812963){return _0x67f943[_0x58d1('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x58d1('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 bb30a79..3e02af0 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 _0x523f=['request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x523f,0x137));var _0xf523=function(_0x4011a4,_0xee3fdb){_0x4011a4=_0x4011a4-0x0;var _0xc1a536=_0x523f[_0x4011a4];return _0xc1a536;};'use strict';var _=require(_0xf523('0x0'));var util=require(_0xf523('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf523('0x2'));var fs=require('fs');var Redis=require(_0xf523('0x3'));var db=require(_0xf523('0x4'))['db'];var utils=require(_0xf523('0x5'));var logger=require(_0xf523('0x6'))(_0xf523('0x7'));var config=require(_0xf523('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf523('0x9')][_0xf523('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x144a81,_0x5a958a,_0x4fa545){return new BPromise(function(_0x317b2d,_0x5aea22){return client['request'](_0x144a81,_0x4fa545)['then'](function(_0x16ff82){logger[_0xf523('0xb')](_0xf523('0xc'),_0x5a958a,'request\x20sent');logger[_0xf523('0xd')](_0xf523('0xe'),_0x5a958a,'request\x20sent',JSON[_0xf523('0xf')](_0x16ff82));if(_0x16ff82[_0xf523('0x10')]){if(_0x16ff82[_0xf523('0x10')][_0xf523('0x11')]===0x1f4){logger[_0xf523('0x10')](_0xf523('0xc'),_0x5a958a,_0x16ff82['error'][_0xf523('0x12')]);return _0x5aea22(_0x16ff82[_0xf523('0x10')][_0xf523('0x12')]);}logger[_0xf523('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5a958a,_0x16ff82[_0xf523('0x10')][_0xf523('0x12')]);return _0x317b2d(_0x16ff82[_0xf523('0x10')][_0xf523('0x12')]);}else{logger[_0xf523('0xb')](_0xf523('0xc'),_0x5a958a,_0xf523('0x13'));_0x317b2d(_0x16ff82[_0xf523('0x14')][_0xf523('0x12')]);}})[_0xf523('0x15')](function(_0x98c767){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5a958a,_0x98c767);_0x5aea22(_0x98c767);});});} \ No newline at end of file +var _0xa9c9=['rpc','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57b287,_0x495d83){var _0x3cafa5=function(_0x295881){while(--_0x295881){_0x57b287['push'](_0x57b287['shift']());}};_0x3cafa5(++_0x495d83);}(_0xa9c9,0xbf));var _0x9a9c=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xa9c9[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require(_0x9a9c('0x0'));var moment=require(_0x9a9c('0x1'));var BPromise=require(_0x9a9c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a9c('0x3'));var db=require(_0x9a9c('0x4'))['db'];var utils=require(_0x9a9c('0x5'));var logger=require(_0x9a9c('0x6'))(_0x9a9c('0x7'));var config=require(_0x9a9c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a9c('0x9')][_0x9a9c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d6ea6,_0x523c4,_0x2d73ce){return new BPromise(function(_0x461e18,_0x11b9c8){return client[_0x9a9c('0xb')](_0x2d6ea6,_0x2d73ce)[_0x9a9c('0xc')](function(_0x361824){logger[_0x9a9c('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x523c4,'request\x20sent');logger['debug'](_0x9a9c('0xe'),_0x523c4,_0x9a9c('0xf'),JSON[_0x9a9c('0x10')](_0x361824));if(_0x361824[_0x9a9c('0x11')]){if(_0x361824[_0x9a9c('0x11')]['code']===0x1f4){logger[_0x9a9c('0x11')](_0x9a9c('0x12'),_0x523c4,_0x361824[_0x9a9c('0x11')][_0x9a9c('0x13')]);return _0x11b9c8(_0x361824[_0x9a9c('0x11')][_0x9a9c('0x13')]);}logger[_0x9a9c('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x523c4,_0x361824[_0x9a9c('0x11')][_0x9a9c('0x13')]);return _0x461e18(_0x361824[_0x9a9c('0x11')][_0x9a9c('0x13')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x523c4,_0x9a9c('0xf'));_0x461e18(_0x361824[_0x9a9c('0x14')][_0x9a9c('0x13')]);}})[_0x9a9c('0x15')](function(_0x88c5f8){logger[_0x9a9c('0x11')](_0x9a9c('0x12'),_0x523c4,_0x88c5f8);_0x11b9c8(_0x88c5f8);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 95abb3f..1c4dada 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(_0x2248c4,_0x2f73be){var _0x573531=function(_0x2de380){while(--_0x2de380){_0x2248c4['push'](_0x2248c4['shift']());}};_0x573531(++_0x2f73be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x23a399,_0x5b4e73){var _0x8a61e8=function(_0x5afa12){while(--_0x5afa12){_0x23a399['push'](_0x23a399['shift']());}};_0x8a61e8(++_0x5b4e73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 060997c..730925c 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 _0xe812=['exports','STRING','TEXT'];(function(_0x23fd49,_0x433b7d){var _0x2b4d27=function(_0x4cb858){while(--_0x4cb858){_0x23fd49['push'](_0x23fd49['shift']());}};_0x2b4d27(++_0x433b7d);}(_0xe812,0x1f2));var _0x2e81=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe812[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x2e81('0x0')]={'name':{'type':Sequelize[_0x2e81('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x2e81('0x2')]},'description':{'type':Sequelize[_0x2e81('0x1')]}}; \ No newline at end of file +var _0x4dfc=['STRING','TEXT','name'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x4dfc,0xda));var _0xc4df=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x4dfc[_0x1793de];return _0x4f0309;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc4df('0x0')},'table':{'type':Sequelize[_0xc4df('0x1')]},'metric':{'type':Sequelize[_0xc4df('0x2')]},'description':{'type':Sequelize[_0xc4df('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fd85665..a45bc99 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 _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x202207,_0x3f2fb5){var _0x4599da=function(_0x2f9bf6){while(--_0x2f9bf6){_0x202207['push'](_0x202207['shift']());}};_0x4599da(++_0x3f2fb5);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x24ca[_0x1f8053];return _0x174fd8;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file +var _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x42a791,_0x1f32c7){var _0x1732b1=function(_0x5ed167){while(--_0x5ed167){_0x42a791['push'](_0x42a791['shift']());}};_0x1732b1(++_0x1f32c7);}(_0x008c,0x188));var _0xc008=function(_0x1f5974,_0x11540c){_0x1f5974=_0x1f5974-0x0;var _0x5cb353=_0x008c[_0x1f5974];return _0x5cb353;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2bf0df8..d0cd987 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 _0x21b7=['../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','api','moment','bluebird','request-promise'];(function(_0x1b7d42,_0x176be6){var _0x33b0af=function(_0x1b2129){while(--_0x1b2129){_0x1b7d42['push'](_0x1b7d42['shift']());}};_0x33b0af(++_0x176be6);}(_0x21b7,0xef));var _0x721b=function(_0x1ebf64,_0x246f66){_0x1ebf64=_0x1ebf64-0x0;var _0x293751=_0x21b7[_0x1ebf64];return _0x293751;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x721b('0x0'));var moment=require(_0x721b('0x1'));var BPromise=require(_0x721b('0x2'));var rp=require(_0x721b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x721b('0x4'));var attributes=require(_0x721b('0x5'));module[_0x721b('0x6')]=function(_0x343cd3,_0x168d33){return _0x343cd3[_0x721b('0x7')]('AnalyticMetric',attributes,{'tableName':_0x721b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03db=['AnalyticMetric','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x79ed15,_0x2aceae){var _0x5b609e=function(_0x5916e8){while(--_0x5916e8){_0x79ed15['push'](_0x79ed15['shift']());}};_0x5b609e(++_0x2aceae);}(_0x03db,0x156));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb03d('0x0'));var util=require(_0xb03d('0x1'));var logger=require(_0xb03d('0x2'))(_0xb03d('0x3'));var moment=require('moment');var BPromise=require(_0xb03d('0x4'));var rp=require(_0xb03d('0x5'));var fs=require('fs');var path=require(_0xb03d('0x6'));var rimraf=require(_0xb03d('0x7'));var config=require(_0xb03d('0x8'));var attributes=require('./analyticMetric.attributes');module[_0xb03d('0x9')]=function(_0x1a01ba,_0x9a0f36){return _0x1a01ba['define'](_0xb03d('0xa'),attributes,{'tableName':'analytics_metrics','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 2b754ac..6b7d1c9 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 _0x3ea9=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0x3ea9,0x153));var _0x93ea=function(_0x2f6a3f,_0x87db21){_0x2f6a3f=_0x2f6a3f-0x0;var _0x26b83c=_0x3ea9[_0x2f6a3f];return _0x26b83c;};'use strict';var _=require(_0x93ea('0x0'));var util=require(_0x93ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93ea('0x2'));var db=require(_0x93ea('0x3'))['db'];var utils=require(_0x93ea('0x4'));var logger=require('../../config/logger')(_0x93ea('0x5'));var config=require('../../config/environment');var jayson=require(_0x93ea('0x6'));var client=jayson[_0x93ea('0x7')][_0x93ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272daf,_0x4f54c8,_0x81e63d){return new BPromise(function(_0x4b5fc3,_0xa93f07){return client[_0x93ea('0x9')](_0x272daf,_0x81e63d)[_0x93ea('0xa')](function(_0x5ea70a){logger[_0x93ea('0xb')](_0x93ea('0xc'),_0x4f54c8,_0x93ea('0xd'));logger[_0x93ea('0xe')](_0x93ea('0xf'),_0x4f54c8,_0x93ea('0xd'),JSON[_0x93ea('0x10')](_0x5ea70a));if(_0x5ea70a[_0x93ea('0x11')]){if(_0x5ea70a['error'][_0x93ea('0x12')]===0x1f4){logger[_0x93ea('0x11')](_0x93ea('0xc'),_0x4f54c8,_0x5ea70a[_0x93ea('0x11')][_0x93ea('0x13')]);return _0xa93f07(_0x5ea70a[_0x93ea('0x11')][_0x93ea('0x13')]);}logger[_0x93ea('0x11')](_0x93ea('0xc'),_0x4f54c8,_0x5ea70a[_0x93ea('0x11')]['message']);return _0x4b5fc3(_0x5ea70a[_0x93ea('0x11')][_0x93ea('0x13')]);}else{logger[_0x93ea('0xb')](_0x93ea('0xc'),_0x4f54c8,_0x93ea('0xd'));_0x4b5fc3(_0x5ea70a[_0x93ea('0x14')][_0x93ea('0x13')]);}})[_0x93ea('0x15')](function(_0x1e2ed7){logger[_0x93ea('0x11')](_0x93ea('0xc'),_0x4f54c8,_0x1e2ed7);_0xa93f07(_0x1e2ed7);});});} \ No newline at end of file +var _0x7df3=['request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x7df3,0x14b));var _0x37df=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7df3[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x37df('0x0'));var util=require('util');var moment=require(_0x37df('0x1'));var BPromise=require(_0x37df('0x2'));var rs=require(_0x37df('0x3'));var fs=require('fs');var Redis=require(_0x37df('0x4'));var db=require(_0x37df('0x5'))['db'];var utils=require(_0x37df('0x6'));var logger=require(_0x37df('0x7'))(_0x37df('0x8'));var config=require(_0x37df('0x9'));var jayson=require(_0x37df('0xa'));var client=jayson[_0x37df('0xb')][_0x37df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c1caf,_0x2ab2f2,_0xd605da){return new BPromise(function(_0xc56756,_0x1e1b16){return client[_0x37df('0xd')](_0x2c1caf,_0xd605da)[_0x37df('0xe')](function(_0x1cc92a){logger[_0x37df('0xf')](_0x37df('0x10'),_0x2ab2f2,'request\x20sent');logger[_0x37df('0x11')](_0x37df('0x12'),_0x2ab2f2,_0x37df('0x13'),JSON['stringify'](_0x1cc92a));if(_0x1cc92a[_0x37df('0x14')]){if(_0x1cc92a['error'][_0x37df('0x15')]===0x1f4){logger[_0x37df('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x2ab2f2,_0x1cc92a['error'][_0x37df('0x16')]);return _0x1e1b16(_0x1cc92a[_0x37df('0x14')][_0x37df('0x16')]);}logger[_0x37df('0x14')](_0x37df('0x10'),_0x2ab2f2,_0x1cc92a[_0x37df('0x14')][_0x37df('0x16')]);return _0xc56756(_0x1cc92a[_0x37df('0x14')][_0x37df('0x16')]);}else{logger[_0x37df('0xf')](_0x37df('0x10'),_0x2ab2f2,_0x37df('0x13'));_0xc56756(_0x1cc92a[_0x37df('0x17')]['message']);}})[_0x37df('0x18')](function(_0x51f115){logger[_0x37df('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x2ab2f2,_0x51f115);_0x1e1b16(_0x51f115);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9e38658..30fdf70 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 _0x6c84=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x30103d,_0x5ed539){var _0x35e583=function(_0x56f56a){while(--_0x56f56a){_0x30103d['push'](_0x30103d['shift']());}};_0x35e583(++_0x5ed539);}(_0x6c84,0x112));var _0x46c8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6c84[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x46c8('0x0'));var util=require(_0x46c8('0x1'));var path=require(_0x46c8('0x2'));var timeout=require(_0x46c8('0x3'));var express=require(_0x46c8('0x4'));var router=express['Router']();var fs_extra=require(_0x46c8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x46c8('0x6'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x46c8('0x7')]('/',auth[_0x46c8('0x8')](),controller[_0x46c8('0x9')]);router[_0x46c8('0x7')](_0x46c8('0xa'),auth[_0x46c8('0x8')](),controller[_0x46c8('0xb')]);router[_0x46c8('0xc')]('/',auth['isAuthenticated'](),controller[_0x46c8('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x46c8('0xe')]);router['delete'](_0x46c8('0xa'),auth[_0x46c8('0x8')](),controller[_0x46c8('0xf')]);module[_0x46c8('0x10')]=router; \ No newline at end of file +var _0x7118=['show','post','create','put','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x7118,0x159));var _0x8711=function(_0x1bb4a8,_0x11b51e){_0x1bb4a8=_0x1bb4a8-0x0;var _0x270930=_0x7118[_0x1bb4a8];return _0x270930;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var timeout=require(_0x8711('0x1'));var express=require('express');var router=express[_0x8711('0x2')]();var fs_extra=require(_0x8711('0x3'));var auth=require(_0x8711('0x4'));var interaction=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var controller=require(_0x8711('0x7'));router[_0x8711('0x8')]('/',auth['isAuthenticated'](),controller[_0x8711('0x9')]);router[_0x8711('0x8')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0xc')]);router[_0x8711('0xd')]('/',auth[_0x8711('0xb')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller['update']);router['delete'](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 3b03c91..dd479d3 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 _0xf492=['TEXT','sequelize','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xf492,0x67));var _0x2f49=function(_0x46a67b,_0x4d7b77){_0x46a67b=_0x46a67b-0x0;var _0x47e8bf=_0xf492[_0x46a67b];return _0x47e8bf;};'use strict';var Sequelize=require(_0x2f49('0x0'));module[_0x2f49('0x1')]={'tree':{'type':Sequelize[_0x2f49('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1db5=['sequelize','TEXT'];(function(_0x5884b2,_0xa393d2){var _0x31574f=function(_0x316964){while(--_0x316964){_0x5884b2['push'](_0x5884b2['shift']());}};_0x31574f(++_0xa393d2);}(_0x1db5,0x1c0));var _0x51db=function(_0x32e3bb,_0x24dc99){_0x32e3bb=_0x32e3bb-0x0;var _0x572aca=_0x1db5[_0x32e3bb];return _0x572aca;};'use strict';var Sequelize=require(_0x51db('0x0'));module['exports']={'tree':{'type':Sequelize[_0x51db('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 619c5b1..881f5ce 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 _0x0af2=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','count','limit','Content-Range','reject','save','then','destroy','end','sendStatus','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x451402,_0x561cb8){var _0x4ffb7f=function(_0x1c263a){while(--_0x1c263a){_0x451402['push'](_0x451402['shift']());}};_0x4ffb7f(++_0x561cb8);}(_0x0af2,0xbe));var _0x20af=function(_0x240069,_0x378f63){_0x240069=_0x240069-0x0;var _0x465688=_0x0af2[_0x240069];return _0x465688;};'use strict';var emlformat=require(_0x20af('0x0'));var rimraf=require(_0x20af('0x1'));var zipdir=require(_0x20af('0x2'));var jsonpatch=require(_0x20af('0x3'));var rp=require(_0x20af('0x4'));var moment=require(_0x20af('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x20af('0x6'));var util=require(_0x20af('0x7'));var path=require(_0x20af('0x8'));var sox=require('sox');var csv=require(_0x20af('0x9'));var ejs=require(_0x20af('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20af('0xb'));var squel=require('squel');var crypto=require(_0x20af('0xc'));var jsforce=require(_0x20af('0xd'));var deskjs=require(_0x20af('0xe'));var toCsv=require(_0x20af('0x9'));var querystring=require(_0x20af('0xf'));var Papa=require(_0x20af('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x20af('0x11'));var as=require(_0x20af('0x12'));var hardwareService=require(_0x20af('0x13'));var logger=require(_0x20af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x20af('0x15'));var licenseUtil=require(_0x20af('0x16'));var db=require(_0x20af('0x17'))['db'];function respondWithStatusCode(_0x621a25,_0x324b1f){_0x324b1f=_0x324b1f||0xcc;return function(_0x5c2de0){if(_0x5c2de0){return _0x621a25['sendStatus'](_0x324b1f);}return _0x621a25[_0x20af('0x18')](_0x324b1f)['end']();};}function respondWithResult(_0x10e4cf,_0x4469e1){_0x4469e1=_0x4469e1||0xc8;return function(_0xe55e3f){if(_0xe55e3f){return _0x10e4cf[_0x20af('0x18')](_0x4469e1)[_0x20af('0x19')](_0xe55e3f);}};}function respondWithFilteredResult(_0x1066c1,_0x8a38a4){return function(_0x36cc95){if(_0x36cc95){var _0x10090e=typeof _0x8a38a4[_0x20af('0x1a')]==='undefined'&&typeof _0x8a38a4['limit']==='undefined';var _0x1eaee7=_0x36cc95['count'];var _0x28e101=_0x10090e?0x0:_0x8a38a4[_0x20af('0x1a')];var _0xfabf01=_0x10090e?_0x36cc95[_0x20af('0x1b')]:_0x8a38a4[_0x20af('0x1a')]+_0x8a38a4[_0x20af('0x1c')];var _0x163bfc;if(_0xfabf01>=_0x1eaee7){_0xfabf01=_0x1eaee7;_0x163bfc=0xc8;}else{_0x163bfc=0xce;}_0x1066c1['status'](_0x163bfc);return _0x1066c1['set'](_0x20af('0x1d'),_0x28e101+'-'+_0xfabf01+'/'+_0x1eaee7)[_0x20af('0x19')](_0x36cc95);}return null;};}function patchUpdates(_0x5e2acc){return function(_0x557533){try{jsonpatch['apply'](_0x557533,_0x5e2acc,!![]);}catch(_0x5e0e36){return BPromise[_0x20af('0x1e')](_0x5e0e36);}return _0x557533[_0x20af('0x1f')]();};}function saveUpdates(_0x2319dd,_0xd7d266){return function(_0x2a5c58){if(_0x2a5c58){return _0x2a5c58['update'](_0x2319dd)[_0x20af('0x20')](function(_0x2eac9d){return _0x2eac9d;});}return null;};}function removeEntity(_0x40e28f,_0x4dc791){return function(_0x464813){if(_0x464813){return _0x464813[_0x20af('0x21')]()[_0x20af('0x20')](function(){_0x40e28f[_0x20af('0x18')](0xcc)[_0x20af('0x22')]();});}};}function handleEntityNotFound(_0x34d76a,_0x43c467){return function(_0x58a8ff){if(!_0x58a8ff){_0x34d76a[_0x20af('0x23')](0x194);}return _0x58a8ff;};}function handleError(_0x21818f,_0x295e42){_0x295e42=_0x295e42||0x1f4;return function(_0x4bc8f9){logger[_0x20af('0x24')](_0x4bc8f9[_0x20af('0x25')]);if(_0x4bc8f9['name']){delete _0x4bc8f9[_0x20af('0x26')];}_0x21818f[_0x20af('0x18')](_0x295e42)['send'](_0x4bc8f9);};}exports[_0x20af('0x27')]=function(_0x499b3b,_0x16e7c6){var _0x18a844={},_0x4f67ac={},_0x542b2b={'count':0x0,'rows':[]};var _0x2a9775=_[_0x20af('0x28')](db[_0x20af('0x29')][_0x20af('0x2a')],function(_0x26b0c5){return{'name':_0x26b0c5['fieldName'],'type':_0x26b0c5[_0x20af('0x2b')][_0x20af('0x2c')]};});_0x4f67ac['model']=_['map'](_0x2a9775,_0x20af('0x26'));_0x4f67ac['query']=_['keys'](_0x499b3b[_0x20af('0x2d')]);_0x4f67ac[_0x20af('0x2e')]=_['intersection'](_0x4f67ac[_0x20af('0x2f')],_0x4f67ac[_0x20af('0x2d')]);_0x18a844['attributes']=_[_0x20af('0x30')](_0x4f67ac[_0x20af('0x2f')],qs[_0x20af('0x31')](_0x499b3b[_0x20af('0x2d')]['fields']));_0x18a844[_0x20af('0x32')]=_0x18a844['attributes'][_0x20af('0x33')]?_0x18a844['attributes']:_0x4f67ac[_0x20af('0x2f')];if(!_0x499b3b[_0x20af('0x2d')][_0x20af('0x34')]('nolimit')){_0x18a844['limit']=qs['limit'](_0x499b3b[_0x20af('0x2d')][_0x20af('0x1c')]);_0x18a844[_0x20af('0x1a')]=qs[_0x20af('0x1a')](_0x499b3b['query'][_0x20af('0x1a')]);}_0x18a844[_0x20af('0x35')]=qs[_0x20af('0x36')](_0x499b3b[_0x20af('0x2d')][_0x20af('0x36')]);_0x18a844['where']=qs[_0x20af('0x2e')](_[_0x20af('0x37')](_0x499b3b['query'],_0x4f67ac['filters']),_0x2a9775);if(_0x499b3b[_0x20af('0x2d')][_0x20af('0x38')]){_0x18a844[_0x20af('0x39')]=_[_0x20af('0x3a')](_0x18a844[_0x20af('0x39')],{'$or':_[_0x20af('0x28')](_0x2a9775,function(_0x532a71){if(_0x532a71[_0x20af('0x2b')]!==_0x20af('0x3b')){var _0x29e90f={};_0x29e90f[_0x532a71[_0x20af('0x26')]]={'$like':'%'+_0x499b3b['query'][_0x20af('0x38')]+'%'};return _0x29e90f;}})});}_0x18a844=_['merge']({},_0x18a844,_0x499b3b['options']);var _0x9ba8d4={'where':_0x18a844[_0x20af('0x39')]};return db[_0x20af('0x29')][_0x20af('0x1b')](_0x9ba8d4)[_0x20af('0x20')](function(_0x54fab7){_0x542b2b['count']=_0x54fab7;if(_0x499b3b[_0x20af('0x2d')][_0x20af('0x3c')]){_0x18a844['include']=[{'all':!![]}];}return db[_0x20af('0x29')][_0x20af('0x3d')](_0x18a844);})[_0x20af('0x20')](function(_0x2f2baf){_0x542b2b[_0x20af('0x3e')]=_0x2f2baf;return _0x542b2b;})['then'](respondWithFilteredResult(_0x16e7c6,_0x18a844))[_0x20af('0x3f')](handleError(_0x16e7c6,null));};exports['show']=function(_0x560a40,_0x301e2d){var _0x279bcb={'raw':!![],'where':{'id':_0x560a40[_0x20af('0x40')]['id']}},_0x2d16e0={};_0x2d16e0[_0x20af('0x2f')]=_[_0x20af('0x41')](db[_0x20af('0x29')][_0x20af('0x2a')]);_0x2d16e0['query']=_['keys'](_0x560a40[_0x20af('0x2d')]);_0x2d16e0['filters']=_['intersection'](_0x2d16e0[_0x20af('0x2f')],_0x2d16e0[_0x20af('0x2d')]);_0x279bcb[_0x20af('0x32')]=_[_0x20af('0x30')](_0x2d16e0[_0x20af('0x2f')],qs['fields'](_0x560a40['query'][_0x20af('0x31')]));_0x279bcb['attributes']=_0x279bcb[_0x20af('0x32')]['length']?_0x279bcb[_0x20af('0x32')]:_0x2d16e0['model'];if(_0x560a40[_0x20af('0x2d')]['includeAll']){_0x279bcb['include']=[{'all':!![]}];}_0x279bcb=_[_0x20af('0x3a')]({},_0x279bcb,_0x560a40[_0x20af('0x42')]);return db[_0x20af('0x29')][_0x20af('0x43')](_0x279bcb)[_0x20af('0x20')](handleEntityNotFound(_0x301e2d,null))[_0x20af('0x20')](respondWithResult(_0x301e2d,null))[_0x20af('0x3f')](handleError(_0x301e2d,null));};exports[_0x20af('0x44')]=function(_0x10c7e7,_0x8357d3){return db[_0x20af('0x29')][_0x20af('0x44')](_0x10c7e7['body'],{})[_0x20af('0x20')](respondWithResult(_0x8357d3,0xc9))[_0x20af('0x3f')](handleError(_0x8357d3,null));};exports['update']=function(_0x287d6f,_0x450e5a){if(_0x287d6f['body']['id']){delete _0x287d6f[_0x20af('0x45')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x287d6f[_0x20af('0x40')]['id']}})[_0x20af('0x20')](handleEntityNotFound(_0x450e5a,null))[_0x20af('0x20')](saveUpdates(_0x287d6f['body'],null))[_0x20af('0x20')](respondWithResult(_0x450e5a,null))[_0x20af('0x3f')](handleError(_0x450e5a,null));};exports[_0x20af('0x21')]=function(_0xd5dfe2,_0x527e99){return db['AnalyticTreeReport'][_0x20af('0x43')]({'where':{'id':_0xd5dfe2[_0x20af('0x40')]['id']}})[_0x20af('0x20')](handleEntityNotFound(_0x527e99,null))[_0x20af('0x20')](removeEntity(_0x527e99,null))[_0x20af('0x3f')](handleError(_0x527e99,null));}; \ No newline at end of file +var _0xffc4=['count','offset','set','apply','reject','then','destroy','error','stack','name','index','AnalyticTreeReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','filter','options','includeAll','include','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x45f741,_0xc0ea1d){var _0x12e05a=function(_0x483c01){while(--_0x483c01){_0x45f741['push'](_0x45f741['shift']());}};_0x12e05a(++_0xc0ea1d);}(_0xffc4,0x6c));var _0x4ffc=function(_0x42dd53,_0xec94a){_0x42dd53=_0x42dd53-0x0;var _0x3d77cb=_0xffc4[_0x42dd53];return _0x3d77cb;};'use strict';var emlformat=require(_0x4ffc('0x0'));var rimraf=require(_0x4ffc('0x1'));var zipdir=require(_0x4ffc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ffc('0x3'));var moment=require(_0x4ffc('0x4'));var BPromise=require(_0x4ffc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ffc('0x6'));var sox=require(_0x4ffc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ffc('0x8'));var _=require(_0x4ffc('0x9'));var squel=require('squel');var crypto=require(_0x4ffc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4ffc('0xb'));var toCsv=require(_0x4ffc('0xc'));var querystring=require(_0x4ffc('0xd'));var Papa=require(_0x4ffc('0xe'));var Redis=require('ioredis');var authService=require(_0x4ffc('0xf'));var qs=require(_0x4ffc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ffc('0x11'));var logger=require(_0x4ffc('0x12'))(_0x4ffc('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4ffc('0x14'));var db=require(_0x4ffc('0x15'))['db'];function respondWithStatusCode(_0x2b68f6,_0x71d8f9){_0x71d8f9=_0x71d8f9||0xcc;return function(_0x5df1f1){if(_0x5df1f1){return _0x2b68f6[_0x4ffc('0x16')](_0x71d8f9);}return _0x2b68f6[_0x4ffc('0x17')](_0x71d8f9)[_0x4ffc('0x18')]();};}function respondWithResult(_0x1d2a88,_0x1bd94f){_0x1bd94f=_0x1bd94f||0xc8;return function(_0xcc8b6b){if(_0xcc8b6b){return _0x1d2a88[_0x4ffc('0x17')](_0x1bd94f)[_0x4ffc('0x19')](_0xcc8b6b);}};}function respondWithFilteredResult(_0x19f2aa,_0x6e4c4b){return function(_0x1c33f6){if(_0x1c33f6){var _0x578a70=typeof _0x6e4c4b['offset']===_0x4ffc('0x1a')&&typeof _0x6e4c4b[_0x4ffc('0x1b')]===_0x4ffc('0x1a');var _0x7a9f77=_0x1c33f6[_0x4ffc('0x1c')];var _0x2186e9=_0x578a70?0x0:_0x6e4c4b[_0x4ffc('0x1d')];var _0x2e682d=_0x578a70?_0x1c33f6[_0x4ffc('0x1c')]:_0x6e4c4b[_0x4ffc('0x1d')]+_0x6e4c4b[_0x4ffc('0x1b')];var _0x36d69f;if(_0x2e682d>=_0x7a9f77){_0x2e682d=_0x7a9f77;_0x36d69f=0xc8;}else{_0x36d69f=0xce;}_0x19f2aa[_0x4ffc('0x17')](_0x36d69f);return _0x19f2aa[_0x4ffc('0x1e')]('Content-Range',_0x2186e9+'-'+_0x2e682d+'/'+_0x7a9f77)[_0x4ffc('0x19')](_0x1c33f6);}return null;};}function patchUpdates(_0x1e5230){return function(_0x56660a){try{jsonpatch[_0x4ffc('0x1f')](_0x56660a,_0x1e5230,!![]);}catch(_0x12e28d){return BPromise[_0x4ffc('0x20')](_0x12e28d);}return _0x56660a['save']();};}function saveUpdates(_0x3b2191,_0x109442){return function(_0x25984a){if(_0x25984a){return _0x25984a['update'](_0x3b2191)[_0x4ffc('0x21')](function(_0x5b4bdb){return _0x5b4bdb;});}return null;};}function removeEntity(_0x1109c6,_0x2565e4){return function(_0x52bd14){if(_0x52bd14){return _0x52bd14[_0x4ffc('0x22')]()[_0x4ffc('0x21')](function(){_0x1109c6[_0x4ffc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bd2ee,_0x1ac269){return function(_0x5ce627){if(!_0x5ce627){_0x4bd2ee[_0x4ffc('0x16')](0x194);}return _0x5ce627;};}function handleError(_0x244145,_0xdd3cec){_0xdd3cec=_0xdd3cec||0x1f4;return function(_0xe233b3){logger[_0x4ffc('0x23')](_0xe233b3[_0x4ffc('0x24')]);if(_0xe233b3[_0x4ffc('0x25')]){delete _0xe233b3[_0x4ffc('0x25')];}_0x244145['status'](_0xdd3cec)['send'](_0xe233b3);};}exports[_0x4ffc('0x26')]=function(_0x3e9a42,_0x16dceb){var _0x1e2854={},_0x2758bd={},_0x334c0f={'count':0x0,'rows':[]};var _0x403bf8=_['map'](db[_0x4ffc('0x27')][_0x4ffc('0x28')],function(_0xb294d0){return{'name':_0xb294d0[_0x4ffc('0x29')],'type':_0xb294d0['type'][_0x4ffc('0x2a')]};});_0x2758bd['model']=_['map'](_0x403bf8,_0x4ffc('0x25'));_0x2758bd['query']=_[_0x4ffc('0x2b')](_0x3e9a42[_0x4ffc('0x2c')]);_0x2758bd[_0x4ffc('0x2d')]=_[_0x4ffc('0x2e')](_0x2758bd[_0x4ffc('0x2f')],_0x2758bd[_0x4ffc('0x2c')]);_0x1e2854[_0x4ffc('0x30')]=_[_0x4ffc('0x2e')](_0x2758bd[_0x4ffc('0x2f')],qs[_0x4ffc('0x31')](_0x3e9a42[_0x4ffc('0x2c')]['fields']));_0x1e2854[_0x4ffc('0x30')]=_0x1e2854[_0x4ffc('0x30')][_0x4ffc('0x32')]?_0x1e2854['attributes']:_0x2758bd[_0x4ffc('0x2f')];if(!_0x3e9a42[_0x4ffc('0x2c')][_0x4ffc('0x33')](_0x4ffc('0x34'))){_0x1e2854['limit']=qs[_0x4ffc('0x1b')](_0x3e9a42[_0x4ffc('0x2c')]['limit']);_0x1e2854['offset']=qs[_0x4ffc('0x1d')](_0x3e9a42['query'][_0x4ffc('0x1d')]);}_0x1e2854[_0x4ffc('0x35')]=qs[_0x4ffc('0x36')](_0x3e9a42['query'][_0x4ffc('0x36')]);_0x1e2854[_0x4ffc('0x37')]=qs[_0x4ffc('0x2d')](_['pick'](_0x3e9a42['query'],_0x2758bd[_0x4ffc('0x2d')]),_0x403bf8);if(_0x3e9a42[_0x4ffc('0x2c')]['filter']){_0x1e2854[_0x4ffc('0x37')]=_[_0x4ffc('0x38')](_0x1e2854[_0x4ffc('0x37')],{'$or':_[_0x4ffc('0x39')](_0x403bf8,function(_0x18625c){if(_0x18625c['type']!=='VIRTUAL'){var _0xf7f0d2={};_0xf7f0d2[_0x18625c[_0x4ffc('0x25')]]={'$like':'%'+_0x3e9a42[_0x4ffc('0x2c')][_0x4ffc('0x3a')]+'%'};return _0xf7f0d2;}})});}_0x1e2854=_[_0x4ffc('0x38')]({},_0x1e2854,_0x3e9a42[_0x4ffc('0x3b')]);var _0x3b3da9={'where':_0x1e2854['where']};return db['AnalyticTreeReport'][_0x4ffc('0x1c')](_0x3b3da9)[_0x4ffc('0x21')](function(_0x6bf5c){_0x334c0f[_0x4ffc('0x1c')]=_0x6bf5c;if(_0x3e9a42[_0x4ffc('0x2c')][_0x4ffc('0x3c')]){_0x1e2854[_0x4ffc('0x3d')]=[{'all':!![]}];}return db[_0x4ffc('0x27')]['findAll'](_0x1e2854);})[_0x4ffc('0x21')](function(_0x14d9a6){_0x334c0f[_0x4ffc('0x3e')]=_0x14d9a6;return _0x334c0f;})[_0x4ffc('0x21')](respondWithFilteredResult(_0x16dceb,_0x1e2854))[_0x4ffc('0x3f')](handleError(_0x16dceb,null));};exports[_0x4ffc('0x40')]=function(_0x563995,_0xdd1086){var _0x49de5b={'raw':!![],'where':{'id':_0x563995['params']['id']}},_0x1d055e={};_0x1d055e[_0x4ffc('0x2f')]=_[_0x4ffc('0x2b')](db['AnalyticTreeReport'][_0x4ffc('0x28')]);_0x1d055e['query']=_[_0x4ffc('0x2b')](_0x563995[_0x4ffc('0x2c')]);_0x1d055e[_0x4ffc('0x2d')]=_[_0x4ffc('0x2e')](_0x1d055e[_0x4ffc('0x2f')],_0x1d055e['query']);_0x49de5b[_0x4ffc('0x30')]=_[_0x4ffc('0x2e')](_0x1d055e['model'],qs['fields'](_0x563995[_0x4ffc('0x2c')][_0x4ffc('0x31')]));_0x49de5b['attributes']=_0x49de5b[_0x4ffc('0x30')][_0x4ffc('0x32')]?_0x49de5b['attributes']:_0x1d055e[_0x4ffc('0x2f')];if(_0x563995['query']['includeAll']){_0x49de5b['include']=[{'all':!![]}];}_0x49de5b=_[_0x4ffc('0x38')]({},_0x49de5b,_0x563995['options']);return db[_0x4ffc('0x27')][_0x4ffc('0x41')](_0x49de5b)[_0x4ffc('0x21')](handleEntityNotFound(_0xdd1086,null))[_0x4ffc('0x21')](respondWithResult(_0xdd1086,null))[_0x4ffc('0x3f')](handleError(_0xdd1086,null));};exports['create']=function(_0x364429,_0x23b56b){return db[_0x4ffc('0x27')]['create'](_0x364429[_0x4ffc('0x42')],{})[_0x4ffc('0x21')](respondWithResult(_0x23b56b,0xc9))[_0x4ffc('0x3f')](handleError(_0x23b56b,null));};exports['update']=function(_0x478d98,_0x174752){if(_0x478d98[_0x4ffc('0x42')]['id']){delete _0x478d98[_0x4ffc('0x42')]['id'];}return db[_0x4ffc('0x27')][_0x4ffc('0x41')]({'where':{'id':_0x478d98['params']['id']}})[_0x4ffc('0x21')](handleEntityNotFound(_0x174752,null))[_0x4ffc('0x21')](saveUpdates(_0x478d98['body'],null))[_0x4ffc('0x21')](respondWithResult(_0x174752,null))[_0x4ffc('0x3f')](handleError(_0x174752,null));};exports[_0x4ffc('0x22')]=function(_0x1f02ca,_0x5db87c){return db[_0x4ffc('0x27')][_0x4ffc('0x41')]({'where':{'id':_0x1f02ca[_0x4ffc('0x43')]['id']}})['then'](handleEntityNotFound(_0x5db87c,null))[_0x4ffc('0x21')](removeEntity(_0x5db87c,null))[_0x4ffc('0x3f')](handleError(_0x5db87c,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 5f6d6ee..5c8bcad 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 _0xdc4d=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','util'];(function(_0x1f869c,_0x118fd4){var _0x47eb58=function(_0x402660){while(--_0x402660){_0x1f869c['push'](_0x1f869c['shift']());}};_0x47eb58(++_0x118fd4);}(_0xdc4d,0x103));var _0xddc4=function(_0x95fc01,_0x8ee446){_0x95fc01=_0x95fc01-0x0;var _0x5681d3=_0xdc4d[_0x95fc01];return _0x5681d3;};'use strict';var _=require('lodash');var util=require(_0xddc4('0x0'));var logger=require(_0xddc4('0x1'))(_0xddc4('0x2'));var moment=require('moment');var BPromise=require(_0xddc4('0x3'));var rp=require(_0xddc4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddc4('0x5'));var config=require(_0xddc4('0x6'));var attributes=require(_0xddc4('0x7'));module[_0xddc4('0x8')]=function(_0x9c35fb,_0x1df7af){return _0x9c35fb[_0xddc4('0x9')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9311=['../../config/logger','request-promise','path','rimraf','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x9311,0x1a2));var _0x1931=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9311[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1931('0x0'));var util=require(_0x1931('0x1'));var logger=require(_0x1931('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1931('0x3'));var fs=require('fs');var path=require(_0x1931('0x4'));var rimraf=require(_0x1931('0x5'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x1931('0x6')]=function(_0x271523,_0x2b4068){return _0x271523[_0x1931('0x7')](_0x1931('0x8'),attributes,{'tableName':_0x1931('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index d7cdfe9..be8bdde 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2ff9a6,_0x149014){var _0x15775a=function(_0x3a19ce){while(--_0x3a19ce){_0x2ff9a6['push'](_0x2ff9a6['shift']());}};_0x15775a(++_0x149014);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33da87,_0x67dad1){_0x33da87=_0x33da87-0x0;var _0x3d094d=_0x5f2f[_0x33da87];return _0x3d094d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x227bfa,_0x51bedc){var _0x331aba=function(_0x36e65b){while(--_0x36e65b){_0x227bfa['push'](_0x227bfa['shift']());}};_0x331aba(++_0x51bedc);}(_0x2ef3,0xba));var _0x32ef=function(_0x144c0e,_0x57d78e){_0x144c0e=_0x144c0e-0x0;var _0x2c8e1f=_0x2ef3[_0x144c0e];return _0x2c8e1f;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 75dba5b..e85d5c3 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 _0x55ec=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','util'];(function(_0x1c57a5,_0x433064){var _0x3dadb9=function(_0x5cf957){while(--_0x5cf957){_0x1c57a5['push'](_0x1c57a5['shift']());}};_0x3dadb9(++_0x433064);}(_0x55ec,0x17b));var _0xc55e=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x55ec[_0x4c184d];return _0x23d997;};'use strict';var multer=require('multer');var util=require(_0xc55e('0x0'));var path=require(_0xc55e('0x1'));var timeout=require(_0xc55e('0x2'));var express=require(_0xc55e('0x3'));var router=express[_0xc55e('0x4')]();var fs_extra=require(_0xc55e('0x5'));var auth=require(_0xc55e('0x6'));var interaction=require(_0xc55e('0x7'));var config=require(_0xc55e('0x8'));var controller=require(_0xc55e('0x9'));router[_0xc55e('0xa')]('/',auth[_0xc55e('0xb')](),controller[_0xc55e('0xc')]);router[_0xc55e('0xa')](_0xc55e('0xd'),auth[_0xc55e('0xb')](),controller[_0xc55e('0xe')]);router[_0xc55e('0xf')]('/',auth['isAuthenticated'](),controller[_0xc55e('0x10')]);router[_0xc55e('0x11')](_0xc55e('0xd'),auth[_0xc55e('0xb')](),controller[_0xc55e('0x12')]);router['delete'](_0xc55e('0xd'),auth[_0xc55e('0xb')](),controller['destroy']);module[_0xc55e('0x13')]=router; \ No newline at end of file +var _0x03dd=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','create','/:id','update','delete'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0x03dd,0x72));var _0xd03d=function(_0x12fec1,_0x20be9c){_0x12fec1=_0x12fec1-0x0;var _0x26c3af=_0x03dd[_0x12fec1];return _0x26c3af;};'use strict';var multer=require(_0xd03d('0x0'));var util=require('util');var path=require(_0xd03d('0x1'));var timeout=require('connect-timeout');var express=require(_0xd03d('0x2'));var router=express[_0xd03d('0x3')]();var fs_extra=require(_0xd03d('0x4'));var auth=require(_0xd03d('0x5'));var interaction=require(_0xd03d('0x6'));var config=require('../../config/environment');var controller=require(_0xd03d('0x7'));router[_0xd03d('0x8')]('/',auth[_0xd03d('0x9')](),controller['index']);router[_0xd03d('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd03d('0x9')](),controller[_0xd03d('0xa')]);router['put'](_0xd03d('0xb'),auth[_0xd03d('0x9')](),controller[_0xd03d('0xc')]);router[_0xd03d('0xd')]('/:id',auth[_0xd03d('0x9')](),controller[_0xd03d('0xe')]);module[_0xd03d('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d432312..9077e08 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 _0xea1a=['exports','STRING','sequelize'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0xea1a,0x158));var _0xaea1=function(_0xf69ad0,_0x1c9649){_0xf69ad0=_0xf69ad0-0x0;var _0x185767=_0xea1a[_0xf69ad0];return _0x185767;};'use strict';var Sequelize=require(_0xaea1('0x0'));module[_0xaea1('0x1')]={'name':{'type':Sequelize[_0xaea1('0x2')]},'basename':{'type':Sequelize[_0xaea1('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x87ae=['STRING'];(function(_0x239cac,_0x143b28){var _0x1f3bbf=function(_0x572828){while(--_0x572828){_0x239cac['push'](_0x239cac['shift']());}};_0x1f3bbf(++_0x143b28);}(_0x87ae,0xf5));var _0xe87a=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x87ae[_0x22e47a];return _0x15a12a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe87a('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5d6c18c..033a07e 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 _0x21df=['undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','Attachment','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','rawAttributes','find','params','get','omit','createdAt','body','updatedAt','create','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x2b2deb,_0x33430f){var _0x162fb0=function(_0x3947ac){while(--_0x3947ac){_0x2b2deb['push'](_0x2b2deb['shift']());}};_0x162fb0(++_0x33430f);}(_0x21df,0xe7));var _0xf21d=function(_0x1295fb,_0x1b5717){_0x1295fb=_0x1295fb-0x0;var _0x2e94bc=_0x21df[_0x1295fb];return _0x2e94bc;};'use strict';var emlformat=require(_0xf21d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf21d('0x1'));var jsonpatch=require(_0xf21d('0x2'));var rp=require(_0xf21d('0x3'));var moment=require(_0xf21d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf21d('0x5'));var util=require(_0xf21d('0x6'));var path=require('path');var sox=require(_0xf21d('0x7'));var csv=require(_0xf21d('0x8'));var ejs=require(_0xf21d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf21d('0xa'));var crypto=require('crypto');var jsforce=require(_0xf21d('0xb'));var deskjs=require(_0xf21d('0xc'));var toCsv=require(_0xf21d('0x8'));var querystring=require(_0xf21d('0xd'));var Papa=require(_0xf21d('0xe'));var Redis=require(_0xf21d('0xf'));var authService=require(_0xf21d('0x10'));var qs=require(_0xf21d('0x11'));var as=require(_0xf21d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf21d('0x13'))(_0xf21d('0x14'));var utils=require(_0xf21d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf21d('0x16'))['db'];function respondWithStatusCode(_0x128d2c,_0x36ea0e){_0x36ea0e=_0x36ea0e||0xcc;return function(_0x5119a5){if(_0x5119a5){return _0x128d2c[_0xf21d('0x17')](_0x36ea0e);}return _0x128d2c[_0xf21d('0x18')](_0x36ea0e)[_0xf21d('0x19')]();};}function respondWithResult(_0x461304,_0x2b4c79){_0x2b4c79=_0x2b4c79||0xc8;return function(_0x5c9817){if(_0x5c9817){return _0x461304[_0xf21d('0x18')](_0x2b4c79)[_0xf21d('0x1a')](_0x5c9817);}};}function respondWithFilteredResult(_0x39cefb,_0x1d304d){return function(_0x1f329f){if(_0x1f329f){var _0x1a9156=typeof _0x1d304d['offset']===_0xf21d('0x1b')&&typeof _0x1d304d[_0xf21d('0x1c')]===_0xf21d('0x1b');var _0x408549=_0x1f329f[_0xf21d('0x1d')];var _0xc2198f=_0x1a9156?0x0:_0x1d304d[_0xf21d('0x1e')];var _0x1d2b62=_0x1a9156?_0x1f329f[_0xf21d('0x1d')]:_0x1d304d['offset']+_0x1d304d[_0xf21d('0x1c')];var _0x2906e4;if(_0x1d2b62>=_0x408549){_0x1d2b62=_0x408549;_0x2906e4=0xc8;}else{_0x2906e4=0xce;}_0x39cefb[_0xf21d('0x18')](_0x2906e4);return _0x39cefb['set'](_0xf21d('0x1f'),_0xc2198f+'-'+_0x1d2b62+'/'+_0x408549)[_0xf21d('0x1a')](_0x1f329f);}return null;};}function patchUpdates(_0x82f351){return function(_0x296aef){try{jsonpatch[_0xf21d('0x20')](_0x296aef,_0x82f351,!![]);}catch(_0x1048ce){return BPromise[_0xf21d('0x21')](_0x1048ce);}return _0x296aef['save']();};}function saveUpdates(_0x55f8e4,_0x41cfa2){return function(_0x119ad7){if(_0x119ad7){return _0x119ad7[_0xf21d('0x22')](_0x55f8e4)[_0xf21d('0x23')](function(_0x27ea24){return _0x27ea24;});}return null;};}function removeEntity(_0x2fbef4,_0x2cd80a){return function(_0x6d17fe){if(_0x6d17fe){return _0x6d17fe[_0xf21d('0x24')]()[_0xf21d('0x23')](function(){_0x2fbef4['status'](0xcc)[_0xf21d('0x19')]();});}};}function handleEntityNotFound(_0x244753,_0x466758){return function(_0x583a22){if(!_0x583a22){_0x244753['sendStatus'](0x194);}return _0x583a22;};}function handleError(_0x1d9895,_0x480a8b){_0x480a8b=_0x480a8b||0x1f4;return function(_0x32dc82){logger[_0xf21d('0x25')](_0x32dc82[_0xf21d('0x26')]);if(_0x32dc82[_0xf21d('0x27')]){delete _0x32dc82['name'];}_0x1d9895[_0xf21d('0x18')](_0x480a8b)[_0xf21d('0x28')](_0x32dc82);};}exports['index']=function(_0xc7c68a,_0x586289){var _0x5ce4a9={},_0x24bcf6={},_0x47d05a={'count':0x0,'rows':[]};var _0x1f265e=_[_0xf21d('0x29')](db[_0xf21d('0x2a')]['rawAttributes'],function(_0x8e8b01){return{'name':_0x8e8b01[_0xf21d('0x2b')],'type':_0x8e8b01['type']['key']};});_0x24bcf6[_0xf21d('0x2c')]=_[_0xf21d('0x29')](_0x1f265e,_0xf21d('0x27'));_0x24bcf6[_0xf21d('0x2d')]=_[_0xf21d('0x2e')](_0xc7c68a[_0xf21d('0x2d')]);_0x24bcf6[_0xf21d('0x2f')]=_[_0xf21d('0x30')](_0x24bcf6[_0xf21d('0x2c')],_0x24bcf6[_0xf21d('0x2d')]);_0x5ce4a9[_0xf21d('0x31')]=_[_0xf21d('0x30')](_0x24bcf6[_0xf21d('0x2c')],qs['fields'](_0xc7c68a[_0xf21d('0x2d')][_0xf21d('0x32')]));_0x5ce4a9[_0xf21d('0x31')]=_0x5ce4a9[_0xf21d('0x31')][_0xf21d('0x33')]?_0x5ce4a9['attributes']:_0x24bcf6[_0xf21d('0x2c')];if(!_0xc7c68a['query'][_0xf21d('0x34')](_0xf21d('0x35'))){_0x5ce4a9[_0xf21d('0x1c')]=qs['limit'](_0xc7c68a[_0xf21d('0x2d')][_0xf21d('0x1c')]);_0x5ce4a9[_0xf21d('0x1e')]=qs['offset'](_0xc7c68a[_0xf21d('0x2d')][_0xf21d('0x1e')]);}_0x5ce4a9[_0xf21d('0x36')]=qs[_0xf21d('0x37')](_0xc7c68a[_0xf21d('0x2d')][_0xf21d('0x37')]);_0x5ce4a9['where']=qs[_0xf21d('0x2f')](_['pick'](_0xc7c68a['query'],_0x24bcf6['filters']),_0x1f265e);if(_0xc7c68a['query']['filter']){_0x5ce4a9[_0xf21d('0x38')]=_['merge'](_0x5ce4a9[_0xf21d('0x38')],{'$or':_[_0xf21d('0x29')](_0x1f265e,function(_0x541fea){if(_0x541fea[_0xf21d('0x39')]!==_0xf21d('0x3a')){var _0x237716={};_0x237716[_0x541fea[_0xf21d('0x27')]]={'$like':'%'+_0xc7c68a['query']['filter']+'%'};return _0x237716;}})});}_0x5ce4a9=_[_0xf21d('0x3b')]({},_0x5ce4a9,_0xc7c68a[_0xf21d('0x3c')]);var _0x30abed={'where':_0x5ce4a9[_0xf21d('0x38')]};return db[_0xf21d('0x2a')][_0xf21d('0x1d')](_0x30abed)[_0xf21d('0x23')](function(_0x303716){_0x47d05a[_0xf21d('0x1d')]=_0x303716;if(_0xc7c68a[_0xf21d('0x2d')][_0xf21d('0x3d')]){_0x5ce4a9[_0xf21d('0x3e')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x5ce4a9);})[_0xf21d('0x23')](function(_0x1428e9){_0x47d05a[_0xf21d('0x3f')]=_0x1428e9;return _0x47d05a;})[_0xf21d('0x23')](respondWithFilteredResult(_0x586289,_0x5ce4a9))[_0xf21d('0x40')](handleError(_0x586289,null));};exports['show']=function(_0x3907d6,_0x492ca9){var _0x1b4a9a={'raw':!![],'where':{'id':_0x3907d6['params']['id']}},_0x273b2c={};_0x273b2c[_0xf21d('0x2c')]=_['keys'](db[_0xf21d('0x2a')][_0xf21d('0x41')]);_0x273b2c[_0xf21d('0x2d')]=_[_0xf21d('0x2e')](_0x3907d6[_0xf21d('0x2d')]);_0x273b2c[_0xf21d('0x2f')]=_[_0xf21d('0x30')](_0x273b2c[_0xf21d('0x2c')],_0x273b2c[_0xf21d('0x2d')]);_0x1b4a9a[_0xf21d('0x31')]=_[_0xf21d('0x30')](_0x273b2c[_0xf21d('0x2c')],qs[_0xf21d('0x32')](_0x3907d6[_0xf21d('0x2d')][_0xf21d('0x32')]));_0x1b4a9a[_0xf21d('0x31')]=_0x1b4a9a[_0xf21d('0x31')]['length']?_0x1b4a9a[_0xf21d('0x31')]:_0x273b2c[_0xf21d('0x2c')];if(_0x3907d6['query'][_0xf21d('0x3d')]){_0x1b4a9a['include']=[{'all':!![]}];}_0x1b4a9a=_['merge']({},_0x1b4a9a,_0x3907d6[_0xf21d('0x3c')]);return db[_0xf21d('0x2a')][_0xf21d('0x42')](_0x1b4a9a)[_0xf21d('0x23')](handleEntityNotFound(_0x492ca9,null))[_0xf21d('0x23')](respondWithResult(_0x492ca9,null))['catch'](handleError(_0x492ca9,null));};exports['clone']=function(_0x3e63c9,_0x94adc3){var _0x2889da={'where':{'id':_0x3e63c9[_0xf21d('0x43')]['id']}},_0xd86cde={};_0xd86cde[_0xf21d('0x2c')]=_[_0xf21d('0x2e')](db[_0xf21d('0x2a')][_0xf21d('0x41')]);_0x2889da[_0xf21d('0x31')]=_[_0xf21d('0x30')](_0xd86cde[_0xf21d('0x2c')],qs[_0xf21d('0x32')](_0x3e63c9[_0xf21d('0x2d')]['fields']));_0x2889da[_0xf21d('0x31')]=_0x2889da[_0xf21d('0x31')][_0xf21d('0x33')]?_0x2889da['attributes']:_0xd86cde[_0xf21d('0x2c')];if(_0x3e63c9[_0xf21d('0x2d')][_0xf21d('0x3d')]){_0x2889da[_0xf21d('0x3e')]=[{'all':!![]}];}_0x2889da=_['merge']({},_0x2889da,_0x3e63c9[_0xf21d('0x3c')]);return db[_0xf21d('0x2a')][_0xf21d('0x42')](_0x2889da)['then'](handleEntityNotFound(_0x94adc3,null))[_0xf21d('0x23')](function(_0x116e68){if(_0x116e68){var _0x26917=_0x116e68[_0xf21d('0x44')]({'plain':!![]});_0x26917=qs[_0xf21d('0x45')](_0x26917,['id',_0xf21d('0x46'),'updatedAt']);_0x3e63c9[_0xf21d('0x47')]=_[_0xf21d('0x45')](_0x3e63c9[_0xf21d('0x47')],['id',_0xf21d('0x46'),_0xf21d('0x48')]);return db[_0xf21d('0x2a')][_0xf21d('0x49')](_[_0xf21d('0x3b')](_0x26917,_0x3e63c9[_0xf21d('0x47')]),{'include':_0x3e63c9[_0xf21d('0x2d')][_0xf21d('0x3d')]?[{'all':!![]}]:undefined});}})[_0xf21d('0x23')](respondWithResult(_0x94adc3,0xc9))['catch'](handleError(_0x94adc3,null));};exports[_0xf21d('0x22')]=function(_0x22afe8,_0x398473){if(_0x22afe8[_0xf21d('0x47')]['id']){delete _0x22afe8[_0xf21d('0x47')]['id'];}return db['Attachment'][_0xf21d('0x42')]({'where':{'id':_0x22afe8[_0xf21d('0x43')]['id']}})['then'](handleEntityNotFound(_0x398473,null))[_0xf21d('0x23')](saveUpdates(_0x22afe8[_0xf21d('0x47')],null))[_0xf21d('0x23')](respondWithResult(_0x398473,null))['catch'](handleError(_0x398473,null));};exports[_0xf21d('0x24')]=function(_0x155085,_0x53ece6){return db[_0xf21d('0x2a')]['find']({'where':{'id':_0x155085[_0xf21d('0x43')]['id']}})['then'](handleEntityNotFound(_0x53ece6,null))[_0xf21d('0x23')](removeEntity(_0x53ece6,null))[_0xf21d('0x40')](handleError(_0x53ece6,null));};exports[_0xf21d('0x49')]=function(_0x5410e9,_0x4121d7,_0x35181f){_0x5410e9['body'][_0xf21d('0x27')]=_0x5410e9['file'][_0xf21d('0x4a')];_0x5410e9[_0xf21d('0x47')][_0xf21d('0x4b')]=_0x5410e9[_0xf21d('0x4c')][_0xf21d('0x4d')];_0x5410e9['body'][_0xf21d('0x39')]=_0x5410e9[_0xf21d('0x4c')][_0xf21d('0x4e')];return db['Attachment'][_0xf21d('0x49')](_0x5410e9[_0xf21d('0x47')])[_0xf21d('0x23')](respondWithResult(_0x4121d7,0xc9))['catch'](handleError(_0x4121d7,null));};exports[_0xf21d('0x4f')]=function(_0x3d2099,_0x5b7ae0,_0x2e56a1){return db[_0xf21d('0x2a')][_0xf21d('0x50')]({'where':{'id':_0x3d2099[_0xf21d('0x43')]['id']},'raw':!![]})[_0xf21d('0x23')](handleEntityNotFound(_0x5b7ae0,null))[_0xf21d('0x23')](function(_0x4c92e2){if(_0x4c92e2){var _0x46681a=_0x4c92e2[_0xf21d('0x51')]!==null;var _0x37ced4=path[_0xf21d('0x52')](config[_0xf21d('0x53')],_0xf21d('0x54'));if(_0x46681a){_0x37ced4=path['join'](_0x37ced4,_0xf21d('0x55'));}var _0xc26a45=path[_0xf21d('0x52')](_0x37ced4,_0x4c92e2['basename']);return _0x5b7ae0[_0xf21d('0x4f')](_0xc26a45);}})[_0xf21d('0x40')](handleError(_0x5b7ae0,null));}; \ No newline at end of file +var _0x5401=['reject','save','update','destroy','then','stack','name','index','map','Attachment','rawAttributes','fieldName','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','clone','get','omit','updatedAt','body','createdAt','create','file','originalname','basename','type','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x57c711,_0x3fe948){var _0x123995=function(_0x538957){while(--_0x538957){_0x57c711['push'](_0x57c711['shift']());}};_0x123995(++_0x3fe948);}(_0x5401,0x9a));var _0x1540=function(_0x4b140a,_0x3d82ed){_0x4b140a=_0x4b140a-0x0;var _0x1d3b60=_0x5401[_0x4b140a];return _0x1d3b60;};'use strict';var emlformat=require(_0x1540('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1540('0x1'));var jsonpatch=require(_0x1540('0x2'));var rp=require(_0x1540('0x3'));var moment=require(_0x1540('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1540('0x5'));var util=require(_0x1540('0x6'));var path=require(_0x1540('0x7'));var sox=require(_0x1540('0x8'));var csv=require(_0x1540('0x9'));var ejs=require(_0x1540('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1540('0xb'));var squel=require(_0x1540('0xc'));var crypto=require(_0x1540('0xd'));var jsforce=require(_0x1540('0xe'));var deskjs=require(_0x1540('0xf'));var toCsv=require(_0x1540('0x9'));var querystring=require(_0x1540('0x10'));var Papa=require(_0x1540('0x11'));var Redis=require(_0x1540('0x12'));var authService=require(_0x1540('0x13'));var qs=require(_0x1540('0x14'));var as=require(_0x1540('0x15'));var hardwareService=require(_0x1540('0x16'));var logger=require(_0x1540('0x17'))(_0x1540('0x18'));var utils=require(_0x1540('0x19'));var config=require(_0x1540('0x1a'));var licenseUtil=require(_0x1540('0x1b'));var db=require(_0x1540('0x1c'))['db'];function respondWithStatusCode(_0x5a838b,_0x12fbb3){_0x12fbb3=_0x12fbb3||0xcc;return function(_0x44be7b){if(_0x44be7b){return _0x5a838b[_0x1540('0x1d')](_0x12fbb3);}return _0x5a838b[_0x1540('0x1e')](_0x12fbb3)[_0x1540('0x1f')]();};}function respondWithResult(_0x2987bc,_0x1fa8bc){_0x1fa8bc=_0x1fa8bc||0xc8;return function(_0xd10d67){if(_0xd10d67){return _0x2987bc[_0x1540('0x1e')](_0x1fa8bc)[_0x1540('0x20')](_0xd10d67);}};}function respondWithFilteredResult(_0x172e16,_0x5245ab){return function(_0x366991){if(_0x366991){var _0x29ecb5=typeof _0x5245ab['offset']===_0x1540('0x21')&&typeof _0x5245ab[_0x1540('0x22')]===_0x1540('0x21');var _0x212de4=_0x366991[_0x1540('0x23')];var _0x34cd9f=_0x29ecb5?0x0:_0x5245ab['offset'];var _0x24fc69=_0x29ecb5?_0x366991[_0x1540('0x23')]:_0x5245ab[_0x1540('0x24')]+_0x5245ab[_0x1540('0x22')];var _0x571fa7;if(_0x24fc69>=_0x212de4){_0x24fc69=_0x212de4;_0x571fa7=0xc8;}else{_0x571fa7=0xce;}_0x172e16[_0x1540('0x1e')](_0x571fa7);return _0x172e16[_0x1540('0x25')](_0x1540('0x26'),_0x34cd9f+'-'+_0x24fc69+'/'+_0x212de4)[_0x1540('0x20')](_0x366991);}return null;};}function patchUpdates(_0x433aee){return function(_0x3567de){try{jsonpatch[_0x1540('0x27')](_0x3567de,_0x433aee,!![]);}catch(_0x20825c){return BPromise[_0x1540('0x28')](_0x20825c);}return _0x3567de[_0x1540('0x29')]();};}function saveUpdates(_0x48d799,_0x556eed){return function(_0x3ce7a7){if(_0x3ce7a7){return _0x3ce7a7[_0x1540('0x2a')](_0x48d799)['then'](function(_0x59cbfb){return _0x59cbfb;});}return null;};}function removeEntity(_0x34dec4,_0x389162){return function(_0x3d9587){if(_0x3d9587){return _0x3d9587[_0x1540('0x2b')]()[_0x1540('0x2c')](function(){_0x34dec4['status'](0xcc)[_0x1540('0x1f')]();});}};}function handleEntityNotFound(_0x63408f,_0x378cf1){return function(_0x34015a){if(!_0x34015a){_0x63408f[_0x1540('0x1d')](0x194);}return _0x34015a;};}function handleError(_0x3d4ab7,_0x40d05b){_0x40d05b=_0x40d05b||0x1f4;return function(_0x166c6f){logger['error'](_0x166c6f[_0x1540('0x2d')]);if(_0x166c6f[_0x1540('0x2e')]){delete _0x166c6f['name'];}_0x3d4ab7['status'](_0x40d05b)['send'](_0x166c6f);};}exports[_0x1540('0x2f')]=function(_0x341b73,_0x25ec4e){var _0x19bec5={},_0x1f1249={},_0x3793f0={'count':0x0,'rows':[]};var _0x40e559=_[_0x1540('0x30')](db[_0x1540('0x31')][_0x1540('0x32')],function(_0xff683a){return{'name':_0xff683a[_0x1540('0x33')],'type':_0xff683a['type'][_0x1540('0x34')]};});_0x1f1249[_0x1540('0x35')]=_[_0x1540('0x30')](_0x40e559,_0x1540('0x2e'));_0x1f1249['query']=_[_0x1540('0x36')](_0x341b73['query']);_0x1f1249['filters']=_[_0x1540('0x37')](_0x1f1249[_0x1540('0x35')],_0x1f1249[_0x1540('0x38')]);_0x19bec5['attributes']=_['intersection'](_0x1f1249['model'],qs[_0x1540('0x39')](_0x341b73['query'][_0x1540('0x39')]));_0x19bec5['attributes']=_0x19bec5[_0x1540('0x3a')][_0x1540('0x3b')]?_0x19bec5[_0x1540('0x3a')]:_0x1f1249[_0x1540('0x35')];if(!_0x341b73[_0x1540('0x38')][_0x1540('0x3c')](_0x1540('0x3d'))){_0x19bec5[_0x1540('0x22')]=qs[_0x1540('0x22')](_0x341b73[_0x1540('0x38')][_0x1540('0x22')]);_0x19bec5[_0x1540('0x24')]=qs['offset'](_0x341b73['query'][_0x1540('0x24')]);}_0x19bec5[_0x1540('0x3e')]=qs[_0x1540('0x3f')](_0x341b73[_0x1540('0x38')][_0x1540('0x3f')]);_0x19bec5[_0x1540('0x40')]=qs[_0x1540('0x41')](_[_0x1540('0x42')](_0x341b73[_0x1540('0x38')],_0x1f1249[_0x1540('0x41')]),_0x40e559);if(_0x341b73[_0x1540('0x38')][_0x1540('0x43')]){_0x19bec5[_0x1540('0x40')]=_[_0x1540('0x44')](_0x19bec5[_0x1540('0x40')],{'$or':_[_0x1540('0x30')](_0x40e559,function(_0x69aede){if(_0x69aede['type']!==_0x1540('0x45')){var _0xc74270={};_0xc74270[_0x69aede[_0x1540('0x2e')]]={'$like':'%'+_0x341b73[_0x1540('0x38')][_0x1540('0x43')]+'%'};return _0xc74270;}})});}_0x19bec5=_[_0x1540('0x44')]({},_0x19bec5,_0x341b73[_0x1540('0x46')]);var _0xf5148b={'where':_0x19bec5[_0x1540('0x40')]};return db[_0x1540('0x31')][_0x1540('0x23')](_0xf5148b)[_0x1540('0x2c')](function(_0x398453){_0x3793f0[_0x1540('0x23')]=_0x398453;if(_0x341b73[_0x1540('0x38')]['includeAll']){_0x19bec5[_0x1540('0x47')]=[{'all':!![]}];}return db[_0x1540('0x31')][_0x1540('0x48')](_0x19bec5);})[_0x1540('0x2c')](function(_0x56af95){_0x3793f0[_0x1540('0x49')]=_0x56af95;return _0x3793f0;})[_0x1540('0x2c')](respondWithFilteredResult(_0x25ec4e,_0x19bec5))[_0x1540('0x4a')](handleError(_0x25ec4e,null));};exports[_0x1540('0x4b')]=function(_0x361f41,_0x9a25c4){var _0x49fc9f={'raw':!![],'where':{'id':_0x361f41[_0x1540('0x4c')]['id']}},_0x58ac8b={};_0x58ac8b['model']=_[_0x1540('0x36')](db[_0x1540('0x31')][_0x1540('0x32')]);_0x58ac8b[_0x1540('0x38')]=_[_0x1540('0x36')](_0x361f41[_0x1540('0x38')]);_0x58ac8b[_0x1540('0x41')]=_[_0x1540('0x37')](_0x58ac8b[_0x1540('0x35')],_0x58ac8b[_0x1540('0x38')]);_0x49fc9f['attributes']=_['intersection'](_0x58ac8b['model'],qs[_0x1540('0x39')](_0x361f41['query'][_0x1540('0x39')]));_0x49fc9f['attributes']=_0x49fc9f['attributes']['length']?_0x49fc9f[_0x1540('0x3a')]:_0x58ac8b['model'];if(_0x361f41[_0x1540('0x38')][_0x1540('0x4d')]){_0x49fc9f[_0x1540('0x47')]=[{'all':!![]}];}_0x49fc9f=_[_0x1540('0x44')]({},_0x49fc9f,_0x361f41[_0x1540('0x46')]);return db[_0x1540('0x31')][_0x1540('0x4e')](_0x49fc9f)[_0x1540('0x2c')](handleEntityNotFound(_0x9a25c4,null))[_0x1540('0x2c')](respondWithResult(_0x9a25c4,null))['catch'](handleError(_0x9a25c4,null));};exports[_0x1540('0x4f')]=function(_0x177ad1,_0x4b4204){var _0x21e7d7={'where':{'id':_0x177ad1[_0x1540('0x4c')]['id']}},_0x20531d={};_0x20531d['model']=_[_0x1540('0x36')](db['Attachment']['rawAttributes']);_0x21e7d7[_0x1540('0x3a')]=_[_0x1540('0x37')](_0x20531d[_0x1540('0x35')],qs[_0x1540('0x39')](_0x177ad1[_0x1540('0x38')]['fields']));_0x21e7d7['attributes']=_0x21e7d7[_0x1540('0x3a')][_0x1540('0x3b')]?_0x21e7d7[_0x1540('0x3a')]:_0x20531d[_0x1540('0x35')];if(_0x177ad1['query'][_0x1540('0x4d')]){_0x21e7d7[_0x1540('0x47')]=[{'all':!![]}];}_0x21e7d7=_[_0x1540('0x44')]({},_0x21e7d7,_0x177ad1[_0x1540('0x46')]);return db[_0x1540('0x31')][_0x1540('0x4e')](_0x21e7d7)['then'](handleEntityNotFound(_0x4b4204,null))[_0x1540('0x2c')](function(_0x57bb4a){if(_0x57bb4a){var _0x2d7095=_0x57bb4a[_0x1540('0x50')]({'plain':!![]});_0x2d7095=qs[_0x1540('0x51')](_0x2d7095,['id','createdAt',_0x1540('0x52')]);_0x177ad1[_0x1540('0x53')]=_[_0x1540('0x51')](_0x177ad1[_0x1540('0x53')],['id',_0x1540('0x54'),_0x1540('0x52')]);return db[_0x1540('0x31')][_0x1540('0x55')](_[_0x1540('0x44')](_0x2d7095,_0x177ad1['body']),{'include':_0x177ad1[_0x1540('0x38')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x1540('0x2c')](respondWithResult(_0x4b4204,0xc9))[_0x1540('0x4a')](handleError(_0x4b4204,null));};exports['update']=function(_0x439ed5,_0x19c18b){if(_0x439ed5[_0x1540('0x53')]['id']){delete _0x439ed5[_0x1540('0x53')]['id'];}return db[_0x1540('0x31')][_0x1540('0x4e')]({'where':{'id':_0x439ed5[_0x1540('0x4c')]['id']}})[_0x1540('0x2c')](handleEntityNotFound(_0x19c18b,null))[_0x1540('0x2c')](saveUpdates(_0x439ed5[_0x1540('0x53')],null))[_0x1540('0x2c')](respondWithResult(_0x19c18b,null))[_0x1540('0x4a')](handleError(_0x19c18b,null));};exports[_0x1540('0x2b')]=function(_0x42feb2,_0x13b44d){return db[_0x1540('0x31')]['find']({'where':{'id':_0x42feb2[_0x1540('0x4c')]['id']}})['then'](handleEntityNotFound(_0x13b44d,null))[_0x1540('0x2c')](removeEntity(_0x13b44d,null))[_0x1540('0x4a')](handleError(_0x13b44d,null));};exports['create']=function(_0x532f9b,_0x378b4a,_0x10b69e){_0x532f9b[_0x1540('0x53')][_0x1540('0x2e')]=_0x532f9b[_0x1540('0x56')][_0x1540('0x57')];_0x532f9b[_0x1540('0x53')][_0x1540('0x58')]=_0x532f9b['file']['filename'];_0x532f9b[_0x1540('0x53')][_0x1540('0x59')]=_0x532f9b[_0x1540('0x56')]['mimetype'];return db[_0x1540('0x31')][_0x1540('0x55')](_0x532f9b[_0x1540('0x53')])[_0x1540('0x2c')](respondWithResult(_0x378b4a,0xc9))[_0x1540('0x4a')](handleError(_0x378b4a,null));};exports[_0x1540('0x5a')]=function(_0x26d08,_0x56657a,_0x346d3e){return db[_0x1540('0x31')][_0x1540('0x5b')]({'where':{'id':_0x26d08[_0x1540('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x56657a,null))[_0x1540('0x2c')](function(_0x14986e){if(_0x14986e){var _0x29ff53=_0x14986e[_0x1540('0x5c')]!==null;var _0x3710e0=path[_0x1540('0x5d')](config[_0x1540('0x5e')],_0x1540('0x5f'));if(_0x29ff53){_0x3710e0=path[_0x1540('0x5d')](_0x3710e0,_0x1540('0x60'));}var _0x2651ce=path['join'](_0x3710e0,_0x14986e[_0x1540('0x58')]);return _0x56657a[_0x1540('0x5a')](_0x2651ce);}})[_0x1540('0x4a')](handleError(_0x56657a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5939c91..427a80c 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 _0x2bc5=['exports','define','attachments','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x2bc5,0x1bb));var _0x52bc=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x2bc5[_0x21d0c3];return _0x4df18e;};'use strict';var _=require(_0x52bc('0x0'));var util=require(_0x52bc('0x1'));var logger=require('../../config/logger')(_0x52bc('0x2'));var moment=require(_0x52bc('0x3'));var BPromise=require(_0x52bc('0x4'));var rp=require(_0x52bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x52bc('0x6'));var attributes=require('./attachment.attributes');module[_0x52bc('0x7')]=function(_0x263aa1,_0x173cf6){return _0x263aa1[_0x52bc('0x8')]('Attachment',attributes,{'tableName':_0x52bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x546b=['Attachment','attachments','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x1b8442,_0x5a33e0){var _0x334c40=function(_0x41d48a){while(--_0x41d48a){_0x1b8442['push'](_0x1b8442['shift']());}};_0x334c40(++_0x5a33e0);}(_0x546b,0x1db));var _0xb546=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x546b[_0x599e60];return _0x468e19;};'use strict';var _=require('lodash');var util=require(_0xb546('0x0'));var logger=require(_0xb546('0x1'))(_0xb546('0x2'));var moment=require('moment');var BPromise=require(_0xb546('0x3'));var rp=require(_0xb546('0x4'));var fs=require('fs');var path=require(_0xb546('0x5'));var rimraf=require(_0xb546('0x6'));var config=require(_0xb546('0x7'));var attributes=require('./attachment.attributes');module['exports']=function(_0x54be7d,_0x305a43){return _0x54be7d[_0xb546('0x8')](_0xb546('0x9'),attributes,{'tableName':_0xb546('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 9676c83..6b9a964 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 _0x9b9b=['create','body','options','raw','then','debug','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment'];(function(_0x7230b5,_0x4020a1){var _0x10e25d=function(_0x12c068){while(--_0x12c068){_0x7230b5['push'](_0x7230b5['shift']());}};_0x10e25d(++_0x4020a1);}(_0x9b9b,0x114));var _0xb9b9=function(_0x124728,_0x463dca){_0x124728=_0x124728-0x0;var _0x8eb20f=_0x9b9b[_0x124728];return _0x8eb20f;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb9b9('0x1'));var fs=require('fs');var Redis=require(_0xb9b9('0x2'));var db=require(_0xb9b9('0x3'))['db'];var utils=require(_0xb9b9('0x4'));var logger=require(_0xb9b9('0x5'))(_0xb9b9('0x6'));var config=require(_0xb9b9('0x7'));var jayson=require(_0xb9b9('0x8'));var client=jayson[_0xb9b9('0x9')][_0xb9b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x85eec,_0x3ef9c1,_0x5be5bc){return new BPromise(function(_0x297cb6,_0x222cba){return client[_0xb9b9('0xb')](_0x85eec,_0x5be5bc)['then'](function(_0x4a645a){logger[_0xb9b9('0xc')](_0xb9b9('0xd'),_0x3ef9c1,_0xb9b9('0xe'));logger['debug'](_0xb9b9('0xf'),_0x3ef9c1,_0xb9b9('0xe'),JSON[_0xb9b9('0x10')](_0x4a645a));if(_0x4a645a['error']){if(_0x4a645a[_0xb9b9('0x11')][_0xb9b9('0x12')]===0x1f4){logger[_0xb9b9('0x11')](_0xb9b9('0xd'),_0x3ef9c1,_0x4a645a[_0xb9b9('0x11')][_0xb9b9('0x13')]);return _0x222cba(_0x4a645a['error']['message']);}logger[_0xb9b9('0x11')]('Attachment,\x20%s,\x20%s',_0x3ef9c1,_0x4a645a[_0xb9b9('0x11')]['message']);return _0x297cb6(_0x4a645a[_0xb9b9('0x11')][_0xb9b9('0x13')]);}else{logger[_0xb9b9('0xc')](_0xb9b9('0xd'),_0x3ef9c1,_0xb9b9('0xe'));_0x297cb6(_0x4a645a[_0xb9b9('0x14')][_0xb9b9('0x13')]);}})[_0xb9b9('0x15')](function(_0x4ae8e6){logger[_0xb9b9('0x11')]('Attachment,\x20%s,\x20%s',_0x3ef9c1,_0x4ae8e6);_0x222cba(_0x4ae8e6);});});}exports[_0xb9b9('0x16')]=function(_0x3e6d23){var _0x3a2fed=this;return new Promise(function(_0x11bb05,_0x49b412){return db[_0xb9b9('0x17')][_0xb9b9('0x18')](_0x3e6d23[_0xb9b9('0x19')],{'raw':_0x3e6d23[_0xb9b9('0x1a')]?_0x3e6d23[_0xb9b9('0x1a')][_0xb9b9('0x1b')]===undefined?!![]:![]:!![]})[_0xb9b9('0x1c')](function(_0x3d0edb){logger[_0xb9b9('0xc')](_0xb9b9('0x16'),_0x3e6d23);logger[_0xb9b9('0x1d')](_0xb9b9('0x16'),_0x3e6d23,JSON[_0xb9b9('0x10')](_0x3d0edb));_0x11bb05(_0x3d0edb);})['catch'](function(_0x10b7e1){logger[_0xb9b9('0x11')](_0xb9b9('0x16'),_0x10b7e1['message'],_0x3e6d23);_0x49b412(_0x3a2fed[_0xb9b9('0x11')](0x1f4,_0x10b7e1[_0xb9b9('0x13')]));});});}; \ No newline at end of file +var _0x544a=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','options','raw','then','stringify','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x544a,0xbd));var _0xa544=function(_0x5b0500,_0x49be7d){_0x5b0500=_0x5b0500-0x0;var _0x2a5476=_0x544a[_0x5b0500];return _0x2a5476;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('rpc');var config=require(_0xa544('0x6'));var jayson=require(_0xa544('0x7'));var client=jayson[_0xa544('0x8')][_0xa544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39caac,_0x543cd1,_0x407443){return new BPromise(function(_0x495819,_0x39bcd7){return client[_0xa544('0xa')](_0x39caac,_0x407443)['then'](function(_0x2e9a6a){logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,_0xa544('0xd'));logger['debug'](_0xa544('0xe'),_0x543cd1,_0xa544('0xd'),JSON['stringify'](_0x2e9a6a));if(_0x2e9a6a[_0xa544('0xf')]){if(_0x2e9a6a['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0xf')]('Attachment,\x20%s,\x20%s',_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x39bcd7(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x495819(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}else{logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,'request\x20sent');_0x495819(_0x2e9a6a[_0xa544('0x12')][_0xa544('0x11')]);}})['catch'](function(_0x9093bd){logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x9093bd);_0x39bcd7(_0x9093bd);});});}exports[_0xa544('0x13')]=function(_0x2c5ae8){var _0x297298=this;return new Promise(function(_0x1f3fcc,_0x44ccd3){return db[_0xa544('0x14')][_0xa544('0x15')](_0x2c5ae8['body'],{'raw':_0x2c5ae8['options']?_0x2c5ae8[_0xa544('0x16')][_0xa544('0x17')]===undefined?!![]:![]:!![]})[_0xa544('0x18')](function(_0x57a154){logger[_0xa544('0xb')](_0xa544('0x13'),_0x2c5ae8);logger['debug'](_0xa544('0x13'),_0x2c5ae8,JSON[_0xa544('0x19')](_0x57a154));_0x1f3fcc(_0x57a154);})[_0xa544('0x1a')](function(_0xb7df3d){logger[_0xa544('0xf')]('CreateAttachment',_0xb7df3d['message'],_0x2c5ae8);_0x44ccd3(_0x297298[_0xa544('0xf')](0x1f4,_0xb7df3d['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 2918eb0..355d4e2 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x2b7603,_0x1bc785){var _0x410cfd=function(_0x2918cb){while(--_0x2918cb){_0x2b7603['push'](_0x2b7603['shift']());}};_0x410cfd(++_0x1bc785);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f2601,_0x10b8be){_0x2f2601=_0x2f2601-0x0;var _0x3c6e6=_0xb10b[_0x2f2601];return _0x3c6e6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x532c66,_0x1a885c){_0x532c66=_0x532c66-0x0;var _0x25fb9f=_0xdb28[_0x532c66];return _0x25fb9f;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index cb3cc8b..4c3e293 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4521=['User','passport','passport-local','moment','activedirectory2','bluebird','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','adAuthenticate','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then','log','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','blocked','user','agent','disabled','blockedAt','add','minutes','getLicense','catch','status','send','message','authenticate','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','ad-login'];(function(_0x44d943,_0x105d2d){var _0x7aef84=function(_0x40a71a){while(--_0x40a71a){_0x44d943['push'](_0x44d943['shift']());}};_0x7aef84(++_0x105d2d);}(_0x4521,0x151));var _0x1452=function(_0x53560b,_0x24213a){_0x53560b=_0x53560b-0x0;var _0x287094=_0x4521[_0x53560b];return _0x287094;};'use strict';var passport=require(_0x1452('0x0'));var LocalStrategy=require(_0x1452('0x1'))['Strategy'];var moment=require(_0x1452('0x2'));var ActiveDirectory=require(_0x1452('0x3'));var BPromise=require(_0x1452('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x1452('0x5'));var utils=require(_0x1452('0x6'));var config=require(_0x1452('0x7'));var logger=require(_0x1452('0x8'))(_0x1452('0x9'));function isActiveDirectoryConfigured(_0x5ecb52){var _0x3c85c1=![];if(typeof _0x5ecb52[_0x1452('0xa')]!=='undefined'){_0x3c85c1=_0x5ecb52[_0x1452('0xa')][_0x1452('0xb')]&&_0x5ecb52['activedirectory'][_0x1452('0xc')]&&_0x5ecb52['activedirectory'][_0x1452('0xd')];}return _0x3c85c1;}function adAuthenticate(_0x1617ea,_0x648495,_0x2d7813){return new BPromise(function(_0x576d45,_0x48d3f3){try{var _0x5c84cb=new ActiveDirectory(_0x1617ea);_0x5c84cb['authenticate'](_0x648495,_0x2d7813,function(_0x1c45b0,_0xc54d26){console['log'](_0x1452('0xe'),_0x1c45b0,_0xc54d26);if(_0x1c45b0){_0x48d3f3(_0x1c45b0);}else if(!_0xc54d26){_0x48d3f3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x576d45(_0xc54d26);}});}catch(_0x1ad97b){_0x48d3f3(_0x1ad97b);}});}function ActiveDirectoryAuthenticate(_0x440d0b,_0xc3aead,_0x494d84,_0x4feae8){var _0x34f592,_0x3b304d;if(!isActiveDirectoryConfigured(config)){logger[_0x1452('0xf')](_0x1452('0x10'),_0xc3aead);return _0x4feae8(null,![],{'message':_0x1452('0x11')});}return db[_0x1452('0x12')][_0x1452('0x13')]({'where':{'id':0x1},'attributes':[_0x1452('0x14'),_0x1452('0x15')],'raw':!![]})[_0x1452('0x16')](function(_0x5f25df){console[_0x1452('0x17')]('settings',_0x5f25df);_0x34f592=_0x5f25df;if(!_0x34f592['adSsoEnabled']){logger[_0x1452('0xf')](_0x1452('0x18'),_0xc3aead);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x440d0b['findOne']({'logging':!![],'attributes':['id',_0x1452('0x19'),_0x1452('0x1a'),'salt',_0x1452('0x1b'),'disabled',_0x1452('0x1c'),'blockedAt'],'where':{'name':_0xc3aead,'role':{'$or':['admin',_0x1452('0x1d'),_0x1452('0x1e')]},'adSsoEnabled':!![]}});})[_0x1452('0x16')](function(_0x196a8c){console[_0x1452('0x17')](_0x1452('0x1d'),_0x196a8c);if(!_0x196a8c||_0x196a8c&&_0x196a8c[_0x1452('0x19')]!==_0xc3aead){throw new Error(_0x1452('0x11'));}_0x3b304d=_0x196a8c;var _0x18587e=_0x3b304d[_0x1452('0x19')]+'@'+config[_0x1452('0xa')]['domain'];return adAuthenticate(config[_0x1452('0xa')],_0x18587e,_0x494d84);})['then'](function(_0x33a9a1){console[_0x1452('0x17')]('res',_0x33a9a1);if(_0x3b304d[_0x1452('0x1f')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x34f592[_0x1452('0x15')]>0x0){if(_0x3b304d[_0x1452('0x1c')]){if(moment(_0x3b304d[_0x1452('0x20')])[_0x1452('0x21')](_0x34f592[_0x1452('0x15')],_0x1452('0x22'))>moment()){throw new Error(_0x1452('0x11'));}return utils['clearBlockUser'](_0x3b304d,0x0,![],null)[_0x1452('0x16')](function(){return utils[_0x1452('0x23')](_0x3b304d);})[_0x1452('0x16')](function(){return _0x4feae8(null,_0x3b304d);});}else{return utils[_0x1452('0x23')](_0x3b304d)[_0x1452('0x16')](function(){return _0x4feae8(null,_0x3b304d);});}}else{return utils[_0x1452('0x23')](_0x3b304d)[_0x1452('0x16')](function(){return _0x4feae8(null,_0x3b304d);});}})[_0x1452('0x24')](function(_0x196a9f){return _0x4feae8(null,![],_0x196a9f);});}function handleError(_0x39f6ff,_0x2b94ec,_0x132fd8){return _0x39f6ff[_0x1452('0x25')](_0x2b94ec||0x1f4)[_0x1452('0x26')]({'message':_0x132fd8?_0x132fd8[_0x1452('0x27')]||_0x132fd8:''});}exports['login']=function(_0x6b7ba6,_0x16332f,_0xc00445){passport[_0x1452('0x28')]('ad-login',function(_0x1bcd8d,_0x59ca7f,_0x1862e8){console[_0x1452('0x17')](_0x1452('0x29'),_0x1bcd8d,_0x59ca7f,_0x1862e8);var _0x32f612=_0x1bcd8d||_0x1862e8;if(_0x32f612){return handleError(_0x16332f,0x191,_0x32f612);}if(!_0x59ca7f){return handleError(_0x16332f,0x194,{'message':_0x1452('0x2a')});}else{var _0x25b0b5={'payload':{'id':_0x59ca7f['id'],'role':_0x59ca7f['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x25b0b5)[_0x1452('0x16')](function(_0xe5cd39){_0x16332f[_0x1452('0x2b')]({'id':_0x59ca7f['id'],'token':_0xe5cd39,'statusCall':'','isAlreadyLogged':_0x59ca7f[_0x1452('0x2c')]});});}})(_0x6b7ba6,_0x16332f,_0xc00445);};passport[_0x1452('0x2d')](_0x1452('0x2e'),new LocalStrategy({'usernameField':_0x1452('0x19'),'passwordField':_0x1452('0x1a')},function(_0xe00b29,_0x39e3bc,_0x4163bf){return ActiveDirectoryAuthenticate(db[_0x1452('0x2f')],_0xe00b29,_0x39e3bc,_0x4163bf);})); \ No newline at end of file +var _0xf442=['use','password','User','passport','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','authenticate','adAuthenticate','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','blockDuration','then','log','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','salt','role','disabled','blockedAt','admin','agent','user','name','domain','res','minutes','getLicense','status','send','message','ad-login','login','signToken','json'];(function(_0x1502ef,_0x1182a7){var _0x115c6f=function(_0x22d504){while(--_0x22d504){_0x1502ef['push'](_0x1502ef['shift']());}};_0x115c6f(++_0x1182a7);}(_0xf442,0x123));var _0x2f44=function(_0x1cd8d1,_0x52fa43){_0x1cd8d1=_0x1cd8d1-0x0;var _0x450f18=_0xf442[_0x1cd8d1];return _0x450f18;};'use strict';var passport=require(_0x2f44('0x0'));var LocalStrategy=require('passport-local')[_0x2f44('0x1')];var moment=require(_0x2f44('0x2'));var ActiveDirectory=require(_0x2f44('0x3'));var BPromise=require(_0x2f44('0x4'));var db=require(_0x2f44('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x2f44('0x6'));var config=require(_0x2f44('0x7'));var logger=require(_0x2f44('0x8'))(_0x2f44('0x9'));function isActiveDirectoryConfigured(_0x173abc){var _0x3c57cf=![];if(typeof _0x173abc[_0x2f44('0xa')]!==_0x2f44('0xb')){_0x3c57cf=_0x173abc[_0x2f44('0xa')][_0x2f44('0xc')]&&_0x173abc[_0x2f44('0xa')][_0x2f44('0xd')]&&_0x173abc[_0x2f44('0xa')]['domain'];}return _0x3c57cf;}function adAuthenticate(_0x494763,_0x502d51,_0x59fd00){return new BPromise(function(_0x2482a4,_0x4a2185){try{var _0x2feffb=new ActiveDirectory(_0x494763);_0x2feffb[_0x2f44('0xe')](_0x502d51,_0x59fd00,function(_0x4f59d3,_0x5ccd39){console['log'](_0x2f44('0xf'),_0x4f59d3,_0x5ccd39);if(_0x4f59d3){_0x4a2185(_0x4f59d3);}else if(!_0x5ccd39){_0x4a2185('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2482a4(_0x5ccd39);}});}catch(_0xb6605d){_0x4a2185(_0xb6605d);}});}function ActiveDirectoryAuthenticate(_0x1eadca,_0x18f7c2,_0x363684,_0x11e0e8){var _0x854eda,_0x424435;if(!isActiveDirectoryConfigured(config)){logger[_0x2f44('0x10')](_0x2f44('0x11'),_0x18f7c2);return _0x11e0e8(null,![],{'message':_0x2f44('0x12')});}return db[_0x2f44('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0x2f44('0x14'),_0x2f44('0x15')],'raw':!![]})[_0x2f44('0x16')](function(_0x3a1b3a){console[_0x2f44('0x17')]('settings',_0x3a1b3a);_0x854eda=_0x3a1b3a;if(!_0x854eda['adSsoEnabled']){logger['error'](_0x2f44('0x18'),_0x18f7c2);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1eadca[_0x2f44('0x19')]({'logging':!![],'attributes':['id','name','password',_0x2f44('0x1a'),_0x2f44('0x1b'),_0x2f44('0x1c'),'blocked',_0x2f44('0x1d')],'where':{'name':_0x18f7c2,'role':{'$or':[_0x2f44('0x1e'),'user',_0x2f44('0x1f')]},'adSsoEnabled':!![]}});})[_0x2f44('0x16')](function(_0x5ba04f){console[_0x2f44('0x17')](_0x2f44('0x20'),_0x5ba04f);if(!_0x5ba04f||_0x5ba04f&&_0x5ba04f[_0x2f44('0x21')]!==_0x18f7c2){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x424435=_0x5ba04f;var _0x243a1b=_0x424435[_0x2f44('0x21')]+'@'+config['activedirectory'][_0x2f44('0x22')];return adAuthenticate(config[_0x2f44('0xa')],_0x243a1b,_0x363684);})[_0x2f44('0x16')](function(_0x2829fe){console[_0x2f44('0x17')](_0x2f44('0x23'),_0x2829fe);if(_0x424435[_0x2f44('0x1c')]){throw new Error(_0x2f44('0x12'));}if(_0x854eda['blockDuration']>0x0){if(_0x424435['blocked']){if(moment(_0x424435[_0x2f44('0x1d')])['add'](_0x854eda[_0x2f44('0x15')],_0x2f44('0x24'))>moment()){throw new Error(_0x2f44('0x12'));}return utils['clearBlockUser'](_0x424435,0x0,![],null)['then'](function(){return utils['getLicense'](_0x424435);})[_0x2f44('0x16')](function(){return _0x11e0e8(null,_0x424435);});}else{return utils[_0x2f44('0x25')](_0x424435)[_0x2f44('0x16')](function(){return _0x11e0e8(null,_0x424435);});}}else{return utils['getLicense'](_0x424435)['then'](function(){return _0x11e0e8(null,_0x424435);});}})['catch'](function(_0x4481bc){return _0x11e0e8(null,![],_0x4481bc);});}function handleError(_0xfc679e,_0x2df2d3,_0x30386c){return _0xfc679e[_0x2f44('0x26')](_0x2df2d3||0x1f4)[_0x2f44('0x27')]({'message':_0x30386c?_0x30386c[_0x2f44('0x28')]||_0x30386c:''});}exports['login']=function(_0x1f1e04,_0x1a6475,_0x10c0b0){passport['authenticate'](_0x2f44('0x29'),function(_0x5dca5d,_0xbeef9e,_0x2a0941){console[_0x2f44('0x17')](_0x2f44('0x2a'),_0x5dca5d,_0xbeef9e,_0x2a0941);var _0x162a6b=_0x5dca5d||_0x2a0941;if(_0x162a6b){return handleError(_0x1a6475,0x191,_0x162a6b);}if(!_0xbeef9e){return handleError(_0x1a6475,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3f7cfa={'payload':{'id':_0xbeef9e['id'],'role':_0xbeef9e[_0x2f44('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x2f44('0x2b')](_0x3f7cfa)[_0x2f44('0x16')](function(_0x1414a6){_0x1a6475[_0x2f44('0x2c')]({'id':_0xbeef9e['id'],'token':_0x1414a6,'statusCall':'','isAlreadyLogged':_0xbeef9e['online']});});}})(_0x1f1e04,_0x1a6475,_0x10c0b0);};passport[_0x2f44('0x2d')](_0x2f44('0x29'),new LocalStrategy({'usernameField':_0x2f44('0x21'),'passwordField':_0x2f44('0x2e')},function(_0x5aa025,_0x19eef0,_0x2b5810){return ActiveDirectoryAuthenticate(db[_0x2f44('0x2f')],_0x5aa025,_0x19eef0,_0x2b5810);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index dfe7ff9..e675764 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x760b=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x4be09e,_0x1fc541){var _0x14f0fe=function(_0x55cc23){while(--_0x55cc23){_0x4be09e['push'](_0x4be09e['shift']());}};_0x14f0fe(++_0x1fc541);}(_0x760b,0x14c));var _0xb760=function(_0x623d1f,_0x25782b){_0x623d1f=_0x623d1f-0x0;var _0x41d02e=_0x760b[_0x623d1f];return _0x41d02e;};'use strict';var express=require(_0xb760('0x0'));var router=express[_0xb760('0x1')]();var controller=require(_0xb760('0x2'));router[_0xb760('0x3')]('/',controller[_0xb760('0x4')]);module['exports']=router; \ No newline at end of file +var _0xc73f=['Router','./authActiveDirectory.controller','exports'];(function(_0x49508f,_0x172399){var _0x1787ef=function(_0x1a9f45){while(--_0x1a9f45){_0x49508f['push'](_0x49508f['shift']());}};_0x1787ef(++_0x172399);}(_0xc73f,0x84));var _0xfc73=function(_0x32f262,_0x35e978){_0x32f262=_0x32f262-0x0;var _0x2f2e16=_0xc73f[_0x32f262];return _0x2f2e16;};'use strict';var express=require('express');var router=express[_0xfc73('0x0')]();var controller=require(_0xfc73('0x1'));router['post']('/',controller['login']);module[_0xfc73('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4271f7f..7a964b2 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 _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x7a54,0x106));var _0x47a5=function(_0x4b7205,_0x228c77){_0x4b7205=_0x4b7205-0x0;var _0x104499=_0x7a54[_0x4b7205];return _0x104499;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7a54,0x106));var _0x47a5=function(_0x87f427,_0x11699d){_0x87f427=_0x87f427-0x0;var _0x135498=_0x7a54[_0x87f427];return _0x135498;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 299b413..a52c40c 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 _0x60b8=['../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','exports','express','./authGoogle.controller'];(function(_0x42bdc2,_0x13ffc9){var _0x1a36c7=function(_0xd52c94){while(--_0xd52c94){_0x42bdc2['push'](_0x42bdc2['shift']());}};_0x1a36c7(++_0x13ffc9);}(_0x60b8,0x1e4));var _0x860b=function(_0x1f5db0,_0x1ce78c){_0x1f5db0=_0x1f5db0-0x0;var _0x55464d=_0x60b8[_0x1f5db0];return _0x55464d;};'use strict';var express=require(_0x860b('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x860b('0x1'));var userController=require(_0x860b('0x2'));var authService=require(_0x860b('0x3'));router[_0x860b('0x4')]('/',controller[_0x860b('0x5')]);router['get']('/callback',controller[_0x860b('0x6')],authService[_0x860b('0x7')],userController[_0x860b('0x5')],authService['setTokenCookie']);module[_0x860b('0x8')]=router; \ No newline at end of file +var _0x4d85=['callback','isMiddleware','login','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d85,0x99));var _0x54d8=function(_0x4b912,_0x183b72){_0x4b912=_0x4b912-0x0;var _0x59d609=_0x4d85[_0x4b912];return _0x59d609;};'use strict';var express=require(_0x54d8('0x0'));var passport=require('passport');var router=express[_0x54d8('0x1')]();var controller=require(_0x54d8('0x2'));var userController=require(_0x54d8('0x3'));var authService=require(_0x54d8('0x4'));router['get']('/',controller['login']);router[_0x54d8('0x5')](_0x54d8('0x6'),controller[_0x54d8('0x7')],authService[_0x54d8('0x8')],userController[_0x54d8('0x9')],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 37e4c6d..fe380b7 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 _0x86d9=['MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','request','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','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','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','params','token','now','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','use','util','passport','passport-local','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','name','password','role','disabled','loginAttempts','admin','user','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','blockDuration','blockedAt','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email'];(function(_0x1a8e02,_0x409ec5){var _0x5222f9=function(_0x1b8d9c){while(--_0x1b8d9c){_0x1a8e02['push'](_0x1a8e02['shift']());}};_0x5222f9(++_0x409ec5);}(_0x86d9,0x1d0));var _0x986d=function(_0x5738ea,_0x29900e){_0x5738ea=_0x5738ea-0x0;var _0x71091=_0x86d9[_0x5738ea];return _0x71091;};'use strict';var util=require(_0x986d('0x0'));var passport=require(_0x986d('0x1'));var LocalStrategy=require(_0x986d('0x2'))['Strategy'];var jayson=require(_0x986d('0x3'));var _=require(_0x986d('0x4'));var rs=require('randomstring');var moment=require(_0x986d('0x5'));var db=require(_0x986d('0x6'))['db'];var authService=require(_0x986d('0x7'));var utils=require(_0x986d('0x8'));var client=jayson[_0x986d('0x9')][_0x986d('0xa')]({'port':0x232b});function localAuthenticate(_0x22a965,_0x28211a,_0x1807a9,_0x38897d){var _0x4adfd0,_0x419bb4;return db[_0x986d('0xb')][_0x986d('0xc')]({'where':{'id':0x1},'attributes':[_0x986d('0xd'),'blockDuration'],'raw':!![]})['then'](function(_0xbd3f72){_0x4adfd0=_0xbd3f72;return _0x22a965[_0x986d('0xc')]({'attributes':['id',_0x986d('0xe'),_0x986d('0xf'),'salt',_0x986d('0x10'),_0x986d('0x11'),'blocked','blockedAt',_0x986d('0x12')],'where':{'name':_0x28211a,'role':{'$or':[_0x986d('0x13'),_0x986d('0x14'),'agent']}}});})[_0x986d('0x15')](function(_0x120633){if(!_0x120633||_0x120633&&_0x120633['name']!==_0x28211a){throw new Error(_0x986d('0x16'));}else{_0x419bb4=_0x120633;return _0x419bb4;}})[_0x986d('0x15')](function(){_0x419bb4[_0x986d('0x17')](_0x1807a9,function(_0x51ff26,_0x4f156f){var _0x2bde86=_0x419bb4['loginAttempts']+0x1;if(_0x51ff26){return _0x38897d(_0x51ff26);}else if(!_0x4f156f){if(_0x419bb4[_0x986d('0x11')]){return _0x38897d(null,![],{'message':_0x986d('0x16')});}else if(_0x4adfd0[_0x986d('0xd')]>0x0){if(_0x419bb4[_0x986d('0x18')]){if(_0x4adfd0[_0x986d('0x19')]>0x0){if(moment(_0x419bb4[_0x986d('0x1a')])['add'](_0x4adfd0[_0x986d('0x19')],_0x986d('0x1b'))>moment()){return _0x38897d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x986d('0x1c')](_0x419bb4,_0x2bde86,![],null)[_0x986d('0x15')](function(){return _0x38897d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x38897d(null,![],{'message':_0x986d('0x16')});}}else{if(_0x2bde86>=_0x4adfd0['allowedLoginAttempts']){return utils[_0x986d('0x1c')](_0x419bb4,0x0,!![],moment())[_0x986d('0x15')](function(){return _0x38897d(null,![],{'message':_0x986d('0x16')});});}else{return utils['clearBlockUser'](_0x419bb4,_0x2bde86,![],null)[_0x986d('0x15')](function(){return _0x38897d(null,![],{'message':_0x986d('0x16')});});}}}else{return _0x38897d(null,![],{'message':_0x986d('0x16')});}}else{if(_0x419bb4[_0x986d('0x11')]){return _0x38897d(null,![],{'message':_0x986d('0x16')});}else if(_0x4adfd0['allowedLoginAttempts']>0x0){if(_0x419bb4[_0x986d('0x18')]){if(_0x4adfd0[_0x986d('0x19')]>0x0){if(moment(_0x419bb4[_0x986d('0x1a')])['add'](_0x4adfd0[_0x986d('0x19')],_0x986d('0x1b'))>moment()){return _0x38897d(null,![],{'message':_0x986d('0x16')});}else{return utils[_0x986d('0x1c')](_0x419bb4,0x0,![],null)[_0x986d('0x15')](function(){return utils[_0x986d('0x1d')](_0x419bb4);})[_0x986d('0x15')](function(){return _0x38897d(null,_0x419bb4);});}}else{return _0x38897d(null,![],{'message':_0x986d('0x16')});}}else{return utils[_0x986d('0x1c')](_0x419bb4,0x0,![],null)['then'](function(){return utils[_0x986d('0x1d')](_0x419bb4);})[_0x986d('0x15')](function(){return _0x38897d(null,_0x419bb4);})[_0x986d('0x1e')](function(_0x975758){return _0x38897d(null,![],_0x975758);});}}else{if(_0x419bb4[_0x986d('0x18')]){return _0x38897d(null,![],{'message':_0x986d('0x16')});}else{return utils['getLicense'](_0x419bb4)[_0x986d('0x15')](function(){return _0x38897d(null,_0x419bb4);});}}}});})['catch'](function(_0x5a7e92){return _0x38897d(null,![],_0x5a7e92);});}function sendServiceMail(_0x1dcf7a){return db[_0x986d('0x1f')][_0x986d('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x986d('0x21')],'include':[{'model':db[_0x986d('0x22')],'as':_0x986d('0x23')}]})[_0x986d('0x15')](function(_0x1ce8a1){if(!_0x1ce8a1){throw new Error(_0x986d('0x24'));}var _0x4dbbe4={'tls':{'rejectUnauthorized':![]}};if(_0x1ce8a1['Smtp'][_0x986d('0x25')]){_0x4dbbe4[_0x986d('0x25')]=_0x1ce8a1[_0x986d('0x23')][_0x986d('0x25')];}else{_0x4dbbe4[_0x986d('0x26')]=_0x1ce8a1[_0x986d('0x23')]['host'];_0x4dbbe4[_0x986d('0x27')]=_0x1ce8a1[_0x986d('0x23')][_0x986d('0x27')];_0x4dbbe4[_0x986d('0x28')]=_0x1ce8a1[_0x986d('0x23')][_0x986d('0x28')];}if(_0x1ce8a1[_0x986d('0x23')][_0x986d('0x29')]){_0x4dbbe4[_0x986d('0x2a')]={'user':_0x1ce8a1['Smtp'][_0x986d('0x14')],'pass':_0x1ce8a1[_0x986d('0x23')]['pass']};}var _0x1b314e={'account':_0x4dbbe4,'message':_[_0x986d('0x2b')]({'from':util[_0x986d('0x2c')](_0x986d('0x2d'),_0x1ce8a1[_0x986d('0xe')],_0x1ce8a1['email']||_0x1ce8a1['Smtp'][_0x986d('0x14')])},_0x1dcf7a)};return client[_0x986d('0x2e')]('SendMail',_0x1b314e);})[_0x986d('0x15')](function(_0x4ce5c3){if(_0x4ce5c3[_0x986d('0x2f')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4ce5c3[_0x986d('0x2f')][_0x986d('0x30')]||JSON[_0x986d('0x31')](_0x4ce5c3[_0x986d('0x2f')])));}return!![];});}function handleError(_0x510154,_0x41efa6,_0x579f7d){return _0x510154[_0x986d('0x32')](_0x41efa6||0x1f4)[_0x986d('0x33')]({'message':_0x579f7d?_0x579f7d[_0x986d('0x30')]||_0x579f7d:''});}exports[_0x986d('0x34')]=function(_0x5ece11,_0x516baf,_0x14156b){passport[_0x986d('0x17')](_0x986d('0x35'),function(_0x461508,_0xaa450d,_0x5e0816){var _0x27325a=_0x461508||_0x5e0816;if(_0x27325a){return handleError(_0x516baf,0x191,_0x27325a);}if(!_0xaa450d){return handleError(_0x516baf,0x194,{'message':_0x986d('0x36')});}else{var _0x24557f={'payload':{'id':_0xaa450d['id'],'role':_0xaa450d[_0x986d('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x986d('0x37')](_0x24557f)['then'](function(_0x20e5d3){_0x516baf['json']({'id':_0xaa450d['id'],'token':_0x20e5d3,'statusCall':'','isAlreadyLogged':_0xaa450d[_0x986d('0x38')]});});}})(_0x5ece11,_0x516baf,_0x14156b);};exports[_0x986d('0x39')]=function(_0x1c5f6c,_0x1be29f,_0x3b8e84){if(!_0x1c5f6c[_0x986d('0x3a')][_0x986d('0x21')]){return handleError(_0x1be29f,0x1f4,{'message':_0x986d('0x3b')});}var _0x2485ac=rs[_0x986d('0x3c')]();_0x1c5f6c[_0x986d('0x3a')][_0x986d('0x21')]=_0x1c5f6c[_0x986d('0x3a')]['email'][_0x986d('0x3d')]()['toLowerCase']();var _0x13d1d5;return db[_0x986d('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x986d('0xd'),_0x986d('0x19')],'raw':!![]})['then'](function(_0x4d8790){_0x13d1d5=_0x4d8790;return db[_0x986d('0x3e')]['find']({'where':{'email':_0x1c5f6c[_0x986d('0x3a')][_0x986d('0x21')]}});})['then'](function(_0x2d15dd){if(!_0x2d15dd){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2d15dd[_0x986d('0x11')]){throw new Error(_0x986d('0x3f'));}if(_0x2d15dd[_0x986d('0x18')]){if(moment(_0x2d15dd[_0x986d('0x1a')])['add'](_0x13d1d5[_0x986d('0x19')],_0x986d('0x1b'))>moment()){throw new Error(_0x986d('0x40'));}else{_0x2d15dd[_0x986d('0x18')]=![];_0x2d15dd[_0x986d('0x1a')]=null;}}_0x2d15dd[_0x986d('0x41')]=_0x2485ac;_0x2d15dd[_0x986d('0x42')]=Date['now']()+0x36ee80;return _0x2d15dd[_0x986d('0x43')]();})[_0x986d('0x15')](function(){return sendServiceMail({'to':_0x1c5f6c['body']['email'],'subject':_0x986d('0x44'),'text':_0x986d('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x986d('0x46')+_0x1c5f6c['headers'][_0x986d('0x26')]+_0x986d('0x47')+_0x2485ac+'\x0a\x0a'+_0x986d('0x48')});})[_0x986d('0x15')](function(){_0x1be29f['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x986d('0x1e')](function(_0x2cd556){return handleError(_0x1be29f,0x1f4,_0x2cd556);});};exports['reset']=function(_0x367c85,_0x16b6a7,_0x584d6b){return db[_0x986d('0x3e')][_0x986d('0x20')]({'where':{'resetPasswordToken':_0x367c85[_0x986d('0x49')][_0x986d('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x986d('0x4b')]()}}})[_0x986d('0x15')](function(_0x457033){if(!_0x457033){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id','securePassword',_0x986d('0x4c'),_0x986d('0x4d')]})['then'](function(_0x1d2d2d){if(_0x1d2d2d[_0x986d('0x4e')])authService[_0x986d('0x4f')](_0x367c85[_0x986d('0x3a')][_0x986d('0xf')]);if(!_0x1d2d2d[_0x986d('0x4c')]||!_0x457033[_0x986d('0x50')])return _0x457033;authService[_0x986d('0x51')](_0x367c85['body'][_0x986d('0xf')],_0x457033['previousPasswords'],_0x1d2d2d[_0x986d('0x4d')]);return _0x457033;})['then'](function(){_0x457033[_0x986d('0xf')]=_0x367c85[_0x986d('0x3a')][_0x986d('0xf')];_0x457033[_0x986d('0x41')]=null;_0x457033[_0x986d('0x42')]=null;return _0x457033['save']();});})[_0x986d('0x15')](function(){_0x16b6a7[_0x986d('0x32')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x986d('0x1e')](function(_0x31da60){return handleError(_0x16b6a7,0x1f4,_0x31da60);});};passport[_0x986d('0x52')]('local-login',new LocalStrategy({'usernameField':_0x986d('0xe'),'passwordField':_0x986d('0xf')},function(_0x46deda,_0x466ce9,_0x3910c2){return localAuthenticate(db[_0x986d('0x3e')],_0x46deda,_0x466ce9,_0x3910c2);})); \ No newline at end of file +var _0xcd2c=['util','passport','passport-local','Strategy','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blockedAt','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','blocked','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','merge','format','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd2c,0x195));var _0xccd2=function(_0x5c61e4,_0x20a992){_0x5c61e4=_0x5c61e4-0x0;var _0x5224dc=_0xcd2c[_0x5c61e4];return _0x5224dc;};'use strict';var util=require(_0xccd2('0x0'));var passport=require(_0xccd2('0x1'));var LocalStrategy=require(_0xccd2('0x2'))[_0xccd2('0x3')];var jayson=require('jayson/promise');var _=require(_0xccd2('0x4'));var rs=require('randomstring');var moment=require(_0xccd2('0x5'));var db=require(_0xccd2('0x6'))['db'];var authService=require(_0xccd2('0x7'));var utils=require(_0xccd2('0x8'));var client=jayson[_0xccd2('0x9')][_0xccd2('0xa')]({'port':0x232b});function localAuthenticate(_0x40999d,_0x1a1fec,_0x44c4e7,_0x2fbd19){var _0x4b2ac2,_0x2b5982;return db[_0xccd2('0xb')][_0xccd2('0xc')]({'where':{'id':0x1},'attributes':[_0xccd2('0xd'),_0xccd2('0xe')],'raw':!![]})[_0xccd2('0xf')](function(_0x28ba04){_0x4b2ac2=_0x28ba04;return _0x40999d[_0xccd2('0xc')]({'attributes':['id',_0xccd2('0x10'),_0xccd2('0x11'),'salt',_0xccd2('0x12'),_0xccd2('0x13'),'blocked',_0xccd2('0x14'),_0xccd2('0x15')],'where':{'name':_0x1a1fec,'role':{'$or':[_0xccd2('0x16'),'user','agent']}}});})['then'](function(_0x365d3d){if(!_0x365d3d||_0x365d3d&&_0x365d3d['name']!==_0x1a1fec){throw new Error(_0xccd2('0x17'));}else{_0x2b5982=_0x365d3d;return _0x2b5982;}})[_0xccd2('0xf')](function(){_0x2b5982[_0xccd2('0x18')](_0x44c4e7,function(_0x2e7564,_0x51c5dd){var _0x1bbd95=_0x2b5982[_0xccd2('0x15')]+0x1;if(_0x2e7564){return _0x2fbd19(_0x2e7564);}else if(!_0x51c5dd){if(_0x2b5982[_0xccd2('0x13')]){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else if(_0x4b2ac2['allowedLoginAttempts']>0x0){if(_0x2b5982['blocked']){if(_0x4b2ac2[_0xccd2('0xe')]>0x0){if(moment(_0x2b5982[_0xccd2('0x14')])[_0xccd2('0x19')](_0x4b2ac2[_0xccd2('0xe')],_0xccd2('0x1a'))>moment()){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else{return utils[_0xccd2('0x1b')](_0x2b5982,_0x1bbd95,![],null)[_0xccd2('0xf')](function(){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});});}}else{return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}}else{if(_0x1bbd95>=_0x4b2ac2['allowedLoginAttempts']){return utils[_0xccd2('0x1b')](_0x2b5982,0x0,!![],moment())[_0xccd2('0xf')](function(){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});});}else{return utils[_0xccd2('0x1b')](_0x2b5982,_0x1bbd95,![],null)[_0xccd2('0xf')](function(){return _0x2fbd19(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}}else{if(_0x2b5982[_0xccd2('0x13')]){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else if(_0x4b2ac2[_0xccd2('0xd')]>0x0){if(_0x2b5982[_0xccd2('0x1c')]){if(_0x4b2ac2[_0xccd2('0xe')]>0x0){if(moment(_0x2b5982[_0xccd2('0x14')])['add'](_0x4b2ac2['blockDuration'],'minutes')>moment()){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else{return utils[_0xccd2('0x1b')](_0x2b5982,0x0,![],null)[_0xccd2('0xf')](function(){return utils['getLicense'](_0x2b5982);})[_0xccd2('0xf')](function(){return _0x2fbd19(null,_0x2b5982);});}}else{return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}}else{return utils[_0xccd2('0x1b')](_0x2b5982,0x0,![],null)['then'](function(){return utils[_0xccd2('0x1d')](_0x2b5982);})[_0xccd2('0xf')](function(){return _0x2fbd19(null,_0x2b5982);})[_0xccd2('0x1e')](function(_0x3b2d26){return _0x2fbd19(null,![],_0x3b2d26);});}}else{if(_0x2b5982[_0xccd2('0x1c')]){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else{return utils[_0xccd2('0x1d')](_0x2b5982)[_0xccd2('0xf')](function(){return _0x2fbd19(null,_0x2b5982);});}}}});})['catch'](function(_0x3037e1){return _0x2fbd19(null,![],_0x3037e1);});}function sendServiceMail(_0x5ab231){return db[_0xccd2('0x1f')][_0xccd2('0x20')]({'where':{'service':!![]},'attributes':['id',_0xccd2('0x10'),_0xccd2('0x21')],'include':[{'model':db['MailServerOut'],'as':_0xccd2('0x22')}]})[_0xccd2('0xf')](function(_0x4d5cf2){if(!_0x4d5cf2){throw new Error(_0xccd2('0x23'));}var _0x15a3dd={'tls':{'rejectUnauthorized':![]}};if(_0x4d5cf2['Smtp'][_0xccd2('0x24')]){_0x15a3dd[_0xccd2('0x24')]=_0x4d5cf2['Smtp'][_0xccd2('0x24')];}else{_0x15a3dd[_0xccd2('0x25')]=_0x4d5cf2[_0xccd2('0x22')]['host'];_0x15a3dd['port']=_0x4d5cf2['Smtp'][_0xccd2('0x26')];_0x15a3dd[_0xccd2('0x27')]=_0x4d5cf2[_0xccd2('0x22')][_0xccd2('0x27')];}if(_0x4d5cf2[_0xccd2('0x22')][_0xccd2('0x28')]){_0x15a3dd[_0xccd2('0x29')]={'user':_0x4d5cf2['Smtp'][_0xccd2('0x2a')],'pass':_0x4d5cf2['Smtp']['pass']};}var _0x20cab7={'account':_0x15a3dd,'message':_[_0xccd2('0x2b')]({'from':util[_0xccd2('0x2c')]('\x22%s\x22\x20<%s>',_0x4d5cf2[_0xccd2('0x10')],_0x4d5cf2[_0xccd2('0x21')]||_0x4d5cf2[_0xccd2('0x22')]['user'])},_0x5ab231)};return client[_0xccd2('0x2d')]('SendMail',_0x20cab7);})[_0xccd2('0xf')](function(_0x3e125c){if(_0x3e125c[_0xccd2('0x2e')]){throw new Error(util[_0xccd2('0x2c')](_0xccd2('0x2f'),_0x3e125c[_0xccd2('0x2e')][_0xccd2('0x30')]||JSON[_0xccd2('0x31')](_0x3e125c[_0xccd2('0x2e')])));}return!![];});}function handleError(_0x9393a,_0x522622,_0x4e686a){return _0x9393a[_0xccd2('0x32')](_0x522622||0x1f4)[_0xccd2('0x33')]({'message':_0x4e686a?_0x4e686a[_0xccd2('0x30')]||_0x4e686a:''});}exports['login']=function(_0x3be377,_0x27ad43,_0x296968){passport[_0xccd2('0x18')](_0xccd2('0x34'),function(_0x963167,_0x283d53,_0xf10b1f){var _0x4e9055=_0x963167||_0xf10b1f;if(_0x4e9055){return handleError(_0x27ad43,0x191,_0x4e9055);}if(!_0x283d53){return handleError(_0x27ad43,0x194,{'message':_0xccd2('0x35')});}else{var _0x349478={'payload':{'id':_0x283d53['id'],'role':_0x283d53[_0xccd2('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x349478)[_0xccd2('0xf')](function(_0x802e0d){_0x27ad43[_0xccd2('0x36')]({'id':_0x283d53['id'],'token':_0x802e0d,'statusCall':'','isAlreadyLogged':_0x283d53[_0xccd2('0x37')]});});}})(_0x3be377,_0x27ad43,_0x296968);};exports[_0xccd2('0x38')]=function(_0x3a5dab,_0x56a8fa,_0x48decb){if(!_0x3a5dab['body'][_0xccd2('0x21')]){return handleError(_0x56a8fa,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x34fa5a=rs['generate']();_0x3a5dab[_0xccd2('0x39')]['email']=_0x3a5dab[_0xccd2('0x39')][_0xccd2('0x21')][_0xccd2('0x3a')]()[_0xccd2('0x3b')]();var _0x53edbe;return db[_0xccd2('0xb')][_0xccd2('0xc')]({'where':{'id':0x1},'attributes':[_0xccd2('0xd'),_0xccd2('0xe')],'raw':!![]})[_0xccd2('0xf')](function(_0x35b6c2){_0x53edbe=_0x35b6c2;return db[_0xccd2('0x3c')][_0xccd2('0x20')]({'where':{'email':_0x3a5dab[_0xccd2('0x39')][_0xccd2('0x21')]}});})[_0xccd2('0xf')](function(_0x19d38a){if(!_0x19d38a){throw new Error(_0xccd2('0x3d'));}if(_0x19d38a[_0xccd2('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x19d38a[_0xccd2('0x1c')]){if(moment(_0x19d38a[_0xccd2('0x14')])[_0xccd2('0x19')](_0x53edbe[_0xccd2('0xe')],'minutes')>moment()){throw new Error(_0xccd2('0x3e'));}else{_0x19d38a[_0xccd2('0x1c')]=![];_0x19d38a[_0xccd2('0x14')]=null;}}_0x19d38a[_0xccd2('0x3f')]=_0x34fa5a;_0x19d38a[_0xccd2('0x40')]=Date[_0xccd2('0x41')]()+0x36ee80;return _0x19d38a[_0xccd2('0x42')]();})[_0xccd2('0xf')](function(){return sendServiceMail({'to':_0x3a5dab[_0xccd2('0x39')][_0xccd2('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xccd2('0x43')+_0xccd2('0x44')+_0xccd2('0x45')+_0x3a5dab[_0xccd2('0x46')][_0xccd2('0x25')]+_0xccd2('0x47')+_0x34fa5a+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xccd2('0xf')](function(){_0x56a8fa[_0xccd2('0x32')](0xc8)['send']({'message':_0xccd2('0x48')});})[_0xccd2('0x1e')](function(_0x2be123){return handleError(_0x56a8fa,0x1f4,_0x2be123);});};exports['reset']=function(_0x113e04,_0x2e521b,_0x39f042){return db['User'][_0xccd2('0x20')]({'where':{'resetPasswordToken':_0x113e04['params'][_0xccd2('0x49')],'resetPasswordExpires':{'$gt':Date[_0xccd2('0x41')]()}}})[_0xccd2('0xf')](function(_0x3b2598){if(!_0x3b2598){throw new Error(_0xccd2('0x4a'));}return db['Setting'][_0xccd2('0xc')]({'attributes':['id',_0xccd2('0x4b'),_0xccd2('0x4c'),_0xccd2('0x4d')]})[_0xccd2('0xf')](function(_0x19114b){if(_0x19114b[_0xccd2('0x4b')])authService[_0xccd2('0x4e')](_0x113e04[_0xccd2('0x39')][_0xccd2('0x11')]);if(!_0x19114b[_0xccd2('0x4c')]||!_0x3b2598['previousPasswords'])return _0x3b2598;authService[_0xccd2('0x4f')](_0x113e04[_0xccd2('0x39')][_0xccd2('0x11')],_0x3b2598[_0xccd2('0x50')],_0x19114b['passwordHistoryLimit']);return _0x3b2598;})[_0xccd2('0xf')](function(){_0x3b2598[_0xccd2('0x11')]=_0x113e04['body']['password'];_0x3b2598[_0xccd2('0x3f')]=null;_0x3b2598[_0xccd2('0x40')]=null;return _0x3b2598[_0xccd2('0x42')]();});})[_0xccd2('0xf')](function(){_0x2e521b['status'](0xc8)['send']({'message':'Password\x20reset!'});})['catch'](function(_0x253fc6){return handleError(_0x2e521b,0x1f4,_0x253fc6);});};passport['use'](_0xccd2('0x34'),new LocalStrategy({'usernameField':'name','passwordField':_0xccd2('0x11')},function(_0xc92f16,_0x3a2e83,_0x25813c){return localAuthenticate(db[_0xccd2('0x3c')],_0xc92f16,_0x3a2e83,_0x25813c);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 52c8e03..c8f4e4d 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 _0x0a2b=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x588920,_0x595dfb){var _0x5e082b=function(_0x42a70b){while(--_0x42a70b){_0x588920['push'](_0x588920['shift']());}};_0x5e082b(++_0x595dfb);}(_0x0a2b,0x111));var _0xb0a2=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x0a2b[_0x59e821];return _0x5333f6;};'use strict';var express=require(_0xb0a2('0x0'));var router=express[_0xb0a2('0x1')]();var controller=require(_0xb0a2('0x2'));router[_0xb0a2('0x3')]('/',controller[_0xb0a2('0x4')]);router[_0xb0a2('0x3')](_0xb0a2('0x5'),controller[_0xb0a2('0x6')]);router[_0xb0a2('0x3')](_0xb0a2('0x7'),controller[_0xb0a2('0x8')]);module[_0xb0a2('0x9')]=router; \ No newline at end of file +var _0x6af4=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0x1791b7,_0x205e7a){var _0x49d71a=function(_0x1c36a8){while(--_0x1c36a8){_0x1791b7['push'](_0x1791b7['shift']());}};_0x49d71a(++_0x205e7a);}(_0x6af4,0xce));var _0x46af=function(_0x126b67,_0x331b2e){_0x126b67=_0x126b67-0x0;var _0x351931=_0x6af4[_0x126b67];return _0x351931;};'use strict';var express=require(_0x46af('0x0'));var router=express['Router']();var controller=require(_0x46af('0x1'));router[_0x46af('0x2')]('/',controller[_0x46af('0x3')]);router[_0x46af('0x2')](_0x46af('0x4'),controller[_0x46af('0x5')]);router[_0x46af('0x2')](_0x46af('0x6'),controller[_0x46af('0x7')]);module[_0x46af('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 3134c7b..1753516 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 _0x7115=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x4c0ccf,_0x109f71){var _0x5501fa=function(_0x23012c){while(--_0x23012c){_0x4c0ccf['push'](_0x4c0ccf['shift']());}};_0x5501fa(++_0x109f71);}(_0x7115,0xcb));var _0x5711=function(_0x124b9a,_0x806a26){_0x124b9a=_0x124b9a-0x0;var _0x4c1085=_0x7115[_0x124b9a];return _0x4c1085;};'use strict';var Sequelize=require('sequelize');module[_0x5711('0x0')]={'name':{'type':Sequelize[_0x5711('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x5711('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5711('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5711('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x3698=['INTEGER','sequelize','STRING'];(function(_0x204ce5,_0x46fb75){var _0x4f5a44=function(_0x55e0ac){while(--_0x55e0ac){_0x204ce5['push'](_0x204ce5['shift']());}};_0x4f5a44(++_0x46fb75);}(_0x3698,0x181));var _0x8369=function(_0xeb5575,_0x486f40){_0xeb5575=_0xeb5575-0x0;var _0x2da5cd=_0x3698[_0xeb5575];return _0x2da5cd;};'use strict';var Sequelize=require(_0x8369('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x8369('0x1')]},'description':{'type':Sequelize[_0x8369('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8369('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 82df4a8..ef53243 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 _0xe417=['Automation','fieldName','type','key','name','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','count','includeAll','rows','catch','show','rawAttributes','include','create','body','find','params','addConditions','ids','omit','getConditions','order','pick','addActions','Action','getActions','eml-format','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','Content-Range','reject','save','update','destroy','then','end','error','stack','index','map'];(function(_0x12033b,_0x50fad7){var _0x15d0ac=function(_0x3e6a9e){while(--_0x3e6a9e){_0x12033b['push'](_0x12033b['shift']());}};_0x15d0ac(++_0x50fad7);}(_0xe417,0x1b3));var _0x7e41=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xe417[_0x17928f];return _0x500b63;};'use strict';var emlformat=require(_0x7e41('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7e41('0x1'));var BPromise=require(_0x7e41('0x2'));var Mustache=require('mustache');var util=require(_0x7e41('0x3'));var path=require(_0x7e41('0x4'));var sox=require(_0x7e41('0x5'));var csv=require(_0x7e41('0x6'));var ejs=require(_0x7e41('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e41('0x8'));var squel=require(_0x7e41('0x9'));var crypto=require(_0x7e41('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7e41('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7e41('0xc'));var Redis=require(_0x7e41('0xd'));var authService=require(_0x7e41('0xe'));var qs=require(_0x7e41('0xf'));var as=require(_0x7e41('0x10'));var hardwareService=require(_0x7e41('0x11'));var logger=require(_0x7e41('0x12'))('api');var utils=require(_0x7e41('0x13'));var config=require(_0x7e41('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e41('0x15'))['db'];function respondWithStatusCode(_0x2fc111,_0x1e7e51){_0x1e7e51=_0x1e7e51||0xcc;return function(_0x4a808e){if(_0x4a808e){return _0x2fc111[_0x7e41('0x16')](_0x1e7e51);}return _0x2fc111['status'](_0x1e7e51)['end']();};}function respondWithResult(_0x2f6cbc,_0x2f767f){_0x2f767f=_0x2f767f||0xc8;return function(_0xa67c9c){if(_0xa67c9c){return _0x2f6cbc[_0x7e41('0x17')](_0x2f767f)[_0x7e41('0x18')](_0xa67c9c);}};}function respondWithFilteredResult(_0x1cbeb7,_0x4b1df0){return function(_0x3aefaa){if(_0x3aefaa){var _0x558b36=typeof _0x4b1df0['offset']===_0x7e41('0x19')&&typeof _0x4b1df0[_0x7e41('0x1a')]===_0x7e41('0x19');var _0x270377=_0x3aefaa['count'];var _0x1ba722=_0x558b36?0x0:_0x4b1df0['offset'];var _0x14a8c5=_0x558b36?_0x3aefaa['count']:_0x4b1df0[_0x7e41('0x1b')]+_0x4b1df0[_0x7e41('0x1a')];var _0x451af4;if(_0x14a8c5>=_0x270377){_0x14a8c5=_0x270377;_0x451af4=0xc8;}else{_0x451af4=0xce;}_0x1cbeb7[_0x7e41('0x17')](_0x451af4);return _0x1cbeb7['set'](_0x7e41('0x1c'),_0x1ba722+'-'+_0x14a8c5+'/'+_0x270377)[_0x7e41('0x18')](_0x3aefaa);}return null;};}function patchUpdates(_0x3e3f59){return function(_0x2b2800){try{jsonpatch['apply'](_0x2b2800,_0x3e3f59,!![]);}catch(_0x36c664){return BPromise[_0x7e41('0x1d')](_0x36c664);}return _0x2b2800[_0x7e41('0x1e')]();};}function saveUpdates(_0x28ae12,_0x2884c8){return function(_0x8a0020){if(_0x8a0020){return _0x8a0020[_0x7e41('0x1f')](_0x28ae12)['then'](function(_0x370bd1){return _0x370bd1;});}return null;};}function removeEntity(_0x1e697a,_0x215859){return function(_0xf4a40a){if(_0xf4a40a){return _0xf4a40a[_0x7e41('0x20')]()[_0x7e41('0x21')](function(){_0x1e697a[_0x7e41('0x17')](0xcc)[_0x7e41('0x22')]();});}};}function handleEntityNotFound(_0x816908,_0x27f152){return function(_0x54d870){if(!_0x54d870){_0x816908[_0x7e41('0x16')](0x194);}return _0x54d870;};}function handleError(_0x472a2e,_0x35045e){_0x35045e=_0x35045e||0x1f4;return function(_0x39feef){logger[_0x7e41('0x23')](_0x39feef[_0x7e41('0x24')]);if(_0x39feef['name']){delete _0x39feef['name'];}_0x472a2e[_0x7e41('0x17')](_0x35045e)['send'](_0x39feef);};}exports[_0x7e41('0x25')]=function(_0x167db1,_0xa71f85){var _0x2da954={},_0x335216={},_0x1ef6a4={'count':0x0,'rows':[]};var _0x3bc7e5=_[_0x7e41('0x26')](db[_0x7e41('0x27')]['rawAttributes'],function(_0xa1bfd4){return{'name':_0xa1bfd4[_0x7e41('0x28')],'type':_0xa1bfd4[_0x7e41('0x29')][_0x7e41('0x2a')]};});_0x335216['model']=_[_0x7e41('0x26')](_0x3bc7e5,_0x7e41('0x2b'));_0x335216[_0x7e41('0x2c')]=_[_0x7e41('0x2d')](_0x167db1[_0x7e41('0x2c')]);_0x335216[_0x7e41('0x2e')]=_['intersection'](_0x335216[_0x7e41('0x2f')],_0x335216['query']);_0x2da954['attributes']=_[_0x7e41('0x30')](_0x335216[_0x7e41('0x2f')],qs[_0x7e41('0x31')](_0x167db1[_0x7e41('0x2c')][_0x7e41('0x31')]));_0x2da954[_0x7e41('0x32')]=_0x2da954[_0x7e41('0x32')][_0x7e41('0x33')]?_0x2da954[_0x7e41('0x32')]:_0x335216[_0x7e41('0x2f')];if(!_0x167db1[_0x7e41('0x2c')][_0x7e41('0x34')](_0x7e41('0x35'))){_0x2da954[_0x7e41('0x1a')]=qs[_0x7e41('0x1a')](_0x167db1[_0x7e41('0x2c')][_0x7e41('0x1a')]);_0x2da954[_0x7e41('0x1b')]=qs[_0x7e41('0x1b')](_0x167db1['query'][_0x7e41('0x1b')]);}_0x2da954['order']=qs[_0x7e41('0x36')](_0x167db1[_0x7e41('0x2c')]['sort']);_0x2da954[_0x7e41('0x37')]=qs[_0x7e41('0x2e')](_['pick'](_0x167db1[_0x7e41('0x2c')],_0x335216[_0x7e41('0x2e')]),_0x3bc7e5);if(_0x167db1['query'][_0x7e41('0x38')]){_0x2da954[_0x7e41('0x37')]=_[_0x7e41('0x39')](_0x2da954[_0x7e41('0x37')],{'$or':_[_0x7e41('0x26')](_0x3bc7e5,function(_0x5c4cea){if(_0x5c4cea['type']!=='VIRTUAL'){var _0x59328c={};_0x59328c[_0x5c4cea[_0x7e41('0x2b')]]={'$like':'%'+_0x167db1['query'][_0x7e41('0x38')]+'%'};return _0x59328c;}})});}_0x2da954=_['merge']({},_0x2da954,_0x167db1[_0x7e41('0x3a')]);var _0x467a81={'where':_0x2da954[_0x7e41('0x37')]};return db[_0x7e41('0x27')][_0x7e41('0x3b')](_0x467a81)[_0x7e41('0x21')](function(_0x2be33c){_0x1ef6a4[_0x7e41('0x3b')]=_0x2be33c;if(_0x167db1[_0x7e41('0x2c')][_0x7e41('0x3c')]){_0x2da954['include']=[{'all':!![]}];}return db[_0x7e41('0x27')]['findAll'](_0x2da954);})[_0x7e41('0x21')](function(_0x481a58){_0x1ef6a4[_0x7e41('0x3d')]=_0x481a58;return _0x1ef6a4;})[_0x7e41('0x21')](respondWithFilteredResult(_0xa71f85,_0x2da954))[_0x7e41('0x3e')](handleError(_0xa71f85,null));};exports[_0x7e41('0x3f')]=function(_0x25729d,_0x53f9a5){var _0x3eea66={'raw':![],'where':{'id':_0x25729d['params']['id']}},_0x1eaaff={};_0x1eaaff[_0x7e41('0x2f')]=_[_0x7e41('0x2d')](db[_0x7e41('0x27')][_0x7e41('0x40')]);_0x1eaaff['query']=_[_0x7e41('0x2d')](_0x25729d[_0x7e41('0x2c')]);_0x1eaaff[_0x7e41('0x2e')]=_[_0x7e41('0x30')](_0x1eaaff['model'],_0x1eaaff[_0x7e41('0x2c')]);_0x3eea66[_0x7e41('0x32')]=_[_0x7e41('0x30')](_0x1eaaff[_0x7e41('0x2f')],qs[_0x7e41('0x31')](_0x25729d[_0x7e41('0x2c')][_0x7e41('0x31')]));_0x3eea66[_0x7e41('0x32')]=_0x3eea66[_0x7e41('0x32')][_0x7e41('0x33')]?_0x3eea66[_0x7e41('0x32')]:_0x1eaaff[_0x7e41('0x2f')];if(_0x25729d[_0x7e41('0x2c')][_0x7e41('0x3c')]){_0x3eea66[_0x7e41('0x41')]=[{'all':!![]}];}_0x3eea66=_[_0x7e41('0x39')]({},_0x3eea66,_0x25729d['options']);return db[_0x7e41('0x27')]['find'](_0x3eea66)[_0x7e41('0x21')](handleEntityNotFound(_0x53f9a5,null))[_0x7e41('0x21')](respondWithResult(_0x53f9a5,null))[_0x7e41('0x3e')](handleError(_0x53f9a5,null));};exports[_0x7e41('0x42')]=function(_0x44a2cf,_0x4243e4){return db[_0x7e41('0x27')]['create'](_0x44a2cf['body'],{})[_0x7e41('0x21')](respondWithResult(_0x4243e4,0xc9))[_0x7e41('0x3e')](handleError(_0x4243e4,null));};exports[_0x7e41('0x1f')]=function(_0x19878e,_0x322497){if(_0x19878e[_0x7e41('0x43')]['id']){delete _0x19878e[_0x7e41('0x43')]['id'];}return db['Automation'][_0x7e41('0x44')]({'where':{'id':_0x19878e['params']['id']}})['then'](handleEntityNotFound(_0x322497,null))[_0x7e41('0x21')](saveUpdates(_0x19878e[_0x7e41('0x43')],null))['then'](respondWithResult(_0x322497,null))[_0x7e41('0x3e')](handleError(_0x322497,null));};exports['destroy']=function(_0x11a3d7,_0x54f15a){return db[_0x7e41('0x27')][_0x7e41('0x44')]({'where':{'id':_0x11a3d7[_0x7e41('0x45')]['id']}})[_0x7e41('0x21')](handleEntityNotFound(_0x54f15a,null))[_0x7e41('0x21')](removeEntity(_0x54f15a,null))[_0x7e41('0x3e')](handleError(_0x54f15a,null));};exports[_0x7e41('0x46')]=function(_0x24338b,_0x972eaf,_0x3f971c){return db['Condition'][_0x7e41('0x44')]({'where':{'id':_0x24338b[_0x7e41('0x45')]['id']}})['then'](handleEntityNotFound(_0x972eaf,null))[_0x7e41('0x21')](function(_0x54b8bf){if(_0x54b8bf){return _0x54b8bf[_0x7e41('0x46')](_0x24338b[_0x7e41('0x43')][_0x7e41('0x47')],_[_0x7e41('0x48')](_0x24338b[_0x7e41('0x43')],[_0x7e41('0x47'),'id'])||{});}})[_0x7e41('0x21')](respondWithResult(_0x972eaf,null))['catch'](handleError(_0x972eaf,null));};exports[_0x7e41('0x49')]=function(_0x3457a6,_0x59871b,_0x1b1675){var _0x2c1f3d={};var _0x5016c2={};var _0x24d64c;var _0x39155c;return db[_0x7e41('0x27')]['findOne']({'where':{'id':_0x3457a6['params']['id']}})['then'](handleEntityNotFound(_0x59871b,null))['then'](function(_0x42c872){if(_0x42c872){_0x24d64c=_0x42c872;_0x5016c2[_0x7e41('0x2f')]=_['keys'](db['Condition']['rawAttributes']);_0x5016c2[_0x7e41('0x2c')]=_[_0x7e41('0x2d')](_0x3457a6['query']);_0x5016c2[_0x7e41('0x2e')]=_[_0x7e41('0x30')](_0x5016c2['model'],_0x5016c2['query']);_0x2c1f3d[_0x7e41('0x32')]=_[_0x7e41('0x30')](_0x5016c2[_0x7e41('0x2f')],qs[_0x7e41('0x31')](_0x3457a6[_0x7e41('0x2c')][_0x7e41('0x31')]));_0x2c1f3d[_0x7e41('0x32')]=_0x2c1f3d[_0x7e41('0x32')][_0x7e41('0x33')]?_0x2c1f3d['attributes']:_0x5016c2[_0x7e41('0x2f')];_0x2c1f3d[_0x7e41('0x4a')]=qs['sort'](_0x3457a6[_0x7e41('0x2c')][_0x7e41('0x36')]);_0x2c1f3d['where']=qs['filters'](_[_0x7e41('0x4b')](_0x3457a6[_0x7e41('0x2c')],_0x5016c2[_0x7e41('0x2e')]));if(_0x3457a6[_0x7e41('0x2c')]['filter']){_0x2c1f3d[_0x7e41('0x37')]=_['merge'](_0x2c1f3d[_0x7e41('0x37')],{'$or':_['map'](_0x2c1f3d[_0x7e41('0x32')],function(_0x221677){var _0x515d14={};_0x515d14[_0x221677]={'$like':'%'+_0x3457a6[_0x7e41('0x2c')]['filter']+'%'};return _0x515d14;})});}_0x2c1f3d=_[_0x7e41('0x39')]({},_0x2c1f3d,_0x3457a6[_0x7e41('0x3a')]);return _0x24d64c[_0x7e41('0x49')](_0x2c1f3d);}})[_0x7e41('0x21')](function(_0x5eb1e4){if(_0x5eb1e4){_0x39155c=_0x5eb1e4[_0x7e41('0x33')];if(!_0x3457a6[_0x7e41('0x2c')]['hasOwnProperty'](_0x7e41('0x35'))){_0x2c1f3d['limit']=qs['limit'](_0x3457a6['query'][_0x7e41('0x1a')]);_0x2c1f3d[_0x7e41('0x1b')]=qs[_0x7e41('0x1b')](_0x3457a6[_0x7e41('0x2c')][_0x7e41('0x1b')]);}return _0x24d64c[_0x7e41('0x49')](_0x2c1f3d);}})[_0x7e41('0x21')](function(_0x15a3bd){if(_0x15a3bd){return _0x15a3bd?{'count':_0x39155c,'rows':_0x15a3bd}:null;}})[_0x7e41('0x21')](respondWithResult(_0x59871b,null))[_0x7e41('0x3e')](handleError(_0x59871b,null));};exports[_0x7e41('0x4c')]=function(_0x1b9392,_0x5ba612,_0x52f1f6){return db[_0x7e41('0x4d')][_0x7e41('0x44')]({'where':{'id':_0x1b9392['params']['id']}})[_0x7e41('0x21')](handleEntityNotFound(_0x5ba612,null))[_0x7e41('0x21')](function(_0x522e8f){if(_0x522e8f){return _0x522e8f[_0x7e41('0x4c')](_0x1b9392[_0x7e41('0x43')][_0x7e41('0x47')],_[_0x7e41('0x48')](_0x1b9392[_0x7e41('0x43')],[_0x7e41('0x47'),'id'])||{});}})[_0x7e41('0x21')](respondWithResult(_0x5ba612,null))['catch'](handleError(_0x5ba612,null));};exports['getActions']=function(_0x13f61d,_0x285266,_0x3a9d33){var _0x31f35a={};var _0x288e08={};var _0x2fe30b;var _0x3a9f56;return db[_0x7e41('0x27')]['findOne']({'where':{'id':_0x13f61d[_0x7e41('0x45')]['id']}})[_0x7e41('0x21')](handleEntityNotFound(_0x285266,null))[_0x7e41('0x21')](function(_0x55dbbc){if(_0x55dbbc){_0x2fe30b=_0x55dbbc;_0x288e08[_0x7e41('0x2f')]=_[_0x7e41('0x2d')](db[_0x7e41('0x4d')]['rawAttributes']);_0x288e08[_0x7e41('0x2c')]=_[_0x7e41('0x2d')](_0x13f61d[_0x7e41('0x2c')]);_0x288e08[_0x7e41('0x2e')]=_[_0x7e41('0x30')](_0x288e08['model'],_0x288e08[_0x7e41('0x2c')]);_0x31f35a['attributes']=_[_0x7e41('0x30')](_0x288e08[_0x7e41('0x2f')],qs['fields'](_0x13f61d[_0x7e41('0x2c')][_0x7e41('0x31')]));_0x31f35a[_0x7e41('0x32')]=_0x31f35a[_0x7e41('0x32')]['length']?_0x31f35a[_0x7e41('0x32')]:_0x288e08[_0x7e41('0x2f')];_0x31f35a['order']=qs[_0x7e41('0x36')](_0x13f61d[_0x7e41('0x2c')][_0x7e41('0x36')]);_0x31f35a['where']=qs[_0x7e41('0x2e')](_[_0x7e41('0x4b')](_0x13f61d['query'],_0x288e08[_0x7e41('0x2e')]));if(_0x13f61d[_0x7e41('0x2c')]['filter']){_0x31f35a[_0x7e41('0x37')]=_['merge'](_0x31f35a['where'],{'$or':_[_0x7e41('0x26')](_0x31f35a[_0x7e41('0x32')],function(_0x3886a3){var _0x23d62f={};_0x23d62f[_0x3886a3]={'$like':'%'+_0x13f61d['query'][_0x7e41('0x38')]+'%'};return _0x23d62f;})});}_0x31f35a=_['merge']({},_0x31f35a,_0x13f61d[_0x7e41('0x3a')]);return _0x2fe30b[_0x7e41('0x4e')](_0x31f35a);}})[_0x7e41('0x21')](function(_0x47045e){if(_0x47045e){_0x3a9f56=_0x47045e[_0x7e41('0x33')];if(!_0x13f61d[_0x7e41('0x2c')][_0x7e41('0x34')](_0x7e41('0x35'))){_0x31f35a[_0x7e41('0x1a')]=qs[_0x7e41('0x1a')](_0x13f61d['query'][_0x7e41('0x1a')]);_0x31f35a[_0x7e41('0x1b')]=qs[_0x7e41('0x1b')](_0x13f61d[_0x7e41('0x2c')][_0x7e41('0x1b')]);}return _0x2fe30b[_0x7e41('0x4e')](_0x31f35a);}})[_0x7e41('0x21')](function(_0x6bac9){if(_0x6bac9){return _0x6bac9?{'count':_0x3a9f56,'rows':_0x6bac9}:null;}})[_0x7e41('0x21')](respondWithResult(_0x285266,null))['catch'](handleError(_0x285266,null));}; \ No newline at end of file +var _0x7a89=['Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Automation','includeAll','include','show','params','find','catch','create','body','destroy','Condition','addConditions','ids','omit','getConditions','findOne','hasOwnProperty','addActions'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x7a89,0x104));var _0x97a8=function(_0x15ec78,_0x1e3a18){_0x15ec78=_0x15ec78-0x0;var _0x191f90=_0x7a89[_0x15ec78];return _0x191f90;};'use strict';var emlformat=require(_0x97a8('0x0'));var rimraf=require(_0x97a8('0x1'));var zipdir=require(_0x97a8('0x2'));var jsonpatch=require(_0x97a8('0x3'));var rp=require(_0x97a8('0x4'));var moment=require(_0x97a8('0x5'));var BPromise=require(_0x97a8('0x6'));var Mustache=require(_0x97a8('0x7'));var util=require(_0x97a8('0x8'));var path=require('path');var sox=require(_0x97a8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a8('0xa'));var _=require('lodash');var squel=require(_0x97a8('0xb'));var crypto=require(_0x97a8('0xc'));var jsforce=require(_0x97a8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97a8('0xe'));var querystring=require(_0x97a8('0xf'));var Papa=require(_0x97a8('0x10'));var Redis=require(_0x97a8('0x11'));var authService=require(_0x97a8('0x12'));var qs=require(_0x97a8('0x13'));var as=require(_0x97a8('0x14'));var hardwareService=require(_0x97a8('0x15'));var logger=require(_0x97a8('0x16'))(_0x97a8('0x17'));var utils=require(_0x97a8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x97a8('0x19'))['db'];function respondWithStatusCode(_0x457aef,_0x21bb48){_0x21bb48=_0x21bb48||0xcc;return function(_0x27b945){if(_0x27b945){return _0x457aef[_0x97a8('0x1a')](_0x21bb48);}return _0x457aef['status'](_0x21bb48)['end']();};}function respondWithResult(_0x135c19,_0x37d687){_0x37d687=_0x37d687||0xc8;return function(_0x286609){if(_0x286609){return _0x135c19[_0x97a8('0x1b')](_0x37d687)[_0x97a8('0x1c')](_0x286609);}};}function respondWithFilteredResult(_0x40c8a9,_0x43c061){return function(_0x14199d){if(_0x14199d){var _0x2ecdb8=typeof _0x43c061[_0x97a8('0x1d')]===_0x97a8('0x1e')&&typeof _0x43c061['limit']===_0x97a8('0x1e');var _0x8820bf=_0x14199d[_0x97a8('0x1f')];var _0x2e87a9=_0x2ecdb8?0x0:_0x43c061[_0x97a8('0x1d')];var _0x47127c=_0x2ecdb8?_0x14199d[_0x97a8('0x1f')]:_0x43c061[_0x97a8('0x1d')]+_0x43c061[_0x97a8('0x20')];var _0x55fe5e;if(_0x47127c>=_0x8820bf){_0x47127c=_0x8820bf;_0x55fe5e=0xc8;}else{_0x55fe5e=0xce;}_0x40c8a9[_0x97a8('0x1b')](_0x55fe5e);return _0x40c8a9['set'](_0x97a8('0x21'),_0x2e87a9+'-'+_0x47127c+'/'+_0x8820bf)[_0x97a8('0x1c')](_0x14199d);}return null;};}function patchUpdates(_0x43ca2a){return function(_0x10b80d){try{jsonpatch[_0x97a8('0x22')](_0x10b80d,_0x43ca2a,!![]);}catch(_0x4666b0){return BPromise[_0x97a8('0x23')](_0x4666b0);}return _0x10b80d[_0x97a8('0x24')]();};}function saveUpdates(_0x40659d,_0x370950){return function(_0x269f1b){if(_0x269f1b){return _0x269f1b[_0x97a8('0x25')](_0x40659d)[_0x97a8('0x26')](function(_0x56ace7){return _0x56ace7;});}return null;};}function removeEntity(_0x4439c0,_0x5a81c6){return function(_0x291df7){if(_0x291df7){return _0x291df7['destroy']()[_0x97a8('0x26')](function(){_0x4439c0[_0x97a8('0x1b')](0xcc)[_0x97a8('0x27')]();});}};}function handleEntityNotFound(_0x400c2a,_0x1532ad){return function(_0x41512d){if(!_0x41512d){_0x400c2a[_0x97a8('0x1a')](0x194);}return _0x41512d;};}function handleError(_0x516c17,_0x1e3697){_0x1e3697=_0x1e3697||0x1f4;return function(_0x461136){logger[_0x97a8('0x28')](_0x461136[_0x97a8('0x29')]);if(_0x461136[_0x97a8('0x2a')]){delete _0x461136[_0x97a8('0x2a')];}_0x516c17[_0x97a8('0x1b')](_0x1e3697)[_0x97a8('0x2b')](_0x461136);};}exports[_0x97a8('0x2c')]=function(_0x223131,_0x2dc307){var _0x58df78={},_0x4d0217={},_0xf70eef={'count':0x0,'rows':[]};var _0x5c0803=_['map'](db['Automation'][_0x97a8('0x2d')],function(_0x5ba2fd){return{'name':_0x5ba2fd[_0x97a8('0x2e')],'type':_0x5ba2fd[_0x97a8('0x2f')]['key']};});_0x4d0217[_0x97a8('0x30')]=_[_0x97a8('0x31')](_0x5c0803,_0x97a8('0x2a'));_0x4d0217[_0x97a8('0x32')]=_[_0x97a8('0x33')](_0x223131[_0x97a8('0x32')]);_0x4d0217[_0x97a8('0x34')]=_[_0x97a8('0x35')](_0x4d0217[_0x97a8('0x30')],_0x4d0217[_0x97a8('0x32')]);_0x58df78[_0x97a8('0x36')]=_['intersection'](_0x4d0217[_0x97a8('0x30')],qs[_0x97a8('0x37')](_0x223131[_0x97a8('0x32')]['fields']));_0x58df78[_0x97a8('0x36')]=_0x58df78[_0x97a8('0x36')][_0x97a8('0x38')]?_0x58df78[_0x97a8('0x36')]:_0x4d0217[_0x97a8('0x30')];if(!_0x223131[_0x97a8('0x32')]['hasOwnProperty'](_0x97a8('0x39'))){_0x58df78[_0x97a8('0x20')]=qs[_0x97a8('0x20')](_0x223131[_0x97a8('0x32')]['limit']);_0x58df78['offset']=qs[_0x97a8('0x1d')](_0x223131[_0x97a8('0x32')][_0x97a8('0x1d')]);}_0x58df78[_0x97a8('0x3a')]=qs['sort'](_0x223131[_0x97a8('0x32')][_0x97a8('0x3b')]);_0x58df78[_0x97a8('0x3c')]=qs[_0x97a8('0x34')](_[_0x97a8('0x3d')](_0x223131[_0x97a8('0x32')],_0x4d0217['filters']),_0x5c0803);if(_0x223131[_0x97a8('0x32')]['filter']){_0x58df78[_0x97a8('0x3c')]=_[_0x97a8('0x3e')](_0x58df78[_0x97a8('0x3c')],{'$or':_[_0x97a8('0x31')](_0x5c0803,function(_0x409c29){if(_0x409c29[_0x97a8('0x2f')]!==_0x97a8('0x3f')){var _0x8ad478={};_0x8ad478[_0x409c29[_0x97a8('0x2a')]]={'$like':'%'+_0x223131[_0x97a8('0x32')][_0x97a8('0x40')]+'%'};return _0x8ad478;}})});}_0x58df78=_['merge']({},_0x58df78,_0x223131[_0x97a8('0x41')]);var _0x2214fd={'where':_0x58df78[_0x97a8('0x3c')]};return db[_0x97a8('0x42')][_0x97a8('0x1f')](_0x2214fd)['then'](function(_0x4a95e2){_0xf70eef[_0x97a8('0x1f')]=_0x4a95e2;if(_0x223131[_0x97a8('0x32')][_0x97a8('0x43')]){_0x58df78[_0x97a8('0x44')]=[{'all':!![]}];}return db[_0x97a8('0x42')]['findAll'](_0x58df78);})[_0x97a8('0x26')](function(_0x85562e){_0xf70eef['rows']=_0x85562e;return _0xf70eef;})[_0x97a8('0x26')](respondWithFilteredResult(_0x2dc307,_0x58df78))['catch'](handleError(_0x2dc307,null));};exports[_0x97a8('0x45')]=function(_0x4d3b76,_0x5e52ff){var _0x140f37={'raw':![],'where':{'id':_0x4d3b76[_0x97a8('0x46')]['id']}},_0x1343e2={};_0x1343e2[_0x97a8('0x30')]=_['keys'](db[_0x97a8('0x42')][_0x97a8('0x2d')]);_0x1343e2[_0x97a8('0x32')]=_[_0x97a8('0x33')](_0x4d3b76['query']);_0x1343e2[_0x97a8('0x34')]=_[_0x97a8('0x35')](_0x1343e2[_0x97a8('0x30')],_0x1343e2[_0x97a8('0x32')]);_0x140f37[_0x97a8('0x36')]=_[_0x97a8('0x35')](_0x1343e2[_0x97a8('0x30')],qs['fields'](_0x4d3b76[_0x97a8('0x32')][_0x97a8('0x37')]));_0x140f37['attributes']=_0x140f37[_0x97a8('0x36')][_0x97a8('0x38')]?_0x140f37[_0x97a8('0x36')]:_0x1343e2[_0x97a8('0x30')];if(_0x4d3b76[_0x97a8('0x32')][_0x97a8('0x43')]){_0x140f37[_0x97a8('0x44')]=[{'all':!![]}];}_0x140f37=_['merge']({},_0x140f37,_0x4d3b76[_0x97a8('0x41')]);return db[_0x97a8('0x42')][_0x97a8('0x47')](_0x140f37)[_0x97a8('0x26')](handleEntityNotFound(_0x5e52ff,null))[_0x97a8('0x26')](respondWithResult(_0x5e52ff,null))[_0x97a8('0x48')](handleError(_0x5e52ff,null));};exports[_0x97a8('0x49')]=function(_0x311ffb,_0x58b054){return db[_0x97a8('0x42')][_0x97a8('0x49')](_0x311ffb[_0x97a8('0x4a')],{})[_0x97a8('0x26')](respondWithResult(_0x58b054,0xc9))['catch'](handleError(_0x58b054,null));};exports[_0x97a8('0x25')]=function(_0x3caada,_0x505931){if(_0x3caada[_0x97a8('0x4a')]['id']){delete _0x3caada[_0x97a8('0x4a')]['id'];}return db[_0x97a8('0x42')][_0x97a8('0x47')]({'where':{'id':_0x3caada[_0x97a8('0x46')]['id']}})[_0x97a8('0x26')](handleEntityNotFound(_0x505931,null))['then'](saveUpdates(_0x3caada[_0x97a8('0x4a')],null))['then'](respondWithResult(_0x505931,null))['catch'](handleError(_0x505931,null));};exports[_0x97a8('0x4b')]=function(_0x3cecc5,_0xc9d98b){return db[_0x97a8('0x42')]['find']({'where':{'id':_0x3cecc5[_0x97a8('0x46')]['id']}})[_0x97a8('0x26')](handleEntityNotFound(_0xc9d98b,null))['then'](removeEntity(_0xc9d98b,null))[_0x97a8('0x48')](handleError(_0xc9d98b,null));};exports['addConditions']=function(_0x384b6c,_0xe8fcd6,_0x15b3be){return db[_0x97a8('0x4c')][_0x97a8('0x47')]({'where':{'id':_0x384b6c['params']['id']}})[_0x97a8('0x26')](handleEntityNotFound(_0xe8fcd6,null))[_0x97a8('0x26')](function(_0x2a2e59){if(_0x2a2e59){return _0x2a2e59[_0x97a8('0x4d')](_0x384b6c['body'][_0x97a8('0x4e')],_[_0x97a8('0x4f')](_0x384b6c[_0x97a8('0x4a')],[_0x97a8('0x4e'),'id'])||{});}})[_0x97a8('0x26')](respondWithResult(_0xe8fcd6,null))['catch'](handleError(_0xe8fcd6,null));};exports[_0x97a8('0x50')]=function(_0x2cfa07,_0xa79baa,_0x54fe93){var _0xcaea47={};var _0x2b40c0={};var _0x496f52;var _0x337ec6;return db['Automation'][_0x97a8('0x51')]({'where':{'id':_0x2cfa07[_0x97a8('0x46')]['id']}})['then'](handleEntityNotFound(_0xa79baa,null))[_0x97a8('0x26')](function(_0x33b2db){if(_0x33b2db){_0x496f52=_0x33b2db;_0x2b40c0[_0x97a8('0x30')]=_['keys'](db['Condition']['rawAttributes']);_0x2b40c0[_0x97a8('0x32')]=_['keys'](_0x2cfa07[_0x97a8('0x32')]);_0x2b40c0[_0x97a8('0x34')]=_[_0x97a8('0x35')](_0x2b40c0[_0x97a8('0x30')],_0x2b40c0[_0x97a8('0x32')]);_0xcaea47[_0x97a8('0x36')]=_[_0x97a8('0x35')](_0x2b40c0[_0x97a8('0x30')],qs[_0x97a8('0x37')](_0x2cfa07['query'][_0x97a8('0x37')]));_0xcaea47[_0x97a8('0x36')]=_0xcaea47[_0x97a8('0x36')][_0x97a8('0x38')]?_0xcaea47['attributes']:_0x2b40c0[_0x97a8('0x30')];_0xcaea47[_0x97a8('0x3a')]=qs[_0x97a8('0x3b')](_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x3b')]);_0xcaea47[_0x97a8('0x3c')]=qs['filters'](_[_0x97a8('0x3d')](_0x2cfa07['query'],_0x2b40c0[_0x97a8('0x34')]));if(_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x40')]){_0xcaea47['where']=_[_0x97a8('0x3e')](_0xcaea47[_0x97a8('0x3c')],{'$or':_[_0x97a8('0x31')](_0xcaea47[_0x97a8('0x36')],function(_0x560b1b){var _0x2be4b7={};_0x2be4b7[_0x560b1b]={'$like':'%'+_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x40')]+'%'};return _0x2be4b7;})});}_0xcaea47=_['merge']({},_0xcaea47,_0x2cfa07[_0x97a8('0x41')]);return _0x496f52[_0x97a8('0x50')](_0xcaea47);}})[_0x97a8('0x26')](function(_0x14bd7e){if(_0x14bd7e){_0x337ec6=_0x14bd7e[_0x97a8('0x38')];if(!_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x52')](_0x97a8('0x39'))){_0xcaea47[_0x97a8('0x20')]=qs[_0x97a8('0x20')](_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x20')]);_0xcaea47['offset']=qs[_0x97a8('0x1d')](_0x2cfa07['query'][_0x97a8('0x1d')]);}return _0x496f52[_0x97a8('0x50')](_0xcaea47);}})[_0x97a8('0x26')](function(_0x15d80f){if(_0x15d80f){return _0x15d80f?{'count':_0x337ec6,'rows':_0x15d80f}:null;}})[_0x97a8('0x26')](respondWithResult(_0xa79baa,null))['catch'](handleError(_0xa79baa,null));};exports[_0x97a8('0x53')]=function(_0x4b53d4,_0x51b6eb,_0x207a1f){return db[_0x97a8('0x54')][_0x97a8('0x47')]({'where':{'id':_0x4b53d4[_0x97a8('0x46')]['id']}})['then'](handleEntityNotFound(_0x51b6eb,null))[_0x97a8('0x26')](function(_0x44f0b2){if(_0x44f0b2){return _0x44f0b2['addActions'](_0x4b53d4[_0x97a8('0x4a')][_0x97a8('0x4e')],_[_0x97a8('0x4f')](_0x4b53d4[_0x97a8('0x4a')],[_0x97a8('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x51b6eb,null))[_0x97a8('0x48')](handleError(_0x51b6eb,null));};exports['getActions']=function(_0x172034,_0x55857e,_0x159459){var _0xc5e309={};var _0x368a9d={};var _0x5c1c9d;var _0x50622e;return db[_0x97a8('0x42')][_0x97a8('0x51')]({'where':{'id':_0x172034[_0x97a8('0x46')]['id']}})[_0x97a8('0x26')](handleEntityNotFound(_0x55857e,null))[_0x97a8('0x26')](function(_0x74a5a7){if(_0x74a5a7){_0x5c1c9d=_0x74a5a7;_0x368a9d['model']=_[_0x97a8('0x33')](db['Action'][_0x97a8('0x2d')]);_0x368a9d[_0x97a8('0x32')]=_[_0x97a8('0x33')](_0x172034[_0x97a8('0x32')]);_0x368a9d['filters']=_[_0x97a8('0x35')](_0x368a9d['model'],_0x368a9d['query']);_0xc5e309[_0x97a8('0x36')]=_[_0x97a8('0x35')](_0x368a9d['model'],qs['fields'](_0x172034[_0x97a8('0x32')]['fields']));_0xc5e309['attributes']=_0xc5e309[_0x97a8('0x36')][_0x97a8('0x38')]?_0xc5e309['attributes']:_0x368a9d[_0x97a8('0x30')];_0xc5e309['order']=qs['sort'](_0x172034[_0x97a8('0x32')][_0x97a8('0x3b')]);_0xc5e309[_0x97a8('0x3c')]=qs['filters'](_[_0x97a8('0x3d')](_0x172034[_0x97a8('0x32')],_0x368a9d[_0x97a8('0x34')]));if(_0x172034[_0x97a8('0x32')][_0x97a8('0x40')]){_0xc5e309[_0x97a8('0x3c')]=_[_0x97a8('0x3e')](_0xc5e309[_0x97a8('0x3c')],{'$or':_[_0x97a8('0x31')](_0xc5e309[_0x97a8('0x36')],function(_0x204efa){var _0x290f86={};_0x290f86[_0x204efa]={'$like':'%'+_0x172034[_0x97a8('0x32')][_0x97a8('0x40')]+'%'};return _0x290f86;})});}_0xc5e309=_[_0x97a8('0x3e')]({},_0xc5e309,_0x172034[_0x97a8('0x41')]);return _0x5c1c9d[_0x97a8('0x55')](_0xc5e309);}})[_0x97a8('0x26')](function(_0x35c79b){if(_0x35c79b){_0x50622e=_0x35c79b[_0x97a8('0x38')];if(!_0x172034[_0x97a8('0x32')][_0x97a8('0x52')](_0x97a8('0x39'))){_0xc5e309[_0x97a8('0x20')]=qs[_0x97a8('0x20')](_0x172034[_0x97a8('0x32')]['limit']);_0xc5e309[_0x97a8('0x1d')]=qs[_0x97a8('0x1d')](_0x172034['query']['offset']);}return _0x5c1c9d[_0x97a8('0x55')](_0xc5e309);}})[_0x97a8('0x26')](function(_0x5b55ba){if(_0x5b55ba){return _0x5b55ba?{'count':_0x50622e,'rows':_0x5b55ba}:null;}})[_0x97a8('0x26')](respondWithResult(_0x55857e,null))[_0x97a8('0x48')](handleError(_0x55857e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 82af16f..dfcd005 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 _0x292c=['./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','path','rimraf','../../config/environment'];(function(_0x50d3e0,_0x15a289){var _0x2ba9d1=function(_0x35344c){while(--_0x35344c){_0x50d3e0['push'](_0x50d3e0['shift']());}};_0x2ba9d1(++_0x15a289);}(_0x292c,0x19f));var _0xc292=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x292c[_0x45346d];return _0x5ce7ca;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var logger=require(_0xc292('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc292('0x2'));var rimraf=require(_0xc292('0x3'));var config=require(_0xc292('0x4'));var attributes=require(_0xc292('0x5'));module[_0xc292('0x6')]=function(_0x125c9f,_0x14417a){return _0x125c9f[_0xc292('0x7')](_0xc292('0x8'),attributes,{'tableName':_0xc292('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0926=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash'];(function(_0x1b56a8,_0x139cf0){var _0x5b2289=function(_0x48f2d4){while(--_0x48f2d4){_0x1b56a8['push'](_0x1b56a8['shift']());}};_0x5b2289(++_0x139cf0);}(_0x0926,0x1b1));var _0x6092=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0x0926[_0x38af48];return _0x445384;};'use strict';var _=require(_0x6092('0x0'));var util=require(_0x6092('0x1'));var logger=require(_0x6092('0x2'))(_0x6092('0x3'));var moment=require(_0x6092('0x4'));var BPromise=require(_0x6092('0x5'));var rp=require(_0x6092('0x6'));var fs=require('fs');var path=require(_0x6092('0x7'));var rimraf=require(_0x6092('0x8'));var config=require(_0x6092('0x9'));var attributes=require('./automation.attributes');module[_0x6092('0xa')]=function(_0x33bef1,_0x11cc23){return _0x33bef1[_0x6092('0xb')](_0x6092('0xc'),attributes,{'tableName':_0x6092('0xd'),'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 914348e..2468377 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 _0x48ac=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis'];(function(_0x11725e,_0x5c97da){var _0xb8cd4d=function(_0x3866d0){while(--_0x3866d0){_0x11725e['push'](_0x11725e['shift']());}};_0xb8cd4d(++_0x5c97da);}(_0x48ac,0xe0));var _0xc48a=function(_0x4486f4,_0x175d78){_0x4486f4=_0x4486f4-0x0;var _0x2d82c5=_0x48ac[_0x4486f4];return _0x2d82c5;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var moment=require('moment');var BPromise=require(_0xc48a('0x1'));var rs=require(_0xc48a('0x2'));var fs=require('fs');var Redis=require(_0xc48a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc48a('0x4'));var logger=require(_0xc48a('0x5'))(_0xc48a('0x6'));var config=require(_0xc48a('0x7'));var jayson=require(_0xc48a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5df462,_0x5cffd4,_0x1e1e1a){return new BPromise(function(_0xf0c31b,_0x2c3285){return client['request'](_0x5df462,_0x1e1e1a)[_0xc48a('0x9')](function(_0x43461a){logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,_0xc48a('0xc'));logger[_0xc48a('0xd')](_0xc48a('0xe'),_0x5cffd4,_0xc48a('0xc'),JSON[_0xc48a('0xf')](_0x43461a));if(_0x43461a[_0xc48a('0x10')]){if(_0x43461a[_0xc48a('0x10')]['code']===0x1f4){logger[_0xc48a('0x10')](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')]['message']);return _0x2c3285(_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);}logger['error'](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);return _0xf0c31b(_0x43461a['error'][_0xc48a('0x11')]);}else{logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,'request\x20sent');_0xf0c31b(_0x43461a[_0xc48a('0x12')][_0xc48a('0x11')]);}})['catch'](function(_0x5c319b){logger[_0xc48a('0x10')]('Automation,\x20%s,\x20%s',_0x5cffd4,_0x5c319b);_0x2c3285(_0x5c319b);});});} \ No newline at end of file +var _0x9ab8=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0x9ab8,0x81));var _0x89ab=function(_0x54b800,_0x36bb53){_0x54b800=_0x54b800-0x0;var _0x541239=_0x9ab8[_0x54b800];return _0x541239;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a984,_0x3ecaa0,_0x366c32){return new BPromise(function(_0x5fd99f,_0x42da87){return client[_0x89ab('0xa')](_0x29a984,_0x366c32)[_0x89ab('0xb')](function(_0x36dc63){logger['info']('Automation,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3ecaa0,_0x89ab('0xc'),JSON[_0x89ab('0xd')](_0x36dc63));if(_0x36dc63[_0x89ab('0xe')]){if(_0x36dc63[_0x89ab('0xe')][_0x89ab('0xf')]===0x1f4){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x42da87(_0x36dc63[_0x89ab('0xe')][_0x89ab('0x11')]);}logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x5fd99f(_0x36dc63[_0x89ab('0xe')]['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');_0x5fd99f(_0x36dc63['result']['message']);}})[_0x89ab('0x12')](function(_0x1ce918){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x1ce918);_0x42da87(_0x1ce918);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0c91636..89d0740 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 _0xc5e6=['post','addActions','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','create'];(function(_0x1526cd,_0xf3ea74){var _0x195505=function(_0x726bd){while(--_0x726bd){_0x1526cd['push'](_0x1526cd['shift']());}};_0x195505(++_0xf3ea74);}(_0xc5e6,0x83));var _0x6c5e=function(_0x8c64d9,_0x45535c){_0x8c64d9=_0x8c64d9-0x0;var _0x22b21e=_0xc5e6[_0x8c64d9];return _0x22b21e;};'use strict';var multer=require(_0x6c5e('0x0'));var util=require(_0x6c5e('0x1'));var path=require(_0x6c5e('0x2'));var timeout=require(_0x6c5e('0x3'));var express=require(_0x6c5e('0x4'));var router=express[_0x6c5e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6c5e('0x6'));var config=require(_0x6c5e('0x7'));var controller=require(_0x6c5e('0x8'));router[_0x6c5e('0x9')]('/',auth['isAuthenticated'](),controller[_0x6c5e('0xa')]);router[_0x6c5e('0x9')](_0x6c5e('0xb'),auth[_0x6c5e('0xc')](),controller[_0x6c5e('0xd')]);router['get'](_0x6c5e('0xe'),auth[_0x6c5e('0xc')](),controller[_0x6c5e('0xf')]);router[_0x6c5e('0x9')](_0x6c5e('0x10'),auth['isAuthenticated'](),controller[_0x6c5e('0x11')]);router['post']('/',auth[_0x6c5e('0xc')](),controller[_0x6c5e('0x12')]);router['post'](_0x6c5e('0xe'),auth[_0x6c5e('0xc')](),controller['addConditions']);router[_0x6c5e('0x13')](_0x6c5e('0x10'),auth[_0x6c5e('0xc')](),controller[_0x6c5e('0x14')]);router['put'](_0x6c5e('0xb'),auth['isAuthenticated'](),controller[_0x6c5e('0x15')]);router[_0x6c5e('0x16')]('/:id',auth[_0x6c5e('0xc')](),controller[_0x6c5e('0x17')]);module[_0x6c5e('0x18')]=router; \ No newline at end of file +var _0xb647=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post','addConditions','put','update'];(function(_0x6fe240,_0x1827a6){var _0x2fc18b=function(_0x3111a3){while(--_0x3111a3){_0x6fe240['push'](_0x6fe240['shift']());}};_0x2fc18b(++_0x1827a6);}(_0xb647,0xdb));var _0x7b64=function(_0x17c95e,_0x1348c2){_0x17c95e=_0x17c95e-0x0;var _0x47d54c=_0xb647[_0x17c95e];return _0x47d54c;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var fs_extra=require(_0x7b64('0x6'));var auth=require(_0x7b64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b64('0x8'));var controller=require('./automation.controller');router[_0x7b64('0x9')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0xb')]);router[_0x7b64('0x9')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0xd')]);router[_0x7b64('0x9')](_0x7b64('0xe'),auth['isAuthenticated'](),controller[_0x7b64('0xf')]);router['get'](_0x7b64('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0x7b64('0x11')]('/',auth[_0x7b64('0xa')](),controller['create']);router[_0x7b64('0x11')](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x12')]);router[_0x7b64('0x11')](_0x7b64('0x10'),auth[_0x7b64('0xa')](),controller['addActions']);router[_0x7b64('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7b64('0x14')]);router[_0x7b64('0x15')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x16')]);module[_0x7b64('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index de6fcd9..5ebd46b 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 _0xd3a2=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0xd3a2,0x7c));var _0x2d3a=function(_0x4d86ee,_0xc48f04){_0x4d86ee=_0x4d86ee-0x0;var _0x4df757=_0xd3a2[_0x4d86ee];return _0x4df757;};'use strict';var Sequelize=require('sequelize');module[_0x2d3a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2d3a('0x1')]('ivr'),'allowNull':![],'defaultValue':_0x2d3a('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2d3a('0x3')},'limitCalls':{'type':Sequelize[_0x2d3a('0x4')](0x4)[_0x2d3a('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2d3a('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2d3a('0x7')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2d3a('0x4')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2d3a('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2d3a('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2d3a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2d3a('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x2d3a('0x4')](0x3)[_0x2d3a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2d3a('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2d3a('0x4')](0x5)[_0x2d3a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2d3a('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2d3a('0x4')](0x3)[_0x2d3a('0x5')],'defaultValue':0x3,'comment':_0x2d3a('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2d3a('0x4')](0x5)[_0x2d3a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2d3a('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2d3a('0xe')},'dialTimezone':{'type':Sequelize[_0x2d3a('0x7')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2d3a('0x7')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x2d3a('0xf'),_0x2d3a('0x10'),_0x2d3a('0x11')),'defaultValue':_0x2d3a('0xf')},'dialAMDActive':{'type':Sequelize[_0x2d3a('0x12')],'defaultValue':0x0,'comment':_0x2d3a('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x2d3a('0x4')](0x9)[_0x2d3a('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2d3a('0x4')](0x9)[_0x2d3a('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2d3a('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2d3a('0x4')](0x9)[_0x2d3a('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2d3a('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x2d3a('0x4')](0x9)[_0x2d3a('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2d3a('0x4')](0x9)[_0x2d3a('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2d3a('0x4')](0x9)[_0x2d3a('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2d3a('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x2d3a('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2d3a('0x4')](0x9)[_0x2d3a('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2d3a('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2d3a('0x1')](_0x2d3a('0x18'),'ASC'),'defaultValue':_0x2d3a('0x18')},'dialPrefix':{'type':Sequelize[_0x2d3a('0x7')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2d3a('0x19')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x2d3a('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2d3a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2d3a('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2d3a('0x4')](0x5)[_0x2d3a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2d3a('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x2d3a('0x4')](0x3)[_0x2d3a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x2d3a('0x4')](0x5)[_0x2d3a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2d3a('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2d3a('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2d3a('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2d3a('0x4')](0x5)[_0x2d3a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x2d3a('0x4')](0x3)[_0x2d3a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2d3a('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2d3a('0x4')](0x5)[_0x2d3a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2d3a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2d3a('0x1f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2d3a('0x4')](0x5)[_0x2d3a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2d3a('0x20')}}; \ No newline at end of file +var _0x2741=['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)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#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','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4952a0,_0x396813){var _0x301cfb=function(_0x797af1){while(--_0x797af1){_0x4952a0['push'](_0x4952a0['shift']());}};_0x301cfb(++_0x396813);}(_0x2741,0xef));var _0x1274=function(_0x41a3d3,_0x5ef4f6){_0x41a3d3=_0x41a3d3-0x0;var _0x1b581e=_0x2741[_0x41a3d3];return _0x1b581e;};'use strict';var Sequelize=require(_0x1274('0x0'));module[_0x1274('0x1')]={'name':{'type':Sequelize[_0x1274('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1274('0x3')](_0x1274('0x4')),'allowNull':![],'defaultValue':_0x1274('0x4')},'description':{'type':Sequelize[_0x1274('0x2')]},'active':{'type':Sequelize[_0x1274('0x5')],'defaultValue':0x0,'comment':_0x1274('0x6')},'limitCalls':{'type':Sequelize[_0x1274('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1274('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1274('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1274('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1274('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1274('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1274('0x3')](_0x1274('0x11'),_0x1274('0x12'),_0x1274('0x13')),'defaultValue':_0x1274('0x11')},'dialAMDActive':{'type':Sequelize[_0x1274('0x5')],'defaultValue':0x0,'comment':_0x1274('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1274('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1274('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1274('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1274('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1274('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1274('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1274('0x3')](_0x1274('0x1b'),'ASC'),'defaultValue':_0x1274('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1274('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1274('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index df3f9f7..ab64b46 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 _0x634f=['error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','params','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','ContactId','ListId','select','field','scheduledAt','CmListId','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','fromQuery','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy'];(function(_0x172d29,_0x2a70b4){var _0x17df2b=function(_0x151eb2){while(--_0x151eb2){_0x172d29['push'](_0x172d29['shift']());}};_0x17df2b(++_0x2a70b4);}(_0x634f,0x16a));var _0xf634=function(_0x3cf6bc,_0x2b16d9){_0x3cf6bc=_0x3cf6bc-0x0;var _0x3b7862=_0x634f[_0x3cf6bc];return _0x3b7862;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf634('0x0'));var zipdir=require(_0xf634('0x1'));var jsonpatch=require(_0xf634('0x2'));var rp=require(_0xf634('0x3'));var moment=require(_0xf634('0x4'));var BPromise=require(_0xf634('0x5'));var Mustache=require(_0xf634('0x6'));var util=require(_0xf634('0x7'));var path=require(_0xf634('0x8'));var sox=require(_0xf634('0x9'));var csv=require(_0xf634('0xa'));var ejs=require(_0xf634('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf634('0xc'));var squel=require(_0xf634('0xd'));var crypto=require(_0xf634('0xe'));var jsforce=require(_0xf634('0xf'));var deskjs=require(_0xf634('0x10'));var toCsv=require(_0xf634('0xa'));var querystring=require(_0xf634('0x11'));var Papa=require(_0xf634('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf634('0x13'));var logger=require(_0xf634('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf634('0x15'));var licenseUtil=require(_0xf634('0x16'));var db=require(_0xf634('0x17'))['db'];function respondWithStatusCode(_0x598366,_0x400910){_0x400910=_0x400910||0xcc;return function(_0x26a8e9){if(_0x26a8e9){return _0x598366[_0xf634('0x18')](_0x400910);}return _0x598366[_0xf634('0x19')](_0x400910)[_0xf634('0x1a')]();};}function respondWithResult(_0x31e163,_0x1157e7){_0x1157e7=_0x1157e7||0xc8;return function(_0x414576){if(_0x414576){return _0x31e163[_0xf634('0x19')](_0x1157e7)[_0xf634('0x1b')](_0x414576);}};}function respondWithFilteredResult(_0x1deb9f,_0x16a51d){return function(_0x36d1b2){if(_0x36d1b2){var _0x14be13=typeof _0x16a51d[_0xf634('0x1c')]===_0xf634('0x1d')&&typeof _0x16a51d[_0xf634('0x1e')]===_0xf634('0x1d');var _0x4a308e=_0x36d1b2['count'];var _0x5d7dec=_0x14be13?0x0:_0x16a51d['offset'];var _0x14c0cb=_0x14be13?_0x36d1b2[_0xf634('0x1f')]:_0x16a51d['offset']+_0x16a51d[_0xf634('0x1e')];var _0x50e8e8;if(_0x14c0cb>=_0x4a308e){_0x14c0cb=_0x4a308e;_0x50e8e8=0xc8;}else{_0x50e8e8=0xce;}_0x1deb9f['status'](_0x50e8e8);return _0x1deb9f[_0xf634('0x20')](_0xf634('0x21'),_0x5d7dec+'-'+_0x14c0cb+'/'+_0x4a308e)[_0xf634('0x1b')](_0x36d1b2);}return null;};}function patchUpdates(_0x37be2e){return function(_0x2172cc){try{jsonpatch[_0xf634('0x22')](_0x2172cc,_0x37be2e,!![]);}catch(_0x3e2594){return BPromise[_0xf634('0x23')](_0x3e2594);}return _0x2172cc[_0xf634('0x24')]();};}function saveUpdates(_0x43d89a,_0x3c3dd8){return function(_0x391764){if(_0x391764){return _0x391764[_0xf634('0x25')](_0x43d89a)[_0xf634('0x26')](function(_0x15f4f5){return _0x15f4f5;});}return null;};}function removeEntity(_0x1a1848,_0x45811c){return function(_0xeb5711){if(_0xeb5711){return _0xeb5711['destroy']()[_0xf634('0x26')](function(){var _0xbb4710=_0xeb5711[_0xf634('0x27')]({'plain':!![]});var _0xda2a70=_0xf634('0x28');return db[_0xf634('0x29')][_0xf634('0x2a')]({'where':{'type':_0xda2a70,'resourceId':_0xbb4710['id']}})[_0xf634('0x26')](function(){return _0xeb5711;});})[_0xf634('0x26')](function(){_0x1a1848[_0xf634('0x19')](0xcc)[_0xf634('0x1a')]();});}};}function handleEntityNotFound(_0x4f551e,_0x18d7d5){return function(_0x28f0b9){if(!_0x28f0b9){_0x4f551e['sendStatus'](0x194);}return _0x28f0b9;};}function handleError(_0x4dbef5,_0x3de70b){_0x3de70b=_0x3de70b||0x1f4;return function(_0x52618e){logger[_0xf634('0x2b')](_0x52618e[_0xf634('0x2c')]);if(_0x52618e['name']){delete _0x52618e[_0xf634('0x2d')];}_0x4dbef5[_0xf634('0x19')](_0x3de70b)[_0xf634('0x2e')](_0x52618e);};}exports[_0xf634('0x2f')]=function(_0x58d75c,_0x3f3c21){var _0xbea1a2={},_0x49fcd6={},_0x35ca4d={'count':0x0,'rows':[]};var _0x167832=_['map'](db[_0xf634('0x30')][_0xf634('0x31')],function(_0xe416a6){return{'name':_0xe416a6[_0xf634('0x32')],'type':_0xe416a6[_0xf634('0x33')][_0xf634('0x34')]};});_0x49fcd6['model']=_[_0xf634('0x35')](_0x167832,_0xf634('0x2d'));_0x49fcd6['query']=_['keys'](_0x58d75c[_0xf634('0x36')]);_0x49fcd6[_0xf634('0x37')]=_[_0xf634('0x38')](_0x49fcd6['model'],_0x49fcd6[_0xf634('0x36')]);_0xbea1a2[_0xf634('0x39')]=_[_0xf634('0x38')](_0x49fcd6[_0xf634('0x3a')],qs[_0xf634('0x3b')](_0x58d75c['query']['fields']));_0xbea1a2[_0xf634('0x39')]=_0xbea1a2[_0xf634('0x39')][_0xf634('0x3c')]?_0xbea1a2[_0xf634('0x39')]:_0x49fcd6[_0xf634('0x3a')];if(!_0x58d75c['query']['hasOwnProperty'](_0xf634('0x3d'))){_0xbea1a2[_0xf634('0x1e')]=qs[_0xf634('0x1e')](_0x58d75c[_0xf634('0x36')][_0xf634('0x1e')]);_0xbea1a2['offset']=qs[_0xf634('0x1c')](_0x58d75c[_0xf634('0x36')][_0xf634('0x1c')]);}_0xbea1a2[_0xf634('0x3e')]=qs['sort'](_0x58d75c[_0xf634('0x36')][_0xf634('0x3f')]);_0xbea1a2[_0xf634('0x40')]=qs['filters'](_[_0xf634('0x41')](_0x58d75c[_0xf634('0x36')],_0x49fcd6[_0xf634('0x37')]),_0x167832);if(_0x58d75c['query'][_0xf634('0x42')]){_0xbea1a2[_0xf634('0x40')]=_[_0xf634('0x43')](_0xbea1a2[_0xf634('0x40')],{'$or':_['map'](_0x167832,function(_0x1cd226){if(_0x1cd226['type']!==_0xf634('0x44')){var _0x4aff6b={};_0x4aff6b[_0x1cd226[_0xf634('0x2d')]]={'$like':'%'+_0x58d75c[_0xf634('0x36')][_0xf634('0x42')]+'%'};return _0x4aff6b;}})});}_0xbea1a2=_['merge']({},_0xbea1a2,_0x58d75c[_0xf634('0x45')]);var _0x148c29={'where':_0xbea1a2[_0xf634('0x40')]};return db[_0xf634('0x30')]['count'](_0x148c29)['then'](function(_0x573830){_0x35ca4d[_0xf634('0x1f')]=_0x573830;if(_0x58d75c[_0xf634('0x36')][_0xf634('0x46')]){_0xbea1a2[_0xf634('0x47')]=[{'all':!![]}];}return db[_0xf634('0x30')][_0xf634('0x48')](_0xbea1a2);})[_0xf634('0x26')](function(_0x4a6fc0){_0x35ca4d[_0xf634('0x49')]=_0x4a6fc0;return _0x35ca4d;})[_0xf634('0x26')](respondWithFilteredResult(_0x3f3c21,_0xbea1a2))[_0xf634('0x4a')](handleError(_0x3f3c21,null));};exports['show']=function(_0x55da1d,_0x7d2ec7){var _0x530edf={'raw':![],'where':{'id':_0x55da1d['params']['id']}},_0x5c3311={};_0x5c3311[_0xf634('0x3a')]=_[_0xf634('0x4b')](db[_0xf634('0x30')]['rawAttributes']);_0x5c3311[_0xf634('0x36')]=_[_0xf634('0x4b')](_0x55da1d[_0xf634('0x36')]);_0x5c3311[_0xf634('0x37')]=_[_0xf634('0x38')](_0x5c3311[_0xf634('0x3a')],_0x5c3311[_0xf634('0x36')]);_0x530edf[_0xf634('0x39')]=_['intersection'](_0x5c3311['model'],qs[_0xf634('0x3b')](_0x55da1d[_0xf634('0x36')][_0xf634('0x3b')]));_0x530edf[_0xf634('0x39')]=_0x530edf[_0xf634('0x39')][_0xf634('0x3c')]?_0x530edf[_0xf634('0x39')]:_0x5c3311['model'];if(_0x55da1d[_0xf634('0x36')][_0xf634('0x46')]){_0x530edf[_0xf634('0x47')]=[{'all':!![]}];}_0x530edf=_[_0xf634('0x43')]({},_0x530edf,_0x55da1d[_0xf634('0x45')]);return db[_0xf634('0x30')]['find'](_0x530edf)[_0xf634('0x26')](handleEntityNotFound(_0x7d2ec7,null))[_0xf634('0x26')](respondWithResult(_0x7d2ec7,null))[_0xf634('0x4a')](handleError(_0x7d2ec7,null));};exports[_0xf634('0x4c')]=function(_0x45f039,_0x2af6b6){return db[_0xf634('0x30')][_0xf634('0x4c')](_0x45f039[_0xf634('0x4d')],{})[_0xf634('0x26')](function(_0x227326){var _0x37f45e=_0x45f039[_0xf634('0x4e')]['get']({'plain':!![]});if(!_0x37f45e)throw new Error(_0xf634('0x4f'));if(_0x37f45e[_0xf634('0x50')]==='user'){var _0x303be5=_0x227326['get']({'plain':!![]});var _0x5cb926=_0xf634('0x28');return db[_0xf634('0x51')][_0xf634('0x52')]({'where':{'name':_0x5cb926,'userProfileId':_0x37f45e[_0xf634('0x53')]},'raw':!![]})[_0xf634('0x26')](function(_0x4d4099){if(_0x4d4099&&_0x4d4099[_0xf634('0x54')]===0x0){return db[_0xf634('0x29')][_0xf634('0x4c')]({'name':_0x303be5[_0xf634('0x2d')],'resourceId':_0x303be5['id'],'type':_0x4d4099[_0xf634('0x2d')],'sectionId':_0x4d4099['id']},{})[_0xf634('0x26')](function(){return _0x227326;});}else{return _0x227326;}})[_0xf634('0x4a')](function(_0x1772bc){logger[_0xf634('0x2b')](_0xf634('0x55'),_0x1772bc);throw _0x1772bc;});}return _0x227326;})[_0xf634('0x26')](respondWithResult(_0x2af6b6,0xc9))[_0xf634('0x4a')](handleError(_0x2af6b6,null));};exports['clone']=function(_0x273c11,_0x5c5694){var _0x526526={'where':{'id':_0x273c11['params']['id']}},_0x196efa={};_0x196efa[_0xf634('0x3a')]=_[_0xf634('0x4b')](db['Campaign'][_0xf634('0x31')]);_0x526526['attributes']=_[_0xf634('0x38')](_0x196efa[_0xf634('0x3a')],qs[_0xf634('0x3b')](_0x273c11[_0xf634('0x36')][_0xf634('0x3b')]));_0x526526[_0xf634('0x39')]=_0x526526[_0xf634('0x39')][_0xf634('0x3c')]?_0x526526[_0xf634('0x39')]:_0x196efa[_0xf634('0x3a')];if(_0x273c11[_0xf634('0x36')][_0xf634('0x46')]){_0x526526[_0xf634('0x47')]=[{'all':!![]}];}_0x526526=_['merge']({},_0x526526,_0x273c11['options']);return db['Campaign'][_0xf634('0x52')](_0x526526)[_0xf634('0x26')](handleEntityNotFound(_0x5c5694,null))[_0xf634('0x26')](function(_0x19de13){if(_0x19de13){var _0x354e22=_0x19de13['get']({'plain':!![]});_0x354e22=qs[_0xf634('0x56')](_0x354e22,['id','createdAt','updatedAt']);_0x273c11[_0xf634('0x4d')]=_[_0xf634('0x56')](_0x273c11['body'],['id',_0xf634('0x57'),_0xf634('0x58')]);return db[_0xf634('0x30')][_0xf634('0x4c')](_[_0xf634('0x43')](_0x354e22,_0x273c11[_0xf634('0x4d')]),{'include':_0x273c11[_0xf634('0x36')][_0xf634('0x46')]?[{'all':!![]}]:undefined})[_0xf634('0x26')](function(_0x5ebe21){var _0xba79e3=_0x273c11['user'][_0xf634('0x27')]({'plain':!![]});if(!_0xba79e3)throw new Error(_0xf634('0x4f'));if(_0xba79e3['role']===_0xf634('0x4e')){var _0x5a79c7=_0x5ebe21[_0xf634('0x27')]({'plain':!![]});var _0x3e8c42=_0xf634('0x28');return db['UserProfileSection'][_0xf634('0x52')]({'where':{'name':_0x3e8c42,'userProfileId':_0xba79e3[_0xf634('0x53')]},'raw':!![]})[_0xf634('0x26')](function(_0x112d7a){if(_0x112d7a&&_0x112d7a[_0xf634('0x54')]===0x0){return db[_0xf634('0x29')][_0xf634('0x4c')]({'name':_0x5a79c7['name'],'resourceId':_0x5a79c7['id'],'type':_0x112d7a[_0xf634('0x2d')],'sectionId':_0x112d7a['id']},{})[_0xf634('0x26')](function(){return _0x5ebe21;});}else{return _0x5ebe21;}})[_0xf634('0x4a')](function(_0x1d9b16){logger[_0xf634('0x2b')](_0xf634('0x55'),_0x1d9b16);throw _0x1d9b16;});}return _0x5ebe21;});}})[_0xf634('0x26')](respondWithResult(_0x5c5694,0xc9))['catch'](handleError(_0x5c5694,null));};exports[_0xf634('0x25')]=function(_0x4e77d1,_0x6fd9dd){if(_0x4e77d1[_0xf634('0x4d')]['id']){delete _0x4e77d1['body']['id'];}return db['Campaign'][_0xf634('0x52')]({'where':{'id':_0x4e77d1[_0xf634('0x59')]['id']}})[_0xf634('0x26')](handleEntityNotFound(_0x6fd9dd,null))['then'](saveUpdates(_0x4e77d1['body'],null))[_0xf634('0x26')](respondWithResult(_0x6fd9dd,null))[_0xf634('0x4a')](handleError(_0x6fd9dd,null));};exports[_0xf634('0x2a')]=function(_0x5168d4,_0x5b0ab7){return db[_0xf634('0x30')]['find']({'where':{'id':_0x5168d4[_0xf634('0x59')]['id']}})['then'](handleEntityNotFound(_0x5b0ab7,null))[_0xf634('0x26')](removeEntity(_0x5b0ab7,null))[_0xf634('0x4a')](handleError(_0x5b0ab7,null));};exports['getHoppers']=function(_0x2cc74d,_0x12ee76,_0x1260cb){var _0x2683c4={'raw':!![],'where':{}};var _0xd0e006={};var _0x4e25e1={'count':0x0,'rows':[]};return db[_0xf634('0x30')]['findOne']({'where':{'id':_0x2cc74d[_0xf634('0x59')]['id']}})['then'](handleEntityNotFound(_0x12ee76,null))[_0xf634('0x26')](function(_0x49a70d){if(_0x49a70d){_0xd0e006[_0xf634('0x3a')]=_[_0xf634('0x4b')](db[_0xf634('0x5a')][_0xf634('0x31')]);_0xd0e006[_0xf634('0x36')]=_['keys'](_0x2cc74d[_0xf634('0x36')]);_0xd0e006[_0xf634('0x37')]=_['intersection'](_0xd0e006[_0xf634('0x3a')],_0xd0e006[_0xf634('0x36')]);_0x2683c4[_0xf634('0x39')]=_[_0xf634('0x38')](_0xd0e006[_0xf634('0x3a')],qs['fields'](_0x2cc74d[_0xf634('0x36')][_0xf634('0x3b')]));_0x2683c4[_0xf634('0x39')]=_0x2683c4[_0xf634('0x39')]['length']?_0x2683c4[_0xf634('0x39')]:_0xd0e006['model'];if(!_0x2cc74d[_0xf634('0x36')][_0xf634('0x5b')](_0xf634('0x3d'))){_0x2683c4[_0xf634('0x1e')]=qs['limit'](_0x2cc74d[_0xf634('0x36')][_0xf634('0x1e')]);_0x2683c4[_0xf634('0x1c')]=qs[_0xf634('0x1c')](_0x2cc74d['query'][_0xf634('0x1c')]);}_0x2683c4[_0xf634('0x3e')]=qs[_0xf634('0x3f')](_0x2cc74d[_0xf634('0x36')][_0xf634('0x3f')]);_0x2683c4[_0xf634('0x40')]=qs[_0xf634('0x37')](_[_0xf634('0x41')](_0x2cc74d[_0xf634('0x36')],_0xd0e006[_0xf634('0x37')]));_0x2683c4['where'][_0xf634('0x5c')]=_0x49a70d['id'];if(_0x2cc74d[_0xf634('0x36')][_0xf634('0x42')]){_0x2683c4[_0xf634('0x40')]=_[_0xf634('0x43')](_0x2683c4['where'],{'$or':_[_0xf634('0x35')](_0x2683c4[_0xf634('0x39')],function(_0x12ee43){var _0x3f4c99={};_0x3f4c99[_0x12ee43]={'$like':'%'+_0x2cc74d[_0xf634('0x36')][_0xf634('0x42')]+'%'};return _0x3f4c99;})});}_0x2683c4=_[_0xf634('0x43')]({},_0x2683c4,_0x2cc74d['options']);return db[_0xf634('0x5a')][_0xf634('0x1f')]({'where':_0x2683c4[_0xf634('0x40')]})['then'](function(_0x2226db){_0x4e25e1[_0xf634('0x1f')]=_0x2226db;if(_0x2cc74d[_0xf634('0x36')][_0xf634('0x46')]){_0x2683c4['include']=[{'all':!![]}];}return db[_0xf634('0x5a')][_0xf634('0x48')](_0x2683c4);})[_0xf634('0x26')](function(_0x46667c){_0x4e25e1[_0xf634('0x49')]=_0x46667c;return _0x4e25e1;});}})[_0xf634('0x26')](respondWithFilteredResult(_0x12ee76,_0x2683c4))[_0xf634('0x4a')](handleError(_0x12ee76,null));};exports[_0xf634('0x5d')]=function(_0x409f55,_0x132e11,_0x584569){var _0x421ec9={'raw':!![],'where':{}};var _0x2d3b25={};var _0x3807bc={'count':0x0,'rows':[]};return db[_0xf634('0x30')][_0xf634('0x5e')]({'where':{'id':_0x409f55['params']['id']}})[_0xf634('0x26')](handleEntityNotFound(_0x132e11,null))[_0xf634('0x26')](function(_0x346821){if(_0x346821){_0x2d3b25[_0xf634('0x3a')]=_[_0xf634('0x4b')](db[_0xf634('0x5f')]['rawAttributes']);_0x2d3b25[_0xf634('0x36')]=_[_0xf634('0x4b')](_0x409f55[_0xf634('0x36')]);_0x2d3b25[_0xf634('0x37')]=_['intersection'](_0x2d3b25['model'],_0x2d3b25[_0xf634('0x36')]);_0x421ec9[_0xf634('0x39')]=_[_0xf634('0x38')](_0x2d3b25[_0xf634('0x3a')],qs['fields'](_0x409f55[_0xf634('0x36')][_0xf634('0x3b')]));_0x421ec9[_0xf634('0x39')]=_0x421ec9[_0xf634('0x39')][_0xf634('0x3c')]?_0x421ec9['attributes']:_0x2d3b25['model'];if(!_0x409f55[_0xf634('0x36')][_0xf634('0x5b')](_0xf634('0x3d'))){_0x421ec9[_0xf634('0x1e')]=qs[_0xf634('0x1e')](_0x409f55[_0xf634('0x36')][_0xf634('0x1e')]);_0x421ec9[_0xf634('0x1c')]=qs[_0xf634('0x1c')](_0x409f55[_0xf634('0x36')][_0xf634('0x1c')]);}_0x421ec9[_0xf634('0x3e')]=qs[_0xf634('0x3f')](_0x409f55['query'][_0xf634('0x3f')]);_0x421ec9['where']=qs['filters'](_['pick'](_0x409f55[_0xf634('0x36')],_0x2d3b25[_0xf634('0x37')]));_0x421ec9[_0xf634('0x40')][_0xf634('0x5c')]=_0x346821['id'];if(_0x409f55[_0xf634('0x36')][_0xf634('0x42')]){_0x421ec9['where']=_[_0xf634('0x43')](_0x421ec9[_0xf634('0x40')],{'$or':_['map'](_0x421ec9['attributes'],function(_0x19c04e){var _0x224291={};_0x224291[_0x19c04e]={'$like':'%'+_0x409f55[_0xf634('0x36')][_0xf634('0x42')]+'%'};return _0x224291;})});}_0x421ec9=_[_0xf634('0x43')]({},_0x421ec9,_0x409f55[_0xf634('0x45')]);return db['CmHopperHistory'][_0xf634('0x1f')]({'where':_0x421ec9['where']})[_0xf634('0x26')](function(_0x58e404){_0x3807bc[_0xf634('0x1f')]=_0x58e404;if(_0x409f55[_0xf634('0x36')]['includeAll']){_0x421ec9[_0xf634('0x47')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf634('0x48')](_0x421ec9);})['then'](function(_0x3d46da){_0x3807bc['rows']=_0x3d46da;return _0x3807bc;});}})[_0xf634('0x26')](respondWithFilteredResult(_0x132e11,_0x421ec9))['catch'](handleError(_0x132e11,null));};exports['getHopperFinals']=function(_0x256551,_0xc69d88,_0x1c5e07){var _0x360041={'raw':!![],'where':{}};var _0x2cb895={};var _0x2092d9={'count':0x0,'rows':[]};return db[_0xf634('0x30')]['findOne']({'where':{'id':_0x256551[_0xf634('0x59')]['id']}})[_0xf634('0x26')](handleEntityNotFound(_0xc69d88,null))[_0xf634('0x26')](function(_0x26a577){if(_0x26a577){_0x2cb895[_0xf634('0x3a')]=_['keys'](db['CmHopperFinal'][_0xf634('0x31')]);_0x2cb895[_0xf634('0x36')]=_[_0xf634('0x4b')](_0x256551[_0xf634('0x36')]);_0x2cb895['filters']=_[_0xf634('0x38')](_0x2cb895['model'],_0x2cb895[_0xf634('0x36')]);_0x360041['attributes']=_[_0xf634('0x38')](_0x2cb895['model'],qs[_0xf634('0x3b')](_0x256551[_0xf634('0x36')][_0xf634('0x3b')]));_0x360041[_0xf634('0x39')]=_0x360041[_0xf634('0x39')][_0xf634('0x3c')]?_0x360041[_0xf634('0x39')]:_0x2cb895[_0xf634('0x3a')];if(!_0x256551[_0xf634('0x36')][_0xf634('0x5b')](_0xf634('0x3d'))){_0x360041['limit']=qs[_0xf634('0x1e')](_0x256551['query'][_0xf634('0x1e')]);_0x360041[_0xf634('0x1c')]=qs['offset'](_0x256551[_0xf634('0x36')][_0xf634('0x1c')]);}_0x360041[_0xf634('0x3e')]=qs[_0xf634('0x3f')](_0x256551['query'][_0xf634('0x3f')]);_0x360041[_0xf634('0x40')]=qs['filters'](_['pick'](_0x256551[_0xf634('0x36')],_0x2cb895[_0xf634('0x37')]));_0x360041['where'][_0xf634('0x5c')]=_0x26a577['id'];if(_0x256551[_0xf634('0x36')][_0xf634('0x42')]){_0x360041[_0xf634('0x40')]=_[_0xf634('0x43')](_0x360041['where'],{'$or':_[_0xf634('0x35')](_0x360041[_0xf634('0x39')],function(_0x74bf2d){var _0x1f4665={};_0x1f4665[_0x74bf2d]={'$like':'%'+_0x256551[_0xf634('0x36')][_0xf634('0x42')]+'%'};return _0x1f4665;})});}_0x360041=_[_0xf634('0x43')]({},_0x360041,_0x256551[_0xf634('0x45')]);return db[_0xf634('0x60')]['count']({'where':_0x360041[_0xf634('0x40')]})[_0xf634('0x26')](function(_0xaaf9e7){_0x2092d9[_0xf634('0x1f')]=_0xaaf9e7;if(_0x256551[_0xf634('0x36')]['includeAll']){_0x360041[_0xf634('0x47')]=[{'all':!![]}];}return db[_0xf634('0x60')][_0xf634('0x48')](_0x360041);})[_0xf634('0x26')](function(_0x3fc87f){_0x2092d9[_0xf634('0x49')]=_0x3fc87f;return _0x2092d9;});}})[_0xf634('0x26')](respondWithFilteredResult(_0xc69d88,_0x360041))[_0xf634('0x4a')](handleError(_0xc69d88,null));};exports['getHopperBlacks']=function(_0x42a04e,_0x38eeae,_0x498dad){var _0x41028c={'raw':!![],'where':{}};var _0x43c7d2={};var _0x21861d={'count':0x0,'rows':[]};return db[_0xf634('0x30')]['findOne']({'where':{'id':_0x42a04e[_0xf634('0x59')]['id']}})['then'](handleEntityNotFound(_0x38eeae,null))['then'](function(_0x5ab6f9){if(_0x5ab6f9){_0x43c7d2[_0xf634('0x3a')]=_[_0xf634('0x4b')](db['CmHopperBlack'][_0xf634('0x31')]);_0x43c7d2['query']=_['keys'](_0x42a04e[_0xf634('0x36')]);_0x43c7d2[_0xf634('0x37')]=_[_0xf634('0x38')](_0x43c7d2[_0xf634('0x3a')],_0x43c7d2[_0xf634('0x36')]);_0x41028c[_0xf634('0x39')]=_['intersection'](_0x43c7d2[_0xf634('0x3a')],qs['fields'](_0x42a04e['query'][_0xf634('0x3b')]));_0x41028c[_0xf634('0x39')]=_0x41028c[_0xf634('0x39')][_0xf634('0x3c')]?_0x41028c[_0xf634('0x39')]:_0x43c7d2[_0xf634('0x3a')];if(!_0x42a04e[_0xf634('0x36')]['hasOwnProperty'](_0xf634('0x3d'))){_0x41028c[_0xf634('0x1e')]=qs[_0xf634('0x1e')](_0x42a04e[_0xf634('0x36')]['limit']);_0x41028c[_0xf634('0x1c')]=qs['offset'](_0x42a04e[_0xf634('0x36')][_0xf634('0x1c')]);}_0x41028c[_0xf634('0x3e')]=qs[_0xf634('0x3f')](_0x42a04e['query']['sort']);_0x41028c['where']=qs[_0xf634('0x37')](_[_0xf634('0x41')](_0x42a04e['query'],_0x43c7d2[_0xf634('0x37')]));_0x41028c[_0xf634('0x40')][_0xf634('0x5c')]=_0x5ab6f9['id'];if(_0x42a04e[_0xf634('0x36')][_0xf634('0x42')]){_0x41028c[_0xf634('0x40')]=_[_0xf634('0x43')](_0x41028c[_0xf634('0x40')],{'$or':_[_0xf634('0x35')](_0x41028c[_0xf634('0x39')],function(_0x44f13f){var _0x1bec7e={};_0x1bec7e[_0x44f13f]={'$like':'%'+_0x42a04e[_0xf634('0x36')]['filter']+'%'};return _0x1bec7e;})});}_0x41028c=_[_0xf634('0x43')]({},_0x41028c,_0x42a04e[_0xf634('0x45')]);return db[_0xf634('0x61')][_0xf634('0x1f')]({'where':_0x41028c[_0xf634('0x40')]})['then'](function(_0x4875c1){_0x21861d['count']=_0x4875c1;if(_0x42a04e['query']['includeAll']){_0x41028c[_0xf634('0x47')]=[{'all':!![]}];}return db[_0xf634('0x61')][_0xf634('0x48')](_0x41028c);})['then'](function(_0x1cc1df){_0x21861d[_0xf634('0x49')]=_0x1cc1df;return _0x21861d;});}})[_0xf634('0x26')](respondWithFilteredResult(_0x38eeae,_0x41028c))[_0xf634('0x4a')](handleError(_0x38eeae,null));};exports[_0xf634('0x62')]=function(_0x59b320,_0x58ca2a,_0x3a363c){var _0x4652b6={};var _0x1aa530={};var _0x58119e;var _0x21982a;return db[_0xf634('0x30')][_0xf634('0x5e')]({'where':{'id':_0x59b320[_0xf634('0x59')]['id']}})[_0xf634('0x26')](handleEntityNotFound(_0x58ca2a,null))['then'](function(_0x110aa0){if(_0x110aa0){_0x58119e=_0x110aa0;_0x1aa530['model']=_[_0xf634('0x4b')](db[_0xf634('0x63')]['rawAttributes']);_0x1aa530['query']=_[_0xf634('0x4b')](_0x59b320[_0xf634('0x36')]);_0x1aa530[_0xf634('0x37')]=_['intersection'](_0x1aa530[_0xf634('0x3a')],_0x1aa530[_0xf634('0x36')]);_0x4652b6['attributes']=_['intersection'](_0x1aa530[_0xf634('0x3a')],qs[_0xf634('0x3b')](_0x59b320['query'][_0xf634('0x3b')]));_0x4652b6[_0xf634('0x39')]=_0x4652b6[_0xf634('0x39')][_0xf634('0x3c')]?_0x4652b6[_0xf634('0x39')]:_0x1aa530[_0xf634('0x3a')];_0x4652b6['order']=qs[_0xf634('0x3f')](_0x59b320['query']['sort']);_0x4652b6[_0xf634('0x40')]=qs[_0xf634('0x37')](_[_0xf634('0x41')](_0x59b320[_0xf634('0x36')],_0x1aa530[_0xf634('0x37')]));if(_0x59b320[_0xf634('0x36')]['filter']){_0x4652b6[_0xf634('0x40')]=_['merge'](_0x4652b6[_0xf634('0x40')],{'$or':_['map'](_0x4652b6['attributes'],function(_0x3e8120){var _0x1c68d1={};_0x1c68d1[_0x3e8120]={'$like':'%'+_0x59b320[_0xf634('0x36')][_0xf634('0x42')]+'%'};return _0x1c68d1;})});}_0x4652b6=_[_0xf634('0x43')]({},_0x4652b6,_0x59b320[_0xf634('0x45')]);return _0x58119e[_0xf634('0x62')](_0x4652b6);}})['then'](function(_0x130252){if(_0x130252){_0x21982a=_0x130252[_0xf634('0x3c')];if(!_0x59b320[_0xf634('0x36')][_0xf634('0x5b')]('nolimit')){_0x4652b6[_0xf634('0x1e')]=qs['limit'](_0x59b320[_0xf634('0x36')][_0xf634('0x1e')]);_0x4652b6['offset']=qs[_0xf634('0x1c')](_0x59b320['query'][_0xf634('0x1c')]);}return _0x58119e[_0xf634('0x62')](_0x4652b6);}})['then'](function(_0x12916c){if(_0x12916c){return _0x12916c?{'count':_0x21982a,'rows':_0x12916c}:null;}})[_0xf634('0x26')](respondWithResult(_0x58ca2a,null))['catch'](handleError(_0x58ca2a,null));};exports[_0xf634('0x64')]=function(_0x446a04,_0x5a3746,_0x1a64dc){var _0x27f6f1,_0x3fbce2;return db[_0xf634('0x30')][_0xf634('0x52')]({'where':{'id':_0x446a04[_0xf634('0x59')]['id']}})['then'](handleEntityNotFound(_0x5a3746,null))[_0xf634('0x26')](function(_0x20b611){if(_0x20b611){_0x3fbce2=_0x20b611;return _0x20b611['addLists'](_0x446a04[_0xf634('0x4d')][_0xf634('0x65')],_['omit'](_0x446a04['body'],[_0xf634('0x65'),'id'])||{});}return null;})[_0xf634('0x66')](function(_0xf9f5b1){var _0x42c0e3;_0x27f6f1=_0xf9f5b1||[];var _0x328627=[];if(_0xf9f5b1){for(var _0x487fa9=0x0;_0x487fa9<_0xf9f5b1[_0xf634('0x3c')];_0x487fa9+=0x1){var _0x44eca3=_0xf9f5b1[_0x487fa9][_0xf634('0x27')]({'plain':!![]});_0x3fbce2[_0xf634('0x67')]=_0x446a04[_0xf634('0x4d')][_0xf634('0x67')]?_0x446a04[_0xf634('0x4d')][_0xf634('0x67')]:_0x3fbce2[_0xf634('0x67')];switch(_0x3fbce2[_0xf634('0x67')]){case'always':_0x42c0e3=squel[_0xf634('0x68')]()[_0xf634('0x69')](_0xf634('0x6a'))['fromQuery']([_0xf634('0x6b'),'scheduledAt',_0xf634('0x6c'),_0xf634('0x6d'),_0xf634('0x5c'),'createdAt',_0xf634('0x58')],squel[_0xf634('0x6e')]()[_0xf634('0x6f')]('phone','phone')[_0xf634('0x6f')]('NOW()',_0xf634('0x70'))[_0xf634('0x6f')]('id',_0xf634('0x6c'))['field'](_0x44eca3[_0xf634('0x71')]['toString'](),_0xf634('0x6d'))[_0xf634('0x6f')](_0x446a04[_0xf634('0x59')]['id']['toString'](),'CampaignId')['field'](_0xf634('0x72'),_0xf634('0x57'))['field'](_0xf634('0x72'),_0xf634('0x58'))[_0xf634('0x73')]('cm_contacts')['where'](_0xf634('0x74'))[_0xf634('0x40')](_0xf634('0x75'),_0x44eca3[_0xf634('0x71')][_0xf634('0x76')]())[_0xf634('0x40')](_0xf634('0x77'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf634('0x6f')](_0xf634('0x78'))[_0xf634('0x73')](_0xf634('0x79'))[_0xf634('0x40')](_0xf634('0x7a'),_0x446a04[_0xf634('0x59')]['id'][_0xf634('0x76')]()))['where'](_0xf634('0x7b'),squel[_0xf634('0x6e')]()[_0xf634('0x6f')](_0xf634('0x7c'))[_0xf634('0x73')](_0xf634('0x6a'))['where']('CampaignId\x20=\x20?',_0x446a04[_0xf634('0x59')]['id'][_0xf634('0x76')]())))[_0xf634('0x76')]();break;case'onlyIfOpen':_0x42c0e3=squel[_0xf634('0x68')]()[_0xf634('0x69')](_0xf634('0x6a'))['fromQuery']([_0xf634('0x6b'),_0xf634('0x70'),_0xf634('0x6c'),_0xf634('0x6d'),'CampaignId',_0xf634('0x57'),_0xf634('0x58')],squel[_0xf634('0x6e')]()[_0xf634('0x6f')]('phone',_0xf634('0x6b'))[_0xf634('0x6f')](_0xf634('0x72'),_0xf634('0x70'))['field']('id',_0xf634('0x6c'))['field'](_0x44eca3['CmListId'][_0xf634('0x76')](),_0xf634('0x6d'))[_0xf634('0x6f')](_0x446a04[_0xf634('0x59')]['id'][_0xf634('0x76')](),_0xf634('0x5c'))[_0xf634('0x6f')](_0xf634('0x72'),_0xf634('0x57'))[_0xf634('0x6f')](_0xf634('0x72'),_0xf634('0x58'))['from'](_0xf634('0x7d'))[_0xf634('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0xf634('0x75'),_0x44eca3[_0xf634('0x71')][_0xf634('0x76')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xf634('0x40')](_0xf634('0x7b'),squel[_0xf634('0x6e')]()[_0xf634('0x6f')](_0xf634('0x7c'))[_0xf634('0x73')](_0xf634('0x6a'))[_0xf634('0x40')](_0xf634('0x7a'),_0x446a04[_0xf634('0x59')]['id'][_0xf634('0x76')]())))[_0xf634('0x76')]();break;default:_0x42c0e3=squel[_0xf634('0x68')]()[_0xf634('0x69')](_0xf634('0x6a'))[_0xf634('0x7e')](['phone','scheduledAt',_0xf634('0x6c'),_0xf634('0x6d'),_0xf634('0x5c'),_0xf634('0x57'),_0xf634('0x58')],squel['select']()['field'](_0xf634('0x6b'),_0xf634('0x6b'))[_0xf634('0x6f')](_0xf634('0x72'),_0xf634('0x70'))['field']('id',_0xf634('0x6c'))[_0xf634('0x6f')](_0x44eca3['CmListId']['toString'](),_0xf634('0x6d'))[_0xf634('0x6f')](_0x446a04[_0xf634('0x59')]['id']['toString'](),_0xf634('0x5c'))[_0xf634('0x6f')](_0xf634('0x72'),_0xf634('0x57'))[_0xf634('0x6f')](_0xf634('0x72'),_0xf634('0x58'))[_0xf634('0x73')](_0xf634('0x7d'))[_0xf634('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0xf634('0x75'),_0x44eca3['CmListId'][_0xf634('0x76')]())[_0xf634('0x40')](_0xf634('0x77')))['toString']();}_0x328627[_0xf634('0x7f')](db[_0xf634('0x80')][_0xf634('0x36')](_0x42c0e3));}return BPromise['all'](_0x328627);}})[_0xf634('0x26')](function(){return _0x27f6f1;})[_0xf634('0x26')](respondWithResult(_0x5a3746,null))[_0xf634('0x4a')](handleError(_0x5a3746,null));};exports['removeLists']=function(_0xa21f39,_0x398d17,_0x22144a){return db[_0xf634('0x30')][_0xf634('0x52')]({'where':{'id':_0xa21f39[_0xf634('0x59')]['id']}})[_0xf634('0x26')](handleEntityNotFound(_0x398d17,null))[_0xf634('0x26')](function(_0x44df25){if(_0x44df25){return _0x44df25[_0xf634('0x81')](_0xa21f39[_0xf634('0x36')][_0xf634('0x65')]);}})[_0xf634('0x26')](function(_0x26acda){if(_0x26acda){return db['CmHopper'][_0xf634('0x2a')]({'where':{'ListId':_0xa21f39[_0xf634('0x36')][_0xf634('0x65')],'CampaignId':_0xa21f39[_0xf634('0x59')]['id']}})['then'](function(){return _0x26acda;});}})[_0xf634('0x26')](respondWithStatusCode(_0x398d17,null))[_0xf634('0x4a')](handleError(_0x398d17,null));};exports[_0xf634('0x82')]=function(_0x5847cb,_0x4d8a36,_0x474734){var _0x538cee={};var _0x4f904b={};var _0xe19330;var _0x1819de;return db['Campaign']['findOne']({'where':{'id':_0x5847cb[_0xf634('0x59')]['id']}})[_0xf634('0x26')](handleEntityNotFound(_0x4d8a36,null))['then'](function(_0xf813f9){if(_0xf813f9){_0xe19330=_0xf813f9;_0x4f904b[_0xf634('0x3a')]=_['keys'](db[_0xf634('0x63')]['rawAttributes']);_0x4f904b[_0xf634('0x36')]=_[_0xf634('0x4b')](_0x5847cb[_0xf634('0x36')]);_0x4f904b[_0xf634('0x37')]=_[_0xf634('0x38')](_0x4f904b['model'],_0x4f904b[_0xf634('0x36')]);_0x538cee[_0xf634('0x39')]=_[_0xf634('0x38')](_0x4f904b['model'],qs[_0xf634('0x3b')](_0x5847cb['query']['fields']));_0x538cee[_0xf634('0x39')]=_0x538cee[_0xf634('0x39')][_0xf634('0x3c')]?_0x538cee[_0xf634('0x39')]:_0x4f904b[_0xf634('0x3a')];_0x538cee[_0xf634('0x3e')]=qs[_0xf634('0x3f')](_0x5847cb['query'][_0xf634('0x3f')]);_0x538cee[_0xf634('0x40')]=qs[_0xf634('0x37')](_[_0xf634('0x41')](_0x5847cb['query'],_0x4f904b[_0xf634('0x37')]));if(_0x5847cb[_0xf634('0x36')][_0xf634('0x42')]){_0x538cee[_0xf634('0x40')]=_[_0xf634('0x43')](_0x538cee[_0xf634('0x40')],{'$or':_['map'](_0x538cee[_0xf634('0x39')],function(_0xc89691){var _0x16d1ba={};_0x16d1ba[_0xc89691]={'$like':'%'+_0x5847cb[_0xf634('0x36')][_0xf634('0x42')]+'%'};return _0x16d1ba;})});}_0x538cee=_[_0xf634('0x43')]({},_0x538cee,_0x5847cb['options']);return _0xe19330[_0xf634('0x82')](_0x538cee);}})[_0xf634('0x26')](function(_0x4607fc){if(_0x4607fc){_0x1819de=_0x4607fc[_0xf634('0x3c')];if(!_0x5847cb[_0xf634('0x36')][_0xf634('0x5b')](_0xf634('0x3d'))){_0x538cee[_0xf634('0x1e')]=qs['limit'](_0x5847cb[_0xf634('0x36')][_0xf634('0x1e')]);_0x538cee['offset']=qs[_0xf634('0x1c')](_0x5847cb[_0xf634('0x36')][_0xf634('0x1c')]);}return _0xe19330[_0xf634('0x82')](_0x538cee);}})['then'](function(_0x280dc6){if(_0x280dc6){return _0x280dc6?{'count':_0x1819de,'rows':_0x280dc6}:null;}})[_0xf634('0x26')](respondWithResult(_0x4d8a36,null))[_0xf634('0x4a')](handleError(_0x4d8a36,null));};exports[_0xf634('0x83')]=function(_0x1826d3,_0x4c54df,_0x4a2100){var _0x334d20,_0x4a578e;return db[_0xf634('0x30')][_0xf634('0x52')]({'where':{'id':_0x1826d3[_0xf634('0x59')]['id']}})[_0xf634('0x26')](handleEntityNotFound(_0x4c54df,null))[_0xf634('0x26')](function(_0x4281a1){if(_0x4281a1){_0x4a578e=_0x4281a1;return _0x4281a1[_0xf634('0x83')](_0x1826d3['body'][_0xf634('0x65')],_[_0xf634('0x56')](_0x1826d3[_0xf634('0x4d')],[_0xf634('0x65'),'id'])||{});}return null;})[_0xf634('0x66')](function(_0x4f0292){var _0x276ba8;_0x334d20=_0x4f0292||[];var _0x28891b=[];if(_0x4f0292){for(var _0x59f12d=0x0;_0x59f12d<_0x4f0292[_0xf634('0x3c')];_0x59f12d+=0x1){var _0x2b8f12=_0x4f0292[_0x59f12d][_0xf634('0x27')]({'plain':!![]});_0x276ba8=squel[_0xf634('0x68')]()[_0xf634('0x69')](_0xf634('0x84'))[_0xf634('0x7e')]([_0xf634('0x6b'),_0xf634('0x6c'),'ListId',_0xf634('0x5c'),_0xf634('0x57'),_0xf634('0x58')],squel[_0xf634('0x6e')]()[_0xf634('0x6f')](_0xf634('0x6b'),_0xf634('0x6b'))[_0xf634('0x6f')]('id',_0xf634('0x6c'))['field'](_0x2b8f12[_0xf634('0x71')]['toString'](),_0xf634('0x6d'))['field'](_0x1826d3[_0xf634('0x59')]['id'][_0xf634('0x76')](),_0xf634('0x5c'))[_0xf634('0x6f')]('NOW()',_0xf634('0x57'))[_0xf634('0x6f')](_0xf634('0x72'),_0xf634('0x58'))[_0xf634('0x73')](_0xf634('0x7d'))['where'](_0xf634('0x74'))['where']('ListId\x20=\x20?',_0x2b8f12[_0xf634('0x71')][_0xf634('0x76')]())['where'](_0xf634('0x77')))[_0xf634('0x76')]();_0x28891b[_0xf634('0x7f')](db[_0xf634('0x80')]['query'](_0x276ba8));}return BPromise[_0xf634('0x85')](_0x28891b);}})[_0xf634('0x26')](function(){return _0x334d20;})[_0xf634('0x26')](respondWithResult(_0x4c54df,null))[_0xf634('0x4a')](handleError(_0x4c54df,null));};exports[_0xf634('0x86')]=function(_0x5a3ca0,_0x462959,_0x310aec){return db['Campaign'][_0xf634('0x52')]({'where':{'id':_0x5a3ca0[_0xf634('0x59')]['id']}})['then'](handleEntityNotFound(_0x462959,null))[_0xf634('0x26')](function(_0x374f9b){if(_0x374f9b){return _0x374f9b[_0xf634('0x86')](_0x5a3ca0[_0xf634('0x36')][_0xf634('0x65')]);}})['then'](function(_0x24b9ec){if(_0x24b9ec){return db[_0xf634('0x61')][_0xf634('0x2a')]({'where':{'ListId':_0x5a3ca0['query'][_0xf634('0x65')],'CampaignId':_0x5a3ca0['params']['id']}})[_0xf634('0x26')](function(){return _0x24b9ec;});}})[_0xf634('0x26')](respondWithStatusCode(_0x462959,null))[_0xf634('0x4a')](handleError(_0x462959,null));}; \ No newline at end of file +var _0xbe72=['offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','IvrCampaigns','end','stack','name','send','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','options','includeAll','rows','catch','show','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','clone','params','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','pick','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','omit','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','COALESCE(phone,\x27\x27)','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json'];(function(_0x28b2f2,_0x5c45b6){var _0x51aa69=function(_0x3bc10f){while(--_0x3bc10f){_0x28b2f2['push'](_0x28b2f2['shift']());}};_0x51aa69(++_0x5c45b6);}(_0xbe72,0xf4));var _0x2be7=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xbe72[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2be7('0x0'));var zipdir=require(_0x2be7('0x1'));var jsonpatch=require(_0x2be7('0x2'));var rp=require('request-promise');var moment=require(_0x2be7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2be7('0x4'));var util=require(_0x2be7('0x5'));var path=require(_0x2be7('0x6'));var sox=require(_0x2be7('0x7'));var csv=require('to-csv');var ejs=require(_0x2be7('0x8'));var fs=require('fs');var fs_extra=require(_0x2be7('0x9'));var _=require(_0x2be7('0xa'));var squel=require('squel');var crypto=require(_0x2be7('0xb'));var jsforce=require(_0x2be7('0xc'));var deskjs=require(_0x2be7('0xd'));var toCsv=require(_0x2be7('0xe'));var querystring=require('querystring');var Papa=require(_0x2be7('0xf'));var Redis=require(_0x2be7('0x10'));var authService=require(_0x2be7('0x11'));var qs=require(_0x2be7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2be7('0x13'))(_0x2be7('0x14'));var utils=require(_0x2be7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2be7('0x16'));var db=require(_0x2be7('0x17'))['db'];function respondWithStatusCode(_0x387dd5,_0x2e15a2){_0x2e15a2=_0x2e15a2||0xcc;return function(_0x2ee522){if(_0x2ee522){return _0x387dd5['sendStatus'](_0x2e15a2);}return _0x387dd5[_0x2be7('0x18')](_0x2e15a2)['end']();};}function respondWithResult(_0x266877,_0x14bda5){_0x14bda5=_0x14bda5||0xc8;return function(_0x50c232){if(_0x50c232){return _0x266877['status'](_0x14bda5)[_0x2be7('0x19')](_0x50c232);}};}function respondWithFilteredResult(_0x2e879d,_0x24b0e6){return function(_0x1a9b80){if(_0x1a9b80){var _0x17e96b=typeof _0x24b0e6[_0x2be7('0x1a')]===_0x2be7('0x1b')&&typeof _0x24b0e6[_0x2be7('0x1c')]===_0x2be7('0x1b');var _0x362b72=_0x1a9b80[_0x2be7('0x1d')];var _0x4033cf=_0x17e96b?0x0:_0x24b0e6[_0x2be7('0x1a')];var _0x202479=_0x17e96b?_0x1a9b80[_0x2be7('0x1d')]:_0x24b0e6[_0x2be7('0x1a')]+_0x24b0e6[_0x2be7('0x1c')];var _0x2fbe83;if(_0x202479>=_0x362b72){_0x202479=_0x362b72;_0x2fbe83=0xc8;}else{_0x2fbe83=0xce;}_0x2e879d[_0x2be7('0x18')](_0x2fbe83);return _0x2e879d[_0x2be7('0x1e')](_0x2be7('0x1f'),_0x4033cf+'-'+_0x202479+'/'+_0x362b72)['json'](_0x1a9b80);}return null;};}function patchUpdates(_0x179905){return function(_0x3c5483){try{jsonpatch[_0x2be7('0x20')](_0x3c5483,_0x179905,!![]);}catch(_0x4c33a2){return BPromise['reject'](_0x4c33a2);}return _0x3c5483[_0x2be7('0x21')]();};}function saveUpdates(_0x240a12,_0x23b9d2){return function(_0x456efb){if(_0x456efb){return _0x456efb[_0x2be7('0x22')](_0x240a12)['then'](function(_0x42ce49){return _0x42ce49;});}return null;};}function removeEntity(_0x5cf822,_0x113885){return function(_0x4e3cf3){if(_0x4e3cf3){return _0x4e3cf3[_0x2be7('0x23')]()[_0x2be7('0x24')](function(){var _0x27e88a=_0x4e3cf3[_0x2be7('0x25')]({'plain':!![]});var _0x24082f=_0x2be7('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x24082f,'resourceId':_0x27e88a['id']}})['then'](function(){return _0x4e3cf3;});})['then'](function(){_0x5cf822['status'](0xcc)[_0x2be7('0x27')]();});}};}function handleEntityNotFound(_0x441c4a,_0x2dbd24){return function(_0x3c9e51){if(!_0x3c9e51){_0x441c4a['sendStatus'](0x194);}return _0x3c9e51;};}function handleError(_0x1ea5ee,_0x32bce1){_0x32bce1=_0x32bce1||0x1f4;return function(_0x17a4ae){logger['error'](_0x17a4ae[_0x2be7('0x28')]);if(_0x17a4ae[_0x2be7('0x29')]){delete _0x17a4ae[_0x2be7('0x29')];}_0x1ea5ee[_0x2be7('0x18')](_0x32bce1)[_0x2be7('0x2a')](_0x17a4ae);};}exports['index']=function(_0x4c0886,_0x312096){var _0x12a8e3={},_0x375d7a={},_0x3276da={'count':0x0,'rows':[]};var _0x1ef1eb=_['map'](db[_0x2be7('0x2b')][_0x2be7('0x2c')],function(_0x579f30){return{'name':_0x579f30[_0x2be7('0x2d')],'type':_0x579f30[_0x2be7('0x2e')][_0x2be7('0x2f')]};});_0x375d7a[_0x2be7('0x30')]=_[_0x2be7('0x31')](_0x1ef1eb,_0x2be7('0x29'));_0x375d7a[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x4c0886['query']);_0x375d7a[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x375d7a[_0x2be7('0x30')],_0x375d7a[_0x2be7('0x32')]);_0x12a8e3['attributes']=_[_0x2be7('0x35')](_0x375d7a['model'],qs['fields'](_0x4c0886[_0x2be7('0x32')][_0x2be7('0x36')]));_0x12a8e3['attributes']=_0x12a8e3[_0x2be7('0x37')][_0x2be7('0x38')]?_0x12a8e3[_0x2be7('0x37')]:_0x375d7a[_0x2be7('0x30')];if(!_0x4c0886[_0x2be7('0x32')]['hasOwnProperty']('nolimit')){_0x12a8e3['limit']=qs['limit'](_0x4c0886['query']['limit']);_0x12a8e3[_0x2be7('0x1a')]=qs[_0x2be7('0x1a')](_0x4c0886[_0x2be7('0x32')][_0x2be7('0x1a')]);}_0x12a8e3[_0x2be7('0x39')]=qs[_0x2be7('0x3a')](_0x4c0886[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x12a8e3[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_['pick'](_0x4c0886[_0x2be7('0x32')],_0x375d7a[_0x2be7('0x34')]),_0x1ef1eb);if(_0x4c0886[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x12a8e3['where']=_[_0x2be7('0x3d')](_0x12a8e3[_0x2be7('0x3b')],{'$or':_['map'](_0x1ef1eb,function(_0x4b9385){if(_0x4b9385['type']!=='VIRTUAL'){var _0xa12a5a={};_0xa12a5a[_0x4b9385[_0x2be7('0x29')]]={'$like':'%'+_0x4c0886[_0x2be7('0x32')]['filter']+'%'};return _0xa12a5a;}})});}_0x12a8e3=_[_0x2be7('0x3d')]({},_0x12a8e3,_0x4c0886[_0x2be7('0x3e')]);var _0x55ea50={'where':_0x12a8e3[_0x2be7('0x3b')]};return db[_0x2be7('0x2b')]['count'](_0x55ea50)[_0x2be7('0x24')](function(_0x40ef2d){_0x3276da[_0x2be7('0x1d')]=_0x40ef2d;if(_0x4c0886[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x12a8e3['include']=[{'all':!![]}];}return db[_0x2be7('0x2b')]['findAll'](_0x12a8e3);})[_0x2be7('0x24')](function(_0x516189){_0x3276da[_0x2be7('0x40')]=_0x516189;return _0x3276da;})[_0x2be7('0x24')](respondWithFilteredResult(_0x312096,_0x12a8e3))[_0x2be7('0x41')](handleError(_0x312096,null));};exports[_0x2be7('0x42')]=function(_0x1b2be0,_0x5d3419){var _0x216218={'raw':![],'where':{'id':_0x1b2be0['params']['id']}},_0x2db05f={};_0x2db05f['model']=_[_0x2be7('0x33')](db[_0x2be7('0x2b')]['rawAttributes']);_0x2db05f[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x1b2be0[_0x2be7('0x32')]);_0x2db05f[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x2db05f[_0x2be7('0x30')],_0x2db05f['query']);_0x216218[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x2db05f[_0x2be7('0x30')],qs['fields'](_0x1b2be0[_0x2be7('0x32')][_0x2be7('0x36')]));_0x216218[_0x2be7('0x37')]=_0x216218[_0x2be7('0x37')][_0x2be7('0x38')]?_0x216218[_0x2be7('0x37')]:_0x2db05f[_0x2be7('0x30')];if(_0x1b2be0[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x216218[_0x2be7('0x43')]=[{'all':!![]}];}_0x216218=_[_0x2be7('0x3d')]({},_0x216218,_0x1b2be0[_0x2be7('0x3e')]);return db[_0x2be7('0x2b')][_0x2be7('0x44')](_0x216218)[_0x2be7('0x24')](handleEntityNotFound(_0x5d3419,null))[_0x2be7('0x24')](respondWithResult(_0x5d3419,null))[_0x2be7('0x41')](handleError(_0x5d3419,null));};exports[_0x2be7('0x45')]=function(_0x1346f9,_0x361bf9){return db[_0x2be7('0x2b')][_0x2be7('0x45')](_0x1346f9['body'],{})[_0x2be7('0x24')](function(_0x1e26ed){var _0x202127=_0x1346f9['user']['get']({'plain':!![]});if(!_0x202127)throw new Error(_0x2be7('0x46'));if(_0x202127['role']===_0x2be7('0x47')){var _0x2bf1b4=_0x1e26ed['get']({'plain':!![]});var _0x27ef60=_0x2be7('0x26');return db[_0x2be7('0x48')]['find']({'where':{'name':_0x27ef60,'userProfileId':_0x202127['userProfileId']},'raw':!![]})[_0x2be7('0x24')](function(_0x1e73e1){if(_0x1e73e1&&_0x1e73e1[_0x2be7('0x49')]===0x0){return db[_0x2be7('0x4a')]['create']({'name':_0x2bf1b4[_0x2be7('0x29')],'resourceId':_0x2bf1b4['id'],'type':_0x1e73e1['name'],'sectionId':_0x1e73e1['id']},{})[_0x2be7('0x24')](function(){return _0x1e26ed;});}else{return _0x1e26ed;}})[_0x2be7('0x41')](function(_0x565c81){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x565c81);throw _0x565c81;});}return _0x1e26ed;})[_0x2be7('0x24')](respondWithResult(_0x361bf9,0xc9))[_0x2be7('0x41')](handleError(_0x361bf9,null));};exports[_0x2be7('0x4b')]=function(_0xe2b232,_0x3b0dea){var _0x40546c={'where':{'id':_0xe2b232[_0x2be7('0x4c')]['id']}},_0x28fc91={};_0x28fc91[_0x2be7('0x30')]=_[_0x2be7('0x33')](db['Campaign']['rawAttributes']);_0x40546c['attributes']=_['intersection'](_0x28fc91[_0x2be7('0x30')],qs[_0x2be7('0x36')](_0xe2b232[_0x2be7('0x32')][_0x2be7('0x36')]));_0x40546c[_0x2be7('0x37')]=_0x40546c[_0x2be7('0x37')][_0x2be7('0x38')]?_0x40546c[_0x2be7('0x37')]:_0x28fc91[_0x2be7('0x30')];if(_0xe2b232[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x40546c[_0x2be7('0x43')]=[{'all':!![]}];}_0x40546c=_['merge']({},_0x40546c,_0xe2b232[_0x2be7('0x3e')]);return db[_0x2be7('0x2b')]['find'](_0x40546c)[_0x2be7('0x24')](handleEntityNotFound(_0x3b0dea,null))['then'](function(_0x1ca702){if(_0x1ca702){var _0xe985de=_0x1ca702[_0x2be7('0x25')]({'plain':!![]});_0xe985de=qs['omit'](_0xe985de,['id',_0x2be7('0x4d'),_0x2be7('0x4e')]);_0xe2b232[_0x2be7('0x4f')]=_['omit'](_0xe2b232[_0x2be7('0x4f')],['id',_0x2be7('0x4d'),_0x2be7('0x4e')]);return db[_0x2be7('0x2b')][_0x2be7('0x45')](_[_0x2be7('0x3d')](_0xe985de,_0xe2b232[_0x2be7('0x4f')]),{'include':_0xe2b232[_0x2be7('0x32')][_0x2be7('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x1f9b03){var _0x2e68cc=_0xe2b232[_0x2be7('0x47')][_0x2be7('0x25')]({'plain':!![]});if(!_0x2e68cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e68cc['role']===_0x2be7('0x47')){var _0x75c42f=_0x1f9b03[_0x2be7('0x25')]({'plain':!![]});var _0x177fc1=_0x2be7('0x26');return db['UserProfileSection'][_0x2be7('0x44')]({'where':{'name':_0x177fc1,'userProfileId':_0x2e68cc['userProfileId']},'raw':!![]})[_0x2be7('0x24')](function(_0x581ea4){if(_0x581ea4&&_0x581ea4['autoAssociation']===0x0){return db[_0x2be7('0x4a')][_0x2be7('0x45')]({'name':_0x75c42f[_0x2be7('0x29')],'resourceId':_0x75c42f['id'],'type':_0x581ea4[_0x2be7('0x29')],'sectionId':_0x581ea4['id']},{})['then'](function(){return _0x1f9b03;});}else{return _0x1f9b03;}})[_0x2be7('0x41')](function(_0x2b262e){logger['error'](_0x2be7('0x50'),_0x2b262e);throw _0x2b262e;});}return _0x1f9b03;});}})[_0x2be7('0x24')](respondWithResult(_0x3b0dea,0xc9))[_0x2be7('0x41')](handleError(_0x3b0dea,null));};exports['update']=function(_0x449fe7,_0x118f16){if(_0x449fe7[_0x2be7('0x4f')]['id']){delete _0x449fe7[_0x2be7('0x4f')]['id'];}return db[_0x2be7('0x2b')][_0x2be7('0x44')]({'where':{'id':_0x449fe7[_0x2be7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x118f16,null))[_0x2be7('0x24')](saveUpdates(_0x449fe7['body'],null))[_0x2be7('0x24')](respondWithResult(_0x118f16,null))['catch'](handleError(_0x118f16,null));};exports['destroy']=function(_0x4084fd,_0x307122){return db[_0x2be7('0x2b')][_0x2be7('0x44')]({'where':{'id':_0x4084fd[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x307122,null))[_0x2be7('0x24')](removeEntity(_0x307122,null))[_0x2be7('0x41')](handleError(_0x307122,null));};exports[_0x2be7('0x51')]=function(_0x4bdf3b,_0x1360e0,_0x44b7e1){var _0x5afdeb={'raw':!![],'where':{}};var _0x456cbc={};var _0x322c42={'count':0x0,'rows':[]};return db['Campaign'][_0x2be7('0x52')]({'where':{'id':_0x4bdf3b[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x1360e0,null))[_0x2be7('0x24')](function(_0x3cae55){if(_0x3cae55){_0x456cbc['model']=_['keys'](db[_0x2be7('0x53')][_0x2be7('0x2c')]);_0x456cbc[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x4bdf3b[_0x2be7('0x32')]);_0x456cbc[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x456cbc[_0x2be7('0x30')],_0x456cbc[_0x2be7('0x32')]);_0x5afdeb[_0x2be7('0x37')]=_['intersection'](_0x456cbc[_0x2be7('0x30')],qs[_0x2be7('0x36')](_0x4bdf3b[_0x2be7('0x32')]['fields']));_0x5afdeb[_0x2be7('0x37')]=_0x5afdeb[_0x2be7('0x37')][_0x2be7('0x38')]?_0x5afdeb[_0x2be7('0x37')]:_0x456cbc[_0x2be7('0x30')];if(!_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x54')](_0x2be7('0x55'))){_0x5afdeb[_0x2be7('0x1c')]=qs['limit'](_0x4bdf3b[_0x2be7('0x32')]['limit']);_0x5afdeb['offset']=qs[_0x2be7('0x1a')](_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x1a')]);}_0x5afdeb[_0x2be7('0x39')]=qs['sort'](_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x5afdeb[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x4bdf3b[_0x2be7('0x32')],_0x456cbc[_0x2be7('0x34')]));_0x5afdeb[_0x2be7('0x3b')][_0x2be7('0x57')]=_0x3cae55['id'];if(_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x5afdeb[_0x2be7('0x3b')]=_['merge'](_0x5afdeb[_0x2be7('0x3b')],{'$or':_['map'](_0x5afdeb[_0x2be7('0x37')],function(_0x16c036){var _0x397e87={};_0x397e87[_0x16c036]={'$like':'%'+_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x3c')]+'%'};return _0x397e87;})});}_0x5afdeb=_[_0x2be7('0x3d')]({},_0x5afdeb,_0x4bdf3b['options']);return db[_0x2be7('0x53')]['count']({'where':_0x5afdeb[_0x2be7('0x3b')]})['then'](function(_0x6770a9){_0x322c42[_0x2be7('0x1d')]=_0x6770a9;if(_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x5afdeb[_0x2be7('0x43')]=[{'all':!![]}];}return db[_0x2be7('0x53')][_0x2be7('0x58')](_0x5afdeb);})[_0x2be7('0x24')](function(_0x16d869){_0x322c42[_0x2be7('0x40')]=_0x16d869;return _0x322c42;});}})[_0x2be7('0x24')](respondWithFilteredResult(_0x1360e0,_0x5afdeb))['catch'](handleError(_0x1360e0,null));};exports[_0x2be7('0x59')]=function(_0x26087c,_0x1ea470,_0x5aefb9){var _0x3e1089={'raw':!![],'where':{}};var _0x307754={};var _0x4959ee={'count':0x0,'rows':[]};return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x26087c[_0x2be7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ea470,null))[_0x2be7('0x24')](function(_0x175902){if(_0x175902){_0x307754['model']=_['keys'](db['CmHopperHistory'][_0x2be7('0x2c')]);_0x307754[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x26087c['query']);_0x307754[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x307754[_0x2be7('0x30')],_0x307754[_0x2be7('0x32')]);_0x3e1089[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x307754['model'],qs['fields'](_0x26087c[_0x2be7('0x32')]['fields']));_0x3e1089[_0x2be7('0x37')]=_0x3e1089[_0x2be7('0x37')][_0x2be7('0x38')]?_0x3e1089['attributes']:_0x307754[_0x2be7('0x30')];if(!_0x26087c[_0x2be7('0x32')][_0x2be7('0x54')](_0x2be7('0x55'))){_0x3e1089[_0x2be7('0x1c')]=qs[_0x2be7('0x1c')](_0x26087c[_0x2be7('0x32')][_0x2be7('0x1c')]);_0x3e1089[_0x2be7('0x1a')]=qs[_0x2be7('0x1a')](_0x26087c['query'][_0x2be7('0x1a')]);}_0x3e1089[_0x2be7('0x39')]=qs[_0x2be7('0x3a')](_0x26087c['query'][_0x2be7('0x3a')]);_0x3e1089[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x26087c[_0x2be7('0x32')],_0x307754[_0x2be7('0x34')]));_0x3e1089['where'][_0x2be7('0x57')]=_0x175902['id'];if(_0x26087c[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x3e1089[_0x2be7('0x3b')]=_[_0x2be7('0x3d')](_0x3e1089[_0x2be7('0x3b')],{'$or':_[_0x2be7('0x31')](_0x3e1089['attributes'],function(_0x23e4d6){var _0x5d37e1={};_0x5d37e1[_0x23e4d6]={'$like':'%'+_0x26087c[_0x2be7('0x32')]['filter']+'%'};return _0x5d37e1;})});}_0x3e1089=_[_0x2be7('0x3d')]({},_0x3e1089,_0x26087c[_0x2be7('0x3e')]);return db['CmHopperHistory'][_0x2be7('0x1d')]({'where':_0x3e1089[_0x2be7('0x3b')]})['then'](function(_0xd7e3a6){_0x4959ee[_0x2be7('0x1d')]=_0xd7e3a6;if(_0x26087c[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x3e1089[_0x2be7('0x43')]=[{'all':!![]}];}return db[_0x2be7('0x5a')][_0x2be7('0x58')](_0x3e1089);})['then'](function(_0x3e82e0){_0x4959ee[_0x2be7('0x40')]=_0x3e82e0;return _0x4959ee;});}})[_0x2be7('0x24')](respondWithFilteredResult(_0x1ea470,_0x3e1089))['catch'](handleError(_0x1ea470,null));};exports[_0x2be7('0x5b')]=function(_0x12393c,_0x4c0139,_0x4cf138){var _0x166f52={'raw':!![],'where':{}};var _0x5bd0c4={};var _0x4a09e8={'count':0x0,'rows':[]};return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x12393c[_0x2be7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c0139,null))[_0x2be7('0x24')](function(_0x551fe1){if(_0x551fe1){_0x5bd0c4[_0x2be7('0x30')]=_[_0x2be7('0x33')](db[_0x2be7('0x5c')][_0x2be7('0x2c')]);_0x5bd0c4[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x12393c['query']);_0x5bd0c4[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x5bd0c4['model'],_0x5bd0c4[_0x2be7('0x32')]);_0x166f52[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x5bd0c4[_0x2be7('0x30')],qs[_0x2be7('0x36')](_0x12393c[_0x2be7('0x32')][_0x2be7('0x36')]));_0x166f52['attributes']=_0x166f52[_0x2be7('0x37')][_0x2be7('0x38')]?_0x166f52[_0x2be7('0x37')]:_0x5bd0c4['model'];if(!_0x12393c[_0x2be7('0x32')][_0x2be7('0x54')](_0x2be7('0x55'))){_0x166f52[_0x2be7('0x1c')]=qs[_0x2be7('0x1c')](_0x12393c['query'][_0x2be7('0x1c')]);_0x166f52[_0x2be7('0x1a')]=qs['offset'](_0x12393c[_0x2be7('0x32')][_0x2be7('0x1a')]);}_0x166f52[_0x2be7('0x39')]=qs[_0x2be7('0x3a')](_0x12393c[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x166f52[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x12393c['query'],_0x5bd0c4[_0x2be7('0x34')]));_0x166f52['where'][_0x2be7('0x57')]=_0x551fe1['id'];if(_0x12393c[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x166f52[_0x2be7('0x3b')]=_['merge'](_0x166f52['where'],{'$or':_[_0x2be7('0x31')](_0x166f52['attributes'],function(_0xee061e){var _0x24dd77={};_0x24dd77[_0xee061e]={'$like':'%'+_0x12393c[_0x2be7('0x32')]['filter']+'%'};return _0x24dd77;})});}_0x166f52=_[_0x2be7('0x3d')]({},_0x166f52,_0x12393c[_0x2be7('0x3e')]);return db[_0x2be7('0x5c')][_0x2be7('0x1d')]({'where':_0x166f52['where']})[_0x2be7('0x24')](function(_0x4ce5ba){_0x4a09e8[_0x2be7('0x1d')]=_0x4ce5ba;if(_0x12393c[_0x2be7('0x32')]['includeAll']){_0x166f52[_0x2be7('0x43')]=[{'all':!![]}];}return db[_0x2be7('0x5c')][_0x2be7('0x58')](_0x166f52);})[_0x2be7('0x24')](function(_0x5d325a){_0x4a09e8[_0x2be7('0x40')]=_0x5d325a;return _0x4a09e8;});}})['then'](respondWithFilteredResult(_0x4c0139,_0x166f52))['catch'](handleError(_0x4c0139,null));};exports[_0x2be7('0x5d')]=function(_0x59fd75,_0xe0cb06,_0x4dc152){var _0x431b6a={'raw':!![],'where':{}};var _0x333a39={};var _0x1c821c={'count':0x0,'rows':[]};return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x59fd75[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0xe0cb06,null))['then'](function(_0x35d47f){if(_0x35d47f){_0x333a39[_0x2be7('0x30')]=_[_0x2be7('0x33')](db['CmHopperBlack'][_0x2be7('0x2c')]);_0x333a39['query']=_[_0x2be7('0x33')](_0x59fd75['query']);_0x333a39['filters']=_['intersection'](_0x333a39[_0x2be7('0x30')],_0x333a39['query']);_0x431b6a[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x333a39['model'],qs[_0x2be7('0x36')](_0x59fd75['query'][_0x2be7('0x36')]));_0x431b6a[_0x2be7('0x37')]=_0x431b6a[_0x2be7('0x37')]['length']?_0x431b6a['attributes']:_0x333a39[_0x2be7('0x30')];if(!_0x59fd75['query'][_0x2be7('0x54')](_0x2be7('0x55'))){_0x431b6a['limit']=qs[_0x2be7('0x1c')](_0x59fd75[_0x2be7('0x32')][_0x2be7('0x1c')]);_0x431b6a['offset']=qs[_0x2be7('0x1a')](_0x59fd75[_0x2be7('0x32')][_0x2be7('0x1a')]);}_0x431b6a[_0x2be7('0x39')]=qs[_0x2be7('0x3a')](_0x59fd75[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x431b6a['where']=qs[_0x2be7('0x34')](_['pick'](_0x59fd75[_0x2be7('0x32')],_0x333a39[_0x2be7('0x34')]));_0x431b6a[_0x2be7('0x3b')][_0x2be7('0x57')]=_0x35d47f['id'];if(_0x59fd75[_0x2be7('0x32')]['filter']){_0x431b6a[_0x2be7('0x3b')]=_[_0x2be7('0x3d')](_0x431b6a[_0x2be7('0x3b')],{'$or':_[_0x2be7('0x31')](_0x431b6a[_0x2be7('0x37')],function(_0x620e58){var _0x10b757={};_0x10b757[_0x620e58]={'$like':'%'+_0x59fd75[_0x2be7('0x32')][_0x2be7('0x3c')]+'%'};return _0x10b757;})});}_0x431b6a=_[_0x2be7('0x3d')]({},_0x431b6a,_0x59fd75[_0x2be7('0x3e')]);return db[_0x2be7('0x5e')][_0x2be7('0x1d')]({'where':_0x431b6a['where']})[_0x2be7('0x24')](function(_0x5f0d10){_0x1c821c[_0x2be7('0x1d')]=_0x5f0d10;if(_0x59fd75[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x431b6a['include']=[{'all':!![]}];}return db[_0x2be7('0x5e')][_0x2be7('0x58')](_0x431b6a);})[_0x2be7('0x24')](function(_0x36f68e){_0x1c821c[_0x2be7('0x40')]=_0x36f68e;return _0x1c821c;});}})[_0x2be7('0x24')](respondWithFilteredResult(_0xe0cb06,_0x431b6a))[_0x2be7('0x41')](handleError(_0xe0cb06,null));};exports[_0x2be7('0x5f')]=function(_0x4832a1,_0x4d03e5,_0x2d708b){var _0x174c4f={};var _0x3b65f7={};var _0x3ce945;var _0x2e50ba;return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x4832a1[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x4d03e5,null))[_0x2be7('0x24')](function(_0x142954){if(_0x142954){_0x3ce945=_0x142954;_0x3b65f7['model']=_['keys'](db[_0x2be7('0x60')][_0x2be7('0x2c')]);_0x3b65f7[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x4832a1[_0x2be7('0x32')]);_0x3b65f7[_0x2be7('0x34')]=_['intersection'](_0x3b65f7[_0x2be7('0x30')],_0x3b65f7[_0x2be7('0x32')]);_0x174c4f[_0x2be7('0x37')]=_['intersection'](_0x3b65f7[_0x2be7('0x30')],qs[_0x2be7('0x36')](_0x4832a1[_0x2be7('0x32')][_0x2be7('0x36')]));_0x174c4f[_0x2be7('0x37')]=_0x174c4f[_0x2be7('0x37')][_0x2be7('0x38')]?_0x174c4f[_0x2be7('0x37')]:_0x3b65f7[_0x2be7('0x30')];_0x174c4f['order']=qs[_0x2be7('0x3a')](_0x4832a1[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x174c4f[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x4832a1[_0x2be7('0x32')],_0x3b65f7[_0x2be7('0x34')]));if(_0x4832a1[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x174c4f[_0x2be7('0x3b')]=_[_0x2be7('0x3d')](_0x174c4f[_0x2be7('0x3b')],{'$or':_['map'](_0x174c4f[_0x2be7('0x37')],function(_0x31c5af){var _0x4265c3={};_0x4265c3[_0x31c5af]={'$like':'%'+_0x4832a1['query'][_0x2be7('0x3c')]+'%'};return _0x4265c3;})});}_0x174c4f=_[_0x2be7('0x3d')]({},_0x174c4f,_0x4832a1['options']);return _0x3ce945['getLists'](_0x174c4f);}})[_0x2be7('0x24')](function(_0x1fb344){if(_0x1fb344){_0x2e50ba=_0x1fb344[_0x2be7('0x38')];if(!_0x4832a1[_0x2be7('0x32')][_0x2be7('0x54')]('nolimit')){_0x174c4f[_0x2be7('0x1c')]=qs[_0x2be7('0x1c')](_0x4832a1[_0x2be7('0x32')][_0x2be7('0x1c')]);_0x174c4f[_0x2be7('0x1a')]=qs[_0x2be7('0x1a')](_0x4832a1[_0x2be7('0x32')][_0x2be7('0x1a')]);}return _0x3ce945[_0x2be7('0x5f')](_0x174c4f);}})[_0x2be7('0x24')](function(_0x49ef37){if(_0x49ef37){return _0x49ef37?{'count':_0x2e50ba,'rows':_0x49ef37}:null;}})[_0x2be7('0x24')](respondWithResult(_0x4d03e5,null))[_0x2be7('0x41')](handleError(_0x4d03e5,null));};exports[_0x2be7('0x61')]=function(_0x3b1146,_0x1885a4,_0x494380){var _0x23c775,_0x35f56b;return db['Campaign'][_0x2be7('0x44')]({'where':{'id':_0x3b1146[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x1885a4,null))[_0x2be7('0x24')](function(_0x2e4ae8){if(_0x2e4ae8){_0x35f56b=_0x2e4ae8;return _0x2e4ae8[_0x2be7('0x61')](_0x3b1146[_0x2be7('0x4f')][_0x2be7('0x62')],_[_0x2be7('0x63')](_0x3b1146['body'],['ids','id'])||{});}return null;})[_0x2be7('0x64')](function(_0x1141d2){var _0x22fdf4;_0x23c775=_0x1141d2||[];var _0x2711a9=[];if(_0x1141d2){for(var _0x847256=0x0;_0x847256<_0x1141d2['length'];_0x847256+=0x1){var _0x2dec55=_0x1141d2[_0x847256]['get']({'plain':!![]});_0x35f56b[_0x2be7('0x65')]=_0x3b1146[_0x2be7('0x4f')][_0x2be7('0x65')]?_0x3b1146[_0x2be7('0x4f')][_0x2be7('0x65')]:_0x35f56b[_0x2be7('0x65')];switch(_0x35f56b[_0x2be7('0x65')]){case _0x2be7('0x66'):_0x22fdf4=squel[_0x2be7('0x67')]()[_0x2be7('0x68')](_0x2be7('0x69'))[_0x2be7('0x6a')]([_0x2be7('0x6b'),_0x2be7('0x6c'),_0x2be7('0x6d'),_0x2be7('0x6e'),_0x2be7('0x57'),_0x2be7('0x4d'),'updatedAt'],squel[_0x2be7('0x6f')]()[_0x2be7('0x70')](_0x2be7('0x6b'),_0x2be7('0x6b'))[_0x2be7('0x70')]('NOW()',_0x2be7('0x6c'))[_0x2be7('0x70')]('id',_0x2be7('0x6d'))['field'](_0x2dec55['CmListId'][_0x2be7('0x71')](),'ListId')[_0x2be7('0x70')](_0x3b1146[_0x2be7('0x4c')]['id'][_0x2be7('0x71')](),_0x2be7('0x57'))[_0x2be7('0x70')]('NOW()','createdAt')[_0x2be7('0x70')](_0x2be7('0x72'),_0x2be7('0x4e'))[_0x2be7('0x73')](_0x2be7('0x74'))[_0x2be7('0x3b')](_0x2be7('0x75'))['where'](_0x2be7('0x76'),_0x2dec55[_0x2be7('0x77')][_0x2be7('0x71')]())[_0x2be7('0x3b')](_0x2be7('0x78'))[_0x2be7('0x3b')](_0x2be7('0x79'),squel[_0x2be7('0x6f')]()[_0x2be7('0x70')](_0x2be7('0x7a'))[_0x2be7('0x73')](_0x2be7('0x7b'))[_0x2be7('0x3b')](_0x2be7('0x7c'),_0x3b1146[_0x2be7('0x4c')]['id']['toString']()))[_0x2be7('0x3b')](_0x2be7('0x79'),squel[_0x2be7('0x6f')]()[_0x2be7('0x70')]('COALESCE(phone,\x27\x27)')[_0x2be7('0x73')](_0x2be7('0x69'))['where'](_0x2be7('0x7c'),_0x3b1146[_0x2be7('0x4c')]['id']['toString']())))['toString']();break;case _0x2be7('0x7d'):_0x22fdf4=squel[_0x2be7('0x67')]()['into'](_0x2be7('0x69'))[_0x2be7('0x6a')]([_0x2be7('0x6b'),_0x2be7('0x6c'),_0x2be7('0x6d'),'ListId','CampaignId',_0x2be7('0x4d'),_0x2be7('0x4e')],squel[_0x2be7('0x6f')]()['field'](_0x2be7('0x6b'),_0x2be7('0x6b'))[_0x2be7('0x70')]('NOW()','scheduledAt')[_0x2be7('0x70')]('id',_0x2be7('0x6d'))['field'](_0x2dec55[_0x2be7('0x77')][_0x2be7('0x71')](),_0x2be7('0x6e'))[_0x2be7('0x70')](_0x3b1146[_0x2be7('0x4c')]['id'][_0x2be7('0x71')](),'CampaignId')[_0x2be7('0x70')](_0x2be7('0x72'),_0x2be7('0x4d'))[_0x2be7('0x70')](_0x2be7('0x72'),_0x2be7('0x4e'))[_0x2be7('0x73')]('cm_contacts')[_0x2be7('0x3b')]('deletedAt\x20IS\x20NULL')[_0x2be7('0x3b')](_0x2be7('0x76'),_0x2dec55[_0x2be7('0x77')][_0x2be7('0x71')]())[_0x2be7('0x3b')](_0x2be7('0x78'))[_0x2be7('0x3b')](_0x2be7('0x79'),squel[_0x2be7('0x6f')]()[_0x2be7('0x70')](_0x2be7('0x7e'))[_0x2be7('0x73')]('cm_hopper')[_0x2be7('0x3b')](_0x2be7('0x7c'),_0x3b1146[_0x2be7('0x4c')]['id'][_0x2be7('0x71')]())))['toString']();break;default:_0x22fdf4=squel[_0x2be7('0x67')]()['into']('cm_hopper')['fromQuery']([_0x2be7('0x6b'),_0x2be7('0x6c'),_0x2be7('0x6d'),_0x2be7('0x6e'),_0x2be7('0x57'),_0x2be7('0x4d'),_0x2be7('0x4e')],squel[_0x2be7('0x6f')]()['field'](_0x2be7('0x6b'),'phone')[_0x2be7('0x70')]('NOW()',_0x2be7('0x6c'))[_0x2be7('0x70')]('id',_0x2be7('0x6d'))['field'](_0x2dec55[_0x2be7('0x77')]['toString'](),_0x2be7('0x6e'))['field'](_0x3b1146[_0x2be7('0x4c')]['id'][_0x2be7('0x71')](),_0x2be7('0x57'))[_0x2be7('0x70')]('NOW()',_0x2be7('0x4d'))['field'](_0x2be7('0x72'),_0x2be7('0x4e'))[_0x2be7('0x73')](_0x2be7('0x74'))[_0x2be7('0x3b')](_0x2be7('0x75'))[_0x2be7('0x3b')](_0x2be7('0x76'),_0x2dec55[_0x2be7('0x77')][_0x2be7('0x71')]())[_0x2be7('0x3b')](_0x2be7('0x78')))[_0x2be7('0x71')]();}_0x2711a9[_0x2be7('0x7f')](db[_0x2be7('0x80')][_0x2be7('0x32')](_0x22fdf4));}return BPromise['all'](_0x2711a9);}})[_0x2be7('0x24')](function(){return _0x23c775;})[_0x2be7('0x24')](respondWithResult(_0x1885a4,null))[_0x2be7('0x41')](handleError(_0x1885a4,null));};exports[_0x2be7('0x81')]=function(_0x5ef377,_0x335986,_0x280d21){return db[_0x2be7('0x2b')][_0x2be7('0x44')]({'where':{'id':_0x5ef377['params']['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x335986,null))[_0x2be7('0x24')](function(_0xd09e0b){if(_0xd09e0b){return _0xd09e0b['removeLists'](_0x5ef377[_0x2be7('0x32')]['ids']);}})['then'](function(_0x848cef){if(_0x848cef){return db['CmHopper'][_0x2be7('0x23')]({'where':{'ListId':_0x5ef377[_0x2be7('0x32')]['ids'],'CampaignId':_0x5ef377['params']['id']}})[_0x2be7('0x24')](function(){return _0x848cef;});}})['then'](respondWithStatusCode(_0x335986,null))[_0x2be7('0x41')](handleError(_0x335986,null));};exports[_0x2be7('0x82')]=function(_0x341edc,_0x2c6484,_0x4fb989){var _0x16a350={};var _0x42305e={};var _0x3f4d9b;var _0x1efa06;return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x341edc['params']['id']}})['then'](handleEntityNotFound(_0x2c6484,null))['then'](function(_0x413003){if(_0x413003){_0x3f4d9b=_0x413003;_0x42305e[_0x2be7('0x30')]=_[_0x2be7('0x33')](db[_0x2be7('0x60')][_0x2be7('0x2c')]);_0x42305e[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x341edc['query']);_0x42305e[_0x2be7('0x34')]=_['intersection'](_0x42305e['model'],_0x42305e[_0x2be7('0x32')]);_0x16a350[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x42305e['model'],qs[_0x2be7('0x36')](_0x341edc[_0x2be7('0x32')][_0x2be7('0x36')]));_0x16a350[_0x2be7('0x37')]=_0x16a350[_0x2be7('0x37')][_0x2be7('0x38')]?_0x16a350[_0x2be7('0x37')]:_0x42305e[_0x2be7('0x30')];_0x16a350['order']=qs[_0x2be7('0x3a')](_0x341edc[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x16a350[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x341edc[_0x2be7('0x32')],_0x42305e[_0x2be7('0x34')]));if(_0x341edc[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x16a350[_0x2be7('0x3b')]=_[_0x2be7('0x3d')](_0x16a350['where'],{'$or':_[_0x2be7('0x31')](_0x16a350['attributes'],function(_0x52ca73){var _0x54af26={};_0x54af26[_0x52ca73]={'$like':'%'+_0x341edc[_0x2be7('0x32')][_0x2be7('0x3c')]+'%'};return _0x54af26;})});}_0x16a350=_[_0x2be7('0x3d')]({},_0x16a350,_0x341edc['options']);return _0x3f4d9b['getBlackLists'](_0x16a350);}})[_0x2be7('0x24')](function(_0x592927){if(_0x592927){_0x1efa06=_0x592927['length'];if(!_0x341edc[_0x2be7('0x32')][_0x2be7('0x54')](_0x2be7('0x55'))){_0x16a350[_0x2be7('0x1c')]=qs['limit'](_0x341edc[_0x2be7('0x32')][_0x2be7('0x1c')]);_0x16a350[_0x2be7('0x1a')]=qs[_0x2be7('0x1a')](_0x341edc[_0x2be7('0x32')][_0x2be7('0x1a')]);}return _0x3f4d9b[_0x2be7('0x82')](_0x16a350);}})['then'](function(_0x493b67){if(_0x493b67){return _0x493b67?{'count':_0x1efa06,'rows':_0x493b67}:null;}})[_0x2be7('0x24')](respondWithResult(_0x2c6484,null))['catch'](handleError(_0x2c6484,null));};exports[_0x2be7('0x83')]=function(_0x44f59f,_0x184a1c,_0x190a93){var _0x28bb4b,_0x1c9397;return db[_0x2be7('0x2b')][_0x2be7('0x44')]({'where':{'id':_0x44f59f[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x184a1c,null))['then'](function(_0x34da78){if(_0x34da78){_0x1c9397=_0x34da78;return _0x34da78[_0x2be7('0x83')](_0x44f59f['body'][_0x2be7('0x62')],_[_0x2be7('0x63')](_0x44f59f['body'],[_0x2be7('0x62'),'id'])||{});}return null;})[_0x2be7('0x64')](function(_0x5f510a){var _0x3d253c;_0x28bb4b=_0x5f510a||[];var _0x4c62fe=[];if(_0x5f510a){for(var _0x384dd2=0x0;_0x384dd2<_0x5f510a[_0x2be7('0x38')];_0x384dd2+=0x1){var _0x577781=_0x5f510a[_0x384dd2][_0x2be7('0x25')]({'plain':!![]});_0x3d253c=squel[_0x2be7('0x67')]()[_0x2be7('0x68')](_0x2be7('0x84'))[_0x2be7('0x6a')]([_0x2be7('0x6b'),_0x2be7('0x6d'),_0x2be7('0x6e'),'CampaignId',_0x2be7('0x4d'),'updatedAt'],squel[_0x2be7('0x6f')]()[_0x2be7('0x70')](_0x2be7('0x6b'),_0x2be7('0x6b'))[_0x2be7('0x70')]('id','ContactId')[_0x2be7('0x70')](_0x577781[_0x2be7('0x77')][_0x2be7('0x71')](),_0x2be7('0x6e'))['field'](_0x44f59f[_0x2be7('0x4c')]['id'][_0x2be7('0x71')](),_0x2be7('0x57'))[_0x2be7('0x70')](_0x2be7('0x72'),_0x2be7('0x4d'))[_0x2be7('0x70')]('NOW()','updatedAt')[_0x2be7('0x73')](_0x2be7('0x74'))[_0x2be7('0x3b')](_0x2be7('0x75'))['where'](_0x2be7('0x76'),_0x577781['CmListId'][_0x2be7('0x71')]())['where'](_0x2be7('0x78')))[_0x2be7('0x71')]();_0x4c62fe[_0x2be7('0x7f')](db[_0x2be7('0x80')][_0x2be7('0x32')](_0x3d253c));}return BPromise[_0x2be7('0x85')](_0x4c62fe);}})[_0x2be7('0x24')](function(){return _0x28bb4b;})[_0x2be7('0x24')](respondWithResult(_0x184a1c,null))[_0x2be7('0x41')](handleError(_0x184a1c,null));};exports['removeBlackLists']=function(_0x319213,_0x1e8de1,_0x214375){return db['Campaign'][_0x2be7('0x44')]({'where':{'id':_0x319213['params']['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x1e8de1,null))[_0x2be7('0x24')](function(_0x2cd476){if(_0x2cd476){return _0x2cd476[_0x2be7('0x86')](_0x319213['query']['ids']);}})[_0x2be7('0x24')](function(_0x3bc67e){if(_0x3bc67e){return db['CmHopperBlack'][_0x2be7('0x23')]({'where':{'ListId':_0x319213['query'][_0x2be7('0x62')],'CampaignId':_0x319213['params']['id']}})[_0x2be7('0x24')](function(){return _0x3bc67e;});}})[_0x2be7('0x24')](respondWithStatusCode(_0x1e8de1,null))[_0x2be7('0x41')](handleError(_0x1e8de1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e1c970a..d97db0f 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 34bc028..9fe1161 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 _0xb469=['include','model','map','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Campaign,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','GetCampaign','findAll','options','raw','attributes','limit'];(function(_0x38eb46,_0x366b44){var _0x42d083=function(_0x4c555b){while(--_0x4c555b){_0x38eb46['push'](_0x38eb46['shift']());}};_0x42d083(++_0x366b44);}(_0xb469,0x13b));var _0x9b46=function(_0x2b7e85,_0x20350a){_0x2b7e85=_0x2b7e85-0x0;var _0x5107e8=_0xb469[_0x2b7e85];return _0x5107e8;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});}exports[_0x9b46('0x14')]=function(_0x5c5cc9){var _0x5dd7bd=this;return new Promise(function(_0x3d9efa,_0x4ccfd0){return db['Campaign'][_0x9b46('0x15')]({'raw':_0x5c5cc9[_0x9b46('0x16')]?_0x5c5cc9['options'][_0x9b46('0x17')]===undefined?!![]:![]:!![],'where':_0x5c5cc9[_0x9b46('0x16')]?_0x5c5cc9['options']['where']||null:null,'attributes':_0x5c5cc9[_0x9b46('0x16')]?_0x5c5cc9[_0x9b46('0x16')][_0x9b46('0x18')]||null:null,'limit':_0x5c5cc9['options']?_0x5c5cc9['options'][_0x9b46('0x19')]||null:null,'include':_0x5c5cc9['options']?_0x5c5cc9[_0x9b46('0x16')][_0x9b46('0x1a')]?_['map'](_0x5c5cc9[_0x9b46('0x16')]['include'],function(_0x141cb6){return{'model':db[_0x141cb6[_0x9b46('0x1b')]],'as':_0x141cb6['as'],'attributes':_0x141cb6['attributes'],'include':_0x141cb6[_0x9b46('0x1a')]?_[_0x9b46('0x1c')](_0x141cb6[_0x9b46('0x1a')],function(_0x319930){return{'model':db[_0x319930[_0x9b46('0x1b')]],'as':_0x319930['as'],'attributes':_0x319930[_0x9b46('0x18')],'include':_0x319930[_0x9b46('0x1a')]?_['map'](_0x319930[_0x9b46('0x1a')],function(_0x3ac37e){return{'model':db[_0x3ac37e[_0x9b46('0x1b')]],'as':_0x3ac37e['as'],'attributes':_0x3ac37e[_0x9b46('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9b46('0xc')](function(_0x2a79a5){logger[_0x9b46('0x12')]('GetCampaign',_0x5c5cc9);logger[_0x9b46('0xe')](_0x9b46('0x14'),_0x5c5cc9,JSON[_0x9b46('0x1d')](_0x2a79a5));_0x3d9efa(_0x2a79a5);})[_0x9b46('0x1e')](function(_0x28b289){logger[_0x9b46('0x10')](_0x9b46('0x14'),_0x28b289[_0x9b46('0x11')],_0x5c5cc9);_0x4ccfd0(_0x5dd7bd[_0x9b46('0x10')](0x1f4,_0x28b289[_0x9b46('0x11')]));});});}; \ No newline at end of file +var _0xb18e=['attributes','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','include','map','model'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb18e,0x181));var _0xeb18=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0xb18e[_0x385eb1];return _0x5d40eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeb18('0x0'));var BPromise=require('bluebird');var rs=require(_0xeb18('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb18('0x2'))['db'];var utils=require(_0xeb18('0x3'));var logger=require('../../config/logger')(_0xeb18('0x4'));var config=require(_0xeb18('0x5'));var jayson=require(_0xeb18('0x6'));var client=jayson[_0xeb18('0x7')][_0xeb18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x183bdf,_0x4a9ddd,_0x1bc3ee){return new BPromise(function(_0x131389,_0x534358){return client[_0xeb18('0x9')](_0x183bdf,_0x1bc3ee)[_0xeb18('0xa')](function(_0x942945){logger[_0xeb18('0xb')](_0xeb18('0xc'),_0x4a9ddd,_0xeb18('0xd'));logger[_0xeb18('0xe')](_0xeb18('0xf'),_0x4a9ddd,_0xeb18('0xd'),JSON[_0xeb18('0x10')](_0x942945));if(_0x942945['error']){if(_0x942945[_0xeb18('0x11')][_0xeb18('0x12')]===0x1f4){logger['error'](_0xeb18('0xc'),_0x4a9ddd,_0x942945['error']['message']);return _0x534358(_0x942945[_0xeb18('0x11')][_0xeb18('0x13')]);}logger[_0xeb18('0x11')]('Campaign,\x20%s,\x20%s',_0x4a9ddd,_0x942945['error'][_0xeb18('0x13')]);return _0x131389(_0x942945[_0xeb18('0x11')]['message']);}else{logger[_0xeb18('0xb')](_0xeb18('0xc'),_0x4a9ddd,_0xeb18('0xd'));_0x131389(_0x942945['result'][_0xeb18('0x13')]);}})[_0xeb18('0x14')](function(_0x318043){logger[_0xeb18('0x11')](_0xeb18('0xc'),_0x4a9ddd,_0x318043);_0x534358(_0x318043);});});}exports[_0xeb18('0x15')]=function(_0x284733){var _0x5bc586=this;return new Promise(function(_0x30f706,_0x5c4adc){return db[_0xeb18('0x16')][_0xeb18('0x17')]({'raw':_0x284733[_0xeb18('0x18')]?_0x284733[_0xeb18('0x18')][_0xeb18('0x19')]===undefined?!![]:![]:!![],'where':_0x284733['options']?_0x284733[_0xeb18('0x18')][_0xeb18('0x1a')]||null:null,'attributes':_0x284733[_0xeb18('0x18')]?_0x284733[_0xeb18('0x18')]['attributes']||null:null,'limit':_0x284733[_0xeb18('0x18')]?_0x284733[_0xeb18('0x18')][_0xeb18('0x1b')]||null:null,'include':_0x284733[_0xeb18('0x18')]?_0x284733[_0xeb18('0x18')][_0xeb18('0x1c')]?_[_0xeb18('0x1d')](_0x284733[_0xeb18('0x18')][_0xeb18('0x1c')],function(_0x7464fd){return{'model':db[_0x7464fd[_0xeb18('0x1e')]],'as':_0x7464fd['as'],'attributes':_0x7464fd[_0xeb18('0x1f')],'include':_0x7464fd['include']?_[_0xeb18('0x1d')](_0x7464fd['include'],function(_0x51867f){return{'model':db[_0x51867f[_0xeb18('0x1e')]],'as':_0x51867f['as'],'attributes':_0x51867f[_0xeb18('0x1f')],'include':_0x51867f[_0xeb18('0x1c')]?_[_0xeb18('0x1d')](_0x51867f[_0xeb18('0x1c')],function(_0x48d10b){return{'model':db[_0x48d10b['model']],'as':_0x48d10b['as'],'attributes':_0x48d10b[_0xeb18('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeb18('0xa')](function(_0x3312d8){logger['info'](_0xeb18('0x15'),_0x284733);logger[_0xeb18('0xe')]('GetCampaign',_0x284733,JSON[_0xeb18('0x10')](_0x3312d8));_0x30f706(_0x3312d8);})['catch'](function(_0x54e62b){logger['error']('GetCampaign',_0x54e62b['message'],_0x284733);_0x5c4adc(_0x5bc586[_0xeb18('0x11')](0x1f4,_0x54e62b[_0xeb18('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 69741be..76d04d6 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 _0x4eaf=['../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','put','delete','removeBlackLists','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5bfcdb,_0x542098){var _0x3c13c0=function(_0x1cb487){while(--_0x1cb487){_0x5bfcdb['push'](_0x5bfcdb['shift']());}};_0x3c13c0(++_0x542098);}(_0x4eaf,0x112));var _0xf4ea=function(_0x283476,_0xaae5d7){_0x283476=_0x283476-0x0;var _0x122d8e=_0x4eaf[_0x283476];return _0x122d8e;};'use strict';var multer=require(_0xf4ea('0x0'));var util=require('util');var path=require(_0xf4ea('0x1'));var timeout=require(_0xf4ea('0x2'));var express=require(_0xf4ea('0x3'));var router=express['Router']();var fs_extra=require(_0xf4ea('0x4'));var auth=require(_0xf4ea('0x5'));var interaction=require(_0xf4ea('0x6'));var config=require(_0xf4ea('0x7'));var controller=require(_0xf4ea('0x8'));router[_0xf4ea('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf4ea('0xa'),auth[_0xf4ea('0xb')](),controller['show']);router[_0xf4ea('0x9')]('/:id/hoppers',auth[_0xf4ea('0xb')](),controller['getHoppers']);router[_0xf4ea('0x9')](_0xf4ea('0xc'),auth['isAuthenticated'](),controller[_0xf4ea('0xd')]);router[_0xf4ea('0x9')](_0xf4ea('0xe'),auth[_0xf4ea('0xb')](),controller[_0xf4ea('0xf')]);router[_0xf4ea('0x9')](_0xf4ea('0x10'),auth[_0xf4ea('0xb')](),controller[_0xf4ea('0x11')]);router[_0xf4ea('0x9')](_0xf4ea('0x12'),auth[_0xf4ea('0xb')](),controller['getLists']);router[_0xf4ea('0x9')](_0xf4ea('0x13'),auth[_0xf4ea('0xb')](),controller[_0xf4ea('0x14')]);router[_0xf4ea('0x15')]('/',auth[_0xf4ea('0xb')](),controller['create']);router[_0xf4ea('0x15')](_0xf4ea('0x16'),auth[_0xf4ea('0xb')](),controller[_0xf4ea('0x17')]);router['post']('/:id/lists',auth[_0xf4ea('0xb')](),controller[_0xf4ea('0x18')]);router['post']('/:id/blacklists',auth[_0xf4ea('0xb')](),controller['addBlackLists']);router[_0xf4ea('0x19')](_0xf4ea('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xf4ea('0x1a')](_0xf4ea('0xa'),auth[_0xf4ea('0xb')](),controller['destroy']);router['delete']('/:id/lists',auth[_0xf4ea('0xb')](),controller['removeLists']);router[_0xf4ea('0x1a')]('/:id/blacklists',auth[_0xf4ea('0xb')](),controller[_0xf4ea('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xc770=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','isAuthenticated','/:id/hoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','create','/:id/clone','/:id/lists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists'];(function(_0x169877,_0x282159){var _0x220d3d=function(_0x34b6b2){while(--_0x34b6b2){_0x169877['push'](_0x169877['shift']());}};_0x220d3d(++_0x282159);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c77('0x2'));var router=express[_0x0c77('0x3')]();var fs_extra=require(_0x0c77('0x4'));var auth=require(_0x0c77('0x5'));var interaction=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var controller=require(_0x0c77('0x8'));router[_0x0c77('0x9')]('/',auth['isAuthenticated'](),controller[_0x0c77('0xa')]);router[_0x0c77('0x9')]('/:id',auth[_0x0c77('0xb')](),controller['show']);router[_0x0c77('0x9')](_0x0c77('0xc'),auth[_0x0c77('0xb')](),controller['getHoppers']);router[_0x0c77('0x9')](_0x0c77('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x0c77('0x9')]('/:id/hopper_finals',auth[_0x0c77('0xb')](),controller[_0x0c77('0xe')]);router['get'](_0x0c77('0xf'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x10')]);router[_0x0c77('0x9')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x0c77('0x9')](_0x0c77('0x11'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x12')]);router['post']('/',auth[_0x0c77('0xb')](),controller[_0x0c77('0x13')]);router['post'](_0x0c77('0x14'),auth[_0x0c77('0xb')](),controller['clone']);router['post'](_0x0c77('0x15'),auth[_0x0c77('0xb')](),controller['addLists']);router['post'](_0x0c77('0x11'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x16')]);router[_0x0c77('0x17')]('/:id',auth[_0x0c77('0xb')](),controller[_0x0c77('0x18')]);router[_0x0c77('0x19')]('/:id',auth[_0x0c77('0xb')](),controller[_0x0c77('0x1a')]);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0x0c77('0x1b')]);router[_0x0c77('0x19')](_0x0c77('0x11'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x1c')]);module[_0x0c77('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c32c6ae..c414e21 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 _0x9ddc=['getDataValue','key','sequelize','exports','TEXT','STRING','VIRTUAL'];(function(_0x3231da,_0x3ae101){var _0x256829=function(_0x57e2d7){while(--_0x57e2d7){_0x3231da['push'](_0x3231da['shift']());}};_0x256829(++_0x3ae101);}(_0x9ddc,0x64));var _0xc9dd=function(_0x258ccf,_0x59e5be){_0x258ccf=_0x258ccf-0x0;var _0x17df41=_0x9ddc[_0x258ccf];return _0x17df41;};'use strict';var Sequelize=require(_0xc9dd('0x0'));module[_0xc9dd('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xc9dd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc9dd('0x3')]},'name':{'type':Sequelize[_0xc9dd('0x4')],'get':function(){return this[_0xc9dd('0x5')](_0xc9dd('0x6'));}}}; \ No newline at end of file +var _0xd87a=['exports','STRING','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x4de86b,_0x5eb642){var _0x306c57=function(_0x20ab50){while(--_0x20ab50){_0x4de86b['push'](_0x4de86b['shift']());}};_0x306c57(++_0x5eb642);}(_0xd87a,0x8b));var _0xad87=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0xd87a[_0x1663ae];return _0x30ffb8;};'use strict';var Sequelize=require(_0xad87('0x0'));module[_0xad87('0x1')]={'key':{'type':Sequelize[_0xad87('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xad87('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xad87('0x2')]},'name':{'type':Sequelize[_0xad87('0x4')],'get':function(){return this[_0xad87('0x5')](_0xad87('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0eb45c8..73d46be 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 _0x0bc9=['where','pick','filter','merge','options','show','params','rawAttributes','keys','includeAll','include','find','catch','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','CannedAnswers','UserProfileResource','destroy','error','stack','name','index','map','CannedAnswer','type','key','model','query','filters','intersection','fields','attributes','length','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bc9,0x71));var _0x90bc=function(_0x46a0cf,_0x4493d3){_0x46a0cf=_0x46a0cf-0x0;var _0x2e7c80=_0x0bc9[_0x46a0cf];return _0x2e7c80;};'use strict';var emlformat=require(_0x90bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90bc('0x1'));var jsonpatch=require(_0x90bc('0x2'));var rp=require(_0x90bc('0x3'));var moment=require(_0x90bc('0x4'));var BPromise=require(_0x90bc('0x5'));var Mustache=require(_0x90bc('0x6'));var util=require(_0x90bc('0x7'));var path=require(_0x90bc('0x8'));var sox=require('sox');var csv=require(_0x90bc('0x9'));var ejs=require(_0x90bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90bc('0xb'));var crypto=require('crypto');var jsforce=require(_0x90bc('0xc'));var deskjs=require(_0x90bc('0xd'));var toCsv=require(_0x90bc('0x9'));var querystring=require('querystring');var Papa=require(_0x90bc('0xe'));var Redis=require(_0x90bc('0xf'));var authService=require(_0x90bc('0x10'));var qs=require(_0x90bc('0x11'));var as=require(_0x90bc('0x12'));var hardwareService=require(_0x90bc('0x13'));var logger=require(_0x90bc('0x14'))(_0x90bc('0x15'));var utils=require(_0x90bc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x90bc('0x17'));var db=require(_0x90bc('0x18'))['db'];function respondWithStatusCode(_0x585913,_0x1941ec){_0x1941ec=_0x1941ec||0xcc;return function(_0x2c7563){if(_0x2c7563){return _0x585913[_0x90bc('0x19')](_0x1941ec);}return _0x585913[_0x90bc('0x1a')](_0x1941ec)[_0x90bc('0x1b')]();};}function respondWithResult(_0x2e88e3,_0x5d6200){_0x5d6200=_0x5d6200||0xc8;return function(_0xaec95f){if(_0xaec95f){return _0x2e88e3[_0x90bc('0x1a')](_0x5d6200)[_0x90bc('0x1c')](_0xaec95f);}};}function respondWithFilteredResult(_0x24d50f,_0x17d7d8){return function(_0x285a7a){if(_0x285a7a){var _0x227570=typeof _0x17d7d8['offset']===_0x90bc('0x1d')&&typeof _0x17d7d8[_0x90bc('0x1e')]===_0x90bc('0x1d');var _0x564f56=_0x285a7a[_0x90bc('0x1f')];var _0x59940c=_0x227570?0x0:_0x17d7d8[_0x90bc('0x20')];var _0x1733a3=_0x227570?_0x285a7a[_0x90bc('0x1f')]:_0x17d7d8[_0x90bc('0x20')]+_0x17d7d8[_0x90bc('0x1e')];var _0x12b00b;if(_0x1733a3>=_0x564f56){_0x1733a3=_0x564f56;_0x12b00b=0xc8;}else{_0x12b00b=0xce;}_0x24d50f[_0x90bc('0x1a')](_0x12b00b);return _0x24d50f[_0x90bc('0x21')](_0x90bc('0x22'),_0x59940c+'-'+_0x1733a3+'/'+_0x564f56)['json'](_0x285a7a);}return null;};}function patchUpdates(_0x3c2b36){return function(_0x57627d){try{jsonpatch[_0x90bc('0x23')](_0x57627d,_0x3c2b36,!![]);}catch(_0xfb8105){return BPromise[_0x90bc('0x24')](_0xfb8105);}return _0x57627d[_0x90bc('0x25')]();};}function saveUpdates(_0xa1bdad,_0x243250){return function(_0xcf9904){if(_0xcf9904){return _0xcf9904[_0x90bc('0x26')](_0xa1bdad)[_0x90bc('0x27')](function(_0x1416c3){return _0x1416c3;});}return null;};}function removeEntity(_0x4bf38a,_0x36f740){return function(_0x497a18){if(_0x497a18){return _0x497a18['destroy']()[_0x90bc('0x27')](function(){var _0x573979=_0x497a18['get']({'plain':!![]});var _0x52ae72=_0x90bc('0x28');return db[_0x90bc('0x29')][_0x90bc('0x2a')]({'where':{'type':_0x52ae72,'resourceId':_0x573979['id']}})[_0x90bc('0x27')](function(){return _0x497a18;});})[_0x90bc('0x27')](function(){_0x4bf38a[_0x90bc('0x1a')](0xcc)[_0x90bc('0x1b')]();});}};}function handleEntityNotFound(_0x53ac3e,_0x5e5dac){return function(_0x4090c5){if(!_0x4090c5){_0x53ac3e['sendStatus'](0x194);}return _0x4090c5;};}function handleError(_0x20bc42,_0x906008){_0x906008=_0x906008||0x1f4;return function(_0x2a846d){logger[_0x90bc('0x2b')](_0x2a846d[_0x90bc('0x2c')]);if(_0x2a846d['name']){delete _0x2a846d[_0x90bc('0x2d')];}_0x20bc42[_0x90bc('0x1a')](_0x906008)['send'](_0x2a846d);};}exports[_0x90bc('0x2e')]=function(_0x5c8f4d,_0x1e21cf){var _0x21ec7d={},_0x439e7c={},_0x2525c9={'count':0x0,'rows':[]};var _0x191e82=_[_0x90bc('0x2f')](db[_0x90bc('0x30')]['rawAttributes'],function(_0x148fb8){return{'name':_0x148fb8['fieldName'],'type':_0x148fb8[_0x90bc('0x31')][_0x90bc('0x32')]};});_0x439e7c[_0x90bc('0x33')]=_[_0x90bc('0x2f')](_0x191e82,_0x90bc('0x2d'));_0x439e7c[_0x90bc('0x34')]=_['keys'](_0x5c8f4d['query']);_0x439e7c[_0x90bc('0x35')]=_['intersection'](_0x439e7c[_0x90bc('0x33')],_0x439e7c[_0x90bc('0x34')]);_0x21ec7d['attributes']=_[_0x90bc('0x36')](_0x439e7c[_0x90bc('0x33')],qs[_0x90bc('0x37')](_0x5c8f4d[_0x90bc('0x34')]['fields']));_0x21ec7d[_0x90bc('0x38')]=_0x21ec7d[_0x90bc('0x38')][_0x90bc('0x39')]?_0x21ec7d['attributes']:_0x439e7c['model'];if(!_0x5c8f4d[_0x90bc('0x34')]['hasOwnProperty']('nolimit')){_0x21ec7d['limit']=qs[_0x90bc('0x1e')](_0x5c8f4d[_0x90bc('0x34')][_0x90bc('0x1e')]);_0x21ec7d[_0x90bc('0x20')]=qs[_0x90bc('0x20')](_0x5c8f4d[_0x90bc('0x34')]['offset']);}_0x21ec7d['order']=qs['sort'](_0x5c8f4d[_0x90bc('0x34')][_0x90bc('0x3a')]);_0x21ec7d[_0x90bc('0x3b')]=qs[_0x90bc('0x35')](_[_0x90bc('0x3c')](_0x5c8f4d[_0x90bc('0x34')],_0x439e7c[_0x90bc('0x35')]),_0x191e82);if(_0x5c8f4d[_0x90bc('0x34')][_0x90bc('0x3d')]){_0x21ec7d[_0x90bc('0x3b')]=_[_0x90bc('0x3e')](_0x21ec7d[_0x90bc('0x3b')],{'$or':[{'key':{'$like':'%'+_0x5c8f4d[_0x90bc('0x34')][_0x90bc('0x3d')]+'%'}},{'value':{'$like':'%'+_0x5c8f4d[_0x90bc('0x34')]['filter']+'%'}}]});}_0x21ec7d=_[_0x90bc('0x3e')]({},_0x21ec7d,_0x5c8f4d[_0x90bc('0x3f')]);var _0x4ab8e5={'where':_0x21ec7d[_0x90bc('0x3b')]};return db[_0x90bc('0x30')]['count'](_0x4ab8e5)[_0x90bc('0x27')](function(_0x3b100f){_0x2525c9[_0x90bc('0x1f')]=_0x3b100f;if(_0x5c8f4d[_0x90bc('0x34')]['includeAll']){_0x21ec7d['include']=[{'all':!![]}];}return db[_0x90bc('0x30')]['findAll'](_0x21ec7d);})[_0x90bc('0x27')](function(_0x37fd82){_0x2525c9['rows']=_0x37fd82;return _0x2525c9;})[_0x90bc('0x27')](respondWithFilteredResult(_0x1e21cf,_0x21ec7d))['catch'](handleError(_0x1e21cf,null));};exports[_0x90bc('0x40')]=function(_0x17052c,_0x5e4610){var _0x4566e6={'raw':!![],'where':{'id':_0x17052c[_0x90bc('0x41')]['id']}},_0x2d5390={};_0x2d5390[_0x90bc('0x33')]=_['keys'](db[_0x90bc('0x30')][_0x90bc('0x42')]);_0x2d5390[_0x90bc('0x34')]=_[_0x90bc('0x43')](_0x17052c[_0x90bc('0x34')]);_0x2d5390[_0x90bc('0x35')]=_[_0x90bc('0x36')](_0x2d5390[_0x90bc('0x33')],_0x2d5390[_0x90bc('0x34')]);_0x4566e6[_0x90bc('0x38')]=_[_0x90bc('0x36')](_0x2d5390['model'],qs[_0x90bc('0x37')](_0x17052c[_0x90bc('0x34')]['fields']));_0x4566e6[_0x90bc('0x38')]=_0x4566e6['attributes'][_0x90bc('0x39')]?_0x4566e6[_0x90bc('0x38')]:_0x2d5390[_0x90bc('0x33')];if(_0x17052c['query'][_0x90bc('0x44')]){_0x4566e6[_0x90bc('0x45')]=[{'all':!![]}];}_0x4566e6=_[_0x90bc('0x3e')]({},_0x4566e6,_0x17052c[_0x90bc('0x3f')]);return db[_0x90bc('0x30')][_0x90bc('0x46')](_0x4566e6)[_0x90bc('0x27')](handleEntityNotFound(_0x5e4610,null))[_0x90bc('0x27')](respondWithResult(_0x5e4610,null))[_0x90bc('0x47')](handleError(_0x5e4610,null));};exports[_0x90bc('0x26')]=function(_0x5d67fc,_0x1c0c2a){if(_0x5d67fc[_0x90bc('0x48')]['id']){delete _0x5d67fc['body']['id'];}return db[_0x90bc('0x30')]['find']({'where':{'id':_0x5d67fc['params']['id']}})[_0x90bc('0x27')](handleEntityNotFound(_0x1c0c2a,null))['then'](saveUpdates(_0x5d67fc[_0x90bc('0x48')],null))[_0x90bc('0x27')](respondWithResult(_0x1c0c2a,null))['catch'](handleError(_0x1c0c2a,null));};exports['destroy']=function(_0x3f6b1e,_0x2f0e07){return db[_0x90bc('0x30')]['find']({'where':{'id':_0x3f6b1e[_0x90bc('0x41')]['id']}})[_0x90bc('0x27')](handleEntityNotFound(_0x2f0e07,null))[_0x90bc('0x27')](removeEntity(_0x2f0e07,null))[_0x90bc('0x47')](handleError(_0x2f0e07,null));};exports['create']=function(_0xee284a,_0x197539){var _0x11687f={'key':_0xee284a[_0x90bc('0x48')][_0x90bc('0x32')]};if(_0xee284a[_0x90bc('0x48')]['MailAccountId']){_0x11687f['MailAccountId']=_0xee284a[_0x90bc('0x48')][_0x90bc('0x49')];}else if(_0xee284a[_0x90bc('0x48')][_0x90bc('0x4a')]){_0x11687f[_0x90bc('0x4a')]=_0xee284a['body'][_0x90bc('0x4a')];}else if(_0xee284a['body'][_0x90bc('0x4b')]){_0x11687f['OpenchannelAccountId']=_0xee284a[_0x90bc('0x48')][_0x90bc('0x4b')];}else if(_0xee284a['body'][_0x90bc('0x4c')]){_0x11687f['ChatWebsiteId']=_0xee284a[_0x90bc('0x48')][_0x90bc('0x4c')];}return db[_0x90bc('0x30')]['find']({'where':_0x11687f})[_0x90bc('0x27')](function(_0x44cab3){if(_0x44cab3){throw new db[(_0x90bc('0x4d'))][(_0x90bc('0x4e'))](_0x90bc('0x4f'));}return db[_0x90bc('0x30')]['create'](_0xee284a[_0x90bc('0x48')]);})[_0x90bc('0x27')](function(_0x4816a4){var _0x32c495=_0xee284a[_0x90bc('0x50')][_0x90bc('0x51')]({'plain':!![]});if(!_0x32c495)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32c495[_0x90bc('0x52')]===_0x90bc('0x50')){var _0xb9982f=_0x4816a4['get']({'plain':!![]});return db[_0x90bc('0x53')]['find']({'where':{'name':_0x90bc('0x28'),'userProfileId':_0x32c495[_0x90bc('0x54')]},'raw':!![]})['then'](function(_0x56a941){if(_0x56a941&&_0x56a941['autoAssociation']===0x0){return db[_0x90bc('0x29')]['create']({'name':_0xb9982f[_0x90bc('0x2d')],'resourceId':_0xb9982f['id'],'type':_0x56a941[_0x90bc('0x2d')],'sectionId':_0x56a941['id']},{})[_0x90bc('0x27')](function(){return _0x4816a4;});}else{return _0x4816a4;}})[_0x90bc('0x47')](function(_0xae3493){logger['error'](_0x90bc('0x55'),_0xae3493);throw _0xae3493;});}return _0x4816a4;})['then'](respondWithResult(_0x197539,0xc9))[_0x90bc('0x47')](handleError(_0x197539,null));}; \ No newline at end of file +var _0x91df=['stack','name','send','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','apply','save','update','then','destroy','get','CannedAnswers','end','sendStatus','error'];(function(_0xf501f3,_0x29979a){var _0x390b76=function(_0x4369b7){while(--_0x4369b7){_0xf501f3['push'](_0xf501f3['shift']());}};_0x390b76(++_0x29979a);}(_0x91df,0x132));var _0xf91d=function(_0x3fbe58,_0x264f56){_0x3fbe58=_0x3fbe58-0x0;var _0x459187=_0x91df[_0x3fbe58];return _0x459187;};'use strict';var emlformat=require(_0xf91d('0x0'));var rimraf=require(_0xf91d('0x1'));var zipdir=require(_0xf91d('0x2'));var jsonpatch=require(_0xf91d('0x3'));var rp=require('request-promise');var moment=require(_0xf91d('0x4'));var BPromise=require(_0xf91d('0x5'));var Mustache=require(_0xf91d('0x6'));var util=require(_0xf91d('0x7'));var path=require('path');var sox=require(_0xf91d('0x8'));var csv=require(_0xf91d('0x9'));var ejs=require(_0xf91d('0xa'));var fs=require('fs');var fs_extra=require(_0xf91d('0xb'));var _=require('lodash');var squel=require(_0xf91d('0xc'));var crypto=require(_0xf91d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf91d('0xe'));var toCsv=require(_0xf91d('0x9'));var querystring=require(_0xf91d('0xf'));var Papa=require(_0xf91d('0x10'));var Redis=require('ioredis');var authService=require(_0xf91d('0x11'));var qs=require(_0xf91d('0x12'));var as=require(_0xf91d('0x13'));var hardwareService=require(_0xf91d('0x14'));var logger=require(_0xf91d('0x15'))(_0xf91d('0x16'));var utils=require('../../config/utils');var config=require(_0xf91d('0x17'));var licenseUtil=require(_0xf91d('0x18'));var db=require(_0xf91d('0x19'))['db'];function respondWithStatusCode(_0x33084b,_0x47986e){_0x47986e=_0x47986e||0xcc;return function(_0x169791){if(_0x169791){return _0x33084b['sendStatus'](_0x47986e);}return _0x33084b[_0xf91d('0x1a')](_0x47986e)['end']();};}function respondWithResult(_0x57ca28,_0xe6afd1){_0xe6afd1=_0xe6afd1||0xc8;return function(_0x4cbb8d){if(_0x4cbb8d){return _0x57ca28['status'](_0xe6afd1)[_0xf91d('0x1b')](_0x4cbb8d);}};}function respondWithFilteredResult(_0x15c651,_0x1c1976){return function(_0x1c0610){if(_0x1c0610){var _0x190e69=typeof _0x1c1976['offset']==='undefined'&&typeof _0x1c1976[_0xf91d('0x1c')]===_0xf91d('0x1d');var _0x2acd16=_0x1c0610[_0xf91d('0x1e')];var _0x55de53=_0x190e69?0x0:_0x1c1976[_0xf91d('0x1f')];var _0x57b6e6=_0x190e69?_0x1c0610[_0xf91d('0x1e')]:_0x1c1976['offset']+_0x1c1976[_0xf91d('0x1c')];var _0x4f422a;if(_0x57b6e6>=_0x2acd16){_0x57b6e6=_0x2acd16;_0x4f422a=0xc8;}else{_0x4f422a=0xce;}_0x15c651[_0xf91d('0x1a')](_0x4f422a);return _0x15c651['set']('Content-Range',_0x55de53+'-'+_0x57b6e6+'/'+_0x2acd16)['json'](_0x1c0610);}return null;};}function patchUpdates(_0x24e211){return function(_0x43eec7){try{jsonpatch[_0xf91d('0x20')](_0x43eec7,_0x24e211,!![]);}catch(_0x2ca2c9){return BPromise['reject'](_0x2ca2c9);}return _0x43eec7[_0xf91d('0x21')]();};}function saveUpdates(_0x1fbf62,_0x46c284){return function(_0x83b660){if(_0x83b660){return _0x83b660[_0xf91d('0x22')](_0x1fbf62)[_0xf91d('0x23')](function(_0x3411db){return _0x3411db;});}return null;};}function removeEntity(_0x275a7a,_0x1338f2){return function(_0x1408d0){if(_0x1408d0){return _0x1408d0[_0xf91d('0x24')]()[_0xf91d('0x23')](function(){var _0x46c869=_0x1408d0[_0xf91d('0x25')]({'plain':!![]});var _0x3a57c3=_0xf91d('0x26');return db['UserProfileResource'][_0xf91d('0x24')]({'where':{'type':_0x3a57c3,'resourceId':_0x46c869['id']}})['then'](function(){return _0x1408d0;});})[_0xf91d('0x23')](function(){_0x275a7a[_0xf91d('0x1a')](0xcc)[_0xf91d('0x27')]();});}};}function handleEntityNotFound(_0x264307,_0xa55d1){return function(_0x581470){if(!_0x581470){_0x264307[_0xf91d('0x28')](0x194);}return _0x581470;};}function handleError(_0x11260f,_0x44a756){_0x44a756=_0x44a756||0x1f4;return function(_0x5738c4){logger[_0xf91d('0x29')](_0x5738c4[_0xf91d('0x2a')]);if(_0x5738c4[_0xf91d('0x2b')]){delete _0x5738c4['name'];}_0x11260f[_0xf91d('0x1a')](_0x44a756)[_0xf91d('0x2c')](_0x5738c4);};}exports['index']=function(_0xb59615,_0x39a1bc){var _0x3dfdf3={},_0x5ab102={},_0x57c1d8={'count':0x0,'rows':[]};var _0x41e94b=_[_0xf91d('0x2d')](db[_0xf91d('0x2e')][_0xf91d('0x2f')],function(_0x5a4c3f){return{'name':_0x5a4c3f[_0xf91d('0x30')],'type':_0x5a4c3f['type'][_0xf91d('0x31')]};});_0x5ab102[_0xf91d('0x32')]=_[_0xf91d('0x2d')](_0x41e94b,_0xf91d('0x2b'));_0x5ab102[_0xf91d('0x33')]=_[_0xf91d('0x34')](_0xb59615[_0xf91d('0x33')]);_0x5ab102[_0xf91d('0x35')]=_[_0xf91d('0x36')](_0x5ab102['model'],_0x5ab102[_0xf91d('0x33')]);_0x3dfdf3[_0xf91d('0x37')]=_[_0xf91d('0x36')](_0x5ab102[_0xf91d('0x32')],qs[_0xf91d('0x38')](_0xb59615[_0xf91d('0x33')][_0xf91d('0x38')]));_0x3dfdf3[_0xf91d('0x37')]=_0x3dfdf3['attributes'][_0xf91d('0x39')]?_0x3dfdf3[_0xf91d('0x37')]:_0x5ab102[_0xf91d('0x32')];if(!_0xb59615[_0xf91d('0x33')][_0xf91d('0x3a')](_0xf91d('0x3b'))){_0x3dfdf3[_0xf91d('0x1c')]=qs[_0xf91d('0x1c')](_0xb59615[_0xf91d('0x33')][_0xf91d('0x1c')]);_0x3dfdf3[_0xf91d('0x1f')]=qs['offset'](_0xb59615[_0xf91d('0x33')][_0xf91d('0x1f')]);}_0x3dfdf3[_0xf91d('0x3c')]=qs[_0xf91d('0x3d')](_0xb59615[_0xf91d('0x33')]['sort']);_0x3dfdf3[_0xf91d('0x3e')]=qs['filters'](_[_0xf91d('0x3f')](_0xb59615[_0xf91d('0x33')],_0x5ab102['filters']),_0x41e94b);if(_0xb59615['query']['filter']){_0x3dfdf3['where']=_[_0xf91d('0x40')](_0x3dfdf3[_0xf91d('0x3e')],{'$or':[{'key':{'$like':'%'+_0xb59615[_0xf91d('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0xb59615[_0xf91d('0x33')][_0xf91d('0x41')]+'%'}}]});}_0x3dfdf3=_[_0xf91d('0x40')]({},_0x3dfdf3,_0xb59615[_0xf91d('0x42')]);var _0x4002b0={'where':_0x3dfdf3[_0xf91d('0x3e')]};return db[_0xf91d('0x2e')][_0xf91d('0x1e')](_0x4002b0)[_0xf91d('0x23')](function(_0x17592a){_0x57c1d8[_0xf91d('0x1e')]=_0x17592a;if(_0xb59615[_0xf91d('0x33')][_0xf91d('0x43')]){_0x3dfdf3[_0xf91d('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf91d('0x45')](_0x3dfdf3);})[_0xf91d('0x23')](function(_0x3044e7){_0x57c1d8[_0xf91d('0x46')]=_0x3044e7;return _0x57c1d8;})[_0xf91d('0x23')](respondWithFilteredResult(_0x39a1bc,_0x3dfdf3))[_0xf91d('0x47')](handleError(_0x39a1bc,null));};exports['show']=function(_0x3d3c11,_0x119376){var _0x1a8dca={'raw':!![],'where':{'id':_0x3d3c11[_0xf91d('0x48')]['id']}},_0x3fd697={};_0x3fd697[_0xf91d('0x32')]=_[_0xf91d('0x34')](db['CannedAnswer']['rawAttributes']);_0x3fd697[_0xf91d('0x33')]=_[_0xf91d('0x34')](_0x3d3c11[_0xf91d('0x33')]);_0x3fd697['filters']=_[_0xf91d('0x36')](_0x3fd697[_0xf91d('0x32')],_0x3fd697['query']);_0x1a8dca[_0xf91d('0x37')]=_[_0xf91d('0x36')](_0x3fd697[_0xf91d('0x32')],qs[_0xf91d('0x38')](_0x3d3c11[_0xf91d('0x33')][_0xf91d('0x38')]));_0x1a8dca[_0xf91d('0x37')]=_0x1a8dca[_0xf91d('0x37')][_0xf91d('0x39')]?_0x1a8dca[_0xf91d('0x37')]:_0x3fd697[_0xf91d('0x32')];if(_0x3d3c11[_0xf91d('0x33')]['includeAll']){_0x1a8dca[_0xf91d('0x44')]=[{'all':!![]}];}_0x1a8dca=_[_0xf91d('0x40')]({},_0x1a8dca,_0x3d3c11[_0xf91d('0x42')]);return db['CannedAnswer'][_0xf91d('0x49')](_0x1a8dca)[_0xf91d('0x23')](handleEntityNotFound(_0x119376,null))[_0xf91d('0x23')](respondWithResult(_0x119376,null))['catch'](handleError(_0x119376,null));};exports['update']=function(_0x7eefca,_0x13f3b6){if(_0x7eefca['body']['id']){delete _0x7eefca[_0xf91d('0x4a')]['id'];}return db[_0xf91d('0x2e')]['find']({'where':{'id':_0x7eefca['params']['id']}})['then'](handleEntityNotFound(_0x13f3b6,null))['then'](saveUpdates(_0x7eefca[_0xf91d('0x4a')],null))['then'](respondWithResult(_0x13f3b6,null))[_0xf91d('0x47')](handleError(_0x13f3b6,null));};exports[_0xf91d('0x24')]=function(_0xca0820,_0x2e3a9f){return db[_0xf91d('0x2e')][_0xf91d('0x49')]({'where':{'id':_0xca0820[_0xf91d('0x48')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x2e3a9f,null))['then'](removeEntity(_0x2e3a9f,null))[_0xf91d('0x47')](handleError(_0x2e3a9f,null));};exports['create']=function(_0x2de373,_0x431424){var _0x3d8518={'key':_0x2de373[_0xf91d('0x4a')][_0xf91d('0x31')]};if(_0x2de373[_0xf91d('0x4a')]['MailAccountId']){_0x3d8518['MailAccountId']=_0x2de373[_0xf91d('0x4a')][_0xf91d('0x4b')];}else if(_0x2de373['body'][_0xf91d('0x4c')]){_0x3d8518[_0xf91d('0x4c')]=_0x2de373[_0xf91d('0x4a')][_0xf91d('0x4c')];}else if(_0x2de373[_0xf91d('0x4a')][_0xf91d('0x4d')]){_0x3d8518[_0xf91d('0x4d')]=_0x2de373['body'][_0xf91d('0x4d')];}else if(_0x2de373['body'][_0xf91d('0x4e')]){_0x3d8518[_0xf91d('0x4e')]=_0x2de373[_0xf91d('0x4a')][_0xf91d('0x4e')];}return db[_0xf91d('0x2e')][_0xf91d('0x49')]({'where':_0x3d8518})[_0xf91d('0x23')](function(_0x406f02){if(_0x406f02){throw new db[(_0xf91d('0x4f'))]['ValidationError'](_0xf91d('0x50'));}return db[_0xf91d('0x2e')][_0xf91d('0x51')](_0x2de373[_0xf91d('0x4a')]);})[_0xf91d('0x23')](function(_0xcd4d01){var _0x3a5109=_0x2de373[_0xf91d('0x52')][_0xf91d('0x25')]({'plain':!![]});if(!_0x3a5109)throw new Error(_0xf91d('0x53'));if(_0x3a5109[_0xf91d('0x54')]===_0xf91d('0x52')){var _0x20fc57=_0xcd4d01[_0xf91d('0x25')]({'plain':!![]});return db[_0xf91d('0x55')][_0xf91d('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3a5109[_0xf91d('0x56')]},'raw':!![]})[_0xf91d('0x23')](function(_0x5a8e02){if(_0x5a8e02&&_0x5a8e02['autoAssociation']===0x0){return db['UserProfileResource'][_0xf91d('0x51')]({'name':_0x20fc57['name'],'resourceId':_0x20fc57['id'],'type':_0x5a8e02[_0xf91d('0x2b')],'sectionId':_0x5a8e02['id']},{})[_0xf91d('0x23')](function(){return _0xcd4d01;});}else{return _0xcd4d01;}})['catch'](function(_0x2b4dc1){logger[_0xf91d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4dc1);throw _0x2b4dc1;});}return _0xcd4d01;})['then'](respondWithResult(_0x431424,0xc9))['catch'](handleError(_0x431424,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f46e27d..f6f959f 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 _0x63cf=['exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cannedAnswer.attributes'];(function(_0x4ea86,_0x9c41f7){var _0x3d9ab0=function(_0x2a9c13){while(--_0x2a9c13){_0x4ea86['push'](_0x4ea86['shift']());}};_0x3d9ab0(++_0x9c41f7);}(_0x63cf,0xc9));var _0xf63c=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x63cf[_0x237f8b];return _0x423f94;};'use strict';var _=require(_0xf63c('0x0'));var util=require(_0xf63c('0x1'));var logger=require(_0xf63c('0x2'))(_0xf63c('0x3'));var moment=require(_0xf63c('0x4'));var BPromise=require(_0xf63c('0x5'));var rp=require(_0xf63c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf63c('0x7'));var config=require('../../config/environment');var attributes=require(_0xf63c('0x8'));module[_0xf63c('0x9')]=function(_0x30da33,_0x2fe800){return _0x30da33[_0xf63c('0xa')]('CannedAnswer',attributes,{'tableName':_0xf63c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf63c('0xc'),'collate':_0xf63c('0xd')});}; \ No newline at end of file +var _0xf35d=['lodash','../../config/logger','moment','bluebird','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x3b0413,_0xd316dd){var _0x4e8dd5=function(_0x205a11){while(--_0x205a11){_0x3b0413['push'](_0x3b0413['shift']());}};_0x4e8dd5(++_0xd316dd);}(_0xf35d,0x17c));var _0xdf35=function(_0x35be98,_0x533d82){_0x35be98=_0x35be98-0x0;var _0x5e2f45=_0xf35d[_0x35be98];return _0x5e2f45;};'use strict';var _=require(_0xdf35('0x0'));var util=require('util');var logger=require(_0xdf35('0x1'))('api');var moment=require(_0xdf35('0x2'));var BPromise=require(_0xdf35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf35('0x4'));var rimraf=require('rimraf');var config=require(_0xdf35('0x5'));var attributes=require(_0xdf35('0x6'));module[_0xdf35('0x7')]=function(_0x7cfe71,_0x41036b){return _0x7cfe71[_0xdf35('0x8')](_0xdf35('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index d37efd1..37be577 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(_0x594323,_0xb0be8c){var _0x517ee6=function(_0x364edd){while(--_0x364edd){_0x594323['push'](_0x594323['shift']());}};_0x517ee6(++_0xb0be8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x4f097d,_0x588037){var _0x141bc3=function(_0x40ae17){while(--_0x40ae17){_0x4f097d['push'](_0x4f097d['shift']());}};_0x141bc3(++_0x588037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 cea65cd..000deb5 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 _0x5d2a=['express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','util','path','connect-timeout'];(function(_0x428c3b,_0x54b081){var _0x424c6f=function(_0x20accc){while(--_0x20accc){_0x428c3b['push'](_0x428c3b['shift']());}};_0x424c6f(++_0x54b081);}(_0x5d2a,0xcd));var _0xa5d2=function(_0x761c1b,_0x3b5c90){_0x761c1b=_0x761c1b-0x0;var _0x1f7529=_0x5d2a[_0x761c1b];return _0x1f7529;};'use strict';var multer=require('multer');var util=require(_0xa5d2('0x0'));var path=require(_0xa5d2('0x1'));var timeout=require(_0xa5d2('0x2'));var express=require(_0xa5d2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa5d2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa5d2('0x5'));var controller=require('./cannedAnswer.controller');router[_0xa5d2('0x6')]('/',auth[_0xa5d2('0x7')](),controller[_0xa5d2('0x8')]);router[_0xa5d2('0x6')](_0xa5d2('0x9'),auth[_0xa5d2('0x7')](),controller[_0xa5d2('0xa')]);router['post']('/',auth[_0xa5d2('0x7')](),controller[_0xa5d2('0xb')]);router[_0xa5d2('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xa5d2('0xd')]);router[_0xa5d2('0xe')](_0xa5d2('0x9'),auth[_0xa5d2('0x7')](),controller['destroy']);module[_0xa5d2('0xf')]=router; \ No newline at end of file +var _0x7f26=['/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','post','create','put'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0x7f26,0x1f1));var _0x67f2=function(_0x22a481,_0x512770){_0x22a481=_0x22a481-0x0;var _0x5a4a04=_0x7f26[_0x22a481];return _0x5a4a04;};'use strict';var multer=require(_0x67f2('0x0'));var util=require('util');var path=require(_0x67f2('0x1'));var timeout=require(_0x67f2('0x2'));var express=require(_0x67f2('0x3'));var router=express[_0x67f2('0x4')]();var fs_extra=require(_0x67f2('0x5'));var auth=require(_0x67f2('0x6'));var interaction=require(_0x67f2('0x7'));var config=require(_0x67f2('0x8'));var controller=require(_0x67f2('0x9'));router[_0x67f2('0xa')]('/',auth[_0x67f2('0xb')](),controller[_0x67f2('0xc')]);router[_0x67f2('0xa')]('/:id',auth[_0x67f2('0xb')](),controller['show']);router[_0x67f2('0xd')]('/',auth[_0x67f2('0xb')](),controller[_0x67f2('0xe')]);router[_0x67f2('0xf')](_0x67f2('0x10'),auth[_0x67f2('0xb')](),controller[_0x67f2('0x11')]);router['delete'](_0x67f2('0x10'),auth[_0x67f2('0xb')](),controller[_0x67f2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 9d5d5c7..52978ac 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 _0xc743=['exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x313b82,_0x43290f){var _0x2f8aa3=function(_0x5e3a41){while(--_0x5e3a41){_0x313b82['push'](_0x313b82['shift']());}};_0x2f8aa3(++_0x43290f);}(_0xc743,0x15c));var _0x3c74=function(_0x4d4475,_0x4f99dd){_0x4d4475=_0x4d4475-0x0;var _0x5a41c6=_0xc743[_0x4d4475];return _0x5a41c6;};'use strict';var Sequelize=require('sequelize');module[_0x3c74('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x3c74('0x1')},'clid':{'type':Sequelize[_0x3c74('0x2')]},'src':{'type':Sequelize[_0x3c74('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3c74('0x2')]},'dstchannel':{'type':Sequelize[_0x3c74('0x2')]},'lastapp':{'type':Sequelize[_0x3c74('0x2')]},'lastdata':{'type':Sequelize[_0x3c74('0x2')]},'duration':{'type':Sequelize[_0x3c74('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3c74('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3c74('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3c74('0x2')]},'userfield':{'type':Sequelize[_0x3c74('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3c74('0x2')]},'sequence':{'type':Sequelize[_0x3c74('0x2')]},'peeraccount':{'type':Sequelize[_0x3c74('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe74e=['INTEGER','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x26db6a,_0x3cff3c){var _0x5ac65f=function(_0x2f4e1e){while(--_0x2f4e1e){_0x26db6a['push'](_0x26db6a['shift']());}};_0x5ac65f(++_0x3cff3c);}(_0xe74e,0x10a));var _0xee74=function(_0x291e6a,_0x94ec18){_0x291e6a=_0x291e6a-0x0;var _0x579e40=_0xe74e[_0x291e6a];return _0x579e40;};'use strict';var Sequelize=require('sequelize');module[_0xee74('0x0')]={'calldate':{'type':Sequelize[_0xee74('0x1')],'allowNull':![],'defaultValue':_0xee74('0x2')},'clid':{'type':Sequelize[_0xee74('0x3')]},'src':{'type':Sequelize[_0xee74('0x3')]},'dst':{'type':Sequelize[_0xee74('0x3')]},'dcontext':{'type':Sequelize[_0xee74('0x3')]},'channel':{'type':Sequelize[_0xee74('0x3')]},'dstchannel':{'type':Sequelize[_0xee74('0x3')]},'lastapp':{'type':Sequelize[_0xee74('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xee74('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xee74('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xee74('0x3')]},'uniqueid':{'type':Sequelize[_0xee74('0x3')]},'linkedid':{'type':Sequelize[_0xee74('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xee74('0x3')]},'tag':{'type':Sequelize[_0xee74('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 11ac122..5eb877d 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 _0xef17=['key','map','intersection','model','attributes','fields','length','query','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','offset','json','apply','reject','save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','fieldName'];(function(_0x1d602d,_0x36d9a6){var _0x59a466=function(_0x34eded){while(--_0x34eded){_0x1d602d['push'](_0x1d602d['shift']());}};_0x59a466(++_0x36d9a6);}(_0xef17,0x136));var _0x7ef1=function(_0x46f1d3,_0x27b738){_0x46f1d3=_0x46f1d3-0x0;var _0x4885c3=_0xef17[_0x46f1d3];return _0x4885c3;};'use strict';var emlformat=require(_0x7ef1('0x0'));var rimraf=require(_0x7ef1('0x1'));var zipdir=require(_0x7ef1('0x2'));var jsonpatch=require(_0x7ef1('0x3'));var rp=require(_0x7ef1('0x4'));var moment=require(_0x7ef1('0x5'));var BPromise=require(_0x7ef1('0x6'));var Mustache=require(_0x7ef1('0x7'));var util=require(_0x7ef1('0x8'));var path=require('path');var sox=require(_0x7ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x7ef1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ef1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ef1('0xc'));var deskjs=require(_0x7ef1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7ef1('0xe'));var Papa=require(_0x7ef1('0xf'));var Redis=require(_0x7ef1('0x10'));var authService=require(_0x7ef1('0x11'));var qs=require(_0x7ef1('0x12'));var as=require(_0x7ef1('0x13'));var hardwareService=require(_0x7ef1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7ef1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122c8a,_0x51e226){_0x51e226=_0x51e226||0xcc;return function(_0x36ddf9){if(_0x36ddf9){return _0x122c8a[_0x7ef1('0x16')](_0x51e226);}return _0x122c8a[_0x7ef1('0x17')](_0x51e226)[_0x7ef1('0x18')]();};}function respondWithResult(_0x39ea9c,_0x317125){_0x317125=_0x317125||0xc8;return function(_0x26e9fb){if(_0x26e9fb){return _0x39ea9c[_0x7ef1('0x17')](_0x317125)['json'](_0x26e9fb);}};}function respondWithFilteredResult(_0x4de80f,_0x267f0e){return function(_0x5d0499){if(_0x5d0499){var _0x20b843=typeof _0x267f0e[_0x7ef1('0x19')]==='undefined'&&typeof _0x267f0e['limit']==='undefined';var _0x300645=_0x5d0499['count'];var _0x3a5835=_0x20b843?0x0:_0x267f0e['offset'];var _0x5a7b2b=_0x20b843?_0x5d0499['count']:_0x267f0e[_0x7ef1('0x19')]+_0x267f0e['limit'];var _0x38c5a7;if(_0x5a7b2b>=_0x300645){_0x5a7b2b=_0x300645;_0x38c5a7=0xc8;}else{_0x38c5a7=0xce;}_0x4de80f[_0x7ef1('0x17')](_0x38c5a7);return _0x4de80f['set']('Content-Range',_0x3a5835+'-'+_0x5a7b2b+'/'+_0x300645)[_0x7ef1('0x1a')](_0x5d0499);}return null;};}function patchUpdates(_0x5490b9){return function(_0x458459){try{jsonpatch[_0x7ef1('0x1b')](_0x458459,_0x5490b9,!![]);}catch(_0x2f8164){return BPromise[_0x7ef1('0x1c')](_0x2f8164);}return _0x458459[_0x7ef1('0x1d')]();};}function saveUpdates(_0xf24942,_0x20887b){return function(_0xd71594){if(_0xd71594){return _0xd71594['update'](_0xf24942)[_0x7ef1('0x1e')](function(_0x3b118f){return _0x3b118f;});}return null;};}function removeEntity(_0x3f26fb,_0x3324d4){return function(_0x31b5bf){if(_0x31b5bf){return _0x31b5bf[_0x7ef1('0x1f')]()[_0x7ef1('0x1e')](function(){_0x3f26fb[_0x7ef1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1ace,_0x33e008){return function(_0x12ef5a){if(!_0x12ef5a){_0x4b1ace[_0x7ef1('0x16')](0x194);}return _0x12ef5a;};}function handleError(_0xcfce5e,_0x19c2c2){_0x19c2c2=_0x19c2c2||0x1f4;return function(_0x4cfa16){logger[_0x7ef1('0x20')](_0x4cfa16[_0x7ef1('0x21')]);if(_0x4cfa16[_0x7ef1('0x22')]){delete _0x4cfa16[_0x7ef1('0x22')];}_0xcfce5e[_0x7ef1('0x17')](_0x19c2c2)[_0x7ef1('0x23')](_0x4cfa16);};}exports[_0x7ef1('0x24')]=function(_0x58e7ee,_0x2e8f1b){var _0x4b0380={},_0x3306b0={},_0x2546bf={'count':0x0,'rows':[]};var _0x4b5fde=_['map'](db[_0x7ef1('0x25')][_0x7ef1('0x26')],function(_0x5ab3a5){return{'name':_0x5ab3a5[_0x7ef1('0x27')],'type':_0x5ab3a5['type'][_0x7ef1('0x28')]};});_0x3306b0['model']=_[_0x7ef1('0x29')](_0x4b5fde,_0x7ef1('0x22'));_0x3306b0['query']=_['keys'](_0x58e7ee['query']);_0x3306b0['filters']=_[_0x7ef1('0x2a')](_0x3306b0[_0x7ef1('0x2b')],_0x3306b0['query']);_0x4b0380[_0x7ef1('0x2c')]=_['intersection'](_0x3306b0['model'],qs[_0x7ef1('0x2d')](_0x58e7ee['query'][_0x7ef1('0x2d')]));_0x4b0380[_0x7ef1('0x2c')]=_0x4b0380[_0x7ef1('0x2c')][_0x7ef1('0x2e')]?_0x4b0380['attributes']:_0x3306b0[_0x7ef1('0x2b')];if(!_0x58e7ee[_0x7ef1('0x2f')]['hasOwnProperty']('nolimit')){_0x4b0380['limit']=qs['limit'](_0x58e7ee[_0x7ef1('0x2f')]['limit']);_0x4b0380[_0x7ef1('0x19')]=qs[_0x7ef1('0x19')](_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x19')]);}_0x4b0380[_0x7ef1('0x30')]=qs[_0x7ef1('0x31')](_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x31')]);_0x4b0380[_0x7ef1('0x32')]=qs[_0x7ef1('0x33')](_[_0x7ef1('0x34')](_0x58e7ee['query'],_0x3306b0[_0x7ef1('0x33')]),_0x4b5fde);if(_0x58e7ee[_0x7ef1('0x2f')]['filter']){_0x4b0380[_0x7ef1('0x32')]=_[_0x7ef1('0x35')](_0x4b0380[_0x7ef1('0x32')],{'$or':_[_0x7ef1('0x29')](_0x4b5fde,function(_0x8ef5b3){if(_0x8ef5b3['type']!==_0x7ef1('0x36')){var _0x1ccbfb={};_0x1ccbfb[_0x8ef5b3[_0x7ef1('0x22')]]={'$like':'%'+_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x37')]+'%'};return _0x1ccbfb;}})});}_0x4b0380=_[_0x7ef1('0x35')]({},_0x4b0380,_0x58e7ee[_0x7ef1('0x38')]);var _0x238aa7={'where':_0x4b0380[_0x7ef1('0x32')]};return db[_0x7ef1('0x25')][_0x7ef1('0x39')](_0x238aa7)[_0x7ef1('0x1e')](function(_0x2da912){_0x2546bf[_0x7ef1('0x39')]=_0x2da912;if(_0x58e7ee[_0x7ef1('0x2f')]['includeAll']){_0x4b0380[_0x7ef1('0x3a')]=[{'all':!![]}];}return db[_0x7ef1('0x25')][_0x7ef1('0x3b')](_0x4b0380);})[_0x7ef1('0x1e')](function(_0x3889d7){_0x2546bf[_0x7ef1('0x3c')]=_0x3889d7;return _0x2546bf;})[_0x7ef1('0x1e')](respondWithFilteredResult(_0x2e8f1b,_0x4b0380))[_0x7ef1('0x3d')](handleError(_0x2e8f1b,null));};exports[_0x7ef1('0x3e')]=function(_0x1cff0b,_0x3e5ecd){var _0x374bf5={'raw':!![],'where':{'id':_0x1cff0b['params']['id']}},_0x2fb6c4={};_0x2fb6c4[_0x7ef1('0x2b')]=_[_0x7ef1('0x3f')](db[_0x7ef1('0x25')][_0x7ef1('0x26')]);_0x2fb6c4[_0x7ef1('0x2f')]=_[_0x7ef1('0x3f')](_0x1cff0b['query']);_0x2fb6c4[_0x7ef1('0x33')]=_[_0x7ef1('0x2a')](_0x2fb6c4[_0x7ef1('0x2b')],_0x2fb6c4[_0x7ef1('0x2f')]);_0x374bf5[_0x7ef1('0x2c')]=_[_0x7ef1('0x2a')](_0x2fb6c4['model'],qs[_0x7ef1('0x2d')](_0x1cff0b[_0x7ef1('0x2f')][_0x7ef1('0x2d')]));_0x374bf5[_0x7ef1('0x2c')]=_0x374bf5['attributes'][_0x7ef1('0x2e')]?_0x374bf5['attributes']:_0x2fb6c4['model'];if(_0x1cff0b[_0x7ef1('0x2f')]['includeAll']){_0x374bf5[_0x7ef1('0x3a')]=[{'all':!![]}];}_0x374bf5=_['merge']({},_0x374bf5,_0x1cff0b[_0x7ef1('0x38')]);return db[_0x7ef1('0x25')][_0x7ef1('0x40')](_0x374bf5)[_0x7ef1('0x1e')](handleEntityNotFound(_0x3e5ecd,null))[_0x7ef1('0x1e')](respondWithResult(_0x3e5ecd,null))[_0x7ef1('0x3d')](handleError(_0x3e5ecd,null));};exports[_0x7ef1('0x41')]=function(_0x106096,_0x49e089){return db['Cdr'][_0x7ef1('0x41')](_0x106096[_0x7ef1('0x42')],{})['then'](respondWithResult(_0x49e089,0xc9))[_0x7ef1('0x3d')](handleError(_0x49e089,null));};exports[_0x7ef1('0x43')]=function(_0xd06ca9,_0x5ce876){if(_0xd06ca9['body']['id']){delete _0xd06ca9[_0x7ef1('0x42')]['id'];}return db['Cdr']['find']({'where':{'id':_0xd06ca9[_0x7ef1('0x44')]['id']}})[_0x7ef1('0x1e')](handleEntityNotFound(_0x5ce876,null))[_0x7ef1('0x1e')](saveUpdates(_0xd06ca9[_0x7ef1('0x42')],null))[_0x7ef1('0x1e')](respondWithResult(_0x5ce876,null))['catch'](handleError(_0x5ce876,null));};exports[_0x7ef1('0x1f')]=function(_0x4e425b,_0x350dde){return db['Cdr'][_0x7ef1('0x40')]({'where':{'id':_0x4e425b['params']['id']}})['then'](handleEntityNotFound(_0x350dde,null))[_0x7ef1('0x1e')](removeEntity(_0x350dde,null))['catch'](handleError(_0x350dde,null));};exports[_0x7ef1('0x45')]=function(_0x30a4ce,_0x54a0bb){return db[_0x7ef1('0x25')][_0x7ef1('0x45')]()[_0x7ef1('0x1e')](respondWithResult(_0x54a0bb,null))['catch'](handleError(_0x54a0bb,null));}; \ No newline at end of file +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(_0x77b86d,_0x200223){var _0x4e84b0=function(_0x7fc3f3){while(--_0x7fc3f3){_0x77b86d['push'](_0x77b86d['shift']());}};_0x4e84b0(++_0x200223);}(_0x1af3,0x1ca));var _0x31af=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0x1af3[_0xf34b0a];return _0x5021e1;};'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 diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ffed71b..3feac5a 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(_0x177008,_0x3806b7){var _0x36d641=function(_0x4f8e32){while(--_0x4f8e32){_0x177008['push'](_0x177008['shift']());}};_0x36d641(++_0x3806b7);}(_0x7a54,0x106));var _0x47a5=function(_0x1cbe51,_0x5a1c2f){_0x1cbe51=_0x1cbe51-0x0;var _0x730377=_0x7a54[_0x1cbe51];return _0x730377;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3bc4f4,_0x1e2b47){var _0x9f4cea=function(_0x4080cb){while(--_0x4080cb){_0x3bc4f4['push'](_0x3bc4f4['shift']());}};_0x9f4cea(++_0x1e2b47);}(_0x7a54,0x106));var _0x47a5=function(_0x39ef4a,_0x5c17f4){_0x39ef4a=_0x39ef4a-0x0;var _0x2ef9b8=_0x7a54[_0x39ef4a];return _0x2ef9b8;};'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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 602f07f..38fe41d 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 _0xd54d=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x41f4d3,_0x5e0883){var _0x12b528=function(_0x2ddba4){while(--_0x2ddba4){_0x41f4d3['push'](_0x41f4d3['shift']());}};_0x12b528(++_0x5e0883);}(_0xd54d,0x171));var _0xdd54=function(_0x44f16c,_0x4ea669){_0x44f16c=_0x44f16c-0x0;var _0x230de8=_0xd54d[_0x44f16c];return _0x230de8;};'use strict';var _=require(_0xdd54('0x0'));var util=require('util');var moment=require(_0xdd54('0x1'));var BPromise=require(_0xdd54('0x2'));var rs=require(_0xdd54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd54('0x4'))['db'];var utils=require(_0xdd54('0x5'));var logger=require(_0xdd54('0x6'))('rpc');var config=require(_0xdd54('0x7'));var jayson=require(_0xdd54('0x8'));var client=jayson[_0xdd54('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5314eb,_0x548ec9,_0xe3ffd){return new BPromise(function(_0x45fc61,_0x1561c2){return client[_0xdd54('0xa')](_0x5314eb,_0xe3ffd)['then'](function(_0x480d20){logger[_0xdd54('0xb')]('Cdr,\x20%s,\x20%s',_0x548ec9,_0xdd54('0xc'));logger[_0xdd54('0xd')](_0xdd54('0xe'),_0x548ec9,'request\x20sent',JSON[_0xdd54('0xf')](_0x480d20));if(_0x480d20['error']){if(_0x480d20[_0xdd54('0x10')][_0xdd54('0x11')]===0x1f4){logger['error'](_0xdd54('0x12'),_0x548ec9,_0x480d20[_0xdd54('0x10')][_0xdd54('0x13')]);return _0x1561c2(_0x480d20[_0xdd54('0x10')][_0xdd54('0x13')]);}logger['error'](_0xdd54('0x12'),_0x548ec9,_0x480d20['error']['message']);return _0x45fc61(_0x480d20[_0xdd54('0x10')]['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x548ec9,'request\x20sent');_0x45fc61(_0x480d20[_0xdd54('0x14')][_0xdd54('0x13')]);}})[_0xdd54('0x15')](function(_0x30892c){logger[_0xdd54('0x10')](_0xdd54('0x12'),_0x548ec9,_0x30892c);_0x1561c2(_0x30892c);});});} \ No newline at end of file +var _0x24d6=['error','message','catch','Cdr,\x20%s,\x20%s','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify'];(function(_0x5affa4,_0x4ba102){var _0x4eb0f3=function(_0x274bbb){while(--_0x274bbb){_0x5affa4['push'](_0x5affa4['shift']());}};_0x4eb0f3(++_0x4ba102);}(_0x24d6,0x17e));var _0x624d=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x24d6[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x624d('0x0'));var fs=require('fs');var Redis=require(_0x624d('0x1'));var db=require(_0x624d('0x2'))['db'];var utils=require(_0x624d('0x3'));var logger=require(_0x624d('0x4'))(_0x624d('0x5'));var config=require(_0x624d('0x6'));var jayson=require(_0x624d('0x7'));var client=jayson[_0x624d('0x8')][_0x624d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c8773,_0x58dc93,_0x4d5a48){return new BPromise(function(_0xe56aee,_0x20737d){return client['request'](_0x2c8773,_0x4d5a48)[_0x624d('0xa')](function(_0x55ec28){logger[_0x624d('0xb')]('Cdr,\x20%s,\x20%s',_0x58dc93,_0x624d('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x58dc93,_0x624d('0xc'),JSON[_0x624d('0xd')](_0x55ec28));if(_0x55ec28[_0x624d('0xe')]){if(_0x55ec28[_0x624d('0xe')]['code']===0x1f4){logger[_0x624d('0xe')]('Cdr,\x20%s,\x20%s',_0x58dc93,_0x55ec28[_0x624d('0xe')][_0x624d('0xf')]);return _0x20737d(_0x55ec28[_0x624d('0xe')]['message']);}logger[_0x624d('0xe')]('Cdr,\x20%s,\x20%s',_0x58dc93,_0x55ec28['error'][_0x624d('0xf')]);return _0xe56aee(_0x55ec28[_0x624d('0xe')][_0x624d('0xf')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x58dc93,_0x624d('0xc'));_0xe56aee(_0x55ec28['result'][_0x624d('0xf')]);}})[_0x624d('0x10')](function(_0x471e69){logger['error'](_0x624d('0x11'),_0x58dc93,_0x471e69);_0x20737d(_0x471e69);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d310c18..161566d 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(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x1eed52,_0x1bb3c1){var _0x57782a=function(_0x2cb894){while(--_0x2cb894){_0x1eed52['push'](_0x1eed52['shift']());}};_0x57782a(++_0x1bb3c1);}(_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 60cc55e..254c12b 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 _0x479d=['sequelize','exports','STRING'];(function(_0x49b0a8,_0x409294){var _0x162a83=function(_0x30ae56){while(--_0x30ae56){_0x49b0a8['push'](_0x49b0a8['shift']());}};_0x162a83(++_0x409294);}(_0x479d,0x1b0));var _0xd479=function(_0x2188aa,_0x33561f){_0x2188aa=_0x2188aa-0x0;var _0x30b27=_0x479d[_0x2188aa];return _0x30b27;};'use strict';var Sequelize=require(_0xd479('0x0'));module[_0xd479('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd479('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd479('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2925=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x23d075,_0x341f61){var _0x205e13=function(_0x2246b5){while(--_0x2246b5){_0x23d075['push'](_0x23d075['shift']());}};_0x205e13(++_0x341f61);}(_0x2925,0x1d9));var _0x5292=function(_0x1ebdd0,_0x346a06){_0x1ebdd0=_0x1ebdd0-0x0;var _0x38829e=_0x2925[_0x1ebdd0];return _0x38829e;};'use strict';var Sequelize=require('sequelize');module[_0x5292('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5292('0x1')],'allowNull':![],'defaultValue':_0x5292('0x2')},'appdata':{'type':Sequelize[_0x5292('0x3')]()},'description':{'type':Sequelize[_0x5292('0x1')]},'interval':{'type':Sequelize[_0x5292('0x1')],'defaultValue':_0x5292('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fb965bb..5b62ff6 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 _0xe87e=['then','destroy','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','catch','body','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/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x4c9fcc,_0x2bde89){var _0xcb4f7d=function(_0x5dd49b){while(--_0x5dd49b){_0x4c9fcc['push'](_0x4c9fcc['shift']());}};_0xcb4f7d(++_0x2bde89);}(_0xe87e,0x17d));var _0xee87=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xe87e[_0x35885a];return _0xe86249;};'use strict';var emlformat=require(_0xee87('0x0'));var rimraf=require(_0xee87('0x1'));var zipdir=require(_0xee87('0x2'));var jsonpatch=require(_0xee87('0x3'));var rp=require(_0xee87('0x4'));var moment=require('moment');var BPromise=require(_0xee87('0x5'));var Mustache=require(_0xee87('0x6'));var util=require(_0xee87('0x7'));var path=require(_0xee87('0x8'));var sox=require(_0xee87('0x9'));var csv=require(_0xee87('0xa'));var ejs=require(_0xee87('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xee87('0xc'));var crypto=require(_0xee87('0xd'));var jsforce=require(_0xee87('0xe'));var deskjs=require(_0xee87('0xf'));var toCsv=require(_0xee87('0xa'));var querystring=require('querystring');var Papa=require(_0xee87('0x10'));var Redis=require(_0xee87('0x11'));var authService=require(_0xee87('0x12'));var qs=require(_0xee87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee87('0x14'));var logger=require(_0xee87('0x15'))('api');var utils=require(_0xee87('0x16'));var config=require(_0xee87('0x17'));var licenseUtil=require(_0xee87('0x18'));var db=require(_0xee87('0x19'))['db'];function respondWithStatusCode(_0x252418,_0x2768f7){_0x2768f7=_0x2768f7||0xcc;return function(_0x317dcd){if(_0x317dcd){return _0x252418[_0xee87('0x1a')](_0x2768f7);}return _0x252418['status'](_0x2768f7)[_0xee87('0x1b')]();};}function respondWithResult(_0x2377a7,_0x49df11){_0x49df11=_0x49df11||0xc8;return function(_0x4be77d){if(_0x4be77d){return _0x2377a7[_0xee87('0x1c')](_0x49df11)[_0xee87('0x1d')](_0x4be77d);}};}function respondWithFilteredResult(_0x5175e6,_0x420526){return function(_0x35d1c7){if(_0x35d1c7){var _0x67df24=typeof _0x420526[_0xee87('0x1e')]==='undefined'&&typeof _0x420526[_0xee87('0x1f')]==='undefined';var _0x2f7ad3=_0x35d1c7[_0xee87('0x20')];var _0x1fa2be=_0x67df24?0x0:_0x420526['offset'];var _0x48a330=_0x67df24?_0x35d1c7[_0xee87('0x20')]:_0x420526[_0xee87('0x1e')]+_0x420526[_0xee87('0x1f')];var _0x4eb271;if(_0x48a330>=_0x2f7ad3){_0x48a330=_0x2f7ad3;_0x4eb271=0xc8;}else{_0x4eb271=0xce;}_0x5175e6[_0xee87('0x1c')](_0x4eb271);return _0x5175e6[_0xee87('0x21')](_0xee87('0x22'),_0x1fa2be+'-'+_0x48a330+'/'+_0x2f7ad3)[_0xee87('0x1d')](_0x35d1c7);}return null;};}function patchUpdates(_0x42ba7a){return function(_0x1d48c6){try{jsonpatch[_0xee87('0x23')](_0x1d48c6,_0x42ba7a,!![]);}catch(_0x504d15){return BPromise[_0xee87('0x24')](_0x504d15);}return _0x1d48c6[_0xee87('0x25')]();};}function saveUpdates(_0x406fde,_0x35e7cf){return function(_0x3176c6){if(_0x3176c6){return _0x3176c6[_0xee87('0x26')](_0x406fde)[_0xee87('0x27')](function(_0x1f5dc3){return _0x1f5dc3;});}return null;};}function removeEntity(_0xb41cbc,_0x49e9f5){return function(_0x5cc9a3){if(_0x5cc9a3){return _0x5cc9a3[_0xee87('0x28')]()[_0xee87('0x27')](function(){_0xb41cbc['status'](0xcc)[_0xee87('0x1b')]();});}};}function handleEntityNotFound(_0xb68987,_0x36a651){return function(_0x55236e){if(!_0x55236e){_0xb68987['sendStatus'](0x194);}return _0x55236e;};}function handleError(_0x18dd0d,_0x48fe19){_0x48fe19=_0x48fe19||0x1f4;return function(_0x36e381){logger['error'](_0x36e381[_0xee87('0x29')]);if(_0x36e381[_0xee87('0x2a')]){delete _0x36e381['name'];}_0x18dd0d[_0xee87('0x1c')](_0x48fe19)[_0xee87('0x2b')](_0x36e381);};}exports[_0xee87('0x2c')]=function(_0x1bd42a,_0x3fcc5e){var _0x5ac56a={'raw':!![],'where':{'id':_0x1bd42a[_0xee87('0x2d')]['id']}},_0x3eb538={};_0x3eb538[_0xee87('0x2e')]=_[_0xee87('0x2f')](db[_0xee87('0x30')][_0xee87('0x31')]);_0x3eb538[_0xee87('0x32')]=_['keys'](_0x1bd42a[_0xee87('0x32')]);_0x3eb538[_0xee87('0x33')]=_[_0xee87('0x34')](_0x3eb538[_0xee87('0x2e')],_0x3eb538[_0xee87('0x32')]);_0x5ac56a[_0xee87('0x35')]=_[_0xee87('0x34')](_0x3eb538[_0xee87('0x2e')],qs[_0xee87('0x36')](_0x1bd42a['query']['fields']));_0x5ac56a[_0xee87('0x35')]=_0x5ac56a['attributes'][_0xee87('0x37')]?_0x5ac56a[_0xee87('0x35')]:_0x3eb538[_0xee87('0x2e')];if(_0x1bd42a[_0xee87('0x32')][_0xee87('0x38')]){_0x5ac56a[_0xee87('0x39')]=[{'all':!![]}];}_0x5ac56a=_['merge']({},_0x5ac56a,_0x1bd42a['options']);return db[_0xee87('0x30')]['find'](_0x5ac56a)['then'](handleEntityNotFound(_0x3fcc5e,null))[_0xee87('0x27')](respondWithResult(_0x3fcc5e,null))[_0xee87('0x3a')](handleError(_0x3fcc5e,null));};exports[_0xee87('0x26')]=function(_0x5746e7,_0x27420a){if(_0x5746e7[_0xee87('0x3b')]['id']){delete _0x5746e7[_0xee87('0x3b')]['id'];}return db[_0xee87('0x30')]['find']({'where':{'id':_0x5746e7[_0xee87('0x2d')]['id']}})[_0xee87('0x27')](handleEntityNotFound(_0x27420a,null))[_0xee87('0x27')](saveUpdates(_0x5746e7['body'],null))[_0xee87('0x27')](respondWithResult(_0x27420a,null))[_0xee87('0x3a')](handleError(_0x27420a,null));};exports[_0xee87('0x28')]=function(_0x1c8d10,_0x512f54){return db[_0xee87('0x30')]['find']({'where':{'id':_0x1c8d10[_0xee87('0x2d')]['id']}})[_0xee87('0x27')](handleEntityNotFound(_0x512f54,null))[_0xee87('0x27')](removeEntity(_0x512f54,null))['catch'](handleError(_0x512f54,null));}; \ No newline at end of file +var _0x4156=['options','find','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','stack','name','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x4156,0xf1));var _0x6415=function(_0x55e007,_0xa44bac){_0x55e007=_0x55e007-0x0;var _0xe6c2a=_0x4156[_0x55e007];return _0xe6c2a;};'use strict';var emlformat=require(_0x6415('0x0'));var rimraf=require(_0x6415('0x1'));var zipdir=require(_0x6415('0x2'));var jsonpatch=require(_0x6415('0x3'));var rp=require(_0x6415('0x4'));var moment=require('moment');var BPromise=require(_0x6415('0x5'));var Mustache=require(_0x6415('0x6'));var util=require(_0x6415('0x7'));var path=require(_0x6415('0x8'));var sox=require(_0x6415('0x9'));var csv=require(_0x6415('0xa'));var ejs=require(_0x6415('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6415('0xc'));var squel=require('squel');var crypto=require(_0x6415('0xd'));var jsforce=require(_0x6415('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6415('0xa'));var querystring=require(_0x6415('0xf'));var Papa=require(_0x6415('0x10'));var Redis=require(_0x6415('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6415('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6415('0x13'))(_0x6415('0x14'));var utils=require(_0x6415('0x15'));var config=require(_0x6415('0x16'));var licenseUtil=require(_0x6415('0x17'));var db=require(_0x6415('0x18'))['db'];function respondWithStatusCode(_0x455f44,_0x596b97){_0x596b97=_0x596b97||0xcc;return function(_0x5b3493){if(_0x5b3493){return _0x455f44[_0x6415('0x19')](_0x596b97);}return _0x455f44[_0x6415('0x1a')](_0x596b97)[_0x6415('0x1b')]();};}function respondWithResult(_0xf75bec,_0x21ae74){_0x21ae74=_0x21ae74||0xc8;return function(_0x5b2a26){if(_0x5b2a26){return _0xf75bec['status'](_0x21ae74)[_0x6415('0x1c')](_0x5b2a26);}};}function respondWithFilteredResult(_0x780643,_0x48017d){return function(_0x1d540c){if(_0x1d540c){var _0x41f9b0=typeof _0x48017d['offset']==='undefined'&&typeof _0x48017d[_0x6415('0x1d')]===_0x6415('0x1e');var _0x3f739d=_0x1d540c[_0x6415('0x1f')];var _0x2ef73b=_0x41f9b0?0x0:_0x48017d[_0x6415('0x20')];var _0x2c74c6=_0x41f9b0?_0x1d540c[_0x6415('0x1f')]:_0x48017d[_0x6415('0x20')]+_0x48017d['limit'];var _0x551985;if(_0x2c74c6>=_0x3f739d){_0x2c74c6=_0x3f739d;_0x551985=0xc8;}else{_0x551985=0xce;}_0x780643['status'](_0x551985);return _0x780643[_0x6415('0x21')](_0x6415('0x22'),_0x2ef73b+'-'+_0x2c74c6+'/'+_0x3f739d)[_0x6415('0x1c')](_0x1d540c);}return null;};}function patchUpdates(_0x1e58f2){return function(_0x551632){try{jsonpatch[_0x6415('0x23')](_0x551632,_0x1e58f2,!![]);}catch(_0x3f4400){return BPromise[_0x6415('0x24')](_0x3f4400);}return _0x551632['save']();};}function saveUpdates(_0x287ac9,_0x266f97){return function(_0x7c567f){if(_0x7c567f){return _0x7c567f[_0x6415('0x25')](_0x287ac9)[_0x6415('0x26')](function(_0x3e33d3){return _0x3e33d3;});}return null;};}function removeEntity(_0x339c50,_0x41c266){return function(_0x1496c1){if(_0x1496c1){return _0x1496c1['destroy']()[_0x6415('0x26')](function(){_0x339c50[_0x6415('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15be31,_0x2b202c){return function(_0x2a936f){if(!_0x2a936f){_0x15be31[_0x6415('0x19')](0x194);}return _0x2a936f;};}function handleError(_0x31dabc,_0x5b5f39){_0x5b5f39=_0x5b5f39||0x1f4;return function(_0x30d857){logger['error'](_0x30d857[_0x6415('0x27')]);if(_0x30d857[_0x6415('0x28')]){delete _0x30d857[_0x6415('0x28')];}_0x31dabc['status'](_0x5b5f39)['send'](_0x30d857);};}exports['show']=function(_0x61e827,_0x31f717){var _0x581bc7={'raw':!![],'where':{'id':_0x61e827[_0x6415('0x29')]['id']}},_0x5bf08d={};_0x5bf08d[_0x6415('0x2a')]=_[_0x6415('0x2b')](db[_0x6415('0x2c')][_0x6415('0x2d')]);_0x5bf08d[_0x6415('0x2e')]=_['keys'](_0x61e827[_0x6415('0x2e')]);_0x5bf08d[_0x6415('0x2f')]=_[_0x6415('0x30')](_0x5bf08d[_0x6415('0x2a')],_0x5bf08d['query']);_0x581bc7['attributes']=_['intersection'](_0x5bf08d[_0x6415('0x2a')],qs['fields'](_0x61e827[_0x6415('0x2e')]['fields']));_0x581bc7[_0x6415('0x31')]=_0x581bc7[_0x6415('0x31')][_0x6415('0x32')]?_0x581bc7[_0x6415('0x31')]:_0x5bf08d['model'];if(_0x61e827['query'][_0x6415('0x33')]){_0x581bc7[_0x6415('0x34')]=[{'all':!![]}];}_0x581bc7=_[_0x6415('0x35')]({},_0x581bc7,_0x61e827[_0x6415('0x36')]);return db[_0x6415('0x2c')][_0x6415('0x37')](_0x581bc7)['then'](handleEntityNotFound(_0x31f717,null))[_0x6415('0x26')](respondWithResult(_0x31f717,null))['catch'](handleError(_0x31f717,null));};exports['update']=function(_0x4e07c6,_0x587b47){if(_0x4e07c6[_0x6415('0x38')]['id']){delete _0x4e07c6[_0x6415('0x38')]['id'];}return db[_0x6415('0x2c')]['find']({'where':{'id':_0x4e07c6[_0x6415('0x29')]['id']}})[_0x6415('0x26')](handleEntityNotFound(_0x587b47,null))['then'](saveUpdates(_0x4e07c6[_0x6415('0x38')],null))[_0x6415('0x26')](respondWithResult(_0x587b47,null))[_0x6415('0x39')](handleError(_0x587b47,null));};exports[_0x6415('0x3a')]=function(_0x248a5e,_0x59d828){return db[_0x6415('0x2c')]['find']({'where':{'id':_0x248a5e[_0x6415('0x29')]['id']}})[_0x6415('0x26')](handleEntityNotFound(_0x59d828,null))['then'](removeEntity(_0x59d828,null))[_0x6415('0x39')](handleError(_0x59d828,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5db65be..622f98a 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 _0x7429=['ChatApplication','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x7429,0x6f));var _0x9742=function(_0x4481dc,_0x200eeb){_0x4481dc=_0x4481dc-0x0;var _0x2a5b20=_0x7429[_0x4481dc];return _0x2a5b20;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9742('0x0'))('api');var moment=require(_0x9742('0x1'));var BPromise=require(_0x9742('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9742('0x3'));var rimraf=require(_0x9742('0x4'));var config=require(_0x9742('0x5'));var attributes=require(_0x9742('0x6'));module[_0x9742('0x7')]=function(_0x5a1528,_0x5a7ef9){return _0x5a1528[_0x9742('0x8')](_0x9742('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9742('0xa'),'collate':_0x9742('0xb')});}; \ No newline at end of file +var _0xde7f=['rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xde7f,0xa4));var _0xfde7=function(_0x10769a,_0xfd36d2){_0x10769a=_0x10769a-0x0;var _0x176daf=_0xde7f[_0x10769a];return _0x176daf;};'use strict';var _=require(_0xfde7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfde7('0x1'));var moment=require('moment');var BPromise=require(_0xfde7('0x2'));var rp=require(_0xfde7('0x3'));var fs=require('fs');var path=require(_0xfde7('0x4'));var rimraf=require(_0xfde7('0x5'));var config=require(_0xfde7('0x6'));var attributes=require(_0xfde7('0x7'));module[_0xfde7('0x8')]=function(_0x13ffe1,_0x54edd6){return _0x13ffe1['define'](_0xfde7('0x9'),attributes,{'tableName':_0xfde7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfde7('0xb'),'collate':_0xfde7('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 7d288d7..f523e4f 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 _0x2b86=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment'];(function(_0x3c7f1d,_0x44b37b){var _0xd7ab0c=function(_0x1dd6b2){while(--_0x1dd6b2){_0x3c7f1d['push'](_0x3c7f1d['shift']());}};_0xd7ab0c(++_0x44b37b);}(_0x2b86,0x1b2));var _0x62b8=function(_0x3f5ae8,_0x176bf1){_0x3f5ae8=_0x3f5ae8-0x0;var _0x1a8573=_0x2b86[_0x3f5ae8];return _0x1a8573;};'use strict';var _=require(_0x62b8('0x0'));var util=require(_0x62b8('0x1'));var moment=require(_0x62b8('0x2'));var BPromise=require(_0x62b8('0x3'));var rs=require(_0x62b8('0x4'));var fs=require('fs');var Redis=require(_0x62b8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x62b8('0x6'));var logger=require('../../config/logger')(_0x62b8('0x7'));var config=require(_0x62b8('0x8'));var jayson=require(_0x62b8('0x9'));var client=jayson[_0x62b8('0xa')][_0x62b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3278b7,_0x1b3a84,_0xf95861){return new BPromise(function(_0xf9981a,_0x1e1897){return client[_0x62b8('0xc')](_0x3278b7,_0xf95861)[_0x62b8('0xd')](function(_0x818841){logger[_0x62b8('0xe')](_0x62b8('0xf'),_0x1b3a84,_0x62b8('0x10'));logger[_0x62b8('0x11')](_0x62b8('0x12'),_0x1b3a84,_0x62b8('0x10'),JSON[_0x62b8('0x13')](_0x818841));if(_0x818841[_0x62b8('0x14')]){if(_0x818841[_0x62b8('0x14')][_0x62b8('0x15')]===0x1f4){logger['error'](_0x62b8('0xf'),_0x1b3a84,_0x818841['error']['message']);return _0x1e1897(_0x818841[_0x62b8('0x14')][_0x62b8('0x16')]);}logger[_0x62b8('0x14')](_0x62b8('0xf'),_0x1b3a84,_0x818841[_0x62b8('0x14')]['message']);return _0xf9981a(_0x818841[_0x62b8('0x14')][_0x62b8('0x16')]);}else{logger[_0x62b8('0xe')](_0x62b8('0xf'),_0x1b3a84,'request\x20sent');_0xf9981a(_0x818841['result'][_0x62b8('0x16')]);}})['catch'](function(_0x304d16){logger['error'](_0x62b8('0xf'),_0x1b3a84,_0x304d16);_0x1e1897(_0x304d16);});});} \ No newline at end of file +var _0x5780=['../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x5620c1,_0x18a353){var _0x91169c=function(_0x4121c4){while(--_0x4121c4){_0x5620c1['push'](_0x5620c1['shift']());}};_0x91169c(++_0x18a353);}(_0x5780,0x9a));var _0x0578=function(_0x240ddc,_0x13f4b6){_0x240ddc=_0x240ddc-0x0;var _0x35464=_0x5780[_0x240ddc];return _0x35464;};'use strict';var _=require(_0x0578('0x0'));var util=require(_0x0578('0x1'));var moment=require(_0x0578('0x2'));var BPromise=require(_0x0578('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0578('0x4'));var logger=require(_0x0578('0x5'))(_0x0578('0x6'));var config=require(_0x0578('0x7'));var jayson=require(_0x0578('0x8'));var client=jayson[_0x0578('0x9')][_0x0578('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a61c6,_0x3114a1,_0x1ec9ac){return new BPromise(function(_0x21a2fe,_0x534bb3){return client[_0x0578('0xb')](_0x5a61c6,_0x1ec9ac)['then'](function(_0x303ad1){logger[_0x0578('0xc')](_0x0578('0xd'),_0x3114a1,_0x0578('0xe'));logger[_0x0578('0xf')](_0x0578('0x10'),_0x3114a1,_0x0578('0xe'),JSON[_0x0578('0x11')](_0x303ad1));if(_0x303ad1[_0x0578('0x12')]){if(_0x303ad1[_0x0578('0x12')][_0x0578('0x13')]===0x1f4){logger['error'](_0x0578('0xd'),_0x3114a1,_0x303ad1[_0x0578('0x12')][_0x0578('0x14')]);return _0x534bb3(_0x303ad1[_0x0578('0x12')][_0x0578('0x14')]);}logger[_0x0578('0x12')](_0x0578('0xd'),_0x3114a1,_0x303ad1['error']['message']);return _0x21a2fe(_0x303ad1['error'][_0x0578('0x14')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x3114a1,_0x0578('0xe'));_0x21a2fe(_0x303ad1[_0x0578('0x15')][_0x0578('0x14')]);}})[_0x0578('0x16')](function(_0x3a2771){logger[_0x0578('0x12')]('ChatApplication,\x20%s,\x20%s',_0x3114a1,_0x3a2771);_0x534bb3(_0x3a2771);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 59bd673..508e463 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 _0x92a2=['destroy','exports','multer','util','path','connect-timeout','Router','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92a2,0x98));var _0x292a=function(_0x16cbb7,_0x51301){_0x16cbb7=_0x16cbb7-0x0;var _0x4507bf=_0x92a2[_0x16cbb7];return _0x4507bf;};'use strict';var multer=require(_0x292a('0x0'));var util=require(_0x292a('0x1'));var path=require(_0x292a('0x2'));var timeout=require(_0x292a('0x3'));var express=require('express');var router=express[_0x292a('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(_0x292a('0x5'));router[_0x292a('0x6')](_0x292a('0x7'),auth['isAuthenticated'](),controller[_0x292a('0x8')]);router[_0x292a('0x9')]('/:id',auth[_0x292a('0xa')](),controller[_0x292a('0xb')]);router[_0x292a('0xc')](_0x292a('0x7'),auth[_0x292a('0xa')](),controller[_0x292a('0xd')]);module[_0x292a('0xe')]=router; \ No newline at end of file +var _0xd16f=['isAuthenticated','put','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../config/environment','./chatApplication.controller'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd16f,0x1e6));var _0xfd16=function(_0x1496ec,_0x2f81e3){_0x1496ec=_0x1496ec-0x0;var _0x5e2b99=_0xd16f[_0x1496ec];return _0x5e2b99;};'use strict';var multer=require(_0xfd16('0x0'));var util=require(_0xfd16('0x1'));var path=require(_0xfd16('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd16('0x3'));var router=express[_0xfd16('0x4')]();var fs_extra=require(_0xfd16('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd16('0x6'));var controller=require(_0xfd16('0x7'));router['get']('/:id',auth[_0xfd16('0x8')](),controller['show']);router[_0xfd16('0x9')](_0xfd16('0xa'),auth[_0xfd16('0x8')](),controller[_0xfd16('0xb')]);router[_0xfd16('0xc')]('/:id',auth[_0xfd16('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7135b88..2fa0195 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 _0x6a80=['exports','STRING','BOOLEAN','sequelize'];(function(_0x53b74a,_0x40eddd){var _0x5a7c78=function(_0x465f38){while(--_0x465f38){_0x53b74a['push'](_0x53b74a['shift']());}};_0x5a7c78(++_0x40eddd);}(_0x6a80,0x1e7));var _0x06a8=function(_0x5d6e33,_0x4d5804){_0x5d6e33=_0x5d6e33-0x0;var _0x3fd62d=_0x6a80[_0x5d6e33];return _0x3fd62d;};'use strict';var Sequelize=require(_0x06a8('0x0'));module[_0x06a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x06a8('0x2')]},'write':{'type':Sequelize[_0x06a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcc13=['STRING','BOOLEAN'];(function(_0x1acdb0,_0x148326){var _0x45652e=function(_0x556532){while(--_0x556532){_0x1acdb0['push'](_0x1acdb0['shift']());}};_0x45652e(++_0x148326);}(_0xcc13,0x190));var _0x3cc1=function(_0x36b821,_0x386805){_0x36b821=_0x36b821-0x0;var _0x38608e=_0xcc13[_0x36b821];return _0x38608e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3cc1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x3cc1('0x0')]},'write':{'type':Sequelize[_0x3cc1('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 9c15797..dfe2651 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 _0xe8cb=['hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','ChatGroup','includeAll','include','findAll','rows','params','intersection','catch','create','body','update','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','removeMembers','addMessage','ChatGroupId','$gte','format','getMessages','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length'];(function(_0x1318f8,_0x3a4626){var _0x284b66=function(_0x470f16){while(--_0x470f16){_0x1318f8['push'](_0x1318f8['shift']());}};_0x284b66(++_0x3a4626);}(_0xe8cb,0xde));var _0xbe8c=function(_0x4185cb,_0x123951){_0x4185cb=_0x4185cb-0x0;var _0x4884c3=_0xe8cb[_0x4185cb];return _0x4884c3;};'use strict';var emlformat=require(_0xbe8c('0x0'));var rimraf=require(_0xbe8c('0x1'));var zipdir=require(_0xbe8c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe8c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe8c('0x4'));var util=require(_0xbe8c('0x5'));var path=require('path');var sox=require(_0xbe8c('0x6'));var csv=require(_0xbe8c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe8c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbe8c('0x9'));var deskjs=require(_0xbe8c('0xa'));var toCsv=require('to-csv');var querystring=require(_0xbe8c('0xb'));var Papa=require('papaparse');var Redis=require(_0xbe8c('0xc'));var authService=require(_0xbe8c('0xd'));var qs=require(_0xbe8c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe8c('0xf'));var logger=require(_0xbe8c('0x10'))(_0xbe8c('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbe8c('0x12'));var db=require(_0xbe8c('0x13'))['db'];config[_0xbe8c('0x14')]=_[_0xbe8c('0x15')](config[_0xbe8c('0x14')],{'host':_0xbe8c('0x16'),'port':0x18eb});var socket=require(_0xbe8c('0x17'))(new Redis(config[_0xbe8c('0x14')]));require(_0xbe8c('0x18'))[_0xbe8c('0x19')](socket);function respondWithStatusCode(_0x174cee,_0x262dfd){_0x262dfd=_0x262dfd||0xcc;return function(_0x3a950b){if(_0x3a950b){return _0x174cee[_0xbe8c('0x1a')](_0x262dfd);}return _0x174cee[_0xbe8c('0x1b')](_0x262dfd)['end']();};}function respondWithResult(_0x4fabd2,_0x29c696){_0x29c696=_0x29c696||0xc8;return function(_0x1c3c16){if(_0x1c3c16){return _0x4fabd2[_0xbe8c('0x1b')](_0x29c696)[_0xbe8c('0x1c')](_0x1c3c16);}};}function respondWithFilteredResult(_0x1a2c1,_0x280453){return function(_0xe62154){if(_0xe62154){var _0x2163b0=typeof _0x280453[_0xbe8c('0x1d')]===_0xbe8c('0x1e')&&typeof _0x280453['limit']===_0xbe8c('0x1e');var _0x5364b2=_0xe62154['count'];var _0x207300=_0x2163b0?0x0:_0x280453[_0xbe8c('0x1d')];var _0x30f3ef=_0x2163b0?_0xe62154[_0xbe8c('0x1f')]:_0x280453[_0xbe8c('0x1d')]+_0x280453[_0xbe8c('0x20')];var _0x2dcd81;if(_0x30f3ef>=_0x5364b2){_0x30f3ef=_0x5364b2;_0x2dcd81=0xc8;}else{_0x2dcd81=0xce;}_0x1a2c1['status'](_0x2dcd81);return _0x1a2c1[_0xbe8c('0x21')](_0xbe8c('0x22'),_0x207300+'-'+_0x30f3ef+'/'+_0x5364b2)[_0xbe8c('0x1c')](_0xe62154);}return null;};}function patchUpdates(_0x54061b){return function(_0x46af49){try{jsonpatch[_0xbe8c('0x23')](_0x46af49,_0x54061b,!![]);}catch(_0x78afd0){return BPromise[_0xbe8c('0x24')](_0x78afd0);}return _0x46af49['save']();};}function saveUpdates(_0x1c125b,_0x380805){return function(_0x4fa014){if(_0x4fa014){return _0x4fa014['update'](_0x1c125b)[_0xbe8c('0x25')](function(_0x164d8f){return _0x164d8f;});}return null;};}function removeEntity(_0x30736d,_0xaa8ed4){return function(_0x596864){if(_0x596864){return _0x596864[_0xbe8c('0x26')]()[_0xbe8c('0x25')](function(){_0x30736d[_0xbe8c('0x1b')](0xcc)[_0xbe8c('0x27')]();});}};}function handleEntityNotFound(_0x2682b8,_0x174860){return function(_0x3a07a5){if(!_0x3a07a5){_0x2682b8[_0xbe8c('0x1a')](0x194);}return _0x3a07a5;};}function handleError(_0x27d90b,_0x209a41){_0x209a41=_0x209a41||0x1f4;return function(_0x1c703a){logger[_0xbe8c('0x28')](_0x1c703a['stack']);if(_0x1c703a[_0xbe8c('0x29')]){delete _0x1c703a[_0xbe8c('0x29')];}_0x27d90b[_0xbe8c('0x1b')](_0x209a41)['send'](_0x1c703a);};}exports[_0xbe8c('0x2a')]=function(_0x5b91d8,_0x30c701){var _0x483c22={},_0x545141={},_0x2b6cc3={'count':0x0,'rows':[]};var _0x1f4ab1=_[_0xbe8c('0x2b')](db['ChatGroup'][_0xbe8c('0x2c')],function(_0x21dc8e){return{'name':_0x21dc8e[_0xbe8c('0x2d')],'type':_0x21dc8e[_0xbe8c('0x2e')]['key']};});_0x545141[_0xbe8c('0x2f')]=_[_0xbe8c('0x2b')](_0x1f4ab1,_0xbe8c('0x29'));_0x545141[_0xbe8c('0x30')]=_[_0xbe8c('0x31')](_0x5b91d8[_0xbe8c('0x30')]);_0x545141[_0xbe8c('0x32')]=_['intersection'](_0x545141['model'],_0x545141[_0xbe8c('0x30')]);_0x483c22[_0xbe8c('0x33')]=_['intersection'](_0x545141[_0xbe8c('0x2f')],qs[_0xbe8c('0x34')](_0x5b91d8['query'][_0xbe8c('0x34')]));_0x483c22[_0xbe8c('0x33')]=_0x483c22[_0xbe8c('0x33')][_0xbe8c('0x35')]?_0x483c22[_0xbe8c('0x33')]:_0x545141[_0xbe8c('0x2f')];if(!_0x5b91d8[_0xbe8c('0x30')][_0xbe8c('0x36')](_0xbe8c('0x37'))){_0x483c22[_0xbe8c('0x20')]=qs[_0xbe8c('0x20')](_0x5b91d8[_0xbe8c('0x30')][_0xbe8c('0x20')]);_0x483c22['offset']=qs['offset'](_0x5b91d8[_0xbe8c('0x30')][_0xbe8c('0x1d')]);}_0x483c22['order']=qs['sort'](_0x5b91d8[_0xbe8c('0x30')][_0xbe8c('0x38')]);_0x483c22['where']=qs[_0xbe8c('0x32')](_[_0xbe8c('0x39')](_0x5b91d8[_0xbe8c('0x30')],_0x545141[_0xbe8c('0x32')]),_0x1f4ab1);if(_0x5b91d8[_0xbe8c('0x30')][_0xbe8c('0x3a')]){_0x483c22[_0xbe8c('0x3b')]=_[_0xbe8c('0x3c')](_0x483c22[_0xbe8c('0x3b')],{'$or':_[_0xbe8c('0x2b')](_0x1f4ab1,function(_0x31dcb0){if(_0x31dcb0[_0xbe8c('0x2e')]!=='VIRTUAL'){var _0x137f23={};_0x137f23[_0x31dcb0[_0xbe8c('0x29')]]={'$like':'%'+_0x5b91d8['query'][_0xbe8c('0x3a')]+'%'};return _0x137f23;}})});}_0x483c22=_['merge']({},_0x483c22,_0x5b91d8[_0xbe8c('0x3d')]);var _0x20252f={'where':_0x483c22[_0xbe8c('0x3b')]};return db[_0xbe8c('0x3e')][_0xbe8c('0x1f')](_0x20252f)['then'](function(_0x3eca7d){_0x2b6cc3[_0xbe8c('0x1f')]=_0x3eca7d;if(_0x5b91d8[_0xbe8c('0x30')][_0xbe8c('0x3f')]){_0x483c22[_0xbe8c('0x40')]=[{'all':!![]}];}return db['ChatGroup'][_0xbe8c('0x41')](_0x483c22);})[_0xbe8c('0x25')](function(_0x27a53d){_0x2b6cc3[_0xbe8c('0x42')]=_0x27a53d;return _0x2b6cc3;})[_0xbe8c('0x25')](respondWithFilteredResult(_0x30c701,_0x483c22))['catch'](handleError(_0x30c701,null));};exports['show']=function(_0x4d3ffa,_0x7e9384){var _0x59c524={'raw':!![],'where':{'id':_0x4d3ffa[_0xbe8c('0x43')]['id']}},_0x282f79={};_0x282f79[_0xbe8c('0x2f')]=_[_0xbe8c('0x31')](db[_0xbe8c('0x3e')]['rawAttributes']);_0x282f79['query']=_['keys'](_0x4d3ffa[_0xbe8c('0x30')]);_0x282f79[_0xbe8c('0x32')]=_[_0xbe8c('0x44')](_0x282f79['model'],_0x282f79[_0xbe8c('0x30')]);_0x59c524[_0xbe8c('0x33')]=_[_0xbe8c('0x44')](_0x282f79[_0xbe8c('0x2f')],qs[_0xbe8c('0x34')](_0x4d3ffa['query']['fields']));_0x59c524[_0xbe8c('0x33')]=_0x59c524[_0xbe8c('0x33')][_0xbe8c('0x35')]?_0x59c524['attributes']:_0x282f79[_0xbe8c('0x2f')];if(_0x4d3ffa['query'][_0xbe8c('0x3f')]){_0x59c524[_0xbe8c('0x40')]=[{'all':!![]}];}_0x59c524=_[_0xbe8c('0x3c')]({},_0x59c524,_0x4d3ffa[_0xbe8c('0x3d')]);return db['ChatGroup']['find'](_0x59c524)['then'](handleEntityNotFound(_0x7e9384,null))[_0xbe8c('0x25')](respondWithResult(_0x7e9384,null))[_0xbe8c('0x45')](handleError(_0x7e9384,null));};exports[_0xbe8c('0x46')]=function(_0x31fda0,_0x169750){return db[_0xbe8c('0x3e')]['create'](_0x31fda0[_0xbe8c('0x47')],{})[_0xbe8c('0x25')](respondWithResult(_0x169750,0xc9))[_0xbe8c('0x45')](handleError(_0x169750,null));};exports[_0xbe8c('0x48')]=function(_0x2b1952,_0x5e7531){if(_0x2b1952['body']['id']){delete _0x2b1952[_0xbe8c('0x47')]['id'];}return db[_0xbe8c('0x3e')][_0xbe8c('0x49')]({'where':{'id':_0x2b1952[_0xbe8c('0x43')]['id']}})[_0xbe8c('0x25')](handleEntityNotFound(_0x5e7531,null))[_0xbe8c('0x25')](saveUpdates(_0x2b1952[_0xbe8c('0x47')],null))['then'](respondWithResult(_0x5e7531,null))[_0xbe8c('0x45')](handleError(_0x5e7531,null));};exports[_0xbe8c('0x26')]=function(_0x313154,_0x2f69d5){return db[_0xbe8c('0x3e')]['find']({'where':{'id':_0x313154[_0xbe8c('0x43')]['id']}})[_0xbe8c('0x25')](handleEntityNotFound(_0x2f69d5,null))[_0xbe8c('0x25')](removeEntity(_0x2f69d5,null))[_0xbe8c('0x45')](handleError(_0x2f69d5,null));};exports[_0xbe8c('0x4a')]=function(_0x2b4fe9,_0x4f8996){return db[_0xbe8c('0x3e')][_0xbe8c('0x4a')]()[_0xbe8c('0x25')](respondWithResult(_0x4f8996,null))[_0xbe8c('0x45')](handleError(_0x4f8996,null));};exports[_0xbe8c('0x4b')]=function(_0x414216,_0x4a4fe8,_0x1c3ff1){return db[_0xbe8c('0x4c')]['count']({'where':{'ChatGroupId':_0x414216['params']['id'],'ToId':_0x414216[_0xbe8c('0x4d')]['id'],'read':![]}})[_0xbe8c('0x25')](function(_0x1d699e){return{'id':_[_0xbe8c('0x4e')](_0x414216[_0xbe8c('0x43')]['id']),'count':_0x1d699e};})[_0xbe8c('0x25')](respondWithResult(_0x4a4fe8,null))[_0xbe8c('0x45')](handleError(_0x4a4fe8,null));};exports[_0xbe8c('0x4f')]=function(_0x44bf0f,_0x57747d,_0x291c2f){return db[_0xbe8c('0x3e')][_0xbe8c('0x49')]({'where':{'id':_0x44bf0f[_0xbe8c('0x43')]['id']}})[_0xbe8c('0x25')](handleEntityNotFound(_0x57747d,null))['then'](function(_0x13347c){if(_0x13347c){return _0x13347c[_0xbe8c('0x4f')](_0x44bf0f[_0xbe8c('0x47')][_0xbe8c('0x50')],_[_0xbe8c('0x51')](_0x44bf0f[_0xbe8c('0x47')],[_0xbe8c('0x50'),'id'])||{});}})[_0xbe8c('0x25')](respondWithResult(_0x57747d,null))[_0xbe8c('0x45')](handleError(_0x57747d,null));};exports[_0xbe8c('0x52')]=function(_0x4af367,_0x47c374,_0xa51235){var _0x903d48={};var _0x1caffb={};var _0x1ed9b1;var _0x47c367;return db[_0xbe8c('0x3e')][_0xbe8c('0x53')]({'where':{'id':_0x4af367['params']['id']}})[_0xbe8c('0x25')](handleEntityNotFound(_0x47c374,null))[_0xbe8c('0x25')](function(_0x4cb320){if(_0x4cb320){_0x1ed9b1=_0x4cb320;_0x1caffb[_0xbe8c('0x2f')]=_[_0xbe8c('0x31')](db[_0xbe8c('0x54')][_0xbe8c('0x2c')]);_0x1caffb['query']=_[_0xbe8c('0x31')](_0x4af367[_0xbe8c('0x30')]);_0x1caffb[_0xbe8c('0x32')]=_[_0xbe8c('0x44')](_0x1caffb[_0xbe8c('0x2f')],_0x1caffb[_0xbe8c('0x30')]);_0x903d48['attributes']=_[_0xbe8c('0x44')](_0x1caffb[_0xbe8c('0x2f')],qs[_0xbe8c('0x34')](_0x4af367[_0xbe8c('0x30')][_0xbe8c('0x34')]));_0x903d48['attributes']=_0x903d48[_0xbe8c('0x33')][_0xbe8c('0x35')]?_0x903d48[_0xbe8c('0x33')]:_0x1caffb[_0xbe8c('0x2f')];_0x903d48[_0xbe8c('0x55')]=qs[_0xbe8c('0x38')](_0x4af367[_0xbe8c('0x30')][_0xbe8c('0x38')]);_0x903d48[_0xbe8c('0x3b')]=qs[_0xbe8c('0x32')](_[_0xbe8c('0x39')](_0x4af367[_0xbe8c('0x30')],_0x1caffb[_0xbe8c('0x32')]));if(_0x4af367[_0xbe8c('0x30')][_0xbe8c('0x3a')]){_0x903d48[_0xbe8c('0x3b')]=_[_0xbe8c('0x3c')](_0x903d48[_0xbe8c('0x3b')],{'$or':_[_0xbe8c('0x2b')](_0x903d48['attributes'],function(_0x4730ad){var _0x706b1a={};_0x706b1a[_0x4730ad]={'$like':'%'+_0x4af367['query'][_0xbe8c('0x3a')]+'%'};return _0x706b1a;})});}_0x903d48=_['merge']({},_0x903d48,_0x4af367[_0xbe8c('0x3d')]);return _0x1ed9b1[_0xbe8c('0x52')](_0x903d48);}})[_0xbe8c('0x25')](function(_0x88db10){if(_0x88db10){_0x47c367=_0x88db10[_0xbe8c('0x35')];if(!_0x4af367[_0xbe8c('0x30')]['hasOwnProperty'](_0xbe8c('0x37'))){_0x903d48['limit']=qs['limit'](_0x4af367[_0xbe8c('0x30')]['limit']);_0x903d48[_0xbe8c('0x1d')]=qs[_0xbe8c('0x1d')](_0x4af367[_0xbe8c('0x30')][_0xbe8c('0x1d')]);}return _0x1ed9b1[_0xbe8c('0x52')](_0x903d48);}})[_0xbe8c('0x25')](function(_0x15e11d){if(_0x15e11d){return _0x15e11d?{'count':_0x47c367,'rows':_0x15e11d}:null;}})[_0xbe8c('0x25')](respondWithResult(_0x47c374,null))[_0xbe8c('0x45')](handleError(_0x47c374,null));};exports[_0xbe8c('0x56')]=function(_0x3e8647,_0x2b1fc2,_0x42a250){return db[_0xbe8c('0x3e')][_0xbe8c('0x49')]({'where':{'id':_0x3e8647[_0xbe8c('0x43')]['id']}})[_0xbe8c('0x25')](handleEntityNotFound(_0x2b1fc2,null))[_0xbe8c('0x25')](function(_0x1884a4){if(_0x1884a4){return _0x1884a4['removeMembers'](_0x3e8647['query']['ids']);}})['then'](respondWithStatusCode(_0x2b1fc2,null))[_0xbe8c('0x45')](handleError(_0x2b1fc2,null));};exports[_0xbe8c('0x57')]=function(_0x259d90,_0x460cb0,_0x42fc8e){if(_0x259d90[_0xbe8c('0x47')]['id']){delete _0x259d90['body']['id'];}return db[_0xbe8c('0x3e')][_0xbe8c('0x49')]({'where':{'id':_0x259d90[_0xbe8c('0x43')]['id']}})[_0xbe8c('0x25')](handleEntityNotFound(_0x460cb0,null))[_0xbe8c('0x25')](function(_0x2260b2){if(_0x2260b2){_0x259d90[_0xbe8c('0x47')][_0xbe8c('0x58')]=_0x2260b2['id'];return db[_0xbe8c('0x4c')]['create'](_0x259d90['body']);}})[_0xbe8c('0x25')](respondWithResult(_0x460cb0,null))[_0xbe8c('0x45')](handleError(_0x460cb0,null));};exports['getMessages']=function(_0x4db020,_0x45ae11,_0x140772){var _0x488c01={};var _0xf5dab2={};var _0x545bfa;var _0x180969;return db[_0xbe8c('0x3e')][_0xbe8c('0x53')]({'where':{'id':_0x4db020['params']['id']}})[_0xbe8c('0x25')](handleEntityNotFound(_0x45ae11,null))[_0xbe8c('0x25')](function(_0x21892){if(_0x21892){_0x545bfa=_0x21892;_0xf5dab2['model']=_[_0xbe8c('0x31')](db[_0xbe8c('0x4c')][_0xbe8c('0x2c')]);_0xf5dab2['query']=_['keys'](_0x4db020[_0xbe8c('0x30')]);_0xf5dab2[_0xbe8c('0x32')]=_['intersection'](_0xf5dab2[_0xbe8c('0x2f')],_0xf5dab2['query']);_0x488c01[_0xbe8c('0x33')]=_[_0xbe8c('0x44')](_0xf5dab2[_0xbe8c('0x2f')],qs[_0xbe8c('0x34')](_0x4db020[_0xbe8c('0x30')][_0xbe8c('0x34')]));_0x488c01[_0xbe8c('0x33')]=_0x488c01[_0xbe8c('0x33')][_0xbe8c('0x35')]?_0x488c01[_0xbe8c('0x33')]:_0xf5dab2[_0xbe8c('0x2f')];_0x488c01[_0xbe8c('0x55')]=qs[_0xbe8c('0x38')](_0x4db020[_0xbe8c('0x30')]['sort']);_0x488c01[_0xbe8c('0x3b')]=qs[_0xbe8c('0x32')](_[_0xbe8c('0x39')](_0x4db020[_0xbe8c('0x30')],_0xf5dab2[_0xbe8c('0x32')]));if(_0x4db020[_0xbe8c('0x30')][_0xbe8c('0x3a')]){_0x488c01[_0xbe8c('0x3b')]=_[_0xbe8c('0x3c')](_0x488c01[_0xbe8c('0x3b')],{'$or':_[_0xbe8c('0x2b')](_0x488c01['attributes'],function(_0x48c921){var _0x1409f9={};_0x1409f9[_0x48c921]={'$like':'%'+_0x4db020[_0xbe8c('0x30')][_0xbe8c('0x3a')]+'%'};return _0x1409f9;})});}if(_0x4db020[_0xbe8c('0x30')]['$gte']){var _0x2b3134=_0x4db020[_0xbe8c('0x30')][_0xbe8c('0x59')]['split'](',');var _0x4cd83d={};_0x4cd83d[_0x2b3134[0x0]]={'$gte':moment(_0x2b3134[0x1])[_0xbe8c('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x488c01[_0xbe8c('0x3b')]=_[_0xbe8c('0x3c')](_0x488c01[_0xbe8c('0x3b')],_0x4cd83d);}_0x488c01=_[_0xbe8c('0x3c')]({},_0x488c01,_0x4db020[_0xbe8c('0x3d')]);return _0x545bfa[_0xbe8c('0x5b')](_0x488c01);}})[_0xbe8c('0x25')](function(_0xb5ab29){if(_0xb5ab29){_0x180969=_0xb5ab29['length'];if(!_0x4db020['query'][_0xbe8c('0x36')](_0xbe8c('0x37'))){_0x488c01[_0xbe8c('0x20')]=qs[_0xbe8c('0x20')](_0x4db020[_0xbe8c('0x30')]['limit']);_0x488c01['offset']=qs['offset'](_0x4db020[_0xbe8c('0x30')][_0xbe8c('0x1d')]);}return _0x545bfa[_0xbe8c('0x5b')](_0x488c01);}})[_0xbe8c('0x25')](function(_0xf71ef4){if(_0xf71ef4){return _0xf71ef4?{'count':_0x180969,'rows':_0xf71ef4}:null;}})[_0xbe8c('0x25')](respondWithResult(_0x45ae11,null))[_0xbe8c('0x45')](handleError(_0x45ae11,null));}; \ No newline at end of file +var _0x325c=['where','pick','VIRTUAL','filter','merge','options','ChatGroup','includeAll','rows','catch','show','find','create','body','params','destroy','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','User','hasOwnProperty','nolimit','removeMembers','ChatInternalMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort'];(function(_0x4c6dbb,_0x228c81){var _0x1deceb=function(_0x550622){while(--_0x550622){_0x4c6dbb['push'](_0x4c6dbb['shift']());}};_0x1deceb(++_0x228c81);}(_0x325c,0xdb));var _0xc325=function(_0x5f03f4,_0x71be0){_0x5f03f4=_0x5f03f4-0x0;var _0x3a4d47=_0x325c[_0x5f03f4];return _0x3a4d47;};'use strict';var emlformat=require(_0xc325('0x0'));var rimraf=require(_0xc325('0x1'));var zipdir=require(_0xc325('0x2'));var jsonpatch=require(_0xc325('0x3'));var rp=require(_0xc325('0x4'));var moment=require('moment');var BPromise=require(_0xc325('0x5'));var Mustache=require('mustache');var util=require(_0xc325('0x6'));var path=require(_0xc325('0x7'));var sox=require(_0xc325('0x8'));var csv=require(_0xc325('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc325('0xa'));var _=require('lodash');var squel=require(_0xc325('0xb'));var crypto=require('crypto');var jsforce=require(_0xc325('0xc'));var deskjs=require(_0xc325('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc325('0xe'));var Papa=require(_0xc325('0xf'));var Redis=require(_0xc325('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc325('0x11'));var as=require(_0xc325('0x12'));var hardwareService=require(_0xc325('0x13'));var logger=require(_0xc325('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc325('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc325('0x16'))['db'];config['redis']=_[_0xc325('0x17')](config[_0xc325('0x18')],{'host':_0xc325('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc325('0x18')]));require(_0xc325('0x1a'))[_0xc325('0x1b')](socket);function respondWithStatusCode(_0x26cfdc,_0xdfab9f){_0xdfab9f=_0xdfab9f||0xcc;return function(_0x16a5ad){if(_0x16a5ad){return _0x26cfdc[_0xc325('0x1c')](_0xdfab9f);}return _0x26cfdc['status'](_0xdfab9f)[_0xc325('0x1d')]();};}function respondWithResult(_0x100390,_0x655b2f){_0x655b2f=_0x655b2f||0xc8;return function(_0x1c493f){if(_0x1c493f){return _0x100390[_0xc325('0x1e')](_0x655b2f)[_0xc325('0x1f')](_0x1c493f);}};}function respondWithFilteredResult(_0x23a7ae,_0x2df6b7){return function(_0x5a6cf1){if(_0x5a6cf1){var _0x346943=typeof _0x2df6b7[_0xc325('0x20')]==='undefined'&&typeof _0x2df6b7[_0xc325('0x21')]===_0xc325('0x22');var _0x39fac7=_0x5a6cf1[_0xc325('0x23')];var _0x252e8b=_0x346943?0x0:_0x2df6b7[_0xc325('0x20')];var _0x2b24e3=_0x346943?_0x5a6cf1[_0xc325('0x23')]:_0x2df6b7[_0xc325('0x20')]+_0x2df6b7[_0xc325('0x21')];var _0x40cc92;if(_0x2b24e3>=_0x39fac7){_0x2b24e3=_0x39fac7;_0x40cc92=0xc8;}else{_0x40cc92=0xce;}_0x23a7ae[_0xc325('0x1e')](_0x40cc92);return _0x23a7ae[_0xc325('0x24')](_0xc325('0x25'),_0x252e8b+'-'+_0x2b24e3+'/'+_0x39fac7)[_0xc325('0x1f')](_0x5a6cf1);}return null;};}function patchUpdates(_0x4e9073){return function(_0x583e8c){try{jsonpatch['apply'](_0x583e8c,_0x4e9073,!![]);}catch(_0x1f16ac){return BPromise['reject'](_0x1f16ac);}return _0x583e8c['save']();};}function saveUpdates(_0x1efc6e,_0x3218c2){return function(_0x263b3e){if(_0x263b3e){return _0x263b3e[_0xc325('0x26')](_0x1efc6e)[_0xc325('0x27')](function(_0xdc17ca){return _0xdc17ca;});}return null;};}function removeEntity(_0x4a9440,_0x4fb164){return function(_0x678c41){if(_0x678c41){return _0x678c41['destroy']()[_0xc325('0x27')](function(){_0x4a9440[_0xc325('0x1e')](0xcc)[_0xc325('0x1d')]();});}};}function handleEntityNotFound(_0x4849b3,_0x493a8e){return function(_0x5a115a){if(!_0x5a115a){_0x4849b3[_0xc325('0x1c')](0x194);}return _0x5a115a;};}function handleError(_0x3d2011,_0x5a4c45){_0x5a4c45=_0x5a4c45||0x1f4;return function(_0x28bb83){logger[_0xc325('0x28')](_0x28bb83[_0xc325('0x29')]);if(_0x28bb83[_0xc325('0x2a')]){delete _0x28bb83['name'];}_0x3d2011[_0xc325('0x1e')](_0x5a4c45)[_0xc325('0x2b')](_0x28bb83);};}exports[_0xc325('0x2c')]=function(_0x1f37bb,_0xfd0f10){var _0x304976={},_0xb189ba={},_0x29582d={'count':0x0,'rows':[]};var _0x3e4c38=_[_0xc325('0x2d')](db['ChatGroup'][_0xc325('0x2e')],function(_0x5d065a){return{'name':_0x5d065a[_0xc325('0x2f')],'type':_0x5d065a[_0xc325('0x30')][_0xc325('0x31')]};});_0xb189ba[_0xc325('0x32')]=_['map'](_0x3e4c38,_0xc325('0x2a'));_0xb189ba[_0xc325('0x33')]=_[_0xc325('0x34')](_0x1f37bb[_0xc325('0x33')]);_0xb189ba[_0xc325('0x35')]=_[_0xc325('0x36')](_0xb189ba['model'],_0xb189ba[_0xc325('0x33')]);_0x304976['attributes']=_[_0xc325('0x36')](_0xb189ba[_0xc325('0x32')],qs[_0xc325('0x37')](_0x1f37bb[_0xc325('0x33')]['fields']));_0x304976[_0xc325('0x38')]=_0x304976[_0xc325('0x38')][_0xc325('0x39')]?_0x304976['attributes']:_0xb189ba['model'];if(!_0x1f37bb['query']['hasOwnProperty']('nolimit')){_0x304976[_0xc325('0x21')]=qs[_0xc325('0x21')](_0x1f37bb[_0xc325('0x33')]['limit']);_0x304976['offset']=qs[_0xc325('0x20')](_0x1f37bb[_0xc325('0x33')][_0xc325('0x20')]);}_0x304976[_0xc325('0x3a')]=qs['sort'](_0x1f37bb[_0xc325('0x33')][_0xc325('0x3b')]);_0x304976[_0xc325('0x3c')]=qs[_0xc325('0x35')](_[_0xc325('0x3d')](_0x1f37bb[_0xc325('0x33')],_0xb189ba[_0xc325('0x35')]),_0x3e4c38);if(_0x1f37bb[_0xc325('0x33')]['filter']){_0x304976['where']=_['merge'](_0x304976[_0xc325('0x3c')],{'$or':_['map'](_0x3e4c38,function(_0x496257){if(_0x496257[_0xc325('0x30')]!==_0xc325('0x3e')){var _0xbd4301={};_0xbd4301[_0x496257[_0xc325('0x2a')]]={'$like':'%'+_0x1f37bb['query'][_0xc325('0x3f')]+'%'};return _0xbd4301;}})});}_0x304976=_[_0xc325('0x40')]({},_0x304976,_0x1f37bb[_0xc325('0x41')]);var _0x1f23ac={'where':_0x304976[_0xc325('0x3c')]};return db[_0xc325('0x42')][_0xc325('0x23')](_0x1f23ac)[_0xc325('0x27')](function(_0x43c5ab){_0x29582d[_0xc325('0x23')]=_0x43c5ab;if(_0x1f37bb[_0xc325('0x33')][_0xc325('0x43')]){_0x304976['include']=[{'all':!![]}];}return db[_0xc325('0x42')]['findAll'](_0x304976);})[_0xc325('0x27')](function(_0x19f78c){_0x29582d[_0xc325('0x44')]=_0x19f78c;return _0x29582d;})['then'](respondWithFilteredResult(_0xfd0f10,_0x304976))[_0xc325('0x45')](handleError(_0xfd0f10,null));};exports[_0xc325('0x46')]=function(_0x52069b,_0x5742e1){var _0x581098={'raw':!![],'where':{'id':_0x52069b['params']['id']}},_0x4f036d={};_0x4f036d[_0xc325('0x32')]=_[_0xc325('0x34')](db[_0xc325('0x42')][_0xc325('0x2e')]);_0x4f036d[_0xc325('0x33')]=_[_0xc325('0x34')](_0x52069b[_0xc325('0x33')]);_0x4f036d['filters']=_[_0xc325('0x36')](_0x4f036d[_0xc325('0x32')],_0x4f036d[_0xc325('0x33')]);_0x581098[_0xc325('0x38')]=_[_0xc325('0x36')](_0x4f036d[_0xc325('0x32')],qs[_0xc325('0x37')](_0x52069b[_0xc325('0x33')][_0xc325('0x37')]));_0x581098[_0xc325('0x38')]=_0x581098[_0xc325('0x38')][_0xc325('0x39')]?_0x581098[_0xc325('0x38')]:_0x4f036d['model'];if(_0x52069b[_0xc325('0x33')]['includeAll']){_0x581098['include']=[{'all':!![]}];}_0x581098=_['merge']({},_0x581098,_0x52069b[_0xc325('0x41')]);return db[_0xc325('0x42')][_0xc325('0x47')](_0x581098)[_0xc325('0x27')](handleEntityNotFound(_0x5742e1,null))[_0xc325('0x27')](respondWithResult(_0x5742e1,null))[_0xc325('0x45')](handleError(_0x5742e1,null));};exports[_0xc325('0x48')]=function(_0x1aa145,_0x1deffb){return db['ChatGroup'][_0xc325('0x48')](_0x1aa145['body'],{})[_0xc325('0x27')](respondWithResult(_0x1deffb,0xc9))[_0xc325('0x45')](handleError(_0x1deffb,null));};exports[_0xc325('0x26')]=function(_0x4e67f6,_0x422b73){if(_0x4e67f6[_0xc325('0x49')]['id']){delete _0x4e67f6[_0xc325('0x49')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x4e67f6[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x422b73,null))[_0xc325('0x27')](saveUpdates(_0x4e67f6[_0xc325('0x49')],null))[_0xc325('0x27')](respondWithResult(_0x422b73,null))[_0xc325('0x45')](handleError(_0x422b73,null));};exports[_0xc325('0x4b')]=function(_0x244b64,_0x3d1366){return db[_0xc325('0x42')][_0xc325('0x47')]({'where':{'id':_0x244b64[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x3d1366,null))[_0xc325('0x27')](removeEntity(_0x3d1366,null))[_0xc325('0x45')](handleError(_0x3d1366,null));};exports[_0xc325('0x4c')]=function(_0x363988,_0x26b877){return db[_0xc325('0x42')][_0xc325('0x4c')]()[_0xc325('0x27')](respondWithResult(_0x26b877,null))[_0xc325('0x45')](handleError(_0x26b877,null));};exports[_0xc325('0x4d')]=function(_0x31fe6f,_0x2a60f9,_0x767a98){return db['ChatInternalMessage'][_0xc325('0x23')]({'where':{'ChatGroupId':_0x31fe6f[_0xc325('0x4a')]['id'],'ToId':_0x31fe6f[_0xc325('0x4e')]['id'],'read':![]}})[_0xc325('0x27')](function(_0x3de0ed){return{'id':_[_0xc325('0x4f')](_0x31fe6f[_0xc325('0x4a')]['id']),'count':_0x3de0ed};})['then'](respondWithResult(_0x2a60f9,null))[_0xc325('0x45')](handleError(_0x2a60f9,null));};exports['addMembers']=function(_0x457823,_0x19cf5e,_0x292e10){return db[_0xc325('0x42')]['find']({'where':{'id':_0x457823[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x19cf5e,null))[_0xc325('0x27')](function(_0x460a04){if(_0x460a04){return _0x460a04[_0xc325('0x50')](_0x457823[_0xc325('0x49')][_0xc325('0x51')],_['omit'](_0x457823['body'],[_0xc325('0x51'),'id'])||{});}})['then'](respondWithResult(_0x19cf5e,null))[_0xc325('0x45')](handleError(_0x19cf5e,null));};exports[_0xc325('0x52')]=function(_0x523e73,_0x34c8a9,_0xb3dd69){var _0x269039={};var _0x285da4={};var _0x1fc690;var _0x185e0f;return db[_0xc325('0x42')][_0xc325('0x53')]({'where':{'id':_0x523e73[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x34c8a9,null))[_0xc325('0x27')](function(_0x5c8c35){if(_0x5c8c35){_0x1fc690=_0x5c8c35;_0x285da4[_0xc325('0x32')]=_[_0xc325('0x34')](db[_0xc325('0x54')][_0xc325('0x2e')]);_0x285da4['query']=_[_0xc325('0x34')](_0x523e73[_0xc325('0x33')]);_0x285da4[_0xc325('0x35')]=_[_0xc325('0x36')](_0x285da4['model'],_0x285da4[_0xc325('0x33')]);_0x269039[_0xc325('0x38')]=_['intersection'](_0x285da4[_0xc325('0x32')],qs[_0xc325('0x37')](_0x523e73[_0xc325('0x33')][_0xc325('0x37')]));_0x269039[_0xc325('0x38')]=_0x269039[_0xc325('0x38')][_0xc325('0x39')]?_0x269039['attributes']:_0x285da4[_0xc325('0x32')];_0x269039['order']=qs[_0xc325('0x3b')](_0x523e73[_0xc325('0x33')][_0xc325('0x3b')]);_0x269039[_0xc325('0x3c')]=qs['filters'](_[_0xc325('0x3d')](_0x523e73[_0xc325('0x33')],_0x285da4[_0xc325('0x35')]));if(_0x523e73['query'][_0xc325('0x3f')]){_0x269039[_0xc325('0x3c')]=_[_0xc325('0x40')](_0x269039[_0xc325('0x3c')],{'$or':_[_0xc325('0x2d')](_0x269039['attributes'],function(_0x1aab7b){var _0x488b56={};_0x488b56[_0x1aab7b]={'$like':'%'+_0x523e73[_0xc325('0x33')][_0xc325('0x3f')]+'%'};return _0x488b56;})});}_0x269039=_[_0xc325('0x40')]({},_0x269039,_0x523e73[_0xc325('0x41')]);return _0x1fc690[_0xc325('0x52')](_0x269039);}})[_0xc325('0x27')](function(_0x7225e4){if(_0x7225e4){_0x185e0f=_0x7225e4['length'];if(!_0x523e73['query'][_0xc325('0x55')](_0xc325('0x56'))){_0x269039[_0xc325('0x21')]=qs[_0xc325('0x21')](_0x523e73[_0xc325('0x33')][_0xc325('0x21')]);_0x269039[_0xc325('0x20')]=qs[_0xc325('0x20')](_0x523e73[_0xc325('0x33')]['offset']);}return _0x1fc690[_0xc325('0x52')](_0x269039);}})[_0xc325('0x27')](function(_0x33f710){if(_0x33f710){return _0x33f710?{'count':_0x185e0f,'rows':_0x33f710}:null;}})[_0xc325('0x27')](respondWithResult(_0x34c8a9,null))[_0xc325('0x45')](handleError(_0x34c8a9,null));};exports['removeMembers']=function(_0x130aed,_0x94d139,_0x311e5d){return db['ChatGroup'][_0xc325('0x47')]({'where':{'id':_0x130aed[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x94d139,null))['then'](function(_0x442571){if(_0x442571){return _0x442571[_0xc325('0x57')](_0x130aed['query']['ids']);}})[_0xc325('0x27')](respondWithStatusCode(_0x94d139,null))[_0xc325('0x45')](handleError(_0x94d139,null));};exports['addMessage']=function(_0x54092a,_0x24d5ef,_0x5b6593){if(_0x54092a[_0xc325('0x49')]['id']){delete _0x54092a['body']['id'];}return db['ChatGroup'][_0xc325('0x47')]({'where':{'id':_0x54092a[_0xc325('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24d5ef,null))['then'](function(_0x525504){if(_0x525504){_0x54092a[_0xc325('0x49')]['ChatGroupId']=_0x525504['id'];return db[_0xc325('0x58')][_0xc325('0x48')](_0x54092a['body']);}})[_0xc325('0x27')](respondWithResult(_0x24d5ef,null))['catch'](handleError(_0x24d5ef,null));};exports[_0xc325('0x59')]=function(_0x2bb21f,_0x4ead27,_0x405e47){var _0x525f85={};var _0x5eec10={};var _0x205440;var _0x5a43c7;return db[_0xc325('0x42')][_0xc325('0x53')]({'where':{'id':_0x2bb21f[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x4ead27,null))[_0xc325('0x27')](function(_0x2d5bde){if(_0x2d5bde){_0x205440=_0x2d5bde;_0x5eec10['model']=_['keys'](db[_0xc325('0x58')][_0xc325('0x2e')]);_0x5eec10[_0xc325('0x33')]=_[_0xc325('0x34')](_0x2bb21f[_0xc325('0x33')]);_0x5eec10[_0xc325('0x35')]=_[_0xc325('0x36')](_0x5eec10[_0xc325('0x32')],_0x5eec10[_0xc325('0x33')]);_0x525f85[_0xc325('0x38')]=_[_0xc325('0x36')](_0x5eec10[_0xc325('0x32')],qs[_0xc325('0x37')](_0x2bb21f[_0xc325('0x33')][_0xc325('0x37')]));_0x525f85[_0xc325('0x38')]=_0x525f85[_0xc325('0x38')]['length']?_0x525f85[_0xc325('0x38')]:_0x5eec10[_0xc325('0x32')];_0x525f85[_0xc325('0x3a')]=qs[_0xc325('0x3b')](_0x2bb21f[_0xc325('0x33')][_0xc325('0x3b')]);_0x525f85[_0xc325('0x3c')]=qs[_0xc325('0x35')](_[_0xc325('0x3d')](_0x2bb21f[_0xc325('0x33')],_0x5eec10[_0xc325('0x35')]));if(_0x2bb21f[_0xc325('0x33')][_0xc325('0x3f')]){_0x525f85[_0xc325('0x3c')]=_[_0xc325('0x40')](_0x525f85[_0xc325('0x3c')],{'$or':_[_0xc325('0x2d')](_0x525f85[_0xc325('0x38')],function(_0x22f902){var _0x5d55bd={};_0x5d55bd[_0x22f902]={'$like':'%'+_0x2bb21f[_0xc325('0x33')][_0xc325('0x3f')]+'%'};return _0x5d55bd;})});}if(_0x2bb21f[_0xc325('0x33')][_0xc325('0x5a')]){var _0x732538=_0x2bb21f[_0xc325('0x33')][_0xc325('0x5a')]['split'](',');var _0x2ee34b={};_0x2ee34b[_0x732538[0x0]]={'$gte':moment(_0x732538[0x1])[_0xc325('0x5b')](_0xc325('0x5c'))};_0x525f85['where']=_[_0xc325('0x40')](_0x525f85['where'],_0x2ee34b);}_0x525f85=_[_0xc325('0x40')]({},_0x525f85,_0x2bb21f['options']);return _0x205440[_0xc325('0x59')](_0x525f85);}})[_0xc325('0x27')](function(_0x3e6503){if(_0x3e6503){_0x5a43c7=_0x3e6503['length'];if(!_0x2bb21f[_0xc325('0x33')][_0xc325('0x55')](_0xc325('0x56'))){_0x525f85['limit']=qs[_0xc325('0x21')](_0x2bb21f[_0xc325('0x33')][_0xc325('0x21')]);_0x525f85[_0xc325('0x20')]=qs['offset'](_0x2bb21f[_0xc325('0x33')]['offset']);}return _0x205440['getMessages'](_0x525f85);}})[_0xc325('0x27')](function(_0x5a6599){if(_0x5a6599){return _0x5a6599?{'count':_0x5a43c7,'rows':_0x5a6599}:null;}})[_0xc325('0x27')](respondWithResult(_0x4ead27,null))['catch'](handleError(_0x4ead27,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index db2590a..a451f73 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 _0x2323=['exports','events','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x539724,_0x555dd1){var _0x51b522=function(_0x2aa9c4){while(--_0x2aa9c4){_0x539724['push'](_0x539724['shift']());}};_0x51b522(++_0x555dd1);}(_0x2323,0x7f));var _0x3232=function(_0x58c9ce,_0x375cd1){_0x58c9ce=_0x58c9ce-0x0;var _0x59e23b=_0x2323[_0x58c9ce];return _0x59e23b;};'use strict';var EventEmitter=require(_0x3232('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x3232('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3232('0x2')](0x0);var events={'afterCreate':_0x3232('0x3'),'afterUpdate':_0x3232('0x4'),'afterDestroy':_0x3232('0x5')};function emitEvent(_0x37dd1a){return function(_0x476485,_0x3663da,_0x55d0ad){ChatGroupEvents[_0x3232('0x6')](_0x37dd1a+':'+_0x476485['id'],_0x476485);ChatGroupEvents[_0x3232('0x6')](_0x37dd1a,_0x476485);_0x55d0ad(null);};}for(var e in events){if(events[_0x3232('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x3232('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x6d3f=['ChatGroup','setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x473e31,_0x18eeaf){var _0x5a831f=function(_0x26fbfd){while(--_0x26fbfd){_0x473e31['push'](_0x473e31['shift']());}};_0x5a831f(++_0x18eeaf);}(_0x6d3f,0xe6));var _0xf6d3=function(_0x26d5d5,_0x14084e){_0x26d5d5=_0x26d5d5-0x0;var _0x3a8a8b=_0x6d3f[_0x26d5d5];return _0x3a8a8b;};'use strict';var EventEmitter=require(_0xf6d3('0x0'));var ChatGroup=require(_0xf6d3('0x1'))['db'][_0xf6d3('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf6d3('0x3')](0x0);var events={'afterCreate':_0xf6d3('0x4'),'afterUpdate':_0xf6d3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1ae390){return function(_0xcaecfe,_0xa2efe5,_0x4070dd){ChatGroupEvents[_0xf6d3('0x6')](_0x1ae390+':'+_0xcaecfe['id'],_0xcaecfe);ChatGroupEvents[_0xf6d3('0x6')](_0x1ae390,_0xcaecfe);_0x4070dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xf6d3('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 55d2eac..20cdf6d 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 _0xad9d=['define','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x532ab7,_0x35a7be){var _0xa84ea=function(_0x359844){while(--_0x359844){_0x532ab7['push'](_0x532ab7['shift']());}};_0xa84ea(++_0x35a7be);}(_0xad9d,0x12d));var _0xdad9=function(_0x5ec6bb,_0x120d78){_0x5ec6bb=_0x5ec6bb-0x0;var _0x18d622=_0xad9d[_0x5ec6bb];return _0x18d622;};'use strict';var _=require(_0xdad9('0x0'));var util=require(_0xdad9('0x1'));var logger=require(_0xdad9('0x2'))(_0xdad9('0x3'));var moment=require('moment');var BPromise=require(_0xdad9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdad9('0x5'));var rimraf=require(_0xdad9('0x6'));var config=require(_0xdad9('0x7'));var attributes=require(_0xdad9('0x8'));module['exports']=function(_0x5444cd,_0x239457){return _0x5444cd[_0xdad9('0x9')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5797=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util'];(function(_0x380eca,_0x3a1430){var _0x32b500=function(_0x48df42){while(--_0x48df42){_0x380eca['push'](_0x380eca['shift']());}};_0x32b500(++_0x3a1430);}(_0x5797,0x1d2));var _0x7579=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x5797[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x7579('0x0'));var util=require(_0x7579('0x1'));var logger=require(_0x7579('0x2'))(_0x7579('0x3'));var moment=require(_0x7579('0x4'));var BPromise=require(_0x7579('0x5'));var rp=require(_0x7579('0x6'));var fs=require('fs');var path=require(_0x7579('0x7'));var rimraf=require(_0x7579('0x8'));var config=require('../../config/environment');var attributes=require(_0x7579('0x9'));module['exports']=function(_0x152db4,_0xb30bc4){return _0x152db4[_0x7579('0xa')](_0x7579('0xb'),attributes,{'tableName':_0x7579('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5ce0fff..fdcbbba 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 _0x41f2=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x44ac18,_0x8036a1){var _0x289db9=function(_0x3ec63e){while(--_0x3ec63e){_0x44ac18['push'](_0x44ac18['shift']());}};_0x289db9(++_0x8036a1);}(_0x41f2,0x14f));var _0x241f=function(_0x868ad,_0x86b626){_0x868ad=_0x868ad-0x0;var _0x1f93e0=_0x41f2[_0x868ad];return _0x1f93e0;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var moment=require('moment');var BPromise=require(_0x241f('0x2'));var rs=require(_0x241f('0x3'));var fs=require('fs');var Redis=require(_0x241f('0x4'));var db=require(_0x241f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x241f('0x6'))(_0x241f('0x7'));var config=require('../../config/environment');var jayson=require(_0x241f('0x8'));var client=jayson[_0x241f('0x9')][_0x241f('0xa')]({'port':0x232a});config[_0x241f('0xb')]=_[_0x241f('0xc')](config['redis'],{'host':_0x241f('0xd'),'port':0x18eb});var socket=require(_0x241f('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x307b1f,_0x481686,_0x171efa){return new BPromise(function(_0x497212,_0xdabda7){return client['request'](_0x307b1f,_0x171efa)[_0x241f('0xf')](function(_0x4ce752){logger[_0x241f('0x10')](_0x241f('0x11'),_0x481686,_0x241f('0x12'));logger['debug'](_0x241f('0x13'),_0x481686,_0x241f('0x12'),JSON[_0x241f('0x14')](_0x4ce752));if(_0x4ce752[_0x241f('0x15')]){if(_0x4ce752['error'][_0x241f('0x16')]===0x1f4){logger['error'](_0x241f('0x11'),_0x481686,_0x4ce752[_0x241f('0x15')]['message']);return _0xdabda7(_0x4ce752[_0x241f('0x15')][_0x241f('0x17')]);}logger[_0x241f('0x15')](_0x241f('0x11'),_0x481686,_0x4ce752['error'][_0x241f('0x17')]);return _0x497212(_0x4ce752[_0x241f('0x15')]['message']);}else{logger[_0x241f('0x10')]('ChatGroup,\x20%s,\x20%s',_0x481686,_0x241f('0x12'));_0x497212(_0x4ce752[_0x241f('0x18')]['message']);}})[_0x241f('0x19')](function(_0x76f461){logger['error']('ChatGroup,\x20%s,\x20%s',_0x481686,_0x76f461);_0xdabda7(_0x76f461);});});} \ No newline at end of file +var _0xb717=['message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x48c6a8,_0x11e119){var _0x23456b=function(_0x1317e9){while(--_0x1317e9){_0x48c6a8['push'](_0x48c6a8['shift']());}};_0x23456b(++_0x11e119);}(_0xb717,0x1b4));var _0x7b71=function(_0x30ac25,_0x3999a9){_0x30ac25=_0x30ac25-0x0;var _0x1f8da3=_0xb717[_0x30ac25];return _0x1f8da3;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var moment=require(_0x7b71('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b71('0x2'));var fs=require('fs');var Redis=require(_0x7b71('0x3'));var db=require(_0x7b71('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var jayson=require(_0x7b71('0x8'));var client=jayson[_0x7b71('0x9')]['http']({'port':0x232a});config[_0x7b71('0xa')]=_[_0x7b71('0xb')](config[_0x7b71('0xa')],{'host':_0x7b71('0xc'),'port':0x18eb});var socket=require(_0x7b71('0xd'))(new Redis(config['redis']));require(_0x7b71('0xe'))[_0x7b71('0xf')](socket);function respondWithRpcPromise(_0x53857a,_0x1b7a5b,_0x45bbcd){return new BPromise(function(_0x179fab,_0x55c72a){return client[_0x7b71('0x10')](_0x53857a,_0x45bbcd)['then'](function(_0x470f77){logger['info'](_0x7b71('0x11'),_0x1b7a5b,_0x7b71('0x12'));logger[_0x7b71('0x13')](_0x7b71('0x14'),_0x1b7a5b,_0x7b71('0x12'),JSON['stringify'](_0x470f77));if(_0x470f77[_0x7b71('0x15')]){if(_0x470f77['error'][_0x7b71('0x16')]===0x1f4){logger[_0x7b71('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1b7a5b,_0x470f77[_0x7b71('0x15')][_0x7b71('0x17')]);return _0x55c72a(_0x470f77[_0x7b71('0x15')]['message']);}logger['error'](_0x7b71('0x11'),_0x1b7a5b,_0x470f77[_0x7b71('0x15')][_0x7b71('0x17')]);return _0x179fab(_0x470f77[_0x7b71('0x15')]['message']);}else{logger[_0x7b71('0x18')]('ChatGroup,\x20%s,\x20%s',_0x1b7a5b,'request\x20sent');_0x179fab(_0x470f77[_0x7b71('0x19')][_0x7b71('0x17')]);}})[_0x7b71('0x1a')](function(_0x46c47d){logger[_0x7b71('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1b7a5b,_0x46c47d);_0x55c72a(_0x46c47d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1d1f7a2..fcad6c3 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 _0x2587=['chatGroup:','./chatGroup.events','save','update','emit','removeListener','register'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0x2587,0x1c8));var _0x7258=function(_0x487131,_0x2c86e8){_0x487131=_0x487131-0x0;var _0xf320ff=_0x2587[_0x487131];return _0xf320ff;};'use strict';var ChatGroupEvents=require(_0x7258('0x0'));var events=[_0x7258('0x1'),'remove',_0x7258('0x2')];function createListener(_0x580023,_0x57012b){return function(_0x3017ef){_0x57012b[_0x7258('0x3')](_0x580023,_0x3017ef);};}function removeListener(_0x302fdd,_0x188de9){return function(){ChatGroupEvents[_0x7258('0x4')](_0x302fdd,_0x188de9);};}exports[_0x7258('0x5')]=function(_0x37db63){for(var _0x22af3a=0x0,_0x274ac5=events['length'];_0x22af3a<_0x274ac5;_0x22af3a++){var _0x37b491=events[_0x22af3a];var _0x10dd4f=createListener(_0x7258('0x6')+_0x37b491,_0x37db63);ChatGroupEvents['on'](_0x37b491,_0x10dd4f);}}; \ No newline at end of file +var _0xe8da=['length','./chatGroup.events','save','update','emit','removeListener','register'];(function(_0x38a999,_0x50ebc3){var _0x5e7f35=function(_0x5cc0e5){while(--_0x5cc0e5){_0x38a999['push'](_0x38a999['shift']());}};_0x5e7f35(++_0x50ebc3);}(_0xe8da,0xef));var _0xae8d=function(_0x2116f5,_0x327df2){_0x2116f5=_0x2116f5-0x0;var _0x35e37c=_0xe8da[_0x2116f5];return _0x35e37c;};'use strict';var ChatGroupEvents=require(_0xae8d('0x0'));var events=[_0xae8d('0x1'),'remove',_0xae8d('0x2')];function createListener(_0x122666,_0x438812){return function(_0x19bae2){_0x438812[_0xae8d('0x3')](_0x122666,_0x19bae2);};}function removeListener(_0x566055,_0x2bd7f3){return function(){ChatGroupEvents[_0xae8d('0x4')](_0x566055,_0x2bd7f3);};}exports[_0xae8d('0x5')]=function(_0x49bbcd){for(var _0xd1a2cd=0x0,_0x4e4ee0=events[_0xae8d('0x6')];_0xd1a2cd<_0x4e4ee0;_0xd1a2cd++){var _0x1a8af0=events[_0xd1a2cd];var _0x5388a4=createListener('chatGroup:'+_0x1a8af0,_0x49bbcd);ChatGroupEvents['on'](_0x1a8af0,_0x5388a4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d1ede5a..29e73dd 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 _0x3e7e=['index','get','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','create','/:id/messages','put','delete','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated'];(function(_0x2a5fdd,_0xa280fe){var _0x59f368=function(_0xbc12de){while(--_0xbc12de){_0x2a5fdd['push'](_0x2a5fdd['shift']());}};_0x59f368(++_0xa280fe);}(_0x3e7e,0xe9));var _0xe3e7=function(_0x297007,_0x1219a0){_0x297007=_0x297007-0x0;var _0x573981=_0x3e7e[_0x297007];return _0x573981;};'use strict';var multer=require(_0xe3e7('0x0'));var util=require(_0xe3e7('0x1'));var path=require(_0xe3e7('0x2'));var timeout=require(_0xe3e7('0x3'));var express=require(_0xe3e7('0x4'));var router=express['Router']();var fs_extra=require(_0xe3e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe3e7('0x6'));var config=require(_0xe3e7('0x7'));var controller=require(_0xe3e7('0x8'));router['get']('/',auth[_0xe3e7('0x9')](),controller[_0xe3e7('0xa')]);router[_0xe3e7('0xb')](_0xe3e7('0xc'),auth[_0xe3e7('0x9')](),controller['describe']);router[_0xe3e7('0xb')](_0xe3e7('0xd'),auth[_0xe3e7('0x9')](),controller[_0xe3e7('0xe')]);router[_0xe3e7('0xb')](_0xe3e7('0xf'),auth['isAuthenticated'](),controller[_0xe3e7('0x10')]);router[_0xe3e7('0xb')](_0xe3e7('0x11'),auth[_0xe3e7('0x9')](),controller[_0xe3e7('0x12')]);router[_0xe3e7('0xb')]('/:id/messages',auth[_0xe3e7('0x9')](),controller[_0xe3e7('0x13')]);router[_0xe3e7('0x14')]('/',auth[_0xe3e7('0x9')](),controller[_0xe3e7('0x15')]);router[_0xe3e7('0x14')](_0xe3e7('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0xe3e7('0x14')](_0xe3e7('0x16'),auth['isAuthenticated'](),controller['addMessage']);router[_0xe3e7('0x17')](_0xe3e7('0xd'),auth[_0xe3e7('0x9')](),controller['update']);router[_0xe3e7('0x18')](_0xe3e7('0xd'),auth[_0xe3e7('0x9')](),controller['destroy']);router[_0xe3e7('0x18')](_0xe3e7('0x11'),auth['isAuthenticated'](),controller[_0xe3e7('0x19')]);module[_0xe3e7('0x1a')]=router; \ No newline at end of file +var _0x0f96=['../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','getMessages','post','/:id/members','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x306f56,_0x47efc7){var _0x564730=function(_0x9eb039){while(--_0x9eb039){_0x306f56['push'](_0x306f56['shift']());}};_0x564730(++_0x47efc7);}(_0x0f96,0x8e));var _0x60f9=function(_0x3eac71,_0x1169cf){_0x3eac71=_0x3eac71-0x0;var _0x292b16=_0x0f96[_0x3eac71];return _0x292b16;};'use strict';var multer=require(_0x60f9('0x0'));var util=require(_0x60f9('0x1'));var path=require(_0x60f9('0x2'));var timeout=require(_0x60f9('0x3'));var express=require(_0x60f9('0x4'));var router=express[_0x60f9('0x5')]();var fs_extra=require(_0x60f9('0x6'));var auth=require(_0x60f9('0x7'));var interaction=require(_0x60f9('0x8'));var config=require(_0x60f9('0x9'));var controller=require(_0x60f9('0xa'));router[_0x60f9('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x60f9('0xb')](_0x60f9('0xc'),auth[_0x60f9('0xd')](),controller[_0x60f9('0xe')]);router[_0x60f9('0xb')](_0x60f9('0xf'),auth['isAuthenticated'](),controller[_0x60f9('0x10')]);router[_0x60f9('0xb')](_0x60f9('0x11'),auth['isAuthenticated'](),controller[_0x60f9('0x12')]);router[_0x60f9('0xb')]('/:id/members',auth[_0x60f9('0xd')](),controller['getMembers']);router['get']('/:id/messages',auth[_0x60f9('0xd')](),controller[_0x60f9('0x13')]);router[_0x60f9('0x14')]('/',auth[_0x60f9('0xd')](),controller['create']);router[_0x60f9('0x14')](_0x60f9('0x15'),auth['isAuthenticated'](),controller[_0x60f9('0x16')]);router[_0x60f9('0x14')](_0x60f9('0x17'),auth['isAuthenticated'](),controller[_0x60f9('0x18')]);router[_0x60f9('0x19')](_0x60f9('0xf'),auth[_0x60f9('0xd')](),controller[_0x60f9('0x1a')]);router[_0x60f9('0x1b')](_0x60f9('0xf'),auth[_0x60f9('0xd')](),controller[_0x60f9('0x1c')]);router[_0x60f9('0x1b')](_0x60f9('0x15'),auth[_0x60f9('0xd')](),controller[_0x60f9('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 348cb89..74a9489 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 _0x83e1=['star','TEXT','STRING','DATE','ENUM','out','sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83e1,0x1ad));var _0x183e=function(_0x51b665,_0x39ba8e){_0x51b665=_0x51b665-0x0;var _0x5bef86=_0x83e1[_0x51b665];return _0x5bef86;};'use strict';var Sequelize=require(_0x183e('0x0'));module[_0x183e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x183e('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x183e('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x183e('0x4')]},'pathTranscript':{'type':Sequelize[_0x183e('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x183e('0x5')]},'thirdDisposition':{'type':Sequelize[_0x183e('0x5')]},'note':{'type':Sequelize[_0x183e('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x183e('0x5')]},'osName':{'type':Sequelize[_0x183e('0x5')]},'osVersion':{'type':Sequelize[_0x183e('0x5')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x183e('0x5')]},'deviceType':{'type':Sequelize[_0x183e('0x5')]},'referer':{'type':Sequelize[_0x183e('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x183e('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x183e('0x6')]},'lastMsgAt':{'type':Sequelize[_0x183e('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x183e('0x7')]('in',_0x183e('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x183e('0x5')]},'customerPort':{'type':Sequelize[_0x183e('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x183e('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x48bc=['BOOLEAN','ENUM','star','thumb','TEXT','STRING','long','DATE','out','sequelize','exports'];(function(_0x1cd43b,_0x2ac627){var _0x21de30=function(_0x375b26){while(--_0x375b26){_0x1cd43b['push'](_0x1cd43b['shift']());}};_0x21de30(++_0x2ac627);}(_0x48bc,0x1b6));var _0xc48b=function(_0x18589b,_0x50ebfb){_0x18589b=_0x18589b-0x0;var _0xef4858=_0x48bc[_0x18589b];return _0xef4858;};'use strict';var Sequelize=require(_0xc48b('0x0'));module[_0xc48b('0x1')]={'closed':{'type':Sequelize[_0xc48b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xc48b('0x3')](_0xc48b('0x4'),_0xc48b('0x5')),'defaultValue':_0xc48b('0x4')},'ratingMessage':{'type':Sequelize[_0xc48b('0x6')]},'pathTranscript':{'type':Sequelize[_0xc48b('0x6')]},'mailTranscript':{'type':Sequelize[_0xc48b('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc48b('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc48b('0x7')]},'note':{'type':Sequelize[_0xc48b('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xc48b('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xc48b('0x7')]},'deviceModel':{'type':Sequelize[_0xc48b('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xc48b('0x7')]},'referer':{'type':Sequelize[_0xc48b('0x6')]},'customerIp':{'type':Sequelize[_0xc48b('0x7')]},'formData':{'type':Sequelize[_0xc48b('0x6')](_0xc48b('0x8'))},'read1stAt':{'type':Sequelize[_0xc48b('0x9')]},'lastMsgAt':{'type':Sequelize[_0xc48b('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xc48b('0x3')]('in',_0xc48b('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc48b('0x7')]},'customerPort':{'type':Sequelize[_0xc48b('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xc48b('0x6')]},'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 1943656..b8900f1 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 _0x5f66=['email','isNull','vidaooNote','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','file','originalname','filename','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','%s%d','agentAlias','System','customer','agentIdentifier','agent_alias','alias','agent_fullname','createdAt','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filter','findAll','getMyMessages','includeAgent','addTags','setTags','spread','emit','removeTags','unix','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Account','Owner','get','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','views','transcript-','.pdf','log','err','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','name','merge','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','includeAll','include','options','create','body','destroy','describe','createVidaooSession','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooApiKey','https://api-vidaoo.xcally.com/api/v1/meetings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var pdf=require(_0x65f6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65f6('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x65f6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x65f6('0x14'))['db'];config['redis']=_[_0x65f6('0x15')](config[_0x65f6('0x16')],{'host':_0x65f6('0x17'),'port':0x18eb});var socket=require(_0x65f6('0x18'))(new Redis(config[_0x65f6('0x16')]));require(_0x65f6('0x19'))[_0x65f6('0x1a')](socket);var jayson=require(_0x65f6('0x1b'));var client=jayson[_0x65f6('0x1c')][_0x65f6('0x1d')]({'port':0x232b});var client9004=jayson['client'][_0x65f6('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x49a913,_0x5dd324,_0x1693e6,_0x5c69f8){return new BPromise(function(_0x37330d,_0x1c955c){var _0x1b1cbb=_0x5c69f8||client;return _0x1b1cbb[_0x65f6('0x1e')](_0x49a913,_0x1693e6)[_0x65f6('0x1f')](function(_0x18380e){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5dd324,_0x65f6('0x20'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5dd324,'request\x20sent',JSON[_0x65f6('0x21')](_0x18380e));if(_0x18380e[_0x65f6('0x22')]){if(_0x18380e['error'][_0x65f6('0x23')]===0x1f4){logger[_0x65f6('0x22')](_0x65f6('0x24'),_0x5dd324,_0x18380e[_0x65f6('0x22')][_0x65f6('0x25')]);return _0x1c955c(_0x18380e[_0x65f6('0x22')]['message']);}logger[_0x65f6('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x5dd324,_0x18380e['error'][_0x65f6('0x25')]);return _0x37330d(_0x18380e[_0x65f6('0x22')]['message']);}else{logger[_0x65f6('0x26')](_0x65f6('0x24'),_0x5dd324,_0x65f6('0x20'));_0x37330d(_0x18380e[_0x65f6('0x27')]['message']);}})[_0x65f6('0x28')](function(_0x59ea32){logger[_0x65f6('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x5dd324,_0x59ea32);_0x1c955c(_0x59ea32);});});}function respondWithStatusCode(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0xcc;return function(_0x29abdb){if(_0x29abdb){return _0x5cb131[_0x65f6('0x29')](_0x4fde2f);}return _0x5cb131['status'](_0x4fde2f)[_0x65f6('0x2a')]();};}function respondWithResult(_0x28f710,_0x52277c){_0x52277c=_0x52277c||0xc8;return function(_0x325cb4){if(_0x325cb4){return _0x28f710[_0x65f6('0x2b')](_0x52277c)[_0x65f6('0x2c')](_0x325cb4);}};}function respondWithFilteredResult(_0x559330,_0x4ac04b){return function(_0x488d36){if(_0x488d36){var _0x266cfe=typeof _0x4ac04b[_0x65f6('0x2d')]===_0x65f6('0x2e')&&typeof _0x4ac04b[_0x65f6('0x2f')]===_0x65f6('0x2e');var _0x14a387=_0x488d36[_0x65f6('0x30')];var _0x4ace4c=_0x266cfe?0x0:_0x4ac04b['offset'];var _0x154cbd=_0x266cfe?_0x488d36[_0x65f6('0x30')]:_0x4ac04b['offset']+_0x4ac04b['limit'];var _0x10b368;if(_0x154cbd>=_0x14a387){_0x154cbd=_0x14a387;_0x10b368=0xc8;}else{_0x10b368=0xce;}_0x559330[_0x65f6('0x2b')](_0x10b368);return _0x559330[_0x65f6('0x31')](_0x65f6('0x32'),_0x4ace4c+'-'+_0x154cbd+'/'+_0x14a387)[_0x65f6('0x2c')](_0x488d36);}return null;};}function patchUpdates(_0x2d32be){return function(_0x5792a0){try{jsonpatch[_0x65f6('0x33')](_0x5792a0,_0x2d32be,!![]);}catch(_0x38f3c6){return BPromise[_0x65f6('0x34')](_0x38f3c6);}return _0x5792a0['save']();};}function saveUpdates(_0x217f35,_0x2a7aa8){return function(_0xbaed3c){if(_0xbaed3c){return _0xbaed3c[_0x65f6('0x35')](_0x217f35)[_0x65f6('0x1f')](function(_0x2f054c){return _0x2f054c;});}return null;};}function removeEntity(_0x4d4d84,_0x3c7c58){return function(_0x1b24ea){if(_0x1b24ea){return _0x1b24ea['destroy']()[_0x65f6('0x1f')](function(){_0x4d4d84['status'](0xcc)[_0x65f6('0x2a')]();});}};}function handleEntityNotFound(_0x50494b,_0x2b9fb6){return function(_0x24f7fd){if(!_0x24f7fd){_0x50494b['sendStatus'](0x194);}return _0x24f7fd;};}function handleError(_0x12dee6,_0x13e41a){_0x13e41a=_0x13e41a||0x1f4;return function(_0x3b261d){logger['error'](_0x3b261d['stack']);if(_0x3b261d[_0x65f6('0x36')]){delete _0x3b261d['name'];}_0x12dee6[_0x65f6('0x2b')](_0x13e41a)['send'](_0x3b261d);};}function getMustacheRender(_0x22d760,_0x2b9675){return Mustache['render'](_0x22d760,_[_0x65f6('0x37')](_0x2b9675['body'],{'contact':_0x2b9675['contact'],'message':_0x2b9675[_0x65f6('0x25')],'agent':_0x2b9675[_0x65f6('0x38')],'interaction':_0x2b9675[_0x65f6('0x39')],'account':_0x2b9675[_0x65f6('0x3a')]}))||'';}function getInteractionUsers(_0xbe54fe,_0x28845a){return new BPromise(function(_0x1a55da,_0x1153f1){try{if(_0x28845a[_0xbe54fe['id']]){_0xbe54fe['Users']=_[_0x65f6('0x3b')](_0x28845a[_0xbe54fe['id']],function(_0x49d8ee){return{'id':_0x49d8ee['id'],'fullname':_0x49d8ee[_0x65f6('0x3c')]};});}}catch(_0xa4394a){_0x1153f1(_0xa4394a);}_0x1a55da(_0xbe54fe);});}function getInteractionTags(_0x4ba7db,_0x2ea7f7){return new BPromise(function(_0x5ef5c2,_0x32148f){try{if(_0x4ba7db[_0x65f6('0x3d')]){_0x4ba7db[_0x65f6('0x3e')]=[];_0x4ba7db[_0x65f6('0x3d')][_0x65f6('0x3f')](',')[_0x65f6('0x40')](function(_0xed4c96){_0x4ba7db[_0x65f6('0x3e')][_0x65f6('0x41')](_0x2ea7f7[_0xed4c96]);});}delete _0x4ba7db['TagIds'];}catch(_0x170d3e){_0x32148f(_0x170d3e);}_0x5ef5c2(_0x4ba7db);});}function updateChatInteraction(_0x400ed2,_0x377ae5,_0x181798){return new BPromise(function(_0x83e2d9,_0x1ac040){return getInteractionUsers(_0x400ed2,_0x181798)[_0x65f6('0x1f')](function(_0x2e91e8){return getInteractionTags(_0x2e91e8,_0x377ae5);})[_0x65f6('0x1f')](function(_0x2abbed){_0x83e2d9(_0x2abbed);})[_0x65f6('0x28')](function(_0x2c008a){_0x1ac040(_0x2c008a);});});}exports[_0x65f6('0x42')]=function(_0x27157d,_0xb1a132){var _0x2cb38d={},_0x5119ee={},_0x2dd16c={'count':0x0,'rows':[]};var _0x37cd36=_[_0x65f6('0x3b')](db[_0x65f6('0x43')]['rawAttributes'],function(_0x1bf5bf){return{'name':_0x1bf5bf[_0x65f6('0x44')],'type':_0x1bf5bf[_0x65f6('0x45')]['key']};});_0x5119ee[_0x65f6('0x46')]=_[_0x65f6('0x3b')](_0x37cd36,_0x65f6('0x36'));_0x5119ee[_0x65f6('0x47')]=_['keys'](_0x27157d[_0x65f6('0x47')]);_0x5119ee['filters']=_[_0x65f6('0x48')](_0x5119ee[_0x65f6('0x46')],_0x5119ee['query']);_0x2cb38d[_0x65f6('0x49')]=_['intersection'](_0x5119ee[_0x65f6('0x46')],qs[_0x65f6('0x4a')](_0x27157d[_0x65f6('0x47')][_0x65f6('0x4a')]));_0x2cb38d[_0x65f6('0x49')]=_0x2cb38d[_0x65f6('0x49')]['length']?_0x2cb38d['attributes']:_0x5119ee[_0x65f6('0x46')];if(!_0x27157d[_0x65f6('0x47')][_0x65f6('0x4b')](_0x65f6('0x4c'))){_0x2cb38d[_0x65f6('0x2f')]=qs[_0x65f6('0x2f')](_0x27157d[_0x65f6('0x47')][_0x65f6('0x2f')]);_0x2cb38d[_0x65f6('0x2d')]=qs['offset'](_0x27157d[_0x65f6('0x47')][_0x65f6('0x2d')]);}_0x2cb38d[_0x65f6('0x4d')]=qs['sort'](_0x27157d[_0x65f6('0x47')][_0x65f6('0x4e')]);_0x2cb38d['where']=qs[_0x65f6('0x4f')](_[_0x65f6('0x50')](_0x27157d['query'],_0x5119ee[_0x65f6('0x4f')]),_0x37cd36);var _0x4f96c4=[];var _0x247be3=squel[_0x65f6('0x51')]()[_0x65f6('0x52')]('id')['field'](_0x65f6('0x36'))[_0x65f6('0x52')]('color')[_0x65f6('0x53')](_0x65f6('0x54'));var _0x48a2ed=squel[_0x65f6('0x51')]()[_0x65f6('0x52')](_0x65f6('0x55'))[_0x65f6('0x52')](_0x65f6('0x56'))[_0x65f6('0x52')](_0x65f6('0x57'))[_0x65f6('0x53')]('user_has_chat_interactions','ui')['left_join']('users','u',_0x65f6('0x58'));var _0x2091f1=squel[_0x65f6('0x51')]()[_0x65f6('0x53')]('chat_interactions','i')[_0x65f6('0x59')](_0x65f6('0x5a'),'c',_0x65f6('0x5b'))['left_join'](_0x65f6('0x5c'),'o',_0x65f6('0x5d'))[_0x65f6('0x59')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x65f6('0x59')](_0x65f6('0x5e'),'me',_0x65f6('0x5f'))[_0x65f6('0x59')](_0x65f6('0x60'),'it',_0x65f6('0x61'))[_0x65f6('0x59')](_0x65f6('0x54'),'t',_0x65f6('0x62'));var _0xddbd90=squel[_0x65f6('0x63')]();var _0x141fcc=[];var _0x30adee=squel[_0x65f6('0x63')]();var _0x5ba9c6;if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x64')]){_0x5ba9c6=as[_0x65f6('0x65')](_0x27157d['query'][_0x65f6('0x64')]);var _0x16dec0=_0x5ba9c6[_0x65f6('0x66')];for(var _0x3096b8=0x0;_0x3096b8<_0x5ba9c6['conditions'][_0x65f6('0x67')];_0x3096b8++){var _0x4227f5=_0x5ba9c6[_0x65f6('0x68')][_0x3096b8];var _0x3e0d8b='i';var _0x553ff0=_[_0x65f6('0x69')](_0x37cd36,[_0x65f6('0x36'),_0x4227f5['field']]);if(!_0x553ff0){switch(_0x4227f5[_0x65f6('0x52')]){case _0x65f6('0x6a'):if(_0x4227f5[_0x65f6('0x6b')]==0x1){_0x2091f1['having']('`'+_0x4227f5[_0x65f6('0x52')]+_0x65f6('0x6c'));}else{_0x2091f1[_0x65f6('0x6d')]('`'+_0x4227f5[_0x65f6('0x52')]+_0x65f6('0x6e'));}break;case _0x65f6('0x6f'):if(_0x4227f5['operator']==='$substring'){if(_0x4227f5['value'][_0x65f6('0x3f')]('\x20')[_0x65f6('0x67')]>0x1){_0xddbd90[_0x16dec0](_0x65f6('0x70'),qs[_0x65f6('0x71')](_0x4227f5[_0x65f6('0x6b')]),null);}else{var _0x304cf9='%'+_0x4227f5['value']+'%';_0xddbd90[_0x16dec0](_0x65f6('0x72'),_0x304cf9,_0x304cf9,_0x304cf9);}}else{_0x553ff0=_[_0x65f6('0x69')](_0x37cd36,['name',_0x65f6('0x73')]);_0x4227f5[_0x65f6('0x52')]=_0x65f6('0x73');_0xf69bf6=as['buildExpression'](_0x3e0d8b,_0x553ff0[_0x65f6('0x45')],_0x4227f5);_0xddbd90[_0x16dec0](_0xf69bf6[_0x65f6('0x74')],_0xf69bf6['value'][_0x65f6('0x75')],_0xf69bf6[_0x65f6('0x6b')][_0x65f6('0x2a')]);}break;case _0x65f6('0x76'):var _0x3d55f7=_0x4227f5[_0x65f6('0x6b')][_0x65f6('0x3f')](',')['map'](function(_0x4e5e94){return Number(_0x4e5e94);});_0x3d55f7[_0x65f6('0x40')](function(_0x3da139){_0x30adee['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3da139+',%');});_0x141fcc=_[_0x65f6('0x77')](_0x141fcc,_0x3d55f7);break;case'User':if(_0x4227f5[_0x65f6('0x78')]==='$substring'){_0xddbd90[_0x16dec0](_0x65f6('0x79'),'%'+_0x4227f5[_0x65f6('0x6b')]+'%',null);}else{_0x553ff0=_[_0x65f6('0x69')](_0x37cd36,[_0x65f6('0x36'),_0x65f6('0x7a')]);_0x4227f5[_0x65f6('0x52')]=_0x65f6('0x7a');_0xf69bf6=as[_0x65f6('0x7b')](_0x3e0d8b,_0x553ff0[_0x65f6('0x45')],_0x4227f5);_0xddbd90[_0x16dec0](_0xf69bf6['text'],_0xf69bf6['value'][_0x65f6('0x75')],_0xf69bf6[_0x65f6('0x6b')][_0x65f6('0x2a')]);}break;case'body':_0xf69bf6=as['buildExpression']('me',null,_0x4227f5);_0xddbd90[_0x16dec0](_0xf69bf6[_0x65f6('0x74')],_0xf69bf6[_0x65f6('0x6b')][_0x65f6('0x75')],_0xf69bf6[_0x65f6('0x6b')][_0x65f6('0x2a')]);break;}}else{var _0xf69bf6=as['buildExpression'](_0x3e0d8b,_0x553ff0['type'],_0x4227f5);_0xddbd90[_0x16dec0](_0xf69bf6[_0x65f6('0x74')],_0xf69bf6[_0x65f6('0x6b')]['start'],_0xf69bf6[_0x65f6('0x6b')]['end']);}}}else{var _0x254e9f=_(_0x27157d[_0x65f6('0x47')])[_0x65f6('0x7c')]()[_0x65f6('0x3b')](function(_0x558888){return _[_0x65f6('0x7d')](_0x37cd36,[_0x65f6('0x36'),_0x558888])?_0x558888:undefined;})[_0x65f6('0x7e')]()['value']();if(!_['isEmpty'](_0x254e9f)){_0x254e9f[_0x65f6('0x40')](function(_0x583a01){if(_0x583a01===_0x65f6('0x7f')){_0x2091f1[_0x65f6('0x80')](_0x65f6('0x81'),[][_0x65f6('0x82')](_0x27157d['query'][_0x583a01]));}else if(_0x583a01==='createdAt'){var _0x56f7f1=JSON[_0x65f6('0x83')](_0x27157d[_0x65f6('0x47')][_0x583a01])[_0x65f6('0x84')];var _0x57464e=JSON[_0x65f6('0x83')](_0x27157d[_0x65f6('0x47')][_0x583a01])[_0x65f6('0x85')];_0x2091f1['where'](_0x65f6('0x86'),_0x56f7f1,_0x57464e);}else{if(_0x27157d[_0x65f6('0x47')][_0x583a01]==='null'){_0x2091f1[_0x65f6('0x80')]('i.'+_0x583a01+_0x65f6('0x87'));}else{_0x2091f1['where']('i.'+_0x583a01+_0x65f6('0x88'),_0x27157d['query'][_0x583a01]);}}});}if(_0x27157d[_0x65f6('0x47')]['read']){if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x89')]==0x1){_0x2091f1['having'](_0x65f6('0x8a'));}else{_0x2091f1[_0x65f6('0x6d')](_0x65f6('0x8b'));}}if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x8c')]){_0x141fcc=_[_0x65f6('0x8d')](_0x27157d[_0x65f6('0x47')][_0x65f6('0x8c')])?_0x27157d[_0x65f6('0x47')][_0x65f6('0x8c')]:new Array(_0x27157d[_0x65f6('0x47')]['tag']);_0x141fcc[_0x65f6('0x40')](function(_0x1cf1bd){_0x30adee['or'](_0x65f6('0x8e'),'%,'+_0x1cf1bd+',%');});}if(_0x27157d[_0x65f6('0x47')]['filter']){var _0x453080=_0x27157d[_0x65f6('0x47')]['filter'][_0x65f6('0x8f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x65f6('0x90')](_0x453080)){_0xddbd90['or']('i.id\x20LIKE\x20?',_0x453080+'%');}else{_0xddbd90['or'](_0x65f6('0x91'),qs[_0x65f6('0x71')](_0x453080))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x453080+'%');}}}_0x2091f1['where'](_0xddbd90);_0x2091f1[_0x65f6('0x92')](_0x65f6('0x93'));var _0x5158c9={'type':db[_0x65f6('0x94')][_0x65f6('0x95')][_0x65f6('0x96')],'raw':!![]};var _0x4edba0=_0x2091f1[_0x65f6('0x97')]();_0x4edba0[_0x65f6('0x52')]('i.id');_0x4edba0[_0x65f6('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x65f6('0x6a'));if(_0x2cb38d['order']){_0x2cb38d['order'][_0x65f6('0x40')](function(_0x1cf4ed){var _0x199d63=_0x1cf4ed[0x0]===_0x65f6('0x98')?_0x1cf4ed[0x0]:'i.'+_0x1cf4ed[0x0];_0x2091f1[_0x65f6('0x4d')](_0x199d63,_0x1cf4ed[0x1]===_0x65f6('0x99')?![]:!![]);});}if(!_[_0x65f6('0x9a')](_0x141fcc)){_0x2091f1[_0x65f6('0x6d')](_0x30adee);_0x4edba0['where']('t.id\x20IN\x20?',_0x141fcc);}BPromise[_0x65f6('0x9b')]()['then'](function(){if(!_0x5ba9c6){if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x7f')])return;_0x4edba0[_0x65f6('0x80')](_0x65f6('0x9c'));_0x2091f1[_0x65f6('0x80')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x27157d[_0x65f6('0x9d')][_0x65f6('0x9e')]!==_0x65f6('0x38'))return;return _0x27157d['user'][_0x65f6('0x9f')]({'attributes':['id'],'raw':!![]})[_0x65f6('0x1f')](function(_0x4254c2){if(_[_0x65f6('0x9a')](_0x4254c2)){_0x4edba0[_0x65f6('0x80')](_0x65f6('0xa0'));_0x2091f1['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x4edba0[_0x65f6('0x80')](_0x65f6('0x81'),_[_0x65f6('0x3b')](_0x4254c2,'id'));_0x2091f1[_0x65f6('0x80')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x4254c2,'id'));}});})[_0x65f6('0x1f')](function(){if(_0x27157d[_0x65f6('0x9d')][_0x65f6('0x9e')]===_0x65f6('0x38')&&!_0x5ba9c6&&!_0x27157d[_0x65f6('0x47')][_0x65f6('0x7f')])return[];return db['sequelize']['query'](_0x4edba0['toString'](),_0x5158c9);})[_0x65f6('0x1f')](function(_0x2e63bb){_0x2dd16c[_0x65f6('0x30')]=_0x2e63bb[_0x65f6('0x67')];if(_0x2dd16c['count']===0x0)return[];return db['sequelize'][_0x65f6('0x47')](_0x247be3[_0x65f6('0xa1')](),_0x5158c9)['then'](function(_0x346fa9){_0x4f96c4=_['keyBy'](_0x346fa9,'id');_0x5158c9=_[_0x65f6('0x37')](_0x5158c9,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x4a')]){_0x2cb38d['attributes'][_0x65f6('0x40')](function(_0x330e18){_0x2091f1[_0x65f6('0x52')]('i.'+_0x330e18);});}else{_0x2091f1[_0x65f6('0x52')](_0x65f6('0xa2'),_0x65f6('0x6a'));_0x2091f1['field'](_0x65f6('0xa3'),'Account.key');_0x2091f1[_0x65f6('0x52')]('a.mandatoryDisposition',_0x65f6('0xa4'));_0x2091f1[_0x65f6('0x52')](_0x65f6('0xa5'),_0x65f6('0x98'));_0x2091f1['field'](_0x65f6('0xa6'));_0x2091f1[_0x65f6('0x52')](_0x65f6('0xa7'),'Contact.firstName');_0x2091f1['field'](_0x65f6('0xa8'),_0x65f6('0xa9'));_0x2091f1['field'](_0x65f6('0xaa'),_0x65f6('0xab'));_0x2091f1[_0x65f6('0x52')]('c.phone',_0x65f6('0xac'));_0x2091f1[_0x65f6('0x52')]('c.mobile',_0x65f6('0xad'));_0x2091f1[_0x65f6('0x52')](_0x65f6('0xae'),'Contact.fax');_0x2091f1[_0x65f6('0x52')](_0x65f6('0xaf'),_0x65f6('0xb0'));_0x2091f1['field'](_0x65f6('0xb1'),'Owner.internal');_0x2091f1[_0x65f6('0x52')](_0x65f6('0xb2'),_0x65f6('0x3d'));}if(_0x2cb38d[_0x65f6('0x2f')])_0x2091f1[_0x65f6('0x2f')](_0x2cb38d[_0x65f6('0x2f')]);if(_0x2cb38d['offset'])_0x2091f1[_0x65f6('0x2d')](_0x2cb38d[_0x65f6('0x2d')]);return db[_0x65f6('0xb3')][_0x65f6('0x47')](_0x2091f1[_0x65f6('0xa1')](),_0x5158c9);})['then'](function(_0x59f421){if(_0x59f421['length']>0x0)_0x48a2ed[_0x65f6('0x80')](_0x65f6('0xb4'),_[_0x65f6('0x3b')](_0x59f421,'id'));return db['sequelize'][_0x65f6('0x47')](_0x48a2ed['toString'](),_0x5158c9)['then'](function(_0x3133f4){var _0x41b58b=_['groupBy'](_0x3133f4,_0x65f6('0xb5'));var _0x3c5053=[];_0x59f421[_0x65f6('0x40')](function(_0x2ba1f7){_0x3c5053[_0x65f6('0x41')](updateChatInteraction(_0x2ba1f7,_0x4f96c4,_0x41b58b));});return BPromise[_0x65f6('0xb6')](_0x3c5053);});});})[_0x65f6('0x1f')](function(_0x3291ac){_0x2dd16c[_0x65f6('0xb7')]=_0x3291ac;return _0x2dd16c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0xb1a132,_0x2cb38d))[_0x65f6('0x28')](handleError(_0xb1a132,null));};exports[_0x65f6('0xb8')]=function(_0x5c9cc0,_0x349af7){var _0x52dc75={'raw':![],'where':{'id':_0x5c9cc0[_0x65f6('0xb9')]['id']}},_0x55355f={};_0x55355f[_0x65f6('0x46')]=_[_0x65f6('0x7c')](db[_0x65f6('0x43')]['rawAttributes']);_0x55355f[_0x65f6('0x47')]=_['keys'](_0x5c9cc0['query']);_0x55355f[_0x65f6('0x4f')]=_[_0x65f6('0x48')](_0x55355f[_0x65f6('0x46')],_0x55355f[_0x65f6('0x47')]);_0x52dc75[_0x65f6('0x49')]=_[_0x65f6('0x48')](_0x55355f['model'],qs[_0x65f6('0x4a')](_0x5c9cc0['query'][_0x65f6('0x4a')]));_0x52dc75[_0x65f6('0x49')]=_0x52dc75[_0x65f6('0x49')]['length']?_0x52dc75[_0x65f6('0x49')]:_0x55355f['model'];if(_0x5c9cc0['query'][_0x65f6('0xba')]){_0x52dc75[_0x65f6('0xbb')]=[{'all':!![]}];}_0x52dc75=_[_0x65f6('0x37')]({},_0x52dc75,_0x5c9cc0[_0x65f6('0xbc')]);return db[_0x65f6('0x43')]['find'](_0x52dc75)[_0x65f6('0x1f')](handleEntityNotFound(_0x349af7,null))[_0x65f6('0x1f')](respondWithResult(_0x349af7,null))[_0x65f6('0x28')](handleError(_0x349af7,null));};exports[_0x65f6('0xbd')]=function(_0x51f1e5,_0x3cd4c1){return db[_0x65f6('0x43')][_0x65f6('0xbd')](_0x51f1e5[_0x65f6('0xbe')],{})[_0x65f6('0x1f')](respondWithResult(_0x3cd4c1,0xc9))[_0x65f6('0x28')](handleError(_0x3cd4c1,null));};exports[_0x65f6('0x35')]=function(_0x8aab06,_0x558410){if(_0x8aab06[_0x65f6('0xbe')]['id']){delete _0x8aab06[_0x65f6('0xbe')]['id'];}return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x8aab06[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x558410,null))['then'](saveUpdates(_0x8aab06[_0x65f6('0xbe')],null))[_0x65f6('0x1f')](respondWithResult(_0x558410,null))['catch'](handleError(_0x558410,null));};exports[_0x65f6('0xbf')]=function(_0x547275,_0x24ff7c){return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x547275[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x24ff7c,null))['then'](removeEntity(_0x24ff7c,null))[_0x65f6('0x28')](handleError(_0x24ff7c,null));};exports[_0x65f6('0xc0')]=function(_0x2394eb,_0x31870f){return db[_0x65f6('0x43')]['describe']()['then'](respondWithResult(_0x31870f,null))[_0x65f6('0x28')](handleError(_0x31870f,null));};exports[_0x65f6('0xc1')]=function(_0x2993ee,_0x3cf2d9){var _0x4c070f=_0x2993ee['params']['id'];var _0x534004;var _0x42a2f6;var _0x3b0a97;return db[_0x65f6('0x43')]['findOne']({'where':{'id':_0x4c070f}})[_0x65f6('0x1f')](function(_0x3b5592){_0x534004=_0x3b5592;return db[_0x65f6('0xc2')][_0x65f6('0xc3')]({'where':{'id':_0x3b5592[_0x65f6('0x7f')]},'attributes':['id','vidaooApiKey',_0x65f6('0xc4'),_0x65f6('0xc5'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x65f6('0x1f')](function(_0x173b54){if(_0x173b54&&_0x173b54[_0x65f6('0xc6')]&&_0x173b54[_0x65f6('0xc4')]){_0x42a2f6=_0x173b54;var _0x17bbc9={'interaction':{'id':_0x4c070f},'agent':{'id':_0x2993ee['user']['id'],'name':_0x2993ee[_0x65f6('0x9d')]['name'],'fullname':_0x2993ee[_0x65f6('0x9d')]['fullname'],'email':_0x2993ee[_0x65f6('0x9d')]['email']},'contact':_0x2993ee[_0x65f6('0xbe')]['contact'],'account':_0x2993ee[_0x65f6('0xbe')][_0x65f6('0x3a')]};var _0x494f9c={'rejectUnauthorized':![],'method':'POST','url':_0x65f6('0xc7'),'headers':{'X-APIKEY':_0x173b54[_0x65f6('0xc6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2993ee[_0x65f6('0x9d')][_0x65f6('0xc8')]],'buttons':null,'topic':_0x42a2f6[_0x65f6('0xc5')],'note':_[_0x65f6('0xc9')](_0x42a2f6[_0x65f6('0xca')])?null:getMustacheRender(_0x42a2f6[_0x65f6('0xca')],_0x17bbc9),'metadata':null},'redirect':_0x65f6('0xcb'),'json':!![]};try{if(!_[_0x65f6('0xc9')](_0x42a2f6[_0x65f6('0xcc')])){var _0x6babec=getMustacheRender(_0x42a2f6[_0x65f6('0xcc')],_0x17bbc9);var _0x42177e=JSON[_0x65f6('0x83')](_0x6babec);_0x494f9c[_0x65f6('0xbe')][_0x65f6('0xcd')]=_0x42177e;}}catch(_0x5efe82){throw new db[(_0x65f6('0x94'))][(_0x65f6('0xce'))](_0x65f6('0xcf'));}return rp(_0x494f9c);}else{throw new db[(_0x65f6('0x94'))][(_0x65f6('0xce'))](_0x65f6('0xd0'));}})[_0x65f6('0x1f')](function(_0x2b3415){_0x3b0a97=_0x2b3415;if(_0x3b0a97['id']){var _0x3c9d49={'body':_0x3b0a97['join_url'],'ChatWebsiteId':_0x42a2f6['id'],'ChatInteractionId':_0x534004['id'],'direction':_0x65f6('0xd1'),'UserId':_0x2993ee[_0x65f6('0x9d')]['id']};return db[_0x65f6('0xd2')][_0x65f6('0xbd')](_0x3c9d49,{});}else{throw new db['Sequelize'][(_0x65f6('0xce'))](_0x65f6('0xd3'));}})['then'](function(){return _0x534004[_0x65f6('0xd4')]({'vidaooSessionId':_0x3b0a97['id']});})[_0x65f6('0x1f')](respondWithResult(_0x3cf2d9,null))[_0x65f6('0x28')](handleError(_0x3cf2d9,null));};exports[_0x65f6('0xd5')]=function(_0x2b89d5,_0x409dd7){if(_0x2b89d5['body']['id']){delete _0x2b89d5[_0x65f6('0xbe')]['id'];}return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x2b89d5[_0x65f6('0xb9')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x409dd7,null))[_0x65f6('0x1f')](saveUpdates(_0x2b89d5[_0x65f6('0xbe')],null))[_0x65f6('0x1f')](respondWithResult(_0x409dd7,null))[_0x65f6('0x28')](handleError(_0x409dd7,null));};exports[_0x65f6('0xd6')]=function(_0x5515a4,_0x542805,_0x2281d5){if(_0x5515a4[_0x65f6('0xbe')]['id']){delete _0x5515a4[_0x65f6('0xbe')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5515a4[_0x65f6('0xb9')]['id']}})['then'](function(_0x10a218){if(!_0x10a218){logger[_0x65f6('0x22')](_0x65f6('0xd7'),_0x65f6('0xd6'),0x194,_0x65f6('0xd8'));_0x542805[_0x65f6('0x29')](0x194);}else{if(_0x10a218[_0x65f6('0x7a')]){throw new db[(_0x65f6('0x94'))][(_0x65f6('0xce'))]('Interaction\x20already\x20assigned');}}return _0x10a218;})[_0x65f6('0x1f')](function(_0x129ae0){if(_0x129ae0){return _0x129ae0['update']({'closed':_0x5515a4[_0x65f6('0xbe')]['closed'],'disposition':_0x5515a4[_0x65f6('0xbe')][_0x65f6('0xd9')]})[_0x65f6('0x1f')](function(_0x579d52){return _0x579d52;});}})[_0x65f6('0x1f')](function(_0x5745e8){return respondWithRpcPromise('AbandonInteraction',_0x65f6('0xd6'),_0x5515a4[_0x65f6('0xbe')],client9004);})['then'](respondWithResult(_0x542805,null))[_0x65f6('0x28')](handleError(_0x542805,null));};exports['attachmentUpload']=function(_0x2b8edf,_0x28b9f4,_0x24e7f7){_0x2b8edf[_0x65f6('0xbe')][_0x65f6('0x36')]=_0x2b8edf[_0x65f6('0xda')][_0x65f6('0xdb')];_0x2b8edf[_0x65f6('0xbe')]['basename']=_0x2b8edf[_0x65f6('0xda')][_0x65f6('0xdc')];_0x2b8edf[_0x65f6('0xbe')][_0x65f6('0x45')]=_0x2b8edf[_0x65f6('0xda')]['mimetype'];return db[_0x65f6('0xdd')]['create'](_0x2b8edf[_0x65f6('0xbe')])['then'](respondWithResult(_0x28b9f4,0xc9))[_0x65f6('0x28')](handleError(_0x28b9f4,null));};exports[_0x65f6('0xde')]=function(_0x83ec2e,_0x3f61c4,_0x230eb9){return db[_0x65f6('0x43')][_0x65f6('0xc3')]({'where':{'id':_0x83ec2e[_0x65f6('0xb9')]['id']},'raw':!![]})[_0x65f6('0x1f')](handleEntityNotFound(_0x3f61c4,null))[_0x65f6('0x1f')](function(_0x72a333){if(_0x72a333){if(_0x72a333[_0x65f6('0xdf')]){return _0x3f61c4[_0x65f6('0x2b')](0x193)[_0x65f6('0x2c')]({'status':0x193,'message':_0x65f6('0xe0')});}return db[_0x65f6('0xdd')][_0x65f6('0xc3')]({'where':{'id':_0x83ec2e['query'][_0x65f6('0xe1')]},'raw':!![]})['then'](handleEntityNotFound(_0x3f61c4,null));}})[_0x65f6('0x1f')](function(_0x34f1cf){if(_0x34f1cf){var _0x431691=_0x34f1cf[_0x65f6('0xe2')]!==null;var _0x17f1f6=path[_0x65f6('0xe3')](config['root'],_0x65f6('0xe4'));if(_0x431691){_0x17f1f6=path[_0x65f6('0xe3')](_0x17f1f6,_0x65f6('0xe5'));}var _0x359734=path[_0x65f6('0xe3')](_0x17f1f6,_0x34f1cf[_0x65f6('0xe6')]);return _0x3f61c4[_0x65f6('0xe7')](_0x359734);}})[_0x65f6('0x28')](handleError(_0x3f61c4,null));};exports[_0x65f6('0xe8')]=function(_0x53da3a,_0x33831f){var _0x4ecd83=null;var _0x5e4778=null;var _0x4427bf=null;var _0x927c22=null;if(_0x53da3a[_0x65f6('0xbe')]['id']){delete _0x53da3a[_0x65f6('0xbe')]['id'];}if(_0x53da3a[_0x65f6('0xbe')][_0x65f6('0xe9')]){_0x927c22=path[_0x65f6('0xe3')](config['root'],_0x65f6('0xea'),util[_0x65f6('0xeb')](_0x65f6('0xec'),Date[_0x65f6('0xed')]()));_0x53da3a[_0x65f6('0xbe')][_0x65f6('0xee')]=_0x927c22;}return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x53da3a[_0x65f6('0xb9')]['id']},'include':[{'model':db[_0x65f6('0xd2')],'as':_0x65f6('0xef'),'include':[{'model':db[_0x65f6('0xf0')],'as':_0x65f6('0xf0')}]}]})['then'](handleEntityNotFound(_0x33831f,null))['then'](saveUpdates(_0x53da3a['body'],null))[_0x65f6('0x1f')](function(_0x3edd09){if(_0x3edd09){_0x4ecd83=_0x3edd09;return db[_0x65f6('0xc2')]['find']({'where':{'id':_0x4ecd83[_0x65f6('0x7f')]}});}})[_0x65f6('0x1f')](function(_0x10d421){if(_0x10d421){_0x4427bf=_0x10d421;return db['CmContact'][_0x65f6('0x69')]({'where':{'id':_0x4ecd83[_0x65f6('0x73')]}});}})['then'](function(_0x346aa3){if(_0x346aa3){_0x5e4778=_0x346aa3;if(_0x927c22){var _0x1f4a0d=null;for(var _0x3369b6=0x1;_0x3369b6<_0x4ecd83['Messages'][_0x65f6('0x67')];++_0x3369b6){_0x1f4a0d=_0x4ecd83[_0x65f6('0xef')][_0x3369b6];var _0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?util[_0x65f6('0xeb')](_0x65f6('0xf1'),_0x4427bf[_0x65f6('0xf2')],_0x1f4a0d[_0x65f6('0x7a')]):_0x65f6('0xf3');var _0x128304=_0x53da3a['body'][_0x65f6('0xf4')]||util[_0x65f6('0xeb')](_0x65f6('0xf1'),'Visitor',_0x1f4a0d['ContactId']);switch(_0x4427bf[_0x65f6('0xf5')]){case'website_alias':_0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?util[_0x65f6('0xeb')](_0x65f6('0xf1'),_0x4427bf[_0x65f6('0xf2')],_0x1f4a0d[_0x65f6('0x7a')]):'System';break;case _0x65f6('0xf6'):_0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?_0x1f4a0d[_0x65f6('0xf0')][_0x65f6('0xf7')]||_0x1f4a0d['User'][_0x65f6('0x3c')]:_0x65f6('0xf3');break;case _0x65f6('0xf8'):_0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?_0x1f4a0d[_0x65f6('0xf0')][_0x65f6('0x3c')]:_0x65f6('0xf3');break;default:_0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?util[_0x65f6('0xeb')](_0x65f6('0xf1'),_0x4427bf[_0x65f6('0xf2')],_0x1f4a0d[_0x65f6('0x7a')]):_0x65f6('0xf3');}var _0x31e87d=util[_0x65f6('0xeb')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1f4a0d[_0x65f6('0xf9')])[_0x65f6('0xeb')]('MM/DD/YYYY\x20HH:mm:ss'),_0x1f4a0d['direction']==='in'?_0x128304:_0x29656f,_0x1f4a0d[_0x65f6('0xbe')]);if(!_0x1f4a0d[_0x65f6('0xfa')]){fs[_0x65f6('0xfb')](_0x927c22,_0x31e87d);}}return db[_0x65f6('0xfc')][_0x65f6('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0x65f6('0xfd')],'as':_0x65f6('0xfe'),'raw':!![]}]});}}})['then'](function(_0x2922b9){if(_0x2922b9&&_0x2922b9['Smtp']&&_0x53da3a['body']){var _0x35062f={'tls':{'rejectUnauthorized':![]}};if(_0x2922b9[_0x65f6('0xfe')][_0x65f6('0xff')]){_0x35062f[_0x65f6('0xff')]=_0x2922b9['Smtp']['service'];}else{_0x35062f[_0x65f6('0x100')]=_0x2922b9[_0x65f6('0xfe')]['host'];_0x35062f['port']=_0x2922b9['Smtp'][_0x65f6('0x101')];_0x35062f[_0x65f6('0x102')]=_0x2922b9[_0x65f6('0xfe')][_0x65f6('0x102')];}if(_0x2922b9[_0x65f6('0xfe')]['authentication']){_0x35062f['auth']={'user':_0x2922b9[_0x65f6('0xfe')][_0x65f6('0x9d')],'pass':_0x2922b9[_0x65f6('0xfe')]['pass']};}return respondWithRpcPromise('SendMail',_0x65f6('0x103'),{'account':_0x35062f,'message':{'from':util[_0x65f6('0xeb')]('\x22%s\x22\x20<%s>',_0x2922b9[_0x65f6('0x36')],_0x2922b9[_0x65f6('0xc8')]||_0x2922b9['Smtp'][_0x65f6('0x9d')]),'to':_0x53da3a['body'][_0x65f6('0xe9')],'subject':_0x65f6('0x104'),'text':util[_0x65f6('0xeb')](_0x65f6('0x105'),_0x53da3a[_0x65f6('0xbe')][_0x65f6('0xe9')]),'attachments':[{'path':_0x927c22}]}})['then'](function(){return _0x4ecd83;})[_0x65f6('0x28')](function(_0x31f4ae){console['error'](_0x31f4ae);});}else{return _0x4ecd83;}})[_0x65f6('0x1f')](respondWithStatusCode(_0x33831f,0xc8))[_0x65f6('0x28')](handleError(_0x33831f,null));};exports[_0x65f6('0x106')]=function(_0x4b2f42,_0x491533,_0x322df1){return db[_0x65f6('0xd2')][_0x65f6('0x69')]({'where':{'id':_0x4b2f42[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x491533,null))[_0x65f6('0x1f')](function(_0x5e4078){if(_0x5e4078){return _0x5e4078['addMessage'](_0x4b2f42[_0x65f6('0xbe')][_0x65f6('0x107')],_[_0x65f6('0x108')](_0x4b2f42[_0x65f6('0xbe')],[_0x65f6('0x107'),'id'])||{});}})[_0x65f6('0x1f')](respondWithResult(_0x491533,null))[_0x65f6('0x28')](handleError(_0x491533,null));};exports[_0x65f6('0x109')]=function(_0x201edb,_0x42c4b8,_0x169632){var _0x32f5d5={'raw':![],'where':{}};var _0x594789={};var _0x624c21={'count':0x0,'rows':[]};return db[_0x65f6('0x43')][_0x65f6('0xc3')]({'where':{'id':_0x201edb[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x42c4b8,null))[_0x65f6('0x1f')](function(_0xd00f2f){if(_0xd00f2f){_0x594789[_0x65f6('0x46')]=_[_0x65f6('0x7c')](db[_0x65f6('0xd2')]['rawAttributes']);_0x594789[_0x65f6('0x47')]=_[_0x65f6('0x7c')](_0x201edb[_0x65f6('0x47')]);_0x594789['filters']=_[_0x65f6('0x48')](_0x594789[_0x65f6('0x46')],_0x594789[_0x65f6('0x47')]);_0x32f5d5['attributes']=_['intersection'](_0x594789[_0x65f6('0x46')],qs[_0x65f6('0x4a')](_0x201edb[_0x65f6('0x47')][_0x65f6('0x4a')]));_0x32f5d5[_0x65f6('0x49')]=_0x32f5d5[_0x65f6('0x49')][_0x65f6('0x67')]?_0x32f5d5[_0x65f6('0x49')]:_0x594789[_0x65f6('0x46')];if(!_0x201edb[_0x65f6('0x47')][_0x65f6('0x4b')](_0x65f6('0x4c'))){_0x32f5d5[_0x65f6('0x2f')]=qs[_0x65f6('0x2f')](_0x201edb[_0x65f6('0x47')][_0x65f6('0x2f')]);_0x32f5d5[_0x65f6('0x2d')]=qs[_0x65f6('0x2d')](_0x201edb['query'][_0x65f6('0x2d')]);}_0x32f5d5[_0x65f6('0x4d')]=qs[_0x65f6('0x4e')](_0x201edb[_0x65f6('0x47')]['sort']);_0x32f5d5[_0x65f6('0x80')]=qs['filters'](_[_0x65f6('0x50')](_0x201edb[_0x65f6('0x47')],_0x594789[_0x65f6('0x4f')]));_0x32f5d5[_0x65f6('0x80')][_0x65f6('0xb5')]=_0xd00f2f['id'];if(_0x201edb['query'][_0x65f6('0x10a')]){_0x32f5d5['where']=_['merge'](_0x32f5d5['where'],{'$or':_[_0x65f6('0x3b')](_0x32f5d5['attributes'],function(_0x28caab){var _0x3db2fd={};_0x3db2fd[_0x28caab]={'$like':'%'+_0x201edb[_0x65f6('0x47')][_0x65f6('0x10a')]+'%'};return _0x3db2fd;})});}if(_0x201edb[_0x65f6('0x47')][_0x65f6('0x84')]){var _0x18461c=_0x201edb[_0x65f6('0x47')]['$gte']['split'](',');var _0x13af41={};_0x13af41[_0x18461c[0x0]]={'$gte':moment(_0x18461c[0x1])[_0x65f6('0xeb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x32f5d5[_0x65f6('0x80')]=_['merge'](_0x32f5d5['where'],_0x13af41);}_0x32f5d5=_[_0x65f6('0x37')]({},_0x32f5d5,_0x201edb[_0x65f6('0xbc')]);return db[_0x65f6('0xd2')][_0x65f6('0x30')]({'where':_0x32f5d5[_0x65f6('0x80')]})['then'](function(_0x1bc75c){_0x624c21['count']=_0x1bc75c;if(_0x201edb[_0x65f6('0x47')]['includeAll']){_0x32f5d5['include']=[{'all':!![]}];}return db[_0x65f6('0xd2')][_0x65f6('0x10b')](_0x32f5d5);})[_0x65f6('0x1f')](function(_0x27e5fa){_0x624c21[_0x65f6('0xb7')]=_0x27e5fa;return _0x624c21;});}})[_0x65f6('0x1f')](respondWithFilteredResult(_0x42c4b8,_0x32f5d5))[_0x65f6('0x28')](handleError(_0x42c4b8,null));};exports[_0x65f6('0x10c')]=function(_0x504520,_0xe8f14f,_0x494de7){var _0x13e006={'where':{}},_0x186cf6={},_0x21ce60={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x65f6('0xc3')]({'where':{'id':_0x504520[_0x65f6('0xb9')]['id']}})['then'](handleEntityNotFound(_0xe8f14f,null))[_0x65f6('0x1f')](function(_0x3e1f7c){if(_0x3e1f7c){_0x186cf6[_0x65f6('0x46')]=_[_0x65f6('0x7c')](db[_0x65f6('0xd2')]['rawAttributes']);_0x186cf6[_0x65f6('0x47')]=_[_0x65f6('0x7c')](_0x504520[_0x65f6('0x47')]);_0x186cf6['filters']=_['intersection'](_0x186cf6[_0x65f6('0x46')],_0x186cf6[_0x65f6('0x47')]);_0x13e006[_0x65f6('0x49')]=_[_0x65f6('0x48')](_0x186cf6[_0x65f6('0x46')],qs['fields'](_0x504520['query']['fields']));_0x13e006[_0x65f6('0x49')]=_0x13e006[_0x65f6('0x49')]['length']?_0x13e006['attributes']:_0x186cf6['model'];if(!_0x504520[_0x65f6('0x47')][_0x65f6('0x4b')](_0x65f6('0x4c'))){_0x13e006[_0x65f6('0x2f')]=qs[_0x65f6('0x2f')](_0x504520[_0x65f6('0x47')][_0x65f6('0x2f')]);_0x13e006[_0x65f6('0x2d')]=qs[_0x65f6('0x2d')](_0x504520[_0x65f6('0x47')][_0x65f6('0x2d')]);}_0x13e006[_0x65f6('0x4d')]=qs[_0x65f6('0x4e')](_0x504520[_0x65f6('0x47')][_0x65f6('0x4e')]);_0x13e006['where']=qs[_0x65f6('0x4f')](_[_0x65f6('0x50')](_0x504520[_0x65f6('0x47')],_0x186cf6[_0x65f6('0x4f')]));_0x13e006[_0x65f6('0x80')][_0x65f6('0xb5')]=_0x3e1f7c['id'];if(_0x504520['query'][_0x65f6('0x10a')]){_0x13e006[_0x65f6('0x80')]=_['merge'](_0x13e006['where'],{'$or':_[_0x65f6('0x3b')](_0x13e006['attributes'],function(_0x4fd7ca){var _0x343d7b={};_0x343d7b[_0x4fd7ca]={'$like':'%'+_0x504520[_0x65f6('0x47')]['filter']+'%'};return _0x343d7b;})});}_0x13e006[_0x65f6('0x80')][_0x65f6('0xfa')]=![];if(_0x504520['query']['id']){_0x13e006[_0x65f6('0x80')]['id']={'$gt':_0x504520[_0x65f6('0x47')]['id']};}_0x13e006=_[_0x65f6('0x37')]({},_0x13e006,_0x504520[_0x65f6('0xbc')]);return db[_0x65f6('0xd2')][_0x65f6('0x30')]({'where':_0x13e006[_0x65f6('0x80')]})[_0x65f6('0x1f')](function(_0x443f1f){_0x21ce60['count']=_0x443f1f;_0x13e006[_0x65f6('0xbb')]=[];if(_0x504520[_0x65f6('0x47')][_0x65f6('0x10d')]){_0x13e006[_0x65f6('0xbb')][_0x65f6('0x41')]({'model':db[_0x65f6('0xf0')],'as':'User','attributes':['id',_0x65f6('0x3c'),'alias']});}if(_0x504520['query']['includeAll']){_0x13e006[_0x65f6('0xbb')]=[{'all':!![]}];}return db['ChatMessage'][_0x65f6('0x10b')](_0x13e006);})[_0x65f6('0x1f')](function(_0x285cef){_0x21ce60[_0x65f6('0xb7')]=_0x285cef;return _0x21ce60;});}})[_0x65f6('0x1f')](respondWithFilteredResult(_0xe8f14f,_0x13e006))[_0x65f6('0x28')](handleError(_0xe8f14f,null));};exports[_0x65f6('0x10e')]=function(_0x5a4c42,_0x5db63d,_0x352012){return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x5a4c42['params']['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x5db63d,null))['then'](function(_0x1188a2){if(_0x1188a2){return _0x1188a2[_0x65f6('0x10f')](_0x5a4c42[_0x65f6('0xbe')]['ids'],_[_0x65f6('0x108')](_0x5a4c42[_0x65f6('0xbe')],[_0x65f6('0x107'),'id'])||{})[_0x65f6('0x110')](function(){return db['Tag']['findAll']({'attributes':['id',_0x65f6('0x36'),'color'],'where':{'id':_0x5a4c42[_0x65f6('0xbe')]['ids']}});})[_0x65f6('0x1f')](function(_0x38b1ed){socket[_0x65f6('0x111')]('chatInteractionTags:save',{'id':Number(_0x5a4c42[_0x65f6('0xb9')]['id']),'tags':_0x38b1ed||[]});return{'id':Number(_0x5a4c42[_0x65f6('0xb9')]['id']),'tags':_0x38b1ed||[]};});}})[_0x65f6('0x1f')](respondWithResult(_0x5db63d,null))[_0x65f6('0x28')](handleError(_0x5db63d,null));};exports[_0x65f6('0x112')]=function(_0x5fb1fa,_0x19c8d4,_0x4e40d4){return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x5fb1fa[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x19c8d4,null))[_0x65f6('0x1f')](function(_0x41da12){if(_0x41da12){return _0x41da12[_0x65f6('0x112')](_0x5fb1fa[_0x65f6('0x47')][_0x65f6('0x107')]);}})['then'](respondWithStatusCode(_0x19c8d4,null))[_0x65f6('0x28')](handleError(_0x19c8d4,null));};exports['download']=function(_0xa3fb44,_0x459924){var _0x286c97=moment()[_0x65f6('0x113')]()[_0x65f6('0xa1')]();var _0x36f46f=path[_0x65f6('0xe3')](config[_0x65f6('0x114')],_0x65f6('0x115'),_0x65f6('0x116'),_0x65f6('0x117'));var _0x38e6ff=path[_0x65f6('0xe3')](config[_0x65f6('0x114')],_0x65f6('0x115'),_0x65f6('0x116'),_0x65f6('0x118'));var _0x560dbb=path[_0x65f6('0xe3')](_0x36f46f,_0x286c97);var _0x2315bc=util['format'](_0x65f6('0x119'),_0xa3fb44[_0x65f6('0xb9')]['id'],_0x286c97);var _0x2eda77=path[_0x65f6('0xe3')](_0x36f46f,_0x2315bc);var _0x2a163e=[];_0x2a163e[_0x65f6('0x41')]({'model':db['User'],'as':'User','attributes':['id',_0x65f6('0x3c')],'raw':!![]});_0x2a163e[_0x65f6('0x41')]({'model':db[_0x65f6('0x11a')],'as':'Contact','attributes':['id',_0x65f6('0x11b'),'lastName'],'raw':!![]});if(_0xa3fb44[_0x65f6('0x47')][_0x65f6('0x118')]){_0x2a163e[_0x65f6('0x41')]({'model':db[_0x65f6('0xdd')],'as':'Attachment','raw':!![]});}var _0x41156f=[{'model':db['ChatMessage'],'as':_0x65f6('0xef'),'attributes':['id',_0x65f6('0xbe'),_0x65f6('0xf9'),'direction',_0x65f6('0xfa'),'read'],'include':_0x2a163e}];_0x41156f['push']({'model':db[_0x65f6('0xc2')],'as':_0x65f6('0x11c'),'attributes':['id',_0x65f6('0x36')]});_0x41156f[_0x65f6('0x41')]({'model':db[_0x65f6('0xf0')],'as':_0x65f6('0x11d'),'attributes':['id',_0x65f6('0x3c')]});return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0xa3fb44[_0x65f6('0xb9')]['id']},'include':_0x41156f})[_0x65f6('0x1f')](handleEntityNotFound(_0x459924,null))['then'](function(_0x168cac){if(_0x168cac){var _0x5d4415=_0x168cac[_0x65f6('0x11e')]({'plain':!![]});fs[_0x65f6('0x11f')](_0x560dbb);var _0x4943cd={'channel':_0x65f6('0x120'),'account':_0x5d4415[_0x65f6('0x11c')]['name'],'agent':_0x5d4415['Owner']?_0x5d4415[_0x65f6('0x11d')]['fullname']:'N.A.','createdAt':moment(_0x5d4415[_0x65f6('0xf9')])[_0x65f6('0xeb')](_0x65f6('0x121'))[_0x65f6('0xa1')](),'closedAt':_0x5d4415[_0x65f6('0xdf')]?moment(_0x5d4415[_0x65f6('0x122')])[_0x65f6('0xeb')](_0x65f6('0x121'))[_0x65f6('0xa1')]():'','disposition':_0x5d4415['disposition'],'chatInfo':{'browser':_0x5d4415[_0x65f6('0x123')],'os':_0x5d4415[_0x65f6('0x124')],'referer':_0x5d4415['referer'],'customerIp':_0x5d4415[_0x65f6('0x125')],'customerPort':_0x5d4415[_0x65f6('0x126')]?_0x5d4415[_0x65f6('0x126')]:_0x65f6('0x127')},'messages':_(_0x5d4415[_0x65f6('0xef')])[_0x65f6('0x128')]()['filter']({'secret':![]})['map'](function(_0x9d51e3){if(_0x9d51e3[_0x65f6('0xdd')]){var _0x22aac6=path[_0x65f6('0xe3')](_0x38e6ff,_0x9d51e3[_0x65f6('0xdd')]['basename']);if(fs[_0x65f6('0x129')](_0x22aac6)){fs[_0x65f6('0x12a')](_0x22aac6)[_0x65f6('0x12b')](fs[_0x65f6('0x12c')](path[_0x65f6('0xe3')](_0x560dbb,_0x9d51e3[_0x65f6('0xdd')][_0x65f6('0xe6')])));}}return{'date':moment(_0x9d51e3[_0x65f6('0xf9')])[_0x65f6('0xeb')](_0x65f6('0x121'))[_0x65f6('0xa1')](),'sender':_0x9d51e3['direction']===_0x65f6('0xd1')?_0x9d51e3[_0x65f6('0xf0')]?_0x9d51e3['User']['fullname']:_0x65f6('0xf3'):_0x9d51e3[_0x65f6('0x6f')][_0x65f6('0x11b')]+(_0x9d51e3['Contact'][_0x65f6('0x12d')]?'\x20'+_0x9d51e3[_0x65f6('0x6f')][_0x65f6('0x12d')]:''),'body':_0x9d51e3[_0x65f6('0xdd')]?_0x9d51e3[_0x65f6('0xdd')][_0x65f6('0xe6')]:_0x9d51e3[_0x65f6('0xbe')],'direction':_0x9d51e3['direction']===_0x65f6('0xd1')?'A':'C','secret':_0x9d51e3['secret'],'read':_0x9d51e3[_0x65f6('0x89')],'attachment':_0x9d51e3[_0x65f6('0xdd')]};})[_0x65f6('0x6b')]()};return ejs[_0x65f6('0x12e')](path[_0x65f6('0xe3')](config[_0x65f6('0x114')],'server',_0x65f6('0x12f'),'downloadInteraction.ejs'),{'interaction':_0x4943cd})[_0x65f6('0x1f')](function(_0x5081ad){var _0x32829e=path['join'](_0x560dbb,_0x65f6('0x130')+_0x5d4415['id']+'-'+_0x286c97+_0x65f6('0x131'));var _0x3f421f={'path':_0x32829e,'channel':_0x65f6('0x120'),'interactionId':_0x5d4415['id']};return pdf['createPdfFromHTML'](_0x5081ad,_0x3f421f);})[_0x65f6('0x1f')](function(){return new BPromise(function(_0xbf09f6,_0x3d6e08){zipdir(_0x560dbb,{'saveTo':_0x2eda77},function(_0x2c4af8,_0x71483f){if(_0x2c4af8)return _0x3d6e08(_0x2c4af8);return _0xbf09f6(_0x71483f);});})[_0x65f6('0x1f')](function(){return new BPromise(function(_0xd06566,_0x21bf41){rimraf(_0x560dbb,function(_0x538dae){if(_0x538dae)_0x21bf41(_0x538dae);return _0xd06566();});});})['then'](function(){return _0x459924[_0x65f6('0xe7')](_0x2eda77,_0x2315bc,function(_0x121e5b){if(_0x121e5b){console[_0x65f6('0x132')](_0x65f6('0x133'),_0x121e5b);}else{fs['unlinkSync'](_0x2eda77);}});});});}else{return _0x459924[_0x65f6('0x29')](0xc8);}})[_0x65f6('0x28')](handleError(_0x459924,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(_0x42f48d,_0x8d0d10){var _0x103cc9=function(_0x30861c){while(--_0x30861c){_0x42f48d['push'](_0x42f48d['shift']());}};_0x103cc9(++_0x8d0d10);}(_0x66fa,0x117));var _0xa66f=function(_0x5a782d,_0x5d0bee){_0x5a782d=_0x5a782d-0x0;var _0xa4e463=_0x66fa[_0x5a782d];return _0xa4e463;};'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 1ce3dc0..5fc6faa 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 _0x9f03=['map','findAll','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x100e0c,_0x5523b8){var _0x4db1aa=function(_0x29f480){while(--_0x29f480){_0x100e0c['push'](_0x100e0c['shift']());}};_0x4db1aa(++_0x5523b8);}(_0x9f03,0xc6));var _0x39f0=function(_0x43d4ba,_0x22dfc6){_0x43d4ba=_0x43d4ba-0x0;var _0x52f78f=_0x9f03[_0x43d4ba];return _0x52f78f;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x39f0('0x0'))['db'][_0x39f0('0x1')];var ChatMessage=require(_0x39f0('0x0'))['db'][_0x39f0('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x39f0('0x3')](0x0);var events={'afterCreate':_0x39f0('0x4'),'afterUpdate':_0x39f0('0x5'),'afterDestroy':_0x39f0('0x6')};function emitEvent(_0x3f2ac9){return function(_0x3fdd82,_0xa8cf73,_0x446e7a){_0x3fdd82[_0x39f0('0x7')]({'attributes':['id'],'raw':!![]})[_0x39f0('0x8')](function(_0x305924){_0x3fdd82[_0x39f0('0x9')](_0x39f0('0xa'),_0x305924[_0x39f0('0xb')](function(_0x411af0){return{'id':_0x411af0['id']};}));return ChatMessage[_0x39f0('0xc')]({'where':{'ChatInteractionId':_0x3fdd82['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x46004b){_0x3fdd82[_0x39f0('0x9')]('unreadMessages',_0x46004b[_0x39f0('0xd')]);ChatInteractionEvents[_0x39f0('0xe')](_0x3f2ac9+':'+_0x3fdd82['id'],_0x3fdd82);ChatInteractionEvents[_0x39f0('0xe')](_0x3f2ac9,_0x3fdd82);_0x446e7a(null);})[_0x39f0('0xf')](_0x446e7a(null));};}for(var e in events){if(events[_0x39f0('0x10')](e)){var event=events[e];ChatInteraction[_0x39f0('0x11')](e,emitEvent(event));}}module[_0x39f0('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x915c=['update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','exports','events','ChatInteraction','../../mysqldb','setMaxListeners','save'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x915c,0xa5));var _0xc915=function(_0x1bfc42,_0x56e7fc){_0x1bfc42=_0x1bfc42-0x0;var _0x3f7592=_0x915c[_0x1bfc42];return _0x3f7592;};'use strict';var EventEmitter=require(_0xc915('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xc915('0x1')];var ChatMessage=require(_0xc915('0x2'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc915('0x3')](0x0);var events={'afterCreate':_0xc915('0x4'),'afterUpdate':_0xc915('0x5'),'afterDestroy':_0xc915('0x6')};function emitEvent(_0x20ff5b){return function(_0x449dd9,_0x9feaff,_0x559354){_0x449dd9[_0xc915('0x7')]({'attributes':['id'],'raw':!![]})[_0xc915('0x8')](function(_0x1253f0){_0x449dd9[_0xc915('0x9')](_0xc915('0xa'),_0x1253f0[_0xc915('0xb')](function(_0x27b230){return{'id':_0x27b230['id']};}));return ChatMessage[_0xc915('0xc')]({'where':{'ChatInteractionId':_0x449dd9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc915('0x8')](function(_0x94a767){_0x449dd9['setDataValue']('unreadMessages',_0x94a767[_0xc915('0xd')]);ChatInteractionEvents[_0xc915('0xe')](_0x20ff5b+':'+_0x449dd9['id'],_0x449dd9);ChatInteractionEvents['emit'](_0x20ff5b,_0x449dd9);_0x559354(null);})[_0xc915('0xf')](_0x559354(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xc915('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 428a165..e221149 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 _0x7755=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','api','request-promise','path','rimraf','exports','define','ChatInteraction','closed','closedAt','format'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x7755,0x161));var _0x5775=function(_0x3aaf78,_0x27aa1f){_0x3aaf78=_0x3aaf78-0x0;var _0x1c97b7=_0x7755[_0x3aaf78];return _0x1c97b7;};'use strict';var _=require(_0x5775('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5775('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5775('0x2'));var fs=require('fs');var path=require(_0x5775('0x3'));var rimraf=require(_0x5775('0x4'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x5775('0x5')]=function(_0x1dcfb2,_0x59c20c){return _0x1dcfb2[_0x5775('0x6')](_0x5775('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1292d3,_0x5ac436,_0x346456){if(_0x1292d3['changed'](_0x5775('0x8'))){_0x1292d3[_0x5775('0x9')]=moment()[_0x5775('0xa')](_0x5775('0xb'));}_0x346456(null,_0x1292d3);}},'charset':_0x5775('0xc'),'collate':_0x5775('0xd')});}; \ No newline at end of file +var _0x4609=['utf8mb4','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4609,0x199));var _0x9460=function(_0x2b003c,_0x21b39b){_0x2b003c=_0x2b003c-0x0;var _0x3aff56=_0x4609[_0x2b003c];return _0x3aff56;};'use strict';var _=require('lodash');var util=require(_0x9460('0x0'));var logger=require(_0x9460('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9460('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9460('0x3'));var rimraf=require(_0x9460('0x4'));var config=require(_0x9460('0x5'));var attributes=require(_0x9460('0x6'));module[_0x9460('0x7')]=function(_0x558c59,_0x32a5c3){return _0x558c59[_0x9460('0x8')](_0x9460('0x9'),attributes,{'tableName':_0x9460('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5243f7,_0x405e80,_0x3fad96){if(_0x5243f7[_0x9460('0xb')](_0x9460('0xc'))){_0x5243f7[_0x9460('0xd')]=moment()[_0x9460('0xe')](_0x9460('0xf'));}_0x3fad96(null,_0x5243f7);}},'charset':_0x9460('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 918fd4e..99385f2 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 _0x2f35=['message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','then','AddTagsToChatInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x187ef8,_0x19eb9a){var _0x5666c1=function(_0x29b788){while(--_0x29b788){_0x187ef8['push'](_0x187ef8['shift']());}};_0x5666c1(++_0x19eb9a);}(_0x2f35,0x1ea));var _0x52f3=function(_0x12f451,_0x3b618f){_0x12f451=_0x12f451-0x0;var _0x5e9589=_0x2f35[_0x12f451];return _0x5e9589;};'use strict';var _=require(_0x52f3('0x0'));var util=require('util');var moment=require(_0x52f3('0x1'));var BPromise=require(_0x52f3('0x2'));var rs=require(_0x52f3('0x3'));var fs=require('fs');var Redis=require(_0x52f3('0x4'));var db=require(_0x52f3('0x5'))['db'];var utils=require(_0x52f3('0x6'));var logger=require(_0x52f3('0x7'))(_0x52f3('0x8'));var config=require(_0x52f3('0x9'));var jayson=require(_0x52f3('0xa'));var client=jayson[_0x52f3('0xb')]['http']({'port':0x232a});config[_0x52f3('0xc')]=_[_0x52f3('0xd')](config['redis'],{'host':_0x52f3('0xe'),'port':0x18eb});var socket=require(_0x52f3('0xf'))(new Redis(config[_0x52f3('0xc')]));require(_0x52f3('0x10'))[_0x52f3('0x11')](socket);function respondWithRpcPromise(_0x2131dc,_0x1c17f5,_0x470dee){return new BPromise(function(_0x4c4f13,_0x45c4b5){return client[_0x52f3('0x12')](_0x2131dc,_0x470dee)['then'](function(_0x379342){logger[_0x52f3('0x13')](_0x52f3('0x14'),_0x1c17f5,'request\x20sent');logger[_0x52f3('0x15')](_0x52f3('0x16'),_0x1c17f5,_0x52f3('0x17'),JSON[_0x52f3('0x18')](_0x379342));if(_0x379342['error']){if(_0x379342[_0x52f3('0x19')][_0x52f3('0x1a')]===0x1f4){logger[_0x52f3('0x19')](_0x52f3('0x14'),_0x1c17f5,_0x379342[_0x52f3('0x19')][_0x52f3('0x1b')]);return _0x45c4b5(_0x379342[_0x52f3('0x19')][_0x52f3('0x1b')]);}logger[_0x52f3('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x1c17f5,_0x379342['error']['message']);return _0x4c4f13(_0x379342['error']['message']);}else{logger['info'](_0x52f3('0x14'),_0x1c17f5,_0x52f3('0x17'));_0x4c4f13(_0x379342[_0x52f3('0x1c')]['message']);}})[_0x52f3('0x1d')](function(_0xe4df2f){logger['error'](_0x52f3('0x14'),_0x1c17f5,_0xe4df2f);_0x45c4b5(_0xe4df2f);});});}exports[_0x52f3('0x1e')]=function(_0x1eb661){var _0x4b33ce=this;return new Promise(function(_0x20de7a,_0x23bdc8){return db[_0x52f3('0x1f')][_0x52f3('0x20')](_0x1eb661['body'],{'raw':_0x1eb661[_0x52f3('0x21')]?_0x1eb661[_0x52f3('0x21')][_0x52f3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eb661['options']?_0x1eb661['options'][_0x52f3('0x23')]||null:null,'attributes':_0x1eb661['options']?_0x1eb661['options'][_0x52f3('0x24')]||null:null,'limit':_0x1eb661[_0x52f3('0x21')]?_0x1eb661[_0x52f3('0x21')][_0x52f3('0x25')]||null:null})[_0x52f3('0x26')](function(_0x37ae38){logger[_0x52f3('0x13')](_0x52f3('0x1e'),_0x1eb661);logger[_0x52f3('0x15')](_0x52f3('0x1e'),_0x1eb661,JSON['stringify'](_0x37ae38));_0x20de7a(_0x37ae38);})[_0x52f3('0x1d')](function(_0xca042e){logger[_0x52f3('0x19')](_0x52f3('0x1e'),_0xca042e[_0x52f3('0x1b')],_0x1eb661);_0x23bdc8(_0x4b33ce[_0x52f3('0x19')](0x1f4,_0xca042e[_0x52f3('0x1b')]));});});};exports[_0x52f3('0x27')]=function(_0x246ac1){return new Promise(function(_0x47e9be,_0x3deade){return db[_0x52f3('0x1f')][_0x52f3('0x28')]({'where':_0x246ac1[_0x52f3('0x21')]?_0x246ac1[_0x52f3('0x21')]['where']||null:null})['then'](function(_0x118f7e){if(_0x118f7e){return _0x118f7e[_0x52f3('0x29')](_0x246ac1['body'][_0x52f3('0x2a')],_[_0x52f3('0x2b')](_0x246ac1[_0x52f3('0x2c')],['ids','id'])||{});}})[_0x52f3('0x2d')](function(_0x1bdb1b){logger[_0x52f3('0x13')](_0x52f3('0x2e'),_0x246ac1);logger[_0x52f3('0x15')](_0x52f3('0x2e'),_0x246ac1,JSON[_0x52f3('0x18')](_0x1bdb1b));_0x47e9be(_0x1bdb1b);})['catch'](function(_0x25a61d){logger['error'](_0x52f3('0x2e'),_0x25a61d[_0x52f3('0x1b')],_0x246ac1);_0x3deade(_this['error'](0x1f4,_0x25a61d[_0x52f3('0x1b')]));});});}; \ No newline at end of file +var _0x771f=['attributes','limit','stringify','AddTagsToChatInteraction','find','body','ids','spread','AddTags','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where'];(function(_0x58dd03,_0x10ad3b){var _0x3d94bb=function(_0x5df1c8){while(--_0x5df1c8){_0x58dd03['push'](_0x58dd03['shift']());}};_0x3d94bb(++_0x10ad3b);}(_0x771f,0x151));var _0xf771=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x771f[_0x1deee5];return _0x1d6c3a;};'use strict';var _=require(_0xf771('0x0'));var util=require('util');var moment=require(_0xf771('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf771('0x2'));var db=require(_0xf771('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf771('0x4'));var config=require(_0xf771('0x5'));var jayson=require(_0xf771('0x6'));var client=jayson[_0xf771('0x7')][_0xf771('0x8')]({'port':0x232a});config['redis']=_[_0xf771('0x9')](config['redis'],{'host':_0xf771('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf771('0xb')]));require(_0xf771('0xc'))[_0xf771('0xd')](socket);function respondWithRpcPromise(_0x26c399,_0x5bce59,_0x47a3bb){return new BPromise(function(_0x24d2a5,_0x4f1766){return client[_0xf771('0xe')](_0x26c399,_0x47a3bb)[_0xf771('0xf')](function(_0x314420){logger[_0xf771('0x10')](_0xf771('0x11'),_0x5bce59,_0xf771('0x12'));logger[_0xf771('0x13')](_0xf771('0x14'),_0x5bce59,_0xf771('0x12'),JSON['stringify'](_0x314420));if(_0x314420[_0xf771('0x15')]){if(_0x314420['error'][_0xf771('0x16')]===0x1f4){logger[_0xf771('0x15')](_0xf771('0x11'),_0x5bce59,_0x314420['error']['message']);return _0x4f1766(_0x314420[_0xf771('0x15')][_0xf771('0x17')]);}logger[_0xf771('0x15')](_0xf771('0x11'),_0x5bce59,_0x314420[_0xf771('0x15')][_0xf771('0x17')]);return _0x24d2a5(_0x314420[_0xf771('0x15')][_0xf771('0x17')]);}else{logger['info'](_0xf771('0x11'),_0x5bce59,_0xf771('0x12'));_0x24d2a5(_0x314420[_0xf771('0x18')]['message']);}})[_0xf771('0x19')](function(_0x555e0e){logger[_0xf771('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5bce59,_0x555e0e);_0x4f1766(_0x555e0e);});});}exports[_0xf771('0x1a')]=function(_0xf2d310){var _0x1aa6d6=this;return new Promise(function(_0x44ea2f,_0xc0942f){return db[_0xf771('0x1b')][_0xf771('0x1c')](_0xf2d310['body'],{'raw':_0xf2d310[_0xf771('0x1d')]?_0xf2d310['options'][_0xf771('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2d310[_0xf771('0x1d')]?_0xf2d310['options'][_0xf771('0x1f')]||null:null,'attributes':_0xf2d310[_0xf771('0x1d')]?_0xf2d310['options'][_0xf771('0x20')]||null:null,'limit':_0xf2d310[_0xf771('0x1d')]?_0xf2d310[_0xf771('0x1d')][_0xf771('0x21')]||null:null})[_0xf771('0xf')](function(_0xa18258){logger[_0xf771('0x10')](_0xf771('0x1a'),_0xf2d310);logger[_0xf771('0x13')]('UpdateChatInteraction',_0xf2d310,JSON[_0xf771('0x22')](_0xa18258));_0x44ea2f(_0xa18258);})['catch'](function(_0x488015){logger[_0xf771('0x15')]('UpdateChatInteraction',_0x488015['message'],_0xf2d310);_0xc0942f(_0x1aa6d6[_0xf771('0x15')](0x1f4,_0x488015[_0xf771('0x17')]));});});};exports[_0xf771('0x23')]=function(_0x37dbd0){return new Promise(function(_0x47bb1f,_0x118159){return db['ChatInteraction'][_0xf771('0x24')]({'where':_0x37dbd0['options']?_0x37dbd0[_0xf771('0x1d')]['where']||null:null})[_0xf771('0xf')](function(_0x224d09){if(_0x224d09){return _0x224d09['addTags'](_0x37dbd0[_0xf771('0x25')][_0xf771('0x26')],_['omit'](_0x37dbd0['body'],[_0xf771('0x26'),'id'])||{});}})[_0xf771('0x27')](function(_0x33e959){logger[_0xf771('0x10')](_0xf771('0x28'),_0x37dbd0);logger[_0xf771('0x13')](_0xf771('0x28'),_0x37dbd0,JSON['stringify'](_0x33e959));_0x47bb1f(_0x33e959);})[_0xf771('0x19')](function(_0x1c5136){logger[_0xf771('0x15')](_0xf771('0x28'),_0x1c5136['message'],_0x37dbd0);_0x118159(_this[_0xf771('0x15')](0x1f4,_0x1c5136[_0xf771('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f1ad7c5..51a6511 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 _0x2eea=['./chatInteraction.events','remove','update','emit','removeListener','register','chatInteraction:'];(function(_0x283470,_0x42a99f){var _0x55d54a=function(_0x4da491){while(--_0x4da491){_0x283470['push'](_0x283470['shift']());}};_0x55d54a(++_0x42a99f);}(_0x2eea,0x188));var _0xa2ee=function(_0x554c8c,_0x23fa96){_0x554c8c=_0x554c8c-0x0;var _0x1e3284=_0x2eea[_0x554c8c];return _0x1e3284;};'use strict';var ChatInteractionEvents=require(_0xa2ee('0x0'));var events=['save',_0xa2ee('0x1'),_0xa2ee('0x2')];function createListener(_0x492317,_0x1e12b4){return function(_0xc3909b){_0x1e12b4[_0xa2ee('0x3')](_0x492317,_0xc3909b);};}function removeListener(_0x1f20cf,_0x485c09){return function(){ChatInteractionEvents[_0xa2ee('0x4')](_0x1f20cf,_0x485c09);};}exports[_0xa2ee('0x5')]=function(_0x1d3495){for(var _0x418c0c=0x0,_0x59ccc5=events['length'];_0x418c0c<_0x59ccc5;_0x418c0c++){var _0x3c9164=events[_0x418c0c];var _0x458122=createListener(_0xa2ee('0x6')+_0x3c9164,_0x1d3495);ChatInteractionEvents['on'](_0x3c9164,_0x458122);}}; \ No newline at end of file +var _0x7be5=['./chatInteraction.events','remove','emit','register','length','chatInteraction:'];(function(_0x57c5e0,_0x46441f){var _0x512049=function(_0x223209){while(--_0x223209){_0x57c5e0['push'](_0x57c5e0['shift']());}};_0x512049(++_0x46441f);}(_0x7be5,0x11a));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var ChatInteractionEvents=require(_0x57be('0x0'));var events=['save',_0x57be('0x1'),'update'];function createListener(_0x4aeabb,_0x42207e){return function(_0x1c51b6){_0x42207e[_0x57be('0x2')](_0x4aeabb,_0x1c51b6);};}function removeListener(_0x23583a,_0x24974a){return function(){ChatInteractionEvents['removeListener'](_0x23583a,_0x24974a);};}exports[_0x57be('0x3')]=function(_0xa9c6da){for(var _0xacf95a=0x0,_0x3bfbd3=events[_0x57be('0x4')];_0xacf95a<_0x3bfbd3;_0xacf95a++){var _0x4184ab=events[_0xacf95a];var _0x1ac835=createListener(_0x57be('0x5')+_0x4184ab,_0xa9c6da);ChatInteractionEvents['on'](_0x4184ab,_0x1ac835);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index cd62b60..a22c96a 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 _0x5415=['put','/:id','update','/:id/custom_update','customUpdate','abandon','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x5415,0x191));var _0x5541=function(_0x4e0958,_0x37b6d7){_0x4e0958=_0x4e0958-0x0;var _0x413afe=_0x5415[_0x4e0958];return _0x413afe;};'use strict';var multer=require('multer');var util=require(_0x5541('0x0'));var path=require(_0x5541('0x1'));var timeout=require(_0x5541('0x2'));var express=require(_0x5541('0x3'));var router=express[_0x5541('0x4')]();var fs_extra=require(_0x5541('0x5'));var auth=require(_0x5541('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5541('0x7'));var controller=require('./chatInteraction.controller');router[_0x5541('0x8')]('/',auth[_0x5541('0x9')](),controller['index']);router[_0x5541('0x8')](_0x5541('0xa'),auth[_0x5541('0x9')](),controller[_0x5541('0xb')]);router[_0x5541('0x8')]('/:id',auth[_0x5541('0xc')](),controller[_0x5541('0xd')]);router['get']('/:id/attachment_download',auth[_0x5541('0xc')](),controller[_0x5541('0xe')]);router['get'](_0x5541('0xf'),auth[_0x5541('0x9')](),controller[_0x5541('0x10')]);router['get'](_0x5541('0x11'),auth[_0x5541('0xc')](),controller[_0x5541('0x12')]);router[_0x5541('0x8')](_0x5541('0x13'),auth[_0x5541('0x9')](),controller[_0x5541('0x14')]);router['post']('/',auth[_0x5541('0x9')](),controller['create']);router[_0x5541('0x15')](_0x5541('0x16'),auth[_0x5541('0x9')](),controller[_0x5541('0x17')]);var upload=multer({'storage':multer[_0x5541('0x18')]({'destination':function(_0xfb285c,_0x1340f8,_0x24eb66){_0x24eb66(null,path[_0x5541('0x19')](config['root'],'server/files/attachments/'));},'filename':function(_0x1be80b,_0x135027,_0x3a087a){_0x3a087a(null,util[_0x5541('0x1a')](_0x5541('0x1b'),Date[_0x5541('0x1c')](),_0x135027[_0x5541('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5541('0x15')](_0x5541('0x1e'),upload[_0x5541('0x1f')](_0x5541('0x20')),controller[_0x5541('0x21')]);router[_0x5541('0x15')](_0x5541('0xf'),auth[_0x5541('0xc')](),controller[_0x5541('0x22')]);router['post'](_0x5541('0x23'),auth[_0x5541('0x9')](),interaction[_0x5541('0x24')](_0x5541('0x25'),_0x5541('0x26')),controller[_0x5541('0x27')]);router[_0x5541('0x28')](_0x5541('0x29'),auth[_0x5541('0x9')](),interaction[_0x5541('0x24')](_0x5541('0x25'),'chatinteraction:update'),controller[_0x5541('0x2a')]);router['put'](_0x5541('0x2b'),controller[_0x5541('0x2c')]);router['put']('/:id/abandon',auth[_0x5541('0xc')](),controller[_0x5541('0x2d')]);router[_0x5541('0x28')]('/:id/close',controller['close']);router[_0x5541('0x2e')](_0x5541('0x29'),auth[_0x5541('0x9')](),interaction['tracked'](_0x5541('0x25'),'chatinteraction:destroy'),controller[_0x5541('0x2f')]);router[_0x5541('0x2e')](_0x5541('0x23'),auth[_0x5541('0x9')](),controller['removeTags']);module[_0x5541('0x30')]=router; \ No newline at end of file +var _0x87be=['format','%s-%s','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/'];(function(_0x44b346,_0xeb097d){var _0x1c2f2b=function(_0x4e1f23){while(--_0x4e1f23){_0x44b346['push'](_0x44b346['shift']());}};_0x1c2f2b(++_0xeb097d);}(_0x87be,0x151));var _0xe87b=function(_0x17b9b6,_0xc24214){_0x17b9b6=_0x17b9b6-0x0;var _0x159874=_0x87be[_0x17b9b6];return _0x159874;};'use strict';var multer=require(_0xe87b('0x0'));var util=require(_0xe87b('0x1'));var path=require('path');var timeout=require(_0xe87b('0x2'));var express=require(_0xe87b('0x3'));var router=express[_0xe87b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe87b('0x5'));var controller=require('./chatInteraction.controller');router[_0xe87b('0x6')]('/',auth[_0xe87b('0x7')](),controller[_0xe87b('0x8')]);router[_0xe87b('0x6')](_0xe87b('0x9'),auth[_0xe87b('0x7')](),controller['describe']);router['get'](_0xe87b('0xa'),auth[_0xe87b('0xb')](),controller[_0xe87b('0xc')]);router[_0xe87b('0x6')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xe87b('0xd')]);router[_0xe87b('0x6')]('/:id/messages',auth[_0xe87b('0x7')](),controller[_0xe87b('0xe')]);router[_0xe87b('0x6')](_0xe87b('0xf'),auth[_0xe87b('0xb')](),controller[_0xe87b('0x10')]);router[_0xe87b('0x6')](_0xe87b('0x11'),auth['isAuthenticated'](),controller[_0xe87b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe87b('0x13')]);router[_0xe87b('0x14')](_0xe87b('0x15'),auth[_0xe87b('0x7')](),controller[_0xe87b('0x16')]);var upload=multer({'storage':multer[_0xe87b('0x17')]({'destination':function(_0x59568e,_0x788468,_0x397302){_0x397302(null,path[_0xe87b('0x18')](config[_0xe87b('0x19')],_0xe87b('0x1a')));},'filename':function(_0x7b3a5a,_0x151af3,_0x28d37d){_0x28d37d(null,util[_0xe87b('0x1b')](_0xe87b('0x1c'),Date['now'](),_0x151af3[_0xe87b('0x1d')][_0xe87b('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xe87b('0x1f'),upload[_0xe87b('0x20')]('file'),controller[_0xe87b('0x21')]);router['post'](_0xe87b('0x22'),auth['isChatInteractionAuthorized'](),controller[_0xe87b('0x23')]);router['post']('/:id/tags',auth[_0xe87b('0x7')](),interaction[_0xe87b('0x24')](_0xe87b('0x25'),_0xe87b('0x26')),controller['addTags']);router[_0xe87b('0x27')](_0xe87b('0xa'),auth['isAuthenticated'](),interaction[_0xe87b('0x24')](_0xe87b('0x25'),_0xe87b('0x28')),controller['update']);router['put'](_0xe87b('0x29'),controller[_0xe87b('0x2a')]);router[_0xe87b('0x27')](_0xe87b('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xe87b('0x2c')]);router[_0xe87b('0x27')](_0xe87b('0x2d'),controller[_0xe87b('0x2e')]);router['delete'](_0xe87b('0xa'),auth[_0xe87b('0x7')](),interaction[_0xe87b('0x24')](_0xe87b('0x25'),_0xe87b('0x2f')),controller[_0xe87b('0x30')]);router['delete'](_0xe87b('0x31'),auth[_0xe87b('0x7')](),controller[_0xe87b('0x32')]);module[_0xe87b('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e596d24..8c67b06 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 _0xc9e9=['exports','TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0xc9e9,0xb8));var _0x9c9e=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xc9e9[_0x352e09];return _0x1b7094;};'use strict';var Sequelize=require(_0x9c9e('0x0'));module[_0x9c9e('0x1')]={'body':{'type':Sequelize[_0x9c9e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9c9e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9c9e('0x4')]}}; \ No newline at end of file +var _0x261a=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x239cca,_0x4d807b){var _0x57675a=function(_0x161741){while(--_0x161741){_0x239cca['push'](_0x239cca['shift']());}};_0x57675a(++_0x4d807b);}(_0x261a,0x66));var _0xa261=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x261a[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xa261('0x0'));module[_0xa261('0x1')]={'body':{'type':Sequelize[_0xa261('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa261('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa261('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 82bffea..50b2759 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 _0xeb82=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./chatInternalMessage.socket','end','status','json','offset','count','limit','set','Content-Range','reject','save','update','destroy','then','stack','send','map','ChatInternalMessage','rawAttributes','fieldName','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','rows','catch','show','params','keys','length','include','find','create','body','describe','get','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','user','fullname','role','userpic','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','createdAt','FromId','ToId','read','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2ba6b6,_0xd11764){var _0x435f1e=function(_0x42f16e){while(--_0x42f16e){_0x2ba6b6['push'](_0x2ba6b6['shift']());}};_0x435f1e(++_0xd11764);}(_0xeb82,0x199));var _0x2eb8=function(_0x22a99c,_0x5b0985){_0x22a99c=_0x22a99c-0x0;var _0x5a10bf=_0xeb82[_0x22a99c];return _0x5a10bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2eb8('0x0'));var zipdir=require(_0x2eb8('0x1'));var jsonpatch=require(_0x2eb8('0x2'));var rp=require(_0x2eb8('0x3'));var moment=require('moment');var BPromise=require(_0x2eb8('0x4'));var Mustache=require(_0x2eb8('0x5'));var util=require(_0x2eb8('0x6'));var path=require(_0x2eb8('0x7'));var sox=require('sox');var csv=require(_0x2eb8('0x8'));var ejs=require(_0x2eb8('0x9'));var fs=require('fs');var fs_extra=require(_0x2eb8('0xa'));var _=require(_0x2eb8('0xb'));var squel=require(_0x2eb8('0xc'));var crypto=require('crypto');var jsforce=require(_0x2eb8('0xd'));var deskjs=require(_0x2eb8('0xe'));var toCsv=require(_0x2eb8('0x8'));var querystring=require('querystring');var Papa=require(_0x2eb8('0xf'));var Redis=require(_0x2eb8('0x10'));var authService=require(_0x2eb8('0x11'));var qs=require(_0x2eb8('0x12'));var as=require(_0x2eb8('0x13'));var hardwareService=require(_0x2eb8('0x14'));var logger=require(_0x2eb8('0x15'))(_0x2eb8('0x16'));var utils=require(_0x2eb8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2eb8('0x18'));var db=require(_0x2eb8('0x19'))['db'];config['redis']=_[_0x2eb8('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2eb8('0x1b'))(new Redis(config['redis']));require(_0x2eb8('0x1c'))['register'](socket);function respondWithStatusCode(_0x51a775,_0x201078){_0x201078=_0x201078||0xcc;return function(_0x57d7e8){if(_0x57d7e8){return _0x51a775['sendStatus'](_0x201078);}return _0x51a775['status'](_0x201078)[_0x2eb8('0x1d')]();};}function respondWithResult(_0x33c81e,_0x321d5f){_0x321d5f=_0x321d5f||0xc8;return function(_0x4d691b){if(_0x4d691b){return _0x33c81e[_0x2eb8('0x1e')](_0x321d5f)[_0x2eb8('0x1f')](_0x4d691b);}};}function respondWithFilteredResult(_0x14512f,_0x1f9b22){return function(_0x59458c){if(_0x59458c){var _0x3b8e34=typeof _0x1f9b22[_0x2eb8('0x20')]==='undefined'&&typeof _0x1f9b22['limit']==='undefined';var _0x5b6ea7=_0x59458c[_0x2eb8('0x21')];var _0x3cc59e=_0x3b8e34?0x0:_0x1f9b22['offset'];var _0x13d01b=_0x3b8e34?_0x59458c[_0x2eb8('0x21')]:_0x1f9b22[_0x2eb8('0x20')]+_0x1f9b22[_0x2eb8('0x22')];var _0x414839;if(_0x13d01b>=_0x5b6ea7){_0x13d01b=_0x5b6ea7;_0x414839=0xc8;}else{_0x414839=0xce;}_0x14512f[_0x2eb8('0x1e')](_0x414839);return _0x14512f[_0x2eb8('0x23')](_0x2eb8('0x24'),_0x3cc59e+'-'+_0x13d01b+'/'+_0x5b6ea7)[_0x2eb8('0x1f')](_0x59458c);}return null;};}function patchUpdates(_0x30c3db){return function(_0x1e96f3){try{jsonpatch['apply'](_0x1e96f3,_0x30c3db,!![]);}catch(_0x53c73f){return BPromise[_0x2eb8('0x25')](_0x53c73f);}return _0x1e96f3[_0x2eb8('0x26')]();};}function saveUpdates(_0x690b80,_0x2e7642){return function(_0x5c6036){if(_0x5c6036){return _0x5c6036[_0x2eb8('0x27')](_0x690b80)['then'](function(_0x5a024d){return _0x5a024d;});}return null;};}function removeEntity(_0x2f682c,_0xed74d0){return function(_0x43186f){if(_0x43186f){return _0x43186f[_0x2eb8('0x28')]()[_0x2eb8('0x29')](function(){_0x2f682c['status'](0xcc)[_0x2eb8('0x1d')]();});}};}function handleEntityNotFound(_0x5774aa,_0x4d1aaa){return function(_0x5089a2){if(!_0x5089a2){_0x5774aa['sendStatus'](0x194);}return _0x5089a2;};}function handleError(_0x460afb,_0x7444c){_0x7444c=_0x7444c||0x1f4;return function(_0x7bfc31){logger['error'](_0x7bfc31[_0x2eb8('0x2a')]);if(_0x7bfc31['name']){delete _0x7bfc31['name'];}_0x460afb[_0x2eb8('0x1e')](_0x7444c)[_0x2eb8('0x2b')](_0x7bfc31);};}exports['index']=function(_0x975e4a,_0x1b5dc9){var _0x3db4f3={},_0x3e3639={},_0x4f1279={'count':0x0,'rows':[]};var _0x106ad8=_[_0x2eb8('0x2c')](db[_0x2eb8('0x2d')][_0x2eb8('0x2e')],function(_0x5982ec){return{'name':_0x5982ec[_0x2eb8('0x2f')],'type':_0x5982ec['type'][_0x2eb8('0x30')]};});_0x3e3639[_0x2eb8('0x31')]=_['map'](_0x106ad8,_0x2eb8('0x32'));_0x3e3639['query']=_['keys'](_0x975e4a['query']);_0x3e3639[_0x2eb8('0x33')]=_[_0x2eb8('0x34')](_0x3e3639[_0x2eb8('0x31')],_0x3e3639[_0x2eb8('0x35')]);_0x3db4f3[_0x2eb8('0x36')]=_[_0x2eb8('0x34')](_0x3e3639[_0x2eb8('0x31')],qs[_0x2eb8('0x37')](_0x975e4a[_0x2eb8('0x35')]['fields']));_0x3db4f3[_0x2eb8('0x36')]=_0x3db4f3['attributes']['length']?_0x3db4f3[_0x2eb8('0x36')]:_0x3e3639[_0x2eb8('0x31')];if(!_0x975e4a[_0x2eb8('0x35')][_0x2eb8('0x38')]('nolimit')){_0x3db4f3['limit']=qs['limit'](_0x975e4a[_0x2eb8('0x35')][_0x2eb8('0x22')]);_0x3db4f3[_0x2eb8('0x20')]=qs['offset'](_0x975e4a[_0x2eb8('0x35')]['offset']);}_0x3db4f3[_0x2eb8('0x39')]=qs[_0x2eb8('0x3a')](_0x975e4a[_0x2eb8('0x35')][_0x2eb8('0x3a')]);_0x3db4f3[_0x2eb8('0x3b')]=qs[_0x2eb8('0x33')](_[_0x2eb8('0x3c')](_0x975e4a[_0x2eb8('0x35')],_0x3e3639[_0x2eb8('0x33')]),_0x106ad8);if(_0x975e4a[_0x2eb8('0x35')][_0x2eb8('0x3d')]){_0x3db4f3[_0x2eb8('0x3b')]=_['merge'](_0x3db4f3[_0x2eb8('0x3b')],{'$or':_[_0x2eb8('0x2c')](_0x106ad8,function(_0x5a06a5){if(_0x5a06a5[_0x2eb8('0x3e')]!==_0x2eb8('0x3f')){var _0x128e7a={};_0x128e7a[_0x5a06a5[_0x2eb8('0x32')]]={'$like':'%'+_0x975e4a['query'][_0x2eb8('0x3d')]+'%'};return _0x128e7a;}})});}_0x3db4f3=_['merge']({},_0x3db4f3,_0x975e4a[_0x2eb8('0x40')]);var _0x19bf72={'where':_0x3db4f3['where']};return db[_0x2eb8('0x2d')][_0x2eb8('0x21')](_0x19bf72)[_0x2eb8('0x29')](function(_0x275915){_0x4f1279['count']=_0x275915;if(_0x975e4a[_0x2eb8('0x35')]['includeAll']){_0x3db4f3['include']=[{'all':!![]}];}return db[_0x2eb8('0x2d')]['findAll'](_0x3db4f3);})[_0x2eb8('0x29')](function(_0x3b2f13){_0x4f1279[_0x2eb8('0x41')]=_0x3b2f13;return _0x4f1279;})[_0x2eb8('0x29')](respondWithFilteredResult(_0x1b5dc9,_0x3db4f3))[_0x2eb8('0x42')](handleError(_0x1b5dc9,null));};exports[_0x2eb8('0x43')]=function(_0x2fe730,_0x3d491e){var _0xd2b736={'raw':!![],'where':{'id':_0x2fe730[_0x2eb8('0x44')]['id']}},_0x1cf634={};_0x1cf634[_0x2eb8('0x31')]=_[_0x2eb8('0x45')](db[_0x2eb8('0x2d')]['rawAttributes']);_0x1cf634[_0x2eb8('0x35')]=_[_0x2eb8('0x45')](_0x2fe730[_0x2eb8('0x35')]);_0x1cf634[_0x2eb8('0x33')]=_[_0x2eb8('0x34')](_0x1cf634[_0x2eb8('0x31')],_0x1cf634['query']);_0xd2b736[_0x2eb8('0x36')]=_['intersection'](_0x1cf634[_0x2eb8('0x31')],qs[_0x2eb8('0x37')](_0x2fe730[_0x2eb8('0x35')]['fields']));_0xd2b736[_0x2eb8('0x36')]=_0xd2b736[_0x2eb8('0x36')][_0x2eb8('0x46')]?_0xd2b736[_0x2eb8('0x36')]:_0x1cf634['model'];if(_0x2fe730['query']['includeAll']){_0xd2b736[_0x2eb8('0x47')]=[{'all':!![]}];}_0xd2b736=_['merge']({},_0xd2b736,_0x2fe730['options']);return db['ChatInternalMessage'][_0x2eb8('0x48')](_0xd2b736)[_0x2eb8('0x29')](handleEntityNotFound(_0x3d491e,null))[_0x2eb8('0x29')](respondWithResult(_0x3d491e,null))[_0x2eb8('0x42')](handleError(_0x3d491e,null));};exports['create']=function(_0x2deb4f,_0x203980){return db[_0x2eb8('0x2d')][_0x2eb8('0x49')](_0x2deb4f['body'],{})[_0x2eb8('0x29')](respondWithResult(_0x203980,0xc9))[_0x2eb8('0x42')](handleError(_0x203980,null));};exports[_0x2eb8('0x27')]=function(_0x5364ae,_0x96eb0){if(_0x5364ae[_0x2eb8('0x4a')]['id']){delete _0x5364ae[_0x2eb8('0x4a')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x5364ae['params']['id']}})['then'](handleEntityNotFound(_0x96eb0,null))[_0x2eb8('0x29')](saveUpdates(_0x5364ae[_0x2eb8('0x4a')],null))['then'](respondWithResult(_0x96eb0,null))['catch'](handleError(_0x96eb0,null));};exports[_0x2eb8('0x28')]=function(_0x77c178,_0xff6c77){return db[_0x2eb8('0x2d')][_0x2eb8('0x48')]({'where':{'id':_0x77c178[_0x2eb8('0x44')]['id']}})[_0x2eb8('0x29')](handleEntityNotFound(_0xff6c77,null))[_0x2eb8('0x29')](removeEntity(_0xff6c77,null))[_0x2eb8('0x42')](handleError(_0xff6c77,null));};exports[_0x2eb8('0x4b')]=function(_0x1550c7,_0x2f0079){return db[_0x2eb8('0x2d')][_0x2eb8('0x4b')]()[_0x2eb8('0x29')](respondWithResult(_0x2f0079,null))['catch'](handleError(_0x2f0079,null));};function wrapUser(_0x25916e){return function(_0x4175ea){var _0x243d96=_0x25916e[_0x2eb8('0x4c')]({'plain':!![]});_0x243d96[_0x2eb8('0x4d')]=[];if(_0x4175ea){_0x243d96[_0x2eb8('0x4e')]=_0x4175ea['createdAt'];_0x243d96[_0x2eb8('0x4f')]=_0x4175ea;}else{_0x243d96['lastMessageAt']=moment(0x0)['format'](_0x2eb8('0x50'));_0x243d96['lastMessage']={};}return _0x243d96;};}exports['getUsers']=function(_0x216200,_0x4a8ba0,_0x48e323){var _0x14b5fd=[];return db[_0x2eb8('0x51')][_0x2eb8('0x52')]({'where':{'role':[_0x2eb8('0x53'),_0x2eb8('0x54'),_0x2eb8('0x55')]},'attributes':['id',_0x2eb8('0x56'),'name',_0x2eb8('0x57'),_0x2eb8('0x58'),'internal','online',_0x2eb8('0x59'),_0x2eb8('0x5a'),_0x2eb8('0x5b')],'order':qs['sort'](_0x2eb8('0x5c')),'include':[{'model':db[_0x2eb8('0x5d')],'as':_0x2eb8('0x5e'),'attributes':['id',_0x2eb8('0x32'),_0x2eb8('0x3e')],'through':{'attributes':[]}}]})['then'](function(_0x444a81){if(_0x444a81){var _0x239e58=_0x216200[_0x2eb8('0x55')][_0x2eb8('0x4c')]({'plain':!![]});if(!_0x239e58)throw new Error(_0x2eb8('0x5f'));if(_0x239e58[_0x2eb8('0x57')]===_0x2eb8('0x55')){return db['UserProfileSection'][_0x2eb8('0x48')]({'where':{'name':_0x2eb8('0x60'),'userProfileId':_0x239e58[_0x2eb8('0x61')]},'raw':!![]})[_0x2eb8('0x29')](function(_0x3a55c1){if(_0x3a55c1){if(_0x3a55c1[_0x2eb8('0x62')]===0x0){return db[_0x2eb8('0x63')][_0x2eb8('0x52')]({'where':{'sectionId':_0x3a55c1['id']},'raw':!![]})[_0x2eb8('0x29')](function(_0x3db4e0){var _0x41301f=[];if(_[_0x2eb8('0x64')](_0x3db4e0)){_0x41301f=_['filter'](_0x444a81,function(_0x3143a8){if(_0x3143a8[_0x2eb8('0x57')]!=='agent'){return _0x3143a8;}});return _0x41301f;}else{for(var _0x250f27=0x0;_0x250f27<_0x444a81[_0x2eb8('0x46')];_0x250f27++){var _0x5a2c62=_0x444a81[_0x250f27];if(_0x5a2c62[_0x2eb8('0x57')]==='agent'){var _0x3d4844=_[_0x2eb8('0x48')](_0x3db4e0,function(_0x467cc4){return _0x467cc4['resourceId']===_0x5a2c62['id'];});if(_0x3d4844)_0x41301f[_0x2eb8('0x65')](_0x5a2c62);}else{_0x41301f[_0x2eb8('0x65')](_0x5a2c62);}}return _0x41301f;}});}else{return _0x444a81;}}else{var _0x10dbfa=_[_0x2eb8('0x3d')](_0x444a81,function(_0x3d378e){if(_0x3d378e[_0x2eb8('0x57')]!==_0x2eb8('0x53')){return _0x3d378e;}});return _0x10dbfa;}});}else{return _0x444a81;}}})[_0x2eb8('0x29')](function(_0x53b97a){var _0x1bfd9c=[];if(_0x53b97a){_0x14b5fd=_0x53b97a;for(var _0x18ffc7=0x0;_0x18ffc7<_0x53b97a[_0x2eb8('0x46')];_0x18ffc7+=0x1){_0x14b5fd[_0x18ffc7][_0x2eb8('0x4d')]=[];_0x1bfd9c['push'](db['ChatInternalMessage'][_0x2eb8('0x48')]({'where':{'FromId':[_0x216200['user']['id'],_0x53b97a[_0x18ffc7]['id']],'ToId':[_0x216200[_0x2eb8('0x55')]['id'],_0x53b97a[_0x18ffc7]['id']],'ChatGroupId':null},'attributes':['id',_0x2eb8('0x66'),_0x2eb8('0x67'),_0x2eb8('0x68'),_0x2eb8('0x69'),_0x2eb8('0x4a')],'order':qs[_0x2eb8('0x3a')](_0x2eb8('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2eb8('0x29')](wrapUser(_0x53b97a[_0x18ffc7])));}return BPromise['all'](_0x1bfd9c);}return[];})[_0x2eb8('0x29')](function(_0x3752b1){return{'rows':_0x3752b1,'count':_0x3752b1['length']};})[_0x2eb8('0x29')](respondWithResult(_0x4a8ba0,null))['catch'](handleError(_0x4a8ba0,null));}; \ No newline at end of file +var _0xa98a=['includeAll','include','findAll','params','options','find','catch','create','body','describe','get','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','isEmpty','filter','resourceId','push','messages','FromId','ToId','read','all','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','ChatInternalMessage','count'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xa98a,0x103));var _0xaa98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa98('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa98('0x1'));var moment=require(_0xaa98('0x2'));var BPromise=require(_0xaa98('0x3'));var Mustache=require(_0xaa98('0x4'));var util=require(_0xaa98('0x5'));var path=require(_0xaa98('0x6'));var sox=require(_0xaa98('0x7'));var csv=require(_0xaa98('0x8'));var ejs=require(_0xaa98('0x9'));var fs=require('fs');var fs_extra=require(_0xaa98('0xa'));var _=require(_0xaa98('0xb'));var squel=require('squel');var crypto=require(_0xaa98('0xc'));var jsforce=require(_0xaa98('0xd'));var deskjs=require(_0xaa98('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaa98('0xf'));var Redis=require(_0xaa98('0x10'));var authService=require(_0xaa98('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa98('0x12'));var hardwareService=require(_0xaa98('0x13'));var logger=require(_0xaa98('0x14'))(_0xaa98('0x15'));var utils=require('../../config/utils');var config=require(_0xaa98('0x16'));var licenseUtil=require(_0xaa98('0x17'));var db=require(_0xaa98('0x18'))['db'];config[_0xaa98('0x19')]=_[_0xaa98('0x1a')](config['redis'],{'host':_0xaa98('0x1b'),'port':0x18eb});var socket=require(_0xaa98('0x1c'))(new Redis(config['redis']));require(_0xaa98('0x1d'))[_0xaa98('0x1e')](socket);function respondWithStatusCode(_0x5e3893,_0x247957){_0x247957=_0x247957||0xcc;return function(_0x3cfda1){if(_0x3cfda1){return _0x5e3893[_0xaa98('0x1f')](_0x247957);}return _0x5e3893[_0xaa98('0x20')](_0x247957)[_0xaa98('0x21')]();};}function respondWithResult(_0x140a20,_0x1ed1b9){_0x1ed1b9=_0x1ed1b9||0xc8;return function(_0x32d535){if(_0x32d535){return _0x140a20[_0xaa98('0x20')](_0x1ed1b9)[_0xaa98('0x22')](_0x32d535);}};}function respondWithFilteredResult(_0x38572c,_0x258178){return function(_0x252a4e){if(_0x252a4e){var _0x3b9e1b=typeof _0x258178['offset']==='undefined'&&typeof _0x258178[_0xaa98('0x23')]===_0xaa98('0x24');var _0x148532=_0x252a4e['count'];var _0x99d02f=_0x3b9e1b?0x0:_0x258178['offset'];var _0x12cb17=_0x3b9e1b?_0x252a4e['count']:_0x258178[_0xaa98('0x25')]+_0x258178['limit'];var _0x481d7b;if(_0x12cb17>=_0x148532){_0x12cb17=_0x148532;_0x481d7b=0xc8;}else{_0x481d7b=0xce;}_0x38572c[_0xaa98('0x20')](_0x481d7b);return _0x38572c[_0xaa98('0x26')](_0xaa98('0x27'),_0x99d02f+'-'+_0x12cb17+'/'+_0x148532)[_0xaa98('0x22')](_0x252a4e);}return null;};}function patchUpdates(_0x1b311d){return function(_0x702bc7){try{jsonpatch[_0xaa98('0x28')](_0x702bc7,_0x1b311d,!![]);}catch(_0x49f76b){return BPromise[_0xaa98('0x29')](_0x49f76b);}return _0x702bc7['save']();};}function saveUpdates(_0x18e1f7,_0x18edf6){return function(_0x188cca){if(_0x188cca){return _0x188cca[_0xaa98('0x2a')](_0x18e1f7)[_0xaa98('0x2b')](function(_0x169e21){return _0x169e21;});}return null;};}function removeEntity(_0xa5446b,_0x50132d){return function(_0xe96d58){if(_0xe96d58){return _0xe96d58[_0xaa98('0x2c')]()[_0xaa98('0x2b')](function(){_0xa5446b[_0xaa98('0x20')](0xcc)[_0xaa98('0x21')]();});}};}function handleEntityNotFound(_0x3795b8,_0x4aa479){return function(_0x5970e3){if(!_0x5970e3){_0x3795b8['sendStatus'](0x194);}return _0x5970e3;};}function handleError(_0x5f3836,_0xb7d4a4){_0xb7d4a4=_0xb7d4a4||0x1f4;return function(_0x4335c4){logger['error'](_0x4335c4['stack']);if(_0x4335c4[_0xaa98('0x2d')]){delete _0x4335c4[_0xaa98('0x2d')];}_0x5f3836[_0xaa98('0x20')](_0xb7d4a4)[_0xaa98('0x2e')](_0x4335c4);};}exports['index']=function(_0x1e748c,_0x5f2bb3){var _0x4ccb9e={},_0x3d5b3a={},_0x47771c={'count':0x0,'rows':[]};var _0x1e2a9a=_[_0xaa98('0x2f')](db['ChatInternalMessage'][_0xaa98('0x30')],function(_0x437017){return{'name':_0x437017[_0xaa98('0x31')],'type':_0x437017[_0xaa98('0x32')][_0xaa98('0x33')]};});_0x3d5b3a['model']=_[_0xaa98('0x2f')](_0x1e2a9a,'name');_0x3d5b3a[_0xaa98('0x34')]=_[_0xaa98('0x35')](_0x1e748c[_0xaa98('0x34')]);_0x3d5b3a['filters']=_[_0xaa98('0x36')](_0x3d5b3a[_0xaa98('0x37')],_0x3d5b3a[_0xaa98('0x34')]);_0x4ccb9e[_0xaa98('0x38')]=_[_0xaa98('0x36')](_0x3d5b3a['model'],qs[_0xaa98('0x39')](_0x1e748c[_0xaa98('0x34')][_0xaa98('0x39')]));_0x4ccb9e[_0xaa98('0x38')]=_0x4ccb9e[_0xaa98('0x38')][_0xaa98('0x3a')]?_0x4ccb9e[_0xaa98('0x38')]:_0x3d5b3a[_0xaa98('0x37')];if(!_0x1e748c['query']['hasOwnProperty'](_0xaa98('0x3b'))){_0x4ccb9e[_0xaa98('0x23')]=qs[_0xaa98('0x23')](_0x1e748c[_0xaa98('0x34')]['limit']);_0x4ccb9e[_0xaa98('0x25')]=qs['offset'](_0x1e748c[_0xaa98('0x34')][_0xaa98('0x25')]);}_0x4ccb9e[_0xaa98('0x3c')]=qs[_0xaa98('0x3d')](_0x1e748c['query'][_0xaa98('0x3d')]);_0x4ccb9e[_0xaa98('0x3e')]=qs[_0xaa98('0x3f')](_['pick'](_0x1e748c[_0xaa98('0x34')],_0x3d5b3a[_0xaa98('0x3f')]),_0x1e2a9a);if(_0x1e748c[_0xaa98('0x34')]['filter']){_0x4ccb9e[_0xaa98('0x3e')]=_[_0xaa98('0x40')](_0x4ccb9e[_0xaa98('0x3e')],{'$or':_[_0xaa98('0x2f')](_0x1e2a9a,function(_0x9476f6){if(_0x9476f6['type']!==_0xaa98('0x41')){var _0x436e8c={};_0x436e8c[_0x9476f6[_0xaa98('0x2d')]]={'$like':'%'+_0x1e748c[_0xaa98('0x34')]['filter']+'%'};return _0x436e8c;}})});}_0x4ccb9e=_['merge']({},_0x4ccb9e,_0x1e748c['options']);var _0x53627a={'where':_0x4ccb9e[_0xaa98('0x3e')]};return db[_0xaa98('0x42')]['count'](_0x53627a)[_0xaa98('0x2b')](function(_0x355f4b){_0x47771c[_0xaa98('0x43')]=_0x355f4b;if(_0x1e748c['query'][_0xaa98('0x44')]){_0x4ccb9e[_0xaa98('0x45')]=[{'all':!![]}];}return db[_0xaa98('0x42')][_0xaa98('0x46')](_0x4ccb9e);})['then'](function(_0x3363b6){_0x47771c['rows']=_0x3363b6;return _0x47771c;})['then'](respondWithFilteredResult(_0x5f2bb3,_0x4ccb9e))['catch'](handleError(_0x5f2bb3,null));};exports['show']=function(_0x538c83,_0x197eaa){var _0x5d93fd={'raw':!![],'where':{'id':_0x538c83[_0xaa98('0x47')]['id']}},_0x3d112d={};_0x3d112d[_0xaa98('0x37')]=_[_0xaa98('0x35')](db[_0xaa98('0x42')][_0xaa98('0x30')]);_0x3d112d[_0xaa98('0x34')]=_[_0xaa98('0x35')](_0x538c83[_0xaa98('0x34')]);_0x3d112d[_0xaa98('0x3f')]=_[_0xaa98('0x36')](_0x3d112d[_0xaa98('0x37')],_0x3d112d[_0xaa98('0x34')]);_0x5d93fd[_0xaa98('0x38')]=_['intersection'](_0x3d112d[_0xaa98('0x37')],qs[_0xaa98('0x39')](_0x538c83[_0xaa98('0x34')]['fields']));_0x5d93fd[_0xaa98('0x38')]=_0x5d93fd[_0xaa98('0x38')]['length']?_0x5d93fd[_0xaa98('0x38')]:_0x3d112d[_0xaa98('0x37')];if(_0x538c83[_0xaa98('0x34')]['includeAll']){_0x5d93fd[_0xaa98('0x45')]=[{'all':!![]}];}_0x5d93fd=_[_0xaa98('0x40')]({},_0x5d93fd,_0x538c83[_0xaa98('0x48')]);return db['ChatInternalMessage'][_0xaa98('0x49')](_0x5d93fd)[_0xaa98('0x2b')](handleEntityNotFound(_0x197eaa,null))['then'](respondWithResult(_0x197eaa,null))[_0xaa98('0x4a')](handleError(_0x197eaa,null));};exports[_0xaa98('0x4b')]=function(_0x2bf1ce,_0x3bc077){return db['ChatInternalMessage'][_0xaa98('0x4b')](_0x2bf1ce[_0xaa98('0x4c')],{})[_0xaa98('0x2b')](respondWithResult(_0x3bc077,0xc9))[_0xaa98('0x4a')](handleError(_0x3bc077,null));};exports[_0xaa98('0x2a')]=function(_0x30e573,_0x13873b){if(_0x30e573[_0xaa98('0x4c')]['id']){delete _0x30e573[_0xaa98('0x4c')]['id'];}return db[_0xaa98('0x42')][_0xaa98('0x49')]({'where':{'id':_0x30e573['params']['id']}})[_0xaa98('0x2b')](handleEntityNotFound(_0x13873b,null))[_0xaa98('0x2b')](saveUpdates(_0x30e573[_0xaa98('0x4c')],null))['then'](respondWithResult(_0x13873b,null))[_0xaa98('0x4a')](handleError(_0x13873b,null));};exports['destroy']=function(_0x46d0cc,_0xab3390){return db[_0xaa98('0x42')][_0xaa98('0x49')]({'where':{'id':_0x46d0cc[_0xaa98('0x47')]['id']}})['then'](handleEntityNotFound(_0xab3390,null))[_0xaa98('0x2b')](removeEntity(_0xab3390,null))[_0xaa98('0x4a')](handleError(_0xab3390,null));};exports[_0xaa98('0x4d')]=function(_0x40857c,_0x34b6f8){return db[_0xaa98('0x42')][_0xaa98('0x4d')]()['then'](respondWithResult(_0x34b6f8,null))[_0xaa98('0x4a')](handleError(_0x34b6f8,null));};function wrapUser(_0x49183b){return function(_0x3c8189){var _0x2c2c25=_0x49183b[_0xaa98('0x4e')]({'plain':!![]});_0x2c2c25['messages']=[];if(_0x3c8189){_0x2c2c25['lastMessageAt']=_0x3c8189[_0xaa98('0x4f')];_0x2c2c25[_0xaa98('0x50')]=_0x3c8189;}else{_0x2c2c25['lastMessageAt']=moment(0x0)['format'](_0xaa98('0x51'));_0x2c2c25[_0xaa98('0x50')]={};}return _0x2c2c25;};}exports[_0xaa98('0x52')]=function(_0x2f8279,_0x3ba7cb,_0x3231ac){var _0x1e589c=[];return db[_0xaa98('0x53')][_0xaa98('0x46')]({'where':{'role':[_0xaa98('0x54'),_0xaa98('0x55'),_0xaa98('0x56')]},'attributes':['id',_0xaa98('0x57'),_0xaa98('0x2d'),'role',_0xaa98('0x58'),_0xaa98('0x59'),_0xaa98('0x5a'),_0xaa98('0x5b'),'allowmessenger','showWebBar'],'order':qs[_0xaa98('0x3d')](_0xaa98('0x5c')),'include':[{'model':db[_0xaa98('0x5d')],'as':_0xaa98('0x5e'),'attributes':['id',_0xaa98('0x2d'),'type'],'through':{'attributes':[]}}]})[_0xaa98('0x2b')](function(_0x3d90be){if(_0x3d90be){var _0x362b41=_0x2f8279['user'][_0xaa98('0x4e')]({'plain':!![]});if(!_0x362b41)throw new Error(_0xaa98('0x5f'));if(_0x362b41[_0xaa98('0x60')]===_0xaa98('0x56')){return db[_0xaa98('0x61')][_0xaa98('0x49')]({'where':{'name':'Agents','userProfileId':_0x362b41[_0xaa98('0x62')]},'raw':!![]})[_0xaa98('0x2b')](function(_0x4cbcc0){if(_0x4cbcc0){if(_0x4cbcc0['autoAssociation']===0x0){return db[_0xaa98('0x63')][_0xaa98('0x46')]({'where':{'sectionId':_0x4cbcc0['id']},'raw':!![]})['then'](function(_0x4a8df3){var _0x3a397a=[];if(_[_0xaa98('0x64')](_0x4a8df3)){_0x3a397a=_[_0xaa98('0x65')](_0x3d90be,function(_0x5c426e){if(_0x5c426e[_0xaa98('0x60')]!=='agent'){return _0x5c426e;}});return _0x3a397a;}else{for(var _0x4e12c8=0x0;_0x4e12c8<_0x3d90be[_0xaa98('0x3a')];_0x4e12c8++){var _0x1bc428=_0x3d90be[_0x4e12c8];if(_0x1bc428[_0xaa98('0x60')]==='agent'){var _0x5147ac=_['find'](_0x4a8df3,function(_0x4eca29){return _0x4eca29[_0xaa98('0x66')]===_0x1bc428['id'];});if(_0x5147ac)_0x3a397a['push'](_0x1bc428);}else{_0x3a397a[_0xaa98('0x67')](_0x1bc428);}}return _0x3a397a;}});}else{return _0x3d90be;}}else{var _0x3cb72d=_['filter'](_0x3d90be,function(_0x45393b){if(_0x45393b[_0xaa98('0x60')]!==_0xaa98('0x54')){return _0x45393b;}});return _0x3cb72d;}});}else{return _0x3d90be;}}})[_0xaa98('0x2b')](function(_0xc410f0){var _0x122b24=[];if(_0xc410f0){_0x1e589c=_0xc410f0;for(var _0x5e38a7=0x0;_0x5e38a7<_0xc410f0['length'];_0x5e38a7+=0x1){_0x1e589c[_0x5e38a7][_0xaa98('0x68')]=[];_0x122b24[_0xaa98('0x67')](db[_0xaa98('0x42')][_0xaa98('0x49')]({'where':{'FromId':[_0x2f8279[_0xaa98('0x56')]['id'],_0xc410f0[_0x5e38a7]['id']],'ToId':[_0x2f8279['user']['id'],_0xc410f0[_0x5e38a7]['id']],'ChatGroupId':null},'attributes':['id',_0xaa98('0x4f'),_0xaa98('0x69'),_0xaa98('0x6a'),_0xaa98('0x6b'),_0xaa98('0x4c')],'order':qs[_0xaa98('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xaa98('0x2b')](wrapUser(_0xc410f0[_0x5e38a7])));}return BPromise[_0xaa98('0x6c')](_0x122b24);}return[];})[_0xaa98('0x2b')](function(_0x3c70b9){return{'rows':_0x3c70b9,'count':_0x3c70b9['length']};})[_0xaa98('0x2b')](respondWithResult(_0x3ba7cb,null))[_0xaa98('0x4a')](handleError(_0x3ba7cb,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 61831ef..1e463f7 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 _0x41b5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x13945b,_0x289c94){var _0x1b1643=function(_0x18f4c3){while(--_0x18f4c3){_0x13945b['push'](_0x13945b['shift']());}};_0x1b1643(++_0x289c94);}(_0x41b5,0x124));var _0x541b=function(_0x2cc702,_0x378584){_0x2cc702=_0x2cc702-0x0;var _0x1f515e=_0x41b5[_0x2cc702];return _0x1f515e;};'use strict';var EventEmitter=require(_0x541b('0x0'));var ChatInternalMessage=require(_0x541b('0x1'))['db'][_0x541b('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x541b('0x3')](0x0);var events={'afterCreate':_0x541b('0x4'),'afterUpdate':_0x541b('0x5'),'afterDestroy':_0x541b('0x6')};function emitEvent(_0x409852){return function(_0x142a70,_0x269f35,_0x444e11){ChatInternalMessageEvents[_0x541b('0x7')](_0x409852+':'+_0x142a70['id'],_0x142a70);ChatInternalMessageEvents[_0x541b('0x7')](_0x409852,_0x142a70);_0x444e11(null);};}for(var e in events){if(events[_0x541b('0x8')](e)){var event=events[e];ChatInternalMessage[_0x541b('0x9')](e,emitEvent(event));}}module[_0x541b('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x623d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x623d,0x109));var _0xd623=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x623d[_0x297fd3];return _0x2af381;};'use strict';var EventEmitter=require(_0xd623('0x0'));var ChatInternalMessage=require(_0xd623('0x1'))['db'][_0xd623('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd623('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd623('0x4'),'afterDestroy':_0xd623('0x5')};function emitEvent(_0x42a6cd){return function(_0x3474cb,_0x468397,_0x233ff4){ChatInternalMessageEvents['emit'](_0x42a6cd+':'+_0x3474cb['id'],_0x3474cb);ChatInternalMessageEvents[_0xd623('0x6')](_0x42a6cd,_0x3474cb);_0x233ff4(null);};}for(var e in events){if(events[_0xd623('0x7')](e)){var event=events[e];ChatInternalMessage[_0xd623('0x8')](e,emitEvent(event));}}module[_0xd623('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 90fdda4..cbd4a00 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 _0xcccc=['moment','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x2df1ad,_0x2aaadf){var _0x5b16b4=function(_0x4a5289){while(--_0x4a5289){_0x2df1ad['push'](_0x2df1ad['shift']());}};_0x5b16b4(++_0x2aaadf);}(_0xcccc,0xf4));var _0xcccc=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0xcccc[_0x406696];return _0x10e35c;};'use strict';var _=require('lodash');var util=require(_0xcccc('0x0'));var logger=require(_0xcccc('0x1'))(_0xcccc('0x2'));var moment=require(_0xcccc('0x3'));var BPromise=require('bluebird');var rp=require(_0xcccc('0x4'));var fs=require('fs');var path=require(_0xcccc('0x5'));var rimraf=require('rimraf');var config=require(_0xcccc('0x6'));var attributes=require(_0xcccc('0x7'));module[_0xcccc('0x8')]=function(_0xd26c17,_0x36abf2){return _0xd26c17[_0xcccc('0x9')](_0xcccc('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcccc('0xb'),'collate':_0xcccc('0xc')});}; \ No newline at end of file +var _0xcc8e=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','exports','define','ChatInternalMessage','chat_internal_messages'];(function(_0x4b5187,_0x547048){var _0x4c164f=function(_0x4c666e){while(--_0x4c666e){_0x4b5187['push'](_0x4b5187['shift']());}};_0x4c164f(++_0x547048);}(_0xcc8e,0x16a));var _0xecc8=function(_0x1297e0,_0x1eb8de){_0x1297e0=_0x1297e0-0x0;var _0x12c8b3=_0xcc8e[_0x1297e0];return _0x12c8b3;};'use strict';var _=require(_0xecc8('0x0'));var util=require(_0xecc8('0x1'));var logger=require('../../config/logger')(_0xecc8('0x2'));var moment=require(_0xecc8('0x3'));var BPromise=require(_0xecc8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xecc8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0xecc8('0x6')]=function(_0x232b0a,_0x412231){return _0x232b0a[_0xecc8('0x7')](_0xecc8('0x8'),attributes,{'tableName':_0xecc8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xecc8('0xa'),'collate':_0xecc8('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 964c0cb..6c90e3e 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 _0x6f2a=['register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatInternalMessage.socket'];(function(_0x36266a,_0x3d4bf8){var _0x17a395=function(_0x2b0ef2){while(--_0x2b0ef2){_0x36266a['push'](_0x36266a['shift']());}};_0x17a395(++_0x3d4bf8);}(_0x6f2a,0x1e0));var _0xa6f2=function(_0x532a60,_0x247971){_0x532a60=_0x532a60-0x0;var _0x42dcb5=_0x6f2a[_0x532a60];return _0x42dcb5;};'use strict';var _=require(_0xa6f2('0x0'));var util=require('util');var moment=require(_0xa6f2('0x1'));var BPromise=require(_0xa6f2('0x2'));var rs=require(_0xa6f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa6f2('0x4'));var logger=require(_0xa6f2('0x5'))(_0xa6f2('0x6'));var config=require(_0xa6f2('0x7'));var jayson=require(_0xa6f2('0x8'));var client=jayson[_0xa6f2('0x9')][_0xa6f2('0xa')]({'port':0x232a});config[_0xa6f2('0xb')]=_[_0xa6f2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa6f2('0xb')]));require(_0xa6f2('0xd'))[_0xa6f2('0xe')](socket);function respondWithRpcPromise(_0x1fcff0,_0x327050,_0x867227){return new BPromise(function(_0x39680c,_0x5c5599){return client[_0xa6f2('0xf')](_0x1fcff0,_0x867227)[_0xa6f2('0x10')](function(_0xd0b0de){logger[_0xa6f2('0x11')](_0xa6f2('0x12'),_0x327050,_0xa6f2('0x13'));logger['debug'](_0xa6f2('0x14'),_0x327050,'request\x20sent',JSON['stringify'](_0xd0b0de));if(_0xd0b0de['error']){if(_0xd0b0de[_0xa6f2('0x15')][_0xa6f2('0x16')]===0x1f4){logger[_0xa6f2('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x327050,_0xd0b0de[_0xa6f2('0x15')][_0xa6f2('0x17')]);return _0x5c5599(_0xd0b0de[_0xa6f2('0x15')]['message']);}logger[_0xa6f2('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x327050,_0xd0b0de[_0xa6f2('0x15')][_0xa6f2('0x17')]);return _0x39680c(_0xd0b0de['error'][_0xa6f2('0x17')]);}else{logger['info'](_0xa6f2('0x12'),_0x327050,_0xa6f2('0x13'));_0x39680c(_0xd0b0de[_0xa6f2('0x18')][_0xa6f2('0x17')]);}})[_0xa6f2('0x19')](function(_0x219693){logger[_0xa6f2('0x15')](_0xa6f2('0x12'),_0x327050,_0x219693);_0x5c5599(_0x219693);});});} \ No newline at end of file +var _0x4891=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent'];(function(_0x11af2b,_0x41538f){var _0x4a0e43=function(_0x4ae1df){while(--_0x4ae1df){_0x11af2b['push'](_0x11af2b['shift']());}};_0x4a0e43(++_0x41538f);}(_0x4891,0x166));var _0x1489=function(_0x1bbef9,_0x27aafc){_0x1bbef9=_0x1bbef9-0x0;var _0x23c45c=_0x4891[_0x1bbef9];return _0x23c45c;};'use strict';var _=require(_0x1489('0x0'));var util=require(_0x1489('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1489('0x2'));var db=require(_0x1489('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1489('0x4'))('rpc');var config=require(_0x1489('0x5'));var jayson=require(_0x1489('0x6'));var client=jayson[_0x1489('0x7')]['http']({'port':0x232a});config[_0x1489('0x8')]=_['defaults'](config[_0x1489('0x8')],{'host':_0x1489('0x9'),'port':0x18eb});var socket=require(_0x1489('0xa'))(new Redis(config[_0x1489('0x8')]));require(_0x1489('0xb'))[_0x1489('0xc')](socket);function respondWithRpcPromise(_0x109fea,_0x48805c,_0x550283){return new BPromise(function(_0x243644,_0x423118){return client[_0x1489('0xd')](_0x109fea,_0x550283)[_0x1489('0xe')](function(_0x321df5){logger[_0x1489('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x1489('0x10'));logger['debug'](_0x1489('0x11'),_0x48805c,_0x1489('0x10'),JSON[_0x1489('0x12')](_0x321df5));if(_0x321df5[_0x1489('0x13')]){if(_0x321df5[_0x1489('0x13')][_0x1489('0x14')]===0x1f4){logger[_0x1489('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x321df5['error'][_0x1489('0x15')]);return _0x423118(_0x321df5['error'][_0x1489('0x15')]);}logger[_0x1489('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x321df5[_0x1489('0x13')][_0x1489('0x15')]);return _0x243644(_0x321df5[_0x1489('0x13')][_0x1489('0x15')]);}else{logger[_0x1489('0xf')](_0x1489('0x16'),_0x48805c,'request\x20sent');_0x243644(_0x321df5[_0x1489('0x17')][_0x1489('0x15')]);}})[_0x1489('0x18')](function(_0x597b4f){logger[_0x1489('0x13')](_0x1489('0x16'),_0x48805c,_0x597b4f);_0x423118(_0x597b4f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7c5ac60..83eff4d 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 _0x7e6d=['chatInternalMessage:','./chatInternalMessage.events','save','remove','emit','removeListener','length'];(function(_0x1e8a46,_0x56bd89){var _0x1aff64=function(_0x323845){while(--_0x323845){_0x1e8a46['push'](_0x1e8a46['shift']());}};_0x1aff64(++_0x56bd89);}(_0x7e6d,0x94));var _0xd7e6=function(_0x39ef10,_0x2ac239){_0x39ef10=_0x39ef10-0x0;var _0x340a98=_0x7e6d[_0x39ef10];return _0x340a98;};'use strict';var ChatInternalMessageEvents=require(_0xd7e6('0x0'));var events=[_0xd7e6('0x1'),_0xd7e6('0x2'),'update'];function createListener(_0x11bbc2,_0x231504){return function(_0x17049d){_0x231504[_0xd7e6('0x3')](_0x11bbc2,_0x17049d);};}function removeListener(_0x59d56b,_0x5a4a39){return function(){ChatInternalMessageEvents[_0xd7e6('0x4')](_0x59d56b,_0x5a4a39);};}exports['register']=function(_0x57ef5c){for(var _0x55db22=0x0,_0xcbd025=events[_0xd7e6('0x5')];_0x55db22<_0xcbd025;_0x55db22++){var _0x482189=events[_0x55db22];var _0x1d2ab5=createListener(_0xd7e6('0x6')+_0x482189,_0x57ef5c);ChatInternalMessageEvents['on'](_0x482189,_0x1d2ab5);}}; \ No newline at end of file +var _0x54dc=['remove','update','removeListener','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x54dc,0x16c));var _0xc54d=function(_0x42b707,_0x22e9c4){_0x42b707=_0x42b707-0x0;var _0x343135=_0x54dc[_0x42b707];return _0x343135;};'use strict';var ChatInternalMessageEvents=require(_0xc54d('0x0'));var events=[_0xc54d('0x1'),_0xc54d('0x2'),_0xc54d('0x3')];function createListener(_0x1eea9a,_0x31ae87){return function(_0x4e7712){_0x31ae87['emit'](_0x1eea9a,_0x4e7712);};}function removeListener(_0x182edd,_0x314d1e){return function(){ChatInternalMessageEvents[_0xc54d('0x4')](_0x182edd,_0x314d1e);};}exports['register']=function(_0x115c51){for(var _0x1ba142=0x0,_0x399a1c=events['length'];_0x1ba142<_0x399a1c;_0x1ba142++){var _0x36d332=events[_0x1ba142];var _0x4189a8=createListener(_0xc54d('0x5')+_0x36d332,_0x115c51);ChatInternalMessageEvents['on'](_0x36d332,_0x4189a8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index bc9ee1c..e9f1754 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 _0x0aa0=['put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/users','getUsers','/:id','show','post','create'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0x0aa0,0x179));var _0x00aa=function(_0x4ad0c4,_0x255b72){_0x4ad0c4=_0x4ad0c4-0x0;var _0x12326c=_0x0aa0[_0x4ad0c4];return _0x12326c;};'use strict';var multer=require(_0x00aa('0x0'));var util=require('util');var path=require(_0x00aa('0x1'));var timeout=require(_0x00aa('0x2'));var express=require(_0x00aa('0x3'));var router=express[_0x00aa('0x4')]();var fs_extra=require(_0x00aa('0x5'));var auth=require(_0x00aa('0x6'));var interaction=require(_0x00aa('0x7'));var config=require(_0x00aa('0x8'));var controller=require('./chatInternalMessage.controller');router[_0x00aa('0x9')]('/',auth[_0x00aa('0xa')](),controller['index']);router[_0x00aa('0x9')](_0x00aa('0xb'),auth[_0x00aa('0xa')](),controller[_0x00aa('0xc')]);router['get'](_0x00aa('0xd'),auth[_0x00aa('0xa')](),controller[_0x00aa('0xe')]);router['get'](_0x00aa('0xf'),auth[_0x00aa('0xa')](),controller[_0x00aa('0x10')]);router[_0x00aa('0x11')]('/',auth['isAuthenticated'](),controller[_0x00aa('0x12')]);router[_0x00aa('0x13')](_0x00aa('0xf'),controller[_0x00aa('0x14')]);router['delete'](_0x00aa('0xf'),auth['isAuthenticated'](),controller[_0x00aa('0x15')]);module['exports']=router; \ No newline at end of file +var _0x88f2=['index','/describe','describe','/users','getUsers','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x88f2,0xd5));var _0x288f=function(_0x56ef39,_0x37ecee){_0x56ef39=_0x56ef39-0x0;var _0x2477e6=_0x88f2[_0x56ef39];return _0x2477e6;};'use strict';var multer=require(_0x288f('0x0'));var util=require(_0x288f('0x1'));var path=require(_0x288f('0x2'));var timeout=require(_0x288f('0x3'));var express=require(_0x288f('0x4'));var router=express[_0x288f('0x5')]();var fs_extra=require(_0x288f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x288f('0x7'));var config=require(_0x288f('0x8'));var controller=require(_0x288f('0x9'));router[_0x288f('0xa')]('/',auth[_0x288f('0xb')](),controller[_0x288f('0xc')]);router[_0x288f('0xa')](_0x288f('0xd'),auth[_0x288f('0xb')](),controller[_0x288f('0xe')]);router[_0x288f('0xa')](_0x288f('0xf'),auth[_0x288f('0xb')](),controller[_0x288f('0x10')]);router[_0x288f('0xa')]('/:id',auth[_0x288f('0xb')](),controller['show']);router[_0x288f('0x11')]('/',auth[_0x288f('0xb')](),controller[_0x288f('0x12')]);router[_0x288f('0x13')](_0x288f('0x14'),controller[_0x288f('0x15')]);router[_0x288f('0x16')](_0x288f('0x14'),auth[_0x288f('0xb')](),controller[_0x288f('0x17')]);module[_0x288f('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e2c935c..9481f52 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 _0x0b70=['ENUM','out','STRING','exports','medium','BOOLEAN'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x0b70,0x159));var _0x00b7=function(_0x4f722d,_0x54dfd6){_0x4f722d=_0x4f722d-0x0;var _0x434171=_0x0b70[_0x4f722d];return _0x434171;};'use strict';var Sequelize=require('sequelize');module[_0x00b7('0x0')]={'body':{'type':Sequelize['TEXT'](_0x00b7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x00b7('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x00b7('0x3')]('in',_0x00b7('0x4')),'defaultValue':_0x00b7('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x00b7('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3f72=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0xc34616,_0x487250){var _0x1221ba=function(_0x531a90){while(--_0x531a90){_0xc34616['push'](_0xc34616['shift']());}};_0x1221ba(++_0x487250);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x23f7('0x0'));module[_0x23f7('0x1')]={'body':{'type':Sequelize[_0x23f7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x23f7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x23f7('0x4')]('in',_0x23f7('0x5')),'defaultValue':_0x23f7('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x23f7('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x23f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index ecd1884..06b6842 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 _0xee89=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatMessage','includeAll','rows','show','params','include','find','create','body','describe','chat-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','isNil','interaction','get','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','User','agent','fullname','internal','manual','SIP/%s','channel','EventManager','acceptmessage','parse','chat','role','null','RejectMessage','rejectMessage','sequelize','contact','email','interface','motionChannel','event','rejectmessage','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0xee89,0x7c));var _0x9ee8=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xee89[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x9ee8('0x0'));var rimraf=require(_0x9ee8('0x1'));var zipdir=require(_0x9ee8('0x2'));var jsonpatch=require(_0x9ee8('0x3'));var rp=require(_0x9ee8('0x4'));var moment=require(_0x9ee8('0x5'));var BPromise=require(_0x9ee8('0x6'));var Mustache=require(_0x9ee8('0x7'));var util=require(_0x9ee8('0x8'));var path=require(_0x9ee8('0x9'));var sox=require('sox');var csv=require(_0x9ee8('0xa'));var ejs=require(_0x9ee8('0xb'));var fs=require('fs');var fs_extra=require(_0x9ee8('0xc'));var _=require(_0x9ee8('0xd'));var squel=require(_0x9ee8('0xe'));var crypto=require(_0x9ee8('0xf'));var jsforce=require(_0x9ee8('0x10'));var deskjs=require(_0x9ee8('0x11'));var toCsv=require(_0x9ee8('0xa'));var querystring=require(_0x9ee8('0x12'));var Papa=require(_0x9ee8('0x13'));var Redis=require(_0x9ee8('0x14'));var authService=require(_0x9ee8('0x15'));var qs=require(_0x9ee8('0x16'));var as=require(_0x9ee8('0x17'));var hardwareService=require(_0x9ee8('0x18'));var logger=require(_0x9ee8('0x19'))('api');var utils=require(_0x9ee8('0x1a'));var config=require(_0x9ee8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ee8('0x1c'))['db'];config[_0x9ee8('0x1d')]=_[_0x9ee8('0x1e')](config[_0x9ee8('0x1d')],{'host':_0x9ee8('0x1f'),'port':0x18eb});var socket=require(_0x9ee8('0x20'))(new Redis(config['redis']));require(_0x9ee8('0x21'))[_0x9ee8('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9ee8('0x23')][_0x9ee8('0x24')]({'port':0x232c});var client9002=jayson[_0x9ee8('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4342,_0x312212,_0x41fad6,_0x5a8223){return new BPromise(function(_0x5f1f73,_0x1c9003){var _0x1196a5=_0x5a8223||client;return _0x1196a5['request'](_0x4d4342,_0x41fad6)[_0x9ee8('0x25')](function(_0x4ebc82){logger[_0x9ee8('0x26')](_0x9ee8('0x27'),_0x312212,_0x9ee8('0x28'));logger[_0x9ee8('0x29')](_0x9ee8('0x2a'),_0x312212,_0x9ee8('0x28'),JSON[_0x9ee8('0x2b')](_0x4ebc82));if(_0x4ebc82[_0x9ee8('0x2c')]){if(_0x4ebc82[_0x9ee8('0x2c')][_0x9ee8('0x2d')]===0x1f4){logger[_0x9ee8('0x2c')](_0x9ee8('0x27'),_0x312212,_0x4ebc82['error']['message']);return _0x1c9003(_0x4ebc82['error'][_0x9ee8('0x2e')]);}logger[_0x9ee8('0x2c')](_0x9ee8('0x27'),_0x312212,_0x4ebc82['error'][_0x9ee8('0x2e')]);return _0x5f1f73(_0x4ebc82[_0x9ee8('0x2c')][_0x9ee8('0x2e')]);}else{logger['info'](_0x9ee8('0x27'),_0x312212,_0x9ee8('0x28'));_0x5f1f73(_0x4ebc82[_0x9ee8('0x2f')][_0x9ee8('0x2e')]);}})[_0x9ee8('0x30')](function(_0x3460da){logger[_0x9ee8('0x2c')](_0x9ee8('0x27'),_0x312212,_0x3460da);_0x1c9003(_0x3460da);});});}function respondWithStatusCode(_0x588f12,_0x2cab0e){_0x2cab0e=_0x2cab0e||0xcc;return function(_0x483aa7){if(_0x483aa7){return _0x588f12[_0x9ee8('0x31')](_0x2cab0e);}return _0x588f12['status'](_0x2cab0e)['end']();};}function respondWithResult(_0x135310,_0x21d226){_0x21d226=_0x21d226||0xc8;return function(_0x38d046){if(_0x38d046){return _0x135310[_0x9ee8('0x32')](_0x21d226)['json'](_0x38d046);}};}function respondWithFilteredResult(_0xc420e2,_0x42bb14){return function(_0x376b86){if(_0x376b86){var _0x31afbe=typeof _0x42bb14['offset']===_0x9ee8('0x33')&&typeof _0x42bb14['limit']===_0x9ee8('0x33');var _0x572f36=_0x376b86[_0x9ee8('0x34')];var _0x52ffca=_0x31afbe?0x0:_0x42bb14[_0x9ee8('0x35')];var _0x4911a5=_0x31afbe?_0x376b86[_0x9ee8('0x34')]:_0x42bb14[_0x9ee8('0x35')]+_0x42bb14[_0x9ee8('0x36')];var _0x45c9ec;if(_0x4911a5>=_0x572f36){_0x4911a5=_0x572f36;_0x45c9ec=0xc8;}else{_0x45c9ec=0xce;}_0xc420e2[_0x9ee8('0x32')](_0x45c9ec);return _0xc420e2[_0x9ee8('0x37')]('Content-Range',_0x52ffca+'-'+_0x4911a5+'/'+_0x572f36)[_0x9ee8('0x38')](_0x376b86);}return null;};}function patchUpdates(_0x20d7fd){return function(_0x1caa2c){try{jsonpatch[_0x9ee8('0x39')](_0x1caa2c,_0x20d7fd,!![]);}catch(_0x25fe10){return BPromise[_0x9ee8('0x3a')](_0x25fe10);}return _0x1caa2c[_0x9ee8('0x3b')]();};}function saveUpdates(_0x1ee6a8,_0xe1eaa3){return function(_0x45fcef){if(_0x45fcef){return _0x45fcef[_0x9ee8('0x3c')](_0x1ee6a8)['then'](function(_0x342e83){return _0x342e83;});}return null;};}function removeEntity(_0x145c27,_0x52184c){return function(_0x2afa9f){if(_0x2afa9f){return _0x2afa9f[_0x9ee8('0x3d')]()[_0x9ee8('0x25')](function(){_0x145c27['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x80084e,_0x1f8ee4){return function(_0x2f3c51){if(!_0x2f3c51){_0x80084e[_0x9ee8('0x31')](0x194);}return _0x2f3c51;};}function handleError(_0x2b4626,_0x4ef0c7){_0x4ef0c7=_0x4ef0c7||0x1f4;return function(_0x491e3c){logger[_0x9ee8('0x2c')](_0x491e3c[_0x9ee8('0x3e')]);if(_0x491e3c[_0x9ee8('0x3f')]){delete _0x491e3c[_0x9ee8('0x3f')];}_0x2b4626[_0x9ee8('0x32')](_0x4ef0c7)[_0x9ee8('0x40')](_0x491e3c);};}exports[_0x9ee8('0x41')]=function(_0x199b8e,_0x5a6848){var _0x324c10={},_0x346dd7={},_0x5cc1dd={'count':0x0,'rows':[]};var _0x386570=_['map'](db['ChatMessage'][_0x9ee8('0x42')],function(_0x17151e){return{'name':_0x17151e[_0x9ee8('0x43')],'type':_0x17151e[_0x9ee8('0x44')]['key']};});_0x346dd7['model']=_[_0x9ee8('0x45')](_0x386570,_0x9ee8('0x3f'));_0x346dd7[_0x9ee8('0x46')]=_[_0x9ee8('0x47')](_0x199b8e['query']);_0x346dd7[_0x9ee8('0x48')]=_[_0x9ee8('0x49')](_0x346dd7[_0x9ee8('0x4a')],_0x346dd7[_0x9ee8('0x46')]);_0x324c10[_0x9ee8('0x4b')]=_['intersection'](_0x346dd7[_0x9ee8('0x4a')],qs['fields'](_0x199b8e[_0x9ee8('0x46')][_0x9ee8('0x4c')]));_0x324c10[_0x9ee8('0x4b')]=_0x324c10[_0x9ee8('0x4b')][_0x9ee8('0x4d')]?_0x324c10['attributes']:_0x346dd7[_0x9ee8('0x4a')];if(!_0x199b8e[_0x9ee8('0x46')][_0x9ee8('0x4e')](_0x9ee8('0x4f'))){_0x324c10[_0x9ee8('0x36')]=qs[_0x9ee8('0x36')](_0x199b8e[_0x9ee8('0x46')][_0x9ee8('0x36')]);_0x324c10['offset']=qs[_0x9ee8('0x35')](_0x199b8e[_0x9ee8('0x46')][_0x9ee8('0x35')]);}_0x324c10[_0x9ee8('0x50')]=qs[_0x9ee8('0x51')](_0x199b8e['query'][_0x9ee8('0x51')]);_0x324c10[_0x9ee8('0x52')]=qs[_0x9ee8('0x48')](_['pick'](_0x199b8e[_0x9ee8('0x46')],_0x346dd7['filters']),_0x386570);if(_0x199b8e[_0x9ee8('0x46')][_0x9ee8('0x53')]){_0x324c10[_0x9ee8('0x52')]=_[_0x9ee8('0x54')](_0x324c10['where'],{'$or':_[_0x9ee8('0x45')](_0x386570,function(_0x212819){if(_0x212819[_0x9ee8('0x44')]!==_0x9ee8('0x55')){var _0x3d5bdf={};_0x3d5bdf[_0x212819[_0x9ee8('0x3f')]]={'$like':'%'+_0x199b8e[_0x9ee8('0x46')][_0x9ee8('0x53')]+'%'};return _0x3d5bdf;}})});}_0x324c10=_[_0x9ee8('0x54')]({},_0x324c10,_0x199b8e[_0x9ee8('0x56')]);var _0x51b64e={'where':_0x324c10['where']};return db[_0x9ee8('0x57')][_0x9ee8('0x34')](_0x51b64e)[_0x9ee8('0x25')](function(_0x2d33e6){_0x5cc1dd['count']=_0x2d33e6;if(_0x199b8e['query'][_0x9ee8('0x58')]){_0x324c10['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x324c10);})['then'](function(_0x1f194b){_0x5cc1dd[_0x9ee8('0x59')]=_0x1f194b;return _0x5cc1dd;})[_0x9ee8('0x25')](respondWithFilteredResult(_0x5a6848,_0x324c10))[_0x9ee8('0x30')](handleError(_0x5a6848,null));};exports[_0x9ee8('0x5a')]=function(_0xf56abd,_0x1996bc){var _0x16462c={'raw':!![],'where':{'id':_0xf56abd[_0x9ee8('0x5b')]['id']}},_0x318f77={};_0x318f77[_0x9ee8('0x4a')]=_[_0x9ee8('0x47')](db[_0x9ee8('0x57')][_0x9ee8('0x42')]);_0x318f77['query']=_[_0x9ee8('0x47')](_0xf56abd['query']);_0x318f77[_0x9ee8('0x48')]=_[_0x9ee8('0x49')](_0x318f77['model'],_0x318f77['query']);_0x16462c[_0x9ee8('0x4b')]=_[_0x9ee8('0x49')](_0x318f77['model'],qs[_0x9ee8('0x4c')](_0xf56abd['query']['fields']));_0x16462c[_0x9ee8('0x4b')]=_0x16462c[_0x9ee8('0x4b')][_0x9ee8('0x4d')]?_0x16462c['attributes']:_0x318f77['model'];if(_0xf56abd['query'][_0x9ee8('0x58')]){_0x16462c[_0x9ee8('0x5c')]=[{'all':!![]}];}_0x16462c=_['merge']({},_0x16462c,_0xf56abd[_0x9ee8('0x56')]);return db[_0x9ee8('0x57')][_0x9ee8('0x5d')](_0x16462c)[_0x9ee8('0x25')](handleEntityNotFound(_0x1996bc,null))['then'](respondWithResult(_0x1996bc,null))[_0x9ee8('0x30')](handleError(_0x1996bc,null));};exports[_0x9ee8('0x5e')]=function(_0x29b8cc,_0x1fdc58){return db[_0x9ee8('0x57')][_0x9ee8('0x5e')](_0x29b8cc[_0x9ee8('0x5f')],{})[_0x9ee8('0x25')](respondWithResult(_0x1fdc58,0xc9))['catch'](handleError(_0x1fdc58,null));};exports[_0x9ee8('0x3c')]=function(_0x57089f,_0x5728a6){if(_0x57089f[_0x9ee8('0x5f')]['id']){delete _0x57089f[_0x9ee8('0x5f')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x57089f[_0x9ee8('0x5b')]['id']}})[_0x9ee8('0x25')](handleEntityNotFound(_0x5728a6,null))['then'](saveUpdates(_0x57089f[_0x9ee8('0x5f')],null))[_0x9ee8('0x25')](respondWithResult(_0x5728a6,null))['catch'](handleError(_0x5728a6,null));};exports['destroy']=function(_0x5061b4,_0x52ef0c){return db['ChatMessage'][_0x9ee8('0x5d')]({'where':{'id':_0x5061b4[_0x9ee8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52ef0c,null))[_0x9ee8('0x25')](removeEntity(_0x52ef0c,null))[_0x9ee8('0x30')](handleError(_0x52ef0c,null));};exports[_0x9ee8('0x60')]=function(_0x4bbc78,_0x1ba2cc){return db[_0x9ee8('0x57')][_0x9ee8('0x60')]()[_0x9ee8('0x25')](respondWithResult(_0x1ba2cc,null))['catch'](handleError(_0x1ba2cc,null));};var interaction_log=require(_0x9ee8('0x19'))(_0x9ee8('0x61'));exports[_0x9ee8('0x62')]=function(_0x126765,_0x2112bb,_0x320d86){var _0x2534c0={'agent':{},'channel':'chat'};if(_0x126765[_0x9ee8('0x5f')]['id']){delete _0x126765[_0x9ee8('0x5f')]['id'];}_0x126765[_0x9ee8('0x5f')]['read']=!![];_0x126765[_0x9ee8('0x5f')][_0x9ee8('0x63')]=moment()[_0x9ee8('0x64')](_0x9ee8('0x65'));_0x126765[_0x9ee8('0x5f')]['UserId']=_0x126765['body'][_0x9ee8('0x66')]||_0x126765[_0x9ee8('0x67')]['id'];_0x2534c0['agent']['id']=_0x126765['body']['UserId'];return db[_0x9ee8('0x57')][_0x9ee8('0x5d')]({'where':{'id':_0x126765[_0x9ee8('0x5b')]['id'],'UserId':null}})[_0x9ee8('0x25')](handleEntityNotFound(_0x2112bb,null))[_0x9ee8('0x25')](saveUpdates(_0x126765[_0x9ee8('0x5f')],null))[_0x9ee8('0x25')](function(_0x30a45d){if(_0x30a45d){_0x2534c0[_0x9ee8('0x2e')]=_0x30a45d['get']({'plain':!![]});return db[_0x9ee8('0x68')][_0x9ee8('0x5d')]({'where':{'id':_0x30a45d[_0x9ee8('0x69')]}});}return null;})[_0x9ee8('0x25')](handleEntityNotFound(_0x2112bb,null))[_0x9ee8('0x25')](function(_0x276bb0){if(_0x276bb0){return _0x276bb0['update']({'UserId':_0x126765['body'][_0x9ee8('0x66')],'read1stAt':_[_0x9ee8('0x6a')](_0x276bb0['read1stAt'])?moment()[_0x9ee8('0x64')](_0x9ee8('0x65')):undefined});}return null;})[_0x9ee8('0x25')](function(_0x599054){if(_0x599054){_0x2534c0[_0x9ee8('0x6b')]=_0x599054[_0x9ee8('0x6c')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x126765[_0x9ee8('0x67')]['id'],_0x126765[_0x9ee8('0x67')][_0x9ee8('0x3f')],_0x126765[_0x9ee8('0x67')]['role'],_0x2534c0['interaction']['id'],_0x126765[_0x9ee8('0x5f')]?JSON[_0x9ee8('0x2b')](_0x126765['body']):'null');return respondWithRpcPromise(_0x9ee8('0x6d'),_0x9ee8('0x6e'),_0x2534c0);}return null;})[_0x9ee8('0x25')](function(_0x5acb32){var _0x6acfbb=_0x9ee8('0x6f')+_0x5acb32[_0x9ee8('0x2e')][_0x9ee8('0x70')];return db['sequelize']['query'](_0x6acfbb,{'type':db['Sequelize'][_0x9ee8('0x71')][_0x9ee8('0x72')],'raw':!![]})[_0x9ee8('0x25')](function(_0x27a183){return _0x27a183;});})[_0x9ee8('0x25')](function(_0x85ac89){if(_0x85ac89){_0x2534c0[_0x9ee8('0x2e')]['contact']=_0x85ac89[0x0];if(!_0x126765[_0x9ee8('0x5f')][_0x9ee8('0x66')])return;return db[_0x9ee8('0x73')][_0x9ee8('0x5d')]({'where':{'id':_0x126765[_0x9ee8('0x5f')]['UserId'],'role':_0x9ee8('0x74')},'attributes':['id',_0x9ee8('0x3f'),_0x9ee8('0x75'),'email',_0x9ee8('0x76')],'raw':!![]});}return null;})[_0x9ee8('0x25')](function(_0x1ebd1f){if(!_0x1ebd1f)return null;_0x2534c0[_0x9ee8('0x2e')][_0x9ee8('0x74')]=_0x1ebd1f;return _0x2534c0;})[_0x9ee8('0x25')](function(_0x2ed1a3){if(_0x2ed1a3){if(_0x126765[_0x9ee8('0x5f')][_0x9ee8('0x77')]){_0x2534c0[_0x9ee8('0x2e')]['interface']=util[_0x9ee8('0x64')](_0x9ee8('0x78'),_0x126765[_0x9ee8('0x67')][_0x9ee8('0x3f')]);_0x2534c0['message']['channel']=_0x2534c0[_0x9ee8('0x79')];_0x2534c0['message']['motionChannel']=_0x2534c0[_0x9ee8('0x79')];_0x2534c0['message']['event']=_0x9ee8('0x62');return respondWithRpcPromise(_0x9ee8('0x7a'),_0x9ee8('0x7a'),{'event':_0x9ee8('0x7b'),'message':_[_0x9ee8('0x54')](_0x2534c0[_0x9ee8('0x2e')],JSON[_0x9ee8('0x7c')](_0x2534c0[_0x9ee8('0x6b')]['formData']))},client9002)['then'](function(){return _0x2534c0;});}return _0x2534c0;}return null;})[_0x9ee8('0x25')](respondWithResult(_0x2112bb,null))[_0x9ee8('0x30')](handleError(_0x2112bb,null));};var interaction_log=require(_0x9ee8('0x19'))(_0x9ee8('0x61'));exports['reject']=function(_0x2c9173,_0x398f67,_0x2b3777){var _0x315eac={'agent':{},'channel':_0x9ee8('0x7d')};if(_0x2c9173[_0x9ee8('0x5f')]['id']){delete _0x2c9173[_0x9ee8('0x5f')]['id'];}_0x2c9173[_0x9ee8('0x5f')][_0x9ee8('0x66')]=_0x2c9173[_0x9ee8('0x5f')]['UserId']||_0x2c9173['user']['id'];_0x315eac[_0x9ee8('0x74')]['id']=_0x2c9173[_0x9ee8('0x5f')][_0x9ee8('0x66')];return db[_0x9ee8('0x57')][_0x9ee8('0x5d')]({'where':{'id':_0x2c9173[_0x9ee8('0x5b')]['id'],'UserId':null}})[_0x9ee8('0x25')](handleEntityNotFound(_0x398f67,null))[_0x9ee8('0x25')](function(_0x3fef07){if(_0x3fef07){_0x315eac[_0x9ee8('0x2e')]=_0x3fef07['get']({'plain':!![]});return db[_0x9ee8('0x68')][_0x9ee8('0x5d')]({'where':{'id':_0x3fef07[_0x9ee8('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x398f67,null))[_0x9ee8('0x25')](function(_0x439659){if(_0x439659){_0x315eac[_0x9ee8('0x6b')]=_0x439659[_0x9ee8('0x6c')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c9173[_0x9ee8('0x67')]['id'],_0x2c9173[_0x9ee8('0x67')]['name'],_0x2c9173[_0x9ee8('0x67')][_0x9ee8('0x7e')],_0x315eac[_0x9ee8('0x6b')]['id'],_0x2c9173[_0x9ee8('0x5f')]?JSON['stringify'](_0x2c9173[_0x9ee8('0x5f')]):_0x9ee8('0x7f'));return respondWithRpcPromise(_0x9ee8('0x80'),_0x9ee8('0x81'),_0x315eac);}return null;})['then'](function(_0x13608c){var _0x2b93b7=_0x9ee8('0x6f')+_0x13608c['message']['ContactId'];return db[_0x9ee8('0x82')][_0x9ee8('0x46')](_0x2b93b7,{'type':db['Sequelize'][_0x9ee8('0x71')][_0x9ee8('0x72')],'raw':!![]})[_0x9ee8('0x25')](function(_0x2861b5){return _0x2861b5;});})[_0x9ee8('0x25')](function(_0x5de87b){if(_0x5de87b){_0x315eac[_0x9ee8('0x2e')][_0x9ee8('0x83')]=_0x5de87b[0x0];if(!_0x2c9173['body']['UserId'])return;return db[_0x9ee8('0x73')]['find']({'where':{'id':_0x2c9173[_0x9ee8('0x5f')][_0x9ee8('0x66')],'role':_0x9ee8('0x74')},'attributes':['id',_0x9ee8('0x3f'),_0x9ee8('0x75'),_0x9ee8('0x84'),_0x9ee8('0x76')],'raw':!![]});}return null;})[_0x9ee8('0x25')](function(_0x43be9d){if(!_0x43be9d)return null;_0x315eac[_0x9ee8('0x2e')][_0x9ee8('0x74')]=_0x43be9d;return _0x315eac;})[_0x9ee8('0x25')](function(_0x1b2c4f){if(_0x1b2c4f){_0x1b2c4f[_0x9ee8('0x2e')][_0x9ee8('0x85')]=util[_0x9ee8('0x64')](_0x9ee8('0x78'),_0x2c9173[_0x9ee8('0x67')][_0x9ee8('0x3f')]);_0x1b2c4f[_0x9ee8('0x2e')][_0x9ee8('0x79')]=_0x315eac[_0x9ee8('0x79')];_0x1b2c4f[_0x9ee8('0x2e')][_0x9ee8('0x86')]=_0x315eac[_0x9ee8('0x79')];_0x1b2c4f[_0x9ee8('0x2e')][_0x9ee8('0x87')]=_0x9ee8('0x3a');respondWithRpcPromise(_0x9ee8('0x7a'),_0x9ee8('0x7a'),{'event':_0x9ee8('0x88'),'message':_[_0x9ee8('0x54')](_0x315eac[_0x9ee8('0x2e')],JSON['parse'](_0x315eac['interaction'][_0x9ee8('0x89')]))},client9002);return _0x315eac;}return null;})[_0x9ee8('0x25')](respondWithResult(_0x398f67,null))[_0x9ee8('0x30')](handleError(_0x398f67,null));}; \ No newline at end of file +var _0x1e42=['QueryTypes','contact','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatMessage.socket','register','http','client','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','update','destroy','name','index','map','ChatMessage','fieldName','type','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','rawAttributes','body','find','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage'];(function(_0x768458,_0x3d0933){var _0x31385c=function(_0xf11dad){while(--_0xf11dad){_0x768458['push'](_0x768458['shift']());}};_0x31385c(++_0x3d0933);}(_0x1e42,0x10c));var _0x21e4=function(_0xcceb55,_0x7bcceb){_0xcceb55=_0xcceb55-0x0;var _0x45e9e6=_0x1e42[_0xcceb55];return _0x45e9e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21e4('0x0'));var zipdir=require(_0x21e4('0x1'));var jsonpatch=require(_0x21e4('0x2'));var rp=require(_0x21e4('0x3'));var moment=require(_0x21e4('0x4'));var BPromise=require(_0x21e4('0x5'));var Mustache=require(_0x21e4('0x6'));var util=require(_0x21e4('0x7'));var path=require(_0x21e4('0x8'));var sox=require(_0x21e4('0x9'));var csv=require('to-csv');var ejs=require(_0x21e4('0xa'));var fs=require('fs');var fs_extra=require(_0x21e4('0xb'));var _=require(_0x21e4('0xc'));var squel=require('squel');var crypto=require(_0x21e4('0xd'));var jsforce=require(_0x21e4('0xe'));var deskjs=require(_0x21e4('0xf'));var toCsv=require(_0x21e4('0x10'));var querystring=require(_0x21e4('0x11'));var Papa=require(_0x21e4('0x12'));var Redis=require(_0x21e4('0x13'));var authService=require(_0x21e4('0x14'));var qs=require(_0x21e4('0x15'));var as=require(_0x21e4('0x16'));var hardwareService=require(_0x21e4('0x17'));var logger=require(_0x21e4('0x18'))('api');var utils=require(_0x21e4('0x19'));var config=require(_0x21e4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x21e4('0x1b'))['db'];config[_0x21e4('0x1c')]=_['defaults'](config['redis'],{'host':_0x21e4('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21e4('0x1c')]));require(_0x21e4('0x1e'))[_0x21e4('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x21e4('0x20')]({'port':0x232c});var client9002=jayson[_0x21e4('0x21')][_0x21e4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4a2827,_0x28ca38,_0x22af7f,_0x352955){return new BPromise(function(_0x1c1ac5,_0x16d505){var _0x5db604=_0x352955||client;return _0x5db604[_0x21e4('0x22')](_0x4a2827,_0x22af7f)['then'](function(_0x576a63){logger[_0x21e4('0x23')](_0x21e4('0x24'),_0x28ca38,'request\x20sent');logger[_0x21e4('0x25')](_0x21e4('0x26'),_0x28ca38,_0x21e4('0x27'),JSON['stringify'](_0x576a63));if(_0x576a63[_0x21e4('0x28')]){if(_0x576a63['error']['code']===0x1f4){logger[_0x21e4('0x28')](_0x21e4('0x24'),_0x28ca38,_0x576a63[_0x21e4('0x28')][_0x21e4('0x29')]);return _0x16d505(_0x576a63[_0x21e4('0x28')][_0x21e4('0x29')]);}logger['error'](_0x21e4('0x24'),_0x28ca38,_0x576a63['error'][_0x21e4('0x29')]);return _0x1c1ac5(_0x576a63[_0x21e4('0x28')][_0x21e4('0x29')]);}else{logger[_0x21e4('0x23')](_0x21e4('0x24'),_0x28ca38,_0x21e4('0x27'));_0x1c1ac5(_0x576a63[_0x21e4('0x2a')]['message']);}})[_0x21e4('0x2b')](function(_0x589c5a){logger[_0x21e4('0x28')](_0x21e4('0x24'),_0x28ca38,_0x589c5a);_0x16d505(_0x589c5a);});});}function respondWithStatusCode(_0x5f1a30,_0x322825){_0x322825=_0x322825||0xcc;return function(_0x5c7519){if(_0x5c7519){return _0x5f1a30[_0x21e4('0x2c')](_0x322825);}return _0x5f1a30['status'](_0x322825)['end']();};}function respondWithResult(_0xf0a96d,_0x193a0a){_0x193a0a=_0x193a0a||0xc8;return function(_0xd44ffe){if(_0xd44ffe){return _0xf0a96d['status'](_0x193a0a)[_0x21e4('0x2d')](_0xd44ffe);}};}function respondWithFilteredResult(_0x14ec1b,_0x168213){return function(_0x5183e3){if(_0x5183e3){var _0x5513af=typeof _0x168213[_0x21e4('0x2e')]===_0x21e4('0x2f')&&typeof _0x168213[_0x21e4('0x30')]===_0x21e4('0x2f');var _0x395caf=_0x5183e3[_0x21e4('0x31')];var _0x524468=_0x5513af?0x0:_0x168213[_0x21e4('0x2e')];var _0x37ce03=_0x5513af?_0x5183e3['count']:_0x168213['offset']+_0x168213['limit'];var _0x48d8c7;if(_0x37ce03>=_0x395caf){_0x37ce03=_0x395caf;_0x48d8c7=0xc8;}else{_0x48d8c7=0xce;}_0x14ec1b[_0x21e4('0x32')](_0x48d8c7);return _0x14ec1b[_0x21e4('0x33')]('Content-Range',_0x524468+'-'+_0x37ce03+'/'+_0x395caf)[_0x21e4('0x2d')](_0x5183e3);}return null;};}function patchUpdates(_0x9a6968){return function(_0x4d0a20){try{jsonpatch[_0x21e4('0x34')](_0x4d0a20,_0x9a6968,!![]);}catch(_0x19d8a7){return BPromise[_0x21e4('0x35')](_0x19d8a7);}return _0x4d0a20['save']();};}function saveUpdates(_0x1d6c05,_0x443958){return function(_0x171c72){if(_0x171c72){return _0x171c72[_0x21e4('0x36')](_0x1d6c05)['then'](function(_0x2d44b0){return _0x2d44b0;});}return null;};}function removeEntity(_0x4eff4e,_0x35817d){return function(_0x6bd0a){if(_0x6bd0a){return _0x6bd0a[_0x21e4('0x37')]()['then'](function(){_0x4eff4e[_0x21e4('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x407b6e,_0x4f23a8){return function(_0x37c70b){if(!_0x37c70b){_0x407b6e['sendStatus'](0x194);}return _0x37c70b;};}function handleError(_0x45183b,_0x332ff1){_0x332ff1=_0x332ff1||0x1f4;return function(_0x2e7064){logger['error'](_0x2e7064['stack']);if(_0x2e7064['name']){delete _0x2e7064[_0x21e4('0x38')];}_0x45183b[_0x21e4('0x32')](_0x332ff1)['send'](_0x2e7064);};}exports[_0x21e4('0x39')]=function(_0x478ae4,_0x260f51){var _0x5041db={},_0x46f6d1={},_0x136745={'count':0x0,'rows':[]};var _0x1237b7=_[_0x21e4('0x3a')](db[_0x21e4('0x3b')]['rawAttributes'],function(_0x450d61){return{'name':_0x450d61[_0x21e4('0x3c')],'type':_0x450d61[_0x21e4('0x3d')]['key']};});_0x46f6d1['model']=_[_0x21e4('0x3a')](_0x1237b7,_0x21e4('0x38'));_0x46f6d1['query']=_[_0x21e4('0x3e')](_0x478ae4[_0x21e4('0x3f')]);_0x46f6d1['filters']=_[_0x21e4('0x40')](_0x46f6d1['model'],_0x46f6d1[_0x21e4('0x3f')]);_0x5041db[_0x21e4('0x41')]=_[_0x21e4('0x40')](_0x46f6d1[_0x21e4('0x42')],qs['fields'](_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x43')]));_0x5041db[_0x21e4('0x41')]=_0x5041db[_0x21e4('0x41')][_0x21e4('0x44')]?_0x5041db['attributes']:_0x46f6d1['model'];if(!_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x45')](_0x21e4('0x46'))){_0x5041db[_0x21e4('0x30')]=qs['limit'](_0x478ae4['query'][_0x21e4('0x30')]);_0x5041db[_0x21e4('0x2e')]=qs['offset'](_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x2e')]);}_0x5041db[_0x21e4('0x47')]=qs[_0x21e4('0x48')](_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x48')]);_0x5041db[_0x21e4('0x49')]=qs[_0x21e4('0x4a')](_[_0x21e4('0x4b')](_0x478ae4[_0x21e4('0x3f')],_0x46f6d1[_0x21e4('0x4a')]),_0x1237b7);if(_0x478ae4[_0x21e4('0x3f')]['filter']){_0x5041db[_0x21e4('0x49')]=_[_0x21e4('0x4c')](_0x5041db[_0x21e4('0x49')],{'$or':_[_0x21e4('0x3a')](_0x1237b7,function(_0x28ad43){if(_0x28ad43[_0x21e4('0x3d')]!==_0x21e4('0x4d')){var _0x2ff756={};_0x2ff756[_0x28ad43[_0x21e4('0x38')]]={'$like':'%'+_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x4e')]+'%'};return _0x2ff756;}})});}_0x5041db=_[_0x21e4('0x4c')]({},_0x5041db,_0x478ae4['options']);var _0x1b75d7={'where':_0x5041db[_0x21e4('0x49')]};return db[_0x21e4('0x3b')][_0x21e4('0x31')](_0x1b75d7)[_0x21e4('0x4f')](function(_0x5a6633){_0x136745[_0x21e4('0x31')]=_0x5a6633;if(_0x478ae4['query'][_0x21e4('0x50')]){_0x5041db[_0x21e4('0x51')]=[{'all':!![]}];}return db[_0x21e4('0x3b')][_0x21e4('0x52')](_0x5041db);})[_0x21e4('0x4f')](function(_0x27f1ca){_0x136745[_0x21e4('0x53')]=_0x27f1ca;return _0x136745;})[_0x21e4('0x4f')](respondWithFilteredResult(_0x260f51,_0x5041db))['catch'](handleError(_0x260f51,null));};exports[_0x21e4('0x54')]=function(_0x16659e,_0x1d69b1){var _0x541e51={'raw':!![],'where':{'id':_0x16659e[_0x21e4('0x55')]['id']}},_0x5b37ed={};_0x5b37ed['model']=_['keys'](db['ChatMessage'][_0x21e4('0x56')]);_0x5b37ed[_0x21e4('0x3f')]=_[_0x21e4('0x3e')](_0x16659e['query']);_0x5b37ed['filters']=_[_0x21e4('0x40')](_0x5b37ed[_0x21e4('0x42')],_0x5b37ed[_0x21e4('0x3f')]);_0x541e51[_0x21e4('0x41')]=_['intersection'](_0x5b37ed[_0x21e4('0x42')],qs['fields'](_0x16659e[_0x21e4('0x3f')][_0x21e4('0x43')]));_0x541e51[_0x21e4('0x41')]=_0x541e51[_0x21e4('0x41')][_0x21e4('0x44')]?_0x541e51['attributes']:_0x5b37ed['model'];if(_0x16659e['query']['includeAll']){_0x541e51['include']=[{'all':!![]}];}_0x541e51=_[_0x21e4('0x4c')]({},_0x541e51,_0x16659e['options']);return db['ChatMessage']['find'](_0x541e51)[_0x21e4('0x4f')](handleEntityNotFound(_0x1d69b1,null))['then'](respondWithResult(_0x1d69b1,null))[_0x21e4('0x2b')](handleError(_0x1d69b1,null));};exports['create']=function(_0x41c2e1,_0x7b114d){return db[_0x21e4('0x3b')]['create'](_0x41c2e1['body'],{})[_0x21e4('0x4f')](respondWithResult(_0x7b114d,0xc9))[_0x21e4('0x2b')](handleError(_0x7b114d,null));};exports[_0x21e4('0x36')]=function(_0x5740f4,_0x433b19){if(_0x5740f4[_0x21e4('0x57')]['id']){delete _0x5740f4[_0x21e4('0x57')]['id'];}return db[_0x21e4('0x3b')]['find']({'where':{'id':_0x5740f4[_0x21e4('0x55')]['id']}})[_0x21e4('0x4f')](handleEntityNotFound(_0x433b19,null))[_0x21e4('0x4f')](saveUpdates(_0x5740f4['body'],null))['then'](respondWithResult(_0x433b19,null))[_0x21e4('0x2b')](handleError(_0x433b19,null));};exports[_0x21e4('0x37')]=function(_0x2b6960,_0x49f092){return db[_0x21e4('0x3b')][_0x21e4('0x58')]({'where':{'id':_0x2b6960[_0x21e4('0x55')]['id']}})[_0x21e4('0x4f')](handleEntityNotFound(_0x49f092,null))[_0x21e4('0x4f')](removeEntity(_0x49f092,null))[_0x21e4('0x2b')](handleError(_0x49f092,null));};exports[_0x21e4('0x59')]=function(_0x2a22e4,_0x341ae8){return db['ChatMessage'][_0x21e4('0x59')]()[_0x21e4('0x4f')](respondWithResult(_0x341ae8,null))['catch'](handleError(_0x341ae8,null));};var interaction_log=require(_0x21e4('0x18'))('chat-interactions');exports[_0x21e4('0x5a')]=function(_0x33f9f1,_0x192f69,_0x4ee2a1){var _0xc58cda={'agent':{},'channel':_0x21e4('0x5b')};if(_0x33f9f1[_0x21e4('0x57')]['id']){delete _0x33f9f1[_0x21e4('0x57')]['id'];}_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x5c')]=!![];_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x5d')]=moment()[_0x21e4('0x5e')](_0x21e4('0x5f'));_0x33f9f1['body']['UserId']=_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x60')]||_0x33f9f1[_0x21e4('0x61')]['id'];_0xc58cda[_0x21e4('0x62')]['id']=_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x60')];return db[_0x21e4('0x3b')][_0x21e4('0x58')]({'where':{'id':_0x33f9f1[_0x21e4('0x55')]['id'],'UserId':null}})[_0x21e4('0x4f')](handleEntityNotFound(_0x192f69,null))[_0x21e4('0x4f')](saveUpdates(_0x33f9f1[_0x21e4('0x57')],null))[_0x21e4('0x4f')](function(_0x1f6594){if(_0x1f6594){_0xc58cda[_0x21e4('0x29')]=_0x1f6594[_0x21e4('0x63')]({'plain':!![]});return db[_0x21e4('0x64')]['find']({'where':{'id':_0x1f6594[_0x21e4('0x65')]}});}return null;})[_0x21e4('0x4f')](handleEntityNotFound(_0x192f69,null))['then'](function(_0x5a71a0){if(_0x5a71a0){return _0x5a71a0[_0x21e4('0x36')]({'UserId':_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x60')],'read1stAt':_[_0x21e4('0x66')](_0x5a71a0[_0x21e4('0x67')])?moment()[_0x21e4('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x39c536){if(_0x39c536){_0xc58cda['interaction']=_0x39c536[_0x21e4('0x63')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33f9f1[_0x21e4('0x61')]['id'],_0x33f9f1[_0x21e4('0x61')][_0x21e4('0x38')],_0x33f9f1[_0x21e4('0x61')][_0x21e4('0x68')],_0xc58cda[_0x21e4('0x69')]['id'],_0x33f9f1['body']?JSON['stringify'](_0x33f9f1[_0x21e4('0x57')]):_0x21e4('0x6a'));return respondWithRpcPromise(_0x21e4('0x6b'),_0x21e4('0x6c'),_0xc58cda);}return null;})[_0x21e4('0x4f')](function(_0x36e1a4){var _0x5576d1=_0x21e4('0x6d')+_0x36e1a4[_0x21e4('0x29')][_0x21e4('0x6e')];return db[_0x21e4('0x6f')][_0x21e4('0x3f')](_0x5576d1,{'type':db[_0x21e4('0x70')]['QueryTypes'][_0x21e4('0x71')],'raw':!![]})[_0x21e4('0x4f')](function(_0x1ffe14){return _0x1ffe14;});})[_0x21e4('0x4f')](function(_0x2caaeb){if(_0x2caaeb){_0xc58cda[_0x21e4('0x29')]['contact']=_0x2caaeb[0x0];if(!_0x33f9f1['body'][_0x21e4('0x60')])return;return db[_0x21e4('0x72')][_0x21e4('0x58')]({'where':{'id':_0x33f9f1['body']['UserId'],'role':_0x21e4('0x62')},'attributes':['id',_0x21e4('0x38'),_0x21e4('0x73'),_0x21e4('0x74'),_0x21e4('0x75')],'raw':!![]});}return null;})['then'](function(_0xa1aee3){if(!_0xa1aee3)return null;_0xc58cda[_0x21e4('0x29')]['agent']=_0xa1aee3;return _0xc58cda;})['then'](function(_0x53a7aa){if(_0x53a7aa){if(_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x76')]){_0xc58cda[_0x21e4('0x29')]['interface']=util['format'](_0x21e4('0x77'),_0x33f9f1[_0x21e4('0x61')][_0x21e4('0x38')]);_0xc58cda[_0x21e4('0x29')][_0x21e4('0x78')]=_0xc58cda[_0x21e4('0x78')];_0xc58cda['message'][_0x21e4('0x79')]=_0xc58cda[_0x21e4('0x78')];_0xc58cda[_0x21e4('0x29')][_0x21e4('0x7a')]=_0x21e4('0x5a');return respondWithRpcPromise('EventManager',_0x21e4('0x7b'),{'event':_0x21e4('0x7c'),'message':_['merge'](_0xc58cda['message'],JSON[_0x21e4('0x7d')](_0xc58cda[_0x21e4('0x69')][_0x21e4('0x7e')]))},client9002)['then'](function(){return _0xc58cda;});}return _0xc58cda;}return null;})[_0x21e4('0x4f')](respondWithResult(_0x192f69,null))[_0x21e4('0x2b')](handleError(_0x192f69,null));};var interaction_log=require(_0x21e4('0x18'))(_0x21e4('0x7f'));exports['reject']=function(_0x4c33eb,_0x41e572,_0x323c5b){var _0x52e2ad={'agent':{},'channel':_0x21e4('0x5b')};if(_0x4c33eb['body']['id']){delete _0x4c33eb['body']['id'];}_0x4c33eb['body'][_0x21e4('0x60')]=_0x4c33eb[_0x21e4('0x57')][_0x21e4('0x60')]||_0x4c33eb[_0x21e4('0x61')]['id'];_0x52e2ad[_0x21e4('0x62')]['id']=_0x4c33eb['body'][_0x21e4('0x60')];return db[_0x21e4('0x3b')][_0x21e4('0x58')]({'where':{'id':_0x4c33eb[_0x21e4('0x55')]['id'],'UserId':null}})[_0x21e4('0x4f')](handleEntityNotFound(_0x41e572,null))['then'](function(_0x12fad4){if(_0x12fad4){_0x52e2ad[_0x21e4('0x29')]=_0x12fad4[_0x21e4('0x63')]({'plain':!![]});return db['ChatInteraction'][_0x21e4('0x58')]({'where':{'id':_0x12fad4[_0x21e4('0x65')]}});}return null;})[_0x21e4('0x4f')](handleEntityNotFound(_0x41e572,null))[_0x21e4('0x4f')](function(_0x1efd43){if(_0x1efd43){_0x52e2ad[_0x21e4('0x69')]=_0x1efd43[_0x21e4('0x63')]({'plain':!![]});interaction_log[_0x21e4('0x23')](_0x21e4('0x80'),_0x4c33eb[_0x21e4('0x61')]['id'],_0x4c33eb[_0x21e4('0x61')][_0x21e4('0x38')],_0x4c33eb[_0x21e4('0x61')][_0x21e4('0x68')],_0x52e2ad[_0x21e4('0x69')]['id'],_0x4c33eb[_0x21e4('0x57')]?JSON[_0x21e4('0x81')](_0x4c33eb[_0x21e4('0x57')]):_0x21e4('0x6a'));return respondWithRpcPromise('RejectMessage',_0x21e4('0x82'),_0x52e2ad);}return null;})[_0x21e4('0x4f')](function(_0x12fe3c){var _0x5bb018=_0x21e4('0x6d')+_0x12fe3c[_0x21e4('0x29')]['ContactId'];return db['sequelize'][_0x21e4('0x3f')](_0x5bb018,{'type':db['Sequelize'][_0x21e4('0x83')][_0x21e4('0x71')],'raw':!![]})[_0x21e4('0x4f')](function(_0x1d6c92){return _0x1d6c92;});})[_0x21e4('0x4f')](function(_0x2ed983){if(_0x2ed983){_0x52e2ad[_0x21e4('0x29')][_0x21e4('0x84')]=_0x2ed983[0x0];if(!_0x4c33eb[_0x21e4('0x57')][_0x21e4('0x60')])return;return db['User'][_0x21e4('0x58')]({'where':{'id':_0x4c33eb['body'][_0x21e4('0x60')],'role':'agent'},'attributes':['id','name',_0x21e4('0x73'),_0x21e4('0x74'),_0x21e4('0x75')],'raw':!![]});}return null;})[_0x21e4('0x4f')](function(_0x43069b){if(!_0x43069b)return null;_0x52e2ad['message'][_0x21e4('0x62')]=_0x43069b;return _0x52e2ad;})[_0x21e4('0x4f')](function(_0x1faea7){if(_0x1faea7){_0x1faea7['message']['interface']=util[_0x21e4('0x5e')](_0x21e4('0x77'),_0x4c33eb[_0x21e4('0x61')]['name']);_0x1faea7[_0x21e4('0x29')]['channel']=_0x52e2ad[_0x21e4('0x78')];_0x1faea7[_0x21e4('0x29')][_0x21e4('0x79')]=_0x52e2ad[_0x21e4('0x78')];_0x1faea7['message']['event']=_0x21e4('0x35');respondWithRpcPromise(_0x21e4('0x7b'),'EventManager',{'event':'rejectmessage','message':_['merge'](_0x52e2ad[_0x21e4('0x29')],JSON[_0x21e4('0x7d')](_0x52e2ad['interaction']['formData']))},client9002);return _0x52e2ad;}return null;})[_0x21e4('0x4f')](respondWithResult(_0x41e572,null))[_0x21e4('0x2b')](handleError(_0x41e572,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5cb8172..8177348 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 _0xc914=['remove','emit','hasOwnProperty','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x40fea4,_0x8757e0){var _0x10197c=function(_0x42c986){while(--_0x42c986){_0x40fea4['push'](_0x40fea4['shift']());}};_0x10197c(++_0x8757e0);}(_0xc914,0x83));var _0x4c91=function(_0xdf6baf,_0x13d18f){_0xdf6baf=_0xdf6baf-0x0;var _0x587021=_0xc914[_0xdf6baf];return _0x587021;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x4c91('0x0'))['db'][_0x4c91('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4c91('0x2')](0x0);var events={'afterCreate':_0x4c91('0x3'),'afterUpdate':_0x4c91('0x4'),'afterDestroy':_0x4c91('0x5')};function emitEvent(_0x557759){return function(_0x175957,_0x261182,_0x57ce0b){ChatMessageEvents[_0x4c91('0x6')](_0x557759+':'+_0x175957['id'],_0x175957);ChatMessageEvents[_0x4c91('0x6')](_0x557759,_0x175957);_0x57ce0b(null);};}for(var e in events){if(events[_0x4c91('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x1838=['../../mysqldb','ChatMessage','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1838,0x1e0));var _0x8183=function(_0x2d1e29,_0x22f87b){_0x2d1e29=_0x2d1e29-0x0;var _0x238fca=_0x1838[_0x2d1e29];return _0x238fca;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x8183('0x0'))['db'][_0x8183('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8183('0x2'),'afterUpdate':_0x8183('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5f55a5){return function(_0x39abd6,_0x5c26fb,_0xcd7070){ChatMessageEvents[_0x8183('0x4')](_0x5f55a5+':'+_0x39abd6['id'],_0x39abd6);ChatMessageEvents[_0x8183('0x4')](_0x5f55a5,_0x39abd6);_0xcd7070(null);};}for(var e in events){if(events[_0x8183('0x5')](e)){var event=events[e];ChatMessage[_0x8183('0x6')](e,emitEvent(event));}}module[_0x8183('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5861c47..7591151 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 _0xad7f=['then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil'];(function(_0x3b88fa,_0x5366f){var _0xbc3533=function(_0x53c6ad){while(--_0x53c6ad){_0x3b88fa['push'](_0x3b88fa['shift']());}};_0xbc3533(++_0x5366f);}(_0xad7f,0x1a5));var _0xfad7=function(_0x16c314,_0x4bcd8e){_0x16c314=_0x16c314-0x0;var _0x1b0580=_0xad7f[_0x16c314];return _0x1b0580;};'use strict';var _=require(_0xfad7('0x0'));var util=require(_0xfad7('0x1'));var logger=require(_0xfad7('0x2'))(_0xfad7('0x3'));var moment=require(_0xfad7('0x4'));var BPromise=require(_0xfad7('0x5'));var rp=require(_0xfad7('0x6'));var fs=require('fs');var path=require(_0xfad7('0x7'));var rimraf=require(_0xfad7('0x8'));var config=require(_0xfad7('0x9'));var attributes=require('./chatMessage.attributes');module[_0xfad7('0xa')]=function(_0x5b067d,_0x57774f){return _0x5b067d['define'](_0xfad7('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xfad7('0xc'),'fields':[_0xfad7('0xd')],'type':_0xfad7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7e5802,_0x14a662,_0x2bd913){var _0x17cfbf=_0x5b067d['models'];var _0x1a2d12=_0x7e5802[_0xfad7('0xf')]({'plain':!![]});if(_0x1a2d12[_0xfad7('0x10')][_0xfad7('0x11')]()==='in'||_0x1a2d12['direction'][_0xfad7('0x11')]()===_0xfad7('0x12')&&!_0x1a2d12[_0xfad7('0x13')]&&!_[_0xfad7('0x14')](_0x1a2d12['UserId'])){_0x17cfbf['ChatInteraction']['findOne']({'where':{'id':_0x1a2d12['ChatInteractionId']}})[_0xfad7('0x15')](function(_0x430b10){if(_0x430b10){_0x430b10[_0xfad7('0x16')]({'lastMsgAt':_0x1a2d12['createdAt'],'lastMsgDirection':_0x1a2d12[_0xfad7('0x10')][_0xfad7('0x11')]()});}})['catch'](function(_0x20dd62){console[_0xfad7('0x17')](_0x20dd62);});}_0x2bd913();}},'charset':_0xfad7('0x18'),'collate':_0xfad7('0x19')});}; \ No newline at end of file +var _0xdab2=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','UserId','ChatInteraction','ChatInteractionId','then','createdAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var logger=require('../../config/logger')(_0x2dab('0x2'));var moment=require(_0x2dab('0x3'));var BPromise=require(_0x2dab('0x4'));var rp=require(_0x2dab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var attributes=require(_0x2dab('0x8'));module[_0x2dab('0x9')]=function(_0x4562bb,_0x1421d5){return _0x4562bb[_0x2dab('0xa')](_0x2dab('0xb'),attributes,{'tableName':_0x2dab('0xc'),'paranoid':![],'indexes':[{'name':_0x2dab('0xd'),'fields':[_0x2dab('0xe')],'type':_0x2dab('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x317c59,_0x533046,_0x596950){var _0x26852f=_0x4562bb[_0x2dab('0x10')];var _0x1e258e=_0x317c59['get']({'plain':!![]});if(_0x1e258e['direction'][_0x2dab('0x11')]()==='in'||_0x1e258e[_0x2dab('0x12')][_0x2dab('0x11')]()===_0x2dab('0x13')&&!_0x1e258e[_0x2dab('0x14')]&&!_['isNil'](_0x1e258e[_0x2dab('0x15')])){_0x26852f[_0x2dab('0x16')]['findOne']({'where':{'id':_0x1e258e[_0x2dab('0x17')]}})[_0x2dab('0x18')](function(_0x1b5161){if(_0x1b5161){_0x1b5161['update']({'lastMsgAt':_0x1e258e[_0x2dab('0x19')],'lastMsgDirection':_0x1e258e[_0x2dab('0x12')]['toLowerCase']()});}})[_0x2dab('0x1a')](function(_0x15a9e7){console[_0x2dab('0x1b')](_0x15a9e7);});}_0x596950();}},'charset':_0x2dab('0x1c'),'collate':_0x2dab('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 555e205..4ae2ffc 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 _0xe86b=['code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0xff70d1,_0x12166f){var _0x144b71=function(_0x29dd){while(--_0x29dd){_0xff70d1['push'](_0xff70d1['shift']());}};_0x144b71(++_0x12166f);}(_0xe86b,0x182));var _0xbe86=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe86b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xbe86('0x0'));var util=require(_0xbe86('0x1'));var moment=require('moment');var BPromise=require(_0xbe86('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe86('0x3'));var db=require(_0xbe86('0x4'))['db'];var utils=require(_0xbe86('0x5'));var logger=require(_0xbe86('0x6'))(_0xbe86('0x7'));var config=require(_0xbe86('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe86('0x9')]({'port':0x232a});config['redis']=_[_0xbe86('0xa')](config[_0xbe86('0xb')],{'host':_0xbe86('0xc'),'port':0x18eb});var socket=require(_0xbe86('0xd'))(new Redis(config[_0xbe86('0xb')]));require(_0xbe86('0xe'))[_0xbe86('0xf')](socket);function respondWithRpcPromise(_0x162f66,_0x5bb316,_0x2fd79f){return new BPromise(function(_0x23fa97,_0x10b292){return client[_0xbe86('0x10')](_0x162f66,_0x2fd79f)['then'](function(_0x2eb681){logger[_0xbe86('0x11')](_0xbe86('0x12'),_0x5bb316,_0xbe86('0x13'));logger[_0xbe86('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5bb316,_0xbe86('0x13'),JSON['stringify'](_0x2eb681));if(_0x2eb681[_0xbe86('0x15')]){if(_0x2eb681[_0xbe86('0x15')][_0xbe86('0x16')]===0x1f4){logger[_0xbe86('0x15')]('ChatMessage,\x20%s,\x20%s',_0x5bb316,_0x2eb681[_0xbe86('0x15')]['message']);return _0x10b292(_0x2eb681[_0xbe86('0x15')][_0xbe86('0x17')]);}logger[_0xbe86('0x15')](_0xbe86('0x12'),_0x5bb316,_0x2eb681[_0xbe86('0x15')][_0xbe86('0x17')]);return _0x23fa97(_0x2eb681[_0xbe86('0x15')]['message']);}else{logger[_0xbe86('0x11')](_0xbe86('0x12'),_0x5bb316,'request\x20sent');_0x23fa97(_0x2eb681[_0xbe86('0x18')][_0xbe86('0x17')]);}})[_0xbe86('0x19')](function(_0x2004ac){logger[_0xbe86('0x15')](_0xbe86('0x12'),_0x5bb316,_0x2004ac);_0x10b292(_0x2004ac);});});}exports[_0xbe86('0x1a')]=function(_0xdd781b){var _0x563392=this;return new Promise(function(_0x1dad5f,_0x2d801f){return db[_0xbe86('0x1b')][_0xbe86('0x1c')](_0xdd781b[_0xbe86('0x1d')],{'raw':_0xdd781b[_0xbe86('0x1e')]?_0xdd781b['options'][_0xbe86('0x1f')]===undefined?!![]:![]:!![]})[_0xbe86('0x20')](function(_0x36801f){logger[_0xbe86('0x11')]('CreateChatMessage',_0xdd781b);logger[_0xbe86('0x14')]('CreateChatMessage',_0xdd781b,JSON[_0xbe86('0x21')](_0x36801f));_0x1dad5f(_0x36801f);})[_0xbe86('0x19')](function(_0x5b8428){logger[_0xbe86('0x15')]('CreateChatMessage',_0x5b8428[_0xbe86('0x17')],_0xdd781b);_0x2d801f(_0x563392[_0xbe86('0x15')](0x1f4,_0x5b8428['message']));});});}; \ No newline at end of file +var _0xfc4f=['create','body','options','raw','then','CreateChatMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','ChatMessage'];(function(_0x22e69a,_0x464f63){var _0x16f52f=function(_0x47918c){while(--_0x47918c){_0x22e69a['push'](_0x22e69a['shift']());}};_0x16f52f(++_0x464f63);}(_0xfc4f,0x192));var _0xffc4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfc4f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xffc4('0x0'));var moment=require(_0xffc4('0x1'));var BPromise=require(_0xffc4('0x2'));var rs=require(_0xffc4('0x3'));var fs=require('fs');var Redis=require(_0xffc4('0x4'));var db=require(_0xffc4('0x5'))['db'];var utils=require(_0xffc4('0x6'));var logger=require('../../config/logger')(_0xffc4('0x7'));var config=require(_0xffc4('0x8'));var jayson=require(_0xffc4('0x9'));var client=jayson[_0xffc4('0xa')]['http']({'port':0x232a});config[_0xffc4('0xb')]=_[_0xffc4('0xc')](config['redis'],{'host':_0xffc4('0xd'),'port':0x18eb});var socket=require(_0xffc4('0xe'))(new Redis(config[_0xffc4('0xb')]));require(_0xffc4('0xf'))['register'](socket);function respondWithRpcPromise(_0x22daf5,_0x22d03a,_0x2539cd){return new BPromise(function(_0x1718c3,_0x3705a7){return client[_0xffc4('0x10')](_0x22daf5,_0x2539cd)['then'](function(_0x4136dd){logger[_0xffc4('0x11')](_0xffc4('0x12'),_0x22d03a,_0xffc4('0x13'));logger[_0xffc4('0x14')](_0xffc4('0x15'),_0x22d03a,_0xffc4('0x13'),JSON['stringify'](_0x4136dd));if(_0x4136dd[_0xffc4('0x16')]){if(_0x4136dd[_0xffc4('0x16')]['code']===0x1f4){logger[_0xffc4('0x16')](_0xffc4('0x12'),_0x22d03a,_0x4136dd['error'][_0xffc4('0x17')]);return _0x3705a7(_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);}logger[_0xffc4('0x16')]('ChatMessage,\x20%s,\x20%s',_0x22d03a,_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);return _0x1718c3(_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);}else{logger[_0xffc4('0x11')](_0xffc4('0x12'),_0x22d03a,_0xffc4('0x13'));_0x1718c3(_0x4136dd[_0xffc4('0x18')][_0xffc4('0x17')]);}})[_0xffc4('0x19')](function(_0x51a9ba){logger[_0xffc4('0x16')]('ChatMessage,\x20%s,\x20%s',_0x22d03a,_0x51a9ba);_0x3705a7(_0x51a9ba);});});}exports['CreateChatMessage']=function(_0x6a0096){var _0xd48851=this;return new Promise(function(_0x25b521,_0x5eb1c1){return db[_0xffc4('0x1a')][_0xffc4('0x1b')](_0x6a0096[_0xffc4('0x1c')],{'raw':_0x6a0096[_0xffc4('0x1d')]?_0x6a0096[_0xffc4('0x1d')][_0xffc4('0x1e')]===undefined?!![]:![]:!![]})[_0xffc4('0x1f')](function(_0x5957f2){logger[_0xffc4('0x11')](_0xffc4('0x20'),_0x6a0096);logger[_0xffc4('0x14')](_0xffc4('0x20'),_0x6a0096,JSON['stringify'](_0x5957f2));_0x25b521(_0x5957f2);})['catch'](function(_0x39d808){logger[_0xffc4('0x16')]('CreateChatMessage',_0x39d808[_0xffc4('0x17')],_0x6a0096);_0x5eb1c1(_0xd48851[_0xffc4('0x16')](0x1f4,_0x39d808[_0xffc4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e5a20df..0275f91 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 _0xb647=['register','length','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x1d414c,_0x34cc20){var _0x498ebf=function(_0x3cc9d4){while(--_0x3cc9d4){_0x1d414c['push'](_0x1d414c['shift']());}};_0x498ebf(++_0x34cc20);}(_0xb647,0xdb));var _0x7b64=function(_0x472479,_0x2b06e8){_0x472479=_0x472479-0x0;var _0x160c6d=_0xb647[_0x472479];return _0x160c6d;};'use strict';var ChatMessageEvents=require(_0x7b64('0x0'));var events=[_0x7b64('0x1'),_0x7b64('0x2'),_0x7b64('0x3')];function createListener(_0x38de52,_0x3b659e){return function(_0x274824){_0x3b659e[_0x7b64('0x4')](_0x38de52,_0x274824);};}function removeListener(_0x54eee8,_0x36ff12){return function(){ChatMessageEvents['removeListener'](_0x54eee8,_0x36ff12);};}exports[_0x7b64('0x5')]=function(_0x38ebf7){for(var _0x31915b=0x0,_0x80721a=events[_0x7b64('0x6')];_0x31915b<_0x80721a;_0x31915b++){var _0x22eca3=events[_0x31915b];var _0x727684=createListener(_0x7b64('0x7')+_0x22eca3,_0x38ebf7);ChatMessageEvents['on'](_0x22eca3,_0x727684);}}; \ No newline at end of file +var _0x0960=['update','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x44361c,_0x310ea4){var _0x59adb0=function(_0x4d0b42){while(--_0x4d0b42){_0x44361c['push'](_0x44361c['shift']());}};_0x59adb0(++_0x310ea4);}(_0x0960,0xc2));var _0x0096=function(_0x440e0f,_0x47a9c1){_0x440e0f=_0x440e0f-0x0;var _0x216b2b=_0x0960[_0x440e0f];return _0x216b2b;};'use strict';var ChatMessageEvents=require(_0x0096('0x0'));var events=[_0x0096('0x1'),'remove',_0x0096('0x2')];function createListener(_0x1078f3,_0x41a86e){return function(_0x136f7a){_0x41a86e[_0x0096('0x3')](_0x1078f3,_0x136f7a);};}function removeListener(_0xd0d4c6,_0x3ee9fb){return function(){ChatMessageEvents[_0x0096('0x4')](_0xd0d4c6,_0x3ee9fb);};}exports[_0x0096('0x5')]=function(_0x6ea572){for(var _0x59b3cc=0x0,_0x81cc41=events['length'];_0x59b3cc<_0x81cc41;_0x59b3cc++){var _0x1d35f1=events[_0x59b3cc];var _0x44e168=createListener(_0x0096('0x6')+_0x1d35f1,_0x6ea572);ChatMessageEvents['on'](_0x1d35f1,_0x44e168);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index a06c8c1..37403a8 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 _0x980e=['/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe','describe','show','post','chat','create','put'];(function(_0x4a3ee3,_0x304512){var _0x56d16d=function(_0x280251){while(--_0x280251){_0x4a3ee3['push'](_0x4a3ee3['shift']());}};_0x56d16d(++_0x304512);}(_0x980e,0x1b7));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe980('0x0'));var util=require(_0xe980('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe980('0x2'));var router=express[_0xe980('0x3')]();var fs_extra=require(_0xe980('0x4'));var auth=require(_0xe980('0x5'));var interaction=require(_0xe980('0x6'));var config=require('../../config/environment');var controller=require(_0xe980('0x7'));router[_0xe980('0x8')]('/',auth[_0xe980('0x9')](),controller['index']);router['get'](_0xe980('0xa'),auth['isAuthenticated'](),controller[_0xe980('0xb')]);router[_0xe980('0x8')]('/:id',auth[_0xe980('0x9')](),controller[_0xe980('0xc')]);router[_0xe980('0xd')]('/',auth[_0xe980('0x9')](),interaction['tracked'](_0xe980('0xe'),'chatmessage:create'),controller[_0xe980('0xf')]);router[_0xe980('0x10')](_0xe980('0x11'),controller[_0xe980('0x12')]);router[_0xe980('0x10')](_0xe980('0x13'),auth[_0xe980('0x9')](),controller['accept']);router[_0xe980('0x10')](_0xe980('0x14'),auth['isAuthenticated'](),controller[_0xe980('0x15')]);router[_0xe980('0x16')](_0xe980('0x11'),auth['isAuthenticated'](),controller[_0xe980('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3749=['delete','destroy','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe','/:id','post','tracked','chat','create','put','update','/:id/accept','/:id/reject','reject'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x3749,0x1d0));var _0x9374=function(_0x3f9d5d,_0x4ee8dd){_0x3f9d5d=_0x3f9d5d-0x0;var _0x1b2cd7=_0x3749[_0x3f9d5d];return _0x1b2cd7;};'use strict';var multer=require(_0x9374('0x0'));var util=require(_0x9374('0x1'));var path=require('path');var timeout=require(_0x9374('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9374('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9374('0x4'));var config=require('../../config/environment');var controller=require(_0x9374('0x5'));router[_0x9374('0x6')]('/',auth[_0x9374('0x7')](),controller['index']);router[_0x9374('0x6')](_0x9374('0x8'),auth[_0x9374('0x7')](),controller['describe']);router[_0x9374('0x6')](_0x9374('0x9'),auth[_0x9374('0x7')](),controller['show']);router[_0x9374('0xa')]('/',auth[_0x9374('0x7')](),interaction[_0x9374('0xb')](_0x9374('0xc'),'chatmessage:create'),controller[_0x9374('0xd')]);router[_0x9374('0xe')](_0x9374('0x9'),controller[_0x9374('0xf')]);router[_0x9374('0xe')](_0x9374('0x10'),auth[_0x9374('0x7')](),controller['accept']);router[_0x9374('0xe')](_0x9374('0x11'),auth[_0x9374('0x7')](),controller[_0x9374('0x12')]);router[_0x9374('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9374('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 46a0b4a..1a3a530 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 _0x46e9=['TEXT','medium','sequelize','exports'];(function(_0x476b5f,_0x1f9952){var _0x5a23d8=function(_0x50b464){while(--_0x50b464){_0x476b5f['push'](_0x476b5f['shift']());}};_0x5a23d8(++_0x1f9952);}(_0x46e9,0x96));var _0x946e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x46e9[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x946e('0x0'));module[_0x946e('0x1')]={'body':{'type':Sequelize[_0x946e('0x2')](_0x946e('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xa34a=['medium','sequelize','TEXT'];(function(_0x18fa33,_0xe5bc0b){var _0x460cde=function(_0x557af1){while(--_0x557af1){_0x18fa33['push'](_0x18fa33['shift']());}};_0x460cde(++_0xe5bc0b);}(_0xa34a,0xac));var _0xaa34=function(_0x5c26ab,_0x327f54){_0x5c26ab=_0x5c26ab-0x0;var _0x5b64f3=_0xa34a[_0x5c26ab];return _0x5b64f3;};'use strict';var Sequelize=require(_0xaa34('0x0'));module['exports']={'body':{'type':Sequelize[_0xaa34('0x1')](_0xaa34('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 99993fc..0756b8d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x7a54,0x106));var _0x47a5=function(_0x42f855,_0x55ca2b){_0x42f855=_0x42f855-0x0;var _0x3a15ea=_0x7a54[_0x42f855];return _0x3a15ea;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xf7471d,_0x24bb2b){var _0x3a1ce8=function(_0x42d69d){while(--_0x42d69d){_0xf7471d['push'](_0xf7471d['shift']());}};_0x3a1ce8(++_0x24bb2b);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 9b2dd0a..60ad9b3 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 _0x9c83=['api','path','./chatOfflineMessage.attributes','exports','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x1bc9b8,_0x379fc7){var _0x1a9a13=function(_0x3a73ea){while(--_0x3a73ea){_0x1bc9b8['push'](_0x1bc9b8['shift']());}};_0x1a9a13(++_0x379fc7);}(_0x9c83,0x13f));var _0x39c8=function(_0x167baa,_0x3f814f){_0x167baa=_0x167baa-0x0;var _0x4e082c=_0x9c83[_0x167baa];return _0x4e082c;};'use strict';var _=require('lodash');var util=require(_0x39c8('0x0'));var logger=require('../../config/logger')(_0x39c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x39c8('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x39c8('0x3'));module[_0x39c8('0x4')]=function(_0x316ef6,_0x55dc54){return _0x316ef6['define']('ChatOfflineMessage',attributes,{'tableName':_0x39c8('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x39c8('0x6'),'collate':_0x39c8('0x7')});}; \ No newline at end of file +var _0x243b=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x20def7,_0x2caec4){var _0xdc6a3e=function(_0x274412){while(--_0x274412){_0x20def7['push'](_0x20def7['shift']());}};_0xdc6a3e(++_0x2caec4);}(_0x243b,0xb3));var _0xb243=function(_0x49eb84,_0x20f3a7){_0x49eb84=_0x49eb84-0x0;var _0x3a5733=_0x243b[_0x49eb84];return _0x3a5733;};'use strict';var _=require(_0xb243('0x0'));var util=require(_0xb243('0x1'));var logger=require(_0xb243('0x2'))('api');var moment=require(_0xb243('0x3'));var BPromise=require(_0xb243('0x4'));var rp=require(_0xb243('0x5'));var fs=require('fs');var path=require(_0xb243('0x6'));var rimraf=require('rimraf');var config=require(_0xb243('0x7'));var attributes=require(_0xb243('0x8'));module['exports']=function(_0x3db848,_0x370c1d){return _0x3db848[_0xb243('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb243('0xa'),'collate':_0xb243('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b45a57c..7516954 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 _0x9f82=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','util','moment','bluebird'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x9f82,0x111));var _0x29f8=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9f82[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0x29f8('0x0'));var moment=require(_0x29f8('0x1'));var BPromise=require(_0x29f8('0x2'));var rs=require(_0x29f8('0x3'));var fs=require('fs');var Redis=require(_0x29f8('0x4'));var db=require(_0x29f8('0x5'))['db'];var utils=require(_0x29f8('0x6'));var logger=require(_0x29f8('0x7'))(_0x29f8('0x8'));var config=require(_0x29f8('0x9'));var jayson=require(_0x29f8('0xa'));var client=jayson[_0x29f8('0xb')][_0x29f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa8366c,_0x5c1cbc,_0x4fc691){return new BPromise(function(_0x30185e,_0x5d12f5){return client['request'](_0xa8366c,_0x4fc691)['then'](function(_0x249dc7){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5c1cbc,_0x29f8('0xd'));logger[_0x29f8('0xe')](_0x29f8('0xf'),_0x5c1cbc,_0x29f8('0xd'),JSON[_0x29f8('0x10')](_0x249dc7));if(_0x249dc7['error']){if(_0x249dc7['error'][_0x29f8('0x11')]===0x1f4){logger[_0x29f8('0x12')](_0x29f8('0x13'),_0x5c1cbc,_0x249dc7['error']['message']);return _0x5d12f5(_0x249dc7[_0x29f8('0x12')]['message']);}logger['error'](_0x29f8('0x13'),_0x5c1cbc,_0x249dc7[_0x29f8('0x12')][_0x29f8('0x14')]);return _0x30185e(_0x249dc7[_0x29f8('0x12')]['message']);}else{logger[_0x29f8('0x15')](_0x29f8('0x13'),_0x5c1cbc,_0x29f8('0xd'));_0x30185e(_0x249dc7['result'][_0x29f8('0x14')]);}})[_0x29f8('0x16')](function(_0x1a362f){logger[_0x29f8('0x12')](_0x29f8('0x13'),_0x5c1cbc,_0x1a362f);_0x5d12f5(_0x1a362f);});});} \ No newline at end of file +var _0x9de1=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x9de1,0x1ea));var _0x19de=function(_0x38999c,_0x45edd0){_0x38999c=_0x38999c-0x0;var _0x302301=_0x9de1[_0x38999c];return _0x302301;};'use strict';var _=require(_0x19de('0x0'));var util=require(_0x19de('0x1'));var moment=require('moment');var BPromise=require(_0x19de('0x2'));var rs=require(_0x19de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19de('0x4'))['db'];var utils=require(_0x19de('0x5'));var logger=require(_0x19de('0x6'))(_0x19de('0x7'));var config=require('../../config/environment');var jayson=require(_0x19de('0x8'));var client=jayson[_0x19de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xda6e81,_0x34325d,_0x3588ce){return new BPromise(function(_0xb16bc7,_0xdee01f){return client[_0x19de('0xa')](_0xda6e81,_0x3588ce)[_0x19de('0xb')](function(_0x1acf99){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x34325d,_0x19de('0xc'));logger[_0x19de('0xd')](_0x19de('0xe'),_0x34325d,_0x19de('0xc'),JSON[_0x19de('0xf')](_0x1acf99));if(_0x1acf99['error']){if(_0x1acf99[_0x19de('0x10')]['code']===0x1f4){logger[_0x19de('0x10')](_0x19de('0x11'),_0x34325d,_0x1acf99[_0x19de('0x10')][_0x19de('0x12')]);return _0xdee01f(_0x1acf99['error']['message']);}logger[_0x19de('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x34325d,_0x1acf99[_0x19de('0x10')][_0x19de('0x12')]);return _0xb16bc7(_0x1acf99[_0x19de('0x10')][_0x19de('0x12')]);}else{logger[_0x19de('0x13')](_0x19de('0x11'),_0x34325d,_0x19de('0xc'));_0xb16bc7(_0x1acf99[_0x19de('0x14')][_0x19de('0x12')]);}})['catch'](function(_0x51a70b){logger['error'](_0x19de('0x11'),_0x34325d,_0x51a70b);_0xdee01f(_0x51a70b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5702eac..fc5eea9 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 _0xc7db=['./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x410dbd,_0x210e38){var _0x2c85ed=function(_0x5e97f8){while(--_0x5e97f8){_0x410dbd['push'](_0x410dbd['shift']());}};_0x2c85ed(++_0x210e38);}(_0xc7db,0x188));var _0xbc7d=function(_0x30bfcf,_0x3e168){_0x30bfcf=_0x30bfcf-0x0;var _0x41f723=_0xc7db[_0x30bfcf];return _0x41f723;};'use strict';var multer=require(_0xbc7d('0x0'));var util=require(_0xbc7d('0x1'));var path=require('path');var timeout=require(_0xbc7d('0x2'));var express=require(_0xbc7d('0x3'));var router=express[_0xbc7d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbc7d('0x5'));var interaction=require(_0xbc7d('0x6'));var config=require('../../config/environment');var controller=require(_0xbc7d('0x7'));router[_0xbc7d('0x8')]('/',auth[_0xbc7d('0x9')](),controller[_0xbc7d('0xa')]);router[_0xbc7d('0x8')](_0xbc7d('0xb'),auth[_0xbc7d('0x9')](),controller[_0xbc7d('0xc')]);router['get'](_0xbc7d('0xd'),auth[_0xbc7d('0x9')](),controller[_0xbc7d('0xe')]);router[_0xbc7d('0xf')]('/',auth[_0xbc7d('0x9')](),controller[_0xbc7d('0x10')]);router[_0xbc7d('0x11')](_0xbc7d('0xd'),auth[_0xbc7d('0x9')](),controller[_0xbc7d('0x12')]);router[_0xbc7d('0x13')](_0xbc7d('0xd'),auth['isAuthenticated'](),controller[_0xbc7d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0a2b=['create','put','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','show','post'];(function(_0x5c1a38,_0x1784a2){var _0x35d5fb=function(_0x2bea10){while(--_0x2bea10){_0x5c1a38['push'](_0x5c1a38['shift']());}};_0x35d5fb(++_0x1784a2);}(_0x0a2b,0x81));var _0xb0a2=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x0a2b[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require(_0xb0a2('0x0'));var path=require(_0xb0a2('0x1'));var timeout=require(_0xb0a2('0x2'));var express=require(_0xb0a2('0x3'));var router=express[_0xb0a2('0x4')]();var fs_extra=require(_0xb0a2('0x5'));var auth=require(_0xb0a2('0x6'));var interaction=require(_0xb0a2('0x7'));var config=require(_0xb0a2('0x8'));var controller=require(_0xb0a2('0x9'));router[_0xb0a2('0xa')]('/',auth[_0xb0a2('0xb')](),controller['index']);router[_0xb0a2('0xa')]('/describe',auth[_0xb0a2('0xb')](),controller[_0xb0a2('0xc')]);router['get']('/:id',auth[_0xb0a2('0xb')](),controller[_0xb0a2('0xd')]);router[_0xb0a2('0xe')]('/',auth[_0xb0a2('0xb')](),controller[_0xb0a2('0xf')]);router[_0xb0a2('0x10')]('/:id',auth[_0xb0a2('0xb')](),controller['update']);router['delete']('/:id',auth[_0xb0a2('0xb')](),controller[_0xb0a2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index bde2508..2b1697d 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 _0x43d4=['INTEGER','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x5cf506,_0x315793){var _0x25e12d=function(_0x18cea2){while(--_0x18cea2){_0x5cf506['push'](_0x5cf506['shift']());}};_0x25e12d(++_0x315793);}(_0x43d4,0x109));var _0x443d=function(_0xbedfe8,_0x16fc10){_0xbedfe8=_0xbedfe8-0x0;var _0x3e7f56=_0x43d4[_0xbedfe8];return _0x3e7f56;};'use strict';var Sequelize=require('sequelize');module[_0x443d('0x0')]={'name':{'type':Sequelize[_0x443d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x443d('0x2')](_0x443d('0x3'),_0x443d('0x4')),'defaultValue':_0x443d('0x3')},'selector':{'type':Sequelize[_0x443d('0x1')]},'timeout':{'type':Sequelize[_0x443d('0x5')]}}; \ No newline at end of file +var _0x3b39=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x12443d,_0x19d2b2){var _0x24d6e0=function(_0x44e06d){while(--_0x44e06d){_0x12443d['push'](_0x12443d['shift']());}};_0x24d6e0(++_0x19d2b2);}(_0x3b39,0x1c1));var _0x93b3=function(_0x1d0cba,_0x2731b1){_0x1d0cba=_0x1d0cba-0x0;var _0xdc3278=_0x3b39[_0x1d0cba];return _0xdc3278;};'use strict';var Sequelize=require(_0x93b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x93b3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x93b3('0x2')](_0x93b3('0x3'),_0x93b3('0x4')),'defaultValue':_0x93b3('0x3')},'selector':{'type':Sequelize[_0x93b3('0x1')]},'timeout':{'type':Sequelize[_0x93b3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 67962e0..7b8afdf 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 _0x9330=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','stack','name','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','include','merge','find','catch','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path'];(function(_0x3b8888,_0x536fe9){var _0x289891=function(_0x22bae2){while(--_0x22bae2){_0x3b8888['push'](_0x3b8888['shift']());}};_0x289891(++_0x536fe9);}(_0x9330,0x14a));var _0x0933=function(_0x218927,_0x3eb444){_0x218927=_0x218927-0x0;var _0x20bc64=_0x9330[_0x218927];return _0x20bc64;};'use strict';var emlformat=require(_0x0933('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0933('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0933('0x2'));var Mustache=require(_0x0933('0x3'));var util=require(_0x0933('0x4'));var path=require(_0x0933('0x5'));var sox=require(_0x0933('0x6'));var csv=require(_0x0933('0x7'));var ejs=require(_0x0933('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0933('0x9'));var squel=require(_0x0933('0xa'));var crypto=require(_0x0933('0xb'));var jsforce=require(_0x0933('0xc'));var deskjs=require(_0x0933('0xd'));var toCsv=require(_0x0933('0x7'));var querystring=require(_0x0933('0xe'));var Papa=require(_0x0933('0xf'));var Redis=require(_0x0933('0x10'));var authService=require(_0x0933('0x11'));var qs=require(_0x0933('0x12'));var as=require(_0x0933('0x13'));var hardwareService=require(_0x0933('0x14'));var logger=require(_0x0933('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0933('0x16'))['db'];function respondWithStatusCode(_0x4b5927,_0x51cdc6){_0x51cdc6=_0x51cdc6||0xcc;return function(_0x56febc){if(_0x56febc){return _0x4b5927[_0x0933('0x17')](_0x51cdc6);}return _0x4b5927[_0x0933('0x18')](_0x51cdc6)['end']();};}function respondWithResult(_0x2ec08f,_0x145954){_0x145954=_0x145954||0xc8;return function(_0x5cb5ba){if(_0x5cb5ba){return _0x2ec08f['status'](_0x145954)[_0x0933('0x19')](_0x5cb5ba);}};}function respondWithFilteredResult(_0xb019db,_0x52144e){return function(_0x14b507){if(_0x14b507){var _0x15672a=typeof _0x52144e[_0x0933('0x1a')]===_0x0933('0x1b')&&typeof _0x52144e[_0x0933('0x1c')]===_0x0933('0x1b');var _0x536799=_0x14b507['count'];var _0x1394dd=_0x15672a?0x0:_0x52144e[_0x0933('0x1a')];var _0x2a433e=_0x15672a?_0x14b507[_0x0933('0x1d')]:_0x52144e[_0x0933('0x1a')]+_0x52144e[_0x0933('0x1c')];var _0x1afd61;if(_0x2a433e>=_0x536799){_0x2a433e=_0x536799;_0x1afd61=0xc8;}else{_0x1afd61=0xce;}_0xb019db[_0x0933('0x18')](_0x1afd61);return _0xb019db[_0x0933('0x1e')]('Content-Range',_0x1394dd+'-'+_0x2a433e+'/'+_0x536799)['json'](_0x14b507);}return null;};}function patchUpdates(_0x30f857){return function(_0x5a5eae){try{jsonpatch[_0x0933('0x1f')](_0x5a5eae,_0x30f857,!![]);}catch(_0x220511){return BPromise['reject'](_0x220511);}return _0x5a5eae[_0x0933('0x20')]();};}function saveUpdates(_0x28e7fe,_0x427d39){return function(_0x5b46ca){if(_0x5b46ca){return _0x5b46ca[_0x0933('0x21')](_0x28e7fe)[_0x0933('0x22')](function(_0x4374bf){return _0x4374bf;});}return null;};}function removeEntity(_0x59d08c,_0x4ff665){return function(_0x631379){if(_0x631379){return _0x631379[_0x0933('0x23')]()[_0x0933('0x22')](function(){_0x59d08c[_0x0933('0x18')](0xcc)[_0x0933('0x24')]();});}};}function handleEntityNotFound(_0x541511,_0x1fc5be){return function(_0x95bee6){if(!_0x95bee6){_0x541511[_0x0933('0x17')](0x194);}return _0x95bee6;};}function handleError(_0x241b8d,_0x3ab616){_0x3ab616=_0x3ab616||0x1f4;return function(_0x23b187){logger['error'](_0x23b187[_0x0933('0x25')]);if(_0x23b187[_0x0933('0x26')]){delete _0x23b187[_0x0933('0x26')];}_0x241b8d[_0x0933('0x18')](_0x3ab616)['send'](_0x23b187);};}exports[_0x0933('0x27')]=function(_0x277553,_0x5bcb34){var _0x447310={'raw':!![],'where':{'id':_0x277553[_0x0933('0x28')]['id']}},_0x35d37d={};_0x35d37d[_0x0933('0x29')]=_[_0x0933('0x2a')](db[_0x0933('0x2b')]['rawAttributes']);_0x35d37d[_0x0933('0x2c')]=_[_0x0933('0x2a')](_0x277553[_0x0933('0x2c')]);_0x35d37d[_0x0933('0x2d')]=_[_0x0933('0x2e')](_0x35d37d['model'],_0x35d37d[_0x0933('0x2c')]);_0x447310[_0x0933('0x2f')]=_[_0x0933('0x2e')](_0x35d37d[_0x0933('0x29')],qs['fields'](_0x277553['query'][_0x0933('0x30')]));_0x447310[_0x0933('0x2f')]=_0x447310[_0x0933('0x2f')][_0x0933('0x31')]?_0x447310[_0x0933('0x2f')]:_0x35d37d['model'];if(_0x277553['query']['includeAll']){_0x447310[_0x0933('0x32')]=[{'all':!![]}];}_0x447310=_[_0x0933('0x33')]({},_0x447310,_0x277553['options']);return db[_0x0933('0x2b')][_0x0933('0x34')](_0x447310)[_0x0933('0x22')](handleEntityNotFound(_0x5bcb34,null))[_0x0933('0x22')](respondWithResult(_0x5bcb34,null))[_0x0933('0x35')](handleError(_0x5bcb34,null));};exports[_0x0933('0x36')]=function(_0x8a752e,_0x1625db){return db['ChatProactiveAction']['create'](_0x8a752e['body'],{})['then'](respondWithResult(_0x1625db,0xc9))[_0x0933('0x35')](handleError(_0x1625db,null));};exports[_0x0933('0x21')]=function(_0x306f49,_0x1a4c2f){if(_0x306f49[_0x0933('0x37')]['id']){delete _0x306f49[_0x0933('0x37')]['id'];}return db[_0x0933('0x2b')][_0x0933('0x34')]({'where':{'id':_0x306f49[_0x0933('0x28')]['id']}})[_0x0933('0x22')](handleEntityNotFound(_0x1a4c2f,null))[_0x0933('0x22')](saveUpdates(_0x306f49['body'],null))['then'](respondWithResult(_0x1a4c2f,null))[_0x0933('0x35')](handleError(_0x1a4c2f,null));};exports[_0x0933('0x23')]=function(_0xc3784b,_0x370696){return db[_0x0933('0x2b')][_0x0933('0x34')]({'where':{'id':_0xc3784b[_0x0933('0x28')]['id']}})[_0x0933('0x22')](handleEntityNotFound(_0x370696,null))['then'](removeEntity(_0x370696,null))[_0x0933('0x35')](handleError(_0x370696,null));}; \ No newline at end of file +var _0xab86=['end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','include','merge','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status'];(function(_0x31fcb9,_0x350d71){var _0xb1eee9=function(_0x47226f){while(--_0x47226f){_0x31fcb9['push'](_0x31fcb9['shift']());}};_0xb1eee9(++_0x350d71);}(_0xab86,0x13e));var _0x6ab8=function(_0x13d991,_0x1ec93f){_0x13d991=_0x13d991-0x0;var _0x47d0ca=_0xab86[_0x13d991];return _0x47d0ca;};'use strict';var emlformat=require(_0x6ab8('0x0'));var rimraf=require(_0x6ab8('0x1'));var zipdir=require(_0x6ab8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ab8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ab8('0x4'));var util=require('util');var path=require(_0x6ab8('0x5'));var sox=require(_0x6ab8('0x6'));var csv=require(_0x6ab8('0x7'));var ejs=require(_0x6ab8('0x8'));var fs=require('fs');var fs_extra=require(_0x6ab8('0x9'));var _=require(_0x6ab8('0xa'));var squel=require(_0x6ab8('0xb'));var crypto=require(_0x6ab8('0xc'));var jsforce=require(_0x6ab8('0xd'));var deskjs=require(_0x6ab8('0xe'));var toCsv=require(_0x6ab8('0x7'));var querystring=require(_0x6ab8('0xf'));var Papa=require(_0x6ab8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6ab8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ab8('0x12'));var logger=require(_0x6ab8('0x13'))(_0x6ab8('0x14'));var utils=require('../../config/utils');var config=require(_0x6ab8('0x15'));var licenseUtil=require(_0x6ab8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d1d9,_0x1b9b34){_0x1b9b34=_0x1b9b34||0xcc;return function(_0x408ce1){if(_0x408ce1){return _0x44d1d9['sendStatus'](_0x1b9b34);}return _0x44d1d9[_0x6ab8('0x17')](_0x1b9b34)[_0x6ab8('0x18')]();};}function respondWithResult(_0x60b50,_0x968bac){_0x968bac=_0x968bac||0xc8;return function(_0x1c83a1){if(_0x1c83a1){return _0x60b50[_0x6ab8('0x17')](_0x968bac)[_0x6ab8('0x19')](_0x1c83a1);}};}function respondWithFilteredResult(_0x2043bb,_0x293389){return function(_0x5218e9){if(_0x5218e9){var _0x1f64a3=typeof _0x293389[_0x6ab8('0x1a')]===_0x6ab8('0x1b')&&typeof _0x293389['limit']===_0x6ab8('0x1b');var _0x35b790=_0x5218e9['count'];var _0x543726=_0x1f64a3?0x0:_0x293389[_0x6ab8('0x1a')];var _0x57cd18=_0x1f64a3?_0x5218e9[_0x6ab8('0x1c')]:_0x293389[_0x6ab8('0x1a')]+_0x293389[_0x6ab8('0x1d')];var _0x4e0fbd;if(_0x57cd18>=_0x35b790){_0x57cd18=_0x35b790;_0x4e0fbd=0xc8;}else{_0x4e0fbd=0xce;}_0x2043bb[_0x6ab8('0x17')](_0x4e0fbd);return _0x2043bb[_0x6ab8('0x1e')](_0x6ab8('0x1f'),_0x543726+'-'+_0x57cd18+'/'+_0x35b790)[_0x6ab8('0x19')](_0x5218e9);}return null;};}function patchUpdates(_0x5227c6){return function(_0x301004){try{jsonpatch[_0x6ab8('0x20')](_0x301004,_0x5227c6,!![]);}catch(_0x520cd8){return BPromise['reject'](_0x520cd8);}return _0x301004['save']();};}function saveUpdates(_0x190af2,_0x46cfdc){return function(_0xe2d5d8){if(_0xe2d5d8){return _0xe2d5d8['update'](_0x190af2)[_0x6ab8('0x21')](function(_0x433f37){return _0x433f37;});}return null;};}function removeEntity(_0x50fc50,_0x503f94){return function(_0x8af7e9){if(_0x8af7e9){return _0x8af7e9[_0x6ab8('0x22')]()['then'](function(){_0x50fc50[_0x6ab8('0x17')](0xcc)[_0x6ab8('0x18')]();});}};}function handleEntityNotFound(_0x24e400,_0x3d614b){return function(_0x3ddaeb){if(!_0x3ddaeb){_0x24e400[_0x6ab8('0x23')](0x194);}return _0x3ddaeb;};}function handleError(_0x2e098f,_0x1e26ed){_0x1e26ed=_0x1e26ed||0x1f4;return function(_0x5a1be3){logger['error'](_0x5a1be3[_0x6ab8('0x24')]);if(_0x5a1be3['name']){delete _0x5a1be3[_0x6ab8('0x25')];}_0x2e098f[_0x6ab8('0x17')](_0x1e26ed)[_0x6ab8('0x26')](_0x5a1be3);};}exports['show']=function(_0x525687,_0x4871e3){var _0x79dbd3={'raw':!![],'where':{'id':_0x525687[_0x6ab8('0x27')]['id']}},_0x14e822={};_0x14e822[_0x6ab8('0x28')]=_[_0x6ab8('0x29')](db[_0x6ab8('0x2a')][_0x6ab8('0x2b')]);_0x14e822[_0x6ab8('0x2c')]=_[_0x6ab8('0x29')](_0x525687[_0x6ab8('0x2c')]);_0x14e822[_0x6ab8('0x2d')]=_[_0x6ab8('0x2e')](_0x14e822[_0x6ab8('0x28')],_0x14e822['query']);_0x79dbd3['attributes']=_[_0x6ab8('0x2e')](_0x14e822['model'],qs['fields'](_0x525687[_0x6ab8('0x2c')][_0x6ab8('0x2f')]));_0x79dbd3['attributes']=_0x79dbd3[_0x6ab8('0x30')]['length']?_0x79dbd3[_0x6ab8('0x30')]:_0x14e822[_0x6ab8('0x28')];if(_0x525687['query']['includeAll']){_0x79dbd3[_0x6ab8('0x31')]=[{'all':!![]}];}_0x79dbd3=_[_0x6ab8('0x32')]({},_0x79dbd3,_0x525687[_0x6ab8('0x33')]);return db[_0x6ab8('0x2a')][_0x6ab8('0x34')](_0x79dbd3)[_0x6ab8('0x21')](handleEntityNotFound(_0x4871e3,null))[_0x6ab8('0x21')](respondWithResult(_0x4871e3,null))[_0x6ab8('0x35')](handleError(_0x4871e3,null));};exports['create']=function(_0x3f7fa0,_0x3ca7cc){return db[_0x6ab8('0x2a')][_0x6ab8('0x36')](_0x3f7fa0[_0x6ab8('0x37')],{})[_0x6ab8('0x21')](respondWithResult(_0x3ca7cc,0xc9))['catch'](handleError(_0x3ca7cc,null));};exports[_0x6ab8('0x38')]=function(_0x127ceb,_0x29321d){if(_0x127ceb['body']['id']){delete _0x127ceb['body']['id'];}return db[_0x6ab8('0x2a')][_0x6ab8('0x34')]({'where':{'id':_0x127ceb[_0x6ab8('0x27')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0x29321d,null))[_0x6ab8('0x21')](saveUpdates(_0x127ceb['body'],null))['then'](respondWithResult(_0x29321d,null))[_0x6ab8('0x35')](handleError(_0x29321d,null));};exports['destroy']=function(_0x404ff4,_0x9ca6ed){return db['ChatProactiveAction']['find']({'where':{'id':_0x404ff4[_0x6ab8('0x27')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0x9ca6ed,null))[_0x6ab8('0x21')](removeEntity(_0x9ca6ed,null))[_0x6ab8('0x35')](handleError(_0x9ca6ed,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1686383..99d9f0c 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 _0x69ea=['util','api','moment','path','../../config/environment','./chatProactiveAction.attributes','exports','chat_proactive_actions','lodash'];(function(_0x4e1acf,_0x4b1669){var _0x139d96=function(_0x2b8485){while(--_0x2b8485){_0x4e1acf['push'](_0x4e1acf['shift']());}};_0x139d96(++_0x4b1669);}(_0x69ea,0xc5));var _0xa69e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x69ea[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xa69e('0x0'));var util=require(_0xa69e('0x1'));var logger=require('../../config/logger')(_0xa69e('0x2'));var moment=require(_0xa69e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa69e('0x4'));var rimraf=require('rimraf');var config=require(_0xa69e('0x5'));var attributes=require(_0xa69e('0x6'));module[_0xa69e('0x7')]=function(_0x4995e1,_0x1009ee){return _0x4995e1['define']('ChatProactiveAction',attributes,{'tableName':_0xa69e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf9d=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf9d,0xb0));var _0xdaf9=function(_0x3b575d,_0x12d43f){_0x3b575d=_0x3b575d-0x0;var _0x3972e8=_0xaf9d[_0x3b575d];return _0x3972e8;};'use strict';var _=require(_0xdaf9('0x0'));var util=require(_0xdaf9('0x1'));var logger=require(_0xdaf9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdaf9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaf9('0x4'));var config=require(_0xdaf9('0x5'));var attributes=require(_0xdaf9('0x6'));module[_0xdaf9('0x7')]=function(_0x589e6f,_0x19da50){return _0x589e6f[_0xdaf9('0x8')](_0xdaf9('0x9'),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 30adaac..456c91e 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 _0x7e4b=['code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5da745,_0x5e54f2){var _0x4f0eda=function(_0x55635e){while(--_0x55635e){_0x5da745['push'](_0x5da745['shift']());}};_0x4f0eda(++_0x5e54f2);}(_0x7e4b,0x64));var _0xb7e4=function(_0x4cdc0f,_0x1d41da){_0x4cdc0f=_0x4cdc0f-0x0;var _0xae57ee=_0x7e4b[_0x4cdc0f];return _0xae57ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb7e4('0x0'));var BPromise=require(_0xb7e4('0x1'));var rs=require(_0xb7e4('0x2'));var fs=require('fs');var Redis=require(_0xb7e4('0x3'));var db=require(_0xb7e4('0x4'))['db'];var utils=require(_0xb7e4('0x5'));var logger=require(_0xb7e4('0x6'))(_0xb7e4('0x7'));var config=require(_0xb7e4('0x8'));var jayson=require(_0xb7e4('0x9'));var client=jayson[_0xb7e4('0xa')][_0xb7e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29715c,_0x511f0c,_0x256926){return new BPromise(function(_0x1f215c,_0xab55d2){return client['request'](_0x29715c,_0x256926)[_0xb7e4('0xc')](function(_0x17f54e){logger[_0xb7e4('0xd')](_0xb7e4('0xe'),_0x511f0c,_0xb7e4('0xf'));logger[_0xb7e4('0x10')](_0xb7e4('0x11'),_0x511f0c,_0xb7e4('0xf'),JSON[_0xb7e4('0x12')](_0x17f54e));if(_0x17f54e[_0xb7e4('0x13')]){if(_0x17f54e[_0xb7e4('0x13')][_0xb7e4('0x14')]===0x1f4){logger[_0xb7e4('0x13')](_0xb7e4('0xe'),_0x511f0c,_0x17f54e[_0xb7e4('0x13')]['message']);return _0xab55d2(_0x17f54e['error'][_0xb7e4('0x15')]);}logger['error'](_0xb7e4('0xe'),_0x511f0c,_0x17f54e[_0xb7e4('0x13')]['message']);return _0x1f215c(_0x17f54e['error'][_0xb7e4('0x15')]);}else{logger[_0xb7e4('0xd')](_0xb7e4('0xe'),_0x511f0c,_0xb7e4('0xf'));_0x1f215c(_0x17f54e[_0xb7e4('0x16')][_0xb7e4('0x15')]);}})[_0xb7e4('0x17')](function(_0x3fc8df){logger[_0xb7e4('0x13')](_0xb7e4('0xe'),_0x511f0c,_0x3fc8df);_0xab55d2(_0x3fc8df);});});} \ No newline at end of file +var _0x3655=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x45cdf1,_0x22ca1a){var _0xbeea4b=function(_0x1939b5){while(--_0x1939b5){_0x45cdf1['push'](_0x45cdf1['shift']());}};_0xbeea4b(++_0x22ca1a);}(_0x3655,0x152));var _0x5365=function(_0x1496bc,_0x369cd5){_0x1496bc=_0x1496bc-0x0;var _0x4f8978=_0x3655[_0x1496bc];return _0x4f8978;};'use strict';var _=require(_0x5365('0x0'));var util=require(_0x5365('0x1'));var moment=require(_0x5365('0x2'));var BPromise=require(_0x5365('0x3'));var rs=require(_0x5365('0x4'));var fs=require('fs');var Redis=require(_0x5365('0x5'));var db=require(_0x5365('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5365('0x7'))(_0x5365('0x8'));var config=require('../../config/environment');var jayson=require(_0x5365('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3259a9,_0x4e0096,_0x17072a){return new BPromise(function(_0x1df10a,_0x5444e6){return client['request'](_0x3259a9,_0x17072a)[_0x5365('0xa')](function(_0x4ce0db){logger[_0x5365('0xb')](_0x5365('0xc'),_0x4e0096,'request\x20sent');logger[_0x5365('0xd')](_0x5365('0xe'),_0x4e0096,_0x5365('0xf'),JSON[_0x5365('0x10')](_0x4ce0db));if(_0x4ce0db[_0x5365('0x11')]){if(_0x4ce0db['error'][_0x5365('0x12')]===0x1f4){logger[_0x5365('0x11')](_0x5365('0xc'),_0x4e0096,_0x4ce0db[_0x5365('0x11')][_0x5365('0x13')]);return _0x5444e6(_0x4ce0db['error']['message']);}logger[_0x5365('0x11')](_0x5365('0xc'),_0x4e0096,_0x4ce0db['error']['message']);return _0x1df10a(_0x4ce0db[_0x5365('0x11')]['message']);}else{logger[_0x5365('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x4e0096,_0x5365('0xf'));_0x1df10a(_0x4ce0db[_0x5365('0x14')][_0x5365('0x13')]);}})['catch'](function(_0x162f74){logger[_0x5365('0x11')](_0x5365('0xc'),_0x4e0096,_0x162f74);_0x5444e6(_0x162f74);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 14ee73f..8822750 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x102382,_0x28c7ec){var _0x2adc79=function(_0x3babb1){while(--_0x3babb1){_0x102382['push'](_0x102382['shift']());}};_0x2adc79(++_0x28c7ec);}(_0xf494,0x1c6));var _0x4f49=function(_0x31e549,_0x331ce8){_0x31e549=_0x31e549-0x0;var _0x1e8bb6=_0xf494[_0x31e549];return _0x1e8bb6;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller['destroy']);module[_0x4f49('0x12')]=router; \ No newline at end of file +var _0xee14=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x1deb37,_0x378557){var _0x50a1b0=function(_0x4c5baf){while(--_0x4c5baf){_0x1deb37['push'](_0x1deb37['shift']());}};_0x50a1b0(++_0x378557);}(_0xee14,0x13a));var _0x4ee1=function(_0x245de5,_0x14c67b){_0x245de5=_0x245de5-0x0;var _0x36cc78=_0xee14[_0x245de5];return _0x36cc78;};'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'](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xa')]);router[_0x4ee1('0xb')]('/',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0xd')]);router[_0x4ee1('0xe')](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')]('/:id',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0x11')]);module[_0x4ee1('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b01439d..4a393d0 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 _0x110f=['rrmemory','roundrobin','STRING','name','INTEGER','ENUM'];(function(_0x19f728,_0x557141){var _0x5e03bb=function(_0x5ecb5b){while(--_0x5ecb5b){_0x19f728['push'](_0x19f728['shift']());}};_0x5e03bb(++_0x557141);}(_0x110f,0x134));var _0xf110=function(_0x191fdb,_0x49b69b){_0x191fdb=_0x191fdb-0x0;var _0x3e3796=_0x110f[_0x191fdb];return _0x3e3796;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf110('0x0')],'unique':_0xf110('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf110('0x0')]},'timeout':{'type':Sequelize[_0xf110('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf110('0x3')](_0xf110('0x4'),'beepall',_0xf110('0x5'))}}; \ No newline at end of file +var _0xfa5f=['roundrobin','exports','STRING','INTEGER','rrmemory'];(function(_0x36f349,_0x895395){var _0xde9e3=function(_0x55c18a){while(--_0x55c18a){_0x36f349['push'](_0x36f349['shift']());}};_0xde9e3(++_0x895395);}(_0xfa5f,0x88));var _0xffa5=function(_0x5bcf88,_0x2ed091){_0x5bcf88=_0x5bcf88-0x0;var _0x5525be=_0xfa5f[_0x5bcf88];return _0x5525be;};'use strict';var Sequelize=require('sequelize');module[_0xffa5('0x0')]={'name':{'type':Sequelize[_0xffa5('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xffa5('0x1')]},'timeout':{'type':Sequelize[_0xffa5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xffa5('0x3'),'beepall',_0xffa5('0x4'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2a5ab40..e646eaf 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 _0x428f=['where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','length','find','create','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','params','addTeams','Team','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','userChatQueue:save','ids','User','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','Agents','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','transaction','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','client','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','map','ChatQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x56ff21,_0x1cb31c){var _0x5fc28d=function(_0x5f2d0f){while(--_0x5f2d0f){_0x56ff21['push'](_0x56ff21['shift']());}};_0x5fc28d(++_0x1cb31c);}(_0x428f,0xdc));var _0xf428=function(_0x58a4d1,_0x15d225){_0x58a4d1=_0x58a4d1-0x0;var _0x4690c1=_0x428f[_0x58a4d1];return _0x4690c1;};'use strict';var emlformat=require(_0xf428('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf428('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf428('0x2'));var moment=require(_0xf428('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf428('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf428('0x5'));var csv=require('to-csv');var ejs=require(_0xf428('0x6'));var fs=require('fs');var fs_extra=require(_0xf428('0x7'));var _=require(_0xf428('0x8'));var squel=require(_0xf428('0x9'));var crypto=require(_0xf428('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf428('0xb'));var toCsv=require(_0xf428('0xc'));var querystring=require('querystring');var Papa=require(_0xf428('0xd'));var Redis=require(_0xf428('0xe'));var authService=require(_0xf428('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf428('0x10'));var hardwareService=require(_0xf428('0x11'));var logger=require('../../config/logger')(_0xf428('0x12'));var utils=require('../../config/utils');var config=require(_0xf428('0x13'));var licenseUtil=require(_0xf428('0x14'));var db=require(_0xf428('0x15'))['db'];config[_0xf428('0x16')]=_['defaults'](config[_0xf428('0x16')],{'host':_0xf428('0x17'),'port':0x18eb});var socket=require(_0xf428('0x18'))(new Redis(config[_0xf428('0x16')]));require(_0xf428('0x19'))[_0xf428('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf428('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7b296,_0x61792,_0x439d58,_0x205bec){return new BPromise(function(_0x1e214c,_0x191fb1){var _0x2f174e=_0x205bec||client;return _0x2f174e['request'](_0xc7b296,_0x439d58)['then'](function(_0x126308){logger[_0xf428('0x1c')](_0xf428('0x1d'),_0x61792,_0xf428('0x1e'));logger[_0xf428('0x1f')](_0xf428('0x20'),_0x61792,_0xf428('0x1e'),JSON[_0xf428('0x21')](_0x126308));if(_0x126308[_0xf428('0x22')]){if(_0x126308[_0xf428('0x22')]['code']===0x1f4){logger[_0xf428('0x22')](_0xf428('0x1d'),_0x61792,_0x126308[_0xf428('0x22')][_0xf428('0x23')]);return _0x191fb1(_0x126308[_0xf428('0x22')][_0xf428('0x23')]);}logger[_0xf428('0x22')](_0xf428('0x1d'),_0x61792,_0x126308['error'][_0xf428('0x23')]);return _0x1e214c(_0x126308['error']['message']);}else{logger[_0xf428('0x1c')]('ChatQueue,\x20%s,\x20%s',_0x61792,_0xf428('0x1e'));_0x1e214c(_0x126308[_0xf428('0x24')][_0xf428('0x23')]);}})[_0xf428('0x25')](function(_0x4dd4b3){logger[_0xf428('0x22')]('ChatQueue,\x20%s,\x20%s',_0x61792,_0x4dd4b3);_0x191fb1(_0x4dd4b3);});});}function respondWithStatusCode(_0x5daca3,_0x34ff87){_0x34ff87=_0x34ff87||0xcc;return function(_0x487978){if(_0x487978){return _0x5daca3[_0xf428('0x26')](_0x34ff87);}return _0x5daca3[_0xf428('0x27')](_0x34ff87)['end']();};}function respondWithResult(_0x47dd20,_0x1322a4){_0x1322a4=_0x1322a4||0xc8;return function(_0x11573b){if(_0x11573b){return _0x47dd20[_0xf428('0x27')](_0x1322a4)[_0xf428('0x28')](_0x11573b);}};}function respondWithFilteredResult(_0x56b37a,_0x45af8d){return function(_0x2b11fc){if(_0x2b11fc){var _0x2c8dc9=typeof _0x45af8d[_0xf428('0x29')]===_0xf428('0x2a')&&typeof _0x45af8d[_0xf428('0x2b')]===_0xf428('0x2a');var _0x571456=_0x2b11fc[_0xf428('0x2c')];var _0x1d706d=_0x2c8dc9?0x0:_0x45af8d[_0xf428('0x29')];var _0x1967c4=_0x2c8dc9?_0x2b11fc[_0xf428('0x2c')]:_0x45af8d[_0xf428('0x29')]+_0x45af8d[_0xf428('0x2b')];var _0x43d11d;if(_0x1967c4>=_0x571456){_0x1967c4=_0x571456;_0x43d11d=0xc8;}else{_0x43d11d=0xce;}_0x56b37a[_0xf428('0x27')](_0x43d11d);return _0x56b37a[_0xf428('0x2d')](_0xf428('0x2e'),_0x1d706d+'-'+_0x1967c4+'/'+_0x571456)[_0xf428('0x28')](_0x2b11fc);}return null;};}function patchUpdates(_0x3ef408){return function(_0x2b49db){try{jsonpatch[_0xf428('0x2f')](_0x2b49db,_0x3ef408,!![]);}catch(_0x6ea9a0){return BPromise[_0xf428('0x30')](_0x6ea9a0);}return _0x2b49db[_0xf428('0x31')]();};}function saveUpdates(_0x1d93f4,_0x5b2722){return function(_0x44eca0){if(_0x44eca0){return _0x44eca0[_0xf428('0x32')](_0x1d93f4)[_0xf428('0x33')](function(_0x4db76f){return _0x4db76f;});}return null;};}function removeEntity(_0x171bfe,_0x317424){return function(_0x572cee){if(_0x572cee){return _0x572cee[_0xf428('0x34')]()['then'](function(){var _0x1d01b3=_0x572cee[_0xf428('0x35')]({'plain':!![]});var _0x146230=_0xf428('0x36');return db[_0xf428('0x37')][_0xf428('0x34')]({'where':{'type':_0x146230,'resourceId':_0x1d01b3['id']}})[_0xf428('0x33')](function(){return _0x572cee;});})[_0xf428('0x33')](function(){_0x171bfe[_0xf428('0x27')](0xcc)[_0xf428('0x38')]();});}};}function handleEntityNotFound(_0x287795,_0x2e3de6){return function(_0x2215a4){if(!_0x2215a4){_0x287795[_0xf428('0x26')](0x194);}return _0x2215a4;};}function handleError(_0x169be9,_0x7e1de5){_0x7e1de5=_0x7e1de5||0x1f4;return function(_0x513dc1){logger[_0xf428('0x22')](_0x513dc1[_0xf428('0x39')]);if(_0x513dc1[_0xf428('0x3a')]){delete _0x513dc1[_0xf428('0x3a')];}_0x169be9['status'](_0x7e1de5)[_0xf428('0x3b')](_0x513dc1);};}exports['index']=function(_0x10e16d,_0x4a9699){var _0x188ea6={},_0xb37aa6={},_0xc61bae={'count':0x0,'rows':[]};var _0x33f35c=_[_0xf428('0x3c')](db[_0xf428('0x3d')][_0xf428('0x3e')],function(_0x20e42d){return{'name':_0x20e42d[_0xf428('0x3f')],'type':_0x20e42d['type'][_0xf428('0x40')]};});_0xb37aa6['model']=_[_0xf428('0x3c')](_0x33f35c,_0xf428('0x3a'));_0xb37aa6[_0xf428('0x41')]=_[_0xf428('0x42')](_0x10e16d[_0xf428('0x41')]);_0xb37aa6[_0xf428('0x43')]=_[_0xf428('0x44')](_0xb37aa6[_0xf428('0x45')],_0xb37aa6[_0xf428('0x41')]);_0x188ea6[_0xf428('0x46')]=_['intersection'](_0xb37aa6[_0xf428('0x45')],qs['fields'](_0x10e16d[_0xf428('0x41')][_0xf428('0x47')]));_0x188ea6['attributes']=_0x188ea6[_0xf428('0x46')]['length']?_0x188ea6[_0xf428('0x46')]:_0xb37aa6[_0xf428('0x45')];if(!_0x10e16d[_0xf428('0x41')][_0xf428('0x48')](_0xf428('0x49'))){_0x188ea6[_0xf428('0x2b')]=qs[_0xf428('0x2b')](_0x10e16d[_0xf428('0x41')][_0xf428('0x2b')]);_0x188ea6[_0xf428('0x29')]=qs['offset'](_0x10e16d[_0xf428('0x41')][_0xf428('0x29')]);}_0x188ea6[_0xf428('0x4a')]=qs[_0xf428('0x4b')](_0x10e16d[_0xf428('0x41')][_0xf428('0x4b')]);_0x188ea6[_0xf428('0x4c')]=qs['filters'](_[_0xf428('0x4d')](_0x10e16d[_0xf428('0x41')],_0xb37aa6['filters']),_0x33f35c);if(_0x10e16d[_0xf428('0x41')][_0xf428('0x4e')]){_0x188ea6[_0xf428('0x4c')]=_[_0xf428('0x4f')](_0x188ea6[_0xf428('0x4c')],{'$or':_[_0xf428('0x3c')](_0x33f35c,function(_0x4132f0){if(_0x4132f0[_0xf428('0x50')]!=='VIRTUAL'){var _0x1f1a85={};_0x1f1a85[_0x4132f0[_0xf428('0x3a')]]={'$like':'%'+_0x10e16d[_0xf428('0x41')][_0xf428('0x4e')]+'%'};return _0x1f1a85;}})});}_0x188ea6=_['merge']({},_0x188ea6,_0x10e16d[_0xf428('0x51')]);var _0x5d02c8={'where':_0x188ea6[_0xf428('0x4c')]};return db[_0xf428('0x3d')][_0xf428('0x2c')](_0x5d02c8)['then'](function(_0x27616f){_0xc61bae[_0xf428('0x2c')]=_0x27616f;if(_0x10e16d['query'][_0xf428('0x52')]){_0x188ea6[_0xf428('0x53')]=[{'all':!![]}];}return db['ChatQueue'][_0xf428('0x54')](_0x188ea6);})[_0xf428('0x33')](function(_0x5a4fb0){_0xc61bae[_0xf428('0x55')]=_0x5a4fb0;return _0xc61bae;})[_0xf428('0x33')](respondWithFilteredResult(_0x4a9699,_0x188ea6))['catch'](handleError(_0x4a9699,null));};exports[_0xf428('0x56')]=function(_0x308775,_0x5ee42b){var _0x3653df={'raw':!![],'where':{'id':_0x308775['params']['id']}},_0x3cf548={};_0x3cf548[_0xf428('0x45')]=_[_0xf428('0x42')](db[_0xf428('0x3d')][_0xf428('0x3e')]);_0x3cf548[_0xf428('0x41')]=_[_0xf428('0x42')](_0x308775['query']);_0x3cf548[_0xf428('0x43')]=_[_0xf428('0x44')](_0x3cf548['model'],_0x3cf548[_0xf428('0x41')]);_0x3653df['attributes']=_[_0xf428('0x44')](_0x3cf548[_0xf428('0x45')],qs['fields'](_0x308775[_0xf428('0x41')][_0xf428('0x47')]));_0x3653df[_0xf428('0x46')]=_0x3653df[_0xf428('0x46')][_0xf428('0x57')]?_0x3653df['attributes']:_0x3cf548['model'];if(_0x308775[_0xf428('0x41')][_0xf428('0x52')]){_0x3653df[_0xf428('0x53')]=[{'all':!![]}];}_0x3653df=_[_0xf428('0x4f')]({},_0x3653df,_0x308775['options']);return db['ChatQueue'][_0xf428('0x58')](_0x3653df)[_0xf428('0x33')](handleEntityNotFound(_0x5ee42b,null))[_0xf428('0x33')](respondWithResult(_0x5ee42b,null))[_0xf428('0x25')](handleError(_0x5ee42b,null));};exports[_0xf428('0x59')]=function(_0x373fd8,_0x216fd7){return db['ChatQueue']['create'](_0x373fd8['body'],{})[_0xf428('0x33')](function(_0x2a7b6f){var _0x4b6a4f=_0x373fd8[_0xf428('0x5a')][_0xf428('0x35')]({'plain':!![]});if(!_0x4b6a4f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b6a4f[_0xf428('0x5b')]===_0xf428('0x5a')){var _0x10a2f8=_0x2a7b6f[_0xf428('0x35')]({'plain':!![]});var _0x20ac09='ChatQueues';return db[_0xf428('0x5c')][_0xf428('0x58')]({'where':{'name':_0x20ac09,'userProfileId':_0x4b6a4f['userProfileId']},'raw':!![]})[_0xf428('0x33')](function(_0x52dbb1){if(_0x52dbb1&&_0x52dbb1['autoAssociation']===0x0){return db[_0xf428('0x37')][_0xf428('0x59')]({'name':_0x10a2f8['name'],'resourceId':_0x10a2f8['id'],'type':_0x52dbb1['name'],'sectionId':_0x52dbb1['id']},{})[_0xf428('0x33')](function(){return _0x2a7b6f;});}else{return _0x2a7b6f;}})[_0xf428('0x25')](function(_0x1d6f15){logger[_0xf428('0x22')](_0xf428('0x5d'),_0x1d6f15);throw _0x1d6f15;});}return _0x2a7b6f;})[_0xf428('0x33')](respondWithResult(_0x216fd7,0xc9))['catch'](handleError(_0x216fd7,null));};exports[_0xf428('0x32')]=function(_0x5768aa,_0x36ca90){if(_0x5768aa['body']['id']){delete _0x5768aa[_0xf428('0x5e')]['id'];}return db[_0xf428('0x3d')]['find']({'where':{'id':_0x5768aa['params']['id']}})[_0xf428('0x33')](handleEntityNotFound(_0x36ca90,null))[_0xf428('0x33')](saveUpdates(_0x5768aa[_0xf428('0x5e')],null))[_0xf428('0x33')](respondWithResult(_0x36ca90,null))[_0xf428('0x25')](handleError(_0x36ca90,null));};exports[_0xf428('0x34')]=function(_0x4bc7b9,_0x3360af){return db[_0xf428('0x3d')][_0xf428('0x58')]({'where':{'id':_0x4bc7b9['params']['id']}})['then'](handleEntityNotFound(_0x3360af,null))[_0xf428('0x33')](removeEntity(_0x3360af,null))[_0xf428('0x25')](handleError(_0x3360af,null));};exports[_0xf428('0x5f')]=function(_0x9de570,_0x5685c8){return db[_0xf428('0x3d')][_0xf428('0x5f')]()[_0xf428('0x33')](respondWithResult(_0x5685c8,null))[_0xf428('0x25')](handleError(_0x5685c8,null));};exports['getMembers']=function(_0x2366a6,_0x5dd428,_0x583c47){var _0x2582ac={'raw':!![],'where':{}},_0x2b9ab2={},_0x127a6c;return db['ChatQueue'][_0xf428('0x60')]({'where':{'id':_0x2366a6['params']['id']}})[_0xf428('0x33')](handleEntityNotFound(_0x5dd428,null))[_0xf428('0x33')](function(_0x33162a){if(_0x33162a){_0x127a6c=_0x33162a['get']({'plain':!![]});_0x2b9ab2[_0xf428('0x45')]=_['keys'](db[_0xf428('0x61')]['rawAttributes']);_0x2b9ab2['query']=_[_0xf428('0x42')](_0x2366a6[_0xf428('0x41')]);_0x2b9ab2[_0xf428('0x43')]=_[_0xf428('0x44')](_0x2b9ab2[_0xf428('0x45')],_0x2b9ab2['query']);_0x2582ac['attributes']=_[_0xf428('0x44')](_0x2b9ab2[_0xf428('0x45')],qs[_0xf428('0x47')](_0x2366a6[_0xf428('0x41')][_0xf428('0x47')]));_0x2582ac[_0xf428('0x46')]=_0x2582ac[_0xf428('0x46')][_0xf428('0x57')]?_0x2582ac[_0xf428('0x46')]:_0x2b9ab2['model'];if(!_0x2366a6[_0xf428('0x41')][_0xf428('0x48')]('nolimit')){_0x2582ac[_0xf428('0x2b')]=qs[_0xf428('0x2b')](_0x2366a6[_0xf428('0x41')][_0xf428('0x2b')]);_0x2582ac[_0xf428('0x29')]=qs[_0xf428('0x29')](_0x2366a6[_0xf428('0x41')][_0xf428('0x29')]);}_0x2582ac[_0xf428('0x4a')]=qs[_0xf428('0x4b')](_0x2366a6[_0xf428('0x41')][_0xf428('0x4b')]);_0x2582ac[_0xf428('0x4c')]=qs[_0xf428('0x43')](_['pick'](_0x2366a6[_0xf428('0x41')],_0x2b9ab2[_0xf428('0x43')]));_0x2582ac[_0xf428('0x4c')][_0xf428('0x62')]=_0x33162a['id'];if(_0x2366a6['query'][_0xf428('0x4e')]){_0x2582ac[_0xf428('0x4c')]=_[_0xf428('0x4f')](_0x2582ac[_0xf428('0x4c')],{'$or':_[_0xf428('0x3c')](_0x2582ac[_0xf428('0x46')],function(_0xf03f9e){var _0x3210a0={};_0x3210a0[_0xf03f9e]={'$like':'%'+_0x2366a6[_0xf428('0x41')]['filter']+'%'};return _0x3210a0;})});}_0x2582ac=_[_0xf428('0x4f')]({},_0x2582ac,_0x2366a6[_0xf428('0x51')]);return db['UserChatQueue'][_0xf428('0x54')](_0x2582ac);}})['then'](function(_0x51c4ca){if(_0x51c4ca){return db['User'][_0xf428('0x63')]({'where':{'id':_[_0xf428('0x3c')](_0x51c4ca,_0xf428('0x64')),'role':_0xf428('0x65')},'attributes':['id','name',_0xf428('0x66'),_0xf428('0x67'),_0xf428('0x68')]});}})[_0xf428('0x33')](function(_0x446216){if(_0x446216){return{'count':_0x446216['count'],'rows':_[_0xf428('0x3c')](_0x446216['rows'],function(_0x1b839c){return{'membername':_0x1b839c['name'],'UserId':_0x1b839c['id'],'queue_name':_0x127a6c['name'],'ChatQueueId':_0x127a6c['id'],'interface':util[_0xf428('0x69')](_0xf428('0x6a'),_0xf428('0x6b'),_0x1b839c['name']),'penalty':0x0,'paused':_0x1b839c[_0xf428('0x66')],'createdAt':_0x1b839c[_0xf428('0x68')],'updatedAt':_0x1b839c[_0xf428('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf428('0x33')](respondWithFilteredResult(_0x5dd428,_0x2582ac))[_0xf428('0x25')](handleError(_0x5dd428,null));};exports[_0xf428('0x6c')]=function(_0x597540,_0x5c1371,_0x2ebcb8){var _0x3d8bb4={};var _0xa2dadc={};var _0x434ec4;var _0xe054c3;return db['ChatQueue'][_0xf428('0x60')]({'where':{'id':_0x597540[_0xf428('0x6d')]['id']}})[_0xf428('0x33')](handleEntityNotFound(_0x5c1371,null))[_0xf428('0x33')](function(_0x6bd0a9){if(_0x6bd0a9){_0x434ec4=_0x6bd0a9;_0xa2dadc[_0xf428('0x45')]=_[_0xf428('0x42')](db['Team'][_0xf428('0x3e')]);_0xa2dadc[_0xf428('0x41')]=_[_0xf428('0x42')](_0x597540[_0xf428('0x41')]);_0xa2dadc[_0xf428('0x43')]=_[_0xf428('0x44')](_0xa2dadc[_0xf428('0x45')],_0xa2dadc[_0xf428('0x41')]);_0x3d8bb4[_0xf428('0x46')]=_['intersection'](_0xa2dadc[_0xf428('0x45')],qs[_0xf428('0x47')](_0x597540[_0xf428('0x41')][_0xf428('0x47')]));_0x3d8bb4[_0xf428('0x46')]=_0x3d8bb4[_0xf428('0x46')][_0xf428('0x57')]?_0x3d8bb4['attributes']:_0xa2dadc[_0xf428('0x45')];_0x3d8bb4[_0xf428('0x4a')]=qs['sort'](_0x597540[_0xf428('0x41')]['sort']);_0x3d8bb4[_0xf428('0x4c')]=qs[_0xf428('0x43')](_[_0xf428('0x4d')](_0x597540[_0xf428('0x41')],_0xa2dadc[_0xf428('0x43')]));if(_0x597540['query']['filter']){_0x3d8bb4['where']=_[_0xf428('0x4f')](_0x3d8bb4[_0xf428('0x4c')],{'$or':_[_0xf428('0x3c')](_0x3d8bb4[_0xf428('0x46')],function(_0x3b0a0a){var _0x10f12b={};_0x10f12b[_0x3b0a0a]={'$like':'%'+_0x597540[_0xf428('0x41')][_0xf428('0x4e')]+'%'};return _0x10f12b;})});}_0x3d8bb4=_[_0xf428('0x4f')]({},_0x3d8bb4,_0x597540['options']);return _0x434ec4['getTeams'](_0x3d8bb4);}})[_0xf428('0x33')](function(_0xdbc3ae){if(_0xdbc3ae){_0xe054c3=_0xdbc3ae[_0xf428('0x57')];if(!_0x597540['query'][_0xf428('0x48')]('nolimit')){_0x3d8bb4[_0xf428('0x2b')]=qs[_0xf428('0x2b')](_0x597540[_0xf428('0x41')][_0xf428('0x2b')]);_0x3d8bb4['offset']=qs[_0xf428('0x29')](_0x597540[_0xf428('0x41')][_0xf428('0x29')]);}return _0x434ec4[_0xf428('0x6c')](_0x3d8bb4);}})[_0xf428('0x33')](function(_0x158626){if(_0x158626){return _0x158626?{'count':_0xe054c3,'rows':_0x158626}:null;}})['then'](respondWithResult(_0x5c1371,null))['catch'](handleError(_0x5c1371,null));};exports[_0xf428('0x6e')]=function(_0x16650f,_0x12c417,_0xef6222){var _0x30cd46=_0x16650f[_0xf428('0x5e')]['ids'];return db[_0xf428('0x6f')][_0xf428('0x54')]({'where':{'id':_0x30cd46},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf428('0x3a'),_0xf428('0x70'),_0xf428('0x71'),'interface'],'raw':!![]}]})[_0xf428('0x33')](function(_0x439f1c){if(_0x439f1c){var _0x19a56b=_[_0xf428('0x72')](_0x439f1c,function(_0x440383){var _0x30ac05=_0x440383[_0xf428('0x35')]({'plain':!![]});return _0x30ac05['Agents'];});return db[_0xf428('0x3d')][_0xf428('0x58')]({'where':{'id':_0x16650f[_0xf428('0x6d')]['id']}})[_0xf428('0x33')](function(_0x28f577){return db[_0xf428('0x73')]['transaction'](function(_0x2a55cc){return _0x28f577['addTeams'](_0x30cd46,{'transaction':_0x2a55cc})[_0xf428('0x33')](function(){return BPromise[_0xf428('0x74')](_0x19a56b,function(_0x249788){return db['UserChatQueue'][_0xf428('0x75')]({'where':{'UserId':_0x249788['id'],'ChatQueueId':_0x16650f[_0xf428('0x6d')]['id']},'transaction':_0x2a55cc});});})[_0xf428('0x33')](function(){_0x19a56b[_0xf428('0x76')](function(_0x93be4c){socket['emit'](_0xf428('0x77'),{'UserId':_0x93be4c['id'],'ChatQueueId':_0x28f577['id']});});});});});}})[_0xf428('0x33')](respondWithStatusCode(_0x12c417,null))[_0xf428('0x25')](handleError(_0x12c417,null));};exports['removeTeams']=function(_0x239727,_0x11ecb9,_0x11bac1){return db[_0xf428('0x6f')]['findAll']({'where':{'id':_0x239727[_0xf428('0x41')][_0xf428('0x78')]},'attributes':['id'],'include':[{'model':db[_0xf428('0x79')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf428('0x33')](handleEntityNotFound(_0x11ecb9,null))['then'](function(_0x3cf613){var _0x3ed8f8=_[_0xf428('0x3c')](_0x3cf613,'id');var _0x292f4e=[];var _0x4b3c43=[];var _0x49effc=squel[_0xf428('0x7a')]();_0x49effc['field'](_0xf428('0x7b'))[_0xf428('0x7c')]('team_has_chat_queues','tq')[_0xf428('0x7d')](_0xf428('0x7e'),'ut',_0xf428('0x7f'))['where'](_0xf428('0x80'),_0x239727[_0xf428('0x6d')]['id']);for(var _0x3b739a=0x0;_0x3b739a<_0x3cf613[_0xf428('0x57')];_0x3b739a+=0x1){let _0x3b4e57=_0x3cf613[_0x3b739a];for(var _0x226c07=0x0;_0x226c07<_0x3b4e57[_0xf428('0x81')][_0xf428('0x57')];_0x226c07+=0x1){let _0x5544c1=_0x3b4e57[_0xf428('0x81')][_0x226c07];var _0x4ee627=_0x49effc['clone']();_0x4ee627[_0xf428('0x4c')](_0xf428('0x82'),_0x5544c1['id']);_0x4b3c43['push'](db[_0xf428('0x73')][_0xf428('0x41')](_0x4ee627[_0xf428('0x83')](),{'type':db[_0xf428('0x73')]['QueryTypes'][_0xf428('0x84')]})[_0xf428('0x33')](function(_0x2b355c){if(_0x2b355c[_0xf428('0x57')]===0x1){return _0x5544c1['id'];}else{var _0x648f2a=_[_0xf428('0x85')](_['map'](_0x2b355c,_0xf428('0x86')),function(_0x5ecfed){return _['includes'](_0x3ed8f8,_0x5ecfed);});if(_0x648f2a){return _0x5544c1['id'];}}}));}}return BPromise[_0xf428('0x87')](_0x4b3c43)[_0xf428('0x33')](function(_0x596a2c){_0x292f4e=_(_0x292f4e)[_0xf428('0x88')](_0x596a2c)[_0xf428('0x89')]()['value']();return db[_0xf428('0x3d')][_0xf428('0x58')]({'where':{'id':_0x239727[_0xf428('0x6d')]['id']}})[_0xf428('0x33')](function(_0x3ad39a){return db[_0xf428('0x73')][_0xf428('0x8a')](function(_0x107a72){return _0x3ad39a['removeTeams'](_0x239727[_0xf428('0x41')][_0xf428('0x78')],{'transaction':_0x107a72})['then'](function(){if(!_[_0xf428('0x8b')](_0x292f4e)){return _0x3ad39a[_0xf428('0x8c')](_0x292f4e,{'transaction':_0x107a72});}})[_0xf428('0x33')](function(){_0x292f4e[_0xf428('0x76')](function(_0x2678df){socket[_0xf428('0x8d')](_0xf428('0x8e'),{'UserId':_0x2678df,'ChatQueueId':_0x3ad39a['id']});});});});});});})['then'](respondWithStatusCode(_0x11ecb9,null))[_0xf428('0x25')](handleError(_0x11ecb9,null));};exports[_0xf428('0x8f')]=function(_0x4a3256,_0x18b641,_0x513aae){return db[_0xf428('0x3d')]['find']({'where':{'id':_0x4a3256[_0xf428('0x6d')]['id']}})['then'](handleEntityNotFound(_0x18b641,null))[_0xf428('0x33')](function(_0xa2bfda){if(_0xa2bfda){return _0xa2bfda['addAgents'](_0x4a3256['body']['ids'],_[_0xf428('0x90')](_0x4a3256[_0xf428('0x5e')],[_0xf428('0x78'),'id'])||{})[_0xf428('0x91')](function(_0x422a14){for(var _0x323b4f=0x0;_0x323b4f<_0x4a3256[_0xf428('0x5e')][_0xf428('0x78')]['length'];_0x323b4f+=0x1){socket[_0xf428('0x8d')](_0xf428('0x77'),{'UserId':Number(_0x4a3256[_0xf428('0x5e')][_0xf428('0x78')][_0x323b4f]),'ChatQueueId':Number(_0x4a3256[_0xf428('0x6d')]['id'])});}return _0x422a14;});}})[_0xf428('0x33')](respondWithResult(_0x18b641,null))[_0xf428('0x25')](handleError(_0x18b641,null));};exports[_0xf428('0x8c')]=function(_0x1b07c7,_0xf18bd5,_0x1dd8fc){return db[_0xf428('0x3d')][_0xf428('0x58')]({'where':{'id':_0x1b07c7[_0xf428('0x6d')]['id']}})[_0xf428('0x33')](handleEntityNotFound(_0xf18bd5,null))[_0xf428('0x33')](function(_0x403956){if(_0x403956){return _0x403956[_0xf428('0x8c')](_0x1b07c7[_0xf428('0x41')][_0xf428('0x78')])[_0xf428('0x33')](function(){if(_[_0xf428('0x92')](_0x1b07c7[_0xf428('0x41')][_0xf428('0x78')])){for(var _0x595908=0x0;_0x595908<_0x1b07c7[_0xf428('0x41')][_0xf428('0x78')][_0xf428('0x57')];_0x595908+=0x1){socket[_0xf428('0x8d')](_0xf428('0x8e'),{'UserId':Number(_0x1b07c7[_0xf428('0x41')][_0xf428('0x78')][_0x595908]),'ChatQueueId':Number(_0x1b07c7[_0xf428('0x6d')]['id'])});}}else{socket[_0xf428('0x8d')](_0xf428('0x8e'),{'UserId':Number(_0x1b07c7['query'][_0xf428('0x78')]),'ChatQueueId':Number(_0x1b07c7['params']['id'])});}});}})[_0xf428('0x33')](respondWithStatusCode(_0xf18bd5,null))[_0xf428('0x25')](handleError(_0xf18bd5,null));};exports[_0xf428('0x93')]=function(_0x4ec429,_0x277dee,_0x34f41a){var _0x3a2faf={};var _0x508c12={};var _0x10e1b4;var _0x43497d;return db[_0xf428('0x3d')][_0xf428('0x60')]({'where':{'id':_0x4ec429[_0xf428('0x6d')]['id']}})[_0xf428('0x33')](handleEntityNotFound(_0x277dee,null))[_0xf428('0x33')](function(_0x201ba6){if(_0x201ba6){_0x10e1b4=_0x201ba6;_0x508c12[_0xf428('0x45')]=_['keys'](db[_0xf428('0x79')][_0xf428('0x3e')]);_0x508c12[_0xf428('0x41')]=_['keys'](_0x4ec429[_0xf428('0x41')]);_0x508c12[_0xf428('0x43')]=_[_0xf428('0x44')](_0x508c12['model'],_0x508c12[_0xf428('0x41')]);_0x3a2faf['attributes']=_[_0xf428('0x44')](_0x508c12[_0xf428('0x45')],qs['fields'](_0x4ec429[_0xf428('0x41')][_0xf428('0x47')]));_0x3a2faf['attributes']=_0x3a2faf['attributes'][_0xf428('0x57')]?_0x3a2faf[_0xf428('0x46')]:_0x508c12['model'];_0x3a2faf[_0xf428('0x4a')]=qs['sort'](_0x4ec429[_0xf428('0x41')][_0xf428('0x4b')]);_0x3a2faf[_0xf428('0x4c')]=qs[_0xf428('0x43')](_['pick'](_0x4ec429[_0xf428('0x41')],_0x508c12['filters']));if(_0x4ec429['query'][_0xf428('0x4e')]){_0x3a2faf[_0xf428('0x4c')]=_['merge'](_0x3a2faf[_0xf428('0x4c')],{'$or':_[_0xf428('0x3c')](_0x3a2faf[_0xf428('0x46')],function(_0xa0ae1){var _0x4f8782={};_0x4f8782[_0xa0ae1]={'$like':'%'+_0x4ec429[_0xf428('0x41')][_0xf428('0x4e')]+'%'};return _0x4f8782;})});}_0x3a2faf=_[_0xf428('0x4f')]({},_0x3a2faf,_0x4ec429[_0xf428('0x51')]);return _0x10e1b4[_0xf428('0x93')](_0x3a2faf);}})[_0xf428('0x33')](function(_0xe5c182){if(_0xe5c182){_0x43497d=_0xe5c182[_0xf428('0x57')];if(!_0x4ec429[_0xf428('0x41')][_0xf428('0x48')]('nolimit')){_0x3a2faf['limit']=qs[_0xf428('0x2b')](_0x4ec429['query'][_0xf428('0x2b')]);_0x3a2faf[_0xf428('0x29')]=qs[_0xf428('0x29')](_0x4ec429[_0xf428('0x41')]['offset']);}return _0x10e1b4[_0xf428('0x93')](_0x3a2faf);}})[_0xf428('0x33')](function(_0x1ac04e){if(_0x1ac04e){return _0x1ac04e?{'count':_0x43497d,'rows':_0x1ac04e}:null;}})[_0xf428('0x33')](respondWithResult(_0x277dee,null))[_0xf428('0x25')](handleError(_0x277dee,null));}; \ No newline at end of file +var _0x8c97=['save','destroy','get','ChatQueues','UserProfileResource','stack','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','ChatQueueId','UserChatQueue','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','each','findOrCreate','userChatQueue:save','removeTeams','Team','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','forEach','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x23c4ca,_0x9f4e93){var _0x279593=function(_0x213f3a){while(--_0x213f3a){_0x23c4ca['push'](_0x23c4ca['shift']());}};_0x279593(++_0x9f4e93);}(_0x8c97,0x19a));var _0x78c9=function(_0x21fb51,_0x2fdd60){_0x21fb51=_0x21fb51-0x0;var _0x340896=_0x8c97[_0x21fb51];return _0x340896;};'use strict';var emlformat=require(_0x78c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78c9('0x1'));var jsonpatch=require(_0x78c9('0x2'));var rp=require(_0x78c9('0x3'));var moment=require('moment');var BPromise=require(_0x78c9('0x4'));var Mustache=require(_0x78c9('0x5'));var util=require(_0x78c9('0x6'));var path=require('path');var sox=require(_0x78c9('0x7'));var csv=require(_0x78c9('0x8'));var ejs=require(_0x78c9('0x9'));var fs=require('fs');var fs_extra=require(_0x78c9('0xa'));var _=require(_0x78c9('0xb'));var squel=require(_0x78c9('0xc'));var crypto=require('crypto');var jsforce=require(_0x78c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x78c9('0x8'));var querystring=require(_0x78c9('0xe'));var Papa=require(_0x78c9('0xf'));var Redis=require(_0x78c9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x78c9('0x11'));var as=require(_0x78c9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78c9('0x13'))(_0x78c9('0x14'));var utils=require(_0x78c9('0x15'));var config=require(_0x78c9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x78c9('0x17')]=_[_0x78c9('0x18')](config[_0x78c9('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x78c9('0x19'))(new Redis(config[_0x78c9('0x17')]));require(_0x78c9('0x1a'))[_0x78c9('0x1b')](socket);var jayson=require(_0x78c9('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a46ab,_0x4facff,_0xfc38f,_0x3bbd8e){return new BPromise(function(_0x19234a,_0x591847){var _0x200bbc=_0x3bbd8e||client;return _0x200bbc[_0x78c9('0x1d')](_0x2a46ab,_0xfc38f)[_0x78c9('0x1e')](function(_0x68243c){logger[_0x78c9('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x4facff,_0x78c9('0x20'));logger[_0x78c9('0x21')](_0x78c9('0x22'),_0x4facff,_0x78c9('0x20'),JSON['stringify'](_0x68243c));if(_0x68243c[_0x78c9('0x23')]){if(_0x68243c[_0x78c9('0x23')][_0x78c9('0x24')]===0x1f4){logger[_0x78c9('0x23')]('ChatQueue,\x20%s,\x20%s',_0x4facff,_0x68243c[_0x78c9('0x23')]['message']);return _0x591847(_0x68243c[_0x78c9('0x23')]['message']);}logger[_0x78c9('0x23')]('ChatQueue,\x20%s,\x20%s',_0x4facff,_0x68243c['error'][_0x78c9('0x25')]);return _0x19234a(_0x68243c[_0x78c9('0x23')][_0x78c9('0x25')]);}else{logger['info'](_0x78c9('0x26'),_0x4facff,'request\x20sent');_0x19234a(_0x68243c[_0x78c9('0x27')][_0x78c9('0x25')]);}})[_0x78c9('0x28')](function(_0x1490b8){logger[_0x78c9('0x23')]('ChatQueue,\x20%s,\x20%s',_0x4facff,_0x1490b8);_0x591847(_0x1490b8);});});}function respondWithStatusCode(_0xad8756,_0x1fa762){_0x1fa762=_0x1fa762||0xcc;return function(_0x1b0594){if(_0x1b0594){return _0xad8756[_0x78c9('0x29')](_0x1fa762);}return _0xad8756['status'](_0x1fa762)[_0x78c9('0x2a')]();};}function respondWithResult(_0x341b1a,_0x31795f){_0x31795f=_0x31795f||0xc8;return function(_0x32d557){if(_0x32d557){return _0x341b1a[_0x78c9('0x2b')](_0x31795f)[_0x78c9('0x2c')](_0x32d557);}};}function respondWithFilteredResult(_0x442e9b,_0xc4261f){return function(_0x47cd98){if(_0x47cd98){var _0x702c0d=typeof _0xc4261f[_0x78c9('0x2d')]===_0x78c9('0x2e')&&typeof _0xc4261f[_0x78c9('0x2f')]===_0x78c9('0x2e');var _0x43a090=_0x47cd98['count'];var _0x50b01b=_0x702c0d?0x0:_0xc4261f[_0x78c9('0x2d')];var _0x3bd0c4=_0x702c0d?_0x47cd98[_0x78c9('0x30')]:_0xc4261f[_0x78c9('0x2d')]+_0xc4261f[_0x78c9('0x2f')];var _0x590a07;if(_0x3bd0c4>=_0x43a090){_0x3bd0c4=_0x43a090;_0x590a07=0xc8;}else{_0x590a07=0xce;}_0x442e9b[_0x78c9('0x2b')](_0x590a07);return _0x442e9b['set'](_0x78c9('0x31'),_0x50b01b+'-'+_0x3bd0c4+'/'+_0x43a090)['json'](_0x47cd98);}return null;};}function patchUpdates(_0x1f533a){return function(_0xdf267f){try{jsonpatch[_0x78c9('0x32')](_0xdf267f,_0x1f533a,!![]);}catch(_0x50f164){return BPromise[_0x78c9('0x33')](_0x50f164);}return _0xdf267f[_0x78c9('0x34')]();};}function saveUpdates(_0x171fb2,_0x2adf97){return function(_0x1853da){if(_0x1853da){return _0x1853da['update'](_0x171fb2)[_0x78c9('0x1e')](function(_0x1368fa){return _0x1368fa;});}return null;};}function removeEntity(_0xd6d3ff,_0x3ef774){return function(_0x1deea8){if(_0x1deea8){return _0x1deea8[_0x78c9('0x35')]()[_0x78c9('0x1e')](function(){var _0x5b9827=_0x1deea8[_0x78c9('0x36')]({'plain':!![]});var _0x2a9528=_0x78c9('0x37');return db[_0x78c9('0x38')][_0x78c9('0x35')]({'where':{'type':_0x2a9528,'resourceId':_0x5b9827['id']}})[_0x78c9('0x1e')](function(){return _0x1deea8;});})[_0x78c9('0x1e')](function(){_0xd6d3ff[_0x78c9('0x2b')](0xcc)[_0x78c9('0x2a')]();});}};}function handleEntityNotFound(_0x5448eb,_0x174b5e){return function(_0x546c59){if(!_0x546c59){_0x5448eb[_0x78c9('0x29')](0x194);}return _0x546c59;};}function handleError(_0xdb8338,_0x367c91){_0x367c91=_0x367c91||0x1f4;return function(_0x41b809){logger[_0x78c9('0x23')](_0x41b809[_0x78c9('0x39')]);if(_0x41b809['name']){delete _0x41b809['name'];}_0xdb8338[_0x78c9('0x2b')](_0x367c91)['send'](_0x41b809);};}exports['index']=function(_0x4c3c6b,_0x568962){var _0x2c06bc={},_0x35e0c6={},_0x20ff18={'count':0x0,'rows':[]};var _0x14568a=_[_0x78c9('0x3a')](db[_0x78c9('0x3b')][_0x78c9('0x3c')],function(_0x291f09){return{'name':_0x291f09[_0x78c9('0x3d')],'type':_0x291f09[_0x78c9('0x3e')][_0x78c9('0x3f')]};});_0x35e0c6['model']=_['map'](_0x14568a,'name');_0x35e0c6[_0x78c9('0x40')]=_[_0x78c9('0x41')](_0x4c3c6b[_0x78c9('0x40')]);_0x35e0c6[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x35e0c6[_0x78c9('0x44')],_0x35e0c6[_0x78c9('0x40')]);_0x2c06bc[_0x78c9('0x45')]=_['intersection'](_0x35e0c6[_0x78c9('0x44')],qs[_0x78c9('0x46')](_0x4c3c6b[_0x78c9('0x40')]['fields']));_0x2c06bc[_0x78c9('0x45')]=_0x2c06bc[_0x78c9('0x45')][_0x78c9('0x47')]?_0x2c06bc['attributes']:_0x35e0c6[_0x78c9('0x44')];if(!_0x4c3c6b[_0x78c9('0x40')][_0x78c9('0x48')]('nolimit')){_0x2c06bc[_0x78c9('0x2f')]=qs[_0x78c9('0x2f')](_0x4c3c6b['query'][_0x78c9('0x2f')]);_0x2c06bc[_0x78c9('0x2d')]=qs[_0x78c9('0x2d')](_0x4c3c6b[_0x78c9('0x40')][_0x78c9('0x2d')]);}_0x2c06bc[_0x78c9('0x49')]=qs['sort'](_0x4c3c6b['query'][_0x78c9('0x4a')]);_0x2c06bc['where']=qs[_0x78c9('0x42')](_[_0x78c9('0x4b')](_0x4c3c6b[_0x78c9('0x40')],_0x35e0c6['filters']),_0x14568a);if(_0x4c3c6b[_0x78c9('0x40')]['filter']){_0x2c06bc[_0x78c9('0x4c')]=_[_0x78c9('0x4d')](_0x2c06bc[_0x78c9('0x4c')],{'$or':_[_0x78c9('0x3a')](_0x14568a,function(_0x332c35){if(_0x332c35['type']!=='VIRTUAL'){var _0x45aae0={};_0x45aae0[_0x332c35['name']]={'$like':'%'+_0x4c3c6b[_0x78c9('0x40')][_0x78c9('0x4e')]+'%'};return _0x45aae0;}})});}_0x2c06bc=_[_0x78c9('0x4d')]({},_0x2c06bc,_0x4c3c6b[_0x78c9('0x4f')]);var _0xbae307={'where':_0x2c06bc['where']};return db[_0x78c9('0x3b')]['count'](_0xbae307)[_0x78c9('0x1e')](function(_0x305fac){_0x20ff18[_0x78c9('0x30')]=_0x305fac;if(_0x4c3c6b[_0x78c9('0x40')][_0x78c9('0x50')]){_0x2c06bc[_0x78c9('0x51')]=[{'all':!![]}];}return db[_0x78c9('0x3b')][_0x78c9('0x52')](_0x2c06bc);})[_0x78c9('0x1e')](function(_0x578a4e){_0x20ff18[_0x78c9('0x53')]=_0x578a4e;return _0x20ff18;})[_0x78c9('0x1e')](respondWithFilteredResult(_0x568962,_0x2c06bc))[_0x78c9('0x28')](handleError(_0x568962,null));};exports[_0x78c9('0x54')]=function(_0x28718e,_0x43bd78){var _0x1afb35={'raw':!![],'where':{'id':_0x28718e[_0x78c9('0x55')]['id']}},_0x568515={};_0x568515[_0x78c9('0x44')]=_['keys'](db[_0x78c9('0x3b')][_0x78c9('0x3c')]);_0x568515['query']=_[_0x78c9('0x41')](_0x28718e[_0x78c9('0x40')]);_0x568515[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x568515[_0x78c9('0x44')],_0x568515[_0x78c9('0x40')]);_0x1afb35[_0x78c9('0x45')]=_[_0x78c9('0x43')](_0x568515[_0x78c9('0x44')],qs['fields'](_0x28718e[_0x78c9('0x40')][_0x78c9('0x46')]));_0x1afb35[_0x78c9('0x45')]=_0x1afb35[_0x78c9('0x45')][_0x78c9('0x47')]?_0x1afb35[_0x78c9('0x45')]:_0x568515[_0x78c9('0x44')];if(_0x28718e[_0x78c9('0x40')][_0x78c9('0x50')]){_0x1afb35[_0x78c9('0x51')]=[{'all':!![]}];}_0x1afb35=_[_0x78c9('0x4d')]({},_0x1afb35,_0x28718e['options']);return db[_0x78c9('0x3b')][_0x78c9('0x56')](_0x1afb35)[_0x78c9('0x1e')](handleEntityNotFound(_0x43bd78,null))[_0x78c9('0x1e')](respondWithResult(_0x43bd78,null))[_0x78c9('0x28')](handleError(_0x43bd78,null));};exports[_0x78c9('0x57')]=function(_0x374808,_0xf831ec){return db[_0x78c9('0x3b')][_0x78c9('0x57')](_0x374808[_0x78c9('0x58')],{})[_0x78c9('0x1e')](function(_0x52f772){var _0x127dc8=_0x374808[_0x78c9('0x59')][_0x78c9('0x36')]({'plain':!![]});if(!_0x127dc8)throw new Error(_0x78c9('0x5a'));if(_0x127dc8['role']===_0x78c9('0x59')){var _0x2e8cf0=_0x52f772[_0x78c9('0x36')]({'plain':!![]});var _0x3f849d=_0x78c9('0x37');return db[_0x78c9('0x5b')]['find']({'where':{'name':_0x3f849d,'userProfileId':_0x127dc8['userProfileId']},'raw':!![]})[_0x78c9('0x1e')](function(_0x3d58f6){if(_0x3d58f6&&_0x3d58f6[_0x78c9('0x5c')]===0x0){return db[_0x78c9('0x38')][_0x78c9('0x57')]({'name':_0x2e8cf0['name'],'resourceId':_0x2e8cf0['id'],'type':_0x3d58f6[_0x78c9('0x5d')],'sectionId':_0x3d58f6['id']},{})[_0x78c9('0x1e')](function(){return _0x52f772;});}else{return _0x52f772;}})[_0x78c9('0x28')](function(_0x4464c9){logger['error'](_0x78c9('0x5e'),_0x4464c9);throw _0x4464c9;});}return _0x52f772;})[_0x78c9('0x1e')](respondWithResult(_0xf831ec,0xc9))[_0x78c9('0x28')](handleError(_0xf831ec,null));};exports[_0x78c9('0x5f')]=function(_0x3d8eec,_0x166d0d){if(_0x3d8eec[_0x78c9('0x58')]['id']){delete _0x3d8eec[_0x78c9('0x58')]['id'];}return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x3d8eec[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x166d0d,null))[_0x78c9('0x1e')](saveUpdates(_0x3d8eec[_0x78c9('0x58')],null))[_0x78c9('0x1e')](respondWithResult(_0x166d0d,null))[_0x78c9('0x28')](handleError(_0x166d0d,null));};exports['destroy']=function(_0x58032d,_0x32b7e8){return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x58032d[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x32b7e8,null))[_0x78c9('0x1e')](removeEntity(_0x32b7e8,null))[_0x78c9('0x28')](handleError(_0x32b7e8,null));};exports[_0x78c9('0x60')]=function(_0x12bad1,_0x5c6230){return db[_0x78c9('0x3b')][_0x78c9('0x60')]()[_0x78c9('0x1e')](respondWithResult(_0x5c6230,null))[_0x78c9('0x28')](handleError(_0x5c6230,null));};exports[_0x78c9('0x61')]=function(_0x2f4756,_0xe64bec,_0x52565e){var _0x5c8245={'raw':!![],'where':{}},_0x48138d={},_0x31d4a0;return db['ChatQueue'][_0x78c9('0x62')]({'where':{'id':_0x2f4756[_0x78c9('0x55')]['id']}})['then'](handleEntityNotFound(_0xe64bec,null))['then'](function(_0xba7264){if(_0xba7264){_0x31d4a0=_0xba7264[_0x78c9('0x36')]({'plain':!![]});_0x48138d[_0x78c9('0x44')]=_[_0x78c9('0x41')](db['UserChatQueue']['rawAttributes']);_0x48138d[_0x78c9('0x40')]=_['keys'](_0x2f4756[_0x78c9('0x40')]);_0x48138d[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x48138d[_0x78c9('0x44')],_0x48138d['query']);_0x5c8245['attributes']=_[_0x78c9('0x43')](_0x48138d[_0x78c9('0x44')],qs[_0x78c9('0x46')](_0x2f4756[_0x78c9('0x40')]['fields']));_0x5c8245['attributes']=_0x5c8245[_0x78c9('0x45')][_0x78c9('0x47')]?_0x5c8245['attributes']:_0x48138d[_0x78c9('0x44')];if(!_0x2f4756[_0x78c9('0x40')][_0x78c9('0x48')]('nolimit')){_0x5c8245[_0x78c9('0x2f')]=qs[_0x78c9('0x2f')](_0x2f4756[_0x78c9('0x40')][_0x78c9('0x2f')]);_0x5c8245[_0x78c9('0x2d')]=qs[_0x78c9('0x2d')](_0x2f4756[_0x78c9('0x40')][_0x78c9('0x2d')]);}_0x5c8245['order']=qs[_0x78c9('0x4a')](_0x2f4756[_0x78c9('0x40')][_0x78c9('0x4a')]);_0x5c8245[_0x78c9('0x4c')]=qs[_0x78c9('0x42')](_[_0x78c9('0x4b')](_0x2f4756[_0x78c9('0x40')],_0x48138d[_0x78c9('0x42')]));_0x5c8245['where'][_0x78c9('0x63')]=_0xba7264['id'];if(_0x2f4756['query'][_0x78c9('0x4e')]){_0x5c8245['where']=_[_0x78c9('0x4d')](_0x5c8245[_0x78c9('0x4c')],{'$or':_['map'](_0x5c8245[_0x78c9('0x45')],function(_0xb40684){var _0x17ad45={};_0x17ad45[_0xb40684]={'$like':'%'+_0x2f4756['query']['filter']+'%'};return _0x17ad45;})});}_0x5c8245=_[_0x78c9('0x4d')]({},_0x5c8245,_0x2f4756[_0x78c9('0x4f')]);return db[_0x78c9('0x64')][_0x78c9('0x52')](_0x5c8245);}})[_0x78c9('0x1e')](function(_0x57df47){if(_0x57df47){return db['User'][_0x78c9('0x65')]({'where':{'id':_['map'](_0x57df47,_0x78c9('0x66')),'role':_0x78c9('0x67')},'attributes':['id',_0x78c9('0x5d'),_0x78c9('0x68'),_0x78c9('0x69'),_0x78c9('0x6a')]});}})[_0x78c9('0x1e')](function(_0x473a41){if(_0x473a41){return{'count':_0x473a41[_0x78c9('0x30')],'rows':_[_0x78c9('0x3a')](_0x473a41[_0x78c9('0x53')],function(_0xe8bb6d){return{'membername':_0xe8bb6d[_0x78c9('0x5d')],'UserId':_0xe8bb6d['id'],'queue_name':_0x31d4a0[_0x78c9('0x5d')],'ChatQueueId':_0x31d4a0['id'],'interface':util[_0x78c9('0x6b')](_0x78c9('0x6c'),_0x78c9('0x6d'),_0xe8bb6d['name']),'penalty':0x0,'paused':_0xe8bb6d['chatPause'],'createdAt':_0xe8bb6d[_0x78c9('0x6a')],'updatedAt':_0xe8bb6d[_0x78c9('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x78c9('0x1e')](respondWithFilteredResult(_0xe64bec,_0x5c8245))[_0x78c9('0x28')](handleError(_0xe64bec,null));};exports[_0x78c9('0x6e')]=function(_0x512ec9,_0x23bf7b,_0x2e33c5){var _0x2cc75a={};var _0x562a34={};var _0x7c4182;var _0x2b42cb;return db[_0x78c9('0x3b')][_0x78c9('0x62')]({'where':{'id':_0x512ec9[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x23bf7b,null))[_0x78c9('0x1e')](function(_0x3ff031){if(_0x3ff031){_0x7c4182=_0x3ff031;_0x562a34[_0x78c9('0x44')]=_[_0x78c9('0x41')](db['Team']['rawAttributes']);_0x562a34[_0x78c9('0x40')]=_[_0x78c9('0x41')](_0x512ec9['query']);_0x562a34[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x562a34[_0x78c9('0x44')],_0x562a34[_0x78c9('0x40')]);_0x2cc75a[_0x78c9('0x45')]=_['intersection'](_0x562a34[_0x78c9('0x44')],qs['fields'](_0x512ec9['query']['fields']));_0x2cc75a[_0x78c9('0x45')]=_0x2cc75a[_0x78c9('0x45')][_0x78c9('0x47')]?_0x2cc75a[_0x78c9('0x45')]:_0x562a34[_0x78c9('0x44')];_0x2cc75a[_0x78c9('0x49')]=qs[_0x78c9('0x4a')](_0x512ec9[_0x78c9('0x40')]['sort']);_0x2cc75a[_0x78c9('0x4c')]=qs[_0x78c9('0x42')](_[_0x78c9('0x4b')](_0x512ec9[_0x78c9('0x40')],_0x562a34[_0x78c9('0x42')]));if(_0x512ec9[_0x78c9('0x40')]['filter']){_0x2cc75a[_0x78c9('0x4c')]=_[_0x78c9('0x4d')](_0x2cc75a[_0x78c9('0x4c')],{'$or':_['map'](_0x2cc75a[_0x78c9('0x45')],function(_0x145d6d){var _0x3dde07={};_0x3dde07[_0x145d6d]={'$like':'%'+_0x512ec9[_0x78c9('0x40')][_0x78c9('0x4e')]+'%'};return _0x3dde07;})});}_0x2cc75a=_[_0x78c9('0x4d')]({},_0x2cc75a,_0x512ec9[_0x78c9('0x4f')]);return _0x7c4182[_0x78c9('0x6e')](_0x2cc75a);}})[_0x78c9('0x1e')](function(_0x45de49){if(_0x45de49){_0x2b42cb=_0x45de49[_0x78c9('0x47')];if(!_0x512ec9[_0x78c9('0x40')]['hasOwnProperty']('nolimit')){_0x2cc75a[_0x78c9('0x2f')]=qs[_0x78c9('0x2f')](_0x512ec9['query'][_0x78c9('0x2f')]);_0x2cc75a[_0x78c9('0x2d')]=qs['offset'](_0x512ec9[_0x78c9('0x40')][_0x78c9('0x2d')]);}return _0x7c4182[_0x78c9('0x6e')](_0x2cc75a);}})['then'](function(_0x55c378){if(_0x55c378){return _0x55c378?{'count':_0x2b42cb,'rows':_0x55c378}:null;}})[_0x78c9('0x1e')](respondWithResult(_0x23bf7b,null))[_0x78c9('0x28')](handleError(_0x23bf7b,null));};exports[_0x78c9('0x6f')]=function(_0x1683e0,_0x120385,_0x4258fe){var _0x5c61c9=_0x1683e0[_0x78c9('0x58')][_0x78c9('0x70')];return db['Team'][_0x78c9('0x52')]({'where':{'id':_0x5c61c9},'attributes':['id'],'include':[{'model':db['User'],'as':_0x78c9('0x71'),'attributes':['id',_0x78c9('0x5d'),_0x78c9('0x72'),_0x78c9('0x73'),_0x78c9('0x74')],'raw':!![]}]})[_0x78c9('0x1e')](function(_0x1b342b){if(_0x1b342b){var _0x3e6a25=_['flatMap'](_0x1b342b,function(_0x2ae828){var _0x1623d6=_0x2ae828[_0x78c9('0x36')]({'plain':!![]});return _0x1623d6['Agents'];});return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x1683e0[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](function(_0x3ff5be){return db['sequelize']['transaction'](function(_0x49a1a8){return _0x3ff5be[_0x78c9('0x6f')](_0x5c61c9,{'transaction':_0x49a1a8})[_0x78c9('0x1e')](function(){return BPromise[_0x78c9('0x75')](_0x3e6a25,function(_0xb4b42d){return db[_0x78c9('0x64')][_0x78c9('0x76')]({'where':{'UserId':_0xb4b42d['id'],'ChatQueueId':_0x1683e0[_0x78c9('0x55')]['id']},'transaction':_0x49a1a8});});})['then'](function(){_0x3e6a25['forEach'](function(_0x4c3850){socket['emit'](_0x78c9('0x77'),{'UserId':_0x4c3850['id'],'ChatQueueId':_0x3ff5be['id']});});});});});}})['then'](respondWithStatusCode(_0x120385,null))[_0x78c9('0x28')](handleError(_0x120385,null));};exports[_0x78c9('0x78')]=function(_0x955563,_0x4d625d,_0x1cf7ed){return db[_0x78c9('0x79')][_0x78c9('0x52')]({'where':{'id':_0x955563[_0x78c9('0x40')][_0x78c9('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d625d,null))['then'](function(_0x5426d8){var _0xb085ab=_[_0x78c9('0x3a')](_0x5426d8,'id');var _0x2c5c2a=[];var _0x2d9bac=[];var _0x58f6b8=squel[_0x78c9('0x7a')]();_0x58f6b8[_0x78c9('0x7b')]('tq.TeamId')[_0x78c9('0x7c')](_0x78c9('0x7d'),'tq')[_0x78c9('0x7e')](_0x78c9('0x7f'),'ut',_0x78c9('0x80'))[_0x78c9('0x4c')](_0x78c9('0x81'),_0x955563['params']['id']);for(var _0x23cc0b=0x0;_0x23cc0b<_0x5426d8[_0x78c9('0x47')];_0x23cc0b+=0x1){let _0x25d5bb=_0x5426d8[_0x23cc0b];for(var _0x2d1985=0x0;_0x2d1985<_0x25d5bb[_0x78c9('0x71')][_0x78c9('0x47')];_0x2d1985+=0x1){let _0x52b839=_0x25d5bb[_0x78c9('0x71')][_0x2d1985];var _0x13f288=_0x58f6b8[_0x78c9('0x82')]();_0x13f288[_0x78c9('0x4c')](_0x78c9('0x83'),_0x52b839['id']);_0x2d9bac[_0x78c9('0x84')](db[_0x78c9('0x85')][_0x78c9('0x40')](_0x13f288['toString'](),{'type':db['sequelize'][_0x78c9('0x86')][_0x78c9('0x87')]})['then'](function(_0x4039fc){if(_0x4039fc[_0x78c9('0x47')]===0x1){return _0x52b839['id'];}else{var _0x438699=_[_0x78c9('0x88')](_['map'](_0x4039fc,_0x78c9('0x89')),function(_0x228944){return _[_0x78c9('0x8a')](_0xb085ab,_0x228944);});if(_0x438699){return _0x52b839['id'];}}}));}}return BPromise[_0x78c9('0x8b')](_0x2d9bac)[_0x78c9('0x1e')](function(_0x114574){_0x2c5c2a=_(_0x2c5c2a)[_0x78c9('0x8c')](_0x114574)[_0x78c9('0x8d')]()['value']();return db[_0x78c9('0x3b')]['find']({'where':{'id':_0x955563[_0x78c9('0x55')]['id']}})['then'](function(_0x25d7ad){return db[_0x78c9('0x85')][_0x78c9('0x8e')](function(_0xbab405){return _0x25d7ad['removeTeams'](_0x955563[_0x78c9('0x40')][_0x78c9('0x70')],{'transaction':_0xbab405})['then'](function(){if(!_[_0x78c9('0x8f')](_0x2c5c2a)){return _0x25d7ad['removeAgents'](_0x2c5c2a,{'transaction':_0xbab405});}})[_0x78c9('0x1e')](function(){_0x2c5c2a[_0x78c9('0x90')](function(_0x4eb4b0){socket[_0x78c9('0x91')](_0x78c9('0x92'),{'UserId':_0x4eb4b0,'ChatQueueId':_0x25d7ad['id']});});});});});});})['then'](respondWithStatusCode(_0x4d625d,null))[_0x78c9('0x28')](handleError(_0x4d625d,null));};exports['addAgents']=function(_0x56a706,_0x3e437d,_0x18cbfe){return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x56a706[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x3e437d,null))[_0x78c9('0x1e')](function(_0x16bc4e){if(_0x16bc4e){return _0x16bc4e[_0x78c9('0x93')](_0x56a706[_0x78c9('0x58')][_0x78c9('0x70')],_[_0x78c9('0x94')](_0x56a706[_0x78c9('0x58')],[_0x78c9('0x70'),'id'])||{})[_0x78c9('0x95')](function(_0x587cf8){for(var _0x66523e=0x0;_0x66523e<_0x56a706[_0x78c9('0x58')]['ids']['length'];_0x66523e+=0x1){socket[_0x78c9('0x91')](_0x78c9('0x77'),{'UserId':Number(_0x56a706[_0x78c9('0x58')][_0x78c9('0x70')][_0x66523e]),'ChatQueueId':Number(_0x56a706[_0x78c9('0x55')]['id'])});}return _0x587cf8;});}})['then'](respondWithResult(_0x3e437d,null))['catch'](handleError(_0x3e437d,null));};exports[_0x78c9('0x96')]=function(_0x5e13d3,_0xe593eb,_0x3f41c6){return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x5e13d3[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0xe593eb,null))[_0x78c9('0x1e')](function(_0x19f2b5){if(_0x19f2b5){return _0x19f2b5[_0x78c9('0x96')](_0x5e13d3[_0x78c9('0x40')]['ids'])[_0x78c9('0x1e')](function(){if(_[_0x78c9('0x97')](_0x5e13d3[_0x78c9('0x40')]['ids'])){for(var _0x756add=0x0;_0x756add<_0x5e13d3[_0x78c9('0x40')]['ids'][_0x78c9('0x47')];_0x756add+=0x1){socket[_0x78c9('0x91')]('userChatQueue:remove',{'UserId':Number(_0x5e13d3[_0x78c9('0x40')][_0x78c9('0x70')][_0x756add]),'ChatQueueId':Number(_0x5e13d3['params']['id'])});}}else{socket[_0x78c9('0x91')](_0x78c9('0x92'),{'UserId':Number(_0x5e13d3[_0x78c9('0x40')][_0x78c9('0x70')]),'ChatQueueId':Number(_0x5e13d3[_0x78c9('0x55')]['id'])});}});}})[_0x78c9('0x1e')](respondWithStatusCode(_0xe593eb,null))[_0x78c9('0x28')](handleError(_0xe593eb,null));};exports[_0x78c9('0x98')]=function(_0x1474a3,_0x37d341,_0x125b69){var _0x149481={};var _0x5083ec={};var _0x4f9fd2;var _0x1df709;return db[_0x78c9('0x3b')][_0x78c9('0x62')]({'where':{'id':_0x1474a3[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x37d341,null))[_0x78c9('0x1e')](function(_0x10414d){if(_0x10414d){_0x4f9fd2=_0x10414d;_0x5083ec[_0x78c9('0x44')]=_[_0x78c9('0x41')](db[_0x78c9('0x99')][_0x78c9('0x3c')]);_0x5083ec[_0x78c9('0x40')]=_[_0x78c9('0x41')](_0x1474a3[_0x78c9('0x40')]);_0x5083ec[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x5083ec[_0x78c9('0x44')],_0x5083ec[_0x78c9('0x40')]);_0x149481[_0x78c9('0x45')]=_[_0x78c9('0x43')](_0x5083ec[_0x78c9('0x44')],qs['fields'](_0x1474a3[_0x78c9('0x40')][_0x78c9('0x46')]));_0x149481['attributes']=_0x149481[_0x78c9('0x45')]['length']?_0x149481[_0x78c9('0x45')]:_0x5083ec[_0x78c9('0x44')];_0x149481[_0x78c9('0x49')]=qs[_0x78c9('0x4a')](_0x1474a3['query'][_0x78c9('0x4a')]);_0x149481[_0x78c9('0x4c')]=qs[_0x78c9('0x42')](_[_0x78c9('0x4b')](_0x1474a3[_0x78c9('0x40')],_0x5083ec[_0x78c9('0x42')]));if(_0x1474a3[_0x78c9('0x40')][_0x78c9('0x4e')]){_0x149481['where']=_[_0x78c9('0x4d')](_0x149481['where'],{'$or':_[_0x78c9('0x3a')](_0x149481[_0x78c9('0x45')],function(_0xc65269){var _0x348b23={};_0x348b23[_0xc65269]={'$like':'%'+_0x1474a3[_0x78c9('0x40')][_0x78c9('0x4e')]+'%'};return _0x348b23;})});}_0x149481=_['merge']({},_0x149481,_0x1474a3['options']);return _0x4f9fd2[_0x78c9('0x98')](_0x149481);}})[_0x78c9('0x1e')](function(_0x1c37e2){if(_0x1c37e2){_0x1df709=_0x1c37e2['length'];if(!_0x1474a3[_0x78c9('0x40')][_0x78c9('0x48')]('nolimit')){_0x149481[_0x78c9('0x2f')]=qs['limit'](_0x1474a3[_0x78c9('0x40')][_0x78c9('0x2f')]);_0x149481['offset']=qs[_0x78c9('0x2d')](_0x1474a3[_0x78c9('0x40')][_0x78c9('0x2d')]);}return _0x4f9fd2[_0x78c9('0x98')](_0x149481);}})['then'](function(_0x4712f1){if(_0x4712f1){return _0x4712f1?{'count':_0x1df709,'rows':_0x4712f1}:null;}})[_0x78c9('0x1e')](respondWithResult(_0x37d341,null))['catch'](handleError(_0x37d341,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 0947ad5..ec5010a 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 _0x383d=['save','remove','emit','hasOwnProperty','hook','exports','ChatQueue','setMaxListeners'];(function(_0xbdff00,_0xb35c83){var _0x19128e=function(_0xbb756d){while(--_0xbb756d){_0xbdff00['push'](_0xbdff00['shift']());}};_0x19128e(++_0xb35c83);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0xd383('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd383('0x1')](0x0);var events={'afterCreate':_0xd383('0x2'),'afterUpdate':'update','afterDestroy':_0xd383('0x3')};function emitEvent(_0x229076){return function(_0x319f67,_0x3439dd,_0x38896a){ChatQueueEvents[_0xd383('0x4')](_0x229076+':'+_0x319f67['id'],_0x319f67);ChatQueueEvents['emit'](_0x229076,_0x319f67);_0x38896a(null);};}for(var e in events){if(events[_0xd383('0x5')](e)){var event=events[e];ChatQueue[_0xd383('0x6')](e,emitEvent(event));}}module[_0xd383('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x9ff2=['save','update','remove','emit','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x3468a7,_0x277414){var _0x3c567b=function(_0x3ae5e7){while(--_0x3ae5e7){_0x3468a7['push'](_0x3468a7['shift']());}};_0x3c567b(++_0x277414);}(_0x9ff2,0x14a));var _0x29ff=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x9ff2[_0x5c3c0b];return _0x52ecd2;};'use strict';var EventEmitter=require(_0x29ff('0x0'));var ChatQueue=require(_0x29ff('0x1'))['db'][_0x29ff('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29ff('0x3'),'afterUpdate':_0x29ff('0x4'),'afterDestroy':_0x29ff('0x5')};function emitEvent(_0x5804ba){return function(_0x5b573f,_0x5d681c,_0xee1ae3){ChatQueueEvents[_0x29ff('0x6')](_0x5804ba+':'+_0x5b573f['id'],_0x5b573f);ChatQueueEvents['emit'](_0x5804ba,_0x5b573f);_0xee1ae3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x29ff('0x7')](e,emitEvent(event));}}module[_0x29ff('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 540caf8..a40f1c0 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 _0x7e5e=['ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x1a65ee,_0x274a5f){var _0x2f40b8=function(_0x5e1e33){while(--_0x5e1e33){_0x1a65ee['push'](_0x1a65ee['shift']());}};_0x2f40b8(++_0x274a5f);}(_0x7e5e,0x12d));var _0xe7e5=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x7e5e[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0xe7e5('0x0'));var util=require(_0xe7e5('0x1'));var logger=require('../../config/logger')(_0xe7e5('0x2'));var moment=require(_0xe7e5('0x3'));var BPromise=require(_0xe7e5('0x4'));var rp=require(_0xe7e5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7e5('0x6'));var config=require(_0xe7e5('0x7'));var attributes=require(_0xe7e5('0x8'));module[_0xe7e5('0x9')]=function(_0x49c7d9,_0x50cccb){return _0x49c7d9[_0xe7e5('0xa')](_0xe7e5('0xb'),attributes,{'tableName':_0xe7e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ae=['ChatQueue','chat_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x9d2bdc,_0x4f2b6a){var _0x410615=function(_0x56b661){while(--_0x56b661){_0x9d2bdc['push'](_0x9d2bdc['shift']());}};_0x410615(++_0x4f2b6a);}(_0x90ae,0x106));var _0xe90a=function(_0x3ed4da,_0x2a4fdd){_0x3ed4da=_0x3ed4da-0x0;var _0x5b7f61=_0x90ae[_0x3ed4da];return _0x5b7f61;};'use strict';var _=require('lodash');var util=require(_0xe90a('0x0'));var logger=require(_0xe90a('0x1'))(_0xe90a('0x2'));var moment=require('moment');var BPromise=require(_0xe90a('0x3'));var rp=require(_0xe90a('0x4'));var fs=require('fs');var path=require(_0xe90a('0x5'));var rimraf=require(_0xe90a('0x6'));var config=require(_0xe90a('0x7'));var attributes=require(_0xe90a('0x8'));module[_0xe90a('0x9')]=function(_0xb69bf4,_0x2e6cfd){return _0xb69bf4[_0xe90a('0xa')](_0xe90a('0xb'),attributes,{'tableName':_0xe90a('0xc'),'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 3510461..b1307ff 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 _0x9512=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','include','map','model','attributes','debug','GetChatQueue','ShowChatQueue'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x9512,0x75));var _0x2951=function(_0x50439d,_0x3aed4c){_0x50439d=_0x50439d-0x0;var _0x5dc279=_0x9512[_0x50439d];return _0x5dc279;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var moment=require(_0x2951('0x2'));var BPromise=require(_0x2951('0x3'));var rs=require(_0x2951('0x4'));var fs=require('fs');var Redis=require(_0x2951('0x5'));var db=require(_0x2951('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2951('0x7'))(_0x2951('0x8'));var config=require(_0x2951('0x9'));var jayson=require(_0x2951('0xa'));var client=jayson[_0x2951('0xb')][_0x2951('0xc')]({'port':0x232a});config[_0x2951('0xd')]=_['defaults'](config[_0x2951('0xd')],{'host':_0x2951('0xe'),'port':0x18eb});var socket=require(_0x2951('0xf'))(new Redis(config[_0x2951('0xd')]));require(_0x2951('0x10'))[_0x2951('0x11')](socket);function respondWithRpcPromise(_0x50dbe2,_0x3e6f58,_0x43a226){return new BPromise(function(_0x28cbbb,_0x2d0b87){return client['request'](_0x50dbe2,_0x43a226)[_0x2951('0x12')](function(_0x34559a){logger[_0x2951('0x13')](_0x2951('0x14'),_0x3e6f58,_0x2951('0x15'));logger['debug'](_0x2951('0x16'),_0x3e6f58,_0x2951('0x15'),JSON[_0x2951('0x17')](_0x34559a));if(_0x34559a[_0x2951('0x18')]){if(_0x34559a[_0x2951('0x18')][_0x2951('0x19')]===0x1f4){logger[_0x2951('0x18')](_0x2951('0x14'),_0x3e6f58,_0x34559a[_0x2951('0x18')][_0x2951('0x1a')]);return _0x2d0b87(_0x34559a[_0x2951('0x18')][_0x2951('0x1a')]);}logger[_0x2951('0x18')]('ChatQueue,\x20%s,\x20%s',_0x3e6f58,_0x34559a[_0x2951('0x18')][_0x2951('0x1a')]);return _0x28cbbb(_0x34559a[_0x2951('0x18')][_0x2951('0x1a')]);}else{logger[_0x2951('0x13')](_0x2951('0x14'),_0x3e6f58,'request\x20sent');_0x28cbbb(_0x34559a[_0x2951('0x1b')][_0x2951('0x1a')]);}})[_0x2951('0x1c')](function(_0x3fa5af){logger[_0x2951('0x18')]('ChatQueue,\x20%s,\x20%s',_0x3e6f58,_0x3fa5af);_0x2d0b87(_0x3fa5af);});});}exports['GetChatQueue']=function(_0x2b110c){var _0x3db6ff=this;return new Promise(function(_0x63ae73,_0x367343){return db['ChatQueue']['findAll']({'raw':_0x2b110c[_0x2951('0x1d')]?_0x2b110c['options'][_0x2951('0x1e')]===undefined?!![]:![]:!![],'where':_0x2b110c[_0x2951('0x1d')]?_0x2b110c[_0x2951('0x1d')][_0x2951('0x1f')]||null:null,'attributes':_0x2b110c[_0x2951('0x1d')]?_0x2b110c[_0x2951('0x1d')]['attributes']||null:null,'limit':_0x2b110c[_0x2951('0x1d')]?_0x2b110c[_0x2951('0x1d')]['limit']||null:null,'include':_0x2b110c[_0x2951('0x1d')]?_0x2b110c[_0x2951('0x1d')][_0x2951('0x20')]?_[_0x2951('0x21')](_0x2b110c['options'][_0x2951('0x20')],function(_0x7082b){return{'model':db[_0x7082b[_0x2951('0x22')]],'as':_0x7082b['as'],'attributes':_0x7082b[_0x2951('0x23')],'include':_0x7082b[_0x2951('0x20')]?_[_0x2951('0x21')](_0x7082b[_0x2951('0x20')],function(_0x76d751){return{'model':db[_0x76d751[_0x2951('0x22')]],'as':_0x76d751['as'],'attributes':_0x76d751['attributes'],'include':_0x76d751[_0x2951('0x20')]?_[_0x2951('0x21')](_0x76d751['include'],function(_0x1bfca1){return{'model':db[_0x1bfca1[_0x2951('0x22')]],'as':_0x1bfca1['as'],'attributes':_0x1bfca1[_0x2951('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2951('0x12')](function(_0x275824){logger[_0x2951('0x13')]('GetChatQueue',_0x2b110c);logger[_0x2951('0x24')](_0x2951('0x25'),_0x2b110c,JSON['stringify'](_0x275824));_0x63ae73(_0x275824);})[_0x2951('0x1c')](function(_0x4365eb){logger['error'](_0x2951('0x25'),_0x4365eb[_0x2951('0x1a')],_0x2b110c);_0x367343(_0x3db6ff[_0x2951('0x18')](0x1f4,_0x4365eb['message']));});});};exports[_0x2951('0x26')]=function(_0xb142b7){var _0x473bfd=this;return new Promise(function(_0x419e52,_0x38d019){return db['ChatQueue']['find']({'raw':_0xb142b7[_0x2951('0x1d')]?_0xb142b7[_0x2951('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xb142b7[_0x2951('0x1d')]?_0xb142b7[_0x2951('0x1d')][_0x2951('0x1f')]||null:null,'attributes':_0xb142b7['options']?_0xb142b7[_0x2951('0x1d')][_0x2951('0x23')]||null:null,'include':_0xb142b7['options']?_0xb142b7[_0x2951('0x1d')][_0x2951('0x20')]?_[_0x2951('0x21')](_0xb142b7['options'][_0x2951('0x20')],function(_0x307c64){return{'model':db[_0x307c64['model']],'as':_0x307c64['as'],'attributes':_0x307c64['attributes'],'include':_0x307c64[_0x2951('0x20')]?_[_0x2951('0x21')](_0x307c64[_0x2951('0x20')],function(_0x2283be){return{'model':db[_0x2283be[_0x2951('0x22')]],'as':_0x2283be['as'],'attributes':_0x2283be['attributes'],'include':_0x2283be['include']?_[_0x2951('0x21')](_0x2283be[_0x2951('0x20')],function(_0x4914af){return{'model':db[_0x4914af['model']],'as':_0x4914af['as'],'attributes':_0x4914af[_0x2951('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2951('0x12')](function(_0x411a6f){logger[_0x2951('0x13')]('ShowChatQueue',_0xb142b7);logger[_0x2951('0x24')](_0x2951('0x26'),_0xb142b7,JSON[_0x2951('0x17')](_0x411a6f));_0x419e52(_0x411a6f);})[_0x2951('0x1c')](function(_0x405986){logger[_0x2951('0x18')](_0x2951('0x26'),_0x405986[_0x2951('0x1a')],_0xb142b7);_0x38d019(_0x473bfd[_0x2951('0x18')](0x1f4,_0x405986[_0x2951('0x1a')]));});});}; \ No newline at end of file +var _0x0419=['socket.io-emitter','./chatQueue.socket','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','raw','limit','include','model','attributes','map','then','ShowChatQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x4e1d7d,_0x5a7761){var _0x53f086=function(_0x3bd510){while(--_0x3bd510){_0x4e1d7d['push'](_0x4e1d7d['shift']());}};_0x53f086(++_0x5a7761);}(_0x0419,0x153));var _0x9041=function(_0x39f237,_0x20c4be){_0x39f237=_0x39f237-0x0;var _0x3fb158=_0x0419[_0x39f237];return _0x3fb158;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9041('0x0'));var BPromise=require(_0x9041('0x1'));var rs=require(_0x9041('0x2'));var fs=require('fs');var Redis=require(_0x9041('0x3'));var db=require(_0x9041('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9041('0x5'));var config=require(_0x9041('0x6'));var jayson=require(_0x9041('0x7'));var client=jayson[_0x9041('0x8')]['http']({'port':0x232a});config[_0x9041('0x9')]=_[_0x9041('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9041('0xb'))(new Redis(config[_0x9041('0x9')]));require(_0x9041('0xc'))['register'](socket);function respondWithRpcPromise(_0x33b812,_0x4d0aaf,_0x22487){return new BPromise(function(_0x2964e9,_0x992570){return client['request'](_0x33b812,_0x22487)['then'](function(_0x473271){logger[_0x9041('0xd')]('ChatQueue,\x20%s,\x20%s',_0x4d0aaf,'request\x20sent');logger[_0x9041('0xe')](_0x9041('0xf'),_0x4d0aaf,_0x9041('0x10'),JSON[_0x9041('0x11')](_0x473271));if(_0x473271[_0x9041('0x12')]){if(_0x473271[_0x9041('0x12')][_0x9041('0x13')]===0x1f4){logger[_0x9041('0x12')](_0x9041('0x14'),_0x4d0aaf,_0x473271[_0x9041('0x12')][_0x9041('0x15')]);return _0x992570(_0x473271['error']['message']);}logger['error'](_0x9041('0x14'),_0x4d0aaf,_0x473271[_0x9041('0x12')][_0x9041('0x15')]);return _0x2964e9(_0x473271['error'][_0x9041('0x15')]);}else{logger[_0x9041('0xd')](_0x9041('0x14'),_0x4d0aaf,'request\x20sent');_0x2964e9(_0x473271[_0x9041('0x16')][_0x9041('0x15')]);}})[_0x9041('0x17')](function(_0x36a5c2){logger[_0x9041('0x12')](_0x9041('0x14'),_0x4d0aaf,_0x36a5c2);_0x992570(_0x36a5c2);});});}exports[_0x9041('0x18')]=function(_0x2f52e0){var _0x5cff96=this;return new Promise(function(_0x3d527b,_0xa8ee07){return db[_0x9041('0x19')]['findAll']({'raw':_0x2f52e0[_0x9041('0x1a')]?_0x2f52e0[_0x9041('0x1a')][_0x9041('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f52e0['options']?_0x2f52e0[_0x9041('0x1a')]['where']||null:null,'attributes':_0x2f52e0[_0x9041('0x1a')]?_0x2f52e0[_0x9041('0x1a')]['attributes']||null:null,'limit':_0x2f52e0['options']?_0x2f52e0[_0x9041('0x1a')][_0x9041('0x1c')]||null:null,'include':_0x2f52e0[_0x9041('0x1a')]?_0x2f52e0[_0x9041('0x1a')]['include']?_['map'](_0x2f52e0[_0x9041('0x1a')][_0x9041('0x1d')],function(_0x11401a){return{'model':db[_0x11401a[_0x9041('0x1e')]],'as':_0x11401a['as'],'attributes':_0x11401a[_0x9041('0x1f')],'include':_0x11401a['include']?_[_0x9041('0x20')](_0x11401a[_0x9041('0x1d')],function(_0x57a1db){return{'model':db[_0x57a1db[_0x9041('0x1e')]],'as':_0x57a1db['as'],'attributes':_0x57a1db[_0x9041('0x1f')],'include':_0x57a1db[_0x9041('0x1d')]?_[_0x9041('0x20')](_0x57a1db[_0x9041('0x1d')],function(_0x462620){return{'model':db[_0x462620[_0x9041('0x1e')]],'as':_0x462620['as'],'attributes':_0x462620[_0x9041('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9041('0x21')](function(_0xd3861e){logger[_0x9041('0xd')](_0x9041('0x18'),_0x2f52e0);logger[_0x9041('0xe')](_0x9041('0x18'),_0x2f52e0,JSON[_0x9041('0x11')](_0xd3861e));_0x3d527b(_0xd3861e);})[_0x9041('0x17')](function(_0x4fee5f){logger[_0x9041('0x12')](_0x9041('0x18'),_0x4fee5f[_0x9041('0x15')],_0x2f52e0);_0xa8ee07(_0x5cff96['error'](0x1f4,_0x4fee5f[_0x9041('0x15')]));});});};exports[_0x9041('0x22')]=function(_0x21c3d5){var _0x3c31e8=this;return new Promise(function(_0x2ea40a,_0x3370b0){return db['ChatQueue']['find']({'raw':_0x21c3d5['options']?_0x21c3d5['options'][_0x9041('0x1b')]===undefined?!![]:![]:!![],'where':_0x21c3d5[_0x9041('0x1a')]?_0x21c3d5['options']['where']||null:null,'attributes':_0x21c3d5[_0x9041('0x1a')]?_0x21c3d5[_0x9041('0x1a')][_0x9041('0x1f')]||null:null,'include':_0x21c3d5[_0x9041('0x1a')]?_0x21c3d5[_0x9041('0x1a')][_0x9041('0x1d')]?_['map'](_0x21c3d5['options']['include'],function(_0x152b15){return{'model':db[_0x152b15['model']],'as':_0x152b15['as'],'attributes':_0x152b15['attributes'],'include':_0x152b15[_0x9041('0x1d')]?_[_0x9041('0x20')](_0x152b15[_0x9041('0x1d')],function(_0xc22135){return{'model':db[_0xc22135[_0x9041('0x1e')]],'as':_0xc22135['as'],'attributes':_0xc22135[_0x9041('0x1f')],'include':_0xc22135[_0x9041('0x1d')]?_['map'](_0xc22135[_0x9041('0x1d')],function(_0x23b91e){return{'model':db[_0x23b91e[_0x9041('0x1e')]],'as':_0x23b91e['as'],'attributes':_0x23b91e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9041('0x21')](function(_0xe21f3){logger[_0x9041('0xd')]('ShowChatQueue',_0x21c3d5);logger[_0x9041('0xe')](_0x9041('0x22'),_0x21c3d5,JSON[_0x9041('0x11')](_0xe21f3));_0x2ea40a(_0xe21f3);})['catch'](function(_0x3745c0){logger[_0x9041('0x12')](_0x9041('0x22'),_0x3745c0[_0x9041('0x15')],_0x21c3d5);_0x3370b0(_0x3c31e8[_0x9041('0x12')](0x1f4,_0x3745c0[_0x9041('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 867f5f5..4adac29 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 _0xd6d6=['chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x385d93,_0x230aed){var _0x570924=function(_0x4cfc76){while(--_0x4cfc76){_0x385d93['push'](_0x385d93['shift']());}};_0x570924(++_0x230aed);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xd89881,_0x504b3a){_0xd89881=_0xd89881-0x0;var _0x1c3530=_0xd6d6[_0xd89881];return _0x1c3530;};'use strict';var ChatQueueEvents=require(_0x6d6d('0x0'));var events=[_0x6d6d('0x1'),_0x6d6d('0x2'),_0x6d6d('0x3')];function createListener(_0x536523,_0x2e1aed){return function(_0x3b743d){_0x2e1aed[_0x6d6d('0x4')](_0x536523,_0x3b743d);};}function removeListener(_0x2a838a,_0x5207c9){return function(){ChatQueueEvents[_0x6d6d('0x5')](_0x2a838a,_0x5207c9);};}exports[_0x6d6d('0x6')]=function(_0x5702dc){for(var _0x210ff7=0x0,_0x1bf731=events[_0x6d6d('0x7')];_0x210ff7<_0x1bf731;_0x210ff7++){var _0x18f824=events[_0x210ff7];var _0xd49f57=createListener(_0x6d6d('0x8')+_0x18f824,_0x5702dc);ChatQueueEvents['on'](_0x18f824,_0xd49f57);}}; \ No newline at end of file +var _0x4b84=['./chatQueue.events','save','emit','length'];(function(_0x44995f,_0x532a52){var _0x4476a2=function(_0x4aa0f6){while(--_0x4aa0f6){_0x44995f['push'](_0x44995f['shift']());}};_0x4476a2(++_0x532a52);}(_0x4b84,0x1cc));var _0x44b8=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x4b84[_0x408e38];return _0x426b0e;};'use strict';var ChatQueueEvents=require(_0x44b8('0x0'));var events=[_0x44b8('0x1'),'remove','update'];function createListener(_0x765943,_0x519db3){return function(_0x4b8ad8){_0x519db3[_0x44b8('0x2')](_0x765943,_0x4b8ad8);};}function removeListener(_0x31282a,_0x39ad16){return function(){ChatQueueEvents['removeListener'](_0x31282a,_0x39ad16);};}exports['register']=function(_0x55f25d){for(var _0x996a8b=0x0,_0x54274b=events[_0x44b8('0x3')];_0x996a8b<_0x54274b;_0x996a8b++){var _0x5947f7=events[_0x996a8b];var _0x3e87c5=createListener('chatQueue:'+_0x5947f7,_0x55f25d);ChatQueueEvents['on'](_0x5947f7,_0x3e87c5);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 38a674a..8215463 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x3be72b,_0x5a63f8){var _0x4b8677=function(_0x22654f){while(--_0x22654f){_0x3be72b['push'](_0x3be72b['shift']());}};_0x4b8677(++_0x5a63f8);}(_0x55ca,0x126));var _0xa55c=function(_0x4e71ac,_0x42aced){_0x4e71ac=_0x4e71ac-0x0;var _0x11d76c=_0x55ca[_0x4e71ac];return _0x11d76c;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +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(_0x30bcf1,_0x30c2db){var _0x150883=function(_0x130930){while(--_0x130930){_0x30bcf1['push'](_0x30bcf1['shift']());}};_0x150883(++_0x30c2db);}(_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',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 aea8983..b2dc50e 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 _0x5770=['moment','sequelize','STRING','DATE'];(function(_0x113156,_0x58a687){var _0x1d8bb5=function(_0x4e45e6){while(--_0x4e45e6){_0x113156['push'](_0x113156['shift']());}};_0x1d8bb5(++_0x58a687);}(_0x5770,0x1b0));var _0x0577=function(_0x57a353,_0x21498d){_0x57a353=_0x57a353-0x0;var _0x4d1690=_0x5770[_0x57a353];return _0x4d1690;};'use strict';var moment=require(_0x0577('0x0'));var Sequelize=require(_0x0577('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0577('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0577('0x2')]},'joinAt':{'type':Sequelize[_0x0577('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0577('0x3')]},'exitAt':{'type':Sequelize[_0x0577('0x3')]},'reason':{'type':Sequelize[_0x0577('0x2')]}}; \ No newline at end of file +var _0x890f=['DATE','sequelize','exports','STRING'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x890f,0x1a1));var _0xf890=function(_0x42225e,_0x1164f2){_0x42225e=_0x42225e-0x0;var _0x2bf9e5=_0x890f[_0x42225e];return _0x2bf9e5;};'use strict';var moment=require('moment');var Sequelize=require(_0xf890('0x0'));module[_0xf890('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf890('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf890('0x3')]},'acceptAt':{'type':Sequelize[_0xf890('0x3')]},'exitAt':{'type':Sequelize[_0xf890('0x3')]},'reason':{'type':Sequelize[_0xf890('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5a3d906..bfec721 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 _0xef96=['util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','ChatQueueReport','findAll','rows','show','params','intersection','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1255d6,_0x481067){var _0x1397af=function(_0x59a5ad){while(--_0x59a5ad){_0x1255d6['push'](_0x1255d6['shift']());}};_0x1397af(++_0x481067);}(_0xef96,0x162));var _0x6ef9=function(_0x2e111f,_0xdca1a2){_0x2e111f=_0x2e111f-0x0;var _0x428e6f=_0xef96[_0x2e111f];return _0x428e6f;};'use strict';var emlformat=require(_0x6ef9('0x0'));var rimraf=require(_0x6ef9('0x1'));var zipdir=require(_0x6ef9('0x2'));var jsonpatch=require(_0x6ef9('0x3'));var rp=require(_0x6ef9('0x4'));var moment=require(_0x6ef9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ef9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6ef9('0x7'));var ejs=require(_0x6ef9('0x8'));var fs=require('fs');var fs_extra=require(_0x6ef9('0x9'));var _=require('lodash');var squel=require(_0x6ef9('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ef9('0xb'));var deskjs=require(_0x6ef9('0xc'));var toCsv=require(_0x6ef9('0x7'));var querystring=require('querystring');var Papa=require(_0x6ef9('0xd'));var Redis=require('ioredis');var authService=require(_0x6ef9('0xe'));var qs=require(_0x6ef9('0xf'));var as=require(_0x6ef9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ef9('0x11'))(_0x6ef9('0x12'));var utils=require(_0x6ef9('0x13'));var config=require(_0x6ef9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ef9('0x15'))['db'];function respondWithStatusCode(_0x428156,_0x2e732f){_0x2e732f=_0x2e732f||0xcc;return function(_0x100591){if(_0x100591){return _0x428156[_0x6ef9('0x16')](_0x2e732f);}return _0x428156[_0x6ef9('0x17')](_0x2e732f)[_0x6ef9('0x18')]();};}function respondWithResult(_0x5e2fc1,_0x24681e){_0x24681e=_0x24681e||0xc8;return function(_0x2942bc){if(_0x2942bc){return _0x5e2fc1[_0x6ef9('0x17')](_0x24681e)[_0x6ef9('0x19')](_0x2942bc);}};}function respondWithFilteredResult(_0xce5672,_0x297af7){return function(_0x2c373c){if(_0x2c373c){var _0x253b13=typeof _0x297af7[_0x6ef9('0x1a')]==='undefined'&&typeof _0x297af7[_0x6ef9('0x1b')]===_0x6ef9('0x1c');var _0x4fac02=_0x2c373c['count'];var _0x1cb130=_0x253b13?0x0:_0x297af7['offset'];var _0x1855e1=_0x253b13?_0x2c373c[_0x6ef9('0x1d')]:_0x297af7[_0x6ef9('0x1a')]+_0x297af7[_0x6ef9('0x1b')];var _0x1d975c;if(_0x1855e1>=_0x4fac02){_0x1855e1=_0x4fac02;_0x1d975c=0xc8;}else{_0x1d975c=0xce;}_0xce5672[_0x6ef9('0x17')](_0x1d975c);return _0xce5672['set']('Content-Range',_0x1cb130+'-'+_0x1855e1+'/'+_0x4fac02)[_0x6ef9('0x19')](_0x2c373c);}return null;};}function patchUpdates(_0x243de4){return function(_0x587d43){try{jsonpatch[_0x6ef9('0x1e')](_0x587d43,_0x243de4,!![]);}catch(_0x3e74d2){return BPromise[_0x6ef9('0x1f')](_0x3e74d2);}return _0x587d43[_0x6ef9('0x20')]();};}function saveUpdates(_0x168cd5,_0x1ef6ee){return function(_0x404515){if(_0x404515){return _0x404515['update'](_0x168cd5)['then'](function(_0xae1b6e){return _0xae1b6e;});}return null;};}function removeEntity(_0x35bc5e,_0x4d664d){return function(_0x49faeb){if(_0x49faeb){return _0x49faeb[_0x6ef9('0x21')]()['then'](function(){_0x35bc5e[_0x6ef9('0x17')](0xcc)[_0x6ef9('0x18')]();});}};}function handleEntityNotFound(_0xdbc856,_0x383197){return function(_0x1bdb00){if(!_0x1bdb00){_0xdbc856[_0x6ef9('0x16')](0x194);}return _0x1bdb00;};}function handleError(_0x196ec0,_0x4f6c85){_0x4f6c85=_0x4f6c85||0x1f4;return function(_0x2e503b){logger['error'](_0x2e503b[_0x6ef9('0x22')]);if(_0x2e503b[_0x6ef9('0x23')]){delete _0x2e503b[_0x6ef9('0x23')];}_0x196ec0[_0x6ef9('0x17')](_0x4f6c85)[_0x6ef9('0x24')](_0x2e503b);};}exports[_0x6ef9('0x25')]=function(_0x212d32,_0x4eb696){var _0x57f6f9={},_0x569649={},_0x50750d={'count':0x0,'rows':[]};var _0x5e0a13=_[_0x6ef9('0x26')](db['ChatQueueReport'][_0x6ef9('0x27')],function(_0x5a8f0c){return{'name':_0x5a8f0c[_0x6ef9('0x28')],'type':_0x5a8f0c[_0x6ef9('0x29')][_0x6ef9('0x2a')]};});_0x569649[_0x6ef9('0x2b')]=_['map'](_0x5e0a13,_0x6ef9('0x23'));_0x569649[_0x6ef9('0x2c')]=_[_0x6ef9('0x2d')](_0x212d32['query']);_0x569649[_0x6ef9('0x2e')]=_['intersection'](_0x569649[_0x6ef9('0x2b')],_0x569649[_0x6ef9('0x2c')]);_0x57f6f9[_0x6ef9('0x2f')]=_['intersection'](_0x569649[_0x6ef9('0x2b')],qs[_0x6ef9('0x30')](_0x212d32['query'][_0x6ef9('0x30')]));_0x57f6f9[_0x6ef9('0x2f')]=_0x57f6f9[_0x6ef9('0x2f')][_0x6ef9('0x31')]?_0x57f6f9[_0x6ef9('0x2f')]:_0x569649[_0x6ef9('0x2b')];if(!_0x212d32['query']['hasOwnProperty']('nolimit')){_0x57f6f9['limit']=qs[_0x6ef9('0x1b')](_0x212d32['query']['limit']);_0x57f6f9[_0x6ef9('0x1a')]=qs[_0x6ef9('0x1a')](_0x212d32['query'][_0x6ef9('0x1a')]);}_0x57f6f9['order']=qs['sort'](_0x212d32[_0x6ef9('0x2c')][_0x6ef9('0x32')]);_0x57f6f9['where']=qs[_0x6ef9('0x2e')](_[_0x6ef9('0x33')](_0x212d32[_0x6ef9('0x2c')],_0x569649['filters']),_0x5e0a13);if(_0x212d32[_0x6ef9('0x2c')][_0x6ef9('0x34')]){_0x57f6f9[_0x6ef9('0x35')]=_[_0x6ef9('0x36')](_0x57f6f9['where'],{'$or':_[_0x6ef9('0x26')](_0x5e0a13,function(_0x2d6370){if(_0x2d6370['type']!==_0x6ef9('0x37')){var _0x305c34={};_0x305c34[_0x2d6370['name']]={'$like':'%'+_0x212d32[_0x6ef9('0x2c')][_0x6ef9('0x34')]+'%'};return _0x305c34;}})});}_0x57f6f9=_[_0x6ef9('0x36')]({},_0x57f6f9,_0x212d32[_0x6ef9('0x38')]);var _0x43a62b={'where':_0x57f6f9[_0x6ef9('0x35')]};return db['ChatQueueReport'][_0x6ef9('0x1d')](_0x43a62b)[_0x6ef9('0x39')](function(_0x5e275a){_0x50750d[_0x6ef9('0x1d')]=_0x5e275a;if(_0x212d32['query'][_0x6ef9('0x3a')]){_0x57f6f9[_0x6ef9('0x3b')]=[{'all':!![]}];}return db[_0x6ef9('0x3c')][_0x6ef9('0x3d')](_0x57f6f9);})[_0x6ef9('0x39')](function(_0x4e6f10){_0x50750d[_0x6ef9('0x3e')]=_0x4e6f10;return _0x50750d;})[_0x6ef9('0x39')](respondWithFilteredResult(_0x4eb696,_0x57f6f9))['catch'](handleError(_0x4eb696,null));};exports[_0x6ef9('0x3f')]=function(_0x150cf8,_0x42382e){var _0x335fbf={'raw':!![],'where':{'id':_0x150cf8[_0x6ef9('0x40')]['id']}},_0x4fcd39={};_0x4fcd39[_0x6ef9('0x2b')]=_[_0x6ef9('0x2d')](db[_0x6ef9('0x3c')][_0x6ef9('0x27')]);_0x4fcd39['query']=_['keys'](_0x150cf8['query']);_0x4fcd39[_0x6ef9('0x2e')]=_[_0x6ef9('0x41')](_0x4fcd39['model'],_0x4fcd39[_0x6ef9('0x2c')]);_0x335fbf[_0x6ef9('0x2f')]=_['intersection'](_0x4fcd39[_0x6ef9('0x2b')],qs['fields'](_0x150cf8[_0x6ef9('0x2c')][_0x6ef9('0x30')]));_0x335fbf[_0x6ef9('0x2f')]=_0x335fbf[_0x6ef9('0x2f')][_0x6ef9('0x31')]?_0x335fbf['attributes']:_0x4fcd39[_0x6ef9('0x2b')];if(_0x150cf8[_0x6ef9('0x2c')][_0x6ef9('0x3a')]){_0x335fbf[_0x6ef9('0x3b')]=[{'all':!![]}];}_0x335fbf=_[_0x6ef9('0x36')]({},_0x335fbf,_0x150cf8[_0x6ef9('0x38')]);return db['ChatQueueReport'][_0x6ef9('0x42')](_0x335fbf)[_0x6ef9('0x39')](handleEntityNotFound(_0x42382e,null))[_0x6ef9('0x39')](respondWithResult(_0x42382e,null))[_0x6ef9('0x43')](handleError(_0x42382e,null));};exports[_0x6ef9('0x44')]=function(_0xdf2b5b,_0x2d3d8e){return db['ChatQueueReport'][_0x6ef9('0x44')](_0xdf2b5b[_0x6ef9('0x45')],{})[_0x6ef9('0x39')](respondWithResult(_0x2d3d8e,0xc9))[_0x6ef9('0x43')](handleError(_0x2d3d8e,null));};exports[_0x6ef9('0x46')]=function(_0x397258,_0x22cd98){if(_0x397258[_0x6ef9('0x45')]['id']){delete _0x397258['body']['id'];}return db[_0x6ef9('0x3c')][_0x6ef9('0x42')]({'where':{'id':_0x397258['params']['id']}})[_0x6ef9('0x39')](handleEntityNotFound(_0x22cd98,null))['then'](saveUpdates(_0x397258[_0x6ef9('0x45')],null))[_0x6ef9('0x39')](respondWithResult(_0x22cd98,null))['catch'](handleError(_0x22cd98,null));};exports[_0x6ef9('0x21')]=function(_0x39f1a8,_0x17cac8){return db[_0x6ef9('0x3c')][_0x6ef9('0x42')]({'where':{'id':_0x39f1a8['params']['id']}})[_0x6ef9('0x39')](handleEntityNotFound(_0x17cac8,null))[_0x6ef9('0x39')](removeEntity(_0x17cac8,null))[_0x6ef9('0x43')](handleError(_0x17cac8,null));};exports[_0x6ef9('0x47')]=function(_0x303967,_0x1ea78b){return db['ChatQueueReport']['describe']()['then'](respondWithResult(_0x1ea78b,null))[_0x6ef9('0x43')](handleError(_0x1ea78b,null));}; \ No newline at end of file +var _0xa24d=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','type','ChatQueueReport','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format'];(function(_0x505bfb,_0xe48938){var _0x3bca12=function(_0x1fb16f){while(--_0x1fb16f){_0x505bfb['push'](_0x505bfb['shift']());}};_0x3bca12(++_0xe48938);}(_0xa24d,0x1c1));var _0xda24=function(_0x1d38e0,_0x23dcaf){_0x1d38e0=_0x1d38e0-0x0;var _0x26e31b=_0xa24d[_0x1d38e0];return _0x26e31b;};'use strict';var emlformat=require(_0xda24('0x0'));var rimraf=require(_0xda24('0x1'));var zipdir=require(_0xda24('0x2'));var jsonpatch=require(_0xda24('0x3'));var rp=require(_0xda24('0x4'));var moment=require(_0xda24('0x5'));var BPromise=require(_0xda24('0x6'));var Mustache=require('mustache');var util=require(_0xda24('0x7'));var path=require(_0xda24('0x8'));var sox=require(_0xda24('0x9'));var csv=require(_0xda24('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda24('0xb'));var _=require(_0xda24('0xc'));var squel=require('squel');var crypto=require(_0xda24('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xda24('0xe'));var toCsv=require(_0xda24('0xa'));var querystring=require(_0xda24('0xf'));var Papa=require(_0xda24('0x10'));var Redis=require('ioredis');var authService=require(_0xda24('0x11'));var qs=require(_0xda24('0x12'));var as=require(_0xda24('0x13'));var hardwareService=require(_0xda24('0x14'));var logger=require(_0xda24('0x15'))('api');var utils=require(_0xda24('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xda24('0x17'));var db=require(_0xda24('0x18'))['db'];function respondWithStatusCode(_0x519fb9,_0x54b23d){_0x54b23d=_0x54b23d||0xcc;return function(_0x2e3505){if(_0x2e3505){return _0x519fb9[_0xda24('0x19')](_0x54b23d);}return _0x519fb9[_0xda24('0x1a')](_0x54b23d)[_0xda24('0x1b')]();};}function respondWithResult(_0x4f34a4,_0xef067b){_0xef067b=_0xef067b||0xc8;return function(_0x53dadc){if(_0x53dadc){return _0x4f34a4[_0xda24('0x1a')](_0xef067b)[_0xda24('0x1c')](_0x53dadc);}};}function respondWithFilteredResult(_0x57f4d6,_0x547e1c){return function(_0x53749f){if(_0x53749f){var _0x26764=typeof _0x547e1c[_0xda24('0x1d')]===_0xda24('0x1e')&&typeof _0x547e1c[_0xda24('0x1f')]===_0xda24('0x1e');var _0x8f6c65=_0x53749f[_0xda24('0x20')];var _0x847878=_0x26764?0x0:_0x547e1c['offset'];var _0x22b57d=_0x26764?_0x53749f[_0xda24('0x20')]:_0x547e1c['offset']+_0x547e1c[_0xda24('0x1f')];var _0x510b07;if(_0x22b57d>=_0x8f6c65){_0x22b57d=_0x8f6c65;_0x510b07=0xc8;}else{_0x510b07=0xce;}_0x57f4d6['status'](_0x510b07);return _0x57f4d6[_0xda24('0x21')](_0xda24('0x22'),_0x847878+'-'+_0x22b57d+'/'+_0x8f6c65)[_0xda24('0x1c')](_0x53749f);}return null;};}function patchUpdates(_0x46cb50){return function(_0x3cdeb5){try{jsonpatch[_0xda24('0x23')](_0x3cdeb5,_0x46cb50,!![]);}catch(_0xc7fab5){return BPromise['reject'](_0xc7fab5);}return _0x3cdeb5[_0xda24('0x24')]();};}function saveUpdates(_0x5f53a3,_0x232df2){return function(_0x2fdf18){if(_0x2fdf18){return _0x2fdf18[_0xda24('0x25')](_0x5f53a3)[_0xda24('0x26')](function(_0x17c573){return _0x17c573;});}return null;};}function removeEntity(_0x2f9ae2,_0x454d04){return function(_0xd74f8d){if(_0xd74f8d){return _0xd74f8d[_0xda24('0x27')]()[_0xda24('0x26')](function(){_0x2f9ae2[_0xda24('0x1a')](0xcc)[_0xda24('0x1b')]();});}};}function handleEntityNotFound(_0x5edfc0,_0x468647){return function(_0x30e886){if(!_0x30e886){_0x5edfc0[_0xda24('0x19')](0x194);}return _0x30e886;};}function handleError(_0x35ff0f,_0x196304){_0x196304=_0x196304||0x1f4;return function(_0x3f666b){logger['error'](_0x3f666b[_0xda24('0x28')]);if(_0x3f666b['name']){delete _0x3f666b[_0xda24('0x29')];}_0x35ff0f[_0xda24('0x1a')](_0x196304)['send'](_0x3f666b);};}exports[_0xda24('0x2a')]=function(_0xd6d60f,_0x49a311){var _0x40487d={},_0xc98aa2={},_0x9a6911={'count':0x0,'rows':[]};var _0x11ffb5=_[_0xda24('0x2b')](db['ChatQueueReport']['rawAttributes'],function(_0x20f60d){return{'name':_0x20f60d['fieldName'],'type':_0x20f60d['type'][_0xda24('0x2c')]};});_0xc98aa2[_0xda24('0x2d')]=_['map'](_0x11ffb5,'name');_0xc98aa2[_0xda24('0x2e')]=_[_0xda24('0x2f')](_0xd6d60f['query']);_0xc98aa2['filters']=_[_0xda24('0x30')](_0xc98aa2[_0xda24('0x2d')],_0xc98aa2[_0xda24('0x2e')]);_0x40487d[_0xda24('0x31')]=_[_0xda24('0x30')](_0xc98aa2['model'],qs[_0xda24('0x32')](_0xd6d60f[_0xda24('0x2e')][_0xda24('0x32')]));_0x40487d[_0xda24('0x31')]=_0x40487d['attributes'][_0xda24('0x33')]?_0x40487d['attributes']:_0xc98aa2[_0xda24('0x2d')];if(!_0xd6d60f[_0xda24('0x2e')][_0xda24('0x34')](_0xda24('0x35'))){_0x40487d[_0xda24('0x1f')]=qs['limit'](_0xd6d60f[_0xda24('0x2e')][_0xda24('0x1f')]);_0x40487d[_0xda24('0x1d')]=qs[_0xda24('0x1d')](_0xd6d60f[_0xda24('0x2e')]['offset']);}_0x40487d[_0xda24('0x36')]=qs[_0xda24('0x37')](_0xd6d60f['query']['sort']);_0x40487d['where']=qs[_0xda24('0x38')](_[_0xda24('0x39')](_0xd6d60f[_0xda24('0x2e')],_0xc98aa2[_0xda24('0x38')]),_0x11ffb5);if(_0xd6d60f[_0xda24('0x2e')][_0xda24('0x3a')]){_0x40487d['where']=_[_0xda24('0x3b')](_0x40487d[_0xda24('0x3c')],{'$or':_[_0xda24('0x2b')](_0x11ffb5,function(_0x5aa0aa){if(_0x5aa0aa[_0xda24('0x3d')]!=='VIRTUAL'){var _0x25d0cd={};_0x25d0cd[_0x5aa0aa['name']]={'$like':'%'+_0xd6d60f[_0xda24('0x2e')]['filter']+'%'};return _0x25d0cd;}})});}_0x40487d=_[_0xda24('0x3b')]({},_0x40487d,_0xd6d60f['options']);var _0x5e81e8={'where':_0x40487d[_0xda24('0x3c')]};return db[_0xda24('0x3e')][_0xda24('0x20')](_0x5e81e8)[_0xda24('0x26')](function(_0x46c18b){_0x9a6911[_0xda24('0x20')]=_0x46c18b;if(_0xd6d60f[_0xda24('0x2e')]['includeAll']){_0x40487d[_0xda24('0x3f')]=[{'all':!![]}];}return db[_0xda24('0x3e')][_0xda24('0x40')](_0x40487d);})[_0xda24('0x26')](function(_0xe42050){_0x9a6911[_0xda24('0x41')]=_0xe42050;return _0x9a6911;})[_0xda24('0x26')](respondWithFilteredResult(_0x49a311,_0x40487d))[_0xda24('0x42')](handleError(_0x49a311,null));};exports[_0xda24('0x43')]=function(_0x1aa0eb,_0x4aea76){var _0x3e6597={'raw':!![],'where':{'id':_0x1aa0eb[_0xda24('0x44')]['id']}},_0x61f885={};_0x61f885[_0xda24('0x2d')]=_['keys'](db[_0xda24('0x3e')][_0xda24('0x45')]);_0x61f885['query']=_['keys'](_0x1aa0eb['query']);_0x61f885['filters']=_['intersection'](_0x61f885['model'],_0x61f885[_0xda24('0x2e')]);_0x3e6597[_0xda24('0x31')]=_[_0xda24('0x30')](_0x61f885[_0xda24('0x2d')],qs[_0xda24('0x32')](_0x1aa0eb['query'][_0xda24('0x32')]));_0x3e6597[_0xda24('0x31')]=_0x3e6597[_0xda24('0x31')][_0xda24('0x33')]?_0x3e6597['attributes']:_0x61f885[_0xda24('0x2d')];if(_0x1aa0eb[_0xda24('0x2e')][_0xda24('0x46')]){_0x3e6597[_0xda24('0x3f')]=[{'all':!![]}];}_0x3e6597=_[_0xda24('0x3b')]({},_0x3e6597,_0x1aa0eb['options']);return db['ChatQueueReport'][_0xda24('0x47')](_0x3e6597)[_0xda24('0x26')](handleEntityNotFound(_0x4aea76,null))[_0xda24('0x26')](respondWithResult(_0x4aea76,null))[_0xda24('0x42')](handleError(_0x4aea76,null));};exports[_0xda24('0x48')]=function(_0x37a834,_0xcfcbd5){return db['ChatQueueReport'][_0xda24('0x48')](_0x37a834[_0xda24('0x49')],{})['then'](respondWithResult(_0xcfcbd5,0xc9))['catch'](handleError(_0xcfcbd5,null));};exports[_0xda24('0x25')]=function(_0x2eb12b,_0x302e2b){if(_0x2eb12b['body']['id']){delete _0x2eb12b[_0xda24('0x49')]['id'];}return db[_0xda24('0x3e')][_0xda24('0x47')]({'where':{'id':_0x2eb12b['params']['id']}})[_0xda24('0x26')](handleEntityNotFound(_0x302e2b,null))[_0xda24('0x26')](saveUpdates(_0x2eb12b['body'],null))[_0xda24('0x26')](respondWithResult(_0x302e2b,null))[_0xda24('0x42')](handleError(_0x302e2b,null));};exports[_0xda24('0x27')]=function(_0x264eb0,_0x2f87b7){return db['ChatQueueReport'][_0xda24('0x47')]({'where':{'id':_0x264eb0[_0xda24('0x44')]['id']}})[_0xda24('0x26')](handleEntityNotFound(_0x2f87b7,null))[_0xda24('0x26')](removeEntity(_0x2f87b7,null))['catch'](handleError(_0x2f87b7,null));};exports[_0xda24('0x4a')]=function(_0x73a1f3,_0x4de9ad){return db[_0xda24('0x3e')][_0xda24('0x4a')]()['then'](respondWithResult(_0x4de9ad,null))[_0xda24('0x42')](handleError(_0x4de9ad,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f79a643..5b7da1e 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x273987,_0x44056f){var _0x50ebc7=function(_0x4efbf0){while(--_0x4efbf0){_0x273987['push'](_0x273987['shift']());}};_0x50ebc7(++_0x44056f);}(_0xb10b,0x12a));var _0xbb10=function(_0x219935,_0x5b7d02){_0x219935=_0x219935-0x0;var _0x130409=_0xb10b[_0x219935];return _0x130409;};'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 +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_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'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('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 4b48619..3dd3c57 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 _0xb72f=['limit','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','raw','then','stringify','UpdateChatQueueReport','update','options','where','attributes'];(function(_0x97820c,_0x2b6f84){var _0x4d1bfe=function(_0x558c1b){while(--_0x558c1b){_0x97820c['push'](_0x97820c['shift']());}};_0x4d1bfe(++_0x2b6f84);}(_0xb72f,0x161));var _0xfb72=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0xb72f[_0x582f72];return _0x4cd5fe;};'use strict';var _=require(_0xfb72('0x0'));var util=require(_0xfb72('0x1'));var moment=require('moment');var BPromise=require(_0xfb72('0x2'));var rs=require(_0xfb72('0x3'));var fs=require('fs');var Redis=require(_0xfb72('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfb72('0x5'))(_0xfb72('0x6'));var config=require(_0xfb72('0x7'));var jayson=require(_0xfb72('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x195533,_0x5abebc,_0x4ebd26){return new BPromise(function(_0x29314f,_0x1a4f88){return client[_0xfb72('0x9')](_0x195533,_0x4ebd26)['then'](function(_0x4347ec){logger[_0xfb72('0xa')](_0xfb72('0xb'),_0x5abebc,_0xfb72('0xc'));logger[_0xfb72('0xd')](_0xfb72('0xe'),_0x5abebc,_0xfb72('0xc'),JSON['stringify'](_0x4347ec));if(_0x4347ec[_0xfb72('0xf')]){if(_0x4347ec['error'][_0xfb72('0x10')]===0x1f4){logger['error'](_0xfb72('0xb'),_0x5abebc,_0x4347ec[_0xfb72('0xf')]['message']);return _0x1a4f88(_0x4347ec[_0xfb72('0xf')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5abebc,_0x4347ec['error'][_0xfb72('0x11')]);return _0x29314f(_0x4347ec[_0xfb72('0xf')][_0xfb72('0x11')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5abebc,_0xfb72('0xc'));_0x29314f(_0x4347ec['result']['message']);}})[_0xfb72('0x12')](function(_0x595051){logger[_0xfb72('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x5abebc,_0x595051);_0x1a4f88(_0x595051);});});}exports[_0xfb72('0x13')]=function(_0x55cba4){var _0x159be0=this;return new Promise(function(_0x4f1067,_0x41d331){return db[_0xfb72('0x14')][_0xfb72('0x15')](_0x55cba4[_0xfb72('0x16')],{'raw':_0x55cba4['options']?_0x55cba4['options'][_0xfb72('0x17')]===undefined?!![]:![]:!![]})[_0xfb72('0x18')](function(_0x513632){logger[_0xfb72('0xa')](_0xfb72('0x13'),_0x55cba4);logger[_0xfb72('0xd')](_0xfb72('0x13'),_0x55cba4,JSON[_0xfb72('0x19')](_0x513632));_0x4f1067(_0x513632);})[_0xfb72('0x12')](function(_0x351e16){logger[_0xfb72('0xf')](_0xfb72('0x13'),_0x351e16[_0xfb72('0x11')],_0x55cba4);_0x41d331(_0x159be0[_0xfb72('0xf')](0x1f4,_0x351e16[_0xfb72('0x11')]));});});};exports[_0xfb72('0x1a')]=function(_0x85146f){var _0x2d85bd=this;return new Promise(function(_0x40e1b2,_0x30c6f6){return db[_0xfb72('0x14')][_0xfb72('0x1b')](_0x85146f[_0xfb72('0x16')],{'raw':_0x85146f['options']?_0x85146f[_0xfb72('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x85146f[_0xfb72('0x1c')]?_0x85146f['options'][_0xfb72('0x1d')]||null:null,'attributes':_0x85146f[_0xfb72('0x1c')]?_0x85146f[_0xfb72('0x1c')][_0xfb72('0x1e')]||null:null,'limit':_0x85146f[_0xfb72('0x1c')]?_0x85146f[_0xfb72('0x1c')][_0xfb72('0x1f')]||null:null})['then'](function(_0x529430){logger[_0xfb72('0xa')](_0xfb72('0x1a'),_0x85146f);logger[_0xfb72('0xd')](_0xfb72('0x1a'),_0x85146f,JSON['stringify'](_0x529430));_0x40e1b2(_0x529430);})[_0xfb72('0x12')](function(_0x39d55b){logger[_0xfb72('0xf')]('UpdateChatQueueReport',_0x39d55b[_0xfb72('0x11')],_0x85146f);_0x30c6f6(_0x2d85bd[_0xfb72('0xf')](0x1f4,_0x39d55b[_0xfb72('0x11')]));});});}; \ No newline at end of file +var _0x988c=['CreateChatQueueReport','ChatQueueReport','create','options','UpdateChatQueueReport','update','body','raw','where','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x988c,0x19e));var _0xc988=function(_0x2e7c21,_0x461843){_0x2e7c21=_0x2e7c21-0x0;var _0x23d22f=_0x988c[_0x2e7c21];return _0x23d22f;};'use strict';var _=require(_0xc988('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc988('0x1'));var fs=require('fs');var Redis=require(_0xc988('0x2'));var db=require(_0xc988('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc988('0x4'));var jayson=require(_0xc988('0x5'));var client=jayson[_0xc988('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e109,_0x14b586,_0x4e6f38){return new BPromise(function(_0x4e48db,_0x2a96ab){return client[_0xc988('0x7')](_0x26e109,_0x4e6f38)[_0xc988('0x8')](function(_0x271d0f){logger[_0xc988('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x14b586,_0xc988('0xa'));logger[_0xc988('0xb')](_0xc988('0xc'),_0x14b586,_0xc988('0xa'),JSON[_0xc988('0xd')](_0x271d0f));if(_0x271d0f['error']){if(_0x271d0f[_0xc988('0xe')][_0xc988('0xf')]===0x1f4){logger[_0xc988('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x14b586,_0x271d0f[_0xc988('0xe')]['message']);return _0x2a96ab(_0x271d0f[_0xc988('0xe')]['message']);}logger[_0xc988('0xe')](_0xc988('0x10'),_0x14b586,_0x271d0f[_0xc988('0xe')][_0xc988('0x11')]);return _0x4e48db(_0x271d0f['error'][_0xc988('0x11')]);}else{logger[_0xc988('0x9')](_0xc988('0x10'),_0x14b586,_0xc988('0xa'));_0x4e48db(_0x271d0f[_0xc988('0x12')][_0xc988('0x11')]);}})[_0xc988('0x13')](function(_0x35aebb){logger[_0xc988('0xe')](_0xc988('0x10'),_0x14b586,_0x35aebb);_0x2a96ab(_0x35aebb);});});}exports[_0xc988('0x14')]=function(_0x49738a){var _0x314a24=this;return new Promise(function(_0x23677f,_0x32319c){return db[_0xc988('0x15')][_0xc988('0x16')](_0x49738a['body'],{'raw':_0x49738a['options']?_0x49738a[_0xc988('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc988('0x8')](function(_0x3cad71){logger['info']('CreateChatQueueReport',_0x49738a);logger[_0xc988('0xb')](_0xc988('0x14'),_0x49738a,JSON[_0xc988('0xd')](_0x3cad71));_0x23677f(_0x3cad71);})['catch'](function(_0xc5754d){logger[_0xc988('0xe')](_0xc988('0x14'),_0xc5754d['message'],_0x49738a);_0x32319c(_0x314a24[_0xc988('0xe')](0x1f4,_0xc5754d[_0xc988('0x11')]));});});};exports[_0xc988('0x18')]=function(_0x5b4555){var _0x5444a5=this;return new Promise(function(_0x343ac3,_0x3ca571){return db[_0xc988('0x15')][_0xc988('0x19')](_0x5b4555[_0xc988('0x1a')],{'raw':_0x5b4555[_0xc988('0x17')]?_0x5b4555[_0xc988('0x17')][_0xc988('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b4555['options']?_0x5b4555[_0xc988('0x17')][_0xc988('0x1c')]||null:null,'attributes':_0x5b4555[_0xc988('0x17')]?_0x5b4555[_0xc988('0x17')][_0xc988('0x1d')]||null:null,'limit':_0x5b4555[_0xc988('0x17')]?_0x5b4555[_0xc988('0x17')][_0xc988('0x1e')]||null:null})['then'](function(_0x2a0d6f){logger[_0xc988('0x9')](_0xc988('0x18'),_0x5b4555);logger[_0xc988('0xb')]('UpdateChatQueueReport',_0x5b4555,JSON['stringify'](_0x2a0d6f));_0x343ac3(_0x2a0d6f);})[_0xc988('0x13')](function(_0x11d51f){logger[_0xc988('0xe')]('UpdateChatQueueReport',_0x11d51f[_0xc988('0x11')],_0x5b4555);_0x3ca571(_0x5444a5[_0xc988('0xe')](0x1f4,_0x11d51f[_0xc988('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c545af5..396737e 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 _0x3d9a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','/:id','exports','multer'];(function(_0x5e2f80,_0x2afd67){var _0x15d05e=function(_0x52251d){while(--_0x52251d){_0x5e2f80['push'](_0x5e2f80['shift']());}};_0x15d05e(++_0x2afd67);}(_0x3d9a,0x18e));var _0xa3d9=function(_0x570e1,_0x5579e1){_0x570e1=_0x570e1-0x0;var _0x4b9f83=_0x3d9a[_0x570e1];return _0x4b9f83;};'use strict';var multer=require(_0xa3d9('0x0'));var util=require(_0xa3d9('0x1'));var path=require('path');var timeout=require(_0xa3d9('0x2'));var express=require(_0xa3d9('0x3'));var router=express[_0xa3d9('0x4')]();var fs_extra=require(_0xa3d9('0x5'));var auth=require(_0xa3d9('0x6'));var interaction=require(_0xa3d9('0x7'));var config=require(_0xa3d9('0x8'));var controller=require(_0xa3d9('0x9'));router[_0xa3d9('0xa')]('/',auth[_0xa3d9('0xb')](),controller[_0xa3d9('0xc')]);router['get'](_0xa3d9('0xd'),auth[_0xa3d9('0xb')](),controller[_0xa3d9('0xe')]);router[_0xa3d9('0xa')]('/:id',auth[_0xa3d9('0xb')](),controller[_0xa3d9('0xf')]);router[_0xa3d9('0x10')]('/',auth[_0xa3d9('0xb')](),controller['create']);router[_0xa3d9('0x11')]('/:id',auth[_0xa3d9('0xb')](),controller[_0xa3d9('0x12')]);router['delete'](_0xa3d9('0x13'),auth[_0xa3d9('0xb')](),controller['destroy']);module[_0xa3d9('0x14')]=router; \ No newline at end of file +var _0xc0a9=['post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0a9,0xf8));var _0x9c0a=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xc0a9[_0x286bfb];return _0x52b683;};'use strict';var multer=require(_0x9c0a('0x0'));var util=require(_0x9c0a('0x1'));var path=require(_0x9c0a('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c0a('0x3'));var router=express[_0x9c0a('0x4')]();var fs_extra=require(_0x9c0a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c0a('0x6'));var config=require(_0x9c0a('0x7'));var controller=require(_0x9c0a('0x8'));router[_0x9c0a('0x9')]('/',auth[_0x9c0a('0xa')](),controller[_0x9c0a('0xb')]);router[_0x9c0a('0x9')](_0x9c0a('0xc'),auth[_0x9c0a('0xa')](),controller[_0x9c0a('0xd')]);router[_0x9c0a('0x9')](_0x9c0a('0xe'),auth[_0x9c0a('0xa')](),controller[_0x9c0a('0xf')]);router[_0x9c0a('0x10')]('/',auth[_0x9c0a('0xa')](),controller['create']);router[_0x9c0a('0x11')](_0x9c0a('0xe'),auth['isAuthenticated'](),controller[_0x9c0a('0x12')]);router[_0x9c0a('0x13')](_0x9c0a('0xe'),auth[_0x9c0a('0xa')](),controller[_0x9c0a('0x14')]);module[_0x9c0a('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 9c7f0d4..1989bc0 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x40176b,_0x168e9f){var _0x874f78=function(_0x241b18){while(--_0x241b18){_0x40176b['push'](_0x40176b['shift']());}};_0x874f78(++_0x168e9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0x9bde,0xe1));var _0xe9bd=function(_0x35d5ab,_0x5722a8){_0x35d5ab=_0x35d5ab-0x0;var _0x22b054=_0x9bde[_0x35d5ab];return _0x22b054;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c67ec7b..a181244 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 _0x1f05=['body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','catch','show','params','length','merge','options','find','create'];(function(_0x3d0716,_0x139260){var _0x4aa768=function(_0xa4426a){while(--_0xa4426a){_0x3d0716['push'](_0x3d0716['shift']());}};_0x4aa768(++_0x139260);}(_0x1f05,0x98));var _0x51f0=function(_0x314bdc,_0x17962d){_0x314bdc=_0x314bdc-0x0;var _0x173802=_0x1f05[_0x314bdc];return _0x173802;};'use strict';var emlformat=require(_0x51f0('0x0'));var rimraf=require(_0x51f0('0x1'));var zipdir=require(_0x51f0('0x2'));var jsonpatch=require(_0x51f0('0x3'));var rp=require('request-promise');var moment=require(_0x51f0('0x4'));var BPromise=require(_0x51f0('0x5'));var Mustache=require(_0x51f0('0x6'));var util=require(_0x51f0('0x7'));var path=require(_0x51f0('0x8'));var sox=require(_0x51f0('0x9'));var csv=require(_0x51f0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x51f0('0xb'));var deskjs=require(_0x51f0('0xc'));var toCsv=require(_0x51f0('0xa'));var querystring=require('querystring');var Papa=require(_0x51f0('0xd'));var Redis=require(_0x51f0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x51f0('0xf'));var as=require(_0x51f0('0x10'));var hardwareService=require(_0x51f0('0x11'));var logger=require(_0x51f0('0x12'))(_0x51f0('0x13'));var utils=require(_0x51f0('0x14'));var config=require(_0x51f0('0x15'));var licenseUtil=require(_0x51f0('0x16'));var db=require(_0x51f0('0x17'))['db'];function respondWithStatusCode(_0x812595,_0x2f940b){_0x2f940b=_0x2f940b||0xcc;return function(_0x5f25da){if(_0x5f25da){return _0x812595['sendStatus'](_0x2f940b);}return _0x812595[_0x51f0('0x18')](_0x2f940b)[_0x51f0('0x19')]();};}function respondWithResult(_0x8cd28,_0x369850){_0x369850=_0x369850||0xc8;return function(_0x54f490){if(_0x54f490){return _0x8cd28[_0x51f0('0x18')](_0x369850)[_0x51f0('0x1a')](_0x54f490);}};}function respondWithFilteredResult(_0x412f57,_0x45b31){return function(_0x4fc254){if(_0x4fc254){var _0x49d042=typeof _0x45b31['offset']===_0x51f0('0x1b')&&typeof _0x45b31[_0x51f0('0x1c')]==='undefined';var _0x8caa4b=_0x4fc254['count'];var _0x536d7b=_0x49d042?0x0:_0x45b31[_0x51f0('0x1d')];var _0x5b781f=_0x49d042?_0x4fc254[_0x51f0('0x1e')]:_0x45b31['offset']+_0x45b31[_0x51f0('0x1c')];var _0x391094;if(_0x5b781f>=_0x8caa4b){_0x5b781f=_0x8caa4b;_0x391094=0xc8;}else{_0x391094=0xce;}_0x412f57[_0x51f0('0x18')](_0x391094);return _0x412f57[_0x51f0('0x1f')](_0x51f0('0x20'),_0x536d7b+'-'+_0x5b781f+'/'+_0x8caa4b)[_0x51f0('0x1a')](_0x4fc254);}return null;};}function patchUpdates(_0xd5cfda){return function(_0x11bc74){try{jsonpatch['apply'](_0x11bc74,_0xd5cfda,!![]);}catch(_0x1f99c4){return BPromise[_0x51f0('0x21')](_0x1f99c4);}return _0x11bc74[_0x51f0('0x22')]();};}function saveUpdates(_0x4f90fc,_0x36eb6a){return function(_0x537567){if(_0x537567){return _0x537567[_0x51f0('0x23')](_0x4f90fc)[_0x51f0('0x24')](function(_0x51603f){return _0x51603f;});}return null;};}function removeEntity(_0x2d1c49,_0x522ab3){return function(_0x58b04f){if(_0x58b04f){return _0x58b04f[_0x51f0('0x25')]()['then'](function(){_0x2d1c49['status'](0xcc)[_0x51f0('0x19')]();});}};}function handleEntityNotFound(_0x290a6e,_0x2d6633){return function(_0x3c39c0){if(!_0x3c39c0){_0x290a6e[_0x51f0('0x26')](0x194);}return _0x3c39c0;};}function handleError(_0x318985,_0x557de8){_0x557de8=_0x557de8||0x1f4;return function(_0x4c7627){logger[_0x51f0('0x27')](_0x4c7627[_0x51f0('0x28')]);if(_0x4c7627[_0x51f0('0x29')]){delete _0x4c7627[_0x51f0('0x29')];}_0x318985[_0x51f0('0x18')](_0x557de8)[_0x51f0('0x2a')](_0x4c7627);};}exports[_0x51f0('0x2b')]=function(_0x5f3c86,_0xeebe6a){var _0x2f0922={},_0x18dedf={},_0x31b53a={'count':0x0,'rows':[]};var _0x40c54f=_[_0x51f0('0x2c')](db[_0x51f0('0x2d')][_0x51f0('0x2e')],function(_0x516824){return{'name':_0x516824[_0x51f0('0x2f')],'type':_0x516824[_0x51f0('0x30')][_0x51f0('0x31')]};});_0x18dedf['model']=_[_0x51f0('0x2c')](_0x40c54f,_0x51f0('0x29'));_0x18dedf[_0x51f0('0x32')]=_[_0x51f0('0x33')](_0x5f3c86[_0x51f0('0x32')]);_0x18dedf['filters']=_[_0x51f0('0x34')](_0x18dedf[_0x51f0('0x35')],_0x18dedf[_0x51f0('0x32')]);_0x2f0922[_0x51f0('0x36')]=_[_0x51f0('0x34')](_0x18dedf['model'],qs[_0x51f0('0x37')](_0x5f3c86['query'][_0x51f0('0x37')]));_0x2f0922[_0x51f0('0x36')]=_0x2f0922[_0x51f0('0x36')]['length']?_0x2f0922['attributes']:_0x18dedf['model'];if(!_0x5f3c86[_0x51f0('0x32')][_0x51f0('0x38')]('nolimit')){_0x2f0922[_0x51f0('0x1c')]=qs[_0x51f0('0x1c')](_0x5f3c86['query'][_0x51f0('0x1c')]);_0x2f0922['offset']=qs['offset'](_0x5f3c86[_0x51f0('0x32')]['offset']);}_0x2f0922['order']=qs['sort'](_0x5f3c86['query'][_0x51f0('0x39')]);_0x2f0922[_0x51f0('0x3a')]=qs[_0x51f0('0x3b')](_[_0x51f0('0x3c')](_0x5f3c86[_0x51f0('0x32')],_0x18dedf['filters']),_0x40c54f);if(_0x5f3c86['query'][_0x51f0('0x3d')]){_0x2f0922['where']=_['merge'](_0x2f0922[_0x51f0('0x3a')],{'$or':_[_0x51f0('0x2c')](_0x40c54f,function(_0x2f39f5){if(_0x2f39f5[_0x51f0('0x30')]!==_0x51f0('0x3e')){var _0x128a81={};_0x128a81[_0x2f39f5[_0x51f0('0x29')]]={'$like':'%'+_0x5f3c86[_0x51f0('0x32')][_0x51f0('0x3d')]+'%'};return _0x128a81;}})});}_0x2f0922=_['merge']({},_0x2f0922,_0x5f3c86['options']);var _0x48bbb9={'where':_0x2f0922[_0x51f0('0x3a')]};return db[_0x51f0('0x2d')][_0x51f0('0x1e')](_0x48bbb9)['then'](function(_0x22d1b6){_0x31b53a[_0x51f0('0x1e')]=_0x22d1b6;if(_0x5f3c86['query'][_0x51f0('0x3f')]){_0x2f0922[_0x51f0('0x40')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x2f0922);})[_0x51f0('0x24')](function(_0x14a902){_0x31b53a['rows']=_0x14a902;return _0x31b53a;})[_0x51f0('0x24')](respondWithFilteredResult(_0xeebe6a,_0x2f0922))[_0x51f0('0x41')](handleError(_0xeebe6a,null));};exports[_0x51f0('0x42')]=function(_0x2ee132,_0x30b719){var _0x4e7e47={'raw':!![],'where':{'id':_0x2ee132[_0x51f0('0x43')]['id']}},_0x11d779={};_0x11d779[_0x51f0('0x35')]=_[_0x51f0('0x33')](db[_0x51f0('0x2d')][_0x51f0('0x2e')]);_0x11d779[_0x51f0('0x32')]=_[_0x51f0('0x33')](_0x2ee132[_0x51f0('0x32')]);_0x11d779[_0x51f0('0x3b')]=_[_0x51f0('0x34')](_0x11d779[_0x51f0('0x35')],_0x11d779['query']);_0x4e7e47[_0x51f0('0x36')]=_[_0x51f0('0x34')](_0x11d779[_0x51f0('0x35')],qs[_0x51f0('0x37')](_0x2ee132['query']['fields']));_0x4e7e47[_0x51f0('0x36')]=_0x4e7e47['attributes'][_0x51f0('0x44')]?_0x4e7e47[_0x51f0('0x36')]:_0x11d779['model'];if(_0x2ee132[_0x51f0('0x32')][_0x51f0('0x3f')]){_0x4e7e47[_0x51f0('0x40')]=[{'all':!![]}];}_0x4e7e47=_[_0x51f0('0x45')]({},_0x4e7e47,_0x2ee132[_0x51f0('0x46')]);return db[_0x51f0('0x2d')][_0x51f0('0x47')](_0x4e7e47)[_0x51f0('0x24')](handleEntityNotFound(_0x30b719,null))[_0x51f0('0x24')](respondWithResult(_0x30b719,null))['catch'](handleError(_0x30b719,null));};exports['create']=function(_0x5e9596,_0x300564){return db['ChatTransferReport'][_0x51f0('0x48')](_0x5e9596[_0x51f0('0x49')],{})[_0x51f0('0x24')](respondWithResult(_0x300564,0xc9))[_0x51f0('0x41')](handleError(_0x300564,null));};exports[_0x51f0('0x23')]=function(_0x6fddc3,_0x437384){if(_0x6fddc3[_0x51f0('0x49')]['id']){delete _0x6fddc3[_0x51f0('0x49')]['id'];}return db[_0x51f0('0x2d')]['find']({'where':{'id':_0x6fddc3['params']['id']}})[_0x51f0('0x24')](handleEntityNotFound(_0x437384,null))['then'](saveUpdates(_0x6fddc3[_0x51f0('0x49')],null))[_0x51f0('0x24')](respondWithResult(_0x437384,null))[_0x51f0('0x41')](handleError(_0x437384,null));};exports['destroy']=function(_0x154d10,_0x132fe7){return db[_0x51f0('0x2d')][_0x51f0('0x47')]({'where':{'id':_0x154d10['params']['id']}})[_0x51f0('0x24')](handleEntityNotFound(_0x132fe7,null))['then'](removeEntity(_0x132fe7,null))['catch'](handleError(_0x132fe7,null));};exports['describe']=function(_0x2d01b5,_0x13dfb6){return db[_0x51f0('0x2d')][_0x51f0('0x4a')]()[_0x51f0('0x24')](respondWithResult(_0x13dfb6,null))[_0x51f0('0x41')](handleError(_0x13dfb6,null));}; \ No newline at end of file +var _0x7c53=['request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x5cbce6,_0x5492b0){var _0x59732a=function(_0x38bebc){while(--_0x38bebc){_0x5cbce6['push'](_0x5cbce6['shift']());}};_0x59732a(++_0x5492b0);}(_0x7c53,0x1dd));var _0x37c5=function(_0x43419a,_0x5b5768){_0x43419a=_0x43419a-0x0;var _0x493bb9=_0x7c53[_0x43419a];return _0x493bb9;};'use strict';var emlformat=require(_0x37c5('0x0'));var rimraf=require(_0x37c5('0x1'));var zipdir=require(_0x37c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37c5('0x3'));var moment=require(_0x37c5('0x4'));var BPromise=require(_0x37c5('0x5'));var Mustache=require(_0x37c5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x37c5('0x7'));var csv=require('to-csv');var ejs=require(_0x37c5('0x8'));var fs=require('fs');var fs_extra=require(_0x37c5('0x9'));var _=require(_0x37c5('0xa'));var squel=require(_0x37c5('0xb'));var crypto=require('crypto');var jsforce=require(_0x37c5('0xc'));var deskjs=require(_0x37c5('0xd'));var toCsv=require(_0x37c5('0xe'));var querystring=require(_0x37c5('0xf'));var Papa=require('papaparse');var Redis=require(_0x37c5('0x10'));var authService=require(_0x37c5('0x11'));var qs=require(_0x37c5('0x12'));var as=require(_0x37c5('0x13'));var hardwareService=require(_0x37c5('0x14'));var logger=require(_0x37c5('0x15'))(_0x37c5('0x16'));var utils=require(_0x37c5('0x17'));var config=require(_0x37c5('0x18'));var licenseUtil=require(_0x37c5('0x19'));var db=require(_0x37c5('0x1a'))['db'];function respondWithStatusCode(_0x1bd6e2,_0x15f458){_0x15f458=_0x15f458||0xcc;return function(_0x17c6a7){if(_0x17c6a7){return _0x1bd6e2[_0x37c5('0x1b')](_0x15f458);}return _0x1bd6e2[_0x37c5('0x1c')](_0x15f458)[_0x37c5('0x1d')]();};}function respondWithResult(_0x1c3aa7,_0x39259c){_0x39259c=_0x39259c||0xc8;return function(_0x1623e8){if(_0x1623e8){return _0x1c3aa7['status'](_0x39259c)[_0x37c5('0x1e')](_0x1623e8);}};}function respondWithFilteredResult(_0xadec39,_0x52f5b2){return function(_0xa3942e){if(_0xa3942e){var _0x31ffd3=typeof _0x52f5b2[_0x37c5('0x1f')]===_0x37c5('0x20')&&typeof _0x52f5b2[_0x37c5('0x21')]==='undefined';var _0x3f258a=_0xa3942e['count'];var _0x2ceefb=_0x31ffd3?0x0:_0x52f5b2[_0x37c5('0x1f')];var _0x256152=_0x31ffd3?_0xa3942e[_0x37c5('0x22')]:_0x52f5b2[_0x37c5('0x1f')]+_0x52f5b2[_0x37c5('0x21')];var _0x16e02c;if(_0x256152>=_0x3f258a){_0x256152=_0x3f258a;_0x16e02c=0xc8;}else{_0x16e02c=0xce;}_0xadec39[_0x37c5('0x1c')](_0x16e02c);return _0xadec39[_0x37c5('0x23')](_0x37c5('0x24'),_0x2ceefb+'-'+_0x256152+'/'+_0x3f258a)[_0x37c5('0x1e')](_0xa3942e);}return null;};}function patchUpdates(_0x57b54e){return function(_0x55fd5f){try{jsonpatch[_0x37c5('0x25')](_0x55fd5f,_0x57b54e,!![]);}catch(_0x35cd83){return BPromise[_0x37c5('0x26')](_0x35cd83);}return _0x55fd5f['save']();};}function saveUpdates(_0x42c9b1,_0x5827b5){return function(_0xeaf79e){if(_0xeaf79e){return _0xeaf79e[_0x37c5('0x27')](_0x42c9b1)[_0x37c5('0x28')](function(_0x14288c){return _0x14288c;});}return null;};}function removeEntity(_0xa2e2e3,_0x4a6b5e){return function(_0x2d5241){if(_0x2d5241){return _0x2d5241['destroy']()[_0x37c5('0x28')](function(){_0xa2e2e3[_0x37c5('0x1c')](0xcc)[_0x37c5('0x1d')]();});}};}function handleEntityNotFound(_0x3a6b7c,_0xdf5738){return function(_0x1808e6){if(!_0x1808e6){_0x3a6b7c[_0x37c5('0x1b')](0x194);}return _0x1808e6;};}function handleError(_0x11252f,_0x2e9546){_0x2e9546=_0x2e9546||0x1f4;return function(_0x240464){logger['error'](_0x240464['stack']);if(_0x240464[_0x37c5('0x29')]){delete _0x240464[_0x37c5('0x29')];}_0x11252f['status'](_0x2e9546)[_0x37c5('0x2a')](_0x240464);};}exports[_0x37c5('0x2b')]=function(_0x3644f7,_0x19f408){var _0x2510aa={},_0x5061ac={},_0x59a246={'count':0x0,'rows':[]};var _0x226bb9=_[_0x37c5('0x2c')](db[_0x37c5('0x2d')][_0x37c5('0x2e')],function(_0xb373ab){return{'name':_0xb373ab[_0x37c5('0x2f')],'type':_0xb373ab['type'][_0x37c5('0x30')]};});_0x5061ac[_0x37c5('0x31')]=_[_0x37c5('0x2c')](_0x226bb9,'name');_0x5061ac[_0x37c5('0x32')]=_[_0x37c5('0x33')](_0x3644f7[_0x37c5('0x32')]);_0x5061ac[_0x37c5('0x34')]=_[_0x37c5('0x35')](_0x5061ac[_0x37c5('0x31')],_0x5061ac[_0x37c5('0x32')]);_0x2510aa['attributes']=_['intersection'](_0x5061ac[_0x37c5('0x31')],qs[_0x37c5('0x36')](_0x3644f7['query']['fields']));_0x2510aa['attributes']=_0x2510aa[_0x37c5('0x37')][_0x37c5('0x38')]?_0x2510aa['attributes']:_0x5061ac[_0x37c5('0x31')];if(!_0x3644f7[_0x37c5('0x32')][_0x37c5('0x39')](_0x37c5('0x3a'))){_0x2510aa[_0x37c5('0x21')]=qs[_0x37c5('0x21')](_0x3644f7[_0x37c5('0x32')][_0x37c5('0x21')]);_0x2510aa['offset']=qs[_0x37c5('0x1f')](_0x3644f7['query'][_0x37c5('0x1f')]);}_0x2510aa[_0x37c5('0x3b')]=qs['sort'](_0x3644f7[_0x37c5('0x32')][_0x37c5('0x3c')]);_0x2510aa['where']=qs[_0x37c5('0x34')](_[_0x37c5('0x3d')](_0x3644f7['query'],_0x5061ac[_0x37c5('0x34')]),_0x226bb9);if(_0x3644f7['query'][_0x37c5('0x3e')]){_0x2510aa[_0x37c5('0x3f')]=_[_0x37c5('0x40')](_0x2510aa[_0x37c5('0x3f')],{'$or':_[_0x37c5('0x2c')](_0x226bb9,function(_0x129bcf){if(_0x129bcf[_0x37c5('0x41')]!==_0x37c5('0x42')){var _0x285b7a={};_0x285b7a[_0x129bcf[_0x37c5('0x29')]]={'$like':'%'+_0x3644f7['query']['filter']+'%'};return _0x285b7a;}})});}_0x2510aa=_[_0x37c5('0x40')]({},_0x2510aa,_0x3644f7[_0x37c5('0x43')]);var _0x1779b2={'where':_0x2510aa[_0x37c5('0x3f')]};return db[_0x37c5('0x2d')][_0x37c5('0x22')](_0x1779b2)['then'](function(_0x2951f4){_0x59a246[_0x37c5('0x22')]=_0x2951f4;if(_0x3644f7[_0x37c5('0x32')][_0x37c5('0x44')]){_0x2510aa[_0x37c5('0x45')]=[{'all':!![]}];}return db[_0x37c5('0x2d')][_0x37c5('0x46')](_0x2510aa);})[_0x37c5('0x28')](function(_0x18d9be){_0x59a246[_0x37c5('0x47')]=_0x18d9be;return _0x59a246;})[_0x37c5('0x28')](respondWithFilteredResult(_0x19f408,_0x2510aa))['catch'](handleError(_0x19f408,null));};exports[_0x37c5('0x48')]=function(_0x5b45d8,_0x100be1){var _0x20f575={'raw':!![],'where':{'id':_0x5b45d8[_0x37c5('0x49')]['id']}},_0x1886d9={};_0x1886d9[_0x37c5('0x31')]=_[_0x37c5('0x33')](db['ChatTransferReport'][_0x37c5('0x2e')]);_0x1886d9[_0x37c5('0x32')]=_[_0x37c5('0x33')](_0x5b45d8['query']);_0x1886d9[_0x37c5('0x34')]=_[_0x37c5('0x35')](_0x1886d9['model'],_0x1886d9['query']);_0x20f575[_0x37c5('0x37')]=_[_0x37c5('0x35')](_0x1886d9[_0x37c5('0x31')],qs['fields'](_0x5b45d8[_0x37c5('0x32')][_0x37c5('0x36')]));_0x20f575[_0x37c5('0x37')]=_0x20f575[_0x37c5('0x37')][_0x37c5('0x38')]?_0x20f575['attributes']:_0x1886d9[_0x37c5('0x31')];if(_0x5b45d8[_0x37c5('0x32')][_0x37c5('0x44')]){_0x20f575[_0x37c5('0x45')]=[{'all':!![]}];}_0x20f575=_[_0x37c5('0x40')]({},_0x20f575,_0x5b45d8['options']);return db['ChatTransferReport'][_0x37c5('0x4a')](_0x20f575)['then'](handleEntityNotFound(_0x100be1,null))[_0x37c5('0x28')](respondWithResult(_0x100be1,null))[_0x37c5('0x4b')](handleError(_0x100be1,null));};exports[_0x37c5('0x4c')]=function(_0x379c05,_0x58a6ab){return db[_0x37c5('0x2d')][_0x37c5('0x4c')](_0x379c05[_0x37c5('0x4d')],{})[_0x37c5('0x28')](respondWithResult(_0x58a6ab,0xc9))[_0x37c5('0x4b')](handleError(_0x58a6ab,null));};exports['update']=function(_0x4990be,_0x389c4d){if(_0x4990be[_0x37c5('0x4d')]['id']){delete _0x4990be[_0x37c5('0x4d')]['id'];}return db[_0x37c5('0x2d')][_0x37c5('0x4a')]({'where':{'id':_0x4990be[_0x37c5('0x49')]['id']}})['then'](handleEntityNotFound(_0x389c4d,null))[_0x37c5('0x28')](saveUpdates(_0x4990be[_0x37c5('0x4d')],null))[_0x37c5('0x28')](respondWithResult(_0x389c4d,null))['catch'](handleError(_0x389c4d,null));};exports[_0x37c5('0x4e')]=function(_0x5c4abe,_0x31065d){return db['ChatTransferReport'][_0x37c5('0x4a')]({'where':{'id':_0x5c4abe[_0x37c5('0x49')]['id']}})[_0x37c5('0x28')](handleEntityNotFound(_0x31065d,null))['then'](removeEntity(_0x31065d,null))[_0x37c5('0x4b')](handleError(_0x31065d,null));};exports[_0x37c5('0x4f')]=function(_0x30a20b,_0x2fd266){return db['ChatTransferReport'][_0x37c5('0x4f')]()[_0x37c5('0x28')](respondWithResult(_0x2fd266,null))[_0x37c5('0x4b')](handleError(_0x2fd266,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 1033e91..309adce 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 _0xede9=['lodash','util','../../config/logger','api','moment','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x3d8fd8,_0x6ab03e){var _0x4d9124=function(_0x1f6917){while(--_0x1f6917){_0x3d8fd8['push'](_0x3d8fd8['shift']());}};_0x4d9124(++_0x6ab03e);}(_0xede9,0x1e0));var _0x9ede=function(_0x2424ee,_0x2dee67){_0x2424ee=_0x2424ee-0x0;var _0x57acb4=_0xede9[_0x2424ee];return _0x57acb4;};'use strict';var _=require(_0x9ede('0x0'));var util=require(_0x9ede('0x1'));var logger=require(_0x9ede('0x2'))(_0x9ede('0x3'));var moment=require(_0x9ede('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ede('0x5'));var attributes=require(_0x9ede('0x6'));module[_0x9ede('0x7')]=function(_0x45886f,_0x345e49){return _0x45886f[_0x9ede('0x8')](_0x9ede('0x9'),attributes,{'tableName':_0x9ede('0xa'),'paranoid':![],'indexes':[{'name':_0x9ede('0xb'),'fields':[_0x9ede('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3bc=['report_chat_transfer','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0xd3bc,0x9e));var _0xcd3b=function(_0x1f3708,_0x57266e){_0x1f3708=_0x1f3708-0x0;var _0x36f290=_0xd3bc[_0x1f3708];return _0x36f290;};'use strict';var _=require(_0xcd3b('0x0'));var util=require('util');var logger=require(_0xcd3b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcd3b('0x2'));var rp=require(_0xcd3b('0x3'));var fs=require('fs');var path=require(_0xcd3b('0x4'));var rimraf=require(_0xcd3b('0x5'));var config=require(_0xcd3b('0x6'));var attributes=require(_0xcd3b('0x7'));module['exports']=function(_0x18bd94,_0x422b86){return _0x18bd94[_0xcd3b('0x8')](_0xcd3b('0x9'),attributes,{'tableName':_0xcd3b('0xa'),'paranoid':![],'indexes':[{'name':_0xcd3b('0xb'),'fields':[_0xcd3b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index f6de656..5d9d41f 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 _0x2c3b=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x1ec127,_0xb74c7e){var _0x36b6bd=function(_0x4b1e28){while(--_0x4b1e28){_0x1ec127['push'](_0x1ec127['shift']());}};_0x36b6bd(++_0xb74c7e);}(_0x2c3b,0x168));var _0xb2c3=function(_0x1ed46f,_0x7691d7){_0x1ed46f=_0x1ed46f-0x0;var _0x43b931=_0x2c3b[_0x1ed46f];return _0x43b931;};'use strict';var _=require(_0xb2c3('0x0'));var util=require(_0xb2c3('0x1'));var moment=require(_0xb2c3('0x2'));var BPromise=require(_0xb2c3('0x3'));var rs=require(_0xb2c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2c3('0x5'))['db'];var utils=require(_0xb2c3('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb2c3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x290418,_0x1004bc,_0x5b2cd1){return new BPromise(function(_0x227012,_0x2908c6){return client[_0xb2c3('0x8')](_0x290418,_0x5b2cd1)[_0xb2c3('0x9')](function(_0x1ae9ad){logger['info'](_0xb2c3('0xa'),_0x1004bc,'request\x20sent');logger[_0xb2c3('0xb')](_0xb2c3('0xc'),_0x1004bc,'request\x20sent',JSON[_0xb2c3('0xd')](_0x1ae9ad));if(_0x1ae9ad[_0xb2c3('0xe')]){if(_0x1ae9ad['error'][_0xb2c3('0xf')]===0x1f4){logger[_0xb2c3('0xe')](_0xb2c3('0xa'),_0x1004bc,_0x1ae9ad[_0xb2c3('0xe')]['message']);return _0x2908c6(_0x1ae9ad['error'][_0xb2c3('0x10')]);}logger[_0xb2c3('0xe')](_0xb2c3('0xa'),_0x1004bc,_0x1ae9ad[_0xb2c3('0xe')][_0xb2c3('0x10')]);return _0x227012(_0x1ae9ad[_0xb2c3('0xe')][_0xb2c3('0x10')]);}else{logger[_0xb2c3('0x11')](_0xb2c3('0xa'),_0x1004bc,_0xb2c3('0x12'));_0x227012(_0x1ae9ad[_0xb2c3('0x13')][_0xb2c3('0x10')]);}})['catch'](function(_0x3d1548){logger['error'](_0xb2c3('0xa'),_0x1004bc,_0x3d1548);_0x2908c6(_0x3d1548);});});} \ No newline at end of file +var _0x4ec6=['error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x4ec6,0x1e6));var _0x64ec=function(_0x2d1fe6,_0x280692){_0x2d1fe6=_0x2d1fe6-0x0;var _0x56d315=_0x4ec6[_0x2d1fe6];return _0x56d315;};'use strict';var _=require(_0x64ec('0x0'));var util=require(_0x64ec('0x1'));var moment=require('moment');var BPromise=require(_0x64ec('0x2'));var rs=require(_0x64ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64ec('0x4'))['db'];var utils=require(_0x64ec('0x5'));var logger=require(_0x64ec('0x6'))(_0x64ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x64ec('0x8'));var client=jayson[_0x64ec('0x9')][_0x64ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd2aa42,_0x4b3795,_0x198dbe){return new BPromise(function(_0x42d081,_0xbcf74a){return client[_0x64ec('0xb')](_0xd2aa42,_0x198dbe)[_0x64ec('0xc')](function(_0x45dabf){logger[_0x64ec('0xd')](_0x64ec('0xe'),_0x4b3795,_0x64ec('0xf'));logger[_0x64ec('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4b3795,_0x64ec('0xf'),JSON[_0x64ec('0x11')](_0x45dabf));if(_0x45dabf[_0x64ec('0x12')]){if(_0x45dabf[_0x64ec('0x12')]['code']===0x1f4){logger['error'](_0x64ec('0xe'),_0x4b3795,_0x45dabf['error'][_0x64ec('0x13')]);return _0xbcf74a(_0x45dabf['error'][_0x64ec('0x13')]);}logger[_0x64ec('0x12')](_0x64ec('0xe'),_0x4b3795,_0x45dabf['error'][_0x64ec('0x13')]);return _0x42d081(_0x45dabf['error']['message']);}else{logger[_0x64ec('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x4b3795,_0x64ec('0xf'));_0x42d081(_0x45dabf['result']['message']);}})[_0x64ec('0x14')](function(_0x504d20){logger[_0x64ec('0x12')](_0x64ec('0xe'),_0x4b3795,_0x504d20);_0xbcf74a(_0x504d20);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2354d50..a961300 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 _0x8833=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x118657,_0x2acddb){var _0x504b05=function(_0x3afe52){while(--_0x3afe52){_0x118657['push'](_0x118657['shift']());}};_0x504b05(++_0x2acddb);}(_0x8833,0x8a));var _0x3883=function(_0x44cca4,_0x1c0550){_0x44cca4=_0x44cca4-0x0;var _0x46c0d6=_0x8833[_0x44cca4];return _0x46c0d6;};'use strict';var multer=require(_0x3883('0x0'));var util=require(_0x3883('0x1'));var path=require(_0x3883('0x2'));var timeout=require(_0x3883('0x3'));var express=require(_0x3883('0x4'));var router=express[_0x3883('0x5')]();var fs_extra=require(_0x3883('0x6'));var auth=require(_0x3883('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3883('0x8'));router[_0x3883('0x9')]('/',auth[_0x3883('0xa')](),controller[_0x3883('0xb')]);router[_0x3883('0x9')](_0x3883('0xc'),auth['isAuthenticated'](),controller[_0x3883('0xd')]);router['get'](_0x3883('0xe'),auth['isAuthenticated'](),controller[_0x3883('0xf')]);router[_0x3883('0x10')]('/',auth['isAuthenticated'](),controller[_0x3883('0x11')]);router[_0x3883('0x12')]('/:id',auth[_0x3883('0xa')](),controller[_0x3883('0x13')]);router[_0x3883('0x14')](_0x3883('0xe'),auth[_0x3883('0xa')](),controller[_0x3883('0x15')]);module[_0x3883('0x16')]=router; \ No newline at end of file +var _0xe100=['post','create','put','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x258777,_0x3b6a9e){var _0x541ec9=function(_0x2371d1){while(--_0x2371d1){_0x258777['push'](_0x258777['shift']());}};_0x541ec9(++_0x3b6a9e);}(_0xe100,0x193));var _0x0e10=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe100[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0e10('0x0'));var util=require(_0x0e10('0x1'));var path=require(_0x0e10('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e10('0x3'));var router=express[_0x0e10('0x4')]();var fs_extra=require(_0x0e10('0x5'));var auth=require(_0x0e10('0x6'));var interaction=require(_0x0e10('0x7'));var config=require(_0x0e10('0x8'));var controller=require(_0x0e10('0x9'));router['get']('/',auth[_0x0e10('0xa')](),controller[_0x0e10('0xb')]);router[_0x0e10('0xc')](_0x0e10('0xd'),auth[_0x0e10('0xa')](),controller[_0x0e10('0xe')]);router[_0x0e10('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0e10('0xf')]('/',auth[_0x0e10('0xa')](),controller[_0x0e10('0x10')]);router[_0x0e10('0x11')]('/:id',auth[_0x0e10('0xa')](),controller['update']);router[_0x0e10('0x12')](_0x0e10('0x13'),auth[_0x0e10('0xa')](),controller[_0x0e10('0x14')]);module[_0x0e10('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 60c22a2..558cdf5 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 _0x5db6=['Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','ENUM','rounded','squared','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','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','setDataValue'];(function(_0x2da59f,_0x163460){var _0x274208=function(_0x410c2c){while(--_0x410c2c){_0x2da59f['push'](_0x2da59f['shift']());}};_0x274208(++_0x163460);}(_0x5db6,0x106));var _0x65db=function(_0x1d056a,_0x293d07){_0x1d056a=_0x1d056a-0x0;var _0x8e14c0=_0x5db6[_0x1d056a];return _0x8e14c0;};'use strict';var Sequelize=require(_0x65db('0x0'));var rs=require(_0x65db('0x1'));module[_0x65db('0x2')]={'name':{'type':Sequelize[_0x65db('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x65db('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x65db('0x3')]},'mapKey':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x4')},'mapKeyOffline':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x4')},'key':{'type':Sequelize[_0x65db('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x65db('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x65db('0x3')],'allowNull':![],'defaultValue':_0x65db('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65db('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65db('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x65db('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x65db('0x7')](_0x65db('0x8'),_0x65db('0x9')),'defaultValue':_0x65db('0x8')},'header_online':{'type':Sequelize[_0x65db('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x65db('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0xa')},'header_offline':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0xb')},'download_transcript':{'type':Sequelize[_0x65db('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x65db('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x65db('0xf')]},'closingQuestion':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x65db('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x12')},'noteTitle':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x13')},'placeholderMessage':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x14')},'closingMessage':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x65db('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x65db('0x17'),'thumb'),'defaultValue':_0x65db('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x65db('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x65db('0xf')],'defaultValue':function(){return JSON[_0x65db('0x18')]({'items':[{'type':_0x65db('0x19'),'variable':null,'config':{'placeholder':_0x65db('0x1a'),'type':_0x65db('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x65db('0x19'),'props':{'title':_0x65db('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x65db('0x1c')](_0x65db('0x1d'))?JSON[_0x65db('0x1e')](this[_0x65db('0x1c')](_0x65db('0x1d'))):{};},'set':function(_0x71a86a){return this['setDataValue'](_0x65db('0x1d'),JSON[_0x65db('0x18')](_0x71a86a));}},'offlineForm':{'type':Sequelize[_0x65db('0xf')],'defaultValue':function(){return JSON[_0x65db('0x18')]({'items':[{'type':'input','props':{'title':_0x65db('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x65db('0x4')},'variable':null},{'type':_0x65db('0x1f'),'config':{'placeholder':_0x65db('0x20')},'props':{'title':_0x65db('0x20'),'helpText':_0x65db('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x65db('0x1c')](_0x65db('0x22'))?JSON[_0x65db('0x1e')](this[_0x65db('0x1c')](_0x65db('0x22'))):{};},'set':function(_0x56384f){return this['setDataValue'](_0x65db('0x22'),JSON[_0x65db('0x18')](_0x56384f));}},'token':{'type':Sequelize[_0x65db('0x3')],'defaultValue':function(){return rs[_0x65db('0x23')]();}},'autoclose':{'type':Sequelize[_0x65db('0xc')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x65db('0x3')]},'forwardOffline':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x65db('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x65db('0x24')},'waitingMessage':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x65db('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x65db('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x28')},'skipUnmanaged':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x29')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x65db('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x65db('0x3')]},'notificationTemplate':{'type':Sequelize[_0x65db('0xf')],'defaultValue':function(){return _0x65db('0x2a');}},'notificationSound':{'type':Sequelize[_0x65db('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x65db('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x65db('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x65db('0x3')],'defaultValue':_0x65db('0x2c')},'verticalAlignment':{'type':Sequelize[_0x65db('0xd')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x65db('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x65db('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x65db('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x65db('0x3')],'allowNull':![],'defaultValue':_0x65db('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x65db('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x65db('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x65db('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x65db('0xd')],'comment':_0x65db('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![],'comment':_0x65db('0x30'),'set':function(_0x2273ee){if(!_0x2273ee)this[_0x65db('0x31')]('mandatoryDispositionPauseId',null);this[_0x65db('0x31')]('mandatoryDisposition',_0x2273ee);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x65db('0x3')]},'vidaooTopic':{'type':Sequelize[_0x65db('0x3')],'allowNull':![],'defaultValue':_0x65db('0x32')},'vidaooNote':{'type':Sequelize[_0x65db('0x3')],'defaultValue':function(){return _0x65db('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x65db('0xc')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x65db('0xf')]}}; \ No newline at end of file +var _0x1216=['We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','ENUM','thumb','stringify','input','name','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared'];(function(_0x58b19d,_0x160b9e){var _0x3a77b8=function(_0x2640e9){while(--_0x2640e9){_0x58b19d['push'](_0x58b19d['shift']());}};_0x3a77b8(++_0x160b9e);}(_0x1216,0x1c9));var _0x6121=function(_0x590ef7,_0x175f08){_0x590ef7=_0x590ef7-0x0;var _0x4c2634=_0x1216[_0x590ef7];return _0x4c2634;};'use strict';var Sequelize=require(_0x6121('0x0'));var rs=require('randomstring');module[_0x6121('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'unique':_0x6121('0x3')},'description':{'type':Sequelize[_0x6121('0x2')]},'mapKey':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x4')},'mapKeyOffline':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x4')},'key':{'type':Sequelize[_0x6121('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'defaultValue':_0x6121('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'defaultValue':_0x6121('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6121('0x2')]},'animation':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x6121('0x9'),_0x6121('0xa')),'defaultValue':_0x6121('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0xb')},'start_chat_button':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6121('0xe')]},'closingQuestion':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x11')},'noteTitle':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x13')},'closingMessage':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x16')},'conditionAgreement':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x17')},'ratingType':{'type':Sequelize[_0x6121('0x18')]('star',_0x6121('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6121('0xe')],'defaultValue':function(){return JSON[_0x6121('0x1a')]({'items':[{'type':_0x6121('0x1b'),'variable':null,'config':{'placeholder':_0x6121('0x1c'),'type':'text','required':!![]},'props':{'title':_0x6121('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0x6121('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6121('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6121('0x1d')](_0x6121('0x1e'))?JSON[_0x6121('0x1f')](this['getDataValue'](_0x6121('0x1e'))):{};},'set':function(_0x1a48ad){return this['setDataValue'](_0x6121('0x1e'),JSON[_0x6121('0x1a')](_0x1a48ad));}},'offlineForm':{'type':Sequelize[_0x6121('0xe')],'defaultValue':function(){return JSON[_0x6121('0x1a')]({'items':[{'type':'input','props':{'title':_0x6121('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6121('0x4')},'variable':null},{'type':_0x6121('0x20'),'config':{'placeholder':_0x6121('0x21')},'props':{'title':'Comments','helpText':_0x6121('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x6121('0x23'))?JSON['parse'](this[_0x6121('0x1d')](_0x6121('0x23'))):{};},'set':function(_0x56b866){return this['setDataValue'](_0x6121('0x23'),JSON[_0x6121('0x1a')](_0x56b866));}},'token':{'type':Sequelize[_0x6121('0x2')],'defaultValue':function(){return rs[_0x6121('0x24')]();}},'autoclose':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x27')},'offlineMessageBody':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x16')},'sendUnmanaged':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6121('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6121('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6121('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x2a')},'verticalAlignment':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6121('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x2c')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6121('0x7')],'comment':_0x6121('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6121('0x2e'),'set':function(_0x498505){if(!_0x498505)this[_0x6121('0x2f')](_0x6121('0x30'),null);this[_0x6121('0x2f')](_0x6121('0x31'),_0x498505);}},'vidaooEscalation':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'defaultValue':_0x6121('0x32')},'vidaooNote':{'type':Sequelize[_0x6121('0x2')],'defaultValue':function(){return _0x6121('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x6121('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6121('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3d3b521..0018935 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 _0xdb59=['getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','then','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','ChatWebsiteId','Disposition','getDispositions','nolimit','include','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','findAll','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','CompanyId','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','Contacts','DESC','ChatApplication','Applications','List','applications','list','orderBy','priority','asc','account','ListId','contact','customerIp','headers','cf-connecting-ip','first','x-forwarded-for','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','offline','files','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','ChatOfflineMessage','originalname','server','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','attachments','offline-chat','remove','addInteraction','omit','Contact','Tag','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0xdb59,0x134));var _0x9db5=function(_0x4cdf87,_0x200caf){_0x4cdf87=_0x4cdf87-0x0;var _0x14d49d=_0xdb59[_0x4cdf87];return _0x14d49d;};'use strict';var BPromise=require(_0x9db5('0x0'));var Mustache=require(_0x9db5('0x1'));var util=require(_0x9db5('0x2'));var path=require(_0x9db5('0x3'));var ejs=require(_0x9db5('0x4'));var fs=require('fs');var fs_extra=require(_0x9db5('0x5'));var _=require(_0x9db5('0x6'));var querystring=require(_0x9db5('0x7'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x9db5('0x8'))('api');var config=require(_0x9db5('0x9'));var db=require(_0x9db5('0xa'))['db'];config[_0x9db5('0xb')]=_[_0x9db5('0xc')](config[_0x9db5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9db5('0xd'))(new Redis(config[_0x9db5('0xb')]));require(_0x9db5('0xe'))[_0x9db5('0xf')](socket);var jayson=require(_0x9db5('0x10'));var client=jayson[_0x9db5('0x11')][_0x9db5('0x12')]({'port':0x232c});var client9002=jayson[_0x9db5('0x11')][_0x9db5('0x12')]({'port':0x232a});var client9003=jayson[_0x9db5('0x11')][_0x9db5('0x12')]({'port':0x232b});var client9001=jayson[_0x9db5('0x11')][_0x9db5('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x5806f8,_0x5e2372,_0x2f22d9,_0x241a58){return new BPromise(function(_0x5706c7,_0x46ab49){var _0x1da0a9=_0x241a58||client;return _0x1da0a9['request'](_0x5806f8,_0x2f22d9)['then'](function(_0x3572a2){logger['info'](_0x9db5('0x13'),_0x5e2372,_0x9db5('0x14'));logger[_0x9db5('0x15')](_0x9db5('0x16'),_0x5e2372,_0x9db5('0x14'),JSON[_0x9db5('0x17')](_0x3572a2));if(_0x3572a2[_0x9db5('0x18')]){if(_0x3572a2[_0x9db5('0x18')]['code']===0x1f4){logger[_0x9db5('0x18')](_0x9db5('0x13'),_0x5e2372,_0x3572a2[_0x9db5('0x18')]['message']);return _0x46ab49(_0x3572a2[_0x9db5('0x18')][_0x9db5('0x19')]);}logger[_0x9db5('0x18')](_0x9db5('0x13'),_0x5e2372,_0x3572a2[_0x9db5('0x18')]['message']);return _0x5706c7(_0x3572a2[_0x9db5('0x18')][_0x9db5('0x19')]);}else{logger[_0x9db5('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x5e2372,'request\x20sent');_0x5706c7(_0x3572a2['result']['message']);}})[_0x9db5('0x1b')](function(_0x3b3c74){logger[_0x9db5('0x18')](_0x9db5('0x13'),_0x5e2372,_0x3b3c74);_0x46ab49(_0x3b3c74);});});}function respondWithStatusCode(_0x7642f4,_0x1fb080){_0x1fb080=_0x1fb080||0xcc;return function(_0x2327c1){if(_0x2327c1){return _0x7642f4[_0x9db5('0x1c')](_0x1fb080);}return _0x7642f4[_0x9db5('0x1d')](_0x1fb080)[_0x9db5('0x1e')]();};}function respondWithResult(_0x312043,_0x5a929c){_0x5a929c=_0x5a929c||0xc8;return function(_0x44b30e){if(_0x44b30e){return _0x312043[_0x9db5('0x1d')](_0x5a929c)[_0x9db5('0x1f')](_0x44b30e);}};}function respondWithFilteredResult(_0xa94c78,_0x2d744c){return function(_0x3ab47a){if(_0x3ab47a){var _0x1aaa98=typeof _0x2d744c['offset']===_0x9db5('0x20')&&typeof _0x2d744c[_0x9db5('0x21')]===_0x9db5('0x20');var _0x1a28f3=_0x3ab47a[_0x9db5('0x22')];var _0x4a6a2b=_0x1aaa98?0x0:_0x2d744c['offset'];var _0x26b808=_0x1aaa98?_0x3ab47a[_0x9db5('0x22')]:_0x2d744c[_0x9db5('0x23')]+_0x2d744c[_0x9db5('0x21')];var _0x10b1ca;if(_0x26b808>=_0x1a28f3){_0x26b808=_0x1a28f3;_0x10b1ca=0xc8;}else{_0x10b1ca=0xce;}_0xa94c78[_0x9db5('0x1d')](_0x10b1ca);return _0xa94c78['set'](_0x9db5('0x24'),_0x4a6a2b+'-'+_0x26b808+'/'+_0x1a28f3)['json'](_0x3ab47a);}return null;};}function saveUpdates(_0x2713f9){return function(_0xb413b4){if(_0xb413b4){return _0xb413b4[_0x9db5('0x25')](_0x2713f9)['then'](function(_0x4ea482){return _0x4ea482;});}return null;};}function removeEntity(_0x1138a5){return function(_0xe9e4c2){if(_0xe9e4c2){return _0xe9e4c2[_0x9db5('0x26')]()[_0x9db5('0x27')](function(){var _0x4bf7f5=_0xe9e4c2['get']({'plain':!![]});var _0x483844=_0x9db5('0x28');return db[_0x9db5('0x29')][_0x9db5('0x26')]({'where':{'type':_0x483844,'resourceId':_0x4bf7f5['id']}})[_0x9db5('0x27')](function(){return _0xe9e4c2;});})[_0x9db5('0x27')](function(){_0x1138a5[_0x9db5('0x1d')](0xcc)[_0x9db5('0x1e')]();});}};}function handleEntityNotFound(_0x5e4276){return function(_0x2793f3){if(!_0x2793f3){_0x5e4276[_0x9db5('0x1c')](0x194);}return _0x2793f3;};}function handleError(_0x57acbb,_0x3ae594){_0x3ae594=_0x3ae594||0x1f4;return function(_0x451b79){logger['error'](_0x451b79[_0x9db5('0x2a')]);if(_0x451b79[_0x9db5('0x2b')]){delete _0x451b79[_0x9db5('0x2b')];}_0x57acbb['status'](_0x3ae594)[_0x9db5('0x2c')](_0x451b79);};}exports[_0x9db5('0x2d')]=function(_0x42daff,_0x30e104){var _0x52ff93={'include':[{'model':db[_0x9db5('0x2e')],'as':_0x9db5('0x2f')}]},_0x4f7374={},_0x10755a={'count':0x0,'rows':[]};var _0x587a74=_['map'](db[_0x9db5('0x30')][_0x9db5('0x31')],function(_0x29b5df){return{'name':_0x29b5df[_0x9db5('0x32')],'type':_0x29b5df['type'][_0x9db5('0x33')]};});_0x4f7374[_0x9db5('0x34')]=_[_0x9db5('0x35')](_0x587a74,_0x9db5('0x2b'));_0x4f7374['query']=_[_0x9db5('0x36')](_0x42daff[_0x9db5('0x37')]);_0x4f7374[_0x9db5('0x38')]=_['intersection'](_0x4f7374[_0x9db5('0x34')],_0x4f7374[_0x9db5('0x37')]);_0x52ff93[_0x9db5('0x39')]=_[_0x9db5('0x3a')](_0x4f7374[_0x9db5('0x34')],qs[_0x9db5('0x3b')](_0x42daff[_0x9db5('0x37')][_0x9db5('0x3b')]));_0x52ff93[_0x9db5('0x39')]=_0x52ff93[_0x9db5('0x39')][_0x9db5('0x3c')]?_0x52ff93[_0x9db5('0x39')]:_0x4f7374['model'];if(!_0x42daff[_0x9db5('0x37')][_0x9db5('0x3d')]('nolimit')){_0x52ff93[_0x9db5('0x21')]=qs[_0x9db5('0x21')](_0x42daff['query'][_0x9db5('0x21')]);_0x52ff93[_0x9db5('0x23')]=qs[_0x9db5('0x23')](_0x42daff[_0x9db5('0x37')][_0x9db5('0x23')]);}_0x52ff93[_0x9db5('0x3e')]=qs[_0x9db5('0x3f')](_0x42daff[_0x9db5('0x37')]['sort']);_0x52ff93[_0x9db5('0x40')]=qs[_0x9db5('0x38')](_[_0x9db5('0x41')](_0x42daff['query'],_0x4f7374['filters']),_0x587a74);if(_0x42daff[_0x9db5('0x37')][_0x9db5('0x42')]){_0x52ff93[_0x9db5('0x40')]=_[_0x9db5('0x43')](_0x52ff93[_0x9db5('0x40')],{'$or':_['map'](_0x587a74,function(_0x5c3d2f){if(_0x5c3d2f[_0x9db5('0x44')]!==_0x9db5('0x45')){var _0x420764={};_0x420764[_0x5c3d2f[_0x9db5('0x2b')]]={'$like':'%'+_0x42daff[_0x9db5('0x37')]['filter']+'%'};return _0x420764;}})});}_0x52ff93=_[_0x9db5('0x43')]({},_0x52ff93,_0x42daff[_0x9db5('0x46')]);var _0x1f0036={'where':_0x52ff93[_0x9db5('0x40')]};return db[_0x9db5('0x30')][_0x9db5('0x22')](_0x1f0036)[_0x9db5('0x27')](function(_0x2bf013){_0x10755a[_0x9db5('0x22')]=_0x2bf013;if(_0x42daff[_0x9db5('0x37')][_0x9db5('0x47')]){_0x52ff93['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x52ff93);})['then'](function(_0x340160){_0x10755a[_0x9db5('0x48')]=_0x340160;return _0x10755a;})['then'](respondWithFilteredResult(_0x30e104,_0x52ff93))[_0x9db5('0x1b')](handleError(_0x30e104,null));};exports['show']=function(_0x155526,_0x51dc33){var _0x573b58={'raw':![],'where':{'id':_0x155526[_0x9db5('0x49')]['id']},'include':[{'model':db[_0x9db5('0x2e')],'as':'mandatoryDispositionPause'}]},_0x1452cd={};_0x1452cd[_0x9db5('0x34')]=_[_0x9db5('0x36')](db[_0x9db5('0x30')][_0x9db5('0x31')]);_0x1452cd[_0x9db5('0x37')]=_['keys'](_0x155526[_0x9db5('0x37')]);_0x1452cd[_0x9db5('0x38')]=_['intersection'](_0x1452cd[_0x9db5('0x34')],_0x1452cd['query']);_0x573b58[_0x9db5('0x39')]=_[_0x9db5('0x3a')](_0x1452cd[_0x9db5('0x34')],qs[_0x9db5('0x3b')](_0x155526[_0x9db5('0x37')][_0x9db5('0x3b')]));_0x573b58['attributes']=_0x573b58[_0x9db5('0x39')]['length']?_0x573b58['attributes']:_0x1452cd[_0x9db5('0x34')];if(_0x155526[_0x9db5('0x37')][_0x9db5('0x47')]){_0x573b58['include']=[{'all':!![]}];}_0x573b58=_[_0x9db5('0x43')]({},_0x573b58,_0x155526[_0x9db5('0x46')]);return db[_0x9db5('0x30')][_0x9db5('0x4a')](_0x573b58)[_0x9db5('0x27')](handleEntityNotFound(_0x51dc33,null))['then'](respondWithResult(_0x51dc33,null))['catch'](handleError(_0x51dc33,null));};exports['create']=function(_0x259d42,_0x429409){return db[_0x9db5('0x30')][_0x9db5('0x4b')](_0x259d42[_0x9db5('0x4c')],{})[_0x9db5('0x27')](function(_0xfdbf53){var _0x4992ac=_0x259d42[_0x9db5('0x4d')][_0x9db5('0x4e')]({'plain':!![]});if(!_0x4992ac)throw new Error(_0x9db5('0x4f'));if(_0x4992ac[_0x9db5('0x50')]==='user'){var _0x1e2a1c=_0xfdbf53['get']({'plain':!![]});var _0x599d2c=_0x9db5('0x28');return db[_0x9db5('0x51')][_0x9db5('0x4a')]({'where':{'name':_0x599d2c,'userProfileId':_0x4992ac[_0x9db5('0x52')]},'raw':!![]})['then'](function(_0x2d8a11){if(_0x2d8a11&&_0x2d8a11[_0x9db5('0x53')]===0x0){return db[_0x9db5('0x29')]['create']({'name':_0x1e2a1c[_0x9db5('0x2b')],'resourceId':_0x1e2a1c['id'],'type':_0x2d8a11[_0x9db5('0x2b')],'sectionId':_0x2d8a11['id']},{})['then'](function(){return _0xfdbf53;});}else{return _0xfdbf53;}})[_0x9db5('0x1b')](function(_0x391cbe){logger[_0x9db5('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x391cbe);throw _0x391cbe;});}return _0xfdbf53;})['then'](respondWithResult(_0x429409,0xc9))['catch'](handleError(_0x429409,null));};exports[_0x9db5('0x25')]=function(_0x5c761a,_0x3d461c){if(_0x5c761a[_0x9db5('0x4c')]['id']){delete _0x5c761a[_0x9db5('0x4c')]['id'];}return db[_0x9db5('0x30')]['find']({'where':{'id':_0x5c761a[_0x9db5('0x49')]['id']},'include':[{'model':db['Pause'],'as':_0x9db5('0x2f')}]})['then'](handleEntityNotFound(_0x3d461c,null))['then'](saveUpdates(_0x5c761a[_0x9db5('0x4c')],null))[_0x9db5('0x27')](respondWithResult(_0x3d461c,null))[_0x9db5('0x1b')](handleError(_0x3d461c,null));};exports[_0x9db5('0x26')]=function(_0x24953,_0x4053d3){return db[_0x9db5('0x30')][_0x9db5('0x4a')]({'where':{'id':_0x24953[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x4053d3,null))['then'](removeEntity(_0x4053d3,null))['catch'](handleError(_0x4053d3,null));};exports['describe']=function(_0x12a204,_0x526d0b){return db[_0x9db5('0x30')][_0x9db5('0x54')]()[_0x9db5('0x27')](respondWithResult(_0x526d0b,null))['catch'](handleError(_0x526d0b,null));};exports['addDisposition']=function(_0x240bdd,_0x516e0f){if(_0x240bdd[_0x9db5('0x4c')]['id']){delete _0x240bdd[_0x9db5('0x4c')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x240bdd['params']['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x516e0f,null))[_0x9db5('0x27')](function(_0x109f27){if(_0x109f27){_0x240bdd[_0x9db5('0x4c')][_0x9db5('0x55')]=_0x109f27['id'];return db[_0x9db5('0x56')][_0x9db5('0x4b')](_0x240bdd[_0x9db5('0x4c')]);}})[_0x9db5('0x27')](respondWithResult(_0x516e0f,null))[_0x9db5('0x1b')](handleError(_0x516e0f,null));};exports[_0x9db5('0x57')]=function(_0x2e436a,_0x1f76f4){var _0x33f112={'raw':![],'where':{}};var _0x6d6174={};var _0x5c73ed={'count':0x0,'rows':[]};return db[_0x9db5('0x30')]['findOne']({'where':{'id':_0x2e436a[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x1f76f4,null))[_0x9db5('0x27')](function(_0x3ecdec){if(_0x3ecdec){_0x6d6174[_0x9db5('0x34')]=_[_0x9db5('0x36')](db[_0x9db5('0x56')][_0x9db5('0x31')]);_0x6d6174[_0x9db5('0x37')]=_[_0x9db5('0x36')](_0x2e436a[_0x9db5('0x37')]);_0x6d6174[_0x9db5('0x38')]=_[_0x9db5('0x3a')](_0x6d6174[_0x9db5('0x34')],_0x6d6174['query']);_0x33f112[_0x9db5('0x39')]=_[_0x9db5('0x3a')](_0x6d6174[_0x9db5('0x34')],qs['fields'](_0x2e436a[_0x9db5('0x37')][_0x9db5('0x3b')]));_0x33f112['attributes']=_0x33f112[_0x9db5('0x39')][_0x9db5('0x3c')]?_0x33f112[_0x9db5('0x39')]:_0x6d6174[_0x9db5('0x34')];if(!_0x2e436a['query'][_0x9db5('0x3d')](_0x9db5('0x58'))){_0x33f112[_0x9db5('0x21')]=qs[_0x9db5('0x21')](_0x2e436a[_0x9db5('0x37')]['limit']);_0x33f112[_0x9db5('0x23')]=qs[_0x9db5('0x23')](_0x2e436a[_0x9db5('0x37')][_0x9db5('0x23')]);}_0x33f112['order']=qs['sort'](_0x2e436a[_0x9db5('0x37')][_0x9db5('0x3f')]);_0x33f112[_0x9db5('0x40')]=qs['filters'](_['pick'](_0x2e436a[_0x9db5('0x37')],_0x6d6174['filters']));_0x33f112[_0x9db5('0x40')][_0x9db5('0x55')]=_0x3ecdec['id'];if(_0x2e436a['query'][_0x9db5('0x42')]){_0x33f112[_0x9db5('0x40')]=_['merge'](_0x33f112[_0x9db5('0x40')],{'$or':_[_0x9db5('0x35')](_0x33f112[_0x9db5('0x39')],function(_0x3999a1){var _0x2689a6={};_0x2689a6[_0x3999a1]={'$like':'%'+_0x2e436a[_0x9db5('0x37')][_0x9db5('0x42')]+'%'};return _0x2689a6;})});}_0x33f112=_[_0x9db5('0x43')]({},_0x33f112,_0x2e436a['options']);return db[_0x9db5('0x56')][_0x9db5('0x22')]({'where':_0x33f112[_0x9db5('0x40')]})[_0x9db5('0x27')](function(_0x568b40){_0x5c73ed[_0x9db5('0x22')]=_0x568b40;if(_0x2e436a[_0x9db5('0x37')]['includeAll']){_0x33f112[_0x9db5('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x33f112);})[_0x9db5('0x27')](function(_0x2ede31){_0x5c73ed[_0x9db5('0x48')]=_0x2ede31;return _0x5c73ed;});}})[_0x9db5('0x27')](respondWithFilteredResult(_0x1f76f4,_0x33f112))[_0x9db5('0x1b')](handleError(_0x1f76f4,null));};exports[_0x9db5('0x5a')]=function(_0x3e0763,_0x5b9860){return db[_0x9db5('0x30')]['find']({'where':{'id':_0x3e0763['params']['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x5b9860,null))[_0x9db5('0x27')](function(_0x7244a1){if(_0x7244a1){return _0x7244a1[_0x9db5('0x5a')](_0x3e0763[_0x9db5('0x37')]['ids']);}})[_0x9db5('0x27')](respondWithStatusCode(_0x5b9860,null))[_0x9db5('0x1b')](handleError(_0x5b9860,null));};exports[_0x9db5('0x5b')]=function(_0x42e0df,_0x43ec7a){if(_0x42e0df['body']['id']){delete _0x42e0df['body']['id'];}return db['ChatWebsite'][_0x9db5('0x4a')]({'where':{'id':_0x42e0df[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x43ec7a,null))[_0x9db5('0x27')](function(_0x3984ff){if(_0x3984ff){_0x42e0df['body'][_0x9db5('0x55')]=_0x3984ff['id'];return db['CannedAnswer'][_0x9db5('0x4b')](_0x42e0df[_0x9db5('0x4c')]);}})[_0x9db5('0x27')](respondWithResult(_0x43ec7a,null))['catch'](handleError(_0x43ec7a,null));};exports[_0x9db5('0x5c')]=function(_0x516222,_0x5bc7f7){var _0x2cb3e5={'raw':![],'where':{}};var _0x3345d5={};var _0x3457cd={'count':0x0,'rows':[]};return db[_0x9db5('0x30')][_0x9db5('0x5d')]({'where':{'id':_0x516222[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x5bc7f7,null))['then'](function(_0x4efcc7){if(_0x4efcc7){_0x3345d5[_0x9db5('0x34')]=_['keys'](db[_0x9db5('0x5e')][_0x9db5('0x31')]);_0x3345d5[_0x9db5('0x37')]=_['keys'](_0x516222[_0x9db5('0x37')]);_0x3345d5[_0x9db5('0x38')]=_[_0x9db5('0x3a')](_0x3345d5[_0x9db5('0x34')],_0x3345d5[_0x9db5('0x37')]);_0x2cb3e5[_0x9db5('0x39')]=_[_0x9db5('0x3a')](_0x3345d5[_0x9db5('0x34')],qs[_0x9db5('0x3b')](_0x516222[_0x9db5('0x37')][_0x9db5('0x3b')]));_0x2cb3e5[_0x9db5('0x39')]=_0x2cb3e5[_0x9db5('0x39')][_0x9db5('0x3c')]?_0x2cb3e5[_0x9db5('0x39')]:_0x3345d5[_0x9db5('0x34')];if(!_0x516222[_0x9db5('0x37')]['hasOwnProperty']('nolimit')){_0x2cb3e5[_0x9db5('0x21')]=qs[_0x9db5('0x21')](_0x516222[_0x9db5('0x37')][_0x9db5('0x21')]);_0x2cb3e5['offset']=qs[_0x9db5('0x23')](_0x516222[_0x9db5('0x37')]['offset']);}_0x2cb3e5['order']=qs[_0x9db5('0x3f')](_0x516222['query'][_0x9db5('0x3f')]);_0x2cb3e5[_0x9db5('0x40')]=qs['filters'](_[_0x9db5('0x41')](_0x516222[_0x9db5('0x37')],_0x3345d5[_0x9db5('0x38')]));_0x2cb3e5['where'][_0x9db5('0x55')]=_0x4efcc7['id'];if(_0x516222[_0x9db5('0x37')][_0x9db5('0x42')]){_0x2cb3e5[_0x9db5('0x40')]=_[_0x9db5('0x43')](_0x2cb3e5['where'],{'$or':_['map'](_0x2cb3e5[_0x9db5('0x39')],function(_0xf03140){var _0x3ed584={};_0x3ed584[_0xf03140]={'$like':'%'+_0x516222[_0x9db5('0x37')][_0x9db5('0x42')]+'%'};return _0x3ed584;})});}_0x2cb3e5=_[_0x9db5('0x43')]({},_0x2cb3e5,_0x516222[_0x9db5('0x46')]);return db['CannedAnswer'][_0x9db5('0x22')]({'where':_0x2cb3e5['where']})['then'](function(_0x34593c){_0x3457cd[_0x9db5('0x22')]=_0x34593c;if(_0x516222[_0x9db5('0x37')][_0x9db5('0x47')]){_0x2cb3e5[_0x9db5('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9db5('0x5f')](_0x2cb3e5);})['then'](function(_0x2ef06e){_0x3457cd[_0x9db5('0x48')]=_0x2ef06e;return _0x3457cd;});}})[_0x9db5('0x27')](respondWithFilteredResult(_0x5bc7f7,_0x2cb3e5))[_0x9db5('0x1b')](handleError(_0x5bc7f7,null));};exports['removeAnswers']=function(_0x1f1462,_0x341b7){return db['ChatWebsite']['find']({'where':{'id':_0x1f1462['params']['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x341b7,null))[_0x9db5('0x27')](function(_0x54ff22){if(_0x54ff22){return _0x54ff22[_0x9db5('0x60')](_0x1f1462[_0x9db5('0x37')][_0x9db5('0x61')]);}})[_0x9db5('0x27')](respondWithStatusCode(_0x341b7,null))[_0x9db5('0x1b')](handleError(_0x341b7,null));};exports[_0x9db5('0x62')]=function(_0x5e45ab,_0x54be42){_0x5e45ab[_0x9db5('0x4c')][_0x9db5('0x63')]=_0x5e45ab[_0x9db5('0x64')][_0x9db5('0x65')];return db[_0x9db5('0x30')]['find']({'where':{'id':_0x5e45ab[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x54be42,null))[_0x9db5('0x27')](saveUpdates(_0x5e45ab[_0x9db5('0x4c')],null))['then'](respondWithResult(_0x54be42,null))['catch'](handleError(_0x54be42,null));};exports[_0x9db5('0x66')]=function(_0x3b5f56,_0x465a12){_0x3b5f56[_0x9db5('0x4c')][_0x9db5('0x67')]=_0x3b5f56['file'][_0x9db5('0x65')];return db[_0x9db5('0x30')][_0x9db5('0x4a')]({'where':{'id':_0x3b5f56[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x465a12,null))[_0x9db5('0x27')](saveUpdates(_0x3b5f56[_0x9db5('0x4c')],null))[_0x9db5('0x27')](respondWithResult(_0x465a12,null))[_0x9db5('0x1b')](handleError(_0x465a12,null));};exports[_0x9db5('0x68')]=function(_0xdd7bdf,_0x1a14f0){_0xdd7bdf[_0x9db5('0x4c')]['customerAvatar']=_0xdd7bdf[_0x9db5('0x64')][_0x9db5('0x65')];return db['ChatWebsite'][_0x9db5('0x4a')]({'where':{'id':_0xdd7bdf[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x1a14f0,null))[_0x9db5('0x27')](saveUpdates(_0xdd7bdf[_0x9db5('0x4c')],null))[_0x9db5('0x27')](respondWithResult(_0x1a14f0,null))[_0x9db5('0x1b')](handleError(_0x1a14f0,null));};exports[_0x9db5('0x69')]=function(_0x3596d3,_0x56cca6){_0x3596d3[_0x9db5('0x4c')]['systemAvatar']=_0x3596d3[_0x9db5('0x64')][_0x9db5('0x65')];return db['ChatWebsite'][_0x9db5('0x4a')]({'where':{'id':_0x3596d3['params']['id']}})['then'](handleEntityNotFound(_0x56cca6,null))[_0x9db5('0x27')](saveUpdates(_0x3596d3[_0x9db5('0x4c')],null))[_0x9db5('0x27')](respondWithResult(_0x56cca6,null))[_0x9db5('0x1b')](handleError(_0x56cca6,null));};exports[_0x9db5('0x6a')]=function(_0x5cb3fb,_0x4f5952){var _0x14fdf8=path['join'](config[_0x9db5('0x6b')],_0x9db5('0x6c'));var _0x43f0d1={'where':{'id':_0x5cb3fb[_0x9db5('0x49')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x4fbac9=![];return require(_0x9db5('0x6d'))['getLicense']()[_0x9db5('0x27')](function(_0x1a7d12){if(_0x1a7d12){_0x4fbac9=_0x1a7d12[_0x9db5('0x6e')];}})[_0x9db5('0x27')](function(){return db['ChatWebsite'][_0x9db5('0x4a')](_0x43f0d1);})['then'](handleEntityNotFound(_0x4f5952,null))[_0x9db5('0x27')](function(_0x589d8c){if(_0x589d8c){if(!_[_0x9db5('0x6f')](_0x589d8c['sitepic'])){if(fs[_0x9db5('0x70')](path[_0x9db5('0x71')](config[_0x9db5('0x6b')],_0x9db5('0x72'),_0x589d8c[_0x9db5('0x63')]))&&_0x4fbac9){_0x14fdf8=path[_0x9db5('0x71')](config[_0x9db5('0x6b')],_0x9db5('0x72'),_0x589d8c[_0x9db5('0x63')]);}}return _0x4f5952[_0x9db5('0x73')](_0x14fdf8);}})[_0x9db5('0x1b')](handleError(_0x4f5952,null));};exports[_0x9db5('0x74')]=function(_0xf2c417,_0x5aa6cc){var _0x528008=path[_0x9db5('0x71')](config[_0x9db5('0x6b')],_0x9db5('0x75'));var _0x1c813e={'where':{'id':_0xf2c417[_0x9db5('0x49')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x9db5('0x4a')](_0x1c813e)['then'](handleEntityNotFound(_0x5aa6cc,null))[_0x9db5('0x27')](function(_0xf7da64){if(_0xf7da64){if(!_['isNil'](_0xf7da64['agentAvatar'])){if(fs['existsSync'](path[_0x9db5('0x71')](config['root'],_0x9db5('0x76'),_0xf7da64[_0x9db5('0x67')]))){_0x528008=path['join'](config['root'],_0x9db5('0x76'),_0xf7da64[_0x9db5('0x67')]);}}return _0x5aa6cc[_0x9db5('0x73')](_0x528008);}})[_0x9db5('0x1b')](handleError(_0x5aa6cc,null));};exports['getCustomerAvatar']=function(_0x4a53a7,_0x563005){var _0x5e3f71=path['join'](config[_0x9db5('0x6b')],_0x9db5('0x77'));var _0x460d09={'where':{'id':_0x4a53a7[_0x9db5('0x49')]['id']},'attributes':['id',_0x9db5('0x78'),_0x9db5('0x79')],'raw':!![]};return db[_0x9db5('0x30')][_0x9db5('0x4a')](_0x460d09)[_0x9db5('0x27')](handleEntityNotFound(_0x563005,null))[_0x9db5('0x27')](function(_0x2eb2ce){if(_0x2eb2ce){if(!_[_0x9db5('0x6f')](_0x2eb2ce[_0x9db5('0x78')])){if(fs[_0x9db5('0x70')](path[_0x9db5('0x71')](config[_0x9db5('0x6b')],_0x9db5('0x76'),_0x2eb2ce[_0x9db5('0x78')]))&&_0x2eb2ce[_0x9db5('0x79')]){_0x5e3f71=path['join'](config['root'],_0x9db5('0x76'),_0x2eb2ce[_0x9db5('0x78')]);}}return _0x563005[_0x9db5('0x73')](_0x5e3f71);}})[_0x9db5('0x1b')](handleError(_0x563005,null));};exports['getSystemAvatar']=function(_0xef1a2c,_0x1aeeb4){var _0x43799e=path[_0x9db5('0x71')](config[_0x9db5('0x6b')],_0x9db5('0x7a'));var _0xfd8af9={'where':{'id':_0xef1a2c[_0x9db5('0x49')]['id']},'attributes':['id',_0x9db5('0x7b')],'raw':!![]};return db[_0x9db5('0x30')]['find'](_0xfd8af9)[_0x9db5('0x27')](handleEntityNotFound(_0x1aeeb4,null))[_0x9db5('0x27')](function(_0x1d532c){if(_0x1d532c){if(!_[_0x9db5('0x6f')](_0x1d532c[_0x9db5('0x7b')])){if(fs['existsSync'](path[_0x9db5('0x71')](config[_0x9db5('0x6b')],'server/files/images/avatars/',_0x1d532c[_0x9db5('0x7b')]))){_0x43799e=path['join'](config[_0x9db5('0x6b')],_0x9db5('0x76'),_0x1d532c[_0x9db5('0x7b')]);}}return _0x1aeeb4[_0x9db5('0x73')](_0x43799e);}})[_0x9db5('0x1b')](handleError(_0x1aeeb4,null));};exports[_0x9db5('0x7c')]=function(_0x38be57,_0x1bce12){var _0x2af504=require('user-agent-parser');var _0x373d31=new _0x2af504();var _0x26edf8=_0x373d31[_0x9db5('0x7d')](_0x38be57['headers'][_0x9db5('0x7e')])[_0x9db5('0x7f')]();var _0x3e79a9={'body':_0x38be57['body'],'channel':_0x9db5('0x80')};var _0x4f2f10=[];var _0x5d95c7=[];var _0x43d8a8={};var _0x170cae=![];return db[_0x9db5('0x81')][_0x9db5('0x54')]()[_0x9db5('0x27')](function(_0x26724a){if(!_0x26724a){throw new db[(_0x9db5('0x82'))]['ValidationError'](_0x9db5('0x83'));}_0x4f2f10=_[_0x9db5('0x84')](_['keys'](_0x26724a),['createdAt',_0x9db5('0x85')]);_0x5d95c7=_['difference'](_['keys'](_0x26724a),['createdAt',_0x9db5('0x85'),_0x9db5('0x86'),'ListId']);if(_0x38be57[_0x9db5('0x4c')]['id']){delete _0x38be57[_0x9db5('0x4c')]['id'];}if(_[_0x9db5('0x6f')](_0x38be57[_0x9db5('0x4c')]['from'])){throw new db[(_0x9db5('0x82'))][(_0x9db5('0x87'))]('from\x20is\x20mandatory');}if(_[_0x9db5('0x6f')](_0x38be57[_0x9db5('0x4c')]['body'])||_0x38be57['body'][_0x9db5('0x4c')]===''){throw new db[(_0x9db5('0x82'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9db5('0x6f')](_0x38be57[_0x9db5('0x4c')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x9db5('0x88')+_0x5d95c7);}if(!_[_0x9db5('0x89')](_0x5d95c7,_0x38be57[_0x9db5('0x4c')][_0x9db5('0x8a')])){throw new db[(_0x9db5('0x82'))][(_0x9db5('0x87'))](_0x9db5('0x8b')+_0x5d95c7);}_0x43d8a8[_0x38be57[_0x9db5('0x4c')][_0x9db5('0x8a')]]=_0x38be57[_0x9db5('0x4c')][_0x9db5('0x8c')];})[_0x9db5('0x27')](function(){return db[_0x9db5('0x30')][_0x9db5('0x4a')]({'where':{'id':_0x38be57[_0x9db5('0x49')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9db5('0x81')],'as':_0x9db5('0x8d'),'where':_0x43d8a8,'limit':0x1,'order':[[_0x9db5('0x85'),_0x9db5('0x8e')]]}]},{'model':db[_0x9db5('0x8f')],'as':_0x9db5('0x90')}]});})['then'](handleEntityNotFound(_0x1bce12,null))['then'](function(_0xc81e79){if(_0xc81e79&&_0xc81e79[_0x9db5('0x91')]){_0x3e79a9['account']=_0xc81e79;_0x3e79a9[_0x9db5('0x92')]=_0xc81e79[_0x9db5('0x90')];_0x3e79a9[_0x9db5('0x93')]=_0xc81e79[_0x9db5('0x91')];_0x3e79a9[_0x9db5('0x92')]=_[_0x9db5('0x94')](_0x3e79a9[_0x9db5('0x92')],[_0x9db5('0x95')],[_0x9db5('0x96')]);if(_0x3e79a9[_0x9db5('0x97')][_0x9db5('0x90')]){delete _0x3e79a9['account'][_0x9db5('0x90')];}if(_0x3e79a9[_0x9db5('0x97')][_0x9db5('0x91')]&&_0x3e79a9[_0x9db5('0x97')][_0x9db5('0x91')][_0x9db5('0x8d')][_0x9db5('0x3c')]){return _0x3e79a9['account'][_0x9db5('0x91')][_0x9db5('0x8d')][0x0];}var _0x572055=_[_0x9db5('0xc')](_0x38be57[_0x9db5('0x4c')],{'firstName':_0x38be57[_0x9db5('0x4c')][_0x9db5('0x8c')],'ListId':_0xc81e79[_0x9db5('0x98')]});_0x572055[_0x38be57[_0x9db5('0x4c')]['mapKey']]=_0x38be57['body'][_0x9db5('0x8c')];return db[_0x9db5('0x81')][_0x9db5('0x4b')](_0x572055,{'fields':_0x4f2f10,'raw':!![]});}})[_0x9db5('0x27')](handleEntityNotFound(_0x1bce12,null))[_0x9db5('0x27')](function(_0x3c5c27){_0x3e79a9[_0x9db5('0x99')]=_0x3c5c27;var _0x29acdc=_0x38be57[_0x9db5('0x4c')][_0x9db5('0x9a')];if(_0x38be57[_0x9db5('0x9b')][_0x9db5('0x9c')]){_0x29acdc=_0x38be57[_0x9db5('0x9b')][_0x9db5('0x9c')];}else if(_0x38be57[_0x9db5('0x9b')]['x-forwarded-for']){_0x29acdc=_[_0x9db5('0x9d')](_0x38be57[_0x9db5('0x9b')][_0x9db5('0x9e')]['split'](','));}if(_0x3c5c27){var _0x2f25b1={'ContactId':_0x3c5c27['id'],'ChatWebsiteId':_0x38be57['params']['id'],'from':(_0x3c5c27['firstName']||'')+'\x20'+(_0x3c5c27[_0x9db5('0x9f')]||''),'customerIp':_0x29acdc,'customerPort':_0x38be57[_0x9db5('0x9b')][_0x9db5('0xa0')]?_0x38be57[_0x9db5('0x9b')][_0x9db5('0xa0')]:null,'referer':_0x38be57[_0x9db5('0x4c')]['referer'],'browserName':_0x26edf8['browser']['name']&&_0x26edf8[_0x9db5('0xa1')][_0x9db5('0xa2')]?util[_0x9db5('0xa3')](_0x9db5('0xa4'),_0x26edf8[_0x9db5('0xa1')][_0x9db5('0x2b')],_0x26edf8[_0x9db5('0xa1')][_0x9db5('0xa2')]):_0x9db5('0xa5'),'browserVersion':_0x26edf8[_0x9db5('0xa1')]['version']||_0x9db5('0xa5'),'osName':util[_0x9db5('0xa3')](_0x9db5('0xa4'),_0x26edf8['os']['name'],_0x26edf8['os']['version']),'osVersion':_0x26edf8['os'][_0x9db5('0xa2')],'deviceModel':_0x26edf8[_0x9db5('0xa6')][_0x9db5('0x34')]&&_0x26edf8[_0x9db5('0xa6')][_0x9db5('0xa7')]?util['format'](_0x9db5('0xa8'),_0x26edf8[_0x9db5('0xa6')]['model'],_0x26edf8[_0x9db5('0xa6')][_0x9db5('0xa7')],_0x26edf8['device'][_0x9db5('0x44')]):null,'deviceVendor':_0x26edf8['device'][_0x9db5('0xa7')],'deviceType':_0x26edf8[_0x9db5('0xa6')][_0x9db5('0x44')],'formData':JSON[_0x9db5('0x17')](_0x38be57[_0x9db5('0x4c')])};var _0x34a9fa={'ChatWebsiteId':_0x38be57[_0x9db5('0x49')]['id'],'closed':![]};if(_0x38be57[_0x9db5('0x4c')]['threadId']){_0x34a9fa[_0x9db5('0xa9')]=_0x38be57[_0x9db5('0x4c')]['threadId'];return db[_0x9db5('0xaa')]['find']({'where':_0x34a9fa})[_0x9db5('0x27')](function(_0x537884){if(_0x537884){return[_0x537884,![]];}_0x2f25b1[_0x9db5('0xa9')]=_0x38be57[_0x9db5('0x4c')][_0x9db5('0xa9')];_0x2f25b1['externalUrl']=_0x38be57[_0x9db5('0x4c')][_0x9db5('0xab')];return db[_0x9db5('0xaa')][_0x9db5('0x4b')](_0x2f25b1)['then'](function(_0x469219){return[_0x469219,!![]];});});}_0x34a9fa[_0x9db5('0xac')]=_0x3c5c27['id'];if(_0x38be57['body'][_0x9db5('0xad')]&&_0x38be57[_0x9db5('0x4c')]['interaction']['id']){_0x34a9fa['id']=_0x38be57[_0x9db5('0x4c')][_0x9db5('0xad')]['id'];return db[_0x9db5('0xaa')][_0x9db5('0x4a')]({'where':_0x34a9fa})['then'](function(_0x3bd520){if(_0x3bd520){return[_0x3bd520,![]];}return db[_0x9db5('0xaa')][_0x9db5('0x4b')](_0x2f25b1)[_0x9db5('0x27')](function(_0x37be1f){return[_0x37be1f,!![]];});});}return db[_0x9db5('0xaa')][_0x9db5('0x4b')](_0x2f25b1)[_0x9db5('0x27')](function(_0x5229ce){return[_0x5229ce,!![]];});}})['spread'](function(_0x41824c,_0x2e096a){if(_0x41824c){_0x170cae=_0x2e096a;if(!_0x2e096a){var _0x2ebe86={'from':(_0x3e79a9[_0x9db5('0x99')]['firstName']||'')+'\x20'+(_0x3e79a9['contact']['lastName']||'')};if(_0x38be57[_0x9db5('0x4c')][_0x9db5('0xa9')]&&_0x38be57[_0x9db5('0x4c')][_0x9db5('0xae')]&&_0x38be57[_0x9db5('0x4c')]['threadId']!=_0x38be57[_0x9db5('0x4c')][_0x9db5('0xae')]){_0x2ebe86[_0x9db5('0xa9')]=_0x38be57[_0x9db5('0x4c')][_0x9db5('0xae')];}return _0x41824c['update'](_0x2ebe86);}else{return _0x41824c;}}})[_0x9db5('0x27')](function(_0x4fb61e){_0x3e79a9['interaction']=_0x4fb61e[_0x9db5('0x4e')]({'plain':!![]});_0x3e79a9[_0x9db5('0xad')]['created']=_0x170cae;if(_0x3e79a9[_0x9db5('0xad')][_0x9db5('0xaf')]){if(_0x3e79a9['account'][_0x9db5('0xb0')]){_0x3e79a9[_0x9db5('0x92')][_0x9db5('0xb1')]({'id':0x0,'priority':_0x3e79a9[_0x9db5('0x92')][_0x9db5('0x3c')]+0x1,'app':_0x9db5('0xb2'),'appdata':'unmanaged','interval':_0x9db5('0xb3')});}}return db[_0x9db5('0xb4')]['create']({'body':_0x38be57[_0x9db5('0x4c')]['body'],'ChatWebsiteId':_0x38be57[_0x9db5('0x49')]['id'],'ChatInteractionId':_0x4fb61e['id'],'direction':'in','ContactId':_0x3e79a9[_0x9db5('0x99')]['id'],'AttachmentId':_0x38be57[_0x9db5('0x4c')]['AttachmentId']});})[_0x9db5('0x27')](function(_0x458a6c){_0x3e79a9['message']=_0x458a6c;if(_0x3e79a9[_0x9db5('0xad')]['UserId']){return db[_0x9db5('0xb5')][_0x9db5('0x4a')]({'attributes':['id','name'],'where':{'id':_0x3e79a9[_0x9db5('0xad')]['UserId']}})['then'](function(_0x2ce6d8){if(_0x2ce6d8){_0x3e79a9['applications'][_0x9db5('0xb6')]({'id':0x0,'priority':0x0,'app':_0x9db5('0xb7'),'appdata':_0x2ce6d8[_0x9db5('0x2b')]+','+(_0x3e79a9[_0x9db5('0x97')][_0x9db5('0xb8')]||0xa),'interval':'*,*,*,*'});_0x3e79a9[_0x9db5('0xb9')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x3e79a9);});}return respondWithRpcPromise(_0x9db5('0xba'),_0x9db5('0xbb'),_0x3e79a9);})[_0x9db5('0x27')](function(_0x74809b){respondWithRpcPromise('EventManager','EventManager',{'event':_0x9db5('0x7c'),'message':_0x74809b},client9002);return _0x74809b;})['then'](respondWithResult(_0x1bce12,null))[_0x9db5('0x1b')](handleError(_0x1bce12,null));};exports[_0x9db5('0xbc')]=function(_0xd4e25a,_0x509a20){var _0x18b1ed,_0x4be959,_0x470bb4;var _0x2918d6=[];var _0x558c5c={};var _0x569df2=_0xd4e25a[_0x9db5('0xbd')]||[];var _0x1ac2b8=[];var _0x1710e3;return db[_0x9db5('0x81')][_0x9db5('0x54')]()[_0x9db5('0x27')](function(_0x3c769d){if(!_0x3c769d){throw new db[(_0x9db5('0x82'))]['ValidationError'](_0x9db5('0x83'));}_0x2918d6=_[_0x9db5('0x84')](_[_0x9db5('0x36')](_0x3c769d),['createdAt','updatedAt',_0x9db5('0x86'),'ListId']);if(_0xd4e25a[_0x9db5('0x4c')]['id']){delete _0xd4e25a[_0x9db5('0x4c')]['id'];}if(_['isNil'](_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0x8c')])){throw _0x509a20[_0x9db5('0x1d')](0x1f4)[_0x9db5('0x2c')](new db[(_0x9db5('0x82'))][(_0x9db5('0x87'))](_0x9db5('0xbe')));}if(_[_0x9db5('0x6f')](_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0x4c')])||_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0x4c')]===''){throw _0x509a20[_0x9db5('0x1d')](0x1f4)[_0x9db5('0x2c')](new db[(_0x9db5('0x82'))]['ValidationError'](_0x9db5('0xbf')));}if(_['isNil'](_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0xc0')])){throw _0x509a20[_0x9db5('0x1d')](0x1f4)[_0x9db5('0x2c')](new db['Sequelize']['ValidationError'](_0x9db5('0xc1')+_0x2918d6));}if(!_[_0x9db5('0x89')](_0x2918d6,_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0xc0')])){throw _0x509a20[_0x9db5('0x1d')](0x1f4)[_0x9db5('0x2c')](new db[(_0x9db5('0x82'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2918d6));}_0x558c5c[_0xd4e25a['body'][_0x9db5('0xc0')]]=_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0x8c')];})[_0x9db5('0x27')](function(){return db[_0x9db5('0x30')][_0x9db5('0x4a')]({'where':{'id':_0xd4e25a[_0x9db5('0x49')]['id']},'include':[{'model':db[_0x9db5('0xc2')],'as':_0x9db5('0x91')},{'model':db[_0x9db5('0xc3')],'as':_0x9db5('0xc3')}]});})[_0x9db5('0x27')](handleEntityNotFound(_0x509a20,null))[_0x9db5('0x27')](function(_0x5760c5){if(_0x5760c5&&_0x5760c5[_0x9db5('0x91')]){_0x4be959=_0x5760c5;var _0x31d146=_[_0x9db5('0xc')](_0xd4e25a[_0x9db5('0x4c')],{'firstName':_0xd4e25a[_0x9db5('0x4c')]['from'],'phone':_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0x8c')],'ListId':_0x5760c5['ListId']});_0x31d146[_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0xc0')]]=_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0x8c')];return db['CmContact'][_0x9db5('0xc4')]({'where':_0x558c5c,'defaults':_0x31d146});}})[_0x9db5('0xc5')](function(_0x3caa60){if(_0x3caa60){_0x470bb4=_0x3caa60;var _0x4f76ca=fs[_0x9db5('0xc6')](path['join'](config[_0x9db5('0x6b')],_0x9db5('0xc7')),_0x9db5('0xc8'));var _0x536879=ejs[_0x9db5('0xc9')](_0x4f76ca,{'body':_['toPairs'](_0xd4e25a[_0x9db5('0x4c')][_0x9db5('0x4c')]),'bodyTitle':_0x4be959['offlineMessageBody']});return db[_0x9db5('0xca')][_0x9db5('0x4b')]({'body':_0x536879,'ContactId':_0x3caa60['id'],'ChatWebsiteId':_0x4be959['id']});}})[_0x9db5('0x27')](function(_0x3c3796){_0x1710e3=_0x3c3796;if(_0x569df2[_0x9db5('0x3c')]){var _0x465ac7=_0x569df2[_0x9db5('0x35')](function(_0x5a272c){return{'name':_0x5a272c[_0x9db5('0xcb')],'basename':_0x5a272c['filename'],'type':_0x5a272c['mimetype'],'ChatOfflineMessageId':_0x3c3796['id']};});_0x1ac2b8=_0x465ac7[_0x9db5('0x35')](_0x4403b3=>{var _0x4356c9={'filename':_0x4403b3[_0x9db5('0x2b')],'path':path[_0x9db5('0x71')](config['root'],_0x9db5('0xcc'),'files','attachments','offline-chat',_0x4403b3[_0x9db5('0xcd')])};return _0x4356c9;});if(!_0x4be959[_0x9db5('0xce')]){return db[_0x9db5('0xcf')][_0x9db5('0xd0')](function(_0x11fba6){return db['Attachment'][_0x9db5('0xd1')](_0x465ac7,{'transaction':_0x11fba6});});}}})[_0x9db5('0x27')](function(){if(_0x1710e3){_0x18b1ed=_0x1710e3;return db['MailAccount'][_0x9db5('0x5d')]({'where':{'active':!![]},'include':[{'model':db[_0x9db5('0xd2')],'as':'Smtp','raw':!![]}]});}})[_0x9db5('0x27')](function(_0x3295f2){if(_0x3295f2&&_0x3295f2[_0x9db5('0xd3')]&&_0x4be959['forwardOffline']&&_0x4be959[_0x9db5('0xd4')]){var _0x345fee={'tls':{'rejectUnauthorized':![]}};if(_0x3295f2[_0x9db5('0xd3')]['service']){_0x345fee['service']=_0x3295f2[_0x9db5('0xd3')][_0x9db5('0xd5')];}else{_0x345fee['host']=_0x3295f2['Smtp']['host'];_0x345fee['port']=_0x3295f2[_0x9db5('0xd3')][_0x9db5('0xd6')];_0x345fee[_0x9db5('0xd7')]=_0x3295f2[_0x9db5('0xd3')][_0x9db5('0xd7')];}if(_0x3295f2[_0x9db5('0xd3')][_0x9db5('0xd8')]){_0x345fee[_0x9db5('0xd9')]={'user':_0x3295f2['Smtp']['user'],'pass':_0x3295f2[_0x9db5('0xd3')][_0x9db5('0xda')]};}return respondWithRpcPromise(_0x9db5('0xdb'),_0x9db5('0xdc'),{'account':_0x345fee,'message':{'from':util[_0x9db5('0xa3')](_0x9db5('0xdd'),_0x3295f2[_0x9db5('0x2b')],_0x3295f2[_0x9db5('0xde')]||_0x3295f2['Smtp'][_0x9db5('0x4d')]),'to':_0x4be959[_0x9db5('0xd4')],'subject':_0x4be959[_0x9db5('0xdf')],'html':_0x18b1ed[_0x9db5('0x4c')],'attachments':_0x1ac2b8}},client9003)[_0x9db5('0x27')](function(){return _0x18b1ed;})[_0x9db5('0x1b')](function(_0x4575fc){console[_0x9db5('0x18')](_0x4575fc);});}})[_0x9db5('0x27')](function(){if(_0x4be959&&_0x4be959[_0x9db5('0xce')]&&_0x4be959[_0x9db5('0xe0')]){var _0x1c6f90=[];if(_0x569df2[_0x9db5('0x3c')]){_0x1c6f90=_0x569df2[_0x9db5('0x35')](function(_0x268ea8){return{'name':_0x268ea8[_0x9db5('0xcb')],'basename':_0x268ea8[_0x9db5('0x65')],'type':_0x268ea8[_0x9db5('0xe1')],'ChatOfflineMessageId':_0x1710e3['id']};});}var _0x4f301d;if(!_['isNil'](_0x4be959[_0x9db5('0xe2')])){var _0x1b9efd=_[_0x9db5('0x35')](_0xd4e25a[_0x9db5('0x4c')],function(_0x520503){return _0x520503;});var _0x3d2506=_[_0x9db5('0xe3')](_0x1b9efd)[0x0];var _0x4403c4=_[_0x9db5('0xe4')](_0x3d2506,function(_0x5f2d34){return _0x5f2d34;});_0x4f301d=_0x4403c4[0x1][_0x4be959[_0x9db5('0xe2')]];}var _0x53f6fd={'from':_0x470bb4[_0x9db5('0xde')],'firstName':_0x470bb4['firstName'],'lastName':_0x470bb4[_0x9db5('0x9f')],'mapKey':_0x9db5('0xde'),'message':{'from':_0x470bb4[_0x9db5('0xde')],'to':_0x4be959[_0x9db5('0xc3')][_0x9db5('0xde')],'cc':'','subject':_[_0x9db5('0x6f')](_0x4f301d)?_0x4be959[_0x9db5('0xdf')]:_0x4f301d,'messageId':'','sentAt':new Date(),'attach':_0x1c6f90[_0x9db5('0x3c')],'attachments':_0x1c6f90,'originChannel':_0x9db5('0xe5'),'ChatWebsiteId':_0x4be959['id'],'ChatOfflineMessageId':_0x18b1ed['id'],'originTo':_0x4be959[_0x9db5('0xc3')]['email']},'body':_0x18b1ed[_0x9db5('0x4c')]};var _0x699ee7={'account':{'id':_0x4be959[_0x9db5('0xe0')]},'body':_0x53f6fd,'log':_0x9db5('0xe6')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x699ee7,client9001)['then'](function(){return _0x18b1ed;})[_0x9db5('0x1b')](function(_0x259a3e){console[_0x9db5('0x18')](_0x259a3e);});}return;})['then'](function(){if(_0x18b1ed){return _0x18b1ed;}})[_0x9db5('0x27')](respondWithResult(_0x509a20,null))['catch'](function(_0x2bbc7b){console[_0x9db5('0x18')](_0x9db5('0x1b'),_0x2bbc7b);for(var _0x16355a of _0x569df2){var _0x1bbbbe=path[_0x9db5('0x71')](config['root'],_0x9db5('0xcc'),_0x9db5('0xbd'),_0x9db5('0xe7'),_0x9db5('0xe8'),_0x16355a['filename']);fs_extra[_0x9db5('0xe9')](_0x1bbbbe)[_0x9db5('0x1b')](function(_0x4efb3c){console['error']('Could\x20not\x20remove\x20attachment\x20file',_0x1bbbbe,_0x4efb3c);});}});};exports[_0x9db5('0xea')]=function(_0x12dc70,_0x36674a){return db[_0x9db5('0xaa')][_0x9db5('0x4a')]({'where':{'id':_0x12dc70['params']['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x36674a,null))[_0x9db5('0x27')](function(_0x46262f){if(_0x46262f){return _0x46262f['addInteraction'](_0x12dc70[_0x9db5('0x4c')][_0x9db5('0x61')],_[_0x9db5('0xeb')](_0x12dc70['body'],['ids','id'])||{});}})[_0x9db5('0x27')](respondWithResult(_0x36674a,null))[_0x9db5('0x1b')](handleError(_0x36674a,null));};exports['getInteractions']=function(_0xaaf9db,_0x3f29be){var _0x31c103={'raw':![],'where':{}};var _0x1e2ba8={};var _0x156549={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9db5('0x5d')]({'where':{'id':_0xaaf9db[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x3f29be,null))[_0x9db5('0x27')](function(_0x3acf3b){if(_0x3acf3b){_0x1e2ba8[_0x9db5('0x34')]=_[_0x9db5('0x36')](db[_0x9db5('0xaa')][_0x9db5('0x31')]);_0x1e2ba8['query']=_['keys'](_0xaaf9db['query']);_0x1e2ba8[_0x9db5('0x38')]=_['intersection'](_0x1e2ba8[_0x9db5('0x34')],_0x1e2ba8['query']);_0x31c103[_0x9db5('0x39')]=_['intersection'](_0x1e2ba8[_0x9db5('0x34')],qs[_0x9db5('0x3b')](_0xaaf9db[_0x9db5('0x37')]['fields']));_0x31c103[_0x9db5('0x39')]=_0x31c103[_0x9db5('0x39')]['length']?_0x31c103[_0x9db5('0x39')]:_0x1e2ba8[_0x9db5('0x34')];if(!_0xaaf9db[_0x9db5('0x37')][_0x9db5('0x3d')]('nolimit')){_0x31c103[_0x9db5('0x21')]=qs['limit'](_0xaaf9db[_0x9db5('0x37')][_0x9db5('0x21')]);_0x31c103[_0x9db5('0x23')]=qs['offset'](_0xaaf9db[_0x9db5('0x37')][_0x9db5('0x23')]);}_0x31c103['order']=qs[_0x9db5('0x3f')](_0xaaf9db[_0x9db5('0x37')]['sort']);_0x31c103[_0x9db5('0x40')]=qs[_0x9db5('0x38')](_['pick'](_0xaaf9db[_0x9db5('0x37')],_0x1e2ba8['filters']));_0x31c103[_0x9db5('0x40')][_0x9db5('0x55')]=_0x3acf3b['id'];if(_0xaaf9db[_0x9db5('0x37')][_0x9db5('0x42')]){_0x31c103['where']=_[_0x9db5('0x43')](_0x31c103[_0x9db5('0x40')],{'$or':_[_0x9db5('0x35')](_0x31c103[_0x9db5('0x39')],function(_0x464543){var _0x534f73={};_0x534f73[_0x464543]={'$like':'%'+_0xaaf9db['query'][_0x9db5('0x42')]+'%'};return _0x534f73;})});}_0x31c103=_[_0x9db5('0x43')]({},_0x31c103,_0xaaf9db[_0x9db5('0x46')]);return db[_0x9db5('0xaa')][_0x9db5('0x22')]({'where':_0x31c103[_0x9db5('0x40')]})[_0x9db5('0x27')](function(_0x3faee6){_0x156549['count']=_0x3faee6;if(_0xaaf9db[_0x9db5('0x37')][_0x9db5('0x47')]){_0x31c103['include']=[{'model':db[_0x9db5('0x81')],'as':_0x9db5('0xec'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9db5('0x2b'),'fullname','internal'],'required':![]},{'model':db[_0x9db5('0xed')],'as':'Tags','attributes':['id','name',_0x9db5('0xee')],'where':_0xaaf9db[_0x9db5('0x37')][_0x9db5('0xef')]?{'id':_0xaaf9db[_0x9db5('0x37')]['tag']}:undefined,'required':_0xaaf9db[_0x9db5('0x37')]['tag']?!![]:![]}];}return db[_0x9db5('0xaa')][_0x9db5('0x5f')](_0x31c103);})[_0x9db5('0x27')](function(_0x56d609){_0x156549['rows']=_0x56d609;return _0x156549;});}})[_0x9db5('0x27')](respondWithFilteredResult(_0x3f29be,_0x31c103))[_0x9db5('0x1b')](handleError(_0x3f29be,null));};function iftimePromise(_0x489182,_0x48c075){return respondWithRpcPromise(_0x9db5('0xf0'),_0x9db5('0xf1'),{'command':_0x48c075['timezone']?util[_0x9db5('0xa3')](_0x9db5('0xf2'),_0x489182[_0x9db5('0xf3')],_0x48c075[_0x9db5('0xf4')]):util[_0x9db5('0xa3')](_0x9db5('0xf5'),_0x489182[_0x9db5('0xf3')])},client9002)[_0x9db5('0x27')](function(_0x21b2d1){var _0x75d645=_0x21b2d1&&_0x21b2d1[_0x9db5('0xf6')]('true')>=0x0?!![]:![];logger[_0x9db5('0x1a')](_0x9db5('0xf7'),_0x48c075['id'],_0x489182['id'],_0x489182[_0x9db5('0xf3')],_0x75d645?_0x9db5('0xf8'):'OFFLINE',_0x48c075['timezone']?_0x48c075[_0x9db5('0xf4')]:_0x9db5('0xf9'));return _0x75d645;})[_0x9db5('0x1b')](function(_0x40aa62){logger[_0x9db5('0x18')](_0x9db5('0xf7'),_0x48c075['id'],_0x489182['id'],_0x489182['interval'],util[_0x9db5('0xfa')](_0x40aa62,{'showHidden':![],'depth':null}),_0x48c075[_0x9db5('0xf4')]?_0x48c075[_0x9db5('0xf4')]:_0x9db5('0xf9'));return![];});}exports[_0x9db5('0xf1')]=function(_0x488627,_0x26aa32){var _0x2e3fdf=0x0;var _0x141dbb=0x0;var _0x150191=![];var _0x1c90f6;var _0xc2481d;return db[_0x9db5('0x30')]['find']({'where':{'id':_0x488627['params']['id']},'include':[{'model':db[_0x9db5('0xfb')],'as':_0x9db5('0xfb'),'include':[{'model':db[_0x9db5('0xfb')],'as':_0x9db5('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x9db5('0x27')](handleEntityNotFound(_0x26aa32,null))[_0x9db5('0x27')](function(_0x491db6){if(_0x491db6){_0x1c90f6=_0x491db6;return _0x491db6[_0x9db5('0xfd')]({'raw':!![]});}})['then'](function(_0x14d847){if(_0x1c90f6){if(_0x14d847){_0xc2481d=_0x14d847;}}return require(_0x9db5('0x6d'))['getLicense']();})['then'](function(_0x17cbaa){if(_0x17cbaa){_0x141dbb=_0x17cbaa[_0x9db5('0xfe')];_0x150191=_0x17cbaa['custom'];}})[_0x9db5('0x27')](function(){return db['ChatInteraction'][_0x9db5('0x22')]({'where':{'closed':![]}});})[_0x9db5('0x27')](function(_0x181c07){_0x2e3fdf=_0x181c07;if(_0x141dbb&&_0x181c07>_0x141dbb){return db[_0x9db5('0xff')][_0x9db5('0x5d')]({'where':{'id':0x1}})[_0x9db5('0x27')](function(_0x3113ab){if(_0x3113ab){_0x3113ab[_0x9db5('0x100')](_0x9db5('0x101'));}});}})[_0x9db5('0x27')](function(){if(_0x1c90f6[_0x9db5('0xfb')]&&_0x1c90f6[_0x9db5('0xfb')][_0x9db5('0xfc')]){var _0x3a887e=[];for(var _0x2a28e4=0x0;_0x2a28e4<_0x1c90f6[_0x9db5('0xfb')]['Intervals']['length'];_0x2a28e4++){var _0x45e288=_0x1c90f6[_0x9db5('0xfb')][_0x9db5('0xfc')][_0x2a28e4][_0x9db5('0x4e')]({'plain':!![]});_0x3a887e[_0x9db5('0xb1')](iftimePromise(_0x45e288,_0x1c90f6));}return BPromise[_0x9db5('0x102')](_0x3a887e)[_0x9db5('0x27')](function(_0x5e0b27){return _[_0x9db5('0x103')](_0x5e0b27);});}else{return!![];}})[_0x9db5('0x27')](function(_0xd089b7){var _0x3e67c3=fs[_0x9db5('0xc6')](path['join'](config['root'],_0x9db5('0x104')),_0x9db5('0xc8'));var _0x3de718={'remote':_0x1c90f6[_0x9db5('0x105')],'query':querystring[_0x9db5('0x17')](_[_0x9db5('0x43')](_0x1c90f6[_0x9db5('0x4e')]({'plain':!![]}),{'customerIp':_0x488627[_0x9db5('0x9b')][_0x9db5('0x9e')]||_0x488627[_0x9db5('0x9b')][_0x9db5('0x106')]||_0x488627['connection']['remoteAddress']||_0x488627['ip'],'referer':_0x488627[_0x9db5('0x9b')]['referer'],'openedInteractions':_0x2e3fdf,'maxInteractions':_0x141dbb,'virtual':_0x150191[_0x9db5('0xfe')],'online':_0xd089b7,'custom':_0x150191}))[_0x9db5('0x107')](/'/g,'\x5c\x27')};_0x26aa32[_0x9db5('0x2c')](ejs['render'](Mustache[_0x9db5('0xc9')](_0x3e67c3,_0x3de718),{'proactiveActions':_0xc2481d,'alignment':_0x1c90f6[_0x9db5('0x108')],'verticalAlignment':_0x1c90f6[_0x9db5('0x109')],'div_color':_0x1c90f6[_0x9db5('0xee')],'text_color':_0x1c90f6[_0x9db5('0x10a')],'button_color':_0x1c90f6[_0x9db5('0x10b')],'background_color':_0x1c90f6[_0x9db5('0x10c')]}));})['catch'](handleError(_0x26aa32,null));};exports[_0x9db5('0x10d')]=function(_0x209405,_0x5741c5){var _0xa7e395=_0x209405[_0x9db5('0x49')]['id'];var _0x3274df=_0x209405[_0x9db5('0x4c')];var _0x3418db=0xc8;var _0x2476dc=null;return db['sequelize'][_0x9db5('0xd0')]({'isolationLevel':db[_0x9db5('0xcf')]['Transaction']['ISOLATION_LEVELS'][_0x9db5('0x10e')]},function(_0x1be1c8){return db[_0x9db5('0x30')][_0x9db5('0x5d')]({'where':{'id':_0xa7e395},'transaction':_0x1be1c8})['then'](function(_0x62384a){if(_0x62384a){return db[_0x9db5('0x8f')]['destroy']({'where':{'ChatWebsiteId':_0xa7e395},'transaction':_0x1be1c8})[_0x9db5('0x27')](function(){var _0x1a6270=_['map'](_0x3274df,function(_0x390fc6){_0x390fc6['ChatWebsiteId']=_0xa7e395;return _0x390fc6;});return db[_0x9db5('0x8f')]['bulkCreate'](_0x1a6270,{'transaction':_0x1be1c8});});}else{_0x3418db=0x194;_0x2476dc=[];}});})[_0x9db5('0x27')](function(){if(_0x3418db!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0xa7e395},'order':_0x9db5('0x95')})[_0x9db5('0x27')](function(_0x573f02){_0x2476dc=_0x573f02;});}})[_0x9db5('0x1b')](function(_0x2ca041){_0x3418db=0x1f4;logger['error'](_0x2ca041['stack']);if(_0x2ca041[_0x9db5('0x2b')]){delete _0x2ca041[_0x9db5('0x2b')];}_0x2476dc=_0x2ca041;})[_0x9db5('0x10f')](function(){if(_0x2476dc===null){_0x5741c5[_0x9db5('0x1c')](_0x3418db);}else{if(_0x3418db===0x1f4){_0x5741c5['status'](_0x3418db)['send'](_0x2476dc);}else{_0x5741c5[_0x9db5('0x1d')](_0x3418db)['json'](_0x2476dc);}}});};exports[_0x9db5('0x110')]=function(_0x681b72,_0x1556ef){var _0x254d34={};var _0x57699b={};var _0x9e6b9b;var _0x24a2a0;return db[_0x9db5('0x30')]['findOne']({'where':{'id':_0x681b72[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x1556ef,null))[_0x9db5('0x27')](function(_0xa6b873){if(_0xa6b873){_0x9e6b9b=_0xa6b873;_0x57699b[_0x9db5('0x34')]=_[_0x9db5('0x36')](db[_0x9db5('0x8f')][_0x9db5('0x31')]);_0x57699b[_0x9db5('0x37')]=_[_0x9db5('0x36')](_0x681b72[_0x9db5('0x37')]);_0x57699b[_0x9db5('0x38')]=_[_0x9db5('0x3a')](_0x57699b[_0x9db5('0x34')],_0x57699b['query']);_0x254d34[_0x9db5('0x39')]=_[_0x9db5('0x3a')](_0x57699b[_0x9db5('0x34')],qs[_0x9db5('0x3b')](_0x681b72[_0x9db5('0x37')][_0x9db5('0x3b')]));_0x254d34[_0x9db5('0x39')]=_0x254d34[_0x9db5('0x39')]['length']?_0x254d34[_0x9db5('0x39')]:_0x57699b[_0x9db5('0x34')];_0x254d34['order']=qs[_0x9db5('0x3f')](_0x681b72[_0x9db5('0x37')][_0x9db5('0x3f')]);_0x254d34[_0x9db5('0x40')]=qs[_0x9db5('0x38')](_[_0x9db5('0x41')](_0x681b72[_0x9db5('0x37')],_0x57699b[_0x9db5('0x38')]));if(_0x681b72['query'][_0x9db5('0x42')]){_0x254d34['where']=_[_0x9db5('0x43')](_0x254d34['where'],{'$or':_[_0x9db5('0x35')](_0x254d34['attributes'],function(_0x207a5e){var _0x2de776={};_0x2de776[_0x207a5e]={'$like':'%'+_0x681b72[_0x9db5('0x37')][_0x9db5('0x42')]+'%'};return _0x2de776;})});}_0x254d34=_[_0x9db5('0x43')]({},_0x254d34,_0x681b72[_0x9db5('0x46')]);return _0x9e6b9b[_0x9db5('0x110')](_0x254d34);}})['then'](function(_0x360d65){if(_0x360d65){_0x24a2a0=_0x360d65[_0x9db5('0x3c')];if(!_0x681b72[_0x9db5('0x37')][_0x9db5('0x3d')](_0x9db5('0x58'))){_0x254d34[_0x9db5('0x21')]=qs[_0x9db5('0x21')](_0x681b72[_0x9db5('0x37')][_0x9db5('0x21')]);_0x254d34[_0x9db5('0x23')]=qs['offset'](_0x681b72[_0x9db5('0x37')][_0x9db5('0x23')]);}return _0x9e6b9b[_0x9db5('0x110')](_0x254d34);}})[_0x9db5('0x27')](function(_0x2eed3a){if(_0x2eed3a){return _0x2eed3a?{'count':_0x24a2a0,'rows':_0x2eed3a}:null;}})[_0x9db5('0x27')](respondWithResult(_0x1556ef,null))[_0x9db5('0x1b')](handleError(_0x1556ef,null));};exports[_0x9db5('0x111')]=function(_0x154dc3,_0x5da1a1){return db[_0x9db5('0x112')]['find']({'where':{'id':_0x154dc3['params']['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x5da1a1,null))[_0x9db5('0x27')](function(_0x3c83f7){if(_0x3c83f7){return _0x3c83f7[_0x9db5('0x111')](_0x154dc3['body']['ids'],_[_0x9db5('0xeb')](_0x154dc3['body'],['ids','id'])||{});}})[_0x9db5('0x27')](respondWithResult(_0x5da1a1,null))[_0x9db5('0x1b')](handleError(_0x5da1a1,null));};exports[_0x9db5('0xfd')]=function(_0x2e0f54,_0x5902f4){var _0x235adf={};var _0xf956b0={};var _0x1278f8;var _0x46ee89;return db[_0x9db5('0x30')][_0x9db5('0x5d')]({'where':{'id':_0x2e0f54['params']['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x5902f4,null))[_0x9db5('0x27')](function(_0x34008a){if(_0x34008a){_0x1278f8=_0x34008a;_0xf956b0[_0x9db5('0x34')]=_[_0x9db5('0x36')](db[_0x9db5('0x113')][_0x9db5('0x31')]);_0xf956b0[_0x9db5('0x37')]=_['keys'](_0x2e0f54['query']);_0xf956b0['filters']=_[_0x9db5('0x3a')](_0xf956b0[_0x9db5('0x34')],_0xf956b0['query']);_0x235adf[_0x9db5('0x39')]=_[_0x9db5('0x3a')](_0xf956b0[_0x9db5('0x34')],qs[_0x9db5('0x3b')](_0x2e0f54[_0x9db5('0x37')][_0x9db5('0x3b')]));_0x235adf['attributes']=_0x235adf[_0x9db5('0x39')][_0x9db5('0x3c')]?_0x235adf['attributes']:_0xf956b0[_0x9db5('0x34')];_0x235adf[_0x9db5('0x3e')]=qs['sort'](_0x2e0f54[_0x9db5('0x37')][_0x9db5('0x3f')]);_0x235adf['where']=qs[_0x9db5('0x38')](_[_0x9db5('0x41')](_0x2e0f54[_0x9db5('0x37')],_0xf956b0[_0x9db5('0x38')]));if(_0x2e0f54['query'][_0x9db5('0x42')]){_0x235adf[_0x9db5('0x40')]=_['merge'](_0x235adf['where'],{'$or':_['map'](_0x235adf[_0x9db5('0x39')],function(_0x367df4){var _0x1a2671={};_0x1a2671[_0x367df4]={'$like':'%'+_0x2e0f54['query'][_0x9db5('0x42')]+'%'};return _0x1a2671;})});}_0x235adf=_[_0x9db5('0x43')]({},_0x235adf,_0x2e0f54[_0x9db5('0x46')]);return _0x1278f8['getProactiveActions'](_0x235adf);}})[_0x9db5('0x27')](function(_0x1d865a){if(_0x1d865a){_0x46ee89=_0x1d865a[_0x9db5('0x3c')];if(!_0x2e0f54['query']['hasOwnProperty'](_0x9db5('0x58'))){_0x235adf[_0x9db5('0x21')]=qs[_0x9db5('0x21')](_0x2e0f54[_0x9db5('0x37')][_0x9db5('0x21')]);_0x235adf[_0x9db5('0x23')]=qs[_0x9db5('0x23')](_0x2e0f54[_0x9db5('0x37')][_0x9db5('0x23')]);}return _0x1278f8['getProactiveActions'](_0x235adf);}})[_0x9db5('0x27')](function(_0x42c0fa){if(_0x42c0fa){return _0x42c0fa?{'count':_0x46ee89,'rows':_0x42c0fa}:null;}})[_0x9db5('0x27')](respondWithResult(_0x5902f4,null))['catch'](handleError(_0x5902f4,null));};exports[_0x9db5('0x114')]=function(_0x29ebdc,_0x1dbe45){var _0x4d53=_0x29ebdc[_0x9db5('0x37')][_0x9db5('0x115')]===_0x9db5('0x116')?_0x9db5('0x117'):'onlineForm';return db[_0x9db5('0x30')][_0x9db5('0x4a')]({'attributes':['id',_0x4d53],'where':{'id':_0x29ebdc[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x1dbe45,null))[_0x9db5('0x27')](function(_0x4cb61a){if(_0x4cb61a){var _0x532e8f=_0x4cb61a[_0x4d53];var _0x565fbd=_0x532e8f&&_0x532e8f[_0x9db5('0x118')]?_0x532e8f['items']:[];_0x1dbe45['send']({'fromKey':_['isNil'](_0x532e8f[_0x9db5('0x119')])?undefined:_0x532e8f[_0x9db5('0x119')],'count':_0x565fbd[_0x9db5('0x3c')],'rows':_0x565fbd});}})[_0x9db5('0x1b')](handleError(_0x1dbe45,null));};exports[_0x9db5('0x11a')]=function(_0x568856,_0x47bd61){var _0xba5602={'raw':![],'where':{}};var _0x43b46d={};var _0x5a4ef1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9db5('0x5d')]({'where':{'id':_0x568856['params']['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x47bd61,null))[_0x9db5('0x27')](function(_0x2c3ca0){if(_0x2c3ca0){_0x43b46d[_0x9db5('0x34')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x43b46d['query']=_[_0x9db5('0x36')](_0x568856[_0x9db5('0x37')]);_0x43b46d[_0x9db5('0x38')]=_[_0x9db5('0x3a')](_0x43b46d[_0x9db5('0x34')],_0x43b46d[_0x9db5('0x37')]);_0xba5602['attributes']=_[_0x9db5('0x3a')](_0x43b46d[_0x9db5('0x34')],qs[_0x9db5('0x3b')](_0x568856['query'][_0x9db5('0x3b')]));_0xba5602[_0x9db5('0x39')]=_0xba5602[_0x9db5('0x39')][_0x9db5('0x3c')]?_0xba5602[_0x9db5('0x39')]:_0x43b46d[_0x9db5('0x34')];if(!_0x568856['query'][_0x9db5('0x3d')](_0x9db5('0x58'))){_0xba5602[_0x9db5('0x21')]=qs[_0x9db5('0x21')](_0x568856[_0x9db5('0x37')][_0x9db5('0x21')]);_0xba5602[_0x9db5('0x23')]=qs[_0x9db5('0x23')](_0x568856['query'][_0x9db5('0x23')]);}_0xba5602[_0x9db5('0x3e')]=qs[_0x9db5('0x3f')](_0x568856[_0x9db5('0x37')][_0x9db5('0x3f')]);_0xba5602['where']=qs['filters'](_['pick'](_0x568856[_0x9db5('0x37')],_0x43b46d[_0x9db5('0x38')]));_0xba5602['where'][_0x9db5('0x55')]=_0x2c3ca0['id'];if(_0x568856[_0x9db5('0x37')]['filter']){_0xba5602[_0x9db5('0x40')]=_[_0x9db5('0x43')](_0xba5602['where'],{'$or':_[_0x9db5('0x35')](_0xba5602['attributes'],function(_0x5b1b01){var _0x3ac878={};_0x3ac878[_0x5b1b01]={'$like':'%'+_0x568856[_0x9db5('0x37')][_0x9db5('0x42')]+'%'};return _0x3ac878;})});}_0xba5602=_[_0x9db5('0x43')]({},_0xba5602,_0x568856[_0x9db5('0x46')]);return db[_0x9db5('0xca')][_0x9db5('0x22')]({'where':_0xba5602[_0x9db5('0x40')]})[_0x9db5('0x27')](function(_0x3c3c16){_0x5a4ef1[_0x9db5('0x22')]=_0x3c3c16;if(_0x568856[_0x9db5('0x37')][_0x9db5('0x47')]){_0xba5602['include']=[{'all':!![]}];}else{_0xba5602[_0x9db5('0x59')]=[{'model':db[_0x9db5('0x81')],'as':'Contact','required':![]},{'model':db[_0x9db5('0x11b')],'as':_0x9db5('0x11c'),'required':![]}];}return db[_0x9db5('0xca')]['findAll'](_0xba5602);})['then'](function(_0x7ce35b){_0x5a4ef1['rows']=_0x7ce35b;return _0x5a4ef1;});}})[_0x9db5('0x27')](respondWithFilteredResult(_0x47bd61,_0xba5602))[_0x9db5('0x1b')](handleError(_0x47bd61,null));};exports[_0x9db5('0x11d')]=function(_0x50ad0a,_0x32046d){return db[_0x9db5('0x30')][_0x9db5('0x4a')]({'where':{'id':_0x50ad0a[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x32046d,null))['then'](function(_0x370ca2){if(_0x370ca2){return _0x370ca2[_0x9db5('0x11d')](_0x50ad0a[_0x9db5('0x4c')][_0x9db5('0x61')],_['omit'](_0x50ad0a['body'],[_0x9db5('0x61'),'id'])||{})[_0x9db5('0xc5')](function(_0x5e556d){for(var _0x27b27f=0x0;_0x27b27f<_0x50ad0a[_0x9db5('0x4c')][_0x9db5('0x61')]['length'];_0x27b27f+=0x1){socket[_0x9db5('0x11e')](_0x9db5('0x11f'),{'UserId':Number(_0x50ad0a[_0x9db5('0x4c')][_0x9db5('0x61')][_0x27b27f]),'ChatWebsiteId':Number(_0x50ad0a['params']['id'])});}return _0x5e556d;});}})[_0x9db5('0x27')](respondWithResult(_0x32046d,null))[_0x9db5('0x1b')](handleError(_0x32046d,null));};exports['removeAgents']=function(_0x30e461,_0x2aaf54){return db[_0x9db5('0x30')][_0x9db5('0x4a')]({'where':{'id':_0x30e461['params']['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x2aaf54,null))['then'](function(_0x44fbaf){if(_0x44fbaf){return _0x44fbaf[_0x9db5('0x120')](_0x30e461[_0x9db5('0x37')][_0x9db5('0x61')])[_0x9db5('0x27')](function(){if(_[_0x9db5('0x121')](_0x30e461[_0x9db5('0x37')][_0x9db5('0x61')])){for(var _0x3b8a59=0x0;_0x3b8a59<_0x30e461['query'][_0x9db5('0x61')][_0x9db5('0x3c')];_0x3b8a59+=0x1){socket[_0x9db5('0x11e')](_0x9db5('0x122'),{'UserId':Number(_0x30e461[_0x9db5('0x37')]['ids'][_0x3b8a59]),'ChatWebsiteId':Number(_0x30e461['params']['id'])});}}else{socket[_0x9db5('0x11e')]('userChatWebsite:remove',{'UserId':Number(_0x30e461[_0x9db5('0x37')][_0x9db5('0x61')]),'ChatWebsiteId':Number(_0x30e461[_0x9db5('0x49')]['id'])});}});}})[_0x9db5('0x27')](respondWithStatusCode(_0x2aaf54,null))[_0x9db5('0x1b')](handleError(_0x2aaf54,null));};exports[_0x9db5('0x123')]=function(_0x58e081,_0x3892de){var _0x18879b={};var _0x50f544={};var _0x8b6ebb;var _0x19315d;return db[_0x9db5('0x30')][_0x9db5('0x5d')]({'where':{'id':_0x58e081[_0x9db5('0x49')]['id']}})[_0x9db5('0x27')](handleEntityNotFound(_0x3892de,null))[_0x9db5('0x27')](function(_0xfb4519){if(_0xfb4519){_0x8b6ebb=_0xfb4519;_0x50f544[_0x9db5('0x34')]=_[_0x9db5('0x36')](db[_0x9db5('0xb5')]['rawAttributes']);_0x50f544['query']=_[_0x9db5('0x36')](_0x58e081['query']);_0x50f544[_0x9db5('0x38')]=_[_0x9db5('0x3a')](_0x50f544['model'],_0x50f544[_0x9db5('0x37')]);_0x18879b[_0x9db5('0x39')]=_[_0x9db5('0x3a')](_0x50f544['model'],qs['fields'](_0x58e081[_0x9db5('0x37')][_0x9db5('0x3b')]));_0x18879b[_0x9db5('0x39')]=_0x18879b[_0x9db5('0x39')][_0x9db5('0x3c')]?_0x18879b['attributes']:_0x50f544[_0x9db5('0x34')];_0x18879b['order']=qs['sort'](_0x58e081['query'][_0x9db5('0x3f')]);_0x18879b[_0x9db5('0x40')]=qs[_0x9db5('0x38')](_['pick'](_0x58e081[_0x9db5('0x37')],_0x50f544[_0x9db5('0x38')]));if(_0x58e081[_0x9db5('0x37')][_0x9db5('0x42')]){_0x18879b['where']=_[_0x9db5('0x43')](_0x18879b[_0x9db5('0x40')],{'$or':_[_0x9db5('0x35')](_0x18879b['attributes'],function(_0x56105d){var _0xc8fde9={};_0xc8fde9[_0x56105d]={'$like':'%'+_0x58e081[_0x9db5('0x37')][_0x9db5('0x42')]+'%'};return _0xc8fde9;})});}_0x18879b=_[_0x9db5('0x43')]({},_0x18879b,_0x58e081[_0x9db5('0x46')]);return _0x8b6ebb[_0x9db5('0x123')](_0x18879b);}})[_0x9db5('0x27')](function(_0x1a9af6){if(_0x1a9af6){_0x19315d=_0x1a9af6['length'];if(!_0x58e081['query'][_0x9db5('0x3d')](_0x9db5('0x58'))){_0x18879b[_0x9db5('0x21')]=qs['limit'](_0x58e081[_0x9db5('0x37')]['limit']);_0x18879b[_0x9db5('0x23')]=qs[_0x9db5('0x23')](_0x58e081[_0x9db5('0x37')][_0x9db5('0x23')]);}return _0x8b6ebb[_0x9db5('0x123')](_0x18879b);}})['then'](function(_0x1ebdc6){if(_0x1ebdc6){return _0x1ebdc6?{'count':_0x19315d,'rows':_0x1ebdc6}:null;}})['then'](respondWithResult(_0x3892de,null))[_0x9db5('0x1b')](handleError(_0x3892de,null));}; \ No newline at end of file +var _0x0529=['defaults','contact','customerIp','cf-connecting-ip','first','split','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','interaction','spread','firstName','messageId','created','autoclose','push','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','offline','files','CompanyId','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','utf8','render','offlineMessageBody','ChatOfflineMessage','mimetype','server','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','nolimit','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','getLicense','virtual','License','increment','all','some','server/files/chat/iframe.ejs','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','referer','replace','alignment','textColor','color_button','backgroundColor','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','fs-extra','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','set','json','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','ChatWebsite','rows','show','params','Pause','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','ChatWebsiteId','Disposition','findAll','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','custom','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','Applications','List','applications','list','orderBy','priority','asc','account'];(function(_0x22844d,_0x1c7353){var _0x3528d0=function(_0x126dcb){while(--_0x126dcb){_0x22844d['push'](_0x22844d['shift']());}};_0x3528d0(++_0x1c7353);}(_0x0529,0x1bd));var _0x9052=function(_0x3f0a31,_0x593f0a){_0x3f0a31=_0x3f0a31-0x0;var _0x330ca9=_0x0529[_0x3f0a31];return _0x330ca9;};'use strict';var BPromise=require(_0x9052('0x0'));var Mustache=require(_0x9052('0x1'));var util=require(_0x9052('0x2'));var path=require(_0x9052('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9052('0x4'));var _=require('lodash');var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0x9052('0x5'));var logger=require(_0x9052('0x6'))(_0x9052('0x7'));var config=require('../../config/environment');var db=require(_0x9052('0x8'))['db'];config[_0x9052('0x9')]=_['defaults'](config[_0x9052('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9052('0x9')]));require(_0x9052('0xa'))[_0x9052('0xb')](socket);var jayson=require(_0x9052('0xc'));var client=jayson[_0x9052('0xd')][_0x9052('0xe')]({'port':0x232c});var client9002=jayson[_0x9052('0xd')][_0x9052('0xe')]({'port':0x232a});var client9003=jayson[_0x9052('0xd')][_0x9052('0xe')]({'port':0x232b});var client9001=jayson[_0x9052('0xd')][_0x9052('0xe')]({'port':0x2329});function respondWithRpcPromise(_0x484196,_0x37fb40,_0x5b4c01,_0x3b31bc){return new BPromise(function(_0x252b5c,_0x17bfd9){var _0xc7134=_0x3b31bc||client;return _0xc7134[_0x9052('0xf')](_0x484196,_0x5b4c01)[_0x9052('0x10')](function(_0x46e60f){logger[_0x9052('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x37fb40,_0x9052('0x12'));logger[_0x9052('0x13')](_0x9052('0x14'),_0x37fb40,_0x9052('0x12'),JSON[_0x9052('0x15')](_0x46e60f));if(_0x46e60f[_0x9052('0x16')]){if(_0x46e60f[_0x9052('0x16')][_0x9052('0x17')]===0x1f4){logger[_0x9052('0x16')](_0x9052('0x18'),_0x37fb40,_0x46e60f['error'][_0x9052('0x19')]);return _0x17bfd9(_0x46e60f['error'][_0x9052('0x19')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x37fb40,_0x46e60f[_0x9052('0x16')]['message']);return _0x252b5c(_0x46e60f['error'][_0x9052('0x19')]);}else{logger[_0x9052('0x11')](_0x9052('0x18'),_0x37fb40,'request\x20sent');_0x252b5c(_0x46e60f[_0x9052('0x1a')]['message']);}})[_0x9052('0x1b')](function(_0x5f4262){logger['error'](_0x9052('0x18'),_0x37fb40,_0x5f4262);_0x17bfd9(_0x5f4262);});});}function respondWithStatusCode(_0x15d442,_0x1b17f6){_0x1b17f6=_0x1b17f6||0xcc;return function(_0x1f0313){if(_0x1f0313){return _0x15d442['sendStatus'](_0x1b17f6);}return _0x15d442[_0x9052('0x1c')](_0x1b17f6)[_0x9052('0x1d')]();};}function respondWithResult(_0x31e06f,_0x3a6110){_0x3a6110=_0x3a6110||0xc8;return function(_0x856a04){if(_0x856a04){return _0x31e06f[_0x9052('0x1c')](_0x3a6110)['json'](_0x856a04);}};}function respondWithFilteredResult(_0x232efb,_0x6bc510){return function(_0x4a31ba){if(_0x4a31ba){var _0x2cc00d=typeof _0x6bc510[_0x9052('0x1e')]===_0x9052('0x1f')&&typeof _0x6bc510[_0x9052('0x20')]===_0x9052('0x1f');var _0x1482c3=_0x4a31ba[_0x9052('0x21')];var _0x2be53a=_0x2cc00d?0x0:_0x6bc510[_0x9052('0x1e')];var _0x5de84d=_0x2cc00d?_0x4a31ba['count']:_0x6bc510[_0x9052('0x1e')]+_0x6bc510[_0x9052('0x20')];var _0x4fcf5b;if(_0x5de84d>=_0x1482c3){_0x5de84d=_0x1482c3;_0x4fcf5b=0xc8;}else{_0x4fcf5b=0xce;}_0x232efb[_0x9052('0x1c')](_0x4fcf5b);return _0x232efb[_0x9052('0x22')]('Content-Range',_0x2be53a+'-'+_0x5de84d+'/'+_0x1482c3)[_0x9052('0x23')](_0x4a31ba);}return null;};}function saveUpdates(_0x7fb396){return function(_0x4fbb2d){if(_0x4fbb2d){return _0x4fbb2d[_0x9052('0x24')](_0x7fb396)['then'](function(_0x19098f){return _0x19098f;});}return null;};}function removeEntity(_0x3cfe02){return function(_0x3189c3){if(_0x3189c3){return _0x3189c3['destroy']()['then'](function(){var _0x1a988b=_0x3189c3[_0x9052('0x25')]({'plain':!![]});var _0x58c2b4=_0x9052('0x26');return db[_0x9052('0x27')][_0x9052('0x28')]({'where':{'type':_0x58c2b4,'resourceId':_0x1a988b['id']}})['then'](function(){return _0x3189c3;});})[_0x9052('0x10')](function(){_0x3cfe02[_0x9052('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd768){return function(_0x2ed5de){if(!_0x2ed5de){_0x4fd768[_0x9052('0x29')](0x194);}return _0x2ed5de;};}function handleError(_0x20d648,_0x7cedb5){_0x7cedb5=_0x7cedb5||0x1f4;return function(_0x18579d){logger[_0x9052('0x16')](_0x18579d[_0x9052('0x2a')]);if(_0x18579d[_0x9052('0x2b')]){delete _0x18579d['name'];}_0x20d648['status'](_0x7cedb5)[_0x9052('0x2c')](_0x18579d);};}exports[_0x9052('0x2d')]=function(_0x580519,_0x135706){var _0x1b0caf={'include':[{'model':db['Pause'],'as':_0x9052('0x2e')}]},_0x4027ac={},_0x9f40a8={'count':0x0,'rows':[]};var _0x59a18f=_[_0x9052('0x2f')](db['ChatWebsite'][_0x9052('0x30')],function(_0x4dc9be){return{'name':_0x4dc9be[_0x9052('0x31')],'type':_0x4dc9be[_0x9052('0x32')]['key']};});_0x4027ac[_0x9052('0x33')]=_[_0x9052('0x2f')](_0x59a18f,_0x9052('0x2b'));_0x4027ac[_0x9052('0x34')]=_['keys'](_0x580519[_0x9052('0x34')]);_0x4027ac[_0x9052('0x35')]=_[_0x9052('0x36')](_0x4027ac[_0x9052('0x33')],_0x4027ac[_0x9052('0x34')]);_0x1b0caf[_0x9052('0x37')]=_[_0x9052('0x36')](_0x4027ac[_0x9052('0x33')],qs[_0x9052('0x38')](_0x580519['query']['fields']));_0x1b0caf[_0x9052('0x37')]=_0x1b0caf[_0x9052('0x37')][_0x9052('0x39')]?_0x1b0caf[_0x9052('0x37')]:_0x4027ac[_0x9052('0x33')];if(!_0x580519[_0x9052('0x34')][_0x9052('0x3a')]('nolimit')){_0x1b0caf['limit']=qs[_0x9052('0x20')](_0x580519['query']['limit']);_0x1b0caf[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x580519['query'][_0x9052('0x1e')]);}_0x1b0caf[_0x9052('0x3b')]=qs['sort'](_0x580519[_0x9052('0x34')][_0x9052('0x3c')]);_0x1b0caf['where']=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x580519[_0x9052('0x34')],_0x4027ac[_0x9052('0x35')]),_0x59a18f);if(_0x580519[_0x9052('0x34')][_0x9052('0x3e')]){_0x1b0caf[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x1b0caf[_0x9052('0x3f')],{'$or':_[_0x9052('0x2f')](_0x59a18f,function(_0x257868){if(_0x257868[_0x9052('0x32')]!==_0x9052('0x41')){var _0x29e692={};_0x29e692[_0x257868[_0x9052('0x2b')]]={'$like':'%'+_0x580519[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x29e692;}})});}_0x1b0caf=_[_0x9052('0x40')]({},_0x1b0caf,_0x580519[_0x9052('0x42')]);var _0x4a6b56={'where':_0x1b0caf[_0x9052('0x3f')]};return db['ChatWebsite']['count'](_0x4a6b56)[_0x9052('0x10')](function(_0x27abe5){_0x9f40a8[_0x9052('0x21')]=_0x27abe5;if(_0x580519[_0x9052('0x34')][_0x9052('0x43')]){_0x1b0caf[_0x9052('0x44')]=[{'all':!![]}];}return db[_0x9052('0x45')]['findAll'](_0x1b0caf);})['then'](function(_0x4fd7f4){_0x9f40a8[_0x9052('0x46')]=_0x4fd7f4;return _0x9f40a8;})['then'](respondWithFilteredResult(_0x135706,_0x1b0caf))[_0x9052('0x1b')](handleError(_0x135706,null));};exports[_0x9052('0x47')]=function(_0x1ae15e,_0xb6c929){var _0xe5bae1={'raw':![],'where':{'id':_0x1ae15e[_0x9052('0x48')]['id']},'include':[{'model':db[_0x9052('0x49')],'as':_0x9052('0x2e')}]},_0xd30c17={};_0xd30c17[_0x9052('0x33')]=_[_0x9052('0x4a')](db[_0x9052('0x45')][_0x9052('0x30')]);_0xd30c17[_0x9052('0x34')]=_[_0x9052('0x4a')](_0x1ae15e[_0x9052('0x34')]);_0xd30c17['filters']=_[_0x9052('0x36')](_0xd30c17[_0x9052('0x33')],_0xd30c17[_0x9052('0x34')]);_0xe5bae1['attributes']=_[_0x9052('0x36')](_0xd30c17[_0x9052('0x33')],qs['fields'](_0x1ae15e['query'][_0x9052('0x38')]));_0xe5bae1[_0x9052('0x37')]=_0xe5bae1['attributes']['length']?_0xe5bae1[_0x9052('0x37')]:_0xd30c17['model'];if(_0x1ae15e['query']['includeAll']){_0xe5bae1[_0x9052('0x44')]=[{'all':!![]}];}_0xe5bae1=_[_0x9052('0x40')]({},_0xe5bae1,_0x1ae15e[_0x9052('0x42')]);return db[_0x9052('0x45')][_0x9052('0x4b')](_0xe5bae1)[_0x9052('0x10')](handleEntityNotFound(_0xb6c929,null))[_0x9052('0x10')](respondWithResult(_0xb6c929,null))[_0x9052('0x1b')](handleError(_0xb6c929,null));};exports['create']=function(_0x4267b1,_0x41c86e){return db[_0x9052('0x45')][_0x9052('0x4c')](_0x4267b1['body'],{})[_0x9052('0x10')](function(_0x21baef){var _0x1abe59=_0x4267b1[_0x9052('0x4d')][_0x9052('0x25')]({'plain':!![]});if(!_0x1abe59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1abe59['role']===_0x9052('0x4d')){var _0x41d480=_0x21baef[_0x9052('0x25')]({'plain':!![]});var _0x1e3f09='ChatWebsites';return db[_0x9052('0x4e')][_0x9052('0x4b')]({'where':{'name':_0x1e3f09,'userProfileId':_0x1abe59[_0x9052('0x4f')]},'raw':!![]})[_0x9052('0x10')](function(_0x169484){if(_0x169484&&_0x169484[_0x9052('0x50')]===0x0){return db[_0x9052('0x27')][_0x9052('0x4c')]({'name':_0x41d480[_0x9052('0x2b')],'resourceId':_0x41d480['id'],'type':_0x169484['name'],'sectionId':_0x169484['id']},{})[_0x9052('0x10')](function(){return _0x21baef;});}else{return _0x21baef;}})['catch'](function(_0x447b85){logger[_0x9052('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x447b85);throw _0x447b85;});}return _0x21baef;})[_0x9052('0x10')](respondWithResult(_0x41c86e,0xc9))[_0x9052('0x1b')](handleError(_0x41c86e,null));};exports['update']=function(_0x5bc591,_0x581978){if(_0x5bc591[_0x9052('0x51')]['id']){delete _0x5bc591['body']['id'];}return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x5bc591[_0x9052('0x48')]['id']},'include':[{'model':db[_0x9052('0x49')],'as':_0x9052('0x2e')}]})[_0x9052('0x10')](handleEntityNotFound(_0x581978,null))['then'](saveUpdates(_0x5bc591['body'],null))[_0x9052('0x10')](respondWithResult(_0x581978,null))[_0x9052('0x1b')](handleError(_0x581978,null));};exports['destroy']=function(_0x5821cf,_0x2c3550){return db[_0x9052('0x45')]['find']({'where':{'id':_0x5821cf[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x2c3550,null))[_0x9052('0x10')](removeEntity(_0x2c3550,null))[_0x9052('0x1b')](handleError(_0x2c3550,null));};exports[_0x9052('0x52')]=function(_0x53fc6f,_0x4841c6){return db[_0x9052('0x45')][_0x9052('0x52')]()['then'](respondWithResult(_0x4841c6,null))['catch'](handleError(_0x4841c6,null));};exports[_0x9052('0x53')]=function(_0x4ddea0,_0xa557bf){if(_0x4ddea0[_0x9052('0x51')]['id']){delete _0x4ddea0[_0x9052('0x51')]['id'];}return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x4ddea0[_0x9052('0x48')]['id']}})['then'](handleEntityNotFound(_0xa557bf,null))['then'](function(_0x2b88df){if(_0x2b88df){_0x4ddea0[_0x9052('0x51')][_0x9052('0x54')]=_0x2b88df['id'];return db[_0x9052('0x55')][_0x9052('0x4c')](_0x4ddea0[_0x9052('0x51')]);}})[_0x9052('0x10')](respondWithResult(_0xa557bf,null))[_0x9052('0x1b')](handleError(_0xa557bf,null));};exports['getDispositions']=function(_0xa87d46,_0x525254){var _0x14e327={'raw':![],'where':{}};var _0x2389bd={};var _0x35ae68={'count':0x0,'rows':[]};return db[_0x9052('0x45')]['findOne']({'where':{'id':_0xa87d46[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x525254,null))['then'](function(_0x4bd0f9){if(_0x4bd0f9){_0x2389bd['model']=_[_0x9052('0x4a')](db[_0x9052('0x55')][_0x9052('0x30')]);_0x2389bd[_0x9052('0x34')]=_[_0x9052('0x4a')](_0xa87d46[_0x9052('0x34')]);_0x2389bd[_0x9052('0x35')]=_[_0x9052('0x36')](_0x2389bd[_0x9052('0x33')],_0x2389bd[_0x9052('0x34')]);_0x14e327[_0x9052('0x37')]=_[_0x9052('0x36')](_0x2389bd[_0x9052('0x33')],qs['fields'](_0xa87d46['query'][_0x9052('0x38')]));_0x14e327[_0x9052('0x37')]=_0x14e327['attributes']['length']?_0x14e327[_0x9052('0x37')]:_0x2389bd[_0x9052('0x33')];if(!_0xa87d46[_0x9052('0x34')][_0x9052('0x3a')]('nolimit')){_0x14e327[_0x9052('0x20')]=qs[_0x9052('0x20')](_0xa87d46['query'][_0x9052('0x20')]);_0x14e327[_0x9052('0x1e')]=qs['offset'](_0xa87d46['query'][_0x9052('0x1e')]);}_0x14e327[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0xa87d46['query']['sort']);_0x14e327[_0x9052('0x3f')]=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0xa87d46['query'],_0x2389bd[_0x9052('0x35')]));_0x14e327[_0x9052('0x3f')][_0x9052('0x54')]=_0x4bd0f9['id'];if(_0xa87d46['query'][_0x9052('0x3e')]){_0x14e327[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x14e327['where'],{'$or':_[_0x9052('0x2f')](_0x14e327['attributes'],function(_0x17e50a){var _0x5b2491={};_0x5b2491[_0x17e50a]={'$like':'%'+_0xa87d46[_0x9052('0x34')]['filter']+'%'};return _0x5b2491;})});}_0x14e327=_['merge']({},_0x14e327,_0xa87d46[_0x9052('0x42')]);return db['Disposition'][_0x9052('0x21')]({'where':_0x14e327[_0x9052('0x3f')]})[_0x9052('0x10')](function(_0x37afb5){_0x35ae68[_0x9052('0x21')]=_0x37afb5;if(_0xa87d46[_0x9052('0x34')][_0x9052('0x43')]){_0x14e327[_0x9052('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x9052('0x56')](_0x14e327);})[_0x9052('0x10')](function(_0x1a2018){_0x35ae68['rows']=_0x1a2018;return _0x35ae68;});}})[_0x9052('0x10')](respondWithFilteredResult(_0x525254,_0x14e327))[_0x9052('0x1b')](handleError(_0x525254,null));};exports['removeDispositions']=function(_0xebc64f,_0x33c694){return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0xebc64f['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x33c694,null))['then'](function(_0x33bee1){if(_0x33bee1){return _0x33bee1[_0x9052('0x57')](_0xebc64f[_0x9052('0x34')][_0x9052('0x58')]);}})['then'](respondWithStatusCode(_0x33c694,null))[_0x9052('0x1b')](handleError(_0x33c694,null));};exports[_0x9052('0x59')]=function(_0x4fddda,_0x28b9f3){if(_0x4fddda[_0x9052('0x51')]['id']){delete _0x4fddda[_0x9052('0x51')]['id'];}return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x4fddda['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x28b9f3,null))['then'](function(_0xa213a0){if(_0xa213a0){_0x4fddda[_0x9052('0x51')][_0x9052('0x54')]=_0xa213a0['id'];return db['CannedAnswer'][_0x9052('0x4c')](_0x4fddda['body']);}})[_0x9052('0x10')](respondWithResult(_0x28b9f3,null))['catch'](handleError(_0x28b9f3,null));};exports[_0x9052('0x5a')]=function(_0x537e5d,_0x31607d){var _0x5e801e={'raw':![],'where':{}};var _0x58c840={};var _0x1ed90f={'count':0x0,'rows':[]};return db[_0x9052('0x45')][_0x9052('0x5b')]({'where':{'id':_0x537e5d['params']['id']}})['then'](handleEntityNotFound(_0x31607d,null))[_0x9052('0x10')](function(_0x32c8ae){if(_0x32c8ae){_0x58c840[_0x9052('0x33')]=_[_0x9052('0x4a')](db[_0x9052('0x5c')][_0x9052('0x30')]);_0x58c840[_0x9052('0x34')]=_[_0x9052('0x4a')](_0x537e5d[_0x9052('0x34')]);_0x58c840['filters']=_['intersection'](_0x58c840[_0x9052('0x33')],_0x58c840['query']);_0x5e801e[_0x9052('0x37')]=_[_0x9052('0x36')](_0x58c840[_0x9052('0x33')],qs[_0x9052('0x38')](_0x537e5d[_0x9052('0x34')]['fields']));_0x5e801e[_0x9052('0x37')]=_0x5e801e[_0x9052('0x37')][_0x9052('0x39')]?_0x5e801e[_0x9052('0x37')]:_0x58c840['model'];if(!_0x537e5d[_0x9052('0x34')][_0x9052('0x3a')]('nolimit')){_0x5e801e[_0x9052('0x20')]=qs['limit'](_0x537e5d[_0x9052('0x34')][_0x9052('0x20')]);_0x5e801e[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x537e5d[_0x9052('0x34')][_0x9052('0x1e')]);}_0x5e801e[_0x9052('0x3b')]=qs['sort'](_0x537e5d['query'][_0x9052('0x3c')]);_0x5e801e[_0x9052('0x3f')]=qs['filters'](_[_0x9052('0x3d')](_0x537e5d['query'],_0x58c840[_0x9052('0x35')]));_0x5e801e[_0x9052('0x3f')][_0x9052('0x54')]=_0x32c8ae['id'];if(_0x537e5d[_0x9052('0x34')][_0x9052('0x3e')]){_0x5e801e[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x5e801e[_0x9052('0x3f')],{'$or':_[_0x9052('0x2f')](_0x5e801e['attributes'],function(_0x231ab5){var _0x198ee1={};_0x198ee1[_0x231ab5]={'$like':'%'+_0x537e5d[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x198ee1;})});}_0x5e801e=_[_0x9052('0x40')]({},_0x5e801e,_0x537e5d[_0x9052('0x42')]);return db[_0x9052('0x5c')][_0x9052('0x21')]({'where':_0x5e801e[_0x9052('0x3f')]})['then'](function(_0x2d21fa){_0x1ed90f[_0x9052('0x21')]=_0x2d21fa;if(_0x537e5d[_0x9052('0x34')][_0x9052('0x43')]){_0x5e801e[_0x9052('0x44')]=[{'all':!![]}];}return db[_0x9052('0x5c')]['findAll'](_0x5e801e);})[_0x9052('0x10')](function(_0x20ef26){_0x1ed90f['rows']=_0x20ef26;return _0x1ed90f;});}})['then'](respondWithFilteredResult(_0x31607d,_0x5e801e))[_0x9052('0x1b')](handleError(_0x31607d,null));};exports[_0x9052('0x5d')]=function(_0x2084bc,_0x3ffb00){return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x2084bc['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x3ffb00,null))[_0x9052('0x10')](function(_0x18412d){if(_0x18412d){return _0x18412d[_0x9052('0x5d')](_0x2084bc[_0x9052('0x34')][_0x9052('0x58')]);}})[_0x9052('0x10')](respondWithStatusCode(_0x3ffb00,null))[_0x9052('0x1b')](handleError(_0x3ffb00,null));};exports[_0x9052('0x5e')]=function(_0x1f0d20,_0x1ae958){_0x1f0d20[_0x9052('0x51')][_0x9052('0x5f')]=_0x1f0d20[_0x9052('0x60')][_0x9052('0x61')];return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x1f0d20[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x1ae958,null))[_0x9052('0x10')](saveUpdates(_0x1f0d20[_0x9052('0x51')],null))[_0x9052('0x10')](respondWithResult(_0x1ae958,null))[_0x9052('0x1b')](handleError(_0x1ae958,null));};exports['addAvatar']=function(_0x3d09ad,_0x47a360){_0x3d09ad[_0x9052('0x51')]['agentAvatar']=_0x3d09ad['file'][_0x9052('0x61')];return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x3d09ad[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x47a360,null))['then'](saveUpdates(_0x3d09ad[_0x9052('0x51')],null))[_0x9052('0x10')](respondWithResult(_0x47a360,null))[_0x9052('0x1b')](handleError(_0x47a360,null));};exports['addCustomerAvatar']=function(_0x2288e2,_0x2f418d){_0x2288e2[_0x9052('0x51')][_0x9052('0x62')]=_0x2288e2['file'][_0x9052('0x61')];return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x2288e2[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x2f418d,null))[_0x9052('0x10')](saveUpdates(_0x2288e2['body'],null))[_0x9052('0x10')](respondWithResult(_0x2f418d,null))[_0x9052('0x1b')](handleError(_0x2f418d,null));};exports[_0x9052('0x63')]=function(_0x2cec6e,_0x4fb222){_0x2cec6e['body'][_0x9052('0x64')]=_0x2cec6e['file']['filename'];return db[_0x9052('0x45')]['find']({'where':{'id':_0x2cec6e[_0x9052('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fb222,null))['then'](saveUpdates(_0x2cec6e['body'],null))[_0x9052('0x10')](respondWithResult(_0x4fb222,null))[_0x9052('0x1b')](handleError(_0x4fb222,null));};exports[_0x9052('0x65')]=function(_0x3d61ea,_0x39c876){var _0x463b5e=path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x68'));var _0xba6b4b={'where':{'id':_0x3d61ea['params']['id']},'attributes':['id',_0x9052('0x5f')],'raw':!![]};var _0x842868=![];return require('../../config/license/util')['getLicense']()[_0x9052('0x10')](function(_0x20f70a){if(_0x20f70a){_0x842868=_0x20f70a[_0x9052('0x69')];}})[_0x9052('0x10')](function(){return db[_0x9052('0x45')][_0x9052('0x4b')](_0xba6b4b);})[_0x9052('0x10')](handleEntityNotFound(_0x39c876,null))[_0x9052('0x10')](function(_0xf31a29){if(_0xf31a29){if(!_['isNil'](_0xf31a29[_0x9052('0x5f')])){if(fs['existsSync'](path[_0x9052('0x66')](config['root'],_0x9052('0x6a'),_0xf31a29['sitepic']))&&_0x842868){_0x463b5e=path['join'](config[_0x9052('0x67')],_0x9052('0x6a'),_0xf31a29[_0x9052('0x5f')]);}}return _0x39c876[_0x9052('0x6b')](_0x463b5e);}})['catch'](handleError(_0x39c876,null));};exports[_0x9052('0x6c')]=function(_0xa50056,_0x412466){var _0x96f7ec=path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x6d'));var _0xc6f83e={'where':{'id':_0xa50056[_0x9052('0x48')]['id']},'attributes':['id',_0x9052('0x6e')],'raw':!![]};return db['ChatWebsite'][_0x9052('0x4b')](_0xc6f83e)['then'](handleEntityNotFound(_0x412466,null))[_0x9052('0x10')](function(_0x2a6509){if(_0x2a6509){if(!_[_0x9052('0x6f')](_0x2a6509[_0x9052('0x6e')])){if(fs[_0x9052('0x70')](path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x71'),_0x2a6509[_0x9052('0x6e')]))){_0x96f7ec=path[_0x9052('0x66')](config['root'],_0x9052('0x71'),_0x2a6509['agentAvatar']);}}return _0x412466[_0x9052('0x6b')](_0x96f7ec);}})[_0x9052('0x1b')](handleError(_0x412466,null));};exports[_0x9052('0x72')]=function(_0x753760,_0x28b045){var _0xebed41=path[_0x9052('0x66')](config['root'],_0x9052('0x73'));var _0x54411b={'where':{'id':_0x753760[_0x9052('0x48')]['id']},'attributes':['id','customerAvatar',_0x9052('0x74')],'raw':!![]};return db[_0x9052('0x45')][_0x9052('0x4b')](_0x54411b)['then'](handleEntityNotFound(_0x28b045,null))[_0x9052('0x10')](function(_0x2e990e){if(_0x2e990e){if(!_[_0x9052('0x6f')](_0x2e990e[_0x9052('0x62')])){if(fs['existsSync'](path[_0x9052('0x66')](config['root'],_0x9052('0x71'),_0x2e990e[_0x9052('0x62')]))&&_0x2e990e[_0x9052('0x74')]){_0xebed41=path[_0x9052('0x66')](config['root'],_0x9052('0x71'),_0x2e990e[_0x9052('0x62')]);}}return _0x28b045[_0x9052('0x6b')](_0xebed41);}})[_0x9052('0x1b')](handleError(_0x28b045,null));};exports[_0x9052('0x75')]=function(_0x1482b8,_0x56a431){var _0x363dcc=path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x76'));var _0x3bd7ed={'where':{'id':_0x1482b8[_0x9052('0x48')]['id']},'attributes':['id',_0x9052('0x64')],'raw':!![]};return db[_0x9052('0x45')][_0x9052('0x4b')](_0x3bd7ed)[_0x9052('0x10')](handleEntityNotFound(_0x56a431,null))[_0x9052('0x10')](function(_0x297047){if(_0x297047){if(!_[_0x9052('0x6f')](_0x297047[_0x9052('0x64')])){if(fs[_0x9052('0x70')](path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x71'),_0x297047['systemAvatar']))){_0x363dcc=path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x71'),_0x297047[_0x9052('0x64')]);}}return _0x56a431[_0x9052('0x6b')](_0x363dcc);}})[_0x9052('0x1b')](handleError(_0x56a431,null));};exports[_0x9052('0x77')]=function(_0x3b5718,_0x76e119){var _0x215dd5=require('user-agent-parser');var _0x4c3d03=new _0x215dd5();var _0x32af25=_0x4c3d03[_0x9052('0x78')](_0x3b5718[_0x9052('0x79')][_0x9052('0x7a')])[_0x9052('0x7b')]();var _0x32e3dd={'body':_0x3b5718[_0x9052('0x51')],'channel':'chat'};var _0x36b5e2=[];var _0x312949=[];var _0x668951={};var _0x444228=![];return db[_0x9052('0x7c')][_0x9052('0x52')]()[_0x9052('0x10')](function(_0x427dc4){if(!_0x427dc4){throw new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))](_0x9052('0x7f'));}_0x36b5e2=_[_0x9052('0x80')](_[_0x9052('0x4a')](_0x427dc4),[_0x9052('0x81'),_0x9052('0x82')]);_0x312949=_[_0x9052('0x80')](_[_0x9052('0x4a')](_0x427dc4),['createdAt','updatedAt','CompanyId',_0x9052('0x83')]);if(_0x3b5718[_0x9052('0x51')]['id']){delete _0x3b5718[_0x9052('0x51')]['id'];}if(_[_0x9052('0x6f')](_0x3b5718[_0x9052('0x51')][_0x9052('0x84')])){throw new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))](_0x9052('0x85'));}if(_[_0x9052('0x6f')](_0x3b5718[_0x9052('0x51')][_0x9052('0x51')])||_0x3b5718[_0x9052('0x51')][_0x9052('0x51')]===''){throw new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))](_0x9052('0x86'));}if(_[_0x9052('0x6f')](_0x3b5718['body']['mapKey'])){throw new db['Sequelize'][(_0x9052('0x7e'))](_0x9052('0x87')+_0x312949);}if(!_[_0x9052('0x88')](_0x312949,_0x3b5718[_0x9052('0x51')][_0x9052('0x89')])){throw new db['Sequelize'][(_0x9052('0x7e'))](_0x9052('0x8a')+_0x312949);}_0x668951[_0x3b5718[_0x9052('0x51')][_0x9052('0x89')]]=_0x3b5718[_0x9052('0x51')][_0x9052('0x84')];})['then'](function(){return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x3b5718[_0x9052('0x48')]['id']},'include':[{'model':db[_0x9052('0x8b')],'as':'List','include':[{'model':db['CmContact'],'as':_0x9052('0x8c'),'where':_0x668951,'limit':0x1,'order':[[_0x9052('0x82'),_0x9052('0x8d')]]}]},{'model':db[_0x9052('0x8e')],'as':_0x9052('0x8f')}]});})[_0x9052('0x10')](handleEntityNotFound(_0x76e119,null))['then'](function(_0x2a27a9){if(_0x2a27a9&&_0x2a27a9[_0x9052('0x90')]){_0x32e3dd['account']=_0x2a27a9;_0x32e3dd[_0x9052('0x91')]=_0x2a27a9[_0x9052('0x8f')];_0x32e3dd[_0x9052('0x92')]=_0x2a27a9[_0x9052('0x90')];_0x32e3dd['applications']=_[_0x9052('0x93')](_0x32e3dd[_0x9052('0x91')],[_0x9052('0x94')],[_0x9052('0x95')]);if(_0x32e3dd[_0x9052('0x96')][_0x9052('0x8f')]){delete _0x32e3dd['account'][_0x9052('0x8f')];}if(_0x32e3dd[_0x9052('0x96')][_0x9052('0x90')]&&_0x32e3dd[_0x9052('0x96')][_0x9052('0x90')][_0x9052('0x8c')][_0x9052('0x39')]){return _0x32e3dd[_0x9052('0x96')][_0x9052('0x90')]['Contacts'][0x0];}var _0xe210a0=_[_0x9052('0x97')](_0x3b5718['body'],{'firstName':_0x3b5718[_0x9052('0x51')][_0x9052('0x84')],'ListId':_0x2a27a9[_0x9052('0x83')]});_0xe210a0[_0x3b5718[_0x9052('0x51')][_0x9052('0x89')]]=_0x3b5718[_0x9052('0x51')]['from'];return db[_0x9052('0x7c')]['create'](_0xe210a0,{'fields':_0x36b5e2,'raw':!![]});}})[_0x9052('0x10')](handleEntityNotFound(_0x76e119,null))[_0x9052('0x10')](function(_0xf3f697){_0x32e3dd[_0x9052('0x98')]=_0xf3f697;var _0x518450=_0x3b5718[_0x9052('0x51')][_0x9052('0x99')];if(_0x3b5718[_0x9052('0x79')][_0x9052('0x9a')]){_0x518450=_0x3b5718[_0x9052('0x79')][_0x9052('0x9a')];}else if(_0x3b5718[_0x9052('0x79')]['x-forwarded-for']){_0x518450=_[_0x9052('0x9b')](_0x3b5718[_0x9052('0x79')]['x-forwarded-for'][_0x9052('0x9c')](','));}if(_0xf3f697){var _0x3e8af5={'ContactId':_0xf3f697['id'],'ChatWebsiteId':_0x3b5718[_0x9052('0x48')]['id'],'from':(_0xf3f697['firstName']||'')+'\x20'+(_0xf3f697[_0x9052('0x9d')]||''),'customerIp':_0x518450,'customerPort':_0x3b5718[_0x9052('0x79')][_0x9052('0x9e')]?_0x3b5718[_0x9052('0x79')][_0x9052('0x9e')]:null,'referer':_0x3b5718[_0x9052('0x51')]['referer'],'browserName':_0x32af25[_0x9052('0x9f')][_0x9052('0x2b')]&&_0x32af25[_0x9052('0x9f')]['version']?util[_0x9052('0xa0')](_0x9052('0xa1'),_0x32af25['browser'][_0x9052('0x2b')],_0x32af25[_0x9052('0x9f')][_0x9052('0xa2')]):_0x9052('0xa3'),'browserVersion':_0x32af25['browser'][_0x9052('0xa2')]||_0x9052('0xa3'),'osName':util['format'](_0x9052('0xa1'),_0x32af25['os']['name'],_0x32af25['os']['version']),'osVersion':_0x32af25['os'][_0x9052('0xa2')],'deviceModel':_0x32af25[_0x9052('0xa4')]['model']&&_0x32af25['device'][_0x9052('0xa5')]?util['format'](_0x9052('0xa6'),_0x32af25[_0x9052('0xa4')][_0x9052('0x33')],_0x32af25[_0x9052('0xa4')][_0x9052('0xa5')],_0x32af25[_0x9052('0xa4')]['type']):null,'deviceVendor':_0x32af25['device'][_0x9052('0xa5')],'deviceType':_0x32af25['device']['type'],'formData':JSON[_0x9052('0x15')](_0x3b5718[_0x9052('0x51')])};var _0x38de54={'ChatWebsiteId':_0x3b5718['params']['id'],'closed':![]};if(_0x3b5718[_0x9052('0x51')][_0x9052('0xa7')]){_0x38de54['threadId']=_0x3b5718[_0x9052('0x51')][_0x9052('0xa7')];return db['ChatInteraction'][_0x9052('0x4b')]({'where':_0x38de54})['then'](function(_0x360b94){if(_0x360b94){return[_0x360b94,![]];}_0x3e8af5[_0x9052('0xa7')]=_0x3b5718[_0x9052('0x51')][_0x9052('0xa7')];_0x3e8af5['externalUrl']=_0x3b5718[_0x9052('0x51')][_0x9052('0xa8')];return db[_0x9052('0xa9')][_0x9052('0x4c')](_0x3e8af5)['then'](function(_0x3ba578){return[_0x3ba578,!![]];});});}_0x38de54['ContactId']=_0xf3f697['id'];if(_0x3b5718[_0x9052('0x51')][_0x9052('0xaa')]&&_0x3b5718[_0x9052('0x51')][_0x9052('0xaa')]['id']){_0x38de54['id']=_0x3b5718[_0x9052('0x51')][_0x9052('0xaa')]['id'];return db[_0x9052('0xa9')][_0x9052('0x4b')]({'where':_0x38de54})[_0x9052('0x10')](function(_0xddfdd){if(_0xddfdd){return[_0xddfdd,![]];}return db[_0x9052('0xa9')][_0x9052('0x4c')](_0x3e8af5)[_0x9052('0x10')](function(_0x13bcc8){return[_0x13bcc8,!![]];});});}return db[_0x9052('0xa9')][_0x9052('0x4c')](_0x3e8af5)[_0x9052('0x10')](function(_0x282354){return[_0x282354,!![]];});}})[_0x9052('0xab')](function(_0x5ae82c,_0x4a0a76){if(_0x5ae82c){_0x444228=_0x4a0a76;if(!_0x4a0a76){var _0x398893={'from':(_0x32e3dd[_0x9052('0x98')][_0x9052('0xac')]||'')+'\x20'+(_0x32e3dd[_0x9052('0x98')][_0x9052('0x9d')]||'')};if(_0x3b5718[_0x9052('0x51')]['threadId']&&_0x3b5718[_0x9052('0x51')][_0x9052('0xad')]&&_0x3b5718['body'][_0x9052('0xa7')]!=_0x3b5718['body'][_0x9052('0xad')]){_0x398893[_0x9052('0xa7')]=_0x3b5718['body'][_0x9052('0xad')];}return _0x5ae82c[_0x9052('0x24')](_0x398893);}else{return _0x5ae82c;}}})['then'](function(_0x1f847d){_0x32e3dd[_0x9052('0xaa')]=_0x1f847d[_0x9052('0x25')]({'plain':!![]});_0x32e3dd['interaction']['created']=_0x444228;if(_0x32e3dd['interaction'][_0x9052('0xae')]){if(_0x32e3dd[_0x9052('0x96')][_0x9052('0xaf')]){_0x32e3dd['applications'][_0x9052('0xb0')]({'id':0x0,'priority':_0x32e3dd[_0x9052('0x91')][_0x9052('0x39')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x9052('0xb1')][_0x9052('0x4c')]({'body':_0x3b5718[_0x9052('0x51')][_0x9052('0x51')],'ChatWebsiteId':_0x3b5718[_0x9052('0x48')]['id'],'ChatInteractionId':_0x1f847d['id'],'direction':'in','ContactId':_0x32e3dd[_0x9052('0x98')]['id'],'AttachmentId':_0x3b5718[_0x9052('0x51')][_0x9052('0xb2')]});})[_0x9052('0x10')](function(_0x5cb116){_0x32e3dd[_0x9052('0x19')]=_0x5cb116;if(_0x32e3dd['interaction'][_0x9052('0xb3')]){return db[_0x9052('0xb4')][_0x9052('0x4b')]({'attributes':['id',_0x9052('0x2b')],'where':{'id':_0x32e3dd[_0x9052('0xaa')]['UserId']}})['then'](function(_0x4f0e99){if(_0x4f0e99){_0x32e3dd['applications'][_0x9052('0xb5')]({'id':0x0,'priority':0x0,'app':_0x9052('0xb6'),'appdata':_0x4f0e99[_0x9052('0x2b')]+','+(_0x32e3dd['account'][_0x9052('0xb7')]||0xa),'interval':_0x9052('0xb8')});_0x32e3dd[_0x9052('0xb9')]=!![];}return respondWithRpcPromise(_0x9052('0xba'),'startRouting',_0x32e3dd);});}return respondWithRpcPromise('Start','startRouting',_0x32e3dd);})[_0x9052('0x10')](function(_0x629e91){respondWithRpcPromise('EventManager','EventManager',{'event':_0x9052('0x77'),'message':_0x629e91},client9002);return _0x629e91;})[_0x9052('0x10')](respondWithResult(_0x76e119,null))['catch'](handleError(_0x76e119,null));};exports[_0x9052('0xbb')]=function(_0x336ce4,_0x154ebb){var _0x379462,_0x4263c1,_0x5290a0;var _0x3a134=[];var _0x3b187e={};var _0x262867=_0x336ce4[_0x9052('0xbc')]||[];var _0x6ded2b=[];var _0x1c4d8e;return db[_0x9052('0x7c')][_0x9052('0x52')]()[_0x9052('0x10')](function(_0x51bd13){if(!_0x51bd13){throw new db[(_0x9052('0x7d'))]['ValidationError']('no\x20available\x20attributes');}_0x3a134=_['difference'](_[_0x9052('0x4a')](_0x51bd13),['createdAt',_0x9052('0x82'),_0x9052('0xbd'),_0x9052('0x83')]);if(_0x336ce4['body']['id']){delete _0x336ce4[_0x9052('0x51')]['id'];}if(_[_0x9052('0x6f')](_0x336ce4[_0x9052('0x51')][_0x9052('0x84')])){throw _0x154ebb['status'](0x1f4)[_0x9052('0x2c')](new db[(_0x9052('0x7d'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x9052('0x6f')](_0x336ce4[_0x9052('0x51')]['body'])||_0x336ce4[_0x9052('0x51')][_0x9052('0x51')]===''){throw _0x154ebb[_0x9052('0x1c')](0x1f4)['send'](new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))](_0x9052('0x86')));}if(_['isNil'](_0x336ce4[_0x9052('0x51')][_0x9052('0xbe')])){throw _0x154ebb['status'](0x1f4)[_0x9052('0x2c')](new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a134));}if(!_[_0x9052('0x88')](_0x3a134,_0x336ce4[_0x9052('0x51')][_0x9052('0xbe')])){throw _0x154ebb['status'](0x1f4)[_0x9052('0x2c')](new db[(_0x9052('0x7d'))]['ValidationError'](_0x9052('0xbf')+_0x3a134));}_0x3b187e[_0x336ce4[_0x9052('0x51')]['mapKeyOffline']]=_0x336ce4['body'][_0x9052('0x84')];})[_0x9052('0x10')](function(){return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x336ce4[_0x9052('0x48')]['id']},'include':[{'model':db[_0x9052('0x8b')],'as':_0x9052('0x90')},{'model':db['MailAccount'],'as':_0x9052('0xc0')}]});})[_0x9052('0x10')](handleEntityNotFound(_0x154ebb,null))[_0x9052('0x10')](function(_0x312894){if(_0x312894&&_0x312894[_0x9052('0x90')]){_0x4263c1=_0x312894;var _0x2bd8e1=_[_0x9052('0x97')](_0x336ce4[_0x9052('0x51')],{'firstName':_0x336ce4[_0x9052('0x51')][_0x9052('0x84')],'phone':_0x336ce4[_0x9052('0x51')][_0x9052('0x84')],'ListId':_0x312894[_0x9052('0x83')]});_0x2bd8e1[_0x336ce4[_0x9052('0x51')][_0x9052('0xbe')]]=_0x336ce4[_0x9052('0x51')]['from'];return db[_0x9052('0x7c')][_0x9052('0xc1')]({'where':_0x3b187e,'defaults':_0x2bd8e1});}})[_0x9052('0xab')](function(_0x11e6a7){if(_0x11e6a7){_0x5290a0=_0x11e6a7;var _0x1279c8=fs['readFileSync'](path[_0x9052('0x66')](config[_0x9052('0x67')],'server/files/templates/chatOfflineMessage.ejs'),_0x9052('0xc2'));var _0x47cbc6=ejs[_0x9052('0xc3')](_0x1279c8,{'body':_['toPairs'](_0x336ce4[_0x9052('0x51')][_0x9052('0x51')]),'bodyTitle':_0x4263c1[_0x9052('0xc4')]});return db[_0x9052('0xc5')][_0x9052('0x4c')]({'body':_0x47cbc6,'ContactId':_0x11e6a7['id'],'ChatWebsiteId':_0x4263c1['id']});}})[_0x9052('0x10')](function(_0x2ed39f){_0x1c4d8e=_0x2ed39f;if(_0x262867[_0x9052('0x39')]){var _0x416ab5=_0x262867[_0x9052('0x2f')](function(_0x251bfb){return{'name':_0x251bfb['originalname'],'basename':_0x251bfb[_0x9052('0x61')],'type':_0x251bfb[_0x9052('0xc6')],'ChatOfflineMessageId':_0x2ed39f['id']};});_0x6ded2b=_0x416ab5[_0x9052('0x2f')](_0x247073=>{var _0x2d50c9={'filename':_0x247073[_0x9052('0x2b')],'path':path['join'](config['root'],_0x9052('0xc7'),'files','attachments',_0x9052('0xc8'),_0x247073[_0x9052('0xc9')])};return _0x2d50c9;});if(!_0x4263c1[_0x9052('0xca')]){return db['sequelize']['transaction'](function(_0x311efb){return db[_0x9052('0xcb')][_0x9052('0xcc')](_0x416ab5,{'transaction':_0x311efb});});}}})['then'](function(){if(_0x1c4d8e){_0x379462=_0x1c4d8e;return db['MailAccount'][_0x9052('0x5b')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0x9052('0x10')](function(_0x140b4e){if(_0x140b4e&&_0x140b4e[_0x9052('0xcd')]&&_0x4263c1[_0x9052('0xce')]&&_0x4263c1[_0x9052('0xcf')]){var _0x5e60b1={'tls':{'rejectUnauthorized':![]}};if(_0x140b4e[_0x9052('0xcd')]['service']){_0x5e60b1[_0x9052('0xd0')]=_0x140b4e[_0x9052('0xcd')]['service'];}else{_0x5e60b1[_0x9052('0xd1')]=_0x140b4e['Smtp'][_0x9052('0xd1')];_0x5e60b1[_0x9052('0xd2')]=_0x140b4e[_0x9052('0xcd')][_0x9052('0xd2')];_0x5e60b1[_0x9052('0xd3')]=_0x140b4e[_0x9052('0xcd')][_0x9052('0xd3')];}if(_0x140b4e['Smtp'][_0x9052('0xd4')]){_0x5e60b1[_0x9052('0xd5')]={'user':_0x140b4e[_0x9052('0xcd')][_0x9052('0x4d')],'pass':_0x140b4e[_0x9052('0xcd')][_0x9052('0xd6')]};}return respondWithRpcPromise(_0x9052('0xd7'),_0x9052('0xd8'),{'account':_0x5e60b1,'message':{'from':util[_0x9052('0xa0')]('\x22%s\x22\x20<%s>',_0x140b4e[_0x9052('0x2b')],_0x140b4e['email']||_0x140b4e[_0x9052('0xcd')][_0x9052('0x4d')]),'to':_0x4263c1[_0x9052('0xcf')],'subject':_0x4263c1[_0x9052('0xd9')],'html':_0x379462['body'],'attachments':_0x6ded2b}},client9003)[_0x9052('0x10')](function(){return _0x379462;})[_0x9052('0x1b')](function(_0x5d8392){console[_0x9052('0x16')](_0x5d8392);});}})[_0x9052('0x10')](function(){if(_0x4263c1&&_0x4263c1[_0x9052('0xca')]&&_0x4263c1[_0x9052('0xda')]){var _0x4dbc00=[];if(_0x262867[_0x9052('0x39')]){_0x4dbc00=_0x262867[_0x9052('0x2f')](function(_0x5da56b){return{'name':_0x5da56b[_0x9052('0xdb')],'basename':_0x5da56b['filename'],'type':_0x5da56b[_0x9052('0xc6')],'ChatOfflineMessageId':_0x1c4d8e['id']};});}var _0x4584c1;if(!_[_0x9052('0x6f')](_0x4263c1[_0x9052('0xdc')])){var _0x55c04a=_[_0x9052('0x2f')](_0x336ce4[_0x9052('0x51')],function(_0x233b6d){return _0x233b6d;});var _0xa42761=_['toPairsIn'](_0x55c04a)[0x0];var _0x5d35b7=_[_0x9052('0xdd')](_0xa42761,function(_0x492c8c){return _0x492c8c;});_0x4584c1=_0x5d35b7[0x1][_0x4263c1[_0x9052('0xdc')]];}var _0x5c4f43={'from':_0x5290a0[_0x9052('0xde')],'firstName':_0x5290a0['firstName'],'lastName':_0x5290a0[_0x9052('0x9d')],'mapKey':_0x9052('0xde'),'message':{'from':_0x5290a0[_0x9052('0xde')],'to':_0x4263c1['MailAccount'][_0x9052('0xde')],'cc':'','subject':_[_0x9052('0x6f')](_0x4584c1)?_0x4263c1[_0x9052('0xd9')]:_0x4584c1,'messageId':'','sentAt':new Date(),'attach':_0x4dbc00[_0x9052('0x39')],'attachments':_0x4dbc00,'originChannel':_0x9052('0xdf'),'ChatWebsiteId':_0x4263c1['id'],'ChatOfflineMessageId':_0x379462['id'],'originTo':_0x4263c1[_0x9052('0xc0')][_0x9052('0xde')]},'body':_0x379462['body']};var _0x492e75={'account':{'id':_0x4263c1[_0x9052('0xda')]},'body':_0x5c4f43,'log':_0x9052('0xe0')};return respondWithRpcPromise(_0x9052('0xe0'),_0x9052('0xe1'),_0x492e75,client9001)[_0x9052('0x10')](function(){return _0x379462;})[_0x9052('0x1b')](function(_0x5911e7){console[_0x9052('0x16')](_0x5911e7);});}return;})[_0x9052('0x10')](function(){if(_0x379462){return _0x379462;}})[_0x9052('0x10')](respondWithResult(_0x154ebb,null))[_0x9052('0x1b')](function(_0x270fae){console[_0x9052('0x16')](_0x9052('0x1b'),_0x270fae);for(var _0x1d3f22 of _0x262867){var _0x31bc31=path[_0x9052('0x66')](config['root'],'server',_0x9052('0xbc'),'attachments',_0x9052('0xc8'),_0x1d3f22[_0x9052('0x61')]);fs_extra[_0x9052('0xe2')](_0x31bc31)[_0x9052('0x1b')](function(_0x2b57a3){console[_0x9052('0x16')](_0x9052('0xe3'),_0x31bc31,_0x2b57a3);});}});};exports['addInteraction']=function(_0x557b87,_0x1eec94){return db[_0x9052('0xa9')][_0x9052('0x4b')]({'where':{'id':_0x557b87[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x1eec94,null))[_0x9052('0x10')](function(_0x2a0aab){if(_0x2a0aab){return _0x2a0aab[_0x9052('0xe4')](_0x557b87[_0x9052('0x51')]['ids'],_[_0x9052('0xe5')](_0x557b87[_0x9052('0x51')],[_0x9052('0x58'),'id'])||{});}})[_0x9052('0x10')](respondWithResult(_0x1eec94,null))['catch'](handleError(_0x1eec94,null));};exports['getInteractions']=function(_0x5110ee,_0x537240){var _0x18083d={'raw':![],'where':{}};var _0x25ec1a={};var _0x3b33da={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9052('0x5b')]({'where':{'id':_0x5110ee[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x537240,null))[_0x9052('0x10')](function(_0x585e96){if(_0x585e96){_0x25ec1a['model']=_['keys'](db[_0x9052('0xa9')][_0x9052('0x30')]);_0x25ec1a[_0x9052('0x34')]=_['keys'](_0x5110ee[_0x9052('0x34')]);_0x25ec1a[_0x9052('0x35')]=_[_0x9052('0x36')](_0x25ec1a['model'],_0x25ec1a[_0x9052('0x34')]);_0x18083d[_0x9052('0x37')]=_[_0x9052('0x36')](_0x25ec1a[_0x9052('0x33')],qs[_0x9052('0x38')](_0x5110ee['query']['fields']));_0x18083d[_0x9052('0x37')]=_0x18083d['attributes']['length']?_0x18083d[_0x9052('0x37')]:_0x25ec1a[_0x9052('0x33')];if(!_0x5110ee['query']['hasOwnProperty'](_0x9052('0xe6'))){_0x18083d[_0x9052('0x20')]=qs[_0x9052('0x20')](_0x5110ee['query'][_0x9052('0x20')]);_0x18083d[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x5110ee[_0x9052('0x34')][_0x9052('0x1e')]);}_0x18083d[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0x5110ee[_0x9052('0x34')][_0x9052('0x3c')]);_0x18083d[_0x9052('0x3f')]=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x5110ee[_0x9052('0x34')],_0x25ec1a['filters']));_0x18083d[_0x9052('0x3f')][_0x9052('0x54')]=_0x585e96['id'];if(_0x5110ee[_0x9052('0x34')][_0x9052('0x3e')]){_0x18083d[_0x9052('0x3f')]=_['merge'](_0x18083d[_0x9052('0x3f')],{'$or':_['map'](_0x18083d[_0x9052('0x37')],function(_0x5d8d83){var _0x2724f6={};_0x2724f6[_0x5d8d83]={'$like':'%'+_0x5110ee[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x2724f6;})});}_0x18083d=_[_0x9052('0x40')]({},_0x18083d,_0x5110ee[_0x9052('0x42')]);return db[_0x9052('0xa9')][_0x9052('0x21')]({'where':_0x18083d['where']})[_0x9052('0x10')](function(_0x2d38e7){_0x3b33da[_0x9052('0x21')]=_0x2d38e7;if(_0x5110ee[_0x9052('0x34')]['includeAll']){_0x18083d[_0x9052('0x44')]=[{'model':db['CmContact'],'as':_0x9052('0xe7'),'required':![]},{'model':db[_0x9052('0xb4')],'as':'Owner','attributes':[_0x9052('0x2b'),_0x9052('0xe8'),_0x9052('0xe9')],'required':![]},{'model':db[_0x9052('0xea')],'as':_0x9052('0xeb'),'attributes':['id',_0x9052('0x2b'),_0x9052('0xec')],'where':_0x5110ee[_0x9052('0x34')][_0x9052('0xed')]?{'id':_0x5110ee[_0x9052('0x34')][_0x9052('0xed')]}:undefined,'required':_0x5110ee[_0x9052('0x34')][_0x9052('0xed')]?!![]:![]}];}return db[_0x9052('0xa9')]['findAll'](_0x18083d);})[_0x9052('0x10')](function(_0x48a490){_0x3b33da[_0x9052('0x46')]=_0x48a490;return _0x3b33da;});}})['then'](respondWithFilteredResult(_0x537240,_0x18083d))[_0x9052('0x1b')](handleError(_0x537240,null));};function iftimePromise(_0x2e1c4e,_0x184706){return respondWithRpcPromise(_0x9052('0xee'),_0x9052('0xef'),{'command':_0x184706['timezone']?util['format'](_0x9052('0xf0'),_0x2e1c4e[_0x9052('0xf1')],_0x184706['timezone']):util[_0x9052('0xa0')](_0x9052('0xf2'),_0x2e1c4e[_0x9052('0xf1')])},client9002)[_0x9052('0x10')](function(_0x3df066){var _0x5d32b4=_0x3df066&&_0x3df066[_0x9052('0xf3')](_0x9052('0xf4'))>=0x0?!![]:![];logger['info'](_0x9052('0xf5'),_0x184706['id'],_0x2e1c4e['id'],_0x2e1c4e[_0x9052('0xf1')],_0x5d32b4?_0x9052('0xf6'):_0x9052('0xf7'),_0x184706['timezone']?_0x184706[_0x9052('0xf8')]:_0x9052('0xf9'));return _0x5d32b4;})[_0x9052('0x1b')](function(_0x5789da){logger['error'](_0x9052('0xf5'),_0x184706['id'],_0x2e1c4e['id'],_0x2e1c4e[_0x9052('0xf1')],util[_0x9052('0xfa')](_0x5789da,{'showHidden':![],'depth':null}),_0x184706['timezone']?_0x184706[_0x9052('0xf8')]:_0x9052('0xf9'));return![];});}exports['getSnippet']=function(_0x7cc975,_0xfa55bd){var _0x1501b4=0x0;var _0x219f9a=0x0;var _0x3d780e=![];var _0xa1b09;var _0x4a2596;return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x7cc975['params']['id']},'include':[{'model':db[_0x9052('0xfb')],'as':'Interval','include':[{'model':db[_0x9052('0xfb')],'as':_0x9052('0xfc'),'attributes':['id',_0x9052('0xf1')],'raw':!![]}]}]})[_0x9052('0x10')](handleEntityNotFound(_0xfa55bd,null))[_0x9052('0x10')](function(_0x4d193f){if(_0x4d193f){_0xa1b09=_0x4d193f;return _0x4d193f[_0x9052('0xfd')]({'raw':!![]});}})[_0x9052('0x10')](function(_0x23cf4f){if(_0xa1b09){if(_0x23cf4f){_0x4a2596=_0x23cf4f;}}return require(_0x9052('0xfe'))[_0x9052('0xff')]();})[_0x9052('0x10')](function(_0x17562d){if(_0x17562d){_0x219f9a=_0x17562d[_0x9052('0x100')];_0x3d780e=_0x17562d['custom'];}})['then'](function(){return db[_0x9052('0xa9')][_0x9052('0x21')]({'where':{'closed':![]}});})[_0x9052('0x10')](function(_0x4bd124){_0x1501b4=_0x4bd124;if(_0x219f9a&&_0x4bd124>_0x219f9a){return db[_0x9052('0x101')][_0x9052('0x5b')]({'where':{'id':0x1}})['then'](function(_0xe10450){if(_0xe10450){_0xe10450[_0x9052('0x102')]('chatLicenseExceeded');}});}})['then'](function(){if(_0xa1b09['Interval']&&_0xa1b09[_0x9052('0xfb')]['Intervals']){var _0x201d88=[];for(var _0x454580=0x0;_0x454580<_0xa1b09['Interval'][_0x9052('0xfc')][_0x9052('0x39')];_0x454580++){var _0x1c4ba5=_0xa1b09[_0x9052('0xfb')][_0x9052('0xfc')][_0x454580][_0x9052('0x25')]({'plain':!![]});_0x201d88[_0x9052('0xb0')](iftimePromise(_0x1c4ba5,_0xa1b09));}return BPromise[_0x9052('0x103')](_0x201d88)['then'](function(_0x44e8dd){return _[_0x9052('0x104')](_0x44e8dd);});}else{return!![];}})[_0x9052('0x10')](function(_0x5b62b4){var _0x5f1b93=fs['readFileSync'](path[_0x9052('0x66')](config['root'],_0x9052('0x105')),_0x9052('0xc2'));var _0x1185e8={'remote':_0xa1b09[_0x9052('0x106')],'query':querystring['stringify'](_[_0x9052('0x40')](_0xa1b09[_0x9052('0x25')]({'plain':!![]}),{'customerIp':_0x7cc975['headers'][_0x9052('0x107')]||_0x7cc975[_0x9052('0x79')][_0x9052('0x108')]||_0x7cc975[_0x9052('0x109')][_0x9052('0x10a')]||_0x7cc975['ip'],'referer':_0x7cc975[_0x9052('0x79')][_0x9052('0x10b')],'openedInteractions':_0x1501b4,'maxInteractions':_0x219f9a,'virtual':_0x3d780e[_0x9052('0x100')],'online':_0x5b62b4,'custom':_0x3d780e}))[_0x9052('0x10c')](/'/g,'\x5c\x27')};_0xfa55bd[_0x9052('0x2c')](ejs[_0x9052('0xc3')](Mustache['render'](_0x5f1b93,_0x1185e8),{'proactiveActions':_0x4a2596,'alignment':_0xa1b09[_0x9052('0x10d')],'verticalAlignment':_0xa1b09['verticalAlignment'],'div_color':_0xa1b09[_0x9052('0xec')],'text_color':_0xa1b09[_0x9052('0x10e')],'button_color':_0xa1b09[_0x9052('0x10f')],'background_color':_0xa1b09[_0x9052('0x110')]}));})[_0x9052('0x1b')](handleError(_0xfa55bd,null));};exports[_0x9052('0x111')]=function(_0x19c9b5,_0x31a01a){var _0x41800e=_0x19c9b5['params']['id'];var _0x525147=_0x19c9b5[_0x9052('0x51')];var _0x3a8f4b=0xc8;var _0x5cf6e5=null;return db[_0x9052('0x112')][_0x9052('0x113')]({'isolationLevel':db['sequelize'][_0x9052('0x114')][_0x9052('0x115')][_0x9052('0x116')]},function(_0x420e6d){return db[_0x9052('0x45')][_0x9052('0x5b')]({'where':{'id':_0x41800e},'transaction':_0x420e6d})['then'](function(_0x729e4f){if(_0x729e4f){return db[_0x9052('0x8e')]['destroy']({'where':{'ChatWebsiteId':_0x41800e},'transaction':_0x420e6d})[_0x9052('0x10')](function(){var _0x404d19=_[_0x9052('0x2f')](_0x525147,function(_0x11147f){_0x11147f[_0x9052('0x54')]=_0x41800e;return _0x11147f;});return db[_0x9052('0x8e')]['bulkCreate'](_0x404d19,{'transaction':_0x420e6d});});}else{_0x3a8f4b=0x194;_0x5cf6e5=[];}});})[_0x9052('0x10')](function(){if(_0x3a8f4b!==0x194){return db['ChatApplication'][_0x9052('0x117')]({'where':{'ChatWebsiteId':_0x41800e},'order':'priority'})[_0x9052('0x10')](function(_0xc7b6ff){_0x5cf6e5=_0xc7b6ff;});}})[_0x9052('0x1b')](function(_0x3a27d0){_0x3a8f4b=0x1f4;logger[_0x9052('0x16')](_0x3a27d0[_0x9052('0x2a')]);if(_0x3a27d0['name']){delete _0x3a27d0[_0x9052('0x2b')];}_0x5cf6e5=_0x3a27d0;})[_0x9052('0x118')](function(){if(_0x5cf6e5===null){_0x31a01a[_0x9052('0x29')](_0x3a8f4b);}else{if(_0x3a8f4b===0x1f4){_0x31a01a[_0x9052('0x1c')](_0x3a8f4b)[_0x9052('0x2c')](_0x5cf6e5);}else{_0x31a01a[_0x9052('0x1c')](_0x3a8f4b)[_0x9052('0x23')](_0x5cf6e5);}}});};exports[_0x9052('0x119')]=function(_0x10e055,_0x4682df){var _0x34cabc={};var _0x3cd9fa={};var _0x1a9c69;var _0x20f09d;return db['ChatWebsite'][_0x9052('0x5b')]({'where':{'id':_0x10e055[_0x9052('0x48')]['id']}})['then'](handleEntityNotFound(_0x4682df,null))[_0x9052('0x10')](function(_0x1e2dee){if(_0x1e2dee){_0x1a9c69=_0x1e2dee;_0x3cd9fa[_0x9052('0x33')]=_[_0x9052('0x4a')](db[_0x9052('0x8e')][_0x9052('0x30')]);_0x3cd9fa['query']=_[_0x9052('0x4a')](_0x10e055['query']);_0x3cd9fa['filters']=_[_0x9052('0x36')](_0x3cd9fa['model'],_0x3cd9fa[_0x9052('0x34')]);_0x34cabc[_0x9052('0x37')]=_['intersection'](_0x3cd9fa[_0x9052('0x33')],qs[_0x9052('0x38')](_0x10e055[_0x9052('0x34')][_0x9052('0x38')]));_0x34cabc['attributes']=_0x34cabc[_0x9052('0x37')]['length']?_0x34cabc[_0x9052('0x37')]:_0x3cd9fa[_0x9052('0x33')];_0x34cabc[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0x10e055['query']['sort']);_0x34cabc['where']=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x10e055[_0x9052('0x34')],_0x3cd9fa[_0x9052('0x35')]));if(_0x10e055['query'][_0x9052('0x3e')]){_0x34cabc['where']=_[_0x9052('0x40')](_0x34cabc[_0x9052('0x3f')],{'$or':_['map'](_0x34cabc[_0x9052('0x37')],function(_0x2a592d){var _0x415f8e={};_0x415f8e[_0x2a592d]={'$like':'%'+_0x10e055[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x415f8e;})});}_0x34cabc=_['merge']({},_0x34cabc,_0x10e055[_0x9052('0x42')]);return _0x1a9c69[_0x9052('0x119')](_0x34cabc);}})['then'](function(_0x80aade){if(_0x80aade){_0x20f09d=_0x80aade[_0x9052('0x39')];if(!_0x10e055['query']['hasOwnProperty'](_0x9052('0xe6'))){_0x34cabc['limit']=qs[_0x9052('0x20')](_0x10e055[_0x9052('0x34')][_0x9052('0x20')]);_0x34cabc['offset']=qs[_0x9052('0x1e')](_0x10e055[_0x9052('0x34')]['offset']);}return _0x1a9c69[_0x9052('0x119')](_0x34cabc);}})[_0x9052('0x10')](function(_0x5ea77d){if(_0x5ea77d){return _0x5ea77d?{'count':_0x20f09d,'rows':_0x5ea77d}:null;}})['then'](respondWithResult(_0x4682df,null))[_0x9052('0x1b')](handleError(_0x4682df,null));};exports[_0x9052('0x11a')]=function(_0x165085,_0x332a5a){return db['chatProactiveAction'][_0x9052('0x4b')]({'where':{'id':_0x165085[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x332a5a,null))[_0x9052('0x10')](function(_0xe3ebb0){if(_0xe3ebb0){return _0xe3ebb0[_0x9052('0x11a')](_0x165085['body'][_0x9052('0x58')],_['omit'](_0x165085[_0x9052('0x51')],[_0x9052('0x58'),'id'])||{});}})[_0x9052('0x10')](respondWithResult(_0x332a5a,null))[_0x9052('0x1b')](handleError(_0x332a5a,null));};exports[_0x9052('0xfd')]=function(_0x248359,_0xcd6d3b){var _0x18e9b6={};var _0x269e26={};var _0x53a6c4;var _0x2b9660;return db[_0x9052('0x45')][_0x9052('0x5b')]({'where':{'id':_0x248359['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0xcd6d3b,null))[_0x9052('0x10')](function(_0x3f2243){if(_0x3f2243){_0x53a6c4=_0x3f2243;_0x269e26[_0x9052('0x33')]=_[_0x9052('0x4a')](db[_0x9052('0x11b')]['rawAttributes']);_0x269e26[_0x9052('0x34')]=_['keys'](_0x248359[_0x9052('0x34')]);_0x269e26[_0x9052('0x35')]=_[_0x9052('0x36')](_0x269e26[_0x9052('0x33')],_0x269e26['query']);_0x18e9b6['attributes']=_[_0x9052('0x36')](_0x269e26['model'],qs[_0x9052('0x38')](_0x248359[_0x9052('0x34')]['fields']));_0x18e9b6[_0x9052('0x37')]=_0x18e9b6[_0x9052('0x37')][_0x9052('0x39')]?_0x18e9b6[_0x9052('0x37')]:_0x269e26[_0x9052('0x33')];_0x18e9b6[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0x248359['query'][_0x9052('0x3c')]);_0x18e9b6['where']=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x248359[_0x9052('0x34')],_0x269e26[_0x9052('0x35')]));if(_0x248359['query']['filter']){_0x18e9b6[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x18e9b6[_0x9052('0x3f')],{'$or':_['map'](_0x18e9b6[_0x9052('0x37')],function(_0x5b959c){var _0x5c4d9d={};_0x5c4d9d[_0x5b959c]={'$like':'%'+_0x248359[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x5c4d9d;})});}_0x18e9b6=_['merge']({},_0x18e9b6,_0x248359[_0x9052('0x42')]);return _0x53a6c4['getProactiveActions'](_0x18e9b6);}})[_0x9052('0x10')](function(_0xd5884a){if(_0xd5884a){_0x2b9660=_0xd5884a[_0x9052('0x39')];if(!_0x248359['query'][_0x9052('0x3a')](_0x9052('0xe6'))){_0x18e9b6[_0x9052('0x20')]=qs[_0x9052('0x20')](_0x248359[_0x9052('0x34')][_0x9052('0x20')]);_0x18e9b6[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x248359[_0x9052('0x34')][_0x9052('0x1e')]);}return _0x53a6c4['getProactiveActions'](_0x18e9b6);}})[_0x9052('0x10')](function(_0x104a30){if(_0x104a30){return _0x104a30?{'count':_0x2b9660,'rows':_0x104a30}:null;}})[_0x9052('0x10')](respondWithResult(_0xcd6d3b,null))[_0x9052('0x1b')](handleError(_0xcd6d3b,null));};exports[_0x9052('0x11c')]=function(_0x59c647,_0x140be2){var _0x478c65=_0x59c647[_0x9052('0x34')][_0x9052('0x11d')]==='false'?_0x9052('0x11e'):_0x9052('0x11f');return db[_0x9052('0x45')][_0x9052('0x4b')]({'attributes':['id',_0x478c65],'where':{'id':_0x59c647[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x140be2,null))[_0x9052('0x10')](function(_0x3154ac){if(_0x3154ac){var _0x512522=_0x3154ac[_0x478c65];var _0x3e911f=_0x512522&&_0x512522[_0x9052('0x120')]?_0x512522[_0x9052('0x120')]:[];_0x140be2[_0x9052('0x2c')]({'fromKey':_['isNil'](_0x512522[_0x9052('0x121')])?undefined:_0x512522[_0x9052('0x121')],'count':_0x3e911f[_0x9052('0x39')],'rows':_0x3e911f});}})[_0x9052('0x1b')](handleError(_0x140be2,null));};exports['getOfflineMessages']=function(_0x49ece8,_0x8ebe2c){var _0x5edc49={'raw':![],'where':{}};var _0x111adf={};var _0xbf7e2={'count':0x0,'rows':[]};return db[_0x9052('0x45')][_0x9052('0x5b')]({'where':{'id':_0x49ece8[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x8ebe2c,null))['then'](function(_0x5ef88f){if(_0x5ef88f){_0x111adf['model']=_[_0x9052('0x4a')](db[_0x9052('0xc5')]['rawAttributes']);_0x111adf[_0x9052('0x34')]=_[_0x9052('0x4a')](_0x49ece8[_0x9052('0x34')]);_0x111adf[_0x9052('0x35')]=_['intersection'](_0x111adf[_0x9052('0x33')],_0x111adf[_0x9052('0x34')]);_0x5edc49[_0x9052('0x37')]=_['intersection'](_0x111adf[_0x9052('0x33')],qs[_0x9052('0x38')](_0x49ece8[_0x9052('0x34')]['fields']));_0x5edc49[_0x9052('0x37')]=_0x5edc49[_0x9052('0x37')]['length']?_0x5edc49[_0x9052('0x37')]:_0x111adf['model'];if(!_0x49ece8['query'][_0x9052('0x3a')](_0x9052('0xe6'))){_0x5edc49[_0x9052('0x20')]=qs[_0x9052('0x20')](_0x49ece8[_0x9052('0x34')][_0x9052('0x20')]);_0x5edc49[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x49ece8[_0x9052('0x34')][_0x9052('0x1e')]);}_0x5edc49[_0x9052('0x3b')]=qs['sort'](_0x49ece8[_0x9052('0x34')][_0x9052('0x3c')]);_0x5edc49[_0x9052('0x3f')]=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x49ece8['query'],_0x111adf[_0x9052('0x35')]));_0x5edc49['where']['ChatWebsiteId']=_0x5ef88f['id'];if(_0x49ece8[_0x9052('0x34')][_0x9052('0x3e')]){_0x5edc49[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x5edc49[_0x9052('0x3f')],{'$or':_[_0x9052('0x2f')](_0x5edc49[_0x9052('0x37')],function(_0x225bfd){var _0x393502={};_0x393502[_0x225bfd]={'$like':'%'+_0x49ece8[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x393502;})});}_0x5edc49=_[_0x9052('0x40')]({},_0x5edc49,_0x49ece8[_0x9052('0x42')]);return db['ChatOfflineMessage']['count']({'where':_0x5edc49[_0x9052('0x3f')]})[_0x9052('0x10')](function(_0x2670dc){_0xbf7e2['count']=_0x2670dc;if(_0x49ece8['query'][_0x9052('0x43')]){_0x5edc49[_0x9052('0x44')]=[{'all':!![]}];}else{_0x5edc49[_0x9052('0x44')]=[{'model':db['CmContact'],'as':_0x9052('0xe7'),'required':![]},{'model':db['Attachment'],'as':_0x9052('0x122'),'required':![]}];}return db['ChatOfflineMessage'][_0x9052('0x56')](_0x5edc49);})[_0x9052('0x10')](function(_0x137412){_0xbf7e2[_0x9052('0x46')]=_0x137412;return _0xbf7e2;});}})[_0x9052('0x10')](respondWithFilteredResult(_0x8ebe2c,_0x5edc49))['catch'](handleError(_0x8ebe2c,null));};exports[_0x9052('0x123')]=function(_0x4d7197,_0x4e89b6){return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x4d7197[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x4e89b6,null))['then'](function(_0x555ddf){if(_0x555ddf){return _0x555ddf['addAgents'](_0x4d7197[_0x9052('0x51')][_0x9052('0x58')],_['omit'](_0x4d7197[_0x9052('0x51')],[_0x9052('0x58'),'id'])||{})[_0x9052('0xab')](function(_0x15fb69){for(var _0x13d8e1=0x0;_0x13d8e1<_0x4d7197['body'][_0x9052('0x58')]['length'];_0x13d8e1+=0x1){socket[_0x9052('0x124')](_0x9052('0x125'),{'UserId':Number(_0x4d7197[_0x9052('0x51')][_0x9052('0x58')][_0x13d8e1]),'ChatWebsiteId':Number(_0x4d7197[_0x9052('0x48')]['id'])});}return _0x15fb69;});}})[_0x9052('0x10')](respondWithResult(_0x4e89b6,null))[_0x9052('0x1b')](handleError(_0x4e89b6,null));};exports[_0x9052('0x126')]=function(_0x547de7,_0x146d73){return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x547de7['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x146d73,null))['then'](function(_0x55a36f){if(_0x55a36f){return _0x55a36f[_0x9052('0x126')](_0x547de7[_0x9052('0x34')][_0x9052('0x58')])[_0x9052('0x10')](function(){if(_[_0x9052('0x127')](_0x547de7[_0x9052('0x34')][_0x9052('0x58')])){for(var _0x4e2722=0x0;_0x4e2722<_0x547de7['query'][_0x9052('0x58')][_0x9052('0x39')];_0x4e2722+=0x1){socket[_0x9052('0x124')](_0x9052('0x128'),{'UserId':Number(_0x547de7[_0x9052('0x34')][_0x9052('0x58')][_0x4e2722]),'ChatWebsiteId':Number(_0x547de7[_0x9052('0x48')]['id'])});}}else{socket['emit'](_0x9052('0x128'),{'UserId':Number(_0x547de7[_0x9052('0x34')]['ids']),'ChatWebsiteId':Number(_0x547de7['params']['id'])});}});}})[_0x9052('0x10')](respondWithStatusCode(_0x146d73,null))[_0x9052('0x1b')](handleError(_0x146d73,null));};exports[_0x9052('0x129')]=function(_0x437209,_0xe4dea6){var _0x454805={};var _0x2f0c8c={};var _0x26dcd3;var _0x42a223;return db[_0x9052('0x45')]['findOne']({'where':{'id':_0x437209[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0xe4dea6,null))['then'](function(_0x3577c7){if(_0x3577c7){_0x26dcd3=_0x3577c7;_0x2f0c8c[_0x9052('0x33')]=_['keys'](db['User'][_0x9052('0x30')]);_0x2f0c8c[_0x9052('0x34')]=_[_0x9052('0x4a')](_0x437209[_0x9052('0x34')]);_0x2f0c8c['filters']=_[_0x9052('0x36')](_0x2f0c8c[_0x9052('0x33')],_0x2f0c8c[_0x9052('0x34')]);_0x454805[_0x9052('0x37')]=_[_0x9052('0x36')](_0x2f0c8c[_0x9052('0x33')],qs[_0x9052('0x38')](_0x437209[_0x9052('0x34')][_0x9052('0x38')]));_0x454805['attributes']=_0x454805[_0x9052('0x37')]['length']?_0x454805[_0x9052('0x37')]:_0x2f0c8c[_0x9052('0x33')];_0x454805[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0x437209[_0x9052('0x34')][_0x9052('0x3c')]);_0x454805['where']=qs['filters'](_[_0x9052('0x3d')](_0x437209[_0x9052('0x34')],_0x2f0c8c['filters']));if(_0x437209[_0x9052('0x34')][_0x9052('0x3e')]){_0x454805[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x454805[_0x9052('0x3f')],{'$or':_[_0x9052('0x2f')](_0x454805[_0x9052('0x37')],function(_0x1c41a9){var _0x244216={};_0x244216[_0x1c41a9]={'$like':'%'+_0x437209[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x244216;})});}_0x454805=_[_0x9052('0x40')]({},_0x454805,_0x437209[_0x9052('0x42')]);return _0x26dcd3[_0x9052('0x129')](_0x454805);}})[_0x9052('0x10')](function(_0x4805e0){if(_0x4805e0){_0x42a223=_0x4805e0[_0x9052('0x39')];if(!_0x437209[_0x9052('0x34')][_0x9052('0x3a')](_0x9052('0xe6'))){_0x454805[_0x9052('0x20')]=qs[_0x9052('0x20')](_0x437209[_0x9052('0x34')][_0x9052('0x20')]);_0x454805['offset']=qs['offset'](_0x437209[_0x9052('0x34')]['offset']);}return _0x26dcd3[_0x9052('0x129')](_0x454805);}})['then'](function(_0x5ad324){if(_0x5ad324){return _0x5ad324?{'count':_0x42a223,'rows':_0x5ad324}:null;}})['then'](respondWithResult(_0xe4dea6,null))[_0x9052('0x1b')](handleError(_0xe4dea6,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 375cc58..96d9ede 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 _0xe79a=['ChatWebsite','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe79a,0x70));var _0xae79=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe79a[_0x164eca];return _0x2ce562;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0xae79('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae79('0x1'),'afterUpdate':_0xae79('0x2'),'afterDestroy':_0xae79('0x3')};function emitEvent(_0x324375){return function(_0x492be8,_0x33b85d,_0x45a28b){ChatWebsiteEvents[_0xae79('0x4')](_0x324375+':'+_0x492be8['id'],_0x492be8);ChatWebsiteEvents['emit'](_0x324375,_0x492be8);_0x45a28b(null);};}for(var e in events){if(events[_0xae79('0x5')](e)){var event=events[e];ChatWebsite[_0xae79('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x17ba=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xf82d0f,_0x59cc40){var _0x5937c5=function(_0x25449d){while(--_0x25449d){_0xf82d0f['push'](_0xf82d0f['shift']());}};_0x5937c5(++_0x59cc40);}(_0x17ba,0xab));var _0xa17b=function(_0x3a076e,_0x2216ed){_0x3a076e=_0x3a076e-0x0;var _0x433648=_0x17ba[_0x3a076e];return _0x433648;};'use strict';var EventEmitter=require(_0xa17b('0x0'));var ChatWebsite=require(_0xa17b('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa17b('0x2')](0x0);var events={'afterCreate':_0xa17b('0x3'),'afterUpdate':_0xa17b('0x4'),'afterDestroy':_0xa17b('0x5')};function emitEvent(_0x106b5b){return function(_0x38c13c,_0x11d7b7,_0x2f64d0){ChatWebsiteEvents[_0xa17b('0x6')](_0x106b5b+':'+_0x38c13c['id'],_0x38c13c);ChatWebsiteEvents[_0xa17b('0x6')](_0x106b5b,_0x38c13c);_0x2f64d0(null);};}for(var e in events){if(events[_0xa17b('0x7')](e)){var event=events[e];ChatWebsite[_0xa17b('0x8')](e,emitEvent(event));}}module[_0xa17b('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 6acdbe8..369f268 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 _0x46e0=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x58bc38,_0xe455b6){var _0x42802c=function(_0x92c225){while(--_0x92c225){_0x58bc38['push'](_0x58bc38['shift']());}};_0x42802c(++_0xe455b6);}(_0x46e0,0x9c));var _0x046e=function(_0x44f183,_0x313bdd){_0x44f183=_0x44f183-0x0;var _0x555253=_0x46e0[_0x44f183];return _0x555253;};'use strict';var _=require(_0x046e('0x0'));var util=require(_0x046e('0x1'));var logger=require(_0x046e('0x2'))(_0x046e('0x3'));var moment=require(_0x046e('0x4'));var BPromise=require('bluebird');var rp=require(_0x046e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x046e('0x6'));var config=require(_0x046e('0x7'));var attributes=require(_0x046e('0x8'));module['exports']=function(_0x49cd9a,_0x3b8d43){return _0x49cd9a['define'](_0x046e('0x9'),attributes,{'tableName':_0x046e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc066=['bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','lodash','util','../../config/logger'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xc066,0x7b));var _0x6c06=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc066[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x6c06('0x0'));var util=require(_0x6c06('0x1'));var logger=require(_0x6c06('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6c06('0x3'));var rp=require(_0x6c06('0x4'));var fs=require('fs');var path=require(_0x6c06('0x5'));var rimraf=require('rimraf');var config=require(_0x6c06('0x6'));var attributes=require(_0x6c06('0x7'));module[_0x6c06('0x8')]=function(_0x5d4c97,_0x4854d1){return _0x5d4c97['define']('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 4da6c87..2451e25 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 _0x41be=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x41be,0xf1));var _0xe41b=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x41be[_0x3c6dce];return _0x1450e9;};'use strict';var _=require(_0xe41b('0x0'));var util=require(_0xe41b('0x1'));var moment=require(_0xe41b('0x2'));var BPromise=require(_0xe41b('0x3'));var rs=require(_0xe41b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe41b('0x5'))['db'];var utils=require(_0xe41b('0x6'));var logger=require(_0xe41b('0x7'))(_0xe41b('0x8'));var config=require(_0xe41b('0x9'));var jayson=require(_0xe41b('0xa'));var client=jayson['client'][_0xe41b('0xb')]({'port':0x232a});config[_0xe41b('0xc')]=_[_0xe41b('0xd')](config[_0xe41b('0xc')],{'host':_0xe41b('0xe'),'port':0x18eb});var socket=require(_0xe41b('0xf'))(new Redis(config[_0xe41b('0xc')]));require('./chatWebsite.socket')[_0xe41b('0x10')](socket);function respondWithRpcPromise(_0x307abe,_0x303c39,_0x12e7d5){return new BPromise(function(_0x494f30,_0x273149){return client[_0xe41b('0x11')](_0x307abe,_0x12e7d5)[_0xe41b('0x12')](function(_0x3e2319){logger[_0xe41b('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x303c39,'request\x20sent');logger['debug'](_0xe41b('0x14'),_0x303c39,_0xe41b('0x15'),JSON['stringify'](_0x3e2319));if(_0x3e2319[_0xe41b('0x16')]){if(_0x3e2319['error'][_0xe41b('0x17')]===0x1f4){logger['error'](_0xe41b('0x18'),_0x303c39,_0x3e2319['error'][_0xe41b('0x19')]);return _0x273149(_0x3e2319[_0xe41b('0x16')][_0xe41b('0x19')]);}logger[_0xe41b('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x303c39,_0x3e2319[_0xe41b('0x16')]['message']);return _0x494f30(_0x3e2319[_0xe41b('0x16')][_0xe41b('0x19')]);}else{logger[_0xe41b('0x13')](_0xe41b('0x18'),_0x303c39,_0xe41b('0x15'));_0x494f30(_0x3e2319[_0xe41b('0x1a')][_0xe41b('0x19')]);}})[_0xe41b('0x1b')](function(_0x2a810b){logger[_0xe41b('0x16')](_0xe41b('0x18'),_0x303c39,_0x2a810b);_0x273149(_0x2a810b);});});} \ No newline at end of file +var _0x3ab8=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x15ebad,_0x1ac8e0){var _0x56818d=function(_0x2f468d){while(--_0x2f468d){_0x15ebad['push'](_0x15ebad['shift']());}};_0x56818d(++_0x1ac8e0);}(_0x3ab8,0x8f));var _0x83ab=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3ab8[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x83ab('0x0'));var util=require(_0x83ab('0x1'));var moment=require('moment');var BPromise=require(_0x83ab('0x2'));var rs=require(_0x83ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x83ab('0x4'));var logger=require('../../config/logger')(_0x83ab('0x5'));var config=require(_0x83ab('0x6'));var jayson=require(_0x83ab('0x7'));var client=jayson[_0x83ab('0x8')]['http']({'port':0x232a});config[_0x83ab('0x9')]=_[_0x83ab('0xa')](config['redis'],{'host':_0x83ab('0xb'),'port':0x18eb});var socket=require(_0x83ab('0xc'))(new Redis(config[_0x83ab('0x9')]));require(_0x83ab('0xd'))[_0x83ab('0xe')](socket);function respondWithRpcPromise(_0x11b879,_0x43b1ef,_0x25e2b5){return new BPromise(function(_0x21e0fe,_0x5e9c53){return client[_0x83ab('0xf')](_0x11b879,_0x25e2b5)[_0x83ab('0x10')](function(_0x42b0b4){logger[_0x83ab('0x11')](_0x83ab('0x12'),_0x43b1ef,'request\x20sent');logger[_0x83ab('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x43b1ef,_0x83ab('0x14'),JSON[_0x83ab('0x15')](_0x42b0b4));if(_0x42b0b4['error']){if(_0x42b0b4[_0x83ab('0x16')][_0x83ab('0x17')]===0x1f4){logger[_0x83ab('0x16')](_0x83ab('0x12'),_0x43b1ef,_0x42b0b4[_0x83ab('0x16')][_0x83ab('0x18')]);return _0x5e9c53(_0x42b0b4[_0x83ab('0x16')][_0x83ab('0x18')]);}logger[_0x83ab('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x43b1ef,_0x42b0b4[_0x83ab('0x16')]['message']);return _0x21e0fe(_0x42b0b4[_0x83ab('0x16')][_0x83ab('0x18')]);}else{logger['info'](_0x83ab('0x12'),_0x43b1ef,_0x83ab('0x14'));_0x21e0fe(_0x42b0b4[_0x83ab('0x19')]['message']);}})[_0x83ab('0x1a')](function(_0x5990d9){logger[_0x83ab('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x43b1ef,_0x5990d9);_0x5e9c53(_0x5990d9);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index eddd645..dde5d27 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 _0xbbe8=['remove','update','length','save'];(function(_0x1b21d8,_0xe6eafe){var _0x4313d8=function(_0x5cc95e){while(--_0x5cc95e){_0x1b21d8['push'](_0x1b21d8['shift']());}};_0x4313d8(++_0xe6eafe);}(_0xbbe8,0x17f));var _0x8bbe=function(_0x453d74,_0x2dd33b){_0x453d74=_0x453d74-0x0;var _0x2a641a=_0xbbe8[_0x453d74];return _0x2a641a;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x8bbe('0x0'),_0x8bbe('0x1'),_0x8bbe('0x2')];function createListener(_0x545f83,_0x446d62){return function(_0x21e44e){_0x446d62['emit'](_0x545f83,_0x21e44e);};}function removeListener(_0x4189ce,_0x3bbdc7){return function(){ChatWebsiteEvents['removeListener'](_0x4189ce,_0x3bbdc7);};}exports['register']=function(_0x649a13){for(var _0x980405=0x0,_0x3dd0de=events[_0x8bbe('0x3')];_0x980405<_0x3dd0de;_0x980405++){var _0x27f6a5=events[_0x980405];var _0x42a486=createListener('chatWebsite:'+_0x27f6a5,_0x649a13);ChatWebsiteEvents['on'](_0x27f6a5,_0x42a486);}}; \ No newline at end of file +var _0xd7b5=['length','chatWebsite:','./chatWebsite.events','remove','update','emit','register'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd7b5,0x6b));var _0x5d7b=function(_0x2a0e90,_0x161a7d){_0x2a0e90=_0x2a0e90-0x0;var _0x229b02=_0xd7b5[_0x2a0e90];return _0x229b02;};'use strict';var ChatWebsiteEvents=require(_0x5d7b('0x0'));var events=['save',_0x5d7b('0x1'),_0x5d7b('0x2')];function createListener(_0x2c2cb9,_0x4cede7){return function(_0x336bc3){_0x4cede7[_0x5d7b('0x3')](_0x2c2cb9,_0x336bc3);};}function removeListener(_0x42489a,_0x36ed59){return function(){ChatWebsiteEvents['removeListener'](_0x42489a,_0x36ed59);};}exports[_0x5d7b('0x4')]=function(_0x36ba6b){for(var _0x47ea54=0x0,_0x5e4398=events[_0x5d7b('0x5')];_0x47ea54<_0x5e4398;_0x47ea54++){var _0x5f2967=events[_0x47ea54];var _0x2cf4d4=createListener(_0x5d7b('0x6')+_0x5f2967,_0x36ba6b);ChatWebsiteEvents['on'](_0x5f2967,_0x2cf4d4);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 6b6adea..cfdb955 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 _0x728c=['getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','%s-%s','now','single','file','addLogo','join','server/files/images/avatars/','format','addAvatar','addCustomerAvatar','originalname','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','any','offline','/:id/interactions','addInteraction','/:id/applications','/:id/proactive_actions','addProactiveActions','/:id/users','addAgents','put','update','destroy','/:id/canned_answers','removeAnswers','delete','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages'];(function(_0x307dd9,_0x51218d){var _0x40988a=function(_0x54f266){while(--_0x54f266){_0x307dd9['push'](_0x307dd9['shift']());}};_0x40988a(++_0x51218d);}(_0x728c,0x19a));var _0xc728=function(_0x4fda7a,_0x14dcb4){_0x4fda7a=_0x4fda7a-0x0;var _0x2ac408=_0x728c[_0x4fda7a];return _0x2ac408;};'use strict';var multer=require(_0xc728('0x0'));var util=require(_0xc728('0x1'));var path=require(_0xc728('0x2'));var timeout=require('connect-timeout');var express=require(_0xc728('0x3'));var router=express[_0xc728('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc728('0x5'));var interaction=require(_0xc728('0x6'));var config=require('../../config/environment');var controller=require(_0xc728('0x7'));router[_0xc728('0x8')]('/',auth[_0xc728('0x9')](),controller[_0xc728('0xa')]);router[_0xc728('0x8')]('/describe',auth[_0xc728('0x9')](),controller[_0xc728('0xb')]);router['get'](_0xc728('0xc'),auth['isAuthenticated'](),controller[_0xc728('0xd')]);router[_0xc728('0x8')]('/:id/dispositions',auth[_0xc728('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc728('0xe')]);router[_0xc728('0x8')](_0xc728('0xf'),controller[_0xc728('0x10')]);router['get'](_0xc728('0x11'),controller['getAvatar']);router['get'](_0xc728('0x12'),controller[_0xc728('0x13')]);router[_0xc728('0x8')]('/:id/system_avatar',controller[_0xc728('0x14')]);router[_0xc728('0x8')]('/:id/interactions',auth[_0xc728('0x9')](),controller[_0xc728('0x15')]);router['get']('/:id/snippet',controller['getSnippet']);router[_0xc728('0x8')]('/:id/applications',auth[_0xc728('0x9')](),controller[_0xc728('0x16')]);router[_0xc728('0x8')]('/:id/proactive_actions',auth[_0xc728('0x9')](),controller[_0xc728('0x17')]);router[_0xc728('0x8')](_0xc728('0x18'),controller[_0xc728('0x19')]);router['get'](_0xc728('0x1a'),auth[_0xc728('0x9')](),controller[_0xc728('0x1b')]);router[_0xc728('0x8')]('/:id/users',auth[_0xc728('0x9')](),controller[_0xc728('0x1c')]);router[_0xc728('0x1d')]('/',auth['isAuthenticated'](),controller[_0xc728('0x1e')]);router[_0xc728('0x1d')](_0xc728('0x1f'),auth[_0xc728('0x9')](),controller[_0xc728('0x20')]);router[_0xc728('0x1d')]('/:id/canned_answers',auth[_0xc728('0x9')](),controller[_0xc728('0x21')]);var upload=multer({'storage':multer[_0xc728('0x22')]({'destination':function(_0x3c3e61,_0x39900b,_0xc47745){_0xc47745(null,path['join'](config[_0xc728('0x23')],'server/files/images/logos/'));},'filename':function(_0x15143e,_0x33f02c,_0x581120){_0x581120(null,util['format'](_0xc728('0x24'),Date[_0xc728('0x25')](),_0x33f02c['originalname']));}})});router[_0xc728('0x1d')](_0xc728('0xf'),upload[_0xc728('0x26')](_0xc728('0x27')),controller[_0xc728('0x28')]);var upload=multer({'storage':multer[_0xc728('0x22')]({'destination':function(_0x200f2f,_0x42b0d5,_0x5ee976){_0x5ee976(null,path[_0xc728('0x29')](config['root'],_0xc728('0x2a')));},'filename':function(_0x4bedae,_0x95c9c7,_0x45f439){_0x45f439(null,util[_0xc728('0x2b')](_0xc728('0x24'),Date[_0xc728('0x25')](),_0x95c9c7['originalname']));}})});router[_0xc728('0x1d')]('/:id/avatar',upload['single'](_0xc728('0x27')),controller[_0xc728('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28e7ed,_0x1dcf62,_0x259aaf){_0x259aaf(null,path['join'](config[_0xc728('0x23')],'server/files/images/avatars/'));},'filename':function(_0x567875,_0x531d62,_0x467e61){_0x467e61(null,util['format'](_0xc728('0x24'),Date[_0xc728('0x25')](),_0x531d62['originalname']));}})});router[_0xc728('0x1d')](_0xc728('0x12'),upload[_0xc728('0x26')](_0xc728('0x27')),controller[_0xc728('0x2d')]);var upload=multer({'storage':multer[_0xc728('0x22')]({'destination':function(_0x940c4d,_0x5e458e,_0x54fc80){_0x54fc80(null,path[_0xc728('0x29')](config[_0xc728('0x23')],_0xc728('0x2a')));},'filename':function(_0x2197db,_0x19e2fa,_0x10c12e){_0x10c12e(null,util[_0xc728('0x2b')](_0xc728('0x24'),Date['now'](),_0x19e2fa[_0xc728('0x2e')]));}})});router[_0xc728('0x1d')](_0xc728('0x2f'),upload['single'](_0xc728('0x27')),controller[_0xc728('0x30')]);router[_0xc728('0x1d')](_0xc728('0x31'),controller[_0xc728('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xc728('0x22')]({'destination':function(_0x70e75c,_0x5bba27,_0x59dc91){const _0x5e2534=path[_0xc728('0x29')](config[_0xc728('0x23')],_0xc728('0x33'),'attachments',_0xc728('0x34'));fs_extra[_0xc728('0x35')](_0x5e2534,function(){_0x59dc91(null,_0x5e2534);});},'filename':function(_0x3c9ee8,_0x48d66f,_0x767004){const _0x41296f=_0x48d66f[_0xc728('0x2e')][_0xc728('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x885181=path[_0xc728('0x37')](_0x41296f);const _0x5a023f=Date[_0xc728('0x25')]()+'-'+_0x41296f[_0xc728('0x36')](_0x885181,'')+_0x885181;_0x767004(null,_0x5a023f);}})});router[_0xc728('0x1d')]('/:id/offline',offlineUploadMulter[_0xc728('0x38')](),controller[_0xc728('0x39')]);router[_0xc728('0x1d')](_0xc728('0x3a'),auth[_0xc728('0x9')](),controller[_0xc728('0x3b')]);router[_0xc728('0x1d')](_0xc728('0x3c'),auth[_0xc728('0x9')](),controller['addApplications']);router['post'](_0xc728('0x3d'),auth[_0xc728('0x9')](),controller[_0xc728('0x3e')]);router[_0xc728('0x1d')](_0xc728('0x3f'),auth['isAuthenticated'](),controller[_0xc728('0x40')]);router[_0xc728('0x41')](_0xc728('0xc'),auth[_0xc728('0x9')](),controller[_0xc728('0x42')]);router['delete']('/:id',auth[_0xc728('0x9')](),controller[_0xc728('0x43')]);router['delete']('/:id/dispositions',auth[_0xc728('0x9')](),controller['removeDispositions']);router['delete'](_0xc728('0x44'),auth['isAuthenticated'](),controller[_0xc728('0x45')]);router[_0xc728('0x46')](_0xc728('0x3f'),auth[_0xc728('0x9')](),controller[_0xc728('0x47')]);module[_0xc728('0x48')]=router; \ No newline at end of file +var _0x69bd=['./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addCustomerAvatar','/:id/notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x30ab37,_0x467f7b){var _0x55624a=function(_0x52a2ac){while(--_0x52a2ac){_0x30ab37['push'](_0x30ab37['shift']());}};_0x55624a(++_0x467f7b);}(_0x69bd,0x14e));var _0xd69b=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x69bd[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require('multer');var util=require(_0xd69b('0x0'));var path=require(_0xd69b('0x1'));var timeout=require(_0xd69b('0x2'));var express=require(_0xd69b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd69b('0x4'));var config=require(_0xd69b('0x5'));var controller=require(_0xd69b('0x6'));router['get']('/',auth[_0xd69b('0x7')](),controller[_0xd69b('0x8')]);router[_0xd69b('0x9')](_0xd69b('0xa'),auth[_0xd69b('0x7')](),controller[_0xd69b('0xb')]);router[_0xd69b('0x9')](_0xd69b('0xc'),auth[_0xd69b('0x7')](),controller[_0xd69b('0xd')]);router[_0xd69b('0x9')](_0xd69b('0xe'),auth[_0xd69b('0x7')](),controller[_0xd69b('0xf')]);router[_0xd69b('0x9')](_0xd69b('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xd69b('0x9')](_0xd69b('0x11'),controller['getLogo']);router[_0xd69b('0x9')]('/:id/avatar',controller[_0xd69b('0x12')]);router[_0xd69b('0x9')](_0xd69b('0x13'),controller['getCustomerAvatar']);router[_0xd69b('0x9')](_0xd69b('0x14'),controller[_0xd69b('0x15')]);router[_0xd69b('0x9')](_0xd69b('0x16'),auth[_0xd69b('0x7')](),controller['getInteractions']);router[_0xd69b('0x9')]('/:id/snippet',controller[_0xd69b('0x17')]);router[_0xd69b('0x9')]('/:id/applications',auth[_0xd69b('0x7')](),controller[_0xd69b('0x18')]);router['get'](_0xd69b('0x19'),auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0xd69b('0x1a'),controller[_0xd69b('0x1b')]);router[_0xd69b('0x9')](_0xd69b('0x1c'),auth[_0xd69b('0x7')](),controller['getOfflineMessages']);router['get'](_0xd69b('0x1d'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x1e')]);router[_0xd69b('0x1f')]('/',auth[_0xd69b('0x7')](),controller[_0xd69b('0x20')]);router[_0xd69b('0x1f')](_0xd69b('0xe'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x21')]);router[_0xd69b('0x1f')](_0xd69b('0x10'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x22')]);var upload=multer({'storage':multer[_0xd69b('0x23')]({'destination':function(_0x10bbaa,_0x22a39d,_0x54f66b){_0x54f66b(null,path[_0xd69b('0x24')](config[_0xd69b('0x25')],_0xd69b('0x26')));},'filename':function(_0x27f3f2,_0x17ab71,_0x388328){_0x388328(null,util[_0xd69b('0x27')](_0xd69b('0x28'),Date[_0xd69b('0x29')](),_0x17ab71[_0xd69b('0x2a')]));}})});router[_0xd69b('0x1f')](_0xd69b('0x11'),upload[_0xd69b('0x2b')](_0xd69b('0x2c')),controller[_0xd69b('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7cae48,_0x5abf5e,_0x220d62){_0x220d62(null,path[_0xd69b('0x24')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4622cc,_0x4a6888,_0x2d2c49){_0x2d2c49(null,util[_0xd69b('0x27')](_0xd69b('0x28'),Date[_0xd69b('0x29')](),_0x4a6888[_0xd69b('0x2a')]));}})});router[_0xd69b('0x1f')]('/:id/avatar',upload[_0xd69b('0x2b')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xd69b('0x23')]({'destination':function(_0x3ea48d,_0x4c7be5,_0x9a5680){_0x9a5680(null,path[_0xd69b('0x24')](config[_0xd69b('0x25')],_0xd69b('0x2e')));},'filename':function(_0xeac85d,_0xa386b8,_0x356bc4){_0x356bc4(null,util['format']('%s-%s',Date[_0xd69b('0x29')](),_0xa386b8['originalname']));}})});router[_0xd69b('0x1f')](_0xd69b('0x13'),upload[_0xd69b('0x2b')]('file'),controller[_0xd69b('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15a185,_0x4c347d,_0x48fe66){_0x48fe66(null,path[_0xd69b('0x24')](config['root'],_0xd69b('0x2e')));},'filename':function(_0x114336,_0x508c74,_0x5e806e){_0x5e806e(null,util[_0xd69b('0x27')]('%s-%s',Date['now'](),_0x508c74['originalname']));}})});router[_0xd69b('0x1f')](_0xd69b('0x14'),upload[_0xd69b('0x2b')](_0xd69b('0x2c')),controller['addSystemAvatar']);router[_0xd69b('0x1f')](_0xd69b('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xd69b('0x23')]({'destination':function(_0x533514,_0x5565f6,_0xc2ab8f){const _0x51f1eb=path[_0xd69b('0x24')](config['root'],_0xd69b('0x31'),'attachments',_0xd69b('0x32'));fs_extra[_0xd69b('0x33')](_0x51f1eb,function(){_0xc2ab8f(null,_0x51f1eb);});},'filename':function(_0x5b29c4,_0xd434f6,_0x47b25f){const _0x5180eb=_0xd434f6[_0xd69b('0x2a')][_0xd69b('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1dc1ca=path[_0xd69b('0x35')](_0x5180eb);const _0xb548fe=Date[_0xd69b('0x29')]()+'-'+_0x5180eb['replace'](_0x1dc1ca,'')+_0x1dc1ca;_0x47b25f(null,_0xb548fe);}})});router['post'](_0xd69b('0x36'),offlineUploadMulter[_0xd69b('0x37')](),controller[_0xd69b('0x38')]);router[_0xd69b('0x1f')](_0xd69b('0x16'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x39')]);router['post']('/:id/applications',auth[_0xd69b('0x7')](),controller[_0xd69b('0x3a')]);router[_0xd69b('0x1f')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xd69b('0x3b')]);router[_0xd69b('0x1f')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xd69b('0x3c')]('/:id',auth['isAuthenticated'](),controller[_0xd69b('0x3d')]);router[_0xd69b('0x3e')](_0xd69b('0xc'),auth['isAuthenticated'](),controller[_0xd69b('0x3f')]);router[_0xd69b('0x3e')]('/:id/dispositions',auth[_0xd69b('0x7')](),controller[_0xd69b('0x40')]);router[_0xd69b('0x3e')](_0xd69b('0x10'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x41')]);router[_0xd69b('0x3e')](_0xd69b('0x1d'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x42')]);module[_0xd69b('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c333db5..18a6835 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 _0xa1aa=['STRING','ENUM','AmazonAWS','Google'];(function(_0xeea366,_0x584bd4){var _0x1a8ebc=function(_0x478de3){while(--_0x478de3){_0xeea366['push'](_0xeea366['shift']());}};_0x1a8ebc(++_0x584bd4);}(_0xa1aa,0x88));var _0xaa1a=function(_0xbe76ec,_0x509605){_0xbe76ec=_0xbe76ec-0x0;var _0x1bac3f=_0xa1aa[_0xbe76ec];return _0x1bac3f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaa1a('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xaa1a('0x1')](_0xaa1a('0x2'),_0xaa1a('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xaa1a('0x0')]},'data2':{'type':Sequelize[_0xaa1a('0x0')]}}; \ No newline at end of file +var _0x3831=['AmazonAWS','Google','sequelize','STRING','ENUM'];(function(_0x38c1f8,_0x52803d){var _0x3e8954=function(_0x84a865){while(--_0x84a865){_0x38c1f8['push'](_0x38c1f8['shift']());}};_0x3e8954(++_0x52803d);}(_0x3831,0x14c));var _0x1383=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0x3831[_0x29975a];return _0x41bcac;};'use strict';var Sequelize=require(_0x1383('0x0'));module['exports']={'name':{'type':Sequelize[_0x1383('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1383('0x2')](_0x1383('0x3'),_0x1383('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1383('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 9c921e6..8ac5116 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CloudProvider','fieldName','type','key'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xadb5,0xad));var _0x5adb=function(_0x4ea2f9,_0x3c31f1){_0x4ea2f9=_0x4ea2f9-0x0;var _0x4c672f=_0xadb5[_0x4ea2f9];return _0x4c672f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CloudProvider']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x932e4c,_0x140353){var _0x5184d4=function(_0x3af828){while(--_0x3af828){_0x932e4c['push'](_0x932e4c['shift']());}};_0x5184d4(++_0x140353);}(_0x2ef3,0xba));var _0x32ef=function(_0x459bb5,_0xc59a0a){_0x459bb5=_0x459bb5-0x0;var _0x19728e=_0x2ef3[_0x459bb5];return _0x19728e;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 042a6c9..c3f463f 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 _0x8d86=['moment','path','rimraf','../../config/environment','./cloudProvider.attributes','define','lodash','util','../../config/logger'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x8d86,0x192));var _0x68d8=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x8d86[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x68d8('0x0'));var util=require(_0x68d8('0x1'));var logger=require(_0x68d8('0x2'))('api');var moment=require(_0x68d8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68d8('0x4'));var rimraf=require(_0x68d8('0x5'));var config=require(_0x68d8('0x6'));var attributes=require(_0x68d8('0x7'));module['exports']=function(_0x303853,_0x3748d7){return _0x303853[_0x68d8('0x8')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x835f=['rimraf','./cloudProvider.attributes','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d9fa4,_0x91dcce){var _0x26f5d0=function(_0x5bcb2f){while(--_0x5bcb2f){_0x2d9fa4['push'](_0x2d9fa4['shift']());}};_0x26f5d0(++_0x91dcce);}(_0x835f,0x121));var _0xf835=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x835f[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0xf835('0x0'));var util=require(_0xf835('0x1'));var logger=require(_0xf835('0x2'))(_0xf835('0x3'));var moment=require(_0xf835('0x4'));var BPromise=require(_0xf835('0x5'));var rp=require(_0xf835('0x6'));var fs=require('fs');var path=require(_0xf835('0x7'));var rimraf=require(_0xf835('0x8'));var config=require('../../config/environment');var attributes=require(_0xf835('0x9'));module['exports']=function(_0x44fc71,_0x22ffb5){return _0x44fc71['define']('CloudProvider',attributes,{'tableName':_0xf835('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 bf92d93..a5d9087 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 _0x7916=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x2523d2,_0x3d47d6){var _0x3c49dc=function(_0x177a67){while(--_0x177a67){_0x2523d2['push'](_0x2523d2['shift']());}};_0x3c49dc(++_0x3d47d6);}(_0x7916,0x128));var _0x6791=function(_0x151c06,_0x5b8419){_0x151c06=_0x151c06-0x0;var _0x5a92be=_0x7916[_0x151c06];return _0x5a92be;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});} \ No newline at end of file +var _0x6db4=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird'];(function(_0x48a1ad,_0x2f2934){var _0x21cbc8=function(_0x280916){while(--_0x280916){_0x48a1ad['push'](_0x48a1ad['shift']());}};_0x21cbc8(++_0x2f2934);}(_0x6db4,0x111));var _0x46db=function(_0x4a3434,_0x166642){_0x4a3434=_0x4a3434-0x0;var _0x1ec429=_0x6db4[_0x4a3434];return _0x1ec429;};'use strict';var _=require('lodash');var util=require(_0x46db('0x0'));var moment=require(_0x46db('0x1'));var BPromise=require(_0x46db('0x2'));var rs=require(_0x46db('0x3'));var fs=require('fs');var Redis=require(_0x46db('0x4'));var db=require(_0x46db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46db('0x6'))(_0x46db('0x7'));var config=require(_0x46db('0x8'));var jayson=require(_0x46db('0x9'));var client=jayson[_0x46db('0xa')][_0x46db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23de32,_0x5409cd,_0x3a2dcb){return new BPromise(function(_0x2a597d,_0x27b949){return client[_0x46db('0xc')](_0x23de32,_0x3a2dcb)[_0x46db('0xd')](function(_0x427c62){logger[_0x46db('0xe')](_0x46db('0xf'),_0x5409cd,_0x46db('0x10'));logger[_0x46db('0x11')](_0x46db('0x12'),_0x5409cd,_0x46db('0x10'),JSON['stringify'](_0x427c62));if(_0x427c62[_0x46db('0x13')]){if(_0x427c62[_0x46db('0x13')][_0x46db('0x14')]===0x1f4){logger[_0x46db('0x13')](_0x46db('0xf'),_0x5409cd,_0x427c62[_0x46db('0x13')][_0x46db('0x15')]);return _0x27b949(_0x427c62[_0x46db('0x13')][_0x46db('0x15')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x5409cd,_0x427c62['error'][_0x46db('0x15')]);return _0x2a597d(_0x427c62[_0x46db('0x13')]['message']);}else{logger[_0x46db('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5409cd,_0x46db('0x10'));_0x2a597d(_0x427c62['result'][_0x46db('0x15')]);}})[_0x46db('0x16')](function(_0x5a75fb){logger[_0x46db('0x13')](_0x46db('0xf'),_0x5409cd,_0x5a75fb);_0x27b949(_0x5a75fb);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 49a4819..72ab0fc 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 _0xa0e9=['/:id','show','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x7496e7,_0x11201a){var _0xe74d27=function(_0xf2a9aa){while(--_0xf2a9aa){_0x7496e7['push'](_0x7496e7['shift']());}};_0xe74d27(++_0x11201a);}(_0xa0e9,0x147));var _0x9a0e=function(_0x50b736,_0x52b024){_0x50b736=_0x50b736-0x0;var _0x3ac9df=_0xa0e9[_0x50b736];return _0x3ac9df;};'use strict';var multer=require(_0x9a0e('0x0'));var util=require('util');var path=require(_0x9a0e('0x1'));var timeout=require(_0x9a0e('0x2'));var express=require(_0x9a0e('0x3'));var router=express[_0x9a0e('0x4')]();var fs_extra=require(_0x9a0e('0x5'));var auth=require(_0x9a0e('0x6'));var interaction=require(_0x9a0e('0x7'));var config=require(_0x9a0e('0x8'));var controller=require(_0x9a0e('0x9'));router[_0x9a0e('0xa')]('/',auth[_0x9a0e('0xb')](),controller[_0x9a0e('0xc')]);router[_0x9a0e('0xa')](_0x9a0e('0xd'),auth[_0x9a0e('0xb')](),controller[_0x9a0e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9a0e('0xf')]);router[_0x9a0e('0x10')](_0x9a0e('0xd'),auth[_0x9a0e('0xb')](),controller[_0x9a0e('0x11')]);router[_0x9a0e('0x12')](_0x9a0e('0xd'),auth[_0x9a0e('0xb')](),controller['destroy']);module[_0x9a0e('0x13')]=router; \ No newline at end of file +var _0x5a14=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./cloudProvider.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy'];(function(_0x21cd1c,_0x21c2b3){var _0x2c2b6a=function(_0x499978){while(--_0x499978){_0x21cd1c['push'](_0x21cd1c['shift']());}};_0x2c2b6a(++_0x21c2b3);}(_0x5a14,0x73));var _0x45a1=function(_0x18936e,_0x4cab2e){_0x18936e=_0x18936e-0x0;var _0x5d85f2=_0x5a14[_0x18936e];return _0x5d85f2;};'use strict';var multer=require(_0x45a1('0x0'));var util=require(_0x45a1('0x1'));var path=require('path');var timeout=require(_0x45a1('0x2'));var express=require('express');var router=express[_0x45a1('0x3')]();var fs_extra=require(_0x45a1('0x4'));var auth=require(_0x45a1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x45a1('0x6'));router[_0x45a1('0x7')]('/',auth['isAuthenticated'](),controller[_0x45a1('0x8')]);router[_0x45a1('0x7')]('/:id',auth[_0x45a1('0x9')](),controller[_0x45a1('0xa')]);router[_0x45a1('0xb')]('/',auth['isAuthenticated'](),controller[_0x45a1('0xc')]);router[_0x45a1('0xd')](_0x45a1('0xe'),auth['isAuthenticated'](),controller[_0x45a1('0xf')]);router[_0x45a1('0x10')](_0x45a1('0xe'),auth[_0x45a1('0x9')](),controller[_0x45a1('0x11')]);module[_0x45a1('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c107176..d765688 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 _0x6060=['sequelize','exports','STRING','name'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x6060,0xd0));var _0x0606=function(_0x373c86,_0x18bfe8){_0x373c86=_0x373c86-0x0;var _0x355b1b=_0x6060[_0x373c86];return _0x355b1b;};'use strict';var Sequelize=require(_0x0606('0x0'));module[_0x0606('0x1')]={'name':{'type':Sequelize[_0x0606('0x2')],'unique':_0x0606('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x0606('0x2')]},'phone':{'type':Sequelize[_0x0606('0x2')]},'fax':{'type':Sequelize[_0x0606('0x2')]},'type':{'type':Sequelize[_0x0606('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0606('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0606('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x0606('0x2')]},'sCity':{'type':Sequelize[_0x0606('0x2')]},'sCountry':{'type':Sequelize[_0x0606('0x2')]},'description':{'type':Sequelize[_0x0606('0x2')]}}; \ No newline at end of file +var _0x2da2=['exports','STRING','name'];(function(_0x1dd505,_0x72c2a9){var _0x14104a=function(_0xd44bc5){while(--_0xd44bc5){_0x1dd505['push'](_0x1dd505['shift']());}};_0x14104a(++_0x72c2a9);}(_0x2da2,0x108));var _0x22da=function(_0xa52b25,_0x488427){_0xa52b25=_0xa52b25-0x0;var _0x112a63=_0x2da2[_0xa52b25];return _0x112a63;};'use strict';var Sequelize=require('sequelize');module[_0x22da('0x0')]={'name':{'type':Sequelize[_0x22da('0x1')],'unique':_0x22da('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x22da('0x1')]},'companyId':{'type':Sequelize[_0x22da('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x22da('0x1')]},'fax':{'type':Sequelize[_0x22da('0x1')]},'type':{'type':Sequelize[_0x22da('0x1')]},'street':{'type':Sequelize[_0x22da('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x22da('0x1')]},'country':{'type':Sequelize[_0x22da('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x22da('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x22da('0x1')]},'sCountry':{'type':Sequelize[_0x22da('0x1')]},'description':{'type':Sequelize[_0x22da('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 3485527..2d3703d 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 _0x1cc2=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmCompany','includeAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','getContacts','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../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','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','describe','model','keys','query'];(function(_0x503c61,_0xbbc8ac){var _0x61a262=function(_0x3c760d){while(--_0x3c760d){_0x503c61['push'](_0x503c61['shift']());}};_0x61a262(++_0xbbc8ac);}(_0x1cc2,0x11d));var _0x21cc=function(_0x16a3de,_0x227e99){_0x16a3de=_0x16a3de-0x0;var _0x172a96=_0x1cc2[_0x16a3de];return _0x172a96;};'use strict';var emlformat=require(_0x21cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21cc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21cc('0x2'));var moment=require(_0x21cc('0x3'));var BPromise=require(_0x21cc('0x4'));var Mustache=require(_0x21cc('0x5'));var util=require(_0x21cc('0x6'));var path=require(_0x21cc('0x7'));var sox=require(_0x21cc('0x8'));var csv=require(_0x21cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21cc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x21cc('0xb'));var jsforce=require(_0x21cc('0xc'));var deskjs=require(_0x21cc('0xd'));var toCsv=require(_0x21cc('0x9'));var querystring=require('querystring');var Papa=require(_0x21cc('0xe'));var Redis=require('ioredis');var authService=require(_0x21cc('0xf'));var qs=require(_0x21cc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21cc('0x11'));var logger=require(_0x21cc('0x12'))(_0x21cc('0x13'));var utils=require(_0x21cc('0x14'));var config=require(_0x21cc('0x15'));var licenseUtil=require(_0x21cc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf3ee,_0x3fdccd){_0x3fdccd=_0x3fdccd||0xcc;return function(_0x55d279){if(_0x55d279){return _0xf3ee[_0x21cc('0x17')](_0x3fdccd);}return _0xf3ee[_0x21cc('0x18')](_0x3fdccd)['end']();};}function respondWithResult(_0x23df8a,_0x41951c){_0x41951c=_0x41951c||0xc8;return function(_0x2f641e){if(_0x2f641e){return _0x23df8a[_0x21cc('0x18')](_0x41951c)[_0x21cc('0x19')](_0x2f641e);}};}function respondWithFilteredResult(_0x285cd8,_0x102875){return function(_0x447a04){if(_0x447a04){var _0x5cf05f=typeof _0x102875[_0x21cc('0x1a')]===_0x21cc('0x1b')&&typeof _0x102875[_0x21cc('0x1c')]===_0x21cc('0x1b');var _0x44f183=_0x447a04['count'];var _0x2a3172=_0x5cf05f?0x0:_0x102875[_0x21cc('0x1a')];var _0x2784e8=_0x5cf05f?_0x447a04[_0x21cc('0x1d')]:_0x102875[_0x21cc('0x1a')]+_0x102875['limit'];var _0x374e2;if(_0x2784e8>=_0x44f183){_0x2784e8=_0x44f183;_0x374e2=0xc8;}else{_0x374e2=0xce;}_0x285cd8[_0x21cc('0x18')](_0x374e2);return _0x285cd8[_0x21cc('0x1e')](_0x21cc('0x1f'),_0x2a3172+'-'+_0x2784e8+'/'+_0x44f183)[_0x21cc('0x19')](_0x447a04);}return null;};}function patchUpdates(_0x81560a){return function(_0x5c5092){try{jsonpatch['apply'](_0x5c5092,_0x81560a,!![]);}catch(_0x7fe829){return BPromise[_0x21cc('0x20')](_0x7fe829);}return _0x5c5092[_0x21cc('0x21')]();};}function saveUpdates(_0x319e30,_0x44ca97){return function(_0x4b0fc5){if(_0x4b0fc5){return _0x4b0fc5[_0x21cc('0x22')](_0x319e30)[_0x21cc('0x23')](function(_0x16bb3f){return _0x16bb3f;});}return null;};}function removeEntity(_0x48b7f1,_0x4bcf5c){return function(_0x77673e){if(_0x77673e){return _0x77673e[_0x21cc('0x24')]()[_0x21cc('0x23')](function(){var _0xe9c80c=_0x77673e[_0x21cc('0x25')]({'plain':!![]});var _0x5c4a5b='Companies';return db[_0x21cc('0x26')]['destroy']({'where':{'type':_0x5c4a5b,'resourceId':_0xe9c80c['id']}})['then'](function(){return _0x77673e;});})[_0x21cc('0x23')](function(){_0x48b7f1[_0x21cc('0x18')](0xcc)[_0x21cc('0x27')]();});}};}function handleEntityNotFound(_0x898998,_0x49c1c4){return function(_0x2100cb){if(!_0x2100cb){_0x898998[_0x21cc('0x17')](0x194);}return _0x2100cb;};}function handleError(_0x4487e1,_0xf66f81){_0xf66f81=_0xf66f81||0x1f4;return function(_0x70b385){logger[_0x21cc('0x28')](_0x70b385[_0x21cc('0x29')]);if(_0x70b385[_0x21cc('0x2a')]){delete _0x70b385[_0x21cc('0x2a')];}_0x4487e1[_0x21cc('0x18')](_0xf66f81)['send'](_0x70b385);};}exports['index']=function(_0xb7776c,_0x29e5e5){var _0x8eeb59={},_0x45d589={},_0x5c7c5e={'count':0x0,'rows':[]};return db['CmCompany'][_0x21cc('0x2b')]()[_0x21cc('0x23')](function(_0x46c1dd){_0x45d589[_0x21cc('0x2c')]=_[_0x21cc('0x2d')](_0x46c1dd);_0x45d589[_0x21cc('0x2e')]=_[_0x21cc('0x2d')](_0xb7776c[_0x21cc('0x2e')]);_0x45d589[_0x21cc('0x2f')]=_[_0x21cc('0x30')](_0x45d589[_0x21cc('0x2c')],_0x45d589['query']);_0x8eeb59['attributes']=_[_0x21cc('0x30')](_0x45d589[_0x21cc('0x2c')],qs[_0x21cc('0x31')](_0xb7776c[_0x21cc('0x2e')]['fields']));_0x8eeb59[_0x21cc('0x32')]=_0x8eeb59[_0x21cc('0x32')]['length']?_0x8eeb59[_0x21cc('0x32')]:_0x45d589[_0x21cc('0x2c')];if(!_0xb7776c[_0x21cc('0x2e')][_0x21cc('0x33')](_0x21cc('0x34'))){_0x8eeb59[_0x21cc('0x1c')]=qs[_0x21cc('0x1c')](_0xb7776c[_0x21cc('0x2e')][_0x21cc('0x1c')]);_0x8eeb59['offset']=qs[_0x21cc('0x1a')](_0xb7776c['query']['offset']);}_0x8eeb59[_0x21cc('0x35')]=qs[_0x21cc('0x36')](_0xb7776c['query']['sort']);_0x8eeb59[_0x21cc('0x37')]=qs['filters'](_[_0x21cc('0x38')](_0xb7776c[_0x21cc('0x2e')],_0x45d589[_0x21cc('0x2f')]),_0x46c1dd);if(_0xb7776c[_0x21cc('0x2e')][_0x21cc('0x39')]){_0x8eeb59[_0x21cc('0x37')]=_[_0x21cc('0x3a')](_0x8eeb59[_0x21cc('0x37')],{'$or':_['map'](_0x8eeb59[_0x21cc('0x32')],function(_0x8d7f7){var _0xe8589c={};_0xe8589c[_0x8d7f7]={'$like':'%'+_0xb7776c['query']['filter']+'%'};return _0xe8589c;})});}_0x8eeb59=_['merge']({},_0x8eeb59,_0xb7776c[_0x21cc('0x3b')]);var _0x1d5886={'where':_0x8eeb59[_0x21cc('0x37')]};return db[_0x21cc('0x3c')][_0x21cc('0x1d')](_0x1d5886)[_0x21cc('0x23')](function(_0x2f3faf){_0x5c7c5e[_0x21cc('0x1d')]=_0x2f3faf;if(_0xb7776c[_0x21cc('0x2e')][_0x21cc('0x3d')]){_0x8eeb59['include']=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x8eeb59);})[_0x21cc('0x23')](function(_0x2aba4c){_0x5c7c5e[_0x21cc('0x3e')]=_0x2aba4c;return _0x5c7c5e;})[_0x21cc('0x23')](respondWithFilteredResult(_0x29e5e5,_0x8eeb59))[_0x21cc('0x3f')](handleError(_0x29e5e5,null));})[_0x21cc('0x3f')](handleError(_0x29e5e5,null));};exports[_0x21cc('0x40')]=function(_0x60434f,_0x1c9324){var _0x3df10c={'raw':![],'where':{'id':_0x60434f[_0x21cc('0x41')]['id']}},_0x223f67={};_0x223f67[_0x21cc('0x2c')]=_[_0x21cc('0x2d')](db[_0x21cc('0x3c')][_0x21cc('0x42')]);_0x223f67['query']=_[_0x21cc('0x2d')](_0x60434f['query']);_0x223f67['filters']=_[_0x21cc('0x30')](_0x223f67[_0x21cc('0x2c')],_0x223f67[_0x21cc('0x2e')]);_0x3df10c['attributes']=_[_0x21cc('0x30')](_0x223f67[_0x21cc('0x2c')],qs[_0x21cc('0x31')](_0x60434f[_0x21cc('0x2e')][_0x21cc('0x31')]));_0x3df10c[_0x21cc('0x32')]=_0x3df10c[_0x21cc('0x32')][_0x21cc('0x43')]?_0x3df10c[_0x21cc('0x32')]:_0x223f67[_0x21cc('0x2c')];if(_0x60434f[_0x21cc('0x2e')][_0x21cc('0x3d')]){_0x3df10c[_0x21cc('0x44')]=[{'all':!![]}];}_0x3df10c=_[_0x21cc('0x3a')]({},_0x3df10c,_0x60434f[_0x21cc('0x3b')]);return db[_0x21cc('0x3c')][_0x21cc('0x45')](_0x3df10c)[_0x21cc('0x23')](handleEntityNotFound(_0x1c9324,null))['then'](respondWithResult(_0x1c9324,null))[_0x21cc('0x3f')](handleError(_0x1c9324,null));};exports['create']=function(_0x4532a8,_0x261960){return db[_0x21cc('0x3c')][_0x21cc('0x46')](_0x4532a8[_0x21cc('0x47')],{})[_0x21cc('0x23')](function(_0x106d25){var _0x156c07=_0x4532a8['user'][_0x21cc('0x25')]({'plain':!![]});if(!_0x156c07)throw new Error(_0x21cc('0x48'));if(_0x156c07['role']===_0x21cc('0x49')){var _0x2d483e=_0x106d25[_0x21cc('0x25')]({'plain':!![]});var _0x19ea24=_0x21cc('0x4a');return db[_0x21cc('0x4b')][_0x21cc('0x45')]({'where':{'name':_0x19ea24,'userProfileId':_0x156c07[_0x21cc('0x4c')]},'raw':!![]})[_0x21cc('0x23')](function(_0x3859a3){if(_0x3859a3&&_0x3859a3['autoAssociation']===0x0){return db[_0x21cc('0x26')][_0x21cc('0x46')]({'name':_0x2d483e[_0x21cc('0x2a')],'resourceId':_0x2d483e['id'],'type':_0x3859a3['name'],'sectionId':_0x3859a3['id']},{})['then'](function(){return _0x106d25;});}else{return _0x106d25;}})[_0x21cc('0x3f')](function(_0x23574c){logger[_0x21cc('0x28')](_0x21cc('0x4d'),_0x23574c);throw _0x23574c;});}return _0x106d25;})[_0x21cc('0x23')](respondWithResult(_0x261960,0xc9))[_0x21cc('0x3f')](handleError(_0x261960,null));};exports[_0x21cc('0x22')]=function(_0x35b9c0,_0x36da5f){if(_0x35b9c0[_0x21cc('0x47')]['id']){delete _0x35b9c0[_0x21cc('0x47')]['id'];}return db[_0x21cc('0x3c')][_0x21cc('0x45')]({'where':{'id':_0x35b9c0[_0x21cc('0x41')]['id']}})[_0x21cc('0x23')](handleEntityNotFound(_0x36da5f,null))[_0x21cc('0x23')](saveUpdates(_0x35b9c0[_0x21cc('0x47')],null))[_0x21cc('0x23')](respondWithResult(_0x36da5f,null))[_0x21cc('0x3f')](handleError(_0x36da5f,null));};exports[_0x21cc('0x24')]=function(_0x1f9f1a,_0x3d4746){return db[_0x21cc('0x3c')]['find']({'where':{'id':_0x1f9f1a[_0x21cc('0x41')]['id']}})[_0x21cc('0x23')](handleEntityNotFound(_0x3d4746,null))['then'](removeEntity(_0x3d4746,null))['catch'](handleError(_0x3d4746,null));};exports[_0x21cc('0x2b')]=function(_0xf65a7,_0x385b71){return db[_0x21cc('0x3c')][_0x21cc('0x2b')]()[_0x21cc('0x23')](respondWithResult(_0x385b71,null))[_0x21cc('0x3f')](handleError(_0x385b71,null));};exports[_0x21cc('0x4e')]=function(_0x567e34,_0x5765c0,_0x430ce4){return db[_0x21cc('0x4f')]['find']({'where':{'id':_0x567e34[_0x21cc('0x41')]['id']}})[_0x21cc('0x23')](handleEntityNotFound(_0x5765c0,null))[_0x21cc('0x23')](function(_0x20143b){if(_0x20143b){return _0x20143b[_0x21cc('0x4e')](_0x567e34[_0x21cc('0x47')]['ids'],_[_0x21cc('0x50')](_0x567e34['body'],[_0x21cc('0x51'),'id'])||{});}})[_0x21cc('0x23')](respondWithResult(_0x5765c0,null))['catch'](handleError(_0x5765c0,null));};exports['getContacts']=function(_0x50f951,_0x4b511f,_0x57d519){var _0x34b38a={};var _0x56d597={};var _0x518519;var _0x164510;return db[_0x21cc('0x3c')]['findOne']({'where':{'id':_0x50f951[_0x21cc('0x41')]['id']}})[_0x21cc('0x23')](handleEntityNotFound(_0x4b511f,null))['then'](function(_0x3ea9c6){if(_0x3ea9c6){_0x518519=_0x3ea9c6;_0x56d597[_0x21cc('0x2c')]=_[_0x21cc('0x2d')](db['CmContact']['rawAttributes']);_0x56d597['query']=_[_0x21cc('0x2d')](_0x50f951[_0x21cc('0x2e')]);_0x56d597[_0x21cc('0x2f')]=_[_0x21cc('0x30')](_0x56d597[_0x21cc('0x2c')],_0x56d597[_0x21cc('0x2e')]);_0x34b38a[_0x21cc('0x32')]=_[_0x21cc('0x30')](_0x56d597[_0x21cc('0x2c')],qs[_0x21cc('0x31')](_0x50f951['query']['fields']));_0x34b38a[_0x21cc('0x32')]=_0x34b38a[_0x21cc('0x32')][_0x21cc('0x43')]?_0x34b38a['attributes']:_0x56d597[_0x21cc('0x2c')];_0x34b38a[_0x21cc('0x35')]=qs[_0x21cc('0x36')](_0x50f951[_0x21cc('0x2e')][_0x21cc('0x36')]);_0x34b38a[_0x21cc('0x37')]=qs[_0x21cc('0x2f')](_['pick'](_0x50f951[_0x21cc('0x2e')],_0x56d597[_0x21cc('0x2f')]));if(_0x50f951['query'][_0x21cc('0x39')]){_0x34b38a[_0x21cc('0x37')]=_[_0x21cc('0x3a')](_0x34b38a['where'],{'$or':_['map'](_0x34b38a['attributes'],function(_0x1f8216){var _0x104727={};_0x104727[_0x1f8216]={'$like':'%'+_0x50f951[_0x21cc('0x2e')]['filter']+'%'};return _0x104727;})});}_0x34b38a=_[_0x21cc('0x3a')]({},_0x34b38a,_0x50f951[_0x21cc('0x3b')]);return _0x518519[_0x21cc('0x52')](_0x34b38a);}})[_0x21cc('0x23')](function(_0x2d7387){if(_0x2d7387){_0x164510=_0x2d7387['length'];if(!_0x50f951[_0x21cc('0x2e')]['hasOwnProperty'](_0x21cc('0x34'))){_0x34b38a[_0x21cc('0x1c')]=qs['limit'](_0x50f951['query'][_0x21cc('0x1c')]);_0x34b38a[_0x21cc('0x1a')]=qs['offset'](_0x50f951['query'][_0x21cc('0x1a')]);}return _0x518519['getContacts'](_0x34b38a);}})[_0x21cc('0x23')](function(_0x392b39){if(_0x392b39){return _0x392b39?{'count':_0x164510,'rows':_0x392b39}:null;}})[_0x21cc('0x23')](respondWithResult(_0x4b511f,null))[_0x21cc('0x3f')](handleError(_0x4b511f,null));}; \ No newline at end of file +var _0x21e1=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','get','Companies','UserProfileResource','destroy','then','error','stack','name','send','index','CmCompany','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','includeAll','findAll','catch','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids','getContacts','findOne','sort'];(function(_0x4c2c40,_0x337dcd){var _0xa1e0ac=function(_0x28d215){while(--_0x28d215){_0x4c2c40['push'](_0x4c2c40['shift']());}};_0xa1e0ac(++_0x337dcd);}(_0x21e1,0x9e));var _0x121e=function(_0x27c2f2,_0x256d40){_0x27c2f2=_0x27c2f2-0x0;var _0x3425d6=_0x21e1[_0x27c2f2];return _0x3425d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x121e('0x0'));var zipdir=require(_0x121e('0x1'));var jsonpatch=require(_0x121e('0x2'));var rp=require(_0x121e('0x3'));var moment=require('moment');var BPromise=require(_0x121e('0x4'));var Mustache=require(_0x121e('0x5'));var util=require('util');var path=require(_0x121e('0x6'));var sox=require(_0x121e('0x7'));var csv=require(_0x121e('0x8'));var ejs=require(_0x121e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x121e('0xa'));var squel=require(_0x121e('0xb'));var crypto=require(_0x121e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x121e('0xd'));var Redis=require(_0x121e('0xe'));var authService=require(_0x121e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x121e('0x10'));var hardwareService=require(_0x121e('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x121e('0x12'));var db=require(_0x121e('0x13'))['db'];function respondWithStatusCode(_0x2e225d,_0x15bd2c){_0x15bd2c=_0x15bd2c||0xcc;return function(_0x5d81d1){if(_0x5d81d1){return _0x2e225d[_0x121e('0x14')](_0x15bd2c);}return _0x2e225d[_0x121e('0x15')](_0x15bd2c)[_0x121e('0x16')]();};}function respondWithResult(_0x14e342,_0x5241fa){_0x5241fa=_0x5241fa||0xc8;return function(_0x42ec76){if(_0x42ec76){return _0x14e342[_0x121e('0x15')](_0x5241fa)[_0x121e('0x17')](_0x42ec76);}};}function respondWithFilteredResult(_0x9dbb87,_0x2468c6){return function(_0x417b68){if(_0x417b68){var _0x210ae5=typeof _0x2468c6[_0x121e('0x18')]===_0x121e('0x19')&&typeof _0x2468c6[_0x121e('0x1a')]===_0x121e('0x19');var _0x192b7e=_0x417b68[_0x121e('0x1b')];var _0x2c56b3=_0x210ae5?0x0:_0x2468c6[_0x121e('0x18')];var _0x2ca479=_0x210ae5?_0x417b68[_0x121e('0x1b')]:_0x2468c6[_0x121e('0x18')]+_0x2468c6[_0x121e('0x1a')];var _0x52d9ed;if(_0x2ca479>=_0x192b7e){_0x2ca479=_0x192b7e;_0x52d9ed=0xc8;}else{_0x52d9ed=0xce;}_0x9dbb87[_0x121e('0x15')](_0x52d9ed);return _0x9dbb87[_0x121e('0x1c')](_0x121e('0x1d'),_0x2c56b3+'-'+_0x2ca479+'/'+_0x192b7e)['json'](_0x417b68);}return null;};}function patchUpdates(_0xab268){return function(_0x268457){try{jsonpatch[_0x121e('0x1e')](_0x268457,_0xab268,!![]);}catch(_0x5dca76){return BPromise['reject'](_0x5dca76);}return _0x268457['save']();};}function saveUpdates(_0x598fb4,_0x357110){return function(_0x2d1566){if(_0x2d1566){return _0x2d1566[_0x121e('0x1f')](_0x598fb4)['then'](function(_0x1cd9fd){return _0x1cd9fd;});}return null;};}function removeEntity(_0x8b667f,_0x175cda){return function(_0x21366e){if(_0x21366e){return _0x21366e['destroy']()['then'](function(){var _0x268b14=_0x21366e[_0x121e('0x20')]({'plain':!![]});var _0x998831=_0x121e('0x21');return db[_0x121e('0x22')][_0x121e('0x23')]({'where':{'type':_0x998831,'resourceId':_0x268b14['id']}})[_0x121e('0x24')](function(){return _0x21366e;});})[_0x121e('0x24')](function(){_0x8b667f[_0x121e('0x15')](0xcc)[_0x121e('0x16')]();});}};}function handleEntityNotFound(_0x1b74bd,_0x4d76b7){return function(_0x8a4ab0){if(!_0x8a4ab0){_0x1b74bd['sendStatus'](0x194);}return _0x8a4ab0;};}function handleError(_0x36c305,_0xec36bc){_0xec36bc=_0xec36bc||0x1f4;return function(_0x1d5349){logger[_0x121e('0x25')](_0x1d5349[_0x121e('0x26')]);if(_0x1d5349['name']){delete _0x1d5349[_0x121e('0x27')];}_0x36c305[_0x121e('0x15')](_0xec36bc)[_0x121e('0x28')](_0x1d5349);};}exports[_0x121e('0x29')]=function(_0x5ab5b1,_0x5be233){var _0x306bee={},_0x30c33a={},_0xd58107={'count':0x0,'rows':[]};return db[_0x121e('0x2a')]['describe']()[_0x121e('0x24')](function(_0x28d90b){_0x30c33a[_0x121e('0x2b')]=_['keys'](_0x28d90b);_0x30c33a[_0x121e('0x2c')]=_['keys'](_0x5ab5b1[_0x121e('0x2c')]);_0x30c33a[_0x121e('0x2d')]=_[_0x121e('0x2e')](_0x30c33a[_0x121e('0x2b')],_0x30c33a[_0x121e('0x2c')]);_0x306bee[_0x121e('0x2f')]=_[_0x121e('0x2e')](_0x30c33a['model'],qs[_0x121e('0x30')](_0x5ab5b1['query']['fields']));_0x306bee['attributes']=_0x306bee['attributes'][_0x121e('0x31')]?_0x306bee[_0x121e('0x2f')]:_0x30c33a[_0x121e('0x2b')];if(!_0x5ab5b1['query'][_0x121e('0x32')](_0x121e('0x33'))){_0x306bee[_0x121e('0x1a')]=qs[_0x121e('0x1a')](_0x5ab5b1[_0x121e('0x2c')]['limit']);_0x306bee[_0x121e('0x18')]=qs[_0x121e('0x18')](_0x5ab5b1['query']['offset']);}_0x306bee[_0x121e('0x34')]=qs['sort'](_0x5ab5b1[_0x121e('0x2c')]['sort']);_0x306bee['where']=qs[_0x121e('0x2d')](_[_0x121e('0x35')](_0x5ab5b1[_0x121e('0x2c')],_0x30c33a['filters']),_0x28d90b);if(_0x5ab5b1[_0x121e('0x2c')][_0x121e('0x36')]){_0x306bee[_0x121e('0x37')]=_[_0x121e('0x38')](_0x306bee['where'],{'$or':_['map'](_0x306bee['attributes'],function(_0xc59642){var _0x3e6c86={};_0x3e6c86[_0xc59642]={'$like':'%'+_0x5ab5b1['query'][_0x121e('0x36')]+'%'};return _0x3e6c86;})});}_0x306bee=_[_0x121e('0x38')]({},_0x306bee,_0x5ab5b1[_0x121e('0x39')]);var _0x2406b6={'where':_0x306bee[_0x121e('0x37')]};return db[_0x121e('0x2a')][_0x121e('0x1b')](_0x2406b6)[_0x121e('0x24')](function(_0x48e1af){_0xd58107[_0x121e('0x1b')]=_0x48e1af;if(_0x5ab5b1[_0x121e('0x2c')][_0x121e('0x3a')]){_0x306bee['include']=[{'all':!![]}];}return db['CmCompany'][_0x121e('0x3b')](_0x306bee);})[_0x121e('0x24')](function(_0x1d29c0){_0xd58107['rows']=_0x1d29c0;return _0xd58107;})[_0x121e('0x24')](respondWithFilteredResult(_0x5be233,_0x306bee))[_0x121e('0x3c')](handleError(_0x5be233,null));})[_0x121e('0x3c')](handleError(_0x5be233,null));};exports['show']=function(_0x134814,_0x20d37f){var _0x3e9884={'raw':![],'where':{'id':_0x134814['params']['id']}},_0x148f83={};_0x148f83[_0x121e('0x2b')]=_[_0x121e('0x3d')](db[_0x121e('0x2a')][_0x121e('0x3e')]);_0x148f83[_0x121e('0x2c')]=_[_0x121e('0x3d')](_0x134814[_0x121e('0x2c')]);_0x148f83['filters']=_[_0x121e('0x2e')](_0x148f83[_0x121e('0x2b')],_0x148f83[_0x121e('0x2c')]);_0x3e9884[_0x121e('0x2f')]=_[_0x121e('0x2e')](_0x148f83['model'],qs[_0x121e('0x30')](_0x134814[_0x121e('0x2c')]['fields']));_0x3e9884[_0x121e('0x2f')]=_0x3e9884[_0x121e('0x2f')][_0x121e('0x31')]?_0x3e9884[_0x121e('0x2f')]:_0x148f83[_0x121e('0x2b')];if(_0x134814[_0x121e('0x2c')][_0x121e('0x3a')]){_0x3e9884['include']=[{'all':!![]}];}_0x3e9884=_[_0x121e('0x38')]({},_0x3e9884,_0x134814[_0x121e('0x39')]);return db[_0x121e('0x2a')][_0x121e('0x3f')](_0x3e9884)['then'](handleEntityNotFound(_0x20d37f,null))['then'](respondWithResult(_0x20d37f,null))[_0x121e('0x3c')](handleError(_0x20d37f,null));};exports[_0x121e('0x40')]=function(_0x3d6a7b,_0x2c33d5){return db[_0x121e('0x2a')][_0x121e('0x40')](_0x3d6a7b['body'],{})[_0x121e('0x24')](function(_0x2bd298){var _0x4d56d8=_0x3d6a7b[_0x121e('0x41')]['get']({'plain':!![]});if(!_0x4d56d8)throw new Error(_0x121e('0x42'));if(_0x4d56d8[_0x121e('0x43')]==='user'){var _0x29f31c=_0x2bd298[_0x121e('0x20')]({'plain':!![]});var _0x5e7eec=_0x121e('0x21');return db[_0x121e('0x44')][_0x121e('0x3f')]({'where':{'name':_0x5e7eec,'userProfileId':_0x4d56d8['userProfileId']},'raw':!![]})[_0x121e('0x24')](function(_0x375de1){if(_0x375de1&&_0x375de1[_0x121e('0x45')]===0x0){return db[_0x121e('0x22')][_0x121e('0x40')]({'name':_0x29f31c[_0x121e('0x27')],'resourceId':_0x29f31c['id'],'type':_0x375de1['name'],'sectionId':_0x375de1['id']},{})[_0x121e('0x24')](function(){return _0x2bd298;});}else{return _0x2bd298;}})[_0x121e('0x3c')](function(_0x243f12){logger[_0x121e('0x25')](_0x121e('0x46'),_0x243f12);throw _0x243f12;});}return _0x2bd298;})[_0x121e('0x24')](respondWithResult(_0x2c33d5,0xc9))[_0x121e('0x3c')](handleError(_0x2c33d5,null));};exports['update']=function(_0x4f6d9c,_0x57a7ce){if(_0x4f6d9c[_0x121e('0x47')]['id']){delete _0x4f6d9c[_0x121e('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x4f6d9c[_0x121e('0x48')]['id']}})[_0x121e('0x24')](handleEntityNotFound(_0x57a7ce,null))[_0x121e('0x24')](saveUpdates(_0x4f6d9c[_0x121e('0x47')],null))['then'](respondWithResult(_0x57a7ce,null))[_0x121e('0x3c')](handleError(_0x57a7ce,null));};exports[_0x121e('0x23')]=function(_0x5c73fc,_0x2b3de5){return db[_0x121e('0x2a')][_0x121e('0x3f')]({'where':{'id':_0x5c73fc[_0x121e('0x48')]['id']}})[_0x121e('0x24')](handleEntityNotFound(_0x2b3de5,null))[_0x121e('0x24')](removeEntity(_0x2b3de5,null))[_0x121e('0x3c')](handleError(_0x2b3de5,null));};exports['describe']=function(_0x338cb2,_0x531c65){return db[_0x121e('0x2a')]['describe']()[_0x121e('0x24')](respondWithResult(_0x531c65,null))[_0x121e('0x3c')](handleError(_0x531c65,null));};exports[_0x121e('0x49')]=function(_0x1ad829,_0x4ffbbd,_0x504d88){return db[_0x121e('0x4a')][_0x121e('0x3f')]({'where':{'id':_0x1ad829[_0x121e('0x48')]['id']}})[_0x121e('0x24')](handleEntityNotFound(_0x4ffbbd,null))[_0x121e('0x24')](function(_0x55cb5e){if(_0x55cb5e){return _0x55cb5e[_0x121e('0x49')](_0x1ad829[_0x121e('0x47')][_0x121e('0x4b')],_['omit'](_0x1ad829[_0x121e('0x47')],[_0x121e('0x4b'),'id'])||{});}})[_0x121e('0x24')](respondWithResult(_0x4ffbbd,null))[_0x121e('0x3c')](handleError(_0x4ffbbd,null));};exports[_0x121e('0x4c')]=function(_0x4947db,_0x3e820d,_0x3e323c){var _0x5081a5={};var _0x3afe4a={};var _0x3e0e99;var _0x44260c;return db['CmCompany'][_0x121e('0x4d')]({'where':{'id':_0x4947db[_0x121e('0x48')]['id']}})[_0x121e('0x24')](handleEntityNotFound(_0x3e820d,null))[_0x121e('0x24')](function(_0x46dfe6){if(_0x46dfe6){_0x3e0e99=_0x46dfe6;_0x3afe4a[_0x121e('0x2b')]=_['keys'](db['CmContact']['rawAttributes']);_0x3afe4a['query']=_['keys'](_0x4947db[_0x121e('0x2c')]);_0x3afe4a[_0x121e('0x2d')]=_[_0x121e('0x2e')](_0x3afe4a[_0x121e('0x2b')],_0x3afe4a[_0x121e('0x2c')]);_0x5081a5['attributes']=_[_0x121e('0x2e')](_0x3afe4a[_0x121e('0x2b')],qs[_0x121e('0x30')](_0x4947db[_0x121e('0x2c')][_0x121e('0x30')]));_0x5081a5[_0x121e('0x2f')]=_0x5081a5[_0x121e('0x2f')]['length']?_0x5081a5[_0x121e('0x2f')]:_0x3afe4a['model'];_0x5081a5['order']=qs['sort'](_0x4947db[_0x121e('0x2c')][_0x121e('0x4e')]);_0x5081a5[_0x121e('0x37')]=qs['filters'](_[_0x121e('0x35')](_0x4947db[_0x121e('0x2c')],_0x3afe4a[_0x121e('0x2d')]));if(_0x4947db[_0x121e('0x2c')][_0x121e('0x36')]){_0x5081a5['where']=_['merge'](_0x5081a5[_0x121e('0x37')],{'$or':_['map'](_0x5081a5[_0x121e('0x2f')],function(_0x4fe72e){var _0x5f44e3={};_0x5f44e3[_0x4fe72e]={'$like':'%'+_0x4947db['query'][_0x121e('0x36')]+'%'};return _0x5f44e3;})});}_0x5081a5=_[_0x121e('0x38')]({},_0x5081a5,_0x4947db['options']);return _0x3e0e99[_0x121e('0x4c')](_0x5081a5);}})[_0x121e('0x24')](function(_0x287dc3){if(_0x287dc3){_0x44260c=_0x287dc3['length'];if(!_0x4947db[_0x121e('0x2c')][_0x121e('0x32')](_0x121e('0x33'))){_0x5081a5[_0x121e('0x1a')]=qs['limit'](_0x4947db[_0x121e('0x2c')][_0x121e('0x1a')]);_0x5081a5[_0x121e('0x18')]=qs[_0x121e('0x18')](_0x4947db['query'][_0x121e('0x18')]);}return _0x3e0e99[_0x121e('0x4c')](_0x5081a5);}})[_0x121e('0x24')](function(_0x220fdf){if(_0x220fdf){return _0x220fdf?{'count':_0x44260c,'rows':_0x220fdf}:null;}})['then'](respondWithResult(_0x3e820d,null))[_0x121e('0x3c')](handleError(_0x3e820d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c393b0b..5ad2c34 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 _0xd2f8=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x9ba548,_0x3e7164){var _0x35b867=function(_0x12f483){while(--_0x12f483){_0x9ba548['push'](_0x9ba548['shift']());}};_0x35b867(++_0x3e7164);}(_0xd2f8,0x15d));var _0x8d2f=function(_0x1263cc,_0x34b0a6){_0x1263cc=_0x1263cc-0x0;var _0x4132a0=_0xd2f8[_0x1263cc];return _0x4132a0;};'use strict';var _=require(_0x8d2f('0x0'));var util=require(_0x8d2f('0x1'));var logger=require(_0x8d2f('0x2'))(_0x8d2f('0x3'));var moment=require(_0x8d2f('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d2f('0x5'));var fs=require('fs');var path=require(_0x8d2f('0x6'));var rimraf=require(_0x8d2f('0x7'));var config=require(_0x8d2f('0x8'));var attributes=require(_0x8d2f('0x9'));module[_0x8d2f('0xa')]=function(_0x465f48,_0x48e3ca){return _0x465f48[_0x8d2f('0xb')](_0x8d2f('0xc'),attributes,{'tableName':_0x8d2f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x221f=['exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x1f8af6,_0x53d3d4){var _0x571552=function(_0x23b4cb){while(--_0x23b4cb){_0x1f8af6['push'](_0x1f8af6['shift']());}};_0x571552(++_0x53d3d4);}(_0x221f,0x6c));var _0xf221=function(_0xe7d07d,_0x52e4e3){_0xe7d07d=_0xe7d07d-0x0;var _0x229e46=_0x221f[_0xe7d07d];return _0x229e46;};'use strict';var _=require(_0xf221('0x0'));var util=require(_0xf221('0x1'));var logger=require(_0xf221('0x2'))(_0xf221('0x3'));var moment=require('moment');var BPromise=require(_0xf221('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf221('0x5'));var rimraf=require(_0xf221('0x6'));var config=require(_0xf221('0x7'));var attributes=require(_0xf221('0x8'));module[_0xf221('0x9')]=function(_0x3c1d27,_0x470e3e){return _0x3c1d27[_0xf221('0xa')](_0xf221('0xb'),attributes,{'tableName':_0xf221('0xc'),'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 d436a49..8ac0c9f 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 _0x869c=['http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x29a30d,_0x5d0800){var _0x102801=function(_0x13ea89){while(--_0x13ea89){_0x29a30d['push'](_0x29a30d['shift']());}};_0x102801(++_0x5d0800);}(_0x869c,0x198));var _0xc869=function(_0x12f2c2,_0x9e8677){_0x12f2c2=_0x12f2c2-0x0;var _0x3ea4d7=_0x869c[_0x12f2c2];return _0x3ea4d7;};'use strict';var _=require(_0xc869('0x0'));var util=require(_0xc869('0x1'));var moment=require(_0xc869('0x2'));var BPromise=require(_0xc869('0x3'));var rs=require(_0xc869('0x4'));var fs=require('fs');var Redis=require(_0xc869('0x5'));var db=require(_0xc869('0x6'))['db'];var utils=require(_0xc869('0x7'));var logger=require(_0xc869('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc869('0x9')][_0xc869('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d4c1c,_0x2ff0fc,_0x317349){return new BPromise(function(_0x3314df,_0x32225f){return client[_0xc869('0xb')](_0x4d4c1c,_0x317349)['then'](function(_0xb9a2b7){logger[_0xc869('0xc')](_0xc869('0xd'),_0x2ff0fc,_0xc869('0xe'));logger[_0xc869('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2ff0fc,_0xc869('0xe'),JSON[_0xc869('0x10')](_0xb9a2b7));if(_0xb9a2b7[_0xc869('0x11')]){if(_0xb9a2b7['error']['code']===0x1f4){logger[_0xc869('0x11')](_0xc869('0xd'),_0x2ff0fc,_0xb9a2b7['error'][_0xc869('0x12')]);return _0x32225f(_0xb9a2b7[_0xc869('0x11')][_0xc869('0x12')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x2ff0fc,_0xb9a2b7[_0xc869('0x11')][_0xc869('0x12')]);return _0x3314df(_0xb9a2b7[_0xc869('0x11')]['message']);}else{logger['info'](_0xc869('0xd'),_0x2ff0fc,_0xc869('0xe'));_0x3314df(_0xb9a2b7['result'][_0xc869('0x12')]);}})['catch'](function(_0x29004a){logger[_0xc869('0x11')]('CmCompany,\x20%s,\x20%s',_0x2ff0fc,_0x29004a);_0x32225f(_0x29004a);});});} \ No newline at end of file +var _0x0495=['info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x0495,0x16f));var _0x5049=function(_0x2180eb,_0x1f17dd){_0x2180eb=_0x2180eb-0x0;var _0x2dcbdd=_0x0495[_0x2180eb];return _0x2dcbdd;};'use strict';var _=require(_0x5049('0x0'));var util=require('util');var moment=require(_0x5049('0x1'));var BPromise=require(_0x5049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5049('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5049('0x4'))(_0x5049('0x5'));var config=require(_0x5049('0x6'));var jayson=require(_0x5049('0x7'));var client=jayson[_0x5049('0x8')][_0x5049('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ad12e,_0x5ab252,_0x1978a5){return new BPromise(function(_0x218a57,_0x25aa9d){return client['request'](_0x4ad12e,_0x1978a5)[_0x5049('0xa')](function(_0x386207){logger[_0x5049('0xb')](_0x5049('0xc'),_0x5ab252,'request\x20sent');logger['debug'](_0x5049('0xd'),_0x5ab252,_0x5049('0xe'),JSON[_0x5049('0xf')](_0x386207));if(_0x386207[_0x5049('0x10')]){if(_0x386207[_0x5049('0x10')][_0x5049('0x11')]===0x1f4){logger[_0x5049('0x10')](_0x5049('0xc'),_0x5ab252,_0x386207[_0x5049('0x10')]['message']);return _0x25aa9d(_0x386207['error']['message']);}logger[_0x5049('0x10')](_0x5049('0xc'),_0x5ab252,_0x386207[_0x5049('0x10')][_0x5049('0x12')]);return _0x218a57(_0x386207['error'][_0x5049('0x12')]);}else{logger[_0x5049('0xb')]('CmCompany,\x20%s,\x20%s',_0x5ab252,'request\x20sent');_0x218a57(_0x386207[_0x5049('0x13')]['message']);}})[_0x5049('0x14')](function(_0x1c05aa){logger[_0x5049('0x10')]('CmCompany,\x20%s,\x20%s',_0x5ab252,_0x1c05aa);_0x25aa9d(_0x1c05aa);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 38c3c87..2440d77 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 _0x9eab=['/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x8d0c91,_0x26ba76){var _0x2e48c8=function(_0x5ded95){while(--_0x5ded95){_0x8d0c91['push'](_0x8d0c91['shift']());}};_0x2e48c8(++_0x26ba76);}(_0x9eab,0x185));var _0xb9ea=function(_0x7ae6c6,_0x29301f){_0x7ae6c6=_0x7ae6c6-0x0;var _0x523c8d=_0x9eab[_0x7ae6c6];return _0x523c8d;};'use strict';var multer=require('multer');var util=require(_0xb9ea('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9ea('0x1'));var router=express[_0xb9ea('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb9ea('0x3'));var interaction=require(_0xb9ea('0x4'));var config=require(_0xb9ea('0x5'));var controller=require('./cmCompany.controller');router[_0xb9ea('0x6')]('/',auth[_0xb9ea('0x7')](),controller[_0xb9ea('0x8')]);router['get']('/describe',auth[_0xb9ea('0x7')](),controller[_0xb9ea('0x9')]);router[_0xb9ea('0x6')](_0xb9ea('0xa'),auth['isAuthenticated'](),controller[_0xb9ea('0xb')]);router[_0xb9ea('0x6')](_0xb9ea('0xc'),auth[_0xb9ea('0x7')](),controller[_0xb9ea('0xd')]);router[_0xb9ea('0xe')]('/',auth[_0xb9ea('0x7')](),controller[_0xb9ea('0xf')]);router['post'](_0xb9ea('0xc'),auth[_0xb9ea('0x7')](),controller[_0xb9ea('0x10')]);router[_0xb9ea('0x11')]('/:id',auth[_0xb9ea('0x7')](),controller[_0xb9ea('0x12')]);router[_0xb9ea('0x13')](_0xb9ea('0xa'),auth[_0xb9ea('0x7')](),controller[_0xb9ea('0x14')]);module['exports']=router; \ No newline at end of file +var _0x311d=['get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','addContacts','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller'];(function(_0x521ec1,_0x21951d){var _0x22aba7=function(_0x43bafe){while(--_0x43bafe){_0x521ec1['push'](_0x521ec1['shift']());}};_0x22aba7(++_0x21951d);}(_0x311d,0x120));var _0xd311=function(_0x4dbb3c,_0x9767a9){_0x4dbb3c=_0x4dbb3c-0x0;var _0x4feeff=_0x311d[_0x4dbb3c];return _0x4feeff;};'use strict';var multer=require(_0xd311('0x0'));var util=require(_0xd311('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd311('0x2'));var auth=require(_0xd311('0x3'));var interaction=require(_0xd311('0x4'));var config=require('../../config/environment');var controller=require(_0xd311('0x5'));router[_0xd311('0x6')]('/',auth[_0xd311('0x7')](),controller[_0xd311('0x8')]);router[_0xd311('0x6')](_0xd311('0x9'),auth[_0xd311('0x7')](),controller[_0xd311('0xa')]);router['get'](_0xd311('0xb'),auth[_0xd311('0x7')](),controller[_0xd311('0xc')]);router[_0xd311('0x6')]('/:id/contacts',auth[_0xd311('0x7')](),controller[_0xd311('0xd')]);router[_0xd311('0xe')]('/',auth[_0xd311('0x7')](),controller[_0xd311('0xf')]);router['post']('/:id/contacts',auth[_0xd311('0x7')](),controller[_0xd311('0x10')]);router['put'](_0xd311('0xb'),auth[_0xd311('0x7')](),controller[_0xd311('0x11')]);router[_0xd311('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd311('0x13')]);module[_0xd311('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index bb67ab4..453d0a7 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 _0xab3f=['UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xab3f,0x1a3));var _0xfab3=function(_0x1781de,_0x5c4b38){_0x1781de=_0x1781de-0x0;var _0x48d7fc=_0xab3f[_0x1781de];return _0x48d7fc;};'use strict';var _=require(_0xfab3('0x0'));var Sequelize=require(_0xfab3('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xfab3('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfab3('0x2')]},'street':{'type':Sequelize[_0xfab3('0x2')]},'postalCode':{'type':Sequelize[_0xfab3('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xfab3('0x2')]},'dateOfBirth':{'type':Sequelize[_0xfab3('0x2')]},'description':{'type':Sequelize[_0xfab3('0x3')]},'phone':{'type':Sequelize[_0xfab3('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfab3('0x2')]},'email':{'type':Sequelize[_0xfab3('0x2')]},'url':{'type':Sequelize[_0xfab3('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xfab3('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xfab3('0x2')]},'viber':{'type':Sequelize[_0xfab3('0x2')]},'line':{'type':Sequelize[_0xfab3('0x2')]},'wechat':{'type':Sequelize[_0xfab3('0x2')]},'telegram':{'type':Sequelize[_0xfab3('0x2')]},'UserId':{'type':Sequelize[_0xfab3('0x4')]},'priority':{'type':Sequelize[_0xfab3('0x4')](0x2)[_0xfab3('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfab3('0x6')],'defaultValue':Sequelize[_0xfab3('0x7')]}}; \ No newline at end of file +var _0x2438=['sequelize','exports','STRING','TEXT','INTEGER','lodash'];(function(_0x40d60f,_0x396a00){var _0xa52e4=function(_0x1f8bf5){while(--_0x1f8bf5){_0x40d60f['push'](_0x40d60f['shift']());}};_0xa52e4(++_0x396a00);}(_0x2438,0x1c7));var _0x8243=function(_0x65f140,_0x45cbc7){_0x65f140=_0x65f140-0x0;var _0x18fbda=_0x2438[_0x65f140];return _0x18fbda;};'use strict';var _=require(_0x8243('0x0'));var Sequelize=require(_0x8243('0x1'));module[_0x8243('0x2')]={'firstName':{'type':Sequelize[_0x8243('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8243('0x3')]},'city':{'type':Sequelize[_0x8243('0x3')]},'country':{'type':Sequelize[_0x8243('0x3')]},'dateOfBirth':{'type':Sequelize[_0x8243('0x3')]},'description':{'type':Sequelize[_0x8243('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x8243('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x8243('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x8243('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x8243('0x3')]},'telegram':{'type':Sequelize[_0x8243('0x3')]},'UserId':{'type':Sequelize[_0x8243('0x5')]},'priority':{'type':Sequelize[_0x8243('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 42bdb16..32b9db1 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 _0xd6a8=['then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','keys','length','startsWith','cf_','CmCustomField','findOne','trimStart','fieldType','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','expr','search','parseSearch','sqlOperator','conditions','find','value','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','start','Contact','push','isEmpty','forEach','ListId','concat','\x20=\x20?','tag','isArray','filter','replace','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','map','sequelize','toString','merge','c.firstName','c.phone','c.mobile','c.fax','c.email','c.CompanyId','TagIds','Tags','rows','catch','describe','columnName','displayName','findAll','alias','custom','body','get','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','bulkCreate','duplicates','$or','findOrCreate','show','params','Tag','isNil','$and','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','values','phone','options','setTags','ids','getHoppers','include','getHopperHistories','rawAttributes','ContactId','pick','includeAll','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','chmodSync','0777','fork','CompanyId','pid','createReadStream','file','parse','meta','No\x20ListId\x20specified','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','sms','openchannel','fax','whatsapp','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','voice','starttime','endtime','note','userDisposition','userSecondDisposition','UserId','createdAt','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','subject','threadId','Interaction','fullname','all','flatten','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','count','limit','Content-Range','update'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xd6a8,0xf7));var _0x8d6a=function(_0x4959db,_0xf7835a){_0x4959db=_0x4959db-0x0;var _0x4e7f43=_0xd6a8[_0x4959db];return _0x4e7f43;};'use strict';var moment=require(_0x8d6a('0x0'));var BPromise=require(_0x8d6a('0x1'));var util=require(_0x8d6a('0x2'));var path=require(_0x8d6a('0x3'));var fs=require('fs');var _=require(_0x8d6a('0x4'));var squel=require(_0x8d6a('0x5'));var Papa=require(_0x8d6a('0x6'));var Redis=require(_0x8d6a('0x7'));var qs=require(_0x8d6a('0x8'));var as=require(_0x8d6a('0x9'));var logger=require(_0x8d6a('0xa'))(_0x8d6a('0xb'));var config=require(_0x8d6a('0xc'));var db=require(_0x8d6a('0xd'))['db'];config[_0x8d6a('0xe')]=_['defaults'](config[_0x8d6a('0xe')],{'host':_0x8d6a('0xf'),'port':0x18eb});var socket=require(_0x8d6a('0x10'))(new Redis(config[_0x8d6a('0xe')]));require('./cmContact.socket')[_0x8d6a('0x11')](socket);function respondWithResult(_0x4ccb2e,_0x4287e2){_0x4287e2=_0x4287e2||0xc8;return function(_0x260436){if(_0x260436){return _0x4ccb2e[_0x8d6a('0x12')](_0x4287e2)[_0x8d6a('0x13')](_0x260436);}};}function respondWithFilteredResult(_0x1b1a8c,_0x3bd776){return function(_0x527978){if(_0x527978){var _0x4dd3e4=typeof _0x3bd776[_0x8d6a('0x14')]===_0x8d6a('0x15')&&typeof _0x3bd776['limit']===_0x8d6a('0x15');var _0x533e51=_0x527978[_0x8d6a('0x16')];var _0x21ff4f=_0x4dd3e4?0x0:_0x3bd776[_0x8d6a('0x14')];var _0x1e855f=_0x4dd3e4?_0x527978[_0x8d6a('0x16')]:_0x3bd776[_0x8d6a('0x14')]+_0x3bd776[_0x8d6a('0x17')];var _0x49c4c3;if(_0x1e855f>=_0x533e51){_0x1e855f=_0x533e51;_0x49c4c3=0xc8;}else{_0x49c4c3=0xce;}_0x1b1a8c['status'](_0x49c4c3);return _0x1b1a8c['set'](_0x8d6a('0x18'),_0x21ff4f+'-'+_0x1e855f+'/'+_0x533e51)['json'](_0x527978);}return null;};}function saveUpdates(_0x13f143){return function(_0x1f1312){if(_0x1f1312){return _0x1f1312[_0x8d6a('0x19')](_0x13f143)[_0x8d6a('0x1a')](function(_0x1e9ad6){return _0x1e9ad6;});}return null;};}function removeEntity(_0x2f92ab){return function(_0xd637e2){if(_0xd637e2){return _0xd637e2[_0x8d6a('0x1b')]()[_0x8d6a('0x1a')](function(){_0x2f92ab[_0x8d6a('0x12')](0xcc)[_0x8d6a('0x1c')]();});}};}function handleEntityNotFound(_0x3db921){return function(_0x42b471){if(!_0x42b471){_0x3db921[_0x8d6a('0x1d')](0x194);}return _0x42b471;};}function handleError(_0x488f37,_0x59c4f7){_0x59c4f7=_0x59c4f7||0x1f4;return function(_0x23411e){logger[_0x8d6a('0x1e')](_0x23411e[_0x8d6a('0x1f')]);if(_0x23411e[_0x8d6a('0x20')]){delete _0x23411e[_0x8d6a('0x20')];}_0x488f37[_0x8d6a('0x12')](_0x59c4f7)[_0x8d6a('0x21')](_0x23411e);};}exports[_0x8d6a('0x22')]=function(_0x4bfe69,_0xf5acf){var _0x2ff890={},_0x4a506a={},_0x20e546={'count':0x0,'rows':[]};return db[_0x8d6a('0x23')]['describe']()[_0x8d6a('0x1a')](function(_0x28da73){var _0x414196=[];for(var _0x526017=0x0;_0x5260170x1){_0x2bb84a['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8d6a('0x5f')](_0x54465e),null);}else{if(qs['isNumeric'](_0x54465e)){_0x2bb84a['or'](_0x8d6a('0x60'),_0x54465e+'%');_0x2bb84a['or']('c.phone\x20LIKE\x20?',_0x54465e+'%');_0x2bb84a['or'](_0x8d6a('0x61'),_0x54465e+'%');_0x2bb84a['or'](_0x8d6a('0x62'),_0x54465e+'%');}else if(qs[_0x8d6a('0x63')](_0x54465e)){_0x2bb84a['or'](_0x8d6a('0x64'),_0x54465e+'%');}else{_0x2bb84a['or']('c.firstName\x20LIKE\x20?','%'+_0x54465e+'%');_0x2bb84a['or'](_0x8d6a('0x65'),'%'+_0x54465e+'%');_0x2bb84a['or'](_0x8d6a('0x64'),'%'+_0x54465e+'%');}}}}_0x1cb850[_0x8d6a('0x36')](_0x2bb84a);_0x1cb850['group']('c.id');var _0x461244={'type':db[_0x8d6a('0x66')][_0x8d6a('0x67')][_0x8d6a('0x68')],'raw':!![]};var _0x4f10c5=_0x1cb850[_0x8d6a('0x69')]()[_0x8d6a('0x37')]('c.id');if(_0x2ff890[_0x8d6a('0x34')]){_0x2ff890[_0x8d6a('0x34')][_0x8d6a('0x57')](function(_0x1c8864){_0x1cb850['order']('c.'+_0x1c8864[0x0],_0x1c8864[0x1]===_0x8d6a('0x6a')?![]:!![]);});}if(!_['isEmpty'](_0x392f1f)){_0x1cb850[_0x8d6a('0x6b')](_0x4c38dc);_0x4f10c5[_0x8d6a('0x36')](_0x8d6a('0x6c'),_0x392f1f);}BPromise[_0x8d6a('0x6d')]()[_0x8d6a('0x1a')](function(){if(!_0x60ad4a)return;if(_0x4bfe69[_0x8d6a('0x6e')][_0x8d6a('0x6f')]!==_0x8d6a('0x70'))return;if(!_['some'](_0x60ad4a[_0x8d6a('0x43')],[_0x8d6a('0x37'),'User'])){return _0x4bfe69[_0x8d6a('0x6e')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x397e1e){if(_[_0x8d6a('0x56')](_0x397e1e)){_0x4f10c5['where']('c.ListId\x20IS\x20NULL');_0x1cb850[_0x8d6a('0x36')](_0x8d6a('0x71'));}else{_0x4f10c5['where'](_0x8d6a('0x72'),_[_0x8d6a('0x73')](_0x397e1e,'id'));_0x1cb850['where']('c.ListId\x20IN\x20?',_[_0x8d6a('0x73')](_0x397e1e,'id'));}});}})['then'](function(){if(_0x4bfe69[_0x8d6a('0x6e')]['role']===_0x8d6a('0x70')&&!_0x60ad4a&&!_0x4bfe69[_0x8d6a('0x2f')][_0x8d6a('0x58')])return[];return db[_0x8d6a('0x74')]['query'](_0x4f10c5[_0x8d6a('0x75')](),_0x461244);})[_0x8d6a('0x1a')](function(_0x368215){_0x20e546[_0x8d6a('0x16')]=_0x368215[_0x8d6a('0x25')];if(_0x20e546[_0x8d6a('0x16')]===0x0)return[];return db['sequelize'][_0x8d6a('0x2f')](_0x5cb275[_0x8d6a('0x75')](),_0x461244)[_0x8d6a('0x1a')](function(_0x3e5239){_0x3c526e=_['keyBy'](_0x3e5239,'id');_0x461244=_[_0x8d6a('0x76')](_0x461244,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bfe69[_0x8d6a('0x2f')][_0x8d6a('0x30')]){_0x2ff890[_0x8d6a('0x31')][_0x8d6a('0x57')](function(_0xafb87e){_0x1cb850['field']('c.'+_0xafb87e);});}else{_0x1cb850[_0x8d6a('0x37')]('c.id');_0x1cb850['field'](_0x8d6a('0x77'));_0x1cb850[_0x8d6a('0x37')]('c.lastName');_0x1cb850[_0x8d6a('0x37')](_0x8d6a('0x78'));_0x1cb850[_0x8d6a('0x37')](_0x8d6a('0x79'));_0x1cb850[_0x8d6a('0x37')](_0x8d6a('0x7a'));_0x1cb850[_0x8d6a('0x37')](_0x8d6a('0x7b'));_0x1cb850['field']('c.ListId');_0x1cb850['field']('c.createdAt');_0x1cb850[_0x8d6a('0x37')]('c.deletedAt');_0x1cb850[_0x8d6a('0x37')](_0x8d6a('0x7c'));_0x1cb850['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8d6a('0x7d'));}if(_0x2ff890[_0x8d6a('0x17')])_0x1cb850[_0x8d6a('0x17')](_0x2ff890[_0x8d6a('0x17')]);if(_0x2ff890[_0x8d6a('0x14')])_0x1cb850[_0x8d6a('0x14')](_0x2ff890[_0x8d6a('0x14')]);return db[_0x8d6a('0x74')][_0x8d6a('0x2f')](_0x1cb850[_0x8d6a('0x75')](),_0x461244);});})['then'](function(_0x532e94){_0x532e94[_0x8d6a('0x57')](function(_0x1334bd){if(_0x1334bd[_0x8d6a('0x7d')]){_0x1334bd[_0x8d6a('0x7e')]=[];_0x1334bd[_0x8d6a('0x7d')][_0x8d6a('0x46')](',')['forEach'](function(_0x44b733){_0x1334bd['Tags'][_0x8d6a('0x55')](_0x3c526e[_0x44b733]);});}delete _0x1334bd[_0x8d6a('0x7d')];});_0x20e546[_0x8d6a('0x7f')]=_0x532e94;return _0x20e546;})[_0x8d6a('0x1a')](respondWithFilteredResult(_0xf5acf,_0x2ff890));})[_0x8d6a('0x80')](handleError(_0xf5acf,null));};exports[_0x8d6a('0x1b')]=function(_0x49afb8,_0x5d58fc){return db[_0x8d6a('0x23')][_0x8d6a('0x44')]({'where':{'id':_0x49afb8['params']['id']}})[_0x8d6a('0x1a')](handleEntityNotFound(_0x5d58fc,null))[_0x8d6a('0x1a')](removeEntity(_0x5d58fc,null))[_0x8d6a('0x80')](handleError(_0x5d58fc,null));};exports[_0x8d6a('0x81')]=function(_0x5546c4,_0x137cf8){return db['CmContact'][_0x8d6a('0x81')]()[_0x8d6a('0x1a')](function(_0x28f2ee){delete _0x28f2ee['tags'];for(var _0x4b2776=0x0;_0x4b2776=_0xe5e1b7){_0x460292=_0xe5e1b7;_0x583601=0xc8;}else{_0x583601=0xce;}_0x4e9c22[_0xaa2e('0x10')](_0x583601);return _0x4e9c22[_0xaa2e('0x16')](_0xaa2e('0x17'),_0x32b31d+'-'+_0x460292+'/'+_0xe5e1b7)[_0xaa2e('0x11')](_0x17c059);}return null;};}function saveUpdates(_0x4b81b3){return function(_0x8704ab){if(_0x8704ab){return _0x8704ab[_0xaa2e('0x18')](_0x4b81b3)['then'](function(_0x599905){return _0x599905;});}return null;};}function removeEntity(_0x58a09a){return function(_0x399b2f){if(_0x399b2f){return _0x399b2f[_0xaa2e('0x19')]()['then'](function(){_0x58a09a[_0xaa2e('0x10')](0xcc)[_0xaa2e('0x1a')]();});}};}function handleEntityNotFound(_0x585560){return function(_0x2e62c8){if(!_0x2e62c8){_0x585560[_0xaa2e('0x1b')](0x194);}return _0x2e62c8;};}function handleError(_0x3334dd,_0x271290){_0x271290=_0x271290||0x1f4;return function(_0x549427){logger[_0xaa2e('0x1c')](_0x549427[_0xaa2e('0x1d')]);if(_0x549427['name']){delete _0x549427[_0xaa2e('0x1e')];}_0x3334dd['status'](_0x271290)[_0xaa2e('0x1f')](_0x549427);};}exports[_0xaa2e('0x20')]=function(_0x23fe74,_0x3c6e07){var _0x154464={},_0x3b8f9e={},_0x16d1cb={'count':0x0,'rows':[]};return db[_0xaa2e('0x21')][_0xaa2e('0x22')]()[_0xaa2e('0x23')](function(_0x2b18ad){var _0x9d6228=[];for(var _0x494b1e=0x0;_0x494b1e0x1){_0x1958c3['or'](_0xaa2e('0x62'),qs['getFullTextValue'](_0xdf79eb),null);}else{if(qs[_0xaa2e('0x63')](_0xdf79eb)){_0x1958c3['or'](_0xaa2e('0x64'),_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x65'),_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x66'),_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x67'),_0xdf79eb+'%');}else if(qs[_0xaa2e('0x68')](_0xdf79eb)){_0x1958c3['or']('c.email\x20LIKE\x20?',_0xdf79eb+'%');}else{_0x1958c3['or'](_0xaa2e('0x69'),'%'+_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x6a'),'%'+_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x6b'),'%'+_0xdf79eb+'%');}}}}_0x2f64d0['where'](_0x1958c3);_0x2f64d0[_0xaa2e('0x6c')](_0xaa2e('0x6d'));var _0x485e18={'type':db[_0xaa2e('0x6e')][_0xaa2e('0x6f')][_0xaa2e('0x70')],'raw':!![]};var _0x261f4c=_0x2f64d0[_0xaa2e('0x71')]()[_0xaa2e('0x39')]('c.id');if(_0x154464[_0xaa2e('0x72')]){_0x154464['order'][_0xaa2e('0x59')](function(_0x51f957){_0x2f64d0[_0xaa2e('0x72')]('c.'+_0x51f957[0x0],_0x51f957[0x1]===_0xaa2e('0x73')?![]:!![]);});}if(!_[_0xaa2e('0x74')](_0x38f078)){_0x2f64d0[_0xaa2e('0x75')](_0x43427b);_0x261f4c[_0xaa2e('0x36')]('t.id\x20IN\x20?',_0x38f078);}BPromise['resolve']()[_0xaa2e('0x23')](function(){if(!_0x450dbb)return;if(_0x23fe74[_0xaa2e('0x76')][_0xaa2e('0x77')]!=='agent')return;if(!_[_0xaa2e('0x78')](_0x450dbb['conditions'],['field',_0xaa2e('0x79')])){return _0x23fe74[_0xaa2e('0x76')][_0xaa2e('0x7a')]({'attributes':['id'],'raw':!![]})[_0xaa2e('0x23')](function(_0x5f2eaa){if(_['isEmpty'](_0x5f2eaa)){_0x261f4c[_0xaa2e('0x36')](_0xaa2e('0x7b'));_0x2f64d0[_0xaa2e('0x36')](_0xaa2e('0x7b'));}else{_0x261f4c['where'](_0xaa2e('0x5b'),_[_0xaa2e('0x49')](_0x5f2eaa,'id'));_0x2f64d0[_0xaa2e('0x36')](_0xaa2e('0x5b'),_[_0xaa2e('0x49')](_0x5f2eaa,'id'));}});}})[_0xaa2e('0x23')](function(){if(_0x23fe74[_0xaa2e('0x76')]['role']===_0xaa2e('0x7c')&&!_0x450dbb&&!_0x23fe74[_0xaa2e('0x2f')][_0xaa2e('0x5a')])return[];return db[_0xaa2e('0x7d')][_0xaa2e('0x2f')](_0x261f4c[_0xaa2e('0x7e')](),_0x485e18);})[_0xaa2e('0x23')](function(_0x36d18a){_0x16d1cb[_0xaa2e('0x15')]=_0x36d18a[_0xaa2e('0x25')];if(_0x16d1cb[_0xaa2e('0x15')]===0x0)return[];return db[_0xaa2e('0x7d')]['query'](_0x393019[_0xaa2e('0x7e')](),_0x485e18)[_0xaa2e('0x23')](function(_0x5d19d7){_0x2f87db=_['keyBy'](_0x5d19d7,'id');_0x485e18=_[_0xaa2e('0x7f')](_0x485e18,{'model':db[_0xaa2e('0x21')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x23fe74[_0xaa2e('0x2f')][_0xaa2e('0x32')]){_0x154464[_0xaa2e('0x31')][_0xaa2e('0x59')](function(_0x41eda5){_0x2f64d0[_0xaa2e('0x39')]('c.'+_0x41eda5);});}else{_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x6d'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x80'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x81'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x82'));_0x2f64d0[_0xaa2e('0x39')]('c.mobile');_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x83'));_0x2f64d0['field'](_0xaa2e('0x84'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x85'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x86'));_0x2f64d0['field'](_0xaa2e('0x87'));_0x2f64d0[_0xaa2e('0x39')]('c.CompanyId');_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x88'),_0xaa2e('0x89'));}if(_0x154464[_0xaa2e('0x14')])_0x2f64d0[_0xaa2e('0x14')](_0x154464['limit']);if(_0x154464[_0xaa2e('0x12')])_0x2f64d0[_0xaa2e('0x12')](_0x154464[_0xaa2e('0x12')]);return db['sequelize'][_0xaa2e('0x2f')](_0x2f64d0[_0xaa2e('0x7e')](),_0x485e18);});})[_0xaa2e('0x23')](function(_0x32c32d){_0x32c32d[_0xaa2e('0x59')](function(_0x265e86){if(_0x265e86[_0xaa2e('0x89')]){_0x265e86[_0xaa2e('0x8a')]=[];_0x265e86[_0xaa2e('0x89')][_0xaa2e('0x61')](',')[_0xaa2e('0x59')](function(_0x276ec3){_0x265e86['Tags'][_0xaa2e('0x27')](_0x2f87db[_0x276ec3]);});}delete _0x265e86[_0xaa2e('0x89')];});_0x16d1cb[_0xaa2e('0x8b')]=_0x32c32d;return _0x16d1cb;})['then'](respondWithFilteredResult(_0x3c6e07,_0x154464));})[_0xaa2e('0x8c')](handleError(_0x3c6e07,null));};exports[_0xaa2e('0x19')]=function(_0x1ff225,_0x3ee0c0){return db[_0xaa2e('0x21')][_0xaa2e('0x48')]({'where':{'id':_0x1ff225[_0xaa2e('0x8d')]['id']}})[_0xaa2e('0x23')](handleEntityNotFound(_0x3ee0c0,null))[_0xaa2e('0x23')](removeEntity(_0x3ee0c0,null))[_0xaa2e('0x8c')](handleError(_0x3ee0c0,null));};exports['describe']=function(_0x578c73,_0x2747ce){return db[_0xaa2e('0x21')][_0xaa2e('0x22')]()[_0xaa2e('0x23')](function(_0x4da960){delete _0x4da960['tags'];for(var _0x185727=0x0;_0x185727{}\s\\|]/g,'-');_0x443afb(null,util[_0x14b4('0x21')](_0x14b4('0x22'),path['basename'](_0x34f397[_0x14b4('0x20')],path[_0x14b4('0x23')](_0x34f397[_0x14b4('0x20')])),Date[_0x14b4('0x24')](),path['extname'](_0x34f397[_0x14b4('0x20')])));}})});router['post'](_0x14b4('0x25'),upload[_0x14b4('0x26')](_0x14b4('0x27')),controller[_0x14b4('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4fbee4,_0x53454e,_0x29200c){_0x29200c(null,path[_0x14b4('0x1d')](config['root'],'server/files/tmp'));},'filename':function(_0x1a5dcb,_0x796c02,_0x12e2c3){_0x796c02['originalname']=_0x796c02[_0x14b4('0x20')][_0x14b4('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x12e2c3(null,util[_0x14b4('0x21')](_0x14b4('0x22'),path[_0x14b4('0x2a')](_0x796c02[_0x14b4('0x20')],path[_0x14b4('0x23')](_0x796c02[_0x14b4('0x20')])),Date[_0x14b4('0x24')](),path['extname'](_0x796c02[_0x14b4('0x20')])));}})});router[_0x14b4('0x16')](_0x14b4('0x2b'),upload[_0x14b4('0x26')]('file'),controller[_0x14b4('0x2c')]);router[_0x14b4('0x16')](_0x14b4('0x2d'),auth[_0x14b4('0xa')](),controller[_0x14b4('0x2e')]);router['put'](_0x14b4('0xb'),auth['isAuthenticated'](),controller[_0x14b4('0x2f')]);router['delete']('/:id',auth[_0x14b4('0xa')](),controller[_0x14b4('0x30')]);module[_0x14b4('0x31')]=router; \ No newline at end of file +var _0x552d=['originalname','replace','format','%s-%s%s','basename','extname','now','file','uploadCsv','/upload','single','upload','/:id','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','isAuthenticated','index','get','/describe','describe','show','/:id/tags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJourney','/merge','merge','post','create','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp'];(function(_0x1e14cc,_0x136b67){var _0x4b7f9a=function(_0x56eceb){while(--_0x56eceb){_0x1e14cc['push'](_0x1e14cc['shift']());}};_0x4b7f9a(++_0x136b67);}(_0x552d,0x1bf));var _0xd552=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x552d[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xd552('0x0'));var util=require('util');var path=require(_0xd552('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd552('0x2')]();var fs_extra=require(_0xd552('0x3'));var auth=require(_0xd552('0x4'));var interaction=require(_0xd552('0x5'));var config=require(_0xd552('0x6'));var controller=require(_0xd552('0x7'));router['get']('/',auth[_0xd552('0x8')](),controller[_0xd552('0x9')]);router[_0xd552('0xa')](_0xd552('0xb'),auth[_0xd552('0x8')](),controller[_0xd552('0xc')]);router['get']('/:id',auth[_0xd552('0x8')](),controller[_0xd552('0xd')]);router[_0xd552('0xa')](_0xd552('0xe'),auth['isAuthenticated'](),controller['getTags']);router[_0xd552('0xa')](_0xd552('0xf'),auth['isAuthenticated'](),controller[_0xd552('0x10')]);router[_0xd552('0xa')](_0xd552('0x11'),auth[_0xd552('0x8')](),controller[_0xd552('0x12')]);router[_0xd552('0xa')](_0xd552('0x13'),auth[_0xd552('0x8')](),controller['getHopperFinals']);router[_0xd552('0xa')](_0xd552('0x14'),auth['isAuthenticated'](),controller['getJscriptySessions']);router[_0xd552('0xa')]('/:id/journey',auth[_0xd552('0x8')](),controller[_0xd552('0x15')]);router['post'](_0xd552('0x16'),auth['isAuthenticated'](),controller[_0xd552('0x17')]);router[_0xd552('0x18')]('/',auth['isAuthenticated'](),controller[_0xd552('0x19')]);router[_0xd552('0x18')](_0xd552('0x1a'),auth[_0xd552('0x8')](),controller[_0xd552('0x1b')]);router[_0xd552('0x18')]('/:id/tags',auth[_0xd552('0x8')](),controller[_0xd552('0x1c')]);var upload=multer({'storage':multer[_0xd552('0x1d')]({'destination':function(_0x541384,_0x442e70,_0x408aea){_0x408aea(null,path[_0xd552('0x1e')](config[_0xd552('0x1f')],_0xd552('0x20')));},'filename':function(_0xe43627,_0x28611c,_0x7f1e3a){_0x28611c['originalname']=_0x28611c[_0xd552('0x21')][_0xd552('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x7f1e3a(null,util[_0xd552('0x23')](_0xd552('0x24'),path[_0xd552('0x25')](_0x28611c[_0xd552('0x21')],path[_0xd552('0x26')](_0x28611c['originalname'])),Date[_0xd552('0x27')](),path[_0xd552('0x26')](_0x28611c[_0xd552('0x21')])));}})});router[_0xd552('0x18')]('/csv',upload['single'](_0xd552('0x28')),controller[_0xd552('0x29')]);var upload=multer({'storage':multer[_0xd552('0x1d')]({'destination':function(_0x5874dc,_0x42effb,_0x470d75){_0x470d75(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x2f1d8d,_0x2fae59,_0x53840d){_0x2fae59[_0xd552('0x21')]=_0x2fae59['originalname'][_0xd552('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53840d(null,util[_0xd552('0x23')](_0xd552('0x24'),path[_0xd552('0x25')](_0x2fae59[_0xd552('0x21')],path['extname'](_0x2fae59[_0xd552('0x21')])),Date[_0xd552('0x27')](),path[_0xd552('0x26')](_0x2fae59['originalname'])));}})});router[_0xd552('0x18')](_0xd552('0x2a'),upload[_0xd552('0x2b')]('file'),controller[_0xd552('0x2c')]);router[_0xd552('0x18')]('/upload/:id',auth[_0xd552('0x8')](),controller['import']);router['put'](_0xd552('0x2d'),auth[_0xd552('0x8')](),controller[_0xd552('0x2e')]);router[_0xd552('0x2f')](_0xd552('0x2d'),auth[_0xd552('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 72e977d..064c2a9 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 _0x612e=['select','parse','values','isArray','BOOLEAN','ENUM','voice','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x612e,0xd7));var _0xe612=function(_0x559f10,_0x112c00){_0x559f10=_0x559f10-0x0;var _0x2bacf7=_0x612e[_0x559f10];return _0x2bacf7;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe612('0x0'));module['exports']={'name':{'type':Sequelize[_0xe612('0x1')],'get':function(_0x3ff2d5){return this[_0xe612('0x2')](_0xe612('0x3'));}},'alias':{'type':Sequelize[_0xe612('0x4')],'allowNull':![],'set':function(_0x3140e9){this[_0xe612('0x5')](_0xe612('0x3'),_0x3140e9?_0x3140e9:this[_0xe612('0x2')](_0xe612('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xe612('0x7')]('long'),'get':function(){if(this['getDataValue'](_0xe612('0x8'))===_0xe612('0x9')){return JSON[_0xe612('0xa')](this['getDataValue'](_0xe612('0xb')));}else{return this[_0xe612('0x2')](_0xe612('0xb'));}},'set':function(_0x40824c){if(Array[_0xe612('0xc')](_0x40824c)){this['setDataValue'](_0xe612('0xb'),JSON['stringify'](_0x40824c));}else{this['setDataValue'](_0xe612('0xb'),_0x40824c);}}},'required':{'type':Sequelize[_0xe612('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe612('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe612('0xe')](_0xe612('0xf'))}}; \ No newline at end of file +var _0x6cf0=['values','isArray','setDataValue','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','type','select'];(function(_0x548607,_0x40b0fa){var _0x42f095=function(_0x199e32){while(--_0x199e32){_0x548607['push'](_0x548607['shift']());}};_0x42f095(++_0x40b0fa);}(_0x6cf0,0xe6));var _0x06cf=function(_0x1964f1,_0x5bb78e){_0x1964f1=_0x1964f1-0x0;var _0x57bd50=_0x6cf0[_0x1964f1];return _0x57bd50;};'use strict';var Sequelize=require(_0x06cf('0x0'));var _=require(_0x06cf('0x1'));module[_0x06cf('0x2')]={'name':{'type':Sequelize[_0x06cf('0x3')],'get':function(_0x21d49c){return this[_0x06cf('0x4')](_0x06cf('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2213fe){this['setDataValue']('alias',_0x2213fe?_0x2213fe:this[_0x06cf('0x4')]('name'));}},'type':{'type':Sequelize[_0x06cf('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x06cf('0x7')]('long'),'get':function(){if(this[_0x06cf('0x4')](_0x06cf('0x8'))===_0x06cf('0x9')){return JSON['parse'](this['getDataValue'](_0x06cf('0xa')));}else{return this[_0x06cf('0x4')](_0x06cf('0xa'));}},'set':function(_0x4484f0){if(Array[_0x06cf('0xb')](_0x4484f0)){this['setDataValue']('values',JSON['stringify'](_0x4484f0));}else{this[_0x06cf('0xc')](_0x06cf('0xa'),_0x4484f0);}}},'required':{'type':Sequelize[_0x06cf('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x06cf('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x06cf('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 9f29c85..1a65feb 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 _0x08a2=['include','body','find','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','queryInterface','format','cf_%d','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','send','index','rawAttributes','fieldName','type','model','differenceBy','map','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmCustomField','rows','catch','show','params'];(function(_0x29dc35,_0x1f1be3){var _0x3993d8=function(_0x512901){while(--_0x512901){_0x29dc35['push'](_0x29dc35['shift']());}};_0x3993d8(++_0x1f1be3);}(_0x08a2,0x15f));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x208a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x208a('0x1'));var rp=require(_0x208a('0x2'));var moment=require(_0x208a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x208a('0x4'));var path=require(_0x208a('0x5'));var sox=require(_0x208a('0x6'));var csv=require(_0x208a('0x7'));var ejs=require(_0x208a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x208a('0x9'));var squel=require('squel');var crypto=require(_0x208a('0xa'));var jsforce=require(_0x208a('0xb'));var deskjs=require(_0x208a('0xc'));var toCsv=require(_0x208a('0x7'));var querystring=require('querystring');var Papa=require(_0x208a('0xd'));var Redis=require(_0x208a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x208a('0xf'));var as=require(_0x208a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x208a('0x11'))(_0x208a('0x12'));var utils=require(_0x208a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x208a('0x14'));var db=require(_0x208a('0x15'))['db'];function respondWithStatusCode(_0xd14437,_0x4ee1e5){_0x4ee1e5=_0x4ee1e5||0xcc;return function(_0x2c9391){if(_0x2c9391){return _0xd14437[_0x208a('0x16')](_0x4ee1e5);}return _0xd14437[_0x208a('0x17')](_0x4ee1e5)[_0x208a('0x18')]();};}function respondWithResult(_0x4a82f4,_0x538526){_0x538526=_0x538526||0xc8;return function(_0x5c762a){if(_0x5c762a){return _0x4a82f4[_0x208a('0x17')](_0x538526)[_0x208a('0x19')](_0x5c762a);}};}function respondWithFilteredResult(_0x474d9d,_0x1b2c01){return function(_0x15003f){if(_0x15003f){var _0xfd1ceb=typeof _0x1b2c01[_0x208a('0x1a')]===_0x208a('0x1b')&&typeof _0x1b2c01[_0x208a('0x1c')]==='undefined';var _0x86e992=_0x15003f[_0x208a('0x1d')];var _0x27760b=_0xfd1ceb?0x0:_0x1b2c01['offset'];var _0x8a74ea=_0xfd1ceb?_0x15003f[_0x208a('0x1d')]:_0x1b2c01[_0x208a('0x1a')]+_0x1b2c01['limit'];var _0x11ca3e;if(_0x8a74ea>=_0x86e992){_0x8a74ea=_0x86e992;_0x11ca3e=0xc8;}else{_0x11ca3e=0xce;}_0x474d9d[_0x208a('0x17')](_0x11ca3e);return _0x474d9d[_0x208a('0x1e')](_0x208a('0x1f'),_0x27760b+'-'+_0x8a74ea+'/'+_0x86e992)[_0x208a('0x19')](_0x15003f);}return null;};}function patchUpdates(_0x988a73){return function(_0x10b537){try{jsonpatch[_0x208a('0x20')](_0x10b537,_0x988a73,!![]);}catch(_0x52e7ab){return BPromise[_0x208a('0x21')](_0x52e7ab);}return _0x10b537['save']();};}function saveUpdates(_0xa572fa,_0x4a2863){return function(_0x374d9e){if(_0x374d9e){return _0x374d9e[_0x208a('0x22')](_0xa572fa)['then'](function(_0xbfd188){return _0xbfd188;});}return null;};}function removeEntity(_0x1a4f05,_0x5d0ff6){return function(_0x1635de){if(_0x1635de){return _0x1635de[_0x208a('0x23')]()[_0x208a('0x24')](function(){_0x1a4f05[_0x208a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24cf0,_0x3b8f5f){return function(_0x431444){if(!_0x431444){_0x24cf0[_0x208a('0x16')](0x194);}return _0x431444;};}function handleError(_0x20585e,_0x1df26c){_0x1df26c=_0x1df26c||0x1f4;return function(_0x4f62d2){logger[_0x208a('0x25')](_0x4f62d2[_0x208a('0x26')]);if(_0x4f62d2['name']){delete _0x4f62d2['name'];}_0x20585e[_0x208a('0x17')](_0x1df26c)[_0x208a('0x27')](_0x4f62d2);};}exports[_0x208a('0x28')]=function(_0x320b62,_0x1a7257){var _0x411406={},_0x4bc9a4={},_0x5eb227={'count':0x0,'rows':[]};var _0x316b9e=_['map'](db['CmCustomField'][_0x208a('0x29')],function(_0x389299){return{'name':_0x389299[_0x208a('0x2a')],'type':_0x389299[_0x208a('0x2b')]['key']};});_0x4bc9a4[_0x208a('0x2c')]=_[_0x208a('0x2d')](_[_0x208a('0x2e')](_0x316b9e,'name'),[_0x208a('0x2f')]);_0x4bc9a4['query']=_[_0x208a('0x30')](_0x320b62[_0x208a('0x31')]);_0x4bc9a4[_0x208a('0x32')]=_['intersection'](_0x4bc9a4[_0x208a('0x2c')],_0x4bc9a4['query']);_0x411406[_0x208a('0x33')]=_[_0x208a('0x34')](_0x4bc9a4['model'],qs['fields'](_0x320b62[_0x208a('0x31')][_0x208a('0x35')]));_0x411406[_0x208a('0x33')]=_0x411406['attributes'][_0x208a('0x36')]?_0x411406[_0x208a('0x33')]:_0x4bc9a4[_0x208a('0x2c')];if(!_0x320b62[_0x208a('0x31')][_0x208a('0x37')](_0x208a('0x38'))){_0x411406[_0x208a('0x1c')]=qs[_0x208a('0x1c')](_0x320b62['query'][_0x208a('0x1c')]);_0x411406[_0x208a('0x1a')]=qs[_0x208a('0x1a')](_0x320b62[_0x208a('0x31')][_0x208a('0x1a')]);}_0x411406[_0x208a('0x39')]=qs['sort'](_0x320b62[_0x208a('0x31')][_0x208a('0x3a')]);_0x411406[_0x208a('0x3b')]=qs[_0x208a('0x32')](_[_0x208a('0x3c')](_0x320b62['query'],_0x4bc9a4[_0x208a('0x32')]),_0x316b9e);if(_0x320b62[_0x208a('0x31')][_0x208a('0x3d')]){_0x411406[_0x208a('0x3b')]=_[_0x208a('0x3e')](_0x411406[_0x208a('0x3b')],{'$or':_['map'](_0x316b9e,function(_0x55efc6){if(_0x55efc6[_0x208a('0x2b')]!=='VIRTUAL'){var _0x4a4d7d={};_0x4a4d7d[_0x55efc6['name']]={'$like':'%'+_0x320b62[_0x208a('0x31')]['filter']+'%'};return _0x4a4d7d;}})});}_0x411406=_[_0x208a('0x3e')]({},_0x411406,_0x320b62[_0x208a('0x3f')]);var _0x4989a7={'where':_0x411406[_0x208a('0x3b')]};return db[_0x208a('0x40')][_0x208a('0x1d')](_0x4989a7)[_0x208a('0x24')](function(_0x2c99cf){_0x5eb227[_0x208a('0x1d')]=_0x2c99cf;if(_0x320b62['query']['includeAll']){_0x411406['include']=[{'all':!![]}];}return db[_0x208a('0x40')]['findAll'](_0x411406);})[_0x208a('0x24')](function(_0x202252){_0x5eb227[_0x208a('0x41')]=_0x202252;return _0x5eb227;})[_0x208a('0x24')](respondWithFilteredResult(_0x1a7257,_0x411406))[_0x208a('0x42')](handleError(_0x1a7257,null));};exports[_0x208a('0x43')]=function(_0xd47f51,_0x5801d6){var _0x44bb28={'raw':!![],'where':{'id':_0xd47f51[_0x208a('0x44')]['id']}},_0x20b453={};_0x20b453['model']=_[_0x208a('0x30')](db[_0x208a('0x40')][_0x208a('0x29')]);_0x20b453[_0x208a('0x31')]=_[_0x208a('0x30')](_0xd47f51['query']);_0x20b453['filters']=_[_0x208a('0x34')](_0x20b453[_0x208a('0x2c')],_0x20b453['query']);_0x44bb28[_0x208a('0x33')]=_[_0x208a('0x34')](_0x20b453[_0x208a('0x2c')],qs[_0x208a('0x35')](_0xd47f51[_0x208a('0x31')]['fields']));_0x44bb28['attributes']=_0x44bb28[_0x208a('0x33')]['length']?_0x44bb28[_0x208a('0x33')]:_0x20b453[_0x208a('0x2c')];if(_0xd47f51[_0x208a('0x31')]['includeAll']){_0x44bb28[_0x208a('0x45')]=[{'all':!![]}];}_0x44bb28=_[_0x208a('0x3e')]({},_0x44bb28,_0xd47f51[_0x208a('0x3f')]);return db['CmCustomField']['find'](_0x44bb28)[_0x208a('0x24')](handleEntityNotFound(_0x5801d6,null))[_0x208a('0x24')](respondWithResult(_0x5801d6,null))[_0x208a('0x42')](handleError(_0x5801d6,null));};exports[_0x208a('0x22')]=function(_0x3743a6,_0xb526d0){if(_0x3743a6[_0x208a('0x46')]['id']){delete _0x3743a6['body']['id'];}return db[_0x208a('0x40')][_0x208a('0x47')]({'where':{'id':_0x3743a6[_0x208a('0x44')]['id']}})[_0x208a('0x24')](handleEntityNotFound(_0xb526d0,null))[_0x208a('0x24')](saveUpdates(_0x3743a6[_0x208a('0x46')],null))[_0x208a('0x24')](respondWithResult(_0xb526d0,null))['catch'](handleError(_0xb526d0,null));};exports[_0x208a('0x23')]=function(_0x3828a4,_0x4861c1){return db[_0x208a('0x40')][_0x208a('0x47')]({'where':{'id':_0x3828a4[_0x208a('0x44')]['id']}})[_0x208a('0x24')](handleEntityNotFound(_0x4861c1,null))[_0x208a('0x24')](removeEntity(_0x4861c1,null))[_0x208a('0x42')](handleError(_0x4861c1,null));};exports['create']=function(_0x5623c8,_0x12728c){var _0x4b014f;return db[_0x208a('0x48')][_0x208a('0x49')](function(_0x555bef){return db[_0x208a('0x40')][_0x208a('0x4a')](_0x5623c8[_0x208a('0x46')],{'transaction':_0x555bef})[_0x208a('0x24')](function(_0x276842){_0x4b014f=_0x276842;var _0x5e831f={'type':db[_0x208a('0x4b')][_0x208a('0x4c')],'transaction':_0x555bef};switch(_0x5623c8[_0x208a('0x46')][_0x208a('0x2b')]){case _0x208a('0x4d'):_0x5e831f[_0x208a('0x2b')]=db[_0x208a('0x4b')][_0x208a('0x4c')];break;case _0x208a('0x4e'):_0x5e831f[_0x208a('0x2b')]=db[_0x208a('0x4b')][_0x208a('0x4f')];break;case'switch':_0x5e831f[_0x208a('0x2b')]=db[_0x208a('0x4b')][_0x208a('0x50')];_0x5e831f['defaultValue']=![];break;default:}return db['sequelize'][_0x208a('0x51')]['addColumn']('cm_contacts',util[_0x208a('0x52')](_0x208a('0x53'),_0x4b014f['id']),_0x5e831f);})['then'](function(){return _0x4b014f;});})['then'](respondWithResult(_0x12728c,0xc9))['catch'](handleError(_0x12728c,null));}; \ No newline at end of file +var _0xc307=['destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','CmCustomField','includeAll','rows','show','params','include','options','catch','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','addColumn','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','apply','update','then'];(function(_0xca9130,_0x2ba075){var _0x1f69e7=function(_0x333821){while(--_0x333821){_0xca9130['push'](_0xca9130['shift']());}};_0x1f69e7(++_0x2ba075);}(_0xc307,0x187));var _0x7c30=function(_0x464a79,_0x364eed){_0x464a79=_0x464a79-0x0;var _0x2919c8=_0xc307[_0x464a79];return _0x2919c8;};'use strict';var emlformat=require(_0x7c30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c30('0x1'));var jsonpatch=require(_0x7c30('0x2'));var rp=require(_0x7c30('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7c30('0x4'));var util=require('util');var path=require(_0x7c30('0x5'));var sox=require(_0x7c30('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c30('0x7'));var _=require(_0x7c30('0x8'));var squel=require(_0x7c30('0x9'));var crypto=require(_0x7c30('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7c30('0xb'));var toCsv=require(_0x7c30('0xc'));var querystring=require(_0x7c30('0xd'));var Papa=require(_0x7c30('0xe'));var Redis=require('ioredis');var authService=require(_0x7c30('0xf'));var qs=require(_0x7c30('0x10'));var as=require(_0x7c30('0x11'));var hardwareService=require(_0x7c30('0x12'));var logger=require('../../config/logger')(_0x7c30('0x13'));var utils=require(_0x7c30('0x14'));var config=require(_0x7c30('0x15'));var licenseUtil=require(_0x7c30('0x16'));var db=require(_0x7c30('0x17'))['db'];function respondWithStatusCode(_0x386b27,_0x47e8cc){_0x47e8cc=_0x47e8cc||0xcc;return function(_0x2482e0){if(_0x2482e0){return _0x386b27[_0x7c30('0x18')](_0x47e8cc);}return _0x386b27[_0x7c30('0x19')](_0x47e8cc)['end']();};}function respondWithResult(_0x51e681,_0x1cb6f1){_0x1cb6f1=_0x1cb6f1||0xc8;return function(_0x590599){if(_0x590599){return _0x51e681[_0x7c30('0x19')](_0x1cb6f1)[_0x7c30('0x1a')](_0x590599);}};}function respondWithFilteredResult(_0x3c0c40,_0x1ed10d){return function(_0x20d8e6){if(_0x20d8e6){var _0x5e7037=typeof _0x1ed10d[_0x7c30('0x1b')]==='undefined'&&typeof _0x1ed10d[_0x7c30('0x1c')]===_0x7c30('0x1d');var _0x4e4d3a=_0x20d8e6[_0x7c30('0x1e')];var _0x28d860=_0x5e7037?0x0:_0x1ed10d[_0x7c30('0x1b')];var _0x1be897=_0x5e7037?_0x20d8e6[_0x7c30('0x1e')]:_0x1ed10d[_0x7c30('0x1b')]+_0x1ed10d['limit'];var _0x5a64d7;if(_0x1be897>=_0x4e4d3a){_0x1be897=_0x4e4d3a;_0x5a64d7=0xc8;}else{_0x5a64d7=0xce;}_0x3c0c40['status'](_0x5a64d7);return _0x3c0c40['set']('Content-Range',_0x28d860+'-'+_0x1be897+'/'+_0x4e4d3a)[_0x7c30('0x1a')](_0x20d8e6);}return null;};}function patchUpdates(_0x1532ac){return function(_0x30bf21){try{jsonpatch[_0x7c30('0x1f')](_0x30bf21,_0x1532ac,!![]);}catch(_0x43a8dc){return BPromise['reject'](_0x43a8dc);}return _0x30bf21['save']();};}function saveUpdates(_0x468431,_0x449f64){return function(_0x293f07){if(_0x293f07){return _0x293f07[_0x7c30('0x20')](_0x468431)[_0x7c30('0x21')](function(_0x44cf7b){return _0x44cf7b;});}return null;};}function removeEntity(_0x419abe,_0x2f9d9d){return function(_0x11c842){if(_0x11c842){return _0x11c842[_0x7c30('0x22')]()['then'](function(){_0x419abe['status'](0xcc)[_0x7c30('0x23')]();});}};}function handleEntityNotFound(_0x46e8fe,_0x2abbc1){return function(_0x115947){if(!_0x115947){_0x46e8fe[_0x7c30('0x18')](0x194);}return _0x115947;};}function handleError(_0xa68cc0,_0x4c26dc){_0x4c26dc=_0x4c26dc||0x1f4;return function(_0x2232f7){logger[_0x7c30('0x24')](_0x2232f7[_0x7c30('0x25')]);if(_0x2232f7[_0x7c30('0x26')]){delete _0x2232f7[_0x7c30('0x26')];}_0xa68cc0[_0x7c30('0x19')](_0x4c26dc)[_0x7c30('0x27')](_0x2232f7);};}exports[_0x7c30('0x28')]=function(_0x404058,_0x321c7a){var _0x5bdb8b={},_0x32cba5={},_0x27d0e0={'count':0x0,'rows':[]};var _0x371abb=_['map'](db['CmCustomField'][_0x7c30('0x29')],function(_0x318e90){return{'name':_0x318e90[_0x7c30('0x2a')],'type':_0x318e90[_0x7c30('0x2b')][_0x7c30('0x2c')]};});_0x32cba5['model']=_[_0x7c30('0x2d')](_[_0x7c30('0x2e')](_0x371abb,_0x7c30('0x26')),[_0x7c30('0x26')]);_0x32cba5[_0x7c30('0x2f')]=_[_0x7c30('0x30')](_0x404058['query']);_0x32cba5['filters']=_['intersection'](_0x32cba5[_0x7c30('0x31')],_0x32cba5[_0x7c30('0x2f')]);_0x5bdb8b['attributes']=_[_0x7c30('0x32')](_0x32cba5['model'],qs[_0x7c30('0x33')](_0x404058['query'][_0x7c30('0x33')]));_0x5bdb8b['attributes']=_0x5bdb8b[_0x7c30('0x34')][_0x7c30('0x35')]?_0x5bdb8b[_0x7c30('0x34')]:_0x32cba5[_0x7c30('0x31')];if(!_0x404058['query'][_0x7c30('0x36')](_0x7c30('0x37'))){_0x5bdb8b[_0x7c30('0x1c')]=qs[_0x7c30('0x1c')](_0x404058[_0x7c30('0x2f')][_0x7c30('0x1c')]);_0x5bdb8b[_0x7c30('0x1b')]=qs[_0x7c30('0x1b')](_0x404058[_0x7c30('0x2f')][_0x7c30('0x1b')]);}_0x5bdb8b[_0x7c30('0x38')]=qs[_0x7c30('0x39')](_0x404058[_0x7c30('0x2f')][_0x7c30('0x39')]);_0x5bdb8b[_0x7c30('0x3a')]=qs['filters'](_['pick'](_0x404058[_0x7c30('0x2f')],_0x32cba5[_0x7c30('0x3b')]),_0x371abb);if(_0x404058['query'][_0x7c30('0x3c')]){_0x5bdb8b[_0x7c30('0x3a')]=_[_0x7c30('0x3d')](_0x5bdb8b['where'],{'$or':_[_0x7c30('0x2e')](_0x371abb,function(_0x43b642){if(_0x43b642[_0x7c30('0x2b')]!==_0x7c30('0x3e')){var _0x36d29b={};_0x36d29b[_0x43b642[_0x7c30('0x26')]]={'$like':'%'+_0x404058['query'][_0x7c30('0x3c')]+'%'};return _0x36d29b;}})});}_0x5bdb8b=_[_0x7c30('0x3d')]({},_0x5bdb8b,_0x404058['options']);var _0x4d1627={'where':_0x5bdb8b[_0x7c30('0x3a')]};return db[_0x7c30('0x3f')][_0x7c30('0x1e')](_0x4d1627)[_0x7c30('0x21')](function(_0x34f9b8){_0x27d0e0['count']=_0x34f9b8;if(_0x404058[_0x7c30('0x2f')][_0x7c30('0x40')]){_0x5bdb8b['include']=[{'all':!![]}];}return db[_0x7c30('0x3f')]['findAll'](_0x5bdb8b);})['then'](function(_0x5b23e8){_0x27d0e0[_0x7c30('0x41')]=_0x5b23e8;return _0x27d0e0;})[_0x7c30('0x21')](respondWithFilteredResult(_0x321c7a,_0x5bdb8b))['catch'](handleError(_0x321c7a,null));};exports[_0x7c30('0x42')]=function(_0x55c5d9,_0x34bbc0){var _0x1df436={'raw':!![],'where':{'id':_0x55c5d9[_0x7c30('0x43')]['id']}},_0x48a89e={};_0x48a89e[_0x7c30('0x31')]=_[_0x7c30('0x30')](db[_0x7c30('0x3f')][_0x7c30('0x29')]);_0x48a89e['query']=_[_0x7c30('0x30')](_0x55c5d9['query']);_0x48a89e[_0x7c30('0x3b')]=_[_0x7c30('0x32')](_0x48a89e[_0x7c30('0x31')],_0x48a89e[_0x7c30('0x2f')]);_0x1df436['attributes']=_[_0x7c30('0x32')](_0x48a89e[_0x7c30('0x31')],qs[_0x7c30('0x33')](_0x55c5d9['query']['fields']));_0x1df436[_0x7c30('0x34')]=_0x1df436[_0x7c30('0x34')][_0x7c30('0x35')]?_0x1df436['attributes']:_0x48a89e[_0x7c30('0x31')];if(_0x55c5d9[_0x7c30('0x2f')][_0x7c30('0x40')]){_0x1df436[_0x7c30('0x44')]=[{'all':!![]}];}_0x1df436=_[_0x7c30('0x3d')]({},_0x1df436,_0x55c5d9[_0x7c30('0x45')]);return db[_0x7c30('0x3f')]['find'](_0x1df436)['then'](handleEntityNotFound(_0x34bbc0,null))[_0x7c30('0x21')](respondWithResult(_0x34bbc0,null))[_0x7c30('0x46')](handleError(_0x34bbc0,null));};exports[_0x7c30('0x20')]=function(_0x5013c6,_0x4af21a){if(_0x5013c6[_0x7c30('0x47')]['id']){delete _0x5013c6[_0x7c30('0x47')]['id'];}return db['CmCustomField'][_0x7c30('0x48')]({'where':{'id':_0x5013c6['params']['id']}})[_0x7c30('0x21')](handleEntityNotFound(_0x4af21a,null))['then'](saveUpdates(_0x5013c6[_0x7c30('0x47')],null))[_0x7c30('0x21')](respondWithResult(_0x4af21a,null))[_0x7c30('0x46')](handleError(_0x4af21a,null));};exports[_0x7c30('0x22')]=function(_0x3ff5bc,_0x56a6bf){return db[_0x7c30('0x3f')][_0x7c30('0x48')]({'where':{'id':_0x3ff5bc[_0x7c30('0x43')]['id']}})[_0x7c30('0x21')](handleEntityNotFound(_0x56a6bf,null))[_0x7c30('0x21')](removeEntity(_0x56a6bf,null))[_0x7c30('0x46')](handleError(_0x56a6bf,null));};exports[_0x7c30('0x49')]=function(_0xdae192,_0x3ad57e){var _0xca568c;return db[_0x7c30('0x4a')][_0x7c30('0x4b')](function(_0x2a26d3){return db[_0x7c30('0x3f')]['create'](_0xdae192['body'],{'transaction':_0x2a26d3})[_0x7c30('0x21')](function(_0x2d2e27){_0xca568c=_0x2d2e27;var _0x22e353={'type':db[_0x7c30('0x4c')][_0x7c30('0x4d')],'transaction':_0x2a26d3};switch(_0xdae192['body'][_0x7c30('0x2b')]){case _0x7c30('0x4e'):_0x22e353['type']=db[_0x7c30('0x4c')][_0x7c30('0x4d')];break;case _0x7c30('0x4f'):_0x22e353[_0x7c30('0x2b')]=db[_0x7c30('0x4c')]['INTEGER'];break;case _0x7c30('0x50'):_0x22e353[_0x7c30('0x2b')]=db[_0x7c30('0x4c')][_0x7c30('0x51')];_0x22e353[_0x7c30('0x52')]=![];break;default:}return db[_0x7c30('0x4a')]['queryInterface'][_0x7c30('0x53')]('cm_contacts',util['format'](_0x7c30('0x54'),_0xca568c['id']),_0x22e353);})[_0x7c30('0x21')](function(){return _0xca568c;});})[_0x7c30('0x21')](respondWithResult(_0x3ad57e,0xc9))['catch'](handleError(_0x3ad57e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f911c9c..ade0ef7 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 _0x7095=['define','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x3fc2fe,_0x4dd01d){var _0x4d439e=function(_0x3f2576){while(--_0x3f2576){_0x3fc2fe['push'](_0x3fc2fe['shift']());}};_0x4d439e(++_0x4dd01d);}(_0x7095,0x187));var _0x5709=function(_0x3da143,_0x71b28b){_0x3da143=_0x3da143-0x0;var _0x299878=_0x7095[_0x3da143];return _0x299878;};'use strict';var _=require(_0x5709('0x0'));var util=require(_0x5709('0x1'));var logger=require(_0x5709('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5709('0x3'));var rp=require(_0x5709('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5709('0x5'));var config=require(_0x5709('0x6'));var attributes=require(_0x5709('0x7'));module[_0x5709('0x8')]=function(_0x3f66c6,_0xdb3adc){return _0x3f66c6[_0x5709('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e81=['../../config/logger','api','moment','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util'];(function(_0x225cfd,_0xb10c62){var _0x1ad768=function(_0x1b4f04){while(--_0x1b4f04){_0x225cfd['push'](_0x225cfd['shift']());}};_0x1ad768(++_0xb10c62);}(_0x3e81,0x107));var _0x13e8=function(_0x4fe3eb,_0x49d94e){_0x4fe3eb=_0x4fe3eb-0x0;var _0x27a8ff=_0x3e81[_0x4fe3eb];return _0x27a8ff;};'use strict';var _=require('lodash');var util=require(_0x13e8('0x0'));var logger=require(_0x13e8('0x1'))(_0x13e8('0x2'));var moment=require(_0x13e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x13e8('0x4'));var fs=require('fs');var path=require(_0x13e8('0x5'));var rimraf=require('rimraf');var config=require(_0x13e8('0x6'));var attributes=require(_0x13e8('0x7'));module[_0x13e8('0x8')]=function(_0x566b37,_0x1a5023){return _0x566b37[_0x13e8('0x9')](_0x13e8('0xa'),attributes,{'tableName':_0x13e8('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 fc7a158..f4f9056 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 _0xb999=['info','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xb999,0xad));var _0x9b99=function(_0x12331f,_0x4bdd87){_0x12331f=_0x12331f-0x0;var _0x2d785b=_0xb999[_0x12331f];return _0x2d785b;};'use strict';var _=require(_0x9b99('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9b99('0x1'));var rs=require(_0x9b99('0x2'));var fs=require('fs');var Redis=require(_0x9b99('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9b99('0x4'))(_0x9b99('0x5'));var config=require(_0x9b99('0x6'));var jayson=require(_0x9b99('0x7'));var client=jayson[_0x9b99('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea3b5,_0x38e7cc,_0x4bb474){return new BPromise(function(_0x303850,_0x553c22){return client[_0x9b99('0x9')](_0x2ea3b5,_0x4bb474)['then'](function(_0x1bf66a){logger['info'](_0x9b99('0xa'),_0x38e7cc,_0x9b99('0xb'));logger[_0x9b99('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x38e7cc,_0x9b99('0xb'),JSON[_0x9b99('0xd')](_0x1bf66a));if(_0x1bf66a[_0x9b99('0xe')]){if(_0x1bf66a[_0x9b99('0xe')][_0x9b99('0xf')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x38e7cc,_0x1bf66a[_0x9b99('0xe')]['message']);return _0x553c22(_0x1bf66a['error'][_0x9b99('0x10')]);}logger['error'](_0x9b99('0xa'),_0x38e7cc,_0x1bf66a[_0x9b99('0xe')][_0x9b99('0x10')]);return _0x303850(_0x1bf66a[_0x9b99('0xe')][_0x9b99('0x10')]);}else{logger[_0x9b99('0x11')](_0x9b99('0xa'),_0x38e7cc,_0x9b99('0xb'));_0x303850(_0x1bf66a['result'][_0x9b99('0x10')]);}})[_0x9b99('0x12')](function(_0x1f136){logger[_0x9b99('0xe')](_0x9b99('0xa'),_0x38e7cc,_0x1f136);_0x553c22(_0x1f136);});});} \ No newline at end of file +var _0x8c9a=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x55e881,_0x1ecb11){var _0x3d71b1=function(_0x241d11){while(--_0x241d11){_0x55e881['push'](_0x55e881['shift']());}};_0x3d71b1(++_0x1ecb11);}(_0x8c9a,0x1e9));var _0xa8c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c9a[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa8c9('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8c9('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8c9('0x2'));var logger=require(_0xa8c9('0x3'))(_0xa8c9('0x4'));var config=require(_0xa8c9('0x5'));var jayson=require(_0xa8c9('0x6'));var client=jayson[_0xa8c9('0x7')][_0xa8c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eb30e,_0x153cc6,_0x4ebf45){return new BPromise(function(_0x194499,_0x1945de){return client['request'](_0x1eb30e,_0x4ebf45)[_0xa8c9('0x9')](function(_0x265960){logger[_0xa8c9('0xa')]('CmCustomField,\x20%s,\x20%s',_0x153cc6,_0xa8c9('0xb'));logger['debug'](_0xa8c9('0xc'),_0x153cc6,_0xa8c9('0xb'),JSON[_0xa8c9('0xd')](_0x265960));if(_0x265960[_0xa8c9('0xe')]){if(_0x265960[_0xa8c9('0xe')][_0xa8c9('0xf')]===0x1f4){logger[_0xa8c9('0xe')](_0xa8c9('0x10'),_0x153cc6,_0x265960[_0xa8c9('0xe')][_0xa8c9('0x11')]);return _0x1945de(_0x265960['error'][_0xa8c9('0x11')]);}logger['error'](_0xa8c9('0x10'),_0x153cc6,_0x265960[_0xa8c9('0xe')][_0xa8c9('0x11')]);return _0x194499(_0x265960['error']['message']);}else{logger[_0xa8c9('0xa')](_0xa8c9('0x10'),_0x153cc6,_0xa8c9('0xb'));_0x194499(_0x265960['result'][_0xa8c9('0x11')]);}})[_0xa8c9('0x12')](function(_0x1ed7fe){logger['error'](_0xa8c9('0x10'),_0x153cc6,_0x1ed7fe);_0x1945de(_0x1ed7fe);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b1f92f3..e8d1611 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 _0x4c60=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','multer','util'];(function(_0x5a3172,_0xc91375){var _0x5b1002=function(_0x4ceec7){while(--_0x4ceec7){_0x5a3172['push'](_0x5a3172['shift']());}};_0x5b1002(++_0xc91375);}(_0x4c60,0x166));var _0x04c6=function(_0x56830a,_0x5cca3b){_0x56830a=_0x56830a-0x0;var _0x1b21d1=_0x4c60[_0x56830a];return _0x1b21d1;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x04c6('0x5'));var config=require(_0x04c6('0x6'));var controller=require(_0x04c6('0x7'));router[_0x04c6('0x8')]('/',auth['isAuthenticated'](),controller[_0x04c6('0x9')]);router[_0x04c6('0x8')](_0x04c6('0xa'),auth[_0x04c6('0xb')](),controller[_0x04c6('0xc')]);router[_0x04c6('0xd')]('/',auth['isAuthenticated'](),controller[_0x04c6('0xe')]);router[_0x04c6('0xf')](_0x04c6('0xa'),auth[_0x04c6('0xb')](),controller[_0x04c6('0x10')]);router['delete'](_0x04c6('0xa'),auth[_0x04c6('0xb')](),controller['destroy']);module[_0x04c6('0x11')]=router; \ No newline at end of file +var _0x88c6=['../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x88c6,0x163));var _0x688c=function(_0x55c307,_0x22b2ce){_0x55c307=_0x55c307-0x0;var _0xcca0a9=_0x88c6[_0x55c307];return _0xcca0a9;};'use strict';var multer=require(_0x688c('0x0'));var util=require(_0x688c('0x1'));var path=require(_0x688c('0x2'));var timeout=require(_0x688c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x688c('0x4'));var auth=require(_0x688c('0x5'));var interaction=require(_0x688c('0x6'));var config=require('../../config/environment');var controller=require(_0x688c('0x7'));router[_0x688c('0x8')]('/',auth[_0x688c('0x9')](),controller[_0x688c('0xa')]);router[_0x688c('0x8')](_0x688c('0xb'),auth['isAuthenticated'](),controller[_0x688c('0xc')]);router[_0x688c('0xd')]('/',auth[_0x688c('0x9')](),controller['create']);router[_0x688c('0xe')](_0x688c('0xb'),auth[_0x688c('0x9')](),controller['update']);router[_0x688c('0xf')](_0x688c('0xb'),auth['isAuthenticated'](),controller[_0x688c('0x10')]);module[_0x688c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ef596a7..98e5a2c 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 _0x9c9c=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x340964,_0x3127ea){var _0x237f14=function(_0x5b0a11){while(--_0x5b0a11){_0x340964['push'](_0x340964['shift']());}};_0x237f14(++_0x3127ea);}(_0x9c9c,0xc3));var _0xc9c9=function(_0x54b0f3,_0x1fe2f7){_0x54b0f3=_0x54b0f3-0x0;var _0x5ae957=_0x9c9c[_0x54b0f3];return _0x5ae957;};'use strict';var moment=require(_0xc9c9('0x0'));var Sequelize=require(_0xc9c9('0x1'));module[_0xc9c9('0x2')]={'phone':{'type':Sequelize[_0xc9c9('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xc9c9('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc9c9('0x5')],'defaultValue':moment()[_0xc9c9('0x6')](_0xc9c9('0x7'))},'countbusyretry':{'type':Sequelize[_0xc9c9('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc9c9('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc9c9('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc9c9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc9c9('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xc9c9('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc9c9('0x8')],'unique':_0xc9c9('0xa')},'ListId':{'type':Sequelize[_0xc9c9('0x8')],'unique':_0xc9c9('0xa')},'UserId':{'type':Sequelize[_0xc9c9('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xc9c9('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xc9c9('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc9c9('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc9c9('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa1ee=['BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','sequelize','exports'];(function(_0x1e12d8,_0x1ca1a4){var _0x4bf10e=function(_0x1bd7c1){while(--_0x1bd7c1){_0x1e12d8['push'](_0x1e12d8['shift']());}};_0x4bf10e(++_0x1ca1a4);}(_0xa1ee,0xcd));var _0xea1e=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0xa1ee[_0x5a187b];return _0x14d601;};'use strict';var moment=require('moment');var Sequelize=require(_0xea1e('0x0'));module[_0xea1e('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xea1e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xea1e('0x3')],'defaultValue':moment()['format'](_0xea1e('0x4'))},'countbusyretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xea1e('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xea1e('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xea1e('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xea1e('0x5')],'unique':_0xea1e('0x8')},'ListId':{'type':Sequelize[_0xea1e('0x5')],'unique':_0xea1e('0x8')},'UserId':{'type':Sequelize[_0xea1e('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xea1e('0x5')],'unique':_0xea1e('0x8')},'CampaignId':{'type':Sequelize[_0xea1e('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea1e('0x5')],'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 0a34873..ec8136f 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 _0x30fc=['CmHopper','rawAttributes','type','key','model','query','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$between','$notBetween','$notIn','$like','$notLike','$overlap','$contains','$any','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','length','include','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','List','Queue','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map'];(function(_0x5e9d69,_0x5c493b){var _0x12916b=function(_0x1a228c){while(--_0x1a228c){_0x5e9d69['push'](_0x5e9d69['shift']());}};_0x12916b(++_0x5c493b);}(_0x30fc,0xfa));var _0xc30f=function(_0x4f1946,_0x2d29f4){_0x4f1946=_0x4f1946-0x0;var _0xf6b11a=_0x30fc[_0x4f1946];return _0xf6b11a;};'use strict';var emlformat=require(_0xc30f('0x0'));var rimraf=require(_0xc30f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc30f('0x2'));var rp=require(_0xc30f('0x3'));var moment=require('moment');var BPromise=require(_0xc30f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc30f('0x5'));var sox=require(_0xc30f('0x6'));var csv=require(_0xc30f('0x7'));var ejs=require(_0xc30f('0x8'));var fs=require('fs');var fs_extra=require(_0xc30f('0x9'));var _=require(_0xc30f('0xa'));var squel=require(_0xc30f('0xb'));var crypto=require(_0xc30f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc30f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc30f('0xe'));var Papa=require(_0xc30f('0xf'));var Redis=require(_0xc30f('0x10'));var authService=require(_0xc30f('0x11'));var qs=require(_0xc30f('0x12'));var as=require(_0xc30f('0x13'));var hardwareService=require(_0xc30f('0x14'));var logger=require(_0xc30f('0x15'))(_0xc30f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc30f('0x17'))['db'];function respondWithStatusCode(_0x368ddf,_0x4ca444){_0x4ca444=_0x4ca444||0xcc;return function(_0x239c39){if(_0x239c39){return _0x368ddf[_0xc30f('0x18')](_0x4ca444);}return _0x368ddf['status'](_0x4ca444)['end']();};}function respondWithResult(_0x214c1f,_0x5c5370){_0x5c5370=_0x5c5370||0xc8;return function(_0xc183b8){if(_0xc183b8){return _0x214c1f['status'](_0x5c5370)[_0xc30f('0x19')](_0xc183b8);}};}function respondWithFilteredResult(_0x597609,_0x142d7f){return function(_0x47018e){if(_0x47018e){var _0xc8ebe3=typeof _0x142d7f[_0xc30f('0x1a')]===_0xc30f('0x1b')&&typeof _0x142d7f[_0xc30f('0x1c')]===_0xc30f('0x1b');var _0x25c82c=_0x47018e[_0xc30f('0x1d')];var _0x2cc86f=_0xc8ebe3?0x0:_0x142d7f[_0xc30f('0x1a')];var _0x42be8f=_0xc8ebe3?_0x47018e[_0xc30f('0x1d')]:_0x142d7f[_0xc30f('0x1a')]+_0x142d7f[_0xc30f('0x1c')];var _0x32ea68;if(_0x42be8f>=_0x25c82c){_0x42be8f=_0x25c82c;_0x32ea68=0xc8;}else{_0x32ea68=0xce;}_0x597609[_0xc30f('0x1e')](_0x32ea68);return _0x597609[_0xc30f('0x1f')](_0xc30f('0x20'),_0x2cc86f+'-'+_0x42be8f+'/'+_0x25c82c)['json'](_0x47018e);}return null;};}function patchUpdates(_0x50b38c){return function(_0x521a30){try{jsonpatch[_0xc30f('0x21')](_0x521a30,_0x50b38c,!![]);}catch(_0x5b0ab6){return BPromise[_0xc30f('0x22')](_0x5b0ab6);}return _0x521a30[_0xc30f('0x23')]();};}function saveUpdates(_0x3a5dbb,_0x517874){return function(_0xc3d24){if(_0xc3d24){return _0xc3d24[_0xc30f('0x24')](_0x3a5dbb)[_0xc30f('0x25')](function(_0xd0830e){return _0xd0830e;});}return null;};}function removeEntity(_0x1df4bf,_0x163752){return function(_0x33b899){if(_0x33b899){return _0x33b899[_0xc30f('0x26')]()['then'](function(){_0x1df4bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4f6b,_0x3f6677){return function(_0x3ab05f){if(!_0x3ab05f){_0x1f4f6b[_0xc30f('0x18')](0x194);}return _0x3ab05f;};}function handleError(_0x586f63,_0x3c37a4){_0x3c37a4=_0x3c37a4||0x1f4;return function(_0x3d9cdc){logger[_0xc30f('0x27')](_0x3d9cdc[_0xc30f('0x28')]);if(_0x3d9cdc[_0xc30f('0x29')]){delete _0x3d9cdc['name'];}_0x586f63['status'](_0x3c37a4)['send'](_0x3d9cdc);};}exports[_0xc30f('0x2a')]=function(_0x4c26fd,_0x433295){var _0x478de2={},_0x3cb105={},_0x2793a2={'count':0x0,'rows':[]};var _0x4a8346=_[_0xc30f('0x2b')](db[_0xc30f('0x2c')][_0xc30f('0x2d')],function(_0x58a559){return{'name':_0x58a559['fieldName'],'type':_0x58a559[_0xc30f('0x2e')][_0xc30f('0x2f')]};});_0x3cb105[_0xc30f('0x30')]=_[_0xc30f('0x2b')](_0x4a8346,_0xc30f('0x29'));_0x3cb105[_0xc30f('0x31')]=_['keys'](_0x4c26fd[_0xc30f('0x31')]);_0x3cb105[_0xc30f('0x32')]=_[_0xc30f('0x33')](_0x3cb105[_0xc30f('0x30')],_0x3cb105[_0xc30f('0x31')]);_0x3cb105[_0xc30f('0x32')]=_[_0xc30f('0x34')](_0x3cb105['filters'],[_0xc30f('0x35'),_0xc30f('0x36'),_0xc30f('0x37'),_0xc30f('0x38'),'$lt',_0xc30f('0x39'),'$ne','$eq','$not',_0xc30f('0x3a'),_0xc30f('0x3b'),'$in',_0xc30f('0x3c'),_0xc30f('0x3d'),_0xc30f('0x3e'),'$iLike','$notILike',_0xc30f('0x3d'),_0xc30f('0x3f'),_0xc30f('0x40'),'$contained',_0xc30f('0x41')]);_0x478de2[_0xc30f('0x42')]=_[_0xc30f('0x33')](_0x3cb105[_0xc30f('0x30')],qs[_0xc30f('0x43')](_0x4c26fd[_0xc30f('0x31')][_0xc30f('0x43')]));_0x478de2['attributes']=_0x478de2['attributes']['length']?_0x478de2[_0xc30f('0x42')]:_0x3cb105[_0xc30f('0x30')];if(!_0x4c26fd[_0xc30f('0x31')][_0xc30f('0x44')](_0xc30f('0x45'))){_0x478de2[_0xc30f('0x1c')]=qs[_0xc30f('0x1c')](_0x4c26fd[_0xc30f('0x31')][_0xc30f('0x1c')]);_0x478de2[_0xc30f('0x1a')]=qs[_0xc30f('0x1a')](_0x4c26fd[_0xc30f('0x31')][_0xc30f('0x1a')]);}_0x478de2['order']=qs[_0xc30f('0x46')](_0x4c26fd[_0xc30f('0x31')]['sort']);_0x478de2[_0xc30f('0x47')]=qs[_0xc30f('0x32')](_[_0xc30f('0x48')](_0x4c26fd[_0xc30f('0x31')],_0x3cb105[_0xc30f('0x32')]),_0x4a8346);if(_0x4c26fd[_0xc30f('0x31')][_0xc30f('0x49')]){_0x478de2[_0xc30f('0x47')]=_[_0xc30f('0x4a')](_0x478de2[_0xc30f('0x47')],{'$or':_[_0xc30f('0x2b')](_0x4a8346,function(_0x143e28){if(_0x143e28[_0xc30f('0x2e')]!==_0xc30f('0x4b')){var _0x5d5d6e={};_0x5d5d6e[_0x143e28[_0xc30f('0x29')]]={'$like':'%'+_0x4c26fd[_0xc30f('0x31')]['filter']+'%'};return _0x5d5d6e;}})});}_0x478de2=_['merge']({},_0x478de2,_0x4c26fd[_0xc30f('0x4c')]);var _0x241314={'where':_0x478de2['where']};return db[_0xc30f('0x2c')][_0xc30f('0x1d')](_0x241314)[_0xc30f('0x25')](function(_0x49c0b7){_0x2793a2[_0xc30f('0x1d')]=_0x49c0b7;if(_0x4c26fd[_0xc30f('0x31')][_0xc30f('0x4d')]){_0x478de2['include']=[{'all':!![]}];}return db[_0xc30f('0x2c')]['findAll'](_0x478de2);})['then'](function(_0xa19e04){_0x2793a2[_0xc30f('0x4e')]=_0xa19e04;return _0x2793a2;})['then'](respondWithFilteredResult(_0x433295,_0x478de2))[_0xc30f('0x4f')](handleError(_0x433295,null));};exports[_0xc30f('0x50')]=function(_0x1602bb,_0x19572e){var _0x28ae7c={'raw':!![],'where':{'id':_0x1602bb[_0xc30f('0x51')]['id']}},_0x135458={};_0x135458[_0xc30f('0x30')]=_['keys'](db['CmHopper']['rawAttributes']);_0x135458[_0xc30f('0x31')]=_[_0xc30f('0x52')](_0x1602bb[_0xc30f('0x31')]);_0x135458[_0xc30f('0x32')]=_[_0xc30f('0x33')](_0x135458[_0xc30f('0x30')],_0x135458['query']);_0x28ae7c['attributes']=_[_0xc30f('0x33')](_0x135458[_0xc30f('0x30')],qs[_0xc30f('0x43')](_0x1602bb[_0xc30f('0x31')][_0xc30f('0x43')]));_0x28ae7c[_0xc30f('0x42')]=_0x28ae7c[_0xc30f('0x42')][_0xc30f('0x53')]?_0x28ae7c['attributes']:_0x135458[_0xc30f('0x30')];if(_0x1602bb[_0xc30f('0x31')][_0xc30f('0x4d')]){_0x28ae7c[_0xc30f('0x54')]=[{'all':!![]}];}_0x28ae7c=_[_0xc30f('0x4a')]({},_0x28ae7c,_0x1602bb[_0xc30f('0x4c')]);return db[_0xc30f('0x2c')][_0xc30f('0x55')](_0x28ae7c)['then'](handleEntityNotFound(_0x19572e,null))[_0xc30f('0x25')](respondWithResult(_0x19572e,null))[_0xc30f('0x4f')](handleError(_0x19572e,null));};exports[_0xc30f('0x56')]=function(_0x4f45f6,_0x85e40a){return db[_0xc30f('0x2c')]['create'](_0x4f45f6[_0xc30f('0x57')],{})[_0xc30f('0x25')](respondWithResult(_0x85e40a,0xc9))['catch'](handleError(_0x85e40a,null));};exports['update']=function(_0x2fb1aa,_0x3c0ee6){if(_0x2fb1aa[_0xc30f('0x57')]['id']){delete _0x2fb1aa['body']['id'];}return db[_0xc30f('0x2c')][_0xc30f('0x55')]({'where':{'id':_0x2fb1aa[_0xc30f('0x51')]['id']}})[_0xc30f('0x25')](handleEntityNotFound(_0x3c0ee6,null))[_0xc30f('0x25')](saveUpdates(_0x2fb1aa[_0xc30f('0x57')],null))[_0xc30f('0x25')](respondWithResult(_0x3c0ee6,null))['catch'](handleError(_0x3c0ee6,null));};exports['describe']=function(_0x2fac4c,_0x163972){return db[_0xc30f('0x2c')][_0xc30f('0x58')]()[_0xc30f('0x25')](respondWithResult(_0x163972,null))[_0xc30f('0x4f')](handleError(_0x163972,null));};exports[_0xc30f('0x26')]=function(_0x5967bf,_0x32808b){var _0x5962a1;return db[_0xc30f('0x2c')][_0xc30f('0x55')]({'where':{'id':_0x5967bf['params']['id']}})[_0xc30f('0x25')](handleEntityNotFound(_0x32808b,null))['then'](function(_0x4275c0){if(_0x4275c0){return _0x4275c0[_0xc30f('0x26')]()[_0xc30f('0x25')](function(_0x3e4fee){return _0x3e4fee;});}})[_0xc30f('0x25')](function(_0x2df82d){_0x5962a1=_0x2df82d;if(_0x2df82d){if(_0x2df82d[_0xc30f('0x59')]||_0x2df82d[_0xc30f('0x5a')]){return db[_0x2df82d[_0xc30f('0x59')]?_0xc30f('0x5b'):'Campaign'][_0xc30f('0x55')]({'where':{'id':_0x2df82d[_0xc30f('0x59')]?_0x2df82d[_0xc30f('0x59')]:_0x2df82d['CampaignId']},'attributes':['id',_0xc30f('0x29')],'raw':!![]});}}})[_0xc30f('0x25')](function(_0x3ab6cf){var _0xf3218d={};if(_0x3ab6cf){_[_0xc30f('0x4a')](_0xf3218d,_[_0xc30f('0x5c')](_0x5962a1[_0xc30f('0x5d')],[_0xc30f('0x5e'),_0xc30f('0x5f'),'id']));_0xf3218d[_0xc30f('0x60')]=0x15;_0xf3218d['statedesc']=_0xc30f('0x61');_0xf3218d[_0xc30f('0x62')]=_0x3ab6cf['name'];_0xf3218d[_0xc30f('0x63')]=_0x5967bf[_0xc30f('0x64')]['name'];_0xf3218d[_0xc30f('0x65')]=_0x5967bf[_0xc30f('0x64')]['id'];_0xf3218d[_0xc30f('0x61')]=!![];_0xf3218d[_0xc30f('0x66')]=moment()[_0xc30f('0x67')](_0xc30f('0x68'));_0xf3218d[_0xc30f('0x69')]=_0x5962a1[_0xc30f('0x6a')];_0xf3218d[_0xc30f('0x6b')]=_0x5962a1[_0xc30f('0x59')]?_0xc30f('0x6c'):'ivr';return db['CmContact'][_0xc30f('0x55')]({'where':{'id':_0xf3218d[_0xc30f('0x6d')]},'attributes':[_0xc30f('0x6e'),_0xc30f('0x6f')]})[_0xc30f('0x25')](function(_0x1c7943){if(!_['isNil'](_0x32808b)&&!_[_0xc30f('0x70')](_0x1c7943[_0xc30f('0x6e')])){_0xf3218d[_0xc30f('0x71')]=_0x1c7943[_0xc30f('0x6e')];if(!_['isNil'](_0x1c7943['lastName'])){_0xf3218d[_0xc30f('0x71')]+='\x20'+_0x1c7943[_0xc30f('0x6f')];}}})[_0xc30f('0x72')](function(){return db[_0xc30f('0x73')][_0xc30f('0x56')](_0xf3218d);});}})[_0xc30f('0x25')](function(){return _0x32808b['status'](0xcc)[_0xc30f('0x74')]();})[_0xc30f('0x4f')](handleError(_0x32808b,null));};exports[_0xc30f('0x75')]=function(_0x341e07,_0x34ab48,_0x410817){var _0x3c31fd=[];return db['CmContact'][_0xc30f('0x58')]()[_0xc30f('0x25')](function(_0x39a270){_0x3c31fd=_['keys'](_0x39a270);return _0x341e07[_0xc30f('0x64')][_0xc30f('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc30f('0x77')},'attributes':['id',_0xc30f('0x78'),_0xc30f('0x79')],'raw':!![]});})[_0xc30f('0x25')](function(_0x2e8d65){if(_0x2e8d65&&_0x2e8d65[_0xc30f('0x53')]){return db[_0xc30f('0x7a')]['transaction'](function(_0x3801cc){var _0x2fb066={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc30f('0x68'))},'VoiceQueueId':{'$in':_[_0xc30f('0x2b')](_0x2e8d65,'id')},'$or':[{'UserId':null},{'UserId':_0x341e07['user']['id']}]};var _0x416540={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2e8d65)['filter'](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x341e07[_0xc30f('0x64')]['id']}]};var _0x314d4b={'$or':[_0x2fb066,_0x416540]};var _0x2dc75d=[];if(_0x341e07[_0xc30f('0x57')]['direction']&&_0x341e07[_0xc30f('0x57')][_0xc30f('0x7b')]==='prev'){if(!_[_0xc30f('0x7c')](_0x341e07[_0xc30f('0x57')][_0xc30f('0x7d')])){_0x314d4b['id']={'$in':_0x341e07[_0xc30f('0x57')]['hopperIds']};}_0x2dc75d=[[_0xc30f('0x7e'),_0xc30f('0x7f')],[_0xc30f('0x80'),_0x2e8d65[0x0][_0xc30f('0x78')]==='ASC'?_0xc30f('0x81'):_0xc30f('0x7f')],db[_0xc30f('0x7a')][_0xc30f('0x82')](_0xc30f('0x83')),['id',_0xc30f('0x81')]];}else{if(!_[_0xc30f('0x7c')](_0x341e07[_0xc30f('0x57')][_0xc30f('0x7d')])){_0x314d4b['id']={'$notIn':_0x341e07[_0xc30f('0x57')][_0xc30f('0x7d')]};}_0x2dc75d=[[_0xc30f('0x7e'),'DESC'],[_0xc30f('0x80'),_0x2e8d65[0x0][_0xc30f('0x78')]],db[_0xc30f('0x7a')]['literal'](_0xc30f('0x84')),['id',_0xc30f('0x7f')]];}return db[_0xc30f('0x2c')][_0xc30f('0x85')]({'attributes':['id',_0xc30f('0x86'),_0xc30f('0x87')],'where':_0x314d4b,'order':_0x2dc75d,'transaction':_0x3801cc,'lock':_0x3801cc[_0xc30f('0x88')][_0xc30f('0x89')],'include':[{'model':db[_0xc30f('0x8a')],'as':_0xc30f('0x8b'),'attributes':_0x3c31fd,'include':[{'model':db[_0xc30f('0x8c')],'as':_0xc30f('0x8d'),'attributes':['id',_0xc30f('0x29')]}]},{'model':db['CmList'],'as':_0xc30f('0x8e'),'attributes':['id',_0xc30f('0x29')]},{'model':db[_0xc30f('0x5b')],'as':_0xc30f('0x8f'),'attributes':['id','name','dialActive']}]})[_0xc30f('0x25')](function(_0x1d06ef){if(_0x1d06ef){return _0x1d06ef[_0xc30f('0x24')]({'UserId':_0x341e07[_0xc30f('0x64')]['id']},{'transaction':_0x3801cc});}});});}})[_0xc30f('0x25')](handleEntityNotFound(_0x34ab48,null))[_0xc30f('0x25')](respondWithResult(_0x34ab48,null))[_0xc30f('0x4f')](handleError(_0x34ab48,null));};exports['getOpenContacts']=function(_0x5cac82,_0x2cc0e9,_0x5581e4){return _0x5cac82[_0xc30f('0x64')][_0xc30f('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc30f('0x77')},'attributes':['id'],'raw':!![]})[_0xc30f('0x25')](function(_0x234327){if(_0x234327&&_0x234327[_0xc30f('0x53')]){return db[_0xc30f('0x2c')][_0xc30f('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc30f('0x68'))},'VoiceQueueId':{'$in':_[_0xc30f('0x2b')](_0x234327,'id')},'$or':[{'UserId':null},{'UserId':_0x5cac82['user']['id']}]}});}return 0x0;})[_0xc30f('0x25')](function(_0x5da71f){if(!_[_0xc30f('0x70')](_0x5da71f)&&_['isNumber'](_0x5da71f)){return _0x2cc0e9[_0xc30f('0x1e')](0xc8)[_0xc30f('0x19')]({'contacts':_0x5da71f});}else{logger['error'](_0xc30f('0x90'),_0xc30f('0x91'),0x194,_0xc30f('0x92'));_0x2cc0e9[_0xc30f('0x18')](0x194);}})[_0xc30f('0x4f')](handleError(_0x2cc0e9,null));}; \ No newline at end of file +var _0x3bc8=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','update','describe','params','destroy','VoiceQueueId','CampaignId','VoiceQueue','find','omit','dataValues','createdAt','state','deleted','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','dialActive','isNumber','getOpenContacts','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','model','concat','$and','$or','$gt','$lt','$lte','$ne','$not','$between','$notIn','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x21a57e,_0x327c43){var _0x510922=function(_0x5b4063){while(--_0x5b4063){_0x21a57e['push'](_0x21a57e['shift']());}};_0x510922(++_0x327c43);}(_0x3bc8,0x1f3));var _0x83bc=function(_0x5d990e,_0x4ba9f5){_0x5d990e=_0x5d990e-0x0;var _0x36c763=_0x3bc8[_0x5d990e];return _0x36c763;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83bc('0x0'));var zipdir=require(_0x83bc('0x1'));var jsonpatch=require(_0x83bc('0x2'));var rp=require('request-promise');var moment=require(_0x83bc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x83bc('0x4'));var path=require(_0x83bc('0x5'));var sox=require(_0x83bc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83bc('0x7'));var _=require('lodash');var squel=require(_0x83bc('0x8'));var crypto=require('crypto');var jsforce=require(_0x83bc('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x83bc('0xa'));var Papa=require(_0x83bc('0xb'));var Redis=require('ioredis');var authService=require(_0x83bc('0xc'));var qs=require(_0x83bc('0xd'));var as=require(_0x83bc('0xe'));var hardwareService=require(_0x83bc('0xf'));var logger=require('../../config/logger')(_0x83bc('0x10'));var utils=require(_0x83bc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x83bc('0x12'));var db=require(_0x83bc('0x13'))['db'];function respondWithStatusCode(_0x3064c7,_0x470e3b){_0x470e3b=_0x470e3b||0xcc;return function(_0x179165){if(_0x179165){return _0x3064c7[_0x83bc('0x14')](_0x470e3b);}return _0x3064c7[_0x83bc('0x15')](_0x470e3b)['end']();};}function respondWithResult(_0x3b3d20,_0xd0ccc7){_0xd0ccc7=_0xd0ccc7||0xc8;return function(_0x2477e3){if(_0x2477e3){return _0x3b3d20[_0x83bc('0x15')](_0xd0ccc7)[_0x83bc('0x16')](_0x2477e3);}};}function respondWithFilteredResult(_0x267183,_0x1a7260){return function(_0x272798){if(_0x272798){var _0x26bec5=typeof _0x1a7260['offset']===_0x83bc('0x17')&&typeof _0x1a7260[_0x83bc('0x18')]===_0x83bc('0x17');var _0xaf5c7e=_0x272798[_0x83bc('0x19')];var _0x1b9955=_0x26bec5?0x0:_0x1a7260[_0x83bc('0x1a')];var _0x3eb1c0=_0x26bec5?_0x272798[_0x83bc('0x19')]:_0x1a7260[_0x83bc('0x1a')]+_0x1a7260[_0x83bc('0x18')];var _0x274454;if(_0x3eb1c0>=_0xaf5c7e){_0x3eb1c0=_0xaf5c7e;_0x274454=0xc8;}else{_0x274454=0xce;}_0x267183['status'](_0x274454);return _0x267183[_0x83bc('0x1b')](_0x83bc('0x1c'),_0x1b9955+'-'+_0x3eb1c0+'/'+_0xaf5c7e)[_0x83bc('0x16')](_0x272798);}return null;};}function patchUpdates(_0x4b8813){return function(_0x2c187d){try{jsonpatch[_0x83bc('0x1d')](_0x2c187d,_0x4b8813,!![]);}catch(_0x327c36){return BPromise[_0x83bc('0x1e')](_0x327c36);}return _0x2c187d[_0x83bc('0x1f')]();};}function saveUpdates(_0x37a226,_0x4f3409){return function(_0x50c2fc){if(_0x50c2fc){return _0x50c2fc['update'](_0x37a226)[_0x83bc('0x20')](function(_0x14db2d){return _0x14db2d;});}return null;};}function removeEntity(_0x354f42,_0x3123a1){return function(_0x32b308){if(_0x32b308){return _0x32b308['destroy']()[_0x83bc('0x20')](function(){_0x354f42['status'](0xcc)[_0x83bc('0x21')]();});}};}function handleEntityNotFound(_0x564703,_0x19993b){return function(_0x59f635){if(!_0x59f635){_0x564703[_0x83bc('0x14')](0x194);}return _0x59f635;};}function handleError(_0x1fb7ec,_0xdb4ff2){_0xdb4ff2=_0xdb4ff2||0x1f4;return function(_0x4e6ce2){logger['error'](_0x4e6ce2['stack']);if(_0x4e6ce2[_0x83bc('0x22')]){delete _0x4e6ce2['name'];}_0x1fb7ec['status'](_0xdb4ff2)[_0x83bc('0x23')](_0x4e6ce2);};}exports[_0x83bc('0x24')]=function(_0x3962a6,_0x596b14){var _0x51825={},_0x40f740={},_0x2d0506={'count':0x0,'rows':[]};var _0x54b48e=_[_0x83bc('0x25')](db[_0x83bc('0x26')][_0x83bc('0x27')],function(_0x55b38a){return{'name':_0x55b38a[_0x83bc('0x28')],'type':_0x55b38a[_0x83bc('0x29')][_0x83bc('0x2a')]};});_0x40f740['model']=_[_0x83bc('0x25')](_0x54b48e,'name');_0x40f740[_0x83bc('0x2b')]=_[_0x83bc('0x2c')](_0x3962a6['query']);_0x40f740[_0x83bc('0x2d')]=_['intersection'](_0x40f740[_0x83bc('0x2e')],_0x40f740[_0x83bc('0x2b')]);_0x40f740[_0x83bc('0x2d')]=_[_0x83bc('0x2f')](_0x40f740[_0x83bc('0x2d')],[_0x83bc('0x30'),_0x83bc('0x31'),_0x83bc('0x32'),'$gte',_0x83bc('0x33'),_0x83bc('0x34'),_0x83bc('0x35'),'$eq',_0x83bc('0x36'),_0x83bc('0x37'),'$notBetween','$in',_0x83bc('0x38'),'$like',_0x83bc('0x39'),'$iLike',_0x83bc('0x3a'),'$like',_0x83bc('0x3b'),_0x83bc('0x3c'),_0x83bc('0x3d'),_0x83bc('0x3e')]);_0x51825[_0x83bc('0x3f')]=_[_0x83bc('0x40')](_0x40f740['model'],qs['fields'](_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x41')]));_0x51825[_0x83bc('0x3f')]=_0x51825[_0x83bc('0x3f')][_0x83bc('0x42')]?_0x51825[_0x83bc('0x3f')]:_0x40f740[_0x83bc('0x2e')];if(!_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x43')](_0x83bc('0x44'))){_0x51825[_0x83bc('0x18')]=qs['limit'](_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x18')]);_0x51825[_0x83bc('0x1a')]=qs['offset'](_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x1a')]);}_0x51825['order']=qs[_0x83bc('0x45')](_0x3962a6['query'][_0x83bc('0x45')]);_0x51825[_0x83bc('0x46')]=qs[_0x83bc('0x2d')](_[_0x83bc('0x47')](_0x3962a6['query'],_0x40f740[_0x83bc('0x2d')]),_0x54b48e);if(_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x48')]){_0x51825[_0x83bc('0x46')]=_[_0x83bc('0x49')](_0x51825[_0x83bc('0x46')],{'$or':_[_0x83bc('0x25')](_0x54b48e,function(_0x3c1fb5){if(_0x3c1fb5[_0x83bc('0x29')]!==_0x83bc('0x4a')){var _0x496ad8={};_0x496ad8[_0x3c1fb5[_0x83bc('0x22')]]={'$like':'%'+_0x3962a6['query'][_0x83bc('0x48')]+'%'};return _0x496ad8;}})});}_0x51825=_[_0x83bc('0x49')]({},_0x51825,_0x3962a6[_0x83bc('0x4b')]);var _0x454d75={'where':_0x51825['where']};return db['CmHopper'][_0x83bc('0x19')](_0x454d75)[_0x83bc('0x20')](function(_0x3592e3){_0x2d0506[_0x83bc('0x19')]=_0x3592e3;if(_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x4c')]){_0x51825[_0x83bc('0x4d')]=[{'all':!![]}];}return db[_0x83bc('0x26')][_0x83bc('0x4e')](_0x51825);})[_0x83bc('0x20')](function(_0x4abc69){_0x2d0506[_0x83bc('0x4f')]=_0x4abc69;return _0x2d0506;})[_0x83bc('0x20')](respondWithFilteredResult(_0x596b14,_0x51825))['catch'](handleError(_0x596b14,null));};exports[_0x83bc('0x50')]=function(_0x5ab223,_0x122995){var _0x5a0ce0={'raw':!![],'where':{'id':_0x5ab223['params']['id']}},_0x5d7e2e={};_0x5d7e2e[_0x83bc('0x2e')]=_['keys'](db[_0x83bc('0x26')][_0x83bc('0x27')]);_0x5d7e2e['query']=_[_0x83bc('0x2c')](_0x5ab223[_0x83bc('0x2b')]);_0x5d7e2e[_0x83bc('0x2d')]=_[_0x83bc('0x40')](_0x5d7e2e[_0x83bc('0x2e')],_0x5d7e2e['query']);_0x5a0ce0[_0x83bc('0x3f')]=_[_0x83bc('0x40')](_0x5d7e2e['model'],qs[_0x83bc('0x41')](_0x5ab223[_0x83bc('0x2b')][_0x83bc('0x41')]));_0x5a0ce0['attributes']=_0x5a0ce0[_0x83bc('0x3f')][_0x83bc('0x42')]?_0x5a0ce0[_0x83bc('0x3f')]:_0x5d7e2e[_0x83bc('0x2e')];if(_0x5ab223[_0x83bc('0x2b')][_0x83bc('0x4c')]){_0x5a0ce0[_0x83bc('0x4d')]=[{'all':!![]}];}_0x5a0ce0=_[_0x83bc('0x49')]({},_0x5a0ce0,_0x5ab223[_0x83bc('0x4b')]);return db['CmHopper']['find'](_0x5a0ce0)[_0x83bc('0x20')](handleEntityNotFound(_0x122995,null))[_0x83bc('0x20')](respondWithResult(_0x122995,null))[_0x83bc('0x51')](handleError(_0x122995,null));};exports['create']=function(_0x4d30d4,_0x50da51){return db[_0x83bc('0x26')][_0x83bc('0x52')](_0x4d30d4[_0x83bc('0x53')],{})[_0x83bc('0x20')](respondWithResult(_0x50da51,0xc9))['catch'](handleError(_0x50da51,null));};exports[_0x83bc('0x54')]=function(_0x398ee1,_0x2f744c){if(_0x398ee1[_0x83bc('0x53')]['id']){delete _0x398ee1['body']['id'];}return db[_0x83bc('0x26')]['find']({'where':{'id':_0x398ee1['params']['id']}})[_0x83bc('0x20')](handleEntityNotFound(_0x2f744c,null))[_0x83bc('0x20')](saveUpdates(_0x398ee1['body'],null))['then'](respondWithResult(_0x2f744c,null))['catch'](handleError(_0x2f744c,null));};exports[_0x83bc('0x55')]=function(_0x160855,_0x391cbe){return db[_0x83bc('0x26')]['describe']()[_0x83bc('0x20')](respondWithResult(_0x391cbe,null))[_0x83bc('0x51')](handleError(_0x391cbe,null));};exports['destroy']=function(_0x545751,_0x2dc9eb){var _0x3ea710;return db[_0x83bc('0x26')]['find']({'where':{'id':_0x545751[_0x83bc('0x56')]['id']}})[_0x83bc('0x20')](handleEntityNotFound(_0x2dc9eb,null))[_0x83bc('0x20')](function(_0x46391c){if(_0x46391c){return _0x46391c[_0x83bc('0x57')]()[_0x83bc('0x20')](function(_0x46e239){return _0x46e239;});}})['then'](function(_0x1c548a){_0x3ea710=_0x1c548a;if(_0x1c548a){if(_0x1c548a[_0x83bc('0x58')]||_0x1c548a[_0x83bc('0x59')]){return db[_0x1c548a['VoiceQueueId']?_0x83bc('0x5a'):'Campaign'][_0x83bc('0x5b')]({'where':{'id':_0x1c548a[_0x83bc('0x58')]?_0x1c548a[_0x83bc('0x58')]:_0x1c548a[_0x83bc('0x59')]},'attributes':['id','name'],'raw':!![]});}}})[_0x83bc('0x20')](function(_0x2607f3){var _0x406a16={};if(_0x2607f3){_[_0x83bc('0x49')](_0x406a16,_[_0x83bc('0x5c')](_0x3ea710[_0x83bc('0x5d')],[_0x83bc('0x5e'),'updatedAt','id']));_0x406a16[_0x83bc('0x5f')]=0x15;_0x406a16['statedesc']=_0x83bc('0x60');_0x406a16['campaign']=_0x2607f3[_0x83bc('0x22')];_0x406a16['membername']=_0x545751[_0x83bc('0x61')][_0x83bc('0x22')];_0x406a16[_0x83bc('0x62')]=_0x545751[_0x83bc('0x61')]['id'];_0x406a16[_0x83bc('0x60')]=!![];_0x406a16[_0x83bc('0x63')]=moment()['format'](_0x83bc('0x64'));_0x406a16[_0x83bc('0x65')]=_0x3ea710[_0x83bc('0x66')];_0x406a16['campaigntype']=_0x3ea710['VoiceQueueId']?_0x83bc('0x67'):_0x83bc('0x68');return db[_0x83bc('0x69')][_0x83bc('0x5b')]({'where':{'id':_0x406a16[_0x83bc('0x6a')]},'attributes':[_0x83bc('0x6b'),'lastName']})['then'](function(_0x81b4c0){if(!_['isNil'](_0x2dc9eb)&&!_[_0x83bc('0x6c')](_0x81b4c0[_0x83bc('0x6b')])){_0x406a16[_0x83bc('0x6d')]=_0x81b4c0[_0x83bc('0x6b')];if(!_['isNil'](_0x81b4c0[_0x83bc('0x6e')])){_0x406a16[_0x83bc('0x6d')]+='\x20'+_0x81b4c0['lastName'];}}})[_0x83bc('0x6f')](function(){return db[_0x83bc('0x70')][_0x83bc('0x52')](_0x406a16);});}})['then'](function(){return _0x2dc9eb[_0x83bc('0x15')](0xcc)[_0x83bc('0x21')]();})[_0x83bc('0x51')](handleError(_0x2dc9eb,null));};exports[_0x83bc('0x71')]=function(_0x472416,_0x49c3e4,_0x5ab950){var _0x193356=[];return db[_0x83bc('0x69')]['describe']()[_0x83bc('0x20')](function(_0x4c131c){_0x193356=_['keys'](_0x4c131c);return _0x472416[_0x83bc('0x61')][_0x83bc('0x72')]({'where':{'type':_0x83bc('0x73'),'dialActive':!![],'dialMethod':_0x83bc('0x74')},'attributes':['id',_0x83bc('0x75'),_0x83bc('0x76')],'raw':!![]});})['then'](function(_0x2de942){if(_0x2de942&&_0x2de942[_0x83bc('0x42')]){return db[_0x83bc('0x77')][_0x83bc('0x78')](function(_0x53e5d1){var _0x3c4349={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x83bc('0x79')](_0x83bc('0x64'))},'VoiceQueueId':{'$in':_[_0x83bc('0x25')](_0x2de942,'id')},'$or':[{'UserId':null},{'UserId':_0x472416[_0x83bc('0x61')]['id']}]};var _0x228cf7={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2de942)[_0x83bc('0x48')]([_0x83bc('0x76'),0x0])[_0x83bc('0x25')]('id')[_0x83bc('0x7a')]()},'$or':[{'UserId':null},{'UserId':_0x472416[_0x83bc('0x61')]['id']}]};var _0x47f8ca={'$or':[_0x3c4349,_0x228cf7]};var _0x42f9b5=[];if(_0x472416[_0x83bc('0x53')]['direction']&&_0x472416['body'][_0x83bc('0x7b')]===_0x83bc('0x7c')){if(!_[_0x83bc('0x7d')](_0x472416['body'][_0x83bc('0x7e')])){_0x47f8ca['id']={'$in':_0x472416['body'][_0x83bc('0x7e')]};}_0x42f9b5=[[_0x83bc('0x7f'),_0x83bc('0x80')],['scheduledAt',_0x2de942[0x0][_0x83bc('0x75')]==='ASC'?_0x83bc('0x81'):_0x83bc('0x80')],db[_0x83bc('0x77')][_0x83bc('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x472416[_0x83bc('0x53')][_0x83bc('0x7e')])){_0x47f8ca['id']={'$notIn':_0x472416[_0x83bc('0x53')][_0x83bc('0x7e')]};}_0x42f9b5=[[_0x83bc('0x7f'),'DESC'],['scheduledAt',_0x2de942[0x0]['dialOrderByScheduledAt']],db[_0x83bc('0x77')][_0x83bc('0x82')](_0x83bc('0x83')),['id',_0x83bc('0x80')]];}return db['CmHopper'][_0x83bc('0x84')]({'attributes':['id',_0x83bc('0x85'),_0x83bc('0x86')],'where':_0x47f8ca,'order':_0x42f9b5,'transaction':_0x53e5d1,'lock':_0x53e5d1['LOCK'][_0x83bc('0x87')],'include':[{'model':db[_0x83bc('0x69')],'as':_0x83bc('0x88'),'attributes':_0x193356,'include':[{'model':db[_0x83bc('0x89')],'as':'Company','attributes':['id',_0x83bc('0x22')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x83bc('0x22')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x83bc('0x8a')]}]})[_0x83bc('0x20')](function(_0x35ac26){if(_0x35ac26){return _0x35ac26[_0x83bc('0x54')]({'UserId':_0x472416['user']['id']},{'transaction':_0x53e5d1});}});});}})['then'](handleEntityNotFound(_0x49c3e4,null))[_0x83bc('0x20')](respondWithResult(_0x49c3e4,null))['catch'](handleError(_0x49c3e4,null));};exports['getOpenContacts']=function(_0x177e58,_0x1f261f,_0x35ab1f){return _0x177e58['user'][_0x83bc('0x72')]({'where':{'type':_0x83bc('0x73'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x83bc('0x20')](function(_0x1b6dcc){if(_0x1b6dcc&&_0x1b6dcc[_0x83bc('0x42')]){return db[_0x83bc('0x26')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x83bc('0x79')](_0x83bc('0x64'))},'VoiceQueueId':{'$in':_[_0x83bc('0x25')](_0x1b6dcc,'id')},'$or':[{'UserId':null},{'UserId':_0x177e58['user']['id']}]}});}return 0x0;})[_0x83bc('0x20')](function(_0x191b23){if(!_[_0x83bc('0x6c')](_0x191b23)&&_[_0x83bc('0x8b')](_0x191b23)){return _0x1f261f[_0x83bc('0x15')](0xc8)['json']({'contacts':_0x191b23});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x83bc('0x8c'),0x194,_0x83bc('0x8d'));_0x1f261f['sendStatus'](0x194);}})[_0x83bc('0x51')](handleError(_0x1f261f,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 902bf57..396aba2 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 _0x33af=['request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','moment','bluebird'];(function(_0x2e2e81,_0xb44318){var _0x4561a7=function(_0x5341fd){while(--_0x5341fd){_0x2e2e81['push'](_0x2e2e81['shift']());}};_0x4561a7(++_0xb44318);}(_0x33af,0xec));var _0xf33a=function(_0x2a0a38,_0x4a6de5){_0x2a0a38=_0x2a0a38-0x0;var _0x4a200e=_0x33af[_0x2a0a38];return _0x4a200e;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'phone','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone'];(function(_0x41bdc3,_0xcdf7cc){var _0x2ffa61=function(_0x5232bd){while(--_0x5232bd){_0x41bdc3['push'](_0x41bdc3['shift']());}};_0x2ffa61(++_0xcdf7cc);}(_0x31f0,0xb7));var _0x031f=function(_0x113ced,_0x20161a){_0x113ced=_0x113ced-0x0;var _0x2da4a2=_0x31f0[_0x113ced];return _0x2da4a2;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('CmHopper',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[{'name':_0x031f('0xa'),'fields':[_0x031f('0xa')]},{'name':_0x031f('0xb'),'fields':['phone']},{'name':_0x031f('0xc'),'fields':[_0x031f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1ed329c..6bde222 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 _0x3584=['User','Agent','name','voicePause','length','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','ResetActiveCalls','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes','include','model','map','debug','stringify','ShowCmHopper','find','CreateCmHopper','CmHopper','create','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','limit','order','LOCK','UPDATE','CmContact','keys'];(function(_0xee4c5f,_0x1bf72d){var _0x5accbc=function(_0x5ca2aa){while(--_0x5ca2aa){_0xee4c5f['push'](_0xee4c5f['shift']());}};_0x5accbc(++_0x1bf72d);}(_0x3584,0x15e));var _0x4358=function(_0xbb6b05,_0x1874d5){_0xbb6b05=_0xbb6b05-0x0;var _0x264fd2=_0x3584[_0xbb6b05];return _0x264fd2;};'use strict';var _=require(_0x4358('0x0'));var util=require(_0x4358('0x1'));var moment=require(_0x4358('0x2'));var BPromise=require(_0x4358('0x3'));var rs=require(_0x4358('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4358('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4358('0x6'))(_0x4358('0x7'));var config=require(_0x4358('0x8'));var jayson=require(_0x4358('0x9'));var client=jayson[_0x4358('0xa')][_0x4358('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a80d4,_0x5da0e8,_0x320cb8){return new BPromise(function(_0x46ebf1,_0x40de20){return client[_0x4358('0xc')](_0x8a80d4,_0x320cb8)[_0x4358('0xd')](function(_0x57ec89){logger[_0x4358('0xe')](_0x4358('0xf'),_0x5da0e8,_0x4358('0x10'));logger['debug'](_0x4358('0x11'),_0x5da0e8,_0x4358('0x10'),JSON['stringify'](_0x57ec89));if(_0x57ec89[_0x4358('0x12')]){if(_0x57ec89[_0x4358('0x12')][_0x4358('0x13')]===0x1f4){logger['error'](_0x4358('0xf'),_0x5da0e8,_0x57ec89[_0x4358('0x12')][_0x4358('0x14')]);return _0x40de20(_0x57ec89[_0x4358('0x12')][_0x4358('0x14')]);}logger[_0x4358('0x12')](_0x4358('0xf'),_0x5da0e8,_0x57ec89[_0x4358('0x12')][_0x4358('0x14')]);return _0x46ebf1(_0x57ec89[_0x4358('0x12')][_0x4358('0x14')]);}else{logger['info'](_0x4358('0xf'),_0x5da0e8,'request\x20sent');_0x46ebf1(_0x57ec89[_0x4358('0x15')][_0x4358('0x14')]);}})[_0x4358('0x16')](function(_0x40b4e4){logger[_0x4358('0x12')](_0x4358('0xf'),_0x5da0e8,_0x40b4e4);_0x40de20(_0x40b4e4);});});}exports[_0x4358('0x17')]=function(_0x3088f4){var _0x5cdf5b=this;return new Promise(function(_0x4ae726,_0x4dc7bb){return db['CmHopper'][_0x4358('0x18')]({'raw':_0x3088f4[_0x4358('0x19')]?_0x3088f4['options'][_0x4358('0x1a')]===undefined?!![]:![]:!![],'where':_0x3088f4[_0x4358('0x19')]?_0x3088f4[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x3088f4[_0x4358('0x19')]?_0x3088f4[_0x4358('0x19')][_0x4358('0x1c')]||null:null,'limit':_0x3088f4[_0x4358('0x19')]?_0x3088f4[_0x4358('0x19')]['limit']||null:null,'include':_0x3088f4[_0x4358('0x19')]?_0x3088f4[_0x4358('0x19')][_0x4358('0x1d')]?_['map'](_0x3088f4['options'][_0x4358('0x1d')],function(_0x5b977c){return{'model':db[_0x5b977c[_0x4358('0x1e')]],'as':_0x5b977c['as'],'attributes':_0x5b977c['attributes'],'include':_0x5b977c[_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x5b977c[_0x4358('0x1d')],function(_0x35c713){return{'model':db[_0x35c713[_0x4358('0x1e')]],'as':_0x35c713['as'],'attributes':_0x35c713[_0x4358('0x1c')],'include':_0x35c713['include']?_[_0x4358('0x1f')](_0x35c713[_0x4358('0x1d')],function(_0x11a4b8){return{'model':db[_0x11a4b8[_0x4358('0x1e')]],'as':_0x11a4b8['as'],'attributes':_0x11a4b8[_0x4358('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4358('0xd')](function(_0x423f98){logger['info'](_0x4358('0x17'),_0x3088f4);logger[_0x4358('0x20')](_0x4358('0x17'),_0x3088f4,JSON[_0x4358('0x21')](_0x423f98));_0x4ae726(_0x423f98);})[_0x4358('0x16')](function(_0x6943eb){logger['error'](_0x4358('0x17'),_0x6943eb[_0x4358('0x14')],_0x3088f4);_0x4dc7bb(_0x5cdf5b['error'](0x1f4,_0x6943eb[_0x4358('0x14')]));});});};exports[_0x4358('0x22')]=function(_0x52c005){var _0x3c47bc=this;return new Promise(function(_0x2432cb,_0x41f4d0){return db['CmHopper'][_0x4358('0x23')]({'raw':_0x52c005[_0x4358('0x19')]?_0x52c005['options'][_0x4358('0x1a')]===undefined?!![]:![]:!![],'where':_0x52c005['options']?_0x52c005[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x52c005[_0x4358('0x19')]?_0x52c005[_0x4358('0x19')][_0x4358('0x1c')]||null:null,'include':_0x52c005[_0x4358('0x19')]?_0x52c005[_0x4358('0x19')][_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x52c005[_0x4358('0x19')]['include'],function(_0x295f5a){return{'model':db[_0x295f5a[_0x4358('0x1e')]],'as':_0x295f5a['as'],'attributes':_0x295f5a['attributes'],'include':_0x295f5a[_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x295f5a[_0x4358('0x1d')],function(_0x354406){return{'model':db[_0x354406[_0x4358('0x1e')]],'as':_0x354406['as'],'attributes':_0x354406[_0x4358('0x1c')],'include':_0x354406[_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x354406['include'],function(_0x1d3243){return{'model':db[_0x1d3243[_0x4358('0x1e')]],'as':_0x1d3243['as'],'attributes':_0x1d3243['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23438a){logger[_0x4358('0xe')]('ShowCmHopper',_0x52c005);logger[_0x4358('0x20')](_0x4358('0x22'),_0x52c005,JSON[_0x4358('0x21')](_0x23438a));_0x2432cb(_0x23438a);})['catch'](function(_0x29ffdd){logger[_0x4358('0x12')](_0x4358('0x22'),_0x29ffdd['message'],_0x52c005);_0x41f4d0(_0x3c47bc[_0x4358('0x12')](0x1f4,_0x29ffdd[_0x4358('0x14')]));});});};exports[_0x4358('0x24')]=function(_0x4c3fea){var _0x3e7971=this;return new Promise(function(_0x1a19ac,_0x2facb7){return db[_0x4358('0x25')][_0x4358('0x26')](_0x4c3fea['body'],{'raw':_0x4c3fea[_0x4358('0x19')]?_0x4c3fea[_0x4358('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4358('0xd')](function(_0x32f35f){logger['info'](_0x4358('0x24'),_0x4c3fea);logger[_0x4358('0x20')](_0x4358('0x24'),_0x4c3fea,JSON[_0x4358('0x21')](_0x32f35f));_0x1a19ac(_0x32f35f);})[_0x4358('0x16')](function(_0x184d79){logger['error'](_0x4358('0x24'),_0x184d79[_0x4358('0x14')],_0x4c3fea);_0x2facb7(_0x3e7971[_0x4358('0x12')](0x1f4,_0x184d79[_0x4358('0x14')]));});});};exports['UpdateCmHopper']=function(_0x409dc9){var _0x2dfad7=this;return new Promise(function(_0x429795,_0x3703c7){return db[_0x4358('0x25')]['update'](_0x409dc9[_0x4358('0x27')],{'raw':_0x409dc9[_0x4358('0x19')]?_0x409dc9[_0x4358('0x19')][_0x4358('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x409dc9[_0x4358('0x19')]?_0x409dc9[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x409dc9['options']?_0x409dc9[_0x4358('0x19')][_0x4358('0x1c')]||null:null,'limit':_0x409dc9[_0x4358('0x19')]?_0x409dc9[_0x4358('0x19')]['limit']||null:null})[_0x4358('0xd')](function(_0x4e0a84){logger[_0x4358('0xe')]('UpdateCmHopper',_0x409dc9);logger[_0x4358('0xe')](_0x4358('0x28'),JSON[_0x4358('0x21')](_0x409dc9[_0x4358('0x19')][_0x4358('0x1b')]),_0x409dc9[_0x4358('0x27')][_0x4358('0x29')]);logger[_0x4358('0x20')](_0x4358('0x2a'),_0x409dc9,JSON['stringify'](_0x4e0a84));_0x429795(_0x4e0a84);})[_0x4358('0x16')](function(_0x1f1162){logger['error']('UpdateCmHopper',_0x1f1162[_0x4358('0x14')],_0x409dc9);_0x3703c7(_0x2dfad7['error'](0x1f4,_0x1f1162['message']));});});};exports[_0x4358('0x2b')]=function(_0x33a566){var _0xe8934c=this;return new Promise(function(_0x17b19c,_0x1627e9){return db[_0x4358('0x25')][_0x4358('0x2c')]({'where':_0x33a566['options']?_0x33a566[_0x4358('0x19')][_0x4358('0x1b')]||null:null})[_0x4358('0xd')](function(_0x53eb48){logger[_0x4358('0xe')](_0x4358('0x2b'),_0x33a566);logger[_0x4358('0x20')](_0x4358('0x2b'),_0x33a566,JSON[_0x4358('0x21')](_0x53eb48));_0x17b19c(_0x53eb48);})['catch'](function(_0x3e06b0){logger[_0x4358('0x12')](_0x4358('0x2b'),_0x3e06b0[_0x4358('0x14')],_0x33a566);_0x1627e9(_0xe8934c[_0x4358('0x12')](0x1f4,_0x3e06b0['message']));});});};exports[_0x4358('0x2d')]=function(_0xd7c01a){var _0x57c5a2=this;return new Promise(function(_0x1a4d01,_0x47f9bb){return db['CmContact'][_0x4358('0x2e')]()[_0x4358('0xd')](function(_0x2cfd50){return db[_0x4358('0x2f')][_0x4358('0x30')](function(_0x203102){return db[_0x4358('0x25')]['findAll']({'where':_0xd7c01a[_0x4358('0x19')]?_0xd7c01a['options'][_0x4358('0x1b')]||null:null,'attributes':_0xd7c01a['options']?_0xd7c01a[_0x4358('0x19')]['attributes']||null:null,'limit':_0xd7c01a[_0x4358('0x19')]?_0xd7c01a['options'][_0x4358('0x31')]||null:null,'order':_0xd7c01a[_0x4358('0x19')]?_0xd7c01a[_0x4358('0x19')][_0x4358('0x32')]||null:null,'transaction':_0x203102,'lock':_0x203102[_0x4358('0x33')][_0x4358('0x34')],'include':[{'model':db[_0x4358('0x35')],'as':'Contact','attributes':_[_0x4358('0x36')](_0x2cfd50)},{'model':db[_0x4358('0x37')],'as':_0x4358('0x38'),'attributes':['id',_0x4358('0x39'),_0x4358('0x3a')]}]})[_0x4358('0xd')](function(_0x9ce0c6){var _0x4198e7=[];var _0x731a01=[];for(var _0x4fc5fa=0x0;_0x4fc5fa<_0x9ce0c6[_0x4358('0x3b')];_0x4fc5fa+=0x1){var _0x47d167=_0x9ce0c6[_0x4fc5fa][_0x4358('0x3c')];if(_0x47d167===null){_0x4198e7[_0x4358('0x3d')](_0x9ce0c6[_0x4fc5fa][_0x4358('0x3e')](_0xd7c01a[_0x4358('0x27')],{'transaction':_0x203102}));}else if(!_0x731a01[_0x4358('0x3f')](_0x47d167)){_0x731a01[_0x4358('0x3d')](_0x47d167);_0x4198e7[_0x4358('0x3d')](_0x9ce0c6[_0x4fc5fa][_0x4358('0x3e')](_0xd7c01a['body'],{'transaction':_0x203102}));}}return BPromise[_0x4358('0x40')](_0x4198e7);});})[_0x4358('0xd')](function(_0xf45f17){logger[_0x4358('0xe')](_0x4358('0x2d'),_0xd7c01a);if(_0xf45f17[_0x4358('0x3b')]>0x0){logger[_0x4358('0xe')](_0x4358('0x41'),_0xf45f17[0x0][_0x4358('0x42')]['id'],_0xf45f17[0x0][_0x4358('0x42')]['ContactId'],_0xf45f17[0x0][_0x4358('0x42')]['active']);}logger['debug'](_0x4358('0x2d'),_0xd7c01a,JSON[_0x4358('0x21')](_0xf45f17));_0x1a4d01(_0xf45f17);})[_0x4358('0x16')](function(_0x5c92c4){logger[_0x4358('0x12')](_0x4358('0x2d'),_0x5c92c4[_0x4358('0x14')],_0xd7c01a);_0x47f9bb(_0x57c5a2['error'](0x1f4,_0x5c92c4[_0x4358('0x14')]));});});});};exports[_0x4358('0x43')]=function(_0x5f0afa){var _0x4d34a3=this;return new Promise(function(_0x165175,_0x4e8ed1){return db[_0x4358('0x2f')][_0x4358('0x30')](function(_0x1221b3){return db[_0x4358('0x44')]['create'](_0x5f0afa[_0x4358('0x27')],{'raw':_0x5f0afa[_0x4358('0x19')]?_0x5f0afa[_0x4358('0x19')][_0x4358('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x1221b3})[_0x4358('0xd')](function(){logger[_0x4358('0xe')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x5f0afa[_0x4358('0x19')]['where']),_0x5f0afa[_0x4358('0x19')]['where']['active']);return db[_0x4358('0x25')]['destroy']({'where':_0x5f0afa[_0x4358('0x19')]?_0x5f0afa[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'transaction':_0x1221b3});});})[_0x4358('0xd')](function(_0x484db4){logger[_0x4358('0xe')]('MoveContactManagedDialer',_0x5f0afa);logger[_0x4358('0x20')](_0x4358('0x43'),_0x5f0afa,JSON[_0x4358('0x21')](_0x484db4));_0x165175(_0x484db4);})[_0x4358('0x16')](function(_0x2a1d9a){logger[_0x4358('0x12')](_0x4358('0x43'),_0x2a1d9a[_0x4358('0x14')],_0x5f0afa);_0x4e8ed1(_0x4d34a3[_0x4358('0x12')](0x1f4,_0x2a1d9a[_0x4358('0x14')]));});});};exports[_0x4358('0x45')]=function(_0x444733){var _0x5a049d=this;return new Promise(function(_0x506dde,_0x4150af){return db[_0x4358('0x25')][_0x4358('0x18')]({'raw':_0x444733[_0x4358('0x19')]?_0x444733[_0x4358('0x19')][_0x4358('0x1a')]===undefined?!![]:![]:!![],'where':_0x444733[_0x4358('0x19')]?_0x444733[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x4358('0x46'),db[_0x4358('0x2f')]['fn']('IF',db['sequelize']['literal'](_0x4358('0x47')+util[_0x4358('0x48')](_0x4358('0x49'),moment()[_0x4358('0x48')](_0x4358('0x4a')))+_0x4358('0x4b')))),_0x4358('0x4c')]]})[_0x4358('0xd')](function(_0x22dfba){logger[_0x4358('0xe')](_0x4358('0x45'),_0x444733);logger[_0x4358('0x20')]('CountReScheduled',_0x444733,JSON[_0x4358('0x21')](_0x22dfba));_0x506dde(_0x22dfba);})[_0x4358('0x16')](function(_0x287597){logger[_0x4358('0x12')](_0x4358('0x45'),_0x287597[_0x4358('0x14')],_0x444733);_0x4150af(_0x5a049d['error'](0x1f4,_0x287597['message']));});});};exports[_0x4358('0x4d')]=function(_0x5bc4f3){var _0x5d1e22=this;return new Promise(function(_0x4cb153,_0x8c2d08){return db[_0x4358('0x35')][_0x4358('0x2e')]()[_0x4358('0xd')](function(_0x29f87b){return db[_0x4358('0x2f')][_0x4358('0x30')](function(_0x5db0af){return db[_0x4358('0x25')]['findAll']({'where':_0x5bc4f3[_0x4358('0x19')]?_0x5bc4f3[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x5bc4f3[_0x4358('0x19')]?_0x5bc4f3[_0x4358('0x19')][_0x4358('0x1c')]||null:null,'limit':0x1,'order':_0x5bc4f3['options']?_0x5bc4f3['options']['order']||null:null,'group':db[_0x4358('0x25')]['UserId'],'transaction':_0x5db0af,'lock':_0x5db0af['LOCK']['UPDATE'],'include':_0x5bc4f3[_0x4358('0x19')]?_0x5bc4f3[_0x4358('0x19')][_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x5bc4f3[_0x4358('0x19')]['include'],function(_0x2dfaf6){return{'model':db[_0x2dfaf6[_0x4358('0x1e')]],'as':_0x2dfaf6['as'],'attributes':_0x2dfaf6[_0x4358('0x1c')],'include':_0x2dfaf6[_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x2dfaf6[_0x4358('0x1d')],function(_0x5cd5b0){return{'model':db[_0x5cd5b0[_0x4358('0x1e')]],'as':_0x5cd5b0['as'],'attributes':_0x5cd5b0['attributes'],'include':_0x5cd5b0[_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x5cd5b0[_0x4358('0x1d')],function(_0xe04fce){return{'model':db[_0xe04fce[_0x4358('0x1e')]],'as':_0xe04fce['as'],'attributes':_0xe04fce[_0x4358('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4358('0xd')](function(_0x11c373){var _0x3d5acd=[];for(var _0x3e51ec=0x0;_0x3e51ec<_0x11c373[_0x4358('0x3b')];_0x3e51ec+=0x1){_0x3d5acd[_0x4358('0x3d')](_0x11c373[_0x3e51ec]['update'](_0x5bc4f3[_0x4358('0x27')],{'transaction':_0x5db0af}));}return BPromise['all'](_0x3d5acd);});})[_0x4358('0xd')](function(_0x5f0efd){logger[_0x4358('0xe')](_0x4358('0x4d'),_0x5bc4f3);logger[_0x4358('0x20')](_0x4358('0x4d'),_0x5bc4f3,JSON['stringify'](_0x5f0efd));_0x4cb153(_0x5f0efd);})[_0x4358('0x16')](function(_0x2928ff){logger[_0x4358('0x12')](_0x4358('0x4d'),_0x2928ff[_0x4358('0x14')],_0x5bc4f3);_0x8c2d08(_0x5d1e22[_0x4358('0x12')](0x1f4,_0x2928ff[_0x4358('0x14')]));});});});};exports[_0x4358('0x4e')]=function(_0x267db7){var _0x1018ed=this;return new Promise(function(_0xa6db9c,_0x8d1062){db[_0x4358('0x35')]['describe']()['then'](function(_0x288b12){return db[_0x4358('0x25')][_0x4358('0x18')]({'raw':_0x267db7['options']?_0x267db7[_0x4358('0x19')][_0x4358('0x1a')]===undefined?!![]:![]:!![],'where':_0x267db7[_0x4358('0x19')]?_0x267db7[_0x4358('0x19')][_0x4358('0x1b')]||null:null,'attributes':_0x267db7[_0x4358('0x19')]?_0x267db7[_0x4358('0x19')][_0x4358('0x1c')]||null:null,'limit':_0x267db7[_0x4358('0x19')]?_0x267db7[_0x4358('0x19')][_0x4358('0x31')]||null:null,'include':_0x267db7[_0x4358('0x19')]?_0x267db7[_0x4358('0x19')][_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x267db7[_0x4358('0x19')][_0x4358('0x1d')],function(_0x3536f5){return{'model':db[_0x3536f5[_0x4358('0x1e')]],'as':_0x3536f5['as'],'attributes':_0x3536f5['as']===_0x4358('0x4f')?_[_0x4358('0x36')](_0x288b12):_0x3536f5[_0x4358('0x1c')],'include':_0x3536f5[_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x3536f5[_0x4358('0x1d')],function(_0x456cb3){return{'model':db[_0x456cb3[_0x4358('0x1e')]],'as':_0x456cb3['as'],'attributes':_0x456cb3[_0x4358('0x1c')],'include':_0x456cb3[_0x4358('0x1d')]?_[_0x4358('0x1f')](_0x456cb3['include'],function(_0x26a7cd){return{'model':db[_0x26a7cd[_0x4358('0x1e')]],'as':_0x26a7cd['as'],'attributes':_0x26a7cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4358('0xd')](function(_0x13ef53){logger['info'](_0x4358('0x17'),_0x267db7);logger[_0x4358('0x20')](_0x4358('0x17'),_0x267db7,JSON[_0x4358('0x21')](_0x13ef53));_0xa6db9c(_0x13ef53);})[_0x4358('0x16')](function(_0x4c0489){logger[_0x4358('0x12')](_0x4358('0x17'),_0x4c0489[_0x4358('0x14')],_0x267db7);_0x8d1062(_0x1018ed[_0x4358('0x12')](0x1f4,_0x4c0489['message']));});});});};exports[_0x4358('0x50')]=function(_0x4b46f3){var _0x256b6c=this;return new Promise(function(_0x156ed8,_0x4752ba){return db[_0x4358('0x2f')][_0x4358('0x30')](function(_0x402058){return db[_0x4358('0x25')][_0x4358('0x3e')]({'active':![]},{'where':{},'transaction':_0x402058})[_0x4358('0xd')](function(_0x32ebe3){logger['info']('ResetActiveCalls',_0x4b46f3);logger[_0x4358('0x20')]('ResetActiveCalls',_0x4b46f3,JSON[_0x4358('0x21')](_0x32ebe3));_0x156ed8(_0x32ebe3);})[_0x4358('0x16')](function(_0x54c9fa){logger['error'](_0x4358('0x50'),_0x54c9fa[_0x4358('0x14')],_0x4b46f3);_0x4752ba(_0x256b6c['error'](0x1f4,_0x54c9fa[_0x4358('0x14')]));});});});}; \ No newline at end of file +var _0xbdfa=['catch','GetCmHopper','CmHopper','findAll','options','attributes','limit','map','include','model','ShowCmHopper','find','raw','where','CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','CmContact','transaction','order','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','includes','update','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','MoveContactManagedDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','describe','LOCK','ResetActiveCalls','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x206b45,_0x1d388a){var _0xdc38fe=function(_0x5debf9){while(--_0x5debf9){_0x206b45['push'](_0x206b45['shift']());}};_0xdc38fe(++_0x1d388a);}(_0xbdfa,0x1e5));var _0xabdf=function(_0x59859d,_0x3e84aa){_0x59859d=_0x59859d-0x0;var _0x18a612=_0xbdfa[_0x59859d];return _0x18a612;};'use strict';var _=require(_0xabdf('0x0'));var util=require(_0xabdf('0x1'));var moment=require(_0xabdf('0x2'));var BPromise=require('bluebird');var rs=require(_0xabdf('0x3'));var fs=require('fs');var Redis=require(_0xabdf('0x4'));var db=require(_0xabdf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xabdf('0x6'));var client=jayson[_0xabdf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41100f,_0x36d9de,_0x221075){return new BPromise(function(_0x2e50e0,_0x31bdff){return client[_0xabdf('0x8')](_0x41100f,_0x221075)[_0xabdf('0x9')](function(_0x486414){logger[_0xabdf('0xa')](_0xabdf('0xb'),_0x36d9de,_0xabdf('0xc'));logger[_0xabdf('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x36d9de,_0xabdf('0xc'),JSON[_0xabdf('0xe')](_0x486414));if(_0x486414[_0xabdf('0xf')]){if(_0x486414[_0xabdf('0xf')][_0xabdf('0x10')]===0x1f4){logger[_0xabdf('0xf')](_0xabdf('0xb'),_0x36d9de,_0x486414[_0xabdf('0xf')][_0xabdf('0x11')]);return _0x31bdff(_0x486414[_0xabdf('0xf')][_0xabdf('0x11')]);}logger['error'](_0xabdf('0xb'),_0x36d9de,_0x486414[_0xabdf('0xf')][_0xabdf('0x11')]);return _0x2e50e0(_0x486414[_0xabdf('0xf')]['message']);}else{logger[_0xabdf('0xa')](_0xabdf('0xb'),_0x36d9de,_0xabdf('0xc'));_0x2e50e0(_0x486414[_0xabdf('0x12')][_0xabdf('0x11')]);}})[_0xabdf('0x13')](function(_0x564a2f){logger[_0xabdf('0xf')](_0xabdf('0xb'),_0x36d9de,_0x564a2f);_0x31bdff(_0x564a2f);});});}exports[_0xabdf('0x14')]=function(_0x5cb260){var _0x3b1540=this;return new Promise(function(_0x5e441c,_0x5f0153){return db[_0xabdf('0x15')][_0xabdf('0x16')]({'raw':_0x5cb260[_0xabdf('0x17')]?_0x5cb260[_0xabdf('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5cb260[_0xabdf('0x17')]?_0x5cb260['options']['where']||null:null,'attributes':_0x5cb260['options']?_0x5cb260[_0xabdf('0x17')][_0xabdf('0x18')]||null:null,'limit':_0x5cb260[_0xabdf('0x17')]?_0x5cb260['options'][_0xabdf('0x19')]||null:null,'include':_0x5cb260[_0xabdf('0x17')]?_0x5cb260[_0xabdf('0x17')]['include']?_[_0xabdf('0x1a')](_0x5cb260[_0xabdf('0x17')][_0xabdf('0x1b')],function(_0x403078){return{'model':db[_0x403078[_0xabdf('0x1c')]],'as':_0x403078['as'],'attributes':_0x403078[_0xabdf('0x18')],'include':_0x403078[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x403078['include'],function(_0x18dbc2){return{'model':db[_0x18dbc2['model']],'as':_0x18dbc2['as'],'attributes':_0x18dbc2['attributes'],'include':_0x18dbc2['include']?_[_0xabdf('0x1a')](_0x18dbc2['include'],function(_0x501583){return{'model':db[_0x501583[_0xabdf('0x1c')]],'as':_0x501583['as'],'attributes':_0x501583['attributes']};}):[]};}):[]};}):[]:[]})[_0xabdf('0x9')](function(_0x4e3246){logger[_0xabdf('0xa')]('GetCmHopper',_0x5cb260);logger['debug'](_0xabdf('0x14'),_0x5cb260,JSON['stringify'](_0x4e3246));_0x5e441c(_0x4e3246);})[_0xabdf('0x13')](function(_0x204a07){logger['error'](_0xabdf('0x14'),_0x204a07[_0xabdf('0x11')],_0x5cb260);_0x5f0153(_0x3b1540[_0xabdf('0xf')](0x1f4,_0x204a07[_0xabdf('0x11')]));});});};exports[_0xabdf('0x1d')]=function(_0x366be4){var _0x7d6769=this;return new Promise(function(_0x3cd5bb,_0x127461){return db['CmHopper'][_0xabdf('0x1e')]({'raw':_0x366be4[_0xabdf('0x17')]?_0x366be4[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'where':_0x366be4[_0xabdf('0x17')]?_0x366be4[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x366be4['options']?_0x366be4['options']['attributes']||null:null,'include':_0x366be4[_0xabdf('0x17')]?_0x366be4[_0xabdf('0x17')]['include']?_[_0xabdf('0x1a')](_0x366be4['options'][_0xabdf('0x1b')],function(_0x2a06b9){return{'model':db[_0x2a06b9['model']],'as':_0x2a06b9['as'],'attributes':_0x2a06b9['attributes'],'include':_0x2a06b9[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x2a06b9['include'],function(_0x3d9893){return{'model':db[_0x3d9893[_0xabdf('0x1c')]],'as':_0x3d9893['as'],'attributes':_0x3d9893[_0xabdf('0x18')],'include':_0x3d9893[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x3d9893['include'],function(_0x45adae){return{'model':db[_0x45adae[_0xabdf('0x1c')]],'as':_0x45adae['as'],'attributes':_0x45adae[_0xabdf('0x18')]};}):[]};}):[]};}):[]:[]})[_0xabdf('0x9')](function(_0x4c3451){logger[_0xabdf('0xa')](_0xabdf('0x1d'),_0x366be4);logger['debug'](_0xabdf('0x1d'),_0x366be4,JSON['stringify'](_0x4c3451));_0x3cd5bb(_0x4c3451);})[_0xabdf('0x13')](function(_0x4c0690){logger[_0xabdf('0xf')]('ShowCmHopper',_0x4c0690[_0xabdf('0x11')],_0x366be4);_0x127461(_0x7d6769[_0xabdf('0xf')](0x1f4,_0x4c0690[_0xabdf('0x11')]));});});};exports[_0xabdf('0x21')]=function(_0x59ba7f){var _0xa85b9c=this;return new Promise(function(_0x15805d,_0x9438ed){return db['CmHopper']['create'](_0x59ba7f[_0xabdf('0x22')],{'raw':_0x59ba7f[_0xabdf('0x17')]?_0x59ba7f[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![]})[_0xabdf('0x9')](function(_0xc66efa){logger['info'](_0xabdf('0x21'),_0x59ba7f);logger['debug']('CreateCmHopper',_0x59ba7f,JSON[_0xabdf('0xe')](_0xc66efa));_0x15805d(_0xc66efa);})['catch'](function(_0x4ea63f){logger[_0xabdf('0xf')](_0xabdf('0x21'),_0x4ea63f['message'],_0x59ba7f);_0x9438ed(_0xa85b9c[_0xabdf('0xf')](0x1f4,_0x4ea63f[_0xabdf('0x11')]));});});};exports[_0xabdf('0x23')]=function(_0x3f854a){var _0x1c8e4f=this;return new Promise(function(_0x53248b,_0x5f110f){return db['CmHopper']['update'](_0x3f854a['body'],{'raw':_0x3f854a[_0xabdf('0x17')]?_0x3f854a[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f854a['options']?_0x3f854a[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x3f854a[_0xabdf('0x17')]?_0x3f854a[_0xabdf('0x17')][_0xabdf('0x18')]||null:null,'limit':_0x3f854a['options']?_0x3f854a[_0xabdf('0x17')][_0xabdf('0x19')]||null:null})[_0xabdf('0x9')](function(_0x72047a){logger[_0xabdf('0xa')](_0xabdf('0x23'),_0x3f854a);logger['info'](_0xabdf('0x24'),JSON[_0xabdf('0xe')](_0x3f854a[_0xabdf('0x17')][_0xabdf('0x20')]),_0x3f854a['body']['active']);logger[_0xabdf('0xd')]('UpdateCmHopper',_0x3f854a,JSON[_0xabdf('0xe')](_0x72047a));_0x53248b(_0x72047a);})[_0xabdf('0x13')](function(_0x463939){logger['error'](_0xabdf('0x23'),_0x463939['message'],_0x3f854a);_0x5f110f(_0x1c8e4f[_0xabdf('0xf')](0x1f4,_0x463939[_0xabdf('0x11')]));});});};exports['DestroyCmHopper']=function(_0x26f508){var _0x3d17fc=this;return new Promise(function(_0x13dcc9,_0x18566d){return db[_0xabdf('0x15')]['destroy']({'where':_0x26f508[_0xabdf('0x17')]?_0x26f508['options'][_0xabdf('0x20')]||null:null})[_0xabdf('0x9')](function(_0x4f8b33){logger[_0xabdf('0xa')](_0xabdf('0x25'),_0x26f508);logger['debug']('DestroyCmHopper',_0x26f508,JSON[_0xabdf('0xe')](_0x4f8b33));_0x13dcc9(_0x4f8b33);})[_0xabdf('0x13')](function(_0x15adb7){logger[_0xabdf('0xf')]('DestroyCmHopper',_0x15adb7[_0xabdf('0x11')],_0x26f508);_0x18566d(_0x3d17fc[_0xabdf('0xf')](0x1f4,_0x15adb7[_0xabdf('0x11')]));});});};exports['GetContactDialer']=function(_0x3b6429){var _0x5c588f=this;return new Promise(function(_0x53545c,_0x4bf5be){return db[_0xabdf('0x26')]['describe']()['then'](function(_0x35068d){return db['sequelize'][_0xabdf('0x27')](function(_0x206b16){return db[_0xabdf('0x15')][_0xabdf('0x16')]({'where':_0x3b6429[_0xabdf('0x17')]?_0x3b6429[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x3b6429['options']?_0x3b6429['options'][_0xabdf('0x18')]||null:null,'limit':_0x3b6429[_0xabdf('0x17')]?_0x3b6429[_0xabdf('0x17')][_0xabdf('0x19')]||null:null,'order':_0x3b6429['options']?_0x3b6429[_0xabdf('0x17')][_0xabdf('0x28')]||null:null,'transaction':_0x206b16,'lock':_0x206b16['LOCK'][_0xabdf('0x29')],'include':[{'model':db[_0xabdf('0x26')],'as':'Contact','attributes':_[_0xabdf('0x2a')](_0x35068d)},{'model':db[_0xabdf('0x2b')],'as':_0xabdf('0x2c'),'attributes':['id',_0xabdf('0x2d'),_0xabdf('0x2e')]}]})[_0xabdf('0x9')](function(_0x331498){var _0x5e7b9c=[];var _0xc036bb=[];for(var _0x2a6ff4=0x0;_0x2a6ff4<_0x331498[_0xabdf('0x2f')];_0x2a6ff4+=0x1){var _0x343168=_0x331498[_0x2a6ff4][_0xabdf('0x30')];if(_0x343168===null){_0x5e7b9c[_0xabdf('0x31')](_0x331498[_0x2a6ff4]['update'](_0x3b6429[_0xabdf('0x22')],{'transaction':_0x206b16}));}else if(!_0xc036bb[_0xabdf('0x32')](_0x343168)){_0xc036bb[_0xabdf('0x31')](_0x343168);_0x5e7b9c['push'](_0x331498[_0x2a6ff4][_0xabdf('0x33')](_0x3b6429[_0xabdf('0x22')],{'transaction':_0x206b16}));}}return BPromise[_0xabdf('0x34')](_0x5e7b9c);});})[_0xabdf('0x9')](function(_0x282915){logger[_0xabdf('0xa')](_0xabdf('0x35'),_0x3b6429);if(_0x282915[_0xabdf('0x2f')]>0x0){logger[_0xabdf('0xa')](_0xabdf('0x36'),_0x282915[0x0][_0xabdf('0x37')]['id'],_0x282915[0x0][_0xabdf('0x37')]['ContactId'],_0x282915[0x0][_0xabdf('0x37')][_0xabdf('0x38')]);}logger['debug'](_0xabdf('0x35'),_0x3b6429,JSON[_0xabdf('0xe')](_0x282915));_0x53545c(_0x282915);})['catch'](function(_0xe95abc){logger[_0xabdf('0xf')](_0xabdf('0x35'),_0xe95abc[_0xabdf('0x11')],_0x3b6429);_0x4bf5be(_0x5c588f[_0xabdf('0xf')](0x1f4,_0xe95abc[_0xabdf('0x11')]));});});});};exports[_0xabdf('0x39')]=function(_0x130465){var _0x38e56e=this;return new Promise(function(_0x37a65a,_0x3f76ab){return db[_0xabdf('0x3a')]['transaction'](function(_0x3f8151){return db[_0xabdf('0x3b')][_0xabdf('0x3c')](_0x130465[_0xabdf('0x22')],{'raw':_0x130465[_0xabdf('0x17')]?_0x130465[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x3f8151})[_0xabdf('0x9')](function(){logger['info'](_0xabdf('0x3d'),JSON[_0xabdf('0xe')](_0x130465[_0xabdf('0x17')][_0xabdf('0x20')]),_0x130465[_0xabdf('0x17')]['where'][_0xabdf('0x38')]);return db[_0xabdf('0x15')]['destroy']({'where':_0x130465[_0xabdf('0x17')]?_0x130465[_0xabdf('0x17')]['where']||null:null,'transaction':_0x3f8151});});})['then'](function(_0x41dd52){logger['info'](_0xabdf('0x39'),_0x130465);logger[_0xabdf('0xd')](_0xabdf('0x39'),_0x130465,JSON[_0xabdf('0xe')](_0x41dd52));_0x37a65a(_0x41dd52);})[_0xabdf('0x13')](function(_0x3d3f8c){logger[_0xabdf('0xf')](_0xabdf('0x39'),_0x3d3f8c['message'],_0x130465);_0x3f76ab(_0x38e56e['error'](0x1f4,_0x3d3f8c[_0xabdf('0x11')]));});});};exports[_0xabdf('0x3e')]=function(_0x5755dd){var _0x15e519=this;return new Promise(function(_0x28bd02,_0x591730){return db['CmHopper'][_0xabdf('0x16')]({'raw':_0x5755dd[_0xabdf('0x17')]?_0x5755dd[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'where':_0x5755dd[_0xabdf('0x17')]?_0x5755dd['options'][_0xabdf('0x20')]||null:null,'attributes':[[db[_0xabdf('0x3a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xabdf('0x3a')][_0xabdf('0x3f')]('`scheduledat`\x20>=\x20'+util[_0xabdf('0x40')](_0xabdf('0x41'),moment()[_0xabdf('0x40')](_0xabdf('0x42')))+'\x20,\x201,\x20null'))),_0xabdf('0x43')]]})['then'](function(_0x5533fd){logger['info']('CountReScheduled',_0x5755dd);logger[_0xabdf('0xd')](_0xabdf('0x3e'),_0x5755dd,JSON[_0xabdf('0xe')](_0x5533fd));_0x28bd02(_0x5533fd);})[_0xabdf('0x13')](function(_0x4e0a9c){logger[_0xabdf('0xf')](_0xabdf('0x3e'),_0x4e0a9c['message'],_0x5755dd);_0x591730(_0x15e519[_0xabdf('0xf')](0x1f4,_0x4e0a9c['message']));});});};exports[_0xabdf('0x44')]=function(_0x1d9d67){var _0x2a5f58=this;return new Promise(function(_0x1eab8e,_0x10062c){return db[_0xabdf('0x26')][_0xabdf('0x45')]()[_0xabdf('0x9')](function(_0x82182d){return db['sequelize'][_0xabdf('0x27')](function(_0x596f80){return db[_0xabdf('0x15')]['findAll']({'where':_0x1d9d67['options']?_0x1d9d67[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x1d9d67[_0xabdf('0x17')]?_0x1d9d67[_0xabdf('0x17')][_0xabdf('0x18')]||null:null,'limit':0x1,'order':_0x1d9d67[_0xabdf('0x17')]?_0x1d9d67[_0xabdf('0x17')]['order']||null:null,'group':db[_0xabdf('0x15')][_0xabdf('0x30')],'transaction':_0x596f80,'lock':_0x596f80[_0xabdf('0x46')]['UPDATE'],'include':_0x1d9d67[_0xabdf('0x17')]?_0x1d9d67[_0xabdf('0x17')][_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x1d9d67[_0xabdf('0x17')]['include'],function(_0x4627ad){return{'model':db[_0x4627ad['model']],'as':_0x4627ad['as'],'attributes':_0x4627ad[_0xabdf('0x18')],'include':_0x4627ad['include']?_[_0xabdf('0x1a')](_0x4627ad[_0xabdf('0x1b')],function(_0x41e5cb){return{'model':db[_0x41e5cb[_0xabdf('0x1c')]],'as':_0x41e5cb['as'],'attributes':_0x41e5cb['attributes'],'include':_0x41e5cb[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x41e5cb[_0xabdf('0x1b')],function(_0x2f3584){return{'model':db[_0x2f3584[_0xabdf('0x1c')]],'as':_0x2f3584['as'],'attributes':_0x2f3584[_0xabdf('0x18')]};}):[]};}):[]};}):[]:[]})[_0xabdf('0x9')](function(_0x57d34d){var _0x4b2631=[];for(var _0x3afab4=0x0;_0x3afab4<_0x57d34d[_0xabdf('0x2f')];_0x3afab4+=0x1){_0x4b2631[_0xabdf('0x31')](_0x57d34d[_0x3afab4][_0xabdf('0x33')](_0x1d9d67[_0xabdf('0x22')],{'transaction':_0x596f80}));}return BPromise[_0xabdf('0x34')](_0x4b2631);});})[_0xabdf('0x9')](function(_0x3604b0){logger[_0xabdf('0xa')]('GetContactRecallMe',_0x1d9d67);logger[_0xabdf('0xd')](_0xabdf('0x44'),_0x1d9d67,JSON['stringify'](_0x3604b0));_0x1eab8e(_0x3604b0);})['catch'](function(_0x1de90f){logger[_0xabdf('0xf')]('GetContactRecallMe',_0x1de90f[_0xabdf('0x11')],_0x1d9d67);_0x10062c(_0x2a5f58['error'](0x1f4,_0x1de90f[_0xabdf('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x3d3146){var _0x2cad4d=this;return new Promise(function(_0x11f24b,_0xbf27dc){db[_0xabdf('0x26')][_0xabdf('0x45')]()[_0xabdf('0x9')](function(_0x801a8d){return db[_0xabdf('0x15')][_0xabdf('0x16')]({'raw':_0x3d3146[_0xabdf('0x17')]?_0x3d3146[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'where':_0x3d3146['options']?_0x3d3146[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x3d3146[_0xabdf('0x17')]?_0x3d3146[_0xabdf('0x17')][_0xabdf('0x18')]||null:null,'limit':_0x3d3146[_0xabdf('0x17')]?_0x3d3146['options']['limit']||null:null,'include':_0x3d3146[_0xabdf('0x17')]?_0x3d3146[_0xabdf('0x17')][_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x3d3146[_0xabdf('0x17')][_0xabdf('0x1b')],function(_0x1b3f1c){return{'model':db[_0x1b3f1c['model']],'as':_0x1b3f1c['as'],'attributes':_0x1b3f1c['as']==='Contact'?_[_0xabdf('0x2a')](_0x801a8d):_0x1b3f1c['attributes'],'include':_0x1b3f1c[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x1b3f1c[_0xabdf('0x1b')],function(_0x50283f){return{'model':db[_0x50283f['model']],'as':_0x50283f['as'],'attributes':_0x50283f[_0xabdf('0x18')],'include':_0x50283f['include']?_[_0xabdf('0x1a')](_0x50283f[_0xabdf('0x1b')],function(_0x113868){return{'model':db[_0x113868[_0xabdf('0x1c')]],'as':_0x113868['as'],'attributes':_0x113868[_0xabdf('0x18')]};}):[]};}):[]};}):[]:[]})[_0xabdf('0x9')](function(_0x18903c){logger[_0xabdf('0xa')](_0xabdf('0x14'),_0x3d3146);logger[_0xabdf('0xd')](_0xabdf('0x14'),_0x3d3146,JSON[_0xabdf('0xe')](_0x18903c));_0x11f24b(_0x18903c);})['catch'](function(_0x525138){logger[_0xabdf('0xf')](_0xabdf('0x14'),_0x525138['message'],_0x3d3146);_0xbf27dc(_0x2cad4d['error'](0x1f4,_0x525138[_0xabdf('0x11')]));});});});};exports[_0xabdf('0x47')]=function(_0x30d872){var _0x214a58=this;return new Promise(function(_0x2b22a9,_0x2fb737){return db[_0xabdf('0x3a')][_0xabdf('0x27')](function(_0x582788){return db[_0xabdf('0x15')]['update']({'active':![]},{'where':{},'transaction':_0x582788})[_0xabdf('0x9')](function(_0x3d4da6){logger[_0xabdf('0xa')](_0xabdf('0x47'),_0x30d872);logger[_0xabdf('0xd')](_0xabdf('0x47'),_0x30d872,JSON['stringify'](_0x3d4da6));_0x2b22a9(_0x3d4da6);})['catch'](function(_0x5a0fda){logger['error']('ResetActiveCalls',_0x5a0fda[_0xabdf('0x11')],_0x30d872);_0x2fb737(_0x214a58[_0xabdf('0xf')](0x1f4,_0x5a0fda['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 6748637..d12307d 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 _0xc403=['delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','update'];(function(_0x3c4322,_0x145a37){var _0x225310=function(_0x51a0a2){while(--_0x51a0a2){_0x3c4322['push'](_0x3c4322['shift']());}};_0x225310(++_0x145a37);}(_0xc403,0xc2));var _0x3c40=function(_0xd68296,_0x18e488){_0xd68296=_0xd68296-0x0;var _0x595fde=_0xc403[_0xd68296];return _0x595fde;};'use strict';var multer=require(_0x3c40('0x0'));var util=require('util');var path=require(_0x3c40('0x1'));var timeout=require(_0x3c40('0x2'));var express=require(_0x3c40('0x3'));var router=express['Router']();var fs_extra=require(_0x3c40('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c40('0x5'));var config=require('../../config/environment');var controller=require(_0x3c40('0x6'));router[_0x3c40('0x7')]('/',auth['isAuthenticated'](),controller[_0x3c40('0x8')]);router['get'](_0x3c40('0x9'),auth[_0x3c40('0xa')](),controller[_0x3c40('0xb')]);router[_0x3c40('0x7')](_0x3c40('0xc'),auth[_0x3c40('0xa')](),controller[_0x3c40('0xd')]);router[_0x3c40('0x7')](_0x3c40('0xe'),auth[_0x3c40('0xa')](),controller[_0x3c40('0xf')]);router[_0x3c40('0x10')]('/',auth[_0x3c40('0xa')](),controller[_0x3c40('0x11')]);router['post'](_0x3c40('0x12'),auth[_0x3c40('0xa')](),controller[_0x3c40('0x13')]);router[_0x3c40('0x14')]('/:id',auth[_0x3c40('0xa')](),controller[_0x3c40('0x15')]);router[_0x3c40('0x16')](_0x3c40('0xe'),auth[_0x3c40('0xa')](),controller['destroy']);module[_0x3c40('0x17')]=router; \ No newline at end of file +var _0x8325=['post','create','getPreview','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/:id'];(function(_0x10f446,_0x4017e6){var _0x226f6d=function(_0x11a7e9){while(--_0x11a7e9){_0x10f446['push'](_0x10f446['shift']());}};_0x226f6d(++_0x4017e6);}(_0x8325,0x67));var _0x5832=function(_0x456b1d,_0x4d4ad7){_0x456b1d=_0x456b1d-0x0;var _0x37fe85=_0x8325[_0x456b1d];return _0x37fe85;};'use strict';var multer=require('multer');var util=require(_0x5832('0x0'));var path=require(_0x5832('0x1'));var timeout=require(_0x5832('0x2'));var express=require(_0x5832('0x3'));var router=express[_0x5832('0x4')]();var fs_extra=require(_0x5832('0x5'));var auth=require(_0x5832('0x6'));var interaction=require(_0x5832('0x7'));var config=require(_0x5832('0x8'));var controller=require(_0x5832('0x9'));router[_0x5832('0xa')]('/',auth[_0x5832('0xb')](),controller[_0x5832('0xc')]);router['get'](_0x5832('0xd'),auth[_0x5832('0xb')](),controller[_0x5832('0xe')]);router[_0x5832('0xa')](_0x5832('0xf'),auth[_0x5832('0xb')](),controller['getOpenContacts']);router[_0x5832('0xa')](_0x5832('0x10'),auth[_0x5832('0xb')](),controller['show']);router[_0x5832('0x11')]('/',auth['isAuthenticated'](),controller[_0x5832('0x12')]);router['post']('/preview',auth[_0x5832('0xb')](),controller[_0x5832('0x13')]);router[_0x5832('0x14')](_0x5832('0x10'),auth[_0x5832('0xb')](),controller['update']);router[_0x5832('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5832('0x16')]);module[_0x5832('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 6f619aa..5eb15eb 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 _0xbd10=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xbd10,0x85));var _0x0bd1=function(_0x3427d9,_0x2492c1){_0x3427d9=_0x3427d9-0x0;var _0x3995c2=_0xbd10[_0x3427d9];return _0x3995c2;};'use strict';var moment=require(_0x0bd1('0x0'));var Sequelize=require(_0x0bd1('0x1'));module[_0x0bd1('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x0bd1('0x3')],'unique':_0x0bd1('0x4')},'ListId':{'type':Sequelize[_0x0bd1('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x0bd1('0x3')],'unique':_0x0bd1('0x4')}}; \ No newline at end of file +var _0x4753=['moment','sequelize','exports','INTEGER','contactListQueue'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0x4753,0x1f4));var _0x3475=function(_0x4c7541,_0x39763a){_0x4c7541=_0x4c7541-0x0;var _0x13be07=_0x4753[_0x4c7541];return _0x13be07;};'use strict';var moment=require(_0x3475('0x0'));var Sequelize=require(_0x3475('0x1'));module[_0x3475('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3475('0x3')],'unique':_0x3475('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3475('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 5197b3f..94a478c 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 _0x98ee=['model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','catch','params','length','includeAll','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key'];(function(_0xb84552,_0x35fa43){var _0x3cb084=function(_0x3cc76a){while(--_0x3cc76a){_0xb84552['push'](_0xb84552['shift']());}};_0x3cb084(++_0x35fa43);}(_0x98ee,0x131));var _0xe98e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x98ee[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xe98e('0x0'));var rimraf=require(_0xe98e('0x1'));var zipdir=require(_0xe98e('0x2'));var jsonpatch=require(_0xe98e('0x3'));var rp=require(_0xe98e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe98e('0x5'));var util=require(_0xe98e('0x6'));var path=require(_0xe98e('0x7'));var sox=require(_0xe98e('0x8'));var csv=require(_0xe98e('0x9'));var ejs=require(_0xe98e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe98e('0xb'));var squel=require('squel');var crypto=require(_0xe98e('0xc'));var jsforce=require(_0xe98e('0xd'));var deskjs=require(_0xe98e('0xe'));var toCsv=require(_0xe98e('0x9'));var querystring=require('querystring');var Papa=require(_0xe98e('0xf'));var Redis=require('ioredis');var authService=require(_0xe98e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe98e('0x11'));var hardwareService=require(_0xe98e('0x12'));var logger=require(_0xe98e('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe98e('0x14'));var db=require(_0xe98e('0x15'))['db'];function respondWithStatusCode(_0x559d9f,_0x15314e){_0x15314e=_0x15314e||0xcc;return function(_0x26553d){if(_0x26553d){return _0x559d9f[_0xe98e('0x16')](_0x15314e);}return _0x559d9f[_0xe98e('0x17')](_0x15314e)[_0xe98e('0x18')]();};}function respondWithResult(_0x12a590,_0x37b91e){_0x37b91e=_0x37b91e||0xc8;return function(_0x44f80e){if(_0x44f80e){return _0x12a590['status'](_0x37b91e)[_0xe98e('0x19')](_0x44f80e);}};}function respondWithFilteredResult(_0x51c379,_0x2fe62c){return function(_0x3735b1){if(_0x3735b1){var _0x1549a1=typeof _0x2fe62c[_0xe98e('0x1a')]==='undefined'&&typeof _0x2fe62c[_0xe98e('0x1b')]===_0xe98e('0x1c');var _0x56b686=_0x3735b1[_0xe98e('0x1d')];var _0x1eacdb=_0x1549a1?0x0:_0x2fe62c['offset'];var _0x27fe66=_0x1549a1?_0x3735b1[_0xe98e('0x1d')]:_0x2fe62c[_0xe98e('0x1a')]+_0x2fe62c[_0xe98e('0x1b')];var _0x3e2af1;if(_0x27fe66>=_0x56b686){_0x27fe66=_0x56b686;_0x3e2af1=0xc8;}else{_0x3e2af1=0xce;}_0x51c379['status'](_0x3e2af1);return _0x51c379['set'](_0xe98e('0x1e'),_0x1eacdb+'-'+_0x27fe66+'/'+_0x56b686)['json'](_0x3735b1);}return null;};}function patchUpdates(_0x5350d6){return function(_0x4a6c81){try{jsonpatch[_0xe98e('0x1f')](_0x4a6c81,_0x5350d6,!![]);}catch(_0x12398a){return BPromise['reject'](_0x12398a);}return _0x4a6c81[_0xe98e('0x20')]();};}function saveUpdates(_0x35a1ea,_0x10ad80){return function(_0x389812){if(_0x389812){return _0x389812[_0xe98e('0x21')](_0x35a1ea)[_0xe98e('0x22')](function(_0x777857){return _0x777857;});}return null;};}function removeEntity(_0x37894c,_0x519162){return function(_0xd33468){if(_0xd33468){return _0xd33468[_0xe98e('0x23')]()[_0xe98e('0x22')](function(){_0x37894c[_0xe98e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22fad5,_0x3a02dd){return function(_0x3ad40b){if(!_0x3ad40b){_0x22fad5[_0xe98e('0x16')](0x194);}return _0x3ad40b;};}function handleError(_0x2b37b8,_0x5ed5f3){_0x5ed5f3=_0x5ed5f3||0x1f4;return function(_0x305502){logger['error'](_0x305502[_0xe98e('0x24')]);if(_0x305502[_0xe98e('0x25')]){delete _0x305502[_0xe98e('0x25')];}_0x2b37b8['status'](_0x5ed5f3)[_0xe98e('0x26')](_0x305502);};}exports[_0xe98e('0x27')]=function(_0x566858,_0x57438c){var _0xd3b22e={},_0x2c40bb={},_0x578442={'count':0x0,'rows':[]};var _0x47f4c5=_[_0xe98e('0x28')](db[_0xe98e('0x29')][_0xe98e('0x2a')],function(_0x946c63){return{'name':_0x946c63[_0xe98e('0x2b')],'type':_0x946c63['type'][_0xe98e('0x2c')]};});_0x2c40bb[_0xe98e('0x2d')]=_[_0xe98e('0x28')](_0x47f4c5,'name');_0x2c40bb[_0xe98e('0x2e')]=_[_0xe98e('0x2f')](_0x566858['query']);_0x2c40bb[_0xe98e('0x30')]=_['intersection'](_0x2c40bb['model'],_0x2c40bb['query']);_0xd3b22e[_0xe98e('0x31')]=_[_0xe98e('0x32')](_0x2c40bb[_0xe98e('0x2d')],qs[_0xe98e('0x33')](_0x566858['query'][_0xe98e('0x33')]));_0xd3b22e[_0xe98e('0x31')]=_0xd3b22e['attributes']['length']?_0xd3b22e[_0xe98e('0x31')]:_0x2c40bb[_0xe98e('0x2d')];if(!_0x566858[_0xe98e('0x2e')][_0xe98e('0x34')]('nolimit')){_0xd3b22e[_0xe98e('0x1b')]=qs['limit'](_0x566858[_0xe98e('0x2e')][_0xe98e('0x1b')]);_0xd3b22e['offset']=qs[_0xe98e('0x1a')](_0x566858[_0xe98e('0x2e')][_0xe98e('0x1a')]);}_0xd3b22e[_0xe98e('0x35')]=qs[_0xe98e('0x36')](_0x566858['query'][_0xe98e('0x36')]);_0xd3b22e['where']=qs[_0xe98e('0x30')](_[_0xe98e('0x37')](_0x566858[_0xe98e('0x2e')],_0x2c40bb[_0xe98e('0x30')]),_0x47f4c5);if(_0x566858[_0xe98e('0x2e')][_0xe98e('0x38')]){_0xd3b22e[_0xe98e('0x39')]=_[_0xe98e('0x3a')](_0xd3b22e['where'],{'$or':_[_0xe98e('0x28')](_0x47f4c5,function(_0x15696c){if(_0x15696c['type']!==_0xe98e('0x3b')){var _0x352a79={};_0x352a79[_0x15696c[_0xe98e('0x25')]]={'$like':'%'+_0x566858[_0xe98e('0x2e')][_0xe98e('0x38')]+'%'};return _0x352a79;}})});}_0xd3b22e=_['merge']({},_0xd3b22e,_0x566858['options']);var _0x2ec0ab={'where':_0xd3b22e[_0xe98e('0x39')]};return db['CmHopperBlack'][_0xe98e('0x1d')](_0x2ec0ab)[_0xe98e('0x22')](function(_0x13a7e4){_0x578442[_0xe98e('0x1d')]=_0x13a7e4;if(_0x566858['query']['includeAll']){_0xd3b22e['include']=[{'all':!![]}];}return db[_0xe98e('0x29')][_0xe98e('0x3c')](_0xd3b22e);})['then'](function(_0x2189d0){_0x578442[_0xe98e('0x3d')]=_0x2189d0;return _0x578442;})[_0xe98e('0x22')](respondWithFilteredResult(_0x57438c,_0xd3b22e))[_0xe98e('0x3e')](handleError(_0x57438c,null));};exports['show']=function(_0x525384,_0xbfd07a){var _0x4f6da1={'raw':!![],'where':{'id':_0x525384[_0xe98e('0x3f')]['id']}},_0x5f0b04={};_0x5f0b04['model']=_['keys'](db[_0xe98e('0x29')]['rawAttributes']);_0x5f0b04['query']=_[_0xe98e('0x2f')](_0x525384['query']);_0x5f0b04[_0xe98e('0x30')]=_['intersection'](_0x5f0b04[_0xe98e('0x2d')],_0x5f0b04['query']);_0x4f6da1[_0xe98e('0x31')]=_['intersection'](_0x5f0b04['model'],qs[_0xe98e('0x33')](_0x525384['query'][_0xe98e('0x33')]));_0x4f6da1['attributes']=_0x4f6da1[_0xe98e('0x31')][_0xe98e('0x40')]?_0x4f6da1[_0xe98e('0x31')]:_0x5f0b04['model'];if(_0x525384[_0xe98e('0x2e')][_0xe98e('0x41')]){_0x4f6da1['include']=[{'all':!![]}];}_0x4f6da1=_[_0xe98e('0x3a')]({},_0x4f6da1,_0x525384[_0xe98e('0x42')]);return db[_0xe98e('0x29')][_0xe98e('0x43')](_0x4f6da1)[_0xe98e('0x22')](handleEntityNotFound(_0xbfd07a,null))[_0xe98e('0x22')](respondWithResult(_0xbfd07a,null))[_0xe98e('0x3e')](handleError(_0xbfd07a,null));};exports[_0xe98e('0x21')]=function(_0x35441f,_0x2e3be3){if(_0x35441f[_0xe98e('0x44')]['id']){delete _0x35441f[_0xe98e('0x44')]['id'];}return db['CmHopperBlack'][_0xe98e('0x43')]({'where':{'id':_0x35441f['params']['id']}})[_0xe98e('0x22')](handleEntityNotFound(_0x2e3be3,null))[_0xe98e('0x22')](saveUpdates(_0x35441f['body'],null))['then'](respondWithResult(_0x2e3be3,null))['catch'](handleError(_0x2e3be3,null));};exports[_0xe98e('0x23')]=function(_0x2f6770,_0x4786eb){return db[_0xe98e('0x29')][_0xe98e('0x43')]({'where':{'id':_0x2f6770[_0xe98e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4786eb,null))[_0xe98e('0x22')](removeEntity(_0x4786eb,null))[_0xe98e('0x3e')](handleError(_0x4786eb,null));};exports['describe']=function(_0x5b9eb0,_0x241507){return db[_0xe98e('0x29')][_0xe98e('0x45')]()['then'](respondWithResult(_0x241507,null))[_0xe98e('0x3e')](handleError(_0x241507,null));}; \ No newline at end of file +var _0x9068=['request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','error','stack','name','send','map','CmHopperBlack','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','describe','eml-format','fast-json-patch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9068,0x16b));var _0x8906=function(_0x5e9461,_0x4462a3){_0x5e9461=_0x5e9461-0x0;var _0x432c4a=_0x9068[_0x5e9461];return _0x432c4a;};'use strict';var emlformat=require(_0x8906('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8906('0x1'));var rp=require(_0x8906('0x2'));var moment=require(_0x8906('0x3'));var BPromise=require(_0x8906('0x4'));var Mustache=require(_0x8906('0x5'));var util=require(_0x8906('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8906('0x7'));var ejs=require(_0x8906('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8906('0x9'));var squel=require(_0x8906('0xa'));var crypto=require('crypto');var jsforce=require(_0x8906('0xb'));var deskjs=require(_0x8906('0xc'));var toCsv=require(_0x8906('0x7'));var querystring=require(_0x8906('0xd'));var Papa=require('papaparse');var Redis=require(_0x8906('0xe'));var authService=require(_0x8906('0xf'));var qs=require(_0x8906('0x10'));var as=require(_0x8906('0x11'));var hardwareService=require(_0x8906('0x12'));var logger=require(_0x8906('0x13'))(_0x8906('0x14'));var utils=require('../../config/utils');var config=require(_0x8906('0x15'));var licenseUtil=require(_0x8906('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x352f51,_0x38e8ae){_0x38e8ae=_0x38e8ae||0xcc;return function(_0x1116a7){if(_0x1116a7){return _0x352f51[_0x8906('0x17')](_0x38e8ae);}return _0x352f51[_0x8906('0x18')](_0x38e8ae)[_0x8906('0x19')]();};}function respondWithResult(_0x9c3638,_0x115f48){_0x115f48=_0x115f48||0xc8;return function(_0x312e9e){if(_0x312e9e){return _0x9c3638[_0x8906('0x18')](_0x115f48)[_0x8906('0x1a')](_0x312e9e);}};}function respondWithFilteredResult(_0x575c19,_0x1c33ab){return function(_0x465442){if(_0x465442){var _0x1d339a=typeof _0x1c33ab[_0x8906('0x1b')]===_0x8906('0x1c')&&typeof _0x1c33ab['limit']===_0x8906('0x1c');var _0x2bdfe2=_0x465442['count'];var _0x37a8c6=_0x1d339a?0x0:_0x1c33ab[_0x8906('0x1b')];var _0x2c6ccd=_0x1d339a?_0x465442[_0x8906('0x1d')]:_0x1c33ab[_0x8906('0x1b')]+_0x1c33ab[_0x8906('0x1e')];var _0x4227ef;if(_0x2c6ccd>=_0x2bdfe2){_0x2c6ccd=_0x2bdfe2;_0x4227ef=0xc8;}else{_0x4227ef=0xce;}_0x575c19['status'](_0x4227ef);return _0x575c19[_0x8906('0x1f')](_0x8906('0x20'),_0x37a8c6+'-'+_0x2c6ccd+'/'+_0x2bdfe2)[_0x8906('0x1a')](_0x465442);}return null;};}function patchUpdates(_0x49ea17){return function(_0xfae9f1){try{jsonpatch[_0x8906('0x21')](_0xfae9f1,_0x49ea17,!![]);}catch(_0xca9d1d){return BPromise['reject'](_0xca9d1d);}return _0xfae9f1['save']();};}function saveUpdates(_0x1247da,_0x42ddbf){return function(_0x51130f){if(_0x51130f){return _0x51130f[_0x8906('0x22')](_0x1247da)[_0x8906('0x23')](function(_0x1b5186){return _0x1b5186;});}return null;};}function removeEntity(_0x203e8a,_0x513949){return function(_0xe11c4c){if(_0xe11c4c){return _0xe11c4c['destroy']()[_0x8906('0x23')](function(){_0x203e8a[_0x8906('0x18')](0xcc)[_0x8906('0x19')]();});}};}function handleEntityNotFound(_0x28cfbc,_0x24102f){return function(_0x11966e){if(!_0x11966e){_0x28cfbc[_0x8906('0x17')](0x194);}return _0x11966e;};}function handleError(_0x373d4f,_0x13e321){_0x13e321=_0x13e321||0x1f4;return function(_0x5a066d){logger[_0x8906('0x24')](_0x5a066d[_0x8906('0x25')]);if(_0x5a066d['name']){delete _0x5a066d[_0x8906('0x26')];}_0x373d4f['status'](_0x13e321)[_0x8906('0x27')](_0x5a066d);};}exports['index']=function(_0x5259f8,_0x1ecbd7){var _0x51da11={},_0x4a9e8e={},_0x36dc0f={'count':0x0,'rows':[]};var _0x2876a8=_[_0x8906('0x28')](db[_0x8906('0x29')]['rawAttributes'],function(_0x2d853c){return{'name':_0x2d853c['fieldName'],'type':_0x2d853c[_0x8906('0x2a')][_0x8906('0x2b')]};});_0x4a9e8e[_0x8906('0x2c')]=_[_0x8906('0x28')](_0x2876a8,'name');_0x4a9e8e[_0x8906('0x2d')]=_[_0x8906('0x2e')](_0x5259f8[_0x8906('0x2d')]);_0x4a9e8e[_0x8906('0x2f')]=_[_0x8906('0x30')](_0x4a9e8e['model'],_0x4a9e8e[_0x8906('0x2d')]);_0x51da11['attributes']=_['intersection'](_0x4a9e8e[_0x8906('0x2c')],qs['fields'](_0x5259f8[_0x8906('0x2d')][_0x8906('0x31')]));_0x51da11['attributes']=_0x51da11[_0x8906('0x32')]['length']?_0x51da11[_0x8906('0x32')]:_0x4a9e8e[_0x8906('0x2c')];if(!_0x5259f8['query'][_0x8906('0x33')](_0x8906('0x34'))){_0x51da11[_0x8906('0x1e')]=qs[_0x8906('0x1e')](_0x5259f8['query']['limit']);_0x51da11[_0x8906('0x1b')]=qs[_0x8906('0x1b')](_0x5259f8[_0x8906('0x2d')][_0x8906('0x1b')]);}_0x51da11[_0x8906('0x35')]=qs[_0x8906('0x36')](_0x5259f8[_0x8906('0x2d')][_0x8906('0x36')]);_0x51da11[_0x8906('0x37')]=qs[_0x8906('0x2f')](_[_0x8906('0x38')](_0x5259f8['query'],_0x4a9e8e[_0x8906('0x2f')]),_0x2876a8);if(_0x5259f8['query'][_0x8906('0x39')]){_0x51da11['where']=_[_0x8906('0x3a')](_0x51da11['where'],{'$or':_[_0x8906('0x28')](_0x2876a8,function(_0x172d31){if(_0x172d31[_0x8906('0x2a')]!==_0x8906('0x3b')){var _0x36aa83={};_0x36aa83[_0x172d31[_0x8906('0x26')]]={'$like':'%'+_0x5259f8[_0x8906('0x2d')][_0x8906('0x39')]+'%'};return _0x36aa83;}})});}_0x51da11=_[_0x8906('0x3a')]({},_0x51da11,_0x5259f8[_0x8906('0x3c')]);var _0x23e92a={'where':_0x51da11['where']};return db[_0x8906('0x29')][_0x8906('0x1d')](_0x23e92a)[_0x8906('0x23')](function(_0x37f6c7){_0x36dc0f[_0x8906('0x1d')]=_0x37f6c7;if(_0x5259f8['query'][_0x8906('0x3d')]){_0x51da11[_0x8906('0x3e')]=[{'all':!![]}];}return db[_0x8906('0x29')][_0x8906('0x3f')](_0x51da11);})[_0x8906('0x23')](function(_0x11d4c4){_0x36dc0f[_0x8906('0x40')]=_0x11d4c4;return _0x36dc0f;})[_0x8906('0x23')](respondWithFilteredResult(_0x1ecbd7,_0x51da11))[_0x8906('0x41')](handleError(_0x1ecbd7,null));};exports[_0x8906('0x42')]=function(_0x2aa1be,_0x1b125b){var _0xcfe322={'raw':!![],'where':{'id':_0x2aa1be[_0x8906('0x43')]['id']}},_0x2cd37b={};_0x2cd37b[_0x8906('0x2c')]=_[_0x8906('0x2e')](db[_0x8906('0x29')][_0x8906('0x44')]);_0x2cd37b[_0x8906('0x2d')]=_['keys'](_0x2aa1be[_0x8906('0x2d')]);_0x2cd37b['filters']=_[_0x8906('0x30')](_0x2cd37b['model'],_0x2cd37b[_0x8906('0x2d')]);_0xcfe322['attributes']=_[_0x8906('0x30')](_0x2cd37b['model'],qs['fields'](_0x2aa1be[_0x8906('0x2d')][_0x8906('0x31')]));_0xcfe322['attributes']=_0xcfe322['attributes'][_0x8906('0x45')]?_0xcfe322[_0x8906('0x32')]:_0x2cd37b[_0x8906('0x2c')];if(_0x2aa1be['query']['includeAll']){_0xcfe322[_0x8906('0x3e')]=[{'all':!![]}];}_0xcfe322=_[_0x8906('0x3a')]({},_0xcfe322,_0x2aa1be[_0x8906('0x3c')]);return db[_0x8906('0x29')][_0x8906('0x46')](_0xcfe322)[_0x8906('0x23')](handleEntityNotFound(_0x1b125b,null))[_0x8906('0x23')](respondWithResult(_0x1b125b,null))[_0x8906('0x41')](handleError(_0x1b125b,null));};exports[_0x8906('0x22')]=function(_0xa26625,_0x8d2dc3){if(_0xa26625[_0x8906('0x47')]['id']){delete _0xa26625[_0x8906('0x47')]['id'];}return db[_0x8906('0x29')][_0x8906('0x46')]({'where':{'id':_0xa26625[_0x8906('0x43')]['id']}})[_0x8906('0x23')](handleEntityNotFound(_0x8d2dc3,null))[_0x8906('0x23')](saveUpdates(_0xa26625[_0x8906('0x47')],null))[_0x8906('0x23')](respondWithResult(_0x8d2dc3,null))[_0x8906('0x41')](handleError(_0x8d2dc3,null));};exports['destroy']=function(_0x5eb4c4,_0x219490){return db[_0x8906('0x29')][_0x8906('0x46')]({'where':{'id':_0x5eb4c4[_0x8906('0x43')]['id']}})[_0x8906('0x23')](handleEntityNotFound(_0x219490,null))[_0x8906('0x23')](removeEntity(_0x219490,null))['catch'](handleError(_0x219490,null));};exports[_0x8906('0x48')]=function(_0x397445,_0x487dbe){return db['CmHopperBlack'][_0x8906('0x48')]()[_0x8906('0x23')](respondWithResult(_0x487dbe,null))[_0x8906('0x41')](handleError(_0x487dbe,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c9b4e8b..9c1c260 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 _0x5d5c=['./cmHopperBlack.attributes','define','cm_hopper_black','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d5c,0x14d));var _0xc5d5=function(_0x8c5bf6,_0x3f85ea){_0x8c5bf6=_0x8c5bf6-0x0;var _0x502693=_0x5d5c[_0x8c5bf6];return _0x502693;};'use strict';var _=require(_0xc5d5('0x0'));var util=require(_0xc5d5('0x1'));var logger=require(_0xc5d5('0x2'))(_0xc5d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc5d5('0x4'));var fs=require('fs');var path=require(_0xc5d5('0x5'));var rimraf=require(_0xc5d5('0x6'));var config=require(_0xc5d5('0x7'));var attributes=require(_0xc5d5('0x8'));module['exports']=function(_0x2e9a3f,_0x31dc6c){return _0x2e9a3f[_0xc5d5('0x9')]('CmHopperBlack',attributes,{'tableName':_0xc5d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a17=['rimraf','./cmHopperBlack.attributes','CmHopperBlack','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x22d667,_0x4ab6f6){var _0xc8eba0=function(_0x217df2){while(--_0x217df2){_0x22d667['push'](_0x22d667['shift']());}};_0xc8eba0(++_0x4ab6f6);}(_0x1a17,0x1f2));var _0x71a1=function(_0x49a3b7,_0x5d2586){_0x49a3b7=_0x49a3b7-0x0;var _0x569e43=_0x1a17[_0x49a3b7];return _0x569e43;};'use strict';var _=require('lodash');var util=require(_0x71a1('0x0'));var logger=require(_0x71a1('0x1'))(_0x71a1('0x2'));var moment=require(_0x71a1('0x3'));var BPromise=require(_0x71a1('0x4'));var rp=require(_0x71a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x71a1('0x6'));var config=require('../../config/environment');var attributes=require(_0x71a1('0x7'));module['exports']=function(_0x3716ff,_0x1d078c){return _0x3716ff['define'](_0x71a1('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 286438d..00a36ab 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 _0xf7af=['util','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','map','include','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0xf7af,0xde));var _0xff7a=function(_0x53cd9f,_0xac8289){_0x53cd9f=_0x53cd9f-0x0;var _0x3cab9e=_0xf7af[_0x53cd9f];return _0x3cab9e;};'use strict';var _=require('lodash');var util=require(_0xff7a('0x0'));var moment=require(_0xff7a('0x1'));var BPromise=require(_0xff7a('0x2'));var rs=require(_0xff7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff7a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xff7a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff7a('0x6')][_0xff7a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11919a,_0xd08767,_0x24f037){return new BPromise(function(_0x5e013f,_0x21469b){return client[_0xff7a('0x8')](_0x11919a,_0x24f037)[_0xff7a('0x9')](function(_0x5bd852){logger[_0xff7a('0xa')](_0xff7a('0xb'),_0xd08767,'request\x20sent');logger[_0xff7a('0xc')](_0xff7a('0xd'),_0xd08767,_0xff7a('0xe'),JSON[_0xff7a('0xf')](_0x5bd852));if(_0x5bd852['error']){if(_0x5bd852['error'][_0xff7a('0x10')]===0x1f4){logger['error'](_0xff7a('0xb'),_0xd08767,_0x5bd852[_0xff7a('0x11')][_0xff7a('0x12')]);return _0x21469b(_0x5bd852[_0xff7a('0x11')][_0xff7a('0x12')]);}logger[_0xff7a('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0xd08767,_0x5bd852[_0xff7a('0x11')][_0xff7a('0x12')]);return _0x5e013f(_0x5bd852[_0xff7a('0x11')]['message']);}else{logger[_0xff7a('0xa')](_0xff7a('0xb'),_0xd08767,_0xff7a('0xe'));_0x5e013f(_0x5bd852[_0xff7a('0x13')][_0xff7a('0x12')]);}})[_0xff7a('0x14')](function(_0x5ca97e){logger['error'](_0xff7a('0xb'),_0xd08767,_0x5ca97e);_0x21469b(_0x5ca97e);});});}exports[_0xff7a('0x15')]=function(_0x37a1c2){var _0x81b3b7=this;return new Promise(function(_0x228de6,_0xc05c7b){return db[_0xff7a('0x16')][_0xff7a('0x17')]({'raw':_0x37a1c2[_0xff7a('0x18')]?_0x37a1c2[_0xff7a('0x18')][_0xff7a('0x19')]===undefined?!![]:![]:!![],'where':_0x37a1c2[_0xff7a('0x18')]?_0x37a1c2['options'][_0xff7a('0x1a')]||null:null,'attributes':_0x37a1c2[_0xff7a('0x18')]?_0x37a1c2[_0xff7a('0x18')][_0xff7a('0x1b')]||null:null,'limit':_0x37a1c2['options']?_0x37a1c2[_0xff7a('0x18')][_0xff7a('0x1c')]||null:null,'include':_0x37a1c2['options']?_0x37a1c2['options']['include']?_[_0xff7a('0x1d')](_0x37a1c2[_0xff7a('0x18')][_0xff7a('0x1e')],function(_0x36cc8c){return{'model':db[_0x36cc8c[_0xff7a('0x1f')]],'as':_0x36cc8c['as'],'attributes':_0x36cc8c[_0xff7a('0x1b')],'include':_0x36cc8c['include']?_['map'](_0x36cc8c[_0xff7a('0x1e')],function(_0x4e28ea){return{'model':db[_0x4e28ea[_0xff7a('0x1f')]],'as':_0x4e28ea['as'],'attributes':_0x4e28ea['attributes'],'include':_0x4e28ea[_0xff7a('0x1e')]?_[_0xff7a('0x1d')](_0x4e28ea[_0xff7a('0x1e')],function(_0x373b64){return{'model':db[_0x373b64['model']],'as':_0x373b64['as'],'attributes':_0x373b64[_0xff7a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x265c81){logger[_0xff7a('0xa')]('GetCmHopperBlack',_0x37a1c2);logger[_0xff7a('0xc')](_0xff7a('0x15'),_0x37a1c2,JSON['stringify'](_0x265c81));_0x228de6(_0x265c81);})['catch'](function(_0x396554){logger[_0xff7a('0x11')](_0xff7a('0x15'),_0x396554[_0xff7a('0x12')],_0x37a1c2);_0xc05c7b(_0x81b3b7['error'](0x1f4,_0x396554[_0xff7a('0x12')]));});});};exports[_0xff7a('0x20')]=function(_0x2a7b00){var _0x4abf36=this;return new Promise(function(_0x3cbd6b,_0x370f84){return db[_0xff7a('0x16')][_0xff7a('0x21')](_0x2a7b00[_0xff7a('0x22')],{'raw':_0x2a7b00[_0xff7a('0x18')]?_0x2a7b00['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a7b00['options']?_0x2a7b00[_0xff7a('0x18')][_0xff7a('0x1a')]||null:null,'attributes':_0x2a7b00['options']?_0x2a7b00['options'][_0xff7a('0x1b')]||null:null,'limit':_0x2a7b00[_0xff7a('0x18')]?_0x2a7b00[_0xff7a('0x18')][_0xff7a('0x1c')]||null:null})[_0xff7a('0x9')](function(_0x1d52af){logger[_0xff7a('0xa')](_0xff7a('0x20'),_0x2a7b00);logger['debug'](_0xff7a('0x20'),_0x2a7b00,JSON['stringify'](_0x1d52af));_0x3cbd6b(_0x1d52af);})[_0xff7a('0x14')](function(_0x1c95d8){logger['error'](_0xff7a('0x20'),_0x1c95d8[_0xff7a('0x12')],_0x2a7b00);_0x370f84(_0x4abf36['error'](0x1f4,_0x1c95d8[_0xff7a('0x12')]));});});};exports[_0xff7a('0x23')]=function(_0x448937){var _0x6793e3=this;return new Promise(function(_0x38d5fb,_0x447ca7){return db[_0xff7a('0x16')][_0xff7a('0x24')]({'where':_0x448937[_0xff7a('0x18')]?_0x448937['options'][_0xff7a('0x1a')]||null:null})[_0xff7a('0x9')](function(_0x23b606){logger[_0xff7a('0xa')]('DestroyCmHopperBlack',_0x448937);logger[_0xff7a('0xc')]('DestroyCmHopperBlack',_0x448937,JSON[_0xff7a('0xf')](_0x23b606));_0x38d5fb(_0x23b606);})[_0xff7a('0x14')](function(_0x12001d){logger[_0xff7a('0x11')](_0xff7a('0x23'),_0x12001d[_0xff7a('0x12')],_0x448937);_0x447ca7(_0x6793e3[_0xff7a('0x11')](0x1f4,_0x12001d[_0xff7a('0x12')]));});});}; \ No newline at end of file +var _0x1906=['then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','limit','include','map','attributes','model','catch','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1906,0x124));var _0x6190=function(_0x4b5c91,_0x73283d){_0x4b5c91=_0x4b5c91-0x0;var _0x596f37=_0x1906[_0x4b5c91];return _0x596f37;};'use strict';var _=require(_0x6190('0x0'));var util=require('util');var moment=require(_0x6190('0x1'));var BPromise=require('bluebird');var rs=require(_0x6190('0x2'));var fs=require('fs');var Redis=require(_0x6190('0x3'));var db=require(_0x6190('0x4'))['db'];var utils=require(_0x6190('0x5'));var logger=require(_0x6190('0x6'))(_0x6190('0x7'));var config=require(_0x6190('0x8'));var jayson=require(_0x6190('0x9'));var client=jayson['client'][_0x6190('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8bf8aa,_0x54f20a,_0x2680bd){return new BPromise(function(_0x2f7d9e,_0x84a866){return client[_0x6190('0xb')](_0x8bf8aa,_0x2680bd)[_0x6190('0xc')](function(_0x4ae438){logger[_0x6190('0xd')](_0x6190('0xe'),_0x54f20a,_0x6190('0xf'));logger[_0x6190('0x10')](_0x6190('0x11'),_0x54f20a,_0x6190('0xf'),JSON[_0x6190('0x12')](_0x4ae438));if(_0x4ae438[_0x6190('0x13')]){if(_0x4ae438['error'][_0x6190('0x14')]===0x1f4){logger['error'](_0x6190('0xe'),_0x54f20a,_0x4ae438[_0x6190('0x13')]['message']);return _0x84a866(_0x4ae438[_0x6190('0x13')][_0x6190('0x15')]);}logger[_0x6190('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x54f20a,_0x4ae438[_0x6190('0x13')]['message']);return _0x2f7d9e(_0x4ae438[_0x6190('0x13')][_0x6190('0x15')]);}else{logger[_0x6190('0xd')](_0x6190('0xe'),_0x54f20a,_0x6190('0xf'));_0x2f7d9e(_0x4ae438[_0x6190('0x16')][_0x6190('0x15')]);}})['catch'](function(_0x3ae306){logger['error'](_0x6190('0xe'),_0x54f20a,_0x3ae306);_0x84a866(_0x3ae306);});});}exports[_0x6190('0x17')]=function(_0x41e085){var _0x37481d=this;return new Promise(function(_0x2deefd,_0x2e3077){return db[_0x6190('0x18')]['findAll']({'raw':_0x41e085['options']?_0x41e085[_0x6190('0x19')][_0x6190('0x1a')]===undefined?!![]:![]:!![],'where':_0x41e085['options']?_0x41e085[_0x6190('0x19')][_0x6190('0x1b')]||null:null,'attributes':_0x41e085['options']?_0x41e085[_0x6190('0x19')]['attributes']||null:null,'limit':_0x41e085[_0x6190('0x19')]?_0x41e085[_0x6190('0x19')][_0x6190('0x1c')]||null:null,'include':_0x41e085[_0x6190('0x19')]?_0x41e085[_0x6190('0x19')][_0x6190('0x1d')]?_[_0x6190('0x1e')](_0x41e085[_0x6190('0x19')]['include'],function(_0x47d85e){return{'model':db[_0x47d85e['model']],'as':_0x47d85e['as'],'attributes':_0x47d85e[_0x6190('0x1f')],'include':_0x47d85e[_0x6190('0x1d')]?_[_0x6190('0x1e')](_0x47d85e[_0x6190('0x1d')],function(_0x3c9c30){return{'model':db[_0x3c9c30[_0x6190('0x20')]],'as':_0x3c9c30['as'],'attributes':_0x3c9c30[_0x6190('0x1f')],'include':_0x3c9c30[_0x6190('0x1d')]?_[_0x6190('0x1e')](_0x3c9c30['include'],function(_0x60ca63){return{'model':db[_0x60ca63['model']],'as':_0x60ca63['as'],'attributes':_0x60ca63[_0x6190('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6190('0xc')](function(_0x3116f9){logger[_0x6190('0xd')](_0x6190('0x17'),_0x41e085);logger[_0x6190('0x10')](_0x6190('0x17'),_0x41e085,JSON[_0x6190('0x12')](_0x3116f9));_0x2deefd(_0x3116f9);})[_0x6190('0x21')](function(_0x7d5077){logger[_0x6190('0x13')](_0x6190('0x17'),_0x7d5077[_0x6190('0x15')],_0x41e085);_0x2e3077(_0x37481d['error'](0x1f4,_0x7d5077[_0x6190('0x15')]));});});};exports[_0x6190('0x22')]=function(_0x3cfd86){var _0x11a5a9=this;return new Promise(function(_0x1e6a62,_0x4cd663){return db['CmHopperBlack']['update'](_0x3cfd86[_0x6190('0x23')],{'raw':_0x3cfd86['options']?_0x3cfd86[_0x6190('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cfd86[_0x6190('0x19')]?_0x3cfd86[_0x6190('0x19')][_0x6190('0x1b')]||null:null,'attributes':_0x3cfd86[_0x6190('0x19')]?_0x3cfd86[_0x6190('0x19')][_0x6190('0x1f')]||null:null,'limit':_0x3cfd86['options']?_0x3cfd86['options']['limit']||null:null})[_0x6190('0xc')](function(_0x600de4){logger['info'](_0x6190('0x22'),_0x3cfd86);logger['debug'](_0x6190('0x22'),_0x3cfd86,JSON[_0x6190('0x12')](_0x600de4));_0x1e6a62(_0x600de4);})[_0x6190('0x21')](function(_0x29350b){logger[_0x6190('0x13')](_0x6190('0x22'),_0x29350b[_0x6190('0x15')],_0x3cfd86);_0x4cd663(_0x11a5a9[_0x6190('0x13')](0x1f4,_0x29350b[_0x6190('0x15')]));});});};exports[_0x6190('0x24')]=function(_0x59301b){var _0x33d7ef=this;return new Promise(function(_0x542e45,_0x5cc99e){return db['CmHopperBlack'][_0x6190('0x25')]({'where':_0x59301b[_0x6190('0x19')]?_0x59301b['options']['where']||null:null})['then'](function(_0x1c4c5b){logger[_0x6190('0xd')](_0x6190('0x24'),_0x59301b);logger[_0x6190('0x10')](_0x6190('0x24'),_0x59301b,JSON[_0x6190('0x12')](_0x1c4c5b));_0x542e45(_0x1c4c5b);})['catch'](function(_0x27dc4a){logger['error'](_0x6190('0x24'),_0x27dc4a['message'],_0x59301b);_0x5cc99e(_0x33d7ef[_0x6190('0x13')](0x1f4,_0x27dc4a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a1a1c0e..78ebcd2 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 _0x4fb4=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x4fb4,0x190));var _0x44fb=function(_0x157dc7,_0x540581){_0x157dc7=_0x157dc7-0x0;var _0x21371f=_0x4fb4[_0x157dc7];return _0x21371f;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var fs_extra=require(_0x44fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var controller=require(_0x44fb('0x8'));router[_0x44fb('0x9')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0xb')]);router[_0x44fb('0x9')](_0x44fb('0xc'),auth['isAuthenticated'](),controller[_0x44fb('0xd')]);router[_0x44fb('0x9')]('/:id',auth[_0x44fb('0xa')](),controller[_0x44fb('0xe')]);router[_0x44fb('0xf')](_0x44fb('0x10'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x11')]);router[_0x44fb('0x12')](_0x44fb('0x10'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['./cmHopperBlack.controller','get','index','/describe','isAuthenticated','put','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x48020,_0x2aae5c){var _0x12d307=function(_0x5ee146){while(--_0x5ee146){_0x48020['push'](_0x48020['shift']());}};_0x12d307(++_0x2aae5c);}(_0x7a54,0x106));var _0x47a5=function(_0x1a5834,_0x4a0dce){_0x1a5834=_0x1a5834-0x0;var _0x1d7ec5=_0x7a54[_0x1a5834];return _0x1d7ec5;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')](_0x47a5('0xe'),auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router['delete']('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x10')]);module[_0x47a5('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 76fcf3f..913980c 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 _0x247f=['INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','STRING','DATE'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x247f,0xd8));var _0xf247=function(_0xac2e59,_0x24a451){_0xac2e59=_0xac2e59-0x0;var _0x8c6cf2=_0x247f[_0xac2e59];return _0x8c6cf2;};'use strict';var Sequelize=require(_0xf247('0x0'));var moment=require(_0xf247('0x1'));module[_0xf247('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xf247('0x3')]},'scheduledat':{'type':Sequelize[_0xf247('0x4')]},'countbusyretry':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf247('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf247('0x3')]},'calleridnum':{'type':Sequelize[_0xf247('0x3')]},'calleridname':{'type':Sequelize[_0xf247('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf247('0x4')]},'answertime':{'type':Sequelize[_0xf247('0x4')]},'droptime':{'type':Sequelize[_0xf247('0x4')]},'endtime':{'type':Sequelize[_0xf247('0x4')]},'ringtime':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xf247('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf247('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xf247('0x3')]},'secondDisposition':{'type':Sequelize[_0xf247('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf247('0x3')]},'dispositionat':{'type':Sequelize[_0xf247('0x4')],'set':function(_0xad6c2e){var _0x385a69=this[_0xf247('0x6')](_0xf247('0x7'));if(_0x385a69&&_0xad6c2e){this[_0xf247('0x8')](_0xf247('0x9'),moment(_0xad6c2e)[_0xf247('0xa')](moment(_0x385a69),_0xf247('0xb')));}return this[_0xf247('0x8')]('dispositionat',_0xad6c2e);}},'amd':{'type':Sequelize[_0xf247('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf247('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf247('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xf247('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf247('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf247('0x4')]},'deleted':{'type':Sequelize[_0xf247('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf247('0x4')]},'recallme':{'type':Sequelize[_0xf247('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf247('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xf247('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf247('0x5')],'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 _0x024e=['DATE','getDataValue','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x024e,0xe3));var _0xe024=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0x024e[_0x257b0e];return _0x27ac2a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe024('0x0'));module[_0xe024('0x1')]={'state':{'type':Sequelize[_0xe024('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe024('0x3')]},'scheduledat':{'type':Sequelize[_0xe024('0x4')]},'countbusyretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe024('0x3')]},'originatecalleridname':{'type':Sequelize[_0xe024('0x3')]},'calleridnum':{'type':Sequelize[_0xe024('0x3')]},'calleridname':{'type':Sequelize[_0xe024('0x3')]},'starttime':{'type':Sequelize[_0xe024('0x4')]},'responsetime':{'type':Sequelize[_0xe024('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe024('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe024('0x3')]},'campaign':{'type':Sequelize[_0xe024('0x3')]},'campaigntype':{'type':Sequelize[_0xe024('0x3')]},'membername':{'type':Sequelize[_0xe024('0x3')]},'reason':{'type':Sequelize[_0xe024('0x3')]},'disposition':{'type':Sequelize[_0xe024('0x3')]},'secondDisposition':{'type':Sequelize[_0xe024('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe024('0x3')]},'dispositionat':{'type':Sequelize[_0xe024('0x4')],'set':function(_0x386256){var _0x51642a=this[_0xe024('0x5')]('endtime');if(_0x51642a&&_0x386256){this[_0xe024('0x6')](_0xe024('0x7'),moment(_0x386256)['diff'](moment(_0x51642a),_0xe024('0x8')));}return this[_0xe024('0x6')](_0xe024('0x9'),_0x386256);}},'amd':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe024('0x4')]},'callback':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe024('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe024('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe024('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe024('0x2')],'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/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index ac240be..34eaa6f 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 _0x6d38=['calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','describe','catch','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state'];(function(_0x3c2bce,_0x2ae59f){var _0x19f3f5=function(_0x4d5c62){while(--_0x4d5c62){_0x3c2bce['push'](_0x3c2bce['shift']());}};_0x19f3f5(++_0x2ae59f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6d38[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['CmHopperFinal'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')]()['then'](respondWithResult(_0xd20863,null))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x3226b5,_0x14fa58){if(_0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')]){delete _0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')];}return db[_0x86d3('0x26')][_0x86d3('0x43')]({'where':{'uniqueid':_0x3226b5[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x14fa58,null))['then'](saveUpdates(_0x3226b5[_0x86d3('0x41')],null))[_0x86d3('0x20')](respondWithResult(_0x14fa58,null))['catch'](handleError(_0x14fa58,null));};exports[_0x86d3('0x45')]=function(_0x23a6ee,_0x197047,_0x2e9af5){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x23a6ee['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x48')))),_0x86d3('0x49')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x4b')))),_0x86d3('0x4c')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal'](_0x86d3('0x4d')))),'busyContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x208,\x201,\x20null'))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x86d3('0x4f')))),'dropContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x197047,null))[_0x86d3('0x20')](respondWithResult(_0x197047,null))['catch'](handleError(_0x197047,null));};exports[_0x86d3('0x53')]=function(_0x416428,_0x15cdd0,_0x29bdee){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'CampaignId':_0x416428[_0x86d3('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x86d3('0x49')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4d')))),_0x86d3('0x54')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x55')))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x86d3('0x56')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x57')))),_0x86d3('0x58')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x15cdd0,null))[_0x86d3('0x20')](respondWithResult(_0x15cdd0,null))[_0x86d3('0x40')](handleError(_0x15cdd0,null));};exports[_0x86d3('0x59')]=function(_0x308fed,_0x1c966a,_0x379799){return db['VoiceQueue'][_0x86d3('0x43')]({'where':{'id':_0x308fed[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x1c966a,null))[_0x86d3('0x20')](function(_0x46e356){var _0x47f72e;if(_0x46e356){_0x47f72e=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')]('cm_hopper')[_0x86d3('0x5c')]([_0x86d3('0x5d'),_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x61'),_0x86d3('0x62'),_0x86d3('0x63')],squel[_0x86d3('0x64')]()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),'scheduledAt')[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))[_0x86d3('0x65')]('ANY_VALUE(ListId)',_0x86d3('0x60'))[_0x86d3('0x65')](_0x86d3('0x69'),_0x86d3('0x61'))['field']('NOW()',_0x86d3('0x62'))['field'](_0x86d3('0x67'),'updatedAt')['from'](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())['where'](_0x86d3('0x6d'),_0x308fed[_0x86d3('0x41')]['state'][_0x86d3('0x6c')]())[_0x86d3('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x86d3('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x86d3('0x64')]()['field']('phone')[_0x86d3('0x6e')]('cm_hopper')[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()[_0x86d3('0x65')]('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')][_0x86d3('0x2b')](_0x47f72e);}return[];})['then'](respondWithResult(_0x1c966a,null))[_0x86d3('0x40')](handleError(_0x1c966a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xca2e0,_0x596b1d,_0x5a22ca){return db[_0x86d3('0x72')][_0x86d3('0x43')]({'where':{'id':_0xca2e0['params']['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x596b1d,null))[_0x86d3('0x20')](function(_0x879a8b){var _0x1c1384;if(_0x879a8b){_0x1c1384=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')](_0x86d3('0x73'))['fromQuery'](['phone',_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x74'),_0x86d3('0x62'),_0x86d3('0x63')],squel['select']()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x5e'))[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))['field'](_0x86d3('0x75'),_0x86d3('0x60'))['field']('ANY_VALUE(CampaignId)',_0x86d3('0x74'))[_0x86d3('0x65')](_0x86d3('0x67'),'createdAt')[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x63'))[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x6d'),_0xca2e0[_0x86d3('0x41')][_0x86d3('0x77')]['toString']())[_0x86d3('0x32')](_0x86d3('0x78'))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field'](_0x86d3('0x5d'))[_0x86d3('0x6e')](_0x86d3('0x73'))[_0x86d3('0x32')](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field']('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')]['query'](_0x1c1384);}return[];})['then'](respondWithResult(_0x596b1d,null))['catch'](handleError(_0x596b1d,null));};exports['checkContactHopper']=function(_0xad83bf,_0x2514c1,_0x28a509){return db[_0x86d3('0x79')][_0x86d3('0x7a')]({'where':{'VoiceQueueId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x61')],'CampaignId':_0xad83bf['body'][_0x86d3('0x74')],'ContactId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x5f')]}})[_0x86d3('0x20')](handleEntityNotFound(_0x2514c1,null))['then'](function(_0xe239b5){if(_0xe239b5){return _0xe239b5;}return null;})['then'](respondWithResult(_0x2514c1,null))[_0x86d3('0x40')](handleError(_0x2514c1,null));}; \ No newline at end of file +var _0x4888=['ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','find','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','CmHopperFinal','includeAll','include','rows','catch','params','options','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','select','field','ANY_VALUE(ContactId)','ContactId'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x4888,0x198));var _0x8488=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x4888[_0x292f93];return _0x5a94b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':!![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')]()[_0x8488('0x21')](respondWithResult(_0x1f0516,null))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x42')]=function(_0x886a9e,_0x299d8e){if(_0x886a9e[_0x8488('0x43')][_0x8488('0x44')]){delete _0x886a9e[_0x8488('0x43')][_0x8488('0x44')];}return db[_0x8488('0x3a')]['find']({'where':{'uniqueid':_0x886a9e['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x299d8e,null))[_0x8488('0x21')](saveUpdates(_0x886a9e[_0x8488('0x43')],null))[_0x8488('0x21')](respondWithResult(_0x299d8e,null))[_0x8488('0x3e')](handleError(_0x299d8e,null));};exports[_0x8488('0x45')]=function(_0x25f2dc,_0x27dfd2,_0x24fa20){return db['CmHopperFinal'][_0x8488('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x25f2dc[_0x8488('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),_0x8488('0x4c')],[db['sequelize']['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0x8488('0x4d')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x4f')))),'dropContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x52')))),_0x8488('0x53')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x27dfd2,null))[_0x8488('0x21')](respondWithResult(_0x27dfd2,null))[_0x8488('0x3e')](handleError(_0x27dfd2,null));};exports[_0x8488('0x55')]=function(_0x1971f3,_0x24ba2d,_0x4facfb){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x1971f3[_0x8488('0x3f')]['id']},'attributes':[[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x56')))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x57')))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8488('0x58')],[db[_0x8488('0x48')]['fn']('COUNT',db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x24ba2d,null))['then'](respondWithResult(_0x24ba2d,null))[_0x8488('0x3e')](handleError(_0x24ba2d,null));};exports[_0x8488('0x59')]=function(_0x44a50b,_0x5815cb,_0xbee86e){return db[_0x8488('0x5a')]['find']({'where':{'id':_0x44a50b['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x5815cb,null))[_0x8488('0x21')](function(_0xfedfd2){var _0x3ab1b6;if(_0xfedfd2){_0x3ab1b6=squel[_0x8488('0x5b')]()[_0x8488('0x5c')](_0x8488('0x5d'))[_0x8488('0x5e')]([_0x8488('0x5f'),_0x8488('0x60'),'ContactId',_0x8488('0x61'),'VoiceQueueId',_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')]('ANY_VALUE(calleridnum)',_0x8488('0x5f'))[_0x8488('0x65')]('NOW()',_0x8488('0x60'))['field'](_0x8488('0x66'),_0x8488('0x67'))[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x69'),_0x8488('0x6a'))['field'](_0x8488('0x6b'),'createdAt')['field'](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']())[_0x8488('0x35')](_0x8488('0x6e'),_0x44a50b[_0x8488('0x43')][_0x8488('0x6f')][_0x8488('0x70')]())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8488('0x35')](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x72'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x73')))[_0x8488('0x74')]('ContactId'))[_0x8488('0x70')]();return db['sequelize'][_0x8488('0x2c')](_0x3ab1b6);}return[];})['then'](respondWithResult(_0x5815cb,null))[_0x8488('0x3e')](handleError(_0x5815cb,null));};exports[_0x8488('0x75')]=function(_0x267401,_0x1e635a,_0x31ab35){return db[_0x8488('0x76')][_0x8488('0x77')]({'where':{'id':_0x267401[_0x8488('0x3f')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x1e635a,null))[_0x8488('0x21')](function(_0xce1d1a){var _0xc9c221;if(_0xce1d1a){_0xc9c221=squel[_0x8488('0x5b')]()[_0x8488('0x5c')]('cm_hopper')[_0x8488('0x5e')]([_0x8488('0x5f'),'scheduledAt',_0x8488('0x67'),_0x8488('0x61'),_0x8488('0x78'),_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x79'),_0x8488('0x5f'))[_0x8488('0x65')](_0x8488('0x6b'),'scheduledAt')[_0x8488('0x65')](_0x8488('0x66'),'ContactId')[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x7a'),'CampaignId')['field'](_0x8488('0x6b'),_0x8488('0x62'))[_0x8488('0x65')](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')](_0x8488('0x7b'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x6e'),_0x267401[_0x8488('0x43')][_0x8488('0x6f')]['toString']())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x72'))[_0x8488('0x6c')](_0x8488('0x7b'))['where'](_0x8488('0x7c'),_0x267401['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')]('state\x20=\x204'))['group'](_0x8488('0x67')))[_0x8488('0x70')]();return db[_0x8488('0x48')][_0x8488('0x2c')](_0xc9c221);}return[];})[_0x8488('0x21')](respondWithResult(_0x1e635a,null))['catch'](handleError(_0x1e635a,null));};exports[_0x8488('0x7d')]=function(_0x19c5c6,_0x50f773,_0x52c750){return db[_0x8488('0x7e')][_0x8488('0x7f')]({'where':{'VoiceQueueId':_0x19c5c6[_0x8488('0x43')]['VoiceQueueId'],'CampaignId':_0x19c5c6['body'][_0x8488('0x78')],'ContactId':_0x19c5c6[_0x8488('0x43')][_0x8488('0x67')]}})['then'](handleEntityNotFound(_0x50f773,null))[_0x8488('0x21')](function(_0x1e4e51){if(_0x1e4e51){return _0x1e4e51;}return null;})[_0x8488('0x21')](respondWithResult(_0x50f773,null))[_0x8488('0x3e')](handleError(_0x50f773,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7fbda97..65e4d9a 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 _0xf3b0=['define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x4885c5,_0x119853){var _0x2cd0f1=function(_0x2483c5){while(--_0x2483c5){_0x4885c5['push'](_0x4885c5['shift']());}};_0x2cd0f1(++_0x119853);}(_0xf3b0,0x1c6));var _0x0f3b=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xf3b0[_0x4a0e68];return _0x4fb274;};'use strict';var _=require(_0x0f3b('0x0'));var util=require(_0x0f3b('0x1'));var logger=require(_0x0f3b('0x2'))(_0x0f3b('0x3'));var moment=require(_0x0f3b('0x4'));var BPromise=require('bluebird');var rp=require(_0x0f3b('0x5'));var fs=require('fs');var path=require(_0x0f3b('0x6'));var rimraf=require(_0x0f3b('0x7'));var config=require(_0x0f3b('0x8'));var attributes=require(_0x0f3b('0x9'));module[_0x0f3b('0xa')]=function(_0x2a5f67,_0x3488b7){return _0x2a5f67[_0x0f3b('0xb')]('CmHopperFinal',attributes,{'tableName':_0x0f3b('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x0f3b('0xd')]},{'name':_0x0f3b('0xe'),'fields':[_0x0f3b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56f4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x56f4,0x109));var _0x456f=function(_0x5dc240,_0x5ce6c5){_0x5dc240=_0x5dc240-0x0;var _0x5c89c5=_0x56f4[_0x5dc240];return _0x5c89c5;};'use strict';var _=require(_0x456f('0x0'));var util=require(_0x456f('0x1'));var logger=require(_0x456f('0x2'))('api');var moment=require(_0x456f('0x3'));var BPromise=require(_0x456f('0x4'));var rp=require(_0x456f('0x5'));var fs=require('fs');var path=require(_0x456f('0x6'));var rimraf=require(_0x456f('0x7'));var config=require(_0x456f('0x8'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x56a50a,_0x4f729f){return _0x56a50a[_0x456f('0x9')](_0x456f('0xa'),attributes,{'tableName':_0x456f('0xb'),'paranoid':![],'indexes':[{'name':_0x456f('0xc'),'fields':[_0x456f('0xc')]},{'name':_0x456f('0xd'),'fields':[_0x456f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 95f0a20..598b86e 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x406725,_0x7b2fb8){var _0x1af3d4=function(_0xebf752){while(--_0xebf752){_0x406725['push'](_0x406725['shift']());}};_0x1af3d4(++_0x7b2fb8);}(_0x7a54,0x106));var _0x47a5=function(_0x17540e,_0x393619){_0x17540e=_0x17540e-0x0;var _0x1e71d8=_0x7a54[_0x17540e];return _0x1e71d8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x1bae9a,_0x5acb3f){var _0x528008=function(_0x247f51){while(--_0x247f51){_0x1bae9a['push'](_0x1bae9a['shift']());}};_0x528008(++_0x5acb3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x512eb0,_0x27edfe){_0x512eb0=_0x512eb0-0x0;var _0x1378fe=_0xb10b[_0x512eb0];return _0x1378fe;};'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 446ea21..e63416f 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 _0xa5aa=['/checkContactHopper','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x5875bf,_0x201039){var _0x11a28d=function(_0x250949){while(--_0x250949){_0x5875bf['push'](_0x5875bf['shift']());}};_0x11a28d(++_0x201039);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x4f6f1a,_0x3e3bc1){_0x4f6f1a=_0x4f6f1a-0x0;var _0x26df43=_0xa5aa[_0x4f6f1a];return _0x26df43;};'use strict';var multer=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var path=require('path');var timeout=require(_0xaa5a('0x2'));var express=require(_0xaa5a('0x3'));var router=express[_0xaa5a('0x4')]();var fs_extra=require(_0xaa5a('0x5'));var auth=require(_0xaa5a('0x6'));var interaction=require(_0xaa5a('0x7'));var config=require('../../config/environment');var controller=require(_0xaa5a('0x8'));router[_0xaa5a('0x9')]('/',auth[_0xaa5a('0xa')](),controller['index']);router['get'](_0xaa5a('0xb'),auth[_0xaa5a('0xa')](),controller['describe']);router[_0xaa5a('0x9')](_0xaa5a('0xc'),auth[_0xaa5a('0xa')](),controller['show']);router[_0xaa5a('0x9')](_0xaa5a('0xd'),auth[_0xaa5a('0xa')](),controller[_0xaa5a('0xe')]);router[_0xaa5a('0x9')](_0xaa5a('0xf'),auth['isAuthenticated'](),controller[_0xaa5a('0x10')]);router[_0xaa5a('0x11')](_0xaa5a('0x12'),auth[_0xaa5a('0xa')](),controller[_0xaa5a('0x13')]);router[_0xaa5a('0x11')](_0xaa5a('0x14'),auth[_0xaa5a('0xa')](),controller[_0xaa5a('0x15')]);router[_0xaa5a('0x11')](_0xaa5a('0x16'),auth[_0xaa5a('0xa')](),controller['checkContactHopper']);router[_0xaa5a('0x17')](_0xaa5a('0xc'),auth[_0xaa5a('0xa')](),controller['update']);module[_0xaa5a('0x18')]=router; \ No newline at end of file +var _0x0942=['update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','isAuthenticated','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put'];(function(_0x21ce4a,_0x49f756){var _0x93ca77=function(_0x365a9a){while(--_0x365a9a){_0x21ce4a['push'](_0x21ce4a['shift']());}};_0x93ca77(++_0x49f756);}(_0x0942,0x11a));var _0x2094=function(_0x143529,_0x50da59){_0x143529=_0x143529-0x0;var _0x2113d1=_0x0942[_0x143529];return _0x2113d1;};'use strict';var multer=require('multer');var util=require(_0x2094('0x0'));var path=require(_0x2094('0x1'));var timeout=require(_0x2094('0x2'));var express=require(_0x2094('0x3'));var router=express[_0x2094('0x4')]();var fs_extra=require(_0x2094('0x5'));var auth=require(_0x2094('0x6'));var interaction=require(_0x2094('0x7'));var config=require('../../config/environment');var controller=require(_0x2094('0x8'));router[_0x2094('0x9')]('/',auth['isAuthenticated'](),controller[_0x2094('0xa')]);router[_0x2094('0x9')](_0x2094('0xb'),auth['isAuthenticated'](),controller[_0x2094('0xc')]);router[_0x2094('0x9')](_0x2094('0xd'),auth['isAuthenticated'](),controller[_0x2094('0xe')]);router[_0x2094('0x9')](_0x2094('0xf'),auth['isAuthenticated'](),controller[_0x2094('0x10')]);router[_0x2094('0x9')](_0x2094('0x11'),auth[_0x2094('0x12')](),controller[_0x2094('0x13')]);router[_0x2094('0x14')]('/voice/queue/moveContacts/:id',auth[_0x2094('0x12')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x2094('0x14')](_0x2094('0x15'),auth[_0x2094('0x12')](),controller[_0x2094('0x16')]);router['post'](_0x2094('0x17'),auth['isAuthenticated'](),controller[_0x2094('0x18')]);router[_0x2094('0x19')]('/:id',auth[_0x2094('0x12')](),controller[_0x2094('0x1a')]);module[_0x2094('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index e06a397..94f8277 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 _0x7460=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x24ef02,_0x5b1d47){var _0x37ec45=function(_0xeffc47){while(--_0xeffc47){_0x24ef02['push'](_0x24ef02['shift']());}};_0x37ec45(++_0x5b1d47);}(_0x7460,0xc1));var _0x0746=function(_0x53afdb,_0x2e743a){_0x53afdb=_0x53afdb-0x0;var _0x1cb9f3=_0x7460[_0x53afdb];return _0x1cb9f3;};'use strict';var Sequelize=require(_0x0746('0x0'));module[_0x0746('0x1')]={'state':{'type':Sequelize[_0x0746('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0746('0x3')]},'scheduledat':{'type':Sequelize[_0x0746('0x4')]},'countbusyretry':{'type':Sequelize[_0x0746('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0746('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0746('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0746('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0746('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0746('0x3')]},'calleridname':{'type':Sequelize[_0x0746('0x3')]},'starttime':{'type':Sequelize[_0x0746('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x0746('0x4')]},'droptime':{'type':Sequelize[_0x0746('0x4')]},'endtime':{'type':Sequelize[_0x0746('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0746('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0746('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0746('0x3')]},'campaign':{'type':Sequelize[_0x0746('0x3')]},'campaigntype':{'type':Sequelize[_0x0746('0x3')]},'membername':{'type':Sequelize[_0x0746('0x3')]},'reason':{'type':Sequelize[_0x0746('0x3')]},'amd':{'type':Sequelize[_0x0746('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0746('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0746('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0746('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x0746('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0746('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0746('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0746('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9d25=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x53c113,_0x4d37d8){var _0x51fe0d=function(_0x5ec6a5){while(--_0x5ec6a5){_0x53c113['push'](_0x53c113['shift']());}};_0x51fe0d(++_0x4d37d8);}(_0x9d25,0x160));var _0x59d2=function(_0x283248,_0x69553f){_0x283248=_0x283248-0x0;var _0x5c19fb=_0x9d25[_0x283248];return _0x5c19fb;};'use strict';var Sequelize=require(_0x59d2('0x0'));module[_0x59d2('0x1')]={'state':{'type':Sequelize[_0x59d2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x59d2('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x59d2('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x59d2('0x3')]},'originatecalleridname':{'type':Sequelize[_0x59d2('0x3')]},'calleridnum':{'type':Sequelize[_0x59d2('0x3')]},'calleridname':{'type':Sequelize[_0x59d2('0x3')]},'starttime':{'type':Sequelize[_0x59d2('0x4')]},'responsetime':{'type':Sequelize[_0x59d2('0x4')]},'answertime':{'type':Sequelize[_0x59d2('0x4')]},'droptime':{'type':Sequelize[_0x59d2('0x4')]},'endtime':{'type':Sequelize[_0x59d2('0x4')]},'ringtime':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x59d2('0x3')]},'campaign':{'type':Sequelize[_0x59d2('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x59d2('0x3')]},'reason':{'type':Sequelize[_0x59d2('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x59d2('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x59d2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x59d2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59d2('0x4')]},'recallme':{'type':Sequelize[_0x59d2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x59d2('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 60890f3..c829935 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 _0x7da1=['filter','type','VIRTUAL','merge','options','includeAll','CmHopperHistory','findAll','catch','length','find','create','describe','body','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick'];(function(_0x5055f1,_0x3cbb87){var _0x28a9f0=function(_0x31433d){while(--_0x31433d){_0x5055f1['push'](_0x5055f1['shift']());}};_0x28a9f0(++_0x3cbb87);}(_0x7da1,0x130));var _0x17da=function(_0x18407c,_0x12e210){_0x18407c=_0x18407c-0x0;var _0x494712=_0x7da1[_0x18407c];return _0x494712;};'use strict';var emlformat=require(_0x17da('0x0'));var rimraf=require(_0x17da('0x1'));var zipdir=require(_0x17da('0x2'));var jsonpatch=require(_0x17da('0x3'));var rp=require('request-promise');var moment=require(_0x17da('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x17da('0x5'));var path=require(_0x17da('0x6'));var sox=require(_0x17da('0x7'));var csv=require(_0x17da('0x8'));var ejs=require(_0x17da('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x17da('0xa'));var squel=require(_0x17da('0xb'));var crypto=require(_0x17da('0xc'));var jsforce=require(_0x17da('0xd'));var deskjs=require(_0x17da('0xe'));var toCsv=require(_0x17da('0x8'));var querystring=require(_0x17da('0xf'));var Papa=require(_0x17da('0x10'));var Redis=require(_0x17da('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x17da('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x17da('0x13'));var utils=require(_0x17da('0x14'));var config=require(_0x17da('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x17da('0x16'))['db'];function respondWithStatusCode(_0x4af536,_0x2917b5){_0x2917b5=_0x2917b5||0xcc;return function(_0x1a1f36){if(_0x1a1f36){return _0x4af536[_0x17da('0x17')](_0x2917b5);}return _0x4af536['status'](_0x2917b5)[_0x17da('0x18')]();};}function respondWithResult(_0x9e0d2d,_0x4ed807){_0x4ed807=_0x4ed807||0xc8;return function(_0x4d567c){if(_0x4d567c){return _0x9e0d2d[_0x17da('0x19')](_0x4ed807)[_0x17da('0x1a')](_0x4d567c);}};}function respondWithFilteredResult(_0x1bb3bb,_0x4f1a61){return function(_0x4320d0){if(_0x4320d0){var _0x3185c7=typeof _0x4f1a61['offset']===_0x17da('0x1b')&&typeof _0x4f1a61[_0x17da('0x1c')]===_0x17da('0x1b');var _0x54a299=_0x4320d0[_0x17da('0x1d')];var _0x45f390=_0x3185c7?0x0:_0x4f1a61[_0x17da('0x1e')];var _0x3de4e4=_0x3185c7?_0x4320d0[_0x17da('0x1d')]:_0x4f1a61[_0x17da('0x1e')]+_0x4f1a61[_0x17da('0x1c')];var _0x3b8733;if(_0x3de4e4>=_0x54a299){_0x3de4e4=_0x54a299;_0x3b8733=0xc8;}else{_0x3b8733=0xce;}_0x1bb3bb['status'](_0x3b8733);return _0x1bb3bb[_0x17da('0x1f')](_0x17da('0x20'),_0x45f390+'-'+_0x3de4e4+'/'+_0x54a299)[_0x17da('0x1a')](_0x4320d0);}return null;};}function patchUpdates(_0x24fb25){return function(_0x1344b5){try{jsonpatch[_0x17da('0x21')](_0x1344b5,_0x24fb25,!![]);}catch(_0x13cf31){return BPromise[_0x17da('0x22')](_0x13cf31);}return _0x1344b5[_0x17da('0x23')]();};}function saveUpdates(_0x1c7397,_0x769ab){return function(_0x42d5ce){if(_0x42d5ce){return _0x42d5ce[_0x17da('0x24')](_0x1c7397)[_0x17da('0x25')](function(_0x595030){return _0x595030;});}return null;};}function removeEntity(_0x281c3f,_0x354773){return function(_0x5d057b){if(_0x5d057b){return _0x5d057b['destroy']()['then'](function(){_0x281c3f[_0x17da('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25d868,_0x1ab278){return function(_0x4ba09a){if(!_0x4ba09a){_0x25d868[_0x17da('0x17')](0x194);}return _0x4ba09a;};}function handleError(_0x2124ac,_0x565972){_0x565972=_0x565972||0x1f4;return function(_0x2840ae){logger['error'](_0x2840ae[_0x17da('0x26')]);if(_0x2840ae[_0x17da('0x27')]){delete _0x2840ae[_0x17da('0x27')];}_0x2124ac[_0x17da('0x19')](_0x565972)['send'](_0x2840ae);};}exports[_0x17da('0x28')]=function(_0x504c6a,_0x3d3085){var _0x39b22c={},_0x506dcb={},_0x1926dd={'count':0x0,'rows':[]};var _0xac0c11=_[_0x17da('0x29')](db['CmHopperHistory'][_0x17da('0x2a')],function(_0x147b52){return{'name':_0x147b52[_0x17da('0x2b')],'type':_0x147b52['type'][_0x17da('0x2c')]};});_0x506dcb[_0x17da('0x2d')]=_['map'](_0xac0c11,_0x17da('0x27'));_0x506dcb[_0x17da('0x2e')]=_[_0x17da('0x2f')](_0x504c6a[_0x17da('0x2e')]);_0x506dcb[_0x17da('0x30')]=_[_0x17da('0x31')](_0x506dcb[_0x17da('0x2d')],_0x506dcb['query']);_0x39b22c[_0x17da('0x32')]=_[_0x17da('0x31')](_0x506dcb[_0x17da('0x2d')],qs[_0x17da('0x33')](_0x504c6a[_0x17da('0x2e')][_0x17da('0x33')]));_0x39b22c[_0x17da('0x32')]=_0x39b22c['attributes']['length']?_0x39b22c['attributes']:_0x506dcb[_0x17da('0x2d')];if(!_0x504c6a['query']['hasOwnProperty']('nolimit')){_0x39b22c[_0x17da('0x1c')]=qs['limit'](_0x504c6a['query'][_0x17da('0x1c')]);_0x39b22c[_0x17da('0x1e')]=qs[_0x17da('0x1e')](_0x504c6a[_0x17da('0x2e')][_0x17da('0x1e')]);}_0x39b22c[_0x17da('0x34')]=qs[_0x17da('0x35')](_0x504c6a[_0x17da('0x2e')][_0x17da('0x35')]);_0x39b22c[_0x17da('0x36')]=qs[_0x17da('0x30')](_[_0x17da('0x37')](_0x504c6a[_0x17da('0x2e')],_0x506dcb[_0x17da('0x30')]),_0xac0c11);if(_0x504c6a[_0x17da('0x2e')][_0x17da('0x38')]){_0x39b22c[_0x17da('0x36')]=_['merge'](_0x39b22c['where'],{'$or':_['map'](_0xac0c11,function(_0x8eb929){if(_0x8eb929[_0x17da('0x39')]!==_0x17da('0x3a')){var _0x1d546a={};_0x1d546a[_0x8eb929[_0x17da('0x27')]]={'$like':'%'+_0x504c6a[_0x17da('0x2e')][_0x17da('0x38')]+'%'};return _0x1d546a;}})});}_0x39b22c=_[_0x17da('0x3b')]({},_0x39b22c,_0x504c6a[_0x17da('0x3c')]);var _0x585f74={'where':_0x39b22c['where']};return db['CmHopperHistory']['count'](_0x585f74)[_0x17da('0x25')](function(_0x11232c){_0x1926dd[_0x17da('0x1d')]=_0x11232c;if(_0x504c6a[_0x17da('0x2e')][_0x17da('0x3d')]){_0x39b22c['include']=[{'all':!![]}];}return db[_0x17da('0x3e')][_0x17da('0x3f')](_0x39b22c);})[_0x17da('0x25')](function(_0x5c25de){_0x1926dd['rows']=_0x5c25de;return _0x1926dd;})['then'](respondWithFilteredResult(_0x3d3085,_0x39b22c))[_0x17da('0x40')](handleError(_0x3d3085,null));};exports['show']=function(_0x24f688,_0x55bedc){var _0x1fbc4e={'raw':!![],'where':{'id':_0x24f688['params']['id']}},_0xa6ef9b={};_0xa6ef9b[_0x17da('0x2d')]=_[_0x17da('0x2f')](db['CmHopperHistory'][_0x17da('0x2a')]);_0xa6ef9b[_0x17da('0x2e')]=_[_0x17da('0x2f')](_0x24f688[_0x17da('0x2e')]);_0xa6ef9b[_0x17da('0x30')]=_['intersection'](_0xa6ef9b['model'],_0xa6ef9b['query']);_0x1fbc4e[_0x17da('0x32')]=_[_0x17da('0x31')](_0xa6ef9b[_0x17da('0x2d')],qs[_0x17da('0x33')](_0x24f688[_0x17da('0x2e')][_0x17da('0x33')]));_0x1fbc4e['attributes']=_0x1fbc4e['attributes'][_0x17da('0x41')]?_0x1fbc4e[_0x17da('0x32')]:_0xa6ef9b['model'];if(_0x24f688['query']['includeAll']){_0x1fbc4e['include']=[{'all':!![]}];}_0x1fbc4e=_[_0x17da('0x3b')]({},_0x1fbc4e,_0x24f688[_0x17da('0x3c')]);return db[_0x17da('0x3e')][_0x17da('0x42')](_0x1fbc4e)[_0x17da('0x25')](handleEntityNotFound(_0x55bedc,null))['then'](respondWithResult(_0x55bedc,null))[_0x17da('0x40')](handleError(_0x55bedc,null));};exports[_0x17da('0x43')]=function(_0x5f24e6,_0x23a6e5){return db[_0x17da('0x3e')]['create'](_0x5f24e6['body'],{})[_0x17da('0x25')](respondWithResult(_0x23a6e5,0xc9))[_0x17da('0x40')](handleError(_0x23a6e5,null));};exports[_0x17da('0x44')]=function(_0x37227c,_0x50569b){return db[_0x17da('0x3e')][_0x17da('0x44')]()[_0x17da('0x25')](respondWithResult(_0x50569b,null))[_0x17da('0x40')](handleError(_0x50569b,null));};exports[_0x17da('0x24')]=function(_0x2119b1,_0x1384c0){if(_0x2119b1[_0x17da('0x45')][_0x17da('0x46')]){delete _0x2119b1['body'][_0x17da('0x46')];}return db[_0x17da('0x3e')][_0x17da('0x42')]({'where':{'uniqueid':_0x2119b1[_0x17da('0x47')]['id']}})[_0x17da('0x25')](handleEntityNotFound(_0x1384c0,null))[_0x17da('0x25')](saveUpdates(_0x2119b1['body'],null))['then'](respondWithResult(_0x1384c0,null))[_0x17da('0x40')](handleError(_0x1384c0,null));}; \ No newline at end of file +var _0xf481=['error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','create','body','describe','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy'];(function(_0x443a06,_0x5bafca){var _0xa1fb2b=function(_0x141ddd){while(--_0x141ddd){_0x443a06['push'](_0x443a06['shift']());}};_0xa1fb2b(++_0x5bafca);}(_0xf481,0x1f1));var _0x1f48=function(_0x3dd8dd,_0x369f8e){_0x3dd8dd=_0x3dd8dd-0x0;var _0x33e300=_0xf481[_0x3dd8dd];return _0x33e300;};'use strict';var emlformat=require(_0x1f48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f48('0x1'));var jsonpatch=require(_0x1f48('0x2'));var rp=require('request-promise');var moment=require(_0x1f48('0x3'));var BPromise=require(_0x1f48('0x4'));var Mustache=require('mustache');var util=require(_0x1f48('0x5'));var path=require(_0x1f48('0x6'));var sox=require('sox');var csv=require(_0x1f48('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f48('0x8'));var _=require(_0x1f48('0x9'));var squel=require('squel');var crypto=require(_0x1f48('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1f48('0xb'));var toCsv=require(_0x1f48('0x7'));var querystring=require(_0x1f48('0xc'));var Papa=require('papaparse');var Redis=require(_0x1f48('0xd'));var authService=require(_0x1f48('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1f48('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1f48('0x10'));var licenseUtil=require(_0x1f48('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f1cde,_0x123a46){_0x123a46=_0x123a46||0xcc;return function(_0x3b3fdc){if(_0x3b3fdc){return _0x5f1cde[_0x1f48('0x12')](_0x123a46);}return _0x5f1cde[_0x1f48('0x13')](_0x123a46)[_0x1f48('0x14')]();};}function respondWithResult(_0x276b1f,_0xd2de60){_0xd2de60=_0xd2de60||0xc8;return function(_0x438207){if(_0x438207){return _0x276b1f['status'](_0xd2de60)[_0x1f48('0x15')](_0x438207);}};}function respondWithFilteredResult(_0x40b945,_0x202b69){return function(_0x53a019){if(_0x53a019){var _0x58bf9d=typeof _0x202b69['offset']===_0x1f48('0x16')&&typeof _0x202b69[_0x1f48('0x17')]==='undefined';var _0x50a3c6=_0x53a019[_0x1f48('0x18')];var _0x3f1a8f=_0x58bf9d?0x0:_0x202b69[_0x1f48('0x19')];var _0x241347=_0x58bf9d?_0x53a019['count']:_0x202b69[_0x1f48('0x19')]+_0x202b69[_0x1f48('0x17')];var _0x545efd;if(_0x241347>=_0x50a3c6){_0x241347=_0x50a3c6;_0x545efd=0xc8;}else{_0x545efd=0xce;}_0x40b945['status'](_0x545efd);return _0x40b945['set'](_0x1f48('0x1a'),_0x3f1a8f+'-'+_0x241347+'/'+_0x50a3c6)[_0x1f48('0x15')](_0x53a019);}return null;};}function patchUpdates(_0x321095){return function(_0x3795c7){try{jsonpatch[_0x1f48('0x1b')](_0x3795c7,_0x321095,!![]);}catch(_0x51a26d){return BPromise['reject'](_0x51a26d);}return _0x3795c7['save']();};}function saveUpdates(_0x4ff3e6,_0x7db0d5){return function(_0x15b433){if(_0x15b433){return _0x15b433[_0x1f48('0x1c')](_0x4ff3e6)[_0x1f48('0x1d')](function(_0x4a6b3c){return _0x4a6b3c;});}return null;};}function removeEntity(_0x32bcff,_0x376856){return function(_0x2e8d46){if(_0x2e8d46){return _0x2e8d46[_0x1f48('0x1e')]()[_0x1f48('0x1d')](function(){_0x32bcff[_0x1f48('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb5ca,_0x8ed6f8){return function(_0x346469){if(!_0x346469){_0x1eb5ca[_0x1f48('0x12')](0x194);}return _0x346469;};}function handleError(_0x11e5b6,_0x506521){_0x506521=_0x506521||0x1f4;return function(_0x16b7cd){logger[_0x1f48('0x1f')](_0x16b7cd[_0x1f48('0x20')]);if(_0x16b7cd['name']){delete _0x16b7cd[_0x1f48('0x21')];}_0x11e5b6[_0x1f48('0x13')](_0x506521)[_0x1f48('0x22')](_0x16b7cd);};}exports[_0x1f48('0x23')]=function(_0xc1f877,_0x1960d2){var _0x213765={},_0x4d7f03={},_0x2a6fa1={'count':0x0,'rows':[]};var _0x16f36f=_[_0x1f48('0x24')](db[_0x1f48('0x25')][_0x1f48('0x26')],function(_0x106e54){return{'name':_0x106e54[_0x1f48('0x27')],'type':_0x106e54['type'][_0x1f48('0x28')]};});_0x4d7f03[_0x1f48('0x29')]=_[_0x1f48('0x24')](_0x16f36f,'name');_0x4d7f03[_0x1f48('0x2a')]=_[_0x1f48('0x2b')](_0xc1f877[_0x1f48('0x2a')]);_0x4d7f03[_0x1f48('0x2c')]=_['intersection'](_0x4d7f03[_0x1f48('0x29')],_0x4d7f03[_0x1f48('0x2a')]);_0x213765[_0x1f48('0x2d')]=_[_0x1f48('0x2e')](_0x4d7f03['model'],qs[_0x1f48('0x2f')](_0xc1f877[_0x1f48('0x2a')]['fields']));_0x213765['attributes']=_0x213765[_0x1f48('0x2d')][_0x1f48('0x30')]?_0x213765[_0x1f48('0x2d')]:_0x4d7f03[_0x1f48('0x29')];if(!_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x31')](_0x1f48('0x32'))){_0x213765[_0x1f48('0x17')]=qs['limit'](_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x17')]);_0x213765[_0x1f48('0x19')]=qs[_0x1f48('0x19')](_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x19')]);}_0x213765[_0x1f48('0x33')]=qs[_0x1f48('0x34')](_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x34')]);_0x213765[_0x1f48('0x35')]=qs[_0x1f48('0x2c')](_['pick'](_0xc1f877[_0x1f48('0x2a')],_0x4d7f03['filters']),_0x16f36f);if(_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x36')]){_0x213765['where']=_[_0x1f48('0x37')](_0x213765['where'],{'$or':_[_0x1f48('0x24')](_0x16f36f,function(_0x45db12){if(_0x45db12['type']!=='VIRTUAL'){var _0x56217b={};_0x56217b[_0x45db12['name']]={'$like':'%'+_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x36')]+'%'};return _0x56217b;}})});}_0x213765=_['merge']({},_0x213765,_0xc1f877[_0x1f48('0x38')]);var _0xdd1286={'where':_0x213765[_0x1f48('0x35')]};return db[_0x1f48('0x25')][_0x1f48('0x18')](_0xdd1286)[_0x1f48('0x1d')](function(_0x482e6a){_0x2a6fa1[_0x1f48('0x18')]=_0x482e6a;if(_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x39')]){_0x213765[_0x1f48('0x3a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1f48('0x3b')](_0x213765);})['then'](function(_0x18c734){_0x2a6fa1['rows']=_0x18c734;return _0x2a6fa1;})[_0x1f48('0x1d')](respondWithFilteredResult(_0x1960d2,_0x213765))['catch'](handleError(_0x1960d2,null));};exports['show']=function(_0x52cfa3,_0x3eaa32){var _0x320449={'raw':!![],'where':{'id':_0x52cfa3['params']['id']}},_0x2ca41d={};_0x2ca41d[_0x1f48('0x29')]=_[_0x1f48('0x2b')](db[_0x1f48('0x25')]['rawAttributes']);_0x2ca41d[_0x1f48('0x2a')]=_[_0x1f48('0x2b')](_0x52cfa3[_0x1f48('0x2a')]);_0x2ca41d[_0x1f48('0x2c')]=_[_0x1f48('0x2e')](_0x2ca41d['model'],_0x2ca41d[_0x1f48('0x2a')]);_0x320449['attributes']=_[_0x1f48('0x2e')](_0x2ca41d[_0x1f48('0x29')],qs[_0x1f48('0x2f')](_0x52cfa3[_0x1f48('0x2a')][_0x1f48('0x2f')]));_0x320449[_0x1f48('0x2d')]=_0x320449[_0x1f48('0x2d')]['length']?_0x320449[_0x1f48('0x2d')]:_0x2ca41d[_0x1f48('0x29')];if(_0x52cfa3[_0x1f48('0x2a')][_0x1f48('0x39')]){_0x320449[_0x1f48('0x3a')]=[{'all':!![]}];}_0x320449=_[_0x1f48('0x37')]({},_0x320449,_0x52cfa3['options']);return db[_0x1f48('0x25')]['find'](_0x320449)[_0x1f48('0x1d')](handleEntityNotFound(_0x3eaa32,null))[_0x1f48('0x1d')](respondWithResult(_0x3eaa32,null))[_0x1f48('0x3c')](handleError(_0x3eaa32,null));};exports['create']=function(_0xe33773,_0x5dae77){return db['CmHopperHistory'][_0x1f48('0x3d')](_0xe33773[_0x1f48('0x3e')],{})[_0x1f48('0x1d')](respondWithResult(_0x5dae77,0xc9))['catch'](handleError(_0x5dae77,null));};exports[_0x1f48('0x3f')]=function(_0x46000e,_0x364a5a){return db[_0x1f48('0x25')][_0x1f48('0x3f')]()['then'](respondWithResult(_0x364a5a,null))[_0x1f48('0x3c')](handleError(_0x364a5a,null));};exports[_0x1f48('0x1c')]=function(_0x5349c4,_0x35e39d){if(_0x5349c4[_0x1f48('0x3e')]['uniqueid']){delete _0x5349c4['body']['uniqueid'];}return db[_0x1f48('0x25')][_0x1f48('0x40')]({'where':{'uniqueid':_0x5349c4[_0x1f48('0x41')]['id']}})[_0x1f48('0x1d')](handleEntityNotFound(_0x35e39d,null))[_0x1f48('0x1d')](saveUpdates(_0x5349c4['body'],null))[_0x1f48('0x1d')](respondWithResult(_0x35e39d,null))['catch'](handleError(_0x35e39d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 111ebb7..543b2f1 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 _0xb114=['../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2311e2,_0x383855){var _0x43bf6a=function(_0x4a3e48){while(--_0x4a3e48){_0x2311e2['push'](_0x2311e2['shift']());}};_0x43bf6a(++_0x383855);}(_0xb114,0x11f));var _0x4b11=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb114[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x4b11('0x0'));var util=require('util');var logger=require(_0x4b11('0x1'))(_0x4b11('0x2'));var moment=require('moment');var BPromise=require(_0x4b11('0x3'));var rp=require(_0x4b11('0x4'));var fs=require('fs');var path=require(_0x4b11('0x5'));var rimraf=require(_0x4b11('0x6'));var config=require(_0x4b11('0x7'));var attributes=require(_0x4b11('0x8'));module['exports']=function(_0x139a82,_0x57aec8){return _0x139a82[_0x4b11('0x9')](_0x4b11('0xa'),attributes,{'tableName':_0x4b11('0xb'),'paranoid':![],'indexes':[{'name':_0x4b11('0xc'),'fields':[_0x4b11('0xc')]},{'name':'uniqueid','fields':[_0x4b11('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c45=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x243092,_0x2b2a3a){var _0x228392=function(_0x5752a2){while(--_0x5752a2){_0x243092['push'](_0x243092['shift']());}};_0x228392(++_0x2b2a3a);}(_0x6c45,0xb1));var _0x56c4=function(_0x31cb37,_0x28159a){_0x31cb37=_0x31cb37-0x0;var _0x293886=_0x6c45[_0x31cb37];return _0x293886;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var logger=require('../../config/logger')(_0x56c4('0x2'));var moment=require(_0x56c4('0x3'));var BPromise=require(_0x56c4('0x4'));var rp=require(_0x56c4('0x5'));var fs=require('fs');var path=require(_0x56c4('0x6'));var rimraf=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var attributes=require(_0x56c4('0x9'));module[_0x56c4('0xa')]=function(_0x3cc49e,_0x1fcb9e){return _0x3cc49e[_0x56c4('0xb')](_0x56c4('0xc'),attributes,{'tableName':_0x56c4('0xd'),'paranoid':![],'indexes':[{'name':_0x56c4('0xe'),'fields':[_0x56c4('0xe')]},{'name':_0x56c4('0xf'),'fields':[_0x56c4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index bbef0b8..6c690a4 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 _0xdd64=['GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CmHopperHistory','create','body','raw','CreateCmHopperHistory','AvgHandleTime','findAll','options','COUNT','col','predictiveIntervalTotalCalls','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay'];(function(_0x2b5cdc,_0x3045c9){var _0x1cb285=function(_0x473c0a){while(--_0x473c0a){_0x2b5cdc['push'](_0x2b5cdc['shift']());}};_0x1cb285(++_0x3045c9);}(_0xdd64,0xd3));var _0x4dd6=function(_0x439e06,_0xe6d21c){_0x439e06=_0x439e06-0x0;var _0xaa57c1=_0xdd64[_0x439e06];return _0xaa57c1;};'use strict';var _=require(_0x4dd6('0x0'));var util=require(_0x4dd6('0x1'));var moment=require(_0x4dd6('0x2'));var BPromise=require(_0x4dd6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4dd6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4dd6('0x5'));var logger=require(_0x4dd6('0x6'))(_0x4dd6('0x7'));var config=require('../../config/environment');var jayson=require(_0x4dd6('0x8'));var client=jayson[_0x4dd6('0x9')][_0x4dd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f2b3,_0x5cd8e0,_0x32b759){return new BPromise(function(_0x2efc76,_0x2592df){return client[_0x4dd6('0xb')](_0x51f2b3,_0x32b759)[_0x4dd6('0xc')](function(_0x59563c){logger['info'](_0x4dd6('0xd'),_0x5cd8e0,_0x4dd6('0xe'));logger[_0x4dd6('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5cd8e0,_0x4dd6('0xe'),JSON[_0x4dd6('0x10')](_0x59563c));if(_0x59563c[_0x4dd6('0x11')]){if(_0x59563c[_0x4dd6('0x11')]['code']===0x1f4){logger[_0x4dd6('0x11')](_0x4dd6('0xd'),_0x5cd8e0,_0x59563c[_0x4dd6('0x11')][_0x4dd6('0x12')]);return _0x2592df(_0x59563c[_0x4dd6('0x11')][_0x4dd6('0x12')]);}logger['error'](_0x4dd6('0xd'),_0x5cd8e0,_0x59563c[_0x4dd6('0x11')][_0x4dd6('0x12')]);return _0x2efc76(_0x59563c[_0x4dd6('0x11')][_0x4dd6('0x12')]);}else{logger[_0x4dd6('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x5cd8e0,_0x4dd6('0xe'));_0x2efc76(_0x59563c[_0x4dd6('0x14')][_0x4dd6('0x12')]);}})[_0x4dd6('0x15')](function(_0xea5cbd){logger[_0x4dd6('0x11')](_0x4dd6('0xd'),_0x5cd8e0,_0xea5cbd);_0x2592df(_0xea5cbd);});});}exports['CreateCmHopperHistory']=function(_0xd28dde){var _0x8a6a07=this;return new Promise(function(_0x248fa4,_0x4634a1){return db[_0x4dd6('0x16')][_0x4dd6('0x17')](_0xd28dde[_0x4dd6('0x18')],{'raw':_0xd28dde['options']?_0xd28dde['options'][_0x4dd6('0x19')]===undefined?!![]:![]:!![]})[_0x4dd6('0xc')](function(_0x8e680c){logger[_0x4dd6('0x13')](_0x4dd6('0x1a'),_0xd28dde);logger[_0x4dd6('0xf')](_0x4dd6('0x1a'),_0xd28dde,JSON[_0x4dd6('0x10')](_0x8e680c));_0x248fa4(_0x8e680c);})[_0x4dd6('0x15')](function(_0x205c05){logger[_0x4dd6('0x11')](_0x4dd6('0x1a'),_0x205c05['message'],_0xd28dde);_0x4634a1(_0x8a6a07[_0x4dd6('0x11')](0x1f4,_0x205c05[_0x4dd6('0x12')]));});});};exports[_0x4dd6('0x1b')]=function(_0x3b1d0c){var _0x22e09b=this;return new Promise(function(_0x31232b,_0x32cd26){return db[_0x4dd6('0x16')][_0x4dd6('0x1c')]({'raw':_0x3b1d0c[_0x4dd6('0x1d')]?_0x3b1d0c[_0x4dd6('0x1d')][_0x4dd6('0x19')]===undefined?!![]:![]:!![],'where':_0x3b1d0c[_0x4dd6('0x1d')]?_0x3b1d0c[_0x4dd6('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x4dd6('0x1e'),db['sequelize'][_0x4dd6('0x1f')]('id')),_0x4dd6('0x20')],[db[_0x4dd6('0x21')]['fn']('COUNT',db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')](_0x4dd6('0x23')))),_0x4dd6('0x24')],[db['sequelize']['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')]['literal'](_0x4dd6('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x4dd6('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),_0x4dd6('0x26')],[db[_0x4dd6('0x21')]['fn'](_0x4dd6('0x27'),db[_0x4dd6('0x21')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x4dd6('0x28')],[db[_0x4dd6('0x21')]['fn'](_0x4dd6('0x27'),db['sequelize']['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')](_0x4dd6('0x29')))),_0x4dd6('0x2a')]]})[_0x4dd6('0xc')](function(_0x2c037e){logger['info'](_0x4dd6('0x1b'),_0x3b1d0c);logger['debug'](_0x4dd6('0x1b'),_0x3b1d0c,JSON[_0x4dd6('0x10')](_0x2c037e));_0x31232b(_0x2c037e);})[_0x4dd6('0x15')](function(_0xcfc983){logger[_0x4dd6('0x11')](_0x4dd6('0x1b'),_0xcfc983['message'],_0x3b1d0c);_0x32cd26(_0x22e09b[_0x4dd6('0x11')](0x1f4,_0xcfc983[_0x4dd6('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3b96d9){var _0x58e722=this;return new Promise(function(_0x46c00a,_0x18c295){return db[_0x4dd6('0x16')]['findAll']({'raw':_0x3b96d9[_0x4dd6('0x1d')]?_0x3b96d9[_0x4dd6('0x1d')][_0x4dd6('0x19')]===undefined?!![]:![]:!![],'where':_0x3b96d9[_0x4dd6('0x1d')]?_0x3b96d9['options'][_0x4dd6('0x2b')]||null:null,'attributes':[[_0x4dd6('0x2c'),_0x4dd6('0x2d')],[db[_0x4dd6('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')](_0x4dd6('0x2e')))),_0x4dd6('0x2f')],[db[_0x4dd6('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4dd6('0x21')]['literal'](_0x4dd6('0x30')))),_0x4dd6('0x31')],[db[_0x4dd6('0x21')]['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')](_0x4dd6('0x23')))),_0x4dd6('0x32')],[db['sequelize']['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')]['literal'](_0x4dd6('0x33')))),_0x4dd6('0x34')],[db[_0x4dd6('0x21')]['fn'](_0x4dd6('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4dd6('0x35')))),_0x4dd6('0x36')],[db[_0x4dd6('0x21')]['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')](_0x4dd6('0x37')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')]['literal'](_0x4dd6('0x38')))),_0x4dd6('0x39')],[db['sequelize']['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')](_0x4dd6('0x3a')))),_0x4dd6('0x3b')],[db['sequelize']['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x4dd6('0x3c')],[db[_0x4dd6('0x21')]['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')](_0x4dd6('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0x4dd6('0x3e')],[db['sequelize']['fn']('COUNT',db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x4dd6('0x21')]['fn']('COUNT',db[_0x4dd6('0x21')]['fn']('IF',db['sequelize'][_0x4dd6('0x22')](_0x4dd6('0x3f')))),_0x4dd6('0x3e')],[db[_0x4dd6('0x21')]['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db['sequelize'][_0x4dd6('0x22')](_0x4dd6('0x40')))),_0x4dd6('0x41')]],'group':['campaign']})[_0x4dd6('0xc')](function(_0x361082){logger[_0x4dd6('0x13')]('GetVoiceQueueHopperHistory',_0x3b96d9);logger['debug'](_0x4dd6('0x42'),_0x3b96d9,JSON[_0x4dd6('0x10')](_0x361082));_0x46c00a(_0x361082);})[_0x4dd6('0x15')](function(_0x3e70da){logger[_0x4dd6('0x11')](_0x4dd6('0x42'),_0x3e70da[_0x4dd6('0x12')],_0x3b96d9);_0x18c295(_0x58e722[_0x4dd6('0x11')](0x1f4,_0x3e70da[_0x4dd6('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0xe28f8){var _0x1291d6=this;return new Promise(function(_0x2775fb,_0x5a5e29){return db[_0x4dd6('0x16')][_0x4dd6('0x1c')]({'raw':_0xe28f8[_0x4dd6('0x1d')]?_0xe28f8[_0x4dd6('0x1d')][_0x4dd6('0x19')]===undefined?!![]:![]:!![],'where':_0xe28f8['options']?_0xe28f8[_0x4dd6('0x1d')][_0x4dd6('0x2b')]||null:null,'attributes':[[_0x4dd6('0x2c'),_0x4dd6('0x2d')],[db['sequelize']['fn'](_0x4dd6('0x1e'),db['sequelize'][_0x4dd6('0x1f')]('id')),_0x4dd6('0x43')],[db[_0x4dd6('0x21')]['fn'](_0x4dd6('0x1e'),db[_0x4dd6('0x21')]['fn']('IF',db[_0x4dd6('0x21')][_0x4dd6('0x22')](_0x4dd6('0x23')))),_0x4dd6('0x44')]],'group':[_0x4dd6('0x2c')]})[_0x4dd6('0xc')](function(_0x353133){logger[_0x4dd6('0x13')](_0x4dd6('0x45'),_0xe28f8);logger[_0x4dd6('0xf')]('GetCampaignHopperHistory',_0xe28f8,JSON[_0x4dd6('0x10')](_0x353133));_0x2775fb(_0x353133);})['catch'](function(_0x1205d3){logger[_0x4dd6('0x11')](_0x4dd6('0x45'),_0x1205d3[_0x4dd6('0x12')],_0xe28f8);_0x5a5e29(_0x1291d6[_0x4dd6('0x11')](0x1f4,_0x1205d3[_0x4dd6('0x12')]));});});}; \ No newline at end of file +var _0xcf4c=['where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','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','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory'];(function(_0x466b7c,_0xa417b0){var _0x56b31d=function(_0x1b7d7c){while(--_0x1b7d7c){_0x466b7c['push'](_0x466b7c['shift']());}};_0x56b31d(++_0xa417b0);}(_0xcf4c,0x19a));var _0xccf4=function(_0x145239,_0x590102){_0x145239=_0x145239-0x0;var _0x4df6f0=_0xcf4c[_0x145239];return _0x4df6f0;};'use strict';var _=require(_0xccf4('0x0'));var util=require(_0xccf4('0x1'));var moment=require(_0xccf4('0x2'));var BPromise=require('bluebird');var rs=require(_0xccf4('0x3'));var fs=require('fs');var Redis=require(_0xccf4('0x4'));var db=require(_0xccf4('0x5'))['db'];var utils=require(_0xccf4('0x6'));var logger=require(_0xccf4('0x7'))(_0xccf4('0x8'));var config=require(_0xccf4('0x9'));var jayson=require(_0xccf4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x82c875,_0x55c93c,_0x494d1b){return new BPromise(function(_0xc21f7e,_0x5207ad){return client[_0xccf4('0xb')](_0x82c875,_0x494d1b)[_0xccf4('0xc')](function(_0x567a56){logger[_0xccf4('0xd')](_0xccf4('0xe'),_0x55c93c,_0xccf4('0xf'));logger[_0xccf4('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x55c93c,_0xccf4('0xf'),JSON[_0xccf4('0x11')](_0x567a56));if(_0x567a56['error']){if(_0x567a56[_0xccf4('0x12')][_0xccf4('0x13')]===0x1f4){logger[_0xccf4('0x12')](_0xccf4('0xe'),_0x55c93c,_0x567a56['error'][_0xccf4('0x14')]);return _0x5207ad(_0x567a56[_0xccf4('0x12')][_0xccf4('0x14')]);}logger['error'](_0xccf4('0xe'),_0x55c93c,_0x567a56['error'][_0xccf4('0x14')]);return _0xc21f7e(_0x567a56[_0xccf4('0x12')][_0xccf4('0x14')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x55c93c,_0xccf4('0xf'));_0xc21f7e(_0x567a56[_0xccf4('0x15')][_0xccf4('0x14')]);}})['catch'](function(_0x495b86){logger['error'](_0xccf4('0xe'),_0x55c93c,_0x495b86);_0x5207ad(_0x495b86);});});}exports[_0xccf4('0x16')]=function(_0x5dd7f9){var _0x204b51=this;return new Promise(function(_0x2fe5f2,_0x2bbf71){return db[_0xccf4('0x17')][_0xccf4('0x18')](_0x5dd7f9[_0xccf4('0x19')],{'raw':_0x5dd7f9[_0xccf4('0x1a')]?_0x5dd7f9[_0xccf4('0x1a')][_0xccf4('0x1b')]===undefined?!![]:![]:!![]})[_0xccf4('0xc')](function(_0x25f2ca){logger[_0xccf4('0xd')](_0xccf4('0x16'),_0x5dd7f9);logger[_0xccf4('0x10')](_0xccf4('0x16'),_0x5dd7f9,JSON[_0xccf4('0x11')](_0x25f2ca));_0x2fe5f2(_0x25f2ca);})[_0xccf4('0x1c')](function(_0x4aa05b){logger[_0xccf4('0x12')](_0xccf4('0x16'),_0x4aa05b[_0xccf4('0x14')],_0x5dd7f9);_0x2bbf71(_0x204b51[_0xccf4('0x12')](0x1f4,_0x4aa05b[_0xccf4('0x14')]));});});};exports[_0xccf4('0x1d')]=function(_0x4e9dac){var _0x13bd14=this;return new Promise(function(_0x3a08ab,_0x3f39a4){return db[_0xccf4('0x17')][_0xccf4('0x1e')]({'raw':_0x4e9dac[_0xccf4('0x1a')]?_0x4e9dac['options'][_0xccf4('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e9dac[_0xccf4('0x1a')]?_0x4e9dac[_0xccf4('0x1a')]['where']||null:null,'attributes':[[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')][_0xccf4('0x21')]('id')),_0xccf4('0x22')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x24')))),_0xccf4('0x25')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x26')))),_0xccf4('0x27')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db['sequelize'][_0xccf4('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),_0xccf4('0x28')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x29'),db['sequelize']['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x2a')))),'predictiveIntervalAvgHoldtime'],[db[_0xccf4('0x1f')]['fn']('AVG',db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x2b')))),_0xccf4('0x2c')]]})[_0xccf4('0xc')](function(_0x21c2f9){logger[_0xccf4('0xd')](_0xccf4('0x1d'),_0x4e9dac);logger[_0xccf4('0x10')](_0xccf4('0x1d'),_0x4e9dac,JSON[_0xccf4('0x11')](_0x21c2f9));_0x3a08ab(_0x21c2f9);})['catch'](function(_0x21aa52){logger['error'](_0xccf4('0x1d'),_0x21aa52['message'],_0x4e9dac);_0x3f39a4(_0x13bd14[_0xccf4('0x12')](0x1f4,_0x21aa52[_0xccf4('0x14')]));});});};exports[_0xccf4('0x2d')]=function(_0x1beb6f){var _0x167992=this;return new Promise(function(_0x405af7,_0x57973a){return db[_0xccf4('0x17')][_0xccf4('0x1e')]({'raw':_0x1beb6f[_0xccf4('0x1a')]?_0x1beb6f[_0xccf4('0x1a')][_0xccf4('0x1b')]===undefined?!![]:![]:!![],'where':_0x1beb6f[_0xccf4('0x1a')]?_0x1beb6f[_0xccf4('0x1a')][_0xccf4('0x2e')]||null:null,'attributes':[[_0xccf4('0x2f'),_0xccf4('0x30')],[db['sequelize']['fn'](_0xccf4('0x20'),db['sequelize']['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x31')))),_0xccf4('0x32')],[db[_0xccf4('0x1f')]['fn']('COUNT',db[_0xccf4('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xccf4('0x33')))),_0xccf4('0x34')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x24')))),'outboundAnswerCallsDay'],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db['sequelize'][_0xccf4('0x23')](_0xccf4('0x35')))),_0xccf4('0x36')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db['sequelize'][_0xccf4('0x23')](_0xccf4('0x37')))),_0xccf4('0x38')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x39')))),_0xccf4('0x3a')],[db[_0xccf4('0x1f')]['fn']('COUNT',db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x3b')))),_0xccf4('0x3c')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')]['literal'](_0xccf4('0x3d')))),_0xccf4('0x3e')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db['sequelize'][_0xccf4('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0xccf4('0x3f')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db['sequelize']['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x40')))),_0xccf4('0x41')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x42')))),_0xccf4('0x43')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x44')))),_0xccf4('0x45')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x46')))),_0xccf4('0x43')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x47')))),_0xccf4('0x48')]],'group':[_0xccf4('0x2f')]})[_0xccf4('0xc')](function(_0x4d8b00){logger[_0xccf4('0xd')]('GetVoiceQueueHopperHistory',_0x1beb6f);logger[_0xccf4('0x10')](_0xccf4('0x2d'),_0x1beb6f,JSON[_0xccf4('0x11')](_0x4d8b00));_0x405af7(_0x4d8b00);})[_0xccf4('0x1c')](function(_0x3f0949){logger[_0xccf4('0x12')](_0xccf4('0x2d'),_0x3f0949[_0xccf4('0x14')],_0x1beb6f);_0x57973a(_0x167992[_0xccf4('0x12')](0x1f4,_0x3f0949['message']));});});};exports[_0xccf4('0x49')]=function(_0x4efc4a){var _0x4735d6=this;return new Promise(function(_0x2a6081,_0x42b648){return db[_0xccf4('0x17')][_0xccf4('0x1e')]({'raw':_0x4efc4a['options']?_0x4efc4a['options'][_0xccf4('0x1b')]===undefined?!![]:![]:!![],'where':_0x4efc4a[_0xccf4('0x1a')]?_0x4efc4a[_0xccf4('0x1a')][_0xccf4('0x2e')]||null:null,'attributes':[[_0xccf4('0x2f'),'name'],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['col']('id')),_0xccf4('0x4a')],[db[_0xccf4('0x1f')]['fn']('COUNT',db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x24')))),_0xccf4('0x4b')]],'group':['campaign']})['then'](function(_0x3bdc22){logger[_0xccf4('0xd')](_0xccf4('0x49'),_0x4efc4a);logger[_0xccf4('0x10')](_0xccf4('0x49'),_0x4efc4a,JSON[_0xccf4('0x11')](_0x3bdc22));_0x2a6081(_0x3bdc22);})[_0xccf4('0x1c')](function(_0x470f32){logger[_0xccf4('0x12')](_0xccf4('0x49'),_0x470f32['message'],_0x4efc4a);_0x42b648(_0x4735d6[_0xccf4('0x12')](0x1f4,_0x470f32['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 8aea18b..3f1ad64 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 _0xb407=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','get','/describe','describe','show','post','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3c9e74,_0x4334c5){var _0x4fea21=function(_0x5a2cbb){while(--_0x5a2cbb){_0x3c9e74['push'](_0x3c9e74['shift']());}};_0x4fea21(++_0x4334c5);}(_0xb407,0x1c8));var _0x7b40=function(_0x1c42e4,_0x559ca5){_0x1c42e4=_0x1c42e4-0x0;var _0x258df3=_0xb407[_0x1c42e4];return _0x258df3;};'use strict';var multer=require(_0x7b40('0x0'));var util=require(_0x7b40('0x1'));var path=require(_0x7b40('0x2'));var timeout=require(_0x7b40('0x3'));var express=require(_0x7b40('0x4'));var router=express[_0x7b40('0x5')]();var fs_extra=require(_0x7b40('0x6'));var auth=require(_0x7b40('0x7'));var interaction=require(_0x7b40('0x8'));var config=require(_0x7b40('0x9'));var controller=require(_0x7b40('0xa'));router['get']('/',auth[_0x7b40('0xb')](),controller['index']);router[_0x7b40('0xc')](_0x7b40('0xd'),auth[_0x7b40('0xb')](),controller[_0x7b40('0xe')]);router[_0x7b40('0xc')]('/:id',auth[_0x7b40('0xb')](),controller[_0x7b40('0xf')]);router[_0x7b40('0x10')]('/',auth[_0x7b40('0xb')](),controller[_0x7b40('0x11')]);router[_0x7b40('0x12')](_0x7b40('0x13'),auth['isAuthenticated'](),controller['update']);module[_0x7b40('0x14')]=router; \ No newline at end of file +var _0xbed1=['create','/:id','update','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post'];(function(_0x49dc0e,_0x1846c7){var _0x2d4930=function(_0x33eb70){while(--_0x33eb70){_0x49dc0e['push'](_0x49dc0e['shift']());}};_0x2d4930(++_0x1846c7);}(_0xbed1,0x183));var _0x1bed=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0xbed1[_0x13992d];return _0x3d15bf;};'use strict';var multer=require(_0x1bed('0x0'));var util=require('util');var path=require(_0x1bed('0x1'));var timeout=require(_0x1bed('0x2'));var express=require(_0x1bed('0x3'));var router=express['Router']();var fs_extra=require(_0x1bed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1bed('0x5'));var config=require(_0x1bed('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x1bed('0x7')]('/',auth[_0x1bed('0x8')](),controller[_0x1bed('0x9')]);router[_0x1bed('0x7')](_0x1bed('0xa'),auth['isAuthenticated'](),controller[_0x1bed('0xb')]);router[_0x1bed('0x7')]('/:id',auth[_0x1bed('0x8')](),controller['show']);router[_0x1bed('0xc')]('/',auth[_0x1bed('0x8')](),controller[_0x1bed('0xd')]);router['put'](_0x1bed('0xe'),auth[_0x1bed('0x8')](),controller[_0x1bed('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1473f82..11a9164 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 _0x943c=['sequelize','exports','STRING','name'];(function(_0x6f4e96,_0x296366){var _0x4edc79=function(_0x5d8cfb){while(--_0x5d8cfb){_0x6f4e96['push'](_0x6f4e96['shift']());}};_0x4edc79(++_0x296366);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc943('0x0'));module[_0xc943('0x1')]={'name':{'type':Sequelize[_0xc943('0x2')],'unique':_0xc943('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa2b=['exports','STRING','name','sequelize'];(function(_0x2b3979,_0x47bc1a){var _0x5e1317=function(_0x46cd68){while(--_0x46cd68){_0x2b3979['push'](_0x2b3979['shift']());}};_0x5e1317(++_0x47bc1a);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x37583a,_0x38ff18){_0x37583a=_0x37583a-0x0;var _0x7c9ff5=_0xfa2b[_0x37583a];return _0x7c9ff5;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'name':{'type':Sequelize[_0xbfa2('0x2')],'unique':_0xbfa2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbfa2('0x2')]},'dialPrefix':{'type':Sequelize[_0xbfa2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index dfe75f4..6649f5d 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 _0x983d=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','getDispositions','findOne','Disposition','rawAttributes','removeDispositions','ids','addContacts','tags','isArray','join','each','omit','success','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','CmContact','concat','cf_%d','getContactsCsv','format','isEmpty','writeFileSync','setHeader','Content-disposition','Content-type','text/csv','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','send','index','CmList','fieldName','type','map','keys','query','filters','model','attributes','intersection','hasOwnProperty'];(function(_0x48fa00,_0x1086d6){var _0x19e409=function(_0xe6c2e7){while(--_0xe6c2e7){_0x48fa00['push'](_0x48fa00['shift']());}};_0x19e409(++_0x1086d6);}(_0x983d,0x1d9));var _0xd983=function(_0x4d8d5e,_0xa5c78a){_0x4d8d5e=_0x4d8d5e-0x0;var _0x4aa60f=_0x983d[_0x4d8d5e];return _0x4aa60f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd983('0x0'));var zipdir=require(_0xd983('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd983('0x2'));var moment=require(_0xd983('0x3'));var BPromise=require(_0xd983('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd983('0x5'));var sox=require(_0xd983('0x6'));var csv=require(_0xd983('0x7'));var ejs=require(_0xd983('0x8'));var fs=require('fs');var fs_extra=require(_0xd983('0x9'));var _=require(_0xd983('0xa'));var squel=require(_0xd983('0xb'));var crypto=require(_0xd983('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd983('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd983('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd983('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xd983('0x10'));var config=require(_0xd983('0x11'));var licenseUtil=require(_0xd983('0x12'));var db=require(_0xd983('0x13'))['db'];config['redis']=_[_0xd983('0x14')](config[_0xd983('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xd983('0x16'))(new Redis(config[_0xd983('0x15')]));require('./cmList.socket')[_0xd983('0x17')](socket);function respondWithStatusCode(_0x11035a,_0x1699f6){_0x1699f6=_0x1699f6||0xcc;return function(_0x21dc79){if(_0x21dc79){return _0x11035a[_0xd983('0x18')](_0x1699f6);}return _0x11035a[_0xd983('0x19')](_0x1699f6)['end']();};}function respondWithResult(_0x408ed2,_0x4a613a){_0x4a613a=_0x4a613a||0xc8;return function(_0x1a8933){if(_0x1a8933){return _0x408ed2[_0xd983('0x19')](_0x4a613a)[_0xd983('0x1a')](_0x1a8933);}};}function respondWithFilteredResult(_0x590181,_0x3b99df){return function(_0x3ac3b8){if(_0x3ac3b8){var _0xa3dadf=typeof _0x3b99df[_0xd983('0x1b')]===_0xd983('0x1c')&&typeof _0x3b99df[_0xd983('0x1d')]===_0xd983('0x1c');var _0x45c027=_0x3ac3b8[_0xd983('0x1e')];var _0xd40d43=_0xa3dadf?0x0:_0x3b99df[_0xd983('0x1b')];var _0x262bf1=_0xa3dadf?_0x3ac3b8[_0xd983('0x1e')]:_0x3b99df[_0xd983('0x1b')]+_0x3b99df[_0xd983('0x1d')];var _0x21f69e;if(_0x262bf1>=_0x45c027){_0x262bf1=_0x45c027;_0x21f69e=0xc8;}else{_0x21f69e=0xce;}_0x590181[_0xd983('0x19')](_0x21f69e);return _0x590181[_0xd983('0x1f')](_0xd983('0x20'),_0xd40d43+'-'+_0x262bf1+'/'+_0x45c027)[_0xd983('0x1a')](_0x3ac3b8);}return null;};}function patchUpdates(_0x3069eb){return function(_0x74e2cd){try{jsonpatch[_0xd983('0x21')](_0x74e2cd,_0x3069eb,!![]);}catch(_0x405dbd){return BPromise['reject'](_0x405dbd);}return _0x74e2cd[_0xd983('0x22')]();};}function saveUpdates(_0x20e4d2,_0x2b4a96){return function(_0x281984){if(_0x281984){return _0x281984[_0xd983('0x23')](_0x20e4d2)[_0xd983('0x24')](function(_0xd5faf4){return _0xd5faf4;});}return null;};}function removeEntity(_0x126e19,_0x105188){return function(_0x4b1044){if(_0x4b1044){return _0x4b1044[_0xd983('0x25')]()[_0xd983('0x24')](function(){var _0x3613e0=_0x4b1044[_0xd983('0x26')]({'plain':!![]});var _0x3f6c6e='Lists';return db['UserProfileResource'][_0xd983('0x25')]({'where':{'type':_0x3f6c6e,'resourceId':_0x3613e0['id']}})[_0xd983('0x24')](function(){return _0x4b1044;});})['then'](function(){_0x126e19[_0xd983('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fe23a,_0x1c2ff6){return function(_0x128127){if(!_0x128127){_0x2fe23a[_0xd983('0x18')](0x194);}return _0x128127;};}function handleError(_0x7bcc96,_0x3ae08a){_0x3ae08a=_0x3ae08a||0x1f4;return function(_0x1a518c){logger[_0xd983('0x27')](_0x1a518c[_0xd983('0x28')]);if(_0x1a518c[_0xd983('0x29')]){delete _0x1a518c['name'];}_0x7bcc96[_0xd983('0x19')](_0x3ae08a)[_0xd983('0x2a')](_0x1a518c);};}exports[_0xd983('0x2b')]=function(_0x9337fa,_0x36607a){var _0x115d41={},_0xfd58ae={},_0x1cc5d9={'count':0x0,'rows':[]};var _0x173f3b=_['map'](db[_0xd983('0x2c')]['rawAttributes'],function(_0x2261e5){return{'name':_0x2261e5[_0xd983('0x2d')],'type':_0x2261e5[_0xd983('0x2e')]['key']};});_0xfd58ae['model']=_[_0xd983('0x2f')](_0x173f3b,'name');_0xfd58ae['query']=_[_0xd983('0x30')](_0x9337fa[_0xd983('0x31')]);_0xfd58ae[_0xd983('0x32')]=_['intersection'](_0xfd58ae[_0xd983('0x33')],_0xfd58ae[_0xd983('0x31')]);_0x115d41[_0xd983('0x34')]=_[_0xd983('0x35')](_0xfd58ae[_0xd983('0x33')],qs['fields'](_0x9337fa[_0xd983('0x31')]['fields']));_0x115d41[_0xd983('0x34')]=_0x115d41[_0xd983('0x34')]['length']?_0x115d41[_0xd983('0x34')]:_0xfd58ae['model'];if(!_0x9337fa[_0xd983('0x31')][_0xd983('0x36')](_0xd983('0x37'))){_0x115d41[_0xd983('0x1d')]=qs[_0xd983('0x1d')](_0x9337fa[_0xd983('0x31')][_0xd983('0x1d')]);_0x115d41[_0xd983('0x1b')]=qs['offset'](_0x9337fa['query']['offset']);}_0x115d41[_0xd983('0x38')]=qs[_0xd983('0x39')](_0x9337fa[_0xd983('0x31')][_0xd983('0x39')]);_0x115d41['where']=qs[_0xd983('0x32')](_[_0xd983('0x3a')](_0x9337fa[_0xd983('0x31')],_0xfd58ae[_0xd983('0x32')]),_0x173f3b);if(_0x9337fa['query'][_0xd983('0x3b')]){_0x115d41[_0xd983('0x3c')]=_[_0xd983('0x3d')](_0x115d41[_0xd983('0x3c')],{'$or':_['map'](_0x173f3b,function(_0x4818eb){if(_0x4818eb[_0xd983('0x2e')]!==_0xd983('0x3e')){var _0x72dc62={};_0x72dc62[_0x4818eb[_0xd983('0x29')]]={'$like':'%'+_0x9337fa[_0xd983('0x31')][_0xd983('0x3b')]+'%'};return _0x72dc62;}})});}_0x115d41=_[_0xd983('0x3d')]({},_0x115d41,_0x9337fa[_0xd983('0x3f')]);var _0x70e832={'where':_0x115d41[_0xd983('0x3c')]};return db['CmList']['count'](_0x70e832)[_0xd983('0x24')](function(_0x421953){_0x1cc5d9['count']=_0x421953;if(_0x9337fa[_0xd983('0x31')][_0xd983('0x40')]){_0x115d41[_0xd983('0x41')]=[{'all':!![]}];}return db[_0xd983('0x2c')][_0xd983('0x42')](_0x115d41);})[_0xd983('0x24')](function(_0x4f5755){_0x1cc5d9[_0xd983('0x43')]=_0x4f5755;return _0x1cc5d9;})['then'](respondWithFilteredResult(_0x36607a,_0x115d41))[_0xd983('0x44')](handleError(_0x36607a,null));};exports[_0xd983('0x45')]=function(_0x52cc54,_0x48cd41){var _0x5c3753={'raw':![],'where':{'id':_0x52cc54[_0xd983('0x46')]['id']}},_0x230c71={};_0x230c71[_0xd983('0x33')]=_['keys'](db[_0xd983('0x2c')]['rawAttributes']);_0x230c71[_0xd983('0x31')]=_[_0xd983('0x30')](_0x52cc54[_0xd983('0x31')]);_0x230c71[_0xd983('0x32')]=_[_0xd983('0x35')](_0x230c71[_0xd983('0x33')],_0x230c71['query']);_0x5c3753[_0xd983('0x34')]=_[_0xd983('0x35')](_0x230c71[_0xd983('0x33')],qs['fields'](_0x52cc54['query'][_0xd983('0x47')]));_0x5c3753['attributes']=_0x5c3753[_0xd983('0x34')][_0xd983('0x48')]?_0x5c3753[_0xd983('0x34')]:_0x230c71[_0xd983('0x33')];if(_0x52cc54[_0xd983('0x31')][_0xd983('0x40')]){_0x5c3753['include']=[{'all':!![]}];}_0x5c3753=_[_0xd983('0x3d')]({},_0x5c3753,_0x52cc54[_0xd983('0x3f')]);return db[_0xd983('0x2c')][_0xd983('0x49')](_0x5c3753)['then'](handleEntityNotFound(_0x48cd41,null))['then'](respondWithResult(_0x48cd41,null))[_0xd983('0x44')](handleError(_0x48cd41,null));};exports['create']=function(_0x207645,_0x3764de){return db['CmList'][_0xd983('0x4a')](_0x207645[_0xd983('0x4b')],{})[_0xd983('0x24')](function(_0xee20e){var _0x1060c5=_0x207645[_0xd983('0x4c')][_0xd983('0x26')]({'plain':!![]});if(!_0x1060c5)throw new Error(_0xd983('0x4d'));if(_0x1060c5[_0xd983('0x4e')]==='user'){var _0x35ba3d=_0xee20e[_0xd983('0x26')]({'plain':!![]});var _0x4d32ea='Lists';return db['UserProfileSection'][_0xd983('0x49')]({'where':{'name':_0x4d32ea,'userProfileId':_0x1060c5['userProfileId']},'raw':!![]})['then'](function(_0x1d499d){if(_0x1d499d&&_0x1d499d[_0xd983('0x4f')]===0x0){return db['UserProfileResource'][_0xd983('0x4a')]({'name':_0x35ba3d[_0xd983('0x29')],'resourceId':_0x35ba3d['id'],'type':_0x1d499d[_0xd983('0x29')],'sectionId':_0x1d499d['id']},{})[_0xd983('0x24')](function(){return _0xee20e;});}else{return _0xee20e;}})[_0xd983('0x44')](function(_0x1cac9f){logger['error'](_0xd983('0x50'),_0x1cac9f);throw _0x1cac9f;});}return _0xee20e;})[_0xd983('0x24')](respondWithResult(_0x3764de,0xc9))[_0xd983('0x44')](handleError(_0x3764de,null));};exports[_0xd983('0x23')]=function(_0x48dc9e,_0x47683c){if(_0x48dc9e[_0xd983('0x4b')]['id']){delete _0x48dc9e['body']['id'];}return db[_0xd983('0x2c')][_0xd983('0x49')]({'where':{'id':_0x48dc9e['params']['id']}})[_0xd983('0x24')](handleEntityNotFound(_0x47683c,null))[_0xd983('0x24')](saveUpdates(_0x48dc9e[_0xd983('0x4b')],null))[_0xd983('0x24')](respondWithResult(_0x47683c,null))[_0xd983('0x44')](handleError(_0x47683c,null));};exports[_0xd983('0x25')]=function(_0x4d3eef,_0x12fe7b){return db['CmList'][_0xd983('0x49')]({'where':{'id':_0x4d3eef['params']['id']}})[_0xd983('0x24')](handleEntityNotFound(_0x12fe7b,null))['then'](removeEntity(_0x12fe7b,null))[_0xd983('0x44')](handleError(_0x12fe7b,null));};exports['describe']=function(_0x44424b,_0x2ce077){return db[_0xd983('0x2c')][_0xd983('0x51')]()[_0xd983('0x24')](respondWithResult(_0x2ce077,null))[_0xd983('0x44')](handleError(_0x2ce077,null));};exports['addDisposition']=function(_0xa15887,_0xc4438a,_0x22152c){if(_0xa15887[_0xd983('0x4b')]['id']){delete _0xa15887[_0xd983('0x4b')]['id'];}return db[_0xd983('0x2c')][_0xd983('0x49')]({'where':{'id':_0xa15887[_0xd983('0x46')]['id']}})['then'](handleEntityNotFound(_0xc4438a,null))[_0xd983('0x24')](function(_0x1092ea){if(_0x1092ea){_0xa15887[_0xd983('0x4b')][_0xd983('0x52')]=_0x1092ea['id'];return db['Disposition'][_0xd983('0x4a')](_0xa15887['body']);}})['then'](respondWithResult(_0xc4438a,null))[_0xd983('0x44')](handleError(_0xc4438a,null));};exports[_0xd983('0x53')]=function(_0x45a1ad,_0x3c4f2d,_0x2fa8de){var _0x4fbef6={'raw':![],'where':{}};var _0x40817f={};var _0x567913={'count':0x0,'rows':[]};return db[_0xd983('0x2c')][_0xd983('0x54')]({'where':{'id':_0x45a1ad[_0xd983('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c4f2d,null))[_0xd983('0x24')](function(_0x417310){if(_0x417310){_0x40817f[_0xd983('0x33')]=_[_0xd983('0x30')](db[_0xd983('0x55')][_0xd983('0x56')]);_0x40817f['query']=_[_0xd983('0x30')](_0x45a1ad[_0xd983('0x31')]);_0x40817f[_0xd983('0x32')]=_[_0xd983('0x35')](_0x40817f['model'],_0x40817f[_0xd983('0x31')]);_0x4fbef6[_0xd983('0x34')]=_[_0xd983('0x35')](_0x40817f[_0xd983('0x33')],qs[_0xd983('0x47')](_0x45a1ad[_0xd983('0x31')][_0xd983('0x47')]));_0x4fbef6[_0xd983('0x34')]=_0x4fbef6['attributes'][_0xd983('0x48')]?_0x4fbef6[_0xd983('0x34')]:_0x40817f[_0xd983('0x33')];if(!_0x45a1ad[_0xd983('0x31')][_0xd983('0x36')](_0xd983('0x37'))){_0x4fbef6[_0xd983('0x1d')]=qs[_0xd983('0x1d')](_0x45a1ad[_0xd983('0x31')][_0xd983('0x1d')]);_0x4fbef6[_0xd983('0x1b')]=qs[_0xd983('0x1b')](_0x45a1ad['query']['offset']);}_0x4fbef6[_0xd983('0x38')]=qs[_0xd983('0x39')](_0x45a1ad[_0xd983('0x31')][_0xd983('0x39')]);_0x4fbef6[_0xd983('0x3c')]=qs[_0xd983('0x32')](_[_0xd983('0x3a')](_0x45a1ad[_0xd983('0x31')],_0x40817f[_0xd983('0x32')]));_0x4fbef6[_0xd983('0x3c')]['ListId']=_0x417310['id'];if(_0x45a1ad[_0xd983('0x31')][_0xd983('0x3b')]){_0x4fbef6[_0xd983('0x3c')]=_['merge'](_0x4fbef6[_0xd983('0x3c')],{'$or':_[_0xd983('0x2f')](_0x4fbef6[_0xd983('0x34')],function(_0x27bc23){var _0x5d94bb={};_0x5d94bb[_0x27bc23]={'$like':'%'+_0x45a1ad['query'][_0xd983('0x3b')]+'%'};return _0x5d94bb;})});}_0x4fbef6=_[_0xd983('0x3d')]({},_0x4fbef6,_0x45a1ad[_0xd983('0x3f')]);return db['Disposition'][_0xd983('0x1e')]({'where':_0x4fbef6['where']})[_0xd983('0x24')](function(_0x273da3){_0x567913[_0xd983('0x1e')]=_0x273da3;if(_0x45a1ad[_0xd983('0x31')][_0xd983('0x40')]){_0x4fbef6['include']=[{'all':!![]}];}return db[_0xd983('0x55')][_0xd983('0x42')](_0x4fbef6);})[_0xd983('0x24')](function(_0x37b366){_0x567913['rows']=_0x37b366;return _0x567913;});}})[_0xd983('0x24')](respondWithFilteredResult(_0x3c4f2d,_0x4fbef6))[_0xd983('0x44')](handleError(_0x3c4f2d,null));};exports[_0xd983('0x57')]=function(_0x3890c2,_0xfbf5f7,_0x26769e){return db[_0xd983('0x2c')][_0xd983('0x49')]({'where':{'id':_0x3890c2[_0xd983('0x46')]['id']}})[_0xd983('0x24')](handleEntityNotFound(_0xfbf5f7,null))[_0xd983('0x24')](function(_0x2bc1bc){if(_0x2bc1bc){return _0x2bc1bc[_0xd983('0x57')](_0x3890c2['query'][_0xd983('0x58')]);}})['then'](respondWithStatusCode(_0xfbf5f7,null))[_0xd983('0x44')](handleError(_0xfbf5f7,null));};exports[_0xd983('0x59')]=function(_0x22c994,_0xefe3ce,_0xa0009c){return db[_0xd983('0x2c')][_0xd983('0x49')]({'where':{'id':_0x22c994[_0xd983('0x46')]['id']}})[_0xd983('0x24')](handleEntityNotFound(_0xefe3ce,null))[_0xd983('0x24')](function(_0x1c77fb){if(_0x1c77fb){var _0x57857c=[];var _0x461a5a={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xd983('0x24')](function(_0x126153){if(_0x22c994['body'][_0xd983('0x5a')]&&_[_0xd983('0x5b')](_0x22c994['body'][_0xd983('0x5a')])){if(_0x22c994['body']['tags'][_0xd983('0x48')]){_0x22c994[_0xd983('0x4b')][_0xd983('0x5a')]=_0x22c994[_0xd983('0x4b')]['tags'][_0xd983('0x5c')](';')+';';}else{_0x22c994[_0xd983('0x4b')][_0xd983('0x5a')]=null;}}else{_0x22c994[_0xd983('0x4b')][_0xd983('0x5a')]=null;}if(_0x22c994[_0xd983('0x4b')]&&_[_0xd983('0x5b')](_0x22c994[_0xd983('0x4b')])){for(var _0x4480b0=0x0;_0x4480b0<_0x22c994[_0xd983('0x4b')][_0xd983('0x48')];_0x4480b0+=0x1){_0x22c994[_0xd983('0x4b')][_0x4480b0][_0xd983('0x52')]=_0x22c994[_0xd983('0x46')]['id'];_0x57857c['push'](_0x22c994[_0xd983('0x4b')][_0x4480b0]);}return BPromise[_0xd983('0x5d')](_0x57857c,function(_0x4b517d){return db['CmContact'][_0xd983('0x4a')](_[_0xd983('0x5e')](_0x4b517d,[_0xd983('0x58'),'id'])||{},{'fields':_[_0xd983('0x30')](_0x126153),'raw':!![]})[_0xd983('0x24')](function(_0x415994){_0x461a5a[_0xd983('0x5f')][_0xd983('0x60')](_0x415994['dataValues']);})['catch'](function(_0x206f7b){_0x461a5a['errors']['push']({'data':_0x4b517d,'error':_0x206f7b[_0xd983('0x61')]});});})[_0xd983('0x24')](function(_0x41fe3b){return _0x461a5a;})[_0xd983('0x44')](function(_0x213271){return _0x213271;});}else{_0xefe3ce['status'](0x190)[_0xd983('0x1a')]({'message':_0xd983('0x62')});}});}})[_0xd983('0x24')](respondWithResult(_0xefe3ce,null))[_0xd983('0x44')](handleError(_0xefe3ce,null));};exports[_0xd983('0x63')]=function(_0x262087,_0x517fc7,_0x18bd1c){var _0x65e2e2;return db[_0xd983('0x2c')][_0xd983('0x49')]({'where':{'id':_0x262087[_0xd983('0x46')]['id']},'include':[{'model':db[_0xd983('0x64')],'as':_0xd983('0x65')}]})['then'](handleEntityNotFound(_0x517fc7,null))[_0xd983('0x24')](function(_0x5f494f){if(_0x5f494f){_0x65e2e2=_0x5f494f;return db[_0xd983('0x66')]['rawAttributes'];}})[_0xd983('0x24')](function(_0x42ad65){if(_0x42ad65){var _0x574925={};var _0x4f4821={};_0x4f4821[_0xd983('0x33')]=_[_0xd983('0x67')](_[_0xd983('0x30')](_0x42ad65),_['map'](_0x65e2e2[_0xd983('0x65')],function(_0x4e2616){return util['format'](_0xd983('0x68'),_0x4e2616['id']);}));_0x4f4821[_0xd983('0x31')]=_['keys'](_0x262087['query']);_0x4f4821['filters']=_[_0xd983('0x35')](_0x4f4821[_0xd983('0x33')],_0x4f4821[_0xd983('0x31')]);_0x574925[_0xd983('0x34')]=_[_0xd983('0x35')](_0x4f4821[_0xd983('0x33')],qs[_0xd983('0x47')](_0x262087[_0xd983('0x31')][_0xd983('0x47')]));_0x574925['attributes']=_0x574925['attributes'][_0xd983('0x48')]?_0x574925[_0xd983('0x34')]:_0x4f4821['model'];if(!_0x262087[_0xd983('0x31')][_0xd983('0x36')](_0xd983('0x37'))){_0x574925[_0xd983('0x1d')]=qs[_0xd983('0x1d')](_0x262087[_0xd983('0x31')][_0xd983('0x1d')]);_0x574925[_0xd983('0x1b')]=qs['offset'](_0x262087[_0xd983('0x31')][_0xd983('0x1b')]);}_0x574925[_0xd983('0x38')]=qs[_0xd983('0x39')](_0x262087[_0xd983('0x31')][_0xd983('0x39')]);_0x574925[_0xd983('0x3c')]=qs[_0xd983('0x32')](_[_0xd983('0x3a')](_0x262087[_0xd983('0x31')],_0x4f4821[_0xd983('0x32')]));_0x574925['raw']=!![];if(_0x262087[_0xd983('0x31')][_0xd983('0x3b')]){_0x574925[_0xd983('0x3c')]=_['merge'](_0x574925[_0xd983('0x3c')],{'$or':_[_0xd983('0x2f')](_0x574925[_0xd983('0x34')],function(_0x59cc04){var _0x5a7fb6={};_0x5a7fb6[_0x59cc04]={'$like':'%'+_0x262087[_0xd983('0x31')]['filter']+'%'};return _0x5a7fb6;})});}_0x574925=_[_0xd983('0x3d')]({},_0x574925,_0x262087['options']);return _0x65e2e2[_0xd983('0x63')](_0x574925);}})[_0xd983('0x24')](respondWithResult(_0x517fc7,null))[_0xd983('0x44')](handleError(_0x517fc7,null));};exports[_0xd983('0x69')]=function(_0x3e0462,_0x2d6eea,_0x38fc25){var _0x27ca23;return db[_0xd983('0x2c')][_0xd983('0x49')]({'where':{'id':_0x3e0462[_0xd983('0x46')]['id']},'include':[{'model':db[_0xd983('0x64')],'as':_0xd983('0x65')}]})[_0xd983('0x24')](handleEntityNotFound(_0x2d6eea,null))[_0xd983('0x24')](function(_0x819360){if(_0x819360){_0x27ca23=_0x819360;return db[_0xd983('0x66')][_0xd983('0x56')];}})['then'](function(_0x105693){if(_0x105693){var _0xda77c9={};var _0xb8eaa={};_0xb8eaa[_0xd983('0x33')]=_['concat'](_[_0xd983('0x30')](_0x105693),_[_0xd983('0x2f')](_0x27ca23[_0xd983('0x65')],function(_0x2334ea){return util[_0xd983('0x6a')](_0xd983('0x68'),_0x2334ea['id']);}));_0xb8eaa['query']=_[_0xd983('0x30')](_0x3e0462[_0xd983('0x31')]);_0xb8eaa[_0xd983('0x32')]=_[_0xd983('0x35')](_0xb8eaa[_0xd983('0x33')],_0xb8eaa[_0xd983('0x31')]);_0xda77c9['attributes']=_['intersection'](_0xb8eaa[_0xd983('0x33')],qs[_0xd983('0x47')](_0x3e0462[_0xd983('0x31')][_0xd983('0x47')]));_0xda77c9['attributes']=_0xda77c9[_0xd983('0x34')]['length']?_0xda77c9['attributes']:_0xb8eaa['model'];if(!_0x3e0462[_0xd983('0x31')][_0xd983('0x36')](_0xd983('0x37'))){_0xda77c9['limit']=qs[_0xd983('0x1d')](_0x3e0462[_0xd983('0x31')]['limit']);_0xda77c9[_0xd983('0x1b')]=qs[_0xd983('0x1b')](_0x3e0462[_0xd983('0x31')]['offset']);}_0xda77c9[_0xd983('0x38')]=qs['sort'](_0x3e0462['query'][_0xd983('0x39')]);_0xda77c9[_0xd983('0x3c')]=qs[_0xd983('0x32')](_[_0xd983('0x3a')](_0x3e0462[_0xd983('0x31')],_0xb8eaa[_0xd983('0x32')]));_0xda77c9['raw']=!![];if(_0x3e0462[_0xd983('0x31')]['filter']){_0xda77c9[_0xd983('0x3c')]=_['merge'](_0xda77c9[_0xd983('0x3c')],{'$or':_['map'](_0xda77c9[_0xd983('0x34')],function(_0x67d73f){var _0x7d5b2a={};_0x7d5b2a[_0x67d73f]={'$like':'%'+_0x3e0462[_0xd983('0x31')][_0xd983('0x3b')]+'%'};return _0x7d5b2a;})});}_0xda77c9=_['merge']({},_0xda77c9,_0x3e0462[_0xd983('0x3f')]);return _0x27ca23['getContacts'](_0xda77c9);}})['then'](function(_0x4dfc51){if(!_[_0xd983('0x6b')](_0x4dfc51)){var _0x4feb64=toCsv(_0x4dfc51);var _0x38d3dc=Date['now']();fs[_0xd983('0x6c')](util[_0xd983('0x6a')]('/tmp/list_%d_%s.csv',_0x27ca23['id'],_0x38d3dc),_0x4feb64);_0x2d6eea[_0xd983('0x6d')](_0xd983('0x6e'),'attachment;\x20filename='+util[_0xd983('0x6a')]('list_%d_%s.csv',_0x27ca23['id'],_0x38d3dc));_0x2d6eea[_0xd983('0x6d')](_0xd983('0x6f'),_0xd983('0x70'));return _0x2d6eea['download'](util[_0xd983('0x6a')]('/tmp/list_%d_%s.csv',_0x27ca23['id'],_0x38d3dc));}else{return _0x2d6eea['sendStatus'](0xcc);}})['catch'](handleError(_0x2d6eea,null));};exports['addCustomField']=function(_0x7435aa,_0x48fa29,_0x3d4ecf){var _0x5ee624;delete _0x7435aa[_0xd983('0x4b')]['id'];return db[_0xd983('0x2c')]['findOne']({'where':{'id':_0x7435aa[_0xd983('0x46')]['id']}})[_0xd983('0x24')](handleEntityNotFound(_0x48fa29,null))['then'](function(_0x304a47){if(_0x304a47){return db[_0xd983('0x71')]['transaction'](function(_0x12d07f){return db[_0xd983('0x64')][_0xd983('0x4a')](_0x7435aa[_0xd983('0x4b')],{'transaction':_0x12d07f})[_0xd983('0x24')](function(_0x12cd4e){_0x5ee624=_0x12cd4e;return _0x304a47[_0xd983('0x72')](_0x12cd4e,{'transaction':_0x12d07f});})[_0xd983('0x24')](function(){var _0x40dc65={'type':db[_0xd983('0x73')][_0xd983('0x74')],'transaction':_0x12d07f};switch(_0x7435aa[_0xd983('0x4b')]['type']){case _0xd983('0x75'):_0x40dc65[_0xd983('0x2e')]=db[_0xd983('0x73')][_0xd983('0x74')];break;case'number':_0x40dc65[_0xd983('0x2e')]=db[_0xd983('0x73')][_0xd983('0x76')];break;case'switch':_0x40dc65['type']=db[_0xd983('0x73')][_0xd983('0x77')];_0x40dc65[_0xd983('0x78')]=![];break;default:}return db['sequelize'][_0xd983('0x79')][_0xd983('0x7a')]('cm_contacts',util['format']('cf_%s',_0x5ee624['id']),_0x40dc65);})[_0xd983('0x24')](function(){return _0x5ee624;});});}})[_0xd983('0x24')](respondWithResult(_0x48fa29,null))[_0xd983('0x44')](handleError(_0x48fa29,null));};exports['getCustomFields']=function(_0x41cb1b,_0x9c2b20,_0x5b3dbe){var _0x98fef7={};var _0x3527ce={};var _0x34b5eb;var _0x37aac2;return db[_0xd983('0x2c')][_0xd983('0x54')]({'where':{'id':_0x41cb1b['params']['id']}})[_0xd983('0x24')](handleEntityNotFound(_0x9c2b20,null))['then'](function(_0x3789f0){if(_0x3789f0){_0x34b5eb=_0x3789f0;_0x3527ce[_0xd983('0x33')]=_[_0xd983('0x30')](db[_0xd983('0x64')][_0xd983('0x56')]);_0x3527ce[_0xd983('0x31')]=_['keys'](_0x41cb1b[_0xd983('0x31')]);_0x3527ce[_0xd983('0x32')]=_[_0xd983('0x35')](_0x3527ce[_0xd983('0x33')],_0x3527ce[_0xd983('0x31')]);_0x98fef7['attributes']=_[_0xd983('0x35')](_0x3527ce['model'],qs[_0xd983('0x47')](_0x41cb1b['query'][_0xd983('0x47')]));_0x98fef7[_0xd983('0x34')]=_0x98fef7['attributes']['length']?_0x98fef7[_0xd983('0x34')]:_0x3527ce[_0xd983('0x33')];_0x98fef7[_0xd983('0x38')]=qs[_0xd983('0x39')](_0x41cb1b[_0xd983('0x31')]['sort']);_0x98fef7[_0xd983('0x3c')]=qs[_0xd983('0x32')](_['pick'](_0x41cb1b[_0xd983('0x31')],_0x3527ce['filters']));_0x98fef7[_0xd983('0x3c')]=_['merge'](_0x98fef7[_0xd983('0x3c')],{'$or':[{'ListId':_0x3789f0['id']},{'ListId':null}]});if(_0x41cb1b['query'][_0xd983('0x3b')]){_0x98fef7['where']=_[_0xd983('0x3d')](_0x98fef7[_0xd983('0x3c')],{'$or':_[_0xd983('0x2f')](_0x98fef7[_0xd983('0x34')],function(_0x5f2d3a){var _0x16d1ee={};_0x16d1ee[_0x5f2d3a]={'$like':'%'+_0x41cb1b['query']['filter']+'%'};return _0x16d1ee;})});}_0x98fef7=_[_0xd983('0x3d')]({},_0x98fef7,_0x41cb1b[_0xd983('0x3f')]);return db['CmCustomField'][_0xd983('0x7b')](_0x98fef7);}})['then'](respondWithResult(_0x9c2b20,null))[_0xd983('0x44')](handleError(_0x9c2b20,null));};exports[_0xd983('0x7c')]=function(_0x36a3b6,_0x47d752,_0x15ecfa){return db[_0xd983('0x2c')][_0xd983('0x49')]({'where':{'id':_0x36a3b6[_0xd983('0x46')]['id']}})[_0xd983('0x24')](handleEntityNotFound(_0x47d752,null))[_0xd983('0x24')](function(_0x40de4c){if(_0x40de4c){return _0x40de4c['addAgents'](_0x36a3b6[_0xd983('0x4b')][_0xd983('0x58')],_['omit'](_0x36a3b6[_0xd983('0x4b')],[_0xd983('0x58'),'id'])||{})[_0xd983('0x7d')](function(_0x1e4b4e){for(var _0x47a107=0x0;_0x47a107<_0x36a3b6[_0xd983('0x4b')]['ids'][_0xd983('0x48')];_0x47a107+=0x1){socket[_0xd983('0x7e')](_0xd983('0x7f'),{'UserId':Number(_0x36a3b6[_0xd983('0x4b')][_0xd983('0x58')][_0x47a107]),'CmListId':Number(_0x36a3b6[_0xd983('0x46')]['id'])});}return _0x1e4b4e;});}})[_0xd983('0x24')](respondWithResult(_0x47d752,null))[_0xd983('0x44')](handleError(_0x47d752,null));};exports[_0xd983('0x80')]=function(_0x2bdfa9,_0x25b2d5,_0xe5ce5){return db['CmList'][_0xd983('0x49')]({'where':{'id':_0x2bdfa9[_0xd983('0x46')]['id']}})['then'](handleEntityNotFound(_0x25b2d5,null))[_0xd983('0x24')](function(_0x4f91a5){if(_0x4f91a5){return _0x4f91a5[_0xd983('0x80')](_0x2bdfa9[_0xd983('0x31')][_0xd983('0x58')])[_0xd983('0x24')](function(){if(_[_0xd983('0x5b')](_0x2bdfa9[_0xd983('0x31')][_0xd983('0x58')])){for(var _0x4c9120=0x0;_0x4c9120<_0x2bdfa9[_0xd983('0x31')][_0xd983('0x58')][_0xd983('0x48')];_0x4c9120+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2bdfa9['query'][_0xd983('0x58')][_0x4c9120]),'CmListId':Number(_0x2bdfa9[_0xd983('0x46')]['id'])});}}else{socket[_0xd983('0x7e')](_0xd983('0x81'),{'UserId':Number(_0x2bdfa9[_0xd983('0x31')][_0xd983('0x58')]),'CmListId':Number(_0x2bdfa9[_0xd983('0x46')]['id'])});}});}})[_0xd983('0x24')](respondWithStatusCode(_0x25b2d5,null))[_0xd983('0x44')](handleError(_0x25b2d5,null));};exports[_0xd983('0x82')]=function(_0x3cff08,_0x40ae59,_0x1aae72){var _0x2a5827={};var _0x5a7367={};var _0x55f4d6;var _0x5bf59f;return db['CmList']['findOne']({'where':{'id':_0x3cff08['params']['id']}})[_0xd983('0x24')](handleEntityNotFound(_0x40ae59,null))['then'](function(_0x5a84e8){if(_0x5a84e8){_0x55f4d6=_0x5a84e8;_0x5a7367[_0xd983('0x33')]=_['keys'](db[_0xd983('0x83')]['rawAttributes']);_0x5a7367[_0xd983('0x31')]=_[_0xd983('0x30')](_0x3cff08[_0xd983('0x31')]);_0x5a7367[_0xd983('0x32')]=_[_0xd983('0x35')](_0x5a7367['model'],_0x5a7367['query']);_0x2a5827[_0xd983('0x34')]=_[_0xd983('0x35')](_0x5a7367[_0xd983('0x33')],qs[_0xd983('0x47')](_0x3cff08[_0xd983('0x31')][_0xd983('0x47')]));_0x2a5827[_0xd983('0x34')]=_0x2a5827['attributes'][_0xd983('0x48')]?_0x2a5827[_0xd983('0x34')]:_0x5a7367['model'];_0x2a5827[_0xd983('0x38')]=qs['sort'](_0x3cff08[_0xd983('0x31')][_0xd983('0x39')]);_0x2a5827[_0xd983('0x3c')]=qs[_0xd983('0x32')](_[_0xd983('0x3a')](_0x3cff08[_0xd983('0x31')],_0x5a7367[_0xd983('0x32')]));if(_0x3cff08['query']['filter']){_0x2a5827['where']=_[_0xd983('0x3d')](_0x2a5827[_0xd983('0x3c')],{'$or':_[_0xd983('0x2f')](_0x2a5827[_0xd983('0x34')],function(_0xe41713){var _0x2a7791={};_0x2a7791[_0xe41713]={'$like':'%'+_0x3cff08[_0xd983('0x31')][_0xd983('0x3b')]+'%'};return _0x2a7791;})});}_0x2a5827=_[_0xd983('0x3d')]({},_0x2a5827,_0x3cff08[_0xd983('0x3f')]);return _0x55f4d6['getAgents'](_0x2a5827);}})[_0xd983('0x24')](function(_0x29f94a){if(_0x29f94a){_0x5bf59f=_0x29f94a[_0xd983('0x48')];if(!_0x3cff08[_0xd983('0x31')][_0xd983('0x36')]('nolimit')){_0x2a5827[_0xd983('0x1d')]=qs[_0xd983('0x1d')](_0x3cff08[_0xd983('0x31')][_0xd983('0x1d')]);_0x2a5827[_0xd983('0x1b')]=qs[_0xd983('0x1b')](_0x3cff08[_0xd983('0x31')][_0xd983('0x1b')]);}return _0x55f4d6[_0xd983('0x82')](_0x2a5827);}})[_0xd983('0x24')](function(_0x330d2d){if(_0x330d2d){return _0x330d2d?{'count':_0x5bf59f,'rows':_0x330d2d}:null;}})[_0xd983('0x24')](respondWithResult(_0x40ae59,null))[_0xd983('0x44')](handleError(_0x40ae59,null));}; \ No newline at end of file +var _0x2f4e=['message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','raw','getContactsCsv','format','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','download','addCustomField','sequelize','transaction','CmCustomField','addCustomFields','TEXT','text','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cf_%s','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','Lists','error','name','send','index','map','CmList','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','success','dataValues','errors'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x2f4e,0x1d0));var _0xe2f4=function(_0x2b76cc,_0x84b7a5){_0x2b76cc=_0x2b76cc-0x0;var _0x3d476f=_0x2f4e[_0x2b76cc];return _0x3d476f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2f4('0x0'));var zipdir=require(_0xe2f4('0x1'));var jsonpatch=require(_0xe2f4('0x2'));var rp=require('request-promise');var moment=require(_0xe2f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe2f4('0x4'));var util=require(_0xe2f4('0x5'));var path=require('path');var sox=require(_0xe2f4('0x6'));var csv=require(_0xe2f4('0x7'));var ejs=require(_0xe2f4('0x8'));var fs=require('fs');var fs_extra=require(_0xe2f4('0x9'));var _=require(_0xe2f4('0xa'));var squel=require(_0xe2f4('0xb'));var crypto=require(_0xe2f4('0xc'));var jsforce=require(_0xe2f4('0xd'));var deskjs=require(_0xe2f4('0xe'));var toCsv=require(_0xe2f4('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe2f4('0xf'));var authService=require(_0xe2f4('0x10'));var qs=require(_0xe2f4('0x11'));var as=require(_0xe2f4('0x12'));var hardwareService=require(_0xe2f4('0x13'));var logger=require('../../config/logger')(_0xe2f4('0x14'));var utils=require(_0xe2f4('0x15'));var config=require(_0xe2f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2f4('0x17'))['db'];config[_0xe2f4('0x18')]=_[_0xe2f4('0x19')](config[_0xe2f4('0x18')],{'host':_0xe2f4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe2f4('0x1b'))[_0xe2f4('0x1c')](socket);function respondWithStatusCode(_0x7a077e,_0x589d06){_0x589d06=_0x589d06||0xcc;return function(_0x135626){if(_0x135626){return _0x7a077e[_0xe2f4('0x1d')](_0x589d06);}return _0x7a077e[_0xe2f4('0x1e')](_0x589d06)[_0xe2f4('0x1f')]();};}function respondWithResult(_0x2b810c,_0x3f90c3){_0x3f90c3=_0x3f90c3||0xc8;return function(_0x5cc103){if(_0x5cc103){return _0x2b810c[_0xe2f4('0x1e')](_0x3f90c3)[_0xe2f4('0x20')](_0x5cc103);}};}function respondWithFilteredResult(_0x323731,_0x38cd8d){return function(_0x423a5f){if(_0x423a5f){var _0x1f09ea=typeof _0x38cd8d[_0xe2f4('0x21')]===_0xe2f4('0x22')&&typeof _0x38cd8d[_0xe2f4('0x23')]===_0xe2f4('0x22');var _0x170953=_0x423a5f[_0xe2f4('0x24')];var _0x341db4=_0x1f09ea?0x0:_0x38cd8d[_0xe2f4('0x21')];var _0x2080d2=_0x1f09ea?_0x423a5f[_0xe2f4('0x24')]:_0x38cd8d[_0xe2f4('0x21')]+_0x38cd8d['limit'];var _0x2854c1;if(_0x2080d2>=_0x170953){_0x2080d2=_0x170953;_0x2854c1=0xc8;}else{_0x2854c1=0xce;}_0x323731[_0xe2f4('0x1e')](_0x2854c1);return _0x323731[_0xe2f4('0x25')](_0xe2f4('0x26'),_0x341db4+'-'+_0x2080d2+'/'+_0x170953)['json'](_0x423a5f);}return null;};}function patchUpdates(_0x3ad3b1){return function(_0x19eff2){try{jsonpatch['apply'](_0x19eff2,_0x3ad3b1,!![]);}catch(_0x25b9c2){return BPromise[_0xe2f4('0x27')](_0x25b9c2);}return _0x19eff2['save']();};}function saveUpdates(_0x4584a2,_0x42e700){return function(_0xef29c2){if(_0xef29c2){return _0xef29c2[_0xe2f4('0x28')](_0x4584a2)[_0xe2f4('0x29')](function(_0x2c7675){return _0x2c7675;});}return null;};}function removeEntity(_0x4002a1,_0x44c4b3){return function(_0xc74e59){if(_0xc74e59){return _0xc74e59['destroy']()[_0xe2f4('0x29')](function(){var _0x5233ad=_0xc74e59[_0xe2f4('0x2a')]({'plain':!![]});var _0x227658=_0xe2f4('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x227658,'resourceId':_0x5233ad['id']}})[_0xe2f4('0x29')](function(){return _0xc74e59;});})[_0xe2f4('0x29')](function(){_0x4002a1['status'](0xcc)[_0xe2f4('0x1f')]();});}};}function handleEntityNotFound(_0x2b3436,_0x34ed55){return function(_0x27e7c1){if(!_0x27e7c1){_0x2b3436[_0xe2f4('0x1d')](0x194);}return _0x27e7c1;};}function handleError(_0x4ffdf4,_0x5be3ce){_0x5be3ce=_0x5be3ce||0x1f4;return function(_0x31ab28){logger[_0xe2f4('0x2c')](_0x31ab28['stack']);if(_0x31ab28[_0xe2f4('0x2d')]){delete _0x31ab28[_0xe2f4('0x2d')];}_0x4ffdf4['status'](_0x5be3ce)[_0xe2f4('0x2e')](_0x31ab28);};}exports[_0xe2f4('0x2f')]=function(_0x8ba3a5,_0x1c5ac8){var _0x393f90={},_0x4fba9e={},_0xdca63b={'count':0x0,'rows':[]};var _0x5d5d66=_[_0xe2f4('0x30')](db[_0xe2f4('0x31')]['rawAttributes'],function(_0x2db826){return{'name':_0x2db826[_0xe2f4('0x32')],'type':_0x2db826[_0xe2f4('0x33')]['key']};});_0x4fba9e[_0xe2f4('0x34')]=_[_0xe2f4('0x30')](_0x5d5d66,_0xe2f4('0x2d'));_0x4fba9e[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x8ba3a5['query']);_0x4fba9e[_0xe2f4('0x37')]=_[_0xe2f4('0x38')](_0x4fba9e['model'],_0x4fba9e[_0xe2f4('0x35')]);_0x393f90[_0xe2f4('0x39')]=_['intersection'](_0x4fba9e['model'],qs[_0xe2f4('0x3a')](_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x3a')]));_0x393f90[_0xe2f4('0x39')]=_0x393f90[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x393f90[_0xe2f4('0x39')]:_0x4fba9e[_0xe2f4('0x34')];if(!_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x393f90[_0xe2f4('0x23')]=qs[_0xe2f4('0x23')](_0x8ba3a5[_0xe2f4('0x35')]['limit']);_0x393f90[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x21')]);}_0x393f90[_0xe2f4('0x3e')]=qs[_0xe2f4('0x3f')](_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x3f')]);_0x393f90[_0xe2f4('0x40')]=qs['filters'](_[_0xe2f4('0x41')](_0x8ba3a5[_0xe2f4('0x35')],_0x4fba9e[_0xe2f4('0x37')]),_0x5d5d66);if(_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x42')]){_0x393f90[_0xe2f4('0x40')]=_['merge'](_0x393f90[_0xe2f4('0x40')],{'$or':_[_0xe2f4('0x30')](_0x5d5d66,function(_0x161406){if(_0x161406[_0xe2f4('0x33')]!==_0xe2f4('0x43')){var _0x507173={};_0x507173[_0x161406[_0xe2f4('0x2d')]]={'$like':'%'+_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x42')]+'%'};return _0x507173;}})});}_0x393f90=_[_0xe2f4('0x44')]({},_0x393f90,_0x8ba3a5['options']);var _0x34e00f={'where':_0x393f90[_0xe2f4('0x40')]};return db[_0xe2f4('0x31')][_0xe2f4('0x24')](_0x34e00f)[_0xe2f4('0x29')](function(_0x210458){_0xdca63b[_0xe2f4('0x24')]=_0x210458;if(_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x45')]){_0x393f90[_0xe2f4('0x46')]=[{'all':!![]}];}return db['CmList'][_0xe2f4('0x47')](_0x393f90);})[_0xe2f4('0x29')](function(_0x1ac1fa){_0xdca63b[_0xe2f4('0x48')]=_0x1ac1fa;return _0xdca63b;})['then'](respondWithFilteredResult(_0x1c5ac8,_0x393f90))[_0xe2f4('0x49')](handleError(_0x1c5ac8,null));};exports[_0xe2f4('0x4a')]=function(_0x4c4701,_0x2cdefe){var _0x30702b={'raw':![],'where':{'id':_0x4c4701[_0xe2f4('0x4b')]['id']}},_0x298763={};_0x298763[_0xe2f4('0x34')]=_[_0xe2f4('0x36')](db[_0xe2f4('0x31')][_0xe2f4('0x4c')]);_0x298763[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x4c4701[_0xe2f4('0x35')]);_0x298763[_0xe2f4('0x37')]=_[_0xe2f4('0x38')](_0x298763['model'],_0x298763['query']);_0x30702b[_0xe2f4('0x39')]=_[_0xe2f4('0x38')](_0x298763[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x4c4701[_0xe2f4('0x35')]['fields']));_0x30702b[_0xe2f4('0x39')]=_0x30702b[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x30702b[_0xe2f4('0x39')]:_0x298763[_0xe2f4('0x34')];if(_0x4c4701['query']['includeAll']){_0x30702b[_0xe2f4('0x46')]=[{'all':!![]}];}_0x30702b=_[_0xe2f4('0x44')]({},_0x30702b,_0x4c4701[_0xe2f4('0x4d')]);return db[_0xe2f4('0x31')][_0xe2f4('0x4e')](_0x30702b)[_0xe2f4('0x29')](handleEntityNotFound(_0x2cdefe,null))[_0xe2f4('0x29')](respondWithResult(_0x2cdefe,null))[_0xe2f4('0x49')](handleError(_0x2cdefe,null));};exports['create']=function(_0x29b98a,_0x3024bb){return db['CmList'][_0xe2f4('0x4f')](_0x29b98a[_0xe2f4('0x50')],{})[_0xe2f4('0x29')](function(_0x5b9681){var _0x306468=_0x29b98a[_0xe2f4('0x51')][_0xe2f4('0x2a')]({'plain':!![]});if(!_0x306468)throw new Error(_0xe2f4('0x52'));if(_0x306468[_0xe2f4('0x53')]===_0xe2f4('0x51')){var _0x529acd=_0x5b9681[_0xe2f4('0x2a')]({'plain':!![]});var _0x21df66=_0xe2f4('0x2b');return db[_0xe2f4('0x54')][_0xe2f4('0x4e')]({'where':{'name':_0x21df66,'userProfileId':_0x306468['userProfileId']},'raw':!![]})[_0xe2f4('0x29')](function(_0x147386){if(_0x147386&&_0x147386['autoAssociation']===0x0){return db['UserProfileResource'][_0xe2f4('0x4f')]({'name':_0x529acd[_0xe2f4('0x2d')],'resourceId':_0x529acd['id'],'type':_0x147386[_0xe2f4('0x2d')],'sectionId':_0x147386['id']},{})[_0xe2f4('0x29')](function(){return _0x5b9681;});}else{return _0x5b9681;}})['catch'](function(_0x4bf4bf){logger[_0xe2f4('0x2c')](_0xe2f4('0x55'),_0x4bf4bf);throw _0x4bf4bf;});}return _0x5b9681;})[_0xe2f4('0x29')](respondWithResult(_0x3024bb,0xc9))['catch'](handleError(_0x3024bb,null));};exports[_0xe2f4('0x28')]=function(_0x2cd347,_0x5181d6){if(_0x2cd347[_0xe2f4('0x50')]['id']){delete _0x2cd347[_0xe2f4('0x50')]['id'];}return db[_0xe2f4('0x31')][_0xe2f4('0x4e')]({'where':{'id':_0x2cd347[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x5181d6,null))[_0xe2f4('0x29')](saveUpdates(_0x2cd347['body'],null))['then'](respondWithResult(_0x5181d6,null))[_0xe2f4('0x49')](handleError(_0x5181d6,null));};exports[_0xe2f4('0x56')]=function(_0x4d4e06,_0x19c672){return db['CmList'][_0xe2f4('0x4e')]({'where':{'id':_0x4d4e06['params']['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x19c672,null))[_0xe2f4('0x29')](removeEntity(_0x19c672,null))['catch'](handleError(_0x19c672,null));};exports['describe']=function(_0x16298d,_0x151d5a){return db['CmList'][_0xe2f4('0x57')]()[_0xe2f4('0x29')](respondWithResult(_0x151d5a,null))['catch'](handleError(_0x151d5a,null));};exports[_0xe2f4('0x58')]=function(_0xb5308,_0x2bd469,_0x567b82){if(_0xb5308[_0xe2f4('0x50')]['id']){delete _0xb5308[_0xe2f4('0x50')]['id'];}return db[_0xe2f4('0x31')]['find']({'where':{'id':_0xb5308[_0xe2f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2bd469,null))[_0xe2f4('0x29')](function(_0x4cca67){if(_0x4cca67){_0xb5308[_0xe2f4('0x50')][_0xe2f4('0x59')]=_0x4cca67['id'];return db['Disposition'][_0xe2f4('0x4f')](_0xb5308[_0xe2f4('0x50')]);}})[_0xe2f4('0x29')](respondWithResult(_0x2bd469,null))['catch'](handleError(_0x2bd469,null));};exports[_0xe2f4('0x5a')]=function(_0x325058,_0xc64c5a,_0x3e06ed){var _0x32c311={'raw':![],'where':{}};var _0x59aa11={};var _0x488ce6={'count':0x0,'rows':[]};return db[_0xe2f4('0x31')][_0xe2f4('0x5b')]({'where':{'id':_0x325058[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0xc64c5a,null))['then'](function(_0x1e51cc){if(_0x1e51cc){_0x59aa11[_0xe2f4('0x34')]=_[_0xe2f4('0x36')](db[_0xe2f4('0x5c')]['rawAttributes']);_0x59aa11[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x325058['query']);_0x59aa11['filters']=_['intersection'](_0x59aa11['model'],_0x59aa11[_0xe2f4('0x35')]);_0x32c311['attributes']=_[_0xe2f4('0x38')](_0x59aa11[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x325058['query'][_0xe2f4('0x3a')]));_0x32c311['attributes']=_0x32c311[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x32c311[_0xe2f4('0x39')]:_0x59aa11[_0xe2f4('0x34')];if(!_0x325058[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x32c311['limit']=qs[_0xe2f4('0x23')](_0x325058['query']['limit']);_0x32c311[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x325058[_0xe2f4('0x35')][_0xe2f4('0x21')]);}_0x32c311[_0xe2f4('0x3e')]=qs[_0xe2f4('0x3f')](_0x325058[_0xe2f4('0x35')][_0xe2f4('0x3f')]);_0x32c311['where']=qs[_0xe2f4('0x37')](_[_0xe2f4('0x41')](_0x325058['query'],_0x59aa11[_0xe2f4('0x37')]));_0x32c311[_0xe2f4('0x40')][_0xe2f4('0x59')]=_0x1e51cc['id'];if(_0x325058[_0xe2f4('0x35')][_0xe2f4('0x42')]){_0x32c311[_0xe2f4('0x40')]=_[_0xe2f4('0x44')](_0x32c311[_0xe2f4('0x40')],{'$or':_[_0xe2f4('0x30')](_0x32c311[_0xe2f4('0x39')],function(_0x240c31){var _0x511ddc={};_0x511ddc[_0x240c31]={'$like':'%'+_0x325058[_0xe2f4('0x35')]['filter']+'%'};return _0x511ddc;})});}_0x32c311=_['merge']({},_0x32c311,_0x325058[_0xe2f4('0x4d')]);return db[_0xe2f4('0x5c')][_0xe2f4('0x24')]({'where':_0x32c311['where']})[_0xe2f4('0x29')](function(_0x51112f){_0x488ce6['count']=_0x51112f;if(_0x325058[_0xe2f4('0x35')]['includeAll']){_0x32c311[_0xe2f4('0x46')]=[{'all':!![]}];}return db[_0xe2f4('0x5c')][_0xe2f4('0x47')](_0x32c311);})[_0xe2f4('0x29')](function(_0x5ecda9){_0x488ce6['rows']=_0x5ecda9;return _0x488ce6;});}})[_0xe2f4('0x29')](respondWithFilteredResult(_0xc64c5a,_0x32c311))[_0xe2f4('0x49')](handleError(_0xc64c5a,null));};exports[_0xe2f4('0x5d')]=function(_0x5a9e98,_0xefb1df,_0x35159c){return db[_0xe2f4('0x31')]['find']({'where':{'id':_0x5a9e98[_0xe2f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0xefb1df,null))[_0xe2f4('0x29')](function(_0x176f5e){if(_0x176f5e){return _0x176f5e[_0xe2f4('0x5d')](_0x5a9e98[_0xe2f4('0x35')][_0xe2f4('0x5e')]);}})[_0xe2f4('0x29')](respondWithStatusCode(_0xefb1df,null))[_0xe2f4('0x49')](handleError(_0xefb1df,null));};exports[_0xe2f4('0x5f')]=function(_0x2250b0,_0x56dfc7,_0x2e1dd8){return db[_0xe2f4('0x31')][_0xe2f4('0x4e')]({'where':{'id':_0x2250b0['params']['id']}})['then'](handleEntityNotFound(_0x56dfc7,null))['then'](function(_0x1c878d){if(_0x1c878d){var _0x22e486=[];var _0x5061f9={'success':[],'errors':[]};return db[_0xe2f4('0x60')][_0xe2f4('0x57')]()['then'](function(_0x56ad6e){if(_0x2250b0[_0xe2f4('0x50')]['tags']&&_[_0xe2f4('0x61')](_0x2250b0[_0xe2f4('0x50')]['tags'])){if(_0x2250b0[_0xe2f4('0x50')][_0xe2f4('0x62')]['length']){_0x2250b0['body'][_0xe2f4('0x62')]=_0x2250b0[_0xe2f4('0x50')]['tags']['join'](';')+';';}else{_0x2250b0['body'][_0xe2f4('0x62')]=null;}}else{_0x2250b0['body'][_0xe2f4('0x62')]=null;}if(_0x2250b0[_0xe2f4('0x50')]&&_[_0xe2f4('0x61')](_0x2250b0[_0xe2f4('0x50')])){for(var _0x2b6190=0x0;_0x2b6190<_0x2250b0['body'][_0xe2f4('0x3b')];_0x2b6190+=0x1){_0x2250b0[_0xe2f4('0x50')][_0x2b6190][_0xe2f4('0x59')]=_0x2250b0[_0xe2f4('0x4b')]['id'];_0x22e486[_0xe2f4('0x63')](_0x2250b0[_0xe2f4('0x50')][_0x2b6190]);}return BPromise[_0xe2f4('0x64')](_0x22e486,function(_0x1b90da){return db[_0xe2f4('0x60')][_0xe2f4('0x4f')](_['omit'](_0x1b90da,['ids','id'])||{},{'fields':_['keys'](_0x56ad6e),'raw':!![]})['then'](function(_0x548b19){_0x5061f9[_0xe2f4('0x65')]['push'](_0x548b19[_0xe2f4('0x66')]);})['catch'](function(_0xcb2643){_0x5061f9[_0xe2f4('0x67')][_0xe2f4('0x63')]({'data':_0x1b90da,'error':_0xcb2643[_0xe2f4('0x68')]});});})[_0xe2f4('0x29')](function(_0x951486){return _0x5061f9;})[_0xe2f4('0x49')](function(_0x41c175){return _0x41c175;});}else{_0x56dfc7[_0xe2f4('0x1e')](0x190)[_0xe2f4('0x20')]({'message':_0xe2f4('0x69')});}});}})['then'](respondWithResult(_0x56dfc7,null))[_0xe2f4('0x49')](handleError(_0x56dfc7,null));};exports[_0xe2f4('0x6a')]=function(_0x1bd351,_0x37d453,_0x28bc33){var _0x1c84a9;return db[_0xe2f4('0x31')][_0xe2f4('0x4e')]({'where':{'id':_0x1bd351['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xe2f4('0x6b')}]})[_0xe2f4('0x29')](handleEntityNotFound(_0x37d453,null))[_0xe2f4('0x29')](function(_0x496ef5){if(_0x496ef5){_0x1c84a9=_0x496ef5;return db[_0xe2f4('0x60')][_0xe2f4('0x4c')];}})[_0xe2f4('0x29')](function(_0x158d72){if(_0x158d72){var _0x89982={};var _0x214433={};_0x214433[_0xe2f4('0x34')]=_[_0xe2f4('0x6c')](_[_0xe2f4('0x36')](_0x158d72),_[_0xe2f4('0x30')](_0x1c84a9['CustomFields'],function(_0x35d65b){return util['format'](_0xe2f4('0x6d'),_0x35d65b['id']);}));_0x214433[_0xe2f4('0x35')]=_['keys'](_0x1bd351['query']);_0x214433['filters']=_['intersection'](_0x214433['model'],_0x214433[_0xe2f4('0x35')]);_0x89982[_0xe2f4('0x39')]=_[_0xe2f4('0x38')](_0x214433[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x1bd351[_0xe2f4('0x35')]['fields']));_0x89982[_0xe2f4('0x39')]=_0x89982['attributes'][_0xe2f4('0x3b')]?_0x89982['attributes']:_0x214433[_0xe2f4('0x34')];if(!_0x1bd351[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x89982[_0xe2f4('0x23')]=qs[_0xe2f4('0x23')](_0x1bd351['query']['limit']);_0x89982[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x1bd351['query'][_0xe2f4('0x21')]);}_0x89982[_0xe2f4('0x3e')]=qs[_0xe2f4('0x3f')](_0x1bd351['query'][_0xe2f4('0x3f')]);_0x89982[_0xe2f4('0x40')]=qs[_0xe2f4('0x37')](_[_0xe2f4('0x41')](_0x1bd351['query'],_0x214433[_0xe2f4('0x37')]));_0x89982[_0xe2f4('0x6e')]=!![];if(_0x1bd351[_0xe2f4('0x35')][_0xe2f4('0x42')]){_0x89982['where']=_['merge'](_0x89982[_0xe2f4('0x40')],{'$or':_['map'](_0x89982[_0xe2f4('0x39')],function(_0x291bb9){var _0x663e02={};_0x663e02[_0x291bb9]={'$like':'%'+_0x1bd351['query']['filter']+'%'};return _0x663e02;})});}_0x89982=_[_0xe2f4('0x44')]({},_0x89982,_0x1bd351['options']);return _0x1c84a9['getContacts'](_0x89982);}})[_0xe2f4('0x29')](respondWithResult(_0x37d453,null))['catch'](handleError(_0x37d453,null));};exports[_0xe2f4('0x6f')]=function(_0x4d21c0,_0x267bf3,_0x11b2f6){var _0x2de86b;return db['CmList']['find']({'where':{'id':_0x4d21c0[_0xe2f4('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xe2f4('0x6b')}]})['then'](handleEntityNotFound(_0x267bf3,null))['then'](function(_0x4e8b18){if(_0x4e8b18){_0x2de86b=_0x4e8b18;return db[_0xe2f4('0x60')][_0xe2f4('0x4c')];}})[_0xe2f4('0x29')](function(_0x4b53e2){if(_0x4b53e2){var _0x18bf13={};var _0xf2e6ce={};_0xf2e6ce['model']=_[_0xe2f4('0x6c')](_[_0xe2f4('0x36')](_0x4b53e2),_[_0xe2f4('0x30')](_0x2de86b[_0xe2f4('0x6b')],function(_0x345474){return util[_0xe2f4('0x70')](_0xe2f4('0x6d'),_0x345474['id']);}));_0xf2e6ce[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x4d21c0[_0xe2f4('0x35')]);_0xf2e6ce['filters']=_['intersection'](_0xf2e6ce[_0xe2f4('0x34')],_0xf2e6ce[_0xe2f4('0x35')]);_0x18bf13[_0xe2f4('0x39')]=_[_0xe2f4('0x38')](_0xf2e6ce[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x3a')]));_0x18bf13[_0xe2f4('0x39')]=_0x18bf13[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x18bf13['attributes']:_0xf2e6ce[_0xe2f4('0x34')];if(!_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x18bf13[_0xe2f4('0x23')]=qs['limit'](_0x4d21c0[_0xe2f4('0x35')]['limit']);_0x18bf13[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x21')]);}_0x18bf13['order']=qs['sort'](_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x3f')]);_0x18bf13[_0xe2f4('0x40')]=qs[_0xe2f4('0x37')](_['pick'](_0x4d21c0[_0xe2f4('0x35')],_0xf2e6ce[_0xe2f4('0x37')]));_0x18bf13[_0xe2f4('0x6e')]=!![];if(_0x4d21c0[_0xe2f4('0x35')]['filter']){_0x18bf13[_0xe2f4('0x40')]=_[_0xe2f4('0x44')](_0x18bf13[_0xe2f4('0x40')],{'$or':_['map'](_0x18bf13[_0xe2f4('0x39')],function(_0x422b18){var _0x7623da={};_0x7623da[_0x422b18]={'$like':'%'+_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x42')]+'%'};return _0x7623da;})});}_0x18bf13=_[_0xe2f4('0x44')]({},_0x18bf13,_0x4d21c0['options']);return _0x2de86b['getContacts'](_0x18bf13);}})[_0xe2f4('0x29')](function(_0x5ea322){if(!_['isEmpty'](_0x5ea322)){var _0x545fe4=toCsv(_0x5ea322);var _0x570701=Date[_0xe2f4('0x71')]();fs[_0xe2f4('0x72')](util['format'](_0xe2f4('0x73'),_0x2de86b['id'],_0x570701),_0x545fe4);_0x267bf3[_0xe2f4('0x74')](_0xe2f4('0x75'),'attachment;\x20filename='+util[_0xe2f4('0x70')]('list_%d_%s.csv',_0x2de86b['id'],_0x570701));_0x267bf3[_0xe2f4('0x74')](_0xe2f4('0x76'),'text/csv');return _0x267bf3[_0xe2f4('0x77')](util[_0xe2f4('0x70')]('/tmp/list_%d_%s.csv',_0x2de86b['id'],_0x570701));}else{return _0x267bf3[_0xe2f4('0x1d')](0xcc);}})[_0xe2f4('0x49')](handleError(_0x267bf3,null));};exports[_0xe2f4('0x78')]=function(_0x4f4b75,_0x451258,_0x5242cf){var _0x3202e7;delete _0x4f4b75[_0xe2f4('0x50')]['id'];return db['CmList'][_0xe2f4('0x5b')]({'where':{'id':_0x4f4b75[_0xe2f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x451258,null))['then'](function(_0x1d897a){if(_0x1d897a){return db[_0xe2f4('0x79')][_0xe2f4('0x7a')](function(_0x4cbaa6){return db[_0xe2f4('0x7b')][_0xe2f4('0x4f')](_0x4f4b75[_0xe2f4('0x50')],{'transaction':_0x4cbaa6})[_0xe2f4('0x29')](function(_0xc8ea3f){_0x3202e7=_0xc8ea3f;return _0x1d897a[_0xe2f4('0x7c')](_0xc8ea3f,{'transaction':_0x4cbaa6});})['then'](function(){var _0x37c212={'type':db['Sequelize'][_0xe2f4('0x7d')],'transaction':_0x4cbaa6};switch(_0x4f4b75[_0xe2f4('0x50')]['type']){case _0xe2f4('0x7e'):_0x37c212['type']=db[_0xe2f4('0x7f')][_0xe2f4('0x7d')];break;case _0xe2f4('0x80'):_0x37c212[_0xe2f4('0x33')]=db[_0xe2f4('0x7f')][_0xe2f4('0x81')];break;case'switch':_0x37c212[_0xe2f4('0x33')]=db[_0xe2f4('0x7f')][_0xe2f4('0x82')];_0x37c212[_0xe2f4('0x83')]=![];break;default:}return db[_0xe2f4('0x79')][_0xe2f4('0x84')]['addColumn']('cm_contacts',util[_0xe2f4('0x70')](_0xe2f4('0x85'),_0x3202e7['id']),_0x37c212);})[_0xe2f4('0x29')](function(){return _0x3202e7;});});}})[_0xe2f4('0x29')](respondWithResult(_0x451258,null))[_0xe2f4('0x49')](handleError(_0x451258,null));};exports['getCustomFields']=function(_0x36e741,_0x4378fb,_0x4be4a0){var _0x474a03={};var _0xf91ee2={};var _0x4dd6c8;var _0x84e620;return db['CmList'][_0xe2f4('0x5b')]({'where':{'id':_0x36e741[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x4378fb,null))[_0xe2f4('0x29')](function(_0x17ba5e){if(_0x17ba5e){_0x4dd6c8=_0x17ba5e;_0xf91ee2[_0xe2f4('0x34')]=_['keys'](db[_0xe2f4('0x7b')][_0xe2f4('0x4c')]);_0xf91ee2[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x36e741[_0xe2f4('0x35')]);_0xf91ee2['filters']=_[_0xe2f4('0x38')](_0xf91ee2['model'],_0xf91ee2[_0xe2f4('0x35')]);_0x474a03[_0xe2f4('0x39')]=_[_0xe2f4('0x38')](_0xf91ee2[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x36e741[_0xe2f4('0x35')][_0xe2f4('0x3a')]));_0x474a03[_0xe2f4('0x39')]=_0x474a03[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x474a03['attributes']:_0xf91ee2[_0xe2f4('0x34')];_0x474a03[_0xe2f4('0x3e')]=qs['sort'](_0x36e741[_0xe2f4('0x35')]['sort']);_0x474a03[_0xe2f4('0x40')]=qs[_0xe2f4('0x37')](_[_0xe2f4('0x41')](_0x36e741[_0xe2f4('0x35')],_0xf91ee2[_0xe2f4('0x37')]));_0x474a03[_0xe2f4('0x40')]=_[_0xe2f4('0x44')](_0x474a03[_0xe2f4('0x40')],{'$or':[{'ListId':_0x17ba5e['id']},{'ListId':null}]});if(_0x36e741[_0xe2f4('0x35')][_0xe2f4('0x42')]){_0x474a03['where']=_[_0xe2f4('0x44')](_0x474a03[_0xe2f4('0x40')],{'$or':_[_0xe2f4('0x30')](_0x474a03[_0xe2f4('0x39')],function(_0x15faab){var _0x27de17={};_0x27de17[_0x15faab]={'$like':'%'+_0x36e741[_0xe2f4('0x35')][_0xe2f4('0x42')]+'%'};return _0x27de17;})});}_0x474a03=_[_0xe2f4('0x44')]({},_0x474a03,_0x36e741[_0xe2f4('0x4d')]);return db[_0xe2f4('0x7b')][_0xe2f4('0x86')](_0x474a03);}})['then'](respondWithResult(_0x4378fb,null))[_0xe2f4('0x49')](handleError(_0x4378fb,null));};exports[_0xe2f4('0x87')]=function(_0x4d8ce0,_0x33ce6e,_0x2107d5){return db['CmList'][_0xe2f4('0x4e')]({'where':{'id':_0x4d8ce0['params']['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x33ce6e,null))[_0xe2f4('0x29')](function(_0x39efa4){if(_0x39efa4){return _0x39efa4[_0xe2f4('0x87')](_0x4d8ce0[_0xe2f4('0x50')]['ids'],_['omit'](_0x4d8ce0[_0xe2f4('0x50')],['ids','id'])||{})[_0xe2f4('0x88')](function(_0x1533c0){for(var _0x2a5695=0x0;_0x2a5695<_0x4d8ce0[_0xe2f4('0x50')][_0xe2f4('0x5e')][_0xe2f4('0x3b')];_0x2a5695+=0x1){socket['emit'](_0xe2f4('0x89'),{'UserId':Number(_0x4d8ce0[_0xe2f4('0x50')]['ids'][_0x2a5695]),'CmListId':Number(_0x4d8ce0['params']['id'])});}return _0x1533c0;});}})[_0xe2f4('0x29')](respondWithResult(_0x33ce6e,null))[_0xe2f4('0x49')](handleError(_0x33ce6e,null));};exports[_0xe2f4('0x8a')]=function(_0x4172cc,_0x259896,_0xf85c11){return db['CmList'][_0xe2f4('0x4e')]({'where':{'id':_0x4172cc[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x259896,null))['then'](function(_0x312899){if(_0x312899){return _0x312899['removeAgents'](_0x4172cc['query']['ids'])[_0xe2f4('0x29')](function(){if(_[_0xe2f4('0x61')](_0x4172cc[_0xe2f4('0x35')][_0xe2f4('0x5e')])){for(var _0x22ccca=0x0;_0x22ccca<_0x4172cc['query'][_0xe2f4('0x5e')][_0xe2f4('0x3b')];_0x22ccca+=0x1){socket[_0xe2f4('0x8b')](_0xe2f4('0x8c'),{'UserId':Number(_0x4172cc[_0xe2f4('0x35')][_0xe2f4('0x5e')][_0x22ccca]),'CmListId':Number(_0x4172cc[_0xe2f4('0x4b')]['id'])});}}else{socket['emit'](_0xe2f4('0x8c'),{'UserId':Number(_0x4172cc['query'][_0xe2f4('0x5e')]),'CmListId':Number(_0x4172cc[_0xe2f4('0x4b')]['id'])});}});}})[_0xe2f4('0x29')](respondWithStatusCode(_0x259896,null))['catch'](handleError(_0x259896,null));};exports['getAgents']=function(_0x305a23,_0x3e0711,_0x930ec4){var _0x4677a7={};var _0xd372a3={};var _0x1c9ecc;var _0x6b2b56;return db['CmList'][_0xe2f4('0x5b')]({'where':{'id':_0x305a23[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x3e0711,null))[_0xe2f4('0x29')](function(_0x4c1039){if(_0x4c1039){_0x1c9ecc=_0x4c1039;_0xd372a3['model']=_[_0xe2f4('0x36')](db['User'][_0xe2f4('0x4c')]);_0xd372a3[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x305a23[_0xe2f4('0x35')]);_0xd372a3['filters']=_[_0xe2f4('0x38')](_0xd372a3[_0xe2f4('0x34')],_0xd372a3[_0xe2f4('0x35')]);_0x4677a7[_0xe2f4('0x39')]=_['intersection'](_0xd372a3[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x305a23['query']['fields']));_0x4677a7[_0xe2f4('0x39')]=_0x4677a7[_0xe2f4('0x39')]['length']?_0x4677a7[_0xe2f4('0x39')]:_0xd372a3['model'];_0x4677a7[_0xe2f4('0x3e')]=qs[_0xe2f4('0x3f')](_0x305a23[_0xe2f4('0x35')][_0xe2f4('0x3f')]);_0x4677a7[_0xe2f4('0x40')]=qs[_0xe2f4('0x37')](_[_0xe2f4('0x41')](_0x305a23['query'],_0xd372a3[_0xe2f4('0x37')]));if(_0x305a23[_0xe2f4('0x35')]['filter']){_0x4677a7[_0xe2f4('0x40')]=_[_0xe2f4('0x44')](_0x4677a7[_0xe2f4('0x40')],{'$or':_[_0xe2f4('0x30')](_0x4677a7[_0xe2f4('0x39')],function(_0xb53e5c){var _0x1acf8e={};_0x1acf8e[_0xb53e5c]={'$like':'%'+_0x305a23[_0xe2f4('0x35')][_0xe2f4('0x42')]+'%'};return _0x1acf8e;})});}_0x4677a7=_['merge']({},_0x4677a7,_0x305a23[_0xe2f4('0x4d')]);return _0x1c9ecc[_0xe2f4('0x8d')](_0x4677a7);}})[_0xe2f4('0x29')](function(_0xc58e91){if(_0xc58e91){_0x6b2b56=_0xc58e91[_0xe2f4('0x3b')];if(!_0x305a23[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x4677a7[_0xe2f4('0x23')]=qs[_0xe2f4('0x23')](_0x305a23[_0xe2f4('0x35')][_0xe2f4('0x23')]);_0x4677a7[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x305a23['query'][_0xe2f4('0x21')]);}return _0x1c9ecc[_0xe2f4('0x8d')](_0x4677a7);}})[_0xe2f4('0x29')](function(_0x3d415f){if(_0x3d415f){return _0x3d415f?{'count':_0x6b2b56,'rows':_0x3d415f}:null;}})[_0xe2f4('0x29')](respondWithResult(_0x3e0711,null))[_0xe2f4('0x49')](handleError(_0x3e0711,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1ec1bc0..8cac9f1 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe14b,0x93));var _0xbe14=function(_0x4f5185,_0x3f5e83){_0x4f5185=_0x4f5185-0x0;var _0x4f70d8=_0xe14b[_0x4f5185];return _0x4f70d8;};'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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x8e28e2,_0x4d4858){_0x8e28e2=_0x8e28e2-0x0;var _0x104d65=_0xe14b[_0x8e28e2];return _0x104d65;};'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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f95dfe0..ebc88bb 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 _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x5dc3c2,_0x36dc20){var _0x1130a4=function(_0x5143ab){while(--_0x5143ab){_0x5dc3c2['push'](_0x5dc3c2['shift']());}};_0x1130a4(++_0x36dc20);}(_0x6324,0x142));var _0x4632=function(_0x35a9a7,_0x5e8c7f){_0x35a9a7=_0x35a9a7-0x0;var _0x142c13=_0x6324[_0x35a9a7];return _0x142c13;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x192d55,_0x7c9ee4){var _0x1ea8ac=function(_0x3e9053){while(--_0x3e9053){_0x192d55['push'](_0x192d55['shift']());}};_0x1ea8ac(++_0x7c9ee4);}(_0x6324,0x142));var _0x4632=function(_0x3aeae6,_0x201d94){_0x3aeae6=_0x3aeae6-0x0;var _0xc3594=_0x6324[_0x3aeae6];return _0xc3594;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('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 d7eeaa2..92e9513 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 _0x0bca=['CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug'];(function(_0x457160,_0x5bbfef){var _0x1763e5=function(_0x4e934a){while(--_0x4e934a){_0x457160['push'](_0x457160['shift']());}};_0x1763e5(++_0x5bbfef);}(_0x0bca,0xf9));var _0xa0bc=function(_0x1475dc,_0x9fb023){_0x1475dc=_0x1475dc-0x0;var _0x19c5a9=_0x0bca[_0x1475dc];return _0x19c5a9;};'use strict';var _=require(_0xa0bc('0x0'));var util=require(_0xa0bc('0x1'));var moment=require(_0xa0bc('0x2'));var BPromise=require(_0xa0bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0bc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0bc('0x5'))(_0xa0bc('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0bc('0x7'));var client=jayson[_0xa0bc('0x8')][_0xa0bc('0x9')]({'port':0x232a});config[_0xa0bc('0xa')]=_[_0xa0bc('0xb')](config[_0xa0bc('0xa')],{'host':_0xa0bc('0xc'),'port':0x18eb});var socket=require(_0xa0bc('0xd'))(new Redis(config[_0xa0bc('0xa')]));require(_0xa0bc('0xe'))[_0xa0bc('0xf')](socket);function respondWithRpcPromise(_0x43594e,_0x3e5cd0,_0x507c92){return new BPromise(function(_0x14c293,_0x318281){return client[_0xa0bc('0x10')](_0x43594e,_0x507c92)[_0xa0bc('0x11')](function(_0x3db27f){logger[_0xa0bc('0x12')](_0xa0bc('0x13'),_0x3e5cd0,'request\x20sent');logger[_0xa0bc('0x14')](_0xa0bc('0x15'),_0x3e5cd0,_0xa0bc('0x16'),JSON['stringify'](_0x3db27f));if(_0x3db27f[_0xa0bc('0x17')]){if(_0x3db27f['error'][_0xa0bc('0x18')]===0x1f4){logger['error'](_0xa0bc('0x13'),_0x3e5cd0,_0x3db27f['error'][_0xa0bc('0x19')]);return _0x318281(_0x3db27f['error'][_0xa0bc('0x19')]);}logger[_0xa0bc('0x17')](_0xa0bc('0x13'),_0x3e5cd0,_0x3db27f[_0xa0bc('0x17')][_0xa0bc('0x19')]);return _0x14c293(_0x3db27f[_0xa0bc('0x17')][_0xa0bc('0x19')]);}else{logger[_0xa0bc('0x12')](_0xa0bc('0x13'),_0x3e5cd0,_0xa0bc('0x16'));_0x14c293(_0x3db27f[_0xa0bc('0x1a')][_0xa0bc('0x19')]);}})['catch'](function(_0x3203d6){logger[_0xa0bc('0x17')]('CmList,\x20%s,\x20%s',_0x3e5cd0,_0x3203d6);_0x318281(_0x3203d6);});});} \ No newline at end of file +var _0x88e8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','CmList,\x20%s,\x20%s','message','result','bluebird'];(function(_0x10cccd,_0x4bada9){var _0x57a069=function(_0xee392e){while(--_0xee392e){_0x10cccd['push'](_0x10cccd['shift']());}};_0x57a069(++_0x4bada9);}(_0x88e8,0x1d3));var _0x888e=function(_0x325654,_0x4e6fe1){_0x325654=_0x325654-0x0;var _0x994fc7=_0x88e8[_0x325654];return _0x994fc7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x888e('0x0'));var rs=require(_0x888e('0x1'));var fs=require('fs');var Redis=require(_0x888e('0x2'));var db=require(_0x888e('0x3'))['db'];var utils=require(_0x888e('0x4'));var logger=require(_0x888e('0x5'))(_0x888e('0x6'));var config=require('../../config/environment');var jayson=require(_0x888e('0x7'));var client=jayson[_0x888e('0x8')][_0x888e('0x9')]({'port':0x232a});config['redis']=_[_0x888e('0xa')](config[_0x888e('0xb')],{'host':_0x888e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x888e('0xb')]));require(_0x888e('0xd'))[_0x888e('0xe')](socket);function respondWithRpcPromise(_0x3be6ab,_0x4cddc2,_0xe853b5){return new BPromise(function(_0x3cd5fd,_0x1d1dec){return client[_0x888e('0xf')](_0x3be6ab,_0xe853b5)[_0x888e('0x10')](function(_0x299278){logger[_0x888e('0x11')]('CmList,\x20%s,\x20%s',_0x4cddc2,_0x888e('0x12'));logger[_0x888e('0x13')](_0x888e('0x14'),_0x4cddc2,'request\x20sent',JSON['stringify'](_0x299278));if(_0x299278[_0x888e('0x15')]){if(_0x299278[_0x888e('0x15')][_0x888e('0x16')]===0x1f4){logger['error'](_0x888e('0x17'),_0x4cddc2,_0x299278[_0x888e('0x15')][_0x888e('0x18')]);return _0x1d1dec(_0x299278['error'][_0x888e('0x18')]);}logger['error'](_0x888e('0x17'),_0x4cddc2,_0x299278[_0x888e('0x15')][_0x888e('0x18')]);return _0x3cd5fd(_0x299278['error'][_0x888e('0x18')]);}else{logger[_0x888e('0x11')]('CmList,\x20%s,\x20%s',_0x4cddc2,_0x888e('0x12'));_0x3cd5fd(_0x299278[_0x888e('0x19')][_0x888e('0x18')]);}})['catch'](function(_0x2486b8){logger[_0x888e('0x15')](_0x888e('0x17'),_0x4cddc2,_0x2486b8);_0x1d1dec(_0x2486b8);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 149394f..085fd13 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 _0xaeec=['length','cmList:','./cmList.events','save','emit','removeListener','register'];(function(_0xbd60c5,_0x1382db){var _0x4faa3e=function(_0x47293a){while(--_0x47293a){_0xbd60c5['push'](_0xbd60c5['shift']());}};_0x4faa3e(++_0x1382db);}(_0xaeec,0x87));var _0xcaee=function(_0x3854d1,_0x140651){_0x3854d1=_0x3854d1-0x0;var _0x248125=_0xaeec[_0x3854d1];return _0x248125;};'use strict';var CmListEvents=require(_0xcaee('0x0'));var events=[_0xcaee('0x1'),'remove','update'];function createListener(_0x5eb3a5,_0x3d7a58){return function(_0x36601a){_0x3d7a58[_0xcaee('0x2')](_0x5eb3a5,_0x36601a);};}function removeListener(_0x310172,_0x46fca1){return function(){CmListEvents[_0xcaee('0x3')](_0x310172,_0x46fca1);};}exports[_0xcaee('0x4')]=function(_0x1be0d0){for(var _0x3a8a17=0x0,_0x2a1dbe=events[_0xcaee('0x5')];_0x3a8a17<_0x2a1dbe;_0x3a8a17++){var _0x552d20=events[_0x3a8a17];var _0x1963dc=createListener(_0xcaee('0x6')+_0x552d20,_0x1be0d0);CmListEvents['on'](_0x552d20,_0x1963dc);}}; \ No newline at end of file +var _0x32b6=['remove','emit','removeListener','length','cmList:','./cmList.events','save'];(function(_0x297b5f,_0x2c2d5e){var _0xbdf50e=function(_0x15d71c){while(--_0x15d71c){_0x297b5f['push'](_0x297b5f['shift']());}};_0xbdf50e(++_0x2c2d5e);}(_0x32b6,0x10f));var _0x632b=function(_0x4e5936,_0x235168){_0x4e5936=_0x4e5936-0x0;var _0x44448c=_0x32b6[_0x4e5936];return _0x44448c;};'use strict';var CmListEvents=require(_0x632b('0x0'));var events=[_0x632b('0x1'),_0x632b('0x2'),'update'];function createListener(_0x18aa39,_0x103eac){return function(_0x58adb3){_0x103eac[_0x632b('0x3')](_0x18aa39,_0x58adb3);};}function removeListener(_0x537628,_0x174696){return function(){CmListEvents[_0x632b('0x4')](_0x537628,_0x174696);};}exports['register']=function(_0x2e6d3f){for(var _0x2c07f3=0x0,_0xc7a3e=events[_0x632b('0x5')];_0x2c07f3<_0xc7a3e;_0x2c07f3++){var _0xdcde8d=events[_0x2c07f3];var _0x7b6ab1=createListener(_0x632b('0x6')+_0xdcde8d,_0x2e6d3f);CmListEvents['on'](_0xdcde8d,_0x7b6ab1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index af6b059..3dc4c4a 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 _0xa2d4=['./cmList.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','delete','removeDispositions','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x40eec9,_0x817a67){var _0xfee890=function(_0x186640){while(--_0x186640){_0x40eec9['push'](_0x40eec9['shift']());}};_0xfee890(++_0x817a67);}(_0xa2d4,0x110));var _0x4a2d=function(_0x3f4d92,_0x3cf948){_0x3f4d92=_0x3f4d92-0x0;var _0x2c6f2b=_0xa2d4[_0x3f4d92];return _0x2c6f2b;};'use strict';var multer=require(_0x4a2d('0x0'));var util=require(_0x4a2d('0x1'));var path=require('path');var timeout=require(_0x4a2d('0x2'));var express=require(_0x4a2d('0x3'));var router=express[_0x4a2d('0x4')]();var fs_extra=require(_0x4a2d('0x5'));var auth=require(_0x4a2d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4a2d('0x7'));var controller=require(_0x4a2d('0x8'));router[_0x4a2d('0x9')]('/',auth[_0x4a2d('0xa')](),controller[_0x4a2d('0xb')]);router[_0x4a2d('0x9')](_0x4a2d('0xc'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0xd')]);router['get']('/:id',auth[_0x4a2d('0xa')](),controller[_0x4a2d('0xe')]);router[_0x4a2d('0x9')](_0x4a2d('0xf'),auth[_0x4a2d('0xa')](),controller['getDispositions']);router[_0x4a2d('0x9')](_0x4a2d('0x10'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0x11')]);router[_0x4a2d('0x9')](_0x4a2d('0x12'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0x13')]);router[_0x4a2d('0x9')](_0x4a2d('0x14'),auth[_0x4a2d('0xa')](),controller['getCustomFields']);router[_0x4a2d('0x9')](_0x4a2d('0x15'),auth['isAuthenticated'](),controller[_0x4a2d('0x16')]);router[_0x4a2d('0x17')]('/',auth[_0x4a2d('0xa')](),controller[_0x4a2d('0x18')]);router[_0x4a2d('0x17')](_0x4a2d('0xf'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0x19')]);router['post'](_0x4a2d('0x10'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0x1a')]);router['post'](_0x4a2d('0x14'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0x1b')]);router[_0x4a2d('0x17')]('/:id/users',auth[_0x4a2d('0xa')](),controller[_0x4a2d('0x1c')]);router[_0x4a2d('0x1d')](_0x4a2d('0x1e'),auth['isAuthenticated'](),controller[_0x4a2d('0x1f')]);router['delete'](_0x4a2d('0x1e'),auth[_0x4a2d('0xa')](),controller['destroy']);router[_0x4a2d('0x20')](_0x4a2d('0xf'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0x21')]);router[_0x4a2d('0x20')](_0x4a2d('0x15'),auth[_0x4a2d('0xa')](),controller['removeAgents']);module[_0x4a2d('0x22')]=router; \ No newline at end of file +var _0x9e29=['express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post','addDisposition','addCustomField','addAgents','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x247fe8,_0x482226){var _0x2285eb=function(_0x242c87){while(--_0x242c87){_0x247fe8['push'](_0x247fe8['shift']());}};_0x2285eb(++_0x482226);}(_0x9e29,0xf4));var _0x99e2=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x9e29[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0x99e2('0x0'));var util=require(_0x99e2('0x1'));var path=require(_0x99e2('0x2'));var timeout=require(_0x99e2('0x3'));var express=require(_0x99e2('0x4'));var router=express[_0x99e2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x99e2('0x6'));var config=require(_0x99e2('0x7'));var controller=require(_0x99e2('0x8'));router[_0x99e2('0x9')]('/',auth[_0x99e2('0xa')](),controller[_0x99e2('0xb')]);router[_0x99e2('0x9')](_0x99e2('0xc'),auth[_0x99e2('0xa')](),controller[_0x99e2('0xd')]);router[_0x99e2('0x9')](_0x99e2('0xe'),auth[_0x99e2('0xa')](),controller[_0x99e2('0xf')]);router[_0x99e2('0x9')](_0x99e2('0x10'),auth['isAuthenticated'](),controller[_0x99e2('0x11')]);router[_0x99e2('0x9')](_0x99e2('0x12'),auth['isAuthenticated'](),controller['getContacts']);router[_0x99e2('0x9')](_0x99e2('0x13'),auth[_0x99e2('0xa')](),controller[_0x99e2('0x14')]);router[_0x99e2('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x99e2('0x15')]);router[_0x99e2('0x9')](_0x99e2('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x99e2('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x99e2('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x99e2('0x18')]);router[_0x99e2('0x17')](_0x99e2('0x12'),auth[_0x99e2('0xa')](),controller['addContacts']);router[_0x99e2('0x17')]('/:id/fields',auth[_0x99e2('0xa')](),controller[_0x99e2('0x19')]);router[_0x99e2('0x17')](_0x99e2('0x16'),auth[_0x99e2('0xa')](),controller[_0x99e2('0x1a')]);router[_0x99e2('0x1b')](_0x99e2('0xe'),auth[_0x99e2('0xa')](),controller[_0x99e2('0x1c')]);router[_0x99e2('0x1d')](_0x99e2('0xe'),auth[_0x99e2('0xa')](),controller['destroy']);router[_0x99e2('0x1d')](_0x99e2('0x10'),auth[_0x99e2('0xa')](),controller['removeDispositions']);router[_0x99e2('0x1d')](_0x99e2('0x16'),auth[_0x99e2('0xa')](),controller['removeAgents']);module[_0x99e2('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4d6b5c9..848c70d 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 _0x7e8a=['field','STRING','sequelize','exports','getDataValue'];(function(_0x46d16d,_0x276ed4){var _0x2dd3a7=function(_0x303fc8){while(--_0x303fc8){_0x46d16d['push'](_0x46d16d['shift']());}};_0x2dd3a7(++_0x276ed4);}(_0x7e8a,0x89));var _0xa7e8=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7e8a[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0xa7e8('0x0'));module[_0xa7e8('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4514a4){return this[_0xa7e8('0x2')](_0xa7e8('0x3'));}},'field':{'type':Sequelize[_0xa7e8('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x219f=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x1b0f73,_0x562ee4){var _0x13e0e1=function(_0x1151e1){while(--_0x1151e1){_0x1b0f73['push'](_0x1b0f73['shift']());}};_0x13e0e1(++_0x562ee4);}(_0x219f,0xc2));var _0xf219=function(_0xfb0087,_0x148b31){_0xfb0087=_0xfb0087-0x0;var _0x22fd7a=_0x219f[_0xfb0087];return _0x22fd7a;};'use strict';var Sequelize=require(_0xf219('0x0'));module[_0xf219('0x1')]={'name':{'type':Sequelize[_0xf219('0x2')],'get':function(_0x555760){return this['getDataValue'](_0xf219('0x3'));}},'field':{'type':Sequelize[_0xf219('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xf219('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xf219('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 433869c..cb50f05 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1977bc,_0x3d0f51){var _0x54ce01=function(_0x497550){while(--_0x497550){_0x1977bc['push'](_0x1977bc['shift']());}};_0x54ce01(++_0x3d0f51);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x58b9fd,_0x353100){var _0x4dad91=function(_0x593929){while(--_0x593929){_0x58b9fd['push'](_0x58b9fd['shift']());}};_0x4dad91(++_0x353100);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 acc4a9f..a63074e 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 _0x7c27=['bluebird','request-promise','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','moment'];(function(_0xb3afd9,_0x4f7ef6){var _0x18dea6=function(_0x4f3a31){while(--_0x4f3a31){_0xb3afd9['push'](_0xb3afd9['shift']());}};_0x18dea6(++_0x4f7ef6);}(_0x7c27,0x98));var _0x77c2=function(_0x55922b,_0x3e3916){_0x55922b=_0x55922b-0x0;var _0x1dba37=_0x7c27[_0x55922b];return _0x1dba37;};'use strict';var _=require(_0x77c2('0x0'));var util=require(_0x77c2('0x1'));var logger=require(_0x77c2('0x2'))('api');var moment=require(_0x77c2('0x3'));var BPromise=require(_0x77c2('0x4'));var rp=require(_0x77c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77c2('0x6'));var config=require('../../config/environment');var attributes=require(_0x77c2('0x7'));module[_0x77c2('0x8')]=function(_0x36fccc,_0x9717d4){return _0x36fccc[_0x77c2('0x9')](_0x77c2('0xa'),attributes,{'tableName':_0x77c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd63c=['rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x43b616,_0xb842c){var _0xc188db=function(_0x2faaf5){while(--_0x2faaf5){_0x43b616['push'](_0x43b616['shift']());}};_0xc188db(++_0xb842c);}(_0xd63c,0x13e));var _0xcd63=function(_0x182f0f,_0xfd5bb7){_0x182f0f=_0x182f0f-0x0;var _0xb571cf=_0xd63c[_0x182f0f];return _0xb571cf;};'use strict';var _=require(_0xcd63('0x0'));var util=require(_0xcd63('0x1'));var logger=require(_0xcd63('0x2'))(_0xcd63('0x3'));var moment=require(_0xcd63('0x4'));var BPromise=require('bluebird');var rp=require(_0xcd63('0x5'));var fs=require('fs');var path=require(_0xcd63('0x6'));var rimraf=require(_0xcd63('0x7'));var config=require(_0xcd63('0x8'));var attributes=require(_0xcd63('0x9'));module['exports']=function(_0x4f85c5,_0x211b84){return _0x4f85c5[_0xcd63('0xa')](_0xcd63('0xb'),attributes,{'tableName':_0xcd63('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 8010496..a73e18c 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 _0x1099=['client','http','request','then','info','Condition,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1099,0x183));var _0x9109=function(_0x21dcb4,_0x5641de){_0x21dcb4=_0x21dcb4-0x0;var _0x319088=_0x1099[_0x21dcb4];return _0x319088;};'use strict';var _=require('lodash');var util=require(_0x9109('0x0'));var moment=require(_0x9109('0x1'));var BPromise=require(_0x9109('0x2'));var rs=require(_0x9109('0x3'));var fs=require('fs');var Redis=require(_0x9109('0x4'));var db=require(_0x9109('0x5'))['db'];var utils=require(_0x9109('0x6'));var logger=require(_0x9109('0x7'))(_0x9109('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9109('0x9')][_0x9109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12f967,_0x1c59c3,_0x3e5947){return new BPromise(function(_0x49dcd4,_0x4fde0e){return client[_0x9109('0xb')](_0x12f967,_0x3e5947)[_0x9109('0xc')](function(_0x1052e3){logger[_0x9109('0xd')](_0x9109('0xe'),_0x1c59c3,'request\x20sent');logger[_0x9109('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x1c59c3,'request\x20sent',JSON[_0x9109('0x10')](_0x1052e3));if(_0x1052e3[_0x9109('0x11')]){if(_0x1052e3[_0x9109('0x11')][_0x9109('0x12')]===0x1f4){logger[_0x9109('0x11')](_0x9109('0xe'),_0x1c59c3,_0x1052e3[_0x9109('0x11')]['message']);return _0x4fde0e(_0x1052e3[_0x9109('0x11')][_0x9109('0x13')]);}logger[_0x9109('0x11')]('Condition,\x20%s,\x20%s',_0x1c59c3,_0x1052e3[_0x9109('0x11')][_0x9109('0x13')]);return _0x49dcd4(_0x1052e3[_0x9109('0x11')][_0x9109('0x13')]);}else{logger[_0x9109('0xd')](_0x9109('0xe'),_0x1c59c3,'request\x20sent');_0x49dcd4(_0x1052e3[_0x9109('0x14')][_0x9109('0x13')]);}})[_0x9109('0x15')](function(_0x467f1e){logger[_0x9109('0x11')](_0x9109('0xe'),_0x1c59c3,_0x467f1e);_0x4fde0e(_0x467f1e);});});} \ No newline at end of file +var _0xb71a=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x3948d6,_0x193434){var _0x5da084=function(_0x2fd552){while(--_0x2fd552){_0x3948d6['push'](_0x3948d6['shift']());}};_0x5da084(++_0x193434);}(_0xb71a,0x18d));var _0xab71=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb71a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xab71('0x0'));var util=require('util');var moment=require(_0xab71('0x1'));var BPromise=require(_0xab71('0x2'));var rs=require(_0xab71('0x3'));var fs=require('fs');var Redis=require(_0xab71('0x4'));var db=require(_0xab71('0x5'))['db'];var utils=require(_0xab71('0x6'));var logger=require(_0xab71('0x7'))(_0xab71('0x8'));var config=require('../../config/environment');var jayson=require(_0xab71('0x9'));var client=jayson[_0xab71('0xa')][_0xab71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x565976,_0x450451,_0x12a50e){return new BPromise(function(_0x334809,_0x7bc04b){return client[_0xab71('0xc')](_0x565976,_0x12a50e)[_0xab71('0xd')](function(_0x5978d2){logger[_0xab71('0xe')](_0xab71('0xf'),_0x450451,_0xab71('0x10'));logger['debug'](_0xab71('0x11'),_0x450451,_0xab71('0x10'),JSON[_0xab71('0x12')](_0x5978d2));if(_0x5978d2['error']){if(_0x5978d2[_0xab71('0x13')][_0xab71('0x14')]===0x1f4){logger[_0xab71('0x13')]('Condition,\x20%s,\x20%s',_0x450451,_0x5978d2[_0xab71('0x13')][_0xab71('0x15')]);return _0x7bc04b(_0x5978d2[_0xab71('0x13')][_0xab71('0x15')]);}logger['error']('Condition,\x20%s,\x20%s',_0x450451,_0x5978d2[_0xab71('0x13')][_0xab71('0x15')]);return _0x334809(_0x5978d2[_0xab71('0x13')][_0xab71('0x15')]);}else{logger['info'](_0xab71('0xf'),_0x450451,_0xab71('0x10'));_0x334809(_0x5978d2['result']['message']);}})[_0xab71('0x16')](function(_0x1c0f74){logger[_0xab71('0x13')](_0xab71('0xf'),_0x450451,_0x1c0f74);_0x7bc04b(_0x1c0f74);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 4776b4d..bc8b41b 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 _0x7ce7=['/:id','update','delete','isAuthenticated','util','Router','fs-extra','../../components/interaction/service','../../config/environment','put'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x7ce7,0x180));var _0x77ce=function(_0x1307d5,_0x25b6c8){_0x1307d5=_0x1307d5-0x0;var _0x4d9f1a=_0x7ce7[_0x1307d5];return _0x4d9f1a;};'use strict';var multer=require('multer');var util=require(_0x77ce('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77ce('0x1')]();var fs_extra=require(_0x77ce('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x77ce('0x3'));var config=require(_0x77ce('0x4'));var controller=require('./condition.controller');router[_0x77ce('0x5')](_0x77ce('0x6'),auth['isAuthenticated'](),controller[_0x77ce('0x7')]);router[_0x77ce('0x8')](_0x77ce('0x6'),auth[_0x77ce('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x95c1=['put','/:id','update','delete','isAuthenticated','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x95c1,0xd8));var _0x195c=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x95c1[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0x195c('0x0'));var util=require(_0x195c('0x1'));var path=require(_0x195c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x195c('0x3'));var auth=require(_0x195c('0x4'));var interaction=require(_0x195c('0x5'));var config=require(_0x195c('0x6'));var controller=require(_0x195c('0x7'));router[_0x195c('0x8')](_0x195c('0x9'),auth['isAuthenticated'](),controller[_0x195c('0xa')]);router[_0x195c('0xb')]('/:id',auth[_0x195c('0xc')](),controller[_0x195c('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c9d170c..5f9f99c 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 _0x0713=['STRING','name'];(function(_0x19e89d,_0xa1ecf1){var _0x19433b=function(_0x596fd5){while(--_0x596fd5){_0x19e89d['push'](_0x19e89d['shift']());}};_0x19433b(++_0xa1ecf1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x2c2bde,_0x485853){var _0x1c7fb7=function(_0x23d83e){while(--_0x23d83e){_0x2c2bde['push'](_0x2c2bde['shift']());}};_0x1c7fb7(++_0x485853);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b6a4d4e..b17ab15 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 _0x717f=['moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./dashboard.socket','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','name','send','Dashboard','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x58ea44,_0x512f53){var _0x31eb1d=function(_0x243848){while(--_0x243848){_0x58ea44['push'](_0x58ea44['shift']());}};_0x31eb1d(++_0x512f53);}(_0x717f,0x72));var _0xf717=function(_0x1135d1,_0x181470){_0x1135d1=_0x1135d1-0x0;var _0x46fd49=_0x717f[_0x1135d1];return _0x46fd49;};'use strict';var emlformat=require(_0xf717('0x0'));var rimraf=require(_0xf717('0x1'));var zipdir=require(_0xf717('0x2'));var jsonpatch=require(_0xf717('0x3'));var rp=require(_0xf717('0x4'));var moment=require(_0xf717('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf717('0x6'));var util=require(_0xf717('0x7'));var path=require(_0xf717('0x8'));var sox=require('sox');var csv=require(_0xf717('0x9'));var ejs=require(_0xf717('0xa'));var fs=require('fs');var fs_extra=require(_0xf717('0xb'));var _=require(_0xf717('0xc'));var squel=require(_0xf717('0xd'));var crypto=require('crypto');var jsforce=require(_0xf717('0xe'));var deskjs=require(_0xf717('0xf'));var toCsv=require(_0xf717('0x9'));var querystring=require('querystring');var Papa=require(_0xf717('0x10'));var Redis=require(_0xf717('0x11'));var authService=require(_0xf717('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf717('0x13'));var logger=require('../../config/logger')(_0xf717('0x14'));var utils=require(_0xf717('0x15'));var config=require(_0xf717('0x16'));var licenseUtil=require(_0xf717('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xf717('0x18')],{'host':_0xf717('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf717('0x1a'))['register'](socket);function respondWithStatusCode(_0x12a8fc,_0x358c18){_0x358c18=_0x358c18||0xcc;return function(_0x43a5e2){if(_0x43a5e2){return _0x12a8fc[_0xf717('0x1b')](_0x358c18);}return _0x12a8fc[_0xf717('0x1c')](_0x358c18)[_0xf717('0x1d')]();};}function respondWithResult(_0x2b39db,_0x4b14bf){_0x4b14bf=_0x4b14bf||0xc8;return function(_0x43ddea){if(_0x43ddea){return _0x2b39db[_0xf717('0x1c')](_0x4b14bf)[_0xf717('0x1e')](_0x43ddea);}};}function respondWithFilteredResult(_0x5d566f,_0x44b8c8){return function(_0x516267){if(_0x516267){var _0xb7c694=typeof _0x44b8c8['offset']==='undefined'&&typeof _0x44b8c8[_0xf717('0x1f')]===_0xf717('0x20');var _0x39d98b=_0x516267[_0xf717('0x21')];var _0x31b698=_0xb7c694?0x0:_0x44b8c8[_0xf717('0x22')];var _0x437766=_0xb7c694?_0x516267[_0xf717('0x21')]:_0x44b8c8[_0xf717('0x22')]+_0x44b8c8[_0xf717('0x1f')];var _0x130340;if(_0x437766>=_0x39d98b){_0x437766=_0x39d98b;_0x130340=0xc8;}else{_0x130340=0xce;}_0x5d566f['status'](_0x130340);return _0x5d566f['set'](_0xf717('0x23'),_0x31b698+'-'+_0x437766+'/'+_0x39d98b)['json'](_0x516267);}return null;};}function patchUpdates(_0x3a9a86){return function(_0x3fb902){try{jsonpatch[_0xf717('0x24')](_0x3fb902,_0x3a9a86,!![]);}catch(_0x2034ef){return BPromise[_0xf717('0x25')](_0x2034ef);}return _0x3fb902['save']();};}function saveUpdates(_0x597a3b,_0x1e73b8){return function(_0x37a8c9){if(_0x37a8c9){return _0x37a8c9[_0xf717('0x26')](_0x597a3b)['then'](function(_0x182d0b){return _0x182d0b;});}return null;};}function removeEntity(_0x178601,_0xa5ee6f){return function(_0x2506b3){if(_0x2506b3){return _0x2506b3[_0xf717('0x27')]()[_0xf717('0x28')](function(){var _0x32d732=_0x2506b3[_0xf717('0x29')]({'plain':!![]});var _0xbe90a1='CustomDashboards';return db[_0xf717('0x2a')]['destroy']({'where':{'type':_0xbe90a1,'resourceId':_0x32d732['id']}})[_0xf717('0x28')](function(){return _0x2506b3;});})[_0xf717('0x28')](function(){_0x178601[_0xf717('0x1c')](0xcc)[_0xf717('0x1d')]();});}};}function handleEntityNotFound(_0x3aae5e,_0x1bedab){return function(_0x5564c5){if(!_0x5564c5){_0x3aae5e['sendStatus'](0x194);}return _0x5564c5;};}function handleError(_0xf06710,_0x466a06){_0x466a06=_0x466a06||0x1f4;return function(_0x469743){logger['error'](_0x469743['stack']);if(_0x469743[_0xf717('0x2b')]){delete _0x469743[_0xf717('0x2b')];}_0xf06710[_0xf717('0x1c')](_0x466a06)[_0xf717('0x2c')](_0x469743);};}exports['index']=function(_0x4fba86,_0x214806){var _0x4690d0={},_0x32bf3d={},_0x5aaba6={'count':0x0,'rows':[]};var _0x2a6ba8=_['map'](db[_0xf717('0x2d')]['rawAttributes'],function(_0x57bd97){return{'name':_0x57bd97['fieldName'],'type':_0x57bd97[_0xf717('0x2e')][_0xf717('0x2f')]};});_0x32bf3d[_0xf717('0x30')]=_['map'](_0x2a6ba8,_0xf717('0x2b'));_0x32bf3d['query']=_[_0xf717('0x31')](_0x4fba86['query']);_0x32bf3d[_0xf717('0x32')]=_[_0xf717('0x33')](_0x32bf3d[_0xf717('0x30')],_0x32bf3d[_0xf717('0x34')]);_0x4690d0[_0xf717('0x35')]=_[_0xf717('0x33')](_0x32bf3d[_0xf717('0x30')],qs['fields'](_0x4fba86[_0xf717('0x34')][_0xf717('0x36')]));_0x4690d0[_0xf717('0x35')]=_0x4690d0[_0xf717('0x35')][_0xf717('0x37')]?_0x4690d0[_0xf717('0x35')]:_0x32bf3d[_0xf717('0x30')];if(!_0x4fba86[_0xf717('0x34')]['hasOwnProperty'](_0xf717('0x38'))){_0x4690d0[_0xf717('0x1f')]=qs['limit'](_0x4fba86[_0xf717('0x34')][_0xf717('0x1f')]);_0x4690d0['offset']=qs['offset'](_0x4fba86[_0xf717('0x34')][_0xf717('0x22')]);}_0x4690d0[_0xf717('0x39')]=qs[_0xf717('0x3a')](_0x4fba86[_0xf717('0x34')][_0xf717('0x3a')]);_0x4690d0['where']=qs[_0xf717('0x32')](_[_0xf717('0x3b')](_0x4fba86[_0xf717('0x34')],_0x32bf3d[_0xf717('0x32')]),_0x2a6ba8);if(_0x4fba86[_0xf717('0x34')][_0xf717('0x3c')]){_0x4690d0[_0xf717('0x3d')]=_[_0xf717('0x3e')](_0x4690d0[_0xf717('0x3d')],{'$or':_[_0xf717('0x3f')](_0x2a6ba8,function(_0x57c0cf){if(_0x57c0cf[_0xf717('0x2e')]!==_0xf717('0x40')){var _0x5e8913={};_0x5e8913[_0x57c0cf[_0xf717('0x2b')]]={'$like':'%'+_0x4fba86[_0xf717('0x34')][_0xf717('0x3c')]+'%'};return _0x5e8913;}})});}_0x4690d0=_[_0xf717('0x3e')]({},_0x4690d0,_0x4fba86[_0xf717('0x41')]);var _0x581023={'where':_0x4690d0[_0xf717('0x3d')]};return db[_0xf717('0x2d')][_0xf717('0x21')](_0x581023)[_0xf717('0x28')](function(_0x38edb8){_0x5aaba6[_0xf717('0x21')]=_0x38edb8;if(_0x4fba86[_0xf717('0x34')]['includeAll']){_0x4690d0['include']=[{'all':!![]}];}return db['Dashboard'][_0xf717('0x42')](_0x4690d0);})['then'](function(_0x5c4174){_0x5aaba6[_0xf717('0x43')]=_0x5c4174;return _0x5aaba6;})[_0xf717('0x28')](respondWithFilteredResult(_0x214806,_0x4690d0))[_0xf717('0x44')](handleError(_0x214806,null));};exports[_0xf717('0x45')]=function(_0x16a68e,_0x50b39a){var _0x16c89f={'raw':![],'where':{'id':_0x16a68e[_0xf717('0x46')]['id']}},_0x519f78={};_0x519f78[_0xf717('0x30')]=_['keys'](db[_0xf717('0x2d')][_0xf717('0x47')]);_0x519f78['query']=_[_0xf717('0x31')](_0x16a68e[_0xf717('0x34')]);_0x519f78[_0xf717('0x32')]=_[_0xf717('0x33')](_0x519f78[_0xf717('0x30')],_0x519f78['query']);_0x16c89f[_0xf717('0x35')]=_[_0xf717('0x33')](_0x519f78[_0xf717('0x30')],qs[_0xf717('0x36')](_0x16a68e[_0xf717('0x34')][_0xf717('0x36')]));_0x16c89f[_0xf717('0x35')]=_0x16c89f[_0xf717('0x35')]['length']?_0x16c89f['attributes']:_0x519f78[_0xf717('0x30')];if(_0x16a68e[_0xf717('0x34')][_0xf717('0x48')]){_0x16c89f[_0xf717('0x49')]=[{'all':!![]}];}_0x16c89f=_[_0xf717('0x3e')]({},_0x16c89f,_0x16a68e[_0xf717('0x41')]);return db[_0xf717('0x2d')][_0xf717('0x4a')](_0x16c89f)[_0xf717('0x28')](handleEntityNotFound(_0x50b39a,null))[_0xf717('0x28')](respondWithResult(_0x50b39a,null))[_0xf717('0x44')](handleError(_0x50b39a,null));};exports[_0xf717('0x4b')]=function(_0x49a161,_0x2a38e5){return db[_0xf717('0x2d')][_0xf717('0x4b')](_0x49a161['body'],{})[_0xf717('0x28')](function(_0x2a4043){var _0x1223a1=_0x49a161[_0xf717('0x4c')][_0xf717('0x29')]({'plain':!![]});if(!_0x1223a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1223a1['role']===_0xf717('0x4c')){var _0x2d1de5=_0x2a4043[_0xf717('0x29')]({'plain':!![]});var _0x27d9e0=_0xf717('0x4d');return db[_0xf717('0x4e')][_0xf717('0x4a')]({'where':{'name':_0x27d9e0,'userProfileId':_0x1223a1[_0xf717('0x4f')]},'raw':!![]})['then'](function(_0x4b0c0c){if(_0x4b0c0c&&_0x4b0c0c[_0xf717('0x50')]===0x0){return db[_0xf717('0x2a')]['create']({'name':_0x2d1de5[_0xf717('0x2b')],'resourceId':_0x2d1de5['id'],'type':_0x4b0c0c[_0xf717('0x2b')],'sectionId':_0x4b0c0c['id']},{})[_0xf717('0x28')](function(){return _0x2a4043;});}else{return _0x2a4043;}})['catch'](function(_0xc45f34){logger[_0xf717('0x51')](_0xf717('0x52'),_0xc45f34);throw _0xc45f34;});}return _0x2a4043;})[_0xf717('0x28')](respondWithResult(_0x2a38e5,0xc9))[_0xf717('0x44')](handleError(_0x2a38e5,null));};exports['clone']=function(_0x1f5666,_0x579c6a){var _0x68d830={'where':{'id':_0x1f5666[_0xf717('0x46')]['id']}},_0x194216={};_0x194216[_0xf717('0x30')]=_[_0xf717('0x31')](db[_0xf717('0x2d')][_0xf717('0x47')]);_0x68d830[_0xf717('0x35')]=_[_0xf717('0x33')](_0x194216[_0xf717('0x30')],qs[_0xf717('0x36')](_0x1f5666[_0xf717('0x34')][_0xf717('0x36')]));_0x68d830[_0xf717('0x35')]=_0x68d830[_0xf717('0x35')][_0xf717('0x37')]?_0x68d830['attributes']:_0x194216['model'];if(_0x1f5666[_0xf717('0x34')]['includeAll']){_0x68d830[_0xf717('0x49')]=[{'all':!![]}];}_0x68d830=_[_0xf717('0x3e')]({},_0x68d830,_0x1f5666[_0xf717('0x41')]);return db[_0xf717('0x2d')][_0xf717('0x4a')](_0x68d830)['then'](handleEntityNotFound(_0x579c6a,null))[_0xf717('0x28')](function(_0x8a3af0){if(_0x8a3af0){var _0x32b01a=_0x8a3af0['get']({'plain':!![]});_0x32b01a=qs['omit'](_0x32b01a,['id',_0xf717('0x53'),_0xf717('0x54')]);_0x1f5666[_0xf717('0x55')]=_[_0xf717('0x56')](_0x1f5666[_0xf717('0x55')],['id',_0xf717('0x53'),'updatedAt']);return db[_0xf717('0x2d')][_0xf717('0x4b')](_['merge'](_0x32b01a,_0x1f5666['body']),{'include':_0x1f5666['query'][_0xf717('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x41d34e){var _0x17ed20=_0x1f5666['user']['get']({'plain':!![]});if(!_0x17ed20)throw new Error(_0xf717('0x57'));if(_0x17ed20[_0xf717('0x58')]===_0xf717('0x4c')){var _0x2e7d38=_0x41d34e[_0xf717('0x29')]({'plain':!![]});var _0x5c8de1='CustomDashboards';return db[_0xf717('0x4e')][_0xf717('0x4a')]({'where':{'name':_0x5c8de1,'userProfileId':_0x17ed20[_0xf717('0x4f')]},'raw':!![]})[_0xf717('0x28')](function(_0x53f974){if(_0x53f974&&_0x53f974[_0xf717('0x50')]===0x0){return db['UserProfileResource'][_0xf717('0x4b')]({'name':_0x2e7d38[_0xf717('0x2b')],'resourceId':_0x2e7d38['id'],'type':_0x53f974['name'],'sectionId':_0x53f974['id']},{})['then'](function(){return _0x41d34e;});}else{return _0x41d34e;}})['catch'](function(_0x5e993a){logger[_0xf717('0x51')](_0xf717('0x52'),_0x5e993a);throw _0x5e993a;});}return _0x41d34e;});}})[_0xf717('0x28')](respondWithResult(_0x579c6a,0xc9))[_0xf717('0x44')](handleError(_0x579c6a,null));};exports[_0xf717('0x26')]=function(_0x27f898,_0x39d51c){if(_0x27f898[_0xf717('0x55')]['id']){delete _0x27f898['body']['id'];}return db[_0xf717('0x2d')]['find']({'where':{'id':_0x27f898['params']['id']}})[_0xf717('0x28')](handleEntityNotFound(_0x39d51c,null))['then'](saveUpdates(_0x27f898[_0xf717('0x55')],null))['then'](respondWithResult(_0x39d51c,null))[_0xf717('0x44')](handleError(_0x39d51c,null));};exports[_0xf717('0x27')]=function(_0x1b93c9,_0x5e62b8){return db[_0xf717('0x2d')][_0xf717('0x4a')]({'where':{'id':_0x1b93c9[_0xf717('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e62b8,null))[_0xf717('0x28')](removeEntity(_0x5e62b8,null))[_0xf717('0x44')](handleError(_0x5e62b8,null));};function widgetAttributes(_0x4ef4be){try{switch(_0x4ef4be[_0xf717('0x2e')]){case _0xf717('0x59'):return[{'name':_0xf717('0x5a'),'value':_0x4ef4be[_0xf717('0x5a')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x0]?_0x4ef4be[_0xf717('0x5b')][0x0][_0xf717('0x5c')]:undefined)||_0xf717('0x5d')}];case'custom':return[{'name':_0xf717('0x5e'),'value':_0x4ef4be[_0xf717('0x5e')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x0]?_0x4ef4be['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xf717('0x5f'),'value':_0x4ef4be[_0xf717('0x5f')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x0]?_0x4ef4be[_0xf717('0x5b')][0x0][_0xf717('0x5c')]:undefined)||_0xf717('0x60')},{'name':_0xf717('0x61'),'value':_0x4ef4be[_0xf717('0x61')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x1]?_0x4ef4be[_0xf717('0x5b')][0x1][_0xf717('0x5c')]:undefined)||_0xf717('0x62')},{'name':_0xf717('0x63'),'value':_0x4ef4be[_0xf717('0x63')]||(_0x4ef4be['attrs']&&_0x4ef4be[_0xf717('0x5b')][0x2]?_0x4ef4be[_0xf717('0x5b')][0x2][_0xf717('0x5c')]:undefined)||0xc}];case _0xf717('0x64'):return[{'name':_0xf717('0x65'),'value':_0x4ef4be[_0xf717('0x65')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x0]?_0x4ef4be['attrs'][0x0][_0xf717('0x5c')]:undefined)||_0xf717('0x66')},{'name':_0xf717('0x67'),'value':_0x4ef4be[_0xf717('0x67')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x1]?_0x4ef4be[_0xf717('0x5b')][0x1][_0xf717('0x5c')]:undefined)||[]},{'name':_0xf717('0x63'),'value':_0x4ef4be['attrFontSize']||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x2]?_0x4ef4be[_0xf717('0x5b')][0x2][_0xf717('0x5c')]:undefined)||0x14}];case _0xf717('0x68'):case'pie-chart':return[{'name':_0xf717('0x69'),'value':_0x4ef4be['attrSerie1']||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x0]?_0x4ef4be['attrs'][0x0][_0xf717('0x5c')]:undefined)||_0xf717('0x66')},{'name':_0xf717('0x6a'),'value':_0x4ef4be[_0xf717('0x6a')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x1]?_0x4ef4be[_0xf717('0x5b')][0x1]['value']:undefined)||null},{'name':_0xf717('0x6b'),'value':_0x4ef4be['attrSerie3']||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x2]?_0x4ef4be[_0xf717('0x5b')][0x2][_0xf717('0x5c')]:undefined)||null},{'name':_0xf717('0x67'),'value':_0x4ef4be['attrVoiceQueues']||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x3]?_0x4ef4be['attrs'][0x3][_0xf717('0x5c')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x4ef4be[_0xf717('0x6c')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x0]?_0x4ef4be[_0xf717('0x5b')][0x0][_0xf717('0x2e')]:undefined)||null,'value':_0x4ef4be[_0xf717('0x6d')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x0]?_0x4ef4be['attrs'][0x0][_0xf717('0x5c')]:undefined)||null},{'name':_0xf717('0x6e'),'value':_0x4ef4be[_0xf717('0x6e')]||(_0x4ef4be[_0xf717('0x5b')]&&_0x4ef4be[_0xf717('0x5b')][0x1]?_0x4ef4be['attrs'][0x1][_0xf717('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x534c4d){logger[_0xf717('0x51')](_0xf717('0x6f'),JSON[_0xf717('0x70')](_0x534c4d));return[];}}exports[_0xf717('0x71')]=function(_0x402664,_0x1eede7,_0x5e925b){if(_0x402664['body']['id']){delete _0x402664[_0xf717('0x55')]['id'];}return db['Dashboard'][_0xf717('0x4a')]({'where':{'id':_0x402664['params']['id']}})[_0xf717('0x28')](handleEntityNotFound(_0x1eede7,null))[_0xf717('0x28')](function(_0x2ce599){if(_0x2ce599){_0x402664['body'][_0xf717('0x72')]=_0x2ce599['id'];_0x402664[_0xf717('0x55')][_0xf717('0x5b')]=widgetAttributes(_0x402664[_0xf717('0x55')]);return db[_0xf717('0x73')][_0xf717('0x4b')](_0x402664[_0xf717('0x55')]);}})[_0xf717('0x28')](respondWithResult(_0x1eede7,null))['catch'](handleError(_0x1eede7,null));};exports[_0xf717('0x74')]=function(_0x257d7c,_0x573cab,_0x24ba26){var _0x9a6227={};var _0x423a2c={};var _0x296d2e;var _0x5bc5e4;return db['Dashboard'][_0xf717('0x75')]({'where':{'id':_0x257d7c[_0xf717('0x46')]['id']}})[_0xf717('0x28')](handleEntityNotFound(_0x573cab,null))[_0xf717('0x28')](function(_0x56dcd3){if(_0x56dcd3){_0x296d2e=_0x56dcd3;_0x423a2c[_0xf717('0x30')]=_[_0xf717('0x31')](db[_0xf717('0x73')][_0xf717('0x47')]);_0x423a2c[_0xf717('0x34')]=_[_0xf717('0x31')](_0x257d7c['query']);_0x423a2c[_0xf717('0x32')]=_['intersection'](_0x423a2c[_0xf717('0x30')],_0x423a2c[_0xf717('0x34')]);_0x9a6227[_0xf717('0x35')]=_[_0xf717('0x33')](_0x423a2c[_0xf717('0x30')],qs[_0xf717('0x36')](_0x257d7c[_0xf717('0x34')][_0xf717('0x36')]));_0x9a6227[_0xf717('0x35')]=_0x9a6227[_0xf717('0x35')][_0xf717('0x37')]?_0x9a6227[_0xf717('0x35')]:_0x423a2c[_0xf717('0x30')];_0x9a6227[_0xf717('0x39')]=qs[_0xf717('0x3a')](_0x257d7c['query'][_0xf717('0x3a')]);_0x9a6227[_0xf717('0x3d')]=qs['filters'](_[_0xf717('0x3b')](_0x257d7c[_0xf717('0x34')],_0x423a2c['filters']));if(_0x257d7c[_0xf717('0x34')]['filter']){_0x9a6227[_0xf717('0x3d')]=_[_0xf717('0x3e')](_0x9a6227[_0xf717('0x3d')],{'$or':_[_0xf717('0x3f')](_0x9a6227[_0xf717('0x35')],function(_0x2d5d3d){var _0x900007={};_0x900007[_0x2d5d3d]={'$like':'%'+_0x257d7c['query'][_0xf717('0x3c')]+'%'};return _0x900007;})});}_0x9a6227=_[_0xf717('0x3e')]({},_0x9a6227,_0x257d7c[_0xf717('0x41')]);return _0x296d2e[_0xf717('0x74')](_0x9a6227);}})[_0xf717('0x28')](function(_0x1f4d11){if(_0x1f4d11){_0x5bc5e4=_0x1f4d11[_0xf717('0x37')];if(!_0x257d7c[_0xf717('0x34')][_0xf717('0x76')](_0xf717('0x38'))){_0x9a6227[_0xf717('0x1f')]=qs[_0xf717('0x1f')](_0x257d7c['query'][_0xf717('0x1f')]);_0x9a6227[_0xf717('0x22')]=qs[_0xf717('0x22')](_0x257d7c[_0xf717('0x34')][_0xf717('0x22')]);}return _0x296d2e[_0xf717('0x74')](_0x9a6227);}})[_0xf717('0x28')](function(_0x19fa9b){if(_0x19fa9b){return _0x19fa9b?{'count':_0x5bc5e4,'rows':_0x19fa9b}:null;}})['then'](respondWithResult(_0x573cab,null))[_0xf717('0x44')](handleError(_0x573cab,null));}; \ No newline at end of file +var _0x199e=['save','then','destroy','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','fieldName','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','keys','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','role','userProfileId','update','params','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','rawAttributes','pick','nolimit','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject'];(function(_0x31f4d5,_0x4e1fd4){var _0x96555b=function(_0xf35362){while(--_0xf35362){_0x31f4d5['push'](_0x31f4d5['shift']());}};_0x96555b(++_0x4e1fd4);}(_0x199e,0xd8));var _0xe199=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x199e[_0x4aba15];return _0x1c8122;};'use strict';var emlformat=require(_0xe199('0x0'));var rimraf=require(_0xe199('0x1'));var zipdir=require(_0xe199('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe199('0x3'));var moment=require('moment');var BPromise=require(_0xe199('0x4'));var Mustache=require(_0xe199('0x5'));var util=require(_0xe199('0x6'));var path=require(_0xe199('0x7'));var sox=require(_0xe199('0x8'));var csv=require(_0xe199('0x9'));var ejs=require(_0xe199('0xa'));var fs=require('fs');var fs_extra=require(_0xe199('0xb'));var _=require(_0xe199('0xc'));var squel=require(_0xe199('0xd'));var crypto=require(_0xe199('0xe'));var jsforce=require(_0xe199('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe199('0x9'));var querystring=require(_0xe199('0x10'));var Papa=require('papaparse');var Redis=require(_0xe199('0x11'));var authService=require(_0xe199('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe199('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe199('0x14'));var config=require(_0xe199('0x15'));var licenseUtil=require(_0xe199('0x16'));var db=require(_0xe199('0x17'))['db'];config[_0xe199('0x18')]=_[_0xe199('0x19')](config['redis'],{'host':_0xe199('0x1a'),'port':0x18eb});var socket=require(_0xe199('0x1b'))(new Redis(config[_0xe199('0x18')]));require(_0xe199('0x1c'))[_0xe199('0x1d')](socket);function respondWithStatusCode(_0x45f3a2,_0x4dd30a){_0x4dd30a=_0x4dd30a||0xcc;return function(_0x12ab39){if(_0x12ab39){return _0x45f3a2[_0xe199('0x1e')](_0x4dd30a);}return _0x45f3a2[_0xe199('0x1f')](_0x4dd30a)[_0xe199('0x20')]();};}function respondWithResult(_0x5db980,_0x1d6f9e){_0x1d6f9e=_0x1d6f9e||0xc8;return function(_0x4212cb){if(_0x4212cb){return _0x5db980[_0xe199('0x1f')](_0x1d6f9e)[_0xe199('0x21')](_0x4212cb);}};}function respondWithFilteredResult(_0x54dd09,_0x461c2f){return function(_0x56303a){if(_0x56303a){var _0x29b0e8=typeof _0x461c2f['offset']===_0xe199('0x22')&&typeof _0x461c2f[_0xe199('0x23')]===_0xe199('0x22');var _0x1471e9=_0x56303a['count'];var _0x5121a4=_0x29b0e8?0x0:_0x461c2f[_0xe199('0x24')];var _0x27d267=_0x29b0e8?_0x56303a[_0xe199('0x25')]:_0x461c2f[_0xe199('0x24')]+_0x461c2f[_0xe199('0x23')];var _0xe83d4c;if(_0x27d267>=_0x1471e9){_0x27d267=_0x1471e9;_0xe83d4c=0xc8;}else{_0xe83d4c=0xce;}_0x54dd09[_0xe199('0x1f')](_0xe83d4c);return _0x54dd09[_0xe199('0x26')](_0xe199('0x27'),_0x5121a4+'-'+_0x27d267+'/'+_0x1471e9)['json'](_0x56303a);}return null;};}function patchUpdates(_0x3a5edd){return function(_0x4c7ac8){try{jsonpatch[_0xe199('0x28')](_0x4c7ac8,_0x3a5edd,!![]);}catch(_0x38b958){return BPromise[_0xe199('0x29')](_0x38b958);}return _0x4c7ac8[_0xe199('0x2a')]();};}function saveUpdates(_0x240903,_0x4ef281){return function(_0x14893d){if(_0x14893d){return _0x14893d['update'](_0x240903)[_0xe199('0x2b')](function(_0x4d59df){return _0x4d59df;});}return null;};}function removeEntity(_0x5b64ae,_0x11d4e8){return function(_0x2da0b2){if(_0x2da0b2){return _0x2da0b2[_0xe199('0x2c')]()[_0xe199('0x2b')](function(){var _0x345cee=_0x2da0b2['get']({'plain':!![]});var _0x5228e6=_0xe199('0x2d');return db[_0xe199('0x2e')][_0xe199('0x2c')]({'where':{'type':_0x5228e6,'resourceId':_0x345cee['id']}})['then'](function(){return _0x2da0b2;});})[_0xe199('0x2b')](function(){_0x5b64ae['status'](0xcc)[_0xe199('0x20')]();});}};}function handleEntityNotFound(_0x3cc452,_0x379a21){return function(_0x11c53e){if(!_0x11c53e){_0x3cc452['sendStatus'](0x194);}return _0x11c53e;};}function handleError(_0x2a3596,_0x3bd7b2){_0x3bd7b2=_0x3bd7b2||0x1f4;return function(_0x319c24){logger[_0xe199('0x2f')](_0x319c24[_0xe199('0x30')]);if(_0x319c24[_0xe199('0x31')]){delete _0x319c24[_0xe199('0x31')];}_0x2a3596[_0xe199('0x1f')](_0x3bd7b2)[_0xe199('0x32')](_0x319c24);};}exports[_0xe199('0x33')]=function(_0x55806d,_0x15f816){var _0x23be89={},_0x396c81={},_0x251c88={'count':0x0,'rows':[]};var _0x4e7477=_['map'](db[_0xe199('0x34')]['rawAttributes'],function(_0x31d3d1){return{'name':_0x31d3d1[_0xe199('0x35')],'type':_0x31d3d1['type'][_0xe199('0x36')]};});_0x396c81['model']=_[_0xe199('0x37')](_0x4e7477,_0xe199('0x31'));_0x396c81[_0xe199('0x38')]=_['keys'](_0x55806d[_0xe199('0x38')]);_0x396c81['filters']=_[_0xe199('0x39')](_0x396c81[_0xe199('0x3a')],_0x396c81['query']);_0x23be89['attributes']=_[_0xe199('0x39')](_0x396c81[_0xe199('0x3a')],qs[_0xe199('0x3b')](_0x55806d['query']['fields']));_0x23be89[_0xe199('0x3c')]=_0x23be89[_0xe199('0x3c')][_0xe199('0x3d')]?_0x23be89[_0xe199('0x3c')]:_0x396c81[_0xe199('0x3a')];if(!_0x55806d[_0xe199('0x38')][_0xe199('0x3e')]('nolimit')){_0x23be89[_0xe199('0x23')]=qs[_0xe199('0x23')](_0x55806d[_0xe199('0x38')][_0xe199('0x23')]);_0x23be89[_0xe199('0x24')]=qs[_0xe199('0x24')](_0x55806d[_0xe199('0x38')][_0xe199('0x24')]);}_0x23be89[_0xe199('0x3f')]=qs[_0xe199('0x40')](_0x55806d[_0xe199('0x38')]['sort']);_0x23be89[_0xe199('0x41')]=qs[_0xe199('0x42')](_['pick'](_0x55806d['query'],_0x396c81[_0xe199('0x42')]),_0x4e7477);if(_0x55806d['query'][_0xe199('0x43')]){_0x23be89['where']=_[_0xe199('0x44')](_0x23be89[_0xe199('0x41')],{'$or':_[_0xe199('0x37')](_0x4e7477,function(_0x57e18a){if(_0x57e18a[_0xe199('0x45')]!==_0xe199('0x46')){var _0x126907={};_0x126907[_0x57e18a[_0xe199('0x31')]]={'$like':'%'+_0x55806d[_0xe199('0x38')][_0xe199('0x43')]+'%'};return _0x126907;}})});}_0x23be89=_[_0xe199('0x44')]({},_0x23be89,_0x55806d['options']);var _0x61d3f4={'where':_0x23be89[_0xe199('0x41')]};return db[_0xe199('0x34')][_0xe199('0x25')](_0x61d3f4)[_0xe199('0x2b')](function(_0x381a0){_0x251c88[_0xe199('0x25')]=_0x381a0;if(_0x55806d[_0xe199('0x38')][_0xe199('0x47')]){_0x23be89[_0xe199('0x48')]=[{'all':!![]}];}return db[_0xe199('0x34')][_0xe199('0x49')](_0x23be89);})['then'](function(_0xa4840a){_0x251c88['rows']=_0xa4840a;return _0x251c88;})[_0xe199('0x2b')](respondWithFilteredResult(_0x15f816,_0x23be89))[_0xe199('0x4a')](handleError(_0x15f816,null));};exports[_0xe199('0x4b')]=function(_0x514f7c,_0x1218fb){var _0x18e59b={'raw':![],'where':{'id':_0x514f7c['params']['id']}},_0xdae242={};_0xdae242['model']=_[_0xe199('0x4c')](db['Dashboard']['rawAttributes']);_0xdae242[_0xe199('0x38')]=_[_0xe199('0x4c')](_0x514f7c[_0xe199('0x38')]);_0xdae242[_0xe199('0x42')]=_[_0xe199('0x39')](_0xdae242[_0xe199('0x3a')],_0xdae242['query']);_0x18e59b[_0xe199('0x3c')]=_['intersection'](_0xdae242[_0xe199('0x3a')],qs[_0xe199('0x3b')](_0x514f7c[_0xe199('0x38')]['fields']));_0x18e59b[_0xe199('0x3c')]=_0x18e59b[_0xe199('0x3c')][_0xe199('0x3d')]?_0x18e59b['attributes']:_0xdae242[_0xe199('0x3a')];if(_0x514f7c[_0xe199('0x38')]['includeAll']){_0x18e59b[_0xe199('0x48')]=[{'all':!![]}];}_0x18e59b=_[_0xe199('0x44')]({},_0x18e59b,_0x514f7c['options']);return db['Dashboard'][_0xe199('0x4d')](_0x18e59b)[_0xe199('0x2b')](handleEntityNotFound(_0x1218fb,null))[_0xe199('0x2b')](respondWithResult(_0x1218fb,null))[_0xe199('0x4a')](handleError(_0x1218fb,null));};exports['create']=function(_0x55a1e3,_0x23268f){return db[_0xe199('0x34')]['create'](_0x55a1e3[_0xe199('0x4e')],{})[_0xe199('0x2b')](function(_0x26ff51){var _0x140e4c=_0x55a1e3[_0xe199('0x4f')][_0xe199('0x50')]({'plain':!![]});if(!_0x140e4c)throw new Error(_0xe199('0x51'));if(_0x140e4c['role']===_0xe199('0x4f')){var _0x336e5c=_0x26ff51[_0xe199('0x50')]({'plain':!![]});var _0x5d7afa=_0xe199('0x2d');return db[_0xe199('0x52')]['find']({'where':{'name':_0x5d7afa,'userProfileId':_0x140e4c['userProfileId']},'raw':!![]})[_0xe199('0x2b')](function(_0x4d4c07){if(_0x4d4c07&&_0x4d4c07[_0xe199('0x53')]===0x0){return db[_0xe199('0x2e')][_0xe199('0x54')]({'name':_0x336e5c[_0xe199('0x31')],'resourceId':_0x336e5c['id'],'type':_0x4d4c07['name'],'sectionId':_0x4d4c07['id']},{})[_0xe199('0x2b')](function(){return _0x26ff51;});}else{return _0x26ff51;}})[_0xe199('0x4a')](function(_0x73b6f){logger[_0xe199('0x2f')](_0xe199('0x55'),_0x73b6f);throw _0x73b6f;});}return _0x26ff51;})[_0xe199('0x2b')](respondWithResult(_0x23268f,0xc9))[_0xe199('0x4a')](handleError(_0x23268f,null));};exports[_0xe199('0x56')]=function(_0x4128fe,_0x1634d1){var _0x483eae={'where':{'id':_0x4128fe['params']['id']}},_0x4e8178={};_0x4e8178['model']=_['keys'](db[_0xe199('0x34')]['rawAttributes']);_0x483eae[_0xe199('0x3c')]=_[_0xe199('0x39')](_0x4e8178[_0xe199('0x3a')],qs['fields'](_0x4128fe[_0xe199('0x38')][_0xe199('0x3b')]));_0x483eae[_0xe199('0x3c')]=_0x483eae['attributes'][_0xe199('0x3d')]?_0x483eae[_0xe199('0x3c')]:_0x4e8178[_0xe199('0x3a')];if(_0x4128fe[_0xe199('0x38')][_0xe199('0x47')]){_0x483eae['include']=[{'all':!![]}];}_0x483eae=_['merge']({},_0x483eae,_0x4128fe[_0xe199('0x57')]);return db['Dashboard'][_0xe199('0x4d')](_0x483eae)[_0xe199('0x2b')](handleEntityNotFound(_0x1634d1,null))[_0xe199('0x2b')](function(_0x411dca){if(_0x411dca){var _0x31f7ea=_0x411dca[_0xe199('0x50')]({'plain':!![]});_0x31f7ea=qs[_0xe199('0x58')](_0x31f7ea,['id',_0xe199('0x59'),'updatedAt']);_0x4128fe[_0xe199('0x4e')]=_[_0xe199('0x58')](_0x4128fe[_0xe199('0x4e')],['id',_0xe199('0x59'),_0xe199('0x5a')]);return db[_0xe199('0x34')]['create'](_[_0xe199('0x44')](_0x31f7ea,_0x4128fe[_0xe199('0x4e')]),{'include':_0x4128fe[_0xe199('0x38')][_0xe199('0x47')]?[{'all':!![]}]:undefined})[_0xe199('0x2b')](function(_0x5ddd26){var _0x51a623=_0x4128fe[_0xe199('0x4f')]['get']({'plain':!![]});if(!_0x51a623)throw new Error(_0xe199('0x51'));if(_0x51a623[_0xe199('0x5b')]===_0xe199('0x4f')){var _0x3c61ff=_0x5ddd26[_0xe199('0x50')]({'plain':!![]});var _0x1acb79='CustomDashboards';return db[_0xe199('0x52')][_0xe199('0x4d')]({'where':{'name':_0x1acb79,'userProfileId':_0x51a623[_0xe199('0x5c')]},'raw':!![]})[_0xe199('0x2b')](function(_0x3f0b35){if(_0x3f0b35&&_0x3f0b35['autoAssociation']===0x0){return db[_0xe199('0x2e')]['create']({'name':_0x3c61ff[_0xe199('0x31')],'resourceId':_0x3c61ff['id'],'type':_0x3f0b35[_0xe199('0x31')],'sectionId':_0x3f0b35['id']},{})[_0xe199('0x2b')](function(){return _0x5ddd26;});}else{return _0x5ddd26;}})[_0xe199('0x4a')](function(_0x47a9da){logger[_0xe199('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47a9da);throw _0x47a9da;});}return _0x5ddd26;});}})[_0xe199('0x2b')](respondWithResult(_0x1634d1,0xc9))[_0xe199('0x4a')](handleError(_0x1634d1,null));};exports[_0xe199('0x5d')]=function(_0x5533e5,_0x5e6c12){if(_0x5533e5[_0xe199('0x4e')]['id']){delete _0x5533e5[_0xe199('0x4e')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x5533e5[_0xe199('0x5e')]['id']}})[_0xe199('0x2b')](handleEntityNotFound(_0x5e6c12,null))[_0xe199('0x2b')](saveUpdates(_0x5533e5[_0xe199('0x4e')],null))[_0xe199('0x2b')](respondWithResult(_0x5e6c12,null))['catch'](handleError(_0x5e6c12,null));};exports[_0xe199('0x2c')]=function(_0x1480ee,_0x51bdc3){return db[_0xe199('0x34')][_0xe199('0x4d')]({'where':{'id':_0x1480ee['params']['id']}})[_0xe199('0x2b')](handleEntityNotFound(_0x51bdc3,null))[_0xe199('0x2b')](removeEntity(_0x51bdc3,null))[_0xe199('0x4a')](handleError(_0x51bdc3,null));};function widgetAttributes(_0x590ad1){try{switch(_0x590ad1[_0xe199('0x45')]){case _0xe199('0x5f'):return[{'name':_0xe199('0x60'),'value':_0x590ad1[_0xe199('0x60')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1['attrs'][0x0][_0xe199('0x62')]:undefined)||_0xe199('0x63')}];case'custom':return[{'name':_0xe199('0x64'),'value':_0x590ad1[_0xe199('0x64')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||''}];case _0xe199('0x65'):return[{'name':_0xe199('0x66'),'value':_0x590ad1['attrHourFormat']||(_0x590ad1['attrs']&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||_0xe199('0x67')},{'name':_0xe199('0x68'),'value':_0x590ad1[_0xe199('0x68')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1['attrs'][0x1]?_0x590ad1[_0xe199('0x61')][0x1][_0xe199('0x62')]:undefined)||_0xe199('0x69')},{'name':_0xe199('0x6a'),'value':_0x590ad1[_0xe199('0x6a')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x2]?_0x590ad1[_0xe199('0x61')][0x2][_0xe199('0x62')]:undefined)||0xc}];case _0xe199('0x6b'):return[{'name':_0xe199('0x6c'),'value':_0x590ad1[_0xe199('0x6c')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||_0xe199('0x6d')},{'name':_0xe199('0x6e'),'value':_0x590ad1['attrVoiceQueues']||(_0x590ad1['attrs']&&_0x590ad1[_0xe199('0x61')][0x1]?_0x590ad1[_0xe199('0x61')][0x1][_0xe199('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0x590ad1['attrFontSize']||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x2]?_0x590ad1[_0xe199('0x61')][0x2]['value']:undefined)||0x14}];case _0xe199('0x6f'):case'pie-chart':return[{'name':'attrSerie1','value':_0x590ad1[_0xe199('0x70')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||_0xe199('0x6d')},{'name':_0xe199('0x71'),'value':_0x590ad1['attrSerie2']||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x1]?_0x590ad1[_0xe199('0x61')][0x1][_0xe199('0x62')]:undefined)||null},{'name':_0xe199('0x72'),'value':_0x590ad1[_0xe199('0x72')]||(_0x590ad1['attrs']&&_0x590ad1[_0xe199('0x61')][0x2]?_0x590ad1['attrs'][0x2]['value']:undefined)||null},{'name':_0xe199('0x6e'),'value':_0x590ad1[_0xe199('0x6e')]||(_0x590ad1['attrs']&&_0x590ad1[_0xe199('0x61')][0x3]?_0x590ad1[_0xe199('0x61')][0x3][_0xe199('0x62')]:undefined)||[]}];case _0xe199('0x73'):return[{'name':_0xe199('0x74'),'type':_0x590ad1[_0xe199('0x75')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x45')]:undefined)||null,'value':_0x590ad1[_0xe199('0x74')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0x590ad1[_0xe199('0x76')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x1]?_0x590ad1[_0xe199('0x61')][0x1][_0xe199('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x1f1d99){logger['error'](_0xe199('0x77'),JSON[_0xe199('0x78')](_0x1f1d99));return[];}}exports[_0xe199('0x79')]=function(_0x145fec,_0x511189,_0x3cb38d){if(_0x145fec['body']['id']){delete _0x145fec['body']['id'];}return db[_0xe199('0x34')][_0xe199('0x4d')]({'where':{'id':_0x145fec[_0xe199('0x5e')]['id']}})['then'](handleEntityNotFound(_0x511189,null))[_0xe199('0x2b')](function(_0x583819){if(_0x583819){_0x145fec[_0xe199('0x4e')][_0xe199('0x7a')]=_0x583819['id'];_0x145fec['body'][_0xe199('0x61')]=widgetAttributes(_0x145fec['body']);return db[_0xe199('0x7b')][_0xe199('0x54')](_0x145fec[_0xe199('0x4e')]);}})[_0xe199('0x2b')](respondWithResult(_0x511189,null))['catch'](handleError(_0x511189,null));};exports[_0xe199('0x7c')]=function(_0x198bd2,_0x12834c,_0x449a0b){var _0x21339a={};var _0x4d64b4={};var _0xb58c2f;var _0x23efa2;return db['Dashboard'][_0xe199('0x7d')]({'where':{'id':_0x198bd2[_0xe199('0x5e')]['id']}})[_0xe199('0x2b')](handleEntityNotFound(_0x12834c,null))['then'](function(_0x5c1197){if(_0x5c1197){_0xb58c2f=_0x5c1197;_0x4d64b4[_0xe199('0x3a')]=_['keys'](db[_0xe199('0x7b')][_0xe199('0x7e')]);_0x4d64b4[_0xe199('0x38')]=_[_0xe199('0x4c')](_0x198bd2['query']);_0x4d64b4[_0xe199('0x42')]=_[_0xe199('0x39')](_0x4d64b4['model'],_0x4d64b4[_0xe199('0x38')]);_0x21339a[_0xe199('0x3c')]=_[_0xe199('0x39')](_0x4d64b4[_0xe199('0x3a')],qs[_0xe199('0x3b')](_0x198bd2[_0xe199('0x38')][_0xe199('0x3b')]));_0x21339a[_0xe199('0x3c')]=_0x21339a[_0xe199('0x3c')]['length']?_0x21339a['attributes']:_0x4d64b4[_0xe199('0x3a')];_0x21339a[_0xe199('0x3f')]=qs[_0xe199('0x40')](_0x198bd2['query'][_0xe199('0x40')]);_0x21339a[_0xe199('0x41')]=qs['filters'](_[_0xe199('0x7f')](_0x198bd2[_0xe199('0x38')],_0x4d64b4[_0xe199('0x42')]));if(_0x198bd2[_0xe199('0x38')][_0xe199('0x43')]){_0x21339a[_0xe199('0x41')]=_[_0xe199('0x44')](_0x21339a[_0xe199('0x41')],{'$or':_['map'](_0x21339a['attributes'],function(_0x3f2189){var _0x12b3df={};_0x12b3df[_0x3f2189]={'$like':'%'+_0x198bd2[_0xe199('0x38')][_0xe199('0x43')]+'%'};return _0x12b3df;})});}_0x21339a=_['merge']({},_0x21339a,_0x198bd2[_0xe199('0x57')]);return _0xb58c2f[_0xe199('0x7c')](_0x21339a);}})[_0xe199('0x2b')](function(_0x13b96b){if(_0x13b96b){_0x23efa2=_0x13b96b[_0xe199('0x3d')];if(!_0x198bd2['query']['hasOwnProperty'](_0xe199('0x80'))){_0x21339a[_0xe199('0x23')]=qs[_0xe199('0x23')](_0x198bd2['query']['limit']);_0x21339a[_0xe199('0x24')]=qs[_0xe199('0x24')](_0x198bd2[_0xe199('0x38')][_0xe199('0x24')]);}return _0xb58c2f[_0xe199('0x7c')](_0x21339a);}})['then'](function(_0x1c369f){if(_0x1c369f){return _0x1c369f?{'count':_0x23efa2,'rows':_0x1c369f}:null;}})[_0xe199('0x2b')](respondWithResult(_0x12834c,null))[_0xe199('0x4a')](handleError(_0x12834c,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 01083b2..1d2bd4f 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 _0xd718=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x3231ce,_0x1ccd99){var _0x5b999d=function(_0x2f9aa0){while(--_0x2f9aa0){_0x3231ce['push'](_0x3231ce['shift']());}};_0x5b999d(++_0x1ccd99);}(_0xd718,0x1dc));var _0x8d71=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xd718[_0x1c8c28];return _0x1f59b4;};'use strict';var EventEmitter=require(_0x8d71('0x0'));var Dashboard=require(_0x8d71('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8d71('0x2')](0x0);var events={'afterCreate':_0x8d71('0x3'),'afterUpdate':_0x8d71('0x4'),'afterDestroy':_0x8d71('0x5')};function emitEvent(_0x5391aa){return function(_0x518257,_0x55b022,_0x55a27b){DashboardEvents[_0x8d71('0x6')](_0x5391aa+':'+_0x518257['id'],_0x518257);DashboardEvents[_0x8d71('0x6')](_0x5391aa,_0x518257);_0x55a27b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x8d71('0x7')](e,emitEvent(event));}}module[_0x8d71('0x8')]=DashboardEvents; \ No newline at end of file +var _0x5557=['hook','exports','events','Dashboard','save','update','emit','hasOwnProperty'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5557,0x1ba));var _0x7555=function(_0x4e536b,_0x4719dc){_0x4e536b=_0x4e536b-0x0;var _0x15d06e=_0x5557[_0x4e536b];return _0x15d06e;};'use strict';var EventEmitter=require(_0x7555('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x7555('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7555('0x2'),'afterUpdate':_0x7555('0x3'),'afterDestroy':'remove'};function emitEvent(_0x150e74){return function(_0x5dd156,_0x2d0ded,_0x4679ca){DashboardEvents[_0x7555('0x4')](_0x150e74+':'+_0x5dd156['id'],_0x5dd156);DashboardEvents[_0x7555('0x4')](_0x150e74,_0x5dd156);_0x4679ca(null);};}for(var e in events){if(events[_0x7555('0x5')](e)){var event=events[e];Dashboard[_0x7555('0x6')](e,emitEvent(event));}}module[_0x7555('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 36f668d..4e2f102 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 _0xe3f3=['request-promise','path','rimraf','../../config/environment','Dashboard','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x124f68,_0x506449){var _0x4118d4=function(_0x2a73a1){while(--_0x2a73a1){_0x124f68['push'](_0x124f68['shift']());}};_0x4118d4(++_0x506449);}(_0xe3f3,0xed));var _0x3e3f=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xe3f3[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x3e3f('0x0'));var util=require(_0x3e3f('0x1'));var logger=require(_0x3e3f('0x2'))(_0x3e3f('0x3'));var moment=require(_0x3e3f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e3f('0x5'));var fs=require('fs');var path=require(_0x3e3f('0x6'));var rimraf=require(_0x3e3f('0x7'));var config=require(_0x3e3f('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x5e6f11,_0x3f3536){return _0x5e6f11['define'](_0x3e3f('0x9'),attributes,{'tableName':_0x3e3f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe74c=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0xe74c,0xf2));var _0xce74=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xe74c[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xce74('0x0'));var util=require(_0xce74('0x1'));var logger=require(_0xce74('0x2'))(_0xce74('0x3'));var moment=require('moment');var BPromise=require(_0xce74('0x4'));var rp=require(_0xce74('0x5'));var fs=require('fs');var path=require(_0xce74('0x6'));var rimraf=require(_0xce74('0x7'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xce74('0x8')]=function(_0x2b83cc,_0x5cbde5){return _0x2b83cc[_0xce74('0x9')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 70d1b12..693d4f8 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 _0x3871=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3871,0x1e6));var _0x1387=function(_0x50582c,_0x12bbc1){_0x50582c=_0x50582c-0x0;var _0x41eef9=_0x3871[_0x50582c];return _0x41eef9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1387('0x0'));var BPromise=require(_0x1387('0x1'));var rs=require(_0x1387('0x2'));var fs=require('fs');var Redis=require(_0x1387('0x3'));var db=require(_0x1387('0x4'))['db'];var utils=require(_0x1387('0x5'));var logger=require('../../config/logger')(_0x1387('0x6'));var config=require(_0x1387('0x7'));var jayson=require(_0x1387('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x1387('0x9')]=_[_0x1387('0xa')](config[_0x1387('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1387('0xb'))(new Redis(config[_0x1387('0x9')]));require(_0x1387('0xc'))[_0x1387('0xd')](socket);function respondWithRpcPromise(_0x228d83,_0x1b57a9,_0x1c11cd){return new BPromise(function(_0x464050,_0x5e90e7){return client[_0x1387('0xe')](_0x228d83,_0x1c11cd)[_0x1387('0xf')](function(_0x344881){logger['info'](_0x1387('0x10'),_0x1b57a9,'request\x20sent');logger[_0x1387('0x11')](_0x1387('0x12'),_0x1b57a9,_0x1387('0x13'),JSON[_0x1387('0x14')](_0x344881));if(_0x344881[_0x1387('0x15')]){if(_0x344881[_0x1387('0x15')][_0x1387('0x16')]===0x1f4){logger[_0x1387('0x15')](_0x1387('0x10'),_0x1b57a9,_0x344881[_0x1387('0x15')][_0x1387('0x17')]);return _0x5e90e7(_0x344881[_0x1387('0x15')]['message']);}logger[_0x1387('0x15')](_0x1387('0x10'),_0x1b57a9,_0x344881[_0x1387('0x15')]['message']);return _0x464050(_0x344881[_0x1387('0x15')][_0x1387('0x17')]);}else{logger[_0x1387('0x18')](_0x1387('0x10'),_0x1b57a9,_0x1387('0x13'));_0x464050(_0x344881[_0x1387('0x19')][_0x1387('0x17')]);}})[_0x1387('0x1a')](function(_0xf3032b){logger[_0x1387('0x15')](_0x1387('0x10'),_0x1b57a9,_0xf3032b);_0x5e90e7(_0xf3032b);});});} \ No newline at end of file +var _0xbda1=['debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x102941,_0x3673e3){var _0x3bbe17=function(_0x514396){while(--_0x514396){_0x102941['push'](_0x102941['shift']());}};_0x3bbe17(++_0x3673e3);}(_0xbda1,0x133));var _0x1bda=function(_0x282b49,_0x4bb118){_0x282b49=_0x282b49-0x0;var _0x1e4746=_0xbda1[_0x282b49];return _0x1e4746;};'use strict';var _=require('lodash');var util=require(_0x1bda('0x0'));var moment=require(_0x1bda('0x1'));var BPromise=require(_0x1bda('0x2'));var rs=require(_0x1bda('0x3'));var fs=require('fs');var Redis=require(_0x1bda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bda('0x5'));var logger=require(_0x1bda('0x6'))('rpc');var config=require(_0x1bda('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1bda('0x8')]['http']({'port':0x232a});config[_0x1bda('0x9')]=_['defaults'](config[_0x1bda('0x9')],{'host':_0x1bda('0xa'),'port':0x18eb});var socket=require(_0x1bda('0xb'))(new Redis(config[_0x1bda('0x9')]));require(_0x1bda('0xc'))[_0x1bda('0xd')](socket);function respondWithRpcPromise(_0x59ba1b,_0x500687,_0x522d68){return new BPromise(function(_0x1bc96a,_0x49e3f0){return client[_0x1bda('0xe')](_0x59ba1b,_0x522d68)[_0x1bda('0xf')](function(_0x264459){logger['info'](_0x1bda('0x10'),_0x500687,_0x1bda('0x11'));logger[_0x1bda('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x500687,_0x1bda('0x11'),JSON[_0x1bda('0x13')](_0x264459));if(_0x264459[_0x1bda('0x14')]){if(_0x264459[_0x1bda('0x14')][_0x1bda('0x15')]===0x1f4){logger[_0x1bda('0x14')](_0x1bda('0x10'),_0x500687,_0x264459['error'][_0x1bda('0x16')]);return _0x49e3f0(_0x264459[_0x1bda('0x14')][_0x1bda('0x16')]);}logger[_0x1bda('0x14')]('Dashboard,\x20%s,\x20%s',_0x500687,_0x264459[_0x1bda('0x14')]['message']);return _0x1bc96a(_0x264459[_0x1bda('0x14')][_0x1bda('0x16')]);}else{logger['info'](_0x1bda('0x10'),_0x500687,_0x1bda('0x11'));_0x1bc96a(_0x264459[_0x1bda('0x17')][_0x1bda('0x16')]);}})[_0x1bda('0x18')](function(_0x33e129){logger[_0x1bda('0x14')]('Dashboard,\x20%s,\x20%s',_0x500687,_0x33e129);_0x49e3f0(_0x33e129);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index bf7efa8..72cc244 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 _0x89cc=['register','length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x89cc,0x11a));var _0xc89c=function(_0x2a3857,_0x22fb1d){_0x2a3857=_0x2a3857-0x0;var _0x1ac734=_0x89cc[_0x2a3857];return _0x1ac734;};'use strict';var DashboardEvents=require(_0xc89c('0x0'));var events=[_0xc89c('0x1'),_0xc89c('0x2'),_0xc89c('0x3')];function createListener(_0x243d87,_0x4b2d55){return function(_0x464539){_0x4b2d55[_0xc89c('0x4')](_0x243d87,_0x464539);};}function removeListener(_0x33c4f2,_0x2946e0){return function(){DashboardEvents[_0xc89c('0x5')](_0x33c4f2,_0x2946e0);};}exports[_0xc89c('0x6')]=function(_0x5dc812){for(var _0x4bc31d=0x0,_0x170d17=events[_0xc89c('0x7')];_0x4bc31d<_0x170d17;_0x4bc31d++){var _0x4e380e=events[_0x4bc31d];var _0x894d5a=createListener(_0xc89c('0x8')+_0x4e380e,_0x5dc812);DashboardEvents['on'](_0x4e380e,_0x894d5a);}}; \ No newline at end of file +var _0xd242=['register','./dashboard.events','save','remove','update','removeListener'];(function(_0x48084f,_0x2d1e50){var _0x215480=function(_0x3662ef){while(--_0x3662ef){_0x48084f['push'](_0x48084f['shift']());}};_0x215480(++_0x2d1e50);}(_0xd242,0x8b));var _0x2d24=function(_0x5782a3,_0x2d54f3){_0x5782a3=_0x5782a3-0x0;var _0x5dcae1=_0xd242[_0x5782a3];return _0x5dcae1;};'use strict';var DashboardEvents=require(_0x2d24('0x0'));var events=[_0x2d24('0x1'),_0x2d24('0x2'),_0x2d24('0x3')];function createListener(_0x42d7c0,_0x7abadc){return function(_0x5a0def){_0x7abadc['emit'](_0x42d7c0,_0x5a0def);};}function removeListener(_0x154271,_0x334621){return function(){DashboardEvents[_0x2d24('0x4')](_0x154271,_0x334621);};}exports[_0x2d24('0x5')]=function(_0x5b84c0){for(var _0x53c0a6=0x0,_0x56786a=events['length'];_0x53c0a6<_0x56786a;_0x53c0a6++){var _0xeba684=events[_0x53c0a6];var _0x450390=createListener('dashboard:'+_0xeba684,_0x5b84c0);DashboardEvents['on'](_0xeba684,_0x450390);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 64598db..9bf2580 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 _0xb764=['fs-extra','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','get','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3163e3,_0x7dfc4b){var _0x2e3388=function(_0x2e139f){while(--_0x2e139f){_0x3163e3['push'](_0x3163e3['shift']());}};_0x2e3388(++_0x7dfc4b);}(_0xb764,0x1b1));var _0x4b76=function(_0xffdd4,_0x56a340){_0xffdd4=_0xffdd4-0x0;var _0x5f57c3=_0xb764[_0xffdd4];return _0x5f57c3;};'use strict';var multer=require('multer');var util=require(_0x4b76('0x0'));var path=require('path');var timeout=require(_0x4b76('0x1'));var express=require(_0x4b76('0x2'));var router=express[_0x4b76('0x3')]();var fs_extra=require(_0x4b76('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4b76('0x5'));var config=require('../../config/environment');var controller=require(_0x4b76('0x6'));router['get']('/',auth[_0x4b76('0x7')](),controller[_0x4b76('0x8')]);router[_0x4b76('0x9')]('/:id',auth[_0x4b76('0x7')](),controller[_0x4b76('0xa')]);router[_0x4b76('0x9')](_0x4b76('0xb'),auth[_0x4b76('0x7')](),controller[_0x4b76('0xc')]);router[_0x4b76('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x4b76('0xe'),auth[_0x4b76('0x7')](),controller[_0x4b76('0xf')]);router[_0x4b76('0xd')](_0x4b76('0xb'),auth[_0x4b76('0x7')](),controller[_0x4b76('0x10')]);router[_0x4b76('0x11')]('/:id',auth[_0x4b76('0x7')](),controller[_0x4b76('0x12')]);router[_0x4b76('0x13')](_0x4b76('0x14'),auth[_0x4b76('0x7')](),controller[_0x4b76('0x15')]);module[_0x4b76('0x16')]=router; \ No newline at end of file +var _0xb854=['put','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','create','post','/:id/clone','/:id/items','addItem'];(function(_0x16024e,_0x403f12){var _0x252d3e=function(_0x8a699d){while(--_0x8a699d){_0x16024e['push'](_0x16024e['shift']());}};_0x252d3e(++_0x403f12);}(_0xb854,0x1a3));var _0x4b85=function(_0x51747d,_0x33e1bf){_0x51747d=_0x51747d-0x0;var _0x2f374d=_0xb854[_0x51747d];return _0x2f374d;};'use strict';var multer=require(_0x4b85('0x0'));var util=require('util');var path=require(_0x4b85('0x1'));var timeout=require('connect-timeout');var express=require(_0x4b85('0x2'));var router=express[_0x4b85('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b85('0x4'));var config=require(_0x4b85('0x5'));var controller=require(_0x4b85('0x6'));router[_0x4b85('0x7')]('/',auth[_0x4b85('0x8')](),controller[_0x4b85('0x9')]);router[_0x4b85('0x7')](_0x4b85('0xa'),auth[_0x4b85('0x8')](),controller[_0x4b85('0xb')]);router['get']('/:id/items',auth[_0x4b85('0x8')](),controller[_0x4b85('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4b85('0xd')]);router[_0x4b85('0xe')](_0x4b85('0xf'),auth[_0x4b85('0x8')](),controller['clone']);router[_0x4b85('0xe')](_0x4b85('0x10'),auth[_0x4b85('0x8')](),controller[_0x4b85('0x11')]);router[_0x4b85('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4b85('0x13')]);router[_0x4b85('0x14')](_0x4b85('0xa'),auth['isAuthenticated'](),controller[_0x4b85('0x15')]);module[_0x4b85('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3ed56fc..0633efc 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 _0x46ed=['sequelize','squel','exports','STRING','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0xd46e('0x0'));var squel=require(_0xd46e('0x1'));var _=require('lodash');module[_0xd46e('0x2')]={'title':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd46e('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xd46e('0x4')),'get':function(){try{return JSON[_0xd46e('0x5')](this['getDataValue'](_0xd46e('0x6')));}catch(_0x1926d9){return[];}},'set':function(_0x160bcf){try{this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')](_0x160bcf));}catch(_0x437ea0){this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xd46e('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd46e('0x9')]},'col':{'type':Sequelize[_0xd46e('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd46e('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![],'defaultValue':_0xd46e('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd46e('0x3')]},'titleFontSize':{'type':Sequelize[_0xd46e('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1623=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','exports','STRING','TEXT','long'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x1623,0xab));var _0x3162=function(_0x2dbd07,_0xccfdd0){_0x2dbd07=_0x2dbd07-0x0;var _0xea9f56=_0x1623[_0x2dbd07];return _0xea9f56;};'use strict';var Sequelize=require(_0x3162('0x0'));var squel=require('squel');var _=require('lodash');module[_0x3162('0x1')]={'title':{'type':Sequelize[_0x3162('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x3162('0x5')));}catch(_0x4b77c4){return[];}},'set':function(_0x1b55f2){try{this[_0x3162('0x6')]('attrs',JSON[_0x3162('0x7')](_0x1b55f2));}catch(_0x2dc07e){this[_0x3162('0x6')](_0x3162('0x5'),JSON[_0x3162('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3162('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3162('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3162('0x2')],'allowNull':![],'defaultValue':_0x3162('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3162('0x2')]},'titleFontSize':{'type':Sequelize[_0x3162('0x8')],'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 bba8d4d..eea2275 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 _0x0a67=['DashboardItem','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','merge','options','find','then','catch','params','type','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','body','create','update','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','apply','save','destroy','stack','name','send','show','keys'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0a67,0x12b));var _0x70a6=function(_0x595010,_0x174b1a){_0x595010=_0x595010-0x0;var _0x362716=_0x0a67[_0x595010];return _0x362716;};'use strict';var emlformat=require(_0x70a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70a6('0x1'));var jsonpatch=require(_0x70a6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x70a6('0x3'));var Mustache=require(_0x70a6('0x4'));var util=require(_0x70a6('0x5'));var path=require('path');var sox=require(_0x70a6('0x6'));var csv=require(_0x70a6('0x7'));var ejs=require(_0x70a6('0x8'));var fs=require('fs');var fs_extra=require(_0x70a6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x70a6('0xa'));var jsforce=require(_0x70a6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x70a6('0x7'));var querystring=require(_0x70a6('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x70a6('0xd'));var qs=require(_0x70a6('0xe'));var as=require(_0x70a6('0xf'));var hardwareService=require(_0x70a6('0x10'));var logger=require(_0x70a6('0x11'))(_0x70a6('0x12'));var utils=require(_0x70a6('0x13'));var config=require(_0x70a6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x70a6('0x15'))['db'];config[_0x70a6('0x16')]=_[_0x70a6('0x17')](config[_0x70a6('0x16')],{'host':_0x70a6('0x18'),'port':0x18eb});var socket=require(_0x70a6('0x19'))(new Redis(config[_0x70a6('0x16')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x356ef0,_0x33bdea){_0x33bdea=_0x33bdea||0xcc;return function(_0x308ae0){if(_0x308ae0){return _0x356ef0[_0x70a6('0x1a')](_0x33bdea);}return _0x356ef0[_0x70a6('0x1b')](_0x33bdea)[_0x70a6('0x1c')]();};}function respondWithResult(_0x2066f1,_0x58ff04){_0x58ff04=_0x58ff04||0xc8;return function(_0x16b950){if(_0x16b950){return _0x2066f1[_0x70a6('0x1b')](_0x58ff04)[_0x70a6('0x1d')](_0x16b950);}};}function respondWithFilteredResult(_0x3ff57a,_0x5d6b6d){return function(_0x5e8cd3){if(_0x5e8cd3){var _0x26d19d=typeof _0x5d6b6d[_0x70a6('0x1e')]===_0x70a6('0x1f')&&typeof _0x5d6b6d[_0x70a6('0x20')]===_0x70a6('0x1f');var _0x44b587=_0x5e8cd3['count'];var _0x3ebeac=_0x26d19d?0x0:_0x5d6b6d[_0x70a6('0x1e')];var _0x5ab9e5=_0x26d19d?_0x5e8cd3['count']:_0x5d6b6d['offset']+_0x5d6b6d[_0x70a6('0x20')];var _0x343967;if(_0x5ab9e5>=_0x44b587){_0x5ab9e5=_0x44b587;_0x343967=0xc8;}else{_0x343967=0xce;}_0x3ff57a[_0x70a6('0x1b')](_0x343967);return _0x3ff57a['set']('Content-Range',_0x3ebeac+'-'+_0x5ab9e5+'/'+_0x44b587)[_0x70a6('0x1d')](_0x5e8cd3);}return null;};}function patchUpdates(_0x15b9b0){return function(_0x2b2bf4){try{jsonpatch[_0x70a6('0x21')](_0x2b2bf4,_0x15b9b0,!![]);}catch(_0x7e45a9){return BPromise['reject'](_0x7e45a9);}return _0x2b2bf4[_0x70a6('0x22')]();};}function saveUpdates(_0x11ff15,_0x452f31){return function(_0x2a7292){if(_0x2a7292){return _0x2a7292['update'](_0x11ff15)['then'](function(_0x5e6c0a){return _0x5e6c0a;});}return null;};}function removeEntity(_0x2ea4e3,_0x28e830){return function(_0x21c0e5){if(_0x21c0e5){return _0x21c0e5[_0x70a6('0x23')]()['then'](function(){_0x2ea4e3[_0x70a6('0x1b')](0xcc)[_0x70a6('0x1c')]();});}};}function handleEntityNotFound(_0x110cbb,_0x535161){return function(_0x233836){if(!_0x233836){_0x110cbb[_0x70a6('0x1a')](0x194);}return _0x233836;};}function handleError(_0x5e4ddf,_0x13f14d){_0x13f14d=_0x13f14d||0x1f4;return function(_0x34c91c){logger['error'](_0x34c91c[_0x70a6('0x24')]);if(_0x34c91c[_0x70a6('0x25')]){delete _0x34c91c[_0x70a6('0x25')];}_0x5e4ddf['status'](_0x13f14d)[_0x70a6('0x26')](_0x34c91c);};}exports[_0x70a6('0x27')]=function(_0x109870,_0x142c86){var _0x5ec2dd={'raw':![],'where':{'id':_0x109870['params']['id']}},_0x2e8802={};_0x2e8802['model']=_[_0x70a6('0x28')](db[_0x70a6('0x29')][_0x70a6('0x2a')]);_0x2e8802[_0x70a6('0x2b')]=_[_0x70a6('0x28')](_0x109870[_0x70a6('0x2b')]);_0x2e8802[_0x70a6('0x2c')]=_['intersection'](_0x2e8802[_0x70a6('0x2d')],_0x2e8802['query']);_0x5ec2dd[_0x70a6('0x2e')]=_[_0x70a6('0x2f')](_0x2e8802[_0x70a6('0x2d')],qs[_0x70a6('0x30')](_0x109870[_0x70a6('0x2b')][_0x70a6('0x30')]));_0x5ec2dd[_0x70a6('0x2e')]=_0x5ec2dd[_0x70a6('0x2e')][_0x70a6('0x31')]?_0x5ec2dd[_0x70a6('0x2e')]:_0x2e8802['model'];if(_0x109870[_0x70a6('0x2b')][_0x70a6('0x32')]){_0x5ec2dd['include']=[{'all':!![]}];}_0x5ec2dd=_[_0x70a6('0x33')]({},_0x5ec2dd,_0x109870[_0x70a6('0x34')]);return db[_0x70a6('0x29')][_0x70a6('0x35')](_0x5ec2dd)[_0x70a6('0x36')](handleEntityNotFound(_0x142c86,null))[_0x70a6('0x36')](respondWithResult(_0x142c86,null))[_0x70a6('0x37')](handleError(_0x142c86,null));};exports[_0x70a6('0x23')]=function(_0x39f2c3,_0x5cfa05){return db[_0x70a6('0x29')][_0x70a6('0x35')]({'where':{'id':_0x39f2c3[_0x70a6('0x38')]['id']}})[_0x70a6('0x36')](handleEntityNotFound(_0x5cfa05,null))[_0x70a6('0x36')](removeEntity(_0x5cfa05,null))['catch'](handleError(_0x5cfa05,null));};function widgetAttributes(_0x48ad41){try{switch(_0x48ad41[_0x70a6('0x39')]){case _0x70a6('0x3a'):return[{'name':_0x70a6('0x3b'),'value':_0x48ad41[_0x70a6('0x3b')]||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41[_0x70a6('0x3c')][0x0]?_0x48ad41[_0x70a6('0x3c')][0x0][_0x70a6('0x3d')]:undefined)||_0x70a6('0x3e')}];case'custom':return[{'name':_0x70a6('0x3f'),'value':_0x48ad41['attrPath']||(_0x48ad41['attrs']&&_0x48ad41[_0x70a6('0x3c')][0x0]?_0x48ad41[_0x70a6('0x3c')][0x0][_0x70a6('0x3d')]:undefined)||''}];case'clock':return[{'name':_0x70a6('0x40'),'value':_0x48ad41[_0x70a6('0x40')]||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41[_0x70a6('0x3c')][0x0]?_0x48ad41[_0x70a6('0x3c')][0x0]['value']:undefined)||_0x70a6('0x41')},{'name':_0x70a6('0x42'),'value':_0x48ad41[_0x70a6('0x42')]||(_0x48ad41['attrs']&&_0x48ad41[_0x70a6('0x3c')][0x1]?_0x48ad41[_0x70a6('0x3c')][0x1][_0x70a6('0x3d')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x48ad41[_0x70a6('0x43')]||(_0x48ad41['attrs']&&_0x48ad41[_0x70a6('0x3c')][0x2]?_0x48ad41[_0x70a6('0x3c')][0x2][_0x70a6('0x3d')]:undefined)||0xc}];case _0x70a6('0x44'):return[{'name':_0x70a6('0x45'),'value':_0x48ad41['attrMetric']||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41[_0x70a6('0x3c')][0x0]?_0x48ad41[_0x70a6('0x3c')][0x0][_0x70a6('0x3d')]:undefined)||_0x70a6('0x46')},{'name':_0x70a6('0x47'),'value':_0x48ad41[_0x70a6('0x47')]||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41[_0x70a6('0x3c')][0x1]?_0x48ad41[_0x70a6('0x3c')][0x1][_0x70a6('0x3d')]:undefined)||[]},{'name':_0x70a6('0x43'),'value':_0x48ad41['attrFontSize']||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41['attrs'][0x2]?_0x48ad41[_0x70a6('0x3c')][0x2][_0x70a6('0x3d')]:undefined)||0x14}];case _0x70a6('0x48'):case _0x70a6('0x49'):return[{'name':_0x70a6('0x4a'),'value':_0x48ad41[_0x70a6('0x4a')]||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41['attrs'][0x0]?_0x48ad41[_0x70a6('0x3c')][0x0][_0x70a6('0x3d')]:undefined)||_0x70a6('0x46')},{'name':'attrSerie2','value':_0x48ad41[_0x70a6('0x4b')]||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41[_0x70a6('0x3c')][0x1]?_0x48ad41['attrs'][0x1]['value']:undefined)||null},{'name':_0x70a6('0x4c'),'value':_0x48ad41[_0x70a6('0x4c')]||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41[_0x70a6('0x3c')][0x2]?_0x48ad41[_0x70a6('0x3c')][0x2][_0x70a6('0x3d')]:undefined)||null},{'name':_0x70a6('0x47'),'value':_0x48ad41[_0x70a6('0x47')]||(_0x48ad41['attrs']&&_0x48ad41['attrs'][0x3]?_0x48ad41['attrs'][0x3][_0x70a6('0x3d')]:undefined)||[]}];case'web-report':return[{'name':_0x70a6('0x4d'),'type':_0x48ad41[_0x70a6('0x4e')]||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41[_0x70a6('0x3c')][0x0]?_0x48ad41[_0x70a6('0x3c')][0x0][_0x70a6('0x39')]:undefined)||null,'value':_0x48ad41[_0x70a6('0x4d')]||(_0x48ad41['attrs']&&_0x48ad41[_0x70a6('0x3c')][0x0]?_0x48ad41['attrs'][0x0]['value']:undefined)||null},{'name':_0x70a6('0x4f'),'value':_0x48ad41[_0x70a6('0x4f')]||(_0x48ad41[_0x70a6('0x3c')]&&_0x48ad41[_0x70a6('0x3c')][0x1]?_0x48ad41[_0x70a6('0x3c')][0x1][_0x70a6('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x3da739){logger[_0x70a6('0x50')](_0x70a6('0x51'),JSON['stringify'](_0x3da739));return[];}}exports['create']=function(_0xc2c136,_0x1d0707){if(_0xc2c136[_0x70a6('0x52')]){_0xc2c136[_0x70a6('0x52')][_0x70a6('0x3c')]=widgetAttributes(_0xc2c136['body']);}return db[_0x70a6('0x29')][_0x70a6('0x53')](_0xc2c136[_0x70a6('0x52')],{})['then'](respondWithResult(_0x1d0707,0xc9))['catch'](handleError(_0x1d0707,null));};exports[_0x70a6('0x54')]=function(_0x5e73fb,_0x113d3f){if(_0x5e73fb[_0x70a6('0x52')]['id']){delete _0x5e73fb['body']['id'];}_0x5e73fb['body']['attrs']=widgetAttributes(_0x5e73fb[_0x70a6('0x52')]);return db['DashboardItem'][_0x70a6('0x35')]({'where':{'id':_0x5e73fb[_0x70a6('0x38')]['id']}})[_0x70a6('0x36')](handleEntityNotFound(_0x113d3f,null))[_0x70a6('0x36')](saveUpdates(_0x5e73fb['body'],null))[_0x70a6('0x36')](respondWithResult(_0x113d3f,null))['catch'](handleError(_0x113d3f,null));}; \ No newline at end of file +var _0xccd7=['type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','show','params','model','rawAttributes','keys','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','DashboardItem','catch','find'];(function(_0x1c5206,_0x1cfa0f){var _0x1ce95e=function(_0x54ed27){while(--_0x54ed27){_0x1c5206['push'](_0x1c5206['shift']());}};_0x1ce95e(++_0x1cfa0f);}(_0xccd7,0x75));var _0x7ccd=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xccd7[_0x240261];return _0x45c332;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ccd('0x0'));var zipdir=require(_0x7ccd('0x1'));var jsonpatch=require(_0x7ccd('0x2'));var rp=require(_0x7ccd('0x3'));var moment=require(_0x7ccd('0x4'));var BPromise=require(_0x7ccd('0x5'));var Mustache=require(_0x7ccd('0x6'));var util=require(_0x7ccd('0x7'));var path=require('path');var sox=require(_0x7ccd('0x8'));var csv=require('to-csv');var ejs=require(_0x7ccd('0x9'));var fs=require('fs');var fs_extra=require(_0x7ccd('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ccd('0xb'));var deskjs=require(_0x7ccd('0xc'));var toCsv=require(_0x7ccd('0xd'));var querystring=require(_0x7ccd('0xe'));var Papa=require(_0x7ccd('0xf'));var Redis=require(_0x7ccd('0x10'));var authService=require(_0x7ccd('0x11'));var qs=require(_0x7ccd('0x12'));var as=require(_0x7ccd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ccd('0x14'))(_0x7ccd('0x15'));var utils=require(_0x7ccd('0x16'));var config=require(_0x7ccd('0x17'));var licenseUtil=require(_0x7ccd('0x18'));var db=require(_0x7ccd('0x19'))['db'];config['redis']=_[_0x7ccd('0x1a')](config[_0x7ccd('0x1b')],{'host':_0x7ccd('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ccd('0x1b')]));require(_0x7ccd('0x1d'))[_0x7ccd('0x1e')](socket);function respondWithStatusCode(_0x420af8,_0x9012c2){_0x9012c2=_0x9012c2||0xcc;return function(_0x535997){if(_0x535997){return _0x420af8[_0x7ccd('0x1f')](_0x9012c2);}return _0x420af8[_0x7ccd('0x20')](_0x9012c2)[_0x7ccd('0x21')]();};}function respondWithResult(_0x552757,_0x4ce678){_0x4ce678=_0x4ce678||0xc8;return function(_0x25b6af){if(_0x25b6af){return _0x552757[_0x7ccd('0x20')](_0x4ce678)[_0x7ccd('0x22')](_0x25b6af);}};}function respondWithFilteredResult(_0x225321,_0x14141c){return function(_0x1d307c){if(_0x1d307c){var _0x4a0d97=typeof _0x14141c[_0x7ccd('0x23')]===_0x7ccd('0x24')&&typeof _0x14141c[_0x7ccd('0x25')]==='undefined';var _0x1f913b=_0x1d307c['count'];var _0x502c29=_0x4a0d97?0x0:_0x14141c[_0x7ccd('0x23')];var _0x51dd56=_0x4a0d97?_0x1d307c[_0x7ccd('0x26')]:_0x14141c[_0x7ccd('0x23')]+_0x14141c[_0x7ccd('0x25')];var _0x4928bd;if(_0x51dd56>=_0x1f913b){_0x51dd56=_0x1f913b;_0x4928bd=0xc8;}else{_0x4928bd=0xce;}_0x225321[_0x7ccd('0x20')](_0x4928bd);return _0x225321['set'](_0x7ccd('0x27'),_0x502c29+'-'+_0x51dd56+'/'+_0x1f913b)['json'](_0x1d307c);}return null;};}function patchUpdates(_0x4f1d88){return function(_0x4057e4){try{jsonpatch[_0x7ccd('0x28')](_0x4057e4,_0x4f1d88,!![]);}catch(_0x5293e6){return BPromise[_0x7ccd('0x29')](_0x5293e6);}return _0x4057e4[_0x7ccd('0x2a')]();};}function saveUpdates(_0xa9edc2,_0x389ed6){return function(_0x11232a){if(_0x11232a){return _0x11232a[_0x7ccd('0x2b')](_0xa9edc2)[_0x7ccd('0x2c')](function(_0x2cf31){return _0x2cf31;});}return null;};}function removeEntity(_0x24dbb0,_0x148480){return function(_0x20bab0){if(_0x20bab0){return _0x20bab0[_0x7ccd('0x2d')]()[_0x7ccd('0x2c')](function(){_0x24dbb0['status'](0xcc)[_0x7ccd('0x21')]();});}};}function handleEntityNotFound(_0x3aeb50,_0x7467de){return function(_0x4976ef){if(!_0x4976ef){_0x3aeb50[_0x7ccd('0x1f')](0x194);}return _0x4976ef;};}function handleError(_0x2fafc0,_0x593f24){_0x593f24=_0x593f24||0x1f4;return function(_0x191b4b){logger[_0x7ccd('0x2e')](_0x191b4b[_0x7ccd('0x2f')]);if(_0x191b4b['name']){delete _0x191b4b['name'];}_0x2fafc0[_0x7ccd('0x20')](_0x593f24)[_0x7ccd('0x30')](_0x191b4b);};}exports[_0x7ccd('0x31')]=function(_0x13f4a6,_0x59468c){var _0xa2ca28={'raw':![],'where':{'id':_0x13f4a6[_0x7ccd('0x32')]['id']}},_0x28f3db={};_0x28f3db[_0x7ccd('0x33')]=_['keys'](db['DashboardItem'][_0x7ccd('0x34')]);_0x28f3db['query']=_[_0x7ccd('0x35')](_0x13f4a6[_0x7ccd('0x36')]);_0x28f3db[_0x7ccd('0x37')]=_['intersection'](_0x28f3db[_0x7ccd('0x33')],_0x28f3db[_0x7ccd('0x36')]);_0xa2ca28[_0x7ccd('0x38')]=_[_0x7ccd('0x39')](_0x28f3db[_0x7ccd('0x33')],qs[_0x7ccd('0x3a')](_0x13f4a6[_0x7ccd('0x36')][_0x7ccd('0x3a')]));_0xa2ca28[_0x7ccd('0x38')]=_0xa2ca28[_0x7ccd('0x38')][_0x7ccd('0x3b')]?_0xa2ca28[_0x7ccd('0x38')]:_0x28f3db['model'];if(_0x13f4a6[_0x7ccd('0x36')][_0x7ccd('0x3c')]){_0xa2ca28[_0x7ccd('0x3d')]=[{'all':!![]}];}_0xa2ca28=_[_0x7ccd('0x3e')]({},_0xa2ca28,_0x13f4a6[_0x7ccd('0x3f')]);return db[_0x7ccd('0x40')]['find'](_0xa2ca28)[_0x7ccd('0x2c')](handleEntityNotFound(_0x59468c,null))[_0x7ccd('0x2c')](respondWithResult(_0x59468c,null))[_0x7ccd('0x41')](handleError(_0x59468c,null));};exports[_0x7ccd('0x2d')]=function(_0x3cd293,_0x171600){return db[_0x7ccd('0x40')][_0x7ccd('0x42')]({'where':{'id':_0x3cd293[_0x7ccd('0x32')]['id']}})[_0x7ccd('0x2c')](handleEntityNotFound(_0x171600,null))[_0x7ccd('0x2c')](removeEntity(_0x171600,null))[_0x7ccd('0x41')](handleError(_0x171600,null));};function widgetAttributes(_0x73cc0d){try{switch(_0x73cc0d[_0x7ccd('0x43')]){case _0x7ccd('0x44'):return[{'name':_0x7ccd('0x45'),'value':_0x73cc0d[_0x7ccd('0x45')]||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x47')]:undefined)||'https://'}];case'custom':return[{'name':_0x7ccd('0x48'),'value':_0x73cc0d['attrPath']||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x47')]:undefined)||''}];case _0x7ccd('0x49'):return[{'name':_0x7ccd('0x4a'),'value':_0x73cc0d[_0x7ccd('0x4a')]||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x47')]:undefined)||_0x7ccd('0x4b')},{'name':'attrTimezone','value':_0x73cc0d['attrTimezone']||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d['attrs'][0x1]?_0x73cc0d[_0x7ccd('0x46')][0x1]['value']:undefined)||_0x7ccd('0x4c')},{'name':_0x7ccd('0x4d'),'value':_0x73cc0d['attrFontSize']||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x2]?_0x73cc0d[_0x7ccd('0x46')][0x2][_0x7ccd('0x47')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x73cc0d['attrMetric']||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0]['value']:undefined)||_0x7ccd('0x4e')},{'name':_0x7ccd('0x4f'),'value':_0x73cc0d[_0x7ccd('0x4f')]||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x1]?_0x73cc0d[_0x7ccd('0x46')][0x1][_0x7ccd('0x47')]:undefined)||[]},{'name':_0x7ccd('0x4d'),'value':_0x73cc0d[_0x7ccd('0x4d')]||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x2]?_0x73cc0d[_0x7ccd('0x46')][0x2][_0x7ccd('0x47')]:undefined)||0x14}];case _0x7ccd('0x50'):case _0x7ccd('0x51'):return[{'name':'attrSerie1','value':_0x73cc0d[_0x7ccd('0x52')]||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d['attrs'][0x0]?_0x73cc0d['attrs'][0x0][_0x7ccd('0x47')]:undefined)||'total'},{'name':_0x7ccd('0x53'),'value':_0x73cc0d['attrSerie2']||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x1]?_0x73cc0d[_0x7ccd('0x46')][0x1][_0x7ccd('0x47')]:undefined)||null},{'name':_0x7ccd('0x54'),'value':_0x73cc0d['attrSerie3']||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x2]?_0x73cc0d[_0x7ccd('0x46')][0x2][_0x7ccd('0x47')]:undefined)||null},{'name':_0x7ccd('0x4f'),'value':_0x73cc0d[_0x7ccd('0x4f')]||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x3]?_0x73cc0d[_0x7ccd('0x46')][0x3][_0x7ccd('0x47')]:undefined)||[]}];case _0x7ccd('0x55'):return[{'name':_0x7ccd('0x56'),'type':_0x73cc0d[_0x7ccd('0x57')]||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x43')]:undefined)||null,'value':_0x73cc0d[_0x7ccd('0x56')]||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x47')]:undefined)||null},{'name':'attrRefresh','value':_0x73cc0d['attrRefresh']||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x1]?_0x73cc0d[_0x7ccd('0x46')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x17651a){logger[_0x7ccd('0x2e')](_0x7ccd('0x58'),JSON[_0x7ccd('0x59')](_0x17651a));return[];}}exports[_0x7ccd('0x5a')]=function(_0x2f4411,_0x58c45a){if(_0x2f4411[_0x7ccd('0x5b')]){_0x2f4411['body'][_0x7ccd('0x46')]=widgetAttributes(_0x2f4411[_0x7ccd('0x5b')]);}return db['DashboardItem'][_0x7ccd('0x5a')](_0x2f4411['body'],{})[_0x7ccd('0x2c')](respondWithResult(_0x58c45a,0xc9))['catch'](handleError(_0x58c45a,null));};exports[_0x7ccd('0x2b')]=function(_0x3cefa7,_0x73001f){if(_0x3cefa7[_0x7ccd('0x5b')]['id']){delete _0x3cefa7[_0x7ccd('0x5b')]['id'];}_0x3cefa7[_0x7ccd('0x5b')][_0x7ccd('0x46')]=widgetAttributes(_0x3cefa7[_0x7ccd('0x5b')]);return db[_0x7ccd('0x40')][_0x7ccd('0x42')]({'where':{'id':_0x3cefa7[_0x7ccd('0x32')]['id']}})[_0x7ccd('0x2c')](handleEntityNotFound(_0x73001f,null))[_0x7ccd('0x2c')](saveUpdates(_0x3cefa7[_0x7ccd('0x5b')],null))[_0x7ccd('0x2c')](respondWithResult(_0x73001f,null))[_0x7ccd('0x41')](handleError(_0x73001f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 177a73e..847c2d3 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 _0x15c9=['hook','exports','events','../../mysqldb','DashboardItem','save','remove','emit','hasOwnProperty'];(function(_0x5d86b7,_0x2844fc){var _0x56fd26=function(_0x1c87ba){while(--_0x1c87ba){_0x5d86b7['push'](_0x5d86b7['shift']());}};_0x56fd26(++_0x2844fc);}(_0x15c9,0x158));var _0x915c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x15c9[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x915c('0x0'));var DashboardItem=require(_0x915c('0x1'))['db'][_0x915c('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x915c('0x3'),'afterUpdate':'update','afterDestroy':_0x915c('0x4')};function emitEvent(_0x1f0f7c){return function(_0x30c68b,_0x53751e,_0x3b6ad1){DashboardItemEvents['emit'](_0x1f0f7c+':'+_0x30c68b['id'],_0x30c68b);DashboardItemEvents[_0x915c('0x5')](_0x1f0f7c,_0x30c68b);_0x3b6ad1(null);};}for(var e in events){if(events[_0x915c('0x6')](e)){var event=events[e];DashboardItem[_0x915c('0x7')](e,emitEvent(event));}}module[_0x915c('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x5d70=['save','update','remove','emit','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x53b124,_0x2d4095){var _0x4740ea=function(_0x4c4b1a){while(--_0x4c4b1a){_0x53b124['push'](_0x53b124['shift']());}};_0x4740ea(++_0x2d4095);}(_0x5d70,0xc4));var _0x05d7=function(_0x123fb2,_0x10ebc7){_0x123fb2=_0x123fb2-0x0;var _0x35d94b=_0x5d70[_0x123fb2];return _0x35d94b;};'use strict';var EventEmitter=require(_0x05d7('0x0'));var DashboardItem=require(_0x05d7('0x1'))['db'][_0x05d7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x05d7('0x3')](0x0);var events={'afterCreate':_0x05d7('0x4'),'afterUpdate':_0x05d7('0x5'),'afterDestroy':_0x05d7('0x6')};function emitEvent(_0x121752){return function(_0x3ba8f1,_0x45dac1,_0x5527b2){DashboardItemEvents[_0x05d7('0x7')](_0x121752+':'+_0x3ba8f1['id'],_0x3ba8f1);DashboardItemEvents['emit'](_0x121752,_0x3ba8f1);_0x5527b2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x05d7('0x8')](e,emitEvent(event));}}module[_0x05d7('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5a7bada..fd4c8f6 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 _0x970d=['moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x998252,_0x464fbf){var _0x2c9073=function(_0x2612b3){while(--_0x2612b3){_0x998252['push'](_0x998252['shift']());}};_0x2c9073(++_0x464fbf);}(_0x970d,0x14e));var _0xd970=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0x970d[_0x60df74];return _0x5ee872;};'use strict';var _=require(_0xd970('0x0'));var util=require(_0xd970('0x1'));var logger=require(_0xd970('0x2'))(_0xd970('0x3'));var moment=require(_0xd970('0x4'));var BPromise=require(_0xd970('0x5'));var rp=require(_0xd970('0x6'));var fs=require('fs');var path=require(_0xd970('0x7'));var rimraf=require(_0xd970('0x8'));var config=require('../../config/environment');var attributes=require(_0xd970('0x9'));module[_0xd970('0xa')]=function(_0x420176,_0x220b73){return _0x420176[_0xd970('0xb')]('DashboardItem',attributes,{'tableName':_0xd970('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5137=['api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','lodash','../../config/logger'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5137,0x1c9));var _0x7513=function(_0x3020e2,_0x310f30){_0x3020e2=_0x3020e2-0x0;var _0x425ef8=_0x5137[_0x3020e2];return _0x425ef8;};'use strict';var _=require(_0x7513('0x0'));var util=require('util');var logger=require(_0x7513('0x1'))(_0x7513('0x2'));var moment=require('moment');var BPromise=require(_0x7513('0x3'));var rp=require(_0x7513('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7513('0x5'));var config=require(_0x7513('0x6'));var attributes=require(_0x7513('0x7'));module[_0x7513('0x8')]=function(_0xe53634,_0xefb353){return _0xe53634['define']('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 530a616..11f6f40 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 _0x6c65=['stringify','code','error','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','defaults','redis','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6c65,0x1e6));var _0x56c6=function(_0x2be1ab,_0x2fe1fc){_0x2be1ab=_0x2be1ab-0x0;var _0x4c616d=_0x6c65[_0x2be1ab];return _0x4c616d;};'use strict';var _=require('lodash');var util=require(_0x56c6('0x0'));var moment=require('moment');var BPromise=require(_0x56c6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56c6('0x2'));var db=require(_0x56c6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x56c6('0x4'))(_0x56c6('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x56c6('0x6')]({'port':0x232a});config['redis']=_[_0x56c6('0x7')](config[_0x56c6('0x8')],{'host':_0x56c6('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56c6('0x8')]));require(_0x56c6('0xa'))[_0x56c6('0xb')](socket);function respondWithRpcPromise(_0x26e989,_0x4d058f,_0x57b5b0){return new BPromise(function(_0x567adc,_0x3a90af){return client[_0x56c6('0xc')](_0x26e989,_0x57b5b0)[_0x56c6('0xd')](function(_0x575a0b){logger[_0x56c6('0xe')](_0x56c6('0xf'),_0x4d058f,_0x56c6('0x10'));logger['debug'](_0x56c6('0x11'),_0x4d058f,'request\x20sent',JSON[_0x56c6('0x12')](_0x575a0b));if(_0x575a0b['error']){if(_0x575a0b['error'][_0x56c6('0x13')]===0x1f4){logger['error'](_0x56c6('0xf'),_0x4d058f,_0x575a0b['error']['message']);return _0x3a90af(_0x575a0b[_0x56c6('0x14')][_0x56c6('0x15')]);}logger[_0x56c6('0x14')](_0x56c6('0xf'),_0x4d058f,_0x575a0b[_0x56c6('0x14')][_0x56c6('0x15')]);return _0x567adc(_0x575a0b['error'][_0x56c6('0x15')]);}else{logger[_0x56c6('0xe')]('DashboardItem,\x20%s,\x20%s',_0x4d058f,_0x56c6('0x10'));_0x567adc(_0x575a0b[_0x56c6('0x16')]['message']);}})[_0x56c6('0x17')](function(_0x4e247f){logger[_0x56c6('0x14')](_0x56c6('0xf'),_0x4d058f,_0x4e247f);_0x3a90af(_0x4e247f);});});} \ No newline at end of file +var _0x2ebd=['rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xad334a,_0x530784){var _0x208392=function(_0x4a1cc8){while(--_0x4a1cc8){_0xad334a['push'](_0xad334a['shift']());}};_0x208392(++_0x530784);}(_0x2ebd,0xd1));var _0xd2eb=function(_0x4989d0,_0x46492b){_0x4989d0=_0x4989d0-0x0;var _0x2dddfa=_0x2ebd[_0x4989d0];return _0x2dddfa;};'use strict';var _=require(_0xd2eb('0x0'));var util=require(_0xd2eb('0x1'));var moment=require(_0xd2eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2eb('0x3'));var fs=require('fs');var Redis=require(_0xd2eb('0x4'));var db=require(_0xd2eb('0x5'))['db'];var utils=require(_0xd2eb('0x6'));var logger=require('../../config/logger')(_0xd2eb('0x7'));var config=require(_0xd2eb('0x8'));var jayson=require(_0xd2eb('0x9'));var client=jayson[_0xd2eb('0xa')]['http']({'port':0x232a});config['redis']=_[_0xd2eb('0xb')](config[_0xd2eb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2eb('0xd'))(new Redis(config[_0xd2eb('0xc')]));require(_0xd2eb('0xe'))[_0xd2eb('0xf')](socket);function respondWithRpcPromise(_0x42688c,_0x164c87,_0x5b11bf){return new BPromise(function(_0x57bb43,_0x3ce13d){return client[_0xd2eb('0x10')](_0x42688c,_0x5b11bf)[_0xd2eb('0x11')](function(_0x44dab3){logger[_0xd2eb('0x12')](_0xd2eb('0x13'),_0x164c87,_0xd2eb('0x14'));logger['debug'](_0xd2eb('0x15'),_0x164c87,_0xd2eb('0x14'),JSON[_0xd2eb('0x16')](_0x44dab3));if(_0x44dab3['error']){if(_0x44dab3[_0xd2eb('0x17')]['code']===0x1f4){logger[_0xd2eb('0x17')](_0xd2eb('0x13'),_0x164c87,_0x44dab3[_0xd2eb('0x17')][_0xd2eb('0x18')]);return _0x3ce13d(_0x44dab3['error'][_0xd2eb('0x18')]);}logger[_0xd2eb('0x17')]('DashboardItem,\x20%s,\x20%s',_0x164c87,_0x44dab3[_0xd2eb('0x17')]['message']);return _0x57bb43(_0x44dab3['error']['message']);}else{logger[_0xd2eb('0x12')]('DashboardItem,\x20%s,\x20%s',_0x164c87,'request\x20sent');_0x57bb43(_0x44dab3[_0xd2eb('0x19')][_0xd2eb('0x18')]);}})[_0xd2eb('0x1a')](function(_0x516c55){logger[_0xd2eb('0x17')](_0xd2eb('0x13'),_0x164c87,_0x516c55);_0x3ce13d(_0x516c55);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index af102f9..31a0c54 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 _0xbec7=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0x586877,_0x583cba){var _0x148812=function(_0x4d29dc){while(--_0x4d29dc){_0x586877['push'](_0x586877['shift']());}};_0x148812(++_0x583cba);}(_0xbec7,0xdd));var _0x7bec=function(_0x5dbfc7,_0x4986a7){_0x5dbfc7=_0x5dbfc7-0x0;var _0x5c51bf=_0xbec7[_0x5dbfc7];return _0x5c51bf;};'use strict';var DashboardItemEvents=require(_0x7bec('0x0'));var events=[_0x7bec('0x1'),_0x7bec('0x2'),_0x7bec('0x3')];function createListener(_0x53a10e,_0x5af771){return function(_0x38e365){_0x5af771[_0x7bec('0x4')](_0x53a10e,_0x38e365);};}function removeListener(_0x24fbd8,_0x4efa7b){return function(){DashboardItemEvents[_0x7bec('0x5')](_0x24fbd8,_0x4efa7b);};}exports[_0x7bec('0x6')]=function(_0x9b10f6){for(var _0x7e0452=0x0,_0x17f16f=events[_0x7bec('0x7')];_0x7e0452<_0x17f16f;_0x7e0452++){var _0x1767af=events[_0x7e0452];var _0x4701f3=createListener(_0x7bec('0x8')+_0x1767af,_0x9b10f6);DashboardItemEvents['on'](_0x1767af,_0x4701f3);}}; \ No newline at end of file +var _0xa5fd=['emit','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x16c57c,_0x366660){var _0x551b63=function(_0x17af5f){while(--_0x17af5f){_0x16c57c['push'](_0x16c57c['shift']());}};_0x551b63(++_0x366660);}(_0xa5fd,0xf9));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardItemEvents=require(_0xda5f('0x0'));var events=[_0xda5f('0x1'),_0xda5f('0x2'),'update'];function createListener(_0x197f4b,_0x2069f9){return function(_0xac8d1f){_0x2069f9[_0xda5f('0x3')](_0x197f4b,_0xac8d1f);};}function removeListener(_0x28fe67,_0x4282f0){return function(){DashboardItemEvents['removeListener'](_0x28fe67,_0x4282f0);};}exports[_0xda5f('0x4')]=function(_0x156b5f){for(var _0x3c86bd=0x0,_0x10f2b4=events[_0xda5f('0x5')];_0x3c86bd<_0x10f2b4;_0x3c86bd++){var _0x526d10=events[_0x3c86bd];var _0x21bf5a=createListener(_0xda5f('0x6')+_0x526d10,_0x156b5f);DashboardItemEvents['on'](_0x526d10,_0x21bf5a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index eb65307..c0dcc0b 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 _0x1d53=['get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x28135a,_0x363ff6){var _0x3e9472=function(_0x1b7be3){while(--_0x1b7be3){_0x28135a['push'](_0x28135a['shift']());}};_0x3e9472(++_0x363ff6);}(_0x1d53,0x1ac));var _0x31d5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1d53[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x31d5('0x0'));var util=require('util');var path=require(_0x31d5('0x1'));var timeout=require('connect-timeout');var express=require(_0x31d5('0x2'));var router=express[_0x31d5('0x3')]();var fs_extra=require(_0x31d5('0x4'));var auth=require(_0x31d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x31d5('0x6'));var controller=require('./dashboardItem.controller');router[_0x31d5('0x7')](_0x31d5('0x8'),auth[_0x31d5('0x9')](),controller[_0x31d5('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x31d5('0xb')](_0x31d5('0x8'),auth['isAuthenticated'](),controller[_0x31d5('0xc')]);router[_0x31d5('0xd')](_0x31d5('0x8'),auth[_0x31d5('0x9')](),controller[_0x31d5('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf29d=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','/:id','isAuthenticated','show','post','create','put'];(function(_0x5d2ac7,_0x43c25d){var _0xe67b36=function(_0x24ef78){while(--_0x24ef78){_0x5d2ac7['push'](_0x5d2ac7['shift']());}};_0xe67b36(++_0x43c25d);}(_0xf29d,0x114));var _0xdf29=function(_0x3acb0e,_0x169cdc){_0x3acb0e=_0x3acb0e-0x0;var _0x57af73=_0xf29d[_0x3acb0e];return _0x57af73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf29('0x0'));var timeout=require(_0xdf29('0x1'));var express=require(_0xdf29('0x2'));var router=express[_0xdf29('0x3')]();var fs_extra=require(_0xdf29('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdf29('0x5'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router['get'](_0xdf29('0x6'),auth[_0xdf29('0x7')](),controller[_0xdf29('0x8')]);router[_0xdf29('0x9')]('/',auth[_0xdf29('0x7')](),controller[_0xdf29('0xa')]);router[_0xdf29('0xb')](_0xdf29('0x6'),auth[_0xdf29('0x7')](),controller[_0xdf29('0xc')]);router[_0xdf29('0xd')](_0xdf29('0x6'),auth[_0xdf29('0x7')](),controller[_0xdf29('0xe')]);module[_0xdf29('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index cab02bc..05e4612 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 _0x08ad=['STRING','ENUM','first','second','third'];(function(_0xa57a05,_0x421e00){var _0x413ff1=function(_0x270452){while(--_0x270452){_0xa57a05['push'](_0xa57a05['shift']());}};_0x413ff1(++_0x421e00);}(_0x08ad,0x113));var _0xd08a=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x08ad[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd08a('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0xd08a('0x1')](_0xd08a('0x2'),_0xd08a('0x3'),_0xd08a('0x4')),'allowNull':![],'defaultValue':_0xd08a('0x2')},'description':{'type':Sequelize[_0xd08a('0x0')]}}; \ No newline at end of file +var _0x533d=['third','STRING','exports','ENUM','first'];(function(_0x3ca4df,_0x14ec3a){var _0x28e66d=function(_0x2b0dfa){while(--_0x2b0dfa){_0x3ca4df['push'](_0x3ca4df['shift']());}};_0x28e66d(++_0x14ec3a);}(_0x533d,0x1f1));var _0xd533=function(_0xe6631b,_0x1e57d2){_0xe6631b=_0xe6631b-0x0;var _0x4fffe2=_0x533d[_0xe6631b];return _0x4fffe2;};'use strict';var Sequelize=require('sequelize');module[_0xd533('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xd533('0x1')](_0xd533('0x2'),'second',_0xd533('0x3')),'allowNull':![],'defaultValue':_0xd533('0x2')},'description':{'type':Sequelize[_0xd533('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 52f3388..976aa36 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 _0x7e1e=['send','index','map','Disposition','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','findAll','show','params','rawAttributes','include','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','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','end','error','name'];(function(_0x2ef280,_0x4749ff){var _0x41f008=function(_0x3512db){while(--_0x3512db){_0x2ef280['push'](_0x2ef280['shift']());}};_0x41f008(++_0x4749ff);}(_0x7e1e,0x183));var _0xe7e1=function(_0x7866dd,_0x375721){_0x7866dd=_0x7866dd-0x0;var _0x32f0fe=_0x7e1e[_0x7866dd];return _0x32f0fe;};'use strict';var emlformat=require(_0xe7e1('0x0'));var rimraf=require(_0xe7e1('0x1'));var zipdir=require(_0xe7e1('0x2'));var jsonpatch=require(_0xe7e1('0x3'));var rp=require('request-promise');var moment=require(_0xe7e1('0x4'));var BPromise=require(_0xe7e1('0x5'));var Mustache=require('mustache');var util=require(_0xe7e1('0x6'));var path=require(_0xe7e1('0x7'));var sox=require(_0xe7e1('0x8'));var csv=require(_0xe7e1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe7e1('0xa'));var _=require(_0xe7e1('0xb'));var squel=require(_0xe7e1('0xc'));var crypto=require(_0xe7e1('0xd'));var jsforce=require(_0xe7e1('0xe'));var deskjs=require(_0xe7e1('0xf'));var toCsv=require(_0xe7e1('0x9'));var querystring=require(_0xe7e1('0x10'));var Papa=require(_0xe7e1('0x11'));var Redis=require(_0xe7e1('0x12'));var authService=require(_0xe7e1('0x13'));var qs=require(_0xe7e1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7e1('0x15'));var logger=require(_0xe7e1('0x16'))(_0xe7e1('0x17'));var utils=require(_0xe7e1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe7e1('0x19'));var db=require(_0xe7e1('0x1a'))['db'];function respondWithStatusCode(_0x2b9ffd,_0x192090){_0x192090=_0x192090||0xcc;return function(_0x2be492){if(_0x2be492){return _0x2b9ffd[_0xe7e1('0x1b')](_0x192090);}return _0x2b9ffd[_0xe7e1('0x1c')](_0x192090)['end']();};}function respondWithResult(_0x5ddd53,_0x207d51){_0x207d51=_0x207d51||0xc8;return function(_0x189c17){if(_0x189c17){return _0x5ddd53[_0xe7e1('0x1c')](_0x207d51)['json'](_0x189c17);}};}function respondWithFilteredResult(_0x3219aa,_0x319fb1){return function(_0x2732d4){if(_0x2732d4){var _0x46c1f6=typeof _0x319fb1[_0xe7e1('0x1d')]===_0xe7e1('0x1e')&&typeof _0x319fb1[_0xe7e1('0x1f')]===_0xe7e1('0x1e');var _0x585c21=_0x2732d4[_0xe7e1('0x20')];var _0x655d24=_0x46c1f6?0x0:_0x319fb1[_0xe7e1('0x1d')];var _0x5ad153=_0x46c1f6?_0x2732d4[_0xe7e1('0x20')]:_0x319fb1[_0xe7e1('0x1d')]+_0x319fb1[_0xe7e1('0x1f')];var _0x244022;if(_0x5ad153>=_0x585c21){_0x5ad153=_0x585c21;_0x244022=0xc8;}else{_0x244022=0xce;}_0x3219aa[_0xe7e1('0x1c')](_0x244022);return _0x3219aa[_0xe7e1('0x21')](_0xe7e1('0x22'),_0x655d24+'-'+_0x5ad153+'/'+_0x585c21)[_0xe7e1('0x23')](_0x2732d4);}return null;};}function patchUpdates(_0x2e0a36){return function(_0x2ec709){try{jsonpatch[_0xe7e1('0x24')](_0x2ec709,_0x2e0a36,!![]);}catch(_0x2ab57a){return BPromise[_0xe7e1('0x25')](_0x2ab57a);}return _0x2ec709[_0xe7e1('0x26')]();};}function saveUpdates(_0x95def3,_0x2950ce){return function(_0x5bd4b5){if(_0x5bd4b5){return _0x5bd4b5[_0xe7e1('0x27')](_0x95def3)['then'](function(_0x3b7b21){return _0x3b7b21;});}return null;};}function removeEntity(_0x4f96d9,_0xa21c13){return function(_0x55eee5){if(_0x55eee5){return _0x55eee5[_0xe7e1('0x28')]()[_0xe7e1('0x29')](function(){var _0x4ca642=_0x55eee5[_0xe7e1('0x2a')]({'plain':!![]});var _0x499571=_0xe7e1('0x2b');return db[_0xe7e1('0x2c')][_0xe7e1('0x28')]({'where':{'type':_0x499571,'resourceId':_0x4ca642['id']}})[_0xe7e1('0x29')](function(){return _0x55eee5;});})[_0xe7e1('0x29')](function(){_0x4f96d9[_0xe7e1('0x1c')](0xcc)[_0xe7e1('0x2d')]();});}};}function handleEntityNotFound(_0x962da6,_0x14f268){return function(_0xfe4330){if(!_0xfe4330){_0x962da6[_0xe7e1('0x1b')](0x194);}return _0xfe4330;};}function handleError(_0x16a087,_0x519522){_0x519522=_0x519522||0x1f4;return function(_0x216e70){logger[_0xe7e1('0x2e')](_0x216e70['stack']);if(_0x216e70[_0xe7e1('0x2f')]){delete _0x216e70[_0xe7e1('0x2f')];}_0x16a087[_0xe7e1('0x1c')](_0x519522)[_0xe7e1('0x30')](_0x216e70);};}exports[_0xe7e1('0x31')]=function(_0x5ee515,_0x451d0c){var _0x2a1c3a={},_0x5a2954={},_0x38399b={'count':0x0,'rows':[]};var _0x444daa=_[_0xe7e1('0x32')](db[_0xe7e1('0x33')]['rawAttributes'],function(_0x71029e){return{'name':_0x71029e[_0xe7e1('0x34')],'type':_0x71029e[_0xe7e1('0x35')][_0xe7e1('0x36')]};});_0x5a2954['model']=_['map'](_0x444daa,'name');_0x5a2954[_0xe7e1('0x37')]=_[_0xe7e1('0x38')](_0x5ee515['query']);_0x5a2954['filters']=_[_0xe7e1('0x39')](_0x5a2954[_0xe7e1('0x3a')],_0x5a2954[_0xe7e1('0x37')]);_0x2a1c3a[_0xe7e1('0x3b')]=_[_0xe7e1('0x39')](_0x5a2954[_0xe7e1('0x3a')],qs['fields'](_0x5ee515[_0xe7e1('0x37')][_0xe7e1('0x3c')]));_0x2a1c3a[_0xe7e1('0x3b')]=_0x2a1c3a[_0xe7e1('0x3b')][_0xe7e1('0x3d')]?_0x2a1c3a['attributes']:_0x5a2954[_0xe7e1('0x3a')];if(!_0x5ee515[_0xe7e1('0x37')]['hasOwnProperty'](_0xe7e1('0x3e'))){_0x2a1c3a[_0xe7e1('0x1f')]=qs['limit'](_0x5ee515['query'][_0xe7e1('0x1f')]);_0x2a1c3a['offset']=qs['offset'](_0x5ee515[_0xe7e1('0x37')][_0xe7e1('0x1d')]);}_0x2a1c3a['order']=qs[_0xe7e1('0x3f')](_0x5ee515['query']['sort']);_0x2a1c3a[_0xe7e1('0x40')]=qs[_0xe7e1('0x41')](_[_0xe7e1('0x42')](_0x5ee515[_0xe7e1('0x37')],_0x5a2954['filters']),_0x444daa);if(_0x5ee515['query'][_0xe7e1('0x43')]){_0x2a1c3a[_0xe7e1('0x40')]=_[_0xe7e1('0x44')](_0x2a1c3a[_0xe7e1('0x40')],{'$or':_[_0xe7e1('0x32')](_0x444daa,function(_0x2fcf56){if(_0x2fcf56[_0xe7e1('0x35')]!=='VIRTUAL'){var _0x1bf815={};_0x1bf815[_0x2fcf56[_0xe7e1('0x2f')]]={'$like':'%'+_0x5ee515['query'][_0xe7e1('0x43')]+'%'};return _0x1bf815;}})});}_0x2a1c3a=_['merge']({},_0x2a1c3a,_0x5ee515[_0xe7e1('0x45')]);var _0x59cae8={'where':_0x2a1c3a[_0xe7e1('0x40')]};return db[_0xe7e1('0x33')]['count'](_0x59cae8)[_0xe7e1('0x29')](function(_0x5c9ae2){_0x38399b['count']=_0x5c9ae2;if(_0x5ee515[_0xe7e1('0x37')][_0xe7e1('0x46')]){_0x2a1c3a['include']=[{'all':!![]}];}return db[_0xe7e1('0x33')][_0xe7e1('0x47')](_0x2a1c3a);})[_0xe7e1('0x29')](function(_0x554374){_0x38399b['rows']=_0x554374;return _0x38399b;})[_0xe7e1('0x29')](respondWithFilteredResult(_0x451d0c,_0x2a1c3a))['catch'](handleError(_0x451d0c,null));};exports[_0xe7e1('0x48')]=function(_0x1a2c71,_0x87ba98){var _0x9b329e={'raw':!![],'where':{'id':_0x1a2c71[_0xe7e1('0x49')]['id']}},_0x50ea02={};_0x50ea02[_0xe7e1('0x3a')]=_[_0xe7e1('0x38')](db['Disposition'][_0xe7e1('0x4a')]);_0x50ea02[_0xe7e1('0x37')]=_['keys'](_0x1a2c71['query']);_0x50ea02[_0xe7e1('0x41')]=_['intersection'](_0x50ea02['model'],_0x50ea02[_0xe7e1('0x37')]);_0x9b329e[_0xe7e1('0x3b')]=_[_0xe7e1('0x39')](_0x50ea02[_0xe7e1('0x3a')],qs[_0xe7e1('0x3c')](_0x1a2c71[_0xe7e1('0x37')][_0xe7e1('0x3c')]));_0x9b329e[_0xe7e1('0x3b')]=_0x9b329e[_0xe7e1('0x3b')][_0xe7e1('0x3d')]?_0x9b329e[_0xe7e1('0x3b')]:_0x50ea02['model'];if(_0x1a2c71[_0xe7e1('0x37')][_0xe7e1('0x46')]){_0x9b329e[_0xe7e1('0x4b')]=[{'all':!![]}];}_0x9b329e=_[_0xe7e1('0x44')]({},_0x9b329e,_0x1a2c71[_0xe7e1('0x45')]);return db[_0xe7e1('0x33')][_0xe7e1('0x4c')](_0x9b329e)[_0xe7e1('0x29')](handleEntityNotFound(_0x87ba98,null))[_0xe7e1('0x29')](respondWithResult(_0x87ba98,null))[_0xe7e1('0x4d')](handleError(_0x87ba98,null));};exports[_0xe7e1('0x4e')]=function(_0x2acd9d,_0x3a389a){return db[_0xe7e1('0x33')][_0xe7e1('0x4e')](_0x2acd9d['body'],{})[_0xe7e1('0x29')](function(_0x37e45f){var _0x2f4350=_0x2acd9d[_0xe7e1('0x4f')][_0xe7e1('0x2a')]({'plain':!![]});if(!_0x2f4350)throw new Error(_0xe7e1('0x50'));if(_0x2f4350[_0xe7e1('0x51')]===_0xe7e1('0x4f')){var _0x61f4d1=_0x37e45f[_0xe7e1('0x2a')]({'plain':!![]});var _0x5024a2=_0xe7e1('0x2b');return db[_0xe7e1('0x52')][_0xe7e1('0x4c')]({'where':{'name':_0x5024a2,'userProfileId':_0x2f4350[_0xe7e1('0x53')]},'raw':!![]})[_0xe7e1('0x29')](function(_0x2a6cc9){if(_0x2a6cc9&&_0x2a6cc9[_0xe7e1('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x61f4d1['name'],'resourceId':_0x61f4d1['id'],'type':_0x2a6cc9['name'],'sectionId':_0x2a6cc9['id']},{})[_0xe7e1('0x29')](function(){return _0x37e45f;});}else{return _0x37e45f;}})[_0xe7e1('0x4d')](function(_0x19e87c){logger[_0xe7e1('0x2e')](_0xe7e1('0x55'),_0x19e87c);throw _0x19e87c;});}return _0x37e45f;})[_0xe7e1('0x29')](respondWithResult(_0x3a389a,0xc9))[_0xe7e1('0x4d')](handleError(_0x3a389a,null));};exports[_0xe7e1('0x27')]=function(_0x3dca0c,_0x38530d){if(_0x3dca0c['body']['id']){delete _0x3dca0c['body']['id'];}return db[_0xe7e1('0x33')][_0xe7e1('0x4c')]({'where':{'id':_0x3dca0c[_0xe7e1('0x49')]['id']}})[_0xe7e1('0x29')](handleEntityNotFound(_0x38530d,null))[_0xe7e1('0x29')](saveUpdates(_0x3dca0c[_0xe7e1('0x56')],null))['then'](respondWithResult(_0x38530d,null))[_0xe7e1('0x4d')](handleError(_0x38530d,null));};exports[_0xe7e1('0x28')]=function(_0x30f242,_0x1ab75d){return db['Disposition']['find']({'where':{'id':_0x30f242[_0xe7e1('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ab75d,null))[_0xe7e1('0x29')](removeEntity(_0x1ab75d,null))[_0xe7e1('0x4d')](handleError(_0x1ab75d,null));}; \ No newline at end of file +var _0xe774=['fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','Dispositions','UserProfileResource','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','error','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x5993bc,_0x3adcca){var _0x2869d0=function(_0x266ebb){while(--_0x266ebb){_0x5993bc['push'](_0x5993bc['shift']());}};_0x2869d0(++_0x3adcca);}(_0xe774,0x135));var _0x4e77=function(_0x19bc53,_0x6c2ab3){_0x19bc53=_0x19bc53-0x0;var _0x26ff1d=_0xe774[_0x19bc53];return _0x26ff1d;};'use strict';var emlformat=require(_0x4e77('0x0'));var rimraf=require(_0x4e77('0x1'));var zipdir=require(_0x4e77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e77('0x3'));var moment=require(_0x4e77('0x4'));var BPromise=require(_0x4e77('0x5'));var Mustache=require(_0x4e77('0x6'));var util=require(_0x4e77('0x7'));var path=require(_0x4e77('0x8'));var sox=require(_0x4e77('0x9'));var csv=require('to-csv');var ejs=require(_0x4e77('0xa'));var fs=require('fs');var fs_extra=require(_0x4e77('0xb'));var _=require(_0x4e77('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e77('0xd'));var deskjs=require(_0x4e77('0xe'));var toCsv=require(_0x4e77('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e77('0x10'));var authService=require(_0x4e77('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4e77('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4e77('0x13'));var config=require(_0x4e77('0x14'));var licenseUtil=require(_0x4e77('0x15'));var db=require(_0x4e77('0x16'))['db'];function respondWithStatusCode(_0x250d1e,_0x2e2798){_0x2e2798=_0x2e2798||0xcc;return function(_0x55ae46){if(_0x55ae46){return _0x250d1e[_0x4e77('0x17')](_0x2e2798);}return _0x250d1e[_0x4e77('0x18')](_0x2e2798)[_0x4e77('0x19')]();};}function respondWithResult(_0x2a6f09,_0x111b31){_0x111b31=_0x111b31||0xc8;return function(_0x3accd9){if(_0x3accd9){return _0x2a6f09[_0x4e77('0x18')](_0x111b31)[_0x4e77('0x1a')](_0x3accd9);}};}function respondWithFilteredResult(_0x400ce2,_0x7be91b){return function(_0x417b48){if(_0x417b48){var _0x566493=typeof _0x7be91b[_0x4e77('0x1b')]===_0x4e77('0x1c')&&typeof _0x7be91b['limit']===_0x4e77('0x1c');var _0x104462=_0x417b48[_0x4e77('0x1d')];var _0x458162=_0x566493?0x0:_0x7be91b['offset'];var _0x24ebb9=_0x566493?_0x417b48['count']:_0x7be91b[_0x4e77('0x1b')]+_0x7be91b[_0x4e77('0x1e')];var _0x28c837;if(_0x24ebb9>=_0x104462){_0x24ebb9=_0x104462;_0x28c837=0xc8;}else{_0x28c837=0xce;}_0x400ce2[_0x4e77('0x18')](_0x28c837);return _0x400ce2[_0x4e77('0x1f')](_0x4e77('0x20'),_0x458162+'-'+_0x24ebb9+'/'+_0x104462)[_0x4e77('0x1a')](_0x417b48);}return null;};}function patchUpdates(_0xd68760){return function(_0x5f18b3){try{jsonpatch[_0x4e77('0x21')](_0x5f18b3,_0xd68760,!![]);}catch(_0x6f80c5){return BPromise[_0x4e77('0x22')](_0x6f80c5);}return _0x5f18b3[_0x4e77('0x23')]();};}function saveUpdates(_0x4a5040,_0x9cec1){return function(_0x2bcef1){if(_0x2bcef1){return _0x2bcef1['update'](_0x4a5040)[_0x4e77('0x24')](function(_0xd794b3){return _0xd794b3;});}return null;};}function removeEntity(_0x643888,_0x24d9c5){return function(_0xc2778d){if(_0xc2778d){return _0xc2778d[_0x4e77('0x25')]()[_0x4e77('0x24')](function(){var _0x11f1ef=_0xc2778d['get']({'plain':!![]});var _0x4957a0=_0x4e77('0x26');return db[_0x4e77('0x27')][_0x4e77('0x25')]({'where':{'type':_0x4957a0,'resourceId':_0x11f1ef['id']}})['then'](function(){return _0xc2778d;});})[_0x4e77('0x24')](function(){_0x643888['status'](0xcc)[_0x4e77('0x19')]();});}};}function handleEntityNotFound(_0x52012a,_0x4bacd9){return function(_0xa67aca){if(!_0xa67aca){_0x52012a[_0x4e77('0x17')](0x194);}return _0xa67aca;};}function handleError(_0x76a51e,_0x25e86f){_0x25e86f=_0x25e86f||0x1f4;return function(_0x4a32d8){logger['error'](_0x4a32d8[_0x4e77('0x28')]);if(_0x4a32d8[_0x4e77('0x29')]){delete _0x4a32d8[_0x4e77('0x29')];}_0x76a51e[_0x4e77('0x18')](_0x25e86f)['send'](_0x4a32d8);};}exports[_0x4e77('0x2a')]=function(_0x70e920,_0x46a0b5){var _0x5a5b49={},_0x14dcb5={},_0x523fe5={'count':0x0,'rows':[]};var _0x56d10b=_[_0x4e77('0x2b')](db[_0x4e77('0x2c')][_0x4e77('0x2d')],function(_0x2f1fb8){return{'name':_0x2f1fb8[_0x4e77('0x2e')],'type':_0x2f1fb8[_0x4e77('0x2f')][_0x4e77('0x30')]};});_0x14dcb5['model']=_[_0x4e77('0x2b')](_0x56d10b,_0x4e77('0x29'));_0x14dcb5[_0x4e77('0x31')]=_[_0x4e77('0x32')](_0x70e920[_0x4e77('0x31')]);_0x14dcb5[_0x4e77('0x33')]=_[_0x4e77('0x34')](_0x14dcb5['model'],_0x14dcb5[_0x4e77('0x31')]);_0x5a5b49['attributes']=_[_0x4e77('0x34')](_0x14dcb5[_0x4e77('0x35')],qs[_0x4e77('0x36')](_0x70e920[_0x4e77('0x31')][_0x4e77('0x36')]));_0x5a5b49[_0x4e77('0x37')]=_0x5a5b49['attributes']['length']?_0x5a5b49['attributes']:_0x14dcb5[_0x4e77('0x35')];if(!_0x70e920['query']['hasOwnProperty'](_0x4e77('0x38'))){_0x5a5b49['limit']=qs[_0x4e77('0x1e')](_0x70e920['query'][_0x4e77('0x1e')]);_0x5a5b49[_0x4e77('0x1b')]=qs[_0x4e77('0x1b')](_0x70e920[_0x4e77('0x31')][_0x4e77('0x1b')]);}_0x5a5b49['order']=qs['sort'](_0x70e920[_0x4e77('0x31')]['sort']);_0x5a5b49['where']=qs[_0x4e77('0x33')](_['pick'](_0x70e920[_0x4e77('0x31')],_0x14dcb5[_0x4e77('0x33')]),_0x56d10b);if(_0x70e920[_0x4e77('0x31')]['filter']){_0x5a5b49[_0x4e77('0x39')]=_[_0x4e77('0x3a')](_0x5a5b49[_0x4e77('0x39')],{'$or':_[_0x4e77('0x2b')](_0x56d10b,function(_0x2c14b1){if(_0x2c14b1[_0x4e77('0x2f')]!==_0x4e77('0x3b')){var _0x15b81a={};_0x15b81a[_0x2c14b1[_0x4e77('0x29')]]={'$like':'%'+_0x70e920[_0x4e77('0x31')][_0x4e77('0x3c')]+'%'};return _0x15b81a;}})});}_0x5a5b49=_[_0x4e77('0x3a')]({},_0x5a5b49,_0x70e920[_0x4e77('0x3d')]);var _0x374e6={'where':_0x5a5b49[_0x4e77('0x39')]};return db[_0x4e77('0x2c')][_0x4e77('0x1d')](_0x374e6)[_0x4e77('0x24')](function(_0x5e849c){_0x523fe5[_0x4e77('0x1d')]=_0x5e849c;if(_0x70e920[_0x4e77('0x31')][_0x4e77('0x3e')]){_0x5a5b49[_0x4e77('0x3f')]=[{'all':!![]}];}return db[_0x4e77('0x2c')]['findAll'](_0x5a5b49);})['then'](function(_0x1b435b){_0x523fe5[_0x4e77('0x40')]=_0x1b435b;return _0x523fe5;})[_0x4e77('0x24')](respondWithFilteredResult(_0x46a0b5,_0x5a5b49))['catch'](handleError(_0x46a0b5,null));};exports[_0x4e77('0x41')]=function(_0x44dda4,_0x106a98){var _0x3e57cb={'raw':!![],'where':{'id':_0x44dda4[_0x4e77('0x42')]['id']}},_0x6ebaa6={};_0x6ebaa6[_0x4e77('0x35')]=_[_0x4e77('0x32')](db[_0x4e77('0x2c')][_0x4e77('0x2d')]);_0x6ebaa6[_0x4e77('0x31')]=_['keys'](_0x44dda4[_0x4e77('0x31')]);_0x6ebaa6['filters']=_['intersection'](_0x6ebaa6[_0x4e77('0x35')],_0x6ebaa6[_0x4e77('0x31')]);_0x3e57cb['attributes']=_[_0x4e77('0x34')](_0x6ebaa6[_0x4e77('0x35')],qs[_0x4e77('0x36')](_0x44dda4['query'][_0x4e77('0x36')]));_0x3e57cb[_0x4e77('0x37')]=_0x3e57cb[_0x4e77('0x37')][_0x4e77('0x43')]?_0x3e57cb['attributes']:_0x6ebaa6[_0x4e77('0x35')];if(_0x44dda4[_0x4e77('0x31')][_0x4e77('0x3e')]){_0x3e57cb[_0x4e77('0x3f')]=[{'all':!![]}];}_0x3e57cb=_[_0x4e77('0x3a')]({},_0x3e57cb,_0x44dda4[_0x4e77('0x3d')]);return db[_0x4e77('0x2c')]['find'](_0x3e57cb)[_0x4e77('0x24')](handleEntityNotFound(_0x106a98,null))[_0x4e77('0x24')](respondWithResult(_0x106a98,null))[_0x4e77('0x44')](handleError(_0x106a98,null));};exports[_0x4e77('0x45')]=function(_0x4b58fc,_0x4943b9){return db[_0x4e77('0x2c')]['create'](_0x4b58fc[_0x4e77('0x46')],{})['then'](function(_0x48367b){var _0x44c746=_0x4b58fc['user'][_0x4e77('0x47')]({'plain':!![]});if(!_0x44c746)throw new Error(_0x4e77('0x48'));if(_0x44c746[_0x4e77('0x49')]===_0x4e77('0x4a')){var _0x11a6f8=_0x48367b[_0x4e77('0x47')]({'plain':!![]});var _0xb7fd3d=_0x4e77('0x26');return db[_0x4e77('0x4b')][_0x4e77('0x4c')]({'where':{'name':_0xb7fd3d,'userProfileId':_0x44c746[_0x4e77('0x4d')]},'raw':!![]})['then'](function(_0x258fba){if(_0x258fba&&_0x258fba['autoAssociation']===0x0){return db[_0x4e77('0x27')][_0x4e77('0x45')]({'name':_0x11a6f8[_0x4e77('0x29')],'resourceId':_0x11a6f8['id'],'type':_0x258fba[_0x4e77('0x29')],'sectionId':_0x258fba['id']},{})[_0x4e77('0x24')](function(){return _0x48367b;});}else{return _0x48367b;}})['catch'](function(_0x3a5b5c){logger[_0x4e77('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a5b5c);throw _0x3a5b5c;});}return _0x48367b;})[_0x4e77('0x24')](respondWithResult(_0x4943b9,0xc9))[_0x4e77('0x44')](handleError(_0x4943b9,null));};exports[_0x4e77('0x4f')]=function(_0x1fe6f2,_0x3cdcd8){if(_0x1fe6f2[_0x4e77('0x46')]['id']){delete _0x1fe6f2['body']['id'];}return db[_0x4e77('0x2c')][_0x4e77('0x4c')]({'where':{'id':_0x1fe6f2[_0x4e77('0x42')]['id']}})['then'](handleEntityNotFound(_0x3cdcd8,null))['then'](saveUpdates(_0x1fe6f2['body'],null))[_0x4e77('0x24')](respondWithResult(_0x3cdcd8,null))[_0x4e77('0x44')](handleError(_0x3cdcd8,null));};exports['destroy']=function(_0x2e4295,_0x2536a9){return db[_0x4e77('0x2c')]['find']({'where':{'id':_0x2e4295[_0x4e77('0x42')]['id']}})['then'](handleEntityNotFound(_0x2536a9,null))[_0x4e77('0x24')](removeEntity(_0x2536a9,null))[_0x4e77('0x44')](handleError(_0x2536a9,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 13b0604..c5d9a51 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 _0x236b=['request-promise','path','rimraf','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment'];(function(_0x323878,_0x185d97){var _0xda4c45=function(_0x35e3b1){while(--_0x35e3b1){_0x323878['push'](_0x323878['shift']());}};_0xda4c45(++_0x185d97);}(_0x236b,0x11b));var _0xb236=function(_0x49904e,_0x5e4de9){_0x49904e=_0x49904e-0x0;var _0x168604=_0x236b[_0x49904e];return _0x168604;};'use strict';var _=require(_0xb236('0x0'));var util=require(_0xb236('0x1'));var logger=require(_0xb236('0x2'))(_0xb236('0x3'));var moment=require(_0xb236('0x4'));var BPromise=require('bluebird');var rp=require(_0xb236('0x5'));var fs=require('fs');var path=require(_0xb236('0x6'));var rimraf=require(_0xb236('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xb236('0x8')]=function(_0x3e7212,_0xbb2566){return _0x3e7212[_0xb236('0x9')]('Disposition',attributes,{'tableName':_0xb236('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb236('0xb'),'fields':[_0xb236('0xc'),_0xb236('0xd')]},{'unique':!![],'name':_0xb236('0xe'),'fields':[_0xb236('0xc'),_0xb236('0xf')]},{'unique':!![],'name':_0xb236('0x10'),'fields':[_0xb236('0xc'),_0xb236('0x11')]},{'unique':!![],'name':_0xb236('0x12'),'fields':[_0xb236('0xc'),_0xb236('0x13')]},{'unique':!![],'name':_0xb236('0x14'),'fields':[_0xb236('0xc'),_0xb236('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0xb236('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0xb236('0x16'),'fields':[_0xb236('0xc'),_0xb236('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36cc=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./disposition.attributes','exports','tools_dispositions','name','ListId'];(function(_0x4da9c0,_0x40e9ff){var _0x70005e=function(_0x2ab2f7){while(--_0x2ab2f7){_0x4da9c0['push'](_0x4da9c0['shift']());}};_0x70005e(++_0x40e9ff);}(_0x36cc,0x1d6));var _0xc36c=function(_0x50303e,_0x3a18d6){_0x50303e=_0x50303e-0x0;var _0xc35f3a=_0x36cc[_0x50303e];return _0xc35f3a;};'use strict';var _=require(_0xc36c('0x0'));var util=require(_0xc36c('0x1'));var logger=require(_0xc36c('0x2'))(_0xc36c('0x3'));var moment=require(_0xc36c('0x4'));var BPromise=require('bluebird');var rp=require(_0xc36c('0x5'));var fs=require('fs');var path=require(_0xc36c('0x6'));var rimraf=require(_0xc36c('0x7'));var config=require('../../config/environment');var attributes=require(_0xc36c('0x8'));module[_0xc36c('0x9')]=function(_0x3c2f5b,_0x331e4a){return _0x3c2f5b['define']('Disposition',attributes,{'tableName':_0xc36c('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xc36c('0xb'),_0xc36c('0xc')]},{'unique':!![],'name':_0xc36c('0xd'),'fields':['name',_0xc36c('0xe')]},{'unique':!![],'name':_0xc36c('0xf'),'fields':[_0xc36c('0xb'),_0xc36c('0x10')]},{'unique':!![],'name':_0xc36c('0x11'),'fields':[_0xc36c('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xc36c('0x12'),'fields':[_0xc36c('0xb'),_0xc36c('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0xc36c('0xb'),_0xc36c('0x14')]},{'unique':!![],'name':_0xc36c('0x15'),'fields':['name',_0xc36c('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2121690..64a8cb3 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(_0xc46270,_0x252249){var _0x318c74=function(_0x54c610){while(--_0x54c610){_0xc46270['push'](_0xc46270['shift']());}};_0x318c74(++_0x252249);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x296796,_0x2e1cee){var _0x40dcb5=function(_0x198fd0){while(--_0x198fd0){_0x296796['push'](_0x296796['shift']());}};_0x40dcb5(++_0x2e1cee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 5a0a863..e1b2c2b 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 _0xf04e=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf04e,0x8b));var _0xef04=function(_0x213d0d,_0x16f057){_0x213d0d=_0x213d0d-0x0;var _0x5b684d=_0xf04e[_0x213d0d];return _0x5b684d;};'use strict';var multer=require(_0xef04('0x0'));var util=require(_0xef04('0x1'));var path=require(_0xef04('0x2'));var timeout=require('connect-timeout');var express=require(_0xef04('0x3'));var router=express[_0xef04('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xef04('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xef04('0x6')]('/',auth['isAuthenticated'](),controller[_0xef04('0x7')]);router[_0xef04('0x6')](_0xef04('0x8'),auth[_0xef04('0x9')](),controller[_0xef04('0xa')]);router[_0xef04('0xb')]('/',auth['isAuthenticated'](),controller[_0xef04('0xc')]);router[_0xef04('0xd')](_0xef04('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xef04('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xef04('0xf')]);module[_0xef04('0x10')]=router; \ No newline at end of file +var _0xdafd=['show','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id'];(function(_0x2be1d6,_0x6ee010){var _0xea43e4=function(_0x2390be){while(--_0x2390be){_0x2be1d6['push'](_0x2be1d6['shift']());}};_0xea43e4(++_0x6ee010);}(_0xdafd,0x1e1));var _0xddaf=function(_0x2a78f8,_0x2d4c2f){_0x2a78f8=_0x2a78f8-0x0;var _0x272457=_0xdafd[_0x2a78f8];return _0x272457;};'use strict';var multer=require(_0xddaf('0x0'));var util=require(_0xddaf('0x1'));var path=require(_0xddaf('0x2'));var timeout=require(_0xddaf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xddaf('0x4'));var auth=require(_0xddaf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddaf('0x6'));var controller=require(_0xddaf('0x7'));router[_0xddaf('0x8')]('/',auth[_0xddaf('0x9')](),controller[_0xddaf('0xa')]);router[_0xddaf('0x8')](_0xddaf('0xb'),auth[_0xddaf('0x9')](),controller[_0xddaf('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xddaf('0xd')]);router[_0xddaf('0xe')](_0xddaf('0xb'),auth[_0xddaf('0x9')](),controller['update']);router[_0xddaf('0xf')](_0xddaf('0xb'),auth[_0xddaf('0x9')](),controller[_0xddaf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d8438de..3550342 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 _0xf289=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','IAX','DADHI','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x2872c5,_0x362506){var _0x5a3d07=function(_0x225572){while(--_0x225572){_0x2872c5['push'](_0x2872c5['shift']());}};_0x5a3d07(++_0x362506);}(_0xf289,0x10d));var _0x9f28=function(_0x29b603,_0x12b48e){_0x29b603=_0x29b603-0x0;var _0x3b741e=_0xf289[_0x29b603];return _0x3b741e;};'use strict';var Sequelize=require(_0x9f28('0x0'));module[_0x9f28('0x1')]={'name':{'type':Sequelize[_0x9f28('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9f28('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x9f28('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x9f28('0x2')],'defaultValue':_0x9f28('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x9f28('0x5')},'minrate':{'type':Sequelize[_0x9f28('0x6')](_0x9f28('0x7'),_0x9f28('0x8'),_0x9f28('0x9'),_0x9f28('0xa'),_0x9f28('0xb'),_0x9f28('0xc')),'defaultValue':_0x9f28('0x8')},'maxrate':{'type':Sequelize[_0x9f28('0x6')](_0x9f28('0x7'),'4800',_0x9f28('0x9'),_0x9f28('0xa'),'12000',_0x9f28('0xc')),'defaultValue':_0x9f28('0xc')},'modem':{'type':Sequelize[_0x9f28('0x2')],'defaultValue':_0x9f28('0xd')},'gateway':{'type':Sequelize[_0x9f28('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9f28('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9f28('0x6')]('SIP',_0x9f28('0xe'),_0x9f28('0xf'),'KHOMP'),'defaultValue':_0x9f28('0x10')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9f28('0x11');}},'notificationSound':{'type':Sequelize[_0x9f28('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9f28('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9f28('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9f28('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f28('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9f28('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f28('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9f28('0x13')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9f28('0x14'),'set':function(_0x27a036){if(!_0x27a036)this[_0x9f28('0x15')](_0x9f28('0x16'),null);this[_0x9f28('0x15')](_0x9f28('0x17'),_0x27a036);}}}; \ No newline at end of file +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(_0x23222c,_0x5d51b2){var _0x3c20f1=function(_0x16068f){while(--_0x16068f){_0x23222c['push'](_0x23222c['shift']());}};_0x3c20f1(++_0x5d51b2);}(_0x407f,0x8a));var _0xf407=function(_0x43b1e4,_0x53fd36){_0x43b1e4=_0x43b1e4-0x0;var _0xfb9e75=_0x407f[_0x43b1e4];return _0xfb9e75;};'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 diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ff8c1c4..9499208 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 _0x1fc6=['request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','findAll','show','length','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','nolimit','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','tag','sequelize','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','app','description','Fax\x20Extension','appdata','push','ecm','localstationid','gateway','maxrate','modem','t38timeout','FAXOPT(','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','transaction','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s'];(function(_0x3848d4,_0x3227bd){var _0x66f1e2=function(_0x36352b){while(--_0x36352b){_0x3848d4['push'](_0x3848d4['shift']());}};_0x66f1e2(++_0x3227bd);}(_0x1fc6,0x150));var _0x61fc=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x1fc6[_0x33c9f8];return _0x2d7004;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x61fc('0x0'));var jsonpatch=require(_0x61fc('0x1'));var rp=require(_0x61fc('0x2'));var moment=require('moment');var BPromise=require(_0x61fc('0x3'));var Mustache=require(_0x61fc('0x4'));var util=require(_0x61fc('0x5'));var path=require(_0x61fc('0x6'));var sox=require(_0x61fc('0x7'));var csv=require(_0x61fc('0x8'));var ejs=require(_0x61fc('0x9'));var fs=require('fs');var fs_extra=require(_0x61fc('0xa'));var _=require('lodash');var squel=require(_0x61fc('0xb'));var crypto=require(_0x61fc('0xc'));var jsforce=require(_0x61fc('0xd'));var deskjs=require(_0x61fc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61fc('0xf'));var Redis=require(_0x61fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x61fc('0x11'));var as=require(_0x61fc('0x12'));var hardwareService=require(_0x61fc('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x61fc('0x14'));var config=require(_0x61fc('0x15'));var licenseUtil=require(_0x61fc('0x16'));var db=require(_0x61fc('0x17'))['db'];config[_0x61fc('0x18')]=_[_0x61fc('0x19')](config[_0x61fc('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x61fc('0x1a'))(new Redis(config[_0x61fc('0x18')]));require(_0x61fc('0x1b'))['register'](socket);var jayson=require(_0x61fc('0x1c'));var client=jayson['client'][_0x61fc('0x1d')]({'port':0x232c});var client9002=jayson[_0x61fc('0x1e')][_0x61fc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5dbcb0,_0x5ac065,_0x46084a,_0x481281){return new BPromise(function(_0x959bd9,_0x3384ac){var _0xfafcb6=_0x481281||client;return _0xfafcb6[_0x61fc('0x1f')](_0x5dbcb0,_0x46084a)['then'](function(_0xaf8292){logger[_0x61fc('0x20')](_0x61fc('0x21'),_0x5ac065,_0x61fc('0x22'));logger[_0x61fc('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5ac065,'request\x20sent',JSON[_0x61fc('0x24')](_0xaf8292));if(_0xaf8292[_0x61fc('0x25')]){if(_0xaf8292[_0x61fc('0x25')][_0x61fc('0x26')]===0x1f4){logger[_0x61fc('0x25')](_0x61fc('0x21'),_0x5ac065,_0xaf8292[_0x61fc('0x25')]['message']);return _0x3384ac(_0xaf8292['error'][_0x61fc('0x27')]);}logger[_0x61fc('0x25')]('FaxAccount,\x20%s,\x20%s',_0x5ac065,_0xaf8292['error'][_0x61fc('0x27')]);return _0x959bd9(_0xaf8292['error'][_0x61fc('0x27')]);}else{logger[_0x61fc('0x20')]('FaxAccount,\x20%s,\x20%s',_0x5ac065,'request\x20sent');_0x959bd9(_0xaf8292[_0x61fc('0x28')]['message']);}})[_0x61fc('0x29')](function(_0x2f9b9c){logger[_0x61fc('0x25')](_0x61fc('0x21'),_0x5ac065,_0x2f9b9c);_0x3384ac(_0x2f9b9c);});});}function respondWithStatusCode(_0x35ec02,_0xffe113){_0xffe113=_0xffe113||0xcc;return function(_0x42b6d8){if(_0x42b6d8){return _0x35ec02[_0x61fc('0x2a')](_0xffe113);}return _0x35ec02['status'](_0xffe113)[_0x61fc('0x2b')]();};}function respondWithResult(_0x3a202d,_0x28092a){_0x28092a=_0x28092a||0xc8;return function(_0x512992){if(_0x512992){return _0x3a202d[_0x61fc('0x2c')](_0x28092a)[_0x61fc('0x2d')](_0x512992);}};}function respondWithFilteredResult(_0x59a17f,_0x4ad7f3){return function(_0x9c957c){if(_0x9c957c){var _0x3a8681=typeof _0x4ad7f3[_0x61fc('0x2e')]===_0x61fc('0x2f')&&typeof _0x4ad7f3['limit']===_0x61fc('0x2f');var _0x170f93=_0x9c957c[_0x61fc('0x30')];var _0x16d9fe=_0x3a8681?0x0:_0x4ad7f3[_0x61fc('0x2e')];var _0x30ec1c=_0x3a8681?_0x9c957c[_0x61fc('0x30')]:_0x4ad7f3[_0x61fc('0x2e')]+_0x4ad7f3['limit'];var _0x360784;if(_0x30ec1c>=_0x170f93){_0x30ec1c=_0x170f93;_0x360784=0xc8;}else{_0x360784=0xce;}_0x59a17f[_0x61fc('0x2c')](_0x360784);return _0x59a17f[_0x61fc('0x31')](_0x61fc('0x32'),_0x16d9fe+'-'+_0x30ec1c+'/'+_0x170f93)[_0x61fc('0x2d')](_0x9c957c);}return null;};}function patchUpdates(_0x560a3a){return function(_0x432685){try{jsonpatch[_0x61fc('0x33')](_0x432685,_0x560a3a,!![]);}catch(_0x214290){return BPromise['reject'](_0x214290);}return _0x432685[_0x61fc('0x34')]();};}function saveUpdates(_0x2bbb17,_0x4a9bd5){return function(_0x56263e){if(_0x56263e){return _0x56263e[_0x61fc('0x35')](_0x2bbb17)[_0x61fc('0x36')](function(_0x129373){return _0x129373;});}return null;};}function removeEntity(_0x2d00ae,_0x23a439){return function(_0x5be8f1){if(_0x5be8f1){return _0x5be8f1[_0x61fc('0x37')]()[_0x61fc('0x36')](function(){var _0x21cc45=_0x5be8f1[_0x61fc('0x38')]({'plain':!![]});var _0x384535=_0x61fc('0x39');return db[_0x61fc('0x3a')][_0x61fc('0x37')]({'where':{'type':_0x384535,'resourceId':_0x21cc45['id']}})['then'](function(){return _0x5be8f1;});})[_0x61fc('0x36')](function(){_0x2d00ae[_0x61fc('0x2c')](0xcc)[_0x61fc('0x2b')]();});}};}function handleEntityNotFound(_0x554543,_0x638442){return function(_0x18c278){if(!_0x18c278){_0x554543[_0x61fc('0x2a')](0x194);}return _0x18c278;};}function handleError(_0x59522f,_0x1d0fd8){_0x1d0fd8=_0x1d0fd8||0x1f4;return function(_0x1b7373){logger['error'](_0x1b7373[_0x61fc('0x3b')]);if(_0x1b7373[_0x61fc('0x3c')]){delete _0x1b7373[_0x61fc('0x3c')];}_0x59522f['status'](_0x1d0fd8)[_0x61fc('0x3d')](_0x1b7373);};}exports['index']=function(_0x3cd376,_0x3f8a7f){var _0x4f2dee={'include':[{'model':db[_0x61fc('0x3e')],'as':_0x61fc('0x3f')}]},_0x111f2f={},_0x5b5edb={'count':0x0,'rows':[]};var _0x32b062=_[_0x61fc('0x40')](db[_0x61fc('0x41')][_0x61fc('0x42')],function(_0x1bb777){return{'name':_0x1bb777[_0x61fc('0x43')],'type':_0x1bb777[_0x61fc('0x44')][_0x61fc('0x45')]};});_0x111f2f['model']=_['map'](_0x32b062,'name');_0x111f2f[_0x61fc('0x46')]=_[_0x61fc('0x47')](_0x3cd376[_0x61fc('0x46')]);_0x111f2f[_0x61fc('0x48')]=_[_0x61fc('0x49')](_0x111f2f[_0x61fc('0x4a')],_0x111f2f[_0x61fc('0x46')]);_0x4f2dee['attributes']=_[_0x61fc('0x49')](_0x111f2f[_0x61fc('0x4a')],qs[_0x61fc('0x4b')](_0x3cd376['query'][_0x61fc('0x4b')]));_0x4f2dee[_0x61fc('0x4c')]=_0x4f2dee['attributes']['length']?_0x4f2dee[_0x61fc('0x4c')]:_0x111f2f[_0x61fc('0x4a')];if(!_0x3cd376['query'][_0x61fc('0x4d')]('nolimit')){_0x4f2dee[_0x61fc('0x4e')]=qs['limit'](_0x3cd376[_0x61fc('0x46')][_0x61fc('0x4e')]);_0x4f2dee[_0x61fc('0x2e')]=qs[_0x61fc('0x2e')](_0x3cd376['query']['offset']);}_0x4f2dee[_0x61fc('0x4f')]=qs['sort'](_0x3cd376[_0x61fc('0x46')][_0x61fc('0x50')]);_0x4f2dee[_0x61fc('0x51')]=qs['filters'](_[_0x61fc('0x52')](_0x3cd376[_0x61fc('0x46')],_0x111f2f[_0x61fc('0x48')]),_0x32b062);if(_0x3cd376[_0x61fc('0x46')][_0x61fc('0x53')]){_0x4f2dee[_0x61fc('0x51')]=_['merge'](_0x4f2dee[_0x61fc('0x51')],{'$or':_[_0x61fc('0x40')](_0x32b062,function(_0x29a3e6){if(_0x29a3e6[_0x61fc('0x44')]!=='VIRTUAL'){var _0x55e34e={};_0x55e34e[_0x29a3e6['name']]={'$like':'%'+_0x3cd376['query'][_0x61fc('0x53')]+'%'};return _0x55e34e;}})});}_0x4f2dee=_[_0x61fc('0x54')]({},_0x4f2dee,_0x3cd376[_0x61fc('0x55')]);var _0x314f40={'where':_0x4f2dee[_0x61fc('0x51')]};return db['FaxAccount'][_0x61fc('0x30')](_0x314f40)['then'](function(_0x260540){_0x5b5edb[_0x61fc('0x30')]=_0x260540;if(_0x3cd376[_0x61fc('0x46')]['includeAll']){_0x4f2dee['include']=[{'all':!![]}];}return db[_0x61fc('0x41')][_0x61fc('0x56')](_0x4f2dee);})[_0x61fc('0x36')](function(_0x2fac4e){_0x5b5edb['rows']=_0x2fac4e;return _0x5b5edb;})['then'](respondWithFilteredResult(_0x3f8a7f,_0x4f2dee))[_0x61fc('0x29')](handleError(_0x3f8a7f,null));};exports[_0x61fc('0x57')]=function(_0x5ba2fe,_0x1eebd5){var _0x5bf75b={'raw':![],'where':{'id':_0x5ba2fe['params']['id']},'include':[{'model':db['Pause'],'as':_0x61fc('0x3f')}]},_0x59fe58={};_0x59fe58[_0x61fc('0x4a')]=_[_0x61fc('0x47')](db[_0x61fc('0x41')][_0x61fc('0x42')]);_0x59fe58[_0x61fc('0x46')]=_[_0x61fc('0x47')](_0x5ba2fe[_0x61fc('0x46')]);_0x59fe58['filters']=_[_0x61fc('0x49')](_0x59fe58[_0x61fc('0x4a')],_0x59fe58['query']);_0x5bf75b[_0x61fc('0x4c')]=_[_0x61fc('0x49')](_0x59fe58[_0x61fc('0x4a')],qs['fields'](_0x5ba2fe[_0x61fc('0x46')][_0x61fc('0x4b')]));_0x5bf75b[_0x61fc('0x4c')]=_0x5bf75b[_0x61fc('0x4c')][_0x61fc('0x58')]?_0x5bf75b['attributes']:_0x59fe58[_0x61fc('0x4a')];if(_0x5ba2fe[_0x61fc('0x46')][_0x61fc('0x59')]){_0x5bf75b[_0x61fc('0x5a')]=[{'all':!![]}];}_0x5bf75b=_[_0x61fc('0x54')]({},_0x5bf75b,_0x5ba2fe[_0x61fc('0x55')]);return db[_0x61fc('0x41')]['find'](_0x5bf75b)['then'](handleEntityNotFound(_0x1eebd5,null))['then'](respondWithResult(_0x1eebd5,null))[_0x61fc('0x29')](handleError(_0x1eebd5,null));};exports['create']=function(_0x3360de,_0xc38c65){return db[_0x61fc('0x41')][_0x61fc('0x5b')](_0x3360de[_0x61fc('0x5c')],{})[_0x61fc('0x36')](function(_0x5416d1){var _0x3c383d=_0x3360de[_0x61fc('0x5d')][_0x61fc('0x38')]({'plain':!![]});if(!_0x3c383d)throw new Error(_0x61fc('0x5e'));if(_0x3c383d[_0x61fc('0x5f')]===_0x61fc('0x5d')){var _0x1594c4=_0x5416d1[_0x61fc('0x38')]({'plain':!![]});var _0x1b02ab='FaxAccounts';return db['UserProfileSection'][_0x61fc('0x60')]({'where':{'name':_0x1b02ab,'userProfileId':_0x3c383d['userProfileId']},'raw':!![]})[_0x61fc('0x36')](function(_0x3a0550){if(_0x3a0550&&_0x3a0550['autoAssociation']===0x0){return db[_0x61fc('0x3a')][_0x61fc('0x5b')]({'name':_0x1594c4[_0x61fc('0x3c')],'resourceId':_0x1594c4['id'],'type':_0x3a0550[_0x61fc('0x3c')],'sectionId':_0x3a0550['id']},{})[_0x61fc('0x36')](function(){return _0x5416d1;});}else{return _0x5416d1;}})[_0x61fc('0x29')](function(_0xf836fe){logger[_0x61fc('0x25')](_0x61fc('0x61'),_0xf836fe);throw _0xf836fe;});}return _0x5416d1;})[_0x61fc('0x36')](respondWithResult(_0xc38c65,0xc9))['catch'](handleError(_0xc38c65,null));};exports[_0x61fc('0x35')]=function(_0x298b22,_0x53fae5){if(_0x298b22[_0x61fc('0x5c')]['id']){delete _0x298b22[_0x61fc('0x5c')]['id'];}return db[_0x61fc('0x41')][_0x61fc('0x60')]({'where':{'id':_0x298b22[_0x61fc('0x62')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x53fae5,null))['then'](saveUpdates(_0x298b22[_0x61fc('0x5c')],null))[_0x61fc('0x36')](respondWithResult(_0x53fae5,null))['catch'](handleError(_0x53fae5,null));};exports['destroy']=function(_0x2be7ef,_0xd5a7da){return db['FaxAccount']['find']({'where':{'id':_0x2be7ef[_0x61fc('0x62')]['id']}})[_0x61fc('0x36')](handleEntityNotFound(_0xd5a7da,null))['then'](removeEntity(_0xd5a7da,null))[_0x61fc('0x29')](handleError(_0xd5a7da,null));};exports[_0x61fc('0x63')]=function(_0x47973d,_0x445f52){return db['FaxAccount'][_0x61fc('0x63')]()[_0x61fc('0x36')](respondWithResult(_0x445f52,null))[_0x61fc('0x29')](handleError(_0x445f52,null));};exports[_0x61fc('0x64')]=function(_0x23a77a,_0x39c28d,_0x386a09){if(_0x23a77a[_0x61fc('0x5c')]['id']){delete _0x23a77a[_0x61fc('0x5c')]['id'];}return db['FaxAccount'][_0x61fc('0x60')]({'where':{'id':_0x23a77a[_0x61fc('0x62')]['id']}})[_0x61fc('0x36')](handleEntityNotFound(_0x39c28d,null))[_0x61fc('0x36')](function(_0xc225a4){if(_0xc225a4){_0x23a77a['body'][_0x61fc('0x65')]=_0xc225a4['id'];return db[_0x61fc('0x66')][_0x61fc('0x5b')](_0x23a77a['body']);}})['then'](respondWithResult(_0x39c28d,null))[_0x61fc('0x29')](handleError(_0x39c28d,null));};exports[_0x61fc('0x67')]=function(_0x200fdf,_0x5de7c8,_0x2d9aac){var _0x34f7e6={'raw':![],'where':{}};var _0xc66741={};var _0x36880f={'count':0x0,'rows':[]};return db[_0x61fc('0x41')]['findOne']({'where':{'id':_0x200fdf[_0x61fc('0x62')]['id']}})['then'](handleEntityNotFound(_0x5de7c8,null))[_0x61fc('0x36')](function(_0x3a4691){if(_0x3a4691){_0xc66741['model']=_['keys'](db[_0x61fc('0x66')][_0x61fc('0x42')]);_0xc66741[_0x61fc('0x46')]=_[_0x61fc('0x47')](_0x200fdf[_0x61fc('0x46')]);_0xc66741[_0x61fc('0x48')]=_[_0x61fc('0x49')](_0xc66741[_0x61fc('0x4a')],_0xc66741['query']);_0x34f7e6[_0x61fc('0x4c')]=_[_0x61fc('0x49')](_0xc66741[_0x61fc('0x4a')],qs[_0x61fc('0x4b')](_0x200fdf[_0x61fc('0x46')][_0x61fc('0x4b')]));_0x34f7e6[_0x61fc('0x4c')]=_0x34f7e6[_0x61fc('0x4c')][_0x61fc('0x58')]?_0x34f7e6[_0x61fc('0x4c')]:_0xc66741[_0x61fc('0x4a')];if(!_0x200fdf[_0x61fc('0x46')]['hasOwnProperty'](_0x61fc('0x68'))){_0x34f7e6[_0x61fc('0x4e')]=qs['limit'](_0x200fdf[_0x61fc('0x46')][_0x61fc('0x4e')]);_0x34f7e6['offset']=qs[_0x61fc('0x2e')](_0x200fdf['query']['offset']);}_0x34f7e6['order']=qs[_0x61fc('0x50')](_0x200fdf[_0x61fc('0x46')][_0x61fc('0x50')]);_0x34f7e6[_0x61fc('0x51')]=qs[_0x61fc('0x48')](_[_0x61fc('0x52')](_0x200fdf[_0x61fc('0x46')],_0xc66741[_0x61fc('0x48')]));_0x34f7e6[_0x61fc('0x51')][_0x61fc('0x65')]=_0x3a4691['id'];if(_0x200fdf[_0x61fc('0x46')][_0x61fc('0x53')]){_0x34f7e6['where']=_[_0x61fc('0x54')](_0x34f7e6[_0x61fc('0x51')],{'$or':_[_0x61fc('0x40')](_0x34f7e6[_0x61fc('0x4c')],function(_0x5edeba){var _0x552f85={};_0x552f85[_0x5edeba]={'$like':'%'+_0x200fdf[_0x61fc('0x46')][_0x61fc('0x53')]+'%'};return _0x552f85;})});}_0x34f7e6=_[_0x61fc('0x54')]({},_0x34f7e6,_0x200fdf[_0x61fc('0x55')]);return db[_0x61fc('0x66')][_0x61fc('0x30')]({'where':_0x34f7e6[_0x61fc('0x51')]})[_0x61fc('0x36')](function(_0x390bd3){_0x36880f[_0x61fc('0x30')]=_0x390bd3;if(_0x200fdf[_0x61fc('0x46')][_0x61fc('0x59')]){_0x34f7e6[_0x61fc('0x5a')]=[{'all':!![]}];}return db[_0x61fc('0x66')][_0x61fc('0x56')](_0x34f7e6);})[_0x61fc('0x36')](function(_0x58a192){_0x36880f[_0x61fc('0x69')]=_0x58a192;return _0x36880f;});}})[_0x61fc('0x36')](respondWithFilteredResult(_0x5de7c8,_0x34f7e6))['catch'](handleError(_0x5de7c8,null));};exports['removeDispositions']=function(_0x379975,_0x4090dd,_0x4347cb){return db[_0x61fc('0x41')]['find']({'where':{'id':_0x379975[_0x61fc('0x62')]['id']}})[_0x61fc('0x36')](handleEntityNotFound(_0x4090dd,null))[_0x61fc('0x36')](function(_0x3dc25f){if(_0x3dc25f){return _0x3dc25f[_0x61fc('0x6a')](_0x379975[_0x61fc('0x46')][_0x61fc('0x6b')]);}})[_0x61fc('0x36')](respondWithStatusCode(_0x4090dd,null))[_0x61fc('0x29')](handleError(_0x4090dd,null));};exports[_0x61fc('0x6c')]=function(_0x55d0c4,_0xa1585b,_0x55b3dd){if(_0x55d0c4[_0x61fc('0x5c')]['id']){delete _0x55d0c4['body']['id'];}return db[_0x61fc('0x41')][_0x61fc('0x60')]({'where':{'id':_0x55d0c4[_0x61fc('0x62')]['id']}})[_0x61fc('0x36')](handleEntityNotFound(_0xa1585b,null))[_0x61fc('0x36')](function(_0x219fca){if(_0x219fca){_0x55d0c4[_0x61fc('0x5c')][_0x61fc('0x65')]=_0x219fca['id'];return db['CannedAnswer'][_0x61fc('0x5b')](_0x55d0c4[_0x61fc('0x5c')]);}})[_0x61fc('0x36')](respondWithResult(_0xa1585b,null))[_0x61fc('0x29')](handleError(_0xa1585b,null));};exports[_0x61fc('0x6d')]=function(_0x38eba0,_0x1db593,_0x2017f5){var _0x2a8429={'raw':![],'where':{}};var _0x5959ab={};var _0x5c9c7c={'count':0x0,'rows':[]};return db[_0x61fc('0x41')][_0x61fc('0x6e')]({'where':{'id':_0x38eba0[_0x61fc('0x62')]['id']}})['then'](handleEntityNotFound(_0x1db593,null))[_0x61fc('0x36')](function(_0x100c49){if(_0x100c49){_0x5959ab[_0x61fc('0x4a')]=_[_0x61fc('0x47')](db[_0x61fc('0x6f')][_0x61fc('0x42')]);_0x5959ab['query']=_[_0x61fc('0x47')](_0x38eba0[_0x61fc('0x46')]);_0x5959ab[_0x61fc('0x48')]=_['intersection'](_0x5959ab[_0x61fc('0x4a')],_0x5959ab[_0x61fc('0x46')]);_0x2a8429[_0x61fc('0x4c')]=_[_0x61fc('0x49')](_0x5959ab[_0x61fc('0x4a')],qs[_0x61fc('0x4b')](_0x38eba0[_0x61fc('0x46')][_0x61fc('0x4b')]));_0x2a8429[_0x61fc('0x4c')]=_0x2a8429[_0x61fc('0x4c')][_0x61fc('0x58')]?_0x2a8429['attributes']:_0x5959ab[_0x61fc('0x4a')];if(!_0x38eba0[_0x61fc('0x46')]['hasOwnProperty']('nolimit')){_0x2a8429[_0x61fc('0x4e')]=qs[_0x61fc('0x4e')](_0x38eba0[_0x61fc('0x46')]['limit']);_0x2a8429[_0x61fc('0x2e')]=qs[_0x61fc('0x2e')](_0x38eba0[_0x61fc('0x46')][_0x61fc('0x2e')]);}_0x2a8429['order']=qs[_0x61fc('0x50')](_0x38eba0['query'][_0x61fc('0x50')]);_0x2a8429[_0x61fc('0x51')]=qs[_0x61fc('0x48')](_['pick'](_0x38eba0[_0x61fc('0x46')],_0x5959ab['filters']));_0x2a8429[_0x61fc('0x51')][_0x61fc('0x65')]=_0x100c49['id'];if(_0x38eba0[_0x61fc('0x46')][_0x61fc('0x53')]){_0x2a8429[_0x61fc('0x51')]=_[_0x61fc('0x54')](_0x2a8429[_0x61fc('0x51')],{'$or':_[_0x61fc('0x40')](_0x2a8429[_0x61fc('0x4c')],function(_0x2eb175){var _0xd388cb={};_0xd388cb[_0x2eb175]={'$like':'%'+_0x38eba0[_0x61fc('0x46')]['filter']+'%'};return _0xd388cb;})});}_0x2a8429=_[_0x61fc('0x54')]({},_0x2a8429,_0x38eba0[_0x61fc('0x55')]);return db[_0x61fc('0x6f')][_0x61fc('0x30')]({'where':_0x2a8429[_0x61fc('0x51')]})[_0x61fc('0x36')](function(_0x3a32c0){_0x5c9c7c[_0x61fc('0x30')]=_0x3a32c0;if(_0x38eba0[_0x61fc('0x46')][_0x61fc('0x59')]){_0x2a8429['include']=[{'all':!![]}];}return db[_0x61fc('0x6f')][_0x61fc('0x56')](_0x2a8429);})[_0x61fc('0x36')](function(_0x7dfd45){_0x5c9c7c[_0x61fc('0x69')]=_0x7dfd45;return _0x5c9c7c;});}})['then'](respondWithFilteredResult(_0x1db593,_0x2a8429))[_0x61fc('0x29')](handleError(_0x1db593,null));};exports[_0x61fc('0x70')]=function(_0x1ae6b2,_0x108ec0,_0x886e59){return db[_0x61fc('0x41')][_0x61fc('0x60')]({'where':{'id':_0x1ae6b2[_0x61fc('0x62')]['id']}})['then'](handleEntityNotFound(_0x108ec0,null))[_0x61fc('0x36')](function(_0x16a429){if(_0x16a429){return _0x16a429[_0x61fc('0x70')](_0x1ae6b2[_0x61fc('0x46')]['ids']);}})[_0x61fc('0x36')](respondWithStatusCode(_0x108ec0,null))[_0x61fc('0x29')](handleError(_0x108ec0,null));};exports['addInteraction']=function(_0x3da594,_0x155f6b,_0x3fe18c){return db[_0x61fc('0x71')][_0x61fc('0x60')]({'where':{'id':_0x3da594[_0x61fc('0x62')]['id']}})['then'](handleEntityNotFound(_0x155f6b,null))[_0x61fc('0x36')](function(_0x11f8e1){if(_0x11f8e1){return _0x11f8e1['addInteraction'](_0x3da594['body']['ids'],_[_0x61fc('0x72')](_0x3da594[_0x61fc('0x5c')],[_0x61fc('0x6b'),'id'])||{});}})[_0x61fc('0x36')](respondWithResult(_0x155f6b,null))['catch'](handleError(_0x155f6b,null));};exports[_0x61fc('0x73')]=function(_0x5ea759,_0x50fcdd,_0x63d5b5){var _0x1552a5={'raw':![],'where':{}};var _0x4cca3e={};var _0x3cea58={'count':0x0,'rows':[]};return db[_0x61fc('0x41')]['findOne']({'where':{'id':_0x5ea759[_0x61fc('0x62')]['id']}})[_0x61fc('0x36')](handleEntityNotFound(_0x50fcdd,null))[_0x61fc('0x36')](function(_0xe8d4a6){if(_0xe8d4a6){_0x4cca3e['model']=_[_0x61fc('0x47')](db['FaxInteraction'][_0x61fc('0x42')]);_0x4cca3e[_0x61fc('0x46')]=_[_0x61fc('0x47')](_0x5ea759[_0x61fc('0x46')]);_0x4cca3e['filters']=_[_0x61fc('0x49')](_0x4cca3e[_0x61fc('0x4a')],_0x4cca3e[_0x61fc('0x46')]);_0x1552a5[_0x61fc('0x4c')]=_[_0x61fc('0x49')](_0x4cca3e['model'],qs[_0x61fc('0x4b')](_0x5ea759[_0x61fc('0x46')][_0x61fc('0x4b')]));_0x1552a5[_0x61fc('0x4c')]=_0x1552a5['attributes'][_0x61fc('0x58')]?_0x1552a5['attributes']:_0x4cca3e[_0x61fc('0x4a')];if(!_0x5ea759['query'][_0x61fc('0x4d')](_0x61fc('0x68'))){_0x1552a5[_0x61fc('0x4e')]=qs[_0x61fc('0x4e')](_0x5ea759[_0x61fc('0x46')][_0x61fc('0x4e')]);_0x1552a5['offset']=qs[_0x61fc('0x2e')](_0x5ea759['query'][_0x61fc('0x2e')]);}_0x1552a5[_0x61fc('0x4f')]=qs[_0x61fc('0x50')](_0x5ea759['query']['sort']);_0x1552a5[_0x61fc('0x51')]=qs[_0x61fc('0x48')](_[_0x61fc('0x52')](_0x5ea759[_0x61fc('0x46')],_0x4cca3e[_0x61fc('0x48')]));_0x1552a5[_0x61fc('0x51')][_0x61fc('0x65')]=_0xe8d4a6['id'];if(_0x5ea759[_0x61fc('0x46')][_0x61fc('0x53')]){_0x1552a5[_0x61fc('0x51')]=_[_0x61fc('0x54')](_0x1552a5['where'],{'$or':_['map'](_0x1552a5['attributes'],function(_0xedfec7){var _0x3c22dd={};_0x3c22dd[_0xedfec7]={'$like':'%'+_0x5ea759['query']['filter']+'%'};return _0x3c22dd;})});}_0x1552a5=_[_0x61fc('0x54')]({},_0x1552a5,_0x5ea759[_0x61fc('0x55')]);return db['FaxInteraction'][_0x61fc('0x30')]({'where':_0x1552a5[_0x61fc('0x51')]})[_0x61fc('0x36')](function(_0x207bbb){_0x3cea58['count']=_0x207bbb;if(_0x5ea759[_0x61fc('0x46')][_0x61fc('0x59')]){_0x1552a5[_0x61fc('0x5a')]=[{'model':db[_0x61fc('0x74')],'as':_0x61fc('0x75'),'required':![]},{'model':db[_0x61fc('0x76')],'as':'Owner','attributes':[_0x61fc('0x3c'),_0x61fc('0x77'),_0x61fc('0x78')],'required':![]},{'model':db[_0x61fc('0x79')],'as':_0x61fc('0x7a'),'attributes':['id','name','color'],'where':_0x5ea759[_0x61fc('0x46')][_0x61fc('0x7b')]?{'id':_0x5ea759[_0x61fc('0x46')][_0x61fc('0x7b')]}:undefined,'required':_0x5ea759[_0x61fc('0x46')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x61fc('0x56')](_0x1552a5);})[_0x61fc('0x36')](function(_0x35ad63){_0x3cea58['rows']=_0x35ad63;return _0x3cea58;});}})[_0x61fc('0x36')](respondWithFilteredResult(_0x50fcdd,_0x1552a5))['catch'](handleError(_0x50fcdd,null));};exports['addApplications']=function(_0x58ddb4,_0x2f8a7c){var _0x305cf0=_0x58ddb4[_0x61fc('0x62')]['id'];var _0x5ca57b=_0x58ddb4[_0x61fc('0x5c')];var _0x3b2e46=0xc8;var _0x31cff2=null;return db[_0x61fc('0x7c')]['transaction']({'isolationLevel':db[_0x61fc('0x7c')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1538e8){return db[_0x61fc('0x41')][_0x61fc('0x6e')]({'where':{'id':_0x305cf0},'transaction':_0x1538e8})[_0x61fc('0x36')](function(_0x443eab){if(_0x443eab){return db[_0x61fc('0x7d')][_0x61fc('0x37')]({'where':{'FaxAccountId':_0x305cf0},'transaction':_0x1538e8})[_0x61fc('0x36')](function(){var _0x1852db=_[_0x61fc('0x40')](_0x5ca57b,function(_0x2e2951){_0x2e2951['FaxAccountId']=_0x305cf0;return _0x2e2951;});return db['FaxApplication']['bulkCreate'](_0x1852db,{'transaction':_0x1538e8});});}else{_0x3b2e46=0x194;_0x31cff2=[];}});})['then'](function(){if(_0x3b2e46!==0x194){return db[_0x61fc('0x7d')][_0x61fc('0x7e')]({'where':{'FaxAccountId':_0x305cf0},'order':_0x61fc('0x7f')})['then'](function(_0x205e4b){_0x31cff2=_0x205e4b;});}})[_0x61fc('0x29')](function(_0x185401){_0x3b2e46=0x1f4;logger[_0x61fc('0x25')](_0x185401[_0x61fc('0x3b')]);if(_0x185401[_0x61fc('0x3c')]){delete _0x185401['name'];}_0x31cff2=_0x185401;})[_0x61fc('0x80')](function(){if(_0x31cff2===null){_0x2f8a7c['sendStatus'](_0x3b2e46);}else{if(_0x3b2e46===0x1f4){_0x2f8a7c['status'](_0x3b2e46)[_0x61fc('0x3d')](_0x31cff2);}else{_0x2f8a7c[_0x61fc('0x2c')](_0x3b2e46)['json'](_0x31cff2);}}});};exports['getApplications']=function(_0x254f4a,_0x34e37,_0x3aa427){var _0x29ed9f={};var _0x2eb685={};var _0x457b85;var _0x19355c;return db[_0x61fc('0x41')][_0x61fc('0x6e')]({'where':{'id':_0x254f4a['params']['id']}})[_0x61fc('0x36')](handleEntityNotFound(_0x34e37,null))[_0x61fc('0x36')](function(_0x10d8d5){if(_0x10d8d5){_0x457b85=_0x10d8d5;_0x2eb685[_0x61fc('0x4a')]=_[_0x61fc('0x47')](db[_0x61fc('0x7d')]['rawAttributes']);_0x2eb685[_0x61fc('0x46')]=_[_0x61fc('0x47')](_0x254f4a['query']);_0x2eb685['filters']=_[_0x61fc('0x49')](_0x2eb685[_0x61fc('0x4a')],_0x2eb685['query']);_0x29ed9f[_0x61fc('0x4c')]=_[_0x61fc('0x49')](_0x2eb685[_0x61fc('0x4a')],qs[_0x61fc('0x4b')](_0x254f4a['query'][_0x61fc('0x4b')]));_0x29ed9f[_0x61fc('0x4c')]=_0x29ed9f['attributes'][_0x61fc('0x58')]?_0x29ed9f[_0x61fc('0x4c')]:_0x2eb685[_0x61fc('0x4a')];_0x29ed9f[_0x61fc('0x4f')]=qs[_0x61fc('0x50')](_0x254f4a['query']['sort']);_0x29ed9f[_0x61fc('0x51')]=qs['filters'](_[_0x61fc('0x52')](_0x254f4a[_0x61fc('0x46')],_0x2eb685['filters']));if(_0x254f4a[_0x61fc('0x46')][_0x61fc('0x53')]){_0x29ed9f[_0x61fc('0x51')]=_[_0x61fc('0x54')](_0x29ed9f[_0x61fc('0x51')],{'$or':_[_0x61fc('0x40')](_0x29ed9f[_0x61fc('0x4c')],function(_0x997c66){var _0x4287a2={};_0x4287a2[_0x997c66]={'$like':'%'+_0x254f4a[_0x61fc('0x46')][_0x61fc('0x53')]+'%'};return _0x4287a2;})});}_0x29ed9f=_[_0x61fc('0x54')]({},_0x29ed9f,_0x254f4a[_0x61fc('0x55')]);return _0x457b85[_0x61fc('0x81')](_0x29ed9f);}})[_0x61fc('0x36')](function(_0x1494c2){if(_0x1494c2){_0x19355c=_0x1494c2[_0x61fc('0x58')];if(!_0x254f4a[_0x61fc('0x46')][_0x61fc('0x4d')](_0x61fc('0x68'))){_0x29ed9f[_0x61fc('0x4e')]=qs['limit'](_0x254f4a['query'][_0x61fc('0x4e')]);_0x29ed9f[_0x61fc('0x2e')]=qs[_0x61fc('0x2e')](_0x254f4a['query'][_0x61fc('0x2e')]);}return _0x457b85[_0x61fc('0x81')](_0x29ed9f);}})['then'](function(_0x3369d7){if(_0x3369d7){return _0x3369d7?{'count':_0x19355c,'rows':_0x3369d7}:null;}})[_0x61fc('0x36')](respondWithResult(_0x34e37,null))[_0x61fc('0x29')](handleError(_0x34e37,null));};function Extension(_0x4bc0bc,_0x5ed05d,_0x277845,_0x1bfa7d){this[_0x61fc('0x82')]=_0x61fc('0x83');this[_0x61fc('0x84')]=_0x4bc0bc['localstationid'];this[_0x61fc('0x85')]=_0x1bfa7d;this[_0x61fc('0x44')]='system';this[_0x61fc('0x86')]=_0x61fc('0x87');this[_0x61fc('0x65')]=_0x4bc0bc['id'];this['priority']=_0x5ed05d;this[_0x61fc('0x88')]=_0x277845;}function createExtensionsReciveFax(_0x5c5357){var _0x18cf5c=0x1;var _0x377e76=[];_0x377e76[_0x61fc('0x89')](new Extension(_0x5c5357,_0x18cf5c,'','Answer'));_0x18cf5c+=0x1;_0x377e76['push'](new Extension(_0x5c5357,_0x18cf5c,'CDR(type)=inbound-fax','Set'));_0x18cf5c+=0x1;for(var _0xa8b227 in _0x5c5357){if(_0x5c5357[_0x61fc('0x4d')](_0xa8b227)&&(_0xa8b227===_0x61fc('0x8a')||_0xa8b227===_0x61fc('0x8b')||_0xa8b227===_0x61fc('0x8c')||_0xa8b227==='faxdetect'||_0xa8b227==='headerinfo'||_0xa8b227===_0x61fc('0x8d')||_0xa8b227==='minrate'||_0xa8b227===_0x61fc('0x8e')||_0xa8b227===_0x61fc('0x8f'))){_0x377e76['push'](new Extension(_0x5c5357,_0x18cf5c,_0x61fc('0x90')+_0xa8b227+')='+_0x5c5357[_0xa8b227],_0x61fc('0x91')));_0x18cf5c+=0x1;}}_0x377e76[_0x61fc('0x89')](new Extension(_0x5c5357,_0x18cf5c,'6','Wait'));_0x18cf5c+=0x1;_0x377e76[_0x61fc('0x89')](new Extension(_0x5c5357,_0x18cf5c,_0x61fc('0x92'),_0x61fc('0x93')));_0x18cf5c=0x0;return _0x377e76;}exports[_0x61fc('0x94')]=function(_0x399c58,_0x35c8ae,_0x2a482d){var _0x49d51d;return db[_0x61fc('0x7c')]['transaction'](function(_0x471602){return db[_0x61fc('0x41')][_0x61fc('0x5b')](_0x399c58[_0x61fc('0x5c')],{'transaction':_0x471602})[_0x61fc('0x36')](function(_0x56032e){_0x49d51d=_0x56032e[_0x61fc('0x38')]({'plain':!![]});return db[_0x61fc('0x95')][_0x61fc('0x96')](createExtensionsReciveFax(_0x49d51d),{'transaction':_0x471602});});})[_0x61fc('0x36')](function(){return _0x49d51d;})[_0x61fc('0x36')](respondWithResult(_0x35c8ae,null))[_0x61fc('0x29')](handleError(_0x35c8ae,null));};exports[_0x61fc('0x97')]=function(_0x420093,_0x4bed33,_0x638bbf){var _0x3b3878;return db[_0x61fc('0x7c')][_0x61fc('0x98')](function(_0x209a81){return db[_0x61fc('0x41')][_0x61fc('0x35')](_0x420093['body'],{'where':{'id':_0x420093[_0x61fc('0x5c')]['id']},'transaction':_0x209a81})[_0x61fc('0x36')](function(_0x46c60d){return db[_0x61fc('0x95')][_0x61fc('0x37')]({'where':{'FaxAccountId':_0x420093[_0x61fc('0x5c')]['id']},'transaction':_0x209a81})['then'](function(_0x5a02ca){return db[_0x61fc('0x95')][_0x61fc('0x96')](createExtensionsReciveFax(_[_0x61fc('0x72')](_0x420093[_0x61fc('0x5c')],['tech','key','createdAt','updatedAt','TrunkId','ListId'])),{'transaction':_0x209a81});});});})[_0x61fc('0x36')](function(){return db[_0x61fc('0x41')][_0x61fc('0x99')](_0x420093[_0x61fc('0x5c')]['id']);})[_0x61fc('0x36')](respondWithResult(_0x4bed33,null))[_0x61fc('0x29')](handleError(_0x4bed33,null));};exports['getMessages']=function(_0x51fb79,_0x4e681a,_0x591dae){var _0x4f370e={'raw':!![],'where':{}};var _0xc44e41={};var _0x5783a1={'count':0x0,'rows':[]};return db[_0x61fc('0x41')][_0x61fc('0x6e')]({'where':{'id':_0x51fb79['params']['id']}})[_0x61fc('0x36')](handleEntityNotFound(_0x4e681a,null))['then'](function(_0x5b69b4){if(_0x5b69b4){_0xc44e41['model']=_[_0x61fc('0x47')](db[_0x61fc('0x9a')][_0x61fc('0x42')]);_0xc44e41[_0x61fc('0x46')]=_[_0x61fc('0x47')](_0x51fb79[_0x61fc('0x46')]);_0xc44e41[_0x61fc('0x48')]=_[_0x61fc('0x49')](_0xc44e41[_0x61fc('0x4a')],_0xc44e41[_0x61fc('0x46')]);_0x4f370e[_0x61fc('0x4c')]=_[_0x61fc('0x49')](_0xc44e41[_0x61fc('0x4a')],qs[_0x61fc('0x4b')](_0x51fb79[_0x61fc('0x46')][_0x61fc('0x4b')]));_0x4f370e[_0x61fc('0x4c')]=_0x4f370e[_0x61fc('0x4c')][_0x61fc('0x58')]?_0x4f370e[_0x61fc('0x4c')]:_0xc44e41[_0x61fc('0x4a')];if(!_0x51fb79[_0x61fc('0x46')][_0x61fc('0x4d')](_0x61fc('0x68'))){_0x4f370e[_0x61fc('0x4e')]=qs['limit'](_0x51fb79[_0x61fc('0x46')][_0x61fc('0x4e')]);_0x4f370e[_0x61fc('0x2e')]=qs[_0x61fc('0x2e')](_0x51fb79['query'][_0x61fc('0x2e')]);}_0x4f370e[_0x61fc('0x4f')]=qs[_0x61fc('0x50')](_0x51fb79[_0x61fc('0x46')][_0x61fc('0x50')]);_0x4f370e[_0x61fc('0x51')]=qs['filters'](_[_0x61fc('0x52')](_0x51fb79[_0x61fc('0x46')],_0xc44e41['filters']));_0x4f370e[_0x61fc('0x51')][_0x61fc('0x65')]=_0x5b69b4['id'];if(_0x51fb79['query']['filter']){_0x4f370e[_0x61fc('0x51')]=_[_0x61fc('0x54')](_0x4f370e['where'],{'$or':_[_0x61fc('0x40')](_0x4f370e['attributes'],function(_0x49ec8e){var _0x43e4ad={};_0x43e4ad[_0x49ec8e]={'$like':'%'+_0x51fb79[_0x61fc('0x46')][_0x61fc('0x53')]+'%'};return _0x43e4ad;})});}if(_0x51fb79[_0x61fc('0x46')][_0x61fc('0x9b')]){var _0x103074=_0x51fb79[_0x61fc('0x46')][_0x61fc('0x9b')][_0x61fc('0x9c')](',');var _0x42b6c5={};_0x42b6c5[_0x103074[0x0]]={'$gte':moment(_0x103074[0x1])[_0x61fc('0x9d')](_0x61fc('0x9e'))};_0x4f370e['where']=_[_0x61fc('0x54')](_0x4f370e[_0x61fc('0x51')],_0x42b6c5);}_0x4f370e=_[_0x61fc('0x54')]({},_0x4f370e,_0x51fb79[_0x61fc('0x55')]);return db['FaxMessage'][_0x61fc('0x30')]({'where':_0x4f370e['where']})['then'](function(_0xc43ebc){_0x5783a1['count']=_0xc43ebc;if(_0x51fb79[_0x61fc('0x46')][_0x61fc('0x59')]){_0x4f370e['include']=[{'all':!![]}];}return db[_0x61fc('0x9a')]['findAll'](_0x4f370e);})[_0x61fc('0x36')](function(_0x20e400){_0x5783a1[_0x61fc('0x69')]=_0x20e400;return _0x5783a1;});}})[_0x61fc('0x36')](respondWithFilteredResult(_0x4e681a,_0x4f370e))['catch'](handleError(_0x4e681a,null));};exports[_0x61fc('0x3d')]=function(_0x5dbb3a,_0x209d79,_0x34b41f){var _0x118945,_0xefcb58={},_0x4576ef;if(_0x5dbb3a['body']['to']){_0x4576ef=_0x5dbb3a[_0x61fc('0x5c')]['to'][0x0];}return db[_0x61fc('0x41')][_0x61fc('0x60')]({'where':{'id':_0x5dbb3a['params']['id']},'include':[{'model':db[_0x61fc('0x9f')],'as':_0x61fc('0xa0'),'include':[{'model':db[_0x61fc('0x74')],'as':_0x61fc('0xa1'),'where':{'fax':_0x4576ef},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x61fc('0x36')](handleEntityNotFound(_0x209d79,null))['then'](function(_0x3d54a9){_0x118945=_0x3d54a9;if(_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa2')]&&_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa2')][_0x61fc('0x58')]){for(var _0x250b11=0x0;_0x250b11<_0x5dbb3a['body']['attachments']['length'];_0x250b11+=0x1){_0x5dbb3a[_0x61fc('0x5c')]['attachments'][_0x250b11]={'filename':_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa2')][_0x250b11]['name'],'id':_0x5dbb3a[_0x61fc('0x5c')]['attachments'][_0x250b11]['id'],'path':path['join'](config[_0x61fc('0xa3')],_0x61fc('0xa4'),_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa2')][_0x250b11][_0x61fc('0xa5')])};}}return respondWithRpcPromise('CheckAfterSend',_0x61fc('0xa6'),{'FaxAccountId':_['isNil'](_0x5dbb3a[_0x61fc('0x62')]['id'])?undefined:_0x5dbb3a[_0x61fc('0x62')]['id'],'path':_[_0x61fc('0xa7')](_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa2')][0x0][_0x61fc('0x6')])?undefined:_0x5dbb3a[_0x61fc('0x5c')]['attachments'][0x0][_0x61fc('0x6')],'fax':_[_0x61fc('0xa7')](_0x5dbb3a[_0x61fc('0x5c')]['to'][0x0])?undefined:_0x5dbb3a[_0x61fc('0x5c')]['to'][0x0]},client9002);})[_0x61fc('0x36')](function(){if(_0x118945){if(_[_0x61fc('0xa7')](_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa8')])){_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa8')]=util[_0x61fc('0x9d')](_0x61fc('0xa9'),_0x118945[_0x61fc('0x3c')],_0x118945[_0x61fc('0xaa')]);}if(_0x118945[_0x61fc('0xa0')]){if(_0x118945[_0x61fc('0xa0')][_0x61fc('0xa1')][_0x61fc('0x58')]){return _0x118945['List'][_0x61fc('0xa1')][0x0];}else{return db[_0x61fc('0x74')][_0x61fc('0x5b')](_[_0x61fc('0x19')](_0x5dbb3a[_0x61fc('0x5c')],{'firstName':_0x5dbb3a['body']['to'][0x0],'phone':_0x5dbb3a[_0x61fc('0x5c')]['to'][0x0],'fax':_0x5dbb3a['body']['to'][0x0],'ListId':_0x118945['ListId']}));}}else{throw new Error(_0x61fc('0xab'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x61fc('0x36')](function(_0x11d371){if(_0x11d371){return db[_0x61fc('0x71')][_0x61fc('0x60')]({'where':{'ContactId':_0x11d371['id'],'closed':![],'FaxAccountId':_0x118945['id']}})[_0x61fc('0x36')](function(_0x45c69b){if(_0x45c69b){return[_0x45c69b,![]];}return db[_0x61fc('0x71')][_0x61fc('0x5b')]({'UserId':_0x5dbb3a[_0x61fc('0x5d')]['id'],'ContactId':_0x11d371['id'],'FaxAccountId':_0x118945['id'],'fax':_0x5dbb3a[_0x61fc('0x5c')]['to'][0x0],'firstMsgDirection':_0x61fc('0xac'),'Messages':[_['merge'](_0x5dbb3a[_0x61fc('0x5c')],{'read':![],'body':_0x5dbb3a[_0x61fc('0x5c')]['attachments'][0x0]['filename'],'FaxAccountId':_0x118945['id'],'UserId':_0x5dbb3a[_0x61fc('0x5d')]['id'],'ContactId':_0x11d371['id'],'AttachmentId':_0x5dbb3a[_0x61fc('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x61fc('0x9a')],'as':_0x61fc('0xad')}]})['then'](function(_0x1cbb10){return[_0x1cbb10,!![]];});});}else{throw new Error(_0x61fc('0xae'));}})['spread'](function(_0x520ec9,_0xdac3c4){if(_0xdac3c4){return _0x520ec9;}return db['FaxMessage'][_0x61fc('0x5b')]({'direction':_0x61fc('0xac'),'read':![],'body':_0x5dbb3a['body'][_0x61fc('0xa2')][0x0]['filename'],'FaxAccountId':_0x118945['id'],'FaxInteractionId':_0x520ec9['id'],'UserId':_0x5dbb3a['user']['id'],'ContactId':_0x520ec9[_0x61fc('0xaf')],'AttachmentId':_0x5dbb3a['body'][_0x61fc('0xa2')][0x0]['id']})[_0x61fc('0x36')](function(_0xaea75){_0x520ec9[_0x61fc('0xb0')][_0x61fc('0xad')]=[];_0x520ec9[_0x61fc('0xb0')][_0x61fc('0xad')][_0x61fc('0x89')](_0xaea75[_0x61fc('0xb0')]);return _0x520ec9;});})['then'](function(_0x71c330){respondWithRpcPromise(_0x61fc('0xb1'),_0x61fc('0xb1'),{'FaxAccountId':_[_0x61fc('0xa7')](_0x5dbb3a[_0x61fc('0x62')]['id'])?undefined:_0x5dbb3a[_0x61fc('0x62')]['id'],'path':_[_0x61fc('0xa7')](_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa2')][0x0][_0x61fc('0x6')])?undefined:_0x5dbb3a[_0x61fc('0x5c')][_0x61fc('0xa2')][0x0][_0x61fc('0x6')],'fax':_[_0x61fc('0xa7')](_0x5dbb3a[_0x61fc('0x5c')]['to'][0x0])?undefined:_0x5dbb3a[_0x61fc('0x5c')]['to'][0x0],'AttachmentId':_0x5dbb3a[_0x61fc('0x5c')]['attachments'][0x0]['id']},client9002)[_0x61fc('0x36')](function(_0x31f827){logger['info'](_0x61fc('0xb2'),_0x31f827);})['catch'](function(_0x51fa93){logger['info'](_0x61fc('0xb2'),_0x51fa93);});return _0x71c330;})[_0x61fc('0x36')](respondWithResult(_0x209d79,null))[_0x61fc('0x29')](handleError(_0x209d79,null));};exports[_0x61fc('0xb3')]=function(_0x425bf1,_0x5bd976,_0x1abb3f){return db[_0x61fc('0x41')][_0x61fc('0x60')]({'where':{'id':_0x425bf1[_0x61fc('0x62')]['id']}})['then'](handleEntityNotFound(_0x5bd976,null))[_0x61fc('0x36')](function(_0x280475){if(_0x280475){return _0x280475[_0x61fc('0xb3')](_0x425bf1[_0x61fc('0x5c')][_0x61fc('0x6b')],_[_0x61fc('0x72')](_0x425bf1[_0x61fc('0x5c')],['ids','id'])||{})['spread'](function(_0x3a1c5e){for(var _0x181479=0x0;_0x181479<_0x425bf1[_0x61fc('0x5c')]['ids'][_0x61fc('0x58')];_0x181479+=0x1){socket['emit'](_0x61fc('0xb4'),{'UserId':Number(_0x425bf1[_0x61fc('0x5c')][_0x61fc('0x6b')][_0x181479]),'FaxAccountId':Number(_0x425bf1[_0x61fc('0x62')]['id'])});}return _0x3a1c5e;});}})[_0x61fc('0x36')](respondWithResult(_0x5bd976,null))[_0x61fc('0x29')](handleError(_0x5bd976,null));};exports['removeAgents']=function(_0x4722c7,_0x565056,_0x1178c9){return db['FaxAccount'][_0x61fc('0x60')]({'where':{'id':_0x4722c7[_0x61fc('0x62')]['id']}})[_0x61fc('0x36')](handleEntityNotFound(_0x565056,null))[_0x61fc('0x36')](function(_0xba53d1){if(_0xba53d1){return _0xba53d1[_0x61fc('0xb5')](_0x4722c7[_0x61fc('0x46')]['ids'])[_0x61fc('0x36')](function(){if(_[_0x61fc('0xb6')](_0x4722c7[_0x61fc('0x46')][_0x61fc('0x6b')])){for(var _0xfeb88f=0x0;_0xfeb88f<_0x4722c7['query']['ids'][_0x61fc('0x58')];_0xfeb88f+=0x1){socket[_0x61fc('0xb7')]('userFaxAccount:remove',{'UserId':Number(_0x4722c7[_0x61fc('0x46')][_0x61fc('0x6b')][_0xfeb88f]),'FaxAccountId':Number(_0x4722c7[_0x61fc('0x62')]['id'])});}}else{socket[_0x61fc('0xb7')]('userFaxAccount:remove',{'UserId':Number(_0x4722c7[_0x61fc('0x46')][_0x61fc('0x6b')]),'FaxAccountId':Number(_0x4722c7[_0x61fc('0x62')]['id'])});}});}})[_0x61fc('0x36')](respondWithStatusCode(_0x565056,null))[_0x61fc('0x29')](handleError(_0x565056,null));};exports['getAgents']=function(_0x212218,_0x3f6e33,_0x22294b){var _0x265ed5={};var _0x57ce37={};var _0x5847eb;var _0x16b360;return db['FaxAccount'][_0x61fc('0x6e')]({'where':{'id':_0x212218['params']['id']}})['then'](handleEntityNotFound(_0x3f6e33,null))['then'](function(_0xd75964){if(_0xd75964){_0x5847eb=_0xd75964;_0x57ce37[_0x61fc('0x4a')]=_[_0x61fc('0x47')](db[_0x61fc('0x76')]['rawAttributes']);_0x57ce37[_0x61fc('0x46')]=_[_0x61fc('0x47')](_0x212218[_0x61fc('0x46')]);_0x57ce37[_0x61fc('0x48')]=_[_0x61fc('0x49')](_0x57ce37[_0x61fc('0x4a')],_0x57ce37[_0x61fc('0x46')]);_0x265ed5['attributes']=_[_0x61fc('0x49')](_0x57ce37['model'],qs['fields'](_0x212218['query'][_0x61fc('0x4b')]));_0x265ed5['attributes']=_0x265ed5[_0x61fc('0x4c')][_0x61fc('0x58')]?_0x265ed5['attributes']:_0x57ce37[_0x61fc('0x4a')];_0x265ed5[_0x61fc('0x4f')]=qs[_0x61fc('0x50')](_0x212218[_0x61fc('0x46')]['sort']);_0x265ed5[_0x61fc('0x51')]=qs['filters'](_[_0x61fc('0x52')](_0x212218[_0x61fc('0x46')],_0x57ce37[_0x61fc('0x48')]));if(_0x212218['query']['filter']){_0x265ed5[_0x61fc('0x51')]=_[_0x61fc('0x54')](_0x265ed5[_0x61fc('0x51')],{'$or':_[_0x61fc('0x40')](_0x265ed5[_0x61fc('0x4c')],function(_0x3b55dd){var _0x26da80={};_0x26da80[_0x3b55dd]={'$like':'%'+_0x212218[_0x61fc('0x46')][_0x61fc('0x53')]+'%'};return _0x26da80;})});}_0x265ed5=_[_0x61fc('0x54')]({},_0x265ed5,_0x212218['options']);return _0x5847eb[_0x61fc('0xb8')](_0x265ed5);}})['then'](function(_0x397cc8){if(_0x397cc8){_0x16b360=_0x397cc8['length'];if(!_0x212218[_0x61fc('0x46')]['hasOwnProperty'](_0x61fc('0x68'))){_0x265ed5[_0x61fc('0x4e')]=qs[_0x61fc('0x4e')](_0x212218[_0x61fc('0x46')]['limit']);_0x265ed5['offset']=qs[_0x61fc('0x2e')](_0x212218['query']['offset']);}return _0x5847eb['getAgents'](_0x265ed5);}})[_0x61fc('0x36')](function(_0x28e02e){if(_0x28e02e){return _0x28e02e?{'count':_0x16b360,'rows':_0x28e02e}:null;}})[_0x61fc('0x36')](respondWithResult(_0x3f6e33,null))[_0x61fc('0x29')](handleError(_0x3f6e33,null));}; \ No newline at end of file +var _0x1fc4=['CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','defaults','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','reject','save','update','get','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','order','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','List','Contacts','DESC','attachments','join','server/files/attachments','basename'];(function(_0x312835,_0xff273e){var _0x1da8b9=function(_0x193c4){while(--_0x193c4){_0x312835['push'](_0x312835['shift']());}};_0x1da8b9(++_0xff273e);}(_0x1fc4,0xd3));var _0x41fc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1fc4[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x41fc('0x0'));var rimraf=require(_0x41fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x41fc('0x2'));var moment=require(_0x41fc('0x3'));var BPromise=require(_0x41fc('0x4'));var Mustache=require(_0x41fc('0x5'));var util=require(_0x41fc('0x6'));var path=require(_0x41fc('0x7'));var sox=require(_0x41fc('0x8'));var csv=require(_0x41fc('0x9'));var ejs=require(_0x41fc('0xa'));var fs=require('fs');var fs_extra=require(_0x41fc('0xb'));var _=require('lodash');var squel=require(_0x41fc('0xc'));var crypto=require('crypto');var jsforce=require(_0x41fc('0xd'));var deskjs=require(_0x41fc('0xe'));var toCsv=require(_0x41fc('0x9'));var querystring=require(_0x41fc('0xf'));var Papa=require('papaparse');var Redis=require(_0x41fc('0x10'));var authService=require(_0x41fc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x41fc('0x12'));var hardwareService=require(_0x41fc('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x41fc('0x14'));var config=require(_0x41fc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x41fc('0x16'))['db'];config[_0x41fc('0x17')]=_['defaults'](config[_0x41fc('0x17')],{'host':_0x41fc('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41fc('0x17')]));require('./faxAccount.socket')[_0x41fc('0x19')](socket);var jayson=require(_0x41fc('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x41fc('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22ccff,_0x52b02a,_0x17cfd3,_0x3fe436){return new BPromise(function(_0x47e2f4,_0x17f302){var _0x53df80=_0x3fe436||client;return _0x53df80['request'](_0x22ccff,_0x17cfd3)[_0x41fc('0x1c')](function(_0x175ef1){logger[_0x41fc('0x1d')](_0x41fc('0x1e'),_0x52b02a,_0x41fc('0x1f'));logger[_0x41fc('0x20')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x52b02a,_0x41fc('0x1f'),JSON[_0x41fc('0x21')](_0x175ef1));if(_0x175ef1['error']){if(_0x175ef1[_0x41fc('0x22')][_0x41fc('0x23')]===0x1f4){logger[_0x41fc('0x22')]('FaxAccount,\x20%s,\x20%s',_0x52b02a,_0x175ef1[_0x41fc('0x22')][_0x41fc('0x24')]);return _0x17f302(_0x175ef1[_0x41fc('0x22')][_0x41fc('0x24')]);}logger['error'](_0x41fc('0x1e'),_0x52b02a,_0x175ef1[_0x41fc('0x22')][_0x41fc('0x24')]);return _0x47e2f4(_0x175ef1['error'][_0x41fc('0x24')]);}else{logger['info'](_0x41fc('0x1e'),_0x52b02a,_0x41fc('0x1f'));_0x47e2f4(_0x175ef1[_0x41fc('0x25')][_0x41fc('0x24')]);}})[_0x41fc('0x26')](function(_0x29effe){logger[_0x41fc('0x22')]('FaxAccount,\x20%s,\x20%s',_0x52b02a,_0x29effe);_0x17f302(_0x29effe);});});}function respondWithStatusCode(_0x272ca1,_0x10ea28){_0x10ea28=_0x10ea28||0xcc;return function(_0x1dbb09){if(_0x1dbb09){return _0x272ca1[_0x41fc('0x27')](_0x10ea28);}return _0x272ca1['status'](_0x10ea28)[_0x41fc('0x28')]();};}function respondWithResult(_0x109043,_0x486a0f){_0x486a0f=_0x486a0f||0xc8;return function(_0x44be2a){if(_0x44be2a){return _0x109043['status'](_0x486a0f)[_0x41fc('0x29')](_0x44be2a);}};}function respondWithFilteredResult(_0x496403,_0x18b6d2){return function(_0x521652){if(_0x521652){var _0x48b901=typeof _0x18b6d2[_0x41fc('0x2a')]===_0x41fc('0x2b')&&typeof _0x18b6d2['limit']===_0x41fc('0x2b');var _0x176979=_0x521652[_0x41fc('0x2c')];var _0xcb072d=_0x48b901?0x0:_0x18b6d2['offset'];var _0x42f3ba=_0x48b901?_0x521652[_0x41fc('0x2c')]:_0x18b6d2[_0x41fc('0x2a')]+_0x18b6d2[_0x41fc('0x2d')];var _0x28c46b;if(_0x42f3ba>=_0x176979){_0x42f3ba=_0x176979;_0x28c46b=0xc8;}else{_0x28c46b=0xce;}_0x496403[_0x41fc('0x2e')](_0x28c46b);return _0x496403['set'](_0x41fc('0x2f'),_0xcb072d+'-'+_0x42f3ba+'/'+_0x176979)[_0x41fc('0x29')](_0x521652);}return null;};}function patchUpdates(_0x41e587){return function(_0x427779){try{jsonpatch['apply'](_0x427779,_0x41e587,!![]);}catch(_0x31a841){return BPromise[_0x41fc('0x30')](_0x31a841);}return _0x427779[_0x41fc('0x31')]();};}function saveUpdates(_0x45896f,_0x403f53){return function(_0x332df4){if(_0x332df4){return _0x332df4[_0x41fc('0x32')](_0x45896f)[_0x41fc('0x1c')](function(_0x5f0a8b){return _0x5f0a8b;});}return null;};}function removeEntity(_0x2b9e94,_0x31f47d){return function(_0x54621b){if(_0x54621b){return _0x54621b['destroy']()['then'](function(){var _0x49c17c=_0x54621b[_0x41fc('0x33')]({'plain':!![]});var _0x5ba0ce='FaxAccounts';return db[_0x41fc('0x34')][_0x41fc('0x35')]({'where':{'type':_0x5ba0ce,'resourceId':_0x49c17c['id']}})['then'](function(){return _0x54621b;});})['then'](function(){_0x2b9e94['status'](0xcc)[_0x41fc('0x28')]();});}};}function handleEntityNotFound(_0x1371e4,_0x5cedcb){return function(_0x16cb8d){if(!_0x16cb8d){_0x1371e4[_0x41fc('0x27')](0x194);}return _0x16cb8d;};}function handleError(_0x363fce,_0xd1e45){_0xd1e45=_0xd1e45||0x1f4;return function(_0x459d69){logger[_0x41fc('0x22')](_0x459d69[_0x41fc('0x36')]);if(_0x459d69[_0x41fc('0x37')]){delete _0x459d69[_0x41fc('0x37')];}_0x363fce[_0x41fc('0x2e')](_0xd1e45)[_0x41fc('0x38')](_0x459d69);};}exports[_0x41fc('0x39')]=function(_0x374da1,_0x390d91){var _0x4b2575={'include':[{'model':db[_0x41fc('0x3a')],'as':_0x41fc('0x3b')}]},_0x55eebb={},_0xa267aa={'count':0x0,'rows':[]};var _0x2e9a9a=_[_0x41fc('0x3c')](db[_0x41fc('0x3d')][_0x41fc('0x3e')],function(_0x2ed761){return{'name':_0x2ed761[_0x41fc('0x3f')],'type':_0x2ed761['type'][_0x41fc('0x40')]};});_0x55eebb[_0x41fc('0x41')]=_[_0x41fc('0x3c')](_0x2e9a9a,_0x41fc('0x37'));_0x55eebb[_0x41fc('0x42')]=_[_0x41fc('0x43')](_0x374da1[_0x41fc('0x42')]);_0x55eebb[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0x55eebb['model'],_0x55eebb[_0x41fc('0x42')]);_0x4b2575['attributes']=_['intersection'](_0x55eebb[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x374da1[_0x41fc('0x42')][_0x41fc('0x46')]));_0x4b2575[_0x41fc('0x47')]=_0x4b2575[_0x41fc('0x47')][_0x41fc('0x48')]?_0x4b2575['attributes']:_0x55eebb['model'];if(!_0x374da1[_0x41fc('0x42')]['hasOwnProperty'](_0x41fc('0x49'))){_0x4b2575[_0x41fc('0x2d')]=qs['limit'](_0x374da1['query'][_0x41fc('0x2d')]);_0x4b2575[_0x41fc('0x2a')]=qs['offset'](_0x374da1[_0x41fc('0x42')][_0x41fc('0x2a')]);}_0x4b2575['order']=qs[_0x41fc('0x4a')](_0x374da1[_0x41fc('0x42')][_0x41fc('0x4a')]);_0x4b2575[_0x41fc('0x4b')]=qs['filters'](_[_0x41fc('0x4c')](_0x374da1[_0x41fc('0x42')],_0x55eebb[_0x41fc('0x44')]),_0x2e9a9a);if(_0x374da1[_0x41fc('0x42')]['filter']){_0x4b2575[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x4b2575[_0x41fc('0x4b')],{'$or':_[_0x41fc('0x3c')](_0x2e9a9a,function(_0x2adccd){if(_0x2adccd[_0x41fc('0x4e')]!=='VIRTUAL'){var _0x4ba04b={};_0x4ba04b[_0x2adccd[_0x41fc('0x37')]]={'$like':'%'+_0x374da1[_0x41fc('0x42')][_0x41fc('0x4f')]+'%'};return _0x4ba04b;}})});}_0x4b2575=_[_0x41fc('0x4d')]({},_0x4b2575,_0x374da1[_0x41fc('0x50')]);var _0x4e6e12={'where':_0x4b2575[_0x41fc('0x4b')]};return db[_0x41fc('0x3d')]['count'](_0x4e6e12)[_0x41fc('0x1c')](function(_0x10865a){_0xa267aa['count']=_0x10865a;if(_0x374da1[_0x41fc('0x42')][_0x41fc('0x51')]){_0x4b2575[_0x41fc('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0x41fc('0x53')](_0x4b2575);})['then'](function(_0x5d957d){_0xa267aa[_0x41fc('0x54')]=_0x5d957d;return _0xa267aa;})[_0x41fc('0x1c')](respondWithFilteredResult(_0x390d91,_0x4b2575))[_0x41fc('0x26')](handleError(_0x390d91,null));};exports[_0x41fc('0x55')]=function(_0x3a4688,_0x4adfbe){var _0x398956={'raw':![],'where':{'id':_0x3a4688[_0x41fc('0x56')]['id']},'include':[{'model':db[_0x41fc('0x3a')],'as':_0x41fc('0x3b')}]},_0x52e013={};_0x52e013[_0x41fc('0x41')]=_[_0x41fc('0x43')](db['FaxAccount'][_0x41fc('0x3e')]);_0x52e013['query']=_[_0x41fc('0x43')](_0x3a4688[_0x41fc('0x42')]);_0x52e013[_0x41fc('0x44')]=_['intersection'](_0x52e013[_0x41fc('0x41')],_0x52e013[_0x41fc('0x42')]);_0x398956[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x52e013[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x3a4688[_0x41fc('0x42')][_0x41fc('0x46')]));_0x398956[_0x41fc('0x47')]=_0x398956['attributes'][_0x41fc('0x48')]?_0x398956[_0x41fc('0x47')]:_0x52e013[_0x41fc('0x41')];if(_0x3a4688[_0x41fc('0x42')][_0x41fc('0x51')]){_0x398956['include']=[{'all':!![]}];}_0x398956=_[_0x41fc('0x4d')]({},_0x398956,_0x3a4688[_0x41fc('0x50')]);return db[_0x41fc('0x3d')][_0x41fc('0x57')](_0x398956)['then'](handleEntityNotFound(_0x4adfbe,null))[_0x41fc('0x1c')](respondWithResult(_0x4adfbe,null))[_0x41fc('0x26')](handleError(_0x4adfbe,null));};exports[_0x41fc('0x58')]=function(_0x2a6d74,_0x25a4ed){return db[_0x41fc('0x3d')][_0x41fc('0x58')](_0x2a6d74[_0x41fc('0x59')],{})[_0x41fc('0x1c')](function(_0x76554b){var _0x47b6e4=_0x2a6d74[_0x41fc('0x5a')][_0x41fc('0x33')]({'plain':!![]});if(!_0x47b6e4)throw new Error(_0x41fc('0x5b'));if(_0x47b6e4[_0x41fc('0x5c')]==='user'){var _0xc32ad=_0x76554b[_0x41fc('0x33')]({'plain':!![]});var _0x324a79=_0x41fc('0x5d');return db[_0x41fc('0x5e')]['find']({'where':{'name':_0x324a79,'userProfileId':_0x47b6e4[_0x41fc('0x5f')]},'raw':!![]})['then'](function(_0x211b6a){if(_0x211b6a&&_0x211b6a[_0x41fc('0x60')]===0x0){return db[_0x41fc('0x34')]['create']({'name':_0xc32ad['name'],'resourceId':_0xc32ad['id'],'type':_0x211b6a[_0x41fc('0x37')],'sectionId':_0x211b6a['id']},{})[_0x41fc('0x1c')](function(){return _0x76554b;});}else{return _0x76554b;}})[_0x41fc('0x26')](function(_0x1e677a){logger['error'](_0x41fc('0x61'),_0x1e677a);throw _0x1e677a;});}return _0x76554b;})[_0x41fc('0x1c')](respondWithResult(_0x25a4ed,0xc9))[_0x41fc('0x26')](handleError(_0x25a4ed,null));};exports['update']=function(_0x4ce206,_0x2a5a26){if(_0x4ce206[_0x41fc('0x59')]['id']){delete _0x4ce206[_0x41fc('0x59')]['id'];}return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x4ce206[_0x41fc('0x56')]['id']},'include':[{'model':db[_0x41fc('0x3a')],'as':_0x41fc('0x3b')}]})[_0x41fc('0x1c')](handleEntityNotFound(_0x2a5a26,null))[_0x41fc('0x1c')](saveUpdates(_0x4ce206['body'],null))[_0x41fc('0x1c')](respondWithResult(_0x2a5a26,null))[_0x41fc('0x26')](handleError(_0x2a5a26,null));};exports['destroy']=function(_0x494dc4,_0x2afdd0){return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x494dc4[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x2afdd0,null))[_0x41fc('0x1c')](removeEntity(_0x2afdd0,null))[_0x41fc('0x26')](handleError(_0x2afdd0,null));};exports[_0x41fc('0x62')]=function(_0x2d6415,_0x5e6e48){return db['FaxAccount'][_0x41fc('0x62')]()['then'](respondWithResult(_0x5e6e48,null))['catch'](handleError(_0x5e6e48,null));};exports['addDisposition']=function(_0x1352fc,_0x4669b8,_0x1ae428){if(_0x1352fc[_0x41fc('0x59')]['id']){delete _0x1352fc[_0x41fc('0x59')]['id'];}return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x1352fc[_0x41fc('0x56')]['id']}})['then'](handleEntityNotFound(_0x4669b8,null))[_0x41fc('0x1c')](function(_0x3f076c){if(_0x3f076c){_0x1352fc[_0x41fc('0x59')][_0x41fc('0x63')]=_0x3f076c['id'];return db[_0x41fc('0x64')][_0x41fc('0x58')](_0x1352fc[_0x41fc('0x59')]);}})[_0x41fc('0x1c')](respondWithResult(_0x4669b8,null))[_0x41fc('0x26')](handleError(_0x4669b8,null));};exports[_0x41fc('0x65')]=function(_0x480ddb,_0x2ac7af,_0x35e066){var _0x39a6fb={'raw':![],'where':{}};var _0x42d566={};var _0x4ba71b={'count':0x0,'rows':[]};return db[_0x41fc('0x3d')][_0x41fc('0x66')]({'where':{'id':_0x480ddb[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x2ac7af,null))[_0x41fc('0x1c')](function(_0x10cf88){if(_0x10cf88){_0x42d566[_0x41fc('0x41')]=_['keys'](db['Disposition'][_0x41fc('0x3e')]);_0x42d566[_0x41fc('0x42')]=_['keys'](_0x480ddb[_0x41fc('0x42')]);_0x42d566['filters']=_[_0x41fc('0x45')](_0x42d566['model'],_0x42d566[_0x41fc('0x42')]);_0x39a6fb['attributes']=_[_0x41fc('0x45')](_0x42d566['model'],qs['fields'](_0x480ddb[_0x41fc('0x42')][_0x41fc('0x46')]));_0x39a6fb[_0x41fc('0x47')]=_0x39a6fb['attributes'][_0x41fc('0x48')]?_0x39a6fb[_0x41fc('0x47')]:_0x42d566[_0x41fc('0x41')];if(!_0x480ddb[_0x41fc('0x42')]['hasOwnProperty'](_0x41fc('0x49'))){_0x39a6fb['limit']=qs[_0x41fc('0x2d')](_0x480ddb[_0x41fc('0x42')]['limit']);_0x39a6fb[_0x41fc('0x2a')]=qs[_0x41fc('0x2a')](_0x480ddb[_0x41fc('0x42')]['offset']);}_0x39a6fb['order']=qs['sort'](_0x480ddb['query'][_0x41fc('0x4a')]);_0x39a6fb[_0x41fc('0x4b')]=qs[_0x41fc('0x44')](_['pick'](_0x480ddb[_0x41fc('0x42')],_0x42d566[_0x41fc('0x44')]));_0x39a6fb[_0x41fc('0x4b')][_0x41fc('0x63')]=_0x10cf88['id'];if(_0x480ddb[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x39a6fb['where']=_[_0x41fc('0x4d')](_0x39a6fb[_0x41fc('0x4b')],{'$or':_[_0x41fc('0x3c')](_0x39a6fb[_0x41fc('0x47')],function(_0x1990cf){var _0x5cbb80={};_0x5cbb80[_0x1990cf]={'$like':'%'+_0x480ddb[_0x41fc('0x42')][_0x41fc('0x4f')]+'%'};return _0x5cbb80;})});}_0x39a6fb=_[_0x41fc('0x4d')]({},_0x39a6fb,_0x480ddb[_0x41fc('0x50')]);return db[_0x41fc('0x64')][_0x41fc('0x2c')]({'where':_0x39a6fb[_0x41fc('0x4b')]})[_0x41fc('0x1c')](function(_0x21b9c2){_0x4ba71b['count']=_0x21b9c2;if(_0x480ddb['query'][_0x41fc('0x51')]){_0x39a6fb[_0x41fc('0x52')]=[{'all':!![]}];}return db[_0x41fc('0x64')][_0x41fc('0x53')](_0x39a6fb);})[_0x41fc('0x1c')](function(_0x20df13){_0x4ba71b[_0x41fc('0x54')]=_0x20df13;return _0x4ba71b;});}})[_0x41fc('0x1c')](respondWithFilteredResult(_0x2ac7af,_0x39a6fb))[_0x41fc('0x26')](handleError(_0x2ac7af,null));};exports[_0x41fc('0x67')]=function(_0x2d44d3,_0x2290e5,_0x4b9a26){return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x2d44d3[_0x41fc('0x56')]['id']}})['then'](handleEntityNotFound(_0x2290e5,null))[_0x41fc('0x1c')](function(_0xd1d84e){if(_0xd1d84e){return _0xd1d84e[_0x41fc('0x67')](_0x2d44d3[_0x41fc('0x42')][_0x41fc('0x68')]);}})[_0x41fc('0x1c')](respondWithStatusCode(_0x2290e5,null))[_0x41fc('0x26')](handleError(_0x2290e5,null));};exports[_0x41fc('0x69')]=function(_0x467f4f,_0x2b635c,_0x284704){if(_0x467f4f[_0x41fc('0x59')]['id']){delete _0x467f4f['body']['id'];}return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x467f4f[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x2b635c,null))['then'](function(_0xf4ad45){if(_0xf4ad45){_0x467f4f[_0x41fc('0x59')]['FaxAccountId']=_0xf4ad45['id'];return db[_0x41fc('0x6a')][_0x41fc('0x58')](_0x467f4f[_0x41fc('0x59')]);}})[_0x41fc('0x1c')](respondWithResult(_0x2b635c,null))[_0x41fc('0x26')](handleError(_0x2b635c,null));};exports[_0x41fc('0x6b')]=function(_0x1f5fe8,_0x5d609d,_0x58fb57){var _0x296973={'raw':![],'where':{}};var _0x565e2b={};var _0x492815={'count':0x0,'rows':[]};return db[_0x41fc('0x3d')][_0x41fc('0x66')]({'where':{'id':_0x1f5fe8['params']['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x5d609d,null))[_0x41fc('0x1c')](function(_0x3b673a){if(_0x3b673a){_0x565e2b['model']=_[_0x41fc('0x43')](db[_0x41fc('0x6a')][_0x41fc('0x3e')]);_0x565e2b[_0x41fc('0x42')]=_[_0x41fc('0x43')](_0x1f5fe8[_0x41fc('0x42')]);_0x565e2b['filters']=_[_0x41fc('0x45')](_0x565e2b[_0x41fc('0x41')],_0x565e2b[_0x41fc('0x42')]);_0x296973[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x565e2b[_0x41fc('0x41')],qs['fields'](_0x1f5fe8[_0x41fc('0x42')]['fields']));_0x296973['attributes']=_0x296973[_0x41fc('0x47')]['length']?_0x296973['attributes']:_0x565e2b[_0x41fc('0x41')];if(!_0x1f5fe8[_0x41fc('0x42')][_0x41fc('0x6c')](_0x41fc('0x49'))){_0x296973[_0x41fc('0x2d')]=qs[_0x41fc('0x2d')](_0x1f5fe8[_0x41fc('0x42')]['limit']);_0x296973[_0x41fc('0x2a')]=qs[_0x41fc('0x2a')](_0x1f5fe8[_0x41fc('0x42')]['offset']);}_0x296973[_0x41fc('0x6d')]=qs[_0x41fc('0x4a')](_0x1f5fe8['query'][_0x41fc('0x4a')]);_0x296973[_0x41fc('0x4b')]=qs[_0x41fc('0x44')](_['pick'](_0x1f5fe8[_0x41fc('0x42')],_0x565e2b['filters']));_0x296973[_0x41fc('0x4b')][_0x41fc('0x63')]=_0x3b673a['id'];if(_0x1f5fe8[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x296973[_0x41fc('0x4b')]=_['merge'](_0x296973[_0x41fc('0x4b')],{'$or':_['map'](_0x296973['attributes'],function(_0x51ff56){var _0x181226={};_0x181226[_0x51ff56]={'$like':'%'+_0x1f5fe8[_0x41fc('0x42')]['filter']+'%'};return _0x181226;})});}_0x296973=_[_0x41fc('0x4d')]({},_0x296973,_0x1f5fe8[_0x41fc('0x50')]);return db[_0x41fc('0x6a')][_0x41fc('0x2c')]({'where':_0x296973['where']})[_0x41fc('0x1c')](function(_0xb17a57){_0x492815[_0x41fc('0x2c')]=_0xb17a57;if(_0x1f5fe8[_0x41fc('0x42')][_0x41fc('0x51')]){_0x296973['include']=[{'all':!![]}];}return db[_0x41fc('0x6a')][_0x41fc('0x53')](_0x296973);})['then'](function(_0x4c7cd3){_0x492815[_0x41fc('0x54')]=_0x4c7cd3;return _0x492815;});}})[_0x41fc('0x1c')](respondWithFilteredResult(_0x5d609d,_0x296973))[_0x41fc('0x26')](handleError(_0x5d609d,null));};exports[_0x41fc('0x6e')]=function(_0x2e35e2,_0x283063,_0x455d60){return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x2e35e2['params']['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x283063,null))[_0x41fc('0x1c')](function(_0x277ebf){if(_0x277ebf){return _0x277ebf[_0x41fc('0x6e')](_0x2e35e2['query'][_0x41fc('0x68')]);}})[_0x41fc('0x1c')](respondWithStatusCode(_0x283063,null))[_0x41fc('0x26')](handleError(_0x283063,null));};exports['addInteraction']=function(_0x1b52dd,_0x4375c1,_0x43bad6){return db[_0x41fc('0x6f')][_0x41fc('0x57')]({'where':{'id':_0x1b52dd[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x4375c1,null))['then'](function(_0x562fb1){if(_0x562fb1){return _0x562fb1[_0x41fc('0x70')](_0x1b52dd[_0x41fc('0x59')][_0x41fc('0x68')],_[_0x41fc('0x71')](_0x1b52dd[_0x41fc('0x59')],[_0x41fc('0x68'),'id'])||{});}})[_0x41fc('0x1c')](respondWithResult(_0x4375c1,null))[_0x41fc('0x26')](handleError(_0x4375c1,null));};exports[_0x41fc('0x72')]=function(_0x52f6f8,_0x19f6cf,_0x332d39){var _0x1c42d9={'raw':![],'where':{}};var _0x44b2f2={};var _0xabde66={'count':0x0,'rows':[]};return db[_0x41fc('0x3d')]['findOne']({'where':{'id':_0x52f6f8[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x19f6cf,null))['then'](function(_0x3522da){if(_0x3522da){_0x44b2f2[_0x41fc('0x41')]=_[_0x41fc('0x43')](db[_0x41fc('0x6f')][_0x41fc('0x3e')]);_0x44b2f2[_0x41fc('0x42')]=_['keys'](_0x52f6f8[_0x41fc('0x42')]);_0x44b2f2[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0x44b2f2[_0x41fc('0x41')],_0x44b2f2[_0x41fc('0x42')]);_0x1c42d9[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x44b2f2[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x52f6f8[_0x41fc('0x42')]['fields']));_0x1c42d9[_0x41fc('0x47')]=_0x1c42d9[_0x41fc('0x47')][_0x41fc('0x48')]?_0x1c42d9[_0x41fc('0x47')]:_0x44b2f2[_0x41fc('0x41')];if(!_0x52f6f8['query'][_0x41fc('0x6c')](_0x41fc('0x49'))){_0x1c42d9[_0x41fc('0x2d')]=qs[_0x41fc('0x2d')](_0x52f6f8['query']['limit']);_0x1c42d9['offset']=qs[_0x41fc('0x2a')](_0x52f6f8['query'][_0x41fc('0x2a')]);}_0x1c42d9[_0x41fc('0x6d')]=qs[_0x41fc('0x4a')](_0x52f6f8['query']['sort']);_0x1c42d9['where']=qs[_0x41fc('0x44')](_['pick'](_0x52f6f8[_0x41fc('0x42')],_0x44b2f2[_0x41fc('0x44')]));_0x1c42d9['where'][_0x41fc('0x63')]=_0x3522da['id'];if(_0x52f6f8[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x1c42d9[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x1c42d9['where'],{'$or':_[_0x41fc('0x3c')](_0x1c42d9[_0x41fc('0x47')],function(_0x48791d){var _0x506611={};_0x506611[_0x48791d]={'$like':'%'+_0x52f6f8[_0x41fc('0x42')][_0x41fc('0x4f')]+'%'};return _0x506611;})});}_0x1c42d9=_[_0x41fc('0x4d')]({},_0x1c42d9,_0x52f6f8[_0x41fc('0x50')]);return db['FaxInteraction'][_0x41fc('0x2c')]({'where':_0x1c42d9['where']})[_0x41fc('0x1c')](function(_0xfac038){_0xabde66[_0x41fc('0x2c')]=_0xfac038;if(_0x52f6f8[_0x41fc('0x42')][_0x41fc('0x51')]){_0x1c42d9[_0x41fc('0x52')]=[{'model':db['CmContact'],'as':_0x41fc('0x73'),'required':![]},{'model':db[_0x41fc('0x74')],'as':_0x41fc('0x75'),'attributes':[_0x41fc('0x37'),_0x41fc('0x76'),_0x41fc('0x77')],'required':![]},{'model':db[_0x41fc('0x78')],'as':'Tags','attributes':['id','name','color'],'where':_0x52f6f8[_0x41fc('0x42')]['tag']?{'id':_0x52f6f8[_0x41fc('0x42')]['tag']}:undefined,'required':_0x52f6f8[_0x41fc('0x42')]['tag']?!![]:![]}];}return db[_0x41fc('0x6f')]['findAll'](_0x1c42d9);})['then'](function(_0x5a3519){_0xabde66[_0x41fc('0x54')]=_0x5a3519;return _0xabde66;});}})[_0x41fc('0x1c')](respondWithFilteredResult(_0x19f6cf,_0x1c42d9))[_0x41fc('0x26')](handleError(_0x19f6cf,null));};exports[_0x41fc('0x79')]=function(_0x333bf3,_0x198814){var _0x378b70=_0x333bf3[_0x41fc('0x56')]['id'];var _0x1a8163=_0x333bf3[_0x41fc('0x59')];var _0x4d5423=0xc8;var _0x2086b3=null;return db[_0x41fc('0x7a')][_0x41fc('0x7b')]({'isolationLevel':db[_0x41fc('0x7a')][_0x41fc('0x7c')]['ISOLATION_LEVELS'][_0x41fc('0x7d')]},function(_0x3bf2f3){return db[_0x41fc('0x3d')][_0x41fc('0x66')]({'where':{'id':_0x378b70},'transaction':_0x3bf2f3})[_0x41fc('0x1c')](function(_0x107b58){if(_0x107b58){return db[_0x41fc('0x7e')][_0x41fc('0x35')]({'where':{'FaxAccountId':_0x378b70},'transaction':_0x3bf2f3})['then'](function(){var _0x32b61d=_['map'](_0x1a8163,function(_0x2af449){_0x2af449[_0x41fc('0x63')]=_0x378b70;return _0x2af449;});return db[_0x41fc('0x7e')][_0x41fc('0x7f')](_0x32b61d,{'transaction':_0x3bf2f3});});}else{_0x4d5423=0x194;_0x2086b3=[];}});})[_0x41fc('0x1c')](function(){if(_0x4d5423!==0x194){return db['FaxApplication'][_0x41fc('0x80')]({'where':{'FaxAccountId':_0x378b70},'order':_0x41fc('0x81')})[_0x41fc('0x1c')](function(_0x1beb66){_0x2086b3=_0x1beb66;});}})[_0x41fc('0x26')](function(_0x2b5619){_0x4d5423=0x1f4;logger['error'](_0x2b5619[_0x41fc('0x36')]);if(_0x2b5619['name']){delete _0x2b5619[_0x41fc('0x37')];}_0x2086b3=_0x2b5619;})[_0x41fc('0x82')](function(){if(_0x2086b3===null){_0x198814[_0x41fc('0x27')](_0x4d5423);}else{if(_0x4d5423===0x1f4){_0x198814[_0x41fc('0x2e')](_0x4d5423)['send'](_0x2086b3);}else{_0x198814[_0x41fc('0x2e')](_0x4d5423)[_0x41fc('0x29')](_0x2086b3);}}});};exports[_0x41fc('0x83')]=function(_0x33876e,_0x332f50,_0x140fbe){var _0x36a8ef={};var _0x14bcab={};var _0x2c52b0;var _0x5dbf27;return db[_0x41fc('0x3d')][_0x41fc('0x66')]({'where':{'id':_0x33876e[_0x41fc('0x56')]['id']}})['then'](handleEntityNotFound(_0x332f50,null))[_0x41fc('0x1c')](function(_0x56d3b6){if(_0x56d3b6){_0x2c52b0=_0x56d3b6;_0x14bcab['model']=_[_0x41fc('0x43')](db['FaxApplication'][_0x41fc('0x3e')]);_0x14bcab[_0x41fc('0x42')]=_[_0x41fc('0x43')](_0x33876e[_0x41fc('0x42')]);_0x14bcab[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0x14bcab[_0x41fc('0x41')],_0x14bcab['query']);_0x36a8ef[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x14bcab[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x33876e[_0x41fc('0x42')][_0x41fc('0x46')]));_0x36a8ef['attributes']=_0x36a8ef[_0x41fc('0x47')]['length']?_0x36a8ef[_0x41fc('0x47')]:_0x14bcab[_0x41fc('0x41')];_0x36a8ef[_0x41fc('0x6d')]=qs[_0x41fc('0x4a')](_0x33876e[_0x41fc('0x42')][_0x41fc('0x4a')]);_0x36a8ef['where']=qs[_0x41fc('0x44')](_[_0x41fc('0x4c')](_0x33876e['query'],_0x14bcab[_0x41fc('0x44')]));if(_0x33876e[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x36a8ef[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x36a8ef['where'],{'$or':_['map'](_0x36a8ef[_0x41fc('0x47')],function(_0x1d2f42){var _0x16baa8={};_0x16baa8[_0x1d2f42]={'$like':'%'+_0x33876e['query'][_0x41fc('0x4f')]+'%'};return _0x16baa8;})});}_0x36a8ef=_[_0x41fc('0x4d')]({},_0x36a8ef,_0x33876e[_0x41fc('0x50')]);return _0x2c52b0['getApplications'](_0x36a8ef);}})['then'](function(_0x1cc47e){if(_0x1cc47e){_0x5dbf27=_0x1cc47e[_0x41fc('0x48')];if(!_0x33876e[_0x41fc('0x42')][_0x41fc('0x6c')]('nolimit')){_0x36a8ef[_0x41fc('0x2d')]=qs[_0x41fc('0x2d')](_0x33876e['query'][_0x41fc('0x2d')]);_0x36a8ef[_0x41fc('0x2a')]=qs[_0x41fc('0x2a')](_0x33876e[_0x41fc('0x42')]['offset']);}return _0x2c52b0[_0x41fc('0x83')](_0x36a8ef);}})[_0x41fc('0x1c')](function(_0x460ac1){if(_0x460ac1){return _0x460ac1?{'count':_0x5dbf27,'rows':_0x460ac1}:null;}})['then'](respondWithResult(_0x332f50,null))['catch'](handleError(_0x332f50,null));};function Extension(_0xc4b44b,_0xa3a7b3,_0x56cfd1,_0xc339e0){this['context']='from-voip-provider';this[_0x41fc('0x84')]=_0xc4b44b[_0x41fc('0x85')];this[_0x41fc('0x86')]=_0xc339e0;this[_0x41fc('0x4e')]=_0x41fc('0x87');this['description']=_0x41fc('0x88');this[_0x41fc('0x63')]=_0xc4b44b['id'];this[_0x41fc('0x81')]=_0xa3a7b3;this[_0x41fc('0x89')]=_0x56cfd1;}function createExtensionsReciveFax(_0x147a73){var _0x4401d1=0x1;var _0x51df29=[];_0x51df29[_0x41fc('0x8a')](new Extension(_0x147a73,_0x4401d1,'',_0x41fc('0x8b')));_0x4401d1+=0x1;_0x51df29[_0x41fc('0x8a')](new Extension(_0x147a73,_0x4401d1,'CDR(type)=inbound-fax',_0x41fc('0x8c')));_0x4401d1+=0x1;for(var _0x435648 in _0x147a73){if(_0x147a73['hasOwnProperty'](_0x435648)&&(_0x435648===_0x41fc('0x8d')||_0x435648==='localstationid'||_0x435648===_0x41fc('0x8e')||_0x435648===_0x41fc('0x8f')||_0x435648==='headerinfo'||_0x435648===_0x41fc('0x90')||_0x435648===_0x41fc('0x91')||_0x435648==='modem'||_0x435648===_0x41fc('0x92'))){_0x51df29[_0x41fc('0x8a')](new Extension(_0x147a73,_0x4401d1,_0x41fc('0x93')+_0x435648+')='+_0x147a73[_0x435648],'Set'));_0x4401d1+=0x1;}}_0x51df29['push'](new Extension(_0x147a73,_0x4401d1,'6','Wait'));_0x4401d1+=0x1;_0x51df29['push'](new Extension(_0x147a73,_0x4401d1,'/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',_0x41fc('0x94')));_0x4401d1=0x0;return _0x51df29;}exports[_0x41fc('0x95')]=function(_0x2c1cd9,_0x5bd595,_0x5bc493){var _0x3b978c;return db[_0x41fc('0x7a')]['transaction'](function(_0x5c2f7d){return db['FaxAccount'][_0x41fc('0x58')](_0x2c1cd9[_0x41fc('0x59')],{'transaction':_0x5c2f7d})[_0x41fc('0x1c')](function(_0x5e416e){_0x3b978c=_0x5e416e['get']({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x3b978c),{'transaction':_0x5c2f7d});});})[_0x41fc('0x1c')](function(){return _0x3b978c;})['then'](respondWithResult(_0x5bd595,null))[_0x41fc('0x26')](handleError(_0x5bd595,null));};exports[_0x41fc('0x96')]=function(_0x1ff1e5,_0x3987d5,_0x4f1b99){var _0x48135a;return db[_0x41fc('0x7a')][_0x41fc('0x7b')](function(_0x1d2a5d){return db['FaxAccount'][_0x41fc('0x32')](_0x1ff1e5[_0x41fc('0x59')],{'where':{'id':_0x1ff1e5[_0x41fc('0x59')]['id']},'transaction':_0x1d2a5d})['then'](function(_0x230f92){return db['VoiceExtension'][_0x41fc('0x35')]({'where':{'FaxAccountId':_0x1ff1e5[_0x41fc('0x59')]['id']},'transaction':_0x1d2a5d})[_0x41fc('0x1c')](function(_0x248514){return db[_0x41fc('0x97')][_0x41fc('0x7f')](createExtensionsReciveFax(_[_0x41fc('0x71')](_0x1ff1e5['body'],[_0x41fc('0x98'),_0x41fc('0x40'),_0x41fc('0x99'),_0x41fc('0x9a'),_0x41fc('0x9b'),_0x41fc('0x9c')])),{'transaction':_0x1d2a5d});});});})['then'](function(){return db[_0x41fc('0x3d')][_0x41fc('0x9d')](_0x1ff1e5['body']['id']);})['then'](respondWithResult(_0x3987d5,null))[_0x41fc('0x26')](handleError(_0x3987d5,null));};exports['getMessages']=function(_0x40e6d1,_0x46583f,_0x587110){var _0x258855={'raw':!![],'where':{}};var _0xc306ed={};var _0x28a559={'count':0x0,'rows':[]};return db['FaxAccount'][_0x41fc('0x66')]({'where':{'id':_0x40e6d1['params']['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x46583f,null))[_0x41fc('0x1c')](function(_0x3041a0){if(_0x3041a0){_0xc306ed[_0x41fc('0x41')]=_[_0x41fc('0x43')](db[_0x41fc('0x9e')][_0x41fc('0x3e')]);_0xc306ed['query']=_[_0x41fc('0x43')](_0x40e6d1[_0x41fc('0x42')]);_0xc306ed[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0xc306ed[_0x41fc('0x41')],_0xc306ed['query']);_0x258855[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0xc306ed[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x46')]));_0x258855[_0x41fc('0x47')]=_0x258855[_0x41fc('0x47')]['length']?_0x258855[_0x41fc('0x47')]:_0xc306ed[_0x41fc('0x41')];if(!_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x6c')](_0x41fc('0x49'))){_0x258855[_0x41fc('0x2d')]=qs[_0x41fc('0x2d')](_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x2d')]);_0x258855[_0x41fc('0x2a')]=qs[_0x41fc('0x2a')](_0x40e6d1['query'][_0x41fc('0x2a')]);}_0x258855['order']=qs['sort'](_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x4a')]);_0x258855[_0x41fc('0x4b')]=qs[_0x41fc('0x44')](_['pick'](_0x40e6d1[_0x41fc('0x42')],_0xc306ed['filters']));_0x258855['where']['FaxAccountId']=_0x3041a0['id'];if(_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x258855[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x258855[_0x41fc('0x4b')],{'$or':_['map'](_0x258855['attributes'],function(_0x21c5f1){var _0x509f42={};_0x509f42[_0x21c5f1]={'$like':'%'+_0x40e6d1['query'][_0x41fc('0x4f')]+'%'};return _0x509f42;})});}if(_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x9f')]){var _0x281e20=_0x40e6d1['query'][_0x41fc('0x9f')][_0x41fc('0xa0')](',');var _0x3b2ff2={};_0x3b2ff2[_0x281e20[0x0]]={'$gte':moment(_0x281e20[0x1])[_0x41fc('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x258855[_0x41fc('0x4b')]=_['merge'](_0x258855[_0x41fc('0x4b')],_0x3b2ff2);}_0x258855=_[_0x41fc('0x4d')]({},_0x258855,_0x40e6d1['options']);return db[_0x41fc('0x9e')][_0x41fc('0x2c')]({'where':_0x258855[_0x41fc('0x4b')]})['then'](function(_0x2b7ea2){_0x28a559[_0x41fc('0x2c')]=_0x2b7ea2;if(_0x40e6d1['query'][_0x41fc('0x51')]){_0x258855[_0x41fc('0x52')]=[{'all':!![]}];}return db[_0x41fc('0x9e')][_0x41fc('0x53')](_0x258855);})[_0x41fc('0x1c')](function(_0xe75ea1){_0x28a559[_0x41fc('0x54')]=_0xe75ea1;return _0x28a559;});}})['then'](respondWithFilteredResult(_0x46583f,_0x258855))['catch'](handleError(_0x46583f,null));};exports[_0x41fc('0x38')]=function(_0x5eb4a1,_0x39df3e,_0x591f2b){var _0x1fbd35,_0xdec5a9={},_0x47a334;if(_0x5eb4a1['body']['to']){_0x47a334=_0x5eb4a1['body']['to'][0x0];}return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x5eb4a1['params']['id']},'include':[{'model':db['CmList'],'as':_0x41fc('0xa2'),'include':[{'model':db['CmContact'],'as':_0x41fc('0xa3'),'where':{'fax':_0x47a334},'limit':0x1,'order':[['updatedAt',_0x41fc('0xa4')]]}]}]})[_0x41fc('0x1c')](handleEntityNotFound(_0x39df3e,null))[_0x41fc('0x1c')](function(_0x1d3974){_0x1fbd35=_0x1d3974;if(_0x5eb4a1[_0x41fc('0x59')]['attachments']&&_0x5eb4a1['body'][_0x41fc('0xa5')][_0x41fc('0x48')]){for(var _0x3dd5ab=0x0;_0x3dd5ab<_0x5eb4a1['body'][_0x41fc('0xa5')]['length'];_0x3dd5ab+=0x1){_0x5eb4a1['body']['attachments'][_0x3dd5ab]={'filename':_0x5eb4a1[_0x41fc('0x59')]['attachments'][_0x3dd5ab][_0x41fc('0x37')],'id':_0x5eb4a1['body'][_0x41fc('0xa5')][_0x3dd5ab]['id'],'path':path[_0x41fc('0xa6')](config['root'],_0x41fc('0xa7'),_0x5eb4a1['body'][_0x41fc('0xa5')][_0x3dd5ab][_0x41fc('0xa8')])};}}return respondWithRpcPromise('CheckAfterSend',_0x41fc('0xa9'),{'FaxAccountId':_[_0x41fc('0xaa')](_0x5eb4a1[_0x41fc('0x56')]['id'])?undefined:_0x5eb4a1[_0x41fc('0x56')]['id'],'path':_[_0x41fc('0xaa')](_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0][_0x41fc('0x7')])?undefined:_0x5eb4a1['body'][_0x41fc('0xa5')][0x0][_0x41fc('0x7')],'fax':_['isNil'](_0x5eb4a1[_0x41fc('0x59')]['to'][0x0])?undefined:_0x5eb4a1[_0x41fc('0x59')]['to'][0x0]},client9002);})[_0x41fc('0x1c')](function(){if(_0x1fbd35){if(_[_0x41fc('0xaa')](_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xab')])){_0x5eb4a1['body'][_0x41fc('0xab')]=util[_0x41fc('0xa1')](_0x41fc('0xac'),_0x1fbd35[_0x41fc('0x37')],_0x1fbd35[_0x41fc('0xad')]);}if(_0x1fbd35['List']){if(_0x1fbd35['List'][_0x41fc('0xa3')]['length']){return _0x1fbd35[_0x41fc('0xa2')]['Contacts'][0x0];}else{return db[_0x41fc('0xae')][_0x41fc('0x58')](_[_0x41fc('0xaf')](_0x5eb4a1[_0x41fc('0x59')],{'firstName':_0x5eb4a1['body']['to'][0x0],'phone':_0x5eb4a1['body']['to'][0x0],'fax':_0x5eb4a1['body']['to'][0x0],'ListId':_0x1fbd35[_0x41fc('0x9c')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x41fc('0x1c')](function(_0x172e50){if(_0x172e50){return db['FaxInteraction']['find']({'where':{'ContactId':_0x172e50['id'],'closed':![],'FaxAccountId':_0x1fbd35['id']}})[_0x41fc('0x1c')](function(_0x4bf668){if(_0x4bf668){return[_0x4bf668,![]];}return db[_0x41fc('0x6f')][_0x41fc('0x58')]({'UserId':_0x5eb4a1[_0x41fc('0x5a')]['id'],'ContactId':_0x172e50['id'],'FaxAccountId':_0x1fbd35['id'],'fax':_0x5eb4a1[_0x41fc('0x59')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x41fc('0x4d')](_0x5eb4a1[_0x41fc('0x59')],{'read':![],'body':_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0][_0x41fc('0xb0')],'FaxAccountId':_0x1fbd35['id'],'UserId':_0x5eb4a1['user']['id'],'ContactId':_0x172e50['id'],'AttachmentId':_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x41fc('0x9e')],'as':_0x41fc('0xb1')}]})[_0x41fc('0x1c')](function(_0x136de8){return[_0x136de8,!![]];});});}else{throw new Error(_0x41fc('0xb2'));}})['spread'](function(_0x3baf2c,_0x48ed44){if(_0x48ed44){return _0x3baf2c;}return db[_0x41fc('0x9e')][_0x41fc('0x58')]({'direction':_0x41fc('0xb3'),'read':![],'body':_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0]['filename'],'FaxAccountId':_0x1fbd35['id'],'FaxInteractionId':_0x3baf2c['id'],'UserId':_0x5eb4a1[_0x41fc('0x5a')]['id'],'ContactId':_0x3baf2c[_0x41fc('0xb4')],'AttachmentId':_0x5eb4a1[_0x41fc('0x59')]['attachments'][0x0]['id']})[_0x41fc('0x1c')](function(_0x150e36){_0x3baf2c['dataValues'][_0x41fc('0xb1')]=[];_0x3baf2c[_0x41fc('0xb5')][_0x41fc('0xb1')][_0x41fc('0x8a')](_0x150e36[_0x41fc('0xb5')]);return _0x3baf2c;});})[_0x41fc('0x1c')](function(_0x848ea){respondWithRpcPromise(_0x41fc('0xb6'),_0x41fc('0xb6'),{'FaxAccountId':_[_0x41fc('0xaa')](_0x5eb4a1[_0x41fc('0x56')]['id'])?undefined:_0x5eb4a1[_0x41fc('0x56')]['id'],'path':_[_0x41fc('0xaa')](_0x5eb4a1['body'][_0x41fc('0xa5')][0x0]['path'])?undefined:_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0][_0x41fc('0x7')],'fax':_['isNil'](_0x5eb4a1['body']['to'][0x0])?undefined:_0x5eb4a1[_0x41fc('0x59')]['to'][0x0],'AttachmentId':_0x5eb4a1['body'][_0x41fc('0xa5')][0x0]['id']},client9002)[_0x41fc('0x1c')](function(_0x423db7){logger[_0x41fc('0x1d')](_0x41fc('0xb7'),_0x423db7);})['catch'](function(_0x23ef9c){logger[_0x41fc('0x1d')](_0x41fc('0xb7'),_0x23ef9c);});return _0x848ea;})[_0x41fc('0x1c')](respondWithResult(_0x39df3e,null))[_0x41fc('0x26')](handleError(_0x39df3e,null));};exports[_0x41fc('0xb8')]=function(_0x3e37aa,_0x5ec7c5,_0x19313c){return db['FaxAccount'][_0x41fc('0x57')]({'where':{'id':_0x3e37aa[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x5ec7c5,null))[_0x41fc('0x1c')](function(_0x5577c0){if(_0x5577c0){return _0x5577c0['addAgents'](_0x3e37aa[_0x41fc('0x59')][_0x41fc('0x68')],_['omit'](_0x3e37aa['body'],[_0x41fc('0x68'),'id'])||{})[_0x41fc('0xb9')](function(_0x255924){for(var _0x42c147=0x0;_0x42c147<_0x3e37aa[_0x41fc('0x59')][_0x41fc('0x68')][_0x41fc('0x48')];_0x42c147+=0x1){socket[_0x41fc('0xba')]('userFaxAccount:save',{'UserId':Number(_0x3e37aa['body']['ids'][_0x42c147]),'FaxAccountId':Number(_0x3e37aa[_0x41fc('0x56')]['id'])});}return _0x255924;});}})[_0x41fc('0x1c')](respondWithResult(_0x5ec7c5,null))[_0x41fc('0x26')](handleError(_0x5ec7c5,null));};exports['removeAgents']=function(_0x448580,_0x43bf1a,_0x28c11f){return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x448580['params']['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x43bf1a,null))[_0x41fc('0x1c')](function(_0x4b4aa4){if(_0x4b4aa4){return _0x4b4aa4[_0x41fc('0xbb')](_0x448580[_0x41fc('0x42')][_0x41fc('0x68')])[_0x41fc('0x1c')](function(){if(_['isArray'](_0x448580[_0x41fc('0x42')]['ids'])){for(var _0x4d6733=0x0;_0x4d6733<_0x448580[_0x41fc('0x42')][_0x41fc('0x68')]['length'];_0x4d6733+=0x1){socket['emit'](_0x41fc('0xbc'),{'UserId':Number(_0x448580['query'][_0x41fc('0x68')][_0x4d6733]),'FaxAccountId':Number(_0x448580[_0x41fc('0x56')]['id'])});}}else{socket[_0x41fc('0xba')](_0x41fc('0xbc'),{'UserId':Number(_0x448580[_0x41fc('0x42')][_0x41fc('0x68')]),'FaxAccountId':Number(_0x448580[_0x41fc('0x56')]['id'])});}});}})[_0x41fc('0x1c')](respondWithStatusCode(_0x43bf1a,null))[_0x41fc('0x26')](handleError(_0x43bf1a,null));};exports[_0x41fc('0xbd')]=function(_0x1ac709,_0x4029a2,_0x581122){var _0x223d49={};var _0x15837e={};var _0x37dcf8;var _0x280d74;return db[_0x41fc('0x3d')]['findOne']({'where':{'id':_0x1ac709['params']['id']}})['then'](handleEntityNotFound(_0x4029a2,null))[_0x41fc('0x1c')](function(_0x2002e2){if(_0x2002e2){_0x37dcf8=_0x2002e2;_0x15837e[_0x41fc('0x41')]=_['keys'](db['User'][_0x41fc('0x3e')]);_0x15837e[_0x41fc('0x42')]=_[_0x41fc('0x43')](_0x1ac709['query']);_0x15837e[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0x15837e[_0x41fc('0x41')],_0x15837e['query']);_0x223d49[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x15837e['model'],qs[_0x41fc('0x46')](_0x1ac709[_0x41fc('0x42')][_0x41fc('0x46')]));_0x223d49['attributes']=_0x223d49[_0x41fc('0x47')][_0x41fc('0x48')]?_0x223d49['attributes']:_0x15837e['model'];_0x223d49['order']=qs['sort'](_0x1ac709[_0x41fc('0x42')]['sort']);_0x223d49[_0x41fc('0x4b')]=qs['filters'](_[_0x41fc('0x4c')](_0x1ac709[_0x41fc('0x42')],_0x15837e[_0x41fc('0x44')]));if(_0x1ac709[_0x41fc('0x42')]['filter']){_0x223d49[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x223d49[_0x41fc('0x4b')],{'$or':_['map'](_0x223d49[_0x41fc('0x47')],function(_0x57ac83){var _0x40c2cc={};_0x40c2cc[_0x57ac83]={'$like':'%'+_0x1ac709[_0x41fc('0x42')][_0x41fc('0x4f')]+'%'};return _0x40c2cc;})});}_0x223d49=_['merge']({},_0x223d49,_0x1ac709[_0x41fc('0x50')]);return _0x37dcf8['getAgents'](_0x223d49);}})[_0x41fc('0x1c')](function(_0x3bdb60){if(_0x3bdb60){_0x280d74=_0x3bdb60[_0x41fc('0x48')];if(!_0x1ac709['query'][_0x41fc('0x6c')](_0x41fc('0x49'))){_0x223d49['limit']=qs[_0x41fc('0x2d')](_0x1ac709['query'][_0x41fc('0x2d')]);_0x223d49[_0x41fc('0x2a')]=qs['offset'](_0x1ac709[_0x41fc('0x42')][_0x41fc('0x2a')]);}return _0x37dcf8['getAgents'](_0x223d49);}})[_0x41fc('0x1c')](function(_0x211d78){if(_0x211d78){return _0x211d78?{'count':_0x280d74,'rows':_0x211d78}:null;}})[_0x41fc('0x1c')](respondWithResult(_0x4029a2,null))[_0x41fc('0x26')](handleError(_0x4029a2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index e161c9b..a006e3a 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 _0x5bf9=['hasOwnProperty','exports','../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit'];(function(_0x46c82b,_0x3c082f){var _0x56fdf1=function(_0x3ed8b5){while(--_0x3ed8b5){_0x46c82b['push'](_0x46c82b['shift']());}};_0x56fdf1(++_0x3c082f);}(_0x5bf9,0xa2));var _0x95bf=function(_0xd773cb,_0x288c5c){_0xd773cb=_0xd773cb-0x0;var _0x7fdfaa=_0x5bf9[_0xd773cb];return _0x7fdfaa;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x95bf('0x0'))['db'][_0x95bf('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x95bf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x95bf('0x3'),'afterDestroy':_0x95bf('0x4')};function emitEvent(_0x2b4c02){return function(_0x4fc39e,_0x4525bc,_0x2f9bfc){FaxAccountEvents[_0x95bf('0x5')](_0x2b4c02+':'+_0x4fc39e['id'],_0x4fc39e);FaxAccountEvents[_0x95bf('0x5')](_0x2b4c02,_0x4fc39e);_0x2f9bfc(null);};}for(var e in events){if(events[_0x95bf('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x95bf('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x685b=['hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2a982b,_0x16346d){var _0x19ce44=function(_0x1ba6e8){while(--_0x1ba6e8){_0x2a982b['push'](_0x2a982b['shift']());}};_0x19ce44(++_0x16346d);}(_0x685b,0x199));var _0xb685=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0x685b[_0x324496];return _0x899545;};'use strict';var EventEmitter=require(_0xb685('0x0'));var FaxAccount=require(_0xb685('0x1'))['db'][_0xb685('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb685('0x3')](0x0);var events={'afterCreate':_0xb685('0x4'),'afterUpdate':_0xb685('0x5'),'afterDestroy':_0xb685('0x6')};function emitEvent(_0x5a8e85){return function(_0x4e6ff5,_0xc83e32,_0x45e901){FaxAccountEvents[_0xb685('0x7')](_0x5a8e85+':'+_0x4e6ff5['id'],_0x4e6ff5);FaxAccountEvents[_0xb685('0x7')](_0x5a8e85,_0x4e6ff5);_0x45e901(null);};}for(var e in events){if(events[_0xb685('0x8')](e)){var event=events[e];FaxAccount[_0xb685('0x9')](e,emitEvent(event));}}module[_0xb685('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 745cae8..4f97ee6 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 _0x56a7=['FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','../../config/environment','define'];(function(_0x1ced25,_0x916de1){var _0xd12f7c=function(_0x2cac5a){while(--_0x2cac5a){_0x1ced25['push'](_0x1ced25['shift']());}};_0xd12f7c(++_0x916de1);}(_0x56a7,0x18e));var _0x756a=function(_0x1d6914,_0x2f6a85){_0x1d6914=_0x1d6914-0x0;var _0x511d10=_0x56a7[_0x1d6914];return _0x511d10;};'use strict';var _=require(_0x756a('0x0'));var util=require(_0x756a('0x1'));var logger=require('../../config/logger')(_0x756a('0x2'));var moment=require(_0x756a('0x3'));var BPromise=require(_0x756a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x756a('0x5'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x17e10e,_0x3be5dd){return _0x17e10e[_0x756a('0x6')](_0x756a('0x7'),attributes,{'tableName':_0x756a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7cd=['fax_accounts','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./faxAccount.attributes','exports'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xf7cd,0x169));var _0xdf7c=function(_0x40b20a,_0x2f2302){_0x40b20a=_0x40b20a-0x0;var _0x168d95=_0xf7cd[_0x40b20a];return _0x168d95;};'use strict';var _=require('lodash');var util=require(_0xdf7c('0x0'));var logger=require(_0xdf7c('0x1'))(_0xdf7c('0x2'));var moment=require('moment');var BPromise=require(_0xdf7c('0x3'));var rp=require(_0xdf7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf7c('0x5'));var attributes=require(_0xdf7c('0x6'));module[_0xdf7c('0x7')]=function(_0x1ebde3,_0x3169ab){return _0x1ebde3['define']('FaxAccount',attributes,{'tableName':_0xdf7c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index cb428c0..0b69edb 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 _0xb5d7=['stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','Sequelize','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','CmList','Contacts','FaxApplication','Applications','List','get','applications','list','orderBy','priority','asc','length','ListId','create','FaxInteraction','spread','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','Start','startRouting','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0xb5d7,0xf5));var _0x7b5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb5d7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7b5d('0x0'));var util=require(_0x7b5d('0x1'));var moment=require('moment');var BPromise=require(_0x7b5d('0x2'));var rs=require(_0x7b5d('0x3'));var fs=require('fs');var Redis=require(_0x7b5d('0x4'));var db=require(_0x7b5d('0x5'))['db'];var utils=require(_0x7b5d('0x6'));var logger=require(_0x7b5d('0x7'))(_0x7b5d('0x8'));var config=require(_0x7b5d('0x9'));var jayson=require(_0x7b5d('0xa'));var client=jayson[_0x7b5d('0xb')][_0x7b5d('0xc')]({'port':0x232c});config['redis']=_[_0x7b5d('0xd')](config[_0x7b5d('0xe')],{'host':_0x7b5d('0xf'),'port':0x18eb});var socket=require(_0x7b5d('0x10'))(new Redis(config[_0x7b5d('0xe')]));require(_0x7b5d('0x11'))[_0x7b5d('0x12')](socket);function respondWithRpcPromise(_0x2d073e,_0x37bc66,_0xddb302){return new BPromise(function(_0x12302d,_0x3a5572){return client['request'](_0x2d073e,_0xddb302)[_0x7b5d('0x13')](function(_0x191dc8){logger[_0x7b5d('0x14')](_0x7b5d('0x15'),_0x37bc66,_0x7b5d('0x16'));logger[_0x7b5d('0x17')](_0x7b5d('0x18'),_0x37bc66,_0x7b5d('0x16'),JSON[_0x7b5d('0x19')](_0x191dc8));if(_0x191dc8[_0x7b5d('0x1a')]){if(_0x191dc8[_0x7b5d('0x1a')][_0x7b5d('0x1b')]===0x1f4){logger[_0x7b5d('0x1a')](_0x7b5d('0x15'),_0x37bc66,_0x191dc8['error'][_0x7b5d('0x1c')]);return _0x3a5572(_0x191dc8['error'][_0x7b5d('0x1c')]);}logger[_0x7b5d('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x37bc66,_0x191dc8['error'][_0x7b5d('0x1c')]);return _0x12302d(_0x191dc8[_0x7b5d('0x1a')]['message']);}else{logger[_0x7b5d('0x14')](_0x7b5d('0x15'),_0x37bc66,_0x7b5d('0x16'));_0x12302d(_0x191dc8[_0x7b5d('0x1d')][_0x7b5d('0x1c')]);}})['catch'](function(_0x164b90){logger[_0x7b5d('0x1a')](_0x7b5d('0x15'),_0x37bc66,_0x164b90);_0x3a5572(_0x164b90);});});}exports['GetFaxAccount']=function(_0x5bdbc8){var _0x55213f=this;return new Promise(function(_0x97305e,_0x5d5a27){return db['FaxAccount'][_0x7b5d('0x1e')]({'raw':_0x5bdbc8[_0x7b5d('0x1f')]?_0x5bdbc8['options'][_0x7b5d('0x20')]===undefined?!![]:![]:!![],'where':_0x5bdbc8['options']?_0x5bdbc8['options'][_0x7b5d('0x21')]||null:null,'attributes':_0x5bdbc8[_0x7b5d('0x1f')]?_0x5bdbc8['options'][_0x7b5d('0x22')]||null:null,'limit':_0x5bdbc8[_0x7b5d('0x1f')]?_0x5bdbc8[_0x7b5d('0x1f')][_0x7b5d('0x23')]||null:null,'include':_0x5bdbc8[_0x7b5d('0x1f')]?_0x5bdbc8[_0x7b5d('0x1f')][_0x7b5d('0x24')]?_[_0x7b5d('0x25')](_0x5bdbc8[_0x7b5d('0x1f')]['include'],function(_0x300306){return{'model':db[_0x300306[_0x7b5d('0x26')]],'as':_0x300306['as'],'attributes':_0x300306[_0x7b5d('0x22')],'include':_0x300306[_0x7b5d('0x24')]?_[_0x7b5d('0x25')](_0x300306[_0x7b5d('0x24')],function(_0x191dcd){return{'model':db[_0x191dcd[_0x7b5d('0x26')]],'as':_0x191dcd['as'],'attributes':_0x191dcd[_0x7b5d('0x22')],'include':_0x191dcd[_0x7b5d('0x24')]?_['map'](_0x191dcd[_0x7b5d('0x24')],function(_0x57cab8){return{'model':db[_0x57cab8[_0x7b5d('0x26')]],'as':_0x57cab8['as'],'attributes':_0x57cab8[_0x7b5d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7b5d('0x13')](function(_0x5e0459){logger['info'](_0x7b5d('0x27'),_0x5bdbc8);logger['debug'](_0x7b5d('0x27'),_0x5bdbc8,JSON[_0x7b5d('0x19')](_0x5e0459));_0x97305e(_0x5e0459);})['catch'](function(_0x9de730){logger[_0x7b5d('0x1a')](_0x7b5d('0x27'),_0x9de730[_0x7b5d('0x1c')],_0x5bdbc8);_0x5d5a27(_0x55213f[_0x7b5d('0x1a')](0x1f4,_0x9de730[_0x7b5d('0x1c')]));});});};exports[_0x7b5d('0x28')]=function(_0x7fdc5e,_0x5b0b5e,_0x15b35b){var _0x5699a3=this;return new Promise(function(_0x78584b,_0x3be2eb){var _0x1a2b65={'body':_0x7fdc5e[_0x7b5d('0x29')],'channel':_0x7b5d('0x2a')};var _0x3aa3d2=[];var _0xe9fd53=[];var _0x1a13fd={};return db[_0x7b5d('0x2b')]['describe']()['then'](function(_0x129454){if(!_0x129454){throw new db[(_0x7b5d('0x2c'))]['ValidationError'](_0x7b5d('0x2d'));}_0x3aa3d2=_[_0x7b5d('0x2e')](_[_0x7b5d('0x2f')](_0x129454),['createdAt',_0x7b5d('0x30')]);_0xe9fd53=_[_0x7b5d('0x2e')](_[_0x7b5d('0x2f')](_0x129454),[_0x7b5d('0x31'),_0x7b5d('0x30'),'CompanyId','ListId']);if(_0x7fdc5e['body']['id']){delete _0x7fdc5e[_0x7b5d('0x29')]['id'];}if(_[_0x7b5d('0x32')](_0x7fdc5e[_0x7b5d('0x29')][_0x7b5d('0x33')])){throw new db[(_0x7b5d('0x2c'))][(_0x7b5d('0x34'))](_0x7b5d('0x35'));}if(_[_0x7b5d('0x32')](_0x7fdc5e[_0x7b5d('0x29')][_0x7b5d('0x29')])||_0x7fdc5e['body'][_0x7b5d('0x29')]===''){throw new db[(_0x7b5d('0x2c'))][(_0x7b5d('0x34'))](_0x7b5d('0x36'));}if(_[_0x7b5d('0x32')](_0x7fdc5e[_0x7b5d('0x29')]['mapKey'])){throw new db[(_0x7b5d('0x2c'))][(_0x7b5d('0x34'))](_0x7b5d('0x37')+_0xe9fd53);}if(!_[_0x7b5d('0x38')](_0xe9fd53,_0x7fdc5e[_0x7b5d('0x29')][_0x7b5d('0x39')])){throw new db[(_0x7b5d('0x2c'))][(_0x7b5d('0x34'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe9fd53);}_0x1a13fd[_0x7fdc5e[_0x7b5d('0x29')]['mapKey']]=_0x7fdc5e['body'][_0x7b5d('0x33')];})[_0x7b5d('0x13')](function(){return db['FaxAccount'][_0x7b5d('0x3a')]({'where':{'id':_0x7fdc5e[_0x7b5d('0x3b')]['id']},'include':[{'model':db[_0x7b5d('0x3c')],'as':'List','include':[{'model':db[_0x7b5d('0x2b')],'as':_0x7b5d('0x3d'),'where':_0x1a13fd,'limit':0x1,'order':[[_0x7b5d('0x30'),'DESC']]}]},{'model':db[_0x7b5d('0x3e')],'as':_0x7b5d('0x3f')}]});})[_0x7b5d('0x13')](function(_0x1e9b25){if(_0x1e9b25&&_0x1e9b25[_0x7b5d('0x40')]){var _0x16155f=_0x1e9b25[_0x7b5d('0x41')]({'plain':!![]});_0x1a2b65['account']=_0x16155f;_0x1a2b65[_0x7b5d('0x42')]=_0x16155f[_0x7b5d('0x3f')];_0x1a2b65[_0x7b5d('0x43')]=_0x16155f[_0x7b5d('0x40')];_0x1a2b65[_0x7b5d('0x42')]=_[_0x7b5d('0x44')](_0x1a2b65[_0x7b5d('0x42')],[_0x7b5d('0x45')],[_0x7b5d('0x46')]);if(_0x1a2b65[_0x7b5d('0x3b')]['Applications']){delete _0x1a2b65[_0x7b5d('0x3b')][_0x7b5d('0x3f')];}if(_0x1a2b65[_0x7b5d('0x3b')][_0x7b5d('0x40')]&&_0x1a2b65[_0x7b5d('0x3b')][_0x7b5d('0x40')][_0x7b5d('0x3d')][_0x7b5d('0x47')]){return _0x1a2b65[_0x7b5d('0x3b')][_0x7b5d('0x40')][_0x7b5d('0x3d')][0x0];}var _0x504214=_[_0x7b5d('0xd')](_0x7fdc5e[_0x7b5d('0x29')],{'firstName':_0x7fdc5e[_0x7b5d('0x29')][_0x7b5d('0x33')],'ListId':_0x16155f[_0x7b5d('0x48')]});_0x504214[_0x7fdc5e[_0x7b5d('0x29')][_0x7b5d('0x39')]]=_0x7fdc5e[_0x7b5d('0x29')]['from'];return db['CmContact'][_0x7b5d('0x49')](_0x504214,{'fields':_0x3aa3d2,'raw':!![]});}})[_0x7b5d('0x13')](function(_0x563a31){_0x1a2b65['contact']=_0x563a31;if(_0x563a31){var _0x342680={'ContactId':_0x563a31['id'],'FaxAccountId':_0x7fdc5e[_0x7b5d('0x3b')]['id'],'fax':_0x563a31[_0x7b5d('0x2a')]};return db['FaxInteraction'][_0x7b5d('0x3a')]({'where':{'ContactId':_0x563a31['id'],'closed':![],'FaxAccountId':_0x7fdc5e[_0x7b5d('0x3b')]['id']}})['then'](function(_0x2e1300){if(_0x2e1300){return[_0x2e1300,![]];}return db[_0x7b5d('0x4a')][_0x7b5d('0x49')](_0x342680)['then'](function(_0x197f91){return[_0x197f91,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7b5d('0x4b')](function(_0xda7705,_0x2699ee){var _0x3807ff=_0xda7705[_0x7b5d('0x41')]({'plain':!![]});if(_0x2699ee){if(_0x1a2b65[_0x7b5d('0x3b')]['autoclose']){_0x1a2b65[_0x7b5d('0x42')]['push']({'id':0x0,'priority':_0x1a2b65[_0x7b5d('0x42')][_0x7b5d('0x47')]+0x1,'app':'close','appdata':_0x7b5d('0x4c'),'interval':_0x7b5d('0x4d')});}_0x3807ff[_0x7b5d('0x4e')]=!![];}else{_0x3807ff[_0x7b5d('0x4e')]=![];}_0x1a2b65['interaction']=_0x3807ff;return db[_0x7b5d('0x4f')][_0x7b5d('0x49')]({'body':_0x7fdc5e[_0x7b5d('0x29')]['body'],'FaxAccountId':_0x7fdc5e[_0x7b5d('0x3b')]['id'],'FaxInteractionId':_0xda7705['id'],'direction':'in','ContactId':_0xda7705[_0x7b5d('0x50')],'AttachmentId':_0x7fdc5e[_0x7b5d('0x29')][_0x7b5d('0x51')]});})[_0x7b5d('0x13')](function(_0x4787a1){_0x1a2b65[_0x7b5d('0x1c')]=_0x4787a1;if(_0x1a2b65[_0x7b5d('0x52')][_0x7b5d('0x53')]){return db[_0x7b5d('0x54')][_0x7b5d('0x3a')]({'attributes':['id',_0x7b5d('0x55')],'where':{'id':_0x1a2b65['interaction'][_0x7b5d('0x53')]}})[_0x7b5d('0x13')](function(_0x55c40c){if(_0x55c40c){_0x1a2b65[_0x7b5d('0x42')][_0x7b5d('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x55c40c[_0x7b5d('0x55')]+','+(_0x1a2b65[_0x7b5d('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7b5d('0x57'),_0x7b5d('0x58'),_0x1a2b65);});}return respondWithRpcPromise('Start',_0x7b5d('0x58'),_0x1a2b65);})['then'](function(_0xd0de66){_0x78584b(_0xd0de66);})[_0x7b5d('0x59')](function(_0x2de208){_0x3be2eb(_0x5699a3[_0x7b5d('0x1a')](0x1f4,_0x2de208[_0x7b5d('0x1c')]));});});}; \ No newline at end of file +var _0xc95d=['describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','priority','asc','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body','CmContact'];(function(_0x5dde91,_0x5006bd){var _0x2aea84=function(_0x14c95b){while(--_0x14c95b){_0x5dde91['push'](_0x5dde91['shift']());}};_0x2aea84(++_0x5006bd);}(_0xc95d,0x14b));var _0xdc95=function(_0x3b2aeb,_0x31372c){_0x3b2aeb=_0x3b2aeb-0x0;var _0x19fb1e=_0xc95d[_0x3b2aeb];return _0x19fb1e;};'use strict';var _=require(_0xdc95('0x0'));var util=require(_0xdc95('0x1'));var moment=require(_0xdc95('0x2'));var BPromise=require(_0xdc95('0x3'));var rs=require(_0xdc95('0x4'));var fs=require('fs');var Redis=require(_0xdc95('0x5'));var db=require(_0xdc95('0x6'))['db'];var utils=require(_0xdc95('0x7'));var logger=require(_0xdc95('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdc95('0x9'));var client=jayson[_0xdc95('0xa')][_0xdc95('0xb')]({'port':0x232c});config[_0xdc95('0xc')]=_[_0xdc95('0xd')](config[_0xdc95('0xc')],{'host':_0xdc95('0xe'),'port':0x18eb});var socket=require(_0xdc95('0xf'))(new Redis(config[_0xdc95('0xc')]));require('./faxAccount.socket')[_0xdc95('0x10')](socket);function respondWithRpcPromise(_0x22a237,_0x462536,_0x221441){return new BPromise(function(_0x34a7de,_0x2c4f1e){return client[_0xdc95('0x11')](_0x22a237,_0x221441)[_0xdc95('0x12')](function(_0x354eb8){logger['info'](_0xdc95('0x13'),_0x462536,_0xdc95('0x14'));logger[_0xdc95('0x15')](_0xdc95('0x16'),_0x462536,'request\x20sent',JSON['stringify'](_0x354eb8));if(_0x354eb8[_0xdc95('0x17')]){if(_0x354eb8[_0xdc95('0x17')][_0xdc95('0x18')]===0x1f4){logger['error'](_0xdc95('0x13'),_0x462536,_0x354eb8[_0xdc95('0x17')][_0xdc95('0x19')]);return _0x2c4f1e(_0x354eb8['error']['message']);}logger[_0xdc95('0x17')](_0xdc95('0x13'),_0x462536,_0x354eb8[_0xdc95('0x17')][_0xdc95('0x19')]);return _0x34a7de(_0x354eb8[_0xdc95('0x17')]['message']);}else{logger[_0xdc95('0x1a')](_0xdc95('0x13'),_0x462536,_0xdc95('0x14'));_0x34a7de(_0x354eb8['result'][_0xdc95('0x19')]);}})[_0xdc95('0x1b')](function(_0x1b03ed){logger[_0xdc95('0x17')](_0xdc95('0x13'),_0x462536,_0x1b03ed);_0x2c4f1e(_0x1b03ed);});});}exports[_0xdc95('0x1c')]=function(_0x32d4fc){var _0x57976=this;return new Promise(function(_0x4867d0,_0x4b7641){return db[_0xdc95('0x1d')][_0xdc95('0x1e')]({'raw':_0x32d4fc['options']?_0x32d4fc[_0xdc95('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x32d4fc[_0xdc95('0x1f')]?_0x32d4fc[_0xdc95('0x1f')][_0xdc95('0x20')]||null:null,'attributes':_0x32d4fc[_0xdc95('0x1f')]?_0x32d4fc['options'][_0xdc95('0x21')]||null:null,'limit':_0x32d4fc[_0xdc95('0x1f')]?_0x32d4fc[_0xdc95('0x1f')][_0xdc95('0x22')]||null:null,'include':_0x32d4fc[_0xdc95('0x1f')]?_0x32d4fc[_0xdc95('0x1f')][_0xdc95('0x23')]?_['map'](_0x32d4fc[_0xdc95('0x1f')][_0xdc95('0x23')],function(_0x589cb4){return{'model':db[_0x589cb4[_0xdc95('0x24')]],'as':_0x589cb4['as'],'attributes':_0x589cb4[_0xdc95('0x21')],'include':_0x589cb4['include']?_[_0xdc95('0x25')](_0x589cb4[_0xdc95('0x23')],function(_0x47e74e){return{'model':db[_0x47e74e[_0xdc95('0x24')]],'as':_0x47e74e['as'],'attributes':_0x47e74e['attributes'],'include':_0x47e74e[_0xdc95('0x23')]?_['map'](_0x47e74e[_0xdc95('0x23')],function(_0x36f962){return{'model':db[_0x36f962[_0xdc95('0x24')]],'as':_0x36f962['as'],'attributes':_0x36f962['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc95('0x12')](function(_0x2fd501){logger[_0xdc95('0x1a')](_0xdc95('0x1c'),_0x32d4fc);logger['debug'](_0xdc95('0x1c'),_0x32d4fc,JSON['stringify'](_0x2fd501));_0x4867d0(_0x2fd501);})[_0xdc95('0x1b')](function(_0x1808f8){logger[_0xdc95('0x17')](_0xdc95('0x1c'),_0x1808f8[_0xdc95('0x19')],_0x32d4fc);_0x4b7641(_0x57976[_0xdc95('0x17')](0x1f4,_0x1808f8[_0xdc95('0x19')]));});});};exports[_0xdc95('0x26')]=function(_0x17f958,_0x3968db,_0xff51bf){var _0x57aa0b=this;return new Promise(function(_0x1739ea,_0x2d71b1){var _0x5e2d72={'body':_0x17f958[_0xdc95('0x27')],'channel':'fax'};var _0xdc8f5c=[];var _0x4f0abf=[];var _0x100d5b={};return db[_0xdc95('0x28')][_0xdc95('0x29')]()[_0xdc95('0x12')](function(_0x16d110){if(!_0x16d110){throw new db['Sequelize'][(_0xdc95('0x2a'))](_0xdc95('0x2b'));}_0xdc8f5c=_[_0xdc95('0x2c')](_[_0xdc95('0x2d')](_0x16d110),[_0xdc95('0x2e'),_0xdc95('0x2f')]);_0x4f0abf=_[_0xdc95('0x2c')](_[_0xdc95('0x2d')](_0x16d110),['createdAt','updatedAt',_0xdc95('0x30'),_0xdc95('0x31')]);if(_0x17f958[_0xdc95('0x27')]['id']){delete _0x17f958[_0xdc95('0x27')]['id'];}if(_['isNil'](_0x17f958['body'][_0xdc95('0x32')])){throw new db[(_0xdc95('0x33'))][(_0xdc95('0x2a'))](_0xdc95('0x34'));}if(_[_0xdc95('0x35')](_0x17f958[_0xdc95('0x27')][_0xdc95('0x27')])||_0x17f958[_0xdc95('0x27')]['body']===''){throw new db['Sequelize'][(_0xdc95('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdc95('0x35')](_0x17f958[_0xdc95('0x27')][_0xdc95('0x36')])){throw new db[(_0xdc95('0x33'))][(_0xdc95('0x2a'))](_0xdc95('0x37')+_0x4f0abf);}if(!_[_0xdc95('0x38')](_0x4f0abf,_0x17f958['body']['mapKey'])){throw new db[(_0xdc95('0x33'))][(_0xdc95('0x2a'))](_0xdc95('0x39')+_0x4f0abf);}_0x100d5b[_0x17f958[_0xdc95('0x27')][_0xdc95('0x36')]]=_0x17f958[_0xdc95('0x27')][_0xdc95('0x32')];})['then'](function(){return db[_0xdc95('0x1d')][_0xdc95('0x3a')]({'where':{'id':_0x17f958[_0xdc95('0x3b')]['id']},'include':[{'model':db[_0xdc95('0x3c')],'as':_0xdc95('0x3d'),'include':[{'model':db[_0xdc95('0x28')],'as':_0xdc95('0x3e'),'where':_0x100d5b,'limit':0x1,'order':[[_0xdc95('0x2f'),_0xdc95('0x3f')]]}]},{'model':db[_0xdc95('0x40')],'as':_0xdc95('0x41')}]});})[_0xdc95('0x12')](function(_0x1419d9){if(_0x1419d9&&_0x1419d9[_0xdc95('0x3d')]){var _0x349cee=_0x1419d9[_0xdc95('0x42')]({'plain':!![]});_0x5e2d72[_0xdc95('0x3b')]=_0x349cee;_0x5e2d72[_0xdc95('0x43')]=_0x349cee[_0xdc95('0x41')];_0x5e2d72['list']=_0x349cee[_0xdc95('0x3d')];_0x5e2d72[_0xdc95('0x43')]=_[_0xdc95('0x44')](_0x5e2d72[_0xdc95('0x43')],[_0xdc95('0x45')],[_0xdc95('0x46')]);if(_0x5e2d72[_0xdc95('0x3b')][_0xdc95('0x41')]){delete _0x5e2d72[_0xdc95('0x3b')][_0xdc95('0x41')];}if(_0x5e2d72[_0xdc95('0x3b')]['List']&&_0x5e2d72[_0xdc95('0x3b')]['List'][_0xdc95('0x3e')][_0xdc95('0x47')]){return _0x5e2d72[_0xdc95('0x3b')][_0xdc95('0x3d')]['Contacts'][0x0];}var _0x2c6d6f=_[_0xdc95('0xd')](_0x17f958[_0xdc95('0x27')],{'firstName':_0x17f958[_0xdc95('0x27')][_0xdc95('0x32')],'ListId':_0x349cee[_0xdc95('0x31')]});_0x2c6d6f[_0x17f958[_0xdc95('0x27')][_0xdc95('0x36')]]=_0x17f958['body']['from'];return db['CmContact'][_0xdc95('0x48')](_0x2c6d6f,{'fields':_0xdc8f5c,'raw':!![]});}})[_0xdc95('0x12')](function(_0x2d969d){_0x5e2d72[_0xdc95('0x49')]=_0x2d969d;if(_0x2d969d){var _0xbeded0={'ContactId':_0x2d969d['id'],'FaxAccountId':_0x17f958[_0xdc95('0x3b')]['id'],'fax':_0x2d969d[_0xdc95('0x4a')]};return db[_0xdc95('0x4b')]['find']({'where':{'ContactId':_0x2d969d['id'],'closed':![],'FaxAccountId':_0x17f958[_0xdc95('0x3b')]['id']}})[_0xdc95('0x12')](function(_0x3f7957){if(_0x3f7957){return[_0x3f7957,![]];}return db[_0xdc95('0x4b')][_0xdc95('0x48')](_0xbeded0)[_0xdc95('0x12')](function(_0x128be1){return[_0x128be1,!![]];});});}else{throw new Error(_0xdc95('0x4c'));}})['spread'](function(_0x195bff,_0x182fb5){var _0x1b9893=_0x195bff[_0xdc95('0x42')]({'plain':!![]});if(_0x182fb5){if(_0x5e2d72[_0xdc95('0x3b')]['autoclose']){_0x5e2d72[_0xdc95('0x43')][_0xdc95('0x4d')]({'id':0x0,'priority':_0x5e2d72[_0xdc95('0x43')][_0xdc95('0x47')]+0x1,'app':_0xdc95('0x4e'),'appdata':'unmanaged','interval':_0xdc95('0x4f')});}_0x1b9893[_0xdc95('0x50')]=!![];}else{_0x1b9893[_0xdc95('0x50')]=![];}_0x5e2d72[_0xdc95('0x51')]=_0x1b9893;return db[_0xdc95('0x52')][_0xdc95('0x48')]({'body':_0x17f958[_0xdc95('0x27')][_0xdc95('0x27')],'FaxAccountId':_0x17f958[_0xdc95('0x3b')]['id'],'FaxInteractionId':_0x195bff['id'],'direction':'in','ContactId':_0x195bff[_0xdc95('0x53')],'AttachmentId':_0x17f958[_0xdc95('0x27')][_0xdc95('0x54')]});})[_0xdc95('0x12')](function(_0x5da8cd){_0x5e2d72['message']=_0x5da8cd;if(_0x5e2d72[_0xdc95('0x51')][_0xdc95('0x55')]){return db[_0xdc95('0x56')][_0xdc95('0x3a')]({'attributes':['id',_0xdc95('0x57')],'where':{'id':_0x5e2d72['interaction'][_0xdc95('0x55')]}})[_0xdc95('0x12')](function(_0x5e986d){if(_0x5e986d){_0x5e2d72['applications'][_0xdc95('0x58')]({'id':0x0,'priority':0x0,'app':_0xdc95('0x59'),'appdata':_0x5e986d[_0xdc95('0x57')]+','+(_0x5e2d72[_0xdc95('0x3b')][_0xdc95('0x5a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xdc95('0x5b'),'startRouting',_0x5e2d72);});}return respondWithRpcPromise('Start',_0xdc95('0x5c'),_0x5e2d72);})['then'](function(_0x2079cb){_0x1739ea(_0x2079cb);})[_0xdc95('0x1b')](function(_0x4fba40){_0x2d71b1(_0x57aa0b['error'](0x1f4,_0x4fba40[_0xdc95('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 372495b..f78f249 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 _0xe730=['emit','register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x554344,_0x27f258){var _0x1b642a=function(_0x234071){while(--_0x234071){_0x554344['push'](_0x554344['shift']());}};_0x1b642a(++_0x27f258);}(_0xe730,0x134));var _0x0e73=function(_0x3ddb4e,_0x5d9ecf){_0x3ddb4e=_0x3ddb4e-0x0;var _0x16202e=_0xe730[_0x3ddb4e];return _0x16202e;};'use strict';var FaxAccountEvents=require(_0x0e73('0x0'));var events=[_0x0e73('0x1'),_0x0e73('0x2'),_0x0e73('0x3')];function createListener(_0x4858c7,_0x304dfc){return function(_0x1c73bf){_0x304dfc[_0x0e73('0x4')](_0x4858c7,_0x1c73bf);};}function removeListener(_0x6b0dac,_0x3416b3){return function(){FaxAccountEvents['removeListener'](_0x6b0dac,_0x3416b3);};}exports[_0x0e73('0x5')]=function(_0x2ec686){for(var _0x377eec=0x0,_0x4b236f=events[_0x0e73('0x6')];_0x377eec<_0x4b236f;_0x377eec++){var _0x626d15=events[_0x377eec];var _0x5262a0=createListener(_0x0e73('0x7')+_0x626d15,_0x2ec686);FaxAccountEvents['on'](_0x626d15,_0x5262a0);}}; \ No newline at end of file +var _0x3f28=['removeListener','register','length','./faxAccount.events','update'];(function(_0x559fe0,_0x17649e){var _0xb1fae5=function(_0x296844){while(--_0x296844){_0x559fe0['push'](_0x559fe0['shift']());}};_0xb1fae5(++_0x17649e);}(_0x3f28,0x157));var _0x83f2=function(_0x20a6fd,_0x3d9778){_0x20a6fd=_0x20a6fd-0x0;var _0x1e4c08=_0x3f28[_0x20a6fd];return _0x1e4c08;};'use strict';var FaxAccountEvents=require(_0x83f2('0x0'));var events=['save','remove',_0x83f2('0x1')];function createListener(_0x2cfe82,_0x3a6532){return function(_0x5ad5ae){_0x3a6532['emit'](_0x2cfe82,_0x5ad5ae);};}function removeListener(_0x3f39d6,_0x59f9b8){return function(){FaxAccountEvents[_0x83f2('0x2')](_0x3f39d6,_0x59f9b8);};}exports[_0x83f2('0x3')]=function(_0x3a5960){for(var _0x597b1d=0x0,_0x3a211c=events[_0x83f2('0x4')];_0x597b1d<_0x3a211c;_0x597b1d++){var _0x76ba23=events[_0x597b1d];var _0x451b1a=createListener('faxAccount:'+_0x76ba23,_0x3a5960);FaxAccountEvents['on'](_0x76ba23,_0x451b1a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 17ad200..e593d92 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(_0x186bb0,_0x330eb0){var _0x5c9c52=function(_0x5d0bd5){while(--_0x5d0bd5){_0x186bb0['push'](_0x186bb0['shift']());}};_0x5c9c52(++_0x330eb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x50fcb7,_0x2f214c){var _0x424472=function(_0x96da0){while(--_0x96da0){_0x50fcb7['push'](_0x50fcb7['shift']());}};_0x424472(++_0x2f214c);}(_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['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 ece629b..c85daa5 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 _0x8c80=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x5c6819,_0x38bcb4){var _0x486436=function(_0x2b812a){while(--_0x2b812a){_0x5c6819['push'](_0x5c6819['shift']());}};_0x486436(++_0x38bcb4);}(_0x8c80,0xc9));var _0x08c8=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0x8c80[_0x38af48];return _0x445384;};'use strict';var Sequelize=require('sequelize');module[_0x08c8('0x0')]={'priority':{'type':Sequelize[_0x08c8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x08c8('0x2')],'allowNull':![],'defaultValue':_0x08c8('0x3')},'appdata':{'type':Sequelize[_0x08c8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x08c8('0x2')],'defaultValue':_0x08c8('0x5')}}; \ No newline at end of file +var _0xdc7b=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x2abd62,_0x36911e){var _0x1c41af=function(_0x431f8f){while(--_0x431f8f){_0x2abd62['push'](_0x2abd62['shift']());}};_0x1c41af(++_0x36911e);}(_0xdc7b,0x1b2));var _0xbdc7=function(_0x5c2817,_0x3a6b53){_0x5c2817=_0x5c2817-0x0;var _0x363a37=_0xdc7b[_0x5c2817];return _0x363a37;};'use strict';var Sequelize=require(_0xbdc7('0x0'));module[_0xbdc7('0x1')]={'priority':{'type':Sequelize[_0xbdc7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbdc7('0x3')],'allowNull':![],'defaultValue':_0xbdc7('0x4')},'appdata':{'type':Sequelize[_0xbdc7('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbdc7('0x3')],'defaultValue':_0xbdc7('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index db9f259..ebb9288 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 _0x28a3=['merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x28a3,0x13f));var _0x328a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x28a3[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x328a('0x0'));var rimraf=require(_0x328a('0x1'));var zipdir=require(_0x328a('0x2'));var jsonpatch=require(_0x328a('0x3'));var rp=require(_0x328a('0x4'));var moment=require(_0x328a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x328a('0x6'));var path=require(_0x328a('0x7'));var sox=require('sox');var csv=require(_0x328a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x328a('0x9'));var _=require(_0x328a('0xa'));var squel=require('squel');var crypto=require(_0x328a('0xb'));var jsforce=require(_0x328a('0xc'));var deskjs=require(_0x328a('0xd'));var toCsv=require(_0x328a('0x8'));var querystring=require(_0x328a('0xe'));var Papa=require(_0x328a('0xf'));var Redis=require(_0x328a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x328a('0x11'));var as=require(_0x328a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x328a('0x13'));var utils=require(_0x328a('0x14'));var config=require(_0x328a('0x15'));var licenseUtil=require(_0x328a('0x16'));var db=require(_0x328a('0x17'))['db'];function respondWithStatusCode(_0x3bbfe4,_0x587e93){_0x587e93=_0x587e93||0xcc;return function(_0x51012b){if(_0x51012b){return _0x3bbfe4[_0x328a('0x18')](_0x587e93);}return _0x3bbfe4[_0x328a('0x19')](_0x587e93)[_0x328a('0x1a')]();};}function respondWithResult(_0x3c9e34,_0x1f4134){_0x1f4134=_0x1f4134||0xc8;return function(_0x218574){if(_0x218574){return _0x3c9e34['status'](_0x1f4134)['json'](_0x218574);}};}function respondWithFilteredResult(_0x512a06,_0x4d8694){return function(_0x2fd373){if(_0x2fd373){var _0x29d5ee=typeof _0x4d8694[_0x328a('0x1b')]==='undefined'&&typeof _0x4d8694[_0x328a('0x1c')]===_0x328a('0x1d');var _0x3351d4=_0x2fd373[_0x328a('0x1e')];var _0x2e2fa5=_0x29d5ee?0x0:_0x4d8694[_0x328a('0x1b')];var _0x5be2d5=_0x29d5ee?_0x2fd373[_0x328a('0x1e')]:_0x4d8694[_0x328a('0x1b')]+_0x4d8694[_0x328a('0x1c')];var _0x7c6d81;if(_0x5be2d5>=_0x3351d4){_0x5be2d5=_0x3351d4;_0x7c6d81=0xc8;}else{_0x7c6d81=0xce;}_0x512a06[_0x328a('0x19')](_0x7c6d81);return _0x512a06['set'](_0x328a('0x1f'),_0x2e2fa5+'-'+_0x5be2d5+'/'+_0x3351d4)[_0x328a('0x20')](_0x2fd373);}return null;};}function patchUpdates(_0x312d4d){return function(_0x2d3d46){try{jsonpatch[_0x328a('0x21')](_0x2d3d46,_0x312d4d,!![]);}catch(_0xa416d8){return BPromise['reject'](_0xa416d8);}return _0x2d3d46[_0x328a('0x22')]();};}function saveUpdates(_0xca4193,_0x33c070){return function(_0x1a4e10){if(_0x1a4e10){return _0x1a4e10['update'](_0xca4193)[_0x328a('0x23')](function(_0xc4b09){return _0xc4b09;});}return null;};}function removeEntity(_0x5cb05f,_0x464187){return function(_0x59328f){if(_0x59328f){return _0x59328f[_0x328a('0x24')]()[_0x328a('0x23')](function(){_0x5cb05f[_0x328a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384b5b,_0x51499a){return function(_0x261d54){if(!_0x261d54){_0x384b5b['sendStatus'](0x194);}return _0x261d54;};}function handleError(_0x23898d,_0x52e337){_0x52e337=_0x52e337||0x1f4;return function(_0x2bf343){logger[_0x328a('0x25')](_0x2bf343[_0x328a('0x26')]);if(_0x2bf343[_0x328a('0x27')]){delete _0x2bf343[_0x328a('0x27')];}_0x23898d[_0x328a('0x19')](_0x52e337)[_0x328a('0x28')](_0x2bf343);};}exports[_0x328a('0x29')]=function(_0x31b8cb,_0x10adbb){var _0x4dab6d={},_0x16f14b={},_0x5be4b2={'count':0x0,'rows':[]};var _0x4d1465=_[_0x328a('0x2a')](db[_0x328a('0x2b')][_0x328a('0x2c')],function(_0x2e7c7f){return{'name':_0x2e7c7f[_0x328a('0x2d')],'type':_0x2e7c7f['type']['key']};});_0x16f14b[_0x328a('0x2e')]=_[_0x328a('0x2a')](_0x4d1465,'name');_0x16f14b['query']=_[_0x328a('0x2f')](_0x31b8cb[_0x328a('0x30')]);_0x16f14b[_0x328a('0x31')]=_['intersection'](_0x16f14b[_0x328a('0x2e')],_0x16f14b['query']);_0x4dab6d[_0x328a('0x32')]=_[_0x328a('0x33')](_0x16f14b[_0x328a('0x2e')],qs[_0x328a('0x34')](_0x31b8cb['query']['fields']));_0x4dab6d[_0x328a('0x32')]=_0x4dab6d['attributes'][_0x328a('0x35')]?_0x4dab6d['attributes']:_0x16f14b[_0x328a('0x2e')];if(!_0x31b8cb[_0x328a('0x30')][_0x328a('0x36')](_0x328a('0x37'))){_0x4dab6d[_0x328a('0x1c')]=qs[_0x328a('0x1c')](_0x31b8cb[_0x328a('0x30')][_0x328a('0x1c')]);_0x4dab6d[_0x328a('0x1b')]=qs[_0x328a('0x1b')](_0x31b8cb['query']['offset']);}_0x4dab6d[_0x328a('0x38')]=qs[_0x328a('0x39')](_0x31b8cb[_0x328a('0x30')][_0x328a('0x39')]);_0x4dab6d[_0x328a('0x3a')]=qs[_0x328a('0x31')](_[_0x328a('0x3b')](_0x31b8cb[_0x328a('0x30')],_0x16f14b[_0x328a('0x31')]),_0x4d1465);if(_0x31b8cb[_0x328a('0x30')][_0x328a('0x3c')]){_0x4dab6d[_0x328a('0x3a')]=_[_0x328a('0x3d')](_0x4dab6d[_0x328a('0x3a')],{'$or':_['map'](_0x4d1465,function(_0x166972){if(_0x166972[_0x328a('0x3e')]!==_0x328a('0x3f')){var _0x10781d={};_0x10781d[_0x166972[_0x328a('0x27')]]={'$like':'%'+_0x31b8cb[_0x328a('0x30')][_0x328a('0x3c')]+'%'};return _0x10781d;}})});}_0x4dab6d=_[_0x328a('0x3d')]({},_0x4dab6d,_0x31b8cb[_0x328a('0x40')]);var _0x37ee5a={'where':_0x4dab6d[_0x328a('0x3a')]};return db[_0x328a('0x2b')][_0x328a('0x1e')](_0x37ee5a)[_0x328a('0x23')](function(_0x15ee7f){_0x5be4b2[_0x328a('0x1e')]=_0x15ee7f;if(_0x31b8cb[_0x328a('0x30')][_0x328a('0x41')]){_0x4dab6d[_0x328a('0x42')]=[{'all':!![]}];}return db[_0x328a('0x2b')][_0x328a('0x43')](_0x4dab6d);})[_0x328a('0x23')](function(_0x4d824d){_0x5be4b2[_0x328a('0x44')]=_0x4d824d;return _0x5be4b2;})[_0x328a('0x23')](respondWithFilteredResult(_0x10adbb,_0x4dab6d))['catch'](handleError(_0x10adbb,null));};exports[_0x328a('0x45')]=function(_0x2cc04a,_0x1202a8){var _0x4a9b71={'raw':!![],'where':{'id':_0x2cc04a[_0x328a('0x46')]['id']}},_0x5e3066={};_0x5e3066[_0x328a('0x2e')]=_['keys'](db[_0x328a('0x2b')][_0x328a('0x2c')]);_0x5e3066[_0x328a('0x30')]=_[_0x328a('0x2f')](_0x2cc04a[_0x328a('0x30')]);_0x5e3066['filters']=_[_0x328a('0x33')](_0x5e3066[_0x328a('0x2e')],_0x5e3066[_0x328a('0x30')]);_0x4a9b71[_0x328a('0x32')]=_[_0x328a('0x33')](_0x5e3066[_0x328a('0x2e')],qs[_0x328a('0x34')](_0x2cc04a['query'][_0x328a('0x34')]));_0x4a9b71[_0x328a('0x32')]=_0x4a9b71[_0x328a('0x32')][_0x328a('0x35')]?_0x4a9b71[_0x328a('0x32')]:_0x5e3066[_0x328a('0x2e')];if(_0x2cc04a['query'][_0x328a('0x41')]){_0x4a9b71['include']=[{'all':!![]}];}_0x4a9b71=_[_0x328a('0x3d')]({},_0x4a9b71,_0x2cc04a[_0x328a('0x40')]);return db[_0x328a('0x2b')][_0x328a('0x47')](_0x4a9b71)[_0x328a('0x23')](handleEntityNotFound(_0x1202a8,null))[_0x328a('0x23')](respondWithResult(_0x1202a8,null))['catch'](handleError(_0x1202a8,null));};exports[_0x328a('0x48')]=function(_0x2b7b39,_0x1ed1cc){return db[_0x328a('0x2b')][_0x328a('0x48')](_0x2b7b39[_0x328a('0x49')],{})[_0x328a('0x23')](respondWithResult(_0x1ed1cc,0xc9))[_0x328a('0x4a')](handleError(_0x1ed1cc,null));};exports[_0x328a('0x4b')]=function(_0x5b384a,_0xa959e1){if(_0x5b384a[_0x328a('0x49')]['id']){delete _0x5b384a[_0x328a('0x49')]['id'];}return db[_0x328a('0x2b')][_0x328a('0x47')]({'where':{'id':_0x5b384a[_0x328a('0x46')]['id']}})[_0x328a('0x23')](handleEntityNotFound(_0xa959e1,null))[_0x328a('0x23')](saveUpdates(_0x5b384a[_0x328a('0x49')],null))[_0x328a('0x23')](respondWithResult(_0xa959e1,null))[_0x328a('0x4a')](handleError(_0xa959e1,null));};exports[_0x328a('0x24')]=function(_0x56c151,_0xe604f1){return db['FaxApplication'][_0x328a('0x47')]({'where':{'id':_0x56c151[_0x328a('0x46')]['id']}})[_0x328a('0x23')](handleEntityNotFound(_0xe604f1,null))[_0x328a('0x23')](removeEntity(_0xe604f1,null))[_0x328a('0x4a')](handleError(_0xe604f1,null));}; \ No newline at end of file +var _0x4e08=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','reject','update','then','sendStatus','error','name','map','type','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxApplication','includeAll','include','findAll','catch','show','keys','options','find','create','body','params'];(function(_0x35206c,_0x1fab51){var _0x5460cc=function(_0x262eb7){while(--_0x262eb7){_0x35206c['push'](_0x35206c['shift']());}};_0x5460cc(++_0x1fab51);}(_0x4e08,0x120));var _0x84e0=function(_0x3856aa,_0x2980a9){_0x3856aa=_0x3856aa-0x0;var _0x38db06=_0x4e08[_0x3856aa];return _0x38db06;};'use strict';var emlformat=require(_0x84e0('0x0'));var rimraf=require(_0x84e0('0x1'));var zipdir=require(_0x84e0('0x2'));var jsonpatch=require(_0x84e0('0x3'));var rp=require(_0x84e0('0x4'));var moment=require(_0x84e0('0x5'));var BPromise=require(_0x84e0('0x6'));var Mustache=require(_0x84e0('0x7'));var util=require(_0x84e0('0x8'));var path=require(_0x84e0('0x9'));var sox=require(_0x84e0('0xa'));var csv=require('to-csv');var ejs=require(_0x84e0('0xb'));var fs=require('fs');var fs_extra=require(_0x84e0('0xc'));var _=require('lodash');var squel=require(_0x84e0('0xd'));var crypto=require(_0x84e0('0xe'));var jsforce=require(_0x84e0('0xf'));var deskjs=require(_0x84e0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x84e0('0x11'));var Papa=require(_0x84e0('0x12'));var Redis=require('ioredis');var authService=require(_0x84e0('0x13'));var qs=require(_0x84e0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84e0('0x15'));var logger=require(_0x84e0('0x16'))(_0x84e0('0x17'));var utils=require(_0x84e0('0x18'));var config=require(_0x84e0('0x19'));var licenseUtil=require(_0x84e0('0x1a'));var db=require(_0x84e0('0x1b'))['db'];function respondWithStatusCode(_0xff710b,_0x4e99b0){_0x4e99b0=_0x4e99b0||0xcc;return function(_0x3b5214){if(_0x3b5214){return _0xff710b['sendStatus'](_0x4e99b0);}return _0xff710b[_0x84e0('0x1c')](_0x4e99b0)[_0x84e0('0x1d')]();};}function respondWithResult(_0x611ed1,_0x835e6f){_0x835e6f=_0x835e6f||0xc8;return function(_0x178e16){if(_0x178e16){return _0x611ed1[_0x84e0('0x1c')](_0x835e6f)[_0x84e0('0x1e')](_0x178e16);}};}function respondWithFilteredResult(_0xbe5275,_0x45f7a2){return function(_0x53d632){if(_0x53d632){var _0x1ca4a2=typeof _0x45f7a2[_0x84e0('0x1f')]===_0x84e0('0x20')&&typeof _0x45f7a2['limit']==='undefined';var _0x3f8183=_0x53d632[_0x84e0('0x21')];var _0x348585=_0x1ca4a2?0x0:_0x45f7a2[_0x84e0('0x1f')];var _0x348aff=_0x1ca4a2?_0x53d632[_0x84e0('0x21')]:_0x45f7a2[_0x84e0('0x1f')]+_0x45f7a2['limit'];var _0x3209a2;if(_0x348aff>=_0x3f8183){_0x348aff=_0x3f8183;_0x3209a2=0xc8;}else{_0x3209a2=0xce;}_0xbe5275[_0x84e0('0x1c')](_0x3209a2);return _0xbe5275[_0x84e0('0x22')]('Content-Range',_0x348585+'-'+_0x348aff+'/'+_0x3f8183)[_0x84e0('0x1e')](_0x53d632);}return null;};}function patchUpdates(_0x578eb8){return function(_0x111e67){try{jsonpatch['apply'](_0x111e67,_0x578eb8,!![]);}catch(_0x2eb80b){return BPromise[_0x84e0('0x23')](_0x2eb80b);}return _0x111e67['save']();};}function saveUpdates(_0x566570,_0x4a3da9){return function(_0x2e7891){if(_0x2e7891){return _0x2e7891[_0x84e0('0x24')](_0x566570)['then'](function(_0x374a0a){return _0x374a0a;});}return null;};}function removeEntity(_0x80f6ed,_0x4c6d06){return function(_0x283ba9){if(_0x283ba9){return _0x283ba9['destroy']()[_0x84e0('0x25')](function(){_0x80f6ed[_0x84e0('0x1c')](0xcc)[_0x84e0('0x1d')]();});}};}function handleEntityNotFound(_0x22328b,_0x5924c6){return function(_0x2a87a5){if(!_0x2a87a5){_0x22328b[_0x84e0('0x26')](0x194);}return _0x2a87a5;};}function handleError(_0x370432,_0x1a100f){_0x1a100f=_0x1a100f||0x1f4;return function(_0x444e5c){logger[_0x84e0('0x27')](_0x444e5c['stack']);if(_0x444e5c['name']){delete _0x444e5c[_0x84e0('0x28')];}_0x370432[_0x84e0('0x1c')](_0x1a100f)['send'](_0x444e5c);};}exports['index']=function(_0x3f11d2,_0x7e3671){var _0xd4ce8={},_0x2a7de1={},_0x40fa10={'count':0x0,'rows':[]};var _0x482596=_[_0x84e0('0x29')](db['FaxApplication']['rawAttributes'],function(_0x15b4ed){return{'name':_0x15b4ed['fieldName'],'type':_0x15b4ed[_0x84e0('0x2a')]['key']};});_0x2a7de1['model']=_[_0x84e0('0x29')](_0x482596,'name');_0x2a7de1[_0x84e0('0x2b')]=_['keys'](_0x3f11d2['query']);_0x2a7de1['filters']=_['intersection'](_0x2a7de1[_0x84e0('0x2c')],_0x2a7de1[_0x84e0('0x2b')]);_0xd4ce8[_0x84e0('0x2d')]=_[_0x84e0('0x2e')](_0x2a7de1[_0x84e0('0x2c')],qs[_0x84e0('0x2f')](_0x3f11d2[_0x84e0('0x2b')][_0x84e0('0x2f')]));_0xd4ce8[_0x84e0('0x2d')]=_0xd4ce8[_0x84e0('0x2d')][_0x84e0('0x30')]?_0xd4ce8[_0x84e0('0x2d')]:_0x2a7de1['model'];if(!_0x3f11d2['query'][_0x84e0('0x31')](_0x84e0('0x32'))){_0xd4ce8[_0x84e0('0x33')]=qs[_0x84e0('0x33')](_0x3f11d2[_0x84e0('0x2b')]['limit']);_0xd4ce8[_0x84e0('0x1f')]=qs[_0x84e0('0x1f')](_0x3f11d2[_0x84e0('0x2b')][_0x84e0('0x1f')]);}_0xd4ce8[_0x84e0('0x34')]=qs[_0x84e0('0x35')](_0x3f11d2['query']['sort']);_0xd4ce8[_0x84e0('0x36')]=qs[_0x84e0('0x37')](_[_0x84e0('0x38')](_0x3f11d2[_0x84e0('0x2b')],_0x2a7de1[_0x84e0('0x37')]),_0x482596);if(_0x3f11d2[_0x84e0('0x2b')][_0x84e0('0x39')]){_0xd4ce8[_0x84e0('0x36')]=_[_0x84e0('0x3a')](_0xd4ce8[_0x84e0('0x36')],{'$or':_[_0x84e0('0x29')](_0x482596,function(_0x59354a){if(_0x59354a[_0x84e0('0x2a')]!==_0x84e0('0x3b')){var _0x37dc2d={};_0x37dc2d[_0x59354a[_0x84e0('0x28')]]={'$like':'%'+_0x3f11d2['query'][_0x84e0('0x39')]+'%'};return _0x37dc2d;}})});}_0xd4ce8=_['merge']({},_0xd4ce8,_0x3f11d2['options']);var _0x567402={'where':_0xd4ce8[_0x84e0('0x36')]};return db[_0x84e0('0x3c')][_0x84e0('0x21')](_0x567402)[_0x84e0('0x25')](function(_0x4586ef){_0x40fa10[_0x84e0('0x21')]=_0x4586ef;if(_0x3f11d2['query'][_0x84e0('0x3d')]){_0xd4ce8[_0x84e0('0x3e')]=[{'all':!![]}];}return db[_0x84e0('0x3c')][_0x84e0('0x3f')](_0xd4ce8);})['then'](function(_0x219745){_0x40fa10['rows']=_0x219745;return _0x40fa10;})[_0x84e0('0x25')](respondWithFilteredResult(_0x7e3671,_0xd4ce8))[_0x84e0('0x40')](handleError(_0x7e3671,null));};exports[_0x84e0('0x41')]=function(_0x3cdb94,_0x82fd79){var _0x3dfb00={'raw':!![],'where':{'id':_0x3cdb94['params']['id']}},_0x2c0841={};_0x2c0841[_0x84e0('0x2c')]=_[_0x84e0('0x42')](db['FaxApplication']['rawAttributes']);_0x2c0841[_0x84e0('0x2b')]=_['keys'](_0x3cdb94[_0x84e0('0x2b')]);_0x2c0841[_0x84e0('0x37')]=_[_0x84e0('0x2e')](_0x2c0841[_0x84e0('0x2c')],_0x2c0841[_0x84e0('0x2b')]);_0x3dfb00[_0x84e0('0x2d')]=_[_0x84e0('0x2e')](_0x2c0841[_0x84e0('0x2c')],qs[_0x84e0('0x2f')](_0x3cdb94[_0x84e0('0x2b')][_0x84e0('0x2f')]));_0x3dfb00[_0x84e0('0x2d')]=_0x3dfb00[_0x84e0('0x2d')]['length']?_0x3dfb00['attributes']:_0x2c0841[_0x84e0('0x2c')];if(_0x3cdb94[_0x84e0('0x2b')][_0x84e0('0x3d')]){_0x3dfb00[_0x84e0('0x3e')]=[{'all':!![]}];}_0x3dfb00=_['merge']({},_0x3dfb00,_0x3cdb94[_0x84e0('0x43')]);return db[_0x84e0('0x3c')][_0x84e0('0x44')](_0x3dfb00)['then'](handleEntityNotFound(_0x82fd79,null))['then'](respondWithResult(_0x82fd79,null))['catch'](handleError(_0x82fd79,null));};exports[_0x84e0('0x45')]=function(_0x4b7453,_0xbb9eda){return db[_0x84e0('0x3c')][_0x84e0('0x45')](_0x4b7453[_0x84e0('0x46')],{})['then'](respondWithResult(_0xbb9eda,0xc9))[_0x84e0('0x40')](handleError(_0xbb9eda,null));};exports['update']=function(_0x39f14f,_0x2db4ab){if(_0x39f14f[_0x84e0('0x46')]['id']){delete _0x39f14f[_0x84e0('0x46')]['id'];}return db[_0x84e0('0x3c')]['find']({'where':{'id':_0x39f14f[_0x84e0('0x47')]['id']}})[_0x84e0('0x25')](handleEntityNotFound(_0x2db4ab,null))[_0x84e0('0x25')](saveUpdates(_0x39f14f[_0x84e0('0x46')],null))[_0x84e0('0x25')](respondWithResult(_0x2db4ab,null))['catch'](handleError(_0x2db4ab,null));};exports['destroy']=function(_0x16491e,_0x4ca177){return db[_0x84e0('0x3c')][_0x84e0('0x44')]({'where':{'id':_0x16491e[_0x84e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ca177,null))[_0x84e0('0x25')](removeEntity(_0x4ca177,null))[_0x84e0('0x40')](handleError(_0x4ca177,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 3f7eb3f..32c3e00 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 _0x700c=['bluebird','path','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x2f99bb,_0x26c580){var _0x1ec7fb=function(_0x55fc5c){while(--_0x55fc5c){_0x2f99bb['push'](_0x2f99bb['shift']());}};_0x1ec7fb(++_0x26c580);}(_0x700c,0xc7));var _0xc700=function(_0x34b62c,_0x443a65){_0x34b62c=_0x34b62c-0x0;var _0xae5a8d=_0x700c[_0x34b62c];return _0xae5a8d;};'use strict';var _=require(_0xc700('0x0'));var util=require(_0xc700('0x1'));var logger=require(_0xc700('0x2'))(_0xc700('0x3'));var moment=require(_0xc700('0x4'));var BPromise=require(_0xc700('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc700('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0xc700('0x7')]=function(_0x47b90e,_0xb19064){return _0x47b90e[_0xc700('0x8')](_0xc700('0x9'),attributes,{'tableName':_0xc700('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc700('0xb')});}; \ No newline at end of file +var _0x5099=['fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x4aadb2,_0x46be05){var _0x43785c=function(_0x6fa6d){while(--_0x6fa6d){_0x4aadb2['push'](_0x4aadb2['shift']());}};_0x43785c(++_0x46be05);}(_0x5099,0x101));var _0x9509=function(_0x21a359,_0x4d8f55){_0x21a359=_0x21a359-0x0;var _0x375ce9=_0x5099[_0x21a359];return _0x375ce9;};'use strict';var _=require(_0x9509('0x0'));var util=require(_0x9509('0x1'));var logger=require(_0x9509('0x2'))(_0x9509('0x3'));var moment=require(_0x9509('0x4'));var BPromise=require(_0x9509('0x5'));var rp=require(_0x9509('0x6'));var fs=require('fs');var path=require(_0x9509('0x7'));var rimraf=require(_0x9509('0x8'));var config=require('../../config/environment');var attributes=require(_0x9509('0x9'));module[_0x9509('0xa')]=function(_0x78a93,_0x16c3bf){return _0x78a93[_0x9509('0xb')](_0x9509('0xc'),attributes,{'tableName':_0x9509('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9509('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8dc1a52..54c48e2 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 _0x3d46=['FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','body','options','raw','where','attributes','limit','then','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5cd83d,_0x48a557){var _0x3678db=function(_0x129957){while(--_0x129957){_0x5cd83d['push'](_0x5cd83d['shift']());}};_0x3678db(++_0x48a557);}(_0x3d46,0x170));var _0x63d4=function(_0x5b8032,_0x1ba6b4){_0x5b8032=_0x5b8032-0x0;var _0x3a4449=_0x3d46[_0x5b8032];return _0x3a4449;};'use strict';var _=require(_0x63d4('0x0'));var util=require(_0x63d4('0x1'));var moment=require(_0x63d4('0x2'));var BPromise=require(_0x63d4('0x3'));var rs=require(_0x63d4('0x4'));var fs=require('fs');var Redis=require(_0x63d4('0x5'));var db=require(_0x63d4('0x6'))['db'];var utils=require(_0x63d4('0x7'));var logger=require('../../config/logger')(_0x63d4('0x8'));var config=require('../../config/environment');var jayson=require(_0x63d4('0x9'));var client=jayson[_0x63d4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39c7f9,_0x167e0c,_0x168d19){return new BPromise(function(_0x3bc1b0,_0x492059){return client[_0x63d4('0xb')](_0x39c7f9,_0x168d19)['then'](function(_0x5eb571){logger[_0x63d4('0xc')](_0x63d4('0xd'),_0x167e0c,_0x63d4('0xe'));logger[_0x63d4('0xf')](_0x63d4('0x10'),_0x167e0c,'request\x20sent',JSON[_0x63d4('0x11')](_0x5eb571));if(_0x5eb571[_0x63d4('0x12')]){if(_0x5eb571[_0x63d4('0x12')][_0x63d4('0x13')]===0x1f4){logger['error'](_0x63d4('0xd'),_0x167e0c,_0x5eb571[_0x63d4('0x12')]['message']);return _0x492059(_0x5eb571['error'][_0x63d4('0x14')]);}logger[_0x63d4('0x12')](_0x63d4('0xd'),_0x167e0c,_0x5eb571[_0x63d4('0x12')][_0x63d4('0x14')]);return _0x3bc1b0(_0x5eb571[_0x63d4('0x12')][_0x63d4('0x14')]);}else{logger[_0x63d4('0xc')]('FaxApplication,\x20%s,\x20%s',_0x167e0c,'request\x20sent');_0x3bc1b0(_0x5eb571[_0x63d4('0x15')][_0x63d4('0x14')]);}})[_0x63d4('0x16')](function(_0xd8cec2){logger[_0x63d4('0x12')](_0x63d4('0xd'),_0x167e0c,_0xd8cec2);_0x492059(_0xd8cec2);});});}exports['UpdateFaxApplication']=function(_0xdfd0da){var _0x2e64dc=this;return new Promise(function(_0x258999,_0x434e0c){return db[_0x63d4('0x17')]['update'](_0xdfd0da[_0x63d4('0x18')],{'raw':_0xdfd0da[_0x63d4('0x19')]?_0xdfd0da[_0x63d4('0x19')][_0x63d4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdfd0da[_0x63d4('0x19')]?_0xdfd0da[_0x63d4('0x19')][_0x63d4('0x1b')]||null:null,'attributes':_0xdfd0da[_0x63d4('0x19')]?_0xdfd0da['options'][_0x63d4('0x1c')]||null:null,'limit':_0xdfd0da[_0x63d4('0x19')]?_0xdfd0da['options'][_0x63d4('0x1d')]||null:null})[_0x63d4('0x1e')](function(_0x4d43c1){logger['info'](_0x63d4('0x1f'),_0xdfd0da);logger[_0x63d4('0xf')](_0x63d4('0x1f'),_0xdfd0da,JSON[_0x63d4('0x11')](_0x4d43c1));_0x258999(_0x4d43c1);})[_0x63d4('0x16')](function(_0x278c95){logger['error']('UpdateFaxApplication',_0x278c95[_0x63d4('0x14')],_0xdfd0da);_0x434e0c(_0x2e64dc[_0x63d4('0x12')](0x1f4,_0x278c95['message']));});});}; \ No newline at end of file +var _0x3261=['client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','FaxApplication','update','body','options','where','attributes','limit','then','UpdateFaxApplication','stringify','catch','util','moment','bluebird','../../config/utils','rpc','../../config/environment'];(function(_0x377926,_0xf3a11){var _0x287f93=function(_0xa50454){while(--_0xa50454){_0x377926['push'](_0x377926['shift']());}};_0x287f93(++_0xf3a11);}(_0x3261,0x7c));var _0x1326=function(_0x591327,_0x551718){_0x591327=_0x591327-0x0;var _0x43a675=_0x3261[_0x591327];return _0x43a675;};'use strict';var _=require('lodash');var util=require(_0x1326('0x0'));var moment=require(_0x1326('0x1'));var BPromise=require(_0x1326('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1326('0x3'));var logger=require('../../config/logger')(_0x1326('0x4'));var config=require(_0x1326('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1326('0x6')][_0x1326('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f2d95,_0x573dd1,_0x5b3123){return new BPromise(function(_0x4d6db8,_0x52de16){return client['request'](_0x5f2d95,_0x5b3123)['then'](function(_0x52a527){logger[_0x1326('0x8')](_0x1326('0x9'),_0x573dd1,_0x1326('0xa'));logger[_0x1326('0xb')](_0x1326('0xc'),_0x573dd1,_0x1326('0xa'),JSON['stringify'](_0x52a527));if(_0x52a527[_0x1326('0xd')]){if(_0x52a527[_0x1326('0xd')]['code']===0x1f4){logger[_0x1326('0xd')](_0x1326('0x9'),_0x573dd1,_0x52a527[_0x1326('0xd')]['message']);return _0x52de16(_0x52a527['error']['message']);}logger[_0x1326('0xd')](_0x1326('0x9'),_0x573dd1,_0x52a527[_0x1326('0xd')][_0x1326('0xe')]);return _0x4d6db8(_0x52a527['error']['message']);}else{logger[_0x1326('0x8')]('FaxApplication,\x20%s,\x20%s',_0x573dd1,'request\x20sent');_0x4d6db8(_0x52a527['result']['message']);}})['catch'](function(_0x1c7b3f){logger[_0x1326('0xd')](_0x1326('0x9'),_0x573dd1,_0x1c7b3f);_0x52de16(_0x1c7b3f);});});}exports['UpdateFaxApplication']=function(_0x49bfda){var _0x234af1=this;return new Promise(function(_0x39dbe1,_0x3fb09a){return db[_0x1326('0xf')][_0x1326('0x10')](_0x49bfda[_0x1326('0x11')],{'raw':_0x49bfda[_0x1326('0x12')]?_0x49bfda[_0x1326('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49bfda[_0x1326('0x12')]?_0x49bfda[_0x1326('0x12')][_0x1326('0x13')]||null:null,'attributes':_0x49bfda[_0x1326('0x12')]?_0x49bfda[_0x1326('0x12')][_0x1326('0x14')]||null:null,'limit':_0x49bfda['options']?_0x49bfda[_0x1326('0x12')][_0x1326('0x15')]||null:null})[_0x1326('0x16')](function(_0x4cfe58){logger['info'](_0x1326('0x17'),_0x49bfda);logger['debug'](_0x1326('0x17'),_0x49bfda,JSON[_0x1326('0x18')](_0x4cfe58));_0x39dbe1(_0x4cfe58);})[_0x1326('0x19')](function(_0x234b15){logger['error']('UpdateFaxApplication',_0x234b15[_0x1326('0xe')],_0x49bfda);_0x3fb09a(_0x234af1[_0x1326('0xd')](0x1f4,_0x234b15[_0x1326('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 41ac9d4..1c1b50b 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x30d98c,_0x4687b2){var _0x30f540=function(_0x46be4c){while(--_0x46be4c){_0x30d98c['push'](_0x30d98c['shift']());}};_0x30f540(++_0x4687b2);}(_0x34b7,0x196));var _0x734b=function(_0x475e33,_0x42824a){_0x475e33=_0x475e33-0x0;var _0x318871=_0x34b7[_0x475e33];return _0x318871;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0xf4f4=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x351848,_0x348c3d){var _0x20864b=function(_0x1ecb9a){while(--_0x1ecb9a){_0x351848['push'](_0x351848['shift']());}};_0x20864b(++_0x348c3d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x228f13,_0x550e4a){_0x228f13=_0x228f13-0x0;var _0x2921f0=_0xf4f4[_0x228f13];return _0x2921f0;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./faxApplication.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b3b5718..993e99f 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 _0x4171=['ENUM','out','BOOLEAN','STRING','DATE'];(function(_0x202ee2,_0x3963ba){var _0x29a801=function(_0x84eed7){while(--_0x84eed7){_0x202ee2['push'](_0x202ee2['shift']());}};_0x29a801(++_0x3963ba);}(_0x4171,0xcf));var _0x1417=function(_0x8518ee,_0x441ea8){_0x8518ee=_0x8518ee-0x0;var _0x5c4322=_0x4171[_0x8518ee];return _0x5c4322;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x1417('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1417('0x1')]},'secondDisposition':{'type':Sequelize[_0x1417('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1417('0x1')]},'read1stAt':{'type':Sequelize[_0x1417('0x2')]},'fax':{'type':Sequelize[_0x1417('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x1417('0x3')]('in',_0x1417('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1417('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7f0f=['DATE','ENUM','out','sequelize','BOOLEAN','STRING'];(function(_0x35efe0,_0x25266f){var _0x45ea82=function(_0x463a96){while(--_0x463a96){_0x35efe0['push'](_0x35efe0['shift']());}};_0x45ea82(++_0x25266f);}(_0x7f0f,0x75));var _0xf7f0=function(_0x4376b3,_0x44b199){_0x4376b3=_0x4376b3-0x0;var _0x325b3b=_0x7f0f[_0x4376b3];return _0x325b3b;};'use strict';var Sequelize=require(_0xf7f0('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf7f0('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf7f0('0x2')]},'secondDisposition':{'type':Sequelize[_0xf7f0('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf7f0('0x2')]},'note':{'type':Sequelize[_0xf7f0('0x2')]},'read1stAt':{'type':Sequelize[_0xf7f0('0x3')]},'fax':{'type':Sequelize[_0xf7f0('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf7f0('0x4')]('in',_0xf7f0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf7f0('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf7f0('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 3c223b7..ab5d461 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 _0x6afa=['send','Users','map','fullname','Tags','TagIds','split','push','catch','index','FaxInteraction','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','rows','show','params','keys','rawAttributes','include','options','create','body','describe','FaxMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','Attachment','Messages','mkdirSync','existsSync','createReadStream','basename','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name'];(function(_0x500242,_0x4b5bb0){var _0x52ba31=function(_0x3e1398){while(--_0x3e1398){_0x500242['push'](_0x500242['shift']());}};_0x52ba31(++_0x4b5bb0);}(_0x6afa,0xa6));var _0xa6af=function(_0x802bdf,_0x2f2893){_0x802bdf=_0x802bdf-0x0;var _0x28b99f=_0x6afa[_0x802bdf];return _0x28b99f;};'use strict';var emlformat=require(_0xa6af('0x0'));var rimraf=require(_0xa6af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6af('0x2'));var rp=require(_0xa6af('0x3'));var moment=require(_0xa6af('0x4'));var BPromise=require(_0xa6af('0x5'));var Mustache=require(_0xa6af('0x6'));var util=require('util');var path=require(_0xa6af('0x7'));var sox=require('sox');var csv=require(_0xa6af('0x8'));var ejs=require(_0xa6af('0x9'));var fs=require('fs');var fs_extra=require(_0xa6af('0xa'));var _=require(_0xa6af('0xb'));var squel=require(_0xa6af('0xc'));var crypto=require(_0xa6af('0xd'));var jsforce=require(_0xa6af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa6af('0x8'));var querystring=require(_0xa6af('0xf'));var Papa=require(_0xa6af('0x10'));var Redis=require(_0xa6af('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa6af('0x12'));var as=require(_0xa6af('0x13'));var hardwareService=require(_0xa6af('0x14'));var logger=require('../../config/logger')(_0xa6af('0x15'));var utils=require(_0xa6af('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa6af('0x17')](config['redis'],{'host':_0xa6af('0x18'),'port':0x18eb});var socket=require(_0xa6af('0x19'))(new Redis(config['redis']));require(_0xa6af('0x1a'))[_0xa6af('0x1b')](socket);function respondWithStatusCode(_0x1d11d4,_0x4d34c4){_0x4d34c4=_0x4d34c4||0xcc;return function(_0xfc3f70){if(_0xfc3f70){return _0x1d11d4[_0xa6af('0x1c')](_0x4d34c4);}return _0x1d11d4[_0xa6af('0x1d')](_0x4d34c4)['end']();};}function respondWithResult(_0x34d0df,_0x447f49){_0x447f49=_0x447f49||0xc8;return function(_0x253d9b){if(_0x253d9b){return _0x34d0df[_0xa6af('0x1d')](_0x447f49)[_0xa6af('0x1e')](_0x253d9b);}};}function respondWithFilteredResult(_0x23b90f,_0x3d25c8){return function(_0x58bac9){if(_0x58bac9){var _0x4c81f4=typeof _0x3d25c8['offset']===_0xa6af('0x1f')&&typeof _0x3d25c8['limit']===_0xa6af('0x1f');var _0x8b18d7=_0x58bac9[_0xa6af('0x20')];var _0x57b57a=_0x4c81f4?0x0:_0x3d25c8[_0xa6af('0x21')];var _0x4c20c4=_0x4c81f4?_0x58bac9['count']:_0x3d25c8[_0xa6af('0x21')]+_0x3d25c8[_0xa6af('0x22')];var _0x59abc8;if(_0x4c20c4>=_0x8b18d7){_0x4c20c4=_0x8b18d7;_0x59abc8=0xc8;}else{_0x59abc8=0xce;}_0x23b90f[_0xa6af('0x1d')](_0x59abc8);return _0x23b90f[_0xa6af('0x23')]('Content-Range',_0x57b57a+'-'+_0x4c20c4+'/'+_0x8b18d7)[_0xa6af('0x1e')](_0x58bac9);}return null;};}function patchUpdates(_0x10bc06){return function(_0x5ba9a2){try{jsonpatch[_0xa6af('0x24')](_0x5ba9a2,_0x10bc06,!![]);}catch(_0x1936bf){return BPromise[_0xa6af('0x25')](_0x1936bf);}return _0x5ba9a2['save']();};}function saveUpdates(_0x1759e8,_0x5dd54e){return function(_0xa19cb1){if(_0xa19cb1){return _0xa19cb1[_0xa6af('0x26')](_0x1759e8)[_0xa6af('0x27')](function(_0x1f743f){return _0x1f743f;});}return null;};}function removeEntity(_0x55031f,_0x380dfa){return function(_0x344ee2){if(_0x344ee2){return _0x344ee2[_0xa6af('0x28')]()[_0xa6af('0x27')](function(){_0x55031f[_0xa6af('0x1d')](0xcc)[_0xa6af('0x29')]();});}};}function handleEntityNotFound(_0x62df11,_0x2fca6c){return function(_0x268b34){if(!_0x268b34){_0x62df11[_0xa6af('0x1c')](0x194);}return _0x268b34;};}function handleError(_0x10c81a,_0x280236){_0x280236=_0x280236||0x1f4;return function(_0x10436d){logger[_0xa6af('0x2a')](_0x10436d[_0xa6af('0x2b')]);if(_0x10436d[_0xa6af('0x2c')]){delete _0x10436d[_0xa6af('0x2c')];}_0x10c81a[_0xa6af('0x1d')](_0x280236)[_0xa6af('0x2d')](_0x10436d);};}function getInteractionUsers(_0x9b4c3b,_0x3f6135){return new BPromise(function(_0x388e41,_0x4a87ac){try{if(_0x3f6135[_0x9b4c3b['id']]){_0x9b4c3b[_0xa6af('0x2e')]=_[_0xa6af('0x2f')](_0x3f6135[_0x9b4c3b['id']],function(_0x11726d){return{'id':_0x11726d['id'],'fullname':_0x11726d[_0xa6af('0x30')]};});}}catch(_0x5778f5){_0x4a87ac(_0x5778f5);}_0x388e41(_0x9b4c3b);});}function getInteractionTags(_0x22d45e,_0x193ec7){return new BPromise(function(_0x862259,_0x20d45c){try{if(_0x22d45e['TagIds']){_0x22d45e[_0xa6af('0x31')]=[];_0x22d45e[_0xa6af('0x32')][_0xa6af('0x33')](',')['forEach'](function(_0x40e6eb){_0x22d45e['Tags'][_0xa6af('0x34')](_0x193ec7[_0x40e6eb]);});}delete _0x22d45e[_0xa6af('0x32')];}catch(_0x3ce02d){_0x20d45c(_0x3ce02d);}_0x862259(_0x22d45e);});}function updateFaxInteraction(_0x5962e7,_0xc27487,_0x13d89c){return new BPromise(function(_0x513603,_0x2e68be){return getInteractionUsers(_0x5962e7,_0x13d89c)['then'](function(_0xb314d0){return getInteractionTags(_0xb314d0,_0xc27487);})[_0xa6af('0x27')](function(_0x57b791){_0x513603(_0x57b791);})[_0xa6af('0x35')](function(_0x66b29a){_0x2e68be(_0x66b29a);});});}exports[_0xa6af('0x36')]=function(_0x295124,_0x8f9f8e){var _0x105313={},_0x30a17d={},_0x433256={'count':0x0,'rows':[]};var _0x26d305=_[_0xa6af('0x2f')](db[_0xa6af('0x37')]['rawAttributes'],function(_0x1f31eb){return{'name':_0x1f31eb[_0xa6af('0x38')],'type':_0x1f31eb[_0xa6af('0x39')][_0xa6af('0x3a')]};});_0x30a17d[_0xa6af('0x3b')]=_[_0xa6af('0x2f')](_0x26d305,_0xa6af('0x2c'));_0x30a17d[_0xa6af('0x3c')]=_['keys'](_0x295124['query']);_0x30a17d[_0xa6af('0x3d')]=_[_0xa6af('0x3e')](_0x30a17d[_0xa6af('0x3b')],_0x30a17d[_0xa6af('0x3c')]);_0x105313[_0xa6af('0x3f')]=_[_0xa6af('0x3e')](_0x30a17d[_0xa6af('0x3b')],qs[_0xa6af('0x40')](_0x295124[_0xa6af('0x3c')][_0xa6af('0x40')]));_0x105313[_0xa6af('0x3f')]=_0x105313[_0xa6af('0x3f')]['length']?_0x105313[_0xa6af('0x3f')]:_0x30a17d[_0xa6af('0x3b')];if(!_0x295124[_0xa6af('0x3c')][_0xa6af('0x41')](_0xa6af('0x42'))){_0x105313['limit']=qs[_0xa6af('0x22')](_0x295124[_0xa6af('0x3c')][_0xa6af('0x22')]);_0x105313[_0xa6af('0x21')]=qs[_0xa6af('0x21')](_0x295124[_0xa6af('0x3c')]['offset']);}_0x105313[_0xa6af('0x43')]=qs['sort'](_0x295124[_0xa6af('0x3c')][_0xa6af('0x44')]);_0x105313[_0xa6af('0x45')]=qs[_0xa6af('0x3d')](_[_0xa6af('0x46')](_0x295124[_0xa6af('0x3c')],_0x30a17d[_0xa6af('0x3d')]),_0x26d305);var _0x295496=[];var _0x24b842=squel[_0xa6af('0x47')]()[_0xa6af('0x48')]('id')[_0xa6af('0x48')](_0xa6af('0x2c'))['field']('color')[_0xa6af('0x49')](_0xa6af('0x4a'));var _0x53cc4f=squel['select']()[_0xa6af('0x48')](_0xa6af('0x4b'))[_0xa6af('0x48')]('u.fullname')[_0xa6af('0x48')](_0xa6af('0x4c'))[_0xa6af('0x49')](_0xa6af('0x4d'),'ui')['left_join'](_0xa6af('0x4e'),'u',_0xa6af('0x4f'));var _0x4d7e42=squel[_0xa6af('0x47')]()[_0xa6af('0x49')]('fax_interactions','i')[_0xa6af('0x50')](_0xa6af('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa6af('0x50')](_0xa6af('0x4e'),'o',_0xa6af('0x52'))[_0xa6af('0x50')](_0xa6af('0x53'),'a',_0xa6af('0x54'))['left_join'](_0xa6af('0x55'),'me',_0xa6af('0x56'))[_0xa6af('0x50')]('fax_interaction_has_tags','it',_0xa6af('0x57'))[_0xa6af('0x50')](_0xa6af('0x4a'),'t',_0xa6af('0x58'));var _0x416a7b=squel['expr']();var _0x415448=[];var _0xf655d9=squel['expr']();var _0x2e6668;if(_0x295124[_0xa6af('0x3c')][_0xa6af('0x59')]){_0x2e6668=as['parseSearch'](_0x295124['query'][_0xa6af('0x59')]);var _0x2ae81b=_0x2e6668['sqlOperator'];for(var _0x52f30a=0x0;_0x52f30a<_0x2e6668['conditions'][_0xa6af('0x5a')];_0x52f30a++){var _0x249ce9=_0x2e6668['conditions'][_0x52f30a];var _0x5cde39='i';var _0x418091=_[_0xa6af('0x5b')](_0x26d305,[_0xa6af('0x2c'),_0x249ce9[_0xa6af('0x48')]]);if(!_0x418091){switch(_0x249ce9[_0xa6af('0x48')]){case _0xa6af('0x5c'):if(_0x249ce9[_0xa6af('0x5d')]==0x1){_0x4d7e42[_0xa6af('0x5e')]('`'+_0x249ce9[_0xa6af('0x48')]+_0xa6af('0x5f'));}else{_0x4d7e42[_0xa6af('0x5e')]('`'+_0x249ce9[_0xa6af('0x48')]+_0xa6af('0x60'));}break;case _0xa6af('0x61'):if(_0x249ce9['operator']===_0xa6af('0x62')){if(_0x249ce9[_0xa6af('0x5d')]['split']('\x20')[_0xa6af('0x5a')]>0x1){_0x416a7b[_0x2ae81b](_0xa6af('0x63'),qs[_0xa6af('0x64')](_0x249ce9[_0xa6af('0x5d')]),null);}else{var _0x42bcd3='%'+_0x249ce9['value']+'%';_0x416a7b[_0x2ae81b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x42bcd3,_0x42bcd3,_0x42bcd3);}}else{_0x418091=_['find'](_0x26d305,[_0xa6af('0x2c'),_0xa6af('0x65')]);_0x249ce9['field']='ContactId';_0x47120d=as['buildExpression'](_0x5cde39,_0x418091[_0xa6af('0x39')],_0x249ce9);_0x416a7b[_0x2ae81b](_0x47120d[_0xa6af('0x66')],_0x47120d[_0xa6af('0x5d')]['start'],_0x47120d[_0xa6af('0x5d')][_0xa6af('0x29')]);}break;case'Tag':var _0x2a2409=_0x249ce9['value'][_0xa6af('0x33')](',')[_0xa6af('0x2f')](function(_0xc16a74){return Number(_0xc16a74);});_0x2a2409[_0xa6af('0x67')](function(_0x379236){_0xf655d9['or'](_0xa6af('0x68'),'%,'+_0x379236+',%');});_0x415448=_['union'](_0x415448,_0x2a2409);break;case _0xa6af('0x69'):if(_0x249ce9['operator']==='$substring'){_0x416a7b[_0x2ae81b](_0xa6af('0x6a'),'%'+_0x249ce9[_0xa6af('0x5d')]+'%',null);}else{_0x418091=_[_0xa6af('0x5b')](_0x26d305,['name',_0xa6af('0x6b')]);_0x249ce9[_0xa6af('0x48')]='UserId';_0x47120d=as[_0xa6af('0x6c')](_0x5cde39,_0x418091['type'],_0x249ce9);_0x416a7b[_0x2ae81b](_0x47120d[_0xa6af('0x66')],_0x47120d[_0xa6af('0x5d')][_0xa6af('0x6d')],_0x47120d[_0xa6af('0x5d')]['end']);}break;case'body':_0x47120d=as[_0xa6af('0x6c')]('me',null,_0x249ce9);_0x416a7b[_0x2ae81b](_0x47120d[_0xa6af('0x66')],_0x47120d['value'][_0xa6af('0x6d')],_0x47120d[_0xa6af('0x5d')][_0xa6af('0x29')]);break;}}else{var _0x47120d=as[_0xa6af('0x6c')](_0x5cde39,_0x418091[_0xa6af('0x39')],_0x249ce9);_0x416a7b[_0x2ae81b](_0x47120d['text'],_0x47120d[_0xa6af('0x5d')][_0xa6af('0x6d')],_0x47120d[_0xa6af('0x5d')][_0xa6af('0x29')]);}}}else{var _0x557282=_(_0x295124[_0xa6af('0x3c')])['keys']()[_0xa6af('0x2f')](function(_0x1ac99a){return _[_0xa6af('0x6e')](_0x26d305,[_0xa6af('0x2c'),_0x1ac99a])?_0x1ac99a:undefined;})['compact']()[_0xa6af('0x5d')]();if(!_[_0xa6af('0x6f')](_0x557282)){_0x557282[_0xa6af('0x67')](function(_0xc08ff5){if(_0xc08ff5===_0xa6af('0x70')){_0x4d7e42[_0xa6af('0x45')](_0xa6af('0x71'),[][_0xa6af('0x72')](_0x295124[_0xa6af('0x3c')][_0xc08ff5]));}else if(_0xc08ff5===_0xa6af('0x73')){var _0x31bcd4=JSON[_0xa6af('0x74')](_0x295124['query'][_0xc08ff5])[_0xa6af('0x75')];var _0x183c85=JSON[_0xa6af('0x74')](_0x295124[_0xa6af('0x3c')][_0xc08ff5])[_0xa6af('0x76')];_0x4d7e42[_0xa6af('0x45')](_0xa6af('0x77'),_0x31bcd4,_0x183c85);}else{if(_0x295124['query'][_0xc08ff5]===_0xa6af('0x78')){_0x4d7e42['where']('i.'+_0xc08ff5+_0xa6af('0x79'));}else{_0x4d7e42['where']('i.'+_0xc08ff5+_0xa6af('0x7a'),_0x295124['query'][_0xc08ff5]);}}});}if(_0x295124[_0xa6af('0x3c')][_0xa6af('0x7b')]){if(_0x295124['query'][_0xa6af('0x7b')]==0x1){_0x4d7e42[_0xa6af('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x4d7e42[_0xa6af('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x295124[_0xa6af('0x3c')][_0xa6af('0x7c')]){_0x415448=_['isArray'](_0x295124['query']['tag'])?_0x295124['query']['tag']:new Array(_0x295124[_0xa6af('0x3c')][_0xa6af('0x7c')]);_0x415448[_0xa6af('0x67')](function(_0xe28855){_0xf655d9['or'](_0xa6af('0x68'),'%,'+_0xe28855+',%');});}if(_0x295124['query'][_0xa6af('0x7d')]){var _0x2fb4ef=_0x295124[_0xa6af('0x3c')][_0xa6af('0x7d')][_0xa6af('0x7e')]('\x5c','\x5c\x5c')[_0xa6af('0x7e')](/'/g,'\x27\x27');if(qs[_0xa6af('0x7f')](_0x2fb4ef)){_0x416a7b['or'](_0xa6af('0x80'),_0x2fb4ef+'%')['or'](_0xa6af('0x81'),_0x2fb4ef+'%');}_0x416a7b['or'](_0xa6af('0x82'),_0x2fb4ef+'%');}}_0x4d7e42[_0xa6af('0x45')](_0x416a7b);_0x4d7e42['group'](_0xa6af('0x83'));var _0x1712b3={'type':db[_0xa6af('0x84')][_0xa6af('0x85')]['SELECT'],'raw':!![]};var _0x5ba409=_0x4d7e42[_0xa6af('0x86')]();_0x5ba409[_0xa6af('0x48')](_0xa6af('0x83'));_0x5ba409[_0xa6af('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa6af('0x5c'));if(_0x105313['order']){_0x105313[_0xa6af('0x43')][_0xa6af('0x67')](function(_0x171de7){var _0x5db2ac=_0x171de7[0x0]===_0xa6af('0x87')?_0x171de7[0x0]:'i.'+_0x171de7[0x0];_0x4d7e42[_0xa6af('0x43')](_0x5db2ac,_0x171de7[0x1]===_0xa6af('0x88')?![]:!![]);});}if(!_[_0xa6af('0x6f')](_0x415448)){_0x4d7e42[_0xa6af('0x5e')](_0xf655d9);_0x5ba409['where'](_0xa6af('0x89'),_0x415448);}BPromise[_0xa6af('0x8a')]()[_0xa6af('0x27')](function(){if(!_0x2e6668){if(_0x295124[_0xa6af('0x3c')][_0xa6af('0x70')])return;_0x5ba409[_0xa6af('0x45')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x4d7e42[_0xa6af('0x45')](_0xa6af('0x8b'));return;}if(_0x295124[_0xa6af('0x8c')][_0xa6af('0x8d')]!=='agent')return;return _0x295124['user'][_0xa6af('0x8e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x47c656){if(_[_0xa6af('0x6f')](_0x47c656)){_0x5ba409[_0xa6af('0x45')]('i.FaxAccountId\x20IS\x20NULL');_0x4d7e42[_0xa6af('0x45')](_0xa6af('0x8f'));}else{_0x5ba409[_0xa6af('0x45')](_0xa6af('0x71'),_[_0xa6af('0x2f')](_0x47c656,'id'));_0x4d7e42['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x47c656,'id'));}});})[_0xa6af('0x27')](function(){if(_0x295124['user'][_0xa6af('0x8d')]==='agent'&&!_0x2e6668&&!_0x295124[_0xa6af('0x3c')][_0xa6af('0x70')])return[];return db[_0xa6af('0x90')][_0xa6af('0x3c')](_0x5ba409[_0xa6af('0x91')](),_0x1712b3);})[_0xa6af('0x27')](function(_0x528a0d){_0x433256[_0xa6af('0x20')]=_0x528a0d[_0xa6af('0x5a')];if(_0x433256[_0xa6af('0x20')]===0x0)return[];return db[_0xa6af('0x90')][_0xa6af('0x3c')](_0x24b842[_0xa6af('0x91')](),_0x1712b3)[_0xa6af('0x27')](function(_0x3422d3){_0x295496=_[_0xa6af('0x92')](_0x3422d3,'id');_0x1712b3=_[_0xa6af('0x93')](_0x1712b3,{'model':db[_0xa6af('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x295124['query']['fields']){_0x105313['attributes'][_0xa6af('0x67')](function(_0x708abc){_0x4d7e42['field']('i.'+_0x708abc);});}else{_0x4d7e42[_0xa6af('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4d7e42['field'](_0xa6af('0x94'),_0xa6af('0x95'));_0x4d7e42[_0xa6af('0x48')](_0xa6af('0x96'),'Account.mandatoryDisposition');_0x4d7e42[_0xa6af('0x48')](_0xa6af('0x97'),'contactName');_0x4d7e42[_0xa6af('0x48')](_0xa6af('0x98'));_0x4d7e42['field'](_0xa6af('0x99'),_0xa6af('0x9a'));_0x4d7e42[_0xa6af('0x48')]('c.lastName','Contact.lastName');_0x4d7e42['field'](_0xa6af('0x9b'),_0xa6af('0x9c'));_0x4d7e42[_0xa6af('0x48')](_0xa6af('0x9d'),'Contact.phone');_0x4d7e42[_0xa6af('0x48')](_0xa6af('0x9e'),_0xa6af('0x9f'));_0x4d7e42[_0xa6af('0x48')](_0xa6af('0xa0'),_0xa6af('0xa1'));_0x4d7e42[_0xa6af('0x48')](_0xa6af('0xa2'),_0xa6af('0xa3'));_0x4d7e42['field'](_0xa6af('0xa4'),'Owner.internal');_0x4d7e42[_0xa6af('0x48')](_0xa6af('0xa5'),_0xa6af('0x32'));}if(_0x105313[_0xa6af('0x22')])_0x4d7e42[_0xa6af('0x22')](_0x105313[_0xa6af('0x22')]);if(_0x105313[_0xa6af('0x21')])_0x4d7e42['offset'](_0x105313[_0xa6af('0x21')]);return db[_0xa6af('0x90')][_0xa6af('0x3c')](_0x4d7e42[_0xa6af('0x91')](),_0x1712b3);})['then'](function(_0x2289a4){if(_0x2289a4[_0xa6af('0x5a')]>0x0)_0x53cc4f[_0xa6af('0x45')](_0xa6af('0xa6'),_[_0xa6af('0x2f')](_0x2289a4,'id'));return db['sequelize'][_0xa6af('0x3c')](_0x53cc4f[_0xa6af('0x91')](),_0x1712b3)[_0xa6af('0x27')](function(_0x22591a){var _0x4214a5=_['groupBy'](_0x22591a,_0xa6af('0xa7'));var _0x12664d=[];_0x2289a4['forEach'](function(_0x2f371d){_0x12664d[_0xa6af('0x34')](updateFaxInteraction(_0x2f371d,_0x295496,_0x4214a5));});return BPromise['all'](_0x12664d);});});})[_0xa6af('0x27')](function(_0x1b6c86){_0x433256[_0xa6af('0xa8')]=_0x1b6c86;return _0x433256;})[_0xa6af('0x27')](respondWithFilteredResult(_0x8f9f8e,_0x105313))[_0xa6af('0x35')](handleError(_0x8f9f8e,null));};exports[_0xa6af('0xa9')]=function(_0x1892af,_0x4309d9){var _0x13fecd={'raw':![],'where':{'id':_0x1892af[_0xa6af('0xaa')]['id']}},_0x34bf5d={};_0x34bf5d[_0xa6af('0x3b')]=_[_0xa6af('0xab')](db[_0xa6af('0x37')][_0xa6af('0xac')]);_0x34bf5d['query']=_[_0xa6af('0xab')](_0x1892af[_0xa6af('0x3c')]);_0x34bf5d[_0xa6af('0x3d')]=_[_0xa6af('0x3e')](_0x34bf5d[_0xa6af('0x3b')],_0x34bf5d[_0xa6af('0x3c')]);_0x13fecd[_0xa6af('0x3f')]=_['intersection'](_0x34bf5d[_0xa6af('0x3b')],qs[_0xa6af('0x40')](_0x1892af['query'][_0xa6af('0x40')]));_0x13fecd[_0xa6af('0x3f')]=_0x13fecd[_0xa6af('0x3f')][_0xa6af('0x5a')]?_0x13fecd[_0xa6af('0x3f')]:_0x34bf5d[_0xa6af('0x3b')];if(_0x1892af['query']['includeAll']){_0x13fecd[_0xa6af('0xad')]=[{'all':!![]}];}_0x13fecd=_[_0xa6af('0x93')]({},_0x13fecd,_0x1892af[_0xa6af('0xae')]);return db[_0xa6af('0x37')]['find'](_0x13fecd)['then'](handleEntityNotFound(_0x4309d9,null))['then'](respondWithResult(_0x4309d9,null))[_0xa6af('0x35')](handleError(_0x4309d9,null));};exports[_0xa6af('0xaf')]=function(_0x373045,_0x2d6630){return db['FaxInteraction'][_0xa6af('0xaf')](_0x373045['body'],{})['then'](respondWithResult(_0x2d6630,0xc9))[_0xa6af('0x35')](handleError(_0x2d6630,null));};exports['update']=function(_0x197dd2,_0x38a3a9){if(_0x197dd2[_0xa6af('0xb0')]['id']){delete _0x197dd2[_0xa6af('0xb0')]['id'];}return db[_0xa6af('0x37')][_0xa6af('0x5b')]({'where':{'id':_0x197dd2[_0xa6af('0xaa')]['id']}})['then'](handleEntityNotFound(_0x38a3a9,null))['then'](saveUpdates(_0x197dd2[_0xa6af('0xb0')],null))['then'](respondWithResult(_0x38a3a9,null))['catch'](handleError(_0x38a3a9,null));};exports[_0xa6af('0x28')]=function(_0x437b06,_0x283fed){return db['FaxInteraction']['find']({'where':{'id':_0x437b06[_0xa6af('0xaa')]['id']}})[_0xa6af('0x27')](handleEntityNotFound(_0x283fed,null))['then'](removeEntity(_0x283fed,null))['catch'](handleError(_0x283fed,null));};exports['describe']=function(_0x1b181d,_0xdef564){return db[_0xa6af('0x37')][_0xa6af('0xb1')]()[_0xa6af('0x27')](respondWithResult(_0xdef564,null))[_0xa6af('0x35')](handleError(_0xdef564,null));};exports['addMessage']=function(_0xb4cb31,_0x57ceda,_0x57f9d0){return db[_0xa6af('0xb2')][_0xa6af('0x5b')]({'where':{'id':_0xb4cb31['params']['id']}})[_0xa6af('0x27')](handleEntityNotFound(_0x57ceda,null))[_0xa6af('0x27')](function(_0x1b172b){if(_0x1b172b){return _0x1b172b['addMessage'](_0xb4cb31['body'][_0xa6af('0xb3')],_[_0xa6af('0xb4')](_0xb4cb31[_0xa6af('0xb0')],[_0xa6af('0xb3'),'id'])||{});}})[_0xa6af('0x27')](respondWithResult(_0x57ceda,null))['catch'](handleError(_0x57ceda,null));};exports[_0xa6af('0xb5')]=function(_0x588de3,_0x53c5de,_0x171344){var _0x4670ac={'raw':![],'where':{}};var _0x9958f6={};var _0x176151={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xa6af('0xb6')]({'where':{'id':_0x588de3[_0xa6af('0xaa')]['id']}})[_0xa6af('0x27')](handleEntityNotFound(_0x53c5de,null))[_0xa6af('0x27')](function(_0x2c39de){if(_0x2c39de){_0x9958f6[_0xa6af('0x3b')]=_[_0xa6af('0xab')](db[_0xa6af('0xb2')][_0xa6af('0xac')]);_0x9958f6[_0xa6af('0x3c')]=_['keys'](_0x588de3['query']);_0x9958f6[_0xa6af('0x3d')]=_['intersection'](_0x9958f6[_0xa6af('0x3b')],_0x9958f6[_0xa6af('0x3c')]);_0x4670ac['attributes']=_[_0xa6af('0x3e')](_0x9958f6[_0xa6af('0x3b')],qs[_0xa6af('0x40')](_0x588de3[_0xa6af('0x3c')][_0xa6af('0x40')]));_0x4670ac[_0xa6af('0x3f')]=_0x4670ac[_0xa6af('0x3f')][_0xa6af('0x5a')]?_0x4670ac['attributes']:_0x9958f6[_0xa6af('0x3b')];if(!_0x588de3[_0xa6af('0x3c')][_0xa6af('0x41')](_0xa6af('0x42'))){_0x4670ac[_0xa6af('0x22')]=qs[_0xa6af('0x22')](_0x588de3[_0xa6af('0x3c')]['limit']);_0x4670ac['offset']=qs[_0xa6af('0x21')](_0x588de3[_0xa6af('0x3c')][_0xa6af('0x21')]);}_0x4670ac[_0xa6af('0x43')]=qs[_0xa6af('0x44')](_0x588de3[_0xa6af('0x3c')]['sort']);_0x4670ac[_0xa6af('0x45')]=qs[_0xa6af('0x3d')](_['pick'](_0x588de3[_0xa6af('0x3c')],_0x9958f6[_0xa6af('0x3d')]));_0x4670ac['where'][_0xa6af('0xa7')]=_0x2c39de['id'];if(_0x588de3[_0xa6af('0x3c')][_0xa6af('0x7d')]){_0x4670ac['where']=_[_0xa6af('0x93')](_0x4670ac[_0xa6af('0x45')],{'$or':_[_0xa6af('0x2f')](_0x4670ac[_0xa6af('0x3f')],function(_0x2cfa70){var _0x367468={};_0x367468[_0x2cfa70]={'$like':'%'+_0x588de3['query']['filter']+'%'};return _0x367468;})});}if(_0x588de3[_0xa6af('0x3c')][_0xa6af('0x75')]){var _0x234e36=_0x588de3['query'][_0xa6af('0x75')]['split'](',');var _0x2457b6={};_0x2457b6[_0x234e36[0x0]]={'$gte':moment(_0x234e36[0x1])['format'](_0xa6af('0xb7'))};_0x4670ac[_0xa6af('0x45')]=_[_0xa6af('0x93')](_0x4670ac[_0xa6af('0x45')],_0x2457b6);}_0x4670ac=_['merge']({},_0x4670ac,_0x588de3[_0xa6af('0xae')]);return db[_0xa6af('0xb2')]['count']({'where':_0x4670ac[_0xa6af('0x45')]})[_0xa6af('0x27')](function(_0x1d8754){_0x176151['count']=_0x1d8754;if(_0x588de3[_0xa6af('0x3c')][_0xa6af('0xb8')]){_0x4670ac[_0xa6af('0xad')]=[{'all':!![]}];}return db['FaxMessage'][_0xa6af('0xb9')](_0x4670ac);})['then'](function(_0x1c7bb8){_0x176151[_0xa6af('0xa8')]=_0x1c7bb8;return _0x176151;});}})['then'](respondWithFilteredResult(_0x53c5de,_0x4670ac))[_0xa6af('0x35')](handleError(_0x53c5de,null));};exports[_0xa6af('0xba')]=function(_0x467236,_0x1c7aaf,_0x2b20a8){return db['FaxInteraction'][_0xa6af('0x5b')]({'where':{'id':_0x467236[_0xa6af('0xaa')]['id']}})[_0xa6af('0x27')](handleEntityNotFound(_0x1c7aaf,null))[_0xa6af('0x27')](function(_0x1af13a){if(_0x1af13a){return _0x1af13a[_0xa6af('0xbb')](_0x467236[_0xa6af('0xb0')][_0xa6af('0xb3')],_[_0xa6af('0xb4')](_0x467236[_0xa6af('0xb0')],[_0xa6af('0xb3'),'id'])||{})[_0xa6af('0xbc')](function(){return db[_0xa6af('0xbd')][_0xa6af('0xb9')]({'attributes':['id',_0xa6af('0x2c'),_0xa6af('0xbe')],'where':{'id':_0x467236[_0xa6af('0xb0')][_0xa6af('0xb3')]}});})[_0xa6af('0x27')](function(_0x1dd01e){socket[_0xa6af('0xbf')](_0xa6af('0xc0'),{'id':Number(_0x467236['params']['id']),'tags':_0x1dd01e||[]});return{'id':Number(_0x467236['params']['id']),'tags':_0x1dd01e||[]};});}})[_0xa6af('0x27')](respondWithResult(_0x1c7aaf,null))['catch'](handleError(_0x1c7aaf,null));};exports['removeTags']=function(_0x66a9d3,_0x325372,_0x1fad59){return db[_0xa6af('0x37')][_0xa6af('0x5b')]({'where':{'id':_0x66a9d3[_0xa6af('0xaa')]['id']}})[_0xa6af('0x27')](handleEntityNotFound(_0x325372,null))['then'](function(_0x5742ff){if(_0x5742ff){return _0x5742ff[_0xa6af('0xc1')](_0x66a9d3[_0xa6af('0x3c')][_0xa6af('0xb3')]);}})['then'](respondWithStatusCode(_0x325372,null))[_0xa6af('0x35')](handleError(_0x325372,null));};exports[_0xa6af('0xc2')]=function(_0x51d336,_0x531172){var _0x2c12b8=moment()[_0xa6af('0xc3')]()[_0xa6af('0x91')]();var _0x156274=path[_0xa6af('0xc4')](config[_0xa6af('0xc5')],_0xa6af('0xc6'),_0xa6af('0xc7'),_0xa6af('0xc8'));var _0x3734ae=path[_0xa6af('0xc4')](config[_0xa6af('0xc5')],'server',_0xa6af('0xc7'),_0xa6af('0xc9'));var _0x3a4a05=path[_0xa6af('0xc4')](_0x156274,_0x2c12b8);var _0x259674=util[_0xa6af('0xca')]('transcript-%d-%s.zip',_0x51d336[_0xa6af('0xaa')]['id'],_0x2c12b8);var _0x5cdc76=path[_0xa6af('0xc4')](_0x156274,_0x259674);var _0x117d95=[];_0x117d95[_0xa6af('0x34')]({'model':db[_0xa6af('0xcb')],'as':_0xa6af('0xcb'),'raw':!![]});var _0x298c71=[{'model':db[_0xa6af('0xb2')],'as':_0xa6af('0xcc'),'attributes':['id','body',_0xa6af('0x73')],'include':_0x117d95}];return db[_0xa6af('0x37')][_0xa6af('0x5b')]({'where':{'id':_0x51d336['params']['id']},'include':_0x298c71})['then'](handleEntityNotFound(_0x531172,null))['then'](function(_0x6f9a74){if(_0x6f9a74&&_0x6f9a74[_0xa6af('0xcc')]){var _0x318923=_0x6f9a74['get']({'plain':!![]});fs[_0xa6af('0xcd')](_0x3a4a05);for(var _0x7f6572=0x0;_0x7f6572<_0x318923[_0xa6af('0xcc')][_0xa6af('0x5a')];_0x7f6572++){var _0x56b1f3=_0x318923[_0xa6af('0xcc')][_0x7f6572][_0xa6af('0xcb')];if(_0x56b1f3){var _0x5d2198=path[_0xa6af('0xc4')](_0x3734ae,_0x56b1f3['basename']);if(fs[_0xa6af('0xce')](_0x5d2198)){fs[_0xa6af('0xcf')](_0x5d2198)['pipe'](fs['createWriteStream'](path[_0xa6af('0xc4')](_0x3a4a05,_0x56b1f3[_0xa6af('0xd0')])));}}}return BPromise[_0xa6af('0x8a')]()[_0xa6af('0x27')](function(){return new BPromise(function(_0x53a544,_0x1d696c){zipdir(_0x3a4a05,{'saveTo':_0x5cdc76},function(_0x1ba562,_0xf080fa){if(_0x1ba562)return _0x1d696c(_0x1ba562);return _0x53a544(_0xf080fa);});})[_0xa6af('0x27')](function(){return new BPromise(function(_0x1fa9ec,_0x55981d){rimraf(_0x3a4a05,function(_0xb5a94){if(_0xb5a94)_0x55981d(_0xb5a94);return _0x1fa9ec();});});})[_0xa6af('0x27')](function(){return _0x531172[_0xa6af('0xc2')](_0x5cdc76,_0x259674,function(_0x34b38c){if(_0x34b38c){console[_0xa6af('0xd1')](_0xa6af('0xd2'),_0x34b38c);}else{fs['unlinkSync'](_0x5cdc76);}});});});}else{return _0x531172[_0xa6af('0x1c')](0xc8);}})[_0xa6af('0x35')](handleError(_0x531172,null));}; \ No newline at end of file +var _0xde42=['getMessages','findOne','FaxMessage','pick','format','options','setTags','spread','findAll','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','createdAt','get','Messages','basename','existsSync','createReadStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','UserId','keys','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','params','includeAll','include','create','body','describe','addMessage','ids','omit'];(function(_0x238b61,_0xb94d00){var _0x519752=function(_0x19a3a1){while(--_0x19a3a1){_0x238b61['push'](_0x238b61['shift']());}};_0x519752(++_0xb94d00);}(_0xde42,0x1c7));var _0x2de4=function(_0x527fd7,_0x15af06){_0x527fd7=_0x527fd7-0x0;var _0x3ca79b=_0xde42[_0x527fd7];return _0x3ca79b;};'use strict';var emlformat=require(_0x2de4('0x0'));var rimraf=require(_0x2de4('0x1'));var zipdir=require(_0x2de4('0x2'));var jsonpatch=require(_0x2de4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2de4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2de4('0x5'));var ejs=require(_0x2de4('0x6'));var fs=require('fs');var fs_extra=require(_0x2de4('0x7'));var _=require(_0x2de4('0x8'));var squel=require(_0x2de4('0x9'));var crypto=require(_0x2de4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2de4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2de4('0xc'));var Papa=require(_0x2de4('0xd'));var Redis=require(_0x2de4('0xe'));var authService=require(_0x2de4('0xf'));var qs=require(_0x2de4('0x10'));var as=require(_0x2de4('0x11'));var hardwareService=require(_0x2de4('0x12'));var logger=require('../../config/logger')(_0x2de4('0x13'));var utils=require(_0x2de4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2de4('0x15')](config[_0x2de4('0x16')],{'host':_0x2de4('0x17'),'port':0x18eb});var socket=require(_0x2de4('0x18'))(new Redis(config[_0x2de4('0x16')]));require(_0x2de4('0x19'))[_0x2de4('0x1a')](socket);function respondWithStatusCode(_0x4d2bcf,_0x266fce){_0x266fce=_0x266fce||0xcc;return function(_0x30b212){if(_0x30b212){return _0x4d2bcf[_0x2de4('0x1b')](_0x266fce);}return _0x4d2bcf[_0x2de4('0x1c')](_0x266fce)[_0x2de4('0x1d')]();};}function respondWithResult(_0x426afb,_0x511d47){_0x511d47=_0x511d47||0xc8;return function(_0x3fa349){if(_0x3fa349){return _0x426afb['status'](_0x511d47)[_0x2de4('0x1e')](_0x3fa349);}};}function respondWithFilteredResult(_0x1a0c15,_0x152f33){return function(_0x3be0e2){if(_0x3be0e2){var _0x5664c0=typeof _0x152f33[_0x2de4('0x1f')]===_0x2de4('0x20')&&typeof _0x152f33[_0x2de4('0x21')]===_0x2de4('0x20');var _0x3b1c84=_0x3be0e2[_0x2de4('0x22')];var _0x214155=_0x5664c0?0x0:_0x152f33['offset'];var _0x5d093d=_0x5664c0?_0x3be0e2['count']:_0x152f33[_0x2de4('0x1f')]+_0x152f33['limit'];var _0x2990bb;if(_0x5d093d>=_0x3b1c84){_0x5d093d=_0x3b1c84;_0x2990bb=0xc8;}else{_0x2990bb=0xce;}_0x1a0c15[_0x2de4('0x1c')](_0x2990bb);return _0x1a0c15[_0x2de4('0x23')](_0x2de4('0x24'),_0x214155+'-'+_0x5d093d+'/'+_0x3b1c84)[_0x2de4('0x1e')](_0x3be0e2);}return null;};}function patchUpdates(_0x4bf5f3){return function(_0x544732){try{jsonpatch[_0x2de4('0x25')](_0x544732,_0x4bf5f3,!![]);}catch(_0x3916ab){return BPromise['reject'](_0x3916ab);}return _0x544732[_0x2de4('0x26')]();};}function saveUpdates(_0x570e78,_0x198def){return function(_0x5c9b97){if(_0x5c9b97){return _0x5c9b97[_0x2de4('0x27')](_0x570e78)[_0x2de4('0x28')](function(_0x524c66){return _0x524c66;});}return null;};}function removeEntity(_0x4853a3,_0x277442){return function(_0x373ec7){if(_0x373ec7){return _0x373ec7[_0x2de4('0x29')]()[_0x2de4('0x28')](function(){_0x4853a3['status'](0xcc)[_0x2de4('0x1d')]();});}};}function handleEntityNotFound(_0x5d23ef,_0x18acbe){return function(_0x21148e){if(!_0x21148e){_0x5d23ef['sendStatus'](0x194);}return _0x21148e;};}function handleError(_0x39abf5,_0x5336f8){_0x5336f8=_0x5336f8||0x1f4;return function(_0x294475){logger['error'](_0x294475[_0x2de4('0x2a')]);if(_0x294475[_0x2de4('0x2b')]){delete _0x294475[_0x2de4('0x2b')];}_0x39abf5[_0x2de4('0x1c')](_0x5336f8)[_0x2de4('0x2c')](_0x294475);};}function getInteractionUsers(_0x19d416,_0x3c53da){return new BPromise(function(_0x17191e,_0x589bce){try{if(_0x3c53da[_0x19d416['id']]){_0x19d416[_0x2de4('0x2d')]=_[_0x2de4('0x2e')](_0x3c53da[_0x19d416['id']],function(_0x26755e){return{'id':_0x26755e['id'],'fullname':_0x26755e[_0x2de4('0x2f')]};});}}catch(_0x33e5b3){_0x589bce(_0x33e5b3);}_0x17191e(_0x19d416);});}function getInteractionTags(_0x24325d,_0x36005f){return new BPromise(function(_0x5e78e7,_0xa183f6){try{if(_0x24325d[_0x2de4('0x30')]){_0x24325d[_0x2de4('0x31')]=[];_0x24325d['TagIds']['split'](',')[_0x2de4('0x32')](function(_0x2eb8c1){_0x24325d[_0x2de4('0x31')][_0x2de4('0x33')](_0x36005f[_0x2eb8c1]);});}delete _0x24325d[_0x2de4('0x30')];}catch(_0x175b7b){_0xa183f6(_0x175b7b);}_0x5e78e7(_0x24325d);});}function updateFaxInteraction(_0x34ee06,_0x125429,_0x503a3e){return new BPromise(function(_0x235661,_0x554ef2){return getInteractionUsers(_0x34ee06,_0x503a3e)[_0x2de4('0x28')](function(_0x99ccfe){return getInteractionTags(_0x99ccfe,_0x125429);})[_0x2de4('0x28')](function(_0x296e91){_0x235661(_0x296e91);})[_0x2de4('0x34')](function(_0x5b3cd6){_0x554ef2(_0x5b3cd6);});});}exports[_0x2de4('0x35')]=function(_0x40d299,_0x433b3b){var _0x36f8fa={},_0x2480c3={},_0x46b784={'count':0x0,'rows':[]};var _0xa6dcbb=_[_0x2de4('0x2e')](db[_0x2de4('0x36')][_0x2de4('0x37')],function(_0x4697fc){return{'name':_0x4697fc[_0x2de4('0x38')],'type':_0x4697fc[_0x2de4('0x39')]['key']};});_0x2480c3['model']=_[_0x2de4('0x2e')](_0xa6dcbb,_0x2de4('0x2b'));_0x2480c3[_0x2de4('0x3a')]=_['keys'](_0x40d299[_0x2de4('0x3a')]);_0x2480c3[_0x2de4('0x3b')]=_[_0x2de4('0x3c')](_0x2480c3['model'],_0x2480c3[_0x2de4('0x3a')]);_0x36f8fa['attributes']=_[_0x2de4('0x3c')](_0x2480c3[_0x2de4('0x3d')],qs[_0x2de4('0x3e')](_0x40d299[_0x2de4('0x3a')]['fields']));_0x36f8fa[_0x2de4('0x3f')]=_0x36f8fa[_0x2de4('0x3f')][_0x2de4('0x40')]?_0x36f8fa[_0x2de4('0x3f')]:_0x2480c3[_0x2de4('0x3d')];if(!_0x40d299[_0x2de4('0x3a')][_0x2de4('0x41')](_0x2de4('0x42'))){_0x36f8fa[_0x2de4('0x21')]=qs[_0x2de4('0x21')](_0x40d299['query'][_0x2de4('0x21')]);_0x36f8fa['offset']=qs[_0x2de4('0x1f')](_0x40d299[_0x2de4('0x3a')][_0x2de4('0x1f')]);}_0x36f8fa['order']=qs['sort'](_0x40d299[_0x2de4('0x3a')][_0x2de4('0x43')]);_0x36f8fa[_0x2de4('0x44')]=qs[_0x2de4('0x3b')](_['pick'](_0x40d299[_0x2de4('0x3a')],_0x2480c3[_0x2de4('0x3b')]),_0xa6dcbb);var _0x1ab139=[];var _0x37cb38=squel['select']()[_0x2de4('0x45')]('id')['field'](_0x2de4('0x2b'))[_0x2de4('0x45')](_0x2de4('0x46'))[_0x2de4('0x47')](_0x2de4('0x48'));var _0x459808=squel['select']()[_0x2de4('0x45')](_0x2de4('0x49'))[_0x2de4('0x45')](_0x2de4('0x4a'))[_0x2de4('0x45')](_0x2de4('0x4b'))[_0x2de4('0x47')](_0x2de4('0x4c'),'ui')[_0x2de4('0x4d')](_0x2de4('0x4e'),'u',_0x2de4('0x4f'));var _0x53f546=squel[_0x2de4('0x50')]()[_0x2de4('0x47')](_0x2de4('0x51'),'i')[_0x2de4('0x4d')]('cm_contacts','c',_0x2de4('0x52'))[_0x2de4('0x4d')](_0x2de4('0x4e'),'o',_0x2de4('0x53'))[_0x2de4('0x4d')]('fax_accounts','a',_0x2de4('0x54'))[_0x2de4('0x4d')](_0x2de4('0x55'),'me',_0x2de4('0x56'))[_0x2de4('0x4d')](_0x2de4('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x2de4('0x4d')]('tools_tags','t',_0x2de4('0x58'));var _0x4242ae=squel[_0x2de4('0x59')]();var _0x1d6aca=[];var _0x3c61f8=squel[_0x2de4('0x59')]();var _0x4690fb;if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x5a')]){_0x4690fb=as[_0x2de4('0x5b')](_0x40d299[_0x2de4('0x3a')][_0x2de4('0x5a')]);var _0x226f13=_0x4690fb['sqlOperator'];for(var _0xa11249=0x0;_0xa11249<_0x4690fb['conditions']['length'];_0xa11249++){var _0x308be5=_0x4690fb[_0x2de4('0x5c')][_0xa11249];var _0x1c58ea='i';var _0x42a290=_[_0x2de4('0x5d')](_0xa6dcbb,['name',_0x308be5[_0x2de4('0x45')]]);if(!_0x42a290){switch(_0x308be5[_0x2de4('0x45')]){case _0x2de4('0x5e'):if(_0x308be5[_0x2de4('0x5f')]==0x1){_0x53f546[_0x2de4('0x60')]('`'+_0x308be5[_0x2de4('0x45')]+_0x2de4('0x61'));}else{_0x53f546[_0x2de4('0x60')]('`'+_0x308be5['field']+'`\x20>\x200');}break;case _0x2de4('0x62'):if(_0x308be5[_0x2de4('0x63')]===_0x2de4('0x64')){if(_0x308be5['value']['split']('\x20')['length']>0x1){_0x4242ae[_0x226f13](_0x2de4('0x65'),qs['getFullTextValue'](_0x308be5[_0x2de4('0x5f')]),null);}else{var _0x513d4e='%'+_0x308be5[_0x2de4('0x5f')]+'%';_0x4242ae[_0x226f13](_0x2de4('0x66'),_0x513d4e,_0x513d4e,_0x513d4e);}}else{_0x42a290=_['find'](_0xa6dcbb,[_0x2de4('0x2b'),_0x2de4('0x67')]);_0x308be5[_0x2de4('0x45')]=_0x2de4('0x67');_0x37d72d=as[_0x2de4('0x68')](_0x1c58ea,_0x42a290[_0x2de4('0x39')],_0x308be5);_0x4242ae[_0x226f13](_0x37d72d[_0x2de4('0x69')],_0x37d72d['value'][_0x2de4('0x6a')],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x1d')]);}break;case _0x2de4('0x6b'):var _0x16ebb0=_0x308be5[_0x2de4('0x5f')][_0x2de4('0x6c')](',')[_0x2de4('0x2e')](function(_0x464aa4){return Number(_0x464aa4);});_0x16ebb0[_0x2de4('0x32')](function(_0x523a46){_0x3c61f8['or'](_0x2de4('0x6d'),'%,'+_0x523a46+',%');});_0x1d6aca=_[_0x2de4('0x6e')](_0x1d6aca,_0x16ebb0);break;case _0x2de4('0x6f'):if(_0x308be5['operator']===_0x2de4('0x64')){_0x4242ae[_0x226f13]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x308be5[_0x2de4('0x5f')]+'%',null);}else{_0x42a290=_[_0x2de4('0x5d')](_0xa6dcbb,[_0x2de4('0x2b'),'UserId']);_0x308be5[_0x2de4('0x45')]=_0x2de4('0x70');_0x37d72d=as[_0x2de4('0x68')](_0x1c58ea,_0x42a290[_0x2de4('0x39')],_0x308be5);_0x4242ae[_0x226f13](_0x37d72d['text'],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x6a')],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x1d')]);}break;case'body':_0x37d72d=as[_0x2de4('0x68')]('me',null,_0x308be5);_0x4242ae[_0x226f13](_0x37d72d[_0x2de4('0x69')],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x6a')],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x1d')]);break;}}else{var _0x37d72d=as[_0x2de4('0x68')](_0x1c58ea,_0x42a290[_0x2de4('0x39')],_0x308be5);_0x4242ae[_0x226f13](_0x37d72d['text'],_0x37d72d[_0x2de4('0x5f')]['start'],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x1d')]);}}}else{var _0x51e44e=_(_0x40d299['query'])[_0x2de4('0x71')]()[_0x2de4('0x2e')](function(_0x1d03dd){return _[_0x2de4('0x72')](_0xa6dcbb,[_0x2de4('0x2b'),_0x1d03dd])?_0x1d03dd:undefined;})[_0x2de4('0x73')]()[_0x2de4('0x5f')]();if(!_['isEmpty'](_0x51e44e)){_0x51e44e['forEach'](function(_0x25651c){if(_0x25651c===_0x2de4('0x74')){_0x53f546[_0x2de4('0x44')](_0x2de4('0x75'),[][_0x2de4('0x76')](_0x40d299[_0x2de4('0x3a')][_0x25651c]));}else if(_0x25651c==='createdAt'){var _0x1584f6=JSON[_0x2de4('0x77')](_0x40d299['query'][_0x25651c])[_0x2de4('0x78')];var _0x56e66e=JSON[_0x2de4('0x77')](_0x40d299[_0x2de4('0x3a')][_0x25651c])['$lte'];_0x53f546[_0x2de4('0x44')](_0x2de4('0x79'),_0x1584f6,_0x56e66e);}else{if(_0x40d299[_0x2de4('0x3a')][_0x25651c]===_0x2de4('0x7a')){_0x53f546[_0x2de4('0x44')]('i.'+_0x25651c+_0x2de4('0x7b'));}else{_0x53f546['where']('i.'+_0x25651c+_0x2de4('0x7c'),_0x40d299[_0x2de4('0x3a')][_0x25651c]);}}});}if(_0x40d299[_0x2de4('0x3a')]['read']){if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x7d')]==0x1){_0x53f546[_0x2de4('0x60')]('`unreadMessages`\x20=\x200');}else{_0x53f546['having'](_0x2de4('0x7e'));}}if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x7f')]){_0x1d6aca=_[_0x2de4('0x80')](_0x40d299[_0x2de4('0x3a')][_0x2de4('0x7f')])?_0x40d299[_0x2de4('0x3a')][_0x2de4('0x7f')]:new Array(_0x40d299[_0x2de4('0x3a')]['tag']);_0x1d6aca['forEach'](function(_0x17a282){_0x3c61f8['or'](_0x2de4('0x6d'),'%,'+_0x17a282+',%');});}if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x81')]){var _0x11f901=_0x40d299[_0x2de4('0x3a')][_0x2de4('0x81')][_0x2de4('0x82')]('\x5c','\x5c\x5c')[_0x2de4('0x82')](/'/g,'\x27\x27');if(qs[_0x2de4('0x83')](_0x11f901)){_0x4242ae['or']('i.id\x20LIKE\x20?',_0x11f901+'%')['or']('i.fax\x20LIKE\x20?',_0x11f901+'%');}_0x4242ae['or'](_0x2de4('0x84'),_0x11f901+'%');}}_0x53f546[_0x2de4('0x44')](_0x4242ae);_0x53f546[_0x2de4('0x85')]('i.id');var _0x2d569f={'type':db['Sequelize'][_0x2de4('0x86')][_0x2de4('0x87')],'raw':!![]};var _0x50e991=_0x53f546[_0x2de4('0x88')]();_0x50e991[_0x2de4('0x45')](_0x2de4('0x89'));_0x50e991[_0x2de4('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x36f8fa[_0x2de4('0x8a')]){_0x36f8fa['order'][_0x2de4('0x32')](function(_0x28ed0a){var _0xac4525=_0x28ed0a[0x0]===_0x2de4('0x8b')?_0x28ed0a[0x0]:'i.'+_0x28ed0a[0x0];_0x53f546[_0x2de4('0x8a')](_0xac4525,_0x28ed0a[0x1]===_0x2de4('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x1d6aca)){_0x53f546[_0x2de4('0x60')](_0x3c61f8);_0x50e991['where'](_0x2de4('0x8d'),_0x1d6aca);}BPromise[_0x2de4('0x8e')]()[_0x2de4('0x28')](function(){if(!_0x4690fb){if(_0x40d299['query'][_0x2de4('0x74')])return;_0x50e991[_0x2de4('0x44')](_0x2de4('0x8f'));_0x53f546[_0x2de4('0x44')](_0x2de4('0x8f'));return;}if(_0x40d299[_0x2de4('0x90')]['role']!==_0x2de4('0x91'))return;return _0x40d299[_0x2de4('0x90')][_0x2de4('0x92')]({'attributes':['id'],'raw':!![]})[_0x2de4('0x28')](function(_0x13d63a){if(_[_0x2de4('0x93')](_0x13d63a)){_0x50e991[_0x2de4('0x44')](_0x2de4('0x94'));_0x53f546[_0x2de4('0x44')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x50e991['where'](_0x2de4('0x75'),_['map'](_0x13d63a,'id'));_0x53f546[_0x2de4('0x44')](_0x2de4('0x75'),_[_0x2de4('0x2e')](_0x13d63a,'id'));}});})[_0x2de4('0x28')](function(){if(_0x40d299[_0x2de4('0x90')][_0x2de4('0x95')]==='agent'&&!_0x4690fb&&!_0x40d299[_0x2de4('0x3a')][_0x2de4('0x74')])return[];return db[_0x2de4('0x96')][_0x2de4('0x3a')](_0x50e991[_0x2de4('0x97')](),_0x2d569f);})[_0x2de4('0x28')](function(_0x7473e2){_0x46b784[_0x2de4('0x22')]=_0x7473e2[_0x2de4('0x40')];if(_0x46b784[_0x2de4('0x22')]===0x0)return[];return db[_0x2de4('0x96')][_0x2de4('0x3a')](_0x37cb38[_0x2de4('0x97')](),_0x2d569f)['then'](function(_0x59ca85){_0x1ab139=_[_0x2de4('0x98')](_0x59ca85,'id');_0x2d569f=_[_0x2de4('0x99')](_0x2d569f,{'model':db[_0x2de4('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x3e')]){_0x36f8fa[_0x2de4('0x3f')]['forEach'](function(_0x2006f9){_0x53f546['field']('i.'+_0x2006f9);});}else{_0x53f546['field'](_0x2de4('0x9a'),_0x2de4('0x5e'));_0x53f546[_0x2de4('0x45')](_0x2de4('0x9b'),_0x2de4('0x9c'));_0x53f546[_0x2de4('0x45')]('a.mandatoryDisposition',_0x2de4('0x9d'));_0x53f546[_0x2de4('0x45')]('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',_0x2de4('0x8b'));_0x53f546[_0x2de4('0x45')]('i.*');_0x53f546[_0x2de4('0x45')](_0x2de4('0x9e'),_0x2de4('0x9f'));_0x53f546[_0x2de4('0x45')](_0x2de4('0xa0'),_0x2de4('0xa1'));_0x53f546[_0x2de4('0x45')]('c.email',_0x2de4('0xa2'));_0x53f546[_0x2de4('0x45')](_0x2de4('0xa3'),_0x2de4('0xa4'));_0x53f546['field'](_0x2de4('0xa5'),_0x2de4('0xa6'));_0x53f546[_0x2de4('0x45')](_0x2de4('0xa7'),_0x2de4('0xa8'));_0x53f546['field']('o.fullname','Owner.fullname');_0x53f546[_0x2de4('0x45')]('o.internal','Owner.internal');_0x53f546[_0x2de4('0x45')](_0x2de4('0xa9'),_0x2de4('0x30'));}if(_0x36f8fa[_0x2de4('0x21')])_0x53f546[_0x2de4('0x21')](_0x36f8fa[_0x2de4('0x21')]);if(_0x36f8fa['offset'])_0x53f546['offset'](_0x36f8fa['offset']);return db[_0x2de4('0x96')][_0x2de4('0x3a')](_0x53f546[_0x2de4('0x97')](),_0x2d569f);})[_0x2de4('0x28')](function(_0x1fa698){if(_0x1fa698[_0x2de4('0x40')]>0x0)_0x459808[_0x2de4('0x44')](_0x2de4('0xaa'),_['map'](_0x1fa698,'id'));return db[_0x2de4('0x96')]['query'](_0x459808['toString'](),_0x2d569f)[_0x2de4('0x28')](function(_0x48cf9f){var _0x3a4b68=_[_0x2de4('0xab')](_0x48cf9f,_0x2de4('0xac'));var _0x40165f=[];_0x1fa698['forEach'](function(_0x34db49){_0x40165f[_0x2de4('0x33')](updateFaxInteraction(_0x34db49,_0x1ab139,_0x3a4b68));});return BPromise[_0x2de4('0xad')](_0x40165f);});});})[_0x2de4('0x28')](function(_0x15016b){_0x46b784[_0x2de4('0xae')]=_0x15016b;return _0x46b784;})['then'](respondWithFilteredResult(_0x433b3b,_0x36f8fa))[_0x2de4('0x34')](handleError(_0x433b3b,null));};exports['show']=function(_0x35bf4f,_0x57a531){var _0x57a96b={'raw':![],'where':{'id':_0x35bf4f[_0x2de4('0xaf')]['id']}},_0x215493={};_0x215493[_0x2de4('0x3d')]=_[_0x2de4('0x71')](db[_0x2de4('0x36')]['rawAttributes']);_0x215493[_0x2de4('0x3a')]=_['keys'](_0x35bf4f[_0x2de4('0x3a')]);_0x215493[_0x2de4('0x3b')]=_[_0x2de4('0x3c')](_0x215493[_0x2de4('0x3d')],_0x215493[_0x2de4('0x3a')]);_0x57a96b[_0x2de4('0x3f')]=_[_0x2de4('0x3c')](_0x215493['model'],qs[_0x2de4('0x3e')](_0x35bf4f[_0x2de4('0x3a')][_0x2de4('0x3e')]));_0x57a96b[_0x2de4('0x3f')]=_0x57a96b[_0x2de4('0x3f')][_0x2de4('0x40')]?_0x57a96b['attributes']:_0x215493[_0x2de4('0x3d')];if(_0x35bf4f['query'][_0x2de4('0xb0')]){_0x57a96b[_0x2de4('0xb1')]=[{'all':!![]}];}_0x57a96b=_['merge']({},_0x57a96b,_0x35bf4f['options']);return db[_0x2de4('0x36')][_0x2de4('0x5d')](_0x57a96b)[_0x2de4('0x28')](handleEntityNotFound(_0x57a531,null))[_0x2de4('0x28')](respondWithResult(_0x57a531,null))[_0x2de4('0x34')](handleError(_0x57a531,null));};exports['create']=function(_0x357964,_0x5d3623){return db[_0x2de4('0x36')][_0x2de4('0xb2')](_0x357964[_0x2de4('0xb3')],{})[_0x2de4('0x28')](respondWithResult(_0x5d3623,0xc9))[_0x2de4('0x34')](handleError(_0x5d3623,null));};exports[_0x2de4('0x27')]=function(_0x5aba00,_0x33277f){if(_0x5aba00[_0x2de4('0xb3')]['id']){delete _0x5aba00['body']['id'];}return db[_0x2de4('0x36')][_0x2de4('0x5d')]({'where':{'id':_0x5aba00['params']['id']}})[_0x2de4('0x28')](handleEntityNotFound(_0x33277f,null))[_0x2de4('0x28')](saveUpdates(_0x5aba00['body'],null))[_0x2de4('0x28')](respondWithResult(_0x33277f,null))[_0x2de4('0x34')](handleError(_0x33277f,null));};exports[_0x2de4('0x29')]=function(_0x2725bd,_0xf150d8){return db['FaxInteraction'][_0x2de4('0x5d')]({'where':{'id':_0x2725bd[_0x2de4('0xaf')]['id']}})[_0x2de4('0x28')](handleEntityNotFound(_0xf150d8,null))['then'](removeEntity(_0xf150d8,null))[_0x2de4('0x34')](handleError(_0xf150d8,null));};exports[_0x2de4('0xb4')]=function(_0x19d2d3,_0x20411c){return db[_0x2de4('0x36')]['describe']()[_0x2de4('0x28')](respondWithResult(_0x20411c,null))[_0x2de4('0x34')](handleError(_0x20411c,null));};exports[_0x2de4('0xb5')]=function(_0x1088fc,_0x571b71,_0x3338df){return db['FaxMessage']['find']({'where':{'id':_0x1088fc['params']['id']}})['then'](handleEntityNotFound(_0x571b71,null))[_0x2de4('0x28')](function(_0x133f00){if(_0x133f00){return _0x133f00[_0x2de4('0xb5')](_0x1088fc['body'][_0x2de4('0xb6')],_[_0x2de4('0xb7')](_0x1088fc['body'],[_0x2de4('0xb6'),'id'])||{});}})[_0x2de4('0x28')](respondWithResult(_0x571b71,null))[_0x2de4('0x34')](handleError(_0x571b71,null));};exports[_0x2de4('0xb8')]=function(_0x431ed2,_0x3e81d8,_0x2f3819){var _0x2b5250={'raw':![],'where':{}};var _0x5099b4={};var _0x4b61a3={'count':0x0,'rows':[]};return db[_0x2de4('0x36')][_0x2de4('0xb9')]({'where':{'id':_0x431ed2['params']['id']}})[_0x2de4('0x28')](handleEntityNotFound(_0x3e81d8,null))[_0x2de4('0x28')](function(_0x168151){if(_0x168151){_0x5099b4['model']=_[_0x2de4('0x71')](db[_0x2de4('0xba')][_0x2de4('0x37')]);_0x5099b4[_0x2de4('0x3a')]=_['keys'](_0x431ed2['query']);_0x5099b4[_0x2de4('0x3b')]=_['intersection'](_0x5099b4[_0x2de4('0x3d')],_0x5099b4['query']);_0x2b5250[_0x2de4('0x3f')]=_[_0x2de4('0x3c')](_0x5099b4[_0x2de4('0x3d')],qs['fields'](_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x3e')]));_0x2b5250[_0x2de4('0x3f')]=_0x2b5250['attributes'][_0x2de4('0x40')]?_0x2b5250[_0x2de4('0x3f')]:_0x5099b4['model'];if(!_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x41')](_0x2de4('0x42'))){_0x2b5250[_0x2de4('0x21')]=qs['limit'](_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x21')]);_0x2b5250[_0x2de4('0x1f')]=qs[_0x2de4('0x1f')](_0x431ed2['query']['offset']);}_0x2b5250[_0x2de4('0x8a')]=qs['sort'](_0x431ed2['query'][_0x2de4('0x43')]);_0x2b5250[_0x2de4('0x44')]=qs[_0x2de4('0x3b')](_[_0x2de4('0xbb')](_0x431ed2['query'],_0x5099b4[_0x2de4('0x3b')]));_0x2b5250['where']['FaxInteractionId']=_0x168151['id'];if(_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x81')]){_0x2b5250[_0x2de4('0x44')]=_[_0x2de4('0x99')](_0x2b5250[_0x2de4('0x44')],{'$or':_[_0x2de4('0x2e')](_0x2b5250[_0x2de4('0x3f')],function(_0xe743e7){var _0x49f8b7={};_0x49f8b7[_0xe743e7]={'$like':'%'+_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x81')]+'%'};return _0x49f8b7;})});}if(_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x78')]){var _0x50007e=_0x431ed2['query'][_0x2de4('0x78')][_0x2de4('0x6c')](',');var _0x453523={};_0x453523[_0x50007e[0x0]]={'$gte':moment(_0x50007e[0x1])[_0x2de4('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2b5250[_0x2de4('0x44')]=_[_0x2de4('0x99')](_0x2b5250[_0x2de4('0x44')],_0x453523);}_0x2b5250=_[_0x2de4('0x99')]({},_0x2b5250,_0x431ed2[_0x2de4('0xbd')]);return db[_0x2de4('0xba')][_0x2de4('0x22')]({'where':_0x2b5250[_0x2de4('0x44')]})[_0x2de4('0x28')](function(_0x4a726d){_0x4b61a3['count']=_0x4a726d;if(_0x431ed2[_0x2de4('0x3a')][_0x2de4('0xb0')]){_0x2b5250[_0x2de4('0xb1')]=[{'all':!![]}];}return db[_0x2de4('0xba')]['findAll'](_0x2b5250);})[_0x2de4('0x28')](function(_0x378975){_0x4b61a3[_0x2de4('0xae')]=_0x378975;return _0x4b61a3;});}})[_0x2de4('0x28')](respondWithFilteredResult(_0x3e81d8,_0x2b5250))[_0x2de4('0x34')](handleError(_0x3e81d8,null));};exports['addTags']=function(_0x3bc7fa,_0x18380b,_0x57b76c){return db[_0x2de4('0x36')][_0x2de4('0x5d')]({'where':{'id':_0x3bc7fa[_0x2de4('0xaf')]['id']}})[_0x2de4('0x28')](handleEntityNotFound(_0x18380b,null))[_0x2de4('0x28')](function(_0x431d0d){if(_0x431d0d){return _0x431d0d[_0x2de4('0xbe')](_0x3bc7fa[_0x2de4('0xb3')][_0x2de4('0xb6')],_[_0x2de4('0xb7')](_0x3bc7fa[_0x2de4('0xb3')],[_0x2de4('0xb6'),'id'])||{})[_0x2de4('0xbf')](function(){return db[_0x2de4('0x6b')][_0x2de4('0xc0')]({'attributes':['id','name',_0x2de4('0x46')],'where':{'id':_0x3bc7fa[_0x2de4('0xb3')][_0x2de4('0xb6')]}});})['then'](function(_0x289f20){socket['emit'](_0x2de4('0xc1'),{'id':Number(_0x3bc7fa['params']['id']),'tags':_0x289f20||[]});return{'id':Number(_0x3bc7fa[_0x2de4('0xaf')]['id']),'tags':_0x289f20||[]};});}})[_0x2de4('0x28')](respondWithResult(_0x18380b,null))['catch'](handleError(_0x18380b,null));};exports[_0x2de4('0xc2')]=function(_0x3f7654,_0x51b9fe,_0x50fe8a){return db[_0x2de4('0x36')][_0x2de4('0x5d')]({'where':{'id':_0x3f7654[_0x2de4('0xaf')]['id']}})['then'](handleEntityNotFound(_0x51b9fe,null))['then'](function(_0x34838d){if(_0x34838d){return _0x34838d[_0x2de4('0xc2')](_0x3f7654['query']['ids']);}})[_0x2de4('0x28')](respondWithStatusCode(_0x51b9fe,null))[_0x2de4('0x34')](handleError(_0x51b9fe,null));};exports[_0x2de4('0xc3')]=function(_0x35e8f0,_0x2e85c5){var _0x41de4c=moment()['unix']()['toString']();var _0x539ebf=path[_0x2de4('0xc4')](config[_0x2de4('0xc5')],_0x2de4('0xc6'),_0x2de4('0xc7'),_0x2de4('0xc8'));var _0x16560b=path['join'](config[_0x2de4('0xc5')],_0x2de4('0xc6'),_0x2de4('0xc7'),_0x2de4('0xc9'));var _0x21e8f0=path[_0x2de4('0xc4')](_0x539ebf,_0x41de4c);var _0xc7f95b=util[_0x2de4('0xbc')](_0x2de4('0xca'),_0x35e8f0[_0x2de4('0xaf')]['id'],_0x41de4c);var _0x1e21c9=path[_0x2de4('0xc4')](_0x539ebf,_0xc7f95b);var _0x445d6b=[];_0x445d6b[_0x2de4('0x33')]({'model':db[_0x2de4('0xcb')],'as':_0x2de4('0xcb'),'raw':!![]});var _0x539d23=[{'model':db[_0x2de4('0xba')],'as':'Messages','attributes':['id','body',_0x2de4('0xcc')],'include':_0x445d6b}];return db[_0x2de4('0x36')][_0x2de4('0x5d')]({'where':{'id':_0x35e8f0[_0x2de4('0xaf')]['id']},'include':_0x539d23})['then'](handleEntityNotFound(_0x2e85c5,null))[_0x2de4('0x28')](function(_0x16300a){if(_0x16300a&&_0x16300a['Messages']){var _0x103dc1=_0x16300a[_0x2de4('0xcd')]({'plain':!![]});fs['mkdirSync'](_0x21e8f0);for(var _0x4a48ad=0x0;_0x4a48ad<_0x103dc1[_0x2de4('0xce')][_0x2de4('0x40')];_0x4a48ad++){var _0x19b20b=_0x103dc1[_0x2de4('0xce')][_0x4a48ad][_0x2de4('0xcb')];if(_0x19b20b){var _0xe8eed3=path['join'](_0x16560b,_0x19b20b[_0x2de4('0xcf')]);if(fs[_0x2de4('0xd0')](_0xe8eed3)){fs[_0x2de4('0xd1')](_0xe8eed3)['pipe'](fs['createWriteStream'](path['join'](_0x21e8f0,_0x19b20b[_0x2de4('0xcf')])));}}}return BPromise[_0x2de4('0x8e')]()[_0x2de4('0x28')](function(){return new BPromise(function(_0x3cd357,_0x2e2e07){zipdir(_0x21e8f0,{'saveTo':_0x1e21c9},function(_0x5d608e,_0x20bbe0){if(_0x5d608e)return _0x2e2e07(_0x5d608e);return _0x3cd357(_0x20bbe0);});})[_0x2de4('0x28')](function(){return new BPromise(function(_0x5921a8,_0x15b18a){rimraf(_0x21e8f0,function(_0x1c892f){if(_0x1c892f)_0x15b18a(_0x1c892f);return _0x5921a8();});});})[_0x2de4('0x28')](function(){return _0x2e85c5['download'](_0x1e21c9,_0xc7f95b,function(_0x1779f7){if(_0x1779f7){console[_0x2de4('0xd2')](_0x2de4('0xd3'),_0x1779f7);}else{fs[_0x2de4('0xd4')](_0x1e21c9);}});});});}else{return _0x2e85c5[_0x2de4('0x1b')](0xc8);}})[_0x2de4('0x34')](handleError(_0x2e85c5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 34ae7df..babc8d5 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 _0x5f70=['FaxMessage','save','update','remove','then','setDataValue','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x48f5b9,_0x174e61){var _0x2161aa=function(_0x555e7b){while(--_0x555e7b){_0x48f5b9['push'](_0x48f5b9['shift']());}};_0x2161aa(++_0x174e61);}(_0x5f70,0x1ed));var _0x05f7=function(_0x20c6cd,_0x5ac47a){_0x20c6cd=_0x20c6cd-0x0;var _0x4c4fd8=_0x5f70[_0x20c6cd];return _0x4c4fd8;};'use strict';var EventEmitter=require(_0x05f7('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0x05f7('0x1'))['db'][_0x05f7('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05f7('0x3'),'afterUpdate':_0x05f7('0x4'),'afterDestroy':_0x05f7('0x5')};function emitEvent(_0x32efb0){return function(_0x38d48b,_0xb82eae,_0xc125ab){_0x38d48b['getUsers']({'attributes':['id'],'raw':!![]})[_0x05f7('0x6')](function(_0x1b5046){_0x38d48b[_0x05f7('0x7')]('Users',_0x1b5046[_0x05f7('0x8')](function(_0x14400b){return{'id':_0x14400b['id']};}));return FaxMessage[_0x05f7('0x9')]({'where':{'FaxInteractionId':_0x38d48b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4918f5){_0x38d48b[_0x05f7('0x7')]('unreadMessages',_0x4918f5[_0x05f7('0xa')]);FaxInteractionEvents['emit'](_0x32efb0+':'+_0x38d48b['id'],_0x38d48b);FaxInteractionEvents[_0x05f7('0xb')](_0x32efb0,_0x38d48b);_0xc125ab(null);})[_0x05f7('0xc')](_0xc125ab(null));};}for(var e in events){if(events[_0x05f7('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x05f7('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x3768=['FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then','Users','setDataValue','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x3768,0xb2));var _0x8376=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0x3768[_0x404957];return _0x4e0365;};'use strict';var EventEmitter=require(_0x8376('0x0'));var FaxInteraction=require(_0x8376('0x1'))['db'][_0x8376('0x2')];var FaxMessage=require(_0x8376('0x1'))['db'][_0x8376('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8376('0x4')](0x0);var events={'afterCreate':_0x8376('0x5'),'afterUpdate':_0x8376('0x6'),'afterDestroy':'remove'};function emitEvent(_0xada9cc){return function(_0x578f45,_0x325bf1,_0x50c9a9){_0x578f45[_0x8376('0x7')]({'attributes':['id'],'raw':!![]})[_0x8376('0x8')](function(_0x23f973){_0x578f45['setDataValue'](_0x8376('0x9'),_0x23f973['map'](function(_0xdc35cb){return{'id':_0xdc35cb['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x578f45['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8376('0x8')](function(_0x154130){_0x578f45[_0x8376('0xa')]('unreadMessages',_0x154130['length']);FaxInteractionEvents['emit'](_0xada9cc+':'+_0x578f45['id'],_0x578f45);FaxInteractionEvents['emit'](_0xada9cc,_0x578f45);_0x50c9a9(null);})[_0x8376('0xb')](_0x50c9a9(null));};}for(var e in events){if(events[_0x8376('0xc')](e)){var event=events[e];FaxInteraction[_0x8376('0xd')](e,emitEvent(event));}}module[_0x8376('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 5671aff..7eee55b 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 _0x635b=['util','../../config/logger','api','moment','bluebird','rimraf','./faxInteraction.attributes','fax_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5498d4,_0x386162){var _0x12b7f7=function(_0x5d9c16){while(--_0x5d9c16){_0x5498d4['push'](_0x5498d4['shift']());}};_0x12b7f7(++_0x386162);}(_0x635b,0xdc));var _0xb635=function(_0x417b9e,_0x2bdcff){_0x417b9e=_0x417b9e-0x0;var _0x449719=_0x635b[_0x417b9e];return _0x449719;};'use strict';var _=require('lodash');var util=require(_0xb635('0x0'));var logger=require(_0xb635('0x1'))(_0xb635('0x2'));var moment=require(_0xb635('0x3'));var BPromise=require(_0xb635('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb635('0x5'));var config=require('../../config/environment');var attributes=require(_0xb635('0x6'));module['exports']=function(_0x52379a,_0x1b045d){return _0x52379a['define']('FaxInteraction',attributes,{'tableName':_0xb635('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x345153,_0x2313a8,_0x6c87a0){if(_0x345153[_0xb635('0x8')](_0xb635('0x9'))){_0x345153['closedAt']=moment()['format'](_0xb635('0xa'));}_0x6c87a0(null,_0x345153);}}});}; \ No newline at end of file +var _0xc15b=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','closed','closedAt','lodash','moment','bluebird'];(function(_0x3709cd,_0x4a3d2a){var _0x320fd7=function(_0xc4ae65){while(--_0xc4ae65){_0x3709cd['push'](_0x3709cd['shift']());}};_0x320fd7(++_0x4a3d2a);}(_0xc15b,0x159));var _0xbc15=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xc15b[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbc15('0x1'));var BPromise=require(_0xbc15('0x2'));var rp=require(_0xbc15('0x3'));var fs=require('fs');var path=require(_0xbc15('0x4'));var rimraf=require(_0xbc15('0x5'));var config=require(_0xbc15('0x6'));var attributes=require(_0xbc15('0x7'));module[_0xbc15('0x8')]=function(_0x437c7e,_0x4b0b70){return _0x437c7e[_0xbc15('0x9')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1490d4,_0x1ca450,_0x40db8b){if(_0x1490d4['changed'](_0xbc15('0xa'))){_0x1490d4[_0xbc15('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x40db8b(null,_0x1490d4);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2e85600..fd4580c 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 _0xc470=['UpdateFaxInteraction','FaxInteraction','body','options','raw','where','limit','AddTagsToFaxInteraction','find','ids','spread','stringify','AddTags','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x5cc9d5,_0x4edc95){var _0x2a7696=function(_0x2cc3f9){while(--_0x2cc3f9){_0x5cc9d5['push'](_0x5cc9d5['shift']());}};_0x2a7696(++_0x4edc95);}(_0xc470,0x7f));var _0x0c47=function(_0x5c86f8,_0x584d10){_0x5c86f8=_0x5c86f8-0x0;var _0x161119=_0xc470[_0x5c86f8];return _0x161119;};'use strict';var _=require(_0x0c47('0x0'));var util=require(_0x0c47('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c47('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c47('0x3'))(_0x0c47('0x4'));var config=require(_0x0c47('0x5'));var jayson=require(_0x0c47('0x6'));var client=jayson[_0x0c47('0x7')][_0x0c47('0x8')]({'port':0x232a});config['redis']=_[_0x0c47('0x9')](config['redis'],{'host':_0x0c47('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c47('0xb')]));require(_0x0c47('0xc'))[_0x0c47('0xd')](socket);function respondWithRpcPromise(_0x3db6d4,_0x2d9741,_0x2ae583){return new BPromise(function(_0x28e8b4,_0x258eff){return client[_0x0c47('0xe')](_0x3db6d4,_0x2ae583)[_0x0c47('0xf')](function(_0x30cbbd){logger[_0x0c47('0x10')](_0x0c47('0x11'),_0x2d9741,'request\x20sent');logger[_0x0c47('0x12')](_0x0c47('0x13'),_0x2d9741,_0x0c47('0x14'),JSON['stringify'](_0x30cbbd));if(_0x30cbbd[_0x0c47('0x15')]){if(_0x30cbbd[_0x0c47('0x15')][_0x0c47('0x16')]===0x1f4){logger[_0x0c47('0x15')](_0x0c47('0x11'),_0x2d9741,_0x30cbbd['error']['message']);return _0x258eff(_0x30cbbd[_0x0c47('0x15')][_0x0c47('0x17')]);}logger[_0x0c47('0x15')](_0x0c47('0x11'),_0x2d9741,_0x30cbbd['error'][_0x0c47('0x17')]);return _0x28e8b4(_0x30cbbd[_0x0c47('0x15')]['message']);}else{logger[_0x0c47('0x10')](_0x0c47('0x11'),_0x2d9741,_0x0c47('0x14'));_0x28e8b4(_0x30cbbd['result'][_0x0c47('0x17')]);}})[_0x0c47('0x18')](function(_0x2e5131){logger[_0x0c47('0x15')](_0x0c47('0x11'),_0x2d9741,_0x2e5131);_0x258eff(_0x2e5131);});});}exports[_0x0c47('0x19')]=function(_0xb6a361){var _0x3dba46=this;return new Promise(function(_0x44c866,_0x54eea0){return db[_0x0c47('0x1a')]['update'](_0xb6a361[_0x0c47('0x1b')],{'raw':_0xb6a361['options']?_0xb6a361[_0x0c47('0x1c')][_0x0c47('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb6a361[_0x0c47('0x1c')]?_0xb6a361[_0x0c47('0x1c')][_0x0c47('0x1e')]||null:null,'attributes':_0xb6a361[_0x0c47('0x1c')]?_0xb6a361[_0x0c47('0x1c')]['attributes']||null:null,'limit':_0xb6a361['options']?_0xb6a361[_0x0c47('0x1c')][_0x0c47('0x1f')]||null:null})[_0x0c47('0xf')](function(_0xac2d34){logger[_0x0c47('0x10')](_0x0c47('0x19'),_0xb6a361);logger[_0x0c47('0x12')](_0x0c47('0x19'),_0xb6a361,JSON['stringify'](_0xac2d34));_0x44c866(_0xac2d34);})[_0x0c47('0x18')](function(_0x16aba3){logger[_0x0c47('0x15')](_0x0c47('0x19'),_0x16aba3['message'],_0xb6a361);_0x54eea0(_0x3dba46[_0x0c47('0x15')](0x1f4,_0x16aba3[_0x0c47('0x17')]));});});};exports[_0x0c47('0x20')]=function(_0x127a6a){return new Promise(function(_0x5f0e54,_0x364244){return db[_0x0c47('0x1a')][_0x0c47('0x21')]({'where':_0x127a6a[_0x0c47('0x1c')]?_0x127a6a[_0x0c47('0x1c')][_0x0c47('0x1e')]||null:null})[_0x0c47('0xf')](function(_0x374cf8){if(_0x374cf8){return _0x374cf8['addTags'](_0x127a6a[_0x0c47('0x1b')]['ids'],_['omit'](_0x127a6a[_0x0c47('0x1b')],[_0x0c47('0x22'),'id'])||{});}})[_0x0c47('0x23')](function(_0x7efe59){logger[_0x0c47('0x10')]('AddTags',_0x127a6a);logger[_0x0c47('0x12')]('AddTags',_0x127a6a,JSON[_0x0c47('0x24')](_0x7efe59));_0x5f0e54(_0x7efe59);})[_0x0c47('0x18')](function(_0x50a813){logger[_0x0c47('0x15')](_0x0c47('0x25'),_0x50a813[_0x0c47('0x17')],_0x127a6a);_0x364244(_this[_0x0c47('0x15')](0x1f4,_0x50a813['message']));});});}; \ No newline at end of file +var _0x0b94=['limit','info','UpdateFaxInteraction','stringify','catch','AddTagsToFaxInteraction','find','where','addTags','ids','spread','AddTags','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','FaxInteraction','body','options','raw','attributes'];(function(_0x476f24,_0xf60f9d){var _0x4e216e=function(_0x21e4f7){while(--_0x21e4f7){_0x476f24['push'](_0x476f24['shift']());}};_0x4e216e(++_0xf60f9d);}(_0x0b94,0xa0));var _0x40b9=function(_0x370436,_0x2df1c5){_0x370436=_0x370436-0x0;var _0x299602=_0x0b94[_0x370436];return _0x299602;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x40b9('0x0'));var rs=require(_0x40b9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40b9('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x40b9('0x3'))(_0x40b9('0x4'));var config=require(_0x40b9('0x5'));var jayson=require(_0x40b9('0x6'));var client=jayson[_0x40b9('0x7')]['http']({'port':0x232a});config['redis']=_[_0x40b9('0x8')](config[_0x40b9('0x9')],{'host':_0x40b9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40b9('0x9')]));require(_0x40b9('0xb'))['register'](socket);function respondWithRpcPromise(_0x303bae,_0x17d2e6,_0x15b9e9){return new BPromise(function(_0x14ccc5,_0xa8f476){return client[_0x40b9('0xc')](_0x303bae,_0x15b9e9)[_0x40b9('0xd')](function(_0xea251a){logger['info'](_0x40b9('0xe'),_0x17d2e6,'request\x20sent');logger[_0x40b9('0xf')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x17d2e6,_0x40b9('0x10'),JSON['stringify'](_0xea251a));if(_0xea251a[_0x40b9('0x11')]){if(_0xea251a[_0x40b9('0x11')]['code']===0x1f4){logger[_0x40b9('0x11')](_0x40b9('0xe'),_0x17d2e6,_0xea251a[_0x40b9('0x11')][_0x40b9('0x12')]);return _0xa8f476(_0xea251a[_0x40b9('0x11')][_0x40b9('0x12')]);}logger[_0x40b9('0x11')](_0x40b9('0xe'),_0x17d2e6,_0xea251a[_0x40b9('0x11')][_0x40b9('0x12')]);return _0x14ccc5(_0xea251a[_0x40b9('0x11')][_0x40b9('0x12')]);}else{logger['info'](_0x40b9('0xe'),_0x17d2e6,'request\x20sent');_0x14ccc5(_0xea251a[_0x40b9('0x13')][_0x40b9('0x12')]);}})['catch'](function(_0x5982c3){logger['error'](_0x40b9('0xe'),_0x17d2e6,_0x5982c3);_0xa8f476(_0x5982c3);});});}exports['UpdateFaxInteraction']=function(_0xe01cf9){var _0x4cd7b7=this;return new Promise(function(_0x3f0598,_0x4c3990){return db[_0x40b9('0x14')]['update'](_0xe01cf9[_0x40b9('0x15')],{'raw':_0xe01cf9[_0x40b9('0x16')]?_0xe01cf9['options'][_0x40b9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe01cf9[_0x40b9('0x16')]?_0xe01cf9['options']['where']||null:null,'attributes':_0xe01cf9[_0x40b9('0x16')]?_0xe01cf9['options'][_0x40b9('0x18')]||null:null,'limit':_0xe01cf9[_0x40b9('0x16')]?_0xe01cf9[_0x40b9('0x16')][_0x40b9('0x19')]||null:null})[_0x40b9('0xd')](function(_0x480b22){logger[_0x40b9('0x1a')](_0x40b9('0x1b'),_0xe01cf9);logger[_0x40b9('0xf')](_0x40b9('0x1b'),_0xe01cf9,JSON[_0x40b9('0x1c')](_0x480b22));_0x3f0598(_0x480b22);})[_0x40b9('0x1d')](function(_0x299921){logger[_0x40b9('0x11')](_0x40b9('0x1b'),_0x299921[_0x40b9('0x12')],_0xe01cf9);_0x4c3990(_0x4cd7b7['error'](0x1f4,_0x299921[_0x40b9('0x12')]));});});};exports[_0x40b9('0x1e')]=function(_0x480349){return new Promise(function(_0x4e2142,_0x157402){return db[_0x40b9('0x14')][_0x40b9('0x1f')]({'where':_0x480349[_0x40b9('0x16')]?_0x480349[_0x40b9('0x16')][_0x40b9('0x20')]||null:null})[_0x40b9('0xd')](function(_0x527a95){if(_0x527a95){return _0x527a95[_0x40b9('0x21')](_0x480349[_0x40b9('0x15')][_0x40b9('0x22')],_['omit'](_0x480349[_0x40b9('0x15')],['ids','id'])||{});}})[_0x40b9('0x23')](function(_0x14a30e){logger['info']('AddTags',_0x480349);logger[_0x40b9('0xf')](_0x40b9('0x24'),_0x480349,JSON[_0x40b9('0x1c')](_0x14a30e));_0x4e2142(_0x14a30e);})[_0x40b9('0x1d')](function(_0x3e916f){logger[_0x40b9('0x11')](_0x40b9('0x24'),_0x3e916f[_0x40b9('0x12')],_0x480349);_0x157402(_this[_0x40b9('0x11')](0x1f4,_0x3e916f[_0x40b9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2b140b8..7f0e392 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 _0x3ba2=['length','faxInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x40d5a0,_0x4f01db){var _0x1dcda4=function(_0x5049b6){while(--_0x5049b6){_0x40d5a0['push'](_0x40d5a0['shift']());}};_0x1dcda4(++_0x4f01db);}(_0x3ba2,0x192));var _0x23ba=function(_0x1f4d01,_0x51a86c){_0x1f4d01=_0x1f4d01-0x0;var _0xe31fa0=_0x3ba2[_0x1f4d01];return _0xe31fa0;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x23ba('0x0'),_0x23ba('0x1'),_0x23ba('0x2')];function createListener(_0x1468a1,_0x6499ce){return function(_0x3506f9){_0x6499ce[_0x23ba('0x3')](_0x1468a1,_0x3506f9);};}function removeListener(_0x18f00a,_0x553ad8){return function(){FaxInteractionEvents[_0x23ba('0x4')](_0x18f00a,_0x553ad8);};}exports[_0x23ba('0x5')]=function(_0x54c8d0){for(var _0x3e7bde=0x0,_0x11f23e=events[_0x23ba('0x6')];_0x3e7bde<_0x11f23e;_0x3e7bde++){var _0x26ceb9=events[_0x3e7bde];var _0x4a7a57=createListener(_0x23ba('0x7')+_0x26ceb9,_0x54c8d0);FaxInteractionEvents['on'](_0x26ceb9,_0x4a7a57);}}; \ No newline at end of file +var _0xef6a=['faxInteraction:','./faxInteraction.events','emit','removeListener','register','length'];(function(_0x3c9acc,_0x5482b5){var _0x55b5b9=function(_0x2965d0){while(--_0x2965d0){_0x3c9acc['push'](_0x3c9acc['shift']());}};_0x55b5b9(++_0x5482b5);}(_0xef6a,0xbb));var _0xaef6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xef6a[_0x53ccf2];return _0x5a2964;};'use strict';var FaxInteractionEvents=require(_0xaef6('0x0'));var events=['save','remove','update'];function createListener(_0x19e2c6,_0x38a1be){return function(_0x14a067){_0x38a1be[_0xaef6('0x1')](_0x19e2c6,_0x14a067);};}function removeListener(_0x28ab96,_0x47ab68){return function(){FaxInteractionEvents[_0xaef6('0x2')](_0x28ab96,_0x47ab68);};}exports[_0xaef6('0x3')]=function(_0x1b7528){for(var _0x241ab2=0x0,_0xa1dcc=events[_0xaef6('0x4')];_0x241ab2<_0xa1dcc;_0x241ab2++){var _0x2f821a=events[_0x241ab2];var _0x36569a=createListener(_0xaef6('0x5')+_0x2f821a,_0x1b7528);FaxInteractionEvents['on'](_0x2f821a,_0x36569a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index df5ec23..a3a453e 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 _0xebbd=['destroy','delete','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','update'];(function(_0x13778a,_0x208106){var _0x118d66=function(_0x20d415){while(--_0x20d415){_0x13778a['push'](_0x13778a['shift']());}};_0x118d66(++_0x208106);}(_0xebbd,0x196));var _0xdebb=function(_0x4cf9dc,_0x44d771){_0x4cf9dc=_0x4cf9dc-0x0;var _0x26fe05=_0xebbd[_0x4cf9dc];return _0x26fe05;};'use strict';var multer=require('multer');var util=require(_0xdebb('0x0'));var path=require(_0xdebb('0x1'));var timeout=require(_0xdebb('0x2'));var express=require(_0xdebb('0x3'));var router=express[_0xdebb('0x4')]();var fs_extra=require(_0xdebb('0x5'));var auth=require(_0xdebb('0x6'));var interaction=require(_0xdebb('0x7'));var config=require(_0xdebb('0x8'));var controller=require(_0xdebb('0x9'));router[_0xdebb('0xa')]('/',auth[_0xdebb('0xb')](),controller[_0xdebb('0xc')]);router[_0xdebb('0xa')](_0xdebb('0xd'),auth[_0xdebb('0xb')](),controller[_0xdebb('0xe')]);router[_0xdebb('0xa')](_0xdebb('0xf'),auth[_0xdebb('0xb')](),controller[_0xdebb('0x10')]);router['get'](_0xdebb('0x11'),auth[_0xdebb('0xb')](),controller['getMessages']);router[_0xdebb('0xa')](_0xdebb('0x12'),auth[_0xdebb('0xb')](),controller['download']);router[_0xdebb('0x13')]('/',auth['isAuthenticated'](),controller[_0xdebb('0x14')]);router['post'](_0xdebb('0x11'),auth[_0xdebb('0xb')](),controller['addMessage']);router[_0xdebb('0x13')](_0xdebb('0x15'),auth['isAuthenticated'](),interaction[_0xdebb('0x16')](_0xdebb('0x17'),'faxinteraction:addtags'),controller[_0xdebb('0x18')]);router[_0xdebb('0x19')]('/:id',auth[_0xdebb('0xb')](),interaction['tracked'](_0xdebb('0x17'),_0xdebb('0x1a')),controller[_0xdebb('0x1b')]);router['delete']('/:id',auth[_0xdebb('0xb')](),interaction[_0xdebb('0x16')](_0xdebb('0x17'),'faxinteraction:destroy'),controller[_0xdebb('0x1c')]);router[_0xdebb('0x1d')](_0xdebb('0x15'),auth[_0xdebb('0xb')](),controller[_0xdebb('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x8811=['/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','put','/:id','fax','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','show'];(function(_0x4bab23,_0x252745){var _0xc1776e=function(_0x59c760){while(--_0x59c760){_0x4bab23['push'](_0x4bab23['shift']());}};_0xc1776e(++_0x252745);}(_0x8811,0x73));var _0x1881=function(_0x563104,_0x351039){_0x563104=_0x563104-0x0;var _0x5638cd=_0x8811[_0x563104];return _0x5638cd;};'use strict';var multer=require(_0x1881('0x0'));var util=require(_0x1881('0x1'));var path=require(_0x1881('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1881('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1881('0x4'));var interaction=require(_0x1881('0x5'));var config=require(_0x1881('0x6'));var controller=require(_0x1881('0x7'));router['get']('/',auth[_0x1881('0x8')](),controller[_0x1881('0x9')]);router[_0x1881('0xa')](_0x1881('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x1881('0xa')]('/:id',auth[_0x1881('0x8')](),controller[_0x1881('0xc')]);router[_0x1881('0xa')](_0x1881('0xd'),auth[_0x1881('0x8')](),controller[_0x1881('0xe')]);router[_0x1881('0xa')](_0x1881('0xf'),auth[_0x1881('0x8')](),controller[_0x1881('0x10')]);router['post']('/',auth[_0x1881('0x8')](),controller[_0x1881('0x11')]);router[_0x1881('0x12')](_0x1881('0xd'),auth[_0x1881('0x8')](),controller[_0x1881('0x13')]);router[_0x1881('0x12')](_0x1881('0x14'),auth[_0x1881('0x8')](),interaction[_0x1881('0x15')]('fax',_0x1881('0x16')),controller['addTags']);router[_0x1881('0x17')](_0x1881('0x18'),auth[_0x1881('0x8')](),interaction[_0x1881('0x15')](_0x1881('0x19'),'faxinteraction:update'),controller[_0x1881('0x1a')]);router[_0x1881('0x1b')]('/:id',auth[_0x1881('0x8')](),interaction[_0x1881('0x15')](_0x1881('0x19'),_0x1881('0x1c')),controller[_0x1881('0x1d')]);router[_0x1881('0x1b')](_0x1881('0x14'),auth[_0x1881('0x8')](),controller[_0x1881('0x1e')]);module[_0x1881('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 559205a..589c258 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 _0x0eaa=['BOOLEAN','ENUM','out','TEXT','DATE','sequelize','exports'];(function(_0x1a029c,_0x37d8dd){var _0x3daf0b=function(_0x45a0c7){while(--_0x45a0c7){_0x1a029c['push'](_0x1a029c['shift']());}};_0x3daf0b(++_0x37d8dd);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x41a769,_0x9ced54){_0x41a769=_0x41a769-0x0;var _0x2e4c3e=_0x0eaa[_0x41a769];return _0x2e4c3e;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module[_0xa0ea('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa0ea('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa0ea('0x3')]('in','out'),'defaultValue':_0xa0ea('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa0ea('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa0ea('0x6')]}}; \ No newline at end of file +var _0xd52a=['medium','BOOLEAN','ENUM','out','TEXT','DATE','exports'];(function(_0x518b4f,_0x22ae83){var _0x4d454d=function(_0x437a14){while(--_0x437a14){_0x518b4f['push'](_0x518b4f['shift']());}};_0x4d454d(++_0x22ae83);}(_0xd52a,0xca));var _0xad52=function(_0xc4b8cb,_0x5da66f){_0xc4b8cb=_0xc4b8cb-0x0;var _0x3a37c1=_0xd52a[_0xc4b8cb];return _0x3a37c1;};'use strict';var Sequelize=require('sequelize');module[_0xad52('0x0')]={'body':{'type':Sequelize['TEXT'](_0xad52('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xad52('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xad52('0x3')]('in','out'),'defaultValue':_0xad52('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xad52('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xad52('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 008fd8f..52a5a9a 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 _0x2f7f=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','includeAll','include','find','body','describe','fax-interactions','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE: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','QueryTypes','fullname','internal','manual','SIP/%s','channel','event','accept','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','SELECT','contact','User','email','interface','rejectmessage','CmContact','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x565b00,_0x244a4c){var _0x1e9835=function(_0x5aa21e){while(--_0x5aa21e){_0x565b00['push'](_0x565b00['shift']());}};_0x1e9835(++_0x244a4c);}(_0x2f7f,0x83));var _0xf2f7=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x2f7f[_0x34843e];return _0x598f7f;};'use strict';var emlformat=require(_0xf2f7('0x0'));var rimraf=require(_0xf2f7('0x1'));var zipdir=require(_0xf2f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2f7('0x3'));var moment=require(_0xf2f7('0x4'));var BPromise=require(_0xf2f7('0x5'));var Mustache=require('mustache');var util=require(_0xf2f7('0x6'));var path=require(_0xf2f7('0x7'));var sox=require(_0xf2f7('0x8'));var csv=require(_0xf2f7('0x9'));var ejs=require(_0xf2f7('0xa'));var fs=require('fs');var fs_extra=require(_0xf2f7('0xb'));var _=require(_0xf2f7('0xc'));var squel=require(_0xf2f7('0xd'));var crypto=require('crypto');var jsforce=require(_0xf2f7('0xe'));var deskjs=require(_0xf2f7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf2f7('0x10'));var Redis=require(_0xf2f7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf2f7('0x12'));var as=require(_0xf2f7('0x13'));var hardwareService=require(_0xf2f7('0x14'));var logger=require(_0xf2f7('0x15'))('api');var utils=require(_0xf2f7('0x16'));var config=require(_0xf2f7('0x17'));var licenseUtil=require(_0xf2f7('0x18'));var db=require(_0xf2f7('0x19'))['db'];config[_0xf2f7('0x1a')]=_['defaults'](config[_0xf2f7('0x1a')],{'host':_0xf2f7('0x1b'),'port':0x18eb});var socket=require(_0xf2f7('0x1c'))(new Redis(config['redis']));require(_0xf2f7('0x1d'))[_0xf2f7('0x1e')](socket);var jayson=require(_0xf2f7('0x1f'));var client=jayson[_0xf2f7('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xf2f7('0x20')][_0xf2f7('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x59550c,_0xd58d9a,_0x2e7e9d,_0x2fcdc8){return new BPromise(function(_0x44dd66,_0x5432f5){var _0x5b2fd4=_0x2fcdc8||client;return _0x5b2fd4[_0xf2f7('0x22')](_0x59550c,_0x2e7e9d)['then'](function(_0x285fef){logger[_0xf2f7('0x23')]('FaxMessage,\x20%s,\x20%s',_0xd58d9a,_0xf2f7('0x24'));logger[_0xf2f7('0x25')](_0xf2f7('0x26'),_0xd58d9a,_0xf2f7('0x24'),JSON[_0xf2f7('0x27')](_0x285fef));if(_0x285fef[_0xf2f7('0x28')]){if(_0x285fef['error'][_0xf2f7('0x29')]===0x1f4){logger[_0xf2f7('0x28')](_0xf2f7('0x2a'),_0xd58d9a,_0x285fef[_0xf2f7('0x28')][_0xf2f7('0x2b')]);return _0x5432f5(_0x285fef[_0xf2f7('0x28')][_0xf2f7('0x2b')]);}logger[_0xf2f7('0x28')](_0xf2f7('0x2a'),_0xd58d9a,_0x285fef[_0xf2f7('0x28')]['message']);return _0x44dd66(_0x285fef[_0xf2f7('0x28')][_0xf2f7('0x2b')]);}else{logger['info'](_0xf2f7('0x2a'),_0xd58d9a,_0xf2f7('0x24'));_0x44dd66(_0x285fef[_0xf2f7('0x2c')][_0xf2f7('0x2b')]);}})['catch'](function(_0x200bf2){logger['error'](_0xf2f7('0x2a'),_0xd58d9a,_0x200bf2);_0x5432f5(_0x200bf2);});});}function respondWithStatusCode(_0x27eab3,_0x4f7a00){_0x4f7a00=_0x4f7a00||0xcc;return function(_0x51e2ba){if(_0x51e2ba){return _0x27eab3['sendStatus'](_0x4f7a00);}return _0x27eab3[_0xf2f7('0x2d')](_0x4f7a00)[_0xf2f7('0x2e')]();};}function respondWithResult(_0x518706,_0x1b368f){_0x1b368f=_0x1b368f||0xc8;return function(_0x252153){if(_0x252153){return _0x518706['status'](_0x1b368f)['json'](_0x252153);}};}function respondWithFilteredResult(_0x1b595b,_0xc6c374){return function(_0xa07f10){if(_0xa07f10){var _0x38250a=typeof _0xc6c374[_0xf2f7('0x2f')]==='undefined'&&typeof _0xc6c374[_0xf2f7('0x30')]===_0xf2f7('0x31');var _0x1f3bdf=_0xa07f10['count'];var _0x128b2c=_0x38250a?0x0:_0xc6c374[_0xf2f7('0x2f')];var _0x143094=_0x38250a?_0xa07f10[_0xf2f7('0x32')]:_0xc6c374[_0xf2f7('0x2f')]+_0xc6c374[_0xf2f7('0x30')];var _0x4b9c02;if(_0x143094>=_0x1f3bdf){_0x143094=_0x1f3bdf;_0x4b9c02=0xc8;}else{_0x4b9c02=0xce;}_0x1b595b[_0xf2f7('0x2d')](_0x4b9c02);return _0x1b595b['set'](_0xf2f7('0x33'),_0x128b2c+'-'+_0x143094+'/'+_0x1f3bdf)[_0xf2f7('0x34')](_0xa07f10);}return null;};}function patchUpdates(_0x5f0da8){return function(_0x439273){try{jsonpatch[_0xf2f7('0x35')](_0x439273,_0x5f0da8,!![]);}catch(_0x1e1cdf){return BPromise[_0xf2f7('0x36')](_0x1e1cdf);}return _0x439273[_0xf2f7('0x37')]();};}function saveUpdates(_0x2c6075,_0x32168c){return function(_0x29223a){if(_0x29223a){return _0x29223a[_0xf2f7('0x38')](_0x2c6075)[_0xf2f7('0x39')](function(_0x57e178){return _0x57e178;});}return null;};}function removeEntity(_0x374767,_0xc96bad){return function(_0x4e8157){if(_0x4e8157){return _0x4e8157['destroy']()[_0xf2f7('0x39')](function(){_0x374767[_0xf2f7('0x2d')](0xcc)[_0xf2f7('0x2e')]();});}};}function handleEntityNotFound(_0x3e2131,_0x3bcd87){return function(_0x4f7d98){if(!_0x4f7d98){_0x3e2131[_0xf2f7('0x3a')](0x194);}return _0x4f7d98;};}function handleError(_0x156237,_0x227619){_0x227619=_0x227619||0x1f4;return function(_0xff572e){logger['error'](_0xff572e[_0xf2f7('0x3b')]);if(_0xff572e[_0xf2f7('0x3c')]){delete _0xff572e[_0xf2f7('0x3c')];}_0x156237[_0xf2f7('0x2d')](_0x227619)[_0xf2f7('0x3d')](_0xff572e);};}exports[_0xf2f7('0x3e')]=function(_0x37550b,_0x54630c){var _0x17be6c={},_0x373aae={},_0x595070={'count':0x0,'rows':[]};var _0x2d5328=_[_0xf2f7('0x3f')](db[_0xf2f7('0x40')][_0xf2f7('0x41')],function(_0x3f33e0){return{'name':_0x3f33e0[_0xf2f7('0x42')],'type':_0x3f33e0['type']['key']};});_0x373aae[_0xf2f7('0x43')]=_[_0xf2f7('0x3f')](_0x2d5328,_0xf2f7('0x3c'));_0x373aae['query']=_[_0xf2f7('0x44')](_0x37550b[_0xf2f7('0x45')]);_0x373aae[_0xf2f7('0x46')]=_['intersection'](_0x373aae[_0xf2f7('0x43')],_0x373aae[_0xf2f7('0x45')]);_0x17be6c['attributes']=_[_0xf2f7('0x47')](_0x373aae['model'],qs[_0xf2f7('0x48')](_0x37550b[_0xf2f7('0x45')]['fields']));_0x17be6c[_0xf2f7('0x49')]=_0x17be6c[_0xf2f7('0x49')][_0xf2f7('0x4a')]?_0x17be6c['attributes']:_0x373aae['model'];if(!_0x37550b[_0xf2f7('0x45')][_0xf2f7('0x4b')](_0xf2f7('0x4c'))){_0x17be6c[_0xf2f7('0x30')]=qs[_0xf2f7('0x30')](_0x37550b[_0xf2f7('0x45')][_0xf2f7('0x30')]);_0x17be6c[_0xf2f7('0x2f')]=qs[_0xf2f7('0x2f')](_0x37550b['query']['offset']);}_0x17be6c[_0xf2f7('0x4d')]=qs[_0xf2f7('0x4e')](_0x37550b[_0xf2f7('0x45')]['sort']);_0x17be6c[_0xf2f7('0x4f')]=qs[_0xf2f7('0x46')](_[_0xf2f7('0x50')](_0x37550b[_0xf2f7('0x45')],_0x373aae[_0xf2f7('0x46')]),_0x2d5328);if(_0x37550b[_0xf2f7('0x45')][_0xf2f7('0x51')]){_0x17be6c[_0xf2f7('0x4f')]=_[_0xf2f7('0x52')](_0x17be6c['where'],{'$or':_['map'](_0x2d5328,function(_0x4abbeb){if(_0x4abbeb[_0xf2f7('0x53')]!==_0xf2f7('0x54')){var _0xe813db={};_0xe813db[_0x4abbeb[_0xf2f7('0x3c')]]={'$like':'%'+_0x37550b[_0xf2f7('0x45')][_0xf2f7('0x51')]+'%'};return _0xe813db;}})});}_0x17be6c=_[_0xf2f7('0x52')]({},_0x17be6c,_0x37550b['options']);var _0x43de16={'where':_0x17be6c['where']};return db[_0xf2f7('0x40')][_0xf2f7('0x32')](_0x43de16)[_0xf2f7('0x39')](function(_0x47ee2){_0x595070[_0xf2f7('0x32')]=_0x47ee2;if(_0x37550b['query']['includeAll']){_0x17be6c['include']=[{'all':!![]}];}return db[_0xf2f7('0x40')][_0xf2f7('0x55')](_0x17be6c);})[_0xf2f7('0x39')](function(_0x52f61e){_0x595070[_0xf2f7('0x56')]=_0x52f61e;return _0x595070;})[_0xf2f7('0x39')](respondWithFilteredResult(_0x54630c,_0x17be6c))[_0xf2f7('0x57')](handleError(_0x54630c,null));};exports[_0xf2f7('0x58')]=function(_0xa08157,_0x4a4a71){var _0x51d85e={'raw':!![],'where':{'id':_0xa08157[_0xf2f7('0x59')]['id']}},_0x596a35={};_0x596a35['model']=_['keys'](db[_0xf2f7('0x40')]['rawAttributes']);_0x596a35[_0xf2f7('0x45')]=_[_0xf2f7('0x44')](_0xa08157[_0xf2f7('0x45')]);_0x596a35['filters']=_[_0xf2f7('0x47')](_0x596a35[_0xf2f7('0x43')],_0x596a35[_0xf2f7('0x45')]);_0x51d85e[_0xf2f7('0x49')]=_[_0xf2f7('0x47')](_0x596a35[_0xf2f7('0x43')],qs[_0xf2f7('0x48')](_0xa08157[_0xf2f7('0x45')][_0xf2f7('0x48')]));_0x51d85e[_0xf2f7('0x49')]=_0x51d85e[_0xf2f7('0x49')][_0xf2f7('0x4a')]?_0x51d85e['attributes']:_0x596a35[_0xf2f7('0x43')];if(_0xa08157['query'][_0xf2f7('0x5a')]){_0x51d85e[_0xf2f7('0x5b')]=[{'all':!![]}];}_0x51d85e=_['merge']({},_0x51d85e,_0xa08157['options']);return db[_0xf2f7('0x40')][_0xf2f7('0x5c')](_0x51d85e)[_0xf2f7('0x39')](handleEntityNotFound(_0x4a4a71,null))[_0xf2f7('0x39')](respondWithResult(_0x4a4a71,null))[_0xf2f7('0x57')](handleError(_0x4a4a71,null));};exports['update']=function(_0x1bb7c7,_0x197f2a){if(_0x1bb7c7[_0xf2f7('0x5d')]['id']){delete _0x1bb7c7[_0xf2f7('0x5d')]['id'];}return db[_0xf2f7('0x40')][_0xf2f7('0x5c')]({'where':{'id':_0x1bb7c7[_0xf2f7('0x59')]['id']}})[_0xf2f7('0x39')](handleEntityNotFound(_0x197f2a,null))[_0xf2f7('0x39')](saveUpdates(_0x1bb7c7[_0xf2f7('0x5d')],null))['then'](respondWithResult(_0x197f2a,null))['catch'](handleError(_0x197f2a,null));};exports['destroy']=function(_0x3361f9,_0x52a0e7){return db[_0xf2f7('0x40')][_0xf2f7('0x5c')]({'where':{'id':_0x3361f9[_0xf2f7('0x59')]['id']}})[_0xf2f7('0x39')](handleEntityNotFound(_0x52a0e7,null))[_0xf2f7('0x39')](removeEntity(_0x52a0e7,null))[_0xf2f7('0x57')](handleError(_0x52a0e7,null));};exports[_0xf2f7('0x5e')]=function(_0x2149a1,_0x1385d1){return db[_0xf2f7('0x40')]['describe']()[_0xf2f7('0x39')](respondWithResult(_0x1385d1,null))[_0xf2f7('0x57')](handleError(_0x1385d1,null));};var interaction_log=require(_0xf2f7('0x15'))(_0xf2f7('0x5f'));exports['accept']=function(_0x3079c6,_0x3da799,_0x3f6e7b){var _0x229beb={'agent':{},'channel':_0xf2f7('0x60')};if(_0x3079c6[_0xf2f7('0x5d')]['id']){delete _0x3079c6[_0xf2f7('0x5d')]['id'];}_0x3079c6[_0xf2f7('0x5d')][_0xf2f7('0x61')]=!![];_0x3079c6['body']['readAt']=moment()[_0xf2f7('0x62')](_0xf2f7('0x63'));_0x3079c6[_0xf2f7('0x5d')]['UserId']=_0x3079c6[_0xf2f7('0x5d')][_0xf2f7('0x64')]||_0x3079c6[_0xf2f7('0x65')]['id'];_0x229beb[_0xf2f7('0x66')]['id']=_0x3079c6[_0xf2f7('0x5d')]['UserId'];return db['FaxMessage'][_0xf2f7('0x5c')]({'where':{'id':_0x3079c6[_0xf2f7('0x59')]['id'],'UserId':null}})[_0xf2f7('0x39')](handleEntityNotFound(_0x3da799,null))['then'](saveUpdates(_0x3079c6[_0xf2f7('0x5d')],null))[_0xf2f7('0x39')](function(_0x2e120a){if(_0x2e120a){_0x229beb[_0xf2f7('0x2b')]=_0x2e120a['get']({'plain':!![]});return db[_0xf2f7('0x67')][_0xf2f7('0x5c')]({'where':{'id':_0x2e120a[_0xf2f7('0x68')]}});}return null;})[_0xf2f7('0x39')](handleEntityNotFound(_0x3da799,null))[_0xf2f7('0x39')](function(_0xd57e09){if(_0xd57e09){return _0xd57e09['update']({'UserId':_0x3079c6[_0xf2f7('0x5d')]['UserId'],'read1stAt':_[_0xf2f7('0x69')](_0xd57e09[_0xf2f7('0x6a')])?moment()['format'](_0xf2f7('0x63')):undefined});}return null;})[_0xf2f7('0x39')](function(_0x488305){if(_0x488305){_0x229beb[_0xf2f7('0x6b')]=_0x488305[_0xf2f7('0x6c')]({'plain':!![]});interaction_log['info'](_0xf2f7('0x6d'),_0x3079c6['user']['id'],_0x3079c6[_0xf2f7('0x65')]['name'],_0x3079c6[_0xf2f7('0x65')][_0xf2f7('0x6e')],_0x229beb[_0xf2f7('0x6b')]['id'],_0x3079c6[_0xf2f7('0x5d')]?JSON[_0xf2f7('0x27')](_0x3079c6[_0xf2f7('0x5d')]):_0xf2f7('0x6f'));return respondWithRpcPromise(_0xf2f7('0x70'),_0xf2f7('0x71'),_0x229beb);}return null;})[_0xf2f7('0x39')](function(_0x225bf2){var _0x5f27a5=_0xf2f7('0x72')+_0x225bf2[_0xf2f7('0x2b')][_0xf2f7('0x73')];return db['sequelize']['query'](_0x5f27a5,{'type':db[_0xf2f7('0x74')][_0xf2f7('0x75')]['SELECT'],'raw':!![]})[_0xf2f7('0x39')](function(_0x1a2027){return _0x1a2027;});})[_0xf2f7('0x39')](function(_0x3cdd32){if(_0x3cdd32){_0x229beb[_0xf2f7('0x2b')]['contact']=_0x3cdd32[0x0];if(!_0x3079c6[_0xf2f7('0x5d')]['UserId'])return;return db['User'][_0xf2f7('0x5c')]({'where':{'id':_0x3079c6[_0xf2f7('0x5d')]['UserId'],'role':_0xf2f7('0x66')},'attributes':['id',_0xf2f7('0x3c'),_0xf2f7('0x76'),'email',_0xf2f7('0x77')],'raw':!![]});}return null;})[_0xf2f7('0x39')](function(_0x6e9876){if(!_0x6e9876)return null;_0x229beb[_0xf2f7('0x2b')][_0xf2f7('0x66')]=_0x6e9876;return _0x229beb;})[_0xf2f7('0x39')](function(_0x874298){if(_0x874298){if(_0x3079c6['body'][_0xf2f7('0x78')]){_0x229beb['message']['interface']=util[_0xf2f7('0x62')](_0xf2f7('0x79'),_0x3079c6[_0xf2f7('0x65')][_0xf2f7('0x3c')]);_0x229beb[_0xf2f7('0x2b')][_0xf2f7('0x7a')]=_0x229beb[_0xf2f7('0x7a')];_0x229beb[_0xf2f7('0x2b')]['motionChannel']=_0x229beb[_0xf2f7('0x7a')];_0x229beb['message'][_0xf2f7('0x7b')]=_0xf2f7('0x7c');return respondWithRpcPromise(_0xf2f7('0x7d'),_0xf2f7('0x7d'),{'event':'acceptmessage','message':_0x229beb[_0xf2f7('0x2b')]},client9002)[_0xf2f7('0x39')](function(){return _0x229beb;});}return _0x229beb;}return null;})[_0xf2f7('0x39')](respondWithResult(_0x3da799,null))[_0xf2f7('0x57')](handleError(_0x3da799,null));};var interaction_log=require(_0xf2f7('0x15'))('fax-interactions');exports[_0xf2f7('0x36')]=function(_0x235893,_0xb6bb51,_0x4b9bbc){var _0x37348c={'agent':{},'channel':_0xf2f7('0x60')};if(_0x235893['body']['id']){delete _0x235893['body']['id'];}_0x235893[_0xf2f7('0x5d')][_0xf2f7('0x64')]=_0x235893['body'][_0xf2f7('0x64')]||_0x235893['user']['id'];_0x37348c[_0xf2f7('0x66')]['id']=_0x235893[_0xf2f7('0x5d')]['UserId'];return db['FaxMessage'][_0xf2f7('0x5c')]({'where':{'id':_0x235893[_0xf2f7('0x59')]['id'],'UserId':null}})[_0xf2f7('0x39')](handleEntityNotFound(_0xb6bb51,null))['then'](function(_0x15382e){if(_0x15382e){_0x37348c['message']=_0x15382e[_0xf2f7('0x6c')]({'plain':!![]});return db[_0xf2f7('0x67')][_0xf2f7('0x5c')]({'where':{'id':_0x15382e['FaxInteractionId']}});}return null;})[_0xf2f7('0x39')](handleEntityNotFound(_0xb6bb51,null))['then'](function(_0x2077f3){if(_0x2077f3){_0x37348c[_0xf2f7('0x6b')]=_0x2077f3[_0xf2f7('0x6c')]({'plain':!![]});interaction_log['info'](_0xf2f7('0x7e'),_0x235893[_0xf2f7('0x65')]['id'],_0x235893[_0xf2f7('0x65')][_0xf2f7('0x3c')],_0x235893[_0xf2f7('0x65')]['role'],_0x37348c['interaction']['id'],_0x235893[_0xf2f7('0x5d')]?JSON[_0xf2f7('0x27')](_0x235893['body']):'null');return respondWithRpcPromise(_0xf2f7('0x7f'),'rejectMessage',_0x37348c);}return null;})['then'](function(_0x3cfc0f){var _0x2a2b5c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3cfc0f['message'][_0xf2f7('0x73')];return db[_0xf2f7('0x80')][_0xf2f7('0x45')](_0x2a2b5c,{'type':db[_0xf2f7('0x74')]['QueryTypes'][_0xf2f7('0x81')],'raw':!![]})[_0xf2f7('0x39')](function(_0x40bafa){return _0x40bafa;});})[_0xf2f7('0x39')](function(_0x3b8c46){if(_0x3b8c46){_0x37348c[_0xf2f7('0x2b')][_0xf2f7('0x82')]=_0x3b8c46[0x0];if(!_0x235893[_0xf2f7('0x5d')][_0xf2f7('0x64')])return;return db[_0xf2f7('0x83')]['find']({'where':{'id':_0x235893[_0xf2f7('0x5d')][_0xf2f7('0x64')],'role':_0xf2f7('0x66')},'attributes':['id',_0xf2f7('0x3c'),_0xf2f7('0x76'),_0xf2f7('0x84'),_0xf2f7('0x77')],'raw':!![]});}return null;})['then'](function(_0x14ad69){if(!_0x14ad69)return null;_0x37348c[_0xf2f7('0x2b')]['agent']=_0x14ad69;return _0x37348c;})[_0xf2f7('0x39')](function(_0x276ada){if(_0x276ada){_0x276ada[_0xf2f7('0x2b')][_0xf2f7('0x85')]=util[_0xf2f7('0x62')]('SIP/%s',_0x235893['user'][_0xf2f7('0x3c')]);_0x276ada[_0xf2f7('0x2b')][_0xf2f7('0x7a')]=_0x37348c['channel'];_0x276ada[_0xf2f7('0x2b')]['motionChannel']=_0x37348c['channel'];_0x276ada['message'][_0xf2f7('0x7b')]=_0xf2f7('0x36');respondWithRpcPromise(_0xf2f7('0x7d'),_0xf2f7('0x7d'),{'event':_0xf2f7('0x86'),'message':_0x276ada[_0xf2f7('0x2b')]},client9002);return _0x37348c;}return null;})[_0xf2f7('0x39')](respondWithResult(_0xb6bb51,null))['catch'](handleError(_0xb6bb51,null));};exports['create']=function(_0x2a7b3d,_0x20f031){var _0x4acb7b;return db[_0xf2f7('0x40')]['create'](_0x2a7b3d[_0xf2f7('0x5d')],{})[_0xf2f7('0x39')](function(_0x1312bf){_0x4acb7b=_0x1312bf;return db[_0xf2f7('0x87')]['findOne']({'where':{'id':_0x4acb7b[_0xf2f7('0x73')]}});})[_0xf2f7('0x39')](function(_0x18e56a){if(_[_0xf2f7('0x69')](_0x18e56a)){return;}else{_0x4acb7b[_0xf2f7('0x60')]=_0x18e56a[_0xf2f7('0x60')];return db[_0xf2f7('0x88')]['findOne']({'where':{'id':_0x4acb7b[_0xf2f7('0x89')]}});}})[_0xf2f7('0x39')](function(_0xa3641e){return respondWithRpcPromise(_0xf2f7('0x8a'),_0xf2f7('0x8a'),{'FaxAccountId':_[_0xf2f7('0x69')](_0x2a7b3d[_0xf2f7('0x5d')])?undefined:_0x2a7b3d['body'][_0xf2f7('0x8b')],'path':_[_0xf2f7('0x69')](_0xa3641e)?undefined:util[_0xf2f7('0x62')](_0xf2f7('0x8c'),_0xa3641e[_0xf2f7('0x8d')]),'fax':_[_0xf2f7('0x69')](_0x4acb7b[_0xf2f7('0x60')])?undefined:_0x4acb7b[_0xf2f7('0x60')],'AttachmentId':_0x4acb7b[_0xf2f7('0x89')]},client9002);})['then'](respondWithResult(_0x20f031,0xc9))[_0xf2f7('0x57')](handleError(_0x20f031,null));};exports[_0xf2f7('0x8e')]=function(_0x14c48a,_0xa6387f){var _0x5d7f5a=path[_0xf2f7('0x8f')](config[_0xf2f7('0x90')],_0xf2f7('0x91'),_0xf2f7('0x92'),_0xf2f7('0x93'));return db[_0xf2f7('0x40')][_0xf2f7('0x5c')]({'where':{'id':_0x14c48a['params']['id']},'include':[{'model':db[_0xf2f7('0x88')],'as':_0xf2f7('0x88')}]})['then'](handleEntityNotFound(_0xa6387f,null))[_0xf2f7('0x39')](function(_0x2c6ceb){if(_0x2c6ceb){return _0xa6387f[_0xf2f7('0x8e')](path[_0xf2f7('0x8f')](_0x5d7f5a,_0x2c6ceb[_0xf2f7('0x88')][_0xf2f7('0x8d')]));}})[_0xf2f7('0x57')](handleError(_0xa6387f,null));}; \ No newline at end of file +var _0x4834=['params','keys','find','body','catch','describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','rejectMessage','User','fullname','email','event','rejectmessage','create','findOne','ContactId','isNil','Attachment','SendFax','download','join','root','server','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','include','findAll','show'];(function(_0x5b8b2a,_0x4610d5){var _0x22ea6e=function(_0x39dfb5){while(--_0x39dfb5){_0x5b8b2a['push'](_0x5b8b2a['shift']());}};_0x22ea6e(++_0x4610d5);}(_0x4834,0xc6));var _0x4483=function(_0x2440ce,_0x3261ab){_0x2440ce=_0x2440ce-0x0;var _0x5938f6=_0x4834[_0x2440ce];return _0x5938f6;};'use strict';var emlformat=require(_0x4483('0x0'));var rimraf=require(_0x4483('0x1'));var zipdir=require(_0x4483('0x2'));var jsonpatch=require(_0x4483('0x3'));var rp=require(_0x4483('0x4'));var moment=require(_0x4483('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4483('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4483('0x7'));var csv=require('to-csv');var ejs=require(_0x4483('0x8'));var fs=require('fs');var fs_extra=require(_0x4483('0x9'));var _=require(_0x4483('0xa'));var squel=require(_0x4483('0xb'));var crypto=require(_0x4483('0xc'));var jsforce=require(_0x4483('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4483('0xe'));var querystring=require('querystring');var Papa=require(_0x4483('0xf'));var Redis=require(_0x4483('0x10'));var authService=require(_0x4483('0x11'));var qs=require(_0x4483('0x12'));var as=require(_0x4483('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4483('0x14'))(_0x4483('0x15'));var utils=require(_0x4483('0x16'));var config=require(_0x4483('0x17'));var licenseUtil=require(_0x4483('0x18'));var db=require('../../mysqldb')['db'];config[_0x4483('0x19')]=_['defaults'](config[_0x4483('0x19')],{'host':_0x4483('0x1a'),'port':0x18eb});var socket=require(_0x4483('0x1b'))(new Redis(config[_0x4483('0x19')]));require(_0x4483('0x1c'))[_0x4483('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4483('0x1e')][_0x4483('0x1f')]({'port':0x232c});var client9002=jayson[_0x4483('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc471,_0x206d01,_0x3831d2,_0x5636c7){return new BPromise(function(_0x273707,_0x3a2a8d){var _0x1b5b86=_0x5636c7||client;return _0x1b5b86[_0x4483('0x20')](_0x1bc471,_0x3831d2)[_0x4483('0x21')](function(_0x34e17e){logger[_0x4483('0x22')](_0x4483('0x23'),_0x206d01,_0x4483('0x24'));logger[_0x4483('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x206d01,_0x4483('0x24'),JSON['stringify'](_0x34e17e));if(_0x34e17e['error']){if(_0x34e17e[_0x4483('0x26')][_0x4483('0x27')]===0x1f4){logger['error'](_0x4483('0x23'),_0x206d01,_0x34e17e[_0x4483('0x26')][_0x4483('0x28')]);return _0x3a2a8d(_0x34e17e[_0x4483('0x26')][_0x4483('0x28')]);}logger[_0x4483('0x26')](_0x4483('0x23'),_0x206d01,_0x34e17e['error'][_0x4483('0x28')]);return _0x273707(_0x34e17e[_0x4483('0x26')][_0x4483('0x28')]);}else{logger[_0x4483('0x22')](_0x4483('0x23'),_0x206d01,'request\x20sent');_0x273707(_0x34e17e[_0x4483('0x29')][_0x4483('0x28')]);}})['catch'](function(_0x28c879){logger['error']('FaxMessage,\x20%s,\x20%s',_0x206d01,_0x28c879);_0x3a2a8d(_0x28c879);});});}function respondWithStatusCode(_0x32b9be,_0x46f442){_0x46f442=_0x46f442||0xcc;return function(_0x347f88){if(_0x347f88){return _0x32b9be[_0x4483('0x2a')](_0x46f442);}return _0x32b9be[_0x4483('0x2b')](_0x46f442)[_0x4483('0x2c')]();};}function respondWithResult(_0x583e94,_0x3547c9){_0x3547c9=_0x3547c9||0xc8;return function(_0xb329fa){if(_0xb329fa){return _0x583e94[_0x4483('0x2b')](_0x3547c9)[_0x4483('0x2d')](_0xb329fa);}};}function respondWithFilteredResult(_0x1b7fb1,_0x36e497){return function(_0x588357){if(_0x588357){var _0xf630b8=typeof _0x36e497['offset']===_0x4483('0x2e')&&typeof _0x36e497['limit']===_0x4483('0x2e');var _0x459a8a=_0x588357[_0x4483('0x2f')];var _0x15c703=_0xf630b8?0x0:_0x36e497[_0x4483('0x30')];var _0x5c4fcc=_0xf630b8?_0x588357[_0x4483('0x2f')]:_0x36e497[_0x4483('0x30')]+_0x36e497['limit'];var _0x4a9fe7;if(_0x5c4fcc>=_0x459a8a){_0x5c4fcc=_0x459a8a;_0x4a9fe7=0xc8;}else{_0x4a9fe7=0xce;}_0x1b7fb1[_0x4483('0x2b')](_0x4a9fe7);return _0x1b7fb1[_0x4483('0x31')](_0x4483('0x32'),_0x15c703+'-'+_0x5c4fcc+'/'+_0x459a8a)[_0x4483('0x2d')](_0x588357);}return null;};}function patchUpdates(_0x28ec7c){return function(_0x9c9d23){try{jsonpatch[_0x4483('0x33')](_0x9c9d23,_0x28ec7c,!![]);}catch(_0x5ef8c5){return BPromise[_0x4483('0x34')](_0x5ef8c5);}return _0x9c9d23[_0x4483('0x35')]();};}function saveUpdates(_0x282c59,_0xc99b5){return function(_0x1b2e03){if(_0x1b2e03){return _0x1b2e03[_0x4483('0x36')](_0x282c59)[_0x4483('0x21')](function(_0x41fda3){return _0x41fda3;});}return null;};}function removeEntity(_0x3c883a,_0x280e23){return function(_0x458f37){if(_0x458f37){return _0x458f37[_0x4483('0x37')]()['then'](function(){_0x3c883a['status'](0xcc)[_0x4483('0x2c')]();});}};}function handleEntityNotFound(_0x17d10b,_0x5738a9){return function(_0x36fed2){if(!_0x36fed2){_0x17d10b[_0x4483('0x2a')](0x194);}return _0x36fed2;};}function handleError(_0x4b7138,_0x208093){_0x208093=_0x208093||0x1f4;return function(_0x322987){logger[_0x4483('0x26')](_0x322987[_0x4483('0x38')]);if(_0x322987['name']){delete _0x322987[_0x4483('0x39')];}_0x4b7138['status'](_0x208093)[_0x4483('0x3a')](_0x322987);};}exports[_0x4483('0x3b')]=function(_0x2d0604,_0x1ef41c){var _0x4be5d8={},_0x564216={},_0x434db2={'count':0x0,'rows':[]};var _0x9fb4b9=_['map'](db[_0x4483('0x3c')][_0x4483('0x3d')],function(_0x378599){return{'name':_0x378599[_0x4483('0x3e')],'type':_0x378599[_0x4483('0x3f')][_0x4483('0x40')]};});_0x564216[_0x4483('0x41')]=_[_0x4483('0x42')](_0x9fb4b9,_0x4483('0x39'));_0x564216[_0x4483('0x43')]=_['keys'](_0x2d0604['query']);_0x564216[_0x4483('0x44')]=_[_0x4483('0x45')](_0x564216[_0x4483('0x41')],_0x564216[_0x4483('0x43')]);_0x4be5d8[_0x4483('0x46')]=_[_0x4483('0x45')](_0x564216[_0x4483('0x41')],qs[_0x4483('0x47')](_0x2d0604[_0x4483('0x43')]['fields']));_0x4be5d8[_0x4483('0x46')]=_0x4be5d8[_0x4483('0x46')][_0x4483('0x48')]?_0x4be5d8['attributes']:_0x564216[_0x4483('0x41')];if(!_0x2d0604['query'][_0x4483('0x49')](_0x4483('0x4a'))){_0x4be5d8['limit']=qs[_0x4483('0x4b')](_0x2d0604[_0x4483('0x43')][_0x4483('0x4b')]);_0x4be5d8[_0x4483('0x30')]=qs['offset'](_0x2d0604[_0x4483('0x43')][_0x4483('0x30')]);}_0x4be5d8[_0x4483('0x4c')]=qs['sort'](_0x2d0604[_0x4483('0x43')][_0x4483('0x4d')]);_0x4be5d8['where']=qs['filters'](_[_0x4483('0x4e')](_0x2d0604[_0x4483('0x43')],_0x564216['filters']),_0x9fb4b9);if(_0x2d0604[_0x4483('0x43')][_0x4483('0x4f')]){_0x4be5d8[_0x4483('0x50')]=_['merge'](_0x4be5d8[_0x4483('0x50')],{'$or':_[_0x4483('0x42')](_0x9fb4b9,function(_0x5ac55f){if(_0x5ac55f['type']!=='VIRTUAL'){var _0xfd3135={};_0xfd3135[_0x5ac55f[_0x4483('0x39')]]={'$like':'%'+_0x2d0604[_0x4483('0x43')][_0x4483('0x4f')]+'%'};return _0xfd3135;}})});}_0x4be5d8=_[_0x4483('0x51')]({},_0x4be5d8,_0x2d0604[_0x4483('0x52')]);var _0xc3c30={'where':_0x4be5d8[_0x4483('0x50')]};return db['FaxMessage'][_0x4483('0x2f')](_0xc3c30)[_0x4483('0x21')](function(_0x3ab061){_0x434db2[_0x4483('0x2f')]=_0x3ab061;if(_0x2d0604['query']['includeAll']){_0x4be5d8[_0x4483('0x53')]=[{'all':!![]}];}return db[_0x4483('0x3c')][_0x4483('0x54')](_0x4be5d8);})['then'](function(_0x4572a3){_0x434db2['rows']=_0x4572a3;return _0x434db2;})['then'](respondWithFilteredResult(_0x1ef41c,_0x4be5d8))['catch'](handleError(_0x1ef41c,null));};exports[_0x4483('0x55')]=function(_0x23b7a1,_0x17ca72){var _0x237924={'raw':!![],'where':{'id':_0x23b7a1[_0x4483('0x56')]['id']}},_0x52dfef={};_0x52dfef[_0x4483('0x41')]=_[_0x4483('0x57')](db[_0x4483('0x3c')][_0x4483('0x3d')]);_0x52dfef['query']=_[_0x4483('0x57')](_0x23b7a1[_0x4483('0x43')]);_0x52dfef[_0x4483('0x44')]=_[_0x4483('0x45')](_0x52dfef[_0x4483('0x41')],_0x52dfef[_0x4483('0x43')]);_0x237924['attributes']=_[_0x4483('0x45')](_0x52dfef[_0x4483('0x41')],qs['fields'](_0x23b7a1['query']['fields']));_0x237924['attributes']=_0x237924[_0x4483('0x46')][_0x4483('0x48')]?_0x237924[_0x4483('0x46')]:_0x52dfef[_0x4483('0x41')];if(_0x23b7a1[_0x4483('0x43')]['includeAll']){_0x237924['include']=[{'all':!![]}];}_0x237924=_['merge']({},_0x237924,_0x23b7a1[_0x4483('0x52')]);return db['FaxMessage'][_0x4483('0x58')](_0x237924)[_0x4483('0x21')](handleEntityNotFound(_0x17ca72,null))[_0x4483('0x21')](respondWithResult(_0x17ca72,null))['catch'](handleError(_0x17ca72,null));};exports['update']=function(_0x53d43e,_0x4d63c4){if(_0x53d43e[_0x4483('0x59')]['id']){delete _0x53d43e['body']['id'];}return db[_0x4483('0x3c')][_0x4483('0x58')]({'where':{'id':_0x53d43e[_0x4483('0x56')]['id']}})[_0x4483('0x21')](handleEntityNotFound(_0x4d63c4,null))[_0x4483('0x21')](saveUpdates(_0x53d43e['body'],null))[_0x4483('0x21')](respondWithResult(_0x4d63c4,null))[_0x4483('0x5a')](handleError(_0x4d63c4,null));};exports[_0x4483('0x37')]=function(_0x1e86e0,_0x27fbf2){return db[_0x4483('0x3c')][_0x4483('0x58')]({'where':{'id':_0x1e86e0[_0x4483('0x56')]['id']}})[_0x4483('0x21')](handleEntityNotFound(_0x27fbf2,null))[_0x4483('0x21')](removeEntity(_0x27fbf2,null))[_0x4483('0x5a')](handleError(_0x27fbf2,null));};exports[_0x4483('0x5b')]=function(_0x2b607d,_0x36de87){return db[_0x4483('0x3c')][_0x4483('0x5b')]()['then'](respondWithResult(_0x36de87,null))[_0x4483('0x5a')](handleError(_0x36de87,null));};var interaction_log=require(_0x4483('0x14'))(_0x4483('0x5c'));exports[_0x4483('0x5d')]=function(_0x2d0db9,_0x1ae896,_0x1910df){var _0x309dfe={'agent':{},'channel':_0x4483('0x5e')};if(_0x2d0db9['body']['id']){delete _0x2d0db9[_0x4483('0x59')]['id'];}_0x2d0db9[_0x4483('0x59')]['read']=!![];_0x2d0db9['body']['readAt']=moment()[_0x4483('0x5f')](_0x4483('0x60'));_0x2d0db9[_0x4483('0x59')][_0x4483('0x61')]=_0x2d0db9['body'][_0x4483('0x61')]||_0x2d0db9[_0x4483('0x62')]['id'];_0x309dfe[_0x4483('0x63')]['id']=_0x2d0db9[_0x4483('0x59')][_0x4483('0x61')];return db[_0x4483('0x3c')][_0x4483('0x58')]({'where':{'id':_0x2d0db9['params']['id'],'UserId':null}})[_0x4483('0x21')](handleEntityNotFound(_0x1ae896,null))[_0x4483('0x21')](saveUpdates(_0x2d0db9[_0x4483('0x59')],null))[_0x4483('0x21')](function(_0x242271){if(_0x242271){_0x309dfe['message']=_0x242271['get']({'plain':!![]});return db[_0x4483('0x64')][_0x4483('0x58')]({'where':{'id':_0x242271[_0x4483('0x65')]}});}return null;})[_0x4483('0x21')](handleEntityNotFound(_0x1ae896,null))['then'](function(_0x734e59){if(_0x734e59){return _0x734e59['update']({'UserId':_0x2d0db9[_0x4483('0x59')]['UserId'],'read1stAt':_['isNil'](_0x734e59[_0x4483('0x66')])?moment()[_0x4483('0x5f')](_0x4483('0x60')):undefined});}return null;})[_0x4483('0x21')](function(_0x5da2a4){if(_0x5da2a4){_0x309dfe[_0x4483('0x67')]=_0x5da2a4[_0x4483('0x68')]({'plain':!![]});interaction_log[_0x4483('0x22')](_0x4483('0x69'),_0x2d0db9['user']['id'],_0x2d0db9['user']['name'],_0x2d0db9[_0x4483('0x62')][_0x4483('0x6a')],_0x309dfe[_0x4483('0x67')]['id'],_0x2d0db9['body']?JSON['stringify'](_0x2d0db9[_0x4483('0x59')]):'null');return respondWithRpcPromise(_0x4483('0x6b'),'acceptMessage',_0x309dfe);}return null;})['then'](function(_0x9bd9c6){var _0x245a71=_0x4483('0x6c')+_0x9bd9c6[_0x4483('0x28')]['ContactId'];return db[_0x4483('0x6d')][_0x4483('0x43')](_0x245a71,{'type':db[_0x4483('0x6e')][_0x4483('0x6f')][_0x4483('0x70')],'raw':!![]})['then'](function(_0x587e0b){return _0x587e0b;});})[_0x4483('0x21')](function(_0x113934){if(_0x113934){_0x309dfe['message'][_0x4483('0x71')]=_0x113934[0x0];if(!_0x2d0db9[_0x4483('0x59')][_0x4483('0x61')])return;return db['User'][_0x4483('0x58')]({'where':{'id':_0x2d0db9[_0x4483('0x59')][_0x4483('0x61')],'role':_0x4483('0x63')},'attributes':['id',_0x4483('0x39'),'fullname','email',_0x4483('0x72')],'raw':!![]});}return null;})[_0x4483('0x21')](function(_0x469617){if(!_0x469617)return null;_0x309dfe['message'][_0x4483('0x63')]=_0x469617;return _0x309dfe;})[_0x4483('0x21')](function(_0x19873f){if(_0x19873f){if(_0x2d0db9[_0x4483('0x59')][_0x4483('0x73')]){_0x309dfe[_0x4483('0x28')][_0x4483('0x74')]=util[_0x4483('0x5f')](_0x4483('0x75'),_0x2d0db9[_0x4483('0x62')]['name']);_0x309dfe[_0x4483('0x28')][_0x4483('0x76')]=_0x309dfe['channel'];_0x309dfe['message'][_0x4483('0x77')]=_0x309dfe[_0x4483('0x76')];_0x309dfe[_0x4483('0x28')]['event']=_0x4483('0x5d');return respondWithRpcPromise(_0x4483('0x78'),_0x4483('0x78'),{'event':'acceptmessage','message':_0x309dfe[_0x4483('0x28')]},client9002)[_0x4483('0x21')](function(){return _0x309dfe;});}return _0x309dfe;}return null;})['then'](respondWithResult(_0x1ae896,null))[_0x4483('0x5a')](handleError(_0x1ae896,null));};var interaction_log=require(_0x4483('0x14'))(_0x4483('0x5c'));exports[_0x4483('0x34')]=function(_0x56d6a1,_0xcf9e32,_0x364536){var _0x41f9d3={'agent':{},'channel':_0x4483('0x5e')};if(_0x56d6a1[_0x4483('0x59')]['id']){delete _0x56d6a1[_0x4483('0x59')]['id'];}_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')]=_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')]||_0x56d6a1[_0x4483('0x62')]['id'];_0x41f9d3[_0x4483('0x63')]['id']=_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')];return db[_0x4483('0x3c')][_0x4483('0x58')]({'where':{'id':_0x56d6a1['params']['id'],'UserId':null}})[_0x4483('0x21')](handleEntityNotFound(_0xcf9e32,null))[_0x4483('0x21')](function(_0x353c3e){if(_0x353c3e){_0x41f9d3[_0x4483('0x28')]=_0x353c3e[_0x4483('0x68')]({'plain':!![]});return db[_0x4483('0x64')][_0x4483('0x58')]({'where':{'id':_0x353c3e[_0x4483('0x65')]}});}return null;})[_0x4483('0x21')](handleEntityNotFound(_0xcf9e32,null))[_0x4483('0x21')](function(_0x3d9349){if(_0x3d9349){_0x41f9d3[_0x4483('0x67')]=_0x3d9349[_0x4483('0x68')]({'plain':!![]});interaction_log['info'](_0x4483('0x79'),_0x56d6a1[_0x4483('0x62')]['id'],_0x56d6a1[_0x4483('0x62')][_0x4483('0x39')],_0x56d6a1[_0x4483('0x62')][_0x4483('0x6a')],_0x41f9d3['interaction']['id'],_0x56d6a1[_0x4483('0x59')]?JSON[_0x4483('0x7a')](_0x56d6a1[_0x4483('0x59')]):_0x4483('0x7b'));return respondWithRpcPromise('RejectMessage',_0x4483('0x7c'),_0x41f9d3);}return null;})[_0x4483('0x21')](function(_0x9cf131){var _0x2a511e=_0x4483('0x6c')+_0x9cf131[_0x4483('0x28')]['ContactId'];return db[_0x4483('0x6d')][_0x4483('0x43')](_0x2a511e,{'type':db['Sequelize'][_0x4483('0x6f')]['SELECT'],'raw':!![]})[_0x4483('0x21')](function(_0x18e8f6){return _0x18e8f6;});})[_0x4483('0x21')](function(_0x1e25c8){if(_0x1e25c8){_0x41f9d3[_0x4483('0x28')][_0x4483('0x71')]=_0x1e25c8[0x0];if(!_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')])return;return db[_0x4483('0x7d')][_0x4483('0x58')]({'where':{'id':_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')],'role':'agent'},'attributes':['id',_0x4483('0x39'),_0x4483('0x7e'),_0x4483('0x7f'),_0x4483('0x72')],'raw':!![]});}return null;})[_0x4483('0x21')](function(_0xb63901){if(!_0xb63901)return null;_0x41f9d3[_0x4483('0x28')][_0x4483('0x63')]=_0xb63901;return _0x41f9d3;})[_0x4483('0x21')](function(_0x5ca062){if(_0x5ca062){_0x5ca062['message']['interface']=util[_0x4483('0x5f')](_0x4483('0x75'),_0x56d6a1['user'][_0x4483('0x39')]);_0x5ca062['message'][_0x4483('0x76')]=_0x41f9d3[_0x4483('0x76')];_0x5ca062[_0x4483('0x28')][_0x4483('0x77')]=_0x41f9d3['channel'];_0x5ca062[_0x4483('0x28')][_0x4483('0x80')]=_0x4483('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0x4483('0x81'),'message':_0x5ca062[_0x4483('0x28')]},client9002);return _0x41f9d3;}return null;})[_0x4483('0x21')](respondWithResult(_0xcf9e32,null))[_0x4483('0x5a')](handleError(_0xcf9e32,null));};exports[_0x4483('0x82')]=function(_0x88a7f5,_0x37219c){var _0x4d559d;return db[_0x4483('0x3c')]['create'](_0x88a7f5[_0x4483('0x59')],{})[_0x4483('0x21')](function(_0x195cbb){_0x4d559d=_0x195cbb;return db['CmContact'][_0x4483('0x83')]({'where':{'id':_0x4d559d[_0x4483('0x84')]}});})[_0x4483('0x21')](function(_0x4f8c64){if(_[_0x4483('0x85')](_0x4f8c64)){return;}else{_0x4d559d[_0x4483('0x5e')]=_0x4f8c64[_0x4483('0x5e')];return db[_0x4483('0x86')][_0x4483('0x83')]({'where':{'id':_0x4d559d['AttachmentId']}});}})[_0x4483('0x21')](function(_0x490795){return respondWithRpcPromise(_0x4483('0x87'),_0x4483('0x87'),{'FaxAccountId':_[_0x4483('0x85')](_0x88a7f5[_0x4483('0x59')])?undefined:_0x88a7f5['body']['FaxAccountId'],'path':_['isNil'](_0x490795)?undefined:util[_0x4483('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x490795['basename']),'fax':_[_0x4483('0x85')](_0x4d559d[_0x4483('0x5e')])?undefined:_0x4d559d['fax'],'AttachmentId':_0x4d559d['AttachmentId']},client9002);})['then'](respondWithResult(_0x37219c,0xc9))[_0x4483('0x5a')](handleError(_0x37219c,null));};exports[_0x4483('0x88')]=function(_0x2674ce,_0x2ae969){var _0x1b4e5f=path[_0x4483('0x89')](config[_0x4483('0x8a')],_0x4483('0x8b'),'files',_0x4483('0x8c'));return db['FaxMessage'][_0x4483('0x58')]({'where':{'id':_0x2674ce[_0x4483('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0x4483('0x86')}]})[_0x4483('0x21')](handleEntityNotFound(_0x2ae969,null))['then'](function(_0x17fe48){if(_0x17fe48){return _0x2ae969['download'](path['join'](_0x1b4e5f,_0x17fe48['Attachment'][_0x4483('0x8d')]));}})[_0x4483('0x5a')](handleError(_0x2ae969,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 0e0d2ad..b8fe6c9 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 _0x2b47=['FaxMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x101e9d,_0x3440d3){var _0x96db1f=function(_0x18da38){while(--_0x18da38){_0x101e9d['push'](_0x101e9d['shift']());}};_0x96db1f(++_0x3440d3);}(_0x2b47,0x177));var _0x72b4=function(_0x33c2db,_0x514929){_0x33c2db=_0x33c2db-0x0;var _0x119a84=_0x2b47[_0x33c2db];return _0x119a84;};'use strict';var EventEmitter=require(_0x72b4('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x72b4('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x72b4('0x2')](0x0);var events={'afterCreate':_0x72b4('0x3'),'afterUpdate':'update','afterDestroy':_0x72b4('0x4')};function emitEvent(_0x299680){return function(_0x2a3f83,_0x302681,_0x160600){FaxMessageEvents[_0x72b4('0x5')](_0x299680+':'+_0x2a3f83['id'],_0x2a3f83);FaxMessageEvents['emit'](_0x299680,_0x2a3f83);_0x160600(null);};}for(var e in events){if(events[_0x72b4('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x72b4('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x28b1=['FaxMessage','save','update','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1f8a44,_0x458b19){var _0x1e26ea=function(_0x4e5b31){while(--_0x4e5b31){_0x1f8a44['push'](_0x1f8a44['shift']());}};_0x1e26ea(++_0x458b19);}(_0x28b1,0x1d6));var _0x128b=function(_0x9b9fb0,_0x58a33e){_0x9b9fb0=_0x9b9fb0-0x0;var _0x5b4f02=_0x28b1[_0x9b9fb0];return _0x5b4f02;};'use strict';var EventEmitter=require(_0x128b('0x0'));var FaxMessage=require(_0x128b('0x1'))['db'][_0x128b('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x128b('0x3'),'afterUpdate':_0x128b('0x4'),'afterDestroy':_0x128b('0x5')};function emitEvent(_0x6c4acf){return function(_0x4dc0ce,_0x58f0cb,_0x40ee56){FaxMessageEvents['emit'](_0x6c4acf+':'+_0x4dc0ce['id'],_0x4dc0ce);FaxMessageEvents['emit'](_0x6c4acf,_0x4dc0ce);_0x40ee56(null);};}for(var e in events){if(events[_0x128b('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x128b('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 64c37a6..82882f5 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 _0x7bf7=['bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','body','FULLTEXT','models','direction','toLowerCase','secret','UserId','findOne','FaxInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','api','moment'];(function(_0x27483c,_0xe0aa1f){var _0x59d1d9=function(_0xa0b5c){while(--_0xa0b5c){_0x27483c['push'](_0x27483c['shift']());}};_0x59d1d9(++_0xe0aa1f);}(_0x7bf7,0x8e));var _0x77bf=function(_0x5b3d2c,_0x45b35b){_0x5b3d2c=_0x5b3d2c-0x0;var _0x91c521=_0x7bf7[_0x5b3d2c];return _0x91c521;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x77bf('0x0'));var moment=require(_0x77bf('0x1'));var BPromise=require(_0x77bf('0x2'));var rp=require(_0x77bf('0x3'));var fs=require('fs');var path=require(_0x77bf('0x4'));var rimraf=require(_0x77bf('0x5'));var config=require(_0x77bf('0x6'));var attributes=require(_0x77bf('0x7'));module['exports']=function(_0x189a61,_0x379101){return _0x189a61[_0x77bf('0x8')]('FaxMessage',attributes,{'tableName':_0x77bf('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x77bf('0xa')],'type':_0x77bf('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ddb3b,_0x5e2fba,_0x2e4198){var _0x28f614=_0x189a61[_0x77bf('0xc')];var _0x23c2cf=_0x3ddb3b['get']({'plain':!![]});if(_0x23c2cf[_0x77bf('0xd')]['toLowerCase']()==='in'||_0x23c2cf[_0x77bf('0xd')][_0x77bf('0xe')]()==='out'&&!_0x23c2cf[_0x77bf('0xf')]&&!_['isNil'](_0x23c2cf[_0x77bf('0x10')])){_0x28f614['FaxInteraction'][_0x77bf('0x11')]({'where':{'id':_0x23c2cf[_0x77bf('0x12')]}})[_0x77bf('0x13')](function(_0x261044){if(_0x261044){_0x261044[_0x77bf('0x14')]({'lastMsgAt':_0x23c2cf['createdAt'],'lastMsgDirection':_0x23c2cf[_0x77bf('0xd')][_0x77bf('0xe')]()});}})[_0x77bf('0x15')](function(_0x58b2f4){console['error'](_0x58b2f4);});}_0x2e4198();}},'charset':_0x77bf('0x16'),'collate':_0x77bf('0x17')});}; \ No newline at end of file +var _0x2c0a=['isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x500812,_0x296a3c){var _0x4add02=function(_0x33c252){while(--_0x33c252){_0x500812['push'](_0x500812['shift']());}};_0x4add02(++_0x296a3c);}(_0x2c0a,0xa6));var _0xa2c0=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x2c0a[_0x284506];return _0x1e9ee5;};'use strict';var _=require(_0xa2c0('0x0'));var util=require(_0xa2c0('0x1'));var logger=require('../../config/logger')(_0xa2c0('0x2'));var moment=require(_0xa2c0('0x3'));var BPromise=require(_0xa2c0('0x4'));var rp=require(_0xa2c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa2c0('0x6'));var attributes=require(_0xa2c0('0x7'));module[_0xa2c0('0x8')]=function(_0x248688,_0x1ff016){return _0x248688[_0xa2c0('0x9')](_0xa2c0('0xa'),attributes,{'tableName':_0xa2c0('0xb'),'paranoid':![],'indexes':[{'name':_0xa2c0('0xc'),'fields':['body'],'type':_0xa2c0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x17c91c,_0x3671b8,_0x178c43){var _0x53f359=_0x248688[_0xa2c0('0xe')];var _0x3f7e3e=_0x17c91c[_0xa2c0('0xf')]({'plain':!![]});if(_0x3f7e3e[_0xa2c0('0x10')][_0xa2c0('0x11')]()==='in'||_0x3f7e3e[_0xa2c0('0x10')][_0xa2c0('0x11')]()===_0xa2c0('0x12')&&!_0x3f7e3e[_0xa2c0('0x13')]&&!_[_0xa2c0('0x14')](_0x3f7e3e[_0xa2c0('0x15')])){_0x53f359[_0xa2c0('0x16')][_0xa2c0('0x17')]({'where':{'id':_0x3f7e3e[_0xa2c0('0x18')]}})[_0xa2c0('0x19')](function(_0x25b716){if(_0x25b716){_0x25b716[_0xa2c0('0x1a')]({'lastMsgAt':_0x3f7e3e[_0xa2c0('0x1b')],'lastMsgDirection':_0x3f7e3e[_0xa2c0('0x10')]['toLowerCase']()});}})[_0xa2c0('0x1c')](function(_0x4b388b){console['error'](_0x4b388b);});}_0x178c43();}},'charset':_0xa2c0('0x1d'),'collate':_0xa2c0('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 34b4e8e..e8eee00 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x5e3530,_0x5ee861){var _0x34ef59=function(_0x2c737f){while(--_0x2c737f){_0x5e3530['push'](_0x5e3530['shift']());}};_0x34ef59(++_0x5ee861);}(_0x9f62,0x154));var _0x29f6=function(_0x4dde85,_0x153f07){_0x4dde85=_0x4dde85-0x0;var _0x248375=_0x9f62[_0x4dde85];return _0x248375;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x373d66,_0x147386){var _0x551c90=function(_0x30dbfb){while(--_0x30dbfb){_0x373d66['push'](_0x373d66['shift']());}};_0x551c90(++_0x147386);}(_0xac31,0xca));var _0x1ac3=function(_0x26fa41,_0x18cd8d){_0x26fa41=_0x26fa41-0x0;var _0x18bdbd=_0xac31[_0x26fa41];return _0x18bdbd;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 626a2e8..a48b149 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 _0x7513=['save','remove','update','emit','length','./faxMessage.events'];(function(_0xeb67d8,_0x14a337){var _0x4138f9=function(_0x3b0407){while(--_0x3b0407){_0xeb67d8['push'](_0xeb67d8['shift']());}};_0x4138f9(++_0x14a337);}(_0x7513,0x1b5));var _0x3751=function(_0x3ab287,_0x5103b8){_0x3ab287=_0x3ab287-0x0;var _0x38a448=_0x7513[_0x3ab287];return _0x38a448;};'use strict';var FaxMessageEvents=require(_0x3751('0x0'));var events=[_0x3751('0x1'),_0x3751('0x2'),_0x3751('0x3')];function createListener(_0x20b8c4,_0x262498){return function(_0x339b6d){_0x262498[_0x3751('0x4')](_0x20b8c4,_0x339b6d);};}function removeListener(_0x1e4dcf,_0x14f376){return function(){FaxMessageEvents['removeListener'](_0x1e4dcf,_0x14f376);};}exports['register']=function(_0x410c78){for(var _0x270e99=0x0,_0x1a39b8=events[_0x3751('0x5')];_0x270e99<_0x1a39b8;_0x270e99++){var _0x2c8657=events[_0x270e99];var _0x1195b5=createListener('faxMessage:'+_0x2c8657,_0x410c78);FaxMessageEvents['on'](_0x2c8657,_0x1195b5);}}; \ No newline at end of file +var _0x62a8=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x62a8,0x93));var _0x862a=function(_0x223d6d,_0x513180){_0x223d6d=_0x223d6d-0x0;var _0x1bcb04=_0x62a8[_0x223d6d];return _0x1bcb04;};'use strict';var FaxMessageEvents=require(_0x862a('0x0'));var events=[_0x862a('0x1'),_0x862a('0x2'),_0x862a('0x3')];function createListener(_0x5a5c90,_0x23f3b6){return function(_0x43adba){_0x23f3b6[_0x862a('0x4')](_0x5a5c90,_0x43adba);};}function removeListener(_0x4d635b,_0x2d1fa5){return function(){FaxMessageEvents[_0x862a('0x5')](_0x4d635b,_0x2d1fa5);};}exports[_0x862a('0x6')]=function(_0x2c3679){for(var _0x4aea24=0x0,_0x5f29bd=events[_0x862a('0x7')];_0x4aea24<_0x5f29bd;_0x4aea24++){var _0x1dc2c3=events[_0x4aea24];var _0x55731c=createListener(_0x862a('0x8')+_0x1dc2c3,_0x2c3679);FaxMessageEvents['on'](_0x1dc2c3,_0x55731c);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ad8ddb9..85a5679 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 _0xdace=['/describe','describe','/:id','show','download','tracked','fax','create','update','put','/:id/accept','accept','reject','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x442ab3,_0x2ff685){var _0x27a7d4=function(_0x394307){while(--_0x394307){_0x442ab3['push'](_0x442ab3['shift']());}};_0x27a7d4(++_0x2ff685);}(_0xdace,0xc5));var _0xedac=function(_0x2d9535,_0x4bc592){_0x2d9535=_0x2d9535-0x0;var _0xb4e710=_0xdace[_0x2d9535];return _0xb4e710;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./faxMessage.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['get']('/:id/download',auth[_0xedac('0x9')](),controller[_0xedac('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xedac('0x10')](_0xedac('0x11'),'faxmessage:create'),controller[_0xedac('0x12')]);router['put'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0x13')]);router[_0xedac('0x14')](_0xedac('0x15'),auth[_0xedac('0x9')](),controller[_0xedac('0x16')]);router[_0xedac('0x14')]('/:id/reject',auth[_0xedac('0x9')](),controller[_0xedac('0x17')]);router[_0xedac('0x18')](_0xedac('0xd'),auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x19')]=router; \ No newline at end of file +var _0xd3d1=['put','update','accept','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create'];(function(_0xaf5b83,_0x3ac943){var _0x32433b=function(_0x366018){while(--_0x366018){_0xaf5b83['push'](_0xaf5b83['shift']());}};_0x32433b(++_0x3ac943);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd3d1[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var fs_extra=require(_0x1d3d('0x4'));var auth=require(_0x1d3d('0x5'));var interaction=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var controller=require(_0x1d3d('0x8'));router[_0x1d3d('0x9')]('/',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0x9')](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0x9')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller['show']);router[_0x1d3d('0x9')](_0x1d3d('0xf'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x10')]);router[_0x1d3d('0x11')]('/',auth[_0x1d3d('0xa')](),interaction[_0x1d3d('0x12')](_0x1d3d('0x13'),_0x1d3d('0x14')),controller[_0x1d3d('0x15')]);router[_0x1d3d('0x16')]('/:id',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x17')]);router['put']('/:id/accept',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x18')]);router[_0x1d3d('0x16')]('/:id/reject',auth[_0x1d3d('0xa')](),controller['reject']);router[_0x1d3d('0x19')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x1a')]);module[_0x1d3d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 72e7a1d..eb36ce2 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 _0xb199=['rrmemory','beepall','roundrobin','INTEGER','exports','STRING','name','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb199,0xdc));var _0x9b19=function(_0x3e9cf4,_0x2a7b9c){_0x3e9cf4=_0x3e9cf4-0x0;var _0x445742=_0xb199[_0x3e9cf4];return _0x445742;};'use strict';var Sequelize=require('sequelize');module[_0x9b19('0x0')]={'name':{'type':Sequelize[_0x9b19('0x1')],'unique':_0x9b19('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9b19('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b19('0x3')](_0x9b19('0x4'),_0x9b19('0x5'),_0x9b19('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9b19('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x97a1=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x47a4ae,_0x471b22){var _0x1fc269=function(_0x21ddc4){while(--_0x21ddc4){_0x47a4ae['push'](_0x47a4ae['shift']());}};_0x1fc269(++_0x471b22);}(_0x97a1,0x1e6));var _0x197a=function(_0x1f55cb,_0x35b298){_0x1f55cb=_0x1f55cb-0x0;var _0x3b53a0=_0x97a1[_0x1f55cb];return _0x3b53a0;};'use strict';var Sequelize=require(_0x197a('0x0'));module['exports']={'name':{'type':Sequelize[_0x197a('0x1')],'unique':_0x197a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x197a('0x1')]},'timeout':{'type':Sequelize[_0x197a('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x197a('0x4')](_0x197a('0x5'),_0x197a('0x6'),_0x197a('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x197a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index f49eeff..13be9e2 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 _0xb307=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','name','index','FaxQueue','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','params','keys','rawAttributes','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','pick','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','User','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','includes','all','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0xb307,0x10b));var _0x7b30=function(_0x28b254,_0x20c0cd){_0x28b254=_0x28b254-0x0;var _0x1a1f34=_0xb307[_0x28b254];return _0x1a1f34;};'use strict';var emlformat=require(_0x7b30('0x0'));var rimraf=require(_0x7b30('0x1'));var zipdir=require(_0x7b30('0x2'));var jsonpatch=require(_0x7b30('0x3'));var rp=require('request-promise');var moment=require(_0x7b30('0x4'));var BPromise=require(_0x7b30('0x5'));var Mustache=require('mustache');var util=require(_0x7b30('0x6'));var path=require(_0x7b30('0x7'));var sox=require(_0x7b30('0x8'));var csv=require(_0x7b30('0x9'));var ejs=require(_0x7b30('0xa'));var fs=require('fs');var fs_extra=require(_0x7b30('0xb'));var _=require(_0x7b30('0xc'));var squel=require(_0x7b30('0xd'));var crypto=require('crypto');var jsforce=require(_0x7b30('0xe'));var deskjs=require(_0x7b30('0xf'));var toCsv=require(_0x7b30('0x9'));var querystring=require(_0x7b30('0x10'));var Papa=require(_0x7b30('0x11'));var Redis=require(_0x7b30('0x12'));var authService=require(_0x7b30('0x13'));var qs=require(_0x7b30('0x14'));var as=require(_0x7b30('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b30('0x16'))(_0x7b30('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b30('0x18'));var db=require(_0x7b30('0x19'))['db'];config[_0x7b30('0x1a')]=_['defaults'](config['redis'],{'host':_0x7b30('0x1b'),'port':0x18eb});var socket=require(_0x7b30('0x1c'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x2d1d92,_0x211f56){_0x211f56=_0x211f56||0xcc;return function(_0x362bea){if(_0x362bea){return _0x2d1d92['sendStatus'](_0x211f56);}return _0x2d1d92[_0x7b30('0x1d')](_0x211f56)[_0x7b30('0x1e')]();};}function respondWithResult(_0xd4682f,_0x15cbd4){_0x15cbd4=_0x15cbd4||0xc8;return function(_0x34713e){if(_0x34713e){return _0xd4682f[_0x7b30('0x1d')](_0x15cbd4)['json'](_0x34713e);}};}function respondWithFilteredResult(_0x62b48d,_0x380ae5){return function(_0x38bde9){if(_0x38bde9){var _0x274b56=typeof _0x380ae5[_0x7b30('0x1f')]===_0x7b30('0x20')&&typeof _0x380ae5['limit']===_0x7b30('0x20');var _0x38345e=_0x38bde9[_0x7b30('0x21')];var _0xd876a7=_0x274b56?0x0:_0x380ae5[_0x7b30('0x1f')];var _0x5c51d7=_0x274b56?_0x38bde9[_0x7b30('0x21')]:_0x380ae5[_0x7b30('0x1f')]+_0x380ae5[_0x7b30('0x22')];var _0x145dbe;if(_0x5c51d7>=_0x38345e){_0x5c51d7=_0x38345e;_0x145dbe=0xc8;}else{_0x145dbe=0xce;}_0x62b48d[_0x7b30('0x1d')](_0x145dbe);return _0x62b48d[_0x7b30('0x23')]('Content-Range',_0xd876a7+'-'+_0x5c51d7+'/'+_0x38345e)[_0x7b30('0x24')](_0x38bde9);}return null;};}function patchUpdates(_0xbfa4ae){return function(_0xca7522){try{jsonpatch[_0x7b30('0x25')](_0xca7522,_0xbfa4ae,!![]);}catch(_0xb1a2c7){return BPromise[_0x7b30('0x26')](_0xb1a2c7);}return _0xca7522[_0x7b30('0x27')]();};}function saveUpdates(_0x2686b7,_0x169bee){return function(_0x161515){if(_0x161515){return _0x161515[_0x7b30('0x28')](_0x2686b7)['then'](function(_0x534642){return _0x534642;});}return null;};}function removeEntity(_0x52c48f,_0x44faa1){return function(_0xd0e9e7){if(_0xd0e9e7){return _0xd0e9e7['destroy']()[_0x7b30('0x29')](function(){var _0x12f986=_0xd0e9e7[_0x7b30('0x2a')]({'plain':!![]});var _0x462731=_0x7b30('0x2b');return db[_0x7b30('0x2c')][_0x7b30('0x2d')]({'where':{'type':_0x462731,'resourceId':_0x12f986['id']}})['then'](function(){return _0xd0e9e7;});})['then'](function(){_0x52c48f[_0x7b30('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6414,_0x4cdde4){return function(_0x16d21b){if(!_0x16d21b){_0x2c6414['sendStatus'](0x194);}return _0x16d21b;};}function handleError(_0x4f1b80,_0x27e779){_0x27e779=_0x27e779||0x1f4;return function(_0x3ae277){logger[_0x7b30('0x2e')](_0x3ae277['stack']);if(_0x3ae277[_0x7b30('0x2f')]){delete _0x3ae277[_0x7b30('0x2f')];}_0x4f1b80[_0x7b30('0x1d')](_0x27e779)['send'](_0x3ae277);};}exports[_0x7b30('0x30')]=function(_0x58792f,_0x10f7cd){var _0x141ec4={},_0x19e2f7={},_0x4ccc43={'count':0x0,'rows':[]};var _0x151c82=_['map'](db[_0x7b30('0x31')]['rawAttributes'],function(_0x4bb2ae){return{'name':_0x4bb2ae[_0x7b30('0x32')],'type':_0x4bb2ae[_0x7b30('0x33')][_0x7b30('0x34')]};});_0x19e2f7[_0x7b30('0x35')]=_['map'](_0x151c82,_0x7b30('0x2f'));_0x19e2f7['query']=_['keys'](_0x58792f[_0x7b30('0x36')]);_0x19e2f7[_0x7b30('0x37')]=_[_0x7b30('0x38')](_0x19e2f7['model'],_0x19e2f7[_0x7b30('0x36')]);_0x141ec4[_0x7b30('0x39')]=_[_0x7b30('0x38')](_0x19e2f7['model'],qs['fields'](_0x58792f[_0x7b30('0x36')]['fields']));_0x141ec4[_0x7b30('0x39')]=_0x141ec4[_0x7b30('0x39')][_0x7b30('0x3a')]?_0x141ec4[_0x7b30('0x39')]:_0x19e2f7[_0x7b30('0x35')];if(!_0x58792f[_0x7b30('0x36')]['hasOwnProperty'](_0x7b30('0x3b'))){_0x141ec4[_0x7b30('0x22')]=qs['limit'](_0x58792f[_0x7b30('0x36')]['limit']);_0x141ec4[_0x7b30('0x1f')]=qs[_0x7b30('0x1f')](_0x58792f[_0x7b30('0x36')]['offset']);}_0x141ec4[_0x7b30('0x3c')]=qs[_0x7b30('0x3d')](_0x58792f[_0x7b30('0x36')][_0x7b30('0x3d')]);_0x141ec4[_0x7b30('0x3e')]=qs[_0x7b30('0x37')](_['pick'](_0x58792f[_0x7b30('0x36')],_0x19e2f7['filters']),_0x151c82);if(_0x58792f[_0x7b30('0x36')][_0x7b30('0x3f')]){_0x141ec4[_0x7b30('0x3e')]=_[_0x7b30('0x40')](_0x141ec4[_0x7b30('0x3e')],{'$or':_[_0x7b30('0x41')](_0x151c82,function(_0x451c38){if(_0x451c38[_0x7b30('0x33')]!==_0x7b30('0x42')){var _0x165060={};_0x165060[_0x451c38[_0x7b30('0x2f')]]={'$like':'%'+_0x58792f[_0x7b30('0x36')][_0x7b30('0x3f')]+'%'};return _0x165060;}})});}_0x141ec4=_['merge']({},_0x141ec4,_0x58792f[_0x7b30('0x43')]);var _0x17d149={'where':_0x141ec4[_0x7b30('0x3e')]};return db['FaxQueue'][_0x7b30('0x21')](_0x17d149)['then'](function(_0x59e322){_0x4ccc43[_0x7b30('0x21')]=_0x59e322;if(_0x58792f[_0x7b30('0x36')]['includeAll']){_0x141ec4[_0x7b30('0x44')]=[{'all':!![]}];}return db[_0x7b30('0x31')][_0x7b30('0x45')](_0x141ec4);})['then'](function(_0x4629ab){_0x4ccc43[_0x7b30('0x46')]=_0x4629ab;return _0x4ccc43;})['then'](respondWithFilteredResult(_0x10f7cd,_0x141ec4))['catch'](handleError(_0x10f7cd,null));};exports[_0x7b30('0x47')]=function(_0x3c50be,_0x54382c){var _0x3ae9c3={'raw':!![],'where':{'id':_0x3c50be[_0x7b30('0x48')]['id']}},_0x16d0c3={};_0x16d0c3['model']=_[_0x7b30('0x49')](db[_0x7b30('0x31')][_0x7b30('0x4a')]);_0x16d0c3[_0x7b30('0x36')]=_['keys'](_0x3c50be['query']);_0x16d0c3[_0x7b30('0x37')]=_[_0x7b30('0x38')](_0x16d0c3[_0x7b30('0x35')],_0x16d0c3['query']);_0x3ae9c3['attributes']=_[_0x7b30('0x38')](_0x16d0c3[_0x7b30('0x35')],qs[_0x7b30('0x4b')](_0x3c50be['query'][_0x7b30('0x4b')]));_0x3ae9c3[_0x7b30('0x39')]=_0x3ae9c3[_0x7b30('0x39')][_0x7b30('0x3a')]?_0x3ae9c3[_0x7b30('0x39')]:_0x16d0c3['model'];if(_0x3c50be['query']['includeAll']){_0x3ae9c3[_0x7b30('0x44')]=[{'all':!![]}];}_0x3ae9c3=_[_0x7b30('0x40')]({},_0x3ae9c3,_0x3c50be[_0x7b30('0x43')]);return db[_0x7b30('0x31')][_0x7b30('0x4c')](_0x3ae9c3)[_0x7b30('0x29')](handleEntityNotFound(_0x54382c,null))[_0x7b30('0x29')](respondWithResult(_0x54382c,null))[_0x7b30('0x4d')](handleError(_0x54382c,null));};exports[_0x7b30('0x4e')]=function(_0x36e63b,_0xb42508){return db['FaxQueue'][_0x7b30('0x4e')](_0x36e63b[_0x7b30('0x4f')],{})[_0x7b30('0x29')](function(_0x35c1be){var _0xb004b4=_0x36e63b[_0x7b30('0x50')][_0x7b30('0x2a')]({'plain':!![]});if(!_0xb004b4)throw new Error(_0x7b30('0x51'));if(_0xb004b4['role']===_0x7b30('0x50')){var _0x1ee401=_0x35c1be[_0x7b30('0x2a')]({'plain':!![]});var _0xff6739=_0x7b30('0x2b');return db[_0x7b30('0x52')][_0x7b30('0x4c')]({'where':{'name':_0xff6739,'userProfileId':_0xb004b4[_0x7b30('0x53')]},'raw':!![]})[_0x7b30('0x29')](function(_0x6f487f){if(_0x6f487f&&_0x6f487f[_0x7b30('0x54')]===0x0){return db[_0x7b30('0x2c')][_0x7b30('0x4e')]({'name':_0x1ee401[_0x7b30('0x2f')],'resourceId':_0x1ee401['id'],'type':_0x6f487f[_0x7b30('0x2f')],'sectionId':_0x6f487f['id']},{})[_0x7b30('0x29')](function(){return _0x35c1be;});}else{return _0x35c1be;}})[_0x7b30('0x4d')](function(_0x306ddb){logger[_0x7b30('0x2e')](_0x7b30('0x55'),_0x306ddb);throw _0x306ddb;});}return _0x35c1be;})[_0x7b30('0x29')](respondWithResult(_0xb42508,0xc9))[_0x7b30('0x4d')](handleError(_0xb42508,null));};exports[_0x7b30('0x28')]=function(_0x48c9df,_0x1829cc){if(_0x48c9df[_0x7b30('0x4f')]['id']){delete _0x48c9df[_0x7b30('0x4f')]['id'];}return db['FaxQueue'][_0x7b30('0x4c')]({'where':{'id':_0x48c9df['params']['id']}})['then'](handleEntityNotFound(_0x1829cc,null))[_0x7b30('0x29')](saveUpdates(_0x48c9df[_0x7b30('0x4f')],null))[_0x7b30('0x29')](respondWithResult(_0x1829cc,null))['catch'](handleError(_0x1829cc,null));};exports[_0x7b30('0x2d')]=function(_0x36bf56,_0x881739){return db[_0x7b30('0x31')]['find']({'where':{'id':_0x36bf56['params']['id']}})[_0x7b30('0x29')](handleEntityNotFound(_0x881739,null))[_0x7b30('0x29')](removeEntity(_0x881739,null))[_0x7b30('0x4d')](handleError(_0x881739,null));};exports['describe']=function(_0x5d0d50,_0x4f76ab){return db[_0x7b30('0x31')][_0x7b30('0x56')]()[_0x7b30('0x29')](respondWithResult(_0x4f76ab,null))[_0x7b30('0x4d')](handleError(_0x4f76ab,null));};exports[_0x7b30('0x57')]=function(_0x1c1800,_0xdb2e7,_0x59adf6){var _0x4c8fb7={'raw':!![],'where':{}},_0x4501a7={},_0x5a70d3;return db[_0x7b30('0x31')][_0x7b30('0x58')]({'where':{'id':_0x1c1800[_0x7b30('0x48')]['id']}})['then'](handleEntityNotFound(_0xdb2e7,null))['then'](function(_0x125ed8){if(_0x125ed8){_0x5a70d3=_0x125ed8[_0x7b30('0x2a')]({'plain':!![]});_0x4501a7[_0x7b30('0x35')]=_[_0x7b30('0x49')](db[_0x7b30('0x59')][_0x7b30('0x4a')]);_0x4501a7[_0x7b30('0x36')]=_[_0x7b30('0x49')](_0x1c1800[_0x7b30('0x36')]);_0x4501a7[_0x7b30('0x37')]=_[_0x7b30('0x38')](_0x4501a7[_0x7b30('0x35')],_0x4501a7[_0x7b30('0x36')]);_0x4c8fb7['attributes']=_[_0x7b30('0x38')](_0x4501a7[_0x7b30('0x35')],qs['fields'](_0x1c1800['query'][_0x7b30('0x4b')]));_0x4c8fb7[_0x7b30('0x39')]=_0x4c8fb7[_0x7b30('0x39')]['length']?_0x4c8fb7[_0x7b30('0x39')]:_0x4501a7['model'];if(!_0x1c1800[_0x7b30('0x36')][_0x7b30('0x5a')](_0x7b30('0x3b'))){_0x4c8fb7[_0x7b30('0x22')]=qs['limit'](_0x1c1800[_0x7b30('0x36')]['limit']);_0x4c8fb7[_0x7b30('0x1f')]=qs[_0x7b30('0x1f')](_0x1c1800[_0x7b30('0x36')][_0x7b30('0x1f')]);}_0x4c8fb7[_0x7b30('0x3c')]=qs[_0x7b30('0x3d')](_0x1c1800[_0x7b30('0x36')][_0x7b30('0x3d')]);_0x4c8fb7[_0x7b30('0x3e')]=qs[_0x7b30('0x37')](_[_0x7b30('0x5b')](_0x1c1800[_0x7b30('0x36')],_0x4501a7[_0x7b30('0x37')]));_0x4c8fb7[_0x7b30('0x3e')][_0x7b30('0x5c')]=_0x125ed8['id'];if(_0x1c1800[_0x7b30('0x36')][_0x7b30('0x3f')]){_0x4c8fb7[_0x7b30('0x3e')]=_[_0x7b30('0x40')](_0x4c8fb7[_0x7b30('0x3e')],{'$or':_[_0x7b30('0x41')](_0x4c8fb7[_0x7b30('0x39')],function(_0x35a794){var _0x2df45e={};_0x2df45e[_0x35a794]={'$like':'%'+_0x1c1800[_0x7b30('0x36')][_0x7b30('0x3f')]+'%'};return _0x2df45e;})});}_0x4c8fb7=_[_0x7b30('0x40')]({},_0x4c8fb7,_0x1c1800[_0x7b30('0x43')]);return db[_0x7b30('0x59')][_0x7b30('0x45')](_0x4c8fb7);}})[_0x7b30('0x29')](function(_0x3a87c3){if(_0x3a87c3){return db['User'][_0x7b30('0x5d')]({'where':{'id':_['map'](_0x3a87c3,_0x7b30('0x5e')),'role':_0x7b30('0x5f')},'attributes':['id',_0x7b30('0x2f'),_0x7b30('0x60'),_0x7b30('0x61'),_0x7b30('0x62')]});}})[_0x7b30('0x29')](function(_0x4f3d9e){if(_0x4f3d9e){return{'count':_0x4f3d9e[_0x7b30('0x21')],'rows':_[_0x7b30('0x41')](_0x4f3d9e['rows'],function(_0x58274b){return{'membername':_0x58274b['name'],'UserId':_0x58274b['id'],'queue_name':_0x5a70d3['name'],'FaxQueueId':_0x5a70d3['id'],'interface':util['format'](_0x7b30('0x63'),_0x7b30('0x64'),_0x58274b['name']),'penalty':0x0,'paused':_0x58274b['faxPause'],'createdAt':_0x58274b[_0x7b30('0x62')],'updatedAt':_0x58274b[_0x7b30('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xdb2e7,_0x4c8fb7))[_0x7b30('0x4d')](handleError(_0xdb2e7,null));};exports[_0x7b30('0x65')]=function(_0x113a4c,_0x4f1e6e,_0x568c24){var _0x32a4af={};var _0x2a36e8={};var _0x46f5df;var _0x44fe71;return db[_0x7b30('0x31')][_0x7b30('0x58')]({'where':{'id':_0x113a4c[_0x7b30('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f1e6e,null))[_0x7b30('0x29')](function(_0x4f7ae2){if(_0x4f7ae2){_0x46f5df=_0x4f7ae2;_0x2a36e8['model']=_[_0x7b30('0x49')](db['Team'][_0x7b30('0x4a')]);_0x2a36e8['query']=_['keys'](_0x113a4c['query']);_0x2a36e8[_0x7b30('0x37')]=_[_0x7b30('0x38')](_0x2a36e8[_0x7b30('0x35')],_0x2a36e8[_0x7b30('0x36')]);_0x32a4af['attributes']=_[_0x7b30('0x38')](_0x2a36e8[_0x7b30('0x35')],qs['fields'](_0x113a4c[_0x7b30('0x36')][_0x7b30('0x4b')]));_0x32a4af['attributes']=_0x32a4af[_0x7b30('0x39')]['length']?_0x32a4af[_0x7b30('0x39')]:_0x2a36e8[_0x7b30('0x35')];_0x32a4af[_0x7b30('0x3c')]=qs[_0x7b30('0x3d')](_0x113a4c[_0x7b30('0x36')]['sort']);_0x32a4af[_0x7b30('0x3e')]=qs[_0x7b30('0x37')](_['pick'](_0x113a4c[_0x7b30('0x36')],_0x2a36e8[_0x7b30('0x37')]));if(_0x113a4c[_0x7b30('0x36')][_0x7b30('0x3f')]){_0x32a4af[_0x7b30('0x3e')]=_[_0x7b30('0x40')](_0x32a4af['where'],{'$or':_[_0x7b30('0x41')](_0x32a4af[_0x7b30('0x39')],function(_0x16525d){var _0x19ea9d={};_0x19ea9d[_0x16525d]={'$like':'%'+_0x113a4c[_0x7b30('0x36')][_0x7b30('0x3f')]+'%'};return _0x19ea9d;})});}_0x32a4af=_[_0x7b30('0x40')]({},_0x32a4af,_0x113a4c[_0x7b30('0x43')]);return _0x46f5df['getTeams'](_0x32a4af);}})[_0x7b30('0x29')](function(_0x33e55d){if(_0x33e55d){_0x44fe71=_0x33e55d[_0x7b30('0x3a')];if(!_0x113a4c['query'][_0x7b30('0x5a')](_0x7b30('0x3b'))){_0x32a4af[_0x7b30('0x22')]=qs[_0x7b30('0x22')](_0x113a4c[_0x7b30('0x36')]['limit']);_0x32a4af['offset']=qs[_0x7b30('0x1f')](_0x113a4c['query']['offset']);}return _0x46f5df[_0x7b30('0x65')](_0x32a4af);}})[_0x7b30('0x29')](function(_0x28b1b3){if(_0x28b1b3){return _0x28b1b3?{'count':_0x44fe71,'rows':_0x28b1b3}:null;}})['then'](respondWithResult(_0x4f1e6e,null))[_0x7b30('0x4d')](handleError(_0x4f1e6e,null));};exports['addTeams']=function(_0x5be83c,_0x242fb0,_0x4bcad6){var _0x36d7b0=_0x5be83c[_0x7b30('0x4f')][_0x7b30('0x66')];return db[_0x7b30('0x67')]['findAll']({'where':{'id':_0x36d7b0},'attributes':['id'],'include':[{'model':db[_0x7b30('0x68')],'as':_0x7b30('0x69'),'attributes':['id',_0x7b30('0x2f'),_0x7b30('0x6a'),_0x7b30('0x6b'),'interface'],'raw':!![]}]})[_0x7b30('0x29')](function(_0x57ce04){if(_0x57ce04){var _0x528273=_[_0x7b30('0x6c')](_0x57ce04,function(_0x1a4b2e){var _0x593219=_0x1a4b2e[_0x7b30('0x2a')]({'plain':!![]});return _0x593219['Agents'];});return db[_0x7b30('0x31')]['find']({'where':{'id':_0x5be83c[_0x7b30('0x48')]['id']}})[_0x7b30('0x29')](function(_0x576af3){return db['sequelize'][_0x7b30('0x6d')](function(_0x46ad7a){return _0x576af3['addTeams'](_0x36d7b0,{'transaction':_0x46ad7a})[_0x7b30('0x29')](function(){return BPromise[_0x7b30('0x6e')](_0x528273,function(_0x446f36){return db[_0x7b30('0x59')][_0x7b30('0x6f')]({'where':{'UserId':_0x446f36['id'],'FaxQueueId':_0x5be83c[_0x7b30('0x48')]['id']},'transaction':_0x46ad7a});});})['then'](function(){_0x528273[_0x7b30('0x70')](function(_0x9a9a64){socket[_0x7b30('0x71')](_0x7b30('0x72'),{'UserId':_0x9a9a64['id'],'FaxQueueId':_0x576af3['id']});});});});});}})[_0x7b30('0x29')](respondWithStatusCode(_0x242fb0,null))['catch'](handleError(_0x242fb0,null));};exports['removeTeams']=function(_0x4a425d,_0x113bf7,_0x11a401){return db[_0x7b30('0x67')]['findAll']({'where':{'id':_0x4a425d[_0x7b30('0x36')][_0x7b30('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7b30('0x29')](handleEntityNotFound(_0x113bf7,null))['then'](function(_0x17e0f3){var _0x41ec05=_[_0x7b30('0x41')](_0x17e0f3,'id');var _0x4d3e26=[];var _0x15a5aa=[];var _0x442213=squel['select']();_0x442213[_0x7b30('0x73')](_0x7b30('0x74'))[_0x7b30('0x75')](_0x7b30('0x76'),'tq')[_0x7b30('0x77')](_0x7b30('0x78'),'ut',_0x7b30('0x79'))[_0x7b30('0x3e')](_0x7b30('0x7a'),_0x4a425d[_0x7b30('0x48')]['id']);for(var _0x2e6077=0x0;_0x2e6077<_0x17e0f3[_0x7b30('0x3a')];_0x2e6077+=0x1){let _0x425849=_0x17e0f3[_0x2e6077];for(var _0x3a5960=0x0;_0x3a5960<_0x425849['Agents'][_0x7b30('0x3a')];_0x3a5960+=0x1){let _0x22bdc7=_0x425849['Agents'][_0x3a5960];var _0x71049c=_0x442213[_0x7b30('0x7b')]();_0x71049c[_0x7b30('0x3e')](_0x7b30('0x7c'),_0x22bdc7['id']);_0x15a5aa[_0x7b30('0x7d')](db[_0x7b30('0x7e')]['query'](_0x71049c['toString'](),{'type':db['sequelize'][_0x7b30('0x7f')][_0x7b30('0x80')]})['then'](function(_0x572c6e){if(_0x572c6e['length']===0x1){return _0x22bdc7['id'];}else{var _0x5a0ae4=_['every'](_[_0x7b30('0x41')](_0x572c6e,'TeamId'),function(_0x489441){return _[_0x7b30('0x81')](_0x41ec05,_0x489441);});if(_0x5a0ae4){return _0x22bdc7['id'];}}}));}}return BPromise[_0x7b30('0x82')](_0x15a5aa)[_0x7b30('0x29')](function(_0x4b5483){_0x4d3e26=_(_0x4d3e26)['union'](_0x4b5483)['compact']()[_0x7b30('0x83')]();return db['FaxQueue'][_0x7b30('0x4c')]({'where':{'id':_0x4a425d[_0x7b30('0x48')]['id']}})['then'](function(_0x3d32ff){return db[_0x7b30('0x7e')][_0x7b30('0x6d')](function(_0x37ab62){return _0x3d32ff[_0x7b30('0x84')](_0x4a425d['query'][_0x7b30('0x66')],{'transaction':_0x37ab62})[_0x7b30('0x29')](function(){if(!_[_0x7b30('0x85')](_0x4d3e26)){return _0x3d32ff[_0x7b30('0x86')](_0x4d3e26,{'transaction':_0x37ab62});}})[_0x7b30('0x29')](function(){_0x4d3e26[_0x7b30('0x70')](function(_0xd4d525){socket['emit']('userFaxQueue:remove',{'UserId':_0xd4d525,'FaxQueueId':_0x3d32ff['id']});});});});});});})[_0x7b30('0x29')](respondWithStatusCode(_0x113bf7,null))[_0x7b30('0x4d')](handleError(_0x113bf7,null));};exports[_0x7b30('0x87')]=function(_0x663e2d,_0x459698,_0x2ca304){return db[_0x7b30('0x31')][_0x7b30('0x4c')]({'where':{'id':_0x663e2d['params']['id']}})[_0x7b30('0x29')](handleEntityNotFound(_0x459698,null))[_0x7b30('0x29')](function(_0x4ce645){if(_0x4ce645){return _0x4ce645[_0x7b30('0x87')](_0x663e2d[_0x7b30('0x4f')][_0x7b30('0x66')],_[_0x7b30('0x88')](_0x663e2d[_0x7b30('0x4f')],['ids','id'])||{})[_0x7b30('0x89')](function(_0x368030){for(var _0x21467c=0x0;_0x21467c<_0x663e2d[_0x7b30('0x4f')][_0x7b30('0x66')][_0x7b30('0x3a')];_0x21467c+=0x1){socket[_0x7b30('0x71')](_0x7b30('0x72'),{'UserId':Number(_0x663e2d[_0x7b30('0x4f')][_0x7b30('0x66')][_0x21467c]),'FaxQueueId':Number(_0x663e2d[_0x7b30('0x48')]['id'])});}return _0x368030;});}})['then'](respondWithResult(_0x459698,null))[_0x7b30('0x4d')](handleError(_0x459698,null));};exports[_0x7b30('0x86')]=function(_0x519a10,_0x34529e,_0x2d925a){return db[_0x7b30('0x31')]['find']({'where':{'id':_0x519a10[_0x7b30('0x48')]['id']}})[_0x7b30('0x29')](handleEntityNotFound(_0x34529e,null))[_0x7b30('0x29')](function(_0x27235f){if(_0x27235f){return _0x27235f['removeAgents'](_0x519a10['query'][_0x7b30('0x66')])['then'](function(){if(_['isArray'](_0x519a10[_0x7b30('0x36')][_0x7b30('0x66')])){for(var _0x1ddbd0=0x0;_0x1ddbd0<_0x519a10[_0x7b30('0x36')]['ids'][_0x7b30('0x3a')];_0x1ddbd0+=0x1){socket[_0x7b30('0x71')](_0x7b30('0x8a'),{'UserId':Number(_0x519a10[_0x7b30('0x36')][_0x7b30('0x66')][_0x1ddbd0]),'FaxQueueId':Number(_0x519a10[_0x7b30('0x48')]['id'])});}}else{socket[_0x7b30('0x71')](_0x7b30('0x8a'),{'UserId':Number(_0x519a10['query']['ids']),'FaxQueueId':Number(_0x519a10[_0x7b30('0x48')]['id'])});}});}})[_0x7b30('0x29')](respondWithStatusCode(_0x34529e,null))[_0x7b30('0x4d')](handleError(_0x34529e,null));};exports[_0x7b30('0x8b')]=function(_0x20f397,_0x2863bd,_0x1e3de1){var _0x36fbe4={};var _0x4f1f3f={};var _0x53058b;var _0x626ef5;return db[_0x7b30('0x31')]['findOne']({'where':{'id':_0x20f397[_0x7b30('0x48')]['id']}})[_0x7b30('0x29')](handleEntityNotFound(_0x2863bd,null))['then'](function(_0x3a3791){if(_0x3a3791){_0x53058b=_0x3a3791;_0x4f1f3f[_0x7b30('0x35')]=_[_0x7b30('0x49')](db[_0x7b30('0x68')][_0x7b30('0x4a')]);_0x4f1f3f['query']=_[_0x7b30('0x49')](_0x20f397[_0x7b30('0x36')]);_0x4f1f3f['filters']=_[_0x7b30('0x38')](_0x4f1f3f['model'],_0x4f1f3f[_0x7b30('0x36')]);_0x36fbe4[_0x7b30('0x39')]=_['intersection'](_0x4f1f3f['model'],qs[_0x7b30('0x4b')](_0x20f397['query']['fields']));_0x36fbe4['attributes']=_0x36fbe4[_0x7b30('0x39')][_0x7b30('0x3a')]?_0x36fbe4[_0x7b30('0x39')]:_0x4f1f3f[_0x7b30('0x35')];_0x36fbe4[_0x7b30('0x3c')]=qs[_0x7b30('0x3d')](_0x20f397[_0x7b30('0x36')][_0x7b30('0x3d')]);_0x36fbe4[_0x7b30('0x3e')]=qs['filters'](_[_0x7b30('0x5b')](_0x20f397[_0x7b30('0x36')],_0x4f1f3f['filters']));if(_0x20f397[_0x7b30('0x36')][_0x7b30('0x3f')]){_0x36fbe4[_0x7b30('0x3e')]=_[_0x7b30('0x40')](_0x36fbe4['where'],{'$or':_[_0x7b30('0x41')](_0x36fbe4[_0x7b30('0x39')],function(_0x5966c0){var _0x546795={};_0x546795[_0x5966c0]={'$like':'%'+_0x20f397['query'][_0x7b30('0x3f')]+'%'};return _0x546795;})});}_0x36fbe4=_[_0x7b30('0x40')]({},_0x36fbe4,_0x20f397[_0x7b30('0x43')]);return _0x53058b['getAgents'](_0x36fbe4);}})[_0x7b30('0x29')](function(_0x1186ab){if(_0x1186ab){_0x626ef5=_0x1186ab[_0x7b30('0x3a')];if(!_0x20f397[_0x7b30('0x36')][_0x7b30('0x5a')](_0x7b30('0x3b'))){_0x36fbe4[_0x7b30('0x22')]=qs['limit'](_0x20f397[_0x7b30('0x36')][_0x7b30('0x22')]);_0x36fbe4[_0x7b30('0x1f')]=qs[_0x7b30('0x1f')](_0x20f397['query'][_0x7b30('0x1f')]);}return _0x53058b['getAgents'](_0x36fbe4);}})[_0x7b30('0x29')](function(_0x44edb5){if(_0x44edb5){return _0x44edb5?{'count':_0x626ef5,'rows':_0x44edb5}:null;}})[_0x7b30('0x29')](respondWithResult(_0x2863bd,null))[_0x7b30('0x4d')](handleError(_0x2863bd,null));}; \ No newline at end of file +var _0x7cab=['ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','compact','removeTeams','ids','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','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','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','name','send','index','FaxQueue','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','options','count','findAll','rows','catch','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','User','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x7cab,0x9d));var _0xb7ca=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x7cab[_0x20a558];return _0x53d3f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7ca('0x0'));var zipdir=require(_0xb7ca('0x1'));var jsonpatch=require(_0xb7ca('0x2'));var rp=require('request-promise');var moment=require(_0xb7ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb7ca('0x4'));var util=require(_0xb7ca('0x5'));var path=require(_0xb7ca('0x6'));var sox=require(_0xb7ca('0x7'));var csv=require(_0xb7ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7ca('0x9'));var _=require('lodash');var squel=require(_0xb7ca('0xa'));var crypto=require(_0xb7ca('0xb'));var jsforce=require(_0xb7ca('0xc'));var deskjs=require(_0xb7ca('0xd'));var toCsv=require(_0xb7ca('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb7ca('0xe'));var authService=require(_0xb7ca('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb7ca('0x10'));var hardwareService=require(_0xb7ca('0x11'));var logger=require(_0xb7ca('0x12'))(_0xb7ca('0x13'));var utils=require(_0xb7ca('0x14'));var config=require(_0xb7ca('0x15'));var licenseUtil=require(_0xb7ca('0x16'));var db=require('../../mysqldb')['db'];config[_0xb7ca('0x17')]=_['defaults'](config['redis'],{'host':_0xb7ca('0x18'),'port':0x18eb});var socket=require(_0xb7ca('0x19'))(new Redis(config[_0xb7ca('0x17')]));require(_0xb7ca('0x1a'))[_0xb7ca('0x1b')](socket);function respondWithStatusCode(_0x1de9e9,_0x5242a3){_0x5242a3=_0x5242a3||0xcc;return function(_0x5d8510){if(_0x5d8510){return _0x1de9e9[_0xb7ca('0x1c')](_0x5242a3);}return _0x1de9e9[_0xb7ca('0x1d')](_0x5242a3)['end']();};}function respondWithResult(_0x5e4cb5,_0x4a09ae){_0x4a09ae=_0x4a09ae||0xc8;return function(_0x311185){if(_0x311185){return _0x5e4cb5['status'](_0x4a09ae)[_0xb7ca('0x1e')](_0x311185);}};}function respondWithFilteredResult(_0x3eb7be,_0x41ee09){return function(_0xf8d6a1){if(_0xf8d6a1){var _0x5de650=typeof _0x41ee09[_0xb7ca('0x1f')]===_0xb7ca('0x20')&&typeof _0x41ee09[_0xb7ca('0x21')]===_0xb7ca('0x20');var _0x41b85c=_0xf8d6a1['count'];var _0x376ca2=_0x5de650?0x0:_0x41ee09['offset'];var _0x48582d=_0x5de650?_0xf8d6a1['count']:_0x41ee09[_0xb7ca('0x1f')]+_0x41ee09[_0xb7ca('0x21')];var _0x3903e2;if(_0x48582d>=_0x41b85c){_0x48582d=_0x41b85c;_0x3903e2=0xc8;}else{_0x3903e2=0xce;}_0x3eb7be['status'](_0x3903e2);return _0x3eb7be[_0xb7ca('0x22')](_0xb7ca('0x23'),_0x376ca2+'-'+_0x48582d+'/'+_0x41b85c)[_0xb7ca('0x1e')](_0xf8d6a1);}return null;};}function patchUpdates(_0x4c0b7d){return function(_0x5a2ca2){try{jsonpatch[_0xb7ca('0x24')](_0x5a2ca2,_0x4c0b7d,!![]);}catch(_0x320085){return BPromise[_0xb7ca('0x25')](_0x320085);}return _0x5a2ca2[_0xb7ca('0x26')]();};}function saveUpdates(_0x144d1a,_0x434c5e){return function(_0x52f9c8){if(_0x52f9c8){return _0x52f9c8[_0xb7ca('0x27')](_0x144d1a)['then'](function(_0x5d528c){return _0x5d528c;});}return null;};}function removeEntity(_0x5153a9,_0x4c15fb){return function(_0x36655f){if(_0x36655f){return _0x36655f[_0xb7ca('0x28')]()[_0xb7ca('0x29')](function(){var _0x98d15b=_0x36655f[_0xb7ca('0x2a')]({'plain':!![]});var _0x266aae='FaxQueues';return db['UserProfileResource'][_0xb7ca('0x28')]({'where':{'type':_0x266aae,'resourceId':_0x98d15b['id']}})[_0xb7ca('0x29')](function(){return _0x36655f;});})[_0xb7ca('0x29')](function(){_0x5153a9[_0xb7ca('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a40af,_0x3a6d67){return function(_0x18d494){if(!_0x18d494){_0x3a40af[_0xb7ca('0x1c')](0x194);}return _0x18d494;};}function handleError(_0x54cd2c,_0x236a71){_0x236a71=_0x236a71||0x1f4;return function(_0x404541){logger[_0xb7ca('0x2b')](_0x404541[_0xb7ca('0x2c')]);if(_0x404541['name']){delete _0x404541[_0xb7ca('0x2d')];}_0x54cd2c[_0xb7ca('0x1d')](_0x236a71)[_0xb7ca('0x2e')](_0x404541);};}exports[_0xb7ca('0x2f')]=function(_0x37f2fd,_0x24dd4c){var _0x109112={},_0x9d0914={},_0x213518={'count':0x0,'rows':[]};var _0x2b861b=_['map'](db[_0xb7ca('0x30')][_0xb7ca('0x31')],function(_0x5230cf){return{'name':_0x5230cf['fieldName'],'type':_0x5230cf[_0xb7ca('0x32')][_0xb7ca('0x33')]};});_0x9d0914[_0xb7ca('0x34')]=_[_0xb7ca('0x35')](_0x2b861b,_0xb7ca('0x2d'));_0x9d0914[_0xb7ca('0x36')]=_[_0xb7ca('0x37')](_0x37f2fd[_0xb7ca('0x36')]);_0x9d0914[_0xb7ca('0x38')]=_[_0xb7ca('0x39')](_0x9d0914[_0xb7ca('0x34')],_0x9d0914[_0xb7ca('0x36')]);_0x109112['attributes']=_[_0xb7ca('0x39')](_0x9d0914[_0xb7ca('0x34')],qs['fields'](_0x37f2fd[_0xb7ca('0x36')][_0xb7ca('0x3a')]));_0x109112[_0xb7ca('0x3b')]=_0x109112[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0x109112[_0xb7ca('0x3b')]:_0x9d0914[_0xb7ca('0x34')];if(!_0x37f2fd['query']['hasOwnProperty'](_0xb7ca('0x3d'))){_0x109112['limit']=qs['limit'](_0x37f2fd[_0xb7ca('0x36')][_0xb7ca('0x21')]);_0x109112[_0xb7ca('0x1f')]=qs[_0xb7ca('0x1f')](_0x37f2fd[_0xb7ca('0x36')]['offset']);}_0x109112[_0xb7ca('0x3e')]=qs['sort'](_0x37f2fd[_0xb7ca('0x36')][_0xb7ca('0x3f')]);_0x109112['where']=qs[_0xb7ca('0x38')](_[_0xb7ca('0x40')](_0x37f2fd['query'],_0x9d0914['filters']),_0x2b861b);if(_0x37f2fd[_0xb7ca('0x36')][_0xb7ca('0x41')]){_0x109112['where']=_[_0xb7ca('0x42')](_0x109112[_0xb7ca('0x43')],{'$or':_[_0xb7ca('0x35')](_0x2b861b,function(_0x2efe09){if(_0x2efe09[_0xb7ca('0x32')]!=='VIRTUAL'){var _0x5b1625={};_0x5b1625[_0x2efe09['name']]={'$like':'%'+_0x37f2fd[_0xb7ca('0x36')]['filter']+'%'};return _0x5b1625;}})});}_0x109112=_['merge']({},_0x109112,_0x37f2fd[_0xb7ca('0x44')]);var _0x165562={'where':_0x109112['where']};return db[_0xb7ca('0x30')][_0xb7ca('0x45')](_0x165562)[_0xb7ca('0x29')](function(_0x4858fd){_0x213518[_0xb7ca('0x45')]=_0x4858fd;if(_0x37f2fd[_0xb7ca('0x36')]['includeAll']){_0x109112['include']=[{'all':!![]}];}return db['FaxQueue'][_0xb7ca('0x46')](_0x109112);})[_0xb7ca('0x29')](function(_0x3fbe38){_0x213518[_0xb7ca('0x47')]=_0x3fbe38;return _0x213518;})[_0xb7ca('0x29')](respondWithFilteredResult(_0x24dd4c,_0x109112))[_0xb7ca('0x48')](handleError(_0x24dd4c,null));};exports['show']=function(_0x3a1981,_0x122806){var _0x3424d4={'raw':!![],'where':{'id':_0x3a1981[_0xb7ca('0x49')]['id']}},_0x4128c4={};_0x4128c4[_0xb7ca('0x34')]=_['keys'](db[_0xb7ca('0x30')][_0xb7ca('0x31')]);_0x4128c4[_0xb7ca('0x36')]=_[_0xb7ca('0x37')](_0x3a1981[_0xb7ca('0x36')]);_0x4128c4[_0xb7ca('0x38')]=_['intersection'](_0x4128c4[_0xb7ca('0x34')],_0x4128c4[_0xb7ca('0x36')]);_0x3424d4['attributes']=_[_0xb7ca('0x39')](_0x4128c4['model'],qs[_0xb7ca('0x3a')](_0x3a1981['query'][_0xb7ca('0x3a')]));_0x3424d4['attributes']=_0x3424d4[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0x3424d4[_0xb7ca('0x3b')]:_0x4128c4[_0xb7ca('0x34')];if(_0x3a1981[_0xb7ca('0x36')][_0xb7ca('0x4a')]){_0x3424d4[_0xb7ca('0x4b')]=[{'all':!![]}];}_0x3424d4=_[_0xb7ca('0x42')]({},_0x3424d4,_0x3a1981[_0xb7ca('0x44')]);return db['FaxQueue'][_0xb7ca('0x4c')](_0x3424d4)[_0xb7ca('0x29')](handleEntityNotFound(_0x122806,null))[_0xb7ca('0x29')](respondWithResult(_0x122806,null))[_0xb7ca('0x48')](handleError(_0x122806,null));};exports['create']=function(_0x54c4c7,_0x5dd532){return db['FaxQueue'][_0xb7ca('0x4d')](_0x54c4c7[_0xb7ca('0x4e')],{})['then'](function(_0x3dc80b){var _0x2c1725=_0x54c4c7['user'][_0xb7ca('0x2a')]({'plain':!![]});if(!_0x2c1725)throw new Error(_0xb7ca('0x4f'));if(_0x2c1725[_0xb7ca('0x50')]==='user'){var _0x291d0f=_0x3dc80b[_0xb7ca('0x2a')]({'plain':!![]});var _0x953e7d='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x953e7d,'userProfileId':_0x2c1725[_0xb7ca('0x51')]},'raw':!![]})[_0xb7ca('0x29')](function(_0x5c983d){if(_0x5c983d&&_0x5c983d[_0xb7ca('0x52')]===0x0){return db[_0xb7ca('0x53')][_0xb7ca('0x4d')]({'name':_0x291d0f['name'],'resourceId':_0x291d0f['id'],'type':_0x5c983d[_0xb7ca('0x2d')],'sectionId':_0x5c983d['id']},{})[_0xb7ca('0x29')](function(){return _0x3dc80b;});}else{return _0x3dc80b;}})[_0xb7ca('0x48')](function(_0x3e4559){logger[_0xb7ca('0x2b')](_0xb7ca('0x54'),_0x3e4559);throw _0x3e4559;});}return _0x3dc80b;})[_0xb7ca('0x29')](respondWithResult(_0x5dd532,0xc9))['catch'](handleError(_0x5dd532,null));};exports[_0xb7ca('0x27')]=function(_0x231a08,_0x867f9a){if(_0x231a08[_0xb7ca('0x4e')]['id']){delete _0x231a08['body']['id'];}return db[_0xb7ca('0x30')][_0xb7ca('0x4c')]({'where':{'id':_0x231a08['params']['id']}})['then'](handleEntityNotFound(_0x867f9a,null))[_0xb7ca('0x29')](saveUpdates(_0x231a08['body'],null))[_0xb7ca('0x29')](respondWithResult(_0x867f9a,null))[_0xb7ca('0x48')](handleError(_0x867f9a,null));};exports[_0xb7ca('0x28')]=function(_0x19f033,_0x2624d9){return db[_0xb7ca('0x30')][_0xb7ca('0x4c')]({'where':{'id':_0x19f033[_0xb7ca('0x49')]['id']}})['then'](handleEntityNotFound(_0x2624d9,null))['then'](removeEntity(_0x2624d9,null))[_0xb7ca('0x48')](handleError(_0x2624d9,null));};exports[_0xb7ca('0x55')]=function(_0x149580,_0x3b8efc){return db[_0xb7ca('0x30')][_0xb7ca('0x55')]()[_0xb7ca('0x29')](respondWithResult(_0x3b8efc,null))[_0xb7ca('0x48')](handleError(_0x3b8efc,null));};exports[_0xb7ca('0x56')]=function(_0x1bd9a6,_0x33f2e1,_0x4aa476){var _0xbcf816={'raw':!![],'where':{}},_0x40c56e={},_0x5630b7;return db[_0xb7ca('0x30')][_0xb7ca('0x57')]({'where':{'id':_0x1bd9a6[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x33f2e1,null))['then'](function(_0xd7b86b){if(_0xd7b86b){_0x5630b7=_0xd7b86b[_0xb7ca('0x2a')]({'plain':!![]});_0x40c56e[_0xb7ca('0x34')]=_[_0xb7ca('0x37')](db[_0xb7ca('0x58')]['rawAttributes']);_0x40c56e[_0xb7ca('0x36')]=_[_0xb7ca('0x37')](_0x1bd9a6[_0xb7ca('0x36')]);_0x40c56e[_0xb7ca('0x38')]=_[_0xb7ca('0x39')](_0x40c56e[_0xb7ca('0x34')],_0x40c56e[_0xb7ca('0x36')]);_0xbcf816[_0xb7ca('0x3b')]=_[_0xb7ca('0x39')](_0x40c56e[_0xb7ca('0x34')],qs[_0xb7ca('0x3a')](_0x1bd9a6[_0xb7ca('0x36')]['fields']));_0xbcf816[_0xb7ca('0x3b')]=_0xbcf816[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0xbcf816[_0xb7ca('0x3b')]:_0x40c56e['model'];if(!_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x59')](_0xb7ca('0x3d'))){_0xbcf816[_0xb7ca('0x21')]=qs[_0xb7ca('0x21')](_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x21')]);_0xbcf816[_0xb7ca('0x1f')]=qs['offset'](_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x1f')]);}_0xbcf816[_0xb7ca('0x3e')]=qs['sort'](_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x3f')]);_0xbcf816[_0xb7ca('0x43')]=qs[_0xb7ca('0x38')](_[_0xb7ca('0x40')](_0x1bd9a6[_0xb7ca('0x36')],_0x40c56e['filters']));_0xbcf816[_0xb7ca('0x43')]['FaxQueueId']=_0xd7b86b['id'];if(_0x1bd9a6[_0xb7ca('0x36')]['filter']){_0xbcf816['where']=_['merge'](_0xbcf816[_0xb7ca('0x43')],{'$or':_[_0xb7ca('0x35')](_0xbcf816[_0xb7ca('0x3b')],function(_0x4d0c4c){var _0x1491d7={};_0x1491d7[_0x4d0c4c]={'$like':'%'+_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x41')]+'%'};return _0x1491d7;})});}_0xbcf816=_[_0xb7ca('0x42')]({},_0xbcf816,_0x1bd9a6[_0xb7ca('0x44')]);return db[_0xb7ca('0x58')][_0xb7ca('0x46')](_0xbcf816);}})[_0xb7ca('0x29')](function(_0x5d1881){if(_0x5d1881){return db[_0xb7ca('0x5a')][_0xb7ca('0x5b')]({'where':{'id':_['map'](_0x5d1881,'UserId'),'role':_0xb7ca('0x5c')},'attributes':['id',_0xb7ca('0x2d'),_0xb7ca('0x5d'),'updatedAt',_0xb7ca('0x5e')]});}})[_0xb7ca('0x29')](function(_0x3b5994){if(_0x3b5994){return{'count':_0x3b5994[_0xb7ca('0x45')],'rows':_[_0xb7ca('0x35')](_0x3b5994[_0xb7ca('0x47')],function(_0xa0f4cc){return{'membername':_0xa0f4cc[_0xb7ca('0x2d')],'UserId':_0xa0f4cc['id'],'queue_name':_0x5630b7[_0xb7ca('0x2d')],'FaxQueueId':_0x5630b7['id'],'interface':util[_0xb7ca('0x5f')](_0xb7ca('0x60'),_0xb7ca('0x61'),_0xa0f4cc[_0xb7ca('0x2d')]),'penalty':0x0,'paused':_0xa0f4cc[_0xb7ca('0x5d')],'createdAt':_0xa0f4cc[_0xb7ca('0x5e')],'updatedAt':_0xa0f4cc[_0xb7ca('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb7ca('0x29')](respondWithFilteredResult(_0x33f2e1,_0xbcf816))[_0xb7ca('0x48')](handleError(_0x33f2e1,null));};exports[_0xb7ca('0x63')]=function(_0x397104,_0x1f31b3,_0x32e3d7){var _0x5c7e78={};var _0x24831f={};var _0x5b5a69;var _0x552451;return db[_0xb7ca('0x30')][_0xb7ca('0x57')]({'where':{'id':_0x397104[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x1f31b3,null))[_0xb7ca('0x29')](function(_0x28da86){if(_0x28da86){_0x5b5a69=_0x28da86;_0x24831f['model']=_['keys'](db[_0xb7ca('0x64')]['rawAttributes']);_0x24831f[_0xb7ca('0x36')]=_['keys'](_0x397104['query']);_0x24831f[_0xb7ca('0x38')]=_['intersection'](_0x24831f[_0xb7ca('0x34')],_0x24831f[_0xb7ca('0x36')]);_0x5c7e78[_0xb7ca('0x3b')]=_['intersection'](_0x24831f[_0xb7ca('0x34')],qs[_0xb7ca('0x3a')](_0x397104[_0xb7ca('0x36')][_0xb7ca('0x3a')]));_0x5c7e78[_0xb7ca('0x3b')]=_0x5c7e78[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0x5c7e78[_0xb7ca('0x3b')]:_0x24831f[_0xb7ca('0x34')];_0x5c7e78[_0xb7ca('0x3e')]=qs['sort'](_0x397104[_0xb7ca('0x36')][_0xb7ca('0x3f')]);_0x5c7e78[_0xb7ca('0x43')]=qs[_0xb7ca('0x38')](_['pick'](_0x397104[_0xb7ca('0x36')],_0x24831f[_0xb7ca('0x38')]));if(_0x397104[_0xb7ca('0x36')]['filter']){_0x5c7e78[_0xb7ca('0x43')]=_[_0xb7ca('0x42')](_0x5c7e78[_0xb7ca('0x43')],{'$or':_[_0xb7ca('0x35')](_0x5c7e78['attributes'],function(_0xaed428){var _0x19d20b={};_0x19d20b[_0xaed428]={'$like':'%'+_0x397104[_0xb7ca('0x36')][_0xb7ca('0x41')]+'%'};return _0x19d20b;})});}_0x5c7e78=_['merge']({},_0x5c7e78,_0x397104[_0xb7ca('0x44')]);return _0x5b5a69[_0xb7ca('0x63')](_0x5c7e78);}})[_0xb7ca('0x29')](function(_0x526f67){if(_0x526f67){_0x552451=_0x526f67[_0xb7ca('0x3c')];if(!_0x397104[_0xb7ca('0x36')]['hasOwnProperty'](_0xb7ca('0x3d'))){_0x5c7e78[_0xb7ca('0x21')]=qs[_0xb7ca('0x21')](_0x397104[_0xb7ca('0x36')][_0xb7ca('0x21')]);_0x5c7e78[_0xb7ca('0x1f')]=qs[_0xb7ca('0x1f')](_0x397104[_0xb7ca('0x36')]['offset']);}return _0x5b5a69['getTeams'](_0x5c7e78);}})[_0xb7ca('0x29')](function(_0x5c30ca){if(_0x5c30ca){return _0x5c30ca?{'count':_0x552451,'rows':_0x5c30ca}:null;}})[_0xb7ca('0x29')](respondWithResult(_0x1f31b3,null))[_0xb7ca('0x48')](handleError(_0x1f31b3,null));};exports[_0xb7ca('0x65')]=function(_0x56ee33,_0x15d480,_0x4c050f){var _0x2378b9=_0x56ee33['body']['ids'];return db['Team'][_0xb7ca('0x46')]({'where':{'id':_0x2378b9},'attributes':['id'],'include':[{'model':db[_0xb7ca('0x5a')],'as':_0xb7ca('0x66'),'attributes':['id',_0xb7ca('0x2d'),_0xb7ca('0x67'),_0xb7ca('0x68'),_0xb7ca('0x69')],'raw':!![]}]})[_0xb7ca('0x29')](function(_0x30d973){if(_0x30d973){var _0x1d734d=_[_0xb7ca('0x6a')](_0x30d973,function(_0xaa9c9f){var _0x50f366=_0xaa9c9f[_0xb7ca('0x2a')]({'plain':!![]});return _0x50f366[_0xb7ca('0x66')];});return db[_0xb7ca('0x30')][_0xb7ca('0x4c')]({'where':{'id':_0x56ee33[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](function(_0x3d88dd){return db['sequelize'][_0xb7ca('0x6b')](function(_0x2e45ee){return _0x3d88dd[_0xb7ca('0x65')](_0x2378b9,{'transaction':_0x2e45ee})[_0xb7ca('0x29')](function(){return BPromise['each'](_0x1d734d,function(_0x5eabad){return db['UserFaxQueue'][_0xb7ca('0x6c')]({'where':{'UserId':_0x5eabad['id'],'FaxQueueId':_0x56ee33[_0xb7ca('0x49')]['id']},'transaction':_0x2e45ee});});})[_0xb7ca('0x29')](function(){_0x1d734d[_0xb7ca('0x6d')](function(_0x5a5959){socket[_0xb7ca('0x6e')](_0xb7ca('0x6f'),{'UserId':_0x5a5959['id'],'FaxQueueId':_0x3d88dd['id']});});});});});}})[_0xb7ca('0x29')](respondWithStatusCode(_0x15d480,null))['catch'](handleError(_0x15d480,null));};exports['removeTeams']=function(_0x41c7b7,_0x2e4874,_0x344c12){return db[_0xb7ca('0x64')][_0xb7ca('0x46')]({'where':{'id':_0x41c7b7[_0xb7ca('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb7ca('0x5a')],'as':_0xb7ca('0x66'),'attributes':['id'],'raw':!![]}]})[_0xb7ca('0x29')](handleEntityNotFound(_0x2e4874,null))[_0xb7ca('0x29')](function(_0x14be25){var _0x1f1a60=_['map'](_0x14be25,'id');var _0x228035=[];var _0x259a41=[];var _0x32fc4d=squel['select']();_0x32fc4d[_0xb7ca('0x70')](_0xb7ca('0x71'))[_0xb7ca('0x72')](_0xb7ca('0x73'),'tq')[_0xb7ca('0x74')](_0xb7ca('0x75'),'ut',_0xb7ca('0x76'))[_0xb7ca('0x43')](_0xb7ca('0x77'),_0x41c7b7['params']['id']);for(var _0x48344b=0x0;_0x48344b<_0x14be25['length'];_0x48344b+=0x1){let _0x51058b=_0x14be25[_0x48344b];for(var _0x97fbc3=0x0;_0x97fbc3<_0x51058b['Agents']['length'];_0x97fbc3+=0x1){let _0x38d763=_0x51058b['Agents'][_0x97fbc3];var _0x352a28=_0x32fc4d[_0xb7ca('0x78')]();_0x352a28[_0xb7ca('0x43')](_0xb7ca('0x79'),_0x38d763['id']);_0x259a41[_0xb7ca('0x7a')](db['sequelize']['query'](_0x352a28[_0xb7ca('0x7b')](),{'type':db[_0xb7ca('0x7c')][_0xb7ca('0x7d')][_0xb7ca('0x7e')]})[_0xb7ca('0x29')](function(_0x4d04c0){if(_0x4d04c0[_0xb7ca('0x3c')]===0x1){return _0x38d763['id'];}else{var _0x156cdb=_[_0xb7ca('0x7f')](_[_0xb7ca('0x35')](_0x4d04c0,_0xb7ca('0x80')),function(_0x279e48){return _[_0xb7ca('0x81')](_0x1f1a60,_0x279e48);});if(_0x156cdb){return _0x38d763['id'];}}}));}}return BPromise['all'](_0x259a41)['then'](function(_0x1d941f){_0x228035=_(_0x228035)['union'](_0x1d941f)[_0xb7ca('0x82')]()['value']();return db['FaxQueue'][_0xb7ca('0x4c')]({'where':{'id':_0x41c7b7[_0xb7ca('0x49')]['id']}})['then'](function(_0x5e9f20){return db[_0xb7ca('0x7c')]['transaction'](function(_0x145cb2){return _0x5e9f20[_0xb7ca('0x83')](_0x41c7b7[_0xb7ca('0x36')][_0xb7ca('0x84')],{'transaction':_0x145cb2})[_0xb7ca('0x29')](function(){if(!_['isEmpty'](_0x228035)){return _0x5e9f20[_0xb7ca('0x85')](_0x228035,{'transaction':_0x145cb2});}})['then'](function(){_0x228035['forEach'](function(_0x4ae116){socket[_0xb7ca('0x6e')](_0xb7ca('0x86'),{'UserId':_0x4ae116,'FaxQueueId':_0x5e9f20['id']});});});});});});})[_0xb7ca('0x29')](respondWithStatusCode(_0x2e4874,null))[_0xb7ca('0x48')](handleError(_0x2e4874,null));};exports[_0xb7ca('0x87')]=function(_0x296e8c,_0x2a3a82,_0x55da84){return db[_0xb7ca('0x30')][_0xb7ca('0x4c')]({'where':{'id':_0x296e8c[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x2a3a82,null))[_0xb7ca('0x29')](function(_0x3f1099){if(_0x3f1099){return _0x3f1099[_0xb7ca('0x87')](_0x296e8c['body']['ids'],_[_0xb7ca('0x88')](_0x296e8c['body'],[_0xb7ca('0x84'),'id'])||{})['spread'](function(_0xba3208){for(var _0xd18c8f=0x0;_0xd18c8f<_0x296e8c['body'][_0xb7ca('0x84')][_0xb7ca('0x3c')];_0xd18c8f+=0x1){socket[_0xb7ca('0x6e')](_0xb7ca('0x6f'),{'UserId':Number(_0x296e8c[_0xb7ca('0x4e')][_0xb7ca('0x84')][_0xd18c8f]),'FaxQueueId':Number(_0x296e8c['params']['id'])});}return _0xba3208;});}})[_0xb7ca('0x29')](respondWithResult(_0x2a3a82,null))['catch'](handleError(_0x2a3a82,null));};exports[_0xb7ca('0x85')]=function(_0x2d4adc,_0x46669e,_0x4c9146){return db['FaxQueue'][_0xb7ca('0x4c')]({'where':{'id':_0x2d4adc['params']['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x46669e,null))[_0xb7ca('0x29')](function(_0x2fa91a){if(_0x2fa91a){return _0x2fa91a[_0xb7ca('0x85')](_0x2d4adc['query']['ids'])[_0xb7ca('0x29')](function(){if(_[_0xb7ca('0x89')](_0x2d4adc[_0xb7ca('0x36')][_0xb7ca('0x84')])){for(var _0x290a22=0x0;_0x290a22<_0x2d4adc[_0xb7ca('0x36')][_0xb7ca('0x84')][_0xb7ca('0x3c')];_0x290a22+=0x1){socket[_0xb7ca('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x2d4adc[_0xb7ca('0x36')][_0xb7ca('0x84')][_0x290a22]),'FaxQueueId':Number(_0x2d4adc[_0xb7ca('0x49')]['id'])});}}else{socket[_0xb7ca('0x6e')](_0xb7ca('0x86'),{'UserId':Number(_0x2d4adc[_0xb7ca('0x36')][_0xb7ca('0x84')]),'FaxQueueId':Number(_0x2d4adc['params']['id'])});}});}})[_0xb7ca('0x29')](respondWithStatusCode(_0x46669e,null))[_0xb7ca('0x48')](handleError(_0x46669e,null));};exports['getAgents']=function(_0x2584d7,_0x2bbafe,_0xee65f8){var _0x4692c1={};var _0x2f5d24={};var _0x265280;var _0x472b3c;return db[_0xb7ca('0x30')][_0xb7ca('0x57')]({'where':{'id':_0x2584d7[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x2bbafe,null))[_0xb7ca('0x29')](function(_0x1354b2){if(_0x1354b2){_0x265280=_0x1354b2;_0x2f5d24[_0xb7ca('0x34')]=_[_0xb7ca('0x37')](db[_0xb7ca('0x5a')][_0xb7ca('0x31')]);_0x2f5d24['query']=_[_0xb7ca('0x37')](_0x2584d7[_0xb7ca('0x36')]);_0x2f5d24[_0xb7ca('0x38')]=_[_0xb7ca('0x39')](_0x2f5d24['model'],_0x2f5d24[_0xb7ca('0x36')]);_0x4692c1[_0xb7ca('0x3b')]=_[_0xb7ca('0x39')](_0x2f5d24[_0xb7ca('0x34')],qs[_0xb7ca('0x3a')](_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x3a')]));_0x4692c1['attributes']=_0x4692c1[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0x4692c1['attributes']:_0x2f5d24[_0xb7ca('0x34')];_0x4692c1[_0xb7ca('0x3e')]=qs[_0xb7ca('0x3f')](_0x2584d7[_0xb7ca('0x36')]['sort']);_0x4692c1[_0xb7ca('0x43')]=qs['filters'](_[_0xb7ca('0x40')](_0x2584d7[_0xb7ca('0x36')],_0x2f5d24[_0xb7ca('0x38')]));if(_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x41')]){_0x4692c1['where']=_['merge'](_0x4692c1[_0xb7ca('0x43')],{'$or':_[_0xb7ca('0x35')](_0x4692c1[_0xb7ca('0x3b')],function(_0x2ad1fc){var _0xfeea8={};_0xfeea8[_0x2ad1fc]={'$like':'%'+_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x41')]+'%'};return _0xfeea8;})});}_0x4692c1=_[_0xb7ca('0x42')]({},_0x4692c1,_0x2584d7['options']);return _0x265280['getAgents'](_0x4692c1);}})[_0xb7ca('0x29')](function(_0x3e945c){if(_0x3e945c){_0x472b3c=_0x3e945c[_0xb7ca('0x3c')];if(!_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x59')]('nolimit')){_0x4692c1['limit']=qs[_0xb7ca('0x21')](_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x21')]);_0x4692c1['offset']=qs['offset'](_0x2584d7['query'][_0xb7ca('0x1f')]);}return _0x265280[_0xb7ca('0x8a')](_0x4692c1);}})['then'](function(_0xc490fc){if(_0xc490fc){return _0xc490fc?{'count':_0x472b3c,'rows':_0xc490fc}:null;}})[_0xb7ca('0x29')](respondWithResult(_0x2bbafe,null))[_0xb7ca('0x48')](handleError(_0x2bbafe,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5728af6..7461d47 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 _0x886f=['hook','exports','events','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x24bbc9,_0x49c2c2){var _0x176a0b=function(_0x3ea511){while(--_0x3ea511){_0x24bbc9['push'](_0x24bbc9['shift']());}};_0x176a0b(++_0x49c2c2);}(_0x886f,0x1c4));var _0xf886=function(_0x1aeae5,_0x44074d){_0x1aeae5=_0x1aeae5-0x0;var _0x59096d=_0x886f[_0x1aeae5];return _0x59096d;};'use strict';var EventEmitter=require(_0xf886('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xf886('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf886('0x2')](0x0);var events={'afterCreate':_0xf886('0x3'),'afterUpdate':_0xf886('0x4'),'afterDestroy':_0xf886('0x5')};function emitEvent(_0x4bbb33){return function(_0x5c8669,_0x1c8e42,_0x8f8a3f){FaxQueueEvents['emit'](_0x4bbb33+':'+_0x5c8669['id'],_0x5c8669);FaxQueueEvents[_0xf886('0x6')](_0x4bbb33,_0x5c8669);_0x8f8a3f(null);};}for(var e in events){if(events[_0xf886('0x7')](e)){var event=events[e];FaxQueue[_0xf886('0x8')](e,emitEvent(event));}}module[_0xf886('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x97fa=['remove','emit','hasOwnProperty','exports','events','FaxQueue','setMaxListeners'];(function(_0x43c920,_0x19b4eb){var _0x1c7cb6=function(_0x556815){while(--_0x556815){_0x43c920['push'](_0x43c920['shift']());}};_0x1c7cb6(++_0x19b4eb);}(_0x97fa,0x1bd));var _0xa97f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97fa[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa97f('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xa97f('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa97f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa97f('0x3')};function emitEvent(_0x2200db){return function(_0x1e7c78,_0xc8d666,_0x26f046){FaxQueueEvents[_0xa97f('0x4')](_0x2200db+':'+_0x1e7c78['id'],_0x1e7c78);FaxQueueEvents[_0xa97f('0x4')](_0x2200db,_0x1e7c78);_0x26f046(null);};}for(var e in events){if(events[_0xa97f('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xa97f('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 7f3fbda..5c8e76e 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 _0xd4dc=['fax_queues','util','../../config/logger','api','rimraf','exports','FaxQueue'];(function(_0x2ed4e9,_0x5dc89b){var _0x515748=function(_0x5a0c67){while(--_0x5a0c67){_0x2ed4e9['push'](_0x2ed4e9['shift']());}};_0x515748(++_0x5dc89b);}(_0xd4dc,0x1ac));var _0xcd4d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xd4dc[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0xcd4d('0x0'));var logger=require(_0xcd4d('0x1'))(_0xcd4d('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(_0xcd4d('0x3'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xcd4d('0x4')]=function(_0x49ba89,_0x297ec4){return _0x49ba89['define'](_0xcd4d('0x5'),attributes,{'tableName':_0xcd4d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb701=['rimraf','./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0xb701,0x1a9));var _0x1b70=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb701[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1b70('0x0'));var util=require(_0x1b70('0x1'));var logger=require(_0x1b70('0x2'))('api');var moment=require(_0x1b70('0x3'));var BPromise=require(_0x1b70('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b70('0x5'));var config=require('../../config/environment');var attributes=require(_0x1b70('0x6'));module[_0x1b70('0x7')]=function(_0x5a3115,_0x1b215c){return _0x5a3115[_0x1b70('0x8')](_0x1b70('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 45f8faf..a919335 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 _0xd5dd=['./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','raw','options','where','attributes','limit','map','include','model','then','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xf176a6,_0xa6f3ab){var _0x4ee953=function(_0xd9bd2b){while(--_0xd9bd2b){_0xf176a6['push'](_0xf176a6['shift']());}};_0x4ee953(++_0xa6f3ab);}(_0xd5dd,0x8b));var _0xdd5d=function(_0x3d86da,_0x282644){_0x3d86da=_0x3d86da-0x0;var _0xdea050=_0xd5dd[_0x3d86da];return _0xdea050;};'use strict';var _=require(_0xdd5d('0x0'));var util=require('util');var moment=require(_0xdd5d('0x1'));var BPromise=require(_0xdd5d('0x2'));var rs=require(_0xdd5d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd5d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd5d('0x5'))(_0xdd5d('0x6'));var config=require('../../config/environment');var jayson=require(_0xdd5d('0x7'));var client=jayson['client'][_0xdd5d('0x8')]({'port':0x232a});config[_0xdd5d('0x9')]=_[_0xdd5d('0xa')](config[_0xdd5d('0x9')],{'host':_0xdd5d('0xb'),'port':0x18eb});var socket=require(_0xdd5d('0xc'))(new Redis(config['redis']));require(_0xdd5d('0xd'))['register'](socket);function respondWithRpcPromise(_0x5cbd6f,_0x5a1bda,_0xe451fe){return new BPromise(function(_0x106009,_0x9edf3e){return client[_0xdd5d('0xe')](_0x5cbd6f,_0xe451fe)['then'](function(_0x55cb8f){logger[_0xdd5d('0xf')](_0xdd5d('0x10'),_0x5a1bda,_0xdd5d('0x11'));logger[_0xdd5d('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5a1bda,_0xdd5d('0x11'),JSON[_0xdd5d('0x13')](_0x55cb8f));if(_0x55cb8f[_0xdd5d('0x14')]){if(_0x55cb8f[_0xdd5d('0x14')][_0xdd5d('0x15')]===0x1f4){logger[_0xdd5d('0x14')]('FaxQueue,\x20%s,\x20%s',_0x5a1bda,_0x55cb8f[_0xdd5d('0x14')][_0xdd5d('0x16')]);return _0x9edf3e(_0x55cb8f[_0xdd5d('0x14')][_0xdd5d('0x16')]);}logger[_0xdd5d('0x14')](_0xdd5d('0x10'),_0x5a1bda,_0x55cb8f[_0xdd5d('0x14')][_0xdd5d('0x16')]);return _0x106009(_0x55cb8f['error'][_0xdd5d('0x16')]);}else{logger[_0xdd5d('0xf')](_0xdd5d('0x10'),_0x5a1bda,_0xdd5d('0x11'));_0x106009(_0x55cb8f['result'][_0xdd5d('0x16')]);}})[_0xdd5d('0x17')](function(_0x1ae689){logger[_0xdd5d('0x14')](_0xdd5d('0x10'),_0x5a1bda,_0x1ae689);_0x9edf3e(_0x1ae689);});});}exports[_0xdd5d('0x18')]=function(_0x509b71){var _0x57171c=this;return new Promise(function(_0x333d64,_0xcc22d1){return db[_0xdd5d('0x19')][_0xdd5d('0x1a')]({'raw':_0x509b71['options']?_0x509b71['options'][_0xdd5d('0x1b')]===undefined?!![]:![]:!![],'where':_0x509b71[_0xdd5d('0x1c')]?_0x509b71[_0xdd5d('0x1c')][_0xdd5d('0x1d')]||null:null,'attributes':_0x509b71['options']?_0x509b71[_0xdd5d('0x1c')][_0xdd5d('0x1e')]||null:null,'limit':_0x509b71[_0xdd5d('0x1c')]?_0x509b71[_0xdd5d('0x1c')][_0xdd5d('0x1f')]||null:null,'include':_0x509b71[_0xdd5d('0x1c')]?_0x509b71['options']['include']?_[_0xdd5d('0x20')](_0x509b71[_0xdd5d('0x1c')][_0xdd5d('0x21')],function(_0xf94121){return{'model':db[_0xf94121['model']],'as':_0xf94121['as'],'attributes':_0xf94121[_0xdd5d('0x1e')],'include':_0xf94121['include']?_[_0xdd5d('0x20')](_0xf94121['include'],function(_0x54fe52){return{'model':db[_0x54fe52[_0xdd5d('0x22')]],'as':_0x54fe52['as'],'attributes':_0x54fe52[_0xdd5d('0x1e')],'include':_0x54fe52[_0xdd5d('0x21')]?_['map'](_0x54fe52['include'],function(_0x4d115a){return{'model':db[_0x4d115a[_0xdd5d('0x22')]],'as':_0x4d115a['as'],'attributes':_0x4d115a[_0xdd5d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdd5d('0x23')](function(_0x14e5c9){logger[_0xdd5d('0xf')](_0xdd5d('0x18'),_0x509b71);logger[_0xdd5d('0x12')]('GetFaxQueue',_0x509b71,JSON[_0xdd5d('0x13')](_0x14e5c9));_0x333d64(_0x14e5c9);})[_0xdd5d('0x17')](function(_0x5b559a){logger[_0xdd5d('0x14')](_0xdd5d('0x18'),_0x5b559a[_0xdd5d('0x16')],_0x509b71);_0xcc22d1(_0x57171c[_0xdd5d('0x14')](0x1f4,_0x5b559a['message']));});});};exports[_0xdd5d('0x24')]=function(_0x44eb80){var _0x251339=this;return new Promise(function(_0x15967f,_0x347b2f){return db[_0xdd5d('0x19')][_0xdd5d('0x25')]({'raw':_0x44eb80[_0xdd5d('0x1c')]?_0x44eb80['options']['raw']===undefined?!![]:![]:!![],'where':_0x44eb80['options']?_0x44eb80[_0xdd5d('0x1c')][_0xdd5d('0x1d')]||null:null,'attributes':_0x44eb80[_0xdd5d('0x1c')]?_0x44eb80[_0xdd5d('0x1c')]['attributes']||null:null,'include':_0x44eb80[_0xdd5d('0x1c')]?_0x44eb80[_0xdd5d('0x1c')]['include']?_['map'](_0x44eb80['options']['include'],function(_0x1612a0){return{'model':db[_0x1612a0[_0xdd5d('0x22')]],'as':_0x1612a0['as'],'attributes':_0x1612a0[_0xdd5d('0x1e')],'include':_0x1612a0[_0xdd5d('0x21')]?_[_0xdd5d('0x20')](_0x1612a0[_0xdd5d('0x21')],function(_0x142f89){return{'model':db[_0x142f89[_0xdd5d('0x22')]],'as':_0x142f89['as'],'attributes':_0x142f89['attributes'],'include':_0x142f89[_0xdd5d('0x21')]?_['map'](_0x142f89[_0xdd5d('0x21')],function(_0x1c45f7){return{'model':db[_0x1c45f7[_0xdd5d('0x22')]],'as':_0x1c45f7['as'],'attributes':_0x1c45f7[_0xdd5d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdd5d('0x23')](function(_0x4b1dda){logger[_0xdd5d('0xf')](_0xdd5d('0x24'),_0x44eb80);logger[_0xdd5d('0x12')](_0xdd5d('0x24'),_0x44eb80,JSON['stringify'](_0x4b1dda));_0x15967f(_0x4b1dda);})[_0xdd5d('0x17')](function(_0x4f8ce9){logger['error'](_0xdd5d('0x24'),_0x4f8ce9[_0xdd5d('0x16')],_0x44eb80);_0x347b2f(_0x251339[_0xdd5d('0x14')](0x1f4,_0x4f8ce9[_0xdd5d('0x16')]));});});}; \ No newline at end of file +var _0x6a6a=['http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11a06e,_0x596882){var _0x4c9e6c=function(_0x21b2e3){while(--_0x21b2e3){_0x11a06e['push'](_0x11a06e['shift']());}};_0x4c9e6c(++_0x596882);}(_0x6a6a,0x74));var _0xa6a6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6a6a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa6a6('0x0'));var util=require(_0xa6a6('0x1'));var moment=require(_0xa6a6('0x2'));var BPromise=require(_0xa6a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6a6('0x4'));var db=require(_0xa6a6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6a6('0x6'))(_0xa6a6('0x7'));var config=require(_0xa6a6('0x8'));var jayson=require(_0xa6a6('0x9'));var client=jayson['client'][_0xa6a6('0xa')]({'port':0x232a});config[_0xa6a6('0xb')]=_[_0xa6a6('0xc')](config['redis'],{'host':_0xa6a6('0xd'),'port':0x18eb});var socket=require(_0xa6a6('0xe'))(new Redis(config[_0xa6a6('0xb')]));require(_0xa6a6('0xf'))[_0xa6a6('0x10')](socket);function respondWithRpcPromise(_0x116b3f,_0x5d863b,_0x477220){return new BPromise(function(_0x842dc6,_0x16eb3c){return client[_0xa6a6('0x11')](_0x116b3f,_0x477220)[_0xa6a6('0x12')](function(_0x2297b3){logger[_0xa6a6('0x13')]('FaxQueue,\x20%s,\x20%s',_0x5d863b,_0xa6a6('0x14'));logger[_0xa6a6('0x15')](_0xa6a6('0x16'),_0x5d863b,_0xa6a6('0x14'),JSON[_0xa6a6('0x17')](_0x2297b3));if(_0x2297b3[_0xa6a6('0x18')]){if(_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x19')]===0x1f4){logger[_0xa6a6('0x18')](_0xa6a6('0x1a'),_0x5d863b,_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x1b')]);return _0x16eb3c(_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x1b')]);}logger['error'](_0xa6a6('0x1a'),_0x5d863b,_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x1b')]);return _0x842dc6(_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x1b')]);}else{logger[_0xa6a6('0x13')](_0xa6a6('0x1a'),_0x5d863b,_0xa6a6('0x14'));_0x842dc6(_0x2297b3[_0xa6a6('0x1c')][_0xa6a6('0x1b')]);}})[_0xa6a6('0x1d')](function(_0x2ec425){logger['error'](_0xa6a6('0x1a'),_0x5d863b,_0x2ec425);_0x16eb3c(_0x2ec425);});});}exports[_0xa6a6('0x1e')]=function(_0x1bb4ab){var _0x3fd835=this;return new Promise(function(_0x548a43,_0x30fdc1){return db[_0xa6a6('0x1f')][_0xa6a6('0x20')]({'raw':_0x1bb4ab[_0xa6a6('0x21')]?_0x1bb4ab[_0xa6a6('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x1bb4ab['options']?_0x1bb4ab['options'][_0xa6a6('0x22')]||null:null,'attributes':_0x1bb4ab[_0xa6a6('0x21')]?_0x1bb4ab['options'][_0xa6a6('0x23')]||null:null,'limit':_0x1bb4ab[_0xa6a6('0x21')]?_0x1bb4ab[_0xa6a6('0x21')][_0xa6a6('0x24')]||null:null,'include':_0x1bb4ab[_0xa6a6('0x21')]?_0x1bb4ab['options'][_0xa6a6('0x25')]?_['map'](_0x1bb4ab[_0xa6a6('0x21')][_0xa6a6('0x25')],function(_0x309098){return{'model':db[_0x309098[_0xa6a6('0x26')]],'as':_0x309098['as'],'attributes':_0x309098[_0xa6a6('0x23')],'include':_0x309098['include']?_['map'](_0x309098[_0xa6a6('0x25')],function(_0x3bd394){return{'model':db[_0x3bd394[_0xa6a6('0x26')]],'as':_0x3bd394['as'],'attributes':_0x3bd394[_0xa6a6('0x23')],'include':_0x3bd394[_0xa6a6('0x25')]?_[_0xa6a6('0x27')](_0x3bd394[_0xa6a6('0x25')],function(_0x1bef36){return{'model':db[_0x1bef36[_0xa6a6('0x26')]],'as':_0x1bef36['as'],'attributes':_0x1bef36[_0xa6a6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa6a6('0x12')](function(_0xace328){logger['info'](_0xa6a6('0x1e'),_0x1bb4ab);logger['debug']('GetFaxQueue',_0x1bb4ab,JSON[_0xa6a6('0x17')](_0xace328));_0x548a43(_0xace328);})[_0xa6a6('0x1d')](function(_0x120648){logger['error']('GetFaxQueue',_0x120648[_0xa6a6('0x1b')],_0x1bb4ab);_0x30fdc1(_0x3fd835[_0xa6a6('0x18')](0x1f4,_0x120648[_0xa6a6('0x1b')]));});});};exports[_0xa6a6('0x28')]=function(_0x487b3e){var _0x33a99e=this;return new Promise(function(_0x387e54,_0x1da6b6){return db['FaxQueue'][_0xa6a6('0x29')]({'raw':_0x487b3e[_0xa6a6('0x21')]?_0x487b3e[_0xa6a6('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x487b3e[_0xa6a6('0x21')]?_0x487b3e[_0xa6a6('0x21')][_0xa6a6('0x22')]||null:null,'attributes':_0x487b3e[_0xa6a6('0x21')]?_0x487b3e[_0xa6a6('0x21')]['attributes']||null:null,'include':_0x487b3e[_0xa6a6('0x21')]?_0x487b3e[_0xa6a6('0x21')][_0xa6a6('0x25')]?_[_0xa6a6('0x27')](_0x487b3e[_0xa6a6('0x21')][_0xa6a6('0x25')],function(_0x433b1b){return{'model':db[_0x433b1b['model']],'as':_0x433b1b['as'],'attributes':_0x433b1b[_0xa6a6('0x23')],'include':_0x433b1b[_0xa6a6('0x25')]?_[_0xa6a6('0x27')](_0x433b1b[_0xa6a6('0x25')],function(_0x196f75){return{'model':db[_0x196f75['model']],'as':_0x196f75['as'],'attributes':_0x196f75[_0xa6a6('0x23')],'include':_0x196f75[_0xa6a6('0x25')]?_['map'](_0x196f75[_0xa6a6('0x25')],function(_0x4609f3){return{'model':db[_0x4609f3[_0xa6a6('0x26')]],'as':_0x4609f3['as'],'attributes':_0x4609f3[_0xa6a6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa6a6('0x12')](function(_0x1834f7){logger[_0xa6a6('0x13')]('ShowFaxQueue',_0x487b3e);logger['debug'](_0xa6a6('0x28'),_0x487b3e,JSON[_0xa6a6('0x17')](_0x1834f7));_0x387e54(_0x1834f7);})[_0xa6a6('0x1d')](function(_0x4c9b70){logger[_0xa6a6('0x18')](_0xa6a6('0x28'),_0x4c9b70[_0xa6a6('0x1b')],_0x487b3e);_0x1da6b6(_0x33a99e[_0xa6a6('0x18')](0x1f4,_0x4c9b70[_0xa6a6('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6ff8eb8..479a26b 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 _0x843b=['./faxQueue.events','save','removeListener','register','faxQueue:'];(function(_0x38edc7,_0x5d0576){var _0x3eb41e=function(_0x2c0917){while(--_0x2c0917){_0x38edc7['push'](_0x38edc7['shift']());}};_0x3eb41e(++_0x5d0576);}(_0x843b,0x91));var _0xb843=function(_0x56adc8,_0x20a3b1){_0x56adc8=_0x56adc8-0x0;var _0x399f1e=_0x843b[_0x56adc8];return _0x399f1e;};'use strict';var FaxQueueEvents=require(_0xb843('0x0'));var events=[_0xb843('0x1'),'remove','update'];function createListener(_0x2d214b,_0x25fb9e){return function(_0x2e36cd){_0x25fb9e['emit'](_0x2d214b,_0x2e36cd);};}function removeListener(_0xa180bd,_0x310c9e){return function(){FaxQueueEvents[_0xb843('0x2')](_0xa180bd,_0x310c9e);};}exports[_0xb843('0x3')]=function(_0x5e781f){for(var _0x1a0c43=0x0,_0x330cfc=events['length'];_0x1a0c43<_0x330cfc;_0x1a0c43++){var _0xf00ead=events[_0x1a0c43];var _0x383f11=createListener(_0xb843('0x4')+_0xf00ead,_0x5e781f);FaxQueueEvents['on'](_0xf00ead,_0x383f11);}}; \ No newline at end of file +var _0xa2c5=['emit','register','save','remove','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa2c5,0x7a));var _0x5a2c=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xa2c5[_0xac151d];return _0x111dba;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5a2c('0x0'),_0x5a2c('0x1'),_0x5a2c('0x2')];function createListener(_0x650de5,_0x56a201){return function(_0x3eb4cc){_0x56a201[_0x5a2c('0x3')](_0x650de5,_0x3eb4cc);};}function removeListener(_0x5b9b16,_0x26cfec){return function(){FaxQueueEvents['removeListener'](_0x5b9b16,_0x26cfec);};}exports[_0x5a2c('0x4')]=function(_0x42a5c7){for(var _0xf13236=0x0,_0x5e43dc=events['length'];_0xf13236<_0x5e43dc;_0xf13236++){var _0x929717=events[_0xf13236];var _0x82ba11=createListener('faxQueue:'+_0x929717,_0x42a5c7);FaxQueueEvents['on'](_0x929717,_0x82ba11);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ea17e8f..c46200c 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 _0x90b1=['addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x131627,_0x642b7a){var _0x10a0b1=function(_0x410d58){while(--_0x410d58){_0x131627['push'](_0x131627['shift']());}};_0x10a0b1(++_0x642b7a);}(_0x90b1,0x1bb));var _0x190b=function(_0x57f91f,_0x21cf17){_0x57f91f=_0x57f91f-0x0;var _0x4deca6=_0x90b1[_0x57f91f];return _0x4deca6;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0x8')](_0x190b('0xe'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x8')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller['getTeams']);router[_0x190b('0x8')](_0x190b('0x11'),auth['isAuthenticated'](),controller[_0x190b('0x12')]);router[_0x190b('0x13')]('/',auth[_0x190b('0xa')](),controller[_0x190b('0x14')]);router[_0x190b('0x13')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller[_0x190b('0x15')]);router[_0x190b('0x13')](_0x190b('0x11'),auth[_0x190b('0xa')](),controller[_0x190b('0x16')]);router[_0x190b('0x17')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0x18')]);router[_0x190b('0x19')]('/:id',auth[_0x190b('0xa')](),controller['destroy']);router[_0x190b('0x19')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller[_0x190b('0x1a')]);router['delete'](_0x190b('0x11'),auth[_0x190b('0xa')](),controller[_0x190b('0x1b')]);module[_0x190b('0x1c')]=router; \ No newline at end of file +var _0x9536=['put','update','delete','removeTeams','removeAgents','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','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents'];(function(_0x36d674,_0x4af6b0){var _0x2d91df=function(_0x4ba058){while(--_0x4ba058){_0x36d674['push'](_0x36d674['shift']());}};_0x2d91df(++_0x4af6b0);}(_0x9536,0x179));var _0x6953=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x9536[_0x622035];return _0x326cf2;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x11')]);router[_0x6953('0x9')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x13')]);router[_0x6953('0x9')](_0x6953('0x14'),auth['isAuthenticated'](),controller[_0x6953('0x15')]);router['post']('/',auth[_0x6953('0xc')](),controller[_0x6953('0x16')]);router[_0x6953('0x17')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x18')]);router[_0x6953('0x17')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller[_0x6953('0x19')]);router[_0x6953('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x6953('0x1b')]);router[_0x6953('0x1c')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller['destroy']);router[_0x6953('0x1c')](_0x6953('0x12'),auth['isAuthenticated'](),controller[_0x6953('0x1d')]);router[_0x6953('0x1c')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller[_0x6953('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 29313fa..16368c2 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 _0xd60b=['sequelize','STRING','DATE'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0xd60b,0x198));var _0xbd60=function(_0x23a0b8,_0x5d9f58){_0x23a0b8=_0x23a0b8-0x0;var _0x3490df=_0xd60b[_0x23a0b8];return _0x3490df;};'use strict';var moment=require('moment');var Sequelize=require(_0xbd60('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbd60('0x1')]},'joinAt':{'type':Sequelize[_0xbd60('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbd60('0x2')]},'exitAt':{'type':Sequelize[_0xbd60('0x2')]},'reason':{'type':Sequelize[_0xbd60('0x1')]}}; \ No newline at end of file +var _0x32c8=['moment','sequelize','STRING','DATE'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x32c8,0x17c));var _0x832c=function(_0x9f5d30,_0x27f581){_0x9f5d30=_0x9f5d30-0x0;var _0x5f4407=_0x32c8[_0x9f5d30];return _0x5f4407;};'use strict';var moment=require(_0x832c('0x0'));var Sequelize=require(_0x832c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x832c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x832c('0x3')]},'leaveAt':{'type':Sequelize[_0x832c('0x3')]},'acceptAt':{'type':Sequelize[_0x832c('0x3')]},'exitAt':{'type':Sequelize[_0x832c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 2e2faea..8efd6e7 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 _0x32c0=['offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','options','catch','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x53ff8d,_0x53b3f8){var _0x36ae29=function(_0x31e1f6){while(--_0x31e1f6){_0x53ff8d['push'](_0x53ff8d['shift']());}};_0x36ae29(++_0x53b3f8);}(_0x32c0,0x1f3));var _0x032c=function(_0x1e65b1,_0x55d6a0){_0x1e65b1=_0x1e65b1-0x0;var _0x35cd26=_0x32c0[_0x1e65b1];return _0x35cd26;};'use strict';var emlformat=require(_0x032c('0x0'));var rimraf=require(_0x032c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x032c('0x2'));var rp=require(_0x032c('0x3'));var moment=require('moment');var BPromise=require(_0x032c('0x4'));var Mustache=require(_0x032c('0x5'));var util=require(_0x032c('0x6'));var path=require(_0x032c('0x7'));var sox=require('sox');var csv=require(_0x032c('0x8'));var ejs=require(_0x032c('0x9'));var fs=require('fs');var fs_extra=require(_0x032c('0xa'));var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var licenseUtil=require(_0x032c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25af77,_0xc88e78){_0xc88e78=_0xc88e78||0xcc;return function(_0x364605){if(_0x364605){return _0x25af77[_0x032c('0x16')](_0xc88e78);}return _0x25af77['status'](_0xc88e78)[_0x032c('0x17')]();};}function respondWithResult(_0x2650d6,_0x1ec9d8){_0x1ec9d8=_0x1ec9d8||0xc8;return function(_0x216984){if(_0x216984){return _0x2650d6[_0x032c('0x18')](_0x1ec9d8)[_0x032c('0x19')](_0x216984);}};}function respondWithFilteredResult(_0x51266f,_0xb678d5){return function(_0x15ddb8){if(_0x15ddb8){var _0x3ebda8=typeof _0xb678d5[_0x032c('0x1a')]===_0x032c('0x1b')&&typeof _0xb678d5[_0x032c('0x1c')]==='undefined';var _0x1444bb=_0x15ddb8[_0x032c('0x1d')];var _0x4435ad=_0x3ebda8?0x0:_0xb678d5[_0x032c('0x1a')];var _0x2b2693=_0x3ebda8?_0x15ddb8[_0x032c('0x1d')]:_0xb678d5[_0x032c('0x1a')]+_0xb678d5[_0x032c('0x1c')];var _0x3a6f71;if(_0x2b2693>=_0x1444bb){_0x2b2693=_0x1444bb;_0x3a6f71=0xc8;}else{_0x3a6f71=0xce;}_0x51266f[_0x032c('0x18')](_0x3a6f71);return _0x51266f[_0x032c('0x1e')](_0x032c('0x1f'),_0x4435ad+'-'+_0x2b2693+'/'+_0x1444bb)[_0x032c('0x19')](_0x15ddb8);}return null;};}function patchUpdates(_0x515409){return function(_0x8a8f30){try{jsonpatch['apply'](_0x8a8f30,_0x515409,!![]);}catch(_0x5341e6){return BPromise['reject'](_0x5341e6);}return _0x8a8f30['save']();};}function saveUpdates(_0x2a24f7,_0x4c0c4b){return function(_0x2ce758){if(_0x2ce758){return _0x2ce758[_0x032c('0x20')](_0x2a24f7)[_0x032c('0x21')](function(_0x51ad8c){return _0x51ad8c;});}return null;};}function removeEntity(_0x135612,_0x16d40f){return function(_0x28ae24){if(_0x28ae24){return _0x28ae24[_0x032c('0x22')]()[_0x032c('0x21')](function(){_0x135612[_0x032c('0x18')](0xcc)[_0x032c('0x17')]();});}};}function handleEntityNotFound(_0x58894b,_0x16ed08){return function(_0x1a0881){if(!_0x1a0881){_0x58894b[_0x032c('0x16')](0x194);}return _0x1a0881;};}function handleError(_0x56d20d,_0x1350d1){_0x1350d1=_0x1350d1||0x1f4;return function(_0x19ed06){logger[_0x032c('0x23')](_0x19ed06[_0x032c('0x24')]);if(_0x19ed06['name']){delete _0x19ed06[_0x032c('0x25')];}_0x56d20d[_0x032c('0x18')](_0x1350d1)[_0x032c('0x26')](_0x19ed06);};}exports[_0x032c('0x27')]=function(_0x51d679,_0x119d8f){var _0x1de595={},_0x5cdd90={},_0x659bbf={'count':0x0,'rows':[]};var _0x306935=_[_0x032c('0x28')](db[_0x032c('0x29')]['rawAttributes'],function(_0x50a3f8){return{'name':_0x50a3f8[_0x032c('0x2a')],'type':_0x50a3f8['type'][_0x032c('0x2b')]};});_0x5cdd90[_0x032c('0x2c')]=_['map'](_0x306935,_0x032c('0x25'));_0x5cdd90[_0x032c('0x2d')]=_[_0x032c('0x2e')](_0x51d679[_0x032c('0x2d')]);_0x5cdd90['filters']=_[_0x032c('0x2f')](_0x5cdd90[_0x032c('0x2c')],_0x5cdd90['query']);_0x1de595[_0x032c('0x30')]=_[_0x032c('0x2f')](_0x5cdd90[_0x032c('0x2c')],qs[_0x032c('0x31')](_0x51d679[_0x032c('0x2d')]['fields']));_0x1de595[_0x032c('0x30')]=_0x1de595['attributes'][_0x032c('0x32')]?_0x1de595['attributes']:_0x5cdd90[_0x032c('0x2c')];if(!_0x51d679[_0x032c('0x2d')][_0x032c('0x33')](_0x032c('0x34'))){_0x1de595[_0x032c('0x1c')]=qs[_0x032c('0x1c')](_0x51d679['query'][_0x032c('0x1c')]);_0x1de595[_0x032c('0x1a')]=qs['offset'](_0x51d679[_0x032c('0x2d')][_0x032c('0x1a')]);}_0x1de595[_0x032c('0x35')]=qs['sort'](_0x51d679[_0x032c('0x2d')][_0x032c('0x36')]);_0x1de595[_0x032c('0x37')]=qs[_0x032c('0x38')](_[_0x032c('0x39')](_0x51d679[_0x032c('0x2d')],_0x5cdd90[_0x032c('0x38')]),_0x306935);if(_0x51d679['query'][_0x032c('0x3a')]){_0x1de595[_0x032c('0x37')]=_[_0x032c('0x3b')](_0x1de595[_0x032c('0x37')],{'$or':_[_0x032c('0x28')](_0x306935,function(_0xf27830){if(_0xf27830[_0x032c('0x3c')]!==_0x032c('0x3d')){var _0x4bba77={};_0x4bba77[_0xf27830[_0x032c('0x25')]]={'$like':'%'+_0x51d679['query'][_0x032c('0x3a')]+'%'};return _0x4bba77;}})});}_0x1de595=_['merge']({},_0x1de595,_0x51d679['options']);var _0x238291={'where':_0x1de595[_0x032c('0x37')]};return db['FaxQueueReport']['count'](_0x238291)[_0x032c('0x21')](function(_0x4c6c2b){_0x659bbf['count']=_0x4c6c2b;if(_0x51d679[_0x032c('0x2d')][_0x032c('0x3e')]){_0x1de595[_0x032c('0x3f')]=[{'all':!![]}];}return db[_0x032c('0x29')][_0x032c('0x40')](_0x1de595);})[_0x032c('0x21')](function(_0x49b83a){_0x659bbf[_0x032c('0x41')]=_0x49b83a;return _0x659bbf;})['then'](respondWithFilteredResult(_0x119d8f,_0x1de595))['catch'](handleError(_0x119d8f,null));};exports[_0x032c('0x42')]=function(_0x15ebeb,_0x2035d5){var _0x235ad6={'raw':!![],'where':{'id':_0x15ebeb['params']['id']}},_0x47360a={};_0x47360a['model']=_[_0x032c('0x2e')](db['FaxQueueReport'][_0x032c('0x43')]);_0x47360a[_0x032c('0x2d')]=_[_0x032c('0x2e')](_0x15ebeb[_0x032c('0x2d')]);_0x47360a[_0x032c('0x38')]=_[_0x032c('0x2f')](_0x47360a[_0x032c('0x2c')],_0x47360a[_0x032c('0x2d')]);_0x235ad6[_0x032c('0x30')]=_['intersection'](_0x47360a[_0x032c('0x2c')],qs['fields'](_0x15ebeb['query'][_0x032c('0x31')]));_0x235ad6[_0x032c('0x30')]=_0x235ad6[_0x032c('0x30')][_0x032c('0x32')]?_0x235ad6[_0x032c('0x30')]:_0x47360a['model'];if(_0x15ebeb['query']['includeAll']){_0x235ad6[_0x032c('0x3f')]=[{'all':!![]}];}_0x235ad6=_['merge']({},_0x235ad6,_0x15ebeb[_0x032c('0x44')]);return db[_0x032c('0x29')]['find'](_0x235ad6)[_0x032c('0x21')](handleEntityNotFound(_0x2035d5,null))[_0x032c('0x21')](respondWithResult(_0x2035d5,null))[_0x032c('0x45')](handleError(_0x2035d5,null));};exports[_0x032c('0x46')]=function(_0x3a877a,_0x26e988){return db[_0x032c('0x29')][_0x032c('0x46')](_0x3a877a[_0x032c('0x47')],{})['then'](respondWithResult(_0x26e988,0xc9))[_0x032c('0x45')](handleError(_0x26e988,null));};exports['update']=function(_0x367638,_0x13f1a7){if(_0x367638[_0x032c('0x47')]['id']){delete _0x367638[_0x032c('0x47')]['id'];}return db[_0x032c('0x29')][_0x032c('0x48')]({'where':{'id':_0x367638[_0x032c('0x49')]['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x13f1a7,null))[_0x032c('0x21')](saveUpdates(_0x367638['body'],null))[_0x032c('0x21')](respondWithResult(_0x13f1a7,null))['catch'](handleError(_0x13f1a7,null));};exports[_0x032c('0x22')]=function(_0x2f1032,_0x4e8fd6){return db[_0x032c('0x29')][_0x032c('0x48')]({'where':{'id':_0x2f1032['params']['id']}})[_0x032c('0x21')](handleEntityNotFound(_0x4e8fd6,null))[_0x032c('0x21')](removeEntity(_0x4e8fd6,null))[_0x032c('0x45')](handleError(_0x4e8fd6,null));};exports['describe']=function(_0x43efaa,_0xf7d545){return db[_0x032c('0x29')][_0x032c('0x4a')]()[_0x032c('0x21')](respondWithResult(_0xf7d545,null))[_0x032c('0x45')](handleError(_0xf7d545,null));}; \ No newline at end of file +var _0xd1d4=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4fc8ba,_0x25b882){var _0x3891b0=function(_0x4dbc0c){while(--_0x4dbc0c){_0x4fc8ba['push'](_0x4fc8ba['shift']());}};_0x3891b0(++_0x25b882);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd1d4[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4d1d('0x0'));var rimraf=require(_0x4d1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d1d('0x3'));var Mustache=require(_0x4d1d('0x4'));var util=require(_0x4d1d('0x5'));var path=require(_0x4d1d('0x6'));var sox=require(_0x4d1d('0x7'));var csv=require(_0x4d1d('0x8'));var ejs=require(_0x4d1d('0x9'));var fs=require('fs');var fs_extra=require(_0x4d1d('0xa'));var _=require(_0x4d1d('0xb'));var squel=require(_0x4d1d('0xc'));var crypto=require(_0x4d1d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4d1d('0x8'));var querystring=require(_0x4d1d('0xe'));var Papa=require('papaparse');var Redis=require(_0x4d1d('0xf'));var authService=require(_0x4d1d('0x10'));var qs=require(_0x4d1d('0x11'));var as=require(_0x4d1d('0x12'));var hardwareService=require(_0x4d1d('0x13'));var logger=require(_0x4d1d('0x14'))(_0x4d1d('0x15'));var utils=require(_0x4d1d('0x16'));var config=require(_0x4d1d('0x17'));var licenseUtil=require(_0x4d1d('0x18'));var db=require(_0x4d1d('0x19'))['db'];function respondWithStatusCode(_0xf8e311,_0x11115c){_0x11115c=_0x11115c||0xcc;return function(_0x515e43){if(_0x515e43){return _0xf8e311[_0x4d1d('0x1a')](_0x11115c);}return _0xf8e311[_0x4d1d('0x1b')](_0x11115c)[_0x4d1d('0x1c')]();};}function respondWithResult(_0x377ff7,_0x4fabbc){_0x4fabbc=_0x4fabbc||0xc8;return function(_0x58c1c0){if(_0x58c1c0){return _0x377ff7[_0x4d1d('0x1b')](_0x4fabbc)[_0x4d1d('0x1d')](_0x58c1c0);}};}function respondWithFilteredResult(_0x1db7a6,_0x569809){return function(_0x42ac80){if(_0x42ac80){var _0x460b3a=typeof _0x569809[_0x4d1d('0x1e')]===_0x4d1d('0x1f')&&typeof _0x569809['limit']==='undefined';var _0x4cec61=_0x42ac80[_0x4d1d('0x20')];var _0x83eb5a=_0x460b3a?0x0:_0x569809[_0x4d1d('0x1e')];var _0x38d465=_0x460b3a?_0x42ac80[_0x4d1d('0x20')]:_0x569809['offset']+_0x569809[_0x4d1d('0x21')];var _0x405dcd;if(_0x38d465>=_0x4cec61){_0x38d465=_0x4cec61;_0x405dcd=0xc8;}else{_0x405dcd=0xce;}_0x1db7a6[_0x4d1d('0x1b')](_0x405dcd);return _0x1db7a6[_0x4d1d('0x22')](_0x4d1d('0x23'),_0x83eb5a+'-'+_0x38d465+'/'+_0x4cec61)[_0x4d1d('0x1d')](_0x42ac80);}return null;};}function patchUpdates(_0x1a5dae){return function(_0x5a325c){try{jsonpatch[_0x4d1d('0x24')](_0x5a325c,_0x1a5dae,!![]);}catch(_0x4fcb5b){return BPromise[_0x4d1d('0x25')](_0x4fcb5b);}return _0x5a325c[_0x4d1d('0x26')]();};}function saveUpdates(_0x356d6f,_0xf1c555){return function(_0x2557b1){if(_0x2557b1){return _0x2557b1[_0x4d1d('0x27')](_0x356d6f)[_0x4d1d('0x28')](function(_0x4e4b7a){return _0x4e4b7a;});}return null;};}function removeEntity(_0x410916,_0x43d108){return function(_0x207472){if(_0x207472){return _0x207472[_0x4d1d('0x29')]()[_0x4d1d('0x28')](function(){_0x410916['status'](0xcc)[_0x4d1d('0x1c')]();});}};}function handleEntityNotFound(_0x45b17c,_0x33f17e){return function(_0x2a49a8){if(!_0x2a49a8){_0x45b17c[_0x4d1d('0x1a')](0x194);}return _0x2a49a8;};}function handleError(_0x5cf5f3,_0x30aa34){_0x30aa34=_0x30aa34||0x1f4;return function(_0x58ac25){logger[_0x4d1d('0x2a')](_0x58ac25[_0x4d1d('0x2b')]);if(_0x58ac25[_0x4d1d('0x2c')]){delete _0x58ac25[_0x4d1d('0x2c')];}_0x5cf5f3[_0x4d1d('0x1b')](_0x30aa34)[_0x4d1d('0x2d')](_0x58ac25);};}exports['index']=function(_0x666c88,_0x322e0f){var _0x276762={},_0x558888={},_0x3c84b9={'count':0x0,'rows':[]};var _0x380e9b=_['map'](db[_0x4d1d('0x2e')][_0x4d1d('0x2f')],function(_0x3bd19b){return{'name':_0x3bd19b[_0x4d1d('0x30')],'type':_0x3bd19b[_0x4d1d('0x31')][_0x4d1d('0x32')]};});_0x558888[_0x4d1d('0x33')]=_[_0x4d1d('0x34')](_0x380e9b,'name');_0x558888['query']=_[_0x4d1d('0x35')](_0x666c88[_0x4d1d('0x36')]);_0x558888['filters']=_[_0x4d1d('0x37')](_0x558888['model'],_0x558888['query']);_0x276762[_0x4d1d('0x38')]=_['intersection'](_0x558888[_0x4d1d('0x33')],qs['fields'](_0x666c88['query'][_0x4d1d('0x39')]));_0x276762[_0x4d1d('0x38')]=_0x276762[_0x4d1d('0x38')][_0x4d1d('0x3a')]?_0x276762['attributes']:_0x558888['model'];if(!_0x666c88[_0x4d1d('0x36')][_0x4d1d('0x3b')](_0x4d1d('0x3c'))){_0x276762[_0x4d1d('0x21')]=qs[_0x4d1d('0x21')](_0x666c88[_0x4d1d('0x36')]['limit']);_0x276762[_0x4d1d('0x1e')]=qs[_0x4d1d('0x1e')](_0x666c88[_0x4d1d('0x36')][_0x4d1d('0x1e')]);}_0x276762[_0x4d1d('0x3d')]=qs[_0x4d1d('0x3e')](_0x666c88['query'][_0x4d1d('0x3e')]);_0x276762[_0x4d1d('0x3f')]=qs[_0x4d1d('0x40')](_[_0x4d1d('0x41')](_0x666c88['query'],_0x558888[_0x4d1d('0x40')]),_0x380e9b);if(_0x666c88[_0x4d1d('0x36')]['filter']){_0x276762['where']=_[_0x4d1d('0x42')](_0x276762[_0x4d1d('0x3f')],{'$or':_['map'](_0x380e9b,function(_0x2ea2e3){if(_0x2ea2e3[_0x4d1d('0x31')]!==_0x4d1d('0x43')){var _0x3afac4={};_0x3afac4[_0x2ea2e3[_0x4d1d('0x2c')]]={'$like':'%'+_0x666c88[_0x4d1d('0x36')][_0x4d1d('0x44')]+'%'};return _0x3afac4;}})});}_0x276762=_[_0x4d1d('0x42')]({},_0x276762,_0x666c88[_0x4d1d('0x45')]);var _0x249ecc={'where':_0x276762[_0x4d1d('0x3f')]};return db['FaxQueueReport'][_0x4d1d('0x20')](_0x249ecc)[_0x4d1d('0x28')](function(_0x44e773){_0x3c84b9['count']=_0x44e773;if(_0x666c88[_0x4d1d('0x36')][_0x4d1d('0x46')]){_0x276762[_0x4d1d('0x47')]=[{'all':!![]}];}return db[_0x4d1d('0x2e')][_0x4d1d('0x48')](_0x276762);})[_0x4d1d('0x28')](function(_0x5c8a9b){_0x3c84b9[_0x4d1d('0x49')]=_0x5c8a9b;return _0x3c84b9;})[_0x4d1d('0x28')](respondWithFilteredResult(_0x322e0f,_0x276762))[_0x4d1d('0x4a')](handleError(_0x322e0f,null));};exports['show']=function(_0x4bce4e,_0x70394d){var _0x50b4d9={'raw':!![],'where':{'id':_0x4bce4e[_0x4d1d('0x4b')]['id']}},_0x8bd0b6={};_0x8bd0b6['model']=_['keys'](db[_0x4d1d('0x2e')][_0x4d1d('0x2f')]);_0x8bd0b6[_0x4d1d('0x36')]=_[_0x4d1d('0x35')](_0x4bce4e[_0x4d1d('0x36')]);_0x8bd0b6['filters']=_[_0x4d1d('0x37')](_0x8bd0b6[_0x4d1d('0x33')],_0x8bd0b6[_0x4d1d('0x36')]);_0x50b4d9[_0x4d1d('0x38')]=_['intersection'](_0x8bd0b6[_0x4d1d('0x33')],qs[_0x4d1d('0x39')](_0x4bce4e[_0x4d1d('0x36')][_0x4d1d('0x39')]));_0x50b4d9[_0x4d1d('0x38')]=_0x50b4d9[_0x4d1d('0x38')]['length']?_0x50b4d9[_0x4d1d('0x38')]:_0x8bd0b6[_0x4d1d('0x33')];if(_0x4bce4e[_0x4d1d('0x36')][_0x4d1d('0x46')]){_0x50b4d9[_0x4d1d('0x47')]=[{'all':!![]}];}_0x50b4d9=_[_0x4d1d('0x42')]({},_0x50b4d9,_0x4bce4e[_0x4d1d('0x45')]);return db[_0x4d1d('0x2e')]['find'](_0x50b4d9)[_0x4d1d('0x28')](handleEntityNotFound(_0x70394d,null))['then'](respondWithResult(_0x70394d,null))[_0x4d1d('0x4a')](handleError(_0x70394d,null));};exports[_0x4d1d('0x4c')]=function(_0x385d38,_0x5e2915){return db['FaxQueueReport'][_0x4d1d('0x4c')](_0x385d38[_0x4d1d('0x4d')],{})['then'](respondWithResult(_0x5e2915,0xc9))[_0x4d1d('0x4a')](handleError(_0x5e2915,null));};exports[_0x4d1d('0x27')]=function(_0x143e13,_0x4719da){if(_0x143e13[_0x4d1d('0x4d')]['id']){delete _0x143e13['body']['id'];}return db[_0x4d1d('0x2e')]['find']({'where':{'id':_0x143e13['params']['id']}})[_0x4d1d('0x28')](handleEntityNotFound(_0x4719da,null))[_0x4d1d('0x28')](saveUpdates(_0x143e13[_0x4d1d('0x4d')],null))[_0x4d1d('0x28')](respondWithResult(_0x4719da,null))[_0x4d1d('0x4a')](handleError(_0x4719da,null));};exports[_0x4d1d('0x29')]=function(_0x47d4b1,_0x2f9da0){return db[_0x4d1d('0x2e')]['find']({'where':{'id':_0x47d4b1[_0x4d1d('0x4b')]['id']}})[_0x4d1d('0x28')](handleEntityNotFound(_0x2f9da0,null))[_0x4d1d('0x28')](removeEntity(_0x2f9da0,null))[_0x4d1d('0x4a')](handleError(_0x2f9da0,null));};exports['describe']=function(_0x30378f,_0xfeca9e){return db[_0x4d1d('0x2e')][_0x4d1d('0x4e')]()[_0x4d1d('0x28')](respondWithResult(_0xfeca9e,null))[_0x4d1d('0x4a')](handleError(_0xfeca9e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e67c88a..73ae6e1 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x2f2b4c,_0x6ce7c1){var _0x28c769=function(_0x181d42){while(--_0x181d42){_0x2f2b4c['push'](_0x2f2b4c['shift']());}};_0x28c769(++_0x6ce7c1);}(_0x1261,0x144));var _0x1126=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x1261[_0x350343];return _0x9afc1c;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x47bfb8,_0x5f2de8){var _0x4c53e7=function(_0x3eecaa){while(--_0x3eecaa){_0x47bfb8['push'](_0x47bfb8['shift']());}};_0x4c53e7(++_0x5f2de8);}(_0x326f,0xd1));var _0xf326=function(_0x482a86,_0x445cdc){_0x482a86=_0x482a86-0x0;var _0x21dcc9=_0x326f[_0x482a86];return _0x21dcc9;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 171cdb1..3677429 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 _0x5381=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','where','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x32e22c,_0x129c5e){var _0x1a1adc=function(_0x514f8b){while(--_0x514f8b){_0x32e22c['push'](_0x32e22c['shift']());}};_0x1a1adc(++_0x129c5e);}(_0x5381,0x10a));var _0x1538=function(_0x4ded6f,_0x527d83){_0x4ded6f=_0x4ded6f-0x0;var _0x4696ad=_0x5381[_0x4ded6f];return _0x4696ad;};'use strict';var _=require(_0x1538('0x0'));var util=require(_0x1538('0x1'));var moment=require(_0x1538('0x2'));var BPromise=require(_0x1538('0x3'));var rs=require(_0x1538('0x4'));var fs=require('fs');var Redis=require(_0x1538('0x5'));var db=require(_0x1538('0x6'))['db'];var utils=require(_0x1538('0x7'));var logger=require(_0x1538('0x8'))(_0x1538('0x9'));var config=require(_0x1538('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1538('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x479b14,_0x225f1c,_0x4310f5){return new BPromise(function(_0x189847,_0x3e8269){return client[_0x1538('0xc')](_0x479b14,_0x4310f5)[_0x1538('0xd')](function(_0x206e8d){logger[_0x1538('0xe')](_0x1538('0xf'),_0x225f1c,_0x1538('0x10'));logger[_0x1538('0x11')](_0x1538('0x12'),_0x225f1c,_0x1538('0x10'),JSON[_0x1538('0x13')](_0x206e8d));if(_0x206e8d['error']){if(_0x206e8d[_0x1538('0x14')][_0x1538('0x15')]===0x1f4){logger[_0x1538('0x14')](_0x1538('0xf'),_0x225f1c,_0x206e8d[_0x1538('0x14')]['message']);return _0x3e8269(_0x206e8d[_0x1538('0x14')][_0x1538('0x16')]);}logger[_0x1538('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x225f1c,_0x206e8d[_0x1538('0x14')][_0x1538('0x16')]);return _0x189847(_0x206e8d['error']['message']);}else{logger[_0x1538('0xe')](_0x1538('0xf'),_0x225f1c,_0x1538('0x10'));_0x189847(_0x206e8d[_0x1538('0x17')]['message']);}})[_0x1538('0x18')](function(_0x516600){logger['error'](_0x1538('0xf'),_0x225f1c,_0x516600);_0x3e8269(_0x516600);});});}exports['CreateFaxQueueReport']=function(_0x285252){var _0x209c23=this;return new Promise(function(_0x3b190d,_0x5b9fd2){return db['FaxQueueReport'][_0x1538('0x19')](_0x285252[_0x1538('0x1a')],{'raw':_0x285252['options']?_0x285252[_0x1538('0x1b')][_0x1538('0x1c')]===undefined?!![]:![]:!![]})[_0x1538('0xd')](function(_0x101d4d){logger['info']('CreateFaxQueueReport',_0x285252);logger[_0x1538('0x11')](_0x1538('0x1d'),_0x285252,JSON['stringify'](_0x101d4d));_0x3b190d(_0x101d4d);})[_0x1538('0x18')](function(_0xdb4b4e){logger['error'](_0x1538('0x1d'),_0xdb4b4e[_0x1538('0x16')],_0x285252);_0x5b9fd2(_0x209c23[_0x1538('0x14')](0x1f4,_0xdb4b4e[_0x1538('0x16')]));});});};exports[_0x1538('0x1e')]=function(_0x3738e0){var _0x2fa767=this;return new Promise(function(_0x105b18,_0x24cd47){return db[_0x1538('0x1f')]['update'](_0x3738e0[_0x1538('0x1a')],{'raw':_0x3738e0[_0x1538('0x1b')]?_0x3738e0['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3738e0['options']?_0x3738e0[_0x1538('0x1b')][_0x1538('0x20')]||null:null,'attributes':_0x3738e0[_0x1538('0x1b')]?_0x3738e0['options']['attributes']||null:null,'limit':_0x3738e0['options']?_0x3738e0['options'][_0x1538('0x21')]||null:null})[_0x1538('0xd')](function(_0x1fbde8){logger[_0x1538('0xe')]('UpdateFaxQueueReport',_0x3738e0);logger[_0x1538('0x11')](_0x1538('0x1e'),_0x3738e0,JSON['stringify'](_0x1fbde8));_0x105b18(_0x1fbde8);})[_0x1538('0x18')](function(_0x2f93a0){logger['error'](_0x1538('0x1e'),_0x2f93a0[_0x1538('0x16')],_0x3738e0);_0x24cd47(_0x2fa767[_0x1538('0x14')](0x1f4,_0x2f93a0['message']));});});}; \ No newline at end of file +var _0xfc24=['message','info','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','update','body','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xf39b7d,_0x4a9dc2){var _0x29e7de=function(_0x5a5584){while(--_0x5a5584){_0xf39b7d['push'](_0xf39b7d['shift']());}};_0x29e7de(++_0x4a9dc2);}(_0xfc24,0x1ae));var _0x4fc2=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xfc24[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x4fc2('0x0'));var util=require('util');var moment=require(_0x4fc2('0x1'));var BPromise=require(_0x4fc2('0x2'));var rs=require(_0x4fc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fc2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fc2('0x5'))(_0x4fc2('0x6'));var config=require(_0x4fc2('0x7'));var jayson=require(_0x4fc2('0x8'));var client=jayson[_0x4fc2('0x9')][_0x4fc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c811f,_0x48656b,_0x429bcf){return new BPromise(function(_0x2cbf32,_0x5949b6){return client[_0x4fc2('0xb')](_0x2c811f,_0x429bcf)[_0x4fc2('0xc')](function(_0x759391){logger['info'](_0x4fc2('0xd'),_0x48656b,_0x4fc2('0xe'));logger[_0x4fc2('0xf')](_0x4fc2('0x10'),_0x48656b,_0x4fc2('0xe'),JSON['stringify'](_0x759391));if(_0x759391[_0x4fc2('0x11')]){if(_0x759391[_0x4fc2('0x11')]['code']===0x1f4){logger['error'](_0x4fc2('0xd'),_0x48656b,_0x759391[_0x4fc2('0x11')]['message']);return _0x5949b6(_0x759391[_0x4fc2('0x11')][_0x4fc2('0x12')]);}logger[_0x4fc2('0x11')](_0x4fc2('0xd'),_0x48656b,_0x759391['error'][_0x4fc2('0x12')]);return _0x2cbf32(_0x759391[_0x4fc2('0x11')][_0x4fc2('0x12')]);}else{logger[_0x4fc2('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x48656b,_0x4fc2('0xe'));_0x2cbf32(_0x759391['result']['message']);}})[_0x4fc2('0x14')](function(_0x5282fc){logger[_0x4fc2('0x11')](_0x4fc2('0xd'),_0x48656b,_0x5282fc);_0x5949b6(_0x5282fc);});});}exports[_0x4fc2('0x15')]=function(_0x1cd79e){var _0xe80e52=this;return new Promise(function(_0x212a65,_0x543e80){return db[_0x4fc2('0x16')][_0x4fc2('0x17')](_0x1cd79e['body'],{'raw':_0x1cd79e[_0x4fc2('0x18')]?_0x1cd79e['options'][_0x4fc2('0x19')]===undefined?!![]:![]:!![]})[_0x4fc2('0xc')](function(_0x21e463){logger[_0x4fc2('0x13')](_0x4fc2('0x15'),_0x1cd79e);logger[_0x4fc2('0xf')](_0x4fc2('0x15'),_0x1cd79e,JSON[_0x4fc2('0x1a')](_0x21e463));_0x212a65(_0x21e463);})['catch'](function(_0x37d15a){logger[_0x4fc2('0x11')](_0x4fc2('0x15'),_0x37d15a['message'],_0x1cd79e);_0x543e80(_0xe80e52['error'](0x1f4,_0x37d15a[_0x4fc2('0x12')]));});});};exports[_0x4fc2('0x1b')]=function(_0x4a1b04){var _0x3da715=this;return new Promise(function(_0x4762ad,_0x2ff97e){return db[_0x4fc2('0x16')][_0x4fc2('0x1c')](_0x4a1b04[_0x4fc2('0x1d')],{'raw':_0x4a1b04[_0x4fc2('0x18')]?_0x4a1b04['options'][_0x4fc2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a1b04[_0x4fc2('0x18')]?_0x4a1b04[_0x4fc2('0x18')][_0x4fc2('0x1e')]||null:null,'attributes':_0x4a1b04[_0x4fc2('0x18')]?_0x4a1b04['options'][_0x4fc2('0x1f')]||null:null,'limit':_0x4a1b04[_0x4fc2('0x18')]?_0x4a1b04[_0x4fc2('0x18')]['limit']||null:null})[_0x4fc2('0xc')](function(_0x2c57e0){logger[_0x4fc2('0x13')](_0x4fc2('0x1b'),_0x4a1b04);logger['debug'](_0x4fc2('0x1b'),_0x4a1b04,JSON[_0x4fc2('0x1a')](_0x2c57e0));_0x4762ad(_0x2c57e0);})[_0x4fc2('0x14')](function(_0x1a9bdb){logger[_0x4fc2('0x11')](_0x4fc2('0x1b'),_0x1a9bdb[_0x4fc2('0x12')],_0x4a1b04);_0x2ff97e(_0x3da715[_0x4fc2('0x11')](0x1f4,_0x1a9bdb[_0x4fc2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index cf0091b..a59a728 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 _0xf392=['multer','util','path','connect-timeout','express','Router','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','update','delete','destroy','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf392,0x85));var _0x2f39=function(_0x1d6039,_0x2c1a3b){_0x1d6039=_0x1d6039-0x0;var _0x30668d=_0xf392[_0x1d6039];return _0x30668d;};'use strict';var multer=require(_0x2f39('0x0'));var util=require(_0x2f39('0x1'));var path=require(_0x2f39('0x2'));var timeout=require(_0x2f39('0x3'));var express=require(_0x2f39('0x4'));var router=express[_0x2f39('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f39('0x6'));var controller=require(_0x2f39('0x7'));router[_0x2f39('0x8')]('/',auth[_0x2f39('0x9')](),controller[_0x2f39('0xa')]);router[_0x2f39('0x8')](_0x2f39('0xb'),auth[_0x2f39('0x9')](),controller['describe']);router[_0x2f39('0x8')](_0x2f39('0xc'),auth[_0x2f39('0x9')](),controller['show']);router[_0x2f39('0xd')]('/',auth[_0x2f39('0x9')](),controller['create']);router[_0x2f39('0xe')](_0x2f39('0xc'),auth[_0x2f39('0x9')](),controller[_0x2f39('0xf')]);router[_0x2f39('0x10')](_0x2f39('0xc'),auth[_0x2f39('0x9')](),controller[_0x2f39('0x11')]);module[_0x2f39('0x12')]=router; \ No newline at end of file +var _0x96c3=['../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x96c3,0x176));var _0x396c=function(_0x3410c2,_0x56d6a1){_0x3410c2=_0x3410c2-0x0;var _0x12240d=_0x96c3[_0x3410c2];return _0x12240d;};'use strict';var multer=require('multer');var util=require(_0x396c('0x0'));var path=require(_0x396c('0x1'));var timeout=require(_0x396c('0x2'));var express=require(_0x396c('0x3'));var router=express[_0x396c('0x4')]();var fs_extra=require(_0x396c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x396c('0x6'));var controller=require(_0x396c('0x7'));router[_0x396c('0x8')]('/',auth[_0x396c('0x9')](),controller['index']);router[_0x396c('0x8')](_0x396c('0xa'),auth[_0x396c('0x9')](),controller[_0x396c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x396c('0xc')]('/',auth[_0x396c('0x9')](),controller[_0x396c('0xd')]);router[_0x396c('0xe')](_0x396c('0xf'),auth[_0x396c('0x9')](),controller[_0x396c('0x10')]);router[_0x396c('0x11')]('/:id',auth[_0x396c('0x9')](),controller[_0x396c('0x12')]);module[_0x396c('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 34c119e..88947bf 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x3bbbea,_0xd04073){var _0x52f608=function(_0x28cd1c){while(--_0x28cd1c){_0x3bbbea['push'](_0x3bbbea['shift']());}};_0x52f608(++_0xd04073);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f114b,_0x222f7a){_0x2f114b=_0x2f114b-0x0;var _0x457f7f=_0xedd9[_0x2f114b];return _0x457f7f;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x2a4877,_0x4bf8e9){var _0x217666=function(_0x720efe){while(--_0x720efe){_0x2a4877['push'](_0x2a4877['shift']());}};_0x217666(++_0x4bf8e9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x29311d,_0x3f9e23){_0x29311d=_0x29311d-0x0;var _0xa29b8f=_0xf3cd[_0x29311d];return _0xa29b8f;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 3077063..9ed9a2d 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 _0x4665=['Content-Range','apply','reject','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0xe16450,_0x4ca4f8){var _0x406c47=function(_0x4590ae){while(--_0x4590ae){_0xe16450['push'](_0xe16450['shift']());}};_0x406c47(++_0x4ca4f8);}(_0x4665,0x10f));var _0x5466=function(_0x43e5e3,_0x271849){_0x43e5e3=_0x43e5e3-0x0;var _0x4200ff=_0x4665[_0x43e5e3];return _0x4200ff;};'use strict';var emlformat=require(_0x5466('0x0'));var rimraf=require(_0x5466('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5466('0x2'));var rp=require(_0x5466('0x3'));var moment=require(_0x5466('0x4'));var BPromise=require(_0x5466('0x5'));var Mustache=require(_0x5466('0x6'));var util=require('util');var path=require(_0x5466('0x7'));var sox=require(_0x5466('0x8'));var csv=require(_0x5466('0x9'));var ejs=require(_0x5466('0xa'));var fs=require('fs');var fs_extra=require(_0x5466('0xb'));var _=require(_0x5466('0xc'));var squel=require('squel');var crypto=require(_0x5466('0xd'));var jsforce=require(_0x5466('0xe'));var deskjs=require(_0x5466('0xf'));var toCsv=require(_0x5466('0x9'));var querystring=require(_0x5466('0x10'));var Papa=require(_0x5466('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5466('0x12'));var as=require(_0x5466('0x13'));var hardwareService=require(_0x5466('0x14'));var logger=require(_0x5466('0x15'))(_0x5466('0x16'));var utils=require(_0x5466('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5466('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x102cd2,_0x3964a3){_0x3964a3=_0x3964a3||0xcc;return function(_0x4a03de){if(_0x4a03de){return _0x102cd2[_0x5466('0x19')](_0x3964a3);}return _0x102cd2[_0x5466('0x1a')](_0x3964a3)[_0x5466('0x1b')]();};}function respondWithResult(_0x4a6166,_0x4aec01){_0x4aec01=_0x4aec01||0xc8;return function(_0x23de70){if(_0x23de70){return _0x4a6166[_0x5466('0x1a')](_0x4aec01)[_0x5466('0x1c')](_0x23de70);}};}function respondWithFilteredResult(_0x18cafa,_0x2004cb){return function(_0x36e857){if(_0x36e857){var _0x252498=typeof _0x2004cb[_0x5466('0x1d')]===_0x5466('0x1e')&&typeof _0x2004cb[_0x5466('0x1f')]===_0x5466('0x1e');var _0x208523=_0x36e857[_0x5466('0x20')];var _0x236135=_0x252498?0x0:_0x2004cb['offset'];var _0x5f1870=_0x252498?_0x36e857[_0x5466('0x20')]:_0x2004cb[_0x5466('0x1d')]+_0x2004cb[_0x5466('0x1f')];var _0xaac13b;if(_0x5f1870>=_0x208523){_0x5f1870=_0x208523;_0xaac13b=0xc8;}else{_0xaac13b=0xce;}_0x18cafa[_0x5466('0x1a')](_0xaac13b);return _0x18cafa['set'](_0x5466('0x21'),_0x236135+'-'+_0x5f1870+'/'+_0x208523)[_0x5466('0x1c')](_0x36e857);}return null;};}function patchUpdates(_0x5866fb){return function(_0x547d2a){try{jsonpatch[_0x5466('0x22')](_0x547d2a,_0x5866fb,!![]);}catch(_0x37c86c){return BPromise[_0x5466('0x23')](_0x37c86c);}return _0x547d2a['save']();};}function saveUpdates(_0x5e1235,_0xb01dc2){return function(_0x293a02){if(_0x293a02){return _0x293a02['update'](_0x5e1235)[_0x5466('0x24')](function(_0x2a62be){return _0x2a62be;});}return null;};}function removeEntity(_0x474297,_0x50a8d3){return function(_0x31f64c){if(_0x31f64c){return _0x31f64c[_0x5466('0x25')]()[_0x5466('0x24')](function(){_0x474297[_0x5466('0x1a')](0xcc)[_0x5466('0x1b')]();});}};}function handleEntityNotFound(_0x5b0c71,_0x34eb28){return function(_0x175de9){if(!_0x175de9){_0x5b0c71['sendStatus'](0x194);}return _0x175de9;};}function handleError(_0x252798,_0x1cace6){_0x1cace6=_0x1cace6||0x1f4;return function(_0x13fff1){logger[_0x5466('0x26')](_0x13fff1[_0x5466('0x27')]);if(_0x13fff1[_0x5466('0x28')]){delete _0x13fff1[_0x5466('0x28')];}_0x252798[_0x5466('0x1a')](_0x1cace6)['send'](_0x13fff1);};}exports[_0x5466('0x29')]=function(_0x1024fb,_0x3caee9){var _0x43061f={},_0x155045={},_0x421c21={'count':0x0,'rows':[]};var _0x157b49=_[_0x5466('0x2a')](db[_0x5466('0x2b')][_0x5466('0x2c')],function(_0x4fda9c){return{'name':_0x4fda9c[_0x5466('0x2d')],'type':_0x4fda9c[_0x5466('0x2e')]['key']};});_0x155045[_0x5466('0x2f')]=_['map'](_0x157b49,_0x5466('0x28'));_0x155045[_0x5466('0x30')]=_[_0x5466('0x31')](_0x1024fb['query']);_0x155045[_0x5466('0x32')]=_[_0x5466('0x33')](_0x155045['model'],_0x155045[_0x5466('0x30')]);_0x43061f[_0x5466('0x34')]=_[_0x5466('0x33')](_0x155045[_0x5466('0x2f')],qs[_0x5466('0x35')](_0x1024fb[_0x5466('0x30')]['fields']));_0x43061f['attributes']=_0x43061f[_0x5466('0x34')][_0x5466('0x36')]?_0x43061f[_0x5466('0x34')]:_0x155045[_0x5466('0x2f')];if(!_0x1024fb[_0x5466('0x30')][_0x5466('0x37')]('nolimit')){_0x43061f['limit']=qs['limit'](_0x1024fb[_0x5466('0x30')][_0x5466('0x1f')]);_0x43061f[_0x5466('0x1d')]=qs[_0x5466('0x1d')](_0x1024fb[_0x5466('0x30')]['offset']);}_0x43061f[_0x5466('0x38')]=qs[_0x5466('0x39')](_0x1024fb['query']['sort']);_0x43061f['where']=qs[_0x5466('0x32')](_[_0x5466('0x3a')](_0x1024fb[_0x5466('0x30')],_0x155045['filters']),_0x157b49);if(_0x1024fb[_0x5466('0x30')][_0x5466('0x3b')]){_0x43061f[_0x5466('0x3c')]=_['merge'](_0x43061f[_0x5466('0x3c')],{'$or':_[_0x5466('0x2a')](_0x157b49,function(_0x480d77){if(_0x480d77['type']!==_0x5466('0x3d')){var _0x1164c4={};_0x1164c4[_0x480d77[_0x5466('0x28')]]={'$like':'%'+_0x1024fb[_0x5466('0x30')]['filter']+'%'};return _0x1164c4;}})});}_0x43061f=_[_0x5466('0x3e')]({},_0x43061f,_0x1024fb['options']);var _0xc8a723={'where':_0x43061f['where']};return db[_0x5466('0x2b')][_0x5466('0x20')](_0xc8a723)[_0x5466('0x24')](function(_0x19ba1e){_0x421c21[_0x5466('0x20')]=_0x19ba1e;if(_0x1024fb[_0x5466('0x30')][_0x5466('0x3f')]){_0x43061f[_0x5466('0x40')]=[{'all':!![]}];}return db[_0x5466('0x2b')][_0x5466('0x41')](_0x43061f);})['then'](function(_0x244cad){_0x421c21[_0x5466('0x42')]=_0x244cad;return _0x421c21;})[_0x5466('0x24')](respondWithFilteredResult(_0x3caee9,_0x43061f))[_0x5466('0x43')](handleError(_0x3caee9,null));};exports[_0x5466('0x44')]=function(_0x4dc18a,_0x9ff8a1){var _0x4151c1={'raw':!![],'where':{'id':_0x4dc18a[_0x5466('0x45')]['id']}},_0x156c87={};_0x156c87[_0x5466('0x2f')]=_[_0x5466('0x31')](db[_0x5466('0x2b')][_0x5466('0x2c')]);_0x156c87[_0x5466('0x30')]=_[_0x5466('0x31')](_0x4dc18a[_0x5466('0x30')]);_0x156c87[_0x5466('0x32')]=_[_0x5466('0x33')](_0x156c87['model'],_0x156c87[_0x5466('0x30')]);_0x4151c1['attributes']=_['intersection'](_0x156c87[_0x5466('0x2f')],qs['fields'](_0x4dc18a[_0x5466('0x30')][_0x5466('0x35')]));_0x4151c1[_0x5466('0x34')]=_0x4151c1[_0x5466('0x34')][_0x5466('0x36')]?_0x4151c1[_0x5466('0x34')]:_0x156c87[_0x5466('0x2f')];if(_0x4dc18a[_0x5466('0x30')][_0x5466('0x3f')]){_0x4151c1[_0x5466('0x40')]=[{'all':!![]}];}_0x4151c1=_[_0x5466('0x3e')]({},_0x4151c1,_0x4dc18a[_0x5466('0x46')]);return db['FaxTransferReport'][_0x5466('0x47')](_0x4151c1)[_0x5466('0x24')](handleEntityNotFound(_0x9ff8a1,null))[_0x5466('0x24')](respondWithResult(_0x9ff8a1,null))[_0x5466('0x43')](handleError(_0x9ff8a1,null));};exports[_0x5466('0x48')]=function(_0x5ac6d5,_0x2e2403){return db['FaxTransferReport'][_0x5466('0x48')](_0x5ac6d5[_0x5466('0x49')],{})[_0x5466('0x24')](respondWithResult(_0x2e2403,0xc9))['catch'](handleError(_0x2e2403,null));};exports[_0x5466('0x4a')]=function(_0x45579f,_0x4da09b){if(_0x45579f[_0x5466('0x49')]['id']){delete _0x45579f[_0x5466('0x49')]['id'];}return db[_0x5466('0x2b')][_0x5466('0x47')]({'where':{'id':_0x45579f[_0x5466('0x45')]['id']}})[_0x5466('0x24')](handleEntityNotFound(_0x4da09b,null))[_0x5466('0x24')](saveUpdates(_0x45579f[_0x5466('0x49')],null))[_0x5466('0x24')](respondWithResult(_0x4da09b,null))[_0x5466('0x43')](handleError(_0x4da09b,null));};exports[_0x5466('0x25')]=function(_0x48be13,_0x4688f4){return db['FaxTransferReport'][_0x5466('0x47')]({'where':{'id':_0x48be13[_0x5466('0x45')]['id']}})[_0x5466('0x24')](handleEntityNotFound(_0x4688f4,null))[_0x5466('0x24')](removeEntity(_0x4688f4,null))[_0x5466('0x43')](handleError(_0x4688f4,null));};exports['describe']=function(_0x27cab1,_0x38ea84){return db[_0x5466('0x2b')][_0x5466('0x4b')]()['then'](respondWithResult(_0x38ea84,null))[_0x5466('0x43')](handleError(_0x38ea84,null));}; \ No newline at end of file +var _0x99ac=['json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','index','FaxTransferReport','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','map','merge','options','include','findAll','rows','show','keys','rawAttributes','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','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'];(function(_0x70c8c3,_0x5eface){var _0x551a55=function(_0x2d825b){while(--_0x2d825b){_0x70c8c3['push'](_0x70c8c3['shift']());}};_0x551a55(++_0x5eface);}(_0x99ac,0x75));var _0xc99a=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x99ac[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0xc99a('0x0'));var rimraf=require(_0xc99a('0x1'));var zipdir=require(_0xc99a('0x2'));var jsonpatch=require(_0xc99a('0x3'));var rp=require(_0xc99a('0x4'));var moment=require(_0xc99a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc99a('0x6'));var ejs=require(_0xc99a('0x7'));var fs=require('fs');var fs_extra=require(_0xc99a('0x8'));var _=require('lodash');var squel=require(_0xc99a('0x9'));var crypto=require('crypto');var jsforce=require(_0xc99a('0xa'));var deskjs=require(_0xc99a('0xb'));var toCsv=require(_0xc99a('0x6'));var querystring=require(_0xc99a('0xc'));var Papa=require(_0xc99a('0xd'));var Redis=require(_0xc99a('0xe'));var authService=require(_0xc99a('0xf'));var qs=require(_0xc99a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc99a('0x11'));var logger=require(_0xc99a('0x12'))(_0xc99a('0x13'));var utils=require(_0xc99a('0x14'));var config=require(_0xc99a('0x15'));var licenseUtil=require(_0xc99a('0x16'));var db=require(_0xc99a('0x17'))['db'];function respondWithStatusCode(_0xfd3333,_0x196e20){_0x196e20=_0x196e20||0xcc;return function(_0x382757){if(_0x382757){return _0xfd3333[_0xc99a('0x18')](_0x196e20);}return _0xfd3333[_0xc99a('0x19')](_0x196e20)[_0xc99a('0x1a')]();};}function respondWithResult(_0x903819,_0x15342e){_0x15342e=_0x15342e||0xc8;return function(_0x3b101d){if(_0x3b101d){return _0x903819[_0xc99a('0x19')](_0x15342e)[_0xc99a('0x1b')](_0x3b101d);}};}function respondWithFilteredResult(_0x19b21b,_0x3ff7c0){return function(_0x558276){if(_0x558276){var _0x372eaa=typeof _0x3ff7c0[_0xc99a('0x1c')]===_0xc99a('0x1d')&&typeof _0x3ff7c0[_0xc99a('0x1e')]===_0xc99a('0x1d');var _0x3710de=_0x558276[_0xc99a('0x1f')];var _0x50bf00=_0x372eaa?0x0:_0x3ff7c0['offset'];var _0x342771=_0x372eaa?_0x558276['count']:_0x3ff7c0[_0xc99a('0x1c')]+_0x3ff7c0[_0xc99a('0x1e')];var _0x403d58;if(_0x342771>=_0x3710de){_0x342771=_0x3710de;_0x403d58=0xc8;}else{_0x403d58=0xce;}_0x19b21b[_0xc99a('0x19')](_0x403d58);return _0x19b21b[_0xc99a('0x20')]('Content-Range',_0x50bf00+'-'+_0x342771+'/'+_0x3710de)[_0xc99a('0x1b')](_0x558276);}return null;};}function patchUpdates(_0x1ccb8e){return function(_0x539f63){try{jsonpatch['apply'](_0x539f63,_0x1ccb8e,!![]);}catch(_0x540f63){return BPromise[_0xc99a('0x21')](_0x540f63);}return _0x539f63[_0xc99a('0x22')]();};}function saveUpdates(_0x2ac966,_0x25570c){return function(_0x486148){if(_0x486148){return _0x486148[_0xc99a('0x23')](_0x2ac966)[_0xc99a('0x24')](function(_0x50f409){return _0x50f409;});}return null;};}function removeEntity(_0x372ec1,_0x6af2a5){return function(_0x30356e){if(_0x30356e){return _0x30356e[_0xc99a('0x25')]()[_0xc99a('0x24')](function(){_0x372ec1[_0xc99a('0x19')](0xcc)[_0xc99a('0x1a')]();});}};}function handleEntityNotFound(_0x1e8425,_0xd9c83d){return function(_0x40fec6){if(!_0x40fec6){_0x1e8425['sendStatus'](0x194);}return _0x40fec6;};}function handleError(_0x31cffd,_0x121b5d){_0x121b5d=_0x121b5d||0x1f4;return function(_0x283d4e){logger[_0xc99a('0x26')](_0x283d4e['stack']);if(_0x283d4e['name']){delete _0x283d4e[_0xc99a('0x27')];}_0x31cffd[_0xc99a('0x19')](_0x121b5d)['send'](_0x283d4e);};}exports[_0xc99a('0x28')]=function(_0x1db384,_0x32861a){var _0xdfc565={},_0x5be439={},_0x5b15e7={'count':0x0,'rows':[]};var _0x500255=_['map'](db[_0xc99a('0x29')]['rawAttributes'],function(_0x2bc227){return{'name':_0x2bc227['fieldName'],'type':_0x2bc227[_0xc99a('0x2a')][_0xc99a('0x2b')]};});_0x5be439['model']=_['map'](_0x500255,'name');_0x5be439[_0xc99a('0x2c')]=_['keys'](_0x1db384[_0xc99a('0x2c')]);_0x5be439[_0xc99a('0x2d')]=_['intersection'](_0x5be439[_0xc99a('0x2e')],_0x5be439[_0xc99a('0x2c')]);_0xdfc565['attributes']=_[_0xc99a('0x2f')](_0x5be439['model'],qs['fields'](_0x1db384[_0xc99a('0x2c')][_0xc99a('0x30')]));_0xdfc565[_0xc99a('0x31')]=_0xdfc565[_0xc99a('0x31')]['length']?_0xdfc565['attributes']:_0x5be439[_0xc99a('0x2e')];if(!_0x1db384[_0xc99a('0x2c')][_0xc99a('0x32')](_0xc99a('0x33'))){_0xdfc565[_0xc99a('0x1e')]=qs[_0xc99a('0x1e')](_0x1db384[_0xc99a('0x2c')][_0xc99a('0x1e')]);_0xdfc565[_0xc99a('0x1c')]=qs[_0xc99a('0x1c')](_0x1db384[_0xc99a('0x2c')][_0xc99a('0x1c')]);}_0xdfc565[_0xc99a('0x34')]=qs[_0xc99a('0x35')](_0x1db384[_0xc99a('0x2c')][_0xc99a('0x35')]);_0xdfc565['where']=qs[_0xc99a('0x2d')](_[_0xc99a('0x36')](_0x1db384['query'],_0x5be439[_0xc99a('0x2d')]),_0x500255);if(_0x1db384[_0xc99a('0x2c')]['filter']){_0xdfc565[_0xc99a('0x37')]=_['merge'](_0xdfc565['where'],{'$or':_[_0xc99a('0x38')](_0x500255,function(_0x1ef710){if(_0x1ef710[_0xc99a('0x2a')]!=='VIRTUAL'){var _0x17dd88={};_0x17dd88[_0x1ef710[_0xc99a('0x27')]]={'$like':'%'+_0x1db384[_0xc99a('0x2c')]['filter']+'%'};return _0x17dd88;}})});}_0xdfc565=_[_0xc99a('0x39')]({},_0xdfc565,_0x1db384[_0xc99a('0x3a')]);var _0x491693={'where':_0xdfc565[_0xc99a('0x37')]};return db['FaxTransferReport'][_0xc99a('0x1f')](_0x491693)['then'](function(_0x2fe5c6){_0x5b15e7[_0xc99a('0x1f')]=_0x2fe5c6;if(_0x1db384[_0xc99a('0x2c')]['includeAll']){_0xdfc565[_0xc99a('0x3b')]=[{'all':!![]}];}return db[_0xc99a('0x29')][_0xc99a('0x3c')](_0xdfc565);})['then'](function(_0x77b8ba){_0x5b15e7[_0xc99a('0x3d')]=_0x77b8ba;return _0x5b15e7;})[_0xc99a('0x24')](respondWithFilteredResult(_0x32861a,_0xdfc565))['catch'](handleError(_0x32861a,null));};exports[_0xc99a('0x3e')]=function(_0x1f9822,_0x3cd39e){var _0x3ade25={'raw':!![],'where':{'id':_0x1f9822['params']['id']}},_0x38dc52={};_0x38dc52['model']=_[_0xc99a('0x3f')](db[_0xc99a('0x29')][_0xc99a('0x40')]);_0x38dc52[_0xc99a('0x2c')]=_[_0xc99a('0x3f')](_0x1f9822[_0xc99a('0x2c')]);_0x38dc52[_0xc99a('0x2d')]=_['intersection'](_0x38dc52[_0xc99a('0x2e')],_0x38dc52['query']);_0x3ade25[_0xc99a('0x31')]=_[_0xc99a('0x2f')](_0x38dc52['model'],qs[_0xc99a('0x30')](_0x1f9822[_0xc99a('0x2c')][_0xc99a('0x30')]));_0x3ade25[_0xc99a('0x31')]=_0x3ade25[_0xc99a('0x31')]['length']?_0x3ade25[_0xc99a('0x31')]:_0x38dc52[_0xc99a('0x2e')];if(_0x1f9822[_0xc99a('0x2c')][_0xc99a('0x41')]){_0x3ade25['include']=[{'all':!![]}];}_0x3ade25=_['merge']({},_0x3ade25,_0x1f9822[_0xc99a('0x3a')]);return db[_0xc99a('0x29')][_0xc99a('0x42')](_0x3ade25)[_0xc99a('0x24')](handleEntityNotFound(_0x3cd39e,null))[_0xc99a('0x24')](respondWithResult(_0x3cd39e,null))[_0xc99a('0x43')](handleError(_0x3cd39e,null));};exports[_0xc99a('0x44')]=function(_0x3bf9bd,_0x1e61d5){return db[_0xc99a('0x29')][_0xc99a('0x44')](_0x3bf9bd[_0xc99a('0x45')],{})[_0xc99a('0x24')](respondWithResult(_0x1e61d5,0xc9))[_0xc99a('0x43')](handleError(_0x1e61d5,null));};exports[_0xc99a('0x23')]=function(_0x5c3ea0,_0x24fb8e){if(_0x5c3ea0[_0xc99a('0x45')]['id']){delete _0x5c3ea0[_0xc99a('0x45')]['id'];}return db[_0xc99a('0x29')][_0xc99a('0x42')]({'where':{'id':_0x5c3ea0[_0xc99a('0x46')]['id']}})[_0xc99a('0x24')](handleEntityNotFound(_0x24fb8e,null))[_0xc99a('0x24')](saveUpdates(_0x5c3ea0[_0xc99a('0x45')],null))[_0xc99a('0x24')](respondWithResult(_0x24fb8e,null))[_0xc99a('0x43')](handleError(_0x24fb8e,null));};exports[_0xc99a('0x25')]=function(_0x18495b,_0x3b24d5){return db[_0xc99a('0x29')][_0xc99a('0x42')]({'where':{'id':_0x18495b[_0xc99a('0x46')]['id']}})[_0xc99a('0x24')](handleEntityNotFound(_0x3b24d5,null))[_0xc99a('0x24')](removeEntity(_0x3b24d5,null))['catch'](handleError(_0x3b24d5,null));};exports[_0xc99a('0x47')]=function(_0x4bdc41,_0x2473a2){return db[_0xc99a('0x29')][_0xc99a('0x47')]()[_0xc99a('0x24')](respondWithResult(_0x2473a2,null))['catch'](handleError(_0x2473a2,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 6da8b22..40bda60 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 _0x0f7f=['../../config/logger','moment','request-promise','../../config/environment','define','FaxTransferReport','uniqueid','lodash','util'];(function(_0x54cfaf,_0x59f305){var _0x4e80e3=function(_0x4ee6b7){while(--_0x4ee6b7){_0x54cfaf['push'](_0x54cfaf['shift']());}};_0x4e80e3(++_0x59f305);}(_0x0f7f,0x1e4));var _0xf0f7=function(_0x1e97b8,_0x12871f){_0x1e97b8=_0x1e97b8-0x0;var _0x4ef93e=_0x0f7f[_0x1e97b8];return _0x4ef93e;};'use strict';var _=require(_0xf0f7('0x0'));var util=require(_0xf0f7('0x1'));var logger=require(_0xf0f7('0x2'))('api');var moment=require(_0xf0f7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf0f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf0f7('0x5'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x438e69,_0x4fa12c){return _0x438e69[_0xf0f7('0x6')](_0xf0f7('0x7'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf0f7('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2739=['moment','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x4eae87,_0x2f46ce){var _0x4f8c9e=function(_0x55db90){while(--_0x55db90){_0x4eae87['push'](_0x4eae87['shift']());}};_0x4f8c9e(++_0x2f46ce);}(_0x2739,0x8b));var _0x9273=function(_0x351ae7,_0x1853cc){_0x351ae7=_0x351ae7-0x0;var _0x435af0=_0x2739[_0x351ae7];return _0x435af0;};'use strict';var _=require(_0x9273('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9273('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9273('0x2'));var rimraf=require(_0x9273('0x3'));var config=require('../../config/environment');var attributes=require(_0x9273('0x4'));module[_0x9273('0x5')]=function(_0x35bb0a,_0x37e8c6){return _0x35bb0a[_0x9273('0x6')](_0x9273('0x7'),attributes,{'tableName':_0x9273('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9273('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 56df4d9..ca5778c 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 _0x333a=['FaxTransferReport,\x20%s,\x20%s','message','catch','lodash','util','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','error','code'];(function(_0x4f78ba,_0x2853ed){var _0x6e4207=function(_0x562850){while(--_0x562850){_0x4f78ba['push'](_0x4f78ba['shift']());}};_0x6e4207(++_0x2853ed);}(_0x333a,0xf1));var _0xa333=function(_0x137664,_0x125ba1){_0x137664=_0x137664-0x0;var _0xb31e5c=_0x333a[_0x137664];return _0xb31e5c;};'use strict';var _=require(_0xa333('0x0'));var util=require(_0xa333('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa333('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa333('0x3'))(_0xa333('0x4'));var config=require('../../config/environment');var jayson=require(_0xa333('0x5'));var client=jayson[_0xa333('0x6')][_0xa333('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x204897,_0x4726cf,_0x1cd605){return new BPromise(function(_0x125a47,_0xb9cafe){return client[_0xa333('0x8')](_0x204897,_0x1cd605)['then'](function(_0x48449b){logger[_0xa333('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x4726cf,_0xa333('0xa'));logger[_0xa333('0xb')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x4726cf,_0xa333('0xa'),JSON['stringify'](_0x48449b));if(_0x48449b[_0xa333('0xc')]){if(_0x48449b[_0xa333('0xc')][_0xa333('0xd')]===0x1f4){logger['error'](_0xa333('0xe'),_0x4726cf,_0x48449b[_0xa333('0xc')]['message']);return _0xb9cafe(_0x48449b['error']['message']);}logger[_0xa333('0xc')](_0xa333('0xe'),_0x4726cf,_0x48449b['error']['message']);return _0x125a47(_0x48449b[_0xa333('0xc')][_0xa333('0xf')]);}else{logger[_0xa333('0x9')](_0xa333('0xe'),_0x4726cf,_0xa333('0xa'));_0x125a47(_0x48449b['result'][_0xa333('0xf')]);}})[_0xa333('0x10')](function(_0x4b9418){logger[_0xa333('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x4726cf,_0x4b9418);_0xb9cafe(_0x4b9418);});});} \ No newline at end of file +var _0x78d3=['error','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x134557,_0x19ea33){var _0x1ab4eb=function(_0x39231d){while(--_0x39231d){_0x134557['push'](_0x134557['shift']());}};_0x1ab4eb(++_0x19ea33);}(_0x78d3,0xc3));var _0x378d=function(_0x3046bb,_0x569f17){_0x3046bb=_0x3046bb-0x0;var _0x2402dc=_0x78d3[_0x3046bb];return _0x2402dc;};'use strict';var _=require(_0x378d('0x0'));var util=require('util');var moment=require(_0x378d('0x1'));var BPromise=require(_0x378d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x378d('0x3'));var db=require(_0x378d('0x4'))['db'];var utils=require(_0x378d('0x5'));var logger=require(_0x378d('0x6'))(_0x378d('0x7'));var config=require(_0x378d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x378d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x560431,_0x573eb6,_0x110ade){return new BPromise(function(_0x48d7a1,_0x5b78c6){return client['request'](_0x560431,_0x110ade)[_0x378d('0xa')](function(_0x2868a5){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x573eb6,_0x378d('0xb'));logger[_0x378d('0xc')](_0x378d('0xd'),_0x573eb6,_0x378d('0xb'),JSON[_0x378d('0xe')](_0x2868a5));if(_0x2868a5['error']){if(_0x2868a5[_0x378d('0xf')]['code']===0x1f4){logger[_0x378d('0xf')](_0x378d('0x10'),_0x573eb6,_0x2868a5[_0x378d('0xf')][_0x378d('0x11')]);return _0x5b78c6(_0x2868a5[_0x378d('0xf')]['message']);}logger[_0x378d('0xf')](_0x378d('0x10'),_0x573eb6,_0x2868a5['error'][_0x378d('0x11')]);return _0x48d7a1(_0x2868a5['error'][_0x378d('0x11')]);}else{logger[_0x378d('0x12')](_0x378d('0x10'),_0x573eb6,'request\x20sent');_0x48d7a1(_0x2868a5[_0x378d('0x13')][_0x378d('0x11')]);}})[_0x378d('0x14')](function(_0x5a0e22){logger[_0x378d('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x573eb6,_0x5a0e22);_0x5b78c6(_0x5a0e22);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8407b99..2301811 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 _0x263b=['fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x263b,0xcf));var _0xb263=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x263b[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xb263('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb263('0x1'));var express=require(_0xb263('0x2'));var router=express['Router']();var fs_extra=require(_0xb263('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb263('0x4'));var config=require(_0xb263('0x5'));var controller=require(_0xb263('0x6'));router[_0xb263('0x7')]('/',auth[_0xb263('0x8')](),controller[_0xb263('0x9')]);router[_0xb263('0x7')](_0xb263('0xa'),auth['isAuthenticated'](),controller[_0xb263('0xb')]);router['get'](_0xb263('0xc'),auth[_0xb263('0x8')](),controller[_0xb263('0xd')]);router[_0xb263('0xe')]('/',auth[_0xb263('0x8')](),controller[_0xb263('0xf')]);router[_0xb263('0x10')]('/:id',auth[_0xb263('0x8')](),controller[_0xb263('0x11')]);router[_0xb263('0x12')](_0xb263('0xc'),auth[_0xb263('0x8')](),controller[_0xb263('0x13')]);module[_0xb263('0x14')]=router; \ No newline at end of file +var _0xf223=['put','update','exports','multer','path','connect-timeout','Router','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x346e23,_0x1defdd){var _0x8cb436=function(_0x370ece){while(--_0x370ece){_0x346e23['push'](_0x346e23['shift']());}};_0x8cb436(++_0x1defdd);}(_0xf223,0x1ac));var _0x3f22=function(_0x71b675,_0x4a2b8a){_0x71b675=_0x71b675-0x0;var _0x1ce6cf=_0xf223[_0x71b675];return _0x1ce6cf;};'use strict';var multer=require(_0x3f22('0x0'));var util=require('util');var path=require(_0x3f22('0x1'));var timeout=require(_0x3f22('0x2'));var express=require('express');var router=express[_0x3f22('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3f22('0x4'));var controller=require(_0x3f22('0x5'));router[_0x3f22('0x6')]('/',auth[_0x3f22('0x7')](),controller[_0x3f22('0x8')]);router[_0x3f22('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x3f22('0x9')]);router['get'](_0x3f22('0xa'),auth['isAuthenticated'](),controller[_0x3f22('0xb')]);router[_0x3f22('0xc')]('/',auth[_0x3f22('0x7')](),controller[_0x3f22('0xd')]);router[_0x3f22('0xe')](_0x3f22('0xa'),auth[_0x3f22('0x7')](),controller[_0x3f22('0xf')]);router['delete'](_0x3f22('0xa'),auth[_0x3f22('0x7')](),controller['destroy']);module[_0x3f22('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 63ab99a..3909a07 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 _0x8f70=['fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','path','connect-timeout','express','Router'];(function(_0x1a3efe,_0x2ff877){var _0xf1a735=function(_0xb190a4){while(--_0xb190a4){_0x1a3efe['push'](_0x1a3efe['shift']());}};_0xf1a735(++_0x2ff877);}(_0x8f70,0xce));var _0x08f7=function(_0x33be38,_0x2b1dda){_0x33be38=_0x33be38-0x0;var _0x363543=_0x8f70[_0x33be38];return _0x363543;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x08f7('0x0'));var timeout=require(_0x08f7('0x1'));var express=require(_0x08f7('0x2'));var router=express[_0x08f7('0x3')]();var fs_extra=require(_0x08f7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x08f7('0x5'));var config=require(_0x08f7('0x6'));var controller=require(_0x08f7('0x7'));router[_0x08f7('0x8')]('/',auth[_0x08f7('0x9')](),controller[_0x08f7('0xa')]);router[_0x08f7('0x8')](_0x08f7('0xb'),auth[_0x08f7('0x9')](),controller['show']);router[_0x08f7('0x8')](_0x08f7('0xc'),auth[_0x08f7('0x9')](),controller[_0x08f7('0xd')]);router[_0x08f7('0x8')]('/:id/fields',auth[_0x08f7('0x9')](),controller[_0x08f7('0xe')]);router[_0x08f7('0xf')]('/',auth[_0x08f7('0x9')](),controller[_0x08f7('0x10')]);router[_0x08f7('0xf')](_0x08f7('0xc'),auth[_0x08f7('0x9')](),controller[_0x08f7('0x11')]);router[_0x08f7('0x12')]('/:id',auth[_0x08f7('0x9')](),controller[_0x08f7('0x13')]);router[_0x08f7('0x14')](_0x08f7('0xb'),auth[_0x08f7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc35f=['getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','isAuthenticated','show'];(function(_0x3384a7,_0x374ae8){var _0x3e5147=function(_0x3040e9){while(--_0x3040e9){_0x3384a7['push'](_0x3384a7['shift']());}};_0x3e5147(++_0x374ae8);}(_0xc35f,0x65));var _0xfc35=function(_0x160582,_0x451d94){_0x160582=_0x160582-0x0;var _0x4cf348=_0xc35f[_0x160582];return _0x4cf348;};'use strict';var multer=require(_0xfc35('0x0'));var util=require(_0xfc35('0x1'));var path=require(_0xfc35('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc35('0x3'));var router=express[_0xfc35('0x4')]();var fs_extra=require(_0xfc35('0x5'));var auth=require(_0xfc35('0x6'));var interaction=require(_0xfc35('0x7'));var config=require(_0xfc35('0x8'));var controller=require(_0xfc35('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfc35('0xa')](_0xfc35('0xb'),auth[_0xfc35('0xc')](),controller[_0xfc35('0xd')]);router[_0xfc35('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xfc35('0xe')]);router['get'](_0xfc35('0xf'),auth[_0xfc35('0xc')](),controller[_0xfc35('0x10')]);router['post']('/',auth[_0xfc35('0xc')](),controller[_0xfc35('0x11')]);router[_0xfc35('0x12')](_0xfc35('0x13'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xfc35('0x14')](_0xfc35('0xb'),auth[_0xfc35('0xc')](),controller[_0xfc35('0x15')]);router['delete'](_0xfc35('0xb'),auth[_0xfc35('0xc')](),controller[_0xfc35('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index bb7253e..59addd9 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 _0xa732=['STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa732,0x125));var _0x2a73=function(_0x180ba1,_0x57c646){_0x180ba1=_0x180ba1-0x0;var _0x3ce134=_0xa732[_0x180ba1];return _0x3ce134;};'use strict';var Sequelize=require(_0x2a73('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a73('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2a73('0x1')]},'remoteUri':{'type':Sequelize[_0x2a73('0x1')]},'authType':{'type':Sequelize[_0x2a73('0x2')](_0x2a73('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x2a73('0x1')]},'consumerKey':{'type':Sequelize[_0x2a73('0x1')]},'consumerSecret':{'type':Sequelize[_0x2a73('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x2a73('0x1')]},'serverUrl':{'type':Sequelize[_0x2a73('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2a73('0x2')](_0x2a73('0x4'),_0x2a73('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x423e=['ENUM','basic','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x26bec8,_0x2cca48){var _0x4a5d80=function(_0x3f819d){while(--_0x3f819d){_0x26bec8['push'](_0x26bec8['shift']());}};_0x4a5d80(++_0x2cca48);}(_0x423e,0xf2));var _0xe423=function(_0x3c54d3,_0x9719e3){_0x3c54d3=_0x3c54d3-0x0;var _0xd67c8f=_0x423e[_0x3c54d3];return _0xd67c8f;};'use strict';var Sequelize=require(_0xe423('0x0'));module[_0xe423('0x1')]={'name':{'type':Sequelize[_0xe423('0x2')]},'description':{'type':Sequelize[_0xe423('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe423('0x2')]},'authType':{'type':Sequelize[_0xe423('0x3')](_0xe423('0x4')),'defaultValue':_0xe423('0x4')},'password':{'type':Sequelize[_0xe423('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xe423('0x2')]},'token':{'type':Sequelize[_0xe423('0x2')]},'tokenSecret':{'type':Sequelize[_0xe423('0x2')]},'serverUrl':{'type':Sequelize[_0xe423('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe423('0x3')]('integrationTab',_0xe423('0x5')),'defaultValue':_0xe423('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 650fad4..882fa43 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 _0x18c4=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','DeskAccount','includeAll','include','rows','show','params','keys','options','catch','create','body','find','findOne','DeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority','consumerKey','consumerSecret','token','tokenSecret','remoteUri','substring','lastIndexOf','GET','format','application/json','authType','basic','Authorization','Basic\x20%s','%s:%s','username','password','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','end','error','name','index','map','rawAttributes','fieldName','key','query'];(function(_0x2792d6,_0x3e2020){var _0x8c1498=function(_0x2fb2f5){while(--_0x2fb2f5){_0x2792d6['push'](_0x2792d6['shift']());}};_0x8c1498(++_0x3e2020);}(_0x18c4,0x1a0));var _0x418c=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0x18c4[_0x21d36e];return _0x4cc307;};'use strict';var emlformat=require(_0x418c('0x0'));var rimraf=require(_0x418c('0x1'));var zipdir=require(_0x418c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x418c('0x3'));var moment=require(_0x418c('0x4'));var BPromise=require(_0x418c('0x5'));var Mustache=require(_0x418c('0x6'));var util=require(_0x418c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x418c('0x8'));var ejs=require(_0x418c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x418c('0xa'));var squel=require(_0x418c('0xb'));var crypto=require('crypto');var jsforce=require(_0x418c('0xc'));var deskjs=require(_0x418c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x418c('0xe'));var Papa=require(_0x418c('0xf'));var Redis=require('ioredis');var authService=require(_0x418c('0x10'));var qs=require(_0x418c('0x11'));var as=require(_0x418c('0x12'));var hardwareService=require(_0x418c('0x13'));var logger=require(_0x418c('0x14'))(_0x418c('0x15'));var utils=require(_0x418c('0x16'));var config=require(_0x418c('0x17'));var licenseUtil=require(_0x418c('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x418c('0x19'));function respondWithStatusCode(_0x508afc,_0x559258){_0x559258=_0x559258||0xcc;return function(_0x4c7de4){if(_0x4c7de4){return _0x508afc[_0x418c('0x1a')](_0x559258);}return _0x508afc[_0x418c('0x1b')](_0x559258)['end']();};}function respondWithResult(_0x386339,_0x3c98f4){_0x3c98f4=_0x3c98f4||0xc8;return function(_0x168d12){if(_0x168d12){return _0x386339[_0x418c('0x1b')](_0x3c98f4)['json'](_0x168d12);}};}function respondWithFilteredResult(_0x1d13c3,_0x580ffa){return function(_0x5908ee){if(_0x5908ee){var _0x21ef09=typeof _0x580ffa[_0x418c('0x1c')]===_0x418c('0x1d')&&typeof _0x580ffa[_0x418c('0x1e')]===_0x418c('0x1d');var _0x410bc3=_0x5908ee[_0x418c('0x1f')];var _0x551b68=_0x21ef09?0x0:_0x580ffa[_0x418c('0x1c')];var _0x5e562c=_0x21ef09?_0x5908ee[_0x418c('0x1f')]:_0x580ffa['offset']+_0x580ffa[_0x418c('0x1e')];var _0x109387;if(_0x5e562c>=_0x410bc3){_0x5e562c=_0x410bc3;_0x109387=0xc8;}else{_0x109387=0xce;}_0x1d13c3[_0x418c('0x1b')](_0x109387);return _0x1d13c3['set'](_0x418c('0x20'),_0x551b68+'-'+_0x5e562c+'/'+_0x410bc3)[_0x418c('0x21')](_0x5908ee);}return null;};}function patchUpdates(_0x38fb3e){return function(_0x27603a){try{jsonpatch[_0x418c('0x22')](_0x27603a,_0x38fb3e,!![]);}catch(_0x5f1c3a){return BPromise[_0x418c('0x23')](_0x5f1c3a);}return _0x27603a[_0x418c('0x24')]();};}function saveUpdates(_0x5e6473,_0x456de3){return function(_0x3ac874){if(_0x3ac874){return _0x3ac874[_0x418c('0x25')](_0x5e6473)[_0x418c('0x26')](function(_0x482e92){return _0x482e92;});}return null;};}function removeEntity(_0x3a81fa,_0x183051){return function(_0x205c01){if(_0x205c01){return _0x205c01['destroy']()[_0x418c('0x26')](function(){_0x3a81fa[_0x418c('0x1b')](0xcc)[_0x418c('0x27')]();});}};}function handleEntityNotFound(_0xf09cdd,_0x1d8466){return function(_0x1f7455){if(!_0x1f7455){_0xf09cdd['sendStatus'](0x194);}return _0x1f7455;};}function handleError(_0xee0f8c,_0x5a942d){_0x5a942d=_0x5a942d||0x1f4;return function(_0x59edbd){logger[_0x418c('0x28')](_0x59edbd['stack']);if(_0x59edbd[_0x418c('0x29')]){delete _0x59edbd[_0x418c('0x29')];}_0xee0f8c[_0x418c('0x1b')](_0x5a942d)['send'](_0x59edbd);};}exports[_0x418c('0x2a')]=function(_0x213b10,_0x354826){var _0x47aaf4={},_0x4ff40b={},_0x961aee={'count':0x0,'rows':[]};var _0x33cfbe=_[_0x418c('0x2b')](db['DeskAccount'][_0x418c('0x2c')],function(_0x5ac1f8){return{'name':_0x5ac1f8[_0x418c('0x2d')],'type':_0x5ac1f8['type'][_0x418c('0x2e')]};});_0x4ff40b['model']=_[_0x418c('0x2b')](_0x33cfbe,_0x418c('0x29'));_0x4ff40b['query']=_['keys'](_0x213b10[_0x418c('0x2f')]);_0x4ff40b[_0x418c('0x30')]=_[_0x418c('0x31')](_0x4ff40b[_0x418c('0x32')],_0x4ff40b[_0x418c('0x2f')]);_0x47aaf4[_0x418c('0x33')]=_[_0x418c('0x31')](_0x4ff40b[_0x418c('0x32')],qs[_0x418c('0x34')](_0x213b10[_0x418c('0x2f')][_0x418c('0x34')]));_0x47aaf4[_0x418c('0x33')]=_0x47aaf4[_0x418c('0x33')][_0x418c('0x35')]?_0x47aaf4[_0x418c('0x33')]:_0x4ff40b[_0x418c('0x32')];if(!_0x213b10['query'][_0x418c('0x36')](_0x418c('0x37'))){_0x47aaf4['limit']=qs['limit'](_0x213b10['query'][_0x418c('0x1e')]);_0x47aaf4[_0x418c('0x1c')]=qs[_0x418c('0x1c')](_0x213b10[_0x418c('0x2f')][_0x418c('0x1c')]);}_0x47aaf4[_0x418c('0x38')]=qs[_0x418c('0x39')](_0x213b10[_0x418c('0x2f')][_0x418c('0x39')]);_0x47aaf4[_0x418c('0x3a')]=qs[_0x418c('0x30')](_[_0x418c('0x3b')](_0x213b10[_0x418c('0x2f')],_0x4ff40b[_0x418c('0x30')]),_0x33cfbe);if(_0x213b10[_0x418c('0x2f')][_0x418c('0x3c')]){_0x47aaf4['where']=_['merge'](_0x47aaf4[_0x418c('0x3a')],{'$or':_[_0x418c('0x2b')](_0x33cfbe,function(_0x3b1399){if(_0x3b1399[_0x418c('0x3d')]!==_0x418c('0x3e')){var _0x38db28={};_0x38db28[_0x3b1399[_0x418c('0x29')]]={'$like':'%'+_0x213b10[_0x418c('0x2f')][_0x418c('0x3c')]+'%'};return _0x38db28;}})});}_0x47aaf4=_[_0x418c('0x3f')]({},_0x47aaf4,_0x213b10['options']);var _0x1741f4={'where':_0x47aaf4['where']};return db[_0x418c('0x40')][_0x418c('0x1f')](_0x1741f4)[_0x418c('0x26')](function(_0x454307){_0x961aee[_0x418c('0x1f')]=_0x454307;if(_0x213b10[_0x418c('0x2f')][_0x418c('0x41')]){_0x47aaf4[_0x418c('0x42')]=[{'all':!![]}];}return db[_0x418c('0x40')]['findAll'](_0x47aaf4);})[_0x418c('0x26')](function(_0x233ff7){_0x961aee[_0x418c('0x43')]=_0x233ff7;return _0x961aee;})[_0x418c('0x26')](respondWithFilteredResult(_0x354826,_0x47aaf4))['catch'](handleError(_0x354826,null));};exports[_0x418c('0x44')]=function(_0xb73b5a,_0x270318){var _0x2c21ef={'raw':![],'where':{'id':_0xb73b5a[_0x418c('0x45')]['id']}},_0x4ad3df={};_0x4ad3df[_0x418c('0x32')]=_[_0x418c('0x46')](db[_0x418c('0x40')][_0x418c('0x2c')]);_0x4ad3df[_0x418c('0x2f')]=_['keys'](_0xb73b5a[_0x418c('0x2f')]);_0x4ad3df[_0x418c('0x30')]=_['intersection'](_0x4ad3df[_0x418c('0x32')],_0x4ad3df[_0x418c('0x2f')]);_0x2c21ef[_0x418c('0x33')]=_[_0x418c('0x31')](_0x4ad3df['model'],qs[_0x418c('0x34')](_0xb73b5a[_0x418c('0x2f')][_0x418c('0x34')]));_0x2c21ef[_0x418c('0x33')]=_0x2c21ef[_0x418c('0x33')][_0x418c('0x35')]?_0x2c21ef[_0x418c('0x33')]:_0x4ad3df[_0x418c('0x32')];if(_0xb73b5a[_0x418c('0x2f')][_0x418c('0x41')]){_0x2c21ef[_0x418c('0x42')]=[{'all':!![]}];}_0x2c21ef=_[_0x418c('0x3f')]({},_0x2c21ef,_0xb73b5a[_0x418c('0x47')]);return db[_0x418c('0x40')]['find'](_0x2c21ef)[_0x418c('0x26')](handleEntityNotFound(_0x270318,null))['then'](respondWithResult(_0x270318,null))[_0x418c('0x48')](handleError(_0x270318,null));};exports[_0x418c('0x49')]=function(_0x9771ba,_0x2f3e0e){return db[_0x418c('0x40')][_0x418c('0x49')](_0x9771ba['body'],{})[_0x418c('0x26')](respondWithResult(_0x2f3e0e,0xc9))['catch'](handleError(_0x2f3e0e,null));};exports[_0x418c('0x25')]=function(_0x550a6c,_0x451bfb){if(_0x550a6c['body']['id']){delete _0x550a6c[_0x418c('0x4a')]['id'];}return db[_0x418c('0x40')][_0x418c('0x4b')]({'where':{'id':_0x550a6c[_0x418c('0x45')]['id']}})[_0x418c('0x26')](handleEntityNotFound(_0x451bfb,null))[_0x418c('0x26')](saveUpdates(_0x550a6c[_0x418c('0x4a')],null))[_0x418c('0x26')](respondWithResult(_0x451bfb,null))['catch'](handleError(_0x451bfb,null));};exports['destroy']=function(_0x4ec30f,_0x5e7533){return db[_0x418c('0x40')][_0x418c('0x4b')]({'where':{'id':_0x4ec30f[_0x418c('0x45')]['id']}})[_0x418c('0x26')](handleEntityNotFound(_0x5e7533,null))[_0x418c('0x26')](removeEntity(_0x5e7533,null))[_0x418c('0x48')](handleError(_0x5e7533,null));};exports['getConfigurations']=function(_0x5c1874,_0x50ff56,_0x31f6b6){var _0x1f2308={};var _0x4d8adf={};var _0x3f7c9d;var _0x4fbf8e;return db['DeskAccount'][_0x418c('0x4c')]({'where':{'id':_0x5c1874[_0x418c('0x45')]['id']}})[_0x418c('0x26')](handleEntityNotFound(_0x50ff56,null))[_0x418c('0x26')](function(_0x38499b){if(_0x38499b){_0x3f7c9d=_0x38499b;_0x4d8adf[_0x418c('0x32')]=_['keys'](db[_0x418c('0x4d')]['rawAttributes']);_0x4d8adf[_0x418c('0x2f')]=_[_0x418c('0x46')](_0x5c1874['query']);_0x4d8adf[_0x418c('0x30')]=_[_0x418c('0x31')](_0x4d8adf[_0x418c('0x32')],_0x4d8adf[_0x418c('0x2f')]);_0x1f2308[_0x418c('0x33')]=_[_0x418c('0x31')](_0x4d8adf[_0x418c('0x32')],qs[_0x418c('0x34')](_0x5c1874[_0x418c('0x2f')]['fields']));_0x1f2308[_0x418c('0x33')]=_0x1f2308[_0x418c('0x33')][_0x418c('0x35')]?_0x1f2308['attributes']:_0x4d8adf[_0x418c('0x32')];_0x1f2308[_0x418c('0x38')]=qs[_0x418c('0x39')](_0x5c1874[_0x418c('0x2f')][_0x418c('0x39')]);_0x1f2308[_0x418c('0x3a')]=qs[_0x418c('0x30')](_[_0x418c('0x3b')](_0x5c1874['query'],_0x4d8adf[_0x418c('0x30')]));if(_0x5c1874[_0x418c('0x2f')][_0x418c('0x3c')]){_0x1f2308[_0x418c('0x3a')]=_[_0x418c('0x3f')](_0x1f2308[_0x418c('0x3a')],{'$or':_[_0x418c('0x2b')](_0x1f2308[_0x418c('0x33')],function(_0x1569a7){var _0x407805={};_0x407805[_0x1569a7]={'$like':'%'+_0x5c1874[_0x418c('0x2f')]['filter']+'%'};return _0x407805;})});}_0x1f2308=_[_0x418c('0x3f')]({},_0x1f2308,_0x5c1874[_0x418c('0x47')]);return _0x3f7c9d['getConfigurations'](_0x1f2308);}})['then'](function(_0x365bae){if(_0x365bae){_0x4fbf8e=_0x365bae[_0x418c('0x35')];if(!_0x5c1874['query'][_0x418c('0x36')](_0x418c('0x37'))){_0x1f2308[_0x418c('0x1e')]=qs[_0x418c('0x1e')](_0x5c1874[_0x418c('0x2f')][_0x418c('0x1e')]);_0x1f2308[_0x418c('0x1c')]=qs[_0x418c('0x1c')](_0x5c1874[_0x418c('0x2f')][_0x418c('0x1c')]);}return _0x3f7c9d[_0x418c('0x4e')](_0x1f2308);}})[_0x418c('0x26')](function(_0x4bf9ea){if(_0x4bf9ea){return _0x4bf9ea?{'count':_0x4fbf8e,'rows':_0x4bf9ea}:null;}})[_0x418c('0x26')](respondWithResult(_0x50ff56,null))[_0x418c('0x48')](handleError(_0x50ff56,null));};exports[_0x418c('0x4f')]=function(_0x1895bd,_0xc9bfd0,_0x51c814){if(_0x1895bd[_0x418c('0x4a')]['id']){delete _0x1895bd['body']['id'];}return db[_0x418c('0x40')][_0x418c('0x4c')]({'where':{'id':_0x1895bd[_0x418c('0x45')]['id']}})[_0x418c('0x26')](handleEntityNotFound(_0xc9bfd0,null))[_0x418c('0x26')](function(_0x3f393a){if(_0x3f393a){_0x1895bd['body']['AccountId']=_0x3f393a['id'];_0x1895bd[_0x418c('0x4a')][_0x418c('0x50')]=integrations[_0x418c('0x51')](_0x1895bd['body'][_0x418c('0x52')],_0x1895bd[_0x418c('0x4a')][_0x418c('0x3d')]);_0x1895bd['body'][_0x418c('0x53')]=integrations[_0x418c('0x54')](_0x1895bd[_0x418c('0x4a')][_0x418c('0x52')],_0x1895bd[_0x418c('0x4a')][_0x418c('0x3d')]);return db[_0x418c('0x4d')][_0x418c('0x49')](_0x1895bd[_0x418c('0x4a')],{'include':[{'model':db[_0x418c('0x55')],'as':_0x418c('0x50')},{'model':db['DeskField'],'as':_0x418c('0x53')}]});}return null;})[_0x418c('0x26')](respondWithResult(_0xc9bfd0,null))[_0x418c('0x48')](handleError(_0xc9bfd0,null));};exports['getFields']=function(_0x9f2a46,_0x132535,_0x2a807d){var _0x3de6ab=[{'name':_0x418c('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5bea67='';return db[_0x418c('0x40')][_0x418c('0x4c')]({'where':{'id':_0x9f2a46[_0x418c('0x45')]['id']},'attributes':['id','remoteUri','authType','username','password',_0x418c('0x57'),_0x418c('0x58'),_0x418c('0x59'),_0x418c('0x5a')]})[_0x418c('0x26')](handleEntityNotFound(_0x132535,null))['then'](function(_0x435e4c){if(_0x435e4c){_0x5bea67=_0x435e4c[_0x418c('0x5b')];var _0x26d64f=_0x5bea67['slice'](-0x1);if(_0x26d64f==='/'){_0x5bea67=_0x5bea67[_0x418c('0x5c')](0x0,_0x5bea67[_0x418c('0x5d')](_0x26d64f));}var _0x290081={'method':_0x418c('0x5e'),'uri':util[_0x418c('0x5f')]('%s/custom_fields',_0x5bea67),'headers':{'Content-Type':'application/json','Accept':_0x418c('0x60')},'json':!![]};if(_0x435e4c[_0x418c('0x61')]===_0x418c('0x62')){_0x290081['headers'][_0x418c('0x63')]=util[_0x418c('0x5f')](_0x418c('0x64'),new Buffer(util['format'](_0x418c('0x65'),_0x435e4c[_0x418c('0x66')],_0x435e4c[_0x418c('0x67')]))[_0x418c('0x68')](_0x418c('0x69')));}return rp(_0x290081)[_0x418c('0x26')](function(_0x585d16){return _0x3de6ab[_0x418c('0x6a')](_[_0x418c('0x2b')](_0x585d16['_embedded'][_0x418c('0x6b')],function(_0x288d7e){return{'id':_0x288d7e[_0x418c('0x29')],'name':_0x288d7e[_0x418c('0x29')],'type':_0x288d7e[_0x418c('0x3d')],'active':_0x288d7e[_0x418c('0x6c')],'label':_0x288d7e[_0x418c('0x6d')],'custom':!![]};}));});}})['then'](function(_0x4eca57){return{'count':_0x4eca57['length'],'rows':_0x4eca57};})[_0x418c('0x26')](respondWithResult(_0x132535,null))[_0x418c('0x48')](function(_0x3acd2d){var _0x4e66fb=_0x9f2a46['query'][_0x418c('0x6e')]?0x1f4:_0x3acd2d[_0x418c('0x6f')]||0x1f4;logger['error'](_0x418c('0x70'),_0x418c('0x71'),_0x4e66fb,JSON[_0x418c('0x72')](_0x3acd2d));delete _0x3acd2d['name'];if(_0x4e66fb===0x191){_0x4e66fb=0x190;}_0x132535[_0x418c('0x1b')](_0x4e66fb)[_0x418c('0x73')](_0x9f2a46[_0x418c('0x2f')][_0x418c('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x3acd2d['statusCode']}:_0x3acd2d);});}; \ No newline at end of file +var _0x663c=['lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','password','toString','concat','_embedded','entries','active','label','test','statusCode','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','DeskAccount','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','options','find','create','body','params','getConfigurations','DeskConfiguration','pick','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','token','tokenSecret','slice','substring'];(function(_0x1a0322,_0x2802d4){var _0x391779=function(_0x3d3c7c){while(--_0x3d3c7c){_0x1a0322['push'](_0x1a0322['shift']());}};_0x391779(++_0x2802d4);}(_0x663c,0xf5));var _0xc663=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x663c[_0x3f6bcf];return _0x1c5350;};'use strict';var emlformat=require(_0xc663('0x0'));var rimraf=require(_0xc663('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc663('0x2'));var rp=require(_0xc663('0x3'));var moment=require(_0xc663('0x4'));var BPromise=require(_0xc663('0x5'));var Mustache=require(_0xc663('0x6'));var util=require('util');var path=require(_0xc663('0x7'));var sox=require(_0xc663('0x8'));var csv=require(_0xc663('0x9'));var ejs=require(_0xc663('0xa'));var fs=require('fs');var fs_extra=require(_0xc663('0xb'));var _=require(_0xc663('0xc'));var squel=require(_0xc663('0xd'));var crypto=require(_0xc663('0xe'));var jsforce=require(_0xc663('0xf'));var deskjs=require(_0xc663('0x10'));var toCsv=require(_0xc663('0x9'));var querystring=require('querystring');var Papa=require(_0xc663('0x11'));var Redis=require(_0xc663('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc663('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc663('0x14'));var logger=require(_0xc663('0x15'))('api');var utils=require(_0xc663('0x16'));var config=require(_0xc663('0x17'));var licenseUtil=require(_0xc663('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc663('0x19'));function respondWithStatusCode(_0x4ff0b9,_0x867d68){_0x867d68=_0x867d68||0xcc;return function(_0x15b399){if(_0x15b399){return _0x4ff0b9['sendStatus'](_0x867d68);}return _0x4ff0b9[_0xc663('0x1a')](_0x867d68)[_0xc663('0x1b')]();};}function respondWithResult(_0x57cacd,_0x54a9ab){_0x54a9ab=_0x54a9ab||0xc8;return function(_0x284a5e){if(_0x284a5e){return _0x57cacd['status'](_0x54a9ab)[_0xc663('0x1c')](_0x284a5e);}};}function respondWithFilteredResult(_0x2c58b8,_0x2532a7){return function(_0x17436b){if(_0x17436b){var _0x4affd4=typeof _0x2532a7[_0xc663('0x1d')]===_0xc663('0x1e')&&typeof _0x2532a7['limit']==='undefined';var _0x12a20b=_0x17436b[_0xc663('0x1f')];var _0x1722b9=_0x4affd4?0x0:_0x2532a7[_0xc663('0x1d')];var _0xceb0c9=_0x4affd4?_0x17436b[_0xc663('0x1f')]:_0x2532a7[_0xc663('0x1d')]+_0x2532a7[_0xc663('0x20')];var _0x48514a;if(_0xceb0c9>=_0x12a20b){_0xceb0c9=_0x12a20b;_0x48514a=0xc8;}else{_0x48514a=0xce;}_0x2c58b8[_0xc663('0x1a')](_0x48514a);return _0x2c58b8['set'](_0xc663('0x21'),_0x1722b9+'-'+_0xceb0c9+'/'+_0x12a20b)[_0xc663('0x1c')](_0x17436b);}return null;};}function patchUpdates(_0x1205d2){return function(_0x33350b){try{jsonpatch[_0xc663('0x22')](_0x33350b,_0x1205d2,!![]);}catch(_0x146a8e){return BPromise[_0xc663('0x23')](_0x146a8e);}return _0x33350b['save']();};}function saveUpdates(_0x4a0356,_0x336ef4){return function(_0x3fee1f){if(_0x3fee1f){return _0x3fee1f[_0xc663('0x24')](_0x4a0356)[_0xc663('0x25')](function(_0x1d7813){return _0x1d7813;});}return null;};}function removeEntity(_0x5b6a71,_0x5e3c17){return function(_0xe670f9){if(_0xe670f9){return _0xe670f9[_0xc663('0x26')]()[_0xc663('0x25')](function(){_0x5b6a71[_0xc663('0x1a')](0xcc)[_0xc663('0x1b')]();});}};}function handleEntityNotFound(_0x419b2f,_0x591afe){return function(_0x5e3c4a){if(!_0x5e3c4a){_0x419b2f['sendStatus'](0x194);}return _0x5e3c4a;};}function handleError(_0x354ec3,_0x3090bc){_0x3090bc=_0x3090bc||0x1f4;return function(_0x5e20b7){logger[_0xc663('0x27')](_0x5e20b7[_0xc663('0x28')]);if(_0x5e20b7[_0xc663('0x29')]){delete _0x5e20b7['name'];}_0x354ec3[_0xc663('0x1a')](_0x3090bc)['send'](_0x5e20b7);};}exports[_0xc663('0x2a')]=function(_0x3a33f2,_0x58da86){var _0x323712={},_0x5bf383={},_0x1f5b22={'count':0x0,'rows':[]};var _0x3378d9=_[_0xc663('0x2b')](db[_0xc663('0x2c')]['rawAttributes'],function(_0x1c764f){return{'name':_0x1c764f[_0xc663('0x2d')],'type':_0x1c764f[_0xc663('0x2e')]['key']};});_0x5bf383[_0xc663('0x2f')]=_[_0xc663('0x2b')](_0x3378d9,_0xc663('0x29'));_0x5bf383['query']=_[_0xc663('0x30')](_0x3a33f2[_0xc663('0x31')]);_0x5bf383[_0xc663('0x32')]=_[_0xc663('0x33')](_0x5bf383[_0xc663('0x2f')],_0x5bf383['query']);_0x323712[_0xc663('0x34')]=_[_0xc663('0x33')](_0x5bf383[_0xc663('0x2f')],qs['fields'](_0x3a33f2['query']['fields']));_0x323712[_0xc663('0x34')]=_0x323712[_0xc663('0x34')][_0xc663('0x35')]?_0x323712[_0xc663('0x34')]:_0x5bf383['model'];if(!_0x3a33f2['query'][_0xc663('0x36')]('nolimit')){_0x323712[_0xc663('0x20')]=qs[_0xc663('0x20')](_0x3a33f2[_0xc663('0x31')][_0xc663('0x20')]);_0x323712['offset']=qs[_0xc663('0x1d')](_0x3a33f2[_0xc663('0x31')][_0xc663('0x1d')]);}_0x323712[_0xc663('0x37')]=qs[_0xc663('0x38')](_0x3a33f2[_0xc663('0x31')]['sort']);_0x323712['where']=qs[_0xc663('0x32')](_['pick'](_0x3a33f2[_0xc663('0x31')],_0x5bf383[_0xc663('0x32')]),_0x3378d9);if(_0x3a33f2[_0xc663('0x31')][_0xc663('0x39')]){_0x323712['where']=_[_0xc663('0x3a')](_0x323712['where'],{'$or':_[_0xc663('0x2b')](_0x3378d9,function(_0x24eaf9){if(_0x24eaf9[_0xc663('0x2e')]!==_0xc663('0x3b')){var _0x7fea98={};_0x7fea98[_0x24eaf9[_0xc663('0x29')]]={'$like':'%'+_0x3a33f2[_0xc663('0x31')][_0xc663('0x39')]+'%'};return _0x7fea98;}})});}_0x323712=_[_0xc663('0x3a')]({},_0x323712,_0x3a33f2['options']);var _0x504375={'where':_0x323712[_0xc663('0x3c')]};return db[_0xc663('0x2c')][_0xc663('0x1f')](_0x504375)[_0xc663('0x25')](function(_0x3bbfa8){_0x1f5b22[_0xc663('0x1f')]=_0x3bbfa8;if(_0x3a33f2[_0xc663('0x31')][_0xc663('0x3d')]){_0x323712[_0xc663('0x3e')]=[{'all':!![]}];}return db[_0xc663('0x2c')][_0xc663('0x3f')](_0x323712);})['then'](function(_0x45d6c0){_0x1f5b22[_0xc663('0x40')]=_0x45d6c0;return _0x1f5b22;})[_0xc663('0x25')](respondWithFilteredResult(_0x58da86,_0x323712))[_0xc663('0x41')](handleError(_0x58da86,null));};exports[_0xc663('0x42')]=function(_0x4ed276,_0x39c0d2){var _0x4627a0={'raw':![],'where':{'id':_0x4ed276['params']['id']}},_0x10830d={};_0x10830d[_0xc663('0x2f')]=_['keys'](db[_0xc663('0x2c')][_0xc663('0x43')]);_0x10830d['query']=_[_0xc663('0x30')](_0x4ed276[_0xc663('0x31')]);_0x10830d[_0xc663('0x32')]=_[_0xc663('0x33')](_0x10830d[_0xc663('0x2f')],_0x10830d['query']);_0x4627a0[_0xc663('0x34')]=_['intersection'](_0x10830d[_0xc663('0x2f')],qs[_0xc663('0x44')](_0x4ed276['query'][_0xc663('0x44')]));_0x4627a0['attributes']=_0x4627a0[_0xc663('0x34')]['length']?_0x4627a0[_0xc663('0x34')]:_0x10830d[_0xc663('0x2f')];if(_0x4ed276['query'][_0xc663('0x3d')]){_0x4627a0[_0xc663('0x3e')]=[{'all':!![]}];}_0x4627a0=_[_0xc663('0x3a')]({},_0x4627a0,_0x4ed276[_0xc663('0x45')]);return db['DeskAccount'][_0xc663('0x46')](_0x4627a0)[_0xc663('0x25')](handleEntityNotFound(_0x39c0d2,null))['then'](respondWithResult(_0x39c0d2,null))['catch'](handleError(_0x39c0d2,null));};exports[_0xc663('0x47')]=function(_0x76df04,_0x1d79c6){return db[_0xc663('0x2c')][_0xc663('0x47')](_0x76df04['body'],{})[_0xc663('0x25')](respondWithResult(_0x1d79c6,0xc9))['catch'](handleError(_0x1d79c6,null));};exports[_0xc663('0x24')]=function(_0x4515a3,_0x34da01){if(_0x4515a3[_0xc663('0x48')]['id']){delete _0x4515a3[_0xc663('0x48')]['id'];}return db[_0xc663('0x2c')][_0xc663('0x46')]({'where':{'id':_0x4515a3[_0xc663('0x49')]['id']}})['then'](handleEntityNotFound(_0x34da01,null))['then'](saveUpdates(_0x4515a3[_0xc663('0x48')],null))[_0xc663('0x25')](respondWithResult(_0x34da01,null))[_0xc663('0x41')](handleError(_0x34da01,null));};exports[_0xc663('0x26')]=function(_0x5eb6fb,_0x5420a2){return db[_0xc663('0x2c')][_0xc663('0x46')]({'where':{'id':_0x5eb6fb['params']['id']}})['then'](handleEntityNotFound(_0x5420a2,null))['then'](removeEntity(_0x5420a2,null))[_0xc663('0x41')](handleError(_0x5420a2,null));};exports[_0xc663('0x4a')]=function(_0x111fda,_0x30358b,_0x1b64c7){var _0x22dc44={};var _0x1bfddb={};var _0x1f6746;var _0x4c4112;return db['DeskAccount']['findOne']({'where':{'id':_0x111fda['params']['id']}})[_0xc663('0x25')](handleEntityNotFound(_0x30358b,null))[_0xc663('0x25')](function(_0x1d1136){if(_0x1d1136){_0x1f6746=_0x1d1136;_0x1bfddb[_0xc663('0x2f')]=_['keys'](db[_0xc663('0x4b')][_0xc663('0x43')]);_0x1bfddb[_0xc663('0x31')]=_['keys'](_0x111fda[_0xc663('0x31')]);_0x1bfddb[_0xc663('0x32')]=_[_0xc663('0x33')](_0x1bfddb['model'],_0x1bfddb[_0xc663('0x31')]);_0x22dc44[_0xc663('0x34')]=_[_0xc663('0x33')](_0x1bfddb[_0xc663('0x2f')],qs[_0xc663('0x44')](_0x111fda[_0xc663('0x31')][_0xc663('0x44')]));_0x22dc44[_0xc663('0x34')]=_0x22dc44[_0xc663('0x34')][_0xc663('0x35')]?_0x22dc44[_0xc663('0x34')]:_0x1bfddb[_0xc663('0x2f')];_0x22dc44[_0xc663('0x37')]=qs[_0xc663('0x38')](_0x111fda[_0xc663('0x31')][_0xc663('0x38')]);_0x22dc44[_0xc663('0x3c')]=qs[_0xc663('0x32')](_[_0xc663('0x4c')](_0x111fda[_0xc663('0x31')],_0x1bfddb[_0xc663('0x32')]));if(_0x111fda[_0xc663('0x31')][_0xc663('0x39')]){_0x22dc44[_0xc663('0x3c')]=_[_0xc663('0x3a')](_0x22dc44[_0xc663('0x3c')],{'$or':_[_0xc663('0x2b')](_0x22dc44[_0xc663('0x34')],function(_0x54d03a){var _0x24592d={};_0x24592d[_0x54d03a]={'$like':'%'+_0x111fda['query'][_0xc663('0x39')]+'%'};return _0x24592d;})});}_0x22dc44=_[_0xc663('0x3a')]({},_0x22dc44,_0x111fda[_0xc663('0x45')]);return _0x1f6746[_0xc663('0x4a')](_0x22dc44);}})[_0xc663('0x25')](function(_0x3a3ded){if(_0x3a3ded){_0x4c4112=_0x3a3ded[_0xc663('0x35')];if(!_0x111fda[_0xc663('0x31')]['hasOwnProperty']('nolimit')){_0x22dc44['limit']=qs[_0xc663('0x20')](_0x111fda[_0xc663('0x31')][_0xc663('0x20')]);_0x22dc44['offset']=qs['offset'](_0x111fda[_0xc663('0x31')][_0xc663('0x1d')]);}return _0x1f6746[_0xc663('0x4a')](_0x22dc44);}})[_0xc663('0x25')](function(_0x56da0e){if(_0x56da0e){return _0x56da0e?{'count':_0x4c4112,'rows':_0x56da0e}:null;}})[_0xc663('0x25')](respondWithResult(_0x30358b,null))[_0xc663('0x41')](handleError(_0x30358b,null));};exports['addConfiguration']=function(_0x3df73d,_0x57778a,_0x4860ce){if(_0x3df73d['body']['id']){delete _0x3df73d[_0xc663('0x48')]['id'];}return db[_0xc663('0x2c')][_0xc663('0x4d')]({'where':{'id':_0x3df73d[_0xc663('0x49')]['id']}})[_0xc663('0x25')](handleEntityNotFound(_0x57778a,null))[_0xc663('0x25')](function(_0x54bf35){if(_0x54bf35){_0x3df73d['body']['AccountId']=_0x54bf35['id'];_0x3df73d[_0xc663('0x48')][_0xc663('0x4e')]=integrations[_0xc663('0x4f')](_0x3df73d[_0xc663('0x48')][_0xc663('0x50')],_0x3df73d[_0xc663('0x48')][_0xc663('0x2e')]);_0x3df73d[_0xc663('0x48')][_0xc663('0x51')]=integrations[_0xc663('0x52')](_0x3df73d[_0xc663('0x48')][_0xc663('0x50')],_0x3df73d['body'][_0xc663('0x2e')]);return db[_0xc663('0x4b')][_0xc663('0x47')](_0x3df73d[_0xc663('0x48')],{'include':[{'model':db[_0xc663('0x53')],'as':_0xc663('0x4e')},{'model':db[_0xc663('0x53')],'as':'Descriptions'}]});}return null;})[_0xc663('0x25')](respondWithResult(_0x57778a,null))[_0xc663('0x41')](handleError(_0x57778a,null));};exports[_0xc663('0x54')]=function(_0x25677d,_0x3d83d4,_0x304bb3){var _0x2751c6=[{'name':_0xc663('0x55'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xbcd7d2='';return db[_0xc663('0x2c')][_0xc663('0x4d')]({'where':{'id':_0x25677d[_0xc663('0x49')]['id']},'attributes':['id',_0xc663('0x56'),_0xc663('0x57'),_0xc663('0x58'),'password',_0xc663('0x59'),'consumerSecret',_0xc663('0x5a'),_0xc663('0x5b')]})[_0xc663('0x25')](handleEntityNotFound(_0x3d83d4,null))[_0xc663('0x25')](function(_0x4bcaae){if(_0x4bcaae){_0xbcd7d2=_0x4bcaae[_0xc663('0x56')];var _0x2824be=_0xbcd7d2[_0xc663('0x5c')](-0x1);if(_0x2824be==='/'){_0xbcd7d2=_0xbcd7d2[_0xc663('0x5d')](0x0,_0xbcd7d2[_0xc663('0x5e')](_0x2824be));}var _0x14df1f={'method':_0xc663('0x5f'),'uri':util[_0xc663('0x60')](_0xc663('0x61'),_0xbcd7d2),'headers':{'Content-Type':_0xc663('0x62'),'Accept':_0xc663('0x62')},'json':!![]};if(_0x4bcaae[_0xc663('0x57')]===_0xc663('0x63')){_0x14df1f[_0xc663('0x64')][_0xc663('0x65')]=util[_0xc663('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xc663('0x66'),_0x4bcaae[_0xc663('0x58')],_0x4bcaae[_0xc663('0x67')]))[_0xc663('0x68')]('base64'));}return rp(_0x14df1f)[_0xc663('0x25')](function(_0x27042a){return _0x2751c6[_0xc663('0x69')](_[_0xc663('0x2b')](_0x27042a[_0xc663('0x6a')][_0xc663('0x6b')],function(_0x3a7107){return{'id':_0x3a7107[_0xc663('0x29')],'name':_0x3a7107[_0xc663('0x29')],'type':_0x3a7107[_0xc663('0x2e')],'active':_0x3a7107[_0xc663('0x6c')],'label':_0x3a7107[_0xc663('0x6d')],'custom':!![]};}));});}})['then'](function(_0x5a37e1){return{'count':_0x5a37e1[_0xc663('0x35')],'rows':_0x5a37e1};})[_0xc663('0x25')](respondWithResult(_0x3d83d4,null))['catch'](function(_0x53ab49){var _0x2e925b=_0x25677d['query'][_0xc663('0x6e')]?0x1f4:_0x53ab49[_0xc663('0x6f')]||0x1f4;logger[_0xc663('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xc663('0x54'),_0x2e925b,JSON[_0xc663('0x70')](_0x53ab49));delete _0x53ab49[_0xc663('0x29')];if(_0x2e925b===0x191){_0x2e925b=0x190;}_0x3d83d4['status'](_0x2e925b)['send'](_0x25677d[_0xc663('0x31')][_0xc663('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x53ab49[_0xc663('0x6f')]}:_0x53ab49);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5c73bbd..5671ff4 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 _0xc041=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1c964a,_0x1e507d){var _0x282df9=function(_0x13ea03){while(--_0x13ea03){_0x1c964a['push'](_0x1c964a['shift']());}};_0x282df9(++_0x1e507d);}(_0xc041,0x129));var _0x1c04=function(_0x5442a5,_0x4110f1){_0x5442a5=_0x5442a5-0x0;var _0x130af0=_0xc041[_0x5442a5];return _0x130af0;};'use strict';var _=require(_0x1c04('0x0'));var util=require(_0x1c04('0x1'));var logger=require(_0x1c04('0x2'))(_0x1c04('0x3'));var moment=require('moment');var BPromise=require(_0x1c04('0x4'));var rp=require(_0x1c04('0x5'));var fs=require('fs');var path=require(_0x1c04('0x6'));var rimraf=require('rimraf');var config=require(_0x1c04('0x7'));var attributes=require(_0x1c04('0x8'));var integrations=require(_0x1c04('0x9'));module[_0x1c04('0xa')]=function(_0x5dca77,_0x4d2ccf){return _0x5dca77[_0x1c04('0xb')](_0x1c04('0xc'),attributes,{'tableName':_0x1c04('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4baa=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','lodash','util','bluebird'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4baa,0x11d));var _0xa4ba=function(_0x4580d4,_0xb4514f){_0x4580d4=_0x4580d4-0x0;var _0x48ce72=_0x4baa[_0x4580d4];return _0x48ce72;};'use strict';var _=require(_0xa4ba('0x0'));var util=require(_0xa4ba('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa4ba('0x2'));var rp=require(_0xa4ba('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4ba('0x4'));var config=require(_0xa4ba('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xa4ba('0x6'));module[_0xa4ba('0x7')]=function(_0x1c2979,_0xf76658){return _0x1c2979[_0xa4ba('0x8')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','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 6b7b7e4..e96f0a9 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 _0x75a6=['include','attributes','model','debug','ShowDeskAccount','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','options','where','limit','map'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x75a6,0xd9));var _0x675a=function(_0x3748c1,_0x8caeb1){_0x3748c1=_0x3748c1-0x0;var _0x1ef943=_0x75a6[_0x3748c1];return _0x1ef943;};'use strict';var _=require('lodash');var util=require(_0x675a('0x0'));var moment=require(_0x675a('0x1'));var BPromise=require('bluebird');var rs=require(_0x675a('0x2'));var fs=require('fs');var Redis=require(_0x675a('0x3'));var db=require(_0x675a('0x4'))['db'];var utils=require(_0x675a('0x5'));var logger=require(_0x675a('0x6'))(_0x675a('0x7'));var config=require('../../config/environment');var jayson=require(_0x675a('0x8'));var client=jayson[_0x675a('0x9')][_0x675a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49fd7e,_0x3c3d00,_0x2e364a){return new BPromise(function(_0x281847,_0x419365){return client[_0x675a('0xb')](_0x49fd7e,_0x2e364a)[_0x675a('0xc')](function(_0x5ea357){logger[_0x675a('0xd')](_0x675a('0xe'),_0x3c3d00,'request\x20sent');logger['debug'](_0x675a('0xf'),_0x3c3d00,_0x675a('0x10'),JSON[_0x675a('0x11')](_0x5ea357));if(_0x5ea357[_0x675a('0x12')]){if(_0x5ea357[_0x675a('0x12')][_0x675a('0x13')]===0x1f4){logger[_0x675a('0x12')](_0x675a('0xe'),_0x3c3d00,_0x5ea357[_0x675a('0x12')][_0x675a('0x14')]);return _0x419365(_0x5ea357['error'][_0x675a('0x14')]);}logger[_0x675a('0x12')](_0x675a('0xe'),_0x3c3d00,_0x5ea357['error'][_0x675a('0x14')]);return _0x281847(_0x5ea357['error'][_0x675a('0x14')]);}else{logger[_0x675a('0xd')]('DeskAccount,\x20%s,\x20%s',_0x3c3d00,_0x675a('0x10'));_0x281847(_0x5ea357['result'][_0x675a('0x14')]);}})[_0x675a('0x15')](function(_0x1e101c){logger[_0x675a('0x12')](_0x675a('0xe'),_0x3c3d00,_0x1e101c);_0x419365(_0x1e101c);});});}exports[_0x675a('0x16')]=function(_0x5952da){var _0x63f76e=this;return new Promise(function(_0x2db656,_0x32c2ce){return db[_0x675a('0x17')]['findAll']({'raw':_0x5952da['options']?_0x5952da['options']['raw']===undefined?!![]:![]:!![],'where':_0x5952da[_0x675a('0x18')]?_0x5952da[_0x675a('0x18')][_0x675a('0x19')]||null:null,'attributes':_0x5952da[_0x675a('0x18')]?_0x5952da[_0x675a('0x18')]['attributes']||null:null,'limit':_0x5952da[_0x675a('0x18')]?_0x5952da[_0x675a('0x18')][_0x675a('0x1a')]||null:null,'include':_0x5952da[_0x675a('0x18')]?_0x5952da['options']['include']?_[_0x675a('0x1b')](_0x5952da[_0x675a('0x18')][_0x675a('0x1c')],function(_0x5d68df){return{'model':db[_0x5d68df['model']],'as':_0x5d68df['as'],'attributes':_0x5d68df[_0x675a('0x1d')],'include':_0x5d68df[_0x675a('0x1c')]?_['map'](_0x5d68df[_0x675a('0x1c')],function(_0x156056){return{'model':db[_0x156056['model']],'as':_0x156056['as'],'attributes':_0x156056['attributes'],'include':_0x156056[_0x675a('0x1c')]?_['map'](_0x156056['include'],function(_0x47c00e){return{'model':db[_0x47c00e[_0x675a('0x1e')]],'as':_0x47c00e['as'],'attributes':_0x47c00e[_0x675a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x675a('0xc')](function(_0x33fb0c){logger['info'](_0x675a('0x16'),_0x5952da);logger[_0x675a('0x1f')](_0x675a('0x16'),_0x5952da,JSON[_0x675a('0x11')](_0x33fb0c));_0x2db656(_0x33fb0c);})[_0x675a('0x15')](function(_0x552aa6){logger[_0x675a('0x12')]('GetDeskAccount',_0x552aa6[_0x675a('0x14')],_0x5952da);_0x32c2ce(_0x63f76e[_0x675a('0x12')](0x1f4,_0x552aa6[_0x675a('0x14')]));});});};exports[_0x675a('0x20')]=function(_0x42b70d){var _0xdc1f3f=this;return new Promise(function(_0x58f3c3,_0x56ebeb){return db[_0x675a('0x17')][_0x675a('0x21')]({'raw':_0x42b70d['options']?_0x42b70d[_0x675a('0x18')][_0x675a('0x22')]===undefined?!![]:![]:!![],'where':_0x42b70d[_0x675a('0x18')]?_0x42b70d[_0x675a('0x18')][_0x675a('0x19')]||null:null,'attributes':_0x42b70d[_0x675a('0x18')]?_0x42b70d[_0x675a('0x18')]['attributes']||null:null,'include':_0x42b70d[_0x675a('0x18')]?_0x42b70d[_0x675a('0x18')]['include']?_['map'](_0x42b70d[_0x675a('0x18')][_0x675a('0x1c')],function(_0x1d926a){return{'model':db[_0x1d926a['model']],'as':_0x1d926a['as'],'attributes':_0x1d926a[_0x675a('0x1d')],'include':_0x1d926a[_0x675a('0x1c')]?_['map'](_0x1d926a[_0x675a('0x1c')],function(_0x5f111f){return{'model':db[_0x5f111f['model']],'as':_0x5f111f['as'],'attributes':_0x5f111f['attributes'],'include':_0x5f111f[_0x675a('0x1c')]?_[_0x675a('0x1b')](_0x5f111f[_0x675a('0x1c')],function(_0x468e2d){return{'model':db[_0x468e2d[_0x675a('0x1e')]],'as':_0x468e2d['as'],'attributes':_0x468e2d[_0x675a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x675a('0xc')](function(_0x40b46b){logger[_0x675a('0xd')](_0x675a('0x20'),_0x42b70d);logger['debug'](_0x675a('0x20'),_0x42b70d,JSON[_0x675a('0x11')](_0x40b46b));_0x58f3c3(_0x40b46b);})[_0x675a('0x15')](function(_0x2f3664){logger[_0x675a('0x12')](_0x675a('0x20'),_0x2f3664[_0x675a('0x14')],_0x42b70d);_0x56ebeb(_0xdc1f3f[_0x675a('0x12')](0x1f4,_0x2f3664[_0x675a('0x14')]));});});}; \ No newline at end of file +var _0x601c=['stringify','ShowDeskAccount','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount'];(function(_0x5bb8e0,_0x3f4030){var _0x254f79=function(_0x198e95){while(--_0x198e95){_0x5bb8e0['push'](_0x5bb8e0['shift']());}};_0x254f79(++_0x3f4030);}(_0x601c,0x94));var _0xc601=function(_0x2a58e0,_0x12e0db){_0x2a58e0=_0x2a58e0-0x0;var _0x8d3424=_0x601c[_0x2a58e0];return _0x8d3424;};'use strict';var _=require(_0xc601('0x0'));var util=require(_0xc601('0x1'));var moment=require('moment');var BPromise=require(_0xc601('0x2'));var rs=require(_0xc601('0x3'));var fs=require('fs');var Redis=require(_0xc601('0x4'));var db=require(_0xc601('0x5'))['db'];var utils=require(_0xc601('0x6'));var logger=require(_0xc601('0x7'))('rpc');var config=require(_0xc601('0x8'));var jayson=require(_0xc601('0x9'));var client=jayson[_0xc601('0xa')][_0xc601('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d3e58,_0xd46df5,_0xc64dc9){return new BPromise(function(_0x49e44e,_0x4d1f92){return client[_0xc601('0xc')](_0x2d3e58,_0xc64dc9)['then'](function(_0x2ba1c5){logger[_0xc601('0xd')]('DeskAccount,\x20%s,\x20%s',_0xd46df5,_0xc601('0xe'));logger[_0xc601('0xf')](_0xc601('0x10'),_0xd46df5,_0xc601('0xe'),JSON['stringify'](_0x2ba1c5));if(_0x2ba1c5[_0xc601('0x11')]){if(_0x2ba1c5[_0xc601('0x11')][_0xc601('0x12')]===0x1f4){logger['error'](_0xc601('0x13'),_0xd46df5,_0x2ba1c5[_0xc601('0x11')][_0xc601('0x14')]);return _0x4d1f92(_0x2ba1c5[_0xc601('0x11')][_0xc601('0x14')]);}logger['error'](_0xc601('0x13'),_0xd46df5,_0x2ba1c5[_0xc601('0x11')][_0xc601('0x14')]);return _0x49e44e(_0x2ba1c5['error'][_0xc601('0x14')]);}else{logger['info'](_0xc601('0x13'),_0xd46df5,_0xc601('0xe'));_0x49e44e(_0x2ba1c5['result'][_0xc601('0x14')]);}})['catch'](function(_0x9d94e5){logger[_0xc601('0x11')](_0xc601('0x13'),_0xd46df5,_0x9d94e5);_0x4d1f92(_0x9d94e5);});});}exports['GetDeskAccount']=function(_0x14eb52){var _0x309074=this;return new Promise(function(_0x4ecec2,_0x1f23e4){return db[_0xc601('0x15')][_0xc601('0x16')]({'raw':_0x14eb52[_0xc601('0x17')]?_0x14eb52[_0xc601('0x17')][_0xc601('0x18')]===undefined?!![]:![]:!![],'where':_0x14eb52[_0xc601('0x17')]?_0x14eb52[_0xc601('0x17')][_0xc601('0x19')]||null:null,'attributes':_0x14eb52[_0xc601('0x17')]?_0x14eb52[_0xc601('0x17')][_0xc601('0x1a')]||null:null,'limit':_0x14eb52[_0xc601('0x17')]?_0x14eb52['options'][_0xc601('0x1b')]||null:null,'include':_0x14eb52[_0xc601('0x17')]?_0x14eb52[_0xc601('0x17')][_0xc601('0x1c')]?_[_0xc601('0x1d')](_0x14eb52[_0xc601('0x17')]['include'],function(_0x1a7857){return{'model':db[_0x1a7857[_0xc601('0x1e')]],'as':_0x1a7857['as'],'attributes':_0x1a7857['attributes'],'include':_0x1a7857[_0xc601('0x1c')]?_['map'](_0x1a7857[_0xc601('0x1c')],function(_0x328dfe){return{'model':db[_0x328dfe[_0xc601('0x1e')]],'as':_0x328dfe['as'],'attributes':_0x328dfe[_0xc601('0x1a')],'include':_0x328dfe['include']?_['map'](_0x328dfe['include'],function(_0x3b10d4){return{'model':db[_0x3b10d4[_0xc601('0x1e')]],'as':_0x3b10d4['as'],'attributes':_0x3b10d4[_0xc601('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4a3f){logger[_0xc601('0xd')]('GetDeskAccount',_0x14eb52);logger['debug'](_0xc601('0x1f'),_0x14eb52,JSON[_0xc601('0x20')](_0x1d4a3f));_0x4ecec2(_0x1d4a3f);})['catch'](function(_0x125038){logger['error'](_0xc601('0x1f'),_0x125038['message'],_0x14eb52);_0x1f23e4(_0x309074['error'](0x1f4,_0x125038[_0xc601('0x14')]));});});};exports[_0xc601('0x21')]=function(_0x5a74ec){var _0x104d45=this;return new Promise(function(_0x382bb1,_0x5c9876){return db[_0xc601('0x15')]['find']({'raw':_0x5a74ec[_0xc601('0x17')]?_0x5a74ec['options'][_0xc601('0x18')]===undefined?!![]:![]:!![],'where':_0x5a74ec[_0xc601('0x17')]?_0x5a74ec['options']['where']||null:null,'attributes':_0x5a74ec[_0xc601('0x17')]?_0x5a74ec[_0xc601('0x17')]['attributes']||null:null,'include':_0x5a74ec['options']?_0x5a74ec['options'][_0xc601('0x1c')]?_[_0xc601('0x1d')](_0x5a74ec[_0xc601('0x17')][_0xc601('0x1c')],function(_0x55918f){return{'model':db[_0x55918f['model']],'as':_0x55918f['as'],'attributes':_0x55918f[_0xc601('0x1a')],'include':_0x55918f['include']?_['map'](_0x55918f['include'],function(_0x4132d5){return{'model':db[_0x4132d5[_0xc601('0x1e')]],'as':_0x4132d5['as'],'attributes':_0x4132d5['attributes'],'include':_0x4132d5[_0xc601('0x1c')]?_[_0xc601('0x1d')](_0x4132d5[_0xc601('0x1c')],function(_0xc4e2b4){return{'model':db[_0xc4e2b4[_0xc601('0x1e')]],'as':_0xc4e2b4['as'],'attributes':_0xc4e2b4[_0xc601('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc601('0x22')](function(_0x3fbc95){logger['info']('ShowDeskAccount',_0x5a74ec);logger[_0xc601('0xf')](_0xc601('0x21'),_0x5a74ec,JSON[_0xc601('0x20')](_0x3fbc95));_0x382bb1(_0x3fbc95);})[_0xc601('0x23')](function(_0x11a58f){logger[_0xc601('0x11')](_0xc601('0x21'),_0x11a58f['message'],_0x5a74ec);_0x5c9876(_0x104d45[_0xc601('0x11')](0x1f4,_0x11a58f[_0xc601('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5b87f3d..4499107 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ee688,_0x2ed804){var _0x3ad0a5=function(_0x230876){while(--_0x230876){_0x4ee688['push'](_0x4ee688['shift']());}};_0x3ad0a5(++_0x2ed804);}(_0x008c,0x188));var _0xc008=function(_0x5bd044,_0xafd5fa){_0x5bd044=_0x5bd044-0x0;var _0x582fd7=_0x008c[_0x5bd044];return _0x582fd7;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);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('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x42c154,_0x405ce9){var _0x543d14=function(_0x208054){while(--_0x208054){_0x42c154['push'](_0x42c154['shift']());}};_0x543d14(++_0x405ce9);}(_0x34e8,0x12c));var _0x834e=function(_0x47c938,_0x24330e){_0x47c938=_0x47c938-0x0;var _0x3fd333=_0x34e8[_0x47c938];return _0x3fd333;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 0a2d23b..d86bdba 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 _0xccb7=['STRING','sequelize','exports'];(function(_0x5d0e63,_0x183e30){var _0x39c1cf=function(_0x3c0993){while(--_0x3c0993){_0x5d0e63['push'](_0x5d0e63['shift']());}};_0x39c1cf(++_0x183e30);}(_0xccb7,0xfa));var _0x7ccb=function(_0x3dfc9e,_0x3a8f6b){_0x3dfc9e=_0x3dfc9e-0x0;var _0x51e3e1=_0xccb7[_0x3dfc9e];return _0x51e3e1;};'use strict';var Sequelize=require(_0x7ccb('0x0'));module[_0x7ccb('0x1')]={'name':{'type':Sequelize[_0x7ccb('0x2')]},'description':{'type':Sequelize[_0x7ccb('0x2')]}}; \ No newline at end of file +var _0xd3ba=['STRING','exports'];(function(_0x441fab,_0x2a5ac4){var _0x53297f=function(_0x483a9a){while(--_0x483a9a){_0x441fab['push'](_0x441fab['shift']());}};_0x53297f(++_0x2a5ac4);}(_0xd3ba,0x1cf));var _0xad3b=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xd3ba[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require('sequelize');module[_0xad3b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xad3b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e218439..3234aac 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 _0x6db9=['nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','update','findOne','DeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','then','destroy','error','name','send','index','map','DeskConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x3d2a07,_0x4fba18){var _0x30484b=function(_0x33390b){while(--_0x33390b){_0x3d2a07['push'](_0x3d2a07['shift']());}};_0x30484b(++_0x4fba18);}(_0x6db9,0xc3));var _0x96db=function(_0x19a0af,_0x5ecca3){_0x19a0af=_0x19a0af-0x0;var _0x3903bc=_0x6db9[_0x19a0af];return _0x3903bc;};'use strict';var emlformat=require(_0x96db('0x0'));var rimraf=require(_0x96db('0x1'));var zipdir=require(_0x96db('0x2'));var jsonpatch=require(_0x96db('0x3'));var rp=require(_0x96db('0x4'));var moment=require(_0x96db('0x5'));var BPromise=require(_0x96db('0x6'));var Mustache=require(_0x96db('0x7'));var util=require(_0x96db('0x8'));var path=require(_0x96db('0x9'));var sox=require(_0x96db('0xa'));var csv=require('to-csv');var ejs=require(_0x96db('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96db('0xc'));var squel=require(_0x96db('0xd'));var crypto=require(_0x96db('0xe'));var jsforce=require(_0x96db('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x96db('0x10'));var querystring=require('querystring');var Papa=require(_0x96db('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x96db('0x12'));var as=require(_0x96db('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x96db('0x14'));var utils=require(_0x96db('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x96db('0x16'))['db'];function respondWithStatusCode(_0x1a6eb5,_0x54644f){_0x54644f=_0x54644f||0xcc;return function(_0x261f46){if(_0x261f46){return _0x1a6eb5[_0x96db('0x17')](_0x54644f);}return _0x1a6eb5['status'](_0x54644f)[_0x96db('0x18')]();};}function respondWithResult(_0x5970be,_0x377e3b){_0x377e3b=_0x377e3b||0xc8;return function(_0x44a30a){if(_0x44a30a){return _0x5970be[_0x96db('0x19')](_0x377e3b)[_0x96db('0x1a')](_0x44a30a);}};}function respondWithFilteredResult(_0x3a9135,_0xe6509e){return function(_0x1357b1){if(_0x1357b1){var _0x2dffb2=typeof _0xe6509e[_0x96db('0x1b')]===_0x96db('0x1c')&&typeof _0xe6509e[_0x96db('0x1d')]===_0x96db('0x1c');var _0x4ae31b=_0x1357b1[_0x96db('0x1e')];var _0x560cae=_0x2dffb2?0x0:_0xe6509e['offset'];var _0x53900e=_0x2dffb2?_0x1357b1[_0x96db('0x1e')]:_0xe6509e['offset']+_0xe6509e['limit'];var _0x2dcd28;if(_0x53900e>=_0x4ae31b){_0x53900e=_0x4ae31b;_0x2dcd28=0xc8;}else{_0x2dcd28=0xce;}_0x3a9135[_0x96db('0x19')](_0x2dcd28);return _0x3a9135['set']('Content-Range',_0x560cae+'-'+_0x53900e+'/'+_0x4ae31b)['json'](_0x1357b1);}return null;};}function patchUpdates(_0x144d1){return function(_0x240943){try{jsonpatch[_0x96db('0x1f')](_0x240943,_0x144d1,!![]);}catch(_0x3760cf){return BPromise[_0x96db('0x20')](_0x3760cf);}return _0x240943['save']();};}function saveUpdates(_0x3a01ef,_0x2262d5){return function(_0xb54fc3){if(_0xb54fc3){return _0xb54fc3['update'](_0x3a01ef)[_0x96db('0x21')](function(_0x119cb5){return _0x119cb5;});}return null;};}function removeEntity(_0x660088,_0x2bd2f4){return function(_0xcf47c4){if(_0xcf47c4){return _0xcf47c4[_0x96db('0x22')]()['then'](function(){_0x660088[_0x96db('0x19')](0xcc)[_0x96db('0x18')]();});}};}function handleEntityNotFound(_0x1188eb,_0x5e9692){return function(_0x2a8e47){if(!_0x2a8e47){_0x1188eb[_0x96db('0x17')](0x194);}return _0x2a8e47;};}function handleError(_0x5077ed,_0x1bd6ce){_0x1bd6ce=_0x1bd6ce||0x1f4;return function(_0x1122f1){logger[_0x96db('0x23')](_0x1122f1['stack']);if(_0x1122f1[_0x96db('0x24')]){delete _0x1122f1[_0x96db('0x24')];}_0x5077ed[_0x96db('0x19')](_0x1bd6ce)[_0x96db('0x25')](_0x1122f1);};}exports[_0x96db('0x26')]=function(_0x3cee0f,_0x5f0d1b){var _0x41bf5b={},_0x10bb26={},_0x4cfb79={'count':0x0,'rows':[]};var _0x1ef14c=_[_0x96db('0x27')](db[_0x96db('0x28')]['rawAttributes'],function(_0x281329){return{'name':_0x281329['fieldName'],'type':_0x281329[_0x96db('0x29')][_0x96db('0x2a')]};});_0x10bb26[_0x96db('0x2b')]=_[_0x96db('0x27')](_0x1ef14c,'name');_0x10bb26[_0x96db('0x2c')]=_['keys'](_0x3cee0f[_0x96db('0x2c')]);_0x10bb26[_0x96db('0x2d')]=_[_0x96db('0x2e')](_0x10bb26[_0x96db('0x2b')],_0x10bb26['query']);_0x41bf5b[_0x96db('0x2f')]=_[_0x96db('0x2e')](_0x10bb26['model'],qs[_0x96db('0x30')](_0x3cee0f[_0x96db('0x2c')][_0x96db('0x30')]));_0x41bf5b[_0x96db('0x2f')]=_0x41bf5b[_0x96db('0x2f')][_0x96db('0x31')]?_0x41bf5b['attributes']:_0x10bb26['model'];if(!_0x3cee0f[_0x96db('0x2c')][_0x96db('0x32')](_0x96db('0x33'))){_0x41bf5b[_0x96db('0x1d')]=qs['limit'](_0x3cee0f[_0x96db('0x2c')][_0x96db('0x1d')]);_0x41bf5b[_0x96db('0x1b')]=qs[_0x96db('0x1b')](_0x3cee0f[_0x96db('0x2c')][_0x96db('0x1b')]);}_0x41bf5b[_0x96db('0x34')]=qs['sort'](_0x3cee0f[_0x96db('0x2c')][_0x96db('0x35')]);_0x41bf5b[_0x96db('0x36')]=qs[_0x96db('0x2d')](_[_0x96db('0x37')](_0x3cee0f[_0x96db('0x2c')],_0x10bb26[_0x96db('0x2d')]),_0x1ef14c);if(_0x3cee0f[_0x96db('0x2c')]['filter']){_0x41bf5b[_0x96db('0x36')]=_[_0x96db('0x38')](_0x41bf5b[_0x96db('0x36')],{'$or':_[_0x96db('0x27')](_0x1ef14c,function(_0xbf1a58){if(_0xbf1a58['type']!==_0x96db('0x39')){var _0x26a8df={};_0x26a8df[_0xbf1a58[_0x96db('0x24')]]={'$like':'%'+_0x3cee0f[_0x96db('0x2c')][_0x96db('0x3a')]+'%'};return _0x26a8df;}})});}_0x41bf5b=_['merge']({},_0x41bf5b,_0x3cee0f[_0x96db('0x3b')]);var _0x2faba4={'where':_0x41bf5b[_0x96db('0x36')]};return db[_0x96db('0x28')]['count'](_0x2faba4)[_0x96db('0x21')](function(_0x49097e){_0x4cfb79[_0x96db('0x1e')]=_0x49097e;if(_0x3cee0f[_0x96db('0x2c')][_0x96db('0x3c')]){_0x41bf5b[_0x96db('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x96db('0x3e')](_0x41bf5b);})[_0x96db('0x21')](function(_0x445387){_0x4cfb79[_0x96db('0x3f')]=_0x445387;return _0x4cfb79;})['then'](respondWithFilteredResult(_0x5f0d1b,_0x41bf5b))['catch'](handleError(_0x5f0d1b,null));};exports[_0x96db('0x40')]=function(_0x23a638,_0x12e97e){var _0x3a6fc2={'raw':![],'where':{'id':_0x23a638[_0x96db('0x41')]['id']}},_0x3bb0e9={};_0x3bb0e9[_0x96db('0x2b')]=_[_0x96db('0x42')](db[_0x96db('0x28')][_0x96db('0x43')]);_0x3bb0e9[_0x96db('0x2c')]=_[_0x96db('0x42')](_0x23a638[_0x96db('0x2c')]);_0x3bb0e9['filters']=_[_0x96db('0x2e')](_0x3bb0e9[_0x96db('0x2b')],_0x3bb0e9['query']);_0x3a6fc2[_0x96db('0x2f')]=_[_0x96db('0x2e')](_0x3bb0e9['model'],qs['fields'](_0x23a638[_0x96db('0x2c')][_0x96db('0x30')]));_0x3a6fc2[_0x96db('0x2f')]=_0x3a6fc2['attributes'][_0x96db('0x31')]?_0x3a6fc2[_0x96db('0x2f')]:_0x3bb0e9[_0x96db('0x2b')];if(_0x23a638[_0x96db('0x2c')]['includeAll']){_0x3a6fc2[_0x96db('0x3d')]=[{'all':!![]}];}_0x3a6fc2=_[_0x96db('0x38')]({},_0x3a6fc2,_0x23a638[_0x96db('0x3b')]);return db[_0x96db('0x28')][_0x96db('0x44')](_0x3a6fc2)[_0x96db('0x21')](handleEntityNotFound(_0x12e97e,null))['then'](respondWithResult(_0x12e97e,null))[_0x96db('0x45')](handleError(_0x12e97e,null));};exports['create']=function(_0x403e3a,_0xc60c2f){return db['DeskConfiguration'][_0x96db('0x46')](_0x403e3a[_0x96db('0x47')],{})[_0x96db('0x21')](respondWithResult(_0xc60c2f,0xc9))[_0x96db('0x45')](handleError(_0xc60c2f,null));};exports[_0x96db('0x48')]=function(_0x1c705d,_0x13e31b){if(_0x1c705d[_0x96db('0x47')]['id']){delete _0x1c705d[_0x96db('0x47')]['id'];}return db[_0x96db('0x28')][_0x96db('0x44')]({'where':{'id':_0x1c705d['params']['id']}})[_0x96db('0x21')](handleEntityNotFound(_0x13e31b,null))[_0x96db('0x21')](saveUpdates(_0x1c705d[_0x96db('0x47')],null))[_0x96db('0x21')](respondWithResult(_0x13e31b,null))[_0x96db('0x45')](handleError(_0x13e31b,null));};exports[_0x96db('0x22')]=function(_0x3c0171,_0x24b5f3){return db[_0x96db('0x28')]['find']({'where':{'id':_0x3c0171[_0x96db('0x41')]['id']}})['then'](handleEntityNotFound(_0x24b5f3,null))[_0x96db('0x21')](removeEntity(_0x24b5f3,null))['catch'](handleError(_0x24b5f3,null));};exports['getFields']=function(_0x1fdc0d,_0x2e0572,_0x11ca24){var _0xe4112={};var _0x5940f7={};var _0x20af15;var _0x2d0895;return db[_0x96db('0x28')][_0x96db('0x49')]({'where':{'id':_0x1fdc0d[_0x96db('0x41')]['id']}})[_0x96db('0x21')](handleEntityNotFound(_0x2e0572,null))[_0x96db('0x21')](function(_0x3c6244){if(_0x3c6244){_0x20af15=_0x3c6244;_0x5940f7[_0x96db('0x2b')]=_['keys'](db[_0x96db('0x4a')][_0x96db('0x43')]);_0x5940f7[_0x96db('0x2c')]=_['keys'](_0x1fdc0d[_0x96db('0x2c')]);_0x5940f7['filters']=_['intersection'](_0x5940f7[_0x96db('0x2b')],_0x5940f7[_0x96db('0x2c')]);_0xe4112['attributes']=_[_0x96db('0x2e')](_0x5940f7['model'],qs['fields'](_0x1fdc0d[_0x96db('0x2c')][_0x96db('0x30')]));_0xe4112[_0x96db('0x2f')]=_0xe4112[_0x96db('0x2f')][_0x96db('0x31')]?_0xe4112[_0x96db('0x2f')]:_0x5940f7['model'];_0xe4112[_0x96db('0x34')]=qs[_0x96db('0x35')](_0x1fdc0d[_0x96db('0x2c')]['sort']);_0xe4112[_0x96db('0x36')]=qs[_0x96db('0x2d')](_['pick'](_0x1fdc0d[_0x96db('0x2c')],_0x5940f7['filters']));if(_0x1fdc0d[_0x96db('0x2c')][_0x96db('0x3a')]){_0xe4112[_0x96db('0x36')]=_[_0x96db('0x38')](_0xe4112[_0x96db('0x36')],{'$or':_['map'](_0xe4112[_0x96db('0x2f')],function(_0xa68878){var _0x5e391c={};_0x5e391c[_0xa68878]={'$like':'%'+_0x1fdc0d[_0x96db('0x2c')][_0x96db('0x3a')]+'%'};return _0x5e391c;})});}_0xe4112=_[_0x96db('0x38')]({},_0xe4112,_0x1fdc0d[_0x96db('0x3b')]);return _0x20af15[_0x96db('0x4b')](_0xe4112);}})[_0x96db('0x21')](function(_0x355544){if(_0x355544){_0x2d0895=_0x355544['length'];if(!_0x1fdc0d[_0x96db('0x2c')][_0x96db('0x32')](_0x96db('0x33'))){_0xe4112[_0x96db('0x1d')]=qs[_0x96db('0x1d')](_0x1fdc0d[_0x96db('0x2c')][_0x96db('0x1d')]);_0xe4112[_0x96db('0x1b')]=qs['offset'](_0x1fdc0d[_0x96db('0x2c')][_0x96db('0x1b')]);}return _0x20af15[_0x96db('0x4b')](_0xe4112);}})[_0x96db('0x21')](function(_0x471eec){if(_0x471eec){return _0x471eec?{'count':_0x2d0895,'rows':_0x471eec}:null;}})[_0x96db('0x21')](respondWithResult(_0x2e0572,null))['catch'](handleError(_0x2e0572,null));};exports[_0x96db('0x4c')]=function(_0x45210b,_0x52cabb,_0x1ae6a0){var _0x5deeec={};var _0x56e096={};var _0x2a3062;var _0x1070b8;return db[_0x96db('0x28')][_0x96db('0x49')]({'where':{'id':_0x45210b[_0x96db('0x41')]['id']}})[_0x96db('0x21')](handleEntityNotFound(_0x52cabb,null))[_0x96db('0x21')](function(_0x5a3a24){if(_0x5a3a24){_0x2a3062=_0x5a3a24;_0x56e096[_0x96db('0x2b')]=_['keys'](db['DeskField'][_0x96db('0x43')]);_0x56e096['query']=_[_0x96db('0x42')](_0x45210b[_0x96db('0x2c')]);_0x56e096['filters']=_[_0x96db('0x2e')](_0x56e096[_0x96db('0x2b')],_0x56e096[_0x96db('0x2c')]);_0x5deeec[_0x96db('0x2f')]=_[_0x96db('0x2e')](_0x56e096[_0x96db('0x2b')],qs[_0x96db('0x30')](_0x45210b['query']['fields']));_0x5deeec['attributes']=_0x5deeec[_0x96db('0x2f')][_0x96db('0x31')]?_0x5deeec[_0x96db('0x2f')]:_0x56e096['model'];_0x5deeec[_0x96db('0x34')]=qs[_0x96db('0x35')](_0x45210b['query']['sort']);_0x5deeec['where']=qs['filters'](_['pick'](_0x45210b[_0x96db('0x2c')],_0x56e096[_0x96db('0x2d')]));if(_0x45210b[_0x96db('0x2c')][_0x96db('0x3a')]){_0x5deeec['where']=_[_0x96db('0x38')](_0x5deeec['where'],{'$or':_[_0x96db('0x27')](_0x5deeec[_0x96db('0x2f')],function(_0x2063a2){var _0x11665c={};_0x11665c[_0x2063a2]={'$like':'%'+_0x45210b[_0x96db('0x2c')][_0x96db('0x3a')]+'%'};return _0x11665c;})});}_0x5deeec=_['merge']({},_0x5deeec,_0x45210b['options']);return _0x2a3062[_0x96db('0x4c')](_0x5deeec);}})[_0x96db('0x21')](function(_0x422561){if(_0x422561){_0x1070b8=_0x422561[_0x96db('0x31')];if(!_0x45210b['query'][_0x96db('0x32')]('nolimit')){_0x5deeec[_0x96db('0x1d')]=qs['limit'](_0x45210b[_0x96db('0x2c')][_0x96db('0x1d')]);_0x5deeec[_0x96db('0x1b')]=qs['offset'](_0x45210b[_0x96db('0x2c')]['offset']);}return _0x2a3062[_0x96db('0x4c')](_0x5deeec);}})[_0x96db('0x21')](function(_0x4f3e86){if(_0x4f3e86){return _0x4f3e86?{'count':_0x1070b8,'rows':_0x4f3e86}:null;}})[_0x96db('0x21')](respondWithResult(_0x52cabb,null))[_0x96db('0x45')](handleError(_0x52cabb,null));};exports[_0x96db('0x4d')]=function(_0x4f2818,_0x1208be,_0x435a3b){var _0x457312={};var _0x4e4f58={};var _0x1e0b9d;var _0x2928af;return db[_0x96db('0x28')][_0x96db('0x49')]({'where':{'id':_0x4f2818[_0x96db('0x41')]['id']}})[_0x96db('0x21')](handleEntityNotFound(_0x1208be,null))[_0x96db('0x21')](function(_0x40554d){if(_0x40554d){_0x1e0b9d=_0x40554d;_0x4e4f58[_0x96db('0x2b')]=_['keys'](db['DeskField'][_0x96db('0x43')]);_0x4e4f58[_0x96db('0x2c')]=_[_0x96db('0x42')](_0x4f2818['query']);_0x4e4f58[_0x96db('0x2d')]=_['intersection'](_0x4e4f58[_0x96db('0x2b')],_0x4e4f58[_0x96db('0x2c')]);_0x457312['attributes']=_['intersection'](_0x4e4f58[_0x96db('0x2b')],qs[_0x96db('0x30')](_0x4f2818[_0x96db('0x2c')][_0x96db('0x30')]));_0x457312[_0x96db('0x2f')]=_0x457312['attributes'][_0x96db('0x31')]?_0x457312[_0x96db('0x2f')]:_0x4e4f58[_0x96db('0x2b')];_0x457312[_0x96db('0x34')]=qs[_0x96db('0x35')](_0x4f2818[_0x96db('0x2c')][_0x96db('0x35')]);_0x457312[_0x96db('0x36')]=qs[_0x96db('0x2d')](_[_0x96db('0x37')](_0x4f2818[_0x96db('0x2c')],_0x4e4f58[_0x96db('0x2d')]));if(_0x4f2818['query'][_0x96db('0x3a')]){_0x457312[_0x96db('0x36')]=_[_0x96db('0x38')](_0x457312['where'],{'$or':_[_0x96db('0x27')](_0x457312[_0x96db('0x2f')],function(_0x41ac6d){var _0x2508e0={};_0x2508e0[_0x41ac6d]={'$like':'%'+_0x4f2818['query'][_0x96db('0x3a')]+'%'};return _0x2508e0;})});}_0x457312=_[_0x96db('0x38')]({},_0x457312,_0x4f2818[_0x96db('0x3b')]);return _0x1e0b9d[_0x96db('0x4d')](_0x457312);}})[_0x96db('0x21')](function(_0x4b330f){if(_0x4b330f){_0x2928af=_0x4b330f[_0x96db('0x31')];if(!_0x4f2818[_0x96db('0x2c')][_0x96db('0x32')](_0x96db('0x33'))){_0x457312[_0x96db('0x1d')]=qs[_0x96db('0x1d')](_0x4f2818[_0x96db('0x2c')][_0x96db('0x1d')]);_0x457312[_0x96db('0x1b')]=qs[_0x96db('0x1b')](_0x4f2818[_0x96db('0x2c')][_0x96db('0x1b')]);}return _0x1e0b9d[_0x96db('0x4d')](_0x457312);}})['then'](function(_0x21b148){if(_0x21b148){return _0x21b148?{'count':_0x2928af,'rows':_0x21b148}:null;}})['then'](respondWithResult(_0x1208be,null))['catch'](handleError(_0x1208be,null));};exports[_0x96db('0x4e')]=function(_0x1c46bd,_0x3fe3de,_0x2ccbd5){var _0x2e0365={};var _0x2b7e20={};var _0x3039d9;var _0x3f1ad1;return db[_0x96db('0x28')][_0x96db('0x49')]({'where':{'id':_0x1c46bd[_0x96db('0x41')]['id']}})[_0x96db('0x21')](handleEntityNotFound(_0x3fe3de,null))['then'](function(_0x1c21ce){if(_0x1c21ce){_0x3039d9=_0x1c21ce;_0x2b7e20[_0x96db('0x2b')]=_[_0x96db('0x42')](db[_0x96db('0x4f')][_0x96db('0x43')]);_0x2b7e20[_0x96db('0x2c')]=_[_0x96db('0x42')](_0x1c46bd[_0x96db('0x2c')]);_0x2b7e20['filters']=_['intersection'](_0x2b7e20['model'],_0x2b7e20['query']);_0x2e0365[_0x96db('0x2f')]=_[_0x96db('0x2e')](_0x2b7e20[_0x96db('0x2b')],qs[_0x96db('0x30')](_0x1c46bd['query'][_0x96db('0x30')]));_0x2e0365['attributes']=_0x2e0365['attributes'][_0x96db('0x31')]?_0x2e0365[_0x96db('0x2f')]:_0x2b7e20[_0x96db('0x2b')];_0x2e0365[_0x96db('0x34')]=qs[_0x96db('0x35')](_0x1c46bd[_0x96db('0x2c')][_0x96db('0x35')]);_0x2e0365[_0x96db('0x36')]=qs[_0x96db('0x2d')](_[_0x96db('0x37')](_0x1c46bd['query'],_0x2b7e20[_0x96db('0x2d')]));if(_0x1c46bd['query'][_0x96db('0x3a')]){_0x2e0365[_0x96db('0x36')]=_[_0x96db('0x38')](_0x2e0365[_0x96db('0x36')],{'$or':_[_0x96db('0x27')](_0x2e0365[_0x96db('0x2f')],function(_0x329e87){var _0x4b8aeb={};_0x4b8aeb[_0x329e87]={'$like':'%'+_0x1c46bd['query']['filter']+'%'};return _0x4b8aeb;})});}_0x2e0365=_[_0x96db('0x38')]({},_0x2e0365,_0x1c46bd[_0x96db('0x3b')]);return _0x3039d9[_0x96db('0x4e')](_0x2e0365);}})[_0x96db('0x21')](function(_0xf45435){if(_0xf45435){_0x3f1ad1=_0xf45435[_0x96db('0x31')];if(!_0x1c46bd[_0x96db('0x2c')]['hasOwnProperty']('nolimit')){_0x2e0365[_0x96db('0x1d')]=qs[_0x96db('0x1d')](_0x1c46bd[_0x96db('0x2c')]['limit']);_0x2e0365['offset']=qs[_0x96db('0x1b')](_0x1c46bd[_0x96db('0x2c')][_0x96db('0x1b')]);}return _0x3039d9[_0x96db('0x4e')](_0x2e0365);}})[_0x96db('0x21')](function(_0x2b3dab){if(_0x2b3dab){return _0x2b3dab?{'count':_0x3f1ad1,'rows':_0x2b3dab}:null;}})[_0x96db('0x21')](respondWithResult(_0x3fe3de,null))[_0x96db('0x45')](handleError(_0x3fe3de,null));};exports[_0x96db('0x50')]=function(_0x4029d9,_0x2106c0,_0x3bbf5d){if(_0x4029d9[_0x96db('0x47')]['id']){delete _0x4029d9[_0x96db('0x47')]['id'];}return db[_0x96db('0x28')][_0x96db('0x49')]({'where':{'id':_0x4029d9[_0x96db('0x41')]['id']}})['then'](handleEntityNotFound(_0x2106c0,null))[_0x96db('0x21')](function(_0x1621ab){if(_0x1621ab){return _0x1621ab[_0x96db('0x50')](_0x4029d9[_0x96db('0x47')][_0x96db('0x51')]||[]);}return null;})[_0x96db('0x21')](respondWithResult(_0x2106c0,null))['catch'](handleError(_0x2106c0,null));}; \ No newline at end of file +var _0x14b6=['getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','update','then','error','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','intersection','length','include','find','create','body','destroy','params'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x14b6,0x148));var _0x614b=function(_0x24f395,_0x2414b4){_0x24f395=_0x24f395-0x0;var _0x386ac7=_0x14b6[_0x24f395];return _0x386ac7;};'use strict';var emlformat=require(_0x614b('0x0'));var rimraf=require(_0x614b('0x1'));var zipdir=require(_0x614b('0x2'));var jsonpatch=require(_0x614b('0x3'));var rp=require(_0x614b('0x4'));var moment=require(_0x614b('0x5'));var BPromise=require(_0x614b('0x6'));var Mustache=require('mustache');var util=require(_0x614b('0x7'));var path=require(_0x614b('0x8'));var sox=require(_0x614b('0x9'));var csv=require(_0x614b('0xa'));var ejs=require(_0x614b('0xb'));var fs=require('fs');var fs_extra=require(_0x614b('0xc'));var _=require(_0x614b('0xd'));var squel=require('squel');var crypto=require(_0x614b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x614b('0xf'));var toCsv=require(_0x614b('0xa'));var querystring=require(_0x614b('0x10'));var Papa=require('papaparse');var Redis=require(_0x614b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x614b('0x12'));var as=require(_0x614b('0x13'));var hardwareService=require(_0x614b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x614b('0x15'));var config=require(_0x614b('0x16'));var licenseUtil=require(_0x614b('0x17'));var db=require(_0x614b('0x18'))['db'];function respondWithStatusCode(_0xb7aa92,_0x45329e){_0x45329e=_0x45329e||0xcc;return function(_0x4ac1f2){if(_0x4ac1f2){return _0xb7aa92['sendStatus'](_0x45329e);}return _0xb7aa92[_0x614b('0x19')](_0x45329e)[_0x614b('0x1a')]();};}function respondWithResult(_0x45b287,_0x395f92){_0x395f92=_0x395f92||0xc8;return function(_0x1b441e){if(_0x1b441e){return _0x45b287['status'](_0x395f92)[_0x614b('0x1b')](_0x1b441e);}};}function respondWithFilteredResult(_0x2ef620,_0x288159){return function(_0x2a1d7e){if(_0x2a1d7e){var _0x5385c4=typeof _0x288159[_0x614b('0x1c')]===_0x614b('0x1d')&&typeof _0x288159['limit']==='undefined';var _0x1cb6ad=_0x2a1d7e[_0x614b('0x1e')];var _0x164d5e=_0x5385c4?0x0:_0x288159[_0x614b('0x1c')];var _0x26e7ee=_0x5385c4?_0x2a1d7e[_0x614b('0x1e')]:_0x288159['offset']+_0x288159['limit'];var _0x302965;if(_0x26e7ee>=_0x1cb6ad){_0x26e7ee=_0x1cb6ad;_0x302965=0xc8;}else{_0x302965=0xce;}_0x2ef620[_0x614b('0x19')](_0x302965);return _0x2ef620['set']('Content-Range',_0x164d5e+'-'+_0x26e7ee+'/'+_0x1cb6ad)['json'](_0x2a1d7e);}return null;};}function patchUpdates(_0x1f6678){return function(_0x2ce403){try{jsonpatch['apply'](_0x2ce403,_0x1f6678,!![]);}catch(_0x36a866){return BPromise['reject'](_0x36a866);}return _0x2ce403['save']();};}function saveUpdates(_0x37237c,_0x5e60c2){return function(_0x4097de){if(_0x4097de){return _0x4097de[_0x614b('0x1f')](_0x37237c)[_0x614b('0x20')](function(_0x702ebf){return _0x702ebf;});}return null;};}function removeEntity(_0x14a97b,_0x35e86c){return function(_0x24cb81){if(_0x24cb81){return _0x24cb81['destroy']()['then'](function(){_0x14a97b['status'](0xcc)[_0x614b('0x1a')]();});}};}function handleEntityNotFound(_0x5292ed,_0x395e04){return function(_0x296e9e){if(!_0x296e9e){_0x5292ed['sendStatus'](0x194);}return _0x296e9e;};}function handleError(_0x5264e,_0x232213){_0x232213=_0x232213||0x1f4;return function(_0x39889a){logger[_0x614b('0x21')](_0x39889a['stack']);if(_0x39889a[_0x614b('0x22')]){delete _0x39889a[_0x614b('0x22')];}_0x5264e[_0x614b('0x19')](_0x232213)[_0x614b('0x23')](_0x39889a);};}exports[_0x614b('0x24')]=function(_0x2fc9d7,_0x45cf60){var _0x426fb2={},_0x30745f={},_0x51347d={'count':0x0,'rows':[]};var _0x3f2fe8=_[_0x614b('0x25')](db[_0x614b('0x26')][_0x614b('0x27')],function(_0x20ae1e){return{'name':_0x20ae1e['fieldName'],'type':_0x20ae1e[_0x614b('0x28')][_0x614b('0x29')]};});_0x30745f[_0x614b('0x2a')]=_[_0x614b('0x25')](_0x3f2fe8,_0x614b('0x22'));_0x30745f[_0x614b('0x2b')]=_['keys'](_0x2fc9d7['query']);_0x30745f[_0x614b('0x2c')]=_['intersection'](_0x30745f[_0x614b('0x2a')],_0x30745f['query']);_0x426fb2[_0x614b('0x2d')]=_['intersection'](_0x30745f[_0x614b('0x2a')],qs[_0x614b('0x2e')](_0x2fc9d7['query'][_0x614b('0x2e')]));_0x426fb2['attributes']=_0x426fb2[_0x614b('0x2d')]['length']?_0x426fb2[_0x614b('0x2d')]:_0x30745f[_0x614b('0x2a')];if(!_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x2f')](_0x614b('0x30'))){_0x426fb2['limit']=qs[_0x614b('0x31')](_0x2fc9d7[_0x614b('0x2b')]['limit']);_0x426fb2[_0x614b('0x1c')]=qs[_0x614b('0x1c')](_0x2fc9d7[_0x614b('0x2b')]['offset']);}_0x426fb2[_0x614b('0x32')]=qs[_0x614b('0x33')](_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x33')]);_0x426fb2[_0x614b('0x34')]=qs[_0x614b('0x2c')](_[_0x614b('0x35')](_0x2fc9d7[_0x614b('0x2b')],_0x30745f[_0x614b('0x2c')]),_0x3f2fe8);if(_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x36')]){_0x426fb2[_0x614b('0x34')]=_[_0x614b('0x37')](_0x426fb2[_0x614b('0x34')],{'$or':_[_0x614b('0x25')](_0x3f2fe8,function(_0x53a437){if(_0x53a437[_0x614b('0x28')]!==_0x614b('0x38')){var _0x5b3712={};_0x5b3712[_0x53a437[_0x614b('0x22')]]={'$like':'%'+_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x36')]+'%'};return _0x5b3712;}})});}_0x426fb2=_[_0x614b('0x37')]({},_0x426fb2,_0x2fc9d7[_0x614b('0x39')]);var _0x555bf0={'where':_0x426fb2['where']};return db[_0x614b('0x26')][_0x614b('0x1e')](_0x555bf0)[_0x614b('0x20')](function(_0x53793e){_0x51347d['count']=_0x53793e;if(_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x3a')]){_0x426fb2['include']=[{'all':!![]}];}return db[_0x614b('0x26')][_0x614b('0x3b')](_0x426fb2);})[_0x614b('0x20')](function(_0x4c2020){_0x51347d[_0x614b('0x3c')]=_0x4c2020;return _0x51347d;})[_0x614b('0x20')](respondWithFilteredResult(_0x45cf60,_0x426fb2))[_0x614b('0x3d')](handleError(_0x45cf60,null));};exports[_0x614b('0x3e')]=function(_0xdc0a89,_0x360f8d){var _0x5ad129={'raw':![],'where':{'id':_0xdc0a89['params']['id']}},_0x537819={};_0x537819[_0x614b('0x2a')]=_['keys'](db[_0x614b('0x26')][_0x614b('0x27')]);_0x537819['query']=_[_0x614b('0x3f')](_0xdc0a89[_0x614b('0x2b')]);_0x537819[_0x614b('0x2c')]=_[_0x614b('0x40')](_0x537819['model'],_0x537819[_0x614b('0x2b')]);_0x5ad129['attributes']=_[_0x614b('0x40')](_0x537819[_0x614b('0x2a')],qs[_0x614b('0x2e')](_0xdc0a89[_0x614b('0x2b')]['fields']));_0x5ad129[_0x614b('0x2d')]=_0x5ad129[_0x614b('0x2d')][_0x614b('0x41')]?_0x5ad129[_0x614b('0x2d')]:_0x537819[_0x614b('0x2a')];if(_0xdc0a89['query']['includeAll']){_0x5ad129[_0x614b('0x42')]=[{'all':!![]}];}_0x5ad129=_[_0x614b('0x37')]({},_0x5ad129,_0xdc0a89['options']);return db[_0x614b('0x26')][_0x614b('0x43')](_0x5ad129)[_0x614b('0x20')](handleEntityNotFound(_0x360f8d,null))['then'](respondWithResult(_0x360f8d,null))[_0x614b('0x3d')](handleError(_0x360f8d,null));};exports[_0x614b('0x44')]=function(_0x2bbaa7,_0x5bcfa1){return db[_0x614b('0x26')][_0x614b('0x44')](_0x2bbaa7[_0x614b('0x45')],{})['then'](respondWithResult(_0x5bcfa1,0xc9))[_0x614b('0x3d')](handleError(_0x5bcfa1,null));};exports[_0x614b('0x1f')]=function(_0x592047,_0x3d336b){if(_0x592047['body']['id']){delete _0x592047['body']['id'];}return db[_0x614b('0x26')]['find']({'where':{'id':_0x592047['params']['id']}})[_0x614b('0x20')](handleEntityNotFound(_0x3d336b,null))[_0x614b('0x20')](saveUpdates(_0x592047[_0x614b('0x45')],null))[_0x614b('0x20')](respondWithResult(_0x3d336b,null))['catch'](handleError(_0x3d336b,null));};exports[_0x614b('0x46')]=function(_0x797fe5,_0x454773){return db[_0x614b('0x26')][_0x614b('0x43')]({'where':{'id':_0x797fe5[_0x614b('0x47')]['id']}})[_0x614b('0x20')](handleEntityNotFound(_0x454773,null))[_0x614b('0x20')](removeEntity(_0x454773,null))[_0x614b('0x3d')](handleError(_0x454773,null));};exports[_0x614b('0x48')]=function(_0x5256a9,_0x447305,_0x2b2224){var _0x2df0bd={};var _0x387a28={};var _0x146a1c;var _0x48a816;return db[_0x614b('0x26')][_0x614b('0x49')]({'where':{'id':_0x5256a9[_0x614b('0x47')]['id']}})[_0x614b('0x20')](handleEntityNotFound(_0x447305,null))['then'](function(_0xeb4599){if(_0xeb4599){_0x146a1c=_0xeb4599;_0x387a28[_0x614b('0x2a')]=_[_0x614b('0x3f')](db[_0x614b('0x4a')][_0x614b('0x27')]);_0x387a28['query']=_[_0x614b('0x3f')](_0x5256a9[_0x614b('0x2b')]);_0x387a28[_0x614b('0x2c')]=_[_0x614b('0x40')](_0x387a28[_0x614b('0x2a')],_0x387a28[_0x614b('0x2b')]);_0x2df0bd['attributes']=_['intersection'](_0x387a28['model'],qs[_0x614b('0x2e')](_0x5256a9[_0x614b('0x2b')][_0x614b('0x2e')]));_0x2df0bd['attributes']=_0x2df0bd[_0x614b('0x2d')][_0x614b('0x41')]?_0x2df0bd[_0x614b('0x2d')]:_0x387a28[_0x614b('0x2a')];_0x2df0bd[_0x614b('0x32')]=qs['sort'](_0x5256a9[_0x614b('0x2b')][_0x614b('0x33')]);_0x2df0bd['where']=qs[_0x614b('0x2c')](_[_0x614b('0x35')](_0x5256a9[_0x614b('0x2b')],_0x387a28[_0x614b('0x2c')]));if(_0x5256a9['query'][_0x614b('0x36')]){_0x2df0bd[_0x614b('0x34')]=_[_0x614b('0x37')](_0x2df0bd[_0x614b('0x34')],{'$or':_[_0x614b('0x25')](_0x2df0bd[_0x614b('0x2d')],function(_0x491410){var _0x59979c={};_0x59979c[_0x491410]={'$like':'%'+_0x5256a9['query'][_0x614b('0x36')]+'%'};return _0x59979c;})});}_0x2df0bd=_[_0x614b('0x37')]({},_0x2df0bd,_0x5256a9[_0x614b('0x39')]);return _0x146a1c[_0x614b('0x48')](_0x2df0bd);}})['then'](function(_0x108d54){if(_0x108d54){_0x48a816=_0x108d54[_0x614b('0x41')];if(!_0x5256a9['query'][_0x614b('0x2f')](_0x614b('0x30'))){_0x2df0bd[_0x614b('0x31')]=qs['limit'](_0x5256a9[_0x614b('0x2b')][_0x614b('0x31')]);_0x2df0bd[_0x614b('0x1c')]=qs[_0x614b('0x1c')](_0x5256a9[_0x614b('0x2b')][_0x614b('0x1c')]);}return _0x146a1c[_0x614b('0x48')](_0x2df0bd);}})[_0x614b('0x20')](function(_0x2d3480){if(_0x2d3480){return _0x2d3480?{'count':_0x48a816,'rows':_0x2d3480}:null;}})[_0x614b('0x20')](respondWithResult(_0x447305,null))[_0x614b('0x3d')](handleError(_0x447305,null));};exports[_0x614b('0x4b')]=function(_0x50047f,_0x214b8b,_0x524318){var _0xf5c662={};var _0x13ad4e={};var _0x3e562f;var _0x1cfaf1;return db[_0x614b('0x26')][_0x614b('0x49')]({'where':{'id':_0x50047f[_0x614b('0x47')]['id']}})['then'](handleEntityNotFound(_0x214b8b,null))[_0x614b('0x20')](function(_0x1417fb){if(_0x1417fb){_0x3e562f=_0x1417fb;_0x13ad4e[_0x614b('0x2a')]=_[_0x614b('0x3f')](db['DeskField'][_0x614b('0x27')]);_0x13ad4e[_0x614b('0x2b')]=_['keys'](_0x50047f[_0x614b('0x2b')]);_0x13ad4e[_0x614b('0x2c')]=_[_0x614b('0x40')](_0x13ad4e[_0x614b('0x2a')],_0x13ad4e[_0x614b('0x2b')]);_0xf5c662[_0x614b('0x2d')]=_[_0x614b('0x40')](_0x13ad4e[_0x614b('0x2a')],qs[_0x614b('0x2e')](_0x50047f[_0x614b('0x2b')][_0x614b('0x2e')]));_0xf5c662[_0x614b('0x2d')]=_0xf5c662[_0x614b('0x2d')][_0x614b('0x41')]?_0xf5c662[_0x614b('0x2d')]:_0x13ad4e[_0x614b('0x2a')];_0xf5c662[_0x614b('0x32')]=qs[_0x614b('0x33')](_0x50047f[_0x614b('0x2b')][_0x614b('0x33')]);_0xf5c662[_0x614b('0x34')]=qs[_0x614b('0x2c')](_['pick'](_0x50047f[_0x614b('0x2b')],_0x13ad4e[_0x614b('0x2c')]));if(_0x50047f[_0x614b('0x2b')][_0x614b('0x36')]){_0xf5c662['where']=_['merge'](_0xf5c662[_0x614b('0x34')],{'$or':_[_0x614b('0x25')](_0xf5c662[_0x614b('0x2d')],function(_0x458e08){var _0x135b4f={};_0x135b4f[_0x458e08]={'$like':'%'+_0x50047f[_0x614b('0x2b')]['filter']+'%'};return _0x135b4f;})});}_0xf5c662=_[_0x614b('0x37')]({},_0xf5c662,_0x50047f[_0x614b('0x39')]);return _0x3e562f[_0x614b('0x4b')](_0xf5c662);}})[_0x614b('0x20')](function(_0x4f1d45){if(_0x4f1d45){_0x1cfaf1=_0x4f1d45[_0x614b('0x41')];if(!_0x50047f[_0x614b('0x2b')][_0x614b('0x2f')](_0x614b('0x30'))){_0xf5c662['limit']=qs['limit'](_0x50047f[_0x614b('0x2b')][_0x614b('0x31')]);_0xf5c662[_0x614b('0x1c')]=qs['offset'](_0x50047f[_0x614b('0x2b')]['offset']);}return _0x3e562f[_0x614b('0x4b')](_0xf5c662);}})[_0x614b('0x20')](function(_0x11dda8){if(_0x11dda8){return _0x11dda8?{'count':_0x1cfaf1,'rows':_0x11dda8}:null;}})[_0x614b('0x20')](respondWithResult(_0x214b8b,null))[_0x614b('0x3d')](handleError(_0x214b8b,null));};exports[_0x614b('0x4c')]=function(_0x22f144,_0x3dcad5,_0xe49719){var _0x848d10={};var _0x407734={};var _0x4bf91b;var _0x2dbd36;return db[_0x614b('0x26')][_0x614b('0x49')]({'where':{'id':_0x22f144[_0x614b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3dcad5,null))[_0x614b('0x20')](function(_0xd8f4e3){if(_0xd8f4e3){_0x4bf91b=_0xd8f4e3;_0x407734[_0x614b('0x2a')]=_['keys'](db[_0x614b('0x4a')][_0x614b('0x27')]);_0x407734['query']=_[_0x614b('0x3f')](_0x22f144[_0x614b('0x2b')]);_0x407734['filters']=_['intersection'](_0x407734[_0x614b('0x2a')],_0x407734[_0x614b('0x2b')]);_0x848d10[_0x614b('0x2d')]=_[_0x614b('0x40')](_0x407734[_0x614b('0x2a')],qs[_0x614b('0x2e')](_0x22f144[_0x614b('0x2b')]['fields']));_0x848d10['attributes']=_0x848d10[_0x614b('0x2d')][_0x614b('0x41')]?_0x848d10[_0x614b('0x2d')]:_0x407734[_0x614b('0x2a')];_0x848d10[_0x614b('0x32')]=qs[_0x614b('0x33')](_0x22f144[_0x614b('0x2b')]['sort']);_0x848d10['where']=qs[_0x614b('0x2c')](_[_0x614b('0x35')](_0x22f144['query'],_0x407734[_0x614b('0x2c')]));if(_0x22f144[_0x614b('0x2b')][_0x614b('0x36')]){_0x848d10['where']=_[_0x614b('0x37')](_0x848d10['where'],{'$or':_['map'](_0x848d10[_0x614b('0x2d')],function(_0x3521a1){var _0x515b92={};_0x515b92[_0x3521a1]={'$like':'%'+_0x22f144['query'][_0x614b('0x36')]+'%'};return _0x515b92;})});}_0x848d10=_[_0x614b('0x37')]({},_0x848d10,_0x22f144[_0x614b('0x39')]);return _0x4bf91b['getDescriptions'](_0x848d10);}})[_0x614b('0x20')](function(_0x152c94){if(_0x152c94){_0x2dbd36=_0x152c94['length'];if(!_0x22f144[_0x614b('0x2b')][_0x614b('0x2f')](_0x614b('0x30'))){_0x848d10['limit']=qs[_0x614b('0x31')](_0x22f144['query'][_0x614b('0x31')]);_0x848d10[_0x614b('0x1c')]=qs[_0x614b('0x1c')](_0x22f144[_0x614b('0x2b')][_0x614b('0x1c')]);}return _0x4bf91b[_0x614b('0x4c')](_0x848d10);}})[_0x614b('0x20')](function(_0x288c91){if(_0x288c91){return _0x288c91?{'count':_0x2dbd36,'rows':_0x288c91}:null;}})[_0x614b('0x20')](respondWithResult(_0x3dcad5,null))[_0x614b('0x3d')](handleError(_0x3dcad5,null));};exports[_0x614b('0x4d')]=function(_0x4bbf7c,_0x2880e5,_0x2fdef8){var _0x5d482f={};var _0x2b3c3d={};var _0x2218c5;var _0x2619c9;return db[_0x614b('0x26')]['findOne']({'where':{'id':_0x4bbf7c[_0x614b('0x47')]['id']}})['then'](handleEntityNotFound(_0x2880e5,null))[_0x614b('0x20')](function(_0xacc8bb){if(_0xacc8bb){_0x2218c5=_0xacc8bb;_0x2b3c3d[_0x614b('0x2a')]=_['keys'](db[_0x614b('0x4e')][_0x614b('0x27')]);_0x2b3c3d[_0x614b('0x2b')]=_[_0x614b('0x3f')](_0x4bbf7c[_0x614b('0x2b')]);_0x2b3c3d[_0x614b('0x2c')]=_['intersection'](_0x2b3c3d[_0x614b('0x2a')],_0x2b3c3d['query']);_0x5d482f[_0x614b('0x2d')]=_['intersection'](_0x2b3c3d[_0x614b('0x2a')],qs['fields'](_0x4bbf7c[_0x614b('0x2b')][_0x614b('0x2e')]));_0x5d482f[_0x614b('0x2d')]=_0x5d482f['attributes'][_0x614b('0x41')]?_0x5d482f['attributes']:_0x2b3c3d[_0x614b('0x2a')];_0x5d482f['order']=qs[_0x614b('0x33')](_0x4bbf7c['query']['sort']);_0x5d482f[_0x614b('0x34')]=qs[_0x614b('0x2c')](_[_0x614b('0x35')](_0x4bbf7c[_0x614b('0x2b')],_0x2b3c3d[_0x614b('0x2c')]));if(_0x4bbf7c['query']['filter']){_0x5d482f['where']=_[_0x614b('0x37')](_0x5d482f['where'],{'$or':_['map'](_0x5d482f[_0x614b('0x2d')],function(_0x529e6d){var _0x3a6f9c={};_0x3a6f9c[_0x529e6d]={'$like':'%'+_0x4bbf7c[_0x614b('0x2b')][_0x614b('0x36')]+'%'};return _0x3a6f9c;})});}_0x5d482f=_['merge']({},_0x5d482f,_0x4bbf7c[_0x614b('0x39')]);return _0x2218c5['getTags'](_0x5d482f);}})[_0x614b('0x20')](function(_0x47ddc8){if(_0x47ddc8){_0x2619c9=_0x47ddc8[_0x614b('0x41')];if(!_0x4bbf7c['query']['hasOwnProperty'](_0x614b('0x30'))){_0x5d482f[_0x614b('0x31')]=qs[_0x614b('0x31')](_0x4bbf7c[_0x614b('0x2b')][_0x614b('0x31')]);_0x5d482f[_0x614b('0x1c')]=qs[_0x614b('0x1c')](_0x4bbf7c[_0x614b('0x2b')][_0x614b('0x1c')]);}return _0x2218c5['getTags'](_0x5d482f);}})['then'](function(_0x14ed00){if(_0x14ed00){return _0x14ed00?{'count':_0x2619c9,'rows':_0x14ed00}:null;}})[_0x614b('0x20')](respondWithResult(_0x2880e5,null))[_0x614b('0x3d')](handleError(_0x2880e5,null));};exports[_0x614b('0x4f')]=function(_0x2dc7d1,_0x39490d,_0x2df3e9){if(_0x2dc7d1[_0x614b('0x45')]['id']){delete _0x2dc7d1['body']['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x2dc7d1[_0x614b('0x47')]['id']}})[_0x614b('0x20')](handleEntityNotFound(_0x39490d,null))[_0x614b('0x20')](function(_0x20b2b5){if(_0x20b2b5){return _0x20b2b5[_0x614b('0x4f')](_0x2dc7d1[_0x614b('0x45')]['ids']||[]);}return null;})[_0x614b('0x20')](respondWithResult(_0x39490d,null))['catch'](handleError(_0x39490d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b9510c8..2a85c6d 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 _0x1069=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','moment'];(function(_0x353b78,_0x517995){var _0x453fa7=function(_0x5eba6d){while(--_0x5eba6d){_0x353b78['push'](_0x353b78['shift']());}};_0x453fa7(++_0x517995);}(_0x1069,0x1ea));var _0x9106=function(_0x12392a,_0x4388e0){_0x12392a=_0x12392a-0x0;var _0x237822=_0x1069[_0x12392a];return _0x237822;};'use strict';var _=require('lodash');var util=require(_0x9106('0x0'));var logger=require(_0x9106('0x1'))(_0x9106('0x2'));var moment=require(_0x9106('0x3'));var BPromise=require(_0x9106('0x4'));var rp=require(_0x9106('0x5'));var fs=require('fs');var path=require(_0x9106('0x6'));var rimraf=require(_0x9106('0x7'));var config=require(_0x9106('0x8'));var attributes=require(_0x9106('0x9'));module[_0x9106('0xa')]=function(_0x41f221,_0xfb9cf1){return _0x41f221['define'](_0x9106('0xb'),attributes,{'tableName':_0x9106('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0820=['bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','api','moment'];(function(_0x1e2bf0,_0x1a4080){var _0x5cc1fc=function(_0x53aa17){while(--_0x53aa17){_0x1e2bf0['push'](_0x1e2bf0['shift']());}};_0x5cc1fc(++_0x1a4080);}(_0x0820,0x1b8));var _0x0082=function(_0x3b2e58,_0x387532){_0x3b2e58=_0x3b2e58-0x0;var _0x454aa7=_0x0820[_0x3b2e58];return _0x454aa7;};'use strict';var _=require(_0x0082('0x0'));var util=require(_0x0082('0x1'));var logger=require('../../config/logger')(_0x0082('0x2'));var moment=require(_0x0082('0x3'));var BPromise=require(_0x0082('0x4'));var rp=require(_0x0082('0x5'));var fs=require('fs');var path=require(_0x0082('0x6'));var rimraf=require('rimraf');var config=require(_0x0082('0x7'));var attributes=require(_0x0082('0x8'));module[_0x0082('0x9')]=function(_0x4ee49f,_0x388f54){return _0x4ee49f[_0x0082('0xa')](_0x0082('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 4fe1c65..6009af0 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 _0x5d4e=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x25e8ab,_0x184b56){var _0x3d8f74=function(_0x35c67c){while(--_0x35c67c){_0x25e8ab['push'](_0x25e8ab['shift']());}};_0x3d8f74(++_0x184b56);}(_0x5d4e,0x138));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe5d4('0x0'));var moment=require(_0xe5d4('0x1'));var BPromise=require(_0xe5d4('0x2'));var rs=require(_0xe5d4('0x3'));var fs=require('fs');var Redis=require(_0xe5d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5d4('0x5'));var logger=require(_0xe5d4('0x6'))(_0xe5d4('0x7'));var config=require('../../config/environment');var jayson=require(_0xe5d4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ecca3,_0x304a0b,_0x262b90){return new BPromise(function(_0x2d416d,_0x1b332f){return client[_0xe5d4('0x9')](_0x5ecca3,_0x262b90)[_0xe5d4('0xa')](function(_0xf7fa11){logger[_0xe5d4('0xb')](_0xe5d4('0xc'),_0x304a0b,_0xe5d4('0xd'));logger[_0xe5d4('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x304a0b,'request\x20sent',JSON[_0xe5d4('0xf')](_0xf7fa11));if(_0xf7fa11[_0xe5d4('0x10')]){if(_0xf7fa11[_0xe5d4('0x10')][_0xe5d4('0x11')]===0x1f4){logger[_0xe5d4('0x10')](_0xe5d4('0xc'),_0x304a0b,_0xf7fa11[_0xe5d4('0x10')][_0xe5d4('0x12')]);return _0x1b332f(_0xf7fa11[_0xe5d4('0x10')]['message']);}logger['error'](_0xe5d4('0xc'),_0x304a0b,_0xf7fa11[_0xe5d4('0x10')]['message']);return _0x2d416d(_0xf7fa11[_0xe5d4('0x10')][_0xe5d4('0x12')]);}else{logger[_0xe5d4('0xb')](_0xe5d4('0xc'),_0x304a0b,_0xe5d4('0xd'));_0x2d416d(_0xf7fa11[_0xe5d4('0x13')][_0xe5d4('0x12')]);}})[_0xe5d4('0x14')](function(_0x274b83){logger[_0xe5d4('0x10')](_0xe5d4('0xc'),_0x304a0b,_0x274b83);_0x1b332f(_0x274b83);});});} \ No newline at end of file +var _0x955f=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x39cbfb,_0x27053a){var _0x417b69=function(_0x49cc49){while(--_0x49cc49){_0x39cbfb['push'](_0x39cbfb['shift']());}};_0x417b69(++_0x27053a);}(_0x955f,0x1eb));var _0xf955=function(_0xed280c,_0x5ee20b){_0xed280c=_0xed280c-0x0;var _0x44f021=_0x955f[_0xed280c];return _0x44f021;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e8611da..27a3507 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 _0x6af5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','util','path','Router'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x6af5,0x7b));var _0x56af=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x6af5[_0x45f951];return _0x24756c;};'use strict';var multer=require('multer');var util=require(_0x56af('0x0'));var path=require(_0x56af('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x56af('0x2')]();var fs_extra=require(_0x56af('0x3'));var auth=require(_0x56af('0x4'));var interaction=require(_0x56af('0x5'));var config=require(_0x56af('0x6'));var controller=require(_0x56af('0x7'));router[_0x56af('0x8')]('/',auth[_0x56af('0x9')](),controller[_0x56af('0xa')]);router[_0x56af('0x8')](_0x56af('0xb'),auth[_0x56af('0x9')](),controller['show']);router[_0x56af('0xc')]('/',auth[_0x56af('0x9')](),controller[_0x56af('0xd')]);router[_0x56af('0xe')](_0x56af('0xb'),auth['isAuthenticated'](),controller[_0x56af('0xf')]);router['delete'](_0x56af('0xb'),auth[_0x56af('0x9')](),controller[_0x56af('0x10')]);module[_0x56af('0x11')]=router; \ No newline at end of file +var _0xb08b=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0xb08b,0x116));var _0xbb08=function(_0xf9192,_0x4df8c5){_0xf9192=_0xf9192-0x0;var _0x35ed5b=_0xb08b[_0xf9192];return _0x35ed5b;};'use strict';var multer=require(_0xbb08('0x0'));var util=require(_0xbb08('0x1'));var path=require(_0xbb08('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb08('0x3'));var router=express[_0xbb08('0x4')]();var fs_extra=require(_0xbb08('0x5'));var auth=require(_0xbb08('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb08('0x7'));var controller=require(_0xbb08('0x8'));router[_0xbb08('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb08('0xa')]);router[_0xbb08('0x9')]('/:id',auth[_0xbb08('0xb')](),controller[_0xbb08('0xc')]);router['post']('/',auth[_0xbb08('0xb')](),controller[_0xbb08('0xd')]);router[_0xbb08('0xe')](_0xbb08('0xf'),auth[_0xbb08('0xb')](),controller[_0xbb08('0x10')]);router[_0xbb08('0x11')](_0xbb08('0xf'),auth[_0xbb08('0xb')](),controller[_0xbb08('0x12')]);module[_0xbb08('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index aa2b6e1..45b9de6 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 _0x3ee8=['sequelize','exports','ENUM','string','customVariable','STRING','variable','BOOLEAN'];(function(_0x5aef75,_0x39228e){var _0x1bb942=function(_0x33884c){while(--_0x33884c){_0x5aef75['push'](_0x5aef75['shift']());}};_0x1bb942(++_0x39228e);}(_0x3ee8,0x150));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x83ee('0x0'));module[_0x83ee('0x1')]={'type':{'type':Sequelize[_0x83ee('0x2')](_0x83ee('0x3'),'variable',_0x83ee('0x4'),'keyValue','picklist'),'defaultValue':_0x83ee('0x3')},'content':{'type':Sequelize[_0x83ee('0x5')]},'key':{'type':Sequelize[_0x83ee('0x5')]},'keyType':{'type':Sequelize[_0x83ee('0x2')]('string',_0x83ee('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x83ee('0x5')]},'nameField':{'type':Sequelize[_0x83ee('0x5')]},'customField':{'type':Sequelize[_0x83ee('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x83ee('0x5')]}}; \ No newline at end of file +var _0x0bea=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x0bea,0x108));var _0xa0be=function(_0x56503a,_0x1c4b81){_0x56503a=_0x56503a-0x0;var _0x52e0d4=_0x0bea[_0x56503a];return _0x52e0d4;};'use strict';var Sequelize=require(_0xa0be('0x0'));module[_0xa0be('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa0be('0x2'),_0xa0be('0x3'),_0xa0be('0x4'),'keyValue',_0xa0be('0x5')),'defaultValue':_0xa0be('0x2')},'content':{'type':Sequelize[_0xa0be('0x6')]},'key':{'type':Sequelize[_0xa0be('0x6')]},'keyType':{'type':Sequelize[_0xa0be('0x7')](_0xa0be('0x2'),_0xa0be('0x3'),_0xa0be('0x4'))},'keyContent':{'type':Sequelize[_0xa0be('0x6')]},'idField':{'type':Sequelize[_0xa0be('0x6')]},'nameField':{'type':Sequelize[_0xa0be('0x6')]},'customField':{'type':Sequelize[_0xa0be('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index cedf0d2..1c5028c 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 _0xd0c9=['DeskField','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','destroy','eml-format','rimraf','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','error','name','send','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x54466d,_0x597e7e){var _0x8d8c37=function(_0xd445d3){while(--_0xd445d3){_0x54466d['push'](_0x54466d['shift']());}};_0x8d8c37(++_0x597e7e);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xd0c9[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x9d0c('0x0'));var rimraf=require(_0x9d0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d0c('0x2'));var BPromise=require(_0x9d0c('0x3'));var Mustache=require(_0x9d0c('0x4'));var util=require('util');var path=require(_0x9d0c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d0c('0x7'));var squel=require(_0x9d0c('0x8'));var crypto=require(_0x9d0c('0x9'));var jsforce=require(_0x9d0c('0xa'));var deskjs=require(_0x9d0c('0xb'));var toCsv=require(_0x9d0c('0xc'));var querystring=require('querystring');var Papa=require(_0x9d0c('0xd'));var Redis=require('ioredis');var authService=require(_0x9d0c('0xe'));var qs=require(_0x9d0c('0xf'));var as=require(_0x9d0c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d0c('0x11'))(_0x9d0c('0x12'));var utils=require(_0x9d0c('0x13'));var config=require(_0x9d0c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d0c('0x15'))['db'];function respondWithStatusCode(_0x575341,_0x191b79){_0x191b79=_0x191b79||0xcc;return function(_0x17e43b){if(_0x17e43b){return _0x575341[_0x9d0c('0x16')](_0x191b79);}return _0x575341[_0x9d0c('0x17')](_0x191b79)['end']();};}function respondWithResult(_0x5b1b42,_0x52ff64){_0x52ff64=_0x52ff64||0xc8;return function(_0x2b7885){if(_0x2b7885){return _0x5b1b42['status'](_0x52ff64)[_0x9d0c('0x18')](_0x2b7885);}};}function respondWithFilteredResult(_0x261be7,_0x2b20ca){return function(_0x275bb0){if(_0x275bb0){var _0x40e4e7=typeof _0x2b20ca[_0x9d0c('0x19')]===_0x9d0c('0x1a')&&typeof _0x2b20ca[_0x9d0c('0x1b')]==='undefined';var _0x4514fd=_0x275bb0[_0x9d0c('0x1c')];var _0x599ddb=_0x40e4e7?0x0:_0x2b20ca[_0x9d0c('0x19')];var _0x182dfb=_0x40e4e7?_0x275bb0[_0x9d0c('0x1c')]:_0x2b20ca['offset']+_0x2b20ca['limit'];var _0x11832a;if(_0x182dfb>=_0x4514fd){_0x182dfb=_0x4514fd;_0x11832a=0xc8;}else{_0x11832a=0xce;}_0x261be7[_0x9d0c('0x17')](_0x11832a);return _0x261be7['set'](_0x9d0c('0x1d'),_0x599ddb+'-'+_0x182dfb+'/'+_0x4514fd)[_0x9d0c('0x18')](_0x275bb0);}return null;};}function patchUpdates(_0xf60863){return function(_0x174ce3){try{jsonpatch[_0x9d0c('0x1e')](_0x174ce3,_0xf60863,!![]);}catch(_0x5b53d9){return BPromise[_0x9d0c('0x1f')](_0x5b53d9);}return _0x174ce3['save']();};}function saveUpdates(_0x1ff3f0,_0x17390f){return function(_0x52049b){if(_0x52049b){return _0x52049b[_0x9d0c('0x20')](_0x1ff3f0)[_0x9d0c('0x21')](function(_0x41d0a8){return _0x41d0a8;});}return null;};}function removeEntity(_0x4ab375,_0x2a1a70){return function(_0x280b22){if(_0x280b22){return _0x280b22['destroy']()[_0x9d0c('0x21')](function(){_0x4ab375[_0x9d0c('0x17')](0xcc)[_0x9d0c('0x22')]();});}};}function handleEntityNotFound(_0x35b60f,_0x472f95){return function(_0xb176f9){if(!_0xb176f9){_0x35b60f[_0x9d0c('0x16')](0x194);}return _0xb176f9;};}function handleError(_0x48b65b,_0x46b647){_0x46b647=_0x46b647||0x1f4;return function(_0x1f35a5){logger[_0x9d0c('0x23')](_0x1f35a5['stack']);if(_0x1f35a5[_0x9d0c('0x24')]){delete _0x1f35a5[_0x9d0c('0x24')];}_0x48b65b[_0x9d0c('0x17')](_0x46b647)[_0x9d0c('0x25')](_0x1f35a5);};}exports['index']=function(_0x12d75f,_0x46955f){var _0x1846f0={},_0x2cbbbc={},_0x4ed782={'count':0x0,'rows':[]};var _0x5bf51b=_['map'](db['DeskField'][_0x9d0c('0x26')],function(_0x263482){return{'name':_0x263482[_0x9d0c('0x27')],'type':_0x263482[_0x9d0c('0x28')]['key']};});_0x2cbbbc['model']=_[_0x9d0c('0x29')](_0x5bf51b,_0x9d0c('0x24'));_0x2cbbbc[_0x9d0c('0x2a')]=_[_0x9d0c('0x2b')](_0x12d75f[_0x9d0c('0x2a')]);_0x2cbbbc[_0x9d0c('0x2c')]=_['intersection'](_0x2cbbbc[_0x9d0c('0x2d')],_0x2cbbbc[_0x9d0c('0x2a')]);_0x1846f0[_0x9d0c('0x2e')]=_[_0x9d0c('0x2f')](_0x2cbbbc[_0x9d0c('0x2d')],qs[_0x9d0c('0x30')](_0x12d75f['query']['fields']));_0x1846f0['attributes']=_0x1846f0[_0x9d0c('0x2e')][_0x9d0c('0x31')]?_0x1846f0['attributes']:_0x2cbbbc[_0x9d0c('0x2d')];if(!_0x12d75f['query'][_0x9d0c('0x32')]('nolimit')){_0x1846f0['limit']=qs[_0x9d0c('0x1b')](_0x12d75f['query'][_0x9d0c('0x1b')]);_0x1846f0[_0x9d0c('0x19')]=qs['offset'](_0x12d75f[_0x9d0c('0x2a')][_0x9d0c('0x19')]);}_0x1846f0[_0x9d0c('0x33')]=qs['sort'](_0x12d75f[_0x9d0c('0x2a')][_0x9d0c('0x34')]);_0x1846f0[_0x9d0c('0x35')]=qs[_0x9d0c('0x2c')](_[_0x9d0c('0x36')](_0x12d75f[_0x9d0c('0x2a')],_0x2cbbbc[_0x9d0c('0x2c')]),_0x5bf51b);if(_0x12d75f[_0x9d0c('0x2a')]['filter']){_0x1846f0[_0x9d0c('0x35')]=_[_0x9d0c('0x37')](_0x1846f0['where'],{'$or':_[_0x9d0c('0x29')](_0x5bf51b,function(_0x346462){if(_0x346462[_0x9d0c('0x28')]!==_0x9d0c('0x38')){var _0x4935f2={};_0x4935f2[_0x346462[_0x9d0c('0x24')]]={'$like':'%'+_0x12d75f[_0x9d0c('0x2a')][_0x9d0c('0x39')]+'%'};return _0x4935f2;}})});}_0x1846f0=_[_0x9d0c('0x37')]({},_0x1846f0,_0x12d75f['options']);var _0x528517={'where':_0x1846f0[_0x9d0c('0x35')]};return db[_0x9d0c('0x3a')][_0x9d0c('0x1c')](_0x528517)['then'](function(_0x17a5bc){_0x4ed782[_0x9d0c('0x1c')]=_0x17a5bc;if(_0x12d75f[_0x9d0c('0x2a')]['includeAll']){_0x1846f0['include']=[{'all':!![]}];}return db[_0x9d0c('0x3a')][_0x9d0c('0x3b')](_0x1846f0);})[_0x9d0c('0x21')](function(_0x1a28fc){_0x4ed782[_0x9d0c('0x3c')]=_0x1a28fc;return _0x4ed782;})[_0x9d0c('0x21')](respondWithFilteredResult(_0x46955f,_0x1846f0))[_0x9d0c('0x3d')](handleError(_0x46955f,null));};exports[_0x9d0c('0x3e')]=function(_0x20473b,_0x454e01){var _0x3a88af={'raw':!![],'where':{'id':_0x20473b[_0x9d0c('0x3f')]['id']}},_0x3b2554={};_0x3b2554[_0x9d0c('0x2d')]=_[_0x9d0c('0x2b')](db[_0x9d0c('0x3a')][_0x9d0c('0x26')]);_0x3b2554[_0x9d0c('0x2a')]=_['keys'](_0x20473b[_0x9d0c('0x2a')]);_0x3b2554[_0x9d0c('0x2c')]=_[_0x9d0c('0x2f')](_0x3b2554[_0x9d0c('0x2d')],_0x3b2554[_0x9d0c('0x2a')]);_0x3a88af[_0x9d0c('0x2e')]=_['intersection'](_0x3b2554[_0x9d0c('0x2d')],qs['fields'](_0x20473b[_0x9d0c('0x2a')][_0x9d0c('0x30')]));_0x3a88af['attributes']=_0x3a88af[_0x9d0c('0x2e')][_0x9d0c('0x31')]?_0x3a88af[_0x9d0c('0x2e')]:_0x3b2554[_0x9d0c('0x2d')];if(_0x20473b[_0x9d0c('0x2a')][_0x9d0c('0x40')]){_0x3a88af[_0x9d0c('0x41')]=[{'all':!![]}];}_0x3a88af=_[_0x9d0c('0x37')]({},_0x3a88af,_0x20473b[_0x9d0c('0x42')]);return db[_0x9d0c('0x3a')][_0x9d0c('0x43')](_0x3a88af)[_0x9d0c('0x21')](handleEntityNotFound(_0x454e01,null))[_0x9d0c('0x21')](respondWithResult(_0x454e01,null))[_0x9d0c('0x3d')](handleError(_0x454e01,null));};exports[_0x9d0c('0x44')]=function(_0x575b66,_0x4ea9c6){return db[_0x9d0c('0x3a')][_0x9d0c('0x44')](_0x575b66[_0x9d0c('0x45')],{})[_0x9d0c('0x21')](respondWithResult(_0x4ea9c6,0xc9))['catch'](handleError(_0x4ea9c6,null));};exports[_0x9d0c('0x20')]=function(_0x6b2dcf,_0x38a61d){if(_0x6b2dcf[_0x9d0c('0x45')]['id']){delete _0x6b2dcf['body']['id'];}return db[_0x9d0c('0x3a')][_0x9d0c('0x43')]({'where':{'id':_0x6b2dcf[_0x9d0c('0x3f')]['id']}})[_0x9d0c('0x21')](handleEntityNotFound(_0x38a61d,null))[_0x9d0c('0x21')](saveUpdates(_0x6b2dcf[_0x9d0c('0x45')],null))[_0x9d0c('0x21')](respondWithResult(_0x38a61d,null))[_0x9d0c('0x3d')](handleError(_0x38a61d,null));};exports[_0x9d0c('0x46')]=function(_0xb0c06,_0xbabbd1){return db[_0x9d0c('0x3a')][_0x9d0c('0x43')]({'where':{'id':_0xb0c06[_0x9d0c('0x3f')]['id']}})['then'](handleEntityNotFound(_0xbabbd1,null))['then'](removeEntity(_0xbabbd1,null))['catch'](handleError(_0xbabbd1,null));}; \ No newline at end of file +var _0xb9e3=['rows','catch','show','params','keys','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','reject','save','then','destroy','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x26b7a6,_0x4f58d1){var _0x20c444=function(_0x30c704){while(--_0x30c704){_0x26b7a6['push'](_0x26b7a6['shift']());}};_0x20c444(++_0x4f58d1);}(_0xb9e3,0xdc));var _0x3b9e=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xb9e3[_0x4063a4];return _0x17908d;};'use strict';var emlformat=require(_0x3b9e('0x0'));var rimraf=require(_0x3b9e('0x1'));var zipdir=require(_0x3b9e('0x2'));var jsonpatch=require(_0x3b9e('0x3'));var rp=require(_0x3b9e('0x4'));var moment=require('moment');var BPromise=require(_0x3b9e('0x5'));var Mustache=require(_0x3b9e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b9e('0x7'));var fs=require('fs');var fs_extra=require(_0x3b9e('0x8'));var _=require('lodash');var squel=require(_0x3b9e('0x9'));var crypto=require(_0x3b9e('0xa'));var jsforce=require(_0x3b9e('0xb'));var deskjs=require(_0x3b9e('0xc'));var toCsv=require(_0x3b9e('0xd'));var querystring=require(_0x3b9e('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b9e('0xf'));var authService=require(_0x3b9e('0x10'));var qs=require(_0x3b9e('0x11'));var as=require(_0x3b9e('0x12'));var hardwareService=require(_0x3b9e('0x13'));var logger=require('../../config/logger')(_0x3b9e('0x14'));var utils=require(_0x3b9e('0x15'));var config=require(_0x3b9e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b9e('0x17'))['db'];function respondWithStatusCode(_0x1cd6bc,_0x31cbf3){_0x31cbf3=_0x31cbf3||0xcc;return function(_0x32aa24){if(_0x32aa24){return _0x1cd6bc[_0x3b9e('0x18')](_0x31cbf3);}return _0x1cd6bc[_0x3b9e('0x19')](_0x31cbf3)['end']();};}function respondWithResult(_0x1c5c69,_0x3188b4){_0x3188b4=_0x3188b4||0xc8;return function(_0xf4afac){if(_0xf4afac){return _0x1c5c69[_0x3b9e('0x19')](_0x3188b4)[_0x3b9e('0x1a')](_0xf4afac);}};}function respondWithFilteredResult(_0x2c4d75,_0x366f9a){return function(_0x1336f0){if(_0x1336f0){var _0x5f50d1=typeof _0x366f9a['offset']===_0x3b9e('0x1b')&&typeof _0x366f9a[_0x3b9e('0x1c')]===_0x3b9e('0x1b');var _0x1ec65e=_0x1336f0['count'];var _0x24984b=_0x5f50d1?0x0:_0x366f9a['offset'];var _0x21fb05=_0x5f50d1?_0x1336f0['count']:_0x366f9a[_0x3b9e('0x1d')]+_0x366f9a[_0x3b9e('0x1c')];var _0x30f9cc;if(_0x21fb05>=_0x1ec65e){_0x21fb05=_0x1ec65e;_0x30f9cc=0xc8;}else{_0x30f9cc=0xce;}_0x2c4d75['status'](_0x30f9cc);return _0x2c4d75[_0x3b9e('0x1e')]('Content-Range',_0x24984b+'-'+_0x21fb05+'/'+_0x1ec65e)[_0x3b9e('0x1a')](_0x1336f0);}return null;};}function patchUpdates(_0x29b958){return function(_0xf12d62){try{jsonpatch[_0x3b9e('0x1f')](_0xf12d62,_0x29b958,!![]);}catch(_0x183ab9){return BPromise[_0x3b9e('0x20')](_0x183ab9);}return _0xf12d62[_0x3b9e('0x21')]();};}function saveUpdates(_0xe9b77e,_0x43baa7){return function(_0xc10506){if(_0xc10506){return _0xc10506['update'](_0xe9b77e)[_0x3b9e('0x22')](function(_0x49b1f1){return _0x49b1f1;});}return null;};}function removeEntity(_0x3f935b,_0x18720e){return function(_0x53707c){if(_0x53707c){return _0x53707c[_0x3b9e('0x23')]()[_0x3b9e('0x22')](function(){_0x3f935b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc078cc,_0x6b3d25){return function(_0x49e15e){if(!_0x49e15e){_0xc078cc['sendStatus'](0x194);}return _0x49e15e;};}function handleError(_0x368ff7,_0x500e8d){_0x500e8d=_0x500e8d||0x1f4;return function(_0x38d238){logger[_0x3b9e('0x24')](_0x38d238[_0x3b9e('0x25')]);if(_0x38d238[_0x3b9e('0x26')]){delete _0x38d238[_0x3b9e('0x26')];}_0x368ff7['status'](_0x500e8d)[_0x3b9e('0x27')](_0x38d238);};}exports['index']=function(_0x555f15,_0x131181){var _0x313be6={},_0x18c9dc={},_0x4552ba={'count':0x0,'rows':[]};var _0x358c55=_['map'](db[_0x3b9e('0x28')][_0x3b9e('0x29')],function(_0x443afd){return{'name':_0x443afd[_0x3b9e('0x2a')],'type':_0x443afd[_0x3b9e('0x2b')][_0x3b9e('0x2c')]};});_0x18c9dc[_0x3b9e('0x2d')]=_[_0x3b9e('0x2e')](_0x358c55,_0x3b9e('0x26'));_0x18c9dc[_0x3b9e('0x2f')]=_['keys'](_0x555f15[_0x3b9e('0x2f')]);_0x18c9dc[_0x3b9e('0x30')]=_['intersection'](_0x18c9dc[_0x3b9e('0x2d')],_0x18c9dc[_0x3b9e('0x2f')]);_0x313be6[_0x3b9e('0x31')]=_['intersection'](_0x18c9dc[_0x3b9e('0x2d')],qs['fields'](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x32')]));_0x313be6[_0x3b9e('0x31')]=_0x313be6[_0x3b9e('0x31')][_0x3b9e('0x33')]?_0x313be6[_0x3b9e('0x31')]:_0x18c9dc[_0x3b9e('0x2d')];if(!_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x34')](_0x3b9e('0x35'))){_0x313be6['limit']=qs[_0x3b9e('0x1c')](_0x555f15['query'][_0x3b9e('0x1c')]);_0x313be6['offset']=qs[_0x3b9e('0x1d')](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x1d')]);}_0x313be6[_0x3b9e('0x36')]=qs[_0x3b9e('0x37')](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x37')]);_0x313be6[_0x3b9e('0x38')]=qs['filters'](_['pick'](_0x555f15[_0x3b9e('0x2f')],_0x18c9dc[_0x3b9e('0x30')]),_0x358c55);if(_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x39')]){_0x313be6['where']=_[_0x3b9e('0x3a')](_0x313be6[_0x3b9e('0x38')],{'$or':_[_0x3b9e('0x2e')](_0x358c55,function(_0x170e7c){if(_0x170e7c[_0x3b9e('0x2b')]!==_0x3b9e('0x3b')){var _0x2c4823={};_0x2c4823[_0x170e7c['name']]={'$like':'%'+_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x39')]+'%'};return _0x2c4823;}})});}_0x313be6=_[_0x3b9e('0x3a')]({},_0x313be6,_0x555f15[_0x3b9e('0x3c')]);var _0x17fae2={'where':_0x313be6[_0x3b9e('0x38')]};return db[_0x3b9e('0x28')][_0x3b9e('0x3d')](_0x17fae2)['then'](function(_0x2a9c73){_0x4552ba[_0x3b9e('0x3d')]=_0x2a9c73;if(_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x3e')]){_0x313be6[_0x3b9e('0x3f')]=[{'all':!![]}];}return db[_0x3b9e('0x28')]['findAll'](_0x313be6);})[_0x3b9e('0x22')](function(_0x596c86){_0x4552ba[_0x3b9e('0x40')]=_0x596c86;return _0x4552ba;})['then'](respondWithFilteredResult(_0x131181,_0x313be6))[_0x3b9e('0x41')](handleError(_0x131181,null));};exports[_0x3b9e('0x42')]=function(_0xcd8ca7,_0x2a93ef){var _0x3ca523={'raw':!![],'where':{'id':_0xcd8ca7[_0x3b9e('0x43')]['id']}},_0x2a33d6={};_0x2a33d6[_0x3b9e('0x2d')]=_[_0x3b9e('0x44')](db[_0x3b9e('0x28')][_0x3b9e('0x29')]);_0x2a33d6[_0x3b9e('0x2f')]=_[_0x3b9e('0x44')](_0xcd8ca7[_0x3b9e('0x2f')]);_0x2a33d6[_0x3b9e('0x30')]=_['intersection'](_0x2a33d6[_0x3b9e('0x2d')],_0x2a33d6[_0x3b9e('0x2f')]);_0x3ca523[_0x3b9e('0x31')]=_['intersection'](_0x2a33d6[_0x3b9e('0x2d')],qs[_0x3b9e('0x32')](_0xcd8ca7[_0x3b9e('0x2f')][_0x3b9e('0x32')]));_0x3ca523[_0x3b9e('0x31')]=_0x3ca523['attributes'][_0x3b9e('0x33')]?_0x3ca523[_0x3b9e('0x31')]:_0x2a33d6[_0x3b9e('0x2d')];if(_0xcd8ca7['query']['includeAll']){_0x3ca523[_0x3b9e('0x3f')]=[{'all':!![]}];}_0x3ca523=_[_0x3b9e('0x3a')]({},_0x3ca523,_0xcd8ca7[_0x3b9e('0x3c')]);return db[_0x3b9e('0x28')]['find'](_0x3ca523)[_0x3b9e('0x22')](handleEntityNotFound(_0x2a93ef,null))[_0x3b9e('0x22')](respondWithResult(_0x2a93ef,null))[_0x3b9e('0x41')](handleError(_0x2a93ef,null));};exports[_0x3b9e('0x45')]=function(_0x2fd720,_0x10a52d){return db[_0x3b9e('0x28')][_0x3b9e('0x45')](_0x2fd720[_0x3b9e('0x46')],{})[_0x3b9e('0x22')](respondWithResult(_0x10a52d,0xc9))['catch'](handleError(_0x10a52d,null));};exports['update']=function(_0x2159c1,_0x5f1920){if(_0x2159c1[_0x3b9e('0x46')]['id']){delete _0x2159c1['body']['id'];}return db[_0x3b9e('0x28')]['find']({'where':{'id':_0x2159c1[_0x3b9e('0x43')]['id']}})[_0x3b9e('0x22')](handleEntityNotFound(_0x5f1920,null))[_0x3b9e('0x22')](saveUpdates(_0x2159c1['body'],null))['then'](respondWithResult(_0x5f1920,null))['catch'](handleError(_0x5f1920,null));};exports[_0x3b9e('0x23')]=function(_0x377b45,_0x582d2){return db[_0x3b9e('0x28')]['find']({'where':{'id':_0x377b45[_0x3b9e('0x43')]['id']}})[_0x3b9e('0x22')](handleEntityNotFound(_0x582d2,null))[_0x3b9e('0x22')](removeEntity(_0x582d2,null))[_0x3b9e('0x41')](handleError(_0x582d2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index cf9afae..d20186f 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 _0x473a=['path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','moment'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x473a,0x149));var _0xa473=function(_0x3e9e9d,_0x2247a0){_0x3e9e9d=_0x3e9e9d-0x0;var _0x505409=_0x473a[_0x3e9e9d];return _0x505409;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa473('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa473('0x1'));var rimraf=require(_0xa473('0x2'));var config=require(_0xa473('0x3'));var attributes=require(_0xa473('0x4'));module[_0xa473('0x5')]=function(_0x1efe7f,_0x22ec8d){return _0x1efe7f['define'](_0xa473('0x6'),attributes,{'tableName':_0xa473('0x7'),'paranoid':![],'indexes':[{'name':_0xa473('0x8'),'fields':[_0xa473('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcfdf=['path','rimraf','define','int_desk_fields','desk_unique_index','idField','lodash'];(function(_0x449c2c,_0x1ee518){var _0x88e8a0=function(_0x63b244){while(--_0x63b244){_0x449c2c['push'](_0x449c2c['shift']());}};_0x88e8a0(++_0x1ee518);}(_0xcfdf,0x1e9));var _0xfcfd=function(_0x15cca8,_0x4fe600){_0x15cca8=_0x15cca8-0x0;var _0x4edc9c=_0xcfdf[_0x15cca8];return _0x4edc9c;};'use strict';var _=require(_0xfcfd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcfd('0x1'));var rimraf=require(_0xfcfd('0x2'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x2ec3b2,_0x47d8d7){return _0x2ec3b2[_0xfcfd('0x3')]('DeskField',attributes,{'tableName':_0xfcfd('0x4'),'paranoid':![],'indexes':[{'name':_0xfcfd('0x5'),'fields':[_0xfcfd('0x6'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 56f9497..df4badc 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 _0x38d9=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment'];(function(_0xd50b5f,_0x3bae03){var _0x4a15e9=function(_0x284696){while(--_0x284696){_0xd50b5f['push'](_0xd50b5f['shift']());}};_0x4a15e9(++_0x3bae03);}(_0x38d9,0x1d9));var _0x938d=function(_0x2bc788,_0x5b2fb4){_0x2bc788=_0x2bc788-0x0;var _0x4cd4b2=_0x38d9[_0x2bc788];return _0x4cd4b2;};'use strict';var _=require('lodash');var util=require(_0x938d('0x0'));var moment=require(_0x938d('0x1'));var BPromise=require(_0x938d('0x2'));var rs=require(_0x938d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x938d('0x4'));var logger=require(_0x938d('0x5'))(_0x938d('0x6'));var config=require(_0x938d('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ceb06,_0x4cc9ef,_0x16b262){return new BPromise(function(_0x38b800,_0x5239fd){return client[_0x938d('0x8')](_0x1ceb06,_0x16b262)['then'](function(_0x23484f){logger['info'](_0x938d('0x9'),_0x4cc9ef,_0x938d('0xa'));logger[_0x938d('0xb')](_0x938d('0xc'),_0x4cc9ef,_0x938d('0xa'),JSON['stringify'](_0x23484f));if(_0x23484f[_0x938d('0xd')]){if(_0x23484f[_0x938d('0xd')][_0x938d('0xe')]===0x1f4){logger[_0x938d('0xd')]('DeskField,\x20%s,\x20%s',_0x4cc9ef,_0x23484f[_0x938d('0xd')][_0x938d('0xf')]);return _0x5239fd(_0x23484f[_0x938d('0xd')][_0x938d('0xf')]);}logger[_0x938d('0xd')]('DeskField,\x20%s,\x20%s',_0x4cc9ef,_0x23484f[_0x938d('0xd')]['message']);return _0x38b800(_0x23484f[_0x938d('0xd')][_0x938d('0xf')]);}else{logger[_0x938d('0x10')](_0x938d('0x9'),_0x4cc9ef,'request\x20sent');_0x38b800(_0x23484f[_0x938d('0x11')][_0x938d('0xf')]);}})[_0x938d('0x12')](function(_0x163a5e){logger[_0x938d('0xd')](_0x938d('0x9'),_0x4cc9ef,_0x163a5e);_0x5239fd(_0x163a5e);});});} \ No newline at end of file +var _0x4ffc=['rpc','jayson/promise','client','http','then','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils'];(function(_0x40ece6,_0x4fd49a){var _0x1a3b51=function(_0x50e0ad){while(--_0x50e0ad){_0x40ece6['push'](_0x40ece6['shift']());}};_0x1a3b51(++_0x4fd49a);}(_0x4ffc,0xe6));var _0xc4ff=function(_0x14f9b1,_0x3d6eeb){_0x14f9b1=_0x14f9b1-0x0;var _0x4bd14b=_0x4ffc[_0x14f9b1];return _0x4bd14b;};'use strict';var _=require(_0xc4ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4ff('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4ff('0x3'));var logger=require('../../config/logger')(_0xc4ff('0x4'));var config=require('../../config/environment');var jayson=require(_0xc4ff('0x5'));var client=jayson[_0xc4ff('0x6')][_0xc4ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b6e75,_0x25ef8c,_0x1b492a){return new BPromise(function(_0x559430,_0xc6db17){return client['request'](_0x5b6e75,_0x1b492a)[_0xc4ff('0x8')](function(_0x2ac869){logger['info'](_0xc4ff('0x9'),_0x25ef8c,'request\x20sent');logger[_0xc4ff('0xa')]('DeskField,\x20%s,\x20%s,\x20%s',_0x25ef8c,_0xc4ff('0xb'),JSON[_0xc4ff('0xc')](_0x2ac869));if(_0x2ac869[_0xc4ff('0xd')]){if(_0x2ac869['error'][_0xc4ff('0xe')]===0x1f4){logger[_0xc4ff('0xd')](_0xc4ff('0x9'),_0x25ef8c,_0x2ac869[_0xc4ff('0xd')][_0xc4ff('0xf')]);return _0xc6db17(_0x2ac869['error'][_0xc4ff('0xf')]);}logger[_0xc4ff('0xd')](_0xc4ff('0x9'),_0x25ef8c,_0x2ac869[_0xc4ff('0xd')][_0xc4ff('0xf')]);return _0x559430(_0x2ac869['error']['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x25ef8c,'request\x20sent');_0x559430(_0x2ac869[_0xc4ff('0x10')][_0xc4ff('0xf')]);}})[_0xc4ff('0x11')](function(_0x3e65f8){logger[_0xc4ff('0xd')](_0xc4ff('0x9'),_0x25ef8c,_0x3e65f8);_0xc6db17(_0x3e65f8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 59b9825..3d512be 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 _0x7546=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','multer'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7546,0x71));var _0x6754=function(_0xc177ee,_0x27205f){_0xc177ee=_0xc177ee-0x0;var _0x100aed=_0x7546[_0xc177ee];return _0x100aed;};'use strict';var multer=require(_0x6754('0x0'));var util=require('util');var path=require(_0x6754('0x1'));var timeout=require('connect-timeout');var express=require(_0x6754('0x2'));var router=express['Router']();var fs_extra=require(_0x6754('0x3'));var auth=require(_0x6754('0x4'));var interaction=require(_0x6754('0x5'));var config=require('../../config/environment');var controller=require(_0x6754('0x6'));router[_0x6754('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6754('0x7')](_0x6754('0x8'),auth[_0x6754('0x9')](),controller['show']);router['get'](_0x6754('0xa'),auth['isAuthenticated'](),controller[_0x6754('0xb')]);router['get']('/:id/fields',auth[_0x6754('0x9')](),controller[_0x6754('0xc')]);router[_0x6754('0xd')]('/',auth[_0x6754('0x9')](),controller[_0x6754('0xe')]);router[_0x6754('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x6754('0xf')]);router[_0x6754('0x10')]('/:id',auth[_0x6754('0x9')](),controller['update']);router[_0x6754('0x11')](_0x6754('0x8'),auth['isAuthenticated'](),controller[_0x6754('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1328=['./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1328,0x1ad));var _0x8132=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x1328[_0x22e47a];return _0x15a12a;};'use strict';var multer=require(_0x8132('0x0'));var util=require(_0x8132('0x1'));var path=require(_0x8132('0x2'));var timeout=require('connect-timeout');var express=require(_0x8132('0x3'));var router=express[_0x8132('0x4')]();var fs_extra=require(_0x8132('0x5'));var auth=require(_0x8132('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8132('0x7'));var controller=require(_0x8132('0x8'));router[_0x8132('0x9')]('/',auth[_0x8132('0xa')](),controller[_0x8132('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8132('0xc')]);router[_0x8132('0x9')](_0x8132('0xd'),auth['isAuthenticated'](),controller[_0x8132('0xe')]);router[_0x8132('0x9')](_0x8132('0xf'),auth['isAuthenticated'](),controller[_0x8132('0x10')]);router[_0x8132('0x11')]('/',auth[_0x8132('0xa')](),controller['create']);router[_0x8132('0x11')](_0x8132('0xd'),auth[_0x8132('0xa')](),controller['addConfiguration']);router[_0x8132('0x12')]('/:id',auth[_0x8132('0xa')](),controller[_0x8132('0x13')]);router['delete'](_0x8132('0x14'),auth[_0x8132('0xa')](),controller[_0x8132('0x15')]);module[_0x8132('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8d31f9f..ef9e419 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 _0x794b=['sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x794b,0x1c2));var _0xb794=function(_0x402e79,_0x54c19a){_0x402e79=_0x402e79-0x0;var _0x62a5d8=_0x794b[_0x402e79];return _0x62a5d8;};'use strict';var Sequelize=require(_0xb794('0x0'));module[_0xb794('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb794('0x2')]},'password':{'type':Sequelize[_0xb794('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb794('0x2')]},'clientSecret':{'type':Sequelize[_0xb794('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaad5=['sequelize','exports','STRING'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xaad5,0x177));var _0x5aad=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xaad5[_0x270adf];return _0x29eda9;};'use strict';var Sequelize=require(_0x5aad('0x0'));module[_0x5aad('0x1')]={'name':{'type':Sequelize[_0x5aad('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5aad('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x5aad('0x2')]},'serverUrl':{'type':Sequelize[_0x5aad('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5aad('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4f00e85..c898f52 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 _0x25b5=[')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','Dynamics365Account','fieldName','type','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','catch','show','params','rawAttributes','includeAll','include','find','body','update','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','create','Dynamics365Field','getFields','ticketType','Incident','description','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','password','tenantId','clientSecret','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','username','access_token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','PicklistAttributeMetadata','push','all','@odata.type','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false'];(function(_0x2455b3,_0x2b2c71){var _0x983cd3=function(_0xf12e4e){while(--_0xf12e4e){_0x2455b3['push'](_0x2455b3['shift']());}};_0x983cd3(++_0x2b2c71);}(_0x25b5,0x198));var _0x525b=function(_0x30c647,_0xf59572){_0x30c647=_0x30c647-0x0;var _0x4029a3=_0x25b5[_0x30c647];return _0x4029a3;};'use strict';var emlformat=require(_0x525b('0x0'));var rimraf=require(_0x525b('0x1'));var zipdir=require(_0x525b('0x2'));var jsonpatch=require(_0x525b('0x3'));var rp=require(_0x525b('0x4'));var moment=require('moment');var BPromise=require(_0x525b('0x5'));var Mustache=require(_0x525b('0x6'));var util=require(_0x525b('0x7'));var path=require(_0x525b('0x8'));var sox=require(_0x525b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x525b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x525b('0xb'));var jsforce=require(_0x525b('0xc'));var deskjs=require(_0x525b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x525b('0xe'));var Papa=require(_0x525b('0xf'));var Redis=require(_0x525b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x525b('0x11'))(_0x525b('0x12'));var utils=require('../../config/utils');var config=require(_0x525b('0x13'));var licenseUtil=require(_0x525b('0x14'));var db=require(_0x525b('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4dd1ca,_0x182ce8){_0x182ce8=_0x182ce8||0xcc;return function(_0x1af427){if(_0x1af427){return _0x4dd1ca[_0x525b('0x16')](_0x182ce8);}return _0x4dd1ca[_0x525b('0x17')](_0x182ce8)[_0x525b('0x18')]();};}function respondWithResult(_0x3897d5,_0x281bf4){_0x281bf4=_0x281bf4||0xc8;return function(_0xc996b4){if(_0xc996b4){return _0x3897d5[_0x525b('0x17')](_0x281bf4)[_0x525b('0x19')](_0xc996b4);}};}function respondWithFilteredResult(_0xe1ace,_0x4d5059){return function(_0x580429){if(_0x580429){var _0x170e3e=typeof _0x4d5059[_0x525b('0x1a')]==='undefined'&&typeof _0x4d5059['limit']===_0x525b('0x1b');var _0x344c4e=_0x580429[_0x525b('0x1c')];var _0x4c4d33=_0x170e3e?0x0:_0x4d5059[_0x525b('0x1a')];var _0x206492=_0x170e3e?_0x580429[_0x525b('0x1c')]:_0x4d5059['offset']+_0x4d5059['limit'];var _0x5f1907;if(_0x206492>=_0x344c4e){_0x206492=_0x344c4e;_0x5f1907=0xc8;}else{_0x5f1907=0xce;}_0xe1ace[_0x525b('0x17')](_0x5f1907);return _0xe1ace[_0x525b('0x1d')](_0x525b('0x1e'),_0x4c4d33+'-'+_0x206492+'/'+_0x344c4e)[_0x525b('0x19')](_0x580429);}return null;};}function patchUpdates(_0x14da20){return function(_0xf7be9a){try{jsonpatch[_0x525b('0x1f')](_0xf7be9a,_0x14da20,!![]);}catch(_0x1635b1){return BPromise[_0x525b('0x20')](_0x1635b1);}return _0xf7be9a['save']();};}function saveUpdates(_0x22b7f3,_0x3357a7){return function(_0x26c6de){if(_0x26c6de){return _0x26c6de['update'](_0x22b7f3)[_0x525b('0x21')](function(_0x29b5dc){return _0x29b5dc;});}return null;};}function removeEntity(_0x40dbc7,_0x4bfd2b){return function(_0x497ca8){if(_0x497ca8){return _0x497ca8[_0x525b('0x22')]()[_0x525b('0x21')](function(){_0x40dbc7[_0x525b('0x17')](0xcc)[_0x525b('0x18')]();});}};}function handleEntityNotFound(_0x466baa,_0x3e250b){return function(_0x3adbeb){if(!_0x3adbeb){_0x466baa[_0x525b('0x16')](0x194);}return _0x3adbeb;};}function handleError(_0x19b964,_0x2fbe49){_0x2fbe49=_0x2fbe49||0x1f4;return function(_0x334bdc){logger[_0x525b('0x23')](_0x334bdc['stack']);if(_0x334bdc['name']){delete _0x334bdc[_0x525b('0x24')];}_0x19b964['status'](_0x2fbe49)[_0x525b('0x25')](_0x334bdc);};}exports[_0x525b('0x26')]=function(_0x126477,_0x480645){var _0x51167a={},_0xbb36d6={},_0x3b2029={'count':0x0,'rows':[]};var _0x3364a3=_[_0x525b('0x27')](db[_0x525b('0x28')]['rawAttributes'],function(_0x2caada){return{'name':_0x2caada[_0x525b('0x29')],'type':_0x2caada[_0x525b('0x2a')]['key']};});_0xbb36d6[_0x525b('0x2b')]=_[_0x525b('0x27')](_0x3364a3,_0x525b('0x24'));_0xbb36d6[_0x525b('0x2c')]=_[_0x525b('0x2d')](_0x126477[_0x525b('0x2c')]);_0xbb36d6['filters']=_[_0x525b('0x2e')](_0xbb36d6[_0x525b('0x2b')],_0xbb36d6[_0x525b('0x2c')]);_0x51167a[_0x525b('0x2f')]=_[_0x525b('0x2e')](_0xbb36d6[_0x525b('0x2b')],qs[_0x525b('0x30')](_0x126477[_0x525b('0x2c')][_0x525b('0x30')]));_0x51167a['attributes']=_0x51167a['attributes'][_0x525b('0x31')]?_0x51167a['attributes']:_0xbb36d6['model'];if(!_0x126477[_0x525b('0x2c')]['hasOwnProperty']('nolimit')){_0x51167a['limit']=qs[_0x525b('0x32')](_0x126477[_0x525b('0x2c')][_0x525b('0x32')]);_0x51167a[_0x525b('0x1a')]=qs['offset'](_0x126477[_0x525b('0x2c')][_0x525b('0x1a')]);}_0x51167a[_0x525b('0x33')]=qs[_0x525b('0x34')](_0x126477[_0x525b('0x2c')][_0x525b('0x34')]);_0x51167a[_0x525b('0x35')]=qs[_0x525b('0x36')](_[_0x525b('0x37')](_0x126477[_0x525b('0x2c')],_0xbb36d6[_0x525b('0x36')]),_0x3364a3);if(_0x126477[_0x525b('0x2c')][_0x525b('0x38')]){_0x51167a[_0x525b('0x35')]=_[_0x525b('0x39')](_0x51167a['where'],{'$or':_['map'](_0x3364a3,function(_0x38904f){if(_0x38904f[_0x525b('0x2a')]!==_0x525b('0x3a')){var _0x2d531b={};_0x2d531b[_0x38904f[_0x525b('0x24')]]={'$like':'%'+_0x126477['query'][_0x525b('0x38')]+'%'};return _0x2d531b;}})});}_0x51167a=_[_0x525b('0x39')]({},_0x51167a,_0x126477[_0x525b('0x3b')]);var _0x263901={'where':_0x51167a[_0x525b('0x35')]};return db[_0x525b('0x28')][_0x525b('0x1c')](_0x263901)[_0x525b('0x21')](function(_0x40d96a){_0x3b2029[_0x525b('0x1c')]=_0x40d96a;if(_0x126477[_0x525b('0x2c')]['includeAll']){_0x51167a['include']=[{'all':!![]}];}return db[_0x525b('0x28')]['findAll'](_0x51167a);})[_0x525b('0x21')](function(_0x492022){_0x3b2029['rows']=_0x492022;return _0x3b2029;})[_0x525b('0x21')](respondWithFilteredResult(_0x480645,_0x51167a))[_0x525b('0x3c')](handleError(_0x480645,null));};exports[_0x525b('0x3d')]=function(_0x1decb0,_0x5e7607){var _0x111d74={'raw':![],'where':{'id':_0x1decb0[_0x525b('0x3e')]['id']}},_0x9f6f78={};_0x9f6f78[_0x525b('0x2b')]=_[_0x525b('0x2d')](db[_0x525b('0x28')][_0x525b('0x3f')]);_0x9f6f78['query']=_[_0x525b('0x2d')](_0x1decb0['query']);_0x9f6f78[_0x525b('0x36')]=_[_0x525b('0x2e')](_0x9f6f78[_0x525b('0x2b')],_0x9f6f78[_0x525b('0x2c')]);_0x111d74['attributes']=_['intersection'](_0x9f6f78[_0x525b('0x2b')],qs[_0x525b('0x30')](_0x1decb0['query'][_0x525b('0x30')]));_0x111d74[_0x525b('0x2f')]=_0x111d74[_0x525b('0x2f')][_0x525b('0x31')]?_0x111d74[_0x525b('0x2f')]:_0x9f6f78[_0x525b('0x2b')];if(_0x1decb0['query'][_0x525b('0x40')]){_0x111d74[_0x525b('0x41')]=[{'all':!![]}];}_0x111d74=_[_0x525b('0x39')]({},_0x111d74,_0x1decb0['options']);return db[_0x525b('0x28')][_0x525b('0x42')](_0x111d74)[_0x525b('0x21')](handleEntityNotFound(_0x5e7607,null))[_0x525b('0x21')](respondWithResult(_0x5e7607,null))['catch'](handleError(_0x5e7607,null));};exports['create']=function(_0x704a87,_0x5bc30a){return db[_0x525b('0x28')]['create'](_0x704a87[_0x525b('0x43')],{})['then'](respondWithResult(_0x5bc30a,0xc9))[_0x525b('0x3c')](handleError(_0x5bc30a,null));};exports[_0x525b('0x44')]=function(_0x159d04,_0x21de91){if(_0x159d04[_0x525b('0x43')]['id']){delete _0x159d04['body']['id'];}return db[_0x525b('0x28')][_0x525b('0x42')]({'where':{'id':_0x159d04['params']['id']}})[_0x525b('0x21')](handleEntityNotFound(_0x21de91,null))[_0x525b('0x21')](saveUpdates(_0x159d04[_0x525b('0x43')],null))[_0x525b('0x21')](respondWithResult(_0x21de91,null))[_0x525b('0x3c')](handleError(_0x21de91,null));};exports[_0x525b('0x22')]=function(_0x3eb8c2,_0x3e87a5){return db[_0x525b('0x28')][_0x525b('0x42')]({'where':{'id':_0x3eb8c2[_0x525b('0x3e')]['id']}})[_0x525b('0x21')](handleEntityNotFound(_0x3e87a5,null))[_0x525b('0x21')](removeEntity(_0x3e87a5,null))[_0x525b('0x3c')](handleError(_0x3e87a5,null));};exports[_0x525b('0x45')]=function(_0x4eecf3,_0x58f5e1,_0x88c271){var _0x1c6d4a={};var _0x58264c={};var _0xb08ba9;var _0x482372;return db[_0x525b('0x28')][_0x525b('0x46')]({'where':{'id':_0x4eecf3[_0x525b('0x3e')]['id']}})[_0x525b('0x21')](handleEntityNotFound(_0x58f5e1,null))['then'](function(_0x1ac3ea){if(_0x1ac3ea){_0xb08ba9=_0x1ac3ea;_0x58264c[_0x525b('0x2b')]=_['keys'](db[_0x525b('0x47')][_0x525b('0x3f')]);_0x58264c['query']=_[_0x525b('0x2d')](_0x4eecf3[_0x525b('0x2c')]);_0x58264c['filters']=_[_0x525b('0x2e')](_0x58264c[_0x525b('0x2b')],_0x58264c[_0x525b('0x2c')]);_0x1c6d4a[_0x525b('0x2f')]=_[_0x525b('0x2e')](_0x58264c[_0x525b('0x2b')],qs[_0x525b('0x30')](_0x4eecf3[_0x525b('0x2c')][_0x525b('0x30')]));_0x1c6d4a[_0x525b('0x2f')]=_0x1c6d4a[_0x525b('0x2f')][_0x525b('0x31')]?_0x1c6d4a[_0x525b('0x2f')]:_0x58264c['model'];_0x1c6d4a[_0x525b('0x33')]=qs[_0x525b('0x34')](_0x4eecf3[_0x525b('0x2c')][_0x525b('0x34')]);_0x1c6d4a['where']=qs[_0x525b('0x36')](_[_0x525b('0x37')](_0x4eecf3[_0x525b('0x2c')],_0x58264c[_0x525b('0x36')]));if(_0x4eecf3[_0x525b('0x2c')][_0x525b('0x38')]){_0x1c6d4a['where']=_[_0x525b('0x39')](_0x1c6d4a[_0x525b('0x35')],{'$or':_[_0x525b('0x27')](_0x1c6d4a[_0x525b('0x2f')],function(_0x50e133){var _0x1953db={};_0x1953db[_0x50e133]={'$like':'%'+_0x4eecf3['query']['filter']+'%'};return _0x1953db;})});}_0x1c6d4a=_['merge']({},_0x1c6d4a,_0x4eecf3['options']);return _0xb08ba9[_0x525b('0x45')](_0x1c6d4a);}})[_0x525b('0x21')](function(_0x35ea54){if(_0x35ea54){_0x482372=_0x35ea54[_0x525b('0x31')];if(!_0x4eecf3['query'][_0x525b('0x48')](_0x525b('0x49'))){_0x1c6d4a[_0x525b('0x32')]=qs[_0x525b('0x32')](_0x4eecf3['query']['limit']);_0x1c6d4a[_0x525b('0x1a')]=qs['offset'](_0x4eecf3[_0x525b('0x2c')]['offset']);}return _0xb08ba9[_0x525b('0x45')](_0x1c6d4a);}})[_0x525b('0x21')](function(_0x49a92f){if(_0x49a92f){return _0x49a92f?{'count':_0x482372,'rows':_0x49a92f}:null;}})[_0x525b('0x21')](respondWithResult(_0x58f5e1,null))[_0x525b('0x3c')](handleError(_0x58f5e1,null));};exports[_0x525b('0x4a')]=function(_0x251fc8,_0x291e18,_0x4a929d){if(_0x251fc8['body']['id']){delete _0x251fc8[_0x525b('0x43')]['id'];}return db[_0x525b('0x28')][_0x525b('0x46')]({'where':{'id':_0x251fc8[_0x525b('0x3e')]['id']}})[_0x525b('0x21')](handleEntityNotFound(_0x291e18,null))[_0x525b('0x21')](function(_0x5cce45){if(_0x5cce45){_0x251fc8[_0x525b('0x43')][_0x525b('0x4b')]=_0x5cce45['id'];_0x251fc8[_0x525b('0x43')][_0x525b('0x4c')]=integrations['getSubjects'](_0x251fc8['body']['channel'],_0x251fc8['body'][_0x525b('0x2a')]);_0x251fc8[_0x525b('0x43')][_0x525b('0x4d')]=integrations[_0x525b('0x4e')](_0x251fc8[_0x525b('0x43')]['channel'],_0x251fc8['body'][_0x525b('0x2a')]);return db[_0x525b('0x47')][_0x525b('0x4f')](_0x251fc8[_0x525b('0x43')],{'include':[{'model':db[_0x525b('0x50')],'as':_0x525b('0x4c')},{'model':db[_0x525b('0x50')],'as':_0x525b('0x4d')}]});}return null;})['then'](respondWithResult(_0x291e18,null))[_0x525b('0x3c')](handleError(_0x291e18,null));};exports[_0x525b('0x51')]=function(_0x67553a,_0x54cff6,_0x5459a1){var _0x4d51cb=_0x67553a[_0x525b('0x2c')][_0x525b('0x52')];var _0x1ef039=_0x4d51cb==='incident'?_0x525b('0x53'):'PhoneCall';var _0x50e5c1='';var _0x14f909='';var _0x1dd756='';var _0x430b00='';var _0x44fc75='';var _0x30281f='';var _0x364686='';var _0x50c496='';var _0x21064c=['title',_0x525b('0x54'),'customerid','ownerid',_0x525b('0x55'),_0x525b('0x56'),_0x525b('0x57'),_0x525b('0x58'),_0x525b('0x59'),'phonecall_activity_parties'];var _0xab9f5=[_0x525b('0x5a'),_0x525b('0x5b'),_0x525b('0x5c'),_0x525b('0x5d'),'contactidname','contactidyominame',_0x525b('0x5e'),_0x525b('0x5f'),_0x525b('0x60'),'createdbyexternalpartyyominame',_0x525b('0x61'),_0x525b('0x62'),_0x525b('0x63'),_0x525b('0x64'),_0x525b('0x65'),_0x525b('0x66'),_0x525b('0x67'),_0x525b('0x68'),_0x525b('0x69'),_0x525b('0x6a'),_0x525b('0x6b'),_0x525b('0x6c'),_0x525b('0x6d'),_0x525b('0x6e'),'firstresponsebykpiidname',_0x525b('0x6f'),_0x525b('0x70'),_0x525b('0x71'),'kbarticleidname','lastonholdtime','masteridname',_0x525b('0x72'),'modifiedbyexternalpartyyominame',_0x525b('0x73'),_0x525b('0x74'),_0x525b('0x75'),_0x525b('0x76'),_0x525b('0x77'),_0x525b('0x78'),_0x525b('0x79'),'numberofchildincidents',_0x525b('0x7a'),_0x525b('0x7b'),_0x525b('0x7c'),_0x525b('0x7d'),_0x525b('0x7e'),_0x525b('0x7f'),'primarycontactidname',_0x525b('0x80'),_0x525b('0x81'),'productidname',_0x525b('0x82'),_0x525b('0x83'),_0x525b('0x84'),_0x525b('0x85'),_0x525b('0x86'),_0x525b('0x87'),_0x525b('0x88'),_0x525b('0x89'),_0x525b('0x8a'),_0x525b('0x8b'),_0x525b('0x8c'),_0x525b('0x8d'),_0x525b('0x8e'),_0x525b('0x8f'),_0x525b('0x90'),'transactioncurrencyidname','traversedpath',_0x525b('0x91'),_0x525b('0x92')];var _0x3d902e=_0x21064c['concat'](_0xab9f5);return db[_0x525b('0x28')][_0x525b('0x46')]({'where':{'id':_0x67553a[_0x525b('0x3e')]['id']},'attributes':['id','username',_0x525b('0x93'),'remoteUri',_0x525b('0x94'),'clientId',_0x525b('0x95')]})[_0x525b('0x21')](handleEntityNotFound(_0x54cff6,null))[_0x525b('0x21')](function(_0x5caf97){if(_0x5caf97){_0x50c496=_0x5caf97['remoteUri'];var _0x1ffae1=_0x50c496['slice'](-0x1);if(_0x1ffae1==='/'){_0x50c496=_0x50c496[_0x525b('0x96')](0x0,_0x50c496[_0x525b('0x97')](_0x1ffae1));}_0x364686=util[_0x525b('0x98')](_0x525b('0x99'),_0x50c496);var _0xe5971a={'method':_0x525b('0x9a'),'uri':_0x525b('0x9b')+_0x5caf97[_0x525b('0x94')]+_0x525b('0x9c'),'form':{'client_id':_0x5caf97['clientId'],'resource':_0x50c496,'username':_0x5caf97[_0x525b('0x9d')],'password':_0x5caf97[_0x525b('0x93')],'grant_type':_0x525b('0x93'),'client_secret':_0x5caf97[_0x525b('0x95')]},'json':!![]};return rp(_0xe5971a);}})['then'](function(_0x1f31f8){_0x30281f=_0x1f31f8[_0x525b('0x9e')];var _0x4ac340={'method':_0x525b('0x9f'),'uri':encodeURI(_0x364686+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1ef039+'\x27'),'headers':{'Authorization':_0x525b('0xa0')+_0x30281f,'If-None-Match':null,'OData-Version':_0x525b('0xa1')},'json':!![]};return rp(_0x4ac340);})[_0x525b('0x21')](function(_0x233e04){var _0x57a84b=_0x233e04[_0x525b('0xa2')][0x0];var _0x22cb5f=_0x57a84b[_0x525b('0xa3')];var _0x21ec98={'method':_0x525b('0x9f'),'uri':_0x364686+_0x525b('0xa4')+_0x22cb5f+_0x525b('0xa5'),'headers':{'Authorization':_0x525b('0xa0')+_0x30281f,'If-None-Match':null,'OData-Version':_0x525b('0xa1')},'json':!![]};return rp(_0x21ec98);})[_0x525b('0x21')](function(_0x43a52f){_0x50e5c1=_0x43a52f;_0x14f909=_0x50e5c1[_0x525b('0xa6')];_0x14f909=_[_0x525b('0xa7')](_0x14f909,function(_0x3802c6){return!_0x3d902e[_0x525b('0xa8')](_0x3802c6[_0x525b('0xa9')]);});var _0x238423=[];var _0x1b0f3a=[];_0x14f909[_0x525b('0xaa')](function(_0x4e8688){if(_0x4e8688['@odata.type']){var _0x46b32c=_0x4e8688['@odata.type'][_0x525b('0x96')](_0x4e8688['@odata.type'][_0x525b('0x97')]('.')+0x1);if(_0x46b32c===_0x525b('0xab')){_0x238423[_0x525b('0xac')](getSelectList(_0x364686,_0x4d51cb,_0x1b0f3a,_0x50e5c1[_0x525b('0xa3')],_0x4e8688[_0x525b('0xa3')],_0x30281f));}}});return Promise[_0x525b('0xad')](_0x238423);})[_0x525b('0x21')](function(_0x4a092c){_0x1dd756=_0x4a092c[0x0];var _0x39cc15=[];var _0x3d96a2=[];_0x14f909[_0x525b('0xaa')](function(_0x244423){if(!_['isNil'](_0x244423[_0x525b('0xae')])){var _0x2f1bb4=_0x244423[_0x525b('0xae')][_0x525b('0x96')](_0x244423[_0x525b('0xae')][_0x525b('0x97')]('.')+0x1);if(_0x2f1bb4===_0x525b('0xaf')){_0x39cc15[_0x525b('0xac')](getBooleanList(_0x364686,_0x4d51cb,_0x3d96a2,_0x50e5c1[_0x525b('0xa3')],_0x244423[_0x525b('0xa3')],_0x30281f));}}});return Promise[_0x525b('0xad')](_0x39cc15);})['then'](function(_0x4d21f4){_0x430b00=_0x4d21f4[0x0];var _0x33f455=[];var _0x1c6860=[];_0x14f909[_0x525b('0xaa')](function(_0x133916){if(_0x133916[_0x525b('0xae')]){var _0x8e7e37=_0x133916[_0x525b('0xae')]['substring'](_0x133916['@odata.type'][_0x525b('0x97')]('.')+0x1);if(_0x8e7e37===_0x525b('0xb0')||_0x8e7e37===_0x525b('0xb1')||_0x8e7e37===_0x525b('0xb2')||_0x8e7e37===_0x525b('0xb3')||_0x8e7e37===_0x525b('0xb4')||_0x8e7e37===_0x525b('0xb5')||_0x8e7e37===_0x525b('0xb6')||_0x8e7e37==='EntityNameAttributeMetadata'||_0x8e7e37===_0x525b('0xb7')||_0x8e7e37===_0x525b('0xb8')){_0x33f455[_0x525b('0xac')](getInputList(_0x364686,_0x4d51cb,_0x8e7e37,_0x1c6860,_0x50e5c1[_0x525b('0xa3')],_0x133916[_0x525b('0xa3')],_0x30281f));}}});return Promise[_0x525b('0xad')](_0x33f455);})[_0x525b('0x21')](function(_0x295008){_0x44fc75=_0x295008[0x0];var _0xc9b6ce=_0x1dd756[_0x525b('0xb9')](_0x430b00)[_0x525b('0xb9')](_0x44fc75);var _0x399cf1={'count':_0xc9b6ce[_0x525b('0x31')],'rows':_0xc9b6ce};return _0x399cf1;})['then'](respondWithResult(_0x54cff6,null))[_0x525b('0x3c')](function(_0x4237c1){var _0xc869ed=_0x67553a[_0x525b('0x2c')][_0x525b('0xba')]?0x1f4:_0x4237c1[_0x525b('0xbb')]||0x1f4;logger[_0x525b('0x23')](_0x4237c1['stack']);delete _0x4237c1[_0x525b('0x24')];if(_0xc869ed===0x191){_0xc869ed=0x190;}_0x54cff6[_0x525b('0x17')](_0xc869ed)[_0x525b('0x25')](_0x67553a[_0x525b('0x2c')][_0x525b('0xba')]?{'message':'Wrong\x20credentials','statusCode':_0x4237c1[_0x525b('0xbb')]}:_0x4237c1);});};function getSelectList(_0x4111c1,_0x27c4f8,_0x1026cc,_0x3b8983,_0x466a9b,_0x1f8ad9){var _0x92a3fc={'method':_0x525b('0x9f'),'uri':_0x4111c1+_0x525b('0xa4')+_0x3b8983+_0x525b('0xbc')+_0x466a9b+_0x525b('0xbd')+_0x525b('0xbe'),'headers':{'Authorization':'Bearer\x20'+_0x1f8ad9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x92a3fc)['then'](function(_0x29c9b6){var _0x19853c=[];var _0x16b732=_0x29c9b6[_0x525b('0xbf')][_0x525b('0xc0')];_0x16b732[_0x525b('0xaa')](function(_0x1796a1){_0x19853c[_0x525b('0xac')]({'name':_0x1796a1[_0x525b('0xc1')][_0x525b('0xc2')][_0x525b('0xc1')],'value':String(_0x1796a1[_0x525b('0xc3')])});});var _0x47fe12={'id':_0x27c4f8+'_'+_0x29c9b6[_0x525b('0xa9')],'name':_0x29c9b6[_0x525b('0xc4')][_0x525b('0xc2')]['Label'],'custom':![],'options':_0x19853c};_0x1026cc[_0x525b('0xac')](_0x47fe12);return _0x1026cc;});}function getBooleanList(_0x17d351,_0x2bc0e6,_0x130eae,_0x1d6257,_0x4d3d7e,_0x446d4b){var _0xcd9f55={'method':_0x525b('0x9f'),'uri':_0x17d351+_0x525b('0xa4')+_0x1d6257+_0x525b('0xbc')+_0x4d3d7e+_0x525b('0xc5'),'headers':{'Authorization':_0x525b('0xa0')+_0x446d4b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xcd9f55)['then'](function(_0x2d5148){var _0x30cd46=[];_0x30cd46[_0x525b('0xac')]({'name':_0x2d5148[_0x525b('0xbf')][_0x525b('0xc6')][_0x525b('0xc1')][_0x525b('0xc2')][_0x525b('0xc1')],'value':'true'},{'name':_0x2d5148[_0x525b('0xbf')][_0x525b('0xc7')][_0x525b('0xc1')]['UserLocalizedLabel'][_0x525b('0xc1')],'value':_0x525b('0xc8')});var _0x2863e8={'id':_0x2bc0e6+'_'+_0x2d5148['LogicalName'],'name':_0x2d5148[_0x525b('0xc4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x30cd46};_0x130eae[_0x525b('0xac')](_0x2863e8);return _0x130eae;});}function getInputList(_0x3d46b5,_0x5af37e,_0x5b5d9e,_0x28ae3a,_0x40dd0d,_0x207f5a,_0x4826a9){var _0xcfaa60={'method':'GET','uri':_0x3d46b5+_0x525b('0xa4')+_0x40dd0d+_0x525b('0xbc')+_0x207f5a+_0x525b('0xc9')+_0x5b5d9e+_0x525b('0xca'),'headers':{'Authorization':_0x525b('0xa0')+_0x4826a9,'If-None-Match':null,'OData-Version':_0x525b('0xa1')},'json':!![]};return rp(_0xcfaa60)[_0x525b('0x21')](function(_0x4572da){var _0x1d969e={'id':_0x5af37e+'_'+_0x4572da[_0x525b('0xa9')],'name':_0x4572da[_0x525b('0xc4')][_0x525b('0xc2')]?_0x4572da[_0x525b('0xc4')]['UserLocalizedLabel'][_0x525b('0xc1')]:_0x4572da[_0x525b('0xa9')],'custom':![],'options':[]};_0x28ae3a[_0x525b('0xac')](_0x1d969e);return _0x28ae3a;});} \ No newline at end of file +var _0xbc17=['TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','Subjects','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','remoteUri','tenantId','clientSecret','slice','substring','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientId','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','concat','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet'];(function(_0x354e9d,_0x297682){var _0x56711d=function(_0x6ae780){while(--_0x6ae780){_0x354e9d['push'](_0x354e9d['shift']());}};_0x56711d(++_0x297682);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x123831,_0x8fe1d6){_0x123831=_0x123831-0x0;var _0x47455b=_0xbc17[_0x123831];return _0x47455b;};'use strict';var emlformat=require(_0x7bc1('0x0'));var rimraf=require(_0x7bc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bc1('0x2'));var rp=require(_0x7bc1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7bc1('0x4'));var util=require(_0x7bc1('0x5'));var path=require('path');var sox=require(_0x7bc1('0x6'));var csv=require('to-csv');var ejs=require(_0x7bc1('0x7'));var fs=require('fs');var fs_extra=require(_0x7bc1('0x8'));var _=require(_0x7bc1('0x9'));var squel=require(_0x7bc1('0xa'));var crypto=require(_0x7bc1('0xb'));var jsforce=require(_0x7bc1('0xc'));var deskjs=require(_0x7bc1('0xd'));var toCsv=require(_0x7bc1('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7bc1('0xf'));var authService=require(_0x7bc1('0x10'));var qs=require(_0x7bc1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bc1('0x12'));var logger=require(_0x7bc1('0x13'))(_0x7bc1('0x14'));var utils=require(_0x7bc1('0x15'));var config=require(_0x7bc1('0x16'));var licenseUtil=require(_0x7bc1('0x17'));var db=require(_0x7bc1('0x18'))['db'];var integrations=require(_0x7bc1('0x19'));function respondWithStatusCode(_0x604f31,_0x54db30){_0x54db30=_0x54db30||0xcc;return function(_0x1297a6){if(_0x1297a6){return _0x604f31[_0x7bc1('0x1a')](_0x54db30);}return _0x604f31['status'](_0x54db30)[_0x7bc1('0x1b')]();};}function respondWithResult(_0x370c8b,_0x4bb73b){_0x4bb73b=_0x4bb73b||0xc8;return function(_0xe90437){if(_0xe90437){return _0x370c8b[_0x7bc1('0x1c')](_0x4bb73b)['json'](_0xe90437);}};}function respondWithFilteredResult(_0x10f5a9,_0x26c89e){return function(_0x1eaf32){if(_0x1eaf32){var _0x3aadaf=typeof _0x26c89e[_0x7bc1('0x1d')]==='undefined'&&typeof _0x26c89e[_0x7bc1('0x1e')]==='undefined';var _0x15b118=_0x1eaf32[_0x7bc1('0x1f')];var _0xdf994=_0x3aadaf?0x0:_0x26c89e[_0x7bc1('0x1d')];var _0x20ce32=_0x3aadaf?_0x1eaf32[_0x7bc1('0x1f')]:_0x26c89e[_0x7bc1('0x1d')]+_0x26c89e[_0x7bc1('0x1e')];var _0x4e49d0;if(_0x20ce32>=_0x15b118){_0x20ce32=_0x15b118;_0x4e49d0=0xc8;}else{_0x4e49d0=0xce;}_0x10f5a9[_0x7bc1('0x1c')](_0x4e49d0);return _0x10f5a9[_0x7bc1('0x20')](_0x7bc1('0x21'),_0xdf994+'-'+_0x20ce32+'/'+_0x15b118)[_0x7bc1('0x22')](_0x1eaf32);}return null;};}function patchUpdates(_0x1d6674){return function(_0x4a0b93){try{jsonpatch[_0x7bc1('0x23')](_0x4a0b93,_0x1d6674,!![]);}catch(_0x5b63f8){return BPromise[_0x7bc1('0x24')](_0x5b63f8);}return _0x4a0b93[_0x7bc1('0x25')]();};}function saveUpdates(_0x3136aa,_0x162efe){return function(_0x24bb15){if(_0x24bb15){return _0x24bb15['update'](_0x3136aa)['then'](function(_0xb8a427){return _0xb8a427;});}return null;};}function removeEntity(_0x306db7,_0x48b09e){return function(_0x4ef200){if(_0x4ef200){return _0x4ef200[_0x7bc1('0x26')]()[_0x7bc1('0x27')](function(){_0x306db7['status'](0xcc)[_0x7bc1('0x1b')]();});}};}function handleEntityNotFound(_0x12ec4b,_0x1e68c3){return function(_0x468d5b){if(!_0x468d5b){_0x12ec4b[_0x7bc1('0x1a')](0x194);}return _0x468d5b;};}function handleError(_0x2c8a0d,_0x25d3a9){_0x25d3a9=_0x25d3a9||0x1f4;return function(_0x35ae7a){logger[_0x7bc1('0x28')](_0x35ae7a[_0x7bc1('0x29')]);if(_0x35ae7a[_0x7bc1('0x2a')]){delete _0x35ae7a[_0x7bc1('0x2a')];}_0x2c8a0d[_0x7bc1('0x1c')](_0x25d3a9)[_0x7bc1('0x2b')](_0x35ae7a);};}exports['index']=function(_0x1927ce,_0xc2cd8b){var _0x26bf05={},_0xc4f3ab={},_0x6614c={'count':0x0,'rows':[]};var _0x101c38=_[_0x7bc1('0x2c')](db[_0x7bc1('0x2d')][_0x7bc1('0x2e')],function(_0x1352c2){return{'name':_0x1352c2[_0x7bc1('0x2f')],'type':_0x1352c2[_0x7bc1('0x30')]['key']};});_0xc4f3ab[_0x7bc1('0x31')]=_[_0x7bc1('0x2c')](_0x101c38,_0x7bc1('0x2a'));_0xc4f3ab[_0x7bc1('0x32')]=_[_0x7bc1('0x33')](_0x1927ce[_0x7bc1('0x32')]);_0xc4f3ab[_0x7bc1('0x34')]=_['intersection'](_0xc4f3ab[_0x7bc1('0x31')],_0xc4f3ab[_0x7bc1('0x32')]);_0x26bf05[_0x7bc1('0x35')]=_[_0x7bc1('0x36')](_0xc4f3ab['model'],qs[_0x7bc1('0x37')](_0x1927ce[_0x7bc1('0x32')]['fields']));_0x26bf05[_0x7bc1('0x35')]=_0x26bf05['attributes']['length']?_0x26bf05[_0x7bc1('0x35')]:_0xc4f3ab[_0x7bc1('0x31')];if(!_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x38')](_0x7bc1('0x39'))){_0x26bf05['limit']=qs[_0x7bc1('0x1e')](_0x1927ce[_0x7bc1('0x32')]['limit']);_0x26bf05['offset']=qs[_0x7bc1('0x1d')](_0x1927ce['query'][_0x7bc1('0x1d')]);}_0x26bf05[_0x7bc1('0x3a')]=qs[_0x7bc1('0x3b')](_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x3b')]);_0x26bf05[_0x7bc1('0x3c')]=qs[_0x7bc1('0x34')](_[_0x7bc1('0x3d')](_0x1927ce[_0x7bc1('0x32')],_0xc4f3ab[_0x7bc1('0x34')]),_0x101c38);if(_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x3e')]){_0x26bf05[_0x7bc1('0x3c')]=_[_0x7bc1('0x3f')](_0x26bf05[_0x7bc1('0x3c')],{'$or':_[_0x7bc1('0x2c')](_0x101c38,function(_0x10fbc6){if(_0x10fbc6[_0x7bc1('0x30')]!==_0x7bc1('0x40')){var _0x5dbe0f={};_0x5dbe0f[_0x10fbc6[_0x7bc1('0x2a')]]={'$like':'%'+_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x3e')]+'%'};return _0x5dbe0f;}})});}_0x26bf05=_['merge']({},_0x26bf05,_0x1927ce['options']);var _0x1ece5f={'where':_0x26bf05['where']};return db['Dynamics365Account']['count'](_0x1ece5f)['then'](function(_0x13026c){_0x6614c[_0x7bc1('0x1f')]=_0x13026c;if(_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x41')]){_0x26bf05[_0x7bc1('0x42')]=[{'all':!![]}];}return db[_0x7bc1('0x2d')][_0x7bc1('0x43')](_0x26bf05);})['then'](function(_0x8aaf8c){_0x6614c[_0x7bc1('0x44')]=_0x8aaf8c;return _0x6614c;})[_0x7bc1('0x27')](respondWithFilteredResult(_0xc2cd8b,_0x26bf05))[_0x7bc1('0x45')](handleError(_0xc2cd8b,null));};exports[_0x7bc1('0x46')]=function(_0x14aff2,_0xc75850){var _0x2f1e76={'raw':![],'where':{'id':_0x14aff2['params']['id']}},_0x45d694={};_0x45d694[_0x7bc1('0x31')]=_[_0x7bc1('0x33')](db[_0x7bc1('0x2d')][_0x7bc1('0x2e')]);_0x45d694[_0x7bc1('0x32')]=_[_0x7bc1('0x33')](_0x14aff2[_0x7bc1('0x32')]);_0x45d694['filters']=_[_0x7bc1('0x36')](_0x45d694['model'],_0x45d694[_0x7bc1('0x32')]);_0x2f1e76['attributes']=_[_0x7bc1('0x36')](_0x45d694[_0x7bc1('0x31')],qs[_0x7bc1('0x37')](_0x14aff2[_0x7bc1('0x32')][_0x7bc1('0x37')]));_0x2f1e76['attributes']=_0x2f1e76[_0x7bc1('0x35')][_0x7bc1('0x47')]?_0x2f1e76[_0x7bc1('0x35')]:_0x45d694[_0x7bc1('0x31')];if(_0x14aff2[_0x7bc1('0x32')]['includeAll']){_0x2f1e76[_0x7bc1('0x42')]=[{'all':!![]}];}_0x2f1e76=_[_0x7bc1('0x3f')]({},_0x2f1e76,_0x14aff2['options']);return db[_0x7bc1('0x2d')][_0x7bc1('0x48')](_0x2f1e76)[_0x7bc1('0x27')](handleEntityNotFound(_0xc75850,null))['then'](respondWithResult(_0xc75850,null))[_0x7bc1('0x45')](handleError(_0xc75850,null));};exports[_0x7bc1('0x49')]=function(_0x4c34e7,_0x3464b2){return db['Dynamics365Account']['create'](_0x4c34e7[_0x7bc1('0x4a')],{})[_0x7bc1('0x27')](respondWithResult(_0x3464b2,0xc9))[_0x7bc1('0x45')](handleError(_0x3464b2,null));};exports[_0x7bc1('0x4b')]=function(_0x42680f,_0x4dd6fb){if(_0x42680f[_0x7bc1('0x4a')]['id']){delete _0x42680f[_0x7bc1('0x4a')]['id'];}return db[_0x7bc1('0x2d')][_0x7bc1('0x48')]({'where':{'id':_0x42680f[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4dd6fb,null))[_0x7bc1('0x27')](saveUpdates(_0x42680f['body'],null))[_0x7bc1('0x27')](respondWithResult(_0x4dd6fb,null))[_0x7bc1('0x45')](handleError(_0x4dd6fb,null));};exports[_0x7bc1('0x26')]=function(_0x40508e,_0x4f597f){return db[_0x7bc1('0x2d')][_0x7bc1('0x48')]({'where':{'id':_0x40508e[_0x7bc1('0x4c')]['id']}})[_0x7bc1('0x27')](handleEntityNotFound(_0x4f597f,null))[_0x7bc1('0x27')](removeEntity(_0x4f597f,null))['catch'](handleError(_0x4f597f,null));};exports[_0x7bc1('0x4d')]=function(_0x1808c9,_0x3c29fa,_0x5370b0){var _0x5c8006={};var _0x5ed489={};var _0xa228;var _0x2bb944;return db[_0x7bc1('0x2d')][_0x7bc1('0x4e')]({'where':{'id':_0x1808c9[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3c29fa,null))['then'](function(_0x389a27){if(_0x389a27){_0xa228=_0x389a27;_0x5ed489['model']=_[_0x7bc1('0x33')](db[_0x7bc1('0x4f')][_0x7bc1('0x2e')]);_0x5ed489[_0x7bc1('0x32')]=_[_0x7bc1('0x33')](_0x1808c9[_0x7bc1('0x32')]);_0x5ed489[_0x7bc1('0x34')]=_[_0x7bc1('0x36')](_0x5ed489[_0x7bc1('0x31')],_0x5ed489[_0x7bc1('0x32')]);_0x5c8006[_0x7bc1('0x35')]=_['intersection'](_0x5ed489[_0x7bc1('0x31')],qs[_0x7bc1('0x37')](_0x1808c9[_0x7bc1('0x32')][_0x7bc1('0x37')]));_0x5c8006[_0x7bc1('0x35')]=_0x5c8006[_0x7bc1('0x35')][_0x7bc1('0x47')]?_0x5c8006[_0x7bc1('0x35')]:_0x5ed489['model'];_0x5c8006[_0x7bc1('0x3a')]=qs[_0x7bc1('0x3b')](_0x1808c9[_0x7bc1('0x32')]['sort']);_0x5c8006['where']=qs[_0x7bc1('0x34')](_[_0x7bc1('0x3d')](_0x1808c9[_0x7bc1('0x32')],_0x5ed489['filters']));if(_0x1808c9[_0x7bc1('0x32')][_0x7bc1('0x3e')]){_0x5c8006['where']=_[_0x7bc1('0x3f')](_0x5c8006[_0x7bc1('0x3c')],{'$or':_['map'](_0x5c8006[_0x7bc1('0x35')],function(_0x3de640){var _0x527b89={};_0x527b89[_0x3de640]={'$like':'%'+_0x1808c9[_0x7bc1('0x32')]['filter']+'%'};return _0x527b89;})});}_0x5c8006=_[_0x7bc1('0x3f')]({},_0x5c8006,_0x1808c9['options']);return _0xa228['getConfigurations'](_0x5c8006);}})['then'](function(_0xb4a763){if(_0xb4a763){_0x2bb944=_0xb4a763[_0x7bc1('0x47')];if(!_0x1808c9[_0x7bc1('0x32')][_0x7bc1('0x38')]('nolimit')){_0x5c8006[_0x7bc1('0x1e')]=qs[_0x7bc1('0x1e')](_0x1808c9['query'][_0x7bc1('0x1e')]);_0x5c8006[_0x7bc1('0x1d')]=qs[_0x7bc1('0x1d')](_0x1808c9[_0x7bc1('0x32')][_0x7bc1('0x1d')]);}return _0xa228[_0x7bc1('0x4d')](_0x5c8006);}})[_0x7bc1('0x27')](function(_0x4338cb){if(_0x4338cb){return _0x4338cb?{'count':_0x2bb944,'rows':_0x4338cb}:null;}})['then'](respondWithResult(_0x3c29fa,null))[_0x7bc1('0x45')](handleError(_0x3c29fa,null));};exports[_0x7bc1('0x50')]=function(_0x502456,_0x14fb76,_0x2cd588){if(_0x502456[_0x7bc1('0x4a')]['id']){delete _0x502456['body']['id'];}return db['Dynamics365Account'][_0x7bc1('0x4e')]({'where':{'id':_0x502456[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14fb76,null))[_0x7bc1('0x27')](function(_0x418f06){if(_0x418f06){_0x502456[_0x7bc1('0x4a')][_0x7bc1('0x51')]=_0x418f06['id'];_0x502456['body']['Subjects']=integrations[_0x7bc1('0x52')](_0x502456[_0x7bc1('0x4a')]['channel'],_0x502456[_0x7bc1('0x4a')]['type']);_0x502456[_0x7bc1('0x4a')][_0x7bc1('0x53')]=integrations[_0x7bc1('0x54')](_0x502456[_0x7bc1('0x4a')][_0x7bc1('0x55')],_0x502456['body']['type']);return db[_0x7bc1('0x4f')][_0x7bc1('0x49')](_0x502456[_0x7bc1('0x4a')],{'include':[{'model':db[_0x7bc1('0x56')],'as':_0x7bc1('0x57')},{'model':db['Dynamics365Field'],'as':_0x7bc1('0x53')}]});}return null;})[_0x7bc1('0x27')](respondWithResult(_0x14fb76,null))[_0x7bc1('0x45')](handleError(_0x14fb76,null));};exports[_0x7bc1('0x58')]=function(_0x1a8c34,_0x45ceff,_0x520d05){var _0xee7d25=_0x1a8c34['query'][_0x7bc1('0x59')];var _0x580fb7=_0xee7d25===_0x7bc1('0x5a')?_0x7bc1('0x5b'):_0x7bc1('0x5c');var _0x387716='';var _0x587882='';var _0x1ec9c8='';var _0x42dacf='';var _0x31d837='';var _0x193e12='';var _0x447170='';var _0x257471='';var _0x1e0e19=[_0x7bc1('0x5d'),_0x7bc1('0x5e'),_0x7bc1('0x5f'),_0x7bc1('0x60'),_0x7bc1('0x61'),_0x7bc1('0x62'),'phonenumber',_0x7bc1('0x63'),_0x7bc1('0x64'),_0x7bc1('0x65')];var _0x12475a=[_0x7bc1('0x66'),_0x7bc1('0x67'),_0x7bc1('0x68'),_0x7bc1('0x69'),_0x7bc1('0x6a'),'contactidyominame',_0x7bc1('0x6b'),_0x7bc1('0x6c'),_0x7bc1('0x6d'),_0x7bc1('0x6e'),'createdbyname',_0x7bc1('0x6f'),_0x7bc1('0x70'),_0x7bc1('0x71'),_0x7bc1('0x72'),_0x7bc1('0x73'),'customeridtype',_0x7bc1('0x74'),'emailaddress',_0x7bc1('0x75'),_0x7bc1('0x76'),'entityimage_url',_0x7bc1('0x77'),'exchangerate',_0x7bc1('0x78'),'followupby',_0x7bc1('0x79'),_0x7bc1('0x7a'),_0x7bc1('0x7b'),'lastonholdtime','masteridname',_0x7bc1('0x7c'),_0x7bc1('0x7d'),_0x7bc1('0x7e'),_0x7bc1('0x7f'),_0x7bc1('0x80'),_0x7bc1('0x81'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x7bc1('0x82'),_0x7bc1('0x83'),_0x7bc1('0x84'),_0x7bc1('0x85'),_0x7bc1('0x86'),'owneridtype',_0x7bc1('0x87'),_0x7bc1('0x88'),_0x7bc1('0x89'),_0x7bc1('0x8a'),_0x7bc1('0x8b'),_0x7bc1('0x8c'),_0x7bc1('0x8d'),_0x7bc1('0x8e'),_0x7bc1('0x8f'),_0x7bc1('0x90'),_0x7bc1('0x91'),_0x7bc1('0x92'),'sentimentvalue',_0x7bc1('0x93'),_0x7bc1('0x94'),'socialprofileidname','statecode',_0x7bc1('0x95'),'subjectidname',_0x7bc1('0x96'),_0x7bc1('0x97'),_0x7bc1('0x98'),_0x7bc1('0x99'),_0x7bc1('0x9a'),_0x7bc1('0x9b')];var _0x22b51b=_0x1e0e19['concat'](_0x12475a);return db[_0x7bc1('0x2d')]['findOne']({'where':{'id':_0x1a8c34[_0x7bc1('0x4c')]['id']},'attributes':['id',_0x7bc1('0x9c'),'password',_0x7bc1('0x9d'),_0x7bc1('0x9e'),'clientId',_0x7bc1('0x9f')]})[_0x7bc1('0x27')](handleEntityNotFound(_0x45ceff,null))[_0x7bc1('0x27')](function(_0x534d15){if(_0x534d15){_0x257471=_0x534d15['remoteUri'];var _0x131f33=_0x257471[_0x7bc1('0xa0')](-0x1);if(_0x131f33==='/'){_0x257471=_0x257471[_0x7bc1('0xa1')](0x0,_0x257471['lastIndexOf'](_0x131f33));}_0x447170=util['format'](_0x7bc1('0xa2'),_0x257471);var _0x29a158={'method':_0x7bc1('0xa3'),'uri':_0x7bc1('0xa4')+_0x534d15[_0x7bc1('0x9e')]+'/oauth2/token','form':{'client_id':_0x534d15[_0x7bc1('0xa5')],'resource':_0x257471,'username':_0x534d15[_0x7bc1('0x9c')],'password':_0x534d15[_0x7bc1('0xa6')],'grant_type':'password','client_secret':_0x534d15[_0x7bc1('0x9f')]},'json':!![]};return rp(_0x29a158);}})[_0x7bc1('0x27')](function(_0x211da6){_0x193e12=_0x211da6[_0x7bc1('0xa7')];var _0x285bc1={'method':_0x7bc1('0xa8'),'uri':encodeURI(_0x447170+_0x7bc1('0xa9')+_0x580fb7+'\x27'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x193e12,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x285bc1);})['then'](function(_0x2bd1f9){var _0x4ab290=_0x2bd1f9[_0x7bc1('0xac')][0x0];var _0x5d27b1=_0x4ab290['MetadataId'];var _0x2895d2={'method':_0x7bc1('0xa8'),'uri':_0x447170+'EntityDefinitions('+_0x5d27b1+_0x7bc1('0xad'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x193e12,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x2895d2);})[_0x7bc1('0x27')](function(_0x34a332){_0x387716=_0x34a332;_0x587882=_0x387716[_0x7bc1('0xae')];_0x587882=_[_0x7bc1('0xaf')](_0x587882,function(_0xdae693){return!_0x22b51b[_0x7bc1('0xb0')](_0xdae693[_0x7bc1('0xb1')]);});var _0x2f44b4=[];var _0x287a38=[];_0x587882[_0x7bc1('0xb2')](function(_0xefc6d7){if(_0xefc6d7[_0x7bc1('0xb3')]){var _0x4cae1f=_0xefc6d7[_0x7bc1('0xb3')][_0x7bc1('0xa1')](_0xefc6d7['@odata.type']['lastIndexOf']('.')+0x1);if(_0x4cae1f===_0x7bc1('0xb4')){_0x2f44b4['push'](getSelectList(_0x447170,_0xee7d25,_0x287a38,_0x387716['MetadataId'],_0xefc6d7[_0x7bc1('0xb5')],_0x193e12));}}});return Promise['all'](_0x2f44b4);})['then'](function(_0x5a2b38){_0x1ec9c8=_0x5a2b38[0x0];var _0x458590=[];var _0x24a067=[];_0x587882['forEach'](function(_0x2d2dcc){if(!_[_0x7bc1('0xb6')](_0x2d2dcc[_0x7bc1('0xb3')])){var _0x215f95=_0x2d2dcc[_0x7bc1('0xb3')][_0x7bc1('0xa1')](_0x2d2dcc[_0x7bc1('0xb3')]['lastIndexOf']('.')+0x1);if(_0x215f95===_0x7bc1('0xb7')){_0x458590['push'](getBooleanList(_0x447170,_0xee7d25,_0x24a067,_0x387716['MetadataId'],_0x2d2dcc[_0x7bc1('0xb5')],_0x193e12));}}});return Promise[_0x7bc1('0xb8')](_0x458590);})['then'](function(_0x8b54ab){_0x42dacf=_0x8b54ab[0x0];var _0x533681=[];var _0x2a34eb=[];_0x587882[_0x7bc1('0xb2')](function(_0x3b6d93){if(_0x3b6d93['@odata.type']){var _0x250926=_0x3b6d93[_0x7bc1('0xb3')][_0x7bc1('0xa1')](_0x3b6d93['@odata.type']['lastIndexOf']('.')+0x1);if(_0x250926==='StringAttributeMetadata'||_0x250926===_0x7bc1('0xb9')||_0x250926==='BigIntAttributeMetadata'||_0x250926==='IntegerAttributeMetadata'||_0x250926===_0x7bc1('0xba')||_0x250926===_0x7bc1('0xbb')||_0x250926===_0x7bc1('0xbc')||_0x250926===_0x7bc1('0xbd')||_0x250926===_0x7bc1('0xbe')||_0x250926===_0x7bc1('0xbf')){_0x533681[_0x7bc1('0xc0')](getInputList(_0x447170,_0xee7d25,_0x250926,_0x2a34eb,_0x387716[_0x7bc1('0xb5')],_0x3b6d93[_0x7bc1('0xb5')],_0x193e12));}}});return Promise[_0x7bc1('0xb8')](_0x533681);})[_0x7bc1('0x27')](function(_0x9bc85f){_0x31d837=_0x9bc85f[0x0];var _0x1a230b=_0x1ec9c8[_0x7bc1('0xc1')](_0x42dacf)['concat'](_0x31d837);var _0x3689bc={'count':_0x1a230b[_0x7bc1('0x47')],'rows':_0x1a230b};return _0x3689bc;})['then'](respondWithResult(_0x45ceff,null))['catch'](function(_0x2aefd0){var _0x4cd654=_0x1a8c34[_0x7bc1('0x32')][_0x7bc1('0xc2')]?0x1f4:_0x2aefd0['statusCode']||0x1f4;logger[_0x7bc1('0x28')](_0x2aefd0['stack']);delete _0x2aefd0[_0x7bc1('0x2a')];if(_0x4cd654===0x191){_0x4cd654=0x190;}_0x45ceff[_0x7bc1('0x1c')](_0x4cd654)['send'](_0x1a8c34['query'][_0x7bc1('0xc2')]?{'message':'Wrong\x20credentials','statusCode':_0x2aefd0[_0x7bc1('0xc3')]}:_0x2aefd0);});};function getSelectList(_0x472414,_0x2cfb03,_0x4c268e,_0x22e2b8,_0x584b9a,_0x16f198){var _0x45c964={'method':_0x7bc1('0xa8'),'uri':_0x472414+_0x7bc1('0xc4')+_0x22e2b8+_0x7bc1('0xc5')+_0x584b9a+_0x7bc1('0xc6')+_0x7bc1('0xc7'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x16f198,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x45c964)[_0x7bc1('0x27')](function(_0xa82558){var _0x1f48de=[];var _0x4b11c8=_0xa82558['OptionSet'][_0x7bc1('0xc8')];_0x4b11c8[_0x7bc1('0xb2')](function(_0x479e11){_0x1f48de[_0x7bc1('0xc0')]({'name':_0x479e11['Label'][_0x7bc1('0xc9')][_0x7bc1('0xca')],'value':String(_0x479e11['Value'])});});var _0x17371b={'id':_0x2cfb03+'_'+_0xa82558[_0x7bc1('0xb1')],'name':_0xa82558[_0x7bc1('0xcb')]['UserLocalizedLabel'][_0x7bc1('0xca')],'custom':![],'options':_0x1f48de};_0x4c268e['push'](_0x17371b);return _0x4c268e;});}function getBooleanList(_0x46735f,_0x505eca,_0x192557,_0x42a62e,_0x23e55c,_0x598279){var _0x377856={'method':_0x7bc1('0xa8'),'uri':_0x46735f+_0x7bc1('0xc4')+_0x42a62e+_0x7bc1('0xc5')+_0x23e55c+_0x7bc1('0xcc'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x598279,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x377856)['then'](function(_0x5730a0){var _0x58f1f8=[];_0x58f1f8[_0x7bc1('0xc0')]({'name':_0x5730a0[_0x7bc1('0xcd')][_0x7bc1('0xce')][_0x7bc1('0xca')][_0x7bc1('0xc9')][_0x7bc1('0xca')],'value':'true'},{'name':_0x5730a0[_0x7bc1('0xcd')][_0x7bc1('0xcf')][_0x7bc1('0xca')][_0x7bc1('0xc9')][_0x7bc1('0xca')],'value':_0x7bc1('0xd0')});var _0x3fb92b={'id':_0x505eca+'_'+_0x5730a0[_0x7bc1('0xb1')],'name':_0x5730a0['DisplayName']['UserLocalizedLabel'][_0x7bc1('0xca')],'custom':![],'options':_0x58f1f8};_0x192557[_0x7bc1('0xc0')](_0x3fb92b);return _0x192557;});}function getInputList(_0x4c8449,_0x48e675,_0x3c192f,_0x4fa56a,_0xc0bb50,_0x3883d4,_0x53730d){var _0x42760c={'method':'GET','uri':_0x4c8449+_0x7bc1('0xc4')+_0xc0bb50+_0x7bc1('0xc5')+_0x3883d4+_0x7bc1('0xd1')+_0x3c192f+_0x7bc1('0xd2'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x53730d,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x42760c)[_0x7bc1('0x27')](function(_0x4ce8d4){var _0x31f722={'id':_0x48e675+'_'+_0x4ce8d4['LogicalName'],'name':_0x4ce8d4[_0x7bc1('0xcb')][_0x7bc1('0xc9')]?_0x4ce8d4[_0x7bc1('0xcb')][_0x7bc1('0xc9')][_0x7bc1('0xca')]:_0x4ce8d4[_0x7bc1('0xb1')],'custom':![],'options':[]};_0x4fa56a[_0x7bc1('0xc0')](_0x31f722);return _0x4fa56a;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 0a3125d..8ede4dd 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x304ba1,_0x1fe502){var _0x1471f1=function(_0x3beb39){while(--_0x3beb39){_0x304ba1['push'](_0x304ba1['shift']());}};_0x1471f1(++_0x1fe502);}(_0xe706,0xa3));var _0x6e70=function(_0x5c6046,_0x25dcd8){_0x5c6046=_0x5c6046-0x0;var _0x4c462d=_0xe706[_0x5c6046];return _0x4c462d;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x49053e,_0x25c375){var _0x52f4c8=function(_0x4fc3a5){while(--_0x4fc3a5){_0x49053e['push'](_0x49053e['shift']());}};_0x52f4c8(++_0x25c375);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb7e7[_0x1f9f37];return _0x21c080;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 224dd34..bdfd8a8 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 _0xa1ab=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','catch','ShowDynamics365Account','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1ef67e,_0x397551){var _0x5f243a=function(_0x3ade3e){while(--_0x3ade3e){_0x1ef67e['push'](_0x1ef67e['shift']());}};_0x5f243a(++_0x397551);}(_0xa1ab,0x110));var _0xba1a=function(_0x540705,_0x5078d2){_0x540705=_0x540705-0x0;var _0x97722a=_0xa1ab[_0x540705];return _0x97722a;};'use strict';var _=require(_0xba1a('0x0'));var util=require('util');var moment=require(_0xba1a('0x1'));var BPromise=require(_0xba1a('0x2'));var rs=require(_0xba1a('0x3'));var fs=require('fs');var Redis=require(_0xba1a('0x4'));var db=require(_0xba1a('0x5'))['db'];var utils=require(_0xba1a('0x6'));var logger=require(_0xba1a('0x7'))(_0xba1a('0x8'));var config=require(_0xba1a('0x9'));var jayson=require(_0xba1a('0xa'));var client=jayson[_0xba1a('0xb')][_0xba1a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x141725,_0x475b9c,_0x216563){return new BPromise(function(_0x239dc8,_0x440c29){return client['request'](_0x141725,_0x216563)[_0xba1a('0xd')](function(_0x160e9a){logger[_0xba1a('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x475b9c,_0xba1a('0xf'));logger[_0xba1a('0x10')](_0xba1a('0x11'),_0x475b9c,_0xba1a('0xf'),JSON[_0xba1a('0x12')](_0x160e9a));if(_0x160e9a[_0xba1a('0x13')]){if(_0x160e9a[_0xba1a('0x13')]['code']===0x1f4){logger[_0xba1a('0x13')](_0xba1a('0x14'),_0x475b9c,_0x160e9a[_0xba1a('0x13')][_0xba1a('0x15')]);return _0x440c29(_0x160e9a['error'][_0xba1a('0x15')]);}logger[_0xba1a('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x475b9c,_0x160e9a[_0xba1a('0x13')][_0xba1a('0x15')]);return _0x239dc8(_0x160e9a[_0xba1a('0x13')][_0xba1a('0x15')]);}else{logger['info'](_0xba1a('0x14'),_0x475b9c,_0xba1a('0xf'));_0x239dc8(_0x160e9a[_0xba1a('0x16')][_0xba1a('0x15')]);}})['catch'](function(_0x509043){logger[_0xba1a('0x13')](_0xba1a('0x14'),_0x475b9c,_0x509043);_0x440c29(_0x509043);});});}exports[_0xba1a('0x17')]=function(_0x42a698){var _0x56af1b=this;return new Promise(function(_0x13f448,_0x19ede0){return db[_0xba1a('0x18')][_0xba1a('0x19')]({'raw':_0x42a698[_0xba1a('0x1a')]?_0x42a698[_0xba1a('0x1a')][_0xba1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x42a698[_0xba1a('0x1a')]?_0x42a698[_0xba1a('0x1a')]['where']||null:null,'attributes':_0x42a698[_0xba1a('0x1a')]?_0x42a698['options'][_0xba1a('0x1c')]||null:null,'limit':_0x42a698['options']?_0x42a698[_0xba1a('0x1a')][_0xba1a('0x1d')]||null:null,'include':_0x42a698[_0xba1a('0x1a')]?_0x42a698[_0xba1a('0x1a')][_0xba1a('0x1e')]?_[_0xba1a('0x1f')](_0x42a698[_0xba1a('0x1a')][_0xba1a('0x1e')],function(_0x4c11c7){return{'model':db[_0x4c11c7[_0xba1a('0x20')]],'as':_0x4c11c7['as'],'attributes':_0x4c11c7['attributes'],'include':_0x4c11c7[_0xba1a('0x1e')]?_['map'](_0x4c11c7[_0xba1a('0x1e')],function(_0x43436d){return{'model':db[_0x43436d[_0xba1a('0x20')]],'as':_0x43436d['as'],'attributes':_0x43436d[_0xba1a('0x1c')],'include':_0x43436d[_0xba1a('0x1e')]?_[_0xba1a('0x1f')](_0x43436d[_0xba1a('0x1e')],function(_0x3c9222){return{'model':db[_0x3c9222['model']],'as':_0x3c9222['as'],'attributes':_0x3c9222[_0xba1a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xba1a('0xd')](function(_0x58467d){logger['info']('GetDynamics365Account',_0x42a698);logger['debug'](_0xba1a('0x17'),_0x42a698,JSON['stringify'](_0x58467d));_0x13f448(_0x58467d);})[_0xba1a('0x21')](function(_0x4f4ca8){logger['error']('GetDynamics365Account',_0x4f4ca8['message'],_0x42a698);_0x19ede0(_0x56af1b[_0xba1a('0x13')](0x1f4,_0x4f4ca8['message']));});});};exports[_0xba1a('0x22')]=function(_0x22e1d4){var _0x4fc93a=this;return new Promise(function(_0x587fd9,_0x362feb){return db[_0xba1a('0x18')]['find']({'raw':_0x22e1d4[_0xba1a('0x1a')]?_0x22e1d4['options'][_0xba1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x22e1d4['options']?_0x22e1d4[_0xba1a('0x1a')]['where']||null:null,'attributes':_0x22e1d4[_0xba1a('0x1a')]?_0x22e1d4['options'][_0xba1a('0x1c')]||null:null,'include':_0x22e1d4[_0xba1a('0x1a')]?_0x22e1d4[_0xba1a('0x1a')][_0xba1a('0x1e')]?_[_0xba1a('0x1f')](_0x22e1d4[_0xba1a('0x1a')][_0xba1a('0x1e')],function(_0x268a11){return{'model':db[_0x268a11['model']],'as':_0x268a11['as'],'attributes':_0x268a11[_0xba1a('0x1c')],'include':_0x268a11['include']?_[_0xba1a('0x1f')](_0x268a11[_0xba1a('0x1e')],function(_0x4ae047){return{'model':db[_0x4ae047[_0xba1a('0x20')]],'as':_0x4ae047['as'],'attributes':_0x4ae047[_0xba1a('0x1c')],'include':_0x4ae047[_0xba1a('0x1e')]?_[_0xba1a('0x1f')](_0x4ae047[_0xba1a('0x1e')],function(_0x5be5c9){return{'model':db[_0x5be5c9[_0xba1a('0x20')]],'as':_0x5be5c9['as'],'attributes':_0x5be5c9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e9808){logger[_0xba1a('0xe')]('ShowDynamics365Account',_0x22e1d4);logger[_0xba1a('0x10')](_0xba1a('0x22'),_0x22e1d4,JSON['stringify'](_0x2e9808));_0x587fd9(_0x2e9808);})[_0xba1a('0x21')](function(_0x17ccaf){logger[_0xba1a('0x13')](_0xba1a('0x22'),_0x17ccaf[_0xba1a('0x15')],_0x22e1d4);_0x362feb(_0x4fc93a[_0xba1a('0x13')](0x1f4,_0x17ccaf['message']));});});}; \ No newline at end of file +var _0xdfcc=['where','attributes','limit','map','include','model','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xdfcc,0x185));var _0xcdfc=function(_0x1e9e56,_0x34a74a){_0x1e9e56=_0x1e9e56-0x0;var _0x5d5e2e=_0xdfcc[_0x1e9e56];return _0x5d5e2e;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var moment=require(_0xcdfc('0x2'));var BPromise=require(_0xcdfc('0x3'));var rs=require(_0xcdfc('0x4'));var fs=require('fs');var Redis=require(_0xcdfc('0x5'));var db=require(_0xcdfc('0x6'))['db'];var utils=require(_0xcdfc('0x7'));var logger=require('../../config/logger')(_0xcdfc('0x8'));var config=require(_0xcdfc('0x9'));var jayson=require(_0xcdfc('0xa'));var client=jayson[_0xcdfc('0xb')][_0xcdfc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a4270,_0x190c46,_0x34f4e5){return new BPromise(function(_0x73743b,_0x286801){return client['request'](_0x5a4270,_0x34f4e5)[_0xcdfc('0xd')](function(_0x46ca09){logger[_0xcdfc('0xe')](_0xcdfc('0xf'),_0x190c46,_0xcdfc('0x10'));logger[_0xcdfc('0x11')](_0xcdfc('0x12'),_0x190c46,_0xcdfc('0x10'),JSON[_0xcdfc('0x13')](_0x46ca09));if(_0x46ca09[_0xcdfc('0x14')]){if(_0x46ca09[_0xcdfc('0x14')][_0xcdfc('0x15')]===0x1f4){logger[_0xcdfc('0x14')](_0xcdfc('0xf'),_0x190c46,_0x46ca09[_0xcdfc('0x14')][_0xcdfc('0x16')]);return _0x286801(_0x46ca09['error'][_0xcdfc('0x16')]);}logger[_0xcdfc('0x14')](_0xcdfc('0xf'),_0x190c46,_0x46ca09[_0xcdfc('0x14')][_0xcdfc('0x16')]);return _0x73743b(_0x46ca09['error'][_0xcdfc('0x16')]);}else{logger[_0xcdfc('0xe')](_0xcdfc('0xf'),_0x190c46,_0xcdfc('0x10'));_0x73743b(_0x46ca09[_0xcdfc('0x17')]['message']);}})[_0xcdfc('0x18')](function(_0x3d3f99){logger[_0xcdfc('0x14')](_0xcdfc('0xf'),_0x190c46,_0x3d3f99);_0x286801(_0x3d3f99);});});}exports[_0xcdfc('0x19')]=function(_0x392ec3){var _0x2883ea=this;return new Promise(function(_0x5ec5ed,_0x309095){return db[_0xcdfc('0x1a')][_0xcdfc('0x1b')]({'raw':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3[_0xcdfc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3[_0xcdfc('0x1c')][_0xcdfc('0x1d')]||null:null,'attributes':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3['options'][_0xcdfc('0x1e')]||null:null,'limit':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3[_0xcdfc('0x1c')][_0xcdfc('0x1f')]||null:null,'include':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3[_0xcdfc('0x1c')]['include']?_[_0xcdfc('0x20')](_0x392ec3['options'][_0xcdfc('0x21')],function(_0xf5d934){return{'model':db[_0xf5d934['model']],'as':_0xf5d934['as'],'attributes':_0xf5d934['attributes'],'include':_0xf5d934[_0xcdfc('0x21')]?_['map'](_0xf5d934[_0xcdfc('0x21')],function(_0x3a8344){return{'model':db[_0x3a8344[_0xcdfc('0x22')]],'as':_0x3a8344['as'],'attributes':_0x3a8344[_0xcdfc('0x1e')],'include':_0x3a8344['include']?_[_0xcdfc('0x20')](_0x3a8344['include'],function(_0x543f5e){return{'model':db[_0x543f5e[_0xcdfc('0x22')]],'as':_0x543f5e['as'],'attributes':_0x543f5e[_0xcdfc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcdfc('0xd')](function(_0x252dfe){logger['info']('GetDynamics365Account',_0x392ec3);logger[_0xcdfc('0x11')](_0xcdfc('0x19'),_0x392ec3,JSON[_0xcdfc('0x13')](_0x252dfe));_0x5ec5ed(_0x252dfe);})[_0xcdfc('0x18')](function(_0x4f2a16){logger[_0xcdfc('0x14')]('GetDynamics365Account',_0x4f2a16[_0xcdfc('0x16')],_0x392ec3);_0x309095(_0x2883ea['error'](0x1f4,_0x4f2a16[_0xcdfc('0x16')]));});});};exports[_0xcdfc('0x23')]=function(_0x44468a){var _0x3be6bb=this;return new Promise(function(_0x37d9cd,_0x48c0a9){return db['Dynamics365Account'][_0xcdfc('0x24')]({'raw':_0x44468a[_0xcdfc('0x1c')]?_0x44468a[_0xcdfc('0x1c')][_0xcdfc('0x25')]===undefined?!![]:![]:!![],'where':_0x44468a[_0xcdfc('0x1c')]?_0x44468a['options'][_0xcdfc('0x1d')]||null:null,'attributes':_0x44468a[_0xcdfc('0x1c')]?_0x44468a[_0xcdfc('0x1c')][_0xcdfc('0x1e')]||null:null,'include':_0x44468a[_0xcdfc('0x1c')]?_0x44468a['options'][_0xcdfc('0x21')]?_['map'](_0x44468a['options'][_0xcdfc('0x21')],function(_0x44711d){return{'model':db[_0x44711d[_0xcdfc('0x22')]],'as':_0x44711d['as'],'attributes':_0x44711d[_0xcdfc('0x1e')],'include':_0x44711d[_0xcdfc('0x21')]?_[_0xcdfc('0x20')](_0x44711d[_0xcdfc('0x21')],function(_0x4bbfc4){return{'model':db[_0x4bbfc4[_0xcdfc('0x22')]],'as':_0x4bbfc4['as'],'attributes':_0x4bbfc4[_0xcdfc('0x1e')],'include':_0x4bbfc4[_0xcdfc('0x21')]?_[_0xcdfc('0x20')](_0x4bbfc4[_0xcdfc('0x21')],function(_0x3f1cf4){return{'model':db[_0x3f1cf4['model']],'as':_0x3f1cf4['as'],'attributes':_0x3f1cf4['attributes']};}):[]};}):[]};}):[]:[]})[_0xcdfc('0xd')](function(_0x4d7f0f){logger['info'](_0xcdfc('0x23'),_0x44468a);logger[_0xcdfc('0x11')](_0xcdfc('0x23'),_0x44468a,JSON['stringify'](_0x4d7f0f));_0x37d9cd(_0x4d7f0f);})[_0xcdfc('0x18')](function(_0x46eb31){logger[_0xcdfc('0x14')](_0xcdfc('0x23'),_0x46eb31[_0xcdfc('0x16')],_0x44468a);_0x48c0a9(_0x3be6bb[_0xcdfc('0x14')](0x1f4,_0x46eb31[_0xcdfc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4548ecf..6c020ab 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 _0x917d=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x50c189,_0x55d6d5){var _0x222f44=function(_0x364217){while(--_0x364217){_0x50c189['push'](_0x50c189['shift']());}};_0x222f44(++_0x55d6d5);}(_0x917d,0x17c));var _0xd917=function(_0x296384,_0x4d79c4){_0x296384=_0x296384-0x0;var _0x5f2b73=_0x917d[_0x296384];return _0x5f2b73;};'use strict';var multer=require(_0xd917('0x0'));var util=require(_0xd917('0x1'));var path=require('path');var timeout=require(_0xd917('0x2'));var express=require(_0xd917('0x3'));var router=express[_0xd917('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd917('0x5'));var interaction=require(_0xd917('0x6'));var config=require('../../config/environment');var controller=require(_0xd917('0x7'));router[_0xd917('0x8')]('/',auth[_0xd917('0x9')](),controller[_0xd917('0xa')]);router[_0xd917('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd917('0xb')]);router[_0xd917('0x8')](_0xd917('0xc'),auth[_0xd917('0x9')](),controller[_0xd917('0xd')]);router[_0xd917('0x8')](_0xd917('0xe'),auth[_0xd917('0x9')](),controller[_0xd917('0xf')]);router['get'](_0xd917('0x10'),auth[_0xd917('0x9')](),controller['getDescriptions']);router[_0xd917('0x11')]('/',auth[_0xd917('0x9')](),controller[_0xd917('0x12')]);router[_0xd917('0x13')]('/:id',auth[_0xd917('0x9')](),controller['update']);router[_0xd917('0x14')](_0xd917('0x15'),auth[_0xd917('0x9')](),controller['destroy']);module[_0xd917('0x16')]=router; \ No newline at end of file +var _0x80e0=['post','put','/:id','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x396772,_0x1d24c4){var _0x4f3c81=function(_0x59a271){while(--_0x59a271){_0x396772['push'](_0x396772['shift']());}};_0x4f3c81(++_0x1d24c4);}(_0x80e0,0x9d));var _0x080e=function(_0x3d336f,_0x1ea87d){_0x3d336f=_0x3d336f-0x0;var _0x50cc1d=_0x80e0[_0x3d336f];return _0x50cc1d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x080e('0x0'));var timeout=require(_0x080e('0x1'));var express=require(_0x080e('0x2'));var router=express['Router']();var fs_extra=require(_0x080e('0x3'));var auth=require(_0x080e('0x4'));var interaction=require(_0x080e('0x5'));var config=require('../../config/environment');var controller=require(_0x080e('0x6'));router[_0x080e('0x7')]('/',auth[_0x080e('0x8')](),controller['index']);router['get']('/:id',auth[_0x080e('0x8')](),controller['show']);router[_0x080e('0x7')]('/:id/fields',auth[_0x080e('0x8')](),controller[_0x080e('0x9')]);router[_0x080e('0x7')](_0x080e('0xa'),auth[_0x080e('0x8')](),controller['getSubjects']);router['get'](_0x080e('0xb'),auth[_0x080e('0x8')](),controller[_0x080e('0xc')]);router[_0x080e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x080e('0xe')](_0x080e('0xf'),auth[_0x080e('0x8')](),controller['update']);router[_0x080e('0x10')](_0x080e('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e4f905a..2cf2430 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 _0x8e9f=['sequelize','exports','STRING','incident','phonecall'];(function(_0x1a42bc,_0x34a88c){var _0x33fd2b=function(_0x2be72d){while(--_0x2be72d){_0x1a42bc['push'](_0x1a42bc['shift']());}};_0x33fd2b(++_0x34a88c);}(_0x8e9f,0xaa));var _0xf8e9=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x8e9f[_0x1562a2];return _0x39a636;};'use strict';var Sequelize=require(_0xf8e9('0x0'));module[_0xf8e9('0x1')]={'name':{'type':Sequelize[_0xf8e9('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xf8e9('0x3'),_0xf8e9('0x4')),'defaultValue':_0xf8e9('0x3')}}; \ No newline at end of file +var _0x27c1=['sequelize','exports','STRING','ENUM','incident'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x27c1,0x78));var _0x127c=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x27c1[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0x127c('0x0'));module[_0x127c('0x1')]={'name':{'type':Sequelize[_0x127c('0x2')]},'description':{'type':Sequelize[_0x127c('0x2')]},'ticketType':{'type':Sequelize[_0x127c('0x3')](_0x127c('0x4'),'phonecall'),'defaultValue':_0x127c('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ac0822e..2167c8c 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 _0x8dcb=['limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getFields','findOne','length','nolimit','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x328391,_0x4cd50c){var _0x57e02c=function(_0xaa1356){while(--_0xaa1356){_0x328391['push'](_0x328391['shift']());}};_0x57e02c(++_0x4cd50c);}(_0x8dcb,0x12c));var _0xb8dc=function(_0x6bb1ac,_0x53d84d){_0x6bb1ac=_0x6bb1ac-0x0;var _0xc35c19=_0x8dcb[_0x6bb1ac];return _0xc35c19;};'use strict';var emlformat=require(_0xb8dc('0x0'));var rimraf=require(_0xb8dc('0x1'));var zipdir=require(_0xb8dc('0x2'));var jsonpatch=require(_0xb8dc('0x3'));var rp=require(_0xb8dc('0x4'));var moment=require(_0xb8dc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb8dc('0x6'));var util=require(_0xb8dc('0x7'));var path=require(_0xb8dc('0x8'));var sox=require(_0xb8dc('0x9'));var csv=require(_0xb8dc('0xa'));var ejs=require(_0xb8dc('0xb'));var fs=require('fs');var fs_extra=require(_0xb8dc('0xc'));var _=require('lodash');var squel=require(_0xb8dc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8dc('0xe'));var toCsv=require(_0xb8dc('0xa'));var querystring=require(_0xb8dc('0xf'));var Papa=require(_0xb8dc('0x10'));var Redis=require(_0xb8dc('0x11'));var authService=require(_0xb8dc('0x12'));var qs=require(_0xb8dc('0x13'));var as=require(_0xb8dc('0x14'));var hardwareService=require(_0xb8dc('0x15'));var logger=require(_0xb8dc('0x16'))(_0xb8dc('0x17'));var utils=require(_0xb8dc('0x18'));var config=require(_0xb8dc('0x19'));var licenseUtil=require(_0xb8dc('0x1a'));var db=require(_0xb8dc('0x1b'))['db'];function respondWithStatusCode(_0x598bc8,_0xf622a9){_0xf622a9=_0xf622a9||0xcc;return function(_0x187265){if(_0x187265){return _0x598bc8[_0xb8dc('0x1c')](_0xf622a9);}return _0x598bc8[_0xb8dc('0x1d')](_0xf622a9)['end']();};}function respondWithResult(_0xf56da3,_0x423598){_0x423598=_0x423598||0xc8;return function(_0x3479ff){if(_0x3479ff){return _0xf56da3[_0xb8dc('0x1d')](_0x423598)[_0xb8dc('0x1e')](_0x3479ff);}};}function respondWithFilteredResult(_0x4fe3cf,_0x49adf2){return function(_0xbc5489){if(_0xbc5489){var _0x2c41b9=typeof _0x49adf2[_0xb8dc('0x1f')]==='undefined'&&typeof _0x49adf2[_0xb8dc('0x20')]===_0xb8dc('0x21');var _0x5fa5e2=_0xbc5489[_0xb8dc('0x22')];var _0x3b2a18=_0x2c41b9?0x0:_0x49adf2[_0xb8dc('0x1f')];var _0x1f2880=_0x2c41b9?_0xbc5489['count']:_0x49adf2[_0xb8dc('0x1f')]+_0x49adf2[_0xb8dc('0x20')];var _0xe8171a;if(_0x1f2880>=_0x5fa5e2){_0x1f2880=_0x5fa5e2;_0xe8171a=0xc8;}else{_0xe8171a=0xce;}_0x4fe3cf[_0xb8dc('0x1d')](_0xe8171a);return _0x4fe3cf[_0xb8dc('0x23')](_0xb8dc('0x24'),_0x3b2a18+'-'+_0x1f2880+'/'+_0x5fa5e2)[_0xb8dc('0x1e')](_0xbc5489);}return null;};}function patchUpdates(_0x13c5b6){return function(_0xb48542){try{jsonpatch[_0xb8dc('0x25')](_0xb48542,_0x13c5b6,!![]);}catch(_0x400dc5){return BPromise['reject'](_0x400dc5);}return _0xb48542[_0xb8dc('0x26')]();};}function saveUpdates(_0xfa7416,_0x2e729f){return function(_0x5175bd){if(_0x5175bd){return _0x5175bd[_0xb8dc('0x27')](_0xfa7416)[_0xb8dc('0x28')](function(_0x185071){return _0x185071;});}return null;};}function removeEntity(_0x1b1beb,_0x10b9be){return function(_0x1a8497){if(_0x1a8497){return _0x1a8497[_0xb8dc('0x29')]()['then'](function(){_0x1b1beb[_0xb8dc('0x1d')](0xcc)[_0xb8dc('0x2a')]();});}};}function handleEntityNotFound(_0x330a6d,_0x12e085){return function(_0x36c125){if(!_0x36c125){_0x330a6d[_0xb8dc('0x1c')](0x194);}return _0x36c125;};}function handleError(_0x521ae7,_0x41cae2){_0x41cae2=_0x41cae2||0x1f4;return function(_0x604769){logger['error'](_0x604769[_0xb8dc('0x2b')]);if(_0x604769[_0xb8dc('0x2c')]){delete _0x604769[_0xb8dc('0x2c')];}_0x521ae7[_0xb8dc('0x1d')](_0x41cae2)['send'](_0x604769);};}exports[_0xb8dc('0x2d')]=function(_0x1886c4,_0x40a7d2){var _0x24caf6={},_0x2decae={},_0x5aad3f={'count':0x0,'rows':[]};var _0x18d981=_[_0xb8dc('0x2e')](db[_0xb8dc('0x2f')][_0xb8dc('0x30')],function(_0x2a001d){return{'name':_0x2a001d[_0xb8dc('0x31')],'type':_0x2a001d[_0xb8dc('0x32')]['key']};});_0x2decae[_0xb8dc('0x33')]=_[_0xb8dc('0x2e')](_0x18d981,_0xb8dc('0x2c'));_0x2decae['query']=_['keys'](_0x1886c4[_0xb8dc('0x34')]);_0x2decae['filters']=_[_0xb8dc('0x35')](_0x2decae[_0xb8dc('0x33')],_0x2decae[_0xb8dc('0x34')]);_0x24caf6[_0xb8dc('0x36')]=_[_0xb8dc('0x35')](_0x2decae['model'],qs[_0xb8dc('0x37')](_0x1886c4[_0xb8dc('0x34')][_0xb8dc('0x37')]));_0x24caf6[_0xb8dc('0x36')]=_0x24caf6[_0xb8dc('0x36')]['length']?_0x24caf6[_0xb8dc('0x36')]:_0x2decae[_0xb8dc('0x33')];if(!_0x1886c4['query'][_0xb8dc('0x38')]('nolimit')){_0x24caf6[_0xb8dc('0x20')]=qs[_0xb8dc('0x20')](_0x1886c4['query']['limit']);_0x24caf6[_0xb8dc('0x1f')]=qs['offset'](_0x1886c4[_0xb8dc('0x34')]['offset']);}_0x24caf6[_0xb8dc('0x39')]=qs[_0xb8dc('0x3a')](_0x1886c4[_0xb8dc('0x34')]['sort']);_0x24caf6[_0xb8dc('0x3b')]=qs[_0xb8dc('0x3c')](_[_0xb8dc('0x3d')](_0x1886c4[_0xb8dc('0x34')],_0x2decae[_0xb8dc('0x3c')]),_0x18d981);if(_0x1886c4[_0xb8dc('0x34')]['filter']){_0x24caf6[_0xb8dc('0x3b')]=_['merge'](_0x24caf6[_0xb8dc('0x3b')],{'$or':_[_0xb8dc('0x2e')](_0x18d981,function(_0x3ffea6){if(_0x3ffea6['type']!=='VIRTUAL'){var _0x2ee508={};_0x2ee508[_0x3ffea6[_0xb8dc('0x2c')]]={'$like':'%'+_0x1886c4[_0xb8dc('0x34')][_0xb8dc('0x3e')]+'%'};return _0x2ee508;}})});}_0x24caf6=_[_0xb8dc('0x3f')]({},_0x24caf6,_0x1886c4[_0xb8dc('0x40')]);var _0x5810a7={'where':_0x24caf6[_0xb8dc('0x3b')]};return db['Dynamics365Configuration'][_0xb8dc('0x22')](_0x5810a7)[_0xb8dc('0x28')](function(_0x502adb){_0x5aad3f['count']=_0x502adb;if(_0x1886c4[_0xb8dc('0x34')][_0xb8dc('0x41')]){_0x24caf6[_0xb8dc('0x42')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xb8dc('0x43')](_0x24caf6);})[_0xb8dc('0x28')](function(_0xb99abd){_0x5aad3f[_0xb8dc('0x44')]=_0xb99abd;return _0x5aad3f;})[_0xb8dc('0x28')](respondWithFilteredResult(_0x40a7d2,_0x24caf6))['catch'](handleError(_0x40a7d2,null));};exports[_0xb8dc('0x45')]=function(_0x2af7a2,_0xbf402e){var _0x28105e={'raw':![],'where':{'id':_0x2af7a2[_0xb8dc('0x46')]['id']}},_0x3b0f1d={};_0x3b0f1d['model']=_[_0xb8dc('0x47')](db[_0xb8dc('0x2f')][_0xb8dc('0x30')]);_0x3b0f1d[_0xb8dc('0x34')]=_[_0xb8dc('0x47')](_0x2af7a2[_0xb8dc('0x34')]);_0x3b0f1d[_0xb8dc('0x3c')]=_[_0xb8dc('0x35')](_0x3b0f1d[_0xb8dc('0x33')],_0x3b0f1d[_0xb8dc('0x34')]);_0x28105e[_0xb8dc('0x36')]=_[_0xb8dc('0x35')](_0x3b0f1d[_0xb8dc('0x33')],qs[_0xb8dc('0x37')](_0x2af7a2[_0xb8dc('0x34')][_0xb8dc('0x37')]));_0x28105e[_0xb8dc('0x36')]=_0x28105e[_0xb8dc('0x36')]['length']?_0x28105e['attributes']:_0x3b0f1d[_0xb8dc('0x33')];if(_0x2af7a2[_0xb8dc('0x34')][_0xb8dc('0x41')]){_0x28105e['include']=[{'all':!![]}];}_0x28105e=_[_0xb8dc('0x3f')]({},_0x28105e,_0x2af7a2['options']);return db['Dynamics365Configuration'][_0xb8dc('0x48')](_0x28105e)[_0xb8dc('0x28')](handleEntityNotFound(_0xbf402e,null))[_0xb8dc('0x28')](respondWithResult(_0xbf402e,null))[_0xb8dc('0x49')](handleError(_0xbf402e,null));};exports[_0xb8dc('0x4a')]=function(_0x2e9c98,_0x556c83){return db[_0xb8dc('0x2f')][_0xb8dc('0x4a')](_0x2e9c98[_0xb8dc('0x4b')],{})[_0xb8dc('0x28')](respondWithResult(_0x556c83,0xc9))[_0xb8dc('0x49')](handleError(_0x556c83,null));};exports[_0xb8dc('0x27')]=function(_0x56b094,_0x2fa54c){if(_0x56b094[_0xb8dc('0x4b')]['id']){delete _0x56b094['body']['id'];}return db[_0xb8dc('0x2f')][_0xb8dc('0x48')]({'where':{'id':_0x56b094[_0xb8dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fa54c,null))[_0xb8dc('0x28')](saveUpdates(_0x56b094[_0xb8dc('0x4b')],null))[_0xb8dc('0x28')](respondWithResult(_0x2fa54c,null))[_0xb8dc('0x49')](handleError(_0x2fa54c,null));};exports['destroy']=function(_0x4e9fa6,_0x22e0a9){return db['Dynamics365Configuration'][_0xb8dc('0x48')]({'where':{'id':_0x4e9fa6[_0xb8dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x22e0a9,null))[_0xb8dc('0x28')](removeEntity(_0x22e0a9,null))[_0xb8dc('0x49')](handleError(_0x22e0a9,null));};exports[_0xb8dc('0x4c')]=function(_0x2c043b,_0x407958,_0x26babb){var _0x5cdb35={};var _0x9b86b3={};var _0xd714dc;var _0x159740;return db[_0xb8dc('0x2f')][_0xb8dc('0x4d')]({'where':{'id':_0x2c043b['params']['id']}})[_0xb8dc('0x28')](handleEntityNotFound(_0x407958,null))[_0xb8dc('0x28')](function(_0x1c8ab0){if(_0x1c8ab0){_0xd714dc=_0x1c8ab0;_0x9b86b3[_0xb8dc('0x33')]=_[_0xb8dc('0x47')](db['Dynamics365Field'][_0xb8dc('0x30')]);_0x9b86b3[_0xb8dc('0x34')]=_[_0xb8dc('0x47')](_0x2c043b[_0xb8dc('0x34')]);_0x9b86b3[_0xb8dc('0x3c')]=_['intersection'](_0x9b86b3[_0xb8dc('0x33')],_0x9b86b3['query']);_0x5cdb35['attributes']=_[_0xb8dc('0x35')](_0x9b86b3[_0xb8dc('0x33')],qs[_0xb8dc('0x37')](_0x2c043b[_0xb8dc('0x34')]['fields']));_0x5cdb35[_0xb8dc('0x36')]=_0x5cdb35['attributes'][_0xb8dc('0x4e')]?_0x5cdb35[_0xb8dc('0x36')]:_0x9b86b3[_0xb8dc('0x33')];_0x5cdb35[_0xb8dc('0x39')]=qs[_0xb8dc('0x3a')](_0x2c043b[_0xb8dc('0x34')]['sort']);_0x5cdb35[_0xb8dc('0x3b')]=qs['filters'](_[_0xb8dc('0x3d')](_0x2c043b[_0xb8dc('0x34')],_0x9b86b3['filters']));if(_0x2c043b['query']['filter']){_0x5cdb35[_0xb8dc('0x3b')]=_['merge'](_0x5cdb35[_0xb8dc('0x3b')],{'$or':_[_0xb8dc('0x2e')](_0x5cdb35[_0xb8dc('0x36')],function(_0x918f37){var _0x5efc65={};_0x5efc65[_0x918f37]={'$like':'%'+_0x2c043b['query'][_0xb8dc('0x3e')]+'%'};return _0x5efc65;})});}_0x5cdb35=_[_0xb8dc('0x3f')]({},_0x5cdb35,_0x2c043b[_0xb8dc('0x40')]);return _0xd714dc[_0xb8dc('0x4c')](_0x5cdb35);}})['then'](function(_0x33af07){if(_0x33af07){_0x159740=_0x33af07['length'];if(!_0x2c043b[_0xb8dc('0x34')][_0xb8dc('0x38')](_0xb8dc('0x4f'))){_0x5cdb35[_0xb8dc('0x20')]=qs[_0xb8dc('0x20')](_0x2c043b[_0xb8dc('0x34')][_0xb8dc('0x20')]);_0x5cdb35[_0xb8dc('0x1f')]=qs[_0xb8dc('0x1f')](_0x2c043b[_0xb8dc('0x34')]['offset']);}return _0xd714dc[_0xb8dc('0x4c')](_0x5cdb35);}})['then'](function(_0x429273){if(_0x429273){return _0x429273?{'count':_0x159740,'rows':_0x429273}:null;}})[_0xb8dc('0x28')](respondWithResult(_0x407958,null))[_0xb8dc('0x49')](handleError(_0x407958,null));};exports[_0xb8dc('0x50')]=function(_0x1961f3,_0x2718f7,_0x4d7ef0){var _0xb408ad={};var _0x623986={};var _0x2a2e4d;var _0x58be37;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x1961f3[_0xb8dc('0x46')]['id']}})[_0xb8dc('0x28')](handleEntityNotFound(_0x2718f7,null))[_0xb8dc('0x28')](function(_0x382392){if(_0x382392){_0x2a2e4d=_0x382392;_0x623986[_0xb8dc('0x33')]=_[_0xb8dc('0x47')](db[_0xb8dc('0x51')]['rawAttributes']);_0x623986[_0xb8dc('0x34')]=_[_0xb8dc('0x47')](_0x1961f3[_0xb8dc('0x34')]);_0x623986['filters']=_[_0xb8dc('0x35')](_0x623986['model'],_0x623986[_0xb8dc('0x34')]);_0xb408ad[_0xb8dc('0x36')]=_[_0xb8dc('0x35')](_0x623986['model'],qs[_0xb8dc('0x37')](_0x1961f3[_0xb8dc('0x34')]['fields']));_0xb408ad['attributes']=_0xb408ad['attributes'][_0xb8dc('0x4e')]?_0xb408ad[_0xb8dc('0x36')]:_0x623986[_0xb8dc('0x33')];_0xb408ad[_0xb8dc('0x39')]=qs[_0xb8dc('0x3a')](_0x1961f3[_0xb8dc('0x34')][_0xb8dc('0x3a')]);_0xb408ad['where']=qs[_0xb8dc('0x3c')](_[_0xb8dc('0x3d')](_0x1961f3[_0xb8dc('0x34')],_0x623986[_0xb8dc('0x3c')]));if(_0x1961f3['query'][_0xb8dc('0x3e')]){_0xb408ad[_0xb8dc('0x3b')]=_['merge'](_0xb408ad[_0xb8dc('0x3b')],{'$or':_[_0xb8dc('0x2e')](_0xb408ad[_0xb8dc('0x36')],function(_0xfa0d62){var _0x747981={};_0x747981[_0xfa0d62]={'$like':'%'+_0x1961f3['query'][_0xb8dc('0x3e')]+'%'};return _0x747981;})});}_0xb408ad=_[_0xb8dc('0x3f')]({},_0xb408ad,_0x1961f3['options']);return _0x2a2e4d[_0xb8dc('0x50')](_0xb408ad);}})[_0xb8dc('0x28')](function(_0x6961c2){if(_0x6961c2){_0x58be37=_0x6961c2[_0xb8dc('0x4e')];if(!_0x1961f3[_0xb8dc('0x34')][_0xb8dc('0x38')](_0xb8dc('0x4f'))){_0xb408ad[_0xb8dc('0x20')]=qs[_0xb8dc('0x20')](_0x1961f3[_0xb8dc('0x34')]['limit']);_0xb408ad['offset']=qs[_0xb8dc('0x1f')](_0x1961f3[_0xb8dc('0x34')][_0xb8dc('0x1f')]);}return _0x2a2e4d[_0xb8dc('0x50')](_0xb408ad);}})[_0xb8dc('0x28')](function(_0x34178a){if(_0x34178a){return _0x34178a?{'count':_0x58be37,'rows':_0x34178a}:null;}})[_0xb8dc('0x28')](respondWithResult(_0x2718f7,null))[_0xb8dc('0x49')](handleError(_0x2718f7,null));};exports[_0xb8dc('0x52')]=function(_0x2208fa,_0x1d1169,_0x70c819){var _0x19949f={};var _0x48896e={};var _0x108ae5;var _0x2b6868;return db[_0xb8dc('0x2f')][_0xb8dc('0x4d')]({'where':{'id':_0x2208fa[_0xb8dc('0x46')]['id']}})[_0xb8dc('0x28')](handleEntityNotFound(_0x1d1169,null))[_0xb8dc('0x28')](function(_0x54e81c){if(_0x54e81c){_0x108ae5=_0x54e81c;_0x48896e[_0xb8dc('0x33')]=_[_0xb8dc('0x47')](db[_0xb8dc('0x51')]['rawAttributes']);_0x48896e[_0xb8dc('0x34')]=_[_0xb8dc('0x47')](_0x2208fa[_0xb8dc('0x34')]);_0x48896e[_0xb8dc('0x3c')]=_[_0xb8dc('0x35')](_0x48896e[_0xb8dc('0x33')],_0x48896e[_0xb8dc('0x34')]);_0x19949f[_0xb8dc('0x36')]=_['intersection'](_0x48896e[_0xb8dc('0x33')],qs[_0xb8dc('0x37')](_0x2208fa[_0xb8dc('0x34')][_0xb8dc('0x37')]));_0x19949f[_0xb8dc('0x36')]=_0x19949f['attributes'][_0xb8dc('0x4e')]?_0x19949f['attributes']:_0x48896e[_0xb8dc('0x33')];_0x19949f[_0xb8dc('0x39')]=qs['sort'](_0x2208fa[_0xb8dc('0x34')][_0xb8dc('0x3a')]);_0x19949f[_0xb8dc('0x3b')]=qs['filters'](_[_0xb8dc('0x3d')](_0x2208fa[_0xb8dc('0x34')],_0x48896e[_0xb8dc('0x3c')]));if(_0x2208fa['query'][_0xb8dc('0x3e')]){_0x19949f[_0xb8dc('0x3b')]=_[_0xb8dc('0x3f')](_0x19949f[_0xb8dc('0x3b')],{'$or':_['map'](_0x19949f[_0xb8dc('0x36')],function(_0x2d8f5c){var _0x4ab02c={};_0x4ab02c[_0x2d8f5c]={'$like':'%'+_0x2208fa[_0xb8dc('0x34')]['filter']+'%'};return _0x4ab02c;})});}_0x19949f=_[_0xb8dc('0x3f')]({},_0x19949f,_0x2208fa[_0xb8dc('0x40')]);return _0x108ae5['getDescriptions'](_0x19949f);}})['then'](function(_0x585684){if(_0x585684){_0x2b6868=_0x585684[_0xb8dc('0x4e')];if(!_0x2208fa[_0xb8dc('0x34')][_0xb8dc('0x38')](_0xb8dc('0x4f'))){_0x19949f[_0xb8dc('0x20')]=qs[_0xb8dc('0x20')](_0x2208fa[_0xb8dc('0x34')]['limit']);_0x19949f[_0xb8dc('0x1f')]=qs[_0xb8dc('0x1f')](_0x2208fa[_0xb8dc('0x34')][_0xb8dc('0x1f')]);}return _0x108ae5[_0xb8dc('0x52')](_0x19949f);}})['then'](function(_0x23c5d6){if(_0x23c5d6){return _0x23c5d6?{'count':_0x2b6868,'rows':_0x23c5d6}:null;}})['then'](respondWithResult(_0x1d1169,null))[_0xb8dc('0x49')](handleError(_0x1d1169,null));}; \ No newline at end of file +var _0x41e5=['end','json','limit','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','Dynamics365Configuration','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','Dynamics365Field','rawAttributes','getSubjects','hasOwnProperty','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x382602,_0x5e9d2d){var _0x14dda6=function(_0xf65c39){while(--_0xf65c39){_0x382602['push'](_0x382602['shift']());}};_0x14dda6(++_0x5e9d2d);}(_0x41e5,0xda));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x541e('0x0'));var rimraf=require(_0x541e('0x1'));var zipdir=require(_0x541e('0x2'));var jsonpatch=require(_0x541e('0x3'));var rp=require(_0x541e('0x4'));var moment=require(_0x541e('0x5'));var BPromise=require(_0x541e('0x6'));var Mustache=require(_0x541e('0x7'));var util=require(_0x541e('0x8'));var path=require(_0x541e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x541e('0xa'));var fs=require('fs');var fs_extra=require(_0x541e('0xb'));var _=require('lodash');var squel=require(_0x541e('0xc'));var crypto=require('crypto');var jsforce=require(_0x541e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x541e('0xe'));var querystring=require(_0x541e('0xf'));var Papa=require(_0x541e('0x10'));var Redis=require(_0x541e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x541e('0x12'));var as=require(_0x541e('0x13'));var hardwareService=require(_0x541e('0x14'));var logger=require(_0x541e('0x15'))(_0x541e('0x16'));var utils=require(_0x541e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x541e('0x18'));var db=require(_0x541e('0x19'))['db'];function respondWithStatusCode(_0x1735cd,_0x18ccc5){_0x18ccc5=_0x18ccc5||0xcc;return function(_0x563648){if(_0x563648){return _0x1735cd[_0x541e('0x1a')](_0x18ccc5);}return _0x1735cd[_0x541e('0x1b')](_0x18ccc5)[_0x541e('0x1c')]();};}function respondWithResult(_0x5e0399,_0x10342b){_0x10342b=_0x10342b||0xc8;return function(_0x367f75){if(_0x367f75){return _0x5e0399[_0x541e('0x1b')](_0x10342b)[_0x541e('0x1d')](_0x367f75);}};}function respondWithFilteredResult(_0x552118,_0x50a47f){return function(_0x54af35){if(_0x54af35){var _0x1a2f43=typeof _0x50a47f['offset']==='undefined'&&typeof _0x50a47f[_0x541e('0x1e')]==='undefined';var _0x30d386=_0x54af35['count'];var _0x243830=_0x1a2f43?0x0:_0x50a47f[_0x541e('0x1f')];var _0x43886c=_0x1a2f43?_0x54af35['count']:_0x50a47f['offset']+_0x50a47f[_0x541e('0x1e')];var _0x2aa1e6;if(_0x43886c>=_0x30d386){_0x43886c=_0x30d386;_0x2aa1e6=0xc8;}else{_0x2aa1e6=0xce;}_0x552118[_0x541e('0x1b')](_0x2aa1e6);return _0x552118[_0x541e('0x20')](_0x541e('0x21'),_0x243830+'-'+_0x43886c+'/'+_0x30d386)[_0x541e('0x1d')](_0x54af35);}return null;};}function patchUpdates(_0x8e3df9){return function(_0x4dc606){try{jsonpatch[_0x541e('0x22')](_0x4dc606,_0x8e3df9,!![]);}catch(_0x25cdd0){return BPromise[_0x541e('0x23')](_0x25cdd0);}return _0x4dc606[_0x541e('0x24')]();};}function saveUpdates(_0x10988a,_0x4911db){return function(_0xf549d8){if(_0xf549d8){return _0xf549d8[_0x541e('0x25')](_0x10988a)['then'](function(_0x1b6a00){return _0x1b6a00;});}return null;};}function removeEntity(_0x368e61,_0x3d93ac){return function(_0x1af326){if(_0x1af326){return _0x1af326[_0x541e('0x26')]()[_0x541e('0x27')](function(){_0x368e61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a44,_0x5758a7){return function(_0x37be4e){if(!_0x37be4e){_0x14a44[_0x541e('0x1a')](0x194);}return _0x37be4e;};}function handleError(_0xb307fe,_0x12b3f9){_0x12b3f9=_0x12b3f9||0x1f4;return function(_0xb38559){logger[_0x541e('0x28')](_0xb38559[_0x541e('0x29')]);if(_0xb38559[_0x541e('0x2a')]){delete _0xb38559[_0x541e('0x2a')];}_0xb307fe[_0x541e('0x1b')](_0x12b3f9)[_0x541e('0x2b')](_0xb38559);};}exports['index']=function(_0x356f9f,_0x4c6e0d){var _0x30fca4={},_0x4d7361={},_0x1d7471={'count':0x0,'rows':[]};var _0x2e134d=_[_0x541e('0x2c')](db[_0x541e('0x2d')]['rawAttributes'],function(_0x30f2a5){return{'name':_0x30f2a5[_0x541e('0x2e')],'type':_0x30f2a5[_0x541e('0x2f')]['key']};});_0x4d7361[_0x541e('0x30')]=_[_0x541e('0x2c')](_0x2e134d,_0x541e('0x2a'));_0x4d7361['query']=_[_0x541e('0x31')](_0x356f9f['query']);_0x4d7361[_0x541e('0x32')]=_[_0x541e('0x33')](_0x4d7361[_0x541e('0x30')],_0x4d7361[_0x541e('0x34')]);_0x30fca4[_0x541e('0x35')]=_['intersection'](_0x4d7361['model'],qs['fields'](_0x356f9f[_0x541e('0x34')][_0x541e('0x36')]));_0x30fca4[_0x541e('0x35')]=_0x30fca4[_0x541e('0x35')][_0x541e('0x37')]?_0x30fca4[_0x541e('0x35')]:_0x4d7361[_0x541e('0x30')];if(!_0x356f9f[_0x541e('0x34')]['hasOwnProperty'](_0x541e('0x38'))){_0x30fca4[_0x541e('0x1e')]=qs['limit'](_0x356f9f[_0x541e('0x34')][_0x541e('0x1e')]);_0x30fca4[_0x541e('0x1f')]=qs[_0x541e('0x1f')](_0x356f9f['query'][_0x541e('0x1f')]);}_0x30fca4[_0x541e('0x39')]=qs['sort'](_0x356f9f[_0x541e('0x34')][_0x541e('0x3a')]);_0x30fca4[_0x541e('0x3b')]=qs[_0x541e('0x32')](_[_0x541e('0x3c')](_0x356f9f[_0x541e('0x34')],_0x4d7361[_0x541e('0x32')]),_0x2e134d);if(_0x356f9f['query'][_0x541e('0x3d')]){_0x30fca4[_0x541e('0x3b')]=_[_0x541e('0x3e')](_0x30fca4[_0x541e('0x3b')],{'$or':_[_0x541e('0x2c')](_0x2e134d,function(_0x30b2e3){if(_0x30b2e3['type']!=='VIRTUAL'){var _0x2115a6={};_0x2115a6[_0x30b2e3[_0x541e('0x2a')]]={'$like':'%'+_0x356f9f['query'][_0x541e('0x3d')]+'%'};return _0x2115a6;}})});}_0x30fca4=_[_0x541e('0x3e')]({},_0x30fca4,_0x356f9f['options']);var _0x558093={'where':_0x30fca4[_0x541e('0x3b')]};return db[_0x541e('0x2d')][_0x541e('0x3f')](_0x558093)[_0x541e('0x27')](function(_0x3cbbdf){_0x1d7471[_0x541e('0x3f')]=_0x3cbbdf;if(_0x356f9f['query'][_0x541e('0x40')]){_0x30fca4[_0x541e('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x541e('0x42')](_0x30fca4);})['then'](function(_0x28d00b){_0x1d7471[_0x541e('0x43')]=_0x28d00b;return _0x1d7471;})[_0x541e('0x27')](respondWithFilteredResult(_0x4c6e0d,_0x30fca4))[_0x541e('0x44')](handleError(_0x4c6e0d,null));};exports[_0x541e('0x45')]=function(_0x15aad6,_0x709406){var _0x18dc1c={'raw':![],'where':{'id':_0x15aad6[_0x541e('0x46')]['id']}},_0x507956={};_0x507956[_0x541e('0x30')]=_[_0x541e('0x31')](db[_0x541e('0x2d')]['rawAttributes']);_0x507956['query']=_[_0x541e('0x31')](_0x15aad6[_0x541e('0x34')]);_0x507956[_0x541e('0x32')]=_[_0x541e('0x33')](_0x507956[_0x541e('0x30')],_0x507956[_0x541e('0x34')]);_0x18dc1c[_0x541e('0x35')]=_[_0x541e('0x33')](_0x507956[_0x541e('0x30')],qs[_0x541e('0x36')](_0x15aad6[_0x541e('0x34')][_0x541e('0x36')]));_0x18dc1c[_0x541e('0x35')]=_0x18dc1c[_0x541e('0x35')]['length']?_0x18dc1c[_0x541e('0x35')]:_0x507956[_0x541e('0x30')];if(_0x15aad6['query'][_0x541e('0x40')]){_0x18dc1c[_0x541e('0x41')]=[{'all':!![]}];}_0x18dc1c=_[_0x541e('0x3e')]({},_0x18dc1c,_0x15aad6[_0x541e('0x47')]);return db[_0x541e('0x2d')][_0x541e('0x48')](_0x18dc1c)['then'](handleEntityNotFound(_0x709406,null))[_0x541e('0x27')](respondWithResult(_0x709406,null))[_0x541e('0x44')](handleError(_0x709406,null));};exports[_0x541e('0x49')]=function(_0x568c7a,_0x368326){return db[_0x541e('0x2d')]['create'](_0x568c7a[_0x541e('0x4a')],{})['then'](respondWithResult(_0x368326,0xc9))[_0x541e('0x44')](handleError(_0x368326,null));};exports['update']=function(_0x106f2a,_0x36e1eb){if(_0x106f2a[_0x541e('0x4a')]['id']){delete _0x106f2a['body']['id'];}return db[_0x541e('0x2d')][_0x541e('0x48')]({'where':{'id':_0x106f2a[_0x541e('0x46')]['id']}})[_0x541e('0x27')](handleEntityNotFound(_0x36e1eb,null))[_0x541e('0x27')](saveUpdates(_0x106f2a['body'],null))['then'](respondWithResult(_0x36e1eb,null))[_0x541e('0x44')](handleError(_0x36e1eb,null));};exports['destroy']=function(_0x5bac28,_0x3ce2ab){return db[_0x541e('0x2d')]['find']({'where':{'id':_0x5bac28[_0x541e('0x46')]['id']}})[_0x541e('0x27')](handleEntityNotFound(_0x3ce2ab,null))['then'](removeEntity(_0x3ce2ab,null))[_0x541e('0x44')](handleError(_0x3ce2ab,null));};exports[_0x541e('0x4b')]=function(_0x57358f,_0x5e7c75,_0x25fced){var _0x417332={};var _0x3256b0={};var _0x1ae953;var _0x7e5a20;return db[_0x541e('0x2d')]['findOne']({'where':{'id':_0x57358f[_0x541e('0x46')]['id']}})[_0x541e('0x27')](handleEntityNotFound(_0x5e7c75,null))[_0x541e('0x27')](function(_0x4f3115){if(_0x4f3115){_0x1ae953=_0x4f3115;_0x3256b0[_0x541e('0x30')]=_[_0x541e('0x31')](db[_0x541e('0x4c')][_0x541e('0x4d')]);_0x3256b0[_0x541e('0x34')]=_['keys'](_0x57358f[_0x541e('0x34')]);_0x3256b0['filters']=_[_0x541e('0x33')](_0x3256b0['model'],_0x3256b0['query']);_0x417332[_0x541e('0x35')]=_[_0x541e('0x33')](_0x3256b0[_0x541e('0x30')],qs[_0x541e('0x36')](_0x57358f[_0x541e('0x34')][_0x541e('0x36')]));_0x417332['attributes']=_0x417332[_0x541e('0x35')][_0x541e('0x37')]?_0x417332['attributes']:_0x3256b0['model'];_0x417332[_0x541e('0x39')]=qs[_0x541e('0x3a')](_0x57358f[_0x541e('0x34')][_0x541e('0x3a')]);_0x417332['where']=qs[_0x541e('0x32')](_[_0x541e('0x3c')](_0x57358f[_0x541e('0x34')],_0x3256b0[_0x541e('0x32')]));if(_0x57358f['query'][_0x541e('0x3d')]){_0x417332[_0x541e('0x3b')]=_[_0x541e('0x3e')](_0x417332[_0x541e('0x3b')],{'$or':_[_0x541e('0x2c')](_0x417332[_0x541e('0x35')],function(_0x1f6fa7){var _0x35a78b={};_0x35a78b[_0x1f6fa7]={'$like':'%'+_0x57358f['query'][_0x541e('0x3d')]+'%'};return _0x35a78b;})});}_0x417332=_[_0x541e('0x3e')]({},_0x417332,_0x57358f[_0x541e('0x47')]);return _0x1ae953['getFields'](_0x417332);}})[_0x541e('0x27')](function(_0xba499c){if(_0xba499c){_0x7e5a20=_0xba499c[_0x541e('0x37')];if(!_0x57358f[_0x541e('0x34')]['hasOwnProperty'](_0x541e('0x38'))){_0x417332[_0x541e('0x1e')]=qs[_0x541e('0x1e')](_0x57358f[_0x541e('0x34')]['limit']);_0x417332['offset']=qs[_0x541e('0x1f')](_0x57358f[_0x541e('0x34')][_0x541e('0x1f')]);}return _0x1ae953[_0x541e('0x4b')](_0x417332);}})['then'](function(_0x1d1273){if(_0x1d1273){return _0x1d1273?{'count':_0x7e5a20,'rows':_0x1d1273}:null;}})['then'](respondWithResult(_0x5e7c75,null))[_0x541e('0x44')](handleError(_0x5e7c75,null));};exports[_0x541e('0x4e')]=function(_0x12e3c9,_0x5e8c47,_0x3cd44f){var _0x41ca50={};var _0x1b4296={};var _0x16c44b;var _0x361440;return db[_0x541e('0x2d')]['findOne']({'where':{'id':_0x12e3c9['params']['id']}})[_0x541e('0x27')](handleEntityNotFound(_0x5e8c47,null))[_0x541e('0x27')](function(_0x3de206){if(_0x3de206){_0x16c44b=_0x3de206;_0x1b4296['model']=_['keys'](db[_0x541e('0x4c')][_0x541e('0x4d')]);_0x1b4296['query']=_[_0x541e('0x31')](_0x12e3c9[_0x541e('0x34')]);_0x1b4296['filters']=_[_0x541e('0x33')](_0x1b4296[_0x541e('0x30')],_0x1b4296['query']);_0x41ca50[_0x541e('0x35')]=_['intersection'](_0x1b4296[_0x541e('0x30')],qs[_0x541e('0x36')](_0x12e3c9[_0x541e('0x34')]['fields']));_0x41ca50['attributes']=_0x41ca50[_0x541e('0x35')][_0x541e('0x37')]?_0x41ca50['attributes']:_0x1b4296[_0x541e('0x30')];_0x41ca50[_0x541e('0x39')]=qs[_0x541e('0x3a')](_0x12e3c9[_0x541e('0x34')][_0x541e('0x3a')]);_0x41ca50[_0x541e('0x3b')]=qs[_0x541e('0x32')](_[_0x541e('0x3c')](_0x12e3c9[_0x541e('0x34')],_0x1b4296['filters']));if(_0x12e3c9[_0x541e('0x34')][_0x541e('0x3d')]){_0x41ca50['where']=_[_0x541e('0x3e')](_0x41ca50['where'],{'$or':_[_0x541e('0x2c')](_0x41ca50[_0x541e('0x35')],function(_0x580a19){var _0x605e85={};_0x605e85[_0x580a19]={'$like':'%'+_0x12e3c9[_0x541e('0x34')][_0x541e('0x3d')]+'%'};return _0x605e85;})});}_0x41ca50=_[_0x541e('0x3e')]({},_0x41ca50,_0x12e3c9[_0x541e('0x47')]);return _0x16c44b[_0x541e('0x4e')](_0x41ca50);}})['then'](function(_0x426d63){if(_0x426d63){_0x361440=_0x426d63[_0x541e('0x37')];if(!_0x12e3c9['query'][_0x541e('0x4f')](_0x541e('0x38'))){_0x41ca50[_0x541e('0x1e')]=qs[_0x541e('0x1e')](_0x12e3c9[_0x541e('0x34')][_0x541e('0x1e')]);_0x41ca50[_0x541e('0x1f')]=qs[_0x541e('0x1f')](_0x12e3c9[_0x541e('0x34')][_0x541e('0x1f')]);}return _0x16c44b[_0x541e('0x4e')](_0x41ca50);}})[_0x541e('0x27')](function(_0x4dc229){if(_0x4dc229){return _0x4dc229?{'count':_0x361440,'rows':_0x4dc229}:null;}})[_0x541e('0x27')](respondWithResult(_0x5e8c47,null))[_0x541e('0x44')](handleError(_0x5e8c47,null));};exports['getDescriptions']=function(_0x5dbf91,_0x2815d6,_0x53a0b9){var _0x1d8312={};var _0x5014c7={};var _0x44f79d;var _0x292169;return db[_0x541e('0x2d')][_0x541e('0x50')]({'where':{'id':_0x5dbf91[_0x541e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2815d6,null))[_0x541e('0x27')](function(_0x4920fc){if(_0x4920fc){_0x44f79d=_0x4920fc;_0x5014c7['model']=_[_0x541e('0x31')](db['Dynamics365Field'][_0x541e('0x4d')]);_0x5014c7[_0x541e('0x34')]=_['keys'](_0x5dbf91['query']);_0x5014c7['filters']=_[_0x541e('0x33')](_0x5014c7[_0x541e('0x30')],_0x5014c7[_0x541e('0x34')]);_0x1d8312[_0x541e('0x35')]=_['intersection'](_0x5014c7[_0x541e('0x30')],qs[_0x541e('0x36')](_0x5dbf91[_0x541e('0x34')][_0x541e('0x36')]));_0x1d8312[_0x541e('0x35')]=_0x1d8312[_0x541e('0x35')]['length']?_0x1d8312[_0x541e('0x35')]:_0x5014c7[_0x541e('0x30')];_0x1d8312[_0x541e('0x39')]=qs['sort'](_0x5dbf91[_0x541e('0x34')][_0x541e('0x3a')]);_0x1d8312[_0x541e('0x3b')]=qs['filters'](_['pick'](_0x5dbf91[_0x541e('0x34')],_0x5014c7['filters']));if(_0x5dbf91[_0x541e('0x34')][_0x541e('0x3d')]){_0x1d8312[_0x541e('0x3b')]=_[_0x541e('0x3e')](_0x1d8312[_0x541e('0x3b')],{'$or':_[_0x541e('0x2c')](_0x1d8312[_0x541e('0x35')],function(_0x5bc0bb){var _0x46fb0e={};_0x46fb0e[_0x5bc0bb]={'$like':'%'+_0x5dbf91[_0x541e('0x34')][_0x541e('0x3d')]+'%'};return _0x46fb0e;})});}_0x1d8312=_['merge']({},_0x1d8312,_0x5dbf91['options']);return _0x44f79d[_0x541e('0x51')](_0x1d8312);}})['then'](function(_0x4ad637){if(_0x4ad637){_0x292169=_0x4ad637[_0x541e('0x37')];if(!_0x5dbf91[_0x541e('0x34')][_0x541e('0x4f')](_0x541e('0x38'))){_0x1d8312[_0x541e('0x1e')]=qs[_0x541e('0x1e')](_0x5dbf91[_0x541e('0x34')][_0x541e('0x1e')]);_0x1d8312[_0x541e('0x1f')]=qs['offset'](_0x5dbf91[_0x541e('0x34')]['offset']);}return _0x44f79d[_0x541e('0x51')](_0x1d8312);}})['then'](function(_0x2a46c8){if(_0x2a46c8){return _0x2a46c8?{'count':_0x292169,'rows':_0x2a46c8}:null;}})[_0x541e('0x27')](respondWithResult(_0x2815d6,null))['catch'](handleError(_0x2815d6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 7867cfa..1fa2533 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9a19,0x114));var _0x99a1=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x9a19[_0xd09668];return _0x68726;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x45739d,_0x2de7df){var _0x2247df=function(_0x1ffdf3){while(--_0x1ffdf3){_0x45739d['push'](_0x45739d['shift']());}};_0x2247df(++_0x2de7df);}(_0xa41a,0x6b));var _0xaa41=function(_0x241c47,_0x17b6f4){_0x241c47=_0x241c47-0x0;var _0x361b5a=_0xa41a[_0x241c47];return _0x361b5a;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('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 fd7b215..9cd4342 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 _0x4d85=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x4d85,0x12e));var _0x54d8=function(_0x41d505,_0x4bb480){_0x41d505=_0x41d505-0x0;var _0x45e857=_0x4d85[_0x41d505];return _0x45e857;};'use strict';var _=require(_0x54d8('0x0'));var util=require(_0x54d8('0x1'));var moment=require(_0x54d8('0x2'));var BPromise=require(_0x54d8('0x3'));var rs=require(_0x54d8('0x4'));var fs=require('fs');var Redis=require(_0x54d8('0x5'));var db=require(_0x54d8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54d8('0x7'));var config=require(_0x54d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54d8('0x9')][_0x54d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf122ca,_0x2ef417,_0x518b6d){return new BPromise(function(_0xd93e8b,_0x4fac01){return client['request'](_0xf122ca,_0x518b6d)['then'](function(_0x1c25b0){logger[_0x54d8('0xb')](_0x54d8('0xc'),_0x2ef417,_0x54d8('0xd'));logger['debug'](_0x54d8('0xe'),_0x2ef417,_0x54d8('0xd'),JSON[_0x54d8('0xf')](_0x1c25b0));if(_0x1c25b0[_0x54d8('0x10')]){if(_0x1c25b0[_0x54d8('0x10')][_0x54d8('0x11')]===0x1f4){logger[_0x54d8('0x10')](_0x54d8('0xc'),_0x2ef417,_0x1c25b0[_0x54d8('0x10')][_0x54d8('0x12')]);return _0x4fac01(_0x1c25b0[_0x54d8('0x10')][_0x54d8('0x12')]);}logger[_0x54d8('0x10')](_0x54d8('0xc'),_0x2ef417,_0x1c25b0['error'][_0x54d8('0x12')]);return _0xd93e8b(_0x1c25b0[_0x54d8('0x10')][_0x54d8('0x12')]);}else{logger[_0x54d8('0xb')](_0x54d8('0xc'),_0x2ef417,_0x54d8('0xd'));_0xd93e8b(_0x1c25b0['result'][_0x54d8('0x12')]);}})['catch'](function(_0x16cf18){logger['error'](_0x54d8('0xc'),_0x2ef417,_0x16cf18);_0x4fac01(_0x16cf18);});});} \ No newline at end of file +var _0x3853=['error','code','message','catch','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5eb182,_0x118510){var _0xa99c78=function(_0x24d504){while(--_0x24d504){_0x5eb182['push'](_0x5eb182['shift']());}};_0xa99c78(++_0x118510);}(_0x3853,0x12a));var _0x3385=function(_0x2cf3c4,_0x476354){_0x2cf3c4=_0x2cf3c4-0x0;var _0x4c898f=_0x3853[_0x2cf3c4];return _0x4c898f;};'use strict';var _=require('lodash');var util=require(_0x3385('0x0'));var moment=require('moment');var BPromise=require(_0x3385('0x1'));var rs=require(_0x3385('0x2'));var fs=require('fs');var Redis=require(_0x3385('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3385('0x4'));var config=require(_0x3385('0x5'));var jayson=require(_0x3385('0x6'));var client=jayson[_0x3385('0x7')][_0x3385('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x107be2,_0x409cc7,_0x58c0d1){return new BPromise(function(_0x571bc5,_0x275f70){return client[_0x3385('0x9')](_0x107be2,_0x58c0d1)[_0x3385('0xa')](function(_0xe7d190){logger[_0x3385('0xb')](_0x3385('0xc'),_0x409cc7,'request\x20sent');logger[_0x3385('0xd')](_0x3385('0xe'),_0x409cc7,_0x3385('0xf'),JSON[_0x3385('0x10')](_0xe7d190));if(_0xe7d190['error']){if(_0xe7d190[_0x3385('0x11')][_0x3385('0x12')]===0x1f4){logger[_0x3385('0x11')](_0x3385('0xc'),_0x409cc7,_0xe7d190['error'][_0x3385('0x13')]);return _0x275f70(_0xe7d190['error']['message']);}logger[_0x3385('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x409cc7,_0xe7d190[_0x3385('0x11')][_0x3385('0x13')]);return _0x571bc5(_0xe7d190[_0x3385('0x11')]['message']);}else{logger[_0x3385('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x409cc7,_0x3385('0xf'));_0x571bc5(_0xe7d190['result'][_0x3385('0x13')]);}})[_0x3385('0x14')](function(_0x898065){logger[_0x3385('0x11')](_0x3385('0xc'),_0x409cc7,_0x898065);_0x275f70(_0x898065);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8591a20..5608524 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 _0x6e8f=['../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x401c21,_0x2e16d5){var _0x1a320e=function(_0x48065e){while(--_0x48065e){_0x401c21['push'](_0x401c21['shift']());}};_0x1a320e(++_0x2e16d5);}(_0x6e8f,0x13d));var _0xf6e8=function(_0x2bfab4,_0xa044e4){_0x2bfab4=_0x2bfab4-0x0;var _0x26b2f3=_0x6e8f[_0x2bfab4];return _0x26b2f3;};'use strict';var multer=require(_0xf6e8('0x0'));var util=require(_0xf6e8('0x1'));var path=require(_0xf6e8('0x2'));var timeout=require(_0xf6e8('0x3'));var express=require('express');var router=express[_0xf6e8('0x4')]();var fs_extra=require(_0xf6e8('0x5'));var auth=require(_0xf6e8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf6e8('0x7'));var controller=require(_0xf6e8('0x8'));router[_0xf6e8('0x9')]('/',auth[_0xf6e8('0xa')](),controller[_0xf6e8('0xb')]);router[_0xf6e8('0x9')](_0xf6e8('0xc'),auth[_0xf6e8('0xa')](),controller[_0xf6e8('0xd')]);router[_0xf6e8('0xe')]('/',auth[_0xf6e8('0xa')](),controller[_0xf6e8('0xf')]);router[_0xf6e8('0x10')](_0xf6e8('0xc'),auth[_0xf6e8('0xa')](),controller['update']);router['delete'](_0xf6e8('0xc'),auth[_0xf6e8('0xa')](),controller[_0xf6e8('0x11')]);module[_0xf6e8('0x12')]=router; \ No newline at end of file +var _0x7c2f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util'];(function(_0x3f5619,_0x3de345){var _0x5428cb=function(_0x3819aa){while(--_0x3819aa){_0x3f5619['push'](_0x3f5619['shift']());}};_0x5428cb(++_0x3de345);}(_0x7c2f,0x18e));var _0xf7c2=function(_0x3d4a1b,_0x198962){_0x3d4a1b=_0x3d4a1b-0x0;var _0x2ed213=_0x7c2f[_0x3d4a1b];return _0x2ed213;};'use strict';var multer=require(_0xf7c2('0x0'));var util=require(_0xf7c2('0x1'));var path=require(_0xf7c2('0x2'));var timeout=require(_0xf7c2('0x3'));var express=require(_0xf7c2('0x4'));var router=express[_0xf7c2('0x5')]();var fs_extra=require(_0xf7c2('0x6'));var auth=require(_0xf7c2('0x7'));var interaction=require(_0xf7c2('0x8'));var config=require('../../config/environment');var controller=require(_0xf7c2('0x9'));router[_0xf7c2('0xa')]('/',auth[_0xf7c2('0xb')](),controller[_0xf7c2('0xc')]);router['get'](_0xf7c2('0xd'),auth['isAuthenticated'](),controller[_0xf7c2('0xe')]);router[_0xf7c2('0xf')]('/',auth[_0xf7c2('0xb')](),controller[_0xf7c2('0x10')]);router['put'](_0xf7c2('0xd'),auth[_0xf7c2('0xb')](),controller['update']);router[_0xf7c2('0x11')](_0xf7c2('0xd'),auth[_0xf7c2('0xb')](),controller[_0xf7c2('0x12')]);module[_0xf7c2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index d885ce2..29861e8 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 _0x378f=['STRING','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x39c469,_0x38c16f){var _0x1405d5=function(_0x3e3508){while(--_0x3e3508){_0x39c469['push'](_0x39c469['shift']());}};_0x1405d5(++_0x38c16f);}(_0x378f,0x1cf));var _0xf378=function(_0x4ae6de,_0x41c995){_0x4ae6de=_0x4ae6de-0x0;var _0x180782=_0x378f[_0x4ae6de];return _0x180782;};'use strict';var Sequelize=require('sequelize');module[_0xf378('0x0')]={'type':{'type':Sequelize[_0xf378('0x1')](_0xf378('0x2'),_0xf378('0x3'),_0xf378('0x4'),'keyValue',_0xf378('0x5')),'defaultValue':_0xf378('0x2')},'content':{'type':Sequelize[_0xf378('0x6')]},'key':{'type':Sequelize[_0xf378('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xf378('0x2'),_0xf378('0x3'),_0xf378('0x4'))},'keyContent':{'type':Sequelize[_0xf378('0x6')]},'idField':{'type':Sequelize[_0xf378('0x6')]},'nameField':{'type':Sequelize[_0xf378('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf378('0x6')]}}; \ No newline at end of file +var _0xa52b=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x413b45,_0x282bb0){var _0x3ea265=function(_0x512a6f){while(--_0x512a6f){_0x413b45['push'](_0x413b45['shift']());}};_0x3ea265(++_0x282bb0);}(_0xa52b,0x1e9));var _0xba52=function(_0x4f51da,_0x3c7442){_0x4f51da=_0x4f51da-0x0;var _0x2d8c69=_0xa52b[_0x4f51da];return _0x2d8c69;};'use strict';var Sequelize=require(_0xba52('0x0'));module[_0xba52('0x1')]={'type':{'type':Sequelize[_0xba52('0x2')](_0xba52('0x3'),_0xba52('0x4'),_0xba52('0x5'),_0xba52('0x6'),_0xba52('0x7')),'defaultValue':_0xba52('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xba52('0x8')]},'keyType':{'type':Sequelize[_0xba52('0x2')](_0xba52('0x3'),_0xba52('0x4'),_0xba52('0x5'))},'keyContent':{'type':Sequelize[_0xba52('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba52('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 9d4f812..e7ba4b9 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 _0x91f0=['show','params','keys','attributes','length','find','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x91f0,0x131));var _0x091f=function(_0x339f57,_0x372158){_0x339f57=_0x339f57-0x0;var _0x5a54ae=_0x91f0[_0x339f57];return _0x5a54ae;};'use strict';var emlformat=require(_0x091f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x091f('0x1'));var rp=require(_0x091f('0x2'));var moment=require(_0x091f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x091f('0x4'));var util=require(_0x091f('0x5'));var path=require(_0x091f('0x6'));var sox=require(_0x091f('0x7'));var csv=require('to-csv');var ejs=require(_0x091f('0x8'));var fs=require('fs');var fs_extra=require(_0x091f('0x9'));var _=require(_0x091f('0xa'));var squel=require(_0x091f('0xb'));var crypto=require(_0x091f('0xc'));var jsforce=require(_0x091f('0xd'));var deskjs=require(_0x091f('0xe'));var toCsv=require(_0x091f('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x091f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x091f('0x11'));var as=require(_0x091f('0x12'));var hardwareService=require(_0x091f('0x13'));var logger=require(_0x091f('0x14'))(_0x091f('0x15'));var utils=require('../../config/utils');var config=require(_0x091f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4c16,_0x1bc533){_0x1bc533=_0x1bc533||0xcc;return function(_0x95de90){if(_0x95de90){return _0x5d4c16['sendStatus'](_0x1bc533);}return _0x5d4c16[_0x091f('0x17')](_0x1bc533)[_0x091f('0x18')]();};}function respondWithResult(_0x27ddeb,_0x6e7b03){_0x6e7b03=_0x6e7b03||0xc8;return function(_0x3687a6){if(_0x3687a6){return _0x27ddeb[_0x091f('0x17')](_0x6e7b03)['json'](_0x3687a6);}};}function respondWithFilteredResult(_0x3c4141,_0x2fbc6a){return function(_0x4a3fb4){if(_0x4a3fb4){var _0x1d654=typeof _0x2fbc6a['offset']===_0x091f('0x19')&&typeof _0x2fbc6a[_0x091f('0x1a')]===_0x091f('0x19');var _0x32c091=_0x4a3fb4[_0x091f('0x1b')];var _0x60c2ae=_0x1d654?0x0:_0x2fbc6a[_0x091f('0x1c')];var _0x584aee=_0x1d654?_0x4a3fb4[_0x091f('0x1b')]:_0x2fbc6a['offset']+_0x2fbc6a[_0x091f('0x1a')];var _0x49d76b;if(_0x584aee>=_0x32c091){_0x584aee=_0x32c091;_0x49d76b=0xc8;}else{_0x49d76b=0xce;}_0x3c4141[_0x091f('0x17')](_0x49d76b);return _0x3c4141[_0x091f('0x1d')](_0x091f('0x1e'),_0x60c2ae+'-'+_0x584aee+'/'+_0x32c091)['json'](_0x4a3fb4);}return null;};}function patchUpdates(_0x5eb8d7){return function(_0xe94049){try{jsonpatch[_0x091f('0x1f')](_0xe94049,_0x5eb8d7,!![]);}catch(_0x2cb8e2){return BPromise[_0x091f('0x20')](_0x2cb8e2);}return _0xe94049['save']();};}function saveUpdates(_0x2af04a,_0x19204a){return function(_0x194cc8){if(_0x194cc8){return _0x194cc8[_0x091f('0x21')](_0x2af04a)[_0x091f('0x22')](function(_0x49fed8){return _0x49fed8;});}return null;};}function removeEntity(_0x1bbc36,_0x592331){return function(_0x536fcd){if(_0x536fcd){return _0x536fcd['destroy']()[_0x091f('0x22')](function(){_0x1bbc36[_0x091f('0x17')](0xcc)[_0x091f('0x18')]();});}};}function handleEntityNotFound(_0x52aa0f,_0x41b312){return function(_0x41f0f3){if(!_0x41f0f3){_0x52aa0f[_0x091f('0x23')](0x194);}return _0x41f0f3;};}function handleError(_0x337db8,_0x449731){_0x449731=_0x449731||0x1f4;return function(_0x284aec){logger[_0x091f('0x24')](_0x284aec[_0x091f('0x25')]);if(_0x284aec[_0x091f('0x26')]){delete _0x284aec[_0x091f('0x26')];}_0x337db8[_0x091f('0x17')](_0x449731)[_0x091f('0x27')](_0x284aec);};}exports[_0x091f('0x28')]=function(_0x54320e,_0x14ddb8){var _0xc61567={},_0x19968c={},_0x29bf48={'count':0x0,'rows':[]};var _0x4edfe4=_['map'](db[_0x091f('0x29')][_0x091f('0x2a')],function(_0x4078d1){return{'name':_0x4078d1[_0x091f('0x2b')],'type':_0x4078d1[_0x091f('0x2c')][_0x091f('0x2d')]};});_0x19968c[_0x091f('0x2e')]=_[_0x091f('0x2f')](_0x4edfe4,_0x091f('0x26'));_0x19968c['query']=_['keys'](_0x54320e['query']);_0x19968c[_0x091f('0x30')]=_[_0x091f('0x31')](_0x19968c[_0x091f('0x2e')],_0x19968c[_0x091f('0x32')]);_0xc61567['attributes']=_['intersection'](_0x19968c[_0x091f('0x2e')],qs[_0x091f('0x33')](_0x54320e[_0x091f('0x32')]['fields']));_0xc61567['attributes']=_0xc61567['attributes']['length']?_0xc61567['attributes']:_0x19968c[_0x091f('0x2e')];if(!_0x54320e[_0x091f('0x32')]['hasOwnProperty'](_0x091f('0x34'))){_0xc61567[_0x091f('0x1a')]=qs[_0x091f('0x1a')](_0x54320e['query']['limit']);_0xc61567[_0x091f('0x1c')]=qs[_0x091f('0x1c')](_0x54320e[_0x091f('0x32')][_0x091f('0x1c')]);}_0xc61567[_0x091f('0x35')]=qs[_0x091f('0x36')](_0x54320e[_0x091f('0x32')][_0x091f('0x36')]);_0xc61567[_0x091f('0x37')]=qs[_0x091f('0x30')](_[_0x091f('0x38')](_0x54320e[_0x091f('0x32')],_0x19968c[_0x091f('0x30')]),_0x4edfe4);if(_0x54320e[_0x091f('0x32')][_0x091f('0x39')]){_0xc61567[_0x091f('0x37')]=_[_0x091f('0x3a')](_0xc61567[_0x091f('0x37')],{'$or':_[_0x091f('0x2f')](_0x4edfe4,function(_0x54dc7c){if(_0x54dc7c[_0x091f('0x2c')]!==_0x091f('0x3b')){var _0x3097fb={};_0x3097fb[_0x54dc7c[_0x091f('0x26')]]={'$like':'%'+_0x54320e[_0x091f('0x32')]['filter']+'%'};return _0x3097fb;}})});}_0xc61567=_[_0x091f('0x3a')]({},_0xc61567,_0x54320e[_0x091f('0x3c')]);var _0x51919e={'where':_0xc61567[_0x091f('0x37')]};return db[_0x091f('0x29')][_0x091f('0x1b')](_0x51919e)[_0x091f('0x22')](function(_0x1c3d58){_0x29bf48[_0x091f('0x1b')]=_0x1c3d58;if(_0x54320e['query'][_0x091f('0x3d')]){_0xc61567['include']=[{'all':!![]}];}return db[_0x091f('0x29')][_0x091f('0x3e')](_0xc61567);})[_0x091f('0x22')](function(_0x21ac42){_0x29bf48[_0x091f('0x3f')]=_0x21ac42;return _0x29bf48;})['then'](respondWithFilteredResult(_0x14ddb8,_0xc61567))[_0x091f('0x40')](handleError(_0x14ddb8,null));};exports[_0x091f('0x41')]=function(_0x14c34b,_0x323359){var _0x23aaf8={'raw':!![],'where':{'id':_0x14c34b[_0x091f('0x42')]['id']}},_0x1f79d0={};_0x1f79d0[_0x091f('0x2e')]=_[_0x091f('0x43')](db[_0x091f('0x29')][_0x091f('0x2a')]);_0x1f79d0[_0x091f('0x32')]=_[_0x091f('0x43')](_0x14c34b[_0x091f('0x32')]);_0x1f79d0[_0x091f('0x30')]=_[_0x091f('0x31')](_0x1f79d0[_0x091f('0x2e')],_0x1f79d0[_0x091f('0x32')]);_0x23aaf8[_0x091f('0x44')]=_[_0x091f('0x31')](_0x1f79d0[_0x091f('0x2e')],qs[_0x091f('0x33')](_0x14c34b[_0x091f('0x32')][_0x091f('0x33')]));_0x23aaf8['attributes']=_0x23aaf8[_0x091f('0x44')][_0x091f('0x45')]?_0x23aaf8[_0x091f('0x44')]:_0x1f79d0['model'];if(_0x14c34b[_0x091f('0x32')][_0x091f('0x3d')]){_0x23aaf8['include']=[{'all':!![]}];}_0x23aaf8=_[_0x091f('0x3a')]({},_0x23aaf8,_0x14c34b[_0x091f('0x3c')]);return db[_0x091f('0x29')][_0x091f('0x46')](_0x23aaf8)[_0x091f('0x22')](handleEntityNotFound(_0x323359,null))[_0x091f('0x22')](respondWithResult(_0x323359,null))['catch'](handleError(_0x323359,null));};exports[_0x091f('0x47')]=function(_0x5985ca,_0x5c8606){return db[_0x091f('0x29')][_0x091f('0x47')](_0x5985ca['body'],{})['then'](respondWithResult(_0x5c8606,0xc9))[_0x091f('0x40')](handleError(_0x5c8606,null));};exports['update']=function(_0x5f3f17,_0xc31775){if(_0x5f3f17[_0x091f('0x48')]['id']){delete _0x5f3f17[_0x091f('0x48')]['id'];}return db[_0x091f('0x29')][_0x091f('0x46')]({'where':{'id':_0x5f3f17['params']['id']}})['then'](handleEntityNotFound(_0xc31775,null))[_0x091f('0x22')](saveUpdates(_0x5f3f17[_0x091f('0x48')],null))[_0x091f('0x22')](respondWithResult(_0xc31775,null))[_0x091f('0x40')](handleError(_0xc31775,null));};exports[_0x091f('0x49')]=function(_0x351671,_0x3cb3ac){return db[_0x091f('0x29')][_0x091f('0x46')]({'where':{'id':_0x351671[_0x091f('0x42')]['id']}})['then'](handleEntityNotFound(_0x3cb3ac,null))['then'](removeEntity(_0x3cb3ac,null))[_0x091f('0x40')](handleError(_0x3cb3ac,null));}; \ No newline at end of file +var _0xdbc0=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','reject','save','then','destroy','error','stack','name','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x25e78f,_0x1a678e){var _0x21d3ea=function(_0x16fc99){while(--_0x16fc99){_0x25e78f['push'](_0x25e78f['shift']());}};_0x21d3ea(++_0x1a678e);}(_0xdbc0,0x15f));var _0x0dbc=function(_0x2dffff,_0x2ae95a){_0x2dffff=_0x2dffff-0x0;var _0x452114=_0xdbc0[_0x2dffff];return _0x452114;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0dbc('0x0'));var jsonpatch=require(_0x0dbc('0x1'));var rp=require('request-promise');var moment=require(_0x0dbc('0x2'));var BPromise=require(_0x0dbc('0x3'));var Mustache=require(_0x0dbc('0x4'));var util=require(_0x0dbc('0x5'));var path=require(_0x0dbc('0x6'));var sox=require(_0x0dbc('0x7'));var csv=require(_0x0dbc('0x8'));var ejs=require(_0x0dbc('0x9'));var fs=require('fs');var fs_extra=require(_0x0dbc('0xa'));var _=require('lodash');var squel=require(_0x0dbc('0xb'));var crypto=require(_0x0dbc('0xc'));var jsforce=require(_0x0dbc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0dbc('0x8'));var querystring=require(_0x0dbc('0xe'));var Papa=require(_0x0dbc('0xf'));var Redis=require(_0x0dbc('0x10'));var authService=require(_0x0dbc('0x11'));var qs=require(_0x0dbc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dbc('0x13'));var logger=require(_0x0dbc('0x14'))(_0x0dbc('0x15'));var utils=require(_0x0dbc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0dbc('0x17'));var db=require(_0x0dbc('0x18'))['db'];function respondWithStatusCode(_0x5df41c,_0x5806bf){_0x5806bf=_0x5806bf||0xcc;return function(_0x18ac55){if(_0x18ac55){return _0x5df41c[_0x0dbc('0x19')](_0x5806bf);}return _0x5df41c[_0x0dbc('0x1a')](_0x5806bf)[_0x0dbc('0x1b')]();};}function respondWithResult(_0x2409c1,_0x586fdf){_0x586fdf=_0x586fdf||0xc8;return function(_0x17898d){if(_0x17898d){return _0x2409c1[_0x0dbc('0x1a')](_0x586fdf)[_0x0dbc('0x1c')](_0x17898d);}};}function respondWithFilteredResult(_0x5d9b7b,_0x3f5a73){return function(_0xeda680){if(_0xeda680){var _0x3b0d25=typeof _0x3f5a73[_0x0dbc('0x1d')]==='undefined'&&typeof _0x3f5a73['limit']==='undefined';var _0x3c1102=_0xeda680['count'];var _0x169c1a=_0x3b0d25?0x0:_0x3f5a73['offset'];var _0x5a127e=_0x3b0d25?_0xeda680[_0x0dbc('0x1e')]:_0x3f5a73['offset']+_0x3f5a73[_0x0dbc('0x1f')];var _0x148890;if(_0x5a127e>=_0x3c1102){_0x5a127e=_0x3c1102;_0x148890=0xc8;}else{_0x148890=0xce;}_0x5d9b7b[_0x0dbc('0x1a')](_0x148890);return _0x5d9b7b[_0x0dbc('0x20')]('Content-Range',_0x169c1a+'-'+_0x5a127e+'/'+_0x3c1102)[_0x0dbc('0x1c')](_0xeda680);}return null;};}function patchUpdates(_0x2202c9){return function(_0x26cace){try{jsonpatch['apply'](_0x26cace,_0x2202c9,!![]);}catch(_0x4e7fea){return BPromise[_0x0dbc('0x21')](_0x4e7fea);}return _0x26cace[_0x0dbc('0x22')]();};}function saveUpdates(_0x59c3d0,_0x5a37b7){return function(_0x2a8885){if(_0x2a8885){return _0x2a8885['update'](_0x59c3d0)[_0x0dbc('0x23')](function(_0x1f72c9){return _0x1f72c9;});}return null;};}function removeEntity(_0x38e784,_0x4f76b8){return function(_0x26ece3){if(_0x26ece3){return _0x26ece3[_0x0dbc('0x24')]()['then'](function(){_0x38e784['status'](0xcc)[_0x0dbc('0x1b')]();});}};}function handleEntityNotFound(_0x28e455,_0xcc6f65){return function(_0x516958){if(!_0x516958){_0x28e455['sendStatus'](0x194);}return _0x516958;};}function handleError(_0x133dc4,_0x550ba9){_0x550ba9=_0x550ba9||0x1f4;return function(_0x41459e){logger[_0x0dbc('0x25')](_0x41459e[_0x0dbc('0x26')]);if(_0x41459e['name']){delete _0x41459e[_0x0dbc('0x27')];}_0x133dc4[_0x0dbc('0x1a')](_0x550ba9)['send'](_0x41459e);};}exports['index']=function(_0x4155a2,_0x22aad9){var _0x5f3bb4={},_0x3e3f21={},_0x5e63d3={'count':0x0,'rows':[]};var _0x6ecfc=_[_0x0dbc('0x28')](db[_0x0dbc('0x29')][_0x0dbc('0x2a')],function(_0xb23043){return{'name':_0xb23043[_0x0dbc('0x2b')],'type':_0xb23043[_0x0dbc('0x2c')][_0x0dbc('0x2d')]};});_0x3e3f21[_0x0dbc('0x2e')]=_[_0x0dbc('0x28')](_0x6ecfc,_0x0dbc('0x27'));_0x3e3f21['query']=_[_0x0dbc('0x2f')](_0x4155a2[_0x0dbc('0x30')]);_0x3e3f21[_0x0dbc('0x31')]=_[_0x0dbc('0x32')](_0x3e3f21['model'],_0x3e3f21['query']);_0x5f3bb4[_0x0dbc('0x33')]=_[_0x0dbc('0x32')](_0x3e3f21[_0x0dbc('0x2e')],qs['fields'](_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x34')]));_0x5f3bb4[_0x0dbc('0x33')]=_0x5f3bb4[_0x0dbc('0x33')][_0x0dbc('0x35')]?_0x5f3bb4['attributes']:_0x3e3f21[_0x0dbc('0x2e')];if(!_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x36')]('nolimit')){_0x5f3bb4[_0x0dbc('0x1f')]=qs[_0x0dbc('0x1f')](_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x1f')]);_0x5f3bb4['offset']=qs[_0x0dbc('0x1d')](_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x1d')]);}_0x5f3bb4[_0x0dbc('0x37')]=qs[_0x0dbc('0x38')](_0x4155a2['query'][_0x0dbc('0x38')]);_0x5f3bb4['where']=qs[_0x0dbc('0x31')](_[_0x0dbc('0x39')](_0x4155a2[_0x0dbc('0x30')],_0x3e3f21[_0x0dbc('0x31')]),_0x6ecfc);if(_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x3a')]){_0x5f3bb4[_0x0dbc('0x3b')]=_['merge'](_0x5f3bb4[_0x0dbc('0x3b')],{'$or':_[_0x0dbc('0x28')](_0x6ecfc,function(_0x3ae801){if(_0x3ae801[_0x0dbc('0x2c')]!=='VIRTUAL'){var _0x3a04af={};_0x3a04af[_0x3ae801[_0x0dbc('0x27')]]={'$like':'%'+_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x3a')]+'%'};return _0x3a04af;}})});}_0x5f3bb4=_[_0x0dbc('0x3c')]({},_0x5f3bb4,_0x4155a2['options']);var _0x5a89de={'where':_0x5f3bb4[_0x0dbc('0x3b')]};return db[_0x0dbc('0x29')][_0x0dbc('0x1e')](_0x5a89de)[_0x0dbc('0x23')](function(_0x45464c){_0x5e63d3[_0x0dbc('0x1e')]=_0x45464c;if(_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x3d')]){_0x5f3bb4[_0x0dbc('0x3e')]=[{'all':!![]}];}return db[_0x0dbc('0x29')][_0x0dbc('0x3f')](_0x5f3bb4);})[_0x0dbc('0x23')](function(_0x3072a8){_0x5e63d3[_0x0dbc('0x40')]=_0x3072a8;return _0x5e63d3;})[_0x0dbc('0x23')](respondWithFilteredResult(_0x22aad9,_0x5f3bb4))['catch'](handleError(_0x22aad9,null));};exports[_0x0dbc('0x41')]=function(_0xce626b,_0x30158b){var _0x3f3bfb={'raw':!![],'where':{'id':_0xce626b[_0x0dbc('0x42')]['id']}},_0x27d414={};_0x27d414[_0x0dbc('0x2e')]=_['keys'](db[_0x0dbc('0x29')]['rawAttributes']);_0x27d414[_0x0dbc('0x30')]=_[_0x0dbc('0x2f')](_0xce626b[_0x0dbc('0x30')]);_0x27d414[_0x0dbc('0x31')]=_[_0x0dbc('0x32')](_0x27d414[_0x0dbc('0x2e')],_0x27d414[_0x0dbc('0x30')]);_0x3f3bfb[_0x0dbc('0x33')]=_[_0x0dbc('0x32')](_0x27d414['model'],qs[_0x0dbc('0x34')](_0xce626b[_0x0dbc('0x30')][_0x0dbc('0x34')]));_0x3f3bfb[_0x0dbc('0x33')]=_0x3f3bfb[_0x0dbc('0x33')][_0x0dbc('0x35')]?_0x3f3bfb[_0x0dbc('0x33')]:_0x27d414[_0x0dbc('0x2e')];if(_0xce626b['query'][_0x0dbc('0x3d')]){_0x3f3bfb[_0x0dbc('0x3e')]=[{'all':!![]}];}_0x3f3bfb=_[_0x0dbc('0x3c')]({},_0x3f3bfb,_0xce626b[_0x0dbc('0x43')]);return db[_0x0dbc('0x29')][_0x0dbc('0x44')](_0x3f3bfb)[_0x0dbc('0x23')](handleEntityNotFound(_0x30158b,null))['then'](respondWithResult(_0x30158b,null))[_0x0dbc('0x45')](handleError(_0x30158b,null));};exports[_0x0dbc('0x46')]=function(_0x441349,_0xcfe6a8){return db[_0x0dbc('0x29')][_0x0dbc('0x46')](_0x441349[_0x0dbc('0x47')],{})[_0x0dbc('0x23')](respondWithResult(_0xcfe6a8,0xc9))[_0x0dbc('0x45')](handleError(_0xcfe6a8,null));};exports[_0x0dbc('0x48')]=function(_0x35c95b,_0x27ab0f){if(_0x35c95b[_0x0dbc('0x47')]['id']){delete _0x35c95b[_0x0dbc('0x47')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x35c95b[_0x0dbc('0x42')]['id']}})[_0x0dbc('0x23')](handleEntityNotFound(_0x27ab0f,null))[_0x0dbc('0x23')](saveUpdates(_0x35c95b['body'],null))['then'](respondWithResult(_0x27ab0f,null))[_0x0dbc('0x45')](handleError(_0x27ab0f,null));};exports[_0x0dbc('0x24')]=function(_0x250735,_0x2b138d){return db['Dynamics365Field'][_0x0dbc('0x44')]({'where':{'id':_0x250735[_0x0dbc('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b138d,null))[_0x0dbc('0x23')](removeEntity(_0x2b138d,null))[_0x0dbc('0x45')](handleError(_0x2b138d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1c18c4e..c3affd9 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 _0x7c14=['lodash','util','../../config/logger','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x2309db,_0x2ac192){var _0x28fcb2=function(_0x562ce0){while(--_0x562ce0){_0x2309db['push'](_0x2309db['shift']());}};_0x28fcb2(++_0x2ac192);}(_0x7c14,0xea));var _0x47c1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7c14[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x47c1('0x0'));var util=require(_0x47c1('0x1'));var logger=require(_0x47c1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x47c1('0x3'));var fs=require('fs');var path=require(_0x47c1('0x4'));var rimraf=require('rimraf');var config=require(_0x47c1('0x5'));var attributes=require(_0x47c1('0x6'));module[_0x47c1('0x7')]=function(_0x537fc1,_0x5aa2f6){return _0x537fc1['define'](_0x47c1('0x8'),attributes,{'tableName':_0x47c1('0x9'),'paranoid':![],'indexes':[{'name':_0x47c1('0xa'),'fields':[_0x47c1('0xb'),_0x47c1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19a8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','lodash'];(function(_0xee2ea6,_0xd39723){var _0x5a449d=function(_0x1d5575){while(--_0x1d5575){_0xee2ea6['push'](_0xee2ea6['shift']());}};_0x5a449d(++_0xd39723);}(_0x19a8,0x81));var _0x819a=function(_0x1e21e8,_0x1f3894){_0x1e21e8=_0x1e21e8-0x0;var _0x4191d3=_0x19a8[_0x1e21e8];return _0x4191d3;};'use strict';var _=require(_0x819a('0x0'));var util=require('util');var logger=require(_0x819a('0x1'))(_0x819a('0x2'));var moment=require(_0x819a('0x3'));var BPromise=require(_0x819a('0x4'));var rp=require(_0x819a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x819a('0x6'));var config=require(_0x819a('0x7'));var attributes=require(_0x819a('0x8'));module[_0x819a('0x9')]=function(_0x699672,_0x5a0e4d){return _0x699672[_0x819a('0xa')](_0x819a('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x819a('0xc'),'fields':['idField','FieldId'],'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 46fb8a1..afe3d5d 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 _0x660b=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x415ba5,_0x54bcc0){var _0x30423e=function(_0x2fbea7){while(--_0x2fbea7){_0x415ba5['push'](_0x415ba5['shift']());}};_0x30423e(++_0x54bcc0);}(_0x660b,0xab));var _0xb660=function(_0x51462a,_0x1e978e){_0x51462a=_0x51462a-0x0;var _0x302a5e=_0x660b[_0x51462a];return _0x302a5e;};'use strict';var _=require(_0xb660('0x0'));var util=require(_0xb660('0x1'));var moment=require(_0xb660('0x2'));var BPromise=require(_0xb660('0x3'));var rs=require(_0xb660('0x4'));var fs=require('fs');var Redis=require(_0xb660('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb660('0x6'));var config=require(_0xb660('0x7'));var jayson=require(_0xb660('0x8'));var client=jayson[_0xb660('0x9')][_0xb660('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f40ad,_0x25898b,_0x5b39bc){return new BPromise(function(_0x4ffd4b,_0x5ad882){return client[_0xb660('0xb')](_0x3f40ad,_0x5b39bc)['then'](function(_0x2a9b5d){logger[_0xb660('0xc')](_0xb660('0xd'),_0x25898b,_0xb660('0xe'));logger[_0xb660('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x25898b,_0xb660('0xe'),JSON[_0xb660('0x10')](_0x2a9b5d));if(_0x2a9b5d[_0xb660('0x11')]){if(_0x2a9b5d[_0xb660('0x11')][_0xb660('0x12')]===0x1f4){logger['error'](_0xb660('0xd'),_0x25898b,_0x2a9b5d[_0xb660('0x11')][_0xb660('0x13')]);return _0x5ad882(_0x2a9b5d['error'][_0xb660('0x13')]);}logger[_0xb660('0x11')](_0xb660('0xd'),_0x25898b,_0x2a9b5d[_0xb660('0x11')][_0xb660('0x13')]);return _0x4ffd4b(_0x2a9b5d[_0xb660('0x11')][_0xb660('0x13')]);}else{logger[_0xb660('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x25898b,'request\x20sent');_0x4ffd4b(_0x2a9b5d['result'][_0xb660('0x13')]);}})[_0xb660('0x14')](function(_0x191837){logger['error'](_0xb660('0xd'),_0x25898b,_0x191837);_0x5ad882(_0x191837);});});} \ No newline at end of file +var _0x0a17=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xc81f5f,_0x181205){var _0x4410dc=function(_0x3cf9a5){while(--_0x3cf9a5){_0xc81f5f['push'](_0xc81f5f['shift']());}};_0x4410dc(++_0x181205);}(_0x0a17,0xca));var _0x70a1=function(_0x5b168a,_0x396949){_0x5b168a=_0x5b168a-0x0;var _0x30e146=_0x0a17[_0x5b168a];return _0x30e146;};'use strict';var _=require(_0x70a1('0x0'));var util=require(_0x70a1('0x1'));var moment=require(_0x70a1('0x2'));var BPromise=require(_0x70a1('0x3'));var rs=require(_0x70a1('0x4'));var fs=require('fs');var Redis=require(_0x70a1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x70a1('0x6'));var logger=require(_0x70a1('0x7'))(_0x70a1('0x8'));var config=require('../../config/environment');var jayson=require(_0x70a1('0x9'));var client=jayson[_0x70a1('0xa')][_0x70a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8fbc71,_0x1c1a4,_0x6b6cac){return new BPromise(function(_0x3078f5,_0x348dd5){return client[_0x70a1('0xc')](_0x8fbc71,_0x6b6cac)[_0x70a1('0xd')](function(_0x1aeaf8){logger[_0x70a1('0xe')](_0x70a1('0xf'),_0x1c1a4,_0x70a1('0x10'));logger[_0x70a1('0x11')](_0x70a1('0x12'),_0x1c1a4,_0x70a1('0x10'),JSON[_0x70a1('0x13')](_0x1aeaf8));if(_0x1aeaf8[_0x70a1('0x14')]){if(_0x1aeaf8[_0x70a1('0x14')][_0x70a1('0x15')]===0x1f4){logger[_0x70a1('0x14')](_0x70a1('0xf'),_0x1c1a4,_0x1aeaf8[_0x70a1('0x14')][_0x70a1('0x16')]);return _0x348dd5(_0x1aeaf8[_0x70a1('0x14')][_0x70a1('0x16')]);}logger['error'](_0x70a1('0xf'),_0x1c1a4,_0x1aeaf8[_0x70a1('0x14')]['message']);return _0x3078f5(_0x1aeaf8[_0x70a1('0x14')][_0x70a1('0x16')]);}else{logger[_0x70a1('0xe')](_0x70a1('0xf'),_0x1c1a4,_0x70a1('0x10'));_0x3078f5(_0x1aeaf8[_0x70a1('0x17')][_0x70a1('0x16')]);}})[_0x70a1('0x18')](function(_0x8e114e){logger[_0x70a1('0x14')](_0x70a1('0xf'),_0x1c1a4,_0x8e114e);_0x348dd5(_0x8e114e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2fbcbb1..24a1284 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 _0xbe2a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x6aef36,_0x501c76){var _0x29132a=function(_0x31b92a){while(--_0x31b92a){_0x6aef36['push'](_0x6aef36['shift']());}};_0x29132a(++_0x501c76);}(_0xbe2a,0x164));var _0xabe2=function(_0x31cf9d,_0x15832d){_0x31cf9d=_0x31cf9d-0x0;var _0x1162e8=_0xbe2a[_0x31cf9d];return _0x1162e8;};'use strict';var multer=require(_0xabe2('0x0'));var util=require(_0xabe2('0x1'));var path=require(_0xabe2('0x2'));var timeout=require(_0xabe2('0x3'));var express=require(_0xabe2('0x4'));var router=express[_0xabe2('0x5')]();var fs_extra=require(_0xabe2('0x6'));var auth=require(_0xabe2('0x7'));var interaction=require(_0xabe2('0x8'));var config=require(_0xabe2('0x9'));var controller=require('./intFreshdeskAccount.controller');router[_0xabe2('0xa')]('/',auth['isAuthenticated'](),controller[_0xabe2('0xb')]);router[_0xabe2('0xa')](_0xabe2('0xc'),auth[_0xabe2('0xd')](),controller['show']);router['get']('/:id/configurations',auth[_0xabe2('0xd')](),controller[_0xabe2('0xe')]);router[_0xabe2('0xa')](_0xabe2('0xf'),auth['isAuthenticated'](),controller[_0xabe2('0x10')]);router[_0xabe2('0x11')]('/',auth['isAuthenticated'](),controller[_0xabe2('0x12')]);router[_0xabe2('0x11')]('/:id/configurations',auth[_0xabe2('0xd')](),controller[_0xabe2('0x13')]);router[_0xabe2('0x14')](_0xabe2('0xc'),auth[_0xabe2('0xd')](),controller['update']);router[_0xabe2('0x15')](_0xabe2('0xc'),auth[_0xabe2('0xd')](),controller[_0xabe2('0x16')]);module[_0xabe2('0x17')]=router; \ No newline at end of file +var _0xe03a=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports'];(function(_0xaa833d,_0x3e7f43){var _0x243c3f=function(_0x2ac323){while(--_0x2ac323){_0xaa833d['push'](_0xaa833d['shift']());}};_0x243c3f(++_0x3e7f43);}(_0xe03a,0x159));var _0xae03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe03a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xae03('0x0'));var util=require(_0xae03('0x1'));var path=require(_0xae03('0x2'));var timeout=require('connect-timeout');var express=require(_0xae03('0x3'));var router=express[_0xae03('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xae03('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xae03('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0xae03('0x7')]('/',auth[_0xae03('0x8')](),controller[_0xae03('0x9')]);router[_0xae03('0x7')](_0xae03('0xa'),auth[_0xae03('0x8')](),controller[_0xae03('0xb')]);router[_0xae03('0x7')](_0xae03('0xc'),auth[_0xae03('0x8')](),controller[_0xae03('0xd')]);router[_0xae03('0x7')](_0xae03('0xe'),auth[_0xae03('0x8')](),controller[_0xae03('0xf')]);router[_0xae03('0x10')]('/',auth['isAuthenticated'](),controller[_0xae03('0x11')]);router[_0xae03('0x10')]('/:id/configurations',auth[_0xae03('0x8')](),controller[_0xae03('0x12')]);router['put'](_0xae03('0xa'),auth[_0xae03('0x8')](),controller[_0xae03('0x13')]);router[_0xae03('0x14')](_0xae03('0xa'),auth[_0xae03('0x8')](),controller[_0xae03('0x15')]);module[_0xae03('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 996cca5..2c47ba2 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 _0x7096=['exports','STRING','username','remoteUri'];(function(_0x2e9a07,_0x5ce478){var _0x22e52d=function(_0x3071bb){while(--_0x3071bb){_0x2e9a07['push'](_0x2e9a07['shift']());}};_0x22e52d(++_0x5ce478);}(_0x7096,0x10c));var _0x6709=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7096[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6a95=['exports','STRING','username','sequelize'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x6a95,0x1db));var _0x56a9=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x6a95[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('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 7e5e6d2..3b0ad38 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 _0x1be1=['send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','merge','where','VIRTUAL','options','FreshdeskAccount','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','pick','length','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','subject','agent','description','group','source','ticket_type','company','remove','includes','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','status','set','json','apply','reject','save','then','destroy','error','stack','name'];(function(_0x3d3715,_0x27e2ba){var _0x343802=function(_0x38dd89){while(--_0x38dd89){_0x3d3715['push'](_0x3d3715['shift']());}};_0x343802(++_0x27e2ba);}(_0x1be1,0x192));var _0x11be=function(_0x1c9a8d,_0x44f9eb){_0x1c9a8d=_0x1c9a8d-0x0;var _0x4bd1d7=_0x1be1[_0x1c9a8d];return _0x4bd1d7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3ff31f,_0x2dad05){_0x2dad05=_0x2dad05||0xcc;return function(_0x4ce3ae){if(_0x4ce3ae){return _0x3ff31f[_0x11be('0x17')](_0x2dad05);}return _0x3ff31f['status'](_0x2dad05)['end']();};}function respondWithResult(_0x569842,_0x4b6e7e){_0x4b6e7e=_0x4b6e7e||0xc8;return function(_0x4e4efd){if(_0x4e4efd){return _0x569842['status'](_0x4b6e7e)['json'](_0x4e4efd);}};}function respondWithFilteredResult(_0x2280e2,_0x52bbef){return function(_0x31047c){if(_0x31047c){var _0x241eec=typeof _0x52bbef[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x52bbef['limit']===_0x11be('0x19');var _0x403d7a=_0x31047c['count'];var _0x299f45=_0x241eec?0x0:_0x52bbef[_0x11be('0x18')];var _0x23aa5f=_0x241eec?_0x31047c['count']:_0x52bbef['offset']+_0x52bbef[_0x11be('0x1a')];var _0x976e51;if(_0x23aa5f>=_0x403d7a){_0x23aa5f=_0x403d7a;_0x976e51=0xc8;}else{_0x976e51=0xce;}_0x2280e2[_0x11be('0x1b')](_0x976e51);return _0x2280e2[_0x11be('0x1c')]('Content-Range',_0x299f45+'-'+_0x23aa5f+'/'+_0x403d7a)[_0x11be('0x1d')](_0x31047c);}return null;};}function patchUpdates(_0x45136f){return function(_0x1c6dd4){try{jsonpatch[_0x11be('0x1e')](_0x1c6dd4,_0x45136f,!![]);}catch(_0x7c554a){return BPromise[_0x11be('0x1f')](_0x7c554a);}return _0x1c6dd4[_0x11be('0x20')]();};}function saveUpdates(_0x17678d,_0x3aea14){return function(_0x2782ae){if(_0x2782ae){return _0x2782ae['update'](_0x17678d)[_0x11be('0x21')](function(_0x46b7c2){return _0x46b7c2;});}return null;};}function removeEntity(_0x2fe43c,_0x5d1690){return function(_0x4b329b){if(_0x4b329b){return _0x4b329b[_0x11be('0x22')]()[_0x11be('0x21')](function(){_0x2fe43c[_0x11be('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x106167,_0x518e2b){return function(_0x46111f){if(!_0x46111f){_0x106167['sendStatus'](0x194);}return _0x46111f;};}function handleError(_0x28310d,_0xb11f3d){_0xb11f3d=_0xb11f3d||0x1f4;return function(_0x5002d7){logger[_0x11be('0x23')](_0x5002d7[_0x11be('0x24')]);if(_0x5002d7[_0x11be('0x25')]){delete _0x5002d7[_0x11be('0x25')];}_0x28310d[_0x11be('0x1b')](_0xb11f3d)[_0x11be('0x26')](_0x5002d7);};}exports[_0x11be('0x27')]=function(_0x2cf9aa,_0x43ab30){var _0x5966c5={},_0x32c796={},_0x4e899f={'count':0x0,'rows':[]};var _0x182f6b=_[_0x11be('0x28')](db['FreshdeskAccount']['rawAttributes'],function(_0x49fd5c){return{'name':_0x49fd5c[_0x11be('0x29')],'type':_0x49fd5c[_0x11be('0x2a')][_0x11be('0x2b')]};});_0x32c796[_0x11be('0x2c')]=_[_0x11be('0x28')](_0x182f6b,_0x11be('0x25'));_0x32c796[_0x11be('0x2d')]=_[_0x11be('0x2e')](_0x2cf9aa['query']);_0x32c796[_0x11be('0x2f')]=_[_0x11be('0x30')](_0x32c796[_0x11be('0x2c')],_0x32c796[_0x11be('0x2d')]);_0x5966c5[_0x11be('0x31')]=_[_0x11be('0x30')](_0x32c796['model'],qs[_0x11be('0x32')](_0x2cf9aa[_0x11be('0x2d')][_0x11be('0x32')]));_0x5966c5[_0x11be('0x31')]=_0x5966c5[_0x11be('0x31')]['length']?_0x5966c5[_0x11be('0x31')]:_0x32c796[_0x11be('0x2c')];if(!_0x2cf9aa[_0x11be('0x2d')]['hasOwnProperty'](_0x11be('0x33'))){_0x5966c5['limit']=qs['limit'](_0x2cf9aa['query']['limit']);_0x5966c5[_0x11be('0x18')]=qs[_0x11be('0x18')](_0x2cf9aa[_0x11be('0x2d')]['offset']);}_0x5966c5[_0x11be('0x34')]=qs[_0x11be('0x35')](_0x2cf9aa['query'][_0x11be('0x35')]);_0x5966c5['where']=qs[_0x11be('0x2f')](_['pick'](_0x2cf9aa[_0x11be('0x2d')],_0x32c796[_0x11be('0x2f')]),_0x182f6b);if(_0x2cf9aa[_0x11be('0x2d')][_0x11be('0x36')]){_0x5966c5['where']=_[_0x11be('0x37')](_0x5966c5[_0x11be('0x38')],{'$or':_[_0x11be('0x28')](_0x182f6b,function(_0x18d402){if(_0x18d402['type']!==_0x11be('0x39')){var _0x361877={};_0x361877[_0x18d402[_0x11be('0x25')]]={'$like':'%'+_0x2cf9aa[_0x11be('0x2d')][_0x11be('0x36')]+'%'};return _0x361877;}})});}_0x5966c5=_[_0x11be('0x37')]({},_0x5966c5,_0x2cf9aa[_0x11be('0x3a')]);var _0x5ee47c={'where':_0x5966c5[_0x11be('0x38')]};return db[_0x11be('0x3b')]['count'](_0x5ee47c)[_0x11be('0x21')](function(_0x28df0f){_0x4e899f['count']=_0x28df0f;if(_0x2cf9aa[_0x11be('0x2d')]['includeAll']){_0x5966c5[_0x11be('0x3c')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x11be('0x3d')](_0x5966c5);})[_0x11be('0x21')](function(_0x5db494){_0x4e899f[_0x11be('0x3e')]=_0x5db494;return _0x4e899f;})['then'](respondWithFilteredResult(_0x43ab30,_0x5966c5))[_0x11be('0x3f')](handleError(_0x43ab30,null));};exports[_0x11be('0x40')]=function(_0x2deae3,_0x383604){var _0x2b847a={'raw':![],'where':{'id':_0x2deae3[_0x11be('0x41')]['id']}},_0x182c28={};_0x182c28['model']=_[_0x11be('0x2e')](db[_0x11be('0x3b')][_0x11be('0x42')]);_0x182c28[_0x11be('0x2d')]=_['keys'](_0x2deae3['query']);_0x182c28['filters']=_[_0x11be('0x30')](_0x182c28['model'],_0x182c28[_0x11be('0x2d')]);_0x2b847a['attributes']=_[_0x11be('0x30')](_0x182c28[_0x11be('0x2c')],qs[_0x11be('0x32')](_0x2deae3[_0x11be('0x2d')][_0x11be('0x32')]));_0x2b847a[_0x11be('0x31')]=_0x2b847a[_0x11be('0x31')]['length']?_0x2b847a[_0x11be('0x31')]:_0x182c28['model'];if(_0x2deae3[_0x11be('0x2d')][_0x11be('0x43')]){_0x2b847a[_0x11be('0x3c')]=[{'all':!![]}];}_0x2b847a=_['merge']({},_0x2b847a,_0x2deae3['options']);return db['FreshdeskAccount'][_0x11be('0x44')](_0x2b847a)[_0x11be('0x21')](handleEntityNotFound(_0x383604,null))['then'](respondWithResult(_0x383604,null))['catch'](handleError(_0x383604,null));};exports['create']=function(_0x44e2e8,_0x1dfece){return db[_0x11be('0x3b')][_0x11be('0x45')](_0x44e2e8[_0x11be('0x46')],{})[_0x11be('0x21')](respondWithResult(_0x1dfece,0xc9))[_0x11be('0x3f')](handleError(_0x1dfece,null));};exports[_0x11be('0x47')]=function(_0x2ce110,_0x205582){if(_0x2ce110[_0x11be('0x46')]['id']){delete _0x2ce110['body']['id'];}return db[_0x11be('0x3b')][_0x11be('0x44')]({'where':{'id':_0x2ce110['params']['id']}})['then'](handleEntityNotFound(_0x205582,null))['then'](saveUpdates(_0x2ce110[_0x11be('0x46')],null))['then'](respondWithResult(_0x205582,null))[_0x11be('0x3f')](handleError(_0x205582,null));};exports[_0x11be('0x22')]=function(_0x2716dc,_0x1fb48d){return db[_0x11be('0x3b')][_0x11be('0x44')]({'where':{'id':_0x2716dc[_0x11be('0x41')]['id']}})[_0x11be('0x21')](handleEntityNotFound(_0x1fb48d,null))[_0x11be('0x21')](removeEntity(_0x1fb48d,null))['catch'](handleError(_0x1fb48d,null));};exports[_0x11be('0x48')]=function(_0x4ad866,_0x1737ef,_0x2e74f0){var _0x5a776a={};var _0x46f15b={};var _0x1164a4;var _0x4c0e37;return db[_0x11be('0x3b')][_0x11be('0x49')]({'where':{'id':_0x4ad866['params']['id']}})['then'](handleEntityNotFound(_0x1737ef,null))[_0x11be('0x21')](function(_0x2886ac){if(_0x2886ac){_0x1164a4=_0x2886ac;_0x46f15b['model']=_['keys'](db[_0x11be('0x4a')][_0x11be('0x42')]);_0x46f15b[_0x11be('0x2d')]=_['keys'](_0x4ad866['query']);_0x46f15b['filters']=_[_0x11be('0x30')](_0x46f15b[_0x11be('0x2c')],_0x46f15b[_0x11be('0x2d')]);_0x5a776a['attributes']=_['intersection'](_0x46f15b[_0x11be('0x2c')],qs[_0x11be('0x32')](_0x4ad866[_0x11be('0x2d')][_0x11be('0x32')]));_0x5a776a['attributes']=_0x5a776a[_0x11be('0x31')]['length']?_0x5a776a['attributes']:_0x46f15b['model'];_0x5a776a['order']=qs[_0x11be('0x35')](_0x4ad866[_0x11be('0x2d')][_0x11be('0x35')]);_0x5a776a[_0x11be('0x38')]=qs[_0x11be('0x2f')](_[_0x11be('0x4b')](_0x4ad866[_0x11be('0x2d')],_0x46f15b['filters']));if(_0x4ad866['query'][_0x11be('0x36')]){_0x5a776a[_0x11be('0x38')]=_[_0x11be('0x37')](_0x5a776a[_0x11be('0x38')],{'$or':_[_0x11be('0x28')](_0x5a776a[_0x11be('0x31')],function(_0xb56259){var _0x3816ab={};_0x3816ab[_0xb56259]={'$like':'%'+_0x4ad866[_0x11be('0x2d')]['filter']+'%'};return _0x3816ab;})});}_0x5a776a=_[_0x11be('0x37')]({},_0x5a776a,_0x4ad866[_0x11be('0x3a')]);return _0x1164a4[_0x11be('0x48')](_0x5a776a);}})['then'](function(_0x3b3cf9){if(_0x3b3cf9){_0x4c0e37=_0x3b3cf9[_0x11be('0x4c')];if(!_0x4ad866['query']['hasOwnProperty'](_0x11be('0x33'))){_0x5a776a[_0x11be('0x1a')]=qs[_0x11be('0x1a')](_0x4ad866[_0x11be('0x2d')]['limit']);_0x5a776a[_0x11be('0x18')]=qs[_0x11be('0x18')](_0x4ad866[_0x11be('0x2d')][_0x11be('0x18')]);}return _0x1164a4[_0x11be('0x48')](_0x5a776a);}})[_0x11be('0x21')](function(_0x44c88d){if(_0x44c88d){return _0x44c88d?{'count':_0x4c0e37,'rows':_0x44c88d}:null;}})[_0x11be('0x21')](respondWithResult(_0x1737ef,null))[_0x11be('0x3f')](handleError(_0x1737ef,null));};exports['addConfiguration']=function(_0x558a57,_0x9237ea,_0x138156){if(_0x558a57['body']['id']){delete _0x558a57[_0x11be('0x46')]['id'];}return db[_0x11be('0x3b')][_0x11be('0x49')]({'where':{'id':_0x558a57[_0x11be('0x41')]['id']}})[_0x11be('0x21')](handleEntityNotFound(_0x9237ea,null))[_0x11be('0x21')](function(_0x308599){if(_0x308599){_0x558a57['body']['AccountId']=_0x308599['id'];_0x558a57[_0x11be('0x46')][_0x11be('0x4d')]=integrations[_0x11be('0x4e')](_0x558a57['body'][_0x11be('0x4f')],_0x558a57[_0x11be('0x46')][_0x11be('0x2a')]);_0x558a57[_0x11be('0x46')][_0x11be('0x50')]=integrations[_0x11be('0x51')](_0x558a57[_0x11be('0x46')][_0x11be('0x4f')],_0x558a57[_0x11be('0x46')][_0x11be('0x2a')]);return db[_0x11be('0x4a')][_0x11be('0x45')](_0x558a57[_0x11be('0x46')],{'include':[{'model':db[_0x11be('0x52')],'as':_0x11be('0x4d')},{'model':db[_0x11be('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x9237ea,null))[_0x11be('0x3f')](handleError(_0x9237ea,null));};exports['getFields']=function(_0x1c92cd,_0xbe1daf,_0x422e33){var _0x2f895f='';return db[_0x11be('0x3b')][_0x11be('0x49')]({'where':{'id':_0x1c92cd[_0x11be('0x41')]['id']},'attributes':['id',_0x11be('0x53'),_0x11be('0x54')]})['then'](handleEntityNotFound(_0xbe1daf,null))[_0x11be('0x21')](function(_0x3b34f0){if(_0x3b34f0){_0x2f895f=_0x3b34f0[_0x11be('0x53')];var _0x534ac7=_0x2f895f[_0x11be('0x55')](-0x1);if(_0x534ac7==='/'){_0x2f895f=_0x2f895f[_0x11be('0x56')](0x0,_0x2f895f['lastIndexOf'](_0x534ac7));}return rp({'method':'GET','uri':util['format']('%s/%s',_0x2f895f,_0x11be('0x57')),'headers':{'Authorization':util[_0x11be('0x58')](_0x11be('0x59'),new Buffer(util[_0x11be('0x58')](_0x11be('0x5a'),_0x3b34f0['apiKey']))[_0x11be('0x5b')](_0x11be('0x5c')))},'json':!![]});}})[_0x11be('0x21')](function(_0x363d6e){if(_0x363d6e){var _0x1a3d16=['requester',_0x11be('0x5d'),_0x11be('0x5e'),_0x11be('0x5f'),_0x11be('0x1b'),'priority',_0x11be('0x60'),_0x11be('0x61'),_0x11be('0x62'),_0x11be('0x60'),_0x11be('0x63')];_[_0x11be('0x64')](_0x363d6e,function(_0x4f6d8d){return _0x1a3d16[_0x11be('0x65')](_0x4f6d8d[_0x11be('0x25')])||!_0x4f6d8d[_0x11be('0x66')]&&_0x4f6d8d[_0x11be('0x2a')]!=='custom_text'&&_0x4f6d8d[_0x11be('0x2a')]!=='custom_dropdown';});return{'count':_0x363d6e[_0x11be('0x4c')],'rows':_[_0x11be('0x28')](_0x363d6e,function(_0x181ddb){return{'id':_0x181ddb[_0x11be('0x25')],'name':_0x181ddb['label'],'custom':!_0x181ddb[_0x11be('0x66')],'options':_0x181ddb[_0x11be('0x67')]?_['map'](_0x181ddb[_0x11be('0x67')],function(_0x219eb){return{'name':_[_0x11be('0x68')](_0x219eb),'value':_0x219eb};}):[]};})};}})[_0x11be('0x21')](respondWithResult(_0xbe1daf,null))['catch'](function(_0x1f1223){var _0x2ab4ce=_0x1c92cd[_0x11be('0x2d')][_0x11be('0x69')]?0x1f4:_0x1f1223[_0x11be('0x6a')]||0x1f4;logger[_0x11be('0x23')](_0x11be('0x6b'),_0x11be('0x6c'),_0x2ab4ce,JSON['stringify'](_0x1f1223));delete _0x1f1223[_0x11be('0x25')];if(_0x2ab4ce===0x191){_0x2ab4ce=0x190;}_0xbe1daf['status'](_0x2ab4ce)['send'](_0x1c92cd[_0x11be('0x2d')][_0x11be('0x69')]?{'message':_0x11be('0x6d'),'statusCode':_0x1f1223[_0x11be('0x6a')]}:_0x1f1223);});}; \ No newline at end of file +var _0x5088=['includeAll','findAll','catch','show','params','include','create','body','find','findOne','FreshdeskConfiguration','length','pick','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','remoteUri','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','requester','subject','agent','description','priority','group','source','company','remove','includes','custom_text','label','default','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','options','FreshdeskAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5088,0xa9));var _0x8508=function(_0x7be910,_0x2b381b){_0x7be910=_0x7be910-0x0;var _0x496ddf=_0x5088[_0x7be910];return _0x496ddf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8508('0x0'));var zipdir=require(_0x8508('0x1'));var jsonpatch=require(_0x8508('0x2'));var rp=require(_0x8508('0x3'));var moment=require('moment');var BPromise=require(_0x8508('0x4'));var Mustache=require(_0x8508('0x5'));var util=require(_0x8508('0x6'));var path=require(_0x8508('0x7'));var sox=require('sox');var csv=require(_0x8508('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8508('0x9'));var _=require(_0x8508('0xa'));var squel=require('squel');var crypto=require(_0x8508('0xb'));var jsforce=require(_0x8508('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8508('0x8'));var querystring=require(_0x8508('0xd'));var Papa=require(_0x8508('0xe'));var Redis=require(_0x8508('0xf'));var authService=require(_0x8508('0x10'));var qs=require(_0x8508('0x11'));var as=require(_0x8508('0x12'));var hardwareService=require(_0x8508('0x13'));var logger=require(_0x8508('0x14'))('api');var utils=require(_0x8508('0x15'));var config=require(_0x8508('0x16'));var licenseUtil=require(_0x8508('0x17'));var db=require(_0x8508('0x18'))['db'];var integrations=require(_0x8508('0x19'));function respondWithStatusCode(_0x129d4c,_0x2a6969){_0x2a6969=_0x2a6969||0xcc;return function(_0x4a6157){if(_0x4a6157){return _0x129d4c[_0x8508('0x1a')](_0x2a6969);}return _0x129d4c[_0x8508('0x1b')](_0x2a6969)[_0x8508('0x1c')]();};}function respondWithResult(_0x431b14,_0x4c4bf9){_0x4c4bf9=_0x4c4bf9||0xc8;return function(_0x318bad){if(_0x318bad){return _0x431b14[_0x8508('0x1b')](_0x4c4bf9)['json'](_0x318bad);}};}function respondWithFilteredResult(_0x34da29,_0x4f81c7){return function(_0xe8daa7){if(_0xe8daa7){var _0x1a67a6=typeof _0x4f81c7[_0x8508('0x1d')]===_0x8508('0x1e')&&typeof _0x4f81c7[_0x8508('0x1f')]==='undefined';var _0x1884d4=_0xe8daa7[_0x8508('0x20')];var _0x4e5dd6=_0x1a67a6?0x0:_0x4f81c7['offset'];var _0xa16f92=_0x1a67a6?_0xe8daa7['count']:_0x4f81c7[_0x8508('0x1d')]+_0x4f81c7[_0x8508('0x1f')];var _0x237b09;if(_0xa16f92>=_0x1884d4){_0xa16f92=_0x1884d4;_0x237b09=0xc8;}else{_0x237b09=0xce;}_0x34da29['status'](_0x237b09);return _0x34da29[_0x8508('0x21')](_0x8508('0x22'),_0x4e5dd6+'-'+_0xa16f92+'/'+_0x1884d4)[_0x8508('0x23')](_0xe8daa7);}return null;};}function patchUpdates(_0x1da402){return function(_0x38e8f0){try{jsonpatch[_0x8508('0x24')](_0x38e8f0,_0x1da402,!![]);}catch(_0x87e3f){return BPromise[_0x8508('0x25')](_0x87e3f);}return _0x38e8f0[_0x8508('0x26')]();};}function saveUpdates(_0x34ee74,_0x455594){return function(_0x4e9610){if(_0x4e9610){return _0x4e9610[_0x8508('0x27')](_0x34ee74)[_0x8508('0x28')](function(_0x43fa1b){return _0x43fa1b;});}return null;};}function removeEntity(_0x5874b2,_0x1efffd){return function(_0x17d458){if(_0x17d458){return _0x17d458[_0x8508('0x29')]()['then'](function(){_0x5874b2[_0x8508('0x1b')](0xcc)[_0x8508('0x1c')]();});}};}function handleEntityNotFound(_0x373c86,_0x2ccf2d){return function(_0x575191){if(!_0x575191){_0x373c86['sendStatus'](0x194);}return _0x575191;};}function handleError(_0x3dcdff,_0x4d872c){_0x4d872c=_0x4d872c||0x1f4;return function(_0x3b43f7){logger['error'](_0x3b43f7[_0x8508('0x2a')]);if(_0x3b43f7[_0x8508('0x2b')]){delete _0x3b43f7[_0x8508('0x2b')];}_0x3dcdff[_0x8508('0x1b')](_0x4d872c)['send'](_0x3b43f7);};}exports[_0x8508('0x2c')]=function(_0x3d0d71,_0x473363){var _0x4e51db={},_0x68f48c={},_0x4f9cbf={'count':0x0,'rows':[]};var _0x22d664=_[_0x8508('0x2d')](db['FreshdeskAccount'][_0x8508('0x2e')],function(_0x5e6fd9){return{'name':_0x5e6fd9['fieldName'],'type':_0x5e6fd9[_0x8508('0x2f')]['key']};});_0x68f48c[_0x8508('0x30')]=_[_0x8508('0x2d')](_0x22d664,'name');_0x68f48c[_0x8508('0x31')]=_[_0x8508('0x32')](_0x3d0d71[_0x8508('0x31')]);_0x68f48c[_0x8508('0x33')]=_[_0x8508('0x34')](_0x68f48c['model'],_0x68f48c[_0x8508('0x31')]);_0x4e51db[_0x8508('0x35')]=_[_0x8508('0x34')](_0x68f48c['model'],qs[_0x8508('0x36')](_0x3d0d71[_0x8508('0x31')][_0x8508('0x36')]));_0x4e51db[_0x8508('0x35')]=_0x4e51db['attributes']['length']?_0x4e51db[_0x8508('0x35')]:_0x68f48c[_0x8508('0x30')];if(!_0x3d0d71[_0x8508('0x31')]['hasOwnProperty'](_0x8508('0x37'))){_0x4e51db[_0x8508('0x1f')]=qs[_0x8508('0x1f')](_0x3d0d71['query']['limit']);_0x4e51db[_0x8508('0x1d')]=qs['offset'](_0x3d0d71['query'][_0x8508('0x1d')]);}_0x4e51db[_0x8508('0x38')]=qs[_0x8508('0x39')](_0x3d0d71[_0x8508('0x31')][_0x8508('0x39')]);_0x4e51db['where']=qs[_0x8508('0x33')](_['pick'](_0x3d0d71['query'],_0x68f48c[_0x8508('0x33')]),_0x22d664);if(_0x3d0d71[_0x8508('0x31')][_0x8508('0x3a')]){_0x4e51db[_0x8508('0x3b')]=_[_0x8508('0x3c')](_0x4e51db[_0x8508('0x3b')],{'$or':_['map'](_0x22d664,function(_0x5a79b4){if(_0x5a79b4[_0x8508('0x2f')]!=='VIRTUAL'){var _0x6a170={};_0x6a170[_0x5a79b4[_0x8508('0x2b')]]={'$like':'%'+_0x3d0d71[_0x8508('0x31')][_0x8508('0x3a')]+'%'};return _0x6a170;}})});}_0x4e51db=_[_0x8508('0x3c')]({},_0x4e51db,_0x3d0d71[_0x8508('0x3d')]);var _0xf2ea9f={'where':_0x4e51db[_0x8508('0x3b')]};return db[_0x8508('0x3e')][_0x8508('0x20')](_0xf2ea9f)[_0x8508('0x28')](function(_0x42e016){_0x4f9cbf[_0x8508('0x20')]=_0x42e016;if(_0x3d0d71[_0x8508('0x31')][_0x8508('0x3f')]){_0x4e51db['include']=[{'all':!![]}];}return db[_0x8508('0x3e')][_0x8508('0x40')](_0x4e51db);})[_0x8508('0x28')](function(_0xadbdc9){_0x4f9cbf['rows']=_0xadbdc9;return _0x4f9cbf;})['then'](respondWithFilteredResult(_0x473363,_0x4e51db))[_0x8508('0x41')](handleError(_0x473363,null));};exports[_0x8508('0x42')]=function(_0x1b8fe7,_0x491559){var _0x48adef={'raw':![],'where':{'id':_0x1b8fe7[_0x8508('0x43')]['id']}},_0x344520={};_0x344520[_0x8508('0x30')]=_['keys'](db['FreshdeskAccount'][_0x8508('0x2e')]);_0x344520[_0x8508('0x31')]=_[_0x8508('0x32')](_0x1b8fe7['query']);_0x344520[_0x8508('0x33')]=_[_0x8508('0x34')](_0x344520[_0x8508('0x30')],_0x344520[_0x8508('0x31')]);_0x48adef[_0x8508('0x35')]=_[_0x8508('0x34')](_0x344520[_0x8508('0x30')],qs['fields'](_0x1b8fe7[_0x8508('0x31')][_0x8508('0x36')]));_0x48adef['attributes']=_0x48adef[_0x8508('0x35')]['length']?_0x48adef[_0x8508('0x35')]:_0x344520[_0x8508('0x30')];if(_0x1b8fe7[_0x8508('0x31')][_0x8508('0x3f')]){_0x48adef[_0x8508('0x44')]=[{'all':!![]}];}_0x48adef=_[_0x8508('0x3c')]({},_0x48adef,_0x1b8fe7[_0x8508('0x3d')]);return db[_0x8508('0x3e')]['find'](_0x48adef)[_0x8508('0x28')](handleEntityNotFound(_0x491559,null))[_0x8508('0x28')](respondWithResult(_0x491559,null))[_0x8508('0x41')](handleError(_0x491559,null));};exports['create']=function(_0x3a1907,_0x5b8e41){return db[_0x8508('0x3e')][_0x8508('0x45')](_0x3a1907[_0x8508('0x46')],{})[_0x8508('0x28')](respondWithResult(_0x5b8e41,0xc9))['catch'](handleError(_0x5b8e41,null));};exports['update']=function(_0x2a8094,_0x773872){if(_0x2a8094[_0x8508('0x46')]['id']){delete _0x2a8094['body']['id'];}return db[_0x8508('0x3e')][_0x8508('0x47')]({'where':{'id':_0x2a8094['params']['id']}})[_0x8508('0x28')](handleEntityNotFound(_0x773872,null))['then'](saveUpdates(_0x2a8094[_0x8508('0x46')],null))[_0x8508('0x28')](respondWithResult(_0x773872,null))[_0x8508('0x41')](handleError(_0x773872,null));};exports[_0x8508('0x29')]=function(_0x2bbbd8,_0x4ce943){return db[_0x8508('0x3e')][_0x8508('0x47')]({'where':{'id':_0x2bbbd8[_0x8508('0x43')]['id']}})[_0x8508('0x28')](handleEntityNotFound(_0x4ce943,null))[_0x8508('0x28')](removeEntity(_0x4ce943,null))[_0x8508('0x41')](handleError(_0x4ce943,null));};exports['getConfigurations']=function(_0x3597b6,_0x27ce59,_0x3c48ac){var _0x33eaa0={};var _0x4ec8ce={};var _0x158057;var _0x5538bc;return db[_0x8508('0x3e')][_0x8508('0x48')]({'where':{'id':_0x3597b6[_0x8508('0x43')]['id']}})[_0x8508('0x28')](handleEntityNotFound(_0x27ce59,null))[_0x8508('0x28')](function(_0x74b6d7){if(_0x74b6d7){_0x158057=_0x74b6d7;_0x4ec8ce[_0x8508('0x30')]=_[_0x8508('0x32')](db[_0x8508('0x49')][_0x8508('0x2e')]);_0x4ec8ce[_0x8508('0x31')]=_[_0x8508('0x32')](_0x3597b6[_0x8508('0x31')]);_0x4ec8ce[_0x8508('0x33')]=_[_0x8508('0x34')](_0x4ec8ce[_0x8508('0x30')],_0x4ec8ce['query']);_0x33eaa0[_0x8508('0x35')]=_[_0x8508('0x34')](_0x4ec8ce[_0x8508('0x30')],qs[_0x8508('0x36')](_0x3597b6[_0x8508('0x31')]['fields']));_0x33eaa0[_0x8508('0x35')]=_0x33eaa0[_0x8508('0x35')][_0x8508('0x4a')]?_0x33eaa0[_0x8508('0x35')]:_0x4ec8ce[_0x8508('0x30')];_0x33eaa0[_0x8508('0x38')]=qs['sort'](_0x3597b6[_0x8508('0x31')][_0x8508('0x39')]);_0x33eaa0[_0x8508('0x3b')]=qs[_0x8508('0x33')](_[_0x8508('0x4b')](_0x3597b6[_0x8508('0x31')],_0x4ec8ce[_0x8508('0x33')]));if(_0x3597b6['query'][_0x8508('0x3a')]){_0x33eaa0[_0x8508('0x3b')]=_[_0x8508('0x3c')](_0x33eaa0[_0x8508('0x3b')],{'$or':_[_0x8508('0x2d')](_0x33eaa0['attributes'],function(_0x3b7f87){var _0x2405bc={};_0x2405bc[_0x3b7f87]={'$like':'%'+_0x3597b6[_0x8508('0x31')][_0x8508('0x3a')]+'%'};return _0x2405bc;})});}_0x33eaa0=_[_0x8508('0x3c')]({},_0x33eaa0,_0x3597b6[_0x8508('0x3d')]);return _0x158057[_0x8508('0x4c')](_0x33eaa0);}})['then'](function(_0x59db60){if(_0x59db60){_0x5538bc=_0x59db60[_0x8508('0x4a')];if(!_0x3597b6['query']['hasOwnProperty']('nolimit')){_0x33eaa0[_0x8508('0x1f')]=qs['limit'](_0x3597b6[_0x8508('0x31')][_0x8508('0x1f')]);_0x33eaa0[_0x8508('0x1d')]=qs['offset'](_0x3597b6[_0x8508('0x31')][_0x8508('0x1d')]);}return _0x158057[_0x8508('0x4c')](_0x33eaa0);}})['then'](function(_0x4cd10a){if(_0x4cd10a){return _0x4cd10a?{'count':_0x5538bc,'rows':_0x4cd10a}:null;}})[_0x8508('0x28')](respondWithResult(_0x27ce59,null))[_0x8508('0x41')](handleError(_0x27ce59,null));};exports[_0x8508('0x4d')]=function(_0x5559ab,_0x4fc9da,_0x105369){if(_0x5559ab[_0x8508('0x46')]['id']){delete _0x5559ab['body']['id'];}return db['FreshdeskAccount'][_0x8508('0x48')]({'where':{'id':_0x5559ab['params']['id']}})[_0x8508('0x28')](handleEntityNotFound(_0x4fc9da,null))[_0x8508('0x28')](function(_0x2d8714){if(_0x2d8714){_0x5559ab[_0x8508('0x46')][_0x8508('0x4e')]=_0x2d8714['id'];_0x5559ab[_0x8508('0x46')]['Subjects']=integrations[_0x8508('0x4f')](_0x5559ab[_0x8508('0x46')][_0x8508('0x50')],_0x5559ab['body'][_0x8508('0x2f')]);_0x5559ab[_0x8508('0x46')][_0x8508('0x51')]=integrations[_0x8508('0x52')](_0x5559ab[_0x8508('0x46')][_0x8508('0x50')],_0x5559ab['body'][_0x8508('0x2f')]);return db[_0x8508('0x49')][_0x8508('0x45')](_0x5559ab[_0x8508('0x46')],{'include':[{'model':db[_0x8508('0x53')],'as':_0x8508('0x54')},{'model':db[_0x8508('0x53')],'as':_0x8508('0x51')}]});}return null;})[_0x8508('0x28')](respondWithResult(_0x4fc9da,null))[_0x8508('0x41')](handleError(_0x4fc9da,null));};exports['getFields']=function(_0x360944,_0x5217f9,_0x601eb0){var _0x168eac='';return db[_0x8508('0x3e')][_0x8508('0x48')]({'where':{'id':_0x360944[_0x8508('0x43')]['id']},'attributes':['id',_0x8508('0x55'),'apiKey']})['then'](handleEntityNotFound(_0x5217f9,null))[_0x8508('0x28')](function(_0x4faa1c){if(_0x4faa1c){_0x168eac=_0x4faa1c['remoteUri'];var _0x47c04e=_0x168eac['slice'](-0x1);if(_0x47c04e==='/'){_0x168eac=_0x168eac['substring'](0x0,_0x168eac[_0x8508('0x56')](_0x47c04e));}return rp({'method':_0x8508('0x57'),'uri':util[_0x8508('0x58')]('%s/%s',_0x168eac,_0x8508('0x59')),'headers':{'Authorization':util[_0x8508('0x58')](_0x8508('0x5a'),new Buffer(util['format'](_0x8508('0x5b'),_0x4faa1c[_0x8508('0x5c')]))[_0x8508('0x5d')]('base64'))},'json':!![]});}})[_0x8508('0x28')](function(_0x2e77b2){if(_0x2e77b2){var _0x22eabf=[_0x8508('0x5e'),_0x8508('0x5f'),_0x8508('0x60'),_0x8508('0x61'),_0x8508('0x1b'),_0x8508('0x62'),_0x8508('0x63'),_0x8508('0x64'),'ticket_type',_0x8508('0x63'),_0x8508('0x65')];_[_0x8508('0x66')](_0x2e77b2,function(_0x31f73a){return _0x22eabf[_0x8508('0x67')](_0x31f73a['name'])||!_0x31f73a['default']&&_0x31f73a[_0x8508('0x2f')]!==_0x8508('0x68')&&_0x31f73a[_0x8508('0x2f')]!=='custom_dropdown';});return{'count':_0x2e77b2[_0x8508('0x4a')],'rows':_[_0x8508('0x2d')](_0x2e77b2,function(_0x468132){return{'id':_0x468132[_0x8508('0x2b')],'name':_0x468132[_0x8508('0x69')],'custom':!_0x468132[_0x8508('0x6a')],'options':_0x468132[_0x8508('0x6b')]?_['map'](_0x468132[_0x8508('0x6b')],function(_0x22a57a){return{'name':_[_0x8508('0x6c')](_0x22a57a),'value':_0x22a57a};}):[]};})};}})['then'](respondWithResult(_0x5217f9,null))[_0x8508('0x41')](function(_0x92efab){var _0x570f25=_0x360944[_0x8508('0x31')][_0x8508('0x6d')]?0x1f4:_0x92efab[_0x8508('0x6e')]||0x1f4;logger[_0x8508('0x6f')](_0x8508('0x70'),'getFields',_0x570f25,JSON[_0x8508('0x71')](_0x92efab));delete _0x92efab[_0x8508('0x2b')];if(_0x570f25===0x191){_0x570f25=0x190;}_0x5217f9[_0x8508('0x1b')](_0x570f25)[_0x8508('0x72')](_0x360944[_0x8508('0x31')][_0x8508('0x6d')]?{'message':_0x8508('0x73'),'statusCode':_0x92efab[_0x8508('0x6e')]}:_0x92efab);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 94a9d13..4f39616 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 _0xd37a=['bluebird','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment'];(function(_0x3f52d9,_0x1d748c){var _0x21e01f=function(_0x22e584){while(--_0x22e584){_0x3f52d9['push'](_0x3f52d9['shift']());}};_0x21e01f(++_0x1d748c);}(_0xd37a,0x98));var _0xad37=function(_0x449278,_0x23c0f6){_0x449278=_0x449278-0x0;var _0x55de44=_0xd37a[_0x449278];return _0x55de44;};'use strict';var _=require('lodash');var util=require(_0xad37('0x0'));var logger=require(_0xad37('0x1'))(_0xad37('0x2'));var moment=require(_0xad37('0x3'));var BPromise=require(_0xad37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad37('0x5'));var rimraf=require(_0xad37('0x6'));var config=require('../../config/environment');var attributes=require(_0xad37('0x7'));var integrations=require(_0xad37('0x8'));module[_0xad37('0x9')]=function(_0x449ace,_0x682d20){return _0x449ace[_0xad37('0xa')](_0xad37('0xb'),attributes,{'tableName':_0xad37('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0943=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0xa19cbd,_0x33d3f4){var _0x247cb0=function(_0x117823){while(--_0x117823){_0xa19cbd['push'](_0xa19cbd['shift']());}};_0x247cb0(++_0x33d3f4);}(_0x0943,0xa9));var _0x3094=function(_0xe8107,_0x11ffeb){_0xe8107=_0xe8107-0x0;var _0x43e8cf=_0x0943[_0xe8107];return _0x43e8cf;};'use strict';var _=require(_0x3094('0x0'));var util=require(_0x3094('0x1'));var logger=require(_0x3094('0x2'))(_0x3094('0x3'));var moment=require(_0x3094('0x4'));var BPromise=require(_0x3094('0x5'));var rp=require(_0x3094('0x6'));var fs=require('fs');var path=require(_0x3094('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3094('0x8'));var integrations=require(_0x3094('0x9'));module[_0x3094('0xa')]=function(_0x1aaac2,_0x79b6be){return _0x1aaac2[_0x3094('0xb')](_0x3094('0xc'),attributes,{'tableName':_0x3094('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 c12c0c8..fbce093 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 _0x70f3=['message','catch','FreshdeskAccount','findAll','raw','options','attributes','limit','map','include','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x70f3,0x1d5));var _0x370f=function(_0x49ed67,_0x5d5d06){_0x49ed67=_0x49ed67-0x0;var _0x2f0e59=_0x70f3[_0x49ed67];return _0x2f0e59;};'use strict';var _=require('lodash');var util=require(_0x370f('0x0'));var moment=require(_0x370f('0x1'));var BPromise=require(_0x370f('0x2'));var rs=require(_0x370f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x370f('0x4'))['db'];var utils=require(_0x370f('0x5'));var logger=require(_0x370f('0x6'))('rpc');var config=require(_0x370f('0x7'));var jayson=require(_0x370f('0x8'));var client=jayson[_0x370f('0x9')][_0x370f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7e0ad9,_0x2b9185,_0x5d72e7){return new BPromise(function(_0x4d98c4,_0x357926){return client[_0x370f('0xb')](_0x7e0ad9,_0x5d72e7)[_0x370f('0xc')](function(_0x531f7e){logger[_0x370f('0xd')](_0x370f('0xe'),_0x2b9185,_0x370f('0xf'));logger[_0x370f('0x10')](_0x370f('0x11'),_0x2b9185,_0x370f('0xf'),JSON[_0x370f('0x12')](_0x531f7e));if(_0x531f7e[_0x370f('0x13')]){if(_0x531f7e[_0x370f('0x13')][_0x370f('0x14')]===0x1f4){logger[_0x370f('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x2b9185,_0x531f7e['error'][_0x370f('0x15')]);return _0x357926(_0x531f7e['error']['message']);}logger[_0x370f('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x2b9185,_0x531f7e[_0x370f('0x13')][_0x370f('0x15')]);return _0x4d98c4(_0x531f7e[_0x370f('0x13')]['message']);}else{logger[_0x370f('0xd')](_0x370f('0xe'),_0x2b9185,_0x370f('0xf'));_0x4d98c4(_0x531f7e['result']['message']);}})[_0x370f('0x16')](function(_0x2e0859){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2b9185,_0x2e0859);_0x357926(_0x2e0859);});});}exports['GetFreshdeskAccount']=function(_0x314461){var _0x599464=this;return new Promise(function(_0x422a00,_0x52369d){return db[_0x370f('0x17')][_0x370f('0x18')]({'raw':_0x314461['options']?_0x314461['options'][_0x370f('0x19')]===undefined?!![]:![]:!![],'where':_0x314461[_0x370f('0x1a')]?_0x314461['options']['where']||null:null,'attributes':_0x314461[_0x370f('0x1a')]?_0x314461[_0x370f('0x1a')][_0x370f('0x1b')]||null:null,'limit':_0x314461[_0x370f('0x1a')]?_0x314461[_0x370f('0x1a')][_0x370f('0x1c')]||null:null,'include':_0x314461[_0x370f('0x1a')]?_0x314461['options']['include']?_[_0x370f('0x1d')](_0x314461[_0x370f('0x1a')][_0x370f('0x1e')],function(_0x43adb3){return{'model':db[_0x43adb3[_0x370f('0x1f')]],'as':_0x43adb3['as'],'attributes':_0x43adb3['attributes'],'include':_0x43adb3[_0x370f('0x1e')]?_[_0x370f('0x1d')](_0x43adb3[_0x370f('0x1e')],function(_0x315549){return{'model':db[_0x315549[_0x370f('0x1f')]],'as':_0x315549['as'],'attributes':_0x315549[_0x370f('0x1b')],'include':_0x315549['include']?_[_0x370f('0x1d')](_0x315549[_0x370f('0x1e')],function(_0x589e14){return{'model':db[_0x589e14[_0x370f('0x1f')]],'as':_0x589e14['as'],'attributes':_0x589e14[_0x370f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x370f('0xc')](function(_0x2b20c2){logger[_0x370f('0xd')](_0x370f('0x20'),_0x314461);logger[_0x370f('0x10')](_0x370f('0x20'),_0x314461,JSON[_0x370f('0x12')](_0x2b20c2));_0x422a00(_0x2b20c2);})['catch'](function(_0x171eb5){logger[_0x370f('0x13')]('GetFreshdeskAccount',_0x171eb5[_0x370f('0x15')],_0x314461);_0x52369d(_0x599464[_0x370f('0x13')](0x1f4,_0x171eb5[_0x370f('0x15')]));});});};exports[_0x370f('0x21')]=function(_0x4c9b0f){var _0x42d125=this;return new Promise(function(_0x3578c3,_0x27638b){return db[_0x370f('0x17')][_0x370f('0x22')]({'raw':_0x4c9b0f[_0x370f('0x1a')]?_0x4c9b0f[_0x370f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4c9b0f[_0x370f('0x1a')]?_0x4c9b0f[_0x370f('0x1a')]['where']||null:null,'attributes':_0x4c9b0f[_0x370f('0x1a')]?_0x4c9b0f[_0x370f('0x1a')][_0x370f('0x1b')]||null:null,'include':_0x4c9b0f[_0x370f('0x1a')]?_0x4c9b0f[_0x370f('0x1a')][_0x370f('0x1e')]?_[_0x370f('0x1d')](_0x4c9b0f['options']['include'],function(_0x4ae07b){return{'model':db[_0x4ae07b[_0x370f('0x1f')]],'as':_0x4ae07b['as'],'attributes':_0x4ae07b[_0x370f('0x1b')],'include':_0x4ae07b['include']?_[_0x370f('0x1d')](_0x4ae07b[_0x370f('0x1e')],function(_0x1c6f0e){return{'model':db[_0x1c6f0e[_0x370f('0x1f')]],'as':_0x1c6f0e['as'],'attributes':_0x1c6f0e[_0x370f('0x1b')],'include':_0x1c6f0e[_0x370f('0x1e')]?_[_0x370f('0x1d')](_0x1c6f0e[_0x370f('0x1e')],function(_0x3772d0){return{'model':db[_0x3772d0[_0x370f('0x1f')]],'as':_0x3772d0['as'],'attributes':_0x3772d0[_0x370f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x370f('0xc')](function(_0x4fe3ed){logger['info'](_0x370f('0x21'),_0x4c9b0f);logger[_0x370f('0x10')]('ShowFreshdeskAccount',_0x4c9b0f,JSON[_0x370f('0x12')](_0x4fe3ed));_0x3578c3(_0x4fe3ed);})[_0x370f('0x16')](function(_0x23d900){logger[_0x370f('0x13')](_0x370f('0x21'),_0x23d900['message'],_0x4c9b0f);_0x27638b(_0x42d125[_0x370f('0x13')](0x1f4,_0x23d900[_0x370f('0x15')]));});});}; \ No newline at end of file +var _0xdd86=['options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount'];(function(_0x1a07ef,_0x57325f){var _0x5b4edb=function(_0x1eee30){while(--_0x1eee30){_0x1a07ef['push'](_0x1a07ef['shift']());}};_0x5b4edb(++_0x57325f);}(_0xdd86,0x15d));var _0x6dd8=function(_0x82b064,_0x4f1d65){_0x82b064=_0x82b064-0x0;var _0x1b1f81=_0xdd86[_0x82b064];return _0x1b1f81;};'use strict';var _=require(_0x6dd8('0x0'));var util=require(_0x6dd8('0x1'));var moment=require(_0x6dd8('0x2'));var BPromise=require('bluebird');var rs=require(_0x6dd8('0x3'));var fs=require('fs');var Redis=require(_0x6dd8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6dd8('0x5'));var logger=require(_0x6dd8('0x6'))(_0x6dd8('0x7'));var config=require(_0x6dd8('0x8'));var jayson=require(_0x6dd8('0x9'));var client=jayson['client'][_0x6dd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ef54d,_0x153d35,_0x3aaf14){return new BPromise(function(_0x3e139f,_0x40a062){return client[_0x6dd8('0xb')](_0x2ef54d,_0x3aaf14)[_0x6dd8('0xc')](function(_0x5de94c){logger['info'](_0x6dd8('0xd'),_0x153d35,_0x6dd8('0xe'));logger[_0x6dd8('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x153d35,'request\x20sent',JSON[_0x6dd8('0x10')](_0x5de94c));if(_0x5de94c[_0x6dd8('0x11')]){if(_0x5de94c[_0x6dd8('0x11')][_0x6dd8('0x12')]===0x1f4){logger[_0x6dd8('0x11')](_0x6dd8('0xd'),_0x153d35,_0x5de94c[_0x6dd8('0x11')][_0x6dd8('0x13')]);return _0x40a062(_0x5de94c['error'][_0x6dd8('0x13')]);}logger[_0x6dd8('0x11')](_0x6dd8('0xd'),_0x153d35,_0x5de94c[_0x6dd8('0x11')][_0x6dd8('0x13')]);return _0x3e139f(_0x5de94c[_0x6dd8('0x11')][_0x6dd8('0x13')]);}else{logger[_0x6dd8('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x153d35,_0x6dd8('0xe'));_0x3e139f(_0x5de94c[_0x6dd8('0x15')]['message']);}})[_0x6dd8('0x16')](function(_0x4e4f65){logger[_0x6dd8('0x11')](_0x6dd8('0xd'),_0x153d35,_0x4e4f65);_0x40a062(_0x4e4f65);});});}exports[_0x6dd8('0x17')]=function(_0x4e2ba4){var _0x1b6162=this;return new Promise(function(_0x5b8ff8,_0x12384f){return db[_0x6dd8('0x18')]['findAll']({'raw':_0x4e2ba4['options']?_0x4e2ba4[_0x6dd8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4e2ba4[_0x6dd8('0x19')]?_0x4e2ba4[_0x6dd8('0x19')][_0x6dd8('0x1a')]||null:null,'attributes':_0x4e2ba4[_0x6dd8('0x19')]?_0x4e2ba4[_0x6dd8('0x19')][_0x6dd8('0x1b')]||null:null,'limit':_0x4e2ba4[_0x6dd8('0x19')]?_0x4e2ba4[_0x6dd8('0x19')][_0x6dd8('0x1c')]||null:null,'include':_0x4e2ba4[_0x6dd8('0x19')]?_0x4e2ba4['options'][_0x6dd8('0x1d')]?_[_0x6dd8('0x1e')](_0x4e2ba4[_0x6dd8('0x19')][_0x6dd8('0x1d')],function(_0x377be1){return{'model':db[_0x377be1[_0x6dd8('0x1f')]],'as':_0x377be1['as'],'attributes':_0x377be1[_0x6dd8('0x1b')],'include':_0x377be1[_0x6dd8('0x1d')]?_[_0x6dd8('0x1e')](_0x377be1['include'],function(_0x37223f){return{'model':db[_0x37223f[_0x6dd8('0x1f')]],'as':_0x37223f['as'],'attributes':_0x37223f[_0x6dd8('0x1b')],'include':_0x37223f['include']?_[_0x6dd8('0x1e')](_0x37223f[_0x6dd8('0x1d')],function(_0xe2bead){return{'model':db[_0xe2bead[_0x6dd8('0x1f')]],'as':_0xe2bead['as'],'attributes':_0xe2bead['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dd8('0xc')](function(_0x52602a){logger['info']('GetFreshdeskAccount',_0x4e2ba4);logger['debug']('GetFreshdeskAccount',_0x4e2ba4,JSON[_0x6dd8('0x10')](_0x52602a));_0x5b8ff8(_0x52602a);})['catch'](function(_0x330144){logger[_0x6dd8('0x11')](_0x6dd8('0x17'),_0x330144['message'],_0x4e2ba4);_0x12384f(_0x1b6162[_0x6dd8('0x11')](0x1f4,_0x330144[_0x6dd8('0x13')]));});});};exports[_0x6dd8('0x20')]=function(_0x104057){var _0x10034e=this;return new Promise(function(_0x1a8cc1,_0x170b84){return db[_0x6dd8('0x18')]['find']({'raw':_0x104057['options']?_0x104057['options'][_0x6dd8('0x21')]===undefined?!![]:![]:!![],'where':_0x104057[_0x6dd8('0x19')]?_0x104057[_0x6dd8('0x19')][_0x6dd8('0x1a')]||null:null,'attributes':_0x104057[_0x6dd8('0x19')]?_0x104057[_0x6dd8('0x19')][_0x6dd8('0x1b')]||null:null,'include':_0x104057[_0x6dd8('0x19')]?_0x104057[_0x6dd8('0x19')]['include']?_['map'](_0x104057[_0x6dd8('0x19')]['include'],function(_0x489cc4){return{'model':db[_0x489cc4[_0x6dd8('0x1f')]],'as':_0x489cc4['as'],'attributes':_0x489cc4[_0x6dd8('0x1b')],'include':_0x489cc4[_0x6dd8('0x1d')]?_[_0x6dd8('0x1e')](_0x489cc4['include'],function(_0x47ea36){return{'model':db[_0x47ea36[_0x6dd8('0x1f')]],'as':_0x47ea36['as'],'attributes':_0x47ea36[_0x6dd8('0x1b')],'include':_0x47ea36[_0x6dd8('0x1d')]?_[_0x6dd8('0x1e')](_0x47ea36[_0x6dd8('0x1d')],function(_0x2bca9b){return{'model':db[_0x2bca9b['model']],'as':_0x2bca9b['as'],'attributes':_0x2bca9b[_0x6dd8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6dd8('0xc')](function(_0x74f9d0){logger[_0x6dd8('0x14')](_0x6dd8('0x20'),_0x104057);logger[_0x6dd8('0xf')](_0x6dd8('0x20'),_0x104057,JSON[_0x6dd8('0x10')](_0x74f9d0));_0x1a8cc1(_0x74f9d0);})['catch'](function(_0x52ae17){logger[_0x6dd8('0x11')](_0x6dd8('0x20'),_0x52ae17[_0x6dd8('0x13')],_0x104057);_0x170b84(_0x10034e['error'](0x1f4,_0x52ae17[_0x6dd8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index b1a5774..8159600 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 _0x4ad3=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','exports','util'];(function(_0x4e0a40,_0x2ae544){var _0x46bba9=function(_0x27e3c1){while(--_0x27e3c1){_0x4e0a40['push'](_0x4e0a40['shift']());}};_0x46bba9(++_0x2ae544);}(_0x4ad3,0xc7));var _0x34ad=function(_0xecc551,_0x471cac){_0xecc551=_0xecc551-0x0;var _0x344658=_0x4ad3[_0xecc551];return _0x344658;};'use strict';var multer=require('multer');var util=require(_0x34ad('0x0'));var path=require(_0x34ad('0x1'));var timeout=require(_0x34ad('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34ad('0x3'));var interaction=require(_0x34ad('0x4'));var config=require(_0x34ad('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x34ad('0x6')]('/',auth[_0x34ad('0x7')](),controller[_0x34ad('0x8')]);router[_0x34ad('0x6')](_0x34ad('0x9'),auth[_0x34ad('0x7')](),controller[_0x34ad('0xa')]);router[_0x34ad('0x6')](_0x34ad('0xb'),auth['isAuthenticated'](),controller[_0x34ad('0xc')]);router['get']('/:id/subjects',auth[_0x34ad('0x7')](),controller[_0x34ad('0xd')]);router[_0x34ad('0x6')](_0x34ad('0xe'),auth[_0x34ad('0x7')](),controller[_0x34ad('0xf')]);router[_0x34ad('0x6')](_0x34ad('0x10'),auth['isAuthenticated'](),controller[_0x34ad('0x11')]);router[_0x34ad('0x12')]('/',auth['isAuthenticated'](),controller[_0x34ad('0x13')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0x34ad('0x14')]);router[_0x34ad('0x15')](_0x34ad('0x9'),auth[_0x34ad('0x7')](),controller['update']);router[_0x34ad('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x34ad('0x17')]);module[_0x34ad('0x18')]=router; \ No newline at end of file +var _0x8fd8=['get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','setTags','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14ace9,_0x25e941){var _0x3a5913=function(_0x2ab6f4){while(--_0x2ab6f4){_0x14ace9['push'](_0x14ace9['shift']());}};_0x3a5913(++_0x25e941);}(_0x8fd8,0x147));var _0x88fd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8fd8[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x88fd('0x0'));var util=require(_0x88fd('0x1'));var path=require(_0x88fd('0x2'));var timeout=require(_0x88fd('0x3'));var express=require(_0x88fd('0x4'));var router=express[_0x88fd('0x5')]();var fs_extra=require(_0x88fd('0x6'));var auth=require(_0x88fd('0x7'));var interaction=require(_0x88fd('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x88fd('0x9')]('/',auth[_0x88fd('0xa')](),controller[_0x88fd('0xb')]);router[_0x88fd('0x9')]('/:id',auth[_0x88fd('0xa')](),controller['show']);router[_0x88fd('0x9')](_0x88fd('0xc'),auth['isAuthenticated'](),controller[_0x88fd('0xd')]);router['get'](_0x88fd('0xe'),auth[_0x88fd('0xa')](),controller['getSubjects']);router[_0x88fd('0x9')](_0x88fd('0xf'),auth['isAuthenticated'](),controller[_0x88fd('0x10')]);router[_0x88fd('0x9')]('/:id/tags',auth[_0x88fd('0xa')](),controller[_0x88fd('0x11')]);router[_0x88fd('0x12')]('/',auth[_0x88fd('0xa')](),controller['create']);router[_0x88fd('0x12')]('/:id/tags',auth[_0x88fd('0xa')](),controller[_0x88fd('0x13')]);router['put']('/:id',auth[_0x88fd('0xa')](),controller['update']);router[_0x88fd('0x14')](_0x88fd('0x15'),auth['isAuthenticated'](),controller[_0x88fd('0x16')]);module[_0x88fd('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 0fb0d32..cc7b3bf 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 _0xeafa=['exports','STRING','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xeafa,0xbf));var _0xaeaf=function(_0xdf0941,_0xd5b302){_0xdf0941=_0xdf0941-0x0;var _0x3b20f9=_0xeafa[_0xdf0941];return _0x3b20f9;};'use strict';var Sequelize=require(_0xaeaf('0x0'));module[_0xaeaf('0x1')]={'name':{'type':Sequelize[_0xaeaf('0x2')]},'description':{'type':Sequelize[_0xaeaf('0x2')]}}; \ No newline at end of file +var _0xf911=['sequelize','exports','STRING'];(function(_0x4f4c84,_0x25ed17){var _0x5f03c4=function(_0x1a063e){while(--_0x1a063e){_0x4f4c84['push'](_0x4f4c84['shift']());}};_0x5f03c4(++_0x25ed17);}(_0xf911,0x1ef));var _0x1f91=function(_0xfc4cd8,_0x25007c){_0xfc4cd8=_0xfc4cd8-0x0;var _0x110fc0=_0xf911[_0xfc4cd8];return _0x110fc0;};'use strict';var Sequelize=require(_0x1f91('0x0'));module[_0x1f91('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f91('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a1c8654..1b899fc 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 _0xaae5=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','order','hasOwnProperty','getSubjects','FreshdeskField','getTags','setTags','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xaae5,0x171));var _0x5aae=function(_0x3df25f,_0x488b61){_0x3df25f=_0x3df25f-0x0;var _0x47ca1e=_0xaae5[_0x3df25f];return _0x47ca1e;};'use strict';var emlformat=require(_0x5aae('0x0'));var rimraf=require(_0x5aae('0x1'));var zipdir=require(_0x5aae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5aae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5aae('0x4'));var util=require(_0x5aae('0x5'));var path=require('path');var sox=require(_0x5aae('0x6'));var csv=require(_0x5aae('0x7'));var ejs=require(_0x5aae('0x8'));var fs=require('fs');var fs_extra=require(_0x5aae('0x9'));var _=require(_0x5aae('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5aae('0xb'));var toCsv=require(_0x5aae('0x7'));var querystring=require(_0x5aae('0xc'));var Papa=require(_0x5aae('0xd'));var Redis=require(_0x5aae('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5aae('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5aae('0x10'))(_0x5aae('0x11'));var utils=require(_0x5aae('0x12'));var config=require(_0x5aae('0x13'));var licenseUtil=require(_0x5aae('0x14'));var db=require(_0x5aae('0x15'))['db'];function respondWithStatusCode(_0x110ed2,_0x384c6d){_0x384c6d=_0x384c6d||0xcc;return function(_0xeab810){if(_0xeab810){return _0x110ed2['sendStatus'](_0x384c6d);}return _0x110ed2['status'](_0x384c6d)[_0x5aae('0x16')]();};}function respondWithResult(_0xf86e8c,_0x2aa4f9){_0x2aa4f9=_0x2aa4f9||0xc8;return function(_0x3bcd5f){if(_0x3bcd5f){return _0xf86e8c[_0x5aae('0x17')](_0x2aa4f9)[_0x5aae('0x18')](_0x3bcd5f);}};}function respondWithFilteredResult(_0x1b17e2,_0x3c1149){return function(_0x10328a){if(_0x10328a){var _0x2075bc=typeof _0x3c1149[_0x5aae('0x19')]==='undefined'&&typeof _0x3c1149[_0x5aae('0x1a')]==='undefined';var _0x2c0dac=_0x10328a['count'];var _0x50947d=_0x2075bc?0x0:_0x3c1149[_0x5aae('0x19')];var _0x1ccda6=_0x2075bc?_0x10328a[_0x5aae('0x1b')]:_0x3c1149[_0x5aae('0x19')]+_0x3c1149[_0x5aae('0x1a')];var _0x4f4ec9;if(_0x1ccda6>=_0x2c0dac){_0x1ccda6=_0x2c0dac;_0x4f4ec9=0xc8;}else{_0x4f4ec9=0xce;}_0x1b17e2[_0x5aae('0x17')](_0x4f4ec9);return _0x1b17e2[_0x5aae('0x1c')](_0x5aae('0x1d'),_0x50947d+'-'+_0x1ccda6+'/'+_0x2c0dac)[_0x5aae('0x18')](_0x10328a);}return null;};}function patchUpdates(_0x38a67f){return function(_0x11a0f7){try{jsonpatch[_0x5aae('0x1e')](_0x11a0f7,_0x38a67f,!![]);}catch(_0x432bfc){return BPromise['reject'](_0x432bfc);}return _0x11a0f7['save']();};}function saveUpdates(_0x507ef4,_0x501613){return function(_0x3a323a){if(_0x3a323a){return _0x3a323a[_0x5aae('0x1f')](_0x507ef4)[_0x5aae('0x20')](function(_0xef9145){return _0xef9145;});}return null;};}function removeEntity(_0x5863ec,_0x42536c){return function(_0x2d2f41){if(_0x2d2f41){return _0x2d2f41[_0x5aae('0x21')]()[_0x5aae('0x20')](function(){_0x5863ec[_0x5aae('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32adb5,_0x880666){return function(_0xfce1eb){if(!_0xfce1eb){_0x32adb5['sendStatus'](0x194);}return _0xfce1eb;};}function handleError(_0x33c08e,_0x175a2e){_0x175a2e=_0x175a2e||0x1f4;return function(_0x2987c8){logger['error'](_0x2987c8['stack']);if(_0x2987c8[_0x5aae('0x22')]){delete _0x2987c8['name'];}_0x33c08e[_0x5aae('0x17')](_0x175a2e)[_0x5aae('0x23')](_0x2987c8);};}exports[_0x5aae('0x24')]=function(_0x21e45f,_0x38a8a2){var _0x3f0aa2={},_0x546bae={},_0x32f7de={'count':0x0,'rows':[]};var _0x329d58=_[_0x5aae('0x25')](db['FreshdeskConfiguration'][_0x5aae('0x26')],function(_0x44491c){return{'name':_0x44491c['fieldName'],'type':_0x44491c[_0x5aae('0x27')][_0x5aae('0x28')]};});_0x546bae[_0x5aae('0x29')]=_[_0x5aae('0x25')](_0x329d58,_0x5aae('0x22'));_0x546bae['query']=_[_0x5aae('0x2a')](_0x21e45f[_0x5aae('0x2b')]);_0x546bae[_0x5aae('0x2c')]=_[_0x5aae('0x2d')](_0x546bae['model'],_0x546bae[_0x5aae('0x2b')]);_0x3f0aa2[_0x5aae('0x2e')]=_[_0x5aae('0x2d')](_0x546bae[_0x5aae('0x29')],qs[_0x5aae('0x2f')](_0x21e45f[_0x5aae('0x2b')]['fields']));_0x3f0aa2[_0x5aae('0x2e')]=_0x3f0aa2[_0x5aae('0x2e')][_0x5aae('0x30')]?_0x3f0aa2['attributes']:_0x546bae[_0x5aae('0x29')];if(!_0x21e45f['query']['hasOwnProperty'](_0x5aae('0x31'))){_0x3f0aa2[_0x5aae('0x1a')]=qs[_0x5aae('0x1a')](_0x21e45f['query'][_0x5aae('0x1a')]);_0x3f0aa2[_0x5aae('0x19')]=qs[_0x5aae('0x19')](_0x21e45f[_0x5aae('0x2b')]['offset']);}_0x3f0aa2['order']=qs[_0x5aae('0x32')](_0x21e45f[_0x5aae('0x2b')]['sort']);_0x3f0aa2[_0x5aae('0x33')]=qs['filters'](_[_0x5aae('0x34')](_0x21e45f[_0x5aae('0x2b')],_0x546bae['filters']),_0x329d58);if(_0x21e45f[_0x5aae('0x2b')]['filter']){_0x3f0aa2[_0x5aae('0x33')]=_[_0x5aae('0x35')](_0x3f0aa2['where'],{'$or':_[_0x5aae('0x25')](_0x329d58,function(_0x160db6){if(_0x160db6[_0x5aae('0x27')]!==_0x5aae('0x36')){var _0x30d15f={};_0x30d15f[_0x160db6[_0x5aae('0x22')]]={'$like':'%'+_0x21e45f[_0x5aae('0x2b')][_0x5aae('0x37')]+'%'};return _0x30d15f;}})});}_0x3f0aa2=_[_0x5aae('0x35')]({},_0x3f0aa2,_0x21e45f[_0x5aae('0x38')]);var _0x54a847={'where':_0x3f0aa2[_0x5aae('0x33')]};return db[_0x5aae('0x39')][_0x5aae('0x1b')](_0x54a847)['then'](function(_0x597b32){_0x32f7de[_0x5aae('0x1b')]=_0x597b32;if(_0x21e45f[_0x5aae('0x2b')][_0x5aae('0x3a')]){_0x3f0aa2[_0x5aae('0x3b')]=[{'all':!![]}];}return db[_0x5aae('0x39')][_0x5aae('0x3c')](_0x3f0aa2);})[_0x5aae('0x20')](function(_0x214529){_0x32f7de[_0x5aae('0x3d')]=_0x214529;return _0x32f7de;})[_0x5aae('0x20')](respondWithFilteredResult(_0x38a8a2,_0x3f0aa2))[_0x5aae('0x3e')](handleError(_0x38a8a2,null));};exports[_0x5aae('0x3f')]=function(_0x44f6b7,_0x2b39f7){var _0x35569c={'raw':![],'where':{'id':_0x44f6b7['params']['id']}},_0x39737c={};_0x39737c[_0x5aae('0x29')]=_[_0x5aae('0x2a')](db[_0x5aae('0x39')]['rawAttributes']);_0x39737c[_0x5aae('0x2b')]=_[_0x5aae('0x2a')](_0x44f6b7[_0x5aae('0x2b')]);_0x39737c['filters']=_[_0x5aae('0x2d')](_0x39737c['model'],_0x39737c[_0x5aae('0x2b')]);_0x35569c[_0x5aae('0x2e')]=_['intersection'](_0x39737c[_0x5aae('0x29')],qs[_0x5aae('0x2f')](_0x44f6b7[_0x5aae('0x2b')][_0x5aae('0x2f')]));_0x35569c[_0x5aae('0x2e')]=_0x35569c[_0x5aae('0x2e')][_0x5aae('0x30')]?_0x35569c[_0x5aae('0x2e')]:_0x39737c[_0x5aae('0x29')];if(_0x44f6b7[_0x5aae('0x2b')]['includeAll']){_0x35569c[_0x5aae('0x3b')]=[{'all':!![]}];}_0x35569c=_[_0x5aae('0x35')]({},_0x35569c,_0x44f6b7[_0x5aae('0x38')]);return db[_0x5aae('0x39')][_0x5aae('0x40')](_0x35569c)[_0x5aae('0x20')](handleEntityNotFound(_0x2b39f7,null))['then'](respondWithResult(_0x2b39f7,null))[_0x5aae('0x3e')](handleError(_0x2b39f7,null));};exports[_0x5aae('0x41')]=function(_0x4971fa,_0xe6a75){return db[_0x5aae('0x39')][_0x5aae('0x41')](_0x4971fa[_0x5aae('0x42')],{})['then'](respondWithResult(_0xe6a75,0xc9))[_0x5aae('0x3e')](handleError(_0xe6a75,null));};exports['update']=function(_0x1f80b7,_0x59b43e){if(_0x1f80b7[_0x5aae('0x42')]['id']){delete _0x1f80b7[_0x5aae('0x42')]['id'];}return db[_0x5aae('0x39')][_0x5aae('0x40')]({'where':{'id':_0x1f80b7['params']['id']}})['then'](handleEntityNotFound(_0x59b43e,null))['then'](saveUpdates(_0x1f80b7[_0x5aae('0x42')],null))[_0x5aae('0x20')](respondWithResult(_0x59b43e,null))[_0x5aae('0x3e')](handleError(_0x59b43e,null));};exports['destroy']=function(_0xcf6a76,_0x26e87f){return db[_0x5aae('0x39')][_0x5aae('0x40')]({'where':{'id':_0xcf6a76[_0x5aae('0x43')]['id']}})[_0x5aae('0x20')](handleEntityNotFound(_0x26e87f,null))['then'](removeEntity(_0x26e87f,null))[_0x5aae('0x3e')](handleError(_0x26e87f,null));};exports[_0x5aae('0x44')]=function(_0x562715,_0x47d70a,_0x3b02dc){var _0x2c830f={};var _0x1f34a4={};var _0x5cecfa;var _0x3d0e31;return db['FreshdeskConfiguration'][_0x5aae('0x45')]({'where':{'id':_0x562715['params']['id']}})[_0x5aae('0x20')](handleEntityNotFound(_0x47d70a,null))[_0x5aae('0x20')](function(_0x46abfe){if(_0x46abfe){_0x5cecfa=_0x46abfe;_0x1f34a4[_0x5aae('0x29')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x1f34a4[_0x5aae('0x2b')]=_[_0x5aae('0x2a')](_0x562715[_0x5aae('0x2b')]);_0x1f34a4['filters']=_['intersection'](_0x1f34a4[_0x5aae('0x29')],_0x1f34a4[_0x5aae('0x2b')]);_0x2c830f[_0x5aae('0x2e')]=_[_0x5aae('0x2d')](_0x1f34a4[_0x5aae('0x29')],qs[_0x5aae('0x2f')](_0x562715[_0x5aae('0x2b')][_0x5aae('0x2f')]));_0x2c830f[_0x5aae('0x2e')]=_0x2c830f[_0x5aae('0x2e')][_0x5aae('0x30')]?_0x2c830f[_0x5aae('0x2e')]:_0x1f34a4[_0x5aae('0x29')];_0x2c830f[_0x5aae('0x46')]=qs[_0x5aae('0x32')](_0x562715[_0x5aae('0x2b')][_0x5aae('0x32')]);_0x2c830f[_0x5aae('0x33')]=qs[_0x5aae('0x2c')](_[_0x5aae('0x34')](_0x562715[_0x5aae('0x2b')],_0x1f34a4['filters']));if(_0x562715[_0x5aae('0x2b')][_0x5aae('0x37')]){_0x2c830f[_0x5aae('0x33')]=_[_0x5aae('0x35')](_0x2c830f[_0x5aae('0x33')],{'$or':_[_0x5aae('0x25')](_0x2c830f['attributes'],function(_0x32e2a5){var _0x4ee265={};_0x4ee265[_0x32e2a5]={'$like':'%'+_0x562715[_0x5aae('0x2b')][_0x5aae('0x37')]+'%'};return _0x4ee265;})});}_0x2c830f=_[_0x5aae('0x35')]({},_0x2c830f,_0x562715[_0x5aae('0x38')]);return _0x5cecfa[_0x5aae('0x44')](_0x2c830f);}})['then'](function(_0xda7f8e){if(_0xda7f8e){_0x3d0e31=_0xda7f8e['length'];if(!_0x562715[_0x5aae('0x2b')][_0x5aae('0x47')](_0x5aae('0x31'))){_0x2c830f[_0x5aae('0x1a')]=qs[_0x5aae('0x1a')](_0x562715[_0x5aae('0x2b')][_0x5aae('0x1a')]);_0x2c830f[_0x5aae('0x19')]=qs[_0x5aae('0x19')](_0x562715['query'][_0x5aae('0x19')]);}return _0x5cecfa[_0x5aae('0x44')](_0x2c830f);}})['then'](function(_0x12134b){if(_0x12134b){return _0x12134b?{'count':_0x3d0e31,'rows':_0x12134b}:null;}})[_0x5aae('0x20')](respondWithResult(_0x47d70a,null))[_0x5aae('0x3e')](handleError(_0x47d70a,null));};exports[_0x5aae('0x48')]=function(_0x640193,_0x276953,_0x3c0f60){var _0x58da2a={};var _0x16209a={};var _0x1023c4;var _0x10625f;return db[_0x5aae('0x39')][_0x5aae('0x45')]({'where':{'id':_0x640193[_0x5aae('0x43')]['id']}})[_0x5aae('0x20')](handleEntityNotFound(_0x276953,null))[_0x5aae('0x20')](function(_0xc50e9){if(_0xc50e9){_0x1023c4=_0xc50e9;_0x16209a['model']=_['keys'](db['FreshdeskField'][_0x5aae('0x26')]);_0x16209a[_0x5aae('0x2b')]=_[_0x5aae('0x2a')](_0x640193['query']);_0x16209a['filters']=_['intersection'](_0x16209a[_0x5aae('0x29')],_0x16209a[_0x5aae('0x2b')]);_0x58da2a[_0x5aae('0x2e')]=_[_0x5aae('0x2d')](_0x16209a[_0x5aae('0x29')],qs[_0x5aae('0x2f')](_0x640193[_0x5aae('0x2b')][_0x5aae('0x2f')]));_0x58da2a[_0x5aae('0x2e')]=_0x58da2a[_0x5aae('0x2e')][_0x5aae('0x30')]?_0x58da2a[_0x5aae('0x2e')]:_0x16209a[_0x5aae('0x29')];_0x58da2a['order']=qs[_0x5aae('0x32')](_0x640193['query'][_0x5aae('0x32')]);_0x58da2a[_0x5aae('0x33')]=qs['filters'](_['pick'](_0x640193['query'],_0x16209a['filters']));if(_0x640193[_0x5aae('0x2b')]['filter']){_0x58da2a['where']=_[_0x5aae('0x35')](_0x58da2a[_0x5aae('0x33')],{'$or':_[_0x5aae('0x25')](_0x58da2a[_0x5aae('0x2e')],function(_0x2d9edd){var _0x59d3ce={};_0x59d3ce[_0x2d9edd]={'$like':'%'+_0x640193['query']['filter']+'%'};return _0x59d3ce;})});}_0x58da2a=_[_0x5aae('0x35')]({},_0x58da2a,_0x640193[_0x5aae('0x38')]);return _0x1023c4[_0x5aae('0x48')](_0x58da2a);}})[_0x5aae('0x20')](function(_0x5d44c6){if(_0x5d44c6){_0x10625f=_0x5d44c6[_0x5aae('0x30')];if(!_0x640193[_0x5aae('0x2b')]['hasOwnProperty'](_0x5aae('0x31'))){_0x58da2a['limit']=qs['limit'](_0x640193[_0x5aae('0x2b')][_0x5aae('0x1a')]);_0x58da2a['offset']=qs[_0x5aae('0x19')](_0x640193[_0x5aae('0x2b')][_0x5aae('0x19')]);}return _0x1023c4[_0x5aae('0x48')](_0x58da2a);}})[_0x5aae('0x20')](function(_0x3d366c){if(_0x3d366c){return _0x3d366c?{'count':_0x10625f,'rows':_0x3d366c}:null;}})[_0x5aae('0x20')](respondWithResult(_0x276953,null))['catch'](handleError(_0x276953,null));};exports['getDescriptions']=function(_0x4f233a,_0x303378,_0x4a41a8){var _0x538472={};var _0x4cbfc7={};var _0x2a6d4a;var _0xafe6e3;return db['FreshdeskConfiguration'][_0x5aae('0x45')]({'where':{'id':_0x4f233a[_0x5aae('0x43')]['id']}})[_0x5aae('0x20')](handleEntityNotFound(_0x303378,null))[_0x5aae('0x20')](function(_0x3e725f){if(_0x3e725f){_0x2a6d4a=_0x3e725f;_0x4cbfc7[_0x5aae('0x29')]=_[_0x5aae('0x2a')](db[_0x5aae('0x49')][_0x5aae('0x26')]);_0x4cbfc7[_0x5aae('0x2b')]=_[_0x5aae('0x2a')](_0x4f233a[_0x5aae('0x2b')]);_0x4cbfc7['filters']=_[_0x5aae('0x2d')](_0x4cbfc7['model'],_0x4cbfc7[_0x5aae('0x2b')]);_0x538472[_0x5aae('0x2e')]=_[_0x5aae('0x2d')](_0x4cbfc7[_0x5aae('0x29')],qs[_0x5aae('0x2f')](_0x4f233a['query'][_0x5aae('0x2f')]));_0x538472[_0x5aae('0x2e')]=_0x538472[_0x5aae('0x2e')][_0x5aae('0x30')]?_0x538472[_0x5aae('0x2e')]:_0x4cbfc7['model'];_0x538472[_0x5aae('0x46')]=qs[_0x5aae('0x32')](_0x4f233a[_0x5aae('0x2b')][_0x5aae('0x32')]);_0x538472[_0x5aae('0x33')]=qs['filters'](_[_0x5aae('0x34')](_0x4f233a[_0x5aae('0x2b')],_0x4cbfc7[_0x5aae('0x2c')]));if(_0x4f233a[_0x5aae('0x2b')][_0x5aae('0x37')]){_0x538472[_0x5aae('0x33')]=_[_0x5aae('0x35')](_0x538472[_0x5aae('0x33')],{'$or':_[_0x5aae('0x25')](_0x538472[_0x5aae('0x2e')],function(_0x33facb){var _0x4dbce1={};_0x4dbce1[_0x33facb]={'$like':'%'+_0x4f233a[_0x5aae('0x2b')][_0x5aae('0x37')]+'%'};return _0x4dbce1;})});}_0x538472=_['merge']({},_0x538472,_0x4f233a[_0x5aae('0x38')]);return _0x2a6d4a['getDescriptions'](_0x538472);}})['then'](function(_0x9dfcc9){if(_0x9dfcc9){_0xafe6e3=_0x9dfcc9[_0x5aae('0x30')];if(!_0x4f233a[_0x5aae('0x2b')][_0x5aae('0x47')](_0x5aae('0x31'))){_0x538472[_0x5aae('0x1a')]=qs['limit'](_0x4f233a[_0x5aae('0x2b')]['limit']);_0x538472[_0x5aae('0x19')]=qs[_0x5aae('0x19')](_0x4f233a[_0x5aae('0x2b')][_0x5aae('0x19')]);}return _0x2a6d4a['getDescriptions'](_0x538472);}})[_0x5aae('0x20')](function(_0x505421){if(_0x505421){return _0x505421?{'count':_0xafe6e3,'rows':_0x505421}:null;}})[_0x5aae('0x20')](respondWithResult(_0x303378,null))[_0x5aae('0x3e')](handleError(_0x303378,null));};exports[_0x5aae('0x4a')]=function(_0x128a68,_0x2fa36b,_0x2986a3){var _0x248c8c={};var _0x3ae700={};var _0x267243;var _0x29c431;return db['FreshdeskConfiguration'][_0x5aae('0x45')]({'where':{'id':_0x128a68[_0x5aae('0x43')]['id']}})['then'](handleEntityNotFound(_0x2fa36b,null))[_0x5aae('0x20')](function(_0x4648de){if(_0x4648de){_0x267243=_0x4648de;_0x3ae700[_0x5aae('0x29')]=_['keys'](db['Tag'][_0x5aae('0x26')]);_0x3ae700[_0x5aae('0x2b')]=_[_0x5aae('0x2a')](_0x128a68[_0x5aae('0x2b')]);_0x3ae700['filters']=_[_0x5aae('0x2d')](_0x3ae700['model'],_0x3ae700[_0x5aae('0x2b')]);_0x248c8c[_0x5aae('0x2e')]=_[_0x5aae('0x2d')](_0x3ae700['model'],qs[_0x5aae('0x2f')](_0x128a68[_0x5aae('0x2b')][_0x5aae('0x2f')]));_0x248c8c[_0x5aae('0x2e')]=_0x248c8c['attributes']['length']?_0x248c8c[_0x5aae('0x2e')]:_0x3ae700[_0x5aae('0x29')];_0x248c8c[_0x5aae('0x46')]=qs[_0x5aae('0x32')](_0x128a68[_0x5aae('0x2b')][_0x5aae('0x32')]);_0x248c8c[_0x5aae('0x33')]=qs['filters'](_[_0x5aae('0x34')](_0x128a68[_0x5aae('0x2b')],_0x3ae700[_0x5aae('0x2c')]));if(_0x128a68['query'][_0x5aae('0x37')]){_0x248c8c['where']=_[_0x5aae('0x35')](_0x248c8c['where'],{'$or':_['map'](_0x248c8c[_0x5aae('0x2e')],function(_0x35d8ae){var _0x22076b={};_0x22076b[_0x35d8ae]={'$like':'%'+_0x128a68['query']['filter']+'%'};return _0x22076b;})});}_0x248c8c=_[_0x5aae('0x35')]({},_0x248c8c,_0x128a68[_0x5aae('0x38')]);return _0x267243[_0x5aae('0x4a')](_0x248c8c);}})[_0x5aae('0x20')](function(_0x4b03de){if(_0x4b03de){_0x29c431=_0x4b03de[_0x5aae('0x30')];if(!_0x128a68['query']['hasOwnProperty'](_0x5aae('0x31'))){_0x248c8c[_0x5aae('0x1a')]=qs[_0x5aae('0x1a')](_0x128a68[_0x5aae('0x2b')][_0x5aae('0x1a')]);_0x248c8c[_0x5aae('0x19')]=qs[_0x5aae('0x19')](_0x128a68['query']['offset']);}return _0x267243[_0x5aae('0x4a')](_0x248c8c);}})[_0x5aae('0x20')](function(_0x4049e2){if(_0x4049e2){return _0x4049e2?{'count':_0x29c431,'rows':_0x4049e2}:null;}})[_0x5aae('0x20')](respondWithResult(_0x2fa36b,null))['catch'](handleError(_0x2fa36b,null));};exports[_0x5aae('0x4b')]=function(_0x2a183b,_0x29a8bf,_0x5f5bf7){if(_0x2a183b[_0x5aae('0x42')]['id']){delete _0x2a183b[_0x5aae('0x42')]['id'];}return db[_0x5aae('0x39')][_0x5aae('0x45')]({'where':{'id':_0x2a183b[_0x5aae('0x43')]['id']}})[_0x5aae('0x20')](handleEntityNotFound(_0x29a8bf,null))[_0x5aae('0x20')](function(_0x40c1af){if(_0x40c1af){return _0x40c1af[_0x5aae('0x4b')](_0x2a183b[_0x5aae('0x42')]['ids']||[]);}return null;})['then'](respondWithResult(_0x29a8bf,null))[_0x5aae('0x3e')](handleError(_0x29a8bf,null));}; \ No newline at end of file +var _0x09d8=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','intersection','options','find','create','body','update','getFields','findOne','order','map','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','save','then','destroy','error','stack','name','send','index','FreshdeskConfiguration'];(function(_0x4badf7,_0x4204b2){var _0x119084=function(_0x3f22d4){while(--_0x3f22d4){_0x4badf7['push'](_0x4badf7['shift']());}};_0x119084(++_0x4204b2);}(_0x09d8,0x115));var _0x809d=function(_0x489d5c,_0x3beb3b){_0x489d5c=_0x489d5c-0x0;var _0xcd7e2a=_0x09d8[_0x489d5c];return _0xcd7e2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x809d('0x0'));var zipdir=require(_0x809d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x809d('0x2'));var moment=require(_0x809d('0x3'));var BPromise=require(_0x809d('0x4'));var Mustache=require('mustache');var util=require(_0x809d('0x5'));var path=require(_0x809d('0x6'));var sox=require(_0x809d('0x7'));var csv=require(_0x809d('0x8'));var ejs=require(_0x809d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x809d('0xa'));var squel=require(_0x809d('0xb'));var crypto=require('crypto');var jsforce=require(_0x809d('0xc'));var deskjs=require(_0x809d('0xd'));var toCsv=require(_0x809d('0x8'));var querystring=require(_0x809d('0xe'));var Papa=require(_0x809d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x809d('0x10'));var as=require(_0x809d('0x11'));var hardwareService=require(_0x809d('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x809d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x809d('0x14'))['db'];function respondWithStatusCode(_0x2bd2dd,_0x4348fb){_0x4348fb=_0x4348fb||0xcc;return function(_0x181a76){if(_0x181a76){return _0x2bd2dd[_0x809d('0x15')](_0x4348fb);}return _0x2bd2dd[_0x809d('0x16')](_0x4348fb)[_0x809d('0x17')]();};}function respondWithResult(_0x57fce7,_0x5c5dfb){_0x5c5dfb=_0x5c5dfb||0xc8;return function(_0x55fa61){if(_0x55fa61){return _0x57fce7[_0x809d('0x16')](_0x5c5dfb)[_0x809d('0x18')](_0x55fa61);}};}function respondWithFilteredResult(_0x7719e1,_0x29a4eb){return function(_0x4ec5c4){if(_0x4ec5c4){var _0x1293d2=typeof _0x29a4eb['offset']===_0x809d('0x19')&&typeof _0x29a4eb[_0x809d('0x1a')]===_0x809d('0x19');var _0x160581=_0x4ec5c4[_0x809d('0x1b')];var _0x18dd7c=_0x1293d2?0x0:_0x29a4eb[_0x809d('0x1c')];var _0x32c963=_0x1293d2?_0x4ec5c4['count']:_0x29a4eb[_0x809d('0x1c')]+_0x29a4eb[_0x809d('0x1a')];var _0x26be92;if(_0x32c963>=_0x160581){_0x32c963=_0x160581;_0x26be92=0xc8;}else{_0x26be92=0xce;}_0x7719e1[_0x809d('0x16')](_0x26be92);return _0x7719e1[_0x809d('0x1d')]('Content-Range',_0x18dd7c+'-'+_0x32c963+'/'+_0x160581)[_0x809d('0x18')](_0x4ec5c4);}return null;};}function patchUpdates(_0x555dbf){return function(_0x4e67a9){try{jsonpatch['apply'](_0x4e67a9,_0x555dbf,!![]);}catch(_0x34ebf2){return BPromise['reject'](_0x34ebf2);}return _0x4e67a9[_0x809d('0x1e')]();};}function saveUpdates(_0x9e6dea,_0x313c07){return function(_0x2e7468){if(_0x2e7468){return _0x2e7468['update'](_0x9e6dea)[_0x809d('0x1f')](function(_0x3ee845){return _0x3ee845;});}return null;};}function removeEntity(_0x409155,_0x25fffc){return function(_0x41833f){if(_0x41833f){return _0x41833f[_0x809d('0x20')]()[_0x809d('0x1f')](function(){_0x409155[_0x809d('0x16')](0xcc)[_0x809d('0x17')]();});}};}function handleEntityNotFound(_0xce4d11,_0x141f9c){return function(_0xf1425f){if(!_0xf1425f){_0xce4d11['sendStatus'](0x194);}return _0xf1425f;};}function handleError(_0x57562b,_0x2b0a1d){_0x2b0a1d=_0x2b0a1d||0x1f4;return function(_0x2d0ee0){logger[_0x809d('0x21')](_0x2d0ee0[_0x809d('0x22')]);if(_0x2d0ee0[_0x809d('0x23')]){delete _0x2d0ee0[_0x809d('0x23')];}_0x57562b[_0x809d('0x16')](_0x2b0a1d)[_0x809d('0x24')](_0x2d0ee0);};}exports[_0x809d('0x25')]=function(_0x55aa93,_0x21c29f){var _0x1e4c48={},_0x5a654c={},_0x4acc95={'count':0x0,'rows':[]};var _0x4dab81=_['map'](db[_0x809d('0x26')][_0x809d('0x27')],function(_0x5ddfc2){return{'name':_0x5ddfc2[_0x809d('0x28')],'type':_0x5ddfc2[_0x809d('0x29')][_0x809d('0x2a')]};});_0x5a654c[_0x809d('0x2b')]=_['map'](_0x4dab81,_0x809d('0x23'));_0x5a654c[_0x809d('0x2c')]=_[_0x809d('0x2d')](_0x55aa93['query']);_0x5a654c[_0x809d('0x2e')]=_['intersection'](_0x5a654c['model'],_0x5a654c[_0x809d('0x2c')]);_0x1e4c48[_0x809d('0x2f')]=_['intersection'](_0x5a654c[_0x809d('0x2b')],qs['fields'](_0x55aa93[_0x809d('0x2c')][_0x809d('0x30')]));_0x1e4c48[_0x809d('0x2f')]=_0x1e4c48[_0x809d('0x2f')][_0x809d('0x31')]?_0x1e4c48[_0x809d('0x2f')]:_0x5a654c[_0x809d('0x2b')];if(!_0x55aa93[_0x809d('0x2c')][_0x809d('0x32')](_0x809d('0x33'))){_0x1e4c48['limit']=qs[_0x809d('0x1a')](_0x55aa93[_0x809d('0x2c')][_0x809d('0x1a')]);_0x1e4c48[_0x809d('0x1c')]=qs[_0x809d('0x1c')](_0x55aa93[_0x809d('0x2c')][_0x809d('0x1c')]);}_0x1e4c48['order']=qs[_0x809d('0x34')](_0x55aa93[_0x809d('0x2c')][_0x809d('0x34')]);_0x1e4c48[_0x809d('0x35')]=qs[_0x809d('0x2e')](_[_0x809d('0x36')](_0x55aa93[_0x809d('0x2c')],_0x5a654c[_0x809d('0x2e')]),_0x4dab81);if(_0x55aa93[_0x809d('0x2c')][_0x809d('0x37')]){_0x1e4c48['where']=_[_0x809d('0x38')](_0x1e4c48['where'],{'$or':_['map'](_0x4dab81,function(_0x13da57){if(_0x13da57[_0x809d('0x29')]!==_0x809d('0x39')){var _0x431e4d={};_0x431e4d[_0x13da57[_0x809d('0x23')]]={'$like':'%'+_0x55aa93[_0x809d('0x2c')]['filter']+'%'};return _0x431e4d;}})});}_0x1e4c48=_['merge']({},_0x1e4c48,_0x55aa93['options']);var _0x1fa16e={'where':_0x1e4c48[_0x809d('0x35')]};return db[_0x809d('0x26')][_0x809d('0x1b')](_0x1fa16e)['then'](function(_0x134ed4){_0x4acc95[_0x809d('0x1b')]=_0x134ed4;if(_0x55aa93[_0x809d('0x2c')][_0x809d('0x3a')]){_0x1e4c48[_0x809d('0x3b')]=[{'all':!![]}];}return db[_0x809d('0x26')]['findAll'](_0x1e4c48);})['then'](function(_0x40a0fa){_0x4acc95['rows']=_0x40a0fa;return _0x4acc95;})['then'](respondWithFilteredResult(_0x21c29f,_0x1e4c48))[_0x809d('0x3c')](handleError(_0x21c29f,null));};exports[_0x809d('0x3d')]=function(_0xf485e9,_0x4d08c9){var _0x3a1fd8={'raw':![],'where':{'id':_0xf485e9[_0x809d('0x3e')]['id']}},_0x28b615={};_0x28b615['model']=_['keys'](db[_0x809d('0x26')][_0x809d('0x27')]);_0x28b615['query']=_[_0x809d('0x2d')](_0xf485e9['query']);_0x28b615[_0x809d('0x2e')]=_[_0x809d('0x3f')](_0x28b615[_0x809d('0x2b')],_0x28b615['query']);_0x3a1fd8[_0x809d('0x2f')]=_[_0x809d('0x3f')](_0x28b615['model'],qs['fields'](_0xf485e9['query'][_0x809d('0x30')]));_0x3a1fd8[_0x809d('0x2f')]=_0x3a1fd8[_0x809d('0x2f')]['length']?_0x3a1fd8[_0x809d('0x2f')]:_0x28b615[_0x809d('0x2b')];if(_0xf485e9[_0x809d('0x2c')][_0x809d('0x3a')]){_0x3a1fd8['include']=[{'all':!![]}];}_0x3a1fd8=_[_0x809d('0x38')]({},_0x3a1fd8,_0xf485e9[_0x809d('0x40')]);return db['FreshdeskConfiguration'][_0x809d('0x41')](_0x3a1fd8)['then'](handleEntityNotFound(_0x4d08c9,null))[_0x809d('0x1f')](respondWithResult(_0x4d08c9,null))['catch'](handleError(_0x4d08c9,null));};exports[_0x809d('0x42')]=function(_0x1089d8,_0x3dfe99){return db[_0x809d('0x26')][_0x809d('0x42')](_0x1089d8[_0x809d('0x43')],{})[_0x809d('0x1f')](respondWithResult(_0x3dfe99,0xc9))[_0x809d('0x3c')](handleError(_0x3dfe99,null));};exports[_0x809d('0x44')]=function(_0x618b4b,_0x29794d){if(_0x618b4b['body']['id']){delete _0x618b4b[_0x809d('0x43')]['id'];}return db[_0x809d('0x26')][_0x809d('0x41')]({'where':{'id':_0x618b4b[_0x809d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x29794d,null))[_0x809d('0x1f')](saveUpdates(_0x618b4b[_0x809d('0x43')],null))['then'](respondWithResult(_0x29794d,null))[_0x809d('0x3c')](handleError(_0x29794d,null));};exports['destroy']=function(_0x381871,_0x27e255){return db[_0x809d('0x26')][_0x809d('0x41')]({'where':{'id':_0x381871[_0x809d('0x3e')]['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0x27e255,null))[_0x809d('0x1f')](removeEntity(_0x27e255,null))[_0x809d('0x3c')](handleError(_0x27e255,null));};exports[_0x809d('0x45')]=function(_0xfb90a,_0x344bdf,_0xbd4854){var _0x414d9f={};var _0x246a7e={};var _0x6fabad;var _0x1bc76e;return db['FreshdeskConfiguration'][_0x809d('0x46')]({'where':{'id':_0xfb90a[_0x809d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x344bdf,null))[_0x809d('0x1f')](function(_0x5582e7){if(_0x5582e7){_0x6fabad=_0x5582e7;_0x246a7e['model']=_[_0x809d('0x2d')](db['FreshdeskField'][_0x809d('0x27')]);_0x246a7e[_0x809d('0x2c')]=_[_0x809d('0x2d')](_0xfb90a['query']);_0x246a7e[_0x809d('0x2e')]=_[_0x809d('0x3f')](_0x246a7e['model'],_0x246a7e[_0x809d('0x2c')]);_0x414d9f[_0x809d('0x2f')]=_['intersection'](_0x246a7e[_0x809d('0x2b')],qs[_0x809d('0x30')](_0xfb90a['query'][_0x809d('0x30')]));_0x414d9f[_0x809d('0x2f')]=_0x414d9f[_0x809d('0x2f')]['length']?_0x414d9f['attributes']:_0x246a7e[_0x809d('0x2b')];_0x414d9f[_0x809d('0x47')]=qs[_0x809d('0x34')](_0xfb90a[_0x809d('0x2c')][_0x809d('0x34')]);_0x414d9f[_0x809d('0x35')]=qs[_0x809d('0x2e')](_['pick'](_0xfb90a['query'],_0x246a7e[_0x809d('0x2e')]));if(_0xfb90a[_0x809d('0x2c')][_0x809d('0x37')]){_0x414d9f[_0x809d('0x35')]=_[_0x809d('0x38')](_0x414d9f['where'],{'$or':_[_0x809d('0x48')](_0x414d9f['attributes'],function(_0x572d24){var _0x595cfc={};_0x595cfc[_0x572d24]={'$like':'%'+_0xfb90a['query'][_0x809d('0x37')]+'%'};return _0x595cfc;})});}_0x414d9f=_[_0x809d('0x38')]({},_0x414d9f,_0xfb90a[_0x809d('0x40')]);return _0x6fabad[_0x809d('0x45')](_0x414d9f);}})[_0x809d('0x1f')](function(_0x2ff67f){if(_0x2ff67f){_0x1bc76e=_0x2ff67f[_0x809d('0x31')];if(!_0xfb90a[_0x809d('0x2c')][_0x809d('0x32')](_0x809d('0x33'))){_0x414d9f[_0x809d('0x1a')]=qs[_0x809d('0x1a')](_0xfb90a[_0x809d('0x2c')][_0x809d('0x1a')]);_0x414d9f[_0x809d('0x1c')]=qs[_0x809d('0x1c')](_0xfb90a[_0x809d('0x2c')][_0x809d('0x1c')]);}return _0x6fabad[_0x809d('0x45')](_0x414d9f);}})[_0x809d('0x1f')](function(_0x2f3176){if(_0x2f3176){return _0x2f3176?{'count':_0x1bc76e,'rows':_0x2f3176}:null;}})[_0x809d('0x1f')](respondWithResult(_0x344bdf,null))[_0x809d('0x3c')](handleError(_0x344bdf,null));};exports[_0x809d('0x49')]=function(_0x232c72,_0xd5a194,_0x1a2e92){var _0x4ff6a3={};var _0x38fba4={};var _0xc560ee;var _0x378f16;return db[_0x809d('0x26')]['findOne']({'where':{'id':_0x232c72['params']['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0xd5a194,null))[_0x809d('0x1f')](function(_0x5bf431){if(_0x5bf431){_0xc560ee=_0x5bf431;_0x38fba4[_0x809d('0x2b')]=_[_0x809d('0x2d')](db[_0x809d('0x4a')][_0x809d('0x27')]);_0x38fba4[_0x809d('0x2c')]=_[_0x809d('0x2d')](_0x232c72[_0x809d('0x2c')]);_0x38fba4[_0x809d('0x2e')]=_['intersection'](_0x38fba4[_0x809d('0x2b')],_0x38fba4[_0x809d('0x2c')]);_0x4ff6a3[_0x809d('0x2f')]=_['intersection'](_0x38fba4['model'],qs[_0x809d('0x30')](_0x232c72[_0x809d('0x2c')][_0x809d('0x30')]));_0x4ff6a3[_0x809d('0x2f')]=_0x4ff6a3[_0x809d('0x2f')]['length']?_0x4ff6a3['attributes']:_0x38fba4[_0x809d('0x2b')];_0x4ff6a3[_0x809d('0x47')]=qs[_0x809d('0x34')](_0x232c72[_0x809d('0x2c')]['sort']);_0x4ff6a3[_0x809d('0x35')]=qs[_0x809d('0x2e')](_['pick'](_0x232c72[_0x809d('0x2c')],_0x38fba4[_0x809d('0x2e')]));if(_0x232c72['query'][_0x809d('0x37')]){_0x4ff6a3[_0x809d('0x35')]=_[_0x809d('0x38')](_0x4ff6a3[_0x809d('0x35')],{'$or':_[_0x809d('0x48')](_0x4ff6a3['attributes'],function(_0x594726){var _0x1da3f2={};_0x1da3f2[_0x594726]={'$like':'%'+_0x232c72[_0x809d('0x2c')][_0x809d('0x37')]+'%'};return _0x1da3f2;})});}_0x4ff6a3=_['merge']({},_0x4ff6a3,_0x232c72[_0x809d('0x40')]);return _0xc560ee['getSubjects'](_0x4ff6a3);}})['then'](function(_0x4816fe){if(_0x4816fe){_0x378f16=_0x4816fe[_0x809d('0x31')];if(!_0x232c72[_0x809d('0x2c')]['hasOwnProperty'](_0x809d('0x33'))){_0x4ff6a3[_0x809d('0x1a')]=qs['limit'](_0x232c72[_0x809d('0x2c')][_0x809d('0x1a')]);_0x4ff6a3[_0x809d('0x1c')]=qs[_0x809d('0x1c')](_0x232c72[_0x809d('0x2c')][_0x809d('0x1c')]);}return _0xc560ee[_0x809d('0x49')](_0x4ff6a3);}})['then'](function(_0x434274){if(_0x434274){return _0x434274?{'count':_0x378f16,'rows':_0x434274}:null;}})[_0x809d('0x1f')](respondWithResult(_0xd5a194,null))[_0x809d('0x3c')](handleError(_0xd5a194,null));};exports[_0x809d('0x4b')]=function(_0x53320f,_0x120e3a,_0x54a00d){var _0x45c683={};var _0x36324c={};var _0x5a72ae;var _0x3da133;return db[_0x809d('0x26')][_0x809d('0x46')]({'where':{'id':_0x53320f[_0x809d('0x3e')]['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0x120e3a,null))[_0x809d('0x1f')](function(_0x85d1f8){if(_0x85d1f8){_0x5a72ae=_0x85d1f8;_0x36324c[_0x809d('0x2b')]=_['keys'](db[_0x809d('0x4a')][_0x809d('0x27')]);_0x36324c[_0x809d('0x2c')]=_[_0x809d('0x2d')](_0x53320f[_0x809d('0x2c')]);_0x36324c['filters']=_[_0x809d('0x3f')](_0x36324c[_0x809d('0x2b')],_0x36324c['query']);_0x45c683[_0x809d('0x2f')]=_[_0x809d('0x3f')](_0x36324c['model'],qs[_0x809d('0x30')](_0x53320f[_0x809d('0x2c')][_0x809d('0x30')]));_0x45c683[_0x809d('0x2f')]=_0x45c683['attributes']['length']?_0x45c683[_0x809d('0x2f')]:_0x36324c[_0x809d('0x2b')];_0x45c683['order']=qs[_0x809d('0x34')](_0x53320f[_0x809d('0x2c')]['sort']);_0x45c683[_0x809d('0x35')]=qs[_0x809d('0x2e')](_[_0x809d('0x36')](_0x53320f['query'],_0x36324c[_0x809d('0x2e')]));if(_0x53320f[_0x809d('0x2c')][_0x809d('0x37')]){_0x45c683[_0x809d('0x35')]=_['merge'](_0x45c683[_0x809d('0x35')],{'$or':_[_0x809d('0x48')](_0x45c683['attributes'],function(_0x3a8633){var _0x16c0c8={};_0x16c0c8[_0x3a8633]={'$like':'%'+_0x53320f[_0x809d('0x2c')]['filter']+'%'};return _0x16c0c8;})});}_0x45c683=_[_0x809d('0x38')]({},_0x45c683,_0x53320f[_0x809d('0x40')]);return _0x5a72ae[_0x809d('0x4b')](_0x45c683);}})[_0x809d('0x1f')](function(_0x40593f){if(_0x40593f){_0x3da133=_0x40593f['length'];if(!_0x53320f[_0x809d('0x2c')]['hasOwnProperty'](_0x809d('0x33'))){_0x45c683[_0x809d('0x1a')]=qs[_0x809d('0x1a')](_0x53320f[_0x809d('0x2c')][_0x809d('0x1a')]);_0x45c683[_0x809d('0x1c')]=qs[_0x809d('0x1c')](_0x53320f[_0x809d('0x2c')][_0x809d('0x1c')]);}return _0x5a72ae[_0x809d('0x4b')](_0x45c683);}})[_0x809d('0x1f')](function(_0x7c63e){if(_0x7c63e){return _0x7c63e?{'count':_0x3da133,'rows':_0x7c63e}:null;}})[_0x809d('0x1f')](respondWithResult(_0x120e3a,null))[_0x809d('0x3c')](handleError(_0x120e3a,null));};exports[_0x809d('0x4c')]=function(_0x55be92,_0x341519,_0xc4c622){var _0x449d00={};var _0x496ca8={};var _0x311068;var _0x5ed1b9;return db['FreshdeskConfiguration'][_0x809d('0x46')]({'where':{'id':_0x55be92[_0x809d('0x3e')]['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0x341519,null))[_0x809d('0x1f')](function(_0x906556){if(_0x906556){_0x311068=_0x906556;_0x496ca8[_0x809d('0x2b')]=_['keys'](db['Tag'][_0x809d('0x27')]);_0x496ca8['query']=_['keys'](_0x55be92[_0x809d('0x2c')]);_0x496ca8[_0x809d('0x2e')]=_[_0x809d('0x3f')](_0x496ca8[_0x809d('0x2b')],_0x496ca8[_0x809d('0x2c')]);_0x449d00['attributes']=_['intersection'](_0x496ca8[_0x809d('0x2b')],qs[_0x809d('0x30')](_0x55be92['query']['fields']));_0x449d00['attributes']=_0x449d00[_0x809d('0x2f')][_0x809d('0x31')]?_0x449d00[_0x809d('0x2f')]:_0x496ca8[_0x809d('0x2b')];_0x449d00['order']=qs['sort'](_0x55be92[_0x809d('0x2c')][_0x809d('0x34')]);_0x449d00['where']=qs['filters'](_['pick'](_0x55be92[_0x809d('0x2c')],_0x496ca8['filters']));if(_0x55be92[_0x809d('0x2c')][_0x809d('0x37')]){_0x449d00[_0x809d('0x35')]=_['merge'](_0x449d00[_0x809d('0x35')],{'$or':_[_0x809d('0x48')](_0x449d00[_0x809d('0x2f')],function(_0x2e929b){var _0x183fd3={};_0x183fd3[_0x2e929b]={'$like':'%'+_0x55be92[_0x809d('0x2c')][_0x809d('0x37')]+'%'};return _0x183fd3;})});}_0x449d00=_[_0x809d('0x38')]({},_0x449d00,_0x55be92[_0x809d('0x40')]);return _0x311068[_0x809d('0x4c')](_0x449d00);}})['then'](function(_0x255f2){if(_0x255f2){_0x5ed1b9=_0x255f2['length'];if(!_0x55be92['query'][_0x809d('0x32')](_0x809d('0x33'))){_0x449d00[_0x809d('0x1a')]=qs[_0x809d('0x1a')](_0x55be92['query']['limit']);_0x449d00['offset']=qs['offset'](_0x55be92[_0x809d('0x2c')]['offset']);}return _0x311068[_0x809d('0x4c')](_0x449d00);}})[_0x809d('0x1f')](function(_0x130e5f){if(_0x130e5f){return _0x130e5f?{'count':_0x5ed1b9,'rows':_0x130e5f}:null;}})[_0x809d('0x1f')](respondWithResult(_0x341519,null))[_0x809d('0x3c')](handleError(_0x341519,null));};exports[_0x809d('0x4d')]=function(_0x54ca17,_0x4ff15f,_0x537a37){if(_0x54ca17[_0x809d('0x43')]['id']){delete _0x54ca17[_0x809d('0x43')]['id'];}return db[_0x809d('0x26')]['findOne']({'where':{'id':_0x54ca17[_0x809d('0x3e')]['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0x4ff15f,null))[_0x809d('0x1f')](function(_0x9e6efc){if(_0x9e6efc){return _0x9e6efc['setTags'](_0x54ca17[_0x809d('0x43')][_0x809d('0x4e')]||[]);}return null;})[_0x809d('0x1f')](respondWithResult(_0x4ff15f,null))[_0x809d('0x3c')](handleError(_0x4ff15f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7df55fe..797e839 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 _0x7d2e=['define','int_freshdesk_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0xd5349d,_0x526fa0){var _0x29d8c8=function(_0x239a0e){while(--_0x239a0e){_0xd5349d['push'](_0xd5349d['shift']());}};_0x29d8c8(++_0x526fa0);}(_0x7d2e,0x9e));var _0xe7d2=function(_0x4d0d2d,_0x4b4ca1){_0x4d0d2d=_0x4d0d2d-0x0;var _0x1e1a80=_0x7d2e[_0x4d0d2d];return _0x1e1a80;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7d2('0x0'))(_0xe7d2('0x1'));var moment=require(_0xe7d2('0x2'));var BPromise=require(_0xe7d2('0x3'));var rp=require(_0xe7d2('0x4'));var fs=require('fs');var path=require(_0xe7d2('0x5'));var rimraf=require(_0xe7d2('0x6'));var config=require(_0xe7d2('0x7'));var attributes=require(_0xe7d2('0x8'));module[_0xe7d2('0x9')]=function(_0x2b6358,_0x1b09bd){return _0x2b6358[_0xe7d2('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0xe7d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8854=['exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x334e97,_0x3fefaa){var _0x42e74d=function(_0x382363){while(--_0x382363){_0x334e97['push'](_0x334e97['shift']());}};_0x42e74d(++_0x3fefaa);}(_0x8854,0x1e7));var _0x4885=function(_0x30094f,_0x4f1ec4){_0x30094f=_0x30094f-0x0;var _0x11fa2a=_0x8854[_0x30094f];return _0x11fa2a;};'use strict';var _=require(_0x4885('0x0'));var util=require('util');var logger=require(_0x4885('0x1'))(_0x4885('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4885('0x3'));var fs=require('fs');var path=require(_0x4885('0x4'));var rimraf=require(_0x4885('0x5'));var config=require(_0x4885('0x6'));var attributes=require(_0x4885('0x7'));module[_0x4885('0x8')]=function(_0x39b21e,_0x3c373d){return _0x39b21e[_0x4885('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x4885('0xa'),'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 f7a624c..fccb587 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 _0x98ec=['code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e3ffe,_0x49510e){var _0x57cbcd=function(_0x5c1177){while(--_0x5c1177){_0x2e3ffe['push'](_0x2e3ffe['shift']());}};_0x57cbcd(++_0x49510e);}(_0x98ec,0x76));var _0xc98e=function(_0x525c0e,_0x2da864){_0x525c0e=_0x525c0e-0x0;var _0x48985a=_0x98ec[_0x525c0e];return _0x48985a;};'use strict';var _=require(_0xc98e('0x0'));var util=require(_0xc98e('0x1'));var moment=require(_0xc98e('0x2'));var BPromise=require('bluebird');var rs=require(_0xc98e('0x3'));var fs=require('fs');var Redis=require(_0xc98e('0x4'));var db=require(_0xc98e('0x5'))['db'];var utils=require(_0xc98e('0x6'));var logger=require(_0xc98e('0x7'))(_0xc98e('0x8'));var config=require(_0xc98e('0x9'));var jayson=require(_0xc98e('0xa'));var client=jayson[_0xc98e('0xb')][_0xc98e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1795b9,_0x26dade,_0x3416d4){return new BPromise(function(_0x3a1419,_0x28e576){return client[_0xc98e('0xd')](_0x1795b9,_0x3416d4)['then'](function(_0x2d1eaa){logger[_0xc98e('0xe')](_0xc98e('0xf'),_0x26dade,'request\x20sent');logger['debug'](_0xc98e('0x10'),_0x26dade,_0xc98e('0x11'),JSON[_0xc98e('0x12')](_0x2d1eaa));if(_0x2d1eaa[_0xc98e('0x13')]){if(_0x2d1eaa[_0xc98e('0x13')][_0xc98e('0x14')]===0x1f4){logger[_0xc98e('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x26dade,_0x2d1eaa['error'][_0xc98e('0x15')]);return _0x28e576(_0x2d1eaa[_0xc98e('0x13')][_0xc98e('0x15')]);}logger[_0xc98e('0x13')](_0xc98e('0xf'),_0x26dade,_0x2d1eaa[_0xc98e('0x13')][_0xc98e('0x15')]);return _0x3a1419(_0x2d1eaa['error']['message']);}else{logger[_0xc98e('0xe')](_0xc98e('0xf'),_0x26dade,_0xc98e('0x11'));_0x3a1419(_0x2d1eaa[_0xc98e('0x16')][_0xc98e('0x15')]);}})['catch'](function(_0x57263c){logger['error'](_0xc98e('0xf'),_0x26dade,_0x57263c);_0x28e576(_0x57263c);});});} \ No newline at end of file +var _0x28bd=['rpc','../../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','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c4f20,_0x266ec5){var _0x23c80d=function(_0x7b7256){while(--_0x7b7256){_0x1c4f20['push'](_0x1c4f20['shift']());}};_0x23c80d(++_0x266ec5);}(_0x28bd,0xf7));var _0xd28b=function(_0x195601,_0xdae54f){_0x195601=_0x195601-0x0;var _0x5263d6=_0x28bd[_0x195601];return _0x5263d6;};'use strict';var _=require('lodash');var util=require(_0xd28b('0x0'));var moment=require(_0xd28b('0x1'));var BPromise=require(_0xd28b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd28b('0x3'))['db'];var utils=require(_0xd28b('0x4'));var logger=require(_0xd28b('0x5'))(_0xd28b('0x6'));var config=require(_0xd28b('0x7'));var jayson=require(_0xd28b('0x8'));var client=jayson[_0xd28b('0x9')][_0xd28b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x426978,_0x2bb46c,_0x448be6){return new BPromise(function(_0x3bad66,_0x563859){return client[_0xd28b('0xb')](_0x426978,_0x448be6)[_0xd28b('0xc')](function(_0x58c446){logger[_0xd28b('0xd')](_0xd28b('0xe'),_0x2bb46c,'request\x20sent');logger[_0xd28b('0xf')](_0xd28b('0x10'),_0x2bb46c,_0xd28b('0x11'),JSON[_0xd28b('0x12')](_0x58c446));if(_0x58c446[_0xd28b('0x13')]){if(_0x58c446[_0xd28b('0x13')]['code']===0x1f4){logger[_0xd28b('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2bb46c,_0x58c446[_0xd28b('0x13')][_0xd28b('0x14')]);return _0x563859(_0x58c446[_0xd28b('0x13')][_0xd28b('0x14')]);}logger[_0xd28b('0x13')](_0xd28b('0xe'),_0x2bb46c,_0x58c446[_0xd28b('0x13')][_0xd28b('0x14')]);return _0x3bad66(_0x58c446['error'][_0xd28b('0x14')]);}else{logger[_0xd28b('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2bb46c,_0xd28b('0x11'));_0x3bad66(_0x58c446[_0xd28b('0x15')][_0xd28b('0x14')]);}})[_0xd28b('0x16')](function(_0x2f2ce3){logger[_0xd28b('0x13')](_0xd28b('0xe'),_0x2bb46c,_0x2f2ce3);_0x563859(_0x2f2ce3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2087332..d3d1c1b 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 _0x2e98=['../../config/environment','get','isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x2e98,0x184));var _0x82e9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2e98[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x82e9('0x0'));var util=require(_0x82e9('0x1'));var path=require(_0x82e9('0x2'));var timeout=require(_0x82e9('0x3'));var express=require(_0x82e9('0x4'));var router=express[_0x82e9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x82e9('0x6'));var interaction=require(_0x82e9('0x7'));var config=require(_0x82e9('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x82e9('0x9')]('/',auth[_0x82e9('0xa')](),controller['index']);router[_0x82e9('0x9')](_0x82e9('0xb'),auth[_0x82e9('0xa')](),controller[_0x82e9('0xc')]);router['post']('/',auth[_0x82e9('0xa')](),controller['create']);router[_0x82e9('0xd')](_0x82e9('0xb'),auth[_0x82e9('0xa')](),controller[_0x82e9('0xe')]);router[_0x82e9('0xf')](_0x82e9('0xb'),auth[_0x82e9('0xa')](),controller[_0x82e9('0x10')]);module[_0x82e9('0x11')]=router; \ No newline at end of file +var _0xbdfd=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xbdfd,0x1e3));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xdbdf('0x0'));var path=require(_0xdbdf('0x1'));var timeout=require('connect-timeout');var express=require(_0xdbdf('0x2'));var router=express[_0xdbdf('0x3')]();var fs_extra=require(_0xdbdf('0x4'));var auth=require(_0xdbdf('0x5'));var interaction=require(_0xdbdf('0x6'));var config=require(_0xdbdf('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xdbdf('0x8')]('/',auth[_0xdbdf('0x9')](),controller[_0xdbdf('0xa')]);router['get'](_0xdbdf('0xb'),auth[_0xdbdf('0x9')](),controller[_0xdbdf('0xc')]);router[_0xdbdf('0xd')]('/',auth[_0xdbdf('0x9')](),controller[_0xdbdf('0xe')]);router[_0xdbdf('0xf')](_0xdbdf('0xb'),auth[_0xdbdf('0x9')](),controller[_0xdbdf('0x10')]);router[_0xdbdf('0x11')](_0xdbdf('0xb'),auth[_0xdbdf('0x9')](),controller[_0xdbdf('0x12')]);module[_0xdbdf('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4b3e78f..03490a2 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 _0xd340=['string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','picklist'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0xd340,0x1cf));var _0x0d34=function(_0x3dd7e6,_0xdb9eda){_0x3dd7e6=_0x3dd7e6-0x0;var _0x485ba=_0xd340[_0x3dd7e6];return _0x485ba;};'use strict';var Sequelize=require(_0x0d34('0x0'));module[_0x0d34('0x1')]={'type':{'type':Sequelize[_0x0d34('0x2')]('string','variable',_0x0d34('0x3'),'keyValue',_0x0d34('0x4')),'defaultValue':_0x0d34('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0d34('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0d34('0x5'),_0x0d34('0x7'),_0x0d34('0x3'))},'keyContent':{'type':Sequelize[_0x0d34('0x6')]},'idField':{'type':Sequelize[_0x0d34('0x6')]},'nameField':{'type':Sequelize[_0x0d34('0x6')]},'customField':{'type':Sequelize[_0x0d34('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d34('0x6')]}}; \ No newline at end of file +var _0xd689=['sequelize','ENUM','string','customVariable','keyValue','picklist','variable','STRING','BOOLEAN'];(function(_0x18920e,_0x40637c){var _0x5b7eb8=function(_0x49e67e){while(--_0x49e67e){_0x18920e['push'](_0x18920e['shift']());}};_0x5b7eb8(++_0x40637c);}(_0xd689,0xfc));var _0x9d68=function(_0x167a71,_0x68d27d){_0x167a71=_0x167a71-0x0;var _0x3778c5=_0xd689[_0x167a71];return _0x3778c5;};'use strict';var Sequelize=require(_0x9d68('0x0'));module['exports']={'type':{'type':Sequelize[_0x9d68('0x1')](_0x9d68('0x2'),'variable',_0x9d68('0x3'),_0x9d68('0x4'),_0x9d68('0x5')),'defaultValue':_0x9d68('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d68('0x1')](_0x9d68('0x2'),_0x9d68('0x6'),_0x9d68('0x3'))},'keyContent':{'type':Sequelize[_0x9d68('0x7')]},'idField':{'type':Sequelize[_0x9d68('0x7')]},'nameField':{'type':Sequelize[_0x9d68('0x7')]},'customField':{'type':Sequelize[_0x9d68('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d68('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 4253fd4..c2bfceb 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 _0xe605=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3ce364,_0x15099c){var _0x4b8ca2=function(_0x324db2){while(--_0x324db2){_0x3ce364['push'](_0x3ce364['shift']());}};_0x4b8ca2(++_0x15099c);}(_0xe605,0x92));var _0x5e60=function(_0x2dad1b,_0xdb8cea){_0x2dad1b=_0x2dad1b-0x0;var _0x12e4c2=_0xe605[_0x2dad1b];return _0x12e4c2;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2a499e[_0x5e60('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cb62,_0x56e3a5){return function(_0x2d8aac){if(!_0x2d8aac){_0x45cb62[_0x5e60('0x19')](0x194);}return _0x2d8aac;};}function handleError(_0x4a0dbc,_0x3bedea){_0x3bedea=_0x3bedea||0x1f4;return function(_0x5712f7){logger[_0x5e60('0x28')](_0x5712f7[_0x5e60('0x29')]);if(_0x5712f7['name']){delete _0x5712f7[_0x5e60('0x2a')];}_0x4a0dbc[_0x5e60('0x1a')](_0x3bedea)['send'](_0x5712f7);};}exports[_0x5e60('0x2b')]=function(_0xac9c7a,_0x52c97c){var _0x5431a8={},_0x52f668={},_0xf25956={'count':0x0,'rows':[]};var _0x235cc7=_[_0x5e60('0x2c')](db[_0x5e60('0x2d')][_0x5e60('0x2e')],function(_0x558197){return{'name':_0x558197[_0x5e60('0x2f')],'type':_0x558197[_0x5e60('0x30')]['key']};});_0x52f668[_0x5e60('0x31')]=_['map'](_0x235cc7,'name');_0x52f668[_0x5e60('0x32')]=_[_0x5e60('0x33')](_0xac9c7a[_0x5e60('0x32')]);_0x52f668[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],_0x52f668[_0x5e60('0x32')]);_0x5431a8[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],qs['fields'](_0xac9c7a[_0x5e60('0x32')]['fields']));_0x5431a8['attributes']=_0x5431a8[_0x5e60('0x36')][_0x5e60('0x37')]?_0x5431a8['attributes']:_0x52f668[_0x5e60('0x31')];if(!_0xac9c7a['query'][_0x5e60('0x38')](_0x5e60('0x39'))){_0x5431a8[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x1e')]);_0x5431a8[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0xac9c7a['query'][_0x5e60('0x1d')]);}_0x5431a8[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3b')]);_0x5431a8[_0x5e60('0x3c')]=qs[_0x5e60('0x34')](_['pick'](_0xac9c7a[_0x5e60('0x32')],_0x52f668[_0x5e60('0x34')]),_0x235cc7);if(_0xac9c7a['query']['filter']){_0x5431a8[_0x5e60('0x3c')]=_[_0x5e60('0x3d')](_0x5431a8[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2c')](_0x235cc7,function(_0x31b900){if(_0x31b900['type']!==_0x5e60('0x3e')){var _0x413bf0={};_0x413bf0[_0x31b900[_0x5e60('0x2a')]]={'$like':'%'+_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3f')]+'%'};return _0x413bf0;}})});}_0x5431a8=_[_0x5e60('0x3d')]({},_0x5431a8,_0xac9c7a[_0x5e60('0x40')]);var _0x54022a={'where':_0x5431a8[_0x5e60('0x3c')]};return db[_0x5e60('0x2d')]['count'](_0x54022a)['then'](function(_0x47a6df){_0xf25956[_0x5e60('0x20')]=_0x47a6df;if(_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x41')]){_0x5431a8[_0x5e60('0x42')]=[{'all':!![]}];}return db['FreshdeskField'][_0x5e60('0x43')](_0x5431a8);})[_0x5e60('0x26')](function(_0x4b6192){_0xf25956['rows']=_0x4b6192;return _0xf25956;})[_0x5e60('0x26')](respondWithFilteredResult(_0x52c97c,_0x5431a8))[_0x5e60('0x44')](handleError(_0x52c97c,null));};exports[_0x5e60('0x45')]=function(_0x38ff1d,_0x39ab09){var _0x3899ae={'raw':!![],'where':{'id':_0x38ff1d[_0x5e60('0x46')]['id']}},_0x2522d2={};_0x2522d2[_0x5e60('0x31')]=_['keys'](db[_0x5e60('0x2d')][_0x5e60('0x2e')]);_0x2522d2['query']=_[_0x5e60('0x33')](_0x38ff1d[_0x5e60('0x32')]);_0x2522d2[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],_0x2522d2['query']);_0x3899ae[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],qs[_0x5e60('0x47')](_0x38ff1d['query']['fields']));_0x3899ae['attributes']=_0x3899ae[_0x5e60('0x36')][_0x5e60('0x37')]?_0x3899ae[_0x5e60('0x36')]:_0x2522d2[_0x5e60('0x31')];if(_0x38ff1d[_0x5e60('0x32')][_0x5e60('0x41')]){_0x3899ae['include']=[{'all':!![]}];}_0x3899ae=_[_0x5e60('0x3d')]({},_0x3899ae,_0x38ff1d[_0x5e60('0x40')]);return db[_0x5e60('0x2d')][_0x5e60('0x48')](_0x3899ae)[_0x5e60('0x26')](handleEntityNotFound(_0x39ab09,null))[_0x5e60('0x26')](respondWithResult(_0x39ab09,null))[_0x5e60('0x44')](handleError(_0x39ab09,null));};exports['create']=function(_0x24c757,_0x3ed45d){return db[_0x5e60('0x2d')][_0x5e60('0x49')](_0x24c757[_0x5e60('0x4a')],{})[_0x5e60('0x26')](respondWithResult(_0x3ed45d,0xc9))[_0x5e60('0x44')](handleError(_0x3ed45d,null));};exports[_0x5e60('0x25')]=function(_0x1518bd,_0x350d6d){if(_0x1518bd[_0x5e60('0x4a')]['id']){delete _0x1518bd[_0x5e60('0x4a')]['id'];}return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x1518bd[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x350d6d,null))[_0x5e60('0x26')](saveUpdates(_0x1518bd[_0x5e60('0x4a')],null))['then'](respondWithResult(_0x350d6d,null))['catch'](handleError(_0x350d6d,null));};exports[_0x5e60('0x27')]=function(_0x4d3588,_0x3525d){return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x4d3588[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x3525d,null))[_0x5e60('0x26')](removeEntity(_0x3525d,null))['catch'](handleError(_0x3525d,null));}; \ No newline at end of file +var _0x3c81=['apply','reject','save','update','then','destroy','end','error','name','send','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c81,0x102));var _0x13c8=function(_0x25ffc9,_0x20b246){_0x25ffc9=_0x25ffc9-0x0;var _0x546e50=_0x3c81[_0x25ffc9];return _0x546e50;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x28')]();});}};}function handleEntityNotFound(_0x4aff35,_0x47e8ae){return function(_0x5ad0dc){if(!_0x5ad0dc){_0x4aff35[_0x13c8('0x19')](0x194);}return _0x5ad0dc;};}function handleError(_0xc7f1b6,_0x53ada9){_0x53ada9=_0x53ada9||0x1f4;return function(_0x4df077){logger[_0x13c8('0x29')](_0x4df077['stack']);if(_0x4df077['name']){delete _0x4df077[_0x13c8('0x2a')];}_0xc7f1b6[_0x13c8('0x1a')](_0x53ada9)[_0x13c8('0x2b')](_0x4df077);};}exports['index']=function(_0x5ef2f7,_0x277a89){var _0x1071a0={},_0x399840={},_0x441182={'count':0x0,'rows':[]};var _0x138017=_[_0x13c8('0x2c')](db[_0x13c8('0x2d')]['rawAttributes'],function(_0x109cb8){return{'name':_0x109cb8[_0x13c8('0x2e')],'type':_0x109cb8['type']['key']};});_0x399840[_0x13c8('0x2f')]=_[_0x13c8('0x2c')](_0x138017,'name');_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x31')](_0x5ef2f7['query']);_0x399840[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],_0x399840[_0x13c8('0x30')]);_0x1071a0[_0x13c8('0x34')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x5ef2f7['query']['fields']));_0x1071a0[_0x13c8('0x34')]=_0x1071a0[_0x13c8('0x34')]['length']?_0x1071a0[_0x13c8('0x34')]:_0x399840['model'];if(!_0x5ef2f7[_0x13c8('0x30')]['hasOwnProperty'](_0x13c8('0x36'))){_0x1071a0[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x1d')]);_0x1071a0[_0x13c8('0x1c')]=qs[_0x13c8('0x1c')](_0x5ef2f7['query'][_0x13c8('0x1c')]);}_0x1071a0[_0x13c8('0x37')]=qs['sort'](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x38')]);_0x1071a0[_0x13c8('0x39')]=qs['filters'](_['pick'](_0x5ef2f7['query'],_0x399840[_0x13c8('0x32')]),_0x138017);if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]){_0x1071a0[_0x13c8('0x39')]=_[_0x13c8('0x3b')](_0x1071a0[_0x13c8('0x39')],{'$or':_[_0x13c8('0x2c')](_0x138017,function(_0xe19858){if(_0xe19858[_0x13c8('0x3c')]!=='VIRTUAL'){var _0x5b2a28={};_0x5b2a28[_0xe19858[_0x13c8('0x2a')]]={'$like':'%'+_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]+'%'};return _0x5b2a28;}})});}_0x1071a0=_[_0x13c8('0x3b')]({},_0x1071a0,_0x5ef2f7['options']);var _0x35e1e7={'where':_0x1071a0['where']};return db[_0x13c8('0x2d')][_0x13c8('0x1f')](_0x35e1e7)[_0x13c8('0x26')](function(_0x1cd02c){_0x441182[_0x13c8('0x1f')]=_0x1cd02c;if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3d')]){_0x1071a0[_0x13c8('0x3e')]=[{'all':!![]}];}return db[_0x13c8('0x2d')][_0x13c8('0x3f')](_0x1071a0);})[_0x13c8('0x26')](function(_0x416169){_0x441182[_0x13c8('0x40')]=_0x416169;return _0x441182;})[_0x13c8('0x26')](respondWithFilteredResult(_0x277a89,_0x1071a0))[_0x13c8('0x41')](handleError(_0x277a89,null));};exports[_0x13c8('0x42')]=function(_0x1b2ada,_0x1505fb){var _0xc5eb86={'raw':!![],'where':{'id':_0x1b2ada[_0x13c8('0x43')]['id']}},_0x1cff99={};_0x1cff99[_0x13c8('0x2f')]=_[_0x13c8('0x31')](db[_0x13c8('0x2d')][_0x13c8('0x44')]);_0x1cff99['query']=_[_0x13c8('0x31')](_0x1b2ada[_0x13c8('0x30')]);_0x1cff99[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],_0x1cff99['query']);_0xc5eb86['attributes']=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x1b2ada['query']['fields']));_0xc5eb86['attributes']=_0xc5eb86[_0x13c8('0x34')]['length']?_0xc5eb86[_0x13c8('0x34')]:_0x1cff99['model'];if(_0x1b2ada[_0x13c8('0x30')][_0x13c8('0x3d')]){_0xc5eb86[_0x13c8('0x3e')]=[{'all':!![]}];}_0xc5eb86=_[_0x13c8('0x3b')]({},_0xc5eb86,_0x1b2ada[_0x13c8('0x45')]);return db[_0x13c8('0x2d')]['find'](_0xc5eb86)[_0x13c8('0x26')](handleEntityNotFound(_0x1505fb,null))[_0x13c8('0x26')](respondWithResult(_0x1505fb,null))['catch'](handleError(_0x1505fb,null));};exports[_0x13c8('0x46')]=function(_0x26155d,_0x2e925f){return db[_0x13c8('0x2d')][_0x13c8('0x46')](_0x26155d['body'],{})[_0x13c8('0x26')](respondWithResult(_0x2e925f,0xc9))[_0x13c8('0x41')](handleError(_0x2e925f,null));};exports[_0x13c8('0x25')]=function(_0x38418b,_0x185d18){if(_0x38418b['body']['id']){delete _0x38418b[_0x13c8('0x47')]['id'];}return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x38418b[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x185d18,null))[_0x13c8('0x26')](saveUpdates(_0x38418b[_0x13c8('0x47')],null))[_0x13c8('0x26')](respondWithResult(_0x185d18,null))[_0x13c8('0x41')](handleError(_0x185d18,null));};exports[_0x13c8('0x27')]=function(_0x266f4e,_0x5e1fe5){return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x266f4e[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x5e1fe5,null))[_0x13c8('0x26')](removeEntity(_0x5e1fe5,null))[_0x13c8('0x41')](handleError(_0x5e1fe5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index ecf3327..d0a520a 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 _0xdd5f=['lodash','../../config/logger','moment','bluebird','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x2f46ce,_0x52ba06){var _0x423481=function(_0x571105){while(--_0x571105){_0x2f46ce['push'](_0x2f46ce['shift']());}};_0x423481(++_0x52ba06);}(_0xdd5f,0x195));var _0xfdd5=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xdd5f[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xfdd5('0x0'));var util=require('util');var logger=require(_0xfdd5('0x1'))('api');var moment=require(_0xfdd5('0x2'));var BPromise=require(_0xfdd5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfdd5('0x4'));var attributes=require(_0xfdd5('0x5'));module[_0xfdd5('0x6')]=function(_0x102410,_0x305ab3){return _0x102410[_0xfdd5('0x7')](_0xfdd5('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9975=['exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskField.attributes'];(function(_0x1ba47c,_0x3445d0){var _0xa2f088=function(_0x22938b){while(--_0x22938b){_0x1ba47c['push'](_0x1ba47c['shift']());}};_0xa2f088(++_0x3445d0);}(_0x9975,0xf6));var _0x5997=function(_0x5b1c32,_0x4673d4){_0x5b1c32=_0x5b1c32-0x0;var _0x16316b=_0x9975[_0x5b1c32];return _0x16316b;};'use strict';var _=require(_0x5997('0x0'));var util=require(_0x5997('0x1'));var logger=require(_0x5997('0x2'))(_0x5997('0x3'));var moment=require(_0x5997('0x4'));var BPromise=require(_0x5997('0x5'));var rp=require(_0x5997('0x6'));var fs=require('fs');var path=require(_0x5997('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5997('0x8'));module[_0x5997('0x9')]=function(_0x11a007,_0x44950b){return _0x11a007[_0x5997('0xa')](_0x5997('0xb'),attributes,{'tableName':_0x5997('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x5997('0xd'),_0x5997('0xe')],'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 e6d64df..20c0980 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 _0x8e3c=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3f5bc0,_0x18a04c){var _0x2d33be=function(_0x19e4b3){while(--_0x19e4b3){_0x3f5bc0['push'](_0x3f5bc0['shift']());}};_0x2d33be(++_0x18a04c);}(_0x8e3c,0x1ac));var _0xc8e3=function(_0x3c00e9,_0x1f46cc){_0x3c00e9=_0x3c00e9-0x0;var _0x7b1d40=_0x8e3c[_0x3c00e9];return _0x7b1d40;};'use strict';var _=require(_0xc8e3('0x0'));var util=require(_0xc8e3('0x1'));var moment=require(_0xc8e3('0x2'));var BPromise=require(_0xc8e3('0x3'));var rs=require(_0xc8e3('0x4'));var fs=require('fs');var Redis=require(_0xc8e3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8e3('0x6'));var logger=require(_0xc8e3('0x7'))('rpc');var config=require(_0xc8e3('0x8'));var jayson=require(_0xc8e3('0x9'));var client=jayson[_0xc8e3('0xa')][_0xc8e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5034d4,_0x6c849d,_0x482c84){return new BPromise(function(_0x2d8d2c,_0x152cf9){return client[_0xc8e3('0xc')](_0x5034d4,_0x482c84)[_0xc8e3('0xd')](function(_0x1b62a4){logger[_0xc8e3('0xe')](_0xc8e3('0xf'),_0x6c849d,_0xc8e3('0x10'));logger[_0xc8e3('0x11')](_0xc8e3('0x12'),_0x6c849d,_0xc8e3('0x10'),JSON[_0xc8e3('0x13')](_0x1b62a4));if(_0x1b62a4[_0xc8e3('0x14')]){if(_0x1b62a4[_0xc8e3('0x14')]['code']===0x1f4){logger[_0xc8e3('0x14')](_0xc8e3('0xf'),_0x6c849d,_0x1b62a4[_0xc8e3('0x14')][_0xc8e3('0x15')]);return _0x152cf9(_0x1b62a4[_0xc8e3('0x14')][_0xc8e3('0x15')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x6c849d,_0x1b62a4[_0xc8e3('0x14')][_0xc8e3('0x15')]);return _0x2d8d2c(_0x1b62a4[_0xc8e3('0x14')][_0xc8e3('0x15')]);}else{logger[_0xc8e3('0xe')](_0xc8e3('0xf'),_0x6c849d,'request\x20sent');_0x2d8d2c(_0x1b62a4[_0xc8e3('0x16')][_0xc8e3('0x15')]);}})[_0xc8e3('0x17')](function(_0x55c175){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x6c849d,_0x55c175);_0x152cf9(_0x55c175);});});} \ No newline at end of file +var _0xa60f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','result','message','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3f7bbe,_0x30e013){var _0x2e0545=function(_0x4686a9){while(--_0x4686a9){_0x3f7bbe['push'](_0x3f7bbe['shift']());}};_0x2e0545(++_0x30e013);}(_0xa60f,0x153));var _0xfa60=function(_0x10d2af,_0x47c53d){_0x10d2af=_0x10d2af-0x0;var _0x223208=_0xa60f[_0x10d2af];return _0x223208;};'use strict';var _=require(_0xfa60('0x0'));var util=require(_0xfa60('0x1'));var moment=require(_0xfa60('0x2'));var BPromise=require(_0xfa60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa60('0x4'));var db=require(_0xfa60('0x5'))['db'];var utils=require(_0xfa60('0x6'));var logger=require(_0xfa60('0x7'))(_0xfa60('0x8'));var config=require(_0xfa60('0x9'));var jayson=require(_0xfa60('0xa'));var client=jayson[_0xfa60('0xb')][_0xfa60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e8517,_0x476205,_0x13d47f){return new BPromise(function(_0x2d11f9,_0x4caa42){return client[_0xfa60('0xd')](_0x1e8517,_0x13d47f)['then'](function(_0x440be6){logger[_0xfa60('0xe')](_0xfa60('0xf'),_0x476205,_0xfa60('0x10'));logger[_0xfa60('0x11')](_0xfa60('0x12'),_0x476205,_0xfa60('0x10'),JSON[_0xfa60('0x13')](_0x440be6));if(_0x440be6[_0xfa60('0x14')]){if(_0x440be6[_0xfa60('0x14')]['code']===0x1f4){logger[_0xfa60('0x14')](_0xfa60('0xf'),_0x476205,_0x440be6['error']['message']);return _0x4caa42(_0x440be6['error']['message']);}logger[_0xfa60('0x14')](_0xfa60('0xf'),_0x476205,_0x440be6[_0xfa60('0x14')]['message']);return _0x2d11f9(_0x440be6[_0xfa60('0x14')]['message']);}else{logger[_0xfa60('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x476205,'request\x20sent');_0x2d11f9(_0x440be6[_0xfa60('0x15')][_0xfa60('0x16')]);}})['catch'](function(_0x37af04){logger[_0xfa60('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x476205,_0x37af04);_0x4caa42(_0x37af04);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b4b8398..535eafc 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 _0x1be1=['getFields','post','create','addConfiguration','/:id','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0x19fbfb,_0xe8c39b){var _0x5e6f51=function(_0x4dfe23){while(--_0x4dfe23){_0x19fbfb['push'](_0x19fbfb['shift']());}};_0x5e6f51(++_0xe8c39b);}(_0x1be1,0x192));var _0x11be=function(_0x1067ef,_0x117979){_0x1067ef=_0x1067ef-0x0;var _0xf327e6=_0x1be1[_0x1067ef];return _0xf327e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['getConfigurations']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);router['post'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xf')]);router['put'](_0x11be('0x10'),auth[_0x11be('0x8')](),controller['update']);router[_0x11be('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa571=['/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x2b1905,_0x3848fd){var _0x3dab44=function(_0x1a5b53){while(--_0x1a5b53){_0x2b1905['push'](_0x2b1905['shift']());}};_0x3dab44(++_0x3848fd);}(_0xa571,0x107));var _0x1a57=function(_0x290a56,_0x28a02a){_0x290a56=_0x290a56-0x0;var _0x56e834=_0xa571[_0x290a56];return _0x56e834;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getConfigurations']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router[_0x1a57('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')](_0x1a57('0xa'),auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x13')]('/:id',auth[_0x1a57('0x8')](),controller['destroy']);module[_0x1a57('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 4b6fcea..cb20cdf 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 _0x3de3=['username','remoteUri','sequelize','STRING'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x3de3,0x1ce));var _0x33de=function(_0x4793c7,_0x4fc0e0){_0x4793c7=_0x4793c7-0x0;var _0x131489=_0x3de3[_0x4793c7];return _0x131489;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'name':{'type':Sequelize[_0x33de('0x1')]},'description':{'type':Sequelize[_0x33de('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x33de('0x2')},'apiKey':{'type':Sequelize[_0x33de('0x1')]},'remoteUri':{'type':Sequelize[_0x33de('0x1')],'unique':_0x33de('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0x5e325f,_0x5d9f8d){var _0x30034e=function(_0x2f7ac5){while(--_0x2f7ac5){_0x5e325f['push'](_0x5e325f['shift']());}};_0x30034e(++_0x5d9f8d);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x1ff297,_0x13b56c){_0x1ff297=_0x1ff297-0x0;var _0x3c4bd9=_0x4e2e[_0x1ff297];return _0x3c4bd9;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index d78a406..90c3b9b 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 _0x6001=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','FreshsalesAccount','includeAll','include','findAll','rows','params','intersection','length','options','find','catch','create','body','findOne','order','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','apiKey','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1d536b,_0x494e1a){var _0x4913d8=function(_0x120b5b){while(--_0x120b5b){_0x1d536b['push'](_0x1d536b['shift']());}};_0x4913d8(++_0x494e1a);}(_0x6001,0x129));var _0x1600=function(_0xb42da0,_0x5e98b4){_0xb42da0=_0xb42da0-0x0;var _0x4036c7=_0x6001[_0xb42da0];return _0x4036c7;};'use strict';var emlformat=require(_0x1600('0x0'));var rimraf=require(_0x1600('0x1'));var zipdir=require(_0x1600('0x2'));var jsonpatch=require(_0x1600('0x3'));var rp=require(_0x1600('0x4'));var moment=require(_0x1600('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1600('0x6'));var util=require(_0x1600('0x7'));var path=require('path');var sox=require(_0x1600('0x8'));var csv=require(_0x1600('0x9'));var ejs=require(_0x1600('0xa'));var fs=require('fs');var fs_extra=require(_0x1600('0xb'));var _=require(_0x1600('0xc'));var squel=require(_0x1600('0xd'));var crypto=require(_0x1600('0xe'));var jsforce=require(_0x1600('0xf'));var deskjs=require(_0x1600('0x10'));var toCsv=require(_0x1600('0x9'));var querystring=require('querystring');var Papa=require(_0x1600('0x11'));var Redis=require(_0x1600('0x12'));var authService=require(_0x1600('0x13'));var qs=require(_0x1600('0x14'));var as=require(_0x1600('0x15'));var hardwareService=require(_0x1600('0x16'));var logger=require(_0x1600('0x17'))(_0x1600('0x18'));var utils=require(_0x1600('0x19'));var config=require(_0x1600('0x1a'));var licenseUtil=require(_0x1600('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x12a92c,_0x5d79e4){_0x5d79e4=_0x5d79e4||0xcc;return function(_0x534de1){if(_0x534de1){return _0x12a92c[_0x1600('0x1c')](_0x5d79e4);}return _0x12a92c['status'](_0x5d79e4)[_0x1600('0x1d')]();};}function respondWithResult(_0x35daff,_0x5af78b){_0x5af78b=_0x5af78b||0xc8;return function(_0x2f1cd8){if(_0x2f1cd8){return _0x35daff[_0x1600('0x1e')](_0x5af78b)[_0x1600('0x1f')](_0x2f1cd8);}};}function respondWithFilteredResult(_0x386cb0,_0x117b42){return function(_0x4b5468){if(_0x4b5468){var _0x3c98b9=typeof _0x117b42[_0x1600('0x20')]===_0x1600('0x21')&&typeof _0x117b42[_0x1600('0x22')]===_0x1600('0x21');var _0x5a8b33=_0x4b5468[_0x1600('0x23')];var _0x4aecc3=_0x3c98b9?0x0:_0x117b42[_0x1600('0x20')];var _0x4d04ec=_0x3c98b9?_0x4b5468[_0x1600('0x23')]:_0x117b42[_0x1600('0x20')]+_0x117b42[_0x1600('0x22')];var _0x257aff;if(_0x4d04ec>=_0x5a8b33){_0x4d04ec=_0x5a8b33;_0x257aff=0xc8;}else{_0x257aff=0xce;}_0x386cb0[_0x1600('0x1e')](_0x257aff);return _0x386cb0[_0x1600('0x24')]('Content-Range',_0x4aecc3+'-'+_0x4d04ec+'/'+_0x5a8b33)['json'](_0x4b5468);}return null;};}function patchUpdates(_0x5262e6){return function(_0x1f3abf){try{jsonpatch[_0x1600('0x25')](_0x1f3abf,_0x5262e6,!![]);}catch(_0x59e0b7){return BPromise[_0x1600('0x26')](_0x59e0b7);}return _0x1f3abf[_0x1600('0x27')]();};}function saveUpdates(_0x3d835f,_0x58ed9a){return function(_0x2d61f8){if(_0x2d61f8){return _0x2d61f8[_0x1600('0x28')](_0x3d835f)[_0x1600('0x29')](function(_0xb958d7){return _0xb958d7;});}return null;};}function removeEntity(_0x1c97d8,_0xc471b4){return function(_0x5e417b){if(_0x5e417b){return _0x5e417b[_0x1600('0x2a')]()['then'](function(){_0x1c97d8['status'](0xcc)[_0x1600('0x1d')]();});}};}function handleEntityNotFound(_0x3e1374,_0x88d548){return function(_0xfbf9f){if(!_0xfbf9f){_0x3e1374[_0x1600('0x1c')](0x194);}return _0xfbf9f;};}function handleError(_0x320013,_0x46cc63){_0x46cc63=_0x46cc63||0x1f4;return function(_0x22e07a){logger[_0x1600('0x2b')](_0x22e07a[_0x1600('0x2c')]);if(_0x22e07a[_0x1600('0x2d')]){delete _0x22e07a[_0x1600('0x2d')];}_0x320013[_0x1600('0x1e')](_0x46cc63)['send'](_0x22e07a);};}exports[_0x1600('0x2e')]=function(_0x1c4f0d,_0x367c05){var _0x32249e={},_0x134244={},_0x119810={'count':0x0,'rows':[]};var _0x2ce417=_[_0x1600('0x2f')](db['FreshsalesAccount'][_0x1600('0x30')],function(_0x4a9143){return{'name':_0x4a9143[_0x1600('0x31')],'type':_0x4a9143[_0x1600('0x32')][_0x1600('0x33')]};});_0x134244['model']=_['map'](_0x2ce417,_0x1600('0x2d'));_0x134244[_0x1600('0x34')]=_[_0x1600('0x35')](_0x1c4f0d[_0x1600('0x34')]);_0x134244[_0x1600('0x36')]=_['intersection'](_0x134244[_0x1600('0x37')],_0x134244[_0x1600('0x34')]);_0x32249e[_0x1600('0x38')]=_['intersection'](_0x134244['model'],qs[_0x1600('0x39')](_0x1c4f0d[_0x1600('0x34')][_0x1600('0x39')]));_0x32249e[_0x1600('0x38')]=_0x32249e['attributes']['length']?_0x32249e['attributes']:_0x134244[_0x1600('0x37')];if(!_0x1c4f0d[_0x1600('0x34')][_0x1600('0x3a')]('nolimit')){_0x32249e[_0x1600('0x22')]=qs['limit'](_0x1c4f0d[_0x1600('0x34')][_0x1600('0x22')]);_0x32249e[_0x1600('0x20')]=qs['offset'](_0x1c4f0d[_0x1600('0x34')]['offset']);}_0x32249e['order']=qs[_0x1600('0x3b')](_0x1c4f0d[_0x1600('0x34')]['sort']);_0x32249e['where']=qs[_0x1600('0x36')](_[_0x1600('0x3c')](_0x1c4f0d['query'],_0x134244[_0x1600('0x36')]),_0x2ce417);if(_0x1c4f0d[_0x1600('0x34')][_0x1600('0x3d')]){_0x32249e[_0x1600('0x3e')]=_[_0x1600('0x3f')](_0x32249e[_0x1600('0x3e')],{'$or':_[_0x1600('0x2f')](_0x2ce417,function(_0x25a251){if(_0x25a251['type']!=='VIRTUAL'){var _0x3c1e9f={};_0x3c1e9f[_0x25a251[_0x1600('0x2d')]]={'$like':'%'+_0x1c4f0d['query'][_0x1600('0x3d')]+'%'};return _0x3c1e9f;}})});}_0x32249e=_['merge']({},_0x32249e,_0x1c4f0d['options']);var _0x40377a={'where':_0x32249e[_0x1600('0x3e')]};return db[_0x1600('0x40')][_0x1600('0x23')](_0x40377a)['then'](function(_0x21fa1c){_0x119810[_0x1600('0x23')]=_0x21fa1c;if(_0x1c4f0d['query'][_0x1600('0x41')]){_0x32249e[_0x1600('0x42')]=[{'all':!![]}];}return db[_0x1600('0x40')][_0x1600('0x43')](_0x32249e);})[_0x1600('0x29')](function(_0x56f0d5){_0x119810[_0x1600('0x44')]=_0x56f0d5;return _0x119810;})[_0x1600('0x29')](respondWithFilteredResult(_0x367c05,_0x32249e))['catch'](handleError(_0x367c05,null));};exports['show']=function(_0xbd775b,_0x2fd33a){var _0x220d0d={'raw':![],'where':{'id':_0xbd775b[_0x1600('0x45')]['id']}},_0x59ee59={};_0x59ee59[_0x1600('0x37')]=_[_0x1600('0x35')](db[_0x1600('0x40')]['rawAttributes']);_0x59ee59[_0x1600('0x34')]=_[_0x1600('0x35')](_0xbd775b[_0x1600('0x34')]);_0x59ee59['filters']=_['intersection'](_0x59ee59['model'],_0x59ee59[_0x1600('0x34')]);_0x220d0d['attributes']=_[_0x1600('0x46')](_0x59ee59[_0x1600('0x37')],qs['fields'](_0xbd775b[_0x1600('0x34')][_0x1600('0x39')]));_0x220d0d['attributes']=_0x220d0d[_0x1600('0x38')][_0x1600('0x47')]?_0x220d0d[_0x1600('0x38')]:_0x59ee59[_0x1600('0x37')];if(_0xbd775b[_0x1600('0x34')][_0x1600('0x41')]){_0x220d0d[_0x1600('0x42')]=[{'all':!![]}];}_0x220d0d=_[_0x1600('0x3f')]({},_0x220d0d,_0xbd775b[_0x1600('0x48')]);return db['FreshsalesAccount'][_0x1600('0x49')](_0x220d0d)[_0x1600('0x29')](handleEntityNotFound(_0x2fd33a,null))[_0x1600('0x29')](respondWithResult(_0x2fd33a,null))[_0x1600('0x4a')](handleError(_0x2fd33a,null));};exports[_0x1600('0x4b')]=function(_0x179350,_0x475ba2){return db['FreshsalesAccount']['create'](_0x179350['body'],{})[_0x1600('0x29')](respondWithResult(_0x475ba2,0xc9))[_0x1600('0x4a')](handleError(_0x475ba2,null));};exports[_0x1600('0x28')]=function(_0x2eb766,_0x3af949){if(_0x2eb766['body']['id']){delete _0x2eb766['body']['id'];}return db[_0x1600('0x40')][_0x1600('0x49')]({'where':{'id':_0x2eb766[_0x1600('0x45')]['id']}})[_0x1600('0x29')](handleEntityNotFound(_0x3af949,null))['then'](saveUpdates(_0x2eb766[_0x1600('0x4c')],null))[_0x1600('0x29')](respondWithResult(_0x3af949,null))[_0x1600('0x4a')](handleError(_0x3af949,null));};exports[_0x1600('0x2a')]=function(_0x363873,_0x54958c){return db['FreshsalesAccount'][_0x1600('0x49')]({'where':{'id':_0x363873[_0x1600('0x45')]['id']}})[_0x1600('0x29')](handleEntityNotFound(_0x54958c,null))['then'](removeEntity(_0x54958c,null))[_0x1600('0x4a')](handleError(_0x54958c,null));};exports['getConfigurations']=function(_0x50ef91,_0x2967fd,_0x5ce783){var _0x230c97={};var _0x5b87bb={};var _0x53fdce;var _0x222cdb;return db[_0x1600('0x40')][_0x1600('0x4d')]({'where':{'id':_0x50ef91[_0x1600('0x45')]['id']}})[_0x1600('0x29')](handleEntityNotFound(_0x2967fd,null))[_0x1600('0x29')](function(_0x2f9602){if(_0x2f9602){_0x53fdce=_0x2f9602;_0x5b87bb[_0x1600('0x37')]=_['keys'](db['FreshsalesConfiguration'][_0x1600('0x30')]);_0x5b87bb[_0x1600('0x34')]=_['keys'](_0x50ef91[_0x1600('0x34')]);_0x5b87bb['filters']=_[_0x1600('0x46')](_0x5b87bb['model'],_0x5b87bb[_0x1600('0x34')]);_0x230c97['attributes']=_[_0x1600('0x46')](_0x5b87bb[_0x1600('0x37')],qs['fields'](_0x50ef91['query'][_0x1600('0x39')]));_0x230c97[_0x1600('0x38')]=_0x230c97[_0x1600('0x38')][_0x1600('0x47')]?_0x230c97['attributes']:_0x5b87bb[_0x1600('0x37')];_0x230c97[_0x1600('0x4e')]=qs[_0x1600('0x3b')](_0x50ef91[_0x1600('0x34')][_0x1600('0x3b')]);_0x230c97[_0x1600('0x3e')]=qs[_0x1600('0x36')](_['pick'](_0x50ef91[_0x1600('0x34')],_0x5b87bb[_0x1600('0x36')]));if(_0x50ef91[_0x1600('0x34')][_0x1600('0x3d')]){_0x230c97['where']=_[_0x1600('0x3f')](_0x230c97[_0x1600('0x3e')],{'$or':_[_0x1600('0x2f')](_0x230c97['attributes'],function(_0x1071e8){var _0x23f74f={};_0x23f74f[_0x1071e8]={'$like':'%'+_0x50ef91[_0x1600('0x34')][_0x1600('0x3d')]+'%'};return _0x23f74f;})});}_0x230c97=_[_0x1600('0x3f')]({},_0x230c97,_0x50ef91[_0x1600('0x48')]);return _0x53fdce[_0x1600('0x4f')](_0x230c97);}})[_0x1600('0x29')](function(_0x4e5ced){if(_0x4e5ced){_0x222cdb=_0x4e5ced['length'];if(!_0x50ef91[_0x1600('0x34')][_0x1600('0x3a')](_0x1600('0x50'))){_0x230c97['limit']=qs[_0x1600('0x22')](_0x50ef91[_0x1600('0x34')][_0x1600('0x22')]);_0x230c97['offset']=qs[_0x1600('0x20')](_0x50ef91[_0x1600('0x34')][_0x1600('0x20')]);}return _0x53fdce[_0x1600('0x4f')](_0x230c97);}})[_0x1600('0x29')](function(_0x2a2964){if(_0x2a2964){return _0x2a2964?{'count':_0x222cdb,'rows':_0x2a2964}:null;}})['then'](respondWithResult(_0x2967fd,null))[_0x1600('0x4a')](handleError(_0x2967fd,null));};exports[_0x1600('0x51')]=function(_0x6c98a3,_0x57b3d6,_0x3751c5){if(_0x6c98a3[_0x1600('0x4c')]['id']){delete _0x6c98a3[_0x1600('0x4c')]['id'];}return db[_0x1600('0x40')][_0x1600('0x4d')]({'where':{'id':_0x6c98a3[_0x1600('0x45')]['id']}})[_0x1600('0x29')](handleEntityNotFound(_0x57b3d6,null))[_0x1600('0x29')](function(_0x3d4a97){if(_0x3d4a97){_0x6c98a3[_0x1600('0x4c')]['AccountId']=_0x3d4a97['id'];_0x6c98a3[_0x1600('0x4c')][_0x1600('0x52')]=integrations[_0x1600('0x53')](_0x6c98a3[_0x1600('0x4c')][_0x1600('0x54')],_0x6c98a3['body'][_0x1600('0x32')]);_0x6c98a3[_0x1600('0x4c')][_0x1600('0x55')]=integrations[_0x1600('0x56')](_0x6c98a3[_0x1600('0x4c')]['channel'],_0x6c98a3['body'][_0x1600('0x32')]);return db['FreshsalesConfiguration'][_0x1600('0x4b')](_0x6c98a3[_0x1600('0x4c')],{'include':[{'model':db[_0x1600('0x57')],'as':_0x1600('0x52')},{'model':db[_0x1600('0x57')],'as':_0x1600('0x55')}]});}return null;})[_0x1600('0x29')](respondWithResult(_0x57b3d6,null))[_0x1600('0x4a')](handleError(_0x57b3d6,null));};exports[_0x1600('0x58')]=function(_0xbe5ec4,_0x4fd966,_0x4d56c1){var _0x3c5d21='';var _0x4b243b='';return db['FreshsalesAccount'][_0x1600('0x4d')]({'where':{'id':_0xbe5ec4[_0x1600('0x45')]['id']},'attributes':['id',_0x1600('0x59'),_0x1600('0x5a'),'apiKey']})[_0x1600('0x29')](handleEntityNotFound(_0x4fd966,null))[_0x1600('0x29')](function(_0x306eb0){if(_0x306eb0){_0x4b243b=_0x306eb0[_0x1600('0x59')];_0x3c5d21=_0x306eb0[_0x1600('0x5a')];var _0x468b11=_0x306eb0[_0x1600('0x5a')]['slice'](-0x1);if(_0x468b11==='/'){_0x3c5d21=_0x3c5d21[_0x1600('0x5b')](0x0,_0x3c5d21[_0x1600('0x5c')](_0x468b11));}return rp({'method':_0x1600('0x5d'),'uri':util[_0x1600('0x5e')]('%s%s',_0x3c5d21,_0x1600('0x5f')),'headers':{'Authorization':_0x1600('0x60')+_0x306eb0[_0x1600('0x61')]},'json':!![]});}})['then'](function(_0x107dc7){if(_0x107dc7){var _0x1c3149=_0x107dc7[_0x1600('0x62')];var _0x5c47a0=![];var _0x12d2cc=null;for(_0x12d2cc=0x0;_0x12d2cc<_0x1c3149[_0x1600('0x47')];_0x12d2cc++){if(_0x1c3149[_0x12d2cc]['email']===_0x4b243b){_0x5c47a0=!![];}}if(_0x5c47a0){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1600('0x63')});}}})[_0x1600('0x29')](respondWithResult(_0x4fd966,null))[_0x1600('0x4a')](function(_0x547881){var _0xcc0bc2=_0xbe5ec4[_0x1600('0x34')][_0x1600('0x64')]?0x1f4:_0x547881[_0x1600('0x65')]||0x1f4;logger[_0x1600('0x2b')](_0x1600('0x66'),_0x1600('0x58'),_0xcc0bc2,JSON[_0x1600('0x67')](_0x547881));delete _0x547881['name'];if(_0xcc0bc2===0x191){_0xcc0bc2=0x190;}_0x4fd966[_0x1600('0x1e')](_0xcc0bc2)[_0x1600('0x68')](_0xbe5ec4[_0x1600('0x34')][_0x1600('0x64')]?{'message':_0x1600('0x69'),'statusCode':_0x547881[_0x1600('0x65')]}:_0x547881);});}; \ No newline at end of file +var _0x7028=['catch','show','params','find','create','update','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','rows'];(function(_0x2d7e8d,_0x48a966){var _0x51a106=function(_0x23eac1){while(--_0x23eac1){_0x2d7e8d['push'](_0x2d7e8d['shift']());}};_0x51a106(++_0x48a966);}(_0x7028,0x8e));var _0x8702=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7028[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x8702('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8702('0x1'));var jsonpatch=require(_0x8702('0x2'));var rp=require(_0x8702('0x3'));var moment=require(_0x8702('0x4'));var BPromise=require(_0x8702('0x5'));var Mustache=require(_0x8702('0x6'));var util=require(_0x8702('0x7'));var path=require(_0x8702('0x8'));var sox=require('sox');var csv=require(_0x8702('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8702('0xa'));var squel=require(_0x8702('0xb'));var crypto=require(_0x8702('0xc'));var jsforce=require(_0x8702('0xd'));var deskjs=require(_0x8702('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8702('0xf'));var Papa=require('papaparse');var Redis=require(_0x8702('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8702('0x11'));var as=require(_0x8702('0x12'));var hardwareService=require(_0x8702('0x13'));var logger=require(_0x8702('0x14'))(_0x8702('0x15'));var utils=require(_0x8702('0x16'));var config=require(_0x8702('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8702('0x18'))['db'];var integrations=require(_0x8702('0x19'));function respondWithStatusCode(_0x498c7d,_0x19dbd5){_0x19dbd5=_0x19dbd5||0xcc;return function(_0x25dcd7){if(_0x25dcd7){return _0x498c7d[_0x8702('0x1a')](_0x19dbd5);}return _0x498c7d['status'](_0x19dbd5)[_0x8702('0x1b')]();};}function respondWithResult(_0x49c12d,_0x5a35cb){_0x5a35cb=_0x5a35cb||0xc8;return function(_0x406873){if(_0x406873){return _0x49c12d[_0x8702('0x1c')](_0x5a35cb)[_0x8702('0x1d')](_0x406873);}};}function respondWithFilteredResult(_0x2238e2,_0x645a3c){return function(_0x4e998b){if(_0x4e998b){var _0x408341=typeof _0x645a3c[_0x8702('0x1e')]===_0x8702('0x1f')&&typeof _0x645a3c[_0x8702('0x20')]===_0x8702('0x1f');var _0x1adb8d=_0x4e998b['count'];var _0x2daf32=_0x408341?0x0:_0x645a3c[_0x8702('0x1e')];var _0x2da594=_0x408341?_0x4e998b[_0x8702('0x21')]:_0x645a3c[_0x8702('0x1e')]+_0x645a3c[_0x8702('0x20')];var _0x51c021;if(_0x2da594>=_0x1adb8d){_0x2da594=_0x1adb8d;_0x51c021=0xc8;}else{_0x51c021=0xce;}_0x2238e2[_0x8702('0x1c')](_0x51c021);return _0x2238e2[_0x8702('0x22')](_0x8702('0x23'),_0x2daf32+'-'+_0x2da594+'/'+_0x1adb8d)[_0x8702('0x1d')](_0x4e998b);}return null;};}function patchUpdates(_0x3fba46){return function(_0x5bcca0){try{jsonpatch[_0x8702('0x24')](_0x5bcca0,_0x3fba46,!![]);}catch(_0x3ff327){return BPromise['reject'](_0x3ff327);}return _0x5bcca0[_0x8702('0x25')]();};}function saveUpdates(_0x1c3dd8,_0x57fb2a){return function(_0x2f3f09){if(_0x2f3f09){return _0x2f3f09['update'](_0x1c3dd8)[_0x8702('0x26')](function(_0x461eae){return _0x461eae;});}return null;};}function removeEntity(_0x3259b0,_0x252391){return function(_0x28685e){if(_0x28685e){return _0x28685e[_0x8702('0x27')]()[_0x8702('0x26')](function(){_0x3259b0['status'](0xcc)[_0x8702('0x1b')]();});}};}function handleEntityNotFound(_0x46a79d,_0x25b1f4){return function(_0x2b34d0){if(!_0x2b34d0){_0x46a79d['sendStatus'](0x194);}return _0x2b34d0;};}function handleError(_0x11e437,_0x14655a){_0x14655a=_0x14655a||0x1f4;return function(_0x2fdb38){logger[_0x8702('0x28')](_0x2fdb38[_0x8702('0x29')]);if(_0x2fdb38['name']){delete _0x2fdb38[_0x8702('0x2a')];}_0x11e437[_0x8702('0x1c')](_0x14655a)[_0x8702('0x2b')](_0x2fdb38);};}exports[_0x8702('0x2c')]=function(_0x586b41,_0x10f87f){var _0x16c59a={},_0x528796={},_0x36e703={'count':0x0,'rows':[]};var _0x4899d0=_[_0x8702('0x2d')](db['FreshsalesAccount'][_0x8702('0x2e')],function(_0x4ca706){return{'name':_0x4ca706[_0x8702('0x2f')],'type':_0x4ca706['type']['key']};});_0x528796[_0x8702('0x30')]=_[_0x8702('0x2d')](_0x4899d0,_0x8702('0x2a'));_0x528796[_0x8702('0x31')]=_[_0x8702('0x32')](_0x586b41['query']);_0x528796[_0x8702('0x33')]=_[_0x8702('0x34')](_0x528796[_0x8702('0x30')],_0x528796['query']);_0x16c59a[_0x8702('0x35')]=_[_0x8702('0x34')](_0x528796[_0x8702('0x30')],qs[_0x8702('0x36')](_0x586b41['query']['fields']));_0x16c59a[_0x8702('0x35')]=_0x16c59a[_0x8702('0x35')][_0x8702('0x37')]?_0x16c59a[_0x8702('0x35')]:_0x528796[_0x8702('0x30')];if(!_0x586b41[_0x8702('0x31')][_0x8702('0x38')](_0x8702('0x39'))){_0x16c59a[_0x8702('0x20')]=qs[_0x8702('0x20')](_0x586b41[_0x8702('0x31')][_0x8702('0x20')]);_0x16c59a[_0x8702('0x1e')]=qs[_0x8702('0x1e')](_0x586b41[_0x8702('0x31')][_0x8702('0x1e')]);}_0x16c59a[_0x8702('0x3a')]=qs[_0x8702('0x3b')](_0x586b41[_0x8702('0x31')][_0x8702('0x3b')]);_0x16c59a[_0x8702('0x3c')]=qs[_0x8702('0x33')](_[_0x8702('0x3d')](_0x586b41['query'],_0x528796[_0x8702('0x33')]),_0x4899d0);if(_0x586b41[_0x8702('0x31')][_0x8702('0x3e')]){_0x16c59a['where']=_[_0x8702('0x3f')](_0x16c59a[_0x8702('0x3c')],{'$or':_[_0x8702('0x2d')](_0x4899d0,function(_0x3f2008){if(_0x3f2008['type']!==_0x8702('0x40')){var _0x527b29={};_0x527b29[_0x3f2008[_0x8702('0x2a')]]={'$like':'%'+_0x586b41[_0x8702('0x31')]['filter']+'%'};return _0x527b29;}})});}_0x16c59a=_[_0x8702('0x3f')]({},_0x16c59a,_0x586b41[_0x8702('0x41')]);var _0x5e1daa={'where':_0x16c59a[_0x8702('0x3c')]};return db[_0x8702('0x42')][_0x8702('0x21')](_0x5e1daa)['then'](function(_0x542254){_0x36e703[_0x8702('0x21')]=_0x542254;if(_0x586b41[_0x8702('0x31')][_0x8702('0x43')]){_0x16c59a[_0x8702('0x44')]=[{'all':!![]}];}return db[_0x8702('0x42')]['findAll'](_0x16c59a);})[_0x8702('0x26')](function(_0x53267a){_0x36e703[_0x8702('0x45')]=_0x53267a;return _0x36e703;})[_0x8702('0x26')](respondWithFilteredResult(_0x10f87f,_0x16c59a))[_0x8702('0x46')](handleError(_0x10f87f,null));};exports[_0x8702('0x47')]=function(_0x264579,_0x39548e){var _0x886d09={'raw':![],'where':{'id':_0x264579[_0x8702('0x48')]['id']}},_0x567c7f={};_0x567c7f[_0x8702('0x30')]=_[_0x8702('0x32')](db['FreshsalesAccount'][_0x8702('0x2e')]);_0x567c7f[_0x8702('0x31')]=_[_0x8702('0x32')](_0x264579[_0x8702('0x31')]);_0x567c7f[_0x8702('0x33')]=_[_0x8702('0x34')](_0x567c7f['model'],_0x567c7f[_0x8702('0x31')]);_0x886d09[_0x8702('0x35')]=_['intersection'](_0x567c7f['model'],qs[_0x8702('0x36')](_0x264579[_0x8702('0x31')]['fields']));_0x886d09[_0x8702('0x35')]=_0x886d09[_0x8702('0x35')][_0x8702('0x37')]?_0x886d09[_0x8702('0x35')]:_0x567c7f[_0x8702('0x30')];if(_0x264579[_0x8702('0x31')][_0x8702('0x43')]){_0x886d09[_0x8702('0x44')]=[{'all':!![]}];}_0x886d09=_[_0x8702('0x3f')]({},_0x886d09,_0x264579['options']);return db[_0x8702('0x42')][_0x8702('0x49')](_0x886d09)['then'](handleEntityNotFound(_0x39548e,null))[_0x8702('0x26')](respondWithResult(_0x39548e,null))[_0x8702('0x46')](handleError(_0x39548e,null));};exports[_0x8702('0x4a')]=function(_0x595367,_0xaf0851){return db[_0x8702('0x42')]['create'](_0x595367['body'],{})[_0x8702('0x26')](respondWithResult(_0xaf0851,0xc9))[_0x8702('0x46')](handleError(_0xaf0851,null));};exports[_0x8702('0x4b')]=function(_0x3de2ee,_0xa0a18b){if(_0x3de2ee[_0x8702('0x4c')]['id']){delete _0x3de2ee[_0x8702('0x4c')]['id'];}return db[_0x8702('0x42')]['find']({'where':{'id':_0x3de2ee[_0x8702('0x48')]['id']}})[_0x8702('0x26')](handleEntityNotFound(_0xa0a18b,null))[_0x8702('0x26')](saveUpdates(_0x3de2ee[_0x8702('0x4c')],null))[_0x8702('0x26')](respondWithResult(_0xa0a18b,null))[_0x8702('0x46')](handleError(_0xa0a18b,null));};exports[_0x8702('0x27')]=function(_0x197a80,_0x23db99){return db[_0x8702('0x42')][_0x8702('0x49')]({'where':{'id':_0x197a80[_0x8702('0x48')]['id']}})['then'](handleEntityNotFound(_0x23db99,null))['then'](removeEntity(_0x23db99,null))[_0x8702('0x46')](handleError(_0x23db99,null));};exports[_0x8702('0x4d')]=function(_0x25aa28,_0xf31cef,_0x1dcef2){var _0x1ece5b={};var _0x240722={};var _0x2216e5;var _0x7fbe91;return db['FreshsalesAccount'][_0x8702('0x4e')]({'where':{'id':_0x25aa28['params']['id']}})[_0x8702('0x26')](handleEntityNotFound(_0xf31cef,null))[_0x8702('0x26')](function(_0x1790e1){if(_0x1790e1){_0x2216e5=_0x1790e1;_0x240722[_0x8702('0x30')]=_['keys'](db[_0x8702('0x4f')][_0x8702('0x2e')]);_0x240722[_0x8702('0x31')]=_[_0x8702('0x32')](_0x25aa28[_0x8702('0x31')]);_0x240722[_0x8702('0x33')]=_[_0x8702('0x34')](_0x240722[_0x8702('0x30')],_0x240722['query']);_0x1ece5b[_0x8702('0x35')]=_[_0x8702('0x34')](_0x240722[_0x8702('0x30')],qs[_0x8702('0x36')](_0x25aa28['query']['fields']));_0x1ece5b[_0x8702('0x35')]=_0x1ece5b[_0x8702('0x35')][_0x8702('0x37')]?_0x1ece5b['attributes']:_0x240722[_0x8702('0x30')];_0x1ece5b[_0x8702('0x3a')]=qs[_0x8702('0x3b')](_0x25aa28[_0x8702('0x31')][_0x8702('0x3b')]);_0x1ece5b[_0x8702('0x3c')]=qs[_0x8702('0x33')](_[_0x8702('0x3d')](_0x25aa28[_0x8702('0x31')],_0x240722[_0x8702('0x33')]));if(_0x25aa28[_0x8702('0x31')][_0x8702('0x3e')]){_0x1ece5b[_0x8702('0x3c')]=_[_0x8702('0x3f')](_0x1ece5b[_0x8702('0x3c')],{'$or':_[_0x8702('0x2d')](_0x1ece5b['attributes'],function(_0x5d153e){var _0x34a07d={};_0x34a07d[_0x5d153e]={'$like':'%'+_0x25aa28[_0x8702('0x31')][_0x8702('0x3e')]+'%'};return _0x34a07d;})});}_0x1ece5b=_[_0x8702('0x3f')]({},_0x1ece5b,_0x25aa28[_0x8702('0x41')]);return _0x2216e5[_0x8702('0x4d')](_0x1ece5b);}})[_0x8702('0x26')](function(_0x50b528){if(_0x50b528){_0x7fbe91=_0x50b528[_0x8702('0x37')];if(!_0x25aa28['query'][_0x8702('0x38')]('nolimit')){_0x1ece5b[_0x8702('0x20')]=qs['limit'](_0x25aa28[_0x8702('0x31')]['limit']);_0x1ece5b[_0x8702('0x1e')]=qs['offset'](_0x25aa28['query'][_0x8702('0x1e')]);}return _0x2216e5[_0x8702('0x4d')](_0x1ece5b);}})[_0x8702('0x26')](function(_0x3df6fd){if(_0x3df6fd){return _0x3df6fd?{'count':_0x7fbe91,'rows':_0x3df6fd}:null;}})[_0x8702('0x26')](respondWithResult(_0xf31cef,null))[_0x8702('0x46')](handleError(_0xf31cef,null));};exports[_0x8702('0x50')]=function(_0x33ff78,_0xe3700c,_0xbca419){if(_0x33ff78[_0x8702('0x4c')]['id']){delete _0x33ff78[_0x8702('0x4c')]['id'];}return db['FreshsalesAccount'][_0x8702('0x4e')]({'where':{'id':_0x33ff78['params']['id']}})[_0x8702('0x26')](handleEntityNotFound(_0xe3700c,null))['then'](function(_0x46cd51){if(_0x46cd51){_0x33ff78[_0x8702('0x4c')][_0x8702('0x51')]=_0x46cd51['id'];_0x33ff78[_0x8702('0x4c')][_0x8702('0x52')]=integrations[_0x8702('0x53')](_0x33ff78[_0x8702('0x4c')][_0x8702('0x54')],_0x33ff78[_0x8702('0x4c')][_0x8702('0x55')]);_0x33ff78['body'][_0x8702('0x56')]=integrations[_0x8702('0x57')](_0x33ff78[_0x8702('0x4c')][_0x8702('0x54')],_0x33ff78[_0x8702('0x4c')][_0x8702('0x55')]);return db[_0x8702('0x4f')]['create'](_0x33ff78['body'],{'include':[{'model':db[_0x8702('0x58')],'as':_0x8702('0x52')},{'model':db[_0x8702('0x58')],'as':_0x8702('0x56')}]});}return null;})['then'](respondWithResult(_0xe3700c,null))['catch'](handleError(_0xe3700c,null));};exports[_0x8702('0x59')]=function(_0x5e1ef8,_0x335dbd,_0x293081){var _0x38d355='';var _0x2728ba='';return db[_0x8702('0x42')][_0x8702('0x4e')]({'where':{'id':_0x5e1ef8[_0x8702('0x48')]['id']},'attributes':['id','username','remoteUri','apiKey']})[_0x8702('0x26')](handleEntityNotFound(_0x335dbd,null))[_0x8702('0x26')](function(_0x557344){if(_0x557344){_0x2728ba=_0x557344[_0x8702('0x5a')];_0x38d355=_0x557344['remoteUri'];var _0x1e23c5=_0x557344[_0x8702('0x5b')]['slice'](-0x1);if(_0x1e23c5==='/'){_0x38d355=_0x38d355[_0x8702('0x5c')](0x0,_0x38d355[_0x8702('0x5d')](_0x1e23c5));}return rp({'method':_0x8702('0x5e'),'uri':util[_0x8702('0x5f')](_0x8702('0x60'),_0x38d355,_0x8702('0x61')),'headers':{'Authorization':_0x8702('0x62')+_0x557344[_0x8702('0x63')]},'json':!![]});}})[_0x8702('0x26')](function(_0x3b25ab){if(_0x3b25ab){var _0x4c9163=_0x3b25ab[_0x8702('0x64')];var _0xdbd1fc=![];var _0x283dee=null;for(_0x283dee=0x0;_0x283dee<_0x4c9163[_0x8702('0x37')];_0x283dee++){if(_0x4c9163[_0x283dee][_0x8702('0x65')]===_0x2728ba){_0xdbd1fc=!![];}}if(_0xdbd1fc){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8702('0x26')](respondWithResult(_0x335dbd,null))[_0x8702('0x46')](function(_0x164965){var _0x5b7472=_0x5e1ef8['query'][_0x8702('0x66')]?0x1f4:_0x164965['statusCode']||0x1f4;logger[_0x8702('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5b7472,JSON[_0x8702('0x67')](_0x164965));delete _0x164965['name'];if(_0x5b7472===0x191){_0x5b7472=0x190;}_0x335dbd[_0x8702('0x1c')](_0x5b7472)[_0x8702('0x2b')](_0x5e1ef8['query']['test']?{'message':_0x8702('0x68'),'statusCode':_0x164965[_0x8702('0x69')]}:_0x164965);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 1f52f4d..a44e126 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 _0x430c=['define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x49870a,_0x1da621){var _0x227723=function(_0x466fa7){while(--_0x466fa7){_0x49870a['push'](_0x49870a['shift']());}};_0x227723(++_0x1da621);}(_0x430c,0x1a1));var _0xc430=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x430c[_0x5b8b97];return _0x1fdf84;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));var integrations=require(_0xc430('0x5'));module['exports']=function(_0x42aa9c,_0x4de44f){return _0x42aa9c[_0xc430('0x6')](_0xc430('0x7'),attributes,{'tableName':_0xc430('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5430=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x5430,0x10c));var _0x0543=function(_0x33fb8e,_0x5cf33d){_0x33fb8e=_0x33fb8e-0x0;var _0x464146=_0x5430[_0x33fb8e];return _0x464146;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0543('0x7'));module[_0x0543('0x8')]=function(_0x9754ba,_0x319568){return _0x9754ba[_0x0543('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x0543('0xa'),'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 1dbe1f4..811ad6f 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 _0x81c6=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','ShowFreshsalesAccount','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x1628b3,_0x5f1805){var _0x4bad95=function(_0x1afa12){while(--_0x1afa12){_0x1628b3['push'](_0x1628b3['shift']());}};_0x4bad95(++_0x5f1805);}(_0x81c6,0x1d5));var _0x681c=function(_0x5a56cc,_0x29650c){_0x5a56cc=_0x5a56cc-0x0;var _0x589caa=_0x81c6[_0x5a56cc];return _0x589caa;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')]({'raw':_0x42f506['options']?_0x42f506[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')]['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506['options'][_0x681c('0x1a')]||null:null,'include':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x42f506[_0x681c('0x18')][_0x681c('0x1b')],function(_0x3d0297){return{'model':db[_0x3d0297[_0x681c('0x1d')]],'as':_0x3d0297['as'],'attributes':_0x3d0297[_0x681c('0x1e')],'include':_0x3d0297[_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x3d0297[_0x681c('0x1b')],function(_0x218410){return{'model':db[_0x218410[_0x681c('0x1d')]],'as':_0x218410['as'],'attributes':_0x218410[_0x681c('0x1e')],'include':_0x218410['include']?_[_0x681c('0x1c')](_0x218410['include'],function(_0x5f8d64){return{'model':db[_0x5f8d64['model']],'as':_0x5f8d64['as'],'attributes':_0x5f8d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x17ea7c){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger['debug'](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x17ea7c));_0x42304f(_0x17ea7c);})[_0x681c('0x14')](function(_0x936fce){logger[_0x681c('0x10')](_0x681c('0x15'),_0x936fce[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192['error'](0x1f4,_0x936fce[_0x681c('0x11')]));});});};exports[_0x681c('0x1f')]=function(_0x2e783d){var _0x4af6aa=this;return new Promise(function(_0x385b14,_0x2179cd){return db[_0x681c('0x16')]['find']({'raw':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e783d[_0x681c('0x18')]?_0x2e783d[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x2e783d['options']?_0x2e783d[_0x681c('0x18')]['attributes']||null:null,'include':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['include']?_['map'](_0x2e783d[_0x681c('0x18')][_0x681c('0x1b')],function(_0x5a349a){return{'model':db[_0x5a349a[_0x681c('0x1d')]],'as':_0x5a349a['as'],'attributes':_0x5a349a['attributes'],'include':_0x5a349a['include']?_[_0x681c('0x1c')](_0x5a349a['include'],function(_0x35991d){return{'model':db[_0x35991d[_0x681c('0x1d')]],'as':_0x35991d['as'],'attributes':_0x35991d[_0x681c('0x1e')],'include':_0x35991d['include']?_['map'](_0x35991d[_0x681c('0x1b')],function(_0x4545ff){return{'model':db[_0x4545ff['model']],'as':_0x4545ff['as'],'attributes':_0x4545ff[_0x681c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x302dab){logger['info'](_0x681c('0x1f'),_0x2e783d);logger[_0x681c('0xb')]('ShowFreshsalesAccount',_0x2e783d,JSON[_0x681c('0xe')](_0x302dab));_0x385b14(_0x302dab);})[_0x681c('0x14')](function(_0x83953c){logger[_0x681c('0x10')](_0x681c('0x1f'),_0x83953c['message'],_0x2e783d);_0x2179cd(_0x4af6aa['error'](0x1f4,_0x83953c[_0x681c('0x11')]));});});}; \ No newline at end of file +var _0x0295=['find','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','where','include','map','model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount'];(function(_0x476705,_0x1bc7b4){var _0x189062=function(_0x2f4324){while(--_0x2f4324){_0x476705['push'](_0x476705['shift']());}};_0x189062(++_0x1bc7b4);}(_0x0295,0x1f0));var _0x5029=function(_0x56eb89,_0xa70f63){_0x56eb89=_0x56eb89-0x0;var _0x237f9d=_0x0295[_0x56eb89];return _0x237f9d;};'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')]('FreshsalesAccount,\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);});});}exports['GetFreshsalesAccount']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0x1ed567[_0x5029('0x17')]?_0x1ed567['options'][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')]['attributes']||null:null,'limit':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')]['limit']||null:null,'include':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')],function(_0x125c26){return{'model':db[_0x125c26[_0x5029('0x1c')]],'as':_0x125c26['as'],'attributes':_0x125c26[_0x5029('0x1d')],'include':_0x125c26['include']?_['map'](_0x125c26['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1c')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1b')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x5e45c4){logger[_0x5029('0xb')](_0x5029('0x1e'),_0x1ed567);logger[_0x5029('0xd')]('GetFreshsalesAccount',_0x1ed567,JSON[_0x5029('0xf')](_0x5e45c4));_0x35de81(_0x5e45c4);})[_0x5029('0x14')](function(_0xe5313e){logger['error'](_0x5029('0x1e'),_0xe5313e[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155['error'](0x1f4,_0xe5313e[_0x5029('0x12')]));});});};exports[_0x5029('0x1f')]=function(_0x4434ff){var _0x1c3dd9=this;return new Promise(function(_0x196830,_0x2a1ed6){return db[_0x5029('0x15')][_0x5029('0x20')]({'raw':_0x4434ff[_0x5029('0x17')]?_0x4434ff[_0x5029('0x17')][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x4434ff[_0x5029('0x17')]?_0x4434ff['options'][_0x5029('0x19')]||null:null,'attributes':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')]['attributes']||null:null,'include':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x4434ff['options'][_0x5029('0x1a')],function(_0x15d882){return{'model':db[_0x15d882[_0x5029('0x1c')]],'as':_0x15d882['as'],'attributes':_0x15d882[_0x5029('0x1d')],'include':_0x15d882[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x15d882[_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1c')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x3e2d88){logger['info']('ShowFreshsalesAccount',_0x4434ff);logger[_0x5029('0xd')](_0x5029('0x1f'),_0x4434ff,JSON['stringify'](_0x3e2d88));_0x196830(_0x3e2d88);})['catch'](function(_0x9656f2){logger[_0x5029('0x10')](_0x5029('0x1f'),_0x9656f2[_0x5029('0x12')],_0x4434ff);_0x2a1ed6(_0x1c3dd9[_0x5029('0x10')](0x1f4,_0x9656f2[_0x5029('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 453f9ca..1499984 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 _0xa851=['getSubjects','/:id/descriptions','/:id/fields','getFields','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2c17ee,_0x1a29cc){var _0x8bf208=function(_0x405312){while(--_0x405312){_0x2c17ee['push'](_0x2c17ee['shift']());}};_0x8bf208(++_0x1a29cc);}(_0xa851,0x10d));var _0x1a85=function(_0x36b444,_0x505b35){_0x36b444=_0x36b444-0x0;var _0x786323=_0xa851[_0x36b444];return _0x786323;};'use strict';var multer=require(_0x1a85('0x0'));var util=require('util');var path=require(_0x1a85('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a85('0x2'));var router=express[_0x1a85('0x3')]();var fs_extra=require(_0x1a85('0x4'));var auth=require(_0x1a85('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a85('0x6'));router[_0x1a85('0x7')]('/',auth[_0x1a85('0x8')](),controller[_0x1a85('0x9')]);router[_0x1a85('0x7')](_0x1a85('0xa'),auth[_0x1a85('0x8')](),controller['show']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x1a85('0xb')]);router[_0x1a85('0x7')](_0x1a85('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x1a85('0x7')](_0x1a85('0xd'),auth['isAuthenticated'](),controller[_0x1a85('0xe')]);router['post']('/',auth[_0x1a85('0x8')](),controller[_0x1a85('0xf')]);router[_0x1a85('0x10')]('/:id',auth[_0x1a85('0x8')](),controller['update']);router[_0x1a85('0x11')](_0x1a85('0xa'),auth[_0x1a85('0x8')](),controller[_0x1a85('0x12')]);module[_0x1a85('0x13')]=router; \ No newline at end of file +var _0x6881=['/:id/subjects','getSubjects','/:id/fields','getFields','put','update','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x6881,0xd8));var _0x1688=function(_0x23f8d3,_0x5408a4){_0x23f8d3=_0x23f8d3-0x0;var _0x45456d=_0x6881[_0x23f8d3];return _0x45456d;};'use strict';var multer=require('multer');var util=require(_0x1688('0x0'));var path=require(_0x1688('0x1'));var timeout=require(_0x1688('0x2'));var express=require('express');var router=express[_0x1688('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1688('0x4'));var config=require(_0x1688('0x5'));var controller=require(_0x1688('0x6'));router[_0x1688('0x7')]('/',auth[_0x1688('0x8')](),controller[_0x1688('0x9')]);router[_0x1688('0x7')](_0x1688('0xa'),auth[_0x1688('0x8')](),controller[_0x1688('0xb')]);router['get'](_0x1688('0xc'),auth[_0x1688('0x8')](),controller[_0x1688('0xd')]);router['get']('/:id/descriptions',auth[_0x1688('0x8')](),controller['getDescriptions']);router[_0x1688('0x7')](_0x1688('0xe'),auth[_0x1688('0x8')](),controller[_0x1688('0xf')]);router['post']('/',auth[_0x1688('0x8')](),controller['create']);router[_0x1688('0x10')]('/:id',auth[_0x1688('0x8')](),controller[_0x1688('0x11')]);router['delete'](_0x1688('0xa'),auth[_0x1688('0x8')](),controller[_0x1688('0x12')]);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 2db8ce8..adfa87b 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 _0x5538=['exports','STRING'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x5538,0x12e));var _0x8553=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x5538[_0x1a0daa];return _0x1dbe15;};'use strict';var Sequelize=require('sequelize');module[_0x8553('0x0')]={'name':{'type':Sequelize[_0x8553('0x1')]},'description':{'type':Sequelize[_0x8553('0x1')]}}; \ No newline at end of file +var _0xc147=['STRING','exports'];(function(_0x40670e,_0x269e03){var _0x410f4d=function(_0x179a79){while(--_0x179a79){_0x40670e['push'](_0x40670e['shift']());}};_0x410f4d(++_0x269e03);}(_0xc147,0x133));var _0x7c14=function(_0x2a5052,_0x9f5550){_0x2a5052=_0x2a5052-0x0;var _0x545e9d=_0xc147[_0x2a5052];return _0x545e9d;};'use strict';var Sequelize=require('sequelize');module[_0x7c14('0x0')]={'name':{'type':Sequelize[_0x7c14('0x1')]},'description':{'type':Sequelize[_0x7c14('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index df6b3fd..9940b64 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 _0x7a28=['limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','catch','show','create','body','find','destroy','params','getSubjects','findOne','FreshsalesField','filter','length','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x496dd5,_0x2e06ba){var _0x58fd39=function(_0x2da6ef){while(--_0x2da6ef){_0x496dd5['push'](_0x496dd5['shift']());}};_0x58fd39(++_0x2e06ba);}(_0x7a28,0x6a));var _0x87a2=function(_0x37c136,_0x1ff97f){_0x37c136=_0x37c136-0x0;var _0x22b1ab=_0x7a28[_0x37c136];return _0x22b1ab;};'use strict';var emlformat=require(_0x87a2('0x0'));var rimraf=require(_0x87a2('0x1'));var zipdir=require(_0x87a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87a2('0x3'));var moment=require(_0x87a2('0x4'));var BPromise=require(_0x87a2('0x5'));var Mustache=require('mustache');var util=require(_0x87a2('0x6'));var path=require(_0x87a2('0x7'));var sox=require(_0x87a2('0x8'));var csv=require(_0x87a2('0x9'));var ejs=require(_0x87a2('0xa'));var fs=require('fs');var fs_extra=require(_0x87a2('0xb'));var _=require(_0x87a2('0xc'));var squel=require(_0x87a2('0xd'));var crypto=require(_0x87a2('0xe'));var jsforce=require(_0x87a2('0xf'));var deskjs=require(_0x87a2('0x10'));var toCsv=require(_0x87a2('0x9'));var querystring=require(_0x87a2('0x11'));var Papa=require(_0x87a2('0x12'));var Redis=require(_0x87a2('0x13'));var authService=require(_0x87a2('0x14'));var qs=require(_0x87a2('0x15'));var as=require(_0x87a2('0x16'));var hardwareService=require(_0x87a2('0x17'));var logger=require(_0x87a2('0x18'))(_0x87a2('0x19'));var utils=require(_0x87a2('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x87a2('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44ac87,_0x473941){_0x473941=_0x473941||0xcc;return function(_0x38ab91){if(_0x38ab91){return _0x44ac87[_0x87a2('0x1c')](_0x473941);}return _0x44ac87[_0x87a2('0x1d')](_0x473941)[_0x87a2('0x1e')]();};}function respondWithResult(_0x523676,_0x3abae6){_0x3abae6=_0x3abae6||0xc8;return function(_0x18f1cf){if(_0x18f1cf){return _0x523676[_0x87a2('0x1d')](_0x3abae6)[_0x87a2('0x1f')](_0x18f1cf);}};}function respondWithFilteredResult(_0x5cf9dc,_0x52d504){return function(_0xa120f2){if(_0xa120f2){var _0x5a21d4=typeof _0x52d504['offset']==='undefined'&&typeof _0x52d504['limit']==='undefined';var _0x2c376a=_0xa120f2[_0x87a2('0x20')];var _0x199355=_0x5a21d4?0x0:_0x52d504['offset'];var _0x49a176=_0x5a21d4?_0xa120f2[_0x87a2('0x20')]:_0x52d504[_0x87a2('0x21')]+_0x52d504['limit'];var _0x2d74e2;if(_0x49a176>=_0x2c376a){_0x49a176=_0x2c376a;_0x2d74e2=0xc8;}else{_0x2d74e2=0xce;}_0x5cf9dc[_0x87a2('0x1d')](_0x2d74e2);return _0x5cf9dc[_0x87a2('0x22')](_0x87a2('0x23'),_0x199355+'-'+_0x49a176+'/'+_0x2c376a)[_0x87a2('0x1f')](_0xa120f2);}return null;};}function patchUpdates(_0x8e1e86){return function(_0x451b83){try{jsonpatch[_0x87a2('0x24')](_0x451b83,_0x8e1e86,!![]);}catch(_0x5ebbe0){return BPromise[_0x87a2('0x25')](_0x5ebbe0);}return _0x451b83[_0x87a2('0x26')]();};}function saveUpdates(_0x5241f2,_0x4f97cd){return function(_0x18e592){if(_0x18e592){return _0x18e592[_0x87a2('0x27')](_0x5241f2)[_0x87a2('0x28')](function(_0x10c839){return _0x10c839;});}return null;};}function removeEntity(_0x580ce4,_0x4d920f){return function(_0x2d61a4){if(_0x2d61a4){return _0x2d61a4['destroy']()[_0x87a2('0x28')](function(){_0x580ce4[_0x87a2('0x1d')](0xcc)[_0x87a2('0x1e')]();});}};}function handleEntityNotFound(_0x2ae58d,_0x3f07e8){return function(_0x533d00){if(!_0x533d00){_0x2ae58d[_0x87a2('0x1c')](0x194);}return _0x533d00;};}function handleError(_0xc4b0d0,_0xf78e0b){_0xf78e0b=_0xf78e0b||0x1f4;return function(_0x3e3152){logger[_0x87a2('0x29')](_0x3e3152[_0x87a2('0x2a')]);if(_0x3e3152['name']){delete _0x3e3152[_0x87a2('0x2b')];}_0xc4b0d0[_0x87a2('0x1d')](_0xf78e0b)[_0x87a2('0x2c')](_0x3e3152);};}exports[_0x87a2('0x2d')]=function(_0x3a9f68,_0x34dd68){var _0x5ad743={},_0x58507c={},_0x44c6e4={'count':0x0,'rows':[]};var _0x229555=_[_0x87a2('0x2e')](db[_0x87a2('0x2f')][_0x87a2('0x30')],function(_0x5df0ae){return{'name':_0x5df0ae['fieldName'],'type':_0x5df0ae[_0x87a2('0x31')][_0x87a2('0x32')]};});_0x58507c[_0x87a2('0x33')]=_[_0x87a2('0x2e')](_0x229555,_0x87a2('0x2b'));_0x58507c[_0x87a2('0x34')]=_[_0x87a2('0x35')](_0x3a9f68[_0x87a2('0x34')]);_0x58507c[_0x87a2('0x36')]=_[_0x87a2('0x37')](_0x58507c['model'],_0x58507c[_0x87a2('0x34')]);_0x5ad743[_0x87a2('0x38')]=_[_0x87a2('0x37')](_0x58507c[_0x87a2('0x33')],qs[_0x87a2('0x39')](_0x3a9f68[_0x87a2('0x34')][_0x87a2('0x39')]));_0x5ad743['attributes']=_0x5ad743[_0x87a2('0x38')]['length']?_0x5ad743[_0x87a2('0x38')]:_0x58507c[_0x87a2('0x33')];if(!_0x3a9f68[_0x87a2('0x34')][_0x87a2('0x3a')](_0x87a2('0x3b'))){_0x5ad743[_0x87a2('0x3c')]=qs[_0x87a2('0x3c')](_0x3a9f68['query'][_0x87a2('0x3c')]);_0x5ad743['offset']=qs[_0x87a2('0x21')](_0x3a9f68[_0x87a2('0x34')][_0x87a2('0x21')]);}_0x5ad743[_0x87a2('0x3d')]=qs[_0x87a2('0x3e')](_0x3a9f68[_0x87a2('0x34')]['sort']);_0x5ad743[_0x87a2('0x3f')]=qs[_0x87a2('0x36')](_[_0x87a2('0x40')](_0x3a9f68['query'],_0x58507c['filters']),_0x229555);if(_0x3a9f68[_0x87a2('0x34')]['filter']){_0x5ad743[_0x87a2('0x3f')]=_[_0x87a2('0x41')](_0x5ad743['where'],{'$or':_[_0x87a2('0x2e')](_0x229555,function(_0x84a147){if(_0x84a147[_0x87a2('0x31')]!==_0x87a2('0x42')){var _0x39cc9f={};_0x39cc9f[_0x84a147[_0x87a2('0x2b')]]={'$like':'%'+_0x3a9f68[_0x87a2('0x34')]['filter']+'%'};return _0x39cc9f;}})});}_0x5ad743=_[_0x87a2('0x41')]({},_0x5ad743,_0x3a9f68[_0x87a2('0x43')]);var _0xa5dc09={'where':_0x5ad743[_0x87a2('0x3f')]};return db['FreshsalesConfiguration'][_0x87a2('0x20')](_0xa5dc09)[_0x87a2('0x28')](function(_0x4c028a){_0x44c6e4[_0x87a2('0x20')]=_0x4c028a;if(_0x3a9f68['query'][_0x87a2('0x44')]){_0x5ad743['include']=[{'all':!![]}];}return db[_0x87a2('0x2f')]['findAll'](_0x5ad743);})[_0x87a2('0x28')](function(_0x33e431){_0x44c6e4['rows']=_0x33e431;return _0x44c6e4;})['then'](respondWithFilteredResult(_0x34dd68,_0x5ad743))[_0x87a2('0x45')](handleError(_0x34dd68,null));};exports[_0x87a2('0x46')]=function(_0x23baae,_0x2983b4){var _0xc8e13a={'raw':![],'where':{'id':_0x23baae['params']['id']}},_0x37398a={};_0x37398a[_0x87a2('0x33')]=_[_0x87a2('0x35')](db[_0x87a2('0x2f')][_0x87a2('0x30')]);_0x37398a[_0x87a2('0x34')]=_[_0x87a2('0x35')](_0x23baae[_0x87a2('0x34')]);_0x37398a[_0x87a2('0x36')]=_[_0x87a2('0x37')](_0x37398a[_0x87a2('0x33')],_0x37398a['query']);_0xc8e13a[_0x87a2('0x38')]=_[_0x87a2('0x37')](_0x37398a['model'],qs[_0x87a2('0x39')](_0x23baae[_0x87a2('0x34')][_0x87a2('0x39')]));_0xc8e13a[_0x87a2('0x38')]=_0xc8e13a[_0x87a2('0x38')]['length']?_0xc8e13a[_0x87a2('0x38')]:_0x37398a['model'];if(_0x23baae['query'][_0x87a2('0x44')]){_0xc8e13a['include']=[{'all':!![]}];}_0xc8e13a=_[_0x87a2('0x41')]({},_0xc8e13a,_0x23baae['options']);return db[_0x87a2('0x2f')]['find'](_0xc8e13a)[_0x87a2('0x28')](handleEntityNotFound(_0x2983b4,null))[_0x87a2('0x28')](respondWithResult(_0x2983b4,null))[_0x87a2('0x45')](handleError(_0x2983b4,null));};exports[_0x87a2('0x47')]=function(_0xcdd926,_0x4bf8af){return db[_0x87a2('0x2f')][_0x87a2('0x47')](_0xcdd926['body'],{})[_0x87a2('0x28')](respondWithResult(_0x4bf8af,0xc9))['catch'](handleError(_0x4bf8af,null));};exports[_0x87a2('0x27')]=function(_0x3b8fa5,_0x7cddd3){if(_0x3b8fa5[_0x87a2('0x48')]['id']){delete _0x3b8fa5['body']['id'];}return db[_0x87a2('0x2f')][_0x87a2('0x49')]({'where':{'id':_0x3b8fa5['params']['id']}})['then'](handleEntityNotFound(_0x7cddd3,null))[_0x87a2('0x28')](saveUpdates(_0x3b8fa5[_0x87a2('0x48')],null))[_0x87a2('0x28')](respondWithResult(_0x7cddd3,null))[_0x87a2('0x45')](handleError(_0x7cddd3,null));};exports[_0x87a2('0x4a')]=function(_0x32e671,_0x448ce0){return db[_0x87a2('0x2f')][_0x87a2('0x49')]({'where':{'id':_0x32e671[_0x87a2('0x4b')]['id']}})[_0x87a2('0x28')](handleEntityNotFound(_0x448ce0,null))[_0x87a2('0x28')](removeEntity(_0x448ce0,null))[_0x87a2('0x45')](handleError(_0x448ce0,null));};exports[_0x87a2('0x4c')]=function(_0xed56ed,_0x2f3740,_0x43fa3b){var _0x4bc26b={};var _0x25bfa0={};var _0x57c709;var _0x748026;return db['FreshsalesConfiguration'][_0x87a2('0x4d')]({'where':{'id':_0xed56ed[_0x87a2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f3740,null))[_0x87a2('0x28')](function(_0x133c4f){if(_0x133c4f){_0x57c709=_0x133c4f;_0x25bfa0[_0x87a2('0x33')]=_[_0x87a2('0x35')](db[_0x87a2('0x4e')][_0x87a2('0x30')]);_0x25bfa0[_0x87a2('0x34')]=_[_0x87a2('0x35')](_0xed56ed['query']);_0x25bfa0[_0x87a2('0x36')]=_[_0x87a2('0x37')](_0x25bfa0[_0x87a2('0x33')],_0x25bfa0['query']);_0x4bc26b['attributes']=_[_0x87a2('0x37')](_0x25bfa0['model'],qs['fields'](_0xed56ed[_0x87a2('0x34')][_0x87a2('0x39')]));_0x4bc26b[_0x87a2('0x38')]=_0x4bc26b[_0x87a2('0x38')]['length']?_0x4bc26b[_0x87a2('0x38')]:_0x25bfa0[_0x87a2('0x33')];_0x4bc26b[_0x87a2('0x3d')]=qs[_0x87a2('0x3e')](_0xed56ed['query'][_0x87a2('0x3e')]);_0x4bc26b[_0x87a2('0x3f')]=qs[_0x87a2('0x36')](_[_0x87a2('0x40')](_0xed56ed[_0x87a2('0x34')],_0x25bfa0[_0x87a2('0x36')]));if(_0xed56ed['query']['filter']){_0x4bc26b['where']=_[_0x87a2('0x41')](_0x4bc26b[_0x87a2('0x3f')],{'$or':_[_0x87a2('0x2e')](_0x4bc26b[_0x87a2('0x38')],function(_0x4c7480){var _0x347548={};_0x347548[_0x4c7480]={'$like':'%'+_0xed56ed[_0x87a2('0x34')][_0x87a2('0x4f')]+'%'};return _0x347548;})});}_0x4bc26b=_[_0x87a2('0x41')]({},_0x4bc26b,_0xed56ed['options']);return _0x57c709[_0x87a2('0x4c')](_0x4bc26b);}})[_0x87a2('0x28')](function(_0x5b017c){if(_0x5b017c){_0x748026=_0x5b017c['length'];if(!_0xed56ed[_0x87a2('0x34')][_0x87a2('0x3a')](_0x87a2('0x3b'))){_0x4bc26b[_0x87a2('0x3c')]=qs['limit'](_0xed56ed['query'][_0x87a2('0x3c')]);_0x4bc26b['offset']=qs[_0x87a2('0x21')](_0xed56ed[_0x87a2('0x34')]['offset']);}return _0x57c709[_0x87a2('0x4c')](_0x4bc26b);}})[_0x87a2('0x28')](function(_0x31a4b4){if(_0x31a4b4){return _0x31a4b4?{'count':_0x748026,'rows':_0x31a4b4}:null;}})[_0x87a2('0x28')](respondWithResult(_0x2f3740,null))[_0x87a2('0x45')](handleError(_0x2f3740,null));};exports['getDescriptions']=function(_0x38f56b,_0x4c0bca,_0x1eb686){var _0x41e7b0={};var _0x7f4e51={};var _0x9c4ac9;var _0x8b176e;return db['FreshsalesConfiguration'][_0x87a2('0x4d')]({'where':{'id':_0x38f56b[_0x87a2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4c0bca,null))[_0x87a2('0x28')](function(_0x8c29fb){if(_0x8c29fb){_0x9c4ac9=_0x8c29fb;_0x7f4e51[_0x87a2('0x33')]=_[_0x87a2('0x35')](db['FreshsalesField'][_0x87a2('0x30')]);_0x7f4e51[_0x87a2('0x34')]=_[_0x87a2('0x35')](_0x38f56b[_0x87a2('0x34')]);_0x7f4e51['filters']=_[_0x87a2('0x37')](_0x7f4e51[_0x87a2('0x33')],_0x7f4e51['query']);_0x41e7b0[_0x87a2('0x38')]=_[_0x87a2('0x37')](_0x7f4e51[_0x87a2('0x33')],qs[_0x87a2('0x39')](_0x38f56b[_0x87a2('0x34')][_0x87a2('0x39')]));_0x41e7b0['attributes']=_0x41e7b0[_0x87a2('0x38')][_0x87a2('0x50')]?_0x41e7b0[_0x87a2('0x38')]:_0x7f4e51[_0x87a2('0x33')];_0x41e7b0[_0x87a2('0x3d')]=qs['sort'](_0x38f56b[_0x87a2('0x34')][_0x87a2('0x3e')]);_0x41e7b0[_0x87a2('0x3f')]=qs[_0x87a2('0x36')](_[_0x87a2('0x40')](_0x38f56b[_0x87a2('0x34')],_0x7f4e51[_0x87a2('0x36')]));if(_0x38f56b[_0x87a2('0x34')][_0x87a2('0x4f')]){_0x41e7b0[_0x87a2('0x3f')]=_[_0x87a2('0x41')](_0x41e7b0[_0x87a2('0x3f')],{'$or':_['map'](_0x41e7b0[_0x87a2('0x38')],function(_0x3f8a45){var _0x300df1={};_0x300df1[_0x3f8a45]={'$like':'%'+_0x38f56b[_0x87a2('0x34')]['filter']+'%'};return _0x300df1;})});}_0x41e7b0=_[_0x87a2('0x41')]({},_0x41e7b0,_0x38f56b[_0x87a2('0x43')]);return _0x9c4ac9[_0x87a2('0x51')](_0x41e7b0);}})[_0x87a2('0x28')](function(_0x5ef582){if(_0x5ef582){_0x8b176e=_0x5ef582[_0x87a2('0x50')];if(!_0x38f56b[_0x87a2('0x34')]['hasOwnProperty']('nolimit')){_0x41e7b0['limit']=qs[_0x87a2('0x3c')](_0x38f56b[_0x87a2('0x34')][_0x87a2('0x3c')]);_0x41e7b0[_0x87a2('0x21')]=qs['offset'](_0x38f56b[_0x87a2('0x34')][_0x87a2('0x21')]);}return _0x9c4ac9['getDescriptions'](_0x41e7b0);}})[_0x87a2('0x28')](function(_0x2dad7d){if(_0x2dad7d){return _0x2dad7d?{'count':_0x8b176e,'rows':_0x2dad7d}:null;}})['then'](respondWithResult(_0x4c0bca,null))['catch'](handleError(_0x4c0bca,null));};exports[_0x87a2('0x52')]=function(_0x44c611,_0x5a49ab,_0x166154){var _0x122c68={};var _0x28a264={};var _0x26f5fe;var _0x12b324;return db['FreshsalesConfiguration'][_0x87a2('0x4d')]({'where':{'id':_0x44c611['params']['id']}})[_0x87a2('0x28')](handleEntityNotFound(_0x5a49ab,null))[_0x87a2('0x28')](function(_0xdd2e5f){if(_0xdd2e5f){_0x26f5fe=_0xdd2e5f;_0x28a264[_0x87a2('0x33')]=_['keys'](db[_0x87a2('0x4e')][_0x87a2('0x30')]);_0x28a264['query']=_['keys'](_0x44c611[_0x87a2('0x34')]);_0x28a264[_0x87a2('0x36')]=_[_0x87a2('0x37')](_0x28a264[_0x87a2('0x33')],_0x28a264[_0x87a2('0x34')]);_0x122c68[_0x87a2('0x38')]=_[_0x87a2('0x37')](_0x28a264['model'],qs['fields'](_0x44c611[_0x87a2('0x34')][_0x87a2('0x39')]));_0x122c68['attributes']=_0x122c68[_0x87a2('0x38')][_0x87a2('0x50')]?_0x122c68['attributes']:_0x28a264['model'];_0x122c68[_0x87a2('0x3d')]=qs[_0x87a2('0x3e')](_0x44c611[_0x87a2('0x34')]['sort']);_0x122c68[_0x87a2('0x3f')]=qs[_0x87a2('0x36')](_['pick'](_0x44c611[_0x87a2('0x34')],_0x28a264[_0x87a2('0x36')]));if(_0x44c611[_0x87a2('0x34')][_0x87a2('0x4f')]){_0x122c68[_0x87a2('0x3f')]=_['merge'](_0x122c68[_0x87a2('0x3f')],{'$or':_[_0x87a2('0x2e')](_0x122c68['attributes'],function(_0x1921ed){var _0x2e0191={};_0x2e0191[_0x1921ed]={'$like':'%'+_0x44c611[_0x87a2('0x34')]['filter']+'%'};return _0x2e0191;})});}_0x122c68=_[_0x87a2('0x41')]({},_0x122c68,_0x44c611[_0x87a2('0x43')]);return _0x26f5fe[_0x87a2('0x52')](_0x122c68);}})[_0x87a2('0x28')](function(_0x578c0b){if(_0x578c0b){_0x12b324=_0x578c0b[_0x87a2('0x50')];if(!_0x44c611[_0x87a2('0x34')][_0x87a2('0x3a')](_0x87a2('0x3b'))){_0x122c68[_0x87a2('0x3c')]=qs[_0x87a2('0x3c')](_0x44c611[_0x87a2('0x34')][_0x87a2('0x3c')]);_0x122c68[_0x87a2('0x21')]=qs['offset'](_0x44c611[_0x87a2('0x34')][_0x87a2('0x21')]);}return _0x26f5fe[_0x87a2('0x52')](_0x122c68);}})[_0x87a2('0x28')](function(_0x5868e6){if(_0x5868e6){return _0x5868e6?{'count':_0x12b324,'rows':_0x5868e6}:null;}})[_0x87a2('0x28')](respondWithResult(_0x5a49ab,null))[_0x87a2('0x45')](handleError(_0x5a49ab,null));}; \ No newline at end of file +var _0x15a2=['attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','update','find','getSubjects','FreshsalesField','hasOwnProperty','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','fieldName','key','query','keys'];(function(_0x24de9f,_0x228cac){var _0x1de54b=function(_0x1e92c9){while(--_0x1e92c9){_0x24de9f['push'](_0x24de9f['shift']());}};_0x1de54b(++_0x228cac);}(_0x15a2,0xc2));var _0x215a=function(_0x168114,_0x54c2d9){_0x168114=_0x168114-0x0;var _0x21d911=_0x15a2[_0x168114];return _0x21d911;};'use strict';var emlformat=require(_0x215a('0x0'));var rimraf=require(_0x215a('0x1'));var zipdir=require(_0x215a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x215a('0x3'));var moment=require(_0x215a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x215a('0x5'));var util=require(_0x215a('0x6'));var path=require(_0x215a('0x7'));var sox=require(_0x215a('0x8'));var csv=require(_0x215a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x215a('0xa'));var _=require(_0x215a('0xb'));var squel=require(_0x215a('0xc'));var crypto=require(_0x215a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x215a('0xe'));var toCsv=require(_0x215a('0x9'));var querystring=require('querystring');var Papa=require(_0x215a('0xf'));var Redis=require(_0x215a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x215a('0x11'));var hardwareService=require(_0x215a('0x12'));var logger=require(_0x215a('0x13'))(_0x215a('0x14'));var utils=require(_0x215a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c6714,_0x5d045f){_0x5d045f=_0x5d045f||0xcc;return function(_0x3402a6){if(_0x3402a6){return _0x3c6714[_0x215a('0x16')](_0x5d045f);}return _0x3c6714[_0x215a('0x17')](_0x5d045f)[_0x215a('0x18')]();};}function respondWithResult(_0x2bed0c,_0x166b49){_0x166b49=_0x166b49||0xc8;return function(_0x1f9055){if(_0x1f9055){return _0x2bed0c[_0x215a('0x17')](_0x166b49)[_0x215a('0x19')](_0x1f9055);}};}function respondWithFilteredResult(_0x3594b4,_0x50f22d){return function(_0x5c5326){if(_0x5c5326){var _0x4c76c7=typeof _0x50f22d['offset']===_0x215a('0x1a')&&typeof _0x50f22d['limit']===_0x215a('0x1a');var _0x35b91e=_0x5c5326[_0x215a('0x1b')];var _0x18a46c=_0x4c76c7?0x0:_0x50f22d[_0x215a('0x1c')];var _0x3d1adb=_0x4c76c7?_0x5c5326[_0x215a('0x1b')]:_0x50f22d[_0x215a('0x1c')]+_0x50f22d[_0x215a('0x1d')];var _0x43cac2;if(_0x3d1adb>=_0x35b91e){_0x3d1adb=_0x35b91e;_0x43cac2=0xc8;}else{_0x43cac2=0xce;}_0x3594b4['status'](_0x43cac2);return _0x3594b4[_0x215a('0x1e')]('Content-Range',_0x18a46c+'-'+_0x3d1adb+'/'+_0x35b91e)[_0x215a('0x19')](_0x5c5326);}return null;};}function patchUpdates(_0xa82f79){return function(_0x239e9b){try{jsonpatch[_0x215a('0x1f')](_0x239e9b,_0xa82f79,!![]);}catch(_0x4f87a7){return BPromise[_0x215a('0x20')](_0x4f87a7);}return _0x239e9b[_0x215a('0x21')]();};}function saveUpdates(_0x18b4a1,_0x11140c){return function(_0x340968){if(_0x340968){return _0x340968['update'](_0x18b4a1)[_0x215a('0x22')](function(_0x24251c){return _0x24251c;});}return null;};}function removeEntity(_0x10dbfa,_0x3eb50d){return function(_0x1520d5){if(_0x1520d5){return _0x1520d5[_0x215a('0x23')]()[_0x215a('0x22')](function(){_0x10dbfa[_0x215a('0x17')](0xcc)[_0x215a('0x18')]();});}};}function handleEntityNotFound(_0x4caa06,_0x334860){return function(_0x2e70ad){if(!_0x2e70ad){_0x4caa06[_0x215a('0x16')](0x194);}return _0x2e70ad;};}function handleError(_0xde4b4e,_0x494300){_0x494300=_0x494300||0x1f4;return function(_0x1ec27b){logger[_0x215a('0x24')](_0x1ec27b[_0x215a('0x25')]);if(_0x1ec27b[_0x215a('0x26')]){delete _0x1ec27b[_0x215a('0x26')];}_0xde4b4e[_0x215a('0x17')](_0x494300)['send'](_0x1ec27b);};}exports[_0x215a('0x27')]=function(_0x367d18,_0x2703d9){var _0x12746c={},_0x37c073={},_0x53caac={'count':0x0,'rows':[]};var _0x229753=_[_0x215a('0x28')](db[_0x215a('0x29')]['rawAttributes'],function(_0x3795fe){return{'name':_0x3795fe[_0x215a('0x2a')],'type':_0x3795fe['type'][_0x215a('0x2b')]};});_0x37c073['model']=_['map'](_0x229753,_0x215a('0x26'));_0x37c073[_0x215a('0x2c')]=_[_0x215a('0x2d')](_0x367d18['query']);_0x37c073['filters']=_['intersection'](_0x37c073['model'],_0x37c073[_0x215a('0x2c')]);_0x12746c[_0x215a('0x2e')]=_[_0x215a('0x2f')](_0x37c073[_0x215a('0x30')],qs[_0x215a('0x31')](_0x367d18['query'][_0x215a('0x31')]));_0x12746c[_0x215a('0x2e')]=_0x12746c[_0x215a('0x2e')][_0x215a('0x32')]?_0x12746c[_0x215a('0x2e')]:_0x37c073[_0x215a('0x30')];if(!_0x367d18['query']['hasOwnProperty'](_0x215a('0x33'))){_0x12746c[_0x215a('0x1d')]=qs[_0x215a('0x1d')](_0x367d18[_0x215a('0x2c')][_0x215a('0x1d')]);_0x12746c[_0x215a('0x1c')]=qs[_0x215a('0x1c')](_0x367d18['query'][_0x215a('0x1c')]);}_0x12746c[_0x215a('0x34')]=qs[_0x215a('0x35')](_0x367d18[_0x215a('0x2c')][_0x215a('0x35')]);_0x12746c[_0x215a('0x36')]=qs[_0x215a('0x37')](_[_0x215a('0x38')](_0x367d18[_0x215a('0x2c')],_0x37c073[_0x215a('0x37')]),_0x229753);if(_0x367d18[_0x215a('0x2c')][_0x215a('0x39')]){_0x12746c['where']=_[_0x215a('0x3a')](_0x12746c[_0x215a('0x36')],{'$or':_['map'](_0x229753,function(_0x4b59da){if(_0x4b59da[_0x215a('0x3b')]!==_0x215a('0x3c')){var _0x1e08d5={};_0x1e08d5[_0x4b59da[_0x215a('0x26')]]={'$like':'%'+_0x367d18[_0x215a('0x2c')][_0x215a('0x39')]+'%'};return _0x1e08d5;}})});}_0x12746c=_['merge']({},_0x12746c,_0x367d18[_0x215a('0x3d')]);var _0x174232={'where':_0x12746c[_0x215a('0x36')]};return db[_0x215a('0x29')][_0x215a('0x1b')](_0x174232)[_0x215a('0x22')](function(_0x99a416){_0x53caac[_0x215a('0x1b')]=_0x99a416;if(_0x367d18['query']['includeAll']){_0x12746c[_0x215a('0x3e')]=[{'all':!![]}];}return db[_0x215a('0x29')][_0x215a('0x3f')](_0x12746c);})[_0x215a('0x22')](function(_0x44d669){_0x53caac[_0x215a('0x40')]=_0x44d669;return _0x53caac;})['then'](respondWithFilteredResult(_0x2703d9,_0x12746c))['catch'](handleError(_0x2703d9,null));};exports[_0x215a('0x41')]=function(_0x2f86c7,_0x578246){var _0xa96e38={'raw':![],'where':{'id':_0x2f86c7[_0x215a('0x42')]['id']}},_0x4cbf87={};_0x4cbf87[_0x215a('0x30')]=_[_0x215a('0x2d')](db['FreshsalesConfiguration'][_0x215a('0x43')]);_0x4cbf87[_0x215a('0x2c')]=_[_0x215a('0x2d')](_0x2f86c7[_0x215a('0x2c')]);_0x4cbf87['filters']=_[_0x215a('0x2f')](_0x4cbf87[_0x215a('0x30')],_0x4cbf87[_0x215a('0x2c')]);_0xa96e38[_0x215a('0x2e')]=_[_0x215a('0x2f')](_0x4cbf87[_0x215a('0x30')],qs['fields'](_0x2f86c7['query'][_0x215a('0x31')]));_0xa96e38[_0x215a('0x2e')]=_0xa96e38['attributes']['length']?_0xa96e38[_0x215a('0x2e')]:_0x4cbf87[_0x215a('0x30')];if(_0x2f86c7['query'][_0x215a('0x44')]){_0xa96e38[_0x215a('0x3e')]=[{'all':!![]}];}_0xa96e38=_[_0x215a('0x3a')]({},_0xa96e38,_0x2f86c7[_0x215a('0x3d')]);return db[_0x215a('0x29')]['find'](_0xa96e38)['then'](handleEntityNotFound(_0x578246,null))[_0x215a('0x22')](respondWithResult(_0x578246,null))[_0x215a('0x45')](handleError(_0x578246,null));};exports[_0x215a('0x46')]=function(_0x59b44d,_0x10de58){return db['FreshsalesConfiguration'][_0x215a('0x46')](_0x59b44d[_0x215a('0x47')],{})[_0x215a('0x22')](respondWithResult(_0x10de58,0xc9))['catch'](handleError(_0x10de58,null));};exports[_0x215a('0x48')]=function(_0x35a412,_0x281938){if(_0x35a412['body']['id']){delete _0x35a412[_0x215a('0x47')]['id'];}return db[_0x215a('0x29')][_0x215a('0x49')]({'where':{'id':_0x35a412['params']['id']}})[_0x215a('0x22')](handleEntityNotFound(_0x281938,null))[_0x215a('0x22')](saveUpdates(_0x35a412['body'],null))[_0x215a('0x22')](respondWithResult(_0x281938,null))[_0x215a('0x45')](handleError(_0x281938,null));};exports[_0x215a('0x23')]=function(_0xf456a7,_0x2d38e0){return db['FreshsalesConfiguration'][_0x215a('0x49')]({'where':{'id':_0xf456a7[_0x215a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d38e0,null))[_0x215a('0x22')](removeEntity(_0x2d38e0,null))[_0x215a('0x45')](handleError(_0x2d38e0,null));};exports[_0x215a('0x4a')]=function(_0x43031d,_0x15a162,_0x3a9f66){var _0x58a957={};var _0x2187fd={};var _0xc257;var _0x4e2d11;return db[_0x215a('0x29')]['findOne']({'where':{'id':_0x43031d[_0x215a('0x42')]['id']}})[_0x215a('0x22')](handleEntityNotFound(_0x15a162,null))['then'](function(_0x178e49){if(_0x178e49){_0xc257=_0x178e49;_0x2187fd[_0x215a('0x30')]=_[_0x215a('0x2d')](db[_0x215a('0x4b')][_0x215a('0x43')]);_0x2187fd[_0x215a('0x2c')]=_[_0x215a('0x2d')](_0x43031d[_0x215a('0x2c')]);_0x2187fd['filters']=_[_0x215a('0x2f')](_0x2187fd[_0x215a('0x30')],_0x2187fd[_0x215a('0x2c')]);_0x58a957[_0x215a('0x2e')]=_[_0x215a('0x2f')](_0x2187fd['model'],qs[_0x215a('0x31')](_0x43031d[_0x215a('0x2c')][_0x215a('0x31')]));_0x58a957[_0x215a('0x2e')]=_0x58a957['attributes'][_0x215a('0x32')]?_0x58a957[_0x215a('0x2e')]:_0x2187fd[_0x215a('0x30')];_0x58a957['order']=qs[_0x215a('0x35')](_0x43031d[_0x215a('0x2c')]['sort']);_0x58a957[_0x215a('0x36')]=qs['filters'](_[_0x215a('0x38')](_0x43031d[_0x215a('0x2c')],_0x2187fd[_0x215a('0x37')]));if(_0x43031d[_0x215a('0x2c')]['filter']){_0x58a957['where']=_['merge'](_0x58a957[_0x215a('0x36')],{'$or':_[_0x215a('0x28')](_0x58a957[_0x215a('0x2e')],function(_0x504d01){var _0x1f8da7={};_0x1f8da7[_0x504d01]={'$like':'%'+_0x43031d[_0x215a('0x2c')][_0x215a('0x39')]+'%'};return _0x1f8da7;})});}_0x58a957=_[_0x215a('0x3a')]({},_0x58a957,_0x43031d[_0x215a('0x3d')]);return _0xc257[_0x215a('0x4a')](_0x58a957);}})[_0x215a('0x22')](function(_0xb07c19){if(_0xb07c19){_0x4e2d11=_0xb07c19[_0x215a('0x32')];if(!_0x43031d[_0x215a('0x2c')][_0x215a('0x4c')](_0x215a('0x33'))){_0x58a957[_0x215a('0x1d')]=qs[_0x215a('0x1d')](_0x43031d[_0x215a('0x2c')][_0x215a('0x1d')]);_0x58a957[_0x215a('0x1c')]=qs[_0x215a('0x1c')](_0x43031d[_0x215a('0x2c')][_0x215a('0x1c')]);}return _0xc257['getSubjects'](_0x58a957);}})[_0x215a('0x22')](function(_0x347762){if(_0x347762){return _0x347762?{'count':_0x4e2d11,'rows':_0x347762}:null;}})[_0x215a('0x22')](respondWithResult(_0x15a162,null))['catch'](handleError(_0x15a162,null));};exports['getDescriptions']=function(_0x5a6f19,_0xa663a9,_0x444337){var _0x425753={};var _0x52e7f5={};var _0x2eaeee;var _0x3f49b1;return db[_0x215a('0x29')]['findOne']({'where':{'id':_0x5a6f19['params']['id']}})[_0x215a('0x22')](handleEntityNotFound(_0xa663a9,null))[_0x215a('0x22')](function(_0x432be){if(_0x432be){_0x2eaeee=_0x432be;_0x52e7f5[_0x215a('0x30')]=_[_0x215a('0x2d')](db[_0x215a('0x4b')]['rawAttributes']);_0x52e7f5[_0x215a('0x2c')]=_[_0x215a('0x2d')](_0x5a6f19[_0x215a('0x2c')]);_0x52e7f5[_0x215a('0x37')]=_[_0x215a('0x2f')](_0x52e7f5[_0x215a('0x30')],_0x52e7f5['query']);_0x425753['attributes']=_[_0x215a('0x2f')](_0x52e7f5[_0x215a('0x30')],qs[_0x215a('0x31')](_0x5a6f19[_0x215a('0x2c')][_0x215a('0x31')]));_0x425753[_0x215a('0x2e')]=_0x425753[_0x215a('0x2e')][_0x215a('0x32')]?_0x425753['attributes']:_0x52e7f5['model'];_0x425753[_0x215a('0x34')]=qs[_0x215a('0x35')](_0x5a6f19[_0x215a('0x2c')][_0x215a('0x35')]);_0x425753[_0x215a('0x36')]=qs['filters'](_['pick'](_0x5a6f19['query'],_0x52e7f5[_0x215a('0x37')]));if(_0x5a6f19['query'][_0x215a('0x39')]){_0x425753[_0x215a('0x36')]=_[_0x215a('0x3a')](_0x425753[_0x215a('0x36')],{'$or':_['map'](_0x425753[_0x215a('0x2e')],function(_0x1e9a71){var _0x5663c7={};_0x5663c7[_0x1e9a71]={'$like':'%'+_0x5a6f19[_0x215a('0x2c')]['filter']+'%'};return _0x5663c7;})});}_0x425753=_[_0x215a('0x3a')]({},_0x425753,_0x5a6f19[_0x215a('0x3d')]);return _0x2eaeee[_0x215a('0x4d')](_0x425753);}})['then'](function(_0x12ba81){if(_0x12ba81){_0x3f49b1=_0x12ba81[_0x215a('0x32')];if(!_0x5a6f19['query'][_0x215a('0x4c')](_0x215a('0x33'))){_0x425753[_0x215a('0x1d')]=qs['limit'](_0x5a6f19[_0x215a('0x2c')][_0x215a('0x1d')]);_0x425753[_0x215a('0x1c')]=qs[_0x215a('0x1c')](_0x5a6f19[_0x215a('0x2c')]['offset']);}return _0x2eaeee['getDescriptions'](_0x425753);}})['then'](function(_0x3b65a0){if(_0x3b65a0){return _0x3b65a0?{'count':_0x3f49b1,'rows':_0x3b65a0}:null;}})[_0x215a('0x22')](respondWithResult(_0xa663a9,null))['catch'](handleError(_0xa663a9,null));};exports['getFields']=function(_0x43c2fe,_0x1b66d4,_0x1adf77){var _0x4e7b89={};var _0x104ccd={};var _0x32093d;var _0x36ba1b;return db[_0x215a('0x29')][_0x215a('0x4e')]({'where':{'id':_0x43c2fe[_0x215a('0x42')]['id']}})[_0x215a('0x22')](handleEntityNotFound(_0x1b66d4,null))[_0x215a('0x22')](function(_0x4543d9){if(_0x4543d9){_0x32093d=_0x4543d9;_0x104ccd[_0x215a('0x30')]=_[_0x215a('0x2d')](db[_0x215a('0x4b')][_0x215a('0x43')]);_0x104ccd['query']=_[_0x215a('0x2d')](_0x43c2fe[_0x215a('0x2c')]);_0x104ccd[_0x215a('0x37')]=_[_0x215a('0x2f')](_0x104ccd[_0x215a('0x30')],_0x104ccd[_0x215a('0x2c')]);_0x4e7b89['attributes']=_[_0x215a('0x2f')](_0x104ccd[_0x215a('0x30')],qs['fields'](_0x43c2fe[_0x215a('0x2c')][_0x215a('0x31')]));_0x4e7b89[_0x215a('0x2e')]=_0x4e7b89['attributes'][_0x215a('0x32')]?_0x4e7b89[_0x215a('0x2e')]:_0x104ccd[_0x215a('0x30')];_0x4e7b89['order']=qs[_0x215a('0x35')](_0x43c2fe[_0x215a('0x2c')]['sort']);_0x4e7b89[_0x215a('0x36')]=qs[_0x215a('0x37')](_[_0x215a('0x38')](_0x43c2fe[_0x215a('0x2c')],_0x104ccd[_0x215a('0x37')]));if(_0x43c2fe[_0x215a('0x2c')][_0x215a('0x39')]){_0x4e7b89[_0x215a('0x36')]=_[_0x215a('0x3a')](_0x4e7b89['where'],{'$or':_[_0x215a('0x28')](_0x4e7b89[_0x215a('0x2e')],function(_0x36f52e){var _0x16e841={};_0x16e841[_0x36f52e]={'$like':'%'+_0x43c2fe[_0x215a('0x2c')][_0x215a('0x39')]+'%'};return _0x16e841;})});}_0x4e7b89=_[_0x215a('0x3a')]({},_0x4e7b89,_0x43c2fe[_0x215a('0x3d')]);return _0x32093d[_0x215a('0x4f')](_0x4e7b89);}})[_0x215a('0x22')](function(_0xbc1a69){if(_0xbc1a69){_0x36ba1b=_0xbc1a69['length'];if(!_0x43c2fe[_0x215a('0x2c')][_0x215a('0x4c')](_0x215a('0x33'))){_0x4e7b89[_0x215a('0x1d')]=qs[_0x215a('0x1d')](_0x43c2fe[_0x215a('0x2c')][_0x215a('0x1d')]);_0x4e7b89['offset']=qs[_0x215a('0x1c')](_0x43c2fe[_0x215a('0x2c')][_0x215a('0x1c')]);}return _0x32093d[_0x215a('0x4f')](_0x4e7b89);}})[_0x215a('0x22')](function(_0x59ecc6){if(_0x59ecc6){return _0x59ecc6?{'count':_0x36ba1b,'rows':_0x59ecc6}:null;}})[_0x215a('0x22')](respondWithResult(_0x1b66d4,null))[_0x215a('0x45')](handleError(_0x1b66d4,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b347716..5aef791 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 _0xe62e=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0xe62e,0x103));var _0xee62=function(_0x48cc2c,_0x419254){_0x48cc2c=_0x48cc2c-0x0;var _0xfe1120=_0xe62e[_0x48cc2c];return _0xfe1120;};'use strict';var _=require(_0xee62('0x0'));var util=require(_0xee62('0x1'));var logger=require(_0xee62('0x2'))(_0xee62('0x3'));var moment=require(_0xee62('0x4'));var BPromise=require(_0xee62('0x5'));var rp=require(_0xee62('0x6'));var fs=require('fs');var path=require(_0xee62('0x7'));var rimraf=require('rimraf');var config=require(_0xee62('0x8'));var attributes=require(_0xee62('0x9'));module[_0xee62('0xa')]=function(_0x212fd2,_0x4b2245){return _0x212fd2[_0xee62('0xb')]('FreshsalesConfiguration',attributes,{'tableName':_0xee62('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50d0=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x358ee6,_0x5e0a5f){var _0x4e7e89=function(_0x9f3cdd){while(--_0x9f3cdd){_0x358ee6['push'](_0x358ee6['shift']());}};_0x4e7e89(++_0x5e0a5f);}(_0x50d0,0x18e));var _0x050d=function(_0x57ffeb,_0xe1382e){_0x57ffeb=_0x57ffeb-0x0;var _0xd42031=_0x50d0[_0x57ffeb];return _0xd42031;};'use strict';var _=require(_0x050d('0x0'));var util=require(_0x050d('0x1'));var logger=require(_0x050d('0x2'))(_0x050d('0x3'));var moment=require(_0x050d('0x4'));var BPromise=require(_0x050d('0x5'));var rp=require(_0x050d('0x6'));var fs=require('fs');var path=require(_0x050d('0x7'));var rimraf=require(_0x050d('0x8'));var config=require(_0x050d('0x9'));var attributes=require(_0x050d('0xa'));module[_0x050d('0xb')]=function(_0x2de260,_0x16dcbe){return _0x2de260[_0x050d('0xc')](_0x050d('0xd'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 46bef13..9477482 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 _0x0f10=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x4025df,_0x5bdc3a){var _0x3caeca=function(_0x394f34){while(--_0x394f34){_0x4025df['push'](_0x4025df['shift']());}};_0x3caeca(++_0x5bdc3a);}(_0x0f10,0x1b7));var _0x00f1=function(_0xc8dfa9,_0x996a2b){_0xc8dfa9=_0xc8dfa9-0x0;var _0x5f5c3c=_0x0f10[_0xc8dfa9];return _0x5f5c3c;};'use strict';var _=require(_0x00f1('0x0'));var util=require('util');var moment=require(_0x00f1('0x1'));var BPromise=require(_0x00f1('0x2'));var rs=require(_0x00f1('0x3'));var fs=require('fs');var Redis=require(_0x00f1('0x4'));var db=require(_0x00f1('0x5'))['db'];var utils=require(_0x00f1('0x6'));var logger=require(_0x00f1('0x7'))(_0x00f1('0x8'));var config=require(_0x00f1('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x00f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ca3e6,_0x405280,_0x531771){return new BPromise(function(_0x3c5959,_0x482d1c){return client[_0x00f1('0xb')](_0x1ca3e6,_0x531771)['then'](function(_0x2184c2){logger[_0x00f1('0xc')](_0x00f1('0xd'),_0x405280,'request\x20sent');logger['debug'](_0x00f1('0xe'),_0x405280,_0x00f1('0xf'),JSON[_0x00f1('0x10')](_0x2184c2));if(_0x2184c2[_0x00f1('0x11')]){if(_0x2184c2[_0x00f1('0x11')][_0x00f1('0x12')]===0x1f4){logger['error'](_0x00f1('0xd'),_0x405280,_0x2184c2[_0x00f1('0x11')]['message']);return _0x482d1c(_0x2184c2[_0x00f1('0x11')][_0x00f1('0x13')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x405280,_0x2184c2[_0x00f1('0x11')][_0x00f1('0x13')]);return _0x3c5959(_0x2184c2['error'][_0x00f1('0x13')]);}else{logger[_0x00f1('0xc')](_0x00f1('0xd'),_0x405280,_0x00f1('0xf'));_0x3c5959(_0x2184c2[_0x00f1('0x14')][_0x00f1('0x13')]);}})[_0x00f1('0x15')](function(_0x50e931){logger[_0x00f1('0x11')](_0x00f1('0xd'),_0x405280,_0x50e931);_0x482d1c(_0x50e931);});});} \ No newline at end of file +var _0xec38=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0xec38,0x137));var _0x8ec3=function(_0x42e75c,_0x136223){_0x42e75c=_0x42e75c-0x0;var _0x42b0b8=_0xec38[_0x42e75c];return _0x42b0b8;};'use strict';var _=require(_0x8ec3('0x0'));var util=require(_0x8ec3('0x1'));var moment=require(_0x8ec3('0x2'));var BPromise=require(_0x8ec3('0x3'));var rs=require(_0x8ec3('0x4'));var fs=require('fs');var Redis=require(_0x8ec3('0x5'));var db=require(_0x8ec3('0x6'))['db'];var utils=require(_0x8ec3('0x7'));var logger=require(_0x8ec3('0x8'))(_0x8ec3('0x9'));var config=require(_0x8ec3('0xa'));var jayson=require(_0x8ec3('0xb'));var client=jayson[_0x8ec3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d0aa,_0x52be75,_0x30d4ea){return new BPromise(function(_0x4df36a,_0x2b691c){return client[_0x8ec3('0xd')](_0x38d0aa,_0x30d4ea)[_0x8ec3('0xe')](function(_0x432210){logger[_0x8ec3('0xf')](_0x8ec3('0x10'),_0x52be75,'request\x20sent');logger['debug'](_0x8ec3('0x11'),_0x52be75,'request\x20sent',JSON[_0x8ec3('0x12')](_0x432210));if(_0x432210[_0x8ec3('0x13')]){if(_0x432210['error'][_0x8ec3('0x14')]===0x1f4){logger[_0x8ec3('0x13')](_0x8ec3('0x10'),_0x52be75,_0x432210['error']['message']);return _0x2b691c(_0x432210[_0x8ec3('0x13')]['message']);}logger[_0x8ec3('0x13')](_0x8ec3('0x10'),_0x52be75,_0x432210[_0x8ec3('0x13')][_0x8ec3('0x15')]);return _0x4df36a(_0x432210[_0x8ec3('0x13')][_0x8ec3('0x15')]);}else{logger['info'](_0x8ec3('0x10'),_0x52be75,_0x8ec3('0x16'));_0x4df36a(_0x432210[_0x8ec3('0x17')][_0x8ec3('0x15')]);}})[_0x8ec3('0x18')](function(_0x362688){logger[_0x8ec3('0x13')](_0x8ec3('0x10'),_0x52be75,_0x362688);_0x2b691c(_0x362688);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 96934c6..d9a0b76 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 _0x8278=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1da7a5,_0x1a5546){var _0x11c3c1=function(_0x563999){while(--_0x563999){_0x1da7a5['push'](_0x1da7a5['shift']());}};_0x11c3c1(++_0x1a5546);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var path=require(_0x8827('0x2'));var timeout=require(_0x8827('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8827('0x4'));var auth=require(_0x8827('0x5'));var interaction=require(_0x8827('0x6'));var config=require(_0x8827('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x8827('0x8')]('/',auth[_0x8827('0x9')](),controller[_0x8827('0xa')]);router[_0x8827('0x8')](_0x8827('0xb'),auth[_0x8827('0x9')](),controller[_0x8827('0xc')]);router[_0x8827('0xd')]('/',auth[_0x8827('0x9')](),controller[_0x8827('0xe')]);router[_0x8827('0xf')](_0x8827('0xb'),auth[_0x8827('0x9')](),controller['update']);router[_0x8827('0x10')](_0x8827('0xb'),auth['isAuthenticated'](),controller[_0x8827('0x11')]);module[_0x8827('0x12')]=router; \ No newline at end of file +var _0x057a=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x057a,0x1a6));var _0xa057=function(_0x55c8e6,_0x41fbfa){_0x55c8e6=_0x55c8e6-0x0;var _0x37c08b=_0x057a[_0x55c8e6];return _0x37c08b;};'use strict';var multer=require(_0xa057('0x0'));var util=require(_0xa057('0x1'));var path=require(_0xa057('0x2'));var timeout=require('connect-timeout');var express=require(_0xa057('0x3'));var router=express['Router']();var fs_extra=require(_0xa057('0x4'));var auth=require(_0xa057('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa057('0x6'));var controller=require(_0xa057('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa057('0x8')]);router[_0xa057('0x9')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0xc')]);router[_0xa057('0xd')]('/',auth[_0xa057('0xb')](),controller[_0xa057('0xe')]);router[_0xa057('0xf')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0x10')]);router[_0xa057('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa057('0x12')]);module[_0xa057('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 71fb721..64c3e34 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 _0xd873=['ENUM','string','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x4d088d,_0x2ca253){var _0x59e4b5=function(_0x38e8fb){while(--_0x38e8fb){_0x4d088d['push'](_0x4d088d['shift']());}};_0x59e4b5(++_0x2ca253);}(_0xd873,0x117));var _0x3d87=function(_0x18643b,_0x5f4aad){_0x18643b=_0x18643b-0x0;var _0x4a3e47=_0xd873[_0x18643b];return _0x4a3e47;};'use strict';var Sequelize=require(_0x3d87('0x0'));module['exports']={'type':{'type':Sequelize[_0x3d87('0x1')](_0x3d87('0x2'),'variable',_0x3d87('0x3'),'keyValue',_0x3d87('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3d87('0x5')]},'key':{'type':Sequelize[_0x3d87('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x3d87('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3d87('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3d87('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa39a=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0xa39a,0x156));var _0xaa39=function(_0xdf6d69,_0x24994f){_0xdf6d69=_0xdf6d69-0x0;var _0x4e5d80=_0xa39a[_0xdf6d69];return _0x4e5d80;};'use strict';var Sequelize=require(_0xaa39('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xaa39('0x1'),_0xaa39('0x2'),_0xaa39('0x3'),_0xaa39('0x4'),'picklist'),'defaultValue':_0xaa39('0x1')},'content':{'type':Sequelize[_0xaa39('0x5')]},'key':{'type':Sequelize[_0xaa39('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xaa39('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xaa39('0x5')]},'idField':{'type':Sequelize[_0xaa39('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaa39('0x6')],'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 5577db8..5e126ae 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 _0xc33e=['status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xc33e,0x19a));var _0xec33=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc33e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec33('0x0'));var zipdir=require(_0xec33('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xec33('0x2'));var Mustache=require(_0xec33('0x3'));var util=require(_0xec33('0x4'));var path=require(_0xec33('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec33('0x6'));var _=require('lodash');var squel=require(_0xec33('0x7'));var crypto=require(_0xec33('0x8'));var jsforce=require(_0xec33('0x9'));var deskjs=require(_0xec33('0xa'));var toCsv=require(_0xec33('0xb'));var querystring=require(_0xec33('0xc'));var Papa=require(_0xec33('0xd'));var Redis=require('ioredis');var authService=require(_0xec33('0xe'));var qs=require(_0xec33('0xf'));var as=require(_0xec33('0x10'));var hardwareService=require(_0xec33('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xec33('0x12'));var config=require(_0xec33('0x13'));var licenseUtil=require(_0xec33('0x14'));var db=require(_0xec33('0x15'))['db'];function respondWithStatusCode(_0x51a852,_0x18d0fc){_0x18d0fc=_0x18d0fc||0xcc;return function(_0x485551){if(_0x485551){return _0x51a852['sendStatus'](_0x18d0fc);}return _0x51a852[_0xec33('0x16')](_0x18d0fc)[_0xec33('0x17')]();};}function respondWithResult(_0x1b062d,_0x45435d){_0x45435d=_0x45435d||0xc8;return function(_0x5c5406){if(_0x5c5406){return _0x1b062d['status'](_0x45435d)[_0xec33('0x18')](_0x5c5406);}};}function respondWithFilteredResult(_0x515b22,_0x520757){return function(_0x4568bd){if(_0x4568bd){var _0x326d43=typeof _0x520757[_0xec33('0x19')]==='undefined'&&typeof _0x520757[_0xec33('0x1a')]===_0xec33('0x1b');var _0x350669=_0x4568bd[_0xec33('0x1c')];var _0x23e299=_0x326d43?0x0:_0x520757[_0xec33('0x19')];var _0x4b6b1e=_0x326d43?_0x4568bd[_0xec33('0x1c')]:_0x520757[_0xec33('0x19')]+_0x520757['limit'];var _0x14816d;if(_0x4b6b1e>=_0x350669){_0x4b6b1e=_0x350669;_0x14816d=0xc8;}else{_0x14816d=0xce;}_0x515b22['status'](_0x14816d);return _0x515b22[_0xec33('0x1d')]('Content-Range',_0x23e299+'-'+_0x4b6b1e+'/'+_0x350669)[_0xec33('0x18')](_0x4568bd);}return null;};}function patchUpdates(_0x23e4b8){return function(_0xbee21){try{jsonpatch[_0xec33('0x1e')](_0xbee21,_0x23e4b8,!![]);}catch(_0x2db2c){return BPromise[_0xec33('0x1f')](_0x2db2c);}return _0xbee21['save']();};}function saveUpdates(_0x3e55db,_0x32e7a7){return function(_0xd0d1a){if(_0xd0d1a){return _0xd0d1a[_0xec33('0x20')](_0x3e55db)[_0xec33('0x21')](function(_0x51d125){return _0x51d125;});}return null;};}function removeEntity(_0x1f3163,_0x58d19e){return function(_0x52bd2e){if(_0x52bd2e){return _0x52bd2e[_0xec33('0x22')]()['then'](function(){_0x1f3163[_0xec33('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3438bd,_0x34f043){return function(_0x1b5c6b){if(!_0x1b5c6b){_0x3438bd[_0xec33('0x23')](0x194);}return _0x1b5c6b;};}function handleError(_0x351c56,_0x2fd08b){_0x2fd08b=_0x2fd08b||0x1f4;return function(_0x468ffe){logger['error'](_0x468ffe[_0xec33('0x24')]);if(_0x468ffe[_0xec33('0x25')]){delete _0x468ffe[_0xec33('0x25')];}_0x351c56[_0xec33('0x16')](_0x2fd08b)[_0xec33('0x26')](_0x468ffe);};}exports[_0xec33('0x27')]=function(_0x4f7e0f,_0x1fd867){var _0xa904b2={},_0x5761ca={},_0x565d67={'count':0x0,'rows':[]};var _0x3e8012=_[_0xec33('0x28')](db[_0xec33('0x29')][_0xec33('0x2a')],function(_0x1f8e96){return{'name':_0x1f8e96[_0xec33('0x2b')],'type':_0x1f8e96['type'][_0xec33('0x2c')]};});_0x5761ca[_0xec33('0x2d')]=_['map'](_0x3e8012,'name');_0x5761ca[_0xec33('0x2e')]=_[_0xec33('0x2f')](_0x4f7e0f[_0xec33('0x2e')]);_0x5761ca[_0xec33('0x30')]=_['intersection'](_0x5761ca[_0xec33('0x2d')],_0x5761ca[_0xec33('0x2e')]);_0xa904b2[_0xec33('0x31')]=_[_0xec33('0x32')](_0x5761ca['model'],qs[_0xec33('0x33')](_0x4f7e0f['query']['fields']));_0xa904b2[_0xec33('0x31')]=_0xa904b2[_0xec33('0x31')][_0xec33('0x34')]?_0xa904b2[_0xec33('0x31')]:_0x5761ca[_0xec33('0x2d')];if(!_0x4f7e0f['query'][_0xec33('0x35')]('nolimit')){_0xa904b2[_0xec33('0x1a')]=qs[_0xec33('0x1a')](_0x4f7e0f[_0xec33('0x2e')]['limit']);_0xa904b2[_0xec33('0x19')]=qs['offset'](_0x4f7e0f['query'][_0xec33('0x19')]);}_0xa904b2[_0xec33('0x36')]=qs[_0xec33('0x37')](_0x4f7e0f[_0xec33('0x2e')][_0xec33('0x37')]);_0xa904b2['where']=qs['filters'](_[_0xec33('0x38')](_0x4f7e0f[_0xec33('0x2e')],_0x5761ca[_0xec33('0x30')]),_0x3e8012);if(_0x4f7e0f[_0xec33('0x2e')]['filter']){_0xa904b2[_0xec33('0x39')]=_[_0xec33('0x3a')](_0xa904b2[_0xec33('0x39')],{'$or':_['map'](_0x3e8012,function(_0x46ee01){if(_0x46ee01[_0xec33('0x3b')]!==_0xec33('0x3c')){var _0x2fbc16={};_0x2fbc16[_0x46ee01[_0xec33('0x25')]]={'$like':'%'+_0x4f7e0f[_0xec33('0x2e')][_0xec33('0x3d')]+'%'};return _0x2fbc16;}})});}_0xa904b2=_[_0xec33('0x3a')]({},_0xa904b2,_0x4f7e0f[_0xec33('0x3e')]);var _0xeece6e={'where':_0xa904b2[_0xec33('0x39')]};return db[_0xec33('0x29')][_0xec33('0x1c')](_0xeece6e)[_0xec33('0x21')](function(_0x516fbf){_0x565d67['count']=_0x516fbf;if(_0x4f7e0f[_0xec33('0x2e')][_0xec33('0x3f')]){_0xa904b2[_0xec33('0x40')]=[{'all':!![]}];}return db[_0xec33('0x29')][_0xec33('0x41')](_0xa904b2);})[_0xec33('0x21')](function(_0x55d602){_0x565d67[_0xec33('0x42')]=_0x55d602;return _0x565d67;})[_0xec33('0x21')](respondWithFilteredResult(_0x1fd867,_0xa904b2))[_0xec33('0x43')](handleError(_0x1fd867,null));};exports['show']=function(_0x118df2,_0x57df01){var _0x233fa2={'raw':!![],'where':{'id':_0x118df2[_0xec33('0x44')]['id']}},_0x5050ca={};_0x5050ca[_0xec33('0x2d')]=_[_0xec33('0x2f')](db[_0xec33('0x29')]['rawAttributes']);_0x5050ca[_0xec33('0x2e')]=_['keys'](_0x118df2[_0xec33('0x2e')]);_0x5050ca[_0xec33('0x30')]=_['intersection'](_0x5050ca['model'],_0x5050ca[_0xec33('0x2e')]);_0x233fa2[_0xec33('0x31')]=_['intersection'](_0x5050ca[_0xec33('0x2d')],qs['fields'](_0x118df2[_0xec33('0x2e')][_0xec33('0x33')]));_0x233fa2[_0xec33('0x31')]=_0x233fa2[_0xec33('0x31')]['length']?_0x233fa2[_0xec33('0x31')]:_0x5050ca[_0xec33('0x2d')];if(_0x118df2[_0xec33('0x2e')][_0xec33('0x3f')]){_0x233fa2['include']=[{'all':!![]}];}_0x233fa2=_[_0xec33('0x3a')]({},_0x233fa2,_0x118df2['options']);return db[_0xec33('0x29')][_0xec33('0x45')](_0x233fa2)[_0xec33('0x21')](handleEntityNotFound(_0x57df01,null))[_0xec33('0x21')](respondWithResult(_0x57df01,null))[_0xec33('0x43')](handleError(_0x57df01,null));};exports[_0xec33('0x46')]=function(_0x514536,_0x25b99c){return db[_0xec33('0x29')]['create'](_0x514536[_0xec33('0x47')],{})['then'](respondWithResult(_0x25b99c,0xc9))[_0xec33('0x43')](handleError(_0x25b99c,null));};exports[_0xec33('0x20')]=function(_0x4f90df,_0x590ec1){if(_0x4f90df['body']['id']){delete _0x4f90df['body']['id'];}return db[_0xec33('0x29')][_0xec33('0x45')]({'where':{'id':_0x4f90df['params']['id']}})['then'](handleEntityNotFound(_0x590ec1,null))[_0xec33('0x21')](saveUpdates(_0x4f90df['body'],null))['then'](respondWithResult(_0x590ec1,null))['catch'](handleError(_0x590ec1,null));};exports[_0xec33('0x22')]=function(_0x505643,_0x4a95ab){return db[_0xec33('0x29')][_0xec33('0x45')]({'where':{'id':_0x505643[_0xec33('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a95ab,null))[_0xec33('0x21')](removeEntity(_0x4a95ab,null))['catch'](handleError(_0x4a95ab,null));}; \ No newline at end of file +var _0x4fd1=['limit','count','set','Content-Range','apply','reject','save','update','then','status','end','error','stack','name','send','index','map','FreshsalesField','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','type','filter','options','includeAll','show','params','include','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined'];(function(_0x40c9ff,_0x4d28fa){var _0x476aff=function(_0x2ab791){while(--_0x2ab791){_0x40c9ff['push'](_0x40c9ff['shift']());}};_0x476aff(++_0x4d28fa);}(_0x4fd1,0x77));var _0x14fd=function(_0x4aab5a,_0x3397e6){_0x4aab5a=_0x4aab5a-0x0;var _0x5c5dc9=_0x4fd1[_0x4aab5a];return _0x5c5dc9;};'use strict';var emlformat=require(_0x14fd('0x0'));var rimraf=require(_0x14fd('0x1'));var zipdir=require(_0x14fd('0x2'));var jsonpatch=require(_0x14fd('0x3'));var rp=require(_0x14fd('0x4'));var moment=require(_0x14fd('0x5'));var BPromise=require(_0x14fd('0x6'));var Mustache=require(_0x14fd('0x7'));var util=require(_0x14fd('0x8'));var path=require(_0x14fd('0x9'));var sox=require(_0x14fd('0xa'));var csv=require(_0x14fd('0xb'));var ejs=require(_0x14fd('0xc'));var fs=require('fs');var fs_extra=require(_0x14fd('0xd'));var _=require(_0x14fd('0xe'));var squel=require(_0x14fd('0xf'));var crypto=require(_0x14fd('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x14fd('0x11'));var toCsv=require(_0x14fd('0xb'));var querystring=require(_0x14fd('0x12'));var Papa=require(_0x14fd('0x13'));var Redis=require(_0x14fd('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x14fd('0x15'));var as=require(_0x14fd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x14fd('0x17'));var licenseUtil=require(_0x14fd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bcd1a,_0x33ba43){_0x33ba43=_0x33ba43||0xcc;return function(_0x41bad1){if(_0x41bad1){return _0x4bcd1a[_0x14fd('0x19')](_0x33ba43);}return _0x4bcd1a['status'](_0x33ba43)['end']();};}function respondWithResult(_0x449345,_0x21bd16){_0x21bd16=_0x21bd16||0xc8;return function(_0x204404){if(_0x204404){return _0x449345['status'](_0x21bd16)[_0x14fd('0x1a')](_0x204404);}};}function respondWithFilteredResult(_0x1fe3d7,_0x595859){return function(_0x3d007f){if(_0x3d007f){var _0x1162b4=typeof _0x595859[_0x14fd('0x1b')]===_0x14fd('0x1c')&&typeof _0x595859[_0x14fd('0x1d')]==='undefined';var _0x10cef0=_0x3d007f[_0x14fd('0x1e')];var _0x22d7b0=_0x1162b4?0x0:_0x595859[_0x14fd('0x1b')];var _0x1d7839=_0x1162b4?_0x3d007f[_0x14fd('0x1e')]:_0x595859[_0x14fd('0x1b')]+_0x595859[_0x14fd('0x1d')];var _0x2c4807;if(_0x1d7839>=_0x10cef0){_0x1d7839=_0x10cef0;_0x2c4807=0xc8;}else{_0x2c4807=0xce;}_0x1fe3d7['status'](_0x2c4807);return _0x1fe3d7[_0x14fd('0x1f')](_0x14fd('0x20'),_0x22d7b0+'-'+_0x1d7839+'/'+_0x10cef0)[_0x14fd('0x1a')](_0x3d007f);}return null;};}function patchUpdates(_0x15a2a0){return function(_0x5215d1){try{jsonpatch[_0x14fd('0x21')](_0x5215d1,_0x15a2a0,!![]);}catch(_0x1fe05d){return BPromise[_0x14fd('0x22')](_0x1fe05d);}return _0x5215d1[_0x14fd('0x23')]();};}function saveUpdates(_0x346ccd,_0x49cc92){return function(_0x281def){if(_0x281def){return _0x281def[_0x14fd('0x24')](_0x346ccd)['then'](function(_0x3359d3){return _0x3359d3;});}return null;};}function removeEntity(_0x27dfa8,_0x5377fc){return function(_0x2ae337){if(_0x2ae337){return _0x2ae337['destroy']()[_0x14fd('0x25')](function(){_0x27dfa8[_0x14fd('0x26')](0xcc)[_0x14fd('0x27')]();});}};}function handleEntityNotFound(_0x3eba3f,_0x4347ca){return function(_0x1b1265){if(!_0x1b1265){_0x3eba3f['sendStatus'](0x194);}return _0x1b1265;};}function handleError(_0x49ec58,_0x26a48c){_0x26a48c=_0x26a48c||0x1f4;return function(_0x1db3b9){logger[_0x14fd('0x28')](_0x1db3b9[_0x14fd('0x29')]);if(_0x1db3b9['name']){delete _0x1db3b9[_0x14fd('0x2a')];}_0x49ec58[_0x14fd('0x26')](_0x26a48c)[_0x14fd('0x2b')](_0x1db3b9);};}exports[_0x14fd('0x2c')]=function(_0x497671,_0x44118c){var _0x1b60cc={},_0x476e5f={},_0x52368d={'count':0x0,'rows':[]};var _0x1cfaac=_[_0x14fd('0x2d')](db[_0x14fd('0x2e')][_0x14fd('0x2f')],function(_0x40b209){return{'name':_0x40b209['fieldName'],'type':_0x40b209['type']['key']};});_0x476e5f[_0x14fd('0x30')]=_[_0x14fd('0x2d')](_0x1cfaac,_0x14fd('0x2a'));_0x476e5f[_0x14fd('0x31')]=_[_0x14fd('0x32')](_0x497671[_0x14fd('0x31')]);_0x476e5f['filters']=_[_0x14fd('0x33')](_0x476e5f[_0x14fd('0x30')],_0x476e5f[_0x14fd('0x31')]);_0x1b60cc[_0x14fd('0x34')]=_['intersection'](_0x476e5f[_0x14fd('0x30')],qs[_0x14fd('0x35')](_0x497671[_0x14fd('0x31')][_0x14fd('0x35')]));_0x1b60cc[_0x14fd('0x34')]=_0x1b60cc['attributes'][_0x14fd('0x36')]?_0x1b60cc['attributes']:_0x476e5f[_0x14fd('0x30')];if(!_0x497671['query'][_0x14fd('0x37')]('nolimit')){_0x1b60cc[_0x14fd('0x1d')]=qs[_0x14fd('0x1d')](_0x497671[_0x14fd('0x31')][_0x14fd('0x1d')]);_0x1b60cc[_0x14fd('0x1b')]=qs[_0x14fd('0x1b')](_0x497671['query'][_0x14fd('0x1b')]);}_0x1b60cc[_0x14fd('0x38')]=qs[_0x14fd('0x39')](_0x497671[_0x14fd('0x31')]['sort']);_0x1b60cc['where']=qs[_0x14fd('0x3a')](_[_0x14fd('0x3b')](_0x497671[_0x14fd('0x31')],_0x476e5f[_0x14fd('0x3a')]),_0x1cfaac);if(_0x497671[_0x14fd('0x31')]['filter']){_0x1b60cc[_0x14fd('0x3c')]=_[_0x14fd('0x3d')](_0x1b60cc[_0x14fd('0x3c')],{'$or':_[_0x14fd('0x2d')](_0x1cfaac,function(_0x1c4bb2){if(_0x1c4bb2[_0x14fd('0x3e')]!=='VIRTUAL'){var _0xbfbd0f={};_0xbfbd0f[_0x1c4bb2[_0x14fd('0x2a')]]={'$like':'%'+_0x497671['query'][_0x14fd('0x3f')]+'%'};return _0xbfbd0f;}})});}_0x1b60cc=_['merge']({},_0x1b60cc,_0x497671[_0x14fd('0x40')]);var _0x19c256={'where':_0x1b60cc['where']};return db[_0x14fd('0x2e')][_0x14fd('0x1e')](_0x19c256)[_0x14fd('0x25')](function(_0x35ca15){_0x52368d['count']=_0x35ca15;if(_0x497671[_0x14fd('0x31')][_0x14fd('0x41')]){_0x1b60cc['include']=[{'all':!![]}];}return db[_0x14fd('0x2e')]['findAll'](_0x1b60cc);})['then'](function(_0x4af716){_0x52368d['rows']=_0x4af716;return _0x52368d;})[_0x14fd('0x25')](respondWithFilteredResult(_0x44118c,_0x1b60cc))['catch'](handleError(_0x44118c,null));};exports[_0x14fd('0x42')]=function(_0x359624,_0xdef7f0){var _0x403138={'raw':!![],'where':{'id':_0x359624[_0x14fd('0x43')]['id']}},_0x152a08={};_0x152a08[_0x14fd('0x30')]=_[_0x14fd('0x32')](db[_0x14fd('0x2e')][_0x14fd('0x2f')]);_0x152a08[_0x14fd('0x31')]=_[_0x14fd('0x32')](_0x359624[_0x14fd('0x31')]);_0x152a08['filters']=_[_0x14fd('0x33')](_0x152a08[_0x14fd('0x30')],_0x152a08[_0x14fd('0x31')]);_0x403138[_0x14fd('0x34')]=_[_0x14fd('0x33')](_0x152a08[_0x14fd('0x30')],qs[_0x14fd('0x35')](_0x359624['query'][_0x14fd('0x35')]));_0x403138[_0x14fd('0x34')]=_0x403138[_0x14fd('0x34')]['length']?_0x403138[_0x14fd('0x34')]:_0x152a08[_0x14fd('0x30')];if(_0x359624['query'][_0x14fd('0x41')]){_0x403138[_0x14fd('0x44')]=[{'all':!![]}];}_0x403138=_[_0x14fd('0x3d')]({},_0x403138,_0x359624['options']);return db['FreshsalesField'][_0x14fd('0x45')](_0x403138)[_0x14fd('0x25')](handleEntityNotFound(_0xdef7f0,null))[_0x14fd('0x25')](respondWithResult(_0xdef7f0,null))[_0x14fd('0x46')](handleError(_0xdef7f0,null));};exports[_0x14fd('0x47')]=function(_0x2b7b39,_0x491bea){return db[_0x14fd('0x2e')][_0x14fd('0x47')](_0x2b7b39[_0x14fd('0x48')],{})[_0x14fd('0x25')](respondWithResult(_0x491bea,0xc9))[_0x14fd('0x46')](handleError(_0x491bea,null));};exports['update']=function(_0x33d656,_0x438ee3){if(_0x33d656[_0x14fd('0x48')]['id']){delete _0x33d656[_0x14fd('0x48')]['id'];}return db[_0x14fd('0x2e')][_0x14fd('0x45')]({'where':{'id':_0x33d656[_0x14fd('0x43')]['id']}})[_0x14fd('0x25')](handleEntityNotFound(_0x438ee3,null))[_0x14fd('0x25')](saveUpdates(_0x33d656[_0x14fd('0x48')],null))[_0x14fd('0x25')](respondWithResult(_0x438ee3,null))[_0x14fd('0x46')](handleError(_0x438ee3,null));};exports[_0x14fd('0x49')]=function(_0x353221,_0x23783e){return db['FreshsalesField']['find']({'where':{'id':_0x353221['params']['id']}})['then'](handleEntityNotFound(_0x23783e,null))[_0x14fd('0x25')](removeEntity(_0x23783e,null))['catch'](handleError(_0x23783e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7755afd..e04ceb9 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 _0x30fc=['request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x30fc,0x64));var _0xc30f=function(_0x3eaea7,_0x9968ff){_0x3eaea7=_0x3eaea7-0x0;var _0xd7cd35=_0x30fc[_0x3eaea7];return _0xd7cd35;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var logger=require('../../config/logger')(_0xc30f('0x2'));var moment=require(_0xc30f('0x3'));var BPromise=require(_0xc30f('0x4'));var rp=require(_0xc30f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc30f('0x6'));var config=require(_0xc30f('0x7'));var attributes=require(_0xc30f('0x8'));module[_0xc30f('0x9')]=function(_0x2948cb,_0x293391){return _0x2948cb['define'](_0xc30f('0xa'),attributes,{'tableName':_0xc30f('0xb'),'paranoid':![],'indexes':[{'name':_0xc30f('0xc'),'fields':[_0xc30f('0xd'),_0xc30f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x419f=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash'];(function(_0x512f8c,_0x3545c1){var _0x2099f8=function(_0x5293eb){while(--_0x5293eb){_0x512f8c['push'](_0x512f8c['shift']());}};_0x2099f8(++_0x3545c1);}(_0x419f,0x176));var _0xf419=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x419f[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xf419('0x0'));var util=require(_0xf419('0x1'));var logger=require(_0xf419('0x2'))(_0xf419('0x3'));var moment=require(_0xf419('0x4'));var BPromise=require(_0xf419('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf419('0x6'));var rimraf=require('rimraf');var config=require(_0xf419('0x7'));var attributes=require(_0xf419('0x8'));module[_0xf419('0x9')]=function(_0x38f2fa,_0x2d8430){return _0x38f2fa[_0xf419('0xa')](_0xf419('0xb'),attributes,{'tableName':_0xf419('0xc'),'paranoid':![],'indexes':[{'name':_0xf419('0xd'),'fields':['idField',_0xf419('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 477a67d..ce29bbb 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 _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x4d9892,_0x16b42c){var _0x17eecf=function(_0x4c1ba7){while(--_0x4c1ba7){_0x4d9892['push'](_0x4d9892['shift']());}};_0x17eecf(++_0x16b42c);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3a9959,_0x6bd0a5){_0x3a9959=_0x3a9959-0x0;var _0x10e253=_0xdbf5[_0x3a9959];return _0x10e253;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x182c04,_0xd4902e){var _0x2d032f=function(_0x116e24){while(--_0x116e24){_0x182c04['push'](_0x182c04['shift']());}};_0x2d032f(++_0xd4902e);}(_0xba34,0x119));var _0x4ba3=function(_0x333a1f,_0x447832){_0x333a1f=_0x333a1f-0x0;var _0x16471f=_0xba34[_0x333a1f];return _0x16471f;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a37b3ac..eba248f 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2964b2,_0x5a4ebd){var _0x2cc2e6=function(_0x171d2e){while(--_0x171d2e){_0x2964b2['push'](_0x2964b2['shift']());}};_0x2cc2e6(++_0x5a4ebd);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x45e6e7,_0xd948ce){var _0x2756d8=function(_0x60a82e){while(--_0x60a82e){_0x45e6e7['push'](_0x45e6e7['shift']());}};_0x2756d8(++_0xd948ce);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 30b93b9..084ff78 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 _0x4b38=['STRING','username','integrationTab','sequelize'];(function(_0x404deb,_0x700f79){var _0x41b21e=function(_0x52eb51){while(--_0x52eb51){_0x404deb['push'](_0x404deb['shift']());}};_0x41b21e(++_0x700f79);}(_0x4b38,0x157));var _0x84b3=function(_0x451217,_0x10df03){_0x451217=_0x451217-0x0;var _0x1c7c5f=_0x4b38[_0x451217];return _0x1c7c5f;};'use strict';var Sequelize=require(_0x84b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x84b3('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x84b3('0x1')],'unique':_0x84b3('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x84b3('0x1')]},'clientId':{'type':Sequelize[_0x84b3('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x84b3('0x1')]},'serverUrl':{'type':Sequelize[_0x84b3('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x84b3('0x3'),'newTab'),'defaultValue':_0x84b3('0x3')}}; \ No newline at end of file +var _0xafa7=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x2730ad,_0x4d247d){var _0x1d4363=function(_0x17c180){while(--_0x17c180){_0x2730ad['push'](_0x2730ad['shift']());}};_0x1d4363(++_0x4d247d);}(_0xafa7,0x122));var _0x7afa=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xafa7[_0xb7a459];return _0x104ab5;};'use strict';var Sequelize=require(_0x7afa('0x0'));module[_0x7afa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7afa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x7afa('0x3')},'remoteUri':{'type':Sequelize[_0x7afa('0x2')]},'password':{'type':Sequelize[_0x7afa('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7afa('0x2')]},'serverUrl':{'type':Sequelize[_0x7afa('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7afa('0x4')](_0x7afa('0x5'),_0x7afa('0x6')),'defaultValue':_0x7afa('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 021c0e4..07eeadc 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 _0x45e0=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','VIRTUAL','filter','options','SalesforceAccount','include','rows','catch','params','includeAll','merge','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','rawAttributes','sort','addConfiguration','Subjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientId','password','securityToken','substring','lastIndexOf','Connection','clientSecret','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','includes','custom','picklistValues','label','boolean','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x7f4118,_0x3331c2){var _0x34e9af=function(_0x54fe58){while(--_0x54fe58){_0x7f4118['push'](_0x7f4118['shift']());}};_0x34e9af(++_0x3331c2);}(_0x45e0,0x66));var _0x045e=function(_0x4f3da8,_0xfc5e41){_0x4f3da8=_0x4f3da8-0x0;var _0x45e590=_0x45e0[_0x4f3da8];return _0x45e590;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x045e('0x0'));var zipdir=require(_0x045e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x045e('0x2'));var moment=require(_0x045e('0x3'));var BPromise=require(_0x045e('0x4'));var Mustache=require(_0x045e('0x5'));var util=require(_0x045e('0x6'));var path=require(_0x045e('0x7'));var sox=require('sox');var csv=require(_0x045e('0x8'));var ejs=require(_0x045e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x045e('0xa'));var squel=require('squel');var crypto=require(_0x045e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x045e('0xc'));var toCsv=require(_0x045e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x045e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x045e('0xe'));var hardwareService=require(_0x045e('0xf'));var logger=require(_0x045e('0x10'))(_0x045e('0x11'));var utils=require(_0x045e('0x12'));var config=require(_0x045e('0x13'));var licenseUtil=require(_0x045e('0x14'));var db=require(_0x045e('0x15'))['db'];var integrations=require(_0x045e('0x16'));function respondWithStatusCode(_0x4b3ba5,_0x289402){_0x289402=_0x289402||0xcc;return function(_0x183da2){if(_0x183da2){return _0x4b3ba5[_0x045e('0x17')](_0x289402);}return _0x4b3ba5[_0x045e('0x18')](_0x289402)[_0x045e('0x19')]();};}function respondWithResult(_0x45659f,_0x184d32){_0x184d32=_0x184d32||0xc8;return function(_0xd7ef08){if(_0xd7ef08){return _0x45659f[_0x045e('0x18')](_0x184d32)[_0x045e('0x1a')](_0xd7ef08);}};}function respondWithFilteredResult(_0x364a84,_0x1fee23){return function(_0x464566){if(_0x464566){var _0x4e83e4=typeof _0x1fee23[_0x045e('0x1b')]===_0x045e('0x1c')&&typeof _0x1fee23[_0x045e('0x1d')]===_0x045e('0x1c');var _0x1da512=_0x464566[_0x045e('0x1e')];var _0x261b0a=_0x4e83e4?0x0:_0x1fee23['offset'];var _0xd0b2fc=_0x4e83e4?_0x464566['count']:_0x1fee23[_0x045e('0x1b')]+_0x1fee23['limit'];var _0xbc0367;if(_0xd0b2fc>=_0x1da512){_0xd0b2fc=_0x1da512;_0xbc0367=0xc8;}else{_0xbc0367=0xce;}_0x364a84[_0x045e('0x18')](_0xbc0367);return _0x364a84[_0x045e('0x1f')](_0x045e('0x20'),_0x261b0a+'-'+_0xd0b2fc+'/'+_0x1da512)[_0x045e('0x1a')](_0x464566);}return null;};}function patchUpdates(_0x46f81f){return function(_0x3871fb){try{jsonpatch[_0x045e('0x21')](_0x3871fb,_0x46f81f,!![]);}catch(_0x17ee3f){return BPromise[_0x045e('0x22')](_0x17ee3f);}return _0x3871fb[_0x045e('0x23')]();};}function saveUpdates(_0xfbb673,_0x410554){return function(_0x3ff3da){if(_0x3ff3da){return _0x3ff3da[_0x045e('0x24')](_0xfbb673)['then'](function(_0x435344){return _0x435344;});}return null;};}function removeEntity(_0x3cd017,_0x38ce62){return function(_0x3296ca){if(_0x3296ca){return _0x3296ca['destroy']()[_0x045e('0x25')](function(){_0x3cd017['status'](0xcc)[_0x045e('0x19')]();});}};}function handleEntityNotFound(_0x5d9286,_0x74510){return function(_0x33248b){if(!_0x33248b){_0x5d9286['sendStatus'](0x194);}return _0x33248b;};}function handleError(_0x38993c,_0x14931f){_0x14931f=_0x14931f||0x1f4;return function(_0x3c528f){logger[_0x045e('0x26')](_0x3c528f[_0x045e('0x27')]);if(_0x3c528f[_0x045e('0x28')]){delete _0x3c528f[_0x045e('0x28')];}_0x38993c[_0x045e('0x18')](_0x14931f)[_0x045e('0x29')](_0x3c528f);};}exports['index']=function(_0x26527c,_0x1df786){var _0x19a2f6={},_0x1e4bcd={},_0x58e2ad={'count':0x0,'rows':[]};var _0x2d59b8=_[_0x045e('0x2a')](db['SalesforceAccount']['rawAttributes'],function(_0x1d8bb5){return{'name':_0x1d8bb5['fieldName'],'type':_0x1d8bb5[_0x045e('0x2b')][_0x045e('0x2c')]};});_0x1e4bcd[_0x045e('0x2d')]=_[_0x045e('0x2a')](_0x2d59b8,'name');_0x1e4bcd[_0x045e('0x2e')]=_[_0x045e('0x2f')](_0x26527c['query']);_0x1e4bcd['filters']=_[_0x045e('0x30')](_0x1e4bcd[_0x045e('0x2d')],_0x1e4bcd['query']);_0x19a2f6[_0x045e('0x31')]=_[_0x045e('0x30')](_0x1e4bcd['model'],qs['fields'](_0x26527c[_0x045e('0x2e')][_0x045e('0x32')]));_0x19a2f6[_0x045e('0x31')]=_0x19a2f6[_0x045e('0x31')][_0x045e('0x33')]?_0x19a2f6[_0x045e('0x31')]:_0x1e4bcd[_0x045e('0x2d')];if(!_0x26527c[_0x045e('0x2e')][_0x045e('0x34')](_0x045e('0x35'))){_0x19a2f6[_0x045e('0x1d')]=qs[_0x045e('0x1d')](_0x26527c[_0x045e('0x2e')]['limit']);_0x19a2f6['offset']=qs[_0x045e('0x1b')](_0x26527c[_0x045e('0x2e')][_0x045e('0x1b')]);}_0x19a2f6[_0x045e('0x36')]=qs['sort'](_0x26527c[_0x045e('0x2e')]['sort']);_0x19a2f6[_0x045e('0x37')]=qs[_0x045e('0x38')](_[_0x045e('0x39')](_0x26527c['query'],_0x1e4bcd[_0x045e('0x38')]),_0x2d59b8);if(_0x26527c[_0x045e('0x2e')]['filter']){_0x19a2f6[_0x045e('0x37')]=_['merge'](_0x19a2f6[_0x045e('0x37')],{'$or':_['map'](_0x2d59b8,function(_0x34cbf3){if(_0x34cbf3['type']!==_0x045e('0x3a')){var _0xaec887={};_0xaec887[_0x34cbf3[_0x045e('0x28')]]={'$like':'%'+_0x26527c[_0x045e('0x2e')][_0x045e('0x3b')]+'%'};return _0xaec887;}})});}_0x19a2f6=_['merge']({},_0x19a2f6,_0x26527c[_0x045e('0x3c')]);var _0x129a4f={'where':_0x19a2f6[_0x045e('0x37')]};return db[_0x045e('0x3d')][_0x045e('0x1e')](_0x129a4f)[_0x045e('0x25')](function(_0x1e8172){_0x58e2ad[_0x045e('0x1e')]=_0x1e8172;if(_0x26527c[_0x045e('0x2e')]['includeAll']){_0x19a2f6[_0x045e('0x3e')]=[{'all':!![]}];}return db[_0x045e('0x3d')]['findAll'](_0x19a2f6);})[_0x045e('0x25')](function(_0x19b4e0){_0x58e2ad[_0x045e('0x3f')]=_0x19b4e0;return _0x58e2ad;})[_0x045e('0x25')](respondWithFilteredResult(_0x1df786,_0x19a2f6))[_0x045e('0x40')](handleError(_0x1df786,null));};exports['show']=function(_0x34cc6f,_0x4e2a8e){var _0x2169f5={'raw':![],'where':{'id':_0x34cc6f[_0x045e('0x41')]['id']}},_0xdfdb62={};_0xdfdb62[_0x045e('0x2d')]=_[_0x045e('0x2f')](db[_0x045e('0x3d')]['rawAttributes']);_0xdfdb62['query']=_[_0x045e('0x2f')](_0x34cc6f[_0x045e('0x2e')]);_0xdfdb62[_0x045e('0x38')]=_[_0x045e('0x30')](_0xdfdb62[_0x045e('0x2d')],_0xdfdb62[_0x045e('0x2e')]);_0x2169f5[_0x045e('0x31')]=_[_0x045e('0x30')](_0xdfdb62[_0x045e('0x2d')],qs[_0x045e('0x32')](_0x34cc6f[_0x045e('0x2e')][_0x045e('0x32')]));_0x2169f5[_0x045e('0x31')]=_0x2169f5[_0x045e('0x31')][_0x045e('0x33')]?_0x2169f5['attributes']:_0xdfdb62[_0x045e('0x2d')];if(_0x34cc6f[_0x045e('0x2e')][_0x045e('0x42')]){_0x2169f5[_0x045e('0x3e')]=[{'all':!![]}];}_0x2169f5=_[_0x045e('0x43')]({},_0x2169f5,_0x34cc6f[_0x045e('0x3c')]);return db[_0x045e('0x3d')][_0x045e('0x44')](_0x2169f5)[_0x045e('0x25')](handleEntityNotFound(_0x4e2a8e,null))['then'](respondWithResult(_0x4e2a8e,null))[_0x045e('0x40')](handleError(_0x4e2a8e,null));};exports[_0x045e('0x45')]=function(_0x17da22,_0xb62582){return db['SalesforceAccount'][_0x045e('0x45')](_0x17da22[_0x045e('0x46')],{})[_0x045e('0x25')](respondWithResult(_0xb62582,0xc9))[_0x045e('0x40')](handleError(_0xb62582,null));};exports[_0x045e('0x24')]=function(_0x44ce0f,_0xe8cb10){if(_0x44ce0f['body']['id']){delete _0x44ce0f['body']['id'];}return db['SalesforceAccount'][_0x045e('0x44')]({'where':{'id':_0x44ce0f['params']['id']}})[_0x045e('0x25')](handleEntityNotFound(_0xe8cb10,null))[_0x045e('0x25')](saveUpdates(_0x44ce0f[_0x045e('0x46')],null))[_0x045e('0x25')](respondWithResult(_0xe8cb10,null))['catch'](handleError(_0xe8cb10,null));};exports[_0x045e('0x47')]=function(_0x5719c5,_0x1ff8bc){return db['SalesforceAccount']['find']({'where':{'id':_0x5719c5['params']['id']}})[_0x045e('0x25')](handleEntityNotFound(_0x1ff8bc,null))[_0x045e('0x25')](removeEntity(_0x1ff8bc,null))[_0x045e('0x40')](handleError(_0x1ff8bc,null));};exports[_0x045e('0x48')]=function(_0x2faed3,_0x459aa1,_0x1beaaa){var _0x1fd9a1={};var _0x386abf={};var _0x2fa9f1;var _0x2c3941;return db[_0x045e('0x3d')][_0x045e('0x49')]({'where':{'id':_0x2faed3[_0x045e('0x41')]['id']}})['then'](handleEntityNotFound(_0x459aa1,null))[_0x045e('0x25')](function(_0xc75a98){if(_0xc75a98){_0x2fa9f1=_0xc75a98;_0x386abf[_0x045e('0x2d')]=_[_0x045e('0x2f')](db[_0x045e('0x4a')][_0x045e('0x4b')]);_0x386abf[_0x045e('0x2e')]=_[_0x045e('0x2f')](_0x2faed3[_0x045e('0x2e')]);_0x386abf[_0x045e('0x38')]=_[_0x045e('0x30')](_0x386abf[_0x045e('0x2d')],_0x386abf['query']);_0x1fd9a1['attributes']=_[_0x045e('0x30')](_0x386abf[_0x045e('0x2d')],qs['fields'](_0x2faed3[_0x045e('0x2e')][_0x045e('0x32')]));_0x1fd9a1[_0x045e('0x31')]=_0x1fd9a1['attributes'][_0x045e('0x33')]?_0x1fd9a1[_0x045e('0x31')]:_0x386abf[_0x045e('0x2d')];_0x1fd9a1['order']=qs[_0x045e('0x4c')](_0x2faed3[_0x045e('0x2e')][_0x045e('0x4c')]);_0x1fd9a1[_0x045e('0x37')]=qs[_0x045e('0x38')](_[_0x045e('0x39')](_0x2faed3[_0x045e('0x2e')],_0x386abf[_0x045e('0x38')]));if(_0x2faed3['query']['filter']){_0x1fd9a1[_0x045e('0x37')]=_['merge'](_0x1fd9a1[_0x045e('0x37')],{'$or':_[_0x045e('0x2a')](_0x1fd9a1['attributes'],function(_0x5d7ac7){var _0x2111b0={};_0x2111b0[_0x5d7ac7]={'$like':'%'+_0x2faed3[_0x045e('0x2e')][_0x045e('0x3b')]+'%'};return _0x2111b0;})});}_0x1fd9a1=_[_0x045e('0x43')]({},_0x1fd9a1,_0x2faed3['options']);return _0x2fa9f1[_0x045e('0x48')](_0x1fd9a1);}})[_0x045e('0x25')](function(_0x28a861){if(_0x28a861){_0x2c3941=_0x28a861[_0x045e('0x33')];if(!_0x2faed3[_0x045e('0x2e')][_0x045e('0x34')]('nolimit')){_0x1fd9a1['limit']=qs['limit'](_0x2faed3[_0x045e('0x2e')]['limit']);_0x1fd9a1['offset']=qs[_0x045e('0x1b')](_0x2faed3[_0x045e('0x2e')]['offset']);}return _0x2fa9f1['getConfigurations'](_0x1fd9a1);}})['then'](function(_0x3576b2){if(_0x3576b2){return _0x3576b2?{'count':_0x2c3941,'rows':_0x3576b2}:null;}})[_0x045e('0x25')](respondWithResult(_0x459aa1,null))[_0x045e('0x40')](handleError(_0x459aa1,null));};exports[_0x045e('0x4d')]=function(_0xaa2ade,_0x3514eb,_0x3caf71){if(_0xaa2ade[_0x045e('0x46')]['id']){delete _0xaa2ade[_0x045e('0x46')]['id'];}return db['SalesforceAccount'][_0x045e('0x49')]({'where':{'id':_0xaa2ade[_0x045e('0x41')]['id']}})[_0x045e('0x25')](handleEntityNotFound(_0x3514eb,null))[_0x045e('0x25')](function(_0x5a7279){if(_0x5a7279){_0xaa2ade[_0x045e('0x46')]['AccountId']=_0x5a7279['id'];_0xaa2ade[_0x045e('0x46')][_0x045e('0x4e')]=integrations['getSubjects'](_0xaa2ade[_0x045e('0x46')][_0x045e('0x4f')],_0xaa2ade['body'][_0x045e('0x2b')]);_0xaa2ade[_0x045e('0x46')][_0x045e('0x50')]=integrations['getDescriptions'](_0xaa2ade[_0x045e('0x46')][_0x045e('0x4f')],_0xaa2ade[_0x045e('0x46')][_0x045e('0x2b')]);return db[_0x045e('0x4a')]['create'](_0xaa2ade[_0x045e('0x46')],{'include':[{'model':db[_0x045e('0x51')],'as':_0x045e('0x4e')},{'model':db[_0x045e('0x51')],'as':_0x045e('0x50')}]});}return null;})[_0x045e('0x25')](respondWithResult(_0x3514eb,null))[_0x045e('0x40')](handleError(_0x3514eb,null));};exports[_0x045e('0x52')]=function(_0x35d469,_0x958e51,_0x323353){var _0x435c10;var _0x44314b='';var _0x1b91b0=_0x045e('0x53');return db[_0x045e('0x3d')][_0x045e('0x49')]({'where':{'id':_0x35d469[_0x045e('0x41')]['id']},'attributes':['id',_0x045e('0x54'),_0x045e('0x55'),'clientSecret','username',_0x045e('0x56'),_0x045e('0x57')]})[_0x045e('0x25')](handleEntityNotFound(_0x958e51,null))[_0x045e('0x25')](function(_0x2a6e3f){if(_0x2a6e3f){_0x44314b=_0x2a6e3f[_0x045e('0x54')];var _0x9dfcfa=_0x44314b['slice'](-0x1);if(_0x9dfcfa==='/'){_0x44314b=_0x44314b[_0x045e('0x58')](0x0,_0x44314b[_0x045e('0x59')](_0x9dfcfa));}_0x435c10=new jsforce[(_0x045e('0x5a'))]({'oauth2':{'loginUrl':_0x44314b,'clientId':_0x2a6e3f['clientId'],'clientSecret':_0x2a6e3f[_0x045e('0x5b')]}});return _0x435c10[_0x045e('0x5c')](_0x2a6e3f[_0x045e('0x5d')],_0x2a6e3f[_0x045e('0x56')][_0x045e('0x5e')](_0x2a6e3f[_0x045e('0x57')]));}})['then'](function(_0x5087df){if(_0x5087df){if(!_[_0x045e('0x5f')](_0x35d469['query'][_0x045e('0x60')])){_0x1b91b0=_0x35d469[_0x045e('0x2e')][_0x045e('0x60')];}return _0x435c10[_0x045e('0x61')](_0x1b91b0)[_0x045e('0x62')]();}})[_0x045e('0x25')](function(_0x1375e5){var _0x1366bd=[_0x045e('0x63'),_0x045e('0x64'),_0x045e('0x65'),_0x045e('0x66'),_0x045e('0x67'),_0x045e('0x68')];var _0x20b2aa=[_0x045e('0x69'),_0x045e('0x6a'),_0x045e('0x6b'),'boolean',_0x045e('0x6c'),'textarea','phone'];if(_0x1375e5){_['remove'](_0x1375e5[_0x045e('0x32')],function(_0x59c38a){return _0x1366bd[_0x045e('0x6d')](_0x59c38a['name'])||!_0x20b2aa[_0x045e('0x6d')](_0x59c38a['type']);});return{'count':_0x1375e5[_0x045e('0x32')][_0x045e('0x33')],'rows':_[_0x045e('0x2a')](_0x1375e5[_0x045e('0x32')],function(_0x5810ea){return{'id':_0x5810ea[_0x045e('0x28')],'name':_0x5810ea['label'],'custom':_0x5810ea[_0x045e('0x6e')],'options':_0x5810ea[_0x045e('0x6f')][_0x045e('0x33')]>0x0?_[_0x045e('0x2a')](_0x5810ea[_0x045e('0x6f')],function(_0x1e9311){return{'name':_0x1e9311[_0x045e('0x70')],'value':_0x1e9311['value']};}):_0x5810ea['type']==_0x045e('0x71')?[{'name':'True','value':_0x045e('0x72')},{'name':_0x045e('0x73'),'value':_0x045e('0x74')}]:[]};})};}})[_0x045e('0x25')](respondWithResult(_0x958e51,null))[_0x045e('0x40')](function(_0x2ffdeb){var _0x53380b=_0x35d469[_0x045e('0x2e')][_0x045e('0x75')]?0x1f4:_0x2ffdeb[_0x045e('0x76')]||0x1f4;logger[_0x045e('0x26')](_0x045e('0x77'),_0x045e('0x52'),_0x53380b,JSON[_0x045e('0x78')](_0x2ffdeb));delete _0x2ffdeb['name'];if(_0x53380b===0x191){_0x53380b=0x190;}_0x958e51['status'](_0x53380b)['send'](_0x35d469[_0x045e('0x2e')]['test']?{'message':_0x045e('0x79'),'statusCode':_0x2ffdeb[_0x045e('0x76')]}:_0x2ffdeb);});}; \ No newline at end of file +var _0x70f2=['includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','getConfigurations','findOne','SalesforceConfiguration','filter','AccountId','getSubjects','channel','SalesforceField','Subjects','Descriptions','getFields','Task','remoteUri','clientSecret','password','securityToken','Connection','clientId','username','concat','isNil','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','includes','custom','picklistValues','label','value','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','SalesforceAccount','then'];(function(_0x4b2a5c,_0x29b5eb){var _0xed6e3c=function(_0x476514){while(--_0x476514){_0x4b2a5c['push'](_0x4b2a5c['shift']());}};_0xed6e3c(++_0x29b5eb);}(_0x70f2,0xb1));var _0x270f=function(_0x4157cd,_0x587a21){_0x4157cd=_0x4157cd-0x0;var _0x214363=_0x70f2[_0x4157cd];return _0x214363;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x270f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x270f('0x1'));var moment=require('moment');var BPromise=require(_0x270f('0x2'));var Mustache=require(_0x270f('0x3'));var util=require('util');var path=require(_0x270f('0x4'));var sox=require(_0x270f('0x5'));var csv=require(_0x270f('0x6'));var ejs=require(_0x270f('0x7'));var fs=require('fs');var fs_extra=require(_0x270f('0x8'));var _=require('lodash');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(_0x270f('0x9'));var Papa=require(_0x270f('0xa'));var Redis=require('ioredis');var authService=require(_0x270f('0xb'));var qs=require(_0x270f('0xc'));var as=require(_0x270f('0xd'));var hardwareService=require(_0x270f('0xe'));var logger=require('../../config/logger')(_0x270f('0xf'));var utils=require(_0x270f('0x10'));var config=require(_0x270f('0x11'));var licenseUtil=require(_0x270f('0x12'));var db=require(_0x270f('0x13'))['db'];var integrations=require(_0x270f('0x14'));function respondWithStatusCode(_0x401ed7,_0x39b2bc){_0x39b2bc=_0x39b2bc||0xcc;return function(_0xab11b2){if(_0xab11b2){return _0x401ed7[_0x270f('0x15')](_0x39b2bc);}return _0x401ed7[_0x270f('0x16')](_0x39b2bc)[_0x270f('0x17')]();};}function respondWithResult(_0x36115b,_0x3c055d){_0x3c055d=_0x3c055d||0xc8;return function(_0x5ee017){if(_0x5ee017){return _0x36115b[_0x270f('0x16')](_0x3c055d)[_0x270f('0x18')](_0x5ee017);}};}function respondWithFilteredResult(_0x282e88,_0x1608f5){return function(_0x2f5601){if(_0x2f5601){var _0x5b04de=typeof _0x1608f5[_0x270f('0x19')]===_0x270f('0x1a')&&typeof _0x1608f5[_0x270f('0x1b')]==='undefined';var _0x443cce=_0x2f5601[_0x270f('0x1c')];var _0x4761c5=_0x5b04de?0x0:_0x1608f5[_0x270f('0x19')];var _0x790529=_0x5b04de?_0x2f5601[_0x270f('0x1c')]:_0x1608f5[_0x270f('0x19')]+_0x1608f5[_0x270f('0x1b')];var _0x1091a1;if(_0x790529>=_0x443cce){_0x790529=_0x443cce;_0x1091a1=0xc8;}else{_0x1091a1=0xce;}_0x282e88[_0x270f('0x16')](_0x1091a1);return _0x282e88[_0x270f('0x1d')]('Content-Range',_0x4761c5+'-'+_0x790529+'/'+_0x443cce)[_0x270f('0x18')](_0x2f5601);}return null;};}function patchUpdates(_0x158b3e){return function(_0x2280dc){try{jsonpatch['apply'](_0x2280dc,_0x158b3e,!![]);}catch(_0x16449b){return BPromise[_0x270f('0x1e')](_0x16449b);}return _0x2280dc[_0x270f('0x1f')]();};}function saveUpdates(_0xb2f41,_0x7d9e7d){return function(_0x39ab39){if(_0x39ab39){return _0x39ab39[_0x270f('0x20')](_0xb2f41)['then'](function(_0x3ef96e){return _0x3ef96e;});}return null;};}function removeEntity(_0x2c72d2,_0x2b9bdf){return function(_0x50f766){if(_0x50f766){return _0x50f766['destroy']()['then'](function(){_0x2c72d2[_0x270f('0x16')](0xcc)[_0x270f('0x17')]();});}};}function handleEntityNotFound(_0x4cfa57,_0x3fc489){return function(_0x39fd42){if(!_0x39fd42){_0x4cfa57[_0x270f('0x15')](0x194);}return _0x39fd42;};}function handleError(_0x2fe3af,_0x332304){_0x332304=_0x332304||0x1f4;return function(_0x4f343d){logger[_0x270f('0x21')](_0x4f343d['stack']);if(_0x4f343d[_0x270f('0x22')]){delete _0x4f343d[_0x270f('0x22')];}_0x2fe3af['status'](_0x332304)[_0x270f('0x23')](_0x4f343d);};}exports[_0x270f('0x24')]=function(_0x1442a3,_0x202cf0){var _0x41ad81={},_0x537573={},_0x132130={'count':0x0,'rows':[]};var _0x4fd90f=_[_0x270f('0x25')](db['SalesforceAccount']['rawAttributes'],function(_0x1898d6){return{'name':_0x1898d6[_0x270f('0x26')],'type':_0x1898d6[_0x270f('0x27')][_0x270f('0x28')]};});_0x537573[_0x270f('0x29')]=_[_0x270f('0x25')](_0x4fd90f,_0x270f('0x22'));_0x537573[_0x270f('0x2a')]=_[_0x270f('0x2b')](_0x1442a3[_0x270f('0x2a')]);_0x537573[_0x270f('0x2c')]=_[_0x270f('0x2d')](_0x537573['model'],_0x537573[_0x270f('0x2a')]);_0x41ad81[_0x270f('0x2e')]=_[_0x270f('0x2d')](_0x537573[_0x270f('0x29')],qs[_0x270f('0x2f')](_0x1442a3[_0x270f('0x2a')][_0x270f('0x2f')]));_0x41ad81[_0x270f('0x2e')]=_0x41ad81[_0x270f('0x2e')][_0x270f('0x30')]?_0x41ad81['attributes']:_0x537573[_0x270f('0x29')];if(!_0x1442a3[_0x270f('0x2a')][_0x270f('0x31')](_0x270f('0x32'))){_0x41ad81[_0x270f('0x1b')]=qs[_0x270f('0x1b')](_0x1442a3[_0x270f('0x2a')][_0x270f('0x1b')]);_0x41ad81[_0x270f('0x19')]=qs['offset'](_0x1442a3['query'][_0x270f('0x19')]);}_0x41ad81[_0x270f('0x33')]=qs[_0x270f('0x34')](_0x1442a3['query'][_0x270f('0x34')]);_0x41ad81[_0x270f('0x35')]=qs[_0x270f('0x2c')](_[_0x270f('0x36')](_0x1442a3[_0x270f('0x2a')],_0x537573[_0x270f('0x2c')]),_0x4fd90f);if(_0x1442a3['query']['filter']){_0x41ad81[_0x270f('0x35')]=_[_0x270f('0x37')](_0x41ad81['where'],{'$or':_[_0x270f('0x25')](_0x4fd90f,function(_0x17f2f1){if(_0x17f2f1[_0x270f('0x27')]!=='VIRTUAL'){var _0x29278a={};_0x29278a[_0x17f2f1[_0x270f('0x22')]]={'$like':'%'+_0x1442a3['query']['filter']+'%'};return _0x29278a;}})});}_0x41ad81=_['merge']({},_0x41ad81,_0x1442a3[_0x270f('0x38')]);var _0x488c0f={'where':_0x41ad81['where']};return db[_0x270f('0x39')]['count'](_0x488c0f)[_0x270f('0x3a')](function(_0x2e5e86){_0x132130[_0x270f('0x1c')]=_0x2e5e86;if(_0x1442a3['query'][_0x270f('0x3b')]){_0x41ad81[_0x270f('0x3c')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x270f('0x3d')](_0x41ad81);})[_0x270f('0x3a')](function(_0xeda4b5){_0x132130['rows']=_0xeda4b5;return _0x132130;})[_0x270f('0x3a')](respondWithFilteredResult(_0x202cf0,_0x41ad81))[_0x270f('0x3e')](handleError(_0x202cf0,null));};exports[_0x270f('0x3f')]=function(_0x50d8bf,_0x443afc){var _0x452a8a={'raw':![],'where':{'id':_0x50d8bf[_0x270f('0x40')]['id']}},_0x4219c4={};_0x4219c4[_0x270f('0x29')]=_[_0x270f('0x2b')](db['SalesforceAccount'][_0x270f('0x41')]);_0x4219c4[_0x270f('0x2a')]=_[_0x270f('0x2b')](_0x50d8bf['query']);_0x4219c4[_0x270f('0x2c')]=_['intersection'](_0x4219c4[_0x270f('0x29')],_0x4219c4[_0x270f('0x2a')]);_0x452a8a[_0x270f('0x2e')]=_[_0x270f('0x2d')](_0x4219c4[_0x270f('0x29')],qs[_0x270f('0x2f')](_0x50d8bf[_0x270f('0x2a')][_0x270f('0x2f')]));_0x452a8a[_0x270f('0x2e')]=_0x452a8a['attributes'][_0x270f('0x30')]?_0x452a8a[_0x270f('0x2e')]:_0x4219c4[_0x270f('0x29')];if(_0x50d8bf['query'][_0x270f('0x3b')]){_0x452a8a[_0x270f('0x3c')]=[{'all':!![]}];}_0x452a8a=_['merge']({},_0x452a8a,_0x50d8bf['options']);return db[_0x270f('0x39')]['find'](_0x452a8a)[_0x270f('0x3a')](handleEntityNotFound(_0x443afc,null))[_0x270f('0x3a')](respondWithResult(_0x443afc,null))['catch'](handleError(_0x443afc,null));};exports[_0x270f('0x42')]=function(_0x2250dd,_0x2e8648){return db[_0x270f('0x39')][_0x270f('0x42')](_0x2250dd[_0x270f('0x43')],{})[_0x270f('0x3a')](respondWithResult(_0x2e8648,0xc9))[_0x270f('0x3e')](handleError(_0x2e8648,null));};exports['update']=function(_0xbb2c3f,_0x251861){if(_0xbb2c3f[_0x270f('0x43')]['id']){delete _0xbb2c3f[_0x270f('0x43')]['id'];}return db[_0x270f('0x39')][_0x270f('0x44')]({'where':{'id':_0xbb2c3f[_0x270f('0x40')]['id']}})[_0x270f('0x3a')](handleEntityNotFound(_0x251861,null))[_0x270f('0x3a')](saveUpdates(_0xbb2c3f[_0x270f('0x43')],null))[_0x270f('0x3a')](respondWithResult(_0x251861,null))[_0x270f('0x3e')](handleError(_0x251861,null));};exports[_0x270f('0x45')]=function(_0x671328,_0x221ea2){return db[_0x270f('0x39')]['find']({'where':{'id':_0x671328[_0x270f('0x40')]['id']}})[_0x270f('0x3a')](handleEntityNotFound(_0x221ea2,null))['then'](removeEntity(_0x221ea2,null))[_0x270f('0x3e')](handleError(_0x221ea2,null));};exports[_0x270f('0x46')]=function(_0x5d6cb0,_0x209794,_0x436b3d){var _0x29ed20={};var _0xc5a455={};var _0xb2f698;var _0x4d840e;return db[_0x270f('0x39')][_0x270f('0x47')]({'where':{'id':_0x5d6cb0[_0x270f('0x40')]['id']}})[_0x270f('0x3a')](handleEntityNotFound(_0x209794,null))[_0x270f('0x3a')](function(_0x396284){if(_0x396284){_0xb2f698=_0x396284;_0xc5a455[_0x270f('0x29')]=_[_0x270f('0x2b')](db[_0x270f('0x48')][_0x270f('0x41')]);_0xc5a455['query']=_[_0x270f('0x2b')](_0x5d6cb0[_0x270f('0x2a')]);_0xc5a455[_0x270f('0x2c')]=_[_0x270f('0x2d')](_0xc5a455[_0x270f('0x29')],_0xc5a455['query']);_0x29ed20[_0x270f('0x2e')]=_[_0x270f('0x2d')](_0xc5a455[_0x270f('0x29')],qs['fields'](_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x2f')]));_0x29ed20['attributes']=_0x29ed20[_0x270f('0x2e')][_0x270f('0x30')]?_0x29ed20[_0x270f('0x2e')]:_0xc5a455[_0x270f('0x29')];_0x29ed20[_0x270f('0x33')]=qs['sort'](_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x34')]);_0x29ed20[_0x270f('0x35')]=qs['filters'](_[_0x270f('0x36')](_0x5d6cb0[_0x270f('0x2a')],_0xc5a455[_0x270f('0x2c')]));if(_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x49')]){_0x29ed20[_0x270f('0x35')]=_[_0x270f('0x37')](_0x29ed20['where'],{'$or':_['map'](_0x29ed20[_0x270f('0x2e')],function(_0x1e8e95){var _0x3e427a={};_0x3e427a[_0x1e8e95]={'$like':'%'+_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x49')]+'%'};return _0x3e427a;})});}_0x29ed20=_[_0x270f('0x37')]({},_0x29ed20,_0x5d6cb0[_0x270f('0x38')]);return _0xb2f698[_0x270f('0x46')](_0x29ed20);}})[_0x270f('0x3a')](function(_0x42a982){if(_0x42a982){_0x4d840e=_0x42a982[_0x270f('0x30')];if(!_0x5d6cb0[_0x270f('0x2a')]['hasOwnProperty']('nolimit')){_0x29ed20[_0x270f('0x1b')]=qs[_0x270f('0x1b')](_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x1b')]);_0x29ed20[_0x270f('0x19')]=qs[_0x270f('0x19')](_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x19')]);}return _0xb2f698[_0x270f('0x46')](_0x29ed20);}})[_0x270f('0x3a')](function(_0x380137){if(_0x380137){return _0x380137?{'count':_0x4d840e,'rows':_0x380137}:null;}})[_0x270f('0x3a')](respondWithResult(_0x209794,null))['catch'](handleError(_0x209794,null));};exports['addConfiguration']=function(_0x41b1bb,_0x202caf,_0x1abedf){if(_0x41b1bb[_0x270f('0x43')]['id']){delete _0x41b1bb[_0x270f('0x43')]['id'];}return db[_0x270f('0x39')][_0x270f('0x47')]({'where':{'id':_0x41b1bb[_0x270f('0x40')]['id']}})[_0x270f('0x3a')](handleEntityNotFound(_0x202caf,null))['then'](function(_0x10841b){if(_0x10841b){_0x41b1bb[_0x270f('0x43')][_0x270f('0x4a')]=_0x10841b['id'];_0x41b1bb[_0x270f('0x43')]['Subjects']=integrations[_0x270f('0x4b')](_0x41b1bb['body'][_0x270f('0x4c')],_0x41b1bb[_0x270f('0x43')][_0x270f('0x27')]);_0x41b1bb['body']['Descriptions']=integrations['getDescriptions'](_0x41b1bb['body'][_0x270f('0x4c')],_0x41b1bb[_0x270f('0x43')][_0x270f('0x27')]);return db['SalesforceConfiguration'][_0x270f('0x42')](_0x41b1bb[_0x270f('0x43')],{'include':[{'model':db[_0x270f('0x4d')],'as':_0x270f('0x4e')},{'model':db[_0x270f('0x4d')],'as':_0x270f('0x4f')}]});}return null;})[_0x270f('0x3a')](respondWithResult(_0x202caf,null))['catch'](handleError(_0x202caf,null));};exports[_0x270f('0x50')]=function(_0x37eaf5,_0x487e11,_0x3ef64f){var _0x1359c2;var _0x42828e='';var _0x25c6e9=_0x270f('0x51');return db[_0x270f('0x39')][_0x270f('0x47')]({'where':{'id':_0x37eaf5[_0x270f('0x40')]['id']},'attributes':['id',_0x270f('0x52'),'clientId',_0x270f('0x53'),'username',_0x270f('0x54'),_0x270f('0x55')]})[_0x270f('0x3a')](handleEntityNotFound(_0x487e11,null))[_0x270f('0x3a')](function(_0x39a28f){if(_0x39a28f){_0x42828e=_0x39a28f[_0x270f('0x52')];var _0x1df22c=_0x42828e['slice'](-0x1);if(_0x1df22c==='/'){_0x42828e=_0x42828e['substring'](0x0,_0x42828e['lastIndexOf'](_0x1df22c));}_0x1359c2=new jsforce[(_0x270f('0x56'))]({'oauth2':{'loginUrl':_0x42828e,'clientId':_0x39a28f[_0x270f('0x57')],'clientSecret':_0x39a28f['clientSecret']}});return _0x1359c2['login'](_0x39a28f[_0x270f('0x58')],_0x39a28f[_0x270f('0x54')][_0x270f('0x59')](_0x39a28f[_0x270f('0x55')]));}})[_0x270f('0x3a')](function(_0x5e24d0){if(_0x5e24d0){if(!_[_0x270f('0x5a')](_0x37eaf5[_0x270f('0x2a')]['ticketType'])){_0x25c6e9=_0x37eaf5[_0x270f('0x2a')]['ticketType'];}return _0x1359c2[_0x270f('0x5b')](_0x25c6e9)[_0x270f('0x5c')]();}})[_0x270f('0x3a')](function(_0x38a62e){var _0xeddc39=[_0x270f('0x5d'),_0x270f('0x5e'),_0x270f('0x5f'),_0x270f('0x60'),_0x270f('0x61'),_0x270f('0x62')];var _0x37cd37=[_0x270f('0x63'),'int',_0x270f('0x64'),_0x270f('0x65'),_0x270f('0x66'),_0x270f('0x67'),_0x270f('0x68')];if(_0x38a62e){_['remove'](_0x38a62e[_0x270f('0x2f')],function(_0x49f5b4){return _0xeddc39['includes'](_0x49f5b4['name'])||!_0x37cd37[_0x270f('0x69')](_0x49f5b4[_0x270f('0x27')]);});return{'count':_0x38a62e['fields'][_0x270f('0x30')],'rows':_[_0x270f('0x25')](_0x38a62e[_0x270f('0x2f')],function(_0xbca6ba){return{'id':_0xbca6ba[_0x270f('0x22')],'name':_0xbca6ba['label'],'custom':_0xbca6ba[_0x270f('0x6a')],'options':_0xbca6ba[_0x270f('0x6b')]['length']>0x0?_[_0x270f('0x25')](_0xbca6ba['picklistValues'],function(_0x326d5e){return{'name':_0x326d5e[_0x270f('0x6c')],'value':_0x326d5e[_0x270f('0x6d')]};}):_0xbca6ba[_0x270f('0x27')]==_0x270f('0x65')?[{'name':_0x270f('0x6e'),'value':_0x270f('0x6f')},{'name':'False','value':_0x270f('0x70')}]:[]};})};}})['then'](respondWithResult(_0x487e11,null))[_0x270f('0x3e')](function(_0x2cff08){var _0x11787f=_0x37eaf5['query'][_0x270f('0x71')]?0x1f4:_0x2cff08[_0x270f('0x72')]||0x1f4;logger[_0x270f('0x21')](_0x270f('0x73'),_0x270f('0x50'),_0x11787f,JSON[_0x270f('0x74')](_0x2cff08));delete _0x2cff08[_0x270f('0x22')];if(_0x11787f===0x191){_0x11787f=0x190;}_0x487e11[_0x270f('0x16')](_0x11787f)[_0x270f('0x23')](_0x37eaf5[_0x270f('0x2a')][_0x270f('0x71')]?{'message':_0x270f('0x75'),'statusCode':_0x2cff08['statusCode']}:_0x2cff08);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3ab5841..4d85a98 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 _0xd3ed=['exports','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0xd3ed,0xf4));var _0xdd3e=function(_0x1cde8b,_0x17f30f){_0x1cde8b=_0x1cde8b-0x0;var _0x3f87a8=_0xd3ed[_0x1cde8b];return _0x3f87a8;};'use strict';var _=require('lodash');var util=require(_0xdd3e('0x0'));var logger=require(_0xdd3e('0x1'))(_0xdd3e('0x2'));var moment=require(_0xdd3e('0x3'));var BPromise=require(_0xdd3e('0x4'));var rp=require(_0xdd3e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd3e('0x6'));var config=require('../../config/environment');var attributes=require(_0xdd3e('0x7'));var integrations=require(_0xdd3e('0x8'));module[_0xdd3e('0x9')]=function(_0x502137,_0x258d42){return _0x502137['define']('SalesforceAccount',attributes,{'tableName':_0xdd3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67f8=['api','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x295788,_0x35065e){var _0x460314=function(_0x5c9c4f){while(--_0x5c9c4f){_0x295788['push'](_0x295788['shift']());}};_0x460314(++_0x35065e);}(_0x67f8,0x105));var _0x867f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x67f8[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x867f('0x0'));var util=require(_0x867f('0x1'));var logger=require(_0x867f('0x2'))(_0x867f('0x3'));var moment=require('moment');var BPromise=require(_0x867f('0x4'));var rp=require(_0x867f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x867f('0x6'));var config=require('../../config/environment');var attributes=require(_0x867f('0x7'));var integrations=require(_0x867f('0x8'));module['exports']=function(_0x547c7d,_0x19f2d9){return _0x547c7d[_0x867f('0x9')](_0x867f('0xa'),attributes,{'tableName':_0x867f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 68f1dbd..74d49cc 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 _0xed19=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','find','ShowSalesforceAccount','lodash','util','bluebird'];(function(_0x3da047,_0x4a932f){var _0x2f5afe=function(_0x208af3){while(--_0x208af3){_0x3da047['push'](_0x3da047['shift']());}};_0x2f5afe(++_0x4a932f);}(_0xed19,0x17e));var _0x9ed1=function(_0x200b29,_0x5aac6f){_0x200b29=_0x200b29-0x0;var _0x470267=_0xed19[_0x200b29];return _0x470267;};'use strict';var _=require(_0x9ed1('0x0'));var util=require(_0x9ed1('0x1'));var moment=require('moment');var BPromise=require(_0x9ed1('0x2'));var rs=require(_0x9ed1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ed1('0x4'))['db'];var utils=require(_0x9ed1('0x5'));var logger=require('../../config/logger')(_0x9ed1('0x6'));var config=require(_0x9ed1('0x7'));var jayson=require(_0x9ed1('0x8'));var client=jayson[_0x9ed1('0x9')][_0x9ed1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7488f6,_0x3a45c3,_0xbadc14){return new BPromise(function(_0x5e205f,_0x2b3aee){return client[_0x9ed1('0xb')](_0x7488f6,_0xbadc14)[_0x9ed1('0xc')](function(_0x337df3){logger[_0x9ed1('0xd')](_0x9ed1('0xe'),_0x3a45c3,_0x9ed1('0xf'));logger['debug'](_0x9ed1('0x10'),_0x3a45c3,_0x9ed1('0xf'),JSON['stringify'](_0x337df3));if(_0x337df3[_0x9ed1('0x11')]){if(_0x337df3[_0x9ed1('0x11')]['code']===0x1f4){logger[_0x9ed1('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x3a45c3,_0x337df3[_0x9ed1('0x11')]['message']);return _0x2b3aee(_0x337df3[_0x9ed1('0x11')][_0x9ed1('0x12')]);}logger[_0x9ed1('0x11')](_0x9ed1('0xe'),_0x3a45c3,_0x337df3[_0x9ed1('0x11')][_0x9ed1('0x12')]);return _0x5e205f(_0x337df3['error']['message']);}else{logger['info'](_0x9ed1('0xe'),_0x3a45c3,_0x9ed1('0xf'));_0x5e205f(_0x337df3[_0x9ed1('0x13')][_0x9ed1('0x12')]);}})[_0x9ed1('0x14')](function(_0x1ec73f){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3a45c3,_0x1ec73f);_0x2b3aee(_0x1ec73f);});});}exports[_0x9ed1('0x15')]=function(_0x511035){var _0x59fd3f=this;return new Promise(function(_0x1d6d26,_0xc0718e){return db[_0x9ed1('0x16')]['findAll']({'raw':_0x511035[_0x9ed1('0x17')]?_0x511035['options'][_0x9ed1('0x18')]===undefined?!![]:![]:!![],'where':_0x511035[_0x9ed1('0x17')]?_0x511035[_0x9ed1('0x17')][_0x9ed1('0x19')]||null:null,'attributes':_0x511035[_0x9ed1('0x17')]?_0x511035[_0x9ed1('0x17')][_0x9ed1('0x1a')]||null:null,'limit':_0x511035['options']?_0x511035[_0x9ed1('0x17')][_0x9ed1('0x1b')]||null:null,'include':_0x511035[_0x9ed1('0x17')]?_0x511035[_0x9ed1('0x17')][_0x9ed1('0x1c')]?_[_0x9ed1('0x1d')](_0x511035['options']['include'],function(_0x4d96e6){return{'model':db[_0x4d96e6[_0x9ed1('0x1e')]],'as':_0x4d96e6['as'],'attributes':_0x4d96e6[_0x9ed1('0x1a')],'include':_0x4d96e6[_0x9ed1('0x1c')]?_['map'](_0x4d96e6['include'],function(_0x3daf52){return{'model':db[_0x3daf52[_0x9ed1('0x1e')]],'as':_0x3daf52['as'],'attributes':_0x3daf52[_0x9ed1('0x1a')],'include':_0x3daf52[_0x9ed1('0x1c')]?_[_0x9ed1('0x1d')](_0x3daf52[_0x9ed1('0x1c')],function(_0x21293d){return{'model':db[_0x21293d[_0x9ed1('0x1e')]],'as':_0x21293d['as'],'attributes':_0x21293d[_0x9ed1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9ed1('0xc')](function(_0x1af490){logger[_0x9ed1('0xd')](_0x9ed1('0x15'),_0x511035);logger[_0x9ed1('0x1f')](_0x9ed1('0x15'),_0x511035,JSON[_0x9ed1('0x20')](_0x1af490));_0x1d6d26(_0x1af490);})['catch'](function(_0xbf6e74){logger[_0x9ed1('0x11')]('GetSalesforceAccount',_0xbf6e74[_0x9ed1('0x12')],_0x511035);_0xc0718e(_0x59fd3f[_0x9ed1('0x11')](0x1f4,_0xbf6e74[_0x9ed1('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x2b7fb3){var _0x586801=this;return new Promise(function(_0x431aa8,_0x38b5a2){return db[_0x9ed1('0x16')][_0x9ed1('0x21')]({'raw':_0x2b7fb3[_0x9ed1('0x17')]?_0x2b7fb3[_0x9ed1('0x17')][_0x9ed1('0x18')]===undefined?!![]:![]:!![],'where':_0x2b7fb3['options']?_0x2b7fb3['options'][_0x9ed1('0x19')]||null:null,'attributes':_0x2b7fb3[_0x9ed1('0x17')]?_0x2b7fb3['options']['attributes']||null:null,'include':_0x2b7fb3[_0x9ed1('0x17')]?_0x2b7fb3[_0x9ed1('0x17')][_0x9ed1('0x1c')]?_['map'](_0x2b7fb3[_0x9ed1('0x17')][_0x9ed1('0x1c')],function(_0x5d45ce){return{'model':db[_0x5d45ce[_0x9ed1('0x1e')]],'as':_0x5d45ce['as'],'attributes':_0x5d45ce['attributes'],'include':_0x5d45ce[_0x9ed1('0x1c')]?_[_0x9ed1('0x1d')](_0x5d45ce[_0x9ed1('0x1c')],function(_0x47b2a9){return{'model':db[_0x47b2a9['model']],'as':_0x47b2a9['as'],'attributes':_0x47b2a9['attributes'],'include':_0x47b2a9['include']?_[_0x9ed1('0x1d')](_0x47b2a9['include'],function(_0x319cbf){return{'model':db[_0x319cbf[_0x9ed1('0x1e')]],'as':_0x319cbf['as'],'attributes':_0x319cbf[_0x9ed1('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ec813){logger[_0x9ed1('0xd')](_0x9ed1('0x22'),_0x2b7fb3);logger['debug']('ShowSalesforceAccount',_0x2b7fb3,JSON[_0x9ed1('0x20')](_0x1ec813));_0x431aa8(_0x1ec813);})[_0x9ed1('0x14')](function(_0x597ed8){logger['error'](_0x9ed1('0x22'),_0x597ed8[_0x9ed1('0x12')],_0x2b7fb3);_0x38b5a2(_0x586801['error'](0x1f4,_0x597ed8[_0x9ed1('0x12')]));});});}; \ No newline at end of file +var _0x4137=['stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','catch','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x253fd9,_0x3500f4){var _0x495424=function(_0x578942){while(--_0x578942){_0x253fd9['push'](_0x253fd9['shift']());}};_0x495424(++_0x3500f4);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['SalesforceAccount'][_0x7413('0x18')]({'raw':_0x19157f[_0x7413('0x19')]?_0x19157f[_0x7413('0x19')][_0x7413('0x1a')]===undefined?!![]:![]:!![],'where':_0x19157f['options']?_0x19157f[_0x7413('0x19')][_0x7413('0x1b')]||null:null,'attributes':_0x19157f[_0x7413('0x19')]?_0x19157f[_0x7413('0x19')][_0x7413('0x1c')]||null:null,'limit':_0x19157f[_0x7413('0x19')]?_0x19157f[_0x7413('0x19')][_0x7413('0x1d')]||null:null,'include':_0x19157f['options']?_0x19157f['options'][_0x7413('0x1e')]?_['map'](_0x19157f[_0x7413('0x19')][_0x7413('0x1e')],function(_0x3b0c81){return{'model':db[_0x3b0c81[_0x7413('0x1f')]],'as':_0x3b0c81['as'],'attributes':_0x3b0c81[_0x7413('0x1c')],'include':_0x3b0c81[_0x7413('0x1e')]?_[_0x7413('0x20')](_0x3b0c81[_0x7413('0x1e')],function(_0x1d455b){return{'model':db[_0x1d455b['model']],'as':_0x1d455b['as'],'attributes':_0x1d455b['attributes'],'include':_0x1d455b[_0x7413('0x1e')]?_['map'](_0x1d455b[_0x7413('0x1e')],function(_0x71cbb4){return{'model':db[_0x71cbb4[_0x7413('0x1f')]],'as':_0x71cbb4['as'],'attributes':_0x71cbb4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7413('0x21')](function(_0x896552){logger[_0x7413('0xe')](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON['stringify'](_0x896552));_0x2a3417(_0x896552);})[_0x7413('0x22')](function(_0x4ed662){logger[_0x7413('0x13')](_0x7413('0x17'),_0x4ed662[_0x7413('0x16')],_0x19157f);_0x26dafe(_0x12a01e[_0x7413('0x13')](0x1f4,_0x4ed662[_0x7413('0x16')]));});});};exports[_0x7413('0x23')]=function(_0x5bb3ea){var _0x1ffb6f=this;return new Promise(function(_0x17c342,_0x39db32){return db[_0x7413('0x24')][_0x7413('0x25')]({'raw':_0x5bb3ea[_0x7413('0x19')]?_0x5bb3ea[_0x7413('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5bb3ea[_0x7413('0x19')]?_0x5bb3ea[_0x7413('0x19')][_0x7413('0x1b')]||null:null,'attributes':_0x5bb3ea[_0x7413('0x19')]?_0x5bb3ea[_0x7413('0x19')]['attributes']||null:null,'include':_0x5bb3ea[_0x7413('0x19')]?_0x5bb3ea['options'][_0x7413('0x1e')]?_[_0x7413('0x20')](_0x5bb3ea[_0x7413('0x19')]['include'],function(_0xe6b096){return{'model':db[_0xe6b096['model']],'as':_0xe6b096['as'],'attributes':_0xe6b096[_0x7413('0x1c')],'include':_0xe6b096[_0x7413('0x1e')]?_['map'](_0xe6b096['include'],function(_0x440bfe){return{'model':db[_0x440bfe[_0x7413('0x1f')]],'as':_0x440bfe['as'],'attributes':_0x440bfe[_0x7413('0x1c')],'include':_0x440bfe['include']?_['map'](_0x440bfe[_0x7413('0x1e')],function(_0x5a92ab){return{'model':db[_0x5a92ab['model']],'as':_0x5a92ab['as'],'attributes':_0x5a92ab[_0x7413('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ad12d){logger[_0x7413('0xe')](_0x7413('0x23'),_0x5bb3ea);logger[_0x7413('0x10')](_0x7413('0x23'),_0x5bb3ea,JSON['stringify'](_0x3ad12d));_0x17c342(_0x3ad12d);})[_0x7413('0x22')](function(_0x8dc047){logger[_0x7413('0x13')](_0x7413('0x23'),_0x8dc047[_0x7413('0x16')],_0x5bb3ea);_0x39db32(_0x1ffb6f[_0x7413('0x13')](0x1f4,_0x8dc047[_0x7413('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d187c18..012586b 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(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2a99ea,_0x1bfb13){_0x2a99ea=_0x2a99ea-0x0;var _0x5887ae=_0x0b0e[_0x2a99ea];return _0x5887ae;};'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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x29f9fc,_0xe19878){var _0x53df10=function(_0x4d8a55){while(--_0x4d8a55){_0x29f9fc['push'](_0x29f9fc['shift']());}};_0x53df10(++_0xe19878);}(_0x5f2f,0x73));var _0xf5f2=function(_0x31f7e3,_0x236b6e){_0x31f7e3=_0x31f7e3-0x0;var _0x1414e9=_0x5f2f[_0x31f7e3];return _0x1414e9;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 5663b52..d19f69b 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 _0x8481=['contact_lead','lead','nothing','contact','account','sequelize','STRING','ENUM','Task','Case'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x8481,0x1c7));var _0x1848=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x8481[_0x4099ee];return _0x1b7bfc;};'use strict';var Sequelize=require(_0x1848('0x0'));module['exports']={'name':{'type':Sequelize[_0x1848('0x1')]},'description':{'type':Sequelize[_0x1848('0x1')]},'ticketType':{'type':Sequelize[_0x1848('0x2')](_0x1848('0x3'),_0x1848('0x4')),'defaultValue':_0x1848('0x3')},'moduleSearch':{'type':Sequelize[_0x1848('0x2')](_0x1848('0x5'),'contact',_0x1848('0x6'),'account_contact_lead','account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x1848('0x7'),_0x1848('0x8'),_0x1848('0x6'),_0x1848('0x9')),'defaultValue':_0x1848('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x1848('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x1848('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x1848('0x1')]}}; \ No newline at end of file +var _0x4d37=['nothing','account','sequelize','exports','STRING','ENUM','Case','Task','contact_lead','contact','lead','account_contact_lead'];(function(_0x3155c4,_0x67295b){var _0x53d2c8=function(_0x23bbca){while(--_0x23bbca){_0x3155c4['push'](_0x3155c4['shift']());}};_0x53d2c8(++_0x67295b);}(_0x4d37,0xe6));var _0x74d3=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0x4d37[_0xac56ce];return _0x5105e1;};'use strict';var Sequelize=require(_0x74d3('0x0'));module[_0x74d3('0x1')]={'name':{'type':Sequelize[_0x74d3('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x74d3('0x3')]('Task',_0x74d3('0x4')),'defaultValue':_0x74d3('0x5')},'moduleSearch':{'type':Sequelize[_0x74d3('0x3')](_0x74d3('0x6'),_0x74d3('0x7'),_0x74d3('0x8'),_0x74d3('0x9'),'account'),'defaultValue':_0x74d3('0x6')},'moduleCreate':{'type':Sequelize[_0x74d3('0x3')](_0x74d3('0xa'),_0x74d3('0x7'),'lead',_0x74d3('0xb')),'defaultValue':_0x74d3('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x74d3('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x74d3('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index bbcce88..202df92 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 _0x11a6=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','length','catch','create','body','find','getFields','findOne','params','SalesforceField','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x11a6,0x1c7));var _0x611a=function(_0x203b1c,_0xc80d95){_0x203b1c=_0x203b1c-0x0;var _0x33ff02=_0x11a6[_0x203b1c];return _0x33ff02;};'use strict';var emlformat=require(_0x611a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x611a('0x1'));var rp=require(_0x611a('0x2'));var moment=require(_0x611a('0x3'));var BPromise=require(_0x611a('0x4'));var Mustache=require(_0x611a('0x5'));var util=require(_0x611a('0x6'));var path=require(_0x611a('0x7'));var sox=require(_0x611a('0x8'));var csv=require('to-csv');var ejs=require(_0x611a('0x9'));var fs=require('fs');var fs_extra=require(_0x611a('0xa'));var _=require(_0x611a('0xb'));var squel=require(_0x611a('0xc'));var crypto=require('crypto');var jsforce=require(_0x611a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x611a('0xe'));var querystring=require(_0x611a('0xf'));var Papa=require('papaparse');var Redis=require(_0x611a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x611a('0x11'));var as=require(_0x611a('0x12'));var hardwareService=require(_0x611a('0x13'));var logger=require(_0x611a('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x611a('0x15'));var db=require(_0x611a('0x16'))['db'];function respondWithStatusCode(_0x5dc3fb,_0x26f2ca){_0x26f2ca=_0x26f2ca||0xcc;return function(_0x49baa6){if(_0x49baa6){return _0x5dc3fb[_0x611a('0x17')](_0x26f2ca);}return _0x5dc3fb[_0x611a('0x18')](_0x26f2ca)[_0x611a('0x19')]();};}function respondWithResult(_0x24c27f,_0x597364){_0x597364=_0x597364||0xc8;return function(_0xe262b2){if(_0xe262b2){return _0x24c27f[_0x611a('0x18')](_0x597364)[_0x611a('0x1a')](_0xe262b2);}};}function respondWithFilteredResult(_0x4cd920,_0xd76c08){return function(_0x938ee7){if(_0x938ee7){var _0x5ccca5=typeof _0xd76c08[_0x611a('0x1b')]==='undefined'&&typeof _0xd76c08['limit']==='undefined';var _0x549f81=_0x938ee7['count'];var _0x3d4815=_0x5ccca5?0x0:_0xd76c08[_0x611a('0x1b')];var _0x38622d=_0x5ccca5?_0x938ee7[_0x611a('0x1c')]:_0xd76c08['offset']+_0xd76c08['limit'];var _0x59669c;if(_0x38622d>=_0x549f81){_0x38622d=_0x549f81;_0x59669c=0xc8;}else{_0x59669c=0xce;}_0x4cd920['status'](_0x59669c);return _0x4cd920['set'](_0x611a('0x1d'),_0x3d4815+'-'+_0x38622d+'/'+_0x549f81)['json'](_0x938ee7);}return null;};}function patchUpdates(_0x3c113e){return function(_0x3b368a){try{jsonpatch[_0x611a('0x1e')](_0x3b368a,_0x3c113e,!![]);}catch(_0x187daf){return BPromise[_0x611a('0x1f')](_0x187daf);}return _0x3b368a[_0x611a('0x20')]();};}function saveUpdates(_0x4c4f21,_0x18241f){return function(_0x18c0eb){if(_0x18c0eb){return _0x18c0eb[_0x611a('0x21')](_0x4c4f21)[_0x611a('0x22')](function(_0x57e564){return _0x57e564;});}return null;};}function removeEntity(_0x3120e6,_0x2571fb){return function(_0x114a54){if(_0x114a54){return _0x114a54[_0x611a('0x23')]()[_0x611a('0x22')](function(){_0x3120e6[_0x611a('0x18')](0xcc)[_0x611a('0x19')]();});}};}function handleEntityNotFound(_0x5076c2,_0x191bdc){return function(_0x5b5b91){if(!_0x5b5b91){_0x5076c2[_0x611a('0x17')](0x194);}return _0x5b5b91;};}function handleError(_0xdabfa2,_0x41c45a){_0x41c45a=_0x41c45a||0x1f4;return function(_0x27782b){logger[_0x611a('0x24')](_0x27782b[_0x611a('0x25')]);if(_0x27782b[_0x611a('0x26')]){delete _0x27782b[_0x611a('0x26')];}_0xdabfa2[_0x611a('0x18')](_0x41c45a)[_0x611a('0x27')](_0x27782b);};}exports[_0x611a('0x28')]=function(_0xa77b31,_0x3e0c15){var _0x2cca64={},_0x37f915={},_0x221cac={'count':0x0,'rows':[]};var _0x13aaf3=_[_0x611a('0x29')](db[_0x611a('0x2a')][_0x611a('0x2b')],function(_0x57ac11){return{'name':_0x57ac11['fieldName'],'type':_0x57ac11[_0x611a('0x2c')][_0x611a('0x2d')]};});_0x37f915[_0x611a('0x2e')]=_[_0x611a('0x29')](_0x13aaf3,_0x611a('0x26'));_0x37f915[_0x611a('0x2f')]=_[_0x611a('0x30')](_0xa77b31[_0x611a('0x2f')]);_0x37f915[_0x611a('0x31')]=_['intersection'](_0x37f915[_0x611a('0x2e')],_0x37f915[_0x611a('0x2f')]);_0x2cca64['attributes']=_[_0x611a('0x32')](_0x37f915[_0x611a('0x2e')],qs[_0x611a('0x33')](_0xa77b31['query'][_0x611a('0x33')]));_0x2cca64[_0x611a('0x34')]=_0x2cca64[_0x611a('0x34')]['length']?_0x2cca64[_0x611a('0x34')]:_0x37f915[_0x611a('0x2e')];if(!_0xa77b31[_0x611a('0x2f')][_0x611a('0x35')](_0x611a('0x36'))){_0x2cca64['limit']=qs[_0x611a('0x37')](_0xa77b31[_0x611a('0x2f')][_0x611a('0x37')]);_0x2cca64[_0x611a('0x1b')]=qs['offset'](_0xa77b31['query'][_0x611a('0x1b')]);}_0x2cca64[_0x611a('0x38')]=qs[_0x611a('0x39')](_0xa77b31[_0x611a('0x2f')][_0x611a('0x39')]);_0x2cca64['where']=qs[_0x611a('0x31')](_[_0x611a('0x3a')](_0xa77b31['query'],_0x37f915[_0x611a('0x31')]),_0x13aaf3);if(_0xa77b31[_0x611a('0x2f')][_0x611a('0x3b')]){_0x2cca64[_0x611a('0x3c')]=_[_0x611a('0x3d')](_0x2cca64['where'],{'$or':_[_0x611a('0x29')](_0x13aaf3,function(_0x21e75c){if(_0x21e75c[_0x611a('0x2c')]!==_0x611a('0x3e')){var _0x2c66d4={};_0x2c66d4[_0x21e75c[_0x611a('0x26')]]={'$like':'%'+_0xa77b31['query'][_0x611a('0x3b')]+'%'};return _0x2c66d4;}})});}_0x2cca64=_[_0x611a('0x3d')]({},_0x2cca64,_0xa77b31[_0x611a('0x3f')]);var _0x1dd741={'where':_0x2cca64['where']};return db[_0x611a('0x2a')][_0x611a('0x1c')](_0x1dd741)[_0x611a('0x22')](function(_0xfdebd2){_0x221cac[_0x611a('0x1c')]=_0xfdebd2;if(_0xa77b31[_0x611a('0x2f')][_0x611a('0x40')]){_0x2cca64[_0x611a('0x41')]=[{'all':!![]}];}return db[_0x611a('0x2a')]['findAll'](_0x2cca64);})['then'](function(_0x689b89){_0x221cac[_0x611a('0x42')]=_0x689b89;return _0x221cac;})[_0x611a('0x22')](respondWithFilteredResult(_0x3e0c15,_0x2cca64))['catch'](handleError(_0x3e0c15,null));};exports[_0x611a('0x43')]=function(_0x5e5fca,_0x2ac9cf){var _0x49ed1e={'raw':![],'where':{'id':_0x5e5fca['params']['id']}},_0x1b88d9={};_0x1b88d9[_0x611a('0x2e')]=_[_0x611a('0x30')](db[_0x611a('0x2a')][_0x611a('0x2b')]);_0x1b88d9[_0x611a('0x2f')]=_[_0x611a('0x30')](_0x5e5fca[_0x611a('0x2f')]);_0x1b88d9['filters']=_[_0x611a('0x32')](_0x1b88d9[_0x611a('0x2e')],_0x1b88d9[_0x611a('0x2f')]);_0x49ed1e['attributes']=_[_0x611a('0x32')](_0x1b88d9[_0x611a('0x2e')],qs['fields'](_0x5e5fca['query'][_0x611a('0x33')]));_0x49ed1e[_0x611a('0x34')]=_0x49ed1e[_0x611a('0x34')][_0x611a('0x44')]?_0x49ed1e[_0x611a('0x34')]:_0x1b88d9[_0x611a('0x2e')];if(_0x5e5fca[_0x611a('0x2f')][_0x611a('0x40')]){_0x49ed1e[_0x611a('0x41')]=[{'all':!![]}];}_0x49ed1e=_[_0x611a('0x3d')]({},_0x49ed1e,_0x5e5fca['options']);return db['SalesforceConfiguration']['find'](_0x49ed1e)[_0x611a('0x22')](handleEntityNotFound(_0x2ac9cf,null))[_0x611a('0x22')](respondWithResult(_0x2ac9cf,null))[_0x611a('0x45')](handleError(_0x2ac9cf,null));};exports[_0x611a('0x46')]=function(_0x3473df,_0x365d9e){return db[_0x611a('0x2a')][_0x611a('0x46')](_0x3473df[_0x611a('0x47')],{})[_0x611a('0x22')](respondWithResult(_0x365d9e,0xc9))[_0x611a('0x45')](handleError(_0x365d9e,null));};exports[_0x611a('0x21')]=function(_0x5d30ba,_0x33e646){if(_0x5d30ba['body']['id']){delete _0x5d30ba['body']['id'];}return db[_0x611a('0x2a')]['find']({'where':{'id':_0x5d30ba['params']['id']}})['then'](handleEntityNotFound(_0x33e646,null))['then'](saveUpdates(_0x5d30ba[_0x611a('0x47')],null))[_0x611a('0x22')](respondWithResult(_0x33e646,null))[_0x611a('0x45')](handleError(_0x33e646,null));};exports[_0x611a('0x23')]=function(_0xbed85c,_0x5e8142){return db[_0x611a('0x2a')][_0x611a('0x48')]({'where':{'id':_0xbed85c['params']['id']}})['then'](handleEntityNotFound(_0x5e8142,null))[_0x611a('0x22')](removeEntity(_0x5e8142,null))[_0x611a('0x45')](handleError(_0x5e8142,null));};exports[_0x611a('0x49')]=function(_0xf6514d,_0x107cee,_0x56a1a8){var _0x6947bf={};var _0x291094={};var _0x3a08d5;var _0x32a0bf;return db[_0x611a('0x2a')][_0x611a('0x4a')]({'where':{'id':_0xf6514d[_0x611a('0x4b')]['id']}})[_0x611a('0x22')](handleEntityNotFound(_0x107cee,null))['then'](function(_0x356fbe){if(_0x356fbe){_0x3a08d5=_0x356fbe;_0x291094['model']=_['keys'](db[_0x611a('0x4c')]['rawAttributes']);_0x291094[_0x611a('0x2f')]=_['keys'](_0xf6514d[_0x611a('0x2f')]);_0x291094[_0x611a('0x31')]=_['intersection'](_0x291094[_0x611a('0x2e')],_0x291094[_0x611a('0x2f')]);_0x6947bf[_0x611a('0x34')]=_[_0x611a('0x32')](_0x291094[_0x611a('0x2e')],qs['fields'](_0xf6514d['query'][_0x611a('0x33')]));_0x6947bf[_0x611a('0x34')]=_0x6947bf[_0x611a('0x34')][_0x611a('0x44')]?_0x6947bf['attributes']:_0x291094['model'];_0x6947bf['order']=qs[_0x611a('0x39')](_0xf6514d['query']['sort']);_0x6947bf[_0x611a('0x3c')]=qs[_0x611a('0x31')](_[_0x611a('0x3a')](_0xf6514d[_0x611a('0x2f')],_0x291094[_0x611a('0x31')]));if(_0xf6514d[_0x611a('0x2f')][_0x611a('0x3b')]){_0x6947bf[_0x611a('0x3c')]=_[_0x611a('0x3d')](_0x6947bf[_0x611a('0x3c')],{'$or':_[_0x611a('0x29')](_0x6947bf[_0x611a('0x34')],function(_0x1bb902){var _0xfedc15={};_0xfedc15[_0x1bb902]={'$like':'%'+_0xf6514d[_0x611a('0x2f')]['filter']+'%'};return _0xfedc15;})});}_0x6947bf=_['merge']({},_0x6947bf,_0xf6514d[_0x611a('0x3f')]);return _0x3a08d5['getFields'](_0x6947bf);}})['then'](function(_0x277d53){if(_0x277d53){_0x32a0bf=_0x277d53[_0x611a('0x44')];if(!_0xf6514d[_0x611a('0x2f')]['hasOwnProperty'](_0x611a('0x36'))){_0x6947bf[_0x611a('0x37')]=qs[_0x611a('0x37')](_0xf6514d['query'][_0x611a('0x37')]);_0x6947bf['offset']=qs[_0x611a('0x1b')](_0xf6514d[_0x611a('0x2f')]['offset']);}return _0x3a08d5[_0x611a('0x49')](_0x6947bf);}})[_0x611a('0x22')](function(_0x15a584){if(_0x15a584){return _0x15a584?{'count':_0x32a0bf,'rows':_0x15a584}:null;}})['then'](respondWithResult(_0x107cee,null))[_0x611a('0x45')](handleError(_0x107cee,null));};exports[_0x611a('0x4d')]=function(_0x3e95f3,_0x3a60b6,_0x225c3a){var _0x3f9679={};var _0x58edc9={};var _0xe31665;var _0x592c0d;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3e95f3[_0x611a('0x4b')]['id']}})[_0x611a('0x22')](handleEntityNotFound(_0x3a60b6,null))['then'](function(_0x162095){if(_0x162095){_0xe31665=_0x162095;_0x58edc9[_0x611a('0x2e')]=_[_0x611a('0x30')](db[_0x611a('0x4c')][_0x611a('0x2b')]);_0x58edc9[_0x611a('0x2f')]=_[_0x611a('0x30')](_0x3e95f3[_0x611a('0x2f')]);_0x58edc9['filters']=_['intersection'](_0x58edc9[_0x611a('0x2e')],_0x58edc9[_0x611a('0x2f')]);_0x3f9679['attributes']=_[_0x611a('0x32')](_0x58edc9[_0x611a('0x2e')],qs[_0x611a('0x33')](_0x3e95f3['query'][_0x611a('0x33')]));_0x3f9679['attributes']=_0x3f9679[_0x611a('0x34')][_0x611a('0x44')]?_0x3f9679[_0x611a('0x34')]:_0x58edc9['model'];_0x3f9679['order']=qs['sort'](_0x3e95f3[_0x611a('0x2f')][_0x611a('0x39')]);_0x3f9679[_0x611a('0x3c')]=qs[_0x611a('0x31')](_[_0x611a('0x3a')](_0x3e95f3[_0x611a('0x2f')],_0x58edc9[_0x611a('0x31')]));if(_0x3e95f3[_0x611a('0x2f')]['filter']){_0x3f9679[_0x611a('0x3c')]=_[_0x611a('0x3d')](_0x3f9679[_0x611a('0x3c')],{'$or':_[_0x611a('0x29')](_0x3f9679['attributes'],function(_0x35e20b){var _0x193665={};_0x193665[_0x35e20b]={'$like':'%'+_0x3e95f3[_0x611a('0x2f')][_0x611a('0x3b')]+'%'};return _0x193665;})});}_0x3f9679=_[_0x611a('0x3d')]({},_0x3f9679,_0x3e95f3[_0x611a('0x3f')]);return _0xe31665[_0x611a('0x4d')](_0x3f9679);}})[_0x611a('0x22')](function(_0x693906){if(_0x693906){_0x592c0d=_0x693906[_0x611a('0x44')];if(!_0x3e95f3[_0x611a('0x2f')][_0x611a('0x35')](_0x611a('0x36'))){_0x3f9679['limit']=qs[_0x611a('0x37')](_0x3e95f3[_0x611a('0x2f')]['limit']);_0x3f9679['offset']=qs[_0x611a('0x1b')](_0x3e95f3[_0x611a('0x2f')][_0x611a('0x1b')]);}return _0xe31665[_0x611a('0x4d')](_0x3f9679);}})[_0x611a('0x22')](function(_0x4b5619){if(_0x4b5619){return _0x4b5619?{'count':_0x592c0d,'rows':_0x4b5619}:null;}})[_0x611a('0x22')](respondWithResult(_0x3a60b6,null))[_0x611a('0x45')](handleError(_0x3a60b6,null));};exports['getDescriptions']=function(_0x2bfb7e,_0x36cbf4,_0x30ea41){var _0x61c35a={};var _0x33b03c={};var _0x5020bb;var _0xab27d1;return db['SalesforceConfiguration'][_0x611a('0x4a')]({'where':{'id':_0x2bfb7e[_0x611a('0x4b')]['id']}})[_0x611a('0x22')](handleEntityNotFound(_0x36cbf4,null))[_0x611a('0x22')](function(_0xb668cc){if(_0xb668cc){_0x5020bb=_0xb668cc;_0x33b03c[_0x611a('0x2e')]=_[_0x611a('0x30')](db[_0x611a('0x4c')][_0x611a('0x2b')]);_0x33b03c[_0x611a('0x2f')]=_[_0x611a('0x30')](_0x2bfb7e[_0x611a('0x2f')]);_0x33b03c[_0x611a('0x31')]=_[_0x611a('0x32')](_0x33b03c['model'],_0x33b03c[_0x611a('0x2f')]);_0x61c35a['attributes']=_[_0x611a('0x32')](_0x33b03c[_0x611a('0x2e')],qs[_0x611a('0x33')](_0x2bfb7e[_0x611a('0x2f')][_0x611a('0x33')]));_0x61c35a['attributes']=_0x61c35a[_0x611a('0x34')]['length']?_0x61c35a[_0x611a('0x34')]:_0x33b03c[_0x611a('0x2e')];_0x61c35a[_0x611a('0x38')]=qs[_0x611a('0x39')](_0x2bfb7e[_0x611a('0x2f')]['sort']);_0x61c35a[_0x611a('0x3c')]=qs[_0x611a('0x31')](_[_0x611a('0x3a')](_0x2bfb7e[_0x611a('0x2f')],_0x33b03c[_0x611a('0x31')]));if(_0x2bfb7e['query'][_0x611a('0x3b')]){_0x61c35a[_0x611a('0x3c')]=_[_0x611a('0x3d')](_0x61c35a[_0x611a('0x3c')],{'$or':_[_0x611a('0x29')](_0x61c35a[_0x611a('0x34')],function(_0x1797be){var _0x54d215={};_0x54d215[_0x1797be]={'$like':'%'+_0x2bfb7e[_0x611a('0x2f')][_0x611a('0x3b')]+'%'};return _0x54d215;})});}_0x61c35a=_[_0x611a('0x3d')]({},_0x61c35a,_0x2bfb7e['options']);return _0x5020bb[_0x611a('0x4e')](_0x61c35a);}})[_0x611a('0x22')](function(_0x4ad863){if(_0x4ad863){_0xab27d1=_0x4ad863[_0x611a('0x44')];if(!_0x2bfb7e[_0x611a('0x2f')][_0x611a('0x35')]('nolimit')){_0x61c35a[_0x611a('0x37')]=qs[_0x611a('0x37')](_0x2bfb7e[_0x611a('0x2f')][_0x611a('0x37')]);_0x61c35a['offset']=qs[_0x611a('0x1b')](_0x2bfb7e['query'][_0x611a('0x1b')]);}return _0x5020bb['getDescriptions'](_0x61c35a);}})[_0x611a('0x22')](function(_0x27a8a6){if(_0x27a8a6){return _0x27a8a6?{'count':_0xab27d1,'rows':_0x27a8a6}:null;}})['then'](respondWithResult(_0x36cbf4,null))[_0x611a('0x45')](handleError(_0x36cbf4,null));}; \ No newline at end of file +var _0x7abb=['findOne','SalesforceField','filter','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body'];(function(_0x20237d,_0x506c3d){var _0x5a5b92=function(_0xdca92d){while(--_0xdca92d){_0x20237d['push'](_0x20237d['shift']());}};_0x5a5b92(++_0x506c3d);}(_0x7abb,0xea));var _0xb7ab=function(_0x13a8b9,_0xd4f9a5){_0x13a8b9=_0x13a8b9-0x0;var _0x3e27a1=_0x7abb[_0x13a8b9];return _0x3e27a1;};'use strict';var emlformat=require(_0xb7ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb7ab('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb7ab('0x2'));var Mustache=require(_0xb7ab('0x3'));var util=require(_0xb7ab('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb7ab('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7ab('0x6'));var squel=require(_0xb7ab('0x7'));var crypto=require(_0xb7ab('0x8'));var jsforce=require(_0xb7ab('0x9'));var deskjs=require(_0xb7ab('0xa'));var toCsv=require(_0xb7ab('0xb'));var querystring=require(_0xb7ab('0xc'));var Papa=require(_0xb7ab('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7ab('0xe'));var logger=require(_0xb7ab('0xf'))(_0xb7ab('0x10'));var utils=require('../../config/utils');var config=require(_0xb7ab('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37038e,_0x406eec){_0x406eec=_0x406eec||0xcc;return function(_0x3c71f1){if(_0x3c71f1){return _0x37038e[_0xb7ab('0x12')](_0x406eec);}return _0x37038e['status'](_0x406eec)[_0xb7ab('0x13')]();};}function respondWithResult(_0x1a4ff5,_0x4030d6){_0x4030d6=_0x4030d6||0xc8;return function(_0x1551f9){if(_0x1551f9){return _0x1a4ff5[_0xb7ab('0x14')](_0x4030d6)['json'](_0x1551f9);}};}function respondWithFilteredResult(_0xbe6998,_0x283d6f){return function(_0xa84c9a){if(_0xa84c9a){var _0xc14cba=typeof _0x283d6f['offset']===_0xb7ab('0x15')&&typeof _0x283d6f[_0xb7ab('0x16')]==='undefined';var _0x2f685=_0xa84c9a[_0xb7ab('0x17')];var _0x11ab5d=_0xc14cba?0x0:_0x283d6f[_0xb7ab('0x18')];var _0x5ced64=_0xc14cba?_0xa84c9a[_0xb7ab('0x17')]:_0x283d6f[_0xb7ab('0x18')]+_0x283d6f[_0xb7ab('0x16')];var _0x4d0b86;if(_0x5ced64>=_0x2f685){_0x5ced64=_0x2f685;_0x4d0b86=0xc8;}else{_0x4d0b86=0xce;}_0xbe6998['status'](_0x4d0b86);return _0xbe6998[_0xb7ab('0x19')]('Content-Range',_0x11ab5d+'-'+_0x5ced64+'/'+_0x2f685)[_0xb7ab('0x1a')](_0xa84c9a);}return null;};}function patchUpdates(_0x45e8b4){return function(_0x4e403e){try{jsonpatch[_0xb7ab('0x1b')](_0x4e403e,_0x45e8b4,!![]);}catch(_0x281978){return BPromise[_0xb7ab('0x1c')](_0x281978);}return _0x4e403e[_0xb7ab('0x1d')]();};}function saveUpdates(_0x4e55c8,_0x307e99){return function(_0x1e1cf7){if(_0x1e1cf7){return _0x1e1cf7[_0xb7ab('0x1e')](_0x4e55c8)[_0xb7ab('0x1f')](function(_0x2a7517){return _0x2a7517;});}return null;};}function removeEntity(_0x3f3e8e,_0x2186dd){return function(_0x1c64e2){if(_0x1c64e2){return _0x1c64e2[_0xb7ab('0x20')]()['then'](function(){_0x3f3e8e[_0xb7ab('0x14')](0xcc)[_0xb7ab('0x13')]();});}};}function handleEntityNotFound(_0x32627e,_0x20d3ae){return function(_0x2ca84f){if(!_0x2ca84f){_0x32627e[_0xb7ab('0x12')](0x194);}return _0x2ca84f;};}function handleError(_0x2941a0,_0x115f32){_0x115f32=_0x115f32||0x1f4;return function(_0x5dcae4){logger[_0xb7ab('0x21')](_0x5dcae4[_0xb7ab('0x22')]);if(_0x5dcae4[_0xb7ab('0x23')]){delete _0x5dcae4[_0xb7ab('0x23')];}_0x2941a0[_0xb7ab('0x14')](_0x115f32)[_0xb7ab('0x24')](_0x5dcae4);};}exports[_0xb7ab('0x25')]=function(_0x135d8f,_0x1f4095){var _0x341e00={},_0x4f09d2={},_0x430ee9={'count':0x0,'rows':[]};var _0x1590b4=_[_0xb7ab('0x26')](db[_0xb7ab('0x27')][_0xb7ab('0x28')],function(_0x20fef4){return{'name':_0x20fef4[_0xb7ab('0x29')],'type':_0x20fef4[_0xb7ab('0x2a')][_0xb7ab('0x2b')]};});_0x4f09d2[_0xb7ab('0x2c')]=_['map'](_0x1590b4,_0xb7ab('0x23'));_0x4f09d2[_0xb7ab('0x2d')]=_[_0xb7ab('0x2e')](_0x135d8f[_0xb7ab('0x2d')]);_0x4f09d2[_0xb7ab('0x2f')]=_['intersection'](_0x4f09d2[_0xb7ab('0x2c')],_0x4f09d2['query']);_0x341e00['attributes']=_[_0xb7ab('0x30')](_0x4f09d2[_0xb7ab('0x2c')],qs['fields'](_0x135d8f[_0xb7ab('0x2d')][_0xb7ab('0x31')]));_0x341e00['attributes']=_0x341e00[_0xb7ab('0x32')][_0xb7ab('0x33')]?_0x341e00[_0xb7ab('0x32')]:_0x4f09d2[_0xb7ab('0x2c')];if(!_0x135d8f['query'][_0xb7ab('0x34')](_0xb7ab('0x35'))){_0x341e00[_0xb7ab('0x16')]=qs['limit'](_0x135d8f[_0xb7ab('0x2d')][_0xb7ab('0x16')]);_0x341e00['offset']=qs[_0xb7ab('0x18')](_0x135d8f['query'][_0xb7ab('0x18')]);}_0x341e00[_0xb7ab('0x36')]=qs[_0xb7ab('0x37')](_0x135d8f[_0xb7ab('0x2d')][_0xb7ab('0x37')]);_0x341e00[_0xb7ab('0x38')]=qs[_0xb7ab('0x2f')](_[_0xb7ab('0x39')](_0x135d8f[_0xb7ab('0x2d')],_0x4f09d2[_0xb7ab('0x2f')]),_0x1590b4);if(_0x135d8f[_0xb7ab('0x2d')]['filter']){_0x341e00['where']=_[_0xb7ab('0x3a')](_0x341e00[_0xb7ab('0x38')],{'$or':_[_0xb7ab('0x26')](_0x1590b4,function(_0x55049b){if(_0x55049b[_0xb7ab('0x2a')]!==_0xb7ab('0x3b')){var _0x4b5043={};_0x4b5043[_0x55049b[_0xb7ab('0x23')]]={'$like':'%'+_0x135d8f[_0xb7ab('0x2d')]['filter']+'%'};return _0x4b5043;}})});}_0x341e00=_[_0xb7ab('0x3a')]({},_0x341e00,_0x135d8f[_0xb7ab('0x3c')]);var _0x543596={'where':_0x341e00[_0xb7ab('0x38')]};return db[_0xb7ab('0x27')][_0xb7ab('0x17')](_0x543596)[_0xb7ab('0x1f')](function(_0x32cc3d){_0x430ee9[_0xb7ab('0x17')]=_0x32cc3d;if(_0x135d8f[_0xb7ab('0x2d')][_0xb7ab('0x3d')]){_0x341e00['include']=[{'all':!![]}];}return db[_0xb7ab('0x27')][_0xb7ab('0x3e')](_0x341e00);})[_0xb7ab('0x1f')](function(_0x126b63){_0x430ee9[_0xb7ab('0x3f')]=_0x126b63;return _0x430ee9;})[_0xb7ab('0x1f')](respondWithFilteredResult(_0x1f4095,_0x341e00))[_0xb7ab('0x40')](handleError(_0x1f4095,null));};exports['show']=function(_0xf98ea6,_0x1470c1){var _0x10c34c={'raw':![],'where':{'id':_0xf98ea6[_0xb7ab('0x41')]['id']}},_0x5244d4={};_0x5244d4[_0xb7ab('0x2c')]=_[_0xb7ab('0x2e')](db[_0xb7ab('0x27')][_0xb7ab('0x28')]);_0x5244d4[_0xb7ab('0x2d')]=_[_0xb7ab('0x2e')](_0xf98ea6['query']);_0x5244d4[_0xb7ab('0x2f')]=_[_0xb7ab('0x30')](_0x5244d4[_0xb7ab('0x2c')],_0x5244d4['query']);_0x10c34c[_0xb7ab('0x32')]=_[_0xb7ab('0x30')](_0x5244d4[_0xb7ab('0x2c')],qs[_0xb7ab('0x31')](_0xf98ea6[_0xb7ab('0x2d')][_0xb7ab('0x31')]));_0x10c34c['attributes']=_0x10c34c[_0xb7ab('0x32')][_0xb7ab('0x33')]?_0x10c34c[_0xb7ab('0x32')]:_0x5244d4[_0xb7ab('0x2c')];if(_0xf98ea6['query'][_0xb7ab('0x3d')]){_0x10c34c[_0xb7ab('0x42')]=[{'all':!![]}];}_0x10c34c=_[_0xb7ab('0x3a')]({},_0x10c34c,_0xf98ea6[_0xb7ab('0x3c')]);return db[_0xb7ab('0x27')][_0xb7ab('0x43')](_0x10c34c)[_0xb7ab('0x1f')](handleEntityNotFound(_0x1470c1,null))[_0xb7ab('0x1f')](respondWithResult(_0x1470c1,null))[_0xb7ab('0x40')](handleError(_0x1470c1,null));};exports[_0xb7ab('0x44')]=function(_0x40a09e,_0x3f9c71){return db['SalesforceConfiguration'][_0xb7ab('0x44')](_0x40a09e[_0xb7ab('0x45')],{})['then'](respondWithResult(_0x3f9c71,0xc9))[_0xb7ab('0x40')](handleError(_0x3f9c71,null));};exports['update']=function(_0x3a4e61,_0x4db2ba){if(_0x3a4e61['body']['id']){delete _0x3a4e61[_0xb7ab('0x45')]['id'];}return db['SalesforceConfiguration'][_0xb7ab('0x43')]({'where':{'id':_0x3a4e61[_0xb7ab('0x41')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x4db2ba,null))[_0xb7ab('0x1f')](saveUpdates(_0x3a4e61[_0xb7ab('0x45')],null))['then'](respondWithResult(_0x4db2ba,null))['catch'](handleError(_0x4db2ba,null));};exports[_0xb7ab('0x20')]=function(_0xf41a4c,_0x7156a7){return db['SalesforceConfiguration'][_0xb7ab('0x43')]({'where':{'id':_0xf41a4c[_0xb7ab('0x41')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x7156a7,null))['then'](removeEntity(_0x7156a7,null))['catch'](handleError(_0x7156a7,null));};exports['getFields']=function(_0x1062fe,_0x4bdfb3,_0x5b9e1b){var _0x4baaa9={};var _0x49cef6={};var _0x48827f;var _0x45c851;return db['SalesforceConfiguration'][_0xb7ab('0x46')]({'where':{'id':_0x1062fe[_0xb7ab('0x41')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x4bdfb3,null))[_0xb7ab('0x1f')](function(_0x1c21a1){if(_0x1c21a1){_0x48827f=_0x1c21a1;_0x49cef6['model']=_['keys'](db[_0xb7ab('0x47')][_0xb7ab('0x28')]);_0x49cef6[_0xb7ab('0x2d')]=_[_0xb7ab('0x2e')](_0x1062fe[_0xb7ab('0x2d')]);_0x49cef6[_0xb7ab('0x2f')]=_[_0xb7ab('0x30')](_0x49cef6[_0xb7ab('0x2c')],_0x49cef6[_0xb7ab('0x2d')]);_0x4baaa9[_0xb7ab('0x32')]=_['intersection'](_0x49cef6['model'],qs[_0xb7ab('0x31')](_0x1062fe[_0xb7ab('0x2d')][_0xb7ab('0x31')]));_0x4baaa9[_0xb7ab('0x32')]=_0x4baaa9['attributes']['length']?_0x4baaa9[_0xb7ab('0x32')]:_0x49cef6[_0xb7ab('0x2c')];_0x4baaa9[_0xb7ab('0x36')]=qs[_0xb7ab('0x37')](_0x1062fe[_0xb7ab('0x2d')]['sort']);_0x4baaa9[_0xb7ab('0x38')]=qs[_0xb7ab('0x2f')](_[_0xb7ab('0x39')](_0x1062fe[_0xb7ab('0x2d')],_0x49cef6[_0xb7ab('0x2f')]));if(_0x1062fe[_0xb7ab('0x2d')][_0xb7ab('0x48')]){_0x4baaa9[_0xb7ab('0x38')]=_[_0xb7ab('0x3a')](_0x4baaa9[_0xb7ab('0x38')],{'$or':_[_0xb7ab('0x26')](_0x4baaa9[_0xb7ab('0x32')],function(_0x363c4a){var _0x41a902={};_0x41a902[_0x363c4a]={'$like':'%'+_0x1062fe[_0xb7ab('0x2d')]['filter']+'%'};return _0x41a902;})});}_0x4baaa9=_[_0xb7ab('0x3a')]({},_0x4baaa9,_0x1062fe[_0xb7ab('0x3c')]);return _0x48827f[_0xb7ab('0x49')](_0x4baaa9);}})[_0xb7ab('0x1f')](function(_0x3ee9d0){if(_0x3ee9d0){_0x45c851=_0x3ee9d0[_0xb7ab('0x33')];if(!_0x1062fe[_0xb7ab('0x2d')][_0xb7ab('0x34')](_0xb7ab('0x35'))){_0x4baaa9['limit']=qs[_0xb7ab('0x16')](_0x1062fe[_0xb7ab('0x2d')][_0xb7ab('0x16')]);_0x4baaa9[_0xb7ab('0x18')]=qs[_0xb7ab('0x18')](_0x1062fe[_0xb7ab('0x2d')]['offset']);}return _0x48827f[_0xb7ab('0x49')](_0x4baaa9);}})[_0xb7ab('0x1f')](function(_0x536f26){if(_0x536f26){return _0x536f26?{'count':_0x45c851,'rows':_0x536f26}:null;}})[_0xb7ab('0x1f')](respondWithResult(_0x4bdfb3,null))['catch'](handleError(_0x4bdfb3,null));};exports[_0xb7ab('0x4a')]=function(_0x1f3c33,_0x5c8171,_0x5d273c){var _0x3cb23d={};var _0x320b69={};var _0x4d8391;var _0x1942fe;return db[_0xb7ab('0x27')][_0xb7ab('0x46')]({'where':{'id':_0x1f3c33[_0xb7ab('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c8171,null))[_0xb7ab('0x1f')](function(_0x17460c){if(_0x17460c){_0x4d8391=_0x17460c;_0x320b69[_0xb7ab('0x2c')]=_[_0xb7ab('0x2e')](db[_0xb7ab('0x47')][_0xb7ab('0x28')]);_0x320b69['query']=_[_0xb7ab('0x2e')](_0x1f3c33[_0xb7ab('0x2d')]);_0x320b69['filters']=_[_0xb7ab('0x30')](_0x320b69[_0xb7ab('0x2c')],_0x320b69[_0xb7ab('0x2d')]);_0x3cb23d['attributes']=_[_0xb7ab('0x30')](_0x320b69[_0xb7ab('0x2c')],qs[_0xb7ab('0x31')](_0x1f3c33['query'][_0xb7ab('0x31')]));_0x3cb23d[_0xb7ab('0x32')]=_0x3cb23d[_0xb7ab('0x32')][_0xb7ab('0x33')]?_0x3cb23d['attributes']:_0x320b69[_0xb7ab('0x2c')];_0x3cb23d[_0xb7ab('0x36')]=qs[_0xb7ab('0x37')](_0x1f3c33['query'][_0xb7ab('0x37')]);_0x3cb23d[_0xb7ab('0x38')]=qs['filters'](_[_0xb7ab('0x39')](_0x1f3c33[_0xb7ab('0x2d')],_0x320b69[_0xb7ab('0x2f')]));if(_0x1f3c33[_0xb7ab('0x2d')][_0xb7ab('0x48')]){_0x3cb23d[_0xb7ab('0x38')]=_['merge'](_0x3cb23d['where'],{'$or':_[_0xb7ab('0x26')](_0x3cb23d[_0xb7ab('0x32')],function(_0x53bc2c){var _0x45d4c5={};_0x45d4c5[_0x53bc2c]={'$like':'%'+_0x1f3c33['query'][_0xb7ab('0x48')]+'%'};return _0x45d4c5;})});}_0x3cb23d=_['merge']({},_0x3cb23d,_0x1f3c33[_0xb7ab('0x3c')]);return _0x4d8391['getSubjects'](_0x3cb23d);}})[_0xb7ab('0x1f')](function(_0x447739){if(_0x447739){_0x1942fe=_0x447739[_0xb7ab('0x33')];if(!_0x1f3c33[_0xb7ab('0x2d')]['hasOwnProperty'](_0xb7ab('0x35'))){_0x3cb23d[_0xb7ab('0x16')]=qs[_0xb7ab('0x16')](_0x1f3c33[_0xb7ab('0x2d')]['limit']);_0x3cb23d[_0xb7ab('0x18')]=qs[_0xb7ab('0x18')](_0x1f3c33[_0xb7ab('0x2d')][_0xb7ab('0x18')]);}return _0x4d8391[_0xb7ab('0x4a')](_0x3cb23d);}})[_0xb7ab('0x1f')](function(_0x2d38c8){if(_0x2d38c8){return _0x2d38c8?{'count':_0x1942fe,'rows':_0x2d38c8}:null;}})['then'](respondWithResult(_0x5c8171,null))['catch'](handleError(_0x5c8171,null));};exports[_0xb7ab('0x4b')]=function(_0x4209ec,_0x2f27bd,_0x38441d){var _0x12e157={};var _0x3437f1={};var _0x8c2e83;var _0x2f6021;return db[_0xb7ab('0x27')][_0xb7ab('0x46')]({'where':{'id':_0x4209ec[_0xb7ab('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f27bd,null))[_0xb7ab('0x1f')](function(_0x259956){if(_0x259956){_0x8c2e83=_0x259956;_0x3437f1[_0xb7ab('0x2c')]=_[_0xb7ab('0x2e')](db['SalesforceField'][_0xb7ab('0x28')]);_0x3437f1[_0xb7ab('0x2d')]=_['keys'](_0x4209ec[_0xb7ab('0x2d')]);_0x3437f1[_0xb7ab('0x2f')]=_[_0xb7ab('0x30')](_0x3437f1[_0xb7ab('0x2c')],_0x3437f1[_0xb7ab('0x2d')]);_0x12e157[_0xb7ab('0x32')]=_['intersection'](_0x3437f1[_0xb7ab('0x2c')],qs['fields'](_0x4209ec[_0xb7ab('0x2d')][_0xb7ab('0x31')]));_0x12e157[_0xb7ab('0x32')]=_0x12e157[_0xb7ab('0x32')][_0xb7ab('0x33')]?_0x12e157[_0xb7ab('0x32')]:_0x3437f1[_0xb7ab('0x2c')];_0x12e157['order']=qs[_0xb7ab('0x37')](_0x4209ec['query'][_0xb7ab('0x37')]);_0x12e157[_0xb7ab('0x38')]=qs['filters'](_[_0xb7ab('0x39')](_0x4209ec[_0xb7ab('0x2d')],_0x3437f1[_0xb7ab('0x2f')]));if(_0x4209ec[_0xb7ab('0x2d')][_0xb7ab('0x48')]){_0x12e157[_0xb7ab('0x38')]=_[_0xb7ab('0x3a')](_0x12e157[_0xb7ab('0x38')],{'$or':_[_0xb7ab('0x26')](_0x12e157[_0xb7ab('0x32')],function(_0x57e583){var _0x4169fd={};_0x4169fd[_0x57e583]={'$like':'%'+_0x4209ec[_0xb7ab('0x2d')]['filter']+'%'};return _0x4169fd;})});}_0x12e157=_['merge']({},_0x12e157,_0x4209ec[_0xb7ab('0x3c')]);return _0x8c2e83['getDescriptions'](_0x12e157);}})[_0xb7ab('0x1f')](function(_0x425575){if(_0x425575){_0x2f6021=_0x425575[_0xb7ab('0x33')];if(!_0x4209ec[_0xb7ab('0x2d')][_0xb7ab('0x34')](_0xb7ab('0x35'))){_0x12e157[_0xb7ab('0x16')]=qs[_0xb7ab('0x16')](_0x4209ec[_0xb7ab('0x2d')][_0xb7ab('0x16')]);_0x12e157['offset']=qs[_0xb7ab('0x18')](_0x4209ec['query'][_0xb7ab('0x18')]);}return _0x8c2e83['getDescriptions'](_0x12e157);}})[_0xb7ab('0x1f')](function(_0x31e3a3){if(_0x31e3a3){return _0x31e3a3?{'count':_0x2f6021,'rows':_0x31e3a3}:null;}})['then'](respondWithResult(_0x2f27bd,null))[_0xb7ab('0x40')](handleError(_0x2f27bd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9b46b25..f044c22 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 _0x23f1=['bluebird','request-promise','rimraf','../../config/environment','exports','SalesforceConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x5d00cb,_0xded7c9){var _0xb3815f=function(_0x14f9b6){while(--_0x14f9b6){_0x5d00cb['push'](_0x5d00cb['shift']());}};_0xb3815f(++_0xded7c9);}(_0x23f1,0x17c));var _0x123f=function(_0x21beb0,_0x70a429){_0x21beb0=_0x21beb0-0x0;var _0x186750=_0x23f1[_0x21beb0];return _0x186750;};'use strict';var _=require(_0x123f('0x0'));var util=require(_0x123f('0x1'));var logger=require(_0x123f('0x2'))(_0x123f('0x3'));var moment=require(_0x123f('0x4'));var BPromise=require(_0x123f('0x5'));var rp=require(_0x123f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x123f('0x7'));var config=require(_0x123f('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x123f('0x9')]=function(_0x49a7ef,_0x3eb2bf){return _0x49a7ef['define'](_0x123f('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba2c=['SalesforceConfiguration','int_salesforce_configurations','util','api','moment','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0xea81a1,_0xb28e9e){var _0x2cd030=function(_0x3f8ea5){while(--_0x3f8ea5){_0xea81a1['push'](_0xea81a1['shift']());}};_0x2cd030(++_0xb28e9e);}(_0xba2c,0x14c));var _0xcba2=function(_0x3a1f89,_0x26c689){_0x3a1f89=_0x3a1f89-0x0;var _0x581bc0=_0xba2c[_0x3a1f89];return _0x581bc0;};'use strict';var _=require('lodash');var util=require(_0xcba2('0x0'));var logger=require('../../config/logger')(_0xcba2('0x1'));var moment=require(_0xcba2('0x2'));var BPromise=require('bluebird');var rp=require(_0xcba2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcba2('0x4'));var config=require(_0xcba2('0x5'));var attributes=require(_0xcba2('0x6'));module[_0xcba2('0x7')]=function(_0x2032bd,_0x510c7f){return _0x2032bd['define'](_0xcba2('0x8'),attributes,{'tableName':_0xcba2('0x9'),'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 4653766..988715e 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 _0xa5d5=['../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa5d5,0xb8));var _0x5a5d=function(_0x50d18f,_0x37ca49){_0x50d18f=_0x50d18f-0x0;var _0x1578bb=_0xa5d5[_0x50d18f];return _0x1578bb;};'use strict';var _=require(_0x5a5d('0x0'));var util=require(_0x5a5d('0x1'));var moment=require(_0x5a5d('0x2'));var BPromise=require(_0x5a5d('0x3'));var rs=require(_0x5a5d('0x4'));var fs=require('fs');var Redis=require(_0x5a5d('0x5'));var db=require(_0x5a5d('0x6'))['db'];var utils=require(_0x5a5d('0x7'));var logger=require(_0x5a5d('0x8'))(_0x5a5d('0x9'));var config=require(_0x5a5d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5a5d('0xb')][_0x5a5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e5940,_0x447cfb,_0x578f64){return new BPromise(function(_0x71aad9,_0x2f41e6){return client[_0x5a5d('0xd')](_0x3e5940,_0x578f64)['then'](function(_0x3f890c){logger[_0x5a5d('0xe')](_0x5a5d('0xf'),_0x447cfb,_0x5a5d('0x10'));logger[_0x5a5d('0x11')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x447cfb,_0x5a5d('0x10'),JSON[_0x5a5d('0x12')](_0x3f890c));if(_0x3f890c['error']){if(_0x3f890c[_0x5a5d('0x13')][_0x5a5d('0x14')]===0x1f4){logger[_0x5a5d('0x13')](_0x5a5d('0xf'),_0x447cfb,_0x3f890c[_0x5a5d('0x13')][_0x5a5d('0x15')]);return _0x2f41e6(_0x3f890c[_0x5a5d('0x13')][_0x5a5d('0x15')]);}logger[_0x5a5d('0x13')](_0x5a5d('0xf'),_0x447cfb,_0x3f890c[_0x5a5d('0x13')][_0x5a5d('0x15')]);return _0x71aad9(_0x3f890c[_0x5a5d('0x13')][_0x5a5d('0x15')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x447cfb,'request\x20sent');_0x71aad9(_0x3f890c[_0x5a5d('0x16')][_0x5a5d('0x15')]);}})[_0x5a5d('0x17')](function(_0x481633){logger[_0x5a5d('0x13')](_0x5a5d('0xf'),_0x447cfb,_0x481633);_0x2f41e6(_0x481633);});});} \ No newline at end of file +var _0x6933=['../../config/logger','rpc','http','request','then','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','SalesforceConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6933,0x6c));var _0x3693=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0x6933[_0x34919b];return _0x505b56;};'use strict';var _=require(_0x3693('0x0'));var util=require(_0x3693('0x1'));var moment=require('moment');var BPromise=require(_0x3693('0x2'));var rs=require(_0x3693('0x3'));var fs=require('fs');var Redis=require(_0x3693('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3693('0x5'));var logger=require(_0x3693('0x6'))(_0x3693('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3693('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x478679,_0x59ac73,_0x3b6083){return new BPromise(function(_0xbdb3df,_0x309d52){return client[_0x3693('0x9')](_0x478679,_0x3b6083)[_0x3693('0xa')](function(_0x17d243){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x59ac73,_0x3693('0xb'));logger['debug'](_0x3693('0xc'),_0x59ac73,_0x3693('0xb'),JSON['stringify'](_0x17d243));if(_0x17d243['error']){if(_0x17d243[_0x3693('0xd')]['code']===0x1f4){logger[_0x3693('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59ac73,_0x17d243[_0x3693('0xd')][_0x3693('0xe')]);return _0x309d52(_0x17d243[_0x3693('0xd')][_0x3693('0xe')]);}logger[_0x3693('0xd')](_0x3693('0xf'),_0x59ac73,_0x17d243[_0x3693('0xd')][_0x3693('0xe')]);return _0xbdb3df(_0x17d243[_0x3693('0xd')][_0x3693('0xe')]);}else{logger[_0x3693('0x10')](_0x3693('0xf'),_0x59ac73,_0x3693('0xb'));_0xbdb3df(_0x17d243[_0x3693('0x11')]['message']);}})[_0x3693('0x12')](function(_0x31c3df){logger[_0x3693('0xd')](_0x3693('0xf'),_0x59ac73,_0x31c3df);_0x309d52(_0x31c3df);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4c9b1ab..58bc974 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 _0x5e8f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','update','destroy'];(function(_0x266af2,_0x45974e){var _0x4f67d6=function(_0x531181){while(--_0x531181){_0x266af2['push'](_0x266af2['shift']());}};_0x4f67d6(++_0x45974e);}(_0x5e8f,0xc9));var _0xf5e8=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0x5e8f[_0x152fe3];return _0xc5bb39;};'use strict';var multer=require(_0xf5e8('0x0'));var util=require(_0xf5e8('0x1'));var path=require(_0xf5e8('0x2'));var timeout=require(_0xf5e8('0x3'));var express=require(_0xf5e8('0x4'));var router=express[_0xf5e8('0x5')]();var fs_extra=require(_0xf5e8('0x6'));var auth=require(_0xf5e8('0x7'));var interaction=require(_0xf5e8('0x8'));var config=require(_0xf5e8('0x9'));var controller=require(_0xf5e8('0xa'));router[_0xf5e8('0xb')]('/',auth[_0xf5e8('0xc')](),controller[_0xf5e8('0xd')]);router[_0xf5e8('0xb')](_0xf5e8('0xe'),auth[_0xf5e8('0xc')](),controller[_0xf5e8('0xf')]);router[_0xf5e8('0x10')]('/',auth[_0xf5e8('0xc')](),controller['create']);router['put'](_0xf5e8('0xe'),auth['isAuthenticated'](),controller[_0xf5e8('0x11')]);router['delete'](_0xf5e8('0xe'),auth[_0xf5e8('0xc')](),controller[_0xf5e8('0x12')]);module[_0xf5e8('0x13')]=router; \ No newline at end of file +var _0x88e4=['index','show','post','/:id','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x31ddf9,_0x559392){var _0x3c4fc1=function(_0x1c2c8e){while(--_0x1c2c8e){_0x31ddf9['push'](_0x31ddf9['shift']());}};_0x3c4fc1(++_0x559392);}(_0x88e4,0x1d3));var _0x488e=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x88e4[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require(_0x488e('0x0'));var path=require(_0x488e('0x1'));var timeout=require('connect-timeout');var express=require(_0x488e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x488e('0x3'));var interaction=require(_0x488e('0x4'));var config=require(_0x488e('0x5'));var controller=require(_0x488e('0x6'));router[_0x488e('0x7')]('/',auth[_0x488e('0x8')](),controller[_0x488e('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x488e('0xa')]);router[_0x488e('0xb')]('/',auth[_0x488e('0x8')](),controller['create']);router['put'](_0x488e('0xc'),auth[_0x488e('0x8')](),controller[_0x488e('0xd')]);router[_0x488e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x488e('0xf')]);module[_0x488e('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 5850511..d126e27 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 _0x3e6e=['keyValue','picklist','string','STRING','ENUM','exports','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e6e,0x1e5));var _0xe3e6=function(_0x432085,_0x2de5f9){_0x432085=_0x432085-0x0;var _0x2c4e95=_0x3e6e[_0x432085];return _0x2c4e95;};'use strict';var Sequelize=require('sequelize');module[_0xe3e6('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xe3e6('0x1'),_0xe3e6('0x2'),_0xe3e6('0x3'),_0xe3e6('0x4')),'defaultValue':_0xe3e6('0x5')},'content':{'type':Sequelize[_0xe3e6('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe3e6('0x7')]('string',_0xe3e6('0x1'),_0xe3e6('0x2'))},'keyContent':{'type':Sequelize[_0xe3e6('0x6')]},'idField':{'type':Sequelize[_0xe3e6('0x6')]},'variableName':{'type':Sequelize[_0xe3e6('0x6')]}}; \ No newline at end of file +var _0xcb42=['customVariable','STRING','ENUM','sequelize','exports','string','variable'];(function(_0x25e934,_0x4757dd){var _0x162c25=function(_0x5c8c4e){while(--_0x5c8c4e){_0x25e934['push'](_0x25e934['shift']());}};_0x162c25(++_0x4757dd);}(_0xcb42,0x1a0));var _0x2cb4=function(_0x81119e,_0x1789cc){_0x81119e=_0x81119e-0x0;var _0x26bc19=_0xcb42[_0x81119e];return _0x26bc19;};'use strict';var Sequelize=require(_0x2cb4('0x0'));module[_0x2cb4('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2cb4('0x2'),_0x2cb4('0x3'),_0x2cb4('0x4'),'keyValue','picklist'),'defaultValue':_0x2cb4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2cb4('0x5')]},'keyType':{'type':Sequelize[_0x2cb4('0x6')](_0x2cb4('0x2'),_0x2cb4('0x3'),_0x2cb4('0x4'))},'keyContent':{'type':Sequelize[_0x2cb4('0x5')]},'idField':{'type':Sequelize[_0x2cb4('0x5')]},'variableName':{'type':Sequelize[_0x2cb4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 04dac38..303e60b 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 _0x4864=['model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','name','send','index','SalesforceField','rawAttributes','fieldName','key','query','keys','filters','intersection'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x4864,0xad));var _0x4486=function(_0x14a3cf,_0xae014f){_0x14a3cf=_0x14a3cf-0x0;var _0x5bcffb=_0x4864[_0x14a3cf];return _0x5bcffb;};'use strict';var emlformat=require(_0x4486('0x0'));var rimraf=require(_0x4486('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4486('0x2'));var rp=require(_0x4486('0x3'));var moment=require(_0x4486('0x4'));var BPromise=require(_0x4486('0x5'));var Mustache=require(_0x4486('0x6'));var util=require('util');var path=require(_0x4486('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4486('0x8'));var fs=require('fs');var fs_extra=require(_0x4486('0x9'));var _=require(_0x4486('0xa'));var squel=require('squel');var crypto=require(_0x4486('0xb'));var jsforce=require(_0x4486('0xc'));var deskjs=require(_0x4486('0xd'));var toCsv=require(_0x4486('0xe'));var querystring=require(_0x4486('0xf'));var Papa=require(_0x4486('0x10'));var Redis=require(_0x4486('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4486('0x12'));var logger=require(_0x4486('0x13'))(_0x4486('0x14'));var utils=require(_0x4486('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4486('0x16'));var db=require(_0x4486('0x17'))['db'];function respondWithStatusCode(_0x973ae,_0x46b81f){_0x46b81f=_0x46b81f||0xcc;return function(_0x42540f){if(_0x42540f){return _0x973ae[_0x4486('0x18')](_0x46b81f);}return _0x973ae['status'](_0x46b81f)['end']();};}function respondWithResult(_0x3852fc,_0x298467){_0x298467=_0x298467||0xc8;return function(_0x3d0367){if(_0x3d0367){return _0x3852fc[_0x4486('0x19')](_0x298467)[_0x4486('0x1a')](_0x3d0367);}};}function respondWithFilteredResult(_0x5e8546,_0x5d0691){return function(_0x1e7938){if(_0x1e7938){var _0x298526=typeof _0x5d0691[_0x4486('0x1b')]===_0x4486('0x1c')&&typeof _0x5d0691[_0x4486('0x1d')]===_0x4486('0x1c');var _0x3ce985=_0x1e7938[_0x4486('0x1e')];var _0x741cf7=_0x298526?0x0:_0x5d0691[_0x4486('0x1b')];var _0x53f629=_0x298526?_0x1e7938[_0x4486('0x1e')]:_0x5d0691['offset']+_0x5d0691['limit'];var _0x296502;if(_0x53f629>=_0x3ce985){_0x53f629=_0x3ce985;_0x296502=0xc8;}else{_0x296502=0xce;}_0x5e8546[_0x4486('0x19')](_0x296502);return _0x5e8546['set'](_0x4486('0x1f'),_0x741cf7+'-'+_0x53f629+'/'+_0x3ce985)[_0x4486('0x1a')](_0x1e7938);}return null;};}function patchUpdates(_0x34d543){return function(_0x10ed65){try{jsonpatch['apply'](_0x10ed65,_0x34d543,!![]);}catch(_0x46e0d0){return BPromise[_0x4486('0x20')](_0x46e0d0);}return _0x10ed65['save']();};}function saveUpdates(_0x13f7ac,_0xe2c290){return function(_0x583101){if(_0x583101){return _0x583101[_0x4486('0x21')](_0x13f7ac)[_0x4486('0x22')](function(_0x25698c){return _0x25698c;});}return null;};}function removeEntity(_0x53d9e3,_0x4c4576){return function(_0x5eb52e){if(_0x5eb52e){return _0x5eb52e[_0x4486('0x23')]()[_0x4486('0x22')](function(){_0x53d9e3['status'](0xcc)[_0x4486('0x24')]();});}};}function handleEntityNotFound(_0xfbedd5,_0x5d0eca){return function(_0x3b08e4){if(!_0x3b08e4){_0xfbedd5[_0x4486('0x18')](0x194);}return _0x3b08e4;};}function handleError(_0x3ac20c,_0x49b741){_0x49b741=_0x49b741||0x1f4;return function(_0x2f656f){logger[_0x4486('0x25')](_0x2f656f['stack']);if(_0x2f656f[_0x4486('0x26')]){delete _0x2f656f[_0x4486('0x26')];}_0x3ac20c[_0x4486('0x19')](_0x49b741)[_0x4486('0x27')](_0x2f656f);};}exports[_0x4486('0x28')]=function(_0x4ab5e1,_0xcb9595){var _0x3e490d={},_0x3073db={},_0x468006={'count':0x0,'rows':[]};var _0x56c71d=_['map'](db[_0x4486('0x29')][_0x4486('0x2a')],function(_0x5f4041){return{'name':_0x5f4041[_0x4486('0x2b')],'type':_0x5f4041['type'][_0x4486('0x2c')]};});_0x3073db['model']=_['map'](_0x56c71d,_0x4486('0x26'));_0x3073db[_0x4486('0x2d')]=_[_0x4486('0x2e')](_0x4ab5e1[_0x4486('0x2d')]);_0x3073db[_0x4486('0x2f')]=_[_0x4486('0x30')](_0x3073db[_0x4486('0x31')],_0x3073db[_0x4486('0x2d')]);_0x3e490d[_0x4486('0x32')]=_['intersection'](_0x3073db['model'],qs[_0x4486('0x33')](_0x4ab5e1[_0x4486('0x2d')][_0x4486('0x33')]));_0x3e490d[_0x4486('0x32')]=_0x3e490d['attributes']['length']?_0x3e490d['attributes']:_0x3073db['model'];if(!_0x4ab5e1[_0x4486('0x2d')][_0x4486('0x34')]('nolimit')){_0x3e490d[_0x4486('0x1d')]=qs[_0x4486('0x1d')](_0x4ab5e1['query']['limit']);_0x3e490d[_0x4486('0x1b')]=qs[_0x4486('0x1b')](_0x4ab5e1[_0x4486('0x2d')][_0x4486('0x1b')]);}_0x3e490d[_0x4486('0x35')]=qs[_0x4486('0x36')](_0x4ab5e1[_0x4486('0x2d')][_0x4486('0x36')]);_0x3e490d[_0x4486('0x37')]=qs[_0x4486('0x2f')](_[_0x4486('0x38')](_0x4ab5e1[_0x4486('0x2d')],_0x3073db[_0x4486('0x2f')]),_0x56c71d);if(_0x4ab5e1[_0x4486('0x2d')][_0x4486('0x39')]){_0x3e490d[_0x4486('0x37')]=_[_0x4486('0x3a')](_0x3e490d['where'],{'$or':_[_0x4486('0x3b')](_0x56c71d,function(_0x2b0d5d){if(_0x2b0d5d[_0x4486('0x3c')]!==_0x4486('0x3d')){var _0xb5cc={};_0xb5cc[_0x2b0d5d['name']]={'$like':'%'+_0x4ab5e1[_0x4486('0x2d')]['filter']+'%'};return _0xb5cc;}})});}_0x3e490d=_[_0x4486('0x3a')]({},_0x3e490d,_0x4ab5e1[_0x4486('0x3e')]);var _0x7d7f6d={'where':_0x3e490d[_0x4486('0x37')]};return db[_0x4486('0x29')][_0x4486('0x1e')](_0x7d7f6d)[_0x4486('0x22')](function(_0x2162ec){_0x468006['count']=_0x2162ec;if(_0x4ab5e1[_0x4486('0x2d')][_0x4486('0x3f')]){_0x3e490d[_0x4486('0x40')]=[{'all':!![]}];}return db[_0x4486('0x29')][_0x4486('0x41')](_0x3e490d);})['then'](function(_0x2af370){_0x468006[_0x4486('0x42')]=_0x2af370;return _0x468006;})['then'](respondWithFilteredResult(_0xcb9595,_0x3e490d))['catch'](handleError(_0xcb9595,null));};exports[_0x4486('0x43')]=function(_0x3766f8,_0x196765){var _0x549e27={'raw':!![],'where':{'id':_0x3766f8[_0x4486('0x44')]['id']}},_0x5146fa={};_0x5146fa['model']=_[_0x4486('0x2e')](db[_0x4486('0x29')][_0x4486('0x2a')]);_0x5146fa[_0x4486('0x2d')]=_['keys'](_0x3766f8[_0x4486('0x2d')]);_0x5146fa[_0x4486('0x2f')]=_[_0x4486('0x30')](_0x5146fa[_0x4486('0x31')],_0x5146fa[_0x4486('0x2d')]);_0x549e27['attributes']=_[_0x4486('0x30')](_0x5146fa[_0x4486('0x31')],qs[_0x4486('0x33')](_0x3766f8[_0x4486('0x2d')][_0x4486('0x33')]));_0x549e27[_0x4486('0x32')]=_0x549e27[_0x4486('0x32')][_0x4486('0x45')]?_0x549e27[_0x4486('0x32')]:_0x5146fa[_0x4486('0x31')];if(_0x3766f8['query'][_0x4486('0x3f')]){_0x549e27[_0x4486('0x40')]=[{'all':!![]}];}_0x549e27=_[_0x4486('0x3a')]({},_0x549e27,_0x3766f8['options']);return db[_0x4486('0x29')][_0x4486('0x46')](_0x549e27)[_0x4486('0x22')](handleEntityNotFound(_0x196765,null))['then'](respondWithResult(_0x196765,null))[_0x4486('0x47')](handleError(_0x196765,null));};exports[_0x4486('0x48')]=function(_0x485c36,_0x48b239){return db[_0x4486('0x29')][_0x4486('0x48')](_0x485c36[_0x4486('0x49')],{})[_0x4486('0x22')](respondWithResult(_0x48b239,0xc9))[_0x4486('0x47')](handleError(_0x48b239,null));};exports[_0x4486('0x21')]=function(_0x5d9ef8,_0x98951c){if(_0x5d9ef8['body']['id']){delete _0x5d9ef8[_0x4486('0x49')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x5d9ef8[_0x4486('0x44')]['id']}})[_0x4486('0x22')](handleEntityNotFound(_0x98951c,null))[_0x4486('0x22')](saveUpdates(_0x5d9ef8['body'],null))[_0x4486('0x22')](respondWithResult(_0x98951c,null))[_0x4486('0x47')](handleError(_0x98951c,null));};exports[_0x4486('0x23')]=function(_0x72e7a6,_0x1fd531){return db[_0x4486('0x29')][_0x4486('0x46')]({'where':{'id':_0x72e7a6[_0x4486('0x44')]['id']}})[_0x4486('0x22')](handleEntityNotFound(_0x1fd531,null))[_0x4486('0x22')](removeEntity(_0x1fd531,null))[_0x4486('0x47')](handleError(_0x1fd531,null));}; \ No newline at end of file +var _0x43c4=['key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','SalesforceField','type'];(function(_0x2a2c13,_0x223fa9){var _0x2b6f56=function(_0xda9cd0){while(--_0xda9cd0){_0x2a2c13['push'](_0x2a2c13['shift']());}};_0x2b6f56(++_0x223fa9);}(_0x43c4,0xf7));var _0x443c=function(_0x19ad0d,_0x3c233d){_0x19ad0d=_0x19ad0d-0x0;var _0x2e6508=_0x43c4[_0x19ad0d];return _0x2e6508;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x443c('0x0'));var zipdir=require(_0x443c('0x1'));var jsonpatch=require(_0x443c('0x2'));var rp=require(_0x443c('0x3'));var moment=require(_0x443c('0x4'));var BPromise=require(_0x443c('0x5'));var Mustache=require(_0x443c('0x6'));var util=require(_0x443c('0x7'));var path=require(_0x443c('0x8'));var sox=require('sox');var csv=require(_0x443c('0x9'));var ejs=require(_0x443c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x443c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x443c('0xc'));var deskjs=require(_0x443c('0xd'));var toCsv=require(_0x443c('0x9'));var querystring=require(_0x443c('0xe'));var Papa=require('papaparse');var Redis=require(_0x443c('0xf'));var authService=require(_0x443c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x443c('0x11'));var hardwareService=require(_0x443c('0x12'));var logger=require(_0x443c('0x13'))(_0x443c('0x14'));var utils=require(_0x443c('0x15'));var config=require(_0x443c('0x16'));var licenseUtil=require(_0x443c('0x17'));var db=require(_0x443c('0x18'))['db'];function respondWithStatusCode(_0x4a6524,_0x313d5a){_0x313d5a=_0x313d5a||0xcc;return function(_0x5175a1){if(_0x5175a1){return _0x4a6524[_0x443c('0x19')](_0x313d5a);}return _0x4a6524[_0x443c('0x1a')](_0x313d5a)[_0x443c('0x1b')]();};}function respondWithResult(_0x117012,_0x2868ce){_0x2868ce=_0x2868ce||0xc8;return function(_0x170552){if(_0x170552){return _0x117012['status'](_0x2868ce)[_0x443c('0x1c')](_0x170552);}};}function respondWithFilteredResult(_0x397105,_0x1c654e){return function(_0xd4a257){if(_0xd4a257){var _0x271a35=typeof _0x1c654e[_0x443c('0x1d')]===_0x443c('0x1e')&&typeof _0x1c654e[_0x443c('0x1f')]===_0x443c('0x1e');var _0x3338fe=_0xd4a257[_0x443c('0x20')];var _0x4e2662=_0x271a35?0x0:_0x1c654e['offset'];var _0x244de7=_0x271a35?_0xd4a257['count']:_0x1c654e[_0x443c('0x1d')]+_0x1c654e[_0x443c('0x1f')];var _0x12fb18;if(_0x244de7>=_0x3338fe){_0x244de7=_0x3338fe;_0x12fb18=0xc8;}else{_0x12fb18=0xce;}_0x397105[_0x443c('0x1a')](_0x12fb18);return _0x397105[_0x443c('0x21')](_0x443c('0x22'),_0x4e2662+'-'+_0x244de7+'/'+_0x3338fe)[_0x443c('0x1c')](_0xd4a257);}return null;};}function patchUpdates(_0x106eda){return function(_0x24041b){try{jsonpatch['apply'](_0x24041b,_0x106eda,!![]);}catch(_0x565528){return BPromise['reject'](_0x565528);}return _0x24041b['save']();};}function saveUpdates(_0x3c55bd,_0x2ed9a5){return function(_0x10a860){if(_0x10a860){return _0x10a860['update'](_0x3c55bd)[_0x443c('0x23')](function(_0x5bf90d){return _0x5bf90d;});}return null;};}function removeEntity(_0x314e99,_0x114b97){return function(_0x1c8f01){if(_0x1c8f01){return _0x1c8f01[_0x443c('0x24')]()[_0x443c('0x23')](function(){_0x314e99[_0x443c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x102ccb,_0x4a74a9){return function(_0xce2868){if(!_0xce2868){_0x102ccb[_0x443c('0x19')](0x194);}return _0xce2868;};}function handleError(_0x3031b3,_0x16bf56){_0x16bf56=_0x16bf56||0x1f4;return function(_0x285c74){logger[_0x443c('0x25')](_0x285c74[_0x443c('0x26')]);if(_0x285c74[_0x443c('0x27')]){delete _0x285c74[_0x443c('0x27')];}_0x3031b3['status'](_0x16bf56)[_0x443c('0x28')](_0x285c74);};}exports[_0x443c('0x29')]=function(_0x3c4a8f,_0x12f2f3){var _0x1a209d={},_0x1a3547={},_0x1c863c={'count':0x0,'rows':[]};var _0x42c4b2=_[_0x443c('0x2a')](db[_0x443c('0x2b')]['rawAttributes'],function(_0x25a9d9){return{'name':_0x25a9d9['fieldName'],'type':_0x25a9d9[_0x443c('0x2c')][_0x443c('0x2d')]};});_0x1a3547['model']=_[_0x443c('0x2a')](_0x42c4b2,_0x443c('0x27'));_0x1a3547[_0x443c('0x2e')]=_[_0x443c('0x2f')](_0x3c4a8f[_0x443c('0x2e')]);_0x1a3547[_0x443c('0x30')]=_['intersection'](_0x1a3547[_0x443c('0x31')],_0x1a3547['query']);_0x1a209d[_0x443c('0x32')]=_[_0x443c('0x33')](_0x1a3547[_0x443c('0x31')],qs[_0x443c('0x34')](_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x34')]));_0x1a209d[_0x443c('0x32')]=_0x1a209d[_0x443c('0x32')]['length']?_0x1a209d[_0x443c('0x32')]:_0x1a3547[_0x443c('0x31')];if(!_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x35')](_0x443c('0x36'))){_0x1a209d[_0x443c('0x1f')]=qs[_0x443c('0x1f')](_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x1f')]);_0x1a209d[_0x443c('0x1d')]=qs[_0x443c('0x1d')](_0x3c4a8f[_0x443c('0x2e')]['offset']);}_0x1a209d[_0x443c('0x37')]=qs[_0x443c('0x38')](_0x3c4a8f['query'][_0x443c('0x38')]);_0x1a209d['where']=qs[_0x443c('0x30')](_[_0x443c('0x39')](_0x3c4a8f['query'],_0x1a3547[_0x443c('0x30')]),_0x42c4b2);if(_0x3c4a8f[_0x443c('0x2e')]['filter']){_0x1a209d[_0x443c('0x3a')]=_[_0x443c('0x3b')](_0x1a209d[_0x443c('0x3a')],{'$or':_[_0x443c('0x2a')](_0x42c4b2,function(_0x961bfd){if(_0x961bfd[_0x443c('0x2c')]!==_0x443c('0x3c')){var _0x68bffc={};_0x68bffc[_0x961bfd[_0x443c('0x27')]]={'$like':'%'+_0x3c4a8f[_0x443c('0x2e')]['filter']+'%'};return _0x68bffc;}})});}_0x1a209d=_[_0x443c('0x3b')]({},_0x1a209d,_0x3c4a8f[_0x443c('0x3d')]);var _0x5d18e6={'where':_0x1a209d[_0x443c('0x3a')]};return db['SalesforceField']['count'](_0x5d18e6)[_0x443c('0x23')](function(_0x31c608){_0x1c863c['count']=_0x31c608;if(_0x3c4a8f['query'][_0x443c('0x3e')]){_0x1a209d[_0x443c('0x3f')]=[{'all':!![]}];}return db[_0x443c('0x2b')][_0x443c('0x40')](_0x1a209d);})['then'](function(_0x38dda7){_0x1c863c[_0x443c('0x41')]=_0x38dda7;return _0x1c863c;})['then'](respondWithFilteredResult(_0x12f2f3,_0x1a209d))[_0x443c('0x42')](handleError(_0x12f2f3,null));};exports[_0x443c('0x43')]=function(_0xbc998b,_0x4220c2){var _0x11ad8b={'raw':!![],'where':{'id':_0xbc998b[_0x443c('0x44')]['id']}},_0x2c778b={};_0x2c778b[_0x443c('0x31')]=_[_0x443c('0x2f')](db['SalesforceField'][_0x443c('0x45')]);_0x2c778b[_0x443c('0x2e')]=_[_0x443c('0x2f')](_0xbc998b[_0x443c('0x2e')]);_0x2c778b['filters']=_['intersection'](_0x2c778b['model'],_0x2c778b['query']);_0x11ad8b[_0x443c('0x32')]=_[_0x443c('0x33')](_0x2c778b[_0x443c('0x31')],qs[_0x443c('0x34')](_0xbc998b[_0x443c('0x2e')][_0x443c('0x34')]));_0x11ad8b[_0x443c('0x32')]=_0x11ad8b[_0x443c('0x32')]['length']?_0x11ad8b['attributes']:_0x2c778b[_0x443c('0x31')];if(_0xbc998b[_0x443c('0x2e')][_0x443c('0x3e')]){_0x11ad8b['include']=[{'all':!![]}];}_0x11ad8b=_[_0x443c('0x3b')]({},_0x11ad8b,_0xbc998b[_0x443c('0x3d')]);return db[_0x443c('0x2b')][_0x443c('0x46')](_0x11ad8b)[_0x443c('0x23')](handleEntityNotFound(_0x4220c2,null))[_0x443c('0x23')](respondWithResult(_0x4220c2,null))['catch'](handleError(_0x4220c2,null));};exports[_0x443c('0x47')]=function(_0x23b19c,_0x310baf){return db[_0x443c('0x2b')]['create'](_0x23b19c['body'],{})[_0x443c('0x23')](respondWithResult(_0x310baf,0xc9))[_0x443c('0x42')](handleError(_0x310baf,null));};exports['update']=function(_0x4bd43b,_0x1796aa){if(_0x4bd43b[_0x443c('0x48')]['id']){delete _0x4bd43b[_0x443c('0x48')]['id'];}return db[_0x443c('0x2b')][_0x443c('0x46')]({'where':{'id':_0x4bd43b[_0x443c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1796aa,null))[_0x443c('0x23')](saveUpdates(_0x4bd43b[_0x443c('0x48')],null))[_0x443c('0x23')](respondWithResult(_0x1796aa,null))[_0x443c('0x42')](handleError(_0x1796aa,null));};exports[_0x443c('0x24')]=function(_0x2a49f4,_0x277b0b){return db['SalesforceField'][_0x443c('0x46')]({'where':{'id':_0x2a49f4[_0x443c('0x44')]['id']}})[_0x443c('0x23')](handleEntityNotFound(_0x277b0b,null))[_0x443c('0x23')](removeEntity(_0x277b0b,null))[_0x443c('0x42')](handleError(_0x277b0b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ef88b25..d80c4f4 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 _0xcfa2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','FieldId','util','api'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcfa2,0x1da));var _0x2cfa=function(_0x1bc9b5,_0x35828b){_0x1bc9b5=_0x1bc9b5-0x0;var _0x428267=_0xcfa2[_0x1bc9b5];return _0x428267;};'use strict';var _=require('lodash');var util=require(_0x2cfa('0x0'));var logger=require('../../config/logger')(_0x2cfa('0x1'));var moment=require(_0x2cfa('0x2'));var BPromise=require(_0x2cfa('0x3'));var rp=require(_0x2cfa('0x4'));var fs=require('fs');var path=require(_0x2cfa('0x5'));var rimraf=require(_0x2cfa('0x6'));var config=require(_0x2cfa('0x7'));var attributes=require(_0x2cfa('0x8'));module[_0x2cfa('0x9')]=function(_0x34f487,_0x25e473){return _0x34f487[_0x2cfa('0xa')](_0x2cfa('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x2cfa('0xc'),'fields':['idField',_0x2cfa('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d64=['request-promise','rimraf','../../config/environment','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0x3d64,0xbb));var _0x43d6=function(_0x10fa9c,_0xda0e2a){_0x10fa9c=_0x10fa9c-0x0;var _0x45950e=_0x3d64[_0x10fa9c];return _0x45950e;};'use strict';var _=require(_0x43d6('0x0'));var util=require('util');var logger=require(_0x43d6('0x1'))('api');var moment=require(_0x43d6('0x2'));var BPromise=require('bluebird');var rp=require(_0x43d6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43d6('0x4'));var config=require(_0x43d6('0x5'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x1bf07e,_0x562be){return _0x1bf07e['define'](_0x43d6('0x6'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x43d6('0x7'),'fields':[_0x43d6('0x8'),_0x43d6('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 66b4842..3b5c08a 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 _0x0766=['../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','SalesforceField,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4c023b,_0x3c05ef){var _0x15ae18=function(_0xcf8744){while(--_0xcf8744){_0x4c023b['push'](_0x4c023b['shift']());}};_0x15ae18(++_0x3c05ef);}(_0x0766,0x71));var _0x6076=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0766[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6076('0x0'));var moment=require(_0x6076('0x1'));var BPromise=require(_0x6076('0x2'));var rs=require(_0x6076('0x3'));var fs=require('fs');var Redis=require(_0x6076('0x4'));var db=require(_0x6076('0x5'))['db'];var utils=require(_0x6076('0x6'));var logger=require(_0x6076('0x7'))(_0x6076('0x8'));var config=require(_0x6076('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6076('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37c155,_0x1233f2,_0x73a11d){return new BPromise(function(_0x1978af,_0x2f7669){return client[_0x6076('0xb')](_0x37c155,_0x73a11d)[_0x6076('0xc')](function(_0x43c9fb){logger['info']('SalesforceField,\x20%s,\x20%s',_0x1233f2,_0x6076('0xd'));logger[_0x6076('0xe')](_0x6076('0xf'),_0x1233f2,_0x6076('0xd'),JSON['stringify'](_0x43c9fb));if(_0x43c9fb[_0x6076('0x10')]){if(_0x43c9fb[_0x6076('0x10')]['code']===0x1f4){logger[_0x6076('0x10')]('SalesforceField,\x20%s,\x20%s',_0x1233f2,_0x43c9fb[_0x6076('0x10')][_0x6076('0x11')]);return _0x2f7669(_0x43c9fb[_0x6076('0x10')][_0x6076('0x11')]);}logger[_0x6076('0x10')](_0x6076('0x12'),_0x1233f2,_0x43c9fb[_0x6076('0x10')][_0x6076('0x11')]);return _0x1978af(_0x43c9fb[_0x6076('0x10')][_0x6076('0x11')]);}else{logger['info'](_0x6076('0x12'),_0x1233f2,_0x6076('0xd'));_0x1978af(_0x43c9fb[_0x6076('0x13')][_0x6076('0x11')]);}})['catch'](function(_0x1d0c49){logger[_0x6076('0x10')](_0x6076('0x12'),_0x1233f2,_0x1d0c49);_0x2f7669(_0x1d0c49);});});} \ No newline at end of file +var _0x3062=['SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3062,0x133));var _0x2306=function(_0x11fbaa,_0x52dc16){_0x11fbaa=_0x11fbaa-0x0;var _0x1831fd=_0x3062[_0x11fbaa];return _0x1831fd;};'use strict';var _=require(_0x2306('0x0'));var util=require(_0x2306('0x1'));var moment=require(_0x2306('0x2'));var BPromise=require(_0x2306('0x3'));var rs=require(_0x2306('0x4'));var fs=require('fs');var Redis=require(_0x2306('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2306('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2306('0x7'));var jayson=require(_0x2306('0x8'));var client=jayson[_0x2306('0x9')][_0x2306('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x145289,_0x36d083,_0x3fb786){return new BPromise(function(_0x8fa97e,_0x40796c){return client['request'](_0x145289,_0x3fb786)[_0x2306('0xb')](function(_0x1ab386){logger[_0x2306('0xc')](_0x2306('0xd'),_0x36d083,_0x2306('0xe'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x36d083,_0x2306('0xe'),JSON[_0x2306('0xf')](_0x1ab386));if(_0x1ab386[_0x2306('0x10')]){if(_0x1ab386[_0x2306('0x10')][_0x2306('0x11')]===0x1f4){logger['error'](_0x2306('0xd'),_0x36d083,_0x1ab386[_0x2306('0x10')][_0x2306('0x12')]);return _0x40796c(_0x1ab386[_0x2306('0x10')]['message']);}logger[_0x2306('0x10')](_0x2306('0xd'),_0x36d083,_0x1ab386[_0x2306('0x10')][_0x2306('0x12')]);return _0x8fa97e(_0x1ab386[_0x2306('0x10')][_0x2306('0x12')]);}else{logger[_0x2306('0xc')](_0x2306('0xd'),_0x36d083,_0x2306('0xe'));_0x8fa97e(_0x1ab386['result'][_0x2306('0x12')]);}})[_0x2306('0x13')](function(_0x207996){logger[_0x2306('0x10')](_0x2306('0xd'),_0x36d083,_0x207996);_0x40796c(_0x207996);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9c5de87..4ae8ef6 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 _0xac72=['getConfigurations','/:id/fields','getFields','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0x1d05c2,_0x1a6c2d){var _0x4766f5=function(_0xa0df0){while(--_0xa0df0){_0x1d05c2['push'](_0x1d05c2['shift']());}};_0x4766f5(++_0x1a6c2d);}(_0xac72,0x1eb));var _0x2ac7=function(_0x212a5c,_0xb12305){_0x212a5c=_0x212a5c-0x0;var _0x26b619=_0xac72[_0x212a5c];return _0x26b619;};'use strict';var multer=require(_0x2ac7('0x0'));var util=require(_0x2ac7('0x1'));var path=require(_0x2ac7('0x2'));var timeout=require('connect-timeout');var express=require(_0x2ac7('0x3'));var router=express[_0x2ac7('0x4')]();var fs_extra=require(_0x2ac7('0x5'));var auth=require(_0x2ac7('0x6'));var interaction=require(_0x2ac7('0x7'));var config=require(_0x2ac7('0x8'));var controller=require(_0x2ac7('0x9'));router[_0x2ac7('0xa')]('/',auth[_0x2ac7('0xb')](),controller[_0x2ac7('0xc')]);router[_0x2ac7('0xa')](_0x2ac7('0xd'),auth[_0x2ac7('0xb')](),controller['show']);router[_0x2ac7('0xa')](_0x2ac7('0xe'),auth['isAuthenticated'](),controller[_0x2ac7('0xf')]);router[_0x2ac7('0xa')](_0x2ac7('0x10'),auth[_0x2ac7('0xb')](),controller[_0x2ac7('0x11')]);router[_0x2ac7('0x12')]('/',auth[_0x2ac7('0xb')](),controller['create']);router[_0x2ac7('0x12')]('/:id/configurations',auth[_0x2ac7('0xb')](),controller['addConfiguration']);router[_0x2ac7('0x13')](_0x2ac7('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2ac7('0x14')](_0x2ac7('0xd'),auth[_0x2ac7('0xb')](),controller[_0x2ac7('0x15')]);module[_0x2ac7('0x16')]=router; \ No newline at end of file +var _0x067d=['Router','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0x067d,0x1db));var _0xd067=function(_0xfadccd,_0x290136){_0xfadccd=_0xfadccd-0x0;var _0x482ac4=_0x067d[_0xfadccd];return _0x482ac4;};'use strict';var multer=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var path=require(_0xd067('0x2'));var timeout=require(_0xd067('0x3'));var express=require(_0xd067('0x4'));var router=express[_0xd067('0x5')]();var fs_extra=require(_0xd067('0x6'));var auth=require(_0xd067('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd067('0x8'));router[_0xd067('0x9')]('/',auth[_0xd067('0xa')](),controller[_0xd067('0xb')]);router['get'](_0xd067('0xc'),auth[_0xd067('0xa')](),controller[_0xd067('0xd')]);router[_0xd067('0x9')](_0xd067('0xe'),auth[_0xd067('0xa')](),controller[_0xd067('0xf')]);router['get'](_0xd067('0x10'),auth[_0xd067('0xa')](),controller[_0xd067('0x11')]);router[_0xd067('0x12')]('/',auth[_0xd067('0xa')](),controller['create']);router[_0xd067('0x12')](_0xd067('0xe'),auth[_0xd067('0xa')](),controller[_0xd067('0x13')]);router[_0xd067('0x14')](_0xd067('0xc'),auth[_0xd067('0xa')](),controller[_0xd067('0x15')]);router[_0xd067('0x16')](_0xd067('0xc'),auth[_0xd067('0xa')](),controller['destroy']);module[_0xd067('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index a593858..c787adb 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 _0x0c5f=['sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c5f,0x8c));var _0xf0c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c5f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf0c5('0x0'));module[_0xf0c5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf0c5('0x2')],'unique':_0xf0c5('0x3')},'password':{'type':Sequelize[_0xf0c5('0x2')]},'email':{'type':Sequelize[_0xf0c5('0x2')]},'remoteUri':{'type':Sequelize[_0xf0c5('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf0c5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xed10=['exports','STRING','username','sequelize'];(function(_0x8ca7a3,_0x3b62fd){var _0xfb38ef=function(_0xe9a8b0){while(--_0xe9a8b0){_0x8ca7a3['push'](_0x8ca7a3['shift']());}};_0xfb38ef(++_0x3b62fd);}(_0xed10,0x1e3));var _0x0ed1=function(_0x23e5ce,_0x57584d){_0x23e5ce=_0x23e5ce-0x0;var _0x2ce19b=_0xed10[_0x23e5ce];return _0x2ce19b;};'use strict';var Sequelize=require(_0x0ed1('0x0'));module[_0x0ed1('0x1')]={'name':{'type':Sequelize[_0x0ed1('0x2')]},'description':{'type':Sequelize[_0x0ed1('0x2')]},'username':{'type':Sequelize[_0x0ed1('0x2')],'unique':_0x0ed1('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0ed1('0x2')]},'remoteUri':{'type':Sequelize[_0x0ed1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0ed1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5e7c950..64344b7 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 _0x6ce7=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','name','send','index','map','ServicenowAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','findOne','ServicenowConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','upon_reject','sys_updated_on','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','work_end','reopened_time','approval_set','short_description','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','reassignment_count','activity_due','severity','comments','sla_due','approval','reopen_count','sys_tags','upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','stack','Wrong\x20credentials','statusCode','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse'];(function(_0x108904,_0x52c660){var _0x52df85=function(_0x2cc877){while(--_0x2cc877){_0x108904['push'](_0x108904['shift']());}};_0x52df85(++_0x52c660);}(_0x6ce7,0xa3));var _0x76ce=function(_0x40d9c3,_0x41a34c){_0x40d9c3=_0x40d9c3-0x0;var _0x462a5e=_0x6ce7[_0x40d9c3];return _0x462a5e;};'use strict';var emlformat=require(_0x76ce('0x0'));var rimraf=require(_0x76ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76ce('0x2'));var rp=require(_0x76ce('0x3'));var moment=require(_0x76ce('0x4'));var BPromise=require(_0x76ce('0x5'));var Mustache=require('mustache');var util=require(_0x76ce('0x6'));var path=require('path');var sox=require(_0x76ce('0x7'));var csv=require('to-csv');var ejs=require(_0x76ce('0x8'));var fs=require('fs');var fs_extra=require(_0x76ce('0x9'));var _=require(_0x76ce('0xa'));var squel=require(_0x76ce('0xb'));var crypto=require(_0x76ce('0xc'));var jsforce=require(_0x76ce('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x76ce('0xe'));var querystring=require('querystring');var Papa=require(_0x76ce('0xf'));var Redis=require(_0x76ce('0x10'));var authService=require(_0x76ce('0x11'));var qs=require(_0x76ce('0x12'));var as=require(_0x76ce('0x13'));var hardwareService=require(_0x76ce('0x14'));var logger=require(_0x76ce('0x15'))(_0x76ce('0x16'));var utils=require(_0x76ce('0x17'));var config=require(_0x76ce('0x18'));var licenseUtil=require(_0x76ce('0x19'));var db=require(_0x76ce('0x1a'))['db'];var integrations=require(_0x76ce('0x1b'));function respondWithStatusCode(_0x55d996,_0x508726){_0x508726=_0x508726||0xcc;return function(_0x25a69a){if(_0x25a69a){return _0x55d996[_0x76ce('0x1c')](_0x508726);}return _0x55d996[_0x76ce('0x1d')](_0x508726)[_0x76ce('0x1e')]();};}function respondWithResult(_0x575540,_0x4138ec){_0x4138ec=_0x4138ec||0xc8;return function(_0x51a987){if(_0x51a987){return _0x575540[_0x76ce('0x1d')](_0x4138ec)[_0x76ce('0x1f')](_0x51a987);}};}function respondWithFilteredResult(_0x23b96,_0x45dd31){return function(_0x14a914){if(_0x14a914){var _0x14b939=typeof _0x45dd31[_0x76ce('0x20')]===_0x76ce('0x21')&&typeof _0x45dd31[_0x76ce('0x22')]===_0x76ce('0x21');var _0x8e8c96=_0x14a914['count'];var _0x1ace37=_0x14b939?0x0:_0x45dd31['offset'];var _0x503656=_0x14b939?_0x14a914[_0x76ce('0x23')]:_0x45dd31[_0x76ce('0x20')]+_0x45dd31[_0x76ce('0x22')];var _0x28d68b;if(_0x503656>=_0x8e8c96){_0x503656=_0x8e8c96;_0x28d68b=0xc8;}else{_0x28d68b=0xce;}_0x23b96[_0x76ce('0x1d')](_0x28d68b);return _0x23b96['set'](_0x76ce('0x24'),_0x1ace37+'-'+_0x503656+'/'+_0x8e8c96)['json'](_0x14a914);}return null;};}function patchUpdates(_0x3cac5c){return function(_0x5cd458){try{jsonpatch[_0x76ce('0x25')](_0x5cd458,_0x3cac5c,!![]);}catch(_0x163174){return BPromise['reject'](_0x163174);}return _0x5cd458['save']();};}function saveUpdates(_0x4014c6,_0x51334c){return function(_0x30f039){if(_0x30f039){return _0x30f039[_0x76ce('0x26')](_0x4014c6)[_0x76ce('0x27')](function(_0x12fc4f){return _0x12fc4f;});}return null;};}function removeEntity(_0x218e14,_0x4011d2){return function(_0x5df807){if(_0x5df807){return _0x5df807[_0x76ce('0x28')]()[_0x76ce('0x27')](function(){_0x218e14[_0x76ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe50787,_0x2af9f0){return function(_0x771c25){if(!_0x771c25){_0xe50787['sendStatus'](0x194);}return _0x771c25;};}function handleError(_0x1e4745,_0x13ec3f){_0x13ec3f=_0x13ec3f||0x1f4;return function(_0x151516){logger[_0x76ce('0x29')](_0x151516['stack']);if(_0x151516[_0x76ce('0x2a')]){delete _0x151516[_0x76ce('0x2a')];}_0x1e4745[_0x76ce('0x1d')](_0x13ec3f)[_0x76ce('0x2b')](_0x151516);};}exports[_0x76ce('0x2c')]=function(_0x5b436e,_0x3ff95c){var _0x3bcc4f={},_0x1ccab3={},_0x13b8d9={'count':0x0,'rows':[]};var _0xcd282a=_[_0x76ce('0x2d')](db[_0x76ce('0x2e')][_0x76ce('0x2f')],function(_0x12c7ee){return{'name':_0x12c7ee['fieldName'],'type':_0x12c7ee['type'][_0x76ce('0x30')]};});_0x1ccab3[_0x76ce('0x31')]=_['map'](_0xcd282a,_0x76ce('0x2a'));_0x1ccab3[_0x76ce('0x32')]=_[_0x76ce('0x33')](_0x5b436e[_0x76ce('0x32')]);_0x1ccab3[_0x76ce('0x34')]=_['intersection'](_0x1ccab3[_0x76ce('0x31')],_0x1ccab3[_0x76ce('0x32')]);_0x3bcc4f['attributes']=_[_0x76ce('0x35')](_0x1ccab3[_0x76ce('0x31')],qs['fields'](_0x5b436e[_0x76ce('0x32')][_0x76ce('0x36')]));_0x3bcc4f['attributes']=_0x3bcc4f[_0x76ce('0x37')]['length']?_0x3bcc4f[_0x76ce('0x37')]:_0x1ccab3[_0x76ce('0x31')];if(!_0x5b436e[_0x76ce('0x32')]['hasOwnProperty'](_0x76ce('0x38'))){_0x3bcc4f['limit']=qs[_0x76ce('0x22')](_0x5b436e[_0x76ce('0x32')]['limit']);_0x3bcc4f['offset']=qs[_0x76ce('0x20')](_0x5b436e['query'][_0x76ce('0x20')]);}_0x3bcc4f[_0x76ce('0x39')]=qs['sort'](_0x5b436e[_0x76ce('0x32')][_0x76ce('0x3a')]);_0x3bcc4f['where']=qs['filters'](_['pick'](_0x5b436e['query'],_0x1ccab3[_0x76ce('0x34')]),_0xcd282a);if(_0x5b436e['query'][_0x76ce('0x3b')]){_0x3bcc4f[_0x76ce('0x3c')]=_['merge'](_0x3bcc4f[_0x76ce('0x3c')],{'$or':_[_0x76ce('0x2d')](_0xcd282a,function(_0x3746bf){if(_0x3746bf[_0x76ce('0x3d')]!==_0x76ce('0x3e')){var _0x130ab1={};_0x130ab1[_0x3746bf[_0x76ce('0x2a')]]={'$like':'%'+_0x5b436e['query'][_0x76ce('0x3b')]+'%'};return _0x130ab1;}})});}_0x3bcc4f=_[_0x76ce('0x3f')]({},_0x3bcc4f,_0x5b436e[_0x76ce('0x40')]);var _0x363d2f={'where':_0x3bcc4f[_0x76ce('0x3c')]};return db[_0x76ce('0x2e')][_0x76ce('0x23')](_0x363d2f)[_0x76ce('0x27')](function(_0x1cda22){_0x13b8d9[_0x76ce('0x23')]=_0x1cda22;if(_0x5b436e[_0x76ce('0x32')][_0x76ce('0x41')]){_0x3bcc4f[_0x76ce('0x42')]=[{'all':!![]}];}return db[_0x76ce('0x2e')][_0x76ce('0x43')](_0x3bcc4f);})[_0x76ce('0x27')](function(_0x1939f5){_0x13b8d9[_0x76ce('0x44')]=_0x1939f5;return _0x13b8d9;})['then'](respondWithFilteredResult(_0x3ff95c,_0x3bcc4f))[_0x76ce('0x45')](handleError(_0x3ff95c,null));};exports[_0x76ce('0x46')]=function(_0x1a2702,_0x9f93bb){var _0x36db3d={'raw':![],'where':{'id':_0x1a2702[_0x76ce('0x47')]['id']}},_0x4c81a3={};_0x4c81a3['model']=_[_0x76ce('0x33')](db[_0x76ce('0x2e')][_0x76ce('0x2f')]);_0x4c81a3['query']=_[_0x76ce('0x33')](_0x1a2702[_0x76ce('0x32')]);_0x4c81a3[_0x76ce('0x34')]=_[_0x76ce('0x35')](_0x4c81a3[_0x76ce('0x31')],_0x4c81a3[_0x76ce('0x32')]);_0x36db3d[_0x76ce('0x37')]=_[_0x76ce('0x35')](_0x4c81a3['model'],qs[_0x76ce('0x36')](_0x1a2702[_0x76ce('0x32')][_0x76ce('0x36')]));_0x36db3d[_0x76ce('0x37')]=_0x36db3d[_0x76ce('0x37')][_0x76ce('0x48')]?_0x36db3d[_0x76ce('0x37')]:_0x4c81a3[_0x76ce('0x31')];if(_0x1a2702[_0x76ce('0x32')][_0x76ce('0x41')]){_0x36db3d[_0x76ce('0x42')]=[{'all':!![]}];}_0x36db3d=_[_0x76ce('0x3f')]({},_0x36db3d,_0x1a2702['options']);return db[_0x76ce('0x2e')]['find'](_0x36db3d)[_0x76ce('0x27')](handleEntityNotFound(_0x9f93bb,null))[_0x76ce('0x27')](respondWithResult(_0x9f93bb,null))[_0x76ce('0x45')](handleError(_0x9f93bb,null));};exports[_0x76ce('0x49')]=function(_0x3fe5d8,_0x2cff86){return db[_0x76ce('0x2e')][_0x76ce('0x49')](_0x3fe5d8[_0x76ce('0x4a')],{})[_0x76ce('0x27')](respondWithResult(_0x2cff86,0xc9))['catch'](handleError(_0x2cff86,null));};exports[_0x76ce('0x26')]=function(_0x3bf875,_0x15af1d){if(_0x3bf875['body']['id']){delete _0x3bf875[_0x76ce('0x4a')]['id'];}return db[_0x76ce('0x2e')]['find']({'where':{'id':_0x3bf875[_0x76ce('0x47')]['id']}})[_0x76ce('0x27')](handleEntityNotFound(_0x15af1d,null))[_0x76ce('0x27')](saveUpdates(_0x3bf875[_0x76ce('0x4a')],null))['then'](respondWithResult(_0x15af1d,null))['catch'](handleError(_0x15af1d,null));};exports[_0x76ce('0x28')]=function(_0x4082a4,_0x1d388a){return db[_0x76ce('0x2e')]['find']({'where':{'id':_0x4082a4[_0x76ce('0x47')]['id']}})[_0x76ce('0x27')](handleEntityNotFound(_0x1d388a,null))['then'](removeEntity(_0x1d388a,null))['catch'](handleError(_0x1d388a,null));};exports['getConfigurations']=function(_0x43abbb,_0x1bb029,_0x4c92d7){var _0x4430e4={};var _0x2a7858={};var _0x20c0cb;var _0x275987;return db[_0x76ce('0x2e')][_0x76ce('0x4b')]({'where':{'id':_0x43abbb[_0x76ce('0x47')]['id']}})[_0x76ce('0x27')](handleEntityNotFound(_0x1bb029,null))[_0x76ce('0x27')](function(_0x3a533b){if(_0x3a533b){_0x20c0cb=_0x3a533b;_0x2a7858[_0x76ce('0x31')]=_[_0x76ce('0x33')](db[_0x76ce('0x4c')]['rawAttributes']);_0x2a7858['query']=_[_0x76ce('0x33')](_0x43abbb[_0x76ce('0x32')]);_0x2a7858[_0x76ce('0x34')]=_[_0x76ce('0x35')](_0x2a7858[_0x76ce('0x31')],_0x2a7858['query']);_0x4430e4[_0x76ce('0x37')]=_['intersection'](_0x2a7858['model'],qs[_0x76ce('0x36')](_0x43abbb[_0x76ce('0x32')]['fields']));_0x4430e4[_0x76ce('0x37')]=_0x4430e4['attributes'][_0x76ce('0x48')]?_0x4430e4[_0x76ce('0x37')]:_0x2a7858[_0x76ce('0x31')];_0x4430e4['order']=qs[_0x76ce('0x3a')](_0x43abbb[_0x76ce('0x32')][_0x76ce('0x3a')]);_0x4430e4[_0x76ce('0x3c')]=qs[_0x76ce('0x34')](_['pick'](_0x43abbb[_0x76ce('0x32')],_0x2a7858[_0x76ce('0x34')]));if(_0x43abbb[_0x76ce('0x32')][_0x76ce('0x3b')]){_0x4430e4[_0x76ce('0x3c')]=_[_0x76ce('0x3f')](_0x4430e4[_0x76ce('0x3c')],{'$or':_[_0x76ce('0x2d')](_0x4430e4['attributes'],function(_0x417a61){var _0x2982d4={};_0x2982d4[_0x417a61]={'$like':'%'+_0x43abbb[_0x76ce('0x32')][_0x76ce('0x3b')]+'%'};return _0x2982d4;})});}_0x4430e4=_[_0x76ce('0x3f')]({},_0x4430e4,_0x43abbb['options']);return _0x20c0cb['getConfigurations'](_0x4430e4);}})[_0x76ce('0x27')](function(_0x1e7683){if(_0x1e7683){_0x275987=_0x1e7683[_0x76ce('0x48')];if(!_0x43abbb[_0x76ce('0x32')][_0x76ce('0x4d')](_0x76ce('0x38'))){_0x4430e4[_0x76ce('0x22')]=qs[_0x76ce('0x22')](_0x43abbb[_0x76ce('0x32')][_0x76ce('0x22')]);_0x4430e4[_0x76ce('0x20')]=qs[_0x76ce('0x20')](_0x43abbb[_0x76ce('0x32')]['offset']);}return _0x20c0cb['getConfigurations'](_0x4430e4);}})[_0x76ce('0x27')](function(_0x1b962b){if(_0x1b962b){return _0x1b962b?{'count':_0x275987,'rows':_0x1b962b}:null;}})[_0x76ce('0x27')](respondWithResult(_0x1bb029,null))[_0x76ce('0x45')](handleError(_0x1bb029,null));};exports['addConfiguration']=function(_0x20997a,_0x408d88,_0x3151e2){if(_0x20997a[_0x76ce('0x4a')]['id']){delete _0x20997a[_0x76ce('0x4a')]['id'];}return db['ServicenowAccount'][_0x76ce('0x4b')]({'where':{'id':_0x20997a[_0x76ce('0x47')]['id']}})[_0x76ce('0x27')](handleEntityNotFound(_0x408d88,null))[_0x76ce('0x27')](function(_0x119453){if(_0x119453){_0x20997a['body'][_0x76ce('0x4e')]=_0x119453['id'];_0x20997a[_0x76ce('0x4a')][_0x76ce('0x4f')]=integrations[_0x76ce('0x50')](_0x20997a[_0x76ce('0x4a')]['channel'],_0x20997a[_0x76ce('0x4a')]['type']);_0x20997a[_0x76ce('0x4a')][_0x76ce('0x51')]=integrations[_0x76ce('0x52')](_0x20997a['body']['channel'],_0x20997a['body'][_0x76ce('0x3d')]);return db[_0x76ce('0x4c')][_0x76ce('0x49')](_0x20997a[_0x76ce('0x4a')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x76ce('0x53')],'as':_0x76ce('0x51')}]});}return null;})[_0x76ce('0x27')](respondWithResult(_0x408d88,null))['catch'](handleError(_0x408d88,null));};exports[_0x76ce('0x54')]=function(_0xc75c36,_0x45cb26,_0x2d760d){var _0x436091=[_0x76ce('0x55'),_0x76ce('0x56'),_0x76ce('0x57'),_0x76ce('0x58'),_0x76ce('0x59'),_0x76ce('0x5a'),_0x76ce('0x5b'),'severity',_0x76ce('0x5c')];var _0x4cce3e=[_0x76ce('0x5d'),_0x76ce('0x55'),_0x76ce('0x5e'),'watch_list',_0x76ce('0x5f'),_0x76ce('0x60'),'child_incidents',_0x76ce('0x56'),'approval_history',_0x76ce('0x61'),'resolved_by',_0x76ce('0x62'),_0x76ce('0x63'),_0x76ce('0x64'),_0x76ce('0x65'),_0x76ce('0x66'),_0x76ce('0x67'),_0x76ce('0x68'),_0x76ce('0x57'),_0x76ce('0x39'),'calendar_stc','closed_at',_0x76ce('0x69'),_0x76ce('0x6a'),'impact',_0x76ce('0x6b'),_0x76ce('0x6c'),'business_service',_0x76ce('0x6d'),_0x76ce('0x6e'),_0x76ce('0x6f'),_0x76ce('0x70'),_0x76ce('0x71'),'opened_at',_0x76ce('0x72'),'group_list',_0x76ce('0x73'),_0x76ce('0x74'),'resolved_at','caller_id',_0x76ce('0x75'),_0x76ce('0x58'),'work_notes',_0x76ce('0x76'),'close_code','correlation_display',_0x76ce('0x77'),'work_start','assignment_group',_0x76ce('0x78'),_0x76ce('0x79'),_0x76ce('0x7a'),_0x76ce('0x7b'),_0x76ce('0x5a'),_0x76ce('0x7c'),_0x76ce('0x7d'),_0x76ce('0x7e'),_0x76ce('0x7f'),_0x76ce('0x80'),_0x76ce('0x81'),'contact_type',_0x76ce('0x82'),'incident_state',_0x76ce('0x83'),_0x76ce('0x84'),'company',_0x76ce('0x85'),_0x76ce('0x86'),'assigned_to',_0x76ce('0x87'),_0x76ce('0x88'),_0x76ce('0x89'),_0x76ce('0x8a'),'comments_and_work_notes','due_date','sys_mod_count',_0x76ce('0x8b'),_0x76ce('0x8c'),'escalation',_0x76ce('0x8d'),_0x76ce('0x8e'),_0x76ce('0x8f'),_0x76ce('0x5c')];var _0x27205b='';var _0x5f01dd='';var _0x30effc=[];var _0x21861c='';var _0x246cbb='';var _0x2d41c4=[];var _0x38b8ed='';var _0x319c19='';var _0x49d4f0={};var _0x3eac8a='';return db[_0x76ce('0x2e')][_0x76ce('0x4b')]({'where':{'id':_0xc75c36[_0x76ce('0x47')]['id']},'attributes':['id','username',_0x76ce('0x90'),_0x76ce('0x91'),_0x76ce('0x92'),_0x76ce('0x93')]})[_0x76ce('0x27')](handleEntityNotFound(_0x45cb26,null))['then'](function(_0x526cf1){if(_0x526cf1){_0x3eac8a=_0x526cf1[_0x76ce('0x92')];var _0x5bdc52=_0x3eac8a[_0x76ce('0x94')](-0x1);if(_0x5bdc52==='/'){_0x3eac8a=_0x3eac8a['substring'](0x0,_0x3eac8a[_0x76ce('0x95')](_0x5bdc52));}_0x319c19=util[_0x76ce('0x96')](_0x76ce('0x97'),_0x3eac8a);_0x38b8ed=util[_0x76ce('0x96')](_0x76ce('0x98'),_0x3eac8a);_0x49d4f0={'user':_0x526cf1['username'],'pass':_0x526cf1[_0x76ce('0x90')]};var _0x271144={'method':'GET','uri':_0x319c19+_0x76ce('0x99'),'auth':_0x49d4f0,'json':!![]};return rp(_0x271144);}})[_0x76ce('0x27')](function(_0x2a8e1f){if(_0x2a8e1f[_0x76ce('0x9a')][_0x76ce('0x48')]>0x0){_0x27205b=_0x2a8e1f[_0x76ce('0x9a')];}console[_0x76ce('0x9b')](_0x76ce('0x9c'),_0x27205b);_0x2d41c4=[];_0x5f01dd=Object[_0x76ce('0x9d')]([],_0x27205b);_[_0x76ce('0x9e')](_0x5f01dd,function(_0x4a3005){return!_0x436091[_0x76ce('0x9f')](_0x4a3005[_0x76ce('0x2a')]);});_0x5f01dd[_0x76ce('0xa0')](function(_0x563b29){var _0x2c710d=createFieldObject(_0x38b8ed,_0x49d4f0,_0x563b29[_0x76ce('0xa1')],_0x563b29[_0x76ce('0x2a')],_0x563b29[_0x76ce('0xa2')],![]);_0x2d41c4[_0x76ce('0xa3')](_0x2c710d);});return Promise['all'](_0x2d41c4);})[_0x76ce('0x27')](function(_0x3892f3){_0x30effc=_0x3892f3;_0x21861c=Object[_0x76ce('0x9d')]([],_0x27205b);console[_0x76ce('0x9b')]('TCL:\x20_object',_0x27205b);_[_0x76ce('0x9e')](_0x21861c,function(_0x33e432){return _0x4cce3e['includes'](_0x33e432[_0x76ce('0x2a')]);});console[_0x76ce('0x9b')](_0x76ce('0xa4'),_0x21861c);_0x2d41c4=[];_0x21861c[_0x76ce('0xa0')](function(_0x504459){var _0x29dc65=createFieldObject(_0x38b8ed,_0x49d4f0,_0x504459[_0x76ce('0xa1')],_0x504459['name'],_0x504459[_0x76ce('0xa2')],!![]);_0x2d41c4[_0x76ce('0xa3')](_0x29dc65);});return Promise['all'](_0x2d41c4);})[_0x76ce('0x27')](function(_0x18f856){_0x246cbb=_0x18f856;var _0x31f738=_0x30effc[_0x76ce('0xa5')](_0x246cbb);return{'count':_0x31f738[_0x76ce('0x48')],'rows':_0x31f738};})['then'](respondWithResult(_0x45cb26,null))[_0x76ce('0x45')](function(_0x1130fe){console['log'](_0x76ce('0xa6')+_0x1130fe);var _0x41284a=_0xc75c36['query'][_0x76ce('0xa7')]?0x1f4:_0x1130fe['statusCode']||0x1f4;logger['error'](_0x1130fe[_0x76ce('0xa8')]);delete _0x1130fe['name'];if(_0x41284a===0x191){_0x41284a=0x190;}_0x45cb26[_0x76ce('0x1d')](_0x41284a)[_0x76ce('0x2b')](_0xc75c36['query'][_0x76ce('0xa7')]?{'message':_0x76ce('0xa9'),'statusCode':_0x1130fe[_0x76ce('0xaa')]}:_0x1130fe);});};function createFieldObject(_0x288f0a,_0x542000,_0x254638,_0x381f3c,_0x43657f,_0x23d171){return new Promise(function(_0x39c12f,_0x14bcaa){var _0x4b4d3b={'id':_0x381f3c,'name':_0x43657f,'custom':_0x23d171};if(_0x254638==='boolean'){_0x4b4d3b['options']=[{'name':_0x76ce('0xab'),'value':_0x76ce('0xac')},{'name':_0x76ce('0xad'),'value':_0x76ce('0xae')}];_0x39c12f(_0x4b4d3b);}else{var _0x427d93={'method':_0x76ce('0xaf'),'uri':_0x288f0a+_0x76ce('0xb0')+_0x381f3c,'auth':_0x542000,'json':!![]};return rp(_0x427d93)['then'](function(_0x1a11f0){var _0x2e52fd=[];if(_0x1a11f0[_0x76ce('0x9a')][_0x76ce('0x48')]>0x0){_0x1a11f0['result'][_0x76ce('0xa0')](function(_0x6ac938){if(_0x6ac938[_0x76ce('0xb1')]==='false'){var _0x127ad2={'name':_0x6ac938[_0x76ce('0xa2')],'value':_0x6ac938[_0x76ce('0xb2')]};_0x2e52fd[_0x76ce('0xa3')](_0x127ad2);}});}_0x4b4d3b[_0x76ce('0x40')]=_0x2e52fd;if(_0x4b4d3b[_0x76ce('0x40')][_0x76ce('0x48')]>0x0){_0x39c12f(_0x4b4d3b);}else{if(_0x23d171==![]){_0x39c12f();}else{_0x39c12f(_0x4b4d3b);}}});}});} \ No newline at end of file +var _0x395c=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','ServicenowAccount','rows','catch','show','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','channel','type','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','knowledge','subcategory','close_code','severity','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','business_service','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','label','value','zip-dir','request-promise'];(function(_0x26371f,_0x3529d6){var _0x7bf77f=function(_0xaaf7ec){while(--_0xaaf7ec){_0x26371f['push'](_0x26371f['shift']());}};_0x7bf77f(++_0x3529d6);}(_0x395c,0x16c));var _0xc395=function(_0x30ee23,_0x264229){_0x30ee23=_0x30ee23-0x0;var _0x23f637=_0x395c[_0x30ee23];return _0x23f637;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc395('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc395('0x1'));var moment=require(_0xc395('0x2'));var BPromise=require(_0xc395('0x3'));var Mustache=require(_0xc395('0x4'));var util=require(_0xc395('0x5'));var path=require(_0xc395('0x6'));var sox=require(_0xc395('0x7'));var csv=require(_0xc395('0x8'));var ejs=require(_0xc395('0x9'));var fs=require('fs');var fs_extra=require(_0xc395('0xa'));var _=require(_0xc395('0xb'));var squel=require(_0xc395('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc395('0x8'));var querystring=require(_0xc395('0xd'));var Papa=require(_0xc395('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc395('0xf'));var as=require(_0xc395('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc395('0x11'))(_0xc395('0x12'));var utils=require(_0xc395('0x13'));var config=require(_0xc395('0x14'));var licenseUtil=require(_0xc395('0x15'));var db=require(_0xc395('0x16'))['db'];var integrations=require(_0xc395('0x17'));function respondWithStatusCode(_0x515693,_0x5cf9c6){_0x5cf9c6=_0x5cf9c6||0xcc;return function(_0x5d5af9){if(_0x5d5af9){return _0x515693[_0xc395('0x18')](_0x5cf9c6);}return _0x515693[_0xc395('0x19')](_0x5cf9c6)[_0xc395('0x1a')]();};}function respondWithResult(_0x4e5a35,_0x5c2723){_0x5c2723=_0x5c2723||0xc8;return function(_0x4b7b5f){if(_0x4b7b5f){return _0x4e5a35['status'](_0x5c2723)[_0xc395('0x1b')](_0x4b7b5f);}};}function respondWithFilteredResult(_0x3b536f,_0x16d65e){return function(_0x2b0d47){if(_0x2b0d47){var _0x2d81db=typeof _0x16d65e['offset']==='undefined'&&typeof _0x16d65e[_0xc395('0x1c')]==='undefined';var _0x494303=_0x2b0d47[_0xc395('0x1d')];var _0x5626f1=_0x2d81db?0x0:_0x16d65e[_0xc395('0x1e')];var _0x4b26c4=_0x2d81db?_0x2b0d47[_0xc395('0x1d')]:_0x16d65e[_0xc395('0x1e')]+_0x16d65e[_0xc395('0x1c')];var _0x4a1723;if(_0x4b26c4>=_0x494303){_0x4b26c4=_0x494303;_0x4a1723=0xc8;}else{_0x4a1723=0xce;}_0x3b536f[_0xc395('0x19')](_0x4a1723);return _0x3b536f[_0xc395('0x1f')](_0xc395('0x20'),_0x5626f1+'-'+_0x4b26c4+'/'+_0x494303)['json'](_0x2b0d47);}return null;};}function patchUpdates(_0x5e4831){return function(_0x5ce486){try{jsonpatch[_0xc395('0x21')](_0x5ce486,_0x5e4831,!![]);}catch(_0x36b812){return BPromise['reject'](_0x36b812);}return _0x5ce486[_0xc395('0x22')]();};}function saveUpdates(_0x44fb93,_0x4ee612){return function(_0x15f331){if(_0x15f331){return _0x15f331[_0xc395('0x23')](_0x44fb93)[_0xc395('0x24')](function(_0x4aac57){return _0x4aac57;});}return null;};}function removeEntity(_0x1f3589,_0x40d9f3){return function(_0x384fb7){if(_0x384fb7){return _0x384fb7[_0xc395('0x25')]()[_0xc395('0x24')](function(){_0x1f3589[_0xc395('0x19')](0xcc)[_0xc395('0x1a')]();});}};}function handleEntityNotFound(_0x35eb2a,_0x4ca163){return function(_0x2a598b){if(!_0x2a598b){_0x35eb2a[_0xc395('0x18')](0x194);}return _0x2a598b;};}function handleError(_0x51e118,_0x47f57a){_0x47f57a=_0x47f57a||0x1f4;return function(_0x139543){logger[_0xc395('0x26')](_0x139543[_0xc395('0x27')]);if(_0x139543['name']){delete _0x139543[_0xc395('0x28')];}_0x51e118[_0xc395('0x19')](_0x47f57a)[_0xc395('0x29')](_0x139543);};}exports[_0xc395('0x2a')]=function(_0x424eb0,_0x586e9c){var _0x222512={},_0x23d6d4={},_0x9ca6ff={'count':0x0,'rows':[]};var _0x442921=_['map'](db['ServicenowAccount'][_0xc395('0x2b')],function(_0x55cbf7){return{'name':_0x55cbf7['fieldName'],'type':_0x55cbf7['type']['key']};});_0x23d6d4['model']=_[_0xc395('0x2c')](_0x442921,_0xc395('0x28'));_0x23d6d4['query']=_[_0xc395('0x2d')](_0x424eb0[_0xc395('0x2e')]);_0x23d6d4[_0xc395('0x2f')]=_[_0xc395('0x30')](_0x23d6d4[_0xc395('0x31')],_0x23d6d4[_0xc395('0x2e')]);_0x222512[_0xc395('0x32')]=_[_0xc395('0x30')](_0x23d6d4[_0xc395('0x31')],qs[_0xc395('0x33')](_0x424eb0[_0xc395('0x2e')][_0xc395('0x33')]));_0x222512[_0xc395('0x32')]=_0x222512[_0xc395('0x32')][_0xc395('0x34')]?_0x222512[_0xc395('0x32')]:_0x23d6d4[_0xc395('0x31')];if(!_0x424eb0[_0xc395('0x2e')][_0xc395('0x35')](_0xc395('0x36'))){_0x222512['limit']=qs[_0xc395('0x1c')](_0x424eb0['query'][_0xc395('0x1c')]);_0x222512['offset']=qs[_0xc395('0x1e')](_0x424eb0['query']['offset']);}_0x222512[_0xc395('0x37')]=qs[_0xc395('0x38')](_0x424eb0[_0xc395('0x2e')][_0xc395('0x38')]);_0x222512[_0xc395('0x39')]=qs[_0xc395('0x2f')](_[_0xc395('0x3a')](_0x424eb0[_0xc395('0x2e')],_0x23d6d4[_0xc395('0x2f')]),_0x442921);if(_0x424eb0[_0xc395('0x2e')][_0xc395('0x3b')]){_0x222512[_0xc395('0x39')]=_[_0xc395('0x3c')](_0x222512[_0xc395('0x39')],{'$or':_['map'](_0x442921,function(_0x588b1c){if(_0x588b1c['type']!==_0xc395('0x3d')){var _0x48af7e={};_0x48af7e[_0x588b1c[_0xc395('0x28')]]={'$like':'%'+_0x424eb0[_0xc395('0x2e')][_0xc395('0x3b')]+'%'};return _0x48af7e;}})});}_0x222512=_[_0xc395('0x3c')]({},_0x222512,_0x424eb0[_0xc395('0x3e')]);var _0x5be6df={'where':_0x222512[_0xc395('0x39')]};return db['ServicenowAccount'][_0xc395('0x1d')](_0x5be6df)['then'](function(_0x13ce3b){_0x9ca6ff[_0xc395('0x1d')]=_0x13ce3b;if(_0x424eb0['query']['includeAll']){_0x222512[_0xc395('0x3f')]=[{'all':!![]}];}return db[_0xc395('0x40')]['findAll'](_0x222512);})[_0xc395('0x24')](function(_0x4122a2){_0x9ca6ff[_0xc395('0x41')]=_0x4122a2;return _0x9ca6ff;})[_0xc395('0x24')](respondWithFilteredResult(_0x586e9c,_0x222512))[_0xc395('0x42')](handleError(_0x586e9c,null));};exports[_0xc395('0x43')]=function(_0x15fb16,_0x3e5fab){var _0x540188={'raw':![],'where':{'id':_0x15fb16[_0xc395('0x44')]['id']}},_0xca590a={};_0xca590a['model']=_['keys'](db[_0xc395('0x40')]['rawAttributes']);_0xca590a['query']=_[_0xc395('0x2d')](_0x15fb16[_0xc395('0x2e')]);_0xca590a[_0xc395('0x2f')]=_['intersection'](_0xca590a[_0xc395('0x31')],_0xca590a[_0xc395('0x2e')]);_0x540188['attributes']=_[_0xc395('0x30')](_0xca590a[_0xc395('0x31')],qs['fields'](_0x15fb16[_0xc395('0x2e')][_0xc395('0x33')]));_0x540188['attributes']=_0x540188['attributes'][_0xc395('0x34')]?_0x540188['attributes']:_0xca590a['model'];if(_0x15fb16['query']['includeAll']){_0x540188[_0xc395('0x3f')]=[{'all':!![]}];}_0x540188=_[_0xc395('0x3c')]({},_0x540188,_0x15fb16[_0xc395('0x3e')]);return db[_0xc395('0x40')][_0xc395('0x45')](_0x540188)[_0xc395('0x24')](handleEntityNotFound(_0x3e5fab,null))['then'](respondWithResult(_0x3e5fab,null))[_0xc395('0x42')](handleError(_0x3e5fab,null));};exports[_0xc395('0x46')]=function(_0x36fd32,_0x24a5c6){return db[_0xc395('0x40')][_0xc395('0x46')](_0x36fd32[_0xc395('0x47')],{})[_0xc395('0x24')](respondWithResult(_0x24a5c6,0xc9))['catch'](handleError(_0x24a5c6,null));};exports['update']=function(_0x226669,_0x7dac19){if(_0x226669[_0xc395('0x47')]['id']){delete _0x226669[_0xc395('0x47')]['id'];}return db['ServicenowAccount'][_0xc395('0x45')]({'where':{'id':_0x226669[_0xc395('0x44')]['id']}})['then'](handleEntityNotFound(_0x7dac19,null))[_0xc395('0x24')](saveUpdates(_0x226669['body'],null))[_0xc395('0x24')](respondWithResult(_0x7dac19,null))[_0xc395('0x42')](handleError(_0x7dac19,null));};exports[_0xc395('0x25')]=function(_0x22708e,_0x48ea45){return db[_0xc395('0x40')][_0xc395('0x45')]({'where':{'id':_0x22708e['params']['id']}})[_0xc395('0x24')](handleEntityNotFound(_0x48ea45,null))[_0xc395('0x24')](removeEntity(_0x48ea45,null))['catch'](handleError(_0x48ea45,null));};exports[_0xc395('0x48')]=function(_0x446b2b,_0x3476c3,_0x226c0d){var _0x10d73c={};var _0x5506a0={};var _0x3a711b;var _0xbadc29;return db['ServicenowAccount'][_0xc395('0x49')]({'where':{'id':_0x446b2b['params']['id']}})[_0xc395('0x24')](handleEntityNotFound(_0x3476c3,null))[_0xc395('0x24')](function(_0x5763bb){if(_0x5763bb){_0x3a711b=_0x5763bb;_0x5506a0[_0xc395('0x31')]=_['keys'](db[_0xc395('0x4a')][_0xc395('0x2b')]);_0x5506a0['query']=_['keys'](_0x446b2b['query']);_0x5506a0[_0xc395('0x2f')]=_[_0xc395('0x30')](_0x5506a0[_0xc395('0x31')],_0x5506a0[_0xc395('0x2e')]);_0x10d73c[_0xc395('0x32')]=_[_0xc395('0x30')](_0x5506a0['model'],qs[_0xc395('0x33')](_0x446b2b['query']['fields']));_0x10d73c[_0xc395('0x32')]=_0x10d73c[_0xc395('0x32')][_0xc395('0x34')]?_0x10d73c['attributes']:_0x5506a0[_0xc395('0x31')];_0x10d73c['order']=qs[_0xc395('0x38')](_0x446b2b[_0xc395('0x2e')]['sort']);_0x10d73c[_0xc395('0x39')]=qs['filters'](_[_0xc395('0x3a')](_0x446b2b[_0xc395('0x2e')],_0x5506a0[_0xc395('0x2f')]));if(_0x446b2b[_0xc395('0x2e')][_0xc395('0x3b')]){_0x10d73c[_0xc395('0x39')]=_[_0xc395('0x3c')](_0x10d73c[_0xc395('0x39')],{'$or':_[_0xc395('0x2c')](_0x10d73c[_0xc395('0x32')],function(_0x49fb2f){var _0x31ec93={};_0x31ec93[_0x49fb2f]={'$like':'%'+_0x446b2b[_0xc395('0x2e')][_0xc395('0x3b')]+'%'};return _0x31ec93;})});}_0x10d73c=_['merge']({},_0x10d73c,_0x446b2b[_0xc395('0x3e')]);return _0x3a711b[_0xc395('0x48')](_0x10d73c);}})['then'](function(_0x38ace5){if(_0x38ace5){_0xbadc29=_0x38ace5[_0xc395('0x34')];if(!_0x446b2b[_0xc395('0x2e')][_0xc395('0x35')](_0xc395('0x36'))){_0x10d73c[_0xc395('0x1c')]=qs[_0xc395('0x1c')](_0x446b2b['query'][_0xc395('0x1c')]);_0x10d73c[_0xc395('0x1e')]=qs['offset'](_0x446b2b[_0xc395('0x2e')][_0xc395('0x1e')]);}return _0x3a711b[_0xc395('0x48')](_0x10d73c);}})[_0xc395('0x24')](function(_0x58535b){if(_0x58535b){return _0x58535b?{'count':_0xbadc29,'rows':_0x58535b}:null;}})[_0xc395('0x24')](respondWithResult(_0x3476c3,null))[_0xc395('0x42')](handleError(_0x3476c3,null));};exports[_0xc395('0x4b')]=function(_0x4ce243,_0x46bf17,_0x587c28){if(_0x4ce243[_0xc395('0x47')]['id']){delete _0x4ce243[_0xc395('0x47')]['id'];}return db[_0xc395('0x40')][_0xc395('0x49')]({'where':{'id':_0x4ce243[_0xc395('0x44')]['id']}})['then'](handleEntityNotFound(_0x46bf17,null))['then'](function(_0x3b1952){if(_0x3b1952){_0x4ce243[_0xc395('0x47')][_0xc395('0x4c')]=_0x3b1952['id'];_0x4ce243[_0xc395('0x47')]['Subjects']=integrations['getSubjects'](_0x4ce243[_0xc395('0x47')][_0xc395('0x4d')],_0x4ce243[_0xc395('0x47')][_0xc395('0x4e')]);_0x4ce243[_0xc395('0x47')][_0xc395('0x4f')]=integrations[_0xc395('0x50')](_0x4ce243[_0xc395('0x47')][_0xc395('0x4d')],_0x4ce243[_0xc395('0x47')]['type']);return db[_0xc395('0x4a')][_0xc395('0x46')](_0x4ce243['body'],{'include':[{'model':db[_0xc395('0x51')],'as':_0xc395('0x52')},{'model':db[_0xc395('0x51')],'as':_0xc395('0x4f')}]});}return null;})[_0xc395('0x24')](respondWithResult(_0x46bf17,null))['catch'](handleError(_0x46bf17,null));};exports[_0xc395('0x53')]=function(_0xdf2f24,_0x19c03f,_0x3c3dbb){var _0x51ed75=['made_sla','hold_reason',_0xc395('0x54'),_0xc395('0x55'),_0xc395('0x56'),'notify','incident_state',_0xc395('0x57'),'category'];var _0x30c8e7=[_0xc395('0x58'),'made_sla',_0xc395('0x59'),_0xc395('0x5a'),_0xc395('0x5b'),'sys_updated_on',_0xc395('0x5c'),'hold_reason',_0xc395('0x5d'),_0xc395('0x5e'),'resolved_by','sys_updated_by',_0xc395('0x5f'),'user_input',_0xc395('0x60'),_0xc395('0x61'),_0xc395('0x62'),_0xc395('0x63'),'knowledge',_0xc395('0x37'),_0xc395('0x64'),_0xc395('0x65'),'cmdb_ci',_0xc395('0x66'),'impact','active','work_notes_list',_0xc395('0x67'),'priority',_0xc395('0x68'),'rfc','time_worked',_0xc395('0x69'),_0xc395('0x6a'),_0xc395('0x6b'),_0xc395('0x6c'),_0xc395('0x6d'),_0xc395('0x6e'),_0xc395('0x6f'),_0xc395('0x70'),'approval_set',_0xc395('0x55'),'work_notes',_0xc395('0x71'),_0xc395('0x56'),_0xc395('0x72'),_0xc395('0x73'),_0xc395('0x74'),_0xc395('0x75'),_0xc395('0x76'),_0xc395('0x77'),_0xc395('0x78'),_0xc395('0x79'),_0xc395('0x7a'),_0xc395('0x7b'),_0xc395('0x7c'),'closed_by',_0xc395('0x7d'),_0xc395('0x7e'),_0xc395('0x7f'),_0xc395('0x80'),'reopened_by',_0xc395('0x81'),_0xc395('0x82'),_0xc395('0x83'),_0xc395('0x84'),_0xc395('0x85'),_0xc395('0x86'),_0xc395('0x87'),_0xc395('0x57'),_0xc395('0x88'),_0xc395('0x89'),'approval',_0xc395('0x8a'),_0xc395('0x8b'),'sys_mod_count',_0xc395('0x8c'),_0xc395('0x8d'),_0xc395('0x8e'),_0xc395('0x8f'),_0xc395('0x90'),_0xc395('0x91'),_0xc395('0x92')];var _0x6e5dfe='';var _0x349225='';var _0x3e44cb=[];var _0x5d9545='';var _0x6e3f02='';var _0x38056f=[];var _0x112ebc='';var _0xed98cc='';var _0x2544ab={};var _0x120647='';return db[_0xc395('0x40')][_0xc395('0x49')]({'where':{'id':_0xdf2f24[_0xc395('0x44')]['id']},'attributes':['id','username',_0xc395('0x93'),'email',_0xc395('0x94'),_0xc395('0x95')]})['then'](handleEntityNotFound(_0x19c03f,null))['then'](function(_0x36856e){if(_0x36856e){_0x120647=_0x36856e['remoteUri'];var _0x37ea76=_0x120647[_0xc395('0x96')](-0x1);if(_0x37ea76==='/'){_0x120647=_0x120647[_0xc395('0x97')](0x0,_0x120647[_0xc395('0x98')](_0x37ea76));}_0xed98cc=util['format'](_0xc395('0x99'),_0x120647);_0x112ebc=util[_0xc395('0x9a')](_0xc395('0x9b'),_0x120647);_0x2544ab={'user':_0x36856e[_0xc395('0x9c')],'pass':_0x36856e[_0xc395('0x93')]};var _0x2a2698={'method':_0xc395('0x9d'),'uri':_0xed98cc+_0xc395('0x9e'),'auth':_0x2544ab,'json':!![]};return rp(_0x2a2698);}})['then'](function(_0x3c90d3){if(_0x3c90d3[_0xc395('0x9f')]['length']>0x0){_0x6e5dfe=_0x3c90d3[_0xc395('0x9f')];}console[_0xc395('0xa0')]('incident\x20table\x20objects',_0x6e5dfe);_0x38056f=[];_0x349225=Object['assign']([],_0x6e5dfe);_[_0xc395('0xa1')](_0x349225,function(_0x21e90a){return!_0x51ed75[_0xc395('0xa2')](_0x21e90a[_0xc395('0x28')]);});_0x349225[_0xc395('0xa3')](function(_0x17e4c3){var _0x21c378=createFieldObject(_0x112ebc,_0x2544ab,_0x17e4c3[_0xc395('0xa4')],_0x17e4c3[_0xc395('0x28')],_0x17e4c3['label'],![]);_0x38056f[_0xc395('0xa5')](_0x21c378);});return Promise[_0xc395('0xa6')](_0x38056f);})[_0xc395('0x24')](function(_0x300f9e){_0x3e44cb=_0x300f9e;_0x5d9545=Object['assign']([],_0x6e5dfe);console[_0xc395('0xa0')](_0xc395('0xa7'),_0x6e5dfe);_['remove'](_0x5d9545,function(_0x15fb6c){return _0x30c8e7['includes'](_0x15fb6c[_0xc395('0x28')]);});console[_0xc395('0xa0')](_0xc395('0xa8'),_0x5d9545);_0x38056f=[];_0x5d9545[_0xc395('0xa3')](function(_0x5043d6){var _0x19208a=createFieldObject(_0x112ebc,_0x2544ab,_0x5043d6['internalType'],_0x5043d6[_0xc395('0x28')],_0x5043d6['label'],!![]);_0x38056f[_0xc395('0xa5')](_0x19208a);});return Promise[_0xc395('0xa6')](_0x38056f);})['then'](function(_0x5d3f4f){_0x6e3f02=_0x5d3f4f;var _0xae6e64=_0x3e44cb[_0xc395('0xa9')](_0x6e3f02);return{'count':_0xae6e64['length'],'rows':_0xae6e64};})[_0xc395('0x24')](respondWithResult(_0x19c03f,null))[_0xc395('0x42')](function(_0xc27e50){console[_0xc395('0xa0')](_0xc395('0xaa')+_0xc27e50);var _0x5a9a58=_0xdf2f24[_0xc395('0x2e')][_0xc395('0xab')]?0x1f4:_0xc27e50[_0xc395('0xac')]||0x1f4;logger[_0xc395('0x26')](_0xc27e50['stack']);delete _0xc27e50[_0xc395('0x28')];if(_0x5a9a58===0x191){_0x5a9a58=0x190;}_0x19c03f[_0xc395('0x19')](_0x5a9a58)['send'](_0xdf2f24[_0xc395('0x2e')]['test']?{'message':_0xc395('0xad'),'statusCode':_0xc27e50['statusCode']}:_0xc27e50);});};function createFieldObject(_0x4778ff,_0x75274,_0x384b99,_0x4d9845,_0x1540dc,_0x35aff8){return new Promise(function(_0x360977,_0xd4498a){var _0x226c68={'id':_0x4d9845,'name':_0x1540dc,'custom':_0x35aff8};if(_0x384b99===_0xc395('0xae')){_0x226c68['options']=[{'name':_0xc395('0xaf'),'value':_0xc395('0xb0')},{'name':_0xc395('0xb1'),'value':'false'}];_0x360977(_0x226c68);}else{var _0x379c29={'method':_0xc395('0x9d'),'uri':_0x4778ff+_0xc395('0xb2')+_0x4d9845,'auth':_0x75274,'json':!![]};return rp(_0x379c29)['then'](function(_0x5da646){var _0xecfa61=[];if(_0x5da646[_0xc395('0x9f')][_0xc395('0x34')]>0x0){_0x5da646[_0xc395('0x9f')]['forEach'](function(_0x25a739){if(_0x25a739[_0xc395('0xb3')]===_0xc395('0xb4')){var _0x47c87b={'name':_0x25a739[_0xc395('0xb5')],'value':_0x25a739[_0xc395('0xb6')]};_0xecfa61['push'](_0x47c87b);}});}_0x226c68[_0xc395('0x3e')]=_0xecfa61;if(_0x226c68[_0xc395('0x3e')][_0xc395('0x34')]>0x0){_0x360977(_0x226c68);}else{if(_0x35aff8==![]){_0x360977();}else{_0x360977(_0x226c68);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b81f6b1..906e609 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 _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0xa1bfdc,_0x512b8c){var _0x2f0b16=function(_0x2b2e9a){while(--_0x2b2e9a){_0xa1bfdc['push'](_0xa1bfdc['shift']());}};_0x2f0b16(++_0x512b8c);}(_0x4819,0xcd));var _0x9481=function(_0x25bd2a,_0xc8fe7a){_0x25bd2a=_0x25bd2a-0x0;var _0xb6b479=_0x4819[_0x25bd2a];return _0xb6b479;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eea=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2e0486,_0x53cba3){_0x2e0486=_0x2e0486-0x0;var _0x5a10ba=_0x3eea[_0x2e0486];return _0x5a10ba;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));var integrations=require(_0xa3ee('0xa'));module[_0xa3ee('0xb')]=function(_0x5776bb,_0x538bf9){return _0x5776bb[_0xa3ee('0xc')]('ServicenowAccount',attributes,{'tableName':_0xa3ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 6f45df8..2d9eb3c 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 _0xd3a4=['ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x397767,_0xe95633){var _0x401997=function(_0x3a67d5){while(--_0x3a67d5){_0x397767['push'](_0x397767['shift']());}};_0x401997(++_0xe95633);}(_0xd3a4,0xab));var _0x4d3a=function(_0x2c45a5,_0x5ef843){_0x2c45a5=_0x2c45a5-0x0;var _0x291748=_0xd3a4[_0x2c45a5];return _0x291748;};'use strict';var _=require(_0x4d3a('0x0'));var util=require(_0x4d3a('0x1'));var moment=require(_0x4d3a('0x2'));var BPromise=require(_0x4d3a('0x3'));var rs=require(_0x4d3a('0x4'));var fs=require('fs');var Redis=require(_0x4d3a('0x5'));var db=require(_0x4d3a('0x6'))['db'];var utils=require(_0x4d3a('0x7'));var logger=require(_0x4d3a('0x8'))(_0x4d3a('0x9'));var config=require(_0x4d3a('0xa'));var jayson=require(_0x4d3a('0xb'));var client=jayson[_0x4d3a('0xc')][_0x4d3a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21c0fd,_0x154339,_0x465b18){return new BPromise(function(_0x3f0e06,_0x360411){return client[_0x4d3a('0xe')](_0x21c0fd,_0x465b18)['then'](function(_0x4f7891){logger[_0x4d3a('0xf')](_0x4d3a('0x10'),_0x154339,_0x4d3a('0x11'));logger[_0x4d3a('0x12')](_0x4d3a('0x13'),_0x154339,'request\x20sent',JSON['stringify'](_0x4f7891));if(_0x4f7891[_0x4d3a('0x14')]){if(_0x4f7891[_0x4d3a('0x14')][_0x4d3a('0x15')]===0x1f4){logger[_0x4d3a('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x154339,_0x4f7891[_0x4d3a('0x14')][_0x4d3a('0x16')]);return _0x360411(_0x4f7891[_0x4d3a('0x14')]['message']);}logger[_0x4d3a('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x154339,_0x4f7891[_0x4d3a('0x14')][_0x4d3a('0x16')]);return _0x3f0e06(_0x4f7891[_0x4d3a('0x14')][_0x4d3a('0x16')]);}else{logger['info'](_0x4d3a('0x10'),_0x154339,'request\x20sent');_0x3f0e06(_0x4f7891[_0x4d3a('0x17')][_0x4d3a('0x16')]);}})[_0x4d3a('0x18')](function(_0x180af0){logger['error'](_0x4d3a('0x10'),_0x154339,_0x180af0);_0x360411(_0x180af0);});});}exports['GetServicenowAccount']=function(_0x2b599d){var _0x52eab5=this;return new Promise(function(_0x24c4b6,_0x4ffcbd){return db[_0x4d3a('0x19')][_0x4d3a('0x1a')]({'raw':_0x2b599d[_0x4d3a('0x1b')]?_0x2b599d[_0x4d3a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2b599d[_0x4d3a('0x1b')]?_0x2b599d[_0x4d3a('0x1b')][_0x4d3a('0x1c')]||null:null,'attributes':_0x2b599d[_0x4d3a('0x1b')]?_0x2b599d[_0x4d3a('0x1b')][_0x4d3a('0x1d')]||null:null,'limit':_0x2b599d['options']?_0x2b599d[_0x4d3a('0x1b')][_0x4d3a('0x1e')]||null:null,'include':_0x2b599d['options']?_0x2b599d[_0x4d3a('0x1b')][_0x4d3a('0x1f')]?_[_0x4d3a('0x20')](_0x2b599d[_0x4d3a('0x1b')][_0x4d3a('0x1f')],function(_0x4cef6a){return{'model':db[_0x4cef6a[_0x4d3a('0x21')]],'as':_0x4cef6a['as'],'attributes':_0x4cef6a[_0x4d3a('0x1d')],'include':_0x4cef6a[_0x4d3a('0x1f')]?_['map'](_0x4cef6a[_0x4d3a('0x1f')],function(_0x3f736d){return{'model':db[_0x3f736d[_0x4d3a('0x21')]],'as':_0x3f736d['as'],'attributes':_0x3f736d['attributes'],'include':_0x3f736d[_0x4d3a('0x1f')]?_[_0x4d3a('0x20')](_0x3f736d[_0x4d3a('0x1f')],function(_0x5454fa){return{'model':db[_0x5454fa[_0x4d3a('0x21')]],'as':_0x5454fa['as'],'attributes':_0x5454fa[_0x4d3a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4174e8){logger[_0x4d3a('0xf')](_0x4d3a('0x22'),_0x2b599d);logger[_0x4d3a('0x12')](_0x4d3a('0x22'),_0x2b599d,JSON[_0x4d3a('0x23')](_0x4174e8));_0x24c4b6(_0x4174e8);})[_0x4d3a('0x18')](function(_0x153b55){logger[_0x4d3a('0x14')](_0x4d3a('0x22'),_0x153b55[_0x4d3a('0x16')],_0x2b599d);_0x4ffcbd(_0x52eab5[_0x4d3a('0x14')](0x1f4,_0x153b55['message']));});});};exports['ShowServicenowAccount']=function(_0x24c359){var _0x546576=this;return new Promise(function(_0x502a31,_0x5630df){return db[_0x4d3a('0x19')][_0x4d3a('0x24')]({'raw':_0x24c359['options']?_0x24c359[_0x4d3a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x24c359[_0x4d3a('0x1b')]?_0x24c359[_0x4d3a('0x1b')][_0x4d3a('0x1c')]||null:null,'attributes':_0x24c359[_0x4d3a('0x1b')]?_0x24c359['options'][_0x4d3a('0x1d')]||null:null,'include':_0x24c359[_0x4d3a('0x1b')]?_0x24c359[_0x4d3a('0x1b')]['include']?_[_0x4d3a('0x20')](_0x24c359[_0x4d3a('0x1b')][_0x4d3a('0x1f')],function(_0x3e8c61){return{'model':db[_0x3e8c61[_0x4d3a('0x21')]],'as':_0x3e8c61['as'],'attributes':_0x3e8c61['attributes'],'include':_0x3e8c61[_0x4d3a('0x1f')]?_['map'](_0x3e8c61[_0x4d3a('0x1f')],function(_0x42dd44){return{'model':db[_0x42dd44['model']],'as':_0x42dd44['as'],'attributes':_0x42dd44[_0x4d3a('0x1d')],'include':_0x42dd44[_0x4d3a('0x1f')]?_['map'](_0x42dd44[_0x4d3a('0x1f')],function(_0x1c6ea6){return{'model':db[_0x1c6ea6['model']],'as':_0x1c6ea6['as'],'attributes':_0x1c6ea6[_0x4d3a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x141ff1){logger['info'](_0x4d3a('0x25'),_0x24c359);logger[_0x4d3a('0x12')]('ShowServicenowAccount',_0x24c359,JSON[_0x4d3a('0x23')](_0x141ff1));_0x502a31(_0x141ff1);})[_0x4d3a('0x18')](function(_0x54e440){logger['error'](_0x4d3a('0x25'),_0x54e440['message'],_0x24c359);_0x5630df(_0x546576[_0x4d3a('0x14')](0x1f4,_0x54e440[_0x4d3a('0x16')]));});});}; \ No newline at end of file +var _0x7716=['map','include','model','ShowServicenowAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit'];(function(_0x4aede2,_0x2960d6){var _0xf38bd1=function(_0x25d102){while(--_0x25d102){_0x4aede2['push'](_0x4aede2['shift']());}};_0xf38bd1(++_0x2960d6);}(_0x7716,0x6a));var _0x6771=function(_0x1ae8ab,_0x6e5c2a){_0x1ae8ab=_0x1ae8ab-0x0;var _0x1ad705=_0x7716[_0x1ae8ab];return _0x1ad705;};'use strict';var _=require(_0x6771('0x0'));var util=require('util');var moment=require(_0x6771('0x1'));var BPromise=require(_0x6771('0x2'));var rs=require(_0x6771('0x3'));var fs=require('fs');var Redis=require(_0x6771('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6771('0x5'));var logger=require(_0x6771('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6771('0x7'));var client=jayson[_0x6771('0x8')][_0x6771('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x514dd2,_0x64edd9,_0x4a2d1d){return new BPromise(function(_0x41c880,_0x1be9a1){return client['request'](_0x514dd2,_0x4a2d1d)[_0x6771('0xa')](function(_0x298b6b){logger[_0x6771('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x64edd9,'request\x20sent');logger[_0x6771('0xc')](_0x6771('0xd'),_0x64edd9,_0x6771('0xe'),JSON[_0x6771('0xf')](_0x298b6b));if(_0x298b6b[_0x6771('0x10')]){if(_0x298b6b['error'][_0x6771('0x11')]===0x1f4){logger['error'](_0x6771('0x12'),_0x64edd9,_0x298b6b[_0x6771('0x10')][_0x6771('0x13')]);return _0x1be9a1(_0x298b6b[_0x6771('0x10')][_0x6771('0x13')]);}logger[_0x6771('0x10')](_0x6771('0x12'),_0x64edd9,_0x298b6b[_0x6771('0x10')][_0x6771('0x13')]);return _0x41c880(_0x298b6b['error'][_0x6771('0x13')]);}else{logger[_0x6771('0xb')](_0x6771('0x12'),_0x64edd9,_0x6771('0xe'));_0x41c880(_0x298b6b[_0x6771('0x14')][_0x6771('0x13')]);}})[_0x6771('0x15')](function(_0x35ade2){logger[_0x6771('0x10')](_0x6771('0x12'),_0x64edd9,_0x35ade2);_0x1be9a1(_0x35ade2);});});}exports[_0x6771('0x16')]=function(_0x46f6ee){var _0x1eb837=this;return new Promise(function(_0x24336d,_0x2b9b83){return db[_0x6771('0x17')][_0x6771('0x18')]({'raw':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')][_0x6771('0x1a')]===undefined?!![]:![]:!![],'where':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')][_0x6771('0x1b')]||null:null,'attributes':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')][_0x6771('0x1c')]||null:null,'limit':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')][_0x6771('0x1d')]||null:null,'include':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')]['include']?_[_0x6771('0x1e')](_0x46f6ee['options'][_0x6771('0x1f')],function(_0x296db3){return{'model':db[_0x296db3[_0x6771('0x20')]],'as':_0x296db3['as'],'attributes':_0x296db3['attributes'],'include':_0x296db3[_0x6771('0x1f')]?_['map'](_0x296db3[_0x6771('0x1f')],function(_0x52dffb){return{'model':db[_0x52dffb[_0x6771('0x20')]],'as':_0x52dffb['as'],'attributes':_0x52dffb['attributes'],'include':_0x52dffb[_0x6771('0x1f')]?_[_0x6771('0x1e')](_0x52dffb['include'],function(_0x35c6ff){return{'model':db[_0x35c6ff['model']],'as':_0x35c6ff['as'],'attributes':_0x35c6ff[_0x6771('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32280f){logger['info'](_0x6771('0x16'),_0x46f6ee);logger['debug'](_0x6771('0x16'),_0x46f6ee,JSON[_0x6771('0xf')](_0x32280f));_0x24336d(_0x32280f);})[_0x6771('0x15')](function(_0x381dfe){logger['error'](_0x6771('0x16'),_0x381dfe[_0x6771('0x13')],_0x46f6ee);_0x2b9b83(_0x1eb837[_0x6771('0x10')](0x1f4,_0x381dfe['message']));});});};exports[_0x6771('0x21')]=function(_0x396c38){var _0x449ebb=this;return new Promise(function(_0x219bf8,_0x30cde8){return db[_0x6771('0x17')]['find']({'raw':_0x396c38['options']?_0x396c38[_0x6771('0x19')][_0x6771('0x1a')]===undefined?!![]:![]:!![],'where':_0x396c38['options']?_0x396c38[_0x6771('0x19')]['where']||null:null,'attributes':_0x396c38[_0x6771('0x19')]?_0x396c38[_0x6771('0x19')][_0x6771('0x1c')]||null:null,'include':_0x396c38[_0x6771('0x19')]?_0x396c38[_0x6771('0x19')][_0x6771('0x1f')]?_[_0x6771('0x1e')](_0x396c38[_0x6771('0x19')][_0x6771('0x1f')],function(_0x469c72){return{'model':db[_0x469c72[_0x6771('0x20')]],'as':_0x469c72['as'],'attributes':_0x469c72[_0x6771('0x1c')],'include':_0x469c72[_0x6771('0x1f')]?_[_0x6771('0x1e')](_0x469c72[_0x6771('0x1f')],function(_0x2d8983){return{'model':db[_0x2d8983[_0x6771('0x20')]],'as':_0x2d8983['as'],'attributes':_0x2d8983[_0x6771('0x1c')],'include':_0x2d8983['include']?_[_0x6771('0x1e')](_0x2d8983['include'],function(_0x1786ad){return{'model':db[_0x1786ad[_0x6771('0x20')]],'as':_0x1786ad['as'],'attributes':_0x1786ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x6771('0xa')](function(_0x31b973){logger['info']('ShowServicenowAccount',_0x396c38);logger[_0x6771('0xc')](_0x6771('0x21'),_0x396c38,JSON[_0x6771('0xf')](_0x31b973));_0x219bf8(_0x31b973);})['catch'](function(_0x48d163){logger['error'](_0x6771('0x21'),_0x48d163[_0x6771('0x13')],_0x396c38);_0x30cde8(_0x449ebb['error'](0x1f4,_0x48d163[_0x6771('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e6d4d12..e7b1258 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 _0x0435=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','/:id','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0x0435,0xf8));var _0x5043=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x0435[_0x1a0600];return _0x734670;};'use strict';var multer=require(_0x5043('0x0'));var util=require(_0x5043('0x1'));var path=require('path');var timeout=require(_0x5043('0x2'));var express=require(_0x5043('0x3'));var router=express[_0x5043('0x4')]();var fs_extra=require(_0x5043('0x5'));var auth=require(_0x5043('0x6'));var interaction=require(_0x5043('0x7'));var config=require('../../config/environment');var controller=require(_0x5043('0x8'));router[_0x5043('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5043('0x9')](_0x5043('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x5043('0x9')](_0x5043('0xb'),auth[_0x5043('0xc')](),controller[_0x5043('0xd')]);router[_0x5043('0x9')](_0x5043('0xe'),auth['isAuthenticated'](),controller[_0x5043('0xf')]);router[_0x5043('0x9')]('/:id/descriptions',auth[_0x5043('0xc')](),controller['getDescriptions']);router['post']('/',auth[_0x5043('0xc')](),controller['create']);router[_0x5043('0x10')](_0x5043('0xa'),auth[_0x5043('0xc')](),controller[_0x5043('0x11')]);router[_0x5043('0x12')](_0x5043('0xa'),auth[_0x5043('0xc')](),controller[_0x5043('0x13')]);module[_0x5043('0x14')]=router; \ No newline at end of file +var _0x29b7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','/:id/descriptions','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29b7,0x1b5));var _0x729b=function(_0x3c437d,_0x500e32){_0x3c437d=_0x3c437d-0x0;var _0x286dd4=_0x29b7[_0x3c437d];return _0x286dd4;};'use strict';var multer=require(_0x729b('0x0'));var util=require(_0x729b('0x1'));var path=require(_0x729b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x729b('0x3')]();var fs_extra=require(_0x729b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x729b('0x5'));var config=require(_0x729b('0x6'));var controller=require(_0x729b('0x7'));router[_0x729b('0x8')]('/',auth[_0x729b('0x9')](),controller['index']);router[_0x729b('0x8')](_0x729b('0xa'),auth[_0x729b('0x9')](),controller[_0x729b('0xb')]);router[_0x729b('0x8')]('/:id/fields',auth[_0x729b('0x9')](),controller[_0x729b('0xc')]);router[_0x729b('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x729b('0xd')]);router[_0x729b('0x8')](_0x729b('0xe'),auth[_0x729b('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x729b('0x9')](),controller['create']);router[_0x729b('0xf')](_0x729b('0xa'),auth[_0x729b('0x9')](),controller[_0x729b('0x10')]);router[_0x729b('0x11')](_0x729b('0xa'),auth['isAuthenticated'](),controller[_0x729b('0x12')]);module[_0x729b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 024dcd2..227aae2 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 _0xd5fe=['STRING','sequelize','exports'];(function(_0x1fce89,_0x2a243d){var _0x5c00d0=function(_0x3f59e0){while(--_0x3f59e0){_0x1fce89['push'](_0x1fce89['shift']());}};_0x5c00d0(++_0x2a243d);}(_0xd5fe,0x1ae));var _0xed5f=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xd5fe[_0x494d1f];return _0x457b6e;};'use strict';var Sequelize=require(_0xed5f('0x0'));module[_0xed5f('0x1')]={'name':{'type':Sequelize[_0xed5f('0x2')]},'description':{'type':Sequelize[_0xed5f('0x2')]}}; \ No newline at end of file +var _0x6b60=['exports','STRING'];(function(_0x2b2580,_0x5ac3f2){var _0x50c840=function(_0x2af697){while(--_0x2af697){_0x2b2580['push'](_0x2b2580['shift']());}};_0x50c840(++_0x5ac3f2);}(_0x6b60,0x130));var _0x06b6=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0x6b60[_0x4eb6ec];return _0x58881b;};'use strict';var Sequelize=require('sequelize');module[_0x06b6('0x0')]={'name':{'type':Sequelize[_0x06b6('0x1')]},'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 bcdaa8b..f51edc3 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 _0xc8ec=['Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','destroy','ServicenowField','length','pick','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set'];(function(_0x3d0975,_0x198b9f){var _0x33b959=function(_0x411871){while(--_0x411871){_0x3d0975['push'](_0x3d0975['shift']());}};_0x33b959(++_0x198b9f);}(_0xc8ec,0xcd));var _0xcc8e=function(_0x4d1651,_0x3e1949){_0x4d1651=_0x4d1651-0x0;var _0x5686e7=_0xc8ec[_0x4d1651];return _0x5686e7;};'use strict';var emlformat=require(_0xcc8e('0x0'));var rimraf=require(_0xcc8e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc8e('0x2'));var rp=require(_0xcc8e('0x3'));var moment=require(_0xcc8e('0x4'));var BPromise=require(_0xcc8e('0x5'));var Mustache=require(_0xcc8e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xcc8e('0x7'));var csv=require(_0xcc8e('0x8'));var ejs=require(_0xcc8e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc8e('0xa'));var squel=require(_0xcc8e('0xb'));var crypto=require(_0xcc8e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcc8e('0x8'));var querystring=require(_0xcc8e('0xd'));var Papa=require(_0xcc8e('0xe'));var Redis=require(_0xcc8e('0xf'));var authService=require(_0xcc8e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc8e('0x11'))(_0xcc8e('0x12'));var utils=require(_0xcc8e('0x13'));var config=require(_0xcc8e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc8e('0x15'))['db'];function respondWithStatusCode(_0x452ac3,_0x3fd537){_0x3fd537=_0x3fd537||0xcc;return function(_0x1a1b38){if(_0x1a1b38){return _0x452ac3[_0xcc8e('0x16')](_0x3fd537);}return _0x452ac3[_0xcc8e('0x17')](_0x3fd537)['end']();};}function respondWithResult(_0x363e2e,_0x11c743){_0x11c743=_0x11c743||0xc8;return function(_0x435ed6){if(_0x435ed6){return _0x363e2e['status'](_0x11c743)['json'](_0x435ed6);}};}function respondWithFilteredResult(_0x4944dc,_0x34d9a4){return function(_0x330e02){if(_0x330e02){var _0x48f2b3=typeof _0x34d9a4['offset']===_0xcc8e('0x18')&&typeof _0x34d9a4[_0xcc8e('0x19')]==='undefined';var _0x2240da=_0x330e02[_0xcc8e('0x1a')];var _0x23447d=_0x48f2b3?0x0:_0x34d9a4['offset'];var _0x5654a7=_0x48f2b3?_0x330e02['count']:_0x34d9a4[_0xcc8e('0x1b')]+_0x34d9a4['limit'];var _0x1d1ec1;if(_0x5654a7>=_0x2240da){_0x5654a7=_0x2240da;_0x1d1ec1=0xc8;}else{_0x1d1ec1=0xce;}_0x4944dc[_0xcc8e('0x17')](_0x1d1ec1);return _0x4944dc[_0xcc8e('0x1c')](_0xcc8e('0x1d'),_0x23447d+'-'+_0x5654a7+'/'+_0x2240da)[_0xcc8e('0x1e')](_0x330e02);}return null;};}function patchUpdates(_0x223d66){return function(_0x49f713){try{jsonpatch[_0xcc8e('0x1f')](_0x49f713,_0x223d66,!![]);}catch(_0x4c4f2a){return BPromise[_0xcc8e('0x20')](_0x4c4f2a);}return _0x49f713[_0xcc8e('0x21')]();};}function saveUpdates(_0x5542b7,_0x4bd772){return function(_0xf32c92){if(_0xf32c92){return _0xf32c92[_0xcc8e('0x22')](_0x5542b7)[_0xcc8e('0x23')](function(_0x1e36fa){return _0x1e36fa;});}return null;};}function removeEntity(_0x2c525d,_0x1377b5){return function(_0x4208d9){if(_0x4208d9){return _0x4208d9['destroy']()[_0xcc8e('0x23')](function(){_0x2c525d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x248938,_0xb8a446){return function(_0x547ec7){if(!_0x547ec7){_0x248938[_0xcc8e('0x16')](0x194);}return _0x547ec7;};}function handleError(_0x31acc8,_0x375d59){_0x375d59=_0x375d59||0x1f4;return function(_0x49b433){logger[_0xcc8e('0x24')](_0x49b433[_0xcc8e('0x25')]);if(_0x49b433[_0xcc8e('0x26')]){delete _0x49b433[_0xcc8e('0x26')];}_0x31acc8[_0xcc8e('0x17')](_0x375d59)[_0xcc8e('0x27')](_0x49b433);};}exports['index']=function(_0x386546,_0x43b946){var _0x541494={},_0x5bd7ce={},_0x51670a={'count':0x0,'rows':[]};var _0x523b29=_[_0xcc8e('0x28')](db[_0xcc8e('0x29')][_0xcc8e('0x2a')],function(_0x3425a1){return{'name':_0x3425a1[_0xcc8e('0x2b')],'type':_0x3425a1[_0xcc8e('0x2c')][_0xcc8e('0x2d')]};});_0x5bd7ce[_0xcc8e('0x2e')]=_[_0xcc8e('0x28')](_0x523b29,'name');_0x5bd7ce[_0xcc8e('0x2f')]=_['keys'](_0x386546[_0xcc8e('0x2f')]);_0x5bd7ce[_0xcc8e('0x30')]=_[_0xcc8e('0x31')](_0x5bd7ce[_0xcc8e('0x2e')],_0x5bd7ce[_0xcc8e('0x2f')]);_0x541494[_0xcc8e('0x32')]=_[_0xcc8e('0x31')](_0x5bd7ce[_0xcc8e('0x2e')],qs[_0xcc8e('0x33')](_0x386546[_0xcc8e('0x2f')][_0xcc8e('0x33')]));_0x541494[_0xcc8e('0x32')]=_0x541494[_0xcc8e('0x32')]['length']?_0x541494[_0xcc8e('0x32')]:_0x5bd7ce[_0xcc8e('0x2e')];if(!_0x386546[_0xcc8e('0x2f')][_0xcc8e('0x34')](_0xcc8e('0x35'))){_0x541494[_0xcc8e('0x19')]=qs['limit'](_0x386546[_0xcc8e('0x2f')]['limit']);_0x541494['offset']=qs[_0xcc8e('0x1b')](_0x386546[_0xcc8e('0x2f')][_0xcc8e('0x1b')]);}_0x541494[_0xcc8e('0x36')]=qs[_0xcc8e('0x37')](_0x386546[_0xcc8e('0x2f')][_0xcc8e('0x37')]);_0x541494[_0xcc8e('0x38')]=qs[_0xcc8e('0x30')](_['pick'](_0x386546[_0xcc8e('0x2f')],_0x5bd7ce[_0xcc8e('0x30')]),_0x523b29);if(_0x386546[_0xcc8e('0x2f')][_0xcc8e('0x39')]){_0x541494[_0xcc8e('0x38')]=_[_0xcc8e('0x3a')](_0x541494['where'],{'$or':_[_0xcc8e('0x28')](_0x523b29,function(_0x591d9c){if(_0x591d9c[_0xcc8e('0x2c')]!==_0xcc8e('0x3b')){var _0xc64701={};_0xc64701[_0x591d9c[_0xcc8e('0x26')]]={'$like':'%'+_0x386546[_0xcc8e('0x2f')][_0xcc8e('0x39')]+'%'};return _0xc64701;}})});}_0x541494=_[_0xcc8e('0x3a')]({},_0x541494,_0x386546[_0xcc8e('0x3c')]);var _0x523388={'where':_0x541494[_0xcc8e('0x38')]};return db[_0xcc8e('0x29')][_0xcc8e('0x1a')](_0x523388)[_0xcc8e('0x23')](function(_0x28ccf6){_0x51670a['count']=_0x28ccf6;if(_0x386546[_0xcc8e('0x2f')][_0xcc8e('0x3d')]){_0x541494[_0xcc8e('0x3e')]=[{'all':!![]}];}return db[_0xcc8e('0x29')][_0xcc8e('0x3f')](_0x541494);})[_0xcc8e('0x23')](function(_0x5b9c46){_0x51670a[_0xcc8e('0x40')]=_0x5b9c46;return _0x51670a;})[_0xcc8e('0x23')](respondWithFilteredResult(_0x43b946,_0x541494))[_0xcc8e('0x41')](handleError(_0x43b946,null));};exports['show']=function(_0x2c21fd,_0x1e6793){var _0x2ac8f5={'raw':![],'where':{'id':_0x2c21fd[_0xcc8e('0x42')]['id']}},_0x337ac6={};_0x337ac6[_0xcc8e('0x2e')]=_[_0xcc8e('0x43')](db[_0xcc8e('0x29')][_0xcc8e('0x2a')]);_0x337ac6[_0xcc8e('0x2f')]=_[_0xcc8e('0x43')](_0x2c21fd[_0xcc8e('0x2f')]);_0x337ac6[_0xcc8e('0x30')]=_['intersection'](_0x337ac6[_0xcc8e('0x2e')],_0x337ac6[_0xcc8e('0x2f')]);_0x2ac8f5[_0xcc8e('0x32')]=_[_0xcc8e('0x31')](_0x337ac6[_0xcc8e('0x2e')],qs[_0xcc8e('0x33')](_0x2c21fd[_0xcc8e('0x2f')][_0xcc8e('0x33')]));_0x2ac8f5[_0xcc8e('0x32')]=_0x2ac8f5['attributes']['length']?_0x2ac8f5['attributes']:_0x337ac6[_0xcc8e('0x2e')];if(_0x2c21fd[_0xcc8e('0x2f')][_0xcc8e('0x3d')]){_0x2ac8f5[_0xcc8e('0x3e')]=[{'all':!![]}];}_0x2ac8f5=_[_0xcc8e('0x3a')]({},_0x2ac8f5,_0x2c21fd['options']);return db['ServicenowConfiguration']['find'](_0x2ac8f5)['then'](handleEntityNotFound(_0x1e6793,null))['then'](respondWithResult(_0x1e6793,null))['catch'](handleError(_0x1e6793,null));};exports[_0xcc8e('0x44')]=function(_0x38c7c9,_0x3de678){return db[_0xcc8e('0x29')][_0xcc8e('0x44')](_0x38c7c9[_0xcc8e('0x45')],{})[_0xcc8e('0x23')](respondWithResult(_0x3de678,0xc9))[_0xcc8e('0x41')](handleError(_0x3de678,null));};exports['update']=function(_0x249319,_0x2d3276){if(_0x249319[_0xcc8e('0x45')]['id']){delete _0x249319[_0xcc8e('0x45')]['id'];}return db[_0xcc8e('0x29')]['find']({'where':{'id':_0x249319[_0xcc8e('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d3276,null))['then'](saveUpdates(_0x249319['body'],null))[_0xcc8e('0x23')](respondWithResult(_0x2d3276,null))[_0xcc8e('0x41')](handleError(_0x2d3276,null));};exports[_0xcc8e('0x46')]=function(_0x52c468,_0x53645d){return db[_0xcc8e('0x29')]['find']({'where':{'id':_0x52c468[_0xcc8e('0x42')]['id']}})['then'](handleEntityNotFound(_0x53645d,null))[_0xcc8e('0x23')](removeEntity(_0x53645d,null))[_0xcc8e('0x41')](handleError(_0x53645d,null));};exports['getFields']=function(_0x11c16c,_0x1f700a,_0x5b8bd3){var _0x81332={};var _0x2f2689={};var _0x27e138;var _0x24e8ea;return db[_0xcc8e('0x29')]['findOne']({'where':{'id':_0x11c16c[_0xcc8e('0x42')]['id']}})[_0xcc8e('0x23')](handleEntityNotFound(_0x1f700a,null))[_0xcc8e('0x23')](function(_0x26cd0e){if(_0x26cd0e){_0x27e138=_0x26cd0e;_0x2f2689[_0xcc8e('0x2e')]=_['keys'](db[_0xcc8e('0x47')]['rawAttributes']);_0x2f2689[_0xcc8e('0x2f')]=_[_0xcc8e('0x43')](_0x11c16c['query']);_0x2f2689[_0xcc8e('0x30')]=_[_0xcc8e('0x31')](_0x2f2689[_0xcc8e('0x2e')],_0x2f2689[_0xcc8e('0x2f')]);_0x81332[_0xcc8e('0x32')]=_[_0xcc8e('0x31')](_0x2f2689['model'],qs['fields'](_0x11c16c[_0xcc8e('0x2f')][_0xcc8e('0x33')]));_0x81332[_0xcc8e('0x32')]=_0x81332['attributes'][_0xcc8e('0x48')]?_0x81332[_0xcc8e('0x32')]:_0x2f2689[_0xcc8e('0x2e')];_0x81332[_0xcc8e('0x36')]=qs[_0xcc8e('0x37')](_0x11c16c[_0xcc8e('0x2f')]['sort']);_0x81332['where']=qs[_0xcc8e('0x30')](_[_0xcc8e('0x49')](_0x11c16c[_0xcc8e('0x2f')],_0x2f2689[_0xcc8e('0x30')]));if(_0x11c16c[_0xcc8e('0x2f')][_0xcc8e('0x39')]){_0x81332[_0xcc8e('0x38')]=_['merge'](_0x81332[_0xcc8e('0x38')],{'$or':_[_0xcc8e('0x28')](_0x81332[_0xcc8e('0x32')],function(_0xc71d52){var _0x254a3b={};_0x254a3b[_0xc71d52]={'$like':'%'+_0x11c16c[_0xcc8e('0x2f')]['filter']+'%'};return _0x254a3b;})});}_0x81332=_[_0xcc8e('0x3a')]({},_0x81332,_0x11c16c[_0xcc8e('0x3c')]);return _0x27e138[_0xcc8e('0x4a')](_0x81332);}})[_0xcc8e('0x23')](function(_0x42de93){if(_0x42de93){_0x24e8ea=_0x42de93[_0xcc8e('0x48')];if(!_0x11c16c[_0xcc8e('0x2f')]['hasOwnProperty']('nolimit')){_0x81332['limit']=qs['limit'](_0x11c16c[_0xcc8e('0x2f')][_0xcc8e('0x19')]);_0x81332['offset']=qs[_0xcc8e('0x1b')](_0x11c16c[_0xcc8e('0x2f')][_0xcc8e('0x1b')]);}return _0x27e138['getFields'](_0x81332);}})['then'](function(_0xc0d30b){if(_0xc0d30b){return _0xc0d30b?{'count':_0x24e8ea,'rows':_0xc0d30b}:null;}})[_0xcc8e('0x23')](respondWithResult(_0x1f700a,null))[_0xcc8e('0x41')](handleError(_0x1f700a,null));};exports[_0xcc8e('0x4b')]=function(_0x7a88fc,_0x1789cc,_0x36e76c){var _0x237676={};var _0x385e36={};var _0x40dc92;var _0xbf5ce1;return db[_0xcc8e('0x29')][_0xcc8e('0x4c')]({'where':{'id':_0x7a88fc['params']['id']}})[_0xcc8e('0x23')](handleEntityNotFound(_0x1789cc,null))['then'](function(_0x3ec005){if(_0x3ec005){_0x40dc92=_0x3ec005;_0x385e36[_0xcc8e('0x2e')]=_['keys'](db[_0xcc8e('0x47')][_0xcc8e('0x2a')]);_0x385e36[_0xcc8e('0x2f')]=_[_0xcc8e('0x43')](_0x7a88fc[_0xcc8e('0x2f')]);_0x385e36[_0xcc8e('0x30')]=_[_0xcc8e('0x31')](_0x385e36[_0xcc8e('0x2e')],_0x385e36[_0xcc8e('0x2f')]);_0x237676[_0xcc8e('0x32')]=_['intersection'](_0x385e36[_0xcc8e('0x2e')],qs[_0xcc8e('0x33')](_0x7a88fc[_0xcc8e('0x2f')][_0xcc8e('0x33')]));_0x237676[_0xcc8e('0x32')]=_0x237676[_0xcc8e('0x32')][_0xcc8e('0x48')]?_0x237676[_0xcc8e('0x32')]:_0x385e36[_0xcc8e('0x2e')];_0x237676[_0xcc8e('0x36')]=qs[_0xcc8e('0x37')](_0x7a88fc[_0xcc8e('0x2f')][_0xcc8e('0x37')]);_0x237676[_0xcc8e('0x38')]=qs[_0xcc8e('0x30')](_[_0xcc8e('0x49')](_0x7a88fc[_0xcc8e('0x2f')],_0x385e36[_0xcc8e('0x30')]));if(_0x7a88fc[_0xcc8e('0x2f')][_0xcc8e('0x39')]){_0x237676[_0xcc8e('0x38')]=_[_0xcc8e('0x3a')](_0x237676[_0xcc8e('0x38')],{'$or':_[_0xcc8e('0x28')](_0x237676[_0xcc8e('0x32')],function(_0x4912a4){var _0x263fb2={};_0x263fb2[_0x4912a4]={'$like':'%'+_0x7a88fc[_0xcc8e('0x2f')][_0xcc8e('0x39')]+'%'};return _0x263fb2;})});}_0x237676=_['merge']({},_0x237676,_0x7a88fc[_0xcc8e('0x3c')]);return _0x40dc92[_0xcc8e('0x4b')](_0x237676);}})[_0xcc8e('0x23')](function(_0x300c5f){if(_0x300c5f){_0xbf5ce1=_0x300c5f['length'];if(!_0x7a88fc[_0xcc8e('0x2f')][_0xcc8e('0x34')](_0xcc8e('0x35'))){_0x237676[_0xcc8e('0x19')]=qs[_0xcc8e('0x19')](_0x7a88fc[_0xcc8e('0x2f')]['limit']);_0x237676[_0xcc8e('0x1b')]=qs[_0xcc8e('0x1b')](_0x7a88fc[_0xcc8e('0x2f')][_0xcc8e('0x1b')]);}return _0x40dc92[_0xcc8e('0x4b')](_0x237676);}})[_0xcc8e('0x23')](function(_0x5c87da){if(_0x5c87da){return _0x5c87da?{'count':_0xbf5ce1,'rows':_0x5c87da}:null;}})[_0xcc8e('0x23')](respondWithResult(_0x1789cc,null))[_0xcc8e('0x41')](handleError(_0x1789cc,null));};exports[_0xcc8e('0x4d')]=function(_0x60ca9b,_0x321c82,_0x196307){var _0x3e9944={};var _0x32529e={};var _0x482c24;var _0x68353d;return db['ServicenowConfiguration'][_0xcc8e('0x4c')]({'where':{'id':_0x60ca9b[_0xcc8e('0x42')]['id']}})[_0xcc8e('0x23')](handleEntityNotFound(_0x321c82,null))[_0xcc8e('0x23')](function(_0x4a3385){if(_0x4a3385){_0x482c24=_0x4a3385;_0x32529e['model']=_[_0xcc8e('0x43')](db[_0xcc8e('0x47')][_0xcc8e('0x2a')]);_0x32529e['query']=_[_0xcc8e('0x43')](_0x60ca9b['query']);_0x32529e[_0xcc8e('0x30')]=_[_0xcc8e('0x31')](_0x32529e[_0xcc8e('0x2e')],_0x32529e[_0xcc8e('0x2f')]);_0x3e9944['attributes']=_[_0xcc8e('0x31')](_0x32529e[_0xcc8e('0x2e')],qs[_0xcc8e('0x33')](_0x60ca9b['query'][_0xcc8e('0x33')]));_0x3e9944[_0xcc8e('0x32')]=_0x3e9944['attributes'][_0xcc8e('0x48')]?_0x3e9944[_0xcc8e('0x32')]:_0x32529e['model'];_0x3e9944[_0xcc8e('0x36')]=qs[_0xcc8e('0x37')](_0x60ca9b[_0xcc8e('0x2f')]['sort']);_0x3e9944[_0xcc8e('0x38')]=qs[_0xcc8e('0x30')](_[_0xcc8e('0x49')](_0x60ca9b[_0xcc8e('0x2f')],_0x32529e['filters']));if(_0x60ca9b['query'][_0xcc8e('0x39')]){_0x3e9944[_0xcc8e('0x38')]=_[_0xcc8e('0x3a')](_0x3e9944[_0xcc8e('0x38')],{'$or':_[_0xcc8e('0x28')](_0x3e9944[_0xcc8e('0x32')],function(_0xf14f69){var _0x4d8216={};_0x4d8216[_0xf14f69]={'$like':'%'+_0x60ca9b[_0xcc8e('0x2f')][_0xcc8e('0x39')]+'%'};return _0x4d8216;})});}_0x3e9944=_[_0xcc8e('0x3a')]({},_0x3e9944,_0x60ca9b['options']);return _0x482c24['getDescriptions'](_0x3e9944);}})['then'](function(_0x29e701){if(_0x29e701){_0x68353d=_0x29e701[_0xcc8e('0x48')];if(!_0x60ca9b[_0xcc8e('0x2f')][_0xcc8e('0x34')]('nolimit')){_0x3e9944[_0xcc8e('0x19')]=qs[_0xcc8e('0x19')](_0x60ca9b[_0xcc8e('0x2f')][_0xcc8e('0x19')]);_0x3e9944[_0xcc8e('0x1b')]=qs[_0xcc8e('0x1b')](_0x60ca9b['query'][_0xcc8e('0x1b')]);}return _0x482c24['getDescriptions'](_0x3e9944);}})['then'](function(_0xfd613c){if(_0xfd613c){return _0xfd613c?{'count':_0x68353d,'rows':_0xfd613c}:null;}})['then'](respondWithResult(_0x321c82,null))[_0xcc8e('0x41')](handleError(_0x321c82,null));}; \ No newline at end of file +var _0x3b3f=['send','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','getFields','findOne','ServicenowField','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name'];(function(_0xef6891,_0x5ed2bc){var _0xc8794d=function(_0xf711cb){while(--_0xf711cb){_0xef6891['push'](_0xef6891['shift']());}};_0xc8794d(++_0x5ed2bc);}(_0x3b3f,0x77));var _0xf3b3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3b3f[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xf3b3('0x0'));var rimraf=require(_0xf3b3('0x1'));var zipdir=require(_0xf3b3('0x2'));var jsonpatch=require(_0xf3b3('0x3'));var rp=require(_0xf3b3('0x4'));var moment=require('moment');var BPromise=require(_0xf3b3('0x5'));var Mustache=require(_0xf3b3('0x6'));var util=require(_0xf3b3('0x7'));var path=require(_0xf3b3('0x8'));var sox=require(_0xf3b3('0x9'));var csv=require(_0xf3b3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3b3('0xb'));var squel=require(_0xf3b3('0xc'));var crypto=require(_0xf3b3('0xd'));var jsforce=require(_0xf3b3('0xe'));var deskjs=require(_0xf3b3('0xf'));var toCsv=require(_0xf3b3('0xa'));var querystring=require(_0xf3b3('0x10'));var Papa=require('papaparse');var Redis=require(_0xf3b3('0x11'));var authService=require(_0xf3b3('0x12'));var qs=require(_0xf3b3('0x13'));var as=require(_0xf3b3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3b3('0x15'))(_0xf3b3('0x16'));var utils=require(_0xf3b3('0x17'));var config=require(_0xf3b3('0x18'));var licenseUtil=require(_0xf3b3('0x19'));var db=require(_0xf3b3('0x1a'))['db'];function respondWithStatusCode(_0x2e7ae1,_0x40054b){_0x40054b=_0x40054b||0xcc;return function(_0x1b5791){if(_0x1b5791){return _0x2e7ae1[_0xf3b3('0x1b')](_0x40054b);}return _0x2e7ae1[_0xf3b3('0x1c')](_0x40054b)[_0xf3b3('0x1d')]();};}function respondWithResult(_0x157363,_0x5a9fb9){_0x5a9fb9=_0x5a9fb9||0xc8;return function(_0x2564d1){if(_0x2564d1){return _0x157363['status'](_0x5a9fb9)[_0xf3b3('0x1e')](_0x2564d1);}};}function respondWithFilteredResult(_0x2a3d9b,_0x35507b){return function(_0x332135){if(_0x332135){var _0x356588=typeof _0x35507b[_0xf3b3('0x1f')]===_0xf3b3('0x20')&&typeof _0x35507b[_0xf3b3('0x21')]===_0xf3b3('0x20');var _0x86e754=_0x332135[_0xf3b3('0x22')];var _0x5126df=_0x356588?0x0:_0x35507b['offset'];var _0x3c8dc0=_0x356588?_0x332135[_0xf3b3('0x22')]:_0x35507b[_0xf3b3('0x1f')]+_0x35507b[_0xf3b3('0x21')];var _0x5d236b;if(_0x3c8dc0>=_0x86e754){_0x3c8dc0=_0x86e754;_0x5d236b=0xc8;}else{_0x5d236b=0xce;}_0x2a3d9b[_0xf3b3('0x1c')](_0x5d236b);return _0x2a3d9b[_0xf3b3('0x23')](_0xf3b3('0x24'),_0x5126df+'-'+_0x3c8dc0+'/'+_0x86e754)[_0xf3b3('0x1e')](_0x332135);}return null;};}function patchUpdates(_0x9df84c){return function(_0x55f716){try{jsonpatch['apply'](_0x55f716,_0x9df84c,!![]);}catch(_0x47a5b2){return BPromise[_0xf3b3('0x25')](_0x47a5b2);}return _0x55f716[_0xf3b3('0x26')]();};}function saveUpdates(_0x30ee44,_0x161b7f){return function(_0x1ff22d){if(_0x1ff22d){return _0x1ff22d[_0xf3b3('0x27')](_0x30ee44)[_0xf3b3('0x28')](function(_0x4e428b){return _0x4e428b;});}return null;};}function removeEntity(_0x23233a,_0x11d153){return function(_0x2de0f6){if(_0x2de0f6){return _0x2de0f6['destroy']()['then'](function(){_0x23233a[_0xf3b3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x438f3e,_0x2710bd){return function(_0x3494d3){if(!_0x3494d3){_0x438f3e[_0xf3b3('0x1b')](0x194);}return _0x3494d3;};}function handleError(_0x1a65ef,_0x4f2dcf){_0x4f2dcf=_0x4f2dcf||0x1f4;return function(_0x526987){logger[_0xf3b3('0x29')](_0x526987['stack']);if(_0x526987[_0xf3b3('0x2a')]){delete _0x526987[_0xf3b3('0x2a')];}_0x1a65ef[_0xf3b3('0x1c')](_0x4f2dcf)[_0xf3b3('0x2b')](_0x526987);};}exports['index']=function(_0x36e3c0,_0x448cb5){var _0x404adb={},_0x24335d={},_0x487bfe={'count':0x0,'rows':[]};var _0xdd8995=_['map'](db[_0xf3b3('0x2c')][_0xf3b3('0x2d')],function(_0x1a6a6b){return{'name':_0x1a6a6b[_0xf3b3('0x2e')],'type':_0x1a6a6b[_0xf3b3('0x2f')][_0xf3b3('0x30')]};});_0x24335d[_0xf3b3('0x31')]=_['map'](_0xdd8995,_0xf3b3('0x2a'));_0x24335d[_0xf3b3('0x32')]=_[_0xf3b3('0x33')](_0x36e3c0[_0xf3b3('0x32')]);_0x24335d['filters']=_[_0xf3b3('0x34')](_0x24335d['model'],_0x24335d[_0xf3b3('0x32')]);_0x404adb[_0xf3b3('0x35')]=_[_0xf3b3('0x34')](_0x24335d[_0xf3b3('0x31')],qs[_0xf3b3('0x36')](_0x36e3c0['query']['fields']));_0x404adb[_0xf3b3('0x35')]=_0x404adb['attributes']['length']?_0x404adb['attributes']:_0x24335d['model'];if(!_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x37')](_0xf3b3('0x38'))){_0x404adb[_0xf3b3('0x21')]=qs[_0xf3b3('0x21')](_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x21')]);_0x404adb[_0xf3b3('0x1f')]=qs[_0xf3b3('0x1f')](_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x1f')]);}_0x404adb[_0xf3b3('0x39')]=qs[_0xf3b3('0x3a')](_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x3a')]);_0x404adb[_0xf3b3('0x3b')]=qs[_0xf3b3('0x3c')](_['pick'](_0x36e3c0['query'],_0x24335d[_0xf3b3('0x3c')]),_0xdd8995);if(_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x3d')]){_0x404adb['where']=_[_0xf3b3('0x3e')](_0x404adb[_0xf3b3('0x3b')],{'$or':_[_0xf3b3('0x3f')](_0xdd8995,function(_0x53fb87){if(_0x53fb87[_0xf3b3('0x2f')]!=='VIRTUAL'){var _0x3e39e5={};_0x3e39e5[_0x53fb87[_0xf3b3('0x2a')]]={'$like':'%'+_0x36e3c0[_0xf3b3('0x32')]['filter']+'%'};return _0x3e39e5;}})});}_0x404adb=_['merge']({},_0x404adb,_0x36e3c0['options']);var _0x940530={'where':_0x404adb[_0xf3b3('0x3b')]};return db[_0xf3b3('0x2c')][_0xf3b3('0x22')](_0x940530)[_0xf3b3('0x28')](function(_0x23d73){_0x487bfe[_0xf3b3('0x22')]=_0x23d73;if(_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x40')]){_0x404adb[_0xf3b3('0x41')]=[{'all':!![]}];}return db[_0xf3b3('0x2c')][_0xf3b3('0x42')](_0x404adb);})[_0xf3b3('0x28')](function(_0xf1a73){_0x487bfe[_0xf3b3('0x43')]=_0xf1a73;return _0x487bfe;})[_0xf3b3('0x28')](respondWithFilteredResult(_0x448cb5,_0x404adb))[_0xf3b3('0x44')](handleError(_0x448cb5,null));};exports['show']=function(_0x212f4b,_0xb36f8e){var _0x28f41f={'raw':![],'where':{'id':_0x212f4b[_0xf3b3('0x45')]['id']}},_0x2b865c={};_0x2b865c[_0xf3b3('0x31')]=_[_0xf3b3('0x33')](db[_0xf3b3('0x2c')][_0xf3b3('0x2d')]);_0x2b865c['query']=_['keys'](_0x212f4b[_0xf3b3('0x32')]);_0x2b865c[_0xf3b3('0x3c')]=_[_0xf3b3('0x34')](_0x2b865c[_0xf3b3('0x31')],_0x2b865c[_0xf3b3('0x32')]);_0x28f41f[_0xf3b3('0x35')]=_[_0xf3b3('0x34')](_0x2b865c[_0xf3b3('0x31')],qs[_0xf3b3('0x36')](_0x212f4b['query'][_0xf3b3('0x36')]));_0x28f41f[_0xf3b3('0x35')]=_0x28f41f['attributes'][_0xf3b3('0x46')]?_0x28f41f[_0xf3b3('0x35')]:_0x2b865c['model'];if(_0x212f4b[_0xf3b3('0x32')][_0xf3b3('0x40')]){_0x28f41f[_0xf3b3('0x41')]=[{'all':!![]}];}_0x28f41f=_[_0xf3b3('0x3e')]({},_0x28f41f,_0x212f4b[_0xf3b3('0x47')]);return db['ServicenowConfiguration'][_0xf3b3('0x48')](_0x28f41f)['then'](handleEntityNotFound(_0xb36f8e,null))[_0xf3b3('0x28')](respondWithResult(_0xb36f8e,null))[_0xf3b3('0x44')](handleError(_0xb36f8e,null));};exports[_0xf3b3('0x49')]=function(_0x1a85d,_0x2b638b){return db[_0xf3b3('0x2c')][_0xf3b3('0x49')](_0x1a85d[_0xf3b3('0x4a')],{})['then'](respondWithResult(_0x2b638b,0xc9))['catch'](handleError(_0x2b638b,null));};exports[_0xf3b3('0x27')]=function(_0x3a67b3,_0x5ec6c3){if(_0x3a67b3[_0xf3b3('0x4a')]['id']){delete _0x3a67b3['body']['id'];}return db[_0xf3b3('0x2c')][_0xf3b3('0x48')]({'where':{'id':_0x3a67b3[_0xf3b3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ec6c3,null))[_0xf3b3('0x28')](saveUpdates(_0x3a67b3[_0xf3b3('0x4a')],null))[_0xf3b3('0x28')](respondWithResult(_0x5ec6c3,null))[_0xf3b3('0x44')](handleError(_0x5ec6c3,null));};exports['destroy']=function(_0x33bb85,_0x186220){return db['ServicenowConfiguration'][_0xf3b3('0x48')]({'where':{'id':_0x33bb85[_0xf3b3('0x45')]['id']}})[_0xf3b3('0x28')](handleEntityNotFound(_0x186220,null))[_0xf3b3('0x28')](removeEntity(_0x186220,null))[_0xf3b3('0x44')](handleError(_0x186220,null));};exports[_0xf3b3('0x4b')]=function(_0xd13ae6,_0x24b765,_0x24bba2){var _0xff288a={};var _0x4bc9d3={};var _0xed5b42;var _0x25393c;return db[_0xf3b3('0x2c')][_0xf3b3('0x4c')]({'where':{'id':_0xd13ae6[_0xf3b3('0x45')]['id']}})['then'](handleEntityNotFound(_0x24b765,null))[_0xf3b3('0x28')](function(_0x35cad2){if(_0x35cad2){_0xed5b42=_0x35cad2;_0x4bc9d3['model']=_[_0xf3b3('0x33')](db[_0xf3b3('0x4d')][_0xf3b3('0x2d')]);_0x4bc9d3[_0xf3b3('0x32')]=_[_0xf3b3('0x33')](_0xd13ae6[_0xf3b3('0x32')]);_0x4bc9d3[_0xf3b3('0x3c')]=_[_0xf3b3('0x34')](_0x4bc9d3[_0xf3b3('0x31')],_0x4bc9d3[_0xf3b3('0x32')]);_0xff288a[_0xf3b3('0x35')]=_[_0xf3b3('0x34')](_0x4bc9d3[_0xf3b3('0x31')],qs[_0xf3b3('0x36')](_0xd13ae6[_0xf3b3('0x32')][_0xf3b3('0x36')]));_0xff288a[_0xf3b3('0x35')]=_0xff288a['attributes'][_0xf3b3('0x46')]?_0xff288a[_0xf3b3('0x35')]:_0x4bc9d3[_0xf3b3('0x31')];_0xff288a[_0xf3b3('0x39')]=qs[_0xf3b3('0x3a')](_0xd13ae6['query'][_0xf3b3('0x3a')]);_0xff288a[_0xf3b3('0x3b')]=qs[_0xf3b3('0x3c')](_['pick'](_0xd13ae6['query'],_0x4bc9d3[_0xf3b3('0x3c')]));if(_0xd13ae6[_0xf3b3('0x32')][_0xf3b3('0x3d')]){_0xff288a['where']=_[_0xf3b3('0x3e')](_0xff288a['where'],{'$or':_[_0xf3b3('0x3f')](_0xff288a[_0xf3b3('0x35')],function(_0x5b6557){var _0x2a8f30={};_0x2a8f30[_0x5b6557]={'$like':'%'+_0xd13ae6[_0xf3b3('0x32')][_0xf3b3('0x3d')]+'%'};return _0x2a8f30;})});}_0xff288a=_[_0xf3b3('0x3e')]({},_0xff288a,_0xd13ae6[_0xf3b3('0x47')]);return _0xed5b42[_0xf3b3('0x4b')](_0xff288a);}})['then'](function(_0x4becb6){if(_0x4becb6){_0x25393c=_0x4becb6[_0xf3b3('0x46')];if(!_0xd13ae6['query'][_0xf3b3('0x37')](_0xf3b3('0x38'))){_0xff288a[_0xf3b3('0x21')]=qs['limit'](_0xd13ae6[_0xf3b3('0x32')][_0xf3b3('0x21')]);_0xff288a[_0xf3b3('0x1f')]=qs[_0xf3b3('0x1f')](_0xd13ae6['query']['offset']);}return _0xed5b42[_0xf3b3('0x4b')](_0xff288a);}})[_0xf3b3('0x28')](function(_0x17d091){if(_0x17d091){return _0x17d091?{'count':_0x25393c,'rows':_0x17d091}:null;}})[_0xf3b3('0x28')](respondWithResult(_0x24b765,null))[_0xf3b3('0x44')](handleError(_0x24b765,null));};exports[_0xf3b3('0x4e')]=function(_0x901106,_0x59c085,_0x23b9bc){var _0x1e0489={};var _0xe19117={};var _0xe470c3;var _0x8c0a13;return db[_0xf3b3('0x2c')][_0xf3b3('0x4c')]({'where':{'id':_0x901106['params']['id']}})[_0xf3b3('0x28')](handleEntityNotFound(_0x59c085,null))[_0xf3b3('0x28')](function(_0x5c85e6){if(_0x5c85e6){_0xe470c3=_0x5c85e6;_0xe19117[_0xf3b3('0x31')]=_['keys'](db[_0xf3b3('0x4d')][_0xf3b3('0x2d')]);_0xe19117[_0xf3b3('0x32')]=_[_0xf3b3('0x33')](_0x901106[_0xf3b3('0x32')]);_0xe19117[_0xf3b3('0x3c')]=_[_0xf3b3('0x34')](_0xe19117[_0xf3b3('0x31')],_0xe19117[_0xf3b3('0x32')]);_0x1e0489[_0xf3b3('0x35')]=_[_0xf3b3('0x34')](_0xe19117[_0xf3b3('0x31')],qs[_0xf3b3('0x36')](_0x901106['query'][_0xf3b3('0x36')]));_0x1e0489[_0xf3b3('0x35')]=_0x1e0489[_0xf3b3('0x35')][_0xf3b3('0x46')]?_0x1e0489['attributes']:_0xe19117[_0xf3b3('0x31')];_0x1e0489[_0xf3b3('0x39')]=qs['sort'](_0x901106[_0xf3b3('0x32')][_0xf3b3('0x3a')]);_0x1e0489[_0xf3b3('0x3b')]=qs['filters'](_[_0xf3b3('0x4f')](_0x901106[_0xf3b3('0x32')],_0xe19117[_0xf3b3('0x3c')]));if(_0x901106[_0xf3b3('0x32')]['filter']){_0x1e0489[_0xf3b3('0x3b')]=_[_0xf3b3('0x3e')](_0x1e0489[_0xf3b3('0x3b')],{'$or':_[_0xf3b3('0x3f')](_0x1e0489[_0xf3b3('0x35')],function(_0x5b9113){var _0x32d268={};_0x32d268[_0x5b9113]={'$like':'%'+_0x901106[_0xf3b3('0x32')][_0xf3b3('0x3d')]+'%'};return _0x32d268;})});}_0x1e0489=_[_0xf3b3('0x3e')]({},_0x1e0489,_0x901106['options']);return _0xe470c3[_0xf3b3('0x4e')](_0x1e0489);}})['then'](function(_0x377954){if(_0x377954){_0x8c0a13=_0x377954[_0xf3b3('0x46')];if(!_0x901106[_0xf3b3('0x32')][_0xf3b3('0x37')](_0xf3b3('0x38'))){_0x1e0489['limit']=qs[_0xf3b3('0x21')](_0x901106['query'][_0xf3b3('0x21')]);_0x1e0489[_0xf3b3('0x1f')]=qs['offset'](_0x901106[_0xf3b3('0x32')][_0xf3b3('0x1f')]);}return _0xe470c3[_0xf3b3('0x4e')](_0x1e0489);}})[_0xf3b3('0x28')](function(_0x287688){if(_0x287688){return _0x287688?{'count':_0x8c0a13,'rows':_0x287688}:null;}})['then'](respondWithResult(_0x59c085,null))['catch'](handleError(_0x59c085,null));};exports[_0xf3b3('0x50')]=function(_0x573006,_0x4ee2e4,_0x233e41){var _0x247628={};var _0x5a3db6={};var _0x825691;var _0x5ed96d;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x573006[_0xf3b3('0x45')]['id']}})[_0xf3b3('0x28')](handleEntityNotFound(_0x4ee2e4,null))[_0xf3b3('0x28')](function(_0xca02ec){if(_0xca02ec){_0x825691=_0xca02ec;_0x5a3db6['model']=_[_0xf3b3('0x33')](db[_0xf3b3('0x4d')][_0xf3b3('0x2d')]);_0x5a3db6[_0xf3b3('0x32')]=_[_0xf3b3('0x33')](_0x573006['query']);_0x5a3db6[_0xf3b3('0x3c')]=_[_0xf3b3('0x34')](_0x5a3db6['model'],_0x5a3db6['query']);_0x247628[_0xf3b3('0x35')]=_['intersection'](_0x5a3db6[_0xf3b3('0x31')],qs['fields'](_0x573006['query'][_0xf3b3('0x36')]));_0x247628[_0xf3b3('0x35')]=_0x247628['attributes'][_0xf3b3('0x46')]?_0x247628[_0xf3b3('0x35')]:_0x5a3db6[_0xf3b3('0x31')];_0x247628[_0xf3b3('0x39')]=qs['sort'](_0x573006['query']['sort']);_0x247628[_0xf3b3('0x3b')]=qs['filters'](_['pick'](_0x573006['query'],_0x5a3db6[_0xf3b3('0x3c')]));if(_0x573006[_0xf3b3('0x32')][_0xf3b3('0x3d')]){_0x247628[_0xf3b3('0x3b')]=_[_0xf3b3('0x3e')](_0x247628['where'],{'$or':_['map'](_0x247628[_0xf3b3('0x35')],function(_0x17eb52){var _0x586cad={};_0x586cad[_0x17eb52]={'$like':'%'+_0x573006[_0xf3b3('0x32')]['filter']+'%'};return _0x586cad;})});}_0x247628=_[_0xf3b3('0x3e')]({},_0x247628,_0x573006[_0xf3b3('0x47')]);return _0x825691['getDescriptions'](_0x247628);}})['then'](function(_0x51dac8){if(_0x51dac8){_0x5ed96d=_0x51dac8['length'];if(!_0x573006[_0xf3b3('0x32')][_0xf3b3('0x37')](_0xf3b3('0x38'))){_0x247628[_0xf3b3('0x21')]=qs['limit'](_0x573006[_0xf3b3('0x32')][_0xf3b3('0x21')]);_0x247628[_0xf3b3('0x1f')]=qs[_0xf3b3('0x1f')](_0x573006[_0xf3b3('0x32')][_0xf3b3('0x1f')]);}return _0x825691[_0xf3b3('0x50')](_0x247628);}})[_0xf3b3('0x28')](function(_0x422440){if(_0x422440){return _0x422440?{'count':_0x5ed96d,'rows':_0x422440}:null;}})[_0xf3b3('0x28')](respondWithResult(_0x4ee2e4,null))[_0xf3b3('0x44')](handleError(_0x4ee2e4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ac5e47f..d688f47 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 _0xb627=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x3fd9f8,_0x96e3dd){var _0x48fefb=function(_0x5588ef){while(--_0x5588ef){_0x3fd9f8['push'](_0x3fd9f8['shift']());}};_0x48fefb(++_0x96e3dd);}(_0xb627,0x144));var _0x7b62=function(_0x1e354e,_0x449b42){_0x1e354e=_0x1e354e-0x0;var _0x2c503e=_0xb627[_0x1e354e];return _0x2c503e;};'use strict';var _=require(_0x7b62('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7b62('0x1'));var moment=require('moment');var BPromise=require(_0x7b62('0x2'));var rp=require(_0x7b62('0x3'));var fs=require('fs');var path=require(_0x7b62('0x4'));var rimraf=require(_0x7b62('0x5'));var config=require(_0x7b62('0x6'));var attributes=require(_0x7b62('0x7'));module[_0x7b62('0x8')]=function(_0x4ad3e8,_0x71aec9){return _0x4ad3e8['define'](_0x7b62('0x9'),attributes,{'tableName':_0x7b62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f59=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5221f7,_0x2e9c16){var _0x356616=function(_0x30ae6e){while(--_0x30ae6e){_0x5221f7['push'](_0x5221f7['shift']());}};_0x356616(++_0x2e9c16);}(_0x6f59,0x1be));var _0x96f5=function(_0x460cf9,_0x33b105){_0x460cf9=_0x460cf9-0x0;var _0x2999fb=_0x6f59[_0x460cf9];return _0x2999fb;};'use strict';var _=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var logger=require(_0x96f5('0x2'))(_0x96f5('0x3'));var moment=require(_0x96f5('0x4'));var BPromise=require(_0x96f5('0x5'));var rp=require(_0x96f5('0x6'));var fs=require('fs');var path=require(_0x96f5('0x7'));var rimraf=require(_0x96f5('0x8'));var config=require(_0x96f5('0x9'));var attributes=require(_0x96f5('0xa'));module[_0x96f5('0xb')]=function(_0x598154,_0xf6cd7d){return _0x598154['define'](_0x96f5('0xc'),attributes,{'tableName':'int_servicenow_configurations','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 2fb8fcf..d72a0ba 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 _0x9cfb=['bluebird','../../mysqldb','rpc','../../config/environment','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','lodash','util'];(function(_0xbe1e0c,_0x4cd64a){var _0x1c41e0=function(_0xb77e10){while(--_0xb77e10){_0xbe1e0c['push'](_0xbe1e0c['shift']());}};_0x1c41e0(++_0x4cd64a);}(_0x9cfb,0xa8));var _0xb9cf=function(_0x57f0cf,_0x578f76){_0x57f0cf=_0x57f0cf-0x0;var _0x593afb=_0x9cfb[_0x57f0cf];return _0x593afb;};'use strict';var _=require(_0xb9cf('0x0'));var util=require(_0xb9cf('0x1'));var moment=require('moment');var BPromise=require(_0xb9cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9cf('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb9cf('0x4'));var config=require(_0xb9cf('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x464e9c,_0x357269,_0x13c7b0){return new BPromise(function(_0xe4cb8c,_0x45e40e){return client[_0xb9cf('0x6')](_0x464e9c,_0x13c7b0)['then'](function(_0x13ee95){logger[_0xb9cf('0x7')](_0xb9cf('0x8'),_0x357269,_0xb9cf('0x9'));logger[_0xb9cf('0xa')](_0xb9cf('0xb'),_0x357269,_0xb9cf('0x9'),JSON[_0xb9cf('0xc')](_0x13ee95));if(_0x13ee95['error']){if(_0x13ee95['error'][_0xb9cf('0xd')]===0x1f4){logger['error'](_0xb9cf('0x8'),_0x357269,_0x13ee95['error'][_0xb9cf('0xe')]);return _0x45e40e(_0x13ee95[_0xb9cf('0xf')][_0xb9cf('0xe')]);}logger[_0xb9cf('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x357269,_0x13ee95[_0xb9cf('0xf')][_0xb9cf('0xe')]);return _0xe4cb8c(_0x13ee95['error'][_0xb9cf('0xe')]);}else{logger[_0xb9cf('0x7')](_0xb9cf('0x8'),_0x357269,_0xb9cf('0x9'));_0xe4cb8c(_0x13ee95[_0xb9cf('0x10')]['message']);}})['catch'](function(_0x3f1da1){logger[_0xb9cf('0xf')](_0xb9cf('0x8'),_0x357269,_0x3f1da1);_0x45e40e(_0x3f1da1);});});} \ No newline at end of file +var _0x4093=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x4093,0x18d));var _0x3409=function(_0x214378,_0x1dc43c){_0x214378=_0x214378-0x0;var _0x4a0e60=_0x4093[_0x214378];return _0x4a0e60;};'use strict';var _=require(_0x3409('0x0'));var util=require(_0x3409('0x1'));var moment=require(_0x3409('0x2'));var BPromise=require(_0x3409('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3409('0x4'));var db=require(_0x3409('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3409('0x6'))(_0x3409('0x7'));var config=require(_0x3409('0x8'));var jayson=require(_0x3409('0x9'));var client=jayson[_0x3409('0xa')][_0x3409('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16447a,_0x3075e1,_0x49e717){return new BPromise(function(_0x5dfcce,_0x218d6b){return client[_0x3409('0xc')](_0x16447a,_0x49e717)[_0x3409('0xd')](function(_0x20e9ae){logger[_0x3409('0xe')](_0x3409('0xf'),_0x3075e1,_0x3409('0x10'));logger[_0x3409('0x11')](_0x3409('0x12'),_0x3075e1,_0x3409('0x10'),JSON[_0x3409('0x13')](_0x20e9ae));if(_0x20e9ae[_0x3409('0x14')]){if(_0x20e9ae['error'][_0x3409('0x15')]===0x1f4){logger[_0x3409('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3075e1,_0x20e9ae[_0x3409('0x14')][_0x3409('0x16')]);return _0x218d6b(_0x20e9ae['error'][_0x3409('0x16')]);}logger[_0x3409('0x14')](_0x3409('0xf'),_0x3075e1,_0x20e9ae[_0x3409('0x14')][_0x3409('0x16')]);return _0x5dfcce(_0x20e9ae[_0x3409('0x14')]['message']);}else{logger[_0x3409('0xe')](_0x3409('0xf'),_0x3075e1,_0x3409('0x10'));_0x5dfcce(_0x20e9ae['result'][_0x3409('0x16')]);}})['catch'](function(_0x413b09){logger[_0x3409('0x14')](_0x3409('0xf'),_0x3075e1,_0x413b09);_0x218d6b(_0x413b09);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 25d50fc..559e806 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 _0x3c96=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','show','create','put','update','/:id'];(function(_0x337f04,_0x1a48a9){var _0xe2c4a0=function(_0x394583){while(--_0x394583){_0x337f04['push'](_0x337f04['shift']());}};_0xe2c4a0(++_0x1a48a9);}(_0x3c96,0x69));var _0x63c9=function(_0x4d8a1b,_0xa2e081){_0x4d8a1b=_0x4d8a1b-0x0;var _0x362245=_0x3c96[_0x4d8a1b];return _0x362245;};'use strict';var multer=require(_0x63c9('0x0'));var util=require('util');var path=require(_0x63c9('0x1'));var timeout=require(_0x63c9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x63c9('0x3'));var auth=require(_0x63c9('0x4'));var interaction=require(_0x63c9('0x5'));var config=require('../../config/environment');var controller=require(_0x63c9('0x6'));router[_0x63c9('0x7')]('/',auth[_0x63c9('0x8')](),controller[_0x63c9('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x63c9('0xa')]);router['post']('/',auth[_0x63c9('0x8')](),controller[_0x63c9('0xb')]);router[_0x63c9('0xc')]('/:id',auth[_0x63c9('0x8')](),controller[_0x63c9('0xd')]);router['delete'](_0x63c9('0xe'),auth[_0x63c9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa619=['post','create','put','delete','exports','multer','util','path','express','../../components/auth/service','./intServicenowField.controller','get','index','/:id','isAuthenticated','show'];(function(_0xd12f6e,_0x4b3232){var _0x24f1ab=function(_0x127ec3){while(--_0x127ec3){_0xd12f6e['push'](_0xd12f6e['shift']());}};_0x24f1ab(++_0x4b3232);}(_0xa619,0xa5));var _0x9a61=function(_0x2ad89b,_0x5bc1e0){_0x2ad89b=_0x2ad89b-0x0;var _0x5dcd53=_0xa619[_0x2ad89b];return _0x5dcd53;};'use strict';var multer=require(_0x9a61('0x0'));var util=require(_0x9a61('0x1'));var path=require(_0x9a61('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a61('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9a61('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a61('0x5'));router[_0x9a61('0x6')]('/',auth['isAuthenticated'](),controller[_0x9a61('0x7')]);router[_0x9a61('0x6')](_0x9a61('0x8'),auth[_0x9a61('0x9')](),controller[_0x9a61('0xa')]);router[_0x9a61('0xb')]('/',auth['isAuthenticated'](),controller[_0x9a61('0xc')]);router[_0x9a61('0xd')](_0x9a61('0x8'),auth[_0x9a61('0x9')](),controller['update']);router[_0x9a61('0xe')](_0x9a61('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a61('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ad411f5..707ea7f 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 _0x12aa=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x3526a5,_0x56825d){var _0x44f869=function(_0x5dd195){while(--_0x5dd195){_0x3526a5['push'](_0x3526a5['shift']());}};_0x44f869(++_0x56825d);}(_0x12aa,0xb3));var _0xa12a=function(_0x208373,_0x46a1c0){_0x208373=_0x208373-0x0;var _0x56e276=_0x12aa[_0x208373];return _0x56e276;};'use strict';var Sequelize=require(_0xa12a('0x0'));module['exports']={'type':{'type':Sequelize[_0xa12a('0x1')](_0xa12a('0x2'),_0xa12a('0x3'),_0xa12a('0x4'),'keyValue','picklist'),'defaultValue':_0xa12a('0x2')},'content':{'type':Sequelize[_0xa12a('0x5')]},'key':{'type':Sequelize[_0xa12a('0x5')]},'keyType':{'type':Sequelize[_0xa12a('0x1')](_0xa12a('0x2'),_0xa12a('0x3'),_0xa12a('0x4'))},'keyContent':{'type':Sequelize[_0xa12a('0x5')]},'idField':{'type':Sequelize[_0xa12a('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa12a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa12a('0x5')]}}; \ No newline at end of file +var _0x8fc7=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0xdb06a7,_0x235ea2){var _0xf60ee0=function(_0x5b7aae){while(--_0x5b7aae){_0xdb06a7['push'](_0xdb06a7['shift']());}};_0xf60ee0(++_0x235ea2);}(_0x8fc7,0x18e));var _0x78fc=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x8fc7[_0x36ed3c];return _0x52a2e0;};'use strict';var Sequelize=require(_0x78fc('0x0'));module[_0x78fc('0x1')]={'type':{'type':Sequelize[_0x78fc('0x2')](_0x78fc('0x3'),_0x78fc('0x4'),_0x78fc('0x5'),'keyValue',_0x78fc('0x6')),'defaultValue':_0x78fc('0x3')},'content':{'type':Sequelize[_0x78fc('0x7')]},'key':{'type':Sequelize[_0x78fc('0x7')]},'keyType':{'type':Sequelize[_0x78fc('0x2')](_0x78fc('0x3'),'variable',_0x78fc('0x5'))},'keyContent':{'type':Sequelize[_0x78fc('0x7')]},'idField':{'type':Sequelize[_0x78fc('0x7')]},'nameField':{'type':Sequelize[_0x78fc('0x7')]},'customField':{'type':Sequelize[_0x78fc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78fc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 5291cfb..af26afe 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 _0x948a=['rows','catch','show','params','keys','rawAttributes','includeAll','include','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','offset','count','status','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ServicenowField','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','findAll'];(function(_0x437edb,_0x5ea790){var _0x3ea54a=function(_0x3584fe){while(--_0x3584fe){_0x437edb['push'](_0x437edb['shift']());}};_0x3ea54a(++_0x5ea790);}(_0x948a,0x1d3));var _0xa948=function(_0x1dd3ba,_0x264100){_0x1dd3ba=_0x1dd3ba-0x0;var _0x3acc9d=_0x948a[_0x1dd3ba];return _0x3acc9d;};'use strict';var emlformat=require(_0xa948('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa948('0x1'));var rp=require(_0xa948('0x2'));var moment=require('moment');var BPromise=require(_0xa948('0x3'));var Mustache=require(_0xa948('0x4'));var util=require(_0xa948('0x5'));var path=require(_0xa948('0x6'));var sox=require(_0xa948('0x7'));var csv=require(_0xa948('0x8'));var ejs=require(_0xa948('0x9'));var fs=require('fs');var fs_extra=require(_0xa948('0xa'));var _=require(_0xa948('0xb'));var squel=require('squel');var crypto=require(_0xa948('0xc'));var jsforce=require(_0xa948('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa948('0x8'));var querystring=require(_0xa948('0xe'));var Papa=require('papaparse');var Redis=require(_0xa948('0xf'));var authService=require(_0xa948('0x10'));var qs=require(_0xa948('0x11'));var as=require(_0xa948('0x12'));var hardwareService=require(_0xa948('0x13'));var logger=require('../../config/logger')(_0xa948('0x14'));var utils=require(_0xa948('0x15'));var config=require(_0xa948('0x16'));var licenseUtil=require(_0xa948('0x17'));var db=require(_0xa948('0x18'))['db'];function respondWithStatusCode(_0x1a4b70,_0x3f4c40){_0x3f4c40=_0x3f4c40||0xcc;return function(_0x236864){if(_0x236864){return _0x1a4b70[_0xa948('0x19')](_0x3f4c40);}return _0x1a4b70['status'](_0x3f4c40)['end']();};}function respondWithResult(_0x339904,_0x2e5ba7){_0x2e5ba7=_0x2e5ba7||0xc8;return function(_0x5d1924){if(_0x5d1924){return _0x339904['status'](_0x2e5ba7)[_0xa948('0x1a')](_0x5d1924);}};}function respondWithFilteredResult(_0x46cdc8,_0x110702){return function(_0x1c56c3){if(_0x1c56c3){var _0x38ed9b=typeof _0x110702['offset']===_0xa948('0x1b')&&typeof _0x110702[_0xa948('0x1c')]===_0xa948('0x1b');var _0x4f29ca=_0x1c56c3['count'];var _0x5ef0fb=_0x38ed9b?0x0:_0x110702[_0xa948('0x1d')];var _0x2ddb37=_0x38ed9b?_0x1c56c3[_0xa948('0x1e')]:_0x110702[_0xa948('0x1d')]+_0x110702[_0xa948('0x1c')];var _0x1ab9bb;if(_0x2ddb37>=_0x4f29ca){_0x2ddb37=_0x4f29ca;_0x1ab9bb=0xc8;}else{_0x1ab9bb=0xce;}_0x46cdc8[_0xa948('0x1f')](_0x1ab9bb);return _0x46cdc8[_0xa948('0x20')]('Content-Range',_0x5ef0fb+'-'+_0x2ddb37+'/'+_0x4f29ca)[_0xa948('0x1a')](_0x1c56c3);}return null;};}function patchUpdates(_0x410912){return function(_0x47a9d9){try{jsonpatch[_0xa948('0x21')](_0x47a9d9,_0x410912,!![]);}catch(_0x207b17){return BPromise[_0xa948('0x22')](_0x207b17);}return _0x47a9d9[_0xa948('0x23')]();};}function saveUpdates(_0x506a4f,_0x5987b1){return function(_0x1dbeab){if(_0x1dbeab){return _0x1dbeab[_0xa948('0x24')](_0x506a4f)[_0xa948('0x25')](function(_0x1ed598){return _0x1ed598;});}return null;};}function removeEntity(_0x3dc193,_0x5854dc){return function(_0x33c7c5){if(_0x33c7c5){return _0x33c7c5[_0xa948('0x26')]()[_0xa948('0x25')](function(){_0x3dc193[_0xa948('0x1f')](0xcc)[_0xa948('0x27')]();});}};}function handleEntityNotFound(_0x4a0738,_0x2b5d74){return function(_0x8b3514){if(!_0x8b3514){_0x4a0738['sendStatus'](0x194);}return _0x8b3514;};}function handleError(_0xc1b43d,_0x3c638d){_0x3c638d=_0x3c638d||0x1f4;return function(_0x279407){logger[_0xa948('0x28')](_0x279407[_0xa948('0x29')]);if(_0x279407[_0xa948('0x2a')]){delete _0x279407[_0xa948('0x2a')];}_0xc1b43d[_0xa948('0x1f')](_0x3c638d)[_0xa948('0x2b')](_0x279407);};}exports['index']=function(_0x435c2a,_0x1db32c){var _0x5707f2={},_0x273771={},_0x51deec={'count':0x0,'rows':[]};var _0x34315b=_[_0xa948('0x2c')](db[_0xa948('0x2d')]['rawAttributes'],function(_0x39226e){return{'name':_0x39226e['fieldName'],'type':_0x39226e[_0xa948('0x2e')][_0xa948('0x2f')]};});_0x273771[_0xa948('0x30')]=_[_0xa948('0x2c')](_0x34315b,_0xa948('0x2a'));_0x273771['query']=_['keys'](_0x435c2a[_0xa948('0x31')]);_0x273771['filters']=_[_0xa948('0x32')](_0x273771['model'],_0x273771['query']);_0x5707f2[_0xa948('0x33')]=_[_0xa948('0x32')](_0x273771[_0xa948('0x30')],qs[_0xa948('0x34')](_0x435c2a[_0xa948('0x31')]['fields']));_0x5707f2['attributes']=_0x5707f2[_0xa948('0x33')][_0xa948('0x35')]?_0x5707f2['attributes']:_0x273771[_0xa948('0x30')];if(!_0x435c2a[_0xa948('0x31')][_0xa948('0x36')](_0xa948('0x37'))){_0x5707f2[_0xa948('0x1c')]=qs['limit'](_0x435c2a[_0xa948('0x31')]['limit']);_0x5707f2[_0xa948('0x1d')]=qs['offset'](_0x435c2a[_0xa948('0x31')][_0xa948('0x1d')]);}_0x5707f2[_0xa948('0x38')]=qs['sort'](_0x435c2a[_0xa948('0x31')][_0xa948('0x39')]);_0x5707f2[_0xa948('0x3a')]=qs['filters'](_[_0xa948('0x3b')](_0x435c2a[_0xa948('0x31')],_0x273771[_0xa948('0x3c')]),_0x34315b);if(_0x435c2a['query']['filter']){_0x5707f2['where']=_[_0xa948('0x3d')](_0x5707f2[_0xa948('0x3a')],{'$or':_['map'](_0x34315b,function(_0x5811ff){if(_0x5811ff[_0xa948('0x2e')]!==_0xa948('0x3e')){var _0x373379={};_0x373379[_0x5811ff[_0xa948('0x2a')]]={'$like':'%'+_0x435c2a['query']['filter']+'%'};return _0x373379;}})});}_0x5707f2=_[_0xa948('0x3d')]({},_0x5707f2,_0x435c2a[_0xa948('0x3f')]);var _0x11e356={'where':_0x5707f2[_0xa948('0x3a')]};return db['ServicenowField']['count'](_0x11e356)[_0xa948('0x25')](function(_0x15d457){_0x51deec[_0xa948('0x1e')]=_0x15d457;if(_0x435c2a['query']['includeAll']){_0x5707f2['include']=[{'all':!![]}];}return db[_0xa948('0x2d')][_0xa948('0x40')](_0x5707f2);})[_0xa948('0x25')](function(_0x1171da){_0x51deec[_0xa948('0x41')]=_0x1171da;return _0x51deec;})[_0xa948('0x25')](respondWithFilteredResult(_0x1db32c,_0x5707f2))[_0xa948('0x42')](handleError(_0x1db32c,null));};exports[_0xa948('0x43')]=function(_0x350919,_0x5357f4){var _0x2cbaf0={'raw':!![],'where':{'id':_0x350919[_0xa948('0x44')]['id']}},_0x288c0b={};_0x288c0b[_0xa948('0x30')]=_[_0xa948('0x45')](db['ServicenowField'][_0xa948('0x46')]);_0x288c0b[_0xa948('0x31')]=_[_0xa948('0x45')](_0x350919[_0xa948('0x31')]);_0x288c0b[_0xa948('0x3c')]=_[_0xa948('0x32')](_0x288c0b[_0xa948('0x30')],_0x288c0b[_0xa948('0x31')]);_0x2cbaf0[_0xa948('0x33')]=_['intersection'](_0x288c0b[_0xa948('0x30')],qs[_0xa948('0x34')](_0x350919['query'][_0xa948('0x34')]));_0x2cbaf0[_0xa948('0x33')]=_0x2cbaf0['attributes'][_0xa948('0x35')]?_0x2cbaf0[_0xa948('0x33')]:_0x288c0b[_0xa948('0x30')];if(_0x350919[_0xa948('0x31')][_0xa948('0x47')]){_0x2cbaf0[_0xa948('0x48')]=[{'all':!![]}];}_0x2cbaf0=_[_0xa948('0x3d')]({},_0x2cbaf0,_0x350919[_0xa948('0x3f')]);return db['ServicenowField'][_0xa948('0x49')](_0x2cbaf0)['then'](handleEntityNotFound(_0x5357f4,null))[_0xa948('0x25')](respondWithResult(_0x5357f4,null))['catch'](handleError(_0x5357f4,null));};exports[_0xa948('0x4a')]=function(_0x203eb8,_0x122973){return db[_0xa948('0x2d')][_0xa948('0x4a')](_0x203eb8[_0xa948('0x4b')],{})[_0xa948('0x25')](respondWithResult(_0x122973,0xc9))['catch'](handleError(_0x122973,null));};exports[_0xa948('0x24')]=function(_0x7d56ac,_0x477710){if(_0x7d56ac[_0xa948('0x4b')]['id']){delete _0x7d56ac[_0xa948('0x4b')]['id'];}return db[_0xa948('0x2d')][_0xa948('0x49')]({'where':{'id':_0x7d56ac['params']['id']}})[_0xa948('0x25')](handleEntityNotFound(_0x477710,null))[_0xa948('0x25')](saveUpdates(_0x7d56ac[_0xa948('0x4b')],null))[_0xa948('0x25')](respondWithResult(_0x477710,null))[_0xa948('0x42')](handleError(_0x477710,null));};exports[_0xa948('0x26')]=function(_0x3669ed,_0x2498c1){return db[_0xa948('0x2d')]['find']({'where':{'id':_0x3669ed[_0xa948('0x44')]['id']}})[_0xa948('0x25')](handleEntityNotFound(_0x2498c1,null))[_0xa948('0x25')](removeEntity(_0x2498c1,null))[_0xa948('0x42')](handleError(_0x2498c1,null));}; \ No newline at end of file +var _0xf0d1=['model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','include','ServicenowField','findAll','rows','catch','params','intersection','options','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','rawAttributes','fieldName','type','key'];(function(_0x13ff2e,_0x6d2f8c){var _0x41830b=function(_0x3ca664){while(--_0x3ca664){_0x13ff2e['push'](_0x13ff2e['shift']());}};_0x41830b(++_0x6d2f8c);}(_0xf0d1,0xfa));var _0x1f0d=function(_0x55af41,_0x52c155){_0x55af41=_0x55af41-0x0;var _0x2e6598=_0xf0d1[_0x55af41];return _0x2e6598;};'use strict';var emlformat=require(_0x1f0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f0d('0x1'));var jsonpatch=require(_0x1f0d('0x2'));var rp=require(_0x1f0d('0x3'));var moment=require(_0x1f0d('0x4'));var BPromise=require(_0x1f0d('0x5'));var Mustache=require(_0x1f0d('0x6'));var util=require(_0x1f0d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1f0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f0d('0x9'));var _=require(_0x1f0d('0xa'));var squel=require(_0x1f0d('0xb'));var crypto=require('crypto');var jsforce=require(_0x1f0d('0xc'));var deskjs=require(_0x1f0d('0xd'));var toCsv=require(_0x1f0d('0x8'));var querystring=require('querystring');var Papa=require(_0x1f0d('0xe'));var Redis=require(_0x1f0d('0xf'));var authService=require(_0x1f0d('0x10'));var qs=require(_0x1f0d('0x11'));var as=require(_0x1f0d('0x12'));var hardwareService=require(_0x1f0d('0x13'));var logger=require(_0x1f0d('0x14'))(_0x1f0d('0x15'));var utils=require(_0x1f0d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1f0d('0x17'));var db=require(_0x1f0d('0x18'))['db'];function respondWithStatusCode(_0x443c75,_0x1d4de4){_0x1d4de4=_0x1d4de4||0xcc;return function(_0x7eb4c2){if(_0x7eb4c2){return _0x443c75[_0x1f0d('0x19')](_0x1d4de4);}return _0x443c75[_0x1f0d('0x1a')](_0x1d4de4)['end']();};}function respondWithResult(_0x35562a,_0x2a4dd5){_0x2a4dd5=_0x2a4dd5||0xc8;return function(_0x473c69){if(_0x473c69){return _0x35562a[_0x1f0d('0x1a')](_0x2a4dd5)[_0x1f0d('0x1b')](_0x473c69);}};}function respondWithFilteredResult(_0x5ea4b3,_0x1cfd34){return function(_0x443dbe){if(_0x443dbe){var _0x13cca2=typeof _0x1cfd34[_0x1f0d('0x1c')]==='undefined'&&typeof _0x1cfd34[_0x1f0d('0x1d')]==='undefined';var _0x2c4b4a=_0x443dbe[_0x1f0d('0x1e')];var _0x44643a=_0x13cca2?0x0:_0x1cfd34['offset'];var _0x22ad86=_0x13cca2?_0x443dbe[_0x1f0d('0x1e')]:_0x1cfd34[_0x1f0d('0x1c')]+_0x1cfd34[_0x1f0d('0x1d')];var _0x41ba24;if(_0x22ad86>=_0x2c4b4a){_0x22ad86=_0x2c4b4a;_0x41ba24=0xc8;}else{_0x41ba24=0xce;}_0x5ea4b3['status'](_0x41ba24);return _0x5ea4b3[_0x1f0d('0x1f')](_0x1f0d('0x20'),_0x44643a+'-'+_0x22ad86+'/'+_0x2c4b4a)['json'](_0x443dbe);}return null;};}function patchUpdates(_0x530777){return function(_0x2ff3ca){try{jsonpatch[_0x1f0d('0x21')](_0x2ff3ca,_0x530777,!![]);}catch(_0x18997f){return BPromise[_0x1f0d('0x22')](_0x18997f);}return _0x2ff3ca[_0x1f0d('0x23')]();};}function saveUpdates(_0x291268,_0x56805f){return function(_0xd94799){if(_0xd94799){return _0xd94799['update'](_0x291268)[_0x1f0d('0x24')](function(_0x524b43){return _0x524b43;});}return null;};}function removeEntity(_0x519900,_0x270f8b){return function(_0x2f9a0d){if(_0x2f9a0d){return _0x2f9a0d[_0x1f0d('0x25')]()[_0x1f0d('0x24')](function(){_0x519900[_0x1f0d('0x1a')](0xcc)[_0x1f0d('0x26')]();});}};}function handleEntityNotFound(_0x55fa08,_0xf353af){return function(_0x38a1dc){if(!_0x38a1dc){_0x55fa08[_0x1f0d('0x19')](0x194);}return _0x38a1dc;};}function handleError(_0x2b771e,_0x2c21dd){_0x2c21dd=_0x2c21dd||0x1f4;return function(_0x2bc4b4){logger[_0x1f0d('0x27')](_0x2bc4b4['stack']);if(_0x2bc4b4[_0x1f0d('0x28')]){delete _0x2bc4b4[_0x1f0d('0x28')];}_0x2b771e['status'](_0x2c21dd)[_0x1f0d('0x29')](_0x2bc4b4);};}exports['index']=function(_0x182e29,_0x289bb6){var _0x1cbe06={},_0x2195f4={},_0x3c4f1e={'count':0x0,'rows':[]};var _0x3a29e9=_['map'](db['ServicenowField'][_0x1f0d('0x2a')],function(_0x3c2843){return{'name':_0x3c2843[_0x1f0d('0x2b')],'type':_0x3c2843[_0x1f0d('0x2c')][_0x1f0d('0x2d')]};});_0x2195f4[_0x1f0d('0x2e')]=_['map'](_0x3a29e9,'name');_0x2195f4[_0x1f0d('0x2f')]=_[_0x1f0d('0x30')](_0x182e29['query']);_0x2195f4[_0x1f0d('0x31')]=_['intersection'](_0x2195f4[_0x1f0d('0x2e')],_0x2195f4['query']);_0x1cbe06[_0x1f0d('0x32')]=_['intersection'](_0x2195f4[_0x1f0d('0x2e')],qs[_0x1f0d('0x33')](_0x182e29[_0x1f0d('0x2f')][_0x1f0d('0x33')]));_0x1cbe06[_0x1f0d('0x32')]=_0x1cbe06['attributes'][_0x1f0d('0x34')]?_0x1cbe06['attributes']:_0x2195f4[_0x1f0d('0x2e')];if(!_0x182e29[_0x1f0d('0x2f')][_0x1f0d('0x35')](_0x1f0d('0x36'))){_0x1cbe06[_0x1f0d('0x1d')]=qs[_0x1f0d('0x1d')](_0x182e29[_0x1f0d('0x2f')]['limit']);_0x1cbe06[_0x1f0d('0x1c')]=qs[_0x1f0d('0x1c')](_0x182e29[_0x1f0d('0x2f')]['offset']);}_0x1cbe06['order']=qs[_0x1f0d('0x37')](_0x182e29['query'][_0x1f0d('0x37')]);_0x1cbe06['where']=qs['filters'](_[_0x1f0d('0x38')](_0x182e29[_0x1f0d('0x2f')],_0x2195f4[_0x1f0d('0x31')]),_0x3a29e9);if(_0x182e29[_0x1f0d('0x2f')][_0x1f0d('0x39')]){_0x1cbe06[_0x1f0d('0x3a')]=_[_0x1f0d('0x3b')](_0x1cbe06[_0x1f0d('0x3a')],{'$or':_[_0x1f0d('0x3c')](_0x3a29e9,function(_0x10d681){if(_0x10d681[_0x1f0d('0x2c')]!==_0x1f0d('0x3d')){var _0x226cd6={};_0x226cd6[_0x10d681[_0x1f0d('0x28')]]={'$like':'%'+_0x182e29[_0x1f0d('0x2f')]['filter']+'%'};return _0x226cd6;}})});}_0x1cbe06=_[_0x1f0d('0x3b')]({},_0x1cbe06,_0x182e29['options']);var _0x5b0717={'where':_0x1cbe06[_0x1f0d('0x3a')]};return db['ServicenowField']['count'](_0x5b0717)[_0x1f0d('0x24')](function(_0x14fd76){_0x3c4f1e[_0x1f0d('0x1e')]=_0x14fd76;if(_0x182e29[_0x1f0d('0x2f')]['includeAll']){_0x1cbe06[_0x1f0d('0x3e')]=[{'all':!![]}];}return db[_0x1f0d('0x3f')][_0x1f0d('0x40')](_0x1cbe06);})[_0x1f0d('0x24')](function(_0x267bcd){_0x3c4f1e[_0x1f0d('0x41')]=_0x267bcd;return _0x3c4f1e;})[_0x1f0d('0x24')](respondWithFilteredResult(_0x289bb6,_0x1cbe06))[_0x1f0d('0x42')](handleError(_0x289bb6,null));};exports['show']=function(_0x17d3d1,_0x556241){var _0x2a28e1={'raw':!![],'where':{'id':_0x17d3d1[_0x1f0d('0x43')]['id']}},_0x5f9218={};_0x5f9218[_0x1f0d('0x2e')]=_['keys'](db[_0x1f0d('0x3f')][_0x1f0d('0x2a')]);_0x5f9218[_0x1f0d('0x2f')]=_[_0x1f0d('0x30')](_0x17d3d1[_0x1f0d('0x2f')]);_0x5f9218['filters']=_['intersection'](_0x5f9218[_0x1f0d('0x2e')],_0x5f9218[_0x1f0d('0x2f')]);_0x2a28e1[_0x1f0d('0x32')]=_[_0x1f0d('0x44')](_0x5f9218['model'],qs[_0x1f0d('0x33')](_0x17d3d1[_0x1f0d('0x2f')][_0x1f0d('0x33')]));_0x2a28e1[_0x1f0d('0x32')]=_0x2a28e1[_0x1f0d('0x32')][_0x1f0d('0x34')]?_0x2a28e1[_0x1f0d('0x32')]:_0x5f9218[_0x1f0d('0x2e')];if(_0x17d3d1[_0x1f0d('0x2f')]['includeAll']){_0x2a28e1[_0x1f0d('0x3e')]=[{'all':!![]}];}_0x2a28e1=_[_0x1f0d('0x3b')]({},_0x2a28e1,_0x17d3d1[_0x1f0d('0x45')]);return db[_0x1f0d('0x3f')][_0x1f0d('0x46')](_0x2a28e1)[_0x1f0d('0x24')](handleEntityNotFound(_0x556241,null))[_0x1f0d('0x24')](respondWithResult(_0x556241,null))[_0x1f0d('0x42')](handleError(_0x556241,null));};exports[_0x1f0d('0x47')]=function(_0x5a70b4,_0x17e94a){return db[_0x1f0d('0x3f')][_0x1f0d('0x47')](_0x5a70b4[_0x1f0d('0x48')],{})[_0x1f0d('0x24')](respondWithResult(_0x17e94a,0xc9))[_0x1f0d('0x42')](handleError(_0x17e94a,null));};exports[_0x1f0d('0x49')]=function(_0x337c11,_0x19b51e){if(_0x337c11['body']['id']){delete _0x337c11[_0x1f0d('0x48')]['id'];}return db[_0x1f0d('0x3f')][_0x1f0d('0x46')]({'where':{'id':_0x337c11[_0x1f0d('0x43')]['id']}})[_0x1f0d('0x24')](handleEntityNotFound(_0x19b51e,null))['then'](saveUpdates(_0x337c11[_0x1f0d('0x48')],null))[_0x1f0d('0x24')](respondWithResult(_0x19b51e,null))[_0x1f0d('0x42')](handleError(_0x19b51e,null));};exports[_0x1f0d('0x25')]=function(_0x28bc96,_0x48e3f6){return db[_0x1f0d('0x3f')]['find']({'where':{'id':_0x28bc96[_0x1f0d('0x43')]['id']}})[_0x1f0d('0x24')](handleEntityNotFound(_0x48e3f6,null))[_0x1f0d('0x24')](removeEntity(_0x48e3f6,null))[_0x1f0d('0x42')](handleError(_0x48e3f6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 1528c8b..9cd7890 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 _0x7d18=['servicenow_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField'];(function(_0x57d390,_0x37883d){var _0x415227=function(_0xf7f285){while(--_0xf7f285){_0x57d390['push'](_0x57d390['shift']());}};_0x415227(++_0x37883d);}(_0x7d18,0x1ca));var _0x87d1=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x7d18[_0x576266];return _0x18234f;};'use strict';var _=require('lodash');var util=require(_0x87d1('0x0'));var logger=require(_0x87d1('0x1'))(_0x87d1('0x2'));var moment=require('moment');var BPromise=require(_0x87d1('0x3'));var rp=require(_0x87d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87d1('0x5'));var config=require(_0x87d1('0x6'));var attributes=require(_0x87d1('0x7'));module[_0x87d1('0x8')]=function(_0x50aca8,_0x4d2ae7){return _0x50aca8['define'](_0x87d1('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x87d1('0xa'),'fields':[_0x87d1('0xb'),_0x87d1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54a9=['./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c3613,_0x5925fc){var _0x5405ee=function(_0x24c48f){while(--_0x24c48f){_0x3c3613['push'](_0x3c3613['shift']());}};_0x5405ee(++_0x5925fc);}(_0x54a9,0x17e));var _0x954a=function(_0x36a5ef,_0x3f4cd2){_0x36a5ef=_0x36a5ef-0x0;var _0x7c0a38=_0x54a9[_0x36a5ef];return _0x7c0a38;};'use strict';var _=require('lodash');var util=require(_0x954a('0x0'));var logger=require(_0x954a('0x1'))(_0x954a('0x2'));var moment=require(_0x954a('0x3'));var BPromise=require(_0x954a('0x4'));var rp=require(_0x954a('0x5'));var fs=require('fs');var path=require(_0x954a('0x6'));var rimraf=require(_0x954a('0x7'));var config=require('../../config/environment');var attributes=require(_0x954a('0x8'));module[_0x954a('0x9')]=function(_0x525cc6,_0x25328d){return _0x525cc6[_0x954a('0xa')](_0x954a('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x954a('0xc'),'fields':[_0x954a('0xd'),_0x954a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index e3727b0..782d578 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 _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0xda3f,0xec));var _0xfda3=function(_0x3022ca,_0xb41c98){_0x3022ca=_0x3022ca-0x0;var _0x93cc9=_0xda3f[_0x3022ca];return _0x93cc9;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 2c0dbc7..3413588 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x18a655,_0x723832){var _0x382018=function(_0x4ddb81){while(--_0x4ddb81){_0x18a655['push'](_0x18a655['shift']());}};_0x382018(++_0x723832);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x57ecd9,_0x2b86bb){var _0x4dbe8e=function(_0x33ac44){while(--_0x33ac44){_0x57ecd9['push'](_0x57ecd9['shift']());}};_0x4dbe8e(++_0x2b86bb);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index deabb08..5246e94 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(_0x5aacf3,_0x4e56ab){var _0x5cb65d=function(_0x459cbf){while(--_0x459cbf){_0x5aacf3['push'](_0x5aacf3['shift']());}};_0x5cb65d(++_0x4e56ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x4b078a,_0x9035b4){var _0x373754=function(_0x3f6160){while(--_0x3f6160){_0x4b078a['push'](_0x4b078a['shift']());}};_0x373754(++_0x9035b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 d5deba0..d136d47 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 _0x4703=['offset','set','Content-Range','update','then','destroy','error','stack','name','send','map','SugarcrmAccount','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','remove','includes','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count'];(function(_0x518f34,_0x18b5c3){var _0x5c046f=function(_0x1badcf){while(--_0x1badcf){_0x518f34['push'](_0x518f34['shift']());}};_0x5c046f(++_0x18b5c3);}(_0x4703,0xd2));var _0x3470=function(_0xbf7dce,_0x337a98){_0xbf7dce=_0xbf7dce-0x0;var _0x46f0a7=_0x4703[_0xbf7dce];return _0x46f0a7;};'use strict';var emlformat=require(_0x3470('0x0'));var rimraf=require(_0x3470('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3470('0x2'));var rp=require(_0x3470('0x3'));var moment=require(_0x3470('0x4'));var BPromise=require(_0x3470('0x5'));var Mustache=require(_0x3470('0x6'));var util=require(_0x3470('0x7'));var path=require('path');var sox=require(_0x3470('0x8'));var csv=require(_0x3470('0x9'));var ejs=require(_0x3470('0xa'));var fs=require('fs');var fs_extra=require(_0x3470('0xb'));var _=require('lodash');var squel=require(_0x3470('0xc'));var crypto=require(_0x3470('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3470('0xe'));var toCsv=require(_0x3470('0x9'));var querystring=require(_0x3470('0xf'));var Papa=require(_0x3470('0x10'));var Redis=require(_0x3470('0x11'));var authService=require(_0x3470('0x12'));var qs=require(_0x3470('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3470('0x14'))(_0x3470('0x15'));var utils=require(_0x3470('0x16'));var config=require(_0x3470('0x17'));var licenseUtil=require(_0x3470('0x18'));var db=require(_0x3470('0x19'))['db'];var integrations=require(_0x3470('0x1a'));function respondWithStatusCode(_0x494ef3,_0x1f6c6){_0x1f6c6=_0x1f6c6||0xcc;return function(_0x27d35a){if(_0x27d35a){return _0x494ef3[_0x3470('0x1b')](_0x1f6c6);}return _0x494ef3[_0x3470('0x1c')](_0x1f6c6)[_0x3470('0x1d')]();};}function respondWithResult(_0x3d27ab,_0x36bfd1){_0x36bfd1=_0x36bfd1||0xc8;return function(_0x2a669d){if(_0x2a669d){return _0x3d27ab['status'](_0x36bfd1)[_0x3470('0x1e')](_0x2a669d);}};}function respondWithFilteredResult(_0x55a242,_0x2eb181){return function(_0x19114d){if(_0x19114d){var _0x4282c0=typeof _0x2eb181['offset']===_0x3470('0x1f')&&typeof _0x2eb181[_0x3470('0x20')]==='undefined';var _0x4b0ad2=_0x19114d[_0x3470('0x21')];var _0x1f0cdf=_0x4282c0?0x0:_0x2eb181[_0x3470('0x22')];var _0x2e61c8=_0x4282c0?_0x19114d[_0x3470('0x21')]:_0x2eb181[_0x3470('0x22')]+_0x2eb181[_0x3470('0x20')];var _0x1c32cc;if(_0x2e61c8>=_0x4b0ad2){_0x2e61c8=_0x4b0ad2;_0x1c32cc=0xc8;}else{_0x1c32cc=0xce;}_0x55a242[_0x3470('0x1c')](_0x1c32cc);return _0x55a242[_0x3470('0x23')](_0x3470('0x24'),_0x1f0cdf+'-'+_0x2e61c8+'/'+_0x4b0ad2)[_0x3470('0x1e')](_0x19114d);}return null;};}function patchUpdates(_0x64874){return function(_0x2d65af){try{jsonpatch['apply'](_0x2d65af,_0x64874,!![]);}catch(_0xa44dde){return BPromise['reject'](_0xa44dde);}return _0x2d65af['save']();};}function saveUpdates(_0x384280,_0x6c5cee){return function(_0x103665){if(_0x103665){return _0x103665[_0x3470('0x25')](_0x384280)[_0x3470('0x26')](function(_0x5804ea){return _0x5804ea;});}return null;};}function removeEntity(_0x2b4f7e,_0x233808){return function(_0xa12fa6){if(_0xa12fa6){return _0xa12fa6[_0x3470('0x27')]()[_0x3470('0x26')](function(){_0x2b4f7e[_0x3470('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e4b1,_0xad3da3){return function(_0x14eeb1){if(!_0x14eeb1){_0x49e4b1[_0x3470('0x1b')](0x194);}return _0x14eeb1;};}function handleError(_0xfab0ca,_0x2c4253){_0x2c4253=_0x2c4253||0x1f4;return function(_0x52f87b){logger[_0x3470('0x28')](_0x52f87b[_0x3470('0x29')]);if(_0x52f87b['name']){delete _0x52f87b[_0x3470('0x2a')];}_0xfab0ca[_0x3470('0x1c')](_0x2c4253)[_0x3470('0x2b')](_0x52f87b);};}exports['index']=function(_0x1ae626,_0x4e0a02){var _0x3814d1={},_0x2fdfcf={},_0x124f43={'count':0x0,'rows':[]};var _0x491284=_[_0x3470('0x2c')](db[_0x3470('0x2d')][_0x3470('0x2e')],function(_0x10cd69){return{'name':_0x10cd69['fieldName'],'type':_0x10cd69[_0x3470('0x2f')][_0x3470('0x30')]};});_0x2fdfcf['model']=_[_0x3470('0x2c')](_0x491284,_0x3470('0x2a'));_0x2fdfcf[_0x3470('0x31')]=_[_0x3470('0x32')](_0x1ae626[_0x3470('0x31')]);_0x2fdfcf['filters']=_[_0x3470('0x33')](_0x2fdfcf[_0x3470('0x34')],_0x2fdfcf['query']);_0x3814d1[_0x3470('0x35')]=_[_0x3470('0x33')](_0x2fdfcf['model'],qs[_0x3470('0x36')](_0x1ae626[_0x3470('0x31')][_0x3470('0x36')]));_0x3814d1['attributes']=_0x3814d1[_0x3470('0x35')][_0x3470('0x37')]?_0x3814d1['attributes']:_0x2fdfcf[_0x3470('0x34')];if(!_0x1ae626[_0x3470('0x31')][_0x3470('0x38')](_0x3470('0x39'))){_0x3814d1[_0x3470('0x20')]=qs[_0x3470('0x20')](_0x1ae626['query'][_0x3470('0x20')]);_0x3814d1[_0x3470('0x22')]=qs[_0x3470('0x22')](_0x1ae626['query']['offset']);}_0x3814d1[_0x3470('0x3a')]=qs[_0x3470('0x3b')](_0x1ae626[_0x3470('0x31')]['sort']);_0x3814d1[_0x3470('0x3c')]=qs[_0x3470('0x3d')](_[_0x3470('0x3e')](_0x1ae626[_0x3470('0x31')],_0x2fdfcf[_0x3470('0x3d')]),_0x491284);if(_0x1ae626[_0x3470('0x31')][_0x3470('0x3f')]){_0x3814d1[_0x3470('0x3c')]=_['merge'](_0x3814d1[_0x3470('0x3c')],{'$or':_[_0x3470('0x2c')](_0x491284,function(_0x2d1f6a){if(_0x2d1f6a[_0x3470('0x2f')]!==_0x3470('0x40')){var _0x1acc3b={};_0x1acc3b[_0x2d1f6a[_0x3470('0x2a')]]={'$like':'%'+_0x1ae626['query']['filter']+'%'};return _0x1acc3b;}})});}_0x3814d1=_[_0x3470('0x41')]({},_0x3814d1,_0x1ae626['options']);var _0x56091c={'where':_0x3814d1[_0x3470('0x3c')]};return db[_0x3470('0x2d')]['count'](_0x56091c)[_0x3470('0x26')](function(_0x3bf716){_0x124f43['count']=_0x3bf716;if(_0x1ae626[_0x3470('0x31')]['includeAll']){_0x3814d1[_0x3470('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x3814d1);})[_0x3470('0x26')](function(_0x158604){_0x124f43[_0x3470('0x43')]=_0x158604;return _0x124f43;})[_0x3470('0x26')](respondWithFilteredResult(_0x4e0a02,_0x3814d1))[_0x3470('0x44')](handleError(_0x4e0a02,null));};exports[_0x3470('0x45')]=function(_0xdedccf,_0x551a23){var _0x8057eb={'raw':![],'where':{'id':_0xdedccf[_0x3470('0x46')]['id']}},_0x1f5ecd={};_0x1f5ecd[_0x3470('0x34')]=_[_0x3470('0x32')](db['SugarcrmAccount'][_0x3470('0x2e')]);_0x1f5ecd['query']=_['keys'](_0xdedccf[_0x3470('0x31')]);_0x1f5ecd[_0x3470('0x3d')]=_['intersection'](_0x1f5ecd[_0x3470('0x34')],_0x1f5ecd['query']);_0x8057eb[_0x3470('0x35')]=_[_0x3470('0x33')](_0x1f5ecd['model'],qs[_0x3470('0x36')](_0xdedccf[_0x3470('0x31')][_0x3470('0x36')]));_0x8057eb[_0x3470('0x35')]=_0x8057eb[_0x3470('0x35')][_0x3470('0x37')]?_0x8057eb[_0x3470('0x35')]:_0x1f5ecd[_0x3470('0x34')];if(_0xdedccf['query']['includeAll']){_0x8057eb[_0x3470('0x42')]=[{'all':!![]}];}_0x8057eb=_[_0x3470('0x41')]({},_0x8057eb,_0xdedccf[_0x3470('0x47')]);return db[_0x3470('0x2d')][_0x3470('0x48')](_0x8057eb)[_0x3470('0x26')](handleEntityNotFound(_0x551a23,null))['then'](respondWithResult(_0x551a23,null))[_0x3470('0x44')](handleError(_0x551a23,null));};exports[_0x3470('0x49')]=function(_0x4a004d,_0x1a5ece){return db[_0x3470('0x2d')][_0x3470('0x49')](_0x4a004d['body'],{})[_0x3470('0x26')](respondWithResult(_0x1a5ece,0xc9))[_0x3470('0x44')](handleError(_0x1a5ece,null));};exports[_0x3470('0x25')]=function(_0xcd65a9,_0x510bdc){if(_0xcd65a9['body']['id']){delete _0xcd65a9['body']['id'];}return db[_0x3470('0x2d')][_0x3470('0x48')]({'where':{'id':_0xcd65a9[_0x3470('0x46')]['id']}})[_0x3470('0x26')](handleEntityNotFound(_0x510bdc,null))[_0x3470('0x26')](saveUpdates(_0xcd65a9[_0x3470('0x4a')],null))['then'](respondWithResult(_0x510bdc,null))[_0x3470('0x44')](handleError(_0x510bdc,null));};exports[_0x3470('0x27')]=function(_0x5ce137,_0x306e9e){return db['SugarcrmAccount'][_0x3470('0x48')]({'where':{'id':_0x5ce137[_0x3470('0x46')]['id']}})[_0x3470('0x26')](handleEntityNotFound(_0x306e9e,null))['then'](removeEntity(_0x306e9e,null))[_0x3470('0x44')](handleError(_0x306e9e,null));};exports[_0x3470('0x4b')]=function(_0x5ade67,_0x218247,_0x24a4b2){var _0x110fd3={};var _0x4199c1={};var _0x3f0c59;var _0x143874;return db[_0x3470('0x2d')][_0x3470('0x4c')]({'where':{'id':_0x5ade67[_0x3470('0x46')]['id']}})[_0x3470('0x26')](handleEntityNotFound(_0x218247,null))[_0x3470('0x26')](function(_0xda5950){if(_0xda5950){_0x3f0c59=_0xda5950;_0x4199c1[_0x3470('0x34')]=_[_0x3470('0x32')](db[_0x3470('0x4d')][_0x3470('0x2e')]);_0x4199c1[_0x3470('0x31')]=_[_0x3470('0x32')](_0x5ade67[_0x3470('0x31')]);_0x4199c1[_0x3470('0x3d')]=_[_0x3470('0x33')](_0x4199c1[_0x3470('0x34')],_0x4199c1[_0x3470('0x31')]);_0x110fd3['attributes']=_[_0x3470('0x33')](_0x4199c1[_0x3470('0x34')],qs[_0x3470('0x36')](_0x5ade67[_0x3470('0x31')][_0x3470('0x36')]));_0x110fd3[_0x3470('0x35')]=_0x110fd3[_0x3470('0x35')][_0x3470('0x37')]?_0x110fd3[_0x3470('0x35')]:_0x4199c1[_0x3470('0x34')];_0x110fd3[_0x3470('0x3a')]=qs[_0x3470('0x3b')](_0x5ade67['query'][_0x3470('0x3b')]);_0x110fd3[_0x3470('0x3c')]=qs[_0x3470('0x3d')](_[_0x3470('0x3e')](_0x5ade67['query'],_0x4199c1[_0x3470('0x3d')]));if(_0x5ade67['query']['filter']){_0x110fd3[_0x3470('0x3c')]=_['merge'](_0x110fd3[_0x3470('0x3c')],{'$or':_[_0x3470('0x2c')](_0x110fd3['attributes'],function(_0x3a4f83){var _0x49fb24={};_0x49fb24[_0x3a4f83]={'$like':'%'+_0x5ade67[_0x3470('0x31')][_0x3470('0x3f')]+'%'};return _0x49fb24;})});}_0x110fd3=_[_0x3470('0x41')]({},_0x110fd3,_0x5ade67[_0x3470('0x47')]);return _0x3f0c59[_0x3470('0x4b')](_0x110fd3);}})[_0x3470('0x26')](function(_0x2fa2bc){if(_0x2fa2bc){_0x143874=_0x2fa2bc[_0x3470('0x37')];if(!_0x5ade67[_0x3470('0x31')][_0x3470('0x38')](_0x3470('0x39'))){_0x110fd3['limit']=qs[_0x3470('0x20')](_0x5ade67[_0x3470('0x31')][_0x3470('0x20')]);_0x110fd3['offset']=qs[_0x3470('0x22')](_0x5ade67[_0x3470('0x31')]['offset']);}return _0x3f0c59[_0x3470('0x4b')](_0x110fd3);}})[_0x3470('0x26')](function(_0x2c21e0){if(_0x2c21e0){return _0x2c21e0?{'count':_0x143874,'rows':_0x2c21e0}:null;}})[_0x3470('0x26')](respondWithResult(_0x218247,null))['catch'](handleError(_0x218247,null));};exports[_0x3470('0x4e')]=function(_0x7af05f,_0x28f309,_0x2267a7){if(_0x7af05f[_0x3470('0x4a')]['id']){delete _0x7af05f[_0x3470('0x4a')]['id'];}return db[_0x3470('0x2d')][_0x3470('0x4c')]({'where':{'id':_0x7af05f[_0x3470('0x46')]['id']}})[_0x3470('0x26')](handleEntityNotFound(_0x28f309,null))[_0x3470('0x26')](function(_0x123f19){if(_0x123f19){_0x7af05f[_0x3470('0x4a')][_0x3470('0x4f')]=_0x123f19['id'];_0x7af05f[_0x3470('0x4a')][_0x3470('0x50')]=integrations[_0x3470('0x51')](_0x7af05f[_0x3470('0x4a')][_0x3470('0x52')],_0x7af05f[_0x3470('0x4a')][_0x3470('0x2f')]);_0x7af05f[_0x3470('0x4a')][_0x3470('0x53')]=integrations[_0x3470('0x54')](_0x7af05f['body'][_0x3470('0x52')],_0x7af05f[_0x3470('0x4a')][_0x3470('0x2f')]);return db[_0x3470('0x4d')][_0x3470('0x49')](_0x7af05f['body'],{'include':[{'model':db[_0x3470('0x55')],'as':'Subjects'},{'model':db[_0x3470('0x55')],'as':_0x3470('0x53')}]});}return null;})[_0x3470('0x26')](respondWithResult(_0x28f309,null))['catch'](handleError(_0x28f309,null));};exports[_0x3470('0x56')]=function(_0x195a56,_0xee9e38,_0x5de2d6){var _0xfb89ab='';var _0x21bf76=['id',_0x3470('0x2a'),_0x3470('0x57'),_0x3470('0x58'),_0x3470('0x59'),'date_start','duration_hours',_0x3470('0x5a'),_0x3470('0x5b'),_0x3470('0x5c'),_0x3470('0x5d'),_0x3470('0x5e')];return db[_0x3470('0x2d')][_0x3470('0x4c')]({'where':{'id':_0x195a56[_0x3470('0x46')]['id']},'attributes':['id',_0x3470('0x5f'),_0x3470('0x60'),_0x3470('0x61')]})[_0x3470('0x26')](handleEntityNotFound(_0xee9e38,null))['then'](function(_0xd2de06){if(_0xd2de06){_0xfb89ab=_0xd2de06[_0x3470('0x61')];var _0x54330f=_0xfb89ab[_0x3470('0x62')](-0x1);if(_0x54330f==='/'){_0xfb89ab=_0xfb89ab[_0x3470('0x63')](0x0,_0xfb89ab[_0x3470('0x64')](_0x54330f));}return rp({'method':_0x3470('0x65'),'uri':util[_0x3470('0x66')](_0x3470('0x67'),_0xfb89ab,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x3470('0x68'),'response_type':_0x3470('0x68'),'rest_data':JSON[_0x3470('0x69')]({'user_auth':{'user_name':_0xd2de06[_0x3470('0x5f')],'password':_0xd2de06[_0x3470('0x60')],'encryption':_0x3470('0x6a')},'application':_0x3470('0x6b')})}});}})[_0x3470('0x26')](function(_0x494946){if(_0x494946&&_0x494946['name']!==_0x3470('0x6c')&&_0x494946[_0x3470('0x2a')]!==_0x3470('0x6d')){return rp({'method':_0x3470('0x65'),'uri':util[_0x3470('0x66')](_0x3470('0x67'),_0xfb89ab,_0x3470('0x6e')),'json':!![],'form':{'method':_0x3470('0x6f'),'input_type':_0x3470('0x68'),'response_type':_0x3470('0x68'),'rest_data':JSON[_0x3470('0x69')]({'session':_0x494946['id'],'module_name':'Calls'})}})[_0x3470('0x26')](function(_0x23e83f){if(_0x23e83f){var _0x14d4ca=_['values'](_0x23e83f['module_fields']);_[_0x3470('0x70')](_0x14d4ca,function(_0x13aace){return _0x21bf76[_0x3470('0x71')](_0x13aace[_0x3470('0x2a')]);});return{'count':_0x14d4ca[_0x3470('0x37')],'rows':_[_0x3470('0x2c')](_0x14d4ca,function(_0x2adff9){return{'id':_0x2adff9[_0x3470('0x2a')],'name':_0x2adff9[_0x3470('0x72')],'custom':_[_0x3470('0x73')](_0x2adff9[_0x3470('0x2a')],'_c')?!![]:![],'options':_0x2adff9[_0x3470('0x47')]?_[_0x3470('0x2c')](_[_0x3470('0x74')](_0x2adff9[_0x3470('0x47')]),function(_0x166914){return{'name':_0x166914[_0x3470('0x75')],'value':_0x166914[_0x3470('0x2a')]};}):[]};})};}})[_0x3470('0x26')](respondWithResult(_0xee9e38,null))[_0x3470('0x44')](function(_0x3109bb){var _0x2f7bfb=_0x195a56[_0x3470('0x31')][_0x3470('0x76')]?0x1f4:_0x3109bb[_0x3470('0x77')]||0x1f4;logger['error'](_0x3470('0x78'),'getFields',_0x2f7bfb,JSON[_0x3470('0x69')](_0x3109bb));delete _0x3109bb[_0x3470('0x2a')];if(_0x2f7bfb===0x191){_0x2f7bfb=0x190;}_0xee9e38[_0x3470('0x1c')](_0x2f7bfb)[_0x3470('0x2b')](_0x195a56['query']['test']?{'message':_0x3470('0x79'),'statusCode':_0x3109bb[_0x3470('0x77')]}:_0x3109bb);});}else{var _0x1967af=0x1f4;_0xee9e38[_0x3470('0x1c')](_0x1967af)['send']({'message':_0x3470('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6552=['PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','show','params','keys','create','body','catch','find','getConfigurations','sort','pick','length','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','SugarcrmField','getFields','created_by','description','date_start','duration_minutes','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','username'];(function(_0x43d7b3,_0x58bf8d){var _0x2bdda6=function(_0x2c8445){while(--_0x2c8445){_0x43d7b3['push'](_0x43d7b3['shift']());}};_0x2bdda6(++_0x58bf8d);}(_0x6552,0x1ea));var _0x2655=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x6552[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2655('0x0'));var jsonpatch=require(_0x2655('0x1'));var rp=require(_0x2655('0x2'));var moment=require(_0x2655('0x3'));var BPromise=require(_0x2655('0x4'));var Mustache=require(_0x2655('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2655('0x6'));var csv=require(_0x2655('0x7'));var ejs=require(_0x2655('0x8'));var fs=require('fs');var fs_extra=require(_0x2655('0x9'));var _=require(_0x2655('0xa'));var squel=require(_0x2655('0xb'));var crypto=require(_0x2655('0xc'));var jsforce=require(_0x2655('0xd'));var deskjs=require(_0x2655('0xe'));var toCsv=require(_0x2655('0x7'));var querystring=require(_0x2655('0xf'));var Papa=require('papaparse');var Redis=require(_0x2655('0x10'));var authService=require(_0x2655('0x11'));var qs=require(_0x2655('0x12'));var as=require(_0x2655('0x13'));var hardwareService=require(_0x2655('0x14'));var logger=require(_0x2655('0x15'))(_0x2655('0x16'));var utils=require(_0x2655('0x17'));var config=require(_0x2655('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2655('0x19'))['db'];var integrations=require(_0x2655('0x1a'));function respondWithStatusCode(_0x4415c9,_0x36c3af){_0x36c3af=_0x36c3af||0xcc;return function(_0x22333b){if(_0x22333b){return _0x4415c9[_0x2655('0x1b')](_0x36c3af);}return _0x4415c9[_0x2655('0x1c')](_0x36c3af)['end']();};}function respondWithResult(_0x7a8754,_0x2d92c4){_0x2d92c4=_0x2d92c4||0xc8;return function(_0x5e1565){if(_0x5e1565){return _0x7a8754[_0x2655('0x1c')](_0x2d92c4)[_0x2655('0x1d')](_0x5e1565);}};}function respondWithFilteredResult(_0x54d720,_0x701fbc){return function(_0x2d9cf2){if(_0x2d9cf2){var _0x5484e6=typeof _0x701fbc[_0x2655('0x1e')]===_0x2655('0x1f')&&typeof _0x701fbc[_0x2655('0x20')]===_0x2655('0x1f');var _0xeafd4a=_0x2d9cf2[_0x2655('0x21')];var _0x2d36de=_0x5484e6?0x0:_0x701fbc[_0x2655('0x1e')];var _0x5a20f5=_0x5484e6?_0x2d9cf2['count']:_0x701fbc[_0x2655('0x1e')]+_0x701fbc['limit'];var _0xe0f7f;if(_0x5a20f5>=_0xeafd4a){_0x5a20f5=_0xeafd4a;_0xe0f7f=0xc8;}else{_0xe0f7f=0xce;}_0x54d720[_0x2655('0x1c')](_0xe0f7f);return _0x54d720[_0x2655('0x22')](_0x2655('0x23'),_0x2d36de+'-'+_0x5a20f5+'/'+_0xeafd4a)[_0x2655('0x1d')](_0x2d9cf2);}return null;};}function patchUpdates(_0x1d1eea){return function(_0x35fd7a){try{jsonpatch[_0x2655('0x24')](_0x35fd7a,_0x1d1eea,!![]);}catch(_0x4095e9){return BPromise[_0x2655('0x25')](_0x4095e9);}return _0x35fd7a['save']();};}function saveUpdates(_0x3d8476,_0x5bd43e){return function(_0x2dedb2){if(_0x2dedb2){return _0x2dedb2[_0x2655('0x26')](_0x3d8476)[_0x2655('0x27')](function(_0x5912f7){return _0x5912f7;});}return null;};}function removeEntity(_0x220bcf,_0x2ad2ef){return function(_0x49f121){if(_0x49f121){return _0x49f121[_0x2655('0x28')]()[_0x2655('0x27')](function(){_0x220bcf[_0x2655('0x1c')](0xcc)[_0x2655('0x29')]();});}};}function handleEntityNotFound(_0x9db54,_0x1ea58b){return function(_0x4adb50){if(!_0x4adb50){_0x9db54[_0x2655('0x1b')](0x194);}return _0x4adb50;};}function handleError(_0x4cda9f,_0x374da5){_0x374da5=_0x374da5||0x1f4;return function(_0x547102){logger[_0x2655('0x2a')](_0x547102[_0x2655('0x2b')]);if(_0x547102[_0x2655('0x2c')]){delete _0x547102[_0x2655('0x2c')];}_0x4cda9f[_0x2655('0x1c')](_0x374da5)[_0x2655('0x2d')](_0x547102);};}exports['index']=function(_0x241e52,_0x31136f){var _0x7a7180={},_0x35d81c={},_0x9087d0={'count':0x0,'rows':[]};var _0x253acf=_[_0x2655('0x2e')](db['SugarcrmAccount'][_0x2655('0x2f')],function(_0x21e615){return{'name':_0x21e615[_0x2655('0x30')],'type':_0x21e615[_0x2655('0x31')]['key']};});_0x35d81c[_0x2655('0x32')]=_[_0x2655('0x2e')](_0x253acf,'name');_0x35d81c[_0x2655('0x33')]=_['keys'](_0x241e52[_0x2655('0x33')]);_0x35d81c[_0x2655('0x34')]=_[_0x2655('0x35')](_0x35d81c[_0x2655('0x32')],_0x35d81c[_0x2655('0x33')]);_0x7a7180[_0x2655('0x36')]=_[_0x2655('0x35')](_0x35d81c['model'],qs[_0x2655('0x37')](_0x241e52['query']['fields']));_0x7a7180[_0x2655('0x36')]=_0x7a7180['attributes']['length']?_0x7a7180[_0x2655('0x36')]:_0x35d81c[_0x2655('0x32')];if(!_0x241e52[_0x2655('0x33')][_0x2655('0x38')](_0x2655('0x39'))){_0x7a7180[_0x2655('0x20')]=qs['limit'](_0x241e52['query'][_0x2655('0x20')]);_0x7a7180[_0x2655('0x1e')]=qs[_0x2655('0x1e')](_0x241e52['query']['offset']);}_0x7a7180[_0x2655('0x3a')]=qs['sort'](_0x241e52[_0x2655('0x33')]['sort']);_0x7a7180['where']=qs[_0x2655('0x34')](_['pick'](_0x241e52[_0x2655('0x33')],_0x35d81c[_0x2655('0x34')]),_0x253acf);if(_0x241e52['query'][_0x2655('0x3b')]){_0x7a7180['where']=_[_0x2655('0x3c')](_0x7a7180[_0x2655('0x3d')],{'$or':_[_0x2655('0x2e')](_0x253acf,function(_0x5d795f){if(_0x5d795f[_0x2655('0x31')]!==_0x2655('0x3e')){var _0x47e1c6={};_0x47e1c6[_0x5d795f['name']]={'$like':'%'+_0x241e52[_0x2655('0x33')][_0x2655('0x3b')]+'%'};return _0x47e1c6;}})});}_0x7a7180=_[_0x2655('0x3c')]({},_0x7a7180,_0x241e52[_0x2655('0x3f')]);var _0x353ec9={'where':_0x7a7180['where']};return db[_0x2655('0x40')]['count'](_0x353ec9)[_0x2655('0x27')](function(_0xe316bc){_0x9087d0[_0x2655('0x21')]=_0xe316bc;if(_0x241e52[_0x2655('0x33')][_0x2655('0x41')]){_0x7a7180[_0x2655('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x2655('0x43')](_0x7a7180);})[_0x2655('0x27')](function(_0x30aaf3){_0x9087d0['rows']=_0x30aaf3;return _0x9087d0;})[_0x2655('0x27')](respondWithFilteredResult(_0x31136f,_0x7a7180))['catch'](handleError(_0x31136f,null));};exports[_0x2655('0x44')]=function(_0x35346b,_0x9bd540){var _0x3e5dca={'raw':![],'where':{'id':_0x35346b[_0x2655('0x45')]['id']}},_0x3d9c1f={};_0x3d9c1f[_0x2655('0x32')]=_[_0x2655('0x46')](db[_0x2655('0x40')][_0x2655('0x2f')]);_0x3d9c1f['query']=_[_0x2655('0x46')](_0x35346b[_0x2655('0x33')]);_0x3d9c1f[_0x2655('0x34')]=_[_0x2655('0x35')](_0x3d9c1f[_0x2655('0x32')],_0x3d9c1f['query']);_0x3e5dca[_0x2655('0x36')]=_[_0x2655('0x35')](_0x3d9c1f[_0x2655('0x32')],qs['fields'](_0x35346b[_0x2655('0x33')][_0x2655('0x37')]));_0x3e5dca[_0x2655('0x36')]=_0x3e5dca['attributes']['length']?_0x3e5dca[_0x2655('0x36')]:_0x3d9c1f[_0x2655('0x32')];if(_0x35346b[_0x2655('0x33')][_0x2655('0x41')]){_0x3e5dca[_0x2655('0x42')]=[{'all':!![]}];}_0x3e5dca=_['merge']({},_0x3e5dca,_0x35346b[_0x2655('0x3f')]);return db[_0x2655('0x40')]['find'](_0x3e5dca)[_0x2655('0x27')](handleEntityNotFound(_0x9bd540,null))[_0x2655('0x27')](respondWithResult(_0x9bd540,null))['catch'](handleError(_0x9bd540,null));};exports[_0x2655('0x47')]=function(_0x54b857,_0x3f5951){return db['SugarcrmAccount'][_0x2655('0x47')](_0x54b857[_0x2655('0x48')],{})['then'](respondWithResult(_0x3f5951,0xc9))[_0x2655('0x49')](handleError(_0x3f5951,null));};exports[_0x2655('0x26')]=function(_0x4372a1,_0x2a1628){if(_0x4372a1[_0x2655('0x48')]['id']){delete _0x4372a1[_0x2655('0x48')]['id'];}return db[_0x2655('0x40')][_0x2655('0x4a')]({'where':{'id':_0x4372a1[_0x2655('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a1628,null))[_0x2655('0x27')](saveUpdates(_0x4372a1['body'],null))[_0x2655('0x27')](respondWithResult(_0x2a1628,null))[_0x2655('0x49')](handleError(_0x2a1628,null));};exports[_0x2655('0x28')]=function(_0x28ade8,_0x380ed8){return db[_0x2655('0x40')]['find']({'where':{'id':_0x28ade8['params']['id']}})[_0x2655('0x27')](handleEntityNotFound(_0x380ed8,null))[_0x2655('0x27')](removeEntity(_0x380ed8,null))[_0x2655('0x49')](handleError(_0x380ed8,null));};exports[_0x2655('0x4b')]=function(_0x576a23,_0x96e502,_0x3b8565){var _0x522445={};var _0x135721={};var _0x15b5df;var _0x5f0c02;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x576a23['params']['id']}})[_0x2655('0x27')](handleEntityNotFound(_0x96e502,null))[_0x2655('0x27')](function(_0x32874d){if(_0x32874d){_0x15b5df=_0x32874d;_0x135721[_0x2655('0x32')]=_[_0x2655('0x46')](db['SugarcrmConfiguration']['rawAttributes']);_0x135721[_0x2655('0x33')]=_[_0x2655('0x46')](_0x576a23['query']);_0x135721[_0x2655('0x34')]=_[_0x2655('0x35')](_0x135721[_0x2655('0x32')],_0x135721[_0x2655('0x33')]);_0x522445[_0x2655('0x36')]=_[_0x2655('0x35')](_0x135721['model'],qs['fields'](_0x576a23[_0x2655('0x33')][_0x2655('0x37')]));_0x522445[_0x2655('0x36')]=_0x522445[_0x2655('0x36')]['length']?_0x522445[_0x2655('0x36')]:_0x135721[_0x2655('0x32')];_0x522445[_0x2655('0x3a')]=qs[_0x2655('0x4c')](_0x576a23[_0x2655('0x33')][_0x2655('0x4c')]);_0x522445[_0x2655('0x3d')]=qs[_0x2655('0x34')](_[_0x2655('0x4d')](_0x576a23[_0x2655('0x33')],_0x135721[_0x2655('0x34')]));if(_0x576a23[_0x2655('0x33')][_0x2655('0x3b')]){_0x522445[_0x2655('0x3d')]=_[_0x2655('0x3c')](_0x522445[_0x2655('0x3d')],{'$or':_[_0x2655('0x2e')](_0x522445[_0x2655('0x36')],function(_0x29f3c6){var _0x4848a5={};_0x4848a5[_0x29f3c6]={'$like':'%'+_0x576a23['query']['filter']+'%'};return _0x4848a5;})});}_0x522445=_[_0x2655('0x3c')]({},_0x522445,_0x576a23['options']);return _0x15b5df[_0x2655('0x4b')](_0x522445);}})[_0x2655('0x27')](function(_0x5af56a){if(_0x5af56a){_0x5f0c02=_0x5af56a[_0x2655('0x4e')];if(!_0x576a23[_0x2655('0x33')]['hasOwnProperty'](_0x2655('0x39'))){_0x522445['limit']=qs[_0x2655('0x20')](_0x576a23[_0x2655('0x33')]['limit']);_0x522445[_0x2655('0x1e')]=qs[_0x2655('0x1e')](_0x576a23['query'][_0x2655('0x1e')]);}return _0x15b5df[_0x2655('0x4b')](_0x522445);}})['then'](function(_0x2af5bf){if(_0x2af5bf){return _0x2af5bf?{'count':_0x5f0c02,'rows':_0x2af5bf}:null;}})[_0x2655('0x27')](respondWithResult(_0x96e502,null))[_0x2655('0x49')](handleError(_0x96e502,null));};exports[_0x2655('0x4f')]=function(_0x432ebd,_0x3254f4,_0x21fe3e){if(_0x432ebd[_0x2655('0x48')]['id']){delete _0x432ebd[_0x2655('0x48')]['id'];}return db[_0x2655('0x40')][_0x2655('0x50')]({'where':{'id':_0x432ebd[_0x2655('0x45')]['id']}})['then'](handleEntityNotFound(_0x3254f4,null))[_0x2655('0x27')](function(_0x18bff9){if(_0x18bff9){_0x432ebd[_0x2655('0x48')][_0x2655('0x51')]=_0x18bff9['id'];_0x432ebd[_0x2655('0x48')][_0x2655('0x52')]=integrations['getSubjects'](_0x432ebd[_0x2655('0x48')][_0x2655('0x53')],_0x432ebd['body'][_0x2655('0x31')]);_0x432ebd['body'][_0x2655('0x54')]=integrations['getDescriptions'](_0x432ebd[_0x2655('0x48')][_0x2655('0x53')],_0x432ebd[_0x2655('0x48')][_0x2655('0x31')]);return db['SugarcrmConfiguration']['create'](_0x432ebd[_0x2655('0x48')],{'include':[{'model':db[_0x2655('0x55')],'as':_0x2655('0x52')},{'model':db[_0x2655('0x55')],'as':_0x2655('0x54')}]});}return null;})[_0x2655('0x27')](respondWithResult(_0x3254f4,null))['catch'](handleError(_0x3254f4,null));};exports[_0x2655('0x56')]=function(_0x13c452,_0x410dd1,_0xcdb629){var _0x3abf60='';var _0x4c7b42=['id',_0x2655('0x2c'),'assigned_user_id',_0x2655('0x57'),_0x2655('0x58'),_0x2655('0x59'),'duration_hours',_0x2655('0x5a'),'parent_id','parent_type',_0x2655('0x5b'),_0x2655('0x5c')];return db['SugarcrmAccount'][_0x2655('0x50')]({'where':{'id':_0x13c452[_0x2655('0x45')]['id']},'attributes':['id','username',_0x2655('0x5d'),_0x2655('0x5e')]})[_0x2655('0x27')](handleEntityNotFound(_0x410dd1,null))[_0x2655('0x27')](function(_0x47383f){if(_0x47383f){_0x3abf60=_0x47383f['remoteUri'];var _0x3b9f87=_0x3abf60[_0x2655('0x5f')](-0x1);if(_0x3b9f87==='/'){_0x3abf60=_0x3abf60[_0x2655('0x60')](0x0,_0x3abf60[_0x2655('0x61')](_0x3b9f87));}return rp({'method':_0x2655('0x62'),'uri':util[_0x2655('0x63')](_0x2655('0x64'),_0x3abf60,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2655('0x65'),'input_type':_0x2655('0x66'),'response_type':_0x2655('0x66'),'rest_data':JSON[_0x2655('0x67')]({'user_auth':{'user_name':_0x47383f[_0x2655('0x68')],'password':_0x47383f[_0x2655('0x5d')],'encryption':_0x2655('0x69')},'application':_0x2655('0x6a')})}});}})[_0x2655('0x27')](function(_0x3c5e58){if(_0x3c5e58&&_0x3c5e58[_0x2655('0x2c')]!==_0x2655('0x6b')&&_0x3c5e58[_0x2655('0x2c')]!==_0x2655('0x6c')){return rp({'method':'POST','uri':util['format'](_0x2655('0x64'),_0x3abf60,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2655('0x6d'),'input_type':'JSON','response_type':_0x2655('0x66'),'rest_data':JSON['stringify']({'session':_0x3c5e58['id'],'module_name':_0x2655('0x6e')})}})[_0x2655('0x27')](function(_0x4df4f7){if(_0x4df4f7){var _0x6bc32c=_[_0x2655('0x6f')](_0x4df4f7['module_fields']);_['remove'](_0x6bc32c,function(_0x537d51){return _0x4c7b42[_0x2655('0x70')](_0x537d51[_0x2655('0x2c')]);});return{'count':_0x6bc32c[_0x2655('0x4e')],'rows':_[_0x2655('0x2e')](_0x6bc32c,function(_0x447ca6){return{'id':_0x447ca6[_0x2655('0x2c')],'name':_0x447ca6['label'],'custom':_[_0x2655('0x71')](_0x447ca6[_0x2655('0x2c')],'_c')?!![]:![],'options':_0x447ca6[_0x2655('0x3f')]?_['map'](_[_0x2655('0x6f')](_0x447ca6[_0x2655('0x3f')]),function(_0x43c3fe){return{'name':_0x43c3fe[_0x2655('0x72')],'value':_0x43c3fe[_0x2655('0x2c')]};}):[]};})};}})[_0x2655('0x27')](respondWithResult(_0x410dd1,null))[_0x2655('0x49')](function(_0x45b6db){var _0x5cd881=_0x13c452[_0x2655('0x33')][_0x2655('0x73')]?0x1f4:_0x45b6db[_0x2655('0x74')]||0x1f4;logger[_0x2655('0x2a')](_0x2655('0x75'),_0x2655('0x56'),_0x5cd881,JSON[_0x2655('0x67')](_0x45b6db));delete _0x45b6db['name'];if(_0x5cd881===0x191){_0x5cd881=0x190;}_0x410dd1[_0x2655('0x1c')](_0x5cd881)[_0x2655('0x2d')](_0x13c452[_0x2655('0x33')][_0x2655('0x73')]?{'message':_0x2655('0x76'),'statusCode':_0x45b6db[_0x2655('0x74')]}:_0x45b6db);});}else{var _0x4efed8=0x1f4;_0x410dd1[_0x2655('0x1c')](_0x4efed8)[_0x2655('0x2d')]({'message':'Wrong\x20credentials','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 ea02a3b..04ab53f 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 _0xbc77=['request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','api','bluebird'];(function(_0x5483bd,_0x5936e3){var _0x2dcfbf=function(_0x1f77fe){while(--_0x1f77fe){_0x5483bd['push'](_0x5483bd['shift']());}};_0x2dcfbf(++_0x5936e3);}(_0xbc77,0x15d));var _0x7bc7=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0xbc77[_0x4d180c];return _0x49b57e;};'use strict';var _=require(_0x7bc7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7bc7('0x1'));var moment=require('moment');var BPromise=require(_0x7bc7('0x2'));var rp=require(_0x7bc7('0x3'));var fs=require('fs');var path=require(_0x7bc7('0x4'));var rimraf=require(_0x7bc7('0x5'));var config=require('../../config/environment');var attributes=require(_0x7bc7('0x6'));var integrations=require(_0x7bc7('0x7'));module['exports']=function(_0x4b5e0e,_0x2ed951){return _0x4b5e0e[_0x7bc7('0x8')](_0x7bc7('0x9'),attributes,{'tableName':_0x7bc7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe02a=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','bluebird','request-promise','path','rimraf'];(function(_0x334cc5,_0xa363d2){var _0x34419b=function(_0x1402c2){while(--_0x1402c2){_0x334cc5['push'](_0x334cc5['shift']());}};_0x34419b(++_0xa363d2);}(_0xe02a,0xa3));var _0xae02=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe02a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xae02('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xae02('0x1'));var rp=require(_0xae02('0x2'));var fs=require('fs');var path=require(_0xae02('0x3'));var rimraf=require(_0xae02('0x4'));var config=require(_0xae02('0x5'));var attributes=require(_0xae02('0x6'));var integrations=require(_0xae02('0x7'));module[_0xae02('0x8')]=function(_0x2ad7f4,_0x3ffda6){return _0x2ad7f4[_0xae02('0x9')](_0xae02('0xa'),attributes,{'tableName':_0xae02('0xb'),'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 3b977b8..a51358a 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 _0xa2e7=['info','request\x20sent','debug','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowSugarcrmAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x20c591,_0x4c7894){var _0x4a1fe4=function(_0x1bddaa){while(--_0x1bddaa){_0x20c591['push'](_0x20c591['shift']());}};_0x4a1fe4(++_0x4c7894);}(_0xa2e7,0x1d2));var _0x7a2e=function(_0x63155e,_0x451662){_0x63155e=_0x63155e-0x0;var _0x4f38a3=_0xa2e7[_0x63155e];return _0x4f38a3;};'use strict';var _=require(_0x7a2e('0x0'));var util=require(_0x7a2e('0x1'));var moment=require(_0x7a2e('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a2e('0x3'));var fs=require('fs');var Redis=require(_0x7a2e('0x4'));var db=require(_0x7a2e('0x5'))['db'];var utils=require(_0x7a2e('0x6'));var logger=require(_0x7a2e('0x7'))(_0x7a2e('0x8'));var config=require(_0x7a2e('0x9'));var jayson=require(_0x7a2e('0xa'));var client=jayson[_0x7a2e('0xb')][_0x7a2e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5efd64,_0x37aae7,_0x35eadf){return new BPromise(function(_0x4d273a,_0x199159){return client[_0x7a2e('0xd')](_0x5efd64,_0x35eadf)[_0x7a2e('0xe')](function(_0x1c1ed5){logger[_0x7a2e('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x37aae7,_0x7a2e('0x10'));logger[_0x7a2e('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x37aae7,_0x7a2e('0x10'),JSON['stringify'](_0x1c1ed5));if(_0x1c1ed5[_0x7a2e('0x12')]){if(_0x1c1ed5['error'][_0x7a2e('0x13')]===0x1f4){logger[_0x7a2e('0x12')](_0x7a2e('0x14'),_0x37aae7,_0x1c1ed5[_0x7a2e('0x12')]['message']);return _0x199159(_0x1c1ed5['error'][_0x7a2e('0x15')]);}logger[_0x7a2e('0x12')](_0x7a2e('0x14'),_0x37aae7,_0x1c1ed5[_0x7a2e('0x12')][_0x7a2e('0x15')]);return _0x4d273a(_0x1c1ed5[_0x7a2e('0x12')][_0x7a2e('0x15')]);}else{logger[_0x7a2e('0xf')](_0x7a2e('0x14'),_0x37aae7,_0x7a2e('0x10'));_0x4d273a(_0x1c1ed5[_0x7a2e('0x16')]['message']);}})[_0x7a2e('0x17')](function(_0x4ef334){logger[_0x7a2e('0x12')](_0x7a2e('0x14'),_0x37aae7,_0x4ef334);_0x199159(_0x4ef334);});});}exports[_0x7a2e('0x18')]=function(_0x11b2e7){var _0x5d2724=this;return new Promise(function(_0x2dfd0e,_0x4df2c6){return db[_0x7a2e('0x19')][_0x7a2e('0x1a')]({'raw':_0x11b2e7[_0x7a2e('0x1b')]?_0x11b2e7[_0x7a2e('0x1b')][_0x7a2e('0x1c')]===undefined?!![]:![]:!![],'where':_0x11b2e7[_0x7a2e('0x1b')]?_0x11b2e7[_0x7a2e('0x1b')][_0x7a2e('0x1d')]||null:null,'attributes':_0x11b2e7[_0x7a2e('0x1b')]?_0x11b2e7[_0x7a2e('0x1b')][_0x7a2e('0x1e')]||null:null,'limit':_0x11b2e7[_0x7a2e('0x1b')]?_0x11b2e7[_0x7a2e('0x1b')][_0x7a2e('0x1f')]||null:null,'include':_0x11b2e7['options']?_0x11b2e7[_0x7a2e('0x1b')]['include']?_[_0x7a2e('0x20')](_0x11b2e7['options'][_0x7a2e('0x21')],function(_0x2aba03){return{'model':db[_0x2aba03[_0x7a2e('0x22')]],'as':_0x2aba03['as'],'attributes':_0x2aba03[_0x7a2e('0x1e')],'include':_0x2aba03[_0x7a2e('0x21')]?_[_0x7a2e('0x20')](_0x2aba03['include'],function(_0x3e44d1){return{'model':db[_0x3e44d1[_0x7a2e('0x22')]],'as':_0x3e44d1['as'],'attributes':_0x3e44d1[_0x7a2e('0x1e')],'include':_0x3e44d1[_0x7a2e('0x21')]?_[_0x7a2e('0x20')](_0x3e44d1['include'],function(_0x5f4961){return{'model':db[_0x5f4961[_0x7a2e('0x22')]],'as':_0x5f4961['as'],'attributes':_0x5f4961[_0x7a2e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a2e('0xe')](function(_0x330c3d){logger['info'](_0x7a2e('0x18'),_0x11b2e7);logger[_0x7a2e('0x11')](_0x7a2e('0x18'),_0x11b2e7,JSON[_0x7a2e('0x23')](_0x330c3d));_0x2dfd0e(_0x330c3d);})['catch'](function(_0x1f75ac){logger['error'](_0x7a2e('0x18'),_0x1f75ac[_0x7a2e('0x15')],_0x11b2e7);_0x4df2c6(_0x5d2724[_0x7a2e('0x12')](0x1f4,_0x1f75ac[_0x7a2e('0x15')]));});});};exports[_0x7a2e('0x24')]=function(_0xc23dac){var _0x3711d9=this;return new Promise(function(_0x161ed6,_0x23e765){return db[_0x7a2e('0x19')]['find']({'raw':_0xc23dac[_0x7a2e('0x1b')]?_0xc23dac[_0x7a2e('0x1b')][_0x7a2e('0x1c')]===undefined?!![]:![]:!![],'where':_0xc23dac[_0x7a2e('0x1b')]?_0xc23dac['options'][_0x7a2e('0x1d')]||null:null,'attributes':_0xc23dac[_0x7a2e('0x1b')]?_0xc23dac['options'][_0x7a2e('0x1e')]||null:null,'include':_0xc23dac[_0x7a2e('0x1b')]?_0xc23dac['options'][_0x7a2e('0x21')]?_['map'](_0xc23dac[_0x7a2e('0x1b')][_0x7a2e('0x21')],function(_0x2e0cac){return{'model':db[_0x2e0cac['model']],'as':_0x2e0cac['as'],'attributes':_0x2e0cac[_0x7a2e('0x1e')],'include':_0x2e0cac[_0x7a2e('0x21')]?_['map'](_0x2e0cac['include'],function(_0x3f2ef8){return{'model':db[_0x3f2ef8[_0x7a2e('0x22')]],'as':_0x3f2ef8['as'],'attributes':_0x3f2ef8[_0x7a2e('0x1e')],'include':_0x3f2ef8['include']?_[_0x7a2e('0x20')](_0x3f2ef8[_0x7a2e('0x21')],function(_0x2ff1b7){return{'model':db[_0x2ff1b7[_0x7a2e('0x22')]],'as':_0x2ff1b7['as'],'attributes':_0x2ff1b7[_0x7a2e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a2e('0xe')](function(_0x414dcd){logger[_0x7a2e('0xf')](_0x7a2e('0x24'),_0xc23dac);logger[_0x7a2e('0x11')](_0x7a2e('0x24'),_0xc23dac,JSON[_0x7a2e('0x23')](_0x414dcd));_0x161ed6(_0x414dcd);})[_0x7a2e('0x17')](function(_0x39b82b){logger['error'](_0x7a2e('0x24'),_0x39b82b[_0x7a2e('0x15')],_0xc23dac);_0x23e765(_0x3711d9[_0x7a2e('0x12')](0x1f4,_0x39b82b[_0x7a2e('0x15')]));});});}; \ No newline at end of file +var _0x0f7c=['where','attributes','limit','map','include','model','stringify','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x0f7c,0x120));var _0xc0f7=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x0f7c[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xc0f7('0x0'));var util=require(_0xc0f7('0x1'));var moment=require('moment');var BPromise=require(_0xc0f7('0x2'));var rs=require(_0xc0f7('0x3'));var fs=require('fs');var Redis=require(_0xc0f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc0f7('0x5'))(_0xc0f7('0x6'));var config=require(_0xc0f7('0x7'));var jayson=require(_0xc0f7('0x8'));var client=jayson[_0xc0f7('0x9')][_0xc0f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4537f4,_0x554a86,_0x5545fb){return new BPromise(function(_0x375627,_0x26d6e9){return client[_0xc0f7('0xb')](_0x4537f4,_0x5545fb)[_0xc0f7('0xc')](function(_0x2ed425){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x554a86,_0xc0f7('0xd'));logger[_0xc0f7('0xe')](_0xc0f7('0xf'),_0x554a86,_0xc0f7('0xd'),JSON['stringify'](_0x2ed425));if(_0x2ed425[_0xc0f7('0x10')]){if(_0x2ed425[_0xc0f7('0x10')]['code']===0x1f4){logger['error'](_0xc0f7('0x11'),_0x554a86,_0x2ed425[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0x26d6e9(_0x2ed425[_0xc0f7('0x10')][_0xc0f7('0x12')]);}logger[_0xc0f7('0x10')](_0xc0f7('0x11'),_0x554a86,_0x2ed425[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0x375627(_0x2ed425[_0xc0f7('0x10')][_0xc0f7('0x12')]);}else{logger[_0xc0f7('0x13')](_0xc0f7('0x11'),_0x554a86,'request\x20sent');_0x375627(_0x2ed425[_0xc0f7('0x14')][_0xc0f7('0x12')]);}})[_0xc0f7('0x15')](function(_0x2bbfaa){logger[_0xc0f7('0x10')](_0xc0f7('0x11'),_0x554a86,_0x2bbfaa);_0x26d6e9(_0x2bbfaa);});});}exports[_0xc0f7('0x16')]=function(_0x196446){var _0x46f5d1=this;return new Promise(function(_0x5cbc03,_0x224170){return db[_0xc0f7('0x17')][_0xc0f7('0x18')]({'raw':_0x196446[_0xc0f7('0x19')]?_0x196446['options'][_0xc0f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x196446[_0xc0f7('0x19')]?_0x196446[_0xc0f7('0x19')][_0xc0f7('0x1b')]||null:null,'attributes':_0x196446[_0xc0f7('0x19')]?_0x196446['options'][_0xc0f7('0x1c')]||null:null,'limit':_0x196446['options']?_0x196446[_0xc0f7('0x19')][_0xc0f7('0x1d')]||null:null,'include':_0x196446['options']?_0x196446['options']['include']?_[_0xc0f7('0x1e')](_0x196446[_0xc0f7('0x19')][_0xc0f7('0x1f')],function(_0x9ad0bc){return{'model':db[_0x9ad0bc[_0xc0f7('0x20')]],'as':_0x9ad0bc['as'],'attributes':_0x9ad0bc['attributes'],'include':_0x9ad0bc[_0xc0f7('0x1f')]?_[_0xc0f7('0x1e')](_0x9ad0bc[_0xc0f7('0x1f')],function(_0x380c2e){return{'model':db[_0x380c2e[_0xc0f7('0x20')]],'as':_0x380c2e['as'],'attributes':_0x380c2e['attributes'],'include':_0x380c2e[_0xc0f7('0x1f')]?_['map'](_0x380c2e['include'],function(_0x12771b){return{'model':db[_0x12771b[_0xc0f7('0x20')]],'as':_0x12771b['as'],'attributes':_0x12771b[_0xc0f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc0f7('0xc')](function(_0x57262b){logger['info'](_0xc0f7('0x16'),_0x196446);logger[_0xc0f7('0xe')](_0xc0f7('0x16'),_0x196446,JSON[_0xc0f7('0x21')](_0x57262b));_0x5cbc03(_0x57262b);})[_0xc0f7('0x15')](function(_0x30ab77){logger[_0xc0f7('0x10')](_0xc0f7('0x16'),_0x30ab77['message'],_0x196446);_0x224170(_0x46f5d1['error'](0x1f4,_0x30ab77[_0xc0f7('0x12')]));});});};exports[_0xc0f7('0x22')]=function(_0x5a331d){var _0x42eb37=this;return new Promise(function(_0x43d6ff,_0x4c7395){return db[_0xc0f7('0x17')]['find']({'raw':_0x5a331d[_0xc0f7('0x19')]?_0x5a331d[_0xc0f7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5a331d[_0xc0f7('0x19')]?_0x5a331d[_0xc0f7('0x19')]['where']||null:null,'attributes':_0x5a331d[_0xc0f7('0x19')]?_0x5a331d['options'][_0xc0f7('0x1c')]||null:null,'include':_0x5a331d[_0xc0f7('0x19')]?_0x5a331d['options']['include']?_['map'](_0x5a331d[_0xc0f7('0x19')][_0xc0f7('0x1f')],function(_0x5556b5){return{'model':db[_0x5556b5[_0xc0f7('0x20')]],'as':_0x5556b5['as'],'attributes':_0x5556b5[_0xc0f7('0x1c')],'include':_0x5556b5['include']?_[_0xc0f7('0x1e')](_0x5556b5[_0xc0f7('0x1f')],function(_0x621e58){return{'model':db[_0x621e58[_0xc0f7('0x20')]],'as':_0x621e58['as'],'attributes':_0x621e58[_0xc0f7('0x1c')],'include':_0x621e58[_0xc0f7('0x1f')]?_[_0xc0f7('0x1e')](_0x621e58[_0xc0f7('0x1f')],function(_0x2bec77){return{'model':db[_0x2bec77['model']],'as':_0x2bec77['as'],'attributes':_0x2bec77['attributes']};}):[]};}):[]};}):[]:[]})[_0xc0f7('0xc')](function(_0x230237){logger[_0xc0f7('0x13')](_0xc0f7('0x22'),_0x5a331d);logger[_0xc0f7('0xe')](_0xc0f7('0x22'),_0x5a331d,JSON[_0xc0f7('0x21')](_0x230237));_0x43d6ff(_0x230237);})['catch'](function(_0x3bf2b5){logger[_0xc0f7('0x10')]('ShowSugarcrmAccount',_0x3bf2b5[_0xc0f7('0x12')],_0x5a331d);_0x4c7395(_0x42eb37[_0xc0f7('0x10')](0x1f4,_0x3bf2b5[_0xc0f7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 53ae91c..312c0c1 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 _0x1cbd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x384bbe,_0x1fb31d){var _0x49e066=function(_0x552b87){while(--_0x552b87){_0x384bbe['push'](_0x384bbe['shift']());}};_0x49e066(++_0x1fb31d);}(_0x1cbd,0x19c));var _0xd1cb=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x1cbd[_0x270adf];return _0x29eda9;};'use strict';var multer=require(_0xd1cb('0x0'));var util=require('util');var path=require(_0xd1cb('0x1'));var timeout=require(_0xd1cb('0x2'));var express=require(_0xd1cb('0x3'));var router=express[_0xd1cb('0x4')]();var fs_extra=require(_0xd1cb('0x5'));var auth=require(_0xd1cb('0x6'));var interaction=require(_0xd1cb('0x7'));var config=require('../../config/environment');var controller=require(_0xd1cb('0x8'));router[_0xd1cb('0x9')]('/',auth[_0xd1cb('0xa')](),controller[_0xd1cb('0xb')]);router[_0xd1cb('0x9')](_0xd1cb('0xc'),auth['isAuthenticated'](),controller[_0xd1cb('0xd')]);router[_0xd1cb('0x9')](_0xd1cb('0xe'),auth['isAuthenticated'](),controller[_0xd1cb('0xf')]);router[_0xd1cb('0x9')](_0xd1cb('0x10'),auth['isAuthenticated'](),controller[_0xd1cb('0x11')]);router[_0xd1cb('0x9')](_0xd1cb('0x12'),auth[_0xd1cb('0xa')](),controller[_0xd1cb('0x13')]);router[_0xd1cb('0x14')]('/',auth['isAuthenticated'](),controller[_0xd1cb('0x15')]);router[_0xd1cb('0x16')](_0xd1cb('0xc'),auth[_0xd1cb('0xa')](),controller[_0xd1cb('0x17')]);router['delete']('/:id',auth[_0xd1cb('0xa')](),controller[_0xd1cb('0x18')]);module[_0xd1cb('0x19')]=router; \ No newline at end of file +var _0x3a53=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields','getFields','get','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer'];(function(_0xa9a8bb,_0x1e30d0){var _0x1bc706=function(_0xe01539){while(--_0xe01539){_0xa9a8bb['push'](_0xa9a8bb['shift']());}};_0x1bc706(++_0x1e30d0);}(_0x3a53,0x18b));var _0x33a5=function(_0xd49fef,_0x23f01e){_0xd49fef=_0xd49fef-0x0;var _0x304be8=_0x3a53[_0xd49fef];return _0x304be8;};'use strict';var multer=require(_0x33a5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x33a5('0x1'));var express=require('express');var router=express[_0x33a5('0x2')]();var fs_extra=require(_0x33a5('0x3'));var auth=require(_0x33a5('0x4'));var interaction=require(_0x33a5('0x5'));var config=require('../../config/environment');var controller=require(_0x33a5('0x6'));router['get']('/',auth[_0x33a5('0x7')](),controller[_0x33a5('0x8')]);router['get'](_0x33a5('0x9'),auth[_0x33a5('0x7')](),controller[_0x33a5('0xa')]);router['get'](_0x33a5('0xb'),auth[_0x33a5('0x7')](),controller[_0x33a5('0xc')]);router[_0x33a5('0xd')](_0x33a5('0xe'),auth[_0x33a5('0x7')](),controller['getSubjects']);router[_0x33a5('0xd')](_0x33a5('0xf'),auth[_0x33a5('0x7')](),controller[_0x33a5('0x10')]);router[_0x33a5('0x11')]('/',auth[_0x33a5('0x7')](),controller['create']);router[_0x33a5('0x12')](_0x33a5('0x9'),auth[_0x33a5('0x7')](),controller[_0x33a5('0x13')]);router[_0x33a5('0x14')]('/:id',auth[_0x33a5('0x7')](),controller[_0x33a5('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 8c344b4..58cf654 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 _0x59b9=['sequelize','exports','STRING'];(function(_0x734a07,_0x2c9a39){var _0x15b45a=function(_0x5de61b){while(--_0x5de61b){_0x734a07['push'](_0x734a07['shift']());}};_0x15b45a(++_0x2c9a39);}(_0x59b9,0x1e9));var _0x959b=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x59b9[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x959b('0x0'));module[_0x959b('0x1')]={'name':{'type':Sequelize[_0x959b('0x2')]},'description':{'type':Sequelize[_0x959b('0x2')]}}; \ No newline at end of file +var _0xa782=['STRING'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xa782,0x10f));var _0x2a78=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa782[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2a78('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index fc2cfa1..ffd5771 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 _0xa9b9=['../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','index','SugarcrmConfiguration','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa8ff2f,_0x43e207){var _0x1c27af=function(_0x1d1551){while(--_0x1d1551){_0xa8ff2f['push'](_0xa8ff2f['shift']());}};_0x1c27af(++_0x43e207);}(_0xa9b9,0x86));var _0x9a9b=function(_0x8806f5,_0x259bc6){_0x8806f5=_0x8806f5-0x0;var _0x39a9a8=_0xa9b9[_0x8806f5];return _0x39a9a8;};'use strict';var emlformat=require(_0x9a9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a9b('0x1'));var jsonpatch=require(_0x9a9b('0x2'));var rp=require(_0x9a9b('0x3'));var moment=require(_0x9a9b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9a9b('0x5'));var sox=require(_0x9a9b('0x6'));var csv=require(_0x9a9b('0x7'));var ejs=require(_0x9a9b('0x8'));var fs=require('fs');var fs_extra=require(_0x9a9b('0x9'));var _=require(_0x9a9b('0xa'));var squel=require(_0x9a9b('0xb'));var crypto=require(_0x9a9b('0xc'));var jsforce=require(_0x9a9b('0xd'));var deskjs=require(_0x9a9b('0xe'));var toCsv=require(_0x9a9b('0x7'));var querystring=require(_0x9a9b('0xf'));var Papa=require(_0x9a9b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a9b('0x11'));var as=require(_0x9a9b('0x12'));var hardwareService=require(_0x9a9b('0x13'));var logger=require(_0x9a9b('0x14'))('api');var utils=require(_0x9a9b('0x15'));var config=require(_0x9a9b('0x16'));var licenseUtil=require(_0x9a9b('0x17'));var db=require(_0x9a9b('0x18'))['db'];function respondWithStatusCode(_0x26c9a5,_0x265a0c){_0x265a0c=_0x265a0c||0xcc;return function(_0x5454f4){if(_0x5454f4){return _0x26c9a5['sendStatus'](_0x265a0c);}return _0x26c9a5[_0x9a9b('0x19')](_0x265a0c)[_0x9a9b('0x1a')]();};}function respondWithResult(_0x23ef71,_0x36d75e){_0x36d75e=_0x36d75e||0xc8;return function(_0x2aa269){if(_0x2aa269){return _0x23ef71['status'](_0x36d75e)[_0x9a9b('0x1b')](_0x2aa269);}};}function respondWithFilteredResult(_0x19339b,_0x4ca9ca){return function(_0x1f05eb){if(_0x1f05eb){var _0x23abc5=typeof _0x4ca9ca[_0x9a9b('0x1c')]==='undefined'&&typeof _0x4ca9ca['limit']===_0x9a9b('0x1d');var _0x4adff8=_0x1f05eb[_0x9a9b('0x1e')];var _0x117030=_0x23abc5?0x0:_0x4ca9ca[_0x9a9b('0x1c')];var _0x1d2009=_0x23abc5?_0x1f05eb[_0x9a9b('0x1e')]:_0x4ca9ca['offset']+_0x4ca9ca[_0x9a9b('0x1f')];var _0x50b714;if(_0x1d2009>=_0x4adff8){_0x1d2009=_0x4adff8;_0x50b714=0xc8;}else{_0x50b714=0xce;}_0x19339b[_0x9a9b('0x19')](_0x50b714);return _0x19339b['set']('Content-Range',_0x117030+'-'+_0x1d2009+'/'+_0x4adff8)[_0x9a9b('0x1b')](_0x1f05eb);}return null;};}function patchUpdates(_0x4e4832){return function(_0x35b24c){try{jsonpatch[_0x9a9b('0x20')](_0x35b24c,_0x4e4832,!![]);}catch(_0x57e449){return BPromise[_0x9a9b('0x21')](_0x57e449);}return _0x35b24c[_0x9a9b('0x22')]();};}function saveUpdates(_0xab0fd8,_0xdab4c8){return function(_0x25e4d0){if(_0x25e4d0){return _0x25e4d0[_0x9a9b('0x23')](_0xab0fd8)[_0x9a9b('0x24')](function(_0x3ce07b){return _0x3ce07b;});}return null;};}function removeEntity(_0x363ca1,_0x425f5e){return function(_0x5149ff){if(_0x5149ff){return _0x5149ff[_0x9a9b('0x25')]()[_0x9a9b('0x24')](function(){_0x363ca1[_0x9a9b('0x19')](0xcc)[_0x9a9b('0x1a')]();});}};}function handleEntityNotFound(_0x244a96,_0x20b245){return function(_0x3b47d1){if(!_0x3b47d1){_0x244a96['sendStatus'](0x194);}return _0x3b47d1;};}function handleError(_0x48b76b,_0x222943){_0x222943=_0x222943||0x1f4;return function(_0x3a883c){logger[_0x9a9b('0x26')](_0x3a883c[_0x9a9b('0x27')]);if(_0x3a883c[_0x9a9b('0x28')]){delete _0x3a883c[_0x9a9b('0x28')];}_0x48b76b[_0x9a9b('0x19')](_0x222943)['send'](_0x3a883c);};}exports[_0x9a9b('0x29')]=function(_0x1a7857,_0x1398b5){var _0x69bd6a={},_0x4cc640={},_0xaa640e={'count':0x0,'rows':[]};var _0x1479bf=_['map'](db[_0x9a9b('0x2a')]['rawAttributes'],function(_0xecd1b4){return{'name':_0xecd1b4[_0x9a9b('0x2b')],'type':_0xecd1b4['type'][_0x9a9b('0x2c')]};});_0x4cc640[_0x9a9b('0x2d')]=_[_0x9a9b('0x2e')](_0x1479bf,'name');_0x4cc640[_0x9a9b('0x2f')]=_['keys'](_0x1a7857['query']);_0x4cc640[_0x9a9b('0x30')]=_[_0x9a9b('0x31')](_0x4cc640[_0x9a9b('0x2d')],_0x4cc640['query']);_0x69bd6a[_0x9a9b('0x32')]=_['intersection'](_0x4cc640[_0x9a9b('0x2d')],qs['fields'](_0x1a7857[_0x9a9b('0x2f')][_0x9a9b('0x33')]));_0x69bd6a[_0x9a9b('0x32')]=_0x69bd6a[_0x9a9b('0x32')][_0x9a9b('0x34')]?_0x69bd6a[_0x9a9b('0x32')]:_0x4cc640[_0x9a9b('0x2d')];if(!_0x1a7857[_0x9a9b('0x2f')]['hasOwnProperty'](_0x9a9b('0x35'))){_0x69bd6a['limit']=qs[_0x9a9b('0x1f')](_0x1a7857['query'][_0x9a9b('0x1f')]);_0x69bd6a['offset']=qs[_0x9a9b('0x1c')](_0x1a7857[_0x9a9b('0x2f')][_0x9a9b('0x1c')]);}_0x69bd6a[_0x9a9b('0x36')]=qs[_0x9a9b('0x37')](_0x1a7857[_0x9a9b('0x2f')][_0x9a9b('0x37')]);_0x69bd6a[_0x9a9b('0x38')]=qs[_0x9a9b('0x30')](_[_0x9a9b('0x39')](_0x1a7857[_0x9a9b('0x2f')],_0x4cc640['filters']),_0x1479bf);if(_0x1a7857['query'][_0x9a9b('0x3a')]){_0x69bd6a[_0x9a9b('0x38')]=_[_0x9a9b('0x3b')](_0x69bd6a[_0x9a9b('0x38')],{'$or':_[_0x9a9b('0x2e')](_0x1479bf,function(_0x381067){if(_0x381067['type']!==_0x9a9b('0x3c')){var _0x3e3569={};_0x3e3569[_0x381067[_0x9a9b('0x28')]]={'$like':'%'+_0x1a7857[_0x9a9b('0x2f')]['filter']+'%'};return _0x3e3569;}})});}_0x69bd6a=_[_0x9a9b('0x3b')]({},_0x69bd6a,_0x1a7857['options']);var _0x8c6a38={'where':_0x69bd6a[_0x9a9b('0x38')]};return db[_0x9a9b('0x2a')]['count'](_0x8c6a38)[_0x9a9b('0x24')](function(_0x3a790a){_0xaa640e[_0x9a9b('0x1e')]=_0x3a790a;if(_0x1a7857[_0x9a9b('0x2f')][_0x9a9b('0x3d')]){_0x69bd6a[_0x9a9b('0x3e')]=[{'all':!![]}];}return db[_0x9a9b('0x2a')][_0x9a9b('0x3f')](_0x69bd6a);})[_0x9a9b('0x24')](function(_0x18c405){_0xaa640e[_0x9a9b('0x40')]=_0x18c405;return _0xaa640e;})[_0x9a9b('0x24')](respondWithFilteredResult(_0x1398b5,_0x69bd6a))[_0x9a9b('0x41')](handleError(_0x1398b5,null));};exports[_0x9a9b('0x42')]=function(_0x1fe477,_0x4894ce){var _0xb3796c={'raw':![],'where':{'id':_0x1fe477[_0x9a9b('0x43')]['id']}},_0x407d4d={};_0x407d4d['model']=_[_0x9a9b('0x44')](db['SugarcrmConfiguration'][_0x9a9b('0x45')]);_0x407d4d['query']=_[_0x9a9b('0x44')](_0x1fe477[_0x9a9b('0x2f')]);_0x407d4d[_0x9a9b('0x30')]=_[_0x9a9b('0x31')](_0x407d4d[_0x9a9b('0x2d')],_0x407d4d['query']);_0xb3796c[_0x9a9b('0x32')]=_[_0x9a9b('0x31')](_0x407d4d[_0x9a9b('0x2d')],qs[_0x9a9b('0x33')](_0x1fe477[_0x9a9b('0x2f')][_0x9a9b('0x33')]));_0xb3796c['attributes']=_0xb3796c[_0x9a9b('0x32')]['length']?_0xb3796c['attributes']:_0x407d4d[_0x9a9b('0x2d')];if(_0x1fe477[_0x9a9b('0x2f')][_0x9a9b('0x3d')]){_0xb3796c[_0x9a9b('0x3e')]=[{'all':!![]}];}_0xb3796c=_[_0x9a9b('0x3b')]({},_0xb3796c,_0x1fe477['options']);return db[_0x9a9b('0x2a')][_0x9a9b('0x46')](_0xb3796c)[_0x9a9b('0x24')](handleEntityNotFound(_0x4894ce,null))[_0x9a9b('0x24')](respondWithResult(_0x4894ce,null))[_0x9a9b('0x41')](handleError(_0x4894ce,null));};exports[_0x9a9b('0x47')]=function(_0x12364d,_0x3a4f4c){return db[_0x9a9b('0x2a')][_0x9a9b('0x47')](_0x12364d[_0x9a9b('0x48')],{})['then'](respondWithResult(_0x3a4f4c,0xc9))[_0x9a9b('0x41')](handleError(_0x3a4f4c,null));};exports[_0x9a9b('0x23')]=function(_0x5bf9b3,_0x58c477){if(_0x5bf9b3['body']['id']){delete _0x5bf9b3['body']['id'];}return db['SugarcrmConfiguration'][_0x9a9b('0x46')]({'where':{'id':_0x5bf9b3[_0x9a9b('0x43')]['id']}})[_0x9a9b('0x24')](handleEntityNotFound(_0x58c477,null))[_0x9a9b('0x24')](saveUpdates(_0x5bf9b3[_0x9a9b('0x48')],null))['then'](respondWithResult(_0x58c477,null))[_0x9a9b('0x41')](handleError(_0x58c477,null));};exports[_0x9a9b('0x25')]=function(_0x1c1884,_0x42ebe3){return db['SugarcrmConfiguration'][_0x9a9b('0x46')]({'where':{'id':_0x1c1884[_0x9a9b('0x43')]['id']}})[_0x9a9b('0x24')](handleEntityNotFound(_0x42ebe3,null))[_0x9a9b('0x24')](removeEntity(_0x42ebe3,null))[_0x9a9b('0x41')](handleError(_0x42ebe3,null));};exports[_0x9a9b('0x49')]=function(_0x46cf60,_0x154251,_0xd1446b){var _0x346ef9={};var _0x2a358b={};var _0x312410;var _0x409313;return db[_0x9a9b('0x2a')][_0x9a9b('0x4a')]({'where':{'id':_0x46cf60[_0x9a9b('0x43')]['id']}})[_0x9a9b('0x24')](handleEntityNotFound(_0x154251,null))[_0x9a9b('0x24')](function(_0x582e12){if(_0x582e12){_0x312410=_0x582e12;_0x2a358b[_0x9a9b('0x2d')]=_['keys'](db[_0x9a9b('0x4b')][_0x9a9b('0x45')]);_0x2a358b['query']=_[_0x9a9b('0x44')](_0x46cf60[_0x9a9b('0x2f')]);_0x2a358b[_0x9a9b('0x30')]=_[_0x9a9b('0x31')](_0x2a358b[_0x9a9b('0x2d')],_0x2a358b[_0x9a9b('0x2f')]);_0x346ef9['attributes']=_[_0x9a9b('0x31')](_0x2a358b[_0x9a9b('0x2d')],qs[_0x9a9b('0x33')](_0x46cf60[_0x9a9b('0x2f')][_0x9a9b('0x33')]));_0x346ef9[_0x9a9b('0x32')]=_0x346ef9[_0x9a9b('0x32')][_0x9a9b('0x34')]?_0x346ef9[_0x9a9b('0x32')]:_0x2a358b['model'];_0x346ef9[_0x9a9b('0x36')]=qs['sort'](_0x46cf60[_0x9a9b('0x2f')]['sort']);_0x346ef9[_0x9a9b('0x38')]=qs['filters'](_[_0x9a9b('0x39')](_0x46cf60[_0x9a9b('0x2f')],_0x2a358b[_0x9a9b('0x30')]));if(_0x46cf60[_0x9a9b('0x2f')][_0x9a9b('0x3a')]){_0x346ef9[_0x9a9b('0x38')]=_['merge'](_0x346ef9[_0x9a9b('0x38')],{'$or':_[_0x9a9b('0x2e')](_0x346ef9[_0x9a9b('0x32')],function(_0xabeb38){var _0x902023={};_0x902023[_0xabeb38]={'$like':'%'+_0x46cf60[_0x9a9b('0x2f')][_0x9a9b('0x3a')]+'%'};return _0x902023;})});}_0x346ef9=_[_0x9a9b('0x3b')]({},_0x346ef9,_0x46cf60['options']);return _0x312410[_0x9a9b('0x49')](_0x346ef9);}})[_0x9a9b('0x24')](function(_0x487427){if(_0x487427){_0x409313=_0x487427[_0x9a9b('0x34')];if(!_0x46cf60[_0x9a9b('0x2f')][_0x9a9b('0x4c')]('nolimit')){_0x346ef9[_0x9a9b('0x1f')]=qs[_0x9a9b('0x1f')](_0x46cf60['query'][_0x9a9b('0x1f')]);_0x346ef9[_0x9a9b('0x1c')]=qs[_0x9a9b('0x1c')](_0x46cf60[_0x9a9b('0x2f')][_0x9a9b('0x1c')]);}return _0x312410[_0x9a9b('0x49')](_0x346ef9);}})[_0x9a9b('0x24')](function(_0x198e2d){if(_0x198e2d){return _0x198e2d?{'count':_0x409313,'rows':_0x198e2d}:null;}})[_0x9a9b('0x24')](respondWithResult(_0x154251,null))[_0x9a9b('0x41')](handleError(_0x154251,null));};exports[_0x9a9b('0x4d')]=function(_0x449011,_0x14245c,_0x44e942){var _0x44f47e={};var _0x35bb9c={};var _0x4bab06;var _0x1b7dd2;return db[_0x9a9b('0x2a')][_0x9a9b('0x4a')]({'where':{'id':_0x449011[_0x9a9b('0x43')]['id']}})[_0x9a9b('0x24')](handleEntityNotFound(_0x14245c,null))['then'](function(_0x5f2767){if(_0x5f2767){_0x4bab06=_0x5f2767;_0x35bb9c[_0x9a9b('0x2d')]=_[_0x9a9b('0x44')](db[_0x9a9b('0x4b')][_0x9a9b('0x45')]);_0x35bb9c[_0x9a9b('0x2f')]=_[_0x9a9b('0x44')](_0x449011[_0x9a9b('0x2f')]);_0x35bb9c[_0x9a9b('0x30')]=_['intersection'](_0x35bb9c['model'],_0x35bb9c[_0x9a9b('0x2f')]);_0x44f47e[_0x9a9b('0x32')]=_[_0x9a9b('0x31')](_0x35bb9c['model'],qs[_0x9a9b('0x33')](_0x449011[_0x9a9b('0x2f')][_0x9a9b('0x33')]));_0x44f47e[_0x9a9b('0x32')]=_0x44f47e[_0x9a9b('0x32')]['length']?_0x44f47e[_0x9a9b('0x32')]:_0x35bb9c['model'];_0x44f47e[_0x9a9b('0x36')]=qs['sort'](_0x449011[_0x9a9b('0x2f')]['sort']);_0x44f47e[_0x9a9b('0x38')]=qs['filters'](_[_0x9a9b('0x39')](_0x449011['query'],_0x35bb9c[_0x9a9b('0x30')]));if(_0x449011['query'][_0x9a9b('0x3a')]){_0x44f47e[_0x9a9b('0x38')]=_['merge'](_0x44f47e[_0x9a9b('0x38')],{'$or':_[_0x9a9b('0x2e')](_0x44f47e['attributes'],function(_0x210fa6){var _0x252b7c={};_0x252b7c[_0x210fa6]={'$like':'%'+_0x449011[_0x9a9b('0x2f')]['filter']+'%'};return _0x252b7c;})});}_0x44f47e=_[_0x9a9b('0x3b')]({},_0x44f47e,_0x449011['options']);return _0x4bab06[_0x9a9b('0x4d')](_0x44f47e);}})[_0x9a9b('0x24')](function(_0x5f1381){if(_0x5f1381){_0x1b7dd2=_0x5f1381[_0x9a9b('0x34')];if(!_0x449011[_0x9a9b('0x2f')][_0x9a9b('0x4c')]('nolimit')){_0x44f47e['limit']=qs[_0x9a9b('0x1f')](_0x449011['query']['limit']);_0x44f47e[_0x9a9b('0x1c')]=qs[_0x9a9b('0x1c')](_0x449011['query'][_0x9a9b('0x1c')]);}return _0x4bab06[_0x9a9b('0x4d')](_0x44f47e);}})['then'](function(_0x408197){if(_0x408197){return _0x408197?{'count':_0x1b7dd2,'rows':_0x408197}:null;}})[_0x9a9b('0x24')](respondWithResult(_0x14245c,null))[_0x9a9b('0x41')](handleError(_0x14245c,null));};exports[_0x9a9b('0x4e')]=function(_0x282f31,_0x39e72a,_0x306102){var _0x2a9f00={};var _0x2a1722={};var _0x2f9543;var _0xad3ee0;return db[_0x9a9b('0x2a')][_0x9a9b('0x4a')]({'where':{'id':_0x282f31['params']['id']}})['then'](handleEntityNotFound(_0x39e72a,null))['then'](function(_0x33807b){if(_0x33807b){_0x2f9543=_0x33807b;_0x2a1722[_0x9a9b('0x2d')]=_[_0x9a9b('0x44')](db['SugarcrmField'][_0x9a9b('0x45')]);_0x2a1722[_0x9a9b('0x2f')]=_[_0x9a9b('0x44')](_0x282f31[_0x9a9b('0x2f')]);_0x2a1722[_0x9a9b('0x30')]=_[_0x9a9b('0x31')](_0x2a1722['model'],_0x2a1722[_0x9a9b('0x2f')]);_0x2a9f00[_0x9a9b('0x32')]=_[_0x9a9b('0x31')](_0x2a1722[_0x9a9b('0x2d')],qs['fields'](_0x282f31[_0x9a9b('0x2f')][_0x9a9b('0x33')]));_0x2a9f00['attributes']=_0x2a9f00[_0x9a9b('0x32')][_0x9a9b('0x34')]?_0x2a9f00['attributes']:_0x2a1722[_0x9a9b('0x2d')];_0x2a9f00[_0x9a9b('0x36')]=qs[_0x9a9b('0x37')](_0x282f31['query']['sort']);_0x2a9f00[_0x9a9b('0x38')]=qs['filters'](_['pick'](_0x282f31[_0x9a9b('0x2f')],_0x2a1722[_0x9a9b('0x30')]));if(_0x282f31[_0x9a9b('0x2f')][_0x9a9b('0x3a')]){_0x2a9f00[_0x9a9b('0x38')]=_[_0x9a9b('0x3b')](_0x2a9f00[_0x9a9b('0x38')],{'$or':_[_0x9a9b('0x2e')](_0x2a9f00['attributes'],function(_0x58f20e){var _0x2e14e1={};_0x2e14e1[_0x58f20e]={'$like':'%'+_0x282f31['query'][_0x9a9b('0x3a')]+'%'};return _0x2e14e1;})});}_0x2a9f00=_['merge']({},_0x2a9f00,_0x282f31['options']);return _0x2f9543[_0x9a9b('0x4e')](_0x2a9f00);}})[_0x9a9b('0x24')](function(_0x2372b1){if(_0x2372b1){_0xad3ee0=_0x2372b1['length'];if(!_0x282f31['query'][_0x9a9b('0x4c')](_0x9a9b('0x35'))){_0x2a9f00[_0x9a9b('0x1f')]=qs[_0x9a9b('0x1f')](_0x282f31[_0x9a9b('0x2f')]['limit']);_0x2a9f00[_0x9a9b('0x1c')]=qs[_0x9a9b('0x1c')](_0x282f31[_0x9a9b('0x2f')][_0x9a9b('0x1c')]);}return _0x2f9543['getDescriptions'](_0x2a9f00);}})[_0x9a9b('0x24')](function(_0x27aebd){if(_0x27aebd){return _0x27aebd?{'count':_0xad3ee0,'rows':_0x27aebd}:null;}})[_0x9a9b('0x24')](respondWithResult(_0x39e72a,null))['catch'](handleError(_0x39e72a,null));}; \ No newline at end of file +var _0x0f45=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','catch','params','find','create','body','destroy','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','query'];(function(_0x462695,_0x9b82b8){var _0x1dc47d=function(_0x425358){while(--_0x425358){_0x462695['push'](_0x462695['shift']());}};_0x1dc47d(++_0x9b82b8);}(_0x0f45,0x1aa));var _0x50f4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x0f45[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0x50f4('0x0'));var rimraf=require(_0x50f4('0x1'));var zipdir=require(_0x50f4('0x2'));var jsonpatch=require(_0x50f4('0x3'));var rp=require(_0x50f4('0x4'));var moment=require(_0x50f4('0x5'));var BPromise=require(_0x50f4('0x6'));var Mustache=require('mustache');var util=require(_0x50f4('0x7'));var path=require('path');var sox=require(_0x50f4('0x8'));var csv=require('to-csv');var ejs=require(_0x50f4('0x9'));var fs=require('fs');var fs_extra=require(_0x50f4('0xa'));var _=require(_0x50f4('0xb'));var squel=require(_0x50f4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x50f4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x50f4('0xe'));var Papa=require(_0x50f4('0xf'));var Redis=require(_0x50f4('0x10'));var authService=require(_0x50f4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x50f4('0x12'))(_0x50f4('0x13'));var utils=require(_0x50f4('0x14'));var config=require(_0x50f4('0x15'));var licenseUtil=require(_0x50f4('0x16'));var db=require(_0x50f4('0x17'))['db'];function respondWithStatusCode(_0x165887,_0x14d72e){_0x14d72e=_0x14d72e||0xcc;return function(_0x3c2646){if(_0x3c2646){return _0x165887[_0x50f4('0x18')](_0x14d72e);}return _0x165887['status'](_0x14d72e)[_0x50f4('0x19')]();};}function respondWithResult(_0x2ad243,_0xafd51d){_0xafd51d=_0xafd51d||0xc8;return function(_0x39ed93){if(_0x39ed93){return _0x2ad243['status'](_0xafd51d)[_0x50f4('0x1a')](_0x39ed93);}};}function respondWithFilteredResult(_0x5c8997,_0x273f4b){return function(_0x4f3ca2){if(_0x4f3ca2){var _0x27a8c2=typeof _0x273f4b[_0x50f4('0x1b')]===_0x50f4('0x1c')&&typeof _0x273f4b[_0x50f4('0x1d')]===_0x50f4('0x1c');var _0x2db4cf=_0x4f3ca2[_0x50f4('0x1e')];var _0x519a47=_0x27a8c2?0x0:_0x273f4b['offset'];var _0x433db3=_0x27a8c2?_0x4f3ca2[_0x50f4('0x1e')]:_0x273f4b[_0x50f4('0x1b')]+_0x273f4b['limit'];var _0x10ea45;if(_0x433db3>=_0x2db4cf){_0x433db3=_0x2db4cf;_0x10ea45=0xc8;}else{_0x10ea45=0xce;}_0x5c8997[_0x50f4('0x1f')](_0x10ea45);return _0x5c8997[_0x50f4('0x20')](_0x50f4('0x21'),_0x519a47+'-'+_0x433db3+'/'+_0x2db4cf)[_0x50f4('0x1a')](_0x4f3ca2);}return null;};}function patchUpdates(_0x46fcf8){return function(_0x5222a2){try{jsonpatch[_0x50f4('0x22')](_0x5222a2,_0x46fcf8,!![]);}catch(_0x49140a){return BPromise[_0x50f4('0x23')](_0x49140a);}return _0x5222a2['save']();};}function saveUpdates(_0x1a9079,_0x2aa1f7){return function(_0x3690e0){if(_0x3690e0){return _0x3690e0[_0x50f4('0x24')](_0x1a9079)[_0x50f4('0x25')](function(_0x2fec83){return _0x2fec83;});}return null;};}function removeEntity(_0x5339f4,_0x4efb5e){return function(_0x36cab2){if(_0x36cab2){return _0x36cab2['destroy']()[_0x50f4('0x25')](function(){_0x5339f4[_0x50f4('0x1f')](0xcc)[_0x50f4('0x19')]();});}};}function handleEntityNotFound(_0x2cbe8f,_0x555653){return function(_0x4e302e){if(!_0x4e302e){_0x2cbe8f[_0x50f4('0x18')](0x194);}return _0x4e302e;};}function handleError(_0x501df9,_0x1da03c){_0x1da03c=_0x1da03c||0x1f4;return function(_0x1769c5){logger[_0x50f4('0x26')](_0x1769c5['stack']);if(_0x1769c5[_0x50f4('0x27')]){delete _0x1769c5[_0x50f4('0x27')];}_0x501df9[_0x50f4('0x1f')](_0x1da03c)[_0x50f4('0x28')](_0x1769c5);};}exports[_0x50f4('0x29')]=function(_0x56e34e,_0x5b1132){var _0x343811={},_0x16b558={},_0x1d81a0={'count':0x0,'rows':[]};var _0x5f3ac7=_[_0x50f4('0x2a')](db[_0x50f4('0x2b')][_0x50f4('0x2c')],function(_0xc80880){return{'name':_0xc80880[_0x50f4('0x2d')],'type':_0xc80880['type'][_0x50f4('0x2e')]};});_0x16b558['model']=_[_0x50f4('0x2a')](_0x5f3ac7,_0x50f4('0x27'));_0x16b558[_0x50f4('0x2f')]=_[_0x50f4('0x30')](_0x56e34e[_0x50f4('0x2f')]);_0x16b558[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x16b558[_0x50f4('0x33')],_0x16b558['query']);_0x343811[_0x50f4('0x34')]=_[_0x50f4('0x32')](_0x16b558[_0x50f4('0x33')],qs['fields'](_0x56e34e[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x343811[_0x50f4('0x34')]=_0x343811[_0x50f4('0x34')][_0x50f4('0x36')]?_0x343811[_0x50f4('0x34')]:_0x16b558['model'];if(!_0x56e34e[_0x50f4('0x2f')][_0x50f4('0x37')](_0x50f4('0x38'))){_0x343811[_0x50f4('0x1d')]=qs[_0x50f4('0x1d')](_0x56e34e['query'][_0x50f4('0x1d')]);_0x343811[_0x50f4('0x1b')]=qs[_0x50f4('0x1b')](_0x56e34e['query'][_0x50f4('0x1b')]);}_0x343811['order']=qs['sort'](_0x56e34e[_0x50f4('0x2f')][_0x50f4('0x39')]);_0x343811[_0x50f4('0x3a')]=qs[_0x50f4('0x31')](_[_0x50f4('0x3b')](_0x56e34e['query'],_0x16b558[_0x50f4('0x31')]),_0x5f3ac7);if(_0x56e34e[_0x50f4('0x2f')][_0x50f4('0x3c')]){_0x343811[_0x50f4('0x3a')]=_['merge'](_0x343811[_0x50f4('0x3a')],{'$or':_['map'](_0x5f3ac7,function(_0x3b1f49){if(_0x3b1f49[_0x50f4('0x3d')]!==_0x50f4('0x3e')){var _0x4779a3={};_0x4779a3[_0x3b1f49['name']]={'$like':'%'+_0x56e34e[_0x50f4('0x2f')]['filter']+'%'};return _0x4779a3;}})});}_0x343811=_[_0x50f4('0x3f')]({},_0x343811,_0x56e34e[_0x50f4('0x40')]);var _0x116152={'where':_0x343811[_0x50f4('0x3a')]};return db[_0x50f4('0x2b')]['count'](_0x116152)[_0x50f4('0x25')](function(_0x1afa71){_0x1d81a0['count']=_0x1afa71;if(_0x56e34e['query']['includeAll']){_0x343811[_0x50f4('0x41')]=[{'all':!![]}];}return db[_0x50f4('0x2b')][_0x50f4('0x42')](_0x343811);})[_0x50f4('0x25')](function(_0x28ce52){_0x1d81a0['rows']=_0x28ce52;return _0x1d81a0;})[_0x50f4('0x25')](respondWithFilteredResult(_0x5b1132,_0x343811))[_0x50f4('0x43')](handleError(_0x5b1132,null));};exports['show']=function(_0xcf8670,_0x32bb01){var _0x2e712e={'raw':![],'where':{'id':_0xcf8670[_0x50f4('0x44')]['id']}},_0x463f37={};_0x463f37[_0x50f4('0x33')]=_[_0x50f4('0x30')](db['SugarcrmConfiguration'][_0x50f4('0x2c')]);_0x463f37[_0x50f4('0x2f')]=_['keys'](_0xcf8670[_0x50f4('0x2f')]);_0x463f37['filters']=_['intersection'](_0x463f37[_0x50f4('0x33')],_0x463f37['query']);_0x2e712e['attributes']=_[_0x50f4('0x32')](_0x463f37[_0x50f4('0x33')],qs[_0x50f4('0x35')](_0xcf8670[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x2e712e[_0x50f4('0x34')]=_0x2e712e[_0x50f4('0x34')]['length']?_0x2e712e[_0x50f4('0x34')]:_0x463f37[_0x50f4('0x33')];if(_0xcf8670['query']['includeAll']){_0x2e712e[_0x50f4('0x41')]=[{'all':!![]}];}_0x2e712e=_[_0x50f4('0x3f')]({},_0x2e712e,_0xcf8670['options']);return db[_0x50f4('0x2b')][_0x50f4('0x45')](_0x2e712e)[_0x50f4('0x25')](handleEntityNotFound(_0x32bb01,null))[_0x50f4('0x25')](respondWithResult(_0x32bb01,null))[_0x50f4('0x43')](handleError(_0x32bb01,null));};exports[_0x50f4('0x46')]=function(_0x3db690,_0x3fa5c6){return db[_0x50f4('0x2b')][_0x50f4('0x46')](_0x3db690[_0x50f4('0x47')],{})[_0x50f4('0x25')](respondWithResult(_0x3fa5c6,0xc9))[_0x50f4('0x43')](handleError(_0x3fa5c6,null));};exports['update']=function(_0x1b6ae4,_0x19fe52){if(_0x1b6ae4['body']['id']){delete _0x1b6ae4['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1b6ae4[_0x50f4('0x44')]['id']}})['then'](handleEntityNotFound(_0x19fe52,null))[_0x50f4('0x25')](saveUpdates(_0x1b6ae4['body'],null))['then'](respondWithResult(_0x19fe52,null))['catch'](handleError(_0x19fe52,null));};exports[_0x50f4('0x48')]=function(_0xa2ce34,_0x54f4f0){return db['SugarcrmConfiguration'][_0x50f4('0x45')]({'where':{'id':_0xa2ce34['params']['id']}})['then'](handleEntityNotFound(_0x54f4f0,null))[_0x50f4('0x25')](removeEntity(_0x54f4f0,null))['catch'](handleError(_0x54f4f0,null));};exports[_0x50f4('0x49')]=function(_0x2855fb,_0x416e8f,_0xf52200){var _0x525405={};var _0x510c53={};var _0x93a7a0;var _0x36543b;return db['SugarcrmConfiguration'][_0x50f4('0x4a')]({'where':{'id':_0x2855fb['params']['id']}})[_0x50f4('0x25')](handleEntityNotFound(_0x416e8f,null))[_0x50f4('0x25')](function(_0xf0aed0){if(_0xf0aed0){_0x93a7a0=_0xf0aed0;_0x510c53['model']=_[_0x50f4('0x30')](db[_0x50f4('0x4b')][_0x50f4('0x2c')]);_0x510c53['query']=_[_0x50f4('0x30')](_0x2855fb[_0x50f4('0x2f')]);_0x510c53[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x510c53[_0x50f4('0x33')],_0x510c53[_0x50f4('0x2f')]);_0x525405[_0x50f4('0x34')]=_['intersection'](_0x510c53['model'],qs['fields'](_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x525405[_0x50f4('0x34')]=_0x525405['attributes'][_0x50f4('0x36')]?_0x525405['attributes']:_0x510c53[_0x50f4('0x33')];_0x525405[_0x50f4('0x4c')]=qs[_0x50f4('0x39')](_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x39')]);_0x525405[_0x50f4('0x3a')]=qs[_0x50f4('0x31')](_[_0x50f4('0x3b')](_0x2855fb[_0x50f4('0x2f')],_0x510c53[_0x50f4('0x31')]));if(_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x3c')]){_0x525405[_0x50f4('0x3a')]=_[_0x50f4('0x3f')](_0x525405[_0x50f4('0x3a')],{'$or':_['map'](_0x525405[_0x50f4('0x34')],function(_0x15f901){var _0x4a60f1={};_0x4a60f1[_0x15f901]={'$like':'%'+_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x3c')]+'%'};return _0x4a60f1;})});}_0x525405=_['merge']({},_0x525405,_0x2855fb[_0x50f4('0x40')]);return _0x93a7a0[_0x50f4('0x49')](_0x525405);}})[_0x50f4('0x25')](function(_0x4aaa01){if(_0x4aaa01){_0x36543b=_0x4aaa01[_0x50f4('0x36')];if(!_0x2855fb['query']['hasOwnProperty'](_0x50f4('0x38'))){_0x525405[_0x50f4('0x1d')]=qs[_0x50f4('0x1d')](_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x1d')]);_0x525405[_0x50f4('0x1b')]=qs[_0x50f4('0x1b')](_0x2855fb['query'][_0x50f4('0x1b')]);}return _0x93a7a0[_0x50f4('0x49')](_0x525405);}})[_0x50f4('0x25')](function(_0x19b542){if(_0x19b542){return _0x19b542?{'count':_0x36543b,'rows':_0x19b542}:null;}})[_0x50f4('0x25')](respondWithResult(_0x416e8f,null))[_0x50f4('0x43')](handleError(_0x416e8f,null));};exports['getSubjects']=function(_0x582b23,_0x4843ad,_0x508972){var _0x3e8146={};var _0x485eee={};var _0x131a5c;var _0x5ec6ac;return db[_0x50f4('0x2b')][_0x50f4('0x4a')]({'where':{'id':_0x582b23[_0x50f4('0x44')]['id']}})[_0x50f4('0x25')](handleEntityNotFound(_0x4843ad,null))[_0x50f4('0x25')](function(_0x497b25){if(_0x497b25){_0x131a5c=_0x497b25;_0x485eee[_0x50f4('0x33')]=_['keys'](db[_0x50f4('0x4b')]['rawAttributes']);_0x485eee[_0x50f4('0x2f')]=_[_0x50f4('0x30')](_0x582b23[_0x50f4('0x2f')]);_0x485eee[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x485eee[_0x50f4('0x33')],_0x485eee['query']);_0x3e8146[_0x50f4('0x34')]=_[_0x50f4('0x32')](_0x485eee[_0x50f4('0x33')],qs['fields'](_0x582b23[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x3e8146[_0x50f4('0x34')]=_0x3e8146[_0x50f4('0x34')]['length']?_0x3e8146[_0x50f4('0x34')]:_0x485eee[_0x50f4('0x33')];_0x3e8146[_0x50f4('0x4c')]=qs[_0x50f4('0x39')](_0x582b23['query'][_0x50f4('0x39')]);_0x3e8146['where']=qs[_0x50f4('0x31')](_[_0x50f4('0x3b')](_0x582b23[_0x50f4('0x2f')],_0x485eee[_0x50f4('0x31')]));if(_0x582b23[_0x50f4('0x2f')][_0x50f4('0x3c')]){_0x3e8146[_0x50f4('0x3a')]=_[_0x50f4('0x3f')](_0x3e8146['where'],{'$or':_['map'](_0x3e8146['attributes'],function(_0x2afa6a){var _0x56567a={};_0x56567a[_0x2afa6a]={'$like':'%'+_0x582b23[_0x50f4('0x2f')]['filter']+'%'};return _0x56567a;})});}_0x3e8146=_[_0x50f4('0x3f')]({},_0x3e8146,_0x582b23[_0x50f4('0x40')]);return _0x131a5c[_0x50f4('0x4d')](_0x3e8146);}})['then'](function(_0x4349c6){if(_0x4349c6){_0x5ec6ac=_0x4349c6[_0x50f4('0x36')];if(!_0x582b23[_0x50f4('0x2f')][_0x50f4('0x37')](_0x50f4('0x38'))){_0x3e8146['limit']=qs[_0x50f4('0x1d')](_0x582b23['query'][_0x50f4('0x1d')]);_0x3e8146[_0x50f4('0x1b')]=qs[_0x50f4('0x1b')](_0x582b23[_0x50f4('0x2f')][_0x50f4('0x1b')]);}return _0x131a5c[_0x50f4('0x4d')](_0x3e8146);}})[_0x50f4('0x25')](function(_0x27813b){if(_0x27813b){return _0x27813b?{'count':_0x5ec6ac,'rows':_0x27813b}:null;}})[_0x50f4('0x25')](respondWithResult(_0x4843ad,null))['catch'](handleError(_0x4843ad,null));};exports[_0x50f4('0x4e')]=function(_0x1b36bf,_0x5a341b,_0x2a4960){var _0x745da4={};var _0x1dfeea={};var _0x16424b;var _0x13a6f3;return db['SugarcrmConfiguration'][_0x50f4('0x4a')]({'where':{'id':_0x1b36bf['params']['id']}})[_0x50f4('0x25')](handleEntityNotFound(_0x5a341b,null))[_0x50f4('0x25')](function(_0x561cd3){if(_0x561cd3){_0x16424b=_0x561cd3;_0x1dfeea[_0x50f4('0x33')]=_[_0x50f4('0x30')](db[_0x50f4('0x4b')][_0x50f4('0x2c')]);_0x1dfeea['query']=_['keys'](_0x1b36bf[_0x50f4('0x2f')]);_0x1dfeea[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x1dfeea[_0x50f4('0x33')],_0x1dfeea[_0x50f4('0x2f')]);_0x745da4[_0x50f4('0x34')]=_['intersection'](_0x1dfeea[_0x50f4('0x33')],qs[_0x50f4('0x35')](_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x745da4[_0x50f4('0x34')]=_0x745da4[_0x50f4('0x34')][_0x50f4('0x36')]?_0x745da4[_0x50f4('0x34')]:_0x1dfeea[_0x50f4('0x33')];_0x745da4[_0x50f4('0x4c')]=qs[_0x50f4('0x39')](_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x39')]);_0x745da4[_0x50f4('0x3a')]=qs[_0x50f4('0x31')](_[_0x50f4('0x3b')](_0x1b36bf[_0x50f4('0x2f')],_0x1dfeea[_0x50f4('0x31')]));if(_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x3c')]){_0x745da4[_0x50f4('0x3a')]=_['merge'](_0x745da4[_0x50f4('0x3a')],{'$or':_[_0x50f4('0x2a')](_0x745da4[_0x50f4('0x34')],function(_0x214c05){var _0x17a56c={};_0x17a56c[_0x214c05]={'$like':'%'+_0x1b36bf['query']['filter']+'%'};return _0x17a56c;})});}_0x745da4=_[_0x50f4('0x3f')]({},_0x745da4,_0x1b36bf[_0x50f4('0x40')]);return _0x16424b[_0x50f4('0x4e')](_0x745da4);}})[_0x50f4('0x25')](function(_0x2114b2){if(_0x2114b2){_0x13a6f3=_0x2114b2['length'];if(!_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x37')](_0x50f4('0x38'))){_0x745da4[_0x50f4('0x1d')]=qs[_0x50f4('0x1d')](_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x1d')]);_0x745da4[_0x50f4('0x1b')]=qs['offset'](_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x1b')]);}return _0x16424b['getDescriptions'](_0x745da4);}})[_0x50f4('0x25')](function(_0x2dbf66){if(_0x2dbf66){return _0x2dbf66?{'count':_0x13a6f3,'rows':_0x2dbf66}:null;}})[_0x50f4('0x25')](respondWithResult(_0x5a341b,null))[_0x50f4('0x43')](handleError(_0x5a341b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 50787fc..5a1db5e 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 _0xf963=['exports','define','int_sugarcrm_configurations','../../config/logger','bluebird','path','rimraf'];(function(_0x48d388,_0x5e792a){var _0x8f96c6=function(_0x29af3d){while(--_0x29af3d){_0x48d388['push'](_0x48d388['shift']());}};_0x8f96c6(++_0x5e792a);}(_0xf963,0x145));var _0x3f96=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf963[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f96('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3f96('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f96('0x2'));var rimraf=require(_0x3f96('0x3'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x3f96('0x4')]=function(_0x28241c,_0x325c70){return _0x28241c[_0x3f96('0x5')]('SugarcrmConfiguration',attributes,{'tableName':_0x3f96('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11f5=['api','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x2e5b28,_0x4c016d){var _0x24f513=function(_0x52bb92){while(--_0x52bb92){_0x2e5b28['push'](_0x2e5b28['shift']());}};_0x24f513(++_0x4c016d);}(_0x11f5,0x8d));var _0x511f=function(_0x1c1777,_0x4f345b){_0x1c1777=_0x1c1777-0x0;var _0x1e634c=_0x11f5[_0x1c1777];return _0x1e634c;};'use strict';var _=require(_0x511f('0x0'));var util=require(_0x511f('0x1'));var logger=require('../../config/logger')(_0x511f('0x2'));var moment=require('moment');var BPromise=require(_0x511f('0x3'));var rp=require(_0x511f('0x4'));var fs=require('fs');var path=require(_0x511f('0x5'));var rimraf=require('rimraf');var config=require(_0x511f('0x6'));var attributes=require(_0x511f('0x7'));module[_0x511f('0x8')]=function(_0x392b7b,_0x32b1a4){return _0x392b7b['define'](_0x511f('0x9'),attributes,{'tableName':_0x511f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 89a6c2d..1bcd0a2 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 _0x9c01=['SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x9c01,0x189));var _0x19c0=function(_0x158562,_0x16c21e){_0x158562=_0x158562-0x0;var _0x5eb16d=_0x9c01[_0x158562];return _0x5eb16d;};'use strict';var _=require(_0x19c0('0x0'));var util=require(_0x19c0('0x1'));var moment=require(_0x19c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x19c0('0x3'));var fs=require('fs');var Redis=require(_0x19c0('0x4'));var db=require(_0x19c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19c0('0x6'))(_0x19c0('0x7'));var config=require(_0x19c0('0x8'));var jayson=require(_0x19c0('0x9'));var client=jayson[_0x19c0('0xa')][_0x19c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x134b49,_0xab293a,_0x3a43cb){return new BPromise(function(_0x56ea03,_0x25ef14){return client[_0x19c0('0xc')](_0x134b49,_0x3a43cb)[_0x19c0('0xd')](function(_0x1dd392){logger[_0x19c0('0xe')](_0x19c0('0xf'),_0xab293a,'request\x20sent');logger['debug'](_0x19c0('0x10'),_0xab293a,_0x19c0('0x11'),JSON[_0x19c0('0x12')](_0x1dd392));if(_0x1dd392[_0x19c0('0x13')]){if(_0x1dd392[_0x19c0('0x13')][_0x19c0('0x14')]===0x1f4){logger[_0x19c0('0x13')](_0x19c0('0xf'),_0xab293a,_0x1dd392[_0x19c0('0x13')]['message']);return _0x25ef14(_0x1dd392[_0x19c0('0x13')][_0x19c0('0x15')]);}logger[_0x19c0('0x13')](_0x19c0('0xf'),_0xab293a,_0x1dd392['error'][_0x19c0('0x15')]);return _0x56ea03(_0x1dd392[_0x19c0('0x13')][_0x19c0('0x15')]);}else{logger[_0x19c0('0xe')](_0x19c0('0xf'),_0xab293a,_0x19c0('0x11'));_0x56ea03(_0x1dd392[_0x19c0('0x16')]['message']);}})[_0x19c0('0x17')](function(_0x235df1){logger['error'](_0x19c0('0xf'),_0xab293a,_0x235df1);_0x25ef14(_0x235df1);});});} \ No newline at end of file +var _0x9f35=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result'];(function(_0x5c8b19,_0x47d79a){var _0x2ff0cd=function(_0x3c1f53){while(--_0x3c1f53){_0x5c8b19['push'](_0x5c8b19['shift']());}};_0x2ff0cd(++_0x47d79a);}(_0x9f35,0x1cc));var _0x59f3=function(_0xadab48,_0x5ae738){_0xadab48=_0xadab48-0x0;var _0x3aef38=_0x9f35[_0xadab48];return _0x3aef38;};'use strict';var _=require('lodash');var util=require(_0x59f3('0x0'));var moment=require(_0x59f3('0x1'));var BPromise=require(_0x59f3('0x2'));var rs=require(_0x59f3('0x3'));var fs=require('fs');var Redis=require(_0x59f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x59f3('0x5'));var logger=require(_0x59f3('0x6'))('rpc');var config=require(_0x59f3('0x7'));var jayson=require(_0x59f3('0x8'));var client=jayson['client'][_0x59f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47ba17,_0x24ee9e,_0x53f268){return new BPromise(function(_0x511952,_0x46826b){return client[_0x59f3('0xa')](_0x47ba17,_0x53f268)[_0x59f3('0xb')](function(_0x4721fa){logger['info'](_0x59f3('0xc'),_0x24ee9e,_0x59f3('0xd'));logger[_0x59f3('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x24ee9e,_0x59f3('0xd'),JSON[_0x59f3('0xf')](_0x4721fa));if(_0x4721fa['error']){if(_0x4721fa[_0x59f3('0x10')]['code']===0x1f4){logger[_0x59f3('0x10')](_0x59f3('0xc'),_0x24ee9e,_0x4721fa[_0x59f3('0x10')][_0x59f3('0x11')]);return _0x46826b(_0x4721fa['error'][_0x59f3('0x11')]);}logger[_0x59f3('0x10')](_0x59f3('0xc'),_0x24ee9e,_0x4721fa[_0x59f3('0x10')][_0x59f3('0x11')]);return _0x511952(_0x4721fa[_0x59f3('0x10')]['message']);}else{logger[_0x59f3('0x12')](_0x59f3('0xc'),_0x24ee9e,_0x59f3('0xd'));_0x511952(_0x4721fa[_0x59f3('0x13')][_0x59f3('0x11')]);}})['catch'](function(_0x5ebdb5){logger[_0x59f3('0x10')](_0x59f3('0xc'),_0x24ee9e,_0x5ebdb5);_0x46826b(_0x5ebdb5);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2610c0e..07b4690 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 _0x9afa=['/:id','post','isAuthenticated','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmField.controller'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x9afa,0x115));var _0xa9af=function(_0x208526,_0x167c47){_0x208526=_0x208526-0x0;var _0x4e630b=_0x9afa[_0x208526];return _0x4e630b;};'use strict';var multer=require('multer');var util=require(_0xa9af('0x0'));var path=require(_0xa9af('0x1'));var timeout=require(_0xa9af('0x2'));var express=require(_0xa9af('0x3'));var router=express[_0xa9af('0x4')]();var fs_extra=require(_0xa9af('0x5'));var auth=require(_0xa9af('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa9af('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa9af('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xa9af('0x9')]('/',auth[_0xa9af('0xa')](),controller['create']);router[_0xa9af('0xb')](_0xa9af('0x8'),auth[_0xa9af('0xa')](),controller[_0xa9af('0xc')]);router['delete']('/:id',auth[_0xa9af('0xa')](),controller[_0xa9af('0xd')]);module[_0xa9af('0xe')]=router; \ No newline at end of file +var _0x34ef=['Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','path','connect-timeout','express'];(function(_0x69188b,_0x550923){var _0x3320f4=function(_0x27d05b){while(--_0x27d05b){_0x69188b['push'](_0x69188b['shift']());}};_0x3320f4(++_0x550923);}(_0x34ef,0x10d));var _0xf34e=function(_0x2d493c,_0x5e8356){_0x2d493c=_0x2d493c-0x0;var _0x5bdd8e=_0x34ef[_0x2d493c];return _0x5bdd8e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf34e('0x0'));var timeout=require(_0xf34e('0x1'));var express=require(_0xf34e('0x2'));var router=express[_0xf34e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf34e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf34e('0x5'));var controller=require(_0xf34e('0x6'));router['get']('/',auth[_0xf34e('0x7')](),controller[_0xf34e('0x8')]);router['get'](_0xf34e('0x9'),auth[_0xf34e('0x7')](),controller[_0xf34e('0xa')]);router[_0xf34e('0xb')]('/',auth[_0xf34e('0x7')](),controller[_0xf34e('0xc')]);router[_0xf34e('0xd')](_0xf34e('0x9'),auth[_0xf34e('0x7')](),controller[_0xf34e('0xe')]);router[_0xf34e('0xf')](_0xf34e('0x9'),auth[_0xf34e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ca4f172..0ba3896 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 _0x8c49=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x141535,_0x2318c8){var _0x1b5cfa=function(_0x136337){while(--_0x136337){_0x141535['push'](_0x141535['shift']());}};_0x1b5cfa(++_0x2318c8);}(_0x8c49,0x137));var _0x98c4=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x8c49[_0xa4f636];return _0x37e02a;};'use strict';var Sequelize=require(_0x98c4('0x0'));module[_0x98c4('0x1')]={'type':{'type':Sequelize[_0x98c4('0x2')](_0x98c4('0x3'),_0x98c4('0x4'),_0x98c4('0x5'),_0x98c4('0x6'),_0x98c4('0x7')),'defaultValue':_0x98c4('0x3')},'content':{'type':Sequelize[_0x98c4('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x98c4('0x2')](_0x98c4('0x3'),_0x98c4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x98c4('0x8')]},'idField':{'type':Sequelize[_0x98c4('0x8')]},'nameField':{'type':Sequelize[_0x98c4('0x8')]},'customField':{'type':Sequelize[_0x98c4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98c4('0x8')]}}; \ No newline at end of file +var _0xbb67=['ENUM','customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbb67,0x181));var _0x7bb6=function(_0x3ca104,_0x23eda6){_0x3ca104=_0x3ca104-0x0;var _0xfe2db3=_0xbb67[_0x3ca104];return _0xfe2db3;};'use strict';var Sequelize=require(_0x7bb6('0x0'));module[_0x7bb6('0x1')]={'type':{'type':Sequelize[_0x7bb6('0x2')]('string','variable',_0x7bb6('0x3'),'keyValue',_0x7bb6('0x4')),'defaultValue':_0x7bb6('0x5')},'content':{'type':Sequelize[_0x7bb6('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7bb6('0x2')](_0x7bb6('0x5'),_0x7bb6('0x7'),_0x7bb6('0x3'))},'keyContent':{'type':Sequelize[_0x7bb6('0x6')]},'idField':{'type':Sequelize[_0x7bb6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7bb6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7bb6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 6134772..713313a 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 _0xc7d0=['include','find','catch','create','body','eml-format','rimraf','request-promise','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys'];(function(_0x4c6fcf,_0xf9397b){var _0x18c02f=function(_0x522b38){while(--_0x522b38){_0x4c6fcf['push'](_0x4c6fcf['shift']());}};_0x18c02f(++_0xf9397b);}(_0xc7d0,0x141));var _0x0c7d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc7d0[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x0c7d('0x0'));var rimraf=require(_0x0c7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0c7d('0x2'));var moment=require(_0x0c7d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0c7d('0x4'));var util=require(_0x0c7d('0x5'));var path=require(_0x0c7d('0x6'));var sox=require(_0x0c7d('0x7'));var csv=require(_0x0c7d('0x8'));var ejs=require(_0x0c7d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c7d('0xa'));var squel=require(_0x0c7d('0xb'));var crypto=require(_0x0c7d('0xc'));var jsforce=require(_0x0c7d('0xd'));var deskjs=require(_0x0c7d('0xe'));var toCsv=require(_0x0c7d('0x8'));var querystring=require(_0x0c7d('0xf'));var Papa=require(_0x0c7d('0x10'));var Redis=require('ioredis');var authService=require(_0x0c7d('0x11'));var qs=require(_0x0c7d('0x12'));var as=require(_0x0c7d('0x13'));var hardwareService=require(_0x0c7d('0x14'));var logger=require(_0x0c7d('0x15'))(_0x0c7d('0x16'));var utils=require(_0x0c7d('0x17'));var config=require(_0x0c7d('0x18'));var licenseUtil=require(_0x0c7d('0x19'));var db=require(_0x0c7d('0x1a'))['db'];function respondWithStatusCode(_0x56a589,_0x2245d1){_0x2245d1=_0x2245d1||0xcc;return function(_0x55e232){if(_0x55e232){return _0x56a589[_0x0c7d('0x1b')](_0x2245d1);}return _0x56a589['status'](_0x2245d1)[_0x0c7d('0x1c')]();};}function respondWithResult(_0x36237d,_0x1d52b8){_0x1d52b8=_0x1d52b8||0xc8;return function(_0x41f46f){if(_0x41f46f){return _0x36237d['status'](_0x1d52b8)[_0x0c7d('0x1d')](_0x41f46f);}};}function respondWithFilteredResult(_0x1f09c7,_0x4eb5e1){return function(_0x1f5274){if(_0x1f5274){var _0x2fbdc0=typeof _0x4eb5e1[_0x0c7d('0x1e')]==='undefined'&&typeof _0x4eb5e1[_0x0c7d('0x1f')]==='undefined';var _0x224108=_0x1f5274[_0x0c7d('0x20')];var _0x5498f5=_0x2fbdc0?0x0:_0x4eb5e1['offset'];var _0x2e88f7=_0x2fbdc0?_0x1f5274[_0x0c7d('0x20')]:_0x4eb5e1['offset']+_0x4eb5e1[_0x0c7d('0x1f')];var _0x3caee;if(_0x2e88f7>=_0x224108){_0x2e88f7=_0x224108;_0x3caee=0xc8;}else{_0x3caee=0xce;}_0x1f09c7[_0x0c7d('0x21')](_0x3caee);return _0x1f09c7[_0x0c7d('0x22')](_0x0c7d('0x23'),_0x5498f5+'-'+_0x2e88f7+'/'+_0x224108)[_0x0c7d('0x1d')](_0x1f5274);}return null;};}function patchUpdates(_0x134b82){return function(_0x44a5bf){try{jsonpatch[_0x0c7d('0x24')](_0x44a5bf,_0x134b82,!![]);}catch(_0x486e50){return BPromise[_0x0c7d('0x25')](_0x486e50);}return _0x44a5bf['save']();};}function saveUpdates(_0x5132e3,_0x30d6d7){return function(_0x5c0906){if(_0x5c0906){return _0x5c0906[_0x0c7d('0x26')](_0x5132e3)['then'](function(_0x6b5b7c){return _0x6b5b7c;});}return null;};}function removeEntity(_0x1ffdb4,_0x2c8d55){return function(_0x3d6b42){if(_0x3d6b42){return _0x3d6b42[_0x0c7d('0x27')]()[_0x0c7d('0x28')](function(){_0x1ffdb4[_0x0c7d('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ce02c,_0x10e87f){return function(_0x38f32e){if(!_0x38f32e){_0x1ce02c['sendStatus'](0x194);}return _0x38f32e;};}function handleError(_0x3896ce,_0x36eb4b){_0x36eb4b=_0x36eb4b||0x1f4;return function(_0x525ef5){logger[_0x0c7d('0x29')](_0x525ef5[_0x0c7d('0x2a')]);if(_0x525ef5[_0x0c7d('0x2b')]){delete _0x525ef5[_0x0c7d('0x2b')];}_0x3896ce[_0x0c7d('0x21')](_0x36eb4b)[_0x0c7d('0x2c')](_0x525ef5);};}exports[_0x0c7d('0x2d')]=function(_0x39cca8,_0x4f20d8){var _0x4cc564={},_0x17a244={},_0x443fcb={'count':0x0,'rows':[]};var _0x158945=_[_0x0c7d('0x2e')](db[_0x0c7d('0x2f')][_0x0c7d('0x30')],function(_0x3ee263){return{'name':_0x3ee263[_0x0c7d('0x31')],'type':_0x3ee263[_0x0c7d('0x32')][_0x0c7d('0x33')]};});_0x17a244[_0x0c7d('0x34')]=_[_0x0c7d('0x2e')](_0x158945,_0x0c7d('0x2b'));_0x17a244[_0x0c7d('0x35')]=_['keys'](_0x39cca8[_0x0c7d('0x35')]);_0x17a244[_0x0c7d('0x36')]=_[_0x0c7d('0x37')](_0x17a244['model'],_0x17a244[_0x0c7d('0x35')]);_0x4cc564[_0x0c7d('0x38')]=_[_0x0c7d('0x37')](_0x17a244[_0x0c7d('0x34')],qs[_0x0c7d('0x39')](_0x39cca8[_0x0c7d('0x35')][_0x0c7d('0x39')]));_0x4cc564[_0x0c7d('0x38')]=_0x4cc564['attributes'][_0x0c7d('0x3a')]?_0x4cc564['attributes']:_0x17a244[_0x0c7d('0x34')];if(!_0x39cca8[_0x0c7d('0x35')][_0x0c7d('0x3b')](_0x0c7d('0x3c'))){_0x4cc564[_0x0c7d('0x1f')]=qs[_0x0c7d('0x1f')](_0x39cca8['query'][_0x0c7d('0x1f')]);_0x4cc564[_0x0c7d('0x1e')]=qs[_0x0c7d('0x1e')](_0x39cca8['query'][_0x0c7d('0x1e')]);}_0x4cc564['order']=qs[_0x0c7d('0x3d')](_0x39cca8[_0x0c7d('0x35')][_0x0c7d('0x3d')]);_0x4cc564[_0x0c7d('0x3e')]=qs[_0x0c7d('0x36')](_[_0x0c7d('0x3f')](_0x39cca8['query'],_0x17a244['filters']),_0x158945);if(_0x39cca8[_0x0c7d('0x35')]['filter']){_0x4cc564['where']=_[_0x0c7d('0x40')](_0x4cc564[_0x0c7d('0x3e')],{'$or':_[_0x0c7d('0x2e')](_0x158945,function(_0x3752b5){if(_0x3752b5['type']!==_0x0c7d('0x41')){var _0x308159={};_0x308159[_0x3752b5['name']]={'$like':'%'+_0x39cca8[_0x0c7d('0x35')][_0x0c7d('0x42')]+'%'};return _0x308159;}})});}_0x4cc564=_[_0x0c7d('0x40')]({},_0x4cc564,_0x39cca8[_0x0c7d('0x43')]);var _0x5caaf4={'where':_0x4cc564['where']};return db[_0x0c7d('0x2f')]['count'](_0x5caaf4)[_0x0c7d('0x28')](function(_0x60252e){_0x443fcb[_0x0c7d('0x20')]=_0x60252e;if(_0x39cca8['query'][_0x0c7d('0x44')]){_0x4cc564['include']=[{'all':!![]}];}return db[_0x0c7d('0x2f')][_0x0c7d('0x45')](_0x4cc564);})[_0x0c7d('0x28')](function(_0x493f89){_0x443fcb[_0x0c7d('0x46')]=_0x493f89;return _0x443fcb;})[_0x0c7d('0x28')](respondWithFilteredResult(_0x4f20d8,_0x4cc564))['catch'](handleError(_0x4f20d8,null));};exports[_0x0c7d('0x47')]=function(_0x550827,_0xd5763){var _0x2a45e4={'raw':!![],'where':{'id':_0x550827[_0x0c7d('0x48')]['id']}},_0x118418={};_0x118418[_0x0c7d('0x34')]=_['keys'](db['SugarcrmField'][_0x0c7d('0x30')]);_0x118418[_0x0c7d('0x35')]=_[_0x0c7d('0x49')](_0x550827[_0x0c7d('0x35')]);_0x118418[_0x0c7d('0x36')]=_[_0x0c7d('0x37')](_0x118418[_0x0c7d('0x34')],_0x118418[_0x0c7d('0x35')]);_0x2a45e4[_0x0c7d('0x38')]=_[_0x0c7d('0x37')](_0x118418[_0x0c7d('0x34')],qs[_0x0c7d('0x39')](_0x550827[_0x0c7d('0x35')][_0x0c7d('0x39')]));_0x2a45e4[_0x0c7d('0x38')]=_0x2a45e4[_0x0c7d('0x38')]['length']?_0x2a45e4[_0x0c7d('0x38')]:_0x118418[_0x0c7d('0x34')];if(_0x550827[_0x0c7d('0x35')][_0x0c7d('0x44')]){_0x2a45e4[_0x0c7d('0x4a')]=[{'all':!![]}];}_0x2a45e4=_[_0x0c7d('0x40')]({},_0x2a45e4,_0x550827['options']);return db[_0x0c7d('0x2f')][_0x0c7d('0x4b')](_0x2a45e4)['then'](handleEntityNotFound(_0xd5763,null))[_0x0c7d('0x28')](respondWithResult(_0xd5763,null))[_0x0c7d('0x4c')](handleError(_0xd5763,null));};exports[_0x0c7d('0x4d')]=function(_0x5b88f2,_0x289c73){return db[_0x0c7d('0x2f')][_0x0c7d('0x4d')](_0x5b88f2[_0x0c7d('0x4e')],{})[_0x0c7d('0x28')](respondWithResult(_0x289c73,0xc9))['catch'](handleError(_0x289c73,null));};exports['update']=function(_0x2d05cb,_0x2b025f){if(_0x2d05cb[_0x0c7d('0x4e')]['id']){delete _0x2d05cb['body']['id'];}return db[_0x0c7d('0x2f')]['find']({'where':{'id':_0x2d05cb['params']['id']}})[_0x0c7d('0x28')](handleEntityNotFound(_0x2b025f,null))['then'](saveUpdates(_0x2d05cb[_0x0c7d('0x4e')],null))[_0x0c7d('0x28')](respondWithResult(_0x2b025f,null))[_0x0c7d('0x4c')](handleError(_0x2b025f,null));};exports[_0x0c7d('0x27')]=function(_0x31b6ad,_0x3896d7){return db['SugarcrmField'][_0x0c7d('0x4b')]({'where':{'id':_0x31b6ad[_0x0c7d('0x48')]['id']}})[_0x0c7d('0x28')](handleEntityNotFound(_0x3896d7,null))['then'](removeEntity(_0x3896d7,null))[_0x0c7d('0x4c')](handleError(_0x3896d7,null));}; \ No newline at end of file +var _0x57b7=['findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SugarcrmField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x57b7,0x9e));var _0x757b=function(_0x2ad11d,_0x5a63eb){_0x2ad11d=_0x2ad11d-0x0;var _0x37141f=_0x57b7[_0x2ad11d];return _0x37141f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x757b('0x0'));var jsonpatch=require(_0x757b('0x1'));var rp=require(_0x757b('0x2'));var moment=require(_0x757b('0x3'));var BPromise=require(_0x757b('0x4'));var Mustache=require(_0x757b('0x5'));var util=require(_0x757b('0x6'));var path=require(_0x757b('0x7'));var sox=require(_0x757b('0x8'));var csv=require(_0x757b('0x9'));var ejs=require(_0x757b('0xa'));var fs=require('fs');var fs_extra=require(_0x757b('0xb'));var _=require(_0x757b('0xc'));var squel=require(_0x757b('0xd'));var crypto=require('crypto');var jsforce=require(_0x757b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x757b('0x9'));var querystring=require('querystring');var Papa=require(_0x757b('0xf'));var Redis=require(_0x757b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x757b('0x11'));var as=require(_0x757b('0x12'));var hardwareService=require(_0x757b('0x13'));var logger=require('../../config/logger')(_0x757b('0x14'));var utils=require(_0x757b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x757b('0x16'))['db'];function respondWithStatusCode(_0x3da24e,_0x24c8ef){_0x24c8ef=_0x24c8ef||0xcc;return function(_0x315182){if(_0x315182){return _0x3da24e['sendStatus'](_0x24c8ef);}return _0x3da24e[_0x757b('0x17')](_0x24c8ef)[_0x757b('0x18')]();};}function respondWithResult(_0x29f9c5,_0x373984){_0x373984=_0x373984||0xc8;return function(_0x1c92c7){if(_0x1c92c7){return _0x29f9c5[_0x757b('0x17')](_0x373984)['json'](_0x1c92c7);}};}function respondWithFilteredResult(_0x30f987,_0x4da447){return function(_0x579139){if(_0x579139){var _0x1ef57f=typeof _0x4da447[_0x757b('0x19')]==='undefined'&&typeof _0x4da447[_0x757b('0x1a')]===_0x757b('0x1b');var _0x31e7c8=_0x579139[_0x757b('0x1c')];var _0x9c8e18=_0x1ef57f?0x0:_0x4da447['offset'];var _0x425a44=_0x1ef57f?_0x579139[_0x757b('0x1c')]:_0x4da447[_0x757b('0x19')]+_0x4da447[_0x757b('0x1a')];var _0x466dac;if(_0x425a44>=_0x31e7c8){_0x425a44=_0x31e7c8;_0x466dac=0xc8;}else{_0x466dac=0xce;}_0x30f987[_0x757b('0x17')](_0x466dac);return _0x30f987['set'](_0x757b('0x1d'),_0x9c8e18+'-'+_0x425a44+'/'+_0x31e7c8)[_0x757b('0x1e')](_0x579139);}return null;};}function patchUpdates(_0x423e38){return function(_0x34ce43){try{jsonpatch[_0x757b('0x1f')](_0x34ce43,_0x423e38,!![]);}catch(_0x18ddcd){return BPromise[_0x757b('0x20')](_0x18ddcd);}return _0x34ce43[_0x757b('0x21')]();};}function saveUpdates(_0x2733e3,_0x1ccc09){return function(_0x567767){if(_0x567767){return _0x567767[_0x757b('0x22')](_0x2733e3)[_0x757b('0x23')](function(_0x551cee){return _0x551cee;});}return null;};}function removeEntity(_0xa6f20e,_0x28a933){return function(_0x1387c3){if(_0x1387c3){return _0x1387c3[_0x757b('0x24')]()[_0x757b('0x23')](function(){_0xa6f20e[_0x757b('0x17')](0xcc)[_0x757b('0x18')]();});}};}function handleEntityNotFound(_0x54c152,_0x12f338){return function(_0x1c67ed){if(!_0x1c67ed){_0x54c152[_0x757b('0x25')](0x194);}return _0x1c67ed;};}function handleError(_0x3d092f,_0x2600c4){_0x2600c4=_0x2600c4||0x1f4;return function(_0xbc7d10){logger[_0x757b('0x26')](_0xbc7d10[_0x757b('0x27')]);if(_0xbc7d10['name']){delete _0xbc7d10[_0x757b('0x28')];}_0x3d092f[_0x757b('0x17')](_0x2600c4)['send'](_0xbc7d10);};}exports[_0x757b('0x29')]=function(_0x12c243,_0xe44c63){var _0x2e56a0={},_0x32f68a={},_0x4f178c={'count':0x0,'rows':[]};var _0x253737=_[_0x757b('0x2a')](db[_0x757b('0x2b')]['rawAttributes'],function(_0xf447e){return{'name':_0xf447e[_0x757b('0x2c')],'type':_0xf447e[_0x757b('0x2d')][_0x757b('0x2e')]};});_0x32f68a[_0x757b('0x2f')]=_['map'](_0x253737,'name');_0x32f68a[_0x757b('0x30')]=_['keys'](_0x12c243[_0x757b('0x30')]);_0x32f68a[_0x757b('0x31')]=_[_0x757b('0x32')](_0x32f68a[_0x757b('0x2f')],_0x32f68a[_0x757b('0x30')]);_0x2e56a0[_0x757b('0x33')]=_[_0x757b('0x32')](_0x32f68a['model'],qs['fields'](_0x12c243[_0x757b('0x30')][_0x757b('0x34')]));_0x2e56a0[_0x757b('0x33')]=_0x2e56a0[_0x757b('0x33')][_0x757b('0x35')]?_0x2e56a0[_0x757b('0x33')]:_0x32f68a[_0x757b('0x2f')];if(!_0x12c243[_0x757b('0x30')][_0x757b('0x36')]('nolimit')){_0x2e56a0[_0x757b('0x1a')]=qs[_0x757b('0x1a')](_0x12c243[_0x757b('0x30')]['limit']);_0x2e56a0[_0x757b('0x19')]=qs[_0x757b('0x19')](_0x12c243[_0x757b('0x30')][_0x757b('0x19')]);}_0x2e56a0[_0x757b('0x37')]=qs['sort'](_0x12c243[_0x757b('0x30')][_0x757b('0x38')]);_0x2e56a0[_0x757b('0x39')]=qs[_0x757b('0x31')](_[_0x757b('0x3a')](_0x12c243[_0x757b('0x30')],_0x32f68a[_0x757b('0x31')]),_0x253737);if(_0x12c243['query'][_0x757b('0x3b')]){_0x2e56a0[_0x757b('0x39')]=_[_0x757b('0x3c')](_0x2e56a0['where'],{'$or':_[_0x757b('0x2a')](_0x253737,function(_0x1cd0a3){if(_0x1cd0a3['type']!==_0x757b('0x3d')){var _0x968593={};_0x968593[_0x1cd0a3[_0x757b('0x28')]]={'$like':'%'+_0x12c243[_0x757b('0x30')][_0x757b('0x3b')]+'%'};return _0x968593;}})});}_0x2e56a0=_[_0x757b('0x3c')]({},_0x2e56a0,_0x12c243[_0x757b('0x3e')]);var _0x4207e1={'where':_0x2e56a0[_0x757b('0x39')]};return db[_0x757b('0x2b')][_0x757b('0x1c')](_0x4207e1)[_0x757b('0x23')](function(_0x674b47){_0x4f178c[_0x757b('0x1c')]=_0x674b47;if(_0x12c243['query'][_0x757b('0x3f')]){_0x2e56a0['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x757b('0x40')](_0x2e56a0);})[_0x757b('0x23')](function(_0x125262){_0x4f178c[_0x757b('0x41')]=_0x125262;return _0x4f178c;})[_0x757b('0x23')](respondWithFilteredResult(_0xe44c63,_0x2e56a0))[_0x757b('0x42')](handleError(_0xe44c63,null));};exports[_0x757b('0x43')]=function(_0x23be4d,_0x41504c){var _0x576291={'raw':!![],'where':{'id':_0x23be4d[_0x757b('0x44')]['id']}},_0x1b8b58={};_0x1b8b58[_0x757b('0x2f')]=_[_0x757b('0x45')](db[_0x757b('0x2b')][_0x757b('0x46')]);_0x1b8b58[_0x757b('0x30')]=_[_0x757b('0x45')](_0x23be4d[_0x757b('0x30')]);_0x1b8b58['filters']=_[_0x757b('0x32')](_0x1b8b58[_0x757b('0x2f')],_0x1b8b58[_0x757b('0x30')]);_0x576291['attributes']=_[_0x757b('0x32')](_0x1b8b58[_0x757b('0x2f')],qs[_0x757b('0x34')](_0x23be4d['query'][_0x757b('0x34')]));_0x576291[_0x757b('0x33')]=_0x576291[_0x757b('0x33')][_0x757b('0x35')]?_0x576291[_0x757b('0x33')]:_0x1b8b58[_0x757b('0x2f')];if(_0x23be4d[_0x757b('0x30')][_0x757b('0x3f')]){_0x576291['include']=[{'all':!![]}];}_0x576291=_[_0x757b('0x3c')]({},_0x576291,_0x23be4d[_0x757b('0x3e')]);return db['SugarcrmField'][_0x757b('0x47')](_0x576291)[_0x757b('0x23')](handleEntityNotFound(_0x41504c,null))[_0x757b('0x23')](respondWithResult(_0x41504c,null))[_0x757b('0x42')](handleError(_0x41504c,null));};exports[_0x757b('0x48')]=function(_0x5863ca,_0x2d9758){return db['SugarcrmField'][_0x757b('0x48')](_0x5863ca['body'],{})['then'](respondWithResult(_0x2d9758,0xc9))[_0x757b('0x42')](handleError(_0x2d9758,null));};exports['update']=function(_0x4f5e3a,_0x15b4df){if(_0x4f5e3a['body']['id']){delete _0x4f5e3a[_0x757b('0x49')]['id'];}return db[_0x757b('0x2b')]['find']({'where':{'id':_0x4f5e3a[_0x757b('0x44')]['id']}})[_0x757b('0x23')](handleEntityNotFound(_0x15b4df,null))[_0x757b('0x23')](saveUpdates(_0x4f5e3a[_0x757b('0x49')],null))[_0x757b('0x23')](respondWithResult(_0x15b4df,null))[_0x757b('0x42')](handleError(_0x15b4df,null));};exports[_0x757b('0x24')]=function(_0x235124,_0x18a8f8){return db[_0x757b('0x2b')][_0x757b('0x47')]({'where':{'id':_0x235124[_0x757b('0x44')]['id']}})[_0x757b('0x23')](handleEntityNotFound(_0x18a8f8,null))[_0x757b('0x23')](removeEntity(_0x18a8f8,null))[_0x757b('0x42')](handleError(_0x18a8f8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index fe5efff..92c58fc 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 _0x9c00=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','moment'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x9c00,0x1ec));var _0x09c0=function(_0x1fa873,_0x1319ab){_0x1fa873=_0x1fa873-0x0;var _0x599fbc=_0x9c00[_0x1fa873];return _0x599fbc;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09c0('0x3'));var config=require(_0x09c0('0x4'));var attributes=require(_0x09c0('0x5'));module[_0x09c0('0x6')]=function(_0x3292cb,_0x1925e7){return _0x3292cb['define'](_0x09c0('0x7'),attributes,{'tableName':_0x09c0('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x09c0('0x9'),_0x09c0('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9284=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5d7c9f,_0x3fa808){var _0x22f332=function(_0x8b0aeb){while(--_0x8b0aeb){_0x5d7c9f['push'](_0x5d7c9f['shift']());}};_0x22f332(++_0x3fa808);}(_0x9284,0x169));var _0x4928=function(_0x2deb66,_0xa97e73){_0x2deb66=_0x2deb66-0x0;var _0x441599=_0x9284[_0x2deb66];return _0x441599;};'use strict';var _=require(_0x4928('0x0'));var util=require(_0x4928('0x1'));var logger=require(_0x4928('0x2'))(_0x4928('0x3'));var moment=require('moment');var BPromise=require(_0x4928('0x4'));var rp=require(_0x4928('0x5'));var fs=require('fs');var path=require(_0x4928('0x6'));var rimraf=require(_0x4928('0x7'));var config=require(_0x4928('0x8'));var attributes=require(_0x4928('0x9'));module[_0x4928('0xa')]=function(_0x597e3e,_0x4c654e){return _0x597e3e[_0x4928('0xb')](_0x4928('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x4928('0xd'),'fields':[_0x4928('0xe'),_0x4928('0xf')],'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 7ad7ed5..0006502 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 _0x1061=['client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x1061,0xc5));var _0x1106=function(_0x2cb84b,_0x1eadd4){_0x2cb84b=_0x2cb84b-0x0;var _0x1ec477=_0x1061[_0x2cb84b];return _0x1ec477;};'use strict';var _=require(_0x1106('0x0'));var util=require(_0x1106('0x1'));var moment=require('moment');var BPromise=require(_0x1106('0x2'));var rs=require(_0x1106('0x3'));var fs=require('fs');var Redis=require(_0x1106('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1106('0x5'));var logger=require(_0x1106('0x6'))(_0x1106('0x7'));var config=require(_0x1106('0x8'));var jayson=require(_0x1106('0x9'));var client=jayson[_0x1106('0xa')][_0x1106('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f2156,_0x11938d,_0x158ad2){return new BPromise(function(_0x56d6f8,_0x2414ae){return client[_0x1106('0xc')](_0x4f2156,_0x158ad2)['then'](function(_0x219b3f){logger[_0x1106('0xd')](_0x1106('0xe'),_0x11938d,_0x1106('0xf'));logger[_0x1106('0x10')](_0x1106('0x11'),_0x11938d,_0x1106('0xf'),JSON[_0x1106('0x12')](_0x219b3f));if(_0x219b3f[_0x1106('0x13')]){if(_0x219b3f[_0x1106('0x13')]['code']===0x1f4){logger[_0x1106('0x13')](_0x1106('0xe'),_0x11938d,_0x219b3f[_0x1106('0x13')]['message']);return _0x2414ae(_0x219b3f['error'][_0x1106('0x14')]);}logger[_0x1106('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x11938d,_0x219b3f[_0x1106('0x13')][_0x1106('0x14')]);return _0x56d6f8(_0x219b3f['error']['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11938d,_0x1106('0xf'));_0x56d6f8(_0x219b3f[_0x1106('0x15')][_0x1106('0x14')]);}})[_0x1106('0x16')](function(_0x5ebf87){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x11938d,_0x5ebf87);_0x2414ae(_0x5ebf87);});});} \ No newline at end of file +var _0x47f8=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x367816,_0x35633c){var _0x2cdde2=function(_0x153253){while(--_0x153253){_0x367816['push'](_0x367816['shift']());}};_0x2cdde2(++_0x35633c);}(_0x47f8,0xef));var _0x847f=function(_0x3d2e68,_0x4f2cd2){_0x3d2e68=_0x3d2e68-0x0;var _0x5c8905=_0x47f8[_0x3d2e68];return _0x5c8905;};'use strict';var _=require(_0x847f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x847f('0x1'));var rs=require(_0x847f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x847f('0x3'));var logger=require(_0x847f('0x4'))(_0x847f('0x5'));var config=require(_0x847f('0x6'));var jayson=require(_0x847f('0x7'));var client=jayson[_0x847f('0x8')][_0x847f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542c1a,_0x7f6d50,_0x4f6bfa){return new BPromise(function(_0x3228cf,_0x1ddeef){return client[_0x847f('0xa')](_0x542c1a,_0x4f6bfa)[_0x847f('0xb')](function(_0x1cb2cb){logger[_0x847f('0xc')](_0x847f('0xd'),_0x7f6d50,_0x847f('0xe'));logger[_0x847f('0xf')](_0x847f('0x10'),_0x7f6d50,_0x847f('0xe'),JSON[_0x847f('0x11')](_0x1cb2cb));if(_0x1cb2cb['error']){if(_0x1cb2cb['error']['code']===0x1f4){logger[_0x847f('0x12')](_0x847f('0xd'),_0x7f6d50,_0x1cb2cb[_0x847f('0x12')][_0x847f('0x13')]);return _0x1ddeef(_0x1cb2cb[_0x847f('0x12')][_0x847f('0x13')]);}logger[_0x847f('0x12')](_0x847f('0xd'),_0x7f6d50,_0x1cb2cb[_0x847f('0x12')][_0x847f('0x13')]);return _0x3228cf(_0x1cb2cb[_0x847f('0x12')][_0x847f('0x13')]);}else{logger[_0x847f('0xc')](_0x847f('0xd'),_0x7f6d50,_0x847f('0xe'));_0x3228cf(_0x1cb2cb[_0x847f('0x14')][_0x847f('0x13')]);}})['catch'](function(_0x4b10a8){logger['error'](_0x847f('0xd'),_0x7f6d50,_0x4b10a8);_0x1ddeef(_0x4b10a8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 978a20e..70cb93b 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 _0x5c58=['Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','util','path'];(function(_0x3f1585,_0x3af590){var _0x2e1951=function(_0xb5cc20){while(--_0xb5cc20){_0x3f1585['push'](_0x3f1585['shift']());}};_0x2e1951(++_0x3af590);}(_0x5c58,0x154));var _0x85c5=function(_0x5d0e32,_0x324f39){_0x5d0e32=_0x5d0e32-0x0;var _0x3e015c=_0x5c58[_0x5d0e32];return _0x3e015c;};'use strict';var multer=require('multer');var util=require(_0x85c5('0x0'));var path=require(_0x85c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85c5('0x2')]();var fs_extra=require(_0x85c5('0x3'));var auth=require(_0x85c5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x85c5('0x5'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x85c5('0x6')](),controller['index']);router[_0x85c5('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x85c5('0x7')](_0x85c5('0x8'),auth['isAuthenticated'](),controller[_0x85c5('0x9')]);router['get'](_0x85c5('0xa'),auth[_0x85c5('0x6')](),controller[_0x85c5('0xb')]);router[_0x85c5('0xc')]('/',auth['isAuthenticated'](),controller[_0x85c5('0xd')]);router[_0x85c5('0xc')](_0x85c5('0x8'),auth[_0x85c5('0x6')](),controller[_0x85c5('0xe')]);router['put'](_0x85c5('0xf'),auth[_0x85c5('0x6')](),controller[_0x85c5('0x10')]);router[_0x85c5('0x11')](_0x85c5('0xf'),auth['isAuthenticated'](),controller[_0x85c5('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb91a=['post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields'];(function(_0xfe3ced,_0x4b75ee){var _0x39f591=function(_0x4ab355){while(--_0x4ab355){_0xfe3ced['push'](_0xfe3ced['shift']());}};_0x39f591(++_0x4b75ee);}(_0xb91a,0xf4));var _0xab91=function(_0x3e8aae,_0x1c7636){_0x3e8aae=_0x3e8aae-0x0;var _0x4cf8df=_0xb91a[_0x3e8aae];return _0x4cf8df;};'use strict';var multer=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var path=require(_0xab91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab91('0x3')]();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0xb')]);router[_0xab91('0x9')]('/:id',auth[_0xab91('0xa')](),controller[_0xab91('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xab91('0xd')]);router[_0xab91('0x9')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0xf')]);router[_0xab91('0x10')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0x11')]);router[_0xab91('0x10')](_0xab91('0x12'),auth[_0xab91('0xa')](),controller[_0xab91('0x13')]);router[_0xab91('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xab91('0x15')]);router[_0xab91('0x16')](_0xab91('0x17'),auth[_0xab91('0xa')](),controller[_0xab91('0x18')]);module[_0xab91('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 331321e..2fab131 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 _0xa407=['sequelize','STRING','HelpDesk'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa407,0x1aa));var _0x7a40=function(_0x27e32e,_0x545899){_0x27e32e=_0x27e32e-0x0;var _0x3fbac7=_0xa407[_0x27e32e];return _0x3fbac7;};'use strict';var Sequelize=require(_0x7a40('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a40('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7a40('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7a40('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7a40('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7a40('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xea35=['HelpDesk','sequelize','exports','STRING'];(function(_0x2cb633,_0x5caee0){var _0x4b1a20=function(_0x4ea50f){while(--_0x4ea50f){_0x2cb633['push'](_0x2cb633['shift']());}};_0x4b1a20(++_0x5caee0);}(_0xea35,0xbd));var _0x5ea3=function(_0x194eba,_0x2d3927){_0x194eba=_0x194eba-0x0;var _0x1a2495=_0xea35[_0x194eba];return _0x1a2495;};'use strict';var Sequelize=require(_0x5ea3('0x0'));module[_0x5ea3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5ea3('0x2')]},'username':{'type':Sequelize[_0x5ea3('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5ea3('0x2')],'allowNull':![],'defaultValue':_0x5ea3('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5ea3('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5ea3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 0913f00..1f573cc 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 _0xe37c=['type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','create','body','catch','find','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','result','sessionName','autogenerated','reference','owner','remove','includes','editable','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VtigerAccount','rawAttributes'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xe37c,0x144));var _0xce37=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xe37c[_0x1a7846];return _0x48049;};'use strict';var emlformat=require(_0xce37('0x0'));var rimraf=require(_0xce37('0x1'));var zipdir=require(_0xce37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce37('0x3'));var moment=require('moment');var BPromise=require(_0xce37('0x4'));var Mustache=require(_0xce37('0x5'));var util=require(_0xce37('0x6'));var path=require(_0xce37('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce37('0x8'));var _=require(_0xce37('0x9'));var squel=require(_0xce37('0xa'));var crypto=require(_0xce37('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xce37('0xc'));var toCsv=require(_0xce37('0xd'));var querystring=require(_0xce37('0xe'));var Papa=require(_0xce37('0xf'));var Redis=require(_0xce37('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xce37('0x11'));var as=require(_0xce37('0x12'));var hardwareService=require(_0xce37('0x13'));var logger=require(_0xce37('0x14'))(_0xce37('0x15'));var utils=require(_0xce37('0x16'));var config=require(_0xce37('0x17'));var licenseUtil=require(_0xce37('0x18'));var db=require(_0xce37('0x19'))['db'];var integrations=require(_0xce37('0x1a'));function respondWithStatusCode(_0x2f6428,_0x27f292){_0x27f292=_0x27f292||0xcc;return function(_0x1e9120){if(_0x1e9120){return _0x2f6428['sendStatus'](_0x27f292);}return _0x2f6428[_0xce37('0x1b')](_0x27f292)['end']();};}function respondWithResult(_0x8988d9,_0x3e2b0b){_0x3e2b0b=_0x3e2b0b||0xc8;return function(_0x357a44){if(_0x357a44){return _0x8988d9[_0xce37('0x1b')](_0x3e2b0b)[_0xce37('0x1c')](_0x357a44);}};}function respondWithFilteredResult(_0x290f54,_0x43fa55){return function(_0x205d5a){if(_0x205d5a){var _0x749be=typeof _0x43fa55[_0xce37('0x1d')]===_0xce37('0x1e')&&typeof _0x43fa55[_0xce37('0x1f')]===_0xce37('0x1e');var _0x45c883=_0x205d5a['count'];var _0x310c41=_0x749be?0x0:_0x43fa55['offset'];var _0x1ac870=_0x749be?_0x205d5a['count']:_0x43fa55['offset']+_0x43fa55['limit'];var _0x3009ac;if(_0x1ac870>=_0x45c883){_0x1ac870=_0x45c883;_0x3009ac=0xc8;}else{_0x3009ac=0xce;}_0x290f54[_0xce37('0x1b')](_0x3009ac);return _0x290f54['set'](_0xce37('0x20'),_0x310c41+'-'+_0x1ac870+'/'+_0x45c883)[_0xce37('0x1c')](_0x205d5a);}return null;};}function patchUpdates(_0x543281){return function(_0x199791){try{jsonpatch[_0xce37('0x21')](_0x199791,_0x543281,!![]);}catch(_0x57e685){return BPromise[_0xce37('0x22')](_0x57e685);}return _0x199791['save']();};}function saveUpdates(_0x5acca2,_0x515dae){return function(_0x182b39){if(_0x182b39){return _0x182b39[_0xce37('0x23')](_0x5acca2)[_0xce37('0x24')](function(_0x310bd8){return _0x310bd8;});}return null;};}function removeEntity(_0x20d88d,_0x1bd1a3){return function(_0x28d1ba){if(_0x28d1ba){return _0x28d1ba[_0xce37('0x25')]()['then'](function(){_0x20d88d['status'](0xcc)[_0xce37('0x26')]();});}};}function handleEntityNotFound(_0x3f519c,_0x446dab){return function(_0x2ab9e2){if(!_0x2ab9e2){_0x3f519c[_0xce37('0x27')](0x194);}return _0x2ab9e2;};}function handleError(_0x2a695c,_0x3294b4){_0x3294b4=_0x3294b4||0x1f4;return function(_0x43e037){logger[_0xce37('0x28')](_0x43e037[_0xce37('0x29')]);if(_0x43e037['name']){delete _0x43e037[_0xce37('0x2a')];}_0x2a695c['status'](_0x3294b4)[_0xce37('0x2b')](_0x43e037);};}exports[_0xce37('0x2c')]=function(_0xef7e01,_0x9cbf93){var _0x25478a={},_0x1a0898={},_0x5dc2ea={'count':0x0,'rows':[]};var _0x2b1dc8=_[_0xce37('0x2d')](db[_0xce37('0x2e')][_0xce37('0x2f')],function(_0x29d6a8){return{'name':_0x29d6a8['fieldName'],'type':_0x29d6a8[_0xce37('0x30')][_0xce37('0x31')]};});_0x1a0898['model']=_['map'](_0x2b1dc8,'name');_0x1a0898[_0xce37('0x32')]=_[_0xce37('0x33')](_0xef7e01[_0xce37('0x32')]);_0x1a0898[_0xce37('0x34')]=_[_0xce37('0x35')](_0x1a0898[_0xce37('0x36')],_0x1a0898['query']);_0x25478a['attributes']=_[_0xce37('0x35')](_0x1a0898['model'],qs[_0xce37('0x37')](_0xef7e01[_0xce37('0x32')][_0xce37('0x37')]));_0x25478a[_0xce37('0x38')]=_0x25478a[_0xce37('0x38')][_0xce37('0x39')]?_0x25478a[_0xce37('0x38')]:_0x1a0898['model'];if(!_0xef7e01['query'][_0xce37('0x3a')](_0xce37('0x3b'))){_0x25478a[_0xce37('0x1f')]=qs[_0xce37('0x1f')](_0xef7e01['query'][_0xce37('0x1f')]);_0x25478a[_0xce37('0x1d')]=qs['offset'](_0xef7e01[_0xce37('0x32')]['offset']);}_0x25478a[_0xce37('0x3c')]=qs[_0xce37('0x3d')](_0xef7e01[_0xce37('0x32')][_0xce37('0x3d')]);_0x25478a[_0xce37('0x3e')]=qs[_0xce37('0x34')](_[_0xce37('0x3f')](_0xef7e01[_0xce37('0x32')],_0x1a0898[_0xce37('0x34')]),_0x2b1dc8);if(_0xef7e01[_0xce37('0x32')][_0xce37('0x40')]){_0x25478a['where']=_[_0xce37('0x41')](_0x25478a[_0xce37('0x3e')],{'$or':_['map'](_0x2b1dc8,function(_0x17084d){if(_0x17084d[_0xce37('0x30')]!==_0xce37('0x42')){var _0x10565c={};_0x10565c[_0x17084d[_0xce37('0x2a')]]={'$like':'%'+_0xef7e01[_0xce37('0x32')][_0xce37('0x40')]+'%'};return _0x10565c;}})});}_0x25478a=_[_0xce37('0x41')]({},_0x25478a,_0xef7e01[_0xce37('0x43')]);var _0x20f846={'where':_0x25478a['where']};return db[_0xce37('0x2e')][_0xce37('0x44')](_0x20f846)['then'](function(_0x4b879d){_0x5dc2ea[_0xce37('0x44')]=_0x4b879d;if(_0xef7e01['query'][_0xce37('0x45')]){_0x25478a[_0xce37('0x46')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x25478a);})['then'](function(_0x5b37ff){_0x5dc2ea[_0xce37('0x47')]=_0x5b37ff;return _0x5dc2ea;})[_0xce37('0x24')](respondWithFilteredResult(_0x9cbf93,_0x25478a))['catch'](handleError(_0x9cbf93,null));};exports[_0xce37('0x48')]=function(_0x2c53a2,_0xa93359){var _0x118bb8={'raw':![],'where':{'id':_0x2c53a2[_0xce37('0x49')]['id']}},_0x1576c8={};_0x1576c8[_0xce37('0x36')]=_[_0xce37('0x33')](db[_0xce37('0x2e')][_0xce37('0x2f')]);_0x1576c8[_0xce37('0x32')]=_[_0xce37('0x33')](_0x2c53a2[_0xce37('0x32')]);_0x1576c8[_0xce37('0x34')]=_[_0xce37('0x35')](_0x1576c8[_0xce37('0x36')],_0x1576c8[_0xce37('0x32')]);_0x118bb8[_0xce37('0x38')]=_[_0xce37('0x35')](_0x1576c8[_0xce37('0x36')],qs[_0xce37('0x37')](_0x2c53a2[_0xce37('0x32')][_0xce37('0x37')]));_0x118bb8['attributes']=_0x118bb8[_0xce37('0x38')]['length']?_0x118bb8[_0xce37('0x38')]:_0x1576c8[_0xce37('0x36')];if(_0x2c53a2[_0xce37('0x32')][_0xce37('0x45')]){_0x118bb8['include']=[{'all':!![]}];}_0x118bb8=_['merge']({},_0x118bb8,_0x2c53a2[_0xce37('0x43')]);return db[_0xce37('0x2e')]['find'](_0x118bb8)[_0xce37('0x24')](handleEntityNotFound(_0xa93359,null))[_0xce37('0x24')](respondWithResult(_0xa93359,null))['catch'](handleError(_0xa93359,null));};exports[_0xce37('0x4a')]=function(_0x2ef19f,_0x799bb3){return db[_0xce37('0x2e')][_0xce37('0x4a')](_0x2ef19f[_0xce37('0x4b')],{})[_0xce37('0x24')](respondWithResult(_0x799bb3,0xc9))[_0xce37('0x4c')](handleError(_0x799bb3,null));};exports['update']=function(_0x465289,_0x5a2efb){if(_0x465289[_0xce37('0x4b')]['id']){delete _0x465289[_0xce37('0x4b')]['id'];}return db[_0xce37('0x2e')]['find']({'where':{'id':_0x465289[_0xce37('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a2efb,null))[_0xce37('0x24')](saveUpdates(_0x465289[_0xce37('0x4b')],null))[_0xce37('0x24')](respondWithResult(_0x5a2efb,null))[_0xce37('0x4c')](handleError(_0x5a2efb,null));};exports[_0xce37('0x25')]=function(_0x165f5b,_0x13b178){return db['VtigerAccount'][_0xce37('0x4d')]({'where':{'id':_0x165f5b['params']['id']}})[_0xce37('0x24')](handleEntityNotFound(_0x13b178,null))[_0xce37('0x24')](removeEntity(_0x13b178,null))[_0xce37('0x4c')](handleError(_0x13b178,null));};exports[_0xce37('0x4e')]=function(_0x499e61,_0x3f5627,_0x1f9bb2){var _0x16b612={};var _0x2ebecf={};var _0x15313f;var _0x594d2e;return db[_0xce37('0x2e')][_0xce37('0x4f')]({'where':{'id':_0x499e61[_0xce37('0x49')]['id']}})[_0xce37('0x24')](handleEntityNotFound(_0x3f5627,null))[_0xce37('0x24')](function(_0x340af2){if(_0x340af2){_0x15313f=_0x340af2;_0x2ebecf[_0xce37('0x36')]=_['keys'](db[_0xce37('0x50')][_0xce37('0x2f')]);_0x2ebecf[_0xce37('0x32')]=_[_0xce37('0x33')](_0x499e61[_0xce37('0x32')]);_0x2ebecf['filters']=_['intersection'](_0x2ebecf[_0xce37('0x36')],_0x2ebecf[_0xce37('0x32')]);_0x16b612['attributes']=_[_0xce37('0x35')](_0x2ebecf[_0xce37('0x36')],qs[_0xce37('0x37')](_0x499e61[_0xce37('0x32')][_0xce37('0x37')]));_0x16b612[_0xce37('0x38')]=_0x16b612[_0xce37('0x38')][_0xce37('0x39')]?_0x16b612[_0xce37('0x38')]:_0x2ebecf[_0xce37('0x36')];_0x16b612[_0xce37('0x3c')]=qs['sort'](_0x499e61['query'][_0xce37('0x3d')]);_0x16b612[_0xce37('0x3e')]=qs[_0xce37('0x34')](_[_0xce37('0x3f')](_0x499e61['query'],_0x2ebecf['filters']));if(_0x499e61[_0xce37('0x32')]['filter']){_0x16b612[_0xce37('0x3e')]=_[_0xce37('0x41')](_0x16b612[_0xce37('0x3e')],{'$or':_[_0xce37('0x2d')](_0x16b612[_0xce37('0x38')],function(_0xc082d6){var _0x1edf56={};_0x1edf56[_0xc082d6]={'$like':'%'+_0x499e61[_0xce37('0x32')][_0xce37('0x40')]+'%'};return _0x1edf56;})});}_0x16b612=_[_0xce37('0x41')]({},_0x16b612,_0x499e61[_0xce37('0x43')]);return _0x15313f[_0xce37('0x4e')](_0x16b612);}})['then'](function(_0x11cc84){if(_0x11cc84){_0x594d2e=_0x11cc84[_0xce37('0x39')];if(!_0x499e61['query'][_0xce37('0x3a')](_0xce37('0x3b'))){_0x16b612[_0xce37('0x1f')]=qs[_0xce37('0x1f')](_0x499e61[_0xce37('0x32')][_0xce37('0x1f')]);_0x16b612['offset']=qs[_0xce37('0x1d')](_0x499e61[_0xce37('0x32')][_0xce37('0x1d')]);}return _0x15313f[_0xce37('0x4e')](_0x16b612);}})[_0xce37('0x24')](function(_0x4d4294){if(_0x4d4294){return _0x4d4294?{'count':_0x594d2e,'rows':_0x4d4294}:null;}})['then'](respondWithResult(_0x3f5627,null))[_0xce37('0x4c')](handleError(_0x3f5627,null));};exports['addConfiguration']=function(_0x42e068,_0x519739,_0x289b92){if(_0x42e068[_0xce37('0x4b')]['id']){delete _0x42e068[_0xce37('0x4b')]['id'];}return db['VtigerAccount'][_0xce37('0x4f')]({'where':{'id':_0x42e068[_0xce37('0x49')]['id']}})[_0xce37('0x24')](handleEntityNotFound(_0x519739,null))[_0xce37('0x24')](function(_0x1944d3){if(_0x1944d3){_0x42e068[_0xce37('0x4b')][_0xce37('0x51')]=_0x1944d3['id'];_0x42e068[_0xce37('0x4b')][_0xce37('0x52')]=integrations[_0xce37('0x53')](_0x42e068['body'][_0xce37('0x54')],_0x42e068['body'][_0xce37('0x30')]);_0x42e068[_0xce37('0x4b')][_0xce37('0x55')]=integrations[_0xce37('0x56')](_0x42e068[_0xce37('0x4b')][_0xce37('0x54')],_0x42e068[_0xce37('0x4b')]['type']);return db[_0xce37('0x50')][_0xce37('0x4a')](_0x42e068[_0xce37('0x4b')],{'include':[{'model':db[_0xce37('0x57')],'as':_0xce37('0x52')},{'model':db[_0xce37('0x57')],'as':'Descriptions'}]});}return null;})[_0xce37('0x24')](respondWithResult(_0x519739,null))['catch'](handleError(_0x519739,null));};var md5=require(_0xce37('0x58'));exports[_0xce37('0x59')]=function(_0x2a47e9,_0x30d64b,_0x1d00d8){var _0xf4bd31=null;var _0x208b65=null;var _0x10a87e=null;var _0x4b4cd0=null;var _0x7bdb2b='';return db[_0xce37('0x2e')][_0xce37('0x4f')]({'where':{'id':_0x2a47e9[_0xce37('0x49')]['id']},'attributes':['id',_0xce37('0x2a'),_0xce37('0x5a'),'description',_0xce37('0x5b'),_0xce37('0x5c'),_0xce37('0x5d'),_0xce37('0x5e')]})['then'](handleEntityNotFound(_0x30d64b,null))[_0xce37('0x24')](function(_0x4c5376){if(_0x4c5376){_0xf4bd31=_0x4c5376[_0xce37('0x5a')];_0x208b65=_0x4c5376[_0xce37('0x5e')];_0x10a87e=_0x4c5376['moduleName'];_0x7bdb2b=_0x4c5376[_0xce37('0x5c')];var _0x544ebf=_0x7bdb2b[_0xce37('0x5f')](-0x1);if(_0x544ebf==='/'){_0x7bdb2b=_0x7bdb2b[_0xce37('0x60')](0x0,_0x7bdb2b[_0xce37('0x61')](_0x544ebf));}_0x4b4cd0=util['format'](_0xce37('0x62'),_0x7bdb2b);var _0x17eb62={'method':_0xce37('0x63'),'uri':_0x4b4cd0,'qs':{'operation':_0xce37('0x64'),'username':_0x4c5376[_0xce37('0x5a')]},'json':!![]};return rp(_0x17eb62);}})[_0xce37('0x24')](function(_0xf279f5){if(_0xf279f5[_0xce37('0x65')]){var _0x165ed0={'method':_0xce37('0x66'),'uri':_0x4b4cd0,'form':{'operation':_0xce37('0x67'),'username':_0xf4bd31,'accessKey':md5(_0xf279f5[_0xce37('0x68')]['token']+_0x208b65)},'json':!![]};return rp(_0x165ed0);}})[_0xce37('0x24')](function(_0x5845e3){if(_0x5845e3['success']){var _0x475056={'method':_0xce37('0x63'),'uri':_0x4b4cd0,'qs':{'operation':'describe','username':_0xf4bd31,'sessionName':_0x5845e3[_0xce37('0x68')][_0xce37('0x69')],'elementType':_0x10a87e},'json':!![]};return rp(_0x475056);}})['then'](function(_0xe81e31){if(_0xe81e31[_0xce37('0x65')]){var _0x40987c=[_0xce37('0x6a'),_0xce37('0x6b'),_0xce37('0x6c')];_[_0xce37('0x6d')](_0xe81e31[_0xce37('0x68')][_0xce37('0x37')],function(_0x38b2ff){return _0x40987c[_0xce37('0x6e')](_0x38b2ff[_0xce37('0x30')][_0xce37('0x2a')]);});_['remove'](_0xe81e31[_0xce37('0x68')][_0xce37('0x37')],function(_0xce7c21){return _0xce7c21[_0xce37('0x6f')]==='false';});return{'count':_0xe81e31[_0xce37('0x68')]['fields'][_0xce37('0x39')],'rows':_['map'](_0xe81e31[_0xce37('0x68')]['fields'],function(_0x231475){return{'id':_0x231475['name'],'name':_0x231475[_0xce37('0x70')],'custom':_['startsWith'](_0x231475[_0xce37('0x2a')],_0xce37('0x71'))?!![]:![],'options':_0x231475[_0xce37('0x30')][_0xce37('0x2a')]===_0xce37('0x72')&&_0x231475['type'][_0xce37('0x73')][_0xce37('0x39')]>0x0?_[_0xce37('0x2d')](_0x231475[_0xce37('0x30')][_0xce37('0x73')],function(_0x1ff1b8){return{'name':_0x1ff1b8['label'],'value':_0x1ff1b8[_0xce37('0x74')]};}):[]};})};}})[_0xce37('0x24')](respondWithResult(_0x30d64b,null))[_0xce37('0x4c')](function(_0xc7363){console[_0xce37('0x75')](_0xce37('0x76')+_0xc7363);var _0x58f828=_0x2a47e9[_0xce37('0x32')][_0xce37('0x77')]?0x1f4:_0xc7363[_0xce37('0x78')]||0x1f4;logger[_0xce37('0x28')](_0xce37('0x79'),_0xce37('0x59'),_0x58f828,JSON[_0xce37('0x7a')](_0xc7363));delete _0xc7363[_0xce37('0x2a')];if(_0x58f828===0x191){_0x58f828=0x190;}_0x30d64b[_0xce37('0x1b')](_0x58f828)[_0xce37('0x2b')](_0x2a47e9[_0xce37('0x32')][_0xce37('0x77')]?{'message':_0xce37('0x7b'),'statusCode':_0xc7363[_0xce37('0x78')]}:_0xc7363);});}; \ No newline at end of file +var _0xbc8f=['apply','save','update','destroy','then','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerAccount','count','include','findAll','rawAttributes','includeAll','find','catch','create','body','params','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','success','POST','login','result','token','describe','sessionName','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range'];(function(_0x353445,_0x485d25){var _0x18717b=function(_0x5d77af){while(--_0x5d77af){_0x353445['push'](_0x353445['shift']());}};_0x18717b(++_0x485d25);}(_0xbc8f,0x146));var _0xfbc8=function(_0x340a9e,_0x2ef9a1){_0x340a9e=_0x340a9e-0x0;var _0xd65e2a=_0xbc8f[_0x340a9e];return _0xd65e2a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfbc8('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfbc8('0x1'));var Mustache=require('mustache');var util=require(_0xfbc8('0x2'));var path=require(_0xfbc8('0x3'));var sox=require(_0xfbc8('0x4'));var csv=require(_0xfbc8('0x5'));var ejs=require(_0xfbc8('0x6'));var fs=require('fs');var fs_extra=require(_0xfbc8('0x7'));var _=require(_0xfbc8('0x8'));var squel=require(_0xfbc8('0x9'));var crypto=require('crypto');var jsforce=require(_0xfbc8('0xa'));var deskjs=require(_0xfbc8('0xb'));var toCsv=require(_0xfbc8('0x5'));var querystring=require(_0xfbc8('0xc'));var Papa=require(_0xfbc8('0xd'));var Redis=require(_0xfbc8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfbc8('0xf'));var as=require(_0xfbc8('0x10'));var hardwareService=require(_0xfbc8('0x11'));var logger=require(_0xfbc8('0x12'))(_0xfbc8('0x13'));var utils=require(_0xfbc8('0x14'));var config=require(_0xfbc8('0x15'));var licenseUtil=require(_0xfbc8('0x16'));var db=require(_0xfbc8('0x17'))['db'];var integrations=require(_0xfbc8('0x18'));function respondWithStatusCode(_0x5aaebf,_0x5985b8){_0x5985b8=_0x5985b8||0xcc;return function(_0x5812e3){if(_0x5812e3){return _0x5aaebf[_0xfbc8('0x19')](_0x5985b8);}return _0x5aaebf[_0xfbc8('0x1a')](_0x5985b8)[_0xfbc8('0x1b')]();};}function respondWithResult(_0x4700ec,_0x30dc55){_0x30dc55=_0x30dc55||0xc8;return function(_0x442e6b){if(_0x442e6b){return _0x4700ec['status'](_0x30dc55)[_0xfbc8('0x1c')](_0x442e6b);}};}function respondWithFilteredResult(_0x3b59a6,_0x561377){return function(_0x54a652){if(_0x54a652){var _0x11da70=typeof _0x561377[_0xfbc8('0x1d')]===_0xfbc8('0x1e')&&typeof _0x561377[_0xfbc8('0x1f')]===_0xfbc8('0x1e');var _0x812533=_0x54a652['count'];var _0x56b178=_0x11da70?0x0:_0x561377[_0xfbc8('0x1d')];var _0x150834=_0x11da70?_0x54a652['count']:_0x561377[_0xfbc8('0x1d')]+_0x561377[_0xfbc8('0x1f')];var _0x4d7d4d;if(_0x150834>=_0x812533){_0x150834=_0x812533;_0x4d7d4d=0xc8;}else{_0x4d7d4d=0xce;}_0x3b59a6[_0xfbc8('0x1a')](_0x4d7d4d);return _0x3b59a6[_0xfbc8('0x20')](_0xfbc8('0x21'),_0x56b178+'-'+_0x150834+'/'+_0x812533)['json'](_0x54a652);}return null;};}function patchUpdates(_0x17d1a0){return function(_0x44f500){try{jsonpatch[_0xfbc8('0x22')](_0x44f500,_0x17d1a0,!![]);}catch(_0x5621b3){return BPromise['reject'](_0x5621b3);}return _0x44f500[_0xfbc8('0x23')]();};}function saveUpdates(_0x3df9ee,_0x9137b0){return function(_0x3811d4){if(_0x3811d4){return _0x3811d4[_0xfbc8('0x24')](_0x3df9ee)['then'](function(_0x56c16d){return _0x56c16d;});}return null;};}function removeEntity(_0x27ec54,_0x5a855e){return function(_0xd55bd4){if(_0xd55bd4){return _0xd55bd4[_0xfbc8('0x25')]()[_0xfbc8('0x26')](function(){_0x27ec54[_0xfbc8('0x1a')](0xcc)[_0xfbc8('0x1b')]();});}};}function handleEntityNotFound(_0x324e39,_0x12ab46){return function(_0x4e4327){if(!_0x4e4327){_0x324e39['sendStatus'](0x194);}return _0x4e4327;};}function handleError(_0x26e93d,_0x3d7c5f){_0x3d7c5f=_0x3d7c5f||0x1f4;return function(_0x43b6ed){logger['error'](_0x43b6ed['stack']);if(_0x43b6ed['name']){delete _0x43b6ed[_0xfbc8('0x27')];}_0x26e93d[_0xfbc8('0x1a')](_0x3d7c5f)[_0xfbc8('0x28')](_0x43b6ed);};}exports[_0xfbc8('0x29')]=function(_0x5cf056,_0x7ed6d6){var _0x5601df={},_0x553bfb={},_0x18976b={'count':0x0,'rows':[]};var _0x3e8482=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x1b17d7){return{'name':_0x1b17d7[_0xfbc8('0x2a')],'type':_0x1b17d7[_0xfbc8('0x2b')][_0xfbc8('0x2c')]};});_0x553bfb[_0xfbc8('0x2d')]=_[_0xfbc8('0x2e')](_0x3e8482,'name');_0x553bfb['query']=_[_0xfbc8('0x2f')](_0x5cf056[_0xfbc8('0x30')]);_0x553bfb[_0xfbc8('0x31')]=_[_0xfbc8('0x32')](_0x553bfb['model'],_0x553bfb[_0xfbc8('0x30')]);_0x5601df['attributes']=_[_0xfbc8('0x32')](_0x553bfb[_0xfbc8('0x2d')],qs[_0xfbc8('0x33')](_0x5cf056['query'][_0xfbc8('0x33')]));_0x5601df['attributes']=_0x5601df['attributes'][_0xfbc8('0x34')]?_0x5601df[_0xfbc8('0x35')]:_0x553bfb[_0xfbc8('0x2d')];if(!_0x5cf056[_0xfbc8('0x30')][_0xfbc8('0x36')](_0xfbc8('0x37'))){_0x5601df[_0xfbc8('0x1f')]=qs['limit'](_0x5cf056[_0xfbc8('0x30')]['limit']);_0x5601df[_0xfbc8('0x1d')]=qs[_0xfbc8('0x1d')](_0x5cf056['query'][_0xfbc8('0x1d')]);}_0x5601df[_0xfbc8('0x38')]=qs[_0xfbc8('0x39')](_0x5cf056[_0xfbc8('0x30')][_0xfbc8('0x39')]);_0x5601df[_0xfbc8('0x3a')]=qs['filters'](_[_0xfbc8('0x3b')](_0x5cf056[_0xfbc8('0x30')],_0x553bfb[_0xfbc8('0x31')]),_0x3e8482);if(_0x5cf056[_0xfbc8('0x30')][_0xfbc8('0x3c')]){_0x5601df[_0xfbc8('0x3a')]=_[_0xfbc8('0x3d')](_0x5601df['where'],{'$or':_[_0xfbc8('0x2e')](_0x3e8482,function(_0x69c857){if(_0x69c857[_0xfbc8('0x2b')]!==_0xfbc8('0x3e')){var _0x5b3941={};_0x5b3941[_0x69c857[_0xfbc8('0x27')]]={'$like':'%'+_0x5cf056['query'][_0xfbc8('0x3c')]+'%'};return _0x5b3941;}})});}_0x5601df=_['merge']({},_0x5601df,_0x5cf056[_0xfbc8('0x3f')]);var _0x284170={'where':_0x5601df['where']};return db[_0xfbc8('0x40')][_0xfbc8('0x41')](_0x284170)[_0xfbc8('0x26')](function(_0x3a0535){_0x18976b[_0xfbc8('0x41')]=_0x3a0535;if(_0x5cf056[_0xfbc8('0x30')]['includeAll']){_0x5601df[_0xfbc8('0x42')]=[{'all':!![]}];}return db[_0xfbc8('0x40')][_0xfbc8('0x43')](_0x5601df);})[_0xfbc8('0x26')](function(_0x310c4a){_0x18976b['rows']=_0x310c4a;return _0x18976b;})[_0xfbc8('0x26')](respondWithFilteredResult(_0x7ed6d6,_0x5601df))['catch'](handleError(_0x7ed6d6,null));};exports['show']=function(_0x3a4ea8,_0xb2b674){var _0x3aadaf={'raw':![],'where':{'id':_0x3a4ea8['params']['id']}},_0x35751c={};_0x35751c['model']=_[_0xfbc8('0x2f')](db[_0xfbc8('0x40')][_0xfbc8('0x44')]);_0x35751c['query']=_[_0xfbc8('0x2f')](_0x3a4ea8['query']);_0x35751c[_0xfbc8('0x31')]=_[_0xfbc8('0x32')](_0x35751c[_0xfbc8('0x2d')],_0x35751c[_0xfbc8('0x30')]);_0x3aadaf[_0xfbc8('0x35')]=_['intersection'](_0x35751c[_0xfbc8('0x2d')],qs[_0xfbc8('0x33')](_0x3a4ea8[_0xfbc8('0x30')][_0xfbc8('0x33')]));_0x3aadaf[_0xfbc8('0x35')]=_0x3aadaf[_0xfbc8('0x35')]['length']?_0x3aadaf[_0xfbc8('0x35')]:_0x35751c[_0xfbc8('0x2d')];if(_0x3a4ea8['query'][_0xfbc8('0x45')]){_0x3aadaf[_0xfbc8('0x42')]=[{'all':!![]}];}_0x3aadaf=_['merge']({},_0x3aadaf,_0x3a4ea8[_0xfbc8('0x3f')]);return db[_0xfbc8('0x40')][_0xfbc8('0x46')](_0x3aadaf)[_0xfbc8('0x26')](handleEntityNotFound(_0xb2b674,null))[_0xfbc8('0x26')](respondWithResult(_0xb2b674,null))[_0xfbc8('0x47')](handleError(_0xb2b674,null));};exports[_0xfbc8('0x48')]=function(_0x4122c0,_0x5cf2c4){return db['VtigerAccount'][_0xfbc8('0x48')](_0x4122c0[_0xfbc8('0x49')],{})[_0xfbc8('0x26')](respondWithResult(_0x5cf2c4,0xc9))[_0xfbc8('0x47')](handleError(_0x5cf2c4,null));};exports[_0xfbc8('0x24')]=function(_0x9835ff,_0x45482a){if(_0x9835ff[_0xfbc8('0x49')]['id']){delete _0x9835ff[_0xfbc8('0x49')]['id'];}return db['VtigerAccount'][_0xfbc8('0x46')]({'where':{'id':_0x9835ff[_0xfbc8('0x4a')]['id']}})[_0xfbc8('0x26')](handleEntityNotFound(_0x45482a,null))['then'](saveUpdates(_0x9835ff[_0xfbc8('0x49')],null))[_0xfbc8('0x26')](respondWithResult(_0x45482a,null))[_0xfbc8('0x47')](handleError(_0x45482a,null));};exports[_0xfbc8('0x25')]=function(_0x8f47a1,_0xe285f2){return db[_0xfbc8('0x40')][_0xfbc8('0x46')]({'where':{'id':_0x8f47a1[_0xfbc8('0x4a')]['id']}})[_0xfbc8('0x26')](handleEntityNotFound(_0xe285f2,null))[_0xfbc8('0x26')](removeEntity(_0xe285f2,null))[_0xfbc8('0x47')](handleError(_0xe285f2,null));};exports[_0xfbc8('0x4b')]=function(_0x3546c0,_0x23712b,_0x10a6aa){var _0x10f52b={};var _0x124778={};var _0x3ede2c;var _0x4962cb;return db[_0xfbc8('0x40')][_0xfbc8('0x4c')]({'where':{'id':_0x3546c0[_0xfbc8('0x4a')]['id']}})[_0xfbc8('0x26')](handleEntityNotFound(_0x23712b,null))[_0xfbc8('0x26')](function(_0xd8aa75){if(_0xd8aa75){_0x3ede2c=_0xd8aa75;_0x124778['model']=_[_0xfbc8('0x2f')](db[_0xfbc8('0x4d')][_0xfbc8('0x44')]);_0x124778['query']=_[_0xfbc8('0x2f')](_0x3546c0[_0xfbc8('0x30')]);_0x124778[_0xfbc8('0x31')]=_[_0xfbc8('0x32')](_0x124778[_0xfbc8('0x2d')],_0x124778['query']);_0x10f52b[_0xfbc8('0x35')]=_['intersection'](_0x124778[_0xfbc8('0x2d')],qs['fields'](_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x33')]));_0x10f52b['attributes']=_0x10f52b[_0xfbc8('0x35')][_0xfbc8('0x34')]?_0x10f52b['attributes']:_0x124778[_0xfbc8('0x2d')];_0x10f52b[_0xfbc8('0x38')]=qs[_0xfbc8('0x39')](_0x3546c0[_0xfbc8('0x30')]['sort']);_0x10f52b['where']=qs[_0xfbc8('0x31')](_['pick'](_0x3546c0[_0xfbc8('0x30')],_0x124778[_0xfbc8('0x31')]));if(_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x3c')]){_0x10f52b[_0xfbc8('0x3a')]=_[_0xfbc8('0x3d')](_0x10f52b['where'],{'$or':_['map'](_0x10f52b[_0xfbc8('0x35')],function(_0x26bd22){var _0x11919b={};_0x11919b[_0x26bd22]={'$like':'%'+_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x3c')]+'%'};return _0x11919b;})});}_0x10f52b=_[_0xfbc8('0x3d')]({},_0x10f52b,_0x3546c0[_0xfbc8('0x3f')]);return _0x3ede2c[_0xfbc8('0x4b')](_0x10f52b);}})[_0xfbc8('0x26')](function(_0x1b4904){if(_0x1b4904){_0x4962cb=_0x1b4904[_0xfbc8('0x34')];if(!_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x36')](_0xfbc8('0x37'))){_0x10f52b[_0xfbc8('0x1f')]=qs[_0xfbc8('0x1f')](_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x1f')]);_0x10f52b['offset']=qs[_0xfbc8('0x1d')](_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x1d')]);}return _0x3ede2c[_0xfbc8('0x4b')](_0x10f52b);}})[_0xfbc8('0x26')](function(_0xad61b0){if(_0xad61b0){return _0xad61b0?{'count':_0x4962cb,'rows':_0xad61b0}:null;}})[_0xfbc8('0x26')](respondWithResult(_0x23712b,null))['catch'](handleError(_0x23712b,null));};exports[_0xfbc8('0x4e')]=function(_0x1f23e0,_0x212d2e,_0x59d7d1){if(_0x1f23e0[_0xfbc8('0x49')]['id']){delete _0x1f23e0[_0xfbc8('0x49')]['id'];}return db[_0xfbc8('0x40')][_0xfbc8('0x4c')]({'where':{'id':_0x1f23e0[_0xfbc8('0x4a')]['id']}})[_0xfbc8('0x26')](handleEntityNotFound(_0x212d2e,null))['then'](function(_0x3a90f9){if(_0x3a90f9){_0x1f23e0[_0xfbc8('0x49')][_0xfbc8('0x4f')]=_0x3a90f9['id'];_0x1f23e0[_0xfbc8('0x49')]['Subjects']=integrations[_0xfbc8('0x50')](_0x1f23e0[_0xfbc8('0x49')][_0xfbc8('0x51')],_0x1f23e0['body'][_0xfbc8('0x2b')]);_0x1f23e0['body'][_0xfbc8('0x52')]=integrations[_0xfbc8('0x53')](_0x1f23e0[_0xfbc8('0x49')][_0xfbc8('0x51')],_0x1f23e0[_0xfbc8('0x49')][_0xfbc8('0x2b')]);return db[_0xfbc8('0x4d')]['create'](_0x1f23e0[_0xfbc8('0x49')],{'include':[{'model':db[_0xfbc8('0x54')],'as':_0xfbc8('0x55')},{'model':db[_0xfbc8('0x54')],'as':'Descriptions'}]});}return null;})[_0xfbc8('0x26')](respondWithResult(_0x212d2e,null))[_0xfbc8('0x47')](handleError(_0x212d2e,null));};var md5=require('md5');exports[_0xfbc8('0x56')]=function(_0x9d86f7,_0x3c6360,_0x12ddf6){var _0x2c8611=null;var _0x17e706=null;var _0x22c962=null;var _0x35b246=null;var _0x4cd508='';return db[_0xfbc8('0x40')][_0xfbc8('0x4c')]({'where':{'id':_0x9d86f7[_0xfbc8('0x4a')]['id']},'attributes':['id',_0xfbc8('0x27'),_0xfbc8('0x57'),_0xfbc8('0x58'),_0xfbc8('0x59'),_0xfbc8('0x5a'),'serverUrl','accessKey']})[_0xfbc8('0x26')](handleEntityNotFound(_0x3c6360,null))[_0xfbc8('0x26')](function(_0x2cf065){if(_0x2cf065){_0x2c8611=_0x2cf065[_0xfbc8('0x57')];_0x17e706=_0x2cf065[_0xfbc8('0x5b')];_0x22c962=_0x2cf065['moduleName'];_0x4cd508=_0x2cf065['remoteUri'];var _0xa1f06f=_0x4cd508[_0xfbc8('0x5c')](-0x1);if(_0xa1f06f==='/'){_0x4cd508=_0x4cd508[_0xfbc8('0x5d')](0x0,_0x4cd508[_0xfbc8('0x5e')](_0xa1f06f));}_0x35b246=util[_0xfbc8('0x5f')](_0xfbc8('0x60'),_0x4cd508);var _0x510a6c={'method':'GET','uri':_0x35b246,'qs':{'operation':'getchallenge','username':_0x2cf065[_0xfbc8('0x57')]},'json':!![]};return rp(_0x510a6c);}})[_0xfbc8('0x26')](function(_0x1d50a2){if(_0x1d50a2[_0xfbc8('0x61')]){var _0x5be186={'method':_0xfbc8('0x62'),'uri':_0x35b246,'form':{'operation':_0xfbc8('0x63'),'username':_0x2c8611,'accessKey':md5(_0x1d50a2[_0xfbc8('0x64')][_0xfbc8('0x65')]+_0x17e706)},'json':!![]};return rp(_0x5be186);}})['then'](function(_0x5087d5){if(_0x5087d5['success']){var _0x325b39={'method':'GET','uri':_0x35b246,'qs':{'operation':_0xfbc8('0x66'),'username':_0x2c8611,'sessionName':_0x5087d5[_0xfbc8('0x64')][_0xfbc8('0x67')],'elementType':_0x22c962},'json':!![]};return rp(_0x325b39);}})[_0xfbc8('0x26')](function(_0x53a963){if(_0x53a963['success']){var _0x418848=['autogenerated','reference',_0xfbc8('0x68')];_[_0xfbc8('0x69')](_0x53a963[_0xfbc8('0x64')][_0xfbc8('0x33')],function(_0x5b8472){return _0x418848[_0xfbc8('0x6a')](_0x5b8472[_0xfbc8('0x2b')][_0xfbc8('0x27')]);});_[_0xfbc8('0x69')](_0x53a963[_0xfbc8('0x64')][_0xfbc8('0x33')],function(_0x2eb6b4){return _0x2eb6b4[_0xfbc8('0x6b')]===_0xfbc8('0x6c');});return{'count':_0x53a963[_0xfbc8('0x64')][_0xfbc8('0x33')][_0xfbc8('0x34')],'rows':_[_0xfbc8('0x2e')](_0x53a963[_0xfbc8('0x64')]['fields'],function(_0x18e767){return{'id':_0x18e767[_0xfbc8('0x27')],'name':_0x18e767['label'],'custom':_[_0xfbc8('0x6d')](_0x18e767[_0xfbc8('0x27')],_0xfbc8('0x6e'))?!![]:![],'options':_0x18e767[_0xfbc8('0x2b')]['name']===_0xfbc8('0x6f')&&_0x18e767[_0xfbc8('0x2b')]['picklistValues'][_0xfbc8('0x34')]>0x0?_[_0xfbc8('0x2e')](_0x18e767[_0xfbc8('0x2b')][_0xfbc8('0x70')],function(_0x426224){return{'name':_0x426224[_0xfbc8('0x71')],'value':_0x426224['value']};}):[]};})};}})[_0xfbc8('0x26')](respondWithResult(_0x3c6360,null))[_0xfbc8('0x47')](function(_0x3dddf4){console['log'](_0xfbc8('0x72')+_0x3dddf4);var _0x4a6bd2=_0x9d86f7[_0xfbc8('0x30')][_0xfbc8('0x73')]?0x1f4:_0x3dddf4[_0xfbc8('0x74')]||0x1f4;logger['error'](_0xfbc8('0x75'),_0xfbc8('0x56'),_0x4a6bd2,JSON[_0xfbc8('0x76')](_0x3dddf4));delete _0x3dddf4['name'];if(_0x4a6bd2===0x191){_0x4a6bd2=0x190;}_0x3c6360['status'](_0x4a6bd2)['send'](_0x9d86f7[_0xfbc8('0x30')]['test']?{'message':_0xfbc8('0x77'),'statusCode':_0x3dddf4['statusCode']}:_0x3dddf4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 0a389a7..66f2145 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 _0x1d76=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','int_vtiger_accounts','lodash','util','moment','bluebird'];(function(_0x2504a3,_0x582e61){var _0x3214a1=function(_0x142537){while(--_0x142537){_0x2504a3['push'](_0x2504a3['shift']());}};_0x3214a1(++_0x582e61);}(_0x1d76,0x1c4));var _0x61d7=function(_0x24243c,_0x162c2c){_0x24243c=_0x24243c-0x0;var _0x49120a=_0x1d76[_0x24243c];return _0x49120a;};'use strict';var _=require(_0x61d7('0x0'));var util=require(_0x61d7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x61d7('0x2'));var BPromise=require(_0x61d7('0x3'));var rp=require(_0x61d7('0x4'));var fs=require('fs');var path=require(_0x61d7('0x5'));var rimraf=require(_0x61d7('0x6'));var config=require(_0x61d7('0x7'));var attributes=require(_0x61d7('0x8'));var integrations=require(_0x61d7('0x9'));module[_0x61d7('0xa')]=function(_0x2a3426,_0x4e5cc8){return _0x2a3426['define']('VtigerAccount',attributes,{'tableName':_0x61d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa23d=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util'];(function(_0x2ab20b,_0x382162){var _0x27f7f2=function(_0x3c2201){while(--_0x3c2201){_0x2ab20b['push'](_0x2ab20b['shift']());}};_0x27f7f2(++_0x382162);}(_0xa23d,0x6e));var _0xda23=function(_0x4ea941,_0x2932a8){_0x4ea941=_0x4ea941-0x0;var _0xeb6ee4=_0xa23d[_0x4ea941];return _0xeb6ee4;};'use strict';var _=require(_0xda23('0x0'));var util=require(_0xda23('0x1'));var logger=require(_0xda23('0x2'))('api');var moment=require(_0xda23('0x3'));var BPromise=require(_0xda23('0x4'));var rp=require(_0xda23('0x5'));var fs=require('fs');var path=require(_0xda23('0x6'));var rimraf=require(_0xda23('0x7'));var config=require(_0xda23('0x8'));var attributes=require(_0xda23('0x9'));var integrations=require(_0xda23('0xa'));module[_0xda23('0xb')]=function(_0x56ff87,_0x58fc5b){return _0x56ff87[_0xda23('0xc')](_0xda23('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 a96683e..03023d9 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 _0xa478=['info','request\x20sent','debug','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','include','map','model','VtigerAccount','find','ShowVtigerAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x335c74,_0x550e56){var _0x1a45cc=function(_0x59e4a2){while(--_0x59e4a2){_0x335c74['push'](_0x335c74['shift']());}};_0x1a45cc(++_0x550e56);}(_0xa478,0x136));var _0x8a47=function(_0x1af8d3,_0x544d86){_0x1af8d3=_0x1af8d3-0x0;var _0x3a50c5=_0xa478[_0x1af8d3];return _0x3a50c5;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});}exports[_0x8a47('0x17')]=function(_0x3f9093){var _0x5f5884=this;return new Promise(function(_0x341089,_0x5c62eb){return db['VtigerAccount'][_0x8a47('0x18')]({'raw':_0x3f9093[_0x8a47('0x19')]?_0x3f9093[_0x8a47('0x19')][_0x8a47('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f9093[_0x8a47('0x19')]?_0x3f9093[_0x8a47('0x19')][_0x8a47('0x1b')]||null:null,'attributes':_0x3f9093[_0x8a47('0x19')]?_0x3f9093[_0x8a47('0x19')][_0x8a47('0x1c')]||null:null,'limit':_0x3f9093['options']?_0x3f9093[_0x8a47('0x19')]['limit']||null:null,'include':_0x3f9093[_0x8a47('0x19')]?_0x3f9093[_0x8a47('0x19')][_0x8a47('0x1d')]?_[_0x8a47('0x1e')](_0x3f9093['options'][_0x8a47('0x1d')],function(_0x5ae186){return{'model':db[_0x5ae186['model']],'as':_0x5ae186['as'],'attributes':_0x5ae186['attributes'],'include':_0x5ae186['include']?_[_0x8a47('0x1e')](_0x5ae186[_0x8a47('0x1d')],function(_0x5bed3e){return{'model':db[_0x5bed3e[_0x8a47('0x1f')]],'as':_0x5bed3e['as'],'attributes':_0x5bed3e[_0x8a47('0x1c')],'include':_0x5bed3e[_0x8a47('0x1d')]?_[_0x8a47('0x1e')](_0x5bed3e[_0x8a47('0x1d')],function(_0xd06be6){return{'model':db[_0xd06be6[_0x8a47('0x1f')]],'as':_0xd06be6['as'],'attributes':_0xd06be6['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a47('0xd')](function(_0x4a10c3){logger[_0x8a47('0xe')](_0x8a47('0x17'),_0x3f9093);logger['debug'](_0x8a47('0x17'),_0x3f9093,JSON['stringify'](_0x4a10c3));_0x341089(_0x4a10c3);})['catch'](function(_0x12470a){logger[_0x8a47('0x11')](_0x8a47('0x17'),_0x12470a[_0x8a47('0x13')],_0x3f9093);_0x5c62eb(_0x5f5884[_0x8a47('0x11')](0x1f4,_0x12470a[_0x8a47('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x353576){var _0x4d78b5=this;return new Promise(function(_0x549913,_0x448459){return db[_0x8a47('0x20')][_0x8a47('0x21')]({'raw':_0x353576[_0x8a47('0x19')]?_0x353576[_0x8a47('0x19')][_0x8a47('0x1a')]===undefined?!![]:![]:!![],'where':_0x353576[_0x8a47('0x19')]?_0x353576[_0x8a47('0x19')][_0x8a47('0x1b')]||null:null,'attributes':_0x353576[_0x8a47('0x19')]?_0x353576['options'][_0x8a47('0x1c')]||null:null,'include':_0x353576[_0x8a47('0x19')]?_0x353576[_0x8a47('0x19')]['include']?_[_0x8a47('0x1e')](_0x353576[_0x8a47('0x19')]['include'],function(_0xa1a852){return{'model':db[_0xa1a852[_0x8a47('0x1f')]],'as':_0xa1a852['as'],'attributes':_0xa1a852[_0x8a47('0x1c')],'include':_0xa1a852[_0x8a47('0x1d')]?_['map'](_0xa1a852['include'],function(_0x145908){return{'model':db[_0x145908[_0x8a47('0x1f')]],'as':_0x145908['as'],'attributes':_0x145908[_0x8a47('0x1c')],'include':_0x145908[_0x8a47('0x1d')]?_[_0x8a47('0x1e')](_0x145908[_0x8a47('0x1d')],function(_0x1819ef){return{'model':db[_0x1819ef['model']],'as':_0x1819ef['as'],'attributes':_0x1819ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a47('0xd')](function(_0x3636af){logger[_0x8a47('0xe')](_0x8a47('0x22'),_0x353576);logger[_0x8a47('0x10')](_0x8a47('0x22'),_0x353576,JSON[_0x8a47('0x23')](_0x3636af));_0x549913(_0x3636af);})[_0x8a47('0x16')](function(_0xe178f1){logger[_0x8a47('0x11')](_0x8a47('0x22'),_0xe178f1['message'],_0x353576);_0x448459(_0x4d78b5[_0x8a47('0x11')](0x1f4,_0xe178f1['message']));});});}; \ No newline at end of file +var _0x97c1=['error','message','result','catch','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetVtigerAccount','debug','find','where','ShowVtigerAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e87f2,_0x22af37){var _0x17979a=function(_0x247c15){while(--_0x247c15){_0x2e87f2['push'](_0x2e87f2['shift']());}};_0x17979a(++_0x22af37);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['GetVtigerAccount']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')]({'raw':_0x372311[_0x197c('0x15')]?_0x372311['options'][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')]['where']||null:null,'attributes':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x17')]||null:null,'limit':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x18')]||null:null,'include':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x372311[_0x197c('0x15')][_0x197c('0x19')],function(_0x174942){return{'model':db[_0x174942[_0x197c('0x1b')]],'as':_0x174942['as'],'attributes':_0x174942[_0x197c('0x17')],'include':_0x174942[_0x197c('0x19')]?_['map'](_0x174942[_0x197c('0x19')],function(_0x2911dd){return{'model':db[_0x2911dd[_0x197c('0x1b')]],'as':_0x2911dd['as'],'attributes':_0x2911dd['attributes'],'include':_0x2911dd[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x2911dd['include'],function(_0x5e7bc9){return{'model':db[_0x5e7bc9[_0x197c('0x1b')]],'as':_0x5e7bc9['as'],'attributes':_0x5e7bc9['attributes']};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x14b0aa){logger[_0x197c('0xa')](_0x197c('0x1d'),_0x372311);logger[_0x197c('0x1e')](_0x197c('0x1d'),_0x372311,JSON[_0x197c('0xe')](_0x14b0aa));_0x50ac52(_0x14b0aa);})[_0x197c('0x12')](function(_0x4422d1){logger['error']('GetVtigerAccount',_0x4422d1['message'],_0x372311);_0x1725d9(_0x47aaa9['error'](0x1f4,_0x4422d1[_0x197c('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x252cde){var _0x35dbf3=this;return new Promise(function(_0x58bc60,_0x422ac6){return db['VtigerAccount'][_0x197c('0x1f')]({'raw':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x20')]||null:null,'attributes':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')]['attributes']||null:null,'include':_0x252cde['options']?_0x252cde[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x252cde[_0x197c('0x15')][_0x197c('0x19')],function(_0x1cb7e8){return{'model':db[_0x1cb7e8[_0x197c('0x1b')]],'as':_0x1cb7e8['as'],'attributes':_0x1cb7e8['attributes'],'include':_0x1cb7e8['include']?_[_0x197c('0x1a')](_0x1cb7e8[_0x197c('0x19')],function(_0x4d085b){return{'model':db[_0x4d085b['model']],'as':_0x4d085b['as'],'attributes':_0x4d085b[_0x197c('0x17')],'include':_0x4d085b[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x4d085b[_0x197c('0x19')],function(_0x45095c){return{'model':db[_0x45095c[_0x197c('0x1b')]],'as':_0x45095c['as'],'attributes':_0x45095c[_0x197c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x44ce68){logger['info'](_0x197c('0x21'),_0x252cde);logger[_0x197c('0x1e')](_0x197c('0x21'),_0x252cde,JSON[_0x197c('0xe')](_0x44ce68));_0x58bc60(_0x44ce68);})[_0x197c('0x12')](function(_0x151e2f){logger['error'](_0x197c('0x21'),_0x151e2f[_0x197c('0x10')],_0x252cde);_0x422ac6(_0x35dbf3[_0x197c('0xf')](0x1f4,_0x151e2f['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index bc29d6d..ced34df 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 _0x1a13=['isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id'];(function(_0xf9eda,_0x2cb072){var _0x1f5c7=function(_0x5cd03f){while(--_0x5cd03f){_0xf9eda['push'](_0xf9eda['shift']());}};_0x1f5c7(++_0x2cb072);}(_0x1a13,0x15a));var _0x31a1=function(_0x3fda57,_0x4f97f4){_0x3fda57=_0x3fda57-0x0;var _0x442f59=_0x1a13[_0x3fda57];return _0x442f59;};'use strict';var multer=require(_0x31a1('0x0'));var util=require(_0x31a1('0x1'));var path=require(_0x31a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x31a1('0x3'));var router=express['Router']();var fs_extra=require(_0x31a1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x31a1('0x5'));var config=require(_0x31a1('0x6'));var controller=require(_0x31a1('0x7'));router[_0x31a1('0x8')]('/',auth['isAuthenticated'](),controller[_0x31a1('0x9')]);router['get'](_0x31a1('0xa'),auth[_0x31a1('0xb')](),controller[_0x31a1('0xc')]);router[_0x31a1('0x8')]('/:id/fields',auth[_0x31a1('0xb')](),controller['getFields']);router['get'](_0x31a1('0xd'),auth[_0x31a1('0xb')](),controller[_0x31a1('0xe')]);router[_0x31a1('0x8')](_0x31a1('0xf'),auth[_0x31a1('0xb')](),controller[_0x31a1('0x10')]);router[_0x31a1('0x11')]('/',auth[_0x31a1('0xb')](),controller['create']);router[_0x31a1('0x12')](_0x31a1('0xa'),auth[_0x31a1('0xb')](),controller['update']);router[_0x31a1('0x13')]('/:id',auth[_0x31a1('0xb')](),controller['destroy']);module[_0x31a1('0x14')]=router; \ No newline at end of file +var _0x7a20=['./intVtigerConfiguration.controller','get','isAuthenticated','index','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','/:id','destroy','util','path','connect-timeout','../../components/auth/service'];(function(_0x41b2ff,_0x1bc707){var _0x625261=function(_0x3e7ec6){while(--_0x3e7ec6){_0x41b2ff['push'](_0x41b2ff['shift']());}};_0x625261(++_0x1bc707);}(_0x7a20,0x7a));var _0x07a2=function(_0x105188,_0x24aaa2){_0x105188=_0x105188-0x0;var _0x404369=_0x7a20[_0x105188];return _0x404369;};'use strict';var multer=require('multer');var util=require(_0x07a2('0x0'));var path=require(_0x07a2('0x1'));var timeout=require(_0x07a2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07a2('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x07a2('0x4'));router[_0x07a2('0x5')]('/',auth[_0x07a2('0x6')](),controller[_0x07a2('0x7')]);router[_0x07a2('0x5')]('/:id',auth[_0x07a2('0x6')](),controller['show']);router[_0x07a2('0x5')]('/:id/fields',auth[_0x07a2('0x6')](),controller[_0x07a2('0x8')]);router[_0x07a2('0x5')](_0x07a2('0x9'),auth[_0x07a2('0x6')](),controller[_0x07a2('0xa')]);router[_0x07a2('0x5')](_0x07a2('0xb'),auth[_0x07a2('0x6')](),controller[_0x07a2('0xc')]);router[_0x07a2('0xd')]('/',auth[_0x07a2('0x6')](),controller['create']);router[_0x07a2('0xe')]('/:id',auth[_0x07a2('0x6')](),controller[_0x07a2('0xf')]);router['delete'](_0x07a2('0x10'),auth['isAuthenticated'](),controller[_0x07a2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 1bb7a31..0ae8233 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 _0xf674=['sequelize'];(function(_0x1c6089,_0x3816e2){var _0x4d97c1=function(_0x3e631b){while(--_0x3e631b){_0x1c6089['push'](_0x1c6089['shift']());}};_0x4d97c1(++_0x3816e2);}(_0xf674,0x109));var _0x4f67=function(_0x5c59e9,_0x253541){_0x5c59e9=_0x5c59e9-0x0;var _0x56b0b3=_0xf674[_0x5c59e9];return _0x56b0b3;};'use strict';var Sequelize=require(_0x4f67('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6646=['STRING','sequelize','exports'];(function(_0x486dc0,_0x100223){var _0x18c616=function(_0xd4d08){while(--_0xd4d08){_0x486dc0['push'](_0x486dc0['shift']());}};_0x18c616(++_0x100223);}(_0x6646,0x11b));var _0x6664=function(_0x337c0a,_0x66b76b){_0x337c0a=_0x337c0a-0x0;var _0x1e27e0=_0x6646[_0x337c0a];return _0x1e27e0;};'use strict';var Sequelize=require(_0x6664('0x0'));module[_0x6664('0x1')]={'name':{'type':Sequelize[_0x6664('0x2')]},'description':{'type':Sequelize[_0x6664('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6057b83..2f04591 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 _0xf81b=['zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','stack','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','where','pick','merge','VIRTUAL','name','filter','options','findAll','rows','catch','params','includeAll','include','find','create','body','getFields','findOne','VtigerField','sort','hasOwnProperty','nolimit','getSubjects','order','getDescriptions','eml-format','rimraf'];(function(_0x1755e2,_0x397e1b){var _0x2eed31=function(_0x1c84b1){while(--_0x1c84b1){_0x1755e2['push'](_0x1755e2['shift']());}};_0x2eed31(++_0x397e1b);}(_0xf81b,0x1cc));var _0xbf81=function(_0x1f0a9a,_0x39dbeb){_0x1f0a9a=_0x1f0a9a-0x0;var _0x30ba19=_0xf81b[_0x1f0a9a];return _0x30ba19;};'use strict';var emlformat=require(_0xbf81('0x0'));var rimraf=require(_0xbf81('0x1'));var zipdir=require(_0xbf81('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf81('0x3'));var moment=require('moment');var BPromise=require(_0xbf81('0x4'));var Mustache=require(_0xbf81('0x5'));var util=require(_0xbf81('0x6'));var path=require(_0xbf81('0x7'));var sox=require(_0xbf81('0x8'));var csv=require(_0xbf81('0x9'));var ejs=require(_0xbf81('0xa'));var fs=require('fs');var fs_extra=require(_0xbf81('0xb'));var _=require('lodash');var squel=require(_0xbf81('0xc'));var crypto=require(_0xbf81('0xd'));var jsforce=require(_0xbf81('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbf81('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf81('0x10'))('api');var utils=require(_0xbf81('0x11'));var config=require(_0xbf81('0x12'));var licenseUtil=require(_0xbf81('0x13'));var db=require(_0xbf81('0x14'))['db'];function respondWithStatusCode(_0x103655,_0x32fe6c){_0x32fe6c=_0x32fe6c||0xcc;return function(_0x394222){if(_0x394222){return _0x103655['sendStatus'](_0x32fe6c);}return _0x103655[_0xbf81('0x15')](_0x32fe6c)[_0xbf81('0x16')]();};}function respondWithResult(_0x33c7f4,_0x5836b7){_0x5836b7=_0x5836b7||0xc8;return function(_0x2dd19e){if(_0x2dd19e){return _0x33c7f4[_0xbf81('0x15')](_0x5836b7)[_0xbf81('0x17')](_0x2dd19e);}};}function respondWithFilteredResult(_0x23dd94,_0x41c56a){return function(_0x5461c2){if(_0x5461c2){var _0x1e78d1=typeof _0x41c56a[_0xbf81('0x18')]===_0xbf81('0x19')&&typeof _0x41c56a[_0xbf81('0x1a')]===_0xbf81('0x19');var _0x1021d5=_0x5461c2[_0xbf81('0x1b')];var _0x2b95f1=_0x1e78d1?0x0:_0x41c56a[_0xbf81('0x18')];var _0x5d6872=_0x1e78d1?_0x5461c2[_0xbf81('0x1b')]:_0x41c56a[_0xbf81('0x18')]+_0x41c56a[_0xbf81('0x1a')];var _0x4a6f7c;if(_0x5d6872>=_0x1021d5){_0x5d6872=_0x1021d5;_0x4a6f7c=0xc8;}else{_0x4a6f7c=0xce;}_0x23dd94['status'](_0x4a6f7c);return _0x23dd94[_0xbf81('0x1c')]('Content-Range',_0x2b95f1+'-'+_0x5d6872+'/'+_0x1021d5)[_0xbf81('0x17')](_0x5461c2);}return null;};}function patchUpdates(_0x10e17e){return function(_0x55a973){try{jsonpatch[_0xbf81('0x1d')](_0x55a973,_0x10e17e,!![]);}catch(_0x3770c6){return BPromise[_0xbf81('0x1e')](_0x3770c6);}return _0x55a973['save']();};}function saveUpdates(_0x314efa,_0x96eecf){return function(_0x2c3618){if(_0x2c3618){return _0x2c3618[_0xbf81('0x1f')](_0x314efa)[_0xbf81('0x20')](function(_0xc51c36){return _0xc51c36;});}return null;};}function removeEntity(_0x1fd2e1,_0x20abc0){return function(_0x27ab40){if(_0x27ab40){return _0x27ab40[_0xbf81('0x21')]()[_0xbf81('0x20')](function(){_0x1fd2e1[_0xbf81('0x15')](0xcc)[_0xbf81('0x16')]();});}};}function handleEntityNotFound(_0x57078c,_0x1d070e){return function(_0x46d650){if(!_0x46d650){_0x57078c[_0xbf81('0x22')](0x194);}return _0x46d650;};}function handleError(_0x2f637c,_0x38f6fb){_0x38f6fb=_0x38f6fb||0x1f4;return function(_0x4f7e61){logger['error'](_0x4f7e61[_0xbf81('0x23')]);if(_0x4f7e61['name']){delete _0x4f7e61['name'];}_0x2f637c[_0xbf81('0x15')](_0x38f6fb)[_0xbf81('0x24')](_0x4f7e61);};}exports[_0xbf81('0x25')]=function(_0x5d58f7,_0x188025){var _0x31a788={},_0x501a72={},_0x183258={'count':0x0,'rows':[]};var _0x4ec0ce=_[_0xbf81('0x26')](db[_0xbf81('0x27')][_0xbf81('0x28')],function(_0x5f5304){return{'name':_0x5f5304[_0xbf81('0x29')],'type':_0x5f5304[_0xbf81('0x2a')][_0xbf81('0x2b')]};});_0x501a72[_0xbf81('0x2c')]=_[_0xbf81('0x26')](_0x4ec0ce,'name');_0x501a72[_0xbf81('0x2d')]=_[_0xbf81('0x2e')](_0x5d58f7[_0xbf81('0x2d')]);_0x501a72[_0xbf81('0x2f')]=_['intersection'](_0x501a72['model'],_0x501a72[_0xbf81('0x2d')]);_0x31a788['attributes']=_[_0xbf81('0x30')](_0x501a72[_0xbf81('0x2c')],qs[_0xbf81('0x31')](_0x5d58f7[_0xbf81('0x2d')]['fields']));_0x31a788[_0xbf81('0x32')]=_0x31a788[_0xbf81('0x32')][_0xbf81('0x33')]?_0x31a788[_0xbf81('0x32')]:_0x501a72[_0xbf81('0x2c')];if(!_0x5d58f7[_0xbf81('0x2d')]['hasOwnProperty']('nolimit')){_0x31a788[_0xbf81('0x1a')]=qs[_0xbf81('0x1a')](_0x5d58f7[_0xbf81('0x2d')][_0xbf81('0x1a')]);_0x31a788['offset']=qs[_0xbf81('0x18')](_0x5d58f7[_0xbf81('0x2d')][_0xbf81('0x18')]);}_0x31a788['order']=qs['sort'](_0x5d58f7[_0xbf81('0x2d')]['sort']);_0x31a788[_0xbf81('0x34')]=qs['filters'](_[_0xbf81('0x35')](_0x5d58f7['query'],_0x501a72[_0xbf81('0x2f')]),_0x4ec0ce);if(_0x5d58f7[_0xbf81('0x2d')]['filter']){_0x31a788[_0xbf81('0x34')]=_[_0xbf81('0x36')](_0x31a788['where'],{'$or':_['map'](_0x4ec0ce,function(_0x368ef1){if(_0x368ef1[_0xbf81('0x2a')]!==_0xbf81('0x37')){var _0x17ed3f={};_0x17ed3f[_0x368ef1[_0xbf81('0x38')]]={'$like':'%'+_0x5d58f7['query'][_0xbf81('0x39')]+'%'};return _0x17ed3f;}})});}_0x31a788=_['merge']({},_0x31a788,_0x5d58f7[_0xbf81('0x3a')]);var _0x94e44a={'where':_0x31a788['where']};return db[_0xbf81('0x27')][_0xbf81('0x1b')](_0x94e44a)[_0xbf81('0x20')](function(_0x64804e){_0x183258['count']=_0x64804e;if(_0x5d58f7[_0xbf81('0x2d')]['includeAll']){_0x31a788['include']=[{'all':!![]}];}return db[_0xbf81('0x27')][_0xbf81('0x3b')](_0x31a788);})[_0xbf81('0x20')](function(_0x34d56f){_0x183258[_0xbf81('0x3c')]=_0x34d56f;return _0x183258;})['then'](respondWithFilteredResult(_0x188025,_0x31a788))[_0xbf81('0x3d')](handleError(_0x188025,null));};exports['show']=function(_0x4a318f,_0x5d5169){var _0xfbeca7={'raw':![],'where':{'id':_0x4a318f[_0xbf81('0x3e')]['id']}},_0x94ad44={};_0x94ad44[_0xbf81('0x2c')]=_['keys'](db[_0xbf81('0x27')][_0xbf81('0x28')]);_0x94ad44['query']=_['keys'](_0x4a318f['query']);_0x94ad44[_0xbf81('0x2f')]=_[_0xbf81('0x30')](_0x94ad44[_0xbf81('0x2c')],_0x94ad44[_0xbf81('0x2d')]);_0xfbeca7[_0xbf81('0x32')]=_[_0xbf81('0x30')](_0x94ad44[_0xbf81('0x2c')],qs[_0xbf81('0x31')](_0x4a318f[_0xbf81('0x2d')][_0xbf81('0x31')]));_0xfbeca7[_0xbf81('0x32')]=_0xfbeca7[_0xbf81('0x32')][_0xbf81('0x33')]?_0xfbeca7[_0xbf81('0x32')]:_0x94ad44[_0xbf81('0x2c')];if(_0x4a318f['query'][_0xbf81('0x3f')]){_0xfbeca7[_0xbf81('0x40')]=[{'all':!![]}];}_0xfbeca7=_[_0xbf81('0x36')]({},_0xfbeca7,_0x4a318f[_0xbf81('0x3a')]);return db[_0xbf81('0x27')][_0xbf81('0x41')](_0xfbeca7)[_0xbf81('0x20')](handleEntityNotFound(_0x5d5169,null))['then'](respondWithResult(_0x5d5169,null))[_0xbf81('0x3d')](handleError(_0x5d5169,null));};exports[_0xbf81('0x42')]=function(_0x478853,_0x291be6){return db['VtigerConfiguration'][_0xbf81('0x42')](_0x478853[_0xbf81('0x43')],{})['then'](respondWithResult(_0x291be6,0xc9))[_0xbf81('0x3d')](handleError(_0x291be6,null));};exports[_0xbf81('0x1f')]=function(_0x5bc432,_0x1bf577){if(_0x5bc432[_0xbf81('0x43')]['id']){delete _0x5bc432['body']['id'];}return db[_0xbf81('0x27')][_0xbf81('0x41')]({'where':{'id':_0x5bc432[_0xbf81('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1bf577,null))['then'](saveUpdates(_0x5bc432[_0xbf81('0x43')],null))[_0xbf81('0x20')](respondWithResult(_0x1bf577,null))[_0xbf81('0x3d')](handleError(_0x1bf577,null));};exports['destroy']=function(_0x50a843,_0x5978f3){return db[_0xbf81('0x27')]['find']({'where':{'id':_0x50a843[_0xbf81('0x3e')]['id']}})[_0xbf81('0x20')](handleEntityNotFound(_0x5978f3,null))[_0xbf81('0x20')](removeEntity(_0x5978f3,null))['catch'](handleError(_0x5978f3,null));};exports[_0xbf81('0x44')]=function(_0x433dca,_0x5957fb,_0xa1334e){var _0x8af1b3={};var _0x1dcdc2={};var _0x376e4d;var _0x10b3cd;return db[_0xbf81('0x27')][_0xbf81('0x45')]({'where':{'id':_0x433dca['params']['id']}})['then'](handleEntityNotFound(_0x5957fb,null))['then'](function(_0x327daf){if(_0x327daf){_0x376e4d=_0x327daf;_0x1dcdc2[_0xbf81('0x2c')]=_[_0xbf81('0x2e')](db[_0xbf81('0x46')][_0xbf81('0x28')]);_0x1dcdc2[_0xbf81('0x2d')]=_[_0xbf81('0x2e')](_0x433dca[_0xbf81('0x2d')]);_0x1dcdc2[_0xbf81('0x2f')]=_[_0xbf81('0x30')](_0x1dcdc2['model'],_0x1dcdc2[_0xbf81('0x2d')]);_0x8af1b3[_0xbf81('0x32')]=_['intersection'](_0x1dcdc2['model'],qs[_0xbf81('0x31')](_0x433dca['query']['fields']));_0x8af1b3[_0xbf81('0x32')]=_0x8af1b3['attributes']['length']?_0x8af1b3[_0xbf81('0x32')]:_0x1dcdc2['model'];_0x8af1b3['order']=qs[_0xbf81('0x47')](_0x433dca[_0xbf81('0x2d')]['sort']);_0x8af1b3[_0xbf81('0x34')]=qs['filters'](_['pick'](_0x433dca[_0xbf81('0x2d')],_0x1dcdc2[_0xbf81('0x2f')]));if(_0x433dca[_0xbf81('0x2d')][_0xbf81('0x39')]){_0x8af1b3[_0xbf81('0x34')]=_[_0xbf81('0x36')](_0x8af1b3[_0xbf81('0x34')],{'$or':_[_0xbf81('0x26')](_0x8af1b3['attributes'],function(_0x9c2c9d){var _0x3dc7d8={};_0x3dc7d8[_0x9c2c9d]={'$like':'%'+_0x433dca[_0xbf81('0x2d')][_0xbf81('0x39')]+'%'};return _0x3dc7d8;})});}_0x8af1b3=_[_0xbf81('0x36')]({},_0x8af1b3,_0x433dca[_0xbf81('0x3a')]);return _0x376e4d[_0xbf81('0x44')](_0x8af1b3);}})[_0xbf81('0x20')](function(_0x42fc9d){if(_0x42fc9d){_0x10b3cd=_0x42fc9d['length'];if(!_0x433dca[_0xbf81('0x2d')][_0xbf81('0x48')](_0xbf81('0x49'))){_0x8af1b3[_0xbf81('0x1a')]=qs[_0xbf81('0x1a')](_0x433dca[_0xbf81('0x2d')]['limit']);_0x8af1b3['offset']=qs[_0xbf81('0x18')](_0x433dca[_0xbf81('0x2d')][_0xbf81('0x18')]);}return _0x376e4d['getFields'](_0x8af1b3);}})['then'](function(_0x2d42ca){if(_0x2d42ca){return _0x2d42ca?{'count':_0x10b3cd,'rows':_0x2d42ca}:null;}})[_0xbf81('0x20')](respondWithResult(_0x5957fb,null))[_0xbf81('0x3d')](handleError(_0x5957fb,null));};exports[_0xbf81('0x4a')]=function(_0x5f1657,_0x4e81a1,_0xa15df6){var _0x123b16={};var _0x15259c={};var _0x43f4f5;var _0x50ce97;return db['VtigerConfiguration'][_0xbf81('0x45')]({'where':{'id':_0x5f1657[_0xbf81('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e81a1,null))['then'](function(_0x2a40e0){if(_0x2a40e0){_0x43f4f5=_0x2a40e0;_0x15259c['model']=_[_0xbf81('0x2e')](db[_0xbf81('0x46')][_0xbf81('0x28')]);_0x15259c[_0xbf81('0x2d')]=_[_0xbf81('0x2e')](_0x5f1657[_0xbf81('0x2d')]);_0x15259c[_0xbf81('0x2f')]=_[_0xbf81('0x30')](_0x15259c['model'],_0x15259c[_0xbf81('0x2d')]);_0x123b16[_0xbf81('0x32')]=_[_0xbf81('0x30')](_0x15259c[_0xbf81('0x2c')],qs[_0xbf81('0x31')](_0x5f1657[_0xbf81('0x2d')][_0xbf81('0x31')]));_0x123b16[_0xbf81('0x32')]=_0x123b16['attributes'][_0xbf81('0x33')]?_0x123b16['attributes']:_0x15259c[_0xbf81('0x2c')];_0x123b16[_0xbf81('0x4b')]=qs[_0xbf81('0x47')](_0x5f1657[_0xbf81('0x2d')][_0xbf81('0x47')]);_0x123b16[_0xbf81('0x34')]=qs[_0xbf81('0x2f')](_[_0xbf81('0x35')](_0x5f1657[_0xbf81('0x2d')],_0x15259c['filters']));if(_0x5f1657[_0xbf81('0x2d')][_0xbf81('0x39')]){_0x123b16[_0xbf81('0x34')]=_[_0xbf81('0x36')](_0x123b16[_0xbf81('0x34')],{'$or':_[_0xbf81('0x26')](_0x123b16[_0xbf81('0x32')],function(_0x5b8beb){var _0x525446={};_0x525446[_0x5b8beb]={'$like':'%'+_0x5f1657[_0xbf81('0x2d')][_0xbf81('0x39')]+'%'};return _0x525446;})});}_0x123b16=_[_0xbf81('0x36')]({},_0x123b16,_0x5f1657['options']);return _0x43f4f5['getSubjects'](_0x123b16);}})[_0xbf81('0x20')](function(_0x33f0fb){if(_0x33f0fb){_0x50ce97=_0x33f0fb[_0xbf81('0x33')];if(!_0x5f1657[_0xbf81('0x2d')][_0xbf81('0x48')](_0xbf81('0x49'))){_0x123b16[_0xbf81('0x1a')]=qs[_0xbf81('0x1a')](_0x5f1657[_0xbf81('0x2d')][_0xbf81('0x1a')]);_0x123b16['offset']=qs[_0xbf81('0x18')](_0x5f1657['query'][_0xbf81('0x18')]);}return _0x43f4f5['getSubjects'](_0x123b16);}})['then'](function(_0x445339){if(_0x445339){return _0x445339?{'count':_0x50ce97,'rows':_0x445339}:null;}})[_0xbf81('0x20')](respondWithResult(_0x4e81a1,null))[_0xbf81('0x3d')](handleError(_0x4e81a1,null));};exports[_0xbf81('0x4c')]=function(_0x42fadb,_0x3a3768,_0x5d5202){var _0x494ac7={};var _0xabd852={};var _0x118d88;var _0x5eb36d;return db[_0xbf81('0x27')][_0xbf81('0x45')]({'where':{'id':_0x42fadb[_0xbf81('0x3e')]['id']}})[_0xbf81('0x20')](handleEntityNotFound(_0x3a3768,null))[_0xbf81('0x20')](function(_0xafd356){if(_0xafd356){_0x118d88=_0xafd356;_0xabd852[_0xbf81('0x2c')]=_[_0xbf81('0x2e')](db[_0xbf81('0x46')][_0xbf81('0x28')]);_0xabd852[_0xbf81('0x2d')]=_[_0xbf81('0x2e')](_0x42fadb['query']);_0xabd852[_0xbf81('0x2f')]=_[_0xbf81('0x30')](_0xabd852[_0xbf81('0x2c')],_0xabd852[_0xbf81('0x2d')]);_0x494ac7[_0xbf81('0x32')]=_[_0xbf81('0x30')](_0xabd852[_0xbf81('0x2c')],qs[_0xbf81('0x31')](_0x42fadb[_0xbf81('0x2d')][_0xbf81('0x31')]));_0x494ac7[_0xbf81('0x32')]=_0x494ac7[_0xbf81('0x32')][_0xbf81('0x33')]?_0x494ac7[_0xbf81('0x32')]:_0xabd852[_0xbf81('0x2c')];_0x494ac7['order']=qs[_0xbf81('0x47')](_0x42fadb[_0xbf81('0x2d')][_0xbf81('0x47')]);_0x494ac7[_0xbf81('0x34')]=qs[_0xbf81('0x2f')](_[_0xbf81('0x35')](_0x42fadb[_0xbf81('0x2d')],_0xabd852[_0xbf81('0x2f')]));if(_0x42fadb['query'][_0xbf81('0x39')]){_0x494ac7[_0xbf81('0x34')]=_[_0xbf81('0x36')](_0x494ac7[_0xbf81('0x34')],{'$or':_['map'](_0x494ac7['attributes'],function(_0x14286c){var _0x5f178e={};_0x5f178e[_0x14286c]={'$like':'%'+_0x42fadb[_0xbf81('0x2d')][_0xbf81('0x39')]+'%'};return _0x5f178e;})});}_0x494ac7=_[_0xbf81('0x36')]({},_0x494ac7,_0x42fadb[_0xbf81('0x3a')]);return _0x118d88[_0xbf81('0x4c')](_0x494ac7);}})[_0xbf81('0x20')](function(_0x5af980){if(_0x5af980){_0x5eb36d=_0x5af980[_0xbf81('0x33')];if(!_0x42fadb[_0xbf81('0x2d')][_0xbf81('0x48')](_0xbf81('0x49'))){_0x494ac7[_0xbf81('0x1a')]=qs['limit'](_0x42fadb['query'][_0xbf81('0x1a')]);_0x494ac7[_0xbf81('0x18')]=qs[_0xbf81('0x18')](_0x42fadb[_0xbf81('0x2d')][_0xbf81('0x18')]);}return _0x118d88[_0xbf81('0x4c')](_0x494ac7);}})[_0xbf81('0x20')](function(_0x19fdce){if(_0x19fdce){return _0x19fdce?{'count':_0x5eb36d,'rows':_0x19fdce}:null;}})[_0xbf81('0x20')](respondWithResult(_0x3a3768,null))['catch'](handleError(_0x3a3768,null));}; \ No newline at end of file +var _0x9f3e=['api','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','set','Content-Range','reject','save','update','then','end','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','destroy','getFields','findOne','VtigerField','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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'];(function(_0x5272be,_0x2256ce){var _0x320ff7=function(_0x4980c6){while(--_0x4980c6){_0x5272be['push'](_0x5272be['shift']());}};_0x320ff7(++_0x2256ce);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x5d644b,_0x815f8a){_0x5d644b=_0x5d644b-0x0;var _0x51296b=_0x9f3e[_0x5d644b];return _0x51296b;};'use strict';var emlformat=require(_0xe9f3('0x0'));var rimraf=require(_0xe9f3('0x1'));var zipdir=require(_0xe9f3('0x2'));var jsonpatch=require(_0xe9f3('0x3'));var rp=require(_0xe9f3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9f3('0x5'));var path=require('path');var sox=require(_0xe9f3('0x6'));var csv=require(_0xe9f3('0x7'));var ejs=require(_0xe9f3('0x8'));var fs=require('fs');var fs_extra=require(_0xe9f3('0x9'));var _=require(_0xe9f3('0xa'));var squel=require(_0xe9f3('0xb'));var crypto=require(_0xe9f3('0xc'));var jsforce=require(_0xe9f3('0xd'));var deskjs=require(_0xe9f3('0xe'));var toCsv=require(_0xe9f3('0x7'));var querystring=require(_0xe9f3('0xf'));var Papa=require(_0xe9f3('0x10'));var Redis=require(_0xe9f3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe9f3('0x12'));var as=require(_0xe9f3('0x13'));var hardwareService=require(_0xe9f3('0x14'));var logger=require(_0xe9f3('0x15'))(_0xe9f3('0x16'));var utils=require('../../config/utils');var config=require(_0xe9f3('0x17'));var licenseUtil=require(_0xe9f3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1865a6,_0x4e2d17){_0x4e2d17=_0x4e2d17||0xcc;return function(_0x14af9f){if(_0x14af9f){return _0x1865a6[_0xe9f3('0x19')](_0x4e2d17);}return _0x1865a6[_0xe9f3('0x1a')](_0x4e2d17)['end']();};}function respondWithResult(_0x5501fe,_0x143a34){_0x143a34=_0x143a34||0xc8;return function(_0x158f4c){if(_0x158f4c){return _0x5501fe['status'](_0x143a34)[_0xe9f3('0x1b')](_0x158f4c);}};}function respondWithFilteredResult(_0x1f0dd9,_0x2d6c96){return function(_0x25abdc){if(_0x25abdc){var _0x45cfd5=typeof _0x2d6c96['offset']==='undefined'&&typeof _0x2d6c96[_0xe9f3('0x1c')]===_0xe9f3('0x1d');var _0x4acda2=_0x25abdc[_0xe9f3('0x1e')];var _0x16b788=_0x45cfd5?0x0:_0x2d6c96['offset'];var _0x1496f=_0x45cfd5?_0x25abdc[_0xe9f3('0x1e')]:_0x2d6c96['offset']+_0x2d6c96[_0xe9f3('0x1c')];var _0x679a80;if(_0x1496f>=_0x4acda2){_0x1496f=_0x4acda2;_0x679a80=0xc8;}else{_0x679a80=0xce;}_0x1f0dd9[_0xe9f3('0x1a')](_0x679a80);return _0x1f0dd9[_0xe9f3('0x1f')](_0xe9f3('0x20'),_0x16b788+'-'+_0x1496f+'/'+_0x4acda2)[_0xe9f3('0x1b')](_0x25abdc);}return null;};}function patchUpdates(_0x3866cc){return function(_0x44be8f){try{jsonpatch['apply'](_0x44be8f,_0x3866cc,!![]);}catch(_0x312b89){return BPromise[_0xe9f3('0x21')](_0x312b89);}return _0x44be8f[_0xe9f3('0x22')]();};}function saveUpdates(_0x514ddc,_0x138e5d){return function(_0x17f97e){if(_0x17f97e){return _0x17f97e[_0xe9f3('0x23')](_0x514ddc)['then'](function(_0x4f9cdd){return _0x4f9cdd;});}return null;};}function removeEntity(_0x1649fa,_0x526d6b){return function(_0x35a8af){if(_0x35a8af){return _0x35a8af['destroy']()[_0xe9f3('0x24')](function(){_0x1649fa[_0xe9f3('0x1a')](0xcc)[_0xe9f3('0x25')]();});}};}function handleEntityNotFound(_0x2e959a,_0x381300){return function(_0x40c7c2){if(!_0x40c7c2){_0x2e959a[_0xe9f3('0x19')](0x194);}return _0x40c7c2;};}function handleError(_0x5e518a,_0x3de723){_0x3de723=_0x3de723||0x1f4;return function(_0x144af0){logger['error'](_0x144af0[_0xe9f3('0x26')]);if(_0x144af0[_0xe9f3('0x27')]){delete _0x144af0[_0xe9f3('0x27')];}_0x5e518a[_0xe9f3('0x1a')](_0x3de723)[_0xe9f3('0x28')](_0x144af0);};}exports['index']=function(_0x54b315,_0x2a8e22){var _0x489ff2={},_0x2fff80={},_0x421b9f={'count':0x0,'rows':[]};var _0x2b33de=_[_0xe9f3('0x29')](db[_0xe9f3('0x2a')][_0xe9f3('0x2b')],function(_0x3baf84){return{'name':_0x3baf84[_0xe9f3('0x2c')],'type':_0x3baf84[_0xe9f3('0x2d')][_0xe9f3('0x2e')]};});_0x2fff80['model']=_[_0xe9f3('0x29')](_0x2b33de,_0xe9f3('0x27'));_0x2fff80[_0xe9f3('0x2f')]=_[_0xe9f3('0x30')](_0x54b315['query']);_0x2fff80[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x2fff80[_0xe9f3('0x33')],_0x2fff80[_0xe9f3('0x2f')]);_0x489ff2['attributes']=_['intersection'](_0x2fff80[_0xe9f3('0x33')],qs[_0xe9f3('0x34')](_0x54b315['query'][_0xe9f3('0x34')]));_0x489ff2[_0xe9f3('0x35')]=_0x489ff2['attributes'][_0xe9f3('0x36')]?_0x489ff2['attributes']:_0x2fff80['model'];if(!_0x54b315[_0xe9f3('0x2f')]['hasOwnProperty']('nolimit')){_0x489ff2['limit']=qs[_0xe9f3('0x1c')](_0x54b315[_0xe9f3('0x2f')]['limit']);_0x489ff2[_0xe9f3('0x37')]=qs[_0xe9f3('0x37')](_0x54b315[_0xe9f3('0x2f')][_0xe9f3('0x37')]);}_0x489ff2[_0xe9f3('0x38')]=qs[_0xe9f3('0x39')](_0x54b315['query'][_0xe9f3('0x39')]);_0x489ff2[_0xe9f3('0x3a')]=qs[_0xe9f3('0x31')](_[_0xe9f3('0x3b')](_0x54b315['query'],_0x2fff80['filters']),_0x2b33de);if(_0x54b315[_0xe9f3('0x2f')][_0xe9f3('0x3c')]){_0x489ff2[_0xe9f3('0x3a')]=_[_0xe9f3('0x3d')](_0x489ff2[_0xe9f3('0x3a')],{'$or':_[_0xe9f3('0x29')](_0x2b33de,function(_0x23bd11){if(_0x23bd11[_0xe9f3('0x2d')]!=='VIRTUAL'){var _0x333ed7={};_0x333ed7[_0x23bd11[_0xe9f3('0x27')]]={'$like':'%'+_0x54b315[_0xe9f3('0x2f')][_0xe9f3('0x3c')]+'%'};return _0x333ed7;}})});}_0x489ff2=_[_0xe9f3('0x3d')]({},_0x489ff2,_0x54b315[_0xe9f3('0x3e')]);var _0xfb1a78={'where':_0x489ff2[_0xe9f3('0x3a')]};return db[_0xe9f3('0x2a')]['count'](_0xfb1a78)[_0xe9f3('0x24')](function(_0x1ecf08){_0x421b9f[_0xe9f3('0x1e')]=_0x1ecf08;if(_0x54b315[_0xe9f3('0x2f')][_0xe9f3('0x3f')]){_0x489ff2[_0xe9f3('0x40')]=[{'all':!![]}];}return db[_0xe9f3('0x2a')][_0xe9f3('0x41')](_0x489ff2);})[_0xe9f3('0x24')](function(_0xb11d82){_0x421b9f['rows']=_0xb11d82;return _0x421b9f;})[_0xe9f3('0x24')](respondWithFilteredResult(_0x2a8e22,_0x489ff2))[_0xe9f3('0x42')](handleError(_0x2a8e22,null));};exports['show']=function(_0x2660c7,_0x17ef05){var _0x502e57={'raw':![],'where':{'id':_0x2660c7[_0xe9f3('0x43')]['id']}},_0x4332e1={};_0x4332e1['model']=_[_0xe9f3('0x30')](db[_0xe9f3('0x2a')]['rawAttributes']);_0x4332e1[_0xe9f3('0x2f')]=_[_0xe9f3('0x30')](_0x2660c7[_0xe9f3('0x2f')]);_0x4332e1[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x4332e1[_0xe9f3('0x33')],_0x4332e1[_0xe9f3('0x2f')]);_0x502e57[_0xe9f3('0x35')]=_['intersection'](_0x4332e1['model'],qs['fields'](_0x2660c7[_0xe9f3('0x2f')][_0xe9f3('0x34')]));_0x502e57[_0xe9f3('0x35')]=_0x502e57['attributes'][_0xe9f3('0x36')]?_0x502e57[_0xe9f3('0x35')]:_0x4332e1[_0xe9f3('0x33')];if(_0x2660c7[_0xe9f3('0x2f')][_0xe9f3('0x3f')]){_0x502e57[_0xe9f3('0x40')]=[{'all':!![]}];}_0x502e57=_[_0xe9f3('0x3d')]({},_0x502e57,_0x2660c7[_0xe9f3('0x3e')]);return db['VtigerConfiguration'][_0xe9f3('0x44')](_0x502e57)[_0xe9f3('0x24')](handleEntityNotFound(_0x17ef05,null))['then'](respondWithResult(_0x17ef05,null))['catch'](handleError(_0x17ef05,null));};exports[_0xe9f3('0x45')]=function(_0x5e2969,_0x3cd2d7){return db[_0xe9f3('0x2a')]['create'](_0x5e2969['body'],{})['then'](respondWithResult(_0x3cd2d7,0xc9))['catch'](handleError(_0x3cd2d7,null));};exports[_0xe9f3('0x23')]=function(_0x130c2b,_0x446d8d){if(_0x130c2b[_0xe9f3('0x46')]['id']){delete _0x130c2b['body']['id'];}return db[_0xe9f3('0x2a')][_0xe9f3('0x44')]({'where':{'id':_0x130c2b['params']['id']}})['then'](handleEntityNotFound(_0x446d8d,null))[_0xe9f3('0x24')](saveUpdates(_0x130c2b[_0xe9f3('0x46')],null))[_0xe9f3('0x24')](respondWithResult(_0x446d8d,null))[_0xe9f3('0x42')](handleError(_0x446d8d,null));};exports[_0xe9f3('0x47')]=function(_0xa2f83f,_0x51d208){return db[_0xe9f3('0x2a')][_0xe9f3('0x44')]({'where':{'id':_0xa2f83f['params']['id']}})[_0xe9f3('0x24')](handleEntityNotFound(_0x51d208,null))[_0xe9f3('0x24')](removeEntity(_0x51d208,null))[_0xe9f3('0x42')](handleError(_0x51d208,null));};exports[_0xe9f3('0x48')]=function(_0x8114c8,_0x11411a,_0x1c376f){var _0x1a3365={};var _0x10113f={};var _0x24b574;var _0x5ccc4f;return db[_0xe9f3('0x2a')][_0xe9f3('0x49')]({'where':{'id':_0x8114c8[_0xe9f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x11411a,null))[_0xe9f3('0x24')](function(_0x249c16){if(_0x249c16){_0x24b574=_0x249c16;_0x10113f[_0xe9f3('0x33')]=_['keys'](db[_0xe9f3('0x4a')][_0xe9f3('0x2b')]);_0x10113f[_0xe9f3('0x2f')]=_[_0xe9f3('0x30')](_0x8114c8[_0xe9f3('0x2f')]);_0x10113f[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x10113f[_0xe9f3('0x33')],_0x10113f[_0xe9f3('0x2f')]);_0x1a3365[_0xe9f3('0x35')]=_[_0xe9f3('0x32')](_0x10113f['model'],qs[_0xe9f3('0x34')](_0x8114c8[_0xe9f3('0x2f')][_0xe9f3('0x34')]));_0x1a3365[_0xe9f3('0x35')]=_0x1a3365[_0xe9f3('0x35')][_0xe9f3('0x36')]?_0x1a3365[_0xe9f3('0x35')]:_0x10113f['model'];_0x1a3365[_0xe9f3('0x38')]=qs[_0xe9f3('0x39')](_0x8114c8[_0xe9f3('0x2f')]['sort']);_0x1a3365[_0xe9f3('0x3a')]=qs[_0xe9f3('0x31')](_['pick'](_0x8114c8['query'],_0x10113f['filters']));if(_0x8114c8[_0xe9f3('0x2f')][_0xe9f3('0x3c')]){_0x1a3365[_0xe9f3('0x3a')]=_[_0xe9f3('0x3d')](_0x1a3365[_0xe9f3('0x3a')],{'$or':_[_0xe9f3('0x29')](_0x1a3365[_0xe9f3('0x35')],function(_0x5267c6){var _0xdba122={};_0xdba122[_0x5267c6]={'$like':'%'+_0x8114c8[_0xe9f3('0x2f')][_0xe9f3('0x3c')]+'%'};return _0xdba122;})});}_0x1a3365=_[_0xe9f3('0x3d')]({},_0x1a3365,_0x8114c8[_0xe9f3('0x3e')]);return _0x24b574[_0xe9f3('0x48')](_0x1a3365);}})[_0xe9f3('0x24')](function(_0x59986c){if(_0x59986c){_0x5ccc4f=_0x59986c[_0xe9f3('0x36')];if(!_0x8114c8['query']['hasOwnProperty'](_0xe9f3('0x4b'))){_0x1a3365[_0xe9f3('0x1c')]=qs['limit'](_0x8114c8[_0xe9f3('0x2f')]['limit']);_0x1a3365[_0xe9f3('0x37')]=qs['offset'](_0x8114c8[_0xe9f3('0x2f')]['offset']);}return _0x24b574[_0xe9f3('0x48')](_0x1a3365);}})[_0xe9f3('0x24')](function(_0x3aec72){if(_0x3aec72){return _0x3aec72?{'count':_0x5ccc4f,'rows':_0x3aec72}:null;}})[_0xe9f3('0x24')](respondWithResult(_0x11411a,null))[_0xe9f3('0x42')](handleError(_0x11411a,null));};exports[_0xe9f3('0x4c')]=function(_0xe3bb87,_0xd21631,_0x328780){var _0x1f0d1d={};var _0x573cf1={};var _0xe9007b;var _0x57e2fc;return db[_0xe9f3('0x2a')][_0xe9f3('0x49')]({'where':{'id':_0xe3bb87[_0xe9f3('0x43')]['id']}})[_0xe9f3('0x24')](handleEntityNotFound(_0xd21631,null))[_0xe9f3('0x24')](function(_0x11e117){if(_0x11e117){_0xe9007b=_0x11e117;_0x573cf1['model']=_[_0xe9f3('0x30')](db[_0xe9f3('0x4a')]['rawAttributes']);_0x573cf1['query']=_[_0xe9f3('0x30')](_0xe3bb87[_0xe9f3('0x2f')]);_0x573cf1[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x573cf1[_0xe9f3('0x33')],_0x573cf1[_0xe9f3('0x2f')]);_0x1f0d1d[_0xe9f3('0x35')]=_[_0xe9f3('0x32')](_0x573cf1[_0xe9f3('0x33')],qs[_0xe9f3('0x34')](_0xe3bb87[_0xe9f3('0x2f')][_0xe9f3('0x34')]));_0x1f0d1d['attributes']=_0x1f0d1d[_0xe9f3('0x35')][_0xe9f3('0x36')]?_0x1f0d1d[_0xe9f3('0x35')]:_0x573cf1[_0xe9f3('0x33')];_0x1f0d1d[_0xe9f3('0x38')]=qs[_0xe9f3('0x39')](_0xe3bb87[_0xe9f3('0x2f')]['sort']);_0x1f0d1d[_0xe9f3('0x3a')]=qs[_0xe9f3('0x31')](_['pick'](_0xe3bb87[_0xe9f3('0x2f')],_0x573cf1[_0xe9f3('0x31')]));if(_0xe3bb87['query'][_0xe9f3('0x3c')]){_0x1f0d1d[_0xe9f3('0x3a')]=_[_0xe9f3('0x3d')](_0x1f0d1d[_0xe9f3('0x3a')],{'$or':_['map'](_0x1f0d1d[_0xe9f3('0x35')],function(_0x26c8d4){var _0x3eff1b={};_0x3eff1b[_0x26c8d4]={'$like':'%'+_0xe3bb87['query'][_0xe9f3('0x3c')]+'%'};return _0x3eff1b;})});}_0x1f0d1d=_[_0xe9f3('0x3d')]({},_0x1f0d1d,_0xe3bb87[_0xe9f3('0x3e')]);return _0xe9007b[_0xe9f3('0x4c')](_0x1f0d1d);}})[_0xe9f3('0x24')](function(_0x40911e){if(_0x40911e){_0x57e2fc=_0x40911e[_0xe9f3('0x36')];if(!_0xe3bb87[_0xe9f3('0x2f')][_0xe9f3('0x4d')]('nolimit')){_0x1f0d1d[_0xe9f3('0x1c')]=qs[_0xe9f3('0x1c')](_0xe3bb87[_0xe9f3('0x2f')]['limit']);_0x1f0d1d[_0xe9f3('0x37')]=qs[_0xe9f3('0x37')](_0xe3bb87[_0xe9f3('0x2f')]['offset']);}return _0xe9007b[_0xe9f3('0x4c')](_0x1f0d1d);}})[_0xe9f3('0x24')](function(_0x2732cd){if(_0x2732cd){return _0x2732cd?{'count':_0x57e2fc,'rows':_0x2732cd}:null;}})[_0xe9f3('0x24')](respondWithResult(_0xd21631,null))[_0xe9f3('0x42')](handleError(_0xd21631,null));};exports[_0xe9f3('0x4e')]=function(_0xc60512,_0x11d6bc,_0x442cb4){var _0x3bdee7={};var _0x4337f4={};var _0x244584;var _0x30e048;return db[_0xe9f3('0x2a')][_0xe9f3('0x49')]({'where':{'id':_0xc60512[_0xe9f3('0x43')]['id']}})[_0xe9f3('0x24')](handleEntityNotFound(_0x11d6bc,null))[_0xe9f3('0x24')](function(_0x5ac835){if(_0x5ac835){_0x244584=_0x5ac835;_0x4337f4[_0xe9f3('0x33')]=_[_0xe9f3('0x30')](db[_0xe9f3('0x4a')][_0xe9f3('0x2b')]);_0x4337f4[_0xe9f3('0x2f')]=_[_0xe9f3('0x30')](_0xc60512['query']);_0x4337f4[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x4337f4[_0xe9f3('0x33')],_0x4337f4[_0xe9f3('0x2f')]);_0x3bdee7[_0xe9f3('0x35')]=_['intersection'](_0x4337f4[_0xe9f3('0x33')],qs[_0xe9f3('0x34')](_0xc60512[_0xe9f3('0x2f')][_0xe9f3('0x34')]));_0x3bdee7[_0xe9f3('0x35')]=_0x3bdee7[_0xe9f3('0x35')][_0xe9f3('0x36')]?_0x3bdee7[_0xe9f3('0x35')]:_0x4337f4[_0xe9f3('0x33')];_0x3bdee7[_0xe9f3('0x38')]=qs[_0xe9f3('0x39')](_0xc60512[_0xe9f3('0x2f')][_0xe9f3('0x39')]);_0x3bdee7[_0xe9f3('0x3a')]=qs['filters'](_[_0xe9f3('0x3b')](_0xc60512[_0xe9f3('0x2f')],_0x4337f4[_0xe9f3('0x31')]));if(_0xc60512[_0xe9f3('0x2f')]['filter']){_0x3bdee7['where']=_['merge'](_0x3bdee7[_0xe9f3('0x3a')],{'$or':_[_0xe9f3('0x29')](_0x3bdee7['attributes'],function(_0x50b9c6){var _0x371c06={};_0x371c06[_0x50b9c6]={'$like':'%'+_0xc60512[_0xe9f3('0x2f')]['filter']+'%'};return _0x371c06;})});}_0x3bdee7=_[_0xe9f3('0x3d')]({},_0x3bdee7,_0xc60512[_0xe9f3('0x3e')]);return _0x244584['getDescriptions'](_0x3bdee7);}})[_0xe9f3('0x24')](function(_0x17ea27){if(_0x17ea27){_0x30e048=_0x17ea27[_0xe9f3('0x36')];if(!_0xc60512[_0xe9f3('0x2f')][_0xe9f3('0x4d')]('nolimit')){_0x3bdee7[_0xe9f3('0x1c')]=qs['limit'](_0xc60512[_0xe9f3('0x2f')]['limit']);_0x3bdee7[_0xe9f3('0x37')]=qs['offset'](_0xc60512['query'][_0xe9f3('0x37')]);}return _0x244584[_0xe9f3('0x4e')](_0x3bdee7);}})['then'](function(_0x571025){if(_0x571025){return _0x571025?{'count':_0x30e048,'rows':_0x571025}:null;}})[_0xe9f3('0x24')](respondWithResult(_0x11d6bc,null))[_0xe9f3('0x42')](handleError(_0x11d6bc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 03fe906..ce56553 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 _0x57f5=['VtigerConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x529c1a,_0x204539){var _0x1186f6=function(_0x503801){while(--_0x503801){_0x529c1a['push'](_0x529c1a['shift']());}};_0x1186f6(++_0x204539);}(_0x57f5,0x181));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x557f('0x0'));var util=require(_0x557f('0x1'));var logger=require(_0x557f('0x2'))(_0x557f('0x3'));var moment=require('moment');var BPromise=require(_0x557f('0x4'));var rp=require(_0x557f('0x5'));var fs=require('fs');var path=require(_0x557f('0x6'));var rimraf=require(_0x557f('0x7'));var config=require(_0x557f('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x557f('0x9')]=function(_0x8e37be,_0x165340){return _0x8e37be[_0x557f('0xa')](_0x557f('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23e4=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x2e925b,_0x41e46f){var _0x4332f8=function(_0x42a0ab){while(--_0x42a0ab){_0x2e925b['push'](_0x2e925b['shift']());}};_0x4332f8(++_0x41e46f);}(_0x23e4,0xc4));var _0x423e=function(_0x46eeca,_0x3e60e6){_0x46eeca=_0x46eeca-0x0;var _0x4f17f5=_0x23e4[_0x46eeca];return _0x4f17f5;};'use strict';var _=require(_0x423e('0x0'));var util=require(_0x423e('0x1'));var logger=require(_0x423e('0x2'))(_0x423e('0x3'));var moment=require('moment');var BPromise=require(_0x423e('0x4'));var rp=require(_0x423e('0x5'));var fs=require('fs');var path=require(_0x423e('0x6'));var rimraf=require(_0x423e('0x7'));var config=require(_0x423e('0x8'));var attributes=require(_0x423e('0x9'));module[_0x423e('0xa')]=function(_0x262bed,_0x3cddd5){return _0x262bed[_0x423e('0xb')](_0x423e('0xc'),attributes,{'tableName':_0x423e('0xd'),'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 0005770..5e73268 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 _0x5fad=['request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xa398c6,_0x1328b6){var _0x1597bc=function(_0x2d7c70){while(--_0x2d7c70){_0xa398c6['push'](_0xa398c6['shift']());}};_0x1597bc(++_0x1328b6);}(_0x5fad,0x11a));var _0xd5fa=function(_0x5e9ae0,_0x16b4bb){_0x5e9ae0=_0x5e9ae0-0x0;var _0x204d50=_0x5fad[_0x5e9ae0];return _0x204d50;};'use strict';var _=require(_0xd5fa('0x0'));var util=require(_0xd5fa('0x1'));var moment=require(_0xd5fa('0x2'));var BPromise=require(_0xd5fa('0x3'));var rs=require(_0xd5fa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5fa('0x5'))['db'];var utils=require(_0xd5fa('0x6'));var logger=require(_0xd5fa('0x7'))(_0xd5fa('0x8'));var config=require(_0xd5fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd5fa('0xa')][_0xd5fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x565422,_0x145a24,_0x1c93d5){return new BPromise(function(_0x3281b2,_0x132dfc){return client[_0xd5fa('0xc')](_0x565422,_0x1c93d5)['then'](function(_0x1c85a8){logger[_0xd5fa('0xd')](_0xd5fa('0xe'),_0x145a24,_0xd5fa('0xf'));logger[_0xd5fa('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x145a24,_0xd5fa('0xf'),JSON['stringify'](_0x1c85a8));if(_0x1c85a8[_0xd5fa('0x11')]){if(_0x1c85a8[_0xd5fa('0x11')][_0xd5fa('0x12')]===0x1f4){logger['error'](_0xd5fa('0xe'),_0x145a24,_0x1c85a8[_0xd5fa('0x11')][_0xd5fa('0x13')]);return _0x132dfc(_0x1c85a8[_0xd5fa('0x11')]['message']);}logger[_0xd5fa('0x11')](_0xd5fa('0xe'),_0x145a24,_0x1c85a8[_0xd5fa('0x11')][_0xd5fa('0x13')]);return _0x3281b2(_0x1c85a8[_0xd5fa('0x11')][_0xd5fa('0x13')]);}else{logger[_0xd5fa('0xd')](_0xd5fa('0xe'),_0x145a24,_0xd5fa('0xf'));_0x3281b2(_0x1c85a8[_0xd5fa('0x14')][_0xd5fa('0x13')]);}})['catch'](function(_0x2e89bc){logger[_0xd5fa('0x11')](_0xd5fa('0xe'),_0x145a24,_0x2e89bc);_0x132dfc(_0x2e89bc);});});} \ No newline at end of file +var _0xce12=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xce12,0xe4));var _0x2ce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce12[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2ce1('0x0'));var util=require(_0x2ce1('0x1'));var moment=require('moment');var BPromise=require(_0x2ce1('0x2'));var rs=require(_0x2ce1('0x3'));var fs=require('fs');var Redis=require(_0x2ce1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ce1('0x5'));var logger=require(_0x2ce1('0x6'))('rpc');var config=require(_0x2ce1('0x7'));var jayson=require(_0x2ce1('0x8'));var client=jayson[_0x2ce1('0x9')][_0x2ce1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398dff,_0x2ff473,_0x4820af){return new BPromise(function(_0x48c5f6,_0x2540e2){return client['request'](_0x398dff,_0x4820af)[_0x2ce1('0xb')](function(_0x160fa4){logger[_0x2ce1('0xc')](_0x2ce1('0xd'),_0x2ff473,_0x2ce1('0xe'));logger[_0x2ce1('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2ff473,_0x2ce1('0xe'),JSON[_0x2ce1('0x10')](_0x160fa4));if(_0x160fa4['error']){if(_0x160fa4[_0x2ce1('0x11')][_0x2ce1('0x12')]===0x1f4){logger[_0x2ce1('0x11')](_0x2ce1('0xd'),_0x2ff473,_0x160fa4[_0x2ce1('0x11')][_0x2ce1('0x13')]);return _0x2540e2(_0x160fa4[_0x2ce1('0x11')][_0x2ce1('0x13')]);}logger[_0x2ce1('0x11')](_0x2ce1('0xd'),_0x2ff473,_0x160fa4[_0x2ce1('0x11')][_0x2ce1('0x13')]);return _0x48c5f6(_0x160fa4['error'][_0x2ce1('0x13')]);}else{logger[_0x2ce1('0xc')](_0x2ce1('0xd'),_0x2ff473,_0x2ce1('0xe'));_0x48c5f6(_0x160fa4[_0x2ce1('0x14')][_0x2ce1('0x13')]);}})[_0x2ce1('0x15')](function(_0x3fbea6){logger[_0x2ce1('0x11')](_0x2ce1('0xd'),_0x2ff473,_0x3fbea6);_0x2540e2(_0x3fbea6);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 8e2f47e..800d453 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 _0x1473=['isAuthenticated','index','/:id','show','post','create','put','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1473,0x14b));var _0x3147=function(_0x54064a,_0x28ec22){_0x54064a=_0x54064a-0x0;var _0xccdaea=_0x1473[_0x54064a];return _0xccdaea;};'use strict';var multer=require('multer');var util=require(_0x3147('0x0'));var path=require(_0x3147('0x1'));var timeout=require(_0x3147('0x2'));var express=require('express');var router=express[_0x3147('0x3')]();var fs_extra=require(_0x3147('0x4'));var auth=require(_0x3147('0x5'));var interaction=require(_0x3147('0x6'));var config=require('../../config/environment');var controller=require(_0x3147('0x7'));router[_0x3147('0x8')]('/',auth[_0x3147('0x9')](),controller[_0x3147('0xa')]);router[_0x3147('0x8')](_0x3147('0xb'),auth[_0x3147('0x9')](),controller[_0x3147('0xc')]);router[_0x3147('0xd')]('/',auth[_0x3147('0x9')](),controller[_0x3147('0xe')]);router[_0x3147('0xf')](_0x3147('0xb'),auth[_0x3147('0x9')](),controller['update']);router['delete'](_0x3147('0xb'),auth[_0x3147('0x9')](),controller[_0x3147('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5752=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','show','post','create','put','/:id','isAuthenticated','delete'];(function(_0x7c4213,_0x241d50){var _0xfcf346=function(_0x3a8f8f){while(--_0x3a8f8f){_0x7c4213['push'](_0x7c4213['shift']());}};_0xfcf346(++_0x241d50);}(_0x5752,0x87));var _0x2575=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5752[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x2575('0x0'));var util=require(_0x2575('0x1'));var path=require(_0x2575('0x2'));var timeout=require(_0x2575('0x3'));var express=require('express');var router=express[_0x2575('0x4')]();var fs_extra=require(_0x2575('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2575('0x6'));var config=require(_0x2575('0x7'));var controller=require('./intVtigerField.controller');router[_0x2575('0x8')]('/',auth['isAuthenticated'](),controller[_0x2575('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2575('0xa')]);router[_0x2575('0xb')]('/',auth['isAuthenticated'](),controller[_0x2575('0xc')]);router[_0x2575('0xd')](_0x2575('0xe'),auth[_0x2575('0xf')](),controller['update']);router[_0x2575('0x10')](_0x2575('0xe'),auth[_0x2575('0xf')](),controller[_0x2575('0x11')]);module[_0x2575('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 28fb51e..b725889 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 _0x8275=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x27b2c7,_0x3c39e2){var _0x3ae168=function(_0x183ad8){while(--_0x183ad8){_0x27b2c7['push'](_0x27b2c7['shift']());}};_0x3ae168(++_0x3c39e2);}(_0x8275,0x176));var _0x5827=function(_0x2a5864,_0x2b9396){_0x2a5864=_0x2a5864-0x0;var _0x490ab6=_0x8275[_0x2a5864];return _0x490ab6;};'use strict';var Sequelize=require(_0x5827('0x0'));module[_0x5827('0x1')]={'type':{'type':Sequelize[_0x5827('0x2')](_0x5827('0x3'),_0x5827('0x4'),_0x5827('0x5'),_0x5827('0x6'),_0x5827('0x7')),'defaultValue':_0x5827('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5827('0x8')]},'keyType':{'type':Sequelize[_0x5827('0x2')](_0x5827('0x3'),_0x5827('0x4'),_0x5827('0x5'))},'keyContent':{'type':Sequelize[_0x5827('0x8')]},'idField':{'type':Sequelize[_0x5827('0x8')]},'nameField':{'type':Sequelize[_0x5827('0x8')]},'customField':{'type':Sequelize[_0x5827('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5827('0x8')]}}; \ No newline at end of file +var _0x801b=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x418735,_0x2eb119){var _0x426f2a=function(_0x28cf26){while(--_0x28cf26){_0x418735['push'](_0x418735['shift']());}};_0x426f2a(++_0x2eb119);}(_0x801b,0xe4));var _0xb801=function(_0x9c1f73,_0x5941c4){_0x9c1f73=_0x9c1f73-0x0;var _0x526d3a=_0x801b[_0x9c1f73];return _0x526d3a;};'use strict';var Sequelize=require(_0xb801('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb801('0x1'),_0xb801('0x2'),_0xb801('0x3'),'keyValue',_0xb801('0x4')),'defaultValue':_0xb801('0x1')},'content':{'type':Sequelize[_0xb801('0x5')]},'key':{'type':Sequelize[_0xb801('0x5')]},'keyType':{'type':Sequelize[_0xb801('0x6')](_0xb801('0x1'),_0xb801('0x2'),_0xb801('0x3'))},'keyContent':{'type':Sequelize[_0xb801('0x5')]},'idField':{'type':Sequelize[_0xb801('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb801('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb801('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3244481..696df92 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 _0xbf7e=['rows','catch','show','params','create','body','find','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VtigerField','include','findAll'];(function(_0x4a26a1,_0xa25d81){var _0x30d475=function(_0x5bba0e){while(--_0x5bba0e){_0x4a26a1['push'](_0x4a26a1['shift']());}};_0x30d475(++_0xa25d81);}(_0xbf7e,0x11f));var _0xebf7=function(_0xffb623,_0x3ecb92){_0xffb623=_0xffb623-0x0;var _0x3adda6=_0xbf7e[_0xffb623];return _0x3adda6;};'use strict';var emlformat=require(_0xebf7('0x0'));var rimraf=require(_0xebf7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xebf7('0x2'));var Mustache=require(_0xebf7('0x3'));var util=require(_0xebf7('0x4'));var path=require('path');var sox=require(_0xebf7('0x5'));var csv=require(_0xebf7('0x6'));var ejs=require(_0xebf7('0x7'));var fs=require('fs');var fs_extra=require(_0xebf7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xebf7('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xebf7('0x6'));var querystring=require('querystring');var Papa=require(_0xebf7('0xa'));var Redis=require('ioredis');var authService=require(_0xebf7('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xebf7('0xc'));var hardwareService=require(_0xebf7('0xd'));var logger=require(_0xebf7('0xe'))(_0xebf7('0xf'));var utils=require(_0xebf7('0x10'));var config=require(_0xebf7('0x11'));var licenseUtil=require(_0xebf7('0x12'));var db=require(_0xebf7('0x13'))['db'];function respondWithStatusCode(_0x282009,_0x215d80){_0x215d80=_0x215d80||0xcc;return function(_0x873424){if(_0x873424){return _0x282009[_0xebf7('0x14')](_0x215d80);}return _0x282009['status'](_0x215d80)[_0xebf7('0x15')]();};}function respondWithResult(_0xeafd76,_0x499ad3){_0x499ad3=_0x499ad3||0xc8;return function(_0x10ef72){if(_0x10ef72){return _0xeafd76[_0xebf7('0x16')](_0x499ad3)[_0xebf7('0x17')](_0x10ef72);}};}function respondWithFilteredResult(_0x4f5107,_0x29f8e9){return function(_0x19490b){if(_0x19490b){var _0xc36f4=typeof _0x29f8e9[_0xebf7('0x18')]===_0xebf7('0x19')&&typeof _0x29f8e9[_0xebf7('0x1a')]===_0xebf7('0x19');var _0x540d5a=_0x19490b[_0xebf7('0x1b')];var _0x49243c=_0xc36f4?0x0:_0x29f8e9['offset'];var _0x516c17=_0xc36f4?_0x19490b['count']:_0x29f8e9[_0xebf7('0x18')]+_0x29f8e9[_0xebf7('0x1a')];var _0x499d71;if(_0x516c17>=_0x540d5a){_0x516c17=_0x540d5a;_0x499d71=0xc8;}else{_0x499d71=0xce;}_0x4f5107['status'](_0x499d71);return _0x4f5107['set'](_0xebf7('0x1c'),_0x49243c+'-'+_0x516c17+'/'+_0x540d5a)[_0xebf7('0x17')](_0x19490b);}return null;};}function patchUpdates(_0x5a346f){return function(_0x28917b){try{jsonpatch[_0xebf7('0x1d')](_0x28917b,_0x5a346f,!![]);}catch(_0x5875ef){return BPromise[_0xebf7('0x1e')](_0x5875ef);}return _0x28917b[_0xebf7('0x1f')]();};}function saveUpdates(_0x1e5efa,_0x3aae66){return function(_0x494d5f){if(_0x494d5f){return _0x494d5f[_0xebf7('0x20')](_0x1e5efa)[_0xebf7('0x21')](function(_0x20af2c){return _0x20af2c;});}return null;};}function removeEntity(_0x1ee747,_0x114dbd){return function(_0x5e74c3){if(_0x5e74c3){return _0x5e74c3[_0xebf7('0x22')]()[_0xebf7('0x21')](function(){_0x1ee747[_0xebf7('0x16')](0xcc)[_0xebf7('0x15')]();});}};}function handleEntityNotFound(_0xa3e7a3,_0x24dd2c){return function(_0x401d18){if(!_0x401d18){_0xa3e7a3['sendStatus'](0x194);}return _0x401d18;};}function handleError(_0x7b42af,_0x6a73d8){_0x6a73d8=_0x6a73d8||0x1f4;return function(_0x5d834d){logger[_0xebf7('0x23')](_0x5d834d['stack']);if(_0x5d834d[_0xebf7('0x24')]){delete _0x5d834d['name'];}_0x7b42af[_0xebf7('0x16')](_0x6a73d8)[_0xebf7('0x25')](_0x5d834d);};}exports[_0xebf7('0x26')]=function(_0x54ff9a,_0x1ffbb9){var _0x3769c0={},_0x432d42={},_0x91db1b={'count':0x0,'rows':[]};var _0x36728d=_['map'](db['VtigerField'][_0xebf7('0x27')],function(_0x31185c){return{'name':_0x31185c[_0xebf7('0x28')],'type':_0x31185c[_0xebf7('0x29')][_0xebf7('0x2a')]};});_0x432d42['model']=_[_0xebf7('0x2b')](_0x36728d,'name');_0x432d42[_0xebf7('0x2c')]=_[_0xebf7('0x2d')](_0x54ff9a[_0xebf7('0x2c')]);_0x432d42[_0xebf7('0x2e')]=_[_0xebf7('0x2f')](_0x432d42['model'],_0x432d42[_0xebf7('0x2c')]);_0x3769c0[_0xebf7('0x30')]=_[_0xebf7('0x2f')](_0x432d42['model'],qs[_0xebf7('0x31')](_0x54ff9a[_0xebf7('0x2c')][_0xebf7('0x31')]));_0x3769c0[_0xebf7('0x30')]=_0x3769c0[_0xebf7('0x30')][_0xebf7('0x32')]?_0x3769c0[_0xebf7('0x30')]:_0x432d42[_0xebf7('0x33')];if(!_0x54ff9a[_0xebf7('0x2c')][_0xebf7('0x34')](_0xebf7('0x35'))){_0x3769c0[_0xebf7('0x1a')]=qs[_0xebf7('0x1a')](_0x54ff9a[_0xebf7('0x2c')]['limit']);_0x3769c0[_0xebf7('0x18')]=qs[_0xebf7('0x18')](_0x54ff9a['query']['offset']);}_0x3769c0[_0xebf7('0x36')]=qs[_0xebf7('0x37')](_0x54ff9a['query'][_0xebf7('0x37')]);_0x3769c0[_0xebf7('0x38')]=qs['filters'](_['pick'](_0x54ff9a[_0xebf7('0x2c')],_0x432d42['filters']),_0x36728d);if(_0x54ff9a[_0xebf7('0x2c')][_0xebf7('0x39')]){_0x3769c0['where']=_[_0xebf7('0x3a')](_0x3769c0[_0xebf7('0x38')],{'$or':_[_0xebf7('0x2b')](_0x36728d,function(_0x546a69){if(_0x546a69[_0xebf7('0x29')]!==_0xebf7('0x3b')){var _0x4c5ccc={};_0x4c5ccc[_0x546a69[_0xebf7('0x24')]]={'$like':'%'+_0x54ff9a[_0xebf7('0x2c')][_0xebf7('0x39')]+'%'};return _0x4c5ccc;}})});}_0x3769c0=_['merge']({},_0x3769c0,_0x54ff9a['options']);var _0x4ddefc={'where':_0x3769c0[_0xebf7('0x38')]};return db[_0xebf7('0x3c')]['count'](_0x4ddefc)[_0xebf7('0x21')](function(_0x439aab){_0x91db1b['count']=_0x439aab;if(_0x54ff9a[_0xebf7('0x2c')]['includeAll']){_0x3769c0[_0xebf7('0x3d')]=[{'all':!![]}];}return db['VtigerField'][_0xebf7('0x3e')](_0x3769c0);})[_0xebf7('0x21')](function(_0x3becae){_0x91db1b[_0xebf7('0x3f')]=_0x3becae;return _0x91db1b;})[_0xebf7('0x21')](respondWithFilteredResult(_0x1ffbb9,_0x3769c0))[_0xebf7('0x40')](handleError(_0x1ffbb9,null));};exports[_0xebf7('0x41')]=function(_0x171f28,_0x2e9f4c){var _0x565932={'raw':!![],'where':{'id':_0x171f28[_0xebf7('0x42')]['id']}},_0x4fba90={};_0x4fba90[_0xebf7('0x33')]=_[_0xebf7('0x2d')](db[_0xebf7('0x3c')][_0xebf7('0x27')]);_0x4fba90[_0xebf7('0x2c')]=_[_0xebf7('0x2d')](_0x171f28['query']);_0x4fba90['filters']=_[_0xebf7('0x2f')](_0x4fba90[_0xebf7('0x33')],_0x4fba90[_0xebf7('0x2c')]);_0x565932[_0xebf7('0x30')]=_['intersection'](_0x4fba90[_0xebf7('0x33')],qs[_0xebf7('0x31')](_0x171f28[_0xebf7('0x2c')]['fields']));_0x565932[_0xebf7('0x30')]=_0x565932[_0xebf7('0x30')]['length']?_0x565932['attributes']:_0x4fba90[_0xebf7('0x33')];if(_0x171f28[_0xebf7('0x2c')]['includeAll']){_0x565932['include']=[{'all':!![]}];}_0x565932=_[_0xebf7('0x3a')]({},_0x565932,_0x171f28['options']);return db[_0xebf7('0x3c')]['find'](_0x565932)[_0xebf7('0x21')](handleEntityNotFound(_0x2e9f4c,null))[_0xebf7('0x21')](respondWithResult(_0x2e9f4c,null))[_0xebf7('0x40')](handleError(_0x2e9f4c,null));};exports[_0xebf7('0x43')]=function(_0x289994,_0x4603d5){return db['VtigerField']['create'](_0x289994[_0xebf7('0x44')],{})[_0xebf7('0x21')](respondWithResult(_0x4603d5,0xc9))[_0xebf7('0x40')](handleError(_0x4603d5,null));};exports[_0xebf7('0x20')]=function(_0x99998e,_0xdfc1d9){if(_0x99998e[_0xebf7('0x44')]['id']){delete _0x99998e[_0xebf7('0x44')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x99998e['params']['id']}})[_0xebf7('0x21')](handleEntityNotFound(_0xdfc1d9,null))[_0xebf7('0x21')](saveUpdates(_0x99998e['body'],null))['then'](respondWithResult(_0xdfc1d9,null))['catch'](handleError(_0xdfc1d9,null));};exports[_0xebf7('0x22')]=function(_0x478404,_0x48895e){return db[_0xebf7('0x3c')][_0xebf7('0x45')]({'where':{'id':_0x478404[_0xebf7('0x42')]['id']}})[_0xebf7('0x21')](handleEntityNotFound(_0x48895e,null))[_0xebf7('0x21')](removeEntity(_0x48895e,null))[_0xebf7('0x40')](handleError(_0x48895e,null));}; \ No newline at end of file +var _0xb4af=['name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4af,0x1a5));var _0xfb4a=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb4af[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0xfb4a('0x0'));var rimraf=require(_0xfb4a('0x1'));var zipdir=require(_0xfb4a('0x2'));var jsonpatch=require(_0xfb4a('0x3'));var rp=require(_0xfb4a('0x4'));var moment=require(_0xfb4a('0x5'));var BPromise=require(_0xfb4a('0x6'));var Mustache=require(_0xfb4a('0x7'));var util=require(_0xfb4a('0x8'));var path=require(_0xfb4a('0x9'));var sox=require(_0xfb4a('0xa'));var csv=require(_0xfb4a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb4a('0xc'));var _=require(_0xfb4a('0xd'));var squel=require(_0xfb4a('0xe'));var crypto=require('crypto');var jsforce=require(_0xfb4a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfb4a('0xb'));var querystring=require('querystring');var Papa=require(_0xfb4a('0x10'));var Redis=require('ioredis');var authService=require(_0xfb4a('0x11'));var qs=require(_0xfb4a('0x12'));var as=require(_0xfb4a('0x13'));var hardwareService=require(_0xfb4a('0x14'));var logger=require(_0xfb4a('0x15'))(_0xfb4a('0x16'));var utils=require(_0xfb4a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfb4a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1477a5,_0x152ded){_0x152ded=_0x152ded||0xcc;return function(_0x1275a4){if(_0x1275a4){return _0x1477a5[_0xfb4a('0x19')](_0x152ded);}return _0x1477a5['status'](_0x152ded)[_0xfb4a('0x1a')]();};}function respondWithResult(_0x531ae1,_0x4dd1a7){_0x4dd1a7=_0x4dd1a7||0xc8;return function(_0x3ecbcd){if(_0x3ecbcd){return _0x531ae1[_0xfb4a('0x1b')](_0x4dd1a7)['json'](_0x3ecbcd);}};}function respondWithFilteredResult(_0x543bcd,_0x504b96){return function(_0x2cf4cd){if(_0x2cf4cd){var _0xe62fd=typeof _0x504b96['offset']===_0xfb4a('0x1c')&&typeof _0x504b96[_0xfb4a('0x1d')]===_0xfb4a('0x1c');var _0x53f67e=_0x2cf4cd['count'];var _0x4635cf=_0xe62fd?0x0:_0x504b96[_0xfb4a('0x1e')];var _0x41c5ee=_0xe62fd?_0x2cf4cd[_0xfb4a('0x1f')]:_0x504b96[_0xfb4a('0x1e')]+_0x504b96[_0xfb4a('0x1d')];var _0x5e1c74;if(_0x41c5ee>=_0x53f67e){_0x41c5ee=_0x53f67e;_0x5e1c74=0xc8;}else{_0x5e1c74=0xce;}_0x543bcd[_0xfb4a('0x1b')](_0x5e1c74);return _0x543bcd[_0xfb4a('0x20')](_0xfb4a('0x21'),_0x4635cf+'-'+_0x41c5ee+'/'+_0x53f67e)[_0xfb4a('0x22')](_0x2cf4cd);}return null;};}function patchUpdates(_0x7970b6){return function(_0x4bfbd9){try{jsonpatch[_0xfb4a('0x23')](_0x4bfbd9,_0x7970b6,!![]);}catch(_0xdeb454){return BPromise[_0xfb4a('0x24')](_0xdeb454);}return _0x4bfbd9['save']();};}function saveUpdates(_0x41e3c7,_0x471503){return function(_0x33972c){if(_0x33972c){return _0x33972c[_0xfb4a('0x25')](_0x41e3c7)[_0xfb4a('0x26')](function(_0x50e039){return _0x50e039;});}return null;};}function removeEntity(_0x35f34a,_0x3120cd){return function(_0x88cf1){if(_0x88cf1){return _0x88cf1[_0xfb4a('0x27')]()[_0xfb4a('0x26')](function(){_0x35f34a['status'](0xcc)[_0xfb4a('0x1a')]();});}};}function handleEntityNotFound(_0x5105e1,_0x43d245){return function(_0x3a7076){if(!_0x3a7076){_0x5105e1[_0xfb4a('0x19')](0x194);}return _0x3a7076;};}function handleError(_0x3ed4a3,_0x3a8245){_0x3a8245=_0x3a8245||0x1f4;return function(_0x3b28ff){logger['error'](_0x3b28ff[_0xfb4a('0x28')]);if(_0x3b28ff[_0xfb4a('0x29')]){delete _0x3b28ff[_0xfb4a('0x29')];}_0x3ed4a3[_0xfb4a('0x1b')](_0x3a8245)[_0xfb4a('0x2a')](_0x3b28ff);};}exports[_0xfb4a('0x2b')]=function(_0x3ee030,_0x1ee360){var _0xcc52be={},_0x48becb={},_0x502935={'count':0x0,'rows':[]};var _0x3f43fa=_['map'](db[_0xfb4a('0x2c')][_0xfb4a('0x2d')],function(_0x14de89){return{'name':_0x14de89[_0xfb4a('0x2e')],'type':_0x14de89[_0xfb4a('0x2f')][_0xfb4a('0x30')]};});_0x48becb[_0xfb4a('0x31')]=_[_0xfb4a('0x32')](_0x3f43fa,'name');_0x48becb['query']=_[_0xfb4a('0x33')](_0x3ee030[_0xfb4a('0x34')]);_0x48becb[_0xfb4a('0x35')]=_[_0xfb4a('0x36')](_0x48becb[_0xfb4a('0x31')],_0x48becb[_0xfb4a('0x34')]);_0xcc52be['attributes']=_[_0xfb4a('0x36')](_0x48becb['model'],qs[_0xfb4a('0x37')](_0x3ee030[_0xfb4a('0x34')][_0xfb4a('0x37')]));_0xcc52be[_0xfb4a('0x38')]=_0xcc52be[_0xfb4a('0x38')][_0xfb4a('0x39')]?_0xcc52be[_0xfb4a('0x38')]:_0x48becb[_0xfb4a('0x31')];if(!_0x3ee030[_0xfb4a('0x34')][_0xfb4a('0x3a')](_0xfb4a('0x3b'))){_0xcc52be[_0xfb4a('0x1d')]=qs[_0xfb4a('0x1d')](_0x3ee030['query'][_0xfb4a('0x1d')]);_0xcc52be['offset']=qs[_0xfb4a('0x1e')](_0x3ee030[_0xfb4a('0x34')]['offset']);}_0xcc52be[_0xfb4a('0x3c')]=qs[_0xfb4a('0x3d')](_0x3ee030[_0xfb4a('0x34')][_0xfb4a('0x3d')]);_0xcc52be[_0xfb4a('0x3e')]=qs[_0xfb4a('0x35')](_[_0xfb4a('0x3f')](_0x3ee030['query'],_0x48becb[_0xfb4a('0x35')]),_0x3f43fa);if(_0x3ee030[_0xfb4a('0x34')][_0xfb4a('0x40')]){_0xcc52be[_0xfb4a('0x3e')]=_[_0xfb4a('0x41')](_0xcc52be['where'],{'$or':_[_0xfb4a('0x32')](_0x3f43fa,function(_0x5d8803){if(_0x5d8803[_0xfb4a('0x2f')]!=='VIRTUAL'){var _0x4242a2={};_0x4242a2[_0x5d8803[_0xfb4a('0x29')]]={'$like':'%'+_0x3ee030['query'][_0xfb4a('0x40')]+'%'};return _0x4242a2;}})});}_0xcc52be=_[_0xfb4a('0x41')]({},_0xcc52be,_0x3ee030[_0xfb4a('0x42')]);var _0x3f069d={'where':_0xcc52be[_0xfb4a('0x3e')]};return db[_0xfb4a('0x2c')][_0xfb4a('0x1f')](_0x3f069d)[_0xfb4a('0x26')](function(_0x9b1a69){_0x502935[_0xfb4a('0x1f')]=_0x9b1a69;if(_0x3ee030[_0xfb4a('0x34')]['includeAll']){_0xcc52be[_0xfb4a('0x43')]=[{'all':!![]}];}return db[_0xfb4a('0x2c')][_0xfb4a('0x44')](_0xcc52be);})['then'](function(_0x3614bf){_0x502935[_0xfb4a('0x45')]=_0x3614bf;return _0x502935;})[_0xfb4a('0x26')](respondWithFilteredResult(_0x1ee360,_0xcc52be))['catch'](handleError(_0x1ee360,null));};exports[_0xfb4a('0x46')]=function(_0x3e2ba1,_0x486116){var _0x75c63f={'raw':!![],'where':{'id':_0x3e2ba1[_0xfb4a('0x47')]['id']}},_0x5c53fa={};_0x5c53fa[_0xfb4a('0x31')]=_[_0xfb4a('0x33')](db[_0xfb4a('0x2c')][_0xfb4a('0x2d')]);_0x5c53fa[_0xfb4a('0x34')]=_[_0xfb4a('0x33')](_0x3e2ba1[_0xfb4a('0x34')]);_0x5c53fa[_0xfb4a('0x35')]=_[_0xfb4a('0x36')](_0x5c53fa[_0xfb4a('0x31')],_0x5c53fa['query']);_0x75c63f['attributes']=_['intersection'](_0x5c53fa['model'],qs[_0xfb4a('0x37')](_0x3e2ba1[_0xfb4a('0x34')][_0xfb4a('0x37')]));_0x75c63f[_0xfb4a('0x38')]=_0x75c63f['attributes'][_0xfb4a('0x39')]?_0x75c63f[_0xfb4a('0x38')]:_0x5c53fa[_0xfb4a('0x31')];if(_0x3e2ba1['query'][_0xfb4a('0x48')]){_0x75c63f['include']=[{'all':!![]}];}_0x75c63f=_[_0xfb4a('0x41')]({},_0x75c63f,_0x3e2ba1[_0xfb4a('0x42')]);return db[_0xfb4a('0x2c')][_0xfb4a('0x49')](_0x75c63f)[_0xfb4a('0x26')](handleEntityNotFound(_0x486116,null))[_0xfb4a('0x26')](respondWithResult(_0x486116,null))[_0xfb4a('0x4a')](handleError(_0x486116,null));};exports[_0xfb4a('0x4b')]=function(_0x4f93b8,_0x19fe42){return db[_0xfb4a('0x2c')][_0xfb4a('0x4b')](_0x4f93b8[_0xfb4a('0x4c')],{})[_0xfb4a('0x26')](respondWithResult(_0x19fe42,0xc9))[_0xfb4a('0x4a')](handleError(_0x19fe42,null));};exports['update']=function(_0xce9ea0,_0x2467fd){if(_0xce9ea0['body']['id']){delete _0xce9ea0[_0xfb4a('0x4c')]['id'];}return db['VtigerField'][_0xfb4a('0x49')]({'where':{'id':_0xce9ea0[_0xfb4a('0x47')]['id']}})[_0xfb4a('0x26')](handleEntityNotFound(_0x2467fd,null))['then'](saveUpdates(_0xce9ea0[_0xfb4a('0x4c')],null))[_0xfb4a('0x26')](respondWithResult(_0x2467fd,null))[_0xfb4a('0x4a')](handleError(_0x2467fd,null));};exports[_0xfb4a('0x27')]=function(_0x3625a9,_0x50cf5c){return db[_0xfb4a('0x2c')][_0xfb4a('0x49')]({'where':{'id':_0x3625a9[_0xfb4a('0x47')]['id']}})[_0xfb4a('0x26')](handleEntityNotFound(_0x50cf5c,null))['then'](removeEntity(_0x50cf5c,null))[_0xfb4a('0x4a')](handleError(_0x50cf5c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 60054c5..7e76461 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 _0x2684=['bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','util','../../config/logger','api'];(function(_0x503f4d,_0x476e97){var _0x4ce6d1=function(_0x17b5fc){while(--_0x17b5fc){_0x503f4d['push'](_0x503f4d['shift']());}};_0x4ce6d1(++_0x476e97);}(_0x2684,0xe4));var _0x4268=function(_0xe6b9cd,_0x419eca){_0xe6b9cd=_0xe6b9cd-0x0;var _0x318628=_0x2684[_0xe6b9cd];return _0x318628;};'use strict';var _=require('lodash');var util=require(_0x4268('0x0'));var logger=require(_0x4268('0x1'))(_0x4268('0x2'));var moment=require('moment');var BPromise=require(_0x4268('0x3'));var rp=require(_0x4268('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4268('0x5'));var config=require(_0x4268('0x6'));var attributes=require(_0x4268('0x7'));module[_0x4268('0x8')]=function(_0x1bb1fb,_0x54faf5){return _0x1bb1fb[_0x4268('0x9')]('VtigerField',attributes,{'tableName':_0x4268('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ddf=['bluebird','request-promise','path','../../config/environment','define','int_vtiger_fields','idField','FieldId','lodash','../../config/logger'];(function(_0x59f87d,_0x340b57){var _0x7286e7=function(_0x51ce69){while(--_0x51ce69){_0x59f87d['push'](_0x59f87d['shift']());}};_0x7286e7(++_0x340b57);}(_0x5ddf,0x12a));var _0xf5dd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5ddf[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf5dd('0x0'));var util=require('util');var logger=require(_0xf5dd('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf5dd('0x2'));var rp=require(_0xf5dd('0x3'));var fs=require('fs');var path=require(_0xf5dd('0x4'));var rimraf=require('rimraf');var config=require(_0xf5dd('0x5'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x54ce06,_0x201b3a){return _0x54ce06[_0xf5dd('0x6')]('VtigerField',attributes,{'tableName':_0xf5dd('0x7'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xf5dd('0x8'),_0xf5dd('0x9')],'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 d96437b..a795224 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 _0x92df=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x92df,0x106));var _0xf92d=function(_0x3b2853,_0x3464f6){_0x3b2853=_0x3b2853-0x0;var _0x3f3a72=_0x92df[_0x3b2853];return _0x3f3a72;};'use strict';var _=require(_0xf92d('0x0'));var util=require(_0xf92d('0x1'));var moment=require(_0xf92d('0x2'));var BPromise=require(_0xf92d('0x3'));var rs=require(_0xf92d('0x4'));var fs=require('fs');var Redis=require(_0xf92d('0x5'));var db=require(_0xf92d('0x6'))['db'];var utils=require(_0xf92d('0x7'));var logger=require(_0xf92d('0x8'))(_0xf92d('0x9'));var config=require('../../config/environment');var jayson=require(_0xf92d('0xa'));var client=jayson[_0xf92d('0xb')][_0xf92d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x140c97,_0x3b12c4,_0x2c9c3b){return new BPromise(function(_0x367d95,_0x4ce8c2){return client['request'](_0x140c97,_0x2c9c3b)['then'](function(_0x430755){logger[_0xf92d('0xd')](_0xf92d('0xe'),_0x3b12c4,_0xf92d('0xf'));logger[_0xf92d('0x10')](_0xf92d('0x11'),_0x3b12c4,'request\x20sent',JSON[_0xf92d('0x12')](_0x430755));if(_0x430755[_0xf92d('0x13')]){if(_0x430755['error'][_0xf92d('0x14')]===0x1f4){logger[_0xf92d('0x13')](_0xf92d('0xe'),_0x3b12c4,_0x430755[_0xf92d('0x13')]['message']);return _0x4ce8c2(_0x430755['error'][_0xf92d('0x15')]);}logger[_0xf92d('0x13')](_0xf92d('0xe'),_0x3b12c4,_0x430755['error'][_0xf92d('0x15')]);return _0x367d95(_0x430755[_0xf92d('0x13')][_0xf92d('0x15')]);}else{logger[_0xf92d('0xd')](_0xf92d('0xe'),_0x3b12c4,'request\x20sent');_0x367d95(_0x430755[_0xf92d('0x16')][_0xf92d('0x15')]);}})[_0xf92d('0x17')](function(_0x2a81db){logger[_0xf92d('0x13')](_0xf92d('0xe'),_0x3b12c4,_0x2a81db);_0x4ce8c2(_0x2a81db);});});} \ No newline at end of file +var _0x4493=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x42c7b5,_0x3f2ccf){var _0x3919b2=function(_0x2e04c9){while(--_0x2e04c9){_0x42c7b5['push'](_0x42c7b5['shift']());}};_0x3919b2(++_0x3f2ccf);}(_0x4493,0x1a8));var _0x3449=function(_0x50a76f,_0x392bbf){_0x50a76f=_0x50a76f-0x0;var _0x5b4ce8=_0x4493[_0x50a76f];return _0x5b4ce8;};'use strict';var _=require(_0x3449('0x0'));var util=require(_0x3449('0x1'));var moment=require(_0x3449('0x2'));var BPromise=require('bluebird');var rs=require(_0x3449('0x3'));var fs=require('fs');var Redis=require(_0x3449('0x4'));var db=require(_0x3449('0x5'))['db'];var utils=require(_0x3449('0x6'));var logger=require(_0x3449('0x7'))(_0x3449('0x8'));var config=require(_0x3449('0x9'));var jayson=require(_0x3449('0xa'));var client=jayson[_0x3449('0xb')][_0x3449('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54fb94,_0x3cb92d,_0x298f85){return new BPromise(function(_0x125148,_0x1d064e){return client[_0x3449('0xd')](_0x54fb94,_0x298f85)[_0x3449('0xe')](function(_0x9e211c){logger[_0x3449('0xf')]('VtigerField,\x20%s,\x20%s',_0x3cb92d,_0x3449('0x10'));logger[_0x3449('0x11')](_0x3449('0x12'),_0x3cb92d,_0x3449('0x10'),JSON[_0x3449('0x13')](_0x9e211c));if(_0x9e211c[_0x3449('0x14')]){if(_0x9e211c[_0x3449('0x14')][_0x3449('0x15')]===0x1f4){logger[_0x3449('0x14')](_0x3449('0x16'),_0x3cb92d,_0x9e211c[_0x3449('0x14')][_0x3449('0x17')]);return _0x1d064e(_0x9e211c['error'][_0x3449('0x17')]);}logger[_0x3449('0x14')]('VtigerField,\x20%s,\x20%s',_0x3cb92d,_0x9e211c['error'][_0x3449('0x17')]);return _0x125148(_0x9e211c[_0x3449('0x14')][_0x3449('0x17')]);}else{logger[_0x3449('0xf')]('VtigerField,\x20%s,\x20%s',_0x3cb92d,'request\x20sent');_0x125148(_0x9e211c['result'][_0x3449('0x17')]);}})['catch'](function(_0x15e852){logger['error'](_0x3449('0x16'),_0x3cb92d,_0x15e852);_0x1d064e(_0x15e852);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0dad246..e6e5cf8 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 _0xbabc=['get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x17ffe5,_0x3a9ff6){var _0x933f79=function(_0xb22de5){while(--_0xb22de5){_0x17ffe5['push'](_0x17ffe5['shift']());}};_0x933f79(++_0x3a9ff6);}(_0xbabc,0x1da));var _0xcbab=function(_0x27654d,_0x3fe2e4){_0x27654d=_0x27654d-0x0;var _0x128d1d=_0xbabc[_0x27654d];return _0x128d1d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcbab('0x0'));var timeout=require(_0xcbab('0x1'));var express=require('express');var router=express[_0xcbab('0x2')]();var fs_extra=require(_0xcbab('0x3'));var auth=require(_0xcbab('0x4'));var interaction=require(_0xcbab('0x5'));var config=require(_0xcbab('0x6'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0xcbab('0x7')](),controller[_0xcbab('0x8')]);router[_0xcbab('0x9')](_0xcbab('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xcbab('0xb'),auth[_0xcbab('0x7')](),controller[_0xcbab('0xc')]);router[_0xcbab('0x9')](_0xcbab('0xd'),auth[_0xcbab('0x7')](),controller[_0xcbab('0xe')]);router[_0xcbab('0xf')]('/',auth[_0xcbab('0x7')](),controller[_0xcbab('0x10')]);router[_0xcbab('0xf')]('/:id/configurations',auth[_0xcbab('0x7')](),controller[_0xcbab('0x11')]);router['put']('/:id',auth[_0xcbab('0x7')](),controller['update']);router[_0xcbab('0x12')](_0xcbab('0xa'),auth[_0xcbab('0x7')](),controller[_0xcbab('0x13')]);module[_0xcbab('0x14')]=router; \ No newline at end of file +var _0xa104=['connect-timeout','express','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','create','addConfiguration','update','delete','destroy','multer','util','path'];(function(_0x4fc9cf,_0x5c7c91){var _0x1c1580=function(_0x5d90f0){while(--_0x5d90f0){_0x4fc9cf['push'](_0x4fc9cf['shift']());}};_0x1c1580(++_0x5c7c91);}(_0xa104,0x9d));var _0x4a10=function(_0x5de1cd,_0x188de7){_0x5de1cd=_0x5de1cd-0x0;var _0x201060=_0xa104[_0x5de1cd];return _0x201060;};'use strict';var multer=require(_0x4a10('0x0'));var util=require(_0x4a10('0x1'));var path=require(_0x4a10('0x2'));var timeout=require(_0x4a10('0x3'));var express=require(_0x4a10('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4a10('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4a10('0x6'));var controller=require(_0x4a10('0x7'));router[_0x4a10('0x8')]('/',auth[_0x4a10('0x9')](),controller[_0x4a10('0xa')]);router[_0x4a10('0x8')](_0x4a10('0xb'),auth[_0x4a10('0x9')](),controller[_0x4a10('0xc')]);router[_0x4a10('0x8')](_0x4a10('0xd'),auth[_0x4a10('0x9')](),controller['getConfigurations']);router[_0x4a10('0x8')](_0x4a10('0xe'),auth[_0x4a10('0x9')](),controller['getFields']);router['post']('/',auth[_0x4a10('0x9')](),controller[_0x4a10('0xf')]);router['post']('/:id/configurations',auth[_0x4a10('0x9')](),controller[_0x4a10('0x10')]);router['put']('/:id',auth[_0x4a10('0x9')](),controller[_0x4a10('0x11')]);router[_0x4a10('0x12')](_0x4a10('0xb'),auth[_0x4a10('0x9')](),controller[_0x4a10('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 6681e97..f5d7ecd 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 _0x41ec=['integrationTab','exports','STRING','remoteUri','ENUM','password','token'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x41ec,0x143));var _0xc41e=function(_0x5c8d16,_0x52f604){_0x5c8d16=_0x5c8d16-0x0;var _0x3f51c7=_0x41ec[_0x5c8d16];return _0x3f51c7;};'use strict';var Sequelize=require('sequelize');module[_0xc41e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc41e('0x1')]},'username':{'type':Sequelize[_0xc41e('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xc41e('0x1')]},'token':{'type':Sequelize[_0xc41e('0x1')]},'remoteUri':{'type':Sequelize[_0xc41e('0x1')],'unique':_0xc41e('0x2')},'authType':{'type':Sequelize[_0xc41e('0x3')](_0xc41e('0x4'),_0xc41e('0x5')),'defaultValue':_0xc41e('0x4')},'serverUrl':{'type':Sequelize[_0xc41e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc41e('0x3')](_0xc41e('0x6'),'newTab'),'defaultValue':_0xc41e('0x6')}}; \ No newline at end of file +var _0x7c1a=['integrationTab','sequelize','exports','STRING','username','ENUM','token','password'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x7c1a,0x159));var _0xa7c1=function(_0x3c2dc8,_0x5e165f){_0x3c2dc8=_0x3c2dc8-0x0;var _0x29545e=_0x7c1a[_0x3c2dc8];return _0x29545e;};'use strict';var Sequelize=require(_0xa7c1('0x0'));module[_0xa7c1('0x1')]={'name':{'type':Sequelize[_0xa7c1('0x2')]},'description':{'type':Sequelize[_0xa7c1('0x2')]},'username':{'type':Sequelize[_0xa7c1('0x2')],'unique':_0xa7c1('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa7c1('0x2')]},'remoteUri':{'type':Sequelize[_0xa7c1('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa7c1('0x4')]('password',_0xa7c1('0x5')),'defaultValue':_0xa7c1('0x6')},'serverUrl':{'type':Sequelize[_0xa7c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa7c1('0x4')]('integrationTab','newTab'),'defaultValue':_0xa7c1('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 42fc071..357b70b 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 _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(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0x5eb8,0xb0));var _0x85eb=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0x5eb8[_0xa30766];return _0x24e780;};'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 +var _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x3daac9,_0x5ca67d){_0x3daac9=_0x3daac9-0x0;var _0x1c5e70=_0xbc9d[_0x3daac9];return _0x1c5e70;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4e33f87..68d5256 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 _0x6953=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x738f0a,_0x5c7fcc){var _0x49ba90=function(_0x18067d){while(--_0x18067d){_0x738f0a['push'](_0x738f0a['shift']());}};_0x49ba90(++_0x5c7fcc);}(_0x6953,0xc0));var _0x3695=function(_0x1e747e,_0x1b82bd){_0x1e747e=_0x1e747e-0x0;var _0x3f9ebb=_0x6953[_0x1e747e];return _0x3f9ebb;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')(_0x3695('0x2'));var moment=require(_0x3695('0x3'));var BPromise=require(_0x3695('0x4'));var rp=require(_0x3695('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3695('0x6'));var config=require(_0x3695('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3695('0x8')]=function(_0x2067e4,_0x46f12f){return _0x2067e4[_0x3695('0x9')](_0x3695('0xa'),attributes,{'tableName':_0x3695('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c8b=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x274e0e,_0x2e7080){var _0x4c370f=function(_0x1fedd9){while(--_0x1fedd9){_0x274e0e['push'](_0x274e0e['shift']());}};_0x4c370f(++_0x2e7080);}(_0x6c8b,0x10b));var _0xb6c8=function(_0x2b648e,_0x3b4b3c){_0x2b648e=_0x2b648e-0x0;var _0x48f1c9=_0x6c8b[_0x2b648e];return _0x48f1c9;};'use strict';var _=require(_0xb6c8('0x0'));var util=require(_0xb6c8('0x1'));var logger=require(_0xb6c8('0x2'))(_0xb6c8('0x3'));var moment=require('moment');var BPromise=require(_0xb6c8('0x4'));var rp=require(_0xb6c8('0x5'));var fs=require('fs');var path=require(_0xb6c8('0x6'));var rimraf=require(_0xb6c8('0x7'));var config=require(_0xb6c8('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xb6c8('0x9'));module[_0xb6c8('0xa')]=function(_0x377a1b,_0x3ff6b2){return _0x377a1b[_0xb6c8('0xb')](_0xb6c8('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 7e9174c..b63794d 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 _0x278a=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','catch','ZendeskAccount','raw','options','attributes','limit','include','map','model','info','GetZendeskAccount','stringify','ShowZendeskAccount','find','where'];(function(_0x281684,_0x1eae63){var _0x513920=function(_0x3f80e8){while(--_0x3f80e8){_0x281684['push'](_0x281684['shift']());}};_0x513920(++_0x1eae63);}(_0x278a,0xde));var _0xa278=function(_0x10e0fb,_0x3dfc66){_0x10e0fb=_0x10e0fb-0x0;var _0x23da9d=_0x278a[_0x10e0fb];return _0x23da9d;};'use strict';var _=require(_0xa278('0x0'));var util=require(_0xa278('0x1'));var moment=require(_0xa278('0x2'));var BPromise=require('bluebird');var rs=require(_0xa278('0x3'));var fs=require('fs');var Redis=require(_0xa278('0x4'));var db=require(_0xa278('0x5'))['db'];var utils=require(_0xa278('0x6'));var logger=require(_0xa278('0x7'))(_0xa278('0x8'));var config=require(_0xa278('0x9'));var jayson=require(_0xa278('0xa'));var client=jayson[_0xa278('0xb')][_0xa278('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f3226,_0x35efd5,_0x2237c8){return new BPromise(function(_0x128443,_0x1b64d5){return client['request'](_0x1f3226,_0x2237c8)[_0xa278('0xd')](function(_0x514fe6){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x35efd5,_0xa278('0xe'));logger[_0xa278('0xf')](_0xa278('0x10'),_0x35efd5,_0xa278('0xe'),JSON['stringify'](_0x514fe6));if(_0x514fe6[_0xa278('0x11')]){if(_0x514fe6[_0xa278('0x11')][_0xa278('0x12')]===0x1f4){logger[_0xa278('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x35efd5,_0x514fe6[_0xa278('0x11')][_0xa278('0x13')]);return _0x1b64d5(_0x514fe6['error'][_0xa278('0x13')]);}logger['error'](_0xa278('0x14'),_0x35efd5,_0x514fe6[_0xa278('0x11')][_0xa278('0x13')]);return _0x128443(_0x514fe6[_0xa278('0x11')][_0xa278('0x13')]);}else{logger['info'](_0xa278('0x14'),_0x35efd5,_0xa278('0xe'));_0x128443(_0x514fe6[_0xa278('0x15')]['message']);}})[_0xa278('0x16')](function(_0x593bb2){logger[_0xa278('0x11')](_0xa278('0x14'),_0x35efd5,_0x593bb2);_0x1b64d5(_0x593bb2);});});}exports['GetZendeskAccount']=function(_0x7858a3){var _0x1de98f=this;return new Promise(function(_0x278b61,_0x1c4b81){return db[_0xa278('0x17')]['findAll']({'raw':_0x7858a3['options']?_0x7858a3['options'][_0xa278('0x18')]===undefined?!![]:![]:!![],'where':_0x7858a3[_0xa278('0x19')]?_0x7858a3[_0xa278('0x19')]['where']||null:null,'attributes':_0x7858a3[_0xa278('0x19')]?_0x7858a3['options'][_0xa278('0x1a')]||null:null,'limit':_0x7858a3[_0xa278('0x19')]?_0x7858a3[_0xa278('0x19')][_0xa278('0x1b')]||null:null,'include':_0x7858a3[_0xa278('0x19')]?_0x7858a3['options'][_0xa278('0x1c')]?_[_0xa278('0x1d')](_0x7858a3[_0xa278('0x19')][_0xa278('0x1c')],function(_0xdb7604){return{'model':db[_0xdb7604[_0xa278('0x1e')]],'as':_0xdb7604['as'],'attributes':_0xdb7604[_0xa278('0x1a')],'include':_0xdb7604['include']?_['map'](_0xdb7604['include'],function(_0x528bd8){return{'model':db[_0x528bd8['model']],'as':_0x528bd8['as'],'attributes':_0x528bd8[_0xa278('0x1a')],'include':_0x528bd8[_0xa278('0x1c')]?_[_0xa278('0x1d')](_0x528bd8[_0xa278('0x1c')],function(_0x745cfd){return{'model':db[_0x745cfd[_0xa278('0x1e')]],'as':_0x745cfd['as'],'attributes':_0x745cfd[_0xa278('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa278('0xd')](function(_0x3bc6c8){logger[_0xa278('0x1f')](_0xa278('0x20'),_0x7858a3);logger[_0xa278('0xf')](_0xa278('0x20'),_0x7858a3,JSON[_0xa278('0x21')](_0x3bc6c8));_0x278b61(_0x3bc6c8);})[_0xa278('0x16')](function(_0x4ac57a){logger['error'](_0xa278('0x20'),_0x4ac57a[_0xa278('0x13')],_0x7858a3);_0x1c4b81(_0x1de98f[_0xa278('0x11')](0x1f4,_0x4ac57a[_0xa278('0x13')]));});});};exports[_0xa278('0x22')]=function(_0x5c1e70){var _0x1ed21b=this;return new Promise(function(_0x10cb36,_0x21e54f){return db[_0xa278('0x17')][_0xa278('0x23')]({'raw':_0x5c1e70[_0xa278('0x19')]?_0x5c1e70[_0xa278('0x19')][_0xa278('0x18')]===undefined?!![]:![]:!![],'where':_0x5c1e70['options']?_0x5c1e70[_0xa278('0x19')][_0xa278('0x24')]||null:null,'attributes':_0x5c1e70[_0xa278('0x19')]?_0x5c1e70[_0xa278('0x19')]['attributes']||null:null,'include':_0x5c1e70[_0xa278('0x19')]?_0x5c1e70['options'][_0xa278('0x1c')]?_[_0xa278('0x1d')](_0x5c1e70[_0xa278('0x19')][_0xa278('0x1c')],function(_0x1d26d8){return{'model':db[_0x1d26d8[_0xa278('0x1e')]],'as':_0x1d26d8['as'],'attributes':_0x1d26d8[_0xa278('0x1a')],'include':_0x1d26d8[_0xa278('0x1c')]?_[_0xa278('0x1d')](_0x1d26d8[_0xa278('0x1c')],function(_0x3a55f0){return{'model':db[_0x3a55f0['model']],'as':_0x3a55f0['as'],'attributes':_0x3a55f0[_0xa278('0x1a')],'include':_0x3a55f0[_0xa278('0x1c')]?_[_0xa278('0x1d')](_0x3a55f0[_0xa278('0x1c')],function(_0xe3a54a){return{'model':db[_0xe3a54a[_0xa278('0x1e')]],'as':_0xe3a54a['as'],'attributes':_0xe3a54a[_0xa278('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa278('0xd')](function(_0x3a7374){logger[_0xa278('0x1f')](_0xa278('0x22'),_0x5c1e70);logger['debug'](_0xa278('0x22'),_0x5c1e70,JSON[_0xa278('0x21')](_0x3a7374));_0x10cb36(_0x3a7374);})[_0xa278('0x16')](function(_0x1e2694){logger['error']('ShowZendeskAccount',_0x1e2694[_0xa278('0x13')],_0x5c1e70);_0x21e54f(_0x1ed21b[_0xa278('0x11')](0x1f4,_0x1e2694[_0xa278('0x13')]));});});}; \ No newline at end of file +var _0xc59d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','debug','catch','ShowZendeskAccount','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc59d,0x11e));var _0xdc59=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc59d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xdc59('0x0'));var util=require(_0xdc59('0x1'));var moment=require(_0xdc59('0x2'));var BPromise=require(_0xdc59('0x3'));var rs=require(_0xdc59('0x4'));var fs=require('fs');var Redis=require(_0xdc59('0x5'));var db=require(_0xdc59('0x6'))['db'];var utils=require(_0xdc59('0x7'));var logger=require(_0xdc59('0x8'))(_0xdc59('0x9'));var config=require(_0xdc59('0xa'));var jayson=require(_0xdc59('0xb'));var client=jayson[_0xdc59('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x410378,_0x40714,_0x2bcc53){return new BPromise(function(_0x9312e7,_0x22bbe8){return client[_0xdc59('0xd')](_0x410378,_0x2bcc53)[_0xdc59('0xe')](function(_0x482299){logger[_0xdc59('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x40714,_0xdc59('0x10'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x40714,_0xdc59('0x10'),JSON[_0xdc59('0x11')](_0x482299));if(_0x482299['error']){if(_0x482299[_0xdc59('0x12')][_0xdc59('0x13')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x40714,_0x482299[_0xdc59('0x12')][_0xdc59('0x14')]);return _0x22bbe8(_0x482299[_0xdc59('0x12')][_0xdc59('0x14')]);}logger[_0xdc59('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x40714,_0x482299[_0xdc59('0x12')][_0xdc59('0x14')]);return _0x9312e7(_0x482299[_0xdc59('0x12')][_0xdc59('0x14')]);}else{logger[_0xdc59('0xf')](_0xdc59('0x15'),_0x40714,_0xdc59('0x10'));_0x9312e7(_0x482299[_0xdc59('0x16')][_0xdc59('0x14')]);}})['catch'](function(_0x1dac04){logger['error'](_0xdc59('0x15'),_0x40714,_0x1dac04);_0x22bbe8(_0x1dac04);});});}exports[_0xdc59('0x17')]=function(_0x5ad066){var _0x19b3fb=this;return new Promise(function(_0x329049,_0x7df3fd){return db[_0xdc59('0x18')][_0xdc59('0x19')]({'raw':_0x5ad066['options']?_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ad066[_0xdc59('0x1a')]?_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1c')]||null:null,'attributes':_0x5ad066[_0xdc59('0x1a')]?_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1d')]||null:null,'limit':_0x5ad066[_0xdc59('0x1a')]?_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1e')]||null:null,'include':_0x5ad066[_0xdc59('0x1a')]?_0x5ad066[_0xdc59('0x1a')]['include']?_['map'](_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1f')],function(_0x5d40da){return{'model':db[_0x5d40da[_0xdc59('0x20')]],'as':_0x5d40da['as'],'attributes':_0x5d40da[_0xdc59('0x1d')],'include':_0x5d40da[_0xdc59('0x1f')]?_['map'](_0x5d40da[_0xdc59('0x1f')],function(_0x4a3802){return{'model':db[_0x4a3802[_0xdc59('0x20')]],'as':_0x4a3802['as'],'attributes':_0x4a3802[_0xdc59('0x1d')],'include':_0x4a3802['include']?_['map'](_0x4a3802['include'],function(_0x62e90d){return{'model':db[_0x62e90d['model']],'as':_0x62e90d['as'],'attributes':_0x62e90d[_0xdc59('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc59('0xe')](function(_0x4abecd){logger[_0xdc59('0xf')](_0xdc59('0x17'),_0x5ad066);logger[_0xdc59('0x21')]('GetZendeskAccount',_0x5ad066,JSON[_0xdc59('0x11')](_0x4abecd));_0x329049(_0x4abecd);})[_0xdc59('0x22')](function(_0x4a98f9){logger['error'](_0xdc59('0x17'),_0x4a98f9[_0xdc59('0x14')],_0x5ad066);_0x7df3fd(_0x19b3fb['error'](0x1f4,_0x4a98f9[_0xdc59('0x14')]));});});};exports[_0xdc59('0x23')]=function(_0x449c2d){var _0x3b97e8=this;return new Promise(function(_0x31e33a,_0x35b432){return db[_0xdc59('0x18')]['find']({'raw':_0x449c2d['options']?_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1b')]===undefined?!![]:![]:!![],'where':_0x449c2d[_0xdc59('0x1a')]?_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1c')]||null:null,'attributes':_0x449c2d[_0xdc59('0x1a')]?_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1d')]||null:null,'include':_0x449c2d['options']?_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1f')]?_['map'](_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1f')],function(_0x1cfd8b){return{'model':db[_0x1cfd8b[_0xdc59('0x20')]],'as':_0x1cfd8b['as'],'attributes':_0x1cfd8b[_0xdc59('0x1d')],'include':_0x1cfd8b['include']?_['map'](_0x1cfd8b[_0xdc59('0x1f')],function(_0x37a901){return{'model':db[_0x37a901[_0xdc59('0x20')]],'as':_0x37a901['as'],'attributes':_0x37a901[_0xdc59('0x1d')],'include':_0x37a901[_0xdc59('0x1f')]?_['map'](_0x37a901['include'],function(_0x319df8){return{'model':db[_0x319df8[_0xdc59('0x20')]],'as':_0x319df8['as'],'attributes':_0x319df8[_0xdc59('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc59('0xe')](function(_0x16d1ac){logger[_0xdc59('0xf')](_0xdc59('0x23'),_0x449c2d);logger[_0xdc59('0x21')](_0xdc59('0x23'),_0x449c2d,JSON[_0xdc59('0x11')](_0x16d1ac));_0x31e33a(_0x16d1ac);})[_0xdc59('0x22')](function(_0x47e639){logger['error']('ShowZendeskAccount',_0x47e639['message'],_0x449c2d);_0x35b432(_0x3b97e8[_0xdc59('0x12')](0x1f4,_0x47e639[_0xdc59('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f0e4fdc..a8800fe 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 _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x51a128,_0x5bb978){var _0xa7f169=function(_0x5a3ec1){while(--_0x5a3ec1){_0x51a128['push'](_0x51a128['shift']());}};_0xa7f169(++_0x5bb978);}(_0xa571,0x107));var _0x1a57=function(_0x130ae7,_0x1a25cd){_0x130ae7=_0x130ae7-0x0;var _0x4f598b=_0xa571[_0x130ae7];return _0x4f598b;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file +var _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x80f133,_0x313800){var _0x46e178=function(_0x23abf4){while(--_0x23abf4){_0x80f133['push'](_0x80f133['shift']());}};_0x46e178(++_0x313800);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5e6299,_0x7b91a1){_0x5e6299=_0x5e6299-0x0;var _0x464d33=_0xf4eb[_0x5e6299];return _0x464d33;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('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 d0d4867..82725db 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 _0x0ab1=['sequelize','STRING'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x0ab1,0x88));var _0x10ab=function(_0x450223,_0x599cfa){_0x450223=_0x450223-0x0;var _0x21d00f=_0x0ab1[_0x450223];return _0x21d00f;};'use strict';var Sequelize=require(_0x10ab('0x0'));module['exports']={'name':{'type':Sequelize[_0x10ab('0x1')]},'description':{'type':Sequelize[_0x10ab('0x1')]}}; \ No newline at end of file +var _0x3c88=['sequelize','exports','STRING'];(function(_0x3463d6,_0xe38e21){var _0x3ceed2=function(_0x2615d5){while(--_0x2615d5){_0x3463d6['push'](_0x3463d6['shift']());}};_0x3ceed2(++_0xe38e21);}(_0x3c88,0x1da));var _0x83c8=function(_0x56e89a,_0x2c7364){_0x56e89a=_0x56e89a-0x0;var _0x2ce005=_0x3c88[_0x56e89a];return _0x2ce005;};'use strict';var Sequelize=require(_0x83c8('0x0'));module[_0x83c8('0x1')]={'name':{'type':Sequelize[_0x83c8('0x2')]},'description':{'type':Sequelize[_0x83c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index ed53aeb..eb9b0a1 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 _0x3499=['ioredis','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZendeskConfiguration','findAll','rows','catch','show','params','options','create','body','find','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x15d5b3,_0x42f627){var _0x7502c6=function(_0x4d2582){while(--_0x4d2582){_0x15d5b3['push'](_0x15d5b3['shift']());}};_0x7502c6(++_0x42f627);}(_0x3499,0xe6));var _0x9349=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x3499[_0xa4f636];return _0x37e02a;};'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(_0x9349('0x0'));var moment=require(_0x9349('0x1'));var BPromise=require(_0x9349('0x2'));var Mustache=require(_0x9349('0x3'));var util=require(_0x9349('0x4'));var path=require(_0x9349('0x5'));var sox=require(_0x9349('0x6'));var csv=require('to-csv');var ejs=require(_0x9349('0x7'));var fs=require('fs');var fs_extra=require(_0x9349('0x8'));var _=require('lodash');var squel=require(_0x9349('0x9'));var crypto=require(_0x9349('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9349('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9349('0xc'));var Papa=require('papaparse');var Redis=require(_0x9349('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9349('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9349('0xf'));var utils=require('../../config/utils');var config=require(_0x9349('0x10'));var licenseUtil=require(_0x9349('0x11'));var db=require(_0x9349('0x12'))['db'];function respondWithStatusCode(_0x74ec23,_0x477d99){_0x477d99=_0x477d99||0xcc;return function(_0xca52dd){if(_0xca52dd){return _0x74ec23[_0x9349('0x13')](_0x477d99);}return _0x74ec23[_0x9349('0x14')](_0x477d99)['end']();};}function respondWithResult(_0x11f506,_0x1ea233){_0x1ea233=_0x1ea233||0xc8;return function(_0x2026c3){if(_0x2026c3){return _0x11f506[_0x9349('0x14')](_0x1ea233)[_0x9349('0x15')](_0x2026c3);}};}function respondWithFilteredResult(_0x10eef2,_0xf0ad1d){return function(_0x4de87e){if(_0x4de87e){var _0x3520f8=typeof _0xf0ad1d['offset']===_0x9349('0x16')&&typeof _0xf0ad1d[_0x9349('0x17')]==='undefined';var _0x2d842a=_0x4de87e[_0x9349('0x18')];var _0x24cb4a=_0x3520f8?0x0:_0xf0ad1d[_0x9349('0x19')];var _0x4f9b63=_0x3520f8?_0x4de87e[_0x9349('0x18')]:_0xf0ad1d[_0x9349('0x19')]+_0xf0ad1d['limit'];var _0x2e2964;if(_0x4f9b63>=_0x2d842a){_0x4f9b63=_0x2d842a;_0x2e2964=0xc8;}else{_0x2e2964=0xce;}_0x10eef2[_0x9349('0x14')](_0x2e2964);return _0x10eef2[_0x9349('0x1a')](_0x9349('0x1b'),_0x24cb4a+'-'+_0x4f9b63+'/'+_0x2d842a)['json'](_0x4de87e);}return null;};}function patchUpdates(_0x56c3b7){return function(_0x12d512){try{jsonpatch[_0x9349('0x1c')](_0x12d512,_0x56c3b7,!![]);}catch(_0x586067){return BPromise[_0x9349('0x1d')](_0x586067);}return _0x12d512[_0x9349('0x1e')]();};}function saveUpdates(_0x41b7ee,_0x5d5ad7){return function(_0x469ddd){if(_0x469ddd){return _0x469ddd[_0x9349('0x1f')](_0x41b7ee)[_0x9349('0x20')](function(_0x247bda){return _0x247bda;});}return null;};}function removeEntity(_0x4ee297,_0x8de1a8){return function(_0x2f46c4){if(_0x2f46c4){return _0x2f46c4[_0x9349('0x21')]()[_0x9349('0x20')](function(){_0x4ee297[_0x9349('0x14')](0xcc)[_0x9349('0x22')]();});}};}function handleEntityNotFound(_0x31551b,_0x43c1c1){return function(_0x5cb2ba){if(!_0x5cb2ba){_0x31551b[_0x9349('0x13')](0x194);}return _0x5cb2ba;};}function handleError(_0x20ca08,_0x2969b1){_0x2969b1=_0x2969b1||0x1f4;return function(_0x1ff7a8){logger['error'](_0x1ff7a8['stack']);if(_0x1ff7a8[_0x9349('0x23')]){delete _0x1ff7a8[_0x9349('0x23')];}_0x20ca08[_0x9349('0x14')](_0x2969b1)[_0x9349('0x24')](_0x1ff7a8);};}exports[_0x9349('0x25')]=function(_0x5aeaf1,_0x3548c1){var _0x380a94={},_0x23c631={},_0x430d7f={'count':0x0,'rows':[]};var _0x567b10=_[_0x9349('0x26')](db['ZendeskConfiguration'][_0x9349('0x27')],function(_0x541147){return{'name':_0x541147[_0x9349('0x28')],'type':_0x541147[_0x9349('0x29')][_0x9349('0x2a')]};});_0x23c631[_0x9349('0x2b')]=_['map'](_0x567b10,_0x9349('0x23'));_0x23c631[_0x9349('0x2c')]=_[_0x9349('0x2d')](_0x5aeaf1[_0x9349('0x2c')]);_0x23c631[_0x9349('0x2e')]=_[_0x9349('0x2f')](_0x23c631[_0x9349('0x2b')],_0x23c631['query']);_0x380a94['attributes']=_[_0x9349('0x2f')](_0x23c631[_0x9349('0x2b')],qs[_0x9349('0x30')](_0x5aeaf1[_0x9349('0x2c')][_0x9349('0x30')]));_0x380a94['attributes']=_0x380a94[_0x9349('0x31')][_0x9349('0x32')]?_0x380a94['attributes']:_0x23c631[_0x9349('0x2b')];if(!_0x5aeaf1[_0x9349('0x2c')][_0x9349('0x33')]('nolimit')){_0x380a94[_0x9349('0x17')]=qs[_0x9349('0x17')](_0x5aeaf1['query']['limit']);_0x380a94['offset']=qs[_0x9349('0x19')](_0x5aeaf1[_0x9349('0x2c')][_0x9349('0x19')]);}_0x380a94[_0x9349('0x34')]=qs[_0x9349('0x35')](_0x5aeaf1[_0x9349('0x2c')][_0x9349('0x35')]);_0x380a94[_0x9349('0x36')]=qs['filters'](_[_0x9349('0x37')](_0x5aeaf1[_0x9349('0x2c')],_0x23c631[_0x9349('0x2e')]),_0x567b10);if(_0x5aeaf1[_0x9349('0x2c')][_0x9349('0x38')]){_0x380a94[_0x9349('0x36')]=_[_0x9349('0x39')](_0x380a94[_0x9349('0x36')],{'$or':_[_0x9349('0x26')](_0x567b10,function(_0x4e51a4){if(_0x4e51a4[_0x9349('0x29')]!==_0x9349('0x3a')){var _0x2ca4f5={};_0x2ca4f5[_0x4e51a4[_0x9349('0x23')]]={'$like':'%'+_0x5aeaf1[_0x9349('0x2c')][_0x9349('0x38')]+'%'};return _0x2ca4f5;}})});}_0x380a94=_[_0x9349('0x39')]({},_0x380a94,_0x5aeaf1['options']);var _0x2d0873={'where':_0x380a94[_0x9349('0x36')]};return db['ZendeskConfiguration'][_0x9349('0x18')](_0x2d0873)[_0x9349('0x20')](function(_0x262672){_0x430d7f[_0x9349('0x18')]=_0x262672;if(_0x5aeaf1[_0x9349('0x2c')][_0x9349('0x3b')]){_0x380a94[_0x9349('0x3c')]=[{'all':!![]}];}return db[_0x9349('0x3d')][_0x9349('0x3e')](_0x380a94);})[_0x9349('0x20')](function(_0x3f625d){_0x430d7f[_0x9349('0x3f')]=_0x3f625d;return _0x430d7f;})[_0x9349('0x20')](respondWithFilteredResult(_0x3548c1,_0x380a94))[_0x9349('0x40')](handleError(_0x3548c1,null));};exports[_0x9349('0x41')]=function(_0x412f91,_0x4dd9ab){var _0x1f96c2={'raw':![],'where':{'id':_0x412f91[_0x9349('0x42')]['id']}},_0x41732b={};_0x41732b[_0x9349('0x2b')]=_[_0x9349('0x2d')](db[_0x9349('0x3d')][_0x9349('0x27')]);_0x41732b[_0x9349('0x2c')]=_[_0x9349('0x2d')](_0x412f91[_0x9349('0x2c')]);_0x41732b['filters']=_[_0x9349('0x2f')](_0x41732b['model'],_0x41732b['query']);_0x1f96c2[_0x9349('0x31')]=_[_0x9349('0x2f')](_0x41732b['model'],qs[_0x9349('0x30')](_0x412f91[_0x9349('0x2c')][_0x9349('0x30')]));_0x1f96c2[_0x9349('0x31')]=_0x1f96c2[_0x9349('0x31')]['length']?_0x1f96c2[_0x9349('0x31')]:_0x41732b['model'];if(_0x412f91['query']['includeAll']){_0x1f96c2[_0x9349('0x3c')]=[{'all':!![]}];}_0x1f96c2=_['merge']({},_0x1f96c2,_0x412f91[_0x9349('0x43')]);return db[_0x9349('0x3d')]['find'](_0x1f96c2)['then'](handleEntityNotFound(_0x4dd9ab,null))[_0x9349('0x20')](respondWithResult(_0x4dd9ab,null))[_0x9349('0x40')](handleError(_0x4dd9ab,null));};exports['create']=function(_0x3c8b24,_0x172bc2){return db['ZendeskConfiguration'][_0x9349('0x44')](_0x3c8b24['body'],{})['then'](respondWithResult(_0x172bc2,0xc9))['catch'](handleError(_0x172bc2,null));};exports[_0x9349('0x1f')]=function(_0x42a2c3,_0x5b9ad2){if(_0x42a2c3[_0x9349('0x45')]['id']){delete _0x42a2c3[_0x9349('0x45')]['id'];}return db[_0x9349('0x3d')][_0x9349('0x46')]({'where':{'id':_0x42a2c3[_0x9349('0x42')]['id']}})[_0x9349('0x20')](handleEntityNotFound(_0x5b9ad2,null))[_0x9349('0x20')](saveUpdates(_0x42a2c3[_0x9349('0x45')],null))[_0x9349('0x20')](respondWithResult(_0x5b9ad2,null))[_0x9349('0x40')](handleError(_0x5b9ad2,null));};exports[_0x9349('0x21')]=function(_0x3c5f6e,_0x434ac3){return db['ZendeskConfiguration'][_0x9349('0x46')]({'where':{'id':_0x3c5f6e['params']['id']}})['then'](handleEntityNotFound(_0x434ac3,null))[_0x9349('0x20')](removeEntity(_0x434ac3,null))[_0x9349('0x40')](handleError(_0x434ac3,null));};exports[_0x9349('0x47')]=function(_0x1b0c11,_0x53ad8e,_0x1f13aa){var _0x2a2e42={};var _0x3061c2={};var _0x4c1750;var _0x3fbe76;return db[_0x9349('0x3d')][_0x9349('0x48')]({'where':{'id':_0x1b0c11[_0x9349('0x42')]['id']}})[_0x9349('0x20')](handleEntityNotFound(_0x53ad8e,null))['then'](function(_0x19a225){if(_0x19a225){_0x4c1750=_0x19a225;_0x3061c2['model']=_[_0x9349('0x2d')](db[_0x9349('0x49')][_0x9349('0x27')]);_0x3061c2[_0x9349('0x2c')]=_[_0x9349('0x2d')](_0x1b0c11[_0x9349('0x2c')]);_0x3061c2['filters']=_[_0x9349('0x2f')](_0x3061c2[_0x9349('0x2b')],_0x3061c2[_0x9349('0x2c')]);_0x2a2e42[_0x9349('0x31')]=_[_0x9349('0x2f')](_0x3061c2[_0x9349('0x2b')],qs[_0x9349('0x30')](_0x1b0c11[_0x9349('0x2c')][_0x9349('0x30')]));_0x2a2e42['attributes']=_0x2a2e42[_0x9349('0x31')][_0x9349('0x32')]?_0x2a2e42[_0x9349('0x31')]:_0x3061c2[_0x9349('0x2b')];_0x2a2e42[_0x9349('0x34')]=qs[_0x9349('0x35')](_0x1b0c11[_0x9349('0x2c')]['sort']);_0x2a2e42[_0x9349('0x36')]=qs[_0x9349('0x2e')](_[_0x9349('0x37')](_0x1b0c11[_0x9349('0x2c')],_0x3061c2[_0x9349('0x2e')]));if(_0x1b0c11['query']['filter']){_0x2a2e42[_0x9349('0x36')]=_[_0x9349('0x39')](_0x2a2e42[_0x9349('0x36')],{'$or':_['map'](_0x2a2e42['attributes'],function(_0x41f523){var _0x126c78={};_0x126c78[_0x41f523]={'$like':'%'+_0x1b0c11[_0x9349('0x2c')][_0x9349('0x38')]+'%'};return _0x126c78;})});}_0x2a2e42=_[_0x9349('0x39')]({},_0x2a2e42,_0x1b0c11[_0x9349('0x43')]);return _0x4c1750['getFields'](_0x2a2e42);}})[_0x9349('0x20')](function(_0x5a02dc){if(_0x5a02dc){_0x3fbe76=_0x5a02dc['length'];if(!_0x1b0c11['query']['hasOwnProperty'](_0x9349('0x4a'))){_0x2a2e42[_0x9349('0x17')]=qs[_0x9349('0x17')](_0x1b0c11[_0x9349('0x2c')][_0x9349('0x17')]);_0x2a2e42[_0x9349('0x19')]=qs[_0x9349('0x19')](_0x1b0c11[_0x9349('0x2c')][_0x9349('0x19')]);}return _0x4c1750['getFields'](_0x2a2e42);}})[_0x9349('0x20')](function(_0x4e364d){if(_0x4e364d){return _0x4e364d?{'count':_0x3fbe76,'rows':_0x4e364d}:null;}})[_0x9349('0x20')](respondWithResult(_0x53ad8e,null))['catch'](handleError(_0x53ad8e,null));};exports[_0x9349('0x4b')]=function(_0x4f592c,_0x3c3dde,_0x2ee597){var _0x2602b7={};var _0x3fbb8c={};var _0x320a92;var _0x8474df;return db['ZendeskConfiguration'][_0x9349('0x48')]({'where':{'id':_0x4f592c[_0x9349('0x42')]['id']}})[_0x9349('0x20')](handleEntityNotFound(_0x3c3dde,null))[_0x9349('0x20')](function(_0x5aa3cf){if(_0x5aa3cf){_0x320a92=_0x5aa3cf;_0x3fbb8c[_0x9349('0x2b')]=_[_0x9349('0x2d')](db[_0x9349('0x49')]['rawAttributes']);_0x3fbb8c[_0x9349('0x2c')]=_[_0x9349('0x2d')](_0x4f592c[_0x9349('0x2c')]);_0x3fbb8c[_0x9349('0x2e')]=_['intersection'](_0x3fbb8c[_0x9349('0x2b')],_0x3fbb8c[_0x9349('0x2c')]);_0x2602b7[_0x9349('0x31')]=_['intersection'](_0x3fbb8c[_0x9349('0x2b')],qs[_0x9349('0x30')](_0x4f592c['query'][_0x9349('0x30')]));_0x2602b7['attributes']=_0x2602b7[_0x9349('0x31')]['length']?_0x2602b7[_0x9349('0x31')]:_0x3fbb8c['model'];_0x2602b7[_0x9349('0x34')]=qs[_0x9349('0x35')](_0x4f592c[_0x9349('0x2c')][_0x9349('0x35')]);_0x2602b7[_0x9349('0x36')]=qs[_0x9349('0x2e')](_['pick'](_0x4f592c['query'],_0x3fbb8c[_0x9349('0x2e')]));if(_0x4f592c['query'][_0x9349('0x38')]){_0x2602b7[_0x9349('0x36')]=_['merge'](_0x2602b7[_0x9349('0x36')],{'$or':_[_0x9349('0x26')](_0x2602b7[_0x9349('0x31')],function(_0x122edf){var _0x559580={};_0x559580[_0x122edf]={'$like':'%'+_0x4f592c[_0x9349('0x2c')][_0x9349('0x38')]+'%'};return _0x559580;})});}_0x2602b7=_[_0x9349('0x39')]({},_0x2602b7,_0x4f592c['options']);return _0x320a92[_0x9349('0x4b')](_0x2602b7);}})[_0x9349('0x20')](function(_0x383c89){if(_0x383c89){_0x8474df=_0x383c89[_0x9349('0x32')];if(!_0x4f592c[_0x9349('0x2c')][_0x9349('0x33')]('nolimit')){_0x2602b7[_0x9349('0x17')]=qs['limit'](_0x4f592c[_0x9349('0x2c')]['limit']);_0x2602b7[_0x9349('0x19')]=qs[_0x9349('0x19')](_0x4f592c['query'][_0x9349('0x19')]);}return _0x320a92[_0x9349('0x4b')](_0x2602b7);}})[_0x9349('0x20')](function(_0x3c0454){if(_0x3c0454){return _0x3c0454?{'count':_0x8474df,'rows':_0x3c0454}:null;}})[_0x9349('0x20')](respondWithResult(_0x3c3dde,null))['catch'](handleError(_0x3c3dde,null));};exports[_0x9349('0x4c')]=function(_0x28ba99,_0x36bb6e,_0xf404ed){var _0x5999cb={};var _0x23fc60={};var _0x54dede;var _0x22792c;return db['ZendeskConfiguration'][_0x9349('0x48')]({'where':{'id':_0x28ba99[_0x9349('0x42')]['id']}})[_0x9349('0x20')](handleEntityNotFound(_0x36bb6e,null))['then'](function(_0x5ed8f3){if(_0x5ed8f3){_0x54dede=_0x5ed8f3;_0x23fc60[_0x9349('0x2b')]=_[_0x9349('0x2d')](db['ZendeskField'][_0x9349('0x27')]);_0x23fc60[_0x9349('0x2c')]=_[_0x9349('0x2d')](_0x28ba99[_0x9349('0x2c')]);_0x23fc60['filters']=_[_0x9349('0x2f')](_0x23fc60['model'],_0x23fc60['query']);_0x5999cb['attributes']=_['intersection'](_0x23fc60[_0x9349('0x2b')],qs[_0x9349('0x30')](_0x28ba99[_0x9349('0x2c')][_0x9349('0x30')]));_0x5999cb['attributes']=_0x5999cb[_0x9349('0x31')][_0x9349('0x32')]?_0x5999cb[_0x9349('0x31')]:_0x23fc60[_0x9349('0x2b')];_0x5999cb[_0x9349('0x34')]=qs['sort'](_0x28ba99['query'][_0x9349('0x35')]);_0x5999cb[_0x9349('0x36')]=qs['filters'](_['pick'](_0x28ba99[_0x9349('0x2c')],_0x23fc60['filters']));if(_0x28ba99[_0x9349('0x2c')][_0x9349('0x38')]){_0x5999cb[_0x9349('0x36')]=_['merge'](_0x5999cb[_0x9349('0x36')],{'$or':_[_0x9349('0x26')](_0x5999cb['attributes'],function(_0x2829cb){var _0x1938dd={};_0x1938dd[_0x2829cb]={'$like':'%'+_0x28ba99[_0x9349('0x2c')][_0x9349('0x38')]+'%'};return _0x1938dd;})});}_0x5999cb=_[_0x9349('0x39')]({},_0x5999cb,_0x28ba99[_0x9349('0x43')]);return _0x54dede[_0x9349('0x4c')](_0x5999cb);}})[_0x9349('0x20')](function(_0x426dbb){if(_0x426dbb){_0x22792c=_0x426dbb[_0x9349('0x32')];if(!_0x28ba99[_0x9349('0x2c')][_0x9349('0x33')]('nolimit')){_0x5999cb['limit']=qs[_0x9349('0x17')](_0x28ba99[_0x9349('0x2c')][_0x9349('0x17')]);_0x5999cb[_0x9349('0x19')]=qs[_0x9349('0x19')](_0x28ba99[_0x9349('0x2c')][_0x9349('0x19')]);}return _0x54dede['getDescriptions'](_0x5999cb);}})[_0x9349('0x20')](function(_0x1ed7f0){if(_0x1ed7f0){return _0x1ed7f0?{'count':_0x22792c,'rows':_0x1ed7f0}:null;}})[_0x9349('0x20')](respondWithResult(_0x36bb6e,null))[_0x9349('0x40')](handleError(_0x36bb6e,null));};exports[_0x9349('0x4d')]=function(_0x5085ca,_0x3ef630,_0x3b20eb){var _0x1539ad={};var _0x483b5f={};var _0x2e321e;var _0x5a720e;return db[_0x9349('0x3d')]['findOne']({'where':{'id':_0x5085ca[_0x9349('0x42')]['id']}})[_0x9349('0x20')](handleEntityNotFound(_0x3ef630,null))['then'](function(_0x56c734){if(_0x56c734){_0x2e321e=_0x56c734;_0x483b5f[_0x9349('0x2b')]=_['keys'](db[_0x9349('0x4e')][_0x9349('0x27')]);_0x483b5f[_0x9349('0x2c')]=_[_0x9349('0x2d')](_0x5085ca[_0x9349('0x2c')]);_0x483b5f[_0x9349('0x2e')]=_[_0x9349('0x2f')](_0x483b5f['model'],_0x483b5f[_0x9349('0x2c')]);_0x1539ad[_0x9349('0x31')]=_['intersection'](_0x483b5f['model'],qs[_0x9349('0x30')](_0x5085ca[_0x9349('0x2c')][_0x9349('0x30')]));_0x1539ad[_0x9349('0x31')]=_0x1539ad[_0x9349('0x31')][_0x9349('0x32')]?_0x1539ad[_0x9349('0x31')]:_0x483b5f[_0x9349('0x2b')];_0x1539ad[_0x9349('0x34')]=qs[_0x9349('0x35')](_0x5085ca['query'][_0x9349('0x35')]);_0x1539ad[_0x9349('0x36')]=qs[_0x9349('0x2e')](_[_0x9349('0x37')](_0x5085ca[_0x9349('0x2c')],_0x483b5f[_0x9349('0x2e')]));if(_0x5085ca[_0x9349('0x2c')][_0x9349('0x38')]){_0x1539ad[_0x9349('0x36')]=_[_0x9349('0x39')](_0x1539ad['where'],{'$or':_[_0x9349('0x26')](_0x1539ad[_0x9349('0x31')],function(_0x7a16cc){var _0x11e30c={};_0x11e30c[_0x7a16cc]={'$like':'%'+_0x5085ca['query'][_0x9349('0x38')]+'%'};return _0x11e30c;})});}_0x1539ad=_[_0x9349('0x39')]({},_0x1539ad,_0x5085ca['options']);return _0x2e321e[_0x9349('0x4d')](_0x1539ad);}})[_0x9349('0x20')](function(_0x3e97cc){if(_0x3e97cc){_0x5a720e=_0x3e97cc['length'];if(!_0x5085ca[_0x9349('0x2c')][_0x9349('0x33')](_0x9349('0x4a'))){_0x1539ad[_0x9349('0x17')]=qs[_0x9349('0x17')](_0x5085ca[_0x9349('0x2c')][_0x9349('0x17')]);_0x1539ad[_0x9349('0x19')]=qs['offset'](_0x5085ca[_0x9349('0x2c')][_0x9349('0x19')]);}return _0x2e321e[_0x9349('0x4d')](_0x1539ad);}})['then'](function(_0x35d91f){if(_0x35d91f){return _0x35d91f?{'count':_0x5a720e,'rows':_0x35d91f}:null;}})[_0x9349('0x20')](respondWithResult(_0x3ef630,null))[_0x9349('0x40')](handleError(_0x3ef630,null));};exports[_0x9349('0x4f')]=function(_0x321697,_0x177652,_0x3c4d3c){if(_0x321697[_0x9349('0x45')]['id']){delete _0x321697[_0x9349('0x45')]['id'];}return db[_0x9349('0x3d')][_0x9349('0x48')]({'where':{'id':_0x321697[_0x9349('0x42')]['id']}})[_0x9349('0x20')](handleEntityNotFound(_0x177652,null))[_0x9349('0x20')](function(_0x34e9d8){if(_0x34e9d8){return _0x34e9d8[_0x9349('0x4f')](_0x321697[_0x9349('0x45')][_0x9349('0x50')]||[]);}return null;})[_0x9349('0x20')](respondWithResult(_0x177652,null))['catch'](handleError(_0x177652,null));}; \ No newline at end of file +var _0x22ef=['update','then','error','name','index','map','ZendeskConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x22ef,0x1d9));var _0xf22e=function(_0x304393,_0x4ba6ca){_0x304393=_0x304393-0x0;var _0x4a7019=_0x22ef[_0x304393];return _0x4a7019;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf22e('0x0'));var zipdir=require(_0xf22e('0x1'));var jsonpatch=require(_0xf22e('0x2'));var rp=require(_0xf22e('0x3'));var moment=require(_0xf22e('0x4'));var BPromise=require(_0xf22e('0x5'));var Mustache=require('mustache');var util=require(_0xf22e('0x6'));var path=require(_0xf22e('0x7'));var sox=require(_0xf22e('0x8'));var csv=require(_0xf22e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf22e('0xa'));var _=require(_0xf22e('0xb'));var squel=require('squel');var crypto=require(_0xf22e('0xc'));var jsforce=require(_0xf22e('0xd'));var deskjs=require(_0xf22e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf22e('0xf'));var Papa=require(_0xf22e('0x10'));var Redis=require(_0xf22e('0x11'));var authService=require(_0xf22e('0x12'));var qs=require(_0xf22e('0x13'));var as=require(_0xf22e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf22e('0x15'))(_0xf22e('0x16'));var utils=require(_0xf22e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf22e('0x18'));var db=require(_0xf22e('0x19'))['db'];function respondWithStatusCode(_0x2172eb,_0x5b2ad9){_0x5b2ad9=_0x5b2ad9||0xcc;return function(_0x220688){if(_0x220688){return _0x2172eb[_0xf22e('0x1a')](_0x5b2ad9);}return _0x2172eb[_0xf22e('0x1b')](_0x5b2ad9)[_0xf22e('0x1c')]();};}function respondWithResult(_0x2541b8,_0x3e7583){_0x3e7583=_0x3e7583||0xc8;return function(_0x206e4f){if(_0x206e4f){return _0x2541b8[_0xf22e('0x1b')](_0x3e7583)[_0xf22e('0x1d')](_0x206e4f);}};}function respondWithFilteredResult(_0x12897f,_0x3247f8){return function(_0xcdc710){if(_0xcdc710){var _0xabfede=typeof _0x3247f8[_0xf22e('0x1e')]===_0xf22e('0x1f')&&typeof _0x3247f8['limit']===_0xf22e('0x1f');var _0x19f03e=_0xcdc710[_0xf22e('0x20')];var _0x532e0a=_0xabfede?0x0:_0x3247f8[_0xf22e('0x1e')];var _0x3c6c1e=_0xabfede?_0xcdc710[_0xf22e('0x20')]:_0x3247f8[_0xf22e('0x1e')]+_0x3247f8['limit'];var _0x638803;if(_0x3c6c1e>=_0x19f03e){_0x3c6c1e=_0x19f03e;_0x638803=0xc8;}else{_0x638803=0xce;}_0x12897f[_0xf22e('0x1b')](_0x638803);return _0x12897f['set'](_0xf22e('0x21'),_0x532e0a+'-'+_0x3c6c1e+'/'+_0x19f03e)[_0xf22e('0x1d')](_0xcdc710);}return null;};}function patchUpdates(_0x205030){return function(_0xfac623){try{jsonpatch[_0xf22e('0x22')](_0xfac623,_0x205030,!![]);}catch(_0x30eaf1){return BPromise[_0xf22e('0x23')](_0x30eaf1);}return _0xfac623[_0xf22e('0x24')]();};}function saveUpdates(_0x27b453,_0x27e624){return function(_0x2d9289){if(_0x2d9289){return _0x2d9289[_0xf22e('0x25')](_0x27b453)[_0xf22e('0x26')](function(_0x132aab){return _0x132aab;});}return null;};}function removeEntity(_0x41930c,_0x54a398){return function(_0xaf7565){if(_0xaf7565){return _0xaf7565['destroy']()[_0xf22e('0x26')](function(){_0x41930c['status'](0xcc)[_0xf22e('0x1c')]();});}};}function handleEntityNotFound(_0x3924a8,_0x571303){return function(_0x37976c){if(!_0x37976c){_0x3924a8[_0xf22e('0x1a')](0x194);}return _0x37976c;};}function handleError(_0xf4380c,_0xbfee32){_0xbfee32=_0xbfee32||0x1f4;return function(_0xa1b9){logger[_0xf22e('0x27')](_0xa1b9['stack']);if(_0xa1b9[_0xf22e('0x28')]){delete _0xa1b9[_0xf22e('0x28')];}_0xf4380c[_0xf22e('0x1b')](_0xbfee32)['send'](_0xa1b9);};}exports[_0xf22e('0x29')]=function(_0x3b52b8,_0x2801c5){var _0x2082f5={},_0x629a0f={},_0x38205f={'count':0x0,'rows':[]};var _0x428c79=_[_0xf22e('0x2a')](db[_0xf22e('0x2b')]['rawAttributes'],function(_0x3f7331){return{'name':_0x3f7331['fieldName'],'type':_0x3f7331[_0xf22e('0x2c')][_0xf22e('0x2d')]};});_0x629a0f[_0xf22e('0x2e')]=_[_0xf22e('0x2a')](_0x428c79,_0xf22e('0x28'));_0x629a0f[_0xf22e('0x2f')]=_['keys'](_0x3b52b8[_0xf22e('0x2f')]);_0x629a0f[_0xf22e('0x30')]=_[_0xf22e('0x31')](_0x629a0f[_0xf22e('0x2e')],_0x629a0f[_0xf22e('0x2f')]);_0x2082f5[_0xf22e('0x32')]=_['intersection'](_0x629a0f[_0xf22e('0x2e')],qs[_0xf22e('0x33')](_0x3b52b8[_0xf22e('0x2f')][_0xf22e('0x33')]));_0x2082f5['attributes']=_0x2082f5['attributes'][_0xf22e('0x34')]?_0x2082f5[_0xf22e('0x32')]:_0x629a0f[_0xf22e('0x2e')];if(!_0x3b52b8[_0xf22e('0x2f')][_0xf22e('0x35')](_0xf22e('0x36'))){_0x2082f5['limit']=qs[_0xf22e('0x37')](_0x3b52b8[_0xf22e('0x2f')]['limit']);_0x2082f5['offset']=qs[_0xf22e('0x1e')](_0x3b52b8[_0xf22e('0x2f')]['offset']);}_0x2082f5[_0xf22e('0x38')]=qs[_0xf22e('0x39')](_0x3b52b8[_0xf22e('0x2f')]['sort']);_0x2082f5['where']=qs[_0xf22e('0x30')](_[_0xf22e('0x3a')](_0x3b52b8[_0xf22e('0x2f')],_0x629a0f[_0xf22e('0x30')]),_0x428c79);if(_0x3b52b8['query']['filter']){_0x2082f5[_0xf22e('0x3b')]=_['merge'](_0x2082f5['where'],{'$or':_[_0xf22e('0x2a')](_0x428c79,function(_0x4c8c53){if(_0x4c8c53[_0xf22e('0x2c')]!=='VIRTUAL'){var _0x2872e1={};_0x2872e1[_0x4c8c53[_0xf22e('0x28')]]={'$like':'%'+_0x3b52b8[_0xf22e('0x2f')][_0xf22e('0x3c')]+'%'};return _0x2872e1;}})});}_0x2082f5=_[_0xf22e('0x3d')]({},_0x2082f5,_0x3b52b8[_0xf22e('0x3e')]);var _0x12d9fe={'where':_0x2082f5['where']};return db[_0xf22e('0x2b')][_0xf22e('0x20')](_0x12d9fe)['then'](function(_0x42b685){_0x38205f['count']=_0x42b685;if(_0x3b52b8[_0xf22e('0x2f')][_0xf22e('0x3f')]){_0x2082f5[_0xf22e('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xf22e('0x41')](_0x2082f5);})['then'](function(_0x7d1ad1){_0x38205f[_0xf22e('0x42')]=_0x7d1ad1;return _0x38205f;})[_0xf22e('0x26')](respondWithFilteredResult(_0x2801c5,_0x2082f5))[_0xf22e('0x43')](handleError(_0x2801c5,null));};exports[_0xf22e('0x44')]=function(_0x383f96,_0x52eb56){var _0x1bddbc={'raw':![],'where':{'id':_0x383f96[_0xf22e('0x45')]['id']}},_0x358b92={};_0x358b92['model']=_[_0xf22e('0x46')](db['ZendeskConfiguration'][_0xf22e('0x47')]);_0x358b92[_0xf22e('0x2f')]=_['keys'](_0x383f96['query']);_0x358b92['filters']=_[_0xf22e('0x31')](_0x358b92[_0xf22e('0x2e')],_0x358b92[_0xf22e('0x2f')]);_0x1bddbc[_0xf22e('0x32')]=_['intersection'](_0x358b92['model'],qs[_0xf22e('0x33')](_0x383f96[_0xf22e('0x2f')][_0xf22e('0x33')]));_0x1bddbc[_0xf22e('0x32')]=_0x1bddbc[_0xf22e('0x32')][_0xf22e('0x34')]?_0x1bddbc[_0xf22e('0x32')]:_0x358b92[_0xf22e('0x2e')];if(_0x383f96[_0xf22e('0x2f')]['includeAll']){_0x1bddbc[_0xf22e('0x40')]=[{'all':!![]}];}_0x1bddbc=_[_0xf22e('0x3d')]({},_0x1bddbc,_0x383f96[_0xf22e('0x3e')]);return db['ZendeskConfiguration'][_0xf22e('0x48')](_0x1bddbc)[_0xf22e('0x26')](handleEntityNotFound(_0x52eb56,null))[_0xf22e('0x26')](respondWithResult(_0x52eb56,null))[_0xf22e('0x43')](handleError(_0x52eb56,null));};exports[_0xf22e('0x49')]=function(_0x5dc1c6,_0x3adfea){return db[_0xf22e('0x2b')][_0xf22e('0x49')](_0x5dc1c6['body'],{})[_0xf22e('0x26')](respondWithResult(_0x3adfea,0xc9))[_0xf22e('0x43')](handleError(_0x3adfea,null));};exports['update']=function(_0x360898,_0x9837b6){if(_0x360898[_0xf22e('0x4a')]['id']){delete _0x360898[_0xf22e('0x4a')]['id'];}return db[_0xf22e('0x2b')][_0xf22e('0x48')]({'where':{'id':_0x360898[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x9837b6,null))['then'](saveUpdates(_0x360898[_0xf22e('0x4a')],null))['then'](respondWithResult(_0x9837b6,null))['catch'](handleError(_0x9837b6,null));};exports[_0xf22e('0x4b')]=function(_0x5dcfaf,_0x539c49){return db[_0xf22e('0x2b')][_0xf22e('0x48')]({'where':{'id':_0x5dcfaf[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x539c49,null))[_0xf22e('0x26')](removeEntity(_0x539c49,null))[_0xf22e('0x43')](handleError(_0x539c49,null));};exports[_0xf22e('0x4c')]=function(_0x31d2da,_0x4fd36b,_0x3e15f1){var _0x1f2c58={};var _0x4d5311={};var _0x2c390c;var _0x56d01c;return db[_0xf22e('0x2b')][_0xf22e('0x4d')]({'where':{'id':_0x31d2da[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x4fd36b,null))['then'](function(_0x4ff2fd){if(_0x4ff2fd){_0x2c390c=_0x4ff2fd;_0x4d5311[_0xf22e('0x2e')]=_[_0xf22e('0x46')](db['ZendeskField']['rawAttributes']);_0x4d5311[_0xf22e('0x2f')]=_[_0xf22e('0x46')](_0x31d2da[_0xf22e('0x2f')]);_0x4d5311[_0xf22e('0x30')]=_[_0xf22e('0x31')](_0x4d5311['model'],_0x4d5311[_0xf22e('0x2f')]);_0x1f2c58[_0xf22e('0x32')]=_[_0xf22e('0x31')](_0x4d5311['model'],qs[_0xf22e('0x33')](_0x31d2da[_0xf22e('0x2f')][_0xf22e('0x33')]));_0x1f2c58[_0xf22e('0x32')]=_0x1f2c58[_0xf22e('0x32')]['length']?_0x1f2c58['attributes']:_0x4d5311[_0xf22e('0x2e')];_0x1f2c58['order']=qs[_0xf22e('0x39')](_0x31d2da['query'][_0xf22e('0x39')]);_0x1f2c58[_0xf22e('0x3b')]=qs[_0xf22e('0x30')](_['pick'](_0x31d2da[_0xf22e('0x2f')],_0x4d5311['filters']));if(_0x31d2da['query'][_0xf22e('0x3c')]){_0x1f2c58[_0xf22e('0x3b')]=_[_0xf22e('0x3d')](_0x1f2c58['where'],{'$or':_['map'](_0x1f2c58[_0xf22e('0x32')],function(_0x1d0ab7){var _0x34e13a={};_0x34e13a[_0x1d0ab7]={'$like':'%'+_0x31d2da['query'][_0xf22e('0x3c')]+'%'};return _0x34e13a;})});}_0x1f2c58=_[_0xf22e('0x3d')]({},_0x1f2c58,_0x31d2da[_0xf22e('0x3e')]);return _0x2c390c[_0xf22e('0x4c')](_0x1f2c58);}})[_0xf22e('0x26')](function(_0x574b90){if(_0x574b90){_0x56d01c=_0x574b90[_0xf22e('0x34')];if(!_0x31d2da[_0xf22e('0x2f')][_0xf22e('0x35')](_0xf22e('0x36'))){_0x1f2c58[_0xf22e('0x37')]=qs[_0xf22e('0x37')](_0x31d2da['query'][_0xf22e('0x37')]);_0x1f2c58[_0xf22e('0x1e')]=qs[_0xf22e('0x1e')](_0x31d2da['query']['offset']);}return _0x2c390c[_0xf22e('0x4c')](_0x1f2c58);}})['then'](function(_0xb2a5aa){if(_0xb2a5aa){return _0xb2a5aa?{'count':_0x56d01c,'rows':_0xb2a5aa}:null;}})[_0xf22e('0x26')](respondWithResult(_0x4fd36b,null))['catch'](handleError(_0x4fd36b,null));};exports['getSubjects']=function(_0x1aba3d,_0x73e944,_0x35ef5b){var _0x4e48c2={};var _0x5b2b23={};var _0x3e788e;var _0x4f888c;return db[_0xf22e('0x2b')]['findOne']({'where':{'id':_0x1aba3d[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x73e944,null))['then'](function(_0x23905a){if(_0x23905a){_0x3e788e=_0x23905a;_0x5b2b23['model']=_[_0xf22e('0x46')](db[_0xf22e('0x4e')]['rawAttributes']);_0x5b2b23[_0xf22e('0x2f')]=_[_0xf22e('0x46')](_0x1aba3d['query']);_0x5b2b23['filters']=_[_0xf22e('0x31')](_0x5b2b23[_0xf22e('0x2e')],_0x5b2b23[_0xf22e('0x2f')]);_0x4e48c2[_0xf22e('0x32')]=_['intersection'](_0x5b2b23[_0xf22e('0x2e')],qs[_0xf22e('0x33')](_0x1aba3d[_0xf22e('0x2f')]['fields']));_0x4e48c2[_0xf22e('0x32')]=_0x4e48c2[_0xf22e('0x32')][_0xf22e('0x34')]?_0x4e48c2['attributes']:_0x5b2b23[_0xf22e('0x2e')];_0x4e48c2[_0xf22e('0x38')]=qs[_0xf22e('0x39')](_0x1aba3d['query']['sort']);_0x4e48c2[_0xf22e('0x3b')]=qs[_0xf22e('0x30')](_[_0xf22e('0x3a')](_0x1aba3d[_0xf22e('0x2f')],_0x5b2b23[_0xf22e('0x30')]));if(_0x1aba3d['query'][_0xf22e('0x3c')]){_0x4e48c2['where']=_[_0xf22e('0x3d')](_0x4e48c2[_0xf22e('0x3b')],{'$or':_['map'](_0x4e48c2[_0xf22e('0x32')],function(_0x4c5846){var _0x5d6a6b={};_0x5d6a6b[_0x4c5846]={'$like':'%'+_0x1aba3d[_0xf22e('0x2f')]['filter']+'%'};return _0x5d6a6b;})});}_0x4e48c2=_[_0xf22e('0x3d')]({},_0x4e48c2,_0x1aba3d[_0xf22e('0x3e')]);return _0x3e788e['getSubjects'](_0x4e48c2);}})[_0xf22e('0x26')](function(_0x28a226){if(_0x28a226){_0x4f888c=_0x28a226[_0xf22e('0x34')];if(!_0x1aba3d[_0xf22e('0x2f')][_0xf22e('0x35')](_0xf22e('0x36'))){_0x4e48c2['limit']=qs[_0xf22e('0x37')](_0x1aba3d[_0xf22e('0x2f')][_0xf22e('0x37')]);_0x4e48c2[_0xf22e('0x1e')]=qs['offset'](_0x1aba3d[_0xf22e('0x2f')][_0xf22e('0x1e')]);}return _0x3e788e[_0xf22e('0x4f')](_0x4e48c2);}})[_0xf22e('0x26')](function(_0xed7de){if(_0xed7de){return _0xed7de?{'count':_0x4f888c,'rows':_0xed7de}:null;}})[_0xf22e('0x26')](respondWithResult(_0x73e944,null))['catch'](handleError(_0x73e944,null));};exports[_0xf22e('0x50')]=function(_0x40c0eb,_0x4c4554,_0x3794d8){var _0x46067a={};var _0x2bc84b={};var _0x15c519;var _0x1a4eb0;return db[_0xf22e('0x2b')][_0xf22e('0x4d')]({'where':{'id':_0x40c0eb[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x4c4554,null))[_0xf22e('0x26')](function(_0x3f93dd){if(_0x3f93dd){_0x15c519=_0x3f93dd;_0x2bc84b[_0xf22e('0x2e')]=_[_0xf22e('0x46')](db[_0xf22e('0x4e')][_0xf22e('0x47')]);_0x2bc84b[_0xf22e('0x2f')]=_[_0xf22e('0x46')](_0x40c0eb['query']);_0x2bc84b['filters']=_[_0xf22e('0x31')](_0x2bc84b[_0xf22e('0x2e')],_0x2bc84b[_0xf22e('0x2f')]);_0x46067a[_0xf22e('0x32')]=_[_0xf22e('0x31')](_0x2bc84b[_0xf22e('0x2e')],qs[_0xf22e('0x33')](_0x40c0eb[_0xf22e('0x2f')]['fields']));_0x46067a['attributes']=_0x46067a['attributes'][_0xf22e('0x34')]?_0x46067a[_0xf22e('0x32')]:_0x2bc84b[_0xf22e('0x2e')];_0x46067a[_0xf22e('0x38')]=qs[_0xf22e('0x39')](_0x40c0eb[_0xf22e('0x2f')][_0xf22e('0x39')]);_0x46067a[_0xf22e('0x3b')]=qs[_0xf22e('0x30')](_[_0xf22e('0x3a')](_0x40c0eb[_0xf22e('0x2f')],_0x2bc84b['filters']));if(_0x40c0eb[_0xf22e('0x2f')][_0xf22e('0x3c')]){_0x46067a['where']=_[_0xf22e('0x3d')](_0x46067a[_0xf22e('0x3b')],{'$or':_[_0xf22e('0x2a')](_0x46067a[_0xf22e('0x32')],function(_0x5d4674){var _0x391fd0={};_0x391fd0[_0x5d4674]={'$like':'%'+_0x40c0eb['query'][_0xf22e('0x3c')]+'%'};return _0x391fd0;})});}_0x46067a=_[_0xf22e('0x3d')]({},_0x46067a,_0x40c0eb[_0xf22e('0x3e')]);return _0x15c519[_0xf22e('0x50')](_0x46067a);}})[_0xf22e('0x26')](function(_0x16cd56){if(_0x16cd56){_0x1a4eb0=_0x16cd56['length'];if(!_0x40c0eb[_0xf22e('0x2f')]['hasOwnProperty'](_0xf22e('0x36'))){_0x46067a[_0xf22e('0x37')]=qs[_0xf22e('0x37')](_0x40c0eb[_0xf22e('0x2f')][_0xf22e('0x37')]);_0x46067a[_0xf22e('0x1e')]=qs[_0xf22e('0x1e')](_0x40c0eb[_0xf22e('0x2f')][_0xf22e('0x1e')]);}return _0x15c519['getDescriptions'](_0x46067a);}})[_0xf22e('0x26')](function(_0xb0763a){if(_0xb0763a){return _0xb0763a?{'count':_0x1a4eb0,'rows':_0xb0763a}:null;}})[_0xf22e('0x26')](respondWithResult(_0x4c4554,null))[_0xf22e('0x43')](handleError(_0x4c4554,null));};exports[_0xf22e('0x51')]=function(_0x52e683,_0x4cdfd1,_0x558aa4){var _0x35f3d0={};var _0x13186d={};var _0x4412f0;var _0x4ed94a;return db['ZendeskConfiguration'][_0xf22e('0x4d')]({'where':{'id':_0x52e683[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x4cdfd1,null))[_0xf22e('0x26')](function(_0x1e9d36){if(_0x1e9d36){_0x4412f0=_0x1e9d36;_0x13186d[_0xf22e('0x2e')]=_[_0xf22e('0x46')](db[_0xf22e('0x52')]['rawAttributes']);_0x13186d[_0xf22e('0x2f')]=_[_0xf22e('0x46')](_0x52e683['query']);_0x13186d[_0xf22e('0x30')]=_[_0xf22e('0x31')](_0x13186d['model'],_0x13186d[_0xf22e('0x2f')]);_0x35f3d0[_0xf22e('0x32')]=_['intersection'](_0x13186d[_0xf22e('0x2e')],qs[_0xf22e('0x33')](_0x52e683['query'][_0xf22e('0x33')]));_0x35f3d0[_0xf22e('0x32')]=_0x35f3d0[_0xf22e('0x32')][_0xf22e('0x34')]?_0x35f3d0['attributes']:_0x13186d[_0xf22e('0x2e')];_0x35f3d0[_0xf22e('0x38')]=qs[_0xf22e('0x39')](_0x52e683[_0xf22e('0x2f')][_0xf22e('0x39')]);_0x35f3d0[_0xf22e('0x3b')]=qs[_0xf22e('0x30')](_[_0xf22e('0x3a')](_0x52e683['query'],_0x13186d['filters']));if(_0x52e683[_0xf22e('0x2f')]['filter']){_0x35f3d0[_0xf22e('0x3b')]=_[_0xf22e('0x3d')](_0x35f3d0[_0xf22e('0x3b')],{'$or':_[_0xf22e('0x2a')](_0x35f3d0[_0xf22e('0x32')],function(_0x150845){var _0x7b90f5={};_0x7b90f5[_0x150845]={'$like':'%'+_0x52e683[_0xf22e('0x2f')][_0xf22e('0x3c')]+'%'};return _0x7b90f5;})});}_0x35f3d0=_[_0xf22e('0x3d')]({},_0x35f3d0,_0x52e683[_0xf22e('0x3e')]);return _0x4412f0['getTags'](_0x35f3d0);}})[_0xf22e('0x26')](function(_0x5a8649){if(_0x5a8649){_0x4ed94a=_0x5a8649[_0xf22e('0x34')];if(!_0x52e683[_0xf22e('0x2f')][_0xf22e('0x35')](_0xf22e('0x36'))){_0x35f3d0['limit']=qs[_0xf22e('0x37')](_0x52e683[_0xf22e('0x2f')]['limit']);_0x35f3d0[_0xf22e('0x1e')]=qs[_0xf22e('0x1e')](_0x52e683[_0xf22e('0x2f')][_0xf22e('0x1e')]);}return _0x4412f0[_0xf22e('0x51')](_0x35f3d0);}})['then'](function(_0x33d83d){if(_0x33d83d){return _0x33d83d?{'count':_0x4ed94a,'rows':_0x33d83d}:null;}})[_0xf22e('0x26')](respondWithResult(_0x4cdfd1,null))[_0xf22e('0x43')](handleError(_0x4cdfd1,null));};exports['setTags']=function(_0x27ec1c,_0x1d3bcb,_0x5e0bf7){if(_0x27ec1c[_0xf22e('0x4a')]['id']){delete _0x27ec1c[_0xf22e('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xf22e('0x4d')]({'where':{'id':_0x27ec1c[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x1d3bcb,null))[_0xf22e('0x26')](function(_0x485a13){if(_0x485a13){return _0x485a13[_0xf22e('0x53')](_0x27ec1c['body'][_0xf22e('0x54')]||[]);}return null;})['then'](respondWithResult(_0x1d3bcb,null))[_0xf22e('0x43')](handleError(_0x1d3bcb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b3c0efc..69e78a5 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 _0x7d25=['api','moment','bluebird','request-promise','path','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger'];(function(_0x29352f,_0x458a13){var _0x217e89=function(_0x54ec85){while(--_0x54ec85){_0x29352f['push'](_0x29352f['shift']());}};_0x217e89(++_0x458a13);}(_0x7d25,0x8a));var _0x57d2=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x7d25[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment','request-promise','path','rimraf'];(function(_0x19249c,_0x2a2804){var _0xfc73ad=function(_0x7c480d){while(--_0x7c480d){_0x19249c['push'](_0x19249c['shift']());}};_0xfc73ad(++_0x2a2804);}(_0xefda,0x96));var _0xaefd=function(_0x2e0e55,_0x1a4e24){_0x2e0e55=_0x2e0e55-0x0;var _0x2c6fad=_0xefda[_0x2e0e55];return _0x2c6fad;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'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 c8c6ead..63f3bb0 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 _0x4b43=['../../config/utils','rpc','../../config/environment','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x4b43,0x13b));var _0x34b4=function(_0x187364,_0x44a6fc){_0x187364=_0x187364-0x0;var _0x88bd8b=_0x4b43[_0x187364];return _0x88bd8b;};'use strict';var _=require('lodash');var util=require(_0x34b4('0x0'));var moment=require(_0x34b4('0x1'));var BPromise=require(_0x34b4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34b4('0x3'));var db=require(_0x34b4('0x4'))['db'];var utils=require(_0x34b4('0x5'));var logger=require('../../config/logger')(_0x34b4('0x6'));var config=require(_0x34b4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34b4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4882b3,_0x2cb493,_0x5b54cc){return new BPromise(function(_0x5750b6,_0x348955){return client['request'](_0x4882b3,_0x5b54cc)[_0x34b4('0x9')](function(_0xff8961){logger[_0x34b4('0xa')](_0x34b4('0xb'),_0x2cb493,'request\x20sent');logger[_0x34b4('0xc')](_0x34b4('0xd'),_0x2cb493,'request\x20sent',JSON[_0x34b4('0xe')](_0xff8961));if(_0xff8961[_0x34b4('0xf')]){if(_0xff8961[_0x34b4('0xf')]['code']===0x1f4){logger[_0x34b4('0xf')](_0x34b4('0xb'),_0x2cb493,_0xff8961['error']['message']);return _0x348955(_0xff8961[_0x34b4('0xf')][_0x34b4('0x10')]);}logger['error'](_0x34b4('0xb'),_0x2cb493,_0xff8961['error'][_0x34b4('0x10')]);return _0x5750b6(_0xff8961[_0x34b4('0xf')][_0x34b4('0x10')]);}else{logger[_0x34b4('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2cb493,_0x34b4('0x11'));_0x5750b6(_0xff8961[_0x34b4('0x12')]['message']);}})[_0x34b4('0x13')](function(_0x160ad9){logger[_0x34b4('0xf')](_0x34b4('0xb'),_0x2cb493,_0x160ad9);_0x348955(_0x160ad9);});});} \ No newline at end of file +var _0x5786=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x5786,0xea));var _0x6578=function(_0x87b887,_0x486517){_0x87b887=_0x87b887-0x0;var _0x4dad53=_0x5786[_0x87b887];return _0x4dad53;};'use strict';var _=require(_0x6578('0x0'));var util=require(_0x6578('0x1'));var moment=require('moment');var BPromise=require(_0x6578('0x2'));var rs=require(_0x6578('0x3'));var fs=require('fs');var Redis=require(_0x6578('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6578('0x5'))(_0x6578('0x6'));var config=require(_0x6578('0x7'));var jayson=require(_0x6578('0x8'));var client=jayson[_0x6578('0x9')][_0x6578('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a4a33,_0x282b3f,_0x3edda3){return new BPromise(function(_0x16b5be,_0x5cf7e3){return client[_0x6578('0xb')](_0x1a4a33,_0x3edda3)['then'](function(_0x28b794){logger[_0x6578('0xc')](_0x6578('0xd'),_0x282b3f,_0x6578('0xe'));logger['debug'](_0x6578('0xf'),_0x282b3f,_0x6578('0xe'),JSON[_0x6578('0x10')](_0x28b794));if(_0x28b794['error']){if(_0x28b794[_0x6578('0x11')][_0x6578('0x12')]===0x1f4){logger['error'](_0x6578('0xd'),_0x282b3f,_0x28b794[_0x6578('0x11')]['message']);return _0x5cf7e3(_0x28b794[_0x6578('0x11')][_0x6578('0x13')]);}logger[_0x6578('0x11')](_0x6578('0xd'),_0x282b3f,_0x28b794[_0x6578('0x11')][_0x6578('0x13')]);return _0x16b5be(_0x28b794['error'][_0x6578('0x13')]);}else{logger[_0x6578('0xc')](_0x6578('0xd'),_0x282b3f,_0x6578('0xe'));_0x16b5be(_0x28b794['result'][_0x6578('0x13')]);}})[_0x6578('0x14')](function(_0x178cf1){logger[_0x6578('0x11')](_0x6578('0xd'),_0x282b3f,_0x178cf1);_0x5cf7e3(_0x178cf1);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index a115eb3..29b800c 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 _0xd972=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','index','isAuthenticated','show','post','create','/:id','delete'];(function(_0x5a06d9,_0xf62efa){var _0x5c1012=function(_0x45df53){while(--_0x45df53){_0x5a06d9['push'](_0x5a06d9['shift']());}};_0x5c1012(++_0xf62efa);}(_0xd972,0x1ee));var _0x2d97=function(_0x1add0a,_0xe035ff){_0x1add0a=_0x1add0a-0x0;var _0x4041ef=_0xd972[_0x1add0a];return _0x4041ef;};'use strict';var multer=require(_0x2d97('0x0'));var util=require(_0x2d97('0x1'));var path=require(_0x2d97('0x2'));var timeout=require(_0x2d97('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2d97('0x4'));var auth=require(_0x2d97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d97('0x6'));var controller=require(_0x2d97('0x7'));router[_0x2d97('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d97('0x9')]);router[_0x2d97('0x8')]('/:id',auth[_0x2d97('0xa')](),controller[_0x2d97('0xb')]);router[_0x2d97('0xc')]('/',auth['isAuthenticated'](),controller[_0x2d97('0xd')]);router['put'](_0x2d97('0xe'),auth[_0x2d97('0xa')](),controller['update']);router[_0x2d97('0xf')](_0x2d97('0xe'),auth[_0x2d97('0xa')](),controller['destroy']);module[_0x2d97('0x10')]=router; \ No newline at end of file +var _0x854c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x854c,0xa9));var _0xc854=function(_0x35211e,_0x10f8ce){_0x35211e=_0x35211e-0x0;var _0x325aa1=_0x854c[_0x35211e];return _0x325aa1;};'use strict';var multer=require(_0xc854('0x0'));var util=require('util');var path=require(_0xc854('0x1'));var timeout=require(_0xc854('0x2'));var express=require(_0xc854('0x3'));var router=express[_0xc854('0x4')]();var fs_extra=require(_0xc854('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc854('0x6'));var config=require(_0xc854('0x7'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc854('0x8')]);router[_0xc854('0x9')](_0xc854('0xa'),auth[_0xc854('0xb')](),controller[_0xc854('0xc')]);router[_0xc854('0xd')]('/',auth[_0xc854('0xb')](),controller[_0xc854('0xe')]);router[_0xc854('0xf')]('/:id',auth[_0xc854('0xb')](),controller[_0xc854('0x10')]);router['delete'](_0xc854('0xa'),auth[_0xc854('0xb')](),controller[_0xc854('0x11')]);module[_0xc854('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 99051cf..d8a71e1 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 _0x0555=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0xcd6010,_0x3cfc81){var _0xe3a132=function(_0x4bcf06){while(--_0x4bcf06){_0xcd6010['push'](_0xcd6010['shift']());}};_0xe3a132(++_0x3cfc81);}(_0x0555,0x6f));var _0x5055=function(_0x28addc,_0x4030dc){_0x28addc=_0x28addc-0x0;var _0x5ac85c=_0x0555[_0x28addc];return _0x5ac85c;};'use strict';var Sequelize=require(_0x5055('0x0'));module[_0x5055('0x1')]={'type':{'type':Sequelize[_0x5055('0x2')](_0x5055('0x3'),_0x5055('0x4'),_0x5055('0x5'),'keyValue',_0x5055('0x6')),'defaultValue':_0x5055('0x3')},'content':{'type':Sequelize[_0x5055('0x7')]},'key':{'type':Sequelize[_0x5055('0x7')]},'keyType':{'type':Sequelize[_0x5055('0x2')](_0x5055('0x3'),_0x5055('0x4'),_0x5055('0x5'))},'keyContent':{'type':Sequelize[_0x5055('0x7')]},'idField':{'type':Sequelize[_0x5055('0x7')]},'nameField':{'type':Sequelize[_0x5055('0x7')]},'customField':{'type':Sequelize[_0x5055('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5055('0x7')]}}; \ No newline at end of file +var _0xf571=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x16490f,_0x42f1d5){var _0x1c86e4=function(_0x581261){while(--_0x581261){_0x16490f['push'](_0x16490f['shift']());}};_0x1c86e4(++_0x42f1d5);}(_0xf571,0xe9));var _0x1f57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf571[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1f57('0x0'));module[_0x1f57('0x1')]={'type':{'type':Sequelize[_0x1f57('0x2')]('string',_0x1f57('0x3'),_0x1f57('0x4'),_0x1f57('0x5'),_0x1f57('0x6')),'defaultValue':_0x1f57('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1f57('0x8')]},'keyType':{'type':Sequelize[_0x1f57('0x2')](_0x1f57('0x7'),'variable',_0x1f57('0x4'))},'keyContent':{'type':Sequelize[_0x1f57('0x8')]},'idField':{'type':Sequelize[_0x1f57('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1f57('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f57('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0786e55..f62692e 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 _0x1db5=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','apply','reject','update','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','map','query','filters','intersection'];(function(_0x4cbe70,_0x2e83fc){var _0x1076b2=function(_0x1908b0){while(--_0x1908b0){_0x4cbe70['push'](_0x4cbe70['shift']());}};_0x1076b2(++_0x2e83fc);}(_0x1db5,0x1c0));var _0x51db=function(_0x3e6c7c,_0x1c0e57){_0x3e6c7c=_0x3e6c7c-0x0;var _0x3d3464=_0x1db5[_0x3e6c7c];return _0x3d3464;};'use strict';var emlformat=require(_0x51db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51db('0x1'));var jsonpatch=require(_0x51db('0x2'));var rp=require(_0x51db('0x3'));var moment=require('moment');var BPromise=require(_0x51db('0x4'));var Mustache=require('mustache');var util=require(_0x51db('0x5'));var path=require(_0x51db('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x51db('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51db('0x8'));var squel=require(_0x51db('0x9'));var crypto=require('crypto');var jsforce=require(_0x51db('0xa'));var deskjs=require(_0x51db('0xb'));var toCsv=require(_0x51db('0xc'));var querystring=require(_0x51db('0xd'));var Papa=require(_0x51db('0xe'));var Redis=require(_0x51db('0xf'));var authService=require(_0x51db('0x10'));var qs=require(_0x51db('0x11'));var as=require(_0x51db('0x12'));var hardwareService=require(_0x51db('0x13'));var logger=require(_0x51db('0x14'))(_0x51db('0x15'));var utils=require('../../config/utils');var config=require(_0x51db('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x51db('0x17'))['db'];function respondWithStatusCode(_0x2ce3d,_0x3e39ba){_0x3e39ba=_0x3e39ba||0xcc;return function(_0x368cb4){if(_0x368cb4){return _0x2ce3d['sendStatus'](_0x3e39ba);}return _0x2ce3d[_0x51db('0x18')](_0x3e39ba)[_0x51db('0x19')]();};}function respondWithResult(_0x3723ff,_0x53591c){_0x53591c=_0x53591c||0xc8;return function(_0x1bc2ce){if(_0x1bc2ce){return _0x3723ff[_0x51db('0x18')](_0x53591c)[_0x51db('0x1a')](_0x1bc2ce);}};}function respondWithFilteredResult(_0x26505f,_0x46b264){return function(_0x18f64d){if(_0x18f64d){var _0x499346=typeof _0x46b264[_0x51db('0x1b')]==='undefined'&&typeof _0x46b264[_0x51db('0x1c')]==='undefined';var _0x521835=_0x18f64d['count'];var _0x19d4bc=_0x499346?0x0:_0x46b264[_0x51db('0x1b')];var _0x2e7fa6=_0x499346?_0x18f64d[_0x51db('0x1d')]:_0x46b264['offset']+_0x46b264[_0x51db('0x1c')];var _0x266df7;if(_0x2e7fa6>=_0x521835){_0x2e7fa6=_0x521835;_0x266df7=0xc8;}else{_0x266df7=0xce;}_0x26505f[_0x51db('0x18')](_0x266df7);return _0x26505f['set']('Content-Range',_0x19d4bc+'-'+_0x2e7fa6+'/'+_0x521835)['json'](_0x18f64d);}return null;};}function patchUpdates(_0x3c0766){return function(_0x46dbe6){try{jsonpatch[_0x51db('0x1e')](_0x46dbe6,_0x3c0766,!![]);}catch(_0x24adc6){return BPromise[_0x51db('0x1f')](_0x24adc6);}return _0x46dbe6['save']();};}function saveUpdates(_0x129ab3,_0x4390fa){return function(_0x5c857a){if(_0x5c857a){return _0x5c857a[_0x51db('0x20')](_0x129ab3)[_0x51db('0x21')](function(_0x155a29){return _0x155a29;});}return null;};}function removeEntity(_0x59f50b,_0x305933){return function(_0x6aa56a){if(_0x6aa56a){return _0x6aa56a[_0x51db('0x22')]()['then'](function(){_0x59f50b[_0x51db('0x18')](0xcc)[_0x51db('0x19')]();});}};}function handleEntityNotFound(_0x4ceac4,_0x26c27d){return function(_0x46d2bb){if(!_0x46d2bb){_0x4ceac4['sendStatus'](0x194);}return _0x46d2bb;};}function handleError(_0x324e25,_0x12bd2f){_0x12bd2f=_0x12bd2f||0x1f4;return function(_0x17eabb){logger[_0x51db('0x23')](_0x17eabb[_0x51db('0x24')]);if(_0x17eabb[_0x51db('0x25')]){delete _0x17eabb[_0x51db('0x25')];}_0x324e25['status'](_0x12bd2f)[_0x51db('0x26')](_0x17eabb);};}exports[_0x51db('0x27')]=function(_0x445762,_0x5d4821){var _0x1850ce={},_0x227cca={},_0x4b414a={'count':0x0,'rows':[]};var _0x5d9ca4=_['map'](db[_0x51db('0x28')][_0x51db('0x29')],function(_0x3311f5){return{'name':_0x3311f5[_0x51db('0x2a')],'type':_0x3311f5[_0x51db('0x2b')][_0x51db('0x2c')]};});_0x227cca['model']=_[_0x51db('0x2d')](_0x5d9ca4,_0x51db('0x25'));_0x227cca['query']=_['keys'](_0x445762[_0x51db('0x2e')]);_0x227cca[_0x51db('0x2f')]=_[_0x51db('0x30')](_0x227cca[_0x51db('0x31')],_0x227cca[_0x51db('0x2e')]);_0x1850ce[_0x51db('0x32')]=_['intersection'](_0x227cca[_0x51db('0x31')],qs[_0x51db('0x33')](_0x445762[_0x51db('0x2e')]['fields']));_0x1850ce[_0x51db('0x32')]=_0x1850ce[_0x51db('0x32')][_0x51db('0x34')]?_0x1850ce[_0x51db('0x32')]:_0x227cca[_0x51db('0x31')];if(!_0x445762['query'][_0x51db('0x35')](_0x51db('0x36'))){_0x1850ce[_0x51db('0x1c')]=qs['limit'](_0x445762[_0x51db('0x2e')][_0x51db('0x1c')]);_0x1850ce[_0x51db('0x1b')]=qs[_0x51db('0x1b')](_0x445762[_0x51db('0x2e')][_0x51db('0x1b')]);}_0x1850ce['order']=qs[_0x51db('0x37')](_0x445762[_0x51db('0x2e')][_0x51db('0x37')]);_0x1850ce[_0x51db('0x38')]=qs[_0x51db('0x2f')](_['pick'](_0x445762[_0x51db('0x2e')],_0x227cca[_0x51db('0x2f')]),_0x5d9ca4);if(_0x445762[_0x51db('0x2e')]['filter']){_0x1850ce[_0x51db('0x38')]=_[_0x51db('0x39')](_0x1850ce[_0x51db('0x38')],{'$or':_[_0x51db('0x2d')](_0x5d9ca4,function(_0x2ff316){if(_0x2ff316[_0x51db('0x2b')]!==_0x51db('0x3a')){var _0x57b604={};_0x57b604[_0x2ff316[_0x51db('0x25')]]={'$like':'%'+_0x445762[_0x51db('0x2e')][_0x51db('0x3b')]+'%'};return _0x57b604;}})});}_0x1850ce=_[_0x51db('0x39')]({},_0x1850ce,_0x445762[_0x51db('0x3c')]);var _0x80e15a={'where':_0x1850ce[_0x51db('0x38')]};return db[_0x51db('0x28')]['count'](_0x80e15a)[_0x51db('0x21')](function(_0x238a57){_0x4b414a[_0x51db('0x1d')]=_0x238a57;if(_0x445762['query']['includeAll']){_0x1850ce[_0x51db('0x3d')]=[{'all':!![]}];}return db[_0x51db('0x28')][_0x51db('0x3e')](_0x1850ce);})['then'](function(_0x202e14){_0x4b414a[_0x51db('0x3f')]=_0x202e14;return _0x4b414a;})[_0x51db('0x21')](respondWithFilteredResult(_0x5d4821,_0x1850ce))[_0x51db('0x40')](handleError(_0x5d4821,null));};exports[_0x51db('0x41')]=function(_0x58e4e7,_0x3f9e3d){var _0x463ed0={'raw':!![],'where':{'id':_0x58e4e7[_0x51db('0x42')]['id']}},_0x153be1={};_0x153be1['model']=_[_0x51db('0x43')](db['ZendeskField'][_0x51db('0x29')]);_0x153be1[_0x51db('0x2e')]=_['keys'](_0x58e4e7[_0x51db('0x2e')]);_0x153be1['filters']=_[_0x51db('0x30')](_0x153be1[_0x51db('0x31')],_0x153be1[_0x51db('0x2e')]);_0x463ed0[_0x51db('0x32')]=_[_0x51db('0x30')](_0x153be1[_0x51db('0x31')],qs[_0x51db('0x33')](_0x58e4e7[_0x51db('0x2e')][_0x51db('0x33')]));_0x463ed0['attributes']=_0x463ed0['attributes'][_0x51db('0x34')]?_0x463ed0[_0x51db('0x32')]:_0x153be1[_0x51db('0x31')];if(_0x58e4e7[_0x51db('0x2e')]['includeAll']){_0x463ed0['include']=[{'all':!![]}];}_0x463ed0=_[_0x51db('0x39')]({},_0x463ed0,_0x58e4e7['options']);return db[_0x51db('0x28')][_0x51db('0x44')](_0x463ed0)[_0x51db('0x21')](handleEntityNotFound(_0x3f9e3d,null))[_0x51db('0x21')](respondWithResult(_0x3f9e3d,null))[_0x51db('0x40')](handleError(_0x3f9e3d,null));};exports['create']=function(_0x2d7101,_0x36a212){return db['ZendeskField'][_0x51db('0x45')](_0x2d7101[_0x51db('0x46')],{})['then'](respondWithResult(_0x36a212,0xc9))[_0x51db('0x40')](handleError(_0x36a212,null));};exports['update']=function(_0x3c179e,_0x478c8f){if(_0x3c179e['body']['id']){delete _0x3c179e[_0x51db('0x46')]['id'];}return db['ZendeskField'][_0x51db('0x44')]({'where':{'id':_0x3c179e[_0x51db('0x42')]['id']}})[_0x51db('0x21')](handleEntityNotFound(_0x478c8f,null))[_0x51db('0x21')](saveUpdates(_0x3c179e[_0x51db('0x46')],null))[_0x51db('0x21')](respondWithResult(_0x478c8f,null))[_0x51db('0x40')](handleError(_0x478c8f,null));};exports[_0x51db('0x22')]=function(_0x1799d7,_0x49c77a){return db['ZendeskField'][_0x51db('0x44')]({'where':{'id':_0x1799d7[_0x51db('0x42')]['id']}})[_0x51db('0x21')](handleEntityNotFound(_0x49c77a,null))[_0x51db('0x21')](removeEntity(_0x49c77a,null))[_0x51db('0x40')](handleError(_0x49c77a,null));}; \ No newline at end of file +var _0x40d4=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','then','destroy','stack','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','ZendeskField','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','update','eml-format'];(function(_0x49d13e,_0x43e265){var _0x417ad5=function(_0x58ee19){while(--_0x58ee19){_0x49d13e['push'](_0x49d13e['shift']());}};_0x417ad5(++_0x43e265);}(_0x40d4,0x16c));var _0x440d=function(_0x143187,_0x421857){_0x143187=_0x143187-0x0;var _0x32cf7e=_0x40d4[_0x143187];return _0x32cf7e;};'use strict';var emlformat=require(_0x440d('0x0'));var rimraf=require(_0x440d('0x1'));var zipdir=require(_0x440d('0x2'));var jsonpatch=require(_0x440d('0x3'));var rp=require(_0x440d('0x4'));var moment=require(_0x440d('0x5'));var BPromise=require(_0x440d('0x6'));var Mustache=require(_0x440d('0x7'));var util=require(_0x440d('0x8'));var path=require(_0x440d('0x9'));var sox=require('sox');var csv=require(_0x440d('0xa'));var ejs=require(_0x440d('0xb'));var fs=require('fs');var fs_extra=require(_0x440d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x440d('0xd'));var toCsv=require(_0x440d('0xa'));var querystring=require(_0x440d('0xe'));var Papa=require(_0x440d('0xf'));var Redis=require(_0x440d('0x10'));var authService=require(_0x440d('0x11'));var qs=require(_0x440d('0x12'));var as=require(_0x440d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x440d('0x14'))(_0x440d('0x15'));var utils=require(_0x440d('0x16'));var config=require(_0x440d('0x17'));var licenseUtil=require(_0x440d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21deba,_0x3b3e7c){_0x3b3e7c=_0x3b3e7c||0xcc;return function(_0x446420){if(_0x446420){return _0x21deba[_0x440d('0x19')](_0x3b3e7c);}return _0x21deba[_0x440d('0x1a')](_0x3b3e7c)[_0x440d('0x1b')]();};}function respondWithResult(_0x41bc41,_0x2f4c1e){_0x2f4c1e=_0x2f4c1e||0xc8;return function(_0x197013){if(_0x197013){return _0x41bc41[_0x440d('0x1a')](_0x2f4c1e)[_0x440d('0x1c')](_0x197013);}};}function respondWithFilteredResult(_0x31dccc,_0x48e9d3){return function(_0xeac57b){if(_0xeac57b){var _0x23628b=typeof _0x48e9d3['offset']===_0x440d('0x1d')&&typeof _0x48e9d3[_0x440d('0x1e')]===_0x440d('0x1d');var _0x720013=_0xeac57b['count'];var _0x5c3bfb=_0x23628b?0x0:_0x48e9d3[_0x440d('0x1f')];var _0x5b4831=_0x23628b?_0xeac57b[_0x440d('0x20')]:_0x48e9d3[_0x440d('0x1f')]+_0x48e9d3[_0x440d('0x1e')];var _0x4b94bb;if(_0x5b4831>=_0x720013){_0x5b4831=_0x720013;_0x4b94bb=0xc8;}else{_0x4b94bb=0xce;}_0x31dccc[_0x440d('0x1a')](_0x4b94bb);return _0x31dccc['set']('Content-Range',_0x5c3bfb+'-'+_0x5b4831+'/'+_0x720013)[_0x440d('0x1c')](_0xeac57b);}return null;};}function patchUpdates(_0x303b2b){return function(_0x2a0e8e){try{jsonpatch[_0x440d('0x21')](_0x2a0e8e,_0x303b2b,!![]);}catch(_0x15f644){return BPromise[_0x440d('0x22')](_0x15f644);}return _0x2a0e8e['save']();};}function saveUpdates(_0x44cef9,_0x535e51){return function(_0x3d3635){if(_0x3d3635){return _0x3d3635['update'](_0x44cef9)[_0x440d('0x23')](function(_0x2af96c){return _0x2af96c;});}return null;};}function removeEntity(_0x475a9e,_0x145152){return function(_0x59f515){if(_0x59f515){return _0x59f515[_0x440d('0x24')]()['then'](function(){_0x475a9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558f05,_0x5e4931){return function(_0x57adb0){if(!_0x57adb0){_0x558f05[_0x440d('0x19')](0x194);}return _0x57adb0;};}function handleError(_0x3a3501,_0x2f7ac3){_0x2f7ac3=_0x2f7ac3||0x1f4;return function(_0x418774){logger['error'](_0x418774[_0x440d('0x25')]);if(_0x418774['name']){delete _0x418774[_0x440d('0x26')];}_0x3a3501[_0x440d('0x1a')](_0x2f7ac3)['send'](_0x418774);};}exports[_0x440d('0x27')]=function(_0x4867da,_0x6b0f3){var _0x591704={},_0x5972dd={},_0xaf3d57={'count':0x0,'rows':[]};var _0xb74f3b=_[_0x440d('0x28')](db['ZendeskField']['rawAttributes'],function(_0x270069){return{'name':_0x270069[_0x440d('0x29')],'type':_0x270069['type'][_0x440d('0x2a')]};});_0x5972dd[_0x440d('0x2b')]=_[_0x440d('0x28')](_0xb74f3b,_0x440d('0x26'));_0x5972dd[_0x440d('0x2c')]=_[_0x440d('0x2d')](_0x4867da['query']);_0x5972dd[_0x440d('0x2e')]=_[_0x440d('0x2f')](_0x5972dd[_0x440d('0x2b')],_0x5972dd[_0x440d('0x2c')]);_0x591704[_0x440d('0x30')]=_[_0x440d('0x2f')](_0x5972dd[_0x440d('0x2b')],qs['fields'](_0x4867da[_0x440d('0x2c')][_0x440d('0x31')]));_0x591704[_0x440d('0x30')]=_0x591704[_0x440d('0x30')][_0x440d('0x32')]?_0x591704[_0x440d('0x30')]:_0x5972dd[_0x440d('0x2b')];if(!_0x4867da['query'][_0x440d('0x33')](_0x440d('0x34'))){_0x591704['limit']=qs[_0x440d('0x1e')](_0x4867da[_0x440d('0x2c')][_0x440d('0x1e')]);_0x591704[_0x440d('0x1f')]=qs['offset'](_0x4867da[_0x440d('0x2c')][_0x440d('0x1f')]);}_0x591704[_0x440d('0x35')]=qs[_0x440d('0x36')](_0x4867da[_0x440d('0x2c')][_0x440d('0x36')]);_0x591704[_0x440d('0x37')]=qs['filters'](_['pick'](_0x4867da[_0x440d('0x2c')],_0x5972dd[_0x440d('0x2e')]),_0xb74f3b);if(_0x4867da[_0x440d('0x2c')][_0x440d('0x38')]){_0x591704[_0x440d('0x37')]=_[_0x440d('0x39')](_0x591704['where'],{'$or':_[_0x440d('0x28')](_0xb74f3b,function(_0x1ba991){if(_0x1ba991[_0x440d('0x3a')]!==_0x440d('0x3b')){var _0x3f1193={};_0x3f1193[_0x1ba991[_0x440d('0x26')]]={'$like':'%'+_0x4867da[_0x440d('0x2c')]['filter']+'%'};return _0x3f1193;}})});}_0x591704=_[_0x440d('0x39')]({},_0x591704,_0x4867da[_0x440d('0x3c')]);var _0x3b7b29={'where':_0x591704['where']};return db[_0x440d('0x3d')][_0x440d('0x20')](_0x3b7b29)[_0x440d('0x23')](function(_0x346cea){_0xaf3d57[_0x440d('0x20')]=_0x346cea;if(_0x4867da[_0x440d('0x2c')][_0x440d('0x3e')]){_0x591704[_0x440d('0x3f')]=[{'all':!![]}];}return db[_0x440d('0x3d')]['findAll'](_0x591704);})['then'](function(_0x4b503b){_0xaf3d57[_0x440d('0x40')]=_0x4b503b;return _0xaf3d57;})[_0x440d('0x23')](respondWithFilteredResult(_0x6b0f3,_0x591704))[_0x440d('0x41')](handleError(_0x6b0f3,null));};exports[_0x440d('0x42')]=function(_0xad626b,_0x49383d){var _0xefda4d={'raw':!![],'where':{'id':_0xad626b[_0x440d('0x43')]['id']}},_0x14ddf1={};_0x14ddf1[_0x440d('0x2b')]=_[_0x440d('0x2d')](db['ZendeskField'][_0x440d('0x44')]);_0x14ddf1[_0x440d('0x2c')]=_[_0x440d('0x2d')](_0xad626b[_0x440d('0x2c')]);_0x14ddf1[_0x440d('0x2e')]=_[_0x440d('0x2f')](_0x14ddf1[_0x440d('0x2b')],_0x14ddf1[_0x440d('0x2c')]);_0xefda4d['attributes']=_[_0x440d('0x2f')](_0x14ddf1[_0x440d('0x2b')],qs[_0x440d('0x31')](_0xad626b['query']['fields']));_0xefda4d[_0x440d('0x30')]=_0xefda4d[_0x440d('0x30')][_0x440d('0x32')]?_0xefda4d[_0x440d('0x30')]:_0x14ddf1[_0x440d('0x2b')];if(_0xad626b['query'][_0x440d('0x3e')]){_0xefda4d[_0x440d('0x3f')]=[{'all':!![]}];}_0xefda4d=_[_0x440d('0x39')]({},_0xefda4d,_0xad626b['options']);return db[_0x440d('0x3d')][_0x440d('0x45')](_0xefda4d)['then'](handleEntityNotFound(_0x49383d,null))[_0x440d('0x23')](respondWithResult(_0x49383d,null))[_0x440d('0x41')](handleError(_0x49383d,null));};exports[_0x440d('0x46')]=function(_0x11906a,_0x5929c2){return db['ZendeskField'][_0x440d('0x46')](_0x11906a[_0x440d('0x47')],{})[_0x440d('0x23')](respondWithResult(_0x5929c2,0xc9))['catch'](handleError(_0x5929c2,null));};exports[_0x440d('0x48')]=function(_0x47ebdb,_0x3f34df){if(_0x47ebdb[_0x440d('0x47')]['id']){delete _0x47ebdb[_0x440d('0x47')]['id'];}return db['ZendeskField'][_0x440d('0x45')]({'where':{'id':_0x47ebdb[_0x440d('0x43')]['id']}})[_0x440d('0x23')](handleEntityNotFound(_0x3f34df,null))[_0x440d('0x23')](saveUpdates(_0x47ebdb['body'],null))[_0x440d('0x23')](respondWithResult(_0x3f34df,null))[_0x440d('0x41')](handleError(_0x3f34df,null));};exports[_0x440d('0x24')]=function(_0x5a9479,_0x35eaaa){return db[_0x440d('0x3d')][_0x440d('0x45')]({'where':{'id':_0x5a9479[_0x440d('0x43')]['id']}})['then'](handleEntityNotFound(_0x35eaaa,null))[_0x440d('0x23')](removeEntity(_0x35eaaa,null))[_0x440d('0x41')](handleError(_0x35eaaa,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7b347ac..7f82dc3 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 _0xdb92=['path','rimraf','../../config/environment','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x481c7d,_0x4394d6){var _0x43abde=function(_0x388616){while(--_0x388616){_0x481c7d['push'](_0x481c7d['shift']());}};_0x43abde(++_0x4394d6);}(_0xdb92,0x19d));var _0x2db9=function(_0x58cb87,_0x4d7cd9){_0x58cb87=_0x58cb87-0x0;var _0xfcc448=_0xdb92[_0x58cb87];return _0xfcc448;};'use strict';var _=require(_0x2db9('0x0'));var util=require(_0x2db9('0x1'));var logger=require(_0x2db9('0x2'))(_0x2db9('0x3'));var moment=require(_0x2db9('0x4'));var BPromise=require(_0x2db9('0x5'));var rp=require(_0x2db9('0x6'));var fs=require('fs');var path=require(_0x2db9('0x7'));var rimraf=require(_0x2db9('0x8'));var config=require(_0x2db9('0x9'));var attributes=require('./intZendeskField.attributes');module[_0x2db9('0xa')]=function(_0x76c3a9,_0x1c536f){return _0x76c3a9['define'](_0x2db9('0xb'),attributes,{'tableName':_0x2db9('0xc'),'paranoid':![],'indexes':[{'name':_0x2db9('0xd'),'fields':['idField',_0x2db9('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4872=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4872,0x72));var _0x2487=function(_0x308c81,_0x3b1c85){_0x308c81=_0x308c81-0x0;var _0x5cc912=_0x4872[_0x308c81];return _0x5cc912;};'use strict';var _=require(_0x2487('0x0'));var util=require(_0x2487('0x1'));var logger=require(_0x2487('0x2'))(_0x2487('0x3'));var moment=require(_0x2487('0x4'));var BPromise=require(_0x2487('0x5'));var rp=require(_0x2487('0x6'));var fs=require('fs');var path=require(_0x2487('0x7'));var rimraf=require('rimraf');var config=require(_0x2487('0x8'));var attributes=require(_0x2487('0x9'));module[_0x2487('0xa')]=function(_0xdf1738,_0x5a3393){return _0xdf1738['define']('ZendeskField',attributes,{'tableName':_0x2487('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x2487('0xc'),_0x2487('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 b47f480..0f63959 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 _0x35e1=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x35e1,0xf0));var _0x135e=function(_0x19a7d3,_0x487155){_0x19a7d3=_0x19a7d3-0x0;var _0x569a8e=_0x35e1[_0x19a7d3];return _0x569a8e;};'use strict';var _=require(_0x135e('0x0'));var util=require(_0x135e('0x1'));var moment=require(_0x135e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x135e('0x3'))['db'];var utils=require(_0x135e('0x4'));var logger=require(_0x135e('0x5'))('rpc');var config=require(_0x135e('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4535f1,_0x2579bf,_0x4549ef){return new BPromise(function(_0x5b2c67,_0x134817){return client['request'](_0x4535f1,_0x4549ef)[_0x135e('0x7')](function(_0x4002b9){logger[_0x135e('0x8')](_0x135e('0x9'),_0x2579bf,_0x135e('0xa'));logger[_0x135e('0xb')](_0x135e('0xc'),_0x2579bf,_0x135e('0xa'),JSON[_0x135e('0xd')](_0x4002b9));if(_0x4002b9[_0x135e('0xe')]){if(_0x4002b9[_0x135e('0xe')][_0x135e('0xf')]===0x1f4){logger[_0x135e('0xe')](_0x135e('0x9'),_0x2579bf,_0x4002b9[_0x135e('0xe')][_0x135e('0x10')]);return _0x134817(_0x4002b9[_0x135e('0xe')][_0x135e('0x10')]);}logger[_0x135e('0xe')](_0x135e('0x9'),_0x2579bf,_0x4002b9[_0x135e('0xe')]['message']);return _0x5b2c67(_0x4002b9['error'][_0x135e('0x10')]);}else{logger[_0x135e('0x8')]('ZendeskField,\x20%s,\x20%s',_0x2579bf,'request\x20sent');_0x5b2c67(_0x4002b9['result']['message']);}})[_0x135e('0x11')](function(_0x4ed9bb){logger[_0x135e('0xe')](_0x135e('0x9'),_0x2579bf,_0x4ed9bb);_0x134817(_0x4ed9bb);});});} \ No newline at end of file +var _0x0d7b=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x67e749,_0x365d09){var _0x3ec9de=function(_0x121672){while(--_0x121672){_0x67e749['push'](_0x67e749['shift']());}};_0x3ec9de(++_0x365d09);}(_0x0d7b,0x174));var _0xb0d7=function(_0x3ecc22,_0x41ee7d){_0x3ecc22=_0x3ecc22-0x0;var _0x462231=_0x0d7b[_0x3ecc22];return _0x462231;};'use strict';var _=require('lodash');var util=require(_0xb0d7('0x0'));var moment=require(_0xb0d7('0x1'));var BPromise=require(_0xb0d7('0x2'));var rs=require(_0xb0d7('0x3'));var fs=require('fs');var Redis=require(_0xb0d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0d7('0x5'))(_0xb0d7('0x6'));var config=require(_0xb0d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb0d7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x262ab0,_0x46cbb2,_0x511f4e){return new BPromise(function(_0x3967ce,_0x5a37cb){return client[_0xb0d7('0x9')](_0x262ab0,_0x511f4e)[_0xb0d7('0xa')](function(_0xf77f7b){logger[_0xb0d7('0xb')](_0xb0d7('0xc'),_0x46cbb2,_0xb0d7('0xd'));logger[_0xb0d7('0xe')](_0xb0d7('0xf'),_0x46cbb2,_0xb0d7('0xd'),JSON[_0xb0d7('0x10')](_0xf77f7b));if(_0xf77f7b[_0xb0d7('0x11')]){if(_0xf77f7b['error'][_0xb0d7('0x12')]===0x1f4){logger[_0xb0d7('0x11')](_0xb0d7('0xc'),_0x46cbb2,_0xf77f7b['error'][_0xb0d7('0x13')]);return _0x5a37cb(_0xf77f7b['error'][_0xb0d7('0x13')]);}logger[_0xb0d7('0x11')](_0xb0d7('0xc'),_0x46cbb2,_0xf77f7b['error'][_0xb0d7('0x13')]);return _0x3967ce(_0xf77f7b[_0xb0d7('0x11')]['message']);}else{logger[_0xb0d7('0xb')](_0xb0d7('0xc'),_0x46cbb2,_0xb0d7('0xd'));_0x3967ce(_0xf77f7b[_0xb0d7('0x14')][_0xb0d7('0x13')]);}})[_0xb0d7('0x15')](function(_0x13c982){logger[_0xb0d7('0x11')](_0xb0d7('0xc'),_0x46cbb2,_0x13c982);_0x5a37cb(_0x13c982);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f505421..174af23 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 _0x36b9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','put','update','delete','multer','util','path'];(function(_0x4fb584,_0x250ea7){var _0x16c087=function(_0x25626b){while(--_0x25626b){_0x4fb584['push'](_0x4fb584['shift']());}};_0x16c087(++_0x250ea7);}(_0x36b9,0xba));var _0x936b=function(_0x4253a9,_0x17583a){_0x4253a9=_0x4253a9-0x0;var _0x1e7ed8=_0x36b9[_0x4253a9];return _0x1e7ed8;};'use strict';var multer=require(_0x936b('0x0'));var util=require(_0x936b('0x1'));var path=require(_0x936b('0x2'));var timeout=require(_0x936b('0x3'));var express=require(_0x936b('0x4'));var router=express[_0x936b('0x5')]();var fs_extra=require(_0x936b('0x6'));var auth=require(_0x936b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x936b('0x8'));var controller=require(_0x936b('0x9'));router[_0x936b('0xa')]('/',auth[_0x936b('0xb')](),controller[_0x936b('0xc')]);router[_0x936b('0xa')](_0x936b('0xd'),auth[_0x936b('0xb')](),controller['show']);router[_0x936b('0xa')]('/:id/configurations',auth[_0x936b('0xb')](),controller[_0x936b('0xe')]);router['get'](_0x936b('0xf'),auth[_0x936b('0xb')](),controller[_0x936b('0x10')]);router['post']('/',auth[_0x936b('0xb')](),controller['create']);router[_0x936b('0x11')]('/:id/configurations',auth[_0x936b('0xb')](),controller['addConfiguration']);router[_0x936b('0x12')](_0x936b('0xd'),auth['isAuthenticated'](),controller[_0x936b('0x13')]);router[_0x936b('0x14')](_0x936b('0xd'),auth[_0x936b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb86e=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','/:id','destroy','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);}(_0xb86e,0x196));var _0xeb86=function(_0x381cc4,_0x1694f2){_0x381cc4=_0x381cc4-0x0;var _0x1fdac0=_0xb86e[_0x381cc4];return _0x1fdac0;};'use strict';var multer=require(_0xeb86('0x0'));var util=require(_0xeb86('0x1'));var path=require(_0xeb86('0x2'));var timeout=require(_0xeb86('0x3'));var express=require(_0xeb86('0x4'));var router=express[_0xeb86('0x5')]();var fs_extra=require(_0xeb86('0x6'));var auth=require(_0xeb86('0x7'));var interaction=require(_0xeb86('0x8'));var config=require(_0xeb86('0x9'));var controller=require('./intZohoAccount.controller');router[_0xeb86('0xa')]('/',auth[_0xeb86('0xb')](),controller[_0xeb86('0xc')]);router[_0xeb86('0xa')]('/:id',auth[_0xeb86('0xb')](),controller[_0xeb86('0xd')]);router[_0xeb86('0xa')](_0xeb86('0xe'),auth[_0xeb86('0xb')](),controller[_0xeb86('0xf')]);router[_0xeb86('0xa')](_0xeb86('0x10'),auth[_0xeb86('0xb')](),controller[_0xeb86('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb86('0x12')]);router[_0xeb86('0x13')]('/:id/configurations',auth[_0xeb86('0xb')](),controller[_0xeb86('0x14')]);router[_0xeb86('0x15')]('/:id',auth[_0xeb86('0xb')](),controller[_0xeb86('0x16')]);router[_0xeb86('0x17')](_0xeb86('0x18'),auth['isAuthenticated'](),controller[_0xeb86('0x19')]);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 65638da..0a0297f 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 _0x41bb=['exports','STRING','sequelize'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x41bb,0xc5));var _0xb41b=function(_0x36bc48,_0x5afab7){_0x36bc48=_0x36bc48-0x0;var _0x42938b=_0x41bb[_0x36bc48];return _0x42938b;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb41b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xb41b('0x2')]},'clientId':{'type':Sequelize[_0xb41b('0x2')]},'clientSecret':{'type':Sequelize[_0xb41b('0x2')]},'serverUrl':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file +var _0x84ab=['sequelize','exports','STRING'];(function(_0x5ef72f,_0x492db8){var _0x13b41b=function(_0x211fa5){while(--_0x211fa5){_0x5ef72f['push'](_0x5ef72f['shift']());}};_0x13b41b(++_0x492db8);}(_0x84ab,0x12f));var _0xb84a=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x84ab[_0x37a79c];return _0x561d89;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'name':{'type':Sequelize[_0xb84a('0x2')]},'description':{'type':Sequelize[_0xb84a('0x2')]},'host':{'type':Sequelize[_0xb84a('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb84a('0x2')]},'clientSecret':{'type':Sequelize[_0xb84a('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb84a('0x2')]},'refreshToken':{'type':Sequelize[_0xb84a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c553413..a26cf09 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 _0xc463=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','find','create','body','update','params','getConfigurations','ZohoConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','code','com','serverUrl','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','push','custom_field','picklist','pick_list_values','test','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','keys','query','filters'];(function(_0x57fd0d,_0x2630ea){var _0x4b57f6=function(_0x5d314c){while(--_0x5d314c){_0x57fd0d['push'](_0x57fd0d['shift']());}};_0x4b57f6(++_0x2630ea);}(_0xc463,0x13a));var _0x3c46=function(_0x210b93,_0x133e6d){_0x210b93=_0x210b93-0x0;var _0x2b020f=_0xc463[_0x210b93];return _0x2b020f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c46('0x0'));var zipdir=require(_0x3c46('0x1'));var jsonpatch=require(_0x3c46('0x2'));var rp=require(_0x3c46('0x3'));var moment=require('moment');var BPromise=require(_0x3c46('0x4'));var Mustache=require(_0x3c46('0x5'));var util=require('util');var path=require(_0x3c46('0x6'));var sox=require(_0x3c46('0x7'));var csv=require(_0x3c46('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c46('0x9'));var squel=require(_0x3c46('0xa'));var crypto=require(_0x3c46('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3c46('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c46('0xd'));var Redis=require(_0x3c46('0xe'));var authService=require(_0x3c46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3c46('0x10'));var hardwareService=require(_0x3c46('0x11'));var logger=require(_0x3c46('0x12'))(_0x3c46('0x13'));var utils=require(_0x3c46('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3c46('0x15'));var db=require(_0x3c46('0x16'))['db'];var integrations=require(_0x3c46('0x17'));function respondWithStatusCode(_0xc6a3ef,_0x1b57ec){_0x1b57ec=_0x1b57ec||0xcc;return function(_0x46dd31){if(_0x46dd31){return _0xc6a3ef[_0x3c46('0x18')](_0x1b57ec);}return _0xc6a3ef['status'](_0x1b57ec)[_0x3c46('0x19')]();};}function respondWithResult(_0x1c622f,_0x2cf56d){_0x2cf56d=_0x2cf56d||0xc8;return function(_0x248c7b){if(_0x248c7b){return _0x1c622f['status'](_0x2cf56d)[_0x3c46('0x1a')](_0x248c7b);}};}function respondWithFilteredResult(_0x4c4779,_0x259830){return function(_0x5a606c){if(_0x5a606c){var _0x1d2ecf=typeof _0x259830['offset']===_0x3c46('0x1b')&&typeof _0x259830[_0x3c46('0x1c')]===_0x3c46('0x1b');var _0x78e068=_0x5a606c[_0x3c46('0x1d')];var _0x2d124b=_0x1d2ecf?0x0:_0x259830[_0x3c46('0x1e')];var _0x3294a8=_0x1d2ecf?_0x5a606c[_0x3c46('0x1d')]:_0x259830[_0x3c46('0x1e')]+_0x259830[_0x3c46('0x1c')];var _0x2fd62f;if(_0x3294a8>=_0x78e068){_0x3294a8=_0x78e068;_0x2fd62f=0xc8;}else{_0x2fd62f=0xce;}_0x4c4779[_0x3c46('0x1f')](_0x2fd62f);return _0x4c4779[_0x3c46('0x20')](_0x3c46('0x21'),_0x2d124b+'-'+_0x3294a8+'/'+_0x78e068)[_0x3c46('0x1a')](_0x5a606c);}return null;};}function patchUpdates(_0x25d3a1){return function(_0x46d6e1){try{jsonpatch[_0x3c46('0x22')](_0x46d6e1,_0x25d3a1,!![]);}catch(_0x2df07f){return BPromise[_0x3c46('0x23')](_0x2df07f);}return _0x46d6e1['save']();};}function saveUpdates(_0x250b4a,_0x252ecc){return function(_0x57863d){if(_0x57863d){return _0x57863d['update'](_0x250b4a)['then'](function(_0x170122){return _0x170122;});}return null;};}function removeEntity(_0x21f8bf,_0xd264c2){return function(_0x28efa1){if(_0x28efa1){return _0x28efa1[_0x3c46('0x24')]()[_0x3c46('0x25')](function(){_0x21f8bf[_0x3c46('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121d16,_0x833d52){return function(_0xe8a512){if(!_0xe8a512){_0x121d16[_0x3c46('0x18')](0x194);}return _0xe8a512;};}function handleError(_0x3b953c,_0x2f180b){_0x2f180b=_0x2f180b||0x1f4;return function(_0x243177){logger[_0x3c46('0x26')](_0x243177[_0x3c46('0x27')]);if(_0x243177['name']){delete _0x243177[_0x3c46('0x28')];}_0x3b953c[_0x3c46('0x1f')](_0x2f180b)[_0x3c46('0x29')](_0x243177);};}exports[_0x3c46('0x2a')]=function(_0x72a11e,_0x44a564){var _0x5a5434={},_0x598a66={},_0x599e8d={'count':0x0,'rows':[]};var _0x2ae9b7=_[_0x3c46('0x2b')](db[_0x3c46('0x2c')][_0x3c46('0x2d')],function(_0x184c96){return{'name':_0x184c96[_0x3c46('0x2e')],'type':_0x184c96[_0x3c46('0x2f')]['key']};});_0x598a66[_0x3c46('0x30')]=_[_0x3c46('0x2b')](_0x2ae9b7,_0x3c46('0x28'));_0x598a66['query']=_[_0x3c46('0x31')](_0x72a11e[_0x3c46('0x32')]);_0x598a66[_0x3c46('0x33')]=_['intersection'](_0x598a66[_0x3c46('0x30')],_0x598a66['query']);_0x5a5434['attributes']=_[_0x3c46('0x34')](_0x598a66['model'],qs[_0x3c46('0x35')](_0x72a11e['query']['fields']));_0x5a5434[_0x3c46('0x36')]=_0x5a5434['attributes'][_0x3c46('0x37')]?_0x5a5434[_0x3c46('0x36')]:_0x598a66['model'];if(!_0x72a11e[_0x3c46('0x32')][_0x3c46('0x38')](_0x3c46('0x39'))){_0x5a5434[_0x3c46('0x1c')]=qs[_0x3c46('0x1c')](_0x72a11e[_0x3c46('0x32')][_0x3c46('0x1c')]);_0x5a5434[_0x3c46('0x1e')]=qs[_0x3c46('0x1e')](_0x72a11e[_0x3c46('0x32')][_0x3c46('0x1e')]);}_0x5a5434[_0x3c46('0x3a')]=qs[_0x3c46('0x3b')](_0x72a11e[_0x3c46('0x32')][_0x3c46('0x3b')]);_0x5a5434[_0x3c46('0x3c')]=qs[_0x3c46('0x33')](_['pick'](_0x72a11e[_0x3c46('0x32')],_0x598a66['filters']),_0x2ae9b7);if(_0x72a11e[_0x3c46('0x32')][_0x3c46('0x3d')]){_0x5a5434[_0x3c46('0x3c')]=_['merge'](_0x5a5434['where'],{'$or':_[_0x3c46('0x2b')](_0x2ae9b7,function(_0x4d7f4b){if(_0x4d7f4b['type']!==_0x3c46('0x3e')){var _0x19d78b={};_0x19d78b[_0x4d7f4b['name']]={'$like':'%'+_0x72a11e[_0x3c46('0x32')]['filter']+'%'};return _0x19d78b;}})});}_0x5a5434=_[_0x3c46('0x3f')]({},_0x5a5434,_0x72a11e[_0x3c46('0x40')]);var _0x8f10ea={'where':_0x5a5434[_0x3c46('0x3c')]};return db['ZohoAccount'][_0x3c46('0x1d')](_0x8f10ea)[_0x3c46('0x25')](function(_0xf5cace){_0x599e8d['count']=_0xf5cace;if(_0x72a11e[_0x3c46('0x32')][_0x3c46('0x41')]){_0x5a5434['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x3c46('0x42')](_0x5a5434);})[_0x3c46('0x25')](function(_0x208595){_0x599e8d[_0x3c46('0x43')]=_0x208595;return _0x599e8d;})[_0x3c46('0x25')](respondWithFilteredResult(_0x44a564,_0x5a5434))[_0x3c46('0x44')](handleError(_0x44a564,null));};exports[_0x3c46('0x45')]=function(_0x3c6557,_0x500f21){var _0x3b6c74={'raw':![],'where':{'id':_0x3c6557['params']['id']}},_0x51c660={};_0x51c660['model']=_[_0x3c46('0x31')](db[_0x3c46('0x2c')][_0x3c46('0x2d')]);_0x51c660[_0x3c46('0x32')]=_['keys'](_0x3c6557[_0x3c46('0x32')]);_0x51c660[_0x3c46('0x33')]=_[_0x3c46('0x34')](_0x51c660[_0x3c46('0x30')],_0x51c660[_0x3c46('0x32')]);_0x3b6c74[_0x3c46('0x36')]=_['intersection'](_0x51c660[_0x3c46('0x30')],qs['fields'](_0x3c6557[_0x3c46('0x32')][_0x3c46('0x35')]));_0x3b6c74[_0x3c46('0x36')]=_0x3b6c74[_0x3c46('0x36')][_0x3c46('0x37')]?_0x3b6c74[_0x3c46('0x36')]:_0x51c660[_0x3c46('0x30')];if(_0x3c6557[_0x3c46('0x32')]['includeAll']){_0x3b6c74['include']=[{'all':!![]}];}_0x3b6c74=_[_0x3c46('0x3f')]({},_0x3b6c74,_0x3c6557[_0x3c46('0x40')]);return db['ZohoAccount'][_0x3c46('0x46')](_0x3b6c74)[_0x3c46('0x25')](handleEntityNotFound(_0x500f21,null))[_0x3c46('0x25')](respondWithResult(_0x500f21,null))['catch'](handleError(_0x500f21,null));};exports[_0x3c46('0x47')]=function(_0x396cc5,_0x50ac92){return db[_0x3c46('0x2c')][_0x3c46('0x47')](_0x396cc5[_0x3c46('0x48')],{})[_0x3c46('0x25')](respondWithResult(_0x50ac92,0xc9))[_0x3c46('0x44')](handleError(_0x50ac92,null));};exports[_0x3c46('0x49')]=function(_0x5aac98,_0x252ae5){if(_0x5aac98['body']['id']){delete _0x5aac98['body']['id'];}return db[_0x3c46('0x2c')]['find']({'where':{'id':_0x5aac98[_0x3c46('0x4a')]['id']}})[_0x3c46('0x25')](handleEntityNotFound(_0x252ae5,null))['then'](saveUpdates(_0x5aac98[_0x3c46('0x48')],null))[_0x3c46('0x25')](respondWithResult(_0x252ae5,null))['catch'](handleError(_0x252ae5,null));};exports[_0x3c46('0x24')]=function(_0x26bc60,_0x5bc4da){return db[_0x3c46('0x2c')][_0x3c46('0x46')]({'where':{'id':_0x26bc60[_0x3c46('0x4a')]['id']}})[_0x3c46('0x25')](handleEntityNotFound(_0x5bc4da,null))[_0x3c46('0x25')](removeEntity(_0x5bc4da,null))['catch'](handleError(_0x5bc4da,null));};exports[_0x3c46('0x4b')]=function(_0x3cfa4c,_0x2fdfd1,_0x1156b8){var _0x547606={};var _0x129310={};var _0x3176b6;var _0x24dde0;return db[_0x3c46('0x2c')]['findOne']({'where':{'id':_0x3cfa4c['params']['id']}})[_0x3c46('0x25')](handleEntityNotFound(_0x2fdfd1,null))[_0x3c46('0x25')](function(_0x3b22f0){if(_0x3b22f0){_0x3176b6=_0x3b22f0;_0x129310[_0x3c46('0x30')]=_[_0x3c46('0x31')](db[_0x3c46('0x4c')][_0x3c46('0x2d')]);_0x129310['query']=_[_0x3c46('0x31')](_0x3cfa4c['query']);_0x129310['filters']=_[_0x3c46('0x34')](_0x129310['model'],_0x129310[_0x3c46('0x32')]);_0x547606[_0x3c46('0x36')]=_[_0x3c46('0x34')](_0x129310['model'],qs[_0x3c46('0x35')](_0x3cfa4c[_0x3c46('0x32')][_0x3c46('0x35')]));_0x547606[_0x3c46('0x36')]=_0x547606[_0x3c46('0x36')][_0x3c46('0x37')]?_0x547606[_0x3c46('0x36')]:_0x129310[_0x3c46('0x30')];_0x547606['order']=qs[_0x3c46('0x3b')](_0x3cfa4c[_0x3c46('0x32')]['sort']);_0x547606[_0x3c46('0x3c')]=qs[_0x3c46('0x33')](_[_0x3c46('0x4d')](_0x3cfa4c['query'],_0x129310[_0x3c46('0x33')]));if(_0x3cfa4c['query'][_0x3c46('0x3d')]){_0x547606['where']=_[_0x3c46('0x3f')](_0x547606['where'],{'$or':_[_0x3c46('0x2b')](_0x547606['attributes'],function(_0x3d052b){var _0x2e444e={};_0x2e444e[_0x3d052b]={'$like':'%'+_0x3cfa4c[_0x3c46('0x32')][_0x3c46('0x3d')]+'%'};return _0x2e444e;})});}_0x547606=_['merge']({},_0x547606,_0x3cfa4c[_0x3c46('0x40')]);return _0x3176b6[_0x3c46('0x4b')](_0x547606);}})[_0x3c46('0x25')](function(_0x2fb47b){if(_0x2fb47b){_0x24dde0=_0x2fb47b[_0x3c46('0x37')];if(!_0x3cfa4c[_0x3c46('0x32')][_0x3c46('0x38')](_0x3c46('0x39'))){_0x547606[_0x3c46('0x1c')]=qs[_0x3c46('0x1c')](_0x3cfa4c[_0x3c46('0x32')][_0x3c46('0x1c')]);_0x547606[_0x3c46('0x1e')]=qs['offset'](_0x3cfa4c[_0x3c46('0x32')][_0x3c46('0x1e')]);}return _0x3176b6['getConfigurations'](_0x547606);}})[_0x3c46('0x25')](function(_0x22b230){if(_0x22b230){return _0x22b230?{'count':_0x24dde0,'rows':_0x22b230}:null;}})[_0x3c46('0x25')](respondWithResult(_0x2fdfd1,null))[_0x3c46('0x44')](handleError(_0x2fdfd1,null));};exports['addConfiguration']=function(_0x1d1fe3,_0x546e19,_0x5c2d9e){if(_0x1d1fe3[_0x3c46('0x48')]['id']){delete _0x1d1fe3[_0x3c46('0x48')]['id'];}return db[_0x3c46('0x2c')]['findOne']({'where':{'id':_0x1d1fe3['params']['id']}})[_0x3c46('0x25')](handleEntityNotFound(_0x546e19,null))[_0x3c46('0x25')](function(_0x35da8e){if(_0x35da8e){_0x1d1fe3[_0x3c46('0x48')][_0x3c46('0x4e')]=_0x35da8e['id'];_0x1d1fe3[_0x3c46('0x48')][_0x3c46('0x4f')]=integrations[_0x3c46('0x50')](_0x1d1fe3[_0x3c46('0x48')][_0x3c46('0x51')],_0x1d1fe3[_0x3c46('0x48')][_0x3c46('0x2f')]);_0x1d1fe3[_0x3c46('0x48')][_0x3c46('0x52')]=integrations['getDescriptions'](_0x1d1fe3['body'][_0x3c46('0x51')],_0x1d1fe3['body']['type']);return db[_0x3c46('0x4c')][_0x3c46('0x47')](_0x1d1fe3[_0x3c46('0x48')],{'include':[{'model':db[_0x3c46('0x53')],'as':'Subjects'},{'model':db[_0x3c46('0x53')],'as':_0x3c46('0x52')}]});}return null;})['then'](respondWithResult(_0x546e19,null))['catch'](handleError(_0x546e19,null));};function getAccessToken(_0x3dec50){return new Promise(function(_0x4edcce,_0x4ebb76){var _0x25888e;switch(_0x3dec50['zone']){case'US':_0x25888e=_0x3c46('0x54');break;case'AU':_0x25888e='https://accounts.zoho.com.au';break;case'EU':_0x25888e=_0x3c46('0x55');break;case'IN':_0x25888e='https://accounts.zoho.in';break;case'CN':_0x25888e=_0x3c46('0x56');break;default:_0x25888e=_0x3c46('0x55');break;}var _0x44a48a={'method':_0x3c46('0x57'),'uri':_0x25888e+_0x3c46('0x58'),'qs':{'refresh_token':_0x3dec50[_0x3c46('0x59')],'client_id':_0x3dec50[_0x3c46('0x5a')],'client_secret':_0x3dec50[_0x3c46('0x5b')],'grant_type':_0x3c46('0x5c')},'json':!![]};return rp(_0x44a48a)['then'](function(_0x279324){if(_0x279324[_0x3c46('0x5d')]){_0x4edcce(_0x279324[_0x3c46('0x5d')]);}else{_0x4ebb76(_0x3c46('0x5e'));}})[_0x3c46('0x44')](function(_0x24e71b){_0x4ebb76(_0x24e71b);});});}exports['getFields']=function(_0x8517cd,_0x15adf0,_0x57f897){var _0x3bbce9,_0x41e222,_0x57c9b9,_0x43a3d,_0x3f0705;return db[_0x3c46('0x2c')]['findOne']({'where':{'id':_0x8517cd[_0x3c46('0x4a')]['id']},'attributes':['id',_0x3c46('0x5f'),'zone',_0x3c46('0x5a'),'clientSecret','serverUrl',_0x3c46('0x60'),_0x3c46('0x59')]})[_0x3c46('0x25')](handleEntityNotFound(_0x15adf0,null))[_0x3c46('0x25')](function(_0x41f165){_0x3f0705=_0x41f165;_0x3bbce9=_0x3f0705[_0x3c46('0x5f')];_0x41e222=_0x3bbce9==='zoho.eu'?'eu':_0x3c46('0x61');_0x57c9b9=_0x3f0705[_0x3c46('0x62')];var _0xebc166=_0x57c9b9[_0x3c46('0x63')](-0x1);if(_0xebc166==='/'||_0xebc166==='\x5c'||_0xebc166===':'){_0x57c9b9=_0x57c9b9[_0x3c46('0x64')](0x0,_0x57c9b9['lastIndexOf'](_0xebc166));}if(!_0x3f0705[_0x3c46('0x59')]){throw new Error(_0x3c46('0x65'));}return getAccessToken(_0x3f0705);})[_0x3c46('0x25')](function(_0x32c0e8){if(_0x32c0e8){return rp({'method':'GET','uri':util[_0x3c46('0x66')](_0x3c46('0x67'),_0x41e222),'qs':{'module':_0x3c46('0x68')},'headers':{'Authorization':_0x3c46('0x69')+_0x32c0e8},'json':!![]});}})[_0x3c46('0x25')](function(_0x59d775){if(_0x59d775){if(_0x59d775[_0x3c46('0x6a')]&&_0x59d775[_0x3c46('0x6a')][_0x3c46('0x26')]){throw new Error(_0x59d775[_0x3c46('0x6a')]['error']['message']);}var _0x3195f2=[];var _0x407d73=[];var _0x4dc4a7=['Owner',_0x3c46('0x6b'),'Description',_0x3c46('0x6c'),_0x3c46('0x6d'),_0x3c46('0x6e'),_0x3c46('0x6f'),_0x3c46('0x70')];_0x407d73=_[_0x3c46('0x71')](_0x59d775[_0x3c46('0x35')],function(_0x51ae69){return _0x4dc4a7['includes'](_0x51ae69['api_name']);});for(var _0x9e5ff3=0x0;_0x9e5ff3<_0x407d73[_0x3c46('0x37')];_0x9e5ff3++){if(_0x407d73[_0x9e5ff3]['system_mandatory']===![]){_0x3195f2[_0x3c46('0x72')]({'id':_0x407d73[_0x9e5ff3]['id'],'name':_0x407d73[_0x9e5ff3]['display_label'],'custom':_0x407d73[_0x9e5ff3][_0x3c46('0x73')],'options':_0x407d73[_0x9e5ff3]['data_type']===_0x3c46('0x74')&&_0x407d73[_0x9e5ff3][_0x3c46('0x75')][_0x3c46('0x37')]>-0x1?_[_0x3c46('0x2b')](_0x407d73[_0x9e5ff3][_0x3c46('0x75')],function(_0x2055f2){return{'name':_0x2055f2,'value':_0x2055f2};}):[]});}}return{'count':_0x3195f2['length'],'rows':_0x3195f2};}else{return{'count':0x0,'rows':[]};}})[_0x3c46('0x25')](respondWithResult(_0x15adf0,null))['catch'](function(_0x312d1b){var _0x346fbc=_0x8517cd['query'][_0x3c46('0x76')]?0x1f4:_0x312d1b['statusCode']||0x1f4;logger[_0x3c46('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x3c46('0x77'),_0x346fbc,JSON[_0x3c46('0x78')](_0x312d1b));delete _0x312d1b[_0x3c46('0x28')];if(_0x346fbc===0x191){_0x346fbc=0x190;}_0x15adf0[_0x3c46('0x1f')](_0x346fbc)[_0x3c46('0x29')](_0x8517cd[_0x3c46('0x32')][_0x3c46('0x76')]?{'message':_0x3c46('0x79'),'statusCode':_0x312d1b['statusCode']}:_0x312d1b);});}; \ No newline at end of file +var _0xec1f=['/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Subject','WhoId','Call_Result','Call_Type','api_name','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','error','name','send','index','map','ZohoAccount','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','then','includeAll','include','findAll','show','catch','create','body','update','find','params','destroy','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x30b647,_0x3e45a7){var _0x1d55dd=function(_0x1c45db){while(--_0x1c45db){_0x30b647['push'](_0x30b647['shift']());}};_0x1d55dd(++_0x3e45a7);}(_0xec1f,0x19c));var _0xfec1=function(_0x361026,_0x2654b6){_0x361026=_0x361026-0x0;var _0x597f17=_0xec1f[_0x361026];return _0x597f17;};'use strict';var emlformat=require(_0xfec1('0x0'));var rimraf=require(_0xfec1('0x1'));var zipdir=require(_0xfec1('0x2'));var jsonpatch=require(_0xfec1('0x3'));var rp=require(_0xfec1('0x4'));var moment=require(_0xfec1('0x5'));var BPromise=require(_0xfec1('0x6'));var Mustache=require(_0xfec1('0x7'));var util=require(_0xfec1('0x8'));var path=require(_0xfec1('0x9'));var sox=require(_0xfec1('0xa'));var csv=require(_0xfec1('0xb'));var ejs=require(_0xfec1('0xc'));var fs=require('fs');var fs_extra=require(_0xfec1('0xd'));var _=require(_0xfec1('0xe'));var squel=require(_0xfec1('0xf'));var crypto=require('crypto');var jsforce=require(_0xfec1('0x10'));var deskjs=require(_0xfec1('0x11'));var toCsv=require(_0xfec1('0xb'));var querystring=require(_0xfec1('0x12'));var Papa=require(_0xfec1('0x13'));var Redis=require(_0xfec1('0x14'));var authService=require(_0xfec1('0x15'));var qs=require(_0xfec1('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfec1('0x17'));var logger=require(_0xfec1('0x18'))(_0xfec1('0x19'));var utils=require(_0xfec1('0x1a'));var config=require(_0xfec1('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xfec1('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4408ab,_0x86ec12){_0x86ec12=_0x86ec12||0xcc;return function(_0x44dee3){if(_0x44dee3){return _0x4408ab['sendStatus'](_0x86ec12);}return _0x4408ab[_0xfec1('0x1d')](_0x86ec12)[_0xfec1('0x1e')]();};}function respondWithResult(_0x5c3023,_0x36ff95){_0x36ff95=_0x36ff95||0xc8;return function(_0x3ee96c){if(_0x3ee96c){return _0x5c3023[_0xfec1('0x1d')](_0x36ff95)[_0xfec1('0x1f')](_0x3ee96c);}};}function respondWithFilteredResult(_0x1084da,_0x114d62){return function(_0x237c8d){if(_0x237c8d){var _0x353e0b=typeof _0x114d62['offset']===_0xfec1('0x20')&&typeof _0x114d62[_0xfec1('0x21')]===_0xfec1('0x20');var _0x4420e8=_0x237c8d[_0xfec1('0x22')];var _0x1fe224=_0x353e0b?0x0:_0x114d62['offset'];var _0x49be38=_0x353e0b?_0x237c8d[_0xfec1('0x22')]:_0x114d62[_0xfec1('0x23')]+_0x114d62[_0xfec1('0x21')];var _0x30cf31;if(_0x49be38>=_0x4420e8){_0x49be38=_0x4420e8;_0x30cf31=0xc8;}else{_0x30cf31=0xce;}_0x1084da[_0xfec1('0x1d')](_0x30cf31);return _0x1084da[_0xfec1('0x24')](_0xfec1('0x25'),_0x1fe224+'-'+_0x49be38+'/'+_0x4420e8)[_0xfec1('0x1f')](_0x237c8d);}return null;};}function patchUpdates(_0x3c8ed2){return function(_0xa49aba){try{jsonpatch['apply'](_0xa49aba,_0x3c8ed2,!![]);}catch(_0x165044){return BPromise[_0xfec1('0x26')](_0x165044);}return _0xa49aba[_0xfec1('0x27')]();};}function saveUpdates(_0x1a8f52,_0x2a147a){return function(_0x3c0a5d){if(_0x3c0a5d){return _0x3c0a5d['update'](_0x1a8f52)['then'](function(_0xb9fd9c){return _0xb9fd9c;});}return null;};}function removeEntity(_0xaa52b3,_0x15e699){return function(_0x1891f6){if(_0x1891f6){return _0x1891f6['destroy']()['then'](function(){_0xaa52b3[_0xfec1('0x1d')](0xcc)[_0xfec1('0x1e')]();});}};}function handleEntityNotFound(_0x47894b,_0x4c30ec){return function(_0x9140cc){if(!_0x9140cc){_0x47894b['sendStatus'](0x194);}return _0x9140cc;};}function handleError(_0x3b3885,_0x348a15){_0x348a15=_0x348a15||0x1f4;return function(_0x28e136){logger[_0xfec1('0x28')](_0x28e136['stack']);if(_0x28e136[_0xfec1('0x29')]){delete _0x28e136['name'];}_0x3b3885[_0xfec1('0x1d')](_0x348a15)[_0xfec1('0x2a')](_0x28e136);};}exports[_0xfec1('0x2b')]=function(_0x2ce1d9,_0x2c16ad){var _0x4c9343={},_0x3df56b={},_0x3a030d={'count':0x0,'rows':[]};var _0x1bcf36=_[_0xfec1('0x2c')](db[_0xfec1('0x2d')][_0xfec1('0x2e')],function(_0x530d21){return{'name':_0x530d21['fieldName'],'type':_0x530d21[_0xfec1('0x2f')][_0xfec1('0x30')]};});_0x3df56b['model']=_['map'](_0x1bcf36,_0xfec1('0x29'));_0x3df56b['query']=_[_0xfec1('0x31')](_0x2ce1d9[_0xfec1('0x32')]);_0x3df56b[_0xfec1('0x33')]=_[_0xfec1('0x34')](_0x3df56b[_0xfec1('0x35')],_0x3df56b[_0xfec1('0x32')]);_0x4c9343['attributes']=_['intersection'](_0x3df56b[_0xfec1('0x35')],qs['fields'](_0x2ce1d9['query'][_0xfec1('0x36')]));_0x4c9343[_0xfec1('0x37')]=_0x4c9343['attributes'][_0xfec1('0x38')]?_0x4c9343[_0xfec1('0x37')]:_0x3df56b[_0xfec1('0x35')];if(!_0x2ce1d9['query']['hasOwnProperty'](_0xfec1('0x39'))){_0x4c9343[_0xfec1('0x21')]=qs[_0xfec1('0x21')](_0x2ce1d9[_0xfec1('0x32')][_0xfec1('0x21')]);_0x4c9343['offset']=qs['offset'](_0x2ce1d9['query'][_0xfec1('0x23')]);}_0x4c9343[_0xfec1('0x3a')]=qs[_0xfec1('0x3b')](_0x2ce1d9['query'][_0xfec1('0x3b')]);_0x4c9343['where']=qs['filters'](_[_0xfec1('0x3c')](_0x2ce1d9[_0xfec1('0x32')],_0x3df56b[_0xfec1('0x33')]),_0x1bcf36);if(_0x2ce1d9[_0xfec1('0x32')]['filter']){_0x4c9343['where']=_[_0xfec1('0x3d')](_0x4c9343[_0xfec1('0x3e')],{'$or':_[_0xfec1('0x2c')](_0x1bcf36,function(_0x1be734){if(_0x1be734['type']!==_0xfec1('0x3f')){var _0xe4905f={};_0xe4905f[_0x1be734[_0xfec1('0x29')]]={'$like':'%'+_0x2ce1d9[_0xfec1('0x32')][_0xfec1('0x40')]+'%'};return _0xe4905f;}})});}_0x4c9343=_['merge']({},_0x4c9343,_0x2ce1d9[_0xfec1('0x41')]);var _0x6f844d={'where':_0x4c9343[_0xfec1('0x3e')]};return db[_0xfec1('0x2d')]['count'](_0x6f844d)[_0xfec1('0x42')](function(_0x565651){_0x3a030d[_0xfec1('0x22')]=_0x565651;if(_0x2ce1d9[_0xfec1('0x32')][_0xfec1('0x43')]){_0x4c9343[_0xfec1('0x44')]=[{'all':!![]}];}return db[_0xfec1('0x2d')][_0xfec1('0x45')](_0x4c9343);})[_0xfec1('0x42')](function(_0x5046dd){_0x3a030d['rows']=_0x5046dd;return _0x3a030d;})[_0xfec1('0x42')](respondWithFilteredResult(_0x2c16ad,_0x4c9343))['catch'](handleError(_0x2c16ad,null));};exports[_0xfec1('0x46')]=function(_0x2c1a2a,_0x185b5b){var _0x5afbcf={'raw':![],'where':{'id':_0x2c1a2a['params']['id']}},_0xf1b528={};_0xf1b528[_0xfec1('0x35')]=_[_0xfec1('0x31')](db[_0xfec1('0x2d')][_0xfec1('0x2e')]);_0xf1b528['query']=_[_0xfec1('0x31')](_0x2c1a2a[_0xfec1('0x32')]);_0xf1b528['filters']=_[_0xfec1('0x34')](_0xf1b528[_0xfec1('0x35')],_0xf1b528[_0xfec1('0x32')]);_0x5afbcf[_0xfec1('0x37')]=_[_0xfec1('0x34')](_0xf1b528[_0xfec1('0x35')],qs[_0xfec1('0x36')](_0x2c1a2a['query'][_0xfec1('0x36')]));_0x5afbcf[_0xfec1('0x37')]=_0x5afbcf['attributes'][_0xfec1('0x38')]?_0x5afbcf[_0xfec1('0x37')]:_0xf1b528[_0xfec1('0x35')];if(_0x2c1a2a[_0xfec1('0x32')][_0xfec1('0x43')]){_0x5afbcf['include']=[{'all':!![]}];}_0x5afbcf=_['merge']({},_0x5afbcf,_0x2c1a2a[_0xfec1('0x41')]);return db[_0xfec1('0x2d')]['find'](_0x5afbcf)[_0xfec1('0x42')](handleEntityNotFound(_0x185b5b,null))[_0xfec1('0x42')](respondWithResult(_0x185b5b,null))[_0xfec1('0x47')](handleError(_0x185b5b,null));};exports['create']=function(_0x2f1c07,_0x899a0e){return db[_0xfec1('0x2d')][_0xfec1('0x48')](_0x2f1c07[_0xfec1('0x49')],{})['then'](respondWithResult(_0x899a0e,0xc9))['catch'](handleError(_0x899a0e,null));};exports[_0xfec1('0x4a')]=function(_0x235ebd,_0x48ed89){if(_0x235ebd[_0xfec1('0x49')]['id']){delete _0x235ebd['body']['id'];}return db[_0xfec1('0x2d')][_0xfec1('0x4b')]({'where':{'id':_0x235ebd[_0xfec1('0x4c')]['id']}})[_0xfec1('0x42')](handleEntityNotFound(_0x48ed89,null))[_0xfec1('0x42')](saveUpdates(_0x235ebd['body'],null))[_0xfec1('0x42')](respondWithResult(_0x48ed89,null))['catch'](handleError(_0x48ed89,null));};exports[_0xfec1('0x4d')]=function(_0x346994,_0x300580){return db[_0xfec1('0x2d')][_0xfec1('0x4b')]({'where':{'id':_0x346994[_0xfec1('0x4c')]['id']}})[_0xfec1('0x42')](handleEntityNotFound(_0x300580,null))[_0xfec1('0x42')](removeEntity(_0x300580,null))[_0xfec1('0x47')](handleError(_0x300580,null));};exports[_0xfec1('0x4e')]=function(_0x4cac81,_0x1ed203,_0x566b64){var _0x4ce553={};var _0x42157d={};var _0x128798;var _0x2116ec;return db[_0xfec1('0x2d')][_0xfec1('0x4f')]({'where':{'id':_0x4cac81[_0xfec1('0x4c')]['id']}})[_0xfec1('0x42')](handleEntityNotFound(_0x1ed203,null))[_0xfec1('0x42')](function(_0x31dc18){if(_0x31dc18){_0x128798=_0x31dc18;_0x42157d[_0xfec1('0x35')]=_[_0xfec1('0x31')](db[_0xfec1('0x50')]['rawAttributes']);_0x42157d[_0xfec1('0x32')]=_[_0xfec1('0x31')](_0x4cac81['query']);_0x42157d[_0xfec1('0x33')]=_[_0xfec1('0x34')](_0x42157d[_0xfec1('0x35')],_0x42157d[_0xfec1('0x32')]);_0x4ce553['attributes']=_[_0xfec1('0x34')](_0x42157d[_0xfec1('0x35')],qs[_0xfec1('0x36')](_0x4cac81['query'][_0xfec1('0x36')]));_0x4ce553[_0xfec1('0x37')]=_0x4ce553['attributes'][_0xfec1('0x38')]?_0x4ce553[_0xfec1('0x37')]:_0x42157d[_0xfec1('0x35')];_0x4ce553[_0xfec1('0x3a')]=qs[_0xfec1('0x3b')](_0x4cac81['query'][_0xfec1('0x3b')]);_0x4ce553[_0xfec1('0x3e')]=qs[_0xfec1('0x33')](_[_0xfec1('0x3c')](_0x4cac81[_0xfec1('0x32')],_0x42157d[_0xfec1('0x33')]));if(_0x4cac81[_0xfec1('0x32')][_0xfec1('0x40')]){_0x4ce553['where']=_[_0xfec1('0x3d')](_0x4ce553[_0xfec1('0x3e')],{'$or':_[_0xfec1('0x2c')](_0x4ce553[_0xfec1('0x37')],function(_0x41a373){var _0x8f6b7b={};_0x8f6b7b[_0x41a373]={'$like':'%'+_0x4cac81['query'][_0xfec1('0x40')]+'%'};return _0x8f6b7b;})});}_0x4ce553=_[_0xfec1('0x3d')]({},_0x4ce553,_0x4cac81[_0xfec1('0x41')]);return _0x128798[_0xfec1('0x4e')](_0x4ce553);}})[_0xfec1('0x42')](function(_0x398a1a){if(_0x398a1a){_0x2116ec=_0x398a1a[_0xfec1('0x38')];if(!_0x4cac81['query']['hasOwnProperty'](_0xfec1('0x39'))){_0x4ce553[_0xfec1('0x21')]=qs[_0xfec1('0x21')](_0x4cac81[_0xfec1('0x32')][_0xfec1('0x21')]);_0x4ce553[_0xfec1('0x23')]=qs[_0xfec1('0x23')](_0x4cac81[_0xfec1('0x32')]['offset']);}return _0x128798['getConfigurations'](_0x4ce553);}})[_0xfec1('0x42')](function(_0x5924e2){if(_0x5924e2){return _0x5924e2?{'count':_0x2116ec,'rows':_0x5924e2}:null;}})['then'](respondWithResult(_0x1ed203,null))['catch'](handleError(_0x1ed203,null));};exports[_0xfec1('0x51')]=function(_0x30c1a7,_0x256600,_0x5d74ae){if(_0x30c1a7[_0xfec1('0x49')]['id']){delete _0x30c1a7[_0xfec1('0x49')]['id'];}return db['ZohoAccount'][_0xfec1('0x4f')]({'where':{'id':_0x30c1a7[_0xfec1('0x4c')]['id']}})[_0xfec1('0x42')](handleEntityNotFound(_0x256600,null))[_0xfec1('0x42')](function(_0x46a9e4){if(_0x46a9e4){_0x30c1a7[_0xfec1('0x49')][_0xfec1('0x52')]=_0x46a9e4['id'];_0x30c1a7['body'][_0xfec1('0x53')]=integrations[_0xfec1('0x54')](_0x30c1a7[_0xfec1('0x49')][_0xfec1('0x55')],_0x30c1a7[_0xfec1('0x49')][_0xfec1('0x2f')]);_0x30c1a7['body'][_0xfec1('0x56')]=integrations[_0xfec1('0x57')](_0x30c1a7[_0xfec1('0x49')][_0xfec1('0x55')],_0x30c1a7['body'][_0xfec1('0x2f')]);return db[_0xfec1('0x50')][_0xfec1('0x48')](_0x30c1a7[_0xfec1('0x49')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xfec1('0x56')}]});}return null;})[_0xfec1('0x42')](respondWithResult(_0x256600,null))[_0xfec1('0x47')](handleError(_0x256600,null));};function getAccessToken(_0xd8ebf7){return new Promise(function(_0x3f9192,_0x274a6c){var _0x31794c;switch(_0xd8ebf7['zone']){case'US':_0x31794c='https://accounts.zoho.com';break;case'AU':_0x31794c=_0xfec1('0x58');break;case'EU':_0x31794c=_0xfec1('0x59');break;case'IN':_0x31794c=_0xfec1('0x5a');break;case'CN':_0x31794c=_0xfec1('0x5b');break;default:_0x31794c=_0xfec1('0x59');break;}var _0x1a5412={'method':'POST','uri':_0x31794c+_0xfec1('0x5c'),'qs':{'refresh_token':_0xd8ebf7[_0xfec1('0x5d')],'client_id':_0xd8ebf7[_0xfec1('0x5e')],'client_secret':_0xd8ebf7[_0xfec1('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1a5412)[_0xfec1('0x42')](function(_0xb8d97c){if(_0xb8d97c[_0xfec1('0x60')]){_0x3f9192(_0xb8d97c[_0xfec1('0x60')]);}else{_0x274a6c(_0xfec1('0x61'));}})['catch'](function(_0xaa26bd){_0x274a6c(_0xaa26bd);});});}exports['getFields']=function(_0x29aadd,_0x4156d1,_0xf2b49c){var _0x5f0af2,_0x20945c,_0x5df796,_0x33fc23,_0x3041aa;return db['ZohoAccount']['findOne']({'where':{'id':_0x29aadd[_0xfec1('0x4c')]['id']},'attributes':['id',_0xfec1('0x62'),_0xfec1('0x63'),_0xfec1('0x5e'),_0xfec1('0x5f'),_0xfec1('0x64'),_0xfec1('0x65'),_0xfec1('0x5d')]})[_0xfec1('0x42')](handleEntityNotFound(_0x4156d1,null))[_0xfec1('0x42')](function(_0x1a1e87){_0x3041aa=_0x1a1e87;_0x5f0af2=_0x3041aa[_0xfec1('0x62')];_0x20945c=_0x5f0af2===_0xfec1('0x66')?'eu':_0xfec1('0x67');_0x5df796=_0x3041aa[_0xfec1('0x64')];var _0x5491b9=_0x5df796[_0xfec1('0x68')](-0x1);if(_0x5491b9==='/'||_0x5491b9==='\x5c'||_0x5491b9===':'){_0x5df796=_0x5df796[_0xfec1('0x69')](0x0,_0x5df796[_0xfec1('0x6a')](_0x5491b9));}if(!_0x3041aa[_0xfec1('0x5d')]){throw new Error(_0xfec1('0x6b'));}return getAccessToken(_0x3041aa);})['then'](function(_0x5181b9){if(_0x5181b9){return rp({'method':'GET','uri':util[_0xfec1('0x6c')](_0xfec1('0x6d'),_0x20945c),'qs':{'module':'Calls'},'headers':{'Authorization':_0xfec1('0x6e')+_0x5181b9},'json':!![]});}})[_0xfec1('0x42')](function(_0x48ebc5){if(_0x48ebc5){if(_0x48ebc5[_0xfec1('0x6f')]&&_0x48ebc5['response']['error']){throw new Error(_0x48ebc5[_0xfec1('0x6f')][_0xfec1('0x28')][_0xfec1('0x70')]);}var _0x3c0eaf=[];var _0x119a25=[];var _0x50bbf8=['Owner',_0xfec1('0x71'),'Description',_0xfec1('0x72'),'Call_Duration',_0xfec1('0x73'),'Call_Start_Time',_0xfec1('0x74')];_0x119a25=_['remove'](_0x48ebc5[_0xfec1('0x36')],function(_0x4b5060){return _0x50bbf8['includes'](_0x4b5060[_0xfec1('0x75')]);});for(var _0x326409=0x0;_0x326409<_0x119a25[_0xfec1('0x38')];_0x326409++){if(_0x119a25[_0x326409]['system_mandatory']===![]){_0x3c0eaf['push']({'id':_0x119a25[_0x326409]['id'],'name':_0x119a25[_0x326409][_0xfec1('0x76')],'custom':_0x119a25[_0x326409][_0xfec1('0x77')],'options':_0x119a25[_0x326409][_0xfec1('0x78')]==='picklist'&&_0x119a25[_0x326409][_0xfec1('0x79')][_0xfec1('0x38')]>-0x1?_[_0xfec1('0x2c')](_0x119a25[_0x326409]['pick_list_values'],function(_0x7cbf2b){return{'name':_0x7cbf2b,'value':_0x7cbf2b};}):[]});}}return{'count':_0x3c0eaf[_0xfec1('0x38')],'rows':_0x3c0eaf};}else{return{'count':0x0,'rows':[]};}})[_0xfec1('0x42')](respondWithResult(_0x4156d1,null))[_0xfec1('0x47')](function(_0x58f0eb){var _0x1ad349=_0x29aadd['query'][_0xfec1('0x7a')]?0x1f4:_0x58f0eb[_0xfec1('0x7b')]||0x1f4;logger[_0xfec1('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xfec1('0x7c'),_0x1ad349,JSON['stringify'](_0x58f0eb));delete _0x58f0eb[_0xfec1('0x29')];if(_0x1ad349===0x191){_0x1ad349=0x190;}_0x4156d1[_0xfec1('0x1d')](_0x1ad349)['send'](_0x29aadd[_0xfec1('0x32')]['test']?{'message':_0xfec1('0x7d'),'statusCode':_0x58f0eb[_0xfec1('0x7b')]}:_0x58f0eb);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 28ebf21..d65061a 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 _0x9fda=['https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','application/x-www-form-urlencoded','then','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','substring','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','parse','refreshToken','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x9fda,0x135));var _0xa9fd=function(_0x3d015c,_0x2865dc){_0x3d015c=_0x3d015c-0x0;var _0x2fa8ef=_0x9fda[_0x3d015c];return _0x2fa8ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa9fd('0x0'))(_0xa9fd('0x1'));var moment=require(_0xa9fd('0x2'));var BPromise=require(_0xa9fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa9fd('0x4'));var config=require(_0xa9fd('0x5'));var attributes=require(_0xa9fd('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xa9fd('0x7')]=function(_0x169e7f,_0x382db8){return _0x169e7f['define'](_0xa9fd('0x8'),attributes,{'tableName':_0xa9fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x6961,_0x5db7b2,_0x1d38d5){if(_0x6961[_0xa9fd('0xa')](_0xa9fd('0xb'))||_0x6961[_0xa9fd('0xa')](_0xa9fd('0xc'))||_0x6961[_0xa9fd('0xa')](_0xa9fd('0xd'))||_0x6961[_0xa9fd('0xa')](_0xa9fd('0xe'))||_0x6961[_0xa9fd('0xa')](_0xa9fd('0xf'))||_0x6961[_0xa9fd('0xa')](_0xa9fd('0x10'))){var _0x22f01f,_0x89c6b9;_0x22f01f=_0x6961[_0xa9fd('0xc')];var _0x34d1d1=_0x22f01f[_0xa9fd('0x11')](-0x1);if(_0x34d1d1==='/'||_0x34d1d1==='\x5c'||_0x34d1d1===':'){_0x22f01f=_0x22f01f['substring'](0x0,_0x22f01f[_0xa9fd('0x12')](_0x34d1d1));}switch(_0x6961[_0xa9fd('0xb')]){case'US':_0x89c6b9=_0xa9fd('0x13');break;case'AU':_0x89c6b9='https://accounts.zoho.com.au';break;case'IN':_0x89c6b9=_0xa9fd('0x14');break;case'CN':_0x89c6b9=_0xa9fd('0x15');break;default:_0x89c6b9='https://accounts.zoho.eu';break;}var _0x29b716={'method':_0xa9fd('0x16'),'uri':_0x89c6b9+'/oauth/v2/token','form':{'grant_type':_0xa9fd('0x17'),'client_id':_0x6961[_0xa9fd('0xd')],'client_secret':_0x6961[_0xa9fd('0xe')],'redirect_uri':_0x6961[_0xa9fd('0xc')],'code':_0x6961[_0xa9fd('0xf')]},'headers':{'Content-Type':_0xa9fd('0x18')}};return rp(_0x29b716)[_0xa9fd('0x19')](function(_0x154888){var _0xd886b8=JSON['parse'](_0x154888);if(_0xd886b8[_0xa9fd('0x1a')]){_0x6961['refreshToken']=_0xd886b8['refresh_token'];logger[_0xa9fd('0x1b')](util[_0xa9fd('0x1c')](_0xa9fd('0x1d'),_0x6961[_0xa9fd('0x1e')],_0x6961['id']));}else{logger[_0xa9fd('0x1f')](util[_0xa9fd('0x1c')](_0xa9fd('0x20'),_0x6961['name'],_0x6961['id']),util[_0xa9fd('0x21')](_0xd886b8,{'showHidden':![],'depth':null}));}return _0x1d38d5(null,_0x5db7b2);})[_0xa9fd('0x22')](function(_0x2fc055){logger[_0xa9fd('0x1f')](util[_0xa9fd('0x1c')](_0xa9fd('0x20'),_0x6961[_0xa9fd('0x1e')],_0x6961['id']),util[_0xa9fd('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x1d38d5(_0x2fc055);});}else{return _0x1d38d5(null,_0x5db7b2);}},'beforeUpdate':function(_0x1ef8e6,_0x5b21b4,_0x5cb550){if(_0x1ef8e6[_0xa9fd('0xa')](_0xa9fd('0xb'))||_0x1ef8e6[_0xa9fd('0xa')](_0xa9fd('0xc'))||_0x1ef8e6[_0xa9fd('0xa')](_0xa9fd('0xd'))||_0x1ef8e6[_0xa9fd('0xa')](_0xa9fd('0xe'))||_0x1ef8e6[_0xa9fd('0xa')](_0xa9fd('0xf'))||_0x1ef8e6['changed'](_0xa9fd('0x10'))){var _0x40af80,_0xe8dc0b;_0x40af80=_0x1ef8e6[_0xa9fd('0xc')];var _0x567d3c=_0x40af80[_0xa9fd('0x11')](-0x1);if(_0x567d3c==='/'||_0x567d3c==='\x5c'||_0x567d3c===':'){_0x40af80=_0x40af80[_0xa9fd('0x23')](0x0,_0x40af80[_0xa9fd('0x12')](_0x567d3c));}switch(_0x1ef8e6['zone']){case'US':_0xe8dc0b=_0xa9fd('0x13');break;case'AU':_0xe8dc0b=_0xa9fd('0x24');break;case'IN':_0xe8dc0b=_0xa9fd('0x14');break;case'CN':_0xe8dc0b=_0xa9fd('0x15');break;default:_0xe8dc0b=_0xa9fd('0x25');break;}var _0x580dba={'method':_0xa9fd('0x16'),'uri':_0xe8dc0b+_0xa9fd('0x26'),'form':{'grant_type':_0xa9fd('0x17'),'client_id':_0x1ef8e6[_0xa9fd('0xd')],'client_secret':_0x1ef8e6[_0xa9fd('0xe')],'redirect_uri':_0x1ef8e6[_0xa9fd('0xc')],'code':_0x1ef8e6['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x580dba)[_0xa9fd('0x19')](function(_0x26a221){var _0x1053df=JSON[_0xa9fd('0x27')](_0x26a221);if(_0x1053df['refresh_token']){_0x1ef8e6[_0xa9fd('0x28')]=_0x1053df[_0xa9fd('0x1a')];logger[_0xa9fd('0x1b')](util['format'](_0xa9fd('0x1d'),_0x1ef8e6[_0xa9fd('0x1e')],_0x1ef8e6['id']));}else{logger[_0xa9fd('0x1f')](util[_0xa9fd('0x1c')](_0xa9fd('0x20'),_0x1ef8e6[_0xa9fd('0x1e')],_0x1ef8e6['id']),util[_0xa9fd('0x21')](_0x1053df,{'showHidden':![],'depth':null}));}return _0x5cb550(null,_0x5b21b4);})[_0xa9fd('0x22')](function(_0x5a21b3){logger[_0xa9fd('0x1f')](util[_0xa9fd('0x1c')](_0xa9fd('0x20'),_0x1ef8e6[_0xa9fd('0x1e')],_0x1ef8e6['id']),util[_0xa9fd('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x5cb550(_0x5a21b3);});}else{return _0x5cb550(null,_0x5b21b4);}}}});}; \ No newline at end of file +var _0x000d=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','substring','lastIndexOf','https://accounts.zoho.com.au','POST','/oauth/v2/token','refreshToken','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','zone','changed','serverUrl','clientId','clientSecret','code','host','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x000d,0x1d2));var _0xd000=function(_0x38991d,_0x3f73e9){_0x38991d=_0x38991d-0x0;var _0x12ef00=_0x000d[_0x38991d];return _0x12ef00;};'use strict';var _=require(_0xd000('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd000('0x1'));var BPromise=require(_0xd000('0x2'));var rp=require(_0xd000('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd000('0x4'));var config=require(_0xd000('0x5'));var attributes=require(_0xd000('0x6'));var integrations=require(_0xd000('0x7'));module['exports']=function(_0x28ae15,_0x4b545b){return _0x28ae15[_0xd000('0x8')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x30383c,_0x11e04a,_0x5a6e32){if(_0x30383c['changed'](_0xd000('0x9'))||_0x30383c[_0xd000('0xa')](_0xd000('0xb'))||_0x30383c[_0xd000('0xa')](_0xd000('0xc'))||_0x30383c['changed'](_0xd000('0xd'))||_0x30383c['changed'](_0xd000('0xe'))||_0x30383c['changed'](_0xd000('0xf'))){var _0x3cc107,_0x42ef82;_0x3cc107=_0x30383c['serverUrl'];var _0xb5af5e=_0x3cc107['slice'](-0x1);if(_0xb5af5e==='/'||_0xb5af5e==='\x5c'||_0xb5af5e===':'){_0x3cc107=_0x3cc107['substring'](0x0,_0x3cc107['lastIndexOf'](_0xb5af5e));}switch(_0x30383c[_0xd000('0x9')]){case'US':_0x42ef82=_0xd000('0x10');break;case'AU':_0x42ef82='https://accounts.zoho.com.au';break;case'IN':_0x42ef82=_0xd000('0x11');break;case'CN':_0x42ef82=_0xd000('0x12');break;default:_0x42ef82=_0xd000('0x13');break;}var _0x2523cf={'method':'POST','uri':_0x42ef82+'/oauth/v2/token','form':{'grant_type':_0xd000('0x14'),'client_id':_0x30383c[_0xd000('0xc')],'client_secret':_0x30383c['clientSecret'],'redirect_uri':_0x30383c['serverUrl'],'code':_0x30383c['code']},'headers':{'Content-Type':_0xd000('0x15')}};return rp(_0x2523cf)['then'](function(_0xfadc15){var _0x216db4=JSON[_0xd000('0x16')](_0xfadc15);if(_0x216db4['refresh_token']){_0x30383c['refreshToken']=_0x216db4[_0xd000('0x17')];logger[_0xd000('0x18')](util[_0xd000('0x19')](_0xd000('0x1a'),_0x30383c[_0xd000('0x1b')],_0x30383c['id']));}else{logger[_0xd000('0x1c')](util['format'](_0xd000('0x1d'),_0x30383c['name'],_0x30383c['id']),util[_0xd000('0x1e')](_0x216db4,{'showHidden':![],'depth':null}));}return _0x5a6e32(null,_0x11e04a);})['catch'](function(_0x43c3e6){logger['error'](util[_0xd000('0x19')](_0xd000('0x1d'),_0x30383c[_0xd000('0x1b')],_0x30383c['id']),util[_0xd000('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x5a6e32(_0x43c3e6);});}else{return _0x5a6e32(null,_0x11e04a);}},'beforeUpdate':function(_0xe3ab98,_0x18d62d,_0x1aed31){if(_0xe3ab98['changed'](_0xd000('0x9'))||_0xe3ab98[_0xd000('0xa')](_0xd000('0xb'))||_0xe3ab98['changed'](_0xd000('0xc'))||_0xe3ab98['changed']('clientSecret')||_0xe3ab98[_0xd000('0xa')]('code')||_0xe3ab98[_0xd000('0xa')]('host')){var _0x44befd,_0x43bf15;_0x44befd=_0xe3ab98[_0xd000('0xb')];var _0x19e16c=_0x44befd[_0xd000('0x1f')](-0x1);if(_0x19e16c==='/'||_0x19e16c==='\x5c'||_0x19e16c===':'){_0x44befd=_0x44befd[_0xd000('0x20')](0x0,_0x44befd[_0xd000('0x21')](_0x19e16c));}switch(_0xe3ab98[_0xd000('0x9')]){case'US':_0x43bf15=_0xd000('0x10');break;case'AU':_0x43bf15=_0xd000('0x22');break;case'IN':_0x43bf15=_0xd000('0x11');break;case'CN':_0x43bf15=_0xd000('0x12');break;default:_0x43bf15='https://accounts.zoho.eu';break;}var _0x3ce5ad={'method':_0xd000('0x23'),'uri':_0x43bf15+_0xd000('0x24'),'form':{'grant_type':_0xd000('0x14'),'client_id':_0xe3ab98[_0xd000('0xc')],'client_secret':_0xe3ab98[_0xd000('0xd')],'redirect_uri':_0xe3ab98[_0xd000('0xb')],'code':_0xe3ab98[_0xd000('0xe')]},'headers':{'Content-Type':_0xd000('0x15')}};return rp(_0x3ce5ad)['then'](function(_0xcbb1ed){var _0x5b71b8=JSON['parse'](_0xcbb1ed);if(_0x5b71b8[_0xd000('0x17')]){_0xe3ab98[_0xd000('0x25')]=_0x5b71b8[_0xd000('0x17')];logger[_0xd000('0x18')](util[_0xd000('0x19')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe3ab98[_0xd000('0x1b')],_0xe3ab98['id']));}else{logger['error'](util[_0xd000('0x19')](_0xd000('0x1d'),_0xe3ab98[_0xd000('0x1b')],_0xe3ab98['id']),util[_0xd000('0x1e')](_0x5b71b8,{'showHidden':![],'depth':null}));}return _0x1aed31(null,_0x18d62d);})['catch'](function(_0x295cbc){logger[_0xd000('0x1c')](util[_0xd000('0x19')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe3ab98['name'],_0xe3ab98['id']),util[_0xd000('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x1aed31(_0x295cbc);});}else{return _0x1aed31(null,_0x18d62d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 97d372c..9308203 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 _0x3e94=['stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','map','include','model','find','ShowZohoAccount'];(function(_0x3b5b94,_0x1b1d80){var _0x507e9e=function(_0x2375e3){while(--_0x2375e3){_0x3b5b94['push'](_0x3b5b94['shift']());}};_0x507e9e(++_0x1b1d80);}(_0x3e94,0x67));var _0x43e9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3e94[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require(_0x43e9('0x2'));var rs=require(_0x43e9('0x3'));var fs=require('fs');var Redis=require(_0x43e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))(_0x43e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x43e9('0x8'));var client=jayson['client'][_0x43e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b35f1,_0x1183a0,_0x2989fe){return new BPromise(function(_0x287aaf,_0x510ee7){return client[_0x43e9('0xa')](_0x4b35f1,_0x2989fe)[_0x43e9('0xb')](function(_0x43d6e8){logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));logger[_0x43e9('0xf')](_0x43e9('0x10'),_0x1183a0,_0x43e9('0xe'),JSON['stringify'](_0x43d6e8));if(_0x43d6e8[_0x43e9('0x11')]){if(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x12')]===0x1f4){logger['error'](_0x43e9('0xd'),_0x1183a0,_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);return _0x510ee7(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1183a0,_0x43d6e8[_0x43e9('0x11')]['message']);return _0x287aaf(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}else{logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));_0x287aaf(_0x43d6e8[_0x43e9('0x14')][_0x43e9('0x13')]);}})[_0x43e9('0x15')](function(_0x3f7164){logger[_0x43e9('0x11')](_0x43e9('0xd'),_0x1183a0,_0x3f7164);_0x510ee7(_0x3f7164);});});}exports[_0x43e9('0x16')]=function(_0x310476){var _0x31614e=this;return new Promise(function(_0x527d97,_0x4e9fef){return db[_0x43e9('0x17')][_0x43e9('0x18')]({'raw':_0x310476[_0x43e9('0x19')]?_0x310476[_0x43e9('0x19')][_0x43e9('0x1a')]===undefined?!![]:![]:!![],'where':_0x310476['options']?_0x310476[_0x43e9('0x19')]['where']||null:null,'attributes':_0x310476[_0x43e9('0x19')]?_0x310476[_0x43e9('0x19')][_0x43e9('0x1b')]||null:null,'limit':_0x310476[_0x43e9('0x19')]?_0x310476[_0x43e9('0x19')]['limit']||null:null,'include':_0x310476[_0x43e9('0x19')]?_0x310476[_0x43e9('0x19')]['include']?_[_0x43e9('0x1c')](_0x310476[_0x43e9('0x19')][_0x43e9('0x1d')],function(_0x6e609b){return{'model':db[_0x6e609b['model']],'as':_0x6e609b['as'],'attributes':_0x6e609b[_0x43e9('0x1b')],'include':_0x6e609b['include']?_[_0x43e9('0x1c')](_0x6e609b['include'],function(_0x486539){return{'model':db[_0x486539['model']],'as':_0x486539['as'],'attributes':_0x486539['attributes'],'include':_0x486539[_0x43e9('0x1d')]?_['map'](_0x486539[_0x43e9('0x1d')],function(_0xf0dbbf){return{'model':db[_0xf0dbbf[_0x43e9('0x1e')]],'as':_0xf0dbbf['as'],'attributes':_0xf0dbbf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf64426){logger['info']('GetZohoAccount',_0x310476);logger[_0x43e9('0xf')]('GetZohoAccount',_0x310476,JSON['stringify'](_0xf64426));_0x527d97(_0xf64426);})['catch'](function(_0x197c88){logger[_0x43e9('0x11')]('GetZohoAccount',_0x197c88[_0x43e9('0x13')],_0x310476);_0x4e9fef(_0x31614e['error'](0x1f4,_0x197c88[_0x43e9('0x13')]));});});};exports['ShowZohoAccount']=function(_0x24dfff){var _0x580bd0=this;return new Promise(function(_0x4cd81b,_0x128b56){return db[_0x43e9('0x17')][_0x43e9('0x1f')]({'raw':_0x24dfff[_0x43e9('0x19')]?_0x24dfff[_0x43e9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x24dfff[_0x43e9('0x19')]?_0x24dfff['options']['where']||null:null,'attributes':_0x24dfff[_0x43e9('0x19')]?_0x24dfff[_0x43e9('0x19')][_0x43e9('0x1b')]||null:null,'include':_0x24dfff[_0x43e9('0x19')]?_0x24dfff['options'][_0x43e9('0x1d')]?_[_0x43e9('0x1c')](_0x24dfff[_0x43e9('0x19')][_0x43e9('0x1d')],function(_0x55ea93){return{'model':db[_0x55ea93[_0x43e9('0x1e')]],'as':_0x55ea93['as'],'attributes':_0x55ea93[_0x43e9('0x1b')],'include':_0x55ea93[_0x43e9('0x1d')]?_[_0x43e9('0x1c')](_0x55ea93[_0x43e9('0x1d')],function(_0x3599e5){return{'model':db[_0x3599e5[_0x43e9('0x1e')]],'as':_0x3599e5['as'],'attributes':_0x3599e5['attributes'],'include':_0x3599e5[_0x43e9('0x1d')]?_[_0x43e9('0x1c')](_0x3599e5[_0x43e9('0x1d')],function(_0x42b436){return{'model':db[_0x42b436[_0x43e9('0x1e')]],'as':_0x42b436['as'],'attributes':_0x42b436['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e9('0xb')](function(_0x238998){logger[_0x43e9('0xc')]('ShowZohoAccount',_0x24dfff);logger[_0x43e9('0xf')](_0x43e9('0x20'),_0x24dfff,JSON[_0x43e9('0x21')](_0x238998));_0x4cd81b(_0x238998);})[_0x43e9('0x15')](function(_0x133fc7){logger['error'](_0x43e9('0x20'),_0x133fc7[_0x43e9('0x13')],_0x24dfff);_0x128b56(_0x580bd0[_0x43e9('0x11')](0x1f4,_0x133fc7[_0x43e9('0x13')]));});});}; \ No newline at end of file +var _0x084b=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','options','where','attributes','include','map','model','ShowZohoAccount','ZohoAccount','find','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x084b,0xd5));var _0xb084=function(_0x397cb5,_0x60d6b2){_0x397cb5=_0x397cb5-0x0;var _0x2a5444=_0x084b[_0x397cb5];return _0x2a5444;};'use strict';var _=require(_0xb084('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb084('0x1'));var fs=require('fs');var Redis=require(_0xb084('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb084('0x3'));var logger=require(_0xb084('0x4'))(_0xb084('0x5'));var config=require('../../config/environment');var jayson=require(_0xb084('0x6'));var client=jayson['client'][_0xb084('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x449c7a,_0x275c8c,_0x4b69ad){return new BPromise(function(_0x4f45d2,_0x18a300){return client[_0xb084('0x8')](_0x449c7a,_0x4b69ad)[_0xb084('0x9')](function(_0xec1e0d){logger[_0xb084('0xa')](_0xb084('0xb'),_0x275c8c,_0xb084('0xc'));logger[_0xb084('0xd')](_0xb084('0xe'),_0x275c8c,_0xb084('0xc'),JSON[_0xb084('0xf')](_0xec1e0d));if(_0xec1e0d[_0xb084('0x10')]){if(_0xec1e0d[_0xb084('0x10')][_0xb084('0x11')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x275c8c,_0xec1e0d[_0xb084('0x10')]['message']);return _0x18a300(_0xec1e0d['error'][_0xb084('0x12')]);}logger[_0xb084('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x275c8c,_0xec1e0d['error'][_0xb084('0x12')]);return _0x4f45d2(_0xec1e0d[_0xb084('0x10')][_0xb084('0x12')]);}else{logger[_0xb084('0xa')](_0xb084('0xb'),_0x275c8c,'request\x20sent');_0x4f45d2(_0xec1e0d[_0xb084('0x13')][_0xb084('0x12')]);}})[_0xb084('0x14')](function(_0xbcdb1f){logger[_0xb084('0x10')](_0xb084('0xb'),_0x275c8c,_0xbcdb1f);_0x18a300(_0xbcdb1f);});});}exports[_0xb084('0x15')]=function(_0x42657a){var _0x13b3e4=this;return new Promise(function(_0x19d426,_0x4b91e5){return db['ZohoAccount']['findAll']({'raw':_0x42657a['options']?_0x42657a[_0xb084('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x42657a[_0xb084('0x16')]?_0x42657a[_0xb084('0x16')][_0xb084('0x17')]||null:null,'attributes':_0x42657a[_0xb084('0x16')]?_0x42657a[_0xb084('0x16')][_0xb084('0x18')]||null:null,'limit':_0x42657a[_0xb084('0x16')]?_0x42657a[_0xb084('0x16')]['limit']||null:null,'include':_0x42657a['options']?_0x42657a[_0xb084('0x16')][_0xb084('0x19')]?_[_0xb084('0x1a')](_0x42657a[_0xb084('0x16')][_0xb084('0x19')],function(_0x4795d9){return{'model':db[_0x4795d9[_0xb084('0x1b')]],'as':_0x4795d9['as'],'attributes':_0x4795d9[_0xb084('0x18')],'include':_0x4795d9['include']?_[_0xb084('0x1a')](_0x4795d9['include'],function(_0x1f4983){return{'model':db[_0x1f4983[_0xb084('0x1b')]],'as':_0x1f4983['as'],'attributes':_0x1f4983['attributes'],'include':_0x1f4983[_0xb084('0x19')]?_[_0xb084('0x1a')](_0x1f4983[_0xb084('0x19')],function(_0x4ce54c){return{'model':db[_0x4ce54c[_0xb084('0x1b')]],'as':_0x4ce54c['as'],'attributes':_0x4ce54c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb084('0x9')](function(_0x623fe8){logger['info'](_0xb084('0x15'),_0x42657a);logger[_0xb084('0xd')]('GetZohoAccount',_0x42657a,JSON[_0xb084('0xf')](_0x623fe8));_0x19d426(_0x623fe8);})[_0xb084('0x14')](function(_0x57406f){logger[_0xb084('0x10')](_0xb084('0x15'),_0x57406f['message'],_0x42657a);_0x4b91e5(_0x13b3e4[_0xb084('0x10')](0x1f4,_0x57406f[_0xb084('0x12')]));});});};exports[_0xb084('0x1c')]=function(_0x257833){var _0x33ed25=this;return new Promise(function(_0x5afdf1,_0x318b34){return db[_0xb084('0x1d')][_0xb084('0x1e')]({'raw':_0x257833[_0xb084('0x16')]?_0x257833['options'][_0xb084('0x1f')]===undefined?!![]:![]:!![],'where':_0x257833[_0xb084('0x16')]?_0x257833[_0xb084('0x16')][_0xb084('0x17')]||null:null,'attributes':_0x257833[_0xb084('0x16')]?_0x257833['options']['attributes']||null:null,'include':_0x257833[_0xb084('0x16')]?_0x257833['options'][_0xb084('0x19')]?_['map'](_0x257833[_0xb084('0x16')][_0xb084('0x19')],function(_0x40e50b){return{'model':db[_0x40e50b[_0xb084('0x1b')]],'as':_0x40e50b['as'],'attributes':_0x40e50b['attributes'],'include':_0x40e50b[_0xb084('0x19')]?_[_0xb084('0x1a')](_0x40e50b[_0xb084('0x19')],function(_0x2ad60c){return{'model':db[_0x2ad60c[_0xb084('0x1b')]],'as':_0x2ad60c['as'],'attributes':_0x2ad60c['attributes'],'include':_0x2ad60c[_0xb084('0x19')]?_[_0xb084('0x1a')](_0x2ad60c['include'],function(_0x481a83){return{'model':db[_0x481a83[_0xb084('0x1b')]],'as':_0x481a83['as'],'attributes':_0x481a83[_0xb084('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb084('0x9')](function(_0xdea33c){logger[_0xb084('0xa')](_0xb084('0x1c'),_0x257833);logger[_0xb084('0xd')](_0xb084('0x1c'),_0x257833,JSON['stringify'](_0xdea33c));_0x5afdf1(_0xdea33c);})[_0xb084('0x14')](function(_0x3da0e9){logger['error'](_0xb084('0x1c'),_0x3da0e9['message'],_0x257833);_0x318b34(_0x33ed25[_0xb084('0x10')](0x1f4,_0x3da0e9[_0xb084('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 43bd887..9fe5849 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 _0x7fe3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x7fe3,0x153));var _0x37fe=function(_0x3205f7,_0x2bcfc6){_0x3205f7=_0x3205f7-0x0;var _0x19a463=_0x7fe3[_0x3205f7];return _0x19a463;};'use strict';var multer=require(_0x37fe('0x0'));var util=require('util');var path=require(_0x37fe('0x1'));var timeout=require(_0x37fe('0x2'));var express=require(_0x37fe('0x3'));var router=express[_0x37fe('0x4')]();var fs_extra=require(_0x37fe('0x5'));var auth=require(_0x37fe('0x6'));var interaction=require(_0x37fe('0x7'));var config=require(_0x37fe('0x8'));var controller=require(_0x37fe('0x9'));router[_0x37fe('0xa')]('/',auth[_0x37fe('0xb')](),controller[_0x37fe('0xc')]);router[_0x37fe('0xa')](_0x37fe('0xd'),auth[_0x37fe('0xb')](),controller['show']);router['get'](_0x37fe('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x37fe('0xa')](_0x37fe('0xf'),auth[_0x37fe('0xb')](),controller['getSubjects']);router[_0x37fe('0xa')](_0x37fe('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x37fe('0x11')]('/',auth['isAuthenticated'](),controller[_0x37fe('0x12')]);router[_0x37fe('0x13')](_0x37fe('0xd'),auth['isAuthenticated'](),controller[_0x37fe('0x14')]);router[_0x37fe('0x15')](_0x37fe('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x37fe('0x16')]=router; \ No newline at end of file +var _0x009b=['connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer','path'];(function(_0x5ff464,_0x5038d7){var _0x347182=function(_0xeef52c){while(--_0xeef52c){_0x5ff464['push'](_0x5ff464['shift']());}};_0x347182(++_0x5038d7);}(_0x009b,0x9f));var _0xb009=function(_0x5bee84,_0x3f6e8a){_0x5bee84=_0x5bee84-0x0;var _0x4d1cc5=_0x009b[_0x5bee84];return _0x4d1cc5;};'use strict';var multer=require(_0xb009('0x0'));var util=require('util');var path=require(_0xb009('0x1'));var timeout=require(_0xb009('0x2'));var express=require(_0xb009('0x3'));var router=express[_0xb009('0x4')]();var fs_extra=require(_0xb009('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb009('0x6'));var controller=require(_0xb009('0x7'));router['get']('/',auth[_0xb009('0x8')](),controller[_0xb009('0x9')]);router[_0xb009('0xa')](_0xb009('0xb'),auth[_0xb009('0x8')](),controller[_0xb009('0xc')]);router[_0xb009('0xa')](_0xb009('0xd'),auth[_0xb009('0x8')](),controller[_0xb009('0xe')]);router[_0xb009('0xa')](_0xb009('0xf'),auth[_0xb009('0x8')](),controller[_0xb009('0x10')]);router[_0xb009('0xa')](_0xb009('0x11'),auth[_0xb009('0x8')](),controller[_0xb009('0x12')]);router['post']('/',auth[_0xb009('0x8')](),controller['create']);router[_0xb009('0x13')](_0xb009('0xb'),auth[_0xb009('0x8')](),controller[_0xb009('0x14')]);router['delete'](_0xb009('0xb'),auth[_0xb009('0x8')](),controller[_0xb009('0x15')]);module[_0xb009('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 604dcd9..bfe6aa1 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 _0xfeb8=['lead','contact','nothing','contact_lead','ENUM'];(function(_0x2b8d02,_0x60cec6){var _0x1c0eaf=function(_0x44d3b7){while(--_0x44d3b7){_0x2b8d02['push'](_0x2b8d02['shift']());}};_0x1c0eaf(++_0x60cec6);}(_0xfeb8,0x167));var _0x8feb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfeb8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x8feb('0x0')](_0x8feb('0x1'),_0x8feb('0x2'),_0x8feb('0x3')),'defaultValue':_0x8feb('0x1')},'moduleSearch':{'type':Sequelize['ENUM'](_0x8feb('0x4'),'contact','lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1c17=['sequelize','exports','STRING','ENUM','contact','nothing','lead','contact_lead'];(function(_0xf0fe2a,_0x32d000){var _0xa6e4ef=function(_0x581cc2){while(--_0x581cc2){_0xf0fe2a['push'](_0xf0fe2a['shift']());}};_0xa6e4ef(++_0x32d000);}(_0x1c17,0x158));var _0x71c1=function(_0x51564e,_0x12ef79){_0x51564e=_0x51564e-0x0;var _0x31d941=_0x1c17[_0x51564e];return _0x31d941;};'use strict';var Sequelize=require(_0x71c1('0x0'));module[_0x71c1('0x1')]={'name':{'type':Sequelize[_0x71c1('0x2')]},'moduleCreate':{'type':Sequelize[_0x71c1('0x3')]('lead',_0x71c1('0x4'),_0x71c1('0x5')),'defaultValue':_0x71c1('0x6')},'moduleSearch':{'type':Sequelize['ENUM'](_0x71c1('0x7'),_0x71c1('0x4'),_0x71c1('0x6')),'defaultValue':_0x71c1('0x7')},'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 c006e60..6d24c89 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 _0xb567=['body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','ZohoConfiguration','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x401b8e,_0x334bb2){var _0x533f3e=function(_0x59ed14){while(--_0x59ed14){_0x401b8e['push'](_0x401b8e['shift']());}};_0x533f3e(++_0x334bb2);}(_0xb567,0x1f2));var _0x7b56=function(_0x5d98bf,_0xecf85e){_0x5d98bf=_0x5d98bf-0x0;var _0x4a5637=_0xb567[_0x5d98bf];return _0x4a5637;};'use strict';var emlformat=require(_0x7b56('0x0'));var rimraf=require(_0x7b56('0x1'));var zipdir=require(_0x7b56('0x2'));var jsonpatch=require(_0x7b56('0x3'));var rp=require('request-promise');var moment=require(_0x7b56('0x4'));var BPromise=require(_0x7b56('0x5'));var Mustache=require(_0x7b56('0x6'));var util=require('util');var path=require(_0x7b56('0x7'));var sox=require('sox');var csv=require(_0x7b56('0x8'));var ejs=require(_0x7b56('0x9'));var fs=require('fs');var fs_extra=require(_0x7b56('0xa'));var _=require(_0x7b56('0xb'));var squel=require(_0x7b56('0xc'));var crypto=require(_0x7b56('0xd'));var jsforce=require(_0x7b56('0xe'));var deskjs=require(_0x7b56('0xf'));var toCsv=require(_0x7b56('0x8'));var querystring=require(_0x7b56('0x10'));var Papa=require('papaparse');var Redis=require(_0x7b56('0x11'));var authService=require(_0x7b56('0x12'));var qs=require(_0x7b56('0x13'));var as=require(_0x7b56('0x14'));var hardwareService=require(_0x7b56('0x15'));var logger=require(_0x7b56('0x16'))(_0x7b56('0x17'));var utils=require('../../config/utils');var config=require(_0x7b56('0x18'));var licenseUtil=require(_0x7b56('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ce986,_0x1eede4){_0x1eede4=_0x1eede4||0xcc;return function(_0x5865f5){if(_0x5865f5){return _0x5ce986[_0x7b56('0x1a')](_0x1eede4);}return _0x5ce986[_0x7b56('0x1b')](_0x1eede4)[_0x7b56('0x1c')]();};}function respondWithResult(_0x2d335f,_0x3edefe){_0x3edefe=_0x3edefe||0xc8;return function(_0x4eb4b5){if(_0x4eb4b5){return _0x2d335f[_0x7b56('0x1b')](_0x3edefe)['json'](_0x4eb4b5);}};}function respondWithFilteredResult(_0x461a33,_0x320fd3){return function(_0x1eda0a){if(_0x1eda0a){var _0x34ac2f=typeof _0x320fd3[_0x7b56('0x1d')]===_0x7b56('0x1e')&&typeof _0x320fd3[_0x7b56('0x1f')]==='undefined';var _0x5bfc1d=_0x1eda0a[_0x7b56('0x20')];var _0x335c71=_0x34ac2f?0x0:_0x320fd3['offset'];var _0x10171f=_0x34ac2f?_0x1eda0a[_0x7b56('0x20')]:_0x320fd3[_0x7b56('0x1d')]+_0x320fd3[_0x7b56('0x1f')];var _0x2a8253;if(_0x10171f>=_0x5bfc1d){_0x10171f=_0x5bfc1d;_0x2a8253=0xc8;}else{_0x2a8253=0xce;}_0x461a33[_0x7b56('0x1b')](_0x2a8253);return _0x461a33[_0x7b56('0x21')](_0x7b56('0x22'),_0x335c71+'-'+_0x10171f+'/'+_0x5bfc1d)[_0x7b56('0x23')](_0x1eda0a);}return null;};}function patchUpdates(_0x3e2398){return function(_0x42bb32){try{jsonpatch[_0x7b56('0x24')](_0x42bb32,_0x3e2398,!![]);}catch(_0x15a6d4){return BPromise[_0x7b56('0x25')](_0x15a6d4);}return _0x42bb32['save']();};}function saveUpdates(_0x9f22fd,_0x160d72){return function(_0x127a8f){if(_0x127a8f){return _0x127a8f[_0x7b56('0x26')](_0x9f22fd)[_0x7b56('0x27')](function(_0x491914){return _0x491914;});}return null;};}function removeEntity(_0x4ea042,_0x2c88e6){return function(_0xdb57c){if(_0xdb57c){return _0xdb57c[_0x7b56('0x28')]()['then'](function(){_0x4ea042[_0x7b56('0x1b')](0xcc)[_0x7b56('0x1c')]();});}};}function handleEntityNotFound(_0x461179,_0x502e3c){return function(_0x43ae47){if(!_0x43ae47){_0x461179[_0x7b56('0x1a')](0x194);}return _0x43ae47;};}function handleError(_0x47aa52,_0x4ab585){_0x4ab585=_0x4ab585||0x1f4;return function(_0x4d22e5){logger[_0x7b56('0x29')](_0x4d22e5[_0x7b56('0x2a')]);if(_0x4d22e5[_0x7b56('0x2b')]){delete _0x4d22e5[_0x7b56('0x2b')];}_0x47aa52[_0x7b56('0x1b')](_0x4ab585)['send'](_0x4d22e5);};}exports['index']=function(_0x4e19cc,_0x20d0f5){var _0x9b5b11={},_0x1bbbd1={},_0x5645d8={'count':0x0,'rows':[]};var _0x32619d=_['map'](db[_0x7b56('0x2c')][_0x7b56('0x2d')],function(_0x279071){return{'name':_0x279071['fieldName'],'type':_0x279071[_0x7b56('0x2e')][_0x7b56('0x2f')]};});_0x1bbbd1[_0x7b56('0x30')]=_[_0x7b56('0x31')](_0x32619d,_0x7b56('0x2b'));_0x1bbbd1['query']=_[_0x7b56('0x32')](_0x4e19cc[_0x7b56('0x33')]);_0x1bbbd1[_0x7b56('0x34')]=_[_0x7b56('0x35')](_0x1bbbd1[_0x7b56('0x30')],_0x1bbbd1[_0x7b56('0x33')]);_0x9b5b11[_0x7b56('0x36')]=_[_0x7b56('0x35')](_0x1bbbd1[_0x7b56('0x30')],qs[_0x7b56('0x37')](_0x4e19cc[_0x7b56('0x33')][_0x7b56('0x37')]));_0x9b5b11[_0x7b56('0x36')]=_0x9b5b11['attributes'][_0x7b56('0x38')]?_0x9b5b11[_0x7b56('0x36')]:_0x1bbbd1[_0x7b56('0x30')];if(!_0x4e19cc[_0x7b56('0x33')][_0x7b56('0x39')](_0x7b56('0x3a'))){_0x9b5b11['limit']=qs[_0x7b56('0x1f')](_0x4e19cc[_0x7b56('0x33')][_0x7b56('0x1f')]);_0x9b5b11[_0x7b56('0x1d')]=qs[_0x7b56('0x1d')](_0x4e19cc[_0x7b56('0x33')][_0x7b56('0x1d')]);}_0x9b5b11[_0x7b56('0x3b')]=qs[_0x7b56('0x3c')](_0x4e19cc['query'][_0x7b56('0x3c')]);_0x9b5b11['where']=qs['filters'](_[_0x7b56('0x3d')](_0x4e19cc[_0x7b56('0x33')],_0x1bbbd1[_0x7b56('0x34')]),_0x32619d);if(_0x4e19cc[_0x7b56('0x33')][_0x7b56('0x3e')]){_0x9b5b11[_0x7b56('0x3f')]=_[_0x7b56('0x40')](_0x9b5b11[_0x7b56('0x3f')],{'$or':_[_0x7b56('0x31')](_0x32619d,function(_0x154be0){if(_0x154be0[_0x7b56('0x2e')]!==_0x7b56('0x41')){var _0x283713={};_0x283713[_0x154be0['name']]={'$like':'%'+_0x4e19cc[_0x7b56('0x33')][_0x7b56('0x3e')]+'%'};return _0x283713;}})});}_0x9b5b11=_[_0x7b56('0x40')]({},_0x9b5b11,_0x4e19cc[_0x7b56('0x42')]);var _0x51210c={'where':_0x9b5b11[_0x7b56('0x3f')]};return db[_0x7b56('0x2c')]['count'](_0x51210c)[_0x7b56('0x27')](function(_0x55c018){_0x5645d8[_0x7b56('0x20')]=_0x55c018;if(_0x4e19cc[_0x7b56('0x33')][_0x7b56('0x43')]){_0x9b5b11[_0x7b56('0x44')]=[{'all':!![]}];}return db[_0x7b56('0x2c')][_0x7b56('0x45')](_0x9b5b11);})[_0x7b56('0x27')](function(_0x2ae80a){_0x5645d8[_0x7b56('0x46')]=_0x2ae80a;return _0x5645d8;})[_0x7b56('0x27')](respondWithFilteredResult(_0x20d0f5,_0x9b5b11))[_0x7b56('0x47')](handleError(_0x20d0f5,null));};exports[_0x7b56('0x48')]=function(_0x12d3b9,_0x12c166){var _0x32302e={'raw':![],'where':{'id':_0x12d3b9[_0x7b56('0x49')]['id']}},_0x570b89={};_0x570b89[_0x7b56('0x30')]=_[_0x7b56('0x32')](db[_0x7b56('0x2c')][_0x7b56('0x2d')]);_0x570b89[_0x7b56('0x33')]=_[_0x7b56('0x32')](_0x12d3b9[_0x7b56('0x33')]);_0x570b89['filters']=_['intersection'](_0x570b89[_0x7b56('0x30')],_0x570b89[_0x7b56('0x33')]);_0x32302e[_0x7b56('0x36')]=_[_0x7b56('0x35')](_0x570b89[_0x7b56('0x30')],qs[_0x7b56('0x37')](_0x12d3b9[_0x7b56('0x33')]['fields']));_0x32302e['attributes']=_0x32302e[_0x7b56('0x36')][_0x7b56('0x38')]?_0x32302e[_0x7b56('0x36')]:_0x570b89[_0x7b56('0x30')];if(_0x12d3b9[_0x7b56('0x33')][_0x7b56('0x43')]){_0x32302e[_0x7b56('0x44')]=[{'all':!![]}];}_0x32302e=_[_0x7b56('0x40')]({},_0x32302e,_0x12d3b9[_0x7b56('0x42')]);return db['ZohoConfiguration'][_0x7b56('0x4a')](_0x32302e)['then'](handleEntityNotFound(_0x12c166,null))[_0x7b56('0x27')](respondWithResult(_0x12c166,null))[_0x7b56('0x47')](handleError(_0x12c166,null));};exports[_0x7b56('0x4b')]=function(_0x2da1aa,_0x147523){return db['ZohoConfiguration'][_0x7b56('0x4b')](_0x2da1aa[_0x7b56('0x4c')],{})[_0x7b56('0x27')](respondWithResult(_0x147523,0xc9))['catch'](handleError(_0x147523,null));};exports['update']=function(_0x2c82ec,_0x3d5690){if(_0x2c82ec[_0x7b56('0x4c')]['id']){delete _0x2c82ec['body']['id'];}return db[_0x7b56('0x2c')][_0x7b56('0x4a')]({'where':{'id':_0x2c82ec[_0x7b56('0x49')]['id']}})[_0x7b56('0x27')](handleEntityNotFound(_0x3d5690,null))[_0x7b56('0x27')](saveUpdates(_0x2c82ec['body'],null))['then'](respondWithResult(_0x3d5690,null))[_0x7b56('0x47')](handleError(_0x3d5690,null));};exports[_0x7b56('0x28')]=function(_0x26647d,_0x129f07){return db['ZohoConfiguration'][_0x7b56('0x4a')]({'where':{'id':_0x26647d[_0x7b56('0x49')]['id']}})[_0x7b56('0x27')](handleEntityNotFound(_0x129f07,null))[_0x7b56('0x27')](removeEntity(_0x129f07,null))[_0x7b56('0x47')](handleError(_0x129f07,null));};exports[_0x7b56('0x4d')]=function(_0x51498b,_0x39266c,_0x55f98a){var _0x530789={};var _0x1e7452={};var _0x167437;var _0x50a49d;return db[_0x7b56('0x2c')][_0x7b56('0x4e')]({'where':{'id':_0x51498b[_0x7b56('0x49')]['id']}})[_0x7b56('0x27')](handleEntityNotFound(_0x39266c,null))['then'](function(_0x39c0ed){if(_0x39c0ed){_0x167437=_0x39c0ed;_0x1e7452[_0x7b56('0x30')]=_[_0x7b56('0x32')](db[_0x7b56('0x4f')][_0x7b56('0x2d')]);_0x1e7452['query']=_[_0x7b56('0x32')](_0x51498b[_0x7b56('0x33')]);_0x1e7452[_0x7b56('0x34')]=_['intersection'](_0x1e7452[_0x7b56('0x30')],_0x1e7452[_0x7b56('0x33')]);_0x530789[_0x7b56('0x36')]=_[_0x7b56('0x35')](_0x1e7452['model'],qs['fields'](_0x51498b['query'][_0x7b56('0x37')]));_0x530789['attributes']=_0x530789['attributes'][_0x7b56('0x38')]?_0x530789[_0x7b56('0x36')]:_0x1e7452[_0x7b56('0x30')];_0x530789[_0x7b56('0x3b')]=qs['sort'](_0x51498b[_0x7b56('0x33')]['sort']);_0x530789[_0x7b56('0x3f')]=qs['filters'](_['pick'](_0x51498b['query'],_0x1e7452[_0x7b56('0x34')]));if(_0x51498b[_0x7b56('0x33')][_0x7b56('0x3e')]){_0x530789['where']=_[_0x7b56('0x40')](_0x530789['where'],{'$or':_['map'](_0x530789['attributes'],function(_0x32e72d){var _0x3679ef={};_0x3679ef[_0x32e72d]={'$like':'%'+_0x51498b['query']['filter']+'%'};return _0x3679ef;})});}_0x530789=_[_0x7b56('0x40')]({},_0x530789,_0x51498b[_0x7b56('0x42')]);return _0x167437[_0x7b56('0x4d')](_0x530789);}})[_0x7b56('0x27')](function(_0x418c51){if(_0x418c51){_0x50a49d=_0x418c51[_0x7b56('0x38')];if(!_0x51498b['query'][_0x7b56('0x39')](_0x7b56('0x3a'))){_0x530789[_0x7b56('0x1f')]=qs[_0x7b56('0x1f')](_0x51498b[_0x7b56('0x33')][_0x7b56('0x1f')]);_0x530789[_0x7b56('0x1d')]=qs[_0x7b56('0x1d')](_0x51498b['query'][_0x7b56('0x1d')]);}return _0x167437[_0x7b56('0x4d')](_0x530789);}})[_0x7b56('0x27')](function(_0x59219e){if(_0x59219e){return _0x59219e?{'count':_0x50a49d,'rows':_0x59219e}:null;}})['then'](respondWithResult(_0x39266c,null))[_0x7b56('0x47')](handleError(_0x39266c,null));};exports['getSubjects']=function(_0x311252,_0x374f1d,_0x2660b0){var _0xd6c266={};var _0x2942e7={};var _0x53fdbe;var _0x24fd12;return db[_0x7b56('0x2c')][_0x7b56('0x4e')]({'where':{'id':_0x311252['params']['id']}})[_0x7b56('0x27')](handleEntityNotFound(_0x374f1d,null))[_0x7b56('0x27')](function(_0x4b93ea){if(_0x4b93ea){_0x53fdbe=_0x4b93ea;_0x2942e7[_0x7b56('0x30')]=_[_0x7b56('0x32')](db[_0x7b56('0x4f')]['rawAttributes']);_0x2942e7[_0x7b56('0x33')]=_[_0x7b56('0x32')](_0x311252['query']);_0x2942e7[_0x7b56('0x34')]=_[_0x7b56('0x35')](_0x2942e7[_0x7b56('0x30')],_0x2942e7[_0x7b56('0x33')]);_0xd6c266[_0x7b56('0x36')]=_[_0x7b56('0x35')](_0x2942e7[_0x7b56('0x30')],qs[_0x7b56('0x37')](_0x311252[_0x7b56('0x33')][_0x7b56('0x37')]));_0xd6c266[_0x7b56('0x36')]=_0xd6c266[_0x7b56('0x36')][_0x7b56('0x38')]?_0xd6c266[_0x7b56('0x36')]:_0x2942e7[_0x7b56('0x30')];_0xd6c266['order']=qs[_0x7b56('0x3c')](_0x311252['query'][_0x7b56('0x3c')]);_0xd6c266[_0x7b56('0x3f')]=qs[_0x7b56('0x34')](_[_0x7b56('0x3d')](_0x311252[_0x7b56('0x33')],_0x2942e7[_0x7b56('0x34')]));if(_0x311252[_0x7b56('0x33')]['filter']){_0xd6c266[_0x7b56('0x3f')]=_[_0x7b56('0x40')](_0xd6c266[_0x7b56('0x3f')],{'$or':_['map'](_0xd6c266[_0x7b56('0x36')],function(_0xa368d6){var _0x1d159b={};_0x1d159b[_0xa368d6]={'$like':'%'+_0x311252[_0x7b56('0x33')][_0x7b56('0x3e')]+'%'};return _0x1d159b;})});}_0xd6c266=_[_0x7b56('0x40')]({},_0xd6c266,_0x311252[_0x7b56('0x42')]);return _0x53fdbe[_0x7b56('0x50')](_0xd6c266);}})[_0x7b56('0x27')](function(_0xe3e6c4){if(_0xe3e6c4){_0x24fd12=_0xe3e6c4[_0x7b56('0x38')];if(!_0x311252[_0x7b56('0x33')][_0x7b56('0x39')](_0x7b56('0x3a'))){_0xd6c266['limit']=qs[_0x7b56('0x1f')](_0x311252['query'][_0x7b56('0x1f')]);_0xd6c266[_0x7b56('0x1d')]=qs[_0x7b56('0x1d')](_0x311252[_0x7b56('0x33')][_0x7b56('0x1d')]);}return _0x53fdbe['getSubjects'](_0xd6c266);}})[_0x7b56('0x27')](function(_0x57bbc6){if(_0x57bbc6){return _0x57bbc6?{'count':_0x24fd12,'rows':_0x57bbc6}:null;}})[_0x7b56('0x27')](respondWithResult(_0x374f1d,null))['catch'](handleError(_0x374f1d,null));};exports[_0x7b56('0x51')]=function(_0x19649b,_0x2cfb2f,_0x14186b){var _0x26bb53={};var _0x54dc62={};var _0x2c780f;var _0x3a980f;return db[_0x7b56('0x2c')][_0x7b56('0x4e')]({'where':{'id':_0x19649b[_0x7b56('0x49')]['id']}})[_0x7b56('0x27')](handleEntityNotFound(_0x2cfb2f,null))[_0x7b56('0x27')](function(_0x5492e2){if(_0x5492e2){_0x2c780f=_0x5492e2;_0x54dc62[_0x7b56('0x30')]=_[_0x7b56('0x32')](db[_0x7b56('0x4f')][_0x7b56('0x2d')]);_0x54dc62[_0x7b56('0x33')]=_[_0x7b56('0x32')](_0x19649b[_0x7b56('0x33')]);_0x54dc62[_0x7b56('0x34')]=_[_0x7b56('0x35')](_0x54dc62[_0x7b56('0x30')],_0x54dc62[_0x7b56('0x33')]);_0x26bb53[_0x7b56('0x36')]=_['intersection'](_0x54dc62['model'],qs['fields'](_0x19649b[_0x7b56('0x33')][_0x7b56('0x37')]));_0x26bb53[_0x7b56('0x36')]=_0x26bb53[_0x7b56('0x36')]['length']?_0x26bb53['attributes']:_0x54dc62[_0x7b56('0x30')];_0x26bb53[_0x7b56('0x3b')]=qs[_0x7b56('0x3c')](_0x19649b[_0x7b56('0x33')]['sort']);_0x26bb53[_0x7b56('0x3f')]=qs[_0x7b56('0x34')](_[_0x7b56('0x3d')](_0x19649b[_0x7b56('0x33')],_0x54dc62[_0x7b56('0x34')]));if(_0x19649b[_0x7b56('0x33')][_0x7b56('0x3e')]){_0x26bb53[_0x7b56('0x3f')]=_['merge'](_0x26bb53[_0x7b56('0x3f')],{'$or':_['map'](_0x26bb53[_0x7b56('0x36')],function(_0x453534){var _0x2374d6={};_0x2374d6[_0x453534]={'$like':'%'+_0x19649b[_0x7b56('0x33')]['filter']+'%'};return _0x2374d6;})});}_0x26bb53=_[_0x7b56('0x40')]({},_0x26bb53,_0x19649b[_0x7b56('0x42')]);return _0x2c780f[_0x7b56('0x51')](_0x26bb53);}})[_0x7b56('0x27')](function(_0x15fc57){if(_0x15fc57){_0x3a980f=_0x15fc57[_0x7b56('0x38')];if(!_0x19649b[_0x7b56('0x33')][_0x7b56('0x39')](_0x7b56('0x3a'))){_0x26bb53[_0x7b56('0x1f')]=qs[_0x7b56('0x1f')](_0x19649b[_0x7b56('0x33')][_0x7b56('0x1f')]);_0x26bb53[_0x7b56('0x1d')]=qs[_0x7b56('0x1d')](_0x19649b['query']['offset']);}return _0x2c780f[_0x7b56('0x51')](_0x26bb53);}})[_0x7b56('0x27')](function(_0x2fdfd8){if(_0x2fdfd8){return _0x2fdfd8?{'count':_0x3a980f,'rows':_0x2fdfd8}:null;}})[_0x7b56('0x27')](respondWithResult(_0x2cfb2f,null))[_0x7b56('0x47')](handleError(_0x2cfb2f,null));}; \ No newline at end of file +var _0x7dda=['nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','getFields','ZohoField','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','update','then','error','stack','name','send','index','ZohoConfiguration','fieldName','key','map','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7dda,0x1b5));var _0xa7dd=function(_0x47152a,_0x224c39){_0x47152a=_0x47152a-0x0;var _0x73406d=_0x7dda[_0x47152a];return _0x73406d;};'use strict';var emlformat=require(_0xa7dd('0x0'));var rimraf=require(_0xa7dd('0x1'));var zipdir=require(_0xa7dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7dd('0x3'));var moment=require(_0xa7dd('0x4'));var BPromise=require(_0xa7dd('0x5'));var Mustache=require(_0xa7dd('0x6'));var util=require(_0xa7dd('0x7'));var path=require(_0xa7dd('0x8'));var sox=require(_0xa7dd('0x9'));var csv=require('to-csv');var ejs=require(_0xa7dd('0xa'));var fs=require('fs');var fs_extra=require(_0xa7dd('0xb'));var _=require(_0xa7dd('0xc'));var squel=require(_0xa7dd('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa7dd('0xe'));var toCsv=require(_0xa7dd('0xf'));var querystring=require('querystring');var Papa=require(_0xa7dd('0x10'));var Redis=require(_0xa7dd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa7dd('0x12'));var as=require(_0xa7dd('0x13'));var hardwareService=require(_0xa7dd('0x14'));var logger=require(_0xa7dd('0x15'))('api');var utils=require(_0xa7dd('0x16'));var config=require(_0xa7dd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7dd('0x18'))['db'];function respondWithStatusCode(_0x44bc63,_0x571711){_0x571711=_0x571711||0xcc;return function(_0x13f137){if(_0x13f137){return _0x44bc63[_0xa7dd('0x19')](_0x571711);}return _0x44bc63[_0xa7dd('0x1a')](_0x571711)[_0xa7dd('0x1b')]();};}function respondWithResult(_0x341141,_0x4b5022){_0x4b5022=_0x4b5022||0xc8;return function(_0x3543f4){if(_0x3543f4){return _0x341141[_0xa7dd('0x1a')](_0x4b5022)[_0xa7dd('0x1c')](_0x3543f4);}};}function respondWithFilteredResult(_0x180806,_0x3b4c9d){return function(_0x38c495){if(_0x38c495){var _0x5cd1e9=typeof _0x3b4c9d[_0xa7dd('0x1d')]==='undefined'&&typeof _0x3b4c9d[_0xa7dd('0x1e')]===_0xa7dd('0x1f');var _0x25ebaf=_0x38c495['count'];var _0x5cf461=_0x5cd1e9?0x0:_0x3b4c9d['offset'];var _0x558a42=_0x5cd1e9?_0x38c495['count']:_0x3b4c9d['offset']+_0x3b4c9d[_0xa7dd('0x1e')];var _0x282cfb;if(_0x558a42>=_0x25ebaf){_0x558a42=_0x25ebaf;_0x282cfb=0xc8;}else{_0x282cfb=0xce;}_0x180806[_0xa7dd('0x1a')](_0x282cfb);return _0x180806[_0xa7dd('0x20')]('Content-Range',_0x5cf461+'-'+_0x558a42+'/'+_0x25ebaf)[_0xa7dd('0x1c')](_0x38c495);}return null;};}function patchUpdates(_0x3e52c3){return function(_0x330e75){try{jsonpatch[_0xa7dd('0x21')](_0x330e75,_0x3e52c3,!![]);}catch(_0x3708e7){return BPromise[_0xa7dd('0x22')](_0x3708e7);}return _0x330e75['save']();};}function saveUpdates(_0x2656dd,_0x7bb075){return function(_0x4ddb34){if(_0x4ddb34){return _0x4ddb34[_0xa7dd('0x23')](_0x2656dd)[_0xa7dd('0x24')](function(_0xb51dcd){return _0xb51dcd;});}return null;};}function removeEntity(_0x23f948,_0x3a092f){return function(_0x223bcf){if(_0x223bcf){return _0x223bcf['destroy']()[_0xa7dd('0x24')](function(){_0x23f948[_0xa7dd('0x1a')](0xcc)[_0xa7dd('0x1b')]();});}};}function handleEntityNotFound(_0x4664c6,_0x3ff226){return function(_0x13807b){if(!_0x13807b){_0x4664c6[_0xa7dd('0x19')](0x194);}return _0x13807b;};}function handleError(_0x5dbcb5,_0x49ccc5){_0x49ccc5=_0x49ccc5||0x1f4;return function(_0x514aa4){logger[_0xa7dd('0x25')](_0x514aa4[_0xa7dd('0x26')]);if(_0x514aa4[_0xa7dd('0x27')]){delete _0x514aa4[_0xa7dd('0x27')];}_0x5dbcb5[_0xa7dd('0x1a')](_0x49ccc5)[_0xa7dd('0x28')](_0x514aa4);};}exports[_0xa7dd('0x29')]=function(_0x51e886,_0x1ab9ce){var _0xd06296={},_0x2e27a0={},_0x9a2271={'count':0x0,'rows':[]};var _0x53d0cc=_['map'](db[_0xa7dd('0x2a')]['rawAttributes'],function(_0x3bffbe){return{'name':_0x3bffbe[_0xa7dd('0x2b')],'type':_0x3bffbe['type'][_0xa7dd('0x2c')]};});_0x2e27a0['model']=_[_0xa7dd('0x2d')](_0x53d0cc,_0xa7dd('0x27'));_0x2e27a0['query']=_[_0xa7dd('0x2e')](_0x51e886[_0xa7dd('0x2f')]);_0x2e27a0[_0xa7dd('0x30')]=_[_0xa7dd('0x31')](_0x2e27a0['model'],_0x2e27a0[_0xa7dd('0x2f')]);_0xd06296['attributes']=_[_0xa7dd('0x31')](_0x2e27a0['model'],qs[_0xa7dd('0x32')](_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0xd06296[_0xa7dd('0x33')]=_0xd06296[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0xd06296['attributes']:_0x2e27a0[_0xa7dd('0x35')];if(!_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x36')](_0xa7dd('0x37'))){_0xd06296['limit']=qs[_0xa7dd('0x1e')](_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x1e')]);_0xd06296[_0xa7dd('0x1d')]=qs['offset'](_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x1d')]);}_0xd06296['order']=qs[_0xa7dd('0x38')](_0x51e886['query'][_0xa7dd('0x38')]);_0xd06296[_0xa7dd('0x39')]=qs['filters'](_[_0xa7dd('0x3a')](_0x51e886[_0xa7dd('0x2f')],_0x2e27a0[_0xa7dd('0x30')]),_0x53d0cc);if(_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x3b')]){_0xd06296[_0xa7dd('0x39')]=_[_0xa7dd('0x3c')](_0xd06296['where'],{'$or':_[_0xa7dd('0x2d')](_0x53d0cc,function(_0x2b772d){if(_0x2b772d[_0xa7dd('0x3d')]!=='VIRTUAL'){var _0x1f46b9={};_0x1f46b9[_0x2b772d[_0xa7dd('0x27')]]={'$like':'%'+_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x3b')]+'%'};return _0x1f46b9;}})});}_0xd06296=_[_0xa7dd('0x3c')]({},_0xd06296,_0x51e886[_0xa7dd('0x3e')]);var _0x2d1fab={'where':_0xd06296[_0xa7dd('0x39')]};return db[_0xa7dd('0x2a')]['count'](_0x2d1fab)['then'](function(_0x55a452){_0x9a2271[_0xa7dd('0x3f')]=_0x55a452;if(_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x40')]){_0xd06296['include']=[{'all':!![]}];}return db[_0xa7dd('0x2a')][_0xa7dd('0x41')](_0xd06296);})[_0xa7dd('0x24')](function(_0x1d5c80){_0x9a2271[_0xa7dd('0x42')]=_0x1d5c80;return _0x9a2271;})['then'](respondWithFilteredResult(_0x1ab9ce,_0xd06296))[_0xa7dd('0x43')](handleError(_0x1ab9ce,null));};exports[_0xa7dd('0x44')]=function(_0x260bb1,_0x26591a){var _0x1b5e7e={'raw':![],'where':{'id':_0x260bb1[_0xa7dd('0x45')]['id']}},_0xcae7fd={};_0xcae7fd[_0xa7dd('0x35')]=_[_0xa7dd('0x2e')](db[_0xa7dd('0x2a')][_0xa7dd('0x46')]);_0xcae7fd['query']=_[_0xa7dd('0x2e')](_0x260bb1[_0xa7dd('0x2f')]);_0xcae7fd['filters']=_['intersection'](_0xcae7fd[_0xa7dd('0x35')],_0xcae7fd[_0xa7dd('0x2f')]);_0x1b5e7e[_0xa7dd('0x33')]=_[_0xa7dd('0x31')](_0xcae7fd['model'],qs[_0xa7dd('0x32')](_0x260bb1[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0x1b5e7e[_0xa7dd('0x33')]=_0x1b5e7e[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0x1b5e7e[_0xa7dd('0x33')]:_0xcae7fd['model'];if(_0x260bb1[_0xa7dd('0x2f')][_0xa7dd('0x40')]){_0x1b5e7e[_0xa7dd('0x47')]=[{'all':!![]}];}_0x1b5e7e=_['merge']({},_0x1b5e7e,_0x260bb1[_0xa7dd('0x3e')]);return db[_0xa7dd('0x2a')][_0xa7dd('0x48')](_0x1b5e7e)[_0xa7dd('0x24')](handleEntityNotFound(_0x26591a,null))[_0xa7dd('0x24')](respondWithResult(_0x26591a,null))['catch'](handleError(_0x26591a,null));};exports[_0xa7dd('0x49')]=function(_0x2f3ba9,_0x4b6761){return db[_0xa7dd('0x2a')][_0xa7dd('0x49')](_0x2f3ba9[_0xa7dd('0x4a')],{})[_0xa7dd('0x24')](respondWithResult(_0x4b6761,0xc9))[_0xa7dd('0x43')](handleError(_0x4b6761,null));};exports[_0xa7dd('0x23')]=function(_0x2d51b9,_0x47ae17){if(_0x2d51b9[_0xa7dd('0x4a')]['id']){delete _0x2d51b9[_0xa7dd('0x4a')]['id'];}return db[_0xa7dd('0x2a')][_0xa7dd('0x48')]({'where':{'id':_0x2d51b9[_0xa7dd('0x45')]['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x47ae17,null))[_0xa7dd('0x24')](saveUpdates(_0x2d51b9[_0xa7dd('0x4a')],null))[_0xa7dd('0x24')](respondWithResult(_0x47ae17,null))['catch'](handleError(_0x47ae17,null));};exports[_0xa7dd('0x4b')]=function(_0x469593,_0x2977cc){return db[_0xa7dd('0x2a')][_0xa7dd('0x48')]({'where':{'id':_0x469593[_0xa7dd('0x45')]['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x2977cc,null))[_0xa7dd('0x24')](removeEntity(_0x2977cc,null))[_0xa7dd('0x43')](handleError(_0x2977cc,null));};exports[_0xa7dd('0x4c')]=function(_0x5efb2b,_0x5c7a53,_0x1118ac){var _0x43e69e={};var _0x161ad7={};var _0x145ffd;var _0x3bffe8;return db[_0xa7dd('0x2a')]['findOne']({'where':{'id':_0x5efb2b['params']['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x5c7a53,null))[_0xa7dd('0x24')](function(_0x2b6ea5){if(_0x2b6ea5){_0x145ffd=_0x2b6ea5;_0x161ad7[_0xa7dd('0x35')]=_[_0xa7dd('0x2e')](db[_0xa7dd('0x4d')][_0xa7dd('0x46')]);_0x161ad7[_0xa7dd('0x2f')]=_['keys'](_0x5efb2b['query']);_0x161ad7[_0xa7dd('0x30')]=_[_0xa7dd('0x31')](_0x161ad7[_0xa7dd('0x35')],_0x161ad7['query']);_0x43e69e[_0xa7dd('0x33')]=_[_0xa7dd('0x31')](_0x161ad7[_0xa7dd('0x35')],qs['fields'](_0x5efb2b[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0x43e69e[_0xa7dd('0x33')]=_0x43e69e[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0x43e69e[_0xa7dd('0x33')]:_0x161ad7[_0xa7dd('0x35')];_0x43e69e[_0xa7dd('0x4e')]=qs[_0xa7dd('0x38')](_0x5efb2b['query'][_0xa7dd('0x38')]);_0x43e69e[_0xa7dd('0x39')]=qs[_0xa7dd('0x30')](_[_0xa7dd('0x3a')](_0x5efb2b[_0xa7dd('0x2f')],_0x161ad7[_0xa7dd('0x30')]));if(_0x5efb2b['query']['filter']){_0x43e69e[_0xa7dd('0x39')]=_[_0xa7dd('0x3c')](_0x43e69e[_0xa7dd('0x39')],{'$or':_[_0xa7dd('0x2d')](_0x43e69e[_0xa7dd('0x33')],function(_0x12bf76){var _0x2e32b4={};_0x2e32b4[_0x12bf76]={'$like':'%'+_0x5efb2b['query'][_0xa7dd('0x3b')]+'%'};return _0x2e32b4;})});}_0x43e69e=_[_0xa7dd('0x3c')]({},_0x43e69e,_0x5efb2b[_0xa7dd('0x3e')]);return _0x145ffd['getFields'](_0x43e69e);}})['then'](function(_0x5145f6){if(_0x5145f6){_0x3bffe8=_0x5145f6['length'];if(!_0x5efb2b[_0xa7dd('0x2f')][_0xa7dd('0x36')](_0xa7dd('0x37'))){_0x43e69e[_0xa7dd('0x1e')]=qs[_0xa7dd('0x1e')](_0x5efb2b[_0xa7dd('0x2f')][_0xa7dd('0x1e')]);_0x43e69e[_0xa7dd('0x1d')]=qs['offset'](_0x5efb2b[_0xa7dd('0x2f')][_0xa7dd('0x1d')]);}return _0x145ffd[_0xa7dd('0x4c')](_0x43e69e);}})[_0xa7dd('0x24')](function(_0x452685){if(_0x452685){return _0x452685?{'count':_0x3bffe8,'rows':_0x452685}:null;}})[_0xa7dd('0x24')](respondWithResult(_0x5c7a53,null))['catch'](handleError(_0x5c7a53,null));};exports[_0xa7dd('0x4f')]=function(_0x5d7ed6,_0x466be9,_0x23308a){var _0x4199a0={};var _0x2f0173={};var _0x14fd61;var _0x57a45c;return db[_0xa7dd('0x2a')]['findOne']({'where':{'id':_0x5d7ed6[_0xa7dd('0x45')]['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x466be9,null))[_0xa7dd('0x24')](function(_0x523eba){if(_0x523eba){_0x14fd61=_0x523eba;_0x2f0173[_0xa7dd('0x35')]=_['keys'](db[_0xa7dd('0x4d')]['rawAttributes']);_0x2f0173['query']=_[_0xa7dd('0x2e')](_0x5d7ed6[_0xa7dd('0x2f')]);_0x2f0173[_0xa7dd('0x30')]=_[_0xa7dd('0x31')](_0x2f0173[_0xa7dd('0x35')],_0x2f0173[_0xa7dd('0x2f')]);_0x4199a0[_0xa7dd('0x33')]=_[_0xa7dd('0x31')](_0x2f0173[_0xa7dd('0x35')],qs[_0xa7dd('0x32')](_0x5d7ed6[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0x4199a0[_0xa7dd('0x33')]=_0x4199a0[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0x4199a0['attributes']:_0x2f0173[_0xa7dd('0x35')];_0x4199a0[_0xa7dd('0x4e')]=qs[_0xa7dd('0x38')](_0x5d7ed6['query'][_0xa7dd('0x38')]);_0x4199a0[_0xa7dd('0x39')]=qs[_0xa7dd('0x30')](_[_0xa7dd('0x3a')](_0x5d7ed6[_0xa7dd('0x2f')],_0x2f0173[_0xa7dd('0x30')]));if(_0x5d7ed6['query']['filter']){_0x4199a0[_0xa7dd('0x39')]=_[_0xa7dd('0x3c')](_0x4199a0[_0xa7dd('0x39')],{'$or':_[_0xa7dd('0x2d')](_0x4199a0['attributes'],function(_0x81a11f){var _0x20a500={};_0x20a500[_0x81a11f]={'$like':'%'+_0x5d7ed6[_0xa7dd('0x2f')][_0xa7dd('0x3b')]+'%'};return _0x20a500;})});}_0x4199a0=_[_0xa7dd('0x3c')]({},_0x4199a0,_0x5d7ed6[_0xa7dd('0x3e')]);return _0x14fd61[_0xa7dd('0x4f')](_0x4199a0);}})['then'](function(_0x1f6a0d){if(_0x1f6a0d){_0x57a45c=_0x1f6a0d[_0xa7dd('0x34')];if(!_0x5d7ed6['query'][_0xa7dd('0x36')](_0xa7dd('0x37'))){_0x4199a0['limit']=qs[_0xa7dd('0x1e')](_0x5d7ed6[_0xa7dd('0x2f')]['limit']);_0x4199a0[_0xa7dd('0x1d')]=qs[_0xa7dd('0x1d')](_0x5d7ed6['query'][_0xa7dd('0x1d')]);}return _0x14fd61['getSubjects'](_0x4199a0);}})['then'](function(_0x31ef1a){if(_0x31ef1a){return _0x31ef1a?{'count':_0x57a45c,'rows':_0x31ef1a}:null;}})['then'](respondWithResult(_0x466be9,null))[_0xa7dd('0x43')](handleError(_0x466be9,null));};exports['getDescriptions']=function(_0x57d978,_0x5ba97e,_0x44ea1d){var _0x1a40ab={};var _0x43a4c3={};var _0x2089b3;var _0x3086e2;return db['ZohoConfiguration'][_0xa7dd('0x50')]({'where':{'id':_0x57d978[_0xa7dd('0x45')]['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x5ba97e,null))[_0xa7dd('0x24')](function(_0x832459){if(_0x832459){_0x2089b3=_0x832459;_0x43a4c3[_0xa7dd('0x35')]=_[_0xa7dd('0x2e')](db[_0xa7dd('0x4d')][_0xa7dd('0x46')]);_0x43a4c3[_0xa7dd('0x2f')]=_[_0xa7dd('0x2e')](_0x57d978[_0xa7dd('0x2f')]);_0x43a4c3[_0xa7dd('0x30')]=_['intersection'](_0x43a4c3[_0xa7dd('0x35')],_0x43a4c3['query']);_0x1a40ab[_0xa7dd('0x33')]=_['intersection'](_0x43a4c3[_0xa7dd('0x35')],qs[_0xa7dd('0x32')](_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0x1a40ab[_0xa7dd('0x33')]=_0x1a40ab[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0x1a40ab['attributes']:_0x43a4c3[_0xa7dd('0x35')];_0x1a40ab[_0xa7dd('0x4e')]=qs[_0xa7dd('0x38')](_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x38')]);_0x1a40ab[_0xa7dd('0x39')]=qs[_0xa7dd('0x30')](_['pick'](_0x57d978[_0xa7dd('0x2f')],_0x43a4c3['filters']));if(_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x3b')]){_0x1a40ab[_0xa7dd('0x39')]=_[_0xa7dd('0x3c')](_0x1a40ab[_0xa7dd('0x39')],{'$or':_[_0xa7dd('0x2d')](_0x1a40ab[_0xa7dd('0x33')],function(_0x58ae77){var _0x3d415b={};_0x3d415b[_0x58ae77]={'$like':'%'+_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x3b')]+'%'};return _0x3d415b;})});}_0x1a40ab=_[_0xa7dd('0x3c')]({},_0x1a40ab,_0x57d978[_0xa7dd('0x3e')]);return _0x2089b3['getDescriptions'](_0x1a40ab);}})[_0xa7dd('0x24')](function(_0xcf8501){if(_0xcf8501){_0x3086e2=_0xcf8501[_0xa7dd('0x34')];if(!_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x36')](_0xa7dd('0x37'))){_0x1a40ab[_0xa7dd('0x1e')]=qs['limit'](_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x1e')]);_0x1a40ab[_0xa7dd('0x1d')]=qs[_0xa7dd('0x1d')](_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x1d')]);}return _0x2089b3[_0xa7dd('0x51')](_0x1a40ab);}})['then'](function(_0x1fcacd){if(_0x1fcacd){return _0x1fcacd?{'count':_0x3086e2,'rows':_0x1fcacd}:null;}})[_0xa7dd('0x24')](respondWithResult(_0x5ba97e,null))[_0xa7dd('0x43')](handleError(_0x5ba97e,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 9744e86..ee8addb 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 _0x1077=['../../config/environment','exports','ZohoConfiguration','int_zoho_configurations','lodash','api','moment','bluebird','path','rimraf'];(function(_0x541737,_0x423e2c){var _0x1b3276=function(_0x5bfbdf){while(--_0x5bfbdf){_0x541737['push'](_0x541737['shift']());}};_0x1b3276(++_0x423e2c);}(_0x1077,0x176));var _0x7107=function(_0x28a7ee,_0x1c6dd3){_0x28a7ee=_0x28a7ee-0x0;var _0x9314a6=_0x1077[_0x28a7ee];return _0x9314a6;};'use strict';var _=require(_0x7107('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7107('0x1'));var moment=require(_0x7107('0x2'));var BPromise=require(_0x7107('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7107('0x4'));var rimraf=require(_0x7107('0x5'));var config=require(_0x7107('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x7107('0x7')]=function(_0x2fee11,_0x57391b){return _0x2fee11['define'](_0x7107('0x8'),attributes,{'tableName':_0x7107('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef50=['int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x335c8f,_0x574dad){var _0x431a00=function(_0x37c51a){while(--_0x37c51a){_0x335c8f['push'](_0x335c8f['shift']());}};_0x431a00(++_0x574dad);}(_0xef50,0x1e1));var _0x0ef5=function(_0x33e4b3,_0x50ff13){_0x33e4b3=_0x33e4b3-0x0;var _0x35b852=_0xef50[_0x33e4b3];return _0x35b852;};'use strict';var _=require(_0x0ef5('0x0'));var util=require(_0x0ef5('0x1'));var logger=require(_0x0ef5('0x2'))('api');var moment=require(_0x0ef5('0x3'));var BPromise=require(_0x0ef5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ef5('0x5'));var rimraf=require(_0x0ef5('0x6'));var config=require(_0x0ef5('0x7'));var attributes=require(_0x0ef5('0x8'));module['exports']=function(_0x44c651,_0x256edd){return _0x44c651[_0x0ef5('0x9')](_0x0ef5('0xa'),attributes,{'tableName':_0x0ef5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index a582831..6ef7a44 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 _0x0c6d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x5151eb,_0x1f5041){var _0x1cce82=function(_0x323c34){while(--_0x323c34){_0x5151eb['push'](_0x5151eb['shift']());}};_0x1cce82(++_0x1f5041);}(_0x0c6d,0x1f3));var _0xd0c6=function(_0x3cc5f5,_0x16da68){_0x3cc5f5=_0x3cc5f5-0x0;var _0x2a3932=_0x0c6d[_0x3cc5f5];return _0x2a3932;};'use strict';var _=require(_0xd0c6('0x0'));var util=require(_0xd0c6('0x1'));var moment=require(_0xd0c6('0x2'));var BPromise=require(_0xd0c6('0x3'));var rs=require(_0xd0c6('0x4'));var fs=require('fs');var Redis=require(_0xd0c6('0x5'));var db=require(_0xd0c6('0x6'))['db'];var utils=require(_0xd0c6('0x7'));var logger=require(_0xd0c6('0x8'))('rpc');var config=require(_0xd0c6('0x9'));var jayson=require(_0xd0c6('0xa'));var client=jayson[_0xd0c6('0xb')][_0xd0c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x331fc7,_0xc8f066,_0x5be322){return new BPromise(function(_0x6babfb,_0x4ed95c){return client[_0xd0c6('0xd')](_0x331fc7,_0x5be322)[_0xd0c6('0xe')](function(_0x598bcd){logger[_0xd0c6('0xf')](_0xd0c6('0x10'),_0xc8f066,_0xd0c6('0x11'));logger[_0xd0c6('0x12')](_0xd0c6('0x13'),_0xc8f066,'request\x20sent',JSON['stringify'](_0x598bcd));if(_0x598bcd[_0xd0c6('0x14')]){if(_0x598bcd[_0xd0c6('0x14')][_0xd0c6('0x15')]===0x1f4){logger[_0xd0c6('0x14')](_0xd0c6('0x10'),_0xc8f066,_0x598bcd['error']['message']);return _0x4ed95c(_0x598bcd['error']['message']);}logger[_0xd0c6('0x14')](_0xd0c6('0x10'),_0xc8f066,_0x598bcd[_0xd0c6('0x14')][_0xd0c6('0x16')]);return _0x6babfb(_0x598bcd[_0xd0c6('0x14')][_0xd0c6('0x16')]);}else{logger[_0xd0c6('0xf')](_0xd0c6('0x10'),_0xc8f066,_0xd0c6('0x11'));_0x6babfb(_0x598bcd[_0xd0c6('0x17')][_0xd0c6('0x16')]);}})[_0xd0c6('0x18')](function(_0xdd542d){logger[_0xd0c6('0x14')](_0xd0c6('0x10'),_0xc8f066,_0xdd542d);_0x4ed95c(_0xdd542d);});});} \ No newline at end of file +var _0x5cac=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x5cac,0x6e));var _0xc5ca=function(_0x18e0d5,_0x1f7f3a){_0x18e0d5=_0x18e0d5-0x0;var _0x3b00bb=_0x5cac[_0x18e0d5];return _0x3b00bb;};'use strict';var _=require(_0xc5ca('0x0'));var util=require(_0xc5ca('0x1'));var moment=require(_0xc5ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5ca('0x3'));var db=require(_0xc5ca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5ca('0x5'))(_0xc5ca('0x6'));var config=require(_0xc5ca('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc5ca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14cc96,_0x2fa982,_0x27f4b2){return new BPromise(function(_0x8e80b0,_0x57e28f){return client[_0xc5ca('0x9')](_0x14cc96,_0x27f4b2)[_0xc5ca('0xa')](function(_0x41621e){logger[_0xc5ca('0xb')](_0xc5ca('0xc'),_0x2fa982,_0xc5ca('0xd'));logger[_0xc5ca('0xe')](_0xc5ca('0xf'),_0x2fa982,_0xc5ca('0xd'),JSON['stringify'](_0x41621e));if(_0x41621e[_0xc5ca('0x10')]){if(_0x41621e[_0xc5ca('0x10')][_0xc5ca('0x11')]===0x1f4){logger[_0xc5ca('0x10')](_0xc5ca('0xc'),_0x2fa982,_0x41621e['error']['message']);return _0x57e28f(_0x41621e[_0xc5ca('0x10')]['message']);}logger['error'](_0xc5ca('0xc'),_0x2fa982,_0x41621e[_0xc5ca('0x10')][_0xc5ca('0x12')]);return _0x8e80b0(_0x41621e[_0xc5ca('0x10')]['message']);}else{logger[_0xc5ca('0xb')](_0xc5ca('0xc'),_0x2fa982,'request\x20sent');_0x8e80b0(_0x41621e[_0xc5ca('0x13')][_0xc5ca('0x12')]);}})['catch'](function(_0x5e100e){logger['error'](_0xc5ca('0xc'),_0x2fa982,_0x5e100e);_0x57e28f(_0x5e100e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 80f34eb..dd50f8e 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 _0x7e20=['post','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3f7d29,_0x3a99c7){var _0x29047e=function(_0x58a3be){while(--_0x58a3be){_0x3f7d29['push'](_0x3f7d29['shift']());}};_0x29047e(++_0x3a99c7);}(_0x7e20,0x1ec));var _0x07e2=function(_0x242de2,_0x5e5933){_0x242de2=_0x242de2-0x0;var _0x2d0eee=_0x7e20[_0x242de2];return _0x2d0eee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x07e2('0x0'));var timeout=require('connect-timeout');var express=require(_0x07e2('0x1'));var router=express[_0x07e2('0x2')]();var fs_extra=require(_0x07e2('0x3'));var auth=require(_0x07e2('0x4'));var interaction=require(_0x07e2('0x5'));var config=require(_0x07e2('0x6'));var controller=require('./intZohoField.controller');router[_0x07e2('0x7')]('/',auth[_0x07e2('0x8')](),controller[_0x07e2('0x9')]);router[_0x07e2('0x7')](_0x07e2('0xa'),auth[_0x07e2('0x8')](),controller[_0x07e2('0xb')]);router[_0x07e2('0xc')]('/',auth[_0x07e2('0x8')](),controller['create']);router[_0x07e2('0xd')](_0x07e2('0xa'),auth[_0x07e2('0x8')](),controller[_0x07e2('0xe')]);router[_0x07e2('0xf')](_0x07e2('0xa'),auth[_0x07e2('0x8')](),controller[_0x07e2('0x10')]);module[_0x07e2('0x11')]=router; \ No newline at end of file +var _0xe5ca=['../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x19fd2c,_0x4839d6){var _0x2621a7=function(_0x56c8c8){while(--_0x56c8c8){_0x19fd2c['push'](_0x19fd2c['shift']());}};_0x2621a7(++_0x4839d6);}(_0xe5ca,0x7d));var _0xae5c=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0xe5ca[_0x3ef2d5];return _0x2fefb2;};'use strict';var multer=require(_0xae5c('0x0'));var util=require(_0xae5c('0x1'));var path=require(_0xae5c('0x2'));var timeout=require(_0xae5c('0x3'));var express=require(_0xae5c('0x4'));var router=express[_0xae5c('0x5')]();var fs_extra=require(_0xae5c('0x6'));var auth=require(_0xae5c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae5c('0x8'));var controller=require(_0xae5c('0x9'));router['get']('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0xb')]);router[_0xae5c('0xc')](_0xae5c('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xae5c('0xe')]('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0xf')]);router[_0xae5c('0x10')](_0xae5c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xae5c('0x11')](_0xae5c('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xae5c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2f7b868..75d4165 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 _0x9903=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9903,0xf7));var _0x3990=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9903[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3990('0x0')]={'type':{'type':Sequelize[_0x3990('0x1')](_0x3990('0x2'),_0x3990('0x3'),'customVariable',_0x3990('0x4'),_0x3990('0x5')),'defaultValue':_0x3990('0x2')},'content':{'type':Sequelize[_0x3990('0x6')]},'key':{'type':Sequelize[_0x3990('0x6')]},'keyType':{'type':Sequelize[_0x3990('0x1')](_0x3990('0x2'),_0x3990('0x3'),_0x3990('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3990('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3990('0x6')]}}; \ No newline at end of file +var _0xe252=['keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x1e61c4,_0x196edd){var _0x162df7=function(_0x396175){while(--_0x396175){_0x1e61c4['push'](_0x1e61c4['shift']());}};_0x162df7(++_0x196edd);}(_0xe252,0xd7));var _0x2e25=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xe252[_0x1e4a8e];return _0x5408f9;};'use strict';var Sequelize=require(_0x2e25('0x0'));module[_0x2e25('0x1')]={'type':{'type':Sequelize[_0x2e25('0x2')](_0x2e25('0x3'),'variable',_0x2e25('0x4'),_0x2e25('0x5'),_0x2e25('0x6')),'defaultValue':_0x2e25('0x3')},'content':{'type':Sequelize[_0x2e25('0x7')]},'key':{'type':Sequelize[_0x2e25('0x7')]},'keyType':{'type':Sequelize[_0x2e25('0x2')](_0x2e25('0x3'),_0x2e25('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2e25('0x7')]},'customField':{'type':Sequelize[_0x2e25('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ef66817..bc041dd 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 _0x1403=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','then','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x497d39,_0x2fef30){var _0x4a9d8f=function(_0x98eaa4){while(--_0x98eaa4){_0x497d39['push'](_0x497d39['shift']());}};_0x4a9d8f(++_0x2fef30);}(_0x1403,0xcb));var _0x3140=function(_0x24682f,_0x30b2d0){_0x24682f=_0x24682f-0x0;var _0x413f07=_0x1403[_0x24682f];return _0x413f07;};'use strict';var emlformat=require(_0x3140('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3140('0x1'));var jsonpatch=require(_0x3140('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3140('0x3'));var Mustache=require(_0x3140('0x4'));var util=require(_0x3140('0x5'));var path=require(_0x3140('0x6'));var sox=require('sox');var csv=require(_0x3140('0x7'));var ejs=require(_0x3140('0x8'));var fs=require('fs');var fs_extra=require(_0x3140('0x9'));var _=require(_0x3140('0xa'));var squel=require(_0x3140('0xb'));var crypto=require(_0x3140('0xc'));var jsforce=require(_0x3140('0xd'));var deskjs=require(_0x3140('0xe'));var toCsv=require(_0x3140('0x7'));var querystring=require(_0x3140('0xf'));var Papa=require(_0x3140('0x10'));var Redis=require('ioredis');var authService=require(_0x3140('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3140('0x12'));var logger=require(_0x3140('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3140('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3140('0x15'))['db'];function respondWithStatusCode(_0x14394e,_0x54d976){_0x54d976=_0x54d976||0xcc;return function(_0x3ebcad){if(_0x3ebcad){return _0x14394e[_0x3140('0x16')](_0x54d976);}return _0x14394e['status'](_0x54d976)[_0x3140('0x17')]();};}function respondWithResult(_0x53c5bc,_0x1ae863){_0x1ae863=_0x1ae863||0xc8;return function(_0x8d0a42){if(_0x8d0a42){return _0x53c5bc[_0x3140('0x18')](_0x1ae863)[_0x3140('0x19')](_0x8d0a42);}};}function respondWithFilteredResult(_0x2c568,_0x4d595f){return function(_0x5ce508){if(_0x5ce508){var _0x3b2f07=typeof _0x4d595f[_0x3140('0x1a')]===_0x3140('0x1b')&&typeof _0x4d595f['limit']==='undefined';var _0xad1f72=_0x5ce508[_0x3140('0x1c')];var _0x207a74=_0x3b2f07?0x0:_0x4d595f[_0x3140('0x1a')];var _0x2af2bd=_0x3b2f07?_0x5ce508['count']:_0x4d595f[_0x3140('0x1a')]+_0x4d595f[_0x3140('0x1d')];var _0x40435e;if(_0x2af2bd>=_0xad1f72){_0x2af2bd=_0xad1f72;_0x40435e=0xc8;}else{_0x40435e=0xce;}_0x2c568['status'](_0x40435e);return _0x2c568[_0x3140('0x1e')](_0x3140('0x1f'),_0x207a74+'-'+_0x2af2bd+'/'+_0xad1f72)['json'](_0x5ce508);}return null;};}function patchUpdates(_0x125a5d){return function(_0x5491f0){try{jsonpatch['apply'](_0x5491f0,_0x125a5d,!![]);}catch(_0x40053e){return BPromise['reject'](_0x40053e);}return _0x5491f0[_0x3140('0x20')]();};}function saveUpdates(_0x3992cf,_0xa57576){return function(_0x50ce69){if(_0x50ce69){return _0x50ce69[_0x3140('0x21')](_0x3992cf)['then'](function(_0x267de1){return _0x267de1;});}return null;};}function removeEntity(_0xc8f5f4,_0x1f0012){return function(_0x4ad039){if(_0x4ad039){return _0x4ad039[_0x3140('0x22')]()[_0x3140('0x23')](function(){_0xc8f5f4[_0x3140('0x18')](0xcc)[_0x3140('0x17')]();});}};}function handleEntityNotFound(_0x26cb32,_0xedaa59){return function(_0x5a8673){if(!_0x5a8673){_0x26cb32[_0x3140('0x16')](0x194);}return _0x5a8673;};}function handleError(_0x97a50b,_0x2443d8){_0x2443d8=_0x2443d8||0x1f4;return function(_0x6de314){logger[_0x3140('0x24')](_0x6de314[_0x3140('0x25')]);if(_0x6de314[_0x3140('0x26')]){delete _0x6de314[_0x3140('0x26')];}_0x97a50b[_0x3140('0x18')](_0x2443d8)[_0x3140('0x27')](_0x6de314);};}exports['index']=function(_0x4f8c40,_0x4d1e95){var _0x363724={},_0x75f177={},_0x16c23c={'count':0x0,'rows':[]};var _0x2aef83=_[_0x3140('0x28')](db[_0x3140('0x29')][_0x3140('0x2a')],function(_0xfe8187){return{'name':_0xfe8187[_0x3140('0x2b')],'type':_0xfe8187[_0x3140('0x2c')][_0x3140('0x2d')]};});_0x75f177['model']=_[_0x3140('0x28')](_0x2aef83,_0x3140('0x26'));_0x75f177['query']=_[_0x3140('0x2e')](_0x4f8c40[_0x3140('0x2f')]);_0x75f177[_0x3140('0x30')]=_[_0x3140('0x31')](_0x75f177['model'],_0x75f177['query']);_0x363724[_0x3140('0x32')]=_[_0x3140('0x31')](_0x75f177[_0x3140('0x33')],qs['fields'](_0x4f8c40[_0x3140('0x2f')][_0x3140('0x34')]));_0x363724[_0x3140('0x32')]=_0x363724['attributes']['length']?_0x363724['attributes']:_0x75f177['model'];if(!_0x4f8c40['query'][_0x3140('0x35')](_0x3140('0x36'))){_0x363724[_0x3140('0x1d')]=qs[_0x3140('0x1d')](_0x4f8c40[_0x3140('0x2f')][_0x3140('0x1d')]);_0x363724[_0x3140('0x1a')]=qs[_0x3140('0x1a')](_0x4f8c40[_0x3140('0x2f')][_0x3140('0x1a')]);}_0x363724[_0x3140('0x37')]=qs[_0x3140('0x38')](_0x4f8c40['query'][_0x3140('0x38')]);_0x363724[_0x3140('0x39')]=qs[_0x3140('0x30')](_[_0x3140('0x3a')](_0x4f8c40['query'],_0x75f177['filters']),_0x2aef83);if(_0x4f8c40[_0x3140('0x2f')][_0x3140('0x3b')]){_0x363724[_0x3140('0x39')]=_[_0x3140('0x3c')](_0x363724[_0x3140('0x39')],{'$or':_[_0x3140('0x28')](_0x2aef83,function(_0x4b0eab){if(_0x4b0eab[_0x3140('0x2c')]!=='VIRTUAL'){var _0xde24b3={};_0xde24b3[_0x4b0eab[_0x3140('0x26')]]={'$like':'%'+_0x4f8c40[_0x3140('0x2f')][_0x3140('0x3b')]+'%'};return _0xde24b3;}})});}_0x363724=_[_0x3140('0x3c')]({},_0x363724,_0x4f8c40['options']);var _0x30d5c1={'where':_0x363724['where']};return db['ZohoField']['count'](_0x30d5c1)[_0x3140('0x23')](function(_0x4b0f0b){_0x16c23c[_0x3140('0x1c')]=_0x4b0f0b;if(_0x4f8c40[_0x3140('0x2f')][_0x3140('0x3d')]){_0x363724[_0x3140('0x3e')]=[{'all':!![]}];}return db[_0x3140('0x29')][_0x3140('0x3f')](_0x363724);})['then'](function(_0x75e37c){_0x16c23c['rows']=_0x75e37c;return _0x16c23c;})[_0x3140('0x23')](respondWithFilteredResult(_0x4d1e95,_0x363724))[_0x3140('0x40')](handleError(_0x4d1e95,null));};exports[_0x3140('0x41')]=function(_0x2019b4,_0x33fb39){var _0x13cfe8={'raw':!![],'where':{'id':_0x2019b4[_0x3140('0x42')]['id']}},_0x4cd778={};_0x4cd778[_0x3140('0x33')]=_[_0x3140('0x2e')](db[_0x3140('0x29')][_0x3140('0x2a')]);_0x4cd778[_0x3140('0x2f')]=_['keys'](_0x2019b4[_0x3140('0x2f')]);_0x4cd778[_0x3140('0x30')]=_[_0x3140('0x31')](_0x4cd778[_0x3140('0x33')],_0x4cd778[_0x3140('0x2f')]);_0x13cfe8[_0x3140('0x32')]=_[_0x3140('0x31')](_0x4cd778[_0x3140('0x33')],qs[_0x3140('0x34')](_0x2019b4['query'][_0x3140('0x34')]));_0x13cfe8['attributes']=_0x13cfe8[_0x3140('0x32')]['length']?_0x13cfe8[_0x3140('0x32')]:_0x4cd778[_0x3140('0x33')];if(_0x2019b4[_0x3140('0x2f')][_0x3140('0x3d')]){_0x13cfe8[_0x3140('0x3e')]=[{'all':!![]}];}_0x13cfe8=_[_0x3140('0x3c')]({},_0x13cfe8,_0x2019b4[_0x3140('0x43')]);return db[_0x3140('0x29')][_0x3140('0x44')](_0x13cfe8)[_0x3140('0x23')](handleEntityNotFound(_0x33fb39,null))[_0x3140('0x23')](respondWithResult(_0x33fb39,null))[_0x3140('0x40')](handleError(_0x33fb39,null));};exports[_0x3140('0x45')]=function(_0x1a14a5,_0x577d2e){return db[_0x3140('0x29')][_0x3140('0x45')](_0x1a14a5['body'],{})[_0x3140('0x23')](respondWithResult(_0x577d2e,0xc9))['catch'](handleError(_0x577d2e,null));};exports[_0x3140('0x21')]=function(_0x471ae4,_0x39a01d){if(_0x471ae4['body']['id']){delete _0x471ae4[_0x3140('0x46')]['id'];}return db['ZohoField'][_0x3140('0x44')]({'where':{'id':_0x471ae4[_0x3140('0x42')]['id']}})[_0x3140('0x23')](handleEntityNotFound(_0x39a01d,null))[_0x3140('0x23')](saveUpdates(_0x471ae4[_0x3140('0x46')],null))['then'](respondWithResult(_0x39a01d,null))[_0x3140('0x40')](handleError(_0x39a01d,null));};exports[_0x3140('0x22')]=function(_0x136785,_0x373c80){return db[_0x3140('0x29')][_0x3140('0x44')]({'where':{'id':_0x136785[_0x3140('0x42')]['id']}})[_0x3140('0x23')](handleEntityNotFound(_0x373c80,null))[_0x3140('0x23')](removeEntity(_0x373c80,null))[_0x3140('0x40')](handleError(_0x373c80,null));}; \ No newline at end of file +var _0x7f93=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','limit','Content-Range','reject','update','then','destroy','status','sendStatus','stack','name','send','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x37235e,_0x42ee4a){var _0x741b7=function(_0x587629){while(--_0x587629){_0x37235e['push'](_0x37235e['shift']());}};_0x741b7(++_0x42ee4a);}(_0x7f93,0x1a6));var _0x37f9=function(_0x3be7fd,_0x322c09){_0x3be7fd=_0x3be7fd-0x0;var _0x25462a=_0x7f93[_0x3be7fd];return _0x25462a;};'use strict';var emlformat=require(_0x37f9('0x0'));var rimraf=require(_0x37f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37f9('0x2'));var rp=require(_0x37f9('0x3'));var moment=require(_0x37f9('0x4'));var BPromise=require(_0x37f9('0x5'));var Mustache=require(_0x37f9('0x6'));var util=require(_0x37f9('0x7'));var path=require(_0x37f9('0x8'));var sox=require(_0x37f9('0x9'));var csv=require(_0x37f9('0xa'));var ejs=require(_0x37f9('0xb'));var fs=require('fs');var fs_extra=require(_0x37f9('0xc'));var _=require('lodash');var squel=require(_0x37f9('0xd'));var crypto=require(_0x37f9('0xe'));var jsforce=require(_0x37f9('0xf'));var deskjs=require(_0x37f9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x37f9('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37f9('0x12'));var qs=require(_0x37f9('0x13'));var as=require(_0x37f9('0x14'));var hardwareService=require(_0x37f9('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x37f9('0x16'));var config=require(_0x37f9('0x17'));var licenseUtil=require(_0x37f9('0x18'));var db=require(_0x37f9('0x19'))['db'];function respondWithStatusCode(_0x26a912,_0x53d23d){_0x53d23d=_0x53d23d||0xcc;return function(_0x2675ca){if(_0x2675ca){return _0x26a912['sendStatus'](_0x53d23d);}return _0x26a912['status'](_0x53d23d)[_0x37f9('0x1a')]();};}function respondWithResult(_0x1865ba,_0x569f54){_0x569f54=_0x569f54||0xc8;return function(_0xa8c07c){if(_0xa8c07c){return _0x1865ba['status'](_0x569f54)[_0x37f9('0x1b')](_0xa8c07c);}};}function respondWithFilteredResult(_0x2f93e8,_0x3ac8b6){return function(_0x4b547f){if(_0x4b547f){var _0xeff21e=typeof _0x3ac8b6['offset']===_0x37f9('0x1c')&&typeof _0x3ac8b6['limit']===_0x37f9('0x1c');var _0x5430fc=_0x4b547f[_0x37f9('0x1d')];var _0x4bb90c=_0xeff21e?0x0:_0x3ac8b6[_0x37f9('0x1e')];var _0x8d9882=_0xeff21e?_0x4b547f[_0x37f9('0x1d')]:_0x3ac8b6[_0x37f9('0x1e')]+_0x3ac8b6[_0x37f9('0x1f')];var _0x333fc2;if(_0x8d9882>=_0x5430fc){_0x8d9882=_0x5430fc;_0x333fc2=0xc8;}else{_0x333fc2=0xce;}_0x2f93e8['status'](_0x333fc2);return _0x2f93e8['set'](_0x37f9('0x20'),_0x4bb90c+'-'+_0x8d9882+'/'+_0x5430fc)[_0x37f9('0x1b')](_0x4b547f);}return null;};}function patchUpdates(_0x53e02){return function(_0x5e1d80){try{jsonpatch['apply'](_0x5e1d80,_0x53e02,!![]);}catch(_0x3b7afe){return BPromise[_0x37f9('0x21')](_0x3b7afe);}return _0x5e1d80['save']();};}function saveUpdates(_0x25c189,_0x382156){return function(_0xe3a76a){if(_0xe3a76a){return _0xe3a76a[_0x37f9('0x22')](_0x25c189)[_0x37f9('0x23')](function(_0x80bfe7){return _0x80bfe7;});}return null;};}function removeEntity(_0x5ae1e5,_0x8f8be7){return function(_0x284cb3){if(_0x284cb3){return _0x284cb3[_0x37f9('0x24')]()[_0x37f9('0x23')](function(){_0x5ae1e5[_0x37f9('0x25')](0xcc)[_0x37f9('0x1a')]();});}};}function handleEntityNotFound(_0xcb4d5,_0x436f87){return function(_0x34fc44){if(!_0x34fc44){_0xcb4d5[_0x37f9('0x26')](0x194);}return _0x34fc44;};}function handleError(_0x475034,_0x4b3427){_0x4b3427=_0x4b3427||0x1f4;return function(_0x4d9e60){logger['error'](_0x4d9e60[_0x37f9('0x27')]);if(_0x4d9e60[_0x37f9('0x28')]){delete _0x4d9e60[_0x37f9('0x28')];}_0x475034[_0x37f9('0x25')](_0x4b3427)[_0x37f9('0x29')](_0x4d9e60);};}exports['index']=function(_0x1e2e11,_0x5f2f3e){var _0x16bab3={},_0x5c9dfb={},_0x5bc787={'count':0x0,'rows':[]};var _0x514039=_[_0x37f9('0x2a')](db[_0x37f9('0x2b')][_0x37f9('0x2c')],function(_0x7e4edc){return{'name':_0x7e4edc[_0x37f9('0x2d')],'type':_0x7e4edc['type'][_0x37f9('0x2e')]};});_0x5c9dfb[_0x37f9('0x2f')]=_[_0x37f9('0x2a')](_0x514039,_0x37f9('0x28'));_0x5c9dfb[_0x37f9('0x30')]=_[_0x37f9('0x31')](_0x1e2e11[_0x37f9('0x30')]);_0x5c9dfb['filters']=_['intersection'](_0x5c9dfb['model'],_0x5c9dfb[_0x37f9('0x30')]);_0x16bab3[_0x37f9('0x32')]=_[_0x37f9('0x33')](_0x5c9dfb[_0x37f9('0x2f')],qs[_0x37f9('0x34')](_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x34')]));_0x16bab3[_0x37f9('0x32')]=_0x16bab3[_0x37f9('0x32')][_0x37f9('0x35')]?_0x16bab3[_0x37f9('0x32')]:_0x5c9dfb[_0x37f9('0x2f')];if(!_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x36')](_0x37f9('0x37'))){_0x16bab3['limit']=qs[_0x37f9('0x1f')](_0x1e2e11[_0x37f9('0x30')]['limit']);_0x16bab3[_0x37f9('0x1e')]=qs[_0x37f9('0x1e')](_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x1e')]);}_0x16bab3[_0x37f9('0x38')]=qs[_0x37f9('0x39')](_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x39')]);_0x16bab3['where']=qs[_0x37f9('0x3a')](_[_0x37f9('0x3b')](_0x1e2e11[_0x37f9('0x30')],_0x5c9dfb[_0x37f9('0x3a')]),_0x514039);if(_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x3c')]){_0x16bab3[_0x37f9('0x3d')]=_[_0x37f9('0x3e')](_0x16bab3[_0x37f9('0x3d')],{'$or':_[_0x37f9('0x2a')](_0x514039,function(_0x9a8c21){if(_0x9a8c21[_0x37f9('0x3f')]!==_0x37f9('0x40')){var _0x51fdf0={};_0x51fdf0[_0x9a8c21[_0x37f9('0x28')]]={'$like':'%'+_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x3c')]+'%'};return _0x51fdf0;}})});}_0x16bab3=_[_0x37f9('0x3e')]({},_0x16bab3,_0x1e2e11[_0x37f9('0x41')]);var _0x59b784={'where':_0x16bab3[_0x37f9('0x3d')]};return db[_0x37f9('0x2b')][_0x37f9('0x1d')](_0x59b784)[_0x37f9('0x23')](function(_0x1e9940){_0x5bc787['count']=_0x1e9940;if(_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x42')]){_0x16bab3[_0x37f9('0x43')]=[{'all':!![]}];}return db[_0x37f9('0x2b')][_0x37f9('0x44')](_0x16bab3);})[_0x37f9('0x23')](function(_0x41260d){_0x5bc787['rows']=_0x41260d;return _0x5bc787;})[_0x37f9('0x23')](respondWithFilteredResult(_0x5f2f3e,_0x16bab3))[_0x37f9('0x45')](handleError(_0x5f2f3e,null));};exports['show']=function(_0x328c73,_0x549f1a){var _0x174ff7={'raw':!![],'where':{'id':_0x328c73[_0x37f9('0x46')]['id']}},_0x3a0a57={};_0x3a0a57['model']=_['keys'](db[_0x37f9('0x2b')][_0x37f9('0x2c')]);_0x3a0a57[_0x37f9('0x30')]=_[_0x37f9('0x31')](_0x328c73[_0x37f9('0x30')]);_0x3a0a57[_0x37f9('0x3a')]=_[_0x37f9('0x33')](_0x3a0a57[_0x37f9('0x2f')],_0x3a0a57['query']);_0x174ff7[_0x37f9('0x32')]=_['intersection'](_0x3a0a57[_0x37f9('0x2f')],qs[_0x37f9('0x34')](_0x328c73[_0x37f9('0x30')][_0x37f9('0x34')]));_0x174ff7[_0x37f9('0x32')]=_0x174ff7['attributes']['length']?_0x174ff7[_0x37f9('0x32')]:_0x3a0a57[_0x37f9('0x2f')];if(_0x328c73['query'][_0x37f9('0x42')]){_0x174ff7['include']=[{'all':!![]}];}_0x174ff7=_['merge']({},_0x174ff7,_0x328c73[_0x37f9('0x41')]);return db[_0x37f9('0x2b')][_0x37f9('0x47')](_0x174ff7)[_0x37f9('0x23')](handleEntityNotFound(_0x549f1a,null))[_0x37f9('0x23')](respondWithResult(_0x549f1a,null))['catch'](handleError(_0x549f1a,null));};exports[_0x37f9('0x48')]=function(_0x30d959,_0x58db79){return db[_0x37f9('0x2b')][_0x37f9('0x48')](_0x30d959[_0x37f9('0x49')],{})[_0x37f9('0x23')](respondWithResult(_0x58db79,0xc9))[_0x37f9('0x45')](handleError(_0x58db79,null));};exports['update']=function(_0x2901bf,_0x3ad236){if(_0x2901bf[_0x37f9('0x49')]['id']){delete _0x2901bf['body']['id'];}return db[_0x37f9('0x2b')][_0x37f9('0x47')]({'where':{'id':_0x2901bf[_0x37f9('0x46')]['id']}})[_0x37f9('0x23')](handleEntityNotFound(_0x3ad236,null))[_0x37f9('0x23')](saveUpdates(_0x2901bf['body'],null))[_0x37f9('0x23')](respondWithResult(_0x3ad236,null))[_0x37f9('0x45')](handleError(_0x3ad236,null));};exports[_0x37f9('0x24')]=function(_0x44eef0,_0x3ac83e){return db[_0x37f9('0x2b')][_0x37f9('0x47')]({'where':{'id':_0x44eef0['params']['id']}})[_0x37f9('0x23')](handleEntityNotFound(_0x3ac83e,null))[_0x37f9('0x23')](removeEntity(_0x3ac83e,null))[_0x37f9('0x45')](handleError(_0x3ac83e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 52ff722..07f4a29 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 _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x57fbc8,_0x5f1746){var _0xfcf1de=function(_0x368e6e){while(--_0x368e6e){_0x57fbc8['push'](_0x57fbc8['shift']());}};_0xfcf1de(++_0x5f1746);}(_0x2a07,0x74));var _0x72a0=function(_0x2c0312,_0x2be972){_0x2c0312=_0x2c0312-0x0;var _0x46222d=_0x2a07[_0x2c0312];return _0x46222d;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xf'),_0x72a0('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68b3=['../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4e2582,_0x22633d){var _0x2341fb=function(_0x2744c9){while(--_0x2744c9){_0x4e2582['push'](_0x4e2582['shift']());}};_0x2341fb(++_0x22633d);}(_0x68b3,0x1d8));var _0x368b=function(_0x558874,_0x5d16fc){_0x558874=_0x558874-0x0;var _0x5f56b9=_0x68b3[_0x558874];return _0x5f56b9;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./intZohoField.attributes');module[_0x368b('0x9')]=function(_0x41b15b,_0x104dad){return _0x41b15b[_0x368b('0xa')](_0x368b('0xb'),attributes,{'tableName':_0x368b('0xc'),'paranoid':![],'indexes':[{'name':_0x368b('0xd'),'fields':[_0x368b('0xe'),_0x368b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 819a567..a58c5b1 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 _0xcc76=['error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc76,0xea));var _0x6cc7=function(_0x4764b8,_0xec22f5){_0x4764b8=_0x4764b8-0x0;var _0x2f8329=_0xcc76[_0x4764b8];return _0x2f8329;};'use strict';var _=require(_0x6cc7('0x0'));var util=require(_0x6cc7('0x1'));var moment=require('moment');var BPromise=require(_0x6cc7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6cc7('0x3'));var db=require(_0x6cc7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6cc7('0x5'))(_0x6cc7('0x6'));var config=require(_0x6cc7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6cc7('0x8')][_0x6cc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14c305,_0x48f61a,_0x28a642){return new BPromise(function(_0x409360,_0x44dc86){return client[_0x6cc7('0xa')](_0x14c305,_0x28a642)[_0x6cc7('0xb')](function(_0x407f58){logger[_0x6cc7('0xc')](_0x6cc7('0xd'),_0x48f61a,_0x6cc7('0xe'));logger[_0x6cc7('0xf')](_0x6cc7('0x10'),_0x48f61a,'request\x20sent',JSON[_0x6cc7('0x11')](_0x407f58));if(_0x407f58['error']){if(_0x407f58[_0x6cc7('0x12')]['code']===0x1f4){logger['error'](_0x6cc7('0xd'),_0x48f61a,_0x407f58[_0x6cc7('0x12')][_0x6cc7('0x13')]);return _0x44dc86(_0x407f58['error'][_0x6cc7('0x13')]);}logger[_0x6cc7('0x12')](_0x6cc7('0xd'),_0x48f61a,_0x407f58[_0x6cc7('0x12')]['message']);return _0x409360(_0x407f58['error'][_0x6cc7('0x13')]);}else{logger['info'](_0x6cc7('0xd'),_0x48f61a,_0x6cc7('0xe'));_0x409360(_0x407f58[_0x6cc7('0x14')][_0x6cc7('0x13')]);}})['catch'](function(_0x41f153){logger['error'](_0x6cc7('0xd'),_0x48f61a,_0x41f153);_0x44dc86(_0x41f153);});});} \ No newline at end of file +var _0x2598=['client','request','then','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','lodash','util','moment','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x5ee507,_0x59e998){var _0x223caf=function(_0x39bfad){while(--_0x39bfad){_0x5ee507['push'](_0x5ee507['shift']());}};_0x223caf(++_0x59e998);}(_0x2598,0x197));var _0x8259=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0x2598[_0x385fed];return _0x52fa25;};'use strict';var _=require(_0x8259('0x0'));var util=require(_0x8259('0x1'));var moment=require(_0x8259('0x2'));var BPromise=require('bluebird');var rs=require(_0x8259('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8259('0x4'));var logger=require('../../config/logger')(_0x8259('0x5'));var config=require('../../config/environment');var jayson=require(_0x8259('0x6'));var client=jayson[_0x8259('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca732,_0x3cd4bc,_0x134888){return new BPromise(function(_0x573e65,_0x77fded){return client[_0x8259('0x8')](_0x1ca732,_0x134888)[_0x8259('0x9')](function(_0x464247){logger['info'](_0x8259('0xa'),_0x3cd4bc,'request\x20sent');logger['debug'](_0x8259('0xb'),_0x3cd4bc,'request\x20sent',JSON['stringify'](_0x464247));if(_0x464247[_0x8259('0xc')]){if(_0x464247[_0x8259('0xc')][_0x8259('0xd')]===0x1f4){logger[_0x8259('0xc')](_0x8259('0xa'),_0x3cd4bc,_0x464247[_0x8259('0xc')]['message']);return _0x77fded(_0x464247[_0x8259('0xc')][_0x8259('0xe')]);}logger[_0x8259('0xc')](_0x8259('0xa'),_0x3cd4bc,_0x464247[_0x8259('0xc')][_0x8259('0xe')]);return _0x573e65(_0x464247[_0x8259('0xc')][_0x8259('0xe')]);}else{logger[_0x8259('0xf')](_0x8259('0xa'),_0x3cd4bc,_0x8259('0x10'));_0x573e65(_0x464247['result'][_0x8259('0xe')]);}})[_0x8259('0x11')](function(_0x3eea3d){logger[_0x8259('0xc')](_0x8259('0xa'),_0x3cd4bc,_0x3eea3d);_0x77fded(_0x3eea3d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index b4839d3..e5ac756 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(_0x2de4e6,_0x2dbab4){var _0x156984=function(_0x3c17c4){while(--_0x3c17c4){_0x2de4e6['push'](_0x2de4e6['shift']());}};_0x156984(++_0x2dbab4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x29f71e,_0x8f151f){var _0x92dbf3=function(_0x28dd7c){while(--_0x28dd7c){_0x29f71e['push'](_0x29f71e['shift']());}};_0x92dbf3(++_0x8f151f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xcb91[_0x510c60];return _0x49c4aa;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 13f9fed..6d0377f 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 _0xf87a=['sequelize','exports','STRING','app.js','INTEGER','BOOLEAN','state'];(function(_0x4c0644,_0x413ff3){var _0x1a6fec=function(_0x570e8){while(--_0x570e8){_0x4c0644['push'](_0x4c0644['shift']());}};_0x1a6fec(++_0x413ff3);}(_0xf87a,0x103));var _0xaf87=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf87a[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xaf87('0x0'));module[_0xaf87('0x1')]={'name':{'type':Sequelize[_0xaf87('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xaf87('0x2')],'defaultValue':_0xaf87('0x3')},'filename':{'type':Sequelize[_0xaf87('0x2')]},'path':{'type':Sequelize[_0xaf87('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xaf87('0x4')]},'active':{'type':Sequelize[_0xaf87('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xaf87('0x2')]},'logo':{'type':Sequelize[_0xaf87('0x2')]},'state':{'type':Sequelize[_0xaf87('0x2')],'unique':_0xaf87('0x6')},'description':{'type':Sequelize[_0xaf87('0x2')]},'title':{'type':Sequelize[_0xaf87('0x2')]},'remoteUri':{'type':Sequelize[_0xaf87('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x47cb=['unique_name_and_version','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x57dae8,_0x14f493){var _0x2da89a=function(_0x498a30){while(--_0x498a30){_0x57dae8['push'](_0x57dae8['shift']());}};_0x2da89a(++_0x14f493);}(_0x47cb,0x10c));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xb47c('0x0')]={'name':{'type':Sequelize[_0xb47c('0x1')],'allowNull':![],'unique':_0xb47c('0x2')},'version':{'type':Sequelize[_0xb47c('0x1')],'allowNull':![],'unique':_0xb47c('0x2')},'main':{'type':Sequelize[_0xb47c('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xb47c('0x1')]},'path':{'type':Sequelize[_0xb47c('0x1')]},'type':{'type':Sequelize[_0xb47c('0x1')]},'size':{'type':Sequelize[_0xb47c('0x3')]},'active':{'type':Sequelize[_0xb47c('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xb47c('0x1')]},'logo':{'type':Sequelize[_0xb47c('0x1')]},'state':{'type':Sequelize[_0xb47c('0x1')],'unique':_0xb47c('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb47c('0x1')]},'link':{'type':Sequelize[_0xb47c('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 43b6956..1a28618 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba34=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5047b2,_0x23ff64){var _0x57d700=function(_0x51cb89){while(--_0x51cb89){_0x5047b2['push'](_0x5047b2['shift']());}};_0x57d700(++_0x23ff64);}(_0xba34,0x119));var _0x4ba3=function(_0x21314a,_0x2c1272){_0x21314a=_0x21314a-0x0;var _0x1c85cc=_0xba34[_0x21314a];return _0x1c85cc;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['Integration']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));}; \ No newline at end of file +var _0xc4aa=['../../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','map','Integration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'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);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index da9138b..9c24c8c 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 _0xed3e=['path','rimraf','../../config/environment','exports','define','Integration','integrations','util','../../config/logger','api','request-promise'];(function(_0x22f62c,_0x52d699){var _0x3bb6a1=function(_0x46301a){while(--_0x46301a){_0x22f62c['push'](_0x22f62c['shift']());}};_0x3bb6a1(++_0x52d699);}(_0xed3e,0x13b));var _0xeed3=function(_0x190743,_0x1a52eb){_0x190743=_0x190743-0x0;var _0xfda428=_0xed3e[_0x190743];return _0xfda428;};'use strict';var _=require('lodash');var util=require(_0xeed3('0x0'));var logger=require(_0xeed3('0x1'))(_0xeed3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeed3('0x3'));var fs=require('fs');var path=require(_0xeed3('0x4'));var rimraf=require(_0xeed3('0x5'));var config=require(_0xeed3('0x6'));var attributes=require('./integration.attributes');module[_0xeed3('0x7')]=function(_0x4cd243,_0x598644){return _0x4cd243[_0xeed3('0x8')](_0xeed3('0x9'),attributes,{'tableName':_0xeed3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8174=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x27f48a,_0x5081e8){var _0x5a497b=function(_0x583d0c){while(--_0x583d0c){_0x27f48a['push'](_0x27f48a['shift']());}};_0x5a497b(++_0x5081e8);}(_0x8174,0xa8));var _0x4817=function(_0x342b40,_0x3bc1dd){_0x342b40=_0x342b40-0x0;var _0x370170=_0x8174[_0x342b40];return _0x370170;};'use strict';var _=require(_0x4817('0x0'));var util=require('util');var logger=require(_0x4817('0x1'))(_0x4817('0x2'));var moment=require(_0x4817('0x3'));var BPromise=require(_0x4817('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4817('0x5'));var rimraf=require(_0x4817('0x6'));var config=require(_0x4817('0x7'));var attributes=require(_0x4817('0x8'));module[_0x4817('0x9')]=function(_0x2cc60d,_0x20c744){return _0x2cc60d[_0x4817('0xa')](_0x4817('0xb'),attributes,{'tableName':_0x4817('0xc'),'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 8e7e8f6..fc69974 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x4d692a,_0x5c1506){var _0x9ef565=function(_0x2e17c8){while(--_0x2e17c8){_0x4d692a['push'](_0x4d692a['shift']());}};_0x9ef565(++_0x5c1506);}(_0xda2d,0x102));var _0xdda2=function(_0x432917,_0x34faac){_0x432917=_0x432917-0x0;var _0x1b89de=_0xda2d[_0x432917];return _0x1b89de;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2cbfdf,_0x3123ce){var _0x31f1f2=function(_0x21c188){while(--_0x21c188){_0x2cbfdf['push'](_0x2cbfdf['shift']());}};_0x31f1f2(++_0x3123ce);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x289c73,_0x5a71a0){_0x289c73=_0x289c73-0x0;var _0x5d05ff=_0xc6ac[_0x289c73];return _0x5d05ff;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 36012b0..c6da52e 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 _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x423d34,_0x365b72){var _0x50006e=function(_0x4b898e){while(--_0x4b898e){_0x423d34['push'](_0x423d34['shift']());}};_0x50006e(++_0x365b72);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3d83fd,_0x14e1b3){_0x3d83fd=_0x3d83fd-0x0;var _0x2e2d25=_0xc6ac[_0x3d83fd];return _0x2e2d25;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index db134b4..7b6862c 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 _0xf096=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize'];(function(_0x114984,_0x5c9593){var _0x44822b=function(_0x10af37){while(--_0x10af37){_0x114984['push'](_0x114984['shift']());}};_0x44822b(++_0x5c9593);}(_0xf096,0x83));var _0x6f09=function(_0x4ea712,_0x22010c){_0x4ea712=_0x4ea712-0x0;var _0x458a09=_0xf096[_0x4ea712];return _0x458a09;};'use strict';var Sequelize=require(_0x6f09('0x0'));module[_0x6f09('0x1')]={'integration':{'type':Sequelize[_0x6f09('0x2')]},'eventChannel':{'type':Sequelize[_0x6f09('0x2')]},'exitStatus':{'type':Sequelize[_0x6f09('0x2')]},'ticketId':{'type':Sequelize[_0x6f09('0x2')]},'integrationId':{'type':Sequelize[_0x6f09('0x3')]},'contacts':{'type':Sequelize[_0x6f09('0x2')]},'uniqueid':{'type':Sequelize[_0x6f09('0x2')]},'calleridnum':{'type':Sequelize[_0x6f09('0x2')]},'calleridname':{'type':Sequelize[_0x6f09('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6f09('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6f09('0x4')]},'agentconnectAt':{'type':Sequelize[_0x6f09('0x4')]},'holdtime':{'type':Sequelize[_0x6f09('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x6f09('0x3')]},'agentacw':{'type':Sequelize[_0x6f09('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6f09('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6f09('0x4')]},'agentdump':{'type':Sequelize[_0x6f09('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6f09('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6f09('0x2')]},'channelstate':{'type':Sequelize[_0x6f09('0x3')]},'channelstatedesc':{'type':Sequelize[_0x6f09('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6f09('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6f09('0x2')]},'accountcode':{'type':Sequelize[_0x6f09('0x2')]},'context':{'type':Sequelize[_0x6f09('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x6f09('0x2')]},'destchannelstate':{'type':Sequelize[_0x6f09('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6f09('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x6f09('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x6f09('0x2')]},'destlanguage':{'type':Sequelize[_0x6f09('0x2')]},'destaccountcode':{'type':Sequelize[_0x6f09('0x2')]},'destcontext':{'type':Sequelize[_0x6f09('0x2')]},'destexten':{'type':Sequelize[_0x6f09('0x2')]},'destpriority':{'type':Sequelize[_0x6f09('0x2')]},'destuniqueid':{'type':Sequelize[_0x6f09('0x2')]},'messageId':{'type':Sequelize[_0x6f09('0x2')]},'inReplyTo':{'type':Sequelize[_0x6f09('0x2')]},'subject':{'type':Sequelize[_0x6f09('0x2')]},'from':{'type':Sequelize[_0x6f09('0x2')]},'to':{'type':Sequelize[_0x6f09('0x2')]},'cc':{'type':Sequelize[_0x6f09('0x2')]},'attachment':{'type':Sequelize[_0x6f09('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x6f09('0x6')]},'status':{'type':Sequelize[_0x6f09('0x7')](_0x6f09('0x8'),_0x6f09('0x9'),_0x6f09('0xa'),'FAILED')},'url':{'type':Sequelize[_0x6f09('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x6f09('0x2')]},'projectId':{'type':Sequelize[_0x6f09('0x3')]}}; \ No newline at end of file +var _0xe584=['BOOLEAN','TEXT','SENT','SENDING','sequelize','STRING','INTEGER','DATE'];(function(_0x456f76,_0x43cdb7){var _0x1d25e6=function(_0xdc84cb){while(--_0xdc84cb){_0x456f76['push'](_0x456f76['shift']());}};_0x1d25e6(++_0x43cdb7);}(_0xe584,0x14c));var _0x4e58=function(_0x59385f,_0x218c19){_0x59385f=_0x59385f-0x0;var _0x3502df=_0xe584[_0x59385f];return _0x3502df;};'use strict';var Sequelize=require(_0x4e58('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x4e58('0x1')]},'ticketId':{'type':Sequelize[_0x4e58('0x1')]},'integrationId':{'type':Sequelize[_0x4e58('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4e58('0x1')]},'calleridnum':{'type':Sequelize[_0x4e58('0x1')]},'calleridname':{'type':Sequelize[_0x4e58('0x1')]},'queue':{'type':Sequelize[_0x4e58('0x1')]},'interface':{'type':Sequelize[_0x4e58('0x1')]},'membername':{'type':Sequelize[_0x4e58('0x1')]},'agentcalledAt':{'type':Sequelize[_0x4e58('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4e58('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4e58('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4e58('0x3')]},'talktime':{'type':Sequelize[_0x4e58('0x2')]},'agentacw':{'type':Sequelize[_0x4e58('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4e58('0x2')]},'reason':{'type':Sequelize[_0x4e58('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x4e58('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x4e58('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4e58('0x3')]},'lastevent':{'type':Sequelize[_0x4e58('0x1')]},'channel':{'type':Sequelize[_0x4e58('0x1')]},'channelstate':{'type':Sequelize[_0x4e58('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4e58('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4e58('0x1')]},'connectedlinename':{'type':Sequelize[_0x4e58('0x1')]},'language':{'type':Sequelize[_0x4e58('0x1')]},'accountcode':{'type':Sequelize[_0x4e58('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4e58('0x1')]},'priority':{'type':Sequelize[_0x4e58('0x1')]},'destchannel':{'type':Sequelize[_0x4e58('0x1')]},'destchannelstate':{'type':Sequelize[_0x4e58('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4e58('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4e58('0x1')]},'destcalleridname':{'type':Sequelize[_0x4e58('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4e58('0x1')]},'destlanguage':{'type':Sequelize[_0x4e58('0x1')]},'destaccountcode':{'type':Sequelize[_0x4e58('0x1')]},'destcontext':{'type':Sequelize[_0x4e58('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4e58('0x1')]},'destuniqueid':{'type':Sequelize[_0x4e58('0x1')]},'messageId':{'type':Sequelize[_0x4e58('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x4e58('0x1')]},'from':{'type':Sequelize[_0x4e58('0x1')]},'to':{'type':Sequelize[_0x4e58('0x1')]},'cc':{'type':Sequelize[_0x4e58('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x4e58('0x5')]},'status':{'type':Sequelize['ENUM'](_0x4e58('0x6'),_0x4e58('0x7'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x4e58('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4e58('0x1')]},'projectId':{'type':Sequelize[_0x4e58('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e4dc2a0..615cd89 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 _0x2e14=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','end','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x422311,_0x54125c){var _0x356858=function(_0x283a0f){while(--_0x283a0f){_0x422311['push'](_0x422311['shift']());}};_0x356858(++_0x54125c);}(_0x2e14,0x80));var _0x42e1=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x2e14[_0x34f701];return _0x3e2429;};'use strict';var emlformat=require(_0x42e1('0x0'));var rimraf=require(_0x42e1('0x1'));var zipdir=require(_0x42e1('0x2'));var jsonpatch=require(_0x42e1('0x3'));var rp=require(_0x42e1('0x4'));var moment=require('moment');var BPromise=require(_0x42e1('0x5'));var Mustache=require(_0x42e1('0x6'));var util=require(_0x42e1('0x7'));var path=require(_0x42e1('0x8'));var sox=require(_0x42e1('0x9'));var csv=require('to-csv');var ejs=require(_0x42e1('0xa'));var fs=require('fs');var fs_extra=require(_0x42e1('0xb'));var _=require('lodash');var squel=require(_0x42e1('0xc'));var crypto=require(_0x42e1('0xd'));var jsforce=require(_0x42e1('0xe'));var deskjs=require(_0x42e1('0xf'));var toCsv=require(_0x42e1('0x10'));var querystring=require('querystring');var Papa=require(_0x42e1('0x11'));var Redis=require('ioredis');var authService=require(_0x42e1('0x12'));var qs=require(_0x42e1('0x13'));var as=require(_0x42e1('0x14'));var hardwareService=require(_0x42e1('0x15'));var logger=require(_0x42e1('0x16'))(_0x42e1('0x17'));var utils=require(_0x42e1('0x18'));var config=require(_0x42e1('0x19'));var licenseUtil=require(_0x42e1('0x1a'));var db=require(_0x42e1('0x1b'))['db'];function respondWithStatusCode(_0x556810,_0x19a3fe){_0x19a3fe=_0x19a3fe||0xcc;return function(_0x4faddd){if(_0x4faddd){return _0x556810[_0x42e1('0x1c')](_0x19a3fe);}return _0x556810[_0x42e1('0x1d')](_0x19a3fe)['end']();};}function respondWithResult(_0x1adc69,_0x1c73d2){_0x1c73d2=_0x1c73d2||0xc8;return function(_0x360c4a){if(_0x360c4a){return _0x1adc69[_0x42e1('0x1d')](_0x1c73d2)['json'](_0x360c4a);}};}function respondWithFilteredResult(_0x590a6e,_0x439a9a){return function(_0x25bb6e){if(_0x25bb6e){var _0x342d16=typeof _0x439a9a[_0x42e1('0x1e')]===_0x42e1('0x1f')&&typeof _0x439a9a[_0x42e1('0x20')]===_0x42e1('0x1f');var _0x57296c=_0x25bb6e[_0x42e1('0x21')];var _0x13a503=_0x342d16?0x0:_0x439a9a[_0x42e1('0x1e')];var _0x3210a0=_0x342d16?_0x25bb6e['count']:_0x439a9a[_0x42e1('0x1e')]+_0x439a9a['limit'];var _0x5f1e45;if(_0x3210a0>=_0x57296c){_0x3210a0=_0x57296c;_0x5f1e45=0xc8;}else{_0x5f1e45=0xce;}_0x590a6e[_0x42e1('0x1d')](_0x5f1e45);return _0x590a6e[_0x42e1('0x22')]('Content-Range',_0x13a503+'-'+_0x3210a0+'/'+_0x57296c)[_0x42e1('0x23')](_0x25bb6e);}return null;};}function patchUpdates(_0x596be3){return function(_0x2e002e){try{jsonpatch[_0x42e1('0x24')](_0x2e002e,_0x596be3,!![]);}catch(_0x285305){return BPromise[_0x42e1('0x25')](_0x285305);}return _0x2e002e[_0x42e1('0x26')]();};}function saveUpdates(_0x60d2e4,_0x5774ce){return function(_0x240c0f){if(_0x240c0f){return _0x240c0f[_0x42e1('0x27')](_0x60d2e4)[_0x42e1('0x28')](function(_0x3ee459){return _0x3ee459;});}return null;};}function removeEntity(_0x404698,_0x282c22){return function(_0x2f088b){if(_0x2f088b){return _0x2f088b['destroy']()[_0x42e1('0x28')](function(){_0x404698[_0x42e1('0x1d')](0xcc)[_0x42e1('0x29')]();});}};}function handleEntityNotFound(_0x211807,_0x4e5332){return function(_0x134533){if(!_0x134533){_0x211807[_0x42e1('0x1c')](0x194);}return _0x134533;};}function handleError(_0x251013,_0x4cd4db){_0x4cd4db=_0x4cd4db||0x1f4;return function(_0x3ba2fb){logger['error'](_0x3ba2fb[_0x42e1('0x2a')]);if(_0x3ba2fb[_0x42e1('0x2b')]){delete _0x3ba2fb[_0x42e1('0x2b')];}_0x251013[_0x42e1('0x1d')](_0x4cd4db)[_0x42e1('0x2c')](_0x3ba2fb);};}exports[_0x42e1('0x2d')]=function(_0x5b66e0,_0x156eec){var _0x290086={},_0x5c75e0={},_0x4dca60={'count':0x0,'rows':[]};var _0x3e2ba7=_['map'](db[_0x42e1('0x2e')][_0x42e1('0x2f')],function(_0x1ecdb0){return{'name':_0x1ecdb0[_0x42e1('0x30')],'type':_0x1ecdb0[_0x42e1('0x31')]['key']};});_0x5c75e0[_0x42e1('0x32')]=_[_0x42e1('0x33')](_0x3e2ba7,_0x42e1('0x2b'));_0x5c75e0[_0x42e1('0x34')]=_[_0x42e1('0x35')](_0x5b66e0[_0x42e1('0x34')]);_0x5c75e0['filters']=_[_0x42e1('0x36')](_0x5c75e0[_0x42e1('0x32')],_0x5c75e0[_0x42e1('0x34')]);_0x290086[_0x42e1('0x37')]=_[_0x42e1('0x36')](_0x5c75e0['model'],qs[_0x42e1('0x38')](_0x5b66e0[_0x42e1('0x34')][_0x42e1('0x38')]));_0x290086[_0x42e1('0x37')]=_0x290086[_0x42e1('0x37')][_0x42e1('0x39')]?_0x290086[_0x42e1('0x37')]:_0x5c75e0[_0x42e1('0x32')];if(!_0x5b66e0[_0x42e1('0x34')][_0x42e1('0x3a')]('nolimit')){_0x290086['limit']=qs[_0x42e1('0x20')](_0x5b66e0[_0x42e1('0x34')][_0x42e1('0x20')]);_0x290086[_0x42e1('0x1e')]=qs[_0x42e1('0x1e')](_0x5b66e0['query'][_0x42e1('0x1e')]);}_0x290086['order']=qs[_0x42e1('0x3b')](_0x5b66e0[_0x42e1('0x34')][_0x42e1('0x3b')]);_0x290086[_0x42e1('0x3c')]=qs[_0x42e1('0x3d')](_[_0x42e1('0x3e')](_0x5b66e0[_0x42e1('0x34')],_0x5c75e0[_0x42e1('0x3d')]),_0x3e2ba7);if(_0x5b66e0[_0x42e1('0x34')][_0x42e1('0x3f')]){_0x290086['where']=_[_0x42e1('0x40')](_0x290086[_0x42e1('0x3c')],{'$or':_[_0x42e1('0x33')](_0x3e2ba7,function(_0x19ee25){if(_0x19ee25[_0x42e1('0x31')]!==_0x42e1('0x41')){var _0x565d6c={};_0x565d6c[_0x19ee25[_0x42e1('0x2b')]]={'$like':'%'+_0x5b66e0[_0x42e1('0x34')][_0x42e1('0x3f')]+'%'};return _0x565d6c;}})});}_0x290086=_[_0x42e1('0x40')]({},_0x290086,_0x5b66e0['options']);var _0x3d5ebb={'where':_0x290086[_0x42e1('0x3c')]};return db['IntegrationReport'][_0x42e1('0x21')](_0x3d5ebb)['then'](function(_0x1365b5){_0x4dca60[_0x42e1('0x21')]=_0x1365b5;if(_0x5b66e0[_0x42e1('0x34')][_0x42e1('0x42')]){_0x290086[_0x42e1('0x43')]=[{'all':!![]}];}return db[_0x42e1('0x2e')]['findAll'](_0x290086);})[_0x42e1('0x28')](function(_0x3acd82){_0x4dca60[_0x42e1('0x44')]=_0x3acd82;return _0x4dca60;})[_0x42e1('0x28')](respondWithFilteredResult(_0x156eec,_0x290086))[_0x42e1('0x45')](handleError(_0x156eec,null));};exports['show']=function(_0x340219,_0x411f3b){var _0x1acd0c={'raw':![],'where':{'id':_0x340219['params']['id']}},_0x135bd8={};_0x135bd8[_0x42e1('0x32')]=_[_0x42e1('0x35')](db['IntegrationReport']['rawAttributes']);_0x135bd8['query']=_[_0x42e1('0x35')](_0x340219[_0x42e1('0x34')]);_0x135bd8[_0x42e1('0x3d')]=_[_0x42e1('0x36')](_0x135bd8['model'],_0x135bd8[_0x42e1('0x34')]);_0x1acd0c[_0x42e1('0x37')]=_[_0x42e1('0x36')](_0x135bd8['model'],qs[_0x42e1('0x38')](_0x340219[_0x42e1('0x34')][_0x42e1('0x38')]));_0x1acd0c[_0x42e1('0x37')]=_0x1acd0c['attributes'][_0x42e1('0x39')]?_0x1acd0c[_0x42e1('0x37')]:_0x135bd8[_0x42e1('0x32')];if(_0x340219['query'][_0x42e1('0x42')]){_0x1acd0c['include']=[{'all':!![]}];}_0x1acd0c=_[_0x42e1('0x40')]({},_0x1acd0c,_0x340219['options']);return db['IntegrationReport'][_0x42e1('0x46')](_0x1acd0c)[_0x42e1('0x28')](handleEntityNotFound(_0x411f3b,null))['then'](respondWithResult(_0x411f3b,null))[_0x42e1('0x45')](handleError(_0x411f3b,null));};exports[_0x42e1('0x47')]=function(_0x5f585e,_0x1f5717){return db[_0x42e1('0x2e')][_0x42e1('0x47')](_0x5f585e[_0x42e1('0x48')],{})[_0x42e1('0x28')](respondWithResult(_0x1f5717,0xc9))[_0x42e1('0x45')](handleError(_0x1f5717,null));};exports['update']=function(_0x18bfb3,_0x202ba1){if(_0x18bfb3['body']['id']){delete _0x18bfb3[_0x42e1('0x48')]['id'];}return db['IntegrationReport'][_0x42e1('0x46')]({'where':{'id':_0x18bfb3[_0x42e1('0x49')]['id']}})[_0x42e1('0x28')](handleEntityNotFound(_0x202ba1,null))[_0x42e1('0x28')](saveUpdates(_0x18bfb3[_0x42e1('0x48')],null))[_0x42e1('0x28')](respondWithResult(_0x202ba1,null))[_0x42e1('0x45')](handleError(_0x202ba1,null));};exports[_0x42e1('0x4a')]=function(_0x47a23c,_0xc411a4){return db[_0x42e1('0x2e')][_0x42e1('0x46')]({'where':{'id':_0x47a23c[_0x42e1('0x49')]['id']}})[_0x42e1('0x28')](handleEntityNotFound(_0xc411a4,null))[_0x42e1('0x28')](removeEntity(_0xc411a4,null))[_0x42e1('0x45')](handleError(_0xc411a4,null));};exports[_0x42e1('0x4b')]=function(_0x7a63f5,_0x2bb13a){return db[_0x42e1('0x2e')][_0x42e1('0x4b')]()[_0x42e1('0x28')](respondWithResult(_0x2bb13a,null))['catch'](handleError(_0x2bb13a,null));}; \ No newline at end of file +var _0xdf90=['limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x4df017,_0x2b1ce7){var _0x4f440d=function(_0x40945a){while(--_0x40945a){_0x4df017['push'](_0x4df017['shift']());}};_0x4f440d(++_0x2b1ce7);}(_0xdf90,0x148));var _0x0df9=function(_0x153c6a,_0x2a217a){_0x153c6a=_0x153c6a-0x0;var _0xce898f=_0xdf90[_0x153c6a];return _0xce898f;};'use strict';var emlformat=require(_0x0df9('0x0'));var rimraf=require(_0x0df9('0x1'));var zipdir=require(_0x0df9('0x2'));var jsonpatch=require(_0x0df9('0x3'));var rp=require(_0x0df9('0x4'));var moment=require(_0x0df9('0x5'));var BPromise=require(_0x0df9('0x6'));var Mustache=require(_0x0df9('0x7'));var util=require(_0x0df9('0x8'));var path=require('path');var sox=require(_0x0df9('0x9'));var csv=require(_0x0df9('0xa'));var ejs=require(_0x0df9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0df9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0df9('0xa'));var querystring=require('querystring');var Papa=require(_0x0df9('0xd'));var Redis=require(_0x0df9('0xe'));var authService=require(_0x0df9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0df9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0df9('0x11'));var utils=require(_0x0df9('0x12'));var config=require(_0x0df9('0x13'));var licenseUtil=require(_0x0df9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aa819,_0x4cc7bb){_0x4cc7bb=_0x4cc7bb||0xcc;return function(_0x1c0ebe){if(_0x1c0ebe){return _0x1aa819[_0x0df9('0x15')](_0x4cc7bb);}return _0x1aa819[_0x0df9('0x16')](_0x4cc7bb)[_0x0df9('0x17')]();};}function respondWithResult(_0x5a66ed,_0x5db865){_0x5db865=_0x5db865||0xc8;return function(_0x4f7f4c){if(_0x4f7f4c){return _0x5a66ed[_0x0df9('0x16')](_0x5db865)[_0x0df9('0x18')](_0x4f7f4c);}};}function respondWithFilteredResult(_0x159528,_0x4fbb62){return function(_0x29c5a6){if(_0x29c5a6){var _0x48c932=typeof _0x4fbb62[_0x0df9('0x19')]===_0x0df9('0x1a')&&typeof _0x4fbb62[_0x0df9('0x1b')]===_0x0df9('0x1a');var _0x3482f7=_0x29c5a6[_0x0df9('0x1c')];var _0x530ef7=_0x48c932?0x0:_0x4fbb62[_0x0df9('0x19')];var _0x42ce42=_0x48c932?_0x29c5a6[_0x0df9('0x1c')]:_0x4fbb62[_0x0df9('0x19')]+_0x4fbb62[_0x0df9('0x1b')];var _0x23b756;if(_0x42ce42>=_0x3482f7){_0x42ce42=_0x3482f7;_0x23b756=0xc8;}else{_0x23b756=0xce;}_0x159528[_0x0df9('0x16')](_0x23b756);return _0x159528['set'](_0x0df9('0x1d'),_0x530ef7+'-'+_0x42ce42+'/'+_0x3482f7)[_0x0df9('0x18')](_0x29c5a6);}return null;};}function patchUpdates(_0x2a9bd7){return function(_0x556e06){try{jsonpatch[_0x0df9('0x1e')](_0x556e06,_0x2a9bd7,!![]);}catch(_0x295704){return BPromise[_0x0df9('0x1f')](_0x295704);}return _0x556e06[_0x0df9('0x20')]();};}function saveUpdates(_0x54b911,_0x17733b){return function(_0x475400){if(_0x475400){return _0x475400[_0x0df9('0x21')](_0x54b911)[_0x0df9('0x22')](function(_0x4c99b9){return _0x4c99b9;});}return null;};}function removeEntity(_0x170b98,_0x56269b){return function(_0x158e96){if(_0x158e96){return _0x158e96[_0x0df9('0x23')]()[_0x0df9('0x22')](function(){_0x170b98['status'](0xcc)[_0x0df9('0x17')]();});}};}function handleEntityNotFound(_0x5b2678,_0x57f13b){return function(_0x478eb6){if(!_0x478eb6){_0x5b2678[_0x0df9('0x15')](0x194);}return _0x478eb6;};}function handleError(_0x289f45,_0x538268){_0x538268=_0x538268||0x1f4;return function(_0x83a423){logger[_0x0df9('0x24')](_0x83a423[_0x0df9('0x25')]);if(_0x83a423['name']){delete _0x83a423[_0x0df9('0x26')];}_0x289f45[_0x0df9('0x16')](_0x538268)['send'](_0x83a423);};}exports[_0x0df9('0x27')]=function(_0xf2ddfd,_0x345138){var _0x460625={},_0x34c614={},_0x3bdbe0={'count':0x0,'rows':[]};var _0x2fd3c7=_[_0x0df9('0x28')](db[_0x0df9('0x29')][_0x0df9('0x2a')],function(_0x1ec7c0){return{'name':_0x1ec7c0['fieldName'],'type':_0x1ec7c0[_0x0df9('0x2b')][_0x0df9('0x2c')]};});_0x34c614['model']=_[_0x0df9('0x28')](_0x2fd3c7,_0x0df9('0x26'));_0x34c614[_0x0df9('0x2d')]=_[_0x0df9('0x2e')](_0xf2ddfd[_0x0df9('0x2d')]);_0x34c614['filters']=_[_0x0df9('0x2f')](_0x34c614[_0x0df9('0x30')],_0x34c614[_0x0df9('0x2d')]);_0x460625[_0x0df9('0x31')]=_[_0x0df9('0x2f')](_0x34c614[_0x0df9('0x30')],qs['fields'](_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x32')]));_0x460625[_0x0df9('0x31')]=_0x460625[_0x0df9('0x31')]['length']?_0x460625['attributes']:_0x34c614[_0x0df9('0x30')];if(!_0xf2ddfd['query'][_0x0df9('0x33')](_0x0df9('0x34'))){_0x460625[_0x0df9('0x1b')]=qs[_0x0df9('0x1b')](_0xf2ddfd[_0x0df9('0x2d')]['limit']);_0x460625[_0x0df9('0x19')]=qs['offset'](_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x19')]);}_0x460625[_0x0df9('0x35')]=qs['sort'](_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x36')]);_0x460625[_0x0df9('0x37')]=qs[_0x0df9('0x38')](_[_0x0df9('0x39')](_0xf2ddfd[_0x0df9('0x2d')],_0x34c614[_0x0df9('0x38')]),_0x2fd3c7);if(_0xf2ddfd['query'][_0x0df9('0x3a')]){_0x460625[_0x0df9('0x37')]=_[_0x0df9('0x3b')](_0x460625[_0x0df9('0x37')],{'$or':_['map'](_0x2fd3c7,function(_0x1988a3){if(_0x1988a3['type']!=='VIRTUAL'){var _0x513d15={};_0x513d15[_0x1988a3['name']]={'$like':'%'+_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x3a')]+'%'};return _0x513d15;}})});}_0x460625=_[_0x0df9('0x3b')]({},_0x460625,_0xf2ddfd[_0x0df9('0x3c')]);var _0x1cf005={'where':_0x460625['where']};return db[_0x0df9('0x29')]['count'](_0x1cf005)[_0x0df9('0x22')](function(_0x416b82){_0x3bdbe0[_0x0df9('0x1c')]=_0x416b82;if(_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x3d')]){_0x460625[_0x0df9('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x0df9('0x3f')](_0x460625);})[_0x0df9('0x22')](function(_0x4a0a22){_0x3bdbe0['rows']=_0x4a0a22;return _0x3bdbe0;})[_0x0df9('0x22')](respondWithFilteredResult(_0x345138,_0x460625))[_0x0df9('0x40')](handleError(_0x345138,null));};exports['show']=function(_0x4ff392,_0x4c0c76){var _0x5e83f6={'raw':![],'where':{'id':_0x4ff392[_0x0df9('0x41')]['id']}},_0x5015bb={};_0x5015bb['model']=_[_0x0df9('0x2e')](db['IntegrationReport'][_0x0df9('0x2a')]);_0x5015bb[_0x0df9('0x2d')]=_['keys'](_0x4ff392[_0x0df9('0x2d')]);_0x5015bb[_0x0df9('0x38')]=_[_0x0df9('0x2f')](_0x5015bb[_0x0df9('0x30')],_0x5015bb[_0x0df9('0x2d')]);_0x5e83f6[_0x0df9('0x31')]=_['intersection'](_0x5015bb[_0x0df9('0x30')],qs[_0x0df9('0x32')](_0x4ff392[_0x0df9('0x2d')]['fields']));_0x5e83f6[_0x0df9('0x31')]=_0x5e83f6[_0x0df9('0x31')][_0x0df9('0x42')]?_0x5e83f6[_0x0df9('0x31')]:_0x5015bb[_0x0df9('0x30')];if(_0x4ff392[_0x0df9('0x2d')][_0x0df9('0x3d')]){_0x5e83f6[_0x0df9('0x3e')]=[{'all':!![]}];}_0x5e83f6=_[_0x0df9('0x3b')]({},_0x5e83f6,_0x4ff392['options']);return db[_0x0df9('0x29')][_0x0df9('0x43')](_0x5e83f6)[_0x0df9('0x22')](handleEntityNotFound(_0x4c0c76,null))[_0x0df9('0x22')](respondWithResult(_0x4c0c76,null))[_0x0df9('0x40')](handleError(_0x4c0c76,null));};exports[_0x0df9('0x44')]=function(_0x1b453e,_0x103888){return db['IntegrationReport'][_0x0df9('0x44')](_0x1b453e[_0x0df9('0x45')],{})[_0x0df9('0x22')](respondWithResult(_0x103888,0xc9))['catch'](handleError(_0x103888,null));};exports['update']=function(_0x7a3d74,_0x3bdd1a){if(_0x7a3d74[_0x0df9('0x45')]['id']){delete _0x7a3d74[_0x0df9('0x45')]['id'];}return db[_0x0df9('0x29')][_0x0df9('0x43')]({'where':{'id':_0x7a3d74[_0x0df9('0x41')]['id']}})[_0x0df9('0x22')](handleEntityNotFound(_0x3bdd1a,null))[_0x0df9('0x22')](saveUpdates(_0x7a3d74[_0x0df9('0x45')],null))[_0x0df9('0x22')](respondWithResult(_0x3bdd1a,null))[_0x0df9('0x40')](handleError(_0x3bdd1a,null));};exports[_0x0df9('0x23')]=function(_0x5dfe51,_0x1ea2ec){return db[_0x0df9('0x29')][_0x0df9('0x43')]({'where':{'id':_0x5dfe51['params']['id']}})[_0x0df9('0x22')](handleEntityNotFound(_0x1ea2ec,null))[_0x0df9('0x22')](removeEntity(_0x1ea2ec,null))['catch'](handleError(_0x1ea2ec,null));};exports[_0x0df9('0x46')]=function(_0x43f5ba,_0x59a5ee){return db[_0x0df9('0x29')][_0x0df9('0x46')]()['then'](respondWithResult(_0x59a5ee,null))[_0x0df9('0x40')](handleError(_0x59a5ee,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6de69eb..01cdb85 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 _0x34a3=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash'];(function(_0x4a724f,_0x5b001a){var _0x35adab=function(_0x56298f){while(--_0x56298f){_0x4a724f['push'](_0x4a724f['shift']());}};_0x35adab(++_0x5b001a);}(_0x34a3,0xdf));var _0x334a=function(_0x3d0293,_0x3d3c80){_0x3d0293=_0x3d0293-0x0;var _0x5aa8d3=_0x34a3[_0x3d0293];return _0x5aa8d3;};'use strict';var _=require(_0x334a('0x0'));var util=require(_0x334a('0x1'));var logger=require(_0x334a('0x2'))(_0x334a('0x3'));var moment=require(_0x334a('0x4'));var BPromise=require(_0x334a('0x5'));var rp=require(_0x334a('0x6'));var fs=require('fs');var path=require(_0x334a('0x7'));var rimraf=require(_0x334a('0x8'));var config=require(_0x334a('0x9'));var attributes=require(_0x334a('0xa'));module[_0x334a('0xb')]=function(_0x4e2ee4,_0x3f6bdd){return _0x4e2ee4[_0x334a('0xc')]('IntegrationReport',attributes,{'tableName':_0x334a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91c6=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','api','bluebird'];(function(_0x4e71cf,_0x40be23){var _0x27e7a5=function(_0x70d714){while(--_0x70d714){_0x4e71cf['push'](_0x4e71cf['shift']());}};_0x27e7a5(++_0x40be23);}(_0x91c6,0x129));var _0x691c=function(_0x3c0672,_0x31b3d9){_0x3c0672=_0x3c0672-0x0;var _0x2cef4d=_0x91c6[_0x3c0672];return _0x2cef4d;};'use strict';var _=require('lodash');var util=require(_0x691c('0x0'));var logger=require('../../config/logger')(_0x691c('0x1'));var moment=require('moment');var BPromise=require(_0x691c('0x2'));var rp=require(_0x691c('0x3'));var fs=require('fs');var path=require(_0x691c('0x4'));var rimraf=require(_0x691c('0x5'));var config=require(_0x691c('0x6'));var attributes=require(_0x691c('0x7'));module[_0x691c('0x8')]=function(_0x447bb8,_0x11843f){return _0x447bb8[_0x691c('0x9')](_0x691c('0xa'),attributes,{'tableName':_0x691c('0xb'),'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 ae80293..a5d7c69 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0xb91532,_0x24a317){var _0x5e6fc3=function(_0x419ead){while(--_0x419ead){_0xb91532['push'](_0xb91532['shift']());}};_0x5e6fc3(++_0x24a317);}(_0x187d,0x93));var _0xd187=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x187d[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x53ec,0x192));var _0xc53e=function(_0x2c24b8,_0x168e0b){_0x2c24b8=_0x2c24b8-0x0;var _0x563ed6=_0x53ec[_0x2c24b8];return _0x563ed6;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c741cda..d6d4dcf 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 _0x7d9a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x7d9a,0x1be));var _0xa7d9=function(_0x5ca841,_0x519f10){_0x5ca841=_0x5ca841-0x0;var _0x530c76=_0x7d9a[_0x5ca841];return _0x530c76;};'use strict';var multer=require(_0xa7d9('0x0'));var util=require(_0xa7d9('0x1'));var path=require('path');var timeout=require(_0xa7d9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa7d9('0x3'));var auth=require(_0xa7d9('0x4'));var interaction=require(_0xa7d9('0x5'));var config=require(_0xa7d9('0x6'));var controller=require(_0xa7d9('0x7'));router[_0xa7d9('0x8')]('/',auth[_0xa7d9('0x9')](),controller[_0xa7d9('0xa')]);router[_0xa7d9('0x8')](_0xa7d9('0xb'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0xc')]);router[_0xa7d9('0x8')](_0xa7d9('0xd'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0xe')]);router['post']('/',auth[_0xa7d9('0x9')](),controller[_0xa7d9('0xf')]);router[_0xa7d9('0x10')](_0xa7d9('0xd'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0x11')]);router[_0xa7d9('0x10')](_0xa7d9('0x12'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0x13')]);router[_0xa7d9('0x14')](_0xa7d9('0xb'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0x15')]);router[_0xa7d9('0x16')](_0xa7d9('0xb'),auth[_0xa7d9('0x9')](),controller[_0xa7d9('0x17')]);module[_0xa7d9('0x18')]=router; \ No newline at end of file +var _0x43ef=['index','show','getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x40ed0e,_0xd9a1c9){var _0x206df4=function(_0x5c07cb){while(--_0x5c07cb){_0x40ed0e['push'](_0x40ed0e['shift']());}};_0x206df4(++_0xd9a1c9);}(_0x43ef,0x19a));var _0xf43e=function(_0x59bfd0,_0x5a2f99){_0x59bfd0=_0x59bfd0-0x0;var _0x1178ff=_0x43ef[_0x59bfd0];return _0x1178ff;};'use strict';var multer=require(_0xf43e('0x0'));var util=require(_0xf43e('0x1'));var path=require('path');var timeout=require(_0xf43e('0x2'));var express=require(_0xf43e('0x3'));var router=express[_0xf43e('0x4')]();var fs_extra=require(_0xf43e('0x5'));var auth=require(_0xf43e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf43e('0x7'));var controller=require('./interval.controller');router[_0xf43e('0x8')]('/',auth[_0xf43e('0x9')](),controller[_0xf43e('0xa')]);router[_0xf43e('0x8')]('/:id',auth[_0xf43e('0x9')](),controller[_0xf43e('0xb')]);router[_0xf43e('0x8')]('/:id/sub_intervals',auth[_0xf43e('0x9')](),controller[_0xf43e('0xc')]);router['post']('/',auth[_0xf43e('0x9')](),controller['create']);router[_0xf43e('0xd')]('/:id/sub_intervals',auth[_0xf43e('0x9')](),controller[_0xf43e('0xe')]);router['post']('/:id/sub_intervals/create_many',auth[_0xf43e('0x9')](),controller[_0xf43e('0xf')]);router[_0xf43e('0x10')](_0xf43e('0x11'),auth[_0xf43e('0x9')](),controller[_0xf43e('0x12')]);router[_0xf43e('0x13')](_0xf43e('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xf43e('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f51e981..76f9734 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 _0xefe1=['exports','STRING','sequelize'];(function(_0x447846,_0x421b70){var _0x12e7f9=function(_0x3217b1){while(--_0x3217b1){_0x447846['push'](_0x447846['shift']());}};_0x12e7f9(++_0x421b70);}(_0xefe1,0xd1));var _0x1efe=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xefe1[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x1efe('0x0'));module[_0x1efe('0x1')]={'name':{'type':Sequelize[_0x1efe('0x2')]},'description':{'type':Sequelize[_0x1efe('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x2ed4=['STRING','sequelize'];(function(_0x4d05a0,_0x53aa7e){var _0x4c999c=function(_0x358867){while(--_0x358867){_0x4d05a0['push'](_0x4d05a0['shift']());}};_0x4c999c(++_0x53aa7e);}(_0x2ed4,0x131));var _0x42ed=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x2ed4[_0x59d0cc];return _0x2ae79f;};'use strict';var Sequelize=require(_0x42ed('0x0'));module['exports']={'name':{'type':Sequelize[_0x42ed('0x1')]},'description':{'type':Sequelize[_0x42ed('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 6ab9ea5..d460f34 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 _0x75b8=['../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','role','user','Intervals','UserProfileSection','userProfileId','autoAssociation','IntervalId','findOne','sort','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x43d0dd,_0x1bd3d2){var _0x233879=function(_0x4461ef){while(--_0x4461ef){_0x43d0dd['push'](_0x43d0dd['shift']());}};_0x233879(++_0x1bd3d2);}(_0x75b8,0x158));var _0x875b=function(_0x1ccb95,_0x1b3be8){_0x1ccb95=_0x1ccb95-0x0;var _0x1a9725=_0x75b8[_0x1ccb95];return _0x1a9725;};'use strict';var emlformat=require(_0x875b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x875b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x875b('0x2'));var moment=require(_0x875b('0x3'));var BPromise=require(_0x875b('0x4'));var Mustache=require(_0x875b('0x5'));var util=require(_0x875b('0x6'));var path=require(_0x875b('0x7'));var sox=require(_0x875b('0x8'));var csv=require(_0x875b('0x9'));var ejs=require(_0x875b('0xa'));var fs=require('fs');var fs_extra=require(_0x875b('0xb'));var _=require(_0x875b('0xc'));var squel=require(_0x875b('0xd'));var crypto=require(_0x875b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x875b('0xf'));var toCsv=require(_0x875b('0x9'));var querystring=require('querystring');var Papa=require(_0x875b('0x10'));var Redis=require(_0x875b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x875b('0x12'));var as=require(_0x875b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x875b('0x14'))('api');var utils=require(_0x875b('0x15'));var config=require(_0x875b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x383bcc,_0x54b9e9){_0x54b9e9=_0x54b9e9||0xcc;return function(_0x3f122a){if(_0x3f122a){return _0x383bcc[_0x875b('0x17')](_0x54b9e9);}return _0x383bcc[_0x875b('0x18')](_0x54b9e9)[_0x875b('0x19')]();};}function respondWithResult(_0x4fc51e,_0x43ecfa){_0x43ecfa=_0x43ecfa||0xc8;return function(_0x2d5c57){if(_0x2d5c57){return _0x4fc51e[_0x875b('0x18')](_0x43ecfa)[_0x875b('0x1a')](_0x2d5c57);}};}function respondWithFilteredResult(_0x3a693d,_0x781eab){return function(_0x1915e1){if(_0x1915e1){var _0x9f676a=typeof _0x781eab[_0x875b('0x1b')]==='undefined'&&typeof _0x781eab[_0x875b('0x1c')]===_0x875b('0x1d');var _0x1a0382=_0x1915e1['count'];var _0x27b588=_0x9f676a?0x0:_0x781eab[_0x875b('0x1b')];var _0x5dcf78=_0x9f676a?_0x1915e1[_0x875b('0x1e')]:_0x781eab['offset']+_0x781eab['limit'];var _0x1fb069;if(_0x5dcf78>=_0x1a0382){_0x5dcf78=_0x1a0382;_0x1fb069=0xc8;}else{_0x1fb069=0xce;}_0x3a693d[_0x875b('0x18')](_0x1fb069);return _0x3a693d[_0x875b('0x1f')](_0x875b('0x20'),_0x27b588+'-'+_0x5dcf78+'/'+_0x1a0382)[_0x875b('0x1a')](_0x1915e1);}return null;};}function patchUpdates(_0x4b354f){return function(_0x1c5e73){try{jsonpatch[_0x875b('0x21')](_0x1c5e73,_0x4b354f,!![]);}catch(_0x593f97){return BPromise['reject'](_0x593f97);}return _0x1c5e73[_0x875b('0x22')]();};}function saveUpdates(_0x455cd5,_0x1b9a1c){return function(_0x360a63){if(_0x360a63){return _0x360a63[_0x875b('0x23')](_0x455cd5)[_0x875b('0x24')](function(_0x74d840){return _0x74d840;});}return null;};}function removeEntity(_0x465ccd,_0x56b0f1){return function(_0x3d68a8){if(_0x3d68a8){return _0x3d68a8[_0x875b('0x25')]()[_0x875b('0x24')](function(){var _0xce8b73=_0x3d68a8[_0x875b('0x26')]({'plain':!![]});var _0x5aee99='Intervals';return db[_0x875b('0x27')][_0x875b('0x25')]({'where':{'type':_0x5aee99,'resourceId':_0xce8b73['id']}})[_0x875b('0x24')](function(){return _0x3d68a8;});})[_0x875b('0x24')](function(){_0x465ccd[_0x875b('0x18')](0xcc)[_0x875b('0x19')]();});}};}function handleEntityNotFound(_0x264d01,_0x2b2289){return function(_0x1494f6){if(!_0x1494f6){_0x264d01[_0x875b('0x17')](0x194);}return _0x1494f6;};}function handleError(_0x2fb98f,_0x45a1e4){_0x45a1e4=_0x45a1e4||0x1f4;return function(_0x8b66d8){logger[_0x875b('0x28')](_0x8b66d8['stack']);if(_0x8b66d8[_0x875b('0x29')]){delete _0x8b66d8[_0x875b('0x29')];}_0x2fb98f[_0x875b('0x18')](_0x45a1e4)[_0x875b('0x2a')](_0x8b66d8);};}exports[_0x875b('0x2b')]=function(_0x43f2d3,_0x1876f8){var _0x18545a={},_0x54a1e5={},_0x31a758={'count':0x0,'rows':[]};var _0x5840f5=_[_0x875b('0x2c')](db[_0x875b('0x2d')][_0x875b('0x2e')],function(_0xa1daa6){return{'name':_0xa1daa6[_0x875b('0x2f')],'type':_0xa1daa6[_0x875b('0x30')][_0x875b('0x31')]};});_0x54a1e5['model']=_[_0x875b('0x2c')](_0x5840f5,'name');_0x54a1e5[_0x875b('0x32')]=_[_0x875b('0x33')](_0x43f2d3[_0x875b('0x32')]);_0x54a1e5[_0x875b('0x34')]=_[_0x875b('0x35')](_0x54a1e5[_0x875b('0x36')],_0x54a1e5[_0x875b('0x32')]);_0x18545a[_0x875b('0x37')]=_['intersection'](_0x54a1e5[_0x875b('0x36')],qs[_0x875b('0x38')](_0x43f2d3['query'][_0x875b('0x38')]));_0x18545a[_0x875b('0x37')]=_0x18545a[_0x875b('0x37')]['length']?_0x18545a[_0x875b('0x37')]:_0x54a1e5[_0x875b('0x36')];if(!_0x43f2d3[_0x875b('0x32')][_0x875b('0x39')](_0x875b('0x3a'))){_0x18545a[_0x875b('0x1c')]=qs[_0x875b('0x1c')](_0x43f2d3[_0x875b('0x32')][_0x875b('0x1c')]);_0x18545a[_0x875b('0x1b')]=qs[_0x875b('0x1b')](_0x43f2d3[_0x875b('0x32')][_0x875b('0x1b')]);}_0x18545a[_0x875b('0x3b')]=qs['sort'](_0x43f2d3[_0x875b('0x32')]['sort']);_0x18545a[_0x875b('0x3c')]=qs[_0x875b('0x34')](_[_0x875b('0x3d')](_0x43f2d3['query'],_0x54a1e5[_0x875b('0x34')]),_0x5840f5);if(_0x43f2d3[_0x875b('0x32')][_0x875b('0x3e')]){_0x18545a[_0x875b('0x3c')]=_[_0x875b('0x3f')](_0x18545a['where'],{'$or':_[_0x875b('0x2c')](_0x5840f5,function(_0x204831){if(_0x204831[_0x875b('0x30')]!==_0x875b('0x40')){var _0x356415={};_0x356415[_0x204831[_0x875b('0x29')]]={'$like':'%'+_0x43f2d3[_0x875b('0x32')][_0x875b('0x3e')]+'%'};return _0x356415;}})});}_0x18545a=_['merge']({},_0x18545a,_0x43f2d3[_0x875b('0x41')]);var _0x28a721={'where':_0x18545a['where']};return db[_0x875b('0x2d')][_0x875b('0x1e')](_0x28a721)['then'](function(_0x1d6ed8){_0x31a758[_0x875b('0x1e')]=_0x1d6ed8;if(_0x43f2d3[_0x875b('0x32')][_0x875b('0x42')]){_0x18545a['include']=[{'all':!![]}];}return db[_0x875b('0x2d')][_0x875b('0x43')](_0x18545a);})[_0x875b('0x24')](function(_0x1d85c0){_0x31a758[_0x875b('0x44')]=_0x1d85c0;return _0x31a758;})[_0x875b('0x24')](respondWithFilteredResult(_0x1876f8,_0x18545a))[_0x875b('0x45')](handleError(_0x1876f8,null));};exports[_0x875b('0x46')]=function(_0x36a9ca,_0x7aaf13){var _0x3aab8d={'raw':!![],'where':{'id':_0x36a9ca[_0x875b('0x47')]['id']}},_0x142e14={};_0x142e14[_0x875b('0x36')]=_[_0x875b('0x33')](db[_0x875b('0x2d')][_0x875b('0x2e')]);_0x142e14[_0x875b('0x32')]=_['keys'](_0x36a9ca[_0x875b('0x32')]);_0x142e14[_0x875b('0x34')]=_[_0x875b('0x35')](_0x142e14['model'],_0x142e14[_0x875b('0x32')]);_0x3aab8d[_0x875b('0x37')]=_[_0x875b('0x35')](_0x142e14[_0x875b('0x36')],qs[_0x875b('0x38')](_0x36a9ca[_0x875b('0x32')][_0x875b('0x38')]));_0x3aab8d[_0x875b('0x37')]=_0x3aab8d[_0x875b('0x37')][_0x875b('0x48')]?_0x3aab8d['attributes']:_0x142e14['model'];if(_0x36a9ca[_0x875b('0x32')][_0x875b('0x42')]){_0x3aab8d[_0x875b('0x49')]=[{'all':!![]}];}_0x3aab8d=_[_0x875b('0x3f')]({},_0x3aab8d,_0x36a9ca['options']);return db[_0x875b('0x2d')][_0x875b('0x4a')](_0x3aab8d)[_0x875b('0x24')](handleEntityNotFound(_0x7aaf13,null))['then'](respondWithResult(_0x7aaf13,null))[_0x875b('0x45')](handleError(_0x7aaf13,null));};exports['create']=function(_0x5a900a,_0x50ead8){return db[_0x875b('0x2d')][_0x875b('0x4b')](_0x5a900a[_0x875b('0x4c')],{})[_0x875b('0x24')](function(_0x772a2b){var _0x50d6c5=_0x5a900a['user'][_0x875b('0x26')]({'plain':!![]});if(!_0x50d6c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50d6c5[_0x875b('0x4d')]===_0x875b('0x4e')){var _0x2bcfd5=_0x772a2b['get']({'plain':!![]});var _0xb59799=_0x875b('0x4f');return db[_0x875b('0x50')][_0x875b('0x4a')]({'where':{'name':_0xb59799,'userProfileId':_0x50d6c5[_0x875b('0x51')]},'raw':!![]})[_0x875b('0x24')](function(_0x340487){if(_0x340487&&_0x340487[_0x875b('0x52')]===0x0){return db[_0x875b('0x27')][_0x875b('0x4b')]({'name':_0x2bcfd5[_0x875b('0x29')],'resourceId':_0x2bcfd5['id'],'type':_0x340487['name'],'sectionId':_0x340487['id']},{})[_0x875b('0x24')](function(){return _0x772a2b;});}else{return _0x772a2b;}})['catch'](function(_0x2f9a4e){logger[_0x875b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f9a4e);throw _0x2f9a4e;});}return _0x772a2b;})[_0x875b('0x24')](respondWithResult(_0x50ead8,0xc9))[_0x875b('0x45')](handleError(_0x50ead8,null));};exports[_0x875b('0x23')]=function(_0x814eb0,_0x4135b1){if(_0x814eb0[_0x875b('0x4c')]['id']){delete _0x814eb0['body']['id'];}return db[_0x875b('0x2d')][_0x875b('0x4a')]({'where':{'id':_0x814eb0[_0x875b('0x47')]['id']}})[_0x875b('0x24')](handleEntityNotFound(_0x4135b1,null))[_0x875b('0x24')](saveUpdates(_0x814eb0['body'],null))['then'](respondWithResult(_0x4135b1,null))[_0x875b('0x45')](handleError(_0x4135b1,null));};exports[_0x875b('0x25')]=function(_0x50bb8f,_0x19b629){return db[_0x875b('0x2d')][_0x875b('0x4a')]({'where':{'id':_0x50bb8f['params']['id']}})[_0x875b('0x24')](handleEntityNotFound(_0x19b629,null))[_0x875b('0x24')](removeEntity(_0x19b629,null))[_0x875b('0x45')](handleError(_0x19b629,null));};exports['addInterval']=function(_0x15872f,_0x1a5b0c,_0x2a08d1){if(_0x15872f[_0x875b('0x4c')]['id']){delete _0x15872f[_0x875b('0x4c')]['id'];}return db['Interval'][_0x875b('0x4a')]({'where':{'id':_0x15872f[_0x875b('0x47')]['id']}})[_0x875b('0x24')](handleEntityNotFound(_0x1a5b0c,null))[_0x875b('0x24')](function(_0x42bcd7){if(_0x42bcd7){_0x15872f[_0x875b('0x4c')][_0x875b('0x53')]=_0x42bcd7['id'];return db[_0x875b('0x2d')][_0x875b('0x4b')](_0x15872f[_0x875b('0x4c')]);}})[_0x875b('0x24')](respondWithResult(_0x1a5b0c,null))['catch'](handleError(_0x1a5b0c,null));};exports['getIntervals']=function(_0x44ae59,_0x338d91,_0x57aace){var _0x51e03e={};var _0x423868={};var _0x2c8714;var _0x55a78c;return db[_0x875b('0x2d')][_0x875b('0x54')]({'where':{'id':_0x44ae59[_0x875b('0x47')]['id']}})['then'](handleEntityNotFound(_0x338d91,null))[_0x875b('0x24')](function(_0xef9106){if(_0xef9106){_0x2c8714=_0xef9106;_0x423868[_0x875b('0x36')]=_[_0x875b('0x33')](db[_0x875b('0x2d')][_0x875b('0x2e')]);_0x423868[_0x875b('0x32')]=_[_0x875b('0x33')](_0x44ae59[_0x875b('0x32')]);_0x423868[_0x875b('0x34')]=_[_0x875b('0x35')](_0x423868[_0x875b('0x36')],_0x423868[_0x875b('0x32')]);_0x51e03e['attributes']=_[_0x875b('0x35')](_0x423868[_0x875b('0x36')],qs[_0x875b('0x38')](_0x44ae59['query']['fields']));_0x51e03e[_0x875b('0x37')]=_0x51e03e[_0x875b('0x37')][_0x875b('0x48')]?_0x51e03e['attributes']:_0x423868['model'];_0x51e03e[_0x875b('0x3b')]=qs[_0x875b('0x55')](_0x44ae59[_0x875b('0x32')]['sort']);_0x51e03e['where']=qs['filters'](_['pick'](_0x44ae59[_0x875b('0x32')],_0x423868[_0x875b('0x34')]));if(_0x44ae59[_0x875b('0x32')]['filter']){_0x51e03e[_0x875b('0x3c')]=_[_0x875b('0x3f')](_0x51e03e[_0x875b('0x3c')],{'$or':_[_0x875b('0x2c')](_0x51e03e[_0x875b('0x37')],function(_0x317f5b){var _0x4ed5a4={};_0x4ed5a4[_0x317f5b]={'$like':'%'+_0x44ae59['query'][_0x875b('0x3e')]+'%'};return _0x4ed5a4;})});}_0x51e03e=_['merge']({},_0x51e03e,_0x44ae59[_0x875b('0x41')]);return _0x2c8714[_0x875b('0x56')](_0x51e03e);}})['then'](function(_0x2a8835){if(_0x2a8835){_0x55a78c=_0x2a8835['length'];if(!_0x44ae59[_0x875b('0x32')][_0x875b('0x39')](_0x875b('0x3a'))){_0x51e03e[_0x875b('0x1c')]=qs[_0x875b('0x1c')](_0x44ae59[_0x875b('0x32')][_0x875b('0x1c')]);_0x51e03e[_0x875b('0x1b')]=qs[_0x875b('0x1b')](_0x44ae59['query'][_0x875b('0x1b')]);}return _0x2c8714['getIntervals'](_0x51e03e);}})[_0x875b('0x24')](function(_0x282bf2){if(_0x282bf2){return _0x282bf2?{'count':_0x55a78c,'rows':_0x282bf2}:null;}})[_0x875b('0x24')](respondWithResult(_0x338d91,null))[_0x875b('0x45')](handleError(_0x338d91,null));};exports[_0x875b('0x57')]=function(_0x2c6fd8,_0x135d12,_0x415f0d){return db[_0x875b('0x2d')][_0x875b('0x54')]({'where':{'id':_0x2c6fd8[_0x875b('0x47')]['id']}})[_0x875b('0x24')](handleEntityNotFound(_0x135d12,null))['then'](function(_0x3229b7){if(_0x3229b7){return db[_0x875b('0x58')][_0x875b('0x59')](function(_0x256e3c){return db['Interval'][_0x875b('0x25')]({'where':{'IntervalId':_0x2c6fd8[_0x875b('0x47')]['id']},'transaction':_0x256e3c})['then'](function(_0xb683d5){var _0x166014=_[_0x875b('0x2c')](_0x2c6fd8[_0x875b('0x4c')],function(_0x58f9f9){delete _0x58f9f9['id'];_0x58f9f9[_0x875b('0x53')]=_0x2c6fd8[_0x875b('0x47')]['id'];return _0x58f9f9;});return db[_0x875b('0x2d')][_0x875b('0x5a')](_0x166014,{'transaction':_0x256e3c});});})['then'](function(){return db[_0x875b('0x2d')][_0x875b('0x43')]({'where':{'IntervalId':_0x2c6fd8['params']['id']}});});}})[_0x875b('0x24')](respondWithResult(_0x135d12,null))[_0x875b('0x45')](handleError(_0x135d12,null));}; \ No newline at end of file +var _0x1ce1=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','length','catch','create','body','user'];(function(_0x46cd01,_0x49ba4d){var _0x55dddd=function(_0x3b508e){while(--_0x3b508e){_0x46cd01['push'](_0x46cd01['shift']());}};_0x55dddd(++_0x49ba4d);}(_0x1ce1,0xc8));var _0x11ce=function(_0x5bfed0,_0x255c0d){_0x5bfed0=_0x5bfed0-0x0;var _0x439d92=_0x1ce1[_0x5bfed0];return _0x439d92;};'use strict';var emlformat=require(_0x11ce('0x0'));var rimraf=require(_0x11ce('0x1'));var zipdir=require(_0x11ce('0x2'));var jsonpatch=require(_0x11ce('0x3'));var rp=require(_0x11ce('0x4'));var moment=require(_0x11ce('0x5'));var BPromise=require(_0x11ce('0x6'));var Mustache=require(_0x11ce('0x7'));var util=require(_0x11ce('0x8'));var path=require(_0x11ce('0x9'));var sox=require(_0x11ce('0xa'));var csv=require('to-csv');var ejs=require(_0x11ce('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11ce('0xc'));var crypto=require(_0x11ce('0xd'));var jsforce=require(_0x11ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x11ce('0xf'));var querystring=require(_0x11ce('0x10'));var Papa=require(_0x11ce('0x11'));var Redis=require(_0x11ce('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x11ce('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11ce('0x14'));var utils=require(_0x11ce('0x15'));var config=require(_0x11ce('0x16'));var licenseUtil=require(_0x11ce('0x17'));var db=require(_0x11ce('0x18'))['db'];var extensions=require(_0x11ce('0x19'));function respondWithStatusCode(_0x2507fb,_0x1e4711){_0x1e4711=_0x1e4711||0xcc;return function(_0x400177){if(_0x400177){return _0x2507fb[_0x11ce('0x1a')](_0x1e4711);}return _0x2507fb[_0x11ce('0x1b')](_0x1e4711)['end']();};}function respondWithResult(_0x436efe,_0x5a6a79){_0x5a6a79=_0x5a6a79||0xc8;return function(_0xe051d0){if(_0xe051d0){return _0x436efe[_0x11ce('0x1b')](_0x5a6a79)[_0x11ce('0x1c')](_0xe051d0);}};}function respondWithFilteredResult(_0x32c351,_0x10916a){return function(_0x4299ae){if(_0x4299ae){var _0x4781b7=typeof _0x10916a[_0x11ce('0x1d')]===_0x11ce('0x1e')&&typeof _0x10916a[_0x11ce('0x1f')]===_0x11ce('0x1e');var _0x2aa157=_0x4299ae[_0x11ce('0x20')];var _0x32bab6=_0x4781b7?0x0:_0x10916a[_0x11ce('0x1d')];var _0xf4d474=_0x4781b7?_0x4299ae[_0x11ce('0x20')]:_0x10916a[_0x11ce('0x1d')]+_0x10916a[_0x11ce('0x1f')];var _0xfec129;if(_0xf4d474>=_0x2aa157){_0xf4d474=_0x2aa157;_0xfec129=0xc8;}else{_0xfec129=0xce;}_0x32c351[_0x11ce('0x1b')](_0xfec129);return _0x32c351[_0x11ce('0x21')](_0x11ce('0x22'),_0x32bab6+'-'+_0xf4d474+'/'+_0x2aa157)[_0x11ce('0x1c')](_0x4299ae);}return null;};}function patchUpdates(_0x85a39f){return function(_0x190ed2){try{jsonpatch[_0x11ce('0x23')](_0x190ed2,_0x85a39f,!![]);}catch(_0x506d20){return BPromise[_0x11ce('0x24')](_0x506d20);}return _0x190ed2[_0x11ce('0x25')]();};}function saveUpdates(_0x42181a,_0x1973a8){return function(_0x46e632){if(_0x46e632){return _0x46e632[_0x11ce('0x26')](_0x42181a)[_0x11ce('0x27')](function(_0x5f1466){return _0x5f1466;});}return null;};}function removeEntity(_0x496169,_0x41b2a5){return function(_0x2e26a8){if(_0x2e26a8){return _0x2e26a8[_0x11ce('0x28')]()[_0x11ce('0x27')](function(){var _0x59b7d7=_0x2e26a8['get']({'plain':!![]});var _0x2517f0='Intervals';return db[_0x11ce('0x29')]['destroy']({'where':{'type':_0x2517f0,'resourceId':_0x59b7d7['id']}})['then'](function(){return _0x2e26a8;});})[_0x11ce('0x27')](function(){_0x496169['status'](0xcc)[_0x11ce('0x2a')]();});}};}function handleEntityNotFound(_0x3e2bc0,_0xe1e42){return function(_0x1724d5){if(!_0x1724d5){_0x3e2bc0[_0x11ce('0x1a')](0x194);}return _0x1724d5;};}function handleError(_0x3b4283,_0x17f8f3){_0x17f8f3=_0x17f8f3||0x1f4;return function(_0x4dff41){logger[_0x11ce('0x2b')](_0x4dff41[_0x11ce('0x2c')]);if(_0x4dff41[_0x11ce('0x2d')]){delete _0x4dff41['name'];}_0x3b4283[_0x11ce('0x1b')](_0x17f8f3)[_0x11ce('0x2e')](_0x4dff41);};}exports[_0x11ce('0x2f')]=function(_0x400cce,_0x4ec450){var _0x3e319f={},_0x55d126={},_0x1c4160={'count':0x0,'rows':[]};var _0x414fee=_[_0x11ce('0x30')](db[_0x11ce('0x31')][_0x11ce('0x32')],function(_0x496a90){return{'name':_0x496a90[_0x11ce('0x33')],'type':_0x496a90[_0x11ce('0x34')][_0x11ce('0x35')]};});_0x55d126['model']=_[_0x11ce('0x30')](_0x414fee,_0x11ce('0x2d'));_0x55d126['query']=_[_0x11ce('0x36')](_0x400cce['query']);_0x55d126[_0x11ce('0x37')]=_[_0x11ce('0x38')](_0x55d126[_0x11ce('0x39')],_0x55d126[_0x11ce('0x3a')]);_0x3e319f[_0x11ce('0x3b')]=_[_0x11ce('0x38')](_0x55d126[_0x11ce('0x39')],qs['fields'](_0x400cce[_0x11ce('0x3a')][_0x11ce('0x3c')]));_0x3e319f['attributes']=_0x3e319f['attributes']['length']?_0x3e319f[_0x11ce('0x3b')]:_0x55d126[_0x11ce('0x39')];if(!_0x400cce['query'][_0x11ce('0x3d')]('nolimit')){_0x3e319f[_0x11ce('0x1f')]=qs['limit'](_0x400cce['query'][_0x11ce('0x1f')]);_0x3e319f[_0x11ce('0x1d')]=qs['offset'](_0x400cce[_0x11ce('0x3a')][_0x11ce('0x1d')]);}_0x3e319f[_0x11ce('0x3e')]=qs[_0x11ce('0x3f')](_0x400cce[_0x11ce('0x3a')][_0x11ce('0x3f')]);_0x3e319f[_0x11ce('0x40')]=qs['filters'](_[_0x11ce('0x41')](_0x400cce[_0x11ce('0x3a')],_0x55d126[_0x11ce('0x37')]),_0x414fee);if(_0x400cce[_0x11ce('0x3a')][_0x11ce('0x42')]){_0x3e319f[_0x11ce('0x40')]=_[_0x11ce('0x43')](_0x3e319f[_0x11ce('0x40')],{'$or':_[_0x11ce('0x30')](_0x414fee,function(_0x404a84){if(_0x404a84[_0x11ce('0x34')]!=='VIRTUAL'){var _0x5e53b7={};_0x5e53b7[_0x404a84['name']]={'$like':'%'+_0x400cce[_0x11ce('0x3a')][_0x11ce('0x42')]+'%'};return _0x5e53b7;}})});}_0x3e319f=_['merge']({},_0x3e319f,_0x400cce[_0x11ce('0x44')]);var _0x26d55a={'where':_0x3e319f[_0x11ce('0x40')]};return db[_0x11ce('0x31')][_0x11ce('0x20')](_0x26d55a)[_0x11ce('0x27')](function(_0x329078){_0x1c4160[_0x11ce('0x20')]=_0x329078;if(_0x400cce[_0x11ce('0x3a')][_0x11ce('0x45')]){_0x3e319f[_0x11ce('0x46')]=[{'all':!![]}];}return db[_0x11ce('0x31')][_0x11ce('0x47')](_0x3e319f);})[_0x11ce('0x27')](function(_0xddc185){_0x1c4160[_0x11ce('0x48')]=_0xddc185;return _0x1c4160;})[_0x11ce('0x27')](respondWithFilteredResult(_0x4ec450,_0x3e319f))['catch'](handleError(_0x4ec450,null));};exports['show']=function(_0x587e79,_0x4b4fd5){var _0x1cd3b2={'raw':!![],'where':{'id':_0x587e79[_0x11ce('0x49')]['id']}},_0x1ccd26={};_0x1ccd26[_0x11ce('0x39')]=_['keys'](db['Interval'][_0x11ce('0x32')]);_0x1ccd26[_0x11ce('0x3a')]=_['keys'](_0x587e79['query']);_0x1ccd26[_0x11ce('0x37')]=_[_0x11ce('0x38')](_0x1ccd26[_0x11ce('0x39')],_0x1ccd26[_0x11ce('0x3a')]);_0x1cd3b2[_0x11ce('0x3b')]=_[_0x11ce('0x38')](_0x1ccd26[_0x11ce('0x39')],qs['fields'](_0x587e79['query'][_0x11ce('0x3c')]));_0x1cd3b2['attributes']=_0x1cd3b2['attributes'][_0x11ce('0x4a')]?_0x1cd3b2[_0x11ce('0x3b')]:_0x1ccd26[_0x11ce('0x39')];if(_0x587e79['query'][_0x11ce('0x45')]){_0x1cd3b2[_0x11ce('0x46')]=[{'all':!![]}];}_0x1cd3b2=_[_0x11ce('0x43')]({},_0x1cd3b2,_0x587e79[_0x11ce('0x44')]);return db[_0x11ce('0x31')]['find'](_0x1cd3b2)['then'](handleEntityNotFound(_0x4b4fd5,null))['then'](respondWithResult(_0x4b4fd5,null))[_0x11ce('0x4b')](handleError(_0x4b4fd5,null));};exports['create']=function(_0x662dcc,_0x5201b0){return db[_0x11ce('0x31')][_0x11ce('0x4c')](_0x662dcc[_0x11ce('0x4d')],{})['then'](function(_0x4ee800){var _0x539bb3=_0x662dcc[_0x11ce('0x4e')][_0x11ce('0x4f')]({'plain':!![]});if(!_0x539bb3)throw new Error(_0x11ce('0x50'));if(_0x539bb3[_0x11ce('0x51')]===_0x11ce('0x4e')){var _0x5f3b8e=_0x4ee800[_0x11ce('0x4f')]({'plain':!![]});var _0x8d0162='Intervals';return db['UserProfileSection'][_0x11ce('0x52')]({'where':{'name':_0x8d0162,'userProfileId':_0x539bb3[_0x11ce('0x53')]},'raw':!![]})[_0x11ce('0x27')](function(_0x32606b){if(_0x32606b&&_0x32606b[_0x11ce('0x54')]===0x0){return db[_0x11ce('0x29')][_0x11ce('0x4c')]({'name':_0x5f3b8e[_0x11ce('0x2d')],'resourceId':_0x5f3b8e['id'],'type':_0x32606b[_0x11ce('0x2d')],'sectionId':_0x32606b['id']},{})[_0x11ce('0x27')](function(){return _0x4ee800;});}else{return _0x4ee800;}})[_0x11ce('0x4b')](function(_0x29c70f){logger[_0x11ce('0x2b')](_0x11ce('0x55'),_0x29c70f);throw _0x29c70f;});}return _0x4ee800;})[_0x11ce('0x27')](respondWithResult(_0x5201b0,0xc9))['catch'](handleError(_0x5201b0,null));};exports[_0x11ce('0x26')]=function(_0x563b6e,_0x7d665b){if(_0x563b6e[_0x11ce('0x4d')]['id']){delete _0x563b6e[_0x11ce('0x4d')]['id'];}return db[_0x11ce('0x31')][_0x11ce('0x52')]({'where':{'id':_0x563b6e[_0x11ce('0x49')]['id']}})['then'](handleEntityNotFound(_0x7d665b,null))[_0x11ce('0x27')](saveUpdates(_0x563b6e[_0x11ce('0x4d')],null))[_0x11ce('0x27')](respondWithResult(_0x7d665b,null))[_0x11ce('0x4b')](handleError(_0x7d665b,null));};exports['destroy']=function(_0x18a258,_0x225765){return db[_0x11ce('0x31')][_0x11ce('0x52')]({'where':{'id':_0x18a258['params']['id']}})[_0x11ce('0x27')](handleEntityNotFound(_0x225765,null))[_0x11ce('0x27')](removeEntity(_0x225765,null))[_0x11ce('0x4b')](handleError(_0x225765,null));};exports[_0x11ce('0x56')]=function(_0x19f1da,_0x3cd267,_0x2ebca6){if(_0x19f1da['body']['id']){delete _0x19f1da[_0x11ce('0x4d')]['id'];}return db['Interval'][_0x11ce('0x52')]({'where':{'id':_0x19f1da['params']['id']}})[_0x11ce('0x27')](handleEntityNotFound(_0x3cd267,null))['then'](function(_0x3a18ff){if(_0x3a18ff){_0x19f1da[_0x11ce('0x4d')][_0x11ce('0x57')]=_0x3a18ff['id'];return db[_0x11ce('0x31')][_0x11ce('0x4c')](_0x19f1da['body']);}})['then'](respondWithResult(_0x3cd267,null))['catch'](handleError(_0x3cd267,null));};exports[_0x11ce('0x58')]=function(_0x358731,_0x5869f4,_0x27b441){var _0x435f02={};var _0x2fa64f={};var _0x5ed1ce;var _0xc96a8b;return db[_0x11ce('0x31')][_0x11ce('0x59')]({'where':{'id':_0x358731[_0x11ce('0x49')]['id']}})[_0x11ce('0x27')](handleEntityNotFound(_0x5869f4,null))['then'](function(_0x7ebc06){if(_0x7ebc06){_0x5ed1ce=_0x7ebc06;_0x2fa64f[_0x11ce('0x39')]=_[_0x11ce('0x36')](db['Interval'][_0x11ce('0x32')]);_0x2fa64f[_0x11ce('0x3a')]=_[_0x11ce('0x36')](_0x358731[_0x11ce('0x3a')]);_0x2fa64f[_0x11ce('0x37')]=_[_0x11ce('0x38')](_0x2fa64f[_0x11ce('0x39')],_0x2fa64f[_0x11ce('0x3a')]);_0x435f02['attributes']=_[_0x11ce('0x38')](_0x2fa64f[_0x11ce('0x39')],qs['fields'](_0x358731[_0x11ce('0x3a')][_0x11ce('0x3c')]));_0x435f02[_0x11ce('0x3b')]=_0x435f02[_0x11ce('0x3b')][_0x11ce('0x4a')]?_0x435f02[_0x11ce('0x3b')]:_0x2fa64f[_0x11ce('0x39')];_0x435f02[_0x11ce('0x3e')]=qs['sort'](_0x358731['query'][_0x11ce('0x3f')]);_0x435f02[_0x11ce('0x40')]=qs[_0x11ce('0x37')](_[_0x11ce('0x41')](_0x358731[_0x11ce('0x3a')],_0x2fa64f[_0x11ce('0x37')]));if(_0x358731[_0x11ce('0x3a')]['filter']){_0x435f02[_0x11ce('0x40')]=_[_0x11ce('0x43')](_0x435f02[_0x11ce('0x40')],{'$or':_[_0x11ce('0x30')](_0x435f02[_0x11ce('0x3b')],function(_0xdafa6b){var _0xce005d={};_0xce005d[_0xdafa6b]={'$like':'%'+_0x358731[_0x11ce('0x3a')]['filter']+'%'};return _0xce005d;})});}_0x435f02=_['merge']({},_0x435f02,_0x358731[_0x11ce('0x44')]);return _0x5ed1ce[_0x11ce('0x58')](_0x435f02);}})[_0x11ce('0x27')](function(_0x439dbd){if(_0x439dbd){_0xc96a8b=_0x439dbd['length'];if(!_0x358731[_0x11ce('0x3a')][_0x11ce('0x3d')]('nolimit')){_0x435f02[_0x11ce('0x1f')]=qs[_0x11ce('0x1f')](_0x358731[_0x11ce('0x3a')][_0x11ce('0x1f')]);_0x435f02[_0x11ce('0x1d')]=qs['offset'](_0x358731[_0x11ce('0x3a')]['offset']);}return _0x5ed1ce[_0x11ce('0x58')](_0x435f02);}})['then'](function(_0x5e35a8){if(_0x5e35a8){return _0x5e35a8?{'count':_0xc96a8b,'rows':_0x5e35a8}:null;}})[_0x11ce('0x27')](respondWithResult(_0x5869f4,null))[_0x11ce('0x4b')](handleError(_0x5869f4,null));};exports[_0x11ce('0x5a')]=function(_0x595917,_0xbe2cbf,_0x4a1124){return db['Interval'][_0x11ce('0x59')]({'where':{'id':_0x595917[_0x11ce('0x49')]['id']}})[_0x11ce('0x27')](handleEntityNotFound(_0xbe2cbf,null))[_0x11ce('0x27')](function(_0x5ea72c){if(_0x5ea72c){return db[_0x11ce('0x5b')][_0x11ce('0x5c')](function(_0x372957){return db[_0x11ce('0x31')][_0x11ce('0x28')]({'where':{'IntervalId':_0x595917[_0x11ce('0x49')]['id']},'transaction':_0x372957})[_0x11ce('0x27')](function(_0x135219){var _0x1f0317=_['map'](_0x595917['body'],function(_0x32c3f3){delete _0x32c3f3['id'];_0x32c3f3[_0x11ce('0x57')]=_0x595917['params']['id'];return _0x32c3f3;});return db[_0x11ce('0x31')]['bulkCreate'](_0x1f0317,{'transaction':_0x372957});});})['then'](function(){return db['Interval'][_0x11ce('0x47')]({'where':{'IntervalId':_0x595917['params']['id']}});});}})[_0x11ce('0x27')](respondWithResult(_0xbe2cbf,null))[_0x11ce('0x4b')](handleError(_0xbe2cbf,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index fd076ef..0d2cb6e 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 _0xb565=['rewrite','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','define','tools_intervals'];(function(_0x5bf3fe,_0x2f2ad0){var _0x586637=function(_0x57e785){while(--_0x57e785){_0x5bf3fe['push'](_0x5bf3fe['shift']());}};_0x586637(++_0x2f2ad0);}(_0xb565,0x1ef));var _0x5b56=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0xb565[_0x3b0d98];return _0x296885;};'use strict';var _=require(_0x5b56('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b56('0x1'));var moment=require(_0x5b56('0x2'));var BPromise=require(_0x5b56('0x3'));var rp=require(_0x5b56('0x4'));var fs=require('fs');var path=require(_0x5b56('0x5'));var rimraf=require(_0x5b56('0x6'));var config=require(_0x5b56('0x7'));var attributes=require(_0x5b56('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x5b56('0x9')]=function(_0x2debac,_0x7cdc0d){return _0x2debac[_0x5b56('0xa')]('Interval',attributes,{'tableName':_0x5b56('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3507d4,_0x181ff1){extensions['rewrite'](_0x2debac,_0x3507d4);},'afterBulkCreate':function(_0x5793f1,_0x425849,_0x2d12ef){_0x2d12ef();extensions['rewrite'](_0x2debac,_0x5793f1[0x0]);},'afterUpdate':function(_0x416cb5,_0x3a4ba8){extensions[_0x5b56('0xc')](_0x2debac,_0x416cb5);},'afterDestroy':function(_0x12fcb1,_0x534bab){extensions[_0x5b56('0xc')](_0x2debac,_0x12fcb1);}}});}; \ No newline at end of file +var _0x8838=['request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8838,0x90));var _0x8883=function(_0x3059d1,_0x4bacf2){_0x3059d1=_0x3059d1-0x0;var _0x91c31a=_0x8838[_0x3059d1];return _0x91c31a;};'use strict';var _=require(_0x8883('0x0'));var util=require(_0x8883('0x1'));var logger=require(_0x8883('0x2'))(_0x8883('0x3'));var moment=require(_0x8883('0x4'));var BPromise=require(_0x8883('0x5'));var rp=require(_0x8883('0x6'));var fs=require('fs');var path=require(_0x8883('0x7'));var rimraf=require(_0x8883('0x8'));var config=require(_0x8883('0x9'));var attributes=require(_0x8883('0xa'));var extensions=require(_0x8883('0xb'));module['exports']=function(_0x5061d6,_0x363519){return _0x5061d6['define'](_0x8883('0xc'),attributes,{'tableName':_0x8883('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x22060b,_0xeded88){extensions[_0x8883('0xe')](_0x5061d6,_0x22060b);},'afterBulkCreate':function(_0x2f91ae,_0x320367,_0x52e9fe){_0x52e9fe();extensions[_0x8883('0xe')](_0x5061d6,_0x2f91ae[0x0]);},'afterUpdate':function(_0x3d3a4a,_0x13f776){extensions[_0x8883('0xe')](_0x5061d6,_0x3d3a4a);},'afterDestroy':function(_0x4bea54,_0x10c259){extensions['rewrite'](_0x5061d6,_0x4bea54);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ebed9bf..a3e4b57 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(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_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 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 a43da1f..3b27319 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x380331,_0x1ae325){var _0x5da18d=function(_0x2bc21d){while(--_0x2bc21d){_0x380331['push'](_0x380331['shift']());}};_0x5da18d(++_0x1ae325);}(_0xdb28,0x106));var _0x8db2=function(_0x1195fd,_0x1e8901){_0x1195fd=_0x1195fd-0x0;var _0x142238=_0xdb28[_0x1195fd];return _0x142238;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x1840a4,_0x2edd45){var _0x26b335=function(_0x13bb78){while(--_0x13bb78){_0x1840a4['push'](_0x1840a4['shift']());}};_0x26b335(++_0x2edd45);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14d48b,_0x619802){_0x14d48b=_0x14d48b-0x0;var _0x33f149=_0x5f2f[_0x14d48b];return _0x33f149;};'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 676c91f..693349a 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 _0x6cb4=['email','customfield_11501','customfield_11502','customfield_11503','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','utf8','end','error','json','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','fields'];(function(_0x1d3059,_0x3278ce){var _0x567aab=function(_0x44a82d){while(--_0x44a82d){_0x1d3059['push'](_0x1d3059['shift']());}};_0x567aab(++_0x3278ce);}(_0x6cb4,0xd3));var _0x46cb=function(_0xebf33a,_0x3163ac){_0xebf33a=_0xebf33a-0x0;var _0x43b985=_0x6cb4[_0xebf33a];return _0x43b985;};'use strict';var BPromise=require(_0x46cb('0x0'));var https=require(_0x46cb('0x1'));var logger=require('../../config/logger')('api');var USERNAME=_0x46cb('0x2');var PASSWORD=_0x46cb('0x3');function openIssue(_0xc05394,_0x589ca9){var _0x30f242={'fields':{'project':{'key':_0xc05394[_0x46cb('0x4')]||'MOTGUI'},'summary':(_0xc05394[_0x46cb('0x5')]||_0x46cb('0x6'))+_0x46cb('0x7')+_0xc05394['ip'],'description':_0xc05394[_0x46cb('0x8')]||JSON[_0x46cb('0x9')](_0xc05394),'issuetype':{'name':_0xc05394['issuetype']||'Bug'}}};_0x30f242[_0x46cb('0xa')]['customfield_11500']=_0xc05394[_0x46cb('0xb')];_0x30f242[_0x46cb('0xa')][_0x46cb('0xc')]=_0xc05394['oldToken'];_0x30f242['fields'][_0x46cb('0xd')]=_0xc05394['newToken'];_0x30f242[_0x46cb('0xa')][_0x46cb('0xe')]=_0xc05394[_0x46cb('0xf')];_0x30f242[_0x46cb('0xa')]['customfield_11504']=_0xc05394[_0x46cb('0x10')];_0x30f242[_0x46cb('0xa')]['customfield_10102']=_0xc05394['ip'];var _0x148e28={'host':_0x46cb('0x11'),'port':0x1bb,'path':_0x46cb('0x12'),'method':_0x46cb('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x46cb('0x14'),'Authorization':_0x46cb('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x46cb('0x16'))}};var _0x30da8d=JSON[_0x46cb('0x9')](_0x30f242);var _0x407b09=https['request'](_0x148e28,function(_0x59540e){_0x59540e['setEncoding'](_0x46cb('0x17'));var _0x156fad='';_0x59540e['on']('data',function(_0x21345f){_0x156fad+=_0x21345f;});_0x59540e['on'](_0x46cb('0x18'),function(){if(_0x589ca9){return _0x589ca9['status'](_0x59540e['statusCode'])['json'](JSON['parse'](_0x156fad));}});});_0x407b09['on'](_0x46cb('0x19'),function(_0x28cb48){if(_0x589ca9){return _0x589ca9['status'](0x1f4)[_0x46cb('0x1a')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x46cb('0x1b')}]});}});_0x407b09[_0x46cb('0x1c')](_0x30da8d);_0x407b09['end']();}exports[_0x46cb('0x1d')]=openIssue;exports[_0x46cb('0x1e')]=function(_0x45a349,_0x23a20c){_0x45a349[_0x46cb('0x1f')]['ip']=_0x45a349[_0x46cb('0x20')][_0x46cb('0x21')]||_0x45a349[_0x46cb('0x22')]['remoteAddress']||_0x45a349[_0x46cb('0x23')][_0x46cb('0x24')]||_0x45a349['connection'][_0x46cb('0x23')][_0x46cb('0x24')];return openIssue(_0x45a349['body'],_0x23a20c);}; \ No newline at end of file +var _0x3e99=['fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','summary','Report','description'];(function(_0x3ce089,_0x1a4890){var _0x35b89d=function(_0x57f388){while(--_0x57f388){_0x3ce089['push'](_0x3ce089['shift']());}};_0x35b89d(++_0x1a4890);}(_0x3e99,0x139));var _0x93e9=function(_0x45b30a,_0x13ac08){_0x45b30a=_0x45b30a-0x0;var _0x111b5a=_0x3e99[_0x45b30a];return _0x111b5a;};'use strict';var BPromise=require(_0x93e9('0x0'));var https=require(_0x93e9('0x1'));var logger=require(_0x93e9('0x2'))(_0x93e9('0x3'));var USERNAME='support';var PASSWORD=_0x93e9('0x4');function openIssue(_0x4d12e9,_0x4906d8){var _0x3d45d3={'fields':{'project':{'key':_0x4d12e9['key']||_0x93e9('0x5')},'summary':(_0x4d12e9[_0x93e9('0x6')]||_0x93e9('0x7'))+'\x20from\x20'+_0x4d12e9['ip'],'description':_0x4d12e9[_0x93e9('0x8')]||JSON['stringify'](_0x4d12e9),'issuetype':{'name':_0x4d12e9['issuetype']||'Bug'}}};_0x3d45d3[_0x93e9('0x9')][_0x93e9('0xa')]=_0x4d12e9[_0x93e9('0xb')];_0x3d45d3[_0x93e9('0x9')][_0x93e9('0xc')]=_0x4d12e9[_0x93e9('0xd')];_0x3d45d3[_0x93e9('0x9')]['customfield_11502']=_0x4d12e9[_0x93e9('0xe')];_0x3d45d3[_0x93e9('0x9')][_0x93e9('0xf')]=_0x4d12e9[_0x93e9('0x10')];_0x3d45d3['fields'][_0x93e9('0x11')]=_0x4d12e9['reason'];_0x3d45d3[_0x93e9('0x9')][_0x93e9('0x12')]=_0x4d12e9['ip'];var _0x3a0888={'host':_0x93e9('0x13'),'port':0x1bb,'path':_0x93e9('0x14'),'method':_0x93e9('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x93e9('0x16'),'Authorization':_0x93e9('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x93e9('0x18')](_0x93e9('0x19'))}};var _0x4ee15f=JSON['stringify'](_0x3d45d3);var _0x79ece0=https[_0x93e9('0x1a')](_0x3a0888,function(_0x2be713){_0x2be713[_0x93e9('0x1b')](_0x93e9('0x1c'));var _0x57c5de='';_0x2be713['on'](_0x93e9('0x1d'),function(_0x1e4ec3){_0x57c5de+=_0x1e4ec3;});_0x2be713['on'](_0x93e9('0x1e'),function(){if(_0x4906d8){return _0x4906d8[_0x93e9('0x1f')](_0x2be713[_0x93e9('0x20')])['json'](JSON[_0x93e9('0x21')](_0x57c5de));}});});_0x79ece0['on'](_0x93e9('0x22'),function(_0x11d165){if(_0x4906d8){return _0x4906d8[_0x93e9('0x1f')](0x1f4)[_0x93e9('0x23')]({'errors':[{'message':_0x93e9('0x24'),'type':_0x93e9('0x25')}]});}});_0x79ece0[_0x93e9('0x26')](_0x4ee15f);_0x79ece0[_0x93e9('0x1e')]();}exports[_0x93e9('0x27')]=openIssue;exports['send']=function(_0x853062,_0x5e3045){_0x853062[_0x93e9('0x28')]['ip']=_0x853062[_0x93e9('0x29')][_0x93e9('0x2a')]||_0x853062[_0x93e9('0x2b')]['remoteAddress']||_0x853062[_0x93e9('0x2c')][_0x93e9('0x2d')]||_0x853062[_0x93e9('0x2b')][_0x93e9('0x2c')][_0x93e9('0x2d')];return openIssue(_0x853062['body'],_0x5e3045);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 76c9b69..d37b85f 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 _0xd2ea=['./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x128977,_0x33b053){var _0x4a761d=function(_0x5b94a3){while(--_0x5b94a3){_0x128977['push'](_0x128977['shift']());}};_0x4a761d(++_0x33b053);}(_0xd2ea,0x15f));var _0xad2e=function(_0x7dcad0,_0x417cb2){_0x7dcad0=_0x7dcad0-0x0;var _0x40dc00=_0xd2ea[_0x7dcad0];return _0x40dc00;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['describe']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);router['delete'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x12')]);module[_0xad2e('0x13')]=router; \ No newline at end of file +var _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x2f05c6,_0x42673e){var _0x21df7c=function(_0x416cdb){while(--_0x416cdb){_0x2f05c6['push'](_0x2f05c6['shift']());}};_0x21df7c(++_0x42673e);}(_0xa74f,0x9a));var _0xfa74=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0xa74f[_0x29e3ec];return _0x25727e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 044f1a3..f7635cb 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x9eca02,_0x49f194){_0x9eca02=_0x9eca02-0x0;var _0x170efe=_0x7a54[_0x9eca02];return _0x170efe;};'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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x157aaa,_0x523795){_0x157aaa=_0x157aaa-0x0;var _0x1195b4=_0x7a54[_0x157aaa];return _0x1195b4;};'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 525d958..58a004a 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 _0x72a2=['json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x72a2,0x161));var _0x272a=function(_0x3ff814,_0x3a77ef){_0x3ff814=_0x3ff814-0x0;var _0x33f802=_0x72a2[_0x3ff814];return _0x33f802;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x272a('0x0'));var zipdir=require(_0x272a('0x1'));var jsonpatch=require(_0x272a('0x2'));var rp=require(_0x272a('0x3'));var moment=require(_0x272a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x272a('0x5'));var util=require('util');var path=require(_0x272a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x272a('0x7'));var _=require(_0x272a('0x8'));var squel=require(_0x272a('0x9'));var crypto=require(_0x272a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x272a('0xb'));var querystring=require('querystring');var Papa=require(_0x272a('0xc'));var Redis=require('ioredis');var authService=require(_0x272a('0xd'));var qs=require(_0x272a('0xe'));var as=require(_0x272a('0xf'));var hardwareService=require(_0x272a('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x272a('0x11'));var config=require(_0x272a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x272a('0x13'))['db'];function respondWithStatusCode(_0x7cb1fe,_0x37ee7e){_0x37ee7e=_0x37ee7e||0xcc;return function(_0xa82788){if(_0xa82788){return _0x7cb1fe[_0x272a('0x14')](_0x37ee7e);}return _0x7cb1fe['status'](_0x37ee7e)[_0x272a('0x15')]();};}function respondWithResult(_0x2143a4,_0x43fce6){_0x43fce6=_0x43fce6||0xc8;return function(_0x167a72){if(_0x167a72){return _0x2143a4['status'](_0x43fce6)[_0x272a('0x16')](_0x167a72);}};}function respondWithFilteredResult(_0x9414d6,_0x5b615a){return function(_0x4e3661){if(_0x4e3661){var _0x4cfb67=typeof _0x5b615a['offset']==='undefined'&&typeof _0x5b615a['limit']===_0x272a('0x17');var _0x48bf3d=_0x4e3661[_0x272a('0x18')];var _0x327f68=_0x4cfb67?0x0:_0x5b615a[_0x272a('0x19')];var _0x3325b2=_0x4cfb67?_0x4e3661['count']:_0x5b615a[_0x272a('0x19')]+_0x5b615a[_0x272a('0x1a')];var _0x2675be;if(_0x3325b2>=_0x48bf3d){_0x3325b2=_0x48bf3d;_0x2675be=0xc8;}else{_0x2675be=0xce;}_0x9414d6[_0x272a('0x1b')](_0x2675be);return _0x9414d6[_0x272a('0x1c')](_0x272a('0x1d'),_0x327f68+'-'+_0x3325b2+'/'+_0x48bf3d)[_0x272a('0x16')](_0x4e3661);}return null;};}function patchUpdates(_0x5cc0d6){return function(_0x393e68){try{jsonpatch[_0x272a('0x1e')](_0x393e68,_0x5cc0d6,!![]);}catch(_0x12c1c3){return BPromise[_0x272a('0x1f')](_0x12c1c3);}return _0x393e68[_0x272a('0x20')]();};}function saveUpdates(_0x297562,_0x4ac0bb){return function(_0x1bfe85){if(_0x1bfe85){return _0x1bfe85['update'](_0x297562)[_0x272a('0x21')](function(_0x504868){return _0x504868;});}return null;};}function removeEntity(_0x3ec1c3,_0x5a7003){return function(_0x13081e){if(_0x13081e){return _0x13081e[_0x272a('0x22')]()[_0x272a('0x21')](function(){_0x3ec1c3[_0x272a('0x1b')](0xcc)[_0x272a('0x15')]();});}};}function handleEntityNotFound(_0x4554b1,_0x15d35c){return function(_0x8138e2){if(!_0x8138e2){_0x4554b1[_0x272a('0x14')](0x194);}return _0x8138e2;};}function handleError(_0x4d1293,_0xc743bc){_0xc743bc=_0xc743bc||0x1f4;return function(_0x6312d4){logger[_0x272a('0x23')](_0x6312d4[_0x272a('0x24')]);if(_0x6312d4[_0x272a('0x25')]){delete _0x6312d4['name'];}_0x4d1293['status'](_0xc743bc)[_0x272a('0x26')](_0x6312d4);};}exports[_0x272a('0x27')]=function(_0x654dc6,_0x1bce15){var _0x62a99c={},_0x73707b={},_0x10d03c={'count':0x0,'rows':[]};var _0x142f1=_[_0x272a('0x28')](db[_0x272a('0x29')][_0x272a('0x2a')],function(_0x5104f3){return{'name':_0x5104f3['fieldName'],'type':_0x5104f3['type'][_0x272a('0x2b')]};});_0x73707b['model']=_[_0x272a('0x28')](_0x142f1,_0x272a('0x25'));_0x73707b['query']=_[_0x272a('0x2c')](_0x654dc6[_0x272a('0x2d')]);_0x73707b[_0x272a('0x2e')]=_[_0x272a('0x2f')](_0x73707b[_0x272a('0x30')],_0x73707b[_0x272a('0x2d')]);_0x62a99c[_0x272a('0x31')]=_[_0x272a('0x2f')](_0x73707b['model'],qs[_0x272a('0x32')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x32')]));_0x62a99c['attributes']=_0x62a99c[_0x272a('0x31')]['length']?_0x62a99c['attributes']:_0x73707b[_0x272a('0x30')];if(!_0x654dc6['query'][_0x272a('0x33')](_0x272a('0x34'))){_0x62a99c[_0x272a('0x1a')]=qs[_0x272a('0x1a')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x1a')]);_0x62a99c['offset']=qs[_0x272a('0x19')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x19')]);}_0x62a99c[_0x272a('0x35')]=qs[_0x272a('0x36')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x36')]);_0x62a99c['where']=qs[_0x272a('0x2e')](_[_0x272a('0x37')](_0x654dc6[_0x272a('0x2d')],_0x73707b[_0x272a('0x2e')]),_0x142f1);if(_0x654dc6[_0x272a('0x2d')][_0x272a('0x38')]){_0x62a99c['where']=_['merge'](_0x62a99c[_0x272a('0x39')],{'$or':_[_0x272a('0x28')](_0x142f1,function(_0x20e5b6){if(_0x20e5b6[_0x272a('0x3a')]!==_0x272a('0x3b')){var _0xf9b46={};_0xf9b46[_0x20e5b6[_0x272a('0x25')]]={'$like':'%'+_0x654dc6[_0x272a('0x2d')][_0x272a('0x38')]+'%'};return _0xf9b46;}})});}_0x62a99c=_[_0x272a('0x3c')]({},_0x62a99c,_0x654dc6[_0x272a('0x3d')]);var _0x46227e={'where':_0x62a99c[_0x272a('0x39')]};return db[_0x272a('0x29')][_0x272a('0x18')](_0x46227e)['then'](function(_0x33abdd){_0x10d03c[_0x272a('0x18')]=_0x33abdd;if(_0x654dc6['query'][_0x272a('0x3e')]){_0x62a99c[_0x272a('0x3f')]=[{'all':!![]}];}return db[_0x272a('0x29')][_0x272a('0x40')](_0x62a99c);})[_0x272a('0x21')](function(_0x357712){_0x10d03c[_0x272a('0x41')]=_0x357712;return _0x10d03c;})['then'](respondWithFilteredResult(_0x1bce15,_0x62a99c))[_0x272a('0x42')](handleError(_0x1bce15,null));};exports[_0x272a('0x43')]=function(_0x5a7a12,_0x48c7b0){var _0x35be0e={'raw':!![],'where':{'id':_0x5a7a12[_0x272a('0x44')]['id']}},_0x47fcbd={};_0x47fcbd[_0x272a('0x30')]=_[_0x272a('0x2c')](db[_0x272a('0x29')][_0x272a('0x2a')]);_0x47fcbd[_0x272a('0x2d')]=_['keys'](_0x5a7a12[_0x272a('0x2d')]);_0x47fcbd[_0x272a('0x2e')]=_['intersection'](_0x47fcbd[_0x272a('0x30')],_0x47fcbd[_0x272a('0x2d')]);_0x35be0e['attributes']=_[_0x272a('0x2f')](_0x47fcbd[_0x272a('0x30')],qs[_0x272a('0x32')](_0x5a7a12[_0x272a('0x2d')][_0x272a('0x32')]));_0x35be0e[_0x272a('0x31')]=_0x35be0e['attributes'][_0x272a('0x45')]?_0x35be0e[_0x272a('0x31')]:_0x47fcbd[_0x272a('0x30')];if(_0x5a7a12['query'][_0x272a('0x3e')]){_0x35be0e[_0x272a('0x3f')]=[{'all':!![]}];}_0x35be0e=_['merge']({},_0x35be0e,_0x5a7a12[_0x272a('0x3d')]);return db[_0x272a('0x29')][_0x272a('0x46')](_0x35be0e)[_0x272a('0x21')](handleEntityNotFound(_0x48c7b0,null))[_0x272a('0x21')](respondWithResult(_0x48c7b0,null))[_0x272a('0x42')](handleError(_0x48c7b0,null));};exports[_0x272a('0x47')]=function(_0x4d2f43,_0x53a627){return db['JscriptyAnswerReport']['create'](_0x4d2f43[_0x272a('0x48')],{})[_0x272a('0x21')](respondWithResult(_0x53a627,0xc9))[_0x272a('0x42')](handleError(_0x53a627,null));};exports[_0x272a('0x49')]=function(_0x4bb335,_0x96d803){if(_0x4bb335[_0x272a('0x48')]['id']){delete _0x4bb335['body']['id'];}return db[_0x272a('0x29')][_0x272a('0x46')]({'where':{'id':_0x4bb335[_0x272a('0x44')]['id']}})[_0x272a('0x21')](handleEntityNotFound(_0x96d803,null))[_0x272a('0x21')](saveUpdates(_0x4bb335[_0x272a('0x48')],null))[_0x272a('0x21')](respondWithResult(_0x96d803,null))[_0x272a('0x42')](handleError(_0x96d803,null));};exports[_0x272a('0x22')]=function(_0x961994,_0x313723){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x961994[_0x272a('0x44')]['id']}})['then'](handleEntityNotFound(_0x313723,null))[_0x272a('0x21')](removeEntity(_0x313723,null))[_0x272a('0x42')](handleError(_0x313723,null));};exports[_0x272a('0x4a')]=function(_0xc9e362,_0x40c86c){return db['JscriptyAnswerReport']['describe']()[_0x272a('0x21')](respondWithResult(_0x40c86c,null))['catch'](handleError(_0x40c86c,null));}; \ No newline at end of file +var _0xd2bb=['destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','create','body','find'];(function(_0x522d90,_0x41aaaa){var _0x7b25b8=function(_0x4c828e){while(--_0x4c828e){_0x522d90['push'](_0x522d90['shift']());}};_0x7b25b8(++_0x41aaaa);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x27106f,_0x1aa316){_0x27106f=_0x27106f-0x0;var _0x527542=_0xd2bb[_0x27106f];return _0x527542;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd2b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd2b('0x1'));var rp=require(_0xbd2b('0x2'));var moment=require(_0xbd2b('0x3'));var BPromise=require(_0xbd2b('0x4'));var Mustache=require(_0xbd2b('0x5'));var util=require(_0xbd2b('0x6'));var path=require('path');var sox=require(_0xbd2b('0x7'));var csv=require(_0xbd2b('0x8'));var ejs=require(_0xbd2b('0x9'));var fs=require('fs');var fs_extra=require(_0xbd2b('0xa'));var _=require(_0xbd2b('0xb'));var squel=require(_0xbd2b('0xc'));var crypto=require(_0xbd2b('0xd'));var jsforce=require(_0xbd2b('0xe'));var deskjs=require(_0xbd2b('0xf'));var toCsv=require(_0xbd2b('0x8'));var querystring=require('querystring');var Papa=require(_0xbd2b('0x10'));var Redis=require('ioredis');var authService=require(_0xbd2b('0x11'));var qs=require(_0xbd2b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd2b('0x13'));var logger=require(_0xbd2b('0x14'))(_0xbd2b('0x15'));var utils=require(_0xbd2b('0x16'));var config=require(_0xbd2b('0x17'));var licenseUtil=require(_0xbd2b('0x18'));var db=require(_0xbd2b('0x19'))['db'];function respondWithStatusCode(_0x275b60,_0x5722a4){_0x5722a4=_0x5722a4||0xcc;return function(_0x35c2c0){if(_0x35c2c0){return _0x275b60[_0xbd2b('0x1a')](_0x5722a4);}return _0x275b60[_0xbd2b('0x1b')](_0x5722a4)[_0xbd2b('0x1c')]();};}function respondWithResult(_0x29f3d1,_0x5f246b){_0x5f246b=_0x5f246b||0xc8;return function(_0x1ccc21){if(_0x1ccc21){return _0x29f3d1[_0xbd2b('0x1b')](_0x5f246b)[_0xbd2b('0x1d')](_0x1ccc21);}};}function respondWithFilteredResult(_0x1018dc,_0x1815b3){return function(_0x2d8352){if(_0x2d8352){var _0x29c6a6=typeof _0x1815b3[_0xbd2b('0x1e')]===_0xbd2b('0x1f')&&typeof _0x1815b3['limit']===_0xbd2b('0x1f');var _0x268025=_0x2d8352[_0xbd2b('0x20')];var _0x19ee5c=_0x29c6a6?0x0:_0x1815b3[_0xbd2b('0x1e')];var _0x112b5e=_0x29c6a6?_0x2d8352[_0xbd2b('0x20')]:_0x1815b3[_0xbd2b('0x1e')]+_0x1815b3[_0xbd2b('0x21')];var _0x17c63d;if(_0x112b5e>=_0x268025){_0x112b5e=_0x268025;_0x17c63d=0xc8;}else{_0x17c63d=0xce;}_0x1018dc['status'](_0x17c63d);return _0x1018dc[_0xbd2b('0x22')](_0xbd2b('0x23'),_0x19ee5c+'-'+_0x112b5e+'/'+_0x268025)[_0xbd2b('0x1d')](_0x2d8352);}return null;};}function patchUpdates(_0x12d252){return function(_0xc1ce31){try{jsonpatch[_0xbd2b('0x24')](_0xc1ce31,_0x12d252,!![]);}catch(_0x2a66a3){return BPromise['reject'](_0x2a66a3);}return _0xc1ce31['save']();};}function saveUpdates(_0x4a3588,_0x2fb14b){return function(_0x51fd7b){if(_0x51fd7b){return _0x51fd7b[_0xbd2b('0x25')](_0x4a3588)[_0xbd2b('0x26')](function(_0x48d06d){return _0x48d06d;});}return null;};}function removeEntity(_0x5b6b31,_0x1a2b3d){return function(_0x1e3609){if(_0x1e3609){return _0x1e3609['destroy']()['then'](function(){_0x5b6b31['status'](0xcc)[_0xbd2b('0x1c')]();});}};}function handleEntityNotFound(_0x43a7c5,_0x9c5ba7){return function(_0xf22365){if(!_0xf22365){_0x43a7c5[_0xbd2b('0x1a')](0x194);}return _0xf22365;};}function handleError(_0x21ce4d,_0x5bf25b){_0x5bf25b=_0x5bf25b||0x1f4;return function(_0x51e091){logger[_0xbd2b('0x27')](_0x51e091[_0xbd2b('0x28')]);if(_0x51e091['name']){delete _0x51e091[_0xbd2b('0x29')];}_0x21ce4d[_0xbd2b('0x1b')](_0x5bf25b)[_0xbd2b('0x2a')](_0x51e091);};}exports[_0xbd2b('0x2b')]=function(_0x54ad15,_0x21dcd8){var _0x5cb9a0={},_0x28ba11={},_0x364755={'count':0x0,'rows':[]};var _0x32d59c=_[_0xbd2b('0x2c')](db[_0xbd2b('0x2d')][_0xbd2b('0x2e')],function(_0x117c1f){return{'name':_0x117c1f['fieldName'],'type':_0x117c1f[_0xbd2b('0x2f')]['key']};});_0x28ba11[_0xbd2b('0x30')]=_[_0xbd2b('0x2c')](_0x32d59c,'name');_0x28ba11['query']=_[_0xbd2b('0x31')](_0x54ad15[_0xbd2b('0x32')]);_0x28ba11[_0xbd2b('0x33')]=_[_0xbd2b('0x34')](_0x28ba11[_0xbd2b('0x30')],_0x28ba11['query']);_0x5cb9a0[_0xbd2b('0x35')]=_[_0xbd2b('0x34')](_0x28ba11[_0xbd2b('0x30')],qs[_0xbd2b('0x36')](_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x36')]));_0x5cb9a0[_0xbd2b('0x35')]=_0x5cb9a0['attributes'][_0xbd2b('0x37')]?_0x5cb9a0['attributes']:_0x28ba11['model'];if(!_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x38')](_0xbd2b('0x39'))){_0x5cb9a0['limit']=qs['limit'](_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x21')]);_0x5cb9a0[_0xbd2b('0x1e')]=qs[_0xbd2b('0x1e')](_0x54ad15[_0xbd2b('0x32')]['offset']);}_0x5cb9a0[_0xbd2b('0x3a')]=qs[_0xbd2b('0x3b')](_0x54ad15['query'][_0xbd2b('0x3b')]);_0x5cb9a0['where']=qs[_0xbd2b('0x33')](_[_0xbd2b('0x3c')](_0x54ad15[_0xbd2b('0x32')],_0x28ba11[_0xbd2b('0x33')]),_0x32d59c);if(_0x54ad15['query'][_0xbd2b('0x3d')]){_0x5cb9a0[_0xbd2b('0x3e')]=_[_0xbd2b('0x3f')](_0x5cb9a0[_0xbd2b('0x3e')],{'$or':_['map'](_0x32d59c,function(_0xa1134d){if(_0xa1134d['type']!==_0xbd2b('0x40')){var _0x3122da={};_0x3122da[_0xa1134d[_0xbd2b('0x29')]]={'$like':'%'+_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x3d')]+'%'};return _0x3122da;}})});}_0x5cb9a0=_['merge']({},_0x5cb9a0,_0x54ad15[_0xbd2b('0x41')]);var _0x5050de={'where':_0x5cb9a0[_0xbd2b('0x3e')]};return db['JscriptyAnswerReport'][_0xbd2b('0x20')](_0x5050de)[_0xbd2b('0x26')](function(_0x10ad62){_0x364755[_0xbd2b('0x20')]=_0x10ad62;if(_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x42')]){_0x5cb9a0['include']=[{'all':!![]}];}return db[_0xbd2b('0x2d')][_0xbd2b('0x43')](_0x5cb9a0);})[_0xbd2b('0x26')](function(_0x4bcdee){_0x364755['rows']=_0x4bcdee;return _0x364755;})['then'](respondWithFilteredResult(_0x21dcd8,_0x5cb9a0))[_0xbd2b('0x44')](handleError(_0x21dcd8,null));};exports[_0xbd2b('0x45')]=function(_0x1c5b08,_0x903b22){var _0x309ad2={'raw':!![],'where':{'id':_0x1c5b08[_0xbd2b('0x46')]['id']}},_0x47b68d={};_0x47b68d['model']=_[_0xbd2b('0x31')](db['JscriptyAnswerReport'][_0xbd2b('0x2e')]);_0x47b68d[_0xbd2b('0x32')]=_[_0xbd2b('0x31')](_0x1c5b08['query']);_0x47b68d['filters']=_[_0xbd2b('0x34')](_0x47b68d['model'],_0x47b68d[_0xbd2b('0x32')]);_0x309ad2[_0xbd2b('0x35')]=_[_0xbd2b('0x34')](_0x47b68d[_0xbd2b('0x30')],qs[_0xbd2b('0x36')](_0x1c5b08[_0xbd2b('0x32')][_0xbd2b('0x36')]));_0x309ad2[_0xbd2b('0x35')]=_0x309ad2['attributes'][_0xbd2b('0x37')]?_0x309ad2['attributes']:_0x47b68d['model'];if(_0x1c5b08['query'][_0xbd2b('0x42')]){_0x309ad2['include']=[{'all':!![]}];}_0x309ad2=_[_0xbd2b('0x3f')]({},_0x309ad2,_0x1c5b08[_0xbd2b('0x41')]);return db[_0xbd2b('0x2d')]['find'](_0x309ad2)[_0xbd2b('0x26')](handleEntityNotFound(_0x903b22,null))['then'](respondWithResult(_0x903b22,null))[_0xbd2b('0x44')](handleError(_0x903b22,null));};exports[_0xbd2b('0x47')]=function(_0x10b28a,_0x2dae90){return db[_0xbd2b('0x2d')][_0xbd2b('0x47')](_0x10b28a['body'],{})[_0xbd2b('0x26')](respondWithResult(_0x2dae90,0xc9))[_0xbd2b('0x44')](handleError(_0x2dae90,null));};exports[_0xbd2b('0x25')]=function(_0x18361d,_0x3cf8be){if(_0x18361d[_0xbd2b('0x48')]['id']){delete _0x18361d[_0xbd2b('0x48')]['id'];}return db['JscriptyAnswerReport'][_0xbd2b('0x49')]({'where':{'id':_0x18361d['params']['id']}})[_0xbd2b('0x26')](handleEntityNotFound(_0x3cf8be,null))[_0xbd2b('0x26')](saveUpdates(_0x18361d[_0xbd2b('0x48')],null))[_0xbd2b('0x26')](respondWithResult(_0x3cf8be,null))[_0xbd2b('0x44')](handleError(_0x3cf8be,null));};exports[_0xbd2b('0x4a')]=function(_0x304d11,_0x35ccf5){return db[_0xbd2b('0x2d')][_0xbd2b('0x49')]({'where':{'id':_0x304d11[_0xbd2b('0x46')]['id']}})['then'](handleEntityNotFound(_0x35ccf5,null))[_0xbd2b('0x26')](removeEntity(_0x35ccf5,null))['catch'](handleError(_0x35ccf5,null));};exports[_0xbd2b('0x4b')]=function(_0x4a88db,_0x21ee9e){return db[_0xbd2b('0x2d')][_0xbd2b('0x4b')]()[_0xbd2b('0x26')](respondWithResult(_0x21ee9e,null))['catch'](handleError(_0x21ee9e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 666d289..af69692 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 _0xa57e=['request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','api','moment','bluebird'];(function(_0x1f8f48,_0x53b717){var _0x4396f4=function(_0x745781){while(--_0x745781){_0x1f8f48['push'](_0x1f8f48['shift']());}};_0x4396f4(++_0x53b717);}(_0xa57e,0x1bf));var _0xea57=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa57e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xea57('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xea57('0x1'));var moment=require(_0xea57('0x2'));var BPromise=require(_0xea57('0x3'));var rp=require(_0xea57('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea57('0x5'));var config=require(_0xea57('0x6'));var attributes=require(_0xea57('0x7'));module['exports']=function(_0x5cd5ec,_0x5726d7){return _0x5cd5ec[_0xea57('0x8')](_0xea57('0x9'),attributes,{'tableName':_0xea57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x192f=['api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger'];(function(_0x78f66a,_0x40d3d5){var _0x4c485e=function(_0x12e683){while(--_0x12e683){_0x78f66a['push'](_0x78f66a['shift']());}};_0x4c485e(++_0x40d3d5);}(_0x192f,0x1eb));var _0xf192=function(_0x44ea69,_0xe31a9a){_0x44ea69=_0x44ea69-0x0;var _0x3873f0=_0x192f[_0x44ea69];return _0x3873f0;};'use strict';var _=require(_0xf192('0x0'));var util=require(_0xf192('0x1'));var logger=require(_0xf192('0x2'))(_0xf192('0x3'));var moment=require(_0xf192('0x4'));var BPromise=require(_0xf192('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf192('0x6'));var rimraf=require(_0xf192('0x7'));var config=require(_0xf192('0x8'));var attributes=require(_0xf192('0x9'));module[_0xf192('0xa')]=function(_0x2b4c6f,_0x4aef3c){return _0x2b4c6f[_0xf192('0xb')](_0xf192('0xc'),attributes,{'tableName':'report_jscripty_answers','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 d2b06a5..3006a38 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 _0x689f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x1a214f,_0x536977){var _0xc90977=function(_0x5db535){while(--_0x5db535){_0x1a214f['push'](_0x1a214f['shift']());}};_0xc90977(++_0x536977);}(_0x689f,0x14a));var _0xf689=function(_0x403230,_0x100c91){_0x403230=_0x403230-0x0;var _0x246eb3=_0x689f[_0x403230];return _0x246eb3;};'use strict';var _=require(_0xf689('0x0'));var util=require(_0xf689('0x1'));var moment=require('moment');var BPromise=require(_0xf689('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf689('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf689('0x4'));var logger=require(_0xf689('0x5'))(_0xf689('0x6'));var config=require(_0xf689('0x7'));var jayson=require(_0xf689('0x8'));var client=jayson[_0xf689('0x9')][_0xf689('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41b85c,_0x5e5eba,_0x30b308){return new BPromise(function(_0x1448f8,_0x566975){return client[_0xf689('0xb')](_0x41b85c,_0x30b308)[_0xf689('0xc')](function(_0x1f7c02){logger[_0xf689('0xd')](_0xf689('0xe'),_0x5e5eba,_0xf689('0xf'));logger[_0xf689('0x10')](_0xf689('0x11'),_0x5e5eba,_0xf689('0xf'),JSON[_0xf689('0x12')](_0x1f7c02));if(_0x1f7c02[_0xf689('0x13')]){if(_0x1f7c02[_0xf689('0x13')][_0xf689('0x14')]===0x1f4){logger[_0xf689('0x13')](_0xf689('0xe'),_0x5e5eba,_0x1f7c02[_0xf689('0x13')]['message']);return _0x566975(_0x1f7c02[_0xf689('0x13')]['message']);}logger[_0xf689('0x13')](_0xf689('0xe'),_0x5e5eba,_0x1f7c02[_0xf689('0x13')][_0xf689('0x15')]);return _0x1448f8(_0x1f7c02[_0xf689('0x13')][_0xf689('0x15')]);}else{logger[_0xf689('0xd')](_0xf689('0xe'),_0x5e5eba,'request\x20sent');_0x1448f8(_0x1f7c02[_0xf689('0x16')]['message']);}})[_0xf689('0x17')](function(_0x474e7){logger['error'](_0xf689('0xe'),_0x5e5eba,_0x474e7);_0x566975(_0x474e7);});});} \ No newline at end of file +var _0xf381=['client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x24c24e,_0x1649a0){var _0x2b0732=function(_0x112e87){while(--_0x112e87){_0x24c24e['push'](_0x24c24e['shift']());}};_0x2b0732(++_0x1649a0);}(_0xf381,0x110));var _0x1f38=function(_0x180667,_0x3fc297){_0x180667=_0x180667-0x0;var _0x3b3d68=_0xf381[_0x180667];return _0x3b3d68;};'use strict';var _=require('lodash');var util=require(_0x1f38('0x0'));var moment=require(_0x1f38('0x1'));var BPromise=require(_0x1f38('0x2'));var rs=require(_0x1f38('0x3'));var fs=require('fs');var Redis=require(_0x1f38('0x4'));var db=require(_0x1f38('0x5'))['db'];var utils=require(_0x1f38('0x6'));var logger=require('../../config/logger')(_0x1f38('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f38('0x8')][_0x1f38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x264847,_0x4aa67e,_0x20d895){return new BPromise(function(_0x1a3ce4,_0x357bfb){return client[_0x1f38('0xa')](_0x264847,_0x20d895)['then'](function(_0x51515e){logger[_0x1f38('0xb')](_0x1f38('0xc'),_0x4aa67e,_0x1f38('0xd'));logger['debug'](_0x1f38('0xe'),_0x4aa67e,'request\x20sent',JSON[_0x1f38('0xf')](_0x51515e));if(_0x51515e[_0x1f38('0x10')]){if(_0x51515e['error'][_0x1f38('0x11')]===0x1f4){logger['error'](_0x1f38('0xc'),_0x4aa67e,_0x51515e['error'][_0x1f38('0x12')]);return _0x357bfb(_0x51515e[_0x1f38('0x10')][_0x1f38('0x12')]);}logger[_0x1f38('0x10')](_0x1f38('0xc'),_0x4aa67e,_0x51515e[_0x1f38('0x10')][_0x1f38('0x12')]);return _0x1a3ce4(_0x51515e[_0x1f38('0x10')][_0x1f38('0x12')]);}else{logger[_0x1f38('0xb')](_0x1f38('0xc'),_0x4aa67e,'request\x20sent');_0x1a3ce4(_0x51515e[_0x1f38('0x13')][_0x1f38('0x12')]);}})['catch'](function(_0x31aa50){logger[_0x1f38('0x10')](_0x1f38('0xc'),_0x4aa67e,_0x31aa50);_0x357bfb(_0x31aa50);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index df9b1b7..83b9a4c 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 _0x24d6=['update','delete','/:id','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put'];(function(_0x5aa0c7,_0x59fc48){var _0x2fe4bc=function(_0x5b1bff){while(--_0x5b1bff){_0x5aa0c7['push'](_0x5aa0c7['shift']());}};_0x2fe4bc(++_0x59fc48);}(_0x24d6,0xa7));var _0x624d=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x24d6[_0x16938f];return _0x5c66e9;};'use strict';var multer=require(_0x624d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x624d('0x1'));var router=express[_0x624d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x624d('0x3'));var interaction=require(_0x624d('0x4'));var config=require(_0x624d('0x5'));var controller=require(_0x624d('0x6'));router[_0x624d('0x7')]('/',auth['isAuthenticated'](),controller[_0x624d('0x8')]);router['get']('/:id',auth[_0x624d('0x9')](),controller[_0x624d('0xa')]);router[_0x624d('0x7')](_0x624d('0xb'),auth['isAuthenticated'](),controller[_0x624d('0xc')]);router[_0x624d('0x7')](_0x624d('0xd'),auth['isAuthenticated'](),controller[_0x624d('0xe')]);router[_0x624d('0x7')](_0x624d('0xf'),auth[_0x624d('0x9')](),timeout(_0x624d('0x10')),controller[_0x624d('0x11')]);router[_0x624d('0x12')]('/',auth[_0x624d('0x9')](),controller['create']);router['post'](_0x624d('0x13'),auth[_0x624d('0x9')](),controller[_0x624d('0x14')]);router[_0x624d('0x15')]('/:id',auth[_0x624d('0x9')](),controller[_0x624d('0x16')]);router[_0x624d('0x17')](_0x624d('0x18'),auth[_0x624d('0x9')](),controller[_0x624d('0x19')]);module[_0x624d('0x1a')]=router; \ No newline at end of file +var _0xd82c=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','/:id/clone','clone','put','update'];(function(_0x15d030,_0x2903eb){var _0x140974=function(_0x50988f){while(--_0x50988f){_0x15d030['push'](_0x15d030['shift']());}};_0x140974(++_0x2903eb);}(_0xd82c,0x1c4));var _0xcd82=function(_0x15ec0a,_0x37b97d){_0x15ec0a=_0x15ec0a-0x0;var _0x2ccf00=_0xd82c[_0x15ec0a];return _0x2ccf00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcd82('0x0'));var timeout=require(_0xcd82('0x1'));var express=require(_0xcd82('0x2'));var router=express[_0xcd82('0x3')]();var fs_extra=require(_0xcd82('0x4'));var auth=require(_0xcd82('0x5'));var interaction=require(_0xcd82('0x6'));var config=require('../../config/environment');var controller=require(_0xcd82('0x7'));router[_0xcd82('0x8')]('/',auth[_0xcd82('0x9')](),controller['index']);router[_0xcd82('0x8')](_0xcd82('0xa'),auth[_0xcd82('0x9')](),controller['show']);router['get'](_0xcd82('0xb'),auth[_0xcd82('0x9')](),controller[_0xcd82('0xc')]);router[_0xcd82('0x8')](_0xcd82('0xd'),auth[_0xcd82('0x9')](),controller[_0xcd82('0xe')]);router['get'](_0xcd82('0xf'),auth[_0xcd82('0x9')](),timeout(_0xcd82('0x10')),controller[_0xcd82('0x11')]);router['post']('/',auth[_0xcd82('0x9')](),controller[_0xcd82('0x12')]);router['post'](_0xcd82('0x13'),auth[_0xcd82('0x9')](),controller[_0xcd82('0x14')]);router[_0xcd82('0x15')]('/:id',auth[_0xcd82('0x9')](),controller[_0xcd82('0x16')]);router['delete'](_0xcd82('0xa'),auth[_0xcd82('0x9')](),controller[_0xcd82('0x17')]);module[_0xcd82('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 16b9471..d171947 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 _0x20ec=['isObjectLike','formData','isString','setDataValue','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name','STRING','long'];(function(_0xd6bb26,_0x63ff2){var _0x122866=function(_0x4e0feb){while(--_0x4e0feb){_0xd6bb26['push'](_0xd6bb26['shift']());}};_0x122866(++_0x63ff2);}(_0x20ec,0x18f));var _0xc20e=function(_0x4c89cd,_0x2c57e2){_0x4c89cd=_0x4c89cd-0x0;var _0x1090d2=_0x20ec[_0x4c89cd];return _0x1090d2;};'use strict';var Sequelize=require(_0xc20e('0x0'));var _=require(_0xc20e('0x1'));var util=require(_0xc20e('0x2'));module[_0xc20e('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0xc20e('0x4')},'description':{'type':Sequelize[_0xc20e('0x5')]},'formData':{'type':Sequelize['TEXT'](_0xc20e('0x6')),'set':function(_0x29cd0d){if(_[_0xc20e('0x7')](_0x29cd0d)){this['setDataValue'](_0xc20e('0x8'),JSON['stringify'](_0x29cd0d));}else if(_[_0xc20e('0x9')](_0x29cd0d)){this['setDataValue'](_0xc20e('0x8'),_0x29cd0d);}else{this[_0xc20e('0xa')](_0xc20e('0x8'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xc20e('0x4'))||'',this[_0xc20e('0xb')](_0xc20e('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc20e('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2728=['util','exports','name','STRING','long','isObjectLike','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0xda6d0f,_0x35e271){var _0x244540=function(_0x30f643){while(--_0x30f643){_0xda6d0f['push'](_0xda6d0f['shift']());}};_0x244540(++_0x35e271);}(_0x2728,0x98));var _0x8272=function(_0x2fc83d,_0x418055){_0x2fc83d=_0x2fc83d-0x0;var _0x40fa14=_0x2728[_0x2fc83d];return _0x40fa14;};'use strict';var Sequelize=require(_0x8272('0x0'));var _=require(_0x8272('0x1'));var util=require(_0x8272('0x2'));module[_0x8272('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x8272('0x4')},'description':{'type':Sequelize[_0x8272('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x8272('0x6')),'set':function(_0x3864be){if(_[_0x8272('0x7')](_0x3864be)){this[_0x8272('0x8')]('formData',JSON['stringify'](_0x3864be));}else if(_['isString'](_0x3864be)){this[_0x8272('0x8')](_0x8272('0x9'),_0x3864be);}else{this[_0x8272('0x8')]('formData',util['format'](_0x8272('0xa'),this[_0x8272('0xb')](_0x8272('0x4'))||'',this[_0x8272('0xb')](_0x8272('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8272('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8272('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7e377e3..645e277 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 _0xc5c0=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','get','omit','createdAt','updatedAt','userProfileId','getSessions','order','pick','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv','download','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x253b0a,_0xd0f0bc){var _0x1fc145=function(_0x4e4254){while(--_0x4e4254){_0x253b0a['push'](_0x253b0a['shift']());}};_0x1fc145(++_0xd0f0bc);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x4bac4e,_0x4d7dd5){_0x4bac4e=_0x4bac4e-0x0;var _0x2e9c38=_0xc5c0[_0x4bac4e];return _0x2e9c38;};'use strict';var emlformat=require(_0x0c5c('0x0'));var rimraf=require(_0x0c5c('0x1'));var zipdir=require(_0x0c5c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0c5c('0x3'));var BPromise=require(_0x0c5c('0x4'));var Mustache=require('mustache');var util=require(_0x0c5c('0x5'));var path=require(_0x0c5c('0x6'));var sox=require(_0x0c5c('0x7'));var csv=require(_0x0c5c('0x8'));var ejs=require(_0x0c5c('0x9'));var fs=require('fs');var fs_extra=require(_0x0c5c('0xa'));var _=require(_0x0c5c('0xb'));var squel=require('squel');var crypto=require(_0x0c5c('0xc'));var jsforce=require(_0x0c5c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c5c('0x8'));var querystring=require(_0x0c5c('0xe'));var Papa=require(_0x0c5c('0xf'));var Redis=require(_0x0c5c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0c5c('0x11'));var as=require(_0x0c5c('0x12'));var hardwareService=require(_0x0c5c('0x13'));var logger=require(_0x0c5c('0x14'))(_0x0c5c('0x15'));var utils=require('../../config/utils');var config=require(_0x0c5c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c5c('0x17'))['db'];function respondWithStatusCode(_0x2a6faa,_0x1dcb7a){_0x1dcb7a=_0x1dcb7a||0xcc;return function(_0x2f9a2f){if(_0x2f9a2f){return _0x2a6faa[_0x0c5c('0x18')](_0x1dcb7a);}return _0x2a6faa[_0x0c5c('0x19')](_0x1dcb7a)[_0x0c5c('0x1a')]();};}function respondWithResult(_0x35a896,_0x30f123){_0x30f123=_0x30f123||0xc8;return function(_0x35e7e3){if(_0x35e7e3){return _0x35a896['status'](_0x30f123)[_0x0c5c('0x1b')](_0x35e7e3);}};}function respondWithFilteredResult(_0x5edd7f,_0x56b0c7){return function(_0x375e9d){if(_0x375e9d){var _0x189c00=typeof _0x56b0c7['offset']===_0x0c5c('0x1c')&&typeof _0x56b0c7['limit']===_0x0c5c('0x1c');var _0x3cef4c=_0x375e9d[_0x0c5c('0x1d')];var _0x5b8105=_0x189c00?0x0:_0x56b0c7[_0x0c5c('0x1e')];var _0x38cd95=_0x189c00?_0x375e9d[_0x0c5c('0x1d')]:_0x56b0c7[_0x0c5c('0x1e')]+_0x56b0c7['limit'];var _0x273a5a;if(_0x38cd95>=_0x3cef4c){_0x38cd95=_0x3cef4c;_0x273a5a=0xc8;}else{_0x273a5a=0xce;}_0x5edd7f[_0x0c5c('0x19')](_0x273a5a);return _0x5edd7f[_0x0c5c('0x1f')](_0x0c5c('0x20'),_0x5b8105+'-'+_0x38cd95+'/'+_0x3cef4c)[_0x0c5c('0x1b')](_0x375e9d);}return null;};}function patchUpdates(_0x17af12){return function(_0x616c62){try{jsonpatch[_0x0c5c('0x21')](_0x616c62,_0x17af12,!![]);}catch(_0x480efe){return BPromise[_0x0c5c('0x22')](_0x480efe);}return _0x616c62[_0x0c5c('0x23')]();};}function saveUpdates(_0xeb244e,_0x2cd15f){return function(_0xe0534d){if(_0xe0534d){return _0xe0534d[_0x0c5c('0x24')](_0xeb244e)['then'](function(_0xb1ea94){return _0xb1ea94;});}return null;};}function removeEntity(_0x4f5c8a,_0x12bc50){return function(_0x4356fa){if(_0x4356fa){return _0x4356fa[_0x0c5c('0x25')]()[_0x0c5c('0x26')](function(){var _0xce6d9c=_0x4356fa['get']({'plain':!![]});var _0x19f49e=_0x0c5c('0x27');return db[_0x0c5c('0x28')][_0x0c5c('0x25')]({'where':{'type':_0x19f49e,'resourceId':_0xce6d9c['id']}})[_0x0c5c('0x26')](function(){return _0x4356fa;});})[_0x0c5c('0x26')](function(){_0x4f5c8a[_0x0c5c('0x19')](0xcc)[_0x0c5c('0x1a')]();});}};}function handleEntityNotFound(_0x2f3b67,_0x307e59){return function(_0x302663){if(!_0x302663){_0x2f3b67[_0x0c5c('0x18')](0x194);}return _0x302663;};}function handleError(_0x4d9741,_0x5ab64a){_0x5ab64a=_0x5ab64a||0x1f4;return function(_0xf56822){logger[_0x0c5c('0x29')](_0xf56822[_0x0c5c('0x2a')]);if(_0xf56822[_0x0c5c('0x2b')]){delete _0xf56822[_0x0c5c('0x2b')];}_0x4d9741[_0x0c5c('0x19')](_0x5ab64a)[_0x0c5c('0x2c')](_0xf56822);};}exports[_0x0c5c('0x2d')]=function(_0x2ef471,_0x1b88c1){var _0xe1130e={},_0x43e2a2={},_0xd94d41={'count':0x0,'rows':[]};var _0x280983=_[_0x0c5c('0x2e')](db[_0x0c5c('0x2f')][_0x0c5c('0x30')],function(_0x20b336){return{'name':_0x20b336[_0x0c5c('0x31')],'type':_0x20b336['type'][_0x0c5c('0x32')]};});_0x43e2a2[_0x0c5c('0x33')]=_[_0x0c5c('0x2e')](_0x280983,'name');_0x43e2a2[_0x0c5c('0x34')]=_[_0x0c5c('0x35')](_0x2ef471[_0x0c5c('0x34')]);_0x43e2a2['filters']=_[_0x0c5c('0x36')](_0x43e2a2['model'],_0x43e2a2[_0x0c5c('0x34')]);_0xe1130e['attributes']=_[_0x0c5c('0x36')](_0x43e2a2[_0x0c5c('0x33')],qs[_0x0c5c('0x37')](_0x2ef471[_0x0c5c('0x34')]['fields']));_0xe1130e[_0x0c5c('0x38')]=_0xe1130e['attributes']['length']?_0xe1130e[_0x0c5c('0x38')]:_0x43e2a2[_0x0c5c('0x33')];if(!_0x2ef471[_0x0c5c('0x34')][_0x0c5c('0x39')](_0x0c5c('0x3a'))){_0xe1130e[_0x0c5c('0x3b')]=qs[_0x0c5c('0x3b')](_0x2ef471['query'][_0x0c5c('0x3b')]);_0xe1130e[_0x0c5c('0x1e')]=qs[_0x0c5c('0x1e')](_0x2ef471[_0x0c5c('0x34')]['offset']);}_0xe1130e['order']=qs[_0x0c5c('0x3c')](_0x2ef471['query'][_0x0c5c('0x3c')]);_0xe1130e[_0x0c5c('0x3d')]=qs[_0x0c5c('0x3e')](_['pick'](_0x2ef471[_0x0c5c('0x34')],_0x43e2a2[_0x0c5c('0x3e')]),_0x280983);if(_0x2ef471[_0x0c5c('0x34')][_0x0c5c('0x3f')]){_0xe1130e[_0x0c5c('0x3d')]=_[_0x0c5c('0x40')](_0xe1130e['where'],{'$or':_[_0x0c5c('0x2e')](_0x280983,function(_0x48a037){if(_0x48a037[_0x0c5c('0x41')]!=='VIRTUAL'){var _0x56e7ee={};_0x56e7ee[_0x48a037[_0x0c5c('0x2b')]]={'$like':'%'+_0x2ef471[_0x0c5c('0x34')][_0x0c5c('0x3f')]+'%'};return _0x56e7ee;}})});}_0xe1130e=_[_0x0c5c('0x40')]({},_0xe1130e,_0x2ef471[_0x0c5c('0x42')]);var _0xb6953d={'where':_0xe1130e[_0x0c5c('0x3d')]};return db[_0x0c5c('0x2f')][_0x0c5c('0x1d')](_0xb6953d)[_0x0c5c('0x26')](function(_0x17f971){_0xd94d41[_0x0c5c('0x1d')]=_0x17f971;if(_0x2ef471[_0x0c5c('0x34')][_0x0c5c('0x43')]){_0xe1130e[_0x0c5c('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0x0c5c('0x45')](_0xe1130e);})['then'](function(_0x570364){_0xd94d41[_0x0c5c('0x46')]=_0x570364;return _0xd94d41;})[_0x0c5c('0x26')](respondWithFilteredResult(_0x1b88c1,_0xe1130e))[_0x0c5c('0x47')](handleError(_0x1b88c1,null));};exports[_0x0c5c('0x48')]=function(_0x4d0710,_0x2367ec){var _0x2a0315={'raw':![],'where':{'id':_0x4d0710['params']['id']}},_0x9abdc0={};_0x9abdc0['model']=_[_0x0c5c('0x35')](db['JscriptyProject']['rawAttributes']);_0x9abdc0[_0x0c5c('0x34')]=_[_0x0c5c('0x35')](_0x4d0710[_0x0c5c('0x34')]);_0x9abdc0[_0x0c5c('0x3e')]=_[_0x0c5c('0x36')](_0x9abdc0[_0x0c5c('0x33')],_0x9abdc0[_0x0c5c('0x34')]);_0x2a0315[_0x0c5c('0x38')]=_[_0x0c5c('0x36')](_0x9abdc0[_0x0c5c('0x33')],qs[_0x0c5c('0x37')](_0x4d0710[_0x0c5c('0x34')][_0x0c5c('0x37')]));_0x2a0315['attributes']=_0x2a0315[_0x0c5c('0x38')][_0x0c5c('0x49')]?_0x2a0315['attributes']:_0x9abdc0[_0x0c5c('0x33')];if(_0x4d0710[_0x0c5c('0x34')][_0x0c5c('0x43')]){_0x2a0315['include']=[{'all':!![]}];}_0x2a0315=_[_0x0c5c('0x40')]({},_0x2a0315,_0x4d0710['options']);return db[_0x0c5c('0x2f')][_0x0c5c('0x4a')](_0x2a0315)[_0x0c5c('0x26')](handleEntityNotFound(_0x2367ec,null))[_0x0c5c('0x26')](respondWithResult(_0x2367ec,null))[_0x0c5c('0x47')](handleError(_0x2367ec,null));};exports[_0x0c5c('0x4b')]=function(_0x1c7235,_0x5688db){return db[_0x0c5c('0x2f')][_0x0c5c('0x4b')](_0x1c7235[_0x0c5c('0x4c')],{})['then'](function(_0x3ae194){var _0x5280df=_0x1c7235[_0x0c5c('0x4d')]['get']({'plain':!![]});if(!_0x5280df)throw new Error(_0x0c5c('0x4e'));if(_0x5280df[_0x0c5c('0x4f')]===_0x0c5c('0x4d')){var _0x291564=_0x3ae194['get']({'plain':!![]});var _0x4409f8='Projects';return db[_0x0c5c('0x50')][_0x0c5c('0x4a')]({'where':{'name':_0x4409f8,'userProfileId':_0x5280df['userProfileId']},'raw':!![]})[_0x0c5c('0x26')](function(_0x48ef7f){if(_0x48ef7f&&_0x48ef7f[_0x0c5c('0x51')]===0x0){return db['UserProfileResource'][_0x0c5c('0x4b')]({'name':_0x291564[_0x0c5c('0x2b')],'resourceId':_0x291564['id'],'type':_0x48ef7f['name'],'sectionId':_0x48ef7f['id']},{})[_0x0c5c('0x26')](function(){return _0x3ae194;});}else{return _0x3ae194;}})[_0x0c5c('0x47')](function(_0x4f85a1){logger[_0x0c5c('0x29')](_0x0c5c('0x52'),_0x4f85a1);throw _0x4f85a1;});}return _0x3ae194;})[_0x0c5c('0x26')](respondWithResult(_0x5688db,0xc9))[_0x0c5c('0x47')](handleError(_0x5688db,null));};exports[_0x0c5c('0x53')]=function(_0x291180,_0x110550){var _0x5a17d1={'where':{'id':_0x291180[_0x0c5c('0x54')]['id']}},_0xbf4af1={};_0xbf4af1[_0x0c5c('0x33')]=_['keys'](db[_0x0c5c('0x2f')][_0x0c5c('0x30')]);_0x5a17d1['attributes']=_[_0x0c5c('0x36')](_0xbf4af1[_0x0c5c('0x33')],qs[_0x0c5c('0x37')](_0x291180[_0x0c5c('0x34')]['fields']));_0x5a17d1[_0x0c5c('0x38')]=_0x5a17d1[_0x0c5c('0x38')][_0x0c5c('0x49')]?_0x5a17d1[_0x0c5c('0x38')]:_0xbf4af1[_0x0c5c('0x33')];if(_0x291180[_0x0c5c('0x34')]['includeAll']){_0x5a17d1[_0x0c5c('0x44')]=[{'all':!![]}];}_0x5a17d1=_[_0x0c5c('0x40')]({},_0x5a17d1,_0x291180[_0x0c5c('0x42')]);return db[_0x0c5c('0x2f')][_0x0c5c('0x4a')](_0x5a17d1)[_0x0c5c('0x26')](handleEntityNotFound(_0x110550,null))[_0x0c5c('0x26')](function(_0x1ae121){if(_0x1ae121){var _0x36ad9c=_0x1ae121[_0x0c5c('0x55')]({'plain':!![]});_0x36ad9c=qs[_0x0c5c('0x56')](_0x36ad9c,['id',_0x0c5c('0x57'),'updatedAt']);_0x291180[_0x0c5c('0x4c')]=_[_0x0c5c('0x56')](_0x291180[_0x0c5c('0x4c')],['id',_0x0c5c('0x57'),_0x0c5c('0x58')]);return db[_0x0c5c('0x2f')][_0x0c5c('0x4b')](_[_0x0c5c('0x40')](_0x36ad9c,_0x291180[_0x0c5c('0x4c')]),{'include':_0x291180[_0x0c5c('0x34')][_0x0c5c('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x3ddb11){var _0x51f1f4=_0x291180['user'][_0x0c5c('0x55')]({'plain':!![]});if(!_0x51f1f4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51f1f4[_0x0c5c('0x4f')]===_0x0c5c('0x4d')){var _0x3d023f=_0x3ddb11[_0x0c5c('0x55')]({'plain':!![]});var _0x3b64b2=_0x0c5c('0x27');return db['UserProfileSection'][_0x0c5c('0x4a')]({'where':{'name':_0x3b64b2,'userProfileId':_0x51f1f4[_0x0c5c('0x59')]},'raw':!![]})[_0x0c5c('0x26')](function(_0x1b5853){if(_0x1b5853&&_0x1b5853[_0x0c5c('0x51')]===0x0){return db[_0x0c5c('0x28')][_0x0c5c('0x4b')]({'name':_0x3d023f['name'],'resourceId':_0x3d023f['id'],'type':_0x1b5853['name'],'sectionId':_0x1b5853['id']},{})[_0x0c5c('0x26')](function(){return _0x3ddb11;});}else{return _0x3ddb11;}})[_0x0c5c('0x47')](function(_0x6b3b0a){logger[_0x0c5c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6b3b0a);throw _0x6b3b0a;});}return _0x3ddb11;});}})[_0x0c5c('0x26')](respondWithResult(_0x110550,0xc9))[_0x0c5c('0x47')](handleError(_0x110550,null));};exports['update']=function(_0x2b9df5,_0x2aa341){if(_0x2b9df5['body']['id']){delete _0x2b9df5[_0x0c5c('0x4c')]['id'];}return db[_0x0c5c('0x2f')]['find']({'where':{'id':_0x2b9df5[_0x0c5c('0x54')]['id']}})[_0x0c5c('0x26')](handleEntityNotFound(_0x2aa341,null))['then'](saveUpdates(_0x2b9df5[_0x0c5c('0x4c')],null))['then'](respondWithResult(_0x2aa341,null))['catch'](handleError(_0x2aa341,null));};exports[_0x0c5c('0x25')]=function(_0x3d1517,_0xe6cbb3){return db['JscriptyProject'][_0x0c5c('0x4a')]({'where':{'id':_0x3d1517[_0x0c5c('0x54')]['id']}})[_0x0c5c('0x26')](handleEntityNotFound(_0xe6cbb3,null))[_0x0c5c('0x26')](removeEntity(_0xe6cbb3,null))['catch'](handleError(_0xe6cbb3,null));};exports[_0x0c5c('0x5a')]=function(_0x219402,_0x1d7451,_0x4e9227){var _0x676abe={'raw':!![],'where':{}};var _0x4497dd={};var _0x1ff4b8={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x219402[_0x0c5c('0x54')]['id']}})[_0x0c5c('0x26')](handleEntityNotFound(_0x1d7451,null))[_0x0c5c('0x26')](function(_0x269eef){if(_0x269eef){_0x4497dd['model']=_[_0x0c5c('0x35')](db['JscriptySessionReport'][_0x0c5c('0x30')]);_0x4497dd['query']=_[_0x0c5c('0x35')](_0x219402[_0x0c5c('0x34')]);_0x4497dd[_0x0c5c('0x3e')]=_[_0x0c5c('0x36')](_0x4497dd[_0x0c5c('0x33')],_0x4497dd['query']);_0x676abe[_0x0c5c('0x38')]=_['intersection'](_0x4497dd[_0x0c5c('0x33')],qs['fields'](_0x219402[_0x0c5c('0x34')][_0x0c5c('0x37')]));_0x676abe[_0x0c5c('0x38')]=_0x676abe['attributes']['length']?_0x676abe[_0x0c5c('0x38')]:_0x4497dd[_0x0c5c('0x33')];if(!_0x219402[_0x0c5c('0x34')][_0x0c5c('0x39')](_0x0c5c('0x3a'))){_0x676abe[_0x0c5c('0x3b')]=qs[_0x0c5c('0x3b')](_0x219402['query'][_0x0c5c('0x3b')]);_0x676abe[_0x0c5c('0x1e')]=qs['offset'](_0x219402['query'][_0x0c5c('0x1e')]);}_0x676abe[_0x0c5c('0x5b')]=qs[_0x0c5c('0x3c')](_0x219402[_0x0c5c('0x34')][_0x0c5c('0x3c')]);_0x676abe['where']=qs[_0x0c5c('0x3e')](_[_0x0c5c('0x5c')](_0x219402['query'],_0x4497dd['filters']));_0x676abe[_0x0c5c('0x3d')][_0x0c5c('0x5d')]=_0x269eef['id'];if(_0x219402[_0x0c5c('0x34')]['filter']){_0x676abe[_0x0c5c('0x3d')]=_[_0x0c5c('0x40')](_0x676abe['where'],{'$or':_[_0x0c5c('0x2e')](_0x676abe[_0x0c5c('0x38')],function(_0x4432e6){var _0x2b9c37={};_0x2b9c37[_0x4432e6]={'$like':'%'+_0x219402[_0x0c5c('0x34')]['filter']+'%'};return _0x2b9c37;})});}_0x676abe=_[_0x0c5c('0x40')]({},_0x676abe,_0x219402[_0x0c5c('0x42')]);return db[_0x0c5c('0x5e')][_0x0c5c('0x1d')]({'where':_0x676abe[_0x0c5c('0x3d')]})[_0x0c5c('0x26')](function(_0x1951ca){_0x1ff4b8[_0x0c5c('0x1d')]=_0x1951ca;if(_0x219402['query'][_0x0c5c('0x43')]){_0x676abe[_0x0c5c('0x44')]=[{'all':!![]}];}return db[_0x0c5c('0x5e')]['findAll'](_0x676abe);})['then'](function(_0x2dc141){_0x1ff4b8[_0x0c5c('0x46')]=_0x2dc141;return _0x1ff4b8;});}})[_0x0c5c('0x26')](respondWithFilteredResult(_0x1d7451,_0x676abe))[_0x0c5c('0x47')](handleError(_0x1d7451,null));};exports[_0x0c5c('0x5f')]=function(_0xfd85bf,_0x1d46ae,_0x1ac228){var _0x3dc869={'raw':!![],'where':{}};var _0x105e15={};var _0x22ccb3={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0c5c('0x60')]({'where':{'id':_0xfd85bf[_0x0c5c('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d46ae,null))[_0x0c5c('0x26')](function(_0x1f01db){if(_0x1f01db){_0x105e15[_0x0c5c('0x33')]=_[_0x0c5c('0x35')](db[_0x0c5c('0x61')][_0x0c5c('0x30')]);_0x105e15['query']=_['keys'](_0xfd85bf[_0x0c5c('0x34')]);_0x105e15[_0x0c5c('0x3e')]=_['intersection'](_0x105e15[_0x0c5c('0x33')],_0x105e15['query']);_0x3dc869[_0x0c5c('0x38')]=_['intersection'](_0x105e15['model'],qs['fields'](_0xfd85bf[_0x0c5c('0x34')][_0x0c5c('0x37')]));_0x3dc869['attributes']=_0x3dc869[_0x0c5c('0x38')][_0x0c5c('0x49')]?_0x3dc869[_0x0c5c('0x38')]:_0x105e15[_0x0c5c('0x33')];if(!_0xfd85bf['query'][_0x0c5c('0x39')](_0x0c5c('0x3a'))){_0x3dc869['limit']=qs[_0x0c5c('0x3b')](_0xfd85bf[_0x0c5c('0x34')][_0x0c5c('0x3b')]);_0x3dc869[_0x0c5c('0x1e')]=qs[_0x0c5c('0x1e')](_0xfd85bf['query'][_0x0c5c('0x1e')]);}_0x3dc869['order']=qs[_0x0c5c('0x3c')](_0xfd85bf[_0x0c5c('0x34')][_0x0c5c('0x3c')]);_0x3dc869[_0x0c5c('0x3d')]=qs[_0x0c5c('0x3e')](_['pick'](_0xfd85bf['query'],_0x105e15['filters']));_0x3dc869[_0x0c5c('0x3d')][_0x0c5c('0x5d')]=_0x1f01db['id'];if(_0xfd85bf[_0x0c5c('0x34')][_0x0c5c('0x3f')]){_0x3dc869['where']=_[_0x0c5c('0x40')](_0x3dc869[_0x0c5c('0x3d')],{'$or':_[_0x0c5c('0x2e')](_0x3dc869['attributes'],function(_0x495c90){var _0x513634={};_0x513634[_0x495c90]={'$like':'%'+_0xfd85bf[_0x0c5c('0x34')][_0x0c5c('0x3f')]+'%'};return _0x513634;})});}_0x3dc869=_[_0x0c5c('0x40')]({},_0x3dc869,_0xfd85bf[_0x0c5c('0x42')]);return db['JscriptyAnswerReport'][_0x0c5c('0x1d')]({'where':_0x3dc869[_0x0c5c('0x3d')]})['then'](function(_0x40df0c){_0x22ccb3[_0x0c5c('0x1d')]=_0x40df0c;if(_0xfd85bf[_0x0c5c('0x34')]['includeAll']){_0x3dc869[_0x0c5c('0x44')]=[{'all':!![]}];}return db[_0x0c5c('0x61')][_0x0c5c('0x45')](_0x3dc869);})[_0x0c5c('0x26')](function(_0x2892cc){_0x22ccb3[_0x0c5c('0x46')]=_0x2892cc;return _0x22ccb3;});}})['then'](respondWithFilteredResult(_0x1d46ae,_0x3dc869))['catch'](handleError(_0x1d46ae,null));};function char(_0x5c078c){return _0x0c5c('0x62')===typeof _0x5c078c?String['fromCharCode']['apply'](null,arguments):_0x5c078c;}function needsEncapsulation(_0x142c80){return!!_0x142c80&&(_0x142c80['toString']()['indexOf'](char(0xd))>=0x0||_0x142c80[_0x0c5c('0x63')]()[_0x0c5c('0x64')](char(0xa))>=0x0||_0x142c80[_0x0c5c('0x63')]()[_0x0c5c('0x64')](char(0x2c))>=0x0||_0x142c80[_0x0c5c('0x63')]()[_0x0c5c('0x64')](char(0x22))>=0x0);}function encapsulate(_0x3570b3){var _0x59ccff=char(0x22),_0x30c16f='\x5c'+char(0x22),_0x12218d=_0x3570b3[_0x0c5c('0x63')]()['replace'](new RegExp(_0x59ccff,'g'),_0x30c16f);return _0x59ccff+_0x12218d+_0x59ccff;}exports[_0x0c5c('0x65')]=function(_0x45ae99,_0x41ab23,_0x3295ed){var _0x2abb10,_0x47d2af;var _0x1ddcc4={'where':{'ProjectId':_0x45ae99['params']['id']}};if(_0x45ae99[_0x0c5c('0x34')][_0x0c5c('0x66')]){_0x1ddcc4['where'][_0x0c5c('0x67')]=JSON[_0x0c5c('0x68')](_0x45ae99['query']['startTime']);}return db[_0x0c5c('0x5e')]['findAll'](_0x1ddcc4)[_0x0c5c('0x26')](handleEntityNotFound(_0x41ab23,null))[_0x0c5c('0x26')](function(_0x27ffd9){if(_0x27ffd9){_0x2abb10=_0x27ffd9;return db[_0x0c5c('0x69')][_0x0c5c('0x45')]({'where':{'SessionId':{'$in':_['map'](_0x2abb10,'id')},'ProjectId':_0x45ae99['params']['id']},'order':_0x0c5c('0x6a')});}})['then'](handleEntityNotFound(_0x41ab23,null))[_0x0c5c('0x26')](function(_0x25f680){if(_0x25f680){_0x47d2af=_0x25f680;var _0x3c3201={};for(var _0x2ddd87=0x0,_0x5969a8=_0x47d2af[_0x0c5c('0x49')];_0x2ddd87<_0x5969a8;_0x2ddd87++){if(!_0x3c3201[_0x0c5c('0x39')](_0x47d2af[_0x2ddd87][_0x0c5c('0x6b')])){_0x3c3201[_0x47d2af[_0x2ddd87][_0x0c5c('0x6b')]]=needsEncapsulation(_0x47d2af[_0x2ddd87][_0x0c5c('0x6c')])?encapsulate(_0x47d2af[_0x2ddd87][_0x0c5c('0x6c')]):_0x47d2af[_0x2ddd87][_0x0c5c('0x6c')];}}var _0x34a90d=[],_0x335ea2={};for(var _0x571291=0x0,_0xd295dc=_0x2abb10[_0x0c5c('0x49')];_0x571291<_0xd295dc;_0x571291++){_0x335ea2={'ProjectId':_0x45ae99[_0x0c5c('0x54')]['id'],'SessionId':_0x2abb10[_0x571291]['id'],'StartTime':moment(_0x2abb10[_0x571291][_0x0c5c('0x67')])['format'](_0x0c5c('0x6d'))};for(var _0x419456=0x0,_0x1d5abf=_0x47d2af[_0x0c5c('0x49')];_0x419456<_0x1d5abf;_0x419456++){if(_0x47d2af[_0x419456][_0x0c5c('0x6e')]==_0x2abb10[_0x571291]['id']&&_0x3c3201[_0x0c5c('0x39')](_0x47d2af[_0x419456][_0x0c5c('0x6b')])){_0x335ea2[_0x3c3201[_0x47d2af[_0x419456][_0x0c5c('0x6b')]]]=_0x47d2af[_0x419456][_0x0c5c('0x6f')];}}for(var _0x246e74 in _0x3c3201){if(!_0x335ea2[_0x0c5c('0x39')](_0x3c3201[_0x246e74])){_0x335ea2[_0x3c3201[_0x246e74]]=null;}}_0x34a90d[_0x0c5c('0x70')](_0x335ea2);}return _0x34a90d;}})[_0x0c5c('0x26')](function(_0x44675f){if(!_[_0x0c5c('0x71')](_0x44675f)){var _0x20246b=toCsv(_0x44675f);var _0x3ff9bc=Date['now']();fs['writeFileSync'](util['format'](_0x0c5c('0x72'),_0x45ae99['params']['id'],_0x3ff9bc),_0x20246b);_0x41ab23[_0x0c5c('0x73')](_0x0c5c('0x74'),_0x0c5c('0x75')+util[_0x0c5c('0x76')]('Jscripty_Project_%d_Summary_%s.csv',_0x45ae99[_0x0c5c('0x54')]['id'],_0x3ff9bc));_0x41ab23[_0x0c5c('0x73')](_0x0c5c('0x77'),_0x0c5c('0x78'));return _0x41ab23[_0x0c5c('0x79')](util[_0x0c5c('0x76')](_0x0c5c('0x72'),_0x45ae99[_0x0c5c('0x54')]['id'],_0x3ff9bc));}else{return _0x41ab23[_0x0c5c('0x18')](0xcc);}})[_0x0c5c('0x47')](handleError(_0x41ab23,null));}; \ No newline at end of file +var _0x4c4d=['intersection','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','JscriptyProject','findAll','rows','catch','params','filters','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','include','omit','createdAt','updatedAt','update','getSessions','JscriptySessionReport','nolimit','ProjectId','JscriptyAnswerReport','filter','apply','toString','indexOf','replace','getSummary','starttime','parse','startTime','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','sendStatus','eml-format','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','Projects','UserProfileResource','then','end','name','status','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes'];(function(_0x50159b,_0x5cce5b){var _0x3f438b=function(_0x16a3e1){while(--_0x16a3e1){_0x50159b['push'](_0x50159b['shift']());}};_0x3f438b(++_0x5cce5b);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x405f17,_0x1ced3f){_0x405f17=_0x405f17-0x0;var _0x59a94f=_0x4c4d[_0x405f17];return _0x59a94f;};'use strict';var emlformat=require(_0xd4c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd4c4('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd4c4('0x2'));var util=require(_0xd4c4('0x3'));var path=require(_0xd4c4('0x4'));var sox=require(_0xd4c4('0x5'));var csv=require(_0xd4c4('0x6'));var ejs=require(_0xd4c4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4c4('0x8'));var squel=require(_0xd4c4('0x9'));var crypto=require(_0xd4c4('0xa'));var jsforce=require(_0xd4c4('0xb'));var deskjs=require(_0xd4c4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd4c4('0xd'));var Papa=require(_0xd4c4('0xe'));var Redis=require(_0xd4c4('0xf'));var authService=require(_0xd4c4('0x10'));var qs=require(_0xd4c4('0x11'));var as=require(_0xd4c4('0x12'));var hardwareService=require(_0xd4c4('0x13'));var logger=require(_0xd4c4('0x14'))(_0xd4c4('0x15'));var utils=require('../../config/utils');var config=require(_0xd4c4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4c4('0x17'))['db'];function respondWithStatusCode(_0x203dc9,_0x5a9e8d){_0x5a9e8d=_0x5a9e8d||0xcc;return function(_0x3bd78e){if(_0x3bd78e){return _0x203dc9['sendStatus'](_0x5a9e8d);}return _0x203dc9['status'](_0x5a9e8d)['end']();};}function respondWithResult(_0x5d4fe4,_0x471952){_0x471952=_0x471952||0xc8;return function(_0x3c52b0){if(_0x3c52b0){return _0x5d4fe4['status'](_0x471952)[_0xd4c4('0x18')](_0x3c52b0);}};}function respondWithFilteredResult(_0x350465,_0x181a8a){return function(_0x442ab1){if(_0x442ab1){var _0x3851cf=typeof _0x181a8a[_0xd4c4('0x19')]===_0xd4c4('0x1a')&&typeof _0x181a8a[_0xd4c4('0x1b')]===_0xd4c4('0x1a');var _0x4d6e3b=_0x442ab1['count'];var _0xded73e=_0x3851cf?0x0:_0x181a8a[_0xd4c4('0x19')];var _0x10370f=_0x3851cf?_0x442ab1[_0xd4c4('0x1c')]:_0x181a8a[_0xd4c4('0x19')]+_0x181a8a['limit'];var _0x1fa73b;if(_0x10370f>=_0x4d6e3b){_0x10370f=_0x4d6e3b;_0x1fa73b=0xc8;}else{_0x1fa73b=0xce;}_0x350465['status'](_0x1fa73b);return _0x350465[_0xd4c4('0x1d')](_0xd4c4('0x1e'),_0xded73e+'-'+_0x10370f+'/'+_0x4d6e3b)['json'](_0x442ab1);}return null;};}function patchUpdates(_0x20224b){return function(_0xc197d8){try{jsonpatch['apply'](_0xc197d8,_0x20224b,!![]);}catch(_0x3714a7){return BPromise[_0xd4c4('0x1f')](_0x3714a7);}return _0xc197d8[_0xd4c4('0x20')]();};}function saveUpdates(_0x4e22fc,_0x29ea89){return function(_0xe7d09c){if(_0xe7d09c){return _0xe7d09c['update'](_0x4e22fc)['then'](function(_0x199011){return _0x199011;});}return null;};}function removeEntity(_0x35ad56,_0x4f79b5){return function(_0x1c1a00){if(_0x1c1a00){return _0x1c1a00[_0xd4c4('0x21')]()['then'](function(){var _0xbf1e3c=_0x1c1a00['get']({'plain':!![]});var _0x10d58a=_0xd4c4('0x22');return db[_0xd4c4('0x23')][_0xd4c4('0x21')]({'where':{'type':_0x10d58a,'resourceId':_0xbf1e3c['id']}})[_0xd4c4('0x24')](function(){return _0x1c1a00;});})['then'](function(){_0x35ad56['status'](0xcc)[_0xd4c4('0x25')]();});}};}function handleEntityNotFound(_0x5781ed,_0x538899){return function(_0x54c567){if(!_0x54c567){_0x5781ed['sendStatus'](0x194);}return _0x54c567;};}function handleError(_0x1c768f,_0x127f03){_0x127f03=_0x127f03||0x1f4;return function(_0x416c3f){logger['error'](_0x416c3f['stack']);if(_0x416c3f[_0xd4c4('0x26')]){delete _0x416c3f[_0xd4c4('0x26')];}_0x1c768f[_0xd4c4('0x27')](_0x127f03)[_0xd4c4('0x28')](_0x416c3f);};}exports[_0xd4c4('0x29')]=function(_0x5f4e8d,_0x26270d){var _0xc53716={},_0x4d48bb={},_0x5bf9eb={'count':0x0,'rows':[]};var _0x561e41=_[_0xd4c4('0x2a')](db['JscriptyProject'][_0xd4c4('0x2b')],function(_0x4fc0e5){return{'name':_0x4fc0e5[_0xd4c4('0x2c')],'type':_0x4fc0e5['type'][_0xd4c4('0x2d')]};});_0x4d48bb[_0xd4c4('0x2e')]=_[_0xd4c4('0x2a')](_0x561e41,_0xd4c4('0x26'));_0x4d48bb[_0xd4c4('0x2f')]=_[_0xd4c4('0x30')](_0x5f4e8d[_0xd4c4('0x2f')]);_0x4d48bb['filters']=_['intersection'](_0x4d48bb[_0xd4c4('0x2e')],_0x4d48bb[_0xd4c4('0x2f')]);_0xc53716[_0xd4c4('0x31')]=_[_0xd4c4('0x32')](_0x4d48bb['model'],qs['fields'](_0x5f4e8d[_0xd4c4('0x2f')]['fields']));_0xc53716['attributes']=_0xc53716[_0xd4c4('0x31')][_0xd4c4('0x33')]?_0xc53716[_0xd4c4('0x31')]:_0x4d48bb['model'];if(!_0x5f4e8d['query'][_0xd4c4('0x34')]('nolimit')){_0xc53716['limit']=qs[_0xd4c4('0x1b')](_0x5f4e8d[_0xd4c4('0x2f')][_0xd4c4('0x1b')]);_0xc53716[_0xd4c4('0x19')]=qs[_0xd4c4('0x19')](_0x5f4e8d['query'][_0xd4c4('0x19')]);}_0xc53716[_0xd4c4('0x35')]=qs[_0xd4c4('0x36')](_0x5f4e8d[_0xd4c4('0x2f')]['sort']);_0xc53716[_0xd4c4('0x37')]=qs['filters'](_[_0xd4c4('0x38')](_0x5f4e8d[_0xd4c4('0x2f')],_0x4d48bb['filters']),_0x561e41);if(_0x5f4e8d[_0xd4c4('0x2f')]['filter']){_0xc53716[_0xd4c4('0x37')]=_['merge'](_0xc53716[_0xd4c4('0x37')],{'$or':_[_0xd4c4('0x2a')](_0x561e41,function(_0x42eb5f){if(_0x42eb5f[_0xd4c4('0x39')]!==_0xd4c4('0x3a')){var _0x28f5d2={};_0x28f5d2[_0x42eb5f[_0xd4c4('0x26')]]={'$like':'%'+_0x5f4e8d[_0xd4c4('0x2f')]['filter']+'%'};return _0x28f5d2;}})});}_0xc53716=_[_0xd4c4('0x3b')]({},_0xc53716,_0x5f4e8d[_0xd4c4('0x3c')]);var _0x437da2={'where':_0xc53716['where']};return db[_0xd4c4('0x3d')][_0xd4c4('0x1c')](_0x437da2)[_0xd4c4('0x24')](function(_0x3d6b8a){_0x5bf9eb[_0xd4c4('0x1c')]=_0x3d6b8a;if(_0x5f4e8d[_0xd4c4('0x2f')]['includeAll']){_0xc53716['include']=[{'all':!![]}];}return db[_0xd4c4('0x3d')][_0xd4c4('0x3e')](_0xc53716);})['then'](function(_0x509f35){_0x5bf9eb[_0xd4c4('0x3f')]=_0x509f35;return _0x5bf9eb;})['then'](respondWithFilteredResult(_0x26270d,_0xc53716))[_0xd4c4('0x40')](handleError(_0x26270d,null));};exports['show']=function(_0x36d50b,_0x464393){var _0x3cb249={'raw':![],'where':{'id':_0x36d50b[_0xd4c4('0x41')]['id']}},_0x12d243={};_0x12d243[_0xd4c4('0x2e')]=_[_0xd4c4('0x30')](db[_0xd4c4('0x3d')][_0xd4c4('0x2b')]);_0x12d243[_0xd4c4('0x2f')]=_[_0xd4c4('0x30')](_0x36d50b[_0xd4c4('0x2f')]);_0x12d243[_0xd4c4('0x42')]=_[_0xd4c4('0x32')](_0x12d243[_0xd4c4('0x2e')],_0x12d243[_0xd4c4('0x2f')]);_0x3cb249[_0xd4c4('0x31')]=_[_0xd4c4('0x32')](_0x12d243[_0xd4c4('0x2e')],qs[_0xd4c4('0x43')](_0x36d50b['query'][_0xd4c4('0x43')]));_0x3cb249[_0xd4c4('0x31')]=_0x3cb249[_0xd4c4('0x31')][_0xd4c4('0x33')]?_0x3cb249[_0xd4c4('0x31')]:_0x12d243[_0xd4c4('0x2e')];if(_0x36d50b[_0xd4c4('0x2f')]['includeAll']){_0x3cb249['include']=[{'all':!![]}];}_0x3cb249=_['merge']({},_0x3cb249,_0x36d50b[_0xd4c4('0x3c')]);return db[_0xd4c4('0x3d')][_0xd4c4('0x44')](_0x3cb249)[_0xd4c4('0x24')](handleEntityNotFound(_0x464393,null))[_0xd4c4('0x24')](respondWithResult(_0x464393,null))[_0xd4c4('0x40')](handleError(_0x464393,null));};exports[_0xd4c4('0x45')]=function(_0x27d36b,_0x509c57){return db['JscriptyProject'][_0xd4c4('0x45')](_0x27d36b[_0xd4c4('0x46')],{})[_0xd4c4('0x24')](function(_0x4edc4f){var _0x1d38b9=_0x27d36b[_0xd4c4('0x47')][_0xd4c4('0x48')]({'plain':!![]});if(!_0x1d38b9)throw new Error(_0xd4c4('0x49'));if(_0x1d38b9[_0xd4c4('0x4a')]==='user'){var _0x3d98c0=_0x4edc4f[_0xd4c4('0x48')]({'plain':!![]});var _0x4b43be='Projects';return db[_0xd4c4('0x4b')]['find']({'where':{'name':_0x4b43be,'userProfileId':_0x1d38b9[_0xd4c4('0x4c')]},'raw':!![]})['then'](function(_0x3439f3){if(_0x3439f3&&_0x3439f3[_0xd4c4('0x4d')]===0x0){return db['UserProfileResource'][_0xd4c4('0x45')]({'name':_0x3d98c0[_0xd4c4('0x26')],'resourceId':_0x3d98c0['id'],'type':_0x3439f3[_0xd4c4('0x26')],'sectionId':_0x3439f3['id']},{})[_0xd4c4('0x24')](function(){return _0x4edc4f;});}else{return _0x4edc4f;}})[_0xd4c4('0x40')](function(_0x85c9a7){logger['error'](_0xd4c4('0x4e'),_0x85c9a7);throw _0x85c9a7;});}return _0x4edc4f;})['then'](respondWithResult(_0x509c57,0xc9))[_0xd4c4('0x40')](handleError(_0x509c57,null));};exports[_0xd4c4('0x4f')]=function(_0x1ec55d,_0x44c91b){var _0x11b35a={'where':{'id':_0x1ec55d[_0xd4c4('0x41')]['id']}},_0x4da5e7={};_0x4da5e7['model']=_[_0xd4c4('0x30')](db[_0xd4c4('0x3d')]['rawAttributes']);_0x11b35a['attributes']=_[_0xd4c4('0x32')](_0x4da5e7[_0xd4c4('0x2e')],qs[_0xd4c4('0x43')](_0x1ec55d[_0xd4c4('0x2f')][_0xd4c4('0x43')]));_0x11b35a[_0xd4c4('0x31')]=_0x11b35a[_0xd4c4('0x31')][_0xd4c4('0x33')]?_0x11b35a[_0xd4c4('0x31')]:_0x4da5e7[_0xd4c4('0x2e')];if(_0x1ec55d[_0xd4c4('0x2f')][_0xd4c4('0x50')]){_0x11b35a[_0xd4c4('0x51')]=[{'all':!![]}];}_0x11b35a=_[_0xd4c4('0x3b')]({},_0x11b35a,_0x1ec55d[_0xd4c4('0x3c')]);return db[_0xd4c4('0x3d')][_0xd4c4('0x44')](_0x11b35a)[_0xd4c4('0x24')](handleEntityNotFound(_0x44c91b,null))['then'](function(_0x3a3fdf){if(_0x3a3fdf){var _0x31a042=_0x3a3fdf[_0xd4c4('0x48')]({'plain':!![]});_0x31a042=qs[_0xd4c4('0x52')](_0x31a042,['id',_0xd4c4('0x53'),'updatedAt']);_0x1ec55d['body']=_['omit'](_0x1ec55d[_0xd4c4('0x46')],['id',_0xd4c4('0x53'),_0xd4c4('0x54')]);return db['JscriptyProject'][_0xd4c4('0x45')](_[_0xd4c4('0x3b')](_0x31a042,_0x1ec55d[_0xd4c4('0x46')]),{'include':_0x1ec55d[_0xd4c4('0x2f')][_0xd4c4('0x50')]?[{'all':!![]}]:undefined})[_0xd4c4('0x24')](function(_0x30d67f){var _0x35a52e=_0x1ec55d[_0xd4c4('0x47')][_0xd4c4('0x48')]({'plain':!![]});if(!_0x35a52e)throw new Error(_0xd4c4('0x49'));if(_0x35a52e[_0xd4c4('0x4a')]===_0xd4c4('0x47')){var _0x9acc7f=_0x30d67f[_0xd4c4('0x48')]({'plain':!![]});var _0x469464=_0xd4c4('0x22');return db[_0xd4c4('0x4b')]['find']({'where':{'name':_0x469464,'userProfileId':_0x35a52e['userProfileId']},'raw':!![]})['then'](function(_0x3170c3){if(_0x3170c3&&_0x3170c3[_0xd4c4('0x4d')]===0x0){return db[_0xd4c4('0x23')][_0xd4c4('0x45')]({'name':_0x9acc7f[_0xd4c4('0x26')],'resourceId':_0x9acc7f['id'],'type':_0x3170c3[_0xd4c4('0x26')],'sectionId':_0x3170c3['id']},{})[_0xd4c4('0x24')](function(){return _0x30d67f;});}else{return _0x30d67f;}})[_0xd4c4('0x40')](function(_0x1f6eae){logger['error'](_0xd4c4('0x4e'),_0x1f6eae);throw _0x1f6eae;});}return _0x30d67f;});}})[_0xd4c4('0x24')](respondWithResult(_0x44c91b,0xc9))['catch'](handleError(_0x44c91b,null));};exports[_0xd4c4('0x55')]=function(_0x16f668,_0x59ff22){if(_0x16f668[_0xd4c4('0x46')]['id']){delete _0x16f668[_0xd4c4('0x46')]['id'];}return db[_0xd4c4('0x3d')][_0xd4c4('0x44')]({'where':{'id':_0x16f668[_0xd4c4('0x41')]['id']}})[_0xd4c4('0x24')](handleEntityNotFound(_0x59ff22,null))[_0xd4c4('0x24')](saveUpdates(_0x16f668[_0xd4c4('0x46')],null))[_0xd4c4('0x24')](respondWithResult(_0x59ff22,null))[_0xd4c4('0x40')](handleError(_0x59ff22,null));};exports[_0xd4c4('0x21')]=function(_0x3140ab,_0x22db84){return db[_0xd4c4('0x3d')]['find']({'where':{'id':_0x3140ab['params']['id']}})[_0xd4c4('0x24')](handleEntityNotFound(_0x22db84,null))[_0xd4c4('0x24')](removeEntity(_0x22db84,null))[_0xd4c4('0x40')](handleError(_0x22db84,null));};exports[_0xd4c4('0x56')]=function(_0x7c54f4,_0x524765,_0x100aed){var _0x1c6ad3={'raw':!![],'where':{}};var _0x1964ff={};var _0x4b3480={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x7c54f4[_0xd4c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x524765,null))[_0xd4c4('0x24')](function(_0x19b89b){if(_0x19b89b){_0x1964ff[_0xd4c4('0x2e')]=_[_0xd4c4('0x30')](db[_0xd4c4('0x57')][_0xd4c4('0x2b')]);_0x1964ff['query']=_[_0xd4c4('0x30')](_0x7c54f4['query']);_0x1964ff[_0xd4c4('0x42')]=_[_0xd4c4('0x32')](_0x1964ff[_0xd4c4('0x2e')],_0x1964ff[_0xd4c4('0x2f')]);_0x1c6ad3[_0xd4c4('0x31')]=_[_0xd4c4('0x32')](_0x1964ff[_0xd4c4('0x2e')],qs[_0xd4c4('0x43')](_0x7c54f4['query'][_0xd4c4('0x43')]));_0x1c6ad3[_0xd4c4('0x31')]=_0x1c6ad3['attributes']['length']?_0x1c6ad3[_0xd4c4('0x31')]:_0x1964ff['model'];if(!_0x7c54f4[_0xd4c4('0x2f')][_0xd4c4('0x34')](_0xd4c4('0x58'))){_0x1c6ad3[_0xd4c4('0x1b')]=qs[_0xd4c4('0x1b')](_0x7c54f4[_0xd4c4('0x2f')][_0xd4c4('0x1b')]);_0x1c6ad3[_0xd4c4('0x19')]=qs[_0xd4c4('0x19')](_0x7c54f4[_0xd4c4('0x2f')][_0xd4c4('0x19')]);}_0x1c6ad3['order']=qs[_0xd4c4('0x36')](_0x7c54f4[_0xd4c4('0x2f')][_0xd4c4('0x36')]);_0x1c6ad3[_0xd4c4('0x37')]=qs[_0xd4c4('0x42')](_['pick'](_0x7c54f4['query'],_0x1964ff['filters']));_0x1c6ad3['where'][_0xd4c4('0x59')]=_0x19b89b['id'];if(_0x7c54f4[_0xd4c4('0x2f')]['filter']){_0x1c6ad3[_0xd4c4('0x37')]=_['merge'](_0x1c6ad3['where'],{'$or':_[_0xd4c4('0x2a')](_0x1c6ad3['attributes'],function(_0xf536aa){var _0x1ac2f3={};_0x1ac2f3[_0xf536aa]={'$like':'%'+_0x7c54f4['query']['filter']+'%'};return _0x1ac2f3;})});}_0x1c6ad3=_[_0xd4c4('0x3b')]({},_0x1c6ad3,_0x7c54f4[_0xd4c4('0x3c')]);return db[_0xd4c4('0x57')]['count']({'where':_0x1c6ad3[_0xd4c4('0x37')]})['then'](function(_0x2f6b08){_0x4b3480[_0xd4c4('0x1c')]=_0x2f6b08;if(_0x7c54f4['query'][_0xd4c4('0x50')]){_0x1c6ad3[_0xd4c4('0x51')]=[{'all':!![]}];}return db[_0xd4c4('0x57')][_0xd4c4('0x3e')](_0x1c6ad3);})[_0xd4c4('0x24')](function(_0x31cf97){_0x4b3480[_0xd4c4('0x3f')]=_0x31cf97;return _0x4b3480;});}})['then'](respondWithFilteredResult(_0x524765,_0x1c6ad3))[_0xd4c4('0x40')](handleError(_0x524765,null));};exports['getAnswers']=function(_0x3e89d5,_0x193009,_0x475be3){var _0x141626={'raw':!![],'where':{}};var _0x579146={};var _0x2f7030={'count':0x0,'rows':[]};return db[_0xd4c4('0x3d')]['findOne']({'where':{'id':_0x3e89d5[_0xd4c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x193009,null))[_0xd4c4('0x24')](function(_0x2ce820){if(_0x2ce820){_0x579146[_0xd4c4('0x2e')]=_[_0xd4c4('0x30')](db[_0xd4c4('0x5a')][_0xd4c4('0x2b')]);_0x579146[_0xd4c4('0x2f')]=_[_0xd4c4('0x30')](_0x3e89d5['query']);_0x579146[_0xd4c4('0x42')]=_['intersection'](_0x579146[_0xd4c4('0x2e')],_0x579146['query']);_0x141626['attributes']=_['intersection'](_0x579146[_0xd4c4('0x2e')],qs[_0xd4c4('0x43')](_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x43')]));_0x141626['attributes']=_0x141626[_0xd4c4('0x31')][_0xd4c4('0x33')]?_0x141626['attributes']:_0x579146[_0xd4c4('0x2e')];if(!_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x34')]('nolimit')){_0x141626[_0xd4c4('0x1b')]=qs[_0xd4c4('0x1b')](_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x1b')]);_0x141626[_0xd4c4('0x19')]=qs[_0xd4c4('0x19')](_0x3e89d5['query'][_0xd4c4('0x19')]);}_0x141626[_0xd4c4('0x35')]=qs['sort'](_0x3e89d5['query'][_0xd4c4('0x36')]);_0x141626[_0xd4c4('0x37')]=qs['filters'](_[_0xd4c4('0x38')](_0x3e89d5[_0xd4c4('0x2f')],_0x579146[_0xd4c4('0x42')]));_0x141626['where'][_0xd4c4('0x59')]=_0x2ce820['id'];if(_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x5b')]){_0x141626[_0xd4c4('0x37')]=_[_0xd4c4('0x3b')](_0x141626['where'],{'$or':_['map'](_0x141626[_0xd4c4('0x31')],function(_0x506342){var _0xb23e5c={};_0xb23e5c[_0x506342]={'$like':'%'+_0x3e89d5['query']['filter']+'%'};return _0xb23e5c;})});}_0x141626=_[_0xd4c4('0x3b')]({},_0x141626,_0x3e89d5[_0xd4c4('0x3c')]);return db['JscriptyAnswerReport'][_0xd4c4('0x1c')]({'where':_0x141626[_0xd4c4('0x37')]})[_0xd4c4('0x24')](function(_0x51df71){_0x2f7030[_0xd4c4('0x1c')]=_0x51df71;if(_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x50')]){_0x141626[_0xd4c4('0x51')]=[{'all':!![]}];}return db[_0xd4c4('0x5a')][_0xd4c4('0x3e')](_0x141626);})[_0xd4c4('0x24')](function(_0x120a72){_0x2f7030[_0xd4c4('0x3f')]=_0x120a72;return _0x2f7030;});}})[_0xd4c4('0x24')](respondWithFilteredResult(_0x193009,_0x141626))[_0xd4c4('0x40')](handleError(_0x193009,null));};function char(_0x4eb4d0){return'number'===typeof _0x4eb4d0?String['fromCharCode'][_0xd4c4('0x5c')](null,arguments):_0x4eb4d0;}function needsEncapsulation(_0x1e80ae){return!!_0x1e80ae&&(_0x1e80ae['toString']()['indexOf'](char(0xd))>=0x0||_0x1e80ae[_0xd4c4('0x5d')]()['indexOf'](char(0xa))>=0x0||_0x1e80ae[_0xd4c4('0x5d')]()['indexOf'](char(0x2c))>=0x0||_0x1e80ae[_0xd4c4('0x5d')]()[_0xd4c4('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x2a828e){var _0x46d514=char(0x22),_0x32492b='\x5c'+char(0x22),_0x3324e5=_0x2a828e['toString']()[_0xd4c4('0x5f')](new RegExp(_0x46d514,'g'),_0x32492b);return _0x46d514+_0x3324e5+_0x46d514;}exports[_0xd4c4('0x60')]=function(_0x4cbfcc,_0x598e28,_0x5afd77){var _0x44681e,_0x1fc889;var _0x2f88f3={'where':{'ProjectId':_0x4cbfcc['params']['id']}};if(_0x4cbfcc[_0xd4c4('0x2f')]['startTime']){_0x2f88f3[_0xd4c4('0x37')][_0xd4c4('0x61')]=JSON[_0xd4c4('0x62')](_0x4cbfcc[_0xd4c4('0x2f')][_0xd4c4('0x63')]);}return db[_0xd4c4('0x57')][_0xd4c4('0x3e')](_0x2f88f3)['then'](handleEntityNotFound(_0x598e28,null))[_0xd4c4('0x24')](function(_0x159276){if(_0x159276){_0x44681e=_0x159276;return db['JscriptyQuestionReport'][_0xd4c4('0x3e')]({'where':{'SessionId':{'$in':_[_0xd4c4('0x2a')](_0x44681e,'id')},'ProjectId':_0x4cbfcc[_0xd4c4('0x41')]['id']},'order':'-createdAt'});}})[_0xd4c4('0x24')](handleEntityNotFound(_0x598e28,null))[_0xd4c4('0x24')](function(_0x2f4d50){if(_0x2f4d50){_0x1fc889=_0x2f4d50;var _0x520bf5={};for(var _0x154301=0x0,_0x6242ee=_0x1fc889[_0xd4c4('0x33')];_0x154301<_0x6242ee;_0x154301++){if(!_0x520bf5[_0xd4c4('0x34')](_0x1fc889[_0x154301][_0xd4c4('0x64')])){_0x520bf5[_0x1fc889[_0x154301][_0xd4c4('0x64')]]=needsEncapsulation(_0x1fc889[_0x154301]['question'])?encapsulate(_0x1fc889[_0x154301]['question']):_0x1fc889[_0x154301][_0xd4c4('0x65')];}}var _0x5e92af=[],_0xba5ea5={};for(var _0x52b988=0x0,_0x3883d5=_0x44681e[_0xd4c4('0x33')];_0x52b988<_0x3883d5;_0x52b988++){_0xba5ea5={'ProjectId':_0x4cbfcc['params']['id'],'SessionId':_0x44681e[_0x52b988]['id'],'StartTime':moment(_0x44681e[_0x52b988][_0xd4c4('0x61')])['format'](_0xd4c4('0x66'))};for(var _0x18e08b=0x0,_0x474e08=_0x1fc889['length'];_0x18e08b<_0x474e08;_0x18e08b++){if(_0x1fc889[_0x18e08b][_0xd4c4('0x67')]==_0x44681e[_0x52b988]['id']&&_0x520bf5[_0xd4c4('0x34')](_0x1fc889[_0x18e08b][_0xd4c4('0x64')])){_0xba5ea5[_0x520bf5[_0x1fc889[_0x18e08b][_0xd4c4('0x64')]]]=_0x1fc889[_0x18e08b][_0xd4c4('0x68')];}}for(var _0x314768 in _0x520bf5){if(!_0xba5ea5[_0xd4c4('0x34')](_0x520bf5[_0x314768])){_0xba5ea5[_0x520bf5[_0x314768]]=null;}}_0x5e92af[_0xd4c4('0x69')](_0xba5ea5);}return _0x5e92af;}})['then'](function(_0x296474){if(!_[_0xd4c4('0x6a')](_0x296474)){var _0x63e39e=toCsv(_0x296474);var _0x1c21d4=Date[_0xd4c4('0x6b')]();fs[_0xd4c4('0x6c')](util[_0xd4c4('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4cbfcc[_0xd4c4('0x41')]['id'],_0x1c21d4),_0x63e39e);_0x598e28[_0xd4c4('0x6e')](_0xd4c4('0x6f'),'attachment;\x20filename='+util[_0xd4c4('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0x4cbfcc[_0xd4c4('0x41')]['id'],_0x1c21d4));_0x598e28[_0xd4c4('0x6e')](_0xd4c4('0x70'),_0xd4c4('0x71'));return _0x598e28[_0xd4c4('0x72')](util['format'](_0xd4c4('0x73'),_0x4cbfcc[_0xd4c4('0x41')]['id'],_0x1c21d4));}else{return _0x598e28[_0xd4c4('0x74')](0xcc);}})[_0xd4c4('0x40')](handleError(_0x598e28,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7aa7930..de9f30c 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 _0x2caf=['rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','api','bluebird','request-promise','path'];(function(_0x38f142,_0x6392b6){var _0x4965c4=function(_0x1bf344){while(--_0x1bf344){_0x38f142['push'](_0x38f142['shift']());}};_0x4965c4(++_0x6392b6);}(_0x2caf,0x6a));var _0xf2ca=function(_0x238a72,_0x4bb866){_0x238a72=_0x238a72-0x0;var _0x10166e=_0x2caf[_0x238a72];return _0x10166e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf2ca('0x0'));var moment=require('moment');var BPromise=require(_0xf2ca('0x1'));var rp=require(_0xf2ca('0x2'));var fs=require('fs');var path=require(_0xf2ca('0x3'));var rimraf=require(_0xf2ca('0x4'));var config=require(_0xf2ca('0x5'));var attributes=require(_0xf2ca('0x6'));module[_0xf2ca('0x7')]=function(_0x51372a,_0x8ce770){return _0x51372a[_0xf2ca('0x8')](_0xf2ca('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf041=['path','../../config/environment','define','JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird'];(function(_0x412bce,_0x49b658){var _0x2b933e=function(_0xec41f9){while(--_0xec41f9){_0x412bce['push'](_0x412bce['shift']());}};_0x2b933e(++_0x49b658);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'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 ac67641..e8e17b4 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b5426,_0x35499e){var _0x34274e=function(_0x33f6c5){while(--_0x33f6c5){_0x5b5426['push'](_0x5b5426['shift']());}};_0x34274e(++_0x35499e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4f701c1..1d9550f 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 _0x2c00=['destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x2c00,0xa2));var _0x02c0=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x2c00[_0x36f47c];return _0x296c55;};'use strict';var multer=require(_0x02c0('0x0'));var util=require(_0x02c0('0x1'));var path=require(_0x02c0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x02c0('0x3'));var auth=require(_0x02c0('0x4'));var interaction=require(_0x02c0('0x5'));var config=require(_0x02c0('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x02c0('0x7')]('/',auth[_0x02c0('0x8')](),controller['index']);router[_0x02c0('0x7')](_0x02c0('0x9'),auth[_0x02c0('0x8')](),controller[_0x02c0('0xa')]);router[_0x02c0('0x7')](_0x02c0('0xb'),auth['isAuthenticated'](),controller[_0x02c0('0xc')]);router[_0x02c0('0xd')]('/',auth[_0x02c0('0x8')](),controller[_0x02c0('0xe')]);router[_0x02c0('0xf')](_0x02c0('0xb'),auth['isAuthenticated'](),controller[_0x02c0('0x10')]);router[_0x02c0('0x11')](_0x02c0('0xb'),auth[_0x02c0('0x8')](),controller[_0x02c0('0x12')]);module[_0x02c0('0x13')]=router; \ No newline at end of file +var _0xdf1c=['put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xdf1c,0x82));var _0xcdf1=function(_0x559a1c,_0x389b77){_0x559a1c=_0x559a1c-0x0;var _0x265590=_0xdf1c[_0x559a1c];return _0x265590;};'use strict';var multer=require(_0xcdf1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcdf1('0x1'));var express=require(_0xcdf1('0x2'));var router=express[_0xcdf1('0x3')]();var fs_extra=require(_0xcdf1('0x4'));var auth=require(_0xcdf1('0x5'));var interaction=require(_0xcdf1('0x6'));var config=require('../../config/environment');var controller=require(_0xcdf1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcdf1('0x8')]('/describe',auth[_0xcdf1('0x9')](),controller[_0xcdf1('0xa')]);router[_0xcdf1('0x8')](_0xcdf1('0xb'),auth[_0xcdf1('0x9')](),controller[_0xcdf1('0xc')]);router[_0xcdf1('0xd')]('/',auth[_0xcdf1('0x9')](),controller['create']);router[_0xcdf1('0xe')](_0xcdf1('0xb'),auth[_0xcdf1('0x9')](),controller[_0xcdf1('0xf')]);router[_0xcdf1('0x10')](_0xcdf1('0xb'),auth[_0xcdf1('0x9')](),controller[_0xcdf1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 68d8701..3e69c01 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x4f197f,_0x201042){_0x4f197f=_0x4f197f-0x0;var _0x17f222=_0x7a54[_0x4f197f];return _0x17f222;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x42dd74,_0x5bfe1e){_0x42dd74=_0x42dd74-0x0;var _0x1d283b=_0x7a54[_0x42dd74];return _0x1d283b;};'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 231b655..c010655 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 _0xf5bf=['fieldName','type','key','model','query','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','update','describe','eml-format','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf5bf,0xaf));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xff5b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xff5b('0x1'));var BPromise=require(_0xff5b('0x2'));var Mustache=require(_0xff5b('0x3'));var util=require(_0xff5b('0x4'));var path=require('path');var sox=require(_0xff5b('0x5'));var csv=require(_0xff5b('0x6'));var ejs=require(_0xff5b('0x7'));var fs=require('fs');var fs_extra=require(_0xff5b('0x8'));var _=require('lodash');var squel=require(_0xff5b('0x9'));var crypto=require(_0xff5b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff5b('0xb'));var Redis=require(_0xff5b('0xc'));var authService=require(_0xff5b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xff5b('0xe'));var hardwareService=require(_0xff5b('0xf'));var logger=require('../../config/logger')(_0xff5b('0x10'));var utils=require(_0xff5b('0x11'));var config=require(_0xff5b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xff5b('0x13'))['db'];function respondWithStatusCode(_0x16f959,_0x39e1e4){_0x39e1e4=_0x39e1e4||0xcc;return function(_0x536ab7){if(_0x536ab7){return _0x16f959['sendStatus'](_0x39e1e4);}return _0x16f959[_0xff5b('0x14')](_0x39e1e4)[_0xff5b('0x15')]();};}function respondWithResult(_0x3be648,_0x4871e1){_0x4871e1=_0x4871e1||0xc8;return function(_0x2e59f1){if(_0x2e59f1){return _0x3be648[_0xff5b('0x14')](_0x4871e1)[_0xff5b('0x16')](_0x2e59f1);}};}function respondWithFilteredResult(_0x2dc0b3,_0x82da90){return function(_0x5e478b){if(_0x5e478b){var _0x4e30e3=typeof _0x82da90[_0xff5b('0x17')]===_0xff5b('0x18')&&typeof _0x82da90[_0xff5b('0x19')]===_0xff5b('0x18');var _0x110842=_0x5e478b[_0xff5b('0x1a')];var _0x364d42=_0x4e30e3?0x0:_0x82da90[_0xff5b('0x17')];var _0x5a1785=_0x4e30e3?_0x5e478b[_0xff5b('0x1a')]:_0x82da90[_0xff5b('0x17')]+_0x82da90[_0xff5b('0x19')];var _0x4185d9;if(_0x5a1785>=_0x110842){_0x5a1785=_0x110842;_0x4185d9=0xc8;}else{_0x4185d9=0xce;}_0x2dc0b3[_0xff5b('0x14')](_0x4185d9);return _0x2dc0b3[_0xff5b('0x1b')](_0xff5b('0x1c'),_0x364d42+'-'+_0x5a1785+'/'+_0x110842)[_0xff5b('0x16')](_0x5e478b);}return null;};}function patchUpdates(_0x4d7a11){return function(_0x2d9592){try{jsonpatch[_0xff5b('0x1d')](_0x2d9592,_0x4d7a11,!![]);}catch(_0x428a8b){return BPromise[_0xff5b('0x1e')](_0x428a8b);}return _0x2d9592[_0xff5b('0x1f')]();};}function saveUpdates(_0x59ff7d,_0x580445){return function(_0xa7709d){if(_0xa7709d){return _0xa7709d['update'](_0x59ff7d)[_0xff5b('0x20')](function(_0x4b303a){return _0x4b303a;});}return null;};}function removeEntity(_0x4d51cc,_0x145eac){return function(_0x5bd5ed){if(_0x5bd5ed){return _0x5bd5ed[_0xff5b('0x21')]()[_0xff5b('0x20')](function(){_0x4d51cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x133405,_0x3eaaea){return function(_0x4c46af){if(!_0x4c46af){_0x133405['sendStatus'](0x194);}return _0x4c46af;};}function handleError(_0x26b9ea,_0x4c7b85){_0x4c7b85=_0x4c7b85||0x1f4;return function(_0x2deb64){logger[_0xff5b('0x22')](_0x2deb64[_0xff5b('0x23')]);if(_0x2deb64[_0xff5b('0x24')]){delete _0x2deb64[_0xff5b('0x24')];}_0x26b9ea['status'](_0x4c7b85)['send'](_0x2deb64);};}exports[_0xff5b('0x25')]=function(_0x2b2f05,_0xbbe741){var _0x13dbec={},_0x45d1a4={},_0x391ee3={'count':0x0,'rows':[]};var _0x31ca08=_[_0xff5b('0x26')](db[_0xff5b('0x27')][_0xff5b('0x28')],function(_0x50a9ce){return{'name':_0x50a9ce[_0xff5b('0x29')],'type':_0x50a9ce[_0xff5b('0x2a')][_0xff5b('0x2b')]};});_0x45d1a4[_0xff5b('0x2c')]=_['map'](_0x31ca08,'name');_0x45d1a4['query']=_['keys'](_0x2b2f05[_0xff5b('0x2d')]);_0x45d1a4['filters']=_['intersection'](_0x45d1a4[_0xff5b('0x2c')],_0x45d1a4[_0xff5b('0x2d')]);_0x13dbec[_0xff5b('0x2e')]=_['intersection'](_0x45d1a4['model'],qs[_0xff5b('0x2f')](_0x2b2f05['query']['fields']));_0x13dbec[_0xff5b('0x2e')]=_0x13dbec[_0xff5b('0x2e')][_0xff5b('0x30')]?_0x13dbec[_0xff5b('0x2e')]:_0x45d1a4[_0xff5b('0x2c')];if(!_0x2b2f05[_0xff5b('0x2d')]['hasOwnProperty'](_0xff5b('0x31'))){_0x13dbec[_0xff5b('0x19')]=qs[_0xff5b('0x19')](_0x2b2f05['query'][_0xff5b('0x19')]);_0x13dbec['offset']=qs['offset'](_0x2b2f05[_0xff5b('0x2d')][_0xff5b('0x17')]);}_0x13dbec[_0xff5b('0x32')]=qs[_0xff5b('0x33')](_0x2b2f05['query']['sort']);_0x13dbec['where']=qs[_0xff5b('0x34')](_[_0xff5b('0x35')](_0x2b2f05[_0xff5b('0x2d')],_0x45d1a4[_0xff5b('0x34')]),_0x31ca08);if(_0x2b2f05[_0xff5b('0x2d')][_0xff5b('0x36')]){_0x13dbec[_0xff5b('0x37')]=_[_0xff5b('0x38')](_0x13dbec['where'],{'$or':_[_0xff5b('0x26')](_0x31ca08,function(_0x3f09d4){if(_0x3f09d4[_0xff5b('0x2a')]!==_0xff5b('0x39')){var _0x5749af={};_0x5749af[_0x3f09d4[_0xff5b('0x24')]]={'$like':'%'+_0x2b2f05['query'][_0xff5b('0x36')]+'%'};return _0x5749af;}})});}_0x13dbec=_[_0xff5b('0x38')]({},_0x13dbec,_0x2b2f05[_0xff5b('0x3a')]);var _0x3975c1={'where':_0x13dbec[_0xff5b('0x37')]};return db[_0xff5b('0x27')][_0xff5b('0x1a')](_0x3975c1)['then'](function(_0x431bf1){_0x391ee3[_0xff5b('0x1a')]=_0x431bf1;if(_0x2b2f05['query'][_0xff5b('0x3b')]){_0x13dbec[_0xff5b('0x3c')]=[{'all':!![]}];}return db[_0xff5b('0x27')][_0xff5b('0x3d')](_0x13dbec);})[_0xff5b('0x20')](function(_0x112275){_0x391ee3[_0xff5b('0x3e')]=_0x112275;return _0x391ee3;})[_0xff5b('0x20')](respondWithFilteredResult(_0xbbe741,_0x13dbec))[_0xff5b('0x3f')](handleError(_0xbbe741,null));};exports[_0xff5b('0x40')]=function(_0x59ea16,_0x39cb3f){var _0x2bece7={'raw':!![],'where':{'id':_0x59ea16['params']['id']}},_0x40153f={};_0x40153f[_0xff5b('0x2c')]=_[_0xff5b('0x41')](db[_0xff5b('0x27')][_0xff5b('0x28')]);_0x40153f['query']=_['keys'](_0x59ea16[_0xff5b('0x2d')]);_0x40153f[_0xff5b('0x34')]=_[_0xff5b('0x42')](_0x40153f[_0xff5b('0x2c')],_0x40153f[_0xff5b('0x2d')]);_0x2bece7[_0xff5b('0x2e')]=_[_0xff5b('0x42')](_0x40153f[_0xff5b('0x2c')],qs['fields'](_0x59ea16['query'][_0xff5b('0x2f')]));_0x2bece7['attributes']=_0x2bece7[_0xff5b('0x2e')][_0xff5b('0x30')]?_0x2bece7['attributes']:_0x40153f[_0xff5b('0x2c')];if(_0x59ea16['query'][_0xff5b('0x3b')]){_0x2bece7[_0xff5b('0x3c')]=[{'all':!![]}];}_0x2bece7=_['merge']({},_0x2bece7,_0x59ea16[_0xff5b('0x3a')]);return db[_0xff5b('0x27')][_0xff5b('0x43')](_0x2bece7)['then'](handleEntityNotFound(_0x39cb3f,null))['then'](respondWithResult(_0x39cb3f,null))[_0xff5b('0x3f')](handleError(_0x39cb3f,null));};exports[_0xff5b('0x44')]=function(_0x13a53d,_0x306cbb){return db['JscriptyQuestionReport'][_0xff5b('0x44')](_0x13a53d[_0xff5b('0x45')],{})[_0xff5b('0x20')](respondWithResult(_0x306cbb,0xc9))[_0xff5b('0x3f')](handleError(_0x306cbb,null));};exports[_0xff5b('0x46')]=function(_0x474e21,_0x46875f){if(_0x474e21['body']['id']){delete _0x474e21['body']['id'];}return db[_0xff5b('0x27')][_0xff5b('0x43')]({'where':{'id':_0x474e21['params']['id']}})['then'](handleEntityNotFound(_0x46875f,null))[_0xff5b('0x20')](saveUpdates(_0x474e21[_0xff5b('0x45')],null))[_0xff5b('0x20')](respondWithResult(_0x46875f,null))[_0xff5b('0x3f')](handleError(_0x46875f,null));};exports[_0xff5b('0x21')]=function(_0x2a6c7f,_0x34c43b){return db[_0xff5b('0x27')][_0xff5b('0x43')]({'where':{'id':_0x2a6c7f['params']['id']}})['then'](handleEntityNotFound(_0x34c43b,null))[_0xff5b('0x20')](removeEntity(_0x34c43b,null))[_0xff5b('0x3f')](handleError(_0x34c43b,null));};exports[_0xff5b('0x47')]=function(_0xf9af6e,_0x2f9a7e){return db[_0xff5b('0x27')]['describe']()[_0xff5b('0x20')](respondWithResult(_0x2f9a7e,null))[_0xff5b('0x3f')](handleError(_0x2f9a7e,null));}; \ No newline at end of file +var _0x53b5=['send','JscriptyQuestionReport','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name'];(function(_0x3ff2a5,_0x390f5b){var _0x6b0c0=function(_0x281573){while(--_0x281573){_0x3ff2a5['push'](_0x3ff2a5['shift']());}};_0x6b0c0(++_0x390f5b);}(_0x53b5,0x19c));var _0x553b=function(_0x3f7838,_0x3f3e2c){_0x3f7838=_0x3f7838-0x0;var _0x41bb40=_0x53b5[_0x3f7838];return _0x41bb40;};'use strict';var emlformat=require(_0x553b('0x0'));var rimraf=require(_0x553b('0x1'));var zipdir=require(_0x553b('0x2'));var jsonpatch=require(_0x553b('0x3'));var rp=require(_0x553b('0x4'));var moment=require(_0x553b('0x5'));var BPromise=require(_0x553b('0x6'));var Mustache=require(_0x553b('0x7'));var util=require(_0x553b('0x8'));var path=require(_0x553b('0x9'));var sox=require(_0x553b('0xa'));var csv=require('to-csv');var ejs=require(_0x553b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553b('0xc'));var squel=require(_0x553b('0xd'));var crypto=require(_0x553b('0xe'));var jsforce=require(_0x553b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x553b('0x10'));var Papa=require(_0x553b('0x11'));var Redis=require(_0x553b('0x12'));var authService=require(_0x553b('0x13'));var qs=require(_0x553b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x553b('0x15'))(_0x553b('0x16'));var utils=require(_0x553b('0x17'));var config=require(_0x553b('0x18'));var licenseUtil=require(_0x553b('0x19'));var db=require(_0x553b('0x1a'))['db'];function respondWithStatusCode(_0x5b31ca,_0x4ff375){_0x4ff375=_0x4ff375||0xcc;return function(_0x38dfd1){if(_0x38dfd1){return _0x5b31ca[_0x553b('0x1b')](_0x4ff375);}return _0x5b31ca['status'](_0x4ff375)[_0x553b('0x1c')]();};}function respondWithResult(_0x3344f5,_0x272552){_0x272552=_0x272552||0xc8;return function(_0x3c502d){if(_0x3c502d){return _0x3344f5[_0x553b('0x1d')](_0x272552)[_0x553b('0x1e')](_0x3c502d);}};}function respondWithFilteredResult(_0x35ddb1,_0x479192){return function(_0x53155a){if(_0x53155a){var _0x192a99=typeof _0x479192['offset']===_0x553b('0x1f')&&typeof _0x479192[_0x553b('0x20')]==='undefined';var _0x5b442e=_0x53155a['count'];var _0x3eb849=_0x192a99?0x0:_0x479192['offset'];var _0x64577d=_0x192a99?_0x53155a[_0x553b('0x21')]:_0x479192[_0x553b('0x22')]+_0x479192[_0x553b('0x20')];var _0x117ef0;if(_0x64577d>=_0x5b442e){_0x64577d=_0x5b442e;_0x117ef0=0xc8;}else{_0x117ef0=0xce;}_0x35ddb1[_0x553b('0x1d')](_0x117ef0);return _0x35ddb1[_0x553b('0x23')](_0x553b('0x24'),_0x3eb849+'-'+_0x64577d+'/'+_0x5b442e)[_0x553b('0x1e')](_0x53155a);}return null;};}function patchUpdates(_0xaa8eaa){return function(_0x184612){try{jsonpatch[_0x553b('0x25')](_0x184612,_0xaa8eaa,!![]);}catch(_0x1cb4b3){return BPromise['reject'](_0x1cb4b3);}return _0x184612['save']();};}function saveUpdates(_0x234749,_0x484a1e){return function(_0x306431){if(_0x306431){return _0x306431[_0x553b('0x26')](_0x234749)[_0x553b('0x27')](function(_0x2814af){return _0x2814af;});}return null;};}function removeEntity(_0x1c4a12,_0x2e7c1f){return function(_0xc2d0d){if(_0xc2d0d){return _0xc2d0d[_0x553b('0x28')]()[_0x553b('0x27')](function(){_0x1c4a12['status'](0xcc)[_0x553b('0x1c')]();});}};}function handleEntityNotFound(_0x192bd0,_0x170b1c){return function(_0xf8dd3d){if(!_0xf8dd3d){_0x192bd0[_0x553b('0x1b')](0x194);}return _0xf8dd3d;};}function handleError(_0x5384dd,_0x423057){_0x423057=_0x423057||0x1f4;return function(_0x4d3e44){logger[_0x553b('0x29')](_0x4d3e44[_0x553b('0x2a')]);if(_0x4d3e44[_0x553b('0x2b')]){delete _0x4d3e44[_0x553b('0x2b')];}_0x5384dd[_0x553b('0x1d')](_0x423057)[_0x553b('0x2c')](_0x4d3e44);};}exports['index']=function(_0x123675,_0x550e65){var _0x1e6486={},_0x1d7005={},_0x3d08dc={'count':0x0,'rows':[]};var _0x1456ec=_['map'](db[_0x553b('0x2d')]['rawAttributes'],function(_0x2ac78c){return{'name':_0x2ac78c['fieldName'],'type':_0x2ac78c[_0x553b('0x2e')][_0x553b('0x2f')]};});_0x1d7005[_0x553b('0x30')]=_['map'](_0x1456ec,_0x553b('0x2b'));_0x1d7005[_0x553b('0x31')]=_[_0x553b('0x32')](_0x123675[_0x553b('0x31')]);_0x1d7005['filters']=_[_0x553b('0x33')](_0x1d7005[_0x553b('0x30')],_0x1d7005['query']);_0x1e6486[_0x553b('0x34')]=_[_0x553b('0x33')](_0x1d7005[_0x553b('0x30')],qs[_0x553b('0x35')](_0x123675[_0x553b('0x31')][_0x553b('0x35')]));_0x1e6486[_0x553b('0x34')]=_0x1e6486[_0x553b('0x34')][_0x553b('0x36')]?_0x1e6486[_0x553b('0x34')]:_0x1d7005[_0x553b('0x30')];if(!_0x123675[_0x553b('0x31')][_0x553b('0x37')](_0x553b('0x38'))){_0x1e6486['limit']=qs[_0x553b('0x20')](_0x123675[_0x553b('0x31')][_0x553b('0x20')]);_0x1e6486[_0x553b('0x22')]=qs[_0x553b('0x22')](_0x123675[_0x553b('0x31')][_0x553b('0x22')]);}_0x1e6486['order']=qs[_0x553b('0x39')](_0x123675['query'][_0x553b('0x39')]);_0x1e6486[_0x553b('0x3a')]=qs[_0x553b('0x3b')](_[_0x553b('0x3c')](_0x123675[_0x553b('0x31')],_0x1d7005[_0x553b('0x3b')]),_0x1456ec);if(_0x123675[_0x553b('0x31')][_0x553b('0x3d')]){_0x1e6486['where']=_[_0x553b('0x3e')](_0x1e6486[_0x553b('0x3a')],{'$or':_[_0x553b('0x3f')](_0x1456ec,function(_0x286c4a){if(_0x286c4a[_0x553b('0x2e')]!=='VIRTUAL'){var _0x1abe70={};_0x1abe70[_0x286c4a['name']]={'$like':'%'+_0x123675[_0x553b('0x31')][_0x553b('0x3d')]+'%'};return _0x1abe70;}})});}_0x1e6486=_[_0x553b('0x3e')]({},_0x1e6486,_0x123675[_0x553b('0x40')]);var _0x253fab={'where':_0x1e6486['where']};return db['JscriptyQuestionReport'][_0x553b('0x21')](_0x253fab)[_0x553b('0x27')](function(_0x1c717f){_0x3d08dc[_0x553b('0x21')]=_0x1c717f;if(_0x123675[_0x553b('0x31')][_0x553b('0x41')]){_0x1e6486[_0x553b('0x42')]=[{'all':!![]}];}return db[_0x553b('0x2d')]['findAll'](_0x1e6486);})[_0x553b('0x27')](function(_0x47cc2c){_0x3d08dc[_0x553b('0x43')]=_0x47cc2c;return _0x3d08dc;})[_0x553b('0x27')](respondWithFilteredResult(_0x550e65,_0x1e6486))[_0x553b('0x44')](handleError(_0x550e65,null));};exports[_0x553b('0x45')]=function(_0x4187f1,_0x3093d3){var _0x283113={'raw':!![],'where':{'id':_0x4187f1[_0x553b('0x46')]['id']}},_0x524c60={};_0x524c60[_0x553b('0x30')]=_['keys'](db[_0x553b('0x2d')][_0x553b('0x47')]);_0x524c60[_0x553b('0x31')]=_[_0x553b('0x32')](_0x4187f1['query']);_0x524c60[_0x553b('0x3b')]=_['intersection'](_0x524c60[_0x553b('0x30')],_0x524c60[_0x553b('0x31')]);_0x283113[_0x553b('0x34')]=_[_0x553b('0x33')](_0x524c60[_0x553b('0x30')],qs['fields'](_0x4187f1[_0x553b('0x31')][_0x553b('0x35')]));_0x283113[_0x553b('0x34')]=_0x283113[_0x553b('0x34')][_0x553b('0x36')]?_0x283113['attributes']:_0x524c60[_0x553b('0x30')];if(_0x4187f1[_0x553b('0x31')][_0x553b('0x41')]){_0x283113[_0x553b('0x42')]=[{'all':!![]}];}_0x283113=_[_0x553b('0x3e')]({},_0x283113,_0x4187f1['options']);return db['JscriptyQuestionReport']['find'](_0x283113)[_0x553b('0x27')](handleEntityNotFound(_0x3093d3,null))[_0x553b('0x27')](respondWithResult(_0x3093d3,null))[_0x553b('0x44')](handleError(_0x3093d3,null));};exports[_0x553b('0x48')]=function(_0x3a9e20,_0x494640){return db[_0x553b('0x2d')][_0x553b('0x48')](_0x3a9e20[_0x553b('0x49')],{})[_0x553b('0x27')](respondWithResult(_0x494640,0xc9))['catch'](handleError(_0x494640,null));};exports['update']=function(_0x28b8d6,_0x1b674a){if(_0x28b8d6[_0x553b('0x49')]['id']){delete _0x28b8d6[_0x553b('0x49')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x28b8d6['params']['id']}})[_0x553b('0x27')](handleEntityNotFound(_0x1b674a,null))[_0x553b('0x27')](saveUpdates(_0x28b8d6[_0x553b('0x49')],null))[_0x553b('0x27')](respondWithResult(_0x1b674a,null))['catch'](handleError(_0x1b674a,null));};exports[_0x553b('0x28')]=function(_0x5a4421,_0x1ecab3){return db['JscriptyQuestionReport'][_0x553b('0x4a')]({'where':{'id':_0x5a4421[_0x553b('0x46')]['id']}})[_0x553b('0x27')](handleEntityNotFound(_0x1ecab3,null))[_0x553b('0x27')](removeEntity(_0x1ecab3,null))[_0x553b('0x44')](handleError(_0x1ecab3,null));};exports[_0x553b('0x4b')]=function(_0x5c6c52,_0x1b01d6){return db[_0x553b('0x2d')][_0x553b('0x4b')]()[_0x553b('0x27')](respondWithResult(_0x1b01d6,null))[_0x553b('0x44')](handleError(_0x1b01d6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 59f91fc..848b1f8 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 _0x38c5=['../../config/environment','exports','define','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x532b6f,_0x362086){var _0x5b9986=function(_0x371001){while(--_0x371001){_0x532b6f['push'](_0x532b6f['shift']());}};_0x5b9986(++_0x362086);}(_0x38c5,0x86));var _0x538c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x38c5[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x538c('0x0'));var util=require(_0x538c('0x1'));var logger=require(_0x538c('0x2'))(_0x538c('0x3'));var moment=require(_0x538c('0x4'));var BPromise=require(_0x538c('0x5'));var rp=require(_0x538c('0x6'));var fs=require('fs');var path=require(_0x538c('0x7'));var rimraf=require(_0x538c('0x8'));var config=require(_0x538c('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x538c('0xa')]=function(_0x362b73,_0x1463c8){return _0x362b73[_0x538c('0xb')]('JscriptyQuestionReport',attributes,{'tableName':_0x538c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6935=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','lodash'];(function(_0x2424fa,_0x1d4322){var _0x294f68=function(_0x13da05){while(--_0x13da05){_0x2424fa['push'](_0x2424fa['shift']());}};_0x294f68(++_0x1d4322);}(_0x6935,0xb3));var _0x5693=function(_0x39f03e,_0x12f827){_0x39f03e=_0x39f03e-0x0;var _0x103757=_0x6935[_0x39f03e];return _0x103757;};'use strict';var _=require(_0x5693('0x0'));var util=require(_0x5693('0x1'));var logger=require(_0x5693('0x2'))(_0x5693('0x3'));var moment=require('moment');var BPromise=require(_0x5693('0x4'));var rp=require(_0x5693('0x5'));var fs=require('fs');var path=require(_0x5693('0x6'));var rimraf=require(_0x5693('0x7'));var config=require(_0x5693('0x8'));var attributes=require(_0x5693('0x9'));module[_0x5693('0xa')]=function(_0x11f71a,_0x2f9afd){return _0x11f71a[_0x5693('0xb')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 7ed7423..b227094 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 _0xf1b9=['jayson/promise','http','request','then','info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x446e2c,_0x57f9ba){var _0x727b86=function(_0x495411){while(--_0x495411){_0x446e2c['push'](_0x446e2c['shift']());}};_0x727b86(++_0x57f9ba);}(_0xf1b9,0x116));var _0x9f1b=function(_0x1ce079,_0x1db391){_0x1ce079=_0x1ce079-0x0;var _0x67ae62=_0xf1b9[_0x1ce079];return _0x67ae62;};'use strict';var _=require(_0x9f1b('0x0'));var util=require('util');var moment=require(_0x9f1b('0x1'));var BPromise=require(_0x9f1b('0x2'));var rs=require(_0x9f1b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f1b('0x4'))['db'];var utils=require(_0x9f1b('0x5'));var logger=require('../../config/logger')(_0x9f1b('0x6'));var config=require(_0x9f1b('0x7'));var jayson=require(_0x9f1b('0x8'));var client=jayson['client'][_0x9f1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463e4b,_0x5548be,_0x544d05){return new BPromise(function(_0x2fdde0,_0x2cd850){return client[_0x9f1b('0xa')](_0x463e4b,_0x544d05)[_0x9f1b('0xb')](function(_0x392cbe){logger[_0x9f1b('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5548be,_0x9f1b('0xd'));logger['debug'](_0x9f1b('0xe'),_0x5548be,_0x9f1b('0xd'),JSON[_0x9f1b('0xf')](_0x392cbe));if(_0x392cbe[_0x9f1b('0x10')]){if(_0x392cbe[_0x9f1b('0x10')][_0x9f1b('0x11')]===0x1f4){logger[_0x9f1b('0x10')](_0x9f1b('0x12'),_0x5548be,_0x392cbe['error']['message']);return _0x2cd850(_0x392cbe[_0x9f1b('0x10')][_0x9f1b('0x13')]);}logger[_0x9f1b('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5548be,_0x392cbe[_0x9f1b('0x10')][_0x9f1b('0x13')]);return _0x2fdde0(_0x392cbe[_0x9f1b('0x10')][_0x9f1b('0x13')]);}else{logger[_0x9f1b('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5548be,_0x9f1b('0xd'));_0x2fdde0(_0x392cbe[_0x9f1b('0x14')][_0x9f1b('0x13')]);}})[_0x9f1b('0x15')](function(_0x309387){logger[_0x9f1b('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5548be,_0x309387);_0x2cd850(_0x309387);});});} \ No newline at end of file +var _0xb701=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x3879ec,_0x11f459){var _0xb3b746=function(_0x80a48d){while(--_0x80a48d){_0x3879ec['push'](_0x3879ec['shift']());}};_0xb3b746(++_0x11f459);}(_0xb701,0x81));var _0x1b70=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb701[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x1b70('0x0'));var util=require(_0x1b70('0x1'));var moment=require(_0x1b70('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b70('0x3'));var fs=require('fs');var Redis=require(_0x1b70('0x4'));var db=require(_0x1b70('0x5'))['db'];var utils=require(_0x1b70('0x6'));var logger=require(_0x1b70('0x7'))('rpc');var config=require(_0x1b70('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1b70('0x9')][_0x1b70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c32a,_0x56235a,_0x396a9e){return new BPromise(function(_0x1c3006,_0x5260c2){return client[_0x1b70('0xb')](_0x58c32a,_0x396a9e)[_0x1b70('0xc')](function(_0x5880b1){logger[_0x1b70('0xd')](_0x1b70('0xe'),_0x56235a,_0x1b70('0xf'));logger[_0x1b70('0x10')](_0x1b70('0x11'),_0x56235a,_0x1b70('0xf'),JSON['stringify'](_0x5880b1));if(_0x5880b1[_0x1b70('0x12')]){if(_0x5880b1[_0x1b70('0x12')][_0x1b70('0x13')]===0x1f4){logger[_0x1b70('0x12')](_0x1b70('0xe'),_0x56235a,_0x5880b1[_0x1b70('0x12')][_0x1b70('0x14')]);return _0x5260c2(_0x5880b1[_0x1b70('0x12')][_0x1b70('0x14')]);}logger[_0x1b70('0x12')](_0x1b70('0xe'),_0x56235a,_0x5880b1['error']['message']);return _0x1c3006(_0x5880b1[_0x1b70('0x12')]['message']);}else{logger['info'](_0x1b70('0xe'),_0x56235a,'request\x20sent');_0x1c3006(_0x5880b1[_0x1b70('0x15')][_0x1b70('0x14')]);}})['catch'](function(_0x83e902){logger[_0x1b70('0x12')](_0x1b70('0xe'),_0x56235a,_0x83e902);_0x5260c2(_0x83e902);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d87ddff..964f969 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 _0x335c=['show','getQuestions','post','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','describe'];(function(_0x31ea60,_0x153b80){var _0x1fc01c=function(_0xc94423){while(--_0xc94423){_0x31ea60['push'](_0x31ea60['shift']());}};_0x1fc01c(++_0x153b80);}(_0x335c,0xd7));var _0xc335=function(_0x30e153,_0x29152d){_0x30e153=_0x30e153-0x0;var _0x5be042=_0x335c[_0x30e153];return _0x5be042;};'use strict';var multer=require(_0xc335('0x0'));var util=require(_0xc335('0x1'));var path=require(_0xc335('0x2'));var timeout=require(_0xc335('0x3'));var express=require(_0xc335('0x4'));var router=express[_0xc335('0x5')]();var fs_extra=require(_0xc335('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc335('0x7'));var config=require(_0xc335('0x8'));var controller=require(_0xc335('0x9'));router[_0xc335('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc335('0xa')]('/describe',auth[_0xc335('0xb')](),controller[_0xc335('0xc')]);router[_0xc335('0xa')]('/:id',auth[_0xc335('0xb')](),controller[_0xc335('0xd')]);router['get']('/:id/questions',auth[_0xc335('0xb')](),controller[_0xc335('0xe')]);router[_0xc335('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc335('0x10'),auth[_0xc335('0xb')](),controller['update']);router[_0xc335('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc335('0x12')]=router; \ No newline at end of file +var _0xc8ad=['getQuestions','update','/:id','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','show'];(function(_0xb20382,_0x302834){var _0x1b0972=function(_0x71a295){while(--_0x71a295){_0xb20382['push'](_0xb20382['shift']());}};_0x1b0972(++_0x302834);}(_0xc8ad,0xa5));var _0xdc8a=function(_0x268984,_0x38d720){_0x268984=_0x268984-0x0;var _0x578e8b=_0xc8ad[_0x268984];return _0x578e8b;};'use strict';var multer=require('multer');var util=require(_0xdc8a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc8a('0x1'));var router=express[_0xdc8a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdc8a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdc8a('0x4'));var controller=require(_0xdc8a('0x5'));router[_0xdc8a('0x6')]('/',auth[_0xdc8a('0x7')](),controller[_0xdc8a('0x8')]);router[_0xdc8a('0x6')](_0xdc8a('0x9'),auth[_0xdc8a('0x7')](),controller['describe']);router[_0xdc8a('0x6')]('/:id',auth[_0xdc8a('0x7')](),controller[_0xdc8a('0xa')]);router[_0xdc8a('0x6')]('/:id/questions',auth[_0xdc8a('0x7')](),controller[_0xdc8a('0xb')]);router['post']('/',auth[_0xdc8a('0x7')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdc8a('0xc')]);router['delete'](_0xdc8a('0xd'),auth[_0xdc8a('0x7')](),controller[_0xdc8a('0xe')]);module[_0xdc8a('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 49a3d5e..9205822 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 _0xea52=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea52,0x103));var _0x2ea5=function(_0x7cdaf1,_0x40e620){_0x7cdaf1=_0x7cdaf1-0x0;var _0xf58e9a=_0xea52[_0x7cdaf1];return _0xf58e9a;};'use strict';var moment=require('moment');var Sequelize=require(_0x2ea5('0x0'));module[_0x2ea5('0x1')]={'starttime':{'type':Sequelize[_0x2ea5('0x2')],'set':function(_0x3131ed){this[_0x2ea5('0x3')](_0x2ea5('0x4'),_0x3131ed);this[_0x2ea5('0x3')]('endtime',moment()[_0x2ea5('0x5')](_0x2ea5('0x6')));}},'endtime':{'type':Sequelize[_0x2ea5('0x2')]},'membername':{'type':Sequelize[_0x2ea5('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2ea5('0x7')]},'uniqueid':{'type':Sequelize[_0x2ea5('0x7')]},'calleridname':{'type':Sequelize[_0x2ea5('0x7')]},'calleridnum':{'type':Sequelize[_0x2ea5('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3eea=['setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3eea,0x1ad));var _0xa3ee=function(_0x33d8b4,_0x967279){_0x33d8b4=_0x33d8b4-0x0;var _0x2f827f=_0x3eea[_0x33d8b4];return _0x2f827f;};'use strict';var moment=require('moment');var Sequelize=require(_0xa3ee('0x0'));module[_0xa3ee('0x1')]={'starttime':{'type':Sequelize[_0xa3ee('0x2')],'set':function(_0x11b8bc){this[_0xa3ee('0x3')](_0xa3ee('0x4'),_0x11b8bc);this[_0xa3ee('0x3')](_0xa3ee('0x5'),moment()['format'](_0xa3ee('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xa3ee('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa3ee('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xa3ee('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index d4e9ee6..b74c3ee 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 _0xa51e=['then','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','create','body','find','destroy','params','describe','getQuestions','JscriptyQuestionReport','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','set','Content-Range','apply','save','update'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0xa51e,0x77));var _0xea51=function(_0x332005,_0x24edf1){_0x332005=_0x332005-0x0;var _0x4393e1=_0xa51e[_0x332005];return _0x4393e1;};'use strict';var emlformat=require(_0xea51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea51('0x1'));var jsonpatch=require(_0xea51('0x2'));var rp=require(_0xea51('0x3'));var moment=require(_0xea51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea51('0x5'));var util=require(_0xea51('0x6'));var path=require(_0xea51('0x7'));var sox=require(_0xea51('0x8'));var csv=require(_0xea51('0x9'));var ejs=require(_0xea51('0xa'));var fs=require('fs');var fs_extra=require(_0xea51('0xb'));var _=require('lodash');var squel=require(_0xea51('0xc'));var crypto=require(_0xea51('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xea51('0xe'));var toCsv=require(_0xea51('0x9'));var querystring=require(_0xea51('0xf'));var Papa=require('papaparse');var Redis=require(_0xea51('0x10'));var authService=require(_0xea51('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xea51('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea51('0x13'))(_0xea51('0x14'));var utils=require(_0xea51('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xea51('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x198b64,_0x5d236b){_0x5d236b=_0x5d236b||0xcc;return function(_0x237d96){if(_0x237d96){return _0x198b64[_0xea51('0x17')](_0x5d236b);}return _0x198b64[_0xea51('0x18')](_0x5d236b)[_0xea51('0x19')]();};}function respondWithResult(_0x11b2db,_0x5376a8){_0x5376a8=_0x5376a8||0xc8;return function(_0x11c766){if(_0x11c766){return _0x11b2db[_0xea51('0x18')](_0x5376a8)[_0xea51('0x1a')](_0x11c766);}};}function respondWithFilteredResult(_0x1becdc,_0xfd470e){return function(_0xfd58f9){if(_0xfd58f9){var _0x3c3254=typeof _0xfd470e['offset']===_0xea51('0x1b')&&typeof _0xfd470e['limit']===_0xea51('0x1b');var _0x76bfb9=_0xfd58f9['count'];var _0x3ff644=_0x3c3254?0x0:_0xfd470e[_0xea51('0x1c')];var _0x198ba6=_0x3c3254?_0xfd58f9[_0xea51('0x1d')]:_0xfd470e[_0xea51('0x1c')]+_0xfd470e['limit'];var _0x55fcbf;if(_0x198ba6>=_0x76bfb9){_0x198ba6=_0x76bfb9;_0x55fcbf=0xc8;}else{_0x55fcbf=0xce;}_0x1becdc[_0xea51('0x18')](_0x55fcbf);return _0x1becdc[_0xea51('0x1e')](_0xea51('0x1f'),_0x3ff644+'-'+_0x198ba6+'/'+_0x76bfb9)['json'](_0xfd58f9);}return null;};}function patchUpdates(_0x4f0f09){return function(_0x5ce84d){try{jsonpatch[_0xea51('0x20')](_0x5ce84d,_0x4f0f09,!![]);}catch(_0x9ade24){return BPromise['reject'](_0x9ade24);}return _0x5ce84d[_0xea51('0x21')]();};}function saveUpdates(_0x3c0d50,_0x91df94){return function(_0x3731e4){if(_0x3731e4){return _0x3731e4[_0xea51('0x22')](_0x3c0d50)[_0xea51('0x23')](function(_0x42e80e){return _0x42e80e;});}return null;};}function removeEntity(_0x1302ca,_0x1efe63){return function(_0x5b8daf){if(_0x5b8daf){return _0x5b8daf['destroy']()[_0xea51('0x23')](function(){_0x1302ca['status'](0xcc)[_0xea51('0x19')]();});}};}function handleEntityNotFound(_0x1d01cf,_0xeba601){return function(_0x339c9a){if(!_0x339c9a){_0x1d01cf[_0xea51('0x17')](0x194);}return _0x339c9a;};}function handleError(_0x24f8cc,_0x51b222){_0x51b222=_0x51b222||0x1f4;return function(_0x4d41ee){logger[_0xea51('0x24')](_0x4d41ee['stack']);if(_0x4d41ee[_0xea51('0x25')]){delete _0x4d41ee[_0xea51('0x25')];}_0x24f8cc[_0xea51('0x18')](_0x51b222)[_0xea51('0x26')](_0x4d41ee);};}exports[_0xea51('0x27')]=function(_0x38e8cd,_0x29573f){var _0xcd4160={},_0x28a192={},_0x43ba18={'count':0x0,'rows':[]};var _0x120453=_[_0xea51('0x28')](db[_0xea51('0x29')][_0xea51('0x2a')],function(_0x2d5730){return{'name':_0x2d5730[_0xea51('0x2b')],'type':_0x2d5730[_0xea51('0x2c')][_0xea51('0x2d')]};});_0x28a192[_0xea51('0x2e')]=_['map'](_0x120453,_0xea51('0x25'));_0x28a192[_0xea51('0x2f')]=_['keys'](_0x38e8cd[_0xea51('0x2f')]);_0x28a192[_0xea51('0x30')]=_[_0xea51('0x31')](_0x28a192['model'],_0x28a192['query']);_0xcd4160['attributes']=_[_0xea51('0x31')](_0x28a192[_0xea51('0x2e')],qs[_0xea51('0x32')](_0x38e8cd[_0xea51('0x2f')][_0xea51('0x32')]));_0xcd4160[_0xea51('0x33')]=_0xcd4160[_0xea51('0x33')][_0xea51('0x34')]?_0xcd4160[_0xea51('0x33')]:_0x28a192[_0xea51('0x2e')];if(!_0x38e8cd[_0xea51('0x2f')]['hasOwnProperty'](_0xea51('0x35'))){_0xcd4160[_0xea51('0x36')]=qs[_0xea51('0x36')](_0x38e8cd[_0xea51('0x2f')][_0xea51('0x36')]);_0xcd4160[_0xea51('0x1c')]=qs[_0xea51('0x1c')](_0x38e8cd[_0xea51('0x2f')]['offset']);}_0xcd4160[_0xea51('0x37')]=qs[_0xea51('0x38')](_0x38e8cd['query'][_0xea51('0x38')]);_0xcd4160[_0xea51('0x39')]=qs[_0xea51('0x30')](_[_0xea51('0x3a')](_0x38e8cd['query'],_0x28a192[_0xea51('0x30')]),_0x120453);if(_0x38e8cd['query'][_0xea51('0x3b')]){_0xcd4160[_0xea51('0x39')]=_['merge'](_0xcd4160[_0xea51('0x39')],{'$or':_[_0xea51('0x28')](_0x120453,function(_0xc9e66a){if(_0xc9e66a[_0xea51('0x2c')]!=='VIRTUAL'){var _0x7f7661={};_0x7f7661[_0xc9e66a[_0xea51('0x25')]]={'$like':'%'+_0x38e8cd[_0xea51('0x2f')][_0xea51('0x3b')]+'%'};return _0x7f7661;}})});}_0xcd4160=_[_0xea51('0x3c')]({},_0xcd4160,_0x38e8cd[_0xea51('0x3d')]);var _0x31fcc5={'where':_0xcd4160[_0xea51('0x39')]};return db[_0xea51('0x29')][_0xea51('0x1d')](_0x31fcc5)['then'](function(_0x25c2a8){_0x43ba18[_0xea51('0x1d')]=_0x25c2a8;if(_0x38e8cd[_0xea51('0x2f')][_0xea51('0x3e')]){_0xcd4160[_0xea51('0x3f')]=[{'all':!![]}];}return db[_0xea51('0x29')][_0xea51('0x40')](_0xcd4160);})['then'](function(_0x2edbe1){_0x43ba18['rows']=_0x2edbe1;return _0x43ba18;})['then'](respondWithFilteredResult(_0x29573f,_0xcd4160))[_0xea51('0x41')](handleError(_0x29573f,null));};exports[_0xea51('0x42')]=function(_0x3156dc,_0x462873){var _0x28d66b={'raw':!![],'where':{'id':_0x3156dc['params']['id']}},_0x7996ea={};_0x7996ea[_0xea51('0x2e')]=_['keys'](db[_0xea51('0x29')]['rawAttributes']);_0x7996ea['query']=_[_0xea51('0x43')](_0x3156dc['query']);_0x7996ea[_0xea51('0x30')]=_['intersection'](_0x7996ea[_0xea51('0x2e')],_0x7996ea[_0xea51('0x2f')]);_0x28d66b[_0xea51('0x33')]=_[_0xea51('0x31')](_0x7996ea['model'],qs[_0xea51('0x32')](_0x3156dc[_0xea51('0x2f')][_0xea51('0x32')]));_0x28d66b[_0xea51('0x33')]=_0x28d66b[_0xea51('0x33')][_0xea51('0x34')]?_0x28d66b[_0xea51('0x33')]:_0x7996ea['model'];if(_0x3156dc[_0xea51('0x2f')][_0xea51('0x3e')]){_0x28d66b[_0xea51('0x3f')]=[{'all':!![]}];}_0x28d66b=_[_0xea51('0x3c')]({},_0x28d66b,_0x3156dc[_0xea51('0x3d')]);return db['JscriptySessionReport']['find'](_0x28d66b)[_0xea51('0x23')](handleEntityNotFound(_0x462873,null))['then'](respondWithResult(_0x462873,null))[_0xea51('0x41')](handleError(_0x462873,null));};exports[_0xea51('0x44')]=function(_0x2e25da,_0x2b2b70){return db['JscriptySessionReport'][_0xea51('0x44')](_0x2e25da[_0xea51('0x45')],{})[_0xea51('0x23')](respondWithResult(_0x2b2b70,0xc9))[_0xea51('0x41')](handleError(_0x2b2b70,null));};exports[_0xea51('0x22')]=function(_0x5241aa,_0xf5b5a){if(_0x5241aa[_0xea51('0x45')]['id']){delete _0x5241aa['body']['id'];}return db[_0xea51('0x29')][_0xea51('0x46')]({'where':{'id':_0x5241aa['params']['id']}})['then'](handleEntityNotFound(_0xf5b5a,null))[_0xea51('0x23')](saveUpdates(_0x5241aa[_0xea51('0x45')],null))[_0xea51('0x23')](respondWithResult(_0xf5b5a,null))[_0xea51('0x41')](handleError(_0xf5b5a,null));};exports[_0xea51('0x47')]=function(_0x1ef05d,_0x3a3c15){return db['JscriptySessionReport']['find']({'where':{'id':_0x1ef05d[_0xea51('0x48')]['id']}})[_0xea51('0x23')](handleEntityNotFound(_0x3a3c15,null))[_0xea51('0x23')](removeEntity(_0x3a3c15,null))[_0xea51('0x41')](handleError(_0x3a3c15,null));};exports[_0xea51('0x49')]=function(_0x51fa7d,_0x4f76f9){return db[_0xea51('0x29')][_0xea51('0x49')]()['then'](respondWithResult(_0x4f76f9,null))[_0xea51('0x41')](handleError(_0x4f76f9,null));};exports[_0xea51('0x4a')]=function(_0x418b42,_0x5398a2,_0xe58883){var _0x3e91c0={'raw':!![],'where':{}};var _0x4cc65b={};var _0x1f3dcd={'count':0x0,'rows':[]};return db[_0xea51('0x29')]['findOne']({'where':{'id':_0x418b42[_0xea51('0x48')]['id']}})[_0xea51('0x23')](handleEntityNotFound(_0x5398a2,null))[_0xea51('0x23')](function(_0x492336){if(_0x492336){_0x4cc65b['model']=_[_0xea51('0x43')](db[_0xea51('0x4b')][_0xea51('0x2a')]);_0x4cc65b[_0xea51('0x2f')]=_[_0xea51('0x43')](_0x418b42[_0xea51('0x2f')]);_0x4cc65b[_0xea51('0x30')]=_[_0xea51('0x31')](_0x4cc65b[_0xea51('0x2e')],_0x4cc65b[_0xea51('0x2f')]);_0x3e91c0['attributes']=_[_0xea51('0x31')](_0x4cc65b[_0xea51('0x2e')],qs[_0xea51('0x32')](_0x418b42[_0xea51('0x2f')][_0xea51('0x32')]));_0x3e91c0['attributes']=_0x3e91c0[_0xea51('0x33')][_0xea51('0x34')]?_0x3e91c0['attributes']:_0x4cc65b[_0xea51('0x2e')];if(!_0x418b42[_0xea51('0x2f')][_0xea51('0x4c')]('nolimit')){_0x3e91c0[_0xea51('0x36')]=qs[_0xea51('0x36')](_0x418b42[_0xea51('0x2f')][_0xea51('0x36')]);_0x3e91c0[_0xea51('0x1c')]=qs[_0xea51('0x1c')](_0x418b42[_0xea51('0x2f')][_0xea51('0x1c')]);}_0x3e91c0[_0xea51('0x37')]=qs['sort'](_0x418b42[_0xea51('0x2f')][_0xea51('0x38')]);_0x3e91c0['where']=qs[_0xea51('0x30')](_['pick'](_0x418b42[_0xea51('0x2f')],_0x4cc65b[_0xea51('0x30')]));_0x3e91c0[_0xea51('0x39')]['SessionId']=_0x492336['id'];if(_0x418b42[_0xea51('0x2f')][_0xea51('0x3b')]){_0x3e91c0[_0xea51('0x39')]=_['merge'](_0x3e91c0['where'],{'$or':_[_0xea51('0x28')](_0x3e91c0[_0xea51('0x33')],function(_0x27c061){var _0x972e55={};_0x972e55[_0x27c061]={'$like':'%'+_0x418b42[_0xea51('0x2f')][_0xea51('0x3b')]+'%'};return _0x972e55;})});}_0x3e91c0=_[_0xea51('0x3c')]({},_0x3e91c0,_0x418b42[_0xea51('0x3d')]);return db[_0xea51('0x4b')]['count']({'where':_0x3e91c0[_0xea51('0x39')]})[_0xea51('0x23')](function(_0x28f37b){_0x1f3dcd[_0xea51('0x1d')]=_0x28f37b;if(_0x418b42[_0xea51('0x2f')]['includeAll']){_0x3e91c0[_0xea51('0x3f')]=[{'all':!![]}];}return db[_0xea51('0x4b')][_0xea51('0x40')](_0x3e91c0);})['then'](function(_0x45a24d){_0x1f3dcd['rows']=_0x45a24d;return _0x1f3dcd;});}})[_0xea51('0x23')](respondWithFilteredResult(_0x5398a2,_0x3e91c0))[_0xea51('0x41')](handleError(_0x5398a2,null));}; \ No newline at end of file +var _0xef52=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','json','reject','then','destroy','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','describe','getQuestions','findOne','pick','SessionId','filter','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment'];(function(_0x3aeec2,_0x167576){var _0xbf0ef1=function(_0x18101d){while(--_0x18101d){_0x3aeec2['push'](_0x3aeec2['shift']());}};_0xbf0ef1(++_0x167576);}(_0xef52,0x16b));var _0x2ef5=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0xef52[_0x407461];return _0x2b3ffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ef5('0x0'));var zipdir=require(_0x2ef5('0x1'));var jsonpatch=require(_0x2ef5('0x2'));var rp=require('request-promise');var moment=require(_0x2ef5('0x3'));var BPromise=require(_0x2ef5('0x4'));var Mustache=require(_0x2ef5('0x5'));var util=require('util');var path=require(_0x2ef5('0x6'));var sox=require(_0x2ef5('0x7'));var csv=require(_0x2ef5('0x8'));var ejs=require(_0x2ef5('0x9'));var fs=require('fs');var fs_extra=require(_0x2ef5('0xa'));var _=require(_0x2ef5('0xb'));var squel=require(_0x2ef5('0xc'));var crypto=require(_0x2ef5('0xd'));var jsforce=require(_0x2ef5('0xe'));var deskjs=require(_0x2ef5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2ef5('0x10'));var Redis=require(_0x2ef5('0x11'));var authService=require(_0x2ef5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2ef5('0x14'));var utils=require('../../config/utils');var config=require(_0x2ef5('0x15'));var licenseUtil=require(_0x2ef5('0x16'));var db=require(_0x2ef5('0x17'))['db'];function respondWithStatusCode(_0xe35bef,_0x82a62b){_0x82a62b=_0x82a62b||0xcc;return function(_0x14d91c){if(_0x14d91c){return _0xe35bef[_0x2ef5('0x18')](_0x82a62b);}return _0xe35bef[_0x2ef5('0x19')](_0x82a62b)[_0x2ef5('0x1a')]();};}function respondWithResult(_0x1dae4f,_0x43aa86){_0x43aa86=_0x43aa86||0xc8;return function(_0x4ba704){if(_0x4ba704){return _0x1dae4f[_0x2ef5('0x19')](_0x43aa86)['json'](_0x4ba704);}};}function respondWithFilteredResult(_0x5d6fbc,_0x8696f){return function(_0x4a8582){if(_0x4a8582){var _0x11107e=typeof _0x8696f[_0x2ef5('0x1b')]==='undefined'&&typeof _0x8696f['limit']===_0x2ef5('0x1c');var _0x152663=_0x4a8582[_0x2ef5('0x1d')];var _0xa10c6f=_0x11107e?0x0:_0x8696f['offset'];var _0x281211=_0x11107e?_0x4a8582[_0x2ef5('0x1d')]:_0x8696f[_0x2ef5('0x1b')]+_0x8696f[_0x2ef5('0x1e')];var _0x37c5bd;if(_0x281211>=_0x152663){_0x281211=_0x152663;_0x37c5bd=0xc8;}else{_0x37c5bd=0xce;}_0x5d6fbc[_0x2ef5('0x19')](_0x37c5bd);return _0x5d6fbc['set']('Content-Range',_0xa10c6f+'-'+_0x281211+'/'+_0x152663)[_0x2ef5('0x1f')](_0x4a8582);}return null;};}function patchUpdates(_0x38c512){return function(_0x428ba0){try{jsonpatch['apply'](_0x428ba0,_0x38c512,!![]);}catch(_0x3cd263){return BPromise[_0x2ef5('0x20')](_0x3cd263);}return _0x428ba0['save']();};}function saveUpdates(_0x5ac368,_0xda2b5a){return function(_0x5dd9e3){if(_0x5dd9e3){return _0x5dd9e3['update'](_0x5ac368)[_0x2ef5('0x21')](function(_0x1d1946){return _0x1d1946;});}return null;};}function removeEntity(_0x2682ed,_0x51b51a){return function(_0x56daa2){if(_0x56daa2){return _0x56daa2[_0x2ef5('0x22')]()['then'](function(){_0x2682ed[_0x2ef5('0x19')](0xcc)[_0x2ef5('0x1a')]();});}};}function handleEntityNotFound(_0x1f240f,_0x9b6129){return function(_0x33bfdc){if(!_0x33bfdc){_0x1f240f['sendStatus'](0x194);}return _0x33bfdc;};}function handleError(_0x17956a,_0x523664){_0x523664=_0x523664||0x1f4;return function(_0x324805){logger['error'](_0x324805['stack']);if(_0x324805[_0x2ef5('0x23')]){delete _0x324805[_0x2ef5('0x23')];}_0x17956a[_0x2ef5('0x19')](_0x523664)[_0x2ef5('0x24')](_0x324805);};}exports[_0x2ef5('0x25')]=function(_0xfb6571,_0x55d931){var _0x30bf49={},_0x26510c={},_0x2de010={'count':0x0,'rows':[]};var _0x135da1=_['map'](db[_0x2ef5('0x26')][_0x2ef5('0x27')],function(_0x18645e){return{'name':_0x18645e[_0x2ef5('0x28')],'type':_0x18645e[_0x2ef5('0x29')][_0x2ef5('0x2a')]};});_0x26510c[_0x2ef5('0x2b')]=_[_0x2ef5('0x2c')](_0x135da1,_0x2ef5('0x23'));_0x26510c[_0x2ef5('0x2d')]=_[_0x2ef5('0x2e')](_0xfb6571[_0x2ef5('0x2d')]);_0x26510c['filters']=_[_0x2ef5('0x2f')](_0x26510c['model'],_0x26510c[_0x2ef5('0x2d')]);_0x30bf49[_0x2ef5('0x30')]=_[_0x2ef5('0x2f')](_0x26510c[_0x2ef5('0x2b')],qs[_0x2ef5('0x31')](_0xfb6571[_0x2ef5('0x2d')]['fields']));_0x30bf49[_0x2ef5('0x30')]=_0x30bf49['attributes'][_0x2ef5('0x32')]?_0x30bf49[_0x2ef5('0x30')]:_0x26510c[_0x2ef5('0x2b')];if(!_0xfb6571[_0x2ef5('0x2d')]['hasOwnProperty'](_0x2ef5('0x33'))){_0x30bf49[_0x2ef5('0x1e')]=qs[_0x2ef5('0x1e')](_0xfb6571[_0x2ef5('0x2d')]['limit']);_0x30bf49[_0x2ef5('0x1b')]=qs[_0x2ef5('0x1b')](_0xfb6571[_0x2ef5('0x2d')]['offset']);}_0x30bf49[_0x2ef5('0x34')]=qs[_0x2ef5('0x35')](_0xfb6571[_0x2ef5('0x2d')]['sort']);_0x30bf49[_0x2ef5('0x36')]=qs[_0x2ef5('0x37')](_['pick'](_0xfb6571['query'],_0x26510c['filters']),_0x135da1);if(_0xfb6571[_0x2ef5('0x2d')]['filter']){_0x30bf49['where']=_['merge'](_0x30bf49[_0x2ef5('0x36')],{'$or':_[_0x2ef5('0x2c')](_0x135da1,function(_0x27d4f3){if(_0x27d4f3[_0x2ef5('0x29')]!==_0x2ef5('0x38')){var _0x3b9510={};_0x3b9510[_0x27d4f3[_0x2ef5('0x23')]]={'$like':'%'+_0xfb6571[_0x2ef5('0x2d')]['filter']+'%'};return _0x3b9510;}})});}_0x30bf49=_[_0x2ef5('0x39')]({},_0x30bf49,_0xfb6571[_0x2ef5('0x3a')]);var _0x37c8d2={'where':_0x30bf49[_0x2ef5('0x36')]};return db[_0x2ef5('0x26')][_0x2ef5('0x1d')](_0x37c8d2)['then'](function(_0x221579){_0x2de010['count']=_0x221579;if(_0xfb6571[_0x2ef5('0x2d')][_0x2ef5('0x3b')]){_0x30bf49[_0x2ef5('0x3c')]=[{'all':!![]}];}return db[_0x2ef5('0x26')][_0x2ef5('0x3d')](_0x30bf49);})[_0x2ef5('0x21')](function(_0x4933bb){_0x2de010[_0x2ef5('0x3e')]=_0x4933bb;return _0x2de010;})[_0x2ef5('0x21')](respondWithFilteredResult(_0x55d931,_0x30bf49))[_0x2ef5('0x3f')](handleError(_0x55d931,null));};exports[_0x2ef5('0x40')]=function(_0x15141a,_0x46d640){var _0x1c360a={'raw':!![],'where':{'id':_0x15141a['params']['id']}},_0x553a1d={};_0x553a1d[_0x2ef5('0x2b')]=_[_0x2ef5('0x2e')](db[_0x2ef5('0x26')][_0x2ef5('0x27')]);_0x553a1d['query']=_['keys'](_0x15141a[_0x2ef5('0x2d')]);_0x553a1d[_0x2ef5('0x37')]=_[_0x2ef5('0x2f')](_0x553a1d[_0x2ef5('0x2b')],_0x553a1d[_0x2ef5('0x2d')]);_0x1c360a[_0x2ef5('0x30')]=_[_0x2ef5('0x2f')](_0x553a1d['model'],qs[_0x2ef5('0x31')](_0x15141a[_0x2ef5('0x2d')][_0x2ef5('0x31')]));_0x1c360a[_0x2ef5('0x30')]=_0x1c360a[_0x2ef5('0x30')]['length']?_0x1c360a['attributes']:_0x553a1d['model'];if(_0x15141a['query'][_0x2ef5('0x3b')]){_0x1c360a['include']=[{'all':!![]}];}_0x1c360a=_['merge']({},_0x1c360a,_0x15141a[_0x2ef5('0x3a')]);return db['JscriptySessionReport']['find'](_0x1c360a)[_0x2ef5('0x21')](handleEntityNotFound(_0x46d640,null))[_0x2ef5('0x21')](respondWithResult(_0x46d640,null))[_0x2ef5('0x3f')](handleError(_0x46d640,null));};exports['create']=function(_0x256367,_0x54985a){return db[_0x2ef5('0x26')][_0x2ef5('0x41')](_0x256367[_0x2ef5('0x42')],{})[_0x2ef5('0x21')](respondWithResult(_0x54985a,0xc9))['catch'](handleError(_0x54985a,null));};exports[_0x2ef5('0x43')]=function(_0x1c8fae,_0x3ded2d){if(_0x1c8fae[_0x2ef5('0x42')]['id']){delete _0x1c8fae[_0x2ef5('0x42')]['id'];}return db[_0x2ef5('0x26')]['find']({'where':{'id':_0x1c8fae['params']['id']}})['then'](handleEntityNotFound(_0x3ded2d,null))[_0x2ef5('0x21')](saveUpdates(_0x1c8fae[_0x2ef5('0x42')],null))[_0x2ef5('0x21')](respondWithResult(_0x3ded2d,null))['catch'](handleError(_0x3ded2d,null));};exports[_0x2ef5('0x22')]=function(_0x302dfc,_0x469643){return db['JscriptySessionReport'][_0x2ef5('0x44')]({'where':{'id':_0x302dfc[_0x2ef5('0x45')]['id']}})[_0x2ef5('0x21')](handleEntityNotFound(_0x469643,null))[_0x2ef5('0x21')](removeEntity(_0x469643,null))['catch'](handleError(_0x469643,null));};exports[_0x2ef5('0x46')]=function(_0x5adb6b,_0x13fb66){return db['JscriptySessionReport'][_0x2ef5('0x46')]()[_0x2ef5('0x21')](respondWithResult(_0x13fb66,null))['catch'](handleError(_0x13fb66,null));};exports[_0x2ef5('0x47')]=function(_0x591a4f,_0x502f21,_0x2f009f){var _0x4d37b0={'raw':!![],'where':{}};var _0x35dd81={};var _0x28c2f8={'count':0x0,'rows':[]};return db[_0x2ef5('0x26')][_0x2ef5('0x48')]({'where':{'id':_0x591a4f[_0x2ef5('0x45')]['id']}})['then'](handleEntityNotFound(_0x502f21,null))[_0x2ef5('0x21')](function(_0x57ec95){if(_0x57ec95){_0x35dd81[_0x2ef5('0x2b')]=_[_0x2ef5('0x2e')](db['JscriptyQuestionReport'][_0x2ef5('0x27')]);_0x35dd81[_0x2ef5('0x2d')]=_['keys'](_0x591a4f['query']);_0x35dd81[_0x2ef5('0x37')]=_['intersection'](_0x35dd81['model'],_0x35dd81['query']);_0x4d37b0[_0x2ef5('0x30')]=_['intersection'](_0x35dd81[_0x2ef5('0x2b')],qs['fields'](_0x591a4f['query'][_0x2ef5('0x31')]));_0x4d37b0['attributes']=_0x4d37b0[_0x2ef5('0x30')][_0x2ef5('0x32')]?_0x4d37b0[_0x2ef5('0x30')]:_0x35dd81[_0x2ef5('0x2b')];if(!_0x591a4f[_0x2ef5('0x2d')]['hasOwnProperty'](_0x2ef5('0x33'))){_0x4d37b0['limit']=qs[_0x2ef5('0x1e')](_0x591a4f[_0x2ef5('0x2d')][_0x2ef5('0x1e')]);_0x4d37b0['offset']=qs['offset'](_0x591a4f['query'][_0x2ef5('0x1b')]);}_0x4d37b0['order']=qs[_0x2ef5('0x35')](_0x591a4f[_0x2ef5('0x2d')][_0x2ef5('0x35')]);_0x4d37b0[_0x2ef5('0x36')]=qs['filters'](_[_0x2ef5('0x49')](_0x591a4f['query'],_0x35dd81['filters']));_0x4d37b0[_0x2ef5('0x36')][_0x2ef5('0x4a')]=_0x57ec95['id'];if(_0x591a4f[_0x2ef5('0x2d')]['filter']){_0x4d37b0[_0x2ef5('0x36')]=_['merge'](_0x4d37b0[_0x2ef5('0x36')],{'$or':_['map'](_0x4d37b0[_0x2ef5('0x30')],function(_0x2b39ec){var _0x540de5={};_0x540de5[_0x2b39ec]={'$like':'%'+_0x591a4f['query'][_0x2ef5('0x4b')]+'%'};return _0x540de5;})});}_0x4d37b0=_['merge']({},_0x4d37b0,_0x591a4f[_0x2ef5('0x3a')]);return db[_0x2ef5('0x4c')][_0x2ef5('0x1d')]({'where':_0x4d37b0[_0x2ef5('0x36')]})[_0x2ef5('0x21')](function(_0x5a7cd3){_0x28c2f8['count']=_0x5a7cd3;if(_0x591a4f[_0x2ef5('0x2d')][_0x2ef5('0x3b')]){_0x4d37b0[_0x2ef5('0x3c')]=[{'all':!![]}];}return db[_0x2ef5('0x4c')][_0x2ef5('0x3d')](_0x4d37b0);})[_0x2ef5('0x21')](function(_0x37b42e){_0x28c2f8[_0x2ef5('0x3e')]=_0x37b42e;return _0x28c2f8;});}})[_0x2ef5('0x21')](respondWithFilteredResult(_0x502f21,_0x4d37b0))[_0x2ef5('0x3f')](handleError(_0x502f21,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 1248664..ac2ac09 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 _0x8f9d=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x171945,_0xd87274){var _0x2d73e6=function(_0xb1bdc9){while(--_0xb1bdc9){_0x171945['push'](_0x171945['shift']());}};_0x2d73e6(++_0xd87274);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7a3=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','JscriptySessionReport','util'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x290358,_0x38c9b8){_0x290358=_0x290358-0x0;var _0x10641c=_0xc7a3[_0x290358];return _0x10641c;};'use strict';var _=require('lodash');var util=require(_0x3c7a('0x0'));var logger=require(_0x3c7a('0x1'))(_0x3c7a('0x2'));var moment=require(_0x3c7a('0x3'));var BPromise=require(_0x3c7a('0x4'));var rp=require(_0x3c7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c7a('0x6'));var config=require(_0x3c7a('0x7'));var attributes=require('./jscriptySessionReport.attributes');module[_0x3c7a('0x8')]=function(_0x2051ce,_0x2736c1){return _0x2051ce['define'](_0x3c7a('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 5917340..c737c50 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 _0x25e7=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x970084,_0x4e5473){var _0x411cce=function(_0x26bced){while(--_0x26bced){_0x970084['push'](_0x970084['shift']());}};_0x411cce(++_0x4e5473);}(_0x25e7,0x1d6));var _0x725e=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0x25e7[_0x2f16e5];return _0x5d082a;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});} \ No newline at end of file +var _0x6343=['message','result','catch','moment','bluebird','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3b936a,_0x1961be){var _0x594d1e=function(_0x5f09ec){while(--_0x5f09ec){_0x3b936a['push'](_0x3b936a['shift']());}};_0x594d1e(++_0x1961be);}(_0x6343,0x168));var _0x3634=function(_0x4914a6,_0x2ec46a){_0x4914a6=_0x4914a6-0x0;var _0x51163b=_0x6343[_0x4914a6];return _0x51163b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302828,_0xd40513,_0x4e6d71){return new BPromise(function(_0x5affba,_0x19170a){return client[_0x3634('0x6')](_0x302828,_0x4e6d71)[_0x3634('0x7')](function(_0x3c813b){logger[_0x3634('0x8')](_0x3634('0x9'),_0xd40513,'request\x20sent');logger['debug'](_0x3634('0xa'),_0xd40513,_0x3634('0xb'),JSON['stringify'](_0x3c813b));if(_0x3c813b[_0x3634('0xc')]){if(_0x3c813b[_0x3634('0xc')][_0x3634('0xd')]===0x1f4){logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x19170a(_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);}logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x5affba(_0x3c813b[_0x3634('0xc')]['message']);}else{logger[_0x3634('0x8')]('JscriptySessionReport,\x20%s,\x20%s',_0xd40513,_0x3634('0xb'));_0x5affba(_0x3c813b[_0x3634('0xf')][_0x3634('0xe')]);}})[_0x3634('0x10')](function(_0x91061e){logger['error'](_0x3634('0x9'),_0xd40513,_0x91061e);_0x19170a(_0x91061e);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 17bca7b..40fd54f 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 _0x9622=['express','Router','fs-extra','get','index','put','/:id','isAuthenticated','update','multer','util','path'];(function(_0x4bfaa7,_0x1033b0){var _0x282f8f=function(_0x4cf762){while(--_0x4cf762){_0x4bfaa7['push'](_0x4bfaa7['shift']());}};_0x282f8f(++_0x1033b0);}(_0x9622,0x8d));var _0x2962=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0x9622[_0x4d821c];return _0x15dd5b;};'use strict';var multer=require(_0x2962('0x0'));var util=require(_0x2962('0x1'));var path=require(_0x2962('0x2'));var timeout=require('connect-timeout');var express=require(_0x2962('0x3'));var router=express[_0x2962('0x4')]();var fs_extra=require(_0x2962('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0x2962('0x6')]('/',controller[_0x2962('0x7')]);router[_0x2962('0x8')](_0x2962('0x9'),auth[_0x2962('0xa')](),controller[_0x2962('0xb')]);module['exports']=router; \ No newline at end of file +var _0x61a5=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','exports'];(function(_0x4c6e44,_0x5067b5){var _0x4a9239=function(_0xa4b260){while(--_0xa4b260){_0x4c6e44['push'](_0x4c6e44['shift']());}};_0x4a9239(++_0x5067b5);}(_0x61a5,0xf0));var _0x561a=function(_0x1d006a,_0x2812b5){_0x1d006a=_0x1d006a-0x0;var _0x20a76b=_0x61a5[_0x1d006a];return _0x20a76b;};'use strict';var multer=require(_0x561a('0x0'));var util=require('util');var path=require(_0x561a('0x1'));var timeout=require(_0x561a('0x2'));var express=require(_0x561a('0x3'));var router=express[_0x561a('0x4')]();var fs_extra=require(_0x561a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var controller=require('./license.controller');router[_0x561a('0x8')]('/',controller[_0x561a('0x9')]);router[_0x561a('0xa')](_0x561a('0xb'),auth[_0x561a('0xc')](),controller[_0x561a('0xd')]);module[_0x561a('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 0ec9854..1ba8349 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 _0xd610=['exports','STRING','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd610,0xa4));var _0x0d61=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xd610[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x0d61('0x0'));module[_0x0d61('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x0d61('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d60=['INTEGER','exports','TEXT','STRING'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x6d60,0x199));var _0x06d6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d60[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module[_0x06d6('0x0')]={'license':{'type':Sequelize[_0x06d6('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x06d6('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x06d6('0x3')],'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 ea78634..b6cb5c0 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['fields','length','merge','options','getLicense','body','License','find','params','get','key','demo','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','../../config/license/util','index','model','rawAttributes','query','keys','filters','intersection','attributes'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xf494,0x1c6));var _0x4f49=function(_0x415d6c,_0x5ab977){_0x415d6c=_0x415d6c-0x0;var _0x265dc9=_0xf494[_0x415d6c];return _0x265dc9;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}var utilLicense=require(_0x4f49('0x29'));exports[_0x4f49('0x2a')]=function(_0x605c91,_0x560050){var _0x3cbfbd={'raw':!![],'where':{'id':0x1}},_0x206203={};_0x206203[_0x4f49('0x2b')]=_['keys'](db['License'][_0x4f49('0x2c')]);_0x206203[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x605c91['query']);_0x206203[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],_0x206203[_0x4f49('0x2d')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],qs[_0x4f49('0x32')](_0x605c91[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x3cbfbd[_0x4f49('0x31')]=_0x3cbfbd[_0x4f49('0x31')][_0x4f49('0x33')]?_0x3cbfbd[_0x4f49('0x31')]:_0x206203[_0x4f49('0x2b')];_0x3cbfbd=_[_0x4f49('0x34')]({},_0x3cbfbd,_0x605c91[_0x4f49('0x35')]);return utilLicense[_0x4f49('0x36')](_0x3cbfbd)[_0x4f49('0x25')](respondWithResult(_0x560050,null))['catch'](handleError(_0x560050,null));};exports[_0x4f49('0x24')]=function(_0x46b7ba,_0x24f568){if(_0x46b7ba[_0x4f49('0x37')]['id']){delete _0x46b7ba[_0x4f49('0x37')]['id'];}return db[_0x4f49('0x38')][_0x4f49('0x39')]({'where':{'id':_0x46b7ba[_0x4f49('0x3a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x24f568,null))[_0x4f49('0x25')](function(_0x44e6a0){var _0x343365=_0x44e6a0[_0x4f49('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x343365,_0x46b7ba[_0x4f49('0x37')][_0x4f49('0x3c')]);})[_0x4f49('0x25')](function(_0x26014f){if(!_0x26014f[_0x4f49('0x3d')]){return saveUpdates(_0x46b7ba[_0x4f49('0x37')],null);}return _0x26014f;})[_0x4f49('0x25')](respondWithResult(_0x24f568,null))[_0x4f49('0x3e')](handleError(_0x24f568,null));}; \ No newline at end of file +var _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(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'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 a6d911a..658b73f 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 _0x0cd6=['exports','define','license','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes'];(function(_0xe24e5d,_0x5e1be4){var _0x3a2da5=function(_0x2841e8){while(--_0x2841e8){_0xe24e5d['push'](_0xe24e5d['shift']());}};_0x3a2da5(++_0x5e1be4);}(_0x0cd6,0xf3));var _0x60cd=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x0cd6[_0x1e381c];return _0x9b5ea9;};'use strict';var _=require(_0x60cd('0x0'));var util=require('util');var logger=require(_0x60cd('0x1'))(_0x60cd('0x2'));var moment=require(_0x60cd('0x3'));var BPromise=require(_0x60cd('0x4'));var rp=require(_0x60cd('0x5'));var fs=require('fs');var path=require(_0x60cd('0x6'));var rimraf=require('rimraf');var config=require(_0x60cd('0x7'));var attributes=require(_0x60cd('0x8'));module[_0x60cd('0x9')]=function(_0x183830,_0x2ee689){return _0x183830[_0x60cd('0xa')]('License',attributes,{'tableName':_0x60cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc489=['license','lodash','util','api','bluebird','request-promise','path','./license.attributes','exports','License'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0xc489,0x137));var _0x9c48=function(_0x1a24f3,_0x59a629){_0x1a24f3=_0x1a24f3-0x0;var _0x4edf11=_0xc489[_0x1a24f3];return _0x4edf11;};'use strict';var _=require(_0x9c48('0x0'));var util=require(_0x9c48('0x1'));var logger=require('../../config/logger')(_0x9c48('0x2'));var moment=require('moment');var BPromise=require(_0x9c48('0x3'));var rp=require(_0x9c48('0x4'));var fs=require('fs');var path=require(_0x9c48('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9c48('0x6'));module[_0x9c48('0x7')]=function(_0x24853f,_0x3492f1){return _0x24853f['define'](_0x9c48('0x8'),attributes,{'tableName':_0x9c48('0x9'),'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 d7bae06..7adf14f 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 _0xdf7b=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xdf7b,0x152));var _0xbdf7=function(_0x20025e,_0x44c8e1){_0x20025e=_0x20025e-0x0;var _0x4a5ac4=_0xdf7b[_0x20025e];return _0x4a5ac4;};'use strict';var _=require('lodash');var util=require(_0xbdf7('0x0'));var moment=require(_0xbdf7('0x1'));var BPromise=require(_0xbdf7('0x2'));var rs=require(_0xbdf7('0x3'));var fs=require('fs');var Redis=require(_0xbdf7('0x4'));var db=require(_0xbdf7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbdf7('0x6'));var config=require(_0xbdf7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbdf7('0x8')][_0xbdf7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42f6d0,_0x271848,_0xa337cc){return new BPromise(function(_0x9eb26e,_0x437fb5){return client['request'](_0x42f6d0,_0xa337cc)[_0xbdf7('0xa')](function(_0x142d6b){logger[_0xbdf7('0xb')](_0xbdf7('0xc'),_0x271848,_0xbdf7('0xd'));logger[_0xbdf7('0xe')](_0xbdf7('0xf'),_0x271848,_0xbdf7('0xd'),JSON[_0xbdf7('0x10')](_0x142d6b));if(_0x142d6b[_0xbdf7('0x11')]){if(_0x142d6b[_0xbdf7('0x11')][_0xbdf7('0x12')]===0x1f4){logger[_0xbdf7('0x11')]('License,\x20%s,\x20%s',_0x271848,_0x142d6b['error']['message']);return _0x437fb5(_0x142d6b[_0xbdf7('0x11')][_0xbdf7('0x13')]);}logger[_0xbdf7('0x11')](_0xbdf7('0xc'),_0x271848,_0x142d6b['error']['message']);return _0x9eb26e(_0x142d6b[_0xbdf7('0x11')][_0xbdf7('0x13')]);}else{logger['info'](_0xbdf7('0xc'),_0x271848,_0xbdf7('0xd'));_0x9eb26e(_0x142d6b[_0xbdf7('0x14')]['message']);}})['catch'](function(_0x5e7f9c){logger[_0xbdf7('0x11')](_0xbdf7('0xc'),_0x271848,_0x5e7f9c);_0x437fb5(_0x5e7f9c);});});} \ No newline at end of file +var _0x75ee=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','randomstring'];(function(_0x7f4776,_0x3d3d05){var _0x188d22=function(_0x2e053b){while(--_0x2e053b){_0x7f4776['push'](_0x7f4776['shift']());}};_0x188d22(++_0x3d3d05);}(_0x75ee,0x179));var _0xe75e=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x75ee[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require('lodash');var util=require(_0xe75e('0x0'));var moment=require(_0xe75e('0x1'));var BPromise=require('bluebird');var rs=require(_0xe75e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe75e('0x3'))['db'];var utils=require(_0xe75e('0x4'));var logger=require(_0xe75e('0x5'))(_0xe75e('0x6'));var config=require(_0xe75e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe75e('0x8')][_0xe75e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16b65e,_0x285676,_0x2ace61){return new BPromise(function(_0xd2367d,_0xd12d49){return client[_0xe75e('0xa')](_0x16b65e,_0x2ace61)['then'](function(_0x1c5705){logger['info'](_0xe75e('0xb'),_0x285676,_0xe75e('0xc'));logger['debug'](_0xe75e('0xd'),_0x285676,_0xe75e('0xc'),JSON[_0xe75e('0xe')](_0x1c5705));if(_0x1c5705[_0xe75e('0xf')]){if(_0x1c5705[_0xe75e('0xf')]['code']===0x1f4){logger['error'](_0xe75e('0xb'),_0x285676,_0x1c5705[_0xe75e('0xf')]['message']);return _0xd12d49(_0x1c5705[_0xe75e('0xf')][_0xe75e('0x10')]);}logger[_0xe75e('0xf')](_0xe75e('0xb'),_0x285676,_0x1c5705[_0xe75e('0xf')][_0xe75e('0x10')]);return _0xd2367d(_0x1c5705[_0xe75e('0xf')][_0xe75e('0x10')]);}else{logger[_0xe75e('0x11')](_0xe75e('0xb'),_0x285676,'request\x20sent');_0xd2367d(_0x1c5705[_0xe75e('0x12')][_0xe75e('0x10')]);}})[_0xe75e('0x13')](function(_0x1320a7){logger[_0xe75e('0xf')](_0xe75e('0xb'),_0x285676,_0x1320a7);_0xd12d49(_0x1320a7);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 120f96a..05e11a5 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 _0xb557=['getAgents','/:id/dispositions','addDisposition','addAnswer','post','create','addImap','addSmtp','addInteraction','/:id/send','send','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb557,0x1f4));var _0x7b55=function(_0x4edab3,_0x425b15){_0x4edab3=_0x4edab3-0x0;var _0x526e76=_0xb557[_0x4edab3];return _0x526e76;};'use strict';var multer=require(_0x7b55('0x0'));var util=require(_0x7b55('0x1'));var path=require(_0x7b55('0x2'));var timeout=require(_0x7b55('0x3'));var express=require('express');var router=express[_0x7b55('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7b55('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7b55('0x6'));router['get']('/',auth[_0x7b55('0x7')](),controller[_0x7b55('0x8')]);router[_0x7b55('0x9')](_0x7b55('0xa'),auth[_0x7b55('0x7')](),controller[_0x7b55('0xb')]);router[_0x7b55('0x9')](_0x7b55('0xc'),auth[_0x7b55('0x7')](),controller[_0x7b55('0xd')]);router[_0x7b55('0x9')]('/:id/dispositions',auth[_0x7b55('0x7')](),controller[_0x7b55('0xe')]);router[_0x7b55('0x9')](_0x7b55('0xf'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x10')]);router['get'](_0x7b55('0x11'),auth['isAuthenticated'](),controller[_0x7b55('0x12')]);router[_0x7b55('0x9')](_0x7b55('0x13'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x14')]);router[_0x7b55('0x9')](_0x7b55('0x15'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x16')]);router[_0x7b55('0x9')](_0x7b55('0x17'),auth['isAuthenticated'](),controller[_0x7b55('0x18')]);router[_0x7b55('0x9')](_0x7b55('0x19'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x1a')]);router[_0x7b55('0x9')]('/:id/verify',auth[_0x7b55('0x7')](),controller[_0x7b55('0x1b')]);router[_0x7b55('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x7b55('0x1c')]);router['post'](_0x7b55('0x1d'),auth['isAuthenticated'](),controller[_0x7b55('0x1e')]);router['post'](_0x7b55('0xf'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x1f')]);router[_0x7b55('0x20')]('/',auth[_0x7b55('0x7')](),controller[_0x7b55('0x21')]);router[_0x7b55('0x20')](_0x7b55('0x11'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x22')]);router[_0x7b55('0x20')](_0x7b55('0x13'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x23')]);router[_0x7b55('0x20')](_0x7b55('0x15'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x24')]);router[_0x7b55('0x20')]('/:id/applications',auth[_0x7b55('0x7')](),controller['addApplications']);router[_0x7b55('0x20')](_0x7b55('0x25'),auth['isAuthenticated'](),controller[_0x7b55('0x26')]);router[_0x7b55('0x20')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x7b55('0x27')](_0x7b55('0xc'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x28')]);router[_0x7b55('0x29')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x7b55('0xf'),auth['isAuthenticated'](),controller[_0x7b55('0x2a')]);router['delete'](_0x7b55('0x11'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x2b')]);router[_0x7b55('0x29')]('/:id/out_servers',auth[_0x7b55('0x7')](),controller[_0x7b55('0x2c')]);router['delete'](_0x7b55('0xc'),auth[_0x7b55('0x7')](),controller[_0x7b55('0x2d')]);router['delete']('/:id/users',auth[_0x7b55('0x7')](),controller[_0x7b55('0x2e')]);module[_0x7b55('0x2f')]=router; \ No newline at end of file +var _0xba98=['/:id/messages','getMessages','/:id/verify','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','/:id','delete','/:id/dispositions','removeDispositions','removeAnswers','removeSmtp','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./mailAccount.controller','index','get','isAuthenticated','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications'];(function(_0x47ba42,_0x6707a8){var _0x3084ba=function(_0x59d8bf){while(--_0x59d8bf){_0x47ba42['push'](_0x47ba42['shift']());}};_0x3084ba(++_0x6707a8);}(_0xba98,0x112));var _0x8ba9=function(_0x488fa5,_0x40fb32){_0x488fa5=_0x488fa5-0x0;var _0x2c72c2=_0xba98[_0x488fa5];return _0x2c72c2;};'use strict';var multer=require(_0x8ba9('0x0'));var util=require(_0x8ba9('0x1'));var path=require('path');var timeout=require(_0x8ba9('0x2'));var express=require('express');var router=express[_0x8ba9('0x3')]();var fs_extra=require(_0x8ba9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8ba9('0x5'));var controller=require(_0x8ba9('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ba9('0x7')]);router[_0x8ba9('0x8')]('/describe',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0xb')]);router[_0x8ba9('0x8')](_0x8ba9('0xc'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0xd')]);router[_0x8ba9('0x8')](_0x8ba9('0xe'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0xf')]);router['get'](_0x8ba9('0x10'),auth['isAuthenticated'](),controller['getSmtp']);router[_0x8ba9('0x8')]('/:id/interactions',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x11')]);router[_0x8ba9('0x8')](_0x8ba9('0x12'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x13')]);router['get'](_0x8ba9('0x14'),auth['isAuthenticated'](),controller[_0x8ba9('0x15')]);router[_0x8ba9('0x8')](_0x8ba9('0x16'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x8ba9('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x8ba9('0x17')]('/:id/dispositions',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x18')]);router[_0x8ba9('0x17')](_0x8ba9('0xc'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x19')]);router[_0x8ba9('0x17')]('/',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x1a')]);router[_0x8ba9('0x17')]('/:id/in_servers',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x1b')]);router['post'](_0x8ba9('0x10'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x1c')]);router[_0x8ba9('0x17')](_0x8ba9('0x1d'),auth['isAuthenticated'](),controller[_0x8ba9('0x1e')]);router[_0x8ba9('0x17')](_0x8ba9('0x12'),auth['isAuthenticated'](),controller[_0x8ba9('0x1f')]);router[_0x8ba9('0x17')](_0x8ba9('0x20'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x21')]);router[_0x8ba9('0x17')]('/:id/users',auth[_0x8ba9('0x9')](),controller['addAgents']);router['put'](_0x8ba9('0x22'),auth[_0x8ba9('0x9')](),controller['update']);router[_0x8ba9('0x23')](_0x8ba9('0x24'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x25')]);router['delete']('/:id/canned_answers',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x26')]);router[_0x8ba9('0x23')](_0x8ba9('0xe'),auth[_0x8ba9('0x9')](),controller['removeImap']);router[_0x8ba9('0x23')](_0x8ba9('0x10'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x27')]);router[_0x8ba9('0x23')](_0x8ba9('0x22'),auth['isAuthenticated'](),controller[_0x8ba9('0x28')]);router[_0x8ba9('0x23')]('/:id/users',auth[_0x8ba9('0x9')](),controller['removeAgents']);module[_0x8ba9('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d43ffe0..a6afcdd 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 _0x7a08=['sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0xbe41ba,_0x384563){var _0x2c2085=function(_0x146ee7){while(--_0x146ee7){_0xbe41ba['push'](_0xbe41ba['shift']());}};_0x2c2085(++_0x384563);}(_0x7a08,0x11e));var _0x87a0=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x7a08[_0x2cd1fb];return _0x48fd2b;};'use strict';var Sequelize=require(_0x87a0('0x0'));module[_0x87a0('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x87a0('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x87a0('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x87a0('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x87a0('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0x87a0('0x4')]},'markAsUnread':{'type':Sequelize[_0x87a0('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x87a0('0x3')],'allowNull':![],'defaultValue':_0x87a0('0x5')},'fontSize':{'type':Sequelize[_0x87a0('0x6')](0x2)[_0x87a0('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x87a0('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x87a0('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x87a0('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x87a0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x87a0('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x87a0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x87a0('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x87a0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x87a0('0x2')],'defaultValue':![],'comment':_0x87a0('0x9'),'set':function(_0x34ba3a){if(!_0x34ba3a)this['setDataValue'](_0x87a0('0xa'),null);this[_0x87a0('0xb')](_0x87a0('0xc'),_0x34ba3a);}}}; \ No newline at end of file +var _0x80d9=['TEXT','UNSIGNED','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN'];(function(_0x40fe55,_0x58f2bd){var _0x7ae83b=function(_0x5738f5){while(--_0x5738f5){_0x40fe55['push'](_0x40fe55['shift']());}};_0x7ae83b(++_0x58f2bd);}(_0x80d9,0x15c));var _0x980d=function(_0x35dc99,_0x32be63){_0x35dc99=_0x35dc99-0x0;var _0x47fca8=_0x80d9[_0x35dc99];return _0x47fca8;};'use strict';var Sequelize=require(_0x980d('0x0'));module['exports']={'description':{'type':Sequelize[_0x980d('0x1')]},'name':{'type':Sequelize[_0x980d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x980d('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x980d('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x980d('0x3')]},'markAsUnread':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x980d('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x980d('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x980d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x980d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x980d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x980d('0x5')],'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':_0x980d('0x6'),'set':function(_0x10872c){if(!_0x10872c)this['setDataValue'](_0x980d('0x7'),null);this['setDataValue'](_0x980d('0x8'),_0x10872c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 2187e50..0830968 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 _0xdbae=['MailAccounts','userProfileId','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','YYYY-MM-DD\x20HH:mm:ss','inlineCss','send','split','CmList','Contacts','updatedAt','DESC','isNil','from','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','List','messageId','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','destroy','get','stack','name','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','keys','filters','intersection','model','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rawAttributes','find','body','params','Pause','describe','addDisposition','Disposition','create','getDispositions','findOne','MailAccountId','rows','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','ListId','active','cauthentication','user','password','cpassword','authentication','host','port','service','cservice','cuser','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1855a7,_0x59c2c4){var _0x539b88=function(_0x224d79){while(--_0x224d79){_0x1855a7['push'](_0x1855a7['shift']());}};_0x539b88(++_0x59c2c4);}(_0xdbae,0x116));var _0xedba=function(_0x243f6b,_0x4e8056){_0x243f6b=_0x243f6b-0x0;var _0x366901=_0xdbae[_0x243f6b];return _0x366901;};'use strict';var emlformat=require(_0xedba('0x0'));var rimraf=require(_0xedba('0x1'));var zipdir=require(_0xedba('0x2'));var jsonpatch=require(_0xedba('0x3'));var rp=require(_0xedba('0x4'));var moment=require(_0xedba('0x5'));var BPromise=require(_0xedba('0x6'));var Mustache=require(_0xedba('0x7'));var util=require(_0xedba('0x8'));var path=require(_0xedba('0x9'));var sox=require(_0xedba('0xa'));var csv=require(_0xedba('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedba('0xc'));var _=require(_0xedba('0xd'));var squel=require(_0xedba('0xe'));var crypto=require(_0xedba('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xedba('0xb'));var querystring=require('querystring');var Papa=require(_0xedba('0x10'));var htmlToText=require(_0xedba('0x11'));var juice=require('juice');var Redis=require(_0xedba('0x12'));var authService=require(_0xedba('0x13'));var qs=require(_0xedba('0x14'));var as=require(_0xedba('0x15'));var hardwareService=require(_0xedba('0x16'));var logger=require(_0xedba('0x17'))(_0xedba('0x18'));var utils=require('../../config/utils');var config=require(_0xedba('0x19'));var licenseUtil=require(_0xedba('0x1a'));var db=require(_0xedba('0x1b'))['db'];config[_0xedba('0x1c')]=_[_0xedba('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xedba('0x1e'))(new Redis(config[_0xedba('0x1c')]));require(_0xedba('0x1f'))[_0xedba('0x20')](socket);var jayson=require(_0xedba('0x21'));var client=jayson[_0xedba('0x22')][_0xedba('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x29131b,_0x17c462,_0x3a6694,_0x561b2d){return new BPromise(function(_0xb858f,_0x38be81){var _0x1081d0=_0x561b2d||client;return _0x1081d0[_0xedba('0x24')](_0x29131b,_0x3a6694)['then'](function(_0x552d48){logger[_0xedba('0x25')](_0xedba('0x26'),_0x17c462,_0xedba('0x27'));logger[_0xedba('0x28')](_0xedba('0x29'),_0x17c462,_0xedba('0x27'),JSON[_0xedba('0x2a')](_0x552d48));if(_0x552d48['error']){if(_0x552d48['error'][_0xedba('0x2b')]===0x1f4){logger[_0xedba('0x2c')](_0xedba('0x26'),_0x17c462,_0x552d48[_0xedba('0x2c')][_0xedba('0x2d')]);return _0x38be81(_0x552d48['error'][_0xedba('0x2d')]);}logger[_0xedba('0x2c')]('MailAccount,\x20%s,\x20%s',_0x17c462,_0x552d48[_0xedba('0x2c')][_0xedba('0x2d')]);return _0xb858f(_0x552d48[_0xedba('0x2c')][_0xedba('0x2d')]);}else{logger[_0xedba('0x25')]('MailAccount,\x20%s,\x20%s',_0x17c462,_0xedba('0x27'));_0xb858f(_0x552d48[_0xedba('0x2e')][_0xedba('0x2d')]);}})[_0xedba('0x2f')](function(_0x4c9ca1){logger[_0xedba('0x2c')]('MailAccount,\x20%s,\x20%s',_0x17c462,_0x4c9ca1);_0x38be81(_0x4c9ca1);});});}function respondWithStatusCode(_0xa0c8e7,_0x52c0e7){_0x52c0e7=_0x52c0e7||0xcc;return function(_0x27e9c1){if(_0x27e9c1){return _0xa0c8e7[_0xedba('0x30')](_0x52c0e7);}return _0xa0c8e7[_0xedba('0x31')](_0x52c0e7)[_0xedba('0x32')]();};}function respondWithResult(_0x32e1fe,_0x10dc89){_0x10dc89=_0x10dc89||0xc8;return function(_0x433716){if(_0x433716){return _0x32e1fe[_0xedba('0x31')](_0x10dc89)[_0xedba('0x33')](_0x433716);}};}function respondWithFilteredResult(_0x3c03fa,_0x385ee1){return function(_0x1808b1){if(_0x1808b1){var _0x3bbc60=typeof _0x385ee1[_0xedba('0x34')]==='undefined'&&typeof _0x385ee1['limit']==='undefined';var _0x4dcb09=_0x1808b1[_0xedba('0x35')];var _0x5023e5=_0x3bbc60?0x0:_0x385ee1[_0xedba('0x34')];var _0x10c761=_0x3bbc60?_0x1808b1['count']:_0x385ee1[_0xedba('0x34')]+_0x385ee1[_0xedba('0x36')];var _0x418be5;if(_0x10c761>=_0x4dcb09){_0x10c761=_0x4dcb09;_0x418be5=0xc8;}else{_0x418be5=0xce;}_0x3c03fa[_0xedba('0x31')](_0x418be5);return _0x3c03fa[_0xedba('0x37')]('Content-Range',_0x5023e5+'-'+_0x10c761+'/'+_0x4dcb09)[_0xedba('0x33')](_0x1808b1);}return null;};}function patchUpdates(_0x248081){return function(_0x381bc8){try{jsonpatch[_0xedba('0x38')](_0x381bc8,_0x248081,!![]);}catch(_0x22f68d){return BPromise[_0xedba('0x39')](_0x22f68d);}return _0x381bc8[_0xedba('0x3a')]();};}function saveUpdates(_0x5d1086,_0xfe1cab){return function(_0x5219d3){if(_0x5219d3){return _0x5219d3[_0xedba('0x3b')](_0x5d1086)['then'](function(_0x3e1735){return _0x3e1735;});}return null;};}function removeEntity(_0x4f43f2,_0x102232){return function(_0x33fb97){if(_0x33fb97){return _0x33fb97[_0xedba('0x3c')]()['then'](function(){var _0x4d0f67=_0x33fb97[_0xedba('0x3d')]({'plain':!![]});var _0x25248f='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x25248f,'resourceId':_0x4d0f67['id']}})['then'](function(){return _0x33fb97;});})['then'](function(){_0x4f43f2[_0xedba('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x424faf,_0x2a6a3b){return function(_0x4a0086){if(!_0x4a0086){_0x424faf[_0xedba('0x30')](0x194);}return _0x4a0086;};}function handleError(_0x5f2450,_0x466f17){_0x466f17=_0x466f17||0x1f4;return function(_0x2f1a65){logger[_0xedba('0x2c')](_0x2f1a65[_0xedba('0x3e')]);if(_0x2f1a65[_0xedba('0x3f')]){delete _0x2f1a65['name'];}_0x5f2450[_0xedba('0x31')](_0x466f17)['send'](_0x2f1a65);};}exports['index']=function(_0x35409e,_0x7c8931){var _0x3a9651={'include':[{'model':db[_0xedba('0x40')],'as':_0xedba('0x41')},{'model':db[_0xedba('0x42')],'as':_0xedba('0x43')},{'model':db['Pause'],'as':_0xedba('0x44')}]},_0x9acf3a={},_0x5b449a={'count':0x0,'rows':[]};var _0x15126=_[_0xedba('0x45')](db[_0xedba('0x46')]['rawAttributes'],function(_0x4eeae4){return{'name':_0x4eeae4[_0xedba('0x47')],'type':_0x4eeae4[_0xedba('0x48')][_0xedba('0x49')]};});_0x9acf3a['model']=_['map'](_0x15126,_0xedba('0x3f'));_0x9acf3a['query']=_[_0xedba('0x4a')](_0x35409e['query']);_0x9acf3a[_0xedba('0x4b')]=_[_0xedba('0x4c')](_0x9acf3a[_0xedba('0x4d')],_0x9acf3a['query']);_0x3a9651['attributes']=_['intersection'](_0x9acf3a['model'],qs[_0xedba('0x4e')](_0x35409e['query'][_0xedba('0x4e')]));_0x3a9651[_0xedba('0x4f')]=_0x3a9651['attributes'][_0xedba('0x50')]?_0x3a9651['attributes']:_0x9acf3a['model'];if(!_0x35409e[_0xedba('0x51')][_0xedba('0x52')](_0xedba('0x53'))){_0x3a9651[_0xedba('0x36')]=qs[_0xedba('0x36')](_0x35409e[_0xedba('0x51')]['limit']);_0x3a9651['offset']=qs['offset'](_0x35409e[_0xedba('0x51')][_0xedba('0x34')]);}_0x3a9651[_0xedba('0x54')]=qs[_0xedba('0x55')](_0x35409e[_0xedba('0x51')]['sort']);_0x3a9651[_0xedba('0x56')]=qs[_0xedba('0x4b')](_[_0xedba('0x57')](_0x35409e['query'],_0x9acf3a['filters']),_0x15126);if(_0x35409e[_0xedba('0x51')][_0xedba('0x58')]){_0x3a9651[_0xedba('0x56')]=_[_0xedba('0x59')](_0x3a9651['where'],{'$or':_[_0xedba('0x45')](_0x15126,function(_0x35f592){if(_0x35f592[_0xedba('0x48')]!==_0xedba('0x5a')){var _0x331b93={};_0x331b93[_0x35f592[_0xedba('0x3f')]]={'$like':'%'+_0x35409e[_0xedba('0x51')][_0xedba('0x58')]+'%'};return _0x331b93;}})});}_0x3a9651=_[_0xedba('0x59')]({},_0x3a9651,_0x35409e[_0xedba('0x5b')]);var _0x12f334={'where':_0x3a9651[_0xedba('0x56')]};return db[_0xedba('0x46')][_0xedba('0x35')](_0x12f334)[_0xedba('0x5c')](function(_0x5002d8){_0x5b449a[_0xedba('0x35')]=_0x5002d8;if(_0x35409e[_0xedba('0x51')][_0xedba('0x5d')]){_0x3a9651[_0xedba('0x5e')]=[{'all':!![]}];}return db[_0xedba('0x46')]['findAll'](_0x3a9651);})[_0xedba('0x5c')](function(_0xc90d57){_0x5b449a['rows']=_0xc90d57;return _0x5b449a;})['then'](respondWithFilteredResult(_0x7c8931,_0x3a9651))[_0xedba('0x2f')](handleError(_0x7c8931,null));};exports['show']=function(_0x4785a0,_0x635c7f){var _0x348aaf={'raw':![],'where':{'id':_0x4785a0['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xedba('0x41')},{'model':db['MailServerOut'],'as':_0xedba('0x43')},{'model':db['Pause'],'as':_0xedba('0x44')}]},_0x46db0f={};_0x46db0f['model']=_[_0xedba('0x4a')](db[_0xedba('0x46')][_0xedba('0x5f')]);_0x46db0f['query']=_['keys'](_0x4785a0[_0xedba('0x51')]);_0x46db0f[_0xedba('0x4b')]=_[_0xedba('0x4c')](_0x46db0f[_0xedba('0x4d')],_0x46db0f[_0xedba('0x51')]);_0x348aaf[_0xedba('0x4f')]=_[_0xedba('0x4c')](_0x46db0f[_0xedba('0x4d')],qs['fields'](_0x4785a0['query'][_0xedba('0x4e')]));_0x348aaf[_0xedba('0x4f')]=_0x348aaf[_0xedba('0x4f')][_0xedba('0x50')]?_0x348aaf['attributes']:_0x46db0f[_0xedba('0x4d')];if(_0x4785a0[_0xedba('0x51')][_0xedba('0x5d')]){_0x348aaf['include']=[{'all':!![]}];}_0x348aaf=_[_0xedba('0x59')]({},_0x348aaf,_0x4785a0[_0xedba('0x5b')]);return db[_0xedba('0x46')][_0xedba('0x60')](_0x348aaf)[_0xedba('0x5c')](handleEntityNotFound(_0x635c7f,null))['then'](respondWithResult(_0x635c7f,null))['catch'](handleError(_0x635c7f,null));};exports[_0xedba('0x3b')]=function(_0xa01b8,_0x5dbda2){if(_0xa01b8[_0xedba('0x61')]['id']){delete _0xa01b8[_0xedba('0x61')]['id'];}return db['MailAccount'][_0xedba('0x60')]({'where':{'id':_0xa01b8[_0xedba('0x62')]['id']},'include':[{'model':db[_0xedba('0x40')],'as':_0xedba('0x41')},{'model':db[_0xedba('0x42')],'as':_0xedba('0x43')},{'model':db[_0xedba('0x63')],'as':_0xedba('0x44')}]})['then'](handleEntityNotFound(_0x5dbda2,null))[_0xedba('0x5c')](saveUpdates(_0xa01b8['body'],null))[_0xedba('0x5c')](function(_0x425bc2){if(_0x425bc2&&_0xa01b8[_0xedba('0x61')]['Imap']){return db['MailServerIn'][_0xedba('0x3b')](_0xa01b8['body'][_0xedba('0x41')],{'where':{'MailAccountId':_0x425bc2['id']}})[_0xedba('0x5c')](function(){return _0x425bc2;});}return _0x425bc2;})[_0xedba('0x5c')](function(_0x20b98b){if(_0x20b98b&&_0xa01b8['body'][_0xedba('0x43')]){return db[_0xedba('0x42')][_0xedba('0x3b')](_0xa01b8[_0xedba('0x61')][_0xedba('0x43')],{'where':{'MailAccountId':_0x20b98b['id']}})['then'](function(){return _0x20b98b;});}return _0x20b98b;})['then'](respondWithResult(_0x5dbda2,null))['catch'](handleError(_0x5dbda2,null));};exports[_0xedba('0x64')]=function(_0xb9e52e,_0xc4b869){return db[_0xedba('0x46')][_0xedba('0x64')]()['then'](respondWithResult(_0xc4b869,null))[_0xedba('0x2f')](handleError(_0xc4b869,null));};exports[_0xedba('0x65')]=function(_0x13de22,_0x1484e2,_0x285d6c){if(_0x13de22[_0xedba('0x61')]['id']){delete _0x13de22[_0xedba('0x61')]['id'];}return db[_0xedba('0x46')]['find']({'where':{'id':_0x13de22['params']['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x1484e2,null))[_0xedba('0x5c')](function(_0x238b6e){if(_0x238b6e){_0x13de22[_0xedba('0x61')]['MailAccountId']=_0x238b6e['id'];return db[_0xedba('0x66')][_0xedba('0x67')](_0x13de22[_0xedba('0x61')]);}})[_0xedba('0x5c')](respondWithResult(_0x1484e2,null))[_0xedba('0x2f')](handleError(_0x1484e2,null));};exports[_0xedba('0x68')]=function(_0x98dc68,_0x2312b9,_0xc498fd){var _0x5c708c={'raw':![],'where':{}};var _0x45cd88={};var _0x420f1a={'count':0x0,'rows':[]};return db[_0xedba('0x46')][_0xedba('0x69')]({'where':{'id':_0x98dc68['params']['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x2312b9,null))[_0xedba('0x5c')](function(_0x4fcea6){if(_0x4fcea6){_0x45cd88[_0xedba('0x4d')]=_[_0xedba('0x4a')](db[_0xedba('0x66')]['rawAttributes']);_0x45cd88[_0xedba('0x51')]=_[_0xedba('0x4a')](_0x98dc68[_0xedba('0x51')]);_0x45cd88[_0xedba('0x4b')]=_[_0xedba('0x4c')](_0x45cd88['model'],_0x45cd88[_0xedba('0x51')]);_0x5c708c[_0xedba('0x4f')]=_['intersection'](_0x45cd88['model'],qs[_0xedba('0x4e')](_0x98dc68[_0xedba('0x51')][_0xedba('0x4e')]));_0x5c708c['attributes']=_0x5c708c['attributes'][_0xedba('0x50')]?_0x5c708c['attributes']:_0x45cd88[_0xedba('0x4d')];if(!_0x98dc68[_0xedba('0x51')][_0xedba('0x52')](_0xedba('0x53'))){_0x5c708c[_0xedba('0x36')]=qs[_0xedba('0x36')](_0x98dc68['query']['limit']);_0x5c708c[_0xedba('0x34')]=qs[_0xedba('0x34')](_0x98dc68[_0xedba('0x51')][_0xedba('0x34')]);}_0x5c708c[_0xedba('0x54')]=qs[_0xedba('0x55')](_0x98dc68[_0xedba('0x51')][_0xedba('0x55')]);_0x5c708c[_0xedba('0x56')]=qs[_0xedba('0x4b')](_[_0xedba('0x57')](_0x98dc68[_0xedba('0x51')],_0x45cd88[_0xedba('0x4b')]));_0x5c708c[_0xedba('0x56')][_0xedba('0x6a')]=_0x4fcea6['id'];if(_0x98dc68[_0xedba('0x51')]['filter']){_0x5c708c[_0xedba('0x56')]=_[_0xedba('0x59')](_0x5c708c[_0xedba('0x56')],{'$or':_['map'](_0x5c708c[_0xedba('0x4f')],function(_0x1da1f3){var _0x4187e1={};_0x4187e1[_0x1da1f3]={'$like':'%'+_0x98dc68[_0xedba('0x51')][_0xedba('0x58')]+'%'};return _0x4187e1;})});}_0x5c708c=_[_0xedba('0x59')]({},_0x5c708c,_0x98dc68[_0xedba('0x5b')]);return db['Disposition'][_0xedba('0x35')]({'where':_0x5c708c[_0xedba('0x56')]})[_0xedba('0x5c')](function(_0x54f89d){_0x420f1a[_0xedba('0x35')]=_0x54f89d;if(_0x98dc68[_0xedba('0x51')]['includeAll']){_0x5c708c[_0xedba('0x5e')]=[{'all':!![]}];}return db[_0xedba('0x66')]['findAll'](_0x5c708c);})[_0xedba('0x5c')](function(_0x48d98d){_0x420f1a[_0xedba('0x6b')]=_0x48d98d;return _0x420f1a;});}})[_0xedba('0x5c')](respondWithFilteredResult(_0x2312b9,_0x5c708c))['catch'](handleError(_0x2312b9,null));};exports['removeDispositions']=function(_0x15645,_0x25a8bd,_0x11665a){return db[_0xedba('0x46')]['find']({'where':{'id':_0x15645['params']['id']}})['then'](handleEntityNotFound(_0x25a8bd,null))[_0xedba('0x5c')](function(_0x5eb4d3){if(_0x5eb4d3){return _0x5eb4d3['removeDispositions'](_0x15645[_0xedba('0x51')][_0xedba('0x6c')]);}})[_0xedba('0x5c')](respondWithStatusCode(_0x25a8bd,null))[_0xedba('0x2f')](handleError(_0x25a8bd,null));};exports[_0xedba('0x6d')]=function(_0x285469,_0x420cec,_0x334103){if(_0x285469[_0xedba('0x61')]['id']){delete _0x285469[_0xedba('0x61')]['id'];}return db[_0xedba('0x46')][_0xedba('0x60')]({'where':{'id':_0x285469[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x420cec,null))[_0xedba('0x5c')](function(_0x168d9a){if(_0x168d9a){_0x285469[_0xedba('0x61')][_0xedba('0x6a')]=_0x168d9a['id'];return db[_0xedba('0x6e')][_0xedba('0x67')](_0x285469['body']);}})[_0xedba('0x5c')](respondWithResult(_0x420cec,null))[_0xedba('0x2f')](handleError(_0x420cec,null));};exports[_0xedba('0x6f')]=function(_0x6de5a6,_0x2331e7,_0x34e9da){var _0xe9c1f0={'raw':![],'where':{}};var _0x599aba={};var _0x421557={'count':0x0,'rows':[]};return db[_0xedba('0x46')][_0xedba('0x69')]({'where':{'id':_0x6de5a6[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x2331e7,null))['then'](function(_0xaf00c5){if(_0xaf00c5){_0x599aba['model']=_[_0xedba('0x4a')](db[_0xedba('0x6e')][_0xedba('0x5f')]);_0x599aba[_0xedba('0x51')]=_[_0xedba('0x4a')](_0x6de5a6[_0xedba('0x51')]);_0x599aba['filters']=_[_0xedba('0x4c')](_0x599aba['model'],_0x599aba['query']);_0xe9c1f0[_0xedba('0x4f')]=_['intersection'](_0x599aba['model'],qs[_0xedba('0x4e')](_0x6de5a6[_0xedba('0x51')][_0xedba('0x4e')]));_0xe9c1f0['attributes']=_0xe9c1f0[_0xedba('0x4f')][_0xedba('0x50')]?_0xe9c1f0[_0xedba('0x4f')]:_0x599aba[_0xedba('0x4d')];if(!_0x6de5a6['query'][_0xedba('0x52')](_0xedba('0x53'))){_0xe9c1f0[_0xedba('0x36')]=qs[_0xedba('0x36')](_0x6de5a6[_0xedba('0x51')]['limit']);_0xe9c1f0[_0xedba('0x34')]=qs['offset'](_0x6de5a6['query'][_0xedba('0x34')]);}_0xe9c1f0['order']=qs[_0xedba('0x55')](_0x6de5a6['query'][_0xedba('0x55')]);_0xe9c1f0[_0xedba('0x56')]=qs[_0xedba('0x4b')](_[_0xedba('0x57')](_0x6de5a6['query'],_0x599aba[_0xedba('0x4b')]));_0xe9c1f0[_0xedba('0x56')]['MailAccountId']=_0xaf00c5['id'];if(_0x6de5a6[_0xedba('0x51')][_0xedba('0x58')]){_0xe9c1f0['where']=_[_0xedba('0x59')](_0xe9c1f0[_0xedba('0x56')],{'$or':_[_0xedba('0x45')](_0xe9c1f0['attributes'],function(_0x3ba0e3){var _0x31c596={};_0x31c596[_0x3ba0e3]={'$like':'%'+_0x6de5a6['query'][_0xedba('0x58')]+'%'};return _0x31c596;})});}_0xe9c1f0=_[_0xedba('0x59')]({},_0xe9c1f0,_0x6de5a6['options']);return db[_0xedba('0x6e')]['count']({'where':_0xe9c1f0[_0xedba('0x56')]})[_0xedba('0x5c')](function(_0x458bd2){_0x421557['count']=_0x458bd2;if(_0x6de5a6[_0xedba('0x51')][_0xedba('0x5d')]){_0xe9c1f0['include']=[{'all':!![]}];}return db[_0xedba('0x6e')][_0xedba('0x70')](_0xe9c1f0);})[_0xedba('0x5c')](function(_0x401f00){_0x421557['rows']=_0x401f00;return _0x421557;});}})[_0xedba('0x5c')](respondWithFilteredResult(_0x2331e7,_0xe9c1f0))[_0xedba('0x2f')](handleError(_0x2331e7,null));};exports[_0xedba('0x71')]=function(_0x318ce1,_0xd95a6,_0x2b41c0){return db[_0xedba('0x46')][_0xedba('0x60')]({'where':{'id':_0x318ce1['params']['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0xd95a6,null))[_0xedba('0x5c')](function(_0x3c568c){if(_0x3c568c){return _0x3c568c[_0xedba('0x71')](_0x318ce1['query'][_0xedba('0x6c')]);}})[_0xedba('0x5c')](respondWithStatusCode(_0xd95a6,null))['catch'](handleError(_0xd95a6,null));};exports['create']=function(_0x3b7af,_0x26a7bd){var _0x110fcd={'name':_0x3b7af[_0xedba('0x61')][_0xedba('0x3f')],'key':_0x3b7af[_0xedba('0x61')]['key'],'email':_0x3b7af[_0xedba('0x61')]['email'],'ListId':_0x3b7af[_0xedba('0x61')][_0xedba('0x72')],'active':!_['isNil'](_0x3b7af[_0xedba('0x61')][_0xedba('0x73')])?_0x3b7af[_0xedba('0x61')][_0xedba('0x73')]:!![],'description':_0x3b7af['body']['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x3b7af[_0xedba('0x61')]['cservice'])){if(_0x3b7af['body'][_0xedba('0x74')]){_0x110fcd[_0xedba('0x41')][_0xedba('0x75')]=_0x110fcd[_0xedba('0x43')][_0xedba('0x75')]=_0x3b7af[_0xedba('0x61')]['cuser'];_0x110fcd[_0xedba('0x41')][_0xedba('0x76')]=_0x110fcd[_0xedba('0x43')]['pass']=_0x3b7af[_0xedba('0x61')][_0xedba('0x77')];}else{_0x110fcd[_0xedba('0x41')]['authentication']=_0x110fcd[_0xedba('0x43')][_0xedba('0x78')]=![];}_0x110fcd[_0xedba('0x41')]['host']=_0x3b7af[_0xedba('0x61')][_0xedba('0x41')][_0xedba('0x79')];_0x110fcd[_0xedba('0x41')][_0xedba('0x7a')]=_0x3b7af['body']['Imap'][_0xedba('0x7a')];_0x110fcd[_0xedba('0x43')][_0xedba('0x79')]=_0x3b7af['body'][_0xedba('0x43')][_0xedba('0x79')];_0x110fcd[_0xedba('0x43')][_0xedba('0x7a')]=_0x3b7af[_0xedba('0x61')]['Smtp'][_0xedba('0x7a')];}else{_0x110fcd[_0xedba('0x41')][_0xedba('0x7b')]=_0x110fcd[_0xedba('0x43')][_0xedba('0x7b')]=_0x3b7af[_0xedba('0x61')][_0xedba('0x7c')];_0x110fcd['Imap']['user']=_0x110fcd[_0xedba('0x43')]['user']=_0x3b7af['body'][_0xedba('0x7d')];_0x110fcd[_0xedba('0x41')][_0xedba('0x76')]=_0x110fcd[_0xedba('0x43')][_0xedba('0x7e')]=_0x3b7af[_0xedba('0x61')][_0xedba('0x77')];}return db[_0xedba('0x46')]['create'](_0x110fcd,{'include':[{'model':db[_0xedba('0x42')],'as':_0xedba('0x43')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xedba('0x5c')](function(_0x3590cc){var _0x36530d=_0x3b7af[_0xedba('0x75')][_0xedba('0x3d')]({'plain':!![]});if(!_0x36530d)throw new Error(_0xedba('0x7f'));if(_0x36530d['role']==='user'){var _0x52e7a6=_0x3590cc['get']({'plain':!![]});return db['UserProfileSection'][_0xedba('0x60')]({'where':{'name':_0xedba('0x80'),'userProfileId':_0x36530d[_0xedba('0x81')]},'raw':!![]})['then'](function(_0x4ab2e8){if(_0x4ab2e8&&_0x4ab2e8[_0xedba('0x82')]===0x0){return db[_0xedba('0x83')][_0xedba('0x67')]({'name':_0x52e7a6[_0xedba('0x3f')],'resourceId':_0x52e7a6['id'],'type':_0x4ab2e8[_0xedba('0x3f')],'sectionId':_0x4ab2e8['id']},{})[_0xedba('0x5c')](function(){return _0x3590cc;});}else{return _0x3590cc;}})['catch'](function(_0x3f5e7a){logger[_0xedba('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f5e7a);throw _0x3f5e7a;});}return _0x3590cc;})[_0xedba('0x5c')](respondWithResult(_0x26a7bd,0xc9))[_0xedba('0x2f')](handleError(_0x26a7bd,null));};exports[_0xedba('0x84')]=function(_0x28d2dc,_0xcd3de5,_0x53a256){return db[_0xedba('0x46')][_0xedba('0x69')]({'where':{'id':_0x28d2dc[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0xcd3de5,null))[_0xedba('0x5c')](function(_0x1f785f){if(_0x1f785f){return _0x1f785f[_0xedba('0x84')]();}return null;})[_0xedba('0x5c')](respondWithResult(_0xcd3de5,null))[_0xedba('0x2f')](handleError(_0xcd3de5,null));};exports[_0xedba('0x85')]=function(_0x9cb23,_0x4f9808,_0x2011f2){if(_0x9cb23[_0xedba('0x61')]['id']){delete _0x9cb23['body']['id'];}return db[_0xedba('0x46')]['find']({'where':{'id':_0x9cb23[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x4f9808,null))[_0xedba('0x5c')](function(_0x8fe7ef){if(_0x8fe7ef){_0x9cb23[_0xedba('0x61')][_0xedba('0x6a')]=_0x8fe7ef['id'];return db[_0xedba('0x40')]['create'](_0x9cb23[_0xedba('0x61')]);}})[_0xedba('0x5c')](respondWithResult(_0x4f9808,null))[_0xedba('0x2f')](handleError(_0x4f9808,null));};exports[_0xedba('0x86')]=function(_0x558f04,_0x54a4c7,_0x2e5bd2){return db['MailAccount'][_0xedba('0x69')]({'where':{'id':_0x558f04[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x54a4c7,null))[_0xedba('0x5c')](function(_0x1c0da){if(_0x1c0da){return _0x1c0da[_0xedba('0x87')](null);}return null;})[_0xedba('0x5c')](respondWithStatusCode(_0x54a4c7,null))[_0xedba('0x2f')](handleError(_0x54a4c7,null));};exports[_0xedba('0x88')]=function(_0x44ebf1,_0x284949,_0x550b9d){return db[_0xedba('0x46')][_0xedba('0x69')]({'where':{'id':_0x44ebf1['params']['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x284949,null))['then'](function(_0x3635f1){if(_0x3635f1){return _0x3635f1[_0xedba('0x88')]();}return null;})[_0xedba('0x5c')](respondWithResult(_0x284949,null))[_0xedba('0x2f')](handleError(_0x284949,null));};exports[_0xedba('0x89')]=function(_0x1c995b,_0x15852d,_0x155ba5){if(_0x1c995b['body']['id']){delete _0x1c995b[_0xedba('0x61')]['id'];}return db['MailAccount'][_0xedba('0x60')]({'where':{'id':_0x1c995b['params']['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x15852d,null))[_0xedba('0x5c')](function(_0xfe3655){if(_0xfe3655){_0x1c995b['body'][_0xedba('0x6a')]=_0xfe3655['id'];return db[_0xedba('0x42')][_0xedba('0x67')](_0x1c995b[_0xedba('0x61')]);}})[_0xedba('0x5c')](respondWithResult(_0x15852d,null))['catch'](handleError(_0x15852d,null));};exports[_0xedba('0x8a')]=function(_0x157193,_0x2738d3,_0x246f13){return db[_0xedba('0x46')]['findOne']({'where':{'id':_0x157193[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x2738d3,null))[_0xedba('0x5c')](function(_0x2522fa){if(_0x2522fa){return _0x2522fa[_0xedba('0x8b')](null);}return null;})[_0xedba('0x5c')](respondWithStatusCode(_0x2738d3,null))['catch'](handleError(_0x2738d3,null));};exports['addInteraction']=function(_0x5a0e9c,_0x4e6922,_0x1676a6){return db[_0xedba('0x8c')][_0xedba('0x60')]({'where':{'id':_0x5a0e9c[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x4e6922,null))[_0xedba('0x5c')](function(_0x111c88){if(_0x111c88){return _0x111c88[_0xedba('0x8d')](_0x5a0e9c[_0xedba('0x61')][_0xedba('0x6c')],_[_0xedba('0x8e')](_0x5a0e9c[_0xedba('0x61')],[_0xedba('0x6c'),'id'])||{});}})[_0xedba('0x5c')](respondWithResult(_0x4e6922,null))['catch'](handleError(_0x4e6922,null));};exports[_0xedba('0x8f')]=function(_0x573703,_0x31555a,_0x3fbf6d){var _0x23fb02={'raw':![],'where':{}};var _0x15679e={};var _0x49943d={'count':0x0,'rows':[]};return db[_0xedba('0x46')][_0xedba('0x69')]({'where':{'id':_0x573703['params']['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x31555a,null))[_0xedba('0x5c')](function(_0x42033e){if(_0x42033e){_0x15679e[_0xedba('0x4d')]=_['keys'](db[_0xedba('0x8c')][_0xedba('0x5f')]);_0x15679e[_0xedba('0x51')]=_['keys'](_0x573703[_0xedba('0x51')]);_0x15679e[_0xedba('0x4b')]=_[_0xedba('0x4c')](_0x15679e[_0xedba('0x4d')],_0x15679e[_0xedba('0x51')]);_0x23fb02[_0xedba('0x4f')]=_[_0xedba('0x4c')](_0x15679e['model'],qs[_0xedba('0x4e')](_0x573703[_0xedba('0x51')][_0xedba('0x4e')]));_0x23fb02['attributes']=_0x23fb02[_0xedba('0x4f')][_0xedba('0x50')]?_0x23fb02['attributes']:_0x15679e[_0xedba('0x4d')];if(!_0x573703[_0xedba('0x51')][_0xedba('0x52')](_0xedba('0x53'))){_0x23fb02[_0xedba('0x36')]=qs[_0xedba('0x36')](_0x573703[_0xedba('0x51')][_0xedba('0x36')]);_0x23fb02[_0xedba('0x34')]=qs[_0xedba('0x34')](_0x573703[_0xedba('0x51')][_0xedba('0x34')]);}_0x23fb02[_0xedba('0x54')]=qs[_0xedba('0x55')](_0x573703['query']['sort']);_0x23fb02[_0xedba('0x56')]=qs[_0xedba('0x4b')](_['pick'](_0x573703[_0xedba('0x51')],_0x15679e['filters']));_0x23fb02['where'][_0xedba('0x6a')]=_0x42033e['id'];if(_0x573703[_0xedba('0x51')]['filter']){_0x23fb02[_0xedba('0x56')]=_[_0xedba('0x59')](_0x23fb02[_0xedba('0x56')],{'$or':_[_0xedba('0x45')](_0x23fb02[_0xedba('0x4f')],function(_0x1c6899){var _0x19488f={};_0x19488f[_0x1c6899]={'$like':'%'+_0x573703['query'][_0xedba('0x58')]+'%'};return _0x19488f;})});}_0x23fb02=_['merge']({},_0x23fb02,_0x573703[_0xedba('0x5b')]);return db['MailInteraction']['count']({'where':_0x23fb02[_0xedba('0x56')]})[_0xedba('0x5c')](function(_0xaeea06){_0x49943d[_0xedba('0x35')]=_0xaeea06;if(_0x573703[_0xedba('0x51')][_0xedba('0x5d')]){_0x23fb02[_0xedba('0x5e')]=[{'model':db[_0xedba('0x90')],'as':_0xedba('0x91'),'required':![]},{'model':db[_0xedba('0x92')],'as':_0xedba('0x93'),'attributes':[_0xedba('0x3f'),_0xedba('0x94'),_0xedba('0x95')],'required':![]},{'model':db[_0xedba('0x96')],'as':'Tags','attributes':['id',_0xedba('0x3f'),_0xedba('0x97')],'where':_0x573703[_0xedba('0x51')][_0xedba('0x98')]?{'id':_0x573703[_0xedba('0x51')]['tag']}:undefined,'required':_0x573703[_0xedba('0x51')][_0xedba('0x98')]?!![]:![]}];}return db[_0xedba('0x8c')][_0xedba('0x70')](_0x23fb02);})[_0xedba('0x5c')](function(_0x5bbc70){_0x49943d['rows']=_0x5bbc70;return _0x49943d;});}})[_0xedba('0x5c')](respondWithFilteredResult(_0x31555a,_0x23fb02))[_0xedba('0x2f')](handleError(_0x31555a,null));};exports[_0xedba('0x99')]=function addApplications(_0x473c79,_0x115877){var _0x472254=_0x473c79[_0xedba('0x62')]['id'];var _0x5aba79=_0x473c79[_0xedba('0x61')];var _0x308f43=0xc8;var _0x16ae69=null;return db[_0xedba('0x9a')][_0xedba('0x9b')]({'isolationLevel':db['sequelize'][_0xedba('0x9c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x403d42){return db[_0xedba('0x46')][_0xedba('0x69')]({'where':{'id':_0x472254},'transaction':_0x403d42})['then'](function(_0x243256){if(_0x243256){return db[_0xedba('0x9d')]['destroy']({'where':{'MailAccountId':_0x472254},'transaction':_0x403d42})[_0xedba('0x5c')](function(){var _0x414b0d=_[_0xedba('0x45')](_0x5aba79,function(_0x5a812b){_0x5a812b[_0xedba('0x6a')]=_0x472254;return _0x5a812b;});return db[_0xedba('0x9d')][_0xedba('0x9e')](_0x414b0d,{'transaction':_0x403d42});});}else{_0x308f43=0x194;_0x16ae69=[];}});})[_0xedba('0x5c')](function(){if(_0x308f43!==0x194){return db[_0xedba('0x9d')][_0xedba('0x9f')]({'where':{'MailAccountId':_0x472254},'order':'priority'})['then'](function(_0x1e09de){_0x16ae69=_0x1e09de;});}})[_0xedba('0x2f')](function(_0x45803e){_0x308f43=0x1f4;logger[_0xedba('0x2c')](_0x45803e[_0xedba('0x3e')]);if(_0x45803e[_0xedba('0x3f')]){delete _0x45803e[_0xedba('0x3f')];}_0x16ae69=_0x45803e;})[_0xedba('0xa0')](function(){if(_0x16ae69===null){_0x115877[_0xedba('0x30')](_0x308f43);}else{if(_0x308f43===0x1f4){_0x115877[_0xedba('0x31')](_0x308f43)['send'](_0x16ae69);}else{_0x115877[_0xedba('0x31')](_0x308f43)[_0xedba('0x33')](_0x16ae69);}}});};exports[_0xedba('0xa1')]=function(_0x3843c1,_0x426a80,_0x18ed31){var _0x27b0d0={};var _0x1308b2={};var _0x284963;var _0x131d9b;return db[_0xedba('0x46')]['findOne']({'where':{'id':_0x3843c1[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x426a80,null))[_0xedba('0x5c')](function(_0x43f511){if(_0x43f511){_0x284963=_0x43f511;_0x1308b2[_0xedba('0x4d')]=_[_0xedba('0x4a')](db[_0xedba('0x9d')][_0xedba('0x5f')]);_0x1308b2['query']=_[_0xedba('0x4a')](_0x3843c1[_0xedba('0x51')]);_0x1308b2[_0xedba('0x4b')]=_[_0xedba('0x4c')](_0x1308b2['model'],_0x1308b2[_0xedba('0x51')]);_0x27b0d0[_0xedba('0x4f')]=_[_0xedba('0x4c')](_0x1308b2[_0xedba('0x4d')],qs[_0xedba('0x4e')](_0x3843c1[_0xedba('0x51')]['fields']));_0x27b0d0['attributes']=_0x27b0d0[_0xedba('0x4f')]['length']?_0x27b0d0[_0xedba('0x4f')]:_0x1308b2[_0xedba('0x4d')];_0x27b0d0[_0xedba('0x54')]=qs[_0xedba('0x55')](_0x3843c1[_0xedba('0x51')][_0xedba('0x55')]);_0x27b0d0[_0xedba('0x56')]=qs[_0xedba('0x4b')](_[_0xedba('0x57')](_0x3843c1['query'],_0x1308b2[_0xedba('0x4b')]));if(_0x3843c1[_0xedba('0x51')][_0xedba('0x58')]){_0x27b0d0[_0xedba('0x56')]=_['merge'](_0x27b0d0['where'],{'$or':_[_0xedba('0x45')](_0x27b0d0[_0xedba('0x4f')],function(_0x42f1e7){var _0x4c03c3={};_0x4c03c3[_0x42f1e7]={'$like':'%'+_0x3843c1['query'][_0xedba('0x58')]+'%'};return _0x4c03c3;})});}_0x27b0d0=_[_0xedba('0x59')]({},_0x27b0d0,_0x3843c1[_0xedba('0x5b')]);return _0x284963['getApplications'](_0x27b0d0);}})['then'](function(_0x48762a){if(_0x48762a){_0x131d9b=_0x48762a[_0xedba('0x50')];if(!_0x3843c1[_0xedba('0x51')][_0xedba('0x52')](_0xedba('0x53'))){_0x27b0d0[_0xedba('0x36')]=qs['limit'](_0x3843c1[_0xedba('0x51')][_0xedba('0x36')]);_0x27b0d0[_0xedba('0x34')]=qs['offset'](_0x3843c1[_0xedba('0x51')]['offset']);}return _0x284963[_0xedba('0xa1')](_0x27b0d0);}})[_0xedba('0x5c')](function(_0x5b08d7){if(_0x5b08d7){return _0x5b08d7?{'count':_0x131d9b,'rows':_0x5b08d7}:null;}})['then'](respondWithResult(_0x426a80,null))[_0xedba('0x2f')](handleError(_0x426a80,null));};exports[_0xedba('0xa2')]=function(_0x3063af,_0x3e09fc,_0xd497ac){var _0x3a878e={'raw':!![],'where':{}};var _0x34e6be={};var _0x376578={'count':0x0,'rows':[]};return db[_0xedba('0x46')][_0xedba('0x69')]({'where':{'id':_0x3063af[_0xedba('0x62')]['id']}})['then'](handleEntityNotFound(_0x3e09fc,null))[_0xedba('0x5c')](function(_0x5c135a){if(_0x5c135a){_0x34e6be[_0xedba('0x4d')]=_[_0xedba('0x4a')](db[_0xedba('0xa3')][_0xedba('0x5f')]);_0x34e6be[_0xedba('0x51')]=_[_0xedba('0x4a')](_0x3063af['query']);_0x34e6be[_0xedba('0x4b')]=_[_0xedba('0x4c')](_0x34e6be[_0xedba('0x4d')],_0x34e6be[_0xedba('0x51')]);_0x3a878e[_0xedba('0x4f')]=_[_0xedba('0x4c')](_0x34e6be['model'],qs['fields'](_0x3063af[_0xedba('0x51')][_0xedba('0x4e')]));_0x3a878e[_0xedba('0x4f')]=_0x3a878e[_0xedba('0x4f')][_0xedba('0x50')]?_0x3a878e[_0xedba('0x4f')]:_0x34e6be[_0xedba('0x4d')];if(!_0x3063af[_0xedba('0x51')][_0xedba('0x52')](_0xedba('0x53'))){_0x3a878e[_0xedba('0x36')]=qs['limit'](_0x3063af[_0xedba('0x51')]['limit']);_0x3a878e[_0xedba('0x34')]=qs[_0xedba('0x34')](_0x3063af[_0xedba('0x51')][_0xedba('0x34')]);}_0x3a878e[_0xedba('0x54')]=qs[_0xedba('0x55')](_0x3063af['query'][_0xedba('0x55')]);_0x3a878e[_0xedba('0x56')]=qs['filters'](_[_0xedba('0x57')](_0x3063af[_0xedba('0x51')],_0x34e6be[_0xedba('0x4b')]));_0x3a878e[_0xedba('0x56')]['MailAccountId']=_0x5c135a['id'];if(_0x3063af['query'][_0xedba('0x58')]){_0x3a878e[_0xedba('0x56')]=_[_0xedba('0x59')](_0x3a878e['where'],{'$or':_[_0xedba('0x45')](_0x3a878e[_0xedba('0x4f')],function(_0x170153){var _0x58a033={};_0x58a033[_0x170153]={'$like':'%'+_0x3063af['query'][_0xedba('0x58')]+'%'};return _0x58a033;})});}if(_0x3063af[_0xedba('0x51')]['$gte']){var _0x1383b8=_0x3063af[_0xedba('0x51')]['$gte']['split'](',');var _0x85f3fa={};_0x85f3fa[_0x1383b8[0x0]]={'$gte':moment(_0x1383b8[0x1])['format'](_0xedba('0xa4'))};_0x3a878e[_0xedba('0x56')]=_[_0xedba('0x59')](_0x3a878e[_0xedba('0x56')],_0x85f3fa);}_0x3a878e=_[_0xedba('0x59')]({},_0x3a878e,_0x3063af[_0xedba('0x5b')]);return db[_0xedba('0xa3')]['count']({'where':_0x3a878e[_0xedba('0x56')]})[_0xedba('0x5c')](function(_0x5ab791){_0x376578[_0xedba('0x35')]=_0x5ab791;if(_0x3063af['query'][_0xedba('0x5d')]){_0x3a878e[_0xedba('0x5e')]=[{'all':!![]}];}return db['MailMessage'][_0xedba('0x70')](_0x3a878e);})['then'](function(_0x337d63){if(_0x3063af[_0xedba('0x51')][_0xedba('0xa5')]==='true'){for(var _0x56fb59=0x0;_0x56fb59<_0x337d63[_0xedba('0x50')];_0x56fb59++){_0x337d63[_0x56fb59][_0xedba('0x61')]=juice(_0x337d63[_0x56fb59][_0xedba('0x61')]);}}_0x376578[_0xedba('0x6b')]=_0x337d63;return _0x376578;});}})[_0xedba('0x5c')](respondWithFilteredResult(_0x3e09fc,_0x3a878e))[_0xedba('0x2f')](handleError(_0x3e09fc,null));};exports[_0xedba('0xa6')]=function(_0x134bd9,_0x1b5d3b,_0x4d6a44){var _0x362104,_0x5088dd={},_0x4b5168;if(_0x134bd9[_0xedba('0x61')]['to']){_0x4b5168=_0x134bd9[_0xedba('0x61')]['to'][_0xedba('0xa7')](',')[0x0];}return db[_0xedba('0x46')]['find']({'where':{'id':_0x134bd9[_0xedba('0x62')]['id']},'include':[{'model':db[_0xedba('0xa8')],'as':'List','include':[{'model':db[_0xedba('0x90')],'as':_0xedba('0xa9'),'where':{'email':_0x4b5168},'limit':0x1,'order':[[_0xedba('0xaa'),_0xedba('0xab')]]}]},{'model':db['MailServerOut'],'as':_0xedba('0x43'),'raw':!![]}]})[_0xedba('0x5c')](handleEntityNotFound(_0x1b5d3b,null))[_0xedba('0x5c')](function(_0x4f9c6c){if(_0x4f9c6c){_0x362104=_0x4f9c6c;if(_0x4f9c6c[_0xedba('0x43')]){if(_[_0xedba('0xac')](_0x134bd9[_0xedba('0x61')][_0xedba('0xad')])){_0x134bd9[_0xedba('0x61')]['from']=util[_0xedba('0xae')](_0xedba('0xaf'),_0x4f9c6c['name'],_0x4f9c6c[_0xedba('0xb0')]||_0x4f9c6c[_0xedba('0x43')][_0xedba('0x75')]);}if(_0x134bd9['body'][_0xedba('0xb1')]&&_0x134bd9[_0xedba('0x61')][_0xedba('0xb1')][_0xedba('0x50')]){for(var _0x29865f=0x0;_0x29865f<_0x134bd9[_0xedba('0x61')][_0xedba('0xb1')]['length'];_0x29865f+=0x1){_0x134bd9['body']['attachments'][_0x29865f]={'filename':_0x134bd9['body'][_0xedba('0xb1')][_0x29865f][_0xedba('0x3f')],'path':path[_0xedba('0xb2')](config[_0xedba('0xb3')],_0xedba('0xb4'),_0x134bd9[_0xedba('0x61')][_0xedba('0xb1')][_0x29865f][_0xedba('0xb5')])};}}var _0x575d24={'tls':{'rejectUnauthorized':![]}};if(_[_0xedba('0xac')](_0x4f9c6c[_0xedba('0x43')][_0xedba('0x7b')])){if(_0x4f9c6c[_0xedba('0x43')][_0xedba('0x78')]){_0x575d24['auth']={'user':_0x4f9c6c[_0xedba('0x43')][_0xedba('0x75')],'pass':_0x4f9c6c[_0xedba('0x43')][_0xedba('0x7e')]};}_0x575d24[_0xedba('0x79')]=_0x4f9c6c[_0xedba('0x43')][_0xedba('0x79')];_0x575d24[_0xedba('0x7a')]=_0x4f9c6c[_0xedba('0x43')]['port'];_0x575d24[_0xedba('0xb6')]=_0x4f9c6c[_0xedba('0x43')][_0xedba('0xb6')];}else{_0x575d24['service']=_0x4f9c6c[_0xedba('0x43')]['service'];_0x575d24[_0xedba('0xb7')]={'user':_0x4f9c6c[_0xedba('0x43')][_0xedba('0x75')],'pass':_0x4f9c6c[_0xedba('0x43')][_0xedba('0x7e')]};}return respondWithRpcPromise(_0xedba('0xb8'),_0xedba('0xb9'),{'account':_0x575d24,'message':_0x134bd9[_0xedba('0x61')]});}else{throw new Error(_0xedba('0xba'));}}})[_0xedba('0x5c')](function(_0x266327){if(_0x266327){_0x5088dd=_0x266327;if(_0x362104[_0xedba('0xbb')]){if(_0x362104[_0xedba('0xbb')]['Contacts'][_0xedba('0x50')]){return _0x362104[_0xedba('0xbb')][_0xedba('0xa9')][0x0];}else{return db[_0xedba('0x90')][_0xedba('0x67')](_['defaults'](_0x134bd9[_0xedba('0x61')],{'firstName':_0x134bd9[_0xedba('0x61')]['to'],'email':_0x134bd9[_0xedba('0x61')]['to'],'phone':_0x134bd9[_0xedba('0x61')]['to'],'ListId':_0x362104['ListId']}));}}else{throw new Error(_0xedba('0xba'));}}})[_0xedba('0x5c')](function(_0x462376){if(_0x462376){var _0x22e613={'UserId':_0x134bd9[_0xedba('0x75')]['id'],'ContactId':_0x462376['id'],'MailAccountId':_0x362104['id'],'inReplyTo':_0x5088dd[_0xedba('0xbc')],'to':_0x134bd9['body'][_0xedba('0xad')],'cc':_0x134bd9[_0xedba('0x61')]['cc'],'subject':_0x134bd9[_0xedba('0x61')]['subject'],'attach':_0x134bd9[_0xedba('0x61')]['attach'],'firstMsgDirection':_0xedba('0xbd'),'lastMsgAt':moment()[_0xedba('0xae')](_0xedba('0xa4')),'lastMsgDirection':_0xedba('0xbd'),'Messages':[_[_0xedba('0x59')](_0x134bd9['body'],{'messageId':_0x5088dd[_0xedba('0xbc')],'sentAt':moment()['format'](_0xedba('0xa4')),'read':!![],'MailAccountId':_0x362104['id'],'UserId':_0x134bd9['user']['id'],'ContactId':_0x462376['id']})]};if(_0x134bd9[_0xedba('0x61')][_0xedba('0xbe')]){_0x22e613=_[_0xedba('0x59')](_0x22e613,_0x134bd9[_0xedba('0x61')][_0xedba('0xbe')]);}return db[_0xedba('0x8c')][_0xedba('0x67')](_0x22e613,{'include':[{'model':db['MailMessage'],'as':_0xedba('0xbf')}]});}})[_0xedba('0x5c')](respondWithResult(_0x1b5d3b,null))[_0xedba('0x2f')](handleError(_0x1b5d3b,null));};exports[_0xedba('0xc0')]=function(_0x1d89f4,_0x264f1d,_0x8036db){return db['MailAccount'][_0xedba('0x60')]({'where':{'id':_0x1d89f4[_0xedba('0x62')]['id']},'include':[{'model':db[_0xedba('0x42')],'as':_0xedba('0x43'),'raw':!![]}]})[_0xedba('0x5c')](handleEntityNotFound(_0x264f1d,null))[_0xedba('0x5c')](function(_0x2380bf){if(_0x2380bf&&_0x2380bf['Smtp']){var _0x4bc031={'id':_0x2380bf['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2380bf[_0xedba('0x43')]['service']){_0x4bc031[_0xedba('0x7b')]=_0x2380bf[_0xedba('0x43')][_0xedba('0x7b')];}else{_0x4bc031[_0xedba('0x79')]=_0x2380bf[_0xedba('0x43')][_0xedba('0x79')];_0x4bc031[_0xedba('0x7a')]=_0x2380bf[_0xedba('0x43')][_0xedba('0x7a')];_0x4bc031[_0xedba('0xb6')]=_0x2380bf[_0xedba('0x43')][_0xedba('0xb6')];}if(_0x2380bf[_0xedba('0x43')][_0xedba('0x78')]){_0x4bc031[_0xedba('0xb7')]={'user':_0x2380bf[_0xedba('0x43')][_0xedba('0x75')],'pass':_0x2380bf[_0xedba('0x43')][_0xedba('0x7e')]};}return respondWithRpcPromise(_0xedba('0xc1'),_0xedba('0xc0'),{'account':_0x4bc031});}})['then'](respondWithResult(_0x264f1d,null))[_0xedba('0x2f')](handleError(_0x264f1d,null));};exports[_0xedba('0x3c')]=function(_0xc14975,_0x42d2e6){return db[_0xedba('0x46')]['find']({'where':{'id':_0xc14975[_0xedba('0x62')]['id']}})['then'](handleEntityNotFound(_0x42d2e6,null))['then'](function(_0x140a9b){if(_0x140a9b&&_0x140a9b[_0xedba('0x7b')]){throw new db[(_0xedba('0xc2'))]['ValidationError'](_0xedba('0xc3'));}return _0x140a9b;})['then'](removeEntity(_0x42d2e6,null))['catch'](handleError(_0x42d2e6,null));};exports[_0xedba('0xc4')]=function(_0x203456,_0x19eae9,_0x397fa4){return db['MailAccount'][_0xedba('0x60')]({'where':{'id':_0x203456[_0xedba('0x62')]['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x19eae9,null))['then'](function(_0x27fece){if(_0x27fece){return _0x27fece['addAgents'](_0x203456['body'][_0xedba('0x6c')],_[_0xedba('0x8e')](_0x203456['body'],[_0xedba('0x6c'),'id'])||{})['spread'](function(_0x1ba6af){for(var _0x186936=0x0;_0x186936<_0x203456['body'][_0xedba('0x6c')][_0xedba('0x50')];_0x186936+=0x1){socket['emit'](_0xedba('0xc5'),{'UserId':Number(_0x203456['body'][_0xedba('0x6c')][_0x186936]),'MailAccountId':Number(_0x203456[_0xedba('0x62')]['id'])});}return _0x1ba6af;});}})['then'](respondWithResult(_0x19eae9,null))[_0xedba('0x2f')](handleError(_0x19eae9,null));};exports[_0xedba('0xc6')]=function(_0x1d976b,_0x455eac,_0x96d309){return db[_0xedba('0x46')][_0xedba('0x60')]({'where':{'id':_0x1d976b['params']['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x455eac,null))[_0xedba('0x5c')](function(_0x24a75b){if(_0x24a75b){return _0x24a75b[_0xedba('0xc6')](_0x1d976b[_0xedba('0x51')][_0xedba('0x6c')])['then'](function(){if(_[_0xedba('0xc7')](_0x1d976b[_0xedba('0x51')][_0xedba('0x6c')])){for(var _0x465b2c=0x0;_0x465b2c<_0x1d976b[_0xedba('0x51')][_0xedba('0x6c')]['length'];_0x465b2c+=0x1){socket[_0xedba('0xc8')](_0xedba('0xc9'),{'UserId':Number(_0x1d976b[_0xedba('0x51')]['ids'][_0x465b2c]),'MailAccountId':Number(_0x1d976b[_0xedba('0x62')]['id'])});}}else{socket[_0xedba('0xc8')](_0xedba('0xc9'),{'UserId':Number(_0x1d976b[_0xedba('0x51')][_0xedba('0x6c')]),'MailAccountId':Number(_0x1d976b[_0xedba('0x62')]['id'])});}});}})[_0xedba('0x5c')](respondWithStatusCode(_0x455eac,null))[_0xedba('0x2f')](handleError(_0x455eac,null));};exports[_0xedba('0xca')]=function(_0x1e34a1,_0x3a94cc,_0x44f8b0){var _0x19c955={};var _0x2558f0={};var _0x571239;var _0x1da1ed;return db[_0xedba('0x46')][_0xedba('0x69')]({'where':{'id':_0x1e34a1['params']['id']}})[_0xedba('0x5c')](handleEntityNotFound(_0x3a94cc,null))[_0xedba('0x5c')](function(_0x1c8160){if(_0x1c8160){_0x571239=_0x1c8160;_0x2558f0[_0xedba('0x4d')]=_[_0xedba('0x4a')](db[_0xedba('0x92')][_0xedba('0x5f')]);_0x2558f0['query']=_[_0xedba('0x4a')](_0x1e34a1[_0xedba('0x51')]);_0x2558f0[_0xedba('0x4b')]=_['intersection'](_0x2558f0[_0xedba('0x4d')],_0x2558f0[_0xedba('0x51')]);_0x19c955[_0xedba('0x4f')]=_[_0xedba('0x4c')](_0x2558f0[_0xedba('0x4d')],qs[_0xedba('0x4e')](_0x1e34a1[_0xedba('0x51')]['fields']));_0x19c955[_0xedba('0x4f')]=_0x19c955['attributes'][_0xedba('0x50')]?_0x19c955[_0xedba('0x4f')]:_0x2558f0['model'];_0x19c955['order']=qs['sort'](_0x1e34a1[_0xedba('0x51')]['sort']);_0x19c955[_0xedba('0x56')]=qs['filters'](_[_0xedba('0x57')](_0x1e34a1[_0xedba('0x51')],_0x2558f0['filters']));if(_0x1e34a1['query'][_0xedba('0x58')]){_0x19c955[_0xedba('0x56')]=_[_0xedba('0x59')](_0x19c955[_0xedba('0x56')],{'$or':_[_0xedba('0x45')](_0x19c955[_0xedba('0x4f')],function(_0x1a9e14){var _0x318ec9={};_0x318ec9[_0x1a9e14]={'$like':'%'+_0x1e34a1[_0xedba('0x51')]['filter']+'%'};return _0x318ec9;})});}_0x19c955=_[_0xedba('0x59')]({},_0x19c955,_0x1e34a1['options']);return _0x571239['getAgents'](_0x19c955);}})[_0xedba('0x5c')](function(_0x59d48c){if(_0x59d48c){_0x1da1ed=_0x59d48c[_0xedba('0x50')];if(!_0x1e34a1[_0xedba('0x51')][_0xedba('0x52')](_0xedba('0x53'))){_0x19c955[_0xedba('0x36')]=qs['limit'](_0x1e34a1[_0xedba('0x51')]['limit']);_0x19c955[_0xedba('0x34')]=qs['offset'](_0x1e34a1[_0xedba('0x51')][_0xedba('0x34')]);}return _0x571239[_0xedba('0xca')](_0x19c955);}})['then'](function(_0x1b9037){if(_0x1b9037){return _0x1b9037?{'count':_0x1da1ed,'rows':_0x1b9037}:null;}})[_0xedba('0x5c')](respondWithResult(_0x3a94cc,null))[_0xedba('0x2f')](handleError(_0x3a94cc,null));}; \ No newline at end of file +var _0xdafa=['service','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','CmContact','Contact','Owner','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','send','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','CmList','List','updatedAt','from','attachments','join','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','get','MailAccounts','UserProfileResource','name','index','Imap','MailServerOut','Smtp','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','MailServerIn','Pause','MailAccount','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','description','cservice','user','password','pass','cpassword','authentication','host','port'];(function(_0x1d944d,_0x3b17a3){var _0x228a42=function(_0x490c52){while(--_0x490c52){_0x1d944d['push'](_0x1d944d['shift']());}};_0x228a42(++_0x3b17a3);}(_0xdafa,0x113));var _0xadaf=function(_0x322cd7,_0x158cad){_0x322cd7=_0x322cd7-0x0;var _0x16d5e1=_0xdafa[_0x322cd7];return _0x16d5e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xadaf('0x0'));var zipdir=require(_0xadaf('0x1'));var jsonpatch=require(_0xadaf('0x2'));var rp=require('request-promise');var moment=require(_0xadaf('0x3'));var BPromise=require(_0xadaf('0x4'));var Mustache=require(_0xadaf('0x5'));var util=require(_0xadaf('0x6'));var path=require(_0xadaf('0x7'));var sox=require(_0xadaf('0x8'));var csv=require(_0xadaf('0x9'));var ejs=require(_0xadaf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadaf('0xb'));var squel=require(_0xadaf('0xc'));var crypto=require(_0xadaf('0xd'));var jsforce=require(_0xadaf('0xe'));var deskjs=require(_0xadaf('0xf'));var toCsv=require(_0xadaf('0x9'));var querystring=require('querystring');var Papa=require(_0xadaf('0x10'));var htmlToText=require(_0xadaf('0x11'));var juice=require(_0xadaf('0x12'));var Redis=require(_0xadaf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xadaf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadaf('0x15'));var logger=require(_0xadaf('0x16'))(_0xadaf('0x17'));var utils=require('../../config/utils');var config=require(_0xadaf('0x18'));var licenseUtil=require(_0xadaf('0x19'));var db=require(_0xadaf('0x1a'))['db'];config[_0xadaf('0x1b')]=_[_0xadaf('0x1c')](config[_0xadaf('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xadaf('0x1d'))(new Redis(config[_0xadaf('0x1b')]));require('./mailAccount.socket')[_0xadaf('0x1e')](socket);var jayson=require(_0xadaf('0x1f'));var client=jayson[_0xadaf('0x20')]['http']({'port':0x232b});function respondWithRpcPromise(_0x3dbcdc,_0xf7112d,_0x533f6f,_0x53a0b5){return new BPromise(function(_0x6c857b,_0xbda776){var _0x29367c=_0x53a0b5||client;return _0x29367c[_0xadaf('0x21')](_0x3dbcdc,_0x533f6f)[_0xadaf('0x22')](function(_0x435358){logger[_0xadaf('0x23')](_0xadaf('0x24'),_0xf7112d,_0xadaf('0x25'));logger[_0xadaf('0x26')](_0xadaf('0x27'),_0xf7112d,_0xadaf('0x25'),JSON['stringify'](_0x435358));if(_0x435358[_0xadaf('0x28')]){if(_0x435358['error'][_0xadaf('0x29')]===0x1f4){logger[_0xadaf('0x28')]('MailAccount,\x20%s,\x20%s',_0xf7112d,_0x435358[_0xadaf('0x28')][_0xadaf('0x2a')]);return _0xbda776(_0x435358[_0xadaf('0x28')][_0xadaf('0x2a')]);}logger[_0xadaf('0x28')](_0xadaf('0x24'),_0xf7112d,_0x435358[_0xadaf('0x28')][_0xadaf('0x2a')]);return _0x6c857b(_0x435358[_0xadaf('0x28')][_0xadaf('0x2a')]);}else{logger[_0xadaf('0x23')](_0xadaf('0x24'),_0xf7112d,_0xadaf('0x25'));_0x6c857b(_0x435358[_0xadaf('0x2b')][_0xadaf('0x2a')]);}})[_0xadaf('0x2c')](function(_0x1fbad0){logger[_0xadaf('0x28')](_0xadaf('0x24'),_0xf7112d,_0x1fbad0);_0xbda776(_0x1fbad0);});});}function respondWithStatusCode(_0x45fde5,_0x4ed81e){_0x4ed81e=_0x4ed81e||0xcc;return function(_0x449c73){if(_0x449c73){return _0x45fde5[_0xadaf('0x2d')](_0x4ed81e);}return _0x45fde5[_0xadaf('0x2e')](_0x4ed81e)[_0xadaf('0x2f')]();};}function respondWithResult(_0x5719a1,_0x19948){_0x19948=_0x19948||0xc8;return function(_0xd4fa1a){if(_0xd4fa1a){return _0x5719a1[_0xadaf('0x2e')](_0x19948)[_0xadaf('0x30')](_0xd4fa1a);}};}function respondWithFilteredResult(_0xf14c7,_0x56ab14){return function(_0x4b9bc9){if(_0x4b9bc9){var _0x4487a5=typeof _0x56ab14[_0xadaf('0x31')]===_0xadaf('0x32')&&typeof _0x56ab14['limit']===_0xadaf('0x32');var _0x36422d=_0x4b9bc9[_0xadaf('0x33')];var _0x2082d3=_0x4487a5?0x0:_0x56ab14[_0xadaf('0x31')];var _0x2bd825=_0x4487a5?_0x4b9bc9[_0xadaf('0x33')]:_0x56ab14['offset']+_0x56ab14[_0xadaf('0x34')];var _0x483554;if(_0x2bd825>=_0x36422d){_0x2bd825=_0x36422d;_0x483554=0xc8;}else{_0x483554=0xce;}_0xf14c7['status'](_0x483554);return _0xf14c7[_0xadaf('0x35')](_0xadaf('0x36'),_0x2082d3+'-'+_0x2bd825+'/'+_0x36422d)[_0xadaf('0x30')](_0x4b9bc9);}return null;};}function patchUpdates(_0x4c29ac){return function(_0x5c29f2){try{jsonpatch['apply'](_0x5c29f2,_0x4c29ac,!![]);}catch(_0x1ef1f9){return BPromise[_0xadaf('0x37')](_0x1ef1f9);}return _0x5c29f2[_0xadaf('0x38')]();};}function saveUpdates(_0xb0122,_0x526d3a){return function(_0x1c3144){if(_0x1c3144){return _0x1c3144[_0xadaf('0x39')](_0xb0122)[_0xadaf('0x22')](function(_0xfaa263){return _0xfaa263;});}return null;};}function removeEntity(_0x5ea074,_0xd5e754){return function(_0x586a4a){if(_0x586a4a){return _0x586a4a[_0xadaf('0x3a')]()[_0xadaf('0x22')](function(){var _0x5a5ac3=_0x586a4a[_0xadaf('0x3b')]({'plain':!![]});var _0xe0db68=_0xadaf('0x3c');return db[_0xadaf('0x3d')][_0xadaf('0x3a')]({'where':{'type':_0xe0db68,'resourceId':_0x5a5ac3['id']}})[_0xadaf('0x22')](function(){return _0x586a4a;});})[_0xadaf('0x22')](function(){_0x5ea074[_0xadaf('0x2e')](0xcc)[_0xadaf('0x2f')]();});}};}function handleEntityNotFound(_0x44e663,_0x581b91){return function(_0x465ef4){if(!_0x465ef4){_0x44e663['sendStatus'](0x194);}return _0x465ef4;};}function handleError(_0x5c58f7,_0x5fab4b){_0x5fab4b=_0x5fab4b||0x1f4;return function(_0x5f005e){logger['error'](_0x5f005e['stack']);if(_0x5f005e[_0xadaf('0x3e')]){delete _0x5f005e['name'];}_0x5c58f7[_0xadaf('0x2e')](_0x5fab4b)['send'](_0x5f005e);};}exports[_0xadaf('0x3f')]=function(_0x533a45,_0x3ae7b6){var _0x88f5aa={'include':[{'model':db['MailServerIn'],'as':_0xadaf('0x40')},{'model':db[_0xadaf('0x41')],'as':_0xadaf('0x42')},{'model':db['Pause'],'as':_0xadaf('0x43')}]},_0xfdb4d3={},_0x5a6eb2={'count':0x0,'rows':[]};var _0x383a41=_['map'](db['MailAccount'][_0xadaf('0x44')],function(_0x54afdc){return{'name':_0x54afdc[_0xadaf('0x45')],'type':_0x54afdc[_0xadaf('0x46')][_0xadaf('0x47')]};});_0xfdb4d3[_0xadaf('0x48')]=_[_0xadaf('0x49')](_0x383a41,'name');_0xfdb4d3['query']=_[_0xadaf('0x4a')](_0x533a45[_0xadaf('0x4b')]);_0xfdb4d3['filters']=_['intersection'](_0xfdb4d3[_0xadaf('0x48')],_0xfdb4d3[_0xadaf('0x4b')]);_0x88f5aa[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0xfdb4d3['model'],qs[_0xadaf('0x4e')](_0x533a45[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x88f5aa[_0xadaf('0x4c')]=_0x88f5aa['attributes'][_0xadaf('0x4f')]?_0x88f5aa[_0xadaf('0x4c')]:_0xfdb4d3[_0xadaf('0x48')];if(!_0x533a45[_0xadaf('0x4b')][_0xadaf('0x50')](_0xadaf('0x51'))){_0x88f5aa['limit']=qs['limit'](_0x533a45[_0xadaf('0x4b')][_0xadaf('0x34')]);_0x88f5aa[_0xadaf('0x31')]=qs['offset'](_0x533a45[_0xadaf('0x4b')]['offset']);}_0x88f5aa[_0xadaf('0x52')]=qs['sort'](_0x533a45[_0xadaf('0x4b')][_0xadaf('0x53')]);_0x88f5aa[_0xadaf('0x54')]=qs[_0xadaf('0x55')](_[_0xadaf('0x56')](_0x533a45[_0xadaf('0x4b')],_0xfdb4d3[_0xadaf('0x55')]),_0x383a41);if(_0x533a45['query'][_0xadaf('0x57')]){_0x88f5aa[_0xadaf('0x54')]=_[_0xadaf('0x58')](_0x88f5aa['where'],{'$or':_['map'](_0x383a41,function(_0x12564d){if(_0x12564d[_0xadaf('0x46')]!==_0xadaf('0x59')){var _0x47caed={};_0x47caed[_0x12564d[_0xadaf('0x3e')]]={'$like':'%'+_0x533a45[_0xadaf('0x4b')][_0xadaf('0x57')]+'%'};return _0x47caed;}})});}_0x88f5aa=_['merge']({},_0x88f5aa,_0x533a45[_0xadaf('0x5a')]);var _0x15b5b5={'where':_0x88f5aa['where']};return db['MailAccount'][_0xadaf('0x33')](_0x15b5b5)[_0xadaf('0x22')](function(_0x1105e1){_0x5a6eb2[_0xadaf('0x33')]=_0x1105e1;if(_0x533a45['query'][_0xadaf('0x5b')]){_0x88f5aa[_0xadaf('0x5c')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x88f5aa);})[_0xadaf('0x22')](function(_0x4e9e52){_0x5a6eb2[_0xadaf('0x5d')]=_0x4e9e52;return _0x5a6eb2;})[_0xadaf('0x22')](respondWithFilteredResult(_0x3ae7b6,_0x88f5aa))['catch'](handleError(_0x3ae7b6,null));};exports['show']=function(_0x8d80a1,_0x4340ef){var _0x1cd0e7={'raw':![],'where':{'id':_0x8d80a1[_0xadaf('0x5e')]['id']},'include':[{'model':db[_0xadaf('0x5f')],'as':_0xadaf('0x40')},{'model':db['MailServerOut'],'as':_0xadaf('0x42')},{'model':db[_0xadaf('0x60')],'as':_0xadaf('0x43')}]},_0x268a12={};_0x268a12['model']=_[_0xadaf('0x4a')](db[_0xadaf('0x61')][_0xadaf('0x44')]);_0x268a12[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x8d80a1['query']);_0x268a12[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x268a12['model'],_0x268a12['query']);_0x1cd0e7[_0xadaf('0x4c')]=_['intersection'](_0x268a12[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x8d80a1[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x1cd0e7['attributes']=_0x1cd0e7[_0xadaf('0x4c')]['length']?_0x1cd0e7[_0xadaf('0x4c')]:_0x268a12[_0xadaf('0x48')];if(_0x8d80a1[_0xadaf('0x4b')][_0xadaf('0x5b')]){_0x1cd0e7[_0xadaf('0x5c')]=[{'all':!![]}];}_0x1cd0e7=_[_0xadaf('0x58')]({},_0x1cd0e7,_0x8d80a1[_0xadaf('0x5a')]);return db[_0xadaf('0x61')][_0xadaf('0x62')](_0x1cd0e7)[_0xadaf('0x22')](handleEntityNotFound(_0x4340ef,null))[_0xadaf('0x22')](respondWithResult(_0x4340ef,null))[_0xadaf('0x2c')](handleError(_0x4340ef,null));};exports['update']=function(_0x2a5012,_0x482601){if(_0x2a5012[_0xadaf('0x63')]['id']){delete _0x2a5012[_0xadaf('0x63')]['id'];}return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x2a5012[_0xadaf('0x5e')]['id']},'include':[{'model':db[_0xadaf('0x5f')],'as':_0xadaf('0x40')},{'model':db[_0xadaf('0x41')],'as':_0xadaf('0x42')},{'model':db[_0xadaf('0x60')],'as':_0xadaf('0x43')}]})[_0xadaf('0x22')](handleEntityNotFound(_0x482601,null))['then'](saveUpdates(_0x2a5012['body'],null))[_0xadaf('0x22')](function(_0x1ae2cc){if(_0x1ae2cc&&_0x2a5012['body']['Imap']){return db['MailServerIn'][_0xadaf('0x39')](_0x2a5012[_0xadaf('0x63')][_0xadaf('0x40')],{'where':{'MailAccountId':_0x1ae2cc['id']}})[_0xadaf('0x22')](function(){return _0x1ae2cc;});}return _0x1ae2cc;})[_0xadaf('0x22')](function(_0x3cf5f6){if(_0x3cf5f6&&_0x2a5012[_0xadaf('0x63')][_0xadaf('0x42')]){return db[_0xadaf('0x41')][_0xadaf('0x39')](_0x2a5012[_0xadaf('0x63')][_0xadaf('0x42')],{'where':{'MailAccountId':_0x3cf5f6['id']}})[_0xadaf('0x22')](function(){return _0x3cf5f6;});}return _0x3cf5f6;})['then'](respondWithResult(_0x482601,null))[_0xadaf('0x2c')](handleError(_0x482601,null));};exports[_0xadaf('0x64')]=function(_0x431b0f,_0x3091ca){return db[_0xadaf('0x61')][_0xadaf('0x64')]()[_0xadaf('0x22')](respondWithResult(_0x3091ca,null))[_0xadaf('0x2c')](handleError(_0x3091ca,null));};exports[_0xadaf('0x65')]=function(_0x87ad70,_0x20c52d,_0x430576){if(_0x87ad70[_0xadaf('0x63')]['id']){delete _0x87ad70[_0xadaf('0x63')]['id'];}return db[_0xadaf('0x61')]['find']({'where':{'id':_0x87ad70[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x20c52d,null))[_0xadaf('0x22')](function(_0x178b9a){if(_0x178b9a){_0x87ad70[_0xadaf('0x63')][_0xadaf('0x66')]=_0x178b9a['id'];return db[_0xadaf('0x67')][_0xadaf('0x68')](_0x87ad70['body']);}})[_0xadaf('0x22')](respondWithResult(_0x20c52d,null))[_0xadaf('0x2c')](handleError(_0x20c52d,null));};exports[_0xadaf('0x69')]=function(_0x36780d,_0x14c23e,_0x5d4991){var _0x2173ba={'raw':![],'where':{}};var _0x1f0b6b={};var _0x2a4f36={'count':0x0,'rows':[]};return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x36780d[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x14c23e,null))[_0xadaf('0x22')](function(_0x3b7a80){if(_0x3b7a80){_0x1f0b6b[_0xadaf('0x48')]=_[_0xadaf('0x4a')](db['Disposition']['rawAttributes']);_0x1f0b6b[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x36780d['query']);_0x1f0b6b['filters']=_[_0xadaf('0x4d')](_0x1f0b6b[_0xadaf('0x48')],_0x1f0b6b['query']);_0x2173ba[_0xadaf('0x4c')]=_['intersection'](_0x1f0b6b['model'],qs[_0xadaf('0x4e')](_0x36780d[_0xadaf('0x4b')]['fields']));_0x2173ba['attributes']=_0x2173ba[_0xadaf('0x4c')][_0xadaf('0x4f')]?_0x2173ba[_0xadaf('0x4c')]:_0x1f0b6b[_0xadaf('0x48')];if(!_0x36780d['query'][_0xadaf('0x50')]('nolimit')){_0x2173ba[_0xadaf('0x34')]=qs[_0xadaf('0x34')](_0x36780d[_0xadaf('0x4b')][_0xadaf('0x34')]);_0x2173ba['offset']=qs[_0xadaf('0x31')](_0x36780d[_0xadaf('0x4b')][_0xadaf('0x31')]);}_0x2173ba['order']=qs[_0xadaf('0x53')](_0x36780d['query']['sort']);_0x2173ba[_0xadaf('0x54')]=qs[_0xadaf('0x55')](_[_0xadaf('0x56')](_0x36780d[_0xadaf('0x4b')],_0x1f0b6b['filters']));_0x2173ba[_0xadaf('0x54')]['MailAccountId']=_0x3b7a80['id'];if(_0x36780d['query'][_0xadaf('0x57')]){_0x2173ba[_0xadaf('0x54')]=_[_0xadaf('0x58')](_0x2173ba[_0xadaf('0x54')],{'$or':_[_0xadaf('0x49')](_0x2173ba[_0xadaf('0x4c')],function(_0x28c32c){var _0x2469f6={};_0x2469f6[_0x28c32c]={'$like':'%'+_0x36780d[_0xadaf('0x4b')]['filter']+'%'};return _0x2469f6;})});}_0x2173ba=_[_0xadaf('0x58')]({},_0x2173ba,_0x36780d['options']);return db[_0xadaf('0x67')]['count']({'where':_0x2173ba[_0xadaf('0x54')]})[_0xadaf('0x22')](function(_0x12087a){_0x2a4f36['count']=_0x12087a;if(_0x36780d[_0xadaf('0x4b')][_0xadaf('0x5b')]){_0x2173ba['include']=[{'all':!![]}];}return db[_0xadaf('0x67')][_0xadaf('0x6b')](_0x2173ba);})[_0xadaf('0x22')](function(_0x29911a){_0x2a4f36[_0xadaf('0x5d')]=_0x29911a;return _0x2a4f36;});}})['then'](respondWithFilteredResult(_0x14c23e,_0x2173ba))['catch'](handleError(_0x14c23e,null));};exports[_0xadaf('0x6c')]=function(_0x507237,_0xcbdb51,_0x55be33){return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x507237[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0xcbdb51,null))[_0xadaf('0x22')](function(_0x5a3c6c){if(_0x5a3c6c){return _0x5a3c6c[_0xadaf('0x6c')](_0x507237[_0xadaf('0x4b')][_0xadaf('0x6d')]);}})[_0xadaf('0x22')](respondWithStatusCode(_0xcbdb51,null))['catch'](handleError(_0xcbdb51,null));};exports['addAnswer']=function(_0x51fd02,_0x2c43da,_0x491918){if(_0x51fd02[_0xadaf('0x63')]['id']){delete _0x51fd02[_0xadaf('0x63')]['id'];}return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x51fd02[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x2c43da,null))[_0xadaf('0x22')](function(_0x564e29){if(_0x564e29){_0x51fd02[_0xadaf('0x63')][_0xadaf('0x66')]=_0x564e29['id'];return db['CannedAnswer'][_0xadaf('0x68')](_0x51fd02[_0xadaf('0x63')]);}})[_0xadaf('0x22')](respondWithResult(_0x2c43da,null))[_0xadaf('0x2c')](handleError(_0x2c43da,null));};exports[_0xadaf('0x6e')]=function(_0x296351,_0x4569c0,_0x43d6c7){var _0x54c28a={'raw':![],'where':{}};var _0x2dc81e={};var _0x2c9605={'count':0x0,'rows':[]};return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x296351[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x4569c0,null))['then'](function(_0x153105){if(_0x153105){_0x2dc81e[_0xadaf('0x48')]=_['keys'](db[_0xadaf('0x6f')][_0xadaf('0x44')]);_0x2dc81e['query']=_[_0xadaf('0x4a')](_0x296351[_0xadaf('0x4b')]);_0x2dc81e['filters']=_['intersection'](_0x2dc81e[_0xadaf('0x48')],_0x2dc81e['query']);_0x54c28a[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0x2dc81e[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x296351[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x54c28a[_0xadaf('0x4c')]=_0x54c28a[_0xadaf('0x4c')][_0xadaf('0x4f')]?_0x54c28a['attributes']:_0x2dc81e[_0xadaf('0x48')];if(!_0x296351[_0xadaf('0x4b')][_0xadaf('0x50')](_0xadaf('0x51'))){_0x54c28a['limit']=qs['limit'](_0x296351[_0xadaf('0x4b')][_0xadaf('0x34')]);_0x54c28a['offset']=qs['offset'](_0x296351[_0xadaf('0x4b')][_0xadaf('0x31')]);}_0x54c28a[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x296351['query']['sort']);_0x54c28a['where']=qs[_0xadaf('0x55')](_[_0xadaf('0x56')](_0x296351['query'],_0x2dc81e[_0xadaf('0x55')]));_0x54c28a[_0xadaf('0x54')]['MailAccountId']=_0x153105['id'];if(_0x296351[_0xadaf('0x4b')]['filter']){_0x54c28a[_0xadaf('0x54')]=_['merge'](_0x54c28a[_0xadaf('0x54')],{'$or':_['map'](_0x54c28a[_0xadaf('0x4c')],function(_0x4514eb){var _0x302511={};_0x302511[_0x4514eb]={'$like':'%'+_0x296351[_0xadaf('0x4b')][_0xadaf('0x57')]+'%'};return _0x302511;})});}_0x54c28a=_[_0xadaf('0x58')]({},_0x54c28a,_0x296351[_0xadaf('0x5a')]);return db[_0xadaf('0x6f')]['count']({'where':_0x54c28a[_0xadaf('0x54')]})['then'](function(_0x191491){_0x2c9605[_0xadaf('0x33')]=_0x191491;if(_0x296351[_0xadaf('0x4b')][_0xadaf('0x5b')]){_0x54c28a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xadaf('0x6b')](_0x54c28a);})[_0xadaf('0x22')](function(_0x49d892){_0x2c9605[_0xadaf('0x5d')]=_0x49d892;return _0x2c9605;});}})[_0xadaf('0x22')](respondWithFilteredResult(_0x4569c0,_0x54c28a))['catch'](handleError(_0x4569c0,null));};exports[_0xadaf('0x70')]=function(_0x566640,_0x3922c0,_0x276c6f){return db['MailAccount']['find']({'where':{'id':_0x566640['params']['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x3922c0,null))[_0xadaf('0x22')](function(_0xf97b89){if(_0xf97b89){return _0xf97b89[_0xadaf('0x70')](_0x566640[_0xadaf('0x4b')][_0xadaf('0x6d')]);}})[_0xadaf('0x22')](respondWithStatusCode(_0x3922c0,null))['catch'](handleError(_0x3922c0,null));};exports[_0xadaf('0x68')]=function(_0x31651e,_0x20395f){var _0x145d17={'name':_0x31651e[_0xadaf('0x63')][_0xadaf('0x3e')],'key':_0x31651e[_0xadaf('0x63')][_0xadaf('0x47')],'email':_0x31651e[_0xadaf('0x63')][_0xadaf('0x71')],'ListId':_0x31651e[_0xadaf('0x63')][_0xadaf('0x72')],'active':!_[_0xadaf('0x73')](_0x31651e['body']['active'])?_0x31651e[_0xadaf('0x63')]['active']:!![],'description':_0x31651e[_0xadaf('0x63')][_0xadaf('0x74')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x31651e[_0xadaf('0x63')][_0xadaf('0x75')])){if(_0x31651e[_0xadaf('0x63')]['cauthentication']){_0x145d17['Imap'][_0xadaf('0x76')]=_0x145d17['Smtp'][_0xadaf('0x76')]=_0x31651e['body']['cuser'];_0x145d17[_0xadaf('0x40')][_0xadaf('0x77')]=_0x145d17[_0xadaf('0x42')][_0xadaf('0x78')]=_0x31651e['body'][_0xadaf('0x79')];}else{_0x145d17[_0xadaf('0x40')][_0xadaf('0x7a')]=_0x145d17[_0xadaf('0x42')][_0xadaf('0x7a')]=![];}_0x145d17['Imap'][_0xadaf('0x7b')]=_0x31651e['body'][_0xadaf('0x40')][_0xadaf('0x7b')];_0x145d17[_0xadaf('0x40')]['port']=_0x31651e[_0xadaf('0x63')]['Imap']['port'];_0x145d17[_0xadaf('0x42')][_0xadaf('0x7b')]=_0x31651e['body']['Smtp'][_0xadaf('0x7b')];_0x145d17[_0xadaf('0x42')]['port']=_0x31651e[_0xadaf('0x63')][_0xadaf('0x42')][_0xadaf('0x7c')];}else{_0x145d17[_0xadaf('0x40')][_0xadaf('0x7d')]=_0x145d17[_0xadaf('0x42')][_0xadaf('0x7d')]=_0x31651e[_0xadaf('0x63')][_0xadaf('0x75')];_0x145d17[_0xadaf('0x40')][_0xadaf('0x76')]=_0x145d17[_0xadaf('0x42')]['user']=_0x31651e['body'][_0xadaf('0x7e')];_0x145d17[_0xadaf('0x40')][_0xadaf('0x77')]=_0x145d17['Smtp'][_0xadaf('0x78')]=_0x31651e['body'][_0xadaf('0x79')];}return db[_0xadaf('0x61')][_0xadaf('0x68')](_0x145d17,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xadaf('0x5f')],'as':_0xadaf('0x40')}]})[_0xadaf('0x22')](function(_0x1efddc){var _0x2fa55a=_0x31651e[_0xadaf('0x76')][_0xadaf('0x3b')]({'plain':!![]});if(!_0x2fa55a)throw new Error(_0xadaf('0x7f'));if(_0x2fa55a[_0xadaf('0x80')]===_0xadaf('0x76')){var _0x4dec86=_0x1efddc['get']({'plain':!![]});return db[_0xadaf('0x81')][_0xadaf('0x62')]({'where':{'name':_0xadaf('0x3c'),'userProfileId':_0x2fa55a['userProfileId']},'raw':!![]})[_0xadaf('0x22')](function(_0x10e2e7){if(_0x10e2e7&&_0x10e2e7[_0xadaf('0x82')]===0x0){return db[_0xadaf('0x3d')][_0xadaf('0x68')]({'name':_0x4dec86[_0xadaf('0x3e')],'resourceId':_0x4dec86['id'],'type':_0x10e2e7[_0xadaf('0x3e')],'sectionId':_0x10e2e7['id']},{})[_0xadaf('0x22')](function(){return _0x1efddc;});}else{return _0x1efddc;}})[_0xadaf('0x2c')](function(_0x1e39c3){logger[_0xadaf('0x28')](_0xadaf('0x83'),_0x1e39c3);throw _0x1e39c3;});}return _0x1efddc;})[_0xadaf('0x22')](respondWithResult(_0x20395f,0xc9))[_0xadaf('0x2c')](handleError(_0x20395f,null));};exports[_0xadaf('0x84')]=function(_0x4106d5,_0x3f1bf1,_0x4e16a0){return db[_0xadaf('0x61')]['findOne']({'where':{'id':_0x4106d5[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x3f1bf1,null))['then'](function(_0x46d300){if(_0x46d300){return _0x46d300[_0xadaf('0x84')]();}return null;})[_0xadaf('0x22')](respondWithResult(_0x3f1bf1,null))[_0xadaf('0x2c')](handleError(_0x3f1bf1,null));};exports['addImap']=function(_0x3ed8e7,_0x123bca,_0x53a338){if(_0x3ed8e7['body']['id']){delete _0x3ed8e7[_0xadaf('0x63')]['id'];}return db['MailAccount'][_0xadaf('0x62')]({'where':{'id':_0x3ed8e7[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x123bca,null))[_0xadaf('0x22')](function(_0x28a4ef){if(_0x28a4ef){_0x3ed8e7[_0xadaf('0x63')]['MailAccountId']=_0x28a4ef['id'];return db[_0xadaf('0x5f')][_0xadaf('0x68')](_0x3ed8e7[_0xadaf('0x63')]);}})['then'](respondWithResult(_0x123bca,null))['catch'](handleError(_0x123bca,null));};exports[_0xadaf('0x85')]=function(_0x366590,_0x48b18d,_0x59ec81){return db['MailAccount']['findOne']({'where':{'id':_0x366590[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x48b18d,null))[_0xadaf('0x22')](function(_0x22797e){if(_0x22797e){return _0x22797e[_0xadaf('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x48b18d,null))[_0xadaf('0x2c')](handleError(_0x48b18d,null));};exports[_0xadaf('0x87')]=function(_0x587894,_0x2ff512,_0x1c9e0a){return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x587894[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x2ff512,null))[_0xadaf('0x22')](function(_0x3af117){if(_0x3af117){return _0x3af117[_0xadaf('0x87')]();}return null;})[_0xadaf('0x22')](respondWithResult(_0x2ff512,null))[_0xadaf('0x2c')](handleError(_0x2ff512,null));};exports[_0xadaf('0x88')]=function(_0x414b55,_0x5aca38,_0xb0c062){if(_0x414b55[_0xadaf('0x63')]['id']){delete _0x414b55['body']['id'];}return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x414b55['params']['id']}})['then'](handleEntityNotFound(_0x5aca38,null))[_0xadaf('0x22')](function(_0x2eec6a){if(_0x2eec6a){_0x414b55[_0xadaf('0x63')][_0xadaf('0x66')]=_0x2eec6a['id'];return db[_0xadaf('0x41')][_0xadaf('0x68')](_0x414b55[_0xadaf('0x63')]);}})[_0xadaf('0x22')](respondWithResult(_0x5aca38,null))['catch'](handleError(_0x5aca38,null));};exports[_0xadaf('0x89')]=function(_0x4d4a43,_0x450bc7,_0x2cbb70){return db['MailAccount'][_0xadaf('0x6a')]({'where':{'id':_0x4d4a43['params']['id']}})['then'](handleEntityNotFound(_0x450bc7,null))['then'](function(_0x1dc978){if(_0x1dc978){return _0x1dc978[_0xadaf('0x8a')](null);}return null;})[_0xadaf('0x22')](respondWithStatusCode(_0x450bc7,null))[_0xadaf('0x2c')](handleError(_0x450bc7,null));};exports['addInteraction']=function(_0x5d8cea,_0x547fa6,_0x3f0fea){return db[_0xadaf('0x8b')]['find']({'where':{'id':_0x5d8cea[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x547fa6,null))[_0xadaf('0x22')](function(_0x34f40b){if(_0x34f40b){return _0x34f40b[_0xadaf('0x8c')](_0x5d8cea[_0xadaf('0x63')][_0xadaf('0x6d')],_['omit'](_0x5d8cea[_0xadaf('0x63')],[_0xadaf('0x6d'),'id'])||{});}})[_0xadaf('0x22')](respondWithResult(_0x547fa6,null))['catch'](handleError(_0x547fa6,null));};exports['getInteractions']=function(_0x59c84e,_0x36a68b,_0x1c59a0){var _0x525e05={'raw':![],'where':{}};var _0x2dd3d5={};var _0x1bf4c3={'count':0x0,'rows':[]};return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x59c84e[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x36a68b,null))['then'](function(_0x3c2318){if(_0x3c2318){_0x2dd3d5['model']=_[_0xadaf('0x4a')](db[_0xadaf('0x8b')][_0xadaf('0x44')]);_0x2dd3d5[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x59c84e['query']);_0x2dd3d5[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x2dd3d5[_0xadaf('0x48')],_0x2dd3d5['query']);_0x525e05['attributes']=_[_0xadaf('0x4d')](_0x2dd3d5[_0xadaf('0x48')],qs['fields'](_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x525e05['attributes']=_0x525e05['attributes'][_0xadaf('0x4f')]?_0x525e05[_0xadaf('0x4c')]:_0x2dd3d5[_0xadaf('0x48')];if(!_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x50')]('nolimit')){_0x525e05[_0xadaf('0x34')]=qs[_0xadaf('0x34')](_0x59c84e['query'][_0xadaf('0x34')]);_0x525e05[_0xadaf('0x31')]=qs[_0xadaf('0x31')](_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x31')]);}_0x525e05[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x53')]);_0x525e05['where']=qs[_0xadaf('0x55')](_['pick'](_0x59c84e[_0xadaf('0x4b')],_0x2dd3d5[_0xadaf('0x55')]));_0x525e05[_0xadaf('0x54')][_0xadaf('0x66')]=_0x3c2318['id'];if(_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x57')]){_0x525e05[_0xadaf('0x54')]=_['merge'](_0x525e05[_0xadaf('0x54')],{'$or':_[_0xadaf('0x49')](_0x525e05[_0xadaf('0x4c')],function(_0x30c4f8){var _0x244040={};_0x244040[_0x30c4f8]={'$like':'%'+_0x59c84e[_0xadaf('0x4b')]['filter']+'%'};return _0x244040;})});}_0x525e05=_[_0xadaf('0x58')]({},_0x525e05,_0x59c84e['options']);return db[_0xadaf('0x8b')][_0xadaf('0x33')]({'where':_0x525e05[_0xadaf('0x54')]})['then'](function(_0x1ca76d){_0x1bf4c3[_0xadaf('0x33')]=_0x1ca76d;if(_0x59c84e['query'][_0xadaf('0x5b')]){_0x525e05[_0xadaf('0x5c')]=[{'model':db[_0xadaf('0x8d')],'as':_0xadaf('0x8e'),'required':![]},{'model':db['User'],'as':_0xadaf('0x8f'),'attributes':[_0xadaf('0x3e'),'fullname','internal'],'required':![]},{'model':db[_0xadaf('0x90')],'as':_0xadaf('0x91'),'attributes':['id',_0xadaf('0x3e'),_0xadaf('0x92')],'where':_0x59c84e['query']['tag']?{'id':_0x59c84e['query'][_0xadaf('0x93')]}:undefined,'required':_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x93')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x525e05);})[_0xadaf('0x22')](function(_0x20acc7){_0x1bf4c3[_0xadaf('0x5d')]=_0x20acc7;return _0x1bf4c3;});}})[_0xadaf('0x22')](respondWithFilteredResult(_0x36a68b,_0x525e05))['catch'](handleError(_0x36a68b,null));};exports[_0xadaf('0x94')]=function addApplications(_0x5e0415,_0x36a380){var _0x4c7db2=_0x5e0415[_0xadaf('0x5e')]['id'];var _0x55189b=_0x5e0415[_0xadaf('0x63')];var _0x25bc81=0xc8;var _0x5355f5=null;return db[_0xadaf('0x95')][_0xadaf('0x96')]({'isolationLevel':db['sequelize'][_0xadaf('0x97')][_0xadaf('0x98')][_0xadaf('0x99')]},function(_0x1dec0d){return db['MailAccount'][_0xadaf('0x6a')]({'where':{'id':_0x4c7db2},'transaction':_0x1dec0d})[_0xadaf('0x22')](function(_0x5755b5){if(_0x5755b5){return db['MailApplication'][_0xadaf('0x3a')]({'where':{'MailAccountId':_0x4c7db2},'transaction':_0x1dec0d})[_0xadaf('0x22')](function(){var _0x295c82=_['map'](_0x55189b,function(_0x5d2e44){_0x5d2e44[_0xadaf('0x66')]=_0x4c7db2;return _0x5d2e44;});return db['MailApplication'][_0xadaf('0x9a')](_0x295c82,{'transaction':_0x1dec0d});});}else{_0x25bc81=0x194;_0x5355f5=[];}});})[_0xadaf('0x22')](function(){if(_0x25bc81!==0x194){return db['MailApplication'][_0xadaf('0x9b')]({'where':{'MailAccountId':_0x4c7db2},'order':'priority'})['then'](function(_0x183d68){_0x5355f5=_0x183d68;});}})['catch'](function(_0x5e9b95){_0x25bc81=0x1f4;logger[_0xadaf('0x28')](_0x5e9b95[_0xadaf('0x9c')]);if(_0x5e9b95[_0xadaf('0x3e')]){delete _0x5e9b95[_0xadaf('0x3e')];}_0x5355f5=_0x5e9b95;})[_0xadaf('0x9d')](function(){if(_0x5355f5===null){_0x36a380['sendStatus'](_0x25bc81);}else{if(_0x25bc81===0x1f4){_0x36a380['status'](_0x25bc81)[_0xadaf('0x9e')](_0x5355f5);}else{_0x36a380[_0xadaf('0x2e')](_0x25bc81)['json'](_0x5355f5);}}});};exports[_0xadaf('0x9f')]=function(_0x525229,_0x113c03,_0x1f44c5){var _0x59e5f3={};var _0x569b2d={};var _0x4cb5bf;var _0x15df44;return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x525229['params']['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x113c03,null))['then'](function(_0xec62ba){if(_0xec62ba){_0x4cb5bf=_0xec62ba;_0x569b2d[_0xadaf('0x48')]=_[_0xadaf('0x4a')](db['MailApplication'][_0xadaf('0x44')]);_0x569b2d['query']=_[_0xadaf('0x4a')](_0x525229[_0xadaf('0x4b')]);_0x569b2d[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x569b2d[_0xadaf('0x48')],_0x569b2d[_0xadaf('0x4b')]);_0x59e5f3[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0x569b2d[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x525229[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x59e5f3['attributes']=_0x59e5f3[_0xadaf('0x4c')][_0xadaf('0x4f')]?_0x59e5f3[_0xadaf('0x4c')]:_0x569b2d[_0xadaf('0x48')];_0x59e5f3[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x525229[_0xadaf('0x4b')]['sort']);_0x59e5f3[_0xadaf('0x54')]=qs[_0xadaf('0x55')](_[_0xadaf('0x56')](_0x525229[_0xadaf('0x4b')],_0x569b2d['filters']));if(_0x525229[_0xadaf('0x4b')][_0xadaf('0x57')]){_0x59e5f3['where']=_[_0xadaf('0x58')](_0x59e5f3[_0xadaf('0x54')],{'$or':_[_0xadaf('0x49')](_0x59e5f3[_0xadaf('0x4c')],function(_0x241b5d){var _0x4c5490={};_0x4c5490[_0x241b5d]={'$like':'%'+_0x525229['query'][_0xadaf('0x57')]+'%'};return _0x4c5490;})});}_0x59e5f3=_[_0xadaf('0x58')]({},_0x59e5f3,_0x525229[_0xadaf('0x5a')]);return _0x4cb5bf[_0xadaf('0x9f')](_0x59e5f3);}})['then'](function(_0x1f9e18){if(_0x1f9e18){_0x15df44=_0x1f9e18[_0xadaf('0x4f')];if(!_0x525229['query']['hasOwnProperty'](_0xadaf('0x51'))){_0x59e5f3[_0xadaf('0x34')]=qs['limit'](_0x525229['query']['limit']);_0x59e5f3['offset']=qs['offset'](_0x525229['query'][_0xadaf('0x31')]);}return _0x4cb5bf[_0xadaf('0x9f')](_0x59e5f3);}})['then'](function(_0x575540){if(_0x575540){return _0x575540?{'count':_0x15df44,'rows':_0x575540}:null;}})[_0xadaf('0x22')](respondWithResult(_0x113c03,null))[_0xadaf('0x2c')](handleError(_0x113c03,null));};exports[_0xadaf('0xa0')]=function(_0x4b3300,_0x4bea6d,_0x253393){var _0x3cb00e={'raw':!![],'where':{}};var _0x36d623={};var _0x3a0353={'count':0x0,'rows':[]};return db['MailAccount'][_0xadaf('0x6a')]({'where':{'id':_0x4b3300[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x4bea6d,null))[_0xadaf('0x22')](function(_0x534c10){if(_0x534c10){_0x36d623['model']=_[_0xadaf('0x4a')](db[_0xadaf('0xa1')][_0xadaf('0x44')]);_0x36d623[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x4b3300['query']);_0x36d623[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x36d623[_0xadaf('0x48')],_0x36d623[_0xadaf('0x4b')]);_0x3cb00e[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0x36d623[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x3cb00e[_0xadaf('0x4c')]=_0x3cb00e[_0xadaf('0x4c')]['length']?_0x3cb00e[_0xadaf('0x4c')]:_0x36d623[_0xadaf('0x48')];if(!_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x50')](_0xadaf('0x51'))){_0x3cb00e[_0xadaf('0x34')]=qs[_0xadaf('0x34')](_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x34')]);_0x3cb00e[_0xadaf('0x31')]=qs[_0xadaf('0x31')](_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x31')]);}_0x3cb00e[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x4b3300['query'][_0xadaf('0x53')]);_0x3cb00e[_0xadaf('0x54')]=qs['filters'](_['pick'](_0x4b3300[_0xadaf('0x4b')],_0x36d623[_0xadaf('0x55')]));_0x3cb00e[_0xadaf('0x54')]['MailAccountId']=_0x534c10['id'];if(_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x57')]){_0x3cb00e['where']=_[_0xadaf('0x58')](_0x3cb00e[_0xadaf('0x54')],{'$or':_['map'](_0x3cb00e[_0xadaf('0x4c')],function(_0x402938){var _0x146108={};_0x146108[_0x402938]={'$like':'%'+_0x4b3300[_0xadaf('0x4b')]['filter']+'%'};return _0x146108;})});}if(_0x4b3300[_0xadaf('0x4b')][_0xadaf('0xa2')]){var _0x223dd3=_0x4b3300[_0xadaf('0x4b')][_0xadaf('0xa2')]['split'](',');var _0x1dca48={};_0x1dca48[_0x223dd3[0x0]]={'$gte':moment(_0x223dd3[0x1])[_0xadaf('0xa3')](_0xadaf('0xa4'))};_0x3cb00e[_0xadaf('0x54')]=_[_0xadaf('0x58')](_0x3cb00e[_0xadaf('0x54')],_0x1dca48);}_0x3cb00e=_[_0xadaf('0x58')]({},_0x3cb00e,_0x4b3300['options']);return db[_0xadaf('0xa1')][_0xadaf('0x33')]({'where':_0x3cb00e['where']})[_0xadaf('0x22')](function(_0x5eb450){_0x3a0353[_0xadaf('0x33')]=_0x5eb450;if(_0x4b3300['query'][_0xadaf('0x5b')]){_0x3cb00e[_0xadaf('0x5c')]=[{'all':!![]}];}return db[_0xadaf('0xa1')][_0xadaf('0x6b')](_0x3cb00e);})[_0xadaf('0x22')](function(_0xc4d15){if(_0x4b3300['query'][_0xadaf('0xa5')]==='true'){for(var _0x8a5526=0x0;_0x8a5526<_0xc4d15[_0xadaf('0x4f')];_0x8a5526++){_0xc4d15[_0x8a5526][_0xadaf('0x63')]=juice(_0xc4d15[_0x8a5526][_0xadaf('0x63')]);}}_0x3a0353[_0xadaf('0x5d')]=_0xc4d15;return _0x3a0353;});}})[_0xadaf('0x22')](respondWithFilteredResult(_0x4bea6d,_0x3cb00e))[_0xadaf('0x2c')](handleError(_0x4bea6d,null));};exports[_0xadaf('0x9e')]=function(_0x1eb081,_0x4945f5,_0x4c8def){var _0x2630e3,_0x3ce88e={},_0x3eb5f3;if(_0x1eb081['body']['to']){_0x3eb5f3=_0x1eb081['body']['to'][_0xadaf('0xa6')](',')[0x0];}return db[_0xadaf('0x61')]['find']({'where':{'id':_0x1eb081[_0xadaf('0x5e')]['id']},'include':[{'model':db[_0xadaf('0xa7')],'as':_0xadaf('0xa8'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x3eb5f3},'limit':0x1,'order':[[_0xadaf('0xa9'),'DESC']]}]},{'model':db[_0xadaf('0x41')],'as':_0xadaf('0x42'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4945f5,null))[_0xadaf('0x22')](function(_0xef9aab){if(_0xef9aab){_0x2630e3=_0xef9aab;if(_0xef9aab['Smtp']){if(_['isNil'](_0x1eb081['body'][_0xadaf('0xaa')])){_0x1eb081[_0xadaf('0x63')][_0xadaf('0xaa')]=util[_0xadaf('0xa3')]('%s\x20<%s>',_0xef9aab['name'],_0xef9aab[_0xadaf('0x71')]||_0xef9aab[_0xadaf('0x42')]['user']);}if(_0x1eb081[_0xadaf('0x63')]['attachments']&&_0x1eb081[_0xadaf('0x63')]['attachments'][_0xadaf('0x4f')]){for(var _0xd9dcc1=0x0;_0xd9dcc1<_0x1eb081[_0xadaf('0x63')][_0xadaf('0xab')]['length'];_0xd9dcc1+=0x1){_0x1eb081[_0xadaf('0x63')][_0xadaf('0xab')][_0xd9dcc1]={'filename':_0x1eb081[_0xadaf('0x63')][_0xadaf('0xab')][_0xd9dcc1][_0xadaf('0x3e')],'path':path[_0xadaf('0xac')](config['root'],_0xadaf('0xad'),_0x1eb081[_0xadaf('0x63')][_0xadaf('0xab')][_0xd9dcc1][_0xadaf('0xae')])};}}var _0x5184a2={'tls':{'rejectUnauthorized':![]}};if(_[_0xadaf('0x73')](_0xef9aab[_0xadaf('0x42')][_0xadaf('0x7d')])){if(_0xef9aab[_0xadaf('0x42')][_0xadaf('0x7a')]){_0x5184a2[_0xadaf('0xaf')]={'user':_0xef9aab[_0xadaf('0x42')][_0xadaf('0x76')],'pass':_0xef9aab['Smtp'][_0xadaf('0x78')]};}_0x5184a2[_0xadaf('0x7b')]=_0xef9aab[_0xadaf('0x42')]['host'];_0x5184a2[_0xadaf('0x7c')]=_0xef9aab['Smtp'][_0xadaf('0x7c')];_0x5184a2['secure']=_0xef9aab[_0xadaf('0x42')][_0xadaf('0xb0')];}else{_0x5184a2[_0xadaf('0x7d')]=_0xef9aab[_0xadaf('0x42')][_0xadaf('0x7d')];_0x5184a2[_0xadaf('0xaf')]={'user':_0xef9aab[_0xadaf('0x42')][_0xadaf('0x76')],'pass':_0xef9aab[_0xadaf('0x42')]['pass']};}return respondWithRpcPromise(_0xadaf('0xb1'),'sendMail',{'account':_0x5184a2,'message':_0x1eb081[_0xadaf('0x63')]});}else{throw new Error(_0xadaf('0xb2'));}}})['then'](function(_0x3afd11){if(_0x3afd11){_0x3ce88e=_0x3afd11;if(_0x2630e3[_0xadaf('0xa8')]){if(_0x2630e3[_0xadaf('0xa8')][_0xadaf('0xb3')][_0xadaf('0x4f')]){return _0x2630e3[_0xadaf('0xa8')][_0xadaf('0xb3')][0x0];}else{return db['CmContact'][_0xadaf('0x68')](_[_0xadaf('0x1c')](_0x1eb081[_0xadaf('0x63')],{'firstName':_0x1eb081[_0xadaf('0x63')]['to'],'email':_0x1eb081[_0xadaf('0x63')]['to'],'phone':_0x1eb081[_0xadaf('0x63')]['to'],'ListId':_0x2630e3[_0xadaf('0x72')]}));}}else{throw new Error(_0xadaf('0xb2'));}}})[_0xadaf('0x22')](function(_0x12a1a0){if(_0x12a1a0){var _0x4bb5e1={'UserId':_0x1eb081[_0xadaf('0x76')]['id'],'ContactId':_0x12a1a0['id'],'MailAccountId':_0x2630e3['id'],'inReplyTo':_0x3ce88e[_0xadaf('0xb4')],'to':_0x1eb081['body']['from'],'cc':_0x1eb081[_0xadaf('0x63')]['cc'],'subject':_0x1eb081['body'][_0xadaf('0xb5')],'attach':_0x1eb081[_0xadaf('0x63')][_0xadaf('0xb6')],'firstMsgDirection':_0xadaf('0xb7'),'lastMsgAt':moment()[_0xadaf('0xa3')](_0xadaf('0xa4')),'lastMsgDirection':_0xadaf('0xb7'),'Messages':[_[_0xadaf('0x58')](_0x1eb081['body'],{'messageId':_0x3ce88e['messageId'],'sentAt':moment()[_0xadaf('0xa3')](_0xadaf('0xa4')),'read':!![],'MailAccountId':_0x2630e3['id'],'UserId':_0x1eb081[_0xadaf('0x76')]['id'],'ContactId':_0x12a1a0['id']})]};if(_0x1eb081[_0xadaf('0x63')][_0xadaf('0xb8')]){_0x4bb5e1=_[_0xadaf('0x58')](_0x4bb5e1,_0x1eb081[_0xadaf('0x63')][_0xadaf('0xb8')]);}return db[_0xadaf('0x8b')][_0xadaf('0x68')](_0x4bb5e1,{'include':[{'model':db[_0xadaf('0xa1')],'as':_0xadaf('0xb9')}]});}})[_0xadaf('0x22')](respondWithResult(_0x4945f5,null))[_0xadaf('0x2c')](handleError(_0x4945f5,null));};exports['verifySmtp']=function(_0x5ec99d,_0x59fd1b,_0x2ab7b3){return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x5ec99d['params']['id']},'include':[{'model':db[_0xadaf('0x41')],'as':_0xadaf('0x42'),'raw':!![]}]})[_0xadaf('0x22')](handleEntityNotFound(_0x59fd1b,null))[_0xadaf('0x22')](function(_0x365b68){if(_0x365b68&&_0x365b68[_0xadaf('0x42')]){var _0x50a033={'id':_0x365b68['id'],'tls':{'rejectUnauthorized':![]}};if(_0x365b68[_0xadaf('0x42')][_0xadaf('0x7d')]){_0x50a033['service']=_0x365b68['Smtp'][_0xadaf('0x7d')];}else{_0x50a033[_0xadaf('0x7b')]=_0x365b68['Smtp']['host'];_0x50a033[_0xadaf('0x7c')]=_0x365b68['Smtp'][_0xadaf('0x7c')];_0x50a033[_0xadaf('0xb0')]=_0x365b68[_0xadaf('0x42')][_0xadaf('0xb0')];}if(_0x365b68[_0xadaf('0x42')][_0xadaf('0x7a')]){_0x50a033['auth']={'user':_0x365b68[_0xadaf('0x42')][_0xadaf('0x76')],'pass':_0x365b68['Smtp'][_0xadaf('0x78')]};}return respondWithRpcPromise(_0xadaf('0xba'),_0xadaf('0xbb'),{'account':_0x50a033});}})[_0xadaf('0x22')](respondWithResult(_0x59fd1b,null))[_0xadaf('0x2c')](handleError(_0x59fd1b,null));};exports[_0xadaf('0x3a')]=function(_0x4ad755,_0x2c3960){return db['MailAccount']['find']({'where':{'id':_0x4ad755[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x2c3960,null))[_0xadaf('0x22')](function(_0x548532){if(_0x548532&&_0x548532[_0xadaf('0x7d')]){throw new db[(_0xadaf('0xbc'))]['ValidationError'](_0xadaf('0xbd'));}return _0x548532;})[_0xadaf('0x22')](removeEntity(_0x2c3960,null))[_0xadaf('0x2c')](handleError(_0x2c3960,null));};exports[_0xadaf('0xbe')]=function(_0xc349db,_0x18cd68,_0xf77f69){return db['MailAccount'][_0xadaf('0x62')]({'where':{'id':_0xc349db[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x18cd68,null))[_0xadaf('0x22')](function(_0x1054a3){if(_0x1054a3){return _0x1054a3[_0xadaf('0xbe')](_0xc349db[_0xadaf('0x63')][_0xadaf('0x6d')],_[_0xadaf('0xbf')](_0xc349db['body'],[_0xadaf('0x6d'),'id'])||{})[_0xadaf('0xc0')](function(_0x6f52f5){for(var _0x4f93b8=0x0;_0x4f93b8<_0xc349db[_0xadaf('0x63')][_0xadaf('0x6d')][_0xadaf('0x4f')];_0x4f93b8+=0x1){socket[_0xadaf('0xc1')](_0xadaf('0xc2'),{'UserId':Number(_0xc349db[_0xadaf('0x63')]['ids'][_0x4f93b8]),'MailAccountId':Number(_0xc349db['params']['id'])});}return _0x6f52f5;});}})['then'](respondWithResult(_0x18cd68,null))[_0xadaf('0x2c')](handleError(_0x18cd68,null));};exports[_0xadaf('0xc3')]=function(_0x5e21a3,_0x2d5341,_0x32fa08){return db['MailAccount'][_0xadaf('0x62')]({'where':{'id':_0x5e21a3[_0xadaf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2d5341,null))[_0xadaf('0x22')](function(_0xad8e21){if(_0xad8e21){return _0xad8e21[_0xadaf('0xc3')](_0x5e21a3['query']['ids'])[_0xadaf('0x22')](function(){if(_[_0xadaf('0xc4')](_0x5e21a3[_0xadaf('0x4b')][_0xadaf('0x6d')])){for(var _0x1b2a44=0x0;_0x1b2a44<_0x5e21a3[_0xadaf('0x4b')][_0xadaf('0x6d')][_0xadaf('0x4f')];_0x1b2a44+=0x1){socket[_0xadaf('0xc1')](_0xadaf('0xc5'),{'UserId':Number(_0x5e21a3[_0xadaf('0x4b')]['ids'][_0x1b2a44]),'MailAccountId':Number(_0x5e21a3[_0xadaf('0x5e')]['id'])});}}else{socket[_0xadaf('0xc1')](_0xadaf('0xc5'),{'UserId':Number(_0x5e21a3[_0xadaf('0x4b')]['ids']),'MailAccountId':Number(_0x5e21a3['params']['id'])});}});}})[_0xadaf('0x22')](respondWithStatusCode(_0x2d5341,null))[_0xadaf('0x2c')](handleError(_0x2d5341,null));};exports['getAgents']=function(_0x211eda,_0xc14bb6,_0xfec3aa){var _0x3690be={};var _0x12216c={};var _0x16de13;var _0x5b134c;return db['MailAccount'][_0xadaf('0x6a')]({'where':{'id':_0x211eda['params']['id']}})['then'](handleEntityNotFound(_0xc14bb6,null))[_0xadaf('0x22')](function(_0x1db89a){if(_0x1db89a){_0x16de13=_0x1db89a;_0x12216c[_0xadaf('0x48')]=_['keys'](db[_0xadaf('0xc6')]['rawAttributes']);_0x12216c[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x211eda['query']);_0x12216c[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x12216c[_0xadaf('0x48')],_0x12216c[_0xadaf('0x4b')]);_0x3690be[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0x12216c[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x211eda['query'][_0xadaf('0x4e')]));_0x3690be[_0xadaf('0x4c')]=_0x3690be[_0xadaf('0x4c')]['length']?_0x3690be[_0xadaf('0x4c')]:_0x12216c[_0xadaf('0x48')];_0x3690be[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x211eda['query'][_0xadaf('0x53')]);_0x3690be[_0xadaf('0x54')]=qs['filters'](_[_0xadaf('0x56')](_0x211eda[_0xadaf('0x4b')],_0x12216c['filters']));if(_0x211eda['query'][_0xadaf('0x57')]){_0x3690be['where']=_[_0xadaf('0x58')](_0x3690be['where'],{'$or':_[_0xadaf('0x49')](_0x3690be['attributes'],function(_0x12730d){var _0xd877e8={};_0xd877e8[_0x12730d]={'$like':'%'+_0x211eda[_0xadaf('0x4b')][_0xadaf('0x57')]+'%'};return _0xd877e8;})});}_0x3690be=_['merge']({},_0x3690be,_0x211eda['options']);return _0x16de13['getAgents'](_0x3690be);}})['then'](function(_0x59cf5f){if(_0x59cf5f){_0x5b134c=_0x59cf5f[_0xadaf('0x4f')];if(!_0x211eda['query'][_0xadaf('0x50')](_0xadaf('0x51'))){_0x3690be[_0xadaf('0x34')]=qs[_0xadaf('0x34')](_0x211eda[_0xadaf('0x4b')]['limit']);_0x3690be['offset']=qs[_0xadaf('0x31')](_0x211eda[_0xadaf('0x4b')]['offset']);}return _0x16de13[_0xadaf('0xc7')](_0x3690be);}})['then'](function(_0x3e4526){if(_0x3e4526){return _0x3e4526?{'count':_0x5b134c,'rows':_0x3e4526}:null;}})[_0xadaf('0x22')](respondWithResult(_0xc14bb6,null))['catch'](handleError(_0xc14bb6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 38509a0..a02c620 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 _0xf1d6=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x567b18,_0x478751){var _0x4a2e90=function(_0x2658dc){while(--_0x2658dc){_0x567b18['push'](_0x567b18['shift']());}};_0x4a2e90(++_0x478751);}(_0xf1d6,0x195));var _0x6f1d=function(_0x378161,_0x6177a5){_0x378161=_0x378161-0x0;var _0x4b07b1=_0xf1d6[_0x378161];return _0x4b07b1;};'use strict';var EventEmitter=require(_0x6f1d('0x0'));var MailAccount=require(_0x6f1d('0x1'))['db'][_0x6f1d('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6f1d('0x3')](0x0);var events={'afterCreate':_0x6f1d('0x4'),'afterUpdate':'update','afterDestroy':_0x6f1d('0x5')};function emitEvent(_0x354ba7){return function(_0x291a97,_0x5464d4,_0x503295){MailAccountEvents['emit'](_0x354ba7+':'+_0x291a97['id'],_0x291a97);MailAccountEvents[_0x6f1d('0x6')](_0x354ba7,_0x291a97);_0x503295(null);};}for(var e in events){if(events[_0x6f1d('0x7')](e)){var event=events[e];MailAccount[_0x6f1d('0x8')](e,emitEvent(event));}}module[_0x6f1d('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x1ae7=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x532e6f,_0x4fa3c2){var _0x23600e=function(_0x160730){while(--_0x160730){_0x532e6f['push'](_0x532e6f['shift']());}};_0x23600e(++_0x4fa3c2);}(_0x1ae7,0x150));var _0x71ae=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1ae7[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x71ae('0x0'));var MailAccount=require(_0x71ae('0x1'))['db'][_0x71ae('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x71ae('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x71ae('0x4'),'afterDestroy':_0x71ae('0x5')};function emitEvent(_0xd66f7d){return function(_0x3182e1,_0x4d6fa7,_0x573837){MailAccountEvents[_0x71ae('0x6')](_0xd66f7d+':'+_0x3182e1['id'],_0x3182e1);MailAccountEvents['emit'](_0xd66f7d,_0x3182e1);_0x573837(null);};}for(var e in events){if(events[_0x71ae('0x7')](e)){var event=events[e];MailAccount[_0x71ae('0x8')](e,emitEvent(event));}}module[_0x71ae('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 954f792..b83a4b7 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 _0x063b=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailAccount.attributes','define','mail_accounts'];(function(_0x23d1fd,_0x1fd001){var _0x59ced3=function(_0x483219){while(--_0x483219){_0x23d1fd['push'](_0x23d1fd['shift']());}};_0x59ced3(++_0x1fd001);}(_0x063b,0x129));var _0xb063=function(_0x53f9fa,_0xeb4822){_0x53f9fa=_0x53f9fa-0x0;var _0x2c3187=_0x063b[_0x53f9fa];return _0x2c3187;};'use strict';var _=require(_0xb063('0x0'));var util=require(_0xb063('0x1'));var logger=require(_0xb063('0x2'))(_0xb063('0x3'));var moment=require(_0xb063('0x4'));var BPromise=require(_0xb063('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb063('0x6'));var config=require(_0xb063('0x7'));var attributes=require(_0xb063('0x8'));module['exports']=function(_0x2999e0,_0x1981f3){return _0x2999e0[_0xb063('0x9')]('MailAccount',attributes,{'tableName':_0xb063('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11db=['define','MailAccount','lodash','util','api','moment','bluebird','request-promise','./mailAccount.attributes'];(function(_0x1baf21,_0x41f45d){var _0x373f34=function(_0x1a00b4){while(--_0x1a00b4){_0x1baf21['push'](_0x1baf21['shift']());}};_0x373f34(++_0x41f45d);}(_0x11db,0x9b));var _0xb11d=function(_0x4a4922,_0x82cb8f){_0x4a4922=_0x4a4922-0x0;var _0x55a8c6=_0x11db[_0x4a4922];return _0x55a8c6;};'use strict';var _=require(_0xb11d('0x0'));var util=require(_0xb11d('0x1'));var logger=require('../../config/logger')(_0xb11d('0x2'));var moment=require(_0xb11d('0x3'));var BPromise=require(_0xb11d('0x4'));var rp=require(_0xb11d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb11d('0x6'));module['exports']=function(_0x399123,_0x8e0098){return _0x399123[_0xb11d('0x7')](_0xb11d('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d0c5f16..7db8b6b 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 _0x28e5=['GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowMailAccount','find','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','Contacts','updatedAt','MailApplication','Applications','get','omit','applications','list','priority','autoclose','length','close','*,*,*,*','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','interaction','contact','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch'];(function(_0x1d0389,_0x5f0773){var _0x215c03=function(_0x5a6d78){while(--_0x5a6d78){_0x1d0389['push'](_0x1d0389['shift']());}};_0x215c03(++_0x5f0773);}(_0x28e5,0xb2));var _0x528e=function(_0x2a247d,_0x36c689){_0x2a247d=_0x2a247d-0x0;var _0x1c0fd9=_0x28e5[_0x2a247d];return _0x1c0fd9;};'use strict';var _=require(_0x528e('0x0'));var util=require(_0x528e('0x1'));var moment=require(_0x528e('0x2'));var BPromise=require(_0x528e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x528e('0x4'))['db'];var utils=require(_0x528e('0x5'));var logger=require(_0x528e('0x6'))(_0x528e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x528e('0x8')]({'port':0x232c});config[_0x528e('0x9')]=_[_0x528e('0xa')](config[_0x528e('0x9')],{'host':_0x528e('0xb'),'port':0x18eb});var socket=require(_0x528e('0xc'))(new Redis(config[_0x528e('0x9')]));require('./mailAccount.socket')[_0x528e('0xd')](socket);function respondWithRpcPromise(_0x35f136,_0x6ac2b3,_0x3bb762){return new BPromise(function(_0x293fbd,_0x295d14){return client['request'](_0x35f136,_0x3bb762)[_0x528e('0xe')](function(_0x3b1320){logger[_0x528e('0xf')](_0x528e('0x10'),_0x6ac2b3,'request\x20sent');logger['debug'](_0x528e('0x11'),_0x6ac2b3,'request\x20sent',JSON[_0x528e('0x12')](_0x3b1320));if(_0x3b1320[_0x528e('0x13')]){if(_0x3b1320[_0x528e('0x13')][_0x528e('0x14')]===0x1f4){logger[_0x528e('0x13')]('MailAccount,\x20%s,\x20%s',_0x6ac2b3,_0x3b1320[_0x528e('0x13')][_0x528e('0x15')]);return _0x295d14(_0x3b1320[_0x528e('0x13')][_0x528e('0x15')]);}logger[_0x528e('0x13')](_0x528e('0x10'),_0x6ac2b3,_0x3b1320[_0x528e('0x13')][_0x528e('0x15')]);return _0x293fbd(_0x3b1320[_0x528e('0x13')][_0x528e('0x15')]);}else{logger['info'](_0x528e('0x10'),_0x6ac2b3,_0x528e('0x16'));_0x293fbd(_0x3b1320['result'][_0x528e('0x15')]);}})[_0x528e('0x17')](function(_0x22e302){logger[_0x528e('0x13')]('MailAccount,\x20%s,\x20%s',_0x6ac2b3,_0x22e302);_0x295d14(_0x22e302);});});}exports[_0x528e('0x18')]=function(_0x54d58){var _0x1212ee=this;return new Promise(function(_0x2252e2,_0x13b5a3){return db[_0x528e('0x19')][_0x528e('0x1a')]({'raw':_0x54d58[_0x528e('0x1b')]?_0x54d58['options'][_0x528e('0x1c')]===undefined?!![]:![]:!![],'where':_0x54d58['options']?_0x54d58['options'][_0x528e('0x1d')]||null:null,'attributes':_0x54d58[_0x528e('0x1b')]?_0x54d58['options'][_0x528e('0x1e')]||null:null,'limit':_0x54d58[_0x528e('0x1b')]?_0x54d58['options'][_0x528e('0x1f')]||null:null,'include':_0x54d58[_0x528e('0x1b')]?_0x54d58[_0x528e('0x1b')][_0x528e('0x20')]?_[_0x528e('0x21')](_0x54d58[_0x528e('0x1b')]['include'],function(_0x3af6c4){return{'model':db[_0x3af6c4[_0x528e('0x22')]],'as':_0x3af6c4['as'],'attributes':_0x3af6c4[_0x528e('0x1e')],'include':_0x3af6c4[_0x528e('0x20')]?_['map'](_0x3af6c4[_0x528e('0x20')],function(_0x4f6a3a){return{'model':db[_0x4f6a3a[_0x528e('0x22')]],'as':_0x4f6a3a['as'],'attributes':_0x4f6a3a[_0x528e('0x1e')],'include':_0x4f6a3a[_0x528e('0x20')]?_[_0x528e('0x21')](_0x4f6a3a['include'],function(_0x3a0faa){return{'model':db[_0x3a0faa[_0x528e('0x22')]],'as':_0x3a0faa['as'],'attributes':_0x3a0faa[_0x528e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fafc5){logger['info'](_0x528e('0x18'),_0x54d58);logger[_0x528e('0x23')](_0x528e('0x18'),_0x54d58,JSON[_0x528e('0x12')](_0x3fafc5));_0x2252e2(_0x3fafc5);})[_0x528e('0x17')](function(_0x25bec3){logger[_0x528e('0x13')](_0x528e('0x18'),_0x25bec3[_0x528e('0x15')],_0x54d58);_0x13b5a3(_0x1212ee[_0x528e('0x13')](0x1f4,_0x25bec3[_0x528e('0x15')]));});});};exports[_0x528e('0x24')]=function(_0x3d6da4){var _0x37b6c2=this;return new Promise(function(_0x4ac028,_0x473c44){return db[_0x528e('0x19')][_0x528e('0x25')]({'raw':_0x3d6da4[_0x528e('0x1b')]?_0x3d6da4[_0x528e('0x1b')][_0x528e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d6da4[_0x528e('0x1b')]?_0x3d6da4[_0x528e('0x1b')][_0x528e('0x1d')]||null:null,'attributes':_0x3d6da4[_0x528e('0x1b')]?_0x3d6da4['options']['attributes']||null:null,'include':_0x3d6da4[_0x528e('0x1b')]?_0x3d6da4[_0x528e('0x1b')][_0x528e('0x20')]?_[_0x528e('0x21')](_0x3d6da4[_0x528e('0x1b')][_0x528e('0x20')],function(_0x54d3cb){return{'model':db[_0x54d3cb['model']],'as':_0x54d3cb['as'],'attributes':_0x54d3cb[_0x528e('0x1e')],'include':_0x54d3cb['include']?_[_0x528e('0x21')](_0x54d3cb[_0x528e('0x20')],function(_0x72640b){return{'model':db[_0x72640b['model']],'as':_0x72640b['as'],'attributes':_0x72640b['attributes'],'include':_0x72640b[_0x528e('0x20')]?_[_0x528e('0x21')](_0x72640b[_0x528e('0x20')],function(_0x5b957c){return{'model':db[_0x5b957c[_0x528e('0x22')]],'as':_0x5b957c['as'],'attributes':_0x5b957c['attributes']};}):[]};}):[]};}):[]:[]})[_0x528e('0xe')](function(_0x1a0262){logger[_0x528e('0xf')](_0x528e('0x24'),_0x3d6da4);logger[_0x528e('0x23')](_0x528e('0x24'),_0x3d6da4,JSON[_0x528e('0x12')](_0x1a0262));_0x4ac028(_0x1a0262);})[_0x528e('0x17')](function(_0x2f1237){logger[_0x528e('0x13')]('ShowMailAccount',_0x2f1237[_0x528e('0x15')],_0x3d6da4);_0x473c44(_0x37b6c2[_0x528e('0x13')](0x1f4,_0x2f1237['message']));});});};exports[_0x528e('0x26')]=function(_0x19ae18){var _0x205557=this;return new Promise(function(_0x469d5d,_0x12a527){var _0x13f995={'body':_0x19ae18[_0x528e('0x27')],'channel':'mail'};var _0x30c9ae=_[_0x528e('0x28')](_[_0x528e('0x29')](db[_0x528e('0x2a')][_0x528e('0x2b')]),[_0x528e('0x2c'),'updatedAt',_0x528e('0x2d'),_0x528e('0x2e')]);var _0x15d63d=![];if(_0x19ae18[_0x528e('0x27')]['id']){delete _0x19ae18[_0x528e('0x27')]['id'];}if(_['isNil'](_0x19ae18['body']['from'])){return _0x12a527(_0x205557[_0x528e('0x13')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x528e('0x2f')](_0x19ae18[_0x528e('0x27')][_0x528e('0x27')])||_0x19ae18[_0x528e('0x27')][_0x528e('0x27')]===''){return _0x12a527(_0x205557['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x528e('0x2f')](_0x19ae18[_0x528e('0x27')][_0x528e('0x30')])){return _0x12a527(_0x205557['error'](0x1f4,_0x528e('0x31')+_0x30c9ae));}if(!_[_0x528e('0x32')](_0x30c9ae,_0x19ae18[_0x528e('0x27')]['mapKey'])){return _0x12a527(_0x205557['error'](0x1f4,_0x528e('0x33')+_0x30c9ae));}var _0x2321bb={};_0x2321bb[_0x19ae18[_0x528e('0x27')][_0x528e('0x30')]]=_0x19ae18[_0x528e('0x27')][_0x528e('0x34')];return db[_0x528e('0x19')][_0x528e('0x25')]({'where':{'id':_0x19ae18[_0x528e('0x35')]['id']},'include':[{'model':db[_0x528e('0x36')],'as':_0x528e('0x37'),'include':[{'model':db[_0x528e('0x2a')],'as':_0x528e('0x38'),'where':_0x2321bb,'limit':0x1,'order':[[_0x528e('0x39'),'DESC']]}]},{'model':db[_0x528e('0x3a')],'as':_0x528e('0x3b')},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x528e('0xe')](function(_0xe982b4){if(_0xe982b4&&_0xe982b4[_0x528e('0x37')]){var _0x58cea1=_0xe982b4[_0x528e('0x3c')]({'plain':!![]});_0x13f995[_0x528e('0x35')]=_[_0x528e('0x3d')](_0x58cea1,[_0x528e('0x3b'),_0x528e('0x37')]);_0x13f995[_0x528e('0x3e')]=_0x58cea1[_0x528e('0x3b')];_0x13f995[_0x528e('0x3f')]=_0x58cea1[_0x528e('0x37')];_0x13f995['applications']=_['orderBy'](_0x13f995[_0x528e('0x3e')],[_0x528e('0x40')],['asc']);if(_0x13f995['account']&&_0x13f995[_0x528e('0x35')][_0x528e('0x41')]){_0x13f995['applications']['push']({'id':0x0,'priority':_0x13f995[_0x528e('0x3e')][_0x528e('0x42')]+0x1,'app':_0x528e('0x43'),'appdata':_0x528e('0x41'),'interval':_0x528e('0x44')});}if(_0x13f995[_0x528e('0x35')]['Applications']){delete _0x13f995[_0x528e('0x35')]['Applications'];}if(_0x13f995[_0x528e('0x35')][_0x528e('0x37')]){delete _0x13f995['account']['List'];}if(_0x58cea1[_0x528e('0x37')][_0x528e('0x38')]['length']){return _0x58cea1[_0x528e('0x37')][_0x528e('0x38')][0x0];}var _0x1b776b=_[_0x528e('0xa')](_0x19ae18['body'],{'firstName':_0x19ae18[_0x528e('0x27')][_0x528e('0x34')],'ListId':_0x58cea1['ListId']});_0x1b776b[_0x19ae18[_0x528e('0x27')]['mapKey']]=_0x19ae18[_0x528e('0x27')][_0x528e('0x34')];return db['CmContact']['create'](_0x1b776b);}else{throw new Error(_0x528e('0x45'));}})['then'](function(_0x948e32){_0x13f995['contact']=_0x948e32;if(_0x948e32){if(!_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x46')]){_0x19ae18['body']['message']['messageId']=rs[_0x528e('0x47')]()+'\x20'+_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x34')];}var _0x5f448f={'ContactId':_0x948e32['id'],'MailAccountId':_0x19ae18[_0x528e('0x35')]['id'],'inReplyTo':_0x19ae18[_0x528e('0x27')]['message'][_0x528e('0x46')],'to':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x34')],'cc':_0x19ae18[_0x528e('0x27')]['message']['cc'],'subject':_0x19ae18[_0x528e('0x27')]['message'][_0x528e('0x48')],'attach':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x49')],'lastMsgAt':moment()[_0x528e('0x4a')](_0x528e('0x4b')),'lastMsgDirection':'in'};return db[_0x528e('0x4c')][_0x528e('0x25')]({'where':{'closed':![],'MailAccountId':_0x19ae18[_0x528e('0x35')]['id']},'include':[{'model':db[_0x528e('0x4d')],'as':_0x528e('0x4e'),'attributes':[_0x528e('0x46')],'where':{'messageId':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x4f')]}}]})[_0x528e('0xe')](function(_0x5dbae3){if(_0x5dbae3){return[_0x5dbae3,![]];}return db[_0x528e('0x4c')][_0x528e('0x50')](_0x5f448f)[_0x528e('0xe')](function(_0x2ce9ed){return[_0x2ce9ed,!![]];});});}else{throw new Error(_0x528e('0x51'));}})[_0x528e('0x52')](function(_0x572af6,_0x56742b){if(_0x572af6){_0x15d63d=_0x56742b;if(!_0x56742b){return _0x572af6[_0x528e('0x53')]({'inReplyTo':_0x19ae18['body']['message'][_0x528e('0x46')],'to':_0x19ae18[_0x528e('0x27')]['message'][_0x528e('0x34')],'cc':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')]['cc'],'subject':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x48')],'attach':_0x572af6[_0x528e('0x49')]?_0x572af6[_0x528e('0x49')]:_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x49')],'substatus':null,'substatusAt':moment()[_0x528e('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x528e('0x4a')](_0x528e('0x4b')),'lastMsgDirection':'in'});}else{return _0x572af6;}}})[_0x528e('0xe')](function(_0x15e71a){_0x13f995[_0x528e('0x54')]=_0x15e71a[_0x528e('0x3c')]({'plain':!![]});_0x13f995[_0x528e('0x54')]['created']=_0x15d63d;return db[_0x528e('0x4d')][_0x528e('0x50')]({'body':_0x19ae18[_0x528e('0x27')]['body'],'MailAccountId':_0x19ae18[_0x528e('0x35')]['id'],'MailInteractionId':_0x15e71a['id'],'direction':'in','ContactId':_0x13f995[_0x528e('0x55')]['id'],'messageId':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')]['messageId'],'from':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x34')],'to':_0x19ae18['body']['message']['to'],'cc':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')]['cc'],'subject':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x48')],'attach':_0x19ae18[_0x528e('0x27')]['message']['attach'],'Attachments':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')]['attachments'],'originTo':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x56')],'originCc':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x57')],'bcc':_0x19ae18[_0x528e('0x27')]['message'][_0x528e('0x58')],'ChatWebsiteId':_0x19ae18['body'][_0x528e('0x15')][_0x528e('0x59')]||null,'originChannel':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')][_0x528e('0x5a')]||_0x528e('0x5b'),'ChatOfflineMessageId':_0x19ae18[_0x528e('0x27')][_0x528e('0x15')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x528e('0x5c')],'as':_0x528e('0x5d')}]});})['then'](function(_0x159583){_0x13f995[_0x528e('0x15')]=_0x159583;if(_0x13f995['interaction'][_0x528e('0x5e')]){return db[_0x528e('0x5f')][_0x528e('0x25')]({'attributes':['id',_0x528e('0x60')],'where':{'id':_0x13f995[_0x528e('0x54')][_0x528e('0x5e')]}})[_0x528e('0xe')](function(_0x4375ac){if(_0x4375ac){_0x13f995['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x528e('0x61'),'appdata':_0x4375ac[_0x528e('0x60')]+','+(_0x13f995[_0x528e('0x35')][_0x528e('0x62')]||0xa),'interval':_0x528e('0x44')});}return respondWithRpcPromise(_0x528e('0x63'),_0x528e('0x64'),_0x13f995);});}return respondWithRpcPromise(_0x528e('0x63'),'startRouting',_0x13f995);})[_0x528e('0xe')](function(_0x3df4b2){_0x469d5d(_0x3df4b2);})[_0x528e('0x17')](function(_0x3b8ce7){_0x12a527(_0x205557[_0x528e('0x13')](0x1f4,_0x3b8ce7['message']));});});}; \ No newline at end of file +var _0xc99a=['created','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','GetMailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','body','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','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','from','MailAccount','account','CmList','Contacts','DESC','MailApplication','MailServerOut','Smtp','List','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','defaults','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','update','subject','interaction','get'];(function(_0x3590ed,_0x3a4587){var _0x21f72f=function(_0x45be21){while(--_0x45be21){_0x3590ed['push'](_0x3590ed['shift']());}};_0x21f72f(++_0x3a4587);}(_0xc99a,0x143));var _0xac99=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc99a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac99('0x0'));var util=require('util');var moment=require(_0xac99('0x1'));var BPromise=require('bluebird');var rs=require(_0xac99('0x2'));var fs=require('fs');var Redis=require(_0xac99('0x3'));var db=require(_0xac99('0x4'))['db'];var utils=require(_0xac99('0x5'));var logger=require(_0xac99('0x6'))('rpc');var config=require(_0xac99('0x7'));var jayson=require(_0xac99('0x8'));var client=jayson['client'][_0xac99('0x9')]({'port':0x232c});config[_0xac99('0xa')]=_['defaults'](config['redis'],{'host':_0xac99('0xb'),'port':0x18eb});var socket=require(_0xac99('0xc'))(new Redis(config['redis']));require(_0xac99('0xd'))[_0xac99('0xe')](socket);function respondWithRpcPromise(_0x70d5cb,_0x11cbe4,_0x21827f){return new BPromise(function(_0x53a6c3,_0x5a7858){return client['request'](_0x70d5cb,_0x21827f)[_0xac99('0xf')](function(_0x55b135){logger[_0xac99('0x10')](_0xac99('0x11'),_0x11cbe4,'request\x20sent');logger[_0xac99('0x12')](_0xac99('0x13'),_0x11cbe4,'request\x20sent',JSON[_0xac99('0x14')](_0x55b135));if(_0x55b135[_0xac99('0x15')]){if(_0x55b135[_0xac99('0x15')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x11cbe4,_0x55b135[_0xac99('0x15')]['message']);return _0x5a7858(_0x55b135[_0xac99('0x15')][_0xac99('0x16')]);}logger[_0xac99('0x15')](_0xac99('0x11'),_0x11cbe4,_0x55b135[_0xac99('0x15')][_0xac99('0x16')]);return _0x53a6c3(_0x55b135['error'][_0xac99('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x11cbe4,_0xac99('0x17'));_0x53a6c3(_0x55b135['result']['message']);}})[_0xac99('0x18')](function(_0x103774){logger[_0xac99('0x15')](_0xac99('0x11'),_0x11cbe4,_0x103774);_0x5a7858(_0x103774);});});}exports[_0xac99('0x19')]=function(_0x19ac2f){var _0x49329d=this;return new Promise(function(_0x2e6094,_0x29ca5e){return db['MailAccount']['findAll']({'raw':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f[_0xac99('0x1a')][_0xac99('0x1b')]===undefined?!![]:![]:!![],'where':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f['options'][_0xac99('0x1c')]||null:null,'attributes':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f[_0xac99('0x1a')][_0xac99('0x1d')]||null:null,'limit':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f['options'][_0xac99('0x1e')]||null:null,'include':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f[_0xac99('0x1a')][_0xac99('0x1f')]?_[_0xac99('0x20')](_0x19ac2f[_0xac99('0x1a')][_0xac99('0x1f')],function(_0x267c01){return{'model':db[_0x267c01[_0xac99('0x21')]],'as':_0x267c01['as'],'attributes':_0x267c01['attributes'],'include':_0x267c01[_0xac99('0x1f')]?_['map'](_0x267c01['include'],function(_0x5733f8){return{'model':db[_0x5733f8[_0xac99('0x21')]],'as':_0x5733f8['as'],'attributes':_0x5733f8[_0xac99('0x1d')],'include':_0x5733f8[_0xac99('0x1f')]?_[_0xac99('0x20')](_0x5733f8[_0xac99('0x1f')],function(_0x461566){return{'model':db[_0x461566[_0xac99('0x21')]],'as':_0x461566['as'],'attributes':_0x461566[_0xac99('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x226103){logger[_0xac99('0x10')](_0xac99('0x19'),_0x19ac2f);logger[_0xac99('0x12')](_0xac99('0x19'),_0x19ac2f,JSON[_0xac99('0x14')](_0x226103));_0x2e6094(_0x226103);})[_0xac99('0x18')](function(_0x3af7d4){logger[_0xac99('0x15')](_0xac99('0x19'),_0x3af7d4[_0xac99('0x16')],_0x19ac2f);_0x29ca5e(_0x49329d['error'](0x1f4,_0x3af7d4[_0xac99('0x16')]));});});};exports[_0xac99('0x22')]=function(_0x4a1226){var _0x5906e7=this;return new Promise(function(_0x1f8ee5,_0x118fbc){return db['MailAccount'][_0xac99('0x23')]({'raw':_0x4a1226[_0xac99('0x1a')]?_0x4a1226[_0xac99('0x1a')][_0xac99('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a1226[_0xac99('0x1a')]?_0x4a1226[_0xac99('0x1a')][_0xac99('0x1c')]||null:null,'attributes':_0x4a1226['options']?_0x4a1226['options'][_0xac99('0x1d')]||null:null,'include':_0x4a1226[_0xac99('0x1a')]?_0x4a1226[_0xac99('0x1a')]['include']?_[_0xac99('0x20')](_0x4a1226[_0xac99('0x1a')][_0xac99('0x1f')],function(_0x3c2873){return{'model':db[_0x3c2873[_0xac99('0x21')]],'as':_0x3c2873['as'],'attributes':_0x3c2873[_0xac99('0x1d')],'include':_0x3c2873[_0xac99('0x1f')]?_[_0xac99('0x20')](_0x3c2873['include'],function(_0x573c80){return{'model':db[_0x573c80[_0xac99('0x21')]],'as':_0x573c80['as'],'attributes':_0x573c80[_0xac99('0x1d')],'include':_0x573c80[_0xac99('0x1f')]?_[_0xac99('0x20')](_0x573c80[_0xac99('0x1f')],function(_0x7b39){return{'model':db[_0x7b39[_0xac99('0x21')]],'as':_0x7b39['as'],'attributes':_0x7b39['attributes']};}):[]};}):[]};}):[]:[]})[_0xac99('0xf')](function(_0x2d01f8){logger['info']('ShowMailAccount',_0x4a1226);logger[_0xac99('0x12')](_0xac99('0x22'),_0x4a1226,JSON['stringify'](_0x2d01f8));_0x1f8ee5(_0x2d01f8);})[_0xac99('0x18')](function(_0xd1b2b1){logger[_0xac99('0x15')](_0xac99('0x22'),_0xd1b2b1[_0xac99('0x16')],_0x4a1226);_0x118fbc(_0x5906e7['error'](0x1f4,_0xd1b2b1[_0xac99('0x16')]));});});};exports['NotifyMailAccount']=function(_0x58023d){var _0x4f5f10=this;return new Promise(function(_0x4ce75d,_0x40a776){var _0x505466={'body':_0x58023d[_0xac99('0x24')],'channel':'mail'};var _0x49551a=_[_0xac99('0x25')](_[_0xac99('0x26')](db[_0xac99('0x27')]['rawAttributes']),[_0xac99('0x28'),_0xac99('0x29'),_0xac99('0x2a'),_0xac99('0x2b')]);var _0x26ce02=![];if(_0x58023d[_0xac99('0x24')]['id']){delete _0x58023d[_0xac99('0x24')]['id'];}if(_[_0xac99('0x2c')](_0x58023d[_0xac99('0x24')]['from'])){return _0x40a776(_0x4f5f10[_0xac99('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x58023d['body'][_0xac99('0x24')])||_0x58023d[_0xac99('0x24')][_0xac99('0x24')]===''){return _0x40a776(_0x4f5f10[_0xac99('0x15')](0x1f4,_0xac99('0x2d')));}if(_[_0xac99('0x2c')](_0x58023d[_0xac99('0x24')][_0xac99('0x2e')])){return _0x40a776(_0x4f5f10[_0xac99('0x15')](0x1f4,_0xac99('0x2f')+_0x49551a));}if(!_[_0xac99('0x30')](_0x49551a,_0x58023d[_0xac99('0x24')]['mapKey'])){return _0x40a776(_0x4f5f10['error'](0x1f4,_0xac99('0x31')+_0x49551a));}var _0x5c23df={};_0x5c23df[_0x58023d['body'][_0xac99('0x2e')]]=_0x58023d['body'][_0xac99('0x32')];return db[_0xac99('0x33')][_0xac99('0x23')]({'where':{'id':_0x58023d[_0xac99('0x34')]['id']},'include':[{'model':db[_0xac99('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':_0xac99('0x36'),'where':_0x5c23df,'limit':0x1,'order':[[_0xac99('0x29'),_0xac99('0x37')]]}]},{'model':db[_0xac99('0x38')],'as':'Applications'},{'model':db[_0xac99('0x39')],'as':_0xac99('0x3a')}]})[_0xac99('0xf')](function(_0x3aaa5e){if(_0x3aaa5e&&_0x3aaa5e[_0xac99('0x3b')]){var _0x57ab71=_0x3aaa5e['get']({'plain':!![]});_0x505466[_0xac99('0x34')]=_[_0xac99('0x3c')](_0x57ab71,[_0xac99('0x3d'),'List']);_0x505466[_0xac99('0x3e')]=_0x57ab71[_0xac99('0x3d')];_0x505466[_0xac99('0x3f')]=_0x57ab71[_0xac99('0x3b')];_0x505466[_0xac99('0x3e')]=_[_0xac99('0x40')](_0x505466[_0xac99('0x3e')],[_0xac99('0x41')],[_0xac99('0x42')]);if(_0x505466[_0xac99('0x34')]&&_0x505466['account'][_0xac99('0x43')]){_0x505466[_0xac99('0x3e')][_0xac99('0x44')]({'id':0x0,'priority':_0x505466[_0xac99('0x3e')]['length']+0x1,'app':_0xac99('0x45'),'appdata':_0xac99('0x43'),'interval':_0xac99('0x46')});}if(_0x505466['account'][_0xac99('0x3d')]){delete _0x505466[_0xac99('0x34')][_0xac99('0x3d')];}if(_0x505466['account'][_0xac99('0x3b')]){delete _0x505466[_0xac99('0x34')]['List'];}if(_0x57ab71[_0xac99('0x3b')][_0xac99('0x36')][_0xac99('0x47')]){return _0x57ab71[_0xac99('0x3b')][_0xac99('0x36')][0x0];}var _0x1f9982=_[_0xac99('0x48')](_0x58023d['body'],{'firstName':_0x58023d[_0xac99('0x24')]['from'],'ListId':_0x57ab71[_0xac99('0x2b')]});_0x1f9982[_0x58023d[_0xac99('0x24')][_0xac99('0x2e')]]=_0x58023d[_0xac99('0x24')][_0xac99('0x32')];return db[_0xac99('0x27')][_0xac99('0x49')](_0x1f9982);}else{throw new Error(_0xac99('0x4a'));}})[_0xac99('0xf')](function(_0x2febbf){_0x505466[_0xac99('0x4b')]=_0x2febbf;if(_0x2febbf){if(!_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x4c')]){_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x4c')]=rs[_0xac99('0x4d')]()+'\x20'+_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x32')];}var _0x1e2840={'ContactId':_0x2febbf['id'],'MailAccountId':_0x58023d[_0xac99('0x34')]['id'],'inReplyTo':_0x58023d['body'][_0xac99('0x16')][_0xac99('0x4c')],'to':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x32')],'cc':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['cc'],'subject':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['subject'],'attach':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x4e')],'lastMsgAt':moment()[_0xac99('0x4f')](_0xac99('0x50')),'lastMsgDirection':'in'};return db[_0xac99('0x51')]['find']({'where':{'closed':![],'MailAccountId':_0x58023d['account']['id']},'include':[{'model':db[_0xac99('0x52')],'as':_0xac99('0x53'),'attributes':['messageId'],'where':{'messageId':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['inReplyTo']}}]})[_0xac99('0xf')](function(_0x3738aa){if(_0x3738aa){return[_0x3738aa,![]];}return db[_0xac99('0x51')][_0xac99('0x49')](_0x1e2840)[_0xac99('0xf')](function(_0x1780d2){return[_0x1780d2,!![]];});});}else{throw new Error(_0xac99('0x54'));}})['spread'](function(_0x4cb40f,_0x1beef0){if(_0x4cb40f){_0x26ce02=_0x1beef0;if(!_0x1beef0){return _0x4cb40f[_0xac99('0x55')]({'inReplyTo':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['messageId'],'to':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x32')],'cc':_0x58023d['body'][_0xac99('0x16')]['cc'],'subject':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x56')],'attach':_0x4cb40f[_0xac99('0x4e')]?_0x4cb40f['attach']:_0x58023d['body'][_0xac99('0x16')][_0xac99('0x4e')],'substatus':null,'substatusAt':moment()[_0xac99('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xac99('0x4f')](_0xac99('0x50')),'lastMsgDirection':'in'});}else{return _0x4cb40f;}}})[_0xac99('0xf')](function(_0x50d187){_0x505466[_0xac99('0x57')]=_0x50d187[_0xac99('0x58')]({'plain':!![]});_0x505466[_0xac99('0x57')][_0xac99('0x59')]=_0x26ce02;return db[_0xac99('0x52')][_0xac99('0x49')]({'body':_0x58023d[_0xac99('0x24')][_0xac99('0x24')],'MailAccountId':_0x58023d[_0xac99('0x34')]['id'],'MailInteractionId':_0x50d187['id'],'direction':'in','ContactId':_0x505466[_0xac99('0x4b')]['id'],'messageId':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x4c')],'from':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x32')],'to':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['to'],'cc':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['cc'],'subject':_0x58023d['body']['message'][_0xac99('0x56')],'attach':_0x58023d[_0xac99('0x24')]['message']['attach'],'Attachments':_0x58023d['body'][_0xac99('0x16')]['attachments'],'originTo':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['originTo'],'originCc':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x5a')],'bcc':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x5b')],'ChatWebsiteId':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x5c')]||null,'originChannel':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x5d')]||'Email','ChatOfflineMessageId':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x5e')]||null},{'include':[{'model':db[_0xac99('0x5f')],'as':'Attachments'}]});})[_0xac99('0xf')](function(_0x521012){_0x505466[_0xac99('0x16')]=_0x521012;if(_0x505466['interaction'][_0xac99('0x60')]){return db[_0xac99('0x61')][_0xac99('0x23')]({'attributes':['id','name'],'where':{'id':_0x505466[_0xac99('0x57')][_0xac99('0x60')]}})[_0xac99('0xf')](function(_0x408730){if(_0x408730){_0x505466['applications'][_0xac99('0x62')]({'id':0x0,'priority':0x0,'app':_0xac99('0x63'),'appdata':_0x408730['name']+','+(_0x505466[_0xac99('0x34')][_0xac99('0x64')]||0xa),'interval':_0xac99('0x46')});}return respondWithRpcPromise(_0xac99('0x65'),'startRouting',_0x505466);});}return respondWithRpcPromise('Start',_0xac99('0x66'),_0x505466);})[_0xac99('0xf')](function(_0x4e91d8){_0x4ce75d(_0x4e91d8);})[_0xac99('0x18')](function(_0x360ca4){_0x40a776(_0x4f5f10[_0xac99('0x15')](0x1f4,_0x360ca4[_0xac99('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index cf6bc4c..9828e52 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 _0x237d=['save','remove','update','emit','removeListener','./mailAccount.events'];(function(_0x1cfd93,_0x2e5014){var _0x361d75=function(_0x42a20f){while(--_0x42a20f){_0x1cfd93['push'](_0x1cfd93['shift']());}};_0x361d75(++_0x2e5014);}(_0x237d,0x1d9));var _0xd237=function(_0x250f7c,_0xadc77b){_0x250f7c=_0x250f7c-0x0;var _0x395f32=_0x237d[_0x250f7c];return _0x395f32;};'use strict';var MailAccountEvents=require(_0xd237('0x0'));var events=[_0xd237('0x1'),_0xd237('0x2'),_0xd237('0x3')];function createListener(_0x4d5e1c,_0x173f47){return function(_0x12d819){_0x173f47[_0xd237('0x4')](_0x4d5e1c,_0x12d819);};}function removeListener(_0x16967d,_0x1de407){return function(){MailAccountEvents[_0xd237('0x5')](_0x16967d,_0x1de407);};}exports['register']=function(_0x1dfaa5){for(var _0x37e6c0=0x0,_0x5ca6e7=events['length'];_0x37e6c0<_0x5ca6e7;_0x37e6c0++){var _0x5390d7=events[_0x37e6c0];var _0x1df838=createListener('mailAccount:'+_0x5390d7,_0x1dfaa5);MailAccountEvents['on'](_0x5390d7,_0x1df838);}}; \ No newline at end of file +var _0x7d1f=['remove','update','emit','removeListener','register','./mailAccount.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7d1f,0x10f));var _0xf7d1=function(_0x53e001,_0xedce48){_0x53e001=_0x53e001-0x0;var _0x4d9b76=_0x7d1f[_0x53e001];return _0x4d9b76;};'use strict';var MailAccountEvents=require(_0xf7d1('0x0'));var events=[_0xf7d1('0x1'),_0xf7d1('0x2'),_0xf7d1('0x3')];function createListener(_0x51ec0d,_0x1b6726){return function(_0x54440f){_0x1b6726[_0xf7d1('0x4')](_0x51ec0d,_0x54440f);};}function removeListener(_0x547da2,_0x5bcef6){return function(){MailAccountEvents[_0xf7d1('0x5')](_0x547da2,_0x5bcef6);};}exports[_0xf7d1('0x6')]=function(_0x4ddd66){for(var _0x5edc59=0x0,_0x25ed5=events['length'];_0x5edc59<_0x25ed5;_0x5edc59++){var _0x4e60ab=events[_0x5edc59];var _0x29902d=createListener('mailAccount:'+_0x4e60ab,_0x4ddd66);MailAccountEvents['on'](_0x4e60ab,_0x29902d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5a0a88b..cda069a 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 _0x553a=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','/:id'];(function(_0x41df38,_0x141346){var _0x422d41=function(_0xf91270){while(--_0xf91270){_0x41df38['push'](_0x41df38['shift']());}};_0x422d41(++_0x141346);}(_0x553a,0x84));var _0xa553=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0x553a[_0x169a8a];return _0x2e8502;};'use strict';var multer=require(_0xa553('0x0'));var util=require(_0xa553('0x1'));var path=require(_0xa553('0x2'));var timeout=require('connect-timeout');var express=require(_0xa553('0x3'));var router=express[_0xa553('0x4')]();var fs_extra=require(_0xa553('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa553('0x6'));var config=require(_0xa553('0x7'));var controller=require('./mailApplication.controller');router[_0xa553('0x8')]('/:id',auth[_0xa553('0x9')](),controller['show']);router[_0xa553('0xa')](_0xa553('0xb'),auth['isAuthenticated'](),controller[_0xa553('0xc')]);router[_0xa553('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xa553('0xe')]);module[_0xa553('0xf')]=router; \ No newline at end of file +var _0x1aae=['show','isAuthenticated','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller','get','/:id'];(function(_0x35d2b2,_0x47388f){var _0xc35fd4=function(_0x4a85ab){while(--_0x4a85ab){_0x35d2b2['push'](_0x35d2b2['shift']());}};_0xc35fd4(++_0x47388f);}(_0x1aae,0x131));var _0xe1aa=function(_0x8f926d,_0x13de6b){_0x8f926d=_0x8f926d-0x0;var _0x2a080d=_0x1aae[_0x8f926d];return _0x2a080d;};'use strict';var multer=require('multer');var util=require(_0xe1aa('0x0'));var path=require(_0xe1aa('0x1'));var timeout=require(_0xe1aa('0x2'));var express=require(_0xe1aa('0x3'));var router=express[_0xe1aa('0x4')]();var fs_extra=require(_0xe1aa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe1aa('0x6'));var config=require('../../config/environment');var controller=require(_0xe1aa('0x7'));router[_0xe1aa('0x8')](_0xe1aa('0x9'),auth['isAuthenticated'](),controller[_0xe1aa('0xa')]);router['put'](_0xe1aa('0x9'),auth[_0xe1aa('0xb')](),controller[_0xe1aa('0xc')]);router[_0xe1aa('0xd')]('/:id',auth[_0xe1aa('0xb')](),controller['destroy']);module[_0xe1aa('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index da31ee8..c9c59b6 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 _0xf31f=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0xf31f,0x95));var _0xff31=function(_0x128c6f,_0x54a780){_0x128c6f=_0x128c6f-0x0;var _0xe8e4b0=_0xf31f[_0x128c6f];return _0xe8e4b0;};'use strict';var Sequelize=require(_0xff31('0x0'));module[_0xff31('0x1')]={'priority':{'type':Sequelize[_0xff31('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xff31('0x3')],'allowNull':![],'defaultValue':_0xff31('0x4')},'appdata':{'type':Sequelize[_0xff31('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xff31('0x3')],'defaultValue':_0xff31('0x6')}}; \ No newline at end of file +var _0xd81d=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x55a312,_0x385afa){var _0x49a53c=function(_0xfd4334){while(--_0xfd4334){_0x55a312['push'](_0x55a312['shift']());}};_0x49a53c(++_0x385afa);}(_0xd81d,0xe3));var _0xdd81=function(_0x9e0ae3,_0x1da32c){_0x9e0ae3=_0x9e0ae3-0x0;var _0x5e1b58=_0xd81d[_0x9e0ae3];return _0x5e1b58;};'use strict';var Sequelize=require(_0xdd81('0x0'));module[_0xdd81('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdd81('0x2')],'allowNull':![],'defaultValue':_0xdd81('0x3')},'appdata':{'type':Sequelize[_0xdd81('0x4')]()},'description':{'type':Sequelize[_0xdd81('0x2')]},'interval':{'type':Sequelize[_0xdd81('0x2')],'defaultValue':_0xdd81('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b7210c0..a06e602 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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1fcd0a,_0x3cc29f){_0x1fcd0a=_0x1fcd0a-0x0;var _0x5930e8=_0x9bde[_0x1fcd0a];return _0x5930e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1dc448,_0xcafe01){var _0x64794a=function(_0x4f54b6){while(--_0x4f54b6){_0x1dc448['push'](_0x1dc448['shift']());}};_0x64794a(++_0xcafe01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8d8957a..8f65292 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 _0xe467=['exports','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2c6ad9,_0x184f4d){var _0x39a6e1=function(_0x4bde9f){while(--_0x4bde9f){_0x2c6ad9['push'](_0x2c6ad9['shift']());}};_0x39a6e1(++_0x184f4d);}(_0xe467,0x68));var _0x7e46=function(_0x210200,_0x150b2e){_0x210200=_0x210200-0x0;var _0x52e0e5=_0xe467[_0x210200];return _0x52e0e5;};'use strict';var _=require('lodash');var util=require(_0x7e46('0x0'));var logger=require(_0x7e46('0x1'))('api');var moment=require(_0x7e46('0x2'));var BPromise=require(_0x7e46('0x3'));var rp=require(_0x7e46('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e46('0x5'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x7e46('0x6')]=function(_0x4d3767,_0x4c10a0){return _0x4d3767['define']('MailApplication',attributes,{'tableName':_0x7e46('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e46('0x8'),'collate':_0x7e46('0x9')});}; \ No newline at end of file +var _0x1644=['../../config/logger','moment','path','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x54af0d,_0x3e5db0){var _0x57b08d=function(_0x35d93a){while(--_0x35d93a){_0x54af0d['push'](_0x54af0d['shift']());}};_0x57b08d(++_0x3e5db0);}(_0x1644,0x196));var _0x4164=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x1644[_0x323430];return _0x9eecd1;};'use strict';var _=require(_0x4164('0x0'));var util=require(_0x4164('0x1'));var logger=require(_0x4164('0x2'))('api');var moment=require(_0x4164('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4164('0x4'));var rimraf=require('rimraf');var config=require(_0x4164('0x5'));var attributes=require(_0x4164('0x6'));module[_0x4164('0x7')]=function(_0x4afb20,_0x3e437e){return _0x4afb20[_0x4164('0x8')]('MailApplication',attributes,{'tableName':_0x4164('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4164('0xa'),'collate':_0x4164('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3f075a7..fbebe04 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 _0x1b1d=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','result','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','then','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent'];(function(_0x5585f5,_0x167771){var _0x3439c9=function(_0x207c3f){while(--_0x207c3f){_0x5585f5['push'](_0x5585f5['shift']());}};_0x3439c9(++_0x167771);}(_0x1b1d,0x16d));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1b1('0x0'));var util=require(_0xd1b1('0x1'));var moment=require('moment');var BPromise=require(_0xd1b1('0x2'));var rs=require(_0xd1b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1b1('0x4'))['db'];var utils=require(_0xd1b1('0x5'));var logger=require(_0xd1b1('0x6'))(_0xd1b1('0x7'));var config=require(_0xd1b1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd1b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x187a82,_0x21ed78,_0xa957d4){return new BPromise(function(_0x17181e,_0x38d450){return client['request'](_0x187a82,_0xa957d4)['then'](function(_0xafed2){logger[_0xd1b1('0xa')]('MailApplication,\x20%s,\x20%s',_0x21ed78,_0xd1b1('0xb'));logger['debug'](_0xd1b1('0xc'),_0x21ed78,'request\x20sent',JSON[_0xd1b1('0xd')](_0xafed2));if(_0xafed2[_0xd1b1('0xe')]){if(_0xafed2['error']['code']===0x1f4){logger[_0xd1b1('0xe')](_0xd1b1('0xf'),_0x21ed78,_0xafed2[_0xd1b1('0xe')][_0xd1b1('0x10')]);return _0x38d450(_0xafed2[_0xd1b1('0xe')][_0xd1b1('0x10')]);}logger[_0xd1b1('0xe')]('MailApplication,\x20%s,\x20%s',_0x21ed78,_0xafed2['error'][_0xd1b1('0x10')]);return _0x17181e(_0xafed2[_0xd1b1('0xe')][_0xd1b1('0x10')]);}else{logger[_0xd1b1('0xa')](_0xd1b1('0xf'),_0x21ed78,'request\x20sent');_0x17181e(_0xafed2[_0xd1b1('0x11')][_0xd1b1('0x10')]);}})['catch'](function(_0x1c5a7b){logger[_0xd1b1('0xe')](_0xd1b1('0xf'),_0x21ed78,_0x1c5a7b);_0x38d450(_0x1c5a7b);});});}exports[_0xd1b1('0x12')]=function(_0x3fb4ad){var _0x440d0a=this;return new Promise(function(_0x2af5f1,_0x10f7dc){return db[_0xd1b1('0x13')][_0xd1b1('0x14')](_0x3fb4ad[_0xd1b1('0x15')],{'raw':_0x3fb4ad[_0xd1b1('0x16')]?_0x3fb4ad[_0xd1b1('0x16')][_0xd1b1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb4ad[_0xd1b1('0x16')]?_0x3fb4ad[_0xd1b1('0x16')][_0xd1b1('0x18')]||null:null,'attributes':_0x3fb4ad[_0xd1b1('0x16')]?_0x3fb4ad[_0xd1b1('0x16')][_0xd1b1('0x19')]||null:null,'limit':_0x3fb4ad['options']?_0x3fb4ad[_0xd1b1('0x16')][_0xd1b1('0x1a')]||null:null})[_0xd1b1('0x1b')](function(_0x28d483){logger[_0xd1b1('0xa')](_0xd1b1('0x12'),_0x3fb4ad);logger['debug'](_0xd1b1('0x12'),_0x3fb4ad,JSON['stringify'](_0x28d483));_0x2af5f1(_0x28d483);})[_0xd1b1('0x1c')](function(_0x3e4779){logger[_0xd1b1('0xe')](_0xd1b1('0x12'),_0x3e4779['message'],_0x3fb4ad);_0x10f7dc(_0x440d0a[_0xd1b1('0xe')](0x1f4,_0x3e4779[_0xd1b1('0x10')]));});});}; \ No newline at end of file +var _0xde6b=['info','MailApplication,\x20%s,\x20%s','debug','error','message','catch','UpdateMailApplication','MailApplication','body','options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0xde6b,0xde));var _0xbde6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xde6b[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xbde6('0x0'));var util=require(_0xbde6('0x1'));var moment=require(_0xbde6('0x2'));var BPromise=require(_0xbde6('0x3'));var rs=require(_0xbde6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbde6('0x5'))['db'];var utils=require(_0xbde6('0x6'));var logger=require('../../config/logger')(_0xbde6('0x7'));var config=require(_0xbde6('0x8'));var jayson=require(_0xbde6('0x9'));var client=jayson[_0xbde6('0xa')][_0xbde6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x160e90,_0x23f3ee,_0x474dd6){return new BPromise(function(_0x56e47,_0x2a57c4){return client['request'](_0x160e90,_0x474dd6)['then'](function(_0x180570){logger[_0xbde6('0xc')](_0xbde6('0xd'),_0x23f3ee,'request\x20sent');logger[_0xbde6('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x23f3ee,'request\x20sent',JSON['stringify'](_0x180570));if(_0x180570[_0xbde6('0xf')]){if(_0x180570['error']['code']===0x1f4){logger[_0xbde6('0xf')](_0xbde6('0xd'),_0x23f3ee,_0x180570[_0xbde6('0xf')][_0xbde6('0x10')]);return _0x2a57c4(_0x180570['error']['message']);}logger[_0xbde6('0xf')](_0xbde6('0xd'),_0x23f3ee,_0x180570[_0xbde6('0xf')]['message']);return _0x56e47(_0x180570['error']['message']);}else{logger[_0xbde6('0xc')]('MailApplication,\x20%s,\x20%s',_0x23f3ee,'request\x20sent');_0x56e47(_0x180570['result'][_0xbde6('0x10')]);}})[_0xbde6('0x11')](function(_0x560e8d){logger[_0xbde6('0xf')](_0xbde6('0xd'),_0x23f3ee,_0x560e8d);_0x2a57c4(_0x560e8d);});});}exports[_0xbde6('0x12')]=function(_0x2e987b){var _0x27838d=this;return new Promise(function(_0x37ef0c,_0x196c95){return db[_0xbde6('0x13')]['update'](_0x2e987b[_0xbde6('0x14')],{'raw':_0x2e987b[_0xbde6('0x15')]?_0x2e987b[_0xbde6('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e987b['options']?_0x2e987b[_0xbde6('0x15')][_0xbde6('0x16')]||null:null,'attributes':_0x2e987b['options']?_0x2e987b[_0xbde6('0x15')][_0xbde6('0x17')]||null:null,'limit':_0x2e987b[_0xbde6('0x15')]?_0x2e987b[_0xbde6('0x15')][_0xbde6('0x18')]||null:null})['then'](function(_0x57b40d){logger[_0xbde6('0xc')](_0xbde6('0x12'),_0x2e987b);logger['debug'](_0xbde6('0x12'),_0x2e987b,JSON[_0xbde6('0x19')](_0x57b40d));_0x37ef0c(_0x57b40d);})['catch'](function(_0x45f19d){logger[_0xbde6('0xf')](_0xbde6('0x12'),_0x45f19d[_0xbde6('0x10')],_0x2e987b);_0x196c95(_0x27838d[_0xbde6('0xf')](0x1f4,_0x45f19d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 38f8641..0e6c697 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 _0xdd42=['/:id/download','download','create','addMessage','post','mailinteraction:addtags','put','/:id','tracked','mail','mailinteraction:update','update','delete','destroy','/:id/tags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages'];(function(_0x5c2b52,_0x4fa1bd){var _0x2819b0=function(_0x59ffca){while(--_0x59ffca){_0x5c2b52['push'](_0x5c2b52['shift']());}};_0x2819b0(++_0x4fa1bd);}(_0xdd42,0x139));var _0x2dd4=function(_0x3279e4,_0x5181a2){_0x3279e4=_0x3279e4-0x0;var _0x4849ed=_0xdd42[_0x3279e4];return _0x4849ed;};'use strict';var express=require(_0x2dd4('0x0'));var router=express['Router']();var auth=require(_0x2dd4('0x1'));var interaction=require(_0x2dd4('0x2'));var controller=require(_0x2dd4('0x3'));router[_0x2dd4('0x4')]('/',auth[_0x2dd4('0x5')](),controller[_0x2dd4('0x6')]);router['get']('/describe',auth[_0x2dd4('0x5')](),controller[_0x2dd4('0x7')]);router[_0x2dd4('0x4')]('/:id',auth[_0x2dd4('0x5')](),controller[_0x2dd4('0x8')]);router['get'](_0x2dd4('0x9'),auth['isAuthenticated'](),controller[_0x2dd4('0xa')]);router[_0x2dd4('0x4')](_0x2dd4('0xb'),auth[_0x2dd4('0x5')](),controller[_0x2dd4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2dd4('0xd')]);router['post'](_0x2dd4('0x9'),auth[_0x2dd4('0x5')](),controller[_0x2dd4('0xe')]);router[_0x2dd4('0xf')]('/:id/tags',auth[_0x2dd4('0x5')](),interaction['tracked']('mail',_0x2dd4('0x10')),controller['addTags']);router[_0x2dd4('0x11')](_0x2dd4('0x12'),auth['isAuthenticated'](),interaction[_0x2dd4('0x13')](_0x2dd4('0x14'),_0x2dd4('0x15')),controller[_0x2dd4('0x16')]);router[_0x2dd4('0x17')](_0x2dd4('0x12'),auth[_0x2dd4('0x5')](),interaction[_0x2dd4('0x13')](_0x2dd4('0x14'),'mailinteraction:destroy'),controller[_0x2dd4('0x18')]);router[_0x2dd4('0x17')](_0x2dd4('0x19'),auth[_0x2dd4('0x5')](),controller['removeTags']);module[_0x2dd4('0x1a')]=router; \ No newline at end of file +var _0xef72=['./mailInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','mail','put','update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3bd6ea,_0x4cdd1c){var _0x1d5da2=function(_0x1b341e){while(--_0x1b341e){_0x3bd6ea['push'](_0x3bd6ea['shift']());}};_0x1d5da2(++_0x4cdd1c);}(_0xef72,0x9f));var _0x2ef7=function(_0x37ace5,_0x5546de){_0x37ace5=_0x37ace5-0x0;var _0x235299=_0xef72[_0x37ace5];return _0x235299;};'use strict';var express=require('express');var router=express[_0x2ef7('0x0')]();var auth=require(_0x2ef7('0x1'));var interaction=require(_0x2ef7('0x2'));var controller=require(_0x2ef7('0x3'));router[_0x2ef7('0x4')]('/',auth['isAuthenticated'](),controller[_0x2ef7('0x5')]);router[_0x2ef7('0x4')](_0x2ef7('0x6'),auth['isAuthenticated'](),controller[_0x2ef7('0x7')]);router[_0x2ef7('0x4')](_0x2ef7('0x8'),auth[_0x2ef7('0x9')](),controller[_0x2ef7('0xa')]);router[_0x2ef7('0x4')](_0x2ef7('0xb'),auth['isAuthenticated'](),controller[_0x2ef7('0xc')]);router[_0x2ef7('0x4')](_0x2ef7('0xd'),auth[_0x2ef7('0x9')](),controller[_0x2ef7('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2ef7('0xf')]);router[_0x2ef7('0x10')](_0x2ef7('0xb'),auth['isAuthenticated'](),controller[_0x2ef7('0x11')]);router['post']('/:id/tags',auth[_0x2ef7('0x9')](),interaction[_0x2ef7('0x12')](_0x2ef7('0x13'),'mailinteraction:addtags'),controller['addTags']);router[_0x2ef7('0x14')](_0x2ef7('0x8'),auth['isAuthenticated'](),interaction['tracked'](_0x2ef7('0x13'),'mailinteraction:update'),controller[_0x2ef7('0x15')]);router[_0x2ef7('0x16')](_0x2ef7('0x8'),auth[_0x2ef7('0x9')](),interaction[_0x2ef7('0x12')](_0x2ef7('0x13'),_0x2ef7('0x17')),controller['destroy']);router[_0x2ef7('0x16')](_0x2ef7('0x18'),auth[_0x2ef7('0x9')](),controller[_0x2ef7('0x19')]);module[_0x2ef7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 2ec2160..5d0ca2b 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 _0xa1cc=['long','DATE','out','sequelize','iconv','exports','BOOLEAN','STRING','TEXT'];(function(_0xad61ea,_0x31b34a){var _0x3e56f7=function(_0x2887b8){while(--_0x2887b8){_0xad61ea['push'](_0xad61ea['shift']());}};_0x3e56f7(++_0x31b34a);}(_0xa1cc,0x93));var _0xca1c=function(_0x56fc02,_0x5b0ffe){_0x56fc02=_0x56fc02-0x0;var _0x4b295e=_0xa1cc[_0x56fc02];return _0x4b295e;};'use strict';var Sequelize=require(_0xca1c('0x0'));var iconv=require(_0xca1c('0x1'));module[_0xca1c('0x2')]={'closed':{'type':Sequelize[_0xca1c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xca1c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xca1c('0x4')]},'note':{'type':Sequelize[_0xca1c('0x4')]},'inReplyTo':{'type':Sequelize[_0xca1c('0x4')](0x1fe)},'to':{'type':Sequelize[_0xca1c('0x4')]},'cc':{'type':Sequelize[_0xca1c('0x5')](_0xca1c('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xca1c('0x7')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xca1c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xca1c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8878=['ENUM','out','sequelize','BOOLEAN','STRING','TEXT','long','DATE'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8878,0x8a));var _0x8887=function(_0x5c4444,_0x119726){_0x5c4444=_0x5c4444-0x0;var _0x20d93d=_0x8878[_0x5c4444];return _0x20d93d;};'use strict';var Sequelize=require(_0x8887('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x8887('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8887('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8887('0x2')]},'note':{'type':Sequelize[_0x8887('0x2')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x8887('0x2')]},'cc':{'type':Sequelize[_0x8887('0x3')](_0x8887('0x4'))},'subject':{'type':Sequelize[_0x8887('0x3')]()},'attach':{'type':Sequelize[_0x8887('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8887('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x8887('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x8887('0x6')]('in',_0x8887('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8887('0x6')]('in',_0x8887('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8887('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d34e67e..83c77c2 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 _0xad05=['CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','merge','MailInteraction','Account.key','a.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','rawAttributes','includeAll','include','options','create','body','describe','addMessage','omit','ids','filter','YYYY-MM-DD\x20HH:mm:ss','inlineCss','addTags','setTags','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','get','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','path','lodash','squel','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','-id','plainBody','lastMsgText','catch','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','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'];(function(_0x5e4424,_0xf1d263){var _0xc88ea9=function(_0x18444c){while(--_0x18444c){_0x5e4424['push'](_0x5e4424['shift']());}};_0xc88ea9(++_0xf1d263);}(_0xad05,0x85));var _0x5ad0=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0xad05[_0x470e67];return _0x28bbde;};'use strict';var emlformat=require(_0x5ad0('0x0'));var rimraf=require(_0x5ad0('0x1'));var zipdir=require('zip-dir');var moment=require(_0x5ad0('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x5ad0('0x3'));var fs=require('fs');var _=require(_0x5ad0('0x4'));var squel=require(_0x5ad0('0x5'));var juice=require(_0x5ad0('0x6'));var Redis=require('ioredis');var qs=require(_0x5ad0('0x7'));var as=require(_0x5ad0('0x8'));var logger=require('../../config/logger')(_0x5ad0('0x9'));var config=require(_0x5ad0('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x5ad0('0xb'));config[_0x5ad0('0xc')]=_[_0x5ad0('0xd')](config[_0x5ad0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5ad0('0xe'))(new Redis(config[_0x5ad0('0xc')]));require(_0x5ad0('0xf'))[_0x5ad0('0x10')](socket);function respondWithStatusCode(_0x2cb62c,_0x1f8989){_0x1f8989=_0x1f8989||0xcc;return function(_0x27a52d){if(_0x27a52d){return _0x2cb62c[_0x5ad0('0x11')](_0x1f8989);}return _0x2cb62c['status'](_0x1f8989)['end']();};}function respondWithResult(_0x1ff00b,_0x444b1a){_0x444b1a=_0x444b1a||0xc8;return function(_0x19fd11){if(_0x19fd11){return _0x1ff00b[_0x5ad0('0x12')](_0x444b1a)[_0x5ad0('0x13')](_0x19fd11);}};}function respondWithFilteredResult(_0x75bdc6,_0x37e9f5){return function(_0xb8bdd5){if(_0xb8bdd5){var _0x5e6d91=typeof _0x37e9f5[_0x5ad0('0x14')]===_0x5ad0('0x15')&&typeof _0x37e9f5[_0x5ad0('0x16')]===_0x5ad0('0x15');var _0x5b92db=_0xb8bdd5[_0x5ad0('0x17')];var _0x52010b=_0x5e6d91?0x0:_0x37e9f5[_0x5ad0('0x14')];var _0x18de7c=_0x5e6d91?_0xb8bdd5[_0x5ad0('0x17')]:_0x37e9f5[_0x5ad0('0x14')]+_0x37e9f5[_0x5ad0('0x16')];var _0x5f54f1;if(_0x18de7c>=_0x5b92db){_0x18de7c=_0x5b92db;_0x5f54f1=0xc8;}else{_0x5f54f1=0xce;}_0x75bdc6[_0x5ad0('0x12')](_0x5f54f1);return _0x75bdc6[_0x5ad0('0x18')]('Content-Range',_0x52010b+'-'+_0x18de7c+'/'+_0x5b92db)[_0x5ad0('0x13')](_0xb8bdd5);}return null;};}function saveUpdates(_0x149b59){return function(_0x4c1862){if(_0x4c1862){return _0x4c1862[_0x5ad0('0x19')](_0x149b59)['then'](function(_0x44f0a1){return _0x44f0a1;});}return null;};}function removeEntity(_0xcce92b){return function(_0x5c098a){if(_0x5c098a){return _0x5c098a[_0x5ad0('0x1a')]()[_0x5ad0('0x1b')](function(){_0xcce92b[_0x5ad0('0x12')](0xcc)[_0x5ad0('0x1c')]();});}};}function handleEntityNotFound(_0x31333c){return function(_0x10f77b){if(!_0x10f77b){_0x31333c['sendStatus'](0x194);}return _0x10f77b;};}function handleError(_0x385bfe,_0x459eba){_0x459eba=_0x459eba||0x1f4;return function(_0x13cadf){logger[_0x5ad0('0x1d')](_0x13cadf[_0x5ad0('0x1e')]);if(_0x13cadf[_0x5ad0('0x1f')]){delete _0x13cadf[_0x5ad0('0x1f')];}_0x385bfe[_0x5ad0('0x12')](_0x459eba)[_0x5ad0('0x20')](_0x13cadf);};}function getInteractionUsers(_0x2af707,_0x3754a3){return new BPromise(function(_0x317fe9,_0x333b2c){try{if(_0x3754a3[_0x2af707['id']]){_0x2af707[_0x5ad0('0x21')]=_[_0x5ad0('0x22')](_0x3754a3[_0x2af707['id']],function(_0x42a53a){return{'id':_0x42a53a['id'],'fullname':_0x42a53a[_0x5ad0('0x23')]};});}}catch(_0x40c3f1){_0x333b2c(_0x40c3f1);}_0x317fe9(_0x2af707);});}function getInteractionTags(_0x5032e0,_0x1c482d){return new BPromise(function(_0x4129be,_0x4c3e4e){try{if(_0x5032e0[_0x5ad0('0x24')]){_0x5032e0[_0x5ad0('0x25')]=[];_0x5032e0[_0x5ad0('0x24')][_0x5ad0('0x26')](',')[_0x5ad0('0x27')](function(_0x888b96){_0x5032e0['Tags'][_0x5ad0('0x28')](_0x1c482d[_0x888b96]);});}delete _0x5032e0[_0x5ad0('0x24')];}catch(_0x1a486e){_0x4c3e4e(_0x1a486e);}_0x4129be(_0x5032e0);});}function getLastMessageText(_0x170bf7){return new BPromise(function(_0x17cc66,_0x4e0284){return db[_0x5ad0('0x29')][_0x5ad0('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x170bf7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5ad0('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x5ad0('0x2c'),'raw':!![]})[_0x5ad0('0x1b')](function(_0x2be531){if(_0x2be531&&_0x2be531[_0x5ad0('0x2d')]){_0x170bf7[_0x5ad0('0x2e')]=_['trimStart'](_0x2be531[_0x5ad0('0x2d')]);}_0x17cc66(_0x170bf7);})[_0x5ad0('0x2f')](function(_0x3cffa9){_0x4e0284(_0x3cffa9);});});}function updateMailInteraction(_0x506831,_0x5346e4,_0x7702c1,_0x269871){return new BPromise(function(_0xbcedad,_0xffdd6e){return getInteractionUsers(_0x506831,_0x7702c1)[_0x5ad0('0x1b')](function(_0x444f75){return getInteractionTags(_0x444f75,_0x5346e4);})['then'](function(_0x3933d1){if(_0x269871){_0xbcedad(getLastMessageText(_0x3933d1));}else{_0xbcedad(_0x3933d1);}})[_0x5ad0('0x2f')](function(_0x20e6be){_0xffdd6e(_0x20e6be);});});}exports['index']=function(_0x2e61cc,_0xd13ad9){var _0x948f87={},_0x26dc1d={},_0x245e04={'count':0x0,'rows':[]};var _0x7f72=_['map'](db['MailInteraction']['rawAttributes'],function(_0x4466b8){return{'name':_0x4466b8[_0x5ad0('0x30')],'type':_0x4466b8[_0x5ad0('0x31')][_0x5ad0('0x32')]};});_0x26dc1d[_0x5ad0('0x33')]=_['map'](_0x7f72,'name');_0x26dc1d[_0x5ad0('0x34')]=_[_0x5ad0('0x35')](_0x2e61cc['query']);_0x26dc1d[_0x5ad0('0x36')]=_['intersection'](_0x26dc1d['model'],_0x26dc1d[_0x5ad0('0x34')]);_0x948f87[_0x5ad0('0x37')]=_[_0x5ad0('0x38')](_0x26dc1d['model'],qs[_0x5ad0('0x39')](_0x2e61cc[_0x5ad0('0x34')][_0x5ad0('0x39')]));_0x948f87[_0x5ad0('0x37')]=_0x948f87[_0x5ad0('0x37')][_0x5ad0('0x3a')]?_0x948f87['attributes']:_0x26dc1d['model'];if(!_0x2e61cc[_0x5ad0('0x34')][_0x5ad0('0x3b')](_0x5ad0('0x3c'))){_0x948f87['limit']=qs['limit'](_0x2e61cc['query'][_0x5ad0('0x16')]);_0x948f87[_0x5ad0('0x14')]=qs['offset'](_0x2e61cc[_0x5ad0('0x34')]['offset']);}_0x948f87[_0x5ad0('0x3d')]=qs[_0x5ad0('0x3e')](_0x2e61cc[_0x5ad0('0x34')]['sort']);_0x948f87[_0x5ad0('0x3f')]=qs[_0x5ad0('0x36')](_[_0x5ad0('0x40')](_0x2e61cc[_0x5ad0('0x34')],_0x26dc1d['filters']),_0x7f72);var _0x176e99=[];var _0x378d2f=squel[_0x5ad0('0x41')]()[_0x5ad0('0x42')]('id')[_0x5ad0('0x42')](_0x5ad0('0x1f'))[_0x5ad0('0x42')](_0x5ad0('0x43'))[_0x5ad0('0x44')](_0x5ad0('0x45'));var _0x23862f=squel[_0x5ad0('0x41')]()['field'](_0x5ad0('0x46'))[_0x5ad0('0x42')](_0x5ad0('0x47'))[_0x5ad0('0x42')](_0x5ad0('0x48'))[_0x5ad0('0x44')](_0x5ad0('0x49'),'ui')[_0x5ad0('0x4a')](_0x5ad0('0x4b'),'u','u.id\x20=\x20ui.UserId');var _0x362e0f=squel[_0x5ad0('0x41')]()[_0x5ad0('0x44')]('mail_interactions','i')[_0x5ad0('0x4a')](_0x5ad0('0x4c'),'c',_0x5ad0('0x4d'))['left_join'](_0x5ad0('0x4b'),'o',_0x5ad0('0x4e'))[_0x5ad0('0x4a')](_0x5ad0('0x4f'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0x5ad0('0x50'),'me',_0x5ad0('0x51'))[_0x5ad0('0x4a')]('mail_interaction_has_tags','it',_0x5ad0('0x52'))[_0x5ad0('0x4a')]('tools_tags','t',_0x5ad0('0x53'));var _0x2f9e38=squel[_0x5ad0('0x54')]();var _0x530e4b=[];var _0xe84171=squel[_0x5ad0('0x54')]();var _0x1eea2f;if(_0x2e61cc['query'][_0x5ad0('0x55')]){_0x1eea2f=as[_0x5ad0('0x56')](_0x2e61cc[_0x5ad0('0x34')]['search']);var _0x48b35f=_0x1eea2f[_0x5ad0('0x57')];for(var _0x4c7de1=0x0;_0x4c7de1<_0x1eea2f[_0x5ad0('0x58')][_0x5ad0('0x3a')];_0x4c7de1++){var _0x10d236=_0x1eea2f[_0x5ad0('0x58')][_0x4c7de1];var _0x11f0ec='i';var _0x189809=_[_0x5ad0('0x59')](_0x7f72,[_0x5ad0('0x1f'),_0x10d236[_0x5ad0('0x42')]]);if(!_0x189809){switch(_0x10d236[_0x5ad0('0x42')]){case _0x5ad0('0x5a'):if(_0x10d236[_0x5ad0('0x5b')]==0x1){_0x362e0f['having']('`'+_0x10d236[_0x5ad0('0x42')]+_0x5ad0('0x5c'));}else{_0x362e0f[_0x5ad0('0x5d')]('`'+_0x10d236['field']+_0x5ad0('0x5e'));}break;case _0x5ad0('0x5f'):if(_0x10d236[_0x5ad0('0x60')]==='$substring'){if(_0x10d236['value'][_0x5ad0('0x26')]('\x20')[_0x5ad0('0x3a')]>0x1){_0x2f9e38[_0x48b35f](_0x5ad0('0x61'),qs[_0x5ad0('0x62')](_0x10d236[_0x5ad0('0x5b')]),null);}else{var _0x2654ea='%'+_0x10d236[_0x5ad0('0x5b')]+'%';_0x2f9e38[_0x48b35f](_0x5ad0('0x63'),_0x2654ea,_0x2654ea,_0x2654ea);}}else{_0x189809=_['find'](_0x7f72,[_0x5ad0('0x1f'),_0x5ad0('0x64')]);_0x10d236[_0x5ad0('0x42')]=_0x5ad0('0x64');_0x1dcdc1=as[_0x5ad0('0x65')](_0x11f0ec,_0x189809['type'],_0x10d236);_0x2f9e38[_0x48b35f](_0x1dcdc1[_0x5ad0('0x66')],_0x1dcdc1['value'][_0x5ad0('0x67')],_0x1dcdc1['value'][_0x5ad0('0x1c')]);}break;case _0x5ad0('0x68'):var _0x1cfc64=_0x10d236[_0x5ad0('0x5b')]['split'](',')[_0x5ad0('0x22')](function(_0x16091d){return Number(_0x16091d);});_0x1cfc64[_0x5ad0('0x27')](function(_0x440fa9){_0xe84171['or'](_0x5ad0('0x69'),'%,'+_0x440fa9+',%');});_0x530e4b=_[_0x5ad0('0x6a')](_0x530e4b,_0x1cfc64);break;case _0x5ad0('0x6b'):if(_0x10d236[_0x5ad0('0x60')]==='$substring'){_0x2f9e38[_0x48b35f](_0x5ad0('0x6c'),'%'+_0x10d236[_0x5ad0('0x5b')]+'%',null);}else{_0x189809=_[_0x5ad0('0x59')](_0x7f72,['name',_0x5ad0('0x6d')]);_0x10d236['field']='UserId';_0x1dcdc1=as[_0x5ad0('0x65')](_0x11f0ec,_0x189809[_0x5ad0('0x31')],_0x10d236);_0x2f9e38[_0x48b35f](_0x1dcdc1[_0x5ad0('0x66')],_0x1dcdc1[_0x5ad0('0x5b')][_0x5ad0('0x67')],_0x1dcdc1[_0x5ad0('0x5b')][_0x5ad0('0x1c')]);}break;case _0x5ad0('0x2d'):_0x1dcdc1=as[_0x5ad0('0x65')]('me',null,_0x10d236);_0x2f9e38[_0x48b35f](_0x1dcdc1[_0x5ad0('0x66')],_0x1dcdc1[_0x5ad0('0x5b')][_0x5ad0('0x67')],_0x1dcdc1['value']['end']);break;}}else{var _0x1dcdc1=as['buildExpression'](_0x11f0ec,_0x189809[_0x5ad0('0x31')],_0x10d236);_0x2f9e38[_0x48b35f](_0x1dcdc1['text'],_0x1dcdc1[_0x5ad0('0x5b')][_0x5ad0('0x67')],_0x1dcdc1[_0x5ad0('0x5b')][_0x5ad0('0x1c')]);}}}else{var _0x217816=_(_0x2e61cc[_0x5ad0('0x34')])[_0x5ad0('0x35')]()[_0x5ad0('0x22')](function(_0x1e823f){return _[_0x5ad0('0x6e')](_0x7f72,[_0x5ad0('0x1f'),_0x1e823f])?_0x1e823f:undefined;})[_0x5ad0('0x6f')]()[_0x5ad0('0x5b')]();if(!_[_0x5ad0('0x70')](_0x217816)){_0x217816[_0x5ad0('0x27')](function(_0xbb463d){if(_0xbb463d==='MailAccountId'){_0x362e0f[_0x5ad0('0x3f')]('i.MailAccountId\x20IN\x20?',[][_0x5ad0('0x71')](_0x2e61cc[_0x5ad0('0x34')][_0xbb463d]));}else if(_0xbb463d===_0x5ad0('0x72')){var _0x578b1a=JSON[_0x5ad0('0x73')](_0x2e61cc['query'][_0xbb463d])[_0x5ad0('0x74')];var _0x3d8722=JSON[_0x5ad0('0x73')](_0x2e61cc[_0x5ad0('0x34')][_0xbb463d])[_0x5ad0('0x75')];_0x362e0f[_0x5ad0('0x3f')](_0x5ad0('0x76'),_0x578b1a,_0x3d8722);}else{if(_0x2e61cc[_0x5ad0('0x34')][_0xbb463d]===_0x5ad0('0x77')){_0x362e0f[_0x5ad0('0x3f')]('i.'+_0xbb463d+'\x20IS\x20NULL');}else{_0x362e0f[_0x5ad0('0x3f')]('i.'+_0xbb463d+_0x5ad0('0x78'),_0x2e61cc[_0x5ad0('0x34')][_0xbb463d]);}}});}if(_0x2e61cc['query'][_0x5ad0('0x79')]){if(_0x2e61cc[_0x5ad0('0x34')]['read']==0x1){_0x362e0f['having'](_0x5ad0('0x7a'));}else{_0x362e0f['having'](_0x5ad0('0x7b'));}}if(_0x2e61cc['query'][_0x5ad0('0x7c')]){_0x530e4b=_['isArray'](_0x2e61cc[_0x5ad0('0x34')]['tag'])?_0x2e61cc[_0x5ad0('0x34')][_0x5ad0('0x7c')]:new Array(_0x2e61cc[_0x5ad0('0x34')][_0x5ad0('0x7c')]);_0x530e4b[_0x5ad0('0x27')](function(_0xde26dc){_0xe84171['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xde26dc+',%');});}if(_0x2e61cc[_0x5ad0('0x34')]['filter']){var _0x3a67f3=_0x2e61cc[_0x5ad0('0x34')]['filter'][_0x5ad0('0x7d')]('\x5c','\x5c\x5c')[_0x5ad0('0x7d')](/'/g,'\x27\x27');if(qs[_0x5ad0('0x7e')](_0x3a67f3)){_0x2f9e38['or'](_0x5ad0('0x7f'),_0x3a67f3+'%');}else if(qs[_0x5ad0('0x80')](_0x3a67f3)){_0x2f9e38['or'](_0x5ad0('0x81'),_0x3a67f3+'%');}else{_0x2f9e38['or'](_0x5ad0('0x82'),qs[_0x5ad0('0x62')](_0x3a67f3))['or'](_0x5ad0('0x83'),qs[_0x5ad0('0x62')](_0x3a67f3));}}}_0x362e0f[_0x5ad0('0x3f')](_0x2f9e38);_0x362e0f[_0x5ad0('0x84')]('i.id');var _0x31cbea={'type':db[_0x5ad0('0x85')]['QueryTypes'][_0x5ad0('0x86')],'raw':!![]};var _0x112fcc=_0x362e0f[_0x5ad0('0x87')]();_0x112fcc[_0x5ad0('0x42')](_0x5ad0('0x88'));_0x112fcc[_0x5ad0('0x42')](_0x5ad0('0x89'),_0x5ad0('0x5a'));if(_0x948f87[_0x5ad0('0x3d')]){_0x948f87[_0x5ad0('0x3d')][_0x5ad0('0x27')](function(_0x450567){var _0x41e878=_0x450567[0x0]===_0x5ad0('0x8a')?_0x450567[0x0]:'i.'+_0x450567[0x0];_0x362e0f['order'](_0x41e878,_0x450567[0x1]===_0x5ad0('0x8b')?![]:!![]);});}if(!_[_0x5ad0('0x70')](_0x530e4b)){_0x362e0f[_0x5ad0('0x5d')](_0xe84171);_0x112fcc['where'](_0x5ad0('0x8c'),_0x530e4b);}BPromise['resolve']()[_0x5ad0('0x1b')](function(){if(!_0x1eea2f){if(_0x2e61cc[_0x5ad0('0x34')][_0x5ad0('0x8d')])return;_0x112fcc[_0x5ad0('0x3f')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x362e0f[_0x5ad0('0x3f')](_0x5ad0('0x8e'));return;}if(_0x2e61cc[_0x5ad0('0x8f')][_0x5ad0('0x90')]!==_0x5ad0('0x91'))return;return _0x2e61cc[_0x5ad0('0x8f')][_0x5ad0('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25169e){if(_[_0x5ad0('0x70')](_0x25169e)){_0x112fcc[_0x5ad0('0x3f')](_0x5ad0('0x93'));_0x362e0f[_0x5ad0('0x3f')]('i.MailAccountId\x20IS\x20NULL');}else{_0x112fcc['where']('i.MailAccountId\x20IN\x20?',_[_0x5ad0('0x22')](_0x25169e,'id'));_0x362e0f['where'](_0x5ad0('0x94'),_[_0x5ad0('0x22')](_0x25169e,'id'));}});})['then'](function(){if(_0x2e61cc[_0x5ad0('0x8f')][_0x5ad0('0x90')]==='agent'&&!_0x1eea2f&&!_0x2e61cc[_0x5ad0('0x34')]['MailAccountId'])return[];return db[_0x5ad0('0x95')]['query'](_0x112fcc[_0x5ad0('0x96')](),_0x31cbea);})[_0x5ad0('0x1b')](function(_0x4b4f1f){_0x245e04['count']=_0x4b4f1f['length'];if(_0x245e04[_0x5ad0('0x17')]===0x0)return[];return db[_0x5ad0('0x95')]['query'](_0x378d2f[_0x5ad0('0x96')](),_0x31cbea)[_0x5ad0('0x1b')](function(_0x23c206){_0x176e99=_['keyBy'](_0x23c206,'id');_0x31cbea=_[_0x5ad0('0x97')](_0x31cbea,{'model':db[_0x5ad0('0x98')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e61cc[_0x5ad0('0x34')][_0x5ad0('0x39')]){_0x948f87['attributes'][_0x5ad0('0x27')](function(_0x225c46){_0x362e0f[_0x5ad0('0x42')]('i.'+_0x225c46);});}else{_0x362e0f[_0x5ad0('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5ad0('0x5a'));_0x362e0f['field']('a.key',_0x5ad0('0x99'));_0x362e0f['field'](_0x5ad0('0x9a'),'Account.mandatoryDisposition');_0x362e0f[_0x5ad0('0x42')]('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');_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0x88'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0x9b'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0x9c'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0x9d'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0x9e'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0x9f'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xa0'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xa1'));_0x362e0f[_0x5ad0('0x42')]('i.subject');_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xa2'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xa3'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xa4'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xa5'));_0x362e0f['field'](_0x5ad0('0xa6'));_0x362e0f['field'](_0x5ad0('0xa7'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xa8'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xa9'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xaa'),_0x5ad0('0xab'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xac'),_0x5ad0('0xad'));_0x362e0f['field'](_0x5ad0('0xae'),_0x5ad0('0xaf'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xb0'),_0x5ad0('0xb1'));_0x362e0f[_0x5ad0('0x42')]('c.mobile',_0x5ad0('0xb2'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xb3'),_0x5ad0('0xb4'));_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xb5'),_0x5ad0('0xb6'));_0x362e0f['field'](_0x5ad0('0xb7'),'Owner.internal');_0x362e0f[_0x5ad0('0x42')](_0x5ad0('0xb8'),_0x5ad0('0x24'));}if(_0x948f87[_0x5ad0('0x16')])_0x362e0f[_0x5ad0('0x16')](_0x948f87[_0x5ad0('0x16')]);if(_0x948f87['offset'])_0x362e0f['offset'](_0x948f87[_0x5ad0('0x14')]);return db[_0x5ad0('0x95')][_0x5ad0('0x34')](_0x362e0f[_0x5ad0('0x96')](),_0x31cbea);})[_0x5ad0('0x1b')](function(_0x2a7cb1){if(_0x2a7cb1[_0x5ad0('0x3a')]>0x0)_0x23862f['where'](_0x5ad0('0xb9'),_['map'](_0x2a7cb1,'id'));return db[_0x5ad0('0x95')][_0x5ad0('0x34')](_0x23862f['toString'](),_0x31cbea)['then'](function(_0x1bb1bb){var _0x56a428=_[_0x5ad0('0xba')](_0x1bb1bb,_0x5ad0('0xbb'));var _0x2c0868=[];return db[_0x5ad0('0xbc')][_0x5ad0('0x2a')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x5ad0('0x1b')](function(_0xfcb010){var _0x5b7093=_0xfcb010[_0x5ad0('0xbd')];_0x2a7cb1[_0x5ad0('0x27')](function(_0x203624){_0x2c0868['push'](updateMailInteraction(_0x203624,_0x176e99,_0x56a428,_0x5b7093));});return BPromise[_0x5ad0('0xbe')](_0x2c0868);});});});})[_0x5ad0('0x1b')](function(_0x5af334){_0x245e04[_0x5ad0('0xbf')]=_0x5af334;return _0x245e04;})['then'](respondWithFilteredResult(_0xd13ad9,_0x948f87))[_0x5ad0('0x2f')](handleError(_0xd13ad9,null));};exports[_0x5ad0('0xc0')]=function(_0x2940ed,_0x2efb7d){var _0x428029={'raw':![],'where':{'id':_0x2940ed[_0x5ad0('0xc1')]['id']}},_0xac8a31={};_0xac8a31['model']=_[_0x5ad0('0x35')](db[_0x5ad0('0x98')][_0x5ad0('0xc2')]);_0xac8a31[_0x5ad0('0x34')]=_[_0x5ad0('0x35')](_0x2940ed[_0x5ad0('0x34')]);_0xac8a31[_0x5ad0('0x36')]=_[_0x5ad0('0x38')](_0xac8a31[_0x5ad0('0x33')],_0xac8a31['query']);_0x428029['attributes']=_[_0x5ad0('0x38')](_0xac8a31['model'],qs['fields'](_0x2940ed[_0x5ad0('0x34')][_0x5ad0('0x39')]));_0x428029[_0x5ad0('0x37')]=_0x428029['attributes'][_0x5ad0('0x3a')]?_0x428029[_0x5ad0('0x37')]:_0xac8a31[_0x5ad0('0x33')];if(_0x2940ed[_0x5ad0('0x34')][_0x5ad0('0xc3')]){_0x428029[_0x5ad0('0xc4')]=[{'all':!![]}];}_0x428029=_[_0x5ad0('0x97')]({},_0x428029,_0x2940ed[_0x5ad0('0xc5')]);return db['MailInteraction']['find'](_0x428029)[_0x5ad0('0x1b')](handleEntityNotFound(_0x2efb7d,null))[_0x5ad0('0x1b')](respondWithResult(_0x2efb7d,null))[_0x5ad0('0x2f')](handleError(_0x2efb7d,null));};exports['create']=function(_0xf81da0,_0x1c0446){return db[_0x5ad0('0x98')][_0x5ad0('0xc6')](_0xf81da0['body'],{})[_0x5ad0('0x1b')](respondWithResult(_0x1c0446,0xc9))[_0x5ad0('0x2f')](handleError(_0x1c0446,null));};exports['update']=function(_0x343bff,_0x2d23f7){if(_0x343bff['body']['id']){delete _0x343bff[_0x5ad0('0xc7')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x343bff[_0x5ad0('0xc1')]['id']}})[_0x5ad0('0x1b')](handleEntityNotFound(_0x2d23f7,null))[_0x5ad0('0x1b')](saveUpdates(_0x343bff['body'],null))['then'](respondWithResult(_0x2d23f7,null))[_0x5ad0('0x2f')](handleError(_0x2d23f7,null));};exports['destroy']=function(_0x2ca65f,_0x1adc8b){return db['MailInteraction']['find']({'where':{'id':_0x2ca65f[_0x5ad0('0xc1')]['id']}})[_0x5ad0('0x1b')](handleEntityNotFound(_0x1adc8b,null))[_0x5ad0('0x1b')](removeEntity(_0x1adc8b,null))[_0x5ad0('0x2f')](handleError(_0x1adc8b,null));};exports[_0x5ad0('0xc8')]=function(_0x15e247,_0x21b7ef){return db[_0x5ad0('0x98')][_0x5ad0('0xc8')]()['then'](respondWithResult(_0x21b7ef,null))[_0x5ad0('0x2f')](handleError(_0x21b7ef,null));};exports[_0x5ad0('0xc9')]=function(_0x11d3bd,_0x100825){return db[_0x5ad0('0x29')]['find']({'where':{'id':_0x11d3bd[_0x5ad0('0xc1')]['id']}})[_0x5ad0('0x1b')](handleEntityNotFound(_0x100825,null))[_0x5ad0('0x1b')](function(_0x414bd4){if(_0x414bd4){return _0x414bd4['addMessage'](_0x11d3bd[_0x5ad0('0xc7')]['ids'],_[_0x5ad0('0xca')](_0x11d3bd[_0x5ad0('0xc7')],[_0x5ad0('0xcb'),'id'])||{});}})[_0x5ad0('0x1b')](respondWithResult(_0x100825,null))[_0x5ad0('0x2f')](handleError(_0x100825,null));};exports['getMessages']=function(_0x27ef73,_0x4c6914){var _0x2fb853={'raw':![],'where':{}};var _0xe960e={};var _0x3bee36={'count':0x0,'rows':[]};return db['MailInteraction'][_0x5ad0('0x2a')]({'where':{'id':_0x27ef73[_0x5ad0('0xc1')]['id']}})[_0x5ad0('0x1b')](handleEntityNotFound(_0x4c6914,null))['then'](function(_0x10ad3e){if(_0x10ad3e){_0xe960e[_0x5ad0('0x33')]=_[_0x5ad0('0x35')](db[_0x5ad0('0x29')][_0x5ad0('0xc2')]);_0xe960e[_0x5ad0('0x34')]=_[_0x5ad0('0x35')](_0x27ef73[_0x5ad0('0x34')]);_0xe960e[_0x5ad0('0x36')]=_['intersection'](_0xe960e[_0x5ad0('0x33')],_0xe960e['query']);_0x2fb853[_0x5ad0('0x37')]=_[_0x5ad0('0x38')](_0xe960e['model'],qs['fields'](_0x27ef73[_0x5ad0('0x34')][_0x5ad0('0x39')]));_0x2fb853['attributes']=_0x2fb853['attributes'][_0x5ad0('0x3a')]?_0x2fb853[_0x5ad0('0x37')]:_0xe960e['model'];if(!_0x27ef73[_0x5ad0('0x34')][_0x5ad0('0x3b')]('nolimit')){_0x2fb853['limit']=qs[_0x5ad0('0x16')](_0x27ef73[_0x5ad0('0x34')][_0x5ad0('0x16')]);_0x2fb853['offset']=qs[_0x5ad0('0x14')](_0x27ef73['query']['offset']);}_0x2fb853[_0x5ad0('0x3d')]=qs[_0x5ad0('0x3e')](_0x27ef73[_0x5ad0('0x34')][_0x5ad0('0x3e')]);_0x2fb853[_0x5ad0('0x3f')]=qs[_0x5ad0('0x36')](_[_0x5ad0('0x40')](_0x27ef73[_0x5ad0('0x34')],_0xe960e[_0x5ad0('0x36')]));_0x2fb853[_0x5ad0('0x3f')][_0x5ad0('0xbb')]=_0x10ad3e['id'];if(_0x27ef73[_0x5ad0('0x34')][_0x5ad0('0xcc')]){_0x2fb853['where']=_['merge'](_0x2fb853[_0x5ad0('0x3f')],{'$or':_['map'](_0x2fb853[_0x5ad0('0x37')],function(_0x5ededc){var _0x1a9545={};_0x1a9545[_0x5ededc]={'$like':'%'+_0x27ef73[_0x5ad0('0x34')][_0x5ad0('0xcc')]+'%'};return _0x1a9545;})});}if(_0x27ef73['query']['$gte']){var _0x6ee082=_0x27ef73['query'][_0x5ad0('0x74')][_0x5ad0('0x26')](',');var _0x5c040f={};_0x5c040f[_0x6ee082[0x0]]={'$gte':moment(_0x6ee082[0x1])['format'](_0x5ad0('0xcd'))};_0x2fb853[_0x5ad0('0x3f')]=_['merge'](_0x2fb853[_0x5ad0('0x3f')],_0x5c040f);}_0x2fb853=_[_0x5ad0('0x97')]({},_0x2fb853,_0x27ef73[_0x5ad0('0xc5')]);return db[_0x5ad0('0x29')][_0x5ad0('0x17')]({'where':_0x2fb853[_0x5ad0('0x3f')]})[_0x5ad0('0x1b')](function(_0x37c907){_0x3bee36[_0x5ad0('0x17')]=_0x37c907;if(_0x27ef73['query']['includeAll']){_0x2fb853[_0x5ad0('0xc4')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x2fb853);})[_0x5ad0('0x1b')](function(_0x2cf008){if(_0x27ef73[_0x5ad0('0x34')][_0x5ad0('0xce')]==='true'){for(var _0x2e3b81=0x0;_0x2e3b81<_0x2cf008[_0x5ad0('0x3a')];_0x2e3b81++){_0x2cf008[_0x2e3b81]['body']=juice(_0x2cf008[_0x2e3b81][_0x5ad0('0xc7')]);}}_0x3bee36['rows']=_0x2cf008;return _0x3bee36;});}})[_0x5ad0('0x1b')](respondWithFilteredResult(_0x4c6914,_0x2fb853))[_0x5ad0('0x2f')](handleError(_0x4c6914,null));};exports[_0x5ad0('0xcf')]=function(_0x48ff83,_0x55ac50){return db[_0x5ad0('0x98')]['find']({'where':{'id':_0x48ff83['params']['id']}})[_0x5ad0('0x1b')](handleEntityNotFound(_0x55ac50,null))[_0x5ad0('0x1b')](function(_0x59ea25){if(_0x59ea25){return _0x59ea25[_0x5ad0('0xd0')](_0x48ff83[_0x5ad0('0xc7')]['ids'],_[_0x5ad0('0xca')](_0x48ff83[_0x5ad0('0xc7')],[_0x5ad0('0xcb'),'id'])||{})['spread'](function(){return db[_0x5ad0('0x68')][_0x5ad0('0xd1')]({'attributes':['id',_0x5ad0('0x1f'),_0x5ad0('0x43')],'where':{'id':_0x48ff83['body'][_0x5ad0('0xcb')]}});})[_0x5ad0('0x1b')](function(_0xd7f3ea){socket[_0x5ad0('0xd2')](_0x5ad0('0xd3'),{'id':Number(_0x48ff83[_0x5ad0('0xc1')]['id']),'tags':_0xd7f3ea||[]});return{'id':Number(_0x48ff83['params']['id']),'tags':_0xd7f3ea||[]};});}})[_0x5ad0('0x1b')](respondWithResult(_0x55ac50,null))['catch'](handleError(_0x55ac50,null));};exports['removeTags']=function(_0x703216,_0x395eca){return db['MailInteraction']['find']({'where':{'id':_0x703216[_0x5ad0('0xc1')]['id']}})[_0x5ad0('0x1b')](handleEntityNotFound(_0x395eca,null))[_0x5ad0('0x1b')](function(_0x8c1c78){if(_0x8c1c78){return _0x8c1c78[_0x5ad0('0xd4')](_0x703216[_0x5ad0('0x34')][_0x5ad0('0xcb')]);}})[_0x5ad0('0x1b')](respondWithStatusCode(_0x395eca,null))['catch'](handleError(_0x395eca,null));};exports[_0x5ad0('0xd5')]=function(_0x264a11,_0x1262b5){var _0x3360ea=moment()[_0x5ad0('0xd6')]()[_0x5ad0('0x96')]();var _0x10ab90=path[_0x5ad0('0xd7')](config['root'],_0x5ad0('0xd8'),_0x5ad0('0xd9'),_0x5ad0('0xda'));var _0x5a9f31=path[_0x5ad0('0xd7')](config['root'],_0x5ad0('0xd8'),_0x5ad0('0xd9'),'attachments');var _0x3ef7c4=path[_0x5ad0('0xd7')](_0x10ab90,_0x3360ea);var _0x217ba1=util[_0x5ad0('0xdb')](_0x5ad0('0xdc'),_0x264a11[_0x5ad0('0xc1')]['id'],_0x3360ea);var _0x52c7df=path[_0x5ad0('0xd7')](_0x10ab90,_0x217ba1);var _0x3137aa=[];if(_0x264a11['query']['attachments']){_0x3137aa['push']({'model':db[_0x5ad0('0xdd')],'as':_0x5ad0('0xde'),'raw':!![]});}var _0x5c21dd=[{'model':db[_0x5ad0('0x29')],'as':_0x5ad0('0xdf'),'attributes':['id','body',_0x5ad0('0x44'),'to','cc',_0x5ad0('0xe0'),'subject',_0x5ad0('0x72')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x3137aa}];return db[_0x5ad0('0x98')][_0x5ad0('0x59')]({'where':{'id':_0x264a11[_0x5ad0('0xc1')]['id']},'include':_0x5c21dd})[_0x5ad0('0x1b')](handleEntityNotFound(_0x1262b5,null))['then'](function(_0x3ad9a6){if(_0x3ad9a6&&_0x3ad9a6[_0x5ad0('0xdf')]){var _0x470d3c=_0x3ad9a6[_0x5ad0('0xe1')]({'plain':!![]});fs['mkdirSync'](_0x3ef7c4);return BPromise[_0x5ad0('0xe2')](_0x470d3c[_0x5ad0('0xdf')],function(_0x54118d,_0x46592c){var _0x27cecc={'from':_0x54118d[_0x5ad0('0x44')],'to':_0x54118d['to'],'subject':_0x54118d[_0x5ad0('0xe3')],'html':htmlEntities[_0x5ad0('0xe4')](_0x54118d[_0x5ad0('0xc7')]),'headers':{'Date':moment(_0x54118d[_0x5ad0('0x72')])['format'](_0x5ad0('0xe5'))},'attachments':[]};if(_0x54118d['cc']){_0x27cecc[_0x5ad0('0xe6')]['Cc']=_0x54118d['cc'];}if(_0x54118d[_0x5ad0('0xe0')]){_0x27cecc['headers'][_0x5ad0('0xe7')]=_0x54118d[_0x5ad0('0xe0')];}return new BPromise(function(_0x306b65,_0x9d858c){if(_0x54118d['Attachments']){for(var _0x2c51a5=0x0;_0x2c51a5<_0x54118d[_0x5ad0('0xde')][_0x5ad0('0x3a')];_0x2c51a5++){var _0x2c8f32=_0x54118d[_0x5ad0('0xde')][_0x2c51a5];var _0x156063=path[_0x5ad0('0xd7')](_0x5a9f31,_0x2c8f32[_0x5ad0('0xe8')]);if(fs[_0x5ad0('0xe9')](_0x156063)){_0x27cecc['attachments'][_0x5ad0('0x28')]({'name':_0x2c8f32[_0x5ad0('0x1f')],'contentType':_0x2c8f32[_0x5ad0('0x31')],'data':fs['readFileSync'](_0x156063)});}}}emlformat[_0x5ad0('0xea')](_0x27cecc,function(_0x13bb6f,_0x1a0195){if(_0x13bb6f)return _0x9d858c(_0x13bb6f);fs[_0x5ad0('0xeb')](path['join'](_0x3ef7c4,util['format'](_0x5ad0('0xec'),_0x46592c)),_0x1a0195);return _0x306b65(_0x1a0195);});});})[_0x5ad0('0x1b')](function(){return new BPromise(function(_0x36791c,_0x51c13b){zipdir(_0x3ef7c4,{'saveTo':_0x52c7df},function(_0x1b4f8a,_0x21e6ca){if(_0x1b4f8a)return _0x51c13b(_0x1b4f8a);return _0x36791c(_0x21e6ca);});})[_0x5ad0('0x1b')](function(){return new BPromise(function(_0x58ab6a,_0x2ea441){rimraf(_0x3ef7c4,function(_0x4553a8){if(_0x4553a8)_0x2ea441(_0x4553a8);return _0x58ab6a();});});})[_0x5ad0('0x1b')](function(){return _0x1262b5[_0x5ad0('0xd5')](_0x52c7df,_0x217ba1,function(_0x53a06c){if(!_0x53a06c)fs[_0x5ad0('0xed')](_0x52c7df);});});});}else{return _0x1262b5[_0x5ad0('0x11')](0xc8);}})[_0x5ad0('0x2f')](handleError(_0x1262b5,null));}; \ No newline at end of file +var _0xab1e=['YYYY-MM-DD\x20HH:mm:ss','include','findAll','inlineCss','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','moment','bluebird','lodash','squel','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','set','update','destroy','then','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','map','MailInteraction','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','split','getFullTextValue','find','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','count','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','toString','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','params','keys','includeAll','options','create','body','describe','addMessage','ids','omit','getMessages','format'];(function(_0x43b882,_0x1b41ab){var _0x3286b9=function(_0x3b1688){while(--_0x3b1688){_0x43b882['push'](_0x43b882['shift']());}};_0x3286b9(++_0x1b41ab);}(_0xab1e,0x105));var _0xeab1=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xab1e[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0xeab1('0x0'));var rimraf=require(_0xeab1('0x1'));var zipdir=require(_0xeab1('0x2'));var moment=require(_0xeab1('0x3'));var BPromise=require(_0xeab1('0x4'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xeab1('0x5'));var squel=require(_0xeab1('0x6'));var juice=require(_0xeab1('0x7'));var Redis=require('ioredis');var qs=require(_0xeab1('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xeab1('0x9'))(_0xeab1('0xa'));var config=require(_0xeab1('0xb'));var db=require(_0xeab1('0xc'))['db'];var htmlEntities=require(_0xeab1('0xd'));config['redis']=_[_0xeab1('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeab1('0xf')]));require(_0xeab1('0x10'))[_0xeab1('0x11')](socket);function respondWithStatusCode(_0x45c9da,_0x35ed1f){_0x35ed1f=_0x35ed1f||0xcc;return function(_0x22a7bc){if(_0x22a7bc){return _0x45c9da['sendStatus'](_0x35ed1f);}return _0x45c9da[_0xeab1('0x12')](_0x35ed1f)[_0xeab1('0x13')]();};}function respondWithResult(_0x175847,_0x257ca5){_0x257ca5=_0x257ca5||0xc8;return function(_0x11bbe7){if(_0x11bbe7){return _0x175847[_0xeab1('0x12')](_0x257ca5)[_0xeab1('0x14')](_0x11bbe7);}};}function respondWithFilteredResult(_0x3cf0ff,_0x363eb3){return function(_0x112d6e){if(_0x112d6e){var _0x4d2a8d=typeof _0x363eb3[_0xeab1('0x15')]===_0xeab1('0x16')&&typeof _0x363eb3[_0xeab1('0x17')]===_0xeab1('0x16');var _0x2922d1=_0x112d6e['count'];var _0x4e8091=_0x4d2a8d?0x0:_0x363eb3[_0xeab1('0x15')];var _0x4120a5=_0x4d2a8d?_0x112d6e['count']:_0x363eb3[_0xeab1('0x15')]+_0x363eb3[_0xeab1('0x17')];var _0x464127;if(_0x4120a5>=_0x2922d1){_0x4120a5=_0x2922d1;_0x464127=0xc8;}else{_0x464127=0xce;}_0x3cf0ff[_0xeab1('0x12')](_0x464127);return _0x3cf0ff[_0xeab1('0x18')]('Content-Range',_0x4e8091+'-'+_0x4120a5+'/'+_0x2922d1)[_0xeab1('0x14')](_0x112d6e);}return null;};}function saveUpdates(_0x3f4525){return function(_0x54f069){if(_0x54f069){return _0x54f069[_0xeab1('0x19')](_0x3f4525)['then'](function(_0x326d08){return _0x326d08;});}return null;};}function removeEntity(_0x4865e4){return function(_0x59b131){if(_0x59b131){return _0x59b131[_0xeab1('0x1a')]()[_0xeab1('0x1b')](function(){_0x4865e4[_0xeab1('0x12')](0xcc)[_0xeab1('0x13')]();});}};}function handleEntityNotFound(_0x5598fb){return function(_0x23e1d6){if(!_0x23e1d6){_0x5598fb['sendStatus'](0x194);}return _0x23e1d6;};}function handleError(_0x2a2a81,_0x3d74f5){_0x3d74f5=_0x3d74f5||0x1f4;return function(_0x253d8c){logger[_0xeab1('0x1c')](_0x253d8c[_0xeab1('0x1d')]);if(_0x253d8c[_0xeab1('0x1e')]){delete _0x253d8c['name'];}_0x2a2a81[_0xeab1('0x12')](_0x3d74f5)[_0xeab1('0x1f')](_0x253d8c);};}function getInteractionUsers(_0x235639,_0x2a8d7b){return new BPromise(function(_0x340dd8,_0x1d1e24){try{if(_0x2a8d7b[_0x235639['id']]){_0x235639[_0xeab1('0x20')]=_['map'](_0x2a8d7b[_0x235639['id']],function(_0x2cfffc){return{'id':_0x2cfffc['id'],'fullname':_0x2cfffc[_0xeab1('0x21')]};});}}catch(_0x4d0b1d){_0x1d1e24(_0x4d0b1d);}_0x340dd8(_0x235639);});}function getInteractionTags(_0x274d02,_0x1c5f17){return new BPromise(function(_0x5bf681,_0x346b9c){try{if(_0x274d02[_0xeab1('0x22')]){_0x274d02[_0xeab1('0x23')]=[];_0x274d02['TagIds']['split'](',')[_0xeab1('0x24')](function(_0x4116cd){_0x274d02[_0xeab1('0x23')][_0xeab1('0x25')](_0x1c5f17[_0x4116cd]);});}delete _0x274d02[_0xeab1('0x22')];}catch(_0x32dbbd){_0x346b9c(_0x32dbbd);}_0x5bf681(_0x274d02);});}function getLastMessageText(_0xdc17a9){return new BPromise(function(_0x32a4f1,_0x413119){return db[_0xeab1('0x26')][_0xeab1('0x27')]({'where':{'$and':[{'MailInteractionId':_0xdc17a9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xeab1('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xeab1('0x29')],'order':_0xeab1('0x2a'),'raw':!![]})['then'](function(_0x1d1766){if(_0x1d1766&&_0x1d1766['plainBody']){_0xdc17a9[_0xeab1('0x2b')]=_[_0xeab1('0x2c')](_0x1d1766[_0xeab1('0x29')]);}_0x32a4f1(_0xdc17a9);})[_0xeab1('0x2d')](function(_0x1c6717){_0x413119(_0x1c6717);});});}function updateMailInteraction(_0x10a747,_0x252b8f,_0x2d5784,_0x55a994){return new BPromise(function(_0x5e7333,_0x6cc8f8){return getInteractionUsers(_0x10a747,_0x2d5784)[_0xeab1('0x1b')](function(_0x180e5f){return getInteractionTags(_0x180e5f,_0x252b8f);})['then'](function(_0x4b7009){if(_0x55a994){_0x5e7333(getLastMessageText(_0x4b7009));}else{_0x5e7333(_0x4b7009);}})[_0xeab1('0x2d')](function(_0x50e3dd){_0x6cc8f8(_0x50e3dd);});});}exports[_0xeab1('0x2e')]=function(_0x10570b,_0x126a23){var _0x3dac73={},_0x53e4fd={},_0x1a817a={'count':0x0,'rows':[]};var _0x4866f8=_[_0xeab1('0x2f')](db[_0xeab1('0x30')][_0xeab1('0x31')],function(_0x565acd){return{'name':_0x565acd[_0xeab1('0x32')],'type':_0x565acd[_0xeab1('0x33')][_0xeab1('0x34')]};});_0x53e4fd[_0xeab1('0x35')]=_[_0xeab1('0x2f')](_0x4866f8,_0xeab1('0x1e'));_0x53e4fd['query']=_['keys'](_0x10570b['query']);_0x53e4fd[_0xeab1('0x36')]=_[_0xeab1('0x37')](_0x53e4fd[_0xeab1('0x35')],_0x53e4fd['query']);_0x3dac73[_0xeab1('0x38')]=_[_0xeab1('0x37')](_0x53e4fd['model'],qs['fields'](_0x10570b[_0xeab1('0x39')][_0xeab1('0x3a')]));_0x3dac73['attributes']=_0x3dac73[_0xeab1('0x38')][_0xeab1('0x3b')]?_0x3dac73[_0xeab1('0x38')]:_0x53e4fd[_0xeab1('0x35')];if(!_0x10570b[_0xeab1('0x39')][_0xeab1('0x3c')](_0xeab1('0x3d'))){_0x3dac73[_0xeab1('0x17')]=qs['limit'](_0x10570b[_0xeab1('0x39')][_0xeab1('0x17')]);_0x3dac73['offset']=qs[_0xeab1('0x15')](_0x10570b['query']['offset']);}_0x3dac73[_0xeab1('0x3e')]=qs[_0xeab1('0x3f')](_0x10570b[_0xeab1('0x39')][_0xeab1('0x3f')]);_0x3dac73[_0xeab1('0x40')]=qs[_0xeab1('0x36')](_[_0xeab1('0x41')](_0x10570b[_0xeab1('0x39')],_0x53e4fd[_0xeab1('0x36')]),_0x4866f8);var _0x250bfe=[];var _0x165609=squel[_0xeab1('0x42')]()[_0xeab1('0x43')]('id')[_0xeab1('0x43')](_0xeab1('0x1e'))[_0xeab1('0x43')](_0xeab1('0x44'))[_0xeab1('0x45')](_0xeab1('0x46'));var _0x290f30=squel[_0xeab1('0x42')]()[_0xeab1('0x43')](_0xeab1('0x47'))[_0xeab1('0x43')](_0xeab1('0x48'))['field']('ui.MailInteractionId')[_0xeab1('0x45')]('user_has_mail_interactions','ui')['left_join'](_0xeab1('0x49'),'u',_0xeab1('0x4a'));var _0x522c80=squel[_0xeab1('0x42')]()[_0xeab1('0x45')](_0xeab1('0x4b'),'i')[_0xeab1('0x4c')](_0xeab1('0x4d'),'c',_0xeab1('0x4e'))[_0xeab1('0x4c')](_0xeab1('0x49'),'o',_0xeab1('0x4f'))[_0xeab1('0x4c')](_0xeab1('0x50'),'a','a.id\x20=\x20i.MailAccountId')[_0xeab1('0x4c')]('mail_messages','me',_0xeab1('0x51'))[_0xeab1('0x4c')](_0xeab1('0x52'),'it',_0xeab1('0x53'))['left_join'](_0xeab1('0x46'),'t',_0xeab1('0x54'));var _0x29f6fe=squel[_0xeab1('0x55')]();var _0x58d48c=[];var _0x297f8b=squel[_0xeab1('0x55')]();var _0x54a361;if(_0x10570b[_0xeab1('0x39')]['search']){_0x54a361=as['parseSearch'](_0x10570b['query']['search']);var _0x5b0cb3=_0x54a361[_0xeab1('0x56')];for(var _0x40f517=0x0;_0x40f517<_0x54a361[_0xeab1('0x57')][_0xeab1('0x3b')];_0x40f517++){var _0x57a9b9=_0x54a361[_0xeab1('0x57')][_0x40f517];var _0x2b0539='i';var _0x338349=_['find'](_0x4866f8,[_0xeab1('0x1e'),_0x57a9b9['field']]);if(!_0x338349){switch(_0x57a9b9['field']){case _0xeab1('0x58'):if(_0x57a9b9['value']==0x1){_0x522c80[_0xeab1('0x59')]('`'+_0x57a9b9[_0xeab1('0x43')]+_0xeab1('0x5a'));}else{_0x522c80[_0xeab1('0x59')]('`'+_0x57a9b9[_0xeab1('0x43')]+_0xeab1('0x5b'));}break;case _0xeab1('0x5c'):if(_0x57a9b9['operator']===_0xeab1('0x5d')){if(_0x57a9b9[_0xeab1('0x5e')][_0xeab1('0x5f')]('\x20')[_0xeab1('0x3b')]>0x1){_0x29f6fe[_0x5b0cb3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xeab1('0x60')](_0x57a9b9['value']),null);}else{var _0x27a7da='%'+_0x57a9b9[_0xeab1('0x5e')]+'%';_0x29f6fe[_0x5b0cb3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x27a7da,_0x27a7da,_0x27a7da);}}else{_0x338349=_[_0xeab1('0x61')](_0x4866f8,['name',_0xeab1('0x62')]);_0x57a9b9[_0xeab1('0x43')]=_0xeab1('0x62');_0x527fda=as[_0xeab1('0x63')](_0x2b0539,_0x338349[_0xeab1('0x33')],_0x57a9b9);_0x29f6fe[_0x5b0cb3](_0x527fda[_0xeab1('0x64')],_0x527fda['value'][_0xeab1('0x65')],_0x527fda[_0xeab1('0x5e')][_0xeab1('0x13')]);}break;case'Tag':var _0x5c60c6=_0x57a9b9[_0xeab1('0x5e')]['split'](',')[_0xeab1('0x2f')](function(_0x33d4b4){return Number(_0x33d4b4);});_0x5c60c6['forEach'](function(_0x212e6f){_0x297f8b['or'](_0xeab1('0x66'),'%,'+_0x212e6f+',%');});_0x58d48c=_[_0xeab1('0x67')](_0x58d48c,_0x5c60c6);break;case _0xeab1('0x68'):if(_0x57a9b9['operator']===_0xeab1('0x5d')){_0x29f6fe[_0x5b0cb3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x57a9b9[_0xeab1('0x5e')]+'%',null);}else{_0x338349=_[_0xeab1('0x61')](_0x4866f8,[_0xeab1('0x1e'),'UserId']);_0x57a9b9[_0xeab1('0x43')]=_0xeab1('0x69');_0x527fda=as['buildExpression'](_0x2b0539,_0x338349[_0xeab1('0x33')],_0x57a9b9);_0x29f6fe[_0x5b0cb3](_0x527fda[_0xeab1('0x64')],_0x527fda[_0xeab1('0x5e')][_0xeab1('0x65')],_0x527fda['value'][_0xeab1('0x13')]);}break;case _0xeab1('0x29'):_0x527fda=as[_0xeab1('0x63')]('me',null,_0x57a9b9);_0x29f6fe[_0x5b0cb3](_0x527fda['text'],_0x527fda['value']['start'],_0x527fda['value'][_0xeab1('0x13')]);break;}}else{var _0x527fda=as[_0xeab1('0x63')](_0x2b0539,_0x338349[_0xeab1('0x33')],_0x57a9b9);_0x29f6fe[_0x5b0cb3](_0x527fda[_0xeab1('0x64')],_0x527fda[_0xeab1('0x5e')]['start'],_0x527fda['value'][_0xeab1('0x13')]);}}}else{var _0x3af62b=_(_0x10570b[_0xeab1('0x39')])['keys']()[_0xeab1('0x2f')](function(_0x2cc2bc){return _[_0xeab1('0x6a')](_0x4866f8,[_0xeab1('0x1e'),_0x2cc2bc])?_0x2cc2bc:undefined;})[_0xeab1('0x6b')]()[_0xeab1('0x5e')]();if(!_[_0xeab1('0x6c')](_0x3af62b)){_0x3af62b[_0xeab1('0x24')](function(_0x1993e3){if(_0x1993e3===_0xeab1('0x6d')){_0x522c80[_0xeab1('0x40')](_0xeab1('0x6e'),[]['concat'](_0x10570b['query'][_0x1993e3]));}else if(_0x1993e3===_0xeab1('0x6f')){var _0x379980=JSON[_0xeab1('0x70')](_0x10570b[_0xeab1('0x39')][_0x1993e3])[_0xeab1('0x71')];var _0x70455b=JSON[_0xeab1('0x70')](_0x10570b['query'][_0x1993e3])['$lte'];_0x522c80[_0xeab1('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x379980,_0x70455b);}else{if(_0x10570b[_0xeab1('0x39')][_0x1993e3]===_0xeab1('0x72')){_0x522c80[_0xeab1('0x40')]('i.'+_0x1993e3+_0xeab1('0x73'));}else{_0x522c80[_0xeab1('0x40')]('i.'+_0x1993e3+_0xeab1('0x74'),_0x10570b['query'][_0x1993e3]);}}});}if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x75')]){if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x75')]==0x1){_0x522c80[_0xeab1('0x59')](_0xeab1('0x76'));}else{_0x522c80[_0xeab1('0x59')]('`unreadMessages`\x20>\x200');}}if(_0x10570b[_0xeab1('0x39')]['tag']){_0x58d48c=_[_0xeab1('0x77')](_0x10570b['query'][_0xeab1('0x78')])?_0x10570b[_0xeab1('0x39')][_0xeab1('0x78')]:new Array(_0x10570b[_0xeab1('0x39')][_0xeab1('0x78')]);_0x58d48c[_0xeab1('0x24')](function(_0x3ac424){_0x297f8b['or'](_0xeab1('0x66'),'%,'+_0x3ac424+',%');});}if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x79')]){var _0x4ba6c2=_0x10570b['query'][_0xeab1('0x79')][_0xeab1('0x7a')]('\x5c','\x5c\x5c')[_0xeab1('0x7a')](/'/g,'\x27\x27');if(qs[_0xeab1('0x7b')](_0x4ba6c2)){_0x29f6fe['or'](_0xeab1('0x7c'),_0x4ba6c2+'%');}else if(qs['isEmail'](_0x4ba6c2)){_0x29f6fe['or'](_0xeab1('0x7d'),_0x4ba6c2+'%');}else{_0x29f6fe['or'](_0xeab1('0x7e'),qs[_0xeab1('0x60')](_0x4ba6c2))['or'](_0xeab1('0x7f'),qs[_0xeab1('0x60')](_0x4ba6c2));}}}_0x522c80['where'](_0x29f6fe);_0x522c80[_0xeab1('0x80')](_0xeab1('0x81'));var _0x54e179={'type':db[_0xeab1('0x82')][_0xeab1('0x83')]['SELECT'],'raw':!![]};var _0x2958d2=_0x522c80['clone']();_0x2958d2[_0xeab1('0x43')](_0xeab1('0x81'));_0x2958d2['field'](_0xeab1('0x84'),'unreadMessages');if(_0x3dac73[_0xeab1('0x3e')]){_0x3dac73[_0xeab1('0x3e')][_0xeab1('0x24')](function(_0xfadaf){var _0x76342=_0xfadaf[0x0]===_0xeab1('0x85')?_0xfadaf[0x0]:'i.'+_0xfadaf[0x0];_0x522c80[_0xeab1('0x3e')](_0x76342,_0xfadaf[0x1]===_0xeab1('0x86')?![]:!![]);});}if(!_[_0xeab1('0x6c')](_0x58d48c)){_0x522c80[_0xeab1('0x59')](_0x297f8b);_0x2958d2['where']('t.id\x20IN\x20?',_0x58d48c);}BPromise['resolve']()[_0xeab1('0x1b')](function(){if(!_0x54a361){if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x6d')])return;_0x2958d2[_0xeab1('0x40')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x522c80[_0xeab1('0x40')](_0xeab1('0x87'));return;}if(_0x10570b[_0xeab1('0x88')][_0xeab1('0x89')]!==_0xeab1('0x8a'))return;return _0x10570b[_0xeab1('0x88')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xeab1('0x1b')](function(_0x4f6591){if(_[_0xeab1('0x6c')](_0x4f6591)){_0x2958d2['where']('i.MailAccountId\x20IS\x20NULL');_0x522c80[_0xeab1('0x40')](_0xeab1('0x8b'));}else{_0x2958d2[_0xeab1('0x40')](_0xeab1('0x6e'),_[_0xeab1('0x2f')](_0x4f6591,'id'));_0x522c80[_0xeab1('0x40')](_0xeab1('0x6e'),_[_0xeab1('0x2f')](_0x4f6591,'id'));}});})['then'](function(){if(_0x10570b[_0xeab1('0x88')]['role']===_0xeab1('0x8a')&&!_0x54a361&&!_0x10570b[_0xeab1('0x39')][_0xeab1('0x6d')])return[];return db[_0xeab1('0x8c')]['query'](_0x2958d2['toString'](),_0x54e179);})[_0xeab1('0x1b')](function(_0xfd47c6){_0x1a817a[_0xeab1('0x8d')]=_0xfd47c6['length'];if(_0x1a817a['count']===0x0)return[];return db[_0xeab1('0x8c')][_0xeab1('0x39')](_0x165609['toString'](),_0x54e179)[_0xeab1('0x1b')](function(_0x179da0){_0x250bfe=_[_0xeab1('0x8e')](_0x179da0,'id');_0x54e179=_[_0xeab1('0x8f')](_0x54e179,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x3a')]){_0x3dac73['attributes'][_0xeab1('0x24')](function(_0x2a4016){_0x522c80[_0xeab1('0x43')]('i.'+_0x2a4016);});}else{_0x522c80[_0xeab1('0x43')](_0xeab1('0x84'),_0xeab1('0x58'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x90'),'Account.key');_0x522c80[_0xeab1('0x43')](_0xeab1('0x91'),_0xeab1('0x92'));_0x522c80['field'](_0xeab1('0x93'),_0xeab1('0x85'));_0x522c80['field'](_0xeab1('0x81'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x94'));_0x522c80[_0xeab1('0x43')]('i.updatedAt');_0x522c80[_0xeab1('0x43')]('i.closed');_0x522c80[_0xeab1('0x43')](_0xeab1('0x95'));_0x522c80[_0xeab1('0x43')]('i.attach');_0x522c80[_0xeab1('0x43')](_0xeab1('0x96'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x97'));_0x522c80[_0xeab1('0x43')]('i.subject');_0x522c80['field'](_0xeab1('0x98'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x99'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9a'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9b'));_0x522c80['field'](_0xeab1('0x9c'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9d'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9e'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9f'));_0x522c80[_0xeab1('0x43')](_0xeab1('0xa0'),_0xeab1('0xa1'));_0x522c80[_0xeab1('0x43')]('c.lastName',_0xeab1('0xa2'));_0x522c80[_0xeab1('0x43')](_0xeab1('0xa3'),_0xeab1('0xa4'));_0x522c80[_0xeab1('0x43')]('c.phone','Contact.phone');_0x522c80['field']('c.mobile',_0xeab1('0xa5'));_0x522c80[_0xeab1('0x43')](_0xeab1('0xa6'),'Contact.fax');_0x522c80[_0xeab1('0x43')](_0xeab1('0xa7'),_0xeab1('0xa8'));_0x522c80[_0xeab1('0x43')](_0xeab1('0xa9'),'Owner.internal');_0x522c80[_0xeab1('0x43')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xeab1('0x22'));}if(_0x3dac73['limit'])_0x522c80[_0xeab1('0x17')](_0x3dac73[_0xeab1('0x17')]);if(_0x3dac73[_0xeab1('0x15')])_0x522c80[_0xeab1('0x15')](_0x3dac73['offset']);return db[_0xeab1('0x8c')][_0xeab1('0x39')](_0x522c80[_0xeab1('0xaa')](),_0x54e179);})[_0xeab1('0x1b')](function(_0x124fbf){if(_0x124fbf[_0xeab1('0x3b')]>0x0)_0x290f30[_0xeab1('0x40')](_0xeab1('0xab'),_['map'](_0x124fbf,'id'));return db[_0xeab1('0x8c')][_0xeab1('0x39')](_0x290f30[_0xeab1('0xaa')](),_0x54e179)['then'](function(_0x4c5e99){var _0x2c96ad=_[_0xeab1('0xac')](_0x4c5e99,_0xeab1('0xad'));var _0x218f13=[];return db['Setting'][_0xeab1('0x27')]({'attributes':[_0xeab1('0xae')],'raw':!![]})['then'](function(_0x235a1b){var _0x24d029=_0x235a1b['enableEmailPreview'];_0x124fbf[_0xeab1('0x24')](function(_0x55d953){_0x218f13[_0xeab1('0x25')](updateMailInteraction(_0x55d953,_0x250bfe,_0x2c96ad,_0x24d029));});return BPromise[_0xeab1('0xaf')](_0x218f13);});});});})[_0xeab1('0x1b')](function(_0x356400){_0x1a817a[_0xeab1('0xb0')]=_0x356400;return _0x1a817a;})[_0xeab1('0x1b')](respondWithFilteredResult(_0x126a23,_0x3dac73))[_0xeab1('0x2d')](handleError(_0x126a23,null));};exports['show']=function(_0x57094b,_0x45ed4f){var _0x4a906f={'raw':![],'where':{'id':_0x57094b[_0xeab1('0xb1')]['id']}},_0x24ac5e={};_0x24ac5e[_0xeab1('0x35')]=_[_0xeab1('0xb2')](db[_0xeab1('0x30')][_0xeab1('0x31')]);_0x24ac5e[_0xeab1('0x39')]=_[_0xeab1('0xb2')](_0x57094b[_0xeab1('0x39')]);_0x24ac5e[_0xeab1('0x36')]=_[_0xeab1('0x37')](_0x24ac5e[_0xeab1('0x35')],_0x24ac5e[_0xeab1('0x39')]);_0x4a906f[_0xeab1('0x38')]=_[_0xeab1('0x37')](_0x24ac5e[_0xeab1('0x35')],qs['fields'](_0x57094b['query']['fields']));_0x4a906f['attributes']=_0x4a906f['attributes'][_0xeab1('0x3b')]?_0x4a906f['attributes']:_0x24ac5e[_0xeab1('0x35')];if(_0x57094b[_0xeab1('0x39')][_0xeab1('0xb3')]){_0x4a906f['include']=[{'all':!![]}];}_0x4a906f=_[_0xeab1('0x8f')]({},_0x4a906f,_0x57094b[_0xeab1('0xb4')]);return db[_0xeab1('0x30')]['find'](_0x4a906f)[_0xeab1('0x1b')](handleEntityNotFound(_0x45ed4f,null))[_0xeab1('0x1b')](respondWithResult(_0x45ed4f,null))['catch'](handleError(_0x45ed4f,null));};exports[_0xeab1('0xb5')]=function(_0xd63bc8,_0x45bdb7){return db[_0xeab1('0x30')][_0xeab1('0xb5')](_0xd63bc8[_0xeab1('0xb6')],{})[_0xeab1('0x1b')](respondWithResult(_0x45bdb7,0xc9))[_0xeab1('0x2d')](handleError(_0x45bdb7,null));};exports[_0xeab1('0x19')]=function(_0x58baca,_0x3f7554){if(_0x58baca['body']['id']){delete _0x58baca[_0xeab1('0xb6')]['id'];}return db[_0xeab1('0x30')][_0xeab1('0x61')]({'where':{'id':_0x58baca[_0xeab1('0xb1')]['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x3f7554,null))[_0xeab1('0x1b')](saveUpdates(_0x58baca[_0xeab1('0xb6')],null))[_0xeab1('0x1b')](respondWithResult(_0x3f7554,null))[_0xeab1('0x2d')](handleError(_0x3f7554,null));};exports[_0xeab1('0x1a')]=function(_0x37fd5e,_0x2b6ea6){return db[_0xeab1('0x30')]['find']({'where':{'id':_0x37fd5e['params']['id']}})['then'](handleEntityNotFound(_0x2b6ea6,null))[_0xeab1('0x1b')](removeEntity(_0x2b6ea6,null))['catch'](handleError(_0x2b6ea6,null));};exports[_0xeab1('0xb7')]=function(_0x193095,_0x1e65ab){return db['MailInteraction'][_0xeab1('0xb7')]()['then'](respondWithResult(_0x1e65ab,null))[_0xeab1('0x2d')](handleError(_0x1e65ab,null));};exports[_0xeab1('0xb8')]=function(_0x41d3b8,_0x4fd798){return db[_0xeab1('0x26')][_0xeab1('0x61')]({'where':{'id':_0x41d3b8[_0xeab1('0xb1')]['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x4fd798,null))[_0xeab1('0x1b')](function(_0x1aaed2){if(_0x1aaed2){return _0x1aaed2[_0xeab1('0xb8')](_0x41d3b8[_0xeab1('0xb6')][_0xeab1('0xb9')],_[_0xeab1('0xba')](_0x41d3b8[_0xeab1('0xb6')],['ids','id'])||{});}})['then'](respondWithResult(_0x4fd798,null))[_0xeab1('0x2d')](handleError(_0x4fd798,null));};exports[_0xeab1('0xbb')]=function(_0x2474bb,_0x557f43){var _0x32a285={'raw':![],'where':{}};var _0x2976d8={};var _0x2665e2={'count':0x0,'rows':[]};return db[_0xeab1('0x30')][_0xeab1('0x27')]({'where':{'id':_0x2474bb['params']['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x557f43,null))[_0xeab1('0x1b')](function(_0x3e28e1){if(_0x3e28e1){_0x2976d8[_0xeab1('0x35')]=_[_0xeab1('0xb2')](db['MailMessage'][_0xeab1('0x31')]);_0x2976d8[_0xeab1('0x39')]=_['keys'](_0x2474bb['query']);_0x2976d8['filters']=_[_0xeab1('0x37')](_0x2976d8[_0xeab1('0x35')],_0x2976d8['query']);_0x32a285['attributes']=_[_0xeab1('0x37')](_0x2976d8[_0xeab1('0x35')],qs['fields'](_0x2474bb[_0xeab1('0x39')][_0xeab1('0x3a')]));_0x32a285['attributes']=_0x32a285[_0xeab1('0x38')][_0xeab1('0x3b')]?_0x32a285[_0xeab1('0x38')]:_0x2976d8[_0xeab1('0x35')];if(!_0x2474bb[_0xeab1('0x39')]['hasOwnProperty'](_0xeab1('0x3d'))){_0x32a285[_0xeab1('0x17')]=qs[_0xeab1('0x17')](_0x2474bb['query']['limit']);_0x32a285[_0xeab1('0x15')]=qs['offset'](_0x2474bb['query'][_0xeab1('0x15')]);}_0x32a285[_0xeab1('0x3e')]=qs['sort'](_0x2474bb[_0xeab1('0x39')]['sort']);_0x32a285[_0xeab1('0x40')]=qs[_0xeab1('0x36')](_[_0xeab1('0x41')](_0x2474bb[_0xeab1('0x39')],_0x2976d8['filters']));_0x32a285[_0xeab1('0x40')][_0xeab1('0xad')]=_0x3e28e1['id'];if(_0x2474bb[_0xeab1('0x39')][_0xeab1('0x79')]){_0x32a285[_0xeab1('0x40')]=_[_0xeab1('0x8f')](_0x32a285[_0xeab1('0x40')],{'$or':_[_0xeab1('0x2f')](_0x32a285[_0xeab1('0x38')],function(_0x105080){var _0x3943f2={};_0x3943f2[_0x105080]={'$like':'%'+_0x2474bb[_0xeab1('0x39')][_0xeab1('0x79')]+'%'};return _0x3943f2;})});}if(_0x2474bb[_0xeab1('0x39')]['$gte']){var _0x1a8b19=_0x2474bb[_0xeab1('0x39')][_0xeab1('0x71')][_0xeab1('0x5f')](',');var _0x1732c7={};_0x1732c7[_0x1a8b19[0x0]]={'$gte':moment(_0x1a8b19[0x1])[_0xeab1('0xbc')](_0xeab1('0xbd'))};_0x32a285[_0xeab1('0x40')]=_['merge'](_0x32a285['where'],_0x1732c7);}_0x32a285=_['merge']({},_0x32a285,_0x2474bb[_0xeab1('0xb4')]);return db[_0xeab1('0x26')][_0xeab1('0x8d')]({'where':_0x32a285['where']})[_0xeab1('0x1b')](function(_0x751cc8){_0x2665e2[_0xeab1('0x8d')]=_0x751cc8;if(_0x2474bb[_0xeab1('0x39')][_0xeab1('0xb3')]){_0x32a285[_0xeab1('0xbe')]=[{'all':!![]}];}return db[_0xeab1('0x26')][_0xeab1('0xbf')](_0x32a285);})[_0xeab1('0x1b')](function(_0xad044e){if(_0x2474bb[_0xeab1('0x39')][_0xeab1('0xc0')]==='true'){for(var _0x71874e=0x0;_0x71874e<_0xad044e[_0xeab1('0x3b')];_0x71874e++){_0xad044e[_0x71874e]['body']=juice(_0xad044e[_0x71874e][_0xeab1('0xb6')]);}}_0x2665e2['rows']=_0xad044e;return _0x2665e2;});}})[_0xeab1('0x1b')](respondWithFilteredResult(_0x557f43,_0x32a285))[_0xeab1('0x2d')](handleError(_0x557f43,null));};exports[_0xeab1('0xc1')]=function(_0x11c823,_0x477948){return db['MailInteraction']['find']({'where':{'id':_0x11c823['params']['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x477948,null))[_0xeab1('0x1b')](function(_0x349afc){if(_0x349afc){return _0x349afc[_0xeab1('0xc2')](_0x11c823['body'][_0xeab1('0xb9')],_[_0xeab1('0xba')](_0x11c823[_0xeab1('0xb6')],[_0xeab1('0xb9'),'id'])||{})[_0xeab1('0xc3')](function(){return db[_0xeab1('0xc4')][_0xeab1('0xbf')]({'attributes':['id',_0xeab1('0x1e'),_0xeab1('0x44')],'where':{'id':_0x11c823[_0xeab1('0xb6')]['ids']}});})[_0xeab1('0x1b')](function(_0x103f00){socket[_0xeab1('0xc5')](_0xeab1('0xc6'),{'id':Number(_0x11c823[_0xeab1('0xb1')]['id']),'tags':_0x103f00||[]});return{'id':Number(_0x11c823[_0xeab1('0xb1')]['id']),'tags':_0x103f00||[]};});}})['then'](respondWithResult(_0x477948,null))[_0xeab1('0x2d')](handleError(_0x477948,null));};exports['removeTags']=function(_0x2356a3,_0x64f1b6){return db[_0xeab1('0x30')][_0xeab1('0x61')]({'where':{'id':_0x2356a3[_0xeab1('0xb1')]['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x64f1b6,null))[_0xeab1('0x1b')](function(_0x210ff2){if(_0x210ff2){return _0x210ff2['removeTags'](_0x2356a3[_0xeab1('0x39')][_0xeab1('0xb9')]);}})[_0xeab1('0x1b')](respondWithStatusCode(_0x64f1b6,null))['catch'](handleError(_0x64f1b6,null));};exports[_0xeab1('0xc7')]=function(_0x4dc534,_0x29ef56){var _0x13b530=moment()[_0xeab1('0xc8')]()[_0xeab1('0xaa')]();var _0xd57350=path[_0xeab1('0xc9')](config[_0xeab1('0xca')],'server',_0xeab1('0xcb'),_0xeab1('0xcc'));var _0x173290=path[_0xeab1('0xc9')](config['root'],_0xeab1('0xcd'),_0xeab1('0xcb'),_0xeab1('0xce'));var _0x57f2e9=path['join'](_0xd57350,_0x13b530);var _0x2954bd=util['format'](_0xeab1('0xcf'),_0x4dc534['params']['id'],_0x13b530);var _0x1b81a6=path['join'](_0xd57350,_0x2954bd);var _0x20f050=[];if(_0x4dc534[_0xeab1('0x39')][_0xeab1('0xce')]){_0x20f050[_0xeab1('0x25')]({'model':db[_0xeab1('0xd0')],'as':_0xeab1('0xd1'),'raw':!![]});}var _0xde66f0=[{'model':db['MailMessage'],'as':_0xeab1('0xd2'),'attributes':['id',_0xeab1('0xb6'),_0xeab1('0x45'),'to','cc',_0xeab1('0xd3'),_0xeab1('0xd4'),_0xeab1('0x6f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x20f050}];return db['MailInteraction'][_0xeab1('0x61')]({'where':{'id':_0x4dc534[_0xeab1('0xb1')]['id']},'include':_0xde66f0})[_0xeab1('0x1b')](handleEntityNotFound(_0x29ef56,null))[_0xeab1('0x1b')](function(_0x552aa4){if(_0x552aa4&&_0x552aa4[_0xeab1('0xd2')]){var _0x1835b1=_0x552aa4[_0xeab1('0xd5')]({'plain':!![]});fs[_0xeab1('0xd6')](_0x57f2e9);return BPromise[_0xeab1('0xd7')](_0x1835b1[_0xeab1('0xd2')],function(_0x12ef9d,_0x2e90d8){var _0x5e39a7={'from':_0x12ef9d[_0xeab1('0x45')],'to':_0x12ef9d['to'],'subject':_0x12ef9d[_0xeab1('0xd4')],'html':htmlEntities[_0xeab1('0xd8')](_0x12ef9d[_0xeab1('0xb6')]),'headers':{'Date':moment(_0x12ef9d[_0xeab1('0x6f')])[_0xeab1('0xbc')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x12ef9d['cc']){_0x5e39a7[_0xeab1('0xd9')]['Cc']=_0x12ef9d['cc'];}if(_0x12ef9d[_0xeab1('0xd3')]){_0x5e39a7['headers'][_0xeab1('0xda')]=_0x12ef9d[_0xeab1('0xd3')];}return new BPromise(function(_0x3d0563,_0x2536a1){if(_0x12ef9d['Attachments']){for(var _0x29fda3=0x0;_0x29fda3<_0x12ef9d[_0xeab1('0xd1')][_0xeab1('0x3b')];_0x29fda3++){var _0x324ad7=_0x12ef9d[_0xeab1('0xd1')][_0x29fda3];var _0x3de824=path[_0xeab1('0xc9')](_0x173290,_0x324ad7[_0xeab1('0xdb')]);if(fs[_0xeab1('0xdc')](_0x3de824)){_0x5e39a7['attachments']['push']({'name':_0x324ad7['name'],'contentType':_0x324ad7[_0xeab1('0x33')],'data':fs[_0xeab1('0xdd')](_0x3de824)});}}}emlformat['build'](_0x5e39a7,function(_0x8ef60e,_0x3c50c7){if(_0x8ef60e)return _0x2536a1(_0x8ef60e);fs[_0xeab1('0xde')](path[_0xeab1('0xc9')](_0x57f2e9,util[_0xeab1('0xbc')]('message%d.eml',_0x2e90d8)),_0x3c50c7);return _0x3d0563(_0x3c50c7);});});})[_0xeab1('0x1b')](function(){return new BPromise(function(_0x4ce531,_0x561364){zipdir(_0x57f2e9,{'saveTo':_0x1b81a6},function(_0x177dee,_0x5ea37a){if(_0x177dee)return _0x561364(_0x177dee);return _0x4ce531(_0x5ea37a);});})[_0xeab1('0x1b')](function(){return new BPromise(function(_0x567c99,_0x396a9d){rimraf(_0x57f2e9,function(_0x3c46a8){if(_0x3c46a8)_0x396a9d(_0x3c46a8);return _0x567c99();});});})['then'](function(){return _0x29ef56[_0xeab1('0xc7')](_0x1b81a6,_0x2954bd,function(_0x5b8658){if(!_0x5b8658)fs[_0xeab1('0xdf')](_0x1b81a6);});});});}else{return _0x29ef56[_0xeab1('0xe0')](0xc8);}})[_0xeab1('0x2d')](handleError(_0x29ef56,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f768fa3..d519f6f 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 _0x7a5a=['hook','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1d4ff6,_0x43a375){var _0x4a76db=function(_0x544e03){while(--_0x544e03){_0x1d4ff6['push'](_0x1d4ff6['shift']());}};_0x4a76db(++_0x43a375);}(_0x7a5a,0xc7));var _0xa7a5=function(_0x1203a4,_0x529665){_0x1203a4=_0x1203a4-0x0;var _0x82d25a=_0x7a5a[_0x1203a4];return _0x82d25a;};'use strict';var EventEmitter=require(_0xa7a5('0x0'));var MailInteraction=require(_0xa7a5('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xa7a5('0x1'))['db'][_0xa7a5('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa7a5('0x3')](0x0);var events={'afterCreate':_0xa7a5('0x4'),'afterUpdate':'update','afterDestroy':_0xa7a5('0x5')};function emitEvent(_0x352472){return function(_0xa9a4be,_0x30e3e6,_0x109245){_0xa9a4be[_0xa7a5('0x6')]({'attributes':['id'],'raw':!![]})[_0xa7a5('0x7')](function(_0x5ec6e2){_0xa9a4be[_0xa7a5('0x8')](_0xa7a5('0x9'),_0x5ec6e2[_0xa7a5('0xa')](function(_0x265655){return{'id':_0x265655['id']};}));return MailMessage[_0xa7a5('0xb')]({'where':{'MailInteractionId':_0xa9a4be['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30a9b8){_0xa9a4be[_0xa7a5('0x8')](_0xa7a5('0xc'),_0x30a9b8[_0xa7a5('0xd')]);MailInteractionEvents['emit'](_0x352472+':'+_0xa9a4be['id'],_0xa9a4be);MailInteractionEvents[_0xa7a5('0xe')](_0x352472,_0xa9a4be);_0x109245(null);})[_0xa7a5('0xf')](_0x109245(null));};}for(var e in events){if(events[_0xa7a5('0x10')](e)){var event=events[e];MailInteraction[_0xa7a5('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x8a8a=['hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','then','setDataValue','Users','map','unreadMessages','emit','catch'];(function(_0x140707,_0xf06afc){var _0x855cb=function(_0x110916){while(--_0x110916){_0x140707['push'](_0x140707['shift']());}};_0x855cb(++_0xf06afc);}(_0x8a8a,0x1d2));var _0xa8a8=function(_0x1d0018,_0x3c503a){_0x1d0018=_0x1d0018-0x0;var _0x1c0b54=_0x8a8a[_0x1d0018];return _0x1c0b54;};'use strict';var EventEmitter=require(_0xa8a8('0x0'));var MailInteraction=require(_0xa8a8('0x1'))['db'][_0xa8a8('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xa8a8('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa8a8('0x4')](0x0);var events={'afterCreate':_0xa8a8('0x5'),'afterUpdate':_0xa8a8('0x6'),'afterDestroy':'remove'};function emitEvent(_0x406209){return function(_0x50591d,_0x2baba0,_0x3507d8){_0x50591d['getUsers']({'attributes':['id'],'raw':!![]})[_0xa8a8('0x7')](function(_0x513098){_0x50591d[_0xa8a8('0x8')](_0xa8a8('0x9'),_0x513098[_0xa8a8('0xa')](function(_0x8e7559){return{'id':_0x8e7559['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x50591d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa8a8('0x7')](function(_0x418219){_0x50591d[_0xa8a8('0x8')](_0xa8a8('0xb'),_0x418219['length']);MailInteractionEvents[_0xa8a8('0xc')](_0x406209+':'+_0x50591d['id'],_0x50591d);MailInteractionEvents[_0xa8a8('0xc')](_0x406209,_0x50591d);_0x3507d8(null);})[_0xa8a8('0xd')](_0x3507d8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa8a8('0xe')](e,emitEvent(event));}}module[_0xa8a8('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index fd768d7..d25ae55 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 _0x69e0=['utf8mb4','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','models','get','MailMessage','update','catch'];(function(_0x132aed,_0x40b4b3){var _0x8da83b=function(_0x538ead){while(--_0x538ead){_0x132aed['push'](_0x132aed['shift']());}};_0x8da83b(++_0x40b4b3);}(_0x69e0,0xd9));var _0x069e=function(_0x2e8ce2,_0x2a4f72){_0x2e8ce2=_0x2e8ce2-0x0;var _0x44c870=_0x69e0[_0x2e8ce2];return _0x44c870;};'use strict';var _=require(_0x069e('0x0'));var util=require(_0x069e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x069e('0x2'));var BPromise=require(_0x069e('0x3'));var rp=require(_0x069e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x069e('0x5'));var config=require(_0x069e('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x069e('0x7')]=function(_0x2fa064,_0x19ec7d){return _0x2fa064[_0x069e('0x8')](_0x069e('0x9'),attributes,{'tableName':_0x069e('0xa'),'paranoid':![],'indexes':[{'name':_0x069e('0xb'),'fields':[_0x069e('0xc'),'to'],'type':_0x069e('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x516380,_0xabe593,_0x237625){if(_0x516380[_0x069e('0xe')]){_0x516380[_0x069e('0xf')]=moment()[_0x069e('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x516380['closed']){_0x516380['closedAt']=moment()['format'](_0x069e('0x11'));}_0x237625(null,_0xabe593);},'beforeUpdate':function(_0xae72d5,_0x580bff,_0x115f4c){if(_0xae72d5[_0x069e('0x12')](_0x069e('0xe'))){_0xae72d5[_0x069e('0xf')]=_0xae72d5['substatus']?moment()[_0x069e('0x10')](_0x069e('0x11')):null;}if(_0xae72d5[_0x069e('0x12')](_0x069e('0x13'))){_0xae72d5[_0x069e('0x14')]=moment()[_0x069e('0x10')](_0x069e('0x11'));_0xae72d5['substatus']=null;_0xae72d5['substatusAt']=null;}_0x115f4c(null,_0xae72d5);},'afterUpdate':function(_0x4b0e96,_0x30d541,_0xa87181){var _0xf496f2=_0x2fa064[_0x069e('0x15')];var _0x24a941=_0x4b0e96[_0x069e('0x16')]({'plain':!![]});if(_0x24a941['closed']){return _0xf496f2[_0x069e('0x17')][_0x069e('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x24a941['id']}})['then'](function(){_0xa87181();})[_0x069e('0x19')](function(_0x1a5f7c){_0xa87181(_0x1a5f7c);});}else{_0xa87181();}}},'charset':_0x069e('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7473=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','exports','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format','models','get','MailMessage'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x7473,0x94));var _0x3747=function(_0x15a019,_0x1c302f){_0x15a019=_0x15a019-0x0;var _0x2aa0a5=_0x7473[_0x15a019];return _0x2aa0a5;};'use strict';var _=require(_0x3747('0x0'));var util=require(_0x3747('0x1'));var logger=require(_0x3747('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3747('0x3'));var rp=require(_0x3747('0x4'));var fs=require('fs');var path=require(_0x3747('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x3747('0x6')]=function(_0x25b50f,_0xa2b609){return _0x25b50f['define'](_0x3747('0x7'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x3747('0x8'),'fields':['subject','to'],'type':_0x3747('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d844d,_0x21ce93,_0x1e0c38){if(_0x3d844d[_0x3747('0xa')]){_0x3d844d[_0x3747('0xb')]=moment()['format'](_0x3747('0xc'));}if(_0x3d844d[_0x3747('0xd')]){_0x3d844d[_0x3747('0xe')]=moment()['format'](_0x3747('0xc'));}_0x1e0c38(null,_0x21ce93);},'beforeUpdate':function(_0x3034df,_0x3b93ea,_0x24e543){if(_0x3034df[_0x3747('0xf')](_0x3747('0xa'))){_0x3034df[_0x3747('0xb')]=_0x3034df['substatus']?moment()[_0x3747('0x10')](_0x3747('0xc')):null;}if(_0x3034df[_0x3747('0xf')]('closed')){_0x3034df['closedAt']=moment()[_0x3747('0x10')](_0x3747('0xc'));_0x3034df[_0x3747('0xa')]=null;_0x3034df['substatusAt']=null;}_0x24e543(null,_0x3034df);},'afterUpdate':function(_0x364b28,_0x52d827,_0x30987a){var _0x4ed858=_0x25b50f[_0x3747('0x11')];var _0x48b683=_0x364b28[_0x3747('0x12')]({'plain':!![]});if(_0x48b683[_0x3747('0xd')]){return _0x4ed858[_0x3747('0x13')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x48b683['id']}})['then'](function(){_0x30987a();})['catch'](function(_0x2b7e6d){_0x30987a(_0x2b7e6d);});}else{_0x30987a();}}},'charset':'utf8mb4','collate':_0x3747('0x14')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5e6e393..284d236 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 _0x7a5f=['AddTags','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','attributes','limit','then','debug','AddTagsToMailInteraction','where','addTags','body','ids','omit'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x7a5f,0x17b));var _0xf7a5=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x7a5f[_0x5a27e8];return _0x4e38f7;};'use strict';var _=require(_0xf7a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf7a5('0x1'));var fs=require('fs');var Redis=require(_0xf7a5('0x2'));var db=require(_0xf7a5('0x3'))['db'];var utils=require(_0xf7a5('0x4'));var logger=require(_0xf7a5('0x5'))(_0xf7a5('0x6'));var config=require(_0xf7a5('0x7'));var jayson=require(_0xf7a5('0x8'));var client=jayson['client'][_0xf7a5('0x9')]({'port':0x232a});config[_0xf7a5('0xa')]=_[_0xf7a5('0xb')](config[_0xf7a5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf7a5('0xc'))(new Redis(config['redis']));require(_0xf7a5('0xd'))[_0xf7a5('0xe')](socket);function respondWithRpcPromise(_0x1ef820,_0x8e74d3,_0x17dfbc){return new BPromise(function(_0x28c721,_0x5bf086){return client[_0xf7a5('0xf')](_0x1ef820,_0x17dfbc)['then'](function(_0x54302e){logger['info'](_0xf7a5('0x10'),_0x8e74d3,_0xf7a5('0x11'));logger['debug'](_0xf7a5('0x12'),_0x8e74d3,'request\x20sent',JSON[_0xf7a5('0x13')](_0x54302e));if(_0x54302e[_0xf7a5('0x14')]){if(_0x54302e[_0xf7a5('0x14')][_0xf7a5('0x15')]===0x1f4){logger['error'](_0xf7a5('0x10'),_0x8e74d3,_0x54302e['error'][_0xf7a5('0x16')]);return _0x5bf086(_0x54302e['error'][_0xf7a5('0x16')]);}logger[_0xf7a5('0x14')](_0xf7a5('0x10'),_0x8e74d3,_0x54302e[_0xf7a5('0x14')][_0xf7a5('0x16')]);return _0x28c721(_0x54302e[_0xf7a5('0x14')][_0xf7a5('0x16')]);}else{logger[_0xf7a5('0x17')](_0xf7a5('0x10'),_0x8e74d3,'request\x20sent');_0x28c721(_0x54302e[_0xf7a5('0x18')][_0xf7a5('0x16')]);}})[_0xf7a5('0x19')](function(_0x50c145){logger['error'](_0xf7a5('0x10'),_0x8e74d3,_0x50c145);_0x5bf086(_0x50c145);});});}exports[_0xf7a5('0x1a')]=function(_0x36381d){var _0x54b080=this;return new Promise(function(_0x2f8c8e,_0x265d87){return db[_0xf7a5('0x1b')][_0xf7a5('0x1c')](_0x36381d['body'],{'raw':_0x36381d[_0xf7a5('0x1d')]?_0x36381d[_0xf7a5('0x1d')][_0xf7a5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36381d[_0xf7a5('0x1d')]?_0x36381d[_0xf7a5('0x1d')]['where']||null:null,'attributes':_0x36381d[_0xf7a5('0x1d')]?_0x36381d[_0xf7a5('0x1d')][_0xf7a5('0x1f')]||null:null,'limit':_0x36381d[_0xf7a5('0x1d')]?_0x36381d[_0xf7a5('0x1d')][_0xf7a5('0x20')]||null:null})[_0xf7a5('0x21')](function(_0x4e84b9){logger[_0xf7a5('0x17')]('UpdateMailInteraction',_0x36381d);logger[_0xf7a5('0x22')](_0xf7a5('0x1a'),_0x36381d,JSON[_0xf7a5('0x13')](_0x4e84b9));_0x2f8c8e(_0x4e84b9);})[_0xf7a5('0x19')](function(_0x2fc290){logger['error'](_0xf7a5('0x1a'),_0x2fc290[_0xf7a5('0x16')],_0x36381d);_0x265d87(_0x54b080[_0xf7a5('0x14')](0x1f4,_0x2fc290['message']));});});};exports[_0xf7a5('0x23')]=function(_0x4c0c9c){return new Promise(function(_0x169685,_0x1f90b0){return db['MailInteraction']['find']({'where':_0x4c0c9c[_0xf7a5('0x1d')]?_0x4c0c9c[_0xf7a5('0x1d')][_0xf7a5('0x24')]||null:null})[_0xf7a5('0x21')](function(_0x684eff){if(_0x684eff){return _0x684eff[_0xf7a5('0x25')](_0x4c0c9c[_0xf7a5('0x26')][_0xf7a5('0x27')],_[_0xf7a5('0x28')](_0x4c0c9c[_0xf7a5('0x26')],[_0xf7a5('0x27'),'id'])||{});}})['spread'](function(_0x23dd3e){logger[_0xf7a5('0x17')](_0xf7a5('0x29'),_0x4c0c9c);logger['debug'](_0xf7a5('0x29'),_0x4c0c9c,JSON[_0xf7a5('0x13')](_0x23dd3e));_0x169685(_0x23dd3e);})[_0xf7a5('0x19')](function(_0x1f2a4b){logger[_0xf7a5('0x14')](_0xf7a5('0x29'),_0x1f2a4b[_0xf7a5('0x16')],_0x4c0c9c);_0x1f90b0(_this['error'](0x1f4,_0x1f2a4b[_0xf7a5('0x16')]));});});}; \ No newline at end of file +var _0xcec8=['limit','stringify','catch','find','where','addTags','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','UpdateMailInteraction','MailInteraction','update','body','options','raw'];(function(_0x5289f9,_0x1f3f49){var _0x23e4da=function(_0x4ff904){while(--_0x4ff904){_0x5289f9['push'](_0x5289f9['shift']());}};_0x23e4da(++_0x1f3f49);}(_0xcec8,0x10c));var _0x8cec=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0xcec8[_0x46a38b];return _0x346e75;};'use strict';var _=require('lodash');var util=require(_0x8cec('0x0'));var moment=require(_0x8cec('0x1'));var BPromise=require(_0x8cec('0x2'));var rs=require(_0x8cec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cec('0x5'))(_0x8cec('0x6'));var config=require(_0x8cec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8cec('0x8')][_0x8cec('0x9')]({'port':0x232a});config['redis']=_[_0x8cec('0xa')](config[_0x8cec('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8cec('0xc'))(new Redis(config[_0x8cec('0xb')]));require(_0x8cec('0xd'))['register'](socket);function respondWithRpcPromise(_0xe41014,_0xb7f80d,_0x2ddefb){return new BPromise(function(_0x1886cf,_0x4eae98){return client[_0x8cec('0xe')](_0xe41014,_0x2ddefb)['then'](function(_0x5bfa4a){logger[_0x8cec('0xf')](_0x8cec('0x10'),_0xb7f80d,_0x8cec('0x11'));logger[_0x8cec('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0xb7f80d,_0x8cec('0x11'),JSON['stringify'](_0x5bfa4a));if(_0x5bfa4a['error']){if(_0x5bfa4a[_0x8cec('0x13')][_0x8cec('0x14')]===0x1f4){logger[_0x8cec('0x13')](_0x8cec('0x10'),_0xb7f80d,_0x5bfa4a[_0x8cec('0x13')]['message']);return _0x4eae98(_0x5bfa4a[_0x8cec('0x13')][_0x8cec('0x15')]);}logger[_0x8cec('0x13')](_0x8cec('0x10'),_0xb7f80d,_0x5bfa4a[_0x8cec('0x13')]['message']);return _0x1886cf(_0x5bfa4a['error'][_0x8cec('0x15')]);}else{logger[_0x8cec('0xf')]('MailInteraction,\x20%s,\x20%s',_0xb7f80d,_0x8cec('0x11'));_0x1886cf(_0x5bfa4a['result'][_0x8cec('0x15')]);}})['catch'](function(_0xf95d28){logger['error']('MailInteraction,\x20%s,\x20%s',_0xb7f80d,_0xf95d28);_0x4eae98(_0xf95d28);});});}exports[_0x8cec('0x16')]=function(_0x58a730){var _0x1abffd=this;return new Promise(function(_0x30d337,_0x246406){return db[_0x8cec('0x17')][_0x8cec('0x18')](_0x58a730[_0x8cec('0x19')],{'raw':_0x58a730[_0x8cec('0x1a')]?_0x58a730[_0x8cec('0x1a')][_0x8cec('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a730[_0x8cec('0x1a')]?_0x58a730[_0x8cec('0x1a')]['where']||null:null,'attributes':_0x58a730[_0x8cec('0x1a')]?_0x58a730[_0x8cec('0x1a')]['attributes']||null:null,'limit':_0x58a730['options']?_0x58a730[_0x8cec('0x1a')][_0x8cec('0x1c')]||null:null})['then'](function(_0x2f9804){logger[_0x8cec('0xf')](_0x8cec('0x16'),_0x58a730);logger['debug'](_0x8cec('0x16'),_0x58a730,JSON[_0x8cec('0x1d')](_0x2f9804));_0x30d337(_0x2f9804);})[_0x8cec('0x1e')](function(_0x211697){logger[_0x8cec('0x13')]('UpdateMailInteraction',_0x211697[_0x8cec('0x15')],_0x58a730);_0x246406(_0x1abffd[_0x8cec('0x13')](0x1f4,_0x211697[_0x8cec('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0x3fe071){return new Promise(function(_0x404527,_0x314ec7){return db[_0x8cec('0x17')][_0x8cec('0x1f')]({'where':_0x3fe071['options']?_0x3fe071[_0x8cec('0x1a')][_0x8cec('0x20')]||null:null})['then'](function(_0x3c706b){if(_0x3c706b){return _0x3c706b[_0x8cec('0x21')](_0x3fe071[_0x8cec('0x19')]['ids'],_[_0x8cec('0x22')](_0x3fe071[_0x8cec('0x19')],['ids','id'])||{});}})[_0x8cec('0x23')](function(_0x4fbc02){logger['info'](_0x8cec('0x24'),_0x3fe071);logger['debug'](_0x8cec('0x24'),_0x3fe071,JSON['stringify'](_0x4fbc02));_0x404527(_0x4fbc02);})[_0x8cec('0x1e')](function(_0x3b20aa){logger['error'](_0x8cec('0x24'),_0x3b20aa['message'],_0x3fe071);_0x314ec7(_this[_0x8cec('0x13')](0x1f4,_0x3b20aa[_0x8cec('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 4409c33..a4a41b0 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 _0x6527=['emit','removeListener','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0x440235,_0x5c4204){var _0x425eb6=function(_0x340a10){while(--_0x340a10){_0x440235['push'](_0x440235['shift']());}};_0x425eb6(++_0x5c4204);}(_0x6527,0xa5));var _0x7652=function(_0x5d801a,_0x379056){_0x5d801a=_0x5d801a-0x0;var _0x1e1fe7=_0x6527[_0x5d801a];return _0x1e1fe7;};'use strict';var MailInteractionEvents=require(_0x7652('0x0'));var events=['save',_0x7652('0x1'),_0x7652('0x2')];function createListener(_0x26ab3a,_0x520bba){return function(_0x29e183){_0x520bba[_0x7652('0x3')](_0x26ab3a,_0x29e183);};}function removeListener(_0x2ae147,_0x3ecaae){return function(){MailInteractionEvents[_0x7652('0x4')](_0x2ae147,_0x3ecaae);};}exports['register']=function(_0x3a72b6){for(var _0x24ce29=0x0,_0x28bf48=events[_0x7652('0x5')];_0x24ce29<_0x28bf48;_0x24ce29++){var _0x5995f8=events[_0x24ce29];var _0x3ed84e=createListener(_0x7652('0x6')+_0x5995f8,_0x3a72b6);MailInteractionEvents['on'](_0x5995f8,_0x3ed84e);}}; \ No newline at end of file +var _0x312a=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','emit'];(function(_0x35ea3f,_0xd437e){var _0x3e262f=function(_0x155e78){while(--_0x155e78){_0x35ea3f['push'](_0x35ea3f['shift']());}};_0x3e262f(++_0xd437e);}(_0x312a,0x104));var _0xa312=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x312a[_0x14add3];return _0x4a174f;};'use strict';var MailInteractionEvents=require(_0xa312('0x0'));var events=[_0xa312('0x1'),_0xa312('0x2'),'update'];function createListener(_0x29e09c,_0x2115b0){return function(_0x388059){_0x2115b0[_0xa312('0x3')](_0x29e09c,_0x388059);};}function removeListener(_0x327514,_0x36161c){return function(){MailInteractionEvents[_0xa312('0x4')](_0x327514,_0x36161c);};}exports[_0xa312('0x5')]=function(_0x5b79f1){for(var _0x2a3a7c=0x0,_0x5635e6=events[_0xa312('0x6')];_0x2a3a7c<_0x5635e6;_0x2a3a7c++){var _0x3d24f8=events[_0x2a3a7c];var _0x221423=createListener(_0xa312('0x7')+_0x3d24f8,_0x5b79f1);MailInteractionEvents['on'](_0x3d24f8,_0x221423);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f05e490..95d2e4d 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 _0x927e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','put','update','/:id/accept','accept','reject','destroy','multer','util','express','Router','fs-extra'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x927e,0x1ab));var _0xe927=function(_0x31d707,_0x733c2b){_0x31d707=_0x31d707-0x0;var _0x3ff20d=_0x927e[_0x31d707];return _0x3ff20d;};'use strict';var multer=require(_0xe927('0x0'));var util=require(_0xe927('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe927('0x2'));var router=express[_0xe927('0x3')]();var fs_extra=require(_0xe927('0x4'));var auth=require(_0xe927('0x5'));var interaction=require(_0xe927('0x6'));var config=require(_0xe927('0x7'));var controller=require(_0xe927('0x8'));router[_0xe927('0x9')]('/',auth[_0xe927('0xa')](),controller[_0xe927('0xb')]);router[_0xe927('0x9')](_0xe927('0xc'),auth[_0xe927('0xa')](),controller[_0xe927('0xd')]);router['get'](_0xe927('0xe'),auth[_0xe927('0xa')](),controller[_0xe927('0xf')]);router[_0xe927('0x9')](_0xe927('0x10'),auth[_0xe927('0xa')](),controller[_0xe927('0x11')]);router[_0xe927('0x12')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xe927('0x13'),_0xe927('0x14')),controller['create']);router[_0xe927('0x15')](_0xe927('0xe'),auth['isAuthenticated'](),controller[_0xe927('0x16')]);router[_0xe927('0x15')](_0xe927('0x17'),auth[_0xe927('0xa')](),controller[_0xe927('0x18')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xe927('0x19')]);router['delete'](_0xe927('0xe'),auth[_0xe927('0xa')](),controller[_0xe927('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xe205=['../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','tracked','mail','mailmessage:create','create','put','update','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x131604,_0x475a68){var _0x4a2aea=function(_0xa43f77){while(--_0xa43f77){_0x131604['push'](_0x131604['shift']());}};_0x4a2aea(++_0x475a68);}(_0xe205,0xa7));var _0x5e20=function(_0x376de6,_0x3d4ea7){_0x376de6=_0x376de6-0x0;var _0x6b4fd6=_0xe205[_0x376de6];return _0x6b4fd6;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/describe',auth[_0x5e20('0xb')](),controller['describe']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['show']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),interaction[_0x5e20('0x10')](_0x5e20('0x11'),_0x5e20('0x12')),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x15')]);router[_0x5e20('0x14')]('/:id/accept',auth[_0x5e20('0xb')](),controller['accept']);router[_0x5e20('0x14')]('/:id/reject',auth[_0x5e20('0xb')](),controller[_0x5e20('0x16')]);router[_0x5e20('0x17')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['destroy']);module[_0x5e20('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 726f955..f3d9d01 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 _0x1ed4=['TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Chat','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1ed4,0x76));var _0x41ed=function(_0x14f5b5,_0x17be06){_0x14f5b5=_0x14f5b5-0x0;var _0x275512=_0x1ed4[_0x14f5b5];return _0x275512;};'use strict';var Sequelize=require(_0x41ed('0x0'));var _=require('lodash');module[_0x41ed('0x1')]={'body':{'type':Sequelize[_0x41ed('0x2')](_0x41ed('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x41ed('0x2')](_0x41ed('0x4'))},'read':{'type':Sequelize[_0x41ed('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x41ed('0x6')]('in',_0x41ed('0x7')),'defaultValue':_0x41ed('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x41ed('0x8')](0x1fe)},'from':{'type':Sequelize[_0x41ed('0x8')]},'to':{'type':Sequelize[_0x41ed('0x2')]('long')},'cc':{'type':Sequelize[_0x41ed('0x2')](_0x41ed('0x3'))},'bcc':{'type':Sequelize[_0x41ed('0x2')](_0x41ed('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x41ed('0x9')]},'attach':{'type':Sequelize[_0x41ed('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x41ed('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x41ed('0x9')]},'originTo':{'type':Sequelize[_0x41ed('0x2')]('long')},'originCc':{'type':Sequelize[_0x41ed('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM']('Email',_0x41ed('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xdc87=['out','STRING','long','DATE','INTEGER','BOOLEAN','Chat','Email','lodash','exports','TEXT','medium','ENUM'];(function(_0x26fac8,_0x4c4906){var _0x1c54cc=function(_0x12b2b){while(--_0x12b2b){_0x26fac8['push'](_0x26fac8['shift']());}};_0x1c54cc(++_0x4c4906);}(_0xdc87,0x7d));var _0x7dc8=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xdc87[_0x2de0a7];return _0x429437;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7dc8('0x0'));module[_0x7dc8('0x1')]={'body':{'type':Sequelize[_0x7dc8('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7dc8('0x2')](_0x7dc8('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7dc8('0x4')]('in',_0x7dc8('0x5')),'defaultValue':_0x7dc8('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7dc8('0x6')](0x1fe)},'from':{'type':Sequelize[_0x7dc8('0x6')]},'to':{'type':Sequelize[_0x7dc8('0x2')](_0x7dc8('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT'](_0x7dc8('0x7'))},'subject':{'type':Sequelize[_0x7dc8('0x2')]},'sentAt':{'type':Sequelize[_0x7dc8('0x8')]},'attach':{'type':Sequelize[_0x7dc8('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7dc8('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7dc8('0x8')]},'originTo':{'type':Sequelize[_0x7dc8('0x2')](_0x7dc8('0x7'))},'originCc':{'type':Sequelize[_0x7dc8('0x2')]('long')},'originChannel':{'type':Sequelize[_0x7dc8('0x4')]('Email',_0x7dc8('0xb')),'defaultValue':_0x7dc8('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f487ee6..1669e3c 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 _0xbe9e=['attributes','length','sort','where','pick','merge','VIRTUAL','filter','options','MailMessage','includeAll','include','findAll','rows','params','intersection','catch','body','find','destroy','describe','create','direction','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','readAt','format','UserId','agent','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','channel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','null','rejectMessage','contact','fullname','SIP/%s','motionChannel','rejectmessage','download','unix','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','path','lodash','ioredis','html-to-text','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','MailMessage,\x20%s,\x20%s','message','result','status','json','undefined','count','offset','limit','set','Content-Range','update','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','fields'];(function(_0x3a5ee7,_0x4f77c4){var _0x52304d=function(_0x365267){while(--_0x365267){_0x3a5ee7['push'](_0x3a5ee7['shift']());}};_0x52304d(++_0x4f77c4);}(_0xbe9e,0x6e));var _0xebe9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe9e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var moment=require(_0xebe9('0x0'));var BPromise=require(_0xebe9('0x1'));var util=require('util');var path=require(_0xebe9('0x2'));var fs=require('fs');var _=require(_0xebe9('0x3'));var Redis=require(_0xebe9('0x4'));var htmlToText=require(_0xebe9('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xebe9('0x6'));var interaction_log=require(_0xebe9('0x7'))(_0xebe9('0x8'));var config=require(_0xebe9('0x9'));var db=require(_0xebe9('0xa'))['db'];config[_0xebe9('0xb')]=_[_0xebe9('0xc')](config[_0xebe9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xebe9('0xd'))(new Redis(config[_0xebe9('0xb')]));var htmlEntities=require(_0xebe9('0xe'));require('./mailMessage.socket')['register'](socket);var jayson=require(_0xebe9('0xf'));var client=jayson[_0xebe9('0x10')][_0xebe9('0x11')]({'port':0x232c});var client9003=jayson[_0xebe9('0x10')][_0xebe9('0x11')]({'port':0x232b});var client9002=jayson[_0xebe9('0x10')][_0xebe9('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2b9dc6,_0x544ac8,_0x5e580d,_0x4bd6c4){return new BPromise(function(_0x50c906,_0x5dd728){var _0xcb397=_0x4bd6c4||client;return _0xcb397[_0xebe9('0x12')](_0x2b9dc6,_0x5e580d)['then'](function(_0x13a3b3){logger[_0xebe9('0x13')]('MailMessage,\x20%s,\x20%s',_0x544ac8,_0xebe9('0x14'));logger[_0xebe9('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x544ac8,'request\x20sent',JSON['stringify'](_0x13a3b3));if(_0x13a3b3[_0xebe9('0x16')]){if(_0x13a3b3[_0xebe9('0x16')][_0xebe9('0x17')]===0x1f4){logger[_0xebe9('0x16')](_0xebe9('0x18'),_0x544ac8,_0x13a3b3[_0xebe9('0x16')]['message']);return _0x5dd728(_0x13a3b3[_0xebe9('0x16')][_0xebe9('0x19')]);}logger[_0xebe9('0x16')](_0xebe9('0x18'),_0x544ac8,_0x13a3b3[_0xebe9('0x16')][_0xebe9('0x19')]);return _0x50c906(_0x13a3b3['error'][_0xebe9('0x19')]);}else{logger[_0xebe9('0x13')](_0xebe9('0x18'),_0x544ac8,_0xebe9('0x14'));_0x50c906(_0x13a3b3[_0xebe9('0x1a')]['message']);}})['catch'](function(_0x47ec8d){logger[_0xebe9('0x16')](_0xebe9('0x18'),_0x544ac8,_0x47ec8d);_0x5dd728(_0x47ec8d);});});}function respondWithResult(_0x4bdc7f,_0x1c25ac){_0x1c25ac=_0x1c25ac||0xc8;return function(_0x51b357){if(_0x51b357){return _0x4bdc7f[_0xebe9('0x1b')](_0x1c25ac)[_0xebe9('0x1c')](_0x51b357);}};}function respondWithFilteredResult(_0x5b7f54,_0x5d40d6){return function(_0x15fb8a){if(_0x15fb8a){var _0x32f94d=typeof _0x5d40d6['offset']===_0xebe9('0x1d')&&typeof _0x5d40d6['limit']===_0xebe9('0x1d');var _0x3613d6=_0x15fb8a[_0xebe9('0x1e')];var _0x1480bb=_0x32f94d?0x0:_0x5d40d6[_0xebe9('0x1f')];var _0x21f996=_0x32f94d?_0x15fb8a[_0xebe9('0x1e')]:_0x5d40d6['offset']+_0x5d40d6[_0xebe9('0x20')];var _0x174c74;if(_0x21f996>=_0x3613d6){_0x21f996=_0x3613d6;_0x174c74=0xc8;}else{_0x174c74=0xce;}_0x5b7f54[_0xebe9('0x1b')](_0x174c74);return _0x5b7f54[_0xebe9('0x21')](_0xebe9('0x22'),_0x1480bb+'-'+_0x21f996+'/'+_0x3613d6)[_0xebe9('0x1c')](_0x15fb8a);}return null;};}function saveUpdates(_0x4a83b2){return function(_0x279740){if(_0x279740){return _0x279740[_0xebe9('0x23')](_0x4a83b2)[_0xebe9('0x24')](function(_0x30facc){return _0x30facc;});}return null;};}function removeEntity(_0x35c8aa){return function(_0x23b0fc){if(_0x23b0fc){return _0x23b0fc['destroy']()['then'](function(){_0x35c8aa[_0xebe9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd034){return function(_0xb416ab){if(!_0xb416ab){_0x5cd034[_0xebe9('0x25')](0x194);}return _0xb416ab;};}function handleError(_0x20978c,_0x5122d6){_0x5122d6=_0x5122d6||0x1f4;return function(_0xeda029){logger['error'](_0xeda029['stack']);if(_0xeda029[_0xebe9('0x26')]){delete _0xeda029['name'];}_0x20978c[_0xebe9('0x1b')](_0x5122d6)[_0xebe9('0x27')](_0xeda029);};}exports[_0xebe9('0x28')]=function(_0x397b50,_0x10bf8f){var _0x4ee306={},_0x3481ea={},_0x5a70b8={'count':0x0,'rows':[]};var _0x1c8c1a=_[_0xebe9('0x29')](db['MailMessage'][_0xebe9('0x2a')],function(_0x5f2eb9){return{'name':_0x5f2eb9[_0xebe9('0x2b')],'type':_0x5f2eb9[_0xebe9('0x2c')][_0xebe9('0x2d')]};});_0x3481ea[_0xebe9('0x2e')]=_['map'](_0x1c8c1a,'name');_0x3481ea[_0xebe9('0x2f')]=_[_0xebe9('0x30')](_0x397b50[_0xebe9('0x2f')]);_0x3481ea[_0xebe9('0x31')]=_['intersection'](_0x3481ea[_0xebe9('0x2e')],_0x3481ea[_0xebe9('0x2f')]);_0x4ee306['attributes']=_['intersection'](_0x3481ea['model'],qs['fields'](_0x397b50[_0xebe9('0x2f')][_0xebe9('0x32')]));_0x4ee306[_0xebe9('0x33')]=_0x4ee306[_0xebe9('0x33')][_0xebe9('0x34')]?_0x4ee306['attributes']:_0x3481ea['model'];if(!_0x397b50[_0xebe9('0x2f')]['hasOwnProperty']('nolimit')){_0x4ee306[_0xebe9('0x20')]=qs[_0xebe9('0x20')](_0x397b50[_0xebe9('0x2f')]['limit']);_0x4ee306['offset']=qs[_0xebe9('0x1f')](_0x397b50[_0xebe9('0x2f')][_0xebe9('0x1f')]);}_0x4ee306['order']=qs[_0xebe9('0x35')](_0x397b50['query'][_0xebe9('0x35')]);_0x4ee306[_0xebe9('0x36')]=qs['filters'](_[_0xebe9('0x37')](_0x397b50[_0xebe9('0x2f')],_0x3481ea[_0xebe9('0x31')]),_0x1c8c1a);if(_0x397b50[_0xebe9('0x2f')]['filter']){_0x4ee306[_0xebe9('0x36')]=_[_0xebe9('0x38')](_0x4ee306[_0xebe9('0x36')],{'$or':_[_0xebe9('0x29')](_0x1c8c1a,function(_0x3610e8){if(_0x3610e8['type']!==_0xebe9('0x39')){var _0x408729={};_0x408729[_0x3610e8[_0xebe9('0x26')]]={'$like':'%'+_0x397b50[_0xebe9('0x2f')][_0xebe9('0x3a')]+'%'};return _0x408729;}})});}_0x4ee306=_[_0xebe9('0x38')]({},_0x4ee306,_0x397b50[_0xebe9('0x3b')]);var _0x4cd824={'where':_0x4ee306[_0xebe9('0x36')]};return db[_0xebe9('0x3c')][_0xebe9('0x1e')](_0x4cd824)[_0xebe9('0x24')](function(_0x469bad){_0x5a70b8[_0xebe9('0x1e')]=_0x469bad;if(_0x397b50[_0xebe9('0x2f')][_0xebe9('0x3d')]){_0x4ee306[_0xebe9('0x3e')]=[{'all':!![]}];}return db['MailMessage'][_0xebe9('0x3f')](_0x4ee306);})[_0xebe9('0x24')](function(_0x16304b){_0x5a70b8[_0xebe9('0x40')]=_0x16304b;return _0x5a70b8;})[_0xebe9('0x24')](respondWithFilteredResult(_0x10bf8f,_0x4ee306))['catch'](handleError(_0x10bf8f,null));};exports['show']=function(_0x49ca2e,_0x6ee2cc){var _0x5dddc5={'raw':!![],'where':{'id':_0x49ca2e[_0xebe9('0x41')]['id']}},_0x18ade7={};_0x18ade7[_0xebe9('0x2e')]=_[_0xebe9('0x30')](db[_0xebe9('0x3c')]['rawAttributes']);_0x18ade7[_0xebe9('0x2f')]=_['keys'](_0x49ca2e[_0xebe9('0x2f')]);_0x18ade7[_0xebe9('0x31')]=_[_0xebe9('0x42')](_0x18ade7[_0xebe9('0x2e')],_0x18ade7['query']);_0x5dddc5[_0xebe9('0x33')]=_[_0xebe9('0x42')](_0x18ade7['model'],qs['fields'](_0x49ca2e[_0xebe9('0x2f')][_0xebe9('0x32')]));_0x5dddc5[_0xebe9('0x33')]=_0x5dddc5[_0xebe9('0x33')][_0xebe9('0x34')]?_0x5dddc5['attributes']:_0x18ade7[_0xebe9('0x2e')];if(_0x49ca2e['query'][_0xebe9('0x3d')]){_0x5dddc5[_0xebe9('0x3e')]=[{'all':!![]}];}_0x5dddc5=_[_0xebe9('0x38')]({},_0x5dddc5,_0x49ca2e[_0xebe9('0x3b')]);return db['MailMessage']['find'](_0x5dddc5)[_0xebe9('0x24')](handleEntityNotFound(_0x6ee2cc,null))[_0xebe9('0x24')](respondWithResult(_0x6ee2cc,null))[_0xebe9('0x43')](handleError(_0x6ee2cc,null));};exports[_0xebe9('0x23')]=function(_0x5b7bde,_0xacde52){if(_0x5b7bde['body']['id']){delete _0x5b7bde[_0xebe9('0x44')]['id'];}return db[_0xebe9('0x3c')][_0xebe9('0x45')]({'where':{'id':_0x5b7bde['params']['id']}})[_0xebe9('0x24')](handleEntityNotFound(_0xacde52,null))['then'](saveUpdates(_0x5b7bde[_0xebe9('0x44')],null))[_0xebe9('0x24')](respondWithResult(_0xacde52,null))['catch'](handleError(_0xacde52,null));};exports[_0xebe9('0x46')]=function(_0x5f5d66,_0x112a63){return db[_0xebe9('0x3c')][_0xebe9('0x45')]({'where':{'id':_0x5f5d66[_0xebe9('0x41')]['id']}})[_0xebe9('0x24')](handleEntityNotFound(_0x112a63,null))['then'](removeEntity(_0x112a63,null))[_0xebe9('0x43')](handleError(_0x112a63,null));};exports[_0xebe9('0x47')]=function(_0x652815,_0x263aeb){return db[_0xebe9('0x3c')][_0xebe9('0x47')]()[_0xebe9('0x24')](respondWithResult(_0x263aeb,null))['catch'](handleError(_0x263aeb,null));};exports['create']=function(_0x33ebd5,_0x59590a){return db['MailMessage'][_0xebe9('0x48')](_0x33ebd5[_0xebe9('0x44')])[_0xebe9('0x24')](function(_0x61f9b1){if(_0x61f9b1){if(_0x61f9b1[_0xebe9('0x49')]==='out'&&!_0x61f9b1[_0xebe9('0x4a')]){var _0x470b27,_0x52f85d,_0x2a3d42;if(_0x33ebd5[_0xebe9('0x44')]['to']){_0x52f85d=_0x33ebd5[_0xebe9('0x44')]['to'][_0xebe9('0x4b')](',')[0x0];}return db['MailAccount'][_0xebe9('0x4c')]({'where':{'id':_0x61f9b1[_0xebe9('0x4d')]},'include':[{'model':db[_0xebe9('0x4e')],'as':_0xebe9('0x4f'),'include':[{'model':db[_0xebe9('0x50')],'as':_0xebe9('0x51'),'where':{'email':_0x52f85d},'limit':0x1,'order':[[_0xebe9('0x52'),_0xebe9('0x53')]]}]},{'model':db['MailServerOut'],'as':_0xebe9('0x54'),'raw':!![]}]})[_0xebe9('0x24')](function(_0x1ab744){_0x470b27=_0x1ab744;if(_0x470b27&&_0x470b27[_0xebe9('0x54')]){var _0x4709d3={'tls':{'rejectUnauthorized':![]}};if(_[_0xebe9('0x55')](_0x470b27[_0xebe9('0x54')][_0xebe9('0x56')])){_0x4709d3[_0xebe9('0x57')]=_0x470b27[_0xebe9('0x54')][_0xebe9('0x57')];_0x4709d3[_0xebe9('0x58')]=_0x470b27[_0xebe9('0x54')]['port'];_0x4709d3[_0xebe9('0x59')]=_0x470b27['Smtp'][_0xebe9('0x59')];if(_0x470b27[_0xebe9('0x54')][_0xebe9('0x5a')]){_0x4709d3[_0xebe9('0x5b')]={'user':_0x470b27[_0xebe9('0x54')][_0xebe9('0x5c')],'pass':_0x470b27[_0xebe9('0x54')][_0xebe9('0x5d')]};}}else{_0x4709d3[_0xebe9('0x56')]=_0x470b27[_0xebe9('0x54')][_0xebe9('0x56')];_0x4709d3[_0xebe9('0x5b')]={'user':_0x470b27[_0xebe9('0x54')][_0xebe9('0x5c')],'pass':_0x470b27['Smtp'][_0xebe9('0x5d')]};_0x4709d3[_0xebe9('0x59')]=_0x470b27[_0xebe9('0x54')][_0xebe9('0x59')];}if(_0x33ebd5[_0xebe9('0x44')][_0xebe9('0x5e')]&&_0x33ebd5[_0xebe9('0x44')][_0xebe9('0x5e')][_0xebe9('0x34')]){for(var _0x3dca1f=0x0;_0x3dca1f<_0x33ebd5[_0xebe9('0x44')][_0xebe9('0x5e')]['length'];_0x3dca1f+=0x1){_0x33ebd5['body'][_0xebe9('0x5e')][_0x3dca1f]={'filename':_0x33ebd5[_0xebe9('0x44')][_0xebe9('0x5e')][_0x3dca1f][_0xebe9('0x26')],'path':path[_0xebe9('0x5f')](config[_0xebe9('0x60')],_0xebe9('0x61'),_0x33ebd5[_0xebe9('0x44')]['attachments'][_0x3dca1f]['basename'])};}}_0x2a3d42={'account':_0x4709d3,'message':_0x33ebd5[_0xebe9('0x44')]};return;}})['then'](function(){if(_0x470b27[_0xebe9('0x4f')]){if(_0x470b27[_0xebe9('0x4f')]['Contacts'][_0xebe9('0x34')]){return _0x470b27['List'][_0xebe9('0x51')][0x0];}else{return db[_0xebe9('0x50')][_0xebe9('0x48')](_[_0xebe9('0xc')](_0x33ebd5['body'],{'firstName':_0x33ebd5['body']['to'],'email':_0x33ebd5[_0xebe9('0x44')]['to'],'phone':_0x33ebd5[_0xebe9('0x44')]['to'],'ListId':_0x470b27['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0xebe9('0x24')](function(){if(_0x2a3d42){return respondWithRpcPromise(_0xebe9('0x62'),_0xebe9('0x63'),_0x2a3d42,client9003)[_0xebe9('0x24')](function(_0x21186d){return _0x61f9b1[_0xebe9('0x23')]({'read':!![],'messageId':_0x21186d['messageId'],'sentAt':moment()['format'](_0xebe9('0x64'))});})[_0xebe9('0x43')](function(_0x566740){logger[_0xebe9('0x16')]('%s',JSON[_0xebe9('0x65')](_0x566740));return _0x61f9b1;});}return _0x61f9b1;});}return _0x61f9b1;}})[_0xebe9('0x24')](respondWithResult(_0x59590a,0xc9))[_0xebe9('0x43')](handleError(_0x59590a,null));};exports[_0xebe9('0x66')]=function(_0x805ae0,_0x1fda69){var _0x50d7a5={'agent':{},'channel':_0xebe9('0x67')};if(_0x805ae0[_0xebe9('0x44')]['id']){delete _0x805ae0[_0xebe9('0x44')]['id'];}_0x805ae0[_0xebe9('0x44')]['read']=!![];_0x805ae0[_0xebe9('0x44')][_0xebe9('0x68')]=moment()[_0xebe9('0x69')](_0xebe9('0x64'));_0x805ae0[_0xebe9('0x44')][_0xebe9('0x6a')]=_0x805ae0[_0xebe9('0x44')][_0xebe9('0x6a')]||_0x805ae0['user']['id'];_0x50d7a5[_0xebe9('0x6b')]['id']=_0x805ae0[_0xebe9('0x44')]['UserId'];return db[_0xebe9('0x3c')][_0xebe9('0x45')]({'where':{'id':_0x805ae0[_0xebe9('0x41')]['id'],'UserId':null}})[_0xebe9('0x24')](handleEntityNotFound(_0x1fda69,null))[_0xebe9('0x24')](saveUpdates(_0x805ae0[_0xebe9('0x44')],null))[_0xebe9('0x24')](function(_0x695d3){if(_0x695d3){_0x50d7a5[_0xebe9('0x19')]=_0x695d3[_0xebe9('0x6c')]({'plain':!![]});return db[_0xebe9('0x6d')]['find']({'where':{'id':_0x695d3['MailInteractionId']}});}return null;})[_0xebe9('0x24')](handleEntityNotFound(_0x1fda69,null))[_0xebe9('0x24')](function(_0xb6e30c){if(_0xb6e30c){return _0xb6e30c[_0xebe9('0x23')]({'UserId':_0x805ae0[_0xebe9('0x44')][_0xebe9('0x6a')],'read1stAt':_[_0xebe9('0x55')](_0xb6e30c[_0xebe9('0x6e')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xebe9('0x24')](function(_0x2f5627){if(_0x2f5627){_0x50d7a5[_0xebe9('0x6f')]=_0x2f5627[_0xebe9('0x6c')]({'plain':!![]});interaction_log[_0xebe9('0x13')](_0xebe9('0x70'),_0x805ae0[_0xebe9('0x5c')]['id'],_0x805ae0['user']['name'],_0x805ae0[_0xebe9('0x5c')][_0xebe9('0x71')],_0x50d7a5[_0xebe9('0x6f')]['id'],_0x805ae0[_0xebe9('0x44')]?JSON[_0xebe9('0x65')](_0x805ae0[_0xebe9('0x44')]):'null');return respondWithRpcPromise('AcceptMessage',_0xebe9('0x72'),_0x50d7a5);}return null;})['then'](function(_0x23ada8){var _0x3af7f6=_0xebe9('0x73')+_0x23ada8[_0xebe9('0x19')][_0xebe9('0x74')];return db[_0xebe9('0x75')][_0xebe9('0x2f')](_0x3af7f6,{'type':db[_0xebe9('0x76')][_0xebe9('0x77')][_0xebe9('0x78')],'raw':!![]})['then'](function(_0x58ef0a){return _0x58ef0a;});})['then'](function(_0x4aba94){if(_0x4aba94){_0x50d7a5[_0xebe9('0x19')]['contact']=_0x4aba94[0x0];if(!_0x805ae0[_0xebe9('0x44')][_0xebe9('0x6a')])return;return db[_0xebe9('0x79')][_0xebe9('0x45')]({'where':{'id':_0x805ae0[_0xebe9('0x44')]['UserId'],'role':'agent'},'attributes':['id',_0xebe9('0x26'),'fullname',_0xebe9('0x7a'),_0xebe9('0x7b')],'raw':!![]});}return null;})[_0xebe9('0x24')](function(_0x3b7876){if(!_0x3b7876)return null;_0x50d7a5[_0xebe9('0x19')][_0xebe9('0x6b')]=_0x3b7876;return _0x50d7a5;})[_0xebe9('0x24')](function(_0x493d26){if(_0x493d26){if(_0x805ae0[_0xebe9('0x44')][_0xebe9('0x7c')]){_0x50d7a5['message'][_0xebe9('0x7d')]=util[_0xebe9('0x69')]('SIP/%s',_0x805ae0[_0xebe9('0x5c')][_0xebe9('0x26')]);_0x50d7a5[_0xebe9('0x19')][_0xebe9('0x7e')]=_0x50d7a5['channel'];_0x50d7a5['message']['motionChannel']=_0x50d7a5['channel'];_0x50d7a5[_0xebe9('0x19')][_0xebe9('0x7f')]='accept';_0x50d7a5['message'][_0xebe9('0x44')]=htmlToText[_0xebe9('0x80')](_0x50d7a5[_0xebe9('0x19')][_0xebe9('0x44')]);return respondWithRpcPromise(_0xebe9('0x81'),'EventManager',{'event':_0xebe9('0x82'),'message':_0x50d7a5[_0xebe9('0x19')]},client9002)[_0xebe9('0x24')](function(){return _0x50d7a5;});}return _0x50d7a5;}return null;})['then'](respondWithResult(_0x1fda69,null))['catch'](handleError(_0x1fda69,null));};exports[_0xebe9('0x83')]=function(_0x4c7bb0,_0x4c01fb){var _0x23ada1={'agent':{},'channel':_0xebe9('0x67')};if(_0x4c7bb0[_0xebe9('0x44')]['id']){delete _0x4c7bb0[_0xebe9('0x44')]['id'];}_0x4c7bb0[_0xebe9('0x44')][_0xebe9('0x6a')]=_0x4c7bb0[_0xebe9('0x44')][_0xebe9('0x6a')]||_0x4c7bb0[_0xebe9('0x5c')]['id'];_0x23ada1[_0xebe9('0x6b')]['id']=_0x4c7bb0['body']['UserId'];return db[_0xebe9('0x3c')]['find']({'where':{'id':_0x4c7bb0[_0xebe9('0x41')]['id'],'UserId':null}})[_0xebe9('0x24')](handleEntityNotFound(_0x4c01fb,null))[_0xebe9('0x24')](function(_0x336431){if(_0x336431){_0x23ada1[_0xebe9('0x19')]=_0x336431['get']({'plain':!![]});return db[_0xebe9('0x6d')][_0xebe9('0x45')]({'where':{'id':_0x336431[_0xebe9('0x84')]}});}return null;})[_0xebe9('0x24')](handleEntityNotFound(_0x4c01fb,null))[_0xebe9('0x24')](function(_0x1a2f2b){if(_0x1a2f2b){_0x23ada1['interaction']=_0x1a2f2b[_0xebe9('0x6c')]({'plain':!![]});interaction_log[_0xebe9('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c7bb0['user']['id'],_0x4c7bb0[_0xebe9('0x5c')][_0xebe9('0x26')],_0x4c7bb0[_0xebe9('0x5c')][_0xebe9('0x71')],_0x23ada1[_0xebe9('0x6f')]['id'],_0x4c7bb0[_0xebe9('0x44')]?JSON['stringify'](_0x4c7bb0['body']):_0xebe9('0x85'));return respondWithRpcPromise('RejectMessage',_0xebe9('0x86'),_0x23ada1);}return null;})[_0xebe9('0x24')](function(_0x17ed3b){var _0x2ee47e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17ed3b[_0xebe9('0x19')][_0xebe9('0x74')];return db['sequelize'][_0xebe9('0x2f')](_0x2ee47e,{'type':db[_0xebe9('0x76')]['QueryTypes']['SELECT'],'raw':!![]})[_0xebe9('0x24')](function(_0x16026a){return _0x16026a;});})[_0xebe9('0x24')](function(_0x24df08){if(_0x24df08){_0x23ada1['message'][_0xebe9('0x87')]=_0x24df08[0x0];if(!_0x4c7bb0[_0xebe9('0x44')][_0xebe9('0x6a')])return;return db[_0xebe9('0x79')][_0xebe9('0x45')]({'where':{'id':_0x4c7bb0[_0xebe9('0x44')][_0xebe9('0x6a')],'role':_0xebe9('0x6b')},'attributes':['id','name',_0xebe9('0x88'),'email',_0xebe9('0x7b')],'raw':!![]});}return null;})[_0xebe9('0x24')](function(_0x9696e5){if(!_0x9696e5)return null;_0x23ada1[_0xebe9('0x19')][_0xebe9('0x6b')]=_0x9696e5;return _0x23ada1;})['then'](function(_0x46273f){if(_0x46273f){_0x46273f[_0xebe9('0x19')][_0xebe9('0x7d')]=util['format'](_0xebe9('0x89'),_0x4c7bb0[_0xebe9('0x5c')]['name']);_0x46273f['message']['channel']=_0x23ada1[_0xebe9('0x7e')];_0x46273f[_0xebe9('0x19')][_0xebe9('0x8a')]=_0x23ada1[_0xebe9('0x7e')];_0x46273f['message']['event']=_0xebe9('0x83');_0x46273f[_0xebe9('0x19')][_0xebe9('0x44')]=htmlToText[_0xebe9('0x80')](_0x23ada1[_0xebe9('0x19')][_0xebe9('0x44')]);respondWithRpcPromise('EventManager',_0xebe9('0x81'),{'event':_0xebe9('0x8b'),'message':_0x46273f['message']},client9002);return _0x23ada1;}return null;})['then'](respondWithResult(_0x4c01fb,null))['catch'](handleError(_0x4c01fb,null));};exports[_0xebe9('0x8c')]=function(_0x5bf07a,_0xe5d764){var _0x3e277c=moment()[_0xebe9('0x8d')]()['toString']();var _0x1eab6d=path[_0xebe9('0x5f')](config[_0xebe9('0x60')],_0xebe9('0x8e'),_0xebe9('0x8f'),'tmp');var _0x5e4da7=path[_0xebe9('0x5f')](config['root'],_0xebe9('0x8e'),_0xebe9('0x8f'),_0xebe9('0x5e'));var _0x3bb2fc=util[_0xebe9('0x69')](_0xebe9('0x90'),_0x3e277c);return db[_0xebe9('0x3c')][_0xebe9('0x45')]({'where':{'id':_0x5bf07a[_0xebe9('0x41')]['id']},'attributes':['id',_0xebe9('0x44'),_0xebe9('0x91'),'to','cc',_0xebe9('0x92'),_0xebe9('0x93'),_0xebe9('0x94')],'include':_0x5bf07a['query']['attachments']?[{'model':db[_0xebe9('0x95')],'as':_0xebe9('0x96')}]:undefined})['then'](handleEntityNotFound(_0xe5d764,null))['then'](function(_0x3b25af){if(_0x3b25af){var _0x7ff6b=_0x3b25af;var _0x50712d={'from':_0x7ff6b[_0xebe9('0x91')],'to':_0x7ff6b['to'],'subject':_0x7ff6b[_0xebe9('0x93')],'html':htmlEntities[_0xebe9('0x97')](_0x7ff6b[_0xebe9('0x44')]),'headers':{'Date':moment(_0x7ff6b[_0xebe9('0x94')])['format'](_0xebe9('0x98'))},'attachments':[]};if(_0x3b25af['cc']){_0x50712d[_0xebe9('0x99')]['Cc']=_0x3b25af['cc'];}if(_0x3b25af[_0xebe9('0x92')]){_0x50712d[_0xebe9('0x99')][_0xebe9('0x9a')]=_0x3b25af['bcc'];}return new BPromise(function(_0xff89db,_0x1cc7ba){if(_0x3b25af[_0xebe9('0x96')]){for(var _0x5829e0=0x0;_0x5829e0<_0x3b25af[_0xebe9('0x96')]['length'];_0x5829e0++){var _0x1e4632=_0x3b25af[_0xebe9('0x96')][_0x5829e0];var _0x19ee2b=path['join'](_0x5e4da7,_0x1e4632['basename']);if(fs[_0xebe9('0x9b')](_0x19ee2b)){_0x50712d[_0xebe9('0x5e')][_0xebe9('0x9c')]({'name':_0x1e4632[_0xebe9('0x26')],'contentType':_0x1e4632[_0xebe9('0x2c')],'data':fs[_0xebe9('0x9d')](_0x19ee2b)});}}}emlformat[_0xebe9('0x9e')](_0x50712d,function(_0x26a47b,_0x13ed0d){if(_0x26a47b)return _0x1cc7ba(_0x26a47b);fs[_0xebe9('0x9f')](path['join'](_0x1eab6d,_0x3bb2fc),_0x13ed0d);return _0xff89db(_0x13ed0d);});});}})['then'](function(_0x137763){if(_0x137763){return _0xe5d764[_0xebe9('0x8c')](path[_0xebe9('0x5f')](_0x1eab6d,_0x3bb2fc),_0x3bb2fc,function(_0x47c4b3){if(!_0x47c4b3)fs[_0xebe9('0xa0')](path[_0xebe9('0x5f')](_0x1eab6d,_0x3bb2fc));});}})[_0xebe9('0x43')](handleError(_0xe5d764,null));}; \ No newline at end of file +var _0x1bb1=['Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','update','end','sendStatus','stack','name','send','map','MailMessage','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','show','rawAttributes','find','body','params','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','MailServerOut','Smtp','isNil','service','host','port','secure','pass','auth','attachments','join','root','server/files/attachments','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','format','UserId','agent','get','MailInteraction','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','EventManager','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x1bb1,0xa9));var _0x11bb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bb1[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x11bb('0x0'));var moment=require(_0x11bb('0x1'));var BPromise=require('bluebird');var util=require(_0x11bb('0x2'));var path=require(_0x11bb('0x3'));var fs=require('fs');var _=require(_0x11bb('0x4'));var Redis=require(_0x11bb('0x5'));var htmlToText=require(_0x11bb('0x6'));var qs=require(_0x11bb('0x7'));var logger=require(_0x11bb('0x8'))(_0x11bb('0x9'));var interaction_log=require(_0x11bb('0x8'))(_0x11bb('0xa'));var config=require(_0x11bb('0xb'));var db=require(_0x11bb('0xc'))['db'];config[_0x11bb('0xd')]=_['defaults'](config[_0x11bb('0xd')],{'host':_0x11bb('0xe'),'port':0x18eb});var socket=require(_0x11bb('0xf'))(new Redis(config[_0x11bb('0xd')]));var htmlEntities=require(_0x11bb('0x10'));require(_0x11bb('0x11'))[_0x11bb('0x12')](socket);var jayson=require(_0x11bb('0x13'));var client=jayson[_0x11bb('0x14')][_0x11bb('0x15')]({'port':0x232c});var client9003=jayson[_0x11bb('0x14')]['http']({'port':0x232b});var client9002=jayson[_0x11bb('0x14')][_0x11bb('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x462bd4,_0x36a021,_0x5ada9f,_0x3bceb9){return new BPromise(function(_0x3d10b6,_0x257f4f){var _0x4c00ae=_0x3bceb9||client;return _0x4c00ae['request'](_0x462bd4,_0x5ada9f)[_0x11bb('0x16')](function(_0x4c0501){logger[_0x11bb('0x17')](_0x11bb('0x18'),_0x36a021,'request\x20sent');logger[_0x11bb('0x19')](_0x11bb('0x1a'),_0x36a021,'request\x20sent',JSON[_0x11bb('0x1b')](_0x4c0501));if(_0x4c0501[_0x11bb('0x1c')]){if(_0x4c0501[_0x11bb('0x1c')]['code']===0x1f4){logger[_0x11bb('0x1c')]('MailMessage,\x20%s,\x20%s',_0x36a021,_0x4c0501[_0x11bb('0x1c')][_0x11bb('0x1d')]);return _0x257f4f(_0x4c0501[_0x11bb('0x1c')]['message']);}logger[_0x11bb('0x1c')]('MailMessage,\x20%s,\x20%s',_0x36a021,_0x4c0501[_0x11bb('0x1c')][_0x11bb('0x1d')]);return _0x3d10b6(_0x4c0501[_0x11bb('0x1c')]['message']);}else{logger[_0x11bb('0x17')](_0x11bb('0x18'),_0x36a021,'request\x20sent');_0x3d10b6(_0x4c0501[_0x11bb('0x1e')]['message']);}})[_0x11bb('0x1f')](function(_0x2b818b){logger[_0x11bb('0x1c')](_0x11bb('0x18'),_0x36a021,_0x2b818b);_0x257f4f(_0x2b818b);});});}function respondWithResult(_0x3f6904,_0x264896){_0x264896=_0x264896||0xc8;return function(_0x14bd47){if(_0x14bd47){return _0x3f6904[_0x11bb('0x20')](_0x264896)[_0x11bb('0x21')](_0x14bd47);}};}function respondWithFilteredResult(_0xff2f5d,_0x25f699){return function(_0x81d8ec){if(_0x81d8ec){var _0x18fe70=typeof _0x25f699[_0x11bb('0x22')]===_0x11bb('0x23')&&typeof _0x25f699[_0x11bb('0x24')]===_0x11bb('0x23');var _0x1a36c5=_0x81d8ec[_0x11bb('0x25')];var _0xccdfc1=_0x18fe70?0x0:_0x25f699[_0x11bb('0x22')];var _0x375a28=_0x18fe70?_0x81d8ec[_0x11bb('0x25')]:_0x25f699['offset']+_0x25f699[_0x11bb('0x24')];var _0x2216bb;if(_0x375a28>=_0x1a36c5){_0x375a28=_0x1a36c5;_0x2216bb=0xc8;}else{_0x2216bb=0xce;}_0xff2f5d['status'](_0x2216bb);return _0xff2f5d[_0x11bb('0x26')]('Content-Range',_0xccdfc1+'-'+_0x375a28+'/'+_0x1a36c5)[_0x11bb('0x21')](_0x81d8ec);}return null;};}function saveUpdates(_0x488132){return function(_0x394f4e){if(_0x394f4e){return _0x394f4e[_0x11bb('0x27')](_0x488132)['then'](function(_0x21862f){return _0x21862f;});}return null;};}function removeEntity(_0x951886){return function(_0x3e23d9){if(_0x3e23d9){return _0x3e23d9['destroy']()[_0x11bb('0x16')](function(){_0x951886['status'](0xcc)[_0x11bb('0x28')]();});}};}function handleEntityNotFound(_0x3443d7){return function(_0x2ea12d){if(!_0x2ea12d){_0x3443d7[_0x11bb('0x29')](0x194);}return _0x2ea12d;};}function handleError(_0xf4a212,_0x367873){_0x367873=_0x367873||0x1f4;return function(_0x45e7d4){logger[_0x11bb('0x1c')](_0x45e7d4[_0x11bb('0x2a')]);if(_0x45e7d4[_0x11bb('0x2b')]){delete _0x45e7d4[_0x11bb('0x2b')];}_0xf4a212[_0x11bb('0x20')](_0x367873)[_0x11bb('0x2c')](_0x45e7d4);};}exports['index']=function(_0x183335,_0x43ea8b){var _0x2205c4={},_0x424014={},_0x18acfc={'count':0x0,'rows':[]};var _0x2c7c24=_[_0x11bb('0x2d')](db[_0x11bb('0x2e')]['rawAttributes'],function(_0x424737){return{'name':_0x424737[_0x11bb('0x2f')],'type':_0x424737[_0x11bb('0x30')][_0x11bb('0x31')]};});_0x424014[_0x11bb('0x32')]=_[_0x11bb('0x2d')](_0x2c7c24,_0x11bb('0x2b'));_0x424014[_0x11bb('0x33')]=_[_0x11bb('0x34')](_0x183335[_0x11bb('0x33')]);_0x424014[_0x11bb('0x35')]=_['intersection'](_0x424014[_0x11bb('0x32')],_0x424014['query']);_0x2205c4['attributes']=_[_0x11bb('0x36')](_0x424014['model'],qs['fields'](_0x183335[_0x11bb('0x33')][_0x11bb('0x37')]));_0x2205c4[_0x11bb('0x38')]=_0x2205c4[_0x11bb('0x38')][_0x11bb('0x39')]?_0x2205c4['attributes']:_0x424014[_0x11bb('0x32')];if(!_0x183335[_0x11bb('0x33')][_0x11bb('0x3a')](_0x11bb('0x3b'))){_0x2205c4['limit']=qs[_0x11bb('0x24')](_0x183335['query'][_0x11bb('0x24')]);_0x2205c4[_0x11bb('0x22')]=qs[_0x11bb('0x22')](_0x183335[_0x11bb('0x33')][_0x11bb('0x22')]);}_0x2205c4[_0x11bb('0x3c')]=qs[_0x11bb('0x3d')](_0x183335[_0x11bb('0x33')][_0x11bb('0x3d')]);_0x2205c4[_0x11bb('0x3e')]=qs[_0x11bb('0x35')](_[_0x11bb('0x3f')](_0x183335[_0x11bb('0x33')],_0x424014[_0x11bb('0x35')]),_0x2c7c24);if(_0x183335[_0x11bb('0x33')][_0x11bb('0x40')]){_0x2205c4[_0x11bb('0x3e')]=_[_0x11bb('0x41')](_0x2205c4[_0x11bb('0x3e')],{'$or':_[_0x11bb('0x2d')](_0x2c7c24,function(_0x140f83){if(_0x140f83[_0x11bb('0x30')]!==_0x11bb('0x42')){var _0x3f07a4={};_0x3f07a4[_0x140f83[_0x11bb('0x2b')]]={'$like':'%'+_0x183335[_0x11bb('0x33')][_0x11bb('0x40')]+'%'};return _0x3f07a4;}})});}_0x2205c4=_[_0x11bb('0x41')]({},_0x2205c4,_0x183335[_0x11bb('0x43')]);var _0x34ac13={'where':_0x2205c4[_0x11bb('0x3e')]};return db[_0x11bb('0x2e')][_0x11bb('0x25')](_0x34ac13)[_0x11bb('0x16')](function(_0x168efd){_0x18acfc[_0x11bb('0x25')]=_0x168efd;if(_0x183335[_0x11bb('0x33')][_0x11bb('0x44')]){_0x2205c4[_0x11bb('0x45')]=[{'all':!![]}];}return db[_0x11bb('0x2e')][_0x11bb('0x46')](_0x2205c4);})['then'](function(_0x37fa5a){_0x18acfc[_0x11bb('0x47')]=_0x37fa5a;return _0x18acfc;})['then'](respondWithFilteredResult(_0x43ea8b,_0x2205c4))[_0x11bb('0x1f')](handleError(_0x43ea8b,null));};exports[_0x11bb('0x48')]=function(_0x30e7af,_0x10eca2){var _0x124570={'raw':!![],'where':{'id':_0x30e7af['params']['id']}},_0x2ce96c={};_0x2ce96c['model']=_[_0x11bb('0x34')](db[_0x11bb('0x2e')][_0x11bb('0x49')]);_0x2ce96c[_0x11bb('0x33')]=_['keys'](_0x30e7af[_0x11bb('0x33')]);_0x2ce96c[_0x11bb('0x35')]=_[_0x11bb('0x36')](_0x2ce96c[_0x11bb('0x32')],_0x2ce96c[_0x11bb('0x33')]);_0x124570['attributes']=_['intersection'](_0x2ce96c['model'],qs[_0x11bb('0x37')](_0x30e7af[_0x11bb('0x33')][_0x11bb('0x37')]));_0x124570[_0x11bb('0x38')]=_0x124570['attributes'][_0x11bb('0x39')]?_0x124570[_0x11bb('0x38')]:_0x2ce96c[_0x11bb('0x32')];if(_0x30e7af[_0x11bb('0x33')]['includeAll']){_0x124570[_0x11bb('0x45')]=[{'all':!![]}];}_0x124570=_[_0x11bb('0x41')]({},_0x124570,_0x30e7af[_0x11bb('0x43')]);return db[_0x11bb('0x2e')][_0x11bb('0x4a')](_0x124570)['then'](handleEntityNotFound(_0x10eca2,null))[_0x11bb('0x16')](respondWithResult(_0x10eca2,null))['catch'](handleError(_0x10eca2,null));};exports[_0x11bb('0x27')]=function(_0x44b128,_0x53f0d5){if(_0x44b128[_0x11bb('0x4b')]['id']){delete _0x44b128[_0x11bb('0x4b')]['id'];}return db[_0x11bb('0x2e')][_0x11bb('0x4a')]({'where':{'id':_0x44b128[_0x11bb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x53f0d5,null))[_0x11bb('0x16')](saveUpdates(_0x44b128[_0x11bb('0x4b')],null))[_0x11bb('0x16')](respondWithResult(_0x53f0d5,null))[_0x11bb('0x1f')](handleError(_0x53f0d5,null));};exports['destroy']=function(_0x2675f1,_0x2f6f2f){return db[_0x11bb('0x2e')][_0x11bb('0x4a')]({'where':{'id':_0x2675f1[_0x11bb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f6f2f,null))[_0x11bb('0x16')](removeEntity(_0x2f6f2f,null))[_0x11bb('0x1f')](handleError(_0x2f6f2f,null));};exports['describe']=function(_0x1a2a19,_0x418e14){return db[_0x11bb('0x2e')]['describe']()['then'](respondWithResult(_0x418e14,null))[_0x11bb('0x1f')](handleError(_0x418e14,null));};exports[_0x11bb('0x4d')]=function(_0x4acd11,_0x4bc78c){return db[_0x11bb('0x2e')][_0x11bb('0x4d')](_0x4acd11[_0x11bb('0x4b')])[_0x11bb('0x16')](function(_0x3afa81){if(_0x3afa81){if(_0x3afa81[_0x11bb('0x4e')]===_0x11bb('0x4f')&&!_0x3afa81[_0x11bb('0x50')]){var _0x489082,_0x2a3c6c,_0x22cdaf;if(_0x4acd11[_0x11bb('0x4b')]['to']){_0x2a3c6c=_0x4acd11[_0x11bb('0x4b')]['to'][_0x11bb('0x51')](',')[0x0];}return db[_0x11bb('0x52')][_0x11bb('0x53')]({'where':{'id':_0x3afa81[_0x11bb('0x54')]},'include':[{'model':db['CmList'],'as':_0x11bb('0x55'),'include':[{'model':db[_0x11bb('0x56')],'as':_0x11bb('0x57'),'where':{'email':_0x2a3c6c},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x11bb('0x58')],'as':_0x11bb('0x59'),'raw':!![]}]})[_0x11bb('0x16')](function(_0xb7c1f5){_0x489082=_0xb7c1f5;if(_0x489082&&_0x489082[_0x11bb('0x59')]){var _0x1d411e={'tls':{'rejectUnauthorized':![]}};if(_[_0x11bb('0x5a')](_0x489082[_0x11bb('0x59')][_0x11bb('0x5b')])){_0x1d411e[_0x11bb('0x5c')]=_0x489082[_0x11bb('0x59')][_0x11bb('0x5c')];_0x1d411e[_0x11bb('0x5d')]=_0x489082['Smtp'][_0x11bb('0x5d')];_0x1d411e[_0x11bb('0x5e')]=_0x489082[_0x11bb('0x59')]['secure'];if(_0x489082[_0x11bb('0x59')]['authentication']){_0x1d411e['auth']={'user':_0x489082[_0x11bb('0x59')]['user'],'pass':_0x489082[_0x11bb('0x59')][_0x11bb('0x5f')]};}}else{_0x1d411e[_0x11bb('0x5b')]=_0x489082[_0x11bb('0x59')]['service'];_0x1d411e[_0x11bb('0x60')]={'user':_0x489082['Smtp']['user'],'pass':_0x489082[_0x11bb('0x59')]['pass']};_0x1d411e['secure']=_0x489082[_0x11bb('0x59')][_0x11bb('0x5e')];}if(_0x4acd11['body'][_0x11bb('0x61')]&&_0x4acd11[_0x11bb('0x4b')][_0x11bb('0x61')][_0x11bb('0x39')]){for(var _0x1385bd=0x0;_0x1385bd<_0x4acd11[_0x11bb('0x4b')][_0x11bb('0x61')]['length'];_0x1385bd+=0x1){_0x4acd11[_0x11bb('0x4b')][_0x11bb('0x61')][_0x1385bd]={'filename':_0x4acd11[_0x11bb('0x4b')]['attachments'][_0x1385bd][_0x11bb('0x2b')],'path':path[_0x11bb('0x62')](config[_0x11bb('0x63')],_0x11bb('0x64'),_0x4acd11[_0x11bb('0x4b')][_0x11bb('0x61')][_0x1385bd]['basename'])};}}_0x22cdaf={'account':_0x1d411e,'message':_0x4acd11['body']};return;}})[_0x11bb('0x16')](function(){if(_0x489082[_0x11bb('0x55')]){if(_0x489082[_0x11bb('0x55')][_0x11bb('0x57')][_0x11bb('0x39')]){return _0x489082['List'][_0x11bb('0x57')][0x0];}else{return db[_0x11bb('0x56')]['create'](_['defaults'](_0x4acd11[_0x11bb('0x4b')],{'firstName':_0x4acd11[_0x11bb('0x4b')]['to'],'email':_0x4acd11[_0x11bb('0x4b')]['to'],'phone':_0x4acd11[_0x11bb('0x4b')]['to'],'ListId':_0x489082[_0x11bb('0x65')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x11bb('0x16')](function(){if(_0x22cdaf){return respondWithRpcPromise(_0x11bb('0x66'),_0x11bb('0x67'),_0x22cdaf,client9003)[_0x11bb('0x16')](function(_0x25cfcf){return _0x3afa81[_0x11bb('0x27')]({'read':!![],'messageId':_0x25cfcf['messageId'],'sentAt':moment()['format'](_0x11bb('0x68'))});})['catch'](function(_0x5c78f6){logger[_0x11bb('0x1c')]('%s',JSON['stringify'](_0x5c78f6));return _0x3afa81;});}return _0x3afa81;});}return _0x3afa81;}})[_0x11bb('0x16')](respondWithResult(_0x4bc78c,0xc9))['catch'](handleError(_0x4bc78c,null));};exports[_0x11bb('0x69')]=function(_0x28c3a4,_0x378d9c){var _0x45ce7a={'agent':{},'channel':_0x11bb('0x6a')};if(_0x28c3a4['body']['id']){delete _0x28c3a4[_0x11bb('0x4b')]['id'];}_0x28c3a4[_0x11bb('0x4b')]['read']=!![];_0x28c3a4[_0x11bb('0x4b')][_0x11bb('0x6b')]=moment()[_0x11bb('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');_0x28c3a4['body'][_0x11bb('0x6d')]=_0x28c3a4[_0x11bb('0x4b')][_0x11bb('0x6d')]||_0x28c3a4['user']['id'];_0x45ce7a[_0x11bb('0x6e')]['id']=_0x28c3a4[_0x11bb('0x4b')][_0x11bb('0x6d')];return db['MailMessage'][_0x11bb('0x4a')]({'where':{'id':_0x28c3a4[_0x11bb('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x378d9c,null))[_0x11bb('0x16')](saveUpdates(_0x28c3a4[_0x11bb('0x4b')],null))[_0x11bb('0x16')](function(_0x80d4e3){if(_0x80d4e3){_0x45ce7a[_0x11bb('0x1d')]=_0x80d4e3[_0x11bb('0x6f')]({'plain':!![]});return db[_0x11bb('0x70')]['find']({'where':{'id':_0x80d4e3['MailInteractionId']}});}return null;})[_0x11bb('0x16')](handleEntityNotFound(_0x378d9c,null))[_0x11bb('0x16')](function(_0x3462d3){if(_0x3462d3){return _0x3462d3[_0x11bb('0x27')]({'UserId':_0x28c3a4['body'][_0x11bb('0x6d')],'read1stAt':_[_0x11bb('0x5a')](_0x3462d3[_0x11bb('0x71')])?moment()['format'](_0x11bb('0x68')):undefined});}return null;})['then'](function(_0x50bedd){if(_0x50bedd){_0x45ce7a['interaction']=_0x50bedd[_0x11bb('0x6f')]({'plain':!![]});interaction_log[_0x11bb('0x17')](_0x11bb('0x72'),_0x28c3a4[_0x11bb('0x73')]['id'],_0x28c3a4[_0x11bb('0x73')][_0x11bb('0x2b')],_0x28c3a4[_0x11bb('0x73')][_0x11bb('0x74')],_0x45ce7a[_0x11bb('0x75')]['id'],_0x28c3a4[_0x11bb('0x4b')]?JSON[_0x11bb('0x1b')](_0x28c3a4[_0x11bb('0x4b')]):_0x11bb('0x76'));return respondWithRpcPromise(_0x11bb('0x77'),'acceptMessage',_0x45ce7a);}return null;})['then'](function(_0x5016d0){var _0x21a3be=_0x11bb('0x78')+_0x5016d0[_0x11bb('0x1d')][_0x11bb('0x79')];return db['sequelize'][_0x11bb('0x33')](_0x21a3be,{'type':db[_0x11bb('0x7a')][_0x11bb('0x7b')][_0x11bb('0x7c')],'raw':!![]})['then'](function(_0x2a3865){return _0x2a3865;});})[_0x11bb('0x16')](function(_0x871be8){if(_0x871be8){_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x7d')]=_0x871be8[0x0];if(!_0x28c3a4[_0x11bb('0x4b')][_0x11bb('0x6d')])return;return db[_0x11bb('0x7e')]['find']({'where':{'id':_0x28c3a4[_0x11bb('0x4b')]['UserId'],'role':_0x11bb('0x6e')},'attributes':['id','name',_0x11bb('0x7f'),'email',_0x11bb('0x80')],'raw':!![]});}return null;})['then'](function(_0x195fdc){if(!_0x195fdc)return null;_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x6e')]=_0x195fdc;return _0x45ce7a;})[_0x11bb('0x16')](function(_0xebcff7){if(_0xebcff7){if(_0x28c3a4['body'][_0x11bb('0x81')]){_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x82')]=util[_0x11bb('0x6c')](_0x11bb('0x83'),_0x28c3a4[_0x11bb('0x73')][_0x11bb('0x2b')]);_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x84')]=_0x45ce7a[_0x11bb('0x84')];_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x85')]=_0x45ce7a['channel'];_0x45ce7a['message']['event']=_0x11bb('0x69');_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x4b')]=htmlToText[_0x11bb('0x86')](_0x45ce7a['message'][_0x11bb('0x4b')]);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x45ce7a[_0x11bb('0x1d')]},client9002)['then'](function(){return _0x45ce7a;});}return _0x45ce7a;}return null;})[_0x11bb('0x16')](respondWithResult(_0x378d9c,null))[_0x11bb('0x1f')](handleError(_0x378d9c,null));};exports[_0x11bb('0x87')]=function(_0x3cc32f,_0x4230cc){var _0x18f01e={'agent':{},'channel':_0x11bb('0x6a')};if(_0x3cc32f[_0x11bb('0x4b')]['id']){delete _0x3cc32f[_0x11bb('0x4b')]['id'];}_0x3cc32f['body'][_0x11bb('0x6d')]=_0x3cc32f['body']['UserId']||_0x3cc32f['user']['id'];_0x18f01e[_0x11bb('0x6e')]['id']=_0x3cc32f[_0x11bb('0x4b')]['UserId'];return db[_0x11bb('0x2e')]['find']({'where':{'id':_0x3cc32f['params']['id'],'UserId':null}})[_0x11bb('0x16')](handleEntityNotFound(_0x4230cc,null))['then'](function(_0x1ef986){if(_0x1ef986){_0x18f01e[_0x11bb('0x1d')]=_0x1ef986[_0x11bb('0x6f')]({'plain':!![]});return db[_0x11bb('0x70')][_0x11bb('0x4a')]({'where':{'id':_0x1ef986[_0x11bb('0x88')]}});}return null;})[_0x11bb('0x16')](handleEntityNotFound(_0x4230cc,null))[_0x11bb('0x16')](function(_0x5eea2e){if(_0x5eea2e){_0x18f01e[_0x11bb('0x75')]=_0x5eea2e[_0x11bb('0x6f')]({'plain':!![]});interaction_log[_0x11bb('0x17')](_0x11bb('0x89'),_0x3cc32f[_0x11bb('0x73')]['id'],_0x3cc32f[_0x11bb('0x73')][_0x11bb('0x2b')],_0x3cc32f[_0x11bb('0x73')][_0x11bb('0x74')],_0x18f01e['interaction']['id'],_0x3cc32f[_0x11bb('0x4b')]?JSON['stringify'](_0x3cc32f[_0x11bb('0x4b')]):_0x11bb('0x76'));return respondWithRpcPromise(_0x11bb('0x8a'),_0x11bb('0x8b'),_0x18f01e);}return null;})[_0x11bb('0x16')](function(_0x55a288){var _0x3aa0d1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x55a288['message']['ContactId'];return db[_0x11bb('0x8c')]['query'](_0x3aa0d1,{'type':db[_0x11bb('0x7a')][_0x11bb('0x7b')][_0x11bb('0x7c')],'raw':!![]})['then'](function(_0x4639d2){return _0x4639d2;});})[_0x11bb('0x16')](function(_0x4930cc){if(_0x4930cc){_0x18f01e[_0x11bb('0x1d')][_0x11bb('0x7d')]=_0x4930cc[0x0];if(!_0x3cc32f[_0x11bb('0x4b')][_0x11bb('0x6d')])return;return db['User'][_0x11bb('0x4a')]({'where':{'id':_0x3cc32f[_0x11bb('0x4b')]['UserId'],'role':_0x11bb('0x6e')},'attributes':['id',_0x11bb('0x2b'),'fullname','email',_0x11bb('0x80')],'raw':!![]});}return null;})[_0x11bb('0x16')](function(_0x41ee06){if(!_0x41ee06)return null;_0x18f01e[_0x11bb('0x1d')]['agent']=_0x41ee06;return _0x18f01e;})[_0x11bb('0x16')](function(_0x3faae8){if(_0x3faae8){_0x3faae8[_0x11bb('0x1d')][_0x11bb('0x82')]=util[_0x11bb('0x6c')](_0x11bb('0x83'),_0x3cc32f[_0x11bb('0x73')][_0x11bb('0x2b')]);_0x3faae8[_0x11bb('0x1d')][_0x11bb('0x84')]=_0x18f01e['channel'];_0x3faae8[_0x11bb('0x1d')]['motionChannel']=_0x18f01e[_0x11bb('0x84')];_0x3faae8[_0x11bb('0x1d')]['event']=_0x11bb('0x87');_0x3faae8['message'][_0x11bb('0x4b')]=htmlToText['fromString'](_0x18f01e['message'][_0x11bb('0x4b')]);respondWithRpcPromise(_0x11bb('0x8d'),_0x11bb('0x8d'),{'event':_0x11bb('0x8e'),'message':_0x3faae8[_0x11bb('0x1d')]},client9002);return _0x18f01e;}return null;})[_0x11bb('0x16')](respondWithResult(_0x4230cc,null))[_0x11bb('0x1f')](handleError(_0x4230cc,null));};exports[_0x11bb('0x8f')]=function(_0x1c4982,_0x23ce6c){var _0x5cd44c=moment()[_0x11bb('0x90')]()[_0x11bb('0x91')]();var _0x14c7fd=path[_0x11bb('0x62')](config[_0x11bb('0x63')],_0x11bb('0x92'),'files','tmp');var _0x705634=path['join'](config[_0x11bb('0x63')],_0x11bb('0x92'),_0x11bb('0x93'),_0x11bb('0x61'));var _0x5756ca=util[_0x11bb('0x6c')](_0x11bb('0x94'),_0x5cd44c);return db[_0x11bb('0x2e')][_0x11bb('0x4a')]({'where':{'id':_0x1c4982[_0x11bb('0x4c')]['id']},'attributes':['id',_0x11bb('0x4b'),_0x11bb('0x95'),'to','cc',_0x11bb('0x96'),_0x11bb('0x97'),_0x11bb('0x98')],'include':_0x1c4982[_0x11bb('0x33')][_0x11bb('0x61')]?[{'model':db['Attachment'],'as':_0x11bb('0x99')}]:undefined})[_0x11bb('0x16')](handleEntityNotFound(_0x23ce6c,null))['then'](function(_0x4d3731){if(_0x4d3731){var _0x5b3588=_0x4d3731;var _0x512479={'from':_0x5b3588[_0x11bb('0x95')],'to':_0x5b3588['to'],'subject':_0x5b3588[_0x11bb('0x97')],'html':htmlEntities[_0x11bb('0x9a')](_0x5b3588['body']),'headers':{'Date':moment(_0x5b3588[_0x11bb('0x98')])['format'](_0x11bb('0x9b'))},'attachments':[]};if(_0x4d3731['cc']){_0x512479[_0x11bb('0x9c')]['Cc']=_0x4d3731['cc'];}if(_0x4d3731[_0x11bb('0x96')]){_0x512479[_0x11bb('0x9c')][_0x11bb('0x9d')]=_0x4d3731[_0x11bb('0x96')];}return new BPromise(function(_0x43f7ea,_0x468921){if(_0x4d3731[_0x11bb('0x99')]){for(var _0x187eb7=0x0;_0x187eb7<_0x4d3731[_0x11bb('0x99')]['length'];_0x187eb7++){var _0x42901d=_0x4d3731['Attachments'][_0x187eb7];var _0xee76d4=path[_0x11bb('0x62')](_0x705634,_0x42901d['basename']);if(fs[_0x11bb('0x9e')](_0xee76d4)){_0x512479[_0x11bb('0x61')][_0x11bb('0x9f')]({'name':_0x42901d['name'],'contentType':_0x42901d[_0x11bb('0x30')],'data':fs[_0x11bb('0xa0')](_0xee76d4)});}}}emlformat['build'](_0x512479,function(_0x36ab01,_0xaccd0b){if(_0x36ab01)return _0x468921(_0x36ab01);fs[_0x11bb('0xa1')](path['join'](_0x14c7fd,_0x5756ca),_0xaccd0b);return _0x43f7ea(_0xaccd0b);});});}})['then'](function(_0x180364){if(_0x180364){return _0x23ce6c['download'](path[_0x11bb('0x62')](_0x14c7fd,_0x5756ca),_0x5756ca,function(_0xce55a1){if(!_0xce55a1)fs[_0x11bb('0xa2')](path['join'](_0x14c7fd,_0x5756ca));});}})['catch'](handleError(_0x23ce6c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 91a23e7..61df8c5 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 _0x6be1=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x56c036,_0x5b11bd){var _0x21d6ce=function(_0x37d00d){while(--_0x37d00d){_0x56c036['push'](_0x56c036['shift']());}};_0x21d6ce(++_0x5b11bd);}(_0x6be1,0xcf));var _0x16be=function(_0x3649b6,_0x1da019){_0x3649b6=_0x3649b6-0x0;var _0xc9bba9=_0x6be1[_0x3649b6];return _0xc9bba9;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x16be('0x0'))['db'][_0x16be('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x16be('0x2')](0x0);var events={'afterCreate':_0x16be('0x3'),'afterUpdate':_0x16be('0x4'),'afterDestroy':_0x16be('0x5')};function emitEvent(_0x4279a0){return function(_0x2b20cb,_0x265a1a,_0x411b7b){MailMessageEvents[_0x16be('0x6')](_0x4279a0+':'+_0x2b20cb['id'],_0x2b20cb);MailMessageEvents[_0x16be('0x6')](_0x4279a0,_0x2b20cb);_0x411b7b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x16be('0x7')](e,emitEvent(event));}}module[_0x16be('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xb64b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3c0f79,_0xafde90){var _0x1fc206=function(_0x2f1587){while(--_0x2f1587){_0x3c0f79['push'](_0x3c0f79['shift']());}};_0x1fc206(++_0xafde90);}(_0xb64b,0x16d));var _0xbb64=function(_0x245f64,_0x4ae342){_0x245f64=_0x245f64-0x0;var _0x3447e0=_0xb64b[_0x245f64];return _0x3447e0;};'use strict';var EventEmitter=require(_0xbb64('0x0'));var MailMessage=require(_0xbb64('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbb64('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbb64('0x3')};function emitEvent(_0x50a347){return function(_0x1e1ec4,_0x68978c,_0x465efc){MailMessageEvents[_0xbb64('0x4')](_0x50a347+':'+_0x1e1ec4['id'],_0x1e1ec4);MailMessageEvents[_0xbb64('0x4')](_0x50a347,_0x1e1ec4);_0x465efc(null);};}for(var e in events){if(events[_0xbb64('0x5')](e)){var event=events[e];MailMessage[_0xbb64('0x6')](e,emitEvent(event));}}module[_0xbb64('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 8247362..f812b9c 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 _0x6d6d=['../../config/logger','api','moment','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','MailInteractionId','then','update','createdAt','catch','utf8mb4','util'];(function(_0x5f052b,_0x36addf){var _0x334e80=function(_0x5893a2){while(--_0x5893a2){_0x5f052b['push'](_0x5f052b['shift']());}};_0x334e80(++_0x36addf);}(_0x6d6d,0x149));var _0xd6d6=function(_0x1448c9,_0xba302c){_0x1448c9=_0x1448c9-0x0;var _0x1e3aec=_0x6d6d[_0x1448c9];return _0x1e3aec;};'use strict';var _=require('lodash');var util=require(_0xd6d6('0x0'));var logger=require(_0xd6d6('0x1'))(_0xd6d6('0x2'));var moment=require(_0xd6d6('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6d6('0x4'));var htmlToText=require(_0xd6d6('0x5'));var fs=require('fs');var path=require(_0xd6d6('0x6'));var rimraf=require('rimraf');var config=require(_0xd6d6('0x7'));var attributes=require(_0xd6d6('0x8'));module[_0xd6d6('0x9')]=function(_0x64088c,_0x135d4a){return _0x64088c[_0xd6d6('0xa')](_0xd6d6('0xb'),attributes,{'tableName':_0xd6d6('0xc'),'paranoid':![],'indexes':[{'name':_0xd6d6('0xd'),'fields':[_0xd6d6('0xd')]},{'name':_0xd6d6('0xe'),'fields':['plainBody',_0xd6d6('0xf')],'type':_0xd6d6('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x12c0eb,_0x2f98e1,_0x216d74){if(_0x12c0eb[_0xd6d6('0x11')]){_0x12c0eb['plainBody']=htmlToText[_0xd6d6('0x12')](_0x12c0eb[_0xd6d6('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x216d74(null,_0x2f98e1);},'afterCreate':function(_0xadfba0,_0x5e5b3d,_0x5e49d9){var _0x247350=_0x64088c[_0xd6d6('0x13')];var _0x41bcce=_0xadfba0[_0xd6d6('0x14')]({'plain':!![]});if(_0x41bcce[_0xd6d6('0x15')]['toLowerCase']()==='in'||_0x41bcce[_0xd6d6('0x15')][_0xd6d6('0x16')]()===_0xd6d6('0x17')&&!_0x41bcce[_0xd6d6('0x18')]&&!_[_0xd6d6('0x19')](_0x41bcce['UserId'])){_0x247350[_0xd6d6('0x1a')]['findOne']({'where':{'id':_0x41bcce[_0xd6d6('0x1b')]}})[_0xd6d6('0x1c')](function(_0x5887e8){if(_0x5887e8){_0x5887e8[_0xd6d6('0x1d')]({'lastMsgAt':_0x41bcce[_0xd6d6('0x1e')],'lastMsgDirection':_0x41bcce['direction'][_0xd6d6('0x16')]()});}})[_0xd6d6('0x1f')](function(_0x505994){console['error'](_0x505994);});}_0x5e49d9();}},'charset':_0xd6d6('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe8a2=['messageId','subject','FULLTEXT','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteraction','MailInteractionId','then','update','error','utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages'];(function(_0x517961,_0x5e49fd){var _0x1f10c3=function(_0x430e05){while(--_0x430e05){_0x517961['push'](_0x517961['shift']());}};_0x1f10c3(++_0x5e49fd);}(_0xe8a2,0x160));var _0x2e8a=function(_0x2f5ea8,_0x52a89b){_0x2f5ea8=_0x2f5ea8-0x0;var _0x403463=_0xe8a2[_0x2f5ea8];return _0x403463;};'use strict';var _=require('lodash');var util=require(_0x2e8a('0x0'));var logger=require('../../config/logger')(_0x2e8a('0x1'));var moment=require(_0x2e8a('0x2'));var BPromise=require(_0x2e8a('0x3'));var rp=require(_0x2e8a('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x2e8a('0x5'));var rimraf=require(_0x2e8a('0x6'));var config=require(_0x2e8a('0x7'));var attributes=require(_0x2e8a('0x8'));module['exports']=function(_0x4a6f5d,_0x13fb65){return _0x4a6f5d[_0x2e8a('0x9')](_0x2e8a('0xa'),attributes,{'tableName':_0x2e8a('0xb'),'paranoid':![],'indexes':[{'name':_0x2e8a('0xc'),'fields':[_0x2e8a('0xc')]},{'name':'fti_mail_messages','fields':['plainBody',_0x2e8a('0xd')],'type':_0x2e8a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x424fcb,_0x1a5890,_0x2a886d){if(_0x424fcb['body']){_0x424fcb['plainBody']=htmlToText[_0x2e8a('0xf')](_0x424fcb['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2a886d(null,_0x1a5890);},'afterCreate':function(_0x58b4fd,_0x489f9a,_0x5f2232){var _0x1167b0=_0x4a6f5d[_0x2e8a('0x10')];var _0x587b85=_0x58b4fd[_0x2e8a('0x11')]({'plain':!![]});if(_0x587b85['direction']['toLowerCase']()==='in'||_0x587b85[_0x2e8a('0x12')][_0x2e8a('0x13')]()==='out'&&!_0x587b85[_0x2e8a('0x14')]&&!_['isNil'](_0x587b85[_0x2e8a('0x15')])){_0x1167b0[_0x2e8a('0x16')]['findOne']({'where':{'id':_0x587b85[_0x2e8a('0x17')]}})[_0x2e8a('0x18')](function(_0x41396d){if(_0x41396d){_0x41396d[_0x2e8a('0x19')]({'lastMsgAt':_0x587b85['createdAt'],'lastMsgDirection':_0x587b85[_0x2e8a('0x12')]['toLowerCase']()});}})['catch'](function(_0x5a8944){console[_0x2e8a('0x1a')](_0x5a8944);});}_0x5f2232();}},'charset':_0x2e8a('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 0da5507..6da44fd 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 _0x36ee=['catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateMailMessage','MailMessage','create','body','options','debug'];(function(_0x27b938,_0x4a7743){var _0x27788d=function(_0x353764){while(--_0x353764){_0x27b938['push'](_0x27b938['shift']());}};_0x27788d(++_0x4a7743);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});config[_0xe36e('0xb')]=_[_0xe36e('0xc')](config['redis'],{'host':_0xe36e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe36e('0xb')]));require(_0xe36e('0xe'))[_0xe36e('0xf')](socket);function respondWithRpcPromise(_0x47ce3a,_0xf119e4,_0x48981b){return new BPromise(function(_0x2e968d,_0x2133cf){return client[_0xe36e('0x10')](_0x47ce3a,_0x48981b)[_0xe36e('0x11')](function(_0xce0110){logger[_0xe36e('0x12')](_0xe36e('0x13'),_0xf119e4,_0xe36e('0x14'));logger['debug'](_0xe36e('0x15'),_0xf119e4,_0xe36e('0x14'),JSON[_0xe36e('0x16')](_0xce0110));if(_0xce0110[_0xe36e('0x17')]){if(_0xce0110['error'][_0xe36e('0x18')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xf119e4,_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);return _0x2133cf(_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);}logger[_0xe36e('0x17')](_0xe36e('0x13'),_0xf119e4,_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);return _0x2e968d(_0xce0110[_0xe36e('0x17')][_0xe36e('0x19')]);}else{logger['info'](_0xe36e('0x13'),_0xf119e4,_0xe36e('0x14'));_0x2e968d(_0xce0110['result'][_0xe36e('0x19')]);}})['catch'](function(_0x471400){logger[_0xe36e('0x17')]('MailMessage,\x20%s,\x20%s',_0xf119e4,_0x471400);_0x2133cf(_0x471400);});});}exports[_0xe36e('0x1a')]=function(_0x6aa186){var _0x21efe7=this;return new Promise(function(_0x597331,_0x21e95e){return db[_0xe36e('0x1b')][_0xe36e('0x1c')](_0x6aa186[_0xe36e('0x1d')],{'raw':_0x6aa186[_0xe36e('0x1e')]?_0x6aa186[_0xe36e('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xe36e('0x11')](function(_0x4f214a){logger[_0xe36e('0x12')](_0xe36e('0x1a'),_0x6aa186);logger[_0xe36e('0x1f')]('CreateMailMessage',_0x6aa186,JSON['stringify'](_0x4f214a));_0x597331(_0x4f214a);})[_0xe36e('0x20')](function(_0x10818d){logger[_0xe36e('0x17')](_0xe36e('0x1a'),_0x10818d[_0xe36e('0x19')],_0x6aa186);_0x21e95e(_0x21efe7[_0xe36e('0x17')](0x1f4,_0x10818d[_0xe36e('0x19')]));});});}; \ No newline at end of file +var _0x896e=['request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s'];(function(_0x200a86,_0x2f126b){var _0x241c2b=function(_0x27fee4){while(--_0x27fee4){_0x200a86['push'](_0x200a86['shift']());}};_0x241c2b(++_0x2f126b);}(_0x896e,0x1e9));var _0xe896=function(_0x55b906,_0x338c0e){_0x55b906=_0x55b906-0x0;var _0x5d2117=_0x896e[_0x55b906];return _0x5d2117;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});}exports[_0xe896('0x1d')]=function(_0x3ac8b8){var _0x388c2e=this;return new Promise(function(_0x32d3d3,_0x49547b){return db[_0xe896('0x1e')]['create'](_0x3ac8b8['body'],{'raw':_0x3ac8b8[_0xe896('0x1f')]?_0x3ac8b8[_0xe896('0x1f')][_0xe896('0x20')]===undefined?!![]:![]:!![]})[_0xe896('0x13')](function(_0x498469){logger[_0xe896('0x21')]('CreateMailMessage',_0x3ac8b8);logger['debug'](_0xe896('0x1d'),_0x3ac8b8,JSON[_0xe896('0x17')](_0x498469));_0x32d3d3(_0x498469);})[_0xe896('0x1c')](function(_0x2e2c10){logger[_0xe896('0x18')](_0xe896('0x1d'),_0x2e2c10[_0xe896('0x1a')],_0x3ac8b8);_0x49547b(_0x388c2e['error'](0x1f4,_0x2e2c10[_0xe896('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index da911c0..5bc340c 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 _0x7762=['mailMessage:','./mailMessage.events','save','remove','register','length'];(function(_0x4c80ef,_0xeb8bfd){var _0x5e6822=function(_0x1c12f0){while(--_0x1c12f0){_0x4c80ef['push'](_0x4c80ef['shift']());}};_0x5e6822(++_0xeb8bfd);}(_0x7762,0x17b));var _0x2776=function(_0x259fb3,_0x369881){_0x259fb3=_0x259fb3-0x0;var _0x4906cb=_0x7762[_0x259fb3];return _0x4906cb;};'use strict';var MailMessageEvents=require(_0x2776('0x0'));var events=[_0x2776('0x1'),_0x2776('0x2'),'update'];function createListener(_0x4266c6,_0x41dfda){return function(_0x30f3a1){_0x41dfda['emit'](_0x4266c6,_0x30f3a1);};}function removeListener(_0x43366b,_0x122cd9){return function(){MailMessageEvents['removeListener'](_0x43366b,_0x122cd9);};}exports[_0x2776('0x3')]=function(_0x489e72){for(var _0x4eefcf=0x0,_0x51fb08=events[_0x2776('0x4')];_0x4eefcf<_0x51fb08;_0x4eefcf++){var _0x110f10=events[_0x4eefcf];var _0x5364ad=createListener(_0x2776('0x5')+_0x110f10,_0x489e72);MailMessageEvents['on'](_0x110f10,_0x5364ad);}}; \ No newline at end of file +var _0x65e9=['./mailMessage.events','save','update','removeListener','register','length','mailMessage:'];(function(_0x38894d,_0x1883d8){var _0x5614fe=function(_0x181989){while(--_0x181989){_0x38894d['push'](_0x38894d['shift']());}};_0x5614fe(++_0x1883d8);}(_0x65e9,0x15e));var _0x965e=function(_0x475769,_0x1f80ee){_0x475769=_0x475769-0x0;var _0x4fdac4=_0x65e9[_0x475769];return _0x4fdac4;};'use strict';var MailMessageEvents=require(_0x965e('0x0'));var events=[_0x965e('0x1'),'remove',_0x965e('0x2')];function createListener(_0x537fb6,_0x18623f){return function(_0x120820){_0x18623f['emit'](_0x537fb6,_0x120820);};}function removeListener(_0xd368fc,_0x8900ca){return function(){MailMessageEvents[_0x965e('0x3')](_0xd368fc,_0x8900ca);};}exports[_0x965e('0x4')]=function(_0x32e6ad){for(var _0x363e45=0x0,_0xa623d5=events[_0x965e('0x5')];_0x363e45<_0xa623d5;_0x363e45++){var _0x38081c=events[_0x363e45];var _0x4bc92d=createListener(_0x965e('0x6')+_0x38081c,_0x32e6ad);MailMessageEvents['on'](_0x38081c,_0x4bc92d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 1094cd5..975e1a0 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 _0x8ab0=['update','delete','removeTeams','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x8ab0,0xdc));var _0x08ab=function(_0x412195,_0x4b32e3){_0x412195=_0x412195-0x0;var _0x47eccf=_0x8ab0[_0x412195];return _0x47eccf;};'use strict';var multer=require(_0x08ab('0x0'));var util=require('util');var path=require(_0x08ab('0x1'));var timeout=require(_0x08ab('0x2'));var express=require(_0x08ab('0x3'));var router=express['Router']();var fs_extra=require(_0x08ab('0x4'));var auth=require(_0x08ab('0x5'));var interaction=require(_0x08ab('0x6'));var config=require('../../config/environment');var controller=require(_0x08ab('0x7'));router[_0x08ab('0x8')]('/',auth[_0x08ab('0x9')](),controller[_0x08ab('0xa')]);router[_0x08ab('0x8')](_0x08ab('0xb'),auth['isAuthenticated'](),controller[_0x08ab('0xc')]);router['get'](_0x08ab('0xd'),auth['isAuthenticated'](),controller[_0x08ab('0xe')]);router['get']('/:id/members',auth[_0x08ab('0x9')](),controller[_0x08ab('0xf')]);router['get'](_0x08ab('0x10'),auth[_0x08ab('0x9')](),controller[_0x08ab('0x11')]);router['get'](_0x08ab('0x12'),auth[_0x08ab('0x9')](),controller[_0x08ab('0x13')]);router['post']('/',auth[_0x08ab('0x9')](),controller['create']);router[_0x08ab('0x14')]('/:id/teams',auth[_0x08ab('0x9')](),controller[_0x08ab('0x15')]);router[_0x08ab('0x14')](_0x08ab('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x08ab('0x16')](_0x08ab('0xd'),auth[_0x08ab('0x9')](),controller[_0x08ab('0x17')]);router[_0x08ab('0x18')](_0x08ab('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x08ab('0x18')](_0x08ab('0x10'),auth[_0x08ab('0x9')](),controller[_0x08ab('0x19')]);router[_0x08ab('0x18')]('/:id/users',auth[_0x08ab('0x9')](),controller['removeAgents']);module[_0x08ab('0x1a')]=router; \ No newline at end of file +var _0x903a=['put','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','create','post','addAgents'];(function(_0x469411,_0x22d14a){var _0x5503ae=function(_0x25335c){while(--_0x25335c){_0x469411['push'](_0x469411['shift']());}};_0x5503ae(++_0x22d14a);}(_0x903a,0x17f));var _0xa903=function(_0x420600,_0x28865c){_0x420600=_0x420600-0x0;var _0x2a0117=_0x903a[_0x420600];return _0x2a0117;};'use strict';var multer=require('multer');var util=require(_0xa903('0x0'));var path=require('path');var timeout=require(_0xa903('0x1'));var express=require(_0xa903('0x2'));var router=express[_0xa903('0x3')]();var fs_extra=require(_0xa903('0x4'));var auth=require(_0xa903('0x5'));var interaction=require(_0xa903('0x6'));var config=require(_0xa903('0x7'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0xa903('0x8')](),controller[_0xa903('0x9')]);router[_0xa903('0xa')](_0xa903('0xb'),auth[_0xa903('0x8')](),controller[_0xa903('0xc')]);router[_0xa903('0xa')](_0xa903('0xd'),auth[_0xa903('0x8')](),controller[_0xa903('0xe')]);router[_0xa903('0xa')]('/:id/members',auth[_0xa903('0x8')](),controller[_0xa903('0xf')]);router[_0xa903('0xa')](_0xa903('0x10'),auth['isAuthenticated'](),controller[_0xa903('0x11')]);router[_0xa903('0xa')](_0xa903('0x12'),auth[_0xa903('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa903('0x8')](),controller[_0xa903('0x13')]);router[_0xa903('0x14')](_0xa903('0x10'),auth[_0xa903('0x8')](),controller['addTeams']);router[_0xa903('0x14')](_0xa903('0x12'),auth[_0xa903('0x8')](),controller[_0xa903('0x15')]);router[_0xa903('0x16')](_0xa903('0xd'),auth[_0xa903('0x8')](),controller['update']);router[_0xa903('0x17')](_0xa903('0xd'),auth['isAuthenticated'](),controller[_0xa903('0x18')]);router[_0xa903('0x17')](_0xa903('0x10'),auth[_0xa903('0x8')](),controller[_0xa903('0x19')]);router[_0xa903('0x17')](_0xa903('0x12'),auth[_0xa903('0x8')](),controller['removeAgents']);module[_0xa903('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6aac742..f839187 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 _0x1bba=['INTEGER','ENUM','roundrobin','sequelize','STRING','name'];(function(_0x3680b3,_0x107ab8){var _0x2d65cc=function(_0x30aeac){while(--_0x30aeac){_0x3680b3['push'](_0x3680b3['shift']());}};_0x2d65cc(++_0x107ab8);}(_0x1bba,0x105));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa1bb('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1bb('0x1')],'unique':_0xa1bb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa1bb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa1bb('0x4')]('rrmemory','beepall',_0xa1bb('0x5'))}}; \ No newline at end of file +var _0xe221=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1ba5c5,_0x2178d9){var _0x28d8a7=function(_0x5cb087){while(--_0x5cb087){_0x1ba5c5['push'](_0x1ba5c5['shift']());}};_0x28d8a7(++_0x2178d9);}(_0xe221,0x133));var _0x1e22=function(_0x58d188,_0xa06a1f){_0x58d188=_0x58d188-0x0;var _0x1fc4a6=_0xe221[_0x58d188];return _0x1fc4a6;};'use strict';var Sequelize=require(_0x1e22('0x0'));module[_0x1e22('0x1')]={'name':{'type':Sequelize[_0x1e22('0x2')],'unique':_0x1e22('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1e22('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1e22('0x5')](_0x1e22('0x6'),_0x1e22('0x7'),_0x1e22('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b372907..7f850ee 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 _0x0c08=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','length','findAndCountAll','UserId','agent','updatedAt','rows','format','%s/%s','mailPause','createdAt','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','transaction','each','emit','userMailQueue:save','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','compact','removeTeams','isEmpty','forEach','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','localhost','socket.io-emitter','redis','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','get','error','stack','send','index','MailQueue','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','create'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x0c08,0x1e6));var _0x80c0=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0x0c08[_0xac56ce];return _0x5105e1;};'use strict';var emlformat=require(_0x80c0('0x0'));var rimraf=require(_0x80c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80c0('0x2'));var rp=require(_0x80c0('0x3'));var moment=require(_0x80c0('0x4'));var BPromise=require(_0x80c0('0x5'));var Mustache=require(_0x80c0('0x6'));var util=require('util');var path=require(_0x80c0('0x7'));var sox=require('sox');var csv=require(_0x80c0('0x8'));var ejs=require(_0x80c0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x80c0('0xa'));var squel=require(_0x80c0('0xb'));var crypto=require(_0x80c0('0xc'));var jsforce=require(_0x80c0('0xd'));var deskjs=require(_0x80c0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x80c0('0xf'));var Redis=require(_0x80c0('0x10'));var authService=require(_0x80c0('0x11'));var qs=require(_0x80c0('0x12'));var as=require(_0x80c0('0x13'));var hardwareService=require(_0x80c0('0x14'));var logger=require('../../config/logger')(_0x80c0('0x15'));var utils=require(_0x80c0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x80c0('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x80c0('0x18'),'port':0x18eb});var socket=require(_0x80c0('0x19'))(new Redis(config[_0x80c0('0x1a')]));require(_0x80c0('0x1b'))[_0x80c0('0x1c')](socket);function respondWithStatusCode(_0xbc152a,_0xea1ec0){_0xea1ec0=_0xea1ec0||0xcc;return function(_0x14eb32){if(_0x14eb32){return _0xbc152a[_0x80c0('0x1d')](_0xea1ec0);}return _0xbc152a[_0x80c0('0x1e')](_0xea1ec0)[_0x80c0('0x1f')]();};}function respondWithResult(_0x169701,_0x4d3341){_0x4d3341=_0x4d3341||0xc8;return function(_0x4e5394){if(_0x4e5394){return _0x169701[_0x80c0('0x1e')](_0x4d3341)[_0x80c0('0x20')](_0x4e5394);}};}function respondWithFilteredResult(_0x204eb6,_0x4f9325){return function(_0x230e77){if(_0x230e77){var _0x254475=typeof _0x4f9325['offset']===_0x80c0('0x21')&&typeof _0x4f9325[_0x80c0('0x22')]==='undefined';var _0x5163bf=_0x230e77[_0x80c0('0x23')];var _0x19ac32=_0x254475?0x0:_0x4f9325[_0x80c0('0x24')];var _0x5cee69=_0x254475?_0x230e77[_0x80c0('0x23')]:_0x4f9325[_0x80c0('0x24')]+_0x4f9325['limit'];var _0x20f480;if(_0x5cee69>=_0x5163bf){_0x5cee69=_0x5163bf;_0x20f480=0xc8;}else{_0x20f480=0xce;}_0x204eb6[_0x80c0('0x1e')](_0x20f480);return _0x204eb6['set'](_0x80c0('0x25'),_0x19ac32+'-'+_0x5cee69+'/'+_0x5163bf)[_0x80c0('0x20')](_0x230e77);}return null;};}function patchUpdates(_0x4879f3){return function(_0x3aabcf){try{jsonpatch['apply'](_0x3aabcf,_0x4879f3,!![]);}catch(_0x147cee){return BPromise[_0x80c0('0x26')](_0x147cee);}return _0x3aabcf['save']();};}function saveUpdates(_0x58bd36,_0x555513){return function(_0x5389f7){if(_0x5389f7){return _0x5389f7[_0x80c0('0x27')](_0x58bd36)[_0x80c0('0x28')](function(_0x588660){return _0x588660;});}return null;};}function removeEntity(_0x2e7c0b,_0x4851aa){return function(_0x2a742a){if(_0x2a742a){return _0x2a742a[_0x80c0('0x29')]()[_0x80c0('0x28')](function(){var _0x2e63ed=_0x2a742a[_0x80c0('0x2a')]({'plain':!![]});var _0x482929='MailQueues';return db['UserProfileResource'][_0x80c0('0x29')]({'where':{'type':_0x482929,'resourceId':_0x2e63ed['id']}})[_0x80c0('0x28')](function(){return _0x2a742a;});})[_0x80c0('0x28')](function(){_0x2e7c0b[_0x80c0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12a780,_0x581adc){return function(_0x531c46){if(!_0x531c46){_0x12a780[_0x80c0('0x1d')](0x194);}return _0x531c46;};}function handleError(_0x545f6b,_0x4eeb94){_0x4eeb94=_0x4eeb94||0x1f4;return function(_0x2a5f90){logger[_0x80c0('0x2b')](_0x2a5f90[_0x80c0('0x2c')]);if(_0x2a5f90['name']){delete _0x2a5f90['name'];}_0x545f6b[_0x80c0('0x1e')](_0x4eeb94)[_0x80c0('0x2d')](_0x2a5f90);};}exports[_0x80c0('0x2e')]=function(_0x343c12,_0x4cea18){var _0x593b42={},_0x36decd={},_0x330bf2={'count':0x0,'rows':[]};var _0x323458=_['map'](db[_0x80c0('0x2f')][_0x80c0('0x30')],function(_0x42e29c){return{'name':_0x42e29c[_0x80c0('0x31')],'type':_0x42e29c[_0x80c0('0x32')][_0x80c0('0x33')]};});_0x36decd[_0x80c0('0x34')]=_[_0x80c0('0x35')](_0x323458,_0x80c0('0x36'));_0x36decd[_0x80c0('0x37')]=_['keys'](_0x343c12['query']);_0x36decd[_0x80c0('0x38')]=_[_0x80c0('0x39')](_0x36decd[_0x80c0('0x34')],_0x36decd['query']);_0x593b42[_0x80c0('0x3a')]=_['intersection'](_0x36decd[_0x80c0('0x34')],qs[_0x80c0('0x3b')](_0x343c12[_0x80c0('0x37')]['fields']));_0x593b42['attributes']=_0x593b42[_0x80c0('0x3a')]['length']?_0x593b42[_0x80c0('0x3a')]:_0x36decd['model'];if(!_0x343c12[_0x80c0('0x37')][_0x80c0('0x3c')](_0x80c0('0x3d'))){_0x593b42[_0x80c0('0x22')]=qs[_0x80c0('0x22')](_0x343c12[_0x80c0('0x37')][_0x80c0('0x22')]);_0x593b42[_0x80c0('0x24')]=qs['offset'](_0x343c12['query'][_0x80c0('0x24')]);}_0x593b42[_0x80c0('0x3e')]=qs[_0x80c0('0x3f')](_0x343c12[_0x80c0('0x37')][_0x80c0('0x3f')]);_0x593b42[_0x80c0('0x40')]=qs['filters'](_[_0x80c0('0x41')](_0x343c12['query'],_0x36decd[_0x80c0('0x38')]),_0x323458);if(_0x343c12[_0x80c0('0x37')][_0x80c0('0x42')]){_0x593b42[_0x80c0('0x40')]=_[_0x80c0('0x43')](_0x593b42['where'],{'$or':_[_0x80c0('0x35')](_0x323458,function(_0x133d5e){if(_0x133d5e[_0x80c0('0x32')]!==_0x80c0('0x44')){var _0x270aca={};_0x270aca[_0x133d5e['name']]={'$like':'%'+_0x343c12['query'][_0x80c0('0x42')]+'%'};return _0x270aca;}})});}_0x593b42=_[_0x80c0('0x43')]({},_0x593b42,_0x343c12[_0x80c0('0x45')]);var _0x597a14={'where':_0x593b42[_0x80c0('0x40')]};return db[_0x80c0('0x2f')][_0x80c0('0x23')](_0x597a14)['then'](function(_0x195110){_0x330bf2[_0x80c0('0x23')]=_0x195110;if(_0x343c12['query']['includeAll']){_0x593b42[_0x80c0('0x46')]=[{'all':!![]}];}return db[_0x80c0('0x2f')][_0x80c0('0x47')](_0x593b42);})[_0x80c0('0x28')](function(_0x36eadb){_0x330bf2['rows']=_0x36eadb;return _0x330bf2;})['then'](respondWithFilteredResult(_0x4cea18,_0x593b42))[_0x80c0('0x48')](handleError(_0x4cea18,null));};exports[_0x80c0('0x49')]=function(_0x105218,_0x130e76){var _0x4f6677={'raw':!![],'where':{'id':_0x105218[_0x80c0('0x4a')]['id']}},_0x5aa0f2={};_0x5aa0f2['model']=_[_0x80c0('0x4b')](db[_0x80c0('0x2f')][_0x80c0('0x30')]);_0x5aa0f2[_0x80c0('0x37')]=_['keys'](_0x105218[_0x80c0('0x37')]);_0x5aa0f2[_0x80c0('0x38')]=_['intersection'](_0x5aa0f2['model'],_0x5aa0f2['query']);_0x4f6677[_0x80c0('0x3a')]=_[_0x80c0('0x39')](_0x5aa0f2[_0x80c0('0x34')],qs['fields'](_0x105218[_0x80c0('0x37')]['fields']));_0x4f6677[_0x80c0('0x3a')]=_0x4f6677[_0x80c0('0x3a')]['length']?_0x4f6677['attributes']:_0x5aa0f2[_0x80c0('0x34')];if(_0x105218['query'][_0x80c0('0x4c')]){_0x4f6677['include']=[{'all':!![]}];}_0x4f6677=_[_0x80c0('0x43')]({},_0x4f6677,_0x105218[_0x80c0('0x45')]);return db[_0x80c0('0x2f')]['find'](_0x4f6677)[_0x80c0('0x28')](handleEntityNotFound(_0x130e76,null))[_0x80c0('0x28')](respondWithResult(_0x130e76,null))[_0x80c0('0x48')](handleError(_0x130e76,null));};exports[_0x80c0('0x4d')]=function(_0x33c738,_0x2c0603){return db[_0x80c0('0x2f')][_0x80c0('0x4d')](_0x33c738[_0x80c0('0x4e')],{})[_0x80c0('0x28')](function(_0x44af76){var _0x1478b5=_0x33c738[_0x80c0('0x4f')][_0x80c0('0x2a')]({'plain':!![]});if(!_0x1478b5)throw new Error(_0x80c0('0x50'));if(_0x1478b5[_0x80c0('0x51')]===_0x80c0('0x4f')){var _0x51dcd7=_0x44af76[_0x80c0('0x2a')]({'plain':!![]});var _0x189fa0=_0x80c0('0x52');return db['UserProfileSection'][_0x80c0('0x53')]({'where':{'name':_0x189fa0,'userProfileId':_0x1478b5[_0x80c0('0x54')]},'raw':!![]})[_0x80c0('0x28')](function(_0x38b8af){if(_0x38b8af&&_0x38b8af[_0x80c0('0x55')]===0x0){return db[_0x80c0('0x56')]['create']({'name':_0x51dcd7[_0x80c0('0x36')],'resourceId':_0x51dcd7['id'],'type':_0x38b8af[_0x80c0('0x36')],'sectionId':_0x38b8af['id']},{})[_0x80c0('0x28')](function(){return _0x44af76;});}else{return _0x44af76;}})[_0x80c0('0x48')](function(_0xaa14af){logger[_0x80c0('0x2b')](_0x80c0('0x57'),_0xaa14af);throw _0xaa14af;});}return _0x44af76;})[_0x80c0('0x28')](respondWithResult(_0x2c0603,0xc9))[_0x80c0('0x48')](handleError(_0x2c0603,null));};exports[_0x80c0('0x27')]=function(_0xad0cbe,_0x4781f5){if(_0xad0cbe[_0x80c0('0x4e')]['id']){delete _0xad0cbe[_0x80c0('0x4e')]['id'];}return db[_0x80c0('0x2f')][_0x80c0('0x53')]({'where':{'id':_0xad0cbe['params']['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x4781f5,null))[_0x80c0('0x28')](saveUpdates(_0xad0cbe[_0x80c0('0x4e')],null))[_0x80c0('0x28')](respondWithResult(_0x4781f5,null))['catch'](handleError(_0x4781f5,null));};exports[_0x80c0('0x29')]=function(_0x581759,_0x571b0d){return db[_0x80c0('0x2f')][_0x80c0('0x53')]({'where':{'id':_0x581759[_0x80c0('0x4a')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x571b0d,null))['then'](removeEntity(_0x571b0d,null))[_0x80c0('0x48')](handleError(_0x571b0d,null));};exports[_0x80c0('0x58')]=function(_0x511272,_0x3ba5d9){return db[_0x80c0('0x2f')][_0x80c0('0x58')]()[_0x80c0('0x28')](respondWithResult(_0x3ba5d9,null))['catch'](handleError(_0x3ba5d9,null));};exports[_0x80c0('0x59')]=function(_0x5a7467,_0x482ce3,_0x1defd1){var _0xf5812={'raw':!![],'where':{}},_0x46e6c2={},_0xb2c114;return db['MailQueue'][_0x80c0('0x5a')]({'where':{'id':_0x5a7467[_0x80c0('0x4a')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x482ce3,null))['then'](function(_0x43c88c){if(_0x43c88c){_0xb2c114=_0x43c88c[_0x80c0('0x2a')]({'plain':!![]});_0x46e6c2['model']=_[_0x80c0('0x4b')](db[_0x80c0('0x5b')]['rawAttributes']);_0x46e6c2[_0x80c0('0x37')]=_['keys'](_0x5a7467[_0x80c0('0x37')]);_0x46e6c2['filters']=_[_0x80c0('0x39')](_0x46e6c2[_0x80c0('0x34')],_0x46e6c2[_0x80c0('0x37')]);_0xf5812[_0x80c0('0x3a')]=_['intersection'](_0x46e6c2[_0x80c0('0x34')],qs[_0x80c0('0x3b')](_0x5a7467[_0x80c0('0x37')][_0x80c0('0x3b')]));_0xf5812[_0x80c0('0x3a')]=_0xf5812['attributes'][_0x80c0('0x5c')]?_0xf5812['attributes']:_0x46e6c2[_0x80c0('0x34')];if(!_0x5a7467[_0x80c0('0x37')]['hasOwnProperty'](_0x80c0('0x3d'))){_0xf5812[_0x80c0('0x22')]=qs['limit'](_0x5a7467[_0x80c0('0x37')][_0x80c0('0x22')]);_0xf5812[_0x80c0('0x24')]=qs[_0x80c0('0x24')](_0x5a7467[_0x80c0('0x37')][_0x80c0('0x24')]);}_0xf5812[_0x80c0('0x3e')]=qs[_0x80c0('0x3f')](_0x5a7467[_0x80c0('0x37')][_0x80c0('0x3f')]);_0xf5812['where']=qs[_0x80c0('0x38')](_[_0x80c0('0x41')](_0x5a7467[_0x80c0('0x37')],_0x46e6c2[_0x80c0('0x38')]));_0xf5812['where']['MailQueueId']=_0x43c88c['id'];if(_0x5a7467[_0x80c0('0x37')][_0x80c0('0x42')]){_0xf5812['where']=_['merge'](_0xf5812[_0x80c0('0x40')],{'$or':_[_0x80c0('0x35')](_0xf5812[_0x80c0('0x3a')],function(_0x58a76c){var _0x48fadb={};_0x48fadb[_0x58a76c]={'$like':'%'+_0x5a7467[_0x80c0('0x37')]['filter']+'%'};return _0x48fadb;})});}_0xf5812=_[_0x80c0('0x43')]({},_0xf5812,_0x5a7467[_0x80c0('0x45')]);return db[_0x80c0('0x5b')][_0x80c0('0x47')](_0xf5812);}})[_0x80c0('0x28')](function(_0x2658cc){if(_0x2658cc){return db['User'][_0x80c0('0x5d')]({'where':{'id':_[_0x80c0('0x35')](_0x2658cc,_0x80c0('0x5e')),'role':_0x80c0('0x5f')},'attributes':['id',_0x80c0('0x36'),'mailPause',_0x80c0('0x60'),'createdAt']});}})[_0x80c0('0x28')](function(_0x552e4e){if(_0x552e4e){return{'count':_0x552e4e['count'],'rows':_['map'](_0x552e4e[_0x80c0('0x61')],function(_0x1793cb){return{'membername':_0x1793cb[_0x80c0('0x36')],'UserId':_0x1793cb['id'],'queue_name':_0xb2c114[_0x80c0('0x36')],'MailQueueId':_0xb2c114['id'],'interface':util[_0x80c0('0x62')](_0x80c0('0x63'),'SIP',_0x1793cb[_0x80c0('0x36')]),'penalty':0x0,'paused':_0x1793cb[_0x80c0('0x64')],'createdAt':_0x1793cb[_0x80c0('0x65')],'updatedAt':_0x1793cb[_0x80c0('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x80c0('0x28')](respondWithFilteredResult(_0x482ce3,_0xf5812))[_0x80c0('0x48')](handleError(_0x482ce3,null));};exports[_0x80c0('0x66')]=function(_0x5b7d11,_0x5a02c1,_0x538567){var _0x1a8573={};var _0x26189e={};var _0x54ca8c;var _0x5a5744;return db['MailQueue'][_0x80c0('0x5a')]({'where':{'id':_0x5b7d11[_0x80c0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5a02c1,null))['then'](function(_0x12cf4c){if(_0x12cf4c){_0x54ca8c=_0x12cf4c;_0x26189e[_0x80c0('0x34')]=_[_0x80c0('0x4b')](db['Team'][_0x80c0('0x30')]);_0x26189e[_0x80c0('0x37')]=_[_0x80c0('0x4b')](_0x5b7d11[_0x80c0('0x37')]);_0x26189e['filters']=_[_0x80c0('0x39')](_0x26189e[_0x80c0('0x34')],_0x26189e['query']);_0x1a8573[_0x80c0('0x3a')]=_[_0x80c0('0x39')](_0x26189e['model'],qs['fields'](_0x5b7d11[_0x80c0('0x37')][_0x80c0('0x3b')]));_0x1a8573[_0x80c0('0x3a')]=_0x1a8573[_0x80c0('0x3a')][_0x80c0('0x5c')]?_0x1a8573[_0x80c0('0x3a')]:_0x26189e['model'];_0x1a8573['order']=qs['sort'](_0x5b7d11[_0x80c0('0x37')][_0x80c0('0x3f')]);_0x1a8573['where']=qs['filters'](_[_0x80c0('0x41')](_0x5b7d11[_0x80c0('0x37')],_0x26189e[_0x80c0('0x38')]));if(_0x5b7d11[_0x80c0('0x37')][_0x80c0('0x42')]){_0x1a8573[_0x80c0('0x40')]=_[_0x80c0('0x43')](_0x1a8573[_0x80c0('0x40')],{'$or':_['map'](_0x1a8573[_0x80c0('0x3a')],function(_0x119398){var _0x3f1dc8={};_0x3f1dc8[_0x119398]={'$like':'%'+_0x5b7d11[_0x80c0('0x37')][_0x80c0('0x42')]+'%'};return _0x3f1dc8;})});}_0x1a8573=_[_0x80c0('0x43')]({},_0x1a8573,_0x5b7d11[_0x80c0('0x45')]);return _0x54ca8c[_0x80c0('0x66')](_0x1a8573);}})[_0x80c0('0x28')](function(_0x445d0d){if(_0x445d0d){_0x5a5744=_0x445d0d[_0x80c0('0x5c')];if(!_0x5b7d11[_0x80c0('0x37')][_0x80c0('0x3c')](_0x80c0('0x3d'))){_0x1a8573['limit']=qs[_0x80c0('0x22')](_0x5b7d11[_0x80c0('0x37')][_0x80c0('0x22')]);_0x1a8573[_0x80c0('0x24')]=qs['offset'](_0x5b7d11[_0x80c0('0x37')][_0x80c0('0x24')]);}return _0x54ca8c[_0x80c0('0x66')](_0x1a8573);}})[_0x80c0('0x28')](function(_0x1b9d15){if(_0x1b9d15){return _0x1b9d15?{'count':_0x5a5744,'rows':_0x1b9d15}:null;}})['then'](respondWithResult(_0x5a02c1,null))['catch'](handleError(_0x5a02c1,null));};exports[_0x80c0('0x67')]=function(_0x4af49d,_0x203570,_0x533896){var _0x4fcf38=_0x4af49d['body'][_0x80c0('0x68')];return db['Team'][_0x80c0('0x47')]({'where':{'id':_0x4fcf38},'attributes':['id'],'include':[{'model':db[_0x80c0('0x69')],'as':_0x80c0('0x6a'),'attributes':['id',_0x80c0('0x36'),_0x80c0('0x6b'),_0x80c0('0x6c'),_0x80c0('0x6d')],'raw':!![]}]})[_0x80c0('0x28')](function(_0x14b2b0){if(_0x14b2b0){var _0x1fd4ac=_[_0x80c0('0x6e')](_0x14b2b0,function(_0x7b3aa7){var _0x56e14c=_0x7b3aa7[_0x80c0('0x2a')]({'plain':!![]});return _0x56e14c[_0x80c0('0x6a')];});return db[_0x80c0('0x2f')][_0x80c0('0x53')]({'where':{'id':_0x4af49d['params']['id']}})[_0x80c0('0x28')](function(_0x3d42d0){return db['sequelize'][_0x80c0('0x6f')](function(_0x6aea6a){return _0x3d42d0[_0x80c0('0x67')](_0x4fcf38,{'transaction':_0x6aea6a})[_0x80c0('0x28')](function(){return BPromise[_0x80c0('0x70')](_0x1fd4ac,function(_0x3906d6){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x3906d6['id'],'MailQueueId':_0x4af49d['params']['id']},'transaction':_0x6aea6a});});})[_0x80c0('0x28')](function(){_0x1fd4ac['forEach'](function(_0x47946c){socket[_0x80c0('0x71')](_0x80c0('0x72'),{'UserId':_0x47946c['id'],'MailQueueId':_0x3d42d0['id']});});});});});}})[_0x80c0('0x28')](respondWithStatusCode(_0x203570,null))[_0x80c0('0x48')](handleError(_0x203570,null));};exports['removeTeams']=function(_0x4f64be,_0x3444f0,_0x4d9bfb){return db['Team'][_0x80c0('0x47')]({'where':{'id':_0x4f64be[_0x80c0('0x37')][_0x80c0('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x80c0('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x80c0('0x28')](handleEntityNotFound(_0x3444f0,null))[_0x80c0('0x28')](function(_0x5423d8){var _0x9f3bf4=_[_0x80c0('0x35')](_0x5423d8,'id');var _0x135b80=[];var _0x786d70=[];var _0x37f0e5=squel[_0x80c0('0x73')]();_0x37f0e5['field'](_0x80c0('0x74'))[_0x80c0('0x75')](_0x80c0('0x76'),'tq')['join'](_0x80c0('0x77'),'ut',_0x80c0('0x78'))[_0x80c0('0x40')](_0x80c0('0x79'),_0x4f64be[_0x80c0('0x4a')]['id']);for(var _0x255ac1=0x0;_0x255ac1<_0x5423d8['length'];_0x255ac1+=0x1){let _0x3409b6=_0x5423d8[_0x255ac1];for(var _0x273195=0x0;_0x273195<_0x3409b6[_0x80c0('0x6a')]['length'];_0x273195+=0x1){let _0x2dc69d=_0x3409b6['Agents'][_0x273195];var _0x1e8eac=_0x37f0e5['clone']();_0x1e8eac[_0x80c0('0x40')](_0x80c0('0x7a'),_0x2dc69d['id']);_0x786d70[_0x80c0('0x7b')](db[_0x80c0('0x7c')][_0x80c0('0x37')](_0x1e8eac[_0x80c0('0x7d')](),{'type':db['sequelize'][_0x80c0('0x7e')][_0x80c0('0x7f')]})['then'](function(_0x26faf8){if(_0x26faf8[_0x80c0('0x5c')]===0x1){return _0x2dc69d['id'];}else{var _0x1b4515=_[_0x80c0('0x80')](_['map'](_0x26faf8,'TeamId'),function(_0x3cd328){return _[_0x80c0('0x81')](_0x9f3bf4,_0x3cd328);});if(_0x1b4515){return _0x2dc69d['id'];}}}));}}return BPromise['all'](_0x786d70)[_0x80c0('0x28')](function(_0x3089b2){_0x135b80=_(_0x135b80)['union'](_0x3089b2)[_0x80c0('0x82')]()['value']();return db[_0x80c0('0x2f')][_0x80c0('0x53')]({'where':{'id':_0x4f64be[_0x80c0('0x4a')]['id']}})[_0x80c0('0x28')](function(_0x51796b){return db[_0x80c0('0x7c')][_0x80c0('0x6f')](function(_0x330c3a){return _0x51796b[_0x80c0('0x83')](_0x4f64be[_0x80c0('0x37')][_0x80c0('0x68')],{'transaction':_0x330c3a})[_0x80c0('0x28')](function(){if(!_[_0x80c0('0x84')](_0x135b80)){return _0x51796b['removeAgents'](_0x135b80,{'transaction':_0x330c3a});}})['then'](function(){_0x135b80[_0x80c0('0x85')](function(_0x19ded1){socket[_0x80c0('0x71')](_0x80c0('0x86'),{'UserId':_0x19ded1,'MailQueueId':_0x51796b['id']});});});});});});})[_0x80c0('0x28')](respondWithStatusCode(_0x3444f0,null))[_0x80c0('0x48')](handleError(_0x3444f0,null));};exports[_0x80c0('0x87')]=function(_0xa5f631,_0x549ef6,_0x3fabaf){return db['MailQueue']['find']({'where':{'id':_0xa5f631[_0x80c0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x549ef6,null))[_0x80c0('0x28')](function(_0x1d03cc){if(_0x1d03cc){return _0x1d03cc[_0x80c0('0x87')](_0xa5f631[_0x80c0('0x4e')][_0x80c0('0x68')],_[_0x80c0('0x88')](_0xa5f631[_0x80c0('0x4e')],['ids','id'])||{})[_0x80c0('0x89')](function(_0x297bbe){for(var _0x306e7a=0x0;_0x306e7a<_0xa5f631[_0x80c0('0x4e')][_0x80c0('0x68')]['length'];_0x306e7a+=0x1){socket[_0x80c0('0x71')](_0x80c0('0x72'),{'UserId':Number(_0xa5f631[_0x80c0('0x4e')][_0x80c0('0x68')][_0x306e7a]),'MailQueueId':Number(_0xa5f631[_0x80c0('0x4a')]['id'])});}return _0x297bbe;});}})[_0x80c0('0x28')](respondWithResult(_0x549ef6,null))[_0x80c0('0x48')](handleError(_0x549ef6,null));};exports[_0x80c0('0x8a')]=function(_0x237163,_0x21109d,_0x29056a){return db[_0x80c0('0x2f')][_0x80c0('0x53')]({'where':{'id':_0x237163['params']['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0x21109d,null))[_0x80c0('0x28')](function(_0x774ad){if(_0x774ad){return _0x774ad[_0x80c0('0x8a')](_0x237163[_0x80c0('0x37')][_0x80c0('0x68')])['then'](function(){if(_[_0x80c0('0x8b')](_0x237163[_0x80c0('0x37')]['ids'])){for(var _0x1ba344=0x0;_0x1ba344<_0x237163['query'][_0x80c0('0x68')]['length'];_0x1ba344+=0x1){socket['emit'](_0x80c0('0x86'),{'UserId':Number(_0x237163[_0x80c0('0x37')]['ids'][_0x1ba344]),'MailQueueId':Number(_0x237163[_0x80c0('0x4a')]['id'])});}}else{socket[_0x80c0('0x71')]('userMailQueue:remove',{'UserId':Number(_0x237163[_0x80c0('0x37')]['ids']),'MailQueueId':Number(_0x237163['params']['id'])});}});}})['then'](respondWithStatusCode(_0x21109d,null))[_0x80c0('0x48')](handleError(_0x21109d,null));};exports[_0x80c0('0x8c')]=function(_0x47b6fe,_0xb823f3,_0x54c2e1){var _0xc105df={};var _0x59d94f={};var _0x48a1fb;var _0x4f1231;return db['MailQueue'][_0x80c0('0x5a')]({'where':{'id':_0x47b6fe[_0x80c0('0x4a')]['id']}})[_0x80c0('0x28')](handleEntityNotFound(_0xb823f3,null))[_0x80c0('0x28')](function(_0x127dbb){if(_0x127dbb){_0x48a1fb=_0x127dbb;_0x59d94f['model']=_[_0x80c0('0x4b')](db['User']['rawAttributes']);_0x59d94f[_0x80c0('0x37')]=_['keys'](_0x47b6fe['query']);_0x59d94f[_0x80c0('0x38')]=_[_0x80c0('0x39')](_0x59d94f['model'],_0x59d94f[_0x80c0('0x37')]);_0xc105df[_0x80c0('0x3a')]=_['intersection'](_0x59d94f['model'],qs[_0x80c0('0x3b')](_0x47b6fe[_0x80c0('0x37')]['fields']));_0xc105df[_0x80c0('0x3a')]=_0xc105df[_0x80c0('0x3a')][_0x80c0('0x5c')]?_0xc105df['attributes']:_0x59d94f[_0x80c0('0x34')];_0xc105df[_0x80c0('0x3e')]=qs['sort'](_0x47b6fe['query'][_0x80c0('0x3f')]);_0xc105df[_0x80c0('0x40')]=qs[_0x80c0('0x38')](_['pick'](_0x47b6fe['query'],_0x59d94f[_0x80c0('0x38')]));if(_0x47b6fe[_0x80c0('0x37')][_0x80c0('0x42')]){_0xc105df[_0x80c0('0x40')]=_[_0x80c0('0x43')](_0xc105df[_0x80c0('0x40')],{'$or':_['map'](_0xc105df[_0x80c0('0x3a')],function(_0x3afec9){var _0xd5c549={};_0xd5c549[_0x3afec9]={'$like':'%'+_0x47b6fe['query'][_0x80c0('0x42')]+'%'};return _0xd5c549;})});}_0xc105df=_[_0x80c0('0x43')]({},_0xc105df,_0x47b6fe[_0x80c0('0x45')]);return _0x48a1fb[_0x80c0('0x8c')](_0xc105df);}})[_0x80c0('0x28')](function(_0xe78d34){if(_0xe78d34){_0x4f1231=_0xe78d34['length'];if(!_0x47b6fe['query'][_0x80c0('0x3c')](_0x80c0('0x3d'))){_0xc105df[_0x80c0('0x22')]=qs[_0x80c0('0x22')](_0x47b6fe[_0x80c0('0x37')][_0x80c0('0x22')]);_0xc105df[_0x80c0('0x24')]=qs[_0x80c0('0x24')](_0x47b6fe[_0x80c0('0x37')][_0x80c0('0x24')]);}return _0x48a1fb[_0x80c0('0x8c')](_0xc105df);}})['then'](function(_0xb15c93){if(_0xb15c93){return _0xb15c93?{'count':_0x4f1231,'rows':_0xb15c93}:null;}})[_0x80c0('0x28')](respondWithResult(_0xb823f3,null))[_0x80c0('0x48')](handleError(_0xb823f3,null));}; \ No newline at end of file +var _0x1109=['../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','get','UserMailQueue','UserId','agent','updatedAt','createdAt','%s/%s','SIP','mailPause','getTeams','findOne','Team','pick','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','all','union','value','transaction','removeAgents','userMailQueue:remove','addAgents','spread','emit','isArray','getAgents','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2e0405,_0x515e07){var _0x1cded0=function(_0x49c6c6){while(--_0x49c6c6){_0x2e0405['push'](_0x2e0405['shift']());}};_0x1cded0(++_0x515e07);}(_0x1109,0x17d));var _0x9110=function(_0x4b935a,_0x327ee3){_0x4b935a=_0x4b935a-0x0;var _0xa298f0=_0x1109[_0x4b935a];return _0xa298f0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9110('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9110('0x1'));var moment=require('moment');var BPromise=require(_0x9110('0x2'));var Mustache=require(_0x9110('0x3'));var util=require(_0x9110('0x4'));var path=require(_0x9110('0x5'));var sox=require(_0x9110('0x6'));var csv=require(_0x9110('0x7'));var ejs=require(_0x9110('0x8'));var fs=require('fs');var fs_extra=require(_0x9110('0x9'));var _=require(_0x9110('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9110('0xb'));var toCsv=require(_0x9110('0x7'));var querystring=require(_0x9110('0xc'));var Papa=require('papaparse');var Redis=require(_0x9110('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9110('0xe'));var hardwareService=require(_0x9110('0xf'));var logger=require(_0x9110('0x10'))(_0x9110('0x11'));var utils=require(_0x9110('0x12'));var config=require(_0x9110('0x13'));var licenseUtil=require(_0x9110('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9110('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9110('0x16'))(new Redis(config[_0x9110('0x17')]));require('./mailQueue.socket')[_0x9110('0x18')](socket);function respondWithStatusCode(_0x4948a7,_0x3b6aa4){_0x3b6aa4=_0x3b6aa4||0xcc;return function(_0x935939){if(_0x935939){return _0x4948a7[_0x9110('0x19')](_0x3b6aa4);}return _0x4948a7[_0x9110('0x1a')](_0x3b6aa4)[_0x9110('0x1b')]();};}function respondWithResult(_0x1234be,_0x58ebd6){_0x58ebd6=_0x58ebd6||0xc8;return function(_0x56d0af){if(_0x56d0af){return _0x1234be[_0x9110('0x1a')](_0x58ebd6)[_0x9110('0x1c')](_0x56d0af);}};}function respondWithFilteredResult(_0x55f739,_0x460f98){return function(_0x11dec4){if(_0x11dec4){var _0x1bcaf2=typeof _0x460f98[_0x9110('0x1d')]===_0x9110('0x1e')&&typeof _0x460f98[_0x9110('0x1f')]===_0x9110('0x1e');var _0x32b89a=_0x11dec4[_0x9110('0x20')];var _0x256c27=_0x1bcaf2?0x0:_0x460f98[_0x9110('0x1d')];var _0x4a8dcc=_0x1bcaf2?_0x11dec4[_0x9110('0x20')]:_0x460f98[_0x9110('0x1d')]+_0x460f98[_0x9110('0x1f')];var _0x1f3ebf;if(_0x4a8dcc>=_0x32b89a){_0x4a8dcc=_0x32b89a;_0x1f3ebf=0xc8;}else{_0x1f3ebf=0xce;}_0x55f739['status'](_0x1f3ebf);return _0x55f739[_0x9110('0x21')]('Content-Range',_0x256c27+'-'+_0x4a8dcc+'/'+_0x32b89a)['json'](_0x11dec4);}return null;};}function patchUpdates(_0x38ea6e){return function(_0x2c98be){try{jsonpatch[_0x9110('0x22')](_0x2c98be,_0x38ea6e,!![]);}catch(_0x296ad0){return BPromise[_0x9110('0x23')](_0x296ad0);}return _0x2c98be[_0x9110('0x24')]();};}function saveUpdates(_0x34903c,_0x2a6f17){return function(_0x10759b){if(_0x10759b){return _0x10759b['update'](_0x34903c)[_0x9110('0x25')](function(_0x472c10){return _0x472c10;});}return null;};}function removeEntity(_0x505daf,_0x410a01){return function(_0x495825){if(_0x495825){return _0x495825[_0x9110('0x26')]()[_0x9110('0x25')](function(){var _0x5ad783=_0x495825['get']({'plain':!![]});var _0x3b0dce='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x3b0dce,'resourceId':_0x5ad783['id']}})[_0x9110('0x25')](function(){return _0x495825;});})[_0x9110('0x25')](function(){_0x505daf[_0x9110('0x1a')](0xcc)[_0x9110('0x1b')]();});}};}function handleEntityNotFound(_0x207255,_0x5803fc){return function(_0xf0e7fe){if(!_0xf0e7fe){_0x207255[_0x9110('0x19')](0x194);}return _0xf0e7fe;};}function handleError(_0x2be2d4,_0x4da7bc){_0x4da7bc=_0x4da7bc||0x1f4;return function(_0xa51863){logger[_0x9110('0x27')](_0xa51863[_0x9110('0x28')]);if(_0xa51863[_0x9110('0x29')]){delete _0xa51863[_0x9110('0x29')];}_0x2be2d4[_0x9110('0x1a')](_0x4da7bc)[_0x9110('0x2a')](_0xa51863);};}exports[_0x9110('0x2b')]=function(_0x259cfb,_0x3be9f2){var _0x37d90f={},_0x82732c={},_0x3a7f5f={'count':0x0,'rows':[]};var _0x3264ac=_[_0x9110('0x2c')](db[_0x9110('0x2d')][_0x9110('0x2e')],function(_0x320447){return{'name':_0x320447[_0x9110('0x2f')],'type':_0x320447['type']['key']};});_0x82732c[_0x9110('0x30')]=_['map'](_0x3264ac,_0x9110('0x29'));_0x82732c[_0x9110('0x31')]=_[_0x9110('0x32')](_0x259cfb[_0x9110('0x31')]);_0x82732c[_0x9110('0x33')]=_[_0x9110('0x34')](_0x82732c[_0x9110('0x30')],_0x82732c[_0x9110('0x31')]);_0x37d90f[_0x9110('0x35')]=_[_0x9110('0x34')](_0x82732c[_0x9110('0x30')],qs['fields'](_0x259cfb[_0x9110('0x31')]['fields']));_0x37d90f[_0x9110('0x35')]=_0x37d90f[_0x9110('0x35')][_0x9110('0x36')]?_0x37d90f[_0x9110('0x35')]:_0x82732c[_0x9110('0x30')];if(!_0x259cfb[_0x9110('0x31')][_0x9110('0x37')](_0x9110('0x38'))){_0x37d90f[_0x9110('0x1f')]=qs[_0x9110('0x1f')](_0x259cfb[_0x9110('0x31')][_0x9110('0x1f')]);_0x37d90f[_0x9110('0x1d')]=qs['offset'](_0x259cfb['query']['offset']);}_0x37d90f[_0x9110('0x39')]=qs[_0x9110('0x3a')](_0x259cfb[_0x9110('0x31')][_0x9110('0x3a')]);_0x37d90f['where']=qs['filters'](_['pick'](_0x259cfb['query'],_0x82732c['filters']),_0x3264ac);if(_0x259cfb['query'][_0x9110('0x3b')]){_0x37d90f['where']=_[_0x9110('0x3c')](_0x37d90f[_0x9110('0x3d')],{'$or':_['map'](_0x3264ac,function(_0x4e8286){if(_0x4e8286['type']!==_0x9110('0x3e')){var _0x5e643f={};_0x5e643f[_0x4e8286[_0x9110('0x29')]]={'$like':'%'+_0x259cfb[_0x9110('0x31')][_0x9110('0x3b')]+'%'};return _0x5e643f;}})});}_0x37d90f=_[_0x9110('0x3c')]({},_0x37d90f,_0x259cfb[_0x9110('0x3f')]);var _0xe5f7dc={'where':_0x37d90f[_0x9110('0x3d')]};return db[_0x9110('0x2d')][_0x9110('0x20')](_0xe5f7dc)[_0x9110('0x25')](function(_0x42316a){_0x3a7f5f[_0x9110('0x20')]=_0x42316a;if(_0x259cfb[_0x9110('0x31')][_0x9110('0x40')]){_0x37d90f[_0x9110('0x41')]=[{'all':!![]}];}return db[_0x9110('0x2d')][_0x9110('0x42')](_0x37d90f);})['then'](function(_0x55d25f){_0x3a7f5f[_0x9110('0x43')]=_0x55d25f;return _0x3a7f5f;})[_0x9110('0x25')](respondWithFilteredResult(_0x3be9f2,_0x37d90f))[_0x9110('0x44')](handleError(_0x3be9f2,null));};exports[_0x9110('0x45')]=function(_0x584804,_0x164618){var _0x447415={'raw':!![],'where':{'id':_0x584804[_0x9110('0x46')]['id']}},_0x4102f7={};_0x4102f7[_0x9110('0x30')]=_['keys'](db[_0x9110('0x2d')][_0x9110('0x2e')]);_0x4102f7[_0x9110('0x31')]=_['keys'](_0x584804[_0x9110('0x31')]);_0x4102f7[_0x9110('0x33')]=_['intersection'](_0x4102f7[_0x9110('0x30')],_0x4102f7[_0x9110('0x31')]);_0x447415[_0x9110('0x35')]=_[_0x9110('0x34')](_0x4102f7[_0x9110('0x30')],qs[_0x9110('0x47')](_0x584804[_0x9110('0x31')][_0x9110('0x47')]));_0x447415[_0x9110('0x35')]=_0x447415[_0x9110('0x35')][_0x9110('0x36')]?_0x447415[_0x9110('0x35')]:_0x4102f7['model'];if(_0x584804[_0x9110('0x31')][_0x9110('0x40')]){_0x447415[_0x9110('0x41')]=[{'all':!![]}];}_0x447415=_[_0x9110('0x3c')]({},_0x447415,_0x584804[_0x9110('0x3f')]);return db[_0x9110('0x2d')][_0x9110('0x48')](_0x447415)['then'](handleEntityNotFound(_0x164618,null))['then'](respondWithResult(_0x164618,null))[_0x9110('0x44')](handleError(_0x164618,null));};exports['create']=function(_0x353df4,_0x598344){return db[_0x9110('0x2d')][_0x9110('0x49')](_0x353df4['body'],{})[_0x9110('0x25')](function(_0x8c8aa7){var _0x1b4f3c=_0x353df4[_0x9110('0x4a')]['get']({'plain':!![]});if(!_0x1b4f3c)throw new Error(_0x9110('0x4b'));if(_0x1b4f3c[_0x9110('0x4c')]==='user'){var _0x287860=_0x8c8aa7['get']({'plain':!![]});var _0x466899=_0x9110('0x4d');return db[_0x9110('0x4e')][_0x9110('0x48')]({'where':{'name':_0x466899,'userProfileId':_0x1b4f3c[_0x9110('0x4f')]},'raw':!![]})[_0x9110('0x25')](function(_0x48d4df){if(_0x48d4df&&_0x48d4df['autoAssociation']===0x0){return db[_0x9110('0x50')]['create']({'name':_0x287860[_0x9110('0x29')],'resourceId':_0x287860['id'],'type':_0x48d4df['name'],'sectionId':_0x48d4df['id']},{})['then'](function(){return _0x8c8aa7;});}else{return _0x8c8aa7;}})[_0x9110('0x44')](function(_0xb1ebf3){logger['error'](_0x9110('0x51'),_0xb1ebf3);throw _0xb1ebf3;});}return _0x8c8aa7;})[_0x9110('0x25')](respondWithResult(_0x598344,0xc9))[_0x9110('0x44')](handleError(_0x598344,null));};exports[_0x9110('0x52')]=function(_0x214b83,_0x107130){if(_0x214b83['body']['id']){delete _0x214b83[_0x9110('0x53')]['id'];}return db['MailQueue'][_0x9110('0x48')]({'where':{'id':_0x214b83['params']['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x107130,null))['then'](saveUpdates(_0x214b83['body'],null))[_0x9110('0x25')](respondWithResult(_0x107130,null))[_0x9110('0x44')](handleError(_0x107130,null));};exports[_0x9110('0x26')]=function(_0x13b278,_0x53bd45){return db['MailQueue'][_0x9110('0x48')]({'where':{'id':_0x13b278[_0x9110('0x46')]['id']}})['then'](handleEntityNotFound(_0x53bd45,null))['then'](removeEntity(_0x53bd45,null))[_0x9110('0x44')](handleError(_0x53bd45,null));};exports[_0x9110('0x54')]=function(_0x51a4ce,_0x21853e){return db[_0x9110('0x2d')][_0x9110('0x54')]()['then'](respondWithResult(_0x21853e,null))[_0x9110('0x44')](handleError(_0x21853e,null));};exports['getMembers']=function(_0x20d612,_0x138043,_0x1aa967){var _0x2ccdde={'raw':!![],'where':{}},_0x15f29e={},_0x5e3213;return db[_0x9110('0x2d')]['findOne']({'where':{'id':_0x20d612['params']['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x138043,null))[_0x9110('0x25')](function(_0x55fb48){if(_0x55fb48){_0x5e3213=_0x55fb48[_0x9110('0x55')]({'plain':!![]});_0x15f29e[_0x9110('0x30')]=_['keys'](db[_0x9110('0x56')][_0x9110('0x2e')]);_0x15f29e[_0x9110('0x31')]=_[_0x9110('0x32')](_0x20d612[_0x9110('0x31')]);_0x15f29e[_0x9110('0x33')]=_[_0x9110('0x34')](_0x15f29e[_0x9110('0x30')],_0x15f29e['query']);_0x2ccdde['attributes']=_[_0x9110('0x34')](_0x15f29e['model'],qs['fields'](_0x20d612[_0x9110('0x31')][_0x9110('0x47')]));_0x2ccdde[_0x9110('0x35')]=_0x2ccdde[_0x9110('0x35')]['length']?_0x2ccdde[_0x9110('0x35')]:_0x15f29e[_0x9110('0x30')];if(!_0x20d612[_0x9110('0x31')][_0x9110('0x37')](_0x9110('0x38'))){_0x2ccdde[_0x9110('0x1f')]=qs[_0x9110('0x1f')](_0x20d612[_0x9110('0x31')]['limit']);_0x2ccdde['offset']=qs[_0x9110('0x1d')](_0x20d612[_0x9110('0x31')][_0x9110('0x1d')]);}_0x2ccdde['order']=qs[_0x9110('0x3a')](_0x20d612[_0x9110('0x31')][_0x9110('0x3a')]);_0x2ccdde['where']=qs[_0x9110('0x33')](_['pick'](_0x20d612[_0x9110('0x31')],_0x15f29e[_0x9110('0x33')]));_0x2ccdde[_0x9110('0x3d')]['MailQueueId']=_0x55fb48['id'];if(_0x20d612['query'][_0x9110('0x3b')]){_0x2ccdde['where']=_['merge'](_0x2ccdde['where'],{'$or':_[_0x9110('0x2c')](_0x2ccdde['attributes'],function(_0x19aca1){var _0x4443db={};_0x4443db[_0x19aca1]={'$like':'%'+_0x20d612[_0x9110('0x31')][_0x9110('0x3b')]+'%'};return _0x4443db;})});}_0x2ccdde=_[_0x9110('0x3c')]({},_0x2ccdde,_0x20d612[_0x9110('0x3f')]);return db[_0x9110('0x56')][_0x9110('0x42')](_0x2ccdde);}})[_0x9110('0x25')](function(_0x541a6e){if(_0x541a6e){return db['User']['findAndCountAll']({'where':{'id':_[_0x9110('0x2c')](_0x541a6e,_0x9110('0x57')),'role':_0x9110('0x58')},'attributes':['id',_0x9110('0x29'),'mailPause',_0x9110('0x59'),_0x9110('0x5a')]});}})['then'](function(_0x9aba81){if(_0x9aba81){return{'count':_0x9aba81[_0x9110('0x20')],'rows':_[_0x9110('0x2c')](_0x9aba81[_0x9110('0x43')],function(_0x31db6a){return{'membername':_0x31db6a['name'],'UserId':_0x31db6a['id'],'queue_name':_0x5e3213[_0x9110('0x29')],'MailQueueId':_0x5e3213['id'],'interface':util['format'](_0x9110('0x5b'),_0x9110('0x5c'),_0x31db6a[_0x9110('0x29')]),'penalty':0x0,'paused':_0x31db6a[_0x9110('0x5d')],'createdAt':_0x31db6a['createdAt'],'updatedAt':_0x31db6a[_0x9110('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9110('0x25')](respondWithFilteredResult(_0x138043,_0x2ccdde))[_0x9110('0x44')](handleError(_0x138043,null));};exports[_0x9110('0x5e')]=function(_0x5bcac5,_0x213831,_0x501b1e){var _0x29b263={};var _0x5b9733={};var _0x141628;var _0x1a1968;return db[_0x9110('0x2d')][_0x9110('0x5f')]({'where':{'id':_0x5bcac5[_0x9110('0x46')]['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x213831,null))[_0x9110('0x25')](function(_0x5edf85){if(_0x5edf85){_0x141628=_0x5edf85;_0x5b9733[_0x9110('0x30')]=_[_0x9110('0x32')](db[_0x9110('0x60')]['rawAttributes']);_0x5b9733[_0x9110('0x31')]=_[_0x9110('0x32')](_0x5bcac5[_0x9110('0x31')]);_0x5b9733[_0x9110('0x33')]=_[_0x9110('0x34')](_0x5b9733[_0x9110('0x30')],_0x5b9733[_0x9110('0x31')]);_0x29b263[_0x9110('0x35')]=_[_0x9110('0x34')](_0x5b9733[_0x9110('0x30')],qs[_0x9110('0x47')](_0x5bcac5[_0x9110('0x31')][_0x9110('0x47')]));_0x29b263[_0x9110('0x35')]=_0x29b263[_0x9110('0x35')][_0x9110('0x36')]?_0x29b263[_0x9110('0x35')]:_0x5b9733[_0x9110('0x30')];_0x29b263['order']=qs[_0x9110('0x3a')](_0x5bcac5[_0x9110('0x31')]['sort']);_0x29b263['where']=qs[_0x9110('0x33')](_[_0x9110('0x61')](_0x5bcac5[_0x9110('0x31')],_0x5b9733[_0x9110('0x33')]));if(_0x5bcac5['query']['filter']){_0x29b263[_0x9110('0x3d')]=_['merge'](_0x29b263[_0x9110('0x3d')],{'$or':_[_0x9110('0x2c')](_0x29b263[_0x9110('0x35')],function(_0xf63202){var _0x1670b0={};_0x1670b0[_0xf63202]={'$like':'%'+_0x5bcac5[_0x9110('0x31')][_0x9110('0x3b')]+'%'};return _0x1670b0;})});}_0x29b263=_[_0x9110('0x3c')]({},_0x29b263,_0x5bcac5[_0x9110('0x3f')]);return _0x141628['getTeams'](_0x29b263);}})['then'](function(_0x11181d){if(_0x11181d){_0x1a1968=_0x11181d[_0x9110('0x36')];if(!_0x5bcac5[_0x9110('0x31')]['hasOwnProperty']('nolimit')){_0x29b263[_0x9110('0x1f')]=qs[_0x9110('0x1f')](_0x5bcac5[_0x9110('0x31')][_0x9110('0x1f')]);_0x29b263['offset']=qs[_0x9110('0x1d')](_0x5bcac5[_0x9110('0x31')]['offset']);}return _0x141628[_0x9110('0x5e')](_0x29b263);}})['then'](function(_0x170ed4){if(_0x170ed4){return _0x170ed4?{'count':_0x1a1968,'rows':_0x170ed4}:null;}})[_0x9110('0x25')](respondWithResult(_0x213831,null))[_0x9110('0x44')](handleError(_0x213831,null));};exports[_0x9110('0x62')]=function(_0x31277c,_0x3dbe1,_0x10c41e){var _0x293713=_0x31277c[_0x9110('0x53')][_0x9110('0x63')];return db[_0x9110('0x60')][_0x9110('0x42')]({'where':{'id':_0x293713},'attributes':['id'],'include':[{'model':db[_0x9110('0x64')],'as':_0x9110('0x65'),'attributes':['id','name',_0x9110('0x66'),'voicePause',_0x9110('0x67')],'raw':!![]}]})[_0x9110('0x25')](function(_0x2f2b40){if(_0x2f2b40){var _0x25a7fb=_[_0x9110('0x68')](_0x2f2b40,function(_0x3b7db5){var _0x537480=_0x3b7db5[_0x9110('0x55')]({'plain':!![]});return _0x537480[_0x9110('0x65')];});return db[_0x9110('0x2d')][_0x9110('0x48')]({'where':{'id':_0x31277c[_0x9110('0x46')]['id']}})['then'](function(_0x2452e7){return db[_0x9110('0x69')]['transaction'](function(_0x3a9ce4){return _0x2452e7['addTeams'](_0x293713,{'transaction':_0x3a9ce4})[_0x9110('0x25')](function(){return BPromise['each'](_0x25a7fb,function(_0x2e1cd4){return db[_0x9110('0x56')][_0x9110('0x6a')]({'where':{'UserId':_0x2e1cd4['id'],'MailQueueId':_0x31277c['params']['id']},'transaction':_0x3a9ce4});});})[_0x9110('0x25')](function(){_0x25a7fb[_0x9110('0x6b')](function(_0x1a36ad){socket['emit'](_0x9110('0x6c'),{'UserId':_0x1a36ad['id'],'MailQueueId':_0x2452e7['id']});});});});});}})[_0x9110('0x25')](respondWithStatusCode(_0x3dbe1,null))[_0x9110('0x44')](handleError(_0x3dbe1,null));};exports[_0x9110('0x6d')]=function(_0x1657ab,_0x5edc51,_0x46c623){return db[_0x9110('0x60')][_0x9110('0x42')]({'where':{'id':_0x1657ab[_0x9110('0x31')][_0x9110('0x63')]},'attributes':['id'],'include':[{'model':db[_0x9110('0x64')],'as':_0x9110('0x65'),'attributes':['id'],'raw':!![]}]})[_0x9110('0x25')](handleEntityNotFound(_0x5edc51,null))['then'](function(_0x5d9f61){var _0x17ef60=_['map'](_0x5d9f61,'id');var _0x44e3f2=[];var _0x338ad2=[];var _0x4f7cdd=squel[_0x9110('0x6e')]();_0x4f7cdd[_0x9110('0x6f')](_0x9110('0x70'))[_0x9110('0x71')](_0x9110('0x72'),'tq')['join'](_0x9110('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9110('0x3d')]('MailQueueId\x20=\x20?',_0x1657ab['params']['id']);for(var _0x3f4bff=0x0;_0x3f4bff<_0x5d9f61[_0x9110('0x36')];_0x3f4bff+=0x1){let _0x14e2ce=_0x5d9f61[_0x3f4bff];for(var _0x38ac56=0x0;_0x38ac56<_0x14e2ce[_0x9110('0x65')][_0x9110('0x36')];_0x38ac56+=0x1){let _0x19115b=_0x14e2ce[_0x9110('0x65')][_0x38ac56];var _0x461f37=_0x4f7cdd[_0x9110('0x74')]();_0x461f37[_0x9110('0x3d')](_0x9110('0x75'),_0x19115b['id']);_0x338ad2[_0x9110('0x76')](db['sequelize'][_0x9110('0x31')](_0x461f37[_0x9110('0x77')](),{'type':db[_0x9110('0x69')][_0x9110('0x78')]['SELECT']})[_0x9110('0x25')](function(_0xde12e0){if(_0xde12e0[_0x9110('0x36')]===0x1){return _0x19115b['id'];}else{var _0x5970ba=_['every'](_['map'](_0xde12e0,'TeamId'),function(_0x25b0b8){return _[_0x9110('0x79')](_0x17ef60,_0x25b0b8);});if(_0x5970ba){return _0x19115b['id'];}}}));}}return BPromise[_0x9110('0x7a')](_0x338ad2)[_0x9110('0x25')](function(_0x410644){_0x44e3f2=_(_0x44e3f2)[_0x9110('0x7b')](_0x410644)['compact']()[_0x9110('0x7c')]();return db[_0x9110('0x2d')][_0x9110('0x48')]({'where':{'id':_0x1657ab[_0x9110('0x46')]['id']}})[_0x9110('0x25')](function(_0x5ef7bc){return db[_0x9110('0x69')][_0x9110('0x7d')](function(_0x9b3173){return _0x5ef7bc[_0x9110('0x6d')](_0x1657ab['query'][_0x9110('0x63')],{'transaction':_0x9b3173})[_0x9110('0x25')](function(){if(!_['isEmpty'](_0x44e3f2)){return _0x5ef7bc[_0x9110('0x7e')](_0x44e3f2,{'transaction':_0x9b3173});}})[_0x9110('0x25')](function(){_0x44e3f2[_0x9110('0x6b')](function(_0x197d12){socket['emit'](_0x9110('0x7f'),{'UserId':_0x197d12,'MailQueueId':_0x5ef7bc['id']});});});});});});})[_0x9110('0x25')](respondWithStatusCode(_0x5edc51,null))[_0x9110('0x44')](handleError(_0x5edc51,null));};exports[_0x9110('0x80')]=function(_0x43fdcb,_0x599c6f,_0x52aaec){return db[_0x9110('0x2d')][_0x9110('0x48')]({'where':{'id':_0x43fdcb[_0x9110('0x46')]['id']}})['then'](handleEntityNotFound(_0x599c6f,null))[_0x9110('0x25')](function(_0x5a1e12){if(_0x5a1e12){return _0x5a1e12[_0x9110('0x80')](_0x43fdcb[_0x9110('0x53')]['ids'],_['omit'](_0x43fdcb[_0x9110('0x53')],[_0x9110('0x63'),'id'])||{})[_0x9110('0x81')](function(_0x277feb){for(var _0x2c52b9=0x0;_0x2c52b9<_0x43fdcb[_0x9110('0x53')][_0x9110('0x63')][_0x9110('0x36')];_0x2c52b9+=0x1){socket[_0x9110('0x82')](_0x9110('0x6c'),{'UserId':Number(_0x43fdcb[_0x9110('0x53')][_0x9110('0x63')][_0x2c52b9]),'MailQueueId':Number(_0x43fdcb[_0x9110('0x46')]['id'])});}return _0x277feb;});}})['then'](respondWithResult(_0x599c6f,null))[_0x9110('0x44')](handleError(_0x599c6f,null));};exports[_0x9110('0x7e')]=function(_0x55dcc9,_0x11935c,_0x2bc411){return db['MailQueue']['find']({'where':{'id':_0x55dcc9[_0x9110('0x46')]['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x11935c,null))[_0x9110('0x25')](function(_0x145b25){if(_0x145b25){return _0x145b25[_0x9110('0x7e')](_0x55dcc9[_0x9110('0x31')][_0x9110('0x63')])[_0x9110('0x25')](function(){if(_[_0x9110('0x83')](_0x55dcc9[_0x9110('0x31')]['ids'])){for(var _0x2bd192=0x0;_0x2bd192<_0x55dcc9['query'][_0x9110('0x63')][_0x9110('0x36')];_0x2bd192+=0x1){socket[_0x9110('0x82')]('userMailQueue:remove',{'UserId':Number(_0x55dcc9['query']['ids'][_0x2bd192]),'MailQueueId':Number(_0x55dcc9[_0x9110('0x46')]['id'])});}}else{socket[_0x9110('0x82')](_0x9110('0x7f'),{'UserId':Number(_0x55dcc9[_0x9110('0x31')][_0x9110('0x63')]),'MailQueueId':Number(_0x55dcc9[_0x9110('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x11935c,null))['catch'](handleError(_0x11935c,null));};exports[_0x9110('0x84')]=function(_0x3417eb,_0x4c580c,_0xf335a0){var _0x58abb1={};var _0xd82c4b={};var _0x4c8232;var _0xa4e179;return db[_0x9110('0x2d')]['findOne']({'where':{'id':_0x3417eb[_0x9110('0x46')]['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x4c580c,null))[_0x9110('0x25')](function(_0x439a90){if(_0x439a90){_0x4c8232=_0x439a90;_0xd82c4b[_0x9110('0x30')]=_[_0x9110('0x32')](db['User'][_0x9110('0x2e')]);_0xd82c4b[_0x9110('0x31')]=_[_0x9110('0x32')](_0x3417eb[_0x9110('0x31')]);_0xd82c4b[_0x9110('0x33')]=_[_0x9110('0x34')](_0xd82c4b['model'],_0xd82c4b[_0x9110('0x31')]);_0x58abb1['attributes']=_[_0x9110('0x34')](_0xd82c4b[_0x9110('0x30')],qs['fields'](_0x3417eb['query'][_0x9110('0x47')]));_0x58abb1[_0x9110('0x35')]=_0x58abb1[_0x9110('0x35')]['length']?_0x58abb1[_0x9110('0x35')]:_0xd82c4b[_0x9110('0x30')];_0x58abb1[_0x9110('0x39')]=qs[_0x9110('0x3a')](_0x3417eb[_0x9110('0x31')][_0x9110('0x3a')]);_0x58abb1[_0x9110('0x3d')]=qs[_0x9110('0x33')](_[_0x9110('0x61')](_0x3417eb[_0x9110('0x31')],_0xd82c4b[_0x9110('0x33')]));if(_0x3417eb[_0x9110('0x31')][_0x9110('0x3b')]){_0x58abb1[_0x9110('0x3d')]=_['merge'](_0x58abb1[_0x9110('0x3d')],{'$or':_[_0x9110('0x2c')](_0x58abb1[_0x9110('0x35')],function(_0x31d59f){var _0x56ede3={};_0x56ede3[_0x31d59f]={'$like':'%'+_0x3417eb[_0x9110('0x31')][_0x9110('0x3b')]+'%'};return _0x56ede3;})});}_0x58abb1=_[_0x9110('0x3c')]({},_0x58abb1,_0x3417eb[_0x9110('0x3f')]);return _0x4c8232[_0x9110('0x84')](_0x58abb1);}})['then'](function(_0x525397){if(_0x525397){_0xa4e179=_0x525397['length'];if(!_0x3417eb[_0x9110('0x31')][_0x9110('0x37')](_0x9110('0x38'))){_0x58abb1[_0x9110('0x1f')]=qs['limit'](_0x3417eb['query'][_0x9110('0x1f')]);_0x58abb1[_0x9110('0x1d')]=qs[_0x9110('0x1d')](_0x3417eb['query'][_0x9110('0x1d')]);}return _0x4c8232[_0x9110('0x84')](_0x58abb1);}})[_0x9110('0x25')](function(_0x866936){if(_0x866936){return _0x866936?{'count':_0xa4e179,'rows':_0x866936}:null;}})[_0x9110('0x25')](respondWithResult(_0x4c580c,null))[_0x9110('0x44')](handleError(_0x4c580c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ba637b5..d180fa3 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 _0x622d=['MailQueue','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x622d,0x7f));var _0xd622=function(_0x2c60a8,_0x242506){_0x2c60a8=_0x2c60a8-0x0;var _0x54fc19=_0x622d[_0x2c60a8];return _0x54fc19;};'use strict';var EventEmitter=require(_0xd622('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xd622('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd622('0x2'),'afterUpdate':_0xd622('0x3'),'afterDestroy':_0xd622('0x4')};function emitEvent(_0x1bf882){return function(_0x120c61,_0x131205,_0x3ea284){MailQueueEvents['emit'](_0x1bf882+':'+_0x120c61['id'],_0x120c61);MailQueueEvents[_0xd622('0x5')](_0x1bf882,_0x120c61);_0x3ea284(null);};}for(var e in events){if(events[_0xd622('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xd622('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x1d59=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x12faa7,_0x4e82bb){var _0x9f4b7f=function(_0x4b2e35){while(--_0x4b2e35){_0x12faa7['push'](_0x12faa7['shift']());}};_0x9f4b7f(++_0x4e82bb);}(_0x1d59,0x1be));var _0x91d5=function(_0x14a5f0,_0x41aa87){_0x14a5f0=_0x14a5f0-0x0;var _0x1c71bd=_0x1d59[_0x14a5f0];return _0x1c71bd;};'use strict';var EventEmitter=require(_0x91d5('0x0'));var MailQueue=require(_0x91d5('0x1'))['db'][_0x91d5('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x91d5('0x3')](0x0);var events={'afterCreate':_0x91d5('0x4'),'afterUpdate':_0x91d5('0x5'),'afterDestroy':_0x91d5('0x6')};function emitEvent(_0xf254d8){return function(_0x53c782,_0x403a83,_0x2c3be9){MailQueueEvents[_0x91d5('0x7')](_0xf254d8+':'+_0x53c782['id'],_0x53c782);MailQueueEvents[_0x91d5('0x7')](_0xf254d8,_0x53c782);_0x2c3be9(null);};}for(var e in events){if(events[_0x91d5('0x8')](e)){var event=events[e];MailQueue[_0x91d5('0x9')](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 7932b8f..47426a9 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 _0x5834=['define','MailQueue','mail_queues','util','../../config/logger','moment','path','rimraf','exports'];(function(_0x3bb7e1,_0x1cf4c8){var _0x3f4ea7=function(_0x3ff367){while(--_0x3ff367){_0x3bb7e1['push'](_0x3bb7e1['shift']());}};_0x3f4ea7(++_0x1cf4c8);}(_0x5834,0x123));var _0x4583=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x5834[_0x2cde0a];return _0x260610;};'use strict';var _=require('lodash');var util=require(_0x4583('0x0'));var logger=require(_0x4583('0x1'))('api');var moment=require(_0x4583('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4583('0x3'));var rimraf=require(_0x4583('0x4'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x4583('0x5')]=function(_0x218c2c,_0x3472d4){return _0x218c2c[_0x4583('0x6')](_0x4583('0x7'),attributes,{'tableName':_0x4583('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x461f=['path','rimraf','../../config/environment','exports','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15813e,_0x135677){var _0x2b1022=function(_0x37113f){while(--_0x37113f){_0x15813e['push'](_0x15813e['shift']());}};_0x2b1022(++_0x135677);}(_0x461f,0x1a9));var _0xf461=function(_0x561197,_0x2d7d64){_0x561197=_0x561197-0x0;var _0x191270=_0x461f[_0x561197];return _0x191270;};'use strict';var _=require(_0xf461('0x0'));var util=require(_0xf461('0x1'));var logger=require(_0xf461('0x2'))(_0xf461('0x3'));var moment=require(_0xf461('0x4'));var BPromise=require(_0xf461('0x5'));var rp=require(_0xf461('0x6'));var fs=require('fs');var path=require(_0xf461('0x7'));var rimraf=require(_0xf461('0x8'));var config=require(_0xf461('0x9'));var attributes=require('./mailQueue.attributes');module[_0xf461('0xa')]=function(_0x17c28a,_0x575813){return _0x17c28a['define'](_0xf461('0xb'),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 ac18d6f..d33fc82 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 _0x14c3=['info','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailQueue','find','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','MailQueue,\x20%s,\x20%s','message'];(function(_0x6b82cd,_0x1fec2b){var _0x32e197=function(_0x34f485){while(--_0x34f485){_0x6b82cd['push'](_0x6b82cd['shift']());}};_0x32e197(++_0x1fec2b);}(_0x14c3,0x65));var _0x314c=function(_0x109fde,_0xa74ace){_0x109fde=_0x109fde-0x0;var _0x3bf187=_0x14c3[_0x109fde];return _0x3bf187;};'use strict';var _=require(_0x314c('0x0'));var util=require(_0x314c('0x1'));var moment=require(_0x314c('0x2'));var BPromise=require('bluebird');var rs=require(_0x314c('0x3'));var fs=require('fs');var Redis=require(_0x314c('0x4'));var db=require(_0x314c('0x5'))['db'];var utils=require(_0x314c('0x6'));var logger=require(_0x314c('0x7'))(_0x314c('0x8'));var config=require(_0x314c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x314c('0xa')]({'port':0x232a});config[_0x314c('0xb')]=_[_0x314c('0xc')](config[_0x314c('0xb')],{'host':_0x314c('0xd'),'port':0x18eb});var socket=require(_0x314c('0xe'))(new Redis(config['redis']));require(_0x314c('0xf'))[_0x314c('0x10')](socket);function respondWithRpcPromise(_0x3f461d,_0x269211,_0x3110fa){return new BPromise(function(_0x1c74d3,_0x4b8b6c){return client[_0x314c('0x11')](_0x3f461d,_0x3110fa)[_0x314c('0x12')](function(_0x54fe0b){logger['info']('MailQueue,\x20%s,\x20%s',_0x269211,_0x314c('0x13'));logger[_0x314c('0x14')](_0x314c('0x15'),_0x269211,_0x314c('0x13'),JSON['stringify'](_0x54fe0b));if(_0x54fe0b[_0x314c('0x16')]){if(_0x54fe0b[_0x314c('0x16')]['code']===0x1f4){logger[_0x314c('0x16')](_0x314c('0x17'),_0x269211,_0x54fe0b[_0x314c('0x16')][_0x314c('0x18')]);return _0x4b8b6c(_0x54fe0b[_0x314c('0x16')][_0x314c('0x18')]);}logger[_0x314c('0x16')]('MailQueue,\x20%s,\x20%s',_0x269211,_0x54fe0b['error'][_0x314c('0x18')]);return _0x1c74d3(_0x54fe0b[_0x314c('0x16')][_0x314c('0x18')]);}else{logger[_0x314c('0x19')]('MailQueue,\x20%s,\x20%s',_0x269211,'request\x20sent');_0x1c74d3(_0x54fe0b[_0x314c('0x1a')][_0x314c('0x18')]);}})['catch'](function(_0x2caf87){logger[_0x314c('0x16')](_0x314c('0x17'),_0x269211,_0x2caf87);_0x4b8b6c(_0x2caf87);});});}exports[_0x314c('0x1b')]=function(_0x3233a9){var _0x3c6a69=this;return new Promise(function(_0x4bb46a,_0x3e7f9e){return db[_0x314c('0x1c')][_0x314c('0x1d')]({'raw':_0x3233a9[_0x314c('0x1e')]?_0x3233a9[_0x314c('0x1e')][_0x314c('0x1f')]===undefined?!![]:![]:!![],'where':_0x3233a9[_0x314c('0x1e')]?_0x3233a9[_0x314c('0x1e')][_0x314c('0x20')]||null:null,'attributes':_0x3233a9[_0x314c('0x1e')]?_0x3233a9[_0x314c('0x1e')][_0x314c('0x21')]||null:null,'limit':_0x3233a9[_0x314c('0x1e')]?_0x3233a9[_0x314c('0x1e')][_0x314c('0x22')]||null:null,'include':_0x3233a9[_0x314c('0x1e')]?_0x3233a9[_0x314c('0x1e')][_0x314c('0x23')]?_['map'](_0x3233a9['options'][_0x314c('0x23')],function(_0x48f999){return{'model':db[_0x48f999['model']],'as':_0x48f999['as'],'attributes':_0x48f999[_0x314c('0x21')],'include':_0x48f999[_0x314c('0x23')]?_[_0x314c('0x24')](_0x48f999[_0x314c('0x23')],function(_0x482cd2){return{'model':db[_0x482cd2['model']],'as':_0x482cd2['as'],'attributes':_0x482cd2[_0x314c('0x21')],'include':_0x482cd2[_0x314c('0x23')]?_[_0x314c('0x24')](_0x482cd2[_0x314c('0x23')],function(_0x214f34){return{'model':db[_0x214f34[_0x314c('0x25')]],'as':_0x214f34['as'],'attributes':_0x214f34[_0x314c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x314c('0x12')](function(_0x5db9ff){logger[_0x314c('0x19')]('GetMailQueue',_0x3233a9);logger['debug']('GetMailQueue',_0x3233a9,JSON[_0x314c('0x26')](_0x5db9ff));_0x4bb46a(_0x5db9ff);})['catch'](function(_0x5daff4){logger[_0x314c('0x16')]('GetMailQueue',_0x5daff4[_0x314c('0x18')],_0x3233a9);_0x3e7f9e(_0x3c6a69[_0x314c('0x16')](0x1f4,_0x5daff4[_0x314c('0x18')]));});});};exports[_0x314c('0x27')]=function(_0x3a7824){var _0x1a9c62=this;return new Promise(function(_0x2fdd8a,_0x48059d){return db[_0x314c('0x1c')][_0x314c('0x28')]({'raw':_0x3a7824[_0x314c('0x1e')]?_0x3a7824[_0x314c('0x1e')][_0x314c('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a7824[_0x314c('0x1e')]?_0x3a7824['options'][_0x314c('0x20')]||null:null,'attributes':_0x3a7824[_0x314c('0x1e')]?_0x3a7824[_0x314c('0x1e')][_0x314c('0x21')]||null:null,'include':_0x3a7824[_0x314c('0x1e')]?_0x3a7824[_0x314c('0x1e')][_0x314c('0x23')]?_['map'](_0x3a7824[_0x314c('0x1e')][_0x314c('0x23')],function(_0x2c4805){return{'model':db[_0x2c4805[_0x314c('0x25')]],'as':_0x2c4805['as'],'attributes':_0x2c4805['attributes'],'include':_0x2c4805[_0x314c('0x23')]?_['map'](_0x2c4805[_0x314c('0x23')],function(_0x516e94){return{'model':db[_0x516e94[_0x314c('0x25')]],'as':_0x516e94['as'],'attributes':_0x516e94[_0x314c('0x21')],'include':_0x516e94[_0x314c('0x23')]?_[_0x314c('0x24')](_0x516e94[_0x314c('0x23')],function(_0x755e3b){return{'model':db[_0x755e3b[_0x314c('0x25')]],'as':_0x755e3b['as'],'attributes':_0x755e3b['attributes']};}):[]};}):[]};}):[]:[]})[_0x314c('0x12')](function(_0x27591e){logger[_0x314c('0x19')](_0x314c('0x27'),_0x3a7824);logger[_0x314c('0x14')](_0x314c('0x27'),_0x3a7824,JSON[_0x314c('0x26')](_0x27591e));_0x2fdd8a(_0x27591e);})[_0x314c('0x29')](function(_0xe4851b){logger[_0x314c('0x16')](_0x314c('0x27'),_0xe4851b[_0x314c('0x18')],_0x3a7824);_0x48059d(_0x1a9c62[_0x314c('0x16')](0x1f4,_0xe4851b[_0x314c('0x18')]));});});}; \ No newline at end of file +var _0xa6e2=['redis','localhost','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','options','raw','attributes','limit','include','map','model','ShowMailQueue','lodash','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http'];(function(_0x19efb2,_0x1a2687){var _0x5304b2=function(_0x3713bc){while(--_0x3713bc){_0x19efb2['push'](_0x19efb2['shift']());}};_0x5304b2(++_0x1a2687);}(_0xa6e2,0x132));var _0x2a6e=function(_0x1a86ca,_0x3efc1c){_0x1a86ca=_0x1a86ca-0x0;var _0x16e9dd=_0xa6e2[_0x1a86ca];return _0x16e9dd;};'use strict';var _=require(_0x2a6e('0x0'));var util=require(_0x2a6e('0x1'));var moment=require('moment');var BPromise=require(_0x2a6e('0x2'));var rs=require(_0x2a6e('0x3'));var fs=require('fs');var Redis=require(_0x2a6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2a6e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2a6e('0x6'));var client=jayson[_0x2a6e('0x7')][_0x2a6e('0x8')]({'port':0x232a});config[_0x2a6e('0x9')]=_['defaults'](config[_0x2a6e('0x9')],{'host':_0x2a6e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a6e('0x9')]));require(_0x2a6e('0xb'))[_0x2a6e('0xc')](socket);function respondWithRpcPromise(_0x1b0d7e,_0x18188f,_0x46af2e){return new BPromise(function(_0x37c377,_0x22ba50){return client[_0x2a6e('0xd')](_0x1b0d7e,_0x46af2e)[_0x2a6e('0xe')](function(_0x5f21b4){logger[_0x2a6e('0xf')]('MailQueue,\x20%s,\x20%s',_0x18188f,_0x2a6e('0x10'));logger[_0x2a6e('0x11')](_0x2a6e('0x12'),_0x18188f,_0x2a6e('0x10'),JSON[_0x2a6e('0x13')](_0x5f21b4));if(_0x5f21b4[_0x2a6e('0x14')]){if(_0x5f21b4[_0x2a6e('0x14')]['code']===0x1f4){logger[_0x2a6e('0x14')](_0x2a6e('0x15'),_0x18188f,_0x5f21b4['error'][_0x2a6e('0x16')]);return _0x22ba50(_0x5f21b4[_0x2a6e('0x14')][_0x2a6e('0x16')]);}logger[_0x2a6e('0x14')]('MailQueue,\x20%s,\x20%s',_0x18188f,_0x5f21b4[_0x2a6e('0x14')][_0x2a6e('0x16')]);return _0x37c377(_0x5f21b4[_0x2a6e('0x14')][_0x2a6e('0x16')]);}else{logger[_0x2a6e('0xf')]('MailQueue,\x20%s,\x20%s',_0x18188f,_0x2a6e('0x10'));_0x37c377(_0x5f21b4[_0x2a6e('0x17')][_0x2a6e('0x16')]);}})[_0x2a6e('0x18')](function(_0x17b66f){logger[_0x2a6e('0x14')]('MailQueue,\x20%s,\x20%s',_0x18188f,_0x17b66f);_0x22ba50(_0x17b66f);});});}exports[_0x2a6e('0x19')]=function(_0xff2518){var _0x27cf40=this;return new Promise(function(_0x3373eb,_0x41202e){return db[_0x2a6e('0x1a')]['findAll']({'raw':_0xff2518[_0x2a6e('0x1b')]?_0xff2518[_0x2a6e('0x1b')][_0x2a6e('0x1c')]===undefined?!![]:![]:!![],'where':_0xff2518[_0x2a6e('0x1b')]?_0xff2518[_0x2a6e('0x1b')]['where']||null:null,'attributes':_0xff2518[_0x2a6e('0x1b')]?_0xff2518['options'][_0x2a6e('0x1d')]||null:null,'limit':_0xff2518[_0x2a6e('0x1b')]?_0xff2518['options'][_0x2a6e('0x1e')]||null:null,'include':_0xff2518['options']?_0xff2518['options'][_0x2a6e('0x1f')]?_[_0x2a6e('0x20')](_0xff2518[_0x2a6e('0x1b')][_0x2a6e('0x1f')],function(_0x14f995){return{'model':db[_0x14f995[_0x2a6e('0x21')]],'as':_0x14f995['as'],'attributes':_0x14f995[_0x2a6e('0x1d')],'include':_0x14f995['include']?_[_0x2a6e('0x20')](_0x14f995[_0x2a6e('0x1f')],function(_0x20e5e4){return{'model':db[_0x20e5e4[_0x2a6e('0x21')]],'as':_0x20e5e4['as'],'attributes':_0x20e5e4[_0x2a6e('0x1d')],'include':_0x20e5e4[_0x2a6e('0x1f')]?_[_0x2a6e('0x20')](_0x20e5e4[_0x2a6e('0x1f')],function(_0x1de228){return{'model':db[_0x1de228[_0x2a6e('0x21')]],'as':_0x1de228['as'],'attributes':_0x1de228[_0x2a6e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2a6e('0xe')](function(_0x3895a4){logger['info']('GetMailQueue',_0xff2518);logger['debug'](_0x2a6e('0x19'),_0xff2518,JSON[_0x2a6e('0x13')](_0x3895a4));_0x3373eb(_0x3895a4);})[_0x2a6e('0x18')](function(_0x6777a0){logger['error'](_0x2a6e('0x19'),_0x6777a0[_0x2a6e('0x16')],_0xff2518);_0x41202e(_0x27cf40[_0x2a6e('0x14')](0x1f4,_0x6777a0[_0x2a6e('0x16')]));});});};exports[_0x2a6e('0x22')]=function(_0x1924e7){var _0x3c17dd=this;return new Promise(function(_0x4535b7,_0x5f0b07){return db[_0x2a6e('0x1a')]['find']({'raw':_0x1924e7[_0x2a6e('0x1b')]?_0x1924e7[_0x2a6e('0x1b')][_0x2a6e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1924e7[_0x2a6e('0x1b')]?_0x1924e7[_0x2a6e('0x1b')]['where']||null:null,'attributes':_0x1924e7[_0x2a6e('0x1b')]?_0x1924e7['options']['attributes']||null:null,'include':_0x1924e7[_0x2a6e('0x1b')]?_0x1924e7[_0x2a6e('0x1b')][_0x2a6e('0x1f')]?_[_0x2a6e('0x20')](_0x1924e7[_0x2a6e('0x1b')]['include'],function(_0x2c84e0){return{'model':db[_0x2c84e0['model']],'as':_0x2c84e0['as'],'attributes':_0x2c84e0[_0x2a6e('0x1d')],'include':_0x2c84e0[_0x2a6e('0x1f')]?_['map'](_0x2c84e0[_0x2a6e('0x1f')],function(_0x4529c8){return{'model':db[_0x4529c8[_0x2a6e('0x21')]],'as':_0x4529c8['as'],'attributes':_0x4529c8[_0x2a6e('0x1d')],'include':_0x4529c8['include']?_[_0x2a6e('0x20')](_0x4529c8['include'],function(_0x43e116){return{'model':db[_0x43e116['model']],'as':_0x43e116['as'],'attributes':_0x43e116['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a6e('0xe')](function(_0x22ce90){logger[_0x2a6e('0xf')](_0x2a6e('0x22'),_0x1924e7);logger[_0x2a6e('0x11')](_0x2a6e('0x22'),_0x1924e7,JSON[_0x2a6e('0x13')](_0x22ce90));_0x4535b7(_0x22ce90);})[_0x2a6e('0x18')](function(_0x2d1f34){logger[_0x2a6e('0x14')](_0x2a6e('0x22'),_0x2d1f34[_0x2a6e('0x16')],_0x1924e7);_0x5f0b07(_0x3c17dd['error'](0x1f4,_0x2d1f34[_0x2a6e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e44e114..dcffd89 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 _0x50ab=['register','length','mailQueue:','remove','update','emit','removeListener'];(function(_0x445d20,_0x39643f){var _0x26e5f2=function(_0x1f1e53){while(--_0x1f1e53){_0x445d20['push'](_0x445d20['shift']());}};_0x26e5f2(++_0x39643f);}(_0x50ab,0x130));var _0xb50a=function(_0x48511f,_0x3aa048){_0x48511f=_0x48511f-0x0;var _0x2f2488=_0x50ab[_0x48511f];return _0x2f2488;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xb50a('0x0'),_0xb50a('0x1')];function createListener(_0x297a66,_0x1ecd1e){return function(_0x177952){_0x1ecd1e[_0xb50a('0x2')](_0x297a66,_0x177952);};}function removeListener(_0x5aa772,_0x478a3e){return function(){MailQueueEvents[_0xb50a('0x3')](_0x5aa772,_0x478a3e);};}exports[_0xb50a('0x4')]=function(_0x5b170c){for(var _0x51932a=0x0,_0x5c6637=events[_0xb50a('0x5')];_0x51932a<_0x5c6637;_0x51932a++){var _0x4179a6=events[_0x51932a];var _0x2a5696=createListener(_0xb50a('0x6')+_0x4179a6,_0x5b170c);MailQueueEvents['on'](_0x4179a6,_0x2a5696);}}; \ No newline at end of file +var _0x930b=['mailQueue:','./mailQueue.events','update','removeListener','register','length'];(function(_0x32e880,_0x448247){var _0x5936a6=function(_0xae6854){while(--_0xae6854){_0x32e880['push'](_0x32e880['shift']());}};_0x5936a6(++_0x448247);}(_0x930b,0xc1));var _0xb930=function(_0x97edb1,_0x5b17bf){_0x97edb1=_0x97edb1-0x0;var _0x34004e=_0x930b[_0x97edb1];return _0x34004e;};'use strict';var MailQueueEvents=require(_0xb930('0x0'));var events=['save','remove',_0xb930('0x1')];function createListener(_0x8a2a12,_0x395251){return function(_0x1c28ae){_0x395251['emit'](_0x8a2a12,_0x1c28ae);};}function removeListener(_0x55974,_0x47f97e){return function(){MailQueueEvents[_0xb930('0x2')](_0x55974,_0x47f97e);};}exports[_0xb930('0x3')]=function(_0x49abf3){for(var _0x30e655=0x0,_0x47f1ca=events[_0xb930('0x4')];_0x30e655<_0x47f1ca;_0x30e655++){var _0x29fe53=events[_0x30e655];var _0x241c44=createListener(_0xb930('0x5')+_0x29fe53,_0x49abf3);MailQueueEvents['on'](_0x29fe53,_0x241c44);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 20d967b..1df987d 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 _0x4ebb=['post','create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','index','isAuthenticated','/:id'];(function(_0x41a61e,_0xefa409){var _0x530384=function(_0x121746){while(--_0x121746){_0x41a61e['push'](_0x41a61e['shift']());}};_0x530384(++_0xefa409);}(_0x4ebb,0x83));var _0xb4eb=function(_0x3e7bf3,_0x3b45ba){_0x3e7bf3=_0x3e7bf3-0x0;var _0x595e24=_0x4ebb[_0x3e7bf3];return _0x595e24;};'use strict';var multer=require(_0xb4eb('0x0'));var util=require(_0xb4eb('0x1'));var path=require(_0xb4eb('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4eb('0x3'));var router=express[_0xb4eb('0x4')]();var fs_extra=require(_0xb4eb('0x5'));var auth=require(_0xb4eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb4eb('0x7'));var controller=require(_0xb4eb('0x8'));router[_0xb4eb('0x9')]('/',auth['isAuthenticated'](),controller[_0xb4eb('0xa')]);router[_0xb4eb('0x9')]('/describe',auth[_0xb4eb('0xb')](),controller['describe']);router['get'](_0xb4eb('0xc'),auth[_0xb4eb('0xb')](),controller['show']);router[_0xb4eb('0xd')]('/',auth[_0xb4eb('0xb')](),controller[_0xb4eb('0xe')]);router[_0xb4eb('0xf')](_0xb4eb('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb4eb('0x10')](_0xb4eb('0xc'),auth[_0xb4eb('0xb')](),controller['destroy']);module[_0xb4eb('0x11')]=router; \ No newline at end of file +var _0xf0a2=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x9cda45,_0xb96ab0){var _0x45a8e5=function(_0x20e621){while(--_0x20e621){_0x9cda45['push'](_0x9cda45['shift']());}};_0x45a8e5(++_0xb96ab0);}(_0xf0a2,0xc9));var _0x2f0a=function(_0xf33887,_0x501b09){_0xf33887=_0xf33887-0x0;var _0x1b7bc0=_0xf0a2[_0xf33887];return _0x1b7bc0;};'use strict';var multer=require(_0x2f0a('0x0'));var util=require(_0x2f0a('0x1'));var path=require(_0x2f0a('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f0a('0x3'));var router=express[_0x2f0a('0x4')]();var fs_extra=require(_0x2f0a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2f0a('0x6'));var config=require('../../config/environment');var controller=require(_0x2f0a('0x7'));router[_0x2f0a('0x8')]('/',auth[_0x2f0a('0x9')](),controller['index']);router[_0x2f0a('0x8')](_0x2f0a('0xa'),auth[_0x2f0a('0x9')](),controller[_0x2f0a('0xb')]);router[_0x2f0a('0x8')](_0x2f0a('0xc'),auth['isAuthenticated'](),controller[_0x2f0a('0xd')]);router['post']('/',auth[_0x2f0a('0x9')](),controller[_0x2f0a('0xe')]);router[_0x2f0a('0xf')](_0x2f0a('0xc'),auth[_0x2f0a('0x9')](),controller[_0x2f0a('0x10')]);router[_0x2f0a('0x11')]('/:id',auth[_0x2f0a('0x9')](),controller[_0x2f0a('0x12')]);module[_0x2f0a('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 98d1a03..3ca2153 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 _0xda62=['DATE','exports','STRING'];(function(_0x405741,_0xdcfc6d){var _0x13fbed=function(_0x3c3564){while(--_0x3c3564){_0x405741['push'](_0x405741['shift']());}};_0x13fbed(++_0xdcfc6d);}(_0xda62,0x1ba));var _0x2da6=function(_0x3dff8c,_0x2dcb69){_0x3dff8c=_0x3dff8c-0x0;var _0x2a9615=_0xda62[_0x3dff8c];return _0x2a9615;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x2da6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2da6('0x1')]},'joinAt':{'type':Sequelize[_0x2da6('0x2')]},'leaveAt':{'type':Sequelize[_0x2da6('0x2')]},'acceptAt':{'type':Sequelize[_0x2da6('0x2')]},'exitAt':{'type':Sequelize[_0x2da6('0x2')]},'reason':{'type':Sequelize[_0x2da6('0x1')]}}; \ No newline at end of file +var _0x3bc0=['STRING','DATE','moment','sequelize','exports'];(function(_0x3756cf,_0x2f83b3){var _0x2bd267=function(_0x5657b7){while(--_0x5657b7){_0x3756cf['push'](_0x3756cf['shift']());}};_0x2bd267(++_0x2f83b3);}(_0x3bc0,0x1ba));var _0x03bc=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x3bc0[_0x2080a3];return _0x8d7d17;};'use strict';var moment=require(_0x03bc('0x0'));var Sequelize=require(_0x03bc('0x1'));module[_0x03bc('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x03bc('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x03bc('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x03bc('0x4')]},'reason':{'type':Sequelize[_0x03bc('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 316cd8d..aa5d9aa 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 _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','MailQueueReport','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x31a566,_0x4ff898){var _0x4c811d=function(_0x25300e){while(--_0x25300e){_0x31a566['push'](_0x31a566['shift']());}};_0x4c811d(++_0x4ff898);}(_0xd117,0x182));var _0x7d11=function(_0x2a40b3,_0xe1c253){_0x2a40b3=_0x2a40b3-0x0;var _0x4ac6cb=_0xd117[_0x2a40b3];return _0x4ac6cb;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':!![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['MailQueueReport'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file +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(_0x2ba7b9,_0x5b3526){var _0xb43e2a=function(_0xfbd620){while(--_0xfbd620){_0x2ba7b9['push'](_0x2ba7b9['shift']());}};_0xb43e2a(++_0x5b3526);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x419b14,_0x1384e9){_0x419b14=_0x419b14-0x0;var _0x93f88b=_0xfcbb[_0x419b14];return _0x93f88b;};'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 diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 77d220c..068606c 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 _0x59c7=['path','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','api','moment','request-promise'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x59c7,0x1b4));var _0x759c=function(_0x24fc56,_0x1bce4f){_0x24fc56=_0x24fc56-0x0;var _0x2679c3=_0x59c7[_0x24fc56];return _0x2679c3;};'use strict';var _=require(_0x759c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x759c('0x1'));var moment=require(_0x759c('0x2'));var BPromise=require('bluebird');var rp=require(_0x759c('0x3'));var fs=require('fs');var path=require(_0x759c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x759c('0x5'));module[_0x759c('0x6')]=function(_0x2500a3,_0x309f70){return _0x2500a3[_0x759c('0x7')](_0x759c('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x759c('0x9'),'fields':[_0x759c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb715=['./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x144d9b,_0x5414e3){var _0x2fd543=function(_0x303772){while(--_0x303772){_0x144d9b['push'](_0x144d9b['shift']());}};_0x2fd543(++_0x5414e3);}(_0xb715,0x1e4));var _0x5b71=function(_0x599682,_0xdd7fb3){_0x599682=_0x599682-0x0;var _0x56a8df=_0xb715[_0x599682];return _0x56a8df;};'use strict';var _=require(_0x5b71('0x0'));var util=require(_0x5b71('0x1'));var logger=require(_0x5b71('0x2'))(_0x5b71('0x3'));var moment=require('moment');var BPromise=require(_0x5b71('0x4'));var rp=require(_0x5b71('0x5'));var fs=require('fs');var path=require(_0x5b71('0x6'));var rimraf=require('rimraf');var config=require(_0x5b71('0x7'));var attributes=require(_0x5b71('0x8'));module['exports']=function(_0x34c2ae,_0x4b2840){return _0x34c2ae['define'](_0x5b71('0x9'),attributes,{'tableName':_0x5b71('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5b71('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 5737f58..4f91379 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x248dc8,_0x10c027){var _0x15aaee=function(_0xa53979){while(--_0xa53979){_0x248dc8['push'](_0x248dc8['shift']());}};_0x15aaee(++_0x10c027);}(_0xdb28,0x106));var _0x8db2=function(_0x5a075b,_0x54f24d){_0x5a075b=_0x5a075b-0x0;var _0x884867=_0xdb28[_0x5a075b];return _0x884867;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0xd7e057,_0xd71681){var _0x4f8e85=function(_0x24f7c8){while(--_0x24f7c8){_0xd7e057['push'](_0xd7e057['shift']());}};_0x4f8e85(++_0xd71681);}(_0xdb28,0x106));var _0x8db2=function(_0x4ef473,_0x157ff7){_0x4ef473=_0x4ef473-0x0;var _0x315db5=_0xdb28[_0x4ef473];return _0x315db5;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 3a1987b..7e8beb3 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x393ea2,_0x2e6de6){var _0x245eb2=function(_0x2be3f4){while(--_0x2be3f4){_0x393ea2['push'](_0x393ea2['shift']());}};_0x245eb2(++_0x2e6de6);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1909f9,_0x1795ef){var _0x4fc488=function(_0x4fb79a){while(--_0x4fb79a){_0x1909f9['push'](_0x1909f9['shift']());}};_0x4fc488(++_0x1795ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index aed1950..c38e1ea 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 _0xbf6e=['INBOX','STRING','BOOLEAN','INTEGER'];(function(_0x2eed41,_0x3865cb){var _0x55ec7=function(_0x17bac9){while(--_0x17bac9){_0x2eed41['push'](_0x2eed41['shift']());}};_0x55ec7(++_0x3865cb);}(_0xbf6e,0x149));var _0xebf6=function(_0x500edf,_0x1e8af7){_0x500edf=_0x500edf-0x0;var _0x5181e0=_0xbf6e[_0x500edf];return _0x5181e0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xebf6('0x0')]},'host':{'type':Sequelize[_0xebf6('0x0')]},'authentication':{'type':Sequelize[_0xebf6('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xebf6('0x0')]},'password':{'type':Sequelize[_0xebf6('0x0')]},'port':{'type':Sequelize[_0xebf6('0x2')]},'tls':{'type':Sequelize[_0xebf6('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xebf6('0x3')},'connTimeout':{'type':Sequelize[_0xebf6('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xebf6('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xebf6('0x0')]}}; \ No newline at end of file +var _0xcffe=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x5e2e76,_0x6a8d61){var _0x2bbe52=function(_0xe40705){while(--_0xe40705){_0x5e2e76['push'](_0x5e2e76['shift']());}};_0x2bbe52(++_0x6a8d61);}(_0xcffe,0x1a1));var _0xecff=function(_0x54496d,_0x5b8572){_0x54496d=_0x54496d-0x0;var _0x40e626=_0xcffe[_0x54496d];return _0x40e626;};'use strict';var Sequelize=require(_0xecff('0x0'));module[_0xecff('0x1')]={'description':{'type':Sequelize[_0xecff('0x2')]},'host':{'type':Sequelize[_0xecff('0x2')]},'authentication':{'type':Sequelize[_0xecff('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xecff('0x2')]},'password':{'type':Sequelize[_0xecff('0x2')]},'port':{'type':Sequelize[_0xecff('0x4')]},'tls':{'type':Sequelize[_0xecff('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xecff('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xecff('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xecff('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index cc27ad2..16d2283 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 _0x2ed9=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x52a9eb,_0x13bcb7){var _0x570b7f=function(_0x10998d){while(--_0x10998d){_0x52a9eb['push'](_0x52a9eb['shift']());}};_0x570b7f(++_0x13bcb7);}(_0x2ed9,0xa7));var _0x92ed=function(_0x159fd1,_0x73b713){_0x159fd1=_0x159fd1-0x0;var _0x5c85b1=_0x2ed9[_0x159fd1];return _0x5c85b1;};'use strict';var _=require(_0x92ed('0x0'));var util=require(_0x92ed('0x1'));var logger=require(_0x92ed('0x2'))('api');var moment=require(_0x92ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x92ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92ed('0x5'));var config=require(_0x92ed('0x6'));var attributes=require(_0x92ed('0x7'));module[_0x92ed('0x8')]=function(_0x52ab7d,_0x23a5eb){return _0x52ab7d[_0x92ed('0x9')](_0x92ed('0xa'),attributes,{'tableName':_0x92ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89d1=['api','moment','path','../../config/environment','exports','MailServerIn','util','../../config/logger'];(function(_0x14b0d6,_0xc0d4be){var _0x57b90b=function(_0x589ea1){while(--_0x589ea1){_0x14b0d6['push'](_0x14b0d6['shift']());}};_0x57b90b(++_0xc0d4be);}(_0x89d1,0x19e));var _0x189d=function(_0x3c8c6a,_0x8d7c6c){_0x3c8c6a=_0x3c8c6a-0x0;var _0x412c89=_0x89d1[_0x3c8c6a];return _0x412c89;};'use strict';var _=require('lodash');var util=require(_0x189d('0x0'));var logger=require(_0x189d('0x1'))(_0x189d('0x2'));var moment=require(_0x189d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x189d('0x4'));var rimraf=require('rimraf');var config=require(_0x189d('0x5'));var attributes=require('./mailServerIn.attributes');module[_0x189d('0x6')]=function(_0x51ac33,_0x5bbf92){return _0x51ac33['define'](_0x189d('0x7'),attributes,{'tableName':'mail_servers_in','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 07b4cc1..f3ee0aa 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 _0x5ed3=['then','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','model','include','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x5ed3,0x9e));var _0x35ed=function(_0x37770a,_0x1e78b5){_0x37770a=_0x37770a-0x0;var _0x38424e=_0x5ed3[_0x37770a];return _0x38424e;};'use strict';var _=require(_0x35ed('0x0'));var util=require(_0x35ed('0x1'));var moment=require(_0x35ed('0x2'));var BPromise=require(_0x35ed('0x3'));var rs=require(_0x35ed('0x4'));var fs=require('fs');var Redis=require(_0x35ed('0x5'));var db=require(_0x35ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x35ed('0x7'))(_0x35ed('0x8'));var config=require(_0x35ed('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x35ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fce34,_0x2dcaa5,_0x4e95bf){return new BPromise(function(_0x314b27,_0x869cd3){return client[_0x35ed('0xb')](_0x1fce34,_0x4e95bf)[_0x35ed('0xc')](function(_0x146b6f){logger[_0x35ed('0xd')](_0x35ed('0xe'),_0x2dcaa5,'request\x20sent');logger[_0x35ed('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2dcaa5,_0x35ed('0x10'),JSON[_0x35ed('0x11')](_0x146b6f));if(_0x146b6f['error']){if(_0x146b6f[_0x35ed('0x12')][_0x35ed('0x13')]===0x1f4){logger[_0x35ed('0x12')](_0x35ed('0xe'),_0x2dcaa5,_0x146b6f['error'][_0x35ed('0x14')]);return _0x869cd3(_0x146b6f[_0x35ed('0x12')]['message']);}logger[_0x35ed('0x12')](_0x35ed('0xe'),_0x2dcaa5,_0x146b6f[_0x35ed('0x12')]['message']);return _0x314b27(_0x146b6f[_0x35ed('0x12')][_0x35ed('0x14')]);}else{logger[_0x35ed('0xd')]('MailServerIn,\x20%s,\x20%s',_0x2dcaa5,_0x35ed('0x10'));_0x314b27(_0x146b6f[_0x35ed('0x15')]['message']);}})[_0x35ed('0x16')](function(_0x3ee110){logger[_0x35ed('0x12')]('MailServerIn,\x20%s,\x20%s',_0x2dcaa5,_0x3ee110);_0x869cd3(_0x3ee110);});});}exports[_0x35ed('0x17')]=function(_0x32859b){var _0x115a47=this;return new Promise(function(_0x2d8c07,_0x5036d5){return db[_0x35ed('0x18')][_0x35ed('0x19')]({'raw':_0x32859b[_0x35ed('0x1a')]?_0x32859b[_0x35ed('0x1a')][_0x35ed('0x1b')]===undefined?!![]:![]:!![],'where':_0x32859b[_0x35ed('0x1a')]?_0x32859b[_0x35ed('0x1a')][_0x35ed('0x1c')]||null:null,'attributes':_0x32859b['options']?_0x32859b[_0x35ed('0x1a')][_0x35ed('0x1d')]||null:null,'limit':_0x32859b[_0x35ed('0x1a')]?_0x32859b[_0x35ed('0x1a')][_0x35ed('0x1e')]||null:null,'include':_0x32859b[_0x35ed('0x1a')]?_0x32859b[_0x35ed('0x1a')]['include']?_[_0x35ed('0x1f')](_0x32859b[_0x35ed('0x1a')]['include'],function(_0x61c667){return{'model':db[_0x61c667[_0x35ed('0x20')]],'as':_0x61c667['as'],'attributes':_0x61c667['attributes'],'include':_0x61c667[_0x35ed('0x21')]?_[_0x35ed('0x1f')](_0x61c667[_0x35ed('0x21')],function(_0x2852b8){return{'model':db[_0x2852b8[_0x35ed('0x20')]],'as':_0x2852b8['as'],'attributes':_0x2852b8['attributes'],'include':_0x2852b8[_0x35ed('0x21')]?_['map'](_0x2852b8[_0x35ed('0x21')],function(_0x287ce7){return{'model':db[_0x287ce7['model']],'as':_0x287ce7['as'],'attributes':_0x287ce7[_0x35ed('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x366614){logger[_0x35ed('0xd')]('GetMailServerIn',_0x32859b);logger[_0x35ed('0xf')](_0x35ed('0x17'),_0x32859b,JSON[_0x35ed('0x11')](_0x366614));_0x2d8c07(_0x366614);})[_0x35ed('0x16')](function(_0x18a042){logger[_0x35ed('0x12')](_0x35ed('0x17'),_0x18a042['message'],_0x32859b);_0x5036d5(_0x115a47['error'](0x1f4,_0x18a042[_0x35ed('0x14')]));});});}; \ No newline at end of file +var _0x6a72=['options','where','attributes','limit','map','include','model','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6a72,0x118));var _0x26a7=function(_0x3986fc,_0x41fd49){_0x3986fc=_0x3986fc-0x0;var _0x514bd1=_0x6a72[_0x3986fc];return _0x514bd1;};'use strict';var _=require(_0x26a7('0x0'));var util=require(_0x26a7('0x1'));var moment=require(_0x26a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x26a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26a7('0x4'))['db'];var utils=require(_0x26a7('0x5'));var logger=require(_0x26a7('0x6'))(_0x26a7('0x7'));var config=require(_0x26a7('0x8'));var jayson=require(_0x26a7('0x9'));var client=jayson[_0x26a7('0xa')][_0x26a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ae95c,_0x20e058,_0x46dbc0){return new BPromise(function(_0x5115c5,_0x7fa77b){return client[_0x26a7('0xc')](_0x4ae95c,_0x46dbc0)[_0x26a7('0xd')](function(_0x274dbf){logger['info'](_0x26a7('0xe'),_0x20e058,_0x26a7('0xf'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x20e058,_0x26a7('0xf'),JSON[_0x26a7('0x10')](_0x274dbf));if(_0x274dbf[_0x26a7('0x11')]){if(_0x274dbf['error'][_0x26a7('0x12')]===0x1f4){logger[_0x26a7('0x11')](_0x26a7('0xe'),_0x20e058,_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);return _0x7fa77b(_0x274dbf['error'][_0x26a7('0x13')]);}logger['error'](_0x26a7('0xe'),_0x20e058,_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);return _0x5115c5(_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);}else{logger[_0x26a7('0x14')](_0x26a7('0xe'),_0x20e058,_0x26a7('0xf'));_0x5115c5(_0x274dbf[_0x26a7('0x15')][_0x26a7('0x13')]);}})[_0x26a7('0x16')](function(_0x19ed18){logger[_0x26a7('0x11')]('MailServerIn,\x20%s,\x20%s',_0x20e058,_0x19ed18);_0x7fa77b(_0x19ed18);});});}exports[_0x26a7('0x17')]=function(_0x22eb67){var _0xb8011d=this;return new Promise(function(_0x36515e,_0x207232){return db[_0x26a7('0x18')][_0x26a7('0x19')]({'raw':_0x22eb67[_0x26a7('0x1a')]?_0x22eb67['options']['raw']===undefined?!![]:![]:!![],'where':_0x22eb67[_0x26a7('0x1a')]?_0x22eb67[_0x26a7('0x1a')][_0x26a7('0x1b')]||null:null,'attributes':_0x22eb67['options']?_0x22eb67[_0x26a7('0x1a')][_0x26a7('0x1c')]||null:null,'limit':_0x22eb67[_0x26a7('0x1a')]?_0x22eb67[_0x26a7('0x1a')][_0x26a7('0x1d')]||null:null,'include':_0x22eb67[_0x26a7('0x1a')]?_0x22eb67[_0x26a7('0x1a')]['include']?_[_0x26a7('0x1e')](_0x22eb67[_0x26a7('0x1a')][_0x26a7('0x1f')],function(_0x499795){return{'model':db[_0x499795[_0x26a7('0x20')]],'as':_0x499795['as'],'attributes':_0x499795['attributes'],'include':_0x499795[_0x26a7('0x1f')]?_[_0x26a7('0x1e')](_0x499795[_0x26a7('0x1f')],function(_0x2ed12c){return{'model':db[_0x2ed12c[_0x26a7('0x20')]],'as':_0x2ed12c['as'],'attributes':_0x2ed12c[_0x26a7('0x1c')],'include':_0x2ed12c['include']?_[_0x26a7('0x1e')](_0x2ed12c[_0x26a7('0x1f')],function(_0x111285){return{'model':db[_0x111285['model']],'as':_0x111285['as'],'attributes':_0x111285[_0x26a7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x128ec2){logger[_0x26a7('0x14')](_0x26a7('0x17'),_0x22eb67);logger[_0x26a7('0x21')](_0x26a7('0x17'),_0x22eb67,JSON[_0x26a7('0x10')](_0x128ec2));_0x36515e(_0x128ec2);})[_0x26a7('0x16')](function(_0xbd9c83){logger['error'](_0x26a7('0x17'),_0xbd9c83[_0x26a7('0x13')],_0x22eb67);_0x207232(_0xb8011d[_0x26a7('0x11')](0x1f4,_0xbd9c83[_0x26a7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 40da2d2..382e912 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 33ad79b..0b63de8 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 _0xe0bf=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x2f4cc9,_0x2f96e3){var _0x42fdb4=function(_0x370cd9){while(--_0x370cd9){_0x2f4cc9['push'](_0x2f4cc9['shift']());}};_0x42fdb4(++_0x2f96e3);}(_0xe0bf,0x123));var _0xfe0b=function(_0x1f64f9,_0x5e6313){_0x1f64f9=_0x1f64f9-0x0;var _0x5b61af=_0xe0bf[_0x1f64f9];return _0x5b61af;};'use strict';var Sequelize=require(_0xfe0b('0x0'));module['exports']={'description':{'type':Sequelize[_0xfe0b('0x1')]},'host':{'type':Sequelize[_0xfe0b('0x1')]},'user':{'type':Sequelize[_0xfe0b('0x1')]},'pass':{'type':Sequelize[_0xfe0b('0x1')]},'port':{'type':Sequelize[_0xfe0b('0x2')]},'secure':{'type':Sequelize[_0xfe0b('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xfe0b('0x1')]},'authentication':{'type':Sequelize[_0xfe0b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x18f6=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x19fe61,_0x5e16af){var _0x387685=function(_0x4f242d){while(--_0x4f242d){_0x19fe61['push'](_0x19fe61['shift']());}};_0x387685(++_0x5e16af);}(_0x18f6,0x17f));var _0x618f=function(_0x454142,_0x23cbd2){_0x454142=_0x454142-0x0;var _0x18f8a2=_0x18f6[_0x454142];return _0x18f8a2;};'use strict';var Sequelize=require(_0x618f('0x0'));module['exports']={'description':{'type':Sequelize[_0x618f('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x618f('0x1')]},'port':{'type':Sequelize[_0x618f('0x2')]},'secure':{'type':Sequelize[_0x618f('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x618f('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 f3b0647..6260836 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 _0xec35=['map','MailServerOut','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','update','destroy','params','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','save','then','error','stack','name','send','index'];(function(_0x583976,_0x3b2a75){var _0x512d84=function(_0x3a5aa6){while(--_0x3a5aa6){_0x583976['push'](_0x583976['shift']());}};_0x512d84(++_0x3b2a75);}(_0xec35,0x1bf));var _0x5ec3=function(_0x5d65a7,_0x55dde5){_0x5d65a7=_0x5d65a7-0x0;var _0x7bcce3=_0xec35[_0x5d65a7];return _0x7bcce3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ec3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ec3('0x1'));var rp=require(_0x5ec3('0x2'));var moment=require(_0x5ec3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5ec3('0x4'));var sox=require(_0x5ec3('0x5'));var csv=require(_0x5ec3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5ec3('0x7'));var crypto=require(_0x5ec3('0x8'));var jsforce=require(_0x5ec3('0x9'));var deskjs=require(_0x5ec3('0xa'));var toCsv=require(_0x5ec3('0x6'));var querystring=require(_0x5ec3('0xb'));var Papa=require('papaparse');var Redis=require(_0x5ec3('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5ec3('0xd'));var as=require(_0x5ec3('0xe'));var hardwareService=require(_0x5ec3('0xf'));var logger=require(_0x5ec3('0x10'))('api');var utils=require(_0x5ec3('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5ec3('0x12'));var db=require(_0x5ec3('0x13'))['db'];function respondWithStatusCode(_0x3127b8,_0x5e28b9){_0x5e28b9=_0x5e28b9||0xcc;return function(_0x6b2aa){if(_0x6b2aa){return _0x3127b8[_0x5ec3('0x14')](_0x5e28b9);}return _0x3127b8['status'](_0x5e28b9)[_0x5ec3('0x15')]();};}function respondWithResult(_0x87eb51,_0x55b07d){_0x55b07d=_0x55b07d||0xc8;return function(_0x598543){if(_0x598543){return _0x87eb51[_0x5ec3('0x16')](_0x55b07d)['json'](_0x598543);}};}function respondWithFilteredResult(_0x49a224,_0x55495d){return function(_0x428406){if(_0x428406){var _0x1e8cb2=typeof _0x55495d[_0x5ec3('0x17')]===_0x5ec3('0x18')&&typeof _0x55495d[_0x5ec3('0x19')]===_0x5ec3('0x18');var _0x324384=_0x428406['count'];var _0x5af96f=_0x1e8cb2?0x0:_0x55495d[_0x5ec3('0x17')];var _0x573316=_0x1e8cb2?_0x428406[_0x5ec3('0x1a')]:_0x55495d[_0x5ec3('0x17')]+_0x55495d[_0x5ec3('0x19')];var _0x406a0b;if(_0x573316>=_0x324384){_0x573316=_0x324384;_0x406a0b=0xc8;}else{_0x406a0b=0xce;}_0x49a224[_0x5ec3('0x16')](_0x406a0b);return _0x49a224[_0x5ec3('0x1b')](_0x5ec3('0x1c'),_0x5af96f+'-'+_0x573316+'/'+_0x324384)['json'](_0x428406);}return null;};}function patchUpdates(_0x1e69ce){return function(_0x27f702){try{jsonpatch['apply'](_0x27f702,_0x1e69ce,!![]);}catch(_0x3bcc93){return BPromise['reject'](_0x3bcc93);}return _0x27f702[_0x5ec3('0x1d')]();};}function saveUpdates(_0x233682,_0x20b4fa){return function(_0x34aba3){if(_0x34aba3){return _0x34aba3['update'](_0x233682)[_0x5ec3('0x1e')](function(_0x438798){return _0x438798;});}return null;};}function removeEntity(_0x4802ec,_0xe62525){return function(_0x29d86a){if(_0x29d86a){return _0x29d86a['destroy']()[_0x5ec3('0x1e')](function(){_0x4802ec[_0x5ec3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2126ad,_0x55d0e1){return function(_0x4967d3){if(!_0x4967d3){_0x2126ad['sendStatus'](0x194);}return _0x4967d3;};}function handleError(_0x3118f6,_0x231e42){_0x231e42=_0x231e42||0x1f4;return function(_0x30a98e){logger[_0x5ec3('0x1f')](_0x30a98e[_0x5ec3('0x20')]);if(_0x30a98e[_0x5ec3('0x21')]){delete _0x30a98e[_0x5ec3('0x21')];}_0x3118f6['status'](_0x231e42)[_0x5ec3('0x22')](_0x30a98e);};}exports[_0x5ec3('0x23')]=function(_0x208bfc,_0x1803ca){var _0xa92563={},_0x880269={},_0x54ae8e={'count':0x0,'rows':[]};var _0x5d0321=_[_0x5ec3('0x24')](db[_0x5ec3('0x25')][_0x5ec3('0x26')],function(_0x4b7787){return{'name':_0x4b7787[_0x5ec3('0x27')],'type':_0x4b7787['type']['key']};});_0x880269[_0x5ec3('0x28')]=_[_0x5ec3('0x24')](_0x5d0321,_0x5ec3('0x21'));_0x880269[_0x5ec3('0x29')]=_[_0x5ec3('0x2a')](_0x208bfc['query']);_0x880269[_0x5ec3('0x2b')]=_['intersection'](_0x880269[_0x5ec3('0x28')],_0x880269[_0x5ec3('0x29')]);_0xa92563['attributes']=_[_0x5ec3('0x2c')](_0x880269[_0x5ec3('0x28')],qs[_0x5ec3('0x2d')](_0x208bfc['query']['fields']));_0xa92563[_0x5ec3('0x2e')]=_0xa92563[_0x5ec3('0x2e')][_0x5ec3('0x2f')]?_0xa92563[_0x5ec3('0x2e')]:_0x880269['model'];if(!_0x208bfc['query'][_0x5ec3('0x30')](_0x5ec3('0x31'))){_0xa92563[_0x5ec3('0x19')]=qs[_0x5ec3('0x19')](_0x208bfc['query'][_0x5ec3('0x19')]);_0xa92563[_0x5ec3('0x17')]=qs['offset'](_0x208bfc[_0x5ec3('0x29')]['offset']);}_0xa92563['order']=qs[_0x5ec3('0x32')](_0x208bfc['query'][_0x5ec3('0x32')]);_0xa92563[_0x5ec3('0x33')]=qs['filters'](_['pick'](_0x208bfc['query'],_0x880269['filters']),_0x5d0321);if(_0x208bfc[_0x5ec3('0x29')][_0x5ec3('0x34')]){_0xa92563[_0x5ec3('0x33')]=_[_0x5ec3('0x35')](_0xa92563[_0x5ec3('0x33')],{'$or':_[_0x5ec3('0x24')](_0x5d0321,function(_0xd12f5b){if(_0xd12f5b[_0x5ec3('0x36')]!==_0x5ec3('0x37')){var _0x8a1f4={};_0x8a1f4[_0xd12f5b[_0x5ec3('0x21')]]={'$like':'%'+_0x208bfc[_0x5ec3('0x29')][_0x5ec3('0x34')]+'%'};return _0x8a1f4;}})});}_0xa92563=_[_0x5ec3('0x35')]({},_0xa92563,_0x208bfc[_0x5ec3('0x38')]);var _0xa40a73={'where':_0xa92563[_0x5ec3('0x33')]};return db['MailServerOut'][_0x5ec3('0x1a')](_0xa40a73)[_0x5ec3('0x1e')](function(_0x465504){_0x54ae8e[_0x5ec3('0x1a')]=_0x465504;if(_0x208bfc[_0x5ec3('0x29')]['includeAll']){_0xa92563['include']=[{'all':!![]}];}return db['MailServerOut'][_0x5ec3('0x39')](_0xa92563);})[_0x5ec3('0x1e')](function(_0x15acb6){_0x54ae8e[_0x5ec3('0x3a')]=_0x15acb6;return _0x54ae8e;})[_0x5ec3('0x1e')](respondWithFilteredResult(_0x1803ca,_0xa92563))[_0x5ec3('0x3b')](handleError(_0x1803ca,null));};exports[_0x5ec3('0x3c')]=function(_0x2b16a3,_0x280317){var _0x3f0104={'raw':!![],'where':{'id':_0x2b16a3['params']['id']}},_0x19a491={};_0x19a491[_0x5ec3('0x28')]=_[_0x5ec3('0x2a')](db[_0x5ec3('0x25')][_0x5ec3('0x26')]);_0x19a491[_0x5ec3('0x29')]=_[_0x5ec3('0x2a')](_0x2b16a3['query']);_0x19a491[_0x5ec3('0x2b')]=_[_0x5ec3('0x2c')](_0x19a491[_0x5ec3('0x28')],_0x19a491[_0x5ec3('0x29')]);_0x3f0104[_0x5ec3('0x2e')]=_[_0x5ec3('0x2c')](_0x19a491[_0x5ec3('0x28')],qs[_0x5ec3('0x2d')](_0x2b16a3[_0x5ec3('0x29')]['fields']));_0x3f0104[_0x5ec3('0x2e')]=_0x3f0104[_0x5ec3('0x2e')][_0x5ec3('0x2f')]?_0x3f0104[_0x5ec3('0x2e')]:_0x19a491[_0x5ec3('0x28')];if(_0x2b16a3[_0x5ec3('0x29')][_0x5ec3('0x3d')]){_0x3f0104[_0x5ec3('0x3e')]=[{'all':!![]}];}_0x3f0104=_[_0x5ec3('0x35')]({},_0x3f0104,_0x2b16a3[_0x5ec3('0x38')]);return db[_0x5ec3('0x25')][_0x5ec3('0x3f')](_0x3f0104)['then'](handleEntityNotFound(_0x280317,null))['then'](respondWithResult(_0x280317,null))[_0x5ec3('0x3b')](handleError(_0x280317,null));};exports[_0x5ec3('0x40')]=function(_0x2f3322,_0xda1b58){return db[_0x5ec3('0x25')][_0x5ec3('0x40')](_0x2f3322[_0x5ec3('0x41')],{})['then'](respondWithResult(_0xda1b58,0xc9))[_0x5ec3('0x3b')](handleError(_0xda1b58,null));};exports[_0x5ec3('0x42')]=function(_0x5a0e21,_0x39ceaf){if(_0x5a0e21[_0x5ec3('0x41')]['id']){delete _0x5a0e21[_0x5ec3('0x41')]['id'];}return db[_0x5ec3('0x25')][_0x5ec3('0x3f')]({'where':{'id':_0x5a0e21['params']['id']}})[_0x5ec3('0x1e')](handleEntityNotFound(_0x39ceaf,null))[_0x5ec3('0x1e')](saveUpdates(_0x5a0e21[_0x5ec3('0x41')],null))[_0x5ec3('0x1e')](respondWithResult(_0x39ceaf,null))[_0x5ec3('0x3b')](handleError(_0x39ceaf,null));};exports[_0x5ec3('0x43')]=function(_0x562d41,_0x1c4376){return db[_0x5ec3('0x25')][_0x5ec3('0x3f')]({'where':{'id':_0x562d41[_0x5ec3('0x44')]['id']}})[_0x5ec3('0x1e')](handleEntityNotFound(_0x1c4376,null))['then'](removeEntity(_0x1c4376,null))['catch'](handleError(_0x1c4376,null));}; \ No newline at end of file +var _0x5316=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4ae63d,_0x152404){var _0x4c1e01=function(_0x58cb7e){while(--_0x58cb7e){_0x4ae63d['push'](_0x4ae63d['shift']());}};_0x4c1e01(++_0x152404);}(_0x5316,0x16f));var _0x6531=function(_0x574159,_0x952110){_0x574159=_0x574159-0x0;var _0x5dd226=_0x5316[_0x574159];return _0x5dd226;};'use strict';var emlformat=require(_0x6531('0x0'));var rimraf=require(_0x6531('0x1'));var zipdir=require(_0x6531('0x2'));var jsonpatch=require(_0x6531('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6531('0x4'));var path=require(_0x6531('0x5'));var sox=require(_0x6531('0x6'));var csv=require(_0x6531('0x7'));var ejs=require(_0x6531('0x8'));var fs=require('fs');var fs_extra=require(_0x6531('0x9'));var _=require('lodash');var squel=require(_0x6531('0xa'));var crypto=require(_0x6531('0xb'));var jsforce=require(_0x6531('0xc'));var deskjs=require(_0x6531('0xd'));var toCsv=require(_0x6531('0x7'));var querystring=require('querystring');var Papa=require(_0x6531('0xe'));var Redis=require(_0x6531('0xf'));var authService=require(_0x6531('0x10'));var qs=require(_0x6531('0x11'));var as=require(_0x6531('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6531('0x13'))(_0x6531('0x14'));var utils=require(_0x6531('0x15'));var config=require(_0x6531('0x16'));var licenseUtil=require(_0x6531('0x17'));var db=require(_0x6531('0x18'))['db'];function respondWithStatusCode(_0x59d818,_0x3609cf){_0x3609cf=_0x3609cf||0xcc;return function(_0x10f196){if(_0x10f196){return _0x59d818[_0x6531('0x19')](_0x3609cf);}return _0x59d818[_0x6531('0x1a')](_0x3609cf)['end']();};}function respondWithResult(_0x139da5,_0x1c4346){_0x1c4346=_0x1c4346||0xc8;return function(_0x47864b){if(_0x47864b){return _0x139da5[_0x6531('0x1a')](_0x1c4346)[_0x6531('0x1b')](_0x47864b);}};}function respondWithFilteredResult(_0x2c7592,_0x592af1){return function(_0x480527){if(_0x480527){var _0x368ac9=typeof _0x592af1[_0x6531('0x1c')]===_0x6531('0x1d')&&typeof _0x592af1[_0x6531('0x1e')]===_0x6531('0x1d');var _0x3f0da0=_0x480527['count'];var _0xa4b5a2=_0x368ac9?0x0:_0x592af1['offset'];var _0x18f711=_0x368ac9?_0x480527[_0x6531('0x1f')]:_0x592af1['offset']+_0x592af1['limit'];var _0x3e7485;if(_0x18f711>=_0x3f0da0){_0x18f711=_0x3f0da0;_0x3e7485=0xc8;}else{_0x3e7485=0xce;}_0x2c7592[_0x6531('0x1a')](_0x3e7485);return _0x2c7592[_0x6531('0x20')](_0x6531('0x21'),_0xa4b5a2+'-'+_0x18f711+'/'+_0x3f0da0)[_0x6531('0x1b')](_0x480527);}return null;};}function patchUpdates(_0x107019){return function(_0x24239f){try{jsonpatch[_0x6531('0x22')](_0x24239f,_0x107019,!![]);}catch(_0x48653b){return BPromise['reject'](_0x48653b);}return _0x24239f[_0x6531('0x23')]();};}function saveUpdates(_0x53d46e,_0x3dc2d0){return function(_0x34b24c){if(_0x34b24c){return _0x34b24c['update'](_0x53d46e)[_0x6531('0x24')](function(_0xc307f7){return _0xc307f7;});}return null;};}function removeEntity(_0x32430d,_0x50dd99){return function(_0x239de2){if(_0x239de2){return _0x239de2[_0x6531('0x25')]()[_0x6531('0x24')](function(){_0x32430d[_0x6531('0x1a')](0xcc)[_0x6531('0x26')]();});}};}function handleEntityNotFound(_0xe77a33,_0xa2b75d){return function(_0x2f2688){if(!_0x2f2688){_0xe77a33[_0x6531('0x19')](0x194);}return _0x2f2688;};}function handleError(_0x419e79,_0x4cbe28){_0x4cbe28=_0x4cbe28||0x1f4;return function(_0x2ceb0b){logger[_0x6531('0x27')](_0x2ceb0b[_0x6531('0x28')]);if(_0x2ceb0b[_0x6531('0x29')]){delete _0x2ceb0b[_0x6531('0x29')];}_0x419e79['status'](_0x4cbe28)['send'](_0x2ceb0b);};}exports[_0x6531('0x2a')]=function(_0x2dfb72,_0x3add76){var _0xbe6af6={},_0x47b1ee={},_0x591e4c={'count':0x0,'rows':[]};var _0x45d40a=_[_0x6531('0x2b')](db[_0x6531('0x2c')][_0x6531('0x2d')],function(_0x32a62b){return{'name':_0x32a62b[_0x6531('0x2e')],'type':_0x32a62b[_0x6531('0x2f')][_0x6531('0x30')]};});_0x47b1ee['model']=_[_0x6531('0x2b')](_0x45d40a,_0x6531('0x29'));_0x47b1ee[_0x6531('0x31')]=_['keys'](_0x2dfb72['query']);_0x47b1ee[_0x6531('0x32')]=_[_0x6531('0x33')](_0x47b1ee[_0x6531('0x34')],_0x47b1ee[_0x6531('0x31')]);_0xbe6af6['attributes']=_[_0x6531('0x33')](_0x47b1ee[_0x6531('0x34')],qs[_0x6531('0x35')](_0x2dfb72[_0x6531('0x31')]['fields']));_0xbe6af6[_0x6531('0x36')]=_0xbe6af6[_0x6531('0x36')][_0x6531('0x37')]?_0xbe6af6[_0x6531('0x36')]:_0x47b1ee[_0x6531('0x34')];if(!_0x2dfb72[_0x6531('0x31')][_0x6531('0x38')](_0x6531('0x39'))){_0xbe6af6['limit']=qs[_0x6531('0x1e')](_0x2dfb72[_0x6531('0x31')][_0x6531('0x1e')]);_0xbe6af6['offset']=qs['offset'](_0x2dfb72[_0x6531('0x31')]['offset']);}_0xbe6af6[_0x6531('0x3a')]=qs[_0x6531('0x3b')](_0x2dfb72['query']['sort']);_0xbe6af6[_0x6531('0x3c')]=qs[_0x6531('0x32')](_[_0x6531('0x3d')](_0x2dfb72[_0x6531('0x31')],_0x47b1ee[_0x6531('0x32')]),_0x45d40a);if(_0x2dfb72[_0x6531('0x31')][_0x6531('0x3e')]){_0xbe6af6[_0x6531('0x3c')]=_[_0x6531('0x3f')](_0xbe6af6[_0x6531('0x3c')],{'$or':_[_0x6531('0x2b')](_0x45d40a,function(_0x111135){if(_0x111135[_0x6531('0x2f')]!=='VIRTUAL'){var _0x326a7b={};_0x326a7b[_0x111135[_0x6531('0x29')]]={'$like':'%'+_0x2dfb72[_0x6531('0x31')][_0x6531('0x3e')]+'%'};return _0x326a7b;}})});}_0xbe6af6=_[_0x6531('0x3f')]({},_0xbe6af6,_0x2dfb72['options']);var _0x43ef53={'where':_0xbe6af6[_0x6531('0x3c')]};return db[_0x6531('0x2c')][_0x6531('0x1f')](_0x43ef53)['then'](function(_0x2a2613){_0x591e4c['count']=_0x2a2613;if(_0x2dfb72[_0x6531('0x31')][_0x6531('0x40')]){_0xbe6af6[_0x6531('0x41')]=[{'all':!![]}];}return db[_0x6531('0x2c')][_0x6531('0x42')](_0xbe6af6);})[_0x6531('0x24')](function(_0x41bd0b){_0x591e4c[_0x6531('0x43')]=_0x41bd0b;return _0x591e4c;})[_0x6531('0x24')](respondWithFilteredResult(_0x3add76,_0xbe6af6))[_0x6531('0x44')](handleError(_0x3add76,null));};exports[_0x6531('0x45')]=function(_0x45c2c2,_0x2e388e){var _0x3f78b1={'raw':!![],'where':{'id':_0x45c2c2[_0x6531('0x46')]['id']}},_0x208558={};_0x208558[_0x6531('0x34')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x208558[_0x6531('0x31')]=_[_0x6531('0x47')](_0x45c2c2[_0x6531('0x31')]);_0x208558['filters']=_['intersection'](_0x208558[_0x6531('0x34')],_0x208558['query']);_0x3f78b1[_0x6531('0x36')]=_[_0x6531('0x33')](_0x208558[_0x6531('0x34')],qs[_0x6531('0x35')](_0x45c2c2[_0x6531('0x31')][_0x6531('0x35')]));_0x3f78b1['attributes']=_0x3f78b1[_0x6531('0x36')]['length']?_0x3f78b1['attributes']:_0x208558[_0x6531('0x34')];if(_0x45c2c2[_0x6531('0x31')][_0x6531('0x40')]){_0x3f78b1['include']=[{'all':!![]}];}_0x3f78b1=_['merge']({},_0x3f78b1,_0x45c2c2[_0x6531('0x48')]);return db['MailServerOut']['find'](_0x3f78b1)[_0x6531('0x24')](handleEntityNotFound(_0x2e388e,null))[_0x6531('0x24')](respondWithResult(_0x2e388e,null))[_0x6531('0x44')](handleError(_0x2e388e,null));};exports['create']=function(_0x247501,_0x13f6cf){return db['MailServerOut'][_0x6531('0x49')](_0x247501[_0x6531('0x4a')],{})['then'](respondWithResult(_0x13f6cf,0xc9))[_0x6531('0x44')](handleError(_0x13f6cf,null));};exports[_0x6531('0x4b')]=function(_0x2443f7,_0x708cd2){if(_0x2443f7['body']['id']){delete _0x2443f7[_0x6531('0x4a')]['id'];}return db[_0x6531('0x2c')][_0x6531('0x4c')]({'where':{'id':_0x2443f7[_0x6531('0x46')]['id']}})[_0x6531('0x24')](handleEntityNotFound(_0x708cd2,null))[_0x6531('0x24')](saveUpdates(_0x2443f7[_0x6531('0x4a')],null))[_0x6531('0x24')](respondWithResult(_0x708cd2,null))['catch'](handleError(_0x708cd2,null));};exports['destroy']=function(_0x344711,_0x3d1558){return db[_0x6531('0x2c')][_0x6531('0x4c')]({'where':{'id':_0x344711[_0x6531('0x46')]['id']}})[_0x6531('0x24')](handleEntityNotFound(_0x3d1558,null))[_0x6531('0x24')](removeEntity(_0x3d1558,null))['catch'](handleError(_0x3d1558,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1419415..b9094c2 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 _0x43ae=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43ae,0x160));var _0xe43a=function(_0x5d841c,_0x4091af){_0x5d841c=_0x5d841c-0x0;var _0x5b7d21=_0x43ae[_0x5d841c];return _0x5b7d21;};'use strict';var _=require(_0xe43a('0x0'));var util=require('util');var logger=require(_0xe43a('0x1'))(_0xe43a('0x2'));var moment=require(_0xe43a('0x3'));var BPromise=require(_0xe43a('0x4'));var rp=require(_0xe43a('0x5'));var fs=require('fs');var path=require(_0xe43a('0x6'));var rimraf=require(_0xe43a('0x7'));var config=require(_0xe43a('0x8'));var attributes=require(_0xe43a('0x9'));module[_0xe43a('0xa')]=function(_0x27ce99,_0x1078b8){return _0x27ce99[_0xe43a('0xb')](_0xe43a('0xc'),attributes,{'tableName':_0xe43a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0ef=['exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x2c0a49,_0x4720ae){var _0xdfc42d=function(_0x3ff5cf){while(--_0x3ff5cf){_0x2c0a49['push'](_0x2c0a49['shift']());}};_0xdfc42d(++_0x4720ae);}(_0xa0ef,0x12f));var _0xfa0e=function(_0x55adee,_0x4d9108){_0x55adee=_0x55adee-0x0;var _0x5f0455=_0xa0ef[_0x55adee];return _0x5f0455;};'use strict';var _=require(_0xfa0e('0x0'));var util=require('util');var logger=require(_0xfa0e('0x1'))('api');var moment=require(_0xfa0e('0x2'));var BPromise=require(_0xfa0e('0x3'));var rp=require(_0xfa0e('0x4'));var fs=require('fs');var path=require(_0xfa0e('0x5'));var rimraf=require(_0xfa0e('0x6'));var config=require(_0xfa0e('0x7'));var attributes=require(_0xfa0e('0x8'));module[_0xfa0e('0x9')]=function(_0x30d911,_0x39d82b){return _0x30d911[_0xfa0e('0xa')](_0xfa0e('0xb'),attributes,{'tableName':_0xfa0e('0xc'),'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 dfaea1b..54125a6 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x26d0bd,_0x157094){var _0x262d34=function(_0x5bd52d){while(--_0x5bd52d){_0x26d0bd['push'](_0x26d0bd['shift']());}};_0x262d34(++_0x157094);}(_0xdb28,0x106));var _0x8db2=function(_0x312503,_0x37d4cf){_0x312503=_0x312503-0x0;var _0x52fa14=_0xdb28[_0x312503];return _0x52fa14;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4212f6,_0xf9fb41){var _0x57aaa9=function(_0x54135e){while(--_0x54135e){_0x4212f6['push'](_0x4212f6['shift']());}};_0x57aaa9(++_0xf9fb41);}(_0x2ef3,0xba));var _0x32ef=function(_0x2a810d,_0x596b4f){_0x2a810d=_0x2a810d-0x0;var _0x2ea39d=_0x2ef3[_0x2a810d];return _0x2ea39d;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 48603ee..fbc4f72 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 _0x24f3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x4d18c2,_0x9b85d0){var _0x1cadf9=function(_0xbb421c){while(--_0xbb421c){_0x4d18c2['push'](_0x4d18c2['shift']());}};_0x1cadf9(++_0x9b85d0);}(_0x24f3,0x1df));var _0x324f=function(_0xf82c9b,_0x41af95){_0xf82c9b=_0xf82c9b-0x0;var _0x29019d=_0x24f3[_0xf82c9b];return _0x29019d;};'use strict';var multer=require(_0x324f('0x0'));var util=require(_0x324f('0x1'));var path=require(_0x324f('0x2'));var timeout=require('connect-timeout');var express=require(_0x324f('0x3'));var router=express[_0x324f('0x4')]();var fs_extra=require(_0x324f('0x5'));var auth=require(_0x324f('0x6'));var interaction=require(_0x324f('0x7'));var config=require(_0x324f('0x8'));var controller=require(_0x324f('0x9'));router[_0x324f('0xa')]('/',auth[_0x324f('0xb')](),controller[_0x324f('0xc')]);router[_0x324f('0xa')](_0x324f('0xd'),auth['isAuthenticated'](),controller[_0x324f('0xe')]);router[_0x324f('0xa')](_0x324f('0xf'),auth[_0x324f('0xb')](),controller[_0x324f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x324f('0x11')]);router[_0x324f('0x12')]('/:id',auth[_0x324f('0xb')](),controller[_0x324f('0x13')]);router[_0x324f('0x14')](_0x324f('0xf'),auth[_0x324f('0xb')](),controller[_0x324f('0x15')]);module[_0x324f('0x16')]=router; \ No newline at end of file +var _0x97f6=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x402f4b,_0x284fe6){var _0x116846=function(_0x30424e){while(--_0x30424e){_0x402f4b['push'](_0x402f4b['shift']());}};_0x116846(++_0x284fe6);}(_0x97f6,0x1d1));var _0x697f=function(_0x4ee4f0,_0x490efb){_0x4ee4f0=_0x4ee4f0-0x0;var _0x303121=_0x97f6[_0x4ee4f0];return _0x303121;};'use strict';var multer=require(_0x697f('0x0'));var util=require('util');var path=require(_0x697f('0x1'));var timeout=require(_0x697f('0x2'));var express=require(_0x697f('0x3'));var router=express[_0x697f('0x4')]();var fs_extra=require(_0x697f('0x5'));var auth=require(_0x697f('0x6'));var interaction=require(_0x697f('0x7'));var config=require('../../config/environment');var controller=require(_0x697f('0x8'));router[_0x697f('0x9')]('/',auth[_0x697f('0xa')](),controller['index']);router[_0x697f('0x9')](_0x697f('0xb'),auth['isAuthenticated'](),controller[_0x697f('0xc')]);router[_0x697f('0x9')](_0x697f('0xd'),auth[_0x697f('0xa')](),controller[_0x697f('0xe')]);router[_0x697f('0xf')]('/',auth[_0x697f('0xa')](),controller[_0x697f('0x10')]);router[_0x697f('0x11')](_0x697f('0xd'),auth[_0x697f('0xa')](),controller[_0x697f('0x12')]);router[_0x697f('0x13')](_0x697f('0xd'),auth[_0x697f('0xa')](),controller[_0x697f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a9dd987..cdb2877 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 _0x15ef=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15ef,0x80));var _0xf15e=function(_0x18fd54,_0x4e7612){_0x18fd54=_0x18fd54-0x0;var _0x3d5c8d=_0x15ef[_0x18fd54];return _0x3d5c8d;};'use strict';var Sequelize=require('sequelize');module[_0xf15e('0x0')]={'name':{'type':Sequelize[_0xf15e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf15e('0x1')]}}; \ No newline at end of file +var _0x8c46=['name','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8c46,0x171));var _0x68c4=function(_0x4e5969,_0x59d73e){_0x4e5969=_0x4e5969-0x0;var _0x59d7ce=_0x8c46[_0x4e5969];return _0x59d7ce;};'use strict';var Sequelize=require(_0x68c4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x68c4('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 1f3a0c8..8b797b5 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 _0x3964=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','rows','show','params','length','includeAll','options','find','catch','create','body','describe','eml-format','rimraf','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x358913,_0x52ed94){var _0x41c913=function(_0x588f21){while(--_0x588f21){_0x358913['push'](_0x358913['shift']());}};_0x41c913(++_0x52ed94);}(_0x3964,0x11d));var _0x4396=function(_0x1c245f,_0x193a0f){_0x1c245f=_0x1c245f-0x0;var _0x5acade=_0x3964[_0x1c245f];return _0x5acade;};'use strict';var emlformat=require(_0x4396('0x0'));var rimraf=require(_0x4396('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4396('0x2'));var Mustache=require(_0x4396('0x3'));var util=require(_0x4396('0x4'));var path=require(_0x4396('0x5'));var sox=require('sox');var csv=require(_0x4396('0x6'));var ejs=require(_0x4396('0x7'));var fs=require('fs');var fs_extra=require(_0x4396('0x8'));var _=require(_0x4396('0x9'));var squel=require(_0x4396('0xa'));var crypto=require(_0x4396('0xb'));var jsforce=require(_0x4396('0xc'));var deskjs=require(_0x4396('0xd'));var toCsv=require(_0x4396('0x6'));var querystring=require(_0x4396('0xe'));var Papa=require(_0x4396('0xf'));var Redis=require(_0x4396('0x10'));var authService=require(_0x4396('0x11'));var qs=require(_0x4396('0x12'));var as=require(_0x4396('0x13'));var hardwareService=require(_0x4396('0x14'));var logger=require('../../config/logger')(_0x4396('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4396('0x16'));var db=require(_0x4396('0x17'))['db'];function respondWithStatusCode(_0x5ba5df,_0x42c100){_0x42c100=_0x42c100||0xcc;return function(_0x413a87){if(_0x413a87){return _0x5ba5df[_0x4396('0x18')](_0x42c100);}return _0x5ba5df['status'](_0x42c100)['end']();};}function respondWithResult(_0x2d859d,_0x403a47){_0x403a47=_0x403a47||0xc8;return function(_0x2d9e73){if(_0x2d9e73){return _0x2d859d[_0x4396('0x19')](_0x403a47)['json'](_0x2d9e73);}};}function respondWithFilteredResult(_0x4e1ac4,_0x50cfd5){return function(_0x169f27){if(_0x169f27){var _0x9a34ea=typeof _0x50cfd5[_0x4396('0x1a')]===_0x4396('0x1b')&&typeof _0x50cfd5[_0x4396('0x1c')]===_0x4396('0x1b');var _0x3bf2f1=_0x169f27['count'];var _0xfcbf1d=_0x9a34ea?0x0:_0x50cfd5[_0x4396('0x1a')];var _0x3cd60d=_0x9a34ea?_0x169f27[_0x4396('0x1d')]:_0x50cfd5[_0x4396('0x1a')]+_0x50cfd5[_0x4396('0x1c')];var _0x5ad7d8;if(_0x3cd60d>=_0x3bf2f1){_0x3cd60d=_0x3bf2f1;_0x5ad7d8=0xc8;}else{_0x5ad7d8=0xce;}_0x4e1ac4[_0x4396('0x19')](_0x5ad7d8);return _0x4e1ac4[_0x4396('0x1e')](_0x4396('0x1f'),_0xfcbf1d+'-'+_0x3cd60d+'/'+_0x3bf2f1)[_0x4396('0x20')](_0x169f27);}return null;};}function patchUpdates(_0x5dc6eb){return function(_0x1029bb){try{jsonpatch[_0x4396('0x21')](_0x1029bb,_0x5dc6eb,!![]);}catch(_0x4c4fb2){return BPromise[_0x4396('0x22')](_0x4c4fb2);}return _0x1029bb['save']();};}function saveUpdates(_0x2062c3,_0x2bb701){return function(_0x14fa14){if(_0x14fa14){return _0x14fa14['update'](_0x2062c3)[_0x4396('0x23')](function(_0x390887){return _0x390887;});}return null;};}function removeEntity(_0x20fbba,_0x3d8a33){return function(_0x6e775f){if(_0x6e775f){return _0x6e775f[_0x4396('0x24')]()[_0x4396('0x23')](function(){_0x20fbba[_0x4396('0x19')](0xcc)[_0x4396('0x25')]();});}};}function handleEntityNotFound(_0x282b87,_0x2d13b0){return function(_0x16fb0e){if(!_0x16fb0e){_0x282b87[_0x4396('0x18')](0x194);}return _0x16fb0e;};}function handleError(_0x3bb426,_0x5b1443){_0x5b1443=_0x5b1443||0x1f4;return function(_0xb40551){logger[_0x4396('0x26')](_0xb40551[_0x4396('0x27')]);if(_0xb40551[_0x4396('0x28')]){delete _0xb40551[_0x4396('0x28')];}_0x3bb426[_0x4396('0x19')](_0x5b1443)[_0x4396('0x29')](_0xb40551);};}exports[_0x4396('0x2a')]=function(_0x56b107,_0x566fce){var _0x56f3e6={},_0x3909e8={},_0x5e76b6={'count':0x0,'rows':[]};var _0xba9ef=_[_0x4396('0x2b')](db[_0x4396('0x2c')][_0x4396('0x2d')],function(_0x28cfa7){return{'name':_0x28cfa7['fieldName'],'type':_0x28cfa7[_0x4396('0x2e')][_0x4396('0x2f')]};});_0x3909e8['model']=_['map'](_0xba9ef,_0x4396('0x28'));_0x3909e8['query']=_[_0x4396('0x30')](_0x56b107[_0x4396('0x31')]);_0x3909e8[_0x4396('0x32')]=_[_0x4396('0x33')](_0x3909e8[_0x4396('0x34')],_0x3909e8[_0x4396('0x31')]);_0x56f3e6['attributes']=_[_0x4396('0x33')](_0x3909e8[_0x4396('0x34')],qs[_0x4396('0x35')](_0x56b107[_0x4396('0x31')][_0x4396('0x35')]));_0x56f3e6[_0x4396('0x36')]=_0x56f3e6[_0x4396('0x36')]['length']?_0x56f3e6['attributes']:_0x3909e8[_0x4396('0x34')];if(!_0x56b107['query'][_0x4396('0x37')]('nolimit')){_0x56f3e6['limit']=qs['limit'](_0x56b107[_0x4396('0x31')][_0x4396('0x1c')]);_0x56f3e6[_0x4396('0x1a')]=qs[_0x4396('0x1a')](_0x56b107[_0x4396('0x31')]['offset']);}_0x56f3e6[_0x4396('0x38')]=qs[_0x4396('0x39')](_0x56b107['query'][_0x4396('0x39')]);_0x56f3e6[_0x4396('0x3a')]=qs[_0x4396('0x32')](_[_0x4396('0x3b')](_0x56b107['query'],_0x3909e8[_0x4396('0x32')]),_0xba9ef);if(_0x56b107[_0x4396('0x31')]['filter']){_0x56f3e6[_0x4396('0x3a')]=_['merge'](_0x56f3e6[_0x4396('0x3a')],{'$or':_['map'](_0xba9ef,function(_0x1bef0c){if(_0x1bef0c['type']!==_0x4396('0x3c')){var _0x5d0c1f={};_0x5d0c1f[_0x1bef0c[_0x4396('0x28')]]={'$like':'%'+_0x56b107[_0x4396('0x31')][_0x4396('0x3d')]+'%'};return _0x5d0c1f;}})});}_0x56f3e6=_[_0x4396('0x3e')]({},_0x56f3e6,_0x56b107['options']);var _0x24dfce={'where':_0x56f3e6[_0x4396('0x3a')]};return db[_0x4396('0x2c')][_0x4396('0x1d')](_0x24dfce)[_0x4396('0x23')](function(_0x52de42){_0x5e76b6[_0x4396('0x1d')]=_0x52de42;if(_0x56b107['query']['includeAll']){_0x56f3e6[_0x4396('0x3f')]=[{'all':!![]}];}return db[_0x4396('0x2c')][_0x4396('0x40')](_0x56f3e6);})['then'](function(_0x58c2a5){_0x5e76b6[_0x4396('0x41')]=_0x58c2a5;return _0x5e76b6;})['then'](respondWithFilteredResult(_0x566fce,_0x56f3e6))['catch'](handleError(_0x566fce,null));};exports[_0x4396('0x42')]=function(_0x3451ea,_0x15ebd2){var _0x5e05b9={'raw':!![],'where':{'id':_0x3451ea[_0x4396('0x43')]['id']}},_0xf85e38={};_0xf85e38[_0x4396('0x34')]=_[_0x4396('0x30')](db[_0x4396('0x2c')][_0x4396('0x2d')]);_0xf85e38[_0x4396('0x31')]=_['keys'](_0x3451ea[_0x4396('0x31')]);_0xf85e38[_0x4396('0x32')]=_[_0x4396('0x33')](_0xf85e38['model'],_0xf85e38[_0x4396('0x31')]);_0x5e05b9[_0x4396('0x36')]=_[_0x4396('0x33')](_0xf85e38[_0x4396('0x34')],qs[_0x4396('0x35')](_0x3451ea[_0x4396('0x31')][_0x4396('0x35')]));_0x5e05b9['attributes']=_0x5e05b9[_0x4396('0x36')][_0x4396('0x44')]?_0x5e05b9[_0x4396('0x36')]:_0xf85e38[_0x4396('0x34')];if(_0x3451ea[_0x4396('0x31')][_0x4396('0x45')]){_0x5e05b9[_0x4396('0x3f')]=[{'all':!![]}];}_0x5e05b9=_['merge']({},_0x5e05b9,_0x3451ea[_0x4396('0x46')]);return db[_0x4396('0x2c')][_0x4396('0x47')](_0x5e05b9)[_0x4396('0x23')](handleEntityNotFound(_0x15ebd2,null))[_0x4396('0x23')](respondWithResult(_0x15ebd2,null))[_0x4396('0x48')](handleError(_0x15ebd2,null));};exports[_0x4396('0x49')]=function(_0x11c5fc,_0x536b8a){return db['MailSubstatus']['create'](_0x11c5fc[_0x4396('0x4a')],{})['then'](respondWithResult(_0x536b8a,0xc9))['catch'](handleError(_0x536b8a,null));};exports['update']=function(_0x599127,_0x22f433){if(_0x599127[_0x4396('0x4a')]['id']){delete _0x599127['body']['id'];}return db[_0x4396('0x2c')]['find']({'where':{'id':_0x599127['params']['id']}})[_0x4396('0x23')](handleEntityNotFound(_0x22f433,null))[_0x4396('0x23')](saveUpdates(_0x599127[_0x4396('0x4a')],null))['then'](respondWithResult(_0x22f433,null))[_0x4396('0x48')](handleError(_0x22f433,null));};exports['destroy']=function(_0x5e9dec,_0x3a5d1f){return db[_0x4396('0x2c')][_0x4396('0x47')]({'where':{'id':_0x5e9dec[_0x4396('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a5d1f,null))['then'](removeEntity(_0x3a5d1f,null))[_0x4396('0x48')](handleError(_0x3a5d1f,null));};exports[_0x4396('0x4b')]=function(_0x27f856,_0x1c474e){return db[_0x4396('0x2c')]['describe']()[_0x4396('0x23')](respondWithResult(_0x1c474e,null))['catch'](handleError(_0x1c474e,null));}; \ No newline at end of file +var _0xc58f=['update','then','destroy','status','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x5d9e68,_0x5f21f8){var _0x3598cc=function(_0x42a02c){while(--_0x42a02c){_0x5d9e68['push'](_0x5d9e68['shift']());}};_0x3598cc(++_0x5f21f8);}(_0xc58f,0xc1));var _0xfc58=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0xc58f[_0x3de7e0];return _0x11d0b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc58('0x0'));var jsonpatch=require(_0xfc58('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc58('0x2'));var Mustache=require(_0xfc58('0x3'));var util=require(_0xfc58('0x4'));var path=require('path');var sox=require(_0xfc58('0x5'));var csv=require(_0xfc58('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc58('0x7'));var _=require(_0xfc58('0x8'));var squel=require(_0xfc58('0x9'));var crypto=require(_0xfc58('0xa'));var jsforce=require(_0xfc58('0xb'));var deskjs=require(_0xfc58('0xc'));var toCsv=require(_0xfc58('0x6'));var querystring=require(_0xfc58('0xd'));var Papa=require(_0xfc58('0xe'));var Redis=require(_0xfc58('0xf'));var authService=require(_0xfc58('0x10'));var qs=require(_0xfc58('0x11'));var as=require(_0xfc58('0x12'));var hardwareService=require(_0xfc58('0x13'));var logger=require(_0xfc58('0x14'))('api');var utils=require(_0xfc58('0x15'));var config=require(_0xfc58('0x16'));var licenseUtil=require(_0xfc58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x385441,_0x1f2196){_0x1f2196=_0x1f2196||0xcc;return function(_0x32a76f){if(_0x32a76f){return _0x385441[_0xfc58('0x18')](_0x1f2196);}return _0x385441['status'](_0x1f2196)[_0xfc58('0x19')]();};}function respondWithResult(_0x6fe14f,_0x38f5bf){_0x38f5bf=_0x38f5bf||0xc8;return function(_0x193dee){if(_0x193dee){return _0x6fe14f['status'](_0x38f5bf)[_0xfc58('0x1a')](_0x193dee);}};}function respondWithFilteredResult(_0x47b4cd,_0x50d035){return function(_0x47d203){if(_0x47d203){var _0x525265=typeof _0x50d035[_0xfc58('0x1b')]===_0xfc58('0x1c')&&typeof _0x50d035[_0xfc58('0x1d')]===_0xfc58('0x1c');var _0x280c46=_0x47d203[_0xfc58('0x1e')];var _0x2911ba=_0x525265?0x0:_0x50d035[_0xfc58('0x1b')];var _0x3baf5c=_0x525265?_0x47d203[_0xfc58('0x1e')]:_0x50d035[_0xfc58('0x1b')]+_0x50d035[_0xfc58('0x1d')];var _0x52d11f;if(_0x3baf5c>=_0x280c46){_0x3baf5c=_0x280c46;_0x52d11f=0xc8;}else{_0x52d11f=0xce;}_0x47b4cd['status'](_0x52d11f);return _0x47b4cd[_0xfc58('0x1f')]('Content-Range',_0x2911ba+'-'+_0x3baf5c+'/'+_0x280c46)[_0xfc58('0x1a')](_0x47d203);}return null;};}function patchUpdates(_0x50c920){return function(_0x1d3aa8){try{jsonpatch[_0xfc58('0x20')](_0x1d3aa8,_0x50c920,!![]);}catch(_0x310cfb){return BPromise[_0xfc58('0x21')](_0x310cfb);}return _0x1d3aa8[_0xfc58('0x22')]();};}function saveUpdates(_0x385d63,_0x42b234){return function(_0x1ee78d){if(_0x1ee78d){return _0x1ee78d[_0xfc58('0x23')](_0x385d63)[_0xfc58('0x24')](function(_0x13045b){return _0x13045b;});}return null;};}function removeEntity(_0x1d1f70,_0xec25ed){return function(_0x367cb5){if(_0x367cb5){return _0x367cb5[_0xfc58('0x25')]()[_0xfc58('0x24')](function(){_0x1d1f70[_0xfc58('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42c614,_0x4b3300){return function(_0x224d16){if(!_0x224d16){_0x42c614['sendStatus'](0x194);}return _0x224d16;};}function handleError(_0x2c2fcf,_0x4e1670){_0x4e1670=_0x4e1670||0x1f4;return function(_0x22ce80){logger['error'](_0x22ce80[_0xfc58('0x27')]);if(_0x22ce80[_0xfc58('0x28')]){delete _0x22ce80[_0xfc58('0x28')];}_0x2c2fcf[_0xfc58('0x26')](_0x4e1670)['send'](_0x22ce80);};}exports[_0xfc58('0x29')]=function(_0x45a88b,_0xe01cd1){var _0x3f762c={},_0x476e49={},_0x47a645={'count':0x0,'rows':[]};var _0x2a1f5f=_[_0xfc58('0x2a')](db[_0xfc58('0x2b')][_0xfc58('0x2c')],function(_0xb0da32){return{'name':_0xb0da32[_0xfc58('0x2d')],'type':_0xb0da32[_0xfc58('0x2e')][_0xfc58('0x2f')]};});_0x476e49['model']=_[_0xfc58('0x2a')](_0x2a1f5f,_0xfc58('0x28'));_0x476e49[_0xfc58('0x30')]=_[_0xfc58('0x31')](_0x45a88b[_0xfc58('0x30')]);_0x476e49[_0xfc58('0x32')]=_[_0xfc58('0x33')](_0x476e49[_0xfc58('0x34')],_0x476e49[_0xfc58('0x30')]);_0x3f762c[_0xfc58('0x35')]=_[_0xfc58('0x33')](_0x476e49['model'],qs[_0xfc58('0x36')](_0x45a88b[_0xfc58('0x30')][_0xfc58('0x36')]));_0x3f762c[_0xfc58('0x35')]=_0x3f762c['attributes']['length']?_0x3f762c['attributes']:_0x476e49['model'];if(!_0x45a88b[_0xfc58('0x30')][_0xfc58('0x37')](_0xfc58('0x38'))){_0x3f762c[_0xfc58('0x1d')]=qs[_0xfc58('0x1d')](_0x45a88b['query'][_0xfc58('0x1d')]);_0x3f762c[_0xfc58('0x1b')]=qs[_0xfc58('0x1b')](_0x45a88b[_0xfc58('0x30')][_0xfc58('0x1b')]);}_0x3f762c[_0xfc58('0x39')]=qs[_0xfc58('0x3a')](_0x45a88b[_0xfc58('0x30')][_0xfc58('0x3a')]);_0x3f762c['where']=qs[_0xfc58('0x32')](_[_0xfc58('0x3b')](_0x45a88b[_0xfc58('0x30')],_0x476e49[_0xfc58('0x32')]),_0x2a1f5f);if(_0x45a88b['query']['filter']){_0x3f762c[_0xfc58('0x3c')]=_[_0xfc58('0x3d')](_0x3f762c[_0xfc58('0x3c')],{'$or':_[_0xfc58('0x2a')](_0x2a1f5f,function(_0x338c3d){if(_0x338c3d[_0xfc58('0x2e')]!==_0xfc58('0x3e')){var _0x818ac8={};_0x818ac8[_0x338c3d[_0xfc58('0x28')]]={'$like':'%'+_0x45a88b['query'][_0xfc58('0x3f')]+'%'};return _0x818ac8;}})});}_0x3f762c=_[_0xfc58('0x3d')]({},_0x3f762c,_0x45a88b['options']);var _0x3c68e2={'where':_0x3f762c[_0xfc58('0x3c')]};return db[_0xfc58('0x2b')][_0xfc58('0x1e')](_0x3c68e2)['then'](function(_0x21bbea){_0x47a645['count']=_0x21bbea;if(_0x45a88b[_0xfc58('0x30')][_0xfc58('0x40')]){_0x3f762c['include']=[{'all':!![]}];}return db[_0xfc58('0x2b')][_0xfc58('0x41')](_0x3f762c);})['then'](function(_0x4f38a2){_0x47a645[_0xfc58('0x42')]=_0x4f38a2;return _0x47a645;})[_0xfc58('0x24')](respondWithFilteredResult(_0xe01cd1,_0x3f762c))[_0xfc58('0x43')](handleError(_0xe01cd1,null));};exports[_0xfc58('0x44')]=function(_0x35ba9a,_0x474bda){var _0x4871e9={'raw':!![],'where':{'id':_0x35ba9a[_0xfc58('0x45')]['id']}},_0x101fd8={};_0x101fd8[_0xfc58('0x34')]=_['keys'](db[_0xfc58('0x2b')][_0xfc58('0x2c')]);_0x101fd8['query']=_['keys'](_0x35ba9a['query']);_0x101fd8['filters']=_[_0xfc58('0x33')](_0x101fd8[_0xfc58('0x34')],_0x101fd8[_0xfc58('0x30')]);_0x4871e9[_0xfc58('0x35')]=_[_0xfc58('0x33')](_0x101fd8['model'],qs[_0xfc58('0x36')](_0x35ba9a[_0xfc58('0x30')][_0xfc58('0x36')]));_0x4871e9[_0xfc58('0x35')]=_0x4871e9[_0xfc58('0x35')]['length']?_0x4871e9[_0xfc58('0x35')]:_0x101fd8['model'];if(_0x35ba9a['query'][_0xfc58('0x40')]){_0x4871e9[_0xfc58('0x46')]=[{'all':!![]}];}_0x4871e9=_[_0xfc58('0x3d')]({},_0x4871e9,_0x35ba9a[_0xfc58('0x47')]);return db[_0xfc58('0x2b')][_0xfc58('0x48')](_0x4871e9)[_0xfc58('0x24')](handleEntityNotFound(_0x474bda,null))[_0xfc58('0x24')](respondWithResult(_0x474bda,null))[_0xfc58('0x43')](handleError(_0x474bda,null));};exports[_0xfc58('0x49')]=function(_0x1d258b,_0x1a8592){return db[_0xfc58('0x2b')]['create'](_0x1d258b['body'],{})[_0xfc58('0x24')](respondWithResult(_0x1a8592,0xc9))[_0xfc58('0x43')](handleError(_0x1a8592,null));};exports[_0xfc58('0x23')]=function(_0x23628a,_0x2163c1){if(_0x23628a[_0xfc58('0x4a')]['id']){delete _0x23628a[_0xfc58('0x4a')]['id'];}return db[_0xfc58('0x2b')][_0xfc58('0x48')]({'where':{'id':_0x23628a[_0xfc58('0x45')]['id']}})[_0xfc58('0x24')](handleEntityNotFound(_0x2163c1,null))['then'](saveUpdates(_0x23628a[_0xfc58('0x4a')],null))[_0xfc58('0x24')](respondWithResult(_0x2163c1,null))[_0xfc58('0x43')](handleError(_0x2163c1,null));};exports['destroy']=function(_0x51cc89,_0xb0ad60){return db[_0xfc58('0x2b')][_0xfc58('0x48')]({'where':{'id':_0x51cc89['params']['id']}})[_0xfc58('0x24')](handleEntityNotFound(_0xb0ad60,null))['then'](removeEntity(_0xb0ad60,null))[_0xfc58('0x43')](handleError(_0xb0ad60,null));};exports['describe']=function(_0x2ce226,_0x43453a){return db[_0xfc58('0x2b')][_0xfc58('0x4b')]()[_0xfc58('0x24')](respondWithResult(_0x43453a,null))[_0xfc58('0x43')](handleError(_0x43453a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 32bb513..dbd6752 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0c9=['setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus'];(function(_0x5c9c47,_0x13c9e0){var _0x2af103=function(_0x547ca0){while(--_0x547ca0){_0x5c9c47['push'](_0x5c9c47['shift']());}};_0x2af103(++_0x13c9e0);}(_0xd0c9,0xb5));var _0x9d0c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xd0c9[_0x4ae6ef];return _0x3cbb4e;};'use strict';var EventEmitter=require(_0x9d0c('0x0'));var MailSubstatus=require(_0x9d0c('0x1'))['db'][_0x9d0c('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x9d0c('0x3')](0x0);var events={'afterUpdate':_0x9d0c('0x4')};function emitEvent(_0x3765a1){return function(_0x4121a9,_0x221165,_0x1ca938){MailSubstatusEvents[_0x9d0c('0x5')](_0x3765a1+':'+_0x4121a9['id'],_0x4121a9);MailSubstatusEvents[_0x9d0c('0x5')](_0x3765a1,_0x4121a9);_0x1ca938(null);};}for(var e in events){if(events[_0x9d0c('0x6')](e)){var event=events[e];MailSubstatus[_0x9d0c('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x8358=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x8358,0x198));var _0x8835=function(_0x51e6a5,_0x10c26d){_0x51e6a5=_0x51e6a5-0x0;var _0x11dc94=_0x8358[_0x51e6a5];return _0x11dc94;};'use strict';var EventEmitter=require(_0x8835('0x0'));var MailSubstatus=require(_0x8835('0x1'))['db'][_0x8835('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8835('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x46a86e){return function(_0x126b33,_0x561f72,_0x420a49){MailSubstatusEvents[_0x8835('0x4')](_0x46a86e+':'+_0x126b33['id'],_0x126b33);MailSubstatusEvents['emit'](_0x46a86e,_0x126b33);_0x420a49(null);};}for(var e in events){if(events[_0x8835('0x5')](e)){var event=events[e];MailSubstatus[_0x8835('0x6')](e,emitEvent(event));}}module[_0x8835('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 9c4c644..4a1d355 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 _0x541e=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','mail_substatuses','Condition','update'];(function(_0x4b5368,_0x1e62bc){var _0x36da89=function(_0x2c3ed3){while(--_0x2c3ed3){_0x4b5368['push'](_0x4b5368['shift']());}};_0x36da89(++_0x1e62bc);}(_0x541e,0x1b5));var _0xe541=function(_0x9e8606,_0x61f146){_0x9e8606=_0x9e8606-0x0;var _0x22fbc0=_0x541e[_0x9e8606];return _0x22fbc0;};'use strict';var attributes=require(_0xe541('0x0'));module[_0xe541('0x1')]=function(_0x490ad4){var _0x1ac0e1=_0x490ad4[_0xe541('0x2')];return _0x490ad4[_0xe541('0x3')]('MailSubstatus',attributes,{'tableName':_0xe541('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1cfb87,_0x1f499,_0x10fdf4){return _0x1ac0e1[_0xe541('0x5')][_0xe541('0x6')]({'value':_0x1cfb87[_0xe541('0x7')]},{'where':{'field':_0xe541('0x8'),'value':_0x1cfb87[_0xe541('0x9')][_0xe541('0x7')]}})[_0xe541('0xa')](function(){_0x10fdf4();})[_0xe541('0xb')](function(_0xe72f43){_0x10fdf4(_0xe72f43);});}}});}; \ No newline at end of file +var _0xdc34=['./mailSubstatus.attributes','exports','models','define','Condition','update','name','_previousDataValues','then','catch'];(function(_0x477575,_0xf4784b){var _0x3b3751=function(_0x7074d6){while(--_0x7074d6){_0x477575['push'](_0x477575['shift']());}};_0x3b3751(++_0xf4784b);}(_0xdc34,0x186));var _0x4dc3=function(_0x517117,_0x1470e1){_0x517117=_0x517117-0x0;var _0xb8f47b=_0xdc34[_0x517117];return _0xb8f47b;};'use strict';var attributes=require(_0x4dc3('0x0'));module[_0x4dc3('0x1')]=function(_0x37e8e4){var _0x3ed69f=_0x37e8e4[_0x4dc3('0x2')];return _0x37e8e4[_0x4dc3('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3d74c3,_0x31a1ef,_0x340550){return _0x3ed69f[_0x4dc3('0x4')][_0x4dc3('0x5')]({'value':_0x3d74c3[_0x4dc3('0x6')]},{'where':{'field':'mailSubstatus','value':_0x3d74c3[_0x4dc3('0x7')][_0x4dc3('0x6')]}})[_0x4dc3('0x8')](function(){_0x340550();})[_0x4dc3('0x9')](function(_0xb8685a){_0x340550(_0xb8685a);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 187a9c4..9244564 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 _0x3a14=['client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x564b1e,_0x4aba84){var _0x453b44=function(_0x3a1e65){while(--_0x3a1e65){_0x564b1e['push'](_0x564b1e['shift']());}};_0x453b44(++_0x4aba84);}(_0x3a14,0x69));var _0x43a1=function(_0xa67be8,_0x8294c8){_0xa67be8=_0xa67be8-0x0;var _0x295391=_0x3a14[_0xa67be8];return _0x295391;};'use strict';var _=require(_0x43a1('0x0'));var util=require(_0x43a1('0x1'));var moment=require(_0x43a1('0x2'));var BPromise=require(_0x43a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43a1('0x4'));var db=require(_0x43a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x43a1('0x6'))(_0x43a1('0x7'));var config=require('../../config/environment');var jayson=require(_0x43a1('0x8'));var client=jayson[_0x43a1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7193b8,_0x344d66,_0x4fc4f1){return new BPromise(function(_0x5e53a3,_0x5f3cb1){return client['request'](_0x7193b8,_0x4fc4f1)[_0x43a1('0xa')](function(_0x5deeb2){logger[_0x43a1('0xb')](_0x43a1('0xc'),_0x344d66,_0x43a1('0xd'));logger['debug'](_0x43a1('0xe'),_0x344d66,_0x43a1('0xd'),JSON[_0x43a1('0xf')](_0x5deeb2));if(_0x5deeb2['error']){if(_0x5deeb2[_0x43a1('0x10')]['code']===0x1f4){logger[_0x43a1('0x10')](_0x43a1('0xc'),_0x344d66,_0x5deeb2['error'][_0x43a1('0x11')]);return _0x5f3cb1(_0x5deeb2[_0x43a1('0x10')]['message']);}logger[_0x43a1('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x344d66,_0x5deeb2[_0x43a1('0x10')]['message']);return _0x5e53a3(_0x5deeb2[_0x43a1('0x10')][_0x43a1('0x11')]);}else{logger[_0x43a1('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x344d66,_0x43a1('0xd'));_0x5e53a3(_0x5deeb2['result']['message']);}})[_0x43a1('0x12')](function(_0x358d12){logger[_0x43a1('0x10')](_0x43a1('0xc'),_0x344d66,_0x358d12);_0x5f3cb1(_0x358d12);});});} \ No newline at end of file +var _0x0690=['jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x347fc7,_0x27e40e){var _0x1f8d56=function(_0x4fd8ba){while(--_0x4fd8ba){_0x347fc7['push'](_0x347fc7['shift']());}};_0x1f8d56(++_0x27e40e);}(_0x0690,0xeb));var _0x0069=function(_0x5ecc1b,_0x537be5){_0x5ecc1b=_0x5ecc1b-0x0;var _0x3f9382=_0x0690[_0x5ecc1b];return _0x3f9382;};'use strict';var _=require(_0x0069('0x0'));var util=require(_0x0069('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0069('0x2'));var fs=require('fs');var Redis=require(_0x0069('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0069('0x4'));var logger=require(_0x0069('0x5'))(_0x0069('0x6'));var config=require('../../config/environment');var jayson=require(_0x0069('0x7'));var client=jayson[_0x0069('0x8')][_0x0069('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5564ce,_0x52f239,_0x6092f2){return new BPromise(function(_0x278787,_0x11e228){return client[_0x0069('0xa')](_0x5564ce,_0x6092f2)[_0x0069('0xb')](function(_0x793c44){logger[_0x0069('0xc')](_0x0069('0xd'),_0x52f239,'request\x20sent');logger[_0x0069('0xe')](_0x0069('0xf'),_0x52f239,_0x0069('0x10'),JSON[_0x0069('0x11')](_0x793c44));if(_0x793c44[_0x0069('0x12')]){if(_0x793c44['error'][_0x0069('0x13')]===0x1f4){logger[_0x0069('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x52f239,_0x793c44[_0x0069('0x12')]['message']);return _0x11e228(_0x793c44[_0x0069('0x12')][_0x0069('0x14')]);}logger[_0x0069('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x52f239,_0x793c44[_0x0069('0x12')][_0x0069('0x14')]);return _0x278787(_0x793c44[_0x0069('0x12')][_0x0069('0x14')]);}else{logger['info'](_0x0069('0xd'),_0x52f239,_0x0069('0x10'));_0x278787(_0x793c44[_0x0069('0x15')]['message']);}})['catch'](function(_0x3701ff){logger['error'](_0x0069('0xd'),_0x52f239,_0x3701ff);_0x11e228(_0x3701ff);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 7d99036..365a787 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 _0x0a03=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x5ec6d7,_0x1d3878){var _0x503fb3=function(_0x2a8dc4){while(--_0x2a8dc4){_0x5ec6d7['push'](_0x5ec6d7['shift']());}};_0x503fb3(++_0x1d3878);}(_0x0a03,0x1df));var _0x30a0=function(_0x9c0abf,_0x19b264){_0x9c0abf=_0x9c0abf-0x0;var _0x284ac3=_0x0a03[_0x9c0abf];return _0x284ac3;};'use strict';var multer=require(_0x30a0('0x0'));var util=require(_0x30a0('0x1'));var path=require('path');var timeout=require(_0x30a0('0x2'));var express=require(_0x30a0('0x3'));var router=express['Router']();var fs_extra=require(_0x30a0('0x4'));var auth=require(_0x30a0('0x5'));var interaction=require(_0x30a0('0x6'));var config=require(_0x30a0('0x7'));var controller=require(_0x30a0('0x8'));router[_0x30a0('0x9')]('/',auth[_0x30a0('0xa')](),controller[_0x30a0('0xb')]);router['get'](_0x30a0('0xc'),auth[_0x30a0('0xa')](),controller[_0x30a0('0xd')]);router[_0x30a0('0x9')](_0x30a0('0xe'),auth[_0x30a0('0xa')](),controller[_0x30a0('0xf')]);router[_0x30a0('0x10')]('/',auth[_0x30a0('0xa')](),controller['create']);router[_0x30a0('0x11')](_0x30a0('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x30a0('0x12')](_0x30a0('0xe'),auth['isAuthenticated'](),controller[_0x30a0('0x13')]);module[_0x30a0('0x14')]=router; \ No newline at end of file +var _0x4931=['isAuthenticated','index','get','/describe','describe','/:id','show','create','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4931,0x7d));var _0x1493=function(_0x666357,_0x46f30f){_0x666357=_0x666357-0x0;var _0xce4f94=_0x4931[_0x666357];return _0xce4f94;};'use strict';var multer=require(_0x1493('0x0'));var util=require(_0x1493('0x1'));var path=require(_0x1493('0x2'));var timeout=require('connect-timeout');var express=require(_0x1493('0x3'));var router=express[_0x1493('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1493('0x5'));var interaction=require(_0x1493('0x6'));var config=require('../../config/environment');var controller=require(_0x1493('0x7'));router['get']('/',auth[_0x1493('0x8')](),controller[_0x1493('0x9')]);router[_0x1493('0xa')](_0x1493('0xb'),auth['isAuthenticated'](),controller[_0x1493('0xc')]);router[_0x1493('0xa')](_0x1493('0xd'),auth[_0x1493('0x8')](),controller[_0x1493('0xe')]);router['post']('/',auth[_0x1493('0x8')](),controller[_0x1493('0xf')]);router['put'](_0x1493('0xd'),auth[_0x1493('0x8')](),controller[_0x1493('0x10')]);router['delete'](_0x1493('0xd'),auth[_0x1493('0x8')](),controller[_0x1493('0x11')]);module[_0x1493('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 16820f4..7ff4fc6 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2c2ad2,_0x394959){var _0x34f4fd=function(_0x174d3a){while(--_0x174d3a){_0x2c2ad2['push'](_0x2c2ad2['shift']());}};_0x34f4fd(++_0x394959);}(_0xedd9,0xfc));var _0x9edd=function(_0x564df3,_0x2a88b4){_0x564df3=_0x564df3-0x0;var _0x3cb047=_0xedd9[_0x564df3];return _0x3cb047;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x348681,_0x486a1d){var _0x30d4b7=function(_0x4b6cb1){while(--_0x4b6cb1){_0x348681['push'](_0x348681['shift']());}};_0x30d4b7(++_0x486a1d);}(_0x54ef,0x112));var _0xf54e=function(_0x578ef2,_0xd2c04f){_0x578ef2=_0x578ef2-0x0;var _0x1e17c5=_0x54ef[_0x578ef2];return _0x1e17c5;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 3ce8533..e18e12b 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 _0xb7a6=['send','index','map','MailTransferReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','then','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','name'];(function(_0x3b8021,_0xe200c8){var _0x518f00=function(_0x148ed7){while(--_0x148ed7){_0x3b8021['push'](_0x3b8021['shift']());}};_0x518f00(++_0xe200c8);}(_0xb7a6,0xa9));var _0x6b7a=function(_0x595603,_0x5de06d){_0x595603=_0x595603-0x0;var _0x29ab0d=_0xb7a6[_0x595603];return _0x29ab0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b7a('0x0'));var zipdir=require(_0x6b7a('0x1'));var jsonpatch=require(_0x6b7a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b7a('0x3'));var Mustache=require('mustache');var util=require(_0x6b7a('0x4'));var path=require('path');var sox=require(_0x6b7a('0x5'));var csv=require(_0x6b7a('0x6'));var ejs=require(_0x6b7a('0x7'));var fs=require('fs');var fs_extra=require(_0x6b7a('0x8'));var _=require(_0x6b7a('0x9'));var squel=require(_0x6b7a('0xa'));var crypto=require('crypto');var jsforce=require(_0x6b7a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6b7a('0x6'));var querystring=require(_0x6b7a('0xc'));var Papa=require('papaparse');var Redis=require(_0x6b7a('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6b7a('0xe'));var hardwareService=require(_0x6b7a('0xf'));var logger=require('../../config/logger')(_0x6b7a('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6b7a('0x11'));var db=require(_0x6b7a('0x12'))['db'];function respondWithStatusCode(_0x26d7f8,_0x5d20d9){_0x5d20d9=_0x5d20d9||0xcc;return function(_0x49c249){if(_0x49c249){return _0x26d7f8[_0x6b7a('0x13')](_0x5d20d9);}return _0x26d7f8[_0x6b7a('0x14')](_0x5d20d9)['end']();};}function respondWithResult(_0x3632f1,_0x1de98b){_0x1de98b=_0x1de98b||0xc8;return function(_0x158fa4){if(_0x158fa4){return _0x3632f1['status'](_0x1de98b)[_0x6b7a('0x15')](_0x158fa4);}};}function respondWithFilteredResult(_0x1b7806,_0x1bb30f){return function(_0x58a78b){if(_0x58a78b){var _0x3a8ae3=typeof _0x1bb30f[_0x6b7a('0x16')]==='undefined'&&typeof _0x1bb30f['limit']===_0x6b7a('0x17');var _0x34feb4=_0x58a78b[_0x6b7a('0x18')];var _0x11cc71=_0x3a8ae3?0x0:_0x1bb30f[_0x6b7a('0x16')];var _0x1e004d=_0x3a8ae3?_0x58a78b[_0x6b7a('0x18')]:_0x1bb30f[_0x6b7a('0x16')]+_0x1bb30f[_0x6b7a('0x19')];var _0x19f9db;if(_0x1e004d>=_0x34feb4){_0x1e004d=_0x34feb4;_0x19f9db=0xc8;}else{_0x19f9db=0xce;}_0x1b7806['status'](_0x19f9db);return _0x1b7806[_0x6b7a('0x1a')](_0x6b7a('0x1b'),_0x11cc71+'-'+_0x1e004d+'/'+_0x34feb4)[_0x6b7a('0x15')](_0x58a78b);}return null;};}function patchUpdates(_0x214f6a){return function(_0x243afa){try{jsonpatch['apply'](_0x243afa,_0x214f6a,!![]);}catch(_0x3f709e){return BPromise['reject'](_0x3f709e);}return _0x243afa[_0x6b7a('0x1c')]();};}function saveUpdates(_0x26f54d,_0x1352f9){return function(_0x13f46a){if(_0x13f46a){return _0x13f46a[_0x6b7a('0x1d')](_0x26f54d)['then'](function(_0x47f533){return _0x47f533;});}return null;};}function removeEntity(_0x2dbc74,_0x3d5fbb){return function(_0x5a39e6){if(_0x5a39e6){return _0x5a39e6[_0x6b7a('0x1e')]()['then'](function(){_0x2dbc74[_0x6b7a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b642,_0x31304a){return function(_0x2299bf){if(!_0x2299bf){_0x16b642[_0x6b7a('0x13')](0x194);}return _0x2299bf;};}function handleError(_0x1bf506,_0x52c224){_0x52c224=_0x52c224||0x1f4;return function(_0x5ad62e){logger['error'](_0x5ad62e['stack']);if(_0x5ad62e[_0x6b7a('0x1f')]){delete _0x5ad62e[_0x6b7a('0x1f')];}_0x1bf506['status'](_0x52c224)[_0x6b7a('0x20')](_0x5ad62e);};}exports[_0x6b7a('0x21')]=function(_0x2ef956,_0x11a78e){var _0x4a4d17={},_0x37a89b={},_0x1e1a3a={'count':0x0,'rows':[]};var _0x57ecfb=_[_0x6b7a('0x22')](db[_0x6b7a('0x23')][_0x6b7a('0x24')],function(_0x30c06e){return{'name':_0x30c06e['fieldName'],'type':_0x30c06e[_0x6b7a('0x25')][_0x6b7a('0x26')]};});_0x37a89b['model']=_[_0x6b7a('0x22')](_0x57ecfb,_0x6b7a('0x1f'));_0x37a89b[_0x6b7a('0x27')]=_['keys'](_0x2ef956[_0x6b7a('0x27')]);_0x37a89b[_0x6b7a('0x28')]=_[_0x6b7a('0x29')](_0x37a89b[_0x6b7a('0x2a')],_0x37a89b[_0x6b7a('0x27')]);_0x4a4d17[_0x6b7a('0x2b')]=_[_0x6b7a('0x29')](_0x37a89b[_0x6b7a('0x2a')],qs['fields'](_0x2ef956[_0x6b7a('0x27')][_0x6b7a('0x2c')]));_0x4a4d17[_0x6b7a('0x2b')]=_0x4a4d17[_0x6b7a('0x2b')][_0x6b7a('0x2d')]?_0x4a4d17[_0x6b7a('0x2b')]:_0x37a89b['model'];if(!_0x2ef956[_0x6b7a('0x27')][_0x6b7a('0x2e')]('nolimit')){_0x4a4d17['limit']=qs[_0x6b7a('0x19')](_0x2ef956['query'][_0x6b7a('0x19')]);_0x4a4d17[_0x6b7a('0x16')]=qs[_0x6b7a('0x16')](_0x2ef956[_0x6b7a('0x27')][_0x6b7a('0x16')]);}_0x4a4d17[_0x6b7a('0x2f')]=qs['sort'](_0x2ef956[_0x6b7a('0x27')][_0x6b7a('0x30')]);_0x4a4d17['where']=qs['filters'](_[_0x6b7a('0x31')](_0x2ef956[_0x6b7a('0x27')],_0x37a89b[_0x6b7a('0x28')]),_0x57ecfb);if(_0x2ef956[_0x6b7a('0x27')][_0x6b7a('0x32')]){_0x4a4d17[_0x6b7a('0x33')]=_['merge'](_0x4a4d17[_0x6b7a('0x33')],{'$or':_[_0x6b7a('0x22')](_0x57ecfb,function(_0x34a208){if(_0x34a208['type']!=='VIRTUAL'){var _0x34ed45={};_0x34ed45[_0x34a208[_0x6b7a('0x1f')]]={'$like':'%'+_0x2ef956[_0x6b7a('0x27')][_0x6b7a('0x32')]+'%'};return _0x34ed45;}})});}_0x4a4d17=_[_0x6b7a('0x34')]({},_0x4a4d17,_0x2ef956[_0x6b7a('0x35')]);var _0x284c0f={'where':_0x4a4d17['where']};return db[_0x6b7a('0x23')]['count'](_0x284c0f)[_0x6b7a('0x36')](function(_0x57ee5d){_0x1e1a3a[_0x6b7a('0x18')]=_0x57ee5d;if(_0x2ef956[_0x6b7a('0x27')]['includeAll']){_0x4a4d17[_0x6b7a('0x37')]=[{'all':!![]}];}return db[_0x6b7a('0x23')][_0x6b7a('0x38')](_0x4a4d17);})['then'](function(_0x3325cc){_0x1e1a3a[_0x6b7a('0x39')]=_0x3325cc;return _0x1e1a3a;})['then'](respondWithFilteredResult(_0x11a78e,_0x4a4d17))[_0x6b7a('0x3a')](handleError(_0x11a78e,null));};exports[_0x6b7a('0x3b')]=function(_0xc29784,_0x18dd60){var _0x3312e0={'raw':!![],'where':{'id':_0xc29784['params']['id']}},_0x24d33e={};_0x24d33e['model']=_['keys'](db[_0x6b7a('0x23')][_0x6b7a('0x24')]);_0x24d33e['query']=_[_0x6b7a('0x3c')](_0xc29784[_0x6b7a('0x27')]);_0x24d33e[_0x6b7a('0x28')]=_[_0x6b7a('0x29')](_0x24d33e['model'],_0x24d33e['query']);_0x3312e0[_0x6b7a('0x2b')]=_[_0x6b7a('0x29')](_0x24d33e[_0x6b7a('0x2a')],qs[_0x6b7a('0x2c')](_0xc29784['query'][_0x6b7a('0x2c')]));_0x3312e0[_0x6b7a('0x2b')]=_0x3312e0[_0x6b7a('0x2b')][_0x6b7a('0x2d')]?_0x3312e0[_0x6b7a('0x2b')]:_0x24d33e['model'];if(_0xc29784[_0x6b7a('0x27')][_0x6b7a('0x3d')]){_0x3312e0[_0x6b7a('0x37')]=[{'all':!![]}];}_0x3312e0=_['merge']({},_0x3312e0,_0xc29784[_0x6b7a('0x35')]);return db['MailTransferReport'][_0x6b7a('0x3e')](_0x3312e0)['then'](handleEntityNotFound(_0x18dd60,null))[_0x6b7a('0x36')](respondWithResult(_0x18dd60,null))['catch'](handleError(_0x18dd60,null));};exports[_0x6b7a('0x3f')]=function(_0xd22352,_0x11a887){return db['MailTransferReport']['create'](_0xd22352[_0x6b7a('0x40')],{})[_0x6b7a('0x36')](respondWithResult(_0x11a887,0xc9))[_0x6b7a('0x3a')](handleError(_0x11a887,null));};exports['update']=function(_0x217418,_0x45ea1a){if(_0x217418[_0x6b7a('0x40')]['id']){delete _0x217418[_0x6b7a('0x40')]['id'];}return db[_0x6b7a('0x23')][_0x6b7a('0x3e')]({'where':{'id':_0x217418[_0x6b7a('0x41')]['id']}})[_0x6b7a('0x36')](handleEntityNotFound(_0x45ea1a,null))[_0x6b7a('0x36')](saveUpdates(_0x217418[_0x6b7a('0x40')],null))[_0x6b7a('0x36')](respondWithResult(_0x45ea1a,null))[_0x6b7a('0x3a')](handleError(_0x45ea1a,null));};exports[_0x6b7a('0x1e')]=function(_0x33171,_0x1a2b5b){return db['MailTransferReport']['find']({'where':{'id':_0x33171[_0x6b7a('0x41')]['id']}})[_0x6b7a('0x36')](handleEntityNotFound(_0x1a2b5b,null))['then'](removeEntity(_0x1a2b5b,null))[_0x6b7a('0x3a')](handleError(_0x1a2b5b,null));};exports[_0x6b7a('0x42')]=function(_0x2b061d,_0x58d9e5){return db[_0x6b7a('0x23')][_0x6b7a('0x42')]()[_0x6b7a('0x36')](respondWithResult(_0x58d9e5,null))[_0x6b7a('0x3a')](handleError(_0x58d9e5,null));}; \ No newline at end of file +var _0x0d16=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','then','includeAll','findAll','keys','include','options','catch','create','body','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x0d16,0xd4));var _0x60d1=function(_0x51b2a8,_0x471d5d){_0x51b2a8=_0x51b2a8-0x0;var _0x37ce12=_0x0d16[_0x51b2a8];return _0x37ce12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60d1('0x0'));var zipdir=require(_0x60d1('0x1'));var jsonpatch=require(_0x60d1('0x2'));var rp=require('request-promise');var moment=require(_0x60d1('0x3'));var BPromise=require(_0x60d1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x60d1('0x5'));var sox=require(_0x60d1('0x6'));var csv=require('to-csv');var ejs=require(_0x60d1('0x7'));var fs=require('fs');var fs_extra=require(_0x60d1('0x8'));var _=require(_0x60d1('0x9'));var squel=require('squel');var crypto=require(_0x60d1('0xa'));var jsforce=require(_0x60d1('0xb'));var deskjs=require(_0x60d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x60d1('0xd'));var Papa=require(_0x60d1('0xe'));var Redis=require(_0x60d1('0xf'));var authService=require(_0x60d1('0x10'));var qs=require(_0x60d1('0x11'));var as=require(_0x60d1('0x12'));var hardwareService=require(_0x60d1('0x13'));var logger=require(_0x60d1('0x14'))(_0x60d1('0x15'));var utils=require(_0x60d1('0x16'));var config=require(_0x60d1('0x17'));var licenseUtil=require(_0x60d1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2bab,_0x146f22){_0x146f22=_0x146f22||0xcc;return function(_0x5353c3){if(_0x5353c3){return _0x5a2bab[_0x60d1('0x19')](_0x146f22);}return _0x5a2bab[_0x60d1('0x1a')](_0x146f22)[_0x60d1('0x1b')]();};}function respondWithResult(_0x1e839a,_0x560cea){_0x560cea=_0x560cea||0xc8;return function(_0x39d11b){if(_0x39d11b){return _0x1e839a[_0x60d1('0x1a')](_0x560cea)['json'](_0x39d11b);}};}function respondWithFilteredResult(_0x1ecee2,_0x39a74d){return function(_0x52b627){if(_0x52b627){var _0x100d45=typeof _0x39a74d['offset']===_0x60d1('0x1c')&&typeof _0x39a74d['limit']===_0x60d1('0x1c');var _0x4eab9d=_0x52b627[_0x60d1('0x1d')];var _0x573769=_0x100d45?0x0:_0x39a74d['offset'];var _0x8f055c=_0x100d45?_0x52b627[_0x60d1('0x1d')]:_0x39a74d[_0x60d1('0x1e')]+_0x39a74d[_0x60d1('0x1f')];var _0x15b95a;if(_0x8f055c>=_0x4eab9d){_0x8f055c=_0x4eab9d;_0x15b95a=0xc8;}else{_0x15b95a=0xce;}_0x1ecee2['status'](_0x15b95a);return _0x1ecee2[_0x60d1('0x20')](_0x60d1('0x21'),_0x573769+'-'+_0x8f055c+'/'+_0x4eab9d)[_0x60d1('0x22')](_0x52b627);}return null;};}function patchUpdates(_0xe6a097){return function(_0x3ab5aa){try{jsonpatch[_0x60d1('0x23')](_0x3ab5aa,_0xe6a097,!![]);}catch(_0xb40f9e){return BPromise[_0x60d1('0x24')](_0xb40f9e);}return _0x3ab5aa[_0x60d1('0x25')]();};}function saveUpdates(_0x2c3b2f,_0x1ceb10){return function(_0x5b0bb9){if(_0x5b0bb9){return _0x5b0bb9[_0x60d1('0x26')](_0x2c3b2f)['then'](function(_0x272e43){return _0x272e43;});}return null;};}function removeEntity(_0x3adb29,_0x289514){return function(_0x27b113){if(_0x27b113){return _0x27b113['destroy']()['then'](function(){_0x3adb29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc456c,_0xdbe9cd){return function(_0x437f2d){if(!_0x437f2d){_0xfc456c[_0x60d1('0x19')](0x194);}return _0x437f2d;};}function handleError(_0xe306fd,_0x41cef9){_0x41cef9=_0x41cef9||0x1f4;return function(_0x52df48){logger[_0x60d1('0x27')](_0x52df48['stack']);if(_0x52df48['name']){delete _0x52df48[_0x60d1('0x28')];}_0xe306fd[_0x60d1('0x1a')](_0x41cef9)[_0x60d1('0x29')](_0x52df48);};}exports[_0x60d1('0x2a')]=function(_0x461a2f,_0x21d503){var _0x1724cd={},_0xf5794b={},_0x2e72f9={'count':0x0,'rows':[]};var _0x57a170=_[_0x60d1('0x2b')](db[_0x60d1('0x2c')][_0x60d1('0x2d')],function(_0xb81356){return{'name':_0xb81356[_0x60d1('0x2e')],'type':_0xb81356[_0x60d1('0x2f')]['key']};});_0xf5794b[_0x60d1('0x30')]=_[_0x60d1('0x2b')](_0x57a170,_0x60d1('0x28'));_0xf5794b[_0x60d1('0x31')]=_['keys'](_0x461a2f[_0x60d1('0x31')]);_0xf5794b[_0x60d1('0x32')]=_[_0x60d1('0x33')](_0xf5794b[_0x60d1('0x30')],_0xf5794b[_0x60d1('0x31')]);_0x1724cd[_0x60d1('0x34')]=_['intersection'](_0xf5794b[_0x60d1('0x30')],qs['fields'](_0x461a2f[_0x60d1('0x31')][_0x60d1('0x35')]));_0x1724cd[_0x60d1('0x34')]=_0x1724cd['attributes'][_0x60d1('0x36')]?_0x1724cd[_0x60d1('0x34')]:_0xf5794b[_0x60d1('0x30')];if(!_0x461a2f[_0x60d1('0x31')][_0x60d1('0x37')](_0x60d1('0x38'))){_0x1724cd[_0x60d1('0x1f')]=qs['limit'](_0x461a2f[_0x60d1('0x31')][_0x60d1('0x1f')]);_0x1724cd[_0x60d1('0x1e')]=qs[_0x60d1('0x1e')](_0x461a2f[_0x60d1('0x31')][_0x60d1('0x1e')]);}_0x1724cd['order']=qs[_0x60d1('0x39')](_0x461a2f[_0x60d1('0x31')]['sort']);_0x1724cd['where']=qs[_0x60d1('0x32')](_[_0x60d1('0x3a')](_0x461a2f['query'],_0xf5794b[_0x60d1('0x32')]),_0x57a170);if(_0x461a2f[_0x60d1('0x31')]['filter']){_0x1724cd[_0x60d1('0x3b')]=_[_0x60d1('0x3c')](_0x1724cd[_0x60d1('0x3b')],{'$or':_[_0x60d1('0x2b')](_0x57a170,function(_0x173a75){if(_0x173a75[_0x60d1('0x2f')]!==_0x60d1('0x3d')){var _0x5f2450={};_0x5f2450[_0x173a75[_0x60d1('0x28')]]={'$like':'%'+_0x461a2f[_0x60d1('0x31')][_0x60d1('0x3e')]+'%'};return _0x5f2450;}})});}_0x1724cd=_[_0x60d1('0x3c')]({},_0x1724cd,_0x461a2f['options']);var _0xc9c62={'where':_0x1724cd[_0x60d1('0x3b')]};return db[_0x60d1('0x2c')][_0x60d1('0x1d')](_0xc9c62)[_0x60d1('0x3f')](function(_0x9f63b1){_0x2e72f9[_0x60d1('0x1d')]=_0x9f63b1;if(_0x461a2f[_0x60d1('0x31')][_0x60d1('0x40')]){_0x1724cd['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x60d1('0x41')](_0x1724cd);})[_0x60d1('0x3f')](function(_0x4e22cb){_0x2e72f9['rows']=_0x4e22cb;return _0x2e72f9;})['then'](respondWithFilteredResult(_0x21d503,_0x1724cd))['catch'](handleError(_0x21d503,null));};exports['show']=function(_0x3d3c48,_0x53407d){var _0x59d2f6={'raw':!![],'where':{'id':_0x3d3c48['params']['id']}},_0x204d3d={};_0x204d3d[_0x60d1('0x30')]=_[_0x60d1('0x42')](db[_0x60d1('0x2c')][_0x60d1('0x2d')]);_0x204d3d[_0x60d1('0x31')]=_[_0x60d1('0x42')](_0x3d3c48[_0x60d1('0x31')]);_0x204d3d['filters']=_[_0x60d1('0x33')](_0x204d3d[_0x60d1('0x30')],_0x204d3d[_0x60d1('0x31')]);_0x59d2f6[_0x60d1('0x34')]=_[_0x60d1('0x33')](_0x204d3d['model'],qs[_0x60d1('0x35')](_0x3d3c48[_0x60d1('0x31')][_0x60d1('0x35')]));_0x59d2f6['attributes']=_0x59d2f6[_0x60d1('0x34')]['length']?_0x59d2f6[_0x60d1('0x34')]:_0x204d3d[_0x60d1('0x30')];if(_0x3d3c48[_0x60d1('0x31')][_0x60d1('0x40')]){_0x59d2f6[_0x60d1('0x43')]=[{'all':!![]}];}_0x59d2f6=_[_0x60d1('0x3c')]({},_0x59d2f6,_0x3d3c48[_0x60d1('0x44')]);return db[_0x60d1('0x2c')]['find'](_0x59d2f6)[_0x60d1('0x3f')](handleEntityNotFound(_0x53407d,null))[_0x60d1('0x3f')](respondWithResult(_0x53407d,null))[_0x60d1('0x45')](handleError(_0x53407d,null));};exports[_0x60d1('0x46')]=function(_0x18d996,_0x27f1ea){return db[_0x60d1('0x2c')][_0x60d1('0x46')](_0x18d996[_0x60d1('0x47')],{})[_0x60d1('0x3f')](respondWithResult(_0x27f1ea,0xc9))['catch'](handleError(_0x27f1ea,null));};exports[_0x60d1('0x26')]=function(_0x4ebb80,_0x3b996c){if(_0x4ebb80[_0x60d1('0x47')]['id']){delete _0x4ebb80[_0x60d1('0x47')]['id'];}return db[_0x60d1('0x2c')][_0x60d1('0x48')]({'where':{'id':_0x4ebb80[_0x60d1('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b996c,null))['then'](saveUpdates(_0x4ebb80['body'],null))[_0x60d1('0x3f')](respondWithResult(_0x3b996c,null))[_0x60d1('0x45')](handleError(_0x3b996c,null));};exports[_0x60d1('0x4a')]=function(_0x342e90,_0x306db2){return db[_0x60d1('0x2c')][_0x60d1('0x48')]({'where':{'id':_0x342e90[_0x60d1('0x49')]['id']}})[_0x60d1('0x3f')](handleEntityNotFound(_0x306db2,null))[_0x60d1('0x3f')](removeEntity(_0x306db2,null))[_0x60d1('0x45')](handleError(_0x306db2,null));};exports[_0x60d1('0x4b')]=function(_0x28f6a2,_0x33de8e){return db[_0x60d1('0x2c')][_0x60d1('0x4b')]()[_0x60d1('0x3f')](respondWithResult(_0x33de8e,null))[_0x60d1('0x45')](handleError(_0x33de8e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index fc6479e..4fb8fb1 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 _0xb2ef=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x51d2f8,_0x27a4a0){var _0x335143=function(_0x4e8457){while(--_0x4e8457){_0x51d2f8['push'](_0x51d2f8['shift']());}};_0x335143(++_0x27a4a0);}(_0xb2ef,0xa7));var _0xfb2e=function(_0xdd9f6e,_0x5612b7){_0xdd9f6e=_0xdd9f6e-0x0;var _0x35a8cf=_0xb2ef[_0xdd9f6e];return _0x35a8cf;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))('api');var moment=require(_0xfb2e('0x3'));var BPromise=require(_0xfb2e('0x4'));var rp=require(_0xfb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2e('0x6'));var config=require(_0xfb2e('0x7'));var attributes=require(_0xfb2e('0x8'));module[_0xfb2e('0x9')]=function(_0x3069a,_0x2a1c23){return _0x3069a[_0xfb2e('0xa')](_0xfb2e('0xb'),attributes,{'tableName':_0xfb2e('0xc'),'paranoid':![],'indexes':[{'name':_0xfb2e('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x406f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger'];(function(_0x2b6a55,_0x1860a9){var _0x599954=function(_0x3bf430){while(--_0x3bf430){_0x2b6a55['push'](_0x2b6a55['shift']());}};_0x599954(++_0x1860a9);}(_0x406f,0xe8));var _0xf406=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x406f[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xf406('0x0'));var util=require('util');var logger=require(_0xf406('0x1'))('api');var moment=require(_0xf406('0x2'));var BPromise=require(_0xf406('0x3'));var rp=require(_0xf406('0x4'));var fs=require('fs');var path=require(_0xf406('0x5'));var rimraf=require(_0xf406('0x6'));var config=require(_0xf406('0x7'));var attributes=require(_0xf406('0x8'));module[_0xf406('0x9')]=function(_0x40542f,_0x235134){return _0x40542f['define'](_0xf406('0xa'),attributes,{'tableName':_0xf406('0xb'),'paranoid':![],'indexes':[{'name':_0xf406('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 54e7617..6f045a7 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 _0xba0f=['request','then','request\x20sent','debug','stringify','error','MailTransferReport,\x20%s,\x20%s','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x1c27e1,_0x10cc1c){var _0x9a81ac=function(_0x51598d){while(--_0x51598d){_0x1c27e1['push'](_0x1c27e1['shift']());}};_0x9a81ac(++_0x10cc1c);}(_0xba0f,0xd2));var _0xfba0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xba0f[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfba0('0x0'));var BPromise=require(_0xfba0('0x1'));var rs=require(_0xfba0('0x2'));var fs=require('fs');var Redis=require(_0xfba0('0x3'));var db=require(_0xfba0('0x4'))['db'];var utils=require(_0xfba0('0x5'));var logger=require(_0xfba0('0x6'))(_0xfba0('0x7'));var config=require('../../config/environment');var jayson=require(_0xfba0('0x8'));var client=jayson['client'][_0xfba0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x352c33,_0x58dc04,_0x54d385){return new BPromise(function(_0x1acf0f,_0x3ccf71){return client[_0xfba0('0xa')](_0x352c33,_0x54d385)[_0xfba0('0xb')](function(_0x248e4e){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x58dc04,_0xfba0('0xc'));logger[_0xfba0('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x58dc04,'request\x20sent',JSON[_0xfba0('0xe')](_0x248e4e));if(_0x248e4e[_0xfba0('0xf')]){if(_0x248e4e['error']['code']===0x1f4){logger['error'](_0xfba0('0x10'),_0x58dc04,_0x248e4e[_0xfba0('0xf')][_0xfba0('0x11')]);return _0x3ccf71(_0x248e4e[_0xfba0('0xf')][_0xfba0('0x11')]);}logger[_0xfba0('0xf')](_0xfba0('0x10'),_0x58dc04,_0x248e4e['error']['message']);return _0x1acf0f(_0x248e4e[_0xfba0('0xf')][_0xfba0('0x11')]);}else{logger[_0xfba0('0x12')](_0xfba0('0x10'),_0x58dc04,_0xfba0('0xc'));_0x1acf0f(_0x248e4e[_0xfba0('0x13')][_0xfba0('0x11')]);}})['catch'](function(_0x376fc6){logger[_0xfba0('0xf')](_0xfba0('0x10'),_0x58dc04,_0x376fc6);_0x3ccf71(_0x376fc6);});});} \ No newline at end of file +var _0xe285=['code','MailTransferReport,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','debug','request\x20sent','stringify','error'];(function(_0x284541,_0x197a01){var _0xd528bc=function(_0x205412){while(--_0x205412){_0x284541['push'](_0x284541['shift']());}};_0xd528bc(++_0x197a01);}(_0xe285,0x122));var _0x5e28=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xe285[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e28('0x0'));var BPromise=require(_0x5e28('0x1'));var rs=require(_0x5e28('0x2'));var fs=require('fs');var Redis=require(_0x5e28('0x3'));var db=require(_0x5e28('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e28('0x5'));var config=require(_0x5e28('0x6'));var jayson=require(_0x5e28('0x7'));var client=jayson[_0x5e28('0x8')][_0x5e28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46181f,_0x322a77,_0x818f41){return new BPromise(function(_0x4ce413,_0x2ecd11){return client['request'](_0x46181f,_0x818f41)['then'](function(_0x50af99){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x322a77,'request\x20sent');logger[_0x5e28('0xa')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x322a77,_0x5e28('0xb'),JSON[_0x5e28('0xc')](_0x50af99));if(_0x50af99[_0x5e28('0xd')]){if(_0x50af99[_0x5e28('0xd')][_0x5e28('0xe')]===0x1f4){logger[_0x5e28('0xd')](_0x5e28('0xf'),_0x322a77,_0x50af99[_0x5e28('0xd')][_0x5e28('0x10')]);return _0x2ecd11(_0x50af99['error'][_0x5e28('0x10')]);}logger[_0x5e28('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x322a77,_0x50af99['error'][_0x5e28('0x10')]);return _0x4ce413(_0x50af99[_0x5e28('0xd')]['message']);}else{logger[_0x5e28('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x322a77,_0x5e28('0xb'));_0x4ce413(_0x50af99['result'][_0x5e28('0x10')]);}})[_0x5e28('0x12')](function(_0x20a434){logger[_0x5e28('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x322a77,_0x20a434);_0x2ecd11(_0x20a434);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 17cd6ad..3315222 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 _0x5080=['../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3865c4,_0xd26435){var _0x1f079d=function(_0x11deb7){while(--_0x11deb7){_0x3865c4['push'](_0x3865c4['shift']());}};_0x1f079d(++_0xd26435);}(_0x5080,0x1b2));var _0x0508=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5080[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require(_0x0508('0x0'));var path=require('path');var timeout=require(_0x0508('0x1'));var express=require(_0x0508('0x2'));var router=express[_0x0508('0x3')]();var fs_extra=require(_0x0508('0x4'));var auth=require(_0x0508('0x5'));var interaction=require(_0x0508('0x6'));var config=require('../../config/environment');var controller=require(_0x0508('0x7'));router[_0x0508('0x8')]('/',auth[_0x0508('0x9')](),controller[_0x0508('0xa')]);router[_0x0508('0x8')](_0x0508('0xb'),auth[_0x0508('0x9')](),controller[_0x0508('0xc')]);router[_0x0508('0x8')]('/:id',auth[_0x0508('0x9')](),controller[_0x0508('0xd')]);router[_0x0508('0xe')]('/',auth['isAuthenticated'](),controller[_0x0508('0xf')]);router['put']('/:id',auth[_0x0508('0x9')](),controller[_0x0508('0x10')]);router[_0x0508('0x11')]('/:id',auth[_0x0508('0x9')](),controller[_0x0508('0x12')]);module[_0x0508('0x13')]=router; \ No newline at end of file +var _0xf5e9=['../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x545e48,_0x471714){var _0x2d6f13=function(_0x2bc9c5){while(--_0x2bc9c5){_0x545e48['push'](_0x545e48['shift']());}};_0x2d6f13(++_0x471714);}(_0xf5e9,0xcb));var _0x9f5e=function(_0x5659c0,_0x5f2532){_0x5659c0=_0x5659c0-0x0;var _0x36e3c0=_0xf5e9[_0x5659c0];return _0x36e3c0;};'use strict';var multer=require(_0x9f5e('0x0'));var util=require(_0x9f5e('0x1'));var path=require(_0x9f5e('0x2'));var timeout=require(_0x9f5e('0x3'));var express=require(_0x9f5e('0x4'));var router=express[_0x9f5e('0x5')]();var fs_extra=require(_0x9f5e('0x6'));var auth=require(_0x9f5e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f5e('0x8'));router[_0x9f5e('0x9')]('/',auth[_0x9f5e('0xa')](),controller[_0x9f5e('0xb')]);router[_0x9f5e('0x9')](_0x9f5e('0xc'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0xd')]);router[_0x9f5e('0x9')](_0x9f5e('0xe'),auth[_0x9f5e('0xa')](),controller['show']);router[_0x9f5e('0xf')]('/',auth['isAuthenticated'](),controller[_0x9f5e('0x10')]);router[_0x9f5e('0x11')](_0x9f5e('0xe'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0x12')]);router[_0x9f5e('0x13')](_0x9f5e('0xe'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7a154e2..593e23f 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 _0x2732=['exitAt','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','diff','seconds','setDataValue'];(function(_0x2966d3,_0x255511){var _0x41c398=function(_0x39e1d7){while(--_0x39e1d7){_0x2966d3['push'](_0x2966d3['shift']());}};_0x41c398(++_0x255511);}(_0x2732,0x112));var _0x2273=function(_0x3ee615,_0x5c3d69){_0x3ee615=_0x3ee615-0x0;var _0x5cb70c=_0x2732[_0x3ee615];return _0x5cb70c;};'use strict';var Sequelize=require(_0x2273('0x0'));var moment=require(_0x2273('0x1'));module[_0x2273('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2273('0x3')]},'interface':{'type':Sequelize[_0x2273('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x2273('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x2273('0x5')]},'enterAt':{'type':Sequelize[_0x2273('0x6')]},'exitAt':{'type':Sequelize[_0x2273('0x6')],'set':function(_0x2cf39){var _0x1bccde=moment(_0x2cf39);var _0x50d7ce=moment(this['getDataValue'](_0x2273('0x7')));var _0x18742b=_0x1bccde[_0x2273('0x8')](_0x50d7ce,_0x2273('0x9'));this[_0x2273('0xa')](_0x2273('0xb'),_0x2cf39);this[_0x2273('0xa')]('duration',_0x18742b>=0x0?_0x18742b:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x2273('0x3')],'comment':_0x2273('0xc')},'data3':{'type':Sequelize[_0x2273('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x2273('0x3')],'comment':_0x2273('0xd')},'data5':{'type':Sequelize[_0x2273('0x3')],'comment':_0x2273('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x2273('0x5')]},'uniqueid':{'type':Sequelize[_0x2273('0x3')]}}; \ No newline at end of file +var _0x1b29=['diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x1b29,0x1d5));var _0x91b2=function(_0x8ad8,_0x4de02f){_0x8ad8=_0x8ad8-0x0;var _0x57e72a=_0x1b29[_0x8ad8];return _0x57e72a;};'use strict';var Sequelize=require(_0x91b2('0x0'));var moment=require(_0x91b2('0x1'));module[_0x91b2('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x91b2('0x3')]},'interface':{'type':Sequelize[_0x91b2('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x91b2('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x91b2('0x5')],'set':function(_0x4857a4){var _0x3cecf6=moment(_0x4857a4);var _0x442475=moment(this[_0x91b2('0x6')]('enterAt'));var _0x31f5c3=_0x3cecf6[_0x91b2('0x7')](_0x442475,_0x91b2('0x8'));this[_0x91b2('0x9')](_0x91b2('0xa'),_0x4857a4);this['setDataValue']('duration',_0x31f5c3>=0x0?_0x31f5c3:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x91b2('0xb')},'data2':{'type':Sequelize[_0x91b2('0x3')],'comment':_0x91b2('0xc')},'data3':{'type':Sequelize[_0x91b2('0x3')],'comment':_0x91b2('0xd')},'data4':{'type':Sequelize[_0x91b2('0x3')],'comment':_0x91b2('0xe')},'data5':{'type':Sequelize[_0x91b2('0x3')],'comment':_0x91b2('0xf')},'role':{'type':Sequelize[_0x91b2('0x3')]},'internal':{'type':Sequelize[_0x91b2('0x10')]},'uniqueid':{'type':Sequelize[_0x91b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 040b20d..fe14533 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 _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(_0x4bf54b,_0x371005){var _0x1d9705=function(_0x3d3f7c){while(--_0x3d3f7c){_0x4bf54b['push'](_0x4bf54b['shift']());}};_0x1d9705(++_0x371005);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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 +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x3c59b5,_0x40975c){var _0x40a8a1=function(_0x2c38c8){while(--_0x2c38c8){_0x3c59b5['push'](_0x3c59b5['shift']());}};_0x40a8a1(++_0x40975c);}(_0x008c,0x188));var _0xc008=function(_0x39adb2,_0x540b96){_0x39adb2=_0x39adb2-0x0;var _0x1df693=_0x008c[_0x39adb2];return _0x1df693;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 053d39e..142c263 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 _0x9fd8=['../../config/logger','api','request-promise','rimraf','../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface','interface','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9fd8,0x18b));var _0x89fd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9fd8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x89fd('0x0'));var logger=require(_0x89fd('0x1'))(_0x89fd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x89fd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89fd('0x4'));var config=require(_0x89fd('0x5'));var attributes=require(_0x89fd('0x6'));module['exports']=function(_0x3effda,_0x5f4caa){return _0x3effda['define'](_0x89fd('0x7'),attributes,{'tableName':_0x89fd('0x8'),'paranoid':![],'indexes':[{'name':_0x89fd('0x9'),'fields':['membername',_0x89fd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25fa=['MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','bluebird','request-promise','path','./memberReport.attributes','define'];(function(_0x26f93d,_0x49bebe){var _0x58bd77=function(_0x1f2648){while(--_0x1f2648){_0x26f93d['push'](_0x26f93d['shift']());}};_0x58bd77(++_0x49bebe);}(_0x25fa,0x109));var _0xa25f=function(_0x5271ca,_0x15d323){_0x5271ca=_0x5271ca-0x0;var _0x5c8646=_0x25fa[_0x5271ca];return _0x5c8646;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'paranoid':![],'indexes':[{'name':_0xa25f('0xa'),'fields':[_0xa25f('0xb'),_0xa25f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7a9c137..e496474 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 _0x1b64=['attributes','catch','CreateMemberReport','MemberReport','body','UpdateMemberReport','update','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','findAll','options','raw','where','limit','include','map','model'];(function(_0x3fdf02,_0x3799cb){var _0xfeaed0=function(_0x21995d){while(--_0x21995d){_0x3fdf02['push'](_0x3fdf02['shift']());}};_0xfeaed0(++_0x3799cb);}(_0x1b64,0x76));var _0x41b6=function(_0x55bf4e,_0x54c43d){_0x55bf4e=_0x55bf4e-0x0;var _0x2872ec=_0x1b64[_0x55bf4e];return _0x2872ec;};'use strict';var _=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var moment=require('moment');var BPromise=require(_0x41b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x41b6('0x3'));var logger=require(_0x41b6('0x4'))(_0x41b6('0x5'));var config=require(_0x41b6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x41b6('0x7')][_0x41b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5775c8,_0x56bd45,_0x4bb579){return new BPromise(function(_0x7763c3,_0x3cc6f8){return client[_0x41b6('0x9')](_0x5775c8,_0x4bb579)[_0x41b6('0xa')](function(_0x477e12){logger[_0x41b6('0xb')]('MemberReport,\x20%s,\x20%s',_0x56bd45,_0x41b6('0xc'));logger[_0x41b6('0xd')](_0x41b6('0xe'),_0x56bd45,_0x41b6('0xc'),JSON[_0x41b6('0xf')](_0x477e12));if(_0x477e12[_0x41b6('0x10')]){if(_0x477e12[_0x41b6('0x10')][_0x41b6('0x11')]===0x1f4){logger[_0x41b6('0x10')](_0x41b6('0x12'),_0x56bd45,_0x477e12[_0x41b6('0x10')][_0x41b6('0x13')]);return _0x3cc6f8(_0x477e12['error'][_0x41b6('0x13')]);}logger[_0x41b6('0x10')](_0x41b6('0x12'),_0x56bd45,_0x477e12[_0x41b6('0x10')]['message']);return _0x7763c3(_0x477e12[_0x41b6('0x10')][_0x41b6('0x13')]);}else{logger[_0x41b6('0xb')](_0x41b6('0x12'),_0x56bd45,_0x41b6('0xc'));_0x7763c3(_0x477e12[_0x41b6('0x14')][_0x41b6('0x13')]);}})['catch'](function(_0x13ce57){logger[_0x41b6('0x10')](_0x41b6('0x12'),_0x56bd45,_0x13ce57);_0x3cc6f8(_0x13ce57);});});}exports[_0x41b6('0x15')]=function(_0x14a786){var _0x47feb9=this;return new Promise(function(_0x5637f6,_0x482baa){return db['MemberReport'][_0x41b6('0x16')]({'raw':_0x14a786['options']?_0x14a786[_0x41b6('0x17')][_0x41b6('0x18')]===undefined?!![]:![]:!![],'where':_0x14a786[_0x41b6('0x17')]?_0x14a786[_0x41b6('0x17')][_0x41b6('0x19')]||null:null,'attributes':_0x14a786[_0x41b6('0x17')]?_0x14a786['options']['attributes']||null:null,'limit':_0x14a786[_0x41b6('0x17')]?_0x14a786['options'][_0x41b6('0x1a')]||null:null,'include':_0x14a786[_0x41b6('0x17')]?_0x14a786[_0x41b6('0x17')][_0x41b6('0x1b')]?_[_0x41b6('0x1c')](_0x14a786[_0x41b6('0x17')][_0x41b6('0x1b')],function(_0x11cc02){return{'model':db[_0x11cc02[_0x41b6('0x1d')]],'as':_0x11cc02['as'],'attributes':_0x11cc02[_0x41b6('0x1e')],'include':_0x11cc02[_0x41b6('0x1b')]?_['map'](_0x11cc02[_0x41b6('0x1b')],function(_0x2c1290){return{'model':db[_0x2c1290['model']],'as':_0x2c1290['as'],'attributes':_0x2c1290[_0x41b6('0x1e')],'include':_0x2c1290[_0x41b6('0x1b')]?_['map'](_0x2c1290[_0x41b6('0x1b')],function(_0x454b5f){return{'model':db[_0x454b5f[_0x41b6('0x1d')]],'as':_0x454b5f['as'],'attributes':_0x454b5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x41b6('0xa')](function(_0x5e431d){logger['info']('GetMemberReport',_0x14a786);logger[_0x41b6('0xd')](_0x41b6('0x15'),_0x14a786,JSON['stringify'](_0x5e431d));_0x5637f6(_0x5e431d);})[_0x41b6('0x1f')](function(_0x45f9e2){logger[_0x41b6('0x10')](_0x41b6('0x15'),_0x45f9e2[_0x41b6('0x13')],_0x14a786);_0x482baa(_0x47feb9['error'](0x1f4,_0x45f9e2['message']));});});};exports[_0x41b6('0x20')]=function(_0x37bd7a){var _0x14e54b=this;return new Promise(function(_0x56b365,_0x626c53){return db[_0x41b6('0x21')]['create'](_0x37bd7a[_0x41b6('0x22')],{'raw':_0x37bd7a[_0x41b6('0x17')]?_0x37bd7a[_0x41b6('0x17')][_0x41b6('0x18')]===undefined?!![]:![]:!![]})[_0x41b6('0xa')](function(_0x2ac3a7){logger[_0x41b6('0xb')]('CreateMemberReport',_0x37bd7a);logger[_0x41b6('0xd')]('CreateMemberReport',_0x37bd7a,JSON['stringify'](_0x2ac3a7));_0x56b365(_0x2ac3a7);})[_0x41b6('0x1f')](function(_0x4cf4d5){logger[_0x41b6('0x10')](_0x41b6('0x20'),_0x4cf4d5[_0x41b6('0x13')],_0x37bd7a);_0x626c53(_0x14e54b[_0x41b6('0x10')](0x1f4,_0x4cf4d5[_0x41b6('0x13')]));});});};exports[_0x41b6('0x23')]=function(_0x420e40){var _0x2e335a=this;return new Promise(function(_0x486709,_0x457e50){return db[_0x41b6('0x21')][_0x41b6('0x24')](_0x420e40[_0x41b6('0x22')],{'raw':_0x420e40[_0x41b6('0x17')]?_0x420e40[_0x41b6('0x17')][_0x41b6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x420e40['options']?_0x420e40[_0x41b6('0x17')]['where']||null:null,'attributes':_0x420e40['options']?_0x420e40[_0x41b6('0x17')][_0x41b6('0x1e')]||null:null,'limit':_0x420e40[_0x41b6('0x17')]?_0x420e40[_0x41b6('0x17')][_0x41b6('0x1a')]||null:null})[_0x41b6('0xa')](function(_0x5b7e9d){logger[_0x41b6('0xb')](_0x41b6('0x23'),_0x420e40);logger[_0x41b6('0xd')](_0x41b6('0x23'),_0x420e40,JSON[_0x41b6('0xf')](_0x5b7e9d));_0x486709(_0x5b7e9d);})[_0x41b6('0x1f')](function(_0x434281){logger['error'](_0x41b6('0x23'),_0x434281[_0x41b6('0x13')],_0x420e40);_0x457e50(_0x2e335a[_0x41b6('0x10')](0x1f4,_0x434281[_0x41b6('0x13')]));});});}; \ No newline at end of file +var _0xc4f5=['debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','model','map','then','CreateMemberReport','create','body','stringify','UpdateMemberReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x1ce23d,_0x25a351){_0x1ce23d=_0x1ce23d-0x0;var _0x4338d9=_0xc4f5[_0x1ce23d];return _0x4338d9;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var moment=require(_0x5c4f('0x1'));var BPromise=require(_0x5c4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c4f('0x3'));var db=require(_0x5c4f('0x4'))['db'];var utils=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123651,_0x51be50,_0x48f095){return new BPromise(function(_0x1ec0c8,_0x4a7bd4){return client[_0x5c4f('0xb')](_0x123651,_0x48f095)['then'](function(_0x381d46){logger[_0x5c4f('0xc')](_0x5c4f('0xd'),_0x51be50,_0x5c4f('0xe'));logger[_0x5c4f('0xf')](_0x5c4f('0x10'),_0x51be50,_0x5c4f('0xe'),JSON['stringify'](_0x381d46));if(_0x381d46[_0x5c4f('0x11')]){if(_0x381d46[_0x5c4f('0x11')]['code']===0x1f4){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x4a7bd4(_0x381d46[_0x5c4f('0x11')]['message']);}logger['error'](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x1ec0c8(_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x51be50,_0x5c4f('0xe'));_0x1ec0c8(_0x381d46['result']['message']);}})[_0x5c4f('0x13')](function(_0x5154eb){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x5154eb);_0x4a7bd4(_0x5154eb);});});}exports[_0x5c4f('0x14')]=function(_0x39f21c){var _0x3b6fcc=this;return new Promise(function(_0x35f5fa,_0x661bab){return db[_0x5c4f('0x15')][_0x5c4f('0x16')]({'raw':_0x39f21c['options']?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x18')]===undefined?!![]:![]:!![],'where':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')]['where']||null:null,'attributes':_0x39f21c['options']?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x19')]||null:null,'limit':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x1a')]||null:null,'include':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x1b')]?_['map'](_0x39f21c['options'][_0x5c4f('0x1b')],function(_0x45ae8c){return{'model':db[_0x45ae8c[_0x5c4f('0x1c')]],'as':_0x45ae8c['as'],'attributes':_0x45ae8c[_0x5c4f('0x19')],'include':_0x45ae8c['include']?_[_0x5c4f('0x1d')](_0x45ae8c[_0x5c4f('0x1b')],function(_0x3d4283){return{'model':db[_0x3d4283[_0x5c4f('0x1c')]],'as':_0x3d4283['as'],'attributes':_0x3d4283[_0x5c4f('0x19')],'include':_0x3d4283['include']?_[_0x5c4f('0x1d')](_0x3d4283[_0x5c4f('0x1b')],function(_0x36ca2a){return{'model':db[_0x36ca2a[_0x5c4f('0x1c')]],'as':_0x36ca2a['as'],'attributes':_0x36ca2a[_0x5c4f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5c4f('0x1e')](function(_0x5da4a0){logger[_0x5c4f('0xc')](_0x5c4f('0x14'),_0x39f21c);logger[_0x5c4f('0xf')](_0x5c4f('0x14'),_0x39f21c,JSON['stringify'](_0x5da4a0));_0x35f5fa(_0x5da4a0);})['catch'](function(_0x545b1c){logger[_0x5c4f('0x11')](_0x5c4f('0x14'),_0x545b1c[_0x5c4f('0x12')],_0x39f21c);_0x661bab(_0x3b6fcc[_0x5c4f('0x11')](0x1f4,_0x545b1c[_0x5c4f('0x12')]));});});};exports[_0x5c4f('0x1f')]=function(_0x24732e){var _0x44b2ff=this;return new Promise(function(_0x1cc74d,_0x358dca){return db[_0x5c4f('0x15')][_0x5c4f('0x20')](_0x24732e[_0x5c4f('0x21')],{'raw':_0x24732e['options']?_0x24732e['options'][_0x5c4f('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2297f9){logger[_0x5c4f('0xc')](_0x5c4f('0x1f'),_0x24732e);logger[_0x5c4f('0xf')](_0x5c4f('0x1f'),_0x24732e,JSON[_0x5c4f('0x22')](_0x2297f9));_0x1cc74d(_0x2297f9);})[_0x5c4f('0x13')](function(_0x5da614){logger[_0x5c4f('0x11')](_0x5c4f('0x1f'),_0x5da614[_0x5c4f('0x12')],_0x24732e);_0x358dca(_0x44b2ff['error'](0x1f4,_0x5da614['message']));});});};exports['UpdateMemberReport']=function(_0xc34c59){var _0x1ffc6e=this;return new Promise(function(_0x46b020,_0x1025e2){return db[_0x5c4f('0x15')]['update'](_0xc34c59[_0x5c4f('0x21')],{'raw':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59['options'][_0x5c4f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59['options']['where']||null:null,'attributes':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59[_0x5c4f('0x17')]['attributes']||null:null,'limit':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59[_0x5c4f('0x17')][_0x5c4f('0x1a')]||null:null})[_0x5c4f('0x1e')](function(_0xcbe2b3){logger['info'](_0x5c4f('0x23'),_0xc34c59);logger['debug'](_0x5c4f('0x23'),_0xc34c59,JSON[_0x5c4f('0x22')](_0xcbe2b3));_0x46b020(_0xcbe2b3);})[_0x5c4f('0x13')](function(_0x419c1e){logger[_0x5c4f('0x11')](_0x5c4f('0x23'),_0x419c1e[_0x5c4f('0x12')],_0xc34c59);_0x1025e2(_0x1ffc6e[_0x5c4f('0x11')](0x1f4,_0x419c1e[_0x5c4f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index ae14005..e49df84 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 _0xab7a=['../../components/interaction/service','./migration.controller','get','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x598a58,_0x232f82){var _0x32fff7=function(_0x3c6894){while(--_0x3c6894){_0x598a58['push'](_0x598a58['shift']());}};_0x32fff7(++_0x232f82);}(_0xab7a,0xff));var _0xaab7=function(_0x5dc9ec,_0x407af4){_0x5dc9ec=_0x5dc9ec-0x0;var _0x5b4cdb=_0xab7a[_0x5dc9ec];return _0x5b4cdb;};'use strict';var multer=require('multer');var util=require(_0xaab7('0x0'));var path=require(_0xaab7('0x1'));var timeout=require(_0xaab7('0x2'));var express=require(_0xaab7('0x3'));var router=express['Router']();var fs_extra=require(_0xaab7('0x4'));var auth=require(_0xaab7('0x5'));var interaction=require(_0xaab7('0x6'));var config=require('../../config/environment');var controller=require(_0xaab7('0x7'));router[_0xaab7('0x8')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x1e92=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x5cc655,_0x4b6145){var _0x244379=function(_0x30d2c5){while(--_0x30d2c5){_0x5cc655['push'](_0x5cc655['shift']());}};_0x244379(++_0x4b6145);}(_0x1e92,0x1df));var _0x21e9=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x1e92[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0x21e9('0x0'));var util=require('util');var path=require(_0x21e9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21e9('0x2')]();var fs_extra=require(_0x21e9('0x3'));var auth=require(_0x21e9('0x4'));var interaction=require(_0x21e9('0x5'));var config=require(_0x21e9('0x6'));var controller=require(_0x21e9('0x7'));router[_0x21e9('0x8')]('/',controller[_0x21e9('0x9')]);module[_0x21e9('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 117e45a..cc0a76f 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 _0xac29=['exports','STRING','version','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac29,0x1a3));var _0x9ac2=function(_0x1a4e60,_0x5f5bea){_0x1a4e60=_0x1a4e60-0x0;var _0x1a17f5=_0xac29[_0x1a4e60];return _0x1a17f5;};'use strict';var Sequelize=require(_0x9ac2('0x0'));module[_0x9ac2('0x1')]={'version':{'type':Sequelize[_0x9ac2('0x2')],'unique':_0x9ac2('0x3')}}; \ No newline at end of file +var _0xfe46=['exports','STRING','version'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xfe46,0x117));var _0x6fe4=function(_0x4e8a61,_0x37a359){_0x4e8a61=_0x4e8a61-0x0;var _0x30c0b2=_0xfe46[_0x4e8a61];return _0x30c0b2;};'use strict';var Sequelize=require('sequelize');module[_0x6fe4('0x0')]={'version':{'type':Sequelize[_0x6fe4('0x1')],'unique':_0x6fe4('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 80711c3..606dde8 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 _0x9d7a=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','Migration','rawAttributes','fieldName'];(function(_0x322e51,_0x5e3261){var _0x1cbec9=function(_0x1399b2){while(--_0x1399b2){_0x322e51['push'](_0x322e51['shift']());}};_0x1cbec9(++_0x5e3261);}(_0x9d7a,0x18a));var _0xa9d7=function(_0x3944c1,_0x4cd2e2){_0x3944c1=_0x3944c1-0x0;var _0x275231=_0x9d7a[_0x3944c1];return _0x275231;};'use strict';var emlformat=require(_0xa9d7('0x0'));var rimraf=require(_0xa9d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa9d7('0x2'));var moment=require(_0xa9d7('0x3'));var BPromise=require(_0xa9d7('0x4'));var Mustache=require(_0xa9d7('0x5'));var util=require(_0xa9d7('0x6'));var path=require(_0xa9d7('0x7'));var sox=require(_0xa9d7('0x8'));var csv=require('to-csv');var ejs=require(_0xa9d7('0x9'));var fs=require('fs');var fs_extra=require(_0xa9d7('0xa'));var _=require(_0xa9d7('0xb'));var squel=require(_0xa9d7('0xc'));var crypto=require(_0xa9d7('0xd'));var jsforce=require(_0xa9d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa9d7('0xf'));var querystring=require(_0xa9d7('0x10'));var Papa=require(_0xa9d7('0x11'));var Redis=require(_0xa9d7('0x12'));var authService=require(_0xa9d7('0x13'));var qs=require(_0xa9d7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9d7('0x15'));var logger=require(_0xa9d7('0x16'))(_0xa9d7('0x17'));var utils=require(_0xa9d7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa9d7('0x19'));var db=require(_0xa9d7('0x1a'))['db'];function respondWithStatusCode(_0x49b9b9,_0x1d532a){_0x1d532a=_0x1d532a||0xcc;return function(_0x27ae3f){if(_0x27ae3f){return _0x49b9b9['sendStatus'](_0x1d532a);}return _0x49b9b9[_0xa9d7('0x1b')](_0x1d532a)[_0xa9d7('0x1c')]();};}function respondWithResult(_0x25a99a,_0x12b3f4){_0x12b3f4=_0x12b3f4||0xc8;return function(_0x379a2d){if(_0x379a2d){return _0x25a99a[_0xa9d7('0x1b')](_0x12b3f4)['json'](_0x379a2d);}};}function respondWithFilteredResult(_0x237b41,_0x3298e3){return function(_0x3aafe2){if(_0x3aafe2){var _0x500c3f=typeof _0x3298e3[_0xa9d7('0x1d')]===_0xa9d7('0x1e')&&typeof _0x3298e3['limit']===_0xa9d7('0x1e');var _0x1bcf6a=_0x3aafe2[_0xa9d7('0x1f')];var _0x5ea960=_0x500c3f?0x0:_0x3298e3['offset'];var _0x1e23cd=_0x500c3f?_0x3aafe2[_0xa9d7('0x1f')]:_0x3298e3[_0xa9d7('0x1d')]+_0x3298e3['limit'];var _0x1ff575;if(_0x1e23cd>=_0x1bcf6a){_0x1e23cd=_0x1bcf6a;_0x1ff575=0xc8;}else{_0x1ff575=0xce;}_0x237b41[_0xa9d7('0x1b')](_0x1ff575);return _0x237b41[_0xa9d7('0x20')](_0xa9d7('0x21'),_0x5ea960+'-'+_0x1e23cd+'/'+_0x1bcf6a)[_0xa9d7('0x22')](_0x3aafe2);}return null;};}function patchUpdates(_0x4d41d3){return function(_0x5a1c68){try{jsonpatch[_0xa9d7('0x23')](_0x5a1c68,_0x4d41d3,!![]);}catch(_0x3102e6){return BPromise[_0xa9d7('0x24')](_0x3102e6);}return _0x5a1c68[_0xa9d7('0x25')]();};}function saveUpdates(_0x327f39,_0x5effd7){return function(_0x5d22c7){if(_0x5d22c7){return _0x5d22c7[_0xa9d7('0x26')](_0x327f39)[_0xa9d7('0x27')](function(_0x489afb){return _0x489afb;});}return null;};}function removeEntity(_0x28e3c4,_0x1d0678){return function(_0x3acd06){if(_0x3acd06){return _0x3acd06[_0xa9d7('0x28')]()[_0xa9d7('0x27')](function(){_0x28e3c4[_0xa9d7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x930a59,_0x165c74){return function(_0xe1ec8d){if(!_0xe1ec8d){_0x930a59[_0xa9d7('0x29')](0x194);}return _0xe1ec8d;};}function handleError(_0x4f912a,_0x16ef96){_0x16ef96=_0x16ef96||0x1f4;return function(_0x3b9816){logger[_0xa9d7('0x2a')](_0x3b9816[_0xa9d7('0x2b')]);if(_0x3b9816['name']){delete _0x3b9816[_0xa9d7('0x2c')];}_0x4f912a[_0xa9d7('0x1b')](_0x16ef96)[_0xa9d7('0x2d')](_0x3b9816);};}exports['index']=function(_0x544d49,_0x2e3ba1){var _0x2d92be={},_0x26a78a={},_0x462d78={'count':0x0,'rows':[]};var _0x488459=_[_0xa9d7('0x2e')](db[_0xa9d7('0x2f')][_0xa9d7('0x30')],function(_0x5e342c){return{'name':_0x5e342c[_0xa9d7('0x31')],'type':_0x5e342c['type'][_0xa9d7('0x32')]};});_0x26a78a[_0xa9d7('0x33')]=_[_0xa9d7('0x2e')](_0x488459,_0xa9d7('0x2c'));_0x26a78a[_0xa9d7('0x34')]=_[_0xa9d7('0x35')](_0x544d49[_0xa9d7('0x34')]);_0x26a78a[_0xa9d7('0x36')]=_[_0xa9d7('0x37')](_0x26a78a[_0xa9d7('0x33')],_0x26a78a[_0xa9d7('0x34')]);_0x2d92be[_0xa9d7('0x38')]=_[_0xa9d7('0x37')](_0x26a78a[_0xa9d7('0x33')],qs[_0xa9d7('0x39')](_0x544d49[_0xa9d7('0x34')][_0xa9d7('0x39')]));_0x2d92be[_0xa9d7('0x38')]=_0x2d92be['attributes'][_0xa9d7('0x3a')]?_0x2d92be[_0xa9d7('0x38')]:_0x26a78a[_0xa9d7('0x33')];if(!_0x544d49[_0xa9d7('0x34')][_0xa9d7('0x3b')](_0xa9d7('0x3c'))){_0x2d92be[_0xa9d7('0x3d')]=qs[_0xa9d7('0x3d')](_0x544d49[_0xa9d7('0x34')][_0xa9d7('0x3d')]);_0x2d92be[_0xa9d7('0x1d')]=qs['offset'](_0x544d49[_0xa9d7('0x34')][_0xa9d7('0x1d')]);}_0x2d92be['order']=qs[_0xa9d7('0x3e')](_0x544d49[_0xa9d7('0x34')][_0xa9d7('0x3e')]);_0x2d92be['where']=qs['filters'](_[_0xa9d7('0x3f')](_0x544d49['query'],_0x26a78a[_0xa9d7('0x36')]),_0x488459);if(_0x544d49[_0xa9d7('0x34')][_0xa9d7('0x40')]){_0x2d92be[_0xa9d7('0x41')]=_[_0xa9d7('0x42')](_0x2d92be['where'],{'$or':_[_0xa9d7('0x2e')](_0x488459,function(_0x5441bc){if(_0x5441bc[_0xa9d7('0x43')]!=='VIRTUAL'){var _0x5aff3c={};_0x5aff3c[_0x5441bc[_0xa9d7('0x2c')]]={'$like':'%'+_0x544d49['query'][_0xa9d7('0x40')]+'%'};return _0x5aff3c;}})});}_0x2d92be=_[_0xa9d7('0x42')]({},_0x2d92be,_0x544d49[_0xa9d7('0x44')]);var _0x298fab={'where':_0x2d92be[_0xa9d7('0x41')]};return db[_0xa9d7('0x2f')][_0xa9d7('0x1f')](_0x298fab)['then'](function(_0x2e2861){_0x462d78[_0xa9d7('0x1f')]=_0x2e2861;if(_0x544d49[_0xa9d7('0x34')][_0xa9d7('0x45')]){_0x2d92be[_0xa9d7('0x46')]=[{'all':!![]}];}return db[_0xa9d7('0x2f')][_0xa9d7('0x47')](_0x2d92be);})['then'](function(_0x42605b){_0x462d78[_0xa9d7('0x48')]=_0x42605b;return _0x462d78;})[_0xa9d7('0x27')](respondWithFilteredResult(_0x2e3ba1,_0x2d92be))[_0xa9d7('0x49')](handleError(_0x2e3ba1,null));}; \ No newline at end of file +var _0x8d81=['error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','Migration','includeAll','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d81,0xe4));var _0x18d8=function(_0x2dd5e8,_0x38db2e){_0x2dd5e8=_0x2dd5e8-0x0;var _0x2e8cb8=_0x8d81[_0x2dd5e8];return _0x2e8cb8;};'use strict';var emlformat=require(_0x18d8('0x0'));var rimraf=require(_0x18d8('0x1'));var zipdir=require(_0x18d8('0x2'));var jsonpatch=require(_0x18d8('0x3'));var rp=require(_0x18d8('0x4'));var moment=require(_0x18d8('0x5'));var BPromise=require(_0x18d8('0x6'));var Mustache=require(_0x18d8('0x7'));var util=require(_0x18d8('0x8'));var path=require(_0x18d8('0x9'));var sox=require('sox');var csv=require(_0x18d8('0xa'));var ejs=require(_0x18d8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x18d8('0xc'));var crypto=require('crypto');var jsforce=require(_0x18d8('0xd'));var deskjs=require(_0x18d8('0xe'));var toCsv=require(_0x18d8('0xa'));var querystring=require(_0x18d8('0xf'));var Papa=require(_0x18d8('0x10'));var Redis=require(_0x18d8('0x11'));var authService=require(_0x18d8('0x12'));var qs=require(_0x18d8('0x13'));var as=require(_0x18d8('0x14'));var hardwareService=require(_0x18d8('0x15'));var logger=require(_0x18d8('0x16'))(_0x18d8('0x17'));var utils=require(_0x18d8('0x18'));var config=require(_0x18d8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x18d8('0x1a'))['db'];function respondWithStatusCode(_0x591f3f,_0x56ad9c){_0x56ad9c=_0x56ad9c||0xcc;return function(_0x323a05){if(_0x323a05){return _0x591f3f[_0x18d8('0x1b')](_0x56ad9c);}return _0x591f3f[_0x18d8('0x1c')](_0x56ad9c)['end']();};}function respondWithResult(_0x122ec0,_0x1ecbea){_0x1ecbea=_0x1ecbea||0xc8;return function(_0x294fab){if(_0x294fab){return _0x122ec0[_0x18d8('0x1c')](_0x1ecbea)[_0x18d8('0x1d')](_0x294fab);}};}function respondWithFilteredResult(_0x9f2d36,_0xbfaef2){return function(_0x16c133){if(_0x16c133){var _0x4493a0=typeof _0xbfaef2[_0x18d8('0x1e')]===_0x18d8('0x1f')&&typeof _0xbfaef2['limit']==='undefined';var _0x5d03c9=_0x16c133[_0x18d8('0x20')];var _0x9745b1=_0x4493a0?0x0:_0xbfaef2[_0x18d8('0x1e')];var _0x1834ea=_0x4493a0?_0x16c133['count']:_0xbfaef2[_0x18d8('0x1e')]+_0xbfaef2[_0x18d8('0x21')];var _0x261db9;if(_0x1834ea>=_0x5d03c9){_0x1834ea=_0x5d03c9;_0x261db9=0xc8;}else{_0x261db9=0xce;}_0x9f2d36[_0x18d8('0x1c')](_0x261db9);return _0x9f2d36['set'](_0x18d8('0x22'),_0x9745b1+'-'+_0x1834ea+'/'+_0x5d03c9)[_0x18d8('0x1d')](_0x16c133);}return null;};}function patchUpdates(_0x2fd710){return function(_0x2119fb){try{jsonpatch[_0x18d8('0x23')](_0x2119fb,_0x2fd710,!![]);}catch(_0x56b1a5){return BPromise[_0x18d8('0x24')](_0x56b1a5);}return _0x2119fb[_0x18d8('0x25')]();};}function saveUpdates(_0x1d4d94,_0x249e20){return function(_0x2135ce){if(_0x2135ce){return _0x2135ce['update'](_0x1d4d94)[_0x18d8('0x26')](function(_0x3a389a){return _0x3a389a;});}return null;};}function removeEntity(_0x23b53e,_0x29248e){return function(_0x5e19e5){if(_0x5e19e5){return _0x5e19e5[_0x18d8('0x27')]()[_0x18d8('0x26')](function(){_0x23b53e[_0x18d8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46491d,_0x5b8d93){return function(_0x12b427){if(!_0x12b427){_0x46491d['sendStatus'](0x194);}return _0x12b427;};}function handleError(_0x1b6e17,_0x284e04){_0x284e04=_0x284e04||0x1f4;return function(_0x10d974){logger[_0x18d8('0x28')](_0x10d974['stack']);if(_0x10d974[_0x18d8('0x29')]){delete _0x10d974['name'];}_0x1b6e17['status'](_0x284e04)[_0x18d8('0x2a')](_0x10d974);};}exports[_0x18d8('0x2b')]=function(_0x1dc361,_0x53e320){var _0x4c52dc={},_0x1f8e87={},_0x185a71={'count':0x0,'rows':[]};var _0x576298=_[_0x18d8('0x2c')](db['Migration'][_0x18d8('0x2d')],function(_0x2596f2){return{'name':_0x2596f2[_0x18d8('0x2e')],'type':_0x2596f2['type']['key']};});_0x1f8e87[_0x18d8('0x2f')]=_[_0x18d8('0x2c')](_0x576298,_0x18d8('0x29'));_0x1f8e87[_0x18d8('0x30')]=_[_0x18d8('0x31')](_0x1dc361[_0x18d8('0x30')]);_0x1f8e87[_0x18d8('0x32')]=_[_0x18d8('0x33')](_0x1f8e87[_0x18d8('0x2f')],_0x1f8e87['query']);_0x4c52dc[_0x18d8('0x34')]=_[_0x18d8('0x33')](_0x1f8e87[_0x18d8('0x2f')],qs[_0x18d8('0x35')](_0x1dc361[_0x18d8('0x30')][_0x18d8('0x35')]));_0x4c52dc['attributes']=_0x4c52dc[_0x18d8('0x34')][_0x18d8('0x36')]?_0x4c52dc[_0x18d8('0x34')]:_0x1f8e87['model'];if(!_0x1dc361[_0x18d8('0x30')]['hasOwnProperty']('nolimit')){_0x4c52dc[_0x18d8('0x21')]=qs[_0x18d8('0x21')](_0x1dc361[_0x18d8('0x30')][_0x18d8('0x21')]);_0x4c52dc[_0x18d8('0x1e')]=qs[_0x18d8('0x1e')](_0x1dc361[_0x18d8('0x30')]['offset']);}_0x4c52dc[_0x18d8('0x37')]=qs[_0x18d8('0x38')](_0x1dc361[_0x18d8('0x30')][_0x18d8('0x38')]);_0x4c52dc[_0x18d8('0x39')]=qs[_0x18d8('0x32')](_[_0x18d8('0x3a')](_0x1dc361[_0x18d8('0x30')],_0x1f8e87['filters']),_0x576298);if(_0x1dc361[_0x18d8('0x30')]['filter']){_0x4c52dc['where']=_[_0x18d8('0x3b')](_0x4c52dc[_0x18d8('0x39')],{'$or':_[_0x18d8('0x2c')](_0x576298,function(_0x3a40e9){if(_0x3a40e9['type']!==_0x18d8('0x3c')){var _0x59fbda={};_0x59fbda[_0x3a40e9[_0x18d8('0x29')]]={'$like':'%'+_0x1dc361[_0x18d8('0x30')][_0x18d8('0x3d')]+'%'};return _0x59fbda;}})});}_0x4c52dc=_['merge']({},_0x4c52dc,_0x1dc361[_0x18d8('0x3e')]);var _0x21d53c={'where':_0x4c52dc[_0x18d8('0x39')]};return db[_0x18d8('0x3f')][_0x18d8('0x20')](_0x21d53c)['then'](function(_0xf76518){_0x185a71[_0x18d8('0x20')]=_0xf76518;if(_0x1dc361[_0x18d8('0x30')][_0x18d8('0x40')]){_0x4c52dc[_0x18d8('0x41')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x4c52dc);})[_0x18d8('0x26')](function(_0x8f38d5){_0x185a71[_0x18d8('0x42')]=_0x8f38d5;return _0x185a71;})[_0x18d8('0x26')](respondWithFilteredResult(_0x53e320,_0x4c52dc))['catch'](handleError(_0x53e320,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 29179c2..6d62f63 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 _0xcdde=['migrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xcdde,0x177));var _0xecdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdde[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xecdd('0x0'));var util=require('util');var logger=require(_0xecdd('0x1'))(_0xecdd('0x2'));var moment=require(_0xecdd('0x3'));var BPromise=require(_0xecdd('0x4'));var rp=require(_0xecdd('0x5'));var fs=require('fs');var path=require(_0xecdd('0x6'));var rimraf=require('rimraf');var config=require(_0xecdd('0x7'));var attributes=require(_0xecdd('0x8'));module[_0xecdd('0x9')]=function(_0x3812fb,_0x115580){return _0x3812fb['define']('Migration',attributes,{'tableName':_0xecdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe086=['define','Migration','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe086,0x110));var _0x6e08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe086[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6e08('0x0'));var util=require('util');var logger=require(_0x6e08('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6e08('0x2'));var rp=require(_0x6e08('0x3'));var fs=require('fs');var path=require(_0x6e08('0x4'));var rimraf=require(_0x6e08('0x5'));var config=require(_0x6e08('0x6'));var attributes=require('./migration.attributes');module[_0x6e08('0x7')]=function(_0x1fa672,_0x274635){return _0x1fa672[_0x6e08('0x8')](_0x6e08('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 54a9628..e459638 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 _0xee4f=['Migration,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','client','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4d8808,_0x598d58){var _0x49a099=function(_0x9eea50){while(--_0x9eea50){_0x4d8808['push'](_0x4d8808['shift']());}};_0x49a099(++_0x598d58);}(_0xee4f,0xad));var _0xfee4=function(_0xe92a5f,_0x3084b3){_0xe92a5f=_0xe92a5f-0x0;var _0x2dbbd7=_0xee4f[_0xe92a5f];return _0x2dbbd7;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfee4('0x1'));var rs=require(_0xfee4('0x2'));var fs=require('fs');var Redis=require(_0xfee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee4('0x4'));var logger=require('../../config/logger')(_0xfee4('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfee4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52fb6b,_0x2fb1b3,_0x16cc9a){return new BPromise(function(_0x34908a,_0x4d3c71){return client['request'](_0x52fb6b,_0x16cc9a)[_0xfee4('0x7')](function(_0x11556d){logger[_0xfee4('0x8')]('Migration,\x20%s,\x20%s',_0x2fb1b3,'request\x20sent');logger[_0xfee4('0x9')](_0xfee4('0xa'),_0x2fb1b3,_0xfee4('0xb'),JSON['stringify'](_0x11556d));if(_0x11556d[_0xfee4('0xc')]){if(_0x11556d[_0xfee4('0xc')][_0xfee4('0xd')]===0x1f4){logger[_0xfee4('0xc')](_0xfee4('0xe'),_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x4d3c71(_0x11556d['error'][_0xfee4('0xf')]);}logger[_0xfee4('0xc')]('Migration,\x20%s,\x20%s',_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x34908a(_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);}else{logger[_0xfee4('0x8')](_0xfee4('0xe'),_0x2fb1b3,_0xfee4('0xb'));_0x34908a(_0x11556d['result'][_0xfee4('0xf')]);}})[_0xfee4('0x10')](function(_0x437979){logger['error'](_0xfee4('0xe'),_0x2fb1b3,_0x437979);_0x4d3c71(_0x437979);});});} \ No newline at end of file +var _0x222f=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x55cbb4,_0x39d3c){var _0x50a0b9=function(_0x1140e5){while(--_0x1140e5){_0x55cbb4['push'](_0x55cbb4['shift']());}};_0x50a0b9(++_0x39d3c);}(_0x222f,0x1a4));var _0xf222=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x222f[_0x163040];return _0x364667;};'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')]('Migration,\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);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7055c37..93b65bc 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 _0x6af6=['../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5dda0e,_0x306c23){var _0x19c2af=function(_0x377503){while(--_0x377503){_0x5dda0e['push'](_0x5dda0e['shift']());}};_0x19c2af(++_0x306c23);}(_0x6af6,0x176));var _0x66af=function(_0x1b4286,_0x17b119){_0x1b4286=_0x1b4286-0x0;var _0x45be6e=_0x6af6[_0x1b4286];return _0x45be6e;};'use strict';var multer=require(_0x66af('0x0'));var util=require(_0x66af('0x1'));var path=require(_0x66af('0x2'));var timeout=require(_0x66af('0x3'));var express=require(_0x66af('0x4'));var router=express['Router']();var fs_extra=require(_0x66af('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x66af('0x6'));var config=require(_0x66af('0x7'));var controller=require(_0x66af('0x8'));router[_0x66af('0x9')]('/',auth['isAuthenticated'](),controller[_0x66af('0xa')]);router['get'](_0x66af('0xb'),auth[_0x66af('0xc')](),controller[_0x66af('0xd')]);router[_0x66af('0xe')]('/',auth[_0x66af('0xc')](),controller['create']);router[_0x66af('0xf')](_0x66af('0xb'),auth[_0x66af('0xc')](),controller[_0x66af('0x10')]);router[_0x66af('0x11')](_0x66af('0xb'),auth[_0x66af('0xc')](),controller[_0x66af('0x12')]);module[_0x66af('0x13')]=router; \ No newline at end of file +var _0x4b24=['../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x30e097,_0xefe2bc){var _0x7c0193=function(_0x304ea1){while(--_0x304ea1){_0x30e097['push'](_0x30e097['shift']());}};_0x7c0193(++_0xefe2bc);}(_0x4b24,0x8a));var _0x44b2=function(_0x4bfbd4,_0x1e2b67){_0x4bfbd4=_0x4bfbd4-0x0;var _0x4622e5=_0x4b24[_0x4bfbd4];return _0x4622e5;};'use strict';var multer=require(_0x44b2('0x0'));var util=require(_0x44b2('0x1'));var path=require(_0x44b2('0x2'));var timeout=require(_0x44b2('0x3'));var express=require(_0x44b2('0x4'));var router=express['Router']();var fs_extra=require(_0x44b2('0x5'));var auth=require(_0x44b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x44b2('0x7'));var controller=require('./network.controller');router[_0x44b2('0x8')]('/',auth['isAuthenticated'](),controller[_0x44b2('0x9')]);router[_0x44b2('0x8')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller['show']);router[_0x44b2('0xc')]('/',auth[_0x44b2('0xb')](),controller['create']);router[_0x44b2('0xd')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller[_0x44b2('0xe')]);router[_0x44b2('0xf')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller[_0x44b2('0x10')]);module[_0x44b2('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6b496cb..2ccebda 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 _0x3bc4=['STRING','sequelize','exports','ENUM','localnet','stun'];(function(_0xfe26da,_0x5ac1b7){var _0x2abe6e=function(_0x586ea1){while(--_0x586ea1){_0xfe26da['push'](_0xfe26da['shift']());}};_0x2abe6e(++_0x5ac1b7);}(_0x3bc4,0x1ed));var _0x43bc=function(_0x2b9c0c,_0x4678a3){_0x2b9c0c=_0x2b9c0c-0x0;var _0xd8577b=_0x3bc4[_0x2b9c0c];return _0xd8577b;};'use strict';var Sequelize=require(_0x43bc('0x0'));module[_0x43bc('0x1')]={'type':{'type':Sequelize[_0x43bc('0x2')](_0x43bc('0x3'),'externip',_0x43bc('0x4'),'turn')},'value':{'type':Sequelize[_0x43bc('0x5')]},'username':{'type':Sequelize[_0x43bc('0x5')]},'password':{'type':Sequelize[_0x43bc('0x5')]}}; \ No newline at end of file +var _0x09ec=['exports','ENUM','localnet','STRING','sequelize'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x09ec,0x149));var _0xc09e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x09ec[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xc09e('0x0'));module[_0xc09e('0x1')]={'type':{'type':Sequelize[_0xc09e('0x2')](_0xc09e('0x3'),'externip','stun','turn')},'value':{'type':Sequelize[_0xc09e('0x4')]},'username':{'type':Sequelize[_0xc09e('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index c223b65..5138dd5 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 _0x5541=['code','message','result','catch','sendStatus','status','offset','undefined','count','limit','Content-Range','save','then','end','stack','name','map','Network','rawAttributes','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','include','findAll','rows','show','params','fields','length','includeAll','merge','transaction','create','body','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','update','sequelize','find','/etc/asterisk/sip_xcally_%s.conf','destroy','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x5541,0x1df));var _0x1554=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x5541[_0x267c52];return _0x46c47b;};'use strict';var emlformat=require(_0x1554('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1554('0x1'));var jsonpatch=require(_0x1554('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1554('0x3'));var Mustache=require('mustache');var util=require(_0x1554('0x4'));var path=require(_0x1554('0x5'));var sox=require(_0x1554('0x6'));var csv=require(_0x1554('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1554('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1554('0x9'));var deskjs=require(_0x1554('0xa'));var toCsv=require(_0x1554('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1554('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x1554('0xc'));var as=require(_0x1554('0xd'));var hardwareService=require(_0x1554('0xe'));var logger=require(_0x1554('0xf'))(_0x1554('0x10'));var utils=require(_0x1554('0x11'));var config=require(_0x1554('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1554('0x13'))['db'];var jayson=require(_0x1554('0x14'));var client=jayson[_0x1554('0x15')][_0x1554('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x70b07f,_0x5d4d7d,_0xdf80d0,_0x45230d){return new BPromise(function(_0x5c26ba,_0x52a0eb){var _0x8a318e=_0x45230d||client;return _0x8a318e[_0x1554('0x17')](_0x70b07f,_0xdf80d0)['then'](function(_0x3fbf5b){logger[_0x1554('0x18')](_0x1554('0x19'),_0x5d4d7d,_0x1554('0x1a'));logger[_0x1554('0x1b')](_0x1554('0x1c'),_0x5d4d7d,_0x1554('0x1a'),JSON[_0x1554('0x1d')](_0x3fbf5b));if(_0x3fbf5b[_0x1554('0x1e')]){if(_0x3fbf5b[_0x1554('0x1e')][_0x1554('0x1f')]===0x1f4){logger[_0x1554('0x1e')](_0x1554('0x19'),_0x5d4d7d,_0x3fbf5b['error'][_0x1554('0x20')]);return _0x52a0eb(_0x3fbf5b[_0x1554('0x1e')][_0x1554('0x20')]);}logger[_0x1554('0x1e')](_0x1554('0x19'),_0x5d4d7d,_0x3fbf5b[_0x1554('0x1e')]['message']);return _0x5c26ba(_0x3fbf5b['error'][_0x1554('0x20')]);}else{logger[_0x1554('0x18')](_0x1554('0x19'),_0x5d4d7d,_0x1554('0x1a'));_0x5c26ba(_0x3fbf5b[_0x1554('0x21')][_0x1554('0x20')]);}})[_0x1554('0x22')](function(_0x809915){logger[_0x1554('0x1e')](_0x1554('0x19'),_0x5d4d7d,_0x809915);_0x52a0eb(_0x809915);});});}function respondWithStatusCode(_0x5a1ca5,_0x391c30){_0x391c30=_0x391c30||0xcc;return function(_0x28bf6d){if(_0x28bf6d){return _0x5a1ca5[_0x1554('0x23')](_0x391c30);}return _0x5a1ca5[_0x1554('0x24')](_0x391c30)['end']();};}function respondWithResult(_0x29f6a1,_0x3912f3){_0x3912f3=_0x3912f3||0xc8;return function(_0x4f133b){if(_0x4f133b){return _0x29f6a1[_0x1554('0x24')](_0x3912f3)['json'](_0x4f133b);}};}function respondWithFilteredResult(_0xdb9442,_0x5eaa66){return function(_0x392cf3){if(_0x392cf3){var _0x48e42f=typeof _0x5eaa66[_0x1554('0x25')]===_0x1554('0x26')&&typeof _0x5eaa66['limit']==='undefined';var _0x124482=_0x392cf3[_0x1554('0x27')];var _0x3a8467=_0x48e42f?0x0:_0x5eaa66[_0x1554('0x25')];var _0x2efe7d=_0x48e42f?_0x392cf3[_0x1554('0x27')]:_0x5eaa66['offset']+_0x5eaa66[_0x1554('0x28')];var _0xfb8e2b;if(_0x2efe7d>=_0x124482){_0x2efe7d=_0x124482;_0xfb8e2b=0xc8;}else{_0xfb8e2b=0xce;}_0xdb9442[_0x1554('0x24')](_0xfb8e2b);return _0xdb9442['set'](_0x1554('0x29'),_0x3a8467+'-'+_0x2efe7d+'/'+_0x124482)['json'](_0x392cf3);}return null;};}function patchUpdates(_0x329dd9){return function(_0x5b902e){try{jsonpatch['apply'](_0x5b902e,_0x329dd9,!![]);}catch(_0x379e15){return BPromise['reject'](_0x379e15);}return _0x5b902e[_0x1554('0x2a')]();};}function saveUpdates(_0x590b7c,_0x468567){return function(_0x1ed325){if(_0x1ed325){return _0x1ed325['update'](_0x590b7c)[_0x1554('0x2b')](function(_0x41a1a6){return _0x41a1a6;});}return null;};}function removeEntity(_0x1f3c3b,_0x4303b6){return function(_0x2fc66a){if(_0x2fc66a){return _0x2fc66a['destroy']()[_0x1554('0x2b')](function(){_0x1f3c3b['status'](0xcc)[_0x1554('0x2c')]();});}};}function handleEntityNotFound(_0x49b603,_0x49989c){return function(_0x33fb57){if(!_0x33fb57){_0x49b603[_0x1554('0x23')](0x194);}return _0x33fb57;};}function handleError(_0x411842,_0x3b0506){_0x3b0506=_0x3b0506||0x1f4;return function(_0x57bbb6){logger[_0x1554('0x1e')](_0x57bbb6[_0x1554('0x2d')]);if(_0x57bbb6[_0x1554('0x2e')]){delete _0x57bbb6[_0x1554('0x2e')];}_0x411842[_0x1554('0x24')](_0x3b0506)['send'](_0x57bbb6);};}exports['index']=function(_0x538945,_0x266219){var _0x248507={},_0x433b3b={},_0x2c9b6b={'count':0x0,'rows':[]};var _0x3d4a1a=_[_0x1554('0x2f')](db[_0x1554('0x30')][_0x1554('0x31')],function(_0x2b35f0){return{'name':_0x2b35f0['fieldName'],'type':_0x2b35f0[_0x1554('0x32')]['key']};});_0x433b3b[_0x1554('0x33')]=_[_0x1554('0x2f')](_0x3d4a1a,_0x1554('0x2e'));_0x433b3b[_0x1554('0x34')]=_[_0x1554('0x35')](_0x538945[_0x1554('0x34')]);_0x433b3b[_0x1554('0x36')]=_[_0x1554('0x37')](_0x433b3b[_0x1554('0x33')],_0x433b3b[_0x1554('0x34')]);_0x248507[_0x1554('0x38')]=_[_0x1554('0x37')](_0x433b3b[_0x1554('0x33')],qs['fields'](_0x538945[_0x1554('0x34')]['fields']));_0x248507[_0x1554('0x38')]=_0x248507[_0x1554('0x38')]['length']?_0x248507[_0x1554('0x38')]:_0x433b3b[_0x1554('0x33')];if(!_0x538945['query'][_0x1554('0x39')](_0x1554('0x3a'))){_0x248507[_0x1554('0x28')]=qs[_0x1554('0x28')](_0x538945[_0x1554('0x34')]['limit']);_0x248507[_0x1554('0x25')]=qs[_0x1554('0x25')](_0x538945[_0x1554('0x34')][_0x1554('0x25')]);}_0x248507[_0x1554('0x3b')]=qs[_0x1554('0x3c')](_0x538945[_0x1554('0x34')]['sort']);_0x248507[_0x1554('0x3d')]=qs['filters'](_[_0x1554('0x3e')](_0x538945[_0x1554('0x34')],_0x433b3b[_0x1554('0x36')]),_0x3d4a1a);if(_0x538945[_0x1554('0x34')]['filter']){_0x248507[_0x1554('0x3d')]=_['merge'](_0x248507[_0x1554('0x3d')],{'$or':_[_0x1554('0x2f')](_0x3d4a1a,function(_0x42b713){if(_0x42b713['type']!==_0x1554('0x3f')){var _0xe908a0={};_0xe908a0[_0x42b713[_0x1554('0x2e')]]={'$like':'%'+_0x538945[_0x1554('0x34')][_0x1554('0x40')]+'%'};return _0xe908a0;}})});}_0x248507=_['merge']({},_0x248507,_0x538945[_0x1554('0x41')]);var _0x34b0d1={'where':_0x248507[_0x1554('0x3d')]};return db[_0x1554('0x30')]['count'](_0x34b0d1)[_0x1554('0x2b')](function(_0x50ae68){_0x2c9b6b[_0x1554('0x27')]=_0x50ae68;if(_0x538945['query']['includeAll']){_0x248507[_0x1554('0x42')]=[{'all':!![]}];}return db[_0x1554('0x30')][_0x1554('0x43')](_0x248507);})['then'](function(_0x362185){_0x2c9b6b[_0x1554('0x44')]=_0x362185;return _0x2c9b6b;})[_0x1554('0x2b')](respondWithFilteredResult(_0x266219,_0x248507))[_0x1554('0x22')](handleError(_0x266219,null));};exports[_0x1554('0x45')]=function(_0x40786a,_0x48c439){var _0x5c0481={'raw':!![],'where':{'id':_0x40786a[_0x1554('0x46')]['id']}},_0x1e3cff={};_0x1e3cff[_0x1554('0x33')]=_['keys'](db[_0x1554('0x30')]['rawAttributes']);_0x1e3cff[_0x1554('0x34')]=_[_0x1554('0x35')](_0x40786a[_0x1554('0x34')]);_0x1e3cff['filters']=_[_0x1554('0x37')](_0x1e3cff[_0x1554('0x33')],_0x1e3cff[_0x1554('0x34')]);_0x5c0481[_0x1554('0x38')]=_[_0x1554('0x37')](_0x1e3cff[_0x1554('0x33')],qs[_0x1554('0x47')](_0x40786a['query'][_0x1554('0x47')]));_0x5c0481['attributes']=_0x5c0481['attributes'][_0x1554('0x48')]?_0x5c0481[_0x1554('0x38')]:_0x1e3cff['model'];if(_0x40786a['query'][_0x1554('0x49')]){_0x5c0481[_0x1554('0x42')]=[{'all':!![]}];}_0x5c0481=_[_0x1554('0x4a')]({},_0x5c0481,_0x40786a[_0x1554('0x41')]);return db[_0x1554('0x30')]['find'](_0x5c0481)['then'](handleEntityNotFound(_0x48c439,null))[_0x1554('0x2b')](respondWithResult(_0x48c439,null))['catch'](handleError(_0x48c439,null));};exports['create']=function(_0x44ba99,_0xcfe6e6,_0x564d38){var _0x45ab03;return db['sequelize'][_0x1554('0x4b')](function(_0x98aef3){return db[_0x1554('0x30')][_0x1554('0x4c')](_0x44ba99['body'],{'raw':!![]})[_0x1554('0x2b')](function(_0x565330){_0x45ab03=_0x565330;return db[_0x1554('0x30')][_0x1554('0x43')]({'where':{'type':_0x44ba99[_0x1554('0x4d')][_0x1554('0x32')]},'raw':!![]});})[_0x1554('0x2b')](function(_0x363f2e){if(_0x45ab03['type']['toUpperCase']()==_0x1554('0x4e')){var _0x367509=fs[_0x1554('0x4f')](path[_0x1554('0x50')](config['root'],_0x1554('0x51')),_0x1554('0x52'));var _0x4739f2=ejs[_0x1554('0x53')](_0x367509,{'networks':_0x363f2e||[]});fs['writeFileSync'](_0x1554('0x54'),_0x4739f2);return respondWithRpcPromise(_0x1554('0x55'),'create',{'module':'res_stun_monitor.so'});}else if(_0x45ab03[_0x1554('0x32')][_0x1554('0x56')]()==_0x1554('0x57')){var _0x47be08=fs['readFileSync'](path[_0x1554('0x50')](config[_0x1554('0x58')],_0x1554('0x59')),_0x1554('0x52'));var _0x5015a2=ejs[_0x1554('0x53')](_0x47be08,{'networks':_0x363f2e||[]});fs[_0x1554('0x5a')](_0x1554('0x5b'),_0x5015a2);return respondWithRpcPromise(_0x1554('0x55'),_0x1554('0x4c'),{'module':_0x1554('0x5c')});}else{var _0x3d56a7=fs[_0x1554('0x4f')](path['join'](config['root'],_0x1554('0x5d')),_0x1554('0x52'));var _0x4105d6=ejs[_0x1554('0x53')](_0x3d56a7,{'networks':_0x363f2e||[]});fs['writeFileSync'](util[_0x1554('0x5e')]('/etc/asterisk/sip_xcally_%s.conf',_0x44ba99['body'][_0x1554('0x32')][_0x1554('0x5f')]()),_0x4105d6);return respondWithRpcPromise(_0x1554('0x55'),_0x1554('0x4c'),{'module':_0x1554('0x60')});}return null;})[_0x1554('0x2b')](function(){return _0x45ab03;});})['then'](respondWithResult(_0xcfe6e6,0xc9))[_0x1554('0x22')](handleError(_0xcfe6e6,null));};exports[_0x1554('0x61')]=function(_0x15889d,_0x58a098,_0x27a704){var _0x46e7cc;return db[_0x1554('0x62')][_0x1554('0x4b')](function(_0x30bde9){return db['Network'][_0x1554('0x63')]({'where':{'id':_0x15889d[_0x1554('0x46')]['id']}})['then'](handleEntityNotFound(_0x58a098,null))['then'](saveUpdates(_0x15889d['body'],null))['then'](function(_0x36d416){if(_0x36d416){_0x46e7cc=_0x36d416;return db[_0x1554('0x30')][_0x1554('0x43')]({'where':{'type':_0x46e7cc['type']},'raw':!![]});}return null;})['then'](function(_0x2eb9a1){if(_0x46e7cc[_0x1554('0x32')][_0x1554('0x56')]()=='STUN'){var _0x16a005=fs[_0x1554('0x4f')](path[_0x1554('0x50')](config[_0x1554('0x58')],_0x1554('0x51')),_0x1554('0x52'));var _0xe26ad7=ejs['render'](_0x16a005,{'networks':_0x2eb9a1||[]});fs[_0x1554('0x5a')](_0x1554('0x54'),_0xe26ad7);return respondWithRpcPromise(_0x1554('0x55'),'update',{'module':_0x1554('0x5c')});}else if(_0x46e7cc[_0x1554('0x32')][_0x1554('0x56')]()==_0x1554('0x57')){var _0x6b2633=fs['readFileSync'](path[_0x1554('0x50')](config['root'],_0x1554('0x59')),_0x1554('0x52'));var _0x39b201=ejs[_0x1554('0x53')](_0x6b2633,{'networks':_0x2eb9a1||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x39b201);return respondWithRpcPromise('Reload',_0x1554('0x61'),{'module':'res_stun_monitor.so'});}else{var _0x135d72=fs[_0x1554('0x4f')](path[_0x1554('0x50')](config[_0x1554('0x58')],_0x1554('0x5d')),_0x1554('0x52'));var _0x82e579=ejs[_0x1554('0x53')](_0x135d72,{'networks':_0x2eb9a1||[]});fs[_0x1554('0x5a')](util[_0x1554('0x5e')](_0x1554('0x64'),_0x15889d['body'][_0x1554('0x32')][_0x1554('0x5f')]()),_0x82e579);return respondWithRpcPromise(_0x1554('0x55'),'update',{'module':_0x1554('0x60')});}return null;})[_0x1554('0x2b')](function(_0x3bca2c){if(_0x3bca2c){return _0x46e7cc;}return null;});})[_0x1554('0x2b')](respondWithResult(_0x58a098,null))[_0x1554('0x22')](handleError(_0x58a098,null));};exports[_0x1554('0x65')]=function(_0x18854a,_0x308edb,_0x40b5ec){var _0x15be7c;return db[_0x1554('0x30')]['find']({'where':{'id':_0x18854a[_0x1554('0x46')]['id']}})['then'](function(_0x4c96e3){_0x15be7c=_0x4c96e3;return _0x4c96e3;})[_0x1554('0x2b')](handleEntityNotFound(_0x308edb,null))['then'](removeEntity(_0x308edb,null))[_0x1554('0x2b')](function(){if(_0x15be7c){return db[_0x1554('0x30')][_0x1554('0x43')]({'where':{'type':_0x15be7c[_0x1554('0x32')]},'raw':!![]});}})['then'](function(_0x3994c1){if(_0x15be7c[_0x1554('0x32')][_0x1554('0x56')]()==_0x1554('0x4e')){var _0x552940=fs[_0x1554('0x4f')](path[_0x1554('0x50')](config[_0x1554('0x58')],_0x1554('0x51')),_0x1554('0x52'));var _0x4c7750=ejs[_0x1554('0x53')](_0x552940,{'networks':_0x3994c1||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4c7750);return respondWithRpcPromise(_0x1554('0x55'),_0x1554('0x65'),{'module':_0x1554('0x5c')});}else if(_0x15be7c[_0x1554('0x32')]['toUpperCase']()=='TURN'){var _0x1e4ae1=fs[_0x1554('0x4f')](path[_0x1554('0x50')](config[_0x1554('0x58')],_0x1554('0x59')),_0x1554('0x52'));var _0x38a22b=ejs[_0x1554('0x53')](_0x1e4ae1,{'networks':_0x3994c1||[]});fs[_0x1554('0x5a')](_0x1554('0x5b'),_0x38a22b);return respondWithRpcPromise(_0x1554('0x55'),_0x1554('0x65'),{'module':_0x1554('0x5c')});}else{var _0x3ea0db=fs[_0x1554('0x4f')](path[_0x1554('0x50')](config[_0x1554('0x58')],'server/files/templates/network.ejs'),_0x1554('0x52'));var _0x247e20=ejs[_0x1554('0x53')](_0x3ea0db,{'networks':_0x3994c1||[]});fs[_0x1554('0x5a')](util['format'](_0x1554('0x64'),_0x18854a['body'][_0x1554('0x32')][_0x1554('0x5f')]()),_0x247e20);return respondWithRpcPromise('Reload',_0x1554('0x65'),{'module':'chan_sip.so'});}return null;})[_0x1554('0x22')](handleError(_0x308edb,null));}; \ No newline at end of file +var _0x3105=['readFileSync','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','writeFileSync','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','TURN','format','destroy','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','stack','name','send','Network','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','params','include','options','find','create','sequelize','transaction','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','render','Reload'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x3105,0x7e));var _0x5310=function(_0x168d67,_0xdeffbe){_0x168d67=_0x168d67-0x0;var _0x3f130a=_0x3105[_0x168d67];return _0x3f130a;};'use strict';var emlformat=require(_0x5310('0x0'));var rimraf=require(_0x5310('0x1'));var zipdir=require(_0x5310('0x2'));var jsonpatch=require(_0x5310('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5310('0x4'));var Mustache=require(_0x5310('0x5'));var util=require(_0x5310('0x6'));var path=require('path');var sox=require(_0x5310('0x7'));var csv=require(_0x5310('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5310('0x9'));var squel=require(_0x5310('0xa'));var crypto=require(_0x5310('0xb'));var jsforce=require(_0x5310('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5310('0x8'));var querystring=require(_0x5310('0xd'));var Papa=require(_0x5310('0xe'));var Redis=require(_0x5310('0xf'));var authService=require(_0x5310('0x10'));var qs=require(_0x5310('0x11'));var as=require(_0x5310('0x12'));var hardwareService=require(_0x5310('0x13'));var logger=require(_0x5310('0x14'))(_0x5310('0x15'));var utils=require(_0x5310('0x16'));var config=require(_0x5310('0x17'));var licenseUtil=require(_0x5310('0x18'));var db=require(_0x5310('0x19'))['db'];var jayson=require(_0x5310('0x1a'));var client=jayson[_0x5310('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x169127,_0x3fc46a,_0x4b2eab,_0x5562e9){return new BPromise(function(_0x262085,_0x7cb71c){var _0x37478d=_0x5562e9||client;return _0x37478d[_0x5310('0x1c')](_0x169127,_0x4b2eab)[_0x5310('0x1d')](function(_0x4f772){logger[_0x5310('0x1e')](_0x5310('0x1f'),_0x3fc46a,_0x5310('0x20'));logger[_0x5310('0x21')](_0x5310('0x22'),_0x3fc46a,_0x5310('0x20'),JSON[_0x5310('0x23')](_0x4f772));if(_0x4f772[_0x5310('0x24')]){if(_0x4f772[_0x5310('0x24')][_0x5310('0x25')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x3fc46a,_0x4f772[_0x5310('0x24')][_0x5310('0x26')]);return _0x7cb71c(_0x4f772['error'][_0x5310('0x26')]);}logger['error'](_0x5310('0x1f'),_0x3fc46a,_0x4f772[_0x5310('0x24')]['message']);return _0x262085(_0x4f772[_0x5310('0x24')]['message']);}else{logger[_0x5310('0x1e')](_0x5310('0x1f'),_0x3fc46a,_0x5310('0x20'));_0x262085(_0x4f772[_0x5310('0x27')][_0x5310('0x26')]);}})[_0x5310('0x28')](function(_0x1a9c89){logger[_0x5310('0x24')](_0x5310('0x1f'),_0x3fc46a,_0x1a9c89);_0x7cb71c(_0x1a9c89);});});}function respondWithStatusCode(_0x1e0e87,_0x4a78f3){_0x4a78f3=_0x4a78f3||0xcc;return function(_0x4902a1){if(_0x4902a1){return _0x1e0e87[_0x5310('0x29')](_0x4a78f3);}return _0x1e0e87['status'](_0x4a78f3)[_0x5310('0x2a')]();};}function respondWithResult(_0x3ebf88,_0x5e9db0){_0x5e9db0=_0x5e9db0||0xc8;return function(_0x19fbca){if(_0x19fbca){return _0x3ebf88[_0x5310('0x2b')](_0x5e9db0)[_0x5310('0x2c')](_0x19fbca);}};}function respondWithFilteredResult(_0x2db375,_0x59a143){return function(_0x362258){if(_0x362258){var _0x453e17=typeof _0x59a143[_0x5310('0x2d')]===_0x5310('0x2e')&&typeof _0x59a143[_0x5310('0x2f')]===_0x5310('0x2e');var _0x573dfc=_0x362258[_0x5310('0x30')];var _0x2da5f7=_0x453e17?0x0:_0x59a143[_0x5310('0x2d')];var _0x1c1b72=_0x453e17?_0x362258['count']:_0x59a143[_0x5310('0x2d')]+_0x59a143[_0x5310('0x2f')];var _0x3b94d5;if(_0x1c1b72>=_0x573dfc){_0x1c1b72=_0x573dfc;_0x3b94d5=0xc8;}else{_0x3b94d5=0xce;}_0x2db375[_0x5310('0x2b')](_0x3b94d5);return _0x2db375[_0x5310('0x31')](_0x5310('0x32'),_0x2da5f7+'-'+_0x1c1b72+'/'+_0x573dfc)['json'](_0x362258);}return null;};}function patchUpdates(_0x346135){return function(_0x2e9580){try{jsonpatch['apply'](_0x2e9580,_0x346135,!![]);}catch(_0x2f4e64){return BPromise[_0x5310('0x33')](_0x2f4e64);}return _0x2e9580[_0x5310('0x34')]();};}function saveUpdates(_0x21ac9c,_0x3d9022){return function(_0x15d84d){if(_0x15d84d){return _0x15d84d[_0x5310('0x35')](_0x21ac9c)['then'](function(_0x3b2759){return _0x3b2759;});}return null;};}function removeEntity(_0x321eff,_0x4afbff){return function(_0x5261ed){if(_0x5261ed){return _0x5261ed['destroy']()[_0x5310('0x1d')](function(){_0x321eff[_0x5310('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c7c18,_0x1d55cc){return function(_0x40b2cd){if(!_0x40b2cd){_0x8c7c18[_0x5310('0x29')](0x194);}return _0x40b2cd;};}function handleError(_0x3fdf34,_0x3f60ef){_0x3f60ef=_0x3f60ef||0x1f4;return function(_0xf3f91e){logger['error'](_0xf3f91e[_0x5310('0x36')]);if(_0xf3f91e['name']){delete _0xf3f91e[_0x5310('0x37')];}_0x3fdf34[_0x5310('0x2b')](_0x3f60ef)[_0x5310('0x38')](_0xf3f91e);};}exports['index']=function(_0x574311,_0x5c9822){var _0x6635b1={},_0x537428={},_0x4adf34={'count':0x0,'rows':[]};var _0x4110db=_['map'](db[_0x5310('0x39')][_0x5310('0x3a')],function(_0x12d1cd){return{'name':_0x12d1cd[_0x5310('0x3b')],'type':_0x12d1cd['type'][_0x5310('0x3c')]};});_0x537428['model']=_[_0x5310('0x3d')](_0x4110db,_0x5310('0x37'));_0x537428['query']=_[_0x5310('0x3e')](_0x574311[_0x5310('0x3f')]);_0x537428[_0x5310('0x40')]=_[_0x5310('0x41')](_0x537428['model'],_0x537428[_0x5310('0x3f')]);_0x6635b1['attributes']=_[_0x5310('0x41')](_0x537428[_0x5310('0x42')],qs[_0x5310('0x43')](_0x574311['query'][_0x5310('0x43')]));_0x6635b1[_0x5310('0x44')]=_0x6635b1[_0x5310('0x44')][_0x5310('0x45')]?_0x6635b1['attributes']:_0x537428['model'];if(!_0x574311[_0x5310('0x3f')][_0x5310('0x46')](_0x5310('0x47'))){_0x6635b1[_0x5310('0x2f')]=qs[_0x5310('0x2f')](_0x574311[_0x5310('0x3f')][_0x5310('0x2f')]);_0x6635b1[_0x5310('0x2d')]=qs[_0x5310('0x2d')](_0x574311[_0x5310('0x3f')][_0x5310('0x2d')]);}_0x6635b1[_0x5310('0x48')]=qs[_0x5310('0x49')](_0x574311[_0x5310('0x3f')][_0x5310('0x49')]);_0x6635b1[_0x5310('0x4a')]=qs['filters'](_['pick'](_0x574311[_0x5310('0x3f')],_0x537428[_0x5310('0x40')]),_0x4110db);if(_0x574311[_0x5310('0x3f')][_0x5310('0x4b')]){_0x6635b1[_0x5310('0x4a')]=_[_0x5310('0x4c')](_0x6635b1['where'],{'$or':_[_0x5310('0x3d')](_0x4110db,function(_0x5223f6){if(_0x5223f6[_0x5310('0x4d')]!==_0x5310('0x4e')){var _0x10c02d={};_0x10c02d[_0x5223f6['name']]={'$like':'%'+_0x574311[_0x5310('0x3f')][_0x5310('0x4b')]+'%'};return _0x10c02d;}})});}_0x6635b1=_[_0x5310('0x4c')]({},_0x6635b1,_0x574311['options']);var _0x4cc207={'where':_0x6635b1['where']};return db[_0x5310('0x39')][_0x5310('0x30')](_0x4cc207)[_0x5310('0x1d')](function(_0x1e8ed3){_0x4adf34[_0x5310('0x30')]=_0x1e8ed3;if(_0x574311['query'][_0x5310('0x4f')]){_0x6635b1['include']=[{'all':!![]}];}return db[_0x5310('0x39')][_0x5310('0x50')](_0x6635b1);})[_0x5310('0x1d')](function(_0x37e56a){_0x4adf34[_0x5310('0x51')]=_0x37e56a;return _0x4adf34;})[_0x5310('0x1d')](respondWithFilteredResult(_0x5c9822,_0x6635b1))[_0x5310('0x28')](handleError(_0x5c9822,null));};exports['show']=function(_0x408372,_0x10b8e5){var _0x58d30a={'raw':!![],'where':{'id':_0x408372[_0x5310('0x52')]['id']}},_0x273535={};_0x273535['model']=_[_0x5310('0x3e')](db[_0x5310('0x39')]['rawAttributes']);_0x273535['query']=_['keys'](_0x408372[_0x5310('0x3f')]);_0x273535[_0x5310('0x40')]=_[_0x5310('0x41')](_0x273535[_0x5310('0x42')],_0x273535[_0x5310('0x3f')]);_0x58d30a['attributes']=_[_0x5310('0x41')](_0x273535[_0x5310('0x42')],qs['fields'](_0x408372[_0x5310('0x3f')][_0x5310('0x43')]));_0x58d30a['attributes']=_0x58d30a[_0x5310('0x44')][_0x5310('0x45')]?_0x58d30a[_0x5310('0x44')]:_0x273535[_0x5310('0x42')];if(_0x408372[_0x5310('0x3f')]['includeAll']){_0x58d30a[_0x5310('0x53')]=[{'all':!![]}];}_0x58d30a=_['merge']({},_0x58d30a,_0x408372[_0x5310('0x54')]);return db[_0x5310('0x39')][_0x5310('0x55')](_0x58d30a)[_0x5310('0x1d')](handleEntityNotFound(_0x10b8e5,null))['then'](respondWithResult(_0x10b8e5,null))[_0x5310('0x28')](handleError(_0x10b8e5,null));};exports[_0x5310('0x56')]=function(_0x131b04,_0x36522f,_0x35f1f8){var _0x4006ac;return db[_0x5310('0x57')][_0x5310('0x58')](function(_0x466944){return db['Network'][_0x5310('0x56')](_0x131b04[_0x5310('0x59')],{'raw':!![]})['then'](function(_0x4202a2){_0x4006ac=_0x4202a2;return db[_0x5310('0x39')][_0x5310('0x50')]({'where':{'type':_0x131b04['body']['type']},'raw':!![]});})[_0x5310('0x1d')](function(_0x315db1){if(_0x4006ac[_0x5310('0x4d')][_0x5310('0x5a')]()==_0x5310('0x5b')){var _0x222588=fs['readFileSync'](path[_0x5310('0x5c')](config['root'],_0x5310('0x5d')),'utf8');var _0x2a4bda=ejs[_0x5310('0x5e')](_0x222588,{'networks':_0x315db1||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2a4bda);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x56'),{'module':'res_stun_monitor.so'});}else if(_0x4006ac['type'][_0x5310('0x5a')]()=='TURN'){var _0x495020=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config[_0x5310('0x61')],_0x5310('0x62')),_0x5310('0x63'));var _0x55c707=ejs[_0x5310('0x5e')](_0x495020,{'networks':_0x315db1||[]});fs['writeFileSync'](_0x5310('0x64'),_0x55c707);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x56'),{'module':_0x5310('0x65')});}else{var _0x4163ea=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config['root'],_0x5310('0x66')),_0x5310('0x63'));var _0xe40358=ejs['render'](_0x4163ea,{'networks':_0x315db1||[]});fs[_0x5310('0x67')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x131b04[_0x5310('0x59')][_0x5310('0x4d')][_0x5310('0x68')]()),_0xe40358);return respondWithRpcPromise('Reload',_0x5310('0x56'),{'module':_0x5310('0x69')});}return null;})['then'](function(){return _0x4006ac;});})['then'](respondWithResult(_0x36522f,0xc9))[_0x5310('0x28')](handleError(_0x36522f,null));};exports[_0x5310('0x35')]=function(_0x2d67aa,_0x3ce22c,_0xde3688){var _0x3cceff;return db['sequelize'][_0x5310('0x58')](function(_0x41459a){return db['Network'][_0x5310('0x55')]({'where':{'id':_0x2d67aa[_0x5310('0x52')]['id']}})[_0x5310('0x1d')](handleEntityNotFound(_0x3ce22c,null))[_0x5310('0x1d')](saveUpdates(_0x2d67aa[_0x5310('0x59')],null))[_0x5310('0x1d')](function(_0x5f35d7){if(_0x5f35d7){_0x3cceff=_0x5f35d7;return db[_0x5310('0x39')]['findAll']({'where':{'type':_0x3cceff['type']},'raw':!![]});}return null;})[_0x5310('0x1d')](function(_0x123746){if(_0x3cceff['type'][_0x5310('0x5a')]()==_0x5310('0x5b')){var _0x27e84d=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config[_0x5310('0x61')],'server/files/templates/stun_multiple.ejs'),_0x5310('0x63'));var _0x2f2aa7=ejs['render'](_0x27e84d,{'networks':_0x123746||[]});fs[_0x5310('0x67')](_0x5310('0x6a'),_0x2f2aa7);return respondWithRpcPromise(_0x5310('0x5f'),'update',{'module':_0x5310('0x65')});}else if(_0x3cceff['type'][_0x5310('0x5a')]()==_0x5310('0x6b')){var _0x46507c=fs['readFileSync'](path['join'](config[_0x5310('0x61')],_0x5310('0x62')),_0x5310('0x63'));var _0x5fe4ea=ejs[_0x5310('0x5e')](_0x46507c,{'networks':_0x123746||[]});fs[_0x5310('0x67')](_0x5310('0x64'),_0x5fe4ea);return respondWithRpcPromise(_0x5310('0x5f'),'update',{'module':'res_stun_monitor.so'});}else{var _0x490cf5=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config['root'],_0x5310('0x66')),_0x5310('0x63'));var _0x4633a6=ejs['render'](_0x490cf5,{'networks':_0x123746||[]});fs[_0x5310('0x67')](util[_0x5310('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0x2d67aa['body'][_0x5310('0x4d')][_0x5310('0x68')]()),_0x4633a6);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x35'),{'module':_0x5310('0x69')});}return null;})[_0x5310('0x1d')](function(_0x2c3e6e){if(_0x2c3e6e){return _0x3cceff;}return null;});})['then'](respondWithResult(_0x3ce22c,null))[_0x5310('0x28')](handleError(_0x3ce22c,null));};exports[_0x5310('0x6d')]=function(_0xf4ae48,_0xa4eac4,_0x5effd2){var _0x51770e;return db[_0x5310('0x39')][_0x5310('0x55')]({'where':{'id':_0xf4ae48[_0x5310('0x52')]['id']}})[_0x5310('0x1d')](function(_0x543722){_0x51770e=_0x543722;return _0x543722;})[_0x5310('0x1d')](handleEntityNotFound(_0xa4eac4,null))['then'](removeEntity(_0xa4eac4,null))[_0x5310('0x1d')](function(){if(_0x51770e){return db[_0x5310('0x39')][_0x5310('0x50')]({'where':{'type':_0x51770e[_0x5310('0x4d')]},'raw':!![]});}})[_0x5310('0x1d')](function(_0xb8bbc6){if(_0x51770e['type'][_0x5310('0x5a')]()==_0x5310('0x5b')){var _0x54c758=fs[_0x5310('0x60')](path['join'](config[_0x5310('0x61')],_0x5310('0x5d')),_0x5310('0x63'));var _0x23f5ef=ejs['render'](_0x54c758,{'networks':_0xb8bbc6||[]});fs[_0x5310('0x67')](_0x5310('0x6a'),_0x23f5ef);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x6d'),{'module':'res_stun_monitor.so'});}else if(_0x51770e['type'][_0x5310('0x5a')]()==_0x5310('0x6b')){var _0x16fcdf=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config[_0x5310('0x61')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2fdd92=ejs[_0x5310('0x5e')](_0x16fcdf,{'networks':_0xb8bbc6||[]});fs[_0x5310('0x67')](_0x5310('0x64'),_0x2fdd92);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x6d'),{'module':_0x5310('0x65')});}else{var _0x354a10=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config[_0x5310('0x61')],_0x5310('0x66')),_0x5310('0x63'));var _0x1307e0=ejs[_0x5310('0x5e')](_0x354a10,{'networks':_0xb8bbc6||[]});fs[_0x5310('0x67')](util[_0x5310('0x6c')](_0x5310('0x6e'),_0xf4ae48[_0x5310('0x59')]['type']['toLowerCase']()),_0x1307e0);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x6d'),{'module':'chan_sip.so'});}return null;})[_0x5310('0x28')](handleError(_0xa4eac4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7b34fbc..e6855ee 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 _0xa902=['../../config/logger','api','moment','request-promise','../../config/environment','./network.attributes','exports','define','network','lodash','util'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa902,0x8d));var _0x2a90=function(_0x27180e,_0x589055){_0x27180e=_0x27180e-0x0;var _0x3b478c=_0xa902[_0x27180e];return _0x3b478c;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var moment=require(_0x2a90('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a90('0x6'));var attributes=require(_0x2a90('0x7'));module[_0x2a90('0x8')]=function(_0x21e1d2,_0x4a32c7){return _0x21e1d2[_0x2a90('0x9')]('Network',attributes,{'tableName':_0x2a90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x702d=['exports','define','Network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x503798,_0x3af578){var _0x761bfa=function(_0x3f44ca){while(--_0x3f44ca){_0x503798['push'](_0x503798['shift']());}};_0x761bfa(++_0x3af578);}(_0x702d,0x147));var _0xd702=function(_0x21be95,_0x4fb14e){_0x21be95=_0x21be95-0x0;var _0x4c9910=_0x702d[_0x21be95];return _0x4c9910;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./network.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 39fd045..89ac967 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x31668e,_0x3969f6){_0x31668e=_0x31668e-0x0;var _0x20e8b2=_0x7a54[_0x31668e];return _0x20e8b2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x116a72,_0x3a950e){_0x116a72=_0x116a72-0x0;var _0x5c68b1=_0x7a54[_0x116a72];return _0x5c68b1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index fef9948..46d3d29 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 _0x85b1=['index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','create','post','/:id/notify','notify','addApplications','/:id/send','send','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x85b1,0x153));var _0x185b=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x85b1[_0x20ef64];return _0x3707d8;};'use strict';var multer=require(_0x185b('0x0'));var util=require(_0x185b('0x1'));var path=require(_0x185b('0x2'));var timeout=require(_0x185b('0x3'));var express=require(_0x185b('0x4'));var router=express[_0x185b('0x5')]();var fs_extra=require(_0x185b('0x6'));var auth=require(_0x185b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x185b('0x8'));router[_0x185b('0x9')]('/',auth[_0x185b('0xa')](),controller[_0x185b('0xb')]);router[_0x185b('0x9')](_0x185b('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x185b('0xd'),auth[_0x185b('0xa')](),controller['show']);router[_0x185b('0x9')](_0x185b('0xe'),auth['isAuthenticated'](),controller[_0x185b('0xf')]);router[_0x185b('0x9')](_0x185b('0x10'),auth[_0x185b('0xa')](),controller['getAnswers']);router[_0x185b('0x9')](_0x185b('0x11'),auth['isAuthenticated'](),controller[_0x185b('0x12')]);router[_0x185b('0x9')]('/:id/interactions',auth[_0x185b('0xa')](),controller[_0x185b('0x13')]);router['get'](_0x185b('0x14'),auth[_0x185b('0xa')](),controller[_0x185b('0x15')]);router['post']('/',auth[_0x185b('0xa')](),controller[_0x185b('0x16')]);router[_0x185b('0x17')](_0x185b('0xe'),auth[_0x185b('0xa')](),controller['addDisposition']);router[_0x185b('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x185b('0x17')](_0x185b('0x18'),controller[_0x185b('0x19')]);router[_0x185b('0x17')](_0x185b('0x11'),auth['isAuthenticated'](),controller[_0x185b('0x1a')]);router[_0x185b('0x17')](_0x185b('0x14'),auth[_0x185b('0xa')](),controller['addAgents']);router[_0x185b('0x17')](_0x185b('0x1b'),auth[_0x185b('0xa')](),controller[_0x185b('0x1c')]);router['put']('/:id',auth[_0x185b('0xa')](),controller['update']);router['delete'](_0x185b('0xd'),auth[_0x185b('0xa')](),controller[_0x185b('0x1d')]);router[_0x185b('0x1e')](_0x185b('0xe'),auth['isAuthenticated'](),controller[_0x185b('0x1f')]);router[_0x185b('0x1e')](_0x185b('0x10'),auth[_0x185b('0xa')](),controller[_0x185b('0x20')]);router[_0x185b('0x1e')](_0x185b('0x14'),auth['isAuthenticated'](),controller[_0x185b('0x21')]);module[_0x185b('0x22')]=router; \ No newline at end of file +var _0x8315=['getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','send','destroy','delete','removeAnswers','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x8315,0x19e));var _0x5831=function(_0x532251,_0x44d617){_0x532251=_0x532251-0x0;var _0x3a3dba=_0x8315[_0x532251];return _0x3a3dba;};'use strict';var multer=require(_0x5831('0x0'));var util=require(_0x5831('0x1'));var path=require(_0x5831('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5831('0x3')]();var fs_extra=require(_0x5831('0x4'));var auth=require(_0x5831('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5831('0x6'));var controller=require(_0x5831('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5831('0x8')]);router[_0x5831('0x9')](_0x5831('0xa'),auth[_0x5831('0xb')](),controller[_0x5831('0xc')]);router[_0x5831('0x9')](_0x5831('0xd'),auth['isAuthenticated'](),controller[_0x5831('0xe')]);router[_0x5831('0x9')](_0x5831('0xf'),auth[_0x5831('0xb')](),controller[_0x5831('0x10')]);router[_0x5831('0x9')](_0x5831('0x11'),auth[_0x5831('0xb')](),controller[_0x5831('0x12')]);router['get']('/:id/applications',auth[_0x5831('0xb')](),controller[_0x5831('0x13')]);router[_0x5831('0x9')](_0x5831('0x14'),auth[_0x5831('0xb')](),controller[_0x5831('0x15')]);router[_0x5831('0x9')](_0x5831('0x16'),auth[_0x5831('0xb')](),controller[_0x5831('0x17')]);router[_0x5831('0x18')]('/',auth[_0x5831('0xb')](),controller[_0x5831('0x19')]);router[_0x5831('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5831('0x1a')]);router[_0x5831('0x18')](_0x5831('0x11'),auth[_0x5831('0xb')](),controller[_0x5831('0x1b')]);router['post'](_0x5831('0x1c'),controller['notify']);router['post'](_0x5831('0x1d'),auth[_0x5831('0xb')](),controller[_0x5831('0x1e')]);router[_0x5831('0x18')](_0x5831('0x16'),auth[_0x5831('0xb')](),controller['addAgents']);router[_0x5831('0x18')]('/:id/send',auth[_0x5831('0xb')](),controller[_0x5831('0x1f')]);router['put'](_0x5831('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5831('0xd'),auth[_0x5831('0xb')](),controller[_0x5831('0x20')]);router[_0x5831('0x21')](_0x5831('0xf'),auth[_0x5831('0xb')](),controller['removeDispositions']);router[_0x5831('0x21')]('/:id/canned_answers',auth[_0x5831('0xb')](),controller[_0x5831('0x22')]);router[_0x5831('0x21')](_0x5831('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x5831('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 6d7febb..bcb81a2 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 _0x1906=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','BOOLEAN','INTEGER'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x1906,0x12d));var _0x6190=function(_0x558a01,_0x5239e3){_0x558a01=_0x558a01-0x0;var _0x319bb8=_0x1906[_0x558a01];return _0x319bb8;};'use strict';var Sequelize=require(_0x6190('0x0'));var rs=require('randomstring');module[_0x6190('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6190('0x2')]},'token':{'type':Sequelize[_0x6190('0x2')],'defaultValue':function(){return rs[_0x6190('0x3')]();}},'replyUri':{'type':Sequelize[_0x6190('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6190('0x4')],'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[_0x6190('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6190('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6190('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6190('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6190('0x6')],'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[_0x6190('0x5')],'defaultValue':![],'comment':_0x6190('0x7'),'set':function(_0x483a71){if(!_0x483a71)this[_0x6190('0x8')](_0x6190('0x9'),null);this[_0x6190('0x8')](_0x6190('0xa'),_0x483a71);}}}; \ No newline at end of file +var _0x5f4b=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1612d6,_0x5577bf){var _0x27a583=function(_0x3dc4a2){while(--_0x3dc4a2){_0x1612d6['push'](_0x1612d6['shift']());}};_0x27a583(++_0x5577bf);}(_0x5f4b,0xb8));var _0xb5f4=function(_0x44e96e,_0x3b551a){_0x44e96e=_0x44e96e-0x0;var _0x27c3a2=_0x5f4b[_0x44e96e];return _0x27c3a2;};'use strict';var Sequelize=require(_0xb5f4('0x0'));var rs=require('randomstring');module[_0xb5f4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb5f4('0x2')]},'token':{'type':Sequelize[_0xb5f4('0x2')],'defaultValue':function(){return rs[_0xb5f4('0x3')]();}},'replyUri':{'type':Sequelize[_0xb5f4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb5f4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb5f4('0x4')],'defaultValue':function(){return _0xb5f4('0x5');}},'notificationSound':{'type':Sequelize[_0xb5f4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb5f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb5f4('0x2')]},'queueTransfer':{'type':Sequelize[_0xb5f4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb5f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb5f4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb5f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb5f4('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb5f4('0x9'),'set':function(_0xf5b6cb){if(!_0xf5b6cb)this[_0xb5f4('0xa')](_0xb5f4('0xb'),null);this['setDataValue'](_0xb5f4('0xc'),_0xf5b6cb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 60a1995..f234497 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 _0x9ed9=['info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','OpenchannelAccounts','stack','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','OpenchannelAccount','includeAll','include','findAll','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','ValidationError','mapKey','from','Contacts','Applications','applications','list','List','priority','asc','account','contact','threadId','externalUrl','OpenchannelInteraction','ContactId','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','sendStatus','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','ids','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','DESC','defaults','dataValues','Messages','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','client','request','then'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x9ed9,0xa0));var _0x99ed=function(_0x2cfee7,_0x1b3757){_0x2cfee7=_0x2cfee7-0x0;var _0xb53aef=_0x9ed9[_0x2cfee7];return _0xb53aef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ed('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99ed('0x1'));var rp=require(_0x99ed('0x2'));var moment=require(_0x99ed('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x99ed('0x4'));var util=require(_0x99ed('0x5'));var path=require('path');var sox=require(_0x99ed('0x6'));var csv=require(_0x99ed('0x7'));var ejs=require(_0x99ed('0x8'));var fs=require('fs');var fs_extra=require(_0x99ed('0x9'));var _=require('lodash');var squel=require(_0x99ed('0xa'));var crypto=require(_0x99ed('0xb'));var jsforce=require(_0x99ed('0xc'));var deskjs=require(_0x99ed('0xd'));var toCsv=require(_0x99ed('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99ed('0xe'));var authService=require(_0x99ed('0xf'));var qs=require(_0x99ed('0x10'));var as=require(_0x99ed('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99ed('0x12'))(_0x99ed('0x13'));var utils=require(_0x99ed('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x99ed('0x15'));var db=require(_0x99ed('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x99ed('0x17'),'port':0x18eb});var socket=require(_0x99ed('0x18'))(new Redis(config[_0x99ed('0x19')]));require(_0x99ed('0x1a'))[_0x99ed('0x1b')](socket);var jayson=require(_0x99ed('0x1c'));var client=jayson[_0x99ed('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x99ed('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d8b6b,_0x4c617f,_0x25d490,_0x3432ee){return new BPromise(function(_0x5c5f89,_0x4facd1){var _0x198c8e=_0x3432ee||client;return _0x198c8e[_0x99ed('0x1e')](_0x3d8b6b,_0x25d490)[_0x99ed('0x1f')](function(_0x55e41b){logger[_0x99ed('0x20')](_0x99ed('0x21'),_0x4c617f,_0x99ed('0x22'));logger[_0x99ed('0x23')](_0x99ed('0x24'),_0x4c617f,_0x99ed('0x22'),JSON['stringify'](_0x55e41b));if(_0x55e41b['error']){if(_0x55e41b[_0x99ed('0x25')][_0x99ed('0x26')]===0x1f4){logger['error'](_0x99ed('0x21'),_0x4c617f,_0x55e41b['error'][_0x99ed('0x27')]);return _0x4facd1(_0x55e41b[_0x99ed('0x25')][_0x99ed('0x27')]);}logger[_0x99ed('0x25')](_0x99ed('0x21'),_0x4c617f,_0x55e41b[_0x99ed('0x25')][_0x99ed('0x27')]);return _0x5c5f89(_0x55e41b[_0x99ed('0x25')]['message']);}else{logger[_0x99ed('0x20')](_0x99ed('0x21'),_0x4c617f,_0x99ed('0x22'));_0x5c5f89(_0x55e41b['result'][_0x99ed('0x27')]);}})[_0x99ed('0x28')](function(_0x346e46){logger[_0x99ed('0x25')](_0x99ed('0x21'),_0x4c617f,_0x346e46);_0x4facd1(_0x346e46);});});}function respondWithStatusCode(_0x28ae11,_0x155330){_0x155330=_0x155330||0xcc;return function(_0x4280d4){if(_0x4280d4){return _0x28ae11['sendStatus'](_0x155330);}return _0x28ae11[_0x99ed('0x29')](_0x155330)[_0x99ed('0x2a')]();};}function respondWithResult(_0x4a5f39,_0x480be7){_0x480be7=_0x480be7||0xc8;return function(_0x342ede){if(_0x342ede){return _0x4a5f39['status'](_0x480be7)[_0x99ed('0x2b')](_0x342ede);}};}function respondWithFilteredResult(_0x28c7ab,_0x4d40){return function(_0x58d722){if(_0x58d722){var _0x1b445b=typeof _0x4d40[_0x99ed('0x2c')]===_0x99ed('0x2d')&&typeof _0x4d40[_0x99ed('0x2e')]===_0x99ed('0x2d');var _0x2c5871=_0x58d722[_0x99ed('0x2f')];var _0x44d033=_0x1b445b?0x0:_0x4d40[_0x99ed('0x2c')];var _0x130a37=_0x1b445b?_0x58d722['count']:_0x4d40[_0x99ed('0x2c')]+_0x4d40[_0x99ed('0x2e')];var _0x40182a;if(_0x130a37>=_0x2c5871){_0x130a37=_0x2c5871;_0x40182a=0xc8;}else{_0x40182a=0xce;}_0x28c7ab[_0x99ed('0x29')](_0x40182a);return _0x28c7ab[_0x99ed('0x30')]('Content-Range',_0x44d033+'-'+_0x130a37+'/'+_0x2c5871)[_0x99ed('0x2b')](_0x58d722);}return null;};}function patchUpdates(_0x216c29){return function(_0x1102e1){try{jsonpatch['apply'](_0x1102e1,_0x216c29,!![]);}catch(_0x51fa1e){return BPromise[_0x99ed('0x31')](_0x51fa1e);}return _0x1102e1[_0x99ed('0x32')]();};}function saveUpdates(_0x155efc,_0x467330){return function(_0x590c75){if(_0x590c75){return _0x590c75[_0x99ed('0x33')](_0x155efc)[_0x99ed('0x1f')](function(_0x2d0aec){return _0x2d0aec;});}return null;};}function removeEntity(_0x4d3c22,_0x23ae22){return function(_0x3cc972){if(_0x3cc972){return _0x3cc972[_0x99ed('0x34')]()[_0x99ed('0x1f')](function(){var _0x642e61=_0x3cc972['get']({'plain':!![]});var _0x10af4a=_0x99ed('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x10af4a,'resourceId':_0x642e61['id']}})['then'](function(){return _0x3cc972;});})[_0x99ed('0x1f')](function(){_0x4d3c22['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc7cdb2,_0x1f1d88){return function(_0x359163){if(!_0x359163){_0xc7cdb2['sendStatus'](0x194);}return _0x359163;};}function handleError(_0x297497,_0x490568){_0x490568=_0x490568||0x1f4;return function(_0x28218a){logger[_0x99ed('0x25')](_0x28218a[_0x99ed('0x36')]);if(_0x28218a[_0x99ed('0x37')]){delete _0x28218a['name'];}_0x297497[_0x99ed('0x29')](_0x490568)[_0x99ed('0x38')](_0x28218a);};}exports[_0x99ed('0x39')]=function(_0x9beed1,_0x3b2edb){var _0x2699fd={'include':[{'model':db['Pause'],'as':_0x99ed('0x3a')}]},_0x3e2bd0={},_0x5014dc={'count':0x0,'rows':[]};var _0x495ef4=_['map'](db['OpenchannelAccount'][_0x99ed('0x3b')],function(_0x5ec7e0){return{'name':_0x5ec7e0[_0x99ed('0x3c')],'type':_0x5ec7e0['type'][_0x99ed('0x3d')]};});_0x3e2bd0[_0x99ed('0x3e')]=_[_0x99ed('0x3f')](_0x495ef4,_0x99ed('0x37'));_0x3e2bd0[_0x99ed('0x40')]=_[_0x99ed('0x41')](_0x9beed1[_0x99ed('0x40')]);_0x3e2bd0[_0x99ed('0x42')]=_[_0x99ed('0x43')](_0x3e2bd0[_0x99ed('0x3e')],_0x3e2bd0['query']);_0x2699fd[_0x99ed('0x44')]=_['intersection'](_0x3e2bd0[_0x99ed('0x3e')],qs[_0x99ed('0x45')](_0x9beed1[_0x99ed('0x40')][_0x99ed('0x45')]));_0x2699fd[_0x99ed('0x44')]=_0x2699fd[_0x99ed('0x44')][_0x99ed('0x46')]?_0x2699fd[_0x99ed('0x44')]:_0x3e2bd0[_0x99ed('0x3e')];if(!_0x9beed1[_0x99ed('0x40')][_0x99ed('0x47')](_0x99ed('0x48'))){_0x2699fd[_0x99ed('0x2e')]=qs[_0x99ed('0x2e')](_0x9beed1[_0x99ed('0x40')][_0x99ed('0x2e')]);_0x2699fd[_0x99ed('0x2c')]=qs[_0x99ed('0x2c')](_0x9beed1['query'][_0x99ed('0x2c')]);}_0x2699fd[_0x99ed('0x49')]=qs[_0x99ed('0x4a')](_0x9beed1['query'][_0x99ed('0x4a')]);_0x2699fd[_0x99ed('0x4b')]=qs['filters'](_[_0x99ed('0x4c')](_0x9beed1[_0x99ed('0x40')],_0x3e2bd0['filters']),_0x495ef4);if(_0x9beed1['query'][_0x99ed('0x4d')]){_0x2699fd[_0x99ed('0x4b')]=_['merge'](_0x2699fd['where'],{'$or':_[_0x99ed('0x3f')](_0x495ef4,function(_0x4c51aa){if(_0x4c51aa[_0x99ed('0x4e')]!==_0x99ed('0x4f')){var _0x3ff446={};_0x3ff446[_0x4c51aa[_0x99ed('0x37')]]={'$like':'%'+_0x9beed1['query'][_0x99ed('0x4d')]+'%'};return _0x3ff446;}})});}_0x2699fd=_[_0x99ed('0x50')]({},_0x2699fd,_0x9beed1[_0x99ed('0x51')]);var _0x1aa299={'where':_0x2699fd[_0x99ed('0x4b')]};return db[_0x99ed('0x52')][_0x99ed('0x2f')](_0x1aa299)[_0x99ed('0x1f')](function(_0x3f214c){_0x5014dc[_0x99ed('0x2f')]=_0x3f214c;if(_0x9beed1['query'][_0x99ed('0x53')]){_0x2699fd[_0x99ed('0x54')]=[{'all':!![]}];}return db[_0x99ed('0x52')][_0x99ed('0x55')](_0x2699fd);})[_0x99ed('0x1f')](function(_0x4ce6fb){_0x5014dc[_0x99ed('0x56')]=_0x4ce6fb;return _0x5014dc;})['then'](respondWithFilteredResult(_0x3b2edb,_0x2699fd))[_0x99ed('0x28')](handleError(_0x3b2edb,null));};exports[_0x99ed('0x57')]=function(_0x36dff4,_0x3aac65){var _0x3130bb={'raw':![],'where':{'id':_0x36dff4[_0x99ed('0x58')]['id']},'include':[{'model':db[_0x99ed('0x59')],'as':_0x99ed('0x3a')}]},_0x4c3d53={};_0x4c3d53[_0x99ed('0x3e')]=_[_0x99ed('0x41')](db['OpenchannelAccount'][_0x99ed('0x3b')]);_0x4c3d53['query']=_[_0x99ed('0x41')](_0x36dff4['query']);_0x4c3d53['filters']=_[_0x99ed('0x43')](_0x4c3d53['model'],_0x4c3d53[_0x99ed('0x40')]);_0x3130bb[_0x99ed('0x44')]=_['intersection'](_0x4c3d53[_0x99ed('0x3e')],qs[_0x99ed('0x45')](_0x36dff4[_0x99ed('0x40')][_0x99ed('0x45')]));_0x3130bb[_0x99ed('0x44')]=_0x3130bb[_0x99ed('0x44')][_0x99ed('0x46')]?_0x3130bb[_0x99ed('0x44')]:_0x4c3d53['model'];if(_0x36dff4[_0x99ed('0x40')][_0x99ed('0x53')]){_0x3130bb['include']=[{'all':!![]}];}_0x3130bb=_['merge']({},_0x3130bb,_0x36dff4[_0x99ed('0x51')]);return db[_0x99ed('0x52')][_0x99ed('0x5a')](_0x3130bb)[_0x99ed('0x1f')](handleEntityNotFound(_0x3aac65,null))[_0x99ed('0x1f')](respondWithResult(_0x3aac65,null))[_0x99ed('0x28')](handleError(_0x3aac65,null));};exports[_0x99ed('0x5b')]=function(_0x23f7b2,_0x537f63){return db[_0x99ed('0x52')][_0x99ed('0x5b')](_0x23f7b2[_0x99ed('0x5c')],{})[_0x99ed('0x1f')](function(_0x37283b){var _0x30f8ae=_0x23f7b2[_0x99ed('0x5d')]['get']({'plain':!![]});if(!_0x30f8ae)throw new Error(_0x99ed('0x5e'));if(_0x30f8ae[_0x99ed('0x5f')]===_0x99ed('0x5d')){var _0x5d9d39=_0x37283b[_0x99ed('0x60')]({'plain':!![]});var _0x1373ba=_0x99ed('0x35');return db[_0x99ed('0x61')][_0x99ed('0x5a')]({'where':{'name':_0x1373ba,'userProfileId':_0x30f8ae[_0x99ed('0x62')]},'raw':!![]})[_0x99ed('0x1f')](function(_0x3857a7){if(_0x3857a7&&_0x3857a7[_0x99ed('0x63')]===0x0){return db[_0x99ed('0x64')][_0x99ed('0x5b')]({'name':_0x5d9d39[_0x99ed('0x37')],'resourceId':_0x5d9d39['id'],'type':_0x3857a7[_0x99ed('0x37')],'sectionId':_0x3857a7['id']},{})['then'](function(){return _0x37283b;});}else{return _0x37283b;}})[_0x99ed('0x28')](function(_0x2b2f93){logger[_0x99ed('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b2f93);throw _0x2b2f93;});}return _0x37283b;})['then'](respondWithResult(_0x537f63,0xc9))['catch'](handleError(_0x537f63,null));};exports[_0x99ed('0x33')]=function(_0x5a2558,_0x483c1b){if(_0x5a2558['body']['id']){delete _0x5a2558['body']['id'];}return db[_0x99ed('0x52')]['find']({'where':{'id':_0x5a2558[_0x99ed('0x58')]['id']},'include':[{'model':db[_0x99ed('0x59')],'as':_0x99ed('0x3a')}]})[_0x99ed('0x1f')](handleEntityNotFound(_0x483c1b,null))[_0x99ed('0x1f')](saveUpdates(_0x5a2558[_0x99ed('0x5c')],null))[_0x99ed('0x1f')](respondWithResult(_0x483c1b,null))[_0x99ed('0x28')](handleError(_0x483c1b,null));};exports[_0x99ed('0x34')]=function(_0x188619,_0x107450){return db[_0x99ed('0x52')]['find']({'where':{'id':_0x188619[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x107450,null))[_0x99ed('0x1f')](removeEntity(_0x107450,null))[_0x99ed('0x28')](handleError(_0x107450,null));};exports['describe']=function(_0x46eb74,_0x36257e){return db['OpenchannelAccount'][_0x99ed('0x65')]()[_0x99ed('0x1f')](respondWithResult(_0x36257e,null))['catch'](handleError(_0x36257e,null));};exports[_0x99ed('0x66')]=function(_0x14ef3d,_0x4e8303,_0x341075){if(_0x14ef3d[_0x99ed('0x5c')]['id']){delete _0x14ef3d['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x14ef3d[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x4e8303,null))[_0x99ed('0x1f')](function(_0x569dd6){if(_0x569dd6){_0x14ef3d[_0x99ed('0x5c')][_0x99ed('0x67')]=_0x569dd6['id'];return db[_0x99ed('0x68')][_0x99ed('0x5b')](_0x14ef3d[_0x99ed('0x5c')]);}})[_0x99ed('0x1f')](respondWithResult(_0x4e8303,null))['catch'](handleError(_0x4e8303,null));};exports[_0x99ed('0x69')]=function(_0x3e0965,_0x446588,_0x53eb93){var _0x3c7f7c={'raw':![],'where':{}};var _0x3eaf5a={};var _0x3e30c2={'count':0x0,'rows':[]};return db[_0x99ed('0x52')][_0x99ed('0x6a')]({'where':{'id':_0x3e0965['params']['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x446588,null))[_0x99ed('0x1f')](function(_0x9cd2ef){if(_0x9cd2ef){_0x3eaf5a[_0x99ed('0x3e')]=_[_0x99ed('0x41')](db[_0x99ed('0x68')][_0x99ed('0x3b')]);_0x3eaf5a[_0x99ed('0x40')]=_[_0x99ed('0x41')](_0x3e0965[_0x99ed('0x40')]);_0x3eaf5a[_0x99ed('0x42')]=_[_0x99ed('0x43')](_0x3eaf5a[_0x99ed('0x3e')],_0x3eaf5a[_0x99ed('0x40')]);_0x3c7f7c[_0x99ed('0x44')]=_[_0x99ed('0x43')](_0x3eaf5a[_0x99ed('0x3e')],qs[_0x99ed('0x45')](_0x3e0965[_0x99ed('0x40')][_0x99ed('0x45')]));_0x3c7f7c[_0x99ed('0x44')]=_0x3c7f7c['attributes']['length']?_0x3c7f7c['attributes']:_0x3eaf5a['model'];if(!_0x3e0965[_0x99ed('0x40')][_0x99ed('0x47')](_0x99ed('0x48'))){_0x3c7f7c[_0x99ed('0x2e')]=qs[_0x99ed('0x2e')](_0x3e0965['query'][_0x99ed('0x2e')]);_0x3c7f7c['offset']=qs[_0x99ed('0x2c')](_0x3e0965[_0x99ed('0x40')]['offset']);}_0x3c7f7c[_0x99ed('0x49')]=qs[_0x99ed('0x4a')](_0x3e0965[_0x99ed('0x40')][_0x99ed('0x4a')]);_0x3c7f7c[_0x99ed('0x4b')]=qs[_0x99ed('0x42')](_[_0x99ed('0x4c')](_0x3e0965['query'],_0x3eaf5a[_0x99ed('0x42')]));_0x3c7f7c[_0x99ed('0x4b')][_0x99ed('0x67')]=_0x9cd2ef['id'];if(_0x3e0965['query']['filter']){_0x3c7f7c[_0x99ed('0x4b')]=_[_0x99ed('0x50')](_0x3c7f7c[_0x99ed('0x4b')],{'$or':_[_0x99ed('0x3f')](_0x3c7f7c[_0x99ed('0x44')],function(_0x3462dd){var _0x196fc8={};_0x196fc8[_0x3462dd]={'$like':'%'+_0x3e0965[_0x99ed('0x40')][_0x99ed('0x4d')]+'%'};return _0x196fc8;})});}_0x3c7f7c=_['merge']({},_0x3c7f7c,_0x3e0965['options']);return db[_0x99ed('0x68')][_0x99ed('0x2f')]({'where':_0x3c7f7c[_0x99ed('0x4b')]})[_0x99ed('0x1f')](function(_0x4318b3){_0x3e30c2[_0x99ed('0x2f')]=_0x4318b3;if(_0x3e0965[_0x99ed('0x40')][_0x99ed('0x53')]){_0x3c7f7c[_0x99ed('0x54')]=[{'all':!![]}];}return db[_0x99ed('0x68')][_0x99ed('0x55')](_0x3c7f7c);})['then'](function(_0x5739f2){_0x3e30c2[_0x99ed('0x56')]=_0x5739f2;return _0x3e30c2;});}})[_0x99ed('0x1f')](respondWithFilteredResult(_0x446588,_0x3c7f7c))[_0x99ed('0x28')](handleError(_0x446588,null));};exports[_0x99ed('0x6b')]=function(_0x133984,_0x6e4c72,_0x47d9d8){return db[_0x99ed('0x52')][_0x99ed('0x5a')]({'where':{'id':_0x133984[_0x99ed('0x58')]['id']}})['then'](handleEntityNotFound(_0x6e4c72,null))[_0x99ed('0x1f')](function(_0x43ef44){if(_0x43ef44){return _0x43ef44['removeDispositions'](_0x133984['query']['ids']);}})['then'](respondWithStatusCode(_0x6e4c72,null))[_0x99ed('0x28')](handleError(_0x6e4c72,null));};exports[_0x99ed('0x6c')]=function(_0x4898aa,_0x48f9d3,_0x1aa8dd){if(_0x4898aa[_0x99ed('0x5c')]['id']){delete _0x4898aa[_0x99ed('0x5c')]['id'];}return db[_0x99ed('0x52')][_0x99ed('0x5a')]({'where':{'id':_0x4898aa[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x48f9d3,null))[_0x99ed('0x1f')](function(_0x386b25){if(_0x386b25){_0x4898aa[_0x99ed('0x5c')][_0x99ed('0x67')]=_0x386b25['id'];return db[_0x99ed('0x6d')][_0x99ed('0x5b')](_0x4898aa[_0x99ed('0x5c')]);}})[_0x99ed('0x1f')](respondWithResult(_0x48f9d3,null))[_0x99ed('0x28')](handleError(_0x48f9d3,null));};exports[_0x99ed('0x6e')]=function(_0x509b14,_0x2610cb,_0x4fd283){var _0x1c9238={'raw':![],'where':{}};var _0x187de9={};var _0x32ac16={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x99ed('0x6a')]({'where':{'id':_0x509b14[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x2610cb,null))[_0x99ed('0x1f')](function(_0x52bcb2){if(_0x52bcb2){_0x187de9[_0x99ed('0x3e')]=_['keys'](db['CannedAnswer'][_0x99ed('0x3b')]);_0x187de9[_0x99ed('0x40')]=_[_0x99ed('0x41')](_0x509b14['query']);_0x187de9[_0x99ed('0x42')]=_['intersection'](_0x187de9[_0x99ed('0x3e')],_0x187de9[_0x99ed('0x40')]);_0x1c9238[_0x99ed('0x44')]=_[_0x99ed('0x43')](_0x187de9[_0x99ed('0x3e')],qs['fields'](_0x509b14[_0x99ed('0x40')][_0x99ed('0x45')]));_0x1c9238[_0x99ed('0x44')]=_0x1c9238[_0x99ed('0x44')]['length']?_0x1c9238[_0x99ed('0x44')]:_0x187de9[_0x99ed('0x3e')];if(!_0x509b14[_0x99ed('0x40')]['hasOwnProperty']('nolimit')){_0x1c9238[_0x99ed('0x2e')]=qs[_0x99ed('0x2e')](_0x509b14[_0x99ed('0x40')][_0x99ed('0x2e')]);_0x1c9238[_0x99ed('0x2c')]=qs['offset'](_0x509b14[_0x99ed('0x40')][_0x99ed('0x2c')]);}_0x1c9238[_0x99ed('0x49')]=qs[_0x99ed('0x4a')](_0x509b14['query'][_0x99ed('0x4a')]);_0x1c9238[_0x99ed('0x4b')]=qs['filters'](_[_0x99ed('0x4c')](_0x509b14[_0x99ed('0x40')],_0x187de9[_0x99ed('0x42')]));_0x1c9238[_0x99ed('0x4b')][_0x99ed('0x67')]=_0x52bcb2['id'];if(_0x509b14['query']['filter']){_0x1c9238[_0x99ed('0x4b')]=_[_0x99ed('0x50')](_0x1c9238['where'],{'$or':_['map'](_0x1c9238[_0x99ed('0x44')],function(_0x891fcb){var _0x37feea={};_0x37feea[_0x891fcb]={'$like':'%'+_0x509b14[_0x99ed('0x40')]['filter']+'%'};return _0x37feea;})});}_0x1c9238=_[_0x99ed('0x50')]({},_0x1c9238,_0x509b14[_0x99ed('0x51')]);return db[_0x99ed('0x6d')]['count']({'where':_0x1c9238[_0x99ed('0x4b')]})[_0x99ed('0x1f')](function(_0x477a6a){_0x32ac16['count']=_0x477a6a;if(_0x509b14['query'][_0x99ed('0x53')]){_0x1c9238['include']=[{'all':!![]}];}return db[_0x99ed('0x6d')][_0x99ed('0x55')](_0x1c9238);})[_0x99ed('0x1f')](function(_0x5096cc){_0x32ac16[_0x99ed('0x56')]=_0x5096cc;return _0x32ac16;});}})[_0x99ed('0x1f')](respondWithFilteredResult(_0x2610cb,_0x1c9238))['catch'](handleError(_0x2610cb,null));};exports[_0x99ed('0x6f')]=function(_0x5d4916,_0x9c18d2,_0x3c4867){return db[_0x99ed('0x52')][_0x99ed('0x5a')]({'where':{'id':_0x5d4916[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x9c18d2,null))['then'](function(_0x327c23){if(_0x327c23){return _0x327c23[_0x99ed('0x6f')](_0x5d4916[_0x99ed('0x40')]['ids']);}})[_0x99ed('0x1f')](respondWithStatusCode(_0x9c18d2,null))['catch'](handleError(_0x9c18d2,null));};exports[_0x99ed('0x70')]=function(_0x47e6c0,_0x5150a8,_0x1e220f){var _0x4b40c6={'body':_0x47e6c0[_0x99ed('0x5c')],'channel':_0x99ed('0x71')};var _0x1ab87e=[];var _0x1290d3=[];var _0x3aaf3={};var _0x5c54f9=![];return db[_0x99ed('0x72')][_0x99ed('0x65')]()[_0x99ed('0x1f')](function(_0x29798f){if(!_0x29798f){throw new db[(_0x99ed('0x73'))]['ValidationError'](_0x99ed('0x74'));}_0x1ab87e=_[_0x99ed('0x75')](_[_0x99ed('0x41')](_0x29798f),['createdAt',_0x99ed('0x76')]);_0x1290d3=_[_0x99ed('0x75')](_['keys'](_0x29798f),['createdAt',_0x99ed('0x76'),_0x99ed('0x77'),'ListId']);if(_0x47e6c0[_0x99ed('0x5c')]['id']){delete _0x47e6c0[_0x99ed('0x5c')]['id'];}if(_[_0x99ed('0x78')](_0x47e6c0[_0x99ed('0x5c')]['from'])){throw new db[(_0x99ed('0x73'))]['ValidationError'](_0x99ed('0x79'));}if(_[_0x99ed('0x78')](_0x47e6c0[_0x99ed('0x5c')][_0x99ed('0x5c')])||_0x47e6c0['body'][_0x99ed('0x5c')]===''){throw new db[(_0x99ed('0x73'))][(_0x99ed('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x99ed('0x78')](_0x47e6c0['body']['mapKey'])){throw new db[(_0x99ed('0x73'))][(_0x99ed('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1290d3);}if(!_['includes'](_0x1290d3,_0x47e6c0['body']['mapKey'])){throw new db[(_0x99ed('0x73'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1290d3);}_0x3aaf3[_0x47e6c0[_0x99ed('0x5c')][_0x99ed('0x7b')]]=_0x47e6c0[_0x99ed('0x5c')][_0x99ed('0x7c')];})['then'](function(){return db['OpenchannelAccount'][_0x99ed('0x5a')]({'where':{'id':_0x47e6c0[_0x99ed('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x99ed('0x7d'),'where':_0x3aaf3,'limit':0x1,'order':[[_0x99ed('0x76'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x99ed('0x7e')}]});})[_0x99ed('0x1f')](handleEntityNotFound(_0x5150a8,null))['then'](function(_0x2489f2){if(_0x2489f2&&_0x2489f2['List']){_0x4b40c6['account']=_0x2489f2;_0x4b40c6[_0x99ed('0x7f')]=_0x2489f2['Applications'];_0x4b40c6[_0x99ed('0x80')]=_0x2489f2[_0x99ed('0x81')];_0x4b40c6['applications']=_['orderBy'](_0x4b40c6[_0x99ed('0x7f')],[_0x99ed('0x82')],[_0x99ed('0x83')]);if(_0x4b40c6['account']['Applications']){delete _0x4b40c6[_0x99ed('0x84')][_0x99ed('0x7e')];}if(_0x4b40c6[_0x99ed('0x84')][_0x99ed('0x81')]&&_0x4b40c6[_0x99ed('0x84')][_0x99ed('0x81')][_0x99ed('0x7d')][_0x99ed('0x46')]){return _0x4b40c6['account'][_0x99ed('0x81')][_0x99ed('0x7d')][0x0];}var _0x3cdcaf=_['defaults'](_0x47e6c0[_0x99ed('0x5c')],{'firstName':_0x47e6c0[_0x99ed('0x5c')]['from'],'ListId':_0x2489f2['ListId']});_0x3cdcaf[_0x47e6c0[_0x99ed('0x5c')]['mapKey']]=_0x47e6c0['body'][_0x99ed('0x7c')];return db[_0x99ed('0x72')]['create'](_0x3cdcaf,{'fields':_0x1ab87e,'raw':!![]});}})['then'](handleEntityNotFound(_0x5150a8,null))[_0x99ed('0x1f')](function(_0x463e66){_0x4b40c6[_0x99ed('0x85')]=_0x463e66;if(_0x463e66){var _0x31dd63={'ContactId':_0x463e66['id'],'OpenchannelAccountId':_0x47e6c0[_0x99ed('0x58')]['id'],'from':(_0x463e66['firstName']||'')+'\x20'+(_0x463e66['lastName']||'')};var _0x57d86e={'OpenchannelAccountId':_0x47e6c0[_0x99ed('0x58')]['id'],'closed':![]};if(_0x47e6c0[_0x99ed('0x5c')][_0x99ed('0x86')]){_0x57d86e[_0x99ed('0x86')]=_0x47e6c0['body']['threadId'];return db['OpenchannelInteraction'][_0x99ed('0x5a')]({'where':_0x57d86e})[_0x99ed('0x1f')](function(_0x4a8ef2){if(_0x4a8ef2){return[_0x4a8ef2,![]];}_0x31dd63[_0x99ed('0x86')]=_0x47e6c0[_0x99ed('0x5c')]['threadId'];_0x31dd63[_0x99ed('0x87')]=_0x47e6c0[_0x99ed('0x5c')]['externalUrl'];return db[_0x99ed('0x88')][_0x99ed('0x5b')](_0x31dd63)[_0x99ed('0x1f')](function(_0x428e78){return[_0x428e78,!![]];});});}else{_0x57d86e[_0x99ed('0x86')]=null;}_0x57d86e[_0x99ed('0x89')]=_0x463e66['id'];return db[_0x99ed('0x88')][_0x99ed('0x5a')]({'where':_0x57d86e})['then'](function(_0x6e9e68){if(_0x6e9e68){return[_0x6e9e68,![]];}return db[_0x99ed('0x88')][_0x99ed('0x5b')](_0x31dd63)[_0x99ed('0x1f')](function(_0x23a725){return[_0x23a725,!![]];});});}})['spread'](function(_0x4e5277,_0x547ca){if(_0x4e5277){_0x5c54f9=_0x547ca;if(!_0x547ca){var _0x4160de={'from':(_0x4b40c6['contact']['firstName']||'')+'\x20'+(_0x4b40c6[_0x99ed('0x85')][_0x99ed('0x8a')]||'')};if(_0x47e6c0[_0x99ed('0x5c')]['threadId']&&_0x47e6c0[_0x99ed('0x5c')][_0x99ed('0x8b')]&&_0x47e6c0[_0x99ed('0x5c')]['threadId']!=_0x47e6c0[_0x99ed('0x5c')]['messageId']){_0x4160de[_0x99ed('0x86')]=_0x47e6c0[_0x99ed('0x5c')][_0x99ed('0x8b')];}return _0x4e5277[_0x99ed('0x33')](_0x4160de);}else{return _0x4e5277;}}})[_0x99ed('0x1f')](function(_0x205522){_0x4b40c6[_0x99ed('0x8c')]=_0x205522['get']({'plain':!![]});_0x4b40c6[_0x99ed('0x8c')][_0x99ed('0x8d')]=_0x5c54f9;if(_0x4b40c6[_0x99ed('0x8c')][_0x99ed('0x8d')]){if(_0x4b40c6[_0x99ed('0x84')]['autoclose']){_0x4b40c6['applications'][_0x99ed('0x8e')]({'id':0x0,'priority':_0x4b40c6[_0x99ed('0x7f')][_0x99ed('0x46')]+0x1,'app':_0x99ed('0x8f'),'appdata':_0x99ed('0x90'),'interval':_0x99ed('0x91')});}}return db[_0x99ed('0x92')][_0x99ed('0x5b')]({'body':_0x47e6c0[_0x99ed('0x5c')]['body'],'OpenchannelAccountId':_0x47e6c0[_0x99ed('0x58')]['id'],'OpenchannelInteractionId':_0x205522['id'],'direction':'in','ContactId':_0x4b40c6[_0x99ed('0x85')]['id'],'AttachmentId':_0x47e6c0['body'][_0x99ed('0x93')]});})[_0x99ed('0x1f')](function(_0x47f2fb){_0x4b40c6[_0x99ed('0x27')]=_0x47f2fb;if(_0x4b40c6['interaction'][_0x99ed('0x94')]){return db['User'][_0x99ed('0x5a')]({'attributes':['id',_0x99ed('0x37')],'where':{'id':_0x4b40c6[_0x99ed('0x8c')][_0x99ed('0x94')]}})[_0x99ed('0x1f')](function(_0x58a27b){if(_0x58a27b){_0x4b40c6['applications'][_0x99ed('0x95')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x58a27b['name']+','+(_0x4b40c6[_0x99ed('0x84')][_0x99ed('0x96')]||0xa),'interval':'*,*,*,*'});_0x4b40c6[_0x99ed('0x97')]=![];}return respondWithRpcPromise(_0x99ed('0x98'),'startRouting',_0x4b40c6);});}return respondWithRpcPromise(_0x99ed('0x98'),_0x99ed('0x99'),_0x4b40c6);})[_0x99ed('0x1f')](function(_0x5b93ab){respondWithRpcPromise(_0x99ed('0x9a'),_0x99ed('0x9a'),{'event':_0x99ed('0x70'),'message':_0x5b93ab},client9002);return _0x5b93ab;})[_0x99ed('0x1f')](respondWithResult(_0x5150a8,null))[_0x99ed('0x28')](handleError(_0x5150a8,null));};exports[_0x99ed('0x9b')]=function(_0x24e30a,_0x7ba2d3){var _0x121b83=_0x24e30a[_0x99ed('0x58')]['id'];var _0x2a6e03=_0x24e30a[_0x99ed('0x5c')];var _0x1d9ff0=0xc8;var _0x12fdc0=null;return db[_0x99ed('0x9c')]['transaction']({'isolationLevel':db[_0x99ed('0x9c')][_0x99ed('0x9d')][_0x99ed('0x9e')][_0x99ed('0x9f')]},function(_0x1564d1){return db[_0x99ed('0x52')][_0x99ed('0x6a')]({'where':{'id':_0x121b83},'transaction':_0x1564d1})[_0x99ed('0x1f')](function(_0x2d17ca){if(_0x2d17ca){return db[_0x99ed('0xa0')][_0x99ed('0x34')]({'where':{'OpenchannelAccountId':_0x121b83},'transaction':_0x1564d1})[_0x99ed('0x1f')](function(){var _0x220174=_[_0x99ed('0x3f')](_0x2a6e03,function(_0x2556a6){_0x2556a6[_0x99ed('0x67')]=_0x121b83;return _0x2556a6;});return db['OpenchannelApplication'][_0x99ed('0xa1')](_0x220174,{'transaction':_0x1564d1});});}else{_0x1d9ff0=0x194;_0x12fdc0=[];}});})[_0x99ed('0x1f')](function(){if(_0x1d9ff0!==0x194){return db['OpenchannelApplication'][_0x99ed('0xa2')]({'where':{'OpenchannelAccountId':_0x121b83},'order':_0x99ed('0x82')})[_0x99ed('0x1f')](function(_0x2feed3){_0x12fdc0=_0x2feed3;});}})[_0x99ed('0x28')](function(_0x1ffc48){_0x1d9ff0=0x1f4;logger[_0x99ed('0x25')](_0x1ffc48[_0x99ed('0x36')]);if(_0x1ffc48[_0x99ed('0x37')]){delete _0x1ffc48[_0x99ed('0x37')];}_0x12fdc0=_0x1ffc48;})[_0x99ed('0xa3')](function(){if(_0x12fdc0===null){_0x7ba2d3[_0x99ed('0xa4')](_0x1d9ff0);}else{if(_0x1d9ff0===0x1f4){_0x7ba2d3[_0x99ed('0x29')](_0x1d9ff0)['send'](_0x12fdc0);}else{_0x7ba2d3[_0x99ed('0x29')](_0x1d9ff0)[_0x99ed('0x2b')](_0x12fdc0);}}});};exports[_0x99ed('0xa5')]=function(_0x5534cf,_0x3f68ba,_0x4b2831){var _0x279819={};var _0x1fc6b7={};var _0x4f04ce;var _0x2bad57;return db[_0x99ed('0x52')]['findOne']({'where':{'id':_0x5534cf['params']['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x3f68ba,null))[_0x99ed('0x1f')](function(_0x21f62f){if(_0x21f62f){_0x4f04ce=_0x21f62f;_0x1fc6b7[_0x99ed('0x3e')]=_[_0x99ed('0x41')](db['OpenchannelApplication'][_0x99ed('0x3b')]);_0x1fc6b7[_0x99ed('0x40')]=_[_0x99ed('0x41')](_0x5534cf[_0x99ed('0x40')]);_0x1fc6b7[_0x99ed('0x42')]=_[_0x99ed('0x43')](_0x1fc6b7[_0x99ed('0x3e')],_0x1fc6b7['query']);_0x279819[_0x99ed('0x44')]=_[_0x99ed('0x43')](_0x1fc6b7[_0x99ed('0x3e')],qs[_0x99ed('0x45')](_0x5534cf[_0x99ed('0x40')][_0x99ed('0x45')]));_0x279819[_0x99ed('0x44')]=_0x279819[_0x99ed('0x44')][_0x99ed('0x46')]?_0x279819['attributes']:_0x1fc6b7[_0x99ed('0x3e')];_0x279819[_0x99ed('0x49')]=qs[_0x99ed('0x4a')](_0x5534cf[_0x99ed('0x40')][_0x99ed('0x4a')]);_0x279819[_0x99ed('0x4b')]=qs[_0x99ed('0x42')](_[_0x99ed('0x4c')](_0x5534cf[_0x99ed('0x40')],_0x1fc6b7['filters']));if(_0x5534cf[_0x99ed('0x40')][_0x99ed('0x4d')]){_0x279819[_0x99ed('0x4b')]=_[_0x99ed('0x50')](_0x279819[_0x99ed('0x4b')],{'$or':_[_0x99ed('0x3f')](_0x279819[_0x99ed('0x44')],function(_0x30b6b0){var _0x3d985f={};_0x3d985f[_0x30b6b0]={'$like':'%'+_0x5534cf['query'][_0x99ed('0x4d')]+'%'};return _0x3d985f;})});}_0x279819=_['merge']({},_0x279819,_0x5534cf['options']);return _0x4f04ce[_0x99ed('0xa5')](_0x279819);}})[_0x99ed('0x1f')](function(_0x130515){if(_0x130515){_0x2bad57=_0x130515[_0x99ed('0x46')];if(!_0x5534cf[_0x99ed('0x40')]['hasOwnProperty'](_0x99ed('0x48'))){_0x279819[_0x99ed('0x2e')]=qs[_0x99ed('0x2e')](_0x5534cf[_0x99ed('0x40')][_0x99ed('0x2e')]);_0x279819['offset']=qs['offset'](_0x5534cf[_0x99ed('0x40')]['offset']);}return _0x4f04ce[_0x99ed('0xa5')](_0x279819);}})[_0x99ed('0x1f')](function(_0x374d04){if(_0x374d04){return _0x374d04?{'count':_0x2bad57,'rows':_0x374d04}:null;}})[_0x99ed('0x1f')](respondWithResult(_0x3f68ba,null))[_0x99ed('0x28')](handleError(_0x3f68ba,null));};exports[_0x99ed('0xa6')]=function(_0x5a1033,_0x2087ea,_0x31ac5a){var _0x27c96c={'raw':![],'where':{}};var _0x11e07e={};var _0x4545af={'count':0x0,'rows':[]};return db[_0x99ed('0x52')][_0x99ed('0x6a')]({'where':{'id':_0x5a1033[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x2087ea,null))[_0x99ed('0x1f')](function(_0x34d25c){if(_0x34d25c){_0x11e07e[_0x99ed('0x3e')]=_[_0x99ed('0x41')](db[_0x99ed('0x88')][_0x99ed('0x3b')]);_0x11e07e[_0x99ed('0x40')]=_['keys'](_0x5a1033['query']);_0x11e07e['filters']=_[_0x99ed('0x43')](_0x11e07e['model'],_0x11e07e['query']);_0x27c96c['attributes']=_[_0x99ed('0x43')](_0x11e07e[_0x99ed('0x3e')],qs['fields'](_0x5a1033[_0x99ed('0x40')][_0x99ed('0x45')]));_0x27c96c['attributes']=_0x27c96c[_0x99ed('0x44')][_0x99ed('0x46')]?_0x27c96c[_0x99ed('0x44')]:_0x11e07e[_0x99ed('0x3e')];if(!_0x5a1033[_0x99ed('0x40')][_0x99ed('0x47')]('nolimit')){_0x27c96c[_0x99ed('0x2e')]=qs['limit'](_0x5a1033['query']['limit']);_0x27c96c[_0x99ed('0x2c')]=qs[_0x99ed('0x2c')](_0x5a1033[_0x99ed('0x40')][_0x99ed('0x2c')]);}_0x27c96c[_0x99ed('0x49')]=qs[_0x99ed('0x4a')](_0x5a1033[_0x99ed('0x40')][_0x99ed('0x4a')]);_0x27c96c[_0x99ed('0x4b')]=qs[_0x99ed('0x42')](_[_0x99ed('0x4c')](_0x5a1033[_0x99ed('0x40')],_0x11e07e[_0x99ed('0x42')]));_0x27c96c[_0x99ed('0x4b')][_0x99ed('0x67')]=_0x34d25c['id'];if(_0x5a1033['query'][_0x99ed('0x4d')]){_0x27c96c[_0x99ed('0x4b')]=_[_0x99ed('0x50')](_0x27c96c[_0x99ed('0x4b')],{'$or':_[_0x99ed('0x3f')](_0x27c96c['attributes'],function(_0x2f6d2a){var _0x1e4fe6={};_0x1e4fe6[_0x2f6d2a]={'$like':'%'+_0x5a1033['query'][_0x99ed('0x4d')]+'%'};return _0x1e4fe6;})});}_0x27c96c=_['merge']({},_0x27c96c,_0x5a1033['options']);return db[_0x99ed('0x88')][_0x99ed('0x2f')]({'where':_0x27c96c['where']})['then'](function(_0x51fdd3){_0x4545af[_0x99ed('0x2f')]=_0x51fdd3;if(_0x5a1033[_0x99ed('0x40')][_0x99ed('0x53')]){_0x27c96c[_0x99ed('0x54')]=[{'model':db[_0x99ed('0x72')],'as':_0x99ed('0xa7'),'required':![]},{'model':db[_0x99ed('0xa8')],'as':_0x99ed('0xa9'),'attributes':['name',_0x99ed('0xaa'),_0x99ed('0xab')],'required':![]},{'model':db[_0x99ed('0xac')],'as':_0x99ed('0xad'),'attributes':['id',_0x99ed('0x37'),_0x99ed('0xae')],'where':_0x5a1033[_0x99ed('0x40')][_0x99ed('0xaf')]?{'id':_0x5a1033[_0x99ed('0x40')][_0x99ed('0xaf')]}:undefined,'required':_0x5a1033[_0x99ed('0x40')][_0x99ed('0xaf')]?!![]:![]}];}return db[_0x99ed('0x88')][_0x99ed('0x55')](_0x27c96c);})[_0x99ed('0x1f')](function(_0x51f552){_0x4545af[_0x99ed('0x56')]=_0x51f552;return _0x4545af;});}})[_0x99ed('0x1f')](respondWithFilteredResult(_0x2087ea,_0x27c96c))[_0x99ed('0x28')](handleError(_0x2087ea,null));};exports[_0x99ed('0xb0')]=function(_0x3c0625,_0x28795a,_0x4f4ae7){return db['OpenchannelAccount'][_0x99ed('0x5a')]({'where':{'id':_0x3c0625[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x28795a,null))[_0x99ed('0x1f')](function(_0x1e1f02){if(_0x1e1f02){return _0x1e1f02[_0x99ed('0xb0')](_0x3c0625['body'][_0x99ed('0xb1')],_[_0x99ed('0xb2')](_0x3c0625['body'],[_0x99ed('0xb1'),'id'])||{})[_0x99ed('0xb3')](function(_0xcad521){for(var _0x1f72fc=0x0;_0x1f72fc<_0x3c0625['body'][_0x99ed('0xb1')]['length'];_0x1f72fc+=0x1){socket[_0x99ed('0xb4')](_0x99ed('0xb5'),{'UserId':Number(_0x3c0625[_0x99ed('0x5c')][_0x99ed('0xb1')][_0x1f72fc]),'OpenchannelAccountId':Number(_0x3c0625[_0x99ed('0x58')]['id'])});}return _0xcad521;});}})['then'](respondWithResult(_0x28795a,null))[_0x99ed('0x28')](handleError(_0x28795a,null));};exports[_0x99ed('0xb6')]=function(_0x50566f,_0x5dbe99,_0x4d6f5c){return db[_0x99ed('0x52')][_0x99ed('0x5a')]({'where':{'id':_0x50566f[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x5dbe99,null))[_0x99ed('0x1f')](function(_0x146337){if(_0x146337){return _0x146337[_0x99ed('0xb6')](_0x50566f[_0x99ed('0x40')]['ids'])['then'](function(){if(_[_0x99ed('0xb7')](_0x50566f[_0x99ed('0x40')][_0x99ed('0xb1')])){for(var _0xb7ce5f=0x0;_0xb7ce5f<_0x50566f['query'][_0x99ed('0xb1')][_0x99ed('0x46')];_0xb7ce5f+=0x1){socket[_0x99ed('0xb4')](_0x99ed('0xb8'),{'UserId':Number(_0x50566f[_0x99ed('0x40')]['ids'][_0xb7ce5f]),'OpenchannelAccountId':Number(_0x50566f[_0x99ed('0x58')]['id'])});}}else{socket[_0x99ed('0xb4')](_0x99ed('0xb8'),{'UserId':Number(_0x50566f[_0x99ed('0x40')][_0x99ed('0xb1')]),'OpenchannelAccountId':Number(_0x50566f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5dbe99,null))[_0x99ed('0x28')](handleError(_0x5dbe99,null));};exports[_0x99ed('0xb9')]=function(_0x175ea4,_0x1f0b7c,_0x1836b9){var _0x16fb13={};var _0x2b64d6={};var _0x330456;var _0x74cb29;return db[_0x99ed('0x52')][_0x99ed('0x6a')]({'where':{'id':_0x175ea4[_0x99ed('0x58')]['id']}})[_0x99ed('0x1f')](handleEntityNotFound(_0x1f0b7c,null))[_0x99ed('0x1f')](function(_0xaaedda){if(_0xaaedda){_0x330456=_0xaaedda;_0x2b64d6['model']=_['keys'](db['User'][_0x99ed('0x3b')]);_0x2b64d6[_0x99ed('0x40')]=_['keys'](_0x175ea4[_0x99ed('0x40')]);_0x2b64d6['filters']=_[_0x99ed('0x43')](_0x2b64d6[_0x99ed('0x3e')],_0x2b64d6[_0x99ed('0x40')]);_0x16fb13[_0x99ed('0x44')]=_[_0x99ed('0x43')](_0x2b64d6['model'],qs['fields'](_0x175ea4[_0x99ed('0x40')][_0x99ed('0x45')]));_0x16fb13[_0x99ed('0x44')]=_0x16fb13[_0x99ed('0x44')][_0x99ed('0x46')]?_0x16fb13['attributes']:_0x2b64d6[_0x99ed('0x3e')];_0x16fb13[_0x99ed('0x49')]=qs['sort'](_0x175ea4[_0x99ed('0x40')][_0x99ed('0x4a')]);_0x16fb13[_0x99ed('0x4b')]=qs[_0x99ed('0x42')](_['pick'](_0x175ea4[_0x99ed('0x40')],_0x2b64d6[_0x99ed('0x42')]));if(_0x175ea4['query'][_0x99ed('0x4d')]){_0x16fb13[_0x99ed('0x4b')]=_[_0x99ed('0x50')](_0x16fb13[_0x99ed('0x4b')],{'$or':_[_0x99ed('0x3f')](_0x16fb13[_0x99ed('0x44')],function(_0x47c2fc){var _0x1099d1={};_0x1099d1[_0x47c2fc]={'$like':'%'+_0x175ea4[_0x99ed('0x40')]['filter']+'%'};return _0x1099d1;})});}_0x16fb13=_[_0x99ed('0x50')]({},_0x16fb13,_0x175ea4[_0x99ed('0x51')]);return _0x330456[_0x99ed('0xb9')](_0x16fb13);}})[_0x99ed('0x1f')](function(_0x285fe5){if(_0x285fe5){_0x74cb29=_0x285fe5[_0x99ed('0x46')];if(!_0x175ea4['query']['hasOwnProperty']('nolimit')){_0x16fb13[_0x99ed('0x2e')]=qs[_0x99ed('0x2e')](_0x175ea4['query'][_0x99ed('0x2e')]);_0x16fb13['offset']=qs['offset'](_0x175ea4[_0x99ed('0x40')]['offset']);}return _0x330456['getAgents'](_0x16fb13);}})[_0x99ed('0x1f')](function(_0x1a68c9){if(_0x1a68c9){return _0x1a68c9?{'count':_0x74cb29,'rows':_0x1a68c9}:null;}})[_0x99ed('0x1f')](respondWithResult(_0x1f0b7c,null))[_0x99ed('0x28')](handleError(_0x1f0b7c,null));};exports[_0x99ed('0x38')]=function(_0x24d23e,_0x139b03,_0x32a207){var _0x1d5165,_0x417f6d,_0x3bfee2;if(_[_0x99ed('0x78')](_0x24d23e[_0x99ed('0x5c')]['body'])||_0x24d23e[_0x99ed('0x5c')][_0x99ed('0x5c')]===''){throw new db[(_0x99ed('0x73'))]['ValidationError'](_0x99ed('0xba'));}if(_[_0x99ed('0x78')](_0x24d23e[_0x99ed('0x5c')]['to'])){}_0x1d5165=_0x24d23e['body']['to'];return db['OpenchannelAccount'][_0x99ed('0x6a')]({'where':{'id':_0x24d23e[_0x99ed('0x58')]['id']}})['then'](handleEntityNotFound(_0x139b03,null))[_0x99ed('0x1f')](function(_0xb783fe){if(_0xb783fe){return db['OpenchannelAccount'][_0x99ed('0x5a')]({'where':{'id':_0xb783fe['id']},'include':[{'model':db[_0x99ed('0xbb')],'as':_0x99ed('0x81'),'include':[{'model':db[_0x99ed('0x72')],'as':_0x99ed('0x7d'),'where':{[_0xb783fe[_0x99ed('0x7b')]]:_0x1d5165},'limit':0x1,'order':[[_0x99ed('0x76'),_0x99ed('0xbc')]]}]}]})[_0x99ed('0x1f')](handleEntityNotFound(_0x139b03,null))['then'](function(_0x295328){if(_0x295328&&_0x295328[_0x99ed('0x81')]){_0x417f6d=_0x295328[_0x99ed('0x60')]({'plain':!![]});if(_0x417f6d[_0x99ed('0x81')]&&_0x417f6d[_0x99ed('0x81')][_0x99ed('0x7d')][_0x99ed('0x46')]){return _0x417f6d['List'][_0x99ed('0x7d')][0x0];}return db['CmContact'][_0x99ed('0x5b')](_[_0x99ed('0xbd')](_0x24d23e['body'],{'firstName':_0x1d5165,[_0x295328[_0x99ed('0x7b')]]:_0x1d5165,'phone':_0x1d5165,'ListId':_0x417f6d['ListId']}));}})[_0x99ed('0x1f')](handleEntityNotFound(_0x139b03,null))[_0x99ed('0x1f')](function(_0x33c1f9){if(_0x33c1f9){_0x3bfee2=_0x33c1f9;return db[_0x99ed('0x88')][_0x99ed('0x5a')]({'where':{'ContactId':_0x3bfee2['id'],'closed':![],'OpenchannelAccountId':_0x417f6d['id']}})[_0x99ed('0x1f')](function(_0x2caef4){if(_0x2caef4){return[_0x2caef4,![]];}return db[_0x99ed('0x88')][_0x99ed('0x5b')]({'UserId':_0x24d23e[_0x99ed('0x5d')]['id'],'ContactId':_0x3bfee2['id'],'OpenchannelAccountId':_0x417f6d['id'],'lastMsgDirection':'out','Messages':[_[_0x99ed('0x50')](_0x24d23e[_0x99ed('0x5c')],{'read':![],'body':_0x24d23e[_0x99ed('0x5c')]['body'],'OpenchannelAccountId':_0x417f6d['id'],'UserId':_0x24d23e[_0x99ed('0x5d')]['id'],'ContactId':_0x3bfee2['id']})]},{'include':[{'model':db[_0x99ed('0x92')],'as':'Messages'}]})[_0x99ed('0x1f')](function(_0x3fca0d){return[_0x3fca0d,!![]];});});}})[_0x99ed('0xb3')](function(_0x354491,_0x547754){if(_0x547754){return _0x354491;}return db[_0x99ed('0x92')][_0x99ed('0x5b')](_[_0x99ed('0x50')](_0x24d23e[_0x99ed('0x5c')],{'read':![],'body':_0x24d23e['body'][_0x99ed('0x5c')],'OpenchannelAccountId':_0x417f6d['id'],'OpenchannelInteractionId':_0x354491['id'],'UserId':_0x24d23e[_0x99ed('0x5d')]['id'],'ContactId':_0x3bfee2['id']}))[_0x99ed('0x1f')](function(_0x273954){_0x354491[_0x99ed('0xbe')][_0x99ed('0xbf')]=[];_0x354491[_0x99ed('0xbe')]['Messages'][_0x99ed('0x8e')](_0x273954[_0x99ed('0xbe')]);return _0x354491;});});}})[_0x99ed('0x1f')](respondWithResult(_0x139b03,null))['catch'](handleError(_0x139b03,null));}; \ No newline at end of file +var _0xfdd6=['autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','destroy','get','UserProfileResource','end','name','send','index','mandatoryDispositionPause','OpenchannelAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','count','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','getAnswers','CannedAnswer','order','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','asc','defaults','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created'];(function(_0x5062d1,_0x1cc467){var _0x4f1cd3=function(_0x35f8fa){while(--_0x35f8fa){_0x5062d1['push'](_0x5062d1['shift']());}};_0x4f1cd3(++_0x1cc467);}(_0xfdd6,0xde));var _0x6fdd=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0xfdd6[_0x12c280];return _0x3638d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6fdd('0x0'));var jsonpatch=require(_0x6fdd('0x1'));var rp=require(_0x6fdd('0x2'));var moment=require(_0x6fdd('0x3'));var BPromise=require(_0x6fdd('0x4'));var Mustache=require(_0x6fdd('0x5'));var util=require(_0x6fdd('0x6'));var path=require(_0x6fdd('0x7'));var sox=require(_0x6fdd('0x8'));var csv=require('to-csv');var ejs=require(_0x6fdd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6fdd('0xa'));var squel=require('squel');var crypto=require(_0x6fdd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6fdd('0xc'));var toCsv=require(_0x6fdd('0xd'));var querystring=require(_0x6fdd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6fdd('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6fdd('0x10'));var utils=require(_0x6fdd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6fdd('0x12'));var db=require('../../mysqldb')['db'];config[_0x6fdd('0x13')]=_['defaults'](config[_0x6fdd('0x13')],{'host':_0x6fdd('0x14'),'port':0x18eb});var socket=require(_0x6fdd('0x15'))(new Redis(config[_0x6fdd('0x13')]));require(_0x6fdd('0x16'))['register'](socket);var jayson=require(_0x6fdd('0x17'));var client=jayson[_0x6fdd('0x18')][_0x6fdd('0x19')]({'port':0x232c});var client9002=jayson[_0x6fdd('0x18')][_0x6fdd('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2bc5f9,_0x4cb8ac,_0x311cf0,_0x112309){return new BPromise(function(_0xe5fbdb,_0x172f9b){var _0x43744e=_0x112309||client;return _0x43744e['request'](_0x2bc5f9,_0x311cf0)[_0x6fdd('0x1a')](function(_0xcfb70d){logger[_0x6fdd('0x1b')](_0x6fdd('0x1c'),_0x4cb8ac,_0x6fdd('0x1d'));logger[_0x6fdd('0x1e')](_0x6fdd('0x1f'),_0x4cb8ac,_0x6fdd('0x1d'),JSON['stringify'](_0xcfb70d));if(_0xcfb70d[_0x6fdd('0x20')]){if(_0xcfb70d[_0x6fdd('0x20')]['code']===0x1f4){logger[_0x6fdd('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x4cb8ac,_0xcfb70d[_0x6fdd('0x20')]['message']);return _0x172f9b(_0xcfb70d[_0x6fdd('0x20')][_0x6fdd('0x21')]);}logger[_0x6fdd('0x20')](_0x6fdd('0x1c'),_0x4cb8ac,_0xcfb70d['error'][_0x6fdd('0x21')]);return _0xe5fbdb(_0xcfb70d['error'][_0x6fdd('0x21')]);}else{logger[_0x6fdd('0x1b')](_0x6fdd('0x1c'),_0x4cb8ac,'request\x20sent');_0xe5fbdb(_0xcfb70d['result'][_0x6fdd('0x21')]);}})[_0x6fdd('0x22')](function(_0x2abf69){logger[_0x6fdd('0x20')](_0x6fdd('0x1c'),_0x4cb8ac,_0x2abf69);_0x172f9b(_0x2abf69);});});}function respondWithStatusCode(_0x511f39,_0x15376d){_0x15376d=_0x15376d||0xcc;return function(_0x1e7a0c){if(_0x1e7a0c){return _0x511f39[_0x6fdd('0x23')](_0x15376d);}return _0x511f39[_0x6fdd('0x24')](_0x15376d)['end']();};}function respondWithResult(_0x43cd04,_0x212d28){_0x212d28=_0x212d28||0xc8;return function(_0x3a0810){if(_0x3a0810){return _0x43cd04[_0x6fdd('0x24')](_0x212d28)[_0x6fdd('0x25')](_0x3a0810);}};}function respondWithFilteredResult(_0x5a790b,_0xf964aa){return function(_0x2fa674){if(_0x2fa674){var _0x193094=typeof _0xf964aa[_0x6fdd('0x26')]===_0x6fdd('0x27')&&typeof _0xf964aa[_0x6fdd('0x28')]===_0x6fdd('0x27');var _0x28fe43=_0x2fa674['count'];var _0x5906ea=_0x193094?0x0:_0xf964aa['offset'];var _0x361160=_0x193094?_0x2fa674['count']:_0xf964aa[_0x6fdd('0x26')]+_0xf964aa['limit'];var _0x4d7f82;if(_0x361160>=_0x28fe43){_0x361160=_0x28fe43;_0x4d7f82=0xc8;}else{_0x4d7f82=0xce;}_0x5a790b[_0x6fdd('0x24')](_0x4d7f82);return _0x5a790b[_0x6fdd('0x29')](_0x6fdd('0x2a'),_0x5906ea+'-'+_0x361160+'/'+_0x28fe43)[_0x6fdd('0x25')](_0x2fa674);}return null;};}function patchUpdates(_0x4c72c4){return function(_0x39e2ed){try{jsonpatch['apply'](_0x39e2ed,_0x4c72c4,!![]);}catch(_0x541d47){return BPromise[_0x6fdd('0x2b')](_0x541d47);}return _0x39e2ed['save']();};}function saveUpdates(_0x238275,_0x40b2d6){return function(_0x21512a){if(_0x21512a){return _0x21512a['update'](_0x238275)['then'](function(_0x521ff7){return _0x521ff7;});}return null;};}function removeEntity(_0x3abad6,_0x241e3e){return function(_0x4ba3d2){if(_0x4ba3d2){return _0x4ba3d2[_0x6fdd('0x2c')]()[_0x6fdd('0x1a')](function(){var _0x1d6dd3=_0x4ba3d2[_0x6fdd('0x2d')]({'plain':!![]});var _0x52052d='OpenchannelAccounts';return db[_0x6fdd('0x2e')][_0x6fdd('0x2c')]({'where':{'type':_0x52052d,'resourceId':_0x1d6dd3['id']}})[_0x6fdd('0x1a')](function(){return _0x4ba3d2;});})[_0x6fdd('0x1a')](function(){_0x3abad6[_0x6fdd('0x24')](0xcc)[_0x6fdd('0x2f')]();});}};}function handleEntityNotFound(_0x423d8a,_0x49ca55){return function(_0x1bcba9){if(!_0x1bcba9){_0x423d8a[_0x6fdd('0x23')](0x194);}return _0x1bcba9;};}function handleError(_0x46f8c2,_0x6f74a0){_0x6f74a0=_0x6f74a0||0x1f4;return function(_0x200871){logger[_0x6fdd('0x20')](_0x200871['stack']);if(_0x200871['name']){delete _0x200871[_0x6fdd('0x30')];}_0x46f8c2[_0x6fdd('0x24')](_0x6f74a0)[_0x6fdd('0x31')](_0x200871);};}exports[_0x6fdd('0x32')]=function(_0x4c62b6,_0x3ff5f9){var _0x223c26={'include':[{'model':db['Pause'],'as':_0x6fdd('0x33')}]},_0x6f0d06={},_0x53c445={'count':0x0,'rows':[]};var _0x35789f=_['map'](db[_0x6fdd('0x34')]['rawAttributes'],function(_0x1d349d){return{'name':_0x1d349d[_0x6fdd('0x35')],'type':_0x1d349d['type'][_0x6fdd('0x36')]};});_0x6f0d06[_0x6fdd('0x37')]=_['map'](_0x35789f,_0x6fdd('0x30'));_0x6f0d06[_0x6fdd('0x38')]=_[_0x6fdd('0x39')](_0x4c62b6['query']);_0x6f0d06[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x6f0d06[_0x6fdd('0x37')],_0x6f0d06['query']);_0x223c26[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x6f0d06[_0x6fdd('0x37')],qs[_0x6fdd('0x3d')](_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x223c26[_0x6fdd('0x3c')]=_0x223c26[_0x6fdd('0x3c')][_0x6fdd('0x3e')]?_0x223c26[_0x6fdd('0x3c')]:_0x6f0d06[_0x6fdd('0x37')];if(!_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x3f')](_0x6fdd('0x40'))){_0x223c26['limit']=qs[_0x6fdd('0x28')](_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x28')]);_0x223c26[_0x6fdd('0x26')]=qs['offset'](_0x4c62b6[_0x6fdd('0x38')]['offset']);}_0x223c26['order']=qs[_0x6fdd('0x41')](_0x4c62b6['query'][_0x6fdd('0x41')]);_0x223c26['where']=qs[_0x6fdd('0x3a')](_[_0x6fdd('0x42')](_0x4c62b6[_0x6fdd('0x38')],_0x6f0d06['filters']),_0x35789f);if(_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x223c26[_0x6fdd('0x44')]=_[_0x6fdd('0x45')](_0x223c26[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x35789f,function(_0x29147e){if(_0x29147e['type']!=='VIRTUAL'){var _0x2c384b={};_0x2c384b[_0x29147e[_0x6fdd('0x30')]]={'$like':'%'+_0x4c62b6['query'][_0x6fdd('0x43')]+'%'};return _0x2c384b;}})});}_0x223c26=_['merge']({},_0x223c26,_0x4c62b6[_0x6fdd('0x47')]);var _0x21f0ba={'where':_0x223c26['where']};return db[_0x6fdd('0x34')][_0x6fdd('0x48')](_0x21f0ba)[_0x6fdd('0x1a')](function(_0x17d443){_0x53c445['count']=_0x17d443;if(_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x49')]){_0x223c26['include']=[{'all':!![]}];}return db[_0x6fdd('0x34')][_0x6fdd('0x4a')](_0x223c26);})['then'](function(_0x4dde2d){_0x53c445[_0x6fdd('0x4b')]=_0x4dde2d;return _0x53c445;})[_0x6fdd('0x1a')](respondWithFilteredResult(_0x3ff5f9,_0x223c26))[_0x6fdd('0x22')](handleError(_0x3ff5f9,null));};exports[_0x6fdd('0x4c')]=function(_0x445b62,_0x4c8964){var _0x13d589={'raw':![],'where':{'id':_0x445b62[_0x6fdd('0x4d')]['id']},'include':[{'model':db['Pause'],'as':_0x6fdd('0x33')}]},_0x5c984a={};_0x5c984a[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db[_0x6fdd('0x34')][_0x6fdd('0x4e')]);_0x5c984a[_0x6fdd('0x38')]=_['keys'](_0x445b62[_0x6fdd('0x38')]);_0x5c984a[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x5c984a[_0x6fdd('0x37')],_0x5c984a[_0x6fdd('0x38')]);_0x13d589[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x5c984a[_0x6fdd('0x37')],qs[_0x6fdd('0x3d')](_0x445b62[_0x6fdd('0x38')]['fields']));_0x13d589[_0x6fdd('0x3c')]=_0x13d589[_0x6fdd('0x3c')][_0x6fdd('0x3e')]?_0x13d589[_0x6fdd('0x3c')]:_0x5c984a[_0x6fdd('0x37')];if(_0x445b62[_0x6fdd('0x38')][_0x6fdd('0x49')]){_0x13d589[_0x6fdd('0x4f')]=[{'all':!![]}];}_0x13d589=_['merge']({},_0x13d589,_0x445b62[_0x6fdd('0x47')]);return db[_0x6fdd('0x34')][_0x6fdd('0x50')](_0x13d589)[_0x6fdd('0x1a')](handleEntityNotFound(_0x4c8964,null))['then'](respondWithResult(_0x4c8964,null))['catch'](handleError(_0x4c8964,null));};exports['create']=function(_0x4e6073,_0x319f1c){return db[_0x6fdd('0x34')][_0x6fdd('0x51')](_0x4e6073[_0x6fdd('0x52')],{})[_0x6fdd('0x1a')](function(_0x5b46f9){var _0x197183=_0x4e6073[_0x6fdd('0x53')][_0x6fdd('0x2d')]({'plain':!![]});if(!_0x197183)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x197183[_0x6fdd('0x54')]===_0x6fdd('0x53')){var _0xb4673c=_0x5b46f9[_0x6fdd('0x2d')]({'plain':!![]});var _0x5a528a=_0x6fdd('0x55');return db[_0x6fdd('0x56')][_0x6fdd('0x50')]({'where':{'name':_0x5a528a,'userProfileId':_0x197183[_0x6fdd('0x57')]},'raw':!![]})[_0x6fdd('0x1a')](function(_0x47dea1){if(_0x47dea1&&_0x47dea1[_0x6fdd('0x58')]===0x0){return db['UserProfileResource'][_0x6fdd('0x51')]({'name':_0xb4673c[_0x6fdd('0x30')],'resourceId':_0xb4673c['id'],'type':_0x47dea1[_0x6fdd('0x30')],'sectionId':_0x47dea1['id']},{})[_0x6fdd('0x1a')](function(){return _0x5b46f9;});}else{return _0x5b46f9;}})[_0x6fdd('0x22')](function(_0x5d0cf3){logger[_0x6fdd('0x20')](_0x6fdd('0x59'),_0x5d0cf3);throw _0x5d0cf3;});}return _0x5b46f9;})[_0x6fdd('0x1a')](respondWithResult(_0x319f1c,0xc9))[_0x6fdd('0x22')](handleError(_0x319f1c,null));};exports[_0x6fdd('0x5a')]=function(_0x379b0c,_0x542c4f){if(_0x379b0c[_0x6fdd('0x52')]['id']){delete _0x379b0c['body']['id'];}return db['OpenchannelAccount'][_0x6fdd('0x50')]({'where':{'id':_0x379b0c[_0x6fdd('0x4d')]['id']},'include':[{'model':db[_0x6fdd('0x5b')],'as':_0x6fdd('0x33')}]})[_0x6fdd('0x1a')](handleEntityNotFound(_0x542c4f,null))['then'](saveUpdates(_0x379b0c[_0x6fdd('0x52')],null))[_0x6fdd('0x1a')](respondWithResult(_0x542c4f,null))[_0x6fdd('0x22')](handleError(_0x542c4f,null));};exports[_0x6fdd('0x2c')]=function(_0x4057b4,_0x1a2a14){return db[_0x6fdd('0x34')][_0x6fdd('0x50')]({'where':{'id':_0x4057b4[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x1a2a14,null))['then'](removeEntity(_0x1a2a14,null))['catch'](handleError(_0x1a2a14,null));};exports['describe']=function(_0x1db426,_0x5340f9){return db[_0x6fdd('0x34')][_0x6fdd('0x5c')]()['then'](respondWithResult(_0x5340f9,null))[_0x6fdd('0x22')](handleError(_0x5340f9,null));};exports[_0x6fdd('0x5d')]=function(_0x209b73,_0x4c0fe1,_0x18d717){if(_0x209b73['body']['id']){delete _0x209b73[_0x6fdd('0x52')]['id'];}return db[_0x6fdd('0x34')]['find']({'where':{'id':_0x209b73[_0x6fdd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c0fe1,null))['then'](function(_0x3c2f25){if(_0x3c2f25){_0x209b73[_0x6fdd('0x52')][_0x6fdd('0x5e')]=_0x3c2f25['id'];return db[_0x6fdd('0x5f')][_0x6fdd('0x51')](_0x209b73['body']);}})[_0x6fdd('0x1a')](respondWithResult(_0x4c0fe1,null))['catch'](handleError(_0x4c0fe1,null));};exports[_0x6fdd('0x60')]=function(_0x2c4e4e,_0x298733,_0x1f8dde){var _0x18c081={'raw':![],'where':{}};var _0x49af81={};var _0x577623={'count':0x0,'rows':[]};return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x2c4e4e['params']['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x298733,null))[_0x6fdd('0x1a')](function(_0x37c05c){if(_0x37c05c){_0x49af81[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db[_0x6fdd('0x5f')]['rawAttributes']);_0x49af81['query']=_['keys'](_0x2c4e4e['query']);_0x49af81[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x49af81['model'],_0x49af81[_0x6fdd('0x38')]);_0x18c081[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x49af81['model'],qs[_0x6fdd('0x3d')](_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x18c081[_0x6fdd('0x3c')]=_0x18c081['attributes'][_0x6fdd('0x3e')]?_0x18c081[_0x6fdd('0x3c')]:_0x49af81[_0x6fdd('0x37')];if(!_0x2c4e4e['query']['hasOwnProperty'](_0x6fdd('0x40'))){_0x18c081['limit']=qs[_0x6fdd('0x28')](_0x2c4e4e['query'][_0x6fdd('0x28')]);_0x18c081['offset']=qs[_0x6fdd('0x26')](_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x26')]);}_0x18c081['order']=qs[_0x6fdd('0x41')](_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x41')]);_0x18c081['where']=qs[_0x6fdd('0x3a')](_['pick'](_0x2c4e4e[_0x6fdd('0x38')],_0x49af81[_0x6fdd('0x3a')]));_0x18c081['where'][_0x6fdd('0x5e')]=_0x37c05c['id'];if(_0x2c4e4e[_0x6fdd('0x38')]['filter']){_0x18c081[_0x6fdd('0x44')]=_[_0x6fdd('0x45')](_0x18c081[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x18c081['attributes'],function(_0x26b01b){var _0x726cd2={};_0x726cd2[_0x26b01b]={'$like':'%'+_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x43')]+'%'};return _0x726cd2;})});}_0x18c081=_['merge']({},_0x18c081,_0x2c4e4e['options']);return db['Disposition'][_0x6fdd('0x48')]({'where':_0x18c081[_0x6fdd('0x44')]})[_0x6fdd('0x1a')](function(_0x453290){_0x577623[_0x6fdd('0x48')]=_0x453290;if(_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x49')]){_0x18c081[_0x6fdd('0x4f')]=[{'all':!![]}];}return db[_0x6fdd('0x5f')][_0x6fdd('0x4a')](_0x18c081);})[_0x6fdd('0x1a')](function(_0x1b4335){_0x577623[_0x6fdd('0x4b')]=_0x1b4335;return _0x577623;});}})[_0x6fdd('0x1a')](respondWithFilteredResult(_0x298733,_0x18c081))[_0x6fdd('0x22')](handleError(_0x298733,null));};exports[_0x6fdd('0x62')]=function(_0x2de9dd,_0x21e76d,_0x5acc81){return db['OpenchannelAccount']['find']({'where':{'id':_0x2de9dd[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x21e76d,null))['then'](function(_0x213cca){if(_0x213cca){return _0x213cca[_0x6fdd('0x62')](_0x2de9dd[_0x6fdd('0x38')][_0x6fdd('0x63')]);}})['then'](respondWithStatusCode(_0x21e76d,null))[_0x6fdd('0x22')](handleError(_0x21e76d,null));};exports['addAnswer']=function(_0x329ccd,_0x22ded2,_0x35be3d){if(_0x329ccd[_0x6fdd('0x52')]['id']){delete _0x329ccd[_0x6fdd('0x52')]['id'];}return db[_0x6fdd('0x34')][_0x6fdd('0x50')]({'where':{'id':_0x329ccd[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x22ded2,null))[_0x6fdd('0x1a')](function(_0x5d82bb){if(_0x5d82bb){_0x329ccd[_0x6fdd('0x52')][_0x6fdd('0x5e')]=_0x5d82bb['id'];return db['CannedAnswer'][_0x6fdd('0x51')](_0x329ccd[_0x6fdd('0x52')]);}})[_0x6fdd('0x1a')](respondWithResult(_0x22ded2,null))['catch'](handleError(_0x22ded2,null));};exports[_0x6fdd('0x64')]=function(_0x46c36a,_0x2abed4,_0x558ea1){var _0x4ed4f1={'raw':![],'where':{}};var _0x3811c6={};var _0xc71e4b={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x46c36a[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x2abed4,null))['then'](function(_0x3e7cc8){if(_0x3e7cc8){_0x3811c6[_0x6fdd('0x37')]=_['keys'](db[_0x6fdd('0x65')][_0x6fdd('0x4e')]);_0x3811c6['query']=_[_0x6fdd('0x39')](_0x46c36a[_0x6fdd('0x38')]);_0x3811c6[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x3811c6['model'],_0x3811c6['query']);_0x4ed4f1[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x3811c6['model'],qs[_0x6fdd('0x3d')](_0x46c36a[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x4ed4f1['attributes']=_0x4ed4f1[_0x6fdd('0x3c')][_0x6fdd('0x3e')]?_0x4ed4f1[_0x6fdd('0x3c')]:_0x3811c6[_0x6fdd('0x37')];if(!_0x46c36a[_0x6fdd('0x38')]['hasOwnProperty'](_0x6fdd('0x40'))){_0x4ed4f1[_0x6fdd('0x28')]=qs['limit'](_0x46c36a[_0x6fdd('0x38')]['limit']);_0x4ed4f1[_0x6fdd('0x26')]=qs['offset'](_0x46c36a[_0x6fdd('0x38')]['offset']);}_0x4ed4f1[_0x6fdd('0x66')]=qs[_0x6fdd('0x41')](_0x46c36a['query'][_0x6fdd('0x41')]);_0x4ed4f1[_0x6fdd('0x44')]=qs[_0x6fdd('0x3a')](_['pick'](_0x46c36a[_0x6fdd('0x38')],_0x3811c6[_0x6fdd('0x3a')]));_0x4ed4f1[_0x6fdd('0x44')][_0x6fdd('0x5e')]=_0x3e7cc8['id'];if(_0x46c36a[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x4ed4f1[_0x6fdd('0x44')]=_['merge'](_0x4ed4f1[_0x6fdd('0x44')],{'$or':_['map'](_0x4ed4f1[_0x6fdd('0x3c')],function(_0x1dd7f9){var _0x43a7cb={};_0x43a7cb[_0x1dd7f9]={'$like':'%'+_0x46c36a['query'][_0x6fdd('0x43')]+'%'};return _0x43a7cb;})});}_0x4ed4f1=_['merge']({},_0x4ed4f1,_0x46c36a[_0x6fdd('0x47')]);return db[_0x6fdd('0x65')]['count']({'where':_0x4ed4f1[_0x6fdd('0x44')]})[_0x6fdd('0x1a')](function(_0x551dd0){_0xc71e4b[_0x6fdd('0x48')]=_0x551dd0;if(_0x46c36a['query'][_0x6fdd('0x49')]){_0x4ed4f1['include']=[{'all':!![]}];}return db[_0x6fdd('0x65')][_0x6fdd('0x4a')](_0x4ed4f1);})[_0x6fdd('0x1a')](function(_0x573787){_0xc71e4b[_0x6fdd('0x4b')]=_0x573787;return _0xc71e4b;});}})[_0x6fdd('0x1a')](respondWithFilteredResult(_0x2abed4,_0x4ed4f1))[_0x6fdd('0x22')](handleError(_0x2abed4,null));};exports['removeAnswers']=function(_0xb6fb29,_0x3ec574,_0x21c78c){return db[_0x6fdd('0x34')]['find']({'where':{'id':_0xb6fb29[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x3ec574,null))['then'](function(_0x3ed875){if(_0x3ed875){return _0x3ed875['removeAnswers'](_0xb6fb29['query'][_0x6fdd('0x63')]);}})[_0x6fdd('0x1a')](respondWithStatusCode(_0x3ec574,null))['catch'](handleError(_0x3ec574,null));};exports[_0x6fdd('0x67')]=function(_0x5c12a2,_0x4ef9f3,_0x1692c5){var _0x4de1d7={'body':_0x5c12a2[_0x6fdd('0x52')],'channel':_0x6fdd('0x68')};var _0x3303b8=[];var _0x5db087=[];var _0x598a59={};var _0x391e67=![];return db[_0x6fdd('0x69')][_0x6fdd('0x5c')]()['then'](function(_0x23bde1){if(!_0x23bde1){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))](_0x6fdd('0x6c'));}_0x3303b8=_['difference'](_['keys'](_0x23bde1),[_0x6fdd('0x6d'),_0x6fdd('0x6e')]);_0x5db087=_[_0x6fdd('0x6f')](_[_0x6fdd('0x39')](_0x23bde1),['createdAt',_0x6fdd('0x6e'),'CompanyId',_0x6fdd('0x70')]);if(_0x5c12a2[_0x6fdd('0x52')]['id']){delete _0x5c12a2[_0x6fdd('0x52')]['id'];}if(_[_0x6fdd('0x71')](_0x5c12a2['body'][_0x6fdd('0x72')])){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))]('from\x20is\x20mandatory');}if(_[_0x6fdd('0x71')](_0x5c12a2['body'][_0x6fdd('0x52')])||_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x52')]===''){throw new db[(_0x6fdd('0x6a'))]['ValidationError'](_0x6fdd('0x73'));}if(_[_0x6fdd('0x71')](_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x74')])){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5db087);}if(!_[_0x6fdd('0x75')](_0x5db087,_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x74')])){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))](_0x6fdd('0x76')+_0x5db087);}_0x598a59[_0x5c12a2['body'][_0x6fdd('0x74')]]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x72')];})[_0x6fdd('0x1a')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x5c12a2[_0x6fdd('0x4d')]['id']},'include':[{'model':db['CmList'],'as':_0x6fdd('0x77'),'include':[{'model':db[_0x6fdd('0x69')],'as':_0x6fdd('0x78'),'where':_0x598a59,'limit':0x1,'order':[[_0x6fdd('0x6e'),_0x6fdd('0x79')]]}]},{'model':db[_0x6fdd('0x7a')],'as':_0x6fdd('0x7b')}]});})[_0x6fdd('0x1a')](handleEntityNotFound(_0x4ef9f3,null))['then'](function(_0x57e2bf){if(_0x57e2bf&&_0x57e2bf['List']){_0x4de1d7[_0x6fdd('0x7c')]=_0x57e2bf;_0x4de1d7[_0x6fdd('0x7d')]=_0x57e2bf[_0x6fdd('0x7b')];_0x4de1d7[_0x6fdd('0x7e')]=_0x57e2bf[_0x6fdd('0x77')];_0x4de1d7[_0x6fdd('0x7d')]=_['orderBy'](_0x4de1d7[_0x6fdd('0x7d')],['priority'],[_0x6fdd('0x7f')]);if(_0x4de1d7[_0x6fdd('0x7c')][_0x6fdd('0x7b')]){delete _0x4de1d7[_0x6fdd('0x7c')]['Applications'];}if(_0x4de1d7['account'][_0x6fdd('0x77')]&&_0x4de1d7['account']['List']['Contacts'][_0x6fdd('0x3e')]){return _0x4de1d7[_0x6fdd('0x7c')][_0x6fdd('0x77')][_0x6fdd('0x78')][0x0];}var _0x36dc4b=_[_0x6fdd('0x80')](_0x5c12a2['body'],{'firstName':_0x5c12a2['body']['from'],'ListId':_0x57e2bf[_0x6fdd('0x70')]});_0x36dc4b[_0x5c12a2[_0x6fdd('0x52')]['mapKey']]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x72')];return db[_0x6fdd('0x69')][_0x6fdd('0x51')](_0x36dc4b,{'fields':_0x3303b8,'raw':!![]});}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x4ef9f3,null))[_0x6fdd('0x1a')](function(_0x25c218){_0x4de1d7[_0x6fdd('0x81')]=_0x25c218;if(_0x25c218){var _0x4da1dc={'ContactId':_0x25c218['id'],'OpenchannelAccountId':_0x5c12a2[_0x6fdd('0x4d')]['id'],'from':(_0x25c218[_0x6fdd('0x82')]||'')+'\x20'+(_0x25c218[_0x6fdd('0x83')]||'')};var _0x38b1ff={'OpenchannelAccountId':_0x5c12a2['params']['id'],'closed':![]};if(_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x84')]){_0x38b1ff[_0x6fdd('0x84')]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x84')];return db['OpenchannelInteraction']['find']({'where':_0x38b1ff})[_0x6fdd('0x1a')](function(_0x28d49a){if(_0x28d49a){return[_0x28d49a,![]];}_0x4da1dc[_0x6fdd('0x84')]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x84')];_0x4da1dc['externalUrl']=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x85')];return db[_0x6fdd('0x86')][_0x6fdd('0x51')](_0x4da1dc)[_0x6fdd('0x1a')](function(_0x1fc9c3){return[_0x1fc9c3,!![]];});});}else{_0x38b1ff[_0x6fdd('0x84')]=null;}_0x38b1ff[_0x6fdd('0x87')]=_0x25c218['id'];return db[_0x6fdd('0x86')][_0x6fdd('0x50')]({'where':_0x38b1ff})[_0x6fdd('0x1a')](function(_0x11b5d8){if(_0x11b5d8){return[_0x11b5d8,![]];}return db[_0x6fdd('0x86')]['create'](_0x4da1dc)['then'](function(_0x2bd459){return[_0x2bd459,!![]];});});}})[_0x6fdd('0x88')](function(_0x52d051,_0x285b2e){if(_0x52d051){_0x391e67=_0x285b2e;if(!_0x285b2e){var _0x386607={'from':(_0x4de1d7['contact'][_0x6fdd('0x82')]||'')+'\x20'+(_0x4de1d7[_0x6fdd('0x81')][_0x6fdd('0x83')]||'')};if(_0x5c12a2['body'][_0x6fdd('0x84')]&&_0x5c12a2[_0x6fdd('0x52')]['messageId']&&_0x5c12a2[_0x6fdd('0x52')]['threadId']!=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x89')]){_0x386607[_0x6fdd('0x84')]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x89')];}return _0x52d051[_0x6fdd('0x5a')](_0x386607);}else{return _0x52d051;}}})[_0x6fdd('0x1a')](function(_0x3f5721){_0x4de1d7['interaction']=_0x3f5721[_0x6fdd('0x2d')]({'plain':!![]});_0x4de1d7[_0x6fdd('0x8a')][_0x6fdd('0x8b')]=_0x391e67;if(_0x4de1d7[_0x6fdd('0x8a')]['created']){if(_0x4de1d7['account'][_0x6fdd('0x8c')]){_0x4de1d7[_0x6fdd('0x7d')][_0x6fdd('0x8d')]({'id':0x0,'priority':_0x4de1d7[_0x6fdd('0x7d')]['length']+0x1,'app':'close','appdata':_0x6fdd('0x8e'),'interval':_0x6fdd('0x8f')});}}return db[_0x6fdd('0x90')]['create']({'body':_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x52')],'OpenchannelAccountId':_0x5c12a2[_0x6fdd('0x4d')]['id'],'OpenchannelInteractionId':_0x3f5721['id'],'direction':'in','ContactId':_0x4de1d7['contact']['id'],'AttachmentId':_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x91')]});})['then'](function(_0x59c586){_0x4de1d7[_0x6fdd('0x21')]=_0x59c586;if(_0x4de1d7[_0x6fdd('0x8a')][_0x6fdd('0x92')]){return db[_0x6fdd('0x93')][_0x6fdd('0x50')]({'attributes':['id',_0x6fdd('0x30')],'where':{'id':_0x4de1d7[_0x6fdd('0x8a')]['UserId']}})[_0x6fdd('0x1a')](function(_0x2239a8){if(_0x2239a8){_0x4de1d7[_0x6fdd('0x7d')][_0x6fdd('0x94')]({'id':0x0,'priority':0x0,'app':_0x6fdd('0x95'),'appdata':_0x2239a8[_0x6fdd('0x30')]+','+(_0x4de1d7['account'][_0x6fdd('0x96')]||0xa),'interval':'*,*,*,*'});_0x4de1d7[_0x6fdd('0x97')]=![];}return respondWithRpcPromise(_0x6fdd('0x98'),'startRouting',_0x4de1d7);});}return respondWithRpcPromise(_0x6fdd('0x98'),'startRouting',_0x4de1d7);})[_0x6fdd('0x1a')](function(_0xfad521){respondWithRpcPromise(_0x6fdd('0x99'),'EventManager',{'event':_0x6fdd('0x67'),'message':_0xfad521},client9002);return _0xfad521;})['then'](respondWithResult(_0x4ef9f3,null))[_0x6fdd('0x22')](handleError(_0x4ef9f3,null));};exports[_0x6fdd('0x9a')]=function(_0x2d2205,_0x487fae){var _0x529bc3=_0x2d2205[_0x6fdd('0x4d')]['id'];var _0x182e2d=_0x2d2205[_0x6fdd('0x52')];var _0x4fcf9e=0xc8;var _0x557c37=null;return db[_0x6fdd('0x9b')][_0x6fdd('0x9c')]({'isolationLevel':db[_0x6fdd('0x9b')][_0x6fdd('0x9d')][_0x6fdd('0x9e')][_0x6fdd('0x9f')]},function(_0xae250b){return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x529bc3},'transaction':_0xae250b})[_0x6fdd('0x1a')](function(_0x410d3b){if(_0x410d3b){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x529bc3},'transaction':_0xae250b})[_0x6fdd('0x1a')](function(){var _0x22b01a=_[_0x6fdd('0x46')](_0x182e2d,function(_0x88d663){_0x88d663[_0x6fdd('0x5e')]=_0x529bc3;return _0x88d663;});return db['OpenchannelApplication']['bulkCreate'](_0x22b01a,{'transaction':_0xae250b});});}else{_0x4fcf9e=0x194;_0x557c37=[];}});})['then'](function(){if(_0x4fcf9e!==0x194){return db['OpenchannelApplication'][_0x6fdd('0xa0')]({'where':{'OpenchannelAccountId':_0x529bc3},'order':'priority'})[_0x6fdd('0x1a')](function(_0x1908ca){_0x557c37=_0x1908ca;});}})['catch'](function(_0x20c828){_0x4fcf9e=0x1f4;logger[_0x6fdd('0x20')](_0x20c828[_0x6fdd('0xa1')]);if(_0x20c828[_0x6fdd('0x30')]){delete _0x20c828[_0x6fdd('0x30')];}_0x557c37=_0x20c828;})[_0x6fdd('0xa2')](function(){if(_0x557c37===null){_0x487fae[_0x6fdd('0x23')](_0x4fcf9e);}else{if(_0x4fcf9e===0x1f4){_0x487fae[_0x6fdd('0x24')](_0x4fcf9e)[_0x6fdd('0x31')](_0x557c37);}else{_0x487fae[_0x6fdd('0x24')](_0x4fcf9e)[_0x6fdd('0x25')](_0x557c37);}}});};exports[_0x6fdd('0xa3')]=function(_0x1e35db,_0x286777,_0x36b0e7){var _0x489b0d={};var _0x4ea72d={};var _0x2eb02f;var _0xa89f95;return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x1e35db[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x286777,null))[_0x6fdd('0x1a')](function(_0x380989){if(_0x380989){_0x2eb02f=_0x380989;_0x4ea72d[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db[_0x6fdd('0x7a')][_0x6fdd('0x4e')]);_0x4ea72d[_0x6fdd('0x38')]=_[_0x6fdd('0x39')](_0x1e35db['query']);_0x4ea72d[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x4ea72d['model'],_0x4ea72d[_0x6fdd('0x38')]);_0x489b0d[_0x6fdd('0x3c')]=_['intersection'](_0x4ea72d[_0x6fdd('0x37')],qs[_0x6fdd('0x3d')](_0x1e35db[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x489b0d['attributes']=_0x489b0d['attributes'][_0x6fdd('0x3e')]?_0x489b0d[_0x6fdd('0x3c')]:_0x4ea72d[_0x6fdd('0x37')];_0x489b0d[_0x6fdd('0x66')]=qs[_0x6fdd('0x41')](_0x1e35db['query'][_0x6fdd('0x41')]);_0x489b0d[_0x6fdd('0x44')]=qs[_0x6fdd('0x3a')](_[_0x6fdd('0x42')](_0x1e35db['query'],_0x4ea72d['filters']));if(_0x1e35db[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x489b0d[_0x6fdd('0x44')]=_[_0x6fdd('0x45')](_0x489b0d[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x489b0d[_0x6fdd('0x3c')],function(_0x426404){var _0x56e8cf={};_0x56e8cf[_0x426404]={'$like':'%'+_0x1e35db[_0x6fdd('0x38')][_0x6fdd('0x43')]+'%'};return _0x56e8cf;})});}_0x489b0d=_[_0x6fdd('0x45')]({},_0x489b0d,_0x1e35db[_0x6fdd('0x47')]);return _0x2eb02f[_0x6fdd('0xa3')](_0x489b0d);}})[_0x6fdd('0x1a')](function(_0x52dc5d){if(_0x52dc5d){_0xa89f95=_0x52dc5d[_0x6fdd('0x3e')];if(!_0x1e35db[_0x6fdd('0x38')][_0x6fdd('0x3f')](_0x6fdd('0x40'))){_0x489b0d[_0x6fdd('0x28')]=qs[_0x6fdd('0x28')](_0x1e35db['query'][_0x6fdd('0x28')]);_0x489b0d[_0x6fdd('0x26')]=qs[_0x6fdd('0x26')](_0x1e35db['query'][_0x6fdd('0x26')]);}return _0x2eb02f[_0x6fdd('0xa3')](_0x489b0d);}})[_0x6fdd('0x1a')](function(_0x32bbc7){if(_0x32bbc7){return _0x32bbc7?{'count':_0xa89f95,'rows':_0x32bbc7}:null;}})[_0x6fdd('0x1a')](respondWithResult(_0x286777,null))[_0x6fdd('0x22')](handleError(_0x286777,null));};exports[_0x6fdd('0xa4')]=function(_0x2f8e82,_0x5811a7,_0x2528da){var _0x27ecb5={'raw':![],'where':{}};var _0x354368={};var _0x26491c={'count':0x0,'rows':[]};return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x2f8e82[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x5811a7,null))['then'](function(_0x3eccf2){if(_0x3eccf2){_0x354368[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db[_0x6fdd('0x86')][_0x6fdd('0x4e')]);_0x354368['query']=_[_0x6fdd('0x39')](_0x2f8e82[_0x6fdd('0x38')]);_0x354368[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x354368[_0x6fdd('0x37')],_0x354368[_0x6fdd('0x38')]);_0x27ecb5[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x354368[_0x6fdd('0x37')],qs[_0x6fdd('0x3d')](_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x27ecb5[_0x6fdd('0x3c')]=_0x27ecb5[_0x6fdd('0x3c')]['length']?_0x27ecb5[_0x6fdd('0x3c')]:_0x354368[_0x6fdd('0x37')];if(!_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x3f')](_0x6fdd('0x40'))){_0x27ecb5['limit']=qs['limit'](_0x2f8e82[_0x6fdd('0x38')]['limit']);_0x27ecb5[_0x6fdd('0x26')]=qs[_0x6fdd('0x26')](_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x26')]);}_0x27ecb5[_0x6fdd('0x66')]=qs['sort'](_0x2f8e82[_0x6fdd('0x38')]['sort']);_0x27ecb5[_0x6fdd('0x44')]=qs[_0x6fdd('0x3a')](_[_0x6fdd('0x42')](_0x2f8e82[_0x6fdd('0x38')],_0x354368[_0x6fdd('0x3a')]));_0x27ecb5[_0x6fdd('0x44')][_0x6fdd('0x5e')]=_0x3eccf2['id'];if(_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x27ecb5['where']=_[_0x6fdd('0x45')](_0x27ecb5[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x27ecb5[_0x6fdd('0x3c')],function(_0x35abb5){var _0x57ee85={};_0x57ee85[_0x35abb5]={'$like':'%'+_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x43')]+'%'};return _0x57ee85;})});}_0x27ecb5=_[_0x6fdd('0x45')]({},_0x27ecb5,_0x2f8e82[_0x6fdd('0x47')]);return db[_0x6fdd('0x86')][_0x6fdd('0x48')]({'where':_0x27ecb5[_0x6fdd('0x44')]})[_0x6fdd('0x1a')](function(_0x5f2621){_0x26491c[_0x6fdd('0x48')]=_0x5f2621;if(_0x2f8e82[_0x6fdd('0x38')]['includeAll']){_0x27ecb5['include']=[{'model':db['CmContact'],'as':_0x6fdd('0xa5'),'required':![]},{'model':db['User'],'as':_0x6fdd('0xa6'),'attributes':[_0x6fdd('0x30'),'fullname',_0x6fdd('0xa7')],'required':![]},{'model':db[_0x6fdd('0xa8')],'as':_0x6fdd('0xa9'),'attributes':['id','name','color'],'where':_0x2f8e82[_0x6fdd('0x38')]['tag']?{'id':_0x2f8e82[_0x6fdd('0x38')]['tag']}:undefined,'required':_0x2f8e82[_0x6fdd('0x38')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x6fdd('0x4a')](_0x27ecb5);})[_0x6fdd('0x1a')](function(_0x13c4ee){_0x26491c[_0x6fdd('0x4b')]=_0x13c4ee;return _0x26491c;});}})[_0x6fdd('0x1a')](respondWithFilteredResult(_0x5811a7,_0x27ecb5))[_0x6fdd('0x22')](handleError(_0x5811a7,null));};exports['addAgents']=function(_0x548ec0,_0x386bdb,_0x22be52){return db['OpenchannelAccount'][_0x6fdd('0x50')]({'where':{'id':_0x548ec0['params']['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x386bdb,null))[_0x6fdd('0x1a')](function(_0xb672df){if(_0xb672df){return _0xb672df['addAgents'](_0x548ec0[_0x6fdd('0x52')][_0x6fdd('0x63')],_[_0x6fdd('0xaa')](_0x548ec0['body'],['ids','id'])||{})[_0x6fdd('0x88')](function(_0x48db25){for(var _0x3f1c29=0x0;_0x3f1c29<_0x548ec0[_0x6fdd('0x52')][_0x6fdd('0x63')][_0x6fdd('0x3e')];_0x3f1c29+=0x1){socket[_0x6fdd('0xab')](_0x6fdd('0xac'),{'UserId':Number(_0x548ec0[_0x6fdd('0x52')][_0x6fdd('0x63')][_0x3f1c29]),'OpenchannelAccountId':Number(_0x548ec0[_0x6fdd('0x4d')]['id'])});}return _0x48db25;});}})[_0x6fdd('0x1a')](respondWithResult(_0x386bdb,null))[_0x6fdd('0x22')](handleError(_0x386bdb,null));};exports[_0x6fdd('0xad')]=function(_0x4379d4,_0x535ec1,_0x213787){return db['OpenchannelAccount']['find']({'where':{'id':_0x4379d4[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x535ec1,null))[_0x6fdd('0x1a')](function(_0x450823){if(_0x450823){return _0x450823[_0x6fdd('0xad')](_0x4379d4[_0x6fdd('0x38')][_0x6fdd('0x63')])[_0x6fdd('0x1a')](function(){if(_[_0x6fdd('0xae')](_0x4379d4[_0x6fdd('0x38')][_0x6fdd('0x63')])){for(var _0x5e93fd=0x0;_0x5e93fd<_0x4379d4['query'][_0x6fdd('0x63')][_0x6fdd('0x3e')];_0x5e93fd+=0x1){socket[_0x6fdd('0xab')](_0x6fdd('0xaf'),{'UserId':Number(_0x4379d4[_0x6fdd('0x38')][_0x6fdd('0x63')][_0x5e93fd]),'OpenchannelAccountId':Number(_0x4379d4[_0x6fdd('0x4d')]['id'])});}}else{socket[_0x6fdd('0xab')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4379d4['query'][_0x6fdd('0x63')]),'OpenchannelAccountId':Number(_0x4379d4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x535ec1,null))['catch'](handleError(_0x535ec1,null));};exports[_0x6fdd('0xb0')]=function(_0x22edf1,_0xb94d4c,_0x45c3d4){var _0x42eb09={};var _0x280695={};var _0x10ff01;var _0x42b1c5;return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x22edf1[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0xb94d4c,null))[_0x6fdd('0x1a')](function(_0x3ad937){if(_0x3ad937){_0x10ff01=_0x3ad937;_0x280695[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db['User']['rawAttributes']);_0x280695[_0x6fdd('0x38')]=_[_0x6fdd('0x39')](_0x22edf1[_0x6fdd('0x38')]);_0x280695['filters']=_[_0x6fdd('0x3b')](_0x280695[_0x6fdd('0x37')],_0x280695[_0x6fdd('0x38')]);_0x42eb09['attributes']=_[_0x6fdd('0x3b')](_0x280695[_0x6fdd('0x37')],qs['fields'](_0x22edf1[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x42eb09[_0x6fdd('0x3c')]=_0x42eb09['attributes'][_0x6fdd('0x3e')]?_0x42eb09['attributes']:_0x280695['model'];_0x42eb09[_0x6fdd('0x66')]=qs['sort'](_0x22edf1[_0x6fdd('0x38')]['sort']);_0x42eb09[_0x6fdd('0x44')]=qs[_0x6fdd('0x3a')](_[_0x6fdd('0x42')](_0x22edf1['query'],_0x280695['filters']));if(_0x22edf1[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x42eb09[_0x6fdd('0x44')]=_[_0x6fdd('0x45')](_0x42eb09[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x42eb09[_0x6fdd('0x3c')],function(_0x5c20b0){var _0x5c9355={};_0x5c9355[_0x5c20b0]={'$like':'%'+_0x22edf1[_0x6fdd('0x38')]['filter']+'%'};return _0x5c9355;})});}_0x42eb09=_[_0x6fdd('0x45')]({},_0x42eb09,_0x22edf1['options']);return _0x10ff01[_0x6fdd('0xb0')](_0x42eb09);}})[_0x6fdd('0x1a')](function(_0x1ac296){if(_0x1ac296){_0x42b1c5=_0x1ac296[_0x6fdd('0x3e')];if(!_0x22edf1['query'][_0x6fdd('0x3f')](_0x6fdd('0x40'))){_0x42eb09[_0x6fdd('0x28')]=qs[_0x6fdd('0x28')](_0x22edf1[_0x6fdd('0x38')]['limit']);_0x42eb09[_0x6fdd('0x26')]=qs[_0x6fdd('0x26')](_0x22edf1[_0x6fdd('0x38')][_0x6fdd('0x26')]);}return _0x10ff01[_0x6fdd('0xb0')](_0x42eb09);}})[_0x6fdd('0x1a')](function(_0x151ee8){if(_0x151ee8){return _0x151ee8?{'count':_0x42b1c5,'rows':_0x151ee8}:null;}})[_0x6fdd('0x1a')](respondWithResult(_0xb94d4c,null))['catch'](handleError(_0xb94d4c,null));};exports['send']=function(_0x398543,_0x499569,_0x181615){var _0x264424,_0x1a24b8,_0x1002e2;if(_[_0x6fdd('0x71')](_0x398543['body']['body'])||_0x398543[_0x6fdd('0x52')][_0x6fdd('0x52')]===''){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))](_0x6fdd('0x73'));}if(_[_0x6fdd('0x71')](_0x398543[_0x6fdd('0x52')]['to'])){}_0x264424=_0x398543[_0x6fdd('0x52')]['to'];return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x398543[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x499569,null))[_0x6fdd('0x1a')](function(_0x485921){if(_0x485921){return db[_0x6fdd('0x34')]['find']({'where':{'id':_0x485921['id']},'include':[{'model':db[_0x6fdd('0xb1')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6fdd('0x78'),'where':{[_0x485921[_0x6fdd('0x74')]]:_0x264424},'limit':0x1,'order':[[_0x6fdd('0x6e'),_0x6fdd('0x79')]]}]}]})[_0x6fdd('0x1a')](handleEntityNotFound(_0x499569,null))[_0x6fdd('0x1a')](function(_0x2321a2){if(_0x2321a2&&_0x2321a2[_0x6fdd('0x77')]){_0x1a24b8=_0x2321a2[_0x6fdd('0x2d')]({'plain':!![]});if(_0x1a24b8[_0x6fdd('0x77')]&&_0x1a24b8[_0x6fdd('0x77')]['Contacts'][_0x6fdd('0x3e')]){return _0x1a24b8[_0x6fdd('0x77')]['Contacts'][0x0];}return db[_0x6fdd('0x69')][_0x6fdd('0x51')](_[_0x6fdd('0x80')](_0x398543[_0x6fdd('0x52')],{'firstName':_0x264424,[_0x2321a2['mapKey']]:_0x264424,'phone':_0x264424,'ListId':_0x1a24b8[_0x6fdd('0x70')]}));}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x499569,null))[_0x6fdd('0x1a')](function(_0x1d6266){if(_0x1d6266){_0x1002e2=_0x1d6266;return db[_0x6fdd('0x86')][_0x6fdd('0x50')]({'where':{'ContactId':_0x1002e2['id'],'closed':![],'OpenchannelAccountId':_0x1a24b8['id']}})[_0x6fdd('0x1a')](function(_0x622425){if(_0x622425){return[_0x622425,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x398543[_0x6fdd('0x53')]['id'],'ContactId':_0x1002e2['id'],'OpenchannelAccountId':_0x1a24b8['id'],'lastMsgDirection':_0x6fdd('0xb2'),'Messages':[_[_0x6fdd('0x45')](_0x398543[_0x6fdd('0x52')],{'read':![],'body':_0x398543['body'][_0x6fdd('0x52')],'OpenchannelAccountId':_0x1a24b8['id'],'UserId':_0x398543[_0x6fdd('0x53')]['id'],'ContactId':_0x1002e2['id']})]},{'include':[{'model':db[_0x6fdd('0x90')],'as':_0x6fdd('0xb3')}]})[_0x6fdd('0x1a')](function(_0x551934){return[_0x551934,!![]];});});}})[_0x6fdd('0x88')](function(_0x24bec8,_0x38ae34){if(_0x38ae34){return _0x24bec8;}return db['OpenchannelMessage']['create'](_[_0x6fdd('0x45')](_0x398543['body'],{'read':![],'body':_0x398543[_0x6fdd('0x52')][_0x6fdd('0x52')],'OpenchannelAccountId':_0x1a24b8['id'],'OpenchannelInteractionId':_0x24bec8['id'],'UserId':_0x398543['user']['id'],'ContactId':_0x1002e2['id']}))[_0x6fdd('0x1a')](function(_0x51a9a1){_0x24bec8[_0x6fdd('0xb4')]['Messages']=[];_0x24bec8[_0x6fdd('0xb4')][_0x6fdd('0xb3')][_0x6fdd('0x8d')](_0x51a9a1[_0x6fdd('0xb4')]);return _0x24bec8;});});}})[_0x6fdd('0x1a')](respondWithResult(_0x499569,null))[_0x6fdd('0x22')](handleError(_0x499569,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b14947a..9220742 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cc=['remove','emit','hook','exports','events','OpenchannelAccount','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x2eea1c,_0x555aae){_0x2eea1c=_0x2eea1c-0x0;var _0x55f270=_0x96cc[_0x2eea1c];return _0x55f270;};'use strict';var EventEmitter=require(_0xc96c('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xc96c('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc96c('0x2'),'afterUpdate':_0xc96c('0x3'),'afterDestroy':_0xc96c('0x4')};function emitEvent(_0x421701){return function(_0x71140d,_0x29b6f1,_0x377e6c){OpenchannelAccountEvents[_0xc96c('0x5')](_0x421701+':'+_0x71140d['id'],_0x71140d);OpenchannelAccountEvents[_0xc96c('0x5')](_0x421701,_0x71140d);_0x377e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc96c('0x6')](e,emitEvent(event));}}module[_0xc96c('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6f7a=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3fe4e2,_0x54a55f){_0x3fe4e2=_0x3fe4e2-0x0;var _0x132790=_0x6f7a[_0x3fe4e2];return _0x132790;};'use strict';var EventEmitter=require(_0xa6f7('0x0'));var OpenchannelAccount=require(_0xa6f7('0x1'))['db'][_0xa6f7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa6f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6f7('0x4'),'afterDestroy':_0xa6f7('0x5')};function emitEvent(_0x12ecb8){return function(_0x1da6dc,_0x22e529,_0x1f5922){OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8+':'+_0x1da6dc['id'],_0x1da6dc);OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8,_0x1da6dc);_0x1f5922(null);};}for(var e in events){if(events[_0xa6f7('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa6f7('0x8')](e,emitEvent(event));}}module[_0xa6f7('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index a9a590d..b18ad67 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(_0x5ce320,_0x3df023){var _0x5cad74=function(_0x31e754){while(--_0x31e754){_0x5ce320['push'](_0x5ce320['shift']());}};_0x5cad74(++_0x3df023);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x19ba0c,_0x3a9220){var _0x4730de=function(_0x4243de){while(--_0x4243de){_0x19ba0c['push'](_0x19ba0c['shift']());}};_0x4730de(++_0x3a9220);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 11b4485..5d98ca7 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x065e=['socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis'];(function(_0x328534,_0x33b41e){var _0x2796c0=function(_0x1ba8ad){while(--_0x1ba8ad){_0x328534['push'](_0x328534['shift']());}};_0x2796c0(++_0x33b41e);}(_0x065e,0x1a7));var _0xe065=function(_0x295245,_0x110169){_0x295245=_0x295245-0x0;var _0x3d166a=_0x065e[_0x295245];return _0x3d166a;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});config[_0xe065('0x8')]=_['defaults'](config[_0xe065('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe065('0x9'))(new Redis(config[_0xe065('0x8')]));require(_0xe065('0xa'))[_0xe065('0xb')](socket);function respondWithRpcPromise(_0x85001e,_0x531ebd,_0x43827c){return new BPromise(function(_0x6c9117,_0x3f59d3){return client[_0xe065('0xc')](_0x85001e,_0x43827c)[_0xe065('0xd')](function(_0x2a6a6e){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0xe065('0xe'));logger[_0xe065('0xf')](_0xe065('0x10'),_0x531ebd,'request\x20sent',JSON[_0xe065('0x11')](_0x2a6a6e));if(_0x2a6a6e[_0xe065('0x12')]){if(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x13')]===0x1f4){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);return _0x3f59d3(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}logger[_0xe065('0x12')](_0xe065('0x15'),_0x531ebd,_0x2a6a6e[_0xe065('0x12')]['message']);return _0x6c9117(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}else{logger['info'](_0xe065('0x15'),_0x531ebd,_0xe065('0xe'));_0x6c9117(_0x2a6a6e[_0xe065('0x16')][_0xe065('0x14')]);}})[_0xe065('0x17')](function(_0x302adf){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x302adf);_0x3f59d3(_0x302adf);});});} \ No newline at end of file +var _0x55f1=['socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost'];(function(_0x3274e1,_0x10a0dd){var _0x3f08b8=function(_0x36a729){while(--_0x36a729){_0x3274e1['push'](_0x3274e1['shift']());}};_0x3f08b8(++_0x10a0dd);}(_0x55f1,0x9b));var _0x155f=function(_0x35104e,_0x5db136){_0x35104e=_0x35104e-0x0;var _0x1857a4=_0x55f1[_0x35104e];return _0x1857a4;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var moment=require(_0x155f('0x1'));var BPromise=require(_0x155f('0x2'));var rs=require(_0x155f('0x3'));var fs=require('fs');var Redis=require(_0x155f('0x4'));var db=require(_0x155f('0x5'))['db'];var utils=require(_0x155f('0x6'));var logger=require(_0x155f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x155f('0x8'));var client=jayson['client'][_0x155f('0x9')]({'port':0x232a});config[_0x155f('0xa')]=_[_0x155f('0xb')](config[_0x155f('0xa')],{'host':_0x155f('0xc'),'port':0x18eb});var socket=require(_0x155f('0xd'))(new Redis(config[_0x155f('0xa')]));require(_0x155f('0xe'))[_0x155f('0xf')](socket);function respondWithRpcPromise(_0x281c5a,_0x11c946,_0x39d85a){return new BPromise(function(_0x5b9e3b,_0x9fb9a){return client[_0x155f('0x10')](_0x281c5a,_0x39d85a)[_0x155f('0x11')](function(_0x3575d8){logger['info'](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));logger[_0x155f('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11c946,'request\x20sent',JSON[_0x155f('0x15')](_0x3575d8));if(_0x3575d8[_0x155f('0x16')]){if(_0x3575d8[_0x155f('0x16')][_0x155f('0x17')]===0x1f4){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')]['message']);return _0x9fb9a(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}logger['error'](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);return _0x5b9e3b(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}else{logger[_0x155f('0x19')](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));_0x5b9e3b(_0x3575d8[_0x155f('0x1a')][_0x155f('0x18')]);}})[_0x155f('0x1b')](function(_0x3bdede){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3bdede);_0x9fb9a(_0x3bdede);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 375f98d..d6d4a0b 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 _0x175e=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x436e31,_0x1e3448){var _0x5028bc=function(_0x414857){while(--_0x414857){_0x436e31['push'](_0x436e31['shift']());}};_0x5028bc(++_0x1e3448);}(_0x175e,0xe6));var _0xe175=function(_0x10e1ee,_0x20d13a){_0x10e1ee=_0x10e1ee-0x0;var _0x570720=_0x175e[_0x10e1ee];return _0x570720;};'use strict';var OpenchannelAccountEvents=require(_0xe175('0x0'));var events=[_0xe175('0x1'),_0xe175('0x2'),_0xe175('0x3')];function createListener(_0x449d97,_0x5bec43){return function(_0x4d2bfc){_0x5bec43[_0xe175('0x4')](_0x449d97,_0x4d2bfc);};}function removeListener(_0x3c493c,_0x3fd951){return function(){OpenchannelAccountEvents[_0xe175('0x5')](_0x3c493c,_0x3fd951);};}exports[_0xe175('0x6')]=function(_0x278a8d){for(var _0x7eba=0x0,_0xbe8cd=events[_0xe175('0x7')];_0x7eba<_0xbe8cd;_0x7eba++){var _0x2e1356=events[_0x7eba];var _0x345531=createListener(_0xe175('0x8')+_0x2e1356,_0x278a8d);OpenchannelAccountEvents['on'](_0x2e1356,_0x345531);}}; \ No newline at end of file +var _0x1fdc=['save','update','emit','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x3daab0,_0x5d8b14){var _0x53eca4=function(_0x1cb0c8){while(--_0x1cb0c8){_0x3daab0['push'](_0x3daab0['shift']());}};_0x53eca4(++_0x5d8b14);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x1fdc[_0x77773a];return _0x1091a2;};'use strict';var OpenchannelAccountEvents=require(_0xc1fd('0x0'));var events=[_0xc1fd('0x1'),'remove',_0xc1fd('0x2')];function createListener(_0x30eaf5,_0x1849f5){return function(_0x256e28){_0x1849f5[_0xc1fd('0x3')](_0x30eaf5,_0x256e28);};}function removeListener(_0x7fe059,_0x259024){return function(){OpenchannelAccountEvents['removeListener'](_0x7fe059,_0x259024);};}exports[_0xc1fd('0x4')]=function(_0x141dab){for(var _0x43cd02=0x0,_0xf6faef=events[_0xc1fd('0x5')];_0x43cd02<_0xf6faef;_0x43cd02++){var _0x3eebe6=events[_0x43cd02];var _0x43b858=createListener(_0xc1fd('0x6')+_0x3eebe6,_0x141dab);OpenchannelAccountEvents['on'](_0x3eebe6,_0x43b858);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 352391a..b43ae1f 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 _0x9c75=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x3660b6,_0x16abe4){var _0x343fb2=function(_0x17e793){while(--_0x17e793){_0x3660b6['push'](_0x3660b6['shift']());}};_0x343fb2(++_0x16abe4);}(_0x9c75,0x173));var _0x59c7=function(_0x230443,_0x2d27dc){_0x230443=_0x230443-0x0;var _0x245f39=_0x9c75[_0x230443];return _0x245f39;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x59c7('0x0'));var timeout=require(_0x59c7('0x1'));var express=require(_0x59c7('0x2'));var router=express[_0x59c7('0x3')]();var fs_extra=require(_0x59c7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x59c7('0x5'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x59c7('0x6')]('/',auth['isAuthenticated'](),controller[_0x59c7('0x7')]);router['get'](_0x59c7('0x8'),auth[_0x59c7('0x9')](),controller[_0x59c7('0xa')]);router[_0x59c7('0xb')]('/',auth[_0x59c7('0x9')](),controller['create']);router[_0x59c7('0xc')](_0x59c7('0x8'),auth[_0x59c7('0x9')](),controller['update']);router[_0x59c7('0xd')](_0x59c7('0x8'),auth[_0x59c7('0x9')](),controller[_0x59c7('0xe')]);module[_0x59c7('0xf')]=router; \ No newline at end of file +var _0x819f=['get','isAuthenticated','index','create','put','/:id','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller'];(function(_0x76c7f8,_0x498e10){var _0x56c0b2=function(_0x6dd83b){while(--_0x6dd83b){_0x76c7f8['push'](_0x76c7f8['shift']());}};_0x56c0b2(++_0x498e10);}(_0x819f,0x1c9));var _0xf819=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x819f[_0x5eca50];return _0x41fb84;};'use strict';var multer=require('multer');var util=require(_0xf819('0x0'));var path=require('path');var timeout=require(_0xf819('0x1'));var express=require('express');var router=express[_0xf819('0x2')]();var fs_extra=require(_0xf819('0x3'));var auth=require(_0xf819('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf819('0x5'));var controller=require(_0xf819('0x6'));router[_0xf819('0x7')]('/',auth[_0xf819('0x8')](),controller[_0xf819('0x9')]);router[_0xf819('0x7')]('/:id',auth[_0xf819('0x8')](),controller['show']);router['post']('/',auth[_0xf819('0x8')](),controller[_0xf819('0xa')]);router[_0xf819('0xb')](_0xf819('0xc'),auth['isAuthenticated'](),controller[_0xf819('0xd')]);router['delete']('/:id',auth[_0xf819('0x8')](),controller[_0xf819('0xe')]);module[_0xf819('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index c271beb..97d9c52 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 _0x566b=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3ddb3f,_0x443638){var _0x27f3e2=function(_0x5ec922){while(--_0x5ec922){_0x3ddb3f['push'](_0x3ddb3f['shift']());}};_0x27f3e2(++_0x443638);}(_0x566b,0x72));var _0xb566=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x566b[_0x5a6644];return _0x3a2a5d;};'use strict';var Sequelize=require(_0xb566('0x0'));module[_0xb566('0x1')]={'priority':{'type':Sequelize[_0xb566('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb566('0x3')],'allowNull':![],'defaultValue':_0xb566('0x4')},'appdata':{'type':Sequelize[_0xb566('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb566('0x3')],'defaultValue':_0xb566('0x6')}}; \ No newline at end of file +var _0xa121=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xa121,0x1c6));var _0x1a12=function(_0x313811,_0x2842f5){_0x313811=_0x313811-0x0;var _0x1d6702=_0xa121[_0x313811];return _0x1d6702;};'use strict';var Sequelize=require(_0x1a12('0x0'));module[_0x1a12('0x1')]={'priority':{'type':Sequelize[_0x1a12('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a12('0x3')},'appdata':{'type':Sequelize[_0x1a12('0x4')]()},'description':{'type':Sequelize[_0x1a12('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 71488cb..64b7ebe 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 _0x25c6=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','eml-format'];(function(_0x357110,_0x4c7262){var _0x554cc4=function(_0xc27a91){while(--_0xc27a91){_0x357110['push'](_0x357110['shift']());}};_0x554cc4(++_0x4c7262);}(_0x25c6,0x1a9));var _0x625c=function(_0x464ec5,_0x708e0a){_0x464ec5=_0x464ec5-0x0;var _0x30a88b=_0x25c6[_0x464ec5];return _0x30a88b;};'use strict';var emlformat=require(_0x625c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x625c('0x1'));var jsonpatch=require(_0x625c('0x2'));var rp=require(_0x625c('0x3'));var moment=require('moment');var BPromise=require(_0x625c('0x4'));var Mustache=require(_0x625c('0x5'));var util=require(_0x625c('0x6'));var path=require(_0x625c('0x7'));var sox=require('sox');var csv=require(_0x625c('0x8'));var ejs=require(_0x625c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x625c('0xa'));var jsforce=require(_0x625c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x625c('0xc'));var Papa=require(_0x625c('0xd'));var Redis=require(_0x625c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x625c('0xf'));var hardwareService=require(_0x625c('0x10'));var logger=require('../../config/logger')(_0x625c('0x11'));var utils=require(_0x625c('0x12'));var config=require(_0x625c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x625c('0x14'))['db'];function respondWithStatusCode(_0x422279,_0x2f8367){_0x2f8367=_0x2f8367||0xcc;return function(_0x5d6368){if(_0x5d6368){return _0x422279['sendStatus'](_0x2f8367);}return _0x422279['status'](_0x2f8367)[_0x625c('0x15')]();};}function respondWithResult(_0x4d44de,_0x5a9a90){_0x5a9a90=_0x5a9a90||0xc8;return function(_0x485d8b){if(_0x485d8b){return _0x4d44de[_0x625c('0x16')](_0x5a9a90)[_0x625c('0x17')](_0x485d8b);}};}function respondWithFilteredResult(_0x107172,_0x2d5352){return function(_0x4305bb){if(_0x4305bb){var _0x3ffe0=typeof _0x2d5352[_0x625c('0x18')]===_0x625c('0x19')&&typeof _0x2d5352['limit']===_0x625c('0x19');var _0x139a9b=_0x4305bb[_0x625c('0x1a')];var _0x382ef5=_0x3ffe0?0x0:_0x2d5352[_0x625c('0x18')];var _0x4e7288=_0x3ffe0?_0x4305bb['count']:_0x2d5352[_0x625c('0x18')]+_0x2d5352[_0x625c('0x1b')];var _0x1337a1;if(_0x4e7288>=_0x139a9b){_0x4e7288=_0x139a9b;_0x1337a1=0xc8;}else{_0x1337a1=0xce;}_0x107172['status'](_0x1337a1);return _0x107172[_0x625c('0x1c')](_0x625c('0x1d'),_0x382ef5+'-'+_0x4e7288+'/'+_0x139a9b)[_0x625c('0x17')](_0x4305bb);}return null;};}function patchUpdates(_0x32e332){return function(_0x197af6){try{jsonpatch[_0x625c('0x1e')](_0x197af6,_0x32e332,!![]);}catch(_0x55fcd5){return BPromise[_0x625c('0x1f')](_0x55fcd5);}return _0x197af6['save']();};}function saveUpdates(_0x3faa13,_0x274113){return function(_0x160836){if(_0x160836){return _0x160836[_0x625c('0x20')](_0x3faa13)[_0x625c('0x21')](function(_0x10075a){return _0x10075a;});}return null;};}function removeEntity(_0x3ca4af,_0xbb6e0d){return function(_0x1d503f){if(_0x1d503f){return _0x1d503f[_0x625c('0x22')]()[_0x625c('0x21')](function(){_0x3ca4af[_0x625c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e2900,_0x5dde0f){return function(_0x520e28){if(!_0x520e28){_0x3e2900[_0x625c('0x23')](0x194);}return _0x520e28;};}function handleError(_0x30d7d9,_0x17694c){_0x17694c=_0x17694c||0x1f4;return function(_0x2e1900){logger[_0x625c('0x24')](_0x2e1900[_0x625c('0x25')]);if(_0x2e1900[_0x625c('0x26')]){delete _0x2e1900[_0x625c('0x26')];}_0x30d7d9[_0x625c('0x16')](_0x17694c)[_0x625c('0x27')](_0x2e1900);};}exports[_0x625c('0x28')]=function(_0x4a8f85,_0x4997af){var _0x1d9e02={},_0x124f94={},_0x350e02={'count':0x0,'rows':[]};var _0x91a20a=_[_0x625c('0x29')](db[_0x625c('0x2a')]['rawAttributes'],function(_0xb68ce1){return{'name':_0xb68ce1[_0x625c('0x2b')],'type':_0xb68ce1[_0x625c('0x2c')]['key']};});_0x124f94[_0x625c('0x2d')]=_[_0x625c('0x29')](_0x91a20a,'name');_0x124f94['query']=_[_0x625c('0x2e')](_0x4a8f85[_0x625c('0x2f')]);_0x124f94[_0x625c('0x30')]=_[_0x625c('0x31')](_0x124f94[_0x625c('0x2d')],_0x124f94[_0x625c('0x2f')]);_0x1d9e02[_0x625c('0x32')]=_[_0x625c('0x31')](_0x124f94[_0x625c('0x2d')],qs[_0x625c('0x33')](_0x4a8f85['query'][_0x625c('0x33')]));_0x1d9e02[_0x625c('0x32')]=_0x1d9e02[_0x625c('0x32')][_0x625c('0x34')]?_0x1d9e02[_0x625c('0x32')]:_0x124f94[_0x625c('0x2d')];if(!_0x4a8f85[_0x625c('0x2f')][_0x625c('0x35')](_0x625c('0x36'))){_0x1d9e02['limit']=qs[_0x625c('0x1b')](_0x4a8f85[_0x625c('0x2f')][_0x625c('0x1b')]);_0x1d9e02[_0x625c('0x18')]=qs[_0x625c('0x18')](_0x4a8f85[_0x625c('0x2f')][_0x625c('0x18')]);}_0x1d9e02[_0x625c('0x37')]=qs[_0x625c('0x38')](_0x4a8f85[_0x625c('0x2f')][_0x625c('0x38')]);_0x1d9e02[_0x625c('0x39')]=qs[_0x625c('0x30')](_[_0x625c('0x3a')](_0x4a8f85[_0x625c('0x2f')],_0x124f94[_0x625c('0x30')]),_0x91a20a);if(_0x4a8f85[_0x625c('0x2f')][_0x625c('0x3b')]){_0x1d9e02[_0x625c('0x39')]=_[_0x625c('0x3c')](_0x1d9e02['where'],{'$or':_[_0x625c('0x29')](_0x91a20a,function(_0x19dee6){if(_0x19dee6[_0x625c('0x2c')]!=='VIRTUAL'){var _0x24ea9c={};_0x24ea9c[_0x19dee6['name']]={'$like':'%'+_0x4a8f85[_0x625c('0x2f')][_0x625c('0x3b')]+'%'};return _0x24ea9c;}})});}_0x1d9e02=_[_0x625c('0x3c')]({},_0x1d9e02,_0x4a8f85[_0x625c('0x3d')]);var _0x42c23a={'where':_0x1d9e02[_0x625c('0x39')]};return db[_0x625c('0x2a')]['count'](_0x42c23a)[_0x625c('0x21')](function(_0x1d63ac){_0x350e02[_0x625c('0x1a')]=_0x1d63ac;if(_0x4a8f85[_0x625c('0x2f')][_0x625c('0x3e')]){_0x1d9e02['include']=[{'all':!![]}];}return db[_0x625c('0x2a')][_0x625c('0x3f')](_0x1d9e02);})['then'](function(_0x5db0a8){_0x350e02['rows']=_0x5db0a8;return _0x350e02;})['then'](respondWithFilteredResult(_0x4997af,_0x1d9e02))[_0x625c('0x40')](handleError(_0x4997af,null));};exports[_0x625c('0x41')]=function(_0x565559,_0x27d57d){var _0x144257={'raw':!![],'where':{'id':_0x565559[_0x625c('0x42')]['id']}},_0x32a596={};_0x32a596[_0x625c('0x2d')]=_[_0x625c('0x2e')](db[_0x625c('0x2a')]['rawAttributes']);_0x32a596[_0x625c('0x2f')]=_[_0x625c('0x2e')](_0x565559[_0x625c('0x2f')]);_0x32a596['filters']=_[_0x625c('0x31')](_0x32a596[_0x625c('0x2d')],_0x32a596[_0x625c('0x2f')]);_0x144257['attributes']=_['intersection'](_0x32a596[_0x625c('0x2d')],qs[_0x625c('0x33')](_0x565559[_0x625c('0x2f')][_0x625c('0x33')]));_0x144257[_0x625c('0x32')]=_0x144257['attributes'][_0x625c('0x34')]?_0x144257[_0x625c('0x32')]:_0x32a596[_0x625c('0x2d')];if(_0x565559['query'][_0x625c('0x3e')]){_0x144257[_0x625c('0x43')]=[{'all':!![]}];}_0x144257=_[_0x625c('0x3c')]({},_0x144257,_0x565559['options']);return db[_0x625c('0x2a')][_0x625c('0x44')](_0x144257)['then'](handleEntityNotFound(_0x27d57d,null))[_0x625c('0x21')](respondWithResult(_0x27d57d,null))[_0x625c('0x40')](handleError(_0x27d57d,null));};exports[_0x625c('0x45')]=function(_0x4ef657,_0x47612b){return db[_0x625c('0x2a')][_0x625c('0x45')](_0x4ef657[_0x625c('0x46')],{})['then'](respondWithResult(_0x47612b,0xc9))[_0x625c('0x40')](handleError(_0x47612b,null));};exports['update']=function(_0x18534c,_0x3ee5e8){if(_0x18534c['body']['id']){delete _0x18534c[_0x625c('0x46')]['id'];}return db[_0x625c('0x2a')]['find']({'where':{'id':_0x18534c[_0x625c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3ee5e8,null))[_0x625c('0x21')](saveUpdates(_0x18534c['body'],null))[_0x625c('0x21')](respondWithResult(_0x3ee5e8,null))['catch'](handleError(_0x3ee5e8,null));};exports[_0x625c('0x22')]=function(_0x10b43d,_0x1bd829){return db[_0x625c('0x2a')][_0x625c('0x44')]({'where':{'id':_0x10b43d[_0x625c('0x42')]['id']}})[_0x625c('0x21')](handleEntityNotFound(_0x1bd829,null))['then'](removeEntity(_0x1bd829,null))[_0x625c('0x40')](handleError(_0x1bd829,null));}; \ No newline at end of file +var _0x6668=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','show','params','includeAll','include','create','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','then','destroy','sendStatus','stack','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x6668,0x1cf));var _0x8666=function(_0x123d3d,_0x114ea5){_0x123d3d=_0x123d3d-0x0;var _0x5707bf=_0x6668[_0x123d3d];return _0x5707bf;};'use strict';var emlformat=require(_0x8666('0x0'));var rimraf=require(_0x8666('0x1'));var zipdir=require(_0x8666('0x2'));var jsonpatch=require(_0x8666('0x3'));var rp=require(_0x8666('0x4'));var moment=require(_0x8666('0x5'));var BPromise=require(_0x8666('0x6'));var Mustache=require(_0x8666('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8666('0x8'));var csv=require(_0x8666('0x9'));var ejs=require(_0x8666('0xa'));var fs=require('fs');var fs_extra=require(_0x8666('0xb'));var _=require('lodash');var squel=require(_0x8666('0xc'));var crypto=require(_0x8666('0xd'));var jsforce=require(_0x8666('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8666('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8666('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8666('0x11'));var hardwareService=require(_0x8666('0x12'));var logger=require(_0x8666('0x13'))('api');var utils=require(_0x8666('0x14'));var config=require(_0x8666('0x15'));var licenseUtil=require(_0x8666('0x16'));var db=require(_0x8666('0x17'))['db'];function respondWithStatusCode(_0x1b0e7c,_0x361aa6){_0x361aa6=_0x361aa6||0xcc;return function(_0xbd87d){if(_0xbd87d){return _0x1b0e7c['sendStatus'](_0x361aa6);}return _0x1b0e7c['status'](_0x361aa6)[_0x8666('0x18')]();};}function respondWithResult(_0x1a2b75,_0x296e56){_0x296e56=_0x296e56||0xc8;return function(_0x33ab28){if(_0x33ab28){return _0x1a2b75['status'](_0x296e56)['json'](_0x33ab28);}};}function respondWithFilteredResult(_0x155ed9,_0x3c3de6){return function(_0x4f0fb4){if(_0x4f0fb4){var _0x519123=typeof _0x3c3de6[_0x8666('0x19')]===_0x8666('0x1a')&&typeof _0x3c3de6[_0x8666('0x1b')]==='undefined';var _0x533168=_0x4f0fb4['count'];var _0x159a55=_0x519123?0x0:_0x3c3de6[_0x8666('0x19')];var _0x3b4156=_0x519123?_0x4f0fb4[_0x8666('0x1c')]:_0x3c3de6['offset']+_0x3c3de6[_0x8666('0x1b')];var _0x2ef9ba;if(_0x3b4156>=_0x533168){_0x3b4156=_0x533168;_0x2ef9ba=0xc8;}else{_0x2ef9ba=0xce;}_0x155ed9[_0x8666('0x1d')](_0x2ef9ba);return _0x155ed9['set'](_0x8666('0x1e'),_0x159a55+'-'+_0x3b4156+'/'+_0x533168)[_0x8666('0x1f')](_0x4f0fb4);}return null;};}function patchUpdates(_0x79ba7){return function(_0x1c970c){try{jsonpatch[_0x8666('0x20')](_0x1c970c,_0x79ba7,!![]);}catch(_0xc503e7){return BPromise[_0x8666('0x21')](_0xc503e7);}return _0x1c970c['save']();};}function saveUpdates(_0x40f392,_0x24fef8){return function(_0x3bbcf5){if(_0x3bbcf5){return _0x3bbcf5['update'](_0x40f392)[_0x8666('0x22')](function(_0xa4819d){return _0xa4819d;});}return null;};}function removeEntity(_0x1138ef,_0x13c304){return function(_0x58da34){if(_0x58da34){return _0x58da34[_0x8666('0x23')]()[_0x8666('0x22')](function(){_0x1138ef[_0x8666('0x1d')](0xcc)[_0x8666('0x18')]();});}};}function handleEntityNotFound(_0x145090,_0x5bbd34){return function(_0x2ba5ea){if(!_0x2ba5ea){_0x145090[_0x8666('0x24')](0x194);}return _0x2ba5ea;};}function handleError(_0x8eb26f,_0x1c6f76){_0x1c6f76=_0x1c6f76||0x1f4;return function(_0x2ddbd7){logger['error'](_0x2ddbd7[_0x8666('0x25')]);if(_0x2ddbd7['name']){delete _0x2ddbd7['name'];}_0x8eb26f[_0x8666('0x1d')](_0x1c6f76)['send'](_0x2ddbd7);};}exports[_0x8666('0x26')]=function(_0xb64e10,_0x3832f7){var _0x44ed12={},_0x3f40d8={},_0x463c1b={'count':0x0,'rows':[]};var _0x44d1eb=_['map'](db[_0x8666('0x27')][_0x8666('0x28')],function(_0x380aa7){return{'name':_0x380aa7[_0x8666('0x29')],'type':_0x380aa7[_0x8666('0x2a')][_0x8666('0x2b')]};});_0x3f40d8[_0x8666('0x2c')]=_[_0x8666('0x2d')](_0x44d1eb,_0x8666('0x2e'));_0x3f40d8['query']=_[_0x8666('0x2f')](_0xb64e10[_0x8666('0x30')]);_0x3f40d8['filters']=_['intersection'](_0x3f40d8[_0x8666('0x2c')],_0x3f40d8['query']);_0x44ed12[_0x8666('0x31')]=_[_0x8666('0x32')](_0x3f40d8['model'],qs[_0x8666('0x33')](_0xb64e10[_0x8666('0x30')]['fields']));_0x44ed12[_0x8666('0x31')]=_0x44ed12[_0x8666('0x31')][_0x8666('0x34')]?_0x44ed12[_0x8666('0x31')]:_0x3f40d8[_0x8666('0x2c')];if(!_0xb64e10['query'][_0x8666('0x35')](_0x8666('0x36'))){_0x44ed12[_0x8666('0x1b')]=qs[_0x8666('0x1b')](_0xb64e10[_0x8666('0x30')][_0x8666('0x1b')]);_0x44ed12[_0x8666('0x19')]=qs[_0x8666('0x19')](_0xb64e10[_0x8666('0x30')][_0x8666('0x19')]);}_0x44ed12[_0x8666('0x37')]=qs[_0x8666('0x38')](_0xb64e10[_0x8666('0x30')]['sort']);_0x44ed12[_0x8666('0x39')]=qs[_0x8666('0x3a')](_[_0x8666('0x3b')](_0xb64e10['query'],_0x3f40d8[_0x8666('0x3a')]),_0x44d1eb);if(_0xb64e10[_0x8666('0x30')][_0x8666('0x3c')]){_0x44ed12[_0x8666('0x39')]=_[_0x8666('0x3d')](_0x44ed12[_0x8666('0x39')],{'$or':_['map'](_0x44d1eb,function(_0x6b3127){if(_0x6b3127[_0x8666('0x2a')]!==_0x8666('0x3e')){var _0x595ff8={};_0x595ff8[_0x6b3127[_0x8666('0x2e')]]={'$like':'%'+_0xb64e10[_0x8666('0x30')][_0x8666('0x3c')]+'%'};return _0x595ff8;}})});}_0x44ed12=_['merge']({},_0x44ed12,_0xb64e10[_0x8666('0x3f')]);var _0x4d24e4={'where':_0x44ed12[_0x8666('0x39')]};return db['OpenchannelApplication'][_0x8666('0x1c')](_0x4d24e4)[_0x8666('0x22')](function(_0x2ace5d){_0x463c1b[_0x8666('0x1c')]=_0x2ace5d;if(_0xb64e10[_0x8666('0x30')]['includeAll']){_0x44ed12['include']=[{'all':!![]}];}return db[_0x8666('0x27')][_0x8666('0x40')](_0x44ed12);})['then'](function(_0x24e7f2){_0x463c1b['rows']=_0x24e7f2;return _0x463c1b;})[_0x8666('0x22')](respondWithFilteredResult(_0x3832f7,_0x44ed12))['catch'](handleError(_0x3832f7,null));};exports[_0x8666('0x41')]=function(_0x163684,_0x33ab76){var _0x33d83c={'raw':!![],'where':{'id':_0x163684[_0x8666('0x42')]['id']}},_0x5ad1ee={};_0x5ad1ee[_0x8666('0x2c')]=_['keys'](db[_0x8666('0x27')]['rawAttributes']);_0x5ad1ee[_0x8666('0x30')]=_['keys'](_0x163684[_0x8666('0x30')]);_0x5ad1ee[_0x8666('0x3a')]=_[_0x8666('0x32')](_0x5ad1ee[_0x8666('0x2c')],_0x5ad1ee['query']);_0x33d83c[_0x8666('0x31')]=_[_0x8666('0x32')](_0x5ad1ee[_0x8666('0x2c')],qs[_0x8666('0x33')](_0x163684['query'][_0x8666('0x33')]));_0x33d83c[_0x8666('0x31')]=_0x33d83c[_0x8666('0x31')][_0x8666('0x34')]?_0x33d83c[_0x8666('0x31')]:_0x5ad1ee[_0x8666('0x2c')];if(_0x163684[_0x8666('0x30')][_0x8666('0x43')]){_0x33d83c[_0x8666('0x44')]=[{'all':!![]}];}_0x33d83c=_[_0x8666('0x3d')]({},_0x33d83c,_0x163684[_0x8666('0x3f')]);return db['OpenchannelApplication']['find'](_0x33d83c)[_0x8666('0x22')](handleEntityNotFound(_0x33ab76,null))[_0x8666('0x22')](respondWithResult(_0x33ab76,null))['catch'](handleError(_0x33ab76,null));};exports['create']=function(_0x4dff09,_0x4e6a71){return db[_0x8666('0x27')][_0x8666('0x45')](_0x4dff09['body'],{})[_0x8666('0x22')](respondWithResult(_0x4e6a71,0xc9))[_0x8666('0x46')](handleError(_0x4e6a71,null));};exports[_0x8666('0x47')]=function(_0x286b13,_0x1dc0c0){if(_0x286b13[_0x8666('0x48')]['id']){delete _0x286b13[_0x8666('0x48')]['id'];}return db[_0x8666('0x27')]['find']({'where':{'id':_0x286b13[_0x8666('0x42')]['id']}})[_0x8666('0x22')](handleEntityNotFound(_0x1dc0c0,null))[_0x8666('0x22')](saveUpdates(_0x286b13['body'],null))[_0x8666('0x22')](respondWithResult(_0x1dc0c0,null))['catch'](handleError(_0x1dc0c0,null));};exports[_0x8666('0x23')]=function(_0x517881,_0x2f0fa8){return db[_0x8666('0x27')][_0x8666('0x49')]({'where':{'id':_0x517881[_0x8666('0x42')]['id']}})[_0x8666('0x22')](handleEntityNotFound(_0x2f0fa8,null))[_0x8666('0x22')](removeEntity(_0x2f0fa8,null))['catch'](handleError(_0x2f0fa8,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b45e30c..8f49eb1 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 _0x5555=['rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','util','api','request-promise','path'];(function(_0x443242,_0x4d9878){var _0x2c7479=function(_0xa1a7b6){while(--_0xa1a7b6){_0x443242['push'](_0x443242['shift']());}};_0x2c7479(++_0x4d9878);}(_0x5555,0x6a));var _0x5555=function(_0x420e6d,_0x3d83db){_0x420e6d=_0x420e6d-0x0;var _0x591cc3=_0x5555[_0x420e6d];return _0x591cc3;};'use strict';var _=require('lodash');var util=require(_0x5555('0x0'));var logger=require('../../config/logger')(_0x5555('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5555('0x2'));var fs=require('fs');var path=require(_0x5555('0x3'));var rimraf=require(_0x5555('0x4'));var config=require(_0x5555('0x5'));var attributes=require('./openchannelApplication.attributes');module[_0x5555('0x6')]=function(_0x20153b,_0x51a7e1){return _0x20153b[_0x5555('0x7')](_0x5555('0x8'),attributes,{'tableName':_0x5555('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5555('0xa')});}; \ No newline at end of file +var _0xe9cb=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','request-promise','path','../../config/environment','OpenchannelApplication'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xe9cb,0xc0));var _0xbe9c=function(_0x459c09,_0x596ed4){_0x459c09=_0x459c09-0x0;var _0x2aee20=_0xe9cb[_0x459c09];return _0x2aee20;};'use strict';var _=require('lodash');var util=require(_0xbe9c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbe9c('0x1'));var BPromise=require('bluebird');var rp=require(_0xbe9c('0x2'));var fs=require('fs');var path=require(_0xbe9c('0x3'));var rimraf=require('rimraf');var config=require(_0xbe9c('0x4'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x19a3d5,_0x2f050d){return _0x19a3d5['define'](_0xbe9c('0x5'),attributes,{'tableName':_0xbe9c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe9c('0x7'),'collate':_0xbe9c('0x8')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d5ced4a..f382a1f 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 _0xa835=['../../config/environment','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','attributes','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1a170a,_0xcc9fca){var _0x413c33=function(_0xbb6447){while(--_0xbb6447){_0x1a170a['push'](_0x1a170a['shift']());}};_0x413c33(++_0xcc9fca);}(_0xa835,0xc2));var _0x5a83=function(_0x4d216f,_0x4c4a62){_0x4d216f=_0x4d216f-0x0;var _0x22827d=_0xa835[_0x4d216f];return _0x22827d;};'use strict';var _=require(_0x5a83('0x0'));var util=require('util');var moment=require(_0x5a83('0x1'));var BPromise=require(_0x5a83('0x2'));var rs=require(_0x5a83('0x3'));var fs=require('fs');var Redis=require(_0x5a83('0x4'));var db=require(_0x5a83('0x5'))['db'];var utils=require(_0x5a83('0x6'));var logger=require(_0x5a83('0x7'))(_0x5a83('0x8'));var config=require(_0x5a83('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5a83('0xa')][_0x5a83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24fb5d,_0xb124e5,_0x191a93){return new BPromise(function(_0x1f48b3,_0x2c5637){return client['request'](_0x24fb5d,_0x191a93)[_0x5a83('0xc')](function(_0x182e67){logger[_0x5a83('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0xb124e5,'request\x20sent');logger['debug'](_0x5a83('0xe'),_0xb124e5,_0x5a83('0xf'),JSON[_0x5a83('0x10')](_0x182e67));if(_0x182e67[_0x5a83('0x11')]){if(_0x182e67[_0x5a83('0x11')]['code']===0x1f4){logger[_0x5a83('0x11')](_0x5a83('0x12'),_0xb124e5,_0x182e67[_0x5a83('0x11')][_0x5a83('0x13')]);return _0x2c5637(_0x182e67[_0x5a83('0x11')][_0x5a83('0x13')]);}logger[_0x5a83('0x11')](_0x5a83('0x12'),_0xb124e5,_0x182e67['error'][_0x5a83('0x13')]);return _0x1f48b3(_0x182e67[_0x5a83('0x11')][_0x5a83('0x13')]);}else{logger[_0x5a83('0xd')](_0x5a83('0x12'),_0xb124e5,_0x5a83('0xf'));_0x1f48b3(_0x182e67[_0x5a83('0x14')][_0x5a83('0x13')]);}})[_0x5a83('0x15')](function(_0x22e3e7){logger[_0x5a83('0x11')](_0x5a83('0x12'),_0xb124e5,_0x22e3e7);_0x2c5637(_0x22e3e7);});});}exports[_0x5a83('0x16')]=function(_0x356b9d){var _0x7f0738=this;return new Promise(function(_0x3f8da3,_0x31c431){return db[_0x5a83('0x17')][_0x5a83('0x18')](_0x356b9d['body'],{'raw':_0x356b9d['options']?_0x356b9d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x356b9d[_0x5a83('0x19')]?_0x356b9d[_0x5a83('0x19')]['where']||null:null,'attributes':_0x356b9d[_0x5a83('0x19')]?_0x356b9d[_0x5a83('0x19')][_0x5a83('0x1a')]||null:null,'limit':_0x356b9d[_0x5a83('0x19')]?_0x356b9d[_0x5a83('0x19')][_0x5a83('0x1b')]||null:null})[_0x5a83('0xc')](function(_0x462815){logger['info'](_0x5a83('0x16'),_0x356b9d);logger[_0x5a83('0x1c')]('UpdateOpenchannelApplication',_0x356b9d,JSON[_0x5a83('0x10')](_0x462815));_0x3f8da3(_0x462815);})['catch'](function(_0xb733d0){logger['error'](_0x5a83('0x16'),_0xb733d0[_0x5a83('0x13')],_0x356b9d);_0x31c431(_0x7f0738['error'](0x1f4,_0xb733d0[_0x5a83('0x13')]));});});}; \ No newline at end of file +var _0x0bdf=['message','info','result','catch','OpenchannelApplication','update','options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x25a63d,_0x21599a){var _0x3230ef=function(_0x1944f8){while(--_0x1944f8){_0x25a63d['push'](_0x25a63d['shift']());}};_0x3230ef(++_0x21599a);}(_0x0bdf,0x1ab));var _0xf0bd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0bdf[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xf0bd('0x0'));var util=require(_0xf0bd('0x1'));var moment=require(_0xf0bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0bd('0x3'));var fs=require('fs');var Redis=require(_0xf0bd('0x4'));var db=require(_0xf0bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0bd('0x6'))(_0xf0bd('0x7'));var config=require(_0xf0bd('0x8'));var jayson=require(_0xf0bd('0x9'));var client=jayson[_0xf0bd('0xa')][_0xf0bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c4e0f,_0x452867,_0x2ec439){return new BPromise(function(_0x881746,_0x80054f){return client[_0xf0bd('0xc')](_0x5c4e0f,_0x2ec439)[_0xf0bd('0xd')](function(_0x5e4773){logger['info'](_0xf0bd('0xe'),_0x452867,_0xf0bd('0xf'));logger[_0xf0bd('0x10')](_0xf0bd('0x11'),_0x452867,'request\x20sent',JSON[_0xf0bd('0x12')](_0x5e4773));if(_0x5e4773[_0xf0bd('0x13')]){if(_0x5e4773[_0xf0bd('0x13')][_0xf0bd('0x14')]===0x1f4){logger[_0xf0bd('0x13')](_0xf0bd('0xe'),_0x452867,_0x5e4773[_0xf0bd('0x13')][_0xf0bd('0x15')]);return _0x80054f(_0x5e4773[_0xf0bd('0x13')]['message']);}logger[_0xf0bd('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x452867,_0x5e4773['error'][_0xf0bd('0x15')]);return _0x881746(_0x5e4773['error']['message']);}else{logger[_0xf0bd('0x16')](_0xf0bd('0xe'),_0x452867,_0xf0bd('0xf'));_0x881746(_0x5e4773[_0xf0bd('0x17')][_0xf0bd('0x15')]);}})[_0xf0bd('0x18')](function(_0x26cd47){logger[_0xf0bd('0x13')](_0xf0bd('0xe'),_0x452867,_0x26cd47);_0x80054f(_0x26cd47);});});}exports['UpdateOpenchannelApplication']=function(_0x30dc27){var _0x4d34d0=this;return new Promise(function(_0x5a1bf3,_0x1a5349){return db[_0xf0bd('0x19')][_0xf0bd('0x1a')](_0x30dc27['body'],{'raw':_0x30dc27[_0xf0bd('0x1b')]?_0x30dc27[_0xf0bd('0x1b')][_0xf0bd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30dc27['options']?_0x30dc27[_0xf0bd('0x1b')][_0xf0bd('0x1d')]||null:null,'attributes':_0x30dc27['options']?_0x30dc27['options'][_0xf0bd('0x1e')]||null:null,'limit':_0x30dc27[_0xf0bd('0x1b')]?_0x30dc27['options'][_0xf0bd('0x1f')]||null:null})[_0xf0bd('0xd')](function(_0x3b0f22){logger['info']('UpdateOpenchannelApplication',_0x30dc27);logger[_0xf0bd('0x10')]('UpdateOpenchannelApplication',_0x30dc27,JSON[_0xf0bd('0x12')](_0x3b0f22));_0x5a1bf3(_0x3b0f22);})[_0xf0bd('0x18')](function(_0x457d96){logger[_0xf0bd('0x13')]('UpdateOpenchannelApplication',_0x457d96[_0xf0bd('0x15')],_0x30dc27);_0x1a5349(_0x4d34d0['error'](0x1f4,_0x457d96[_0xf0bd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4a5009a..9066c2d 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 _0x10b5=['delete','openchannelinteraction:destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','put','tracked','openchannel','openchannelinteraction:update','update'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x10b5,0xa4));var _0x510b=function(_0x1e8ad7,_0x28681e){_0x1e8ad7=_0x1e8ad7-0x0;var _0x42adf9=_0x10b5[_0x1e8ad7];return _0x42adf9;};'use strict';var multer=require(_0x510b('0x0'));var util=require(_0x510b('0x1'));var path=require(_0x510b('0x2'));var timeout=require(_0x510b('0x3'));var express=require(_0x510b('0x4'));var router=express['Router']();var fs_extra=require(_0x510b('0x5'));var auth=require(_0x510b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x510b('0x7')]('/',auth[_0x510b('0x8')](),controller[_0x510b('0x9')]);router[_0x510b('0x7')]('/describe',auth[_0x510b('0x8')](),controller[_0x510b('0xa')]);router[_0x510b('0x7')](_0x510b('0xb'),auth[_0x510b('0x8')](),controller[_0x510b('0xc')]);router[_0x510b('0x7')]('/:id/messages',auth[_0x510b('0x8')](),controller[_0x510b('0xd')]);router[_0x510b('0x7')](_0x510b('0xe'),auth['isAuthenticated'](),controller[_0x510b('0xf')]);router[_0x510b('0x10')]('/',auth[_0x510b('0x8')](),controller[_0x510b('0x11')]);router[_0x510b('0x10')]('/:id/messages',auth[_0x510b('0x8')](),controller[_0x510b('0x12')]);router['post'](_0x510b('0x13'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller['addTags']);router[_0x510b('0x14')](_0x510b('0xb'),auth['isAuthenticated'](),interaction[_0x510b('0x15')](_0x510b('0x16'),_0x510b('0x17')),controller[_0x510b('0x18')]);router[_0x510b('0x19')](_0x510b('0xb'),auth[_0x510b('0x8')](),interaction['tracked'](_0x510b('0x16'),_0x510b('0x1a')),controller['destroy']);router[_0x510b('0x19')](_0x510b('0x13'),auth[_0x510b('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x29bb=['express','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe','describe','show','/:id/messages','post','create','addMessage','tracked','openchannel','put','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','connect-timeout'];(function(_0x1e82f2,_0x57120e){var _0x1ccad9=function(_0x25dd1c){while(--_0x25dd1c){_0x1e82f2['push'](_0x1e82f2['shift']());}};_0x1ccad9(++_0x57120e);}(_0x29bb,0x15c));var _0xb29b=function(_0x49f09f,_0x1d5542){_0x49f09f=_0x49f09f-0x0;var _0x50569b=_0x29bb[_0x49f09f];return _0x50569b;};'use strict';var multer=require(_0xb29b('0x0'));var util=require(_0xb29b('0x1'));var path=require('path');var timeout=require(_0xb29b('0x2'));var express=require(_0xb29b('0x3'));var router=express[_0xb29b('0x4')]();var fs_extra=require(_0xb29b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb29b('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xb29b('0x7')](),controller['index']);router[_0xb29b('0x8')](_0xb29b('0x9'),auth[_0xb29b('0x7')](),controller[_0xb29b('0xa')]);router[_0xb29b('0x8')]('/:id',auth[_0xb29b('0x7')](),controller[_0xb29b('0xb')]);router['get'](_0xb29b('0xc'),auth[_0xb29b('0x7')](),controller['getMessages']);router[_0xb29b('0x8')]('/:id/download',auth[_0xb29b('0x7')](),controller['download']);router[_0xb29b('0xd')]('/',auth[_0xb29b('0x7')](),controller[_0xb29b('0xe')]);router[_0xb29b('0xd')](_0xb29b('0xc'),auth['isAuthenticated'](),controller[_0xb29b('0xf')]);router[_0xb29b('0xd')]('/:id/tags',auth[_0xb29b('0x7')](),interaction[_0xb29b('0x10')](_0xb29b('0x11'),'openchannelinteraction:addtags'),controller['addTags']);router[_0xb29b('0x12')](_0xb29b('0x13'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xb29b('0x14')),controller[_0xb29b('0x15')]);router[_0xb29b('0x16')](_0xb29b('0x13'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xb29b('0x17')),controller[_0xb29b('0x18')]);router['delete'](_0xb29b('0x19'),auth[_0xb29b('0x7')](),controller[_0xb29b('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 90e7f76..d2e803a 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 _0x8c25=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0xd5a33b,_0x52f521){var _0x294254=function(_0x2f865d){while(--_0x2f865d){_0xd5a33b['push'](_0xd5a33b['shift']());}};_0x294254(++_0x52f521);}(_0x8c25,0x15e));var _0x58c2=function(_0x2644b9,_0x51b941){_0x2644b9=_0x2644b9-0x0;var _0x521d8f=_0x8c25[_0x2644b9];return _0x521d8f;};'use strict';var Sequelize=require(_0x58c2('0x0'));module[_0x58c2('0x1')]={'closed':{'type':Sequelize[_0x58c2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x58c2('0x3')]},'disposition':{'type':Sequelize[_0x58c2('0x4')]},'secondDisposition':{'type':Sequelize[_0x58c2('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x58c2('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x58c2('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x58c2('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x86dd=['DATE','STRING','ENUM','out','exports'];(function(_0xda6478,_0x53163c){var _0x2ff8ce=function(_0x401b80){while(--_0x401b80){_0xda6478['push'](_0xda6478['shift']());}};_0x2ff8ce(++_0x53163c);}(_0x86dd,0x1ee));var _0xd86d=function(_0x2303e1,_0x270550){_0x2303e1=_0x2303e1-0x0;var _0x4d51c6=_0x86dd[_0x2303e1];return _0x4d51c6;};'use strict';var Sequelize=require('sequelize');module[_0xd86d('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd86d('0x1')]},'disposition':{'type':Sequelize[_0xd86d('0x2')]},'secondDisposition':{'type':Sequelize[_0xd86d('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd86d('0x2')]},'note':{'type':Sequelize[_0xd86d('0x2')]},'read1stAt':{'type':Sequelize[_0xd86d('0x1')]},'threadId':{'type':Sequelize[_0xd86d('0x2')]},'externalUrl':{'type':Sequelize[_0xd86d('0x2')]},'lastMsgAt':{'type':Sequelize[_0xd86d('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xd86d('0x3')]('in',_0xd86d('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd86d('0x2')]},'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 1eff4c2..ce26197 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 _0x53af=['.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','destroy','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','then','catch','map','fieldName','key','model','query','attributes','fields','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','start','body','buildExpression','keys','some','isEmpty','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','length','merge','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','show','params','rawAttributes','intersection','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','Contact','lastName','Attachment','Messages','Account','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','System','secret','renderFile','views','transcript-'];(function(_0x21b86e,_0x47c9a8){var _0x4b7723=function(_0x328f03){while(--_0x328f03){_0x21b86e['push'](_0x21b86e['shift']());}};_0x4b7723(++_0x47c9a8);}(_0x53af,0xf4));var _0xf53a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x53af[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xf53a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf53a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf53a('0x2'));var moment=require(_0xf53a('0x3'));var BPromise=require(_0xf53a('0x4'));var Mustache=require(_0xf53a('0x5'));var util=require(_0xf53a('0x6'));var path=require(_0xf53a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf53a('0x8'));var _=require(_0xf53a('0x9'));var squel=require(_0xf53a('0xa'));var crypto=require(_0xf53a('0xb'));var jsforce=require(_0xf53a('0xc'));var deskjs=require(_0xf53a('0xd'));var toCsv=require(_0xf53a('0xe'));var querystring=require(_0xf53a('0xf'));var Papa=require(_0xf53a('0x10'));var Redis=require(_0xf53a('0x11'));var authService=require(_0xf53a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf53a('0x13'));var hardwareService=require(_0xf53a('0x14'));var logger=require(_0xf53a('0x15'))('api');var utils=require(_0xf53a('0x16'));var config=require(_0xf53a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf53a('0x18'))['db'];config[_0xf53a('0x19')]=_[_0xf53a('0x1a')](config[_0xf53a('0x19')],{'host':_0xf53a('0x1b'),'port':0x18eb});var socket=require(_0xf53a('0x1c'))(new Redis(config[_0xf53a('0x19')]));require(_0xf53a('0x1d'))[_0xf53a('0x1e')](socket);function respondWithStatusCode(_0x273e03,_0x4db412){_0x4db412=_0x4db412||0xcc;return function(_0x40891c){if(_0x40891c){return _0x273e03[_0xf53a('0x1f')](_0x4db412);}return _0x273e03[_0xf53a('0x20')](_0x4db412)[_0xf53a('0x21')]();};}function respondWithResult(_0x4bc764,_0x2fbb75){_0x2fbb75=_0x2fbb75||0xc8;return function(_0xaf7988){if(_0xaf7988){return _0x4bc764['status'](_0x2fbb75)['json'](_0xaf7988);}};}function respondWithFilteredResult(_0x279259,_0x205716){return function(_0x5bc8c7){if(_0x5bc8c7){var _0xe7acec=typeof _0x205716['offset']===_0xf53a('0x22')&&typeof _0x205716[_0xf53a('0x23')]===_0xf53a('0x22');var _0xd822cc=_0x5bc8c7[_0xf53a('0x24')];var _0x3ed0d4=_0xe7acec?0x0:_0x205716['offset'];var _0x36566a=_0xe7acec?_0x5bc8c7['count']:_0x205716[_0xf53a('0x25')]+_0x205716['limit'];var _0x571098;if(_0x36566a>=_0xd822cc){_0x36566a=_0xd822cc;_0x571098=0xc8;}else{_0x571098=0xce;}_0x279259['status'](_0x571098);return _0x279259[_0xf53a('0x26')](_0xf53a('0x27'),_0x3ed0d4+'-'+_0x36566a+'/'+_0xd822cc)[_0xf53a('0x28')](_0x5bc8c7);}return null;};}function patchUpdates(_0x1d6f29){return function(_0x2f9962){try{jsonpatch['apply'](_0x2f9962,_0x1d6f29,!![]);}catch(_0x50aebf){return BPromise[_0xf53a('0x29')](_0x50aebf);}return _0x2f9962['save']();};}function saveUpdates(_0x42842b,_0x4bccd6){return function(_0x2f57b8){if(_0x2f57b8){return _0x2f57b8[_0xf53a('0x2a')](_0x42842b)['then'](function(_0x284e2e){return _0x284e2e;});}return null;};}function removeEntity(_0x49f6ae,_0x20f1f0){return function(_0x341d28){if(_0x341d28){return _0x341d28[_0xf53a('0x2b')]()['then'](function(){_0x49f6ae['status'](0xcc)[_0xf53a('0x21')]();});}};}function handleEntityNotFound(_0x4fc1e6,_0x456136){return function(_0x417373){if(!_0x417373){_0x4fc1e6[_0xf53a('0x1f')](0x194);}return _0x417373;};}function handleError(_0x5621a7,_0x1c7268){_0x1c7268=_0x1c7268||0x1f4;return function(_0x5f5160){logger[_0xf53a('0x2c')](_0x5f5160[_0xf53a('0x2d')]);if(_0x5f5160[_0xf53a('0x2e')]){delete _0x5f5160[_0xf53a('0x2e')];}_0x5621a7[_0xf53a('0x20')](_0x1c7268)[_0xf53a('0x2f')](_0x5f5160);};}function getInteractionUsers(_0xdb1e42,_0x61209a){return new BPromise(function(_0x2ab658,_0x4ce673){try{if(_0x61209a[_0xdb1e42['id']]){_0xdb1e42['Users']=_['map'](_0x61209a[_0xdb1e42['id']],function(_0x29efb3){return{'id':_0x29efb3['id'],'fullname':_0x29efb3[_0xf53a('0x30')]};});}}catch(_0x536526){_0x4ce673(_0x536526);}_0x2ab658(_0xdb1e42);});}function getInteractionTags(_0x18e088,_0x531c15){return new BPromise(function(_0x540db9,_0x269727){try{if(_0x18e088[_0xf53a('0x31')]){_0x18e088[_0xf53a('0x32')]=[];_0x18e088['TagIds'][_0xf53a('0x33')](',')[_0xf53a('0x34')](function(_0x559341){_0x18e088['Tags'][_0xf53a('0x35')](_0x531c15[_0x559341]);});}delete _0x18e088[_0xf53a('0x31')];}catch(_0x36f4d7){_0x269727(_0x36f4d7);}_0x540db9(_0x18e088);});}function updateOpenchannelInteraction(_0xc3220e,_0x153b8b,_0x527c47){return new BPromise(function(_0x2dd88c,_0x24e791){return getInteractionUsers(_0xc3220e,_0x527c47)['then'](function(_0x407f5b){return getInteractionTags(_0x407f5b,_0x153b8b);})[_0xf53a('0x36')](function(_0x6cd906){_0x2dd88c(_0x6cd906);})[_0xf53a('0x37')](function(_0xd2255f){_0x24e791(_0xd2255f);});});}exports['index']=function(_0x2b6432,_0x4159db){var _0x1ac4ec={},_0x16cafe={},_0x153ec3={'count':0x0,'rows':[]};var _0x3dd714=_[_0xf53a('0x38')](db['OpenchannelInteraction']['rawAttributes'],function(_0x191d70){return{'name':_0x191d70[_0xf53a('0x39')],'type':_0x191d70['type'][_0xf53a('0x3a')]};});_0x16cafe[_0xf53a('0x3b')]=_[_0xf53a('0x38')](_0x3dd714,_0xf53a('0x2e'));_0x16cafe[_0xf53a('0x3c')]=_['keys'](_0x2b6432['query']);_0x16cafe['filters']=_['intersection'](_0x16cafe[_0xf53a('0x3b')],_0x16cafe[_0xf53a('0x3c')]);_0x1ac4ec[_0xf53a('0x3d')]=_['intersection'](_0x16cafe[_0xf53a('0x3b')],qs[_0xf53a('0x3e')](_0x2b6432[_0xf53a('0x3c')][_0xf53a('0x3e')]));_0x1ac4ec[_0xf53a('0x3d')]=_0x1ac4ec[_0xf53a('0x3d')]['length']?_0x1ac4ec['attributes']:_0x16cafe[_0xf53a('0x3b')];if(!_0x2b6432[_0xf53a('0x3c')]['hasOwnProperty'](_0xf53a('0x3f'))){_0x1ac4ec[_0xf53a('0x23')]=qs[_0xf53a('0x23')](_0x2b6432[_0xf53a('0x3c')]['limit']);_0x1ac4ec['offset']=qs['offset'](_0x2b6432[_0xf53a('0x3c')][_0xf53a('0x25')]);}_0x1ac4ec['order']=qs['sort'](_0x2b6432['query'][_0xf53a('0x40')]);_0x1ac4ec[_0xf53a('0x41')]=qs[_0xf53a('0x42')](_[_0xf53a('0x43')](_0x2b6432[_0xf53a('0x3c')],_0x16cafe[_0xf53a('0x42')]),_0x3dd714);var _0x1f0869=[];var _0xafca29=squel[_0xf53a('0x44')]()[_0xf53a('0x45')]('id')[_0xf53a('0x45')]('name')[_0xf53a('0x45')](_0xf53a('0x46'))[_0xf53a('0x47')](_0xf53a('0x48'));var _0x5f49d9=squel['select']()[_0xf53a('0x45')](_0xf53a('0x49'))[_0xf53a('0x45')]('u.fullname')['field']('ui.OpenchannelInteractionId')[_0xf53a('0x47')](_0xf53a('0x4a'),'ui')[_0xf53a('0x4b')]('users','u',_0xf53a('0x4c'));var _0x3de387=squel['select']()[_0xf53a('0x47')](_0xf53a('0x4d'),'i')['left_join'](_0xf53a('0x4e'),'c',_0xf53a('0x4f'))['left_join'](_0xf53a('0x50'),'o',_0xf53a('0x51'))[_0xf53a('0x4b')](_0xf53a('0x52'),'a',_0xf53a('0x53'))[_0xf53a('0x4b')]('openchannel_messages','me',_0xf53a('0x54'))[_0xf53a('0x4b')](_0xf53a('0x55'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xf53a('0x4b')](_0xf53a('0x48'),'t',_0xf53a('0x56'));var _0x16fc57=squel[_0xf53a('0x57')]();var _0x7cbebf=[];var _0x2be715=squel[_0xf53a('0x57')]();var _0x1dfea1;if(_0x2b6432[_0xf53a('0x3c')]['search']){_0x1dfea1=as[_0xf53a('0x58')](_0x2b6432[_0xf53a('0x3c')]['search']);var _0x2d0305=_0x1dfea1[_0xf53a('0x59')];for(var _0x161b29=0x0;_0x161b29<_0x1dfea1[_0xf53a('0x5a')]['length'];_0x161b29++){var _0x236ec2=_0x1dfea1['conditions'][_0x161b29];var _0x3a55b2='i';var _0xf614dd=_['find'](_0x3dd714,[_0xf53a('0x2e'),_0x236ec2[_0xf53a('0x45')]]);if(!_0xf614dd){switch(_0x236ec2[_0xf53a('0x45')]){case _0xf53a('0x5b'):if(_0x236ec2[_0xf53a('0x5c')]==0x1){_0x3de387[_0xf53a('0x5d')]('`'+_0x236ec2['field']+_0xf53a('0x5e'));}else{_0x3de387[_0xf53a('0x5d')]('`'+_0x236ec2[_0xf53a('0x45')]+_0xf53a('0x5f'));}break;case'Contact':if(_0x236ec2[_0xf53a('0x60')]==='$substring'){if(_0x236ec2[_0xf53a('0x5c')][_0xf53a('0x33')]('\x20')['length']>0x1){_0x16fc57[_0x2d0305](_0xf53a('0x61'),qs['getFullTextValue'](_0x236ec2[_0xf53a('0x5c')]),null);}else{var _0x13e884='%'+_0x236ec2[_0xf53a('0x5c')]+'%';_0x16fc57[_0x2d0305](_0xf53a('0x62'),_0x13e884,_0x13e884,_0x13e884);}}else{_0xf614dd=_[_0xf53a('0x63')](_0x3dd714,[_0xf53a('0x2e'),_0xf53a('0x64')]);_0x236ec2['field']=_0xf53a('0x64');_0x1d22a4=as['buildExpression'](_0x3a55b2,_0xf614dd['type'],_0x236ec2);_0x16fc57[_0x2d0305](_0x1d22a4[_0xf53a('0x65')],_0x1d22a4[_0xf53a('0x5c')]['start'],_0x1d22a4[_0xf53a('0x5c')][_0xf53a('0x21')]);}break;case _0xf53a('0x66'):var _0x2fc534=_0x236ec2['value'][_0xf53a('0x33')](',')[_0xf53a('0x38')](function(_0x545ba8){return Number(_0x545ba8);});_0x2fc534[_0xf53a('0x34')](function(_0xce6798){_0x2be715['or'](_0xf53a('0x67'),'%,'+_0xce6798+',%');});_0x7cbebf=_[_0xf53a('0x68')](_0x7cbebf,_0x2fc534);break;case _0xf53a('0x69'):if(_0x236ec2[_0xf53a('0x60')]===_0xf53a('0x6a')){_0x16fc57[_0x2d0305](_0xf53a('0x6b'),'%'+_0x236ec2['value']+'%',null);}else{_0xf614dd=_['find'](_0x3dd714,[_0xf53a('0x2e'),_0xf53a('0x6c')]);_0x236ec2[_0xf53a('0x45')]=_0xf53a('0x6c');_0x1d22a4=as['buildExpression'](_0x3a55b2,_0xf614dd[_0xf53a('0x6d')],_0x236ec2);_0x16fc57[_0x2d0305](_0x1d22a4[_0xf53a('0x65')],_0x1d22a4[_0xf53a('0x5c')][_0xf53a('0x6e')],_0x1d22a4[_0xf53a('0x5c')][_0xf53a('0x21')]);}break;case _0xf53a('0x6f'):_0x1d22a4=as[_0xf53a('0x70')]('me',null,_0x236ec2);_0x16fc57[_0x2d0305](_0x1d22a4[_0xf53a('0x65')],_0x1d22a4[_0xf53a('0x5c')]['start'],_0x1d22a4[_0xf53a('0x5c')][_0xf53a('0x21')]);break;}}else{var _0x1d22a4=as[_0xf53a('0x70')](_0x3a55b2,_0xf614dd[_0xf53a('0x6d')],_0x236ec2);_0x16fc57[_0x2d0305](_0x1d22a4[_0xf53a('0x65')],_0x1d22a4['value'][_0xf53a('0x6e')],_0x1d22a4['value'][_0xf53a('0x21')]);}}}else{var _0x149778=_(_0x2b6432['query'])[_0xf53a('0x71')]()[_0xf53a('0x38')](function(_0x3d135e){return _[_0xf53a('0x72')](_0x3dd714,[_0xf53a('0x2e'),_0x3d135e])?_0x3d135e:undefined;})['compact']()[_0xf53a('0x5c')]();if(!_[_0xf53a('0x73')](_0x149778)){_0x149778[_0xf53a('0x34')](function(_0x2f037d){if(_0x2f037d==='OpenchannelAccountId'){_0x3de387[_0xf53a('0x41')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xf53a('0x74')](_0x2b6432[_0xf53a('0x3c')][_0x2f037d]));}else if(_0x2f037d===_0xf53a('0x75')){var _0x5d7cf7=JSON['parse'](_0x2b6432[_0xf53a('0x3c')][_0x2f037d])[_0xf53a('0x76')];var _0x59f645=JSON[_0xf53a('0x77')](_0x2b6432['query'][_0x2f037d])['$lte'];_0x3de387['where'](_0xf53a('0x78'),_0x5d7cf7,_0x59f645);}else{if(_0x2b6432['query'][_0x2f037d]==='null'){_0x3de387[_0xf53a('0x41')]('i.'+_0x2f037d+'\x20IS\x20NULL');}else{_0x3de387[_0xf53a('0x41')]('i.'+_0x2f037d+_0xf53a('0x79'),_0x2b6432[_0xf53a('0x3c')][_0x2f037d]);}}});}if(_0x2b6432[_0xf53a('0x3c')][_0xf53a('0x7a')]){if(_0x2b6432[_0xf53a('0x3c')][_0xf53a('0x7a')]==0x1){_0x3de387[_0xf53a('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x3de387[_0xf53a('0x5d')](_0xf53a('0x7b'));}}if(_0x2b6432['query'][_0xf53a('0x7c')]){_0x7cbebf=_['isArray'](_0x2b6432[_0xf53a('0x3c')]['tag'])?_0x2b6432['query'][_0xf53a('0x7c')]:new Array(_0x2b6432[_0xf53a('0x3c')][_0xf53a('0x7c')]);_0x7cbebf[_0xf53a('0x34')](function(_0x25a009){_0x2be715['or'](_0xf53a('0x67'),'%,'+_0x25a009+',%');});}if(_0x2b6432[_0xf53a('0x3c')][_0xf53a('0x7d')]){var _0xff709=_0x2b6432[_0xf53a('0x3c')][_0xf53a('0x7d')][_0xf53a('0x7e')]('\x5c','\x5c\x5c')[_0xf53a('0x7e')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xff709)){_0x16fc57['or'](_0xf53a('0x7f'),_0xff709+'%');}else{_0x16fc57['or'](_0xf53a('0x80'),qs[_0xf53a('0x81')](_0xff709))['or'](_0xf53a('0x82'),_0xff709+'%')['or'](_0xf53a('0x83'),_0xff709+'%');}}}_0x3de387['where'](_0x16fc57);_0x3de387[_0xf53a('0x84')]('i.id');var _0xa93c97={'type':db[_0xf53a('0x85')][_0xf53a('0x86')][_0xf53a('0x87')],'raw':!![]};var _0x464020=_0x3de387[_0xf53a('0x88')]();_0x464020[_0xf53a('0x45')](_0xf53a('0x89'));_0x464020[_0xf53a('0x45')](_0xf53a('0x8a'),_0xf53a('0x5b'));if(_0x1ac4ec[_0xf53a('0x8b')]){_0x1ac4ec['order']['forEach'](function(_0x440fc7){var _0x3a515e=_0x440fc7[0x0]==='contactName'?_0x440fc7[0x0]:'i.'+_0x440fc7[0x0];_0x3de387['order'](_0x3a515e,_0x440fc7[0x1]===_0xf53a('0x8c')?![]:!![]);});}if(!_[_0xf53a('0x73')](_0x7cbebf)){_0x3de387[_0xf53a('0x5d')](_0x2be715);_0x464020[_0xf53a('0x41')](_0xf53a('0x8d'),_0x7cbebf);}BPromise['resolve']()[_0xf53a('0x36')](function(){if(!_0x1dfea1){if(_0x2b6432['query'][_0xf53a('0x8e')])return;_0x464020[_0xf53a('0x41')](_0xf53a('0x8f'));_0x3de387[_0xf53a('0x41')](_0xf53a('0x8f'));return;}if(_0x2b6432[_0xf53a('0x90')][_0xf53a('0x91')]!==_0xf53a('0x92'))return;return _0x2b6432['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xf53a('0x36')](function(_0x24f239){if(_[_0xf53a('0x73')](_0x24f239)){_0x464020[_0xf53a('0x41')](_0xf53a('0x93'));_0x3de387[_0xf53a('0x41')](_0xf53a('0x93'));}else{_0x464020[_0xf53a('0x41')](_0xf53a('0x94'),_[_0xf53a('0x38')](_0x24f239,'id'));_0x3de387[_0xf53a('0x41')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xf53a('0x38')](_0x24f239,'id'));}});})['then'](function(){if(_0x2b6432['user'][_0xf53a('0x91')]===_0xf53a('0x92')&&!_0x1dfea1&&!_0x2b6432['query']['OpenchannelAccountId'])return[];return db[_0xf53a('0x95')][_0xf53a('0x3c')](_0x464020[_0xf53a('0x96')](),_0xa93c97);})[_0xf53a('0x36')](function(_0xc5788b){_0x153ec3[_0xf53a('0x24')]=_0xc5788b[_0xf53a('0x97')];if(_0x153ec3[_0xf53a('0x24')]===0x0)return[];return db[_0xf53a('0x95')]['query'](_0xafca29['toString'](),_0xa93c97)[_0xf53a('0x36')](function(_0x5c3e41){_0x1f0869=_['keyBy'](_0x5c3e41,'id');_0xa93c97=_[_0xf53a('0x98')](_0xa93c97,{'model':db[_0xf53a('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b6432[_0xf53a('0x3c')][_0xf53a('0x3e')]){_0x1ac4ec[_0xf53a('0x3d')]['forEach'](function(_0x2d0ab8){_0x3de387[_0xf53a('0x45')]('i.'+_0x2d0ab8);});}else{_0x3de387[_0xf53a('0x45')](_0xf53a('0x8a'),_0xf53a('0x5b'));_0x3de387['field'](_0xf53a('0x9a'),_0xf53a('0x9b'));_0x3de387['field'](_0xf53a('0x9c'),_0xf53a('0x9d'));_0x3de387[_0xf53a('0x45')](_0xf53a('0x9e'),_0xf53a('0x9f'));_0x3de387[_0xf53a('0x45')](_0xf53a('0xa0'));_0x3de387['field']('c.firstName','Contact.firstName');_0x3de387[_0xf53a('0x45')](_0xf53a('0xa1'),_0xf53a('0xa2'));_0x3de387['field'](_0xf53a('0xa3'),_0xf53a('0xa4'));_0x3de387['field'](_0xf53a('0xa5'),'Contact.phone');_0x3de387[_0xf53a('0x45')](_0xf53a('0xa6'),_0xf53a('0xa7'));_0x3de387[_0xf53a('0x45')](_0xf53a('0xa8'),_0xf53a('0xa9'));_0x3de387[_0xf53a('0x45')](_0xf53a('0xaa'),_0xf53a('0xab'));_0x3de387[_0xf53a('0x45')]('o.internal','Owner.internal');_0x3de387[_0xf53a('0x45')](_0xf53a('0xac'),_0xf53a('0x31'));}if(_0x1ac4ec[_0xf53a('0x23')])_0x3de387['limit'](_0x1ac4ec['limit']);if(_0x1ac4ec['offset'])_0x3de387[_0xf53a('0x25')](_0x1ac4ec['offset']);return db[_0xf53a('0x95')][_0xf53a('0x3c')](_0x3de387[_0xf53a('0x96')](),_0xa93c97);})['then'](function(_0x16704f){if(_0x16704f['length']>0x0)_0x5f49d9[_0xf53a('0x41')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x16704f,'id'));return db['sequelize'][_0xf53a('0x3c')](_0x5f49d9[_0xf53a('0x96')](),_0xa93c97)[_0xf53a('0x36')](function(_0x998cfd){var _0x25af82=_[_0xf53a('0xad')](_0x998cfd,'OpenchannelInteractionId');var _0x239515=[];_0x16704f[_0xf53a('0x34')](function(_0x31b623){_0x239515[_0xf53a('0x35')](updateOpenchannelInteraction(_0x31b623,_0x1f0869,_0x25af82));});return BPromise[_0xf53a('0xae')](_0x239515);});});})[_0xf53a('0x36')](function(_0x4aeedb){_0x153ec3['rows']=_0x4aeedb;return _0x153ec3;})[_0xf53a('0x36')](respondWithFilteredResult(_0x4159db,_0x1ac4ec))[_0xf53a('0x37')](handleError(_0x4159db,null));};exports[_0xf53a('0xaf')]=function(_0x49d4d7,_0x419000){var _0x5bf720={};if(_0x49d4d7[_0xf53a('0x3c')][_0xf53a('0x6d')]&&_0x49d4d7['query'][_0xf53a('0x6d')]===_0xf53a('0x47')){_0x5bf720[_0xf53a('0x47')]=_0x49d4d7[_0xf53a('0xb0')]['id'];}else{_0x5bf720['id']=_0x49d4d7[_0xf53a('0xb0')]['id'];}var _0x255377={'raw':![],'where':_0x5bf720},_0x35cd53={};_0x35cd53['model']=_[_0xf53a('0x71')](db[_0xf53a('0x99')][_0xf53a('0xb1')]);_0x35cd53['query']=_[_0xf53a('0x71')](_0x49d4d7[_0xf53a('0x3c')]);_0x35cd53[_0xf53a('0x42')]=_[_0xf53a('0xb2')](_0x35cd53[_0xf53a('0x3b')],_0x35cd53['query']);_0x255377['attributes']=_[_0xf53a('0xb2')](_0x35cd53[_0xf53a('0x3b')],qs[_0xf53a('0x3e')](_0x49d4d7[_0xf53a('0x3c')][_0xf53a('0x3e')]));_0x255377[_0xf53a('0x3d')]=_0x255377['attributes'][_0xf53a('0x97')]?_0x255377['attributes']:_0x35cd53[_0xf53a('0x3b')];if(_0x49d4d7['query'][_0xf53a('0xb3')]){_0x255377[_0xf53a('0xb4')]=[{'all':!![]}];}_0x255377=_[_0xf53a('0x98')]({},_0x255377,_0x49d4d7[_0xf53a('0xb5')]);return db[_0xf53a('0x99')]['find'](_0x255377)['then'](handleEntityNotFound(_0x419000,null))['then'](respondWithResult(_0x419000,null))['catch'](handleError(_0x419000,null));};exports[_0xf53a('0xb6')]=function(_0x29c95d,_0x2eb816){return db[_0xf53a('0x99')][_0xf53a('0xb6')](_0x29c95d[_0xf53a('0x6f')],{})[_0xf53a('0x36')](respondWithResult(_0x2eb816,0xc9))['catch'](handleError(_0x2eb816,null));};exports['update']=function(_0x528b5e,_0xa553ea){if(_0x528b5e['body']['id']){delete _0x528b5e[_0xf53a('0x6f')]['id'];}return db[_0xf53a('0x99')][_0xf53a('0x63')]({'where':{'id':_0x528b5e['params']['id']}})[_0xf53a('0x36')](handleEntityNotFound(_0xa553ea,null))[_0xf53a('0x36')](saveUpdates(_0x528b5e[_0xf53a('0x6f')],null))[_0xf53a('0x36')](respondWithResult(_0xa553ea,null))[_0xf53a('0x37')](handleError(_0xa553ea,null));};exports[_0xf53a('0x2b')]=function(_0x28b0da,_0x42f284){return db['OpenchannelInteraction']['find']({'where':{'id':_0x28b0da[_0xf53a('0xb0')]['id']}})[_0xf53a('0x36')](handleEntityNotFound(_0x42f284,null))[_0xf53a('0x36')](removeEntity(_0x42f284,null))[_0xf53a('0x37')](handleError(_0x42f284,null));};exports[_0xf53a('0xb7')]=function(_0x5220e2,_0x382afe){return db[_0xf53a('0x99')]['describe']()[_0xf53a('0x36')](respondWithResult(_0x382afe,null))[_0xf53a('0x37')](handleError(_0x382afe,null));};exports[_0xf53a('0xb8')]=function(_0x4bfcd8,_0x452a57,_0x5bb762){return db[_0xf53a('0xb9')][_0xf53a('0x63')]({'where':{'id':_0x4bfcd8[_0xf53a('0xb0')]['id']}})[_0xf53a('0x36')](handleEntityNotFound(_0x452a57,null))[_0xf53a('0x36')](function(_0x277037){if(_0x277037){return _0x277037[_0xf53a('0xb8')](_0x4bfcd8[_0xf53a('0x6f')][_0xf53a('0xba')],_[_0xf53a('0xbb')](_0x4bfcd8[_0xf53a('0x6f')],['ids','id'])||{});}})['then'](respondWithResult(_0x452a57,null))[_0xf53a('0x37')](handleError(_0x452a57,null));};exports[_0xf53a('0xbc')]=function(_0x32f471,_0x495c1,_0x10d26f){var _0xabedb2={'raw':![],'where':{}};var _0xff2357={};var _0x4c5d1a={'count':0x0,'rows':[]};return db[_0xf53a('0x99')][_0xf53a('0xbd')]({'where':{'id':_0x32f471[_0xf53a('0xb0')]['id']}})[_0xf53a('0x36')](handleEntityNotFound(_0x495c1,null))[_0xf53a('0x36')](function(_0x2c4bef){if(_0x2c4bef){_0xff2357[_0xf53a('0x3b')]=_[_0xf53a('0x71')](db[_0xf53a('0xb9')][_0xf53a('0xb1')]);_0xff2357[_0xf53a('0x3c')]=_[_0xf53a('0x71')](_0x32f471['query']);_0xff2357['filters']=_['intersection'](_0xff2357['model'],_0xff2357[_0xf53a('0x3c')]);_0xabedb2[_0xf53a('0x3d')]=_['intersection'](_0xff2357['model'],qs[_0xf53a('0x3e')](_0x32f471[_0xf53a('0x3c')]['fields']));_0xabedb2[_0xf53a('0x3d')]=_0xabedb2[_0xf53a('0x3d')][_0xf53a('0x97')]?_0xabedb2[_0xf53a('0x3d')]:_0xff2357[_0xf53a('0x3b')];if(!_0x32f471[_0xf53a('0x3c')]['hasOwnProperty']('nolimit')){_0xabedb2[_0xf53a('0x23')]=qs[_0xf53a('0x23')](_0x32f471[_0xf53a('0x3c')][_0xf53a('0x23')]);_0xabedb2[_0xf53a('0x25')]=qs['offset'](_0x32f471['query'][_0xf53a('0x25')]);}_0xabedb2[_0xf53a('0x8b')]=qs['sort'](_0x32f471['query'][_0xf53a('0x40')]);_0xabedb2[_0xf53a('0x41')]=qs[_0xf53a('0x42')](_[_0xf53a('0x43')](_0x32f471[_0xf53a('0x3c')],_0xff2357[_0xf53a('0x42')]));_0xabedb2['where'][_0xf53a('0xbe')]=_0x2c4bef['id'];if(_0x32f471['query'][_0xf53a('0x7d')]){_0xabedb2[_0xf53a('0x41')]=_[_0xf53a('0x98')](_0xabedb2[_0xf53a('0x41')],{'$or':_[_0xf53a('0x38')](_0xabedb2['attributes'],function(_0x4fac59){var _0x5cb43b={};_0x5cb43b[_0x4fac59]={'$like':'%'+_0x32f471[_0xf53a('0x3c')]['filter']+'%'};return _0x5cb43b;})});}if(_0x32f471[_0xf53a('0x3c')][_0xf53a('0x76')]){var _0x42d757=_0x32f471[_0xf53a('0x3c')][_0xf53a('0x76')][_0xf53a('0x33')](',');var _0x3afc3c={};_0x3afc3c[_0x42d757[0x0]]={'$gte':moment(_0x42d757[0x1])[_0xf53a('0xbf')](_0xf53a('0xc0'))};_0xabedb2['where']=_[_0xf53a('0x98')](_0xabedb2[_0xf53a('0x41')],_0x3afc3c);}_0xabedb2=_[_0xf53a('0x98')]({},_0xabedb2,_0x32f471['options']);return db['OpenchannelMessage'][_0xf53a('0x24')]({'where':_0xabedb2[_0xf53a('0x41')]})['then'](function(_0x1b03a6){_0x4c5d1a[_0xf53a('0x24')]=_0x1b03a6;if(_0x32f471[_0xf53a('0x3c')][_0xf53a('0xb3')]){_0xabedb2[_0xf53a('0xb4')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0xabedb2);})[_0xf53a('0x36')](function(_0x5b2779){_0x4c5d1a['rows']=_0x5b2779;return _0x4c5d1a;});}})[_0xf53a('0x36')](respondWithFilteredResult(_0x495c1,_0xabedb2))[_0xf53a('0x37')](handleError(_0x495c1,null));};exports[_0xf53a('0xc1')]=function(_0x2edc5e,_0xe0665b,_0x342062){return db[_0xf53a('0x99')][_0xf53a('0x63')]({'where':{'id':_0x2edc5e[_0xf53a('0xb0')]['id']}})[_0xf53a('0x36')](handleEntityNotFound(_0xe0665b,null))[_0xf53a('0x36')](function(_0x189688){if(_0x189688){return _0x189688[_0xf53a('0xc2')](_0x2edc5e[_0xf53a('0x6f')]['ids'],_['omit'](_0x2edc5e[_0xf53a('0x6f')],['ids','id'])||{})[_0xf53a('0xc3')](function(){return db[_0xf53a('0x66')]['findAll']({'attributes':['id',_0xf53a('0x2e'),_0xf53a('0x46')],'where':{'id':_0x2edc5e[_0xf53a('0x6f')][_0xf53a('0xba')]}});})[_0xf53a('0x36')](function(_0x4096e4){socket['emit'](_0xf53a('0xc4'),{'id':Number(_0x2edc5e[_0xf53a('0xb0')]['id']),'tags':_0x4096e4||[]});return{'id':Number(_0x2edc5e[_0xf53a('0xb0')]['id']),'tags':_0x4096e4||[]};});}})[_0xf53a('0x36')](respondWithResult(_0xe0665b,null))[_0xf53a('0x37')](handleError(_0xe0665b,null));};exports[_0xf53a('0xc5')]=function(_0x375203,_0x147db8,_0x6b5837){return db[_0xf53a('0x99')]['find']({'where':{'id':_0x375203[_0xf53a('0xb0')]['id']}})['then'](handleEntityNotFound(_0x147db8,null))['then'](function(_0x2292bb){if(_0x2292bb){return _0x2292bb[_0xf53a('0xc5')](_0x375203[_0xf53a('0x3c')][_0xf53a('0xba')]);}})[_0xf53a('0x36')](respondWithStatusCode(_0x147db8,null))['catch'](handleError(_0x147db8,null));};exports[_0xf53a('0xc6')]=function(_0x1bb371,_0x5efc21){var _0x12e897=moment()[_0xf53a('0xc7')]()[_0xf53a('0x96')]();var _0x1642a7=path[_0xf53a('0xc8')](config[_0xf53a('0xc9')],_0xf53a('0xca'),'files','tmp');var _0x54dc90=path[_0xf53a('0xc8')](config[_0xf53a('0xc9')],_0xf53a('0xca'),_0xf53a('0xcb'),_0xf53a('0xcc'));var _0x24ee42=path[_0xf53a('0xc8')](_0x1642a7,_0x12e897);var _0x54677d=util[_0xf53a('0xbf')](_0xf53a('0xcd'),_0x1bb371[_0xf53a('0xb0')]['id'],_0x12e897);var _0x1e32f4=path[_0xf53a('0xc8')](_0x1642a7,_0x54677d);var _0x3dd9b1=[];_0x3dd9b1[_0xf53a('0x35')]({'model':db[_0xf53a('0x69')],'as':_0xf53a('0x69'),'attributes':['id',_0xf53a('0x30')],'raw':!![]});_0x3dd9b1[_0xf53a('0x35')]({'model':db[_0xf53a('0xce')],'as':_0xf53a('0xcf'),'attributes':['id','firstName',_0xf53a('0xd0')],'raw':!![]});if(_0x1bb371[_0xf53a('0x3c')][_0xf53a('0xcc')]){_0x3dd9b1[_0xf53a('0x35')]({'model':db[_0xf53a('0xd1')],'as':_0xf53a('0xd1'),'raw':!![]});}var _0x3abb55=[{'model':db['OpenchannelMessage'],'as':_0xf53a('0xd2'),'attributes':['id',_0xf53a('0x6f'),_0xf53a('0x75'),'direction','secret',_0xf53a('0x7a')],'include':_0x3dd9b1}];_0x3abb55[_0xf53a('0x35')]({'model':db['OpenchannelAccount'],'as':_0xf53a('0xd3'),'attributes':['id',_0xf53a('0x2e')]});_0x3abb55[_0xf53a('0x35')]({'model':db[_0xf53a('0x69')],'as':_0xf53a('0xd4'),'attributes':['id','fullname']});return db[_0xf53a('0x99')][_0xf53a('0x63')]({'where':{'id':_0x1bb371[_0xf53a('0xb0')]['id']},'include':_0x3abb55})[_0xf53a('0x36')](handleEntityNotFound(_0x5efc21,null))[_0xf53a('0x36')](function(_0x21a5fb){if(_0x21a5fb){var _0x171c82=_0x21a5fb['get']({'plain':!![]});fs[_0xf53a('0xd5')](_0x24ee42);var _0x45479a={'channel':_0xf53a('0xd6'),'account':_0x171c82[_0xf53a('0xd3')]['name'],'agent':_0x171c82[_0xf53a('0xd4')]?_0x171c82[_0xf53a('0xd4')][_0xf53a('0x30')]:_0xf53a('0xd7'),'createdAt':moment(_0x171c82[_0xf53a('0x75')])[_0xf53a('0xbf')](_0xf53a('0xc0'))[_0xf53a('0x96')](),'closedAt':_0x171c82[_0xf53a('0xd8')]?moment(_0x171c82[_0xf53a('0xd9')])[_0xf53a('0xbf')](_0xf53a('0xc0'))[_0xf53a('0x96')]():'','disposition':_0x171c82[_0xf53a('0xda')],'visibility':_0x171c82[_0xf53a('0xdb')]?_0xf53a('0xdc'):_0xf53a('0xdd'),'messages':_(_0x171c82[_0xf53a('0xd2')])[_0xf53a('0x7d')]({'secret':![]})[_0xf53a('0x38')](function(_0x2fe2ec){if(_0x2fe2ec['Attachment']){var _0x25786f=path['join'](_0x54dc90,_0x2fe2ec[_0xf53a('0xd1')]['basename']);if(fs[_0xf53a('0xde')](_0x25786f)){fs[_0xf53a('0xdf')](_0x25786f)[_0xf53a('0xe0')](fs[_0xf53a('0xe1')](path[_0xf53a('0xc8')](_0x24ee42,_0x2fe2ec[_0xf53a('0xd1')][_0xf53a('0xe2')])));}}return{'date':moment(_0x2fe2ec[_0xf53a('0x75')])['format'](_0xf53a('0xc0'))[_0xf53a('0x96')](),'sender':_0x2fe2ec[_0xf53a('0xe3')]===_0xf53a('0xe4')?_0x2fe2ec[_0xf53a('0x69')]?_0x2fe2ec[_0xf53a('0x69')][_0xf53a('0x30')]:_0xf53a('0xe5'):_0x2fe2ec[_0xf53a('0xcf')]['firstName']+(_0x2fe2ec[_0xf53a('0xcf')]['lastName']?'\x20'+_0x2fe2ec['Contact'][_0xf53a('0xd0')]:''),'body':_0x2fe2ec[_0xf53a('0xd1')]?_0x2fe2ec[_0xf53a('0xd1')][_0xf53a('0xe2')]:_0x2fe2ec['body'],'direction':_0x2fe2ec[_0xf53a('0xe3')]===_0xf53a('0xe4')?'A':'C','secret':_0x2fe2ec[_0xf53a('0xe6')],'read':_0x2fe2ec[_0xf53a('0x7a')],'attachment':_0x2fe2ec[_0xf53a('0xd1')]};})[_0xf53a('0x5c')]()};return ejs[_0xf53a('0xe7')](path[_0xf53a('0xc8')](config[_0xf53a('0xc9')],_0xf53a('0xca'),_0xf53a('0xe8'),'downloadInteraction.ejs'),{'interaction':_0x45479a})[_0xf53a('0x36')](function(_0x5d1129){var _0x4d34c6=path[_0xf53a('0xc8')](_0x24ee42,_0xf53a('0xe9')+_0x171c82['id']+'-'+_0x12e897+_0xf53a('0xea'));var _0x12dda4={'path':_0x4d34c6,'channel':_0xf53a('0xd6'),'interactionId':_0x171c82['id']};return pdf[_0xf53a('0xeb')](_0x5d1129,_0x12dda4);})[_0xf53a('0x36')](function(){return new BPromise(function(_0x3c1104,_0x46a0a8){zipdir(_0x24ee42,{'saveTo':_0x1e32f4},function(_0x30f89a,_0x3eb2dd){if(_0x30f89a)return _0x46a0a8(_0x30f89a);return _0x3c1104(_0x3eb2dd);});})['then'](function(){return new BPromise(function(_0x1b143f,_0x3c553a){rimraf(_0x24ee42,function(_0x4d8704){if(_0x4d8704)_0x3c553a(_0x4d8704);return _0x1b143f();});});})[_0xf53a('0x36')](function(){return _0x5efc21[_0xf53a('0xc6')](_0x1e32f4,_0x54677d,function(_0x19817c){if(_0x19817c){console[_0xf53a('0xec')](_0xf53a('0xed'),_0x19817c);}else{fs[_0xf53a('0xee')](_0x1e32f4);}});});});}else{return _0x5efc21['sendStatus'](0xc8);}})[_0xf53a('0x37')](handleError(_0x5efc21,null));}; \ No newline at end of file +var _0xcca7=['mkdirSync','Openchannel','N.A.','closedAt','Private','basename','existsSync','createReadStream','pipe','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','sendStatus','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','name','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','buildExpression','start','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','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','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','keyBy','merge','Account.key','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','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','toString','groupBy','OpenchannelInteractionId','rows','show','params','includeAll','options','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner'];(function(_0x4a14d9,_0x5caaf6){var _0x1afc25=function(_0x4b96ef){while(--_0x4b96ef){_0x4a14d9['push'](_0x4a14d9['shift']());}};_0x1afc25(++_0x5caaf6);}(_0xcca7,0xff));var _0x7cca=function(_0x552cb2,_0x503b9a){_0x552cb2=_0x552cb2-0x0;var _0xc5a7ca=_0xcca7[_0x552cb2];return _0xc5a7ca;};'use strict';var emlformat=require(_0x7cca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7cca('0x1'));var rp=require(_0x7cca('0x2'));var moment=require(_0x7cca('0x3'));var BPromise=require(_0x7cca('0x4'));var Mustache=require(_0x7cca('0x5'));var util=require('util');var path=require(_0x7cca('0x6'));var sox=require(_0x7cca('0x7'));var csv=require(_0x7cca('0x8'));var ejs=require(_0x7cca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7cca('0xa'));var squel=require(_0x7cca('0xb'));var crypto=require(_0x7cca('0xc'));var jsforce=require(_0x7cca('0xd'));var deskjs=require(_0x7cca('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7cca('0xf'));var Papa=require(_0x7cca('0x10'));var Redis=require(_0x7cca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var pdf=require(_0x7cca('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x15'))(_0x7cca('0x16'));var utils=require(_0x7cca('0x17'));var config=require(_0x7cca('0x18'));var licenseUtil=require(_0x7cca('0x19'));var db=require(_0x7cca('0x1a'))['db'];config['redis']=_[_0x7cca('0x1b')](config[_0x7cca('0x1c')],{'host':_0x7cca('0x1d'),'port':0x18eb});var socket=require(_0x7cca('0x1e'))(new Redis(config[_0x7cca('0x1c')]));require(_0x7cca('0x1f'))[_0x7cca('0x20')](socket);function respondWithStatusCode(_0x15532d,_0x43f116){_0x43f116=_0x43f116||0xcc;return function(_0xcec626){if(_0xcec626){return _0x15532d['sendStatus'](_0x43f116);}return _0x15532d['status'](_0x43f116)[_0x7cca('0x21')]();};}function respondWithResult(_0x5e6753,_0x2448e9){_0x2448e9=_0x2448e9||0xc8;return function(_0x154942){if(_0x154942){return _0x5e6753[_0x7cca('0x22')](_0x2448e9)[_0x7cca('0x23')](_0x154942);}};}function respondWithFilteredResult(_0x29cc51,_0x141c2d){return function(_0x3a1af6){if(_0x3a1af6){var _0x4c706a=typeof _0x141c2d[_0x7cca('0x24')]==='undefined'&&typeof _0x141c2d[_0x7cca('0x25')]===_0x7cca('0x26');var _0x4d8c52=_0x3a1af6[_0x7cca('0x27')];var _0xc54424=_0x4c706a?0x0:_0x141c2d[_0x7cca('0x24')];var _0x248340=_0x4c706a?_0x3a1af6[_0x7cca('0x27')]:_0x141c2d[_0x7cca('0x24')]+_0x141c2d[_0x7cca('0x25')];var _0x422875;if(_0x248340>=_0x4d8c52){_0x248340=_0x4d8c52;_0x422875=0xc8;}else{_0x422875=0xce;}_0x29cc51[_0x7cca('0x22')](_0x422875);return _0x29cc51[_0x7cca('0x28')](_0x7cca('0x29'),_0xc54424+'-'+_0x248340+'/'+_0x4d8c52)['json'](_0x3a1af6);}return null;};}function patchUpdates(_0x54b5dc){return function(_0x488758){try{jsonpatch[_0x7cca('0x2a')](_0x488758,_0x54b5dc,!![]);}catch(_0x3f7c55){return BPromise['reject'](_0x3f7c55);}return _0x488758[_0x7cca('0x2b')]();};}function saveUpdates(_0x2192c2,_0x403026){return function(_0x21e066){if(_0x21e066){return _0x21e066[_0x7cca('0x2c')](_0x2192c2)[_0x7cca('0x2d')](function(_0x526021){return _0x526021;});}return null;};}function removeEntity(_0x1fb343,_0x3259ef){return function(_0x5ea65b){if(_0x5ea65b){return _0x5ea65b[_0x7cca('0x2e')]()['then'](function(){_0x1fb343['status'](0xcc)[_0x7cca('0x21')]();});}};}function handleEntityNotFound(_0x62b1ab,_0x541175){return function(_0x4133e7){if(!_0x4133e7){_0x62b1ab['sendStatus'](0x194);}return _0x4133e7;};}function handleError(_0x30e536,_0x3d29c9){_0x3d29c9=_0x3d29c9||0x1f4;return function(_0x3c568a){logger['error'](_0x3c568a[_0x7cca('0x2f')]);if(_0x3c568a['name']){delete _0x3c568a['name'];}_0x30e536[_0x7cca('0x22')](_0x3d29c9)[_0x7cca('0x30')](_0x3c568a);};}function getInteractionUsers(_0x51ec60,_0x2e7202){return new BPromise(function(_0x170e62,_0xcb4422){try{if(_0x2e7202[_0x51ec60['id']]){_0x51ec60['Users']=_[_0x7cca('0x31')](_0x2e7202[_0x51ec60['id']],function(_0x2af021){return{'id':_0x2af021['id'],'fullname':_0x2af021[_0x7cca('0x32')]};});}}catch(_0x181497){_0xcb4422(_0x181497);}_0x170e62(_0x51ec60);});}function getInteractionTags(_0x24b606,_0x3c6c96){return new BPromise(function(_0x3330b4,_0x34c0dc){try{if(_0x24b606[_0x7cca('0x33')]){_0x24b606[_0x7cca('0x34')]=[];_0x24b606[_0x7cca('0x33')][_0x7cca('0x35')](',')[_0x7cca('0x36')](function(_0x228c2f){_0x24b606['Tags'][_0x7cca('0x37')](_0x3c6c96[_0x228c2f]);});}delete _0x24b606[_0x7cca('0x33')];}catch(_0x22dbbd){_0x34c0dc(_0x22dbbd);}_0x3330b4(_0x24b606);});}function updateOpenchannelInteraction(_0x16af60,_0x5ae13d,_0x41e9c7){return new BPromise(function(_0x9cdb55,_0x5a8e1e){return getInteractionUsers(_0x16af60,_0x41e9c7)[_0x7cca('0x2d')](function(_0x5a7a59){return getInteractionTags(_0x5a7a59,_0x5ae13d);})[_0x7cca('0x2d')](function(_0x9d06ec){_0x9cdb55(_0x9d06ec);})[_0x7cca('0x38')](function(_0x416553){_0x5a8e1e(_0x416553);});});}exports[_0x7cca('0x39')]=function(_0x3fe17c,_0x4c164f){var _0x23ffdf={},_0x9289c2={},_0x159f3a={'count':0x0,'rows':[]};var _0x4f0da1=_[_0x7cca('0x31')](db[_0x7cca('0x3a')][_0x7cca('0x3b')],function(_0xafb3b0){return{'name':_0xafb3b0[_0x7cca('0x3c')],'type':_0xafb3b0[_0x7cca('0x3d')][_0x7cca('0x3e')]};});_0x9289c2['model']=_[_0x7cca('0x31')](_0x4f0da1,_0x7cca('0x3f'));_0x9289c2['query']=_[_0x7cca('0x40')](_0x3fe17c[_0x7cca('0x41')]);_0x9289c2[_0x7cca('0x42')]=_['intersection'](_0x9289c2['model'],_0x9289c2[_0x7cca('0x41')]);_0x23ffdf[_0x7cca('0x43')]=_[_0x7cca('0x44')](_0x9289c2[_0x7cca('0x45')],qs[_0x7cca('0x46')](_0x3fe17c[_0x7cca('0x41')]['fields']));_0x23ffdf[_0x7cca('0x43')]=_0x23ffdf[_0x7cca('0x43')][_0x7cca('0x47')]?_0x23ffdf['attributes']:_0x9289c2[_0x7cca('0x45')];if(!_0x3fe17c['query'][_0x7cca('0x48')](_0x7cca('0x49'))){_0x23ffdf['limit']=qs[_0x7cca('0x25')](_0x3fe17c['query'][_0x7cca('0x25')]);_0x23ffdf[_0x7cca('0x24')]=qs[_0x7cca('0x24')](_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x24')]);}_0x23ffdf[_0x7cca('0x4a')]=qs[_0x7cca('0x4b')](_0x3fe17c['query']['sort']);_0x23ffdf[_0x7cca('0x4c')]=qs[_0x7cca('0x42')](_[_0x7cca('0x4d')](_0x3fe17c[_0x7cca('0x41')],_0x9289c2['filters']),_0x4f0da1);var _0x47cb57=[];var _0x4ea2d9=squel[_0x7cca('0x4e')]()[_0x7cca('0x4f')]('id')[_0x7cca('0x4f')](_0x7cca('0x3f'))['field']('color')[_0x7cca('0x50')](_0x7cca('0x51'));var _0x4b0d5d=squel[_0x7cca('0x4e')]()[_0x7cca('0x4f')](_0x7cca('0x52'))[_0x7cca('0x4f')](_0x7cca('0x53'))[_0x7cca('0x4f')](_0x7cca('0x54'))[_0x7cca('0x50')]('user_has_openchannel_interactions','ui')[_0x7cca('0x55')](_0x7cca('0x56'),'u',_0x7cca('0x57'));var _0x18fae1=squel[_0x7cca('0x4e')]()[_0x7cca('0x50')](_0x7cca('0x58'),'i')[_0x7cca('0x55')](_0x7cca('0x59'),'c',_0x7cca('0x5a'))['left_join'](_0x7cca('0x56'),'o',_0x7cca('0x5b'))[_0x7cca('0x55')]('openchannel_accounts','a',_0x7cca('0x5c'))[_0x7cca('0x55')](_0x7cca('0x5d'),'me',_0x7cca('0x5e'))['left_join']('openchannel_interaction_has_tags','it',_0x7cca('0x5f'))[_0x7cca('0x55')](_0x7cca('0x51'),'t','t.id\x20=\x20it.TagId');var _0x41811f=squel[_0x7cca('0x60')]();var _0x40b158=[];var _0x37fa40=squel[_0x7cca('0x60')]();var _0x3bfe31;if(_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x61')]){_0x3bfe31=as['parseSearch'](_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x61')]);var _0x6c1394=_0x3bfe31[_0x7cca('0x62')];for(var _0x277249=0x0;_0x277249<_0x3bfe31['conditions'][_0x7cca('0x47')];_0x277249++){var _0x39860d=_0x3bfe31['conditions'][_0x277249];var _0x28a3d1='i';var _0x4784ed=_[_0x7cca('0x63')](_0x4f0da1,[_0x7cca('0x3f'),_0x39860d[_0x7cca('0x4f')]]);if(!_0x4784ed){switch(_0x39860d[_0x7cca('0x4f')]){case _0x7cca('0x64'):if(_0x39860d[_0x7cca('0x65')]==0x1){_0x18fae1[_0x7cca('0x66')]('`'+_0x39860d[_0x7cca('0x4f')]+_0x7cca('0x67'));}else{_0x18fae1[_0x7cca('0x66')]('`'+_0x39860d['field']+'`\x20>\x200');}break;case _0x7cca('0x68'):if(_0x39860d['operator']===_0x7cca('0x69')){if(_0x39860d['value'][_0x7cca('0x35')]('\x20')['length']>0x1){_0x41811f[_0x6c1394](_0x7cca('0x6a'),qs[_0x7cca('0x6b')](_0x39860d[_0x7cca('0x65')]),null);}else{var _0x1db0ca='%'+_0x39860d[_0x7cca('0x65')]+'%';_0x41811f[_0x6c1394](_0x7cca('0x6c'),_0x1db0ca,_0x1db0ca,_0x1db0ca);}}else{_0x4784ed=_[_0x7cca('0x63')](_0x4f0da1,[_0x7cca('0x3f'),_0x7cca('0x6d')]);_0x39860d[_0x7cca('0x4f')]=_0x7cca('0x6d');_0x1e9480=as['buildExpression'](_0x28a3d1,_0x4784ed[_0x7cca('0x3d')],_0x39860d);_0x41811f[_0x6c1394](_0x1e9480[_0x7cca('0x6e')],_0x1e9480[_0x7cca('0x65')]['start'],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x21')]);}break;case _0x7cca('0x6f'):var _0x2d441f=_0x39860d[_0x7cca('0x65')]['split'](',')[_0x7cca('0x31')](function(_0x5d57ab){return Number(_0x5d57ab);});_0x2d441f[_0x7cca('0x36')](function(_0x280c3f){_0x37fa40['or'](_0x7cca('0x70'),'%,'+_0x280c3f+',%');});_0x40b158=_[_0x7cca('0x71')](_0x40b158,_0x2d441f);break;case _0x7cca('0x72'):if(_0x39860d[_0x7cca('0x73')]===_0x7cca('0x69')){_0x41811f[_0x6c1394]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x39860d[_0x7cca('0x65')]+'%',null);}else{_0x4784ed=_[_0x7cca('0x63')](_0x4f0da1,[_0x7cca('0x3f'),_0x7cca('0x74')]);_0x39860d['field']=_0x7cca('0x74');_0x1e9480=as[_0x7cca('0x75')](_0x28a3d1,_0x4784ed[_0x7cca('0x3d')],_0x39860d);_0x41811f[_0x6c1394](_0x1e9480[_0x7cca('0x6e')],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x76')],_0x1e9480['value'][_0x7cca('0x21')]);}break;case'body':_0x1e9480=as[_0x7cca('0x75')]('me',null,_0x39860d);_0x41811f[_0x6c1394](_0x1e9480['text'],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x76')],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x21')]);break;}}else{var _0x1e9480=as[_0x7cca('0x75')](_0x28a3d1,_0x4784ed[_0x7cca('0x3d')],_0x39860d);_0x41811f[_0x6c1394](_0x1e9480[_0x7cca('0x6e')],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x76')],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x21')]);}}}else{var _0x15dc7c=_(_0x3fe17c[_0x7cca('0x41')])[_0x7cca('0x40')]()[_0x7cca('0x31')](function(_0x470ce6){return _[_0x7cca('0x77')](_0x4f0da1,[_0x7cca('0x3f'),_0x470ce6])?_0x470ce6:undefined;})[_0x7cca('0x78')]()[_0x7cca('0x65')]();if(!_[_0x7cca('0x79')](_0x15dc7c)){_0x15dc7c[_0x7cca('0x36')](function(_0x5c219d){if(_0x5c219d==='OpenchannelAccountId'){_0x18fae1['where'](_0x7cca('0x7a'),[][_0x7cca('0x7b')](_0x3fe17c[_0x7cca('0x41')][_0x5c219d]));}else if(_0x5c219d===_0x7cca('0x7c')){var _0x469d2b=JSON['parse'](_0x3fe17c['query'][_0x5c219d])['$gte'];var _0x2649a0=JSON[_0x7cca('0x7d')](_0x3fe17c[_0x7cca('0x41')][_0x5c219d])[_0x7cca('0x7e')];_0x18fae1[_0x7cca('0x4c')](_0x7cca('0x7f'),_0x469d2b,_0x2649a0);}else{if(_0x3fe17c[_0x7cca('0x41')][_0x5c219d]===_0x7cca('0x80')){_0x18fae1[_0x7cca('0x4c')]('i.'+_0x5c219d+_0x7cca('0x81'));}else{_0x18fae1[_0x7cca('0x4c')]('i.'+_0x5c219d+_0x7cca('0x82'),_0x3fe17c[_0x7cca('0x41')][_0x5c219d]);}}});}if(_0x3fe17c['query'][_0x7cca('0x83')]){if(_0x3fe17c['query'][_0x7cca('0x83')]==0x1){_0x18fae1['having'](_0x7cca('0x84'));}else{_0x18fae1[_0x7cca('0x66')](_0x7cca('0x85'));}}if(_0x3fe17c[_0x7cca('0x41')]['tag']){_0x40b158=_[_0x7cca('0x86')](_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x87')])?_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x87')]:new Array(_0x3fe17c['query'][_0x7cca('0x87')]);_0x40b158['forEach'](function(_0x57a0e4){_0x37fa40['or'](_0x7cca('0x70'),'%,'+_0x57a0e4+',%');});}if(_0x3fe17c[_0x7cca('0x41')]['filter']){var _0x2d2dee=_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x88')][_0x7cca('0x89')]('\x5c','\x5c\x5c')[_0x7cca('0x89')](/'/g,'\x27\x27');if(qs[_0x7cca('0x8a')](_0x2d2dee)){_0x41811f['or']('i.id\x20LIKE\x20?',_0x2d2dee+'%');}else{_0x41811f['or'](_0x7cca('0x8b'),qs['getFullTextValue'](_0x2d2dee))['or'](_0x7cca('0x8c'),_0x2d2dee+'%')['or'](_0x7cca('0x8d'),_0x2d2dee+'%');}}}_0x18fae1[_0x7cca('0x4c')](_0x41811f);_0x18fae1[_0x7cca('0x8e')](_0x7cca('0x8f'));var _0x2d1005={'type':db[_0x7cca('0x90')]['QueryTypes']['SELECT'],'raw':!![]};var _0xdf4125=_0x18fae1[_0x7cca('0x91')]();_0xdf4125[_0x7cca('0x4f')](_0x7cca('0x8f'));_0xdf4125[_0x7cca('0x4f')](_0x7cca('0x92'),'unreadMessages');if(_0x23ffdf[_0x7cca('0x4a')]){_0x23ffdf[_0x7cca('0x4a')][_0x7cca('0x36')](function(_0x6aa7aa){var _0x1cb16c=_0x6aa7aa[0x0]===_0x7cca('0x93')?_0x6aa7aa[0x0]:'i.'+_0x6aa7aa[0x0];_0x18fae1[_0x7cca('0x4a')](_0x1cb16c,_0x6aa7aa[0x1]===_0x7cca('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x40b158)){_0x18fae1['having'](_0x37fa40);_0xdf4125[_0x7cca('0x4c')](_0x7cca('0x95'),_0x40b158);}BPromise[_0x7cca('0x96')]()[_0x7cca('0x2d')](function(){if(!_0x3bfe31){if(_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x97')])return;_0xdf4125[_0x7cca('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x18fae1[_0x7cca('0x4c')](_0x7cca('0x98'));return;}if(_0x3fe17c['user']['role']!==_0x7cca('0x99'))return;return _0x3fe17c[_0x7cca('0x9a')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x234a16){if(_[_0x7cca('0x79')](_0x234a16)){_0xdf4125['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x18fae1['where'](_0x7cca('0x9b'));}else{_0xdf4125[_0x7cca('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x7cca('0x31')](_0x234a16,'id'));_0x18fae1[_0x7cca('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x7cca('0x31')](_0x234a16,'id'));}});})[_0x7cca('0x2d')](function(){if(_0x3fe17c[_0x7cca('0x9a')]['role']==='agent'&&!_0x3bfe31&&!_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x97')])return[];return db[_0x7cca('0x9c')][_0x7cca('0x41')](_0xdf4125['toString'](),_0x2d1005);})[_0x7cca('0x2d')](function(_0x1ca413){_0x159f3a[_0x7cca('0x27')]=_0x1ca413[_0x7cca('0x47')];if(_0x159f3a[_0x7cca('0x27')]===0x0)return[];return db[_0x7cca('0x9c')][_0x7cca('0x41')](_0x4ea2d9['toString'](),_0x2d1005)['then'](function(_0x29e029){_0x47cb57=_[_0x7cca('0x9d')](_0x29e029,'id');_0x2d1005=_[_0x7cca('0x9e')](_0x2d1005,{'model':db[_0x7cca('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x46')]){_0x23ffdf[_0x7cca('0x43')][_0x7cca('0x36')](function(_0x368340){_0x18fae1['field']('i.'+_0x368340);});}else{_0x18fae1['field'](_0x7cca('0x92'),_0x7cca('0x64'));_0x18fae1[_0x7cca('0x4f')]('a.key',_0x7cca('0x9f'));_0x18fae1['field']('a.mandatoryDisposition',_0x7cca('0xa0'));_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa1'),'contactName');_0x18fae1[_0x7cca('0x4f')]('i.*');_0x18fae1[_0x7cca('0x4f')]('c.firstName',_0x7cca('0xa2'));_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa3'),_0x7cca('0xa4'));_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa5'),'Contact.email');_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa6'),_0x7cca('0xa7'));_0x18fae1[_0x7cca('0x4f')]('c.mobile',_0x7cca('0xa8'));_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa9'),_0x7cca('0xaa'));_0x18fae1['field']('o.fullname',_0x7cca('0xab'));_0x18fae1['field'](_0x7cca('0xac'),'Owner.internal');_0x18fae1[_0x7cca('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x23ffdf[_0x7cca('0x25')])_0x18fae1[_0x7cca('0x25')](_0x23ffdf['limit']);if(_0x23ffdf[_0x7cca('0x24')])_0x18fae1['offset'](_0x23ffdf[_0x7cca('0x24')]);return db[_0x7cca('0x9c')][_0x7cca('0x41')](_0x18fae1[_0x7cca('0xad')](),_0x2d1005);})[_0x7cca('0x2d')](function(_0x7028ac){if(_0x7028ac['length']>0x0)_0x4b0d5d[_0x7cca('0x4c')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x7028ac,'id'));return db['sequelize']['query'](_0x4b0d5d[_0x7cca('0xad')](),_0x2d1005)[_0x7cca('0x2d')](function(_0x1ed57f){var _0xa0e66b=_[_0x7cca('0xae')](_0x1ed57f,_0x7cca('0xaf'));var _0x1add00=[];_0x7028ac[_0x7cca('0x36')](function(_0x5a94cd){_0x1add00[_0x7cca('0x37')](updateOpenchannelInteraction(_0x5a94cd,_0x47cb57,_0xa0e66b));});return BPromise['all'](_0x1add00);});});})[_0x7cca('0x2d')](function(_0x141e53){_0x159f3a[_0x7cca('0xb0')]=_0x141e53;return _0x159f3a;})[_0x7cca('0x2d')](respondWithFilteredResult(_0x4c164f,_0x23ffdf))[_0x7cca('0x38')](handleError(_0x4c164f,null));};exports[_0x7cca('0xb1')]=function(_0x188fa9,_0x3d8fbf){var _0x2147a8={};if(_0x188fa9[_0x7cca('0x41')][_0x7cca('0x3d')]&&_0x188fa9['query']['type']===_0x7cca('0x50')){_0x2147a8[_0x7cca('0x50')]=_0x188fa9[_0x7cca('0xb2')]['id'];}else{_0x2147a8['id']=_0x188fa9[_0x7cca('0xb2')]['id'];}var _0x47f721={'raw':![],'where':_0x2147a8},_0x1b90e6={};_0x1b90e6[_0x7cca('0x45')]=_[_0x7cca('0x40')](db[_0x7cca('0x3a')][_0x7cca('0x3b')]);_0x1b90e6[_0x7cca('0x41')]=_['keys'](_0x188fa9[_0x7cca('0x41')]);_0x1b90e6[_0x7cca('0x42')]=_[_0x7cca('0x44')](_0x1b90e6[_0x7cca('0x45')],_0x1b90e6[_0x7cca('0x41')]);_0x47f721['attributes']=_[_0x7cca('0x44')](_0x1b90e6[_0x7cca('0x45')],qs[_0x7cca('0x46')](_0x188fa9['query'][_0x7cca('0x46')]));_0x47f721[_0x7cca('0x43')]=_0x47f721[_0x7cca('0x43')][_0x7cca('0x47')]?_0x47f721['attributes']:_0x1b90e6[_0x7cca('0x45')];if(_0x188fa9['query'][_0x7cca('0xb3')]){_0x47f721['include']=[{'all':!![]}];}_0x47f721=_[_0x7cca('0x9e')]({},_0x47f721,_0x188fa9[_0x7cca('0xb4')]);return db[_0x7cca('0x3a')]['find'](_0x47f721)[_0x7cca('0x2d')](handleEntityNotFound(_0x3d8fbf,null))[_0x7cca('0x2d')](respondWithResult(_0x3d8fbf,null))[_0x7cca('0x38')](handleError(_0x3d8fbf,null));};exports[_0x7cca('0xb5')]=function(_0x3a5ed8,_0x7a8d41){return db[_0x7cca('0x3a')]['create'](_0x3a5ed8[_0x7cca('0xb6')],{})[_0x7cca('0x2d')](respondWithResult(_0x7a8d41,0xc9))[_0x7cca('0x38')](handleError(_0x7a8d41,null));};exports[_0x7cca('0x2c')]=function(_0x1690ea,_0xc1dec0){if(_0x1690ea[_0x7cca('0xb6')]['id']){delete _0x1690ea[_0x7cca('0xb6')]['id'];}return db[_0x7cca('0x3a')]['find']({'where':{'id':_0x1690ea[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0xc1dec0,null))['then'](saveUpdates(_0x1690ea[_0x7cca('0xb6')],null))['then'](respondWithResult(_0xc1dec0,null))['catch'](handleError(_0xc1dec0,null));};exports['destroy']=function(_0x2f72dd,_0x311879){return db[_0x7cca('0x3a')][_0x7cca('0x63')]({'where':{'id':_0x2f72dd['params']['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x311879,null))[_0x7cca('0x2d')](removeEntity(_0x311879,null))[_0x7cca('0x38')](handleError(_0x311879,null));};exports[_0x7cca('0xb7')]=function(_0x233606,_0x315e0e){return db[_0x7cca('0x3a')]['describe']()[_0x7cca('0x2d')](respondWithResult(_0x315e0e,null))[_0x7cca('0x38')](handleError(_0x315e0e,null));};exports[_0x7cca('0xb8')]=function(_0x1137f9,_0x422c54,_0x1d5cf1){return db[_0x7cca('0xb9')][_0x7cca('0x63')]({'where':{'id':_0x1137f9[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x422c54,null))[_0x7cca('0x2d')](function(_0x28b55c){if(_0x28b55c){return _0x28b55c[_0x7cca('0xb8')](_0x1137f9[_0x7cca('0xb6')][_0x7cca('0xba')],_[_0x7cca('0xbb')](_0x1137f9['body'],[_0x7cca('0xba'),'id'])||{});}})[_0x7cca('0x2d')](respondWithResult(_0x422c54,null))[_0x7cca('0x38')](handleError(_0x422c54,null));};exports[_0x7cca('0xbc')]=function(_0x4e3d27,_0x54f878,_0x47536d){var _0x1c5066={'raw':![],'where':{}};var _0x158caa={};var _0x1c6d6a={'count':0x0,'rows':[]};return db[_0x7cca('0x3a')]['findOne']({'where':{'id':_0x4e3d27[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x54f878,null))[_0x7cca('0x2d')](function(_0x120c38){if(_0x120c38){_0x158caa[_0x7cca('0x45')]=_[_0x7cca('0x40')](db[_0x7cca('0xb9')][_0x7cca('0x3b')]);_0x158caa[_0x7cca('0x41')]=_['keys'](_0x4e3d27[_0x7cca('0x41')]);_0x158caa[_0x7cca('0x42')]=_[_0x7cca('0x44')](_0x158caa['model'],_0x158caa[_0x7cca('0x41')]);_0x1c5066[_0x7cca('0x43')]=_[_0x7cca('0x44')](_0x158caa[_0x7cca('0x45')],qs['fields'](_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x46')]));_0x1c5066[_0x7cca('0x43')]=_0x1c5066[_0x7cca('0x43')][_0x7cca('0x47')]?_0x1c5066[_0x7cca('0x43')]:_0x158caa[_0x7cca('0x45')];if(!_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x48')](_0x7cca('0x49'))){_0x1c5066[_0x7cca('0x25')]=qs['limit'](_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x25')]);_0x1c5066[_0x7cca('0x24')]=qs[_0x7cca('0x24')](_0x4e3d27['query'][_0x7cca('0x24')]);}_0x1c5066['order']=qs[_0x7cca('0x4b')](_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x4b')]);_0x1c5066['where']=qs[_0x7cca('0x42')](_[_0x7cca('0x4d')](_0x4e3d27[_0x7cca('0x41')],_0x158caa[_0x7cca('0x42')]));_0x1c5066[_0x7cca('0x4c')]['OpenchannelInteractionId']=_0x120c38['id'];if(_0x4e3d27[_0x7cca('0x41')]['filter']){_0x1c5066[_0x7cca('0x4c')]=_[_0x7cca('0x9e')](_0x1c5066[_0x7cca('0x4c')],{'$or':_['map'](_0x1c5066[_0x7cca('0x43')],function(_0x37bc73){var _0x1f14e2={};_0x1f14e2[_0x37bc73]={'$like':'%'+_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x88')]+'%'};return _0x1f14e2;})});}if(_0x4e3d27[_0x7cca('0x41')][_0x7cca('0xbd')]){var _0x3e8831=_0x4e3d27[_0x7cca('0x41')][_0x7cca('0xbd')][_0x7cca('0x35')](',');var _0x4c7692={};_0x4c7692[_0x3e8831[0x0]]={'$gte':moment(_0x3e8831[0x1])[_0x7cca('0xbe')](_0x7cca('0xbf'))};_0x1c5066[_0x7cca('0x4c')]=_['merge'](_0x1c5066[_0x7cca('0x4c')],_0x4c7692);}_0x1c5066=_['merge']({},_0x1c5066,_0x4e3d27['options']);return db[_0x7cca('0xb9')][_0x7cca('0x27')]({'where':_0x1c5066['where']})[_0x7cca('0x2d')](function(_0x184a75){_0x1c6d6a[_0x7cca('0x27')]=_0x184a75;if(_0x4e3d27['query'][_0x7cca('0xb3')]){_0x1c5066[_0x7cca('0xc0')]=[{'all':!![]}];}return db[_0x7cca('0xb9')][_0x7cca('0xc1')](_0x1c5066);})['then'](function(_0x5d9716){_0x1c6d6a[_0x7cca('0xb0')]=_0x5d9716;return _0x1c6d6a;});}})[_0x7cca('0x2d')](respondWithFilteredResult(_0x54f878,_0x1c5066))[_0x7cca('0x38')](handleError(_0x54f878,null));};exports[_0x7cca('0xc2')]=function(_0x23886a,_0x2fb14d,_0x405feb){return db[_0x7cca('0x3a')][_0x7cca('0x63')]({'where':{'id':_0x23886a[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x2fb14d,null))[_0x7cca('0x2d')](function(_0x2b5f4d){if(_0x2b5f4d){return _0x2b5f4d['setTags'](_0x23886a['body'][_0x7cca('0xba')],_[_0x7cca('0xbb')](_0x23886a['body'],[_0x7cca('0xba'),'id'])||{})[_0x7cca('0xc3')](function(){return db[_0x7cca('0x6f')][_0x7cca('0xc1')]({'attributes':['id',_0x7cca('0x3f'),_0x7cca('0xc4')],'where':{'id':_0x23886a[_0x7cca('0xb6')]['ids']}});})[_0x7cca('0x2d')](function(_0x1a6f70){socket[_0x7cca('0xc5')](_0x7cca('0xc6'),{'id':Number(_0x23886a['params']['id']),'tags':_0x1a6f70||[]});return{'id':Number(_0x23886a[_0x7cca('0xb2')]['id']),'tags':_0x1a6f70||[]};});}})[_0x7cca('0x2d')](respondWithResult(_0x2fb14d,null))[_0x7cca('0x38')](handleError(_0x2fb14d,null));};exports[_0x7cca('0xc7')]=function(_0x2d9dc6,_0x29286f,_0x49026d){return db[_0x7cca('0x3a')]['find']({'where':{'id':_0x2d9dc6[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x29286f,null))[_0x7cca('0x2d')](function(_0x3e7b95){if(_0x3e7b95){return _0x3e7b95[_0x7cca('0xc7')](_0x2d9dc6[_0x7cca('0x41')][_0x7cca('0xba')]);}})['then'](respondWithStatusCode(_0x29286f,null))['catch'](handleError(_0x29286f,null));};exports[_0x7cca('0xc8')]=function(_0x1d72c8,_0x33a427){var _0x359cf3=moment()['unix']()[_0x7cca('0xad')]();var _0x3d9479=path[_0x7cca('0xc9')](config[_0x7cca('0xca')],_0x7cca('0xcb'),_0x7cca('0xcc'),_0x7cca('0xcd'));var _0x117c5d=path[_0x7cca('0xc9')](config[_0x7cca('0xca')],'server',_0x7cca('0xcc'),_0x7cca('0xce'));var _0x4c046b=path[_0x7cca('0xc9')](_0x3d9479,_0x359cf3);var _0x5ea919=util['format'](_0x7cca('0xcf'),_0x1d72c8[_0x7cca('0xb2')]['id'],_0x359cf3);var _0x2b365d=path[_0x7cca('0xc9')](_0x3d9479,_0x5ea919);var _0x114d0e=[];_0x114d0e[_0x7cca('0x37')]({'model':db[_0x7cca('0x72')],'as':_0x7cca('0x72'),'attributes':['id',_0x7cca('0x32')],'raw':!![]});_0x114d0e['push']({'model':db[_0x7cca('0xd0')],'as':'Contact','attributes':['id',_0x7cca('0xd1'),_0x7cca('0xd2')],'raw':!![]});if(_0x1d72c8[_0x7cca('0x41')][_0x7cca('0xce')]){_0x114d0e['push']({'model':db[_0x7cca('0xd3')],'as':_0x7cca('0xd3'),'raw':!![]});}var _0x23ecd9=[{'model':db['OpenchannelMessage'],'as':_0x7cca('0xd4'),'attributes':['id',_0x7cca('0xb6'),_0x7cca('0x7c'),_0x7cca('0xd5'),'secret',_0x7cca('0x83')],'include':_0x114d0e}];_0x23ecd9[_0x7cca('0x37')]({'model':db[_0x7cca('0xd6')],'as':_0x7cca('0xd7'),'attributes':['id',_0x7cca('0x3f')]});_0x23ecd9['push']({'model':db[_0x7cca('0x72')],'as':_0x7cca('0xd8'),'attributes':['id',_0x7cca('0x32')]});return db['OpenchannelInteraction'][_0x7cca('0x63')]({'where':{'id':_0x1d72c8[_0x7cca('0xb2')]['id']},'include':_0x23ecd9})[_0x7cca('0x2d')](handleEntityNotFound(_0x33a427,null))[_0x7cca('0x2d')](function(_0x306780){if(_0x306780){var _0x595404=_0x306780['get']({'plain':!![]});fs[_0x7cca('0xd9')](_0x4c046b);var _0x3fa53a={'channel':_0x7cca('0xda'),'account':_0x595404[_0x7cca('0xd7')][_0x7cca('0x3f')],'agent':_0x595404[_0x7cca('0xd8')]?_0x595404[_0x7cca('0xd8')][_0x7cca('0x32')]:_0x7cca('0xdb'),'createdAt':moment(_0x595404[_0x7cca('0x7c')])[_0x7cca('0xbe')](_0x7cca('0xbf'))[_0x7cca('0xad')](),'closedAt':_0x595404['closed']?moment(_0x595404[_0x7cca('0xdc')])['format'](_0x7cca('0xbf'))[_0x7cca('0xad')]():'','disposition':_0x595404['disposition'],'visibility':_0x595404['threadId']?'Public':_0x7cca('0xdd'),'messages':_(_0x595404[_0x7cca('0xd4')])[_0x7cca('0x88')]({'secret':![]})['map'](function(_0x565515){if(_0x565515['Attachment']){var _0x350fa1=path[_0x7cca('0xc9')](_0x117c5d,_0x565515[_0x7cca('0xd3')][_0x7cca('0xde')]);if(fs[_0x7cca('0xdf')](_0x350fa1)){fs[_0x7cca('0xe0')](_0x350fa1)[_0x7cca('0xe1')](fs['createWriteStream'](path['join'](_0x4c046b,_0x565515[_0x7cca('0xd3')][_0x7cca('0xde')])));}}return{'date':moment(_0x565515[_0x7cca('0x7c')])[_0x7cca('0xbe')](_0x7cca('0xbf'))[_0x7cca('0xad')](),'sender':_0x565515['direction']===_0x7cca('0xe2')?_0x565515['User']?_0x565515[_0x7cca('0x72')][_0x7cca('0x32')]:_0x7cca('0xe3'):_0x565515[_0x7cca('0x68')][_0x7cca('0xd1')]+(_0x565515['Contact'][_0x7cca('0xd2')]?'\x20'+_0x565515['Contact'][_0x7cca('0xd2')]:''),'body':_0x565515[_0x7cca('0xd3')]?_0x565515[_0x7cca('0xd3')][_0x7cca('0xde')]:_0x565515['body'],'direction':_0x565515[_0x7cca('0xd5')]===_0x7cca('0xe2')?'A':'C','secret':_0x565515['secret'],'read':_0x565515[_0x7cca('0x83')],'attachment':_0x565515[_0x7cca('0xd3')]};})[_0x7cca('0x65')]()};return ejs[_0x7cca('0xe4')](path[_0x7cca('0xc9')](config[_0x7cca('0xca')],_0x7cca('0xcb'),'views',_0x7cca('0xe5')),{'interaction':_0x3fa53a})[_0x7cca('0x2d')](function(_0x45416f){var _0x495b0a=path[_0x7cca('0xc9')](_0x4c046b,_0x7cca('0xe6')+_0x595404['id']+'-'+_0x359cf3+_0x7cca('0xe7'));var _0x520326={'path':_0x495b0a,'channel':_0x7cca('0xda'),'interactionId':_0x595404['id']};return pdf[_0x7cca('0xe8')](_0x45416f,_0x520326);})[_0x7cca('0x2d')](function(){return new BPromise(function(_0x2936a1,_0x2ab977){zipdir(_0x4c046b,{'saveTo':_0x2b365d},function(_0xe8d2f8,_0x56f222){if(_0xe8d2f8)return _0x2ab977(_0xe8d2f8);return _0x2936a1(_0x56f222);});})[_0x7cca('0x2d')](function(){return new BPromise(function(_0x4692d2,_0x5b55fc){rimraf(_0x4c046b,function(_0x3592c8){if(_0x3592c8)_0x5b55fc(_0x3592c8);return _0x4692d2();});});})['then'](function(){return _0x33a427[_0x7cca('0xc8')](_0x2b365d,_0x5ea919,function(_0x30ceaf){if(_0x30ceaf){console[_0x7cca('0xe9')]('err',_0x30ceaf);}else{fs[_0x7cca('0xea')](_0x2b365d);}});});});}else{return _0x33a427[_0x7cca('0xeb')](0xc8);}})['catch'](handleError(_0x33a427,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e7daf7f..f9aadb3 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 _0xbddd=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','events'];(function(_0x24403d,_0x94ebf1){var _0x3fabf3=function(_0x39b1a9){while(--_0x39b1a9){_0x24403d['push'](_0x24403d['shift']());}};_0x3fabf3(++_0x94ebf1);}(_0xbddd,0x19d));var _0xdbdd=function(_0x20fcc3,_0x31dfff){_0x20fcc3=_0x20fcc3-0x0;var _0x482216=_0xbddd[_0x20fcc3];return _0x482216;};'use strict';var EventEmitter=require(_0xdbdd('0x0'));var OpenchannelInteraction=require(_0xdbdd('0x1'))['db'][_0xdbdd('0x2')];var OpenchannelMessage=require(_0xdbdd('0x1'))['db'][_0xdbdd('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdbdd('0x4')](0x0);var events={'afterCreate':_0xdbdd('0x5'),'afterUpdate':_0xdbdd('0x6'),'afterDestroy':_0xdbdd('0x7')};function emitEvent(_0xc2d5){return function(_0x313d7c,_0x44acba,_0x56b362){_0x313d7c[_0xdbdd('0x8')]({'attributes':['id'],'raw':!![]})[_0xdbdd('0x9')](function(_0x89c4da){_0x313d7c[_0xdbdd('0xa')](_0xdbdd('0xb'),_0x89c4da[_0xdbdd('0xc')](function(_0x15db11){return{'id':_0x15db11['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x313d7c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdbdd('0x9')](function(_0x49e790){_0x313d7c['setDataValue'](_0xdbdd('0xd'),_0x49e790[_0xdbdd('0xe')]);OpenchannelInteractionEvents['emit'](_0xc2d5+':'+_0x313d7c['id'],_0x313d7c);OpenchannelInteractionEvents[_0xdbdd('0xf')](_0xc2d5,_0x313d7c);_0x56b362(null);})[_0xdbdd('0x10')](_0x56b362(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xdbdd('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2581=['OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue','findAll','then','unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction'];(function(_0x5e58d6,_0x553e06){var _0x1f571c=function(_0x47c666){while(--_0x47c666){_0x5e58d6['push'](_0x5e58d6['shift']());}};_0x1f571c(++_0x553e06);}(_0x2581,0x9d));var _0x1258=function(_0x385931,_0x431805){_0x385931=_0x385931-0x0;var _0x97058=_0x2581[_0x385931];return _0x97058;};'use strict';var EventEmitter=require(_0x1258('0x0'));var OpenchannelInteraction=require(_0x1258('0x1'))['db'][_0x1258('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x1258('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1258('0x4')](0x0);var events={'afterCreate':_0x1258('0x5'),'afterUpdate':_0x1258('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1c9fe9){return function(_0x25832a,_0x3fe96b,_0x37d739){_0x25832a[_0x1258('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1479fc){_0x25832a[_0x1258('0x8')]('Users',_0x1479fc['map'](function(_0x2b0267){return{'id':_0x2b0267['id']};}));return OpenchannelMessage[_0x1258('0x9')]({'where':{'OpenchannelInteractionId':_0x25832a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1258('0xa')](function(_0x4ee664){_0x25832a[_0x1258('0x8')](_0x1258('0xb'),_0x4ee664[_0x1258('0xc')]);OpenchannelInteractionEvents[_0x1258('0xd')](_0x1c9fe9+':'+_0x25832a['id'],_0x25832a);OpenchannelInteractionEvents[_0x1258('0xd')](_0x1c9fe9,_0x25832a);_0x37d739(null);})[_0x1258('0xe')](_0x37d739(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x1258('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1043023..33ad4c9 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 _0xb271=['closedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x3137f9,_0xf9094d){var _0xebaec5=function(_0x2cd481){while(--_0x2cd481){_0x3137f9['push'](_0x3137f9['shift']());}};_0xebaec5(++_0xf9094d);}(_0xb271,0x145));var _0x1b27=function(_0x41b192,_0x4a4c4f){_0x41b192=_0x41b192-0x0;var _0x3f8763=_0xb271[_0x41b192];return _0x3f8763;};'use strict';var _=require(_0x1b27('0x0'));var util=require('util');var logger=require(_0x1b27('0x1'))(_0x1b27('0x2'));var moment=require(_0x1b27('0x3'));var BPromise=require(_0x1b27('0x4'));var rp=require(_0x1b27('0x5'));var fs=require('fs');var path=require(_0x1b27('0x6'));var rimraf=require(_0x1b27('0x7'));var config=require(_0x1b27('0x8'));var attributes=require(_0x1b27('0x9'));module[_0x1b27('0xa')]=function(_0x5b53e5,_0x42335d){return _0x5b53e5[_0x1b27('0xb')](_0x1b27('0xc'),attributes,{'tableName':_0x1b27('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1b27('0xe'),'collate':_0x1b27('0xf'),'hooks':{'beforeUpdate':function(_0x22a4a1,_0x261c39,_0x54d51e){if(_0x22a4a1[_0x1b27('0x10')]('closed')){_0x22a4a1[_0x1b27('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x54d51e(null,_0x22a4a1);}}});}; \ No newline at end of file +var _0xc59d=['closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x2bdc1f,_0x15a033){var _0x599318=function(_0x4e270f){while(--_0x4e270f){_0x2bdc1f['push'](_0x2bdc1f['shift']());}};_0x599318(++_0x15a033);}(_0xc59d,0x11e));var _0xdc59=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc59d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdc59('0x0'));var util=require(_0xdc59('0x1'));var logger=require(_0xdc59('0x2'))(_0xdc59('0x3'));var moment=require(_0xdc59('0x4'));var BPromise=require(_0xdc59('0x5'));var rp=require(_0xdc59('0x6'));var fs=require('fs');var path=require(_0xdc59('0x7'));var rimraf=require(_0xdc59('0x8'));var config=require(_0xdc59('0x9'));var attributes=require(_0xdc59('0xa'));module[_0xdc59('0xb')]=function(_0x37a266,_0x5337c3){return _0x37a266[_0xdc59('0xc')](_0xdc59('0xd'),attributes,{'tableName':_0xdc59('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdc59('0xf'),'collate':_0xdc59('0x10'),'hooks':{'beforeUpdate':function(_0x3d1615,_0x3c53cc,_0x482299){if(_0x3d1615[_0xdc59('0x11')]('closed')){_0x3d1615[_0xdc59('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x482299(null,_0x3d1615);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1bb83f5..af9148a 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 _0x54f5=['attributes','AddTagsToOpenchannelInteraction','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where'];(function(_0x179b32,_0x428c8b){var _0x37071a=function(_0x3eda23){while(--_0x3eda23){_0x179b32['push'](_0x179b32['shift']());}};_0x37071a(++_0x428c8b);}(_0x54f5,0x154));var _0x554f=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x54f5[_0x25df80];return _0x17b6d0;};'use strict';var _=require(_0x554f('0x0'));var util=require(_0x554f('0x1'));var moment=require('moment');var BPromise=require(_0x554f('0x2'));var rs=require(_0x554f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x554f('0x4'))['db'];var utils=require(_0x554f('0x5'));var logger=require(_0x554f('0x6'))('rpc');var config=require(_0x554f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x554f('0x8')]['http']({'port':0x232a});config[_0x554f('0x9')]=_[_0x554f('0xa')](config[_0x554f('0x9')],{'host':_0x554f('0xb'),'port':0x18eb});var socket=require(_0x554f('0xc'))(new Redis(config[_0x554f('0x9')]));require(_0x554f('0xd'))[_0x554f('0xe')](socket);function respondWithRpcPromise(_0x1eb734,_0x14c5e9,_0x370fdf){return new BPromise(function(_0x1a5b3a,_0x5decd3){return client[_0x554f('0xf')](_0x1eb734,_0x370fdf)[_0x554f('0x10')](function(_0x3b28cf){logger[_0x554f('0x11')](_0x554f('0x12'),_0x14c5e9,_0x554f('0x13'));logger[_0x554f('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x14c5e9,_0x554f('0x13'),JSON[_0x554f('0x15')](_0x3b28cf));if(_0x3b28cf[_0x554f('0x16')]){if(_0x3b28cf[_0x554f('0x16')]['code']===0x1f4){logger[_0x554f('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x14c5e9,_0x3b28cf[_0x554f('0x16')][_0x554f('0x17')]);return _0x5decd3(_0x3b28cf['error'][_0x554f('0x17')]);}logger[_0x554f('0x16')](_0x554f('0x12'),_0x14c5e9,_0x3b28cf[_0x554f('0x16')][_0x554f('0x17')]);return _0x1a5b3a(_0x3b28cf[_0x554f('0x16')][_0x554f('0x17')]);}else{logger[_0x554f('0x11')](_0x554f('0x12'),_0x14c5e9,_0x554f('0x13'));_0x1a5b3a(_0x3b28cf['result']['message']);}})[_0x554f('0x18')](function(_0x9c889b){logger['error'](_0x554f('0x12'),_0x14c5e9,_0x9c889b);_0x5decd3(_0x9c889b);});});}exports[_0x554f('0x19')]=function(_0x21ea01){var _0x5e7f7f=this;return new Promise(function(_0x5111fb,_0x57e521){return db[_0x554f('0x1a')]['update'](_0x21ea01[_0x554f('0x1b')],{'raw':_0x21ea01['options']?_0x21ea01[_0x554f('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ea01['options']?_0x21ea01[_0x554f('0x1c')][_0x554f('0x1d')]||null:null,'attributes':_0x21ea01['options']?_0x21ea01[_0x554f('0x1c')][_0x554f('0x1e')]||null:null,'limit':_0x21ea01[_0x554f('0x1c')]?_0x21ea01[_0x554f('0x1c')]['limit']||null:null})[_0x554f('0x10')](function(_0x3ef831){logger[_0x554f('0x11')](_0x554f('0x19'),_0x21ea01);logger[_0x554f('0x14')]('UpdateOpenchannelInteraction',_0x21ea01,JSON[_0x554f('0x15')](_0x3ef831));_0x5111fb(_0x3ef831);})[_0x554f('0x18')](function(_0x5818d4){logger[_0x554f('0x16')]('UpdateOpenchannelInteraction',_0x5818d4[_0x554f('0x17')],_0x21ea01);_0x57e521(_0x5e7f7f['error'](0x1f4,_0x5818d4[_0x554f('0x17')]));});});};exports[_0x554f('0x1f')]=function(_0x66c0fa){return new Promise(function(_0x5e041f,_0x56a674){return db[_0x554f('0x1a')]['find']({'where':_0x66c0fa[_0x554f('0x1c')]?_0x66c0fa[_0x554f('0x1c')][_0x554f('0x1d')]||null:null})[_0x554f('0x10')](function(_0x3fe8f5){if(_0x3fe8f5){return _0x3fe8f5[_0x554f('0x20')](_0x66c0fa[_0x554f('0x1b')]['ids'],_[_0x554f('0x21')](_0x66c0fa[_0x554f('0x1b')],[_0x554f('0x22'),'id'])||{});}})[_0x554f('0x23')](function(_0x516ac9){logger['info'](_0x554f('0x24'),_0x66c0fa);logger['debug'](_0x554f('0x24'),_0x66c0fa,JSON[_0x554f('0x15')](_0x516ac9));_0x5e041f(_0x516ac9);})[_0x554f('0x18')](function(_0x1eaf96){logger[_0x554f('0x16')]('AddTags',_0x1eaf96[_0x554f('0x17')],_0x66c0fa);_0x56a674(_this['error'](0x1f4,_0x1eaf96[_0x554f('0x17')]));});});}; \ No newline at end of file +var _0x0300=['OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','debug','find','body','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info'];(function(_0x23c0a6,_0x354b7d){var _0x27eaf3=function(_0x31862a){while(--_0x31862a){_0x23c0a6['push'](_0x23c0a6['shift']());}};_0x27eaf3(++_0x354b7d);}(_0x0300,0x107));var _0x0030=function(_0x599a81,_0x4b4ee7){_0x599a81=_0x599a81-0x0;var _0x766623=_0x0300[_0x599a81];return _0x766623;};'use strict';var _=require(_0x0030('0x0'));var util=require(_0x0030('0x1'));var moment=require(_0x0030('0x2'));var BPromise=require(_0x0030('0x3'));var rs=require(_0x0030('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0030('0x5'));var logger=require(_0x0030('0x6'))(_0x0030('0x7'));var config=require('../../config/environment');var jayson=require(_0x0030('0x8'));var client=jayson['client'][_0x0030('0x9')]({'port':0x232a});config[_0x0030('0xa')]=_['defaults'](config['redis'],{'host':_0x0030('0xb'),'port':0x18eb});var socket=require(_0x0030('0xc'))(new Redis(config[_0x0030('0xa')]));require(_0x0030('0xd'))[_0x0030('0xe')](socket);function respondWithRpcPromise(_0x325fde,_0x2af161,_0x38c7e8){return new BPromise(function(_0x559607,_0x268617){return client['request'](_0x325fde,_0x38c7e8)[_0x0030('0xf')](function(_0x33ad47){logger[_0x0030('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2af161,'request\x20sent');logger['debug'](_0x0030('0x11'),_0x2af161,_0x0030('0x12'),JSON[_0x0030('0x13')](_0x33ad47));if(_0x33ad47[_0x0030('0x14')]){if(_0x33ad47[_0x0030('0x14')][_0x0030('0x15')]===0x1f4){logger[_0x0030('0x14')](_0x0030('0x16'),_0x2af161,_0x33ad47[_0x0030('0x14')][_0x0030('0x17')]);return _0x268617(_0x33ad47['error'][_0x0030('0x17')]);}logger[_0x0030('0x14')](_0x0030('0x16'),_0x2af161,_0x33ad47[_0x0030('0x14')]['message']);return _0x559607(_0x33ad47[_0x0030('0x14')][_0x0030('0x17')]);}else{logger[_0x0030('0x10')](_0x0030('0x16'),_0x2af161,'request\x20sent');_0x559607(_0x33ad47[_0x0030('0x18')][_0x0030('0x17')]);}})['catch'](function(_0xf47c8f){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2af161,_0xf47c8f);_0x268617(_0xf47c8f);});});}exports[_0x0030('0x19')]=function(_0x453901){var _0x3e88d5=this;return new Promise(function(_0x562763,_0x3ea46b){return db[_0x0030('0x1a')]['update'](_0x453901['body'],{'raw':_0x453901['options']?_0x453901[_0x0030('0x1b')][_0x0030('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453901[_0x0030('0x1b')]?_0x453901['options'][_0x0030('0x1d')]||null:null,'attributes':_0x453901[_0x0030('0x1b')]?_0x453901[_0x0030('0x1b')][_0x0030('0x1e')]||null:null,'limit':_0x453901[_0x0030('0x1b')]?_0x453901['options'][_0x0030('0x1f')]||null:null})[_0x0030('0xf')](function(_0x2b82a2){logger[_0x0030('0x10')](_0x0030('0x19'),_0x453901);logger[_0x0030('0x20')](_0x0030('0x19'),_0x453901,JSON['stringify'](_0x2b82a2));_0x562763(_0x2b82a2);})['catch'](function(_0x5bd780){logger[_0x0030('0x14')](_0x0030('0x19'),_0x5bd780[_0x0030('0x17')],_0x453901);_0x3ea46b(_0x3e88d5[_0x0030('0x14')](0x1f4,_0x5bd780[_0x0030('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x393a75){return new Promise(function(_0x36d0a9,_0x334902){return db[_0x0030('0x1a')][_0x0030('0x21')]({'where':_0x393a75[_0x0030('0x1b')]?_0x393a75[_0x0030('0x1b')]['where']||null:null})['then'](function(_0x20db97){if(_0x20db97){return _0x20db97['addTags'](_0x393a75[_0x0030('0x22')][_0x0030('0x23')],_[_0x0030('0x24')](_0x393a75[_0x0030('0x22')],[_0x0030('0x23'),'id'])||{});}})[_0x0030('0x25')](function(_0x5eadc5){logger['info'](_0x0030('0x26'),_0x393a75);logger[_0x0030('0x20')]('AddTags',_0x393a75,JSON[_0x0030('0x13')](_0x5eadc5));_0x36d0a9(_0x5eadc5);})[_0x0030('0x27')](function(_0xdb3df6){logger['error'](_0x0030('0x26'),_0xdb3df6[_0x0030('0x17')],_0x393a75);_0x334902(_this[_0x0030('0x14')](0x1f4,_0xdb3df6[_0x0030('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c05c5d2..c6f4517 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 _0x3d0f=['save','remove','emit','removeListener','length','./openchannelInteraction.events'];(function(_0x535c7e,_0x43a005){var _0x567a3a=function(_0xc9215f){while(--_0xc9215f){_0x535c7e['push'](_0x535c7e['shift']());}};_0x567a3a(++_0x43a005);}(_0x3d0f,0xa1));var _0xf3d0=function(_0x448bab,_0x25517b){_0x448bab=_0x448bab-0x0;var _0x5dc534=_0x3d0f[_0x448bab];return _0x5dc534;};'use strict';var OpenchannelInteractionEvents=require(_0xf3d0('0x0'));var events=[_0xf3d0('0x1'),_0xf3d0('0x2'),'update'];function createListener(_0x4f82eb,_0x8df0df){return function(_0x3a860a){_0x8df0df[_0xf3d0('0x3')](_0x4f82eb,_0x3a860a);};}function removeListener(_0x127e45,_0x1d7862){return function(){OpenchannelInteractionEvents[_0xf3d0('0x4')](_0x127e45,_0x1d7862);};}exports['register']=function(_0x168694){for(var _0x56e800=0x0,_0x3d150c=events[_0xf3d0('0x5')];_0x56e800<_0x3d150c;_0x56e800++){var _0x2d2cc1=events[_0x56e800];var _0x41a116=createListener('openchannelInteraction:'+_0x2d2cc1,_0x168694);OpenchannelInteractionEvents['on'](_0x2d2cc1,_0x41a116);}}; \ No newline at end of file +var _0x33b4=['openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener','length'];(function(_0x481691,_0x474008){var _0x5af136=function(_0x44cee3){while(--_0x44cee3){_0x481691['push'](_0x481691['shift']());}};_0x5af136(++_0x474008);}(_0x33b4,0x16d));var _0x433b=function(_0x1785e8,_0x492aac){_0x1785e8=_0x1785e8-0x0;var _0x5e6021=_0x33b4[_0x1785e8];return _0x5e6021;};'use strict';var OpenchannelInteractionEvents=require(_0x433b('0x0'));var events=['save',_0x433b('0x1'),_0x433b('0x2')];function createListener(_0x73ce3d,_0x1c5ee0){return function(_0x268f6e){_0x1c5ee0[_0x433b('0x3')](_0x73ce3d,_0x268f6e);};}function removeListener(_0x508e39,_0x2e8e53){return function(){OpenchannelInteractionEvents[_0x433b('0x4')](_0x508e39,_0x2e8e53);};}exports['register']=function(_0x6cddd4){for(var _0x2919b9=0x0,_0x25c77a=events[_0x433b('0x5')];_0x2919b9<_0x25c77a;_0x2919b9++){var _0x389a44=events[_0x2919b9];var _0x4e5856=createListener(_0x433b('0x6')+_0x389a44,_0x6cddd4);OpenchannelInteractionEvents['on'](_0x389a44,_0x4e5856);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ca0d05f..1fc7253 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0xd548a1,_0x2225e3){var _0x3a85f=function(_0x4a4944){while(--_0x4a4944){_0xd548a1['push'](_0xd548a1['shift']());}};_0x3a85f(++_0x2225e3);}(_0xe706,0xa3));var _0x6e70=function(_0x2f2dd0,_0x242127){_0x2f2dd0=_0x2f2dd0-0x0;var _0x3c48d1=_0xe706[_0x2f2dd0];return _0x3c48d1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x3dab4e,_0x419650){var _0x2a2ec8=function(_0x272dd1){while(--_0x272dd1){_0x3dab4e['push'](_0x3dab4e['shift']());}};_0x2a2ec8(++_0x419650);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index cb49c2b..33459cc 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 _0x657b=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x20c6e3,_0x400b33){var _0x2bc769=function(_0x41fff6){while(--_0x41fff6){_0x20c6e3['push'](_0x20c6e3['shift']());}};_0x2bc769(++_0x400b33);}(_0x657b,0x131));var _0xb657=function(_0x5c7961,_0xd0e981){_0x5c7961=_0x5c7961-0x0;var _0x27f9cc=_0x657b[_0x5c7961];return _0x27f9cc;};'use strict';var Sequelize=require(_0xb657('0x0'));module[_0xb657('0x1')]={'body':{'type':Sequelize[_0xb657('0x2')](_0xb657('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb657('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb657('0x5')]('in',_0xb657('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb657('0x7')]},'providerName':{'type':Sequelize[_0xb657('0x8')]},'providerResponse':{'type':Sequelize[_0xb657('0x2')]}}; \ No newline at end of file +var _0x1bc6=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1bc6,0x94));var _0x61bc=function(_0x2ac69d,_0x42398c){_0x2ac69d=_0x2ac69d-0x0;var _0x2022d0=_0x1bc6[_0x2ac69d];return _0x2022d0;};'use strict';var Sequelize=require(_0x61bc('0x0'));module[_0x61bc('0x1')]={'body':{'type':Sequelize[_0x61bc('0x2')](_0x61bc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x61bc('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x61bc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x61bc('0x5')]('in','out'),'defaultValue':_0x61bc('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x61bc('0x7')]},'providerName':{'type':Sequelize[_0x61bc('0x8')]},'providerResponse':{'type':Sequelize[_0x61bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index ea8f128..4b210c1 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 _0xbf4e=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','filters','filter','where','merge','VIRTUAL','options','OpenchannelMessage','includeAll','findAll','rows','show','params','keys','include','body','find','describe','accept','read','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','channel','motionChannel','event','EventManager','openchannel-interactions','openchannel','role','rejectMessage','Sequelize','email','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xbf4e,0x172));var _0xebf4=function(_0x7d9d28,_0x139d3f){_0x7d9d28=_0x7d9d28-0x0;var _0x9b00b0=_0xbf4e[_0x7d9d28];return _0x9b00b0;};'use strict';var emlformat=require(_0xebf4('0x0'));var rimraf=require(_0xebf4('0x1'));var zipdir=require(_0xebf4('0x2'));var jsonpatch=require(_0xebf4('0x3'));var rp=require(_0xebf4('0x4'));var moment=require(_0xebf4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xebf4('0x6'));var util=require('util');var path=require('path');var sox=require(_0xebf4('0x7'));var csv=require(_0xebf4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xebf4('0x9'));var _=require(_0xebf4('0xa'));var squel=require(_0xebf4('0xb'));var crypto=require('crypto');var jsforce=require(_0xebf4('0xc'));var deskjs=require(_0xebf4('0xd'));var toCsv=require(_0xebf4('0x8'));var querystring=require(_0xebf4('0xe'));var Papa=require(_0xebf4('0xf'));var Redis=require(_0xebf4('0x10'));var authService=require(_0xebf4('0x11'));var qs=require(_0xebf4('0x12'));var as=require(_0xebf4('0x13'));var hardwareService=require(_0xebf4('0x14'));var logger=require(_0xebf4('0x15'))(_0xebf4('0x16'));var utils=require(_0xebf4('0x17'));var config=require(_0xebf4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf4('0x19'))['db'];config[_0xebf4('0x1a')]=_[_0xebf4('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xebf4('0x1c'))(new Redis(config[_0xebf4('0x1a')]));require(_0xebf4('0x1d'))[_0xebf4('0x1e')](socket);var jayson=require(_0xebf4('0x1f'));var client=jayson[_0xebf4('0x20')][_0xebf4('0x21')]({'port':0x232c});var client9002=jayson[_0xebf4('0x20')][_0xebf4('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x313880,_0x14c06d,_0xb5805f,_0x432fd8){return new BPromise(function(_0x2b0259,_0x2205c4){var _0x43cd50=_0x432fd8||client;return _0x43cd50[_0xebf4('0x22')](_0x313880,_0xb5805f)[_0xebf4('0x23')](function(_0x5e1b61){logger['info'](_0xebf4('0x24'),_0x14c06d,_0xebf4('0x25'));logger[_0xebf4('0x26')](_0xebf4('0x27'),_0x14c06d,_0xebf4('0x25'),JSON[_0xebf4('0x28')](_0x5e1b61));if(_0x5e1b61[_0xebf4('0x29')]){if(_0x5e1b61[_0xebf4('0x29')][_0xebf4('0x2a')]===0x1f4){logger['error'](_0xebf4('0x24'),_0x14c06d,_0x5e1b61[_0xebf4('0x29')][_0xebf4('0x2b')]);return _0x2205c4(_0x5e1b61[_0xebf4('0x29')][_0xebf4('0x2b')]);}logger[_0xebf4('0x29')](_0xebf4('0x24'),_0x14c06d,_0x5e1b61['error'][_0xebf4('0x2b')]);return _0x2b0259(_0x5e1b61[_0xebf4('0x29')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x14c06d,'request\x20sent');_0x2b0259(_0x5e1b61[_0xebf4('0x2c')][_0xebf4('0x2b')]);}})[_0xebf4('0x2d')](function(_0x31c070){logger[_0xebf4('0x29')](_0xebf4('0x24'),_0x14c06d,_0x31c070);_0x2205c4(_0x31c070);});});}function respondWithStatusCode(_0x3488e4,_0x11ca94){_0x11ca94=_0x11ca94||0xcc;return function(_0x504349){if(_0x504349){return _0x3488e4[_0xebf4('0x2e')](_0x11ca94);}return _0x3488e4['status'](_0x11ca94)[_0xebf4('0x2f')]();};}function respondWithResult(_0x919571,_0x534272){_0x534272=_0x534272||0xc8;return function(_0x327ea9){if(_0x327ea9){return _0x919571[_0xebf4('0x30')](_0x534272)['json'](_0x327ea9);}};}function respondWithFilteredResult(_0x64293d,_0x484305){return function(_0xd33862){if(_0xd33862){var _0x3632c9=typeof _0x484305['offset']===_0xebf4('0x31')&&typeof _0x484305['limit']==='undefined';var _0x565349=_0xd33862[_0xebf4('0x32')];var _0x329804=_0x3632c9?0x0:_0x484305['offset'];var _0x416b66=_0x3632c9?_0xd33862[_0xebf4('0x32')]:_0x484305['offset']+_0x484305[_0xebf4('0x33')];var _0xdb7921;if(_0x416b66>=_0x565349){_0x416b66=_0x565349;_0xdb7921=0xc8;}else{_0xdb7921=0xce;}_0x64293d[_0xebf4('0x30')](_0xdb7921);return _0x64293d[_0xebf4('0x34')](_0xebf4('0x35'),_0x329804+'-'+_0x416b66+'/'+_0x565349)['json'](_0xd33862);}return null;};}function patchUpdates(_0x1580ea){return function(_0x3ee843){try{jsonpatch[_0xebf4('0x36')](_0x3ee843,_0x1580ea,!![]);}catch(_0x9520a2){return BPromise[_0xebf4('0x37')](_0x9520a2);}return _0x3ee843[_0xebf4('0x38')]();};}function saveUpdates(_0x154e1a,_0x1e253d){return function(_0x55e690){if(_0x55e690){return _0x55e690[_0xebf4('0x39')](_0x154e1a)[_0xebf4('0x23')](function(_0x63a89){return _0x63a89;});}return null;};}function removeEntity(_0x1c0f85,_0x5c0b75){return function(_0x4b2a98){if(_0x4b2a98){return _0x4b2a98[_0xebf4('0x3a')]()[_0xebf4('0x23')](function(){_0x1c0f85[_0xebf4('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e5a2c,_0x34c681){return function(_0xc3d9a6){if(!_0xc3d9a6){_0x5e5a2c['sendStatus'](0x194);}return _0xc3d9a6;};}function handleError(_0x457176,_0x53f150){_0x53f150=_0x53f150||0x1f4;return function(_0x348455){logger[_0xebf4('0x29')](_0x348455[_0xebf4('0x3b')]);if(_0x348455['name']){delete _0x348455[_0xebf4('0x3c')];}_0x457176['status'](_0x53f150)[_0xebf4('0x3d')](_0x348455);};}exports[_0xebf4('0x3e')]=function(_0x3aec22,_0xf6da9a){var _0xb6f4c8={},_0x354ab2={},_0x2e84b5={'count':0x0,'rows':[]};var _0x269afb=_[_0xebf4('0x3f')](db['OpenchannelMessage']['rawAttributes'],function(_0x2afb9c){return{'name':_0x2afb9c[_0xebf4('0x40')],'type':_0x2afb9c[_0xebf4('0x41')]['key']};});_0x354ab2[_0xebf4('0x42')]=_[_0xebf4('0x3f')](_0x269afb,'name');_0x354ab2[_0xebf4('0x43')]=_['keys'](_0x3aec22[_0xebf4('0x43')]);_0x354ab2['filters']=_['intersection'](_0x354ab2['model'],_0x354ab2['query']);_0xb6f4c8['attributes']=_[_0xebf4('0x44')](_0x354ab2['model'],qs[_0xebf4('0x45')](_0x3aec22['query'][_0xebf4('0x45')]));_0xb6f4c8['attributes']=_0xb6f4c8[_0xebf4('0x46')][_0xebf4('0x47')]?_0xb6f4c8['attributes']:_0x354ab2['model'];if(!_0x3aec22[_0xebf4('0x43')][_0xebf4('0x48')]('nolimit')){_0xb6f4c8[_0xebf4('0x33')]=qs[_0xebf4('0x33')](_0x3aec22['query'][_0xebf4('0x33')]);_0xb6f4c8[_0xebf4('0x49')]=qs[_0xebf4('0x49')](_0x3aec22[_0xebf4('0x43')][_0xebf4('0x49')]);}_0xb6f4c8[_0xebf4('0x4a')]=qs[_0xebf4('0x4b')](_0x3aec22[_0xebf4('0x43')][_0xebf4('0x4b')]);_0xb6f4c8['where']=qs[_0xebf4('0x4c')](_['pick'](_0x3aec22[_0xebf4('0x43')],_0x354ab2['filters']),_0x269afb);if(_0x3aec22[_0xebf4('0x43')][_0xebf4('0x4d')]){_0xb6f4c8[_0xebf4('0x4e')]=_[_0xebf4('0x4f')](_0xb6f4c8[_0xebf4('0x4e')],{'$or':_[_0xebf4('0x3f')](_0x269afb,function(_0x68a3a2){if(_0x68a3a2['type']!==_0xebf4('0x50')){var _0x4adf3c={};_0x4adf3c[_0x68a3a2[_0xebf4('0x3c')]]={'$like':'%'+_0x3aec22['query'][_0xebf4('0x4d')]+'%'};return _0x4adf3c;}})});}_0xb6f4c8=_[_0xebf4('0x4f')]({},_0xb6f4c8,_0x3aec22[_0xebf4('0x51')]);var _0x1b1898={'where':_0xb6f4c8[_0xebf4('0x4e')]};return db[_0xebf4('0x52')][_0xebf4('0x32')](_0x1b1898)[_0xebf4('0x23')](function(_0x4a8137){_0x2e84b5[_0xebf4('0x32')]=_0x4a8137;if(_0x3aec22['query'][_0xebf4('0x53')]){_0xb6f4c8['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xebf4('0x54')](_0xb6f4c8);})[_0xebf4('0x23')](function(_0x42c7c4){_0x2e84b5[_0xebf4('0x55')]=_0x42c7c4;return _0x2e84b5;})['then'](respondWithFilteredResult(_0xf6da9a,_0xb6f4c8))[_0xebf4('0x2d')](handleError(_0xf6da9a,null));};exports[_0xebf4('0x56')]=function(_0x5a6483,_0x59689c){var _0x50ac8f={'raw':!![],'where':{'id':_0x5a6483[_0xebf4('0x57')]['id']}},_0x178c8e={};_0x178c8e['model']=_[_0xebf4('0x58')](db['OpenchannelMessage']['rawAttributes']);_0x178c8e[_0xebf4('0x43')]=_[_0xebf4('0x58')](_0x5a6483[_0xebf4('0x43')]);_0x178c8e[_0xebf4('0x4c')]=_[_0xebf4('0x44')](_0x178c8e['model'],_0x178c8e[_0xebf4('0x43')]);_0x50ac8f[_0xebf4('0x46')]=_[_0xebf4('0x44')](_0x178c8e['model'],qs['fields'](_0x5a6483[_0xebf4('0x43')]['fields']));_0x50ac8f['attributes']=_0x50ac8f[_0xebf4('0x46')][_0xebf4('0x47')]?_0x50ac8f[_0xebf4('0x46')]:_0x178c8e[_0xebf4('0x42')];if(_0x5a6483[_0xebf4('0x43')][_0xebf4('0x53')]){_0x50ac8f[_0xebf4('0x59')]=[{'all':!![]}];}_0x50ac8f=_[_0xebf4('0x4f')]({},_0x50ac8f,_0x5a6483[_0xebf4('0x51')]);return db[_0xebf4('0x52')]['find'](_0x50ac8f)[_0xebf4('0x23')](handleEntityNotFound(_0x59689c,null))['then'](respondWithResult(_0x59689c,null))[_0xebf4('0x2d')](handleError(_0x59689c,null));};exports['create']=function(_0x49f9c9,_0x46843a){return db['OpenchannelMessage']['create'](_0x49f9c9['body'],{})['then'](respondWithResult(_0x46843a,0xc9))[_0xebf4('0x2d')](handleError(_0x46843a,null));};exports[_0xebf4('0x39')]=function(_0x36b5a7,_0x4da0da){if(_0x36b5a7[_0xebf4('0x5a')]['id']){delete _0x36b5a7[_0xebf4('0x5a')]['id'];}return db[_0xebf4('0x52')][_0xebf4('0x5b')]({'where':{'id':_0x36b5a7[_0xebf4('0x57')]['id']}})[_0xebf4('0x23')](handleEntityNotFound(_0x4da0da,null))['then'](saveUpdates(_0x36b5a7[_0xebf4('0x5a')],null))[_0xebf4('0x23')](respondWithResult(_0x4da0da,null))[_0xebf4('0x2d')](handleError(_0x4da0da,null));};exports[_0xebf4('0x3a')]=function(_0x21d341,_0x28e90e){return db[_0xebf4('0x52')][_0xebf4('0x5b')]({'where':{'id':_0x21d341['params']['id']}})[_0xebf4('0x23')](handleEntityNotFound(_0x28e90e,null))[_0xebf4('0x23')](removeEntity(_0x28e90e,null))[_0xebf4('0x2d')](handleError(_0x28e90e,null));};exports['describe']=function(_0x180408,_0x18394f){return db[_0xebf4('0x52')][_0xebf4('0x5c')]()['then'](respondWithResult(_0x18394f,null))['catch'](handleError(_0x18394f,null));};var interaction_log=require(_0xebf4('0x15'))('openchannel-interactions');exports[_0xebf4('0x5d')]=function(_0x2bea17,_0x34b405,_0x18f7b4){var _0x2ba5a9={'agent':{},'channel':'openchannel'};if(_0x2bea17['body']['id']){delete _0x2bea17['body']['id'];}_0x2bea17[_0xebf4('0x5a')][_0xebf4('0x5e')]=!![];_0x2bea17[_0xebf4('0x5a')]['readAt']=moment()[_0xebf4('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bea17['body'][_0xebf4('0x60')]=_0x2bea17[_0xebf4('0x5a')]['UserId']||_0x2bea17[_0xebf4('0x61')]['id'];_0x2ba5a9[_0xebf4('0x62')]['id']=_0x2bea17[_0xebf4('0x5a')]['UserId'];return db[_0xebf4('0x52')][_0xebf4('0x5b')]({'where':{'id':_0x2bea17[_0xebf4('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x34b405,null))[_0xebf4('0x23')](saveUpdates(_0x2bea17[_0xebf4('0x5a')],null))['then'](function(_0x2947c1){if(_0x2947c1){_0x2ba5a9[_0xebf4('0x2b')]=_0x2947c1[_0xebf4('0x63')]({'plain':!![]});return db[_0xebf4('0x64')][_0xebf4('0x5b')]({'where':{'id':_0x2947c1[_0xebf4('0x65')]}});}return null;})[_0xebf4('0x23')](handleEntityNotFound(_0x34b405,null))['then'](function(_0x13f3a2){if(_0x13f3a2){return _0x13f3a2[_0xebf4('0x39')]({'UserId':_0x2bea17[_0xebf4('0x5a')][_0xebf4('0x60')],'read1stAt':_[_0xebf4('0x66')](_0x13f3a2[_0xebf4('0x67')])?moment()[_0xebf4('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xebf4('0x23')](function(_0x59063e){if(_0x59063e){_0x2ba5a9[_0xebf4('0x68')]=_0x59063e[_0xebf4('0x63')]({'plain':!![]});interaction_log[_0xebf4('0x69')](_0xebf4('0x6a'),_0x2bea17[_0xebf4('0x61')]['id'],_0x2bea17['user']['name'],_0x2bea17[_0xebf4('0x61')]['role'],_0x2ba5a9[_0xebf4('0x68')]['id'],_0x2bea17['body']?JSON[_0xebf4('0x28')](_0x2bea17[_0xebf4('0x5a')]):_0xebf4('0x6b'));return respondWithRpcPromise(_0xebf4('0x6c'),_0xebf4('0x6d'),_0x2ba5a9);}return null;})['then'](function(_0x1e42b5){var _0x5e2ea7=_0xebf4('0x6e')+_0x1e42b5['message'][_0xebf4('0x6f')];return db[_0xebf4('0x70')][_0xebf4('0x43')](_0x5e2ea7,{'type':db['Sequelize'][_0xebf4('0x71')][_0xebf4('0x72')],'raw':!![]})[_0xebf4('0x23')](function(_0x9f290a){return _0x9f290a;});})[_0xebf4('0x23')](function(_0x3f8c09){if(_0x3f8c09){_0x2ba5a9['message'][_0xebf4('0x73')]=_0x3f8c09[0x0];if(!_0x2bea17['body'][_0xebf4('0x60')])return;return db[_0xebf4('0x74')][_0xebf4('0x5b')]({'where':{'id':_0x2bea17[_0xebf4('0x5a')][_0xebf4('0x60')],'role':_0xebf4('0x62')},'attributes':['id',_0xebf4('0x3c'),_0xebf4('0x75'),'email',_0xebf4('0x76')],'raw':!![]});}return null;})[_0xebf4('0x23')](function(_0x30f719){if(!_0x30f719)return null;_0x2ba5a9['message']['agent']=_0x30f719;return _0x2ba5a9;})[_0xebf4('0x23')](function(_0x2cbf35){if(_0x2cbf35){if(_0x2bea17[_0xebf4('0x5a')]['manual']){_0x2ba5a9[_0xebf4('0x2b')]['interface']=util[_0xebf4('0x5f')]('SIP/%s',_0x2bea17[_0xebf4('0x61')][_0xebf4('0x3c')]);_0x2ba5a9[_0xebf4('0x2b')][_0xebf4('0x77')]=_0x2ba5a9['channel'];_0x2ba5a9[_0xebf4('0x2b')][_0xebf4('0x78')]=_0x2ba5a9[_0xebf4('0x77')];_0x2ba5a9[_0xebf4('0x2b')][_0xebf4('0x79')]=_0xebf4('0x5d');return respondWithRpcPromise(_0xebf4('0x7a'),_0xebf4('0x7a'),{'event':'acceptmessage','message':_0x2ba5a9[_0xebf4('0x2b')]},client9002)[_0xebf4('0x23')](function(){return _0x2ba5a9;});}return _0x2ba5a9;}return null;})[_0xebf4('0x23')](respondWithResult(_0x34b405,null))[_0xebf4('0x2d')](handleError(_0x34b405,null));};var interaction_log=require(_0xebf4('0x15'))(_0xebf4('0x7b'));exports[_0xebf4('0x37')]=function(_0x23942c,_0x7c03c7,_0x208e96){var _0xe9da5b={'agent':{},'channel':_0xebf4('0x7c')};if(_0x23942c[_0xebf4('0x5a')]['id']){delete _0x23942c[_0xebf4('0x5a')]['id'];}_0x23942c[_0xebf4('0x5a')][_0xebf4('0x60')]=_0x23942c['body'][_0xebf4('0x60')]||_0x23942c[_0xebf4('0x61')]['id'];_0xe9da5b[_0xebf4('0x62')]['id']=_0x23942c[_0xebf4('0x5a')][_0xebf4('0x60')];return db[_0xebf4('0x52')]['find']({'where':{'id':_0x23942c[_0xebf4('0x57')]['id'],'UserId':null}})[_0xebf4('0x23')](handleEntityNotFound(_0x7c03c7,null))[_0xebf4('0x23')](function(_0x12056d){if(_0x12056d){_0xe9da5b[_0xebf4('0x2b')]=_0x12056d[_0xebf4('0x63')]({'plain':!![]});return db[_0xebf4('0x64')][_0xebf4('0x5b')]({'where':{'id':_0x12056d[_0xebf4('0x65')]}});}return null;})[_0xebf4('0x23')](handleEntityNotFound(_0x7c03c7,null))['then'](function(_0x5af7a4){if(_0x5af7a4){_0xe9da5b[_0xebf4('0x68')]=_0x5af7a4[_0xebf4('0x63')]({'plain':!![]});interaction_log[_0xebf4('0x69')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23942c[_0xebf4('0x61')]['id'],_0x23942c['user']['name'],_0x23942c[_0xebf4('0x61')][_0xebf4('0x7d')],_0xe9da5b[_0xebf4('0x68')]['id'],_0x23942c[_0xebf4('0x5a')]?JSON[_0xebf4('0x28')](_0x23942c[_0xebf4('0x5a')]):_0xebf4('0x6b'));return respondWithRpcPromise('RejectMessage',_0xebf4('0x7e'),_0xe9da5b);}return null;})[_0xebf4('0x23')](function(_0x41cee5){var _0x22b68b=_0xebf4('0x6e')+_0x41cee5['message'][_0xebf4('0x6f')];return db[_0xebf4('0x70')][_0xebf4('0x43')](_0x22b68b,{'type':db[_0xebf4('0x7f')]['QueryTypes'][_0xebf4('0x72')],'raw':!![]})[_0xebf4('0x23')](function(_0x226266){return _0x226266;});})[_0xebf4('0x23')](function(_0x46a5c9){if(_0x46a5c9){_0xe9da5b[_0xebf4('0x2b')][_0xebf4('0x73')]=_0x46a5c9[0x0];if(!_0x23942c[_0xebf4('0x5a')][_0xebf4('0x60')])return;return db[_0xebf4('0x74')][_0xebf4('0x5b')]({'where':{'id':_0x23942c[_0xebf4('0x5a')][_0xebf4('0x60')],'role':'agent'},'attributes':['id',_0xebf4('0x3c'),_0xebf4('0x75'),_0xebf4('0x80'),'internal'],'raw':!![]});}return null;})[_0xebf4('0x23')](function(_0x1753a6){if(!_0x1753a6)return null;_0xe9da5b['message']['agent']=_0x1753a6;return _0xe9da5b;})['then'](function(_0x5ea2a6){if(_0x5ea2a6){_0x5ea2a6[_0xebf4('0x2b')]['interface']=util['format'](_0xebf4('0x81'),_0x23942c[_0xebf4('0x61')][_0xebf4('0x3c')]);_0x5ea2a6[_0xebf4('0x2b')][_0xebf4('0x77')]=_0xe9da5b[_0xebf4('0x77')];_0x5ea2a6[_0xebf4('0x2b')][_0xebf4('0x78')]=_0xe9da5b['channel'];_0x5ea2a6[_0xebf4('0x2b')][_0xebf4('0x79')]=_0xebf4('0x37');respondWithRpcPromise(_0xebf4('0x7a'),_0xebf4('0x7a'),{'event':_0xebf4('0x82'),'message':_0x5ea2a6[_0xebf4('0x2b')]},client9002);return _0xe9da5b;}return null;})[_0xebf4('0x23')](respondWithResult(_0x7c03c7,null))[_0xebf4('0x2d')](handleError(_0x7c03c7,null));}; \ No newline at end of file +var _0x758d=['length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','include','rows','show','params','intersection','fields','create','body','find','describe','openchannel-interactions','openchannel','readAt','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','SIP/%s','channel','motionChannel','accept','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','interface','event','EventManager','rejectmessage','eml-format','rimraf','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x758d,0xc0));var _0xd758=function(_0x27cf74,_0x465234){_0x27cf74=_0x27cf74-0x0;var _0x5f5997=_0x758d[_0x27cf74];return _0x5f5997;};'use strict';var emlformat=require(_0xd758('0x0'));var rimraf=require(_0xd758('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd758('0x2'));var util=require(_0xd758('0x3'));var path=require(_0xd758('0x4'));var sox=require(_0xd758('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd758('0x6'));var squel=require(_0xd758('0x7'));var crypto=require(_0xd758('0x8'));var jsforce=require(_0xd758('0x9'));var deskjs=require(_0xd758('0xa'));var toCsv=require(_0xd758('0xb'));var querystring=require(_0xd758('0xc'));var Papa=require(_0xd758('0xd'));var Redis=require('ioredis');var authService=require(_0xd758('0xe'));var qs=require(_0xd758('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd758('0x10'));var logger=require(_0xd758('0x11'))(_0xd758('0x12'));var utils=require(_0xd758('0x13'));var config=require(_0xd758('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd758('0x15'))['db'];config[_0xd758('0x16')]=_[_0xd758('0x17')](config[_0xd758('0x16')],{'host':_0xd758('0x18'),'port':0x18eb});var socket=require(_0xd758('0x19'))(new Redis(config[_0xd758('0x16')]));require('./openchannelMessage.socket')[_0xd758('0x1a')](socket);var jayson=require(_0xd758('0x1b'));var client=jayson[_0xd758('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xd758('0x1c')][_0xd758('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x9ac450,_0x570dda,_0x1dd258,_0x4caf6c){return new BPromise(function(_0x1c07e8,_0x3e5eee){var _0x1e7eca=_0x4caf6c||client;return _0x1e7eca[_0xd758('0x1e')](_0x9ac450,_0x1dd258)['then'](function(_0x557e69){logger['info'](_0xd758('0x1f'),_0x570dda,'request\x20sent');logger[_0xd758('0x20')](_0xd758('0x21'),_0x570dda,_0xd758('0x22'),JSON[_0xd758('0x23')](_0x557e69));if(_0x557e69['error']){if(_0x557e69['error'][_0xd758('0x24')]===0x1f4){logger[_0xd758('0x25')](_0xd758('0x1f'),_0x570dda,_0x557e69['error'][_0xd758('0x26')]);return _0x3e5eee(_0x557e69['error']['message']);}logger[_0xd758('0x25')](_0xd758('0x1f'),_0x570dda,_0x557e69[_0xd758('0x25')]['message']);return _0x1c07e8(_0x557e69[_0xd758('0x25')]['message']);}else{logger[_0xd758('0x27')](_0xd758('0x1f'),_0x570dda,_0xd758('0x22'));_0x1c07e8(_0x557e69[_0xd758('0x28')]['message']);}})[_0xd758('0x29')](function(_0x4a9ef9){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x570dda,_0x4a9ef9);_0x3e5eee(_0x4a9ef9);});});}function respondWithStatusCode(_0x3e99b3,_0x598a8f){_0x598a8f=_0x598a8f||0xcc;return function(_0x284676){if(_0x284676){return _0x3e99b3['sendStatus'](_0x598a8f);}return _0x3e99b3[_0xd758('0x2a')](_0x598a8f)[_0xd758('0x2b')]();};}function respondWithResult(_0x21194f,_0x1f5e6d){_0x1f5e6d=_0x1f5e6d||0xc8;return function(_0x2204a4){if(_0x2204a4){return _0x21194f[_0xd758('0x2a')](_0x1f5e6d)[_0xd758('0x2c')](_0x2204a4);}};}function respondWithFilteredResult(_0x7743c1,_0x5bd054){return function(_0x5c2a34){if(_0x5c2a34){var _0x5c414c=typeof _0x5bd054[_0xd758('0x2d')]===_0xd758('0x2e')&&typeof _0x5bd054['limit']==='undefined';var _0x227e28=_0x5c2a34[_0xd758('0x2f')];var _0x507b7a=_0x5c414c?0x0:_0x5bd054[_0xd758('0x2d')];var _0x20f581=_0x5c414c?_0x5c2a34[_0xd758('0x2f')]:_0x5bd054[_0xd758('0x2d')]+_0x5bd054['limit'];var _0x5db9da;if(_0x20f581>=_0x227e28){_0x20f581=_0x227e28;_0x5db9da=0xc8;}else{_0x5db9da=0xce;}_0x7743c1[_0xd758('0x2a')](_0x5db9da);return _0x7743c1['set'](_0xd758('0x30'),_0x507b7a+'-'+_0x20f581+'/'+_0x227e28)['json'](_0x5c2a34);}return null;};}function patchUpdates(_0x2250fd){return function(_0x3e8c25){try{jsonpatch[_0xd758('0x31')](_0x3e8c25,_0x2250fd,!![]);}catch(_0x172640){return BPromise[_0xd758('0x32')](_0x172640);}return _0x3e8c25[_0xd758('0x33')]();};}function saveUpdates(_0x10a423,_0x2c911f){return function(_0x2a9b93){if(_0x2a9b93){return _0x2a9b93[_0xd758('0x34')](_0x10a423)[_0xd758('0x35')](function(_0x2aa8e1){return _0x2aa8e1;});}return null;};}function removeEntity(_0x26905e,_0x5173bb){return function(_0x27d413){if(_0x27d413){return _0x27d413[_0xd758('0x36')]()['then'](function(){_0x26905e[_0xd758('0x2a')](0xcc)[_0xd758('0x2b')]();});}};}function handleEntityNotFound(_0x16e647,_0x2847cf){return function(_0x45b597){if(!_0x45b597){_0x16e647[_0xd758('0x37')](0x194);}return _0x45b597;};}function handleError(_0x26577a,_0x276b21){_0x276b21=_0x276b21||0x1f4;return function(_0x47c540){logger[_0xd758('0x25')](_0x47c540[_0xd758('0x38')]);if(_0x47c540[_0xd758('0x39')]){delete _0x47c540[_0xd758('0x39')];}_0x26577a[_0xd758('0x2a')](_0x276b21)[_0xd758('0x3a')](_0x47c540);};}exports['index']=function(_0x50516d,_0x5094a5){var _0x1c82ce={},_0x501370={},_0x4acaab={'count':0x0,'rows':[]};var _0xc574f1=_[_0xd758('0x3b')](db[_0xd758('0x3c')][_0xd758('0x3d')],function(_0x33e74d){return{'name':_0x33e74d[_0xd758('0x3e')],'type':_0x33e74d[_0xd758('0x3f')][_0xd758('0x40')]};});_0x501370[_0xd758('0x41')]=_[_0xd758('0x3b')](_0xc574f1,_0xd758('0x39'));_0x501370['query']=_[_0xd758('0x42')](_0x50516d['query']);_0x501370[_0xd758('0x43')]=_['intersection'](_0x501370[_0xd758('0x41')],_0x501370[_0xd758('0x44')]);_0x1c82ce[_0xd758('0x45')]=_['intersection'](_0x501370['model'],qs['fields'](_0x50516d[_0xd758('0x44')]['fields']));_0x1c82ce[_0xd758('0x45')]=_0x1c82ce[_0xd758('0x45')][_0xd758('0x46')]?_0x1c82ce[_0xd758('0x45')]:_0x501370[_0xd758('0x41')];if(!_0x50516d[_0xd758('0x44')][_0xd758('0x47')](_0xd758('0x48'))){_0x1c82ce[_0xd758('0x49')]=qs['limit'](_0x50516d[_0xd758('0x44')][_0xd758('0x49')]);_0x1c82ce[_0xd758('0x2d')]=qs['offset'](_0x50516d['query']['offset']);}_0x1c82ce[_0xd758('0x4a')]=qs[_0xd758('0x4b')](_0x50516d[_0xd758('0x44')][_0xd758('0x4b')]);_0x1c82ce['where']=qs[_0xd758('0x43')](_['pick'](_0x50516d[_0xd758('0x44')],_0x501370['filters']),_0xc574f1);if(_0x50516d['query'][_0xd758('0x4c')]){_0x1c82ce[_0xd758('0x4d')]=_[_0xd758('0x4e')](_0x1c82ce['where'],{'$or':_['map'](_0xc574f1,function(_0x109554){if(_0x109554['type']!==_0xd758('0x4f')){var _0x22c788={};_0x22c788[_0x109554['name']]={'$like':'%'+_0x50516d[_0xd758('0x44')][_0xd758('0x4c')]+'%'};return _0x22c788;}})});}_0x1c82ce=_[_0xd758('0x4e')]({},_0x1c82ce,_0x50516d[_0xd758('0x50')]);var _0x33f7b1={'where':_0x1c82ce['where']};return db[_0xd758('0x3c')][_0xd758('0x2f')](_0x33f7b1)[_0xd758('0x35')](function(_0x5708a4){_0x4acaab['count']=_0x5708a4;if(_0x50516d[_0xd758('0x44')]['includeAll']){_0x1c82ce[_0xd758('0x51')]=[{'all':!![]}];}return db[_0xd758('0x3c')]['findAll'](_0x1c82ce);})[_0xd758('0x35')](function(_0x478a52){_0x4acaab[_0xd758('0x52')]=_0x478a52;return _0x4acaab;})['then'](respondWithFilteredResult(_0x5094a5,_0x1c82ce))[_0xd758('0x29')](handleError(_0x5094a5,null));};exports[_0xd758('0x53')]=function(_0x5be92a,_0x4abd98){var _0x4c2901={'raw':!![],'where':{'id':_0x5be92a[_0xd758('0x54')]['id']}},_0x1fe51b={};_0x1fe51b[_0xd758('0x41')]=_[_0xd758('0x42')](db[_0xd758('0x3c')][_0xd758('0x3d')]);_0x1fe51b[_0xd758('0x44')]=_[_0xd758('0x42')](_0x5be92a['query']);_0x1fe51b[_0xd758('0x43')]=_[_0xd758('0x55')](_0x1fe51b['model'],_0x1fe51b[_0xd758('0x44')]);_0x4c2901[_0xd758('0x45')]=_[_0xd758('0x55')](_0x1fe51b[_0xd758('0x41')],qs['fields'](_0x5be92a['query'][_0xd758('0x56')]));_0x4c2901['attributes']=_0x4c2901[_0xd758('0x45')]['length']?_0x4c2901['attributes']:_0x1fe51b[_0xd758('0x41')];if(_0x5be92a[_0xd758('0x44')]['includeAll']){_0x4c2901['include']=[{'all':!![]}];}_0x4c2901=_[_0xd758('0x4e')]({},_0x4c2901,_0x5be92a[_0xd758('0x50')]);return db[_0xd758('0x3c')]['find'](_0x4c2901)[_0xd758('0x35')](handleEntityNotFound(_0x4abd98,null))[_0xd758('0x35')](respondWithResult(_0x4abd98,null))['catch'](handleError(_0x4abd98,null));};exports[_0xd758('0x57')]=function(_0x2403db,_0x15f8f9){return db[_0xd758('0x3c')][_0xd758('0x57')](_0x2403db[_0xd758('0x58')],{})['then'](respondWithResult(_0x15f8f9,0xc9))[_0xd758('0x29')](handleError(_0x15f8f9,null));};exports[_0xd758('0x34')]=function(_0x534fdb,_0x5b1ad0){if(_0x534fdb[_0xd758('0x58')]['id']){delete _0x534fdb[_0xd758('0x58')]['id'];}return db[_0xd758('0x3c')][_0xd758('0x59')]({'where':{'id':_0x534fdb[_0xd758('0x54')]['id']}})[_0xd758('0x35')](handleEntityNotFound(_0x5b1ad0,null))['then'](saveUpdates(_0x534fdb[_0xd758('0x58')],null))[_0xd758('0x35')](respondWithResult(_0x5b1ad0,null))[_0xd758('0x29')](handleError(_0x5b1ad0,null));};exports[_0xd758('0x36')]=function(_0x5c6d4c,_0xee8fd3){return db[_0xd758('0x3c')][_0xd758('0x59')]({'where':{'id':_0x5c6d4c['params']['id']}})[_0xd758('0x35')](handleEntityNotFound(_0xee8fd3,null))[_0xd758('0x35')](removeEntity(_0xee8fd3,null))[_0xd758('0x29')](handleError(_0xee8fd3,null));};exports[_0xd758('0x5a')]=function(_0x323b2e,_0x4ee0b2){return db[_0xd758('0x3c')][_0xd758('0x5a')]()[_0xd758('0x35')](respondWithResult(_0x4ee0b2,null))[_0xd758('0x29')](handleError(_0x4ee0b2,null));};var interaction_log=require(_0xd758('0x11'))(_0xd758('0x5b'));exports['accept']=function(_0x4f4398,_0x346d79,_0x255f4b){var _0x56e56d={'agent':{},'channel':_0xd758('0x5c')};if(_0x4f4398['body']['id']){delete _0x4f4398['body']['id'];}_0x4f4398[_0xd758('0x58')]['read']=!![];_0x4f4398[_0xd758('0x58')][_0xd758('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4f4398[_0xd758('0x58')]['UserId']=_0x4f4398['body'][_0xd758('0x5e')]||_0x4f4398[_0xd758('0x5f')]['id'];_0x56e56d[_0xd758('0x60')]['id']=_0x4f4398[_0xd758('0x58')]['UserId'];return db[_0xd758('0x3c')][_0xd758('0x59')]({'where':{'id':_0x4f4398[_0xd758('0x54')]['id'],'UserId':null}})[_0xd758('0x35')](handleEntityNotFound(_0x346d79,null))[_0xd758('0x35')](saveUpdates(_0x4f4398[_0xd758('0x58')],null))[_0xd758('0x35')](function(_0x29a35f){if(_0x29a35f){_0x56e56d[_0xd758('0x26')]=_0x29a35f[_0xd758('0x61')]({'plain':!![]});return db[_0xd758('0x62')][_0xd758('0x59')]({'where':{'id':_0x29a35f[_0xd758('0x63')]}});}return null;})[_0xd758('0x35')](handleEntityNotFound(_0x346d79,null))['then'](function(_0x10d5d1){if(_0x10d5d1){return _0x10d5d1[_0xd758('0x34')]({'UserId':_0x4f4398['body'][_0xd758('0x5e')],'read1stAt':_['isNil'](_0x10d5d1[_0xd758('0x64')])?moment()[_0xd758('0x65')](_0xd758('0x66')):undefined});}return null;})[_0xd758('0x35')](function(_0x5df9b1){if(_0x5df9b1){_0x56e56d[_0xd758('0x67')]=_0x5df9b1[_0xd758('0x61')]({'plain':!![]});interaction_log[_0xd758('0x27')](_0xd758('0x68'),_0x4f4398[_0xd758('0x5f')]['id'],_0x4f4398[_0xd758('0x5f')][_0xd758('0x39')],_0x4f4398[_0xd758('0x5f')][_0xd758('0x69')],_0x56e56d[_0xd758('0x67')]['id'],_0x4f4398['body']?JSON[_0xd758('0x23')](_0x4f4398[_0xd758('0x58')]):'null');return respondWithRpcPromise(_0xd758('0x6a'),_0xd758('0x6b'),_0x56e56d);}return null;})['then'](function(_0x533821){var _0xa38a15=_0xd758('0x6c')+_0x533821[_0xd758('0x26')][_0xd758('0x6d')];return db['sequelize'][_0xd758('0x44')](_0xa38a15,{'type':db[_0xd758('0x6e')][_0xd758('0x6f')][_0xd758('0x70')],'raw':!![]})[_0xd758('0x35')](function(_0x323b9d){return _0x323b9d;});})[_0xd758('0x35')](function(_0x314982){if(_0x314982){_0x56e56d[_0xd758('0x26')][_0xd758('0x71')]=_0x314982[0x0];if(!_0x4f4398[_0xd758('0x58')]['UserId'])return;return db[_0xd758('0x72')][_0xd758('0x59')]({'where':{'id':_0x4f4398[_0xd758('0x58')][_0xd758('0x5e')],'role':'agent'},'attributes':['id',_0xd758('0x39'),_0xd758('0x73'),_0xd758('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x20ec52){if(!_0x20ec52)return null;_0x56e56d[_0xd758('0x26')][_0xd758('0x60')]=_0x20ec52;return _0x56e56d;})[_0xd758('0x35')](function(_0x1cfa52){if(_0x1cfa52){if(_0x4f4398[_0xd758('0x58')]['manual']){_0x56e56d[_0xd758('0x26')]['interface']=util[_0xd758('0x65')](_0xd758('0x75'),_0x4f4398['user'][_0xd758('0x39')]);_0x56e56d[_0xd758('0x26')]['channel']=_0x56e56d[_0xd758('0x76')];_0x56e56d[_0xd758('0x26')][_0xd758('0x77')]=_0x56e56d[_0xd758('0x76')];_0x56e56d[_0xd758('0x26')]['event']=_0xd758('0x78');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd758('0x79'),'message':_0x56e56d[_0xd758('0x26')]},client9002)[_0xd758('0x35')](function(){return _0x56e56d;});}return _0x56e56d;}return null;})[_0xd758('0x35')](respondWithResult(_0x346d79,null))['catch'](handleError(_0x346d79,null));};var interaction_log=require(_0xd758('0x11'))(_0xd758('0x5b'));exports[_0xd758('0x32')]=function(_0x4b797c,_0x5836ba,_0x1bf18f){var _0x70ea75={'agent':{},'channel':_0xd758('0x5c')};if(_0x4b797c[_0xd758('0x58')]['id']){delete _0x4b797c[_0xd758('0x58')]['id'];}_0x4b797c[_0xd758('0x58')][_0xd758('0x5e')]=_0x4b797c[_0xd758('0x58')][_0xd758('0x5e')]||_0x4b797c[_0xd758('0x5f')]['id'];_0x70ea75[_0xd758('0x60')]['id']=_0x4b797c[_0xd758('0x58')][_0xd758('0x5e')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4b797c['params']['id'],'UserId':null}})[_0xd758('0x35')](handleEntityNotFound(_0x5836ba,null))[_0xd758('0x35')](function(_0x4eafcb){if(_0x4eafcb){_0x70ea75[_0xd758('0x26')]=_0x4eafcb['get']({'plain':!![]});return db[_0xd758('0x62')][_0xd758('0x59')]({'where':{'id':_0x4eafcb[_0xd758('0x63')]}});}return null;})[_0xd758('0x35')](handleEntityNotFound(_0x5836ba,null))[_0xd758('0x35')](function(_0x115a80){if(_0x115a80){_0x70ea75[_0xd758('0x67')]=_0x115a80[_0xd758('0x61')]({'plain':!![]});interaction_log[_0xd758('0x27')](_0xd758('0x7a'),_0x4b797c[_0xd758('0x5f')]['id'],_0x4b797c[_0xd758('0x5f')][_0xd758('0x39')],_0x4b797c['user']['role'],_0x70ea75[_0xd758('0x67')]['id'],_0x4b797c[_0xd758('0x58')]?JSON['stringify'](_0x4b797c[_0xd758('0x58')]):_0xd758('0x7b'));return respondWithRpcPromise(_0xd758('0x7c'),_0xd758('0x7d'),_0x70ea75);}return null;})[_0xd758('0x35')](function(_0x583a08){var _0x5c79aa=_0xd758('0x6c')+_0x583a08[_0xd758('0x26')][_0xd758('0x6d')];return db[_0xd758('0x7e')]['query'](_0x5c79aa,{'type':db[_0xd758('0x6e')][_0xd758('0x6f')]['SELECT'],'raw':!![]})[_0xd758('0x35')](function(_0x21b735){return _0x21b735;});})[_0xd758('0x35')](function(_0x23baa0){if(_0x23baa0){_0x70ea75[_0xd758('0x26')][_0xd758('0x71')]=_0x23baa0[0x0];if(!_0x4b797c[_0xd758('0x58')]['UserId'])return;return db[_0xd758('0x72')][_0xd758('0x59')]({'where':{'id':_0x4b797c[_0xd758('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xd758('0x39'),_0xd758('0x73'),'email','internal'],'raw':!![]});}return null;})[_0xd758('0x35')](function(_0x488861){if(!_0x488861)return null;_0x70ea75[_0xd758('0x26')]['agent']=_0x488861;return _0x70ea75;})[_0xd758('0x35')](function(_0x569a7f){if(_0x569a7f){_0x569a7f[_0xd758('0x26')][_0xd758('0x7f')]=util[_0xd758('0x65')]('SIP/%s',_0x4b797c[_0xd758('0x5f')][_0xd758('0x39')]);_0x569a7f[_0xd758('0x26')][_0xd758('0x76')]=_0x70ea75['channel'];_0x569a7f[_0xd758('0x26')][_0xd758('0x77')]=_0x70ea75[_0xd758('0x76')];_0x569a7f[_0xd758('0x26')][_0xd758('0x80')]='reject';respondWithRpcPromise('EventManager',_0xd758('0x81'),{'event':_0xd758('0x82'),'message':_0x569a7f[_0xd758('0x26')]},client9002);return _0x70ea75;}return null;})[_0xd758('0x35')](respondWithResult(_0x5836ba,null))['catch'](handleError(_0x5836ba,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 2111461..c5db912 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 _0xa119=['setMaxListeners','save','update','remove','emit','exports','events','OpenchannelMessage'];(function(_0x102d89,_0x3388b9){var _0x24eb37=function(_0xeffb8d){while(--_0xeffb8d){_0x102d89['push'](_0x102d89['shift']());}};_0x24eb37(++_0x3388b9);}(_0xa119,0x17e));var _0x9a11=function(_0x3a07ee,_0x2649a5){_0x3a07ee=_0x3a07ee-0x0;var _0x42fbb1=_0xa119[_0x3a07ee];return _0x42fbb1;};'use strict';var EventEmitter=require(_0x9a11('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x9a11('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9a11('0x2')](0x0);var events={'afterCreate':_0x9a11('0x3'),'afterUpdate':_0x9a11('0x4'),'afterDestroy':_0x9a11('0x5')};function emitEvent(_0x10637a){return function(_0xa80d14,_0x3b8e48,_0x14ed99){OpenchannelMessageEvents['emit'](_0x10637a+':'+_0xa80d14['id'],_0xa80d14);OpenchannelMessageEvents[_0x9a11('0x6')](_0x10637a,_0xa80d14);_0x14ed99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x9a11('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x481c=['save','update','remove','emit','hook','../../mysqldb','setMaxListeners'];(function(_0x1c290f,_0x94ef44){var _0x3980fe=function(_0x203af9){while(--_0x203af9){_0x1c290f['push'](_0x1c290f['shift']());}};_0x3980fe(++_0x94ef44);}(_0x481c,0x83));var _0xc481=function(_0x5d1b9c,_0x41eae3){_0x5d1b9c=_0x5d1b9c-0x0;var _0x7efe06=_0x481c[_0x5d1b9c];return _0x7efe06;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xc481('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc481('0x1')](0x0);var events={'afterCreate':_0xc481('0x2'),'afterUpdate':_0xc481('0x3'),'afterDestroy':_0xc481('0x4')};function emitEvent(_0x2715b4){return function(_0x367da2,_0x4b1b4f,_0x1f9e6a){OpenchannelMessageEvents[_0xc481('0x5')](_0x2715b4+':'+_0x367da2['id'],_0x367da2);OpenchannelMessageEvents[_0xc481('0x5')](_0x2715b4,_0x367da2);_0x1f9e6a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xc481('0x6')](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 e6c3687..554af5a 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 _0x2032=['body','models','direction','out','secret','then','createdAt','toLowerCase','catch','error','describe','OpenchannelAccount','find','OpenchannelInteraction','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x47cce4,_0x50e878){var _0x53e939=function(_0xf2fecb){while(--_0xf2fecb){_0x47cce4['push'](_0x47cce4['shift']());}};_0x53e939(++_0x50e878);}(_0x2032,0xd9));var _0x2203=function(_0x2907e3,_0x8c2bd5){_0x2907e3=_0x2907e3-0x0;var _0x631f4=_0x2032[_0x2907e3];return _0x631f4;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'name':_0x2203('0xc'),'fields':[_0x2203('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x526ae0,_0x10f055,_0x549908){var _0x27081c=_0x3f7ba1[_0x2203('0xe')];var _0x6339c4=_0x526ae0['get']({'plain':!![]});if(_0x6339c4[_0x2203('0xf')]['toLowerCase']()==='in'||_0x6339c4[_0x2203('0xf')]['toLowerCase']()===_0x2203('0x10')&&!_0x6339c4[_0x2203('0x11')]&&!_['isNil'](_0x6339c4['UserId'])){_0x27081c['OpenchannelInteraction']['findOne']({'where':{'id':_0x6339c4['OpenchannelInteractionId']}})[_0x2203('0x12')](function(_0x538b30){if(_0x538b30){_0x538b30['update']({'lastMsgAt':_0x6339c4[_0x2203('0x13')],'lastMsgDirection':_0x6339c4[_0x2203('0xf')][_0x2203('0x14')]()});}})[_0x2203('0x15')](function(_0x226209){console[_0x2203('0x16')](_0x226209);});}if(_0x6339c4[_0x2203('0xf')]===_0x2203('0x10')&&!_0x6339c4[_0x2203('0x11')]){var _0x3053f3;_0x27081c['CmContact'][_0x2203('0x17')]()[_0x2203('0x12')](function(_0x4893ff){return _0x27081c[_0x2203('0x18')][_0x2203('0x19')]({'where':{'id':_0x6339c4['OpenchannelAccountId']},'include':[{'model':_0x27081c[_0x2203('0x1a')],'as':'Interactions','where':{'id':_0x6339c4[_0x2203('0x1b')]},'limit':0x1,'include':[{'model':_0x27081c[_0x2203('0x1c')],'as':_0x2203('0x1d'),'attributes':_[_0x2203('0x1e')](_0x4893ff)}]}]});})[_0x2203('0x12')](function(_0x449039){_0x3053f3=_0x449039['get']({'plain':!![]});if(_0x3053f3&&_0x3053f3[_0x2203('0x1f')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2203('0x20'),util['format'](_0x2203('0x21'),_0x6339c4['id'],_0x3053f3[_0x2203('0x1f')]));if(_0x3053f3['Interactions']&&_0x3053f3[_0x2203('0x22')]['length']){_0x6339c4['Interaction']=_[_0x2203('0x23')](_0x3053f3[_0x2203('0x22')][0x0],_0x2203('0x1d'));_0x6339c4[_0x2203('0x1d')]=_0x3053f3[_0x2203('0x22')][0x0][_0x2203('0x1d')];}var _0x10f055={'method':_0x2203('0x24'),'uri':encodeURI(_0x3053f3['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x10f055[_0x2203('0x25')]){case _0x2203('0x26'):_0x10f055['qs']=_0x6339c4;break;case _0x2203('0x24'):_0x10f055['body']=_0x6339c4;break;}return rp(_0x10f055)[_0x2203('0x12')](function(_0x1cec17){logger['info'](_0x2203('0x27'),_0x2203('0x20'),util[_0x2203('0x28')](_0x2203('0x29'),_0x6339c4['id'],_0x3053f3[_0x2203('0x1f')]));if(_0x1cec17[_0x2203('0xd')][_0x2203('0x2a')]&&_0x1cec17['body'][_0x2203('0x2a')]!=_0x6339c4[_0x2203('0x2b')][_0x2203('0x2a')]){return _0x27081c[_0x2203('0x1a')]['update']({'threadId':_0x1cec17[_0x2203('0xd')][_0x2203('0x2a')]},{'logging':!![],'where':{'id':_0x6339c4[_0x2203('0x2b')]['id']}});}else{return;}})[_0x2203('0x12')](function(){return _0x526ae0['update']({'read':!![]});})[_0x2203('0x15')](function(_0x50aa17){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2203('0x20'),util['inspect'](_0x50aa17,{'showHidden':![],'depth':null}));_0x549908();});}else{_0x549908();}})['finally'](function(){_0x549908();});}else{_0x549908();}}},'charset':_0x2203('0x2c'),'collate':_0x2203('0x2d')});}; \ No newline at end of file +var _0xea28=['moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','GET','afterCreate','threadId','finally','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x43fe80,_0x3bad2c){var _0x18d848=function(_0x57fb53){while(--_0x57fb53){_0x43fe80['push'](_0x43fe80['shift']());}};_0x18d848(++_0x3bad2c);}(_0xea28,0x13a));var _0x8ea2=function(_0x4d6617,_0x831056){_0x4d6617=_0x4d6617-0x0;var _0x218511=_0xea28[_0x4d6617];return _0x218511;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[{'name':_0x8ea2('0xe'),'fields':[_0x8ea2('0xf')],'type':_0x8ea2('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x320750,_0x3de4a1,_0x3000f9){var _0x3d0b35=_0x513a0d[_0x8ea2('0x11')];var _0x500b82=_0x320750['get']({'plain':!![]});if(_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()==='in'||_0x500b82[_0x8ea2('0x12')]['toLowerCase']()===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]&&!_[_0x8ea2('0x16')](_0x500b82[_0x8ea2('0x17')])){_0x3d0b35[_0x8ea2('0x18')]['findOne']({'where':{'id':_0x500b82[_0x8ea2('0x19')]}})['then'](function(_0x4b2192){if(_0x4b2192){_0x4b2192[_0x8ea2('0x1a')]({'lastMsgAt':_0x500b82[_0x8ea2('0x1b')],'lastMsgDirection':_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()});}})[_0x8ea2('0x1c')](function(_0xbb9bd1){console[_0x8ea2('0x1d')](_0xbb9bd1);});}if(_0x500b82[_0x8ea2('0x12')]===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]){var _0x2dfa7c;_0x3d0b35[_0x8ea2('0x1e')][_0x8ea2('0x1f')]()[_0x8ea2('0x20')](function(_0x1b64cf){return _0x3d0b35[_0x8ea2('0x21')][_0x8ea2('0x22')]({'where':{'id':_0x500b82[_0x8ea2('0x23')]},'include':[{'model':_0x3d0b35[_0x8ea2('0x18')],'as':_0x8ea2('0x24'),'where':{'id':_0x500b82[_0x8ea2('0x19')]},'limit':0x1,'include':[{'model':_0x3d0b35[_0x8ea2('0x1e')],'as':'Contact','attributes':_['keys'](_0x1b64cf)}]}]});})[_0x8ea2('0x20')](function(_0x248c18){_0x2dfa7c=_0x248c18[_0x8ea2('0x25')]({'plain':!![]});if(_0x2dfa7c&&_0x2dfa7c['replyUri']){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),'afterCreate',util[_0x8ea2('0x28')](_0x8ea2('0x29'),_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x2dfa7c[_0x8ea2('0x24')]&&_0x2dfa7c[_0x8ea2('0x24')][_0x8ea2('0x2b')]){_0x500b82[_0x8ea2('0x2c')]=_[_0x8ea2('0x2d')](_0x2dfa7c[_0x8ea2('0x24')][0x0],'Contact');_0x500b82[_0x8ea2('0x2e')]=_0x2dfa7c['Interactions'][0x0][_0x8ea2('0x2e')];}var _0x3de4a1={'method':_0x8ea2('0x2f'),'uri':encodeURI(_0x2dfa7c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3de4a1['method']){case _0x8ea2('0x30'):_0x3de4a1['qs']=_0x500b82;break;case'POST':_0x3de4a1[_0x8ea2('0xf')]=_0x500b82;break;}return rp(_0x3de4a1)['then'](function(_0x3be291){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x8ea2('0x31'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x3be291['body'][_0x8ea2('0x32')]&&_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]!=_0x500b82[_0x8ea2('0x2c')][_0x8ea2('0x32')]){return _0x3d0b35[_0x8ea2('0x18')][_0x8ea2('0x1a')]({'threadId':_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]},{'logging':!![],'where':{'id':_0x500b82[_0x8ea2('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x320750['update']({'read':!![]});})[_0x8ea2('0x1c')](function(_0x188553){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x8ea2('0x31'),util['inspect'](_0x188553,{'showHidden':![],'depth':null}));_0x3000f9();});}else{_0x3000f9();}})[_0x8ea2('0x33')](function(){_0x3000f9();});}else{_0x3000f9();}}},'charset':_0x8ea2('0x34'),'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 84256ee..3074405 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x13260f,_0x514db7){var _0x18da8e=function(_0x16a081){while(--_0x16a081){_0x13260f['push'](_0x13260f['shift']());}};_0x18da8e(++_0x514db7);}(_0xadb5,0xad));var _0x5adb=function(_0x3ef0d2,_0xdcae70){_0x3ef0d2=_0x3ef0d2-0x0;var _0x2bfc1a=_0xadb5[_0x3ef0d2];return _0x2bfc1a;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +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(_0x45e684,_0x33a27d){var _0x31a0f2=function(_0x4c7541){while(--_0x4c7541){_0x45e684['push'](_0x45e684['shift']());}};_0x31a0f2(++_0x33a27d);}(_0x2ef3,0xba));var _0x32ef=function(_0x925915,_0x451ec3){_0x925915=_0x925915-0x0;var _0x1bd01e=_0x2ef3[_0x925915];return _0x1bd01e;};'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 2c2c76c..5d2a35f 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 _0x749a=['openchannelMessage:','./openchannelMessage.events','save','remove','emit','register','length'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x749a,0xbe));var _0xa749=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x749a[_0x122ef9];return _0x42fba0;};'use strict';var OpenchannelMessageEvents=require(_0xa749('0x0'));var events=[_0xa749('0x1'),_0xa749('0x2'),'update'];function createListener(_0x813248,_0x4fa1db){return function(_0x3c034d){_0x4fa1db[_0xa749('0x3')](_0x813248,_0x3c034d);};}function removeListener(_0x35bc69,_0x263541){return function(){OpenchannelMessageEvents['removeListener'](_0x35bc69,_0x263541);};}exports[_0xa749('0x4')]=function(_0x334ae4){for(var _0xe73bed=0x0,_0x1d6d7c=events[_0xa749('0x5')];_0xe73bed<_0x1d6d7c;_0xe73bed++){var _0x3fc0f9=events[_0xe73bed];var _0x4ecf21=createListener(_0xa749('0x6')+_0x3fc0f9,_0x334ae4);OpenchannelMessageEvents['on'](_0x3fc0f9,_0x4ecf21);}}; \ No newline at end of file +var _0x6dfb=['length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener','register'];(function(_0x1491aa,_0x46daa2){var _0x33ebb5=function(_0x415c4e){while(--_0x415c4e){_0x1491aa['push'](_0x1491aa['shift']());}};_0x33ebb5(++_0x46daa2);}(_0x6dfb,0x14a));var _0xb6df=function(_0x4a64f1,_0x36a9d7){_0x4a64f1=_0x4a64f1-0x0;var _0x24b874=_0x6dfb[_0x4a64f1];return _0x24b874;};'use strict';var OpenchannelMessageEvents=require(_0xb6df('0x0'));var events=[_0xb6df('0x1'),_0xb6df('0x2'),'update'];function createListener(_0x3df384,_0x1cb39d){return function(_0x415319){_0x1cb39d[_0xb6df('0x3')](_0x3df384,_0x415319);};}function removeListener(_0x33b712,_0x59d0a2){return function(){OpenchannelMessageEvents[_0xb6df('0x4')](_0x33b712,_0x59d0a2);};}exports[_0xb6df('0x5')]=function(_0x1ecf28){for(var _0x33038c=0x0,_0x2df04e=events[_0xb6df('0x6')];_0x33038c<_0x2df04e;_0x33038c++){var _0x453d41=events[_0x33038c];var _0x3b66dc=createListener(_0xb6df('0x7')+_0x453d41,_0x1ecf28);OpenchannelMessageEvents['on'](_0x453d41,_0x3b66dc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 881a3b9..11cafb1 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 _0x961f=['removeAgents','exports','multer','util','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','/:id/teams','removeTeams'];(function(_0x626e85,_0xd9be0b){var _0x2334f1=function(_0xc860bd){while(--_0xc860bd){_0x626e85['push'](_0x626e85['shift']());}};_0x2334f1(++_0xd9be0b);}(_0x961f,0x147));var _0xf961=function(_0x28dd1a,_0x48ecb3){_0x28dd1a=_0x28dd1a-0x0;var _0x18d911=_0x961f[_0x28dd1a];return _0x18d911;};'use strict';var multer=require(_0xf961('0x0'));var util=require(_0xf961('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf961('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf961('0x3'));router[_0xf961('0x4')]('/',auth[_0xf961('0x5')](),controller[_0xf961('0x6')]);router[_0xf961('0x4')](_0xf961('0x7'),auth[_0xf961('0x5')](),controller['describe']);router[_0xf961('0x4')](_0xf961('0x8'),auth[_0xf961('0x5')](),controller[_0xf961('0x9')]);router[_0xf961('0x4')]('/:id/members',auth[_0xf961('0x5')](),controller[_0xf961('0xa')]);router[_0xf961('0x4')]('/:id/teams',auth[_0xf961('0x5')](),controller[_0xf961('0xb')]);router['get']('/:id/users',auth[_0xf961('0x5')](),controller[_0xf961('0xc')]);router[_0xf961('0xd')]('/',auth['isAuthenticated'](),controller[_0xf961('0xe')]);router[_0xf961('0xd')]('/:id/teams',auth[_0xf961('0x5')](),controller['addTeams']);router[_0xf961('0xd')](_0xf961('0xf'),auth[_0xf961('0x5')](),controller[_0xf961('0x10')]);router[_0xf961('0x11')](_0xf961('0x8'),auth['isAuthenticated'](),controller[_0xf961('0x12')]);router[_0xf961('0x13')]('/:id',auth[_0xf961('0x5')](),controller[_0xf961('0x14')]);router['delete'](_0xf961('0x15'),auth[_0xf961('0x5')](),controller[_0xf961('0x16')]);router[_0xf961('0x13')](_0xf961('0xf'),auth['isAuthenticated'](),controller[_0xf961('0x17')]);module[_0xf961('0x18')]=router; \ No newline at end of file +var _0xcc04=['isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1866c3,_0x4693b1){var _0x4f4758=function(_0x56ec15){while(--_0x56ec15){_0x1866c3['push'](_0x1866c3['shift']());}};_0x4f4758(++_0x4693b1);}(_0xcc04,0xfb));var _0x4cc0=function(_0xebf5,_0x3754f3){_0xebf5=_0xebf5-0x0;var _0x4c52bf=_0xcc04[_0xebf5];return _0x4c52bf;};'use strict';var multer=require(_0x4cc0('0x0'));var util=require(_0x4cc0('0x1'));var path=require(_0x4cc0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4cc0('0x3')]();var fs_extra=require(_0x4cc0('0x4'));var auth=require(_0x4cc0('0x5'));var interaction=require(_0x4cc0('0x6'));var config=require(_0x4cc0('0x7'));var controller=require('./openchannelQueue.controller');router[_0x4cc0('0x8')]('/',auth[_0x4cc0('0x9')](),controller['index']);router[_0x4cc0('0x8')]('/describe',auth[_0x4cc0('0x9')](),controller[_0x4cc0('0xa')]);router[_0x4cc0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4cc0('0xb')]);router[_0x4cc0('0x8')](_0x4cc0('0xc'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0xd')]);router['get'](_0x4cc0('0xe'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0xf')]);router['get'](_0x4cc0('0x10'),auth[_0x4cc0('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4cc0('0x11')](_0x4cc0('0xe'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0x12')]);router[_0x4cc0('0x11')](_0x4cc0('0x10'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0x13')]);router[_0x4cc0('0x14')](_0x4cc0('0x15'),auth[_0x4cc0('0x9')](),controller['update']);router[_0x4cc0('0x16')](_0x4cc0('0x15'),auth['isAuthenticated'](),controller[_0x4cc0('0x17')]);router[_0x4cc0('0x16')](_0x4cc0('0xe'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0x18')]);router[_0x4cc0('0x16')]('/:id/users',auth[_0x4cc0('0x9')](),controller[_0x4cc0('0x19')]);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 dce864d..69abfa5 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 _0x40db=['STRING','ENUM','roundrobin','sequelize','exports'];(function(_0xb5c06e,_0x49cb99){var _0xe76bde=function(_0x12ed89){while(--_0x12ed89){_0xb5c06e['push'](_0xb5c06e['shift']());}};_0xe76bde(++_0x49cb99);}(_0x40db,0x193));var _0xb40d=function(_0x2c2c7c,_0x516e0d){_0x2c2c7c=_0x2c2c7c-0x0;var _0x20bef6=_0x40db[_0x2c2c7c];return _0x20bef6;};'use strict';var Sequelize=require(_0xb40d('0x0'));module[_0xb40d('0x1')]={'name':{'type':Sequelize[_0xb40d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb40d('0x3')]('rrmemory','beepall',_0xb40d('0x4'))}}; \ No newline at end of file +var _0x7996=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x368b19,_0xcf4ad7){var _0x8ec657=function(_0x250768){while(--_0x250768){_0x368b19['push'](_0x368b19['shift']());}};_0x8ec657(++_0xcf4ad7);}(_0x7996,0x1c5));var _0x6799=function(_0x219935,_0x5b7d02){_0x219935=_0x219935-0x0;var _0x130409=_0x7996[_0x219935];return _0x130409;};'use strict';var Sequelize=require(_0x6799('0x0'));module[_0x6799('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6799('0x2')]},'timeout':{'type':Sequelize[_0x6799('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6799('0x4')]('rrmemory',_0x6799('0x5'),_0x6799('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 37cca1d..837b2ef 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 _0x692c=['stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','params','include','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','OpenchannelQueueId','findAndCountAll','UserId','updatedAt','createdAt','%s/%s','SIP','openchannelPause','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','User','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error'];(function(_0x452985,_0x1ca4af){var _0x115294=function(_0x38a74d){while(--_0x38a74d){_0x452985['push'](_0x452985['shift']());}};_0x115294(++_0x1ca4af);}(_0x692c,0x17a));var _0xc692=function(_0xab551,_0x145c86){_0xab551=_0xab551-0x0;var _0x479877=_0x692c[_0xab551];return _0x479877;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc692('0x0'));var zipdir=require(_0xc692('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc692('0x2'));var moment=require(_0xc692('0x3'));var BPromise=require(_0xc692('0x4'));var Mustache=require('mustache');var util=require(_0xc692('0x5'));var path=require('path');var sox=require(_0xc692('0x6'));var csv=require(_0xc692('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc692('0x8'));var squel=require(_0xc692('0x9'));var crypto=require(_0xc692('0xa'));var jsforce=require(_0xc692('0xb'));var deskjs=require(_0xc692('0xc'));var toCsv=require(_0xc692('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc692('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc692('0xe'));var hardwareService=require(_0xc692('0xf'));var logger=require(_0xc692('0x10'))(_0xc692('0x11'));var utils=require(_0xc692('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc692('0x13'))['db'];config['redis']=_[_0xc692('0x14')](config['redis'],{'host':_0xc692('0x15'),'port':0x18eb});var socket=require(_0xc692('0x16'))(new Redis(config[_0xc692('0x17')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x4f5487,_0x4c517a){_0x4c517a=_0x4c517a||0xcc;return function(_0xb31220){if(_0xb31220){return _0x4f5487[_0xc692('0x18')](_0x4c517a);}return _0x4f5487['status'](_0x4c517a)['end']();};}function respondWithResult(_0x4d9a08,_0x4c154b){_0x4c154b=_0x4c154b||0xc8;return function(_0x297b10){if(_0x297b10){return _0x4d9a08[_0xc692('0x19')](_0x4c154b)[_0xc692('0x1a')](_0x297b10);}};}function respondWithFilteredResult(_0x1a88ab,_0x109230){return function(_0x147890){if(_0x147890){var _0x37af0a=typeof _0x109230['offset']===_0xc692('0x1b')&&typeof _0x109230['limit']===_0xc692('0x1b');var _0x531700=_0x147890[_0xc692('0x1c')];var _0x4fdd7e=_0x37af0a?0x0:_0x109230[_0xc692('0x1d')];var _0xf23ca1=_0x37af0a?_0x147890['count']:_0x109230[_0xc692('0x1d')]+_0x109230[_0xc692('0x1e')];var _0x467ea2;if(_0xf23ca1>=_0x531700){_0xf23ca1=_0x531700;_0x467ea2=0xc8;}else{_0x467ea2=0xce;}_0x1a88ab['status'](_0x467ea2);return _0x1a88ab[_0xc692('0x1f')](_0xc692('0x20'),_0x4fdd7e+'-'+_0xf23ca1+'/'+_0x531700)['json'](_0x147890);}return null;};}function patchUpdates(_0xd98f6b){return function(_0x2b25ad){try{jsonpatch[_0xc692('0x21')](_0x2b25ad,_0xd98f6b,!![]);}catch(_0x103902){return BPromise[_0xc692('0x22')](_0x103902);}return _0x2b25ad[_0xc692('0x23')]();};}function saveUpdates(_0x574e4b,_0x2d74e2){return function(_0x31bbef){if(_0x31bbef){return _0x31bbef[_0xc692('0x24')](_0x574e4b)['then'](function(_0x1e1a22){return _0x1e1a22;});}return null;};}function removeEntity(_0x5743fa,_0x12f103){return function(_0x49f390){if(_0x49f390){return _0x49f390[_0xc692('0x25')]()[_0xc692('0x26')](function(){var _0x605c1=_0x49f390[_0xc692('0x27')]({'plain':!![]});var _0x44668b=_0xc692('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x44668b,'resourceId':_0x605c1['id']}})[_0xc692('0x26')](function(){return _0x49f390;});})['then'](function(){_0x5743fa[_0xc692('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e9f5,_0x386256){return function(_0x229115){if(!_0x229115){_0x39e9f5['sendStatus'](0x194);}return _0x229115;};}function handleError(_0x328d60,_0x21821d){_0x21821d=_0x21821d||0x1f4;return function(_0x441f30){logger[_0xc692('0x29')](_0x441f30[_0xc692('0x2a')]);if(_0x441f30[_0xc692('0x2b')]){delete _0x441f30[_0xc692('0x2b')];}_0x328d60[_0xc692('0x19')](_0x21821d)[_0xc692('0x2c')](_0x441f30);};}exports[_0xc692('0x2d')]=function(_0x2b7970,_0x24202a){var _0x338371={},_0x1332d0={},_0xce4169={'count':0x0,'rows':[]};var _0x2c6559=_[_0xc692('0x2e')](db[_0xc692('0x2f')][_0xc692('0x30')],function(_0x41b26e){return{'name':_0x41b26e[_0xc692('0x31')],'type':_0x41b26e[_0xc692('0x32')][_0xc692('0x33')]};});_0x1332d0['model']=_['map'](_0x2c6559,_0xc692('0x2b'));_0x1332d0[_0xc692('0x34')]=_[_0xc692('0x35')](_0x2b7970['query']);_0x1332d0[_0xc692('0x36')]=_[_0xc692('0x37')](_0x1332d0[_0xc692('0x38')],_0x1332d0[_0xc692('0x34')]);_0x338371[_0xc692('0x39')]=_[_0xc692('0x37')](_0x1332d0[_0xc692('0x38')],qs[_0xc692('0x3a')](_0x2b7970[_0xc692('0x34')]['fields']));_0x338371['attributes']=_0x338371['attributes'][_0xc692('0x3b')]?_0x338371[_0xc692('0x39')]:_0x1332d0[_0xc692('0x38')];if(!_0x2b7970['query'][_0xc692('0x3c')](_0xc692('0x3d'))){_0x338371[_0xc692('0x1e')]=qs['limit'](_0x2b7970[_0xc692('0x34')][_0xc692('0x1e')]);_0x338371[_0xc692('0x1d')]=qs[_0xc692('0x1d')](_0x2b7970[_0xc692('0x34')][_0xc692('0x1d')]);}_0x338371[_0xc692('0x3e')]=qs[_0xc692('0x3f')](_0x2b7970[_0xc692('0x34')]['sort']);_0x338371[_0xc692('0x40')]=qs[_0xc692('0x36')](_[_0xc692('0x41')](_0x2b7970[_0xc692('0x34')],_0x1332d0[_0xc692('0x36')]),_0x2c6559);if(_0x2b7970[_0xc692('0x34')][_0xc692('0x42')]){_0x338371[_0xc692('0x40')]=_['merge'](_0x338371[_0xc692('0x40')],{'$or':_[_0xc692('0x2e')](_0x2c6559,function(_0xe0896c){if(_0xe0896c[_0xc692('0x32')]!==_0xc692('0x43')){var _0x3bd3b2={};_0x3bd3b2[_0xe0896c['name']]={'$like':'%'+_0x2b7970[_0xc692('0x34')]['filter']+'%'};return _0x3bd3b2;}})});}_0x338371=_[_0xc692('0x44')]({},_0x338371,_0x2b7970[_0xc692('0x45')]);var _0x5da684={'where':_0x338371['where']};return db[_0xc692('0x2f')][_0xc692('0x1c')](_0x5da684)['then'](function(_0x2a379a){_0xce4169[_0xc692('0x1c')]=_0x2a379a;if(_0x2b7970[_0xc692('0x34')][_0xc692('0x46')]){_0x338371['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0xc692('0x47')](_0x338371);})[_0xc692('0x26')](function(_0x183b6b){_0xce4169['rows']=_0x183b6b;return _0xce4169;})['then'](respondWithFilteredResult(_0x24202a,_0x338371))['catch'](handleError(_0x24202a,null));};exports['show']=function(_0x2650b5,_0x420b7d){var _0x8b96c7={'raw':!![],'where':{'id':_0x2650b5[_0xc692('0x48')]['id']}},_0x517730={};_0x517730['model']=_[_0xc692('0x35')](db[_0xc692('0x2f')]['rawAttributes']);_0x517730[_0xc692('0x34')]=_['keys'](_0x2650b5['query']);_0x517730[_0xc692('0x36')]=_[_0xc692('0x37')](_0x517730[_0xc692('0x38')],_0x517730[_0xc692('0x34')]);_0x8b96c7[_0xc692('0x39')]=_[_0xc692('0x37')](_0x517730[_0xc692('0x38')],qs[_0xc692('0x3a')](_0x2650b5[_0xc692('0x34')][_0xc692('0x3a')]));_0x8b96c7['attributes']=_0x8b96c7[_0xc692('0x39')][_0xc692('0x3b')]?_0x8b96c7[_0xc692('0x39')]:_0x517730[_0xc692('0x38')];if(_0x2650b5[_0xc692('0x34')][_0xc692('0x46')]){_0x8b96c7[_0xc692('0x49')]=[{'all':!![]}];}_0x8b96c7=_[_0xc692('0x44')]({},_0x8b96c7,_0x2650b5[_0xc692('0x45')]);return db[_0xc692('0x2f')][_0xc692('0x4a')](_0x8b96c7)[_0xc692('0x26')](handleEntityNotFound(_0x420b7d,null))['then'](respondWithResult(_0x420b7d,null))[_0xc692('0x4b')](handleError(_0x420b7d,null));};exports[_0xc692('0x4c')]=function(_0x53b34c,_0x422399){return db[_0xc692('0x2f')]['create'](_0x53b34c[_0xc692('0x4d')],{})[_0xc692('0x26')](function(_0x15fd54){var _0x49100a=_0x53b34c[_0xc692('0x4e')][_0xc692('0x27')]({'plain':!![]});if(!_0x49100a)throw new Error(_0xc692('0x4f'));if(_0x49100a[_0xc692('0x50')]==='user'){var _0x38ad1d=_0x15fd54[_0xc692('0x27')]({'plain':!![]});var _0x50521=_0xc692('0x28');return db[_0xc692('0x51')][_0xc692('0x4a')]({'where':{'name':_0x50521,'userProfileId':_0x49100a[_0xc692('0x52')]},'raw':!![]})[_0xc692('0x26')](function(_0x1d830a){if(_0x1d830a&&_0x1d830a[_0xc692('0x53')]===0x0){return db[_0xc692('0x54')][_0xc692('0x4c')]({'name':_0x38ad1d[_0xc692('0x2b')],'resourceId':_0x38ad1d['id'],'type':_0x1d830a[_0xc692('0x2b')],'sectionId':_0x1d830a['id']},{})[_0xc692('0x26')](function(){return _0x15fd54;});}else{return _0x15fd54;}})[_0xc692('0x4b')](function(_0x392bde){logger[_0xc692('0x29')](_0xc692('0x55'),_0x392bde);throw _0x392bde;});}return _0x15fd54;})[_0xc692('0x26')](respondWithResult(_0x422399,0xc9))[_0xc692('0x4b')](handleError(_0x422399,null));};exports[_0xc692('0x24')]=function(_0x92eebe,_0x4cfabc){if(_0x92eebe['body']['id']){delete _0x92eebe[_0xc692('0x4d')]['id'];}return db[_0xc692('0x2f')][_0xc692('0x4a')]({'where':{'id':_0x92eebe[_0xc692('0x48')]['id']}})[_0xc692('0x26')](handleEntityNotFound(_0x4cfabc,null))[_0xc692('0x26')](saveUpdates(_0x92eebe[_0xc692('0x4d')],null))[_0xc692('0x26')](respondWithResult(_0x4cfabc,null))[_0xc692('0x4b')](handleError(_0x4cfabc,null));};exports[_0xc692('0x25')]=function(_0x47b998,_0x317018){return db[_0xc692('0x2f')]['find']({'where':{'id':_0x47b998[_0xc692('0x48')]['id']}})['then'](handleEntityNotFound(_0x317018,null))[_0xc692('0x26')](removeEntity(_0x317018,null))[_0xc692('0x4b')](handleError(_0x317018,null));};exports[_0xc692('0x56')]=function(_0x1da840,_0x48a1ba){return db['OpenchannelQueue'][_0xc692('0x56')]()[_0xc692('0x26')](respondWithResult(_0x48a1ba,null))[_0xc692('0x4b')](handleError(_0x48a1ba,null));};exports[_0xc692('0x57')]=function(_0x3879cf,_0x3fde4a,_0x9a30e9){var _0x1b093e={'raw':!![],'where':{}},_0x3a2765={},_0x3eaa51;return db[_0xc692('0x2f')][_0xc692('0x58')]({'where':{'id':_0x3879cf['params']['id']}})[_0xc692('0x26')](handleEntityNotFound(_0x3fde4a,null))['then'](function(_0x4bbb54){if(_0x4bbb54){_0x3eaa51=_0x4bbb54[_0xc692('0x27')]({'plain':!![]});_0x3a2765[_0xc692('0x38')]=_['keys'](db[_0xc692('0x59')][_0xc692('0x30')]);_0x3a2765[_0xc692('0x34')]=_[_0xc692('0x35')](_0x3879cf['query']);_0x3a2765[_0xc692('0x36')]=_[_0xc692('0x37')](_0x3a2765['model'],_0x3a2765[_0xc692('0x34')]);_0x1b093e[_0xc692('0x39')]=_[_0xc692('0x37')](_0x3a2765[_0xc692('0x38')],qs[_0xc692('0x3a')](_0x3879cf[_0xc692('0x34')][_0xc692('0x3a')]));_0x1b093e[_0xc692('0x39')]=_0x1b093e[_0xc692('0x39')][_0xc692('0x3b')]?_0x1b093e['attributes']:_0x3a2765[_0xc692('0x38')];if(!_0x3879cf[_0xc692('0x34')][_0xc692('0x3c')](_0xc692('0x3d'))){_0x1b093e[_0xc692('0x1e')]=qs[_0xc692('0x1e')](_0x3879cf[_0xc692('0x34')][_0xc692('0x1e')]);_0x1b093e['offset']=qs['offset'](_0x3879cf[_0xc692('0x34')][_0xc692('0x1d')]);}_0x1b093e[_0xc692('0x3e')]=qs['sort'](_0x3879cf['query']['sort']);_0x1b093e[_0xc692('0x40')]=qs[_0xc692('0x36')](_[_0xc692('0x41')](_0x3879cf['query'],_0x3a2765[_0xc692('0x36')]));_0x1b093e[_0xc692('0x40')][_0xc692('0x5a')]=_0x4bbb54['id'];if(_0x3879cf['query'][_0xc692('0x42')]){_0x1b093e[_0xc692('0x40')]=_['merge'](_0x1b093e['where'],{'$or':_[_0xc692('0x2e')](_0x1b093e['attributes'],function(_0x55899a){var _0x37be09={};_0x37be09[_0x55899a]={'$like':'%'+_0x3879cf['query'][_0xc692('0x42')]+'%'};return _0x37be09;})});}_0x1b093e=_['merge']({},_0x1b093e,_0x3879cf[_0xc692('0x45')]);return db['UserOpenchannelQueue'][_0xc692('0x47')](_0x1b093e);}})['then'](function(_0x2b4dc8){if(_0x2b4dc8){return db['User'][_0xc692('0x5b')]({'where':{'id':_[_0xc692('0x2e')](_0x2b4dc8,_0xc692('0x5c')),'role':'agent'},'attributes':['id','name','openchannelPause',_0xc692('0x5d'),_0xc692('0x5e')]});}})[_0xc692('0x26')](function(_0x55cad7){if(_0x55cad7){return{'count':_0x55cad7[_0xc692('0x1c')],'rows':_[_0xc692('0x2e')](_0x55cad7['rows'],function(_0x33f860){return{'membername':_0x33f860[_0xc692('0x2b')],'UserId':_0x33f860['id'],'queue_name':_0x3eaa51[_0xc692('0x2b')],'OpenchannelQueueId':_0x3eaa51['id'],'interface':util['format'](_0xc692('0x5f'),_0xc692('0x60'),_0x33f860['name']),'penalty':0x0,'paused':_0x33f860[_0xc692('0x61')],'createdAt':_0x33f860[_0xc692('0x5e')],'updatedAt':_0x33f860[_0xc692('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3fde4a,_0x1b093e))[_0xc692('0x4b')](handleError(_0x3fde4a,null));};exports['getTeams']=function(_0x55507d,_0x4d72a2,_0xcc47f8){var _0x14be1b={};var _0x361536={};var _0x4dd5d7;var _0x4079f2;return db[_0xc692('0x2f')][_0xc692('0x58')]({'where':{'id':_0x55507d[_0xc692('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d72a2,null))[_0xc692('0x26')](function(_0x32e06e){if(_0x32e06e){_0x4dd5d7=_0x32e06e;_0x361536[_0xc692('0x38')]=_[_0xc692('0x35')](db['Team'][_0xc692('0x30')]);_0x361536[_0xc692('0x34')]=_[_0xc692('0x35')](_0x55507d[_0xc692('0x34')]);_0x361536[_0xc692('0x36')]=_[_0xc692('0x37')](_0x361536[_0xc692('0x38')],_0x361536[_0xc692('0x34')]);_0x14be1b['attributes']=_[_0xc692('0x37')](_0x361536['model'],qs['fields'](_0x55507d[_0xc692('0x34')][_0xc692('0x3a')]));_0x14be1b[_0xc692('0x39')]=_0x14be1b[_0xc692('0x39')][_0xc692('0x3b')]?_0x14be1b[_0xc692('0x39')]:_0x361536['model'];_0x14be1b[_0xc692('0x3e')]=qs[_0xc692('0x3f')](_0x55507d[_0xc692('0x34')][_0xc692('0x3f')]);_0x14be1b['where']=qs[_0xc692('0x36')](_[_0xc692('0x41')](_0x55507d[_0xc692('0x34')],_0x361536[_0xc692('0x36')]));if(_0x55507d['query']['filter']){_0x14be1b[_0xc692('0x40')]=_[_0xc692('0x44')](_0x14be1b['where'],{'$or':_['map'](_0x14be1b['attributes'],function(_0x33d92e){var _0x4a3e37={};_0x4a3e37[_0x33d92e]={'$like':'%'+_0x55507d[_0xc692('0x34')]['filter']+'%'};return _0x4a3e37;})});}_0x14be1b=_[_0xc692('0x44')]({},_0x14be1b,_0x55507d[_0xc692('0x45')]);return _0x4dd5d7[_0xc692('0x62')](_0x14be1b);}})['then'](function(_0x3e51b9){if(_0x3e51b9){_0x4079f2=_0x3e51b9[_0xc692('0x3b')];if(!_0x55507d[_0xc692('0x34')][_0xc692('0x3c')](_0xc692('0x3d'))){_0x14be1b[_0xc692('0x1e')]=qs[_0xc692('0x1e')](_0x55507d[_0xc692('0x34')][_0xc692('0x1e')]);_0x14be1b[_0xc692('0x1d')]=qs['offset'](_0x55507d[_0xc692('0x34')][_0xc692('0x1d')]);}return _0x4dd5d7[_0xc692('0x62')](_0x14be1b);}})[_0xc692('0x26')](function(_0x58c734){if(_0x58c734){return _0x58c734?{'count':_0x4079f2,'rows':_0x58c734}:null;}})[_0xc692('0x26')](respondWithResult(_0x4d72a2,null))[_0xc692('0x4b')](handleError(_0x4d72a2,null));};exports[_0xc692('0x63')]=function(_0x5782fe,_0x54f833,_0x38995a){var _0x762d86=_0x5782fe['body']['ids'];return db[_0xc692('0x64')]['findAll']({'where':{'id':_0x762d86},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc692('0x65'),'attributes':['id',_0xc692('0x2b'),_0xc692('0x66'),_0xc692('0x67'),_0xc692('0x68')],'raw':!![]}]})['then'](function(_0x542820){if(_0x542820){var _0x4e39b4=_[_0xc692('0x69')](_0x542820,function(_0x23ea00){var _0x2d4e14=_0x23ea00[_0xc692('0x27')]({'plain':!![]});return _0x2d4e14[_0xc692('0x65')];});return db[_0xc692('0x2f')][_0xc692('0x4a')]({'where':{'id':_0x5782fe[_0xc692('0x48')]['id']}})['then'](function(_0x1e2c78){return db[_0xc692('0x6a')]['transaction'](function(_0x44e65d){return _0x1e2c78[_0xc692('0x63')](_0x762d86,{'transaction':_0x44e65d})[_0xc692('0x26')](function(){return BPromise[_0xc692('0x6b')](_0x4e39b4,function(_0x3af0cf){return db[_0xc692('0x59')][_0xc692('0x6c')]({'where':{'UserId':_0x3af0cf['id'],'OpenchannelQueueId':_0x5782fe[_0xc692('0x48')]['id']},'transaction':_0x44e65d});});})['then'](function(){_0x4e39b4[_0xc692('0x6d')](function(_0x404a69){socket[_0xc692('0x6e')](_0xc692('0x6f'),{'UserId':_0x404a69['id'],'OpenchannelQueueId':_0x1e2c78['id']});});});});});}})['then'](respondWithStatusCode(_0x54f833,null))['catch'](handleError(_0x54f833,null));};exports[_0xc692('0x70')]=function(_0x4bd76e,_0x4ed042,_0xec9403){return db[_0xc692('0x64')][_0xc692('0x47')]({'where':{'id':_0x4bd76e['query'][_0xc692('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc692('0x65'),'attributes':['id'],'raw':!![]}]})[_0xc692('0x26')](handleEntityNotFound(_0x4ed042,null))[_0xc692('0x26')](function(_0x1293c4){var _0x33a92e=_[_0xc692('0x2e')](_0x1293c4,'id');var _0x3dd05c=[];var _0x4cd82d=[];var _0x4cf8c7=squel['select']();_0x4cf8c7['field'](_0xc692('0x72'))['from'](_0xc692('0x73'),'tq')[_0xc692('0x74')]('user_has_teams','ut',_0xc692('0x75'))[_0xc692('0x40')](_0xc692('0x76'),_0x4bd76e[_0xc692('0x48')]['id']);for(var _0x970368=0x0;_0x970368<_0x1293c4['length'];_0x970368+=0x1){let _0x871258=_0x1293c4[_0x970368];for(var _0x19fcbe=0x0;_0x19fcbe<_0x871258[_0xc692('0x65')][_0xc692('0x3b')];_0x19fcbe+=0x1){let _0x38455f=_0x871258[_0xc692('0x65')][_0x19fcbe];var _0x1a2c99=_0x4cf8c7['clone']();_0x1a2c99[_0xc692('0x40')](_0xc692('0x77'),_0x38455f['id']);_0x4cd82d[_0xc692('0x78')](db[_0xc692('0x6a')][_0xc692('0x34')](_0x1a2c99[_0xc692('0x79')](),{'type':db[_0xc692('0x6a')][_0xc692('0x7a')][_0xc692('0x7b')]})['then'](function(_0x4609ce){if(_0x4609ce[_0xc692('0x3b')]===0x1){return _0x38455f['id'];}else{var _0x493759=_[_0xc692('0x7c')](_[_0xc692('0x2e')](_0x4609ce,_0xc692('0x7d')),function(_0xb54ddd){return _[_0xc692('0x7e')](_0x33a92e,_0xb54ddd);});if(_0x493759){return _0x38455f['id'];}}}));}}return BPromise[_0xc692('0x7f')](_0x4cd82d)['then'](function(_0x2bcd49){_0x3dd05c=_(_0x3dd05c)['union'](_0x2bcd49)[_0xc692('0x80')]()[_0xc692('0x81')]();return db[_0xc692('0x2f')][_0xc692('0x4a')]({'where':{'id':_0x4bd76e[_0xc692('0x48')]['id']}})[_0xc692('0x26')](function(_0x59fdcd){return db[_0xc692('0x6a')][_0xc692('0x82')](function(_0x393c3a){return _0x59fdcd[_0xc692('0x70')](_0x4bd76e[_0xc692('0x34')][_0xc692('0x71')],{'transaction':_0x393c3a})[_0xc692('0x26')](function(){if(!_[_0xc692('0x83')](_0x3dd05c)){return _0x59fdcd[_0xc692('0x84')](_0x3dd05c,{'transaction':_0x393c3a});}})[_0xc692('0x26')](function(){_0x3dd05c[_0xc692('0x6d')](function(_0x5d26ce){socket[_0xc692('0x6e')](_0xc692('0x85'),{'UserId':_0x5d26ce,'OpenchannelQueueId':_0x59fdcd['id']});});});});});});})[_0xc692('0x26')](respondWithStatusCode(_0x4ed042,null))[_0xc692('0x4b')](handleError(_0x4ed042,null));};exports[_0xc692('0x86')]=function(_0xbc2786,_0x11b534,_0x34cc0b){return db[_0xc692('0x2f')][_0xc692('0x4a')]({'where':{'id':_0xbc2786[_0xc692('0x48')]['id']}})[_0xc692('0x26')](handleEntityNotFound(_0x11b534,null))[_0xc692('0x26')](function(_0x3cb917){if(_0x3cb917){return _0x3cb917['addAgents'](_0xbc2786[_0xc692('0x4d')][_0xc692('0x71')],_[_0xc692('0x87')](_0xbc2786[_0xc692('0x4d')],[_0xc692('0x71'),'id'])||{})[_0xc692('0x88')](function(_0xdcd446){for(var _0x252488=0x0;_0x252488<_0xbc2786[_0xc692('0x4d')][_0xc692('0x71')][_0xc692('0x3b')];_0x252488+=0x1){socket[_0xc692('0x6e')](_0xc692('0x6f'),{'UserId':Number(_0xbc2786[_0xc692('0x4d')][_0xc692('0x71')][_0x252488]),'OpenchannelQueueId':Number(_0xbc2786['params']['id'])});}return _0xdcd446;});}})[_0xc692('0x26')](respondWithResult(_0x11b534,null))[_0xc692('0x4b')](handleError(_0x11b534,null));};exports[_0xc692('0x84')]=function(_0xcb46be,_0x52013c,_0x5419ac){return db['OpenchannelQueue'][_0xc692('0x4a')]({'where':{'id':_0xcb46be[_0xc692('0x48')]['id']}})['then'](handleEntityNotFound(_0x52013c,null))[_0xc692('0x26')](function(_0x12d26b){if(_0x12d26b){return _0x12d26b['removeAgents'](_0xcb46be[_0xc692('0x34')][_0xc692('0x71')])[_0xc692('0x26')](function(){if(_[_0xc692('0x89')](_0xcb46be['query'][_0xc692('0x71')])){for(var _0x422f9e=0x0;_0x422f9e<_0xcb46be[_0xc692('0x34')][_0xc692('0x71')][_0xc692('0x3b')];_0x422f9e+=0x1){socket[_0xc692('0x6e')](_0xc692('0x85'),{'UserId':Number(_0xcb46be[_0xc692('0x34')][_0xc692('0x71')][_0x422f9e]),'OpenchannelQueueId':Number(_0xcb46be[_0xc692('0x48')]['id'])});}}else{socket['emit'](_0xc692('0x85'),{'UserId':Number(_0xcb46be[_0xc692('0x34')]['ids']),'OpenchannelQueueId':Number(_0xcb46be['params']['id'])});}});}})[_0xc692('0x26')](respondWithStatusCode(_0x52013c,null))[_0xc692('0x4b')](handleError(_0x52013c,null));};exports[_0xc692('0x8a')]=function(_0x501312,_0x5a4b20,_0x4e037d){var _0x1bb19e={};var _0x14e0ef={};var _0x4b1640;var _0x33c602;return db['OpenchannelQueue'][_0xc692('0x58')]({'where':{'id':_0x501312[_0xc692('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a4b20,null))['then'](function(_0x4cd934){if(_0x4cd934){_0x4b1640=_0x4cd934;_0x14e0ef[_0xc692('0x38')]=_[_0xc692('0x35')](db[_0xc692('0x8b')][_0xc692('0x30')]);_0x14e0ef[_0xc692('0x34')]=_[_0xc692('0x35')](_0x501312['query']);_0x14e0ef[_0xc692('0x36')]=_[_0xc692('0x37')](_0x14e0ef[_0xc692('0x38')],_0x14e0ef[_0xc692('0x34')]);_0x1bb19e['attributes']=_[_0xc692('0x37')](_0x14e0ef['model'],qs[_0xc692('0x3a')](_0x501312[_0xc692('0x34')][_0xc692('0x3a')]));_0x1bb19e[_0xc692('0x39')]=_0x1bb19e[_0xc692('0x39')]['length']?_0x1bb19e[_0xc692('0x39')]:_0x14e0ef[_0xc692('0x38')];_0x1bb19e['order']=qs[_0xc692('0x3f')](_0x501312['query'][_0xc692('0x3f')]);_0x1bb19e['where']=qs[_0xc692('0x36')](_[_0xc692('0x41')](_0x501312[_0xc692('0x34')],_0x14e0ef[_0xc692('0x36')]));if(_0x501312[_0xc692('0x34')][_0xc692('0x42')]){_0x1bb19e['where']=_[_0xc692('0x44')](_0x1bb19e['where'],{'$or':_['map'](_0x1bb19e[_0xc692('0x39')],function(_0x43558d){var _0x33bbf1={};_0x33bbf1[_0x43558d]={'$like':'%'+_0x501312[_0xc692('0x34')][_0xc692('0x42')]+'%'};return _0x33bbf1;})});}_0x1bb19e=_[_0xc692('0x44')]({},_0x1bb19e,_0x501312['options']);return _0x4b1640[_0xc692('0x8a')](_0x1bb19e);}})['then'](function(_0xe74c49){if(_0xe74c49){_0x33c602=_0xe74c49[_0xc692('0x3b')];if(!_0x501312['query'][_0xc692('0x3c')]('nolimit')){_0x1bb19e[_0xc692('0x1e')]=qs[_0xc692('0x1e')](_0x501312['query']['limit']);_0x1bb19e[_0xc692('0x1d')]=qs['offset'](_0x501312[_0xc692('0x34')][_0xc692('0x1d')]);}return _0x4b1640[_0xc692('0x8a')](_0x1bb19e);}})[_0xc692('0x26')](function(_0x403d3d){if(_0x403d3d){return _0x403d3d?{'count':_0x33c602,'rows':_0x403d3d}:null;}})['then'](respondWithResult(_0x5a4b20,null))['catch'](handleError(_0x5a4b20,null));}; \ No newline at end of file +var _0x753f=['where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserOpenchannelQueue','order','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','%s/%s','updatedAt','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','select','field','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','every','all','union','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','end','stack','name','send','index','OpenchannelQueue','rawAttributes','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x753f,0x15b));var _0xf753=function(_0xfe4d6f,_0x1488ce){_0xfe4d6f=_0xfe4d6f-0x0;var _0x5748e5=_0x753f[_0xfe4d6f];return _0x5748e5;};'use strict';var emlformat=require(_0xf753('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf753('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf753('0x2'));var moment=require(_0xf753('0x3'));var BPromise=require(_0xf753('0x4'));var Mustache=require('mustache');var util=require(_0xf753('0x5'));var path=require(_0xf753('0x6'));var sox=require('sox');var csv=require(_0xf753('0x7'));var ejs=require(_0xf753('0x8'));var fs=require('fs');var fs_extra=require(_0xf753('0x9'));var _=require(_0xf753('0xa'));var squel=require(_0xf753('0xb'));var crypto=require(_0xf753('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf753('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf753('0xe'));var Papa=require('papaparse');var Redis=require(_0xf753('0xf'));var authService=require(_0xf753('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf753('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf753('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf753('0x13'));var licenseUtil=require(_0xf753('0x14'));var db=require(_0xf753('0x15'))['db'];config['redis']=_[_0xf753('0x16')](config[_0xf753('0x17')],{'host':_0xf753('0x18'),'port':0x18eb});var socket=require(_0xf753('0x19'))(new Redis(config[_0xf753('0x17')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x3f3d0b,_0x5d5211){_0x5d5211=_0x5d5211||0xcc;return function(_0x4b3c63){if(_0x4b3c63){return _0x3f3d0b[_0xf753('0x1a')](_0x5d5211);}return _0x3f3d0b[_0xf753('0x1b')](_0x5d5211)['end']();};}function respondWithResult(_0x432336,_0x22a67f){_0x22a67f=_0x22a67f||0xc8;return function(_0x216527){if(_0x216527){return _0x432336[_0xf753('0x1b')](_0x22a67f)[_0xf753('0x1c')](_0x216527);}};}function respondWithFilteredResult(_0x10c580,_0x55568e){return function(_0x342f84){if(_0x342f84){var _0x387b18=typeof _0x55568e[_0xf753('0x1d')]===_0xf753('0x1e')&&typeof _0x55568e[_0xf753('0x1f')]==='undefined';var _0x5976ef=_0x342f84[_0xf753('0x20')];var _0x1a7342=_0x387b18?0x0:_0x55568e[_0xf753('0x1d')];var _0x2affc6=_0x387b18?_0x342f84['count']:_0x55568e[_0xf753('0x1d')]+_0x55568e[_0xf753('0x1f')];var _0x4c1682;if(_0x2affc6>=_0x5976ef){_0x2affc6=_0x5976ef;_0x4c1682=0xc8;}else{_0x4c1682=0xce;}_0x10c580[_0xf753('0x1b')](_0x4c1682);return _0x10c580[_0xf753('0x21')](_0xf753('0x22'),_0x1a7342+'-'+_0x2affc6+'/'+_0x5976ef)['json'](_0x342f84);}return null;};}function patchUpdates(_0x30e8d5){return function(_0x3502c7){try{jsonpatch[_0xf753('0x23')](_0x3502c7,_0x30e8d5,!![]);}catch(_0x444179){return BPromise[_0xf753('0x24')](_0x444179);}return _0x3502c7[_0xf753('0x25')]();};}function saveUpdates(_0x87e81a,_0x50e6c2){return function(_0x54016a){if(_0x54016a){return _0x54016a[_0xf753('0x26')](_0x87e81a)[_0xf753('0x27')](function(_0x251145){return _0x251145;});}return null;};}function removeEntity(_0x115b05,_0x532050){return function(_0x56f578){if(_0x56f578){return _0x56f578['destroy']()[_0xf753('0x27')](function(){var _0x3cfdb4=_0x56f578[_0xf753('0x28')]({'plain':!![]});var _0x1d5748=_0xf753('0x29');return db[_0xf753('0x2a')]['destroy']({'where':{'type':_0x1d5748,'resourceId':_0x3cfdb4['id']}})['then'](function(){return _0x56f578;});})[_0xf753('0x27')](function(){_0x115b05[_0xf753('0x1b')](0xcc)[_0xf753('0x2b')]();});}};}function handleEntityNotFound(_0x463912,_0x4cc0a2){return function(_0x5b6020){if(!_0x5b6020){_0x463912[_0xf753('0x1a')](0x194);}return _0x5b6020;};}function handleError(_0x2020ba,_0x5958c9){_0x5958c9=_0x5958c9||0x1f4;return function(_0x558913){logger['error'](_0x558913[_0xf753('0x2c')]);if(_0x558913[_0xf753('0x2d')]){delete _0x558913[_0xf753('0x2d')];}_0x2020ba[_0xf753('0x1b')](_0x5958c9)[_0xf753('0x2e')](_0x558913);};}exports[_0xf753('0x2f')]=function(_0x730eab,_0x253759){var _0x280a8b={},_0x516434={},_0x3928d3={'count':0x0,'rows':[]};var _0x43bae9=_['map'](db[_0xf753('0x30')][_0xf753('0x31')],function(_0x276ee0){return{'name':_0x276ee0['fieldName'],'type':_0x276ee0[_0xf753('0x32')]['key']};});_0x516434[_0xf753('0x33')]=_[_0xf753('0x34')](_0x43bae9,_0xf753('0x2d'));_0x516434['query']=_[_0xf753('0x35')](_0x730eab[_0xf753('0x36')]);_0x516434['filters']=_[_0xf753('0x37')](_0x516434[_0xf753('0x33')],_0x516434[_0xf753('0x36')]);_0x280a8b[_0xf753('0x38')]=_[_0xf753('0x37')](_0x516434['model'],qs['fields'](_0x730eab['query'][_0xf753('0x39')]));_0x280a8b[_0xf753('0x38')]=_0x280a8b[_0xf753('0x38')][_0xf753('0x3a')]?_0x280a8b[_0xf753('0x38')]:_0x516434[_0xf753('0x33')];if(!_0x730eab[_0xf753('0x36')][_0xf753('0x3b')](_0xf753('0x3c'))){_0x280a8b[_0xf753('0x1f')]=qs[_0xf753('0x1f')](_0x730eab[_0xf753('0x36')][_0xf753('0x1f')]);_0x280a8b[_0xf753('0x1d')]=qs[_0xf753('0x1d')](_0x730eab[_0xf753('0x36')]['offset']);}_0x280a8b['order']=qs[_0xf753('0x3d')](_0x730eab['query'][_0xf753('0x3d')]);_0x280a8b['where']=qs[_0xf753('0x3e')](_['pick'](_0x730eab[_0xf753('0x36')],_0x516434[_0xf753('0x3e')]),_0x43bae9);if(_0x730eab[_0xf753('0x36')][_0xf753('0x3f')]){_0x280a8b[_0xf753('0x40')]=_['merge'](_0x280a8b[_0xf753('0x40')],{'$or':_[_0xf753('0x34')](_0x43bae9,function(_0x12efac){if(_0x12efac[_0xf753('0x32')]!=='VIRTUAL'){var _0x236f2d={};_0x236f2d[_0x12efac[_0xf753('0x2d')]]={'$like':'%'+_0x730eab[_0xf753('0x36')][_0xf753('0x3f')]+'%'};return _0x236f2d;}})});}_0x280a8b=_[_0xf753('0x41')]({},_0x280a8b,_0x730eab[_0xf753('0x42')]);var _0x4ab1a3={'where':_0x280a8b[_0xf753('0x40')]};return db[_0xf753('0x30')][_0xf753('0x20')](_0x4ab1a3)[_0xf753('0x27')](function(_0x482da9){_0x3928d3[_0xf753('0x20')]=_0x482da9;if(_0x730eab[_0xf753('0x36')][_0xf753('0x43')]){_0x280a8b[_0xf753('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xf753('0x45')](_0x280a8b);})['then'](function(_0x590023){_0x3928d3[_0xf753('0x46')]=_0x590023;return _0x3928d3;})['then'](respondWithFilteredResult(_0x253759,_0x280a8b))[_0xf753('0x47')](handleError(_0x253759,null));};exports[_0xf753('0x48')]=function(_0x2c15b2,_0x81ec99){var _0xb73b2={'raw':!![],'where':{'id':_0x2c15b2[_0xf753('0x49')]['id']}},_0x76198c={};_0x76198c[_0xf753('0x33')]=_['keys'](db['OpenchannelQueue'][_0xf753('0x31')]);_0x76198c[_0xf753('0x36')]=_['keys'](_0x2c15b2[_0xf753('0x36')]);_0x76198c[_0xf753('0x3e')]=_['intersection'](_0x76198c[_0xf753('0x33')],_0x76198c[_0xf753('0x36')]);_0xb73b2[_0xf753('0x38')]=_[_0xf753('0x37')](_0x76198c['model'],qs['fields'](_0x2c15b2['query'][_0xf753('0x39')]));_0xb73b2[_0xf753('0x38')]=_0xb73b2['attributes'][_0xf753('0x3a')]?_0xb73b2[_0xf753('0x38')]:_0x76198c[_0xf753('0x33')];if(_0x2c15b2[_0xf753('0x36')][_0xf753('0x43')]){_0xb73b2[_0xf753('0x44')]=[{'all':!![]}];}_0xb73b2=_['merge']({},_0xb73b2,_0x2c15b2[_0xf753('0x42')]);return db[_0xf753('0x30')][_0xf753('0x4a')](_0xb73b2)['then'](handleEntityNotFound(_0x81ec99,null))[_0xf753('0x27')](respondWithResult(_0x81ec99,null))[_0xf753('0x47')](handleError(_0x81ec99,null));};exports[_0xf753('0x4b')]=function(_0x3e5068,_0x395059){return db[_0xf753('0x30')][_0xf753('0x4b')](_0x3e5068['body'],{})[_0xf753('0x27')](function(_0x2c6d08){var _0x2ae546=_0x3e5068[_0xf753('0x4c')][_0xf753('0x28')]({'plain':!![]});if(!_0x2ae546)throw new Error(_0xf753('0x4d'));if(_0x2ae546[_0xf753('0x4e')]===_0xf753('0x4c')){var _0x2c8eca=_0x2c6d08['get']({'plain':!![]});var _0x2385f8=_0xf753('0x29');return db[_0xf753('0x4f')][_0xf753('0x4a')]({'where':{'name':_0x2385f8,'userProfileId':_0x2ae546['userProfileId']},'raw':!![]})[_0xf753('0x27')](function(_0x573364){if(_0x573364&&_0x573364[_0xf753('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2c8eca[_0xf753('0x2d')],'resourceId':_0x2c8eca['id'],'type':_0x573364['name'],'sectionId':_0x573364['id']},{})['then'](function(){return _0x2c6d08;});}else{return _0x2c6d08;}})[_0xf753('0x47')](function(_0x1d9a3f){logger[_0xf753('0x51')](_0xf753('0x52'),_0x1d9a3f);throw _0x1d9a3f;});}return _0x2c6d08;})[_0xf753('0x27')](respondWithResult(_0x395059,0xc9))['catch'](handleError(_0x395059,null));};exports[_0xf753('0x26')]=function(_0x5d0c0f,_0x161f64){if(_0x5d0c0f['body']['id']){delete _0x5d0c0f['body']['id'];}return db[_0xf753('0x30')]['find']({'where':{'id':_0x5d0c0f[_0xf753('0x49')]['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x161f64,null))[_0xf753('0x27')](saveUpdates(_0x5d0c0f[_0xf753('0x53')],null))['then'](respondWithResult(_0x161f64,null))['catch'](handleError(_0x161f64,null));};exports[_0xf753('0x54')]=function(_0x269519,_0xf70762){return db['OpenchannelQueue'][_0xf753('0x4a')]({'where':{'id':_0x269519[_0xf753('0x49')]['id']}})[_0xf753('0x27')](handleEntityNotFound(_0xf70762,null))[_0xf753('0x27')](removeEntity(_0xf70762,null))[_0xf753('0x47')](handleError(_0xf70762,null));};exports[_0xf753('0x55')]=function(_0x363424,_0x3d53cd){return db[_0xf753('0x30')][_0xf753('0x55')]()[_0xf753('0x27')](respondWithResult(_0x3d53cd,null))[_0xf753('0x47')](handleError(_0x3d53cd,null));};exports[_0xf753('0x56')]=function(_0x5b7565,_0x163db9,_0x37e08b){var _0x82cab1={'raw':!![],'where':{}},_0x2fd099={},_0x45fdd8;return db['OpenchannelQueue'][_0xf753('0x57')]({'where':{'id':_0x5b7565[_0xf753('0x49')]['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x163db9,null))['then'](function(_0x478ad9){if(_0x478ad9){_0x45fdd8=_0x478ad9['get']({'plain':!![]});_0x2fd099['model']=_[_0xf753('0x35')](db[_0xf753('0x58')][_0xf753('0x31')]);_0x2fd099[_0xf753('0x36')]=_['keys'](_0x5b7565[_0xf753('0x36')]);_0x2fd099[_0xf753('0x3e')]=_[_0xf753('0x37')](_0x2fd099[_0xf753('0x33')],_0x2fd099[_0xf753('0x36')]);_0x82cab1[_0xf753('0x38')]=_['intersection'](_0x2fd099[_0xf753('0x33')],qs[_0xf753('0x39')](_0x5b7565[_0xf753('0x36')][_0xf753('0x39')]));_0x82cab1['attributes']=_0x82cab1[_0xf753('0x38')]['length']?_0x82cab1[_0xf753('0x38')]:_0x2fd099[_0xf753('0x33')];if(!_0x5b7565['query']['hasOwnProperty'](_0xf753('0x3c'))){_0x82cab1[_0xf753('0x1f')]=qs[_0xf753('0x1f')](_0x5b7565[_0xf753('0x36')]['limit']);_0x82cab1[_0xf753('0x1d')]=qs['offset'](_0x5b7565['query']['offset']);}_0x82cab1[_0xf753('0x59')]=qs[_0xf753('0x3d')](_0x5b7565[_0xf753('0x36')][_0xf753('0x3d')]);_0x82cab1[_0xf753('0x40')]=qs['filters'](_[_0xf753('0x5a')](_0x5b7565[_0xf753('0x36')],_0x2fd099[_0xf753('0x3e')]));_0x82cab1['where'][_0xf753('0x5b')]=_0x478ad9['id'];if(_0x5b7565[_0xf753('0x36')][_0xf753('0x3f')]){_0x82cab1[_0xf753('0x40')]=_['merge'](_0x82cab1[_0xf753('0x40')],{'$or':_[_0xf753('0x34')](_0x82cab1[_0xf753('0x38')],function(_0x3dc63c){var _0x32db99={};_0x32db99[_0x3dc63c]={'$like':'%'+_0x5b7565[_0xf753('0x36')]['filter']+'%'};return _0x32db99;})});}_0x82cab1=_[_0xf753('0x41')]({},_0x82cab1,_0x5b7565['options']);return db[_0xf753('0x58')]['findAll'](_0x82cab1);}})[_0xf753('0x27')](function(_0x15a330){if(_0x15a330){return db[_0xf753('0x5c')][_0xf753('0x5d')]({'where':{'id':_[_0xf753('0x34')](_0x15a330,_0xf753('0x5e')),'role':_0xf753('0x5f')},'attributes':['id',_0xf753('0x2d'),_0xf753('0x60'),'updatedAt',_0xf753('0x61')]});}})[_0xf753('0x27')](function(_0x53561b){if(_0x53561b){return{'count':_0x53561b['count'],'rows':_['map'](_0x53561b[_0xf753('0x46')],function(_0x48554a){return{'membername':_0x48554a[_0xf753('0x2d')],'UserId':_0x48554a['id'],'queue_name':_0x45fdd8[_0xf753('0x2d')],'OpenchannelQueueId':_0x45fdd8['id'],'interface':util['format'](_0xf753('0x62'),'SIP',_0x48554a['name']),'penalty':0x0,'paused':_0x48554a[_0xf753('0x60')],'createdAt':_0x48554a[_0xf753('0x61')],'updatedAt':_0x48554a[_0xf753('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf753('0x27')](respondWithFilteredResult(_0x163db9,_0x82cab1))['catch'](handleError(_0x163db9,null));};exports[_0xf753('0x64')]=function(_0x163297,_0x1b1882,_0x466237){var _0x4ebeeb={};var _0x184e0c={};var _0x452fec;var _0x146b04;return db[_0xf753('0x30')][_0xf753('0x57')]({'where':{'id':_0x163297['params']['id']}})['then'](handleEntityNotFound(_0x1b1882,null))['then'](function(_0x2e732e){if(_0x2e732e){_0x452fec=_0x2e732e;_0x184e0c[_0xf753('0x33')]=_['keys'](db['Team'][_0xf753('0x31')]);_0x184e0c[_0xf753('0x36')]=_[_0xf753('0x35')](_0x163297[_0xf753('0x36')]);_0x184e0c['filters']=_[_0xf753('0x37')](_0x184e0c[_0xf753('0x33')],_0x184e0c[_0xf753('0x36')]);_0x4ebeeb[_0xf753('0x38')]=_['intersection'](_0x184e0c[_0xf753('0x33')],qs[_0xf753('0x39')](_0x163297[_0xf753('0x36')]['fields']));_0x4ebeeb['attributes']=_0x4ebeeb['attributes'][_0xf753('0x3a')]?_0x4ebeeb[_0xf753('0x38')]:_0x184e0c['model'];_0x4ebeeb[_0xf753('0x59')]=qs[_0xf753('0x3d')](_0x163297['query'][_0xf753('0x3d')]);_0x4ebeeb['where']=qs[_0xf753('0x3e')](_[_0xf753('0x5a')](_0x163297[_0xf753('0x36')],_0x184e0c[_0xf753('0x3e')]));if(_0x163297['query']['filter']){_0x4ebeeb['where']=_[_0xf753('0x41')](_0x4ebeeb[_0xf753('0x40')],{'$or':_[_0xf753('0x34')](_0x4ebeeb[_0xf753('0x38')],function(_0x372491){var _0x541f47={};_0x541f47[_0x372491]={'$like':'%'+_0x163297[_0xf753('0x36')]['filter']+'%'};return _0x541f47;})});}_0x4ebeeb=_[_0xf753('0x41')]({},_0x4ebeeb,_0x163297[_0xf753('0x42')]);return _0x452fec[_0xf753('0x64')](_0x4ebeeb);}})[_0xf753('0x27')](function(_0x59482a){if(_0x59482a){_0x146b04=_0x59482a['length'];if(!_0x163297['query'][_0xf753('0x3b')](_0xf753('0x3c'))){_0x4ebeeb['limit']=qs[_0xf753('0x1f')](_0x163297[_0xf753('0x36')]['limit']);_0x4ebeeb[_0xf753('0x1d')]=qs[_0xf753('0x1d')](_0x163297[_0xf753('0x36')][_0xf753('0x1d')]);}return _0x452fec['getTeams'](_0x4ebeeb);}})['then'](function(_0x34b808){if(_0x34b808){return _0x34b808?{'count':_0x146b04,'rows':_0x34b808}:null;}})['then'](respondWithResult(_0x1b1882,null))['catch'](handleError(_0x1b1882,null));};exports[_0xf753('0x65')]=function(_0x38d650,_0x1aab02,_0x22c2e7){var _0x401267=_0x38d650[_0xf753('0x53')][_0xf753('0x66')];return db[_0xf753('0x67')]['findAll']({'where':{'id':_0x401267},'attributes':['id'],'include':[{'model':db[_0xf753('0x5c')],'as':'Agents','attributes':['id','name',_0xf753('0x68'),_0xf753('0x69'),_0xf753('0x6a')],'raw':!![]}]})[_0xf753('0x27')](function(_0x53e91a){if(_0x53e91a){var _0x554d90=_[_0xf753('0x6b')](_0x53e91a,function(_0x33b946){var _0x11b3f2=_0x33b946['get']({'plain':!![]});return _0x11b3f2[_0xf753('0x6c')];});return db[_0xf753('0x30')][_0xf753('0x4a')]({'where':{'id':_0x38d650[_0xf753('0x49')]['id']}})[_0xf753('0x27')](function(_0x3b58fd){return db[_0xf753('0x6d')][_0xf753('0x6e')](function(_0xe7355d){return _0x3b58fd[_0xf753('0x65')](_0x401267,{'transaction':_0xe7355d})[_0xf753('0x27')](function(){return BPromise['each'](_0x554d90,function(_0xeeb777){return db[_0xf753('0x58')]['findOrCreate']({'where':{'UserId':_0xeeb777['id'],'OpenchannelQueueId':_0x38d650[_0xf753('0x49')]['id']},'transaction':_0xe7355d});});})[_0xf753('0x27')](function(){_0x554d90[_0xf753('0x6f')](function(_0x1d0bb5){socket[_0xf753('0x70')]('userOpenchannelQueue:save',{'UserId':_0x1d0bb5['id'],'OpenchannelQueueId':_0x3b58fd['id']});});});});});}})[_0xf753('0x27')](respondWithStatusCode(_0x1aab02,null))[_0xf753('0x47')](handleError(_0x1aab02,null));};exports['removeTeams']=function(_0x3167bc,_0x5878bf,_0x61fe36){return db[_0xf753('0x67')][_0xf753('0x45')]({'where':{'id':_0x3167bc['query'][_0xf753('0x66')]},'attributes':['id'],'include':[{'model':db[_0xf753('0x5c')],'as':_0xf753('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf753('0x27')](handleEntityNotFound(_0x5878bf,null))[_0xf753('0x27')](function(_0x23fede){var _0x2775ae=_[_0xf753('0x34')](_0x23fede,'id');var _0x26c98d=[];var _0x45347e=[];var _0x475f0c=squel[_0xf753('0x71')]();_0x475f0c[_0xf753('0x72')]('tq.TeamId')['from'](_0xf753('0x73'),'tq')[_0xf753('0x74')](_0xf753('0x75'),'ut',_0xf753('0x76'))[_0xf753('0x40')](_0xf753('0x77'),_0x3167bc['params']['id']);for(var _0x5b9620=0x0;_0x5b9620<_0x23fede['length'];_0x5b9620+=0x1){let _0x24c0f8=_0x23fede[_0x5b9620];for(var _0x34b8f0=0x0;_0x34b8f0<_0x24c0f8['Agents'][_0xf753('0x3a')];_0x34b8f0+=0x1){let _0x2afaff=_0x24c0f8[_0xf753('0x6c')][_0x34b8f0];var _0x9d5654=_0x475f0c[_0xf753('0x78')]();_0x9d5654[_0xf753('0x40')]('ut.UserId\x20=\x20?',_0x2afaff['id']);_0x45347e[_0xf753('0x79')](db[_0xf753('0x6d')][_0xf753('0x36')](_0x9d5654['toString'](),{'type':db['sequelize'][_0xf753('0x7a')]['SELECT']})['then'](function(_0x1e8e6c){if(_0x1e8e6c['length']===0x1){return _0x2afaff['id'];}else{var _0x39df95=_[_0xf753('0x7b')](_['map'](_0x1e8e6c,'TeamId'),function(_0xc9480b){return _['includes'](_0x2775ae,_0xc9480b);});if(_0x39df95){return _0x2afaff['id'];}}}));}}return BPromise[_0xf753('0x7c')](_0x45347e)[_0xf753('0x27')](function(_0x2ce935){_0x26c98d=_(_0x26c98d)[_0xf753('0x7d')](_0x2ce935)['compact']()[_0xf753('0x7e')]();return db['OpenchannelQueue'][_0xf753('0x4a')]({'where':{'id':_0x3167bc['params']['id']}})[_0xf753('0x27')](function(_0x3093e9){return db[_0xf753('0x6d')][_0xf753('0x6e')](function(_0x5ef213){return _0x3093e9[_0xf753('0x7f')](_0x3167bc['query'][_0xf753('0x66')],{'transaction':_0x5ef213})[_0xf753('0x27')](function(){if(!_[_0xf753('0x80')](_0x26c98d)){return _0x3093e9[_0xf753('0x81')](_0x26c98d,{'transaction':_0x5ef213});}})[_0xf753('0x27')](function(){_0x26c98d[_0xf753('0x6f')](function(_0x18f97b){socket[_0xf753('0x70')]('userOpenchannelQueue:remove',{'UserId':_0x18f97b,'OpenchannelQueueId':_0x3093e9['id']});});});});});});})[_0xf753('0x27')](respondWithStatusCode(_0x5878bf,null))['catch'](handleError(_0x5878bf,null));};exports[_0xf753('0x82')]=function(_0x459af8,_0x49dddb,_0x5ca635){return db[_0xf753('0x30')][_0xf753('0x4a')]({'where':{'id':_0x459af8['params']['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x49dddb,null))['then'](function(_0x34e772){if(_0x34e772){return _0x34e772['addAgents'](_0x459af8[_0xf753('0x53')]['ids'],_[_0xf753('0x83')](_0x459af8[_0xf753('0x53')],[_0xf753('0x66'),'id'])||{})[_0xf753('0x84')](function(_0x5653a2){for(var _0x40bac8=0x0;_0x40bac8<_0x459af8[_0xf753('0x53')][_0xf753('0x66')][_0xf753('0x3a')];_0x40bac8+=0x1){socket[_0xf753('0x70')](_0xf753('0x85'),{'UserId':Number(_0x459af8[_0xf753('0x53')][_0xf753('0x66')][_0x40bac8]),'OpenchannelQueueId':Number(_0x459af8[_0xf753('0x49')]['id'])});}return _0x5653a2;});}})['then'](respondWithResult(_0x49dddb,null))['catch'](handleError(_0x49dddb,null));};exports[_0xf753('0x81')]=function(_0x44b02a,_0x555a97,_0x2f315f){return db[_0xf753('0x30')][_0xf753('0x4a')]({'where':{'id':_0x44b02a[_0xf753('0x49')]['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x555a97,null))[_0xf753('0x27')](function(_0x37ef24){if(_0x37ef24){return _0x37ef24[_0xf753('0x81')](_0x44b02a['query'][_0xf753('0x66')])['then'](function(){if(_[_0xf753('0x86')](_0x44b02a[_0xf753('0x36')][_0xf753('0x66')])){for(var _0x2e8624=0x0;_0x2e8624<_0x44b02a[_0xf753('0x36')][_0xf753('0x66')][_0xf753('0x3a')];_0x2e8624+=0x1){socket[_0xf753('0x70')](_0xf753('0x87'),{'UserId':Number(_0x44b02a[_0xf753('0x36')][_0xf753('0x66')][_0x2e8624]),'OpenchannelQueueId':Number(_0x44b02a[_0xf753('0x49')]['id'])});}}else{socket[_0xf753('0x70')](_0xf753('0x87'),{'UserId':Number(_0x44b02a[_0xf753('0x36')]['ids']),'OpenchannelQueueId':Number(_0x44b02a[_0xf753('0x49')]['id'])});}});}})[_0xf753('0x27')](respondWithStatusCode(_0x555a97,null))[_0xf753('0x47')](handleError(_0x555a97,null));};exports[_0xf753('0x88')]=function(_0x2fae1f,_0x38f789,_0x2396df){var _0x56a4bc={};var _0x3b11e8={};var _0x22ca35;var _0x49976b;return db['OpenchannelQueue'][_0xf753('0x57')]({'where':{'id':_0x2fae1f['params']['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x38f789,null))['then'](function(_0xcf804d){if(_0xcf804d){_0x22ca35=_0xcf804d;_0x3b11e8[_0xf753('0x33')]=_['keys'](db['User'][_0xf753('0x31')]);_0x3b11e8[_0xf753('0x36')]=_[_0xf753('0x35')](_0x2fae1f[_0xf753('0x36')]);_0x3b11e8[_0xf753('0x3e')]=_[_0xf753('0x37')](_0x3b11e8[_0xf753('0x33')],_0x3b11e8[_0xf753('0x36')]);_0x56a4bc[_0xf753('0x38')]=_[_0xf753('0x37')](_0x3b11e8[_0xf753('0x33')],qs[_0xf753('0x39')](_0x2fae1f[_0xf753('0x36')][_0xf753('0x39')]));_0x56a4bc[_0xf753('0x38')]=_0x56a4bc[_0xf753('0x38')][_0xf753('0x3a')]?_0x56a4bc['attributes']:_0x3b11e8[_0xf753('0x33')];_0x56a4bc[_0xf753('0x59')]=qs[_0xf753('0x3d')](_0x2fae1f[_0xf753('0x36')]['sort']);_0x56a4bc[_0xf753('0x40')]=qs[_0xf753('0x3e')](_['pick'](_0x2fae1f[_0xf753('0x36')],_0x3b11e8[_0xf753('0x3e')]));if(_0x2fae1f['query']['filter']){_0x56a4bc[_0xf753('0x40')]=_[_0xf753('0x41')](_0x56a4bc['where'],{'$or':_[_0xf753('0x34')](_0x56a4bc[_0xf753('0x38')],function(_0x11ad21){var _0x403ef2={};_0x403ef2[_0x11ad21]={'$like':'%'+_0x2fae1f[_0xf753('0x36')]['filter']+'%'};return _0x403ef2;})});}_0x56a4bc=_['merge']({},_0x56a4bc,_0x2fae1f[_0xf753('0x42')]);return _0x22ca35[_0xf753('0x88')](_0x56a4bc);}})[_0xf753('0x27')](function(_0x4626a9){if(_0x4626a9){_0x49976b=_0x4626a9[_0xf753('0x3a')];if(!_0x2fae1f[_0xf753('0x36')]['hasOwnProperty'](_0xf753('0x3c'))){_0x56a4bc['limit']=qs[_0xf753('0x1f')](_0x2fae1f[_0xf753('0x36')]['limit']);_0x56a4bc['offset']=qs[_0xf753('0x1d')](_0x2fae1f[_0xf753('0x36')]['offset']);}return _0x22ca35[_0xf753('0x88')](_0x56a4bc);}})['then'](function(_0x2c8c5e){if(_0x2c8c5e){return _0x2c8c5e?{'count':_0x49976b,'rows':_0x2c8c5e}:null;}})[_0xf753('0x27')](respondWithResult(_0x38f789,null))['catch'](handleError(_0x38f789,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 9735ebb..aa1a90a 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 _0xfab3=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x2f4559,_0x4a72a7){var _0x51ec76=function(_0x4eece){while(--_0x4eece){_0x2f4559['push'](_0x2f4559['shift']());}};_0x51ec76(++_0x4a72a7);}(_0xfab3,0x16d));var _0x3fab=function(_0xd584f6,_0x34cfe6){_0xd584f6=_0xd584f6-0x0;var _0x5ec250=_0xfab3[_0xd584f6];return _0x5ec250;};'use strict';var EventEmitter=require(_0x3fab('0x0'));var OpenchannelQueue=require(_0x3fab('0x1'))['db'][_0x3fab('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3fab('0x3'),'afterUpdate':'update','afterDestroy':_0x3fab('0x4')};function emitEvent(_0xa78822){return function(_0x1fcfa9,_0x1b5e28,_0x40ce1b){OpenchannelQueueEvents[_0x3fab('0x5')](_0xa78822+':'+_0x1fcfa9['id'],_0x1fcfa9);OpenchannelQueueEvents['emit'](_0xa78822,_0x1fcfa9);_0x40ce1b(null);};}for(var e in events){if(events[_0x3fab('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x3fab('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x36a0=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x26c517,_0x16481a){var _0x4fe380=function(_0x231443){while(--_0x231443){_0x26c517['push'](_0x26c517['shift']());}};_0x4fe380(++_0x16481a);}(_0x36a0,0x83));var _0x036a=function(_0x400aee,_0x4f3c2b){_0x400aee=_0x400aee-0x0;var _0x40551d=_0x36a0[_0x400aee];return _0x40551d;};'use strict';var EventEmitter=require(_0x036a('0x0'));var OpenchannelQueue=require(_0x036a('0x1'))['db'][_0x036a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x036a('0x3')](0x0);var events={'afterCreate':_0x036a('0x4'),'afterUpdate':_0x036a('0x5'),'afterDestroy':_0x036a('0x6')};function emitEvent(_0x1070f9){return function(_0x462c73,_0xee8195,_0x2888d1){OpenchannelQueueEvents[_0x036a('0x7')](_0x1070f9+':'+_0x462c73['id'],_0x462c73);OpenchannelQueueEvents[_0x036a('0x7')](_0x1070f9,_0x462c73);_0x2888d1(null);};}for(var e in events){if(events[_0x036a('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x036a('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index b2a0094..9fb5f81 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 _0xb173=['util','../../config/logger','moment','request-promise','rimraf','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x2d0854,_0x4c5b12){var _0x287c91=function(_0x469aa7){while(--_0x469aa7){_0x2d0854['push'](_0x2d0854['shift']());}};_0x287c91(++_0x4c5b12);}(_0xb173,0x103));var _0x3b17=function(_0x5204d9,_0x23cdab){_0x5204d9=_0x5204d9-0x0;var _0x1825cd=_0xb173[_0x5204d9];return _0x1825cd;};'use strict';var _=require(_0x3b17('0x0'));var util=require(_0x3b17('0x1'));var logger=require(_0x3b17('0x2'))('api');var moment=require(_0x3b17('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b17('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b17('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x3b17('0x6')]=function(_0x1cc8b0,_0x4dd639){return _0x1cc8b0[_0x3b17('0x7')](_0x3b17('0x8'),attributes,{'tableName':_0x3b17('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9dc=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','lodash'];(function(_0x33be9d,_0x41618e){var _0x4a9267=function(_0x4f0e70){while(--_0x4f0e70){_0x33be9d['push'](_0x33be9d['shift']());}};_0x4a9267(++_0x41618e);}(_0xb9dc,0xbd));var _0xcb9d=function(_0x1a5870,_0x2d5cfb){_0x1a5870=_0x1a5870-0x0;var _0x1cd614=_0xb9dc[_0x1a5870];return _0x1cd614;};'use strict';var _=require(_0xcb9d('0x0'));var util=require('util');var logger=require(_0xcb9d('0x1'))(_0xcb9d('0x2'));var moment=require(_0xcb9d('0x3'));var BPromise=require(_0xcb9d('0x4'));var rp=require(_0xcb9d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb9d('0x6'));var config=require(_0xcb9d('0x7'));var attributes=require(_0xcb9d('0x8'));module['exports']=function(_0x2b54e3,_0x40d33a){return _0x2b54e3['define'](_0xcb9d('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 72e9ded..a7b3e44 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 _0x398d=['info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetOpenchannelQueue','options','raw','where','attributes','limit','include','map','model','catch','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','./openchannelQueue.socket','register','request','then'];(function(_0x4060ca,_0x5234d8){var _0x1bc049=function(_0x670f1c){while(--_0x670f1c){_0x4060ca['push'](_0x4060ca['shift']());}};_0x1bc049(++_0x5234d8);}(_0x398d,0x88));var _0xd398=function(_0x53a6b1,_0x29455b){_0x53a6b1=_0x53a6b1-0x0;var _0x358f81=_0x398d[_0x53a6b1];return _0x358f81;};'use strict';var _=require(_0xd398('0x0'));var util=require(_0xd398('0x1'));var moment=require(_0xd398('0x2'));var BPromise=require(_0xd398('0x3'));var rs=require(_0xd398('0x4'));var fs=require('fs');var Redis=require(_0xd398('0x5'));var db=require(_0xd398('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd398('0x7'));var jayson=require(_0xd398('0x8'));var client=jayson[_0xd398('0x9')][_0xd398('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd398('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd398('0xb')]));require(_0xd398('0xc'))[_0xd398('0xd')](socket);function respondWithRpcPromise(_0x313640,_0x453abe,_0x3c789d){return new BPromise(function(_0x466cf1,_0x3788e3){return client[_0xd398('0xe')](_0x313640,_0x3c789d)[_0xd398('0xf')](function(_0x27be36){logger[_0xd398('0x10')](_0xd398('0x11'),_0x453abe,'request\x20sent');logger[_0xd398('0x12')](_0xd398('0x13'),_0x453abe,_0xd398('0x14'),JSON[_0xd398('0x15')](_0x27be36));if(_0x27be36['error']){if(_0x27be36[_0xd398('0x16')][_0xd398('0x17')]===0x1f4){logger[_0xd398('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x453abe,_0x27be36['error']['message']);return _0x3788e3(_0x27be36['error'][_0xd398('0x18')]);}logger[_0xd398('0x16')](_0xd398('0x11'),_0x453abe,_0x27be36[_0xd398('0x16')][_0xd398('0x18')]);return _0x466cf1(_0x27be36['error']['message']);}else{logger[_0xd398('0x10')](_0xd398('0x11'),_0x453abe,_0xd398('0x14'));_0x466cf1(_0x27be36[_0xd398('0x19')][_0xd398('0x18')]);}})['catch'](function(_0x56f115){logger['error'](_0xd398('0x11'),_0x453abe,_0x56f115);_0x3788e3(_0x56f115);});});}exports[_0xd398('0x1a')]=function(_0x2c992a){var _0x3623c3=this;return new Promise(function(_0x383a39,_0xb8ee34){return db['OpenchannelQueue']['findAll']({'raw':_0x2c992a[_0xd398('0x1b')]?_0x2c992a['options'][_0xd398('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c992a[_0xd398('0x1b')]?_0x2c992a[_0xd398('0x1b')][_0xd398('0x1d')]||null:null,'attributes':_0x2c992a[_0xd398('0x1b')]?_0x2c992a[_0xd398('0x1b')][_0xd398('0x1e')]||null:null,'limit':_0x2c992a[_0xd398('0x1b')]?_0x2c992a[_0xd398('0x1b')][_0xd398('0x1f')]||null:null,'include':_0x2c992a[_0xd398('0x1b')]?_0x2c992a[_0xd398('0x1b')][_0xd398('0x20')]?_[_0xd398('0x21')](_0x2c992a['options'][_0xd398('0x20')],function(_0x2953ec){return{'model':db[_0x2953ec['model']],'as':_0x2953ec['as'],'attributes':_0x2953ec[_0xd398('0x1e')],'include':_0x2953ec[_0xd398('0x20')]?_[_0xd398('0x21')](_0x2953ec[_0xd398('0x20')],function(_0x35e804){return{'model':db[_0x35e804[_0xd398('0x22')]],'as':_0x35e804['as'],'attributes':_0x35e804[_0xd398('0x1e')],'include':_0x35e804['include']?_[_0xd398('0x21')](_0x35e804['include'],function(_0xf86365){return{'model':db[_0xf86365['model']],'as':_0xf86365['as'],'attributes':_0xf86365[_0xd398('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd398('0xf')](function(_0x449119){logger[_0xd398('0x10')]('GetOpenchannelQueue',_0x2c992a);logger[_0xd398('0x12')](_0xd398('0x1a'),_0x2c992a,JSON['stringify'](_0x449119));_0x383a39(_0x449119);})[_0xd398('0x23')](function(_0x1ceefe){logger[_0xd398('0x16')](_0xd398('0x1a'),_0x1ceefe[_0xd398('0x18')],_0x2c992a);_0xb8ee34(_0x3623c3[_0xd398('0x16')](0x1f4,_0x1ceefe['message']));});});};exports[_0xd398('0x24')]=function(_0x2c3bef){var _0x3f3b33=this;return new Promise(function(_0x11bc7a,_0x3612f9){return db['OpenchannelQueue'][_0xd398('0x25')]({'raw':_0x2c3bef['options']?_0x2c3bef[_0xd398('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2c3bef['options']?_0x2c3bef['options'][_0xd398('0x1d')]||null:null,'attributes':_0x2c3bef[_0xd398('0x1b')]?_0x2c3bef[_0xd398('0x1b')][_0xd398('0x1e')]||null:null,'include':_0x2c3bef[_0xd398('0x1b')]?_0x2c3bef['options'][_0xd398('0x20')]?_[_0xd398('0x21')](_0x2c3bef['options'][_0xd398('0x20')],function(_0x365289){return{'model':db[_0x365289[_0xd398('0x22')]],'as':_0x365289['as'],'attributes':_0x365289['attributes'],'include':_0x365289[_0xd398('0x20')]?_[_0xd398('0x21')](_0x365289['include'],function(_0x1f0ee1){return{'model':db[_0x1f0ee1[_0xd398('0x22')]],'as':_0x1f0ee1['as'],'attributes':_0x1f0ee1[_0xd398('0x1e')],'include':_0x1f0ee1['include']?_[_0xd398('0x21')](_0x1f0ee1[_0xd398('0x20')],function(_0x18261a){return{'model':db[_0x18261a['model']],'as':_0x18261a['as'],'attributes':_0x18261a['attributes']};}):[]};}):[]};}):[]:[]})[_0xd398('0xf')](function(_0x12fb55){logger[_0xd398('0x10')](_0xd398('0x24'),_0x2c3bef);logger[_0xd398('0x12')]('ShowOpenchannelQueue',_0x2c3bef,JSON[_0xd398('0x15')](_0x12fb55));_0x11bc7a(_0x12fb55);})[_0xd398('0x23')](function(_0x5cc8f6){logger[_0xd398('0x16')](_0xd398('0x24'),_0x5cc8f6['message'],_0x2c3bef);_0x3612f9(_0x3f3b33[_0xd398('0x16')](0x1f4,_0x5cc8f6['message']));});});}; \ No newline at end of file +var _0x8ae2=['message','result','catch','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ae2,0x66));var _0x28ae=function(_0x5a6e02,_0x3d1739){_0x5a6e02=_0x5a6e02-0x0;var _0x1913e4=_0x8ae2[_0x5a6e02];return _0x1913e4;};'use strict';var _=require(_0x28ae('0x0'));var util=require('util');var moment=require(_0x28ae('0x1'));var BPromise=require(_0x28ae('0x2'));var rs=require(_0x28ae('0x3'));var fs=require('fs');var Redis=require(_0x28ae('0x4'));var db=require(_0x28ae('0x5'))['db'];var utils=require(_0x28ae('0x6'));var logger=require(_0x28ae('0x7'))(_0x28ae('0x8'));var config=require(_0x28ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x28ae('0xa')][_0x28ae('0xb')]({'port':0x232a});config['redis']=_[_0x28ae('0xc')](config[_0x28ae('0xd')],{'host':_0x28ae('0xe'),'port':0x18eb});var socket=require(_0x28ae('0xf'))(new Redis(config[_0x28ae('0xd')]));require('./openchannelQueue.socket')[_0x28ae('0x10')](socket);function respondWithRpcPromise(_0x3a1e24,_0x2cb0e5,_0x280e0f){return new BPromise(function(_0x37e1d4,_0x25c5ab){return client[_0x28ae('0x11')](_0x3a1e24,_0x280e0f)[_0x28ae('0x12')](function(_0x4ce311){logger[_0x28ae('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x2cb0e5,'request\x20sent');logger[_0x28ae('0x14')](_0x28ae('0x15'),_0x2cb0e5,_0x28ae('0x16'),JSON[_0x28ae('0x17')](_0x4ce311));if(_0x4ce311['error']){if(_0x4ce311[_0x28ae('0x18')][_0x28ae('0x19')]===0x1f4){logger['error'](_0x28ae('0x1a'),_0x2cb0e5,_0x4ce311[_0x28ae('0x18')][_0x28ae('0x1b')]);return _0x25c5ab(_0x4ce311[_0x28ae('0x18')]['message']);}logger[_0x28ae('0x18')](_0x28ae('0x1a'),_0x2cb0e5,_0x4ce311[_0x28ae('0x18')][_0x28ae('0x1b')]);return _0x37e1d4(_0x4ce311[_0x28ae('0x18')][_0x28ae('0x1b')]);}else{logger[_0x28ae('0x13')](_0x28ae('0x1a'),_0x2cb0e5,_0x28ae('0x16'));_0x37e1d4(_0x4ce311[_0x28ae('0x1c')][_0x28ae('0x1b')]);}})[_0x28ae('0x1d')](function(_0x4e1a4f){logger[_0x28ae('0x18')](_0x28ae('0x1a'),_0x2cb0e5,_0x4e1a4f);_0x25c5ab(_0x4e1a4f);});});}exports['GetOpenchannelQueue']=function(_0x3b2e7a){var _0x2a9872=this;return new Promise(function(_0x1c909d,_0x6590b1){return db[_0x28ae('0x1e')][_0x28ae('0x1f')]({'raw':_0x3b2e7a[_0x28ae('0x20')]?_0x3b2e7a[_0x28ae('0x20')][_0x28ae('0x21')]===undefined?!![]:![]:!![],'where':_0x3b2e7a[_0x28ae('0x20')]?_0x3b2e7a[_0x28ae('0x20')][_0x28ae('0x22')]||null:null,'attributes':_0x3b2e7a[_0x28ae('0x20')]?_0x3b2e7a['options']['attributes']||null:null,'limit':_0x3b2e7a['options']?_0x3b2e7a[_0x28ae('0x20')][_0x28ae('0x23')]||null:null,'include':_0x3b2e7a[_0x28ae('0x20')]?_0x3b2e7a['options'][_0x28ae('0x24')]?_[_0x28ae('0x25')](_0x3b2e7a[_0x28ae('0x20')]['include'],function(_0x25f9d3){return{'model':db[_0x25f9d3[_0x28ae('0x26')]],'as':_0x25f9d3['as'],'attributes':_0x25f9d3[_0x28ae('0x27')],'include':_0x25f9d3[_0x28ae('0x24')]?_[_0x28ae('0x25')](_0x25f9d3[_0x28ae('0x24')],function(_0x52a6a2){return{'model':db[_0x52a6a2['model']],'as':_0x52a6a2['as'],'attributes':_0x52a6a2['attributes'],'include':_0x52a6a2[_0x28ae('0x24')]?_[_0x28ae('0x25')](_0x52a6a2[_0x28ae('0x24')],function(_0x1e6717){return{'model':db[_0x1e6717[_0x28ae('0x26')]],'as':_0x1e6717['as'],'attributes':_0x1e6717[_0x28ae('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59d448){logger[_0x28ae('0x13')](_0x28ae('0x28'),_0x3b2e7a);logger['debug'](_0x28ae('0x28'),_0x3b2e7a,JSON['stringify'](_0x59d448));_0x1c909d(_0x59d448);})[_0x28ae('0x1d')](function(_0x41a31b){logger[_0x28ae('0x18')](_0x28ae('0x28'),_0x41a31b[_0x28ae('0x1b')],_0x3b2e7a);_0x6590b1(_0x2a9872['error'](0x1f4,_0x41a31b[_0x28ae('0x1b')]));});});};exports['ShowOpenchannelQueue']=function(_0x3a9731){var _0x1a959f=this;return new Promise(function(_0x2baeca,_0x44405e){return db['OpenchannelQueue'][_0x28ae('0x29')]({'raw':_0x3a9731['options']?_0x3a9731[_0x28ae('0x20')][_0x28ae('0x21')]===undefined?!![]:![]:!![],'where':_0x3a9731[_0x28ae('0x20')]?_0x3a9731[_0x28ae('0x20')][_0x28ae('0x22')]||null:null,'attributes':_0x3a9731[_0x28ae('0x20')]?_0x3a9731[_0x28ae('0x20')][_0x28ae('0x27')]||null:null,'include':_0x3a9731[_0x28ae('0x20')]?_0x3a9731[_0x28ae('0x20')][_0x28ae('0x24')]?_['map'](_0x3a9731[_0x28ae('0x20')][_0x28ae('0x24')],function(_0x47f3d1){return{'model':db[_0x47f3d1['model']],'as':_0x47f3d1['as'],'attributes':_0x47f3d1[_0x28ae('0x27')],'include':_0x47f3d1[_0x28ae('0x24')]?_['map'](_0x47f3d1[_0x28ae('0x24')],function(_0x4a4d23){return{'model':db[_0x4a4d23['model']],'as':_0x4a4d23['as'],'attributes':_0x4a4d23[_0x28ae('0x27')],'include':_0x4a4d23['include']?_['map'](_0x4a4d23[_0x28ae('0x24')],function(_0x204fd9){return{'model':db[_0x204fd9['model']],'as':_0x204fd9['as'],'attributes':_0x204fd9[_0x28ae('0x27')]};}):[]};}):[]};}):[]:[]})[_0x28ae('0x12')](function(_0x506c73){logger[_0x28ae('0x13')](_0x28ae('0x2a'),_0x3a9731);logger[_0x28ae('0x14')](_0x28ae('0x2a'),_0x3a9731,JSON[_0x28ae('0x17')](_0x506c73));_0x2baeca(_0x506c73);})[_0x28ae('0x1d')](function(_0x5100bf){logger[_0x28ae('0x18')](_0x28ae('0x2a'),_0x5100bf[_0x28ae('0x1b')],_0x3a9731);_0x44405e(_0x1a959f['error'](0x1f4,_0x5100bf[_0x28ae('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d2b6a79..3281a62 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 _0x8b90=['openchannelQueue:','./openchannelQueue.events','save','remove','removeListener','register','length'];(function(_0x1f8246,_0x50cd78){var _0x41e27d=function(_0x39c3c8){while(--_0x39c3c8){_0x1f8246['push'](_0x1f8246['shift']());}};_0x41e27d(++_0x50cd78);}(_0x8b90,0x1a5));var _0x08b9=function(_0x1a22ef,_0x1ef6df){_0x1a22ef=_0x1a22ef-0x0;var _0x4a8226=_0x8b90[_0x1a22ef];return _0x4a8226;};'use strict';var OpenchannelQueueEvents=require(_0x08b9('0x0'));var events=[_0x08b9('0x1'),_0x08b9('0x2'),'update'];function createListener(_0x1847e5,_0x3bd1e6){return function(_0x171190){_0x3bd1e6['emit'](_0x1847e5,_0x171190);};}function removeListener(_0x45879c,_0x14a148){return function(){OpenchannelQueueEvents[_0x08b9('0x3')](_0x45879c,_0x14a148);};}exports[_0x08b9('0x4')]=function(_0x1bffa5){for(var _0x2a64f2=0x0,_0x4ecccf=events[_0x08b9('0x5')];_0x2a64f2<_0x4ecccf;_0x2a64f2++){var _0x213cb3=events[_0x2a64f2];var _0x4759a8=createListener(_0x08b9('0x6')+_0x213cb3,_0x1bffa5);OpenchannelQueueEvents['on'](_0x213cb3,_0x4759a8);}}; \ No newline at end of file +var _0x064b=['update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x338442,_0x1974d1){var _0x11179b=function(_0x5bd177){while(--_0x5bd177){_0x338442['push'](_0x338442['shift']());}};_0x11179b(++_0x1974d1);}(_0x064b,0xa6));var _0xb064=function(_0x3c5cee,_0x2639ef){_0x3c5cee=_0x3c5cee-0x0;var _0x5d7064=_0x064b[_0x3c5cee];return _0x5d7064;};'use strict';var OpenchannelQueueEvents=require(_0xb064('0x0'));var events=[_0xb064('0x1'),'remove',_0xb064('0x2')];function createListener(_0x2f91ab,_0xe6825f){return function(_0x431b33){_0xe6825f[_0xb064('0x3')](_0x2f91ab,_0x431b33);};}function removeListener(_0x5067f4,_0x2ca61b){return function(){OpenchannelQueueEvents[_0xb064('0x4')](_0x5067f4,_0x2ca61b);};}exports[_0xb064('0x5')]=function(_0x4267b){for(var _0x4cdc64=0x0,_0x39b81d=events[_0xb064('0x6')];_0x4cdc64<_0x39b81d;_0x4cdc64++){var _0x18ad3b=events[_0x4cdc64];var _0x670e9=createListener(_0xb064('0x7')+_0x18ad3b,_0x4267b);OpenchannelQueueEvents['on'](_0x18ad3b,_0x670e9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b96269b..b32fd8a 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 _0xa8b9=['post','create','put','update','delete','destroy','exports','express','Router','fs-extra','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4e992b,_0x1778a3){var _0x100346=function(_0x362860){while(--_0x362860){_0x4e992b['push'](_0x4e992b['shift']());}};_0x100346(++_0x1778a3);}(_0xa8b9,0x97));var _0x9a8b=function(_0x2866f6,_0xc44b99){_0x2866f6=_0x2866f6-0x0;var _0x3648c2=_0xa8b9[_0x2866f6];return _0x3648c2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9a8b('0x0'));var router=express[_0x9a8b('0x1')]();var fs_extra=require(_0x9a8b('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a8b('0x3'));var controller=require(_0x9a8b('0x4'));router[_0x9a8b('0x5')]('/',auth[_0x9a8b('0x6')](),controller[_0x9a8b('0x7')]);router[_0x9a8b('0x5')](_0x9a8b('0x8'),auth[_0x9a8b('0x6')](),controller['describe']);router[_0x9a8b('0x5')](_0x9a8b('0x9'),auth[_0x9a8b('0x6')](),controller[_0x9a8b('0xa')]);router[_0x9a8b('0xb')]('/',auth[_0x9a8b('0x6')](),controller[_0x9a8b('0xc')]);router[_0x9a8b('0xd')](_0x9a8b('0x9'),auth[_0x9a8b('0x6')](),controller[_0x9a8b('0xe')]);router[_0x9a8b('0xf')](_0x9a8b('0x9'),auth['isAuthenticated'](),controller[_0x9a8b('0x10')]);module[_0x9a8b('0x11')]=router; \ No newline at end of file +var _0xeaeb=['describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x1da42f,_0x23dc53){var _0x458c83=function(_0x16eb14){while(--_0x16eb14){_0x1da42f['push'](_0x1da42f['shift']());}};_0x458c83(++_0x23dc53);}(_0xeaeb,0x1ec));var _0xbeae=function(_0x85d56d,_0x37f5c1){_0x85d56d=_0x85d56d-0x0;var _0x51f613=_0xeaeb[_0x85d56d];return _0x51f613;};'use strict';var multer=require(_0xbeae('0x0'));var util=require(_0xbeae('0x1'));var path=require('path');var timeout=require(_0xbeae('0x2'));var express=require(_0xbeae('0x3'));var router=express[_0xbeae('0x4')]();var fs_extra=require(_0xbeae('0x5'));var auth=require(_0xbeae('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbeae('0x7'));router['get']('/',auth[_0xbeae('0x8')](),controller[_0xbeae('0x9')]);router[_0xbeae('0xa')](_0xbeae('0xb'),auth['isAuthenticated'](),controller[_0xbeae('0xc')]);router[_0xbeae('0xa')](_0xbeae('0xd'),auth['isAuthenticated'](),controller[_0xbeae('0xe')]);router[_0xbeae('0xf')]('/',auth['isAuthenticated'](),controller[_0xbeae('0x10')]);router[_0xbeae('0x11')](_0xbeae('0xd'),auth[_0xbeae('0x8')](),controller[_0xbeae('0x12')]);router[_0xbeae('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbeae('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9208971..20faa54 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 _0x9a6e=['DATE','moment','sequelize','STRING'];(function(_0x1ca438,_0x3d250e){var _0x4959ac=function(_0x3d8799){while(--_0x3d8799){_0x1ca438['push'](_0x1ca438['shift']());}};_0x4959ac(++_0x3d250e);}(_0x9a6e,0xc1));var _0xe9a6=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x9a6e[_0x11c573];return _0x6b72de;};'use strict';var moment=require(_0xe9a6('0x0'));var Sequelize=require(_0xe9a6('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9a6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe9a6('0x2')]},'joinAt':{'type':Sequelize[_0xe9a6('0x3')]},'leaveAt':{'type':Sequelize[_0xe9a6('0x3')]},'acceptAt':{'type':Sequelize[_0xe9a6('0x3')]},'exitAt':{'type':Sequelize[_0xe9a6('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xecc6=['sequelize','exports','STRING','DATE'];(function(_0x5ae776,_0x2a6480){var _0x49751d=function(_0x46d175){while(--_0x46d175){_0x5ae776['push'](_0x5ae776['shift']());}};_0x49751d(++_0x2a6480);}(_0xecc6,0x148));var _0x6ecc=function(_0x2721ec,_0x501561){_0x2721ec=_0x2721ec-0x0;var _0x440a36=_0xecc6[_0x2721ec];return _0x440a36;};'use strict';var moment=require('moment');var Sequelize=require(_0x6ecc('0x0'));module[_0x6ecc('0x1')]={'uniqueid':{'type':Sequelize[_0x6ecc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6ecc('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6ecc('0x3')]},'exitAt':{'type':Sequelize[_0x6ecc('0x3')]},'reason':{'type':Sequelize[_0x6ecc('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 7012998..63e71d4 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 _0xa779=['index','OpenchannelQueueReport','rawAttributes','fieldName','map','query','keys','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','catch','show','fields','includeAll','include','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send'];(function(_0x96a6d6,_0x5c5dd8){var _0xd845b1=function(_0x4b0f79){while(--_0x4b0f79){_0x96a6d6['push'](_0x96a6d6['shift']());}};_0xd845b1(++_0x5c5dd8);}(_0xa779,0x1f3));var _0x9a77=function(_0x301b89,_0x145f35){_0x301b89=_0x301b89-0x0;var _0x2c97e8=_0xa779[_0x301b89];return _0x2c97e8;};'use strict';var emlformat=require(_0x9a77('0x0'));var rimraf=require(_0x9a77('0x1'));var zipdir=require(_0x9a77('0x2'));var jsonpatch=require(_0x9a77('0x3'));var rp=require(_0x9a77('0x4'));var moment=require(_0x9a77('0x5'));var BPromise=require(_0x9a77('0x6'));var Mustache=require('mustache');var util=require(_0x9a77('0x7'));var path=require(_0x9a77('0x8'));var sox=require(_0x9a77('0x9'));var csv=require(_0x9a77('0xa'));var ejs=require(_0x9a77('0xb'));var fs=require('fs');var fs_extra=require(_0x9a77('0xc'));var _=require(_0x9a77('0xd'));var squel=require(_0x9a77('0xe'));var crypto=require(_0x9a77('0xf'));var jsforce=require(_0x9a77('0x10'));var deskjs=require(_0x9a77('0x11'));var toCsv=require(_0x9a77('0xa'));var querystring=require(_0x9a77('0x12'));var Papa=require('papaparse');var Redis=require(_0x9a77('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a77('0x14'));var hardwareService=require(_0x9a77('0x15'));var logger=require(_0x9a77('0x16'))(_0x9a77('0x17'));var utils=require(_0x9a77('0x18'));var config=require(_0x9a77('0x19'));var licenseUtil=require(_0x9a77('0x1a'));var db=require(_0x9a77('0x1b'))['db'];function respondWithStatusCode(_0x362d37,_0x18175f){_0x18175f=_0x18175f||0xcc;return function(_0x27d456){if(_0x27d456){return _0x362d37['sendStatus'](_0x18175f);}return _0x362d37[_0x9a77('0x1c')](_0x18175f)[_0x9a77('0x1d')]();};}function respondWithResult(_0x576187,_0xbb31c6){_0xbb31c6=_0xbb31c6||0xc8;return function(_0x6218d){if(_0x6218d){return _0x576187['status'](_0xbb31c6)[_0x9a77('0x1e')](_0x6218d);}};}function respondWithFilteredResult(_0x24a780,_0x1715c0){return function(_0x156dbc){if(_0x156dbc){var _0x44f7b8=typeof _0x1715c0['offset']==='undefined'&&typeof _0x1715c0['limit']===_0x9a77('0x1f');var _0x500e01=_0x156dbc[_0x9a77('0x20')];var _0x16df51=_0x44f7b8?0x0:_0x1715c0[_0x9a77('0x21')];var _0x1c7883=_0x44f7b8?_0x156dbc['count']:_0x1715c0[_0x9a77('0x21')]+_0x1715c0[_0x9a77('0x22')];var _0x3f5829;if(_0x1c7883>=_0x500e01){_0x1c7883=_0x500e01;_0x3f5829=0xc8;}else{_0x3f5829=0xce;}_0x24a780[_0x9a77('0x1c')](_0x3f5829);return _0x24a780[_0x9a77('0x23')](_0x9a77('0x24'),_0x16df51+'-'+_0x1c7883+'/'+_0x500e01)['json'](_0x156dbc);}return null;};}function patchUpdates(_0x26cf10){return function(_0x3f4996){try{jsonpatch[_0x9a77('0x25')](_0x3f4996,_0x26cf10,!![]);}catch(_0x4b1408){return BPromise[_0x9a77('0x26')](_0x4b1408);}return _0x3f4996[_0x9a77('0x27')]();};}function saveUpdates(_0x51b130,_0x5ef71f){return function(_0x580492){if(_0x580492){return _0x580492[_0x9a77('0x28')](_0x51b130)[_0x9a77('0x29')](function(_0x2bb4f0){return _0x2bb4f0;});}return null;};}function removeEntity(_0x143c72,_0x41a652){return function(_0x17ca2e){if(_0x17ca2e){return _0x17ca2e[_0x9a77('0x2a')]()['then'](function(){_0x143c72['status'](0xcc)[_0x9a77('0x1d')]();});}};}function handleEntityNotFound(_0x384e26,_0x5f3ea1){return function(_0x18764e){if(!_0x18764e){_0x384e26[_0x9a77('0x2b')](0x194);}return _0x18764e;};}function handleError(_0x2959d1,_0xfc7654){_0xfc7654=_0xfc7654||0x1f4;return function(_0x443c2b){logger['error'](_0x443c2b[_0x9a77('0x2c')]);if(_0x443c2b[_0x9a77('0x2d')]){delete _0x443c2b[_0x9a77('0x2d')];}_0x2959d1[_0x9a77('0x1c')](_0xfc7654)[_0x9a77('0x2e')](_0x443c2b);};}exports[_0x9a77('0x2f')]=function(_0x1ee2e8,_0x588066){var _0x59d97b={},_0x12500c={},_0x4e2470={'count':0x0,'rows':[]};var _0x1dac08=_['map'](db[_0x9a77('0x30')][_0x9a77('0x31')],function(_0x2771a7){return{'name':_0x2771a7[_0x9a77('0x32')],'type':_0x2771a7['type']['key']};});_0x12500c['model']=_[_0x9a77('0x33')](_0x1dac08,_0x9a77('0x2d'));_0x12500c[_0x9a77('0x34')]=_[_0x9a77('0x35')](_0x1ee2e8[_0x9a77('0x34')]);_0x12500c['filters']=_[_0x9a77('0x36')](_0x12500c['model'],_0x12500c[_0x9a77('0x34')]);_0x59d97b[_0x9a77('0x37')]=_['intersection'](_0x12500c['model'],qs['fields'](_0x1ee2e8[_0x9a77('0x34')]['fields']));_0x59d97b['attributes']=_0x59d97b['attributes'][_0x9a77('0x38')]?_0x59d97b[_0x9a77('0x37')]:_0x12500c[_0x9a77('0x39')];if(!_0x1ee2e8[_0x9a77('0x34')][_0x9a77('0x3a')](_0x9a77('0x3b'))){_0x59d97b['limit']=qs[_0x9a77('0x22')](_0x1ee2e8[_0x9a77('0x34')][_0x9a77('0x22')]);_0x59d97b[_0x9a77('0x21')]=qs['offset'](_0x1ee2e8[_0x9a77('0x34')][_0x9a77('0x21')]);}_0x59d97b[_0x9a77('0x3c')]=qs['sort'](_0x1ee2e8[_0x9a77('0x34')][_0x9a77('0x3d')]);_0x59d97b[_0x9a77('0x3e')]=qs[_0x9a77('0x3f')](_[_0x9a77('0x40')](_0x1ee2e8[_0x9a77('0x34')],_0x12500c[_0x9a77('0x3f')]),_0x1dac08);if(_0x1ee2e8['query'][_0x9a77('0x41')]){_0x59d97b[_0x9a77('0x3e')]=_[_0x9a77('0x42')](_0x59d97b['where'],{'$or':_[_0x9a77('0x33')](_0x1dac08,function(_0x5b57e8){if(_0x5b57e8[_0x9a77('0x43')]!=='VIRTUAL'){var _0x5890b3={};_0x5890b3[_0x5b57e8[_0x9a77('0x2d')]]={'$like':'%'+_0x1ee2e8[_0x9a77('0x34')]['filter']+'%'};return _0x5890b3;}})});}_0x59d97b=_[_0x9a77('0x42')]({},_0x59d97b,_0x1ee2e8[_0x9a77('0x44')]);var _0x669a83={'where':_0x59d97b[_0x9a77('0x3e')]};return db[_0x9a77('0x30')][_0x9a77('0x20')](_0x669a83)[_0x9a77('0x29')](function(_0x46be78){_0x4e2470[_0x9a77('0x20')]=_0x46be78;if(_0x1ee2e8[_0x9a77('0x34')]['includeAll']){_0x59d97b['include']=[{'all':!![]}];}return db[_0x9a77('0x30')]['findAll'](_0x59d97b);})[_0x9a77('0x29')](function(_0x37e1f1){_0x4e2470['rows']=_0x37e1f1;return _0x4e2470;})[_0x9a77('0x29')](respondWithFilteredResult(_0x588066,_0x59d97b))[_0x9a77('0x45')](handleError(_0x588066,null));};exports[_0x9a77('0x46')]=function(_0x25ae20,_0x2322f3){var _0x4bf5fd={'raw':!![],'where':{'id':_0x25ae20['params']['id']}},_0x530660={};_0x530660['model']=_[_0x9a77('0x35')](db[_0x9a77('0x30')][_0x9a77('0x31')]);_0x530660[_0x9a77('0x34')]=_['keys'](_0x25ae20[_0x9a77('0x34')]);_0x530660[_0x9a77('0x3f')]=_['intersection'](_0x530660[_0x9a77('0x39')],_0x530660[_0x9a77('0x34')]);_0x4bf5fd['attributes']=_[_0x9a77('0x36')](_0x530660[_0x9a77('0x39')],qs[_0x9a77('0x47')](_0x25ae20[_0x9a77('0x34')]['fields']));_0x4bf5fd[_0x9a77('0x37')]=_0x4bf5fd[_0x9a77('0x37')][_0x9a77('0x38')]?_0x4bf5fd[_0x9a77('0x37')]:_0x530660[_0x9a77('0x39')];if(_0x25ae20['query'][_0x9a77('0x48')]){_0x4bf5fd[_0x9a77('0x49')]=[{'all':!![]}];}_0x4bf5fd=_[_0x9a77('0x42')]({},_0x4bf5fd,_0x25ae20[_0x9a77('0x44')]);return db[_0x9a77('0x30')][_0x9a77('0x4a')](_0x4bf5fd)[_0x9a77('0x29')](handleEntityNotFound(_0x2322f3,null))[_0x9a77('0x29')](respondWithResult(_0x2322f3,null))[_0x9a77('0x45')](handleError(_0x2322f3,null));};exports['create']=function(_0x4a9d08,_0x59b1ed){return db[_0x9a77('0x30')]['create'](_0x4a9d08[_0x9a77('0x4b')],{})[_0x9a77('0x29')](respondWithResult(_0x59b1ed,0xc9))[_0x9a77('0x45')](handleError(_0x59b1ed,null));};exports[_0x9a77('0x28')]=function(_0xa6ba8b,_0x414bca){if(_0xa6ba8b['body']['id']){delete _0xa6ba8b['body']['id'];}return db[_0x9a77('0x30')][_0x9a77('0x4a')]({'where':{'id':_0xa6ba8b[_0x9a77('0x4c')]['id']}})[_0x9a77('0x29')](handleEntityNotFound(_0x414bca,null))[_0x9a77('0x29')](saveUpdates(_0xa6ba8b[_0x9a77('0x4b')],null))[_0x9a77('0x29')](respondWithResult(_0x414bca,null))[_0x9a77('0x45')](handleError(_0x414bca,null));};exports[_0x9a77('0x2a')]=function(_0x2ae881,_0x1b1141){return db[_0x9a77('0x30')][_0x9a77('0x4a')]({'where':{'id':_0x2ae881['params']['id']}})[_0x9a77('0x29')](handleEntityNotFound(_0x1b1141,null))['then'](removeEntity(_0x1b1141,null))[_0x9a77('0x45')](handleError(_0x1b1141,null));};exports[_0x9a77('0x4d')]=function(_0x5a1424,_0x4eb5a5){return db['OpenchannelQueueReport'][_0x9a77('0x4d')]()[_0x9a77('0x29')](respondWithResult(_0x4eb5a5,null))[_0x9a77('0x45')](handleError(_0x4eb5a5,null));}; \ No newline at end of file +var _0x8561=['describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy'];(function(_0x3a946c,_0x38e13c){var _0x41bd2e=function(_0x453a76){while(--_0x453a76){_0x3a946c['push'](_0x3a946c['shift']());}};_0x41bd2e(++_0x38e13c);}(_0x8561,0x1b7));var _0x1856=function(_0x248d46,_0xba08ec){_0x248d46=_0x248d46-0x0;var _0x354942=_0x8561[_0x248d46];return _0x354942;};'use strict';var emlformat=require(_0x1856('0x0'));var rimraf=require(_0x1856('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1856('0x2'));var rp=require('request-promise');var moment=require(_0x1856('0x3'));var BPromise=require(_0x1856('0x4'));var Mustache=require(_0x1856('0x5'));var util=require(_0x1856('0x6'));var path=require(_0x1856('0x7'));var sox=require(_0x1856('0x8'));var csv=require(_0x1856('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1856('0xa'));var crypto=require(_0x1856('0xb'));var jsforce=require(_0x1856('0xc'));var deskjs=require(_0x1856('0xd'));var toCsv=require(_0x1856('0x9'));var querystring=require(_0x1856('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1856('0xf'));var qs=require(_0x1856('0x10'));var as=require(_0x1856('0x11'));var hardwareService=require(_0x1856('0x12'));var logger=require(_0x1856('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1856('0x14'));var licenseUtil=require(_0x1856('0x15'));var db=require(_0x1856('0x16'))['db'];function respondWithStatusCode(_0x116838,_0x13e329){_0x13e329=_0x13e329||0xcc;return function(_0x49dca5){if(_0x49dca5){return _0x116838[_0x1856('0x17')](_0x13e329);}return _0x116838[_0x1856('0x18')](_0x13e329)[_0x1856('0x19')]();};}function respondWithResult(_0x44a81d,_0x2b00d5){_0x2b00d5=_0x2b00d5||0xc8;return function(_0x5e80f8){if(_0x5e80f8){return _0x44a81d[_0x1856('0x18')](_0x2b00d5)[_0x1856('0x1a')](_0x5e80f8);}};}function respondWithFilteredResult(_0xbaa1f5,_0x8ddf46){return function(_0x29407a){if(_0x29407a){var _0x659158=typeof _0x8ddf46[_0x1856('0x1b')]==='undefined'&&typeof _0x8ddf46[_0x1856('0x1c')]===_0x1856('0x1d');var _0x17a06e=_0x29407a[_0x1856('0x1e')];var _0x442f5a=_0x659158?0x0:_0x8ddf46[_0x1856('0x1b')];var _0x23fa10=_0x659158?_0x29407a['count']:_0x8ddf46['offset']+_0x8ddf46[_0x1856('0x1c')];var _0x416891;if(_0x23fa10>=_0x17a06e){_0x23fa10=_0x17a06e;_0x416891=0xc8;}else{_0x416891=0xce;}_0xbaa1f5[_0x1856('0x18')](_0x416891);return _0xbaa1f5[_0x1856('0x1f')](_0x1856('0x20'),_0x442f5a+'-'+_0x23fa10+'/'+_0x17a06e)[_0x1856('0x1a')](_0x29407a);}return null;};}function patchUpdates(_0x134007){return function(_0x4cf2ab){try{jsonpatch[_0x1856('0x21')](_0x4cf2ab,_0x134007,!![]);}catch(_0x5801ae){return BPromise[_0x1856('0x22')](_0x5801ae);}return _0x4cf2ab[_0x1856('0x23')]();};}function saveUpdates(_0x31d325,_0x35aeec){return function(_0x2d8ac3){if(_0x2d8ac3){return _0x2d8ac3[_0x1856('0x24')](_0x31d325)[_0x1856('0x25')](function(_0x56dbbc){return _0x56dbbc;});}return null;};}function removeEntity(_0x821664,_0x3623b4){return function(_0x2b9f5c){if(_0x2b9f5c){return _0x2b9f5c['destroy']()['then'](function(){_0x821664[_0x1856('0x18')](0xcc)[_0x1856('0x19')]();});}};}function handleEntityNotFound(_0x15e7f7,_0x150669){return function(_0x54d45b){if(!_0x54d45b){_0x15e7f7['sendStatus'](0x194);}return _0x54d45b;};}function handleError(_0x17985a,_0xbb316f){_0xbb316f=_0xbb316f||0x1f4;return function(_0x389db1){logger['error'](_0x389db1[_0x1856('0x26')]);if(_0x389db1[_0x1856('0x27')]){delete _0x389db1['name'];}_0x17985a['status'](_0xbb316f)['send'](_0x389db1);};}exports['index']=function(_0x1547ab,_0x2785c2){var _0x3f58a6={},_0xc2d9b0={},_0x5ac8e9={'count':0x0,'rows':[]};var _0x3b02b6=_[_0x1856('0x28')](db[_0x1856('0x29')][_0x1856('0x2a')],function(_0x75c33a){return{'name':_0x75c33a[_0x1856('0x2b')],'type':_0x75c33a[_0x1856('0x2c')]['key']};});_0xc2d9b0[_0x1856('0x2d')]=_[_0x1856('0x28')](_0x3b02b6,'name');_0xc2d9b0['query']=_['keys'](_0x1547ab['query']);_0xc2d9b0[_0x1856('0x2e')]=_[_0x1856('0x2f')](_0xc2d9b0[_0x1856('0x2d')],_0xc2d9b0['query']);_0x3f58a6[_0x1856('0x30')]=_[_0x1856('0x2f')](_0xc2d9b0['model'],qs[_0x1856('0x31')](_0x1547ab[_0x1856('0x32')][_0x1856('0x31')]));_0x3f58a6[_0x1856('0x30')]=_0x3f58a6[_0x1856('0x30')][_0x1856('0x33')]?_0x3f58a6[_0x1856('0x30')]:_0xc2d9b0['model'];if(!_0x1547ab[_0x1856('0x32')][_0x1856('0x34')]('nolimit')){_0x3f58a6['limit']=qs[_0x1856('0x1c')](_0x1547ab[_0x1856('0x32')]['limit']);_0x3f58a6['offset']=qs[_0x1856('0x1b')](_0x1547ab[_0x1856('0x32')][_0x1856('0x1b')]);}_0x3f58a6[_0x1856('0x35')]=qs['sort'](_0x1547ab['query'][_0x1856('0x36')]);_0x3f58a6[_0x1856('0x37')]=qs['filters'](_[_0x1856('0x38')](_0x1547ab[_0x1856('0x32')],_0xc2d9b0[_0x1856('0x2e')]),_0x3b02b6);if(_0x1547ab[_0x1856('0x32')]['filter']){_0x3f58a6[_0x1856('0x37')]=_[_0x1856('0x39')](_0x3f58a6[_0x1856('0x37')],{'$or':_[_0x1856('0x28')](_0x3b02b6,function(_0x2e6e49){if(_0x2e6e49['type']!=='VIRTUAL'){var _0x263568={};_0x263568[_0x2e6e49[_0x1856('0x27')]]={'$like':'%'+_0x1547ab[_0x1856('0x32')][_0x1856('0x3a')]+'%'};return _0x263568;}})});}_0x3f58a6=_[_0x1856('0x39')]({},_0x3f58a6,_0x1547ab[_0x1856('0x3b')]);var _0x3173a5={'where':_0x3f58a6[_0x1856('0x37')]};return db[_0x1856('0x29')][_0x1856('0x1e')](_0x3173a5)[_0x1856('0x25')](function(_0x27232d){_0x5ac8e9['count']=_0x27232d;if(_0x1547ab[_0x1856('0x32')][_0x1856('0x3c')]){_0x3f58a6[_0x1856('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x1856('0x3e')](_0x3f58a6);})['then'](function(_0x594010){_0x5ac8e9[_0x1856('0x3f')]=_0x594010;return _0x5ac8e9;})[_0x1856('0x25')](respondWithFilteredResult(_0x2785c2,_0x3f58a6))[_0x1856('0x40')](handleError(_0x2785c2,null));};exports[_0x1856('0x41')]=function(_0x464e03,_0x1dd5d7){var _0x2f32bd={'raw':!![],'where':{'id':_0x464e03[_0x1856('0x42')]['id']}},_0x2e4d89={};_0x2e4d89[_0x1856('0x2d')]=_[_0x1856('0x43')](db['OpenchannelQueueReport'][_0x1856('0x2a')]);_0x2e4d89[_0x1856('0x32')]=_['keys'](_0x464e03[_0x1856('0x32')]);_0x2e4d89[_0x1856('0x2e')]=_['intersection'](_0x2e4d89[_0x1856('0x2d')],_0x2e4d89[_0x1856('0x32')]);_0x2f32bd[_0x1856('0x30')]=_[_0x1856('0x2f')](_0x2e4d89[_0x1856('0x2d')],qs[_0x1856('0x31')](_0x464e03['query'][_0x1856('0x31')]));_0x2f32bd[_0x1856('0x30')]=_0x2f32bd['attributes']['length']?_0x2f32bd['attributes']:_0x2e4d89['model'];if(_0x464e03[_0x1856('0x32')][_0x1856('0x3c')]){_0x2f32bd[_0x1856('0x3d')]=[{'all':!![]}];}_0x2f32bd=_['merge']({},_0x2f32bd,_0x464e03[_0x1856('0x3b')]);return db['OpenchannelQueueReport'][_0x1856('0x44')](_0x2f32bd)[_0x1856('0x25')](handleEntityNotFound(_0x1dd5d7,null))['then'](respondWithResult(_0x1dd5d7,null))['catch'](handleError(_0x1dd5d7,null));};exports[_0x1856('0x45')]=function(_0x257436,_0x160412){return db[_0x1856('0x29')][_0x1856('0x45')](_0x257436[_0x1856('0x46')],{})[_0x1856('0x25')](respondWithResult(_0x160412,0xc9))[_0x1856('0x40')](handleError(_0x160412,null));};exports[_0x1856('0x24')]=function(_0x572490,_0x1a16fb){if(_0x572490[_0x1856('0x46')]['id']){delete _0x572490[_0x1856('0x46')]['id'];}return db[_0x1856('0x29')]['find']({'where':{'id':_0x572490['params']['id']}})[_0x1856('0x25')](handleEntityNotFound(_0x1a16fb,null))['then'](saveUpdates(_0x572490[_0x1856('0x46')],null))[_0x1856('0x25')](respondWithResult(_0x1a16fb,null))['catch'](handleError(_0x1a16fb,null));};exports[_0x1856('0x47')]=function(_0x5e0ac8,_0x3f1e83){return db[_0x1856('0x29')][_0x1856('0x44')]({'where':{'id':_0x5e0ac8['params']['id']}})[_0x1856('0x25')](handleEntityNotFound(_0x3f1e83,null))[_0x1856('0x25')](removeEntity(_0x3f1e83,null))[_0x1856('0x40')](handleError(_0x3f1e83,null));};exports[_0x1856('0x48')]=function(_0x390499,_0x4fb1aa){return db[_0x1856('0x29')]['describe']()['then'](respondWithResult(_0x4fb1aa,null))[_0x1856('0x40')](handleError(_0x4fb1aa,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 5e36e6a..30e5b9c 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x4005b2,_0x1fe448){var _0x2ab573=function(_0x330b94){while(--_0x330b94){_0x4005b2['push'](_0x4005b2['shift']());}};_0x2ab573(++_0x1fe448);}(_0x1261,0x144));var _0x1126=function(_0x5a30fb,_0x206270){_0x5a30fb=_0x5a30fb-0x0;var _0x3b86aa=_0x1261[_0x5a30fb];return _0x3b86aa;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x17f117,_0x5144c6){var _0x50d150=function(_0x36e70f){while(--_0x36e70f){_0x17f117['push'](_0x17f117['shift']());}};_0x50d150(++_0x5144c6);}(_0x1261,0x144));var _0x1126=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x1261[_0x432fca];return _0x3adba4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ea1290f..d229bba 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 _0xfcbb=['body','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update'];(function(_0x2aa866,_0x14443a){var _0x47456c=function(_0x7e638f){while(--_0x7e638f){_0x2aa866['push'](_0x2aa866['shift']());}};_0x47456c(++_0x14443a);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x5286f5,_0x49878c){_0x5286f5=_0x5286f5-0x0;var _0x41d1f5=_0xfcbb[_0x5286f5];return _0x41d1f5;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateOpenchannelQueueReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1a')]=function(_0x19616c){var _0x69c8e9=this;return new Promise(function(_0x14e43c,_0x11f6f7){return db[_0xbfcb('0x17')][_0xbfcb('0x1b')](_0x19616c[_0xbfcb('0x1c')],{'raw':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1e')]||null:null,'attributes':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1f')]||null:null,'limit':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x20')]||null:null})[_0xbfcb('0xa')](function(_0x3542e9){logger[_0xbfcb('0xb')](_0xbfcb('0x1a'),_0x19616c);logger[_0xbfcb('0xd')](_0xbfcb('0x1a'),_0x19616c,JSON['stringify'](_0x3542e9));_0x14e43c(_0x3542e9);})[_0xbfcb('0x15')](function(_0x3aa3cd){logger[_0xbfcb('0x10')](_0xbfcb('0x1a'),_0x3aa3cd[_0xbfcb('0x13')],_0x19616c);_0x11f6f7(_0x69c8e9[_0xbfcb('0x10')](0x1f4,_0x3aa3cd[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0xae60=['rpc','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xae60,0x1c7));var _0x0ae6=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xae60[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});}exports[_0x0ae6('0x17')]=function(_0xda4f01){var _0x3f5c41=this;return new Promise(function(_0x2fdf25,_0x1735ba){return db[_0x0ae6('0x18')][_0x0ae6('0x19')](_0xda4f01[_0x0ae6('0x1a')],{'raw':_0xda4f01[_0x0ae6('0x1b')]?_0xda4f01['options'][_0x0ae6('0x1c')]===undefined?!![]:![]:!![]})[_0x0ae6('0xb')](function(_0x140a3b){logger[_0x0ae6('0xc')](_0x0ae6('0x17'),_0xda4f01);logger[_0x0ae6('0xe')](_0x0ae6('0x17'),_0xda4f01,JSON[_0x0ae6('0x11')](_0x140a3b));_0x2fdf25(_0x140a3b);})['catch'](function(_0x39b22e){logger[_0x0ae6('0x12')](_0x0ae6('0x17'),_0x39b22e[_0x0ae6('0x14')],_0xda4f01);_0x1735ba(_0x3f5c41[_0x0ae6('0x12')](0x1f4,_0x39b22e['message']));});});};exports[_0x0ae6('0x1d')]=function(_0x4e1242){var _0xccd1c5=this;return new Promise(function(_0x3955d8,_0x3c43d8){return db[_0x0ae6('0x18')]['update'](_0x4e1242[_0x0ae6('0x1a')],{'raw':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242[_0x0ae6('0x1b')][_0x0ae6('0x1e')]||null:null,'attributes':_0x4e1242['options']?_0x4e1242[_0x0ae6('0x1b')][_0x0ae6('0x1f')]||null:null,'limit':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242['options'][_0x0ae6('0x20')]||null:null})[_0x0ae6('0xb')](function(_0x449c33){logger[_0x0ae6('0xc')](_0x0ae6('0x1d'),_0x4e1242);logger[_0x0ae6('0xe')]('UpdateOpenchannelQueueReport',_0x4e1242,JSON['stringify'](_0x449c33));_0x3955d8(_0x449c33);})[_0x0ae6('0x16')](function(_0x419384){logger['error']('UpdateOpenchannelQueueReport',_0x419384[_0x0ae6('0x14')],_0x4e1242);_0x3c43d8(_0xccd1c5[_0x0ae6('0x12')](0x1f4,_0x419384[_0x0ae6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8586c46..3e0d0d3 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 _0x1ee9=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x573367,_0x4548d0){var _0x310f32=function(_0x3f60a6){while(--_0x3f60a6){_0x573367['push'](_0x573367['shift']());}};_0x310f32(++_0x4548d0);}(_0x1ee9,0x125));var _0x91ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ee9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x91ee('0x0'));var util=require('util');var path=require(_0x91ee('0x1'));var timeout=require(_0x91ee('0x2'));var express=require('express');var router=express[_0x91ee('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x91ee('0x4'));router[_0x91ee('0x5')]('/',auth[_0x91ee('0x6')](),controller[_0x91ee('0x7')]);router[_0x91ee('0x5')](_0x91ee('0x8'),auth[_0x91ee('0x6')](),controller[_0x91ee('0x9')]);router[_0x91ee('0x5')](_0x91ee('0xa'),auth[_0x91ee('0x6')](),controller['show']);router[_0x91ee('0xb')]('/',auth['isAuthenticated'](),controller[_0x91ee('0xc')]);router[_0x91ee('0xd')](_0x91ee('0xa'),auth[_0x91ee('0x6')](),controller[_0x91ee('0xe')]);router[_0x91ee('0xf')](_0x91ee('0xa'),auth['isAuthenticated'](),controller[_0x91ee('0x10')]);module[_0x91ee('0x11')]=router; \ No newline at end of file +var _0x4199=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x364322,_0x1644c6){var _0x1517e5=function(_0x4e118f){while(--_0x4e118f){_0x364322['push'](_0x364322['shift']());}};_0x1517e5(++_0x1644c6);}(_0x4199,0x86));var _0x9419=function(_0x5d2796,_0x3e2234){_0x5d2796=_0x5d2796-0x0;var _0x4ea88a=_0x4199[_0x5d2796];return _0x4ea88a;};'use strict';var multer=require(_0x9419('0x0'));var util=require(_0x9419('0x1'));var path=require(_0x9419('0x2'));var timeout=require(_0x9419('0x3'));var express=require(_0x9419('0x4'));var router=express[_0x9419('0x5')]();var fs_extra=require(_0x9419('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9419('0x7'));var config=require(_0x9419('0x8'));var controller=require(_0x9419('0x9'));router[_0x9419('0xa')]('/',auth[_0x9419('0xb')](),controller['index']);router[_0x9419('0xa')](_0x9419('0xc'),auth[_0x9419('0xb')](),controller[_0x9419('0xd')]);router[_0x9419('0xa')](_0x9419('0xe'),auth[_0x9419('0xb')](),controller[_0x9419('0xf')]);router['post']('/',auth[_0x9419('0xb')](),controller[_0x9419('0x10')]);router[_0x9419('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9419('0x12')]);router['delete'](_0x9419('0xe'),auth[_0x9419('0xb')](),controller['destroy']);module[_0x9419('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 0c773f8..54a6f31 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(_0x40e181,_0x1953ee){var _0x257e72=function(_0x51ea44){while(--_0x51ea44){_0x40e181['push'](_0x40e181['shift']());}};_0x257e72(++_0x1953ee);}(_0xaa88,0x137));var _0x8aa8=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0xaa88[_0x138836];return _0x322688;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4cc42f,_0x3c0a63){var _0x2e6df9=function(_0x2b9456){while(--_0x2b9456){_0x4cc42f['push'](_0x4cc42f['shift']());}};_0x2e6df9(++_0x3c0a63);}(_0x008c,0x188));var _0xc008=function(_0x3e4566,_0x1e02e2){_0x3e4566=_0x3e4566-0x0;var _0x2eb60f=_0x008c[_0x3e4566];return _0x2eb60f;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 234edc5..e2b758d 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 _0xfdfd=['rows','show','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','OpenchannelTransferReport','includeAll','include','findAll'];(function(_0x57d9f1,_0x45123d){var _0x3ae610=function(_0x463911){while(--_0x463911){_0x57d9f1['push'](_0x57d9f1['shift']());}};_0x3ae610(++_0x45123d);}(_0xfdfd,0x14e));var _0xdfdf=function(_0x1e0779,_0x45715f){_0x1e0779=_0x1e0779-0x0;var _0x4b22c7=_0xfdfd[_0x1e0779];return _0x4b22c7;};'use strict';var emlformat=require(_0xdfdf('0x0'));var rimraf=require(_0xdfdf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfdf('0x2'));var rp=require('request-promise');var moment=require(_0xdfdf('0x3'));var BPromise=require(_0xdfdf('0x4'));var Mustache=require(_0xdfdf('0x5'));var util=require(_0xdfdf('0x6'));var path=require(_0xdfdf('0x7'));var sox=require(_0xdfdf('0x8'));var csv=require(_0xdfdf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfdf('0xa'));var _=require(_0xdfdf('0xb'));var squel=require(_0xdfdf('0xc'));var crypto=require(_0xdfdf('0xd'));var jsforce=require(_0xdfdf('0xe'));var deskjs=require(_0xdfdf('0xf'));var toCsv=require(_0xdfdf('0x9'));var querystring=require('querystring');var Papa=require(_0xdfdf('0x10'));var Redis=require(_0xdfdf('0x11'));var authService=require(_0xdfdf('0x12'));var qs=require(_0xdfdf('0x13'));var as=require(_0xdfdf('0x14'));var hardwareService=require(_0xdfdf('0x15'));var logger=require(_0xdfdf('0x16'))(_0xdfdf('0x17'));var utils=require('../../config/utils');var config=require(_0xdfdf('0x18'));var licenseUtil=require(_0xdfdf('0x19'));var db=require(_0xdfdf('0x1a'))['db'];function respondWithStatusCode(_0x18a478,_0x26d864){_0x26d864=_0x26d864||0xcc;return function(_0x2e39d4){if(_0x2e39d4){return _0x18a478[_0xdfdf('0x1b')](_0x26d864);}return _0x18a478[_0xdfdf('0x1c')](_0x26d864)['end']();};}function respondWithResult(_0x2832eb,_0x2d3e97){_0x2d3e97=_0x2d3e97||0xc8;return function(_0x4d4646){if(_0x4d4646){return _0x2832eb[_0xdfdf('0x1c')](_0x2d3e97)[_0xdfdf('0x1d')](_0x4d4646);}};}function respondWithFilteredResult(_0x5ef390,_0x4f5ec7){return function(_0x1ddef0){if(_0x1ddef0){var _0x47070d=typeof _0x4f5ec7[_0xdfdf('0x1e')]===_0xdfdf('0x1f')&&typeof _0x4f5ec7[_0xdfdf('0x20')]===_0xdfdf('0x1f');var _0x4438d0=_0x1ddef0[_0xdfdf('0x21')];var _0x185c58=_0x47070d?0x0:_0x4f5ec7[_0xdfdf('0x1e')];var _0x3ce588=_0x47070d?_0x1ddef0[_0xdfdf('0x21')]:_0x4f5ec7['offset']+_0x4f5ec7[_0xdfdf('0x20')];var _0x549e8a;if(_0x3ce588>=_0x4438d0){_0x3ce588=_0x4438d0;_0x549e8a=0xc8;}else{_0x549e8a=0xce;}_0x5ef390[_0xdfdf('0x1c')](_0x549e8a);return _0x5ef390[_0xdfdf('0x22')](_0xdfdf('0x23'),_0x185c58+'-'+_0x3ce588+'/'+_0x4438d0)['json'](_0x1ddef0);}return null;};}function patchUpdates(_0x64ec61){return function(_0x1c9450){try{jsonpatch['apply'](_0x1c9450,_0x64ec61,!![]);}catch(_0x599221){return BPromise[_0xdfdf('0x24')](_0x599221);}return _0x1c9450[_0xdfdf('0x25')]();};}function saveUpdates(_0x257d55,_0x443171){return function(_0x40c3fe){if(_0x40c3fe){return _0x40c3fe[_0xdfdf('0x26')](_0x257d55)[_0xdfdf('0x27')](function(_0x1fc02a){return _0x1fc02a;});}return null;};}function removeEntity(_0x34000e,_0x68c37c){return function(_0x2ac93d){if(_0x2ac93d){return _0x2ac93d[_0xdfdf('0x28')]()[_0xdfdf('0x27')](function(){_0x34000e[_0xdfdf('0x1c')](0xcc)[_0xdfdf('0x29')]();});}};}function handleEntityNotFound(_0x3cb14c,_0x20c721){return function(_0x2e721a){if(!_0x2e721a){_0x3cb14c['sendStatus'](0x194);}return _0x2e721a;};}function handleError(_0x3eb4d7,_0x4e4765){_0x4e4765=_0x4e4765||0x1f4;return function(_0x416aeb){logger[_0xdfdf('0x2a')](_0x416aeb['stack']);if(_0x416aeb[_0xdfdf('0x2b')]){delete _0x416aeb[_0xdfdf('0x2b')];}_0x3eb4d7[_0xdfdf('0x1c')](_0x4e4765)[_0xdfdf('0x2c')](_0x416aeb);};}exports[_0xdfdf('0x2d')]=function(_0x2084d4,_0x12c15d){var _0x1a6f61={},_0x3d8ef8={},_0xe26c01={'count':0x0,'rows':[]};var _0x35db88=_[_0xdfdf('0x2e')](db['OpenchannelTransferReport'][_0xdfdf('0x2f')],function(_0x27b957){return{'name':_0x27b957[_0xdfdf('0x30')],'type':_0x27b957[_0xdfdf('0x31')][_0xdfdf('0x32')]};});_0x3d8ef8[_0xdfdf('0x33')]=_[_0xdfdf('0x2e')](_0x35db88,_0xdfdf('0x2b'));_0x3d8ef8[_0xdfdf('0x34')]=_['keys'](_0x2084d4[_0xdfdf('0x34')]);_0x3d8ef8[_0xdfdf('0x35')]=_[_0xdfdf('0x36')](_0x3d8ef8[_0xdfdf('0x33')],_0x3d8ef8[_0xdfdf('0x34')]);_0x1a6f61[_0xdfdf('0x37')]=_[_0xdfdf('0x36')](_0x3d8ef8[_0xdfdf('0x33')],qs[_0xdfdf('0x38')](_0x2084d4[_0xdfdf('0x34')][_0xdfdf('0x38')]));_0x1a6f61[_0xdfdf('0x37')]=_0x1a6f61[_0xdfdf('0x37')][_0xdfdf('0x39')]?_0x1a6f61[_0xdfdf('0x37')]:_0x3d8ef8[_0xdfdf('0x33')];if(!_0x2084d4[_0xdfdf('0x34')][_0xdfdf('0x3a')](_0xdfdf('0x3b'))){_0x1a6f61[_0xdfdf('0x20')]=qs[_0xdfdf('0x20')](_0x2084d4['query'][_0xdfdf('0x20')]);_0x1a6f61[_0xdfdf('0x1e')]=qs['offset'](_0x2084d4[_0xdfdf('0x34')][_0xdfdf('0x1e')]);}_0x1a6f61[_0xdfdf('0x3c')]=qs[_0xdfdf('0x3d')](_0x2084d4[_0xdfdf('0x34')]['sort']);_0x1a6f61[_0xdfdf('0x3e')]=qs[_0xdfdf('0x35')](_[_0xdfdf('0x3f')](_0x2084d4['query'],_0x3d8ef8[_0xdfdf('0x35')]),_0x35db88);if(_0x2084d4[_0xdfdf('0x34')]['filter']){_0x1a6f61[_0xdfdf('0x3e')]=_[_0xdfdf('0x40')](_0x1a6f61['where'],{'$or':_['map'](_0x35db88,function(_0x1bac9b){if(_0x1bac9b['type']!==_0xdfdf('0x41')){var _0xb61813={};_0xb61813[_0x1bac9b[_0xdfdf('0x2b')]]={'$like':'%'+_0x2084d4[_0xdfdf('0x34')][_0xdfdf('0x42')]+'%'};return _0xb61813;}})});}_0x1a6f61=_[_0xdfdf('0x40')]({},_0x1a6f61,_0x2084d4['options']);var _0x2969e4={'where':_0x1a6f61[_0xdfdf('0x3e')]};return db[_0xdfdf('0x43')][_0xdfdf('0x21')](_0x2969e4)[_0xdfdf('0x27')](function(_0x4a1492){_0xe26c01[_0xdfdf('0x21')]=_0x4a1492;if(_0x2084d4[_0xdfdf('0x34')][_0xdfdf('0x44')]){_0x1a6f61[_0xdfdf('0x45')]=[{'all':!![]}];}return db[_0xdfdf('0x43')][_0xdfdf('0x46')](_0x1a6f61);})['then'](function(_0x3a80d0){_0xe26c01[_0xdfdf('0x47')]=_0x3a80d0;return _0xe26c01;})[_0xdfdf('0x27')](respondWithFilteredResult(_0x12c15d,_0x1a6f61))['catch'](handleError(_0x12c15d,null));};exports[_0xdfdf('0x48')]=function(_0x56c13f,_0xff4503){var _0x488157={'raw':!![],'where':{'id':_0x56c13f[_0xdfdf('0x49')]['id']}},_0x2b6592={};_0x2b6592[_0xdfdf('0x33')]=_['keys'](db[_0xdfdf('0x43')][_0xdfdf('0x2f')]);_0x2b6592[_0xdfdf('0x34')]=_[_0xdfdf('0x4a')](_0x56c13f['query']);_0x2b6592['filters']=_['intersection'](_0x2b6592[_0xdfdf('0x33')],_0x2b6592['query']);_0x488157['attributes']=_['intersection'](_0x2b6592[_0xdfdf('0x33')],qs[_0xdfdf('0x38')](_0x56c13f[_0xdfdf('0x34')][_0xdfdf('0x38')]));_0x488157[_0xdfdf('0x37')]=_0x488157[_0xdfdf('0x37')][_0xdfdf('0x39')]?_0x488157[_0xdfdf('0x37')]:_0x2b6592[_0xdfdf('0x33')];if(_0x56c13f[_0xdfdf('0x34')]['includeAll']){_0x488157[_0xdfdf('0x45')]=[{'all':!![]}];}_0x488157=_[_0xdfdf('0x40')]({},_0x488157,_0x56c13f[_0xdfdf('0x4b')]);return db[_0xdfdf('0x43')]['find'](_0x488157)[_0xdfdf('0x27')](handleEntityNotFound(_0xff4503,null))[_0xdfdf('0x27')](respondWithResult(_0xff4503,null))[_0xdfdf('0x4c')](handleError(_0xff4503,null));};exports[_0xdfdf('0x4d')]=function(_0x50764d,_0x3ea27f){return db[_0xdfdf('0x43')][_0xdfdf('0x4d')](_0x50764d[_0xdfdf('0x4e')],{})[_0xdfdf('0x27')](respondWithResult(_0x3ea27f,0xc9))[_0xdfdf('0x4c')](handleError(_0x3ea27f,null));};exports[_0xdfdf('0x26')]=function(_0x6d9766,_0x5b08a5){if(_0x6d9766[_0xdfdf('0x4e')]['id']){delete _0x6d9766[_0xdfdf('0x4e')]['id'];}return db['OpenchannelTransferReport'][_0xdfdf('0x4f')]({'where':{'id':_0x6d9766[_0xdfdf('0x49')]['id']}})[_0xdfdf('0x27')](handleEntityNotFound(_0x5b08a5,null))[_0xdfdf('0x27')](saveUpdates(_0x6d9766[_0xdfdf('0x4e')],null))['then'](respondWithResult(_0x5b08a5,null))[_0xdfdf('0x4c')](handleError(_0x5b08a5,null));};exports[_0xdfdf('0x28')]=function(_0x30ed65,_0x281025){return db[_0xdfdf('0x43')][_0xdfdf('0x4f')]({'where':{'id':_0x30ed65[_0xdfdf('0x49')]['id']}})[_0xdfdf('0x27')](handleEntityNotFound(_0x281025,null))[_0xdfdf('0x27')](removeEntity(_0x281025,null))[_0xdfdf('0x4c')](handleError(_0x281025,null));};exports[_0xdfdf('0x50')]=function(_0x5f4cb8,_0x4c7406){return db[_0xdfdf('0x43')][_0xdfdf('0x50')]()[_0xdfdf('0x27')](respondWithResult(_0x4c7406,null))[_0xdfdf('0x4c')](handleError(_0x4c7406,null));}; \ No newline at end of file +var _0x8b50=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8b50,0x1ea));var _0x08b5=function(_0x124c3d,_0x5e6e47){_0x124c3d=_0x124c3d-0x0;var _0x2ef0a6=_0x8b50[_0x124c3d];return _0x2ef0a6;};'use strict';var emlformat=require(_0x08b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x08b5('0x1'));var rp=require('request-promise');var moment=require(_0x08b5('0x2'));var BPromise=require(_0x08b5('0x3'));var Mustache=require('mustache');var util=require(_0x08b5('0x4'));var path=require(_0x08b5('0x5'));var sox=require(_0x08b5('0x6'));var csv=require(_0x08b5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08b5('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x08b5('0x9'));var jsforce=require(_0x08b5('0xa'));var deskjs=require(_0x08b5('0xb'));var toCsv=require(_0x08b5('0x7'));var querystring=require(_0x08b5('0xc'));var Papa=require(_0x08b5('0xd'));var Redis=require(_0x08b5('0xe'));var authService=require(_0x08b5('0xf'));var qs=require(_0x08b5('0x10'));var as=require(_0x08b5('0x11'));var hardwareService=require(_0x08b5('0x12'));var logger=require(_0x08b5('0x13'))(_0x08b5('0x14'));var utils=require('../../config/utils');var config=require(_0x08b5('0x15'));var licenseUtil=require(_0x08b5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc039d5,_0x350a79){_0x350a79=_0x350a79||0xcc;return function(_0x3c7fd9){if(_0x3c7fd9){return _0xc039d5[_0x08b5('0x17')](_0x350a79);}return _0xc039d5[_0x08b5('0x18')](_0x350a79)[_0x08b5('0x19')]();};}function respondWithResult(_0x5e6448,_0x261da9){_0x261da9=_0x261da9||0xc8;return function(_0xf0553a){if(_0xf0553a){return _0x5e6448[_0x08b5('0x18')](_0x261da9)[_0x08b5('0x1a')](_0xf0553a);}};}function respondWithFilteredResult(_0x23790d,_0x2dbf9c){return function(_0x3fab9d){if(_0x3fab9d){var _0x1c7e9b=typeof _0x2dbf9c[_0x08b5('0x1b')]===_0x08b5('0x1c')&&typeof _0x2dbf9c[_0x08b5('0x1d')]===_0x08b5('0x1c');var _0x5182b9=_0x3fab9d[_0x08b5('0x1e')];var _0x5c89a1=_0x1c7e9b?0x0:_0x2dbf9c[_0x08b5('0x1b')];var _0x24fc57=_0x1c7e9b?_0x3fab9d[_0x08b5('0x1e')]:_0x2dbf9c[_0x08b5('0x1b')]+_0x2dbf9c[_0x08b5('0x1d')];var _0x485049;if(_0x24fc57>=_0x5182b9){_0x24fc57=_0x5182b9;_0x485049=0xc8;}else{_0x485049=0xce;}_0x23790d['status'](_0x485049);return _0x23790d['set']('Content-Range',_0x5c89a1+'-'+_0x24fc57+'/'+_0x5182b9)['json'](_0x3fab9d);}return null;};}function patchUpdates(_0x2d0ce6){return function(_0x54cb0a){try{jsonpatch[_0x08b5('0x1f')](_0x54cb0a,_0x2d0ce6,!![]);}catch(_0x44cb32){return BPromise[_0x08b5('0x20')](_0x44cb32);}return _0x54cb0a['save']();};}function saveUpdates(_0x80d132,_0x4021b3){return function(_0x4f12da){if(_0x4f12da){return _0x4f12da[_0x08b5('0x21')](_0x80d132)[_0x08b5('0x22')](function(_0x2c6a68){return _0x2c6a68;});}return null;};}function removeEntity(_0xbc0e36,_0x1a02dc){return function(_0x27c971){if(_0x27c971){return _0x27c971[_0x08b5('0x23')]()[_0x08b5('0x22')](function(){_0xbc0e36[_0x08b5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x63ae13,_0x5ef3b6){return function(_0x416802){if(!_0x416802){_0x63ae13[_0x08b5('0x17')](0x194);}return _0x416802;};}function handleError(_0xce55b,_0x13fd77){_0x13fd77=_0x13fd77||0x1f4;return function(_0x41e969){logger[_0x08b5('0x24')](_0x41e969[_0x08b5('0x25')]);if(_0x41e969[_0x08b5('0x26')]){delete _0x41e969['name'];}_0xce55b[_0x08b5('0x18')](_0x13fd77)['send'](_0x41e969);};}exports[_0x08b5('0x27')]=function(_0x5312c9,_0xeb7618){var _0x322311={},_0x2ccab1={},_0x45dac9={'count':0x0,'rows':[]};var _0xb1aef6=_[_0x08b5('0x28')](db[_0x08b5('0x29')][_0x08b5('0x2a')],function(_0xe795b3){return{'name':_0xe795b3[_0x08b5('0x2b')],'type':_0xe795b3['type'][_0x08b5('0x2c')]};});_0x2ccab1[_0x08b5('0x2d')]=_[_0x08b5('0x28')](_0xb1aef6,_0x08b5('0x26'));_0x2ccab1[_0x08b5('0x2e')]=_['keys'](_0x5312c9['query']);_0x2ccab1['filters']=_['intersection'](_0x2ccab1['model'],_0x2ccab1[_0x08b5('0x2e')]);_0x322311[_0x08b5('0x2f')]=_[_0x08b5('0x30')](_0x2ccab1[_0x08b5('0x2d')],qs[_0x08b5('0x31')](_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x31')]));_0x322311[_0x08b5('0x2f')]=_0x322311['attributes'][_0x08b5('0x32')]?_0x322311['attributes']:_0x2ccab1['model'];if(!_0x5312c9['query'][_0x08b5('0x33')](_0x08b5('0x34'))){_0x322311[_0x08b5('0x1d')]=qs[_0x08b5('0x1d')](_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x1d')]);_0x322311[_0x08b5('0x1b')]=qs[_0x08b5('0x1b')](_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x1b')]);}_0x322311[_0x08b5('0x35')]=qs[_0x08b5('0x36')](_0x5312c9['query'][_0x08b5('0x36')]);_0x322311[_0x08b5('0x37')]=qs['filters'](_['pick'](_0x5312c9['query'],_0x2ccab1[_0x08b5('0x38')]),_0xb1aef6);if(_0x5312c9['query'][_0x08b5('0x39')]){_0x322311[_0x08b5('0x37')]=_[_0x08b5('0x3a')](_0x322311[_0x08b5('0x37')],{'$or':_['map'](_0xb1aef6,function(_0x1b5f34){if(_0x1b5f34[_0x08b5('0x3b')]!=='VIRTUAL'){var _0x4e8e17={};_0x4e8e17[_0x1b5f34['name']]={'$like':'%'+_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x39')]+'%'};return _0x4e8e17;}})});}_0x322311=_[_0x08b5('0x3a')]({},_0x322311,_0x5312c9[_0x08b5('0x3c')]);var _0x2a1d4f={'where':_0x322311[_0x08b5('0x37')]};return db[_0x08b5('0x29')][_0x08b5('0x1e')](_0x2a1d4f)[_0x08b5('0x22')](function(_0x435091){_0x45dac9[_0x08b5('0x1e')]=_0x435091;if(_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x3d')]){_0x322311[_0x08b5('0x3e')]=[{'all':!![]}];}return db[_0x08b5('0x29')]['findAll'](_0x322311);})['then'](function(_0x2461d3){_0x45dac9[_0x08b5('0x3f')]=_0x2461d3;return _0x45dac9;})[_0x08b5('0x22')](respondWithFilteredResult(_0xeb7618,_0x322311))[_0x08b5('0x40')](handleError(_0xeb7618,null));};exports[_0x08b5('0x41')]=function(_0x2866b9,_0x5932f1){var _0x56e133={'raw':!![],'where':{'id':_0x2866b9[_0x08b5('0x42')]['id']}},_0x1e8450={};_0x1e8450[_0x08b5('0x2d')]=_[_0x08b5('0x43')](db[_0x08b5('0x29')]['rawAttributes']);_0x1e8450[_0x08b5('0x2e')]=_[_0x08b5('0x43')](_0x2866b9[_0x08b5('0x2e')]);_0x1e8450[_0x08b5('0x38')]=_[_0x08b5('0x30')](_0x1e8450[_0x08b5('0x2d')],_0x1e8450[_0x08b5('0x2e')]);_0x56e133[_0x08b5('0x2f')]=_[_0x08b5('0x30')](_0x1e8450[_0x08b5('0x2d')],qs[_0x08b5('0x31')](_0x2866b9['query'][_0x08b5('0x31')]));_0x56e133['attributes']=_0x56e133[_0x08b5('0x2f')]['length']?_0x56e133[_0x08b5('0x2f')]:_0x1e8450[_0x08b5('0x2d')];if(_0x2866b9[_0x08b5('0x2e')]['includeAll']){_0x56e133[_0x08b5('0x3e')]=[{'all':!![]}];}_0x56e133=_[_0x08b5('0x3a')]({},_0x56e133,_0x2866b9['options']);return db[_0x08b5('0x29')]['find'](_0x56e133)[_0x08b5('0x22')](handleEntityNotFound(_0x5932f1,null))[_0x08b5('0x22')](respondWithResult(_0x5932f1,null))[_0x08b5('0x40')](handleError(_0x5932f1,null));};exports[_0x08b5('0x44')]=function(_0x113014,_0x3cbb2b){return db[_0x08b5('0x29')][_0x08b5('0x44')](_0x113014[_0x08b5('0x45')],{})['then'](respondWithResult(_0x3cbb2b,0xc9))[_0x08b5('0x40')](handleError(_0x3cbb2b,null));};exports[_0x08b5('0x21')]=function(_0x1b5426,_0xe1a4e5){if(_0x1b5426[_0x08b5('0x45')]['id']){delete _0x1b5426[_0x08b5('0x45')]['id'];}return db[_0x08b5('0x29')]['find']({'where':{'id':_0x1b5426[_0x08b5('0x42')]['id']}})[_0x08b5('0x22')](handleEntityNotFound(_0xe1a4e5,null))['then'](saveUpdates(_0x1b5426['body'],null))[_0x08b5('0x22')](respondWithResult(_0xe1a4e5,null))[_0x08b5('0x40')](handleError(_0xe1a4e5,null));};exports['destroy']=function(_0x49ab3a,_0x161461){return db[_0x08b5('0x29')][_0x08b5('0x46')]({'where':{'id':_0x49ab3a[_0x08b5('0x42')]['id']}})[_0x08b5('0x22')](handleEntityNotFound(_0x161461,null))[_0x08b5('0x22')](removeEntity(_0x161461,null))['catch'](handleError(_0x161461,null));};exports[_0x08b5('0x47')]=function(_0x190e76,_0x4e5384){return db[_0x08b5('0x29')][_0x08b5('0x47')]()['then'](respondWithResult(_0x4e5384,null))[_0x08b5('0x40')](handleError(_0x4e5384,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 228be23..cd87940 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 _0xce5c=['rimraf','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5ac5be,_0x45217d){var _0x22f30f=function(_0x1cd2fe){while(--_0x1cd2fe){_0x5ac5be['push'](_0x5ac5be['shift']());}};_0x22f30f(++_0x45217d);}(_0xce5c,0x8a));var _0xcce5=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0xce5c[_0x25c988];return _0x45fcc2;};'use strict';var _=require('lodash');var util=require(_0xcce5('0x0'));var logger=require(_0xcce5('0x1'))(_0xcce5('0x2'));var moment=require(_0xcce5('0x3'));var BPromise=require('bluebird');var rp=require(_0xcce5('0x4'));var fs=require('fs');var path=require(_0xcce5('0x5'));var rimraf=require(_0xcce5('0x6'));var config=require('../../config/environment');var attributes=require(_0xcce5('0x7'));module[_0xcce5('0x8')]=function(_0x3e3e01,_0x1020e4){return _0x3e3e01['define'](_0xcce5('0x9'),attributes,{'tableName':_0xcce5('0xa'),'paranoid':![],'indexes':[{'name':_0xcce5('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5d5=['define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x21ef85,_0x2d9f4f){var _0x5b9a7d=function(_0x5b5f13){while(--_0x5b5f13){_0x21ef85['push'](_0x21ef85['shift']());}};_0x5b9a7d(++_0x2d9f4f);}(_0xd5d5,0x137));var _0x5d5d=function(_0x399e3b,_0x5dd3d2){_0x399e3b=_0x399e3b-0x0;var _0x28c6a4=_0xd5d5[_0x399e3b];return _0x28c6a4;};'use strict';var _=require(_0x5d5d('0x0'));var util=require(_0x5d5d('0x1'));var logger=require(_0x5d5d('0x2'))(_0x5d5d('0x3'));var moment=require(_0x5d5d('0x4'));var BPromise=require(_0x5d5d('0x5'));var rp=require(_0x5d5d('0x6'));var fs=require('fs');var path=require(_0x5d5d('0x7'));var rimraf=require(_0x5d5d('0x8'));var config=require(_0x5d5d('0x9'));var attributes=require(_0x5d5d('0xa'));module['exports']=function(_0x326cac,_0x430d21){return _0x326cac[_0x5d5d('0xb')](_0x5d5d('0xc'),attributes,{'tableName':_0x5d5d('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 28bcd6e..d229931 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 _0x0207=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','util','randomstring','ioredis'];(function(_0x55a5e2,_0x3b9712){var _0x577445=function(_0x2e411d){while(--_0x2e411d){_0x55a5e2['push'](_0x55a5e2['shift']());}};_0x577445(++_0x3b9712);}(_0x0207,0x162));var _0x7020=function(_0x429f1d,_0x80ee79){_0x429f1d=_0x429f1d-0x0;var _0xbc3342=_0x0207[_0x429f1d];return _0xbc3342;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7020('0x1'));var fs=require('fs');var Redis=require(_0x7020('0x2'));var db=require(_0x7020('0x3'))['db'];var utils=require(_0x7020('0x4'));var logger=require(_0x7020('0x5'))(_0x7020('0x6'));var config=require(_0x7020('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7020('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39263c,_0x3c6c11,_0x17deac){return new BPromise(function(_0x42bc79,_0x22ba3e){return client[_0x7020('0x9')](_0x39263c,_0x17deac)['then'](function(_0x5e86b5){logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));logger['debug'](_0x7020('0xd'),_0x3c6c11,_0x7020('0xc'),JSON['stringify'](_0x5e86b5));if(_0x5e86b5[_0x7020('0xe')]){if(_0x5e86b5[_0x7020('0xe')][_0x7020('0xf')]===0x1f4){logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);return _0x22ba3e(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}logger['error'](_0x7020('0xb'),_0x3c6c11,_0x5e86b5['error'][_0x7020('0x10')]);return _0x42bc79(_0x5e86b5[_0x7020('0xe')][_0x7020('0x10')]);}else{logger[_0x7020('0xa')](_0x7020('0xb'),_0x3c6c11,_0x7020('0xc'));_0x42bc79(_0x5e86b5['result'][_0x7020('0x10')]);}})['catch'](function(_0x2f4db5){logger[_0x7020('0xe')](_0x7020('0xb'),_0x3c6c11,_0x2f4db5);_0x22ba3e(_0x2f4db5);});});} \ No newline at end of file +var _0x9c5a=['http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4204b9,_0x18aee4){var _0x46e056=function(_0x650cd2){while(--_0x650cd2){_0x4204b9['push'](_0x4204b9['shift']());}};_0x46e056(++_0x18aee4);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x169b42,_0x2c96f7){_0x169b42=_0x169b42-0x0;var _0x313019=_0x9c5a[_0x169b42];return _0x313019;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 2bf595d..628bac4 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 _0x5b2a=['../../components/interaction/service','./pause.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','express','fs-extra'];(function(_0x41648f,_0x4a8936){var _0x20340a=function(_0x358f29){while(--_0x358f29){_0x41648f['push'](_0x41648f['shift']());}};_0x20340a(++_0x4a8936);}(_0x5b2a,0x150));var _0xa5b2=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x5b2a[_0x414655];return _0x237884;};'use strict';var multer=require(_0xa5b2('0x0'));var util=require('util');var path=require(_0xa5b2('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5b2('0x2'));var router=express['Router']();var fs_extra=require(_0xa5b2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa5b2('0x4'));var config=require('../../config/environment');var controller=require(_0xa5b2('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xa5b2('0x6')]);router[_0xa5b2('0x7')](_0xa5b2('0x8'),auth[_0xa5b2('0x9')](),controller[_0xa5b2('0xa')]);router[_0xa5b2('0xb')]('/',auth[_0xa5b2('0x9')](),controller[_0xa5b2('0xc')]);router[_0xa5b2('0xd')](_0xa5b2('0x8'),auth[_0xa5b2('0x9')](),controller[_0xa5b2('0xe')]);router[_0xa5b2('0xf')]('/:id',auth[_0xa5b2('0x9')](),controller[_0xa5b2('0x10')]);module['exports']=router; \ No newline at end of file +var _0x916c=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x916c,0x6d));var _0xc916=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x916c[_0x57645b];return _0xe82f00;};'use strict';var multer=require(_0xc916('0x0'));var util=require('util');var path=require(_0xc916('0x1'));var timeout=require(_0xc916('0x2'));var express=require(_0xc916('0x3'));var router=express[_0xc916('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc916('0x5'));var interaction=require(_0xc916('0x6'));var config=require('../../config/environment');var controller=require(_0xc916('0x7'));router[_0xc916('0x8')]('/',auth[_0xc916('0x9')](),controller['index']);router['get'](_0xc916('0xa'),auth['isAuthenticated'](),controller[_0xc916('0xb')]);router[_0xc916('0xc')]('/',auth[_0xc916('0x9')](),controller[_0xc916('0xd')]);router[_0xc916('0xe')](_0xc916('0xa'),auth[_0xc916('0x9')](),controller['update']);router[_0xc916('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc916('0x10')]);module[_0xc916('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 449023e..1e6e853 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 _0xe205=['exports','name','sequelize'];(function(_0x4f0a61,_0x1df9a7){var _0x447ea6=function(_0x22577e){while(--_0x22577e){_0x4f0a61['push'](_0x4f0a61['shift']());}};_0x447ea6(++_0x1df9a7);}(_0xe205,0x125));var _0x5e20=function(_0x417df8,_0x379eb1){_0x417df8=_0x417df8-0x0;var _0x3da045=_0xe205[_0x417df8];return _0x3da045;};'use strict';var Sequelize=require(_0x5e20('0x0'));module[_0x5e20('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5e20('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7c2=['sequelize','exports','STRING','name'];(function(_0x19d4e9,_0x4a8446){var _0x22a280=function(_0x54c608){while(--_0x54c608){_0x19d4e9['push'](_0x19d4e9['shift']());}};_0x22a280(++_0x4a8446);}(_0xc7c2,0xb8));var _0x2c7c=function(_0x242e94,_0x37ba73){_0x242e94=_0x242e94-0x0;var _0x27afec=_0xc7c2[_0x242e94];return _0x27afec;};'use strict';var Sequelize=require(_0x2c7c('0x0'));module[_0x2c7c('0x1')]={'name':{'type':Sequelize[_0x2c7c('0x2')],'unique':_0x2c7c('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 710a888..8d9005d 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 _0x293d=['Pause','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x293d,0x1d0));var _0xd293=function(_0x4eef5c,_0x495a8f){_0x4eef5c=_0x4eef5c-0x0;var _0x431053=_0x293d[_0x4eef5c];return _0x431053;};'use strict';var emlformat=require(_0xd293('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd293('0x1'));var jsonpatch=require(_0xd293('0x2'));var rp=require(_0xd293('0x3'));var moment=require(_0xd293('0x4'));var BPromise=require(_0xd293('0x5'));var Mustache=require(_0xd293('0x6'));var util=require(_0xd293('0x7'));var path=require(_0xd293('0x8'));var sox=require(_0xd293('0x9'));var csv=require(_0xd293('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd293('0xb'));var _=require(_0xd293('0xc'));var squel=require('squel');var crypto=require(_0xd293('0xd'));var jsforce=require(_0xd293('0xe'));var deskjs=require(_0xd293('0xf'));var toCsv=require(_0xd293('0xa'));var querystring=require(_0xd293('0x10'));var Papa=require('papaparse');var Redis=require(_0xd293('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd293('0x12'));var as=require(_0xd293('0x13'));var hardwareService=require(_0xd293('0x14'));var logger=require(_0xd293('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd293('0x16'));var licenseUtil=require(_0xd293('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ef421,_0x435509){_0x435509=_0x435509||0xcc;return function(_0x8ba6c){if(_0x8ba6c){return _0x2ef421[_0xd293('0x18')](_0x435509);}return _0x2ef421['status'](_0x435509)[_0xd293('0x19')]();};}function respondWithResult(_0x3e02e7,_0x25d619){_0x25d619=_0x25d619||0xc8;return function(_0x1226cd){if(_0x1226cd){return _0x3e02e7['status'](_0x25d619)[_0xd293('0x1a')](_0x1226cd);}};}function respondWithFilteredResult(_0x3266b5,_0x1a05f4){return function(_0x2d1f9c){if(_0x2d1f9c){var _0x443cd9=typeof _0x1a05f4[_0xd293('0x1b')]===_0xd293('0x1c')&&typeof _0x1a05f4[_0xd293('0x1d')]==='undefined';var _0x2e1e57=_0x2d1f9c['count'];var _0x2de8ad=_0x443cd9?0x0:_0x1a05f4[_0xd293('0x1b')];var _0x13e1c5=_0x443cd9?_0x2d1f9c[_0xd293('0x1e')]:_0x1a05f4[_0xd293('0x1b')]+_0x1a05f4['limit'];var _0x287c52;if(_0x13e1c5>=_0x2e1e57){_0x13e1c5=_0x2e1e57;_0x287c52=0xc8;}else{_0x287c52=0xce;}_0x3266b5[_0xd293('0x1f')](_0x287c52);return _0x3266b5['set'](_0xd293('0x20'),_0x2de8ad+'-'+_0x13e1c5+'/'+_0x2e1e57)[_0xd293('0x1a')](_0x2d1f9c);}return null;};}function patchUpdates(_0x27bee2){return function(_0x30643f){try{jsonpatch[_0xd293('0x21')](_0x30643f,_0x27bee2,!![]);}catch(_0x134a08){return BPromise['reject'](_0x134a08);}return _0x30643f[_0xd293('0x22')]();};}function saveUpdates(_0x531a3b,_0x38265e){return function(_0x3e6dba){if(_0x3e6dba){return _0x3e6dba['update'](_0x531a3b)[_0xd293('0x23')](function(_0x76f39a){return _0x76f39a;});}return null;};}function removeEntity(_0x47763e,_0x113c90){return function(_0x289e6f){if(_0x289e6f){return _0x289e6f[_0xd293('0x24')]()[_0xd293('0x23')](function(){var _0x11254e=_0x289e6f[_0xd293('0x25')]({'plain':!![]});var _0x205eeb=_0xd293('0x26');return db[_0xd293('0x27')][_0xd293('0x24')]({'where':{'type':_0x205eeb,'resourceId':_0x11254e['id']}})[_0xd293('0x23')](function(){return _0x289e6f;});})[_0xd293('0x23')](function(){_0x47763e[_0xd293('0x1f')](0xcc)[_0xd293('0x19')]();});}};}function handleEntityNotFound(_0x4d2430,_0x521bbc){return function(_0xb65911){if(!_0xb65911){_0x4d2430[_0xd293('0x18')](0x194);}return _0xb65911;};}function handleError(_0xef5115,_0x50adc2){_0x50adc2=_0x50adc2||0x1f4;return function(_0x9c054e){logger[_0xd293('0x28')](_0x9c054e[_0xd293('0x29')]);if(_0x9c054e[_0xd293('0x2a')]){delete _0x9c054e['name'];}_0xef5115[_0xd293('0x1f')](_0x50adc2)[_0xd293('0x2b')](_0x9c054e);};}exports[_0xd293('0x2c')]=function(_0x48beba,_0xe5a37){var _0x5f5c84={},_0x4edb15={},_0x127451={'count':0x0,'rows':[]};var _0x4b0f98=_[_0xd293('0x2d')](db[_0xd293('0x2e')][_0xd293('0x2f')],function(_0x2f4b10){return{'name':_0x2f4b10[_0xd293('0x30')],'type':_0x2f4b10['type'][_0xd293('0x31')]};});_0x4edb15[_0xd293('0x32')]=_[_0xd293('0x2d')](_0x4b0f98,_0xd293('0x2a'));_0x4edb15[_0xd293('0x33')]=_[_0xd293('0x34')](_0x48beba['query']);_0x4edb15[_0xd293('0x35')]=_[_0xd293('0x36')](_0x4edb15[_0xd293('0x32')],_0x4edb15[_0xd293('0x33')]);_0x5f5c84[_0xd293('0x37')]=_[_0xd293('0x36')](_0x4edb15[_0xd293('0x32')],qs[_0xd293('0x38')](_0x48beba[_0xd293('0x33')][_0xd293('0x38')]));_0x5f5c84[_0xd293('0x37')]=_0x5f5c84[_0xd293('0x37')][_0xd293('0x39')]?_0x5f5c84[_0xd293('0x37')]:_0x4edb15[_0xd293('0x32')];if(!_0x48beba['query'][_0xd293('0x3a')](_0xd293('0x3b'))){_0x5f5c84['limit']=qs[_0xd293('0x1d')](_0x48beba[_0xd293('0x33')]['limit']);_0x5f5c84[_0xd293('0x1b')]=qs['offset'](_0x48beba[_0xd293('0x33')]['offset']);}_0x5f5c84[_0xd293('0x3c')]=qs[_0xd293('0x3d')](_0x48beba[_0xd293('0x33')][_0xd293('0x3d')]);_0x5f5c84['where']=qs[_0xd293('0x35')](_[_0xd293('0x3e')](_0x48beba['query'],_0x4edb15[_0xd293('0x35')]),_0x4b0f98);if(_0x48beba[_0xd293('0x33')][_0xd293('0x3f')]){_0x5f5c84[_0xd293('0x40')]=_['merge'](_0x5f5c84[_0xd293('0x40')],{'$or':_[_0xd293('0x2d')](_0x4b0f98,function(_0x450e78){if(_0x450e78[_0xd293('0x41')]!=='VIRTUAL'){var _0x2afd70={};_0x2afd70[_0x450e78[_0xd293('0x2a')]]={'$like':'%'+_0x48beba[_0xd293('0x33')][_0xd293('0x3f')]+'%'};return _0x2afd70;}})});}_0x5f5c84=_['merge']({},_0x5f5c84,_0x48beba[_0xd293('0x42')]);var _0x6ccd22={'where':_0x5f5c84[_0xd293('0x40')]};return db[_0xd293('0x2e')][_0xd293('0x1e')](_0x6ccd22)[_0xd293('0x23')](function(_0x43f73c){_0x127451[_0xd293('0x1e')]=_0x43f73c;if(_0x48beba['query'][_0xd293('0x43')]){_0x5f5c84['include']=[{'all':!![]}];}return db[_0xd293('0x2e')][_0xd293('0x44')](_0x5f5c84);})[_0xd293('0x23')](function(_0x239324){_0x127451[_0xd293('0x45')]=_0x239324;return _0x127451;})[_0xd293('0x23')](respondWithFilteredResult(_0xe5a37,_0x5f5c84))[_0xd293('0x46')](handleError(_0xe5a37,null));};exports[_0xd293('0x47')]=function(_0x470a07,_0x306137){var _0x1bc039={'raw':!![],'where':{'id':_0x470a07[_0xd293('0x48')]['id']}},_0x5b26e0={};_0x5b26e0['model']=_['keys'](db[_0xd293('0x2e')][_0xd293('0x2f')]);_0x5b26e0[_0xd293('0x33')]=_[_0xd293('0x34')](_0x470a07['query']);_0x5b26e0[_0xd293('0x35')]=_[_0xd293('0x36')](_0x5b26e0[_0xd293('0x32')],_0x5b26e0[_0xd293('0x33')]);_0x1bc039[_0xd293('0x37')]=_[_0xd293('0x36')](_0x5b26e0[_0xd293('0x32')],qs[_0xd293('0x38')](_0x470a07[_0xd293('0x33')]['fields']));_0x1bc039[_0xd293('0x37')]=_0x1bc039[_0xd293('0x37')][_0xd293('0x39')]?_0x1bc039[_0xd293('0x37')]:_0x5b26e0[_0xd293('0x32')];if(_0x470a07['query'][_0xd293('0x43')]){_0x1bc039[_0xd293('0x49')]=[{'all':!![]}];}_0x1bc039=_[_0xd293('0x4a')]({},_0x1bc039,_0x470a07[_0xd293('0x42')]);return db[_0xd293('0x2e')][_0xd293('0x4b')](_0x1bc039)[_0xd293('0x23')](handleEntityNotFound(_0x306137,null))[_0xd293('0x23')](respondWithResult(_0x306137,null))['catch'](handleError(_0x306137,null));};exports[_0xd293('0x4c')]=function(_0x57971f,_0x8cb328){return db['Pause'][_0xd293('0x4c')](_0x57971f[_0xd293('0x4d')],{})[_0xd293('0x23')](function(_0x1b2b91){var _0x1dd57c=_0x57971f[_0xd293('0x4e')]['get']({'plain':!![]});if(!_0x1dd57c)throw new Error(_0xd293('0x4f'));if(_0x1dd57c['role']==='user'){var _0x34adad=_0x1b2b91[_0xd293('0x25')]({'plain':!![]});var _0x4a3e2c=_0xd293('0x26');return db[_0xd293('0x50')]['find']({'where':{'name':_0x4a3e2c,'userProfileId':_0x1dd57c[_0xd293('0x51')]},'raw':!![]})[_0xd293('0x23')](function(_0x4b3083){if(_0x4b3083&&_0x4b3083[_0xd293('0x52')]===0x0){return db[_0xd293('0x27')][_0xd293('0x4c')]({'name':_0x34adad[_0xd293('0x2a')],'resourceId':_0x34adad['id'],'type':_0x4b3083[_0xd293('0x2a')],'sectionId':_0x4b3083['id']},{})[_0xd293('0x23')](function(){return _0x1b2b91;});}else{return _0x1b2b91;}})['catch'](function(_0x141778){logger[_0xd293('0x28')](_0xd293('0x53'),_0x141778);throw _0x141778;});}return _0x1b2b91;})[_0xd293('0x23')](respondWithResult(_0x8cb328,0xc9))[_0xd293('0x46')](handleError(_0x8cb328,null));};exports[_0xd293('0x54')]=function(_0x5c94ca,_0x1a10e6){if(_0x5c94ca[_0xd293('0x4d')]['id']){delete _0x5c94ca[_0xd293('0x4d')]['id'];}return db[_0xd293('0x2e')][_0xd293('0x4b')]({'where':{'id':_0x5c94ca['params']['id']}})['then'](handleEntityNotFound(_0x1a10e6,null))[_0xd293('0x23')](saveUpdates(_0x5c94ca[_0xd293('0x4d')],null))[_0xd293('0x23')](respondWithResult(_0x1a10e6,null))[_0xd293('0x46')](handleError(_0x1a10e6,null));};exports[_0xd293('0x24')]=function(_0x38a70f,_0x4a129c){return db[_0xd293('0x2e')][_0xd293('0x4b')]({'where':{'id':_0x38a70f[_0xd293('0x48')]['id']}})[_0xd293('0x23')](handleEntityNotFound(_0x4a129c,null))[_0xd293('0x23')](removeEntity(_0x4a129c,null))[_0xd293('0x46')](handleError(_0x4a129c,null));}; \ No newline at end of file +var _0x3a8f=['merge','options','where','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Pauses','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','map','filter'];(function(_0x27235e,_0x410d32){var _0x10a010=function(_0xcd8b1c){while(--_0xcd8b1c){_0x27235e['push'](_0x27235e['shift']());}};_0x10a010(++_0x410d32);}(_0x3a8f,0xbf));var _0xf3a8=function(_0xb41ee,_0x3e1038){_0xb41ee=_0xb41ee-0x0;var _0x51c4c2=_0x3a8f[_0xb41ee];return _0x51c4c2;};'use strict';var emlformat=require(_0xf3a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf3a8('0x1'));var rp=require(_0xf3a8('0x2'));var moment=require(_0xf3a8('0x3'));var BPromise=require(_0xf3a8('0x4'));var Mustache=require(_0xf3a8('0x5'));var util=require('util');var path=require(_0xf3a8('0x6'));var sox=require(_0xf3a8('0x7'));var csv=require(_0xf3a8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3a8('0x9'));var _=require('lodash');var squel=require(_0xf3a8('0xa'));var crypto=require(_0xf3a8('0xb'));var jsforce=require(_0xf3a8('0xc'));var deskjs=require(_0xf3a8('0xd'));var toCsv=require(_0xf3a8('0x8'));var querystring=require(_0xf3a8('0xe'));var Papa=require(_0xf3a8('0xf'));var Redis=require(_0xf3a8('0x10'));var authService=require(_0xf3a8('0x11'));var qs=require(_0xf3a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3a8('0x13'));var logger=require('../../config/logger')(_0xf3a8('0x14'));var utils=require('../../config/utils');var config=require(_0xf3a8('0x15'));var licenseUtil=require(_0xf3a8('0x16'));var db=require(_0xf3a8('0x17'))['db'];function respondWithStatusCode(_0xa13541,_0x1b6faa){_0x1b6faa=_0x1b6faa||0xcc;return function(_0x23feb2){if(_0x23feb2){return _0xa13541[_0xf3a8('0x18')](_0x1b6faa);}return _0xa13541['status'](_0x1b6faa)[_0xf3a8('0x19')]();};}function respondWithResult(_0x3c03f6,_0x296cd4){_0x296cd4=_0x296cd4||0xc8;return function(_0x414222){if(_0x414222){return _0x3c03f6[_0xf3a8('0x1a')](_0x296cd4)[_0xf3a8('0x1b')](_0x414222);}};}function respondWithFilteredResult(_0x3261be,_0x59f3ee){return function(_0x204abc){if(_0x204abc){var _0x4bc486=typeof _0x59f3ee[_0xf3a8('0x1c')]===_0xf3a8('0x1d')&&typeof _0x59f3ee[_0xf3a8('0x1e')]==='undefined';var _0x57b89b=_0x204abc[_0xf3a8('0x1f')];var _0x3ce2cd=_0x4bc486?0x0:_0x59f3ee[_0xf3a8('0x1c')];var _0x58848e=_0x4bc486?_0x204abc[_0xf3a8('0x1f')]:_0x59f3ee[_0xf3a8('0x1c')]+_0x59f3ee[_0xf3a8('0x1e')];var _0x34a3f4;if(_0x58848e>=_0x57b89b){_0x58848e=_0x57b89b;_0x34a3f4=0xc8;}else{_0x34a3f4=0xce;}_0x3261be[_0xf3a8('0x1a')](_0x34a3f4);return _0x3261be[_0xf3a8('0x20')](_0xf3a8('0x21'),_0x3ce2cd+'-'+_0x58848e+'/'+_0x57b89b)[_0xf3a8('0x1b')](_0x204abc);}return null;};}function patchUpdates(_0x379c00){return function(_0x15f184){try{jsonpatch[_0xf3a8('0x22')](_0x15f184,_0x379c00,!![]);}catch(_0x22d499){return BPromise['reject'](_0x22d499);}return _0x15f184[_0xf3a8('0x23')]();};}function saveUpdates(_0x45fc06,_0x461c7c){return function(_0x509c91){if(_0x509c91){return _0x509c91[_0xf3a8('0x24')](_0x45fc06)[_0xf3a8('0x25')](function(_0x1fb213){return _0x1fb213;});}return null;};}function removeEntity(_0x131ef0,_0x215664){return function(_0x33dd54){if(_0x33dd54){return _0x33dd54['destroy']()['then'](function(){var _0x2967f0=_0x33dd54[_0xf3a8('0x26')]({'plain':!![]});var _0x456442='Pauses';return db['UserProfileResource'][_0xf3a8('0x27')]({'where':{'type':_0x456442,'resourceId':_0x2967f0['id']}})['then'](function(){return _0x33dd54;});})['then'](function(){_0x131ef0[_0xf3a8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498d26,_0x5939d6){return function(_0x4267a4){if(!_0x4267a4){_0x498d26[_0xf3a8('0x18')](0x194);}return _0x4267a4;};}function handleError(_0x42d4d8,_0x38f4a0){_0x38f4a0=_0x38f4a0||0x1f4;return function(_0x53f07d){logger[_0xf3a8('0x28')](_0x53f07d[_0xf3a8('0x29')]);if(_0x53f07d[_0xf3a8('0x2a')]){delete _0x53f07d[_0xf3a8('0x2a')];}_0x42d4d8['status'](_0x38f4a0)[_0xf3a8('0x2b')](_0x53f07d);};}exports[_0xf3a8('0x2c')]=function(_0xc16c12,_0x350c1c){var _0xb5d920={},_0x3ec7cb={},_0x2d69cd={'count':0x0,'rows':[]};var _0x397bff=_['map'](db[_0xf3a8('0x2d')][_0xf3a8('0x2e')],function(_0x35ed13){return{'name':_0x35ed13[_0xf3a8('0x2f')],'type':_0x35ed13[_0xf3a8('0x30')]['key']};});_0x3ec7cb[_0xf3a8('0x31')]=_['map'](_0x397bff,'name');_0x3ec7cb[_0xf3a8('0x32')]=_[_0xf3a8('0x33')](_0xc16c12[_0xf3a8('0x32')]);_0x3ec7cb[_0xf3a8('0x34')]=_[_0xf3a8('0x35')](_0x3ec7cb[_0xf3a8('0x31')],_0x3ec7cb[_0xf3a8('0x32')]);_0xb5d920[_0xf3a8('0x36')]=_['intersection'](_0x3ec7cb[_0xf3a8('0x31')],qs[_0xf3a8('0x37')](_0xc16c12[_0xf3a8('0x32')][_0xf3a8('0x37')]));_0xb5d920[_0xf3a8('0x36')]=_0xb5d920[_0xf3a8('0x36')][_0xf3a8('0x38')]?_0xb5d920[_0xf3a8('0x36')]:_0x3ec7cb[_0xf3a8('0x31')];if(!_0xc16c12[_0xf3a8('0x32')][_0xf3a8('0x39')](_0xf3a8('0x3a'))){_0xb5d920[_0xf3a8('0x1e')]=qs[_0xf3a8('0x1e')](_0xc16c12['query'][_0xf3a8('0x1e')]);_0xb5d920[_0xf3a8('0x1c')]=qs[_0xf3a8('0x1c')](_0xc16c12[_0xf3a8('0x32')]['offset']);}_0xb5d920[_0xf3a8('0x3b')]=qs['sort'](_0xc16c12['query'][_0xf3a8('0x3c')]);_0xb5d920['where']=qs[_0xf3a8('0x34')](_[_0xf3a8('0x3d')](_0xc16c12[_0xf3a8('0x32')],_0x3ec7cb[_0xf3a8('0x34')]),_0x397bff);if(_0xc16c12[_0xf3a8('0x32')]['filter']){_0xb5d920['where']=_['merge'](_0xb5d920['where'],{'$or':_[_0xf3a8('0x3e')](_0x397bff,function(_0x5033b9){if(_0x5033b9[_0xf3a8('0x30')]!=='VIRTUAL'){var _0x2bedd7={};_0x2bedd7[_0x5033b9[_0xf3a8('0x2a')]]={'$like':'%'+_0xc16c12[_0xf3a8('0x32')][_0xf3a8('0x3f')]+'%'};return _0x2bedd7;}})});}_0xb5d920=_[_0xf3a8('0x40')]({},_0xb5d920,_0xc16c12[_0xf3a8('0x41')]);var _0x46c16f={'where':_0xb5d920[_0xf3a8('0x42')]};return db[_0xf3a8('0x2d')][_0xf3a8('0x1f')](_0x46c16f)[_0xf3a8('0x25')](function(_0x1176a0){_0x2d69cd[_0xf3a8('0x1f')]=_0x1176a0;if(_0xc16c12[_0xf3a8('0x32')]['includeAll']){_0xb5d920[_0xf3a8('0x43')]=[{'all':!![]}];}return db[_0xf3a8('0x2d')][_0xf3a8('0x44')](_0xb5d920);})[_0xf3a8('0x25')](function(_0x810d15){_0x2d69cd[_0xf3a8('0x45')]=_0x810d15;return _0x2d69cd;})['then'](respondWithFilteredResult(_0x350c1c,_0xb5d920))[_0xf3a8('0x46')](handleError(_0x350c1c,null));};exports[_0xf3a8('0x47')]=function(_0x7503e7,_0x10efb7){var _0x2660ba={'raw':!![],'where':{'id':_0x7503e7['params']['id']}},_0x28125c={};_0x28125c[_0xf3a8('0x31')]=_[_0xf3a8('0x33')](db['Pause'][_0xf3a8('0x2e')]);_0x28125c['query']=_[_0xf3a8('0x33')](_0x7503e7[_0xf3a8('0x32')]);_0x28125c[_0xf3a8('0x34')]=_['intersection'](_0x28125c[_0xf3a8('0x31')],_0x28125c[_0xf3a8('0x32')]);_0x2660ba[_0xf3a8('0x36')]=_[_0xf3a8('0x35')](_0x28125c[_0xf3a8('0x31')],qs[_0xf3a8('0x37')](_0x7503e7[_0xf3a8('0x32')][_0xf3a8('0x37')]));_0x2660ba['attributes']=_0x2660ba[_0xf3a8('0x36')][_0xf3a8('0x38')]?_0x2660ba[_0xf3a8('0x36')]:_0x28125c[_0xf3a8('0x31')];if(_0x7503e7[_0xf3a8('0x32')]['includeAll']){_0x2660ba[_0xf3a8('0x43')]=[{'all':!![]}];}_0x2660ba=_[_0xf3a8('0x40')]({},_0x2660ba,_0x7503e7[_0xf3a8('0x41')]);return db[_0xf3a8('0x2d')]['find'](_0x2660ba)[_0xf3a8('0x25')](handleEntityNotFound(_0x10efb7,null))[_0xf3a8('0x25')](respondWithResult(_0x10efb7,null))[_0xf3a8('0x46')](handleError(_0x10efb7,null));};exports['create']=function(_0x2a6276,_0x2a75ce){return db['Pause'][_0xf3a8('0x48')](_0x2a6276[_0xf3a8('0x49')],{})['then'](function(_0x552191){var _0xf3e401=_0x2a6276['user'][_0xf3a8('0x26')]({'plain':!![]});if(!_0xf3e401)throw new Error(_0xf3a8('0x4a'));if(_0xf3e401[_0xf3a8('0x4b')]===_0xf3a8('0x4c')){var _0x355eab=_0x552191[_0xf3a8('0x26')]({'plain':!![]});var _0x4cc08c=_0xf3a8('0x4d');return db[_0xf3a8('0x4e')][_0xf3a8('0x4f')]({'where':{'name':_0x4cc08c,'userProfileId':_0xf3e401[_0xf3a8('0x50')]},'raw':!![]})['then'](function(_0x2199fc){if(_0x2199fc&&_0x2199fc[_0xf3a8('0x51')]===0x0){return db[_0xf3a8('0x52')][_0xf3a8('0x48')]({'name':_0x355eab[_0xf3a8('0x2a')],'resourceId':_0x355eab['id'],'type':_0x2199fc[_0xf3a8('0x2a')],'sectionId':_0x2199fc['id']},{})['then'](function(){return _0x552191;});}else{return _0x552191;}})['catch'](function(_0x4db948){logger[_0xf3a8('0x28')](_0xf3a8('0x53'),_0x4db948);throw _0x4db948;});}return _0x552191;})[_0xf3a8('0x25')](respondWithResult(_0x2a75ce,0xc9))[_0xf3a8('0x46')](handleError(_0x2a75ce,null));};exports[_0xf3a8('0x24')]=function(_0x3c4133,_0x3bfdf3){if(_0x3c4133[_0xf3a8('0x49')]['id']){delete _0x3c4133['body']['id'];}return db['Pause'][_0xf3a8('0x4f')]({'where':{'id':_0x3c4133['params']['id']}})[_0xf3a8('0x25')](handleEntityNotFound(_0x3bfdf3,null))[_0xf3a8('0x25')](saveUpdates(_0x3c4133[_0xf3a8('0x49')],null))[_0xf3a8('0x25')](respondWithResult(_0x3bfdf3,null))[_0xf3a8('0x46')](handleError(_0x3bfdf3,null));};exports[_0xf3a8('0x27')]=function(_0x32c914,_0x5de01c){return db['Pause'][_0xf3a8('0x4f')]({'where':{'id':_0x32c914[_0xf3a8('0x54')]['id']}})[_0xf3a8('0x25')](handleEntityNotFound(_0x5de01c,null))['then'](removeEntity(_0x5de01c,null))[_0xf3a8('0x46')](handleError(_0x5de01c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 03c6f62..0695577 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 _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5e271e,_0x21f7ba){var _0x148e01=function(_0x2c1a3b){while(--_0x2c1a3b){_0x5e271e['push'](_0x5e271e['shift']());}};_0x148e01(++_0x21f7ba);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4b4397,_0x389ffe){_0x4b4397=_0x4b4397-0x0;var _0x2bfff3=_0x1cb9[_0x4b4397];return _0x2bfff3;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x480986,_0x6d6b32){var _0x40b219=function(_0x58a741){while(--_0x58a741){_0x480986['push'](_0x480986['shift']());}};_0x40b219(++_0x6d6b32);}(_0xf494,0x1c6));var _0x4f49=function(_0x5e28a1,_0x306092){_0x5e28a1=_0x5e28a1-0x0;var _0x37d2a7=_0xf494[_0x5e28a1];return _0x37d2a7;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 631a842..858fe44 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x24b55c,_0x5d5fe5){var _0x4556b0=function(_0x579c6c){while(--_0x579c6c){_0x24b55c['push'](_0x24b55c['shift']());}};_0x4556b0(++_0x5d5fe5);}(_0xb10b,0x12a));var _0xbb10=function(_0x15ece6,_0x51a965){_0x15ece6=_0x15ece6-0x0;var _0x3dc05c=_0xb10b[_0x15ece6];return _0x3dc05c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5b842b,_0x4b88e9){var _0x264ff2=function(_0x8bff9b){while(--_0x8bff9b){_0x5b842b['push'](_0x5b842b['shift']());}};_0x264ff2(++_0x4b88e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5659c0,_0x5f2532){_0x5659c0=_0x5659c0-0x0;var _0x36e3c0=_0xb10b[_0x5659c0];return _0x36e3c0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 274ac3e..d0ce5e4 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 _0xa41a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','webhookGet','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','post','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xa41a,0x6b));var _0xaa41=function(_0x3fc6c2,_0x3acffd){_0x3fc6c2=_0x3fc6c2-0x0;var _0x1b025e=_0xa41a[_0x3fc6c2];return _0x1b025e;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/webhook',controller[_0xaa41('0xc')]);router[_0xaa41('0xd')]('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xd')](_0xaa41('0xf'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);var upload=multer({'storage':multer[_0xaa41('0x11')]({'destination':function(_0x423a19,_0x1c291e,_0x5c9fc7){_0x5c9fc7(null,path[_0xaa41('0x12')](config[_0xaa41('0x13')],'server/files/plugins'));},'filename':function(_0x54827c,_0x1d0a54,_0x518b5b){_0x1d0a54[_0xaa41('0x14')]=_0x1d0a54[_0xaa41('0x14')][_0xaa41('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x518b5b(null,util[_0xaa41('0x16')](_0xaa41('0x17'),path['basename'](_0x1d0a54[_0xaa41('0x14')],path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])),Date[_0xaa41('0x19')](),path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])));}})});router[_0xaa41('0x1a')]('/',upload['single'](_0xaa41('0x1b')),controller[_0xaa41('0x1c')]);router[_0xaa41('0x1a')](_0xaa41('0x1d'),controller[_0xaa41('0x1e')]);router[_0xaa41('0x1f')](_0xaa41('0x20'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x21')]);router['delete']('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0x22')]);module[_0xaa41('0x23')]=router; \ No newline at end of file +var _0x4ea3=['%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','root','server/files/plugins','originalname','replace','format'];(function(_0x3c9a7c,_0x26856c){var _0x43826c=function(_0x4224c4){while(--_0x4224c4){_0x3c9a7c['push'](_0x3c9a7c['shift']());}};_0x43826c(++_0x26856c);}(_0x4ea3,0x70));var _0x34ea=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4ea3[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),controller[_0x34ea('0xb')]);router['get'](_0x34ea('0xc'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['get'](_0x34ea('0xe'),auth[_0x34ea('0x8')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bd8b6,_0x346287,_0x167667){_0x167667(null,path['join'](config[_0x34ea('0xf')],_0x34ea('0x10')));},'filename':function(_0x10135f,_0x233b11,_0x60725f){_0x233b11[_0x34ea('0x11')]=_0x233b11[_0x34ea('0x11')][_0x34ea('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x60725f(null,util[_0x34ea('0x13')](_0x34ea('0x14'),path[_0x34ea('0x15')](_0x233b11['originalname'],path[_0x34ea('0x16')](_0x233b11[_0x34ea('0x11')])),Date[_0x34ea('0x17')](),path[_0x34ea('0x16')](_0x233b11[_0x34ea('0x11')])));}})});router['post']('/',upload[_0x34ea('0x18')](_0x34ea('0x19')),controller[_0x34ea('0x1a')]);router[_0x34ea('0x1b')]('/webhook',controller[_0x34ea('0x1c')]);router[_0x34ea('0x1d')](_0x34ea('0xc'),auth['isAuthenticated'](),controller[_0x34ea('0x1e')]);router[_0x34ea('0x1f')](_0x34ea('0xc'),auth[_0x34ea('0x8')](),controller['delete']);module[_0x34ea('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index bae1d09..dcd6bb0 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 _0x9879=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always'];(function(_0x2038a5,_0xf86914){var _0x20a8cf=function(_0x4fb974){while(--_0x4fb974){_0x2038a5['push'](_0x2038a5['shift']());}};_0x20a8cf(++_0xf86914);}(_0x9879,0x92));var _0x9987=function(_0x3df8a0,_0x2c14df){_0x3df8a0=_0x3df8a0-0x0;var _0x867f54=_0x9879[_0x3df8a0];return _0x867f54;};'use strict';var Sequelize=require(_0x9987('0x0'));module[_0x9987('0x1')]={'name':{'type':Sequelize[_0x9987('0x2')]},'type':{'type':Sequelize[_0x9987('0x3')](_0x9987('0x4'),_0x9987('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x9987('0x6')],'defaultValue':0x0,'comment':_0x9987('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x9987('0x8'),_0x9987('0x9'),_0x9987('0xa')),'defaultValue':_0x9987('0x9'),'comment':_0x9987('0xb')},'icon':{'type':Sequelize[_0x9987('0x2')]},'adminUrl':{'type':Sequelize[_0x9987('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x9987('0x2')]}}; \ No newline at end of file +var _0xff9c=['sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x278ed1,_0x3997e6){var _0x599068=function(_0x1da92f){while(--_0x1da92f){_0x278ed1['push'](_0x278ed1['shift']());}};_0x599068(++_0x3997e6);}(_0xff9c,0x108));var _0xcff9=function(_0x1935e0,_0x3c7e5d){_0x1935e0=_0x1935e0-0x0;var _0x19eac7=_0xff9c[_0x1935e0];return _0x19eac7;};'use strict';var Sequelize=require(_0xcff9('0x0'));module[_0xcff9('0x1')]={'name':{'type':Sequelize[_0xcff9('0x2')]},'type':{'type':Sequelize[_0xcff9('0x3')]('html',_0xcff9('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xcff9('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0xcff9('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xcff9('0x7')},'sidebar':{'type':Sequelize[_0xcff9('0x3')](_0xcff9('0x8'),'agentOnly',_0xcff9('0x9'),'never'),'defaultValue':_0xcff9('0x9'),'comment':_0xcff9('0xa')},'icon':{'type':Sequelize[_0xcff9('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xcff9('0x2')]},'scriptName':{'type':Sequelize[_0xcff9('0x2')]},'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 8366c84..24e1534 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 _0x0470=['limit','Content-Range','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','send','index','map','rawAttributes','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','includeAll','include','rows','show','params','catch','download','join','root','%s.zip','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','basename','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','agent','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','find','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','method','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','end','status','json','offset','undefined','count'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x0470,0x1d4));var _0x0047=function(_0x5bef8b,_0x297cac){_0x5bef8b=_0x5bef8b-0x0;var _0x1129de=_0x0470[_0x5bef8b];return _0x1129de;};'use strict';var emlformat=require(_0x0047('0x0'));var rimraf=require(_0x0047('0x1'));var zipdir=require(_0x0047('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0047('0x3'));var moment=require(_0x0047('0x4'));var BPromise=require(_0x0047('0x5'));var Mustache=require(_0x0047('0x6'));var util=require('util');var path=require(_0x0047('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0047('0x8'));var fs=require('fs');var fs_extra=require(_0x0047('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0047('0xa'));var jsforce=require(_0x0047('0xb'));var deskjs=require(_0x0047('0xc'));var toCsv=require(_0x0047('0xd'));var querystring=require(_0x0047('0xe'));var Papa=require(_0x0047('0xf'));var extract=require(_0x0047('0x10'));var rimraf=require(_0x0047('0x1'));var archiver=require(_0x0047('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0047('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0047('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0047('0x14'));var db=require('../../mysqldb')['db'];config[_0x0047('0x15')]=_[_0x0047('0x16')](config['redis'],{'host':_0x0047('0x17'),'port':0x18eb});var socket=require(_0x0047('0x18'))(new Redis(config['redis']));require(_0x0047('0x19'))[_0x0047('0x1a')](socket);function respondWithStatusCode(_0x20e765,_0x225a93){_0x225a93=_0x225a93||0xcc;return function(_0x2d0865){if(_0x2d0865){return _0x20e765['sendStatus'](_0x225a93);}return _0x20e765['status'](_0x225a93)[_0x0047('0x1b')]();};}function respondWithResult(_0x3860b8,_0x42d81e){_0x42d81e=_0x42d81e||0xc8;return function(_0x24782f){if(_0x24782f){return _0x3860b8[_0x0047('0x1c')](_0x42d81e)[_0x0047('0x1d')](_0x24782f);}};}function respondWithFilteredResult(_0x2c45e7,_0xf37e2a){return function(_0x404a5d){if(_0x404a5d){var _0x1da44f=typeof _0xf37e2a[_0x0047('0x1e')]==='undefined'&&typeof _0xf37e2a['limit']===_0x0047('0x1f');var _0x40901e=_0x404a5d['count'];var _0x219080=_0x1da44f?0x0:_0xf37e2a['offset'];var _0x24a9d6=_0x1da44f?_0x404a5d[_0x0047('0x20')]:_0xf37e2a[_0x0047('0x1e')]+_0xf37e2a[_0x0047('0x21')];var _0x3fdd8e;if(_0x24a9d6>=_0x40901e){_0x24a9d6=_0x40901e;_0x3fdd8e=0xc8;}else{_0x3fdd8e=0xce;}_0x2c45e7['status'](_0x3fdd8e);return _0x2c45e7['set'](_0x0047('0x22'),_0x219080+'-'+_0x24a9d6+'/'+_0x40901e)['json'](_0x404a5d);}return null;};}function patchUpdates(_0x2e78b0){return function(_0x3634bd){try{jsonpatch['apply'](_0x3634bd,_0x2e78b0,!![]);}catch(_0x2bf6b4){return BPromise['reject'](_0x2bf6b4);}return _0x3634bd[_0x0047('0x23')]();};}function saveUpdates(_0x41d096,_0x18a437){return function(_0x3c6a2f){if(_0x3c6a2f){return _0x3c6a2f[_0x0047('0x24')](_0x41d096)[_0x0047('0x25')](function(_0x38ce0a){return _0x38ce0a;});}return null;};}function removeEntity(_0x2b684d,_0x1adfba){return function(_0x5f53ab){if(_0x5f53ab){return _0x5f53ab[_0x0047('0x26')]()[_0x0047('0x25')](function(){var _0x29ed82=_0x5f53ab[_0x0047('0x27')]({'plain':!![]});var _0xd1e00f=_0x0047('0x28');return db[_0x0047('0x29')][_0x0047('0x26')]({'where':{'type':_0xd1e00f,'resourceId':_0x29ed82['id']}})[_0x0047('0x25')](function(){return _0x5f53ab;});})[_0x0047('0x25')](function(){_0x2b684d['status'](0xcc)[_0x0047('0x1b')]();});}};}function handleEntityNotFound(_0x3edeb8,_0x2ac11b){return function(_0x4cde80){if(!_0x4cde80){_0x3edeb8[_0x0047('0x2a')](0x194);}return _0x4cde80;};}function handleError(_0x3aeaea,_0x20a735){_0x20a735=_0x20a735||0x1f4;return function(_0x8b89a1){logger[_0x0047('0x2b')](_0x8b89a1[_0x0047('0x2c')]);if(_0x8b89a1['name']){delete _0x8b89a1['name'];}_0x3aeaea[_0x0047('0x1c')](_0x20a735)[_0x0047('0x2d')](_0x8b89a1);};}exports[_0x0047('0x2e')]=function(_0x1fb958,_0xf5032c){var _0x3fb061={},_0xe8dc7f={},_0x5a359d={'count':0x0,'rows':[]};var _0x2484fe=_[_0x0047('0x2f')](db['Plugin'][_0x0047('0x30')],function(_0x5ae008){return{'name':_0x5ae008['fieldName'],'type':_0x5ae008[_0x0047('0x31')][_0x0047('0x32')]};});_0xe8dc7f[_0x0047('0x33')]=_[_0x0047('0x2f')](_0x2484fe,_0x0047('0x34'));_0xe8dc7f['query']=_[_0x0047('0x35')](_0x1fb958['query']);_0xe8dc7f[_0x0047('0x36')]=_[_0x0047('0x37')](_0xe8dc7f[_0x0047('0x33')],_0xe8dc7f[_0x0047('0x38')]);_0x3fb061[_0x0047('0x39')]=_[_0x0047('0x37')](_0xe8dc7f[_0x0047('0x33')],qs[_0x0047('0x3a')](_0x1fb958['query'][_0x0047('0x3a')]));_0x3fb061[_0x0047('0x39')]=_0x3fb061[_0x0047('0x39')][_0x0047('0x3b')]?_0x3fb061['attributes']:_0xe8dc7f[_0x0047('0x33')];if(!_0x1fb958[_0x0047('0x38')][_0x0047('0x3c')](_0x0047('0x3d'))){_0x3fb061['limit']=qs[_0x0047('0x21')](_0x1fb958[_0x0047('0x38')][_0x0047('0x21')]);_0x3fb061[_0x0047('0x1e')]=qs[_0x0047('0x1e')](_0x1fb958[_0x0047('0x38')][_0x0047('0x1e')]);}_0x3fb061[_0x0047('0x3e')]=qs[_0x0047('0x3f')](_0x1fb958[_0x0047('0x38')]['sort']);_0x3fb061[_0x0047('0x40')]=qs[_0x0047('0x36')](_[_0x0047('0x41')](_0x1fb958[_0x0047('0x38')],_0xe8dc7f[_0x0047('0x36')]),_0x2484fe);if(_0x1fb958[_0x0047('0x38')][_0x0047('0x42')]){_0x3fb061['where']=_[_0x0047('0x43')](_0x3fb061[_0x0047('0x40')],{'$or':_[_0x0047('0x2f')](_0x2484fe,function(_0xb9e8f9){if(_0xb9e8f9[_0x0047('0x31')]!==_0x0047('0x44')){var _0x2f3651={};_0x2f3651[_0xb9e8f9[_0x0047('0x34')]]={'$like':'%'+_0x1fb958[_0x0047('0x38')]['filter']+'%'};return _0x2f3651;}})});}_0x3fb061=_['merge']({},_0x3fb061,_0x1fb958[_0x0047('0x45')]);var _0x4d5832={'where':_0x3fb061[_0x0047('0x40')]};return db[_0x0047('0x46')][_0x0047('0x20')](_0x4d5832)[_0x0047('0x25')](function(_0x180ef4){_0x5a359d[_0x0047('0x20')]=_0x180ef4;if(_0x1fb958['query'][_0x0047('0x47')]){_0x3fb061[_0x0047('0x48')]=[{'all':!![]}];}return db[_0x0047('0x46')]['findAll'](_0x3fb061);})[_0x0047('0x25')](function(_0x32f88e){_0x5a359d[_0x0047('0x49')]=_0x32f88e;return _0x5a359d;})[_0x0047('0x25')](respondWithFilteredResult(_0xf5032c,_0x3fb061))['catch'](handleError(_0xf5032c,null));};exports[_0x0047('0x4a')]=function(_0x590d4a,_0x27ff0d){var _0x422ce2={'raw':!![],'where':{'id':_0x590d4a[_0x0047('0x4b')]['id']}},_0x4784cf={};_0x4784cf[_0x0047('0x33')]=_[_0x0047('0x35')](db[_0x0047('0x46')][_0x0047('0x30')]);_0x4784cf[_0x0047('0x38')]=_[_0x0047('0x35')](_0x590d4a[_0x0047('0x38')]);_0x4784cf[_0x0047('0x36')]=_['intersection'](_0x4784cf['model'],_0x4784cf['query']);_0x422ce2[_0x0047('0x39')]=_[_0x0047('0x37')](_0x4784cf[_0x0047('0x33')],qs['fields'](_0x590d4a[_0x0047('0x38')]['fields']));_0x422ce2[_0x0047('0x39')]=_0x422ce2[_0x0047('0x39')][_0x0047('0x3b')]?_0x422ce2[_0x0047('0x39')]:_0x4784cf[_0x0047('0x33')];if(_0x590d4a[_0x0047('0x38')][_0x0047('0x47')]){_0x422ce2[_0x0047('0x48')]=[{'all':!![]}];}_0x422ce2=_[_0x0047('0x43')]({},_0x422ce2,_0x590d4a[_0x0047('0x45')]);return db[_0x0047('0x46')]['find'](_0x422ce2)[_0x0047('0x25')](handleEntityNotFound(_0x27ff0d,null))[_0x0047('0x25')](respondWithResult(_0x27ff0d,null))[_0x0047('0x4c')](handleError(_0x27ff0d,null));};exports[_0x0047('0x4d')]=function(_0x44deb2,_0xdc96e0,_0x3c1586){return db[_0x0047('0x46')]['find']({'where':{'id':_0x44deb2['params']['id']},'attributes':[_0x0047('0x34'),_0x0047('0x7')],'raw':!![]})[_0x0047('0x25')](handleEntityNotFound(_0xdc96e0,null))[_0x0047('0x25')](function(_0x3e9a4e){if(_0x3e9a4e){var _0x228c5a=path[_0x0047('0x4e')](config[_0x0047('0x4f')],'server/files/plugins',util['format'](_0x0047('0x50'),path['basename'](_0x3e9a4e[_0x0047('0x7')])));var _0x5b4276=fs[_0x0047('0x51')](_0x228c5a);var _0x5cca0a=archiver(_0x0047('0x52'),{'zlib':{'level':0x9}});_0x5cca0a['on']('warning',function(_0x3b9472){if(_0x3b9472[_0x0047('0x53')]===_0x0047('0x54')){logger[_0x0047('0x2b')](_0x3b9472);}else{throw new db[(_0x0047('0x55'))][(_0x0047('0x56'))](_0x0047('0x57'));}});_0x5cca0a['on'](_0x0047('0x2b'),function(_0x14e69f){throw new db[(_0x0047('0x55'))][(_0x0047('0x56'))](_0x0047('0x57'));});_0x5cca0a[_0x0047('0x58')](_0x5b4276);_0x5cca0a[_0x0047('0x59')](_0x0047('0x5a'),{'cwd':path[_0x0047('0x4e')](config['root'],_0x0047('0x5b'),path[_0x0047('0x5c')](_0x3e9a4e['path'])),'ignore':[path[_0x0047('0x4e')](path['basename'](_0x3e9a4e[_0x0047('0x7')]),_0x0047('0x5d')),path[_0x0047('0x4e')](path[_0x0047('0x5e')](_0x3e9a4e[_0x0047('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x0047('0x5f')]();_0x5b4276['on'](_0x0047('0x60'),function(){if(!fs[_0x0047('0x61')](_0x228c5a)){throw new db[(_0x0047('0x55'))][(_0x0047('0x56'))](_0x0047('0x62'));}return _0xdc96e0['download'](_0x228c5a,util[_0x0047('0x63')](_0x0047('0x50'),path[_0x0047('0x5e')](_0x3e9a4e[_0x0047('0x7')])),function(_0x239463){if(_0x239463){throw new db[(_0x0047('0x55'))][(_0x0047('0x56'))](_0x0047('0x64'));}fs[_0x0047('0x65')](_0x228c5a);logger[_0x0047('0x66')]('Download\x20completed');logger[_0x0047('0x66')]('Temporary\x20file\x20removed');});});}return null;})[_0x0047('0x4c')](handleError(_0xdc96e0,null));};exports['upload']=function(_0x1daa63,_0x55a510,_0x1eb248){var _0x2bb758=path[_0x0047('0x5e')](_0x1daa63[_0x0047('0x67')][_0x0047('0x68')],path[_0x0047('0x69')](_0x1daa63[_0x0047('0x67')][_0x0047('0x68')]));var _0x2dacc3=path[_0x0047('0x4e')](config[_0x0047('0x4f')],_0x0047('0x5b'),_0x1daa63[_0x0047('0x67')]['filename']);var _0x418940=path['join'](config[_0x0047('0x4f')],'server/files/plugins',_0x2bb758);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x2dacc3);logger[_0x0047('0x66')](_0x0047('0x6a'),_0x418940);try{fs[_0x0047('0x6b')](_0x2dacc3,parseInt(_0x0047('0x6c'),0x8));extract(_0x2dacc3,{'dir':_0x418940},function(_0x1aad17){if(_0x1aad17){logger[_0x0047('0x2b')](_0x1aad17);handleError(_0x1aad17,!![]);};var _0x4d210f=fs[_0x0047('0x6d')](_0x418940);if(_0x4d210f[_0x0047('0x3b')]>0x1){removeReferences(_0x2dacc3,_0x418940);logger[_0x0047('0x2b')]('Invalid\x20plugin\x20structure');return _0x1eb248(new Error(_0x0047('0x6e')));}var _0x1cdb48=fs[_0x0047('0x6f')](path[_0x0047('0x4e')](_0x418940,_0x4d210f[0x0]));if(_0x1cdb48[_0x0047('0x70')]()){removeReferences(_0x2dacc3,_0x418940);logger['error'](_0x0047('0x6e'));return _0x1eb248(new Error(_0x0047('0x6e')));}if(_0x1cdb48[_0x0047('0x71')]()){var _0x5ccd86=fs[_0x0047('0x6d')](path['join'](_0x418940,_0x4d210f[0x0]));if(_0x5ccd86[_0x0047('0x3b')]===0x0){removeReferences(_0x2dacc3,_0x418940);logger['error']('Invalid\x20plugin\x20structure');return _0x1eb248(new Error(_0x0047('0x6e')));}var _0x7f01e=_0x5ccd86[_0x0047('0x72')](function(_0x1b9a33){return _0x1b9a33==='manifest.json';});if(!_0x7f01e){return _0x1eb248(new Error('Plugin\x20manifest\x20missing'));}var _0x431358=fs[_0x0047('0x73')](path['join'](_0x418940,_0x4d210f[0x0],'manifest.json'));var _0x410136=JSON['parse'](_0x431358);if(_0x0047('0x1f')==typeof _0x410136[_0x0047('0x34')]){return _0x1eb248(new Error(_0x0047('0x74')));}if('undefined'==typeof _0x410136['type']){return _0x1eb248(new Error(_0x0047('0x75')));}if(_0x0047('0x1f')==typeof _0x410136[_0x0047('0x76')]){return _0x1eb248(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x0047('0x1f')==typeof _0x410136['parameters']){return _0x1eb248(new Error(_0x0047('0x77')));}if(_0x410136['type']===_0x0047('0x78')){if(_0x0047('0x1f')==typeof _0x410136[_0x0047('0x79')]['views']){return _0x1eb248(new Error(_0x0047('0x7a')));}if(_0x0047('0x1f')==typeof _0x410136['parameters'][_0x0047('0x7b')][_0x0047('0x7c')]&&_0x0047('0x1f')==typeof _0x410136[_0x0047('0x79')][_0x0047('0x7b')]['agent']){return _0x1eb248(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x410136['type']===_0x0047('0x7d')){if(_0x0047('0x1f')==typeof _0x410136[_0x0047('0x79')][_0x0047('0x7e')]){return _0x1eb248(new Error(_0x0047('0x7f')));}if('undefined'==typeof _0x410136['parameters'][_0x0047('0x80')]){return _0x1eb248(new Error(_0x0047('0x81')));}}else{return _0x1eb248(new Error(_0x0047('0x82')));}var _0x424565=_0x410136[_0x0047('0x34')];var _0x2f3fa6=_0x410136[_0x0047('0x83')];var _0xdbb860=_0x410136[_0x0047('0x31')];var _0x1dc006=_0x410136[_0x0047('0x84')]?_0x410136[_0x0047('0x84')]:_0x0047('0x85');var _0x1a624a=_0x410136[_0x0047('0x86')]?_0x410136['icon']:'icon-apps';var _0x2c8058='';var _0x454ec8='';var _0x41fbff='';var _0x5a6bc6='';var _0x5659ce=_0x410136['version'];if(_0xdbb860===_0x0047('0x78')){if(_0x0047('0x1f')!=typeof _0x410136[_0x0047('0x79')][_0x0047('0x7b')][_0x0047('0x7c')]){var _0x5f0f8d=_0x410136[_0x0047('0x79')][_0x0047('0x7b')][_0x0047('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5f0f8d)){_0x2c8058=path[_0x0047('0x4e')]('plugins',_0x2bb758,_0x4d210f[0x0],_0x5f0f8d);}else{_0x2c8058=_0x5f0f8d;}}else{logger[_0x0047('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x0047('0x1f')!=typeof _0x410136['parameters'][_0x0047('0x7b')][_0x0047('0x87')]){var _0x31df4b=_0x410136['parameters'][_0x0047('0x7b')][_0x0047('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x0047('0x88')](_0x31df4b)){_0x454ec8=path[_0x0047('0x4e')](_0x0047('0x89'),_0x2bb758,_0x4d210f[0x0],_0x31df4b);}else{_0x454ec8=_0x31df4b;}}else{logger[_0x0047('0x66')](_0x0047('0x8a'));}}else if(_0xdbb860===_0x0047('0x7d')){_0x41fbff=_0x410136['parameters'][_0x0047('0x7e')];_0x5a6bc6=_0x410136[_0x0047('0x79')][_0x0047('0x80')];if(_0x0047('0x1f')!=typeof _0x410136['parameters'][_0x0047('0x7b')]){if(_0x0047('0x1f')!=typeof _0x410136[_0x0047('0x79')][_0x0047('0x7b')][_0x0047('0x7c')]){var _0x5f0f8d=_0x410136['parameters'][_0x0047('0x7b')][_0x0047('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x0047('0x88')](_0x5f0f8d)){_0x2c8058=path[_0x0047('0x4e')](_0x0047('0x89'),_0x2bb758,_0x4d210f[0x0],_0x5f0f8d);}else{_0x2c8058=_0x5f0f8d;}}if(_0x0047('0x1f')!=typeof _0x410136[_0x0047('0x79')][_0x0047('0x7b')][_0x0047('0x87')]){var _0x31df4b=_0x410136[_0x0047('0x79')][_0x0047('0x7b')][_0x0047('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x0047('0x88')](_0x31df4b)){_0x454ec8=path[_0x0047('0x4e')](_0x0047('0x89'),_0x2bb758,_0x4d210f[0x0],_0x31df4b);}else{_0x454ec8=_0x31df4b;}}}}var _0x8d4889={'name':_0x424565,'description':_0x2f3fa6,'path':path[_0x0047('0x4e')](_0x2bb758,_0x4d210f[0x0]),'type':_0xdbb860,'sidebar':_0x1dc006,'icon':_0x1a624a,'adminUrl':_0x2c8058,'agentUrl':_0x454ec8,'scriptName':_0x41fbff,'scriptPath':_0x5a6bc6,'version':_0x5659ce};removeReferences(_0x2dacc3,null);return db[_0x0047('0x46')][_0x0047('0x8b')](_0x8d4889)[_0x0047('0x25')](function(_0x2055ac){var _0x13d8cc={'role':_0x1daa63[_0x0047('0x8c')][_0x0047('0x8d')],'userProfileId':_0x1daa63['body'][_0x0047('0x8e')]};if(!_0x13d8cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13d8cc['role']===_0x0047('0x8f')){var _0x48c879=_0x2055ac[_0x0047('0x27')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x0047('0x28'),'userProfileId':_0x13d8cc[_0x0047('0x8e')]},'raw':!![]})[_0x0047('0x25')](function(_0x1b54b0){if(_0x1b54b0&&_0x1b54b0[_0x0047('0x90')]===0x0){return db[_0x0047('0x29')][_0x0047('0x8b')]({'name':_0x48c879[_0x0047('0x34')],'resourceId':_0x48c879['id'],'type':_0x1b54b0[_0x0047('0x34')],'sectionId':_0x1b54b0['id']},{})['then'](function(){return _0x2055ac;});}else{return _0x2055ac;}})[_0x0047('0x4c')](function(_0xbaae67){logger[_0x0047('0x2b')](_0x0047('0x91'),_0xbaae67);throw _0xbaae67;});}return _0x2055ac;})['then'](respondWithResult(_0x55a510,null))[_0x0047('0x4c')](handleError(_0x55a510,null));}});}catch(_0x18de50){_0x55a510[_0x0047('0x1c')](0x1f4)[_0x0047('0x2d')](_0x18de50);}};function removeReferences(_0x4d8ed1,_0x2e6bd3){try{if(_0x4d8ed1){fs[_0x0047('0x65')](_0x4d8ed1);logger['info'](_0x0047('0x92'));}if(_0x2e6bd3){rimraf(_0x2e6bd3,function(){});logger[_0x0047('0x66')](_0x0047('0x93'));}}catch(_0xda5680){logger[_0x0047('0x2b')](_0xda5680);}}exports['update']=function(_0x320817,_0x467fb0,_0x412dee){return db[_0x0047('0x46')][_0x0047('0x94')]({'where':{'id':_0x320817[_0x0047('0x4b')]['id']}})[_0x0047('0x25')](handleEntityNotFound(_0x467fb0,null))['then'](saveUpdates(_0x320817[_0x0047('0x8c')],null))[_0x0047('0x25')](respondWithResult(_0x467fb0,null))[_0x0047('0x4c')](handleError(_0x467fb0,null));};exports[_0x0047('0x95')]=function(_0x3f865d,_0x166fd6,_0x163cfe){return db['Plugin'][_0x0047('0x94')]({'where':{'id':_0x3f865d[_0x0047('0x4b')]['id']}})[_0x0047('0x25')](function(_0x4b57a6){if(_0x4b57a6){return _0x4b57a6[_0x0047('0x26')]();}})[_0x0047('0x25')](function(_0x179fc2){rimraf(path[_0x0047('0x4e')](config['root'],_0x0047('0x5b'),path[_0x0047('0x5c')](_0x179fc2[_0x0047('0x7')])),function(){});return _0x179fc2;})[_0x0047('0x25')](handleEntityNotFound(_0x166fd6,null))['then'](respondWithStatusCode(_0x166fd6,null))['catch'](handleError(_0x166fd6,null));};exports[_0x0047('0x96')]=function(_0x4d969b,_0x332b56,_0x171b13){return BPromise['resolve']()['then'](function(){if(!_0x4d969b[_0x0047('0x38')][_0x0047('0x7')]){throw new Error(_0x0047('0x97'));}if(!_0x4d969b['query'][_0x0047('0x98')]){throw new Error(_0x0047('0x99'));}var _0x149088=_0x4d969b[_0x0047('0x38')]['hostname']?_0x4d969b[_0x0047('0x38')][_0x0047('0x9a')]+':'+_0x4d969b[_0x0047('0x38')][_0x0047('0x98')]:_0x0047('0x9b')+_0x4d969b['query'][_0x0047('0x98')];var _0xae48e1=_0x4d969b['query'][_0x0047('0x1d')]?_0x4d969b['query']['json']:!![];var _0x7b52df=_0x4d969b[_0x0047('0x38')][_0x0047('0x9c')]?_0x4d969b[_0x0047('0x38')]['encoding']:null;var _0x435a50={'method':_0x4d969b['method'],'uri':util[_0x0047('0x63')](_0x0047('0x9d'),_0x149088,_0x4d969b[_0x0047('0x38')][_0x0047('0x7')]),'json':_0xae48e1,'resolveWithFullResponse':!![],'encoding':_0x7b52df,'qs':_0x4d969b[_0x0047('0x38')]};if(_0x4d969b[_0x0047('0x9e')]){_0x435a50[_0x0047('0x9e')]=_0x4d969b[_0x0047('0x9e')];if(_0x435a50[_0x0047('0x9e')][_0x0047('0x9f')]){delete _0x435a50[_0x0047('0x9e')][_0x0047('0x9f')];}}if(_0x435a50['headers'][_0x0047('0xa0')]){delete _0x435a50[_0x0047('0x9e')]['content-type'];}return rp(_0x435a50);})[_0x0047('0x25')](function(_0x359d05){if(_0x359d05){_0x332b56[_0x0047('0xa1')](_0x359d05['headers']);logger[_0x0047('0x66')](_0x359d05[_0x0047('0x8c')]);if(_[_0x0047('0xa2')](_0x4d969b[_0x0047('0x38')][_0x0047('0x7')],'download')&&_0x359d05[_0x0047('0xa3')]==0x1f4){return _0x332b56[_0x0047('0x2a')](_0x359d05[_0x0047('0xa3')]);}else{return _0x332b56[_0x0047('0x1c')](_0x359d05[_0x0047('0xa3')])[_0x0047('0x2d')](_0x359d05[_0x0047('0x8c')]);}}else{return _0x332b56['sendStatus'](0xc8);}})['catch'](handleError(_0x332b56,null));};exports[_0x0047('0xa4')]=function(_0x2e5368,_0x3f6825,_0x1521dc){return BPromise[_0x0047('0xa5')]()[_0x0047('0x25')](function(){if(!_0x2e5368[_0x0047('0x38')]['path']){throw new Error(_0x0047('0x97'));}if(!_0x2e5368[_0x0047('0x38')][_0x0047('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4afd03=_0x2e5368[_0x0047('0x38')][_0x0047('0x9a')]?_0x2e5368['query'][_0x0047('0x9a')]+':'+_0x2e5368[_0x0047('0x38')][_0x0047('0x98')]:_0x0047('0x9b')+_0x2e5368[_0x0047('0x38')][_0x0047('0x98')];var _0x58a8ba=_0x2e5368[_0x0047('0x38')]['json']?_0x2e5368[_0x0047('0x38')][_0x0047('0x1d')]:!![];var _0x3ae7ea=_0x2e5368[_0x0047('0x38')][_0x0047('0x9c')]?_0x2e5368['query']['encoding']:null;var _0x2c2e54={'method':_0x2e5368[_0x0047('0xa6')],'uri':util['format'](_0x0047('0x9d'),_0x4afd03,_0x2e5368[_0x0047('0x38')][_0x0047('0x7')]),'json':_0x58a8ba,'resolveWithFullResponse':!![],'encoding':_0x3ae7ea,'body':_0x2e5368[_0x0047('0x8c')]};if(_0x2e5368[_0x0047('0x9e')]){_0x2c2e54[_0x0047('0x9e')]=_0x2e5368[_0x0047('0x9e')];if(_0x2c2e54['headers'][_0x0047('0x9f')]){delete _0x2c2e54[_0x0047('0x9e')][_0x0047('0x9f')];}}if(_0x2c2e54['headers']['content-type']){delete _0x2c2e54[_0x0047('0x9e')][_0x0047('0xa0')];}return rp(_0x2c2e54);})[_0x0047('0x25')](function(_0x420c1b){if(_0x420c1b){_0x3f6825[_0x0047('0xa1')](_0x420c1b[_0x0047('0x9e')]);logger['info'](_0x420c1b[_0x0047('0x8c')]);return _0x3f6825[_0x0047('0x1c')](_0x420c1b[_0x0047('0xa3')])[_0x0047('0x2d')](_0x420c1b[_0x0047('0x8c')]);}else{return _0x3f6825[_0x0047('0x2a')](0xc8);}})['catch'](handleError(_0x3f6825,null));}; \ No newline at end of file +var _0xc397=['filter','type','VIRTUAL','merge','options','Plugin','includeAll','findAll','rows','catch','show','keys','intersection','find','download','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','update','params','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','get','Plugins','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','query','fields','attributes','length','nolimit','sort','where','filters'];(function(_0x5a868f,_0x3466d8){var _0x1e0fd7=function(_0x32de99){while(--_0x32de99){_0x5a868f['push'](_0x5a868f['shift']());}};_0x1e0fd7(++_0x3466d8);}(_0xc397,0x6b));var _0x7c39=function(_0x2e4bff,_0x40e5b1){_0x2e4bff=_0x2e4bff-0x0;var _0x1b4c18=_0xc397[_0x2e4bff];return _0x1b4c18;};'use strict';var emlformat=require(_0x7c39('0x0'));var rimraf=require(_0x7c39('0x1'));var zipdir=require(_0x7c39('0x2'));var jsonpatch=require(_0x7c39('0x3'));var rp=require(_0x7c39('0x4'));var moment=require(_0x7c39('0x5'));var BPromise=require(_0x7c39('0x6'));var Mustache=require(_0x7c39('0x7'));var util=require(_0x7c39('0x8'));var path=require(_0x7c39('0x9'));var sox=require(_0x7c39('0xa'));var csv=require(_0x7c39('0xb'));var ejs=require(_0x7c39('0xc'));var fs=require('fs');var fs_extra=require(_0x7c39('0xd'));var _=require(_0x7c39('0xe'));var squel=require(_0x7c39('0xf'));var crypto=require('crypto');var jsforce=require(_0x7c39('0x10'));var deskjs=require(_0x7c39('0x11'));var toCsv=require(_0x7c39('0xb'));var querystring=require(_0x7c39('0x12'));var Papa=require(_0x7c39('0x13'));var extract=require('extract-zip');var rimraf=require(_0x7c39('0x1'));var archiver=require(_0x7c39('0x14'));var Redis=require(_0x7c39('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x7c39('0x16'));var as=require(_0x7c39('0x17'));var hardwareService=require(_0x7c39('0x18'));var logger=require(_0x7c39('0x19'))(_0x7c39('0x1a'));var utils=require('../../config/utils');var config=require(_0x7c39('0x1b'));var licenseUtil=require(_0x7c39('0x1c'));var db=require('../../mysqldb')['db'];config[_0x7c39('0x1d')]=_[_0x7c39('0x1e')](config['redis'],{'host':_0x7c39('0x1f'),'port':0x18eb});var socket=require(_0x7c39('0x20'))(new Redis(config[_0x7c39('0x1d')]));require(_0x7c39('0x21'))['register'](socket);function respondWithStatusCode(_0x27d1cd,_0x1a2667){_0x1a2667=_0x1a2667||0xcc;return function(_0x1eec47){if(_0x1eec47){return _0x27d1cd[_0x7c39('0x22')](_0x1a2667);}return _0x27d1cd[_0x7c39('0x23')](_0x1a2667)[_0x7c39('0x24')]();};}function respondWithResult(_0x3f4023,_0x216bc5){_0x216bc5=_0x216bc5||0xc8;return function(_0x52793b){if(_0x52793b){return _0x3f4023[_0x7c39('0x23')](_0x216bc5)['json'](_0x52793b);}};}function respondWithFilteredResult(_0x308ddc,_0x266f19){return function(_0x1c6076){if(_0x1c6076){var _0x2e9881=typeof _0x266f19[_0x7c39('0x25')]===_0x7c39('0x26')&&typeof _0x266f19[_0x7c39('0x27')]===_0x7c39('0x26');var _0x395ded=_0x1c6076[_0x7c39('0x28')];var _0x400b3f=_0x2e9881?0x0:_0x266f19['offset'];var _0x3b822b=_0x2e9881?_0x1c6076[_0x7c39('0x28')]:_0x266f19[_0x7c39('0x25')]+_0x266f19[_0x7c39('0x27')];var _0x1240c8;if(_0x3b822b>=_0x395ded){_0x3b822b=_0x395ded;_0x1240c8=0xc8;}else{_0x1240c8=0xce;}_0x308ddc[_0x7c39('0x23')](_0x1240c8);return _0x308ddc[_0x7c39('0x29')](_0x7c39('0x2a'),_0x400b3f+'-'+_0x3b822b+'/'+_0x395ded)[_0x7c39('0x2b')](_0x1c6076);}return null;};}function patchUpdates(_0x31335a){return function(_0x4351ae){try{jsonpatch[_0x7c39('0x2c')](_0x4351ae,_0x31335a,!![]);}catch(_0xa459dc){return BPromise['reject'](_0xa459dc);}return _0x4351ae[_0x7c39('0x2d')]();};}function saveUpdates(_0x36a668,_0x5c4235){return function(_0x13c122){if(_0x13c122){return _0x13c122['update'](_0x36a668)[_0x7c39('0x2e')](function(_0x4f9751){return _0x4f9751;});}return null;};}function removeEntity(_0x2e205b,_0x5d3539){return function(_0x4746b1){if(_0x4746b1){return _0x4746b1['destroy']()[_0x7c39('0x2e')](function(){var _0x32d454=_0x4746b1[_0x7c39('0x2f')]({'plain':!![]});var _0x2c468a=_0x7c39('0x30');return db[_0x7c39('0x31')][_0x7c39('0x32')]({'where':{'type':_0x2c468a,'resourceId':_0x32d454['id']}})['then'](function(){return _0x4746b1;});})[_0x7c39('0x2e')](function(){_0x2e205b[_0x7c39('0x23')](0xcc)[_0x7c39('0x24')]();});}};}function handleEntityNotFound(_0x501a38,_0x196f69){return function(_0x81d599){if(!_0x81d599){_0x501a38[_0x7c39('0x22')](0x194);}return _0x81d599;};}function handleError(_0x253ae9,_0x2685c8){_0x2685c8=_0x2685c8||0x1f4;return function(_0x5a86a2){logger[_0x7c39('0x33')](_0x5a86a2[_0x7c39('0x34')]);if(_0x5a86a2[_0x7c39('0x35')]){delete _0x5a86a2[_0x7c39('0x35')];}_0x253ae9[_0x7c39('0x23')](_0x2685c8)['send'](_0x5a86a2);};}exports[_0x7c39('0x36')]=function(_0x45571b,_0x323c9c){var _0x6ca4fc={},_0x5da99a={},_0x2dd9b2={'count':0x0,'rows':[]};var _0x137c76=_[_0x7c39('0x37')](db['Plugin'][_0x7c39('0x38')],function(_0x51811b){return{'name':_0x51811b[_0x7c39('0x39')],'type':_0x51811b['type']['key']};});_0x5da99a[_0x7c39('0x3a')]=_[_0x7c39('0x37')](_0x137c76,'name');_0x5da99a[_0x7c39('0x3b')]=_['keys'](_0x45571b[_0x7c39('0x3b')]);_0x5da99a['filters']=_['intersection'](_0x5da99a[_0x7c39('0x3a')],_0x5da99a[_0x7c39('0x3b')]);_0x6ca4fc['attributes']=_['intersection'](_0x5da99a[_0x7c39('0x3a')],qs[_0x7c39('0x3c')](_0x45571b[_0x7c39('0x3b')]['fields']));_0x6ca4fc[_0x7c39('0x3d')]=_0x6ca4fc[_0x7c39('0x3d')][_0x7c39('0x3e')]?_0x6ca4fc[_0x7c39('0x3d')]:_0x5da99a[_0x7c39('0x3a')];if(!_0x45571b[_0x7c39('0x3b')]['hasOwnProperty'](_0x7c39('0x3f'))){_0x6ca4fc[_0x7c39('0x27')]=qs[_0x7c39('0x27')](_0x45571b[_0x7c39('0x3b')][_0x7c39('0x27')]);_0x6ca4fc[_0x7c39('0x25')]=qs[_0x7c39('0x25')](_0x45571b['query'][_0x7c39('0x25')]);}_0x6ca4fc['order']=qs[_0x7c39('0x40')](_0x45571b[_0x7c39('0x3b')][_0x7c39('0x40')]);_0x6ca4fc[_0x7c39('0x41')]=qs['filters'](_['pick'](_0x45571b[_0x7c39('0x3b')],_0x5da99a[_0x7c39('0x42')]),_0x137c76);if(_0x45571b[_0x7c39('0x3b')][_0x7c39('0x43')]){_0x6ca4fc['where']=_['merge'](_0x6ca4fc['where'],{'$or':_['map'](_0x137c76,function(_0x366978){if(_0x366978[_0x7c39('0x44')]!==_0x7c39('0x45')){var _0x1ee84e={};_0x1ee84e[_0x366978[_0x7c39('0x35')]]={'$like':'%'+_0x45571b['query'][_0x7c39('0x43')]+'%'};return _0x1ee84e;}})});}_0x6ca4fc=_[_0x7c39('0x46')]({},_0x6ca4fc,_0x45571b[_0x7c39('0x47')]);var _0x5f34e1={'where':_0x6ca4fc[_0x7c39('0x41')]};return db[_0x7c39('0x48')][_0x7c39('0x28')](_0x5f34e1)[_0x7c39('0x2e')](function(_0x2b4c0){_0x2dd9b2[_0x7c39('0x28')]=_0x2b4c0;if(_0x45571b['query'][_0x7c39('0x49')]){_0x6ca4fc['include']=[{'all':!![]}];}return db[_0x7c39('0x48')][_0x7c39('0x4a')](_0x6ca4fc);})[_0x7c39('0x2e')](function(_0x3fcfaf){_0x2dd9b2[_0x7c39('0x4b')]=_0x3fcfaf;return _0x2dd9b2;})[_0x7c39('0x2e')](respondWithFilteredResult(_0x323c9c,_0x6ca4fc))[_0x7c39('0x4c')](handleError(_0x323c9c,null));};exports[_0x7c39('0x4d')]=function(_0x2c5a54,_0x18cfbc){var _0x433ce3={'raw':!![],'where':{'id':_0x2c5a54['params']['id']}},_0x47c185={};_0x47c185[_0x7c39('0x3a')]=_[_0x7c39('0x4e')](db[_0x7c39('0x48')]['rawAttributes']);_0x47c185[_0x7c39('0x3b')]=_['keys'](_0x2c5a54['query']);_0x47c185[_0x7c39('0x42')]=_['intersection'](_0x47c185[_0x7c39('0x3a')],_0x47c185['query']);_0x433ce3[_0x7c39('0x3d')]=_[_0x7c39('0x4f')](_0x47c185['model'],qs['fields'](_0x2c5a54[_0x7c39('0x3b')][_0x7c39('0x3c')]));_0x433ce3[_0x7c39('0x3d')]=_0x433ce3['attributes']['length']?_0x433ce3[_0x7c39('0x3d')]:_0x47c185[_0x7c39('0x3a')];if(_0x2c5a54[_0x7c39('0x3b')]['includeAll']){_0x433ce3['include']=[{'all':!![]}];}_0x433ce3=_[_0x7c39('0x46')]({},_0x433ce3,_0x2c5a54[_0x7c39('0x47')]);return db[_0x7c39('0x48')][_0x7c39('0x50')](_0x433ce3)[_0x7c39('0x2e')](handleEntityNotFound(_0x18cfbc,null))[_0x7c39('0x2e')](respondWithResult(_0x18cfbc,null))[_0x7c39('0x4c')](handleError(_0x18cfbc,null));};exports[_0x7c39('0x51')]=function(_0x51dbf2,_0x196627,_0xf87904){return db['Plugin'][_0x7c39('0x50')]({'where':{'id':_0x51dbf2['params']['id']},'attributes':['name','path'],'raw':!![]})[_0x7c39('0x2e')](handleEntityNotFound(_0x196627,null))['then'](function(_0x175897){if(_0x175897){var _0x29fb01=path['join'](config[_0x7c39('0x52')],_0x7c39('0x53'),util['format'](_0x7c39('0x54'),path[_0x7c39('0x55')](_0x175897['path'])));var _0xdaef8e=fs[_0x7c39('0x56')](_0x29fb01);var _0x50deab=archiver(_0x7c39('0x57'),{'zlib':{'level':0x9}});_0x50deab['on'](_0x7c39('0x58'),function(_0x463f2b){if(_0x463f2b[_0x7c39('0x59')]===_0x7c39('0x5a')){logger[_0x7c39('0x33')](_0x463f2b);}else{throw new db['Sequelize'][(_0x7c39('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x50deab['on'](_0x7c39('0x33'),function(_0x12c50e){throw new db[(_0x7c39('0x5c'))][(_0x7c39('0x5b'))](_0x7c39('0x5d'));});_0x50deab[_0x7c39('0x5e')](_0xdaef8e);_0x50deab['glob'](_0x7c39('0x5f'),{'cwd':path[_0x7c39('0x60')](config[_0x7c39('0x52')],'server/files/plugins',path[_0x7c39('0x61')](_0x175897[_0x7c39('0x9')])),'ignore':[path['join'](path[_0x7c39('0x55')](_0x175897[_0x7c39('0x9')]),_0x7c39('0x62')),path[_0x7c39('0x60')](path[_0x7c39('0x55')](_0x175897[_0x7c39('0x9')]),_0x7c39('0x63'))],'nodir':!![]})[_0x7c39('0x64')]();_0xdaef8e['on'](_0x7c39('0x65'),function(){if(!fs[_0x7c39('0x66')](_0x29fb01)){throw new db['Sequelize'][(_0x7c39('0x5b'))](_0x7c39('0x67'));}return _0x196627[_0x7c39('0x51')](_0x29fb01,util['format']('%s.zip',path[_0x7c39('0x55')](_0x175897[_0x7c39('0x9')])),function(_0x829114){if(_0x829114){throw new db[(_0x7c39('0x5c'))][(_0x7c39('0x5b'))](_0x7c39('0x68'));}fs[_0x7c39('0x69')](_0x29fb01);logger['info'](_0x7c39('0x6a'));logger['info'](_0x7c39('0x6b'));});});}return null;})[_0x7c39('0x4c')](handleError(_0x196627,null));};exports['upload']=function(_0x24f638,_0x5260c5,_0x1fbe3b){var _0x2492d9=path[_0x7c39('0x55')](_0x24f638[_0x7c39('0x6c')][_0x7c39('0x6d')],path[_0x7c39('0x6e')](_0x24f638[_0x7c39('0x6c')]['filename']));var _0x4debcc=path[_0x7c39('0x60')](config[_0x7c39('0x52')],_0x7c39('0x53'),_0x24f638[_0x7c39('0x6c')][_0x7c39('0x6d')]);var _0x58eafd=path['join'](config[_0x7c39('0x52')],_0x7c39('0x53'),_0x2492d9);logger[_0x7c39('0x6f')](_0x7c39('0x70'),_0x4debcc);logger[_0x7c39('0x6f')](_0x7c39('0x71'),_0x58eafd);try{fs['chmodSync'](_0x4debcc,parseInt(_0x7c39('0x72'),0x8));extract(_0x4debcc,{'dir':_0x58eafd},function(_0x54727d){if(_0x54727d){logger[_0x7c39('0x33')](_0x54727d);handleError(_0x54727d,!![]);};var _0x130a80=fs['readdirSync'](_0x58eafd);if(_0x130a80[_0x7c39('0x3e')]>0x1){removeReferences(_0x4debcc,_0x58eafd);logger[_0x7c39('0x33')]('Invalid\x20plugin\x20structure');return _0x1fbe3b(new Error(_0x7c39('0x73')));}var _0x11f9c5=fs[_0x7c39('0x74')](path[_0x7c39('0x60')](_0x58eafd,_0x130a80[0x0]));if(_0x11f9c5['isFile']()){removeReferences(_0x4debcc,_0x58eafd);logger[_0x7c39('0x33')](_0x7c39('0x73'));return _0x1fbe3b(new Error(_0x7c39('0x73')));}if(_0x11f9c5[_0x7c39('0x75')]()){var _0x3757c7=fs[_0x7c39('0x76')](path[_0x7c39('0x60')](_0x58eafd,_0x130a80[0x0]));if(_0x3757c7[_0x7c39('0x3e')]===0x0){removeReferences(_0x4debcc,_0x58eafd);logger['error'](_0x7c39('0x73'));return _0x1fbe3b(new Error('Invalid\x20plugin\x20structure'));}var _0x32bca9=_0x3757c7[_0x7c39('0x77')](function(_0x4110f7){return _0x4110f7==='manifest.json';});if(!_0x32bca9){return _0x1fbe3b(new Error(_0x7c39('0x78')));}var _0x219fbe=fs['readFileSync'](path[_0x7c39('0x60')](_0x58eafd,_0x130a80[0x0],_0x7c39('0x79')));var _0x1370b8=JSON[_0x7c39('0x7a')](_0x219fbe);if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x35')]){return _0x1fbe3b(new Error(_0x7c39('0x7b')));}if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x44')]){return _0x1fbe3b(new Error(_0x7c39('0x7c')));}if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x7d')]){return _0x1fbe3b(new Error(_0x7c39('0x7e')));}if('undefined'==typeof _0x1370b8['parameters']){return _0x1fbe3b(new Error(_0x7c39('0x7f')));}if(_0x1370b8[_0x7c39('0x44')]===_0x7c39('0x80')){if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x81')]['views']){return _0x1fbe3b(new Error(_0x7c39('0x82')));}if(_0x7c39('0x26')==typeof _0x1370b8['parameters'][_0x7c39('0x83')][_0x7c39('0x84')]&&_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x85')]){return _0x1fbe3b(new Error(_0x7c39('0x86')));}}else if(_0x1370b8['type']===_0x7c39('0x87')){if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x81')][_0x7c39('0x88')]){return _0x1fbe3b(new Error(_0x7c39('0x89')));}if(_0x7c39('0x26')==typeof _0x1370b8['parameters'][_0x7c39('0x8a')]){return _0x1fbe3b(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1fbe3b(new Error(_0x7c39('0x8b')));}var _0x4b8292=_0x1370b8['name'];var _0x2bb4b7=_0x1370b8[_0x7c39('0x8c')];var _0x441a89=_0x1370b8['type'];var _0x4003f5=_0x1370b8[_0x7c39('0x8d')]?_0x1370b8['sidebar']:_0x7c39('0x8e');var _0x458190=_0x1370b8[_0x7c39('0x8f')]?_0x1370b8['icon']:'icon-apps';var _0x88e66d='';var _0x1f8d10='';var _0xb2661f='';var _0x23f720='';var _0x481112=_0x1370b8['version'];if(_0x441a89===_0x7c39('0x80')){if(_0x7c39('0x26')!=typeof _0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x84')]){var _0x415430=_0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x415430)){_0x88e66d=path[_0x7c39('0x60')](_0x7c39('0x90'),_0x2492d9,_0x130a80[0x0],_0x415430);}else{_0x88e66d=_0x415430;}}else{logger[_0x7c39('0x6f')](_0x7c39('0x91'));}if(_0x7c39('0x26')!=typeof _0x1370b8[_0x7c39('0x81')]['views'][_0x7c39('0x85')]){var _0x760abc=_0x1370b8['parameters'][_0x7c39('0x83')][_0x7c39('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x7c39('0x92')](_0x760abc)){_0x1f8d10=path[_0x7c39('0x60')](_0x7c39('0x90'),_0x2492d9,_0x130a80[0x0],_0x760abc);}else{_0x1f8d10=_0x760abc;}}else{logger[_0x7c39('0x6f')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x441a89===_0x7c39('0x87')){_0xb2661f=_0x1370b8[_0x7c39('0x81')][_0x7c39('0x88')];_0x23f720=_0x1370b8[_0x7c39('0x81')][_0x7c39('0x8a')];if('undefined'!=typeof _0x1370b8[_0x7c39('0x81')]['views']){if(_0x7c39('0x26')!=typeof _0x1370b8['parameters'][_0x7c39('0x83')]['admin']){var _0x415430=_0x1370b8['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7c39('0x92')](_0x415430)){_0x88e66d=path['join']('plugins',_0x2492d9,_0x130a80[0x0],_0x415430);}else{_0x88e66d=_0x415430;}}if(_0x7c39('0x26')!=typeof _0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x85')]){var _0x760abc=_0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x7c39('0x92')](_0x760abc)){_0x1f8d10=path[_0x7c39('0x60')]('plugins',_0x2492d9,_0x130a80[0x0],_0x760abc);}else{_0x1f8d10=_0x760abc;}}}}var _0x105c5f={'name':_0x4b8292,'description':_0x2bb4b7,'path':path['join'](_0x2492d9,_0x130a80[0x0]),'type':_0x441a89,'sidebar':_0x4003f5,'icon':_0x458190,'adminUrl':_0x88e66d,'agentUrl':_0x1f8d10,'scriptName':_0xb2661f,'scriptPath':_0x23f720,'version':_0x481112};removeReferences(_0x4debcc,null);return db[_0x7c39('0x48')]['create'](_0x105c5f)[_0x7c39('0x2e')](function(_0x44da2e){var _0x11a5b4={'role':_0x24f638[_0x7c39('0x93')][_0x7c39('0x94')],'userProfileId':_0x24f638[_0x7c39('0x93')]['userProfileId']};if(!_0x11a5b4)throw new Error(_0x7c39('0x95'));if(_0x11a5b4[_0x7c39('0x94')]===_0x7c39('0x96')){var _0x12db2d=_0x44da2e[_0x7c39('0x2f')]({'plain':!![]});return db[_0x7c39('0x97')]['find']({'where':{'name':_0x7c39('0x30'),'userProfileId':_0x11a5b4[_0x7c39('0x98')]},'raw':!![]})[_0x7c39('0x2e')](function(_0x33feb0){if(_0x33feb0&&_0x33feb0['autoAssociation']===0x0){return db[_0x7c39('0x31')]['create']({'name':_0x12db2d[_0x7c39('0x35')],'resourceId':_0x12db2d['id'],'type':_0x33feb0[_0x7c39('0x35')],'sectionId':_0x33feb0['id']},{})[_0x7c39('0x2e')](function(){return _0x44da2e;});}else{return _0x44da2e;}})[_0x7c39('0x4c')](function(_0xb02ff8){logger[_0x7c39('0x33')](_0x7c39('0x99'),_0xb02ff8);throw _0xb02ff8;});}return _0x44da2e;})[_0x7c39('0x2e')](respondWithResult(_0x5260c5,null))[_0x7c39('0x4c')](handleError(_0x5260c5,null));}});}catch(_0x3175a2){_0x5260c5[_0x7c39('0x23')](0x1f4)[_0x7c39('0x9a')](_0x3175a2);}};function removeReferences(_0x308eba,_0x1cc94a){try{if(_0x308eba){fs[_0x7c39('0x69')](_0x308eba);logger[_0x7c39('0x6f')]('Zip\x20archive\x20removed');}if(_0x1cc94a){rimraf(_0x1cc94a,function(){});logger['info'](_0x7c39('0x9b'));}}catch(_0x36cca2){logger['error'](_0x36cca2);}}exports[_0x7c39('0x9c')]=function(_0x330d6a,_0x589247,_0x176eb3){return db[_0x7c39('0x48')][_0x7c39('0x50')]({'where':{'id':_0x330d6a[_0x7c39('0x9d')]['id']}})[_0x7c39('0x2e')](handleEntityNotFound(_0x589247,null))['then'](saveUpdates(_0x330d6a['body'],null))['then'](respondWithResult(_0x589247,null))[_0x7c39('0x4c')](handleError(_0x589247,null));};exports['delete']=function(_0x3ce16f,_0x479c7e,_0x3c556e){return db[_0x7c39('0x48')][_0x7c39('0x50')]({'where':{'id':_0x3ce16f[_0x7c39('0x9d')]['id']}})[_0x7c39('0x2e')](function(_0x44a86f){if(_0x44a86f){return _0x44a86f['destroy']();}})[_0x7c39('0x2e')](function(_0x48407e){rimraf(path['join'](config['root'],_0x7c39('0x53'),path['dirname'](_0x48407e[_0x7c39('0x9')])),function(){});return _0x48407e;})[_0x7c39('0x2e')](handleEntityNotFound(_0x479c7e,null))[_0x7c39('0x2e')](respondWithStatusCode(_0x479c7e,null))[_0x7c39('0x4c')](handleError(_0x479c7e,null));};exports['webhookGet']=function(_0x4258d3,_0x48bb6d,_0x3fd7ff){return BPromise[_0x7c39('0x9e')]()[_0x7c39('0x2e')](function(){if(!_0x4258d3[_0x7c39('0x3b')][_0x7c39('0x9')]){throw new Error(_0x7c39('0x9f'));}if(!_0x4258d3[_0x7c39('0x3b')]['port']){throw new Error(_0x7c39('0xa0'));}var _0x3d9806=_0x4258d3[_0x7c39('0x3b')][_0x7c39('0xa1')]?_0x4258d3[_0x7c39('0x3b')][_0x7c39('0xa1')]+':'+_0x4258d3[_0x7c39('0x3b')][_0x7c39('0xa2')]:_0x7c39('0xa3')+_0x4258d3['query'][_0x7c39('0xa2')];var _0x5b202a=_0x4258d3[_0x7c39('0x3b')][_0x7c39('0x2b')]?_0x4258d3['query']['json']:!![];var _0x4e198e=_0x4258d3['query'][_0x7c39('0xa4')]?_0x4258d3[_0x7c39('0x3b')]['encoding']:null;var _0x2bd8eb={'method':_0x4258d3[_0x7c39('0xa5')],'uri':util['format'](_0x7c39('0xa6'),_0x3d9806,_0x4258d3[_0x7c39('0x3b')][_0x7c39('0x9')]),'json':_0x5b202a,'resolveWithFullResponse':!![],'encoding':_0x4e198e,'qs':_0x4258d3[_0x7c39('0x3b')]};if(_0x4258d3[_0x7c39('0xa7')]){_0x2bd8eb[_0x7c39('0xa7')]=_0x4258d3[_0x7c39('0xa7')];if(_0x2bd8eb['headers'][_0x7c39('0xa8')]){delete _0x2bd8eb[_0x7c39('0xa7')][_0x7c39('0xa8')];}}if(_0x2bd8eb[_0x7c39('0xa7')][_0x7c39('0xa9')]){delete _0x2bd8eb['headers'][_0x7c39('0xa9')];}return rp(_0x2bd8eb);})[_0x7c39('0x2e')](function(_0x451882){if(_0x451882){_0x48bb6d[_0x7c39('0x29')](_0x451882[_0x7c39('0xa7')]);logger[_0x7c39('0x6f')](_0x451882[_0x7c39('0x93')]);if(_[_0x7c39('0xaa')](_0x4258d3[_0x7c39('0x3b')]['path'],_0x7c39('0x51'))&&_0x451882['statusCode']==0x1f4){return _0x48bb6d['sendStatus'](_0x451882[_0x7c39('0xab')]);}else{return _0x48bb6d[_0x7c39('0x23')](_0x451882[_0x7c39('0xab')])[_0x7c39('0x9a')](_0x451882[_0x7c39('0x93')]);}}else{return _0x48bb6d[_0x7c39('0x22')](0xc8);}})['catch'](handleError(_0x48bb6d,null));};exports[_0x7c39('0xac')]=function(_0x4bc47e,_0xecbcbd,_0x455184){return BPromise['resolve']()[_0x7c39('0x2e')](function(){if(!_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0x9')]){throw new Error(_0x7c39('0x9f'));}if(!_0x4bc47e[_0x7c39('0x3b')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xd41b86=_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0xa1')]?_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0xa1')]+':'+_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0xa2')]:_0x7c39('0xa3')+_0x4bc47e[_0x7c39('0x3b')]['port'];var _0xca7152=_0x4bc47e['query'][_0x7c39('0x2b')]?_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0x2b')]:!![];var _0x282c3b=_0x4bc47e[_0x7c39('0x3b')]['encoding']?_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0xa4')]:null;var _0x5d1ee1={'method':_0x4bc47e[_0x7c39('0xa5')],'uri':util[_0x7c39('0xad')](_0x7c39('0xa6'),_0xd41b86,_0x4bc47e[_0x7c39('0x3b')]['path']),'json':_0xca7152,'resolveWithFullResponse':!![],'encoding':_0x282c3b,'body':_0x4bc47e[_0x7c39('0x93')]};if(_0x4bc47e[_0x7c39('0xa7')]){_0x5d1ee1['headers']=_0x4bc47e[_0x7c39('0xa7')];if(_0x5d1ee1['headers'][_0x7c39('0xa8')]){delete _0x5d1ee1[_0x7c39('0xa7')][_0x7c39('0xa8')];}}if(_0x5d1ee1[_0x7c39('0xa7')][_0x7c39('0xa9')]){delete _0x5d1ee1['headers'][_0x7c39('0xa9')];}return rp(_0x5d1ee1);})[_0x7c39('0x2e')](function(_0xc3193e){if(_0xc3193e){_0xecbcbd[_0x7c39('0x29')](_0xc3193e[_0x7c39('0xa7')]);logger['info'](_0xc3193e[_0x7c39('0x93')]);return _0xecbcbd[_0x7c39('0x23')](_0xc3193e[_0x7c39('0xab')])[_0x7c39('0x9a')](_0xc3193e[_0x7c39('0x93')]);}else{return _0xecbcbd[_0x7c39('0x22')](0xc8);}})[_0x7c39('0x4c')](handleError(_0xecbcbd,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3727d04..5a3e731 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 _0xa786=['save','update','remove','emit','hasOwnProperty','hook','exports','Plugin','setMaxListeners'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa786,0x1d2));var _0x6a78=function(_0x20adfa,_0x258941){_0x20adfa=_0x20adfa-0x0;var _0x54f04e=_0xa786[_0x20adfa];return _0x54f04e;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x6a78('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0x6a78('0x1')](0x0);var events={'afterCreate':_0x6a78('0x2'),'afterUpdate':_0x6a78('0x3'),'afterDestroy':_0x6a78('0x4')};function emitEvent(_0x1ca897){return function(_0x34b520,_0x521b4a,_0x14cd87){PluginEvents[_0x6a78('0x5')](_0x1ca897+':'+_0x34b520['id'],_0x34b520);PluginEvents[_0x6a78('0x5')](_0x1ca897,_0x34b520);_0x14cd87(null);};}for(var e in events){if(events[_0x6a78('0x6')](e)){var event=events[e];Plugin[_0x6a78('0x7')](e,emitEvent(event));}}module[_0x6a78('0x8')]=PluginEvents; \ No newline at end of file +var _0x3ca4=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','remove','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3ca4,0x17d));var _0x43ca=function(_0x274b3b,_0x2dd1f0){_0x274b3b=_0x274b3b-0x0;var _0x2b4ef4=_0x3ca4[_0x274b3b];return _0x2b4ef4;};'use strict';var EventEmitter=require(_0x43ca('0x0'));var Plugin=require(_0x43ca('0x1'))['db'][_0x43ca('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x43ca('0x3'),'afterDestroy':_0x43ca('0x4')};function emitEvent(_0x21e96a){return function(_0x23ce52,_0x23c381,_0xc00cdb){PluginEvents[_0x43ca('0x5')](_0x21e96a+':'+_0x23ce52['id'],_0x23ce52);PluginEvents['emit'](_0x21e96a,_0x23ce52);_0xc00cdb(null);};}for(var e in events){if(events[_0x43ca('0x6')](e)){var event=events[e];Plugin[_0x43ca('0x7')](e,emitEvent(event));}}module[_0x43ca('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 82145f9..79c73f8 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 _0x5d8d=['rimraf','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1fdaf8,_0xe0c77f){var _0x5d49d7=function(_0x2b6063){while(--_0x2b6063){_0x1fdaf8['push'](_0x1fdaf8['shift']());}};_0x5d49d7(++_0xe0c77f);}(_0x5d8d,0x1a9));var _0xd5d8=function(_0x446f18,_0x47cf94){_0x446f18=_0x446f18-0x0;var _0xfe8927=_0x5d8d[_0x446f18];return _0xfe8927;};'use strict';var _=require(_0xd5d8('0x0'));var util=require(_0xd5d8('0x1'));var logger=require(_0xd5d8('0x2'))(_0xd5d8('0x3'));var moment=require(_0xd5d8('0x4'));var BPromise=require(_0xd5d8('0x5'));var rp=require(_0xd5d8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5d8('0x7'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xd5d8('0x8')]=function(_0x484435,_0x1e619f){return _0x484435[_0xd5d8('0x9')](_0xd5d8('0xa'),attributes,{'tableName':_0xd5d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2260=['plugins','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x500334,_0x962aba){var _0x7fcae=function(_0x2fc48e){while(--_0x2fc48e){_0x500334['push'](_0x500334['shift']());}};_0x7fcae(++_0x962aba);}(_0x2260,0x156));var _0x0226=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x2260[_0xdd827a];return _0x2f46f1;};'use strict';var _=require('lodash');var util=require(_0x0226('0x0'));var logger=require(_0x0226('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0226('0x2'));var rp=require(_0x0226('0x3'));var fs=require('fs');var path=require(_0x0226('0x4'));var rimraf=require(_0x0226('0x5'));var config=require(_0x0226('0x6'));var attributes=require(_0x0226('0x7'));module[_0x0226('0x8')]=function(_0x216ec4,_0x4f3202){return _0x216ec4[_0x0226('0x9')]('Plugin',attributes,{'tableName':_0x0226('0xa'),'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 b431520..7fa5d4e 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 _0x2e35=['debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','Plugin','create','body','options','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0x2e35,0xd9));var _0x52e3=function(_0x5198a3,_0x440517){_0x5198a3=_0x5198a3-0x0;var _0x564c09=_0x2e35[_0x5198a3];return _0x564c09;};'use strict';var _=require('lodash');var util=require(_0x52e3('0x0'));var moment=require(_0x52e3('0x1'));var BPromise=require(_0x52e3('0x2'));var rs=require(_0x52e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52e3('0x4'))['db'];var utils=require(_0x52e3('0x5'));var logger=require('../../config/logger')(_0x52e3('0x6'));var config=require(_0x52e3('0x7'));var jayson=require(_0x52e3('0x8'));var client=jayson[_0x52e3('0x9')][_0x52e3('0xa')]({'port':0x232a});config[_0x52e3('0xb')]=_[_0x52e3('0xc')](config[_0x52e3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x52e3('0xd'))(new Redis(config[_0x52e3('0xb')]));require(_0x52e3('0xe'))[_0x52e3('0xf')](socket);function respondWithRpcPromise(_0x2d1c09,_0x36edee,_0x552393){return new BPromise(function(_0xd947be,_0x5ac540){return client[_0x52e3('0x10')](_0x2d1c09,_0x552393)[_0x52e3('0x11')](function(_0x395312){logger[_0x52e3('0x12')](_0x52e3('0x13'),_0x36edee,_0x52e3('0x14'));logger[_0x52e3('0x15')](_0x52e3('0x16'),_0x36edee,_0x52e3('0x14'),JSON[_0x52e3('0x17')](_0x395312));if(_0x395312['error']){if(_0x395312[_0x52e3('0x18')][_0x52e3('0x19')]===0x1f4){logger[_0x52e3('0x18')]('Plugin,\x20%s,\x20%s',_0x36edee,_0x395312[_0x52e3('0x18')][_0x52e3('0x1a')]);return _0x5ac540(_0x395312[_0x52e3('0x18')][_0x52e3('0x1a')]);}logger[_0x52e3('0x18')](_0x52e3('0x13'),_0x36edee,_0x395312[_0x52e3('0x18')][_0x52e3('0x1a')]);return _0xd947be(_0x395312[_0x52e3('0x18')][_0x52e3('0x1a')]);}else{logger['info'](_0x52e3('0x13'),_0x36edee,_0x52e3('0x14'));_0xd947be(_0x395312[_0x52e3('0x1b')][_0x52e3('0x1a')]);}})['catch'](function(_0x1fbe23){logger['error'](_0x52e3('0x13'),_0x36edee,_0x1fbe23);_0x5ac540(_0x1fbe23);});});}exports[_0x52e3('0x1c')]=function(_0x3d14ed){var _0x36957e=this;return new Promise(function(_0x44f720,_0x57590b){return db[_0x52e3('0x1d')][_0x52e3('0x1e')](_0x3d14ed[_0x52e3('0x1f')],{'raw':_0x3d14ed['options']?_0x3d14ed[_0x52e3('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x52e3('0x11')](function(_0x4de790){logger[_0x52e3('0x12')](_0x52e3('0x1c'),_0x3d14ed);logger[_0x52e3('0x15')](_0x52e3('0x1c'),_0x3d14ed,JSON[_0x52e3('0x17')](_0x4de790));_0x44f720(_0x4de790);})[_0x52e3('0x21')](function(_0x51f0e0){logger[_0x52e3('0x18')]('CreatePlugin',_0x51f0e0[_0x52e3('0x1a')],_0x3d14ed);_0x57590b(_0x36957e[_0x52e3('0x18')](0x1f4,_0x51f0e0[_0x52e3('0x1a')]));});});}; \ No newline at end of file +var _0xc102=['message','result','catch','CreatePlugin','body','raw','then','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x43637d,_0x553e14){var _0x2d7ab3=function(_0x441e1e){while(--_0x441e1e){_0x43637d['push'](_0x43637d['shift']());}};_0x2d7ab3(++_0x553e14);}(_0xc102,0xb8));var _0x2c10=function(_0x16a0e0,_0x2e7c73){_0x16a0e0=_0x16a0e0-0x0;var _0x22fe8f=_0xc102[_0x16a0e0];return _0x22fe8f;};'use strict';var _=require(_0x2c10('0x0'));var util=require(_0x2c10('0x1'));var moment=require(_0x2c10('0x2'));var BPromise=require(_0x2c10('0x3'));var rs=require(_0x2c10('0x4'));var fs=require('fs');var Redis=require(_0x2c10('0x5'));var db=require(_0x2c10('0x6'))['db'];var utils=require(_0x2c10('0x7'));var logger=require(_0x2c10('0x8'))(_0x2c10('0x9'));var config=require(_0x2c10('0xa'));var jayson=require(_0x2c10('0xb'));var client=jayson[_0x2c10('0xc')][_0x2c10('0xd')]({'port':0x232a});config[_0x2c10('0xe')]=_[_0x2c10('0xf')](config[_0x2c10('0xe')],{'host':_0x2c10('0x10'),'port':0x18eb});var socket=require(_0x2c10('0x11'))(new Redis(config['redis']));require(_0x2c10('0x12'))[_0x2c10('0x13')](socket);function respondWithRpcPromise(_0x2dc1d1,_0x5ba5d6,_0x257560){return new BPromise(function(_0x3fd1eb,_0x104335){return client[_0x2c10('0x14')](_0x2dc1d1,_0x257560)['then'](function(_0x1b4d18){logger['info'](_0x2c10('0x15'),_0x5ba5d6,'request\x20sent');logger[_0x2c10('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x5ba5d6,_0x2c10('0x17'),JSON['stringify'](_0x1b4d18));if(_0x1b4d18[_0x2c10('0x18')]){if(_0x1b4d18[_0x2c10('0x18')][_0x2c10('0x19')]===0x1f4){logger[_0x2c10('0x18')](_0x2c10('0x15'),_0x5ba5d6,_0x1b4d18[_0x2c10('0x18')][_0x2c10('0x1a')]);return _0x104335(_0x1b4d18[_0x2c10('0x18')][_0x2c10('0x1a')]);}logger[_0x2c10('0x18')](_0x2c10('0x15'),_0x5ba5d6,_0x1b4d18[_0x2c10('0x18')]['message']);return _0x3fd1eb(_0x1b4d18[_0x2c10('0x18')][_0x2c10('0x1a')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x5ba5d6,_0x2c10('0x17'));_0x3fd1eb(_0x1b4d18[_0x2c10('0x1b')][_0x2c10('0x1a')]);}})[_0x2c10('0x1c')](function(_0x16f3b2){logger[_0x2c10('0x18')](_0x2c10('0x15'),_0x5ba5d6,_0x16f3b2);_0x104335(_0x16f3b2);});});}exports[_0x2c10('0x1d')]=function(_0x5d2f85){var _0x340951=this;return new Promise(function(_0x5d2b7a,_0x35d43a){return db['Plugin']['create'](_0x5d2f85[_0x2c10('0x1e')],{'raw':_0x5d2f85['options']?_0x5d2f85['options'][_0x2c10('0x1f')]===undefined?!![]:![]:!![]})[_0x2c10('0x20')](function(_0x32c97a){logger[_0x2c10('0x21')]('CreatePlugin',_0x5d2f85);logger[_0x2c10('0x16')](_0x2c10('0x1d'),_0x5d2f85,JSON[_0x2c10('0x22')](_0x32c97a));_0x5d2b7a(_0x32c97a);})[_0x2c10('0x1c')](function(_0x317aac){logger[_0x2c10('0x18')](_0x2c10('0x1d'),_0x317aac['message'],_0x5d2f85);_0x35d43a(_0x340951['error'](0x1f4,_0x317aac[_0x2c10('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2cd8258..7c11258 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 _0xda91=['remove','update','removeListener','register','./plugin.events','save'];(function(_0xe9f509,_0x877922){var _0x3f7c9b=function(_0xaf70df){while(--_0xaf70df){_0xe9f509['push'](_0xe9f509['shift']());}};_0x3f7c9b(++_0x877922);}(_0xda91,0x178));var _0x1da9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xda91[_0x3947c9];return _0x2e7871;};'use strict';var PluginEvents=require(_0x1da9('0x0'));var events=[_0x1da9('0x1'),_0x1da9('0x2'),_0x1da9('0x3')];function createListener(_0x1d0c15,_0x353ae4){return function(_0x24a059){_0x353ae4['emit'](_0x1d0c15,_0x24a059);};}function removeListener(_0x24e8fa,_0x30da18){return function(){PluginEvents[_0x1da9('0x4')](_0x24e8fa,_0x30da18);};}exports[_0x1da9('0x5')]=function(_0x2b05e8){for(var _0x321550=0x0,_0x3d6cd3=events['length'];_0x321550<_0x3d6cd3;_0x321550++){var _0x302b69=events[_0x321550];var _0x5ebf50=createListener('plugin:'+_0x302b69,_0x2b05e8);PluginEvents['on'](_0x302b69,_0x5ebf50);}}; \ No newline at end of file +var _0xb6d8=['plugin:','save','remove','emit','register','length'];(function(_0x2be459,_0x2062be){var _0x188a31=function(_0x3f4cbf){while(--_0x3f4cbf){_0x2be459['push'](_0x2be459['shift']());}};_0x188a31(++_0x2062be);}(_0xb6d8,0x145));var _0x8b6d=function(_0x44c79e,_0x5cb645){_0x44c79e=_0x44c79e-0x0;var _0x291a40=_0xb6d8[_0x44c79e];return _0x291a40;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8b6d('0x0'),_0x8b6d('0x1'),'update'];function createListener(_0x54b2c3,_0x4914d8){return function(_0x2fbec2){_0x4914d8[_0x8b6d('0x2')](_0x54b2c3,_0x2fbec2);};}function removeListener(_0x1f4982,_0x3e0fb3){return function(){PluginEvents['removeListener'](_0x1f4982,_0x3e0fb3);};}exports[_0x8b6d('0x3')]=function(_0x38ce3c){for(var _0x1ff170=0x0,_0x567f5d=events[_0x8b6d('0x4')];_0x1ff170<_0x567f5d;_0x1ff170++){var _0x31fb2f=events[_0x1ff170];var _0x2ab329=createListener(_0x8b6d('0x5')+_0x31fb2f,_0x38ce3c);PluginEvents['on'](_0x31fb2f,_0x2ab329);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 54d25e4..14a119b 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(_0x74517f,_0x3c3164){var _0x5ba911=function(_0x242c99){while(--_0x242c99){_0x74517f['push'](_0x74517f['shift']());}};_0x5ba911(++_0x3c3164);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x18ed60,_0x3e3d4c){var _0x4cabfd=function(_0x4a83ad){while(--_0x4a83ad){_0x18ed60['push'](_0x18ed60['shift']());}};_0x4cabfd(++_0x3e3d4c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 627638a..fd0a1f0 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 _0xd87e=['catch','describe','params','create','body','script','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length'];(function(_0x25aaa1,_0x8405a3){var _0x2fa2c1=function(_0x1d4efd){while(--_0x1d4efd){_0x25aaa1['push'](_0x25aaa1['shift']());}};_0x2fa2c1(++_0x8405a3);}(_0xd87e,0x1bf));var _0xed87=function(_0x44f470,_0x74d1a8){_0x44f470=_0x44f470-0x0;var _0x54f0f5=_0xd87e[_0x44f470];return _0x54f0f5;};'use strict';var _=require(_0xed87('0x0'));var pm2=require(_0xed87('0x1'));var logger=require('../../config/logger')(_0xed87('0x2'));var path=require(_0xed87('0x3'));var exec=require(_0xed87('0x4'))['exec'];var BPromise=require(_0xed87('0x5'));function handleEntityNotFound(_0x5e960f,_0x11a5d9){return function(_0x41ca7c){if(!_0x41ca7c){_0x5e960f['sendStatus'](0x194);;}return _0x41ca7c;};}function respondWithResult(_0x17adfe,_0x589fb9){_0x589fb9=_0x589fb9||0xc8;return function(_0x5da793){if(_0x5da793){return _0x17adfe[_0xed87('0x6')](_0x589fb9)[_0xed87('0x7')](_0x5da793);}return null;};}function handleError(_0x33e1c1,_0x2f348a){_0x2f348a=_0x2f348a||0x1f4;return function(_0x569d66){logger[_0xed87('0x8')](_0x569d66[_0xed87('0x9')]);if(_0x569d66[_0xed87('0xa')]){delete _0x569d66[_0xed87('0xa')];}_0x33e1c1[_0xed87('0x6')](_0x2f348a)[_0xed87('0xb')](_0x569d66);};}function execChildProcess(){return new BPromise(function(_0x293db4,_0x5b8ab4){exec(_0xed87('0xc'),function(_0xf104cb,_0x5cf4fe,_0x2f642f){logger[_0xed87('0xd')](_0x5cf4fe);logger['info'](_0x2f642f);if(_0xf104cb){logger['error'](_0xf104cb);return _0x5b8ab4(_0xf104cb);}return _0x293db4(_0x5cf4fe);});});}exports[_0xed87('0xe')]=function(_0x32276e,_0x353d46){return pm2[_0xed87('0xf')]()[_0xed87('0x10')](function(_0x3865c5){if(_0x3865c5){var _0x52dfe8=_[_0xed87('0x11')](_0x3865c5,function(_0x19b283){return _0x19b283[_0xed87('0xa')]===_0xed87('0x12')||_0x19b283[_0xed87('0xa')]===_0xed87('0x13');});return{'rows':_0x52dfe8,'count':_0x52dfe8[_0xed87('0x14')]};}return null;})[_0xed87('0x10')](respondWithResult(_0x353d46,null))[_0xed87('0x15')](handleError(_0x353d46,null));};exports['show']=function(_0x3db5ea,_0x18ab7d){return pm2[_0xed87('0x16')](_0x3db5ea[_0xed87('0x17')]['id'])['then'](respondWithResult(_0x18ab7d,null))[_0xed87('0x10')](handleEntityNotFound(_0x18ab7d,null))[_0xed87('0x15')](handleError(_0x18ab7d,null));};exports[_0xed87('0x18')]=function(_0x3f9e08,_0x98a2ca){if(_0x3f9e08[_0xed87('0x19')][_0xed87('0xa')]&&_0x3f9e08[_0xed87('0x19')][_0xed87('0x1a')]){var _0x52e81c=path['join'](__dirname,'../../files/plugins',_0x3f9e08['body'][_0xed87('0x1a')]);var _0x5d3ec8=process[_0xed87('0x1b')]();process[_0xed87('0x1c')](path['dirname'](_0x52e81c));return execChildProcess()[_0xed87('0x10')](function(_0x505733){process[_0xed87('0x1c')](_0x5d3ec8);return pm2[_0xed87('0x1d')]({'name':_0x3f9e08[_0xed87('0x19')][_0xed87('0xa')],'script':_0x52e81c});})[_0xed87('0x10')](function(_0x5d15b3){pm2[_0xed87('0x1e')]();return _0x5d15b3[0x0];})[_0xed87('0x10')](respondWithResult(_0x98a2ca,0xc9))[_0xed87('0x15')](handleError(_0x98a2ca,null));}else{return _0x98a2ca[_0xed87('0x6')](0x1f4)[_0xed87('0xb')]({'message':_0xed87('0x1f')});}};exports[_0xed87('0x20')]=function(_0x4735b3,_0x40b2fa){if(_0x4735b3[_0xed87('0x19')]['id']){delete _0x4735b3[_0xed87('0x19')]['id'];}var _0x341a35={'online':_0xed87('0x21'),'stopped':_0xed87('0x22')};if(_0x341a35['hasOwnProperty'](_0x4735b3[_0xed87('0x19')][_0xed87('0x6')])){return pm2[_0x341a35[_0x4735b3['body'][_0xed87('0x6')]]](_0x4735b3[_0xed87('0x17')]['id'])[_0xed87('0x10')](respondWithResult(_0x40b2fa,0xc8))['catch'](handleError(_0x40b2fa,null));}else{return _0x40b2fa['status'](0x1f4)[_0xed87('0xb')]({'message':_0xed87('0x23')});}};exports[_0xed87('0x24')]=function(_0x549a19,_0x37d45a){if(_0x549a19[_0xed87('0x19')]['id']){delete _0x549a19[_0xed87('0x19')]['id'];}if(_0x549a19[_0xed87('0x17')]['id']){return pm2[_0xed87('0x25')](_0x549a19[_0xed87('0x17')]['id'])[_0xed87('0x10')](function(_0x10509d){pm2[_0xed87('0x1e')]();return _0x10509d[0x0];})['then'](respondWithResult(_0x37d45a,null))[_0xed87('0x15')](handleError(_0x37d45a,null));}else{return _0x37d45a[_0xed87('0x6')](0x1f4)['send']({'message':_0xed87('0x26')});}}; \ No newline at end of file +var _0xde2c=['start','dump','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show','create','body','script','cwd','chdir','dirname'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xde2c,0x7f));var _0xcde2=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xde2c[_0x2de0a7];return _0x429437;};'use strict';var _=require(_0xcde2('0x0'));var pm2=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var path=require(_0xcde2('0x4'));var exec=require(_0xcde2('0x5'))[_0xcde2('0x6')];var BPromise=require(_0xcde2('0x7'));function handleEntityNotFound(_0x55c175,_0x4353c8){return function(_0x196898){if(!_0x196898){_0x55c175[_0xcde2('0x8')](0x194);;}return _0x196898;};}function respondWithResult(_0x1398de,_0x401b16){_0x401b16=_0x401b16||0xc8;return function(_0x53c558){if(_0x53c558){return _0x1398de[_0xcde2('0x9')](_0x401b16)[_0xcde2('0xa')](_0x53c558);}return null;};}function handleError(_0x9c7036,_0x544235){_0x544235=_0x544235||0x1f4;return function(_0x582a6c){logger[_0xcde2('0xb')](_0x582a6c[_0xcde2('0xc')]);if(_0x582a6c['name']){delete _0x582a6c[_0xcde2('0xd')];}_0x9c7036[_0xcde2('0x9')](_0x544235)[_0xcde2('0xe')](_0x582a6c);};}function execChildProcess(){return new BPromise(function(_0x127358,_0x54b7c5){exec('npm\x20install',function(_0x25677f,_0x1bc697,_0x3b1333){logger[_0xcde2('0xf')](_0x1bc697);logger[_0xcde2('0xf')](_0x3b1333);if(_0x25677f){logger[_0xcde2('0xb')](_0x25677f);return _0x54b7c5(_0x25677f);}return _0x127358(_0x1bc697);});});}exports['index']=function(_0x211215,_0x577062){return pm2[_0xcde2('0x10')]()['then'](function(_0x4b0e0e){if(_0x4b0e0e){var _0x34e079=_[_0xcde2('0x11')](_0x4b0e0e,function(_0x417505){return _0x417505[_0xcde2('0xd')]===_0xcde2('0x12')||_0x417505['name']===_0xcde2('0x13');});return{'rows':_0x34e079,'count':_0x34e079['length']};}return null;})[_0xcde2('0x14')](respondWithResult(_0x577062,null))[_0xcde2('0x15')](handleError(_0x577062,null));};exports[_0xcde2('0x16')]=function(_0x1f1858,_0x5223f1){return pm2['describe'](_0x1f1858['params']['id'])[_0xcde2('0x14')](respondWithResult(_0x5223f1,null))['then'](handleEntityNotFound(_0x5223f1,null))[_0xcde2('0x15')](handleError(_0x5223f1,null));};exports[_0xcde2('0x17')]=function(_0x252372,_0x481fc0){if(_0x252372[_0xcde2('0x18')][_0xcde2('0xd')]&&_0x252372[_0xcde2('0x18')][_0xcde2('0x19')]){var _0x43df7a=path['join'](__dirname,'../../files/plugins',_0x252372['body'][_0xcde2('0x19')]);var _0x3e5170=process[_0xcde2('0x1a')]();process[_0xcde2('0x1b')](path[_0xcde2('0x1c')](_0x43df7a));return execChildProcess()['then'](function(_0x1104b8){process['chdir'](_0x3e5170);return pm2[_0xcde2('0x1d')]({'name':_0x252372[_0xcde2('0x18')][_0xcde2('0xd')],'script':_0x43df7a});})['then'](function(_0x593aa4){pm2[_0xcde2('0x1e')]();return _0x593aa4[0x0];})[_0xcde2('0x14')](respondWithResult(_0x481fc0,0xc9))[_0xcde2('0x15')](handleError(_0x481fc0,null));}else{return _0x481fc0[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xcde2('0x1f')]=function(_0x45275a,_0x1dce65){if(_0x45275a['body']['id']){delete _0x45275a[_0xcde2('0x18')]['id'];}var _0x348ca1={'online':_0xcde2('0x20'),'stopped':_0xcde2('0x21')};if(_0x348ca1[_0xcde2('0x22')](_0x45275a[_0xcde2('0x18')][_0xcde2('0x9')])){return pm2[_0x348ca1[_0x45275a[_0xcde2('0x18')]['status']]](_0x45275a[_0xcde2('0x23')]['id'])['then'](respondWithResult(_0x1dce65,0xc8))[_0xcde2('0x15')](handleError(_0x1dce65,null));}else{return _0x1dce65[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Unknown\x20status'});}};exports[_0xcde2('0x24')]=function(_0x28fedd,_0x58afb1){if(_0x28fedd[_0xcde2('0x18')]['id']){delete _0x28fedd[_0xcde2('0x18')]['id'];}if(_0x28fedd[_0xcde2('0x23')]['id']){return pm2[_0xcde2('0x25')](_0x28fedd[_0xcde2('0x23')]['id'])[_0xcde2('0x14')](function(_0x11b817){pm2[_0xcde2('0x1e')]();return _0x11b817[0x0];})['then'](respondWithResult(_0x58afb1,null))[_0xcde2('0x15')](handleError(_0x58afb1,null));}else{return _0x58afb1[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':_0xcde2('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f18336c..0c3ea6b 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 _0x71d3=['getQueues','express','Router','../../components/auth/service','./realtime.controller','isAuthenticated','getAgents','get','/queues'];(function(_0x1407d1,_0x4cc88c){var _0x4e6cbe=function(_0x40b958){while(--_0x40b958){_0x1407d1['push'](_0x1407d1['shift']());}};_0x4e6cbe(++_0x4cc88c);}(_0x71d3,0x1d5));var _0x371d=function(_0xa454a,_0x598f3c){_0xa454a=_0xa454a-0x0;var _0x53de0c=_0x71d3[_0xa454a];return _0x53de0c;};'use strict';var express=require(_0x371d('0x0'));var router=express[_0x371d('0x1')]();var auth=require(_0x371d('0x2'));var controller=require(_0x371d('0x3'));router['get']('/agents',auth[_0x371d('0x4')](),controller[_0x371d('0x5')]);router[_0x371d('0x6')](_0x371d('0x7'),auth['isAuthenticated'](),controller[_0x371d('0x8')]);module['exports']=router; \ No newline at end of file +var _0x76f2=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x2eb138,_0x48f6d8){var _0x2a59cb=function(_0x460a00){while(--_0x460a00){_0x2eb138['push'](_0x2eb138['shift']());}};_0x2a59cb(++_0x48f6d8);}(_0x76f2,0x1af));var _0x276f=function(_0x94c5c1,_0x35528a){_0x94c5c1=_0x94c5c1-0x0;var _0x615b88=_0x76f2[_0x94c5c1];return _0x615b88;};'use strict';var express=require(_0x276f('0x0'));var router=express[_0x276f('0x1')]();var auth=require(_0x276f('0x2'));var controller=require(_0x276f('0x3'));router[_0x276f('0x4')](_0x276f('0x5'),auth[_0x276f('0x6')](),controller[_0x276f('0x7')]);router[_0x276f('0x4')](_0x276f('0x8'),auth[_0x276f('0x6')](),controller[_0x276f('0x9')]);module[_0x276f('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 67f53e0..fdc08d8 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 _0x372d=['get','agents','loggedIn','busy','outbound','find','pick','queue','length','some','connectedlinenum','internal','getMembers','UserId','voiceStatus','loggedInDb','User','findAll','QueueId','online','unknown','unavailable','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','filter','idle','pause','every','chatStatus','faxStatus','openchannelStatus','smsStatus','*pause','getAgents','userpic','lastPauseAt','pauseType','address','chatPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','whatsappPause','resolve','rawAttributes','fieldName','type','key','query','getOptions','raw','user','agent','nolimit','sort','UserProfile','getResources','rows','merge','globalStatus','globalStatusFilter','mail','chat','fax','whatsapp','channel','includes','Invalid\x20channel','toLowerCase','Queue','role','userProfileId','QueueCampaigns','Queues','findAndCountAll','util','../../components/parsers/qs','../../config/logger','../../mysqldb','http','client','offset','undefined','limit','count','status','error','name','send','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','voice','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','push','pTalking','originated','message','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map'];(function(_0xbac97,_0x509573){var _0x397cde=function(_0x4d4d21){while(--_0x4d4d21){_0xbac97['push'](_0xbac97['shift']());}};_0x397cde(++_0x509573);}(_0x372d,0x182));var _0xd372=function(_0x498ec3,_0x23257b){_0x498ec3=_0x498ec3-0x0;var _0x5218ed=_0x372d[_0x498ec3];return _0x5218ed;};'use strict';var util=require(_0xd372('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0xd372('0x1'));var logger=require(_0xd372('0x2'))('api');var db=require(_0xd372('0x3'))['db'];var amiClient=jayson['client'][_0xd372('0x4')]({'port':0x232a});var routingClient=jayson[_0xd372('0x5')][_0xd372('0x4')]({'port':0x232c});function respondWithFilteredResult(_0xe25a8c,_0x261e4a){return function(_0x123838){if(_0x123838){var _0x55f57c=typeof _0x261e4a[_0xd372('0x6')]===_0xd372('0x7')&&typeof _0x261e4a[_0xd372('0x8')]===_0xd372('0x7');var _0x1a8a68=_0x123838[_0xd372('0x9')];var _0x254540=_0x55f57c?0x0:_0x261e4a[_0xd372('0x6')];var _0x477170=_0x55f57c?_0x123838[_0xd372('0x9')]:_0x261e4a[_0xd372('0x6')]+_0x261e4a[_0xd372('0x8')];var _0x21a39e;if(_0x477170>=_0x1a8a68){_0x477170=_0x1a8a68;_0x21a39e=0xc8;}else{_0x21a39e=0xce;}_0xe25a8c[_0xd372('0xa')](_0x21a39e);return _0xe25a8c['set']('Content-Range',_0x254540+'-'+_0x477170+'/'+_0x1a8a68)['json'](_0x123838);}return null;};}function handleError(_0x65ba00,_0x41c7d2){_0x41c7d2=_0x41c7d2||0x1f4;return function(_0x5915ab){logger[_0xd372('0xb')](_0x5915ab['stack']);if(_0x5915ab[_0xd372('0xc')]){delete _0x5915ab[_0xd372('0xc')];}_0x65ba00[_0xd372('0xa')](_0x41c7d2)[_0xd372('0xd')](_0x5915ab);};}function getRealtimeAgents(){return new Promise(function(_0x29a46f,_0x4d499){return amiClient[_0xd372('0xe')](_0xd372('0xf'),{})['then'](function(_0x9276da){if(_0x9276da[_0xd372('0xb')])throw new Error(_0xd372('0x10'));var _0x3c93a0=_0x9276da[_0xd372('0x11')];return routingClient[_0xd372('0xe')](_0xd372('0xf'),{})[_0xd372('0x12')](function(_0x39d7ea){if(_0x39d7ea['error'])throw new Error(_0xd372('0x13'));var _0x58a56e=_0x39d7ea[_0xd372('0x11')];return _0x29a46f(_['merge']({},_0x3c93a0,_0x58a56e));});})['catch'](function(_0x3484ce){_0x4d499(_0x3484ce);});});}function getRealtimeQueues(_0x8a6c9e,_0x5509b3){return new Promise(function(_0x37c417,_0x22bd7a){var _0x48d0e7=_0x5509b3===_0xd372('0x14')?amiClient:routingClient;return _0x48d0e7['request'](_[_0xd372('0x15')](_0x5509b3)+'Queues',_0x8a6c9e)[_0xd372('0x12')](function(_0x1309ca){if(_0x1309ca[_0xd372('0xb')])throw new Error(util[_0xd372('0x16')](_0xd372('0x17'),_0x5509b3));return _0x37c417(_0x1309ca[_0xd372('0x11')]);})[_0xd372('0x18')](function(_0x2f2267){_0x22bd7a(_0x2f2267);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5c456d,_0x323ee7){return amiClient[_0xd372('0xe')]('VoiceQueuesChannels',{})[_0xd372('0x12')](function(_0x4bcf4b){if(_0x4bcf4b[_0xd372('0xb')])throw new Error(_0xd372('0x19'));return _0x5c456d(_0x4bcf4b[_0xd372('0x11')]);})[_0xd372('0x18')](function(_0x5c0990){_0x323ee7(_0x5c0990);});});}function initializeQueues(_0x3fd8e3,_0x25d07d,_0x58103c,_0x59ad54){var _0x4b07bc=['loggedIn',_0xd372('0x1a'),_0xd372('0x1b'),_0xd372('0x1c'),_0xd372('0x1d')];if(_0x58103c===_0xd372('0x14')&&_0x59ad54==='outbound'){_0x4b07bc[_0xd372('0x1e')](_0xd372('0x1f'),_0xd372('0x20'),_0xd372('0x21'),'dialActive',_0xd372('0x22'),_0xd372('0x23'),_0xd372('0x24'),_0xd372('0x25'),'erlangCalls',_0xd372('0x26'),_0xd372('0x27'),_0xd372('0x28'),_0xd372('0x29'),_0xd372('0x2a'),_0xd372('0x2b'),_0xd372('0x2c'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0xd372('0x2d'),'predictiveIntervalDroppedCallsCallersExit',_0xd372('0x2e'),_0xd372('0x2f'));}return _0x3fd8e3[_0xd372('0x30')](function(_0x3bb513){var _0x1609f2=_0x3bb513[_0xd372('0x31')]({'plain':!![]});_0x1609f2[_0xd372('0x32')]=[];_0x1609f2[_0xd372('0x1d')]=0x0;_0x1609f2['loggedInDb']=0x0;_0x1609f2[_0xd372('0x33')]=0x0;_0x1609f2[_0xd372('0x1a')]=0x0;_0x1609f2[_0xd372('0x1b')]=0x0;if(_0x58103c===_0xd372('0x14')){_0x1609f2[_0xd372('0x1c')]=0x0;_0x1609f2[_0xd372('0x34')]=0x0;if(_0x59ad54===_0xd372('0x35')){_0x1609f2['pTalking']=0x0;_0x1609f2[_0xd372('0x20')]=0x0;}}var _0x3d796e=_[_0xd372('0x36')](_0x25d07d,['id',_0x1609f2['id']]);if(_0x3d796e)_['merge'](_0x1609f2,_[_0xd372('0x37')](_0x3d796e,_0x4b07bc));return _0x1609f2;});}function updateAgentVoiceStatus(_0x5340d1,_0x343b6b,_0x103216){var _0x4a0035=_['filter'](_0x103216,[_0xd372('0x38'),_0x343b6b[_0xd372('0xc')]]);if(_0x4a0035[_0xd372('0x39')]===0x0)return _0x5340d1['busy']=!![];if(_[_0xd372('0x3a')](_0x4a0035,[_0xd372('0x3b'),_0x5340d1[_0xd372('0x3c')]['toString']()]))return _0x5340d1['talking']=!![];if(!_0x5340d1[_0xd372('0x1c')])return _0x5340d1[_0xd372('0x34')]=!![];}function getVoiceQueueAgents(_0x5ab638,_0x73a689,_0x3f4b82,_0x376923){var _0x5ad1ed=_[_0xd372('0x36')](_0x73a689,['id',_0x5ab638['id']]);if(!_0x5ad1ed)return _0x5ab638;return _0x5ad1ed[_0xd372('0x3d')]({'raw':!![]})[_0xd372('0x12')](function(_0x1e8dcf){for(var _0x46c96e=0x0;_0x46c96e<_0x1e8dcf[_0xd372('0x39')];_0x46c96e++){var _0x251a94=_[_0xd372('0x36')](_0x3f4b82,['id',_0x1e8dcf[_0x46c96e][_0xd372('0x3e')]]);if(!_0x251a94){_0x251a94={'id':_0x1e8dcf[_0x46c96e]['UserId'],'name':_0x1e8dcf[_0x46c96e][_0xd372('0x3e')],'accountcode':'','online':![]};}var _0x4fad2a={'id':_0x251a94['id'],'name':_0x251a94['name'],'internal':_0x251a94['accountcode'],'online':Boolean(_0x251a94['online']),'paused':Boolean(_0x1e8dcf[_0x46c96e][_0xd372('0x1d')])};if(_0x251a94[_0xd372('0x3f')]===_0xd372('0x1c'))updateAgentVoiceStatus(_0x4fad2a,_0x5ab638,_0x376923);if(_0x4fad2a['online'])_0x5ab638[_0xd372('0x40')]++;if(_0x4fad2a[_0xd372('0x34')])_0x5ab638['busy']++;if(_0x4fad2a[_0xd372('0x1d')]&&!_0x4fad2a[_0xd372('0x34')]&&!_0x4fad2a[_0xd372('0x1c')])_0x5ab638[_0xd372('0x1d')]++;_0x5ab638[_0xd372('0x32')][_0xd372('0x1e')](_0x4fad2a);}return _0x5ab638;});}function getQueueAgents(_0x257419,_0x32e84b,_0x4c8734){var _0x342f51=_0xd372('0x41')+_[_0xd372('0x15')](_0x4c8734)+'Queue';var _0x38ce29=_0x4c8734+'Pause';return db[_0x342f51][_0xd372('0x42')]({'where':{[_[_0xd372('0x15')](_0x4c8734)+_0xd372('0x43')]:_0x257419['id']},'raw':!![]})[_0xd372('0x12')](function(_0x5fd168){for(var _0x31a889=0x0;_0x31a889<_0x5fd168[_0xd372('0x39')];_0x31a889++){var _0x37d3c4=_[_0xd372('0x36')](_0x32e84b,['id',_0x5fd168[_0x31a889][_0xd372('0x3e')]]);if(!_0x37d3c4){_0x37d3c4={'id':_0x5fd168[_0x31a889]['UserId'],'name':_0x5fd168[_0x31a889][_0xd372('0x3e')],'online':![],['pauseField']:![]};}var _0x1de0d0={'id':_0x37d3c4['id'],'name':_0x37d3c4['name'],'online':Boolean(_0x37d3c4[_0xd372('0x44')]),'paused':Boolean(_0x37d3c4[_0x38ce29])};if(_0x1de0d0[_0xd372('0x44')])_0x257419[_0xd372('0x40')]++;_0x257419[_0xd372('0x32')][_0xd372('0x1e')](_0x1de0d0);}return _0x257419;});}function isIdle(_0x4323cf){return _0x4323cf==='idle'||_0x4323cf===_0xd372('0x45')||_0x4323cf===_0xd372('0x46')||_0x4323cf==='ringing'||_[_0xd372('0x47')](_0x4323cf);}function isAgentPaused(_0x329929,_0x5f41c7){var _0xa6a493=[_0x329929['chatPause'],_0x329929[_0xd372('0x48')],_0x329929[_0xd372('0x49')],_0x329929[_0xd372('0x4a')],_0x329929[_0xd372('0x4b')],_0x329929[_0xd372('0x4c')],_0x329929['whatsappPause']];if(!_0x5f41c7)return _['every'](_0xa6a493);var _0x3b71fc=_[_0xd372('0x4d')](_0xa6a493);return _0x3b71fc[_0xd372('0x39')]>0x0&&_0x3b71fc['length']<_0xa6a493[_0xd372('0x39')]?!![]:![];}function isAgentIdle(_0x596c0a){if(_0x596c0a[_0xd372('0x3f')]!==_0xd372('0x4e')&&_0x596c0a['voicePause']){_0x596c0a[_0xd372('0x3f')]=_0xd372('0x4f');return![];}return _[_0xd372('0x50')]([_0x596c0a[_0xd372('0x51')],_0x596c0a[_0xd372('0x52')],_0x596c0a['mailStatus'],_0x596c0a[_0xd372('0x53')],_0x596c0a[_0xd372('0x54')],_0x596c0a[_0xd372('0x3f')],_0x596c0a['whatsappStatus']],isIdle);}function getAgentStatus(_0x1e7c1b){var _0x4c47f2=_0xd372('0x45');if(isAgentPaused(_0x1e7c1b))_0x4c47f2=_0xd372('0x4f');else if(isAgentPaused(_0x1e7c1b,!![]))_0x4c47f2=_0xd372('0x55');else if(isAgentIdle(_0x1e7c1b))_0x4c47f2=_0xd372('0x4e');else _0x4c47f2=_0xd372('0x34');return _0x4c47f2;}exports[_0xd372('0x56')]=function(_0x341471,_0x196c31){var _0xf7cef4={'count':0x0,'rows':[]},_0x19effb={},_0x319a58,_0x4a3b94,_0x428f21=[_0xd372('0x57'),_0xd372('0x44'),'lastLoginAt',_0xd372('0x58'),_0xd372('0x59'),_0xd372('0x58'),_0xd372('0x3c'),_0xd372('0x5a'),_0xd372('0x5b'),_0xd372('0x4a'),_0xd372('0x49'),_0xd372('0x4b'),'whatsappPause',_0xd372('0x48'),_0xd372('0x4c'),_0xd372('0x5c'),_0xd372('0x5d'),_0xd372('0x5e'),_0xd372('0x5f'),'whatsappCapacity',_0xd372('0x60'),_0xd372('0x61'),'openchannelCurrentCapacity','mailCurrentCapacity',_0xd372('0x62'),_0xd372('0x63'),_0xd372('0x64'),_0xd372('0x51'),'openchannelStatus',_0xd372('0x65'),'smsStatus',_0xd372('0x66'),_0xd372('0x52'),_0xd372('0x3f'),_0xd372('0x67'),_0xd372('0x68'),_0xd372('0x69'),'smsStatusTime',_0xd372('0x6a'),_0xd372('0x6b'),_0xd372('0x6c'),'queue','destconnectedlinenum',_0xd372('0x6d'),_0xd372('0x6e'),'phoneBarEnableAutomaticScreenRecording',_0xd372('0x6f')],_0x4b0580=[_0xd372('0x5b'),_0xd372('0x4a'),_0xd372('0x49'),_0xd372('0x4b'),_0xd372('0x70'),_0xd372('0x48'),'voicePause','online'];Promise[_0xd372('0x71')]()['then'](function(){var _0x49ba64=_[_0xd372('0x30')](db[_0xd372('0x41')][_0xd372('0x72')],function(_0x10116b){return{'name':_0x10116b[_0xd372('0x73')],'type':_0x10116b[_0xd372('0x74')][_0xd372('0x75')]};});_0x341471[_0xd372('0x76')]['role']='agent';_0x341471[_0xd372('0x76')]['online']=!![];_0x19effb=qs[_0xd372('0x77')](_0x49ba64,_0x341471);_0x19effb[_0xd372('0x78')]=!![];if(_0x341471[_0xd372('0x79')]['role']===_0xd372('0x79')){var _0x353b78={'params':{'id':_0x341471['user']['userProfileId']},'query':{'section':'Agents','role':_0xd372('0x7a'),'online':!![],'nolimit':_0x341471['query'][_0xd372('0x7b')],'sort':_0x341471[_0xd372('0x76')][_0xd372('0x7c')],'filter':_0x341471[_0xd372('0x76')][_0xd372('0x4d')]},'raw':!![]};return db[_0xd372('0x7d')][_0xd372('0x7e')](_0x353b78);}return db['User']['findAndCountAll'](_0x19effb);})[_0xd372('0x12')](function(_0x1ada74){_0xf7cef4[_0xd372('0x9')]=_0x1ada74['count'];_0x319a58=_0x1ada74[_0xd372('0x7f')];return getRealtimeAgents();})[_0xd372('0x12')](function(_0x2ab5b0){_0x4a3b94=_0x2ab5b0[_0xd372('0x7f')];return _0x319a58['map'](function(_0xf40b4a){var _0x1fbfda=_[_0xd372('0x36')](_0x4a3b94,['id',_0xf40b4a['id']]);if(_0x1fbfda)_[_0xd372('0x80')](_0xf40b4a,_['pick'](_['omit'](_0x1fbfda,_0x4b0580),_0x428f21));_0xf40b4a[_0xd372('0x81')]=getAgentStatus(_0xf40b4a);return _0xf40b4a;});})[_0xd372('0x12')](function(_0x28c63d){if(_0x341471[_0xd372('0x76')][_0xd372('0x82')]){var _0x40d4f6=_[_0xd372('0x4d')](_0x28c63d,['globalStatus',_0x341471[_0xd372('0x76')][_0xd372('0x82')]]);if(_0x341471['query']['pauseTypeFilter']){_0x40d4f6=_[_0xd372('0x4d')](_0x40d4f6,[_0xd372('0x59'),_0x341471[_0xd372('0x76')]['pauseTypeFilter']]);}}_0xf7cef4['rows']=_0x40d4f6||_0x28c63d;return _0xf7cef4;})[_0xd372('0x12')](respondWithFilteredResult(_0x196c31,_0x19effb))[_0xd372('0x18')](handleError(_0x196c31,null));};exports['getQueues']=function(_0x3a1dc8,_0x459e69){var _0x2e0674=[_0xd372('0x83'),_0xd372('0x84'),'sms','openchannel',_0xd372('0x85'),_0xd372('0x86'),_0xd372('0x14')];var _0x247434={'count':0x0,'rows':[]},_0x3e9b6e={},_0x1535d1,_0x108bd3,_0x1c456c,_0x531281,_0x475b88;Promise['resolve']()['then'](function(){if(_0x3a1dc8[_0xd372('0x76')][_0xd372('0x87')]){if(!_[_0xd372('0x88')](_0x2e0674,_0x3a1dc8[_0xd372('0x76')]['channel']['toLowerCase']()))throw new Error(_0xd372('0x89'));_0x1535d1=_0x3a1dc8['query'][_0xd372('0x87')][_0xd372('0x8a')]();}var _0x4f0861=_['startCase'](_0x1535d1)+_0xd372('0x8b');var _0x16f2fe=_[_0xd372('0x30')](db[_0x4f0861][_0xd372('0x72')],function(_0x19a561){return{'name':_0x19a561[_0xd372('0x73')],'type':_0x19a561[_0xd372('0x74')]['key']};});_0x3e9b6e=qs['getOptions'](_0x16f2fe,_0x3a1dc8);if(_0x3a1dc8[_0xd372('0x79')][_0xd372('0x8c')]===_0xd372('0x79')){var _0x4c57b4={'params':{'id':_0x3a1dc8[_0xd372('0x79')][_0xd372('0x8d')]},'query':{'section':_0x1535d1===_0xd372('0x14')&&_0x3a1dc8[_0xd372('0x76')][_0xd372('0x74')]===_0xd372('0x35')?_0xd372('0x8e'):_[_0xd372('0x15')](_0x1535d1)+_0xd372('0x8f'),'type':_0x3a1dc8['query'][_0xd372('0x74')],'nolimit':!![],'sort':_0xd372('0xc'),'filter':_0x3a1dc8[_0xd372('0x76')]['filter']}};return db[_0xd372('0x7d')][_0xd372('0x7e')](_0x4c57b4);}return db[_0x4f0861][_0xd372('0x90')](_0x3e9b6e);})['then'](function(_0x2b157e){_0x247434[_0xd372('0x9')]=_0x2b157e[_0xd372('0x9')];_0x108bd3=_0x2b157e[_0xd372('0x7f')];return getRealtimeQueues(_0x3a1dc8,_0x1535d1);})[_0xd372('0x12')](function(_0x25c380){_0x531281=_0x25c380[_0xd372('0x7f')];return getRealtimeAgents();})['then'](function(_0x4bf0eb){_0x1c456c=_0x4bf0eb[_0xd372('0x7f')];if(_0x1535d1!=_0xd372('0x14'))return;return getRealtimeVoiceQueueChannels();})[_0xd372('0x12')](function(_0x31006a){_0x475b88=_0x31006a?_0x31006a[_0xd372('0x7f')]:[];return initializeQueues(_0x108bd3,_0x531281,_0x1535d1,_0x3a1dc8['query'][_0xd372('0x74')]);})['then'](function(_0x5b4035){var _0x2d69e6=_0x5b4035['map'](function(_0x2d203e){if(_0x1535d1===_0xd372('0x14'))return getVoiceQueueAgents(_0x2d203e,_0x108bd3,_0x1c456c,_0x475b88);else return getQueueAgents(_0x2d203e,_0x1c456c,_0x1535d1);});return Promise['all'](_0x2d69e6);})[_0xd372('0x12')](function(_0x1ba41a){_0x247434['rows']=_0x1ba41a;return _0x247434;})[_0xd372('0x12')](respondWithFilteredResult(_0x459e69,_0x3e9b6e))[_0xd372('0x18')](handleError(_0x459e69,null));}; \ No newline at end of file +var _0x3651=['mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','map','rawAttributes','fieldName','key','query','role','agent','raw','user','userProfileId','sort','UserProfile','getResources','rows','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','openchannel','fax','whatsapp','channel','includes','Invalid\x20channel','type','getOptions','QueueCampaigns','Queues','findAndCountAll','util','jayson/promise','../../components/parsers/qs','api','../../mysqldb','http','offset','undefined','count','limit','status','set','Content-Range','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','voice','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','agents','find','pick','filter','queue','length','busy','internal','toString','talking','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','User','startCase','Queue','Pause','QueueId','unknown','unavailable','ringing','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','pause','every','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','idle','getAgents','userpic','pauseType','lastPauseAt','address','mailPause'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x3651,0x160));var _0x1365=function(_0x4e8660,_0x3d27d0){_0x4e8660=_0x4e8660-0x0;var _0x137a81=_0x3651[_0x4e8660];return _0x137a81;};'use strict';var util=require(_0x1365('0x0'));var _=require('lodash');var jayson=require(_0x1365('0x1'));var qs=require(_0x1365('0x2'));var logger=require('../../config/logger')(_0x1365('0x3'));var db=require(_0x1365('0x4'))['db'];var amiClient=jayson['client'][_0x1365('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0x1365('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x19a877,_0x7b1590){return function(_0x533756){if(_0x533756){var _0x1a40af=typeof _0x7b1590[_0x1365('0x6')]===_0x1365('0x7')&&typeof _0x7b1590['limit']===_0x1365('0x7');var _0x5226bf=_0x533756[_0x1365('0x8')];var _0x3d8660=_0x1a40af?0x0:_0x7b1590[_0x1365('0x6')];var _0x3aab31=_0x1a40af?_0x533756[_0x1365('0x8')]:_0x7b1590[_0x1365('0x6')]+_0x7b1590[_0x1365('0x9')];var _0x1d00a7;if(_0x3aab31>=_0x5226bf){_0x3aab31=_0x5226bf;_0x1d00a7=0xc8;}else{_0x1d00a7=0xce;}_0x19a877[_0x1365('0xa')](_0x1d00a7);return _0x19a877[_0x1365('0xb')](_0x1365('0xc'),_0x3d8660+'-'+_0x3aab31+'/'+_0x5226bf)[_0x1365('0xd')](_0x533756);}return null;};}function handleError(_0x25a6a7,_0x322456){_0x322456=_0x322456||0x1f4;return function(_0x4cac9e){logger[_0x1365('0xe')](_0x4cac9e[_0x1365('0xf')]);if(_0x4cac9e['name']){delete _0x4cac9e[_0x1365('0x10')];}_0x25a6a7[_0x1365('0xa')](_0x322456)[_0x1365('0x11')](_0x4cac9e);};}function getRealtimeAgents(){return new Promise(function(_0x325cab,_0x2c334c){return amiClient[_0x1365('0x12')](_0x1365('0x13'),{})[_0x1365('0x14')](function(_0x793178){if(_0x793178['error'])throw new Error(_0x1365('0x15'));var _0x265013=_0x793178[_0x1365('0x16')];return routingClient[_0x1365('0x12')](_0x1365('0x13'),{})[_0x1365('0x14')](function(_0x489385){if(_0x489385['error'])throw new Error(_0x1365('0x17'));var _0x2d8a63=_0x489385[_0x1365('0x16')];return _0x325cab(_[_0x1365('0x18')]({},_0x265013,_0x2d8a63));});})[_0x1365('0x19')](function(_0x46743e){_0x2c334c(_0x46743e);});});}function getRealtimeQueues(_0x488f08,_0x2e82f4){return new Promise(function(_0x581bc4,_0x554b44){var _0x44408b=_0x2e82f4==='voice'?amiClient:routingClient;return _0x44408b[_0x1365('0x12')](_['startCase'](_0x2e82f4)+'Queues',_0x488f08)['then'](function(_0x3ac0b2){if(_0x3ac0b2[_0x1365('0xe')])throw new Error(util[_0x1365('0x1a')](_0x1365('0x1b'),_0x2e82f4));return _0x581bc4(_0x3ac0b2[_0x1365('0x16')]);})[_0x1365('0x19')](function(_0x25b1f5){_0x554b44(_0x25b1f5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x1177e6,_0x129f07){return amiClient[_0x1365('0x12')]('VoiceQueuesChannels',{})[_0x1365('0x14')](function(_0x394489){if(_0x394489[_0x1365('0xe')])throw new Error(_0x1365('0x1c'));return _0x1177e6(_0x394489[_0x1365('0x16')]);})[_0x1365('0x19')](function(_0x1a0f90){_0x129f07(_0x1a0f90);});});}function initializeQueues(_0x1c10a6,_0x31f18f,_0x405cac,_0x20b1da){var _0x4ce08b=[_0x1365('0x1d'),_0x1365('0x1e'),_0x1365('0x1f'),'talking',_0x1365('0x20')];if(_0x405cac===_0x1365('0x21')&&_0x20b1da===_0x1365('0x22')){_0x4ce08b[_0x1365('0x23')](_0x1365('0x24'),_0x1365('0x25'),_0x1365('0x26'),_0x1365('0x27'),_0x1365('0x28'),_0x1365('0x29'),_0x1365('0x2a'),_0x1365('0x2b'),_0x1365('0x2c'),_0x1365('0x2d'),'erlangAbandonmentRate',_0x1365('0x2e'),_0x1365('0x2f'),_0x1365('0x30'),_0x1365('0x31'),'predictiveIntervalAvailable',_0x1365('0x32'),_0x1365('0x33'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x1365('0x34'),_0x1365('0x35'));}return _0x1c10a6['map'](function(_0x55d83e){var _0x53daad=_0x55d83e['get']({'plain':!![]});_0x53daad[_0x1365('0x36')]=[];_0x53daad['paused']=0x0;_0x53daad['loggedInDb']=0x0;_0x53daad[_0x1365('0x1d')]=0x0;_0x53daad[_0x1365('0x1e')]=0x0;_0x53daad['waiting']=0x0;if(_0x405cac===_0x1365('0x21')){_0x53daad['talking']=0x0;_0x53daad['busy']=0x0;if(_0x20b1da===_0x1365('0x22')){_0x53daad[_0x1365('0x24')]=0x0;_0x53daad[_0x1365('0x25')]=0x0;}}var _0x46eab6=_[_0x1365('0x37')](_0x31f18f,['id',_0x53daad['id']]);if(_0x46eab6)_[_0x1365('0x18')](_0x53daad,_[_0x1365('0x38')](_0x46eab6,_0x4ce08b));return _0x53daad;});}function updateAgentVoiceStatus(_0x1ae784,_0x4a9b20,_0xa9e4d5){var _0x60703a=_[_0x1365('0x39')](_0xa9e4d5,[_0x1365('0x3a'),_0x4a9b20[_0x1365('0x10')]]);if(_0x60703a[_0x1365('0x3b')]===0x0)return _0x1ae784[_0x1365('0x3c')]=!![];if(_['some'](_0x60703a,['connectedlinenum',_0x1ae784[_0x1365('0x3d')][_0x1365('0x3e')]()]))return _0x1ae784[_0x1365('0x3f')]=!![];if(!_0x1ae784[_0x1365('0x3f')])return _0x1ae784['busy']=!![];}function getVoiceQueueAgents(_0x4fc5ad,_0x17255c,_0x413979,_0x1773a9){var _0x5be80a=_[_0x1365('0x37')](_0x17255c,['id',_0x4fc5ad['id']]);if(!_0x5be80a)return _0x4fc5ad;return _0x5be80a[_0x1365('0x40')]({'raw':!![]})['then'](function(_0x1d72cb){for(var _0x135292=0x0;_0x135292<_0x1d72cb[_0x1365('0x3b')];_0x135292++){var _0x23f067=_[_0x1365('0x37')](_0x413979,['id',_0x1d72cb[_0x135292]['UserId']]);if(!_0x23f067){_0x23f067={'id':_0x1d72cb[_0x135292][_0x1365('0x41')],'name':_0x1d72cb[_0x135292][_0x1365('0x41')],'accountcode':'','online':![]};}var _0x4992a7={'id':_0x23f067['id'],'name':_0x23f067['name'],'internal':_0x23f067[_0x1365('0x42')],'online':Boolean(_0x23f067[_0x1365('0x43')]),'paused':Boolean(_0x1d72cb[_0x135292][_0x1365('0x20')])};if(_0x23f067[_0x1365('0x44')]===_0x1365('0x3f'))updateAgentVoiceStatus(_0x4992a7,_0x4fc5ad,_0x1773a9);if(_0x4992a7[_0x1365('0x43')])_0x4fc5ad[_0x1365('0x45')]++;if(_0x4992a7['busy'])_0x4fc5ad[_0x1365('0x3c')]++;if(_0x4992a7[_0x1365('0x20')]&&!_0x4992a7[_0x1365('0x3c')]&&!_0x4992a7[_0x1365('0x3f')])_0x4fc5ad[_0x1365('0x20')]++;_0x4fc5ad[_0x1365('0x36')][_0x1365('0x23')](_0x4992a7);}return _0x4fc5ad;});}function getQueueAgents(_0x464da9,_0x3f5b28,_0x17120a){var _0x14d619=_0x1365('0x46')+_[_0x1365('0x47')](_0x17120a)+_0x1365('0x48');var _0x2539e1=_0x17120a+_0x1365('0x49');return db[_0x14d619]['findAll']({'where':{[_[_0x1365('0x47')](_0x17120a)+_0x1365('0x4a')]:_0x464da9['id']},'raw':!![]})[_0x1365('0x14')](function(_0xf2a0f4){for(var _0x36364f=0x0;_0x36364f<_0xf2a0f4['length'];_0x36364f++){var _0x1aa505=_[_0x1365('0x37')](_0x3f5b28,['id',_0xf2a0f4[_0x36364f][_0x1365('0x41')]]);if(!_0x1aa505){_0x1aa505={'id':_0xf2a0f4[_0x36364f][_0x1365('0x41')],'name':_0xf2a0f4[_0x36364f]['UserId'],'online':![],['pauseField']:![]};}var _0x255e11={'id':_0x1aa505['id'],'name':_0x1aa505[_0x1365('0x10')],'online':Boolean(_0x1aa505[_0x1365('0x43')]),'paused':Boolean(_0x1aa505[_0x2539e1])};if(_0x255e11[_0x1365('0x43')])_0x464da9['loggedInDb']++;_0x464da9[_0x1365('0x36')][_0x1365('0x23')](_0x255e11);}return _0x464da9;});}function isIdle(_0x759890){return _0x759890==='idle'||_0x759890===_0x1365('0x4b')||_0x759890===_0x1365('0x4c')||_0x759890===_0x1365('0x4d')||_['isNil'](_0x759890);}function isAgentPaused(_0xde2218,_0x5002d){var _0x8d3e03=[_0xde2218[_0x1365('0x4e')],_0xde2218[_0x1365('0x4f')],_0xde2218['mailPause'],_0xde2218[_0x1365('0x50')],_0xde2218[_0x1365('0x51')],_0xde2218[_0x1365('0x52')],_0xde2218[_0x1365('0x53')]];if(!_0x5002d)return _['every'](_0x8d3e03);var _0x299305=_[_0x1365('0x39')](_0x8d3e03);return _0x299305[_0x1365('0x3b')]>0x0&&_0x299305[_0x1365('0x3b')]<_0x8d3e03[_0x1365('0x3b')]?!![]:![];}function isAgentIdle(_0x21db35){if(_0x21db35[_0x1365('0x44')]!=='idle'&&_0x21db35[_0x1365('0x52')]){_0x21db35[_0x1365('0x44')]=_0x1365('0x54');return![];}return _[_0x1365('0x55')]([_0x21db35[_0x1365('0x56')],_0x21db35[_0x1365('0x57')],_0x21db35['mailStatus'],_0x21db35[_0x1365('0x58')],_0x21db35[_0x1365('0x59')],_0x21db35['voiceStatus'],_0x21db35[_0x1365('0x5a')]],isIdle);}function getAgentStatus(_0x162c13){var _0x16f794=_0x1365('0x4b');if(isAgentPaused(_0x162c13))_0x16f794=_0x1365('0x54');else if(isAgentPaused(_0x162c13,!![]))_0x16f794='*pause';else if(isAgentIdle(_0x162c13))_0x16f794=_0x1365('0x5b');else _0x16f794='busy';return _0x16f794;}exports[_0x1365('0x5c')]=function(_0x222b58,_0x524efe){var _0x21bfc6={'count':0x0,'rows':[]},_0x874c99={},_0xdc10b,_0x4a482d,_0x1959d4=[_0x1365('0x5d'),_0x1365('0x43'),'lastLoginAt','lastPauseAt',_0x1365('0x5e'),_0x1365('0x5f'),'internal',_0x1365('0x60'),_0x1365('0x4e'),_0x1365('0x50'),_0x1365('0x61'),_0x1365('0x51'),_0x1365('0x53'),_0x1365('0x4f'),_0x1365('0x52'),'chatCapacity','openchannelCapacity',_0x1365('0x62'),_0x1365('0x63'),_0x1365('0x64'),_0x1365('0x65'),_0x1365('0x66'),_0x1365('0x67'),_0x1365('0x68'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x1365('0x69'),'chatStatus',_0x1365('0x58'),_0x1365('0x6a'),_0x1365('0x59'),_0x1365('0x5a'),_0x1365('0x57'),_0x1365('0x44'),_0x1365('0x6b'),_0x1365('0x6c'),_0x1365('0x6d'),_0x1365('0x6e'),_0x1365('0x6f'),'faxStatusTime',_0x1365('0x70'),'queue',_0x1365('0x71'),_0x1365('0x72'),_0x1365('0x73'),_0x1365('0x74'),_0x1365('0x75')],_0x3cc884=[_0x1365('0x4e'),_0x1365('0x50'),_0x1365('0x61'),'smsPause',_0x1365('0x53'),_0x1365('0x4f'),_0x1365('0x52'),_0x1365('0x43')];Promise[_0x1365('0x76')]()[_0x1365('0x14')](function(){var _0x119b82=_[_0x1365('0x77')](db[_0x1365('0x46')][_0x1365('0x78')],function(_0xa0bffe){return{'name':_0xa0bffe[_0x1365('0x79')],'type':_0xa0bffe['type'][_0x1365('0x7a')]};});_0x222b58[_0x1365('0x7b')][_0x1365('0x7c')]=_0x1365('0x7d');_0x222b58[_0x1365('0x7b')]['online']=!![];_0x874c99=qs['getOptions'](_0x119b82,_0x222b58);_0x874c99[_0x1365('0x7e')]=!![];if(_0x222b58[_0x1365('0x7f')][_0x1365('0x7c')]===_0x1365('0x7f')){var _0x519cef={'params':{'id':_0x222b58[_0x1365('0x7f')][_0x1365('0x80')]},'query':{'section':_0x1365('0x13'),'role':'agent','online':!![],'nolimit':_0x222b58[_0x1365('0x7b')]['nolimit'],'sort':_0x222b58[_0x1365('0x7b')][_0x1365('0x81')],'filter':_0x222b58[_0x1365('0x7b')][_0x1365('0x39')]},'raw':!![]};return db[_0x1365('0x82')][_0x1365('0x83')](_0x519cef);}return db[_0x1365('0x46')]['findAndCountAll'](_0x874c99);})[_0x1365('0x14')](function(_0x1af640){_0x21bfc6[_0x1365('0x8')]=_0x1af640['count'];_0xdc10b=_0x1af640[_0x1365('0x84')];return getRealtimeAgents();})[_0x1365('0x14')](function(_0x1a878c){_0x4a482d=_0x1a878c[_0x1365('0x84')];return _0xdc10b[_0x1365('0x77')](function(_0x2567bf){var _0x2ef220=_['find'](_0x4a482d,['id',_0x2567bf['id']]);if(_0x2ef220)_[_0x1365('0x18')](_0x2567bf,_[_0x1365('0x38')](_['omit'](_0x2ef220,_0x3cc884),_0x1959d4));_0x2567bf[_0x1365('0x85')]=getAgentStatus(_0x2567bf);return _0x2567bf;});})[_0x1365('0x14')](function(_0xdca86c){if(_0x222b58[_0x1365('0x7b')]['globalStatusFilter']){var _0x2a6ffb=_['filter'](_0xdca86c,['globalStatus',_0x222b58[_0x1365('0x7b')][_0x1365('0x86')]]);if(_0x222b58[_0x1365('0x7b')]['pauseTypeFilter']){_0x2a6ffb=_[_0x1365('0x39')](_0x2a6ffb,[_0x1365('0x5e'),_0x222b58[_0x1365('0x7b')][_0x1365('0x87')]]);}}_0x21bfc6[_0x1365('0x84')]=_0x2a6ffb||_0xdca86c;return _0x21bfc6;})[_0x1365('0x14')](respondWithFilteredResult(_0x524efe,_0x874c99))['catch'](handleError(_0x524efe,null));};exports[_0x1365('0x88')]=function(_0x5783b3,_0x4d836b){var _0x2d4137=[_0x1365('0x89'),_0x1365('0x8a'),'sms',_0x1365('0x8b'),_0x1365('0x8c'),_0x1365('0x8d'),'voice'];var _0x2d3079={'count':0x0,'rows':[]},_0x261e0b={},_0x1f88f9,_0xde6130,_0x40ceea,_0x489148,_0x1e27ca;Promise[_0x1365('0x76')]()['then'](function(){if(_0x5783b3['query'][_0x1365('0x8e')]){if(!_[_0x1365('0x8f')](_0x2d4137,_0x5783b3[_0x1365('0x7b')][_0x1365('0x8e')]['toLowerCase']()))throw new Error(_0x1365('0x90'));_0x1f88f9=_0x5783b3[_0x1365('0x7b')]['channel']['toLowerCase']();}var _0x27aede=_['startCase'](_0x1f88f9)+_0x1365('0x48');var _0x1b2a5f=_[_0x1365('0x77')](db[_0x27aede][_0x1365('0x78')],function(_0x5775d7){return{'name':_0x5775d7[_0x1365('0x79')],'type':_0x5775d7[_0x1365('0x91')][_0x1365('0x7a')]};});_0x261e0b=qs[_0x1365('0x92')](_0x1b2a5f,_0x5783b3);if(_0x5783b3[_0x1365('0x7f')][_0x1365('0x7c')]===_0x1365('0x7f')){var _0x12fb6d={'params':{'id':_0x5783b3['user'][_0x1365('0x80')]},'query':{'section':_0x1f88f9===_0x1365('0x21')&&_0x5783b3[_0x1365('0x7b')][_0x1365('0x91')]==='outbound'?_0x1365('0x93'):_['startCase'](_0x1f88f9)+_0x1365('0x94'),'type':_0x5783b3[_0x1365('0x7b')]['type'],'nolimit':!![],'sort':_0x1365('0x10'),'filter':_0x5783b3[_0x1365('0x7b')][_0x1365('0x39')]}};return db['UserProfile'][_0x1365('0x83')](_0x12fb6d);}return db[_0x27aede][_0x1365('0x95')](_0x261e0b);})[_0x1365('0x14')](function(_0x45f186){_0x2d3079[_0x1365('0x8')]=_0x45f186[_0x1365('0x8')];_0xde6130=_0x45f186[_0x1365('0x84')];return getRealtimeQueues(_0x5783b3,_0x1f88f9);})[_0x1365('0x14')](function(_0x8c98d9){_0x489148=_0x8c98d9['rows'];return getRealtimeAgents();})[_0x1365('0x14')](function(_0x3088c0){_0x40ceea=_0x3088c0[_0x1365('0x84')];if(_0x1f88f9!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x1365('0x14')](function(_0x1dc31e){_0x1e27ca=_0x1dc31e?_0x1dc31e[_0x1365('0x84')]:[];return initializeQueues(_0xde6130,_0x489148,_0x1f88f9,_0x5783b3[_0x1365('0x7b')][_0x1365('0x91')]);})['then'](function(_0x5168c1){var _0x404239=_0x5168c1[_0x1365('0x77')](function(_0x4c2a5b){if(_0x1f88f9===_0x1365('0x21'))return getVoiceQueueAgents(_0x4c2a5b,_0xde6130,_0x40ceea,_0x1e27ca);else return getQueueAgents(_0x4c2a5b,_0x40ceea,_0x1f88f9);});return Promise['all'](_0x404239);})['then'](function(_0x8b703a){_0x2d3079['rows']=_0x8b703a;return _0x2d3079;})[_0x1365('0x14')](respondWithFilteredResult(_0x4d836b,_0x261e0b))[_0x1365('0x19')](handleError(_0x4d836b,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4b10862..bb99fc4 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x328196,_0x14bd89){var _0x9c5d77=function(_0x18da76){while(--_0x18da76){_0x328196['push'](_0x328196['shift']());}};_0x9c5d77(++_0x14bd89);}(_0xedd9,0xfc));var _0x9edd=function(_0x2ced3b,_0xe131cf){_0x2ced3b=_0x2ced3b-0x0;var _0xed9aed=_0xedd9[_0x2ced3b];return _0xed9aed;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xdbff26,_0xfc8995){var _0x4adb23=function(_0x291780){while(--_0x291780){_0xdbff26['push'](_0xdbff26['shift']());}};_0x4adb23(++_0xfc8995);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 167d410..8014950 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 _0xfb65=['DATE','STRING','exports','INTEGER'];(function(_0x162ae9,_0x80a632){var _0x4e1701=function(_0x2caea5){while(--_0x2caea5){_0x162ae9['push'](_0x162ae9['shift']());}};_0x4e1701(++_0x80a632);}(_0xfb65,0x82));var _0x5fb6=function(_0x37263c,_0x1aa946){_0x37263c=_0x37263c-0x0;var _0x5aacdb=_0xfb65[_0x37263c];return _0x5aacdb;};'use strict';var Sequelize=require('sequelize');module[_0x5fb6('0x0')]={'state':{'type':Sequelize[_0x5fb6('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5fb6('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5fb6('0x2')]},'responsetime':{'type':Sequelize[_0x5fb6('0x2')]},'ringtime':{'type':Sequelize[_0x5fb6('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5fb6('0x3')]},'campaigntype':{'type':Sequelize[_0x5fb6('0x3')]},'membername':{'type':Sequelize[_0x5fb6('0x3')]}}; \ No newline at end of file +var _0xc1fa=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x222054,_0x45620f){var _0x5de492=function(_0x8ee7b4){while(--_0x8ee7b4){_0x222054['push'](_0x222054['shift']());}};_0x5de492(++_0x45620f);}(_0xc1fa,0x83));var _0xac1f=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0xc1fa[_0x4996d5];return _0x4793f9;};'use strict';var Sequelize=require(_0xac1f('0x0'));module[_0xac1f('0x1')]={'state':{'type':Sequelize[_0xac1f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xac1f('0x3')]},'scheduledat':{'type':Sequelize[_0xac1f('0x4')]},'uniqueid':{'type':Sequelize[_0xac1f('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xac1f('0x4')]},'ringtime':{'type':Sequelize[_0xac1f('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xac1f('0x3')]},'campaigntype':{'type':Sequelize[_0xac1f('0x3')]},'membername':{'type':Sequelize[_0xac1f('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index fd5ae28..d0dfce6 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 _0x6998=['report_agent_preview','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x4318ad,_0x206dca){var _0x7c3a43=function(_0x4a74d8){while(--_0x4a74d8){_0x4318ad['push'](_0x4318ad['shift']());}};_0x7c3a43(++_0x206dca);}(_0x6998,0x12d));var _0x8699=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0x6998[_0x119705];return _0x2affc2;};'use strict';var _=require(_0x8699('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8699('0x1'));var moment=require(_0x8699('0x2'));var BPromise=require(_0x8699('0x3'));var rp=require(_0x8699('0x4'));var fs=require('fs');var path=require(_0x8699('0x5'));var rimraf=require(_0x8699('0x6'));var config=require(_0x8699('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x27e52f,_0x50affd){return _0x27e52f[_0x8699('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x8699('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc70=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','report_agent_preview','lodash'];(function(_0x154d5d,_0x2fd8ef){var _0x138c13=function(_0x327544){while(--_0x327544){_0x154d5d['push'](_0x154d5d['shift']());}};_0x138c13(++_0x2fd8ef);}(_0xdc70,0x173));var _0x0dc7=function(_0x5470e5,_0x2915c3){_0x5470e5=_0x5470e5-0x0;var _0x24bd75=_0xdc70[_0x5470e5];return _0x24bd75;};'use strict';var _=require(_0x0dc7('0x0'));var util=require(_0x0dc7('0x1'));var logger=require(_0x0dc7('0x2'))(_0x0dc7('0x3'));var moment=require(_0x0dc7('0x4'));var BPromise=require(_0x0dc7('0x5'));var rp=require(_0x0dc7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dc7('0x7'));var config=require(_0x0dc7('0x8'));var attributes=require(_0x0dc7('0x9'));module[_0x0dc7('0xa')]=function(_0x18de38,_0x5bc634){return _0x18de38['define']('ReportAgentPreview',attributes,{'tableName':_0x0dc7('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 a58a399..19d840f 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 _0x5c5f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','util'];(function(_0x2658b0,_0x2c7d75){var _0x1851dc=function(_0x18c687){while(--_0x18c687){_0x2658b0['push'](_0x2658b0['shift']());}};_0x1851dc(++_0x2c7d75);}(_0x5c5f,0xa6));var _0xf5c5=function(_0x16bb39,_0x293e15){_0x16bb39=_0x16bb39-0x0;var _0x3daba8=_0x5c5f[_0x16bb39];return _0x3daba8;};'use strict';var _=require(_0xf5c5('0x0'));var util=require(_0xf5c5('0x1'));var moment=require('moment');var BPromise=require(_0xf5c5('0x2'));var rs=require(_0xf5c5('0x3'));var fs=require('fs');var Redis=require(_0xf5c5('0x4'));var db=require(_0xf5c5('0x5'))['db'];var utils=require(_0xf5c5('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5c5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf5c5('0x8')][_0xf5c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ee169,_0x60022,_0x42cd27){return new BPromise(function(_0x129f7c,_0x7b8b80){return client[_0xf5c5('0xa')](_0x4ee169,_0x42cd27)[_0xf5c5('0xb')](function(_0x39750d){logger[_0xf5c5('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x60022,'request\x20sent');logger[_0xf5c5('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x60022,_0xf5c5('0xe'),JSON[_0xf5c5('0xf')](_0x39750d));if(_0x39750d[_0xf5c5('0x10')]){if(_0x39750d[_0xf5c5('0x10')][_0xf5c5('0x11')]===0x1f4){logger['error'](_0xf5c5('0x12'),_0x60022,_0x39750d[_0xf5c5('0x10')][_0xf5c5('0x13')]);return _0x7b8b80(_0x39750d[_0xf5c5('0x10')]['message']);}logger[_0xf5c5('0x10')](_0xf5c5('0x12'),_0x60022,_0x39750d[_0xf5c5('0x10')][_0xf5c5('0x13')]);return _0x129f7c(_0x39750d[_0xf5c5('0x10')][_0xf5c5('0x13')]);}else{logger[_0xf5c5('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x60022,_0xf5c5('0xe'));_0x129f7c(_0x39750d[_0xf5c5('0x14')][_0xf5c5('0x13')]);}})[_0xf5c5('0x15')](function(_0x2cb7f8){logger[_0xf5c5('0x10')](_0xf5c5('0x12'),_0x60022,_0x2cb7f8);_0x7b8b80(_0x2cb7f8);});});}exports['CreateReportAgentPreview']=function(_0x420128){var _0x5b82de=this;return new Promise(function(_0x158592,_0x54e900){return db[_0xf5c5('0x16')][_0xf5c5('0x17')](_0x420128[_0xf5c5('0x18')],{'raw':_0x420128[_0xf5c5('0x19')]?_0x420128[_0xf5c5('0x19')][_0xf5c5('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x16b5a3){logger[_0xf5c5('0xc')](_0xf5c5('0x1b'),_0x420128);logger[_0xf5c5('0xd')](_0xf5c5('0x1b'),_0x420128,JSON['stringify'](_0x16b5a3));_0x158592(_0x16b5a3);})[_0xf5c5('0x15')](function(_0x354229){logger[_0xf5c5('0x10')]('CreateReportAgentPreview',_0x354229['message'],_0x420128);_0x54e900(_0x5b82de['error'](0x1f4,_0x354229[_0xf5c5('0x13')]));});});}; \ No newline at end of file +var _0xf9aa=['debug','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3c9c06,_0x4e0395){var _0x32cd7d=function(_0x31b15f){while(--_0x31b15f){_0x3c9c06['push'](_0x3c9c06['shift']());}};_0x32cd7d(++_0x4e0395);}(_0xf9aa,0x15a));var _0xaf9a=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0xf9aa[_0x4ada50];return _0x3d85d5;};'use strict';var _=require(_0xaf9a('0x0'));var util=require(_0xaf9a('0x1'));var moment=require(_0xaf9a('0x2'));var BPromise=require(_0xaf9a('0x3'));var rs=require(_0xaf9a('0x4'));var fs=require('fs');var Redis=require(_0xaf9a('0x5'));var db=require(_0xaf9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf9a('0x7'))(_0xaf9a('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf9a('0x9'));var client=jayson[_0xaf9a('0xa')][_0xaf9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20ae35,_0x5c4f84,_0x5026bc){return new BPromise(function(_0x452228,_0x5b7eed){return client[_0xaf9a('0xc')](_0x20ae35,_0x5026bc)[_0xaf9a('0xd')](function(_0x10e7e0){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x5c4f84,'request\x20sent');logger[_0xaf9a('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5c4f84,_0xaf9a('0xf'),JSON['stringify'](_0x10e7e0));if(_0x10e7e0['error']){if(_0x10e7e0[_0xaf9a('0x10')][_0xaf9a('0x11')]===0x1f4){logger[_0xaf9a('0x10')](_0xaf9a('0x12'),_0x5c4f84,_0x10e7e0[_0xaf9a('0x10')]['message']);return _0x5b7eed(_0x10e7e0['error'][_0xaf9a('0x13')]);}logger[_0xaf9a('0x10')](_0xaf9a('0x12'),_0x5c4f84,_0x10e7e0[_0xaf9a('0x10')][_0xaf9a('0x13')]);return _0x452228(_0x10e7e0[_0xaf9a('0x10')]['message']);}else{logger[_0xaf9a('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x5c4f84,_0xaf9a('0xf'));_0x452228(_0x10e7e0[_0xaf9a('0x15')][_0xaf9a('0x13')]);}})[_0xaf9a('0x16')](function(_0x1d4d5c){logger['error'](_0xaf9a('0x12'),_0x5c4f84,_0x1d4d5c);_0x5b7eed(_0x1d4d5c);});});}exports[_0xaf9a('0x17')]=function(_0x33fa7a){var _0x28bfa4=this;return new Promise(function(_0xd6bbad,_0x428da8){return db[_0xaf9a('0x18')][_0xaf9a('0x19')](_0x33fa7a[_0xaf9a('0x1a')],{'raw':_0x33fa7a[_0xaf9a('0x1b')]?_0x33fa7a[_0xaf9a('0x1b')][_0xaf9a('0x1c')]===undefined?!![]:![]:!![]})[_0xaf9a('0xd')](function(_0x12bace){logger['info']('CreateReportAgentPreview',_0x33fa7a);logger[_0xaf9a('0xe')](_0xaf9a('0x17'),_0x33fa7a,JSON[_0xaf9a('0x1d')](_0x12bace));_0xd6bbad(_0x12bace);})[_0xaf9a('0x16')](function(_0x3b3b8f){logger[_0xaf9a('0x10')](_0xaf9a('0x17'),_0x3b3b8f[_0xaf9a('0x13')],_0x33fa7a);_0x428da8(_0x28bfa4[_0xaf9a('0x10')](0x1f4,_0x3b3b8f[_0xaf9a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 94eb110..9f16851 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 _0x08dc=['faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','agentNotify','exports','multer','path','express','Router','../../components/auth/service','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/telephones','telephones','/trunks','trunks','/campaigns'];(function(_0x348b7b,_0x23b9a3){var _0x4323a5=function(_0x287d89){while(--_0x287d89){_0x348b7b['push'](_0x348b7b['shift']());}};_0x4323a5(++_0x23b9a3);}(_0x08dc,0x189));var _0xc08d=function(_0x148c0d,_0x9566c9){_0x148c0d=_0x148c0d-0x0;var _0x4e22e9=_0x08dc[_0x148c0d];return _0x4e22e9;};'use strict';var multer=require(_0xc08d('0x0'));var util=require('util');var path=require(_0xc08d('0x1'));var express=require(_0xc08d('0x2'));var router=express[_0xc08d('0x3')]();var auth=require(_0xc08d('0x4'));var controller=require('./rpc.controller');router[_0xc08d('0x5')](_0xc08d('0x6'),auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xc08d('0x7'),auth[_0xc08d('0x8')](),controller['voiceChannelMixMonitor']);router[_0xc08d('0x5')](_0xc08d('0x9'),auth['isAuthenticated'](),controller[_0xc08d('0xa')]);router[_0xc08d('0x5')]('/voice/queues',auth[_0xc08d('0x8')](),controller[_0xc08d('0xb')]);router[_0xc08d('0x5')](_0xc08d('0xc'),auth[_0xc08d('0x8')](),controller['chatQueues']);router[_0xc08d('0x5')](_0xc08d('0xd'),auth[_0xc08d('0x8')](),controller[_0xc08d('0xe')]);router[_0xc08d('0x5')](_0xc08d('0xf'),auth['isAuthenticated'](),controller[_0xc08d('0x10')]);router[_0xc08d('0x5')](_0xc08d('0x11'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x12')]);router['get'](_0xc08d('0x13'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x14')]);router['get'](_0xc08d('0x15'),auth['isAuthenticated'](),controller[_0xc08d('0x16')]);router['get']('/fax/queues',auth[_0xc08d('0x8')](),controller[_0xc08d('0x17')]);router[_0xc08d('0x5')](_0xc08d('0x18'),auth['isAuthenticated'](),controller[_0xc08d('0x19')]);router[_0xc08d('0x5')]('/voice/queues/channels',auth[_0xc08d('0x8')](),controller[_0xc08d('0x1a')]);router['get'](_0xc08d('0x1b'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x1c')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xc08d('0x8')](),controller[_0xc08d('0x1d')]);router[_0xc08d('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xc08d('0x8')](),controller[_0xc08d('0x1e')]);router[_0xc08d('0x5')](_0xc08d('0x1f'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x20')]);router[_0xc08d('0x21')](_0xc08d('0x1f'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x22')]);router['get'](_0xc08d('0x23'),auth['isAuthenticated'](),controller[_0xc08d('0x24')]);router[_0xc08d('0x5')](_0xc08d('0x25'),auth[_0xc08d('0x8')](),controller['outboundChannels']);router[_0xc08d('0x5')](_0xc08d('0x26'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x27')]);router[_0xc08d('0x21')]('/agents/:id/capacity',auth[_0xc08d('0x8')](),controller['agentCapacity']);router['get'](_0xc08d('0x28'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x29')]);router[_0xc08d('0x5')](_0xc08d('0x2a'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x2b')]);router[_0xc08d('0x5')](_0xc08d('0x2c'),auth[_0xc08d('0x8')](),controller['campaigns']);router[_0xc08d('0x5')]('/fax/accounts',auth[_0xc08d('0x8')](),controller[_0xc08d('0x2d')]);router[_0xc08d('0x5')](_0xc08d('0x2e'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x2f')]);router[_0xc08d('0x5')](_0xc08d('0x30'),auth[_0xc08d('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0xc08d('0x5')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xc08d('0x5')](_0xc08d('0x31'),auth[_0xc08d('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xc08d('0x5')](_0xc08d('0x32'),auth['isAuthenticated'](),controller[_0xc08d('0x33')]);router[_0xc08d('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0xc08d('0x8')](),controller[_0xc08d('0x34')]);router[_0xc08d('0x5')](_0xc08d('0x35'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x36')]);router[_0xc08d('0x37')]('/mail/queues/:id/notify',auth[_0xc08d('0x8')](),controller[_0xc08d('0x38')](_0xc08d('0x39')));router[_0xc08d('0x5')](_0xc08d('0x3a'),auth[_0xc08d('0x8')](),controller['showMailQueues']);router[_0xc08d('0x37')]('/chat/queues/:id/notify',auth[_0xc08d('0x8')](),controller['queueNotify'](_0xc08d('0x3b')));router[_0xc08d('0x5')](_0xc08d('0x3c'),auth[_0xc08d('0x8')](),controller[_0xc08d('0x3d')]);router[_0xc08d('0x37')]('/fax/queues/:id/notify',auth[_0xc08d('0x8')](),controller[_0xc08d('0x38')](_0xc08d('0x3e')));router[_0xc08d('0x5')](_0xc08d('0x3f'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0xc08d('0x37')]('/openchannel/queues/:id/notify',auth[_0xc08d('0x8')](),controller[_0xc08d('0x38')]('openchannel'));router['get']('/openchannel/queues/:id',auth[_0xc08d('0x8')](),controller[_0xc08d('0x40')]);router[_0xc08d('0x37')](_0xc08d('0x41'),auth[_0xc08d('0x8')](),controller['queueNotify'](_0xc08d('0x42')));router[_0xc08d('0x37')](_0xc08d('0x43'),auth['isAuthenticated'](),controller[_0xc08d('0x38')](_0xc08d('0x44')));router[_0xc08d('0x5')](_0xc08d('0x45'),auth[_0xc08d('0x8')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0xc08d('0x8')](),controller[_0xc08d('0x46')]);router[_0xc08d('0x37')]('/agents/:id/notify',auth[_0xc08d('0x8')](),controller[_0xc08d('0x47')]);module[_0xc08d('0x48')]=router; \ No newline at end of file +var _0xc264=['openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','/trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions'];(function(_0x46e807,_0x4821a4){var _0x44bee4=function(_0x3be339){while(--_0x3be339){_0x46e807['push'](_0x46e807['shift']());}};_0x44bee4(++_0x4821a4);}(_0xc264,0x1a6));var _0x4c26=function(_0x2384f6,_0x167775){_0x2384f6=_0x2384f6-0x0;var _0x370294=_0xc264[_0x2384f6];return _0x370294;};'use strict';var multer=require(_0x4c26('0x0'));var util=require(_0x4c26('0x1'));var path=require(_0x4c26('0x2'));var express=require(_0x4c26('0x3'));var router=express[_0x4c26('0x4')]();var auth=require(_0x4c26('0x5'));var controller=require(_0x4c26('0x6'));router[_0x4c26('0x7')](_0x4c26('0x8'),auth['isAuthenticated'](),controller[_0x4c26('0x9')]);router[_0x4c26('0x7')](_0x4c26('0xa'),auth[_0x4c26('0xb')](),controller[_0x4c26('0xc')]);router['get'](_0x4c26('0xd'),auth['isAuthenticated'](),controller[_0x4c26('0xe')]);router[_0x4c26('0x7')](_0x4c26('0xf'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x10')]);router[_0x4c26('0x7')]('/chat/queues',auth[_0x4c26('0xb')](),controller['chatQueues']);router['get'](_0x4c26('0x11'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x12')]);router[_0x4c26('0x7')](_0x4c26('0x13'),auth[_0x4c26('0xb')](),controller['mailAccounts']);router[_0x4c26('0x7')](_0x4c26('0x14'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x15')]);router[_0x4c26('0x7')](_0x4c26('0x16'),auth[_0x4c26('0xb')](),controller['smsQueues']);router[_0x4c26('0x7')]('/whatsapp/queues',auth[_0x4c26('0xb')](),controller['whatsappQueues']);router[_0x4c26('0x7')](_0x4c26('0x17'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x18')]);router[_0x4c26('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x4c26('0x19'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x1a')]);router[_0x4c26('0x7')](_0x4c26('0x1b'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x1c')]);router['get'](_0x4c26('0x1d'),auth[_0x4c26('0xb')](),controller['voiceQueuesChannelHangup']);router[_0x4c26('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x4c26('0x1e')]);router[_0x4c26('0x7')](_0x4c26('0x1f'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x20')]);router[_0x4c26('0x21')]('/voice/queues/:id',auth[_0x4c26('0xb')](),controller[_0x4c26('0x22')]);router[_0x4c26('0x7')](_0x4c26('0x23'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x24')]);router[_0x4c26('0x7')](_0x4c26('0x25'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x26')]);router[_0x4c26('0x7')](_0x4c26('0x27'),auth['isAuthenticated'](),controller[_0x4c26('0x28')]);router[_0x4c26('0x21')](_0x4c26('0x29'),auth[_0x4c26('0xb')](),controller['agentCapacity']);router[_0x4c26('0x7')](_0x4c26('0x2a'),auth['isAuthenticated'](),controller['telephones']);router[_0x4c26('0x7')](_0x4c26('0x2b'),auth['isAuthenticated'](),controller['trunks']);router[_0x4c26('0x7')](_0x4c26('0x2c'),auth[_0x4c26('0xb')](),controller['campaigns']);router[_0x4c26('0x7')](_0x4c26('0x2d'),auth[_0x4c26('0xb')](),controller['faxAccounts']);router['get'](_0x4c26('0x2e'),auth['isAuthenticated'](),controller[_0x4c26('0x2f')]);router[_0x4c26('0x7')](_0x4c26('0x30'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x31')]);router[_0x4c26('0x7')]('/openchannel/queues/waitinginteractions',auth[_0x4c26('0xb')](),controller[_0x4c26('0x32')]);router[_0x4c26('0x7')](_0x4c26('0x33'),auth['isAuthenticated'](),controller[_0x4c26('0x34')]);router[_0x4c26('0x7')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x4c26('0x35')]);router[_0x4c26('0x7')](_0x4c26('0x36'),auth['isAuthenticated'](),controller[_0x4c26('0x37')]);router[_0x4c26('0x7')]('/fax/queues/waitinginteractions',auth[_0x4c26('0xb')](),controller[_0x4c26('0x38')]);router[_0x4c26('0x39')]('/mail/queues/:id/notify',auth[_0x4c26('0xb')](),controller[_0x4c26('0x3a')](_0x4c26('0x3b')));router[_0x4c26('0x7')](_0x4c26('0x3c'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x3d')]);router[_0x4c26('0x39')](_0x4c26('0x3e'),auth['isAuthenticated'](),controller[_0x4c26('0x3a')](_0x4c26('0x3f')));router[_0x4c26('0x7')](_0x4c26('0x40'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x41')]);router[_0x4c26('0x39')](_0x4c26('0x42'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x3a')](_0x4c26('0x43')));router[_0x4c26('0x7')](_0x4c26('0x44'),auth[_0x4c26('0xb')](),controller['showFaxQueues']);router[_0x4c26('0x39')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x4c26('0x45')));router[_0x4c26('0x7')](_0x4c26('0x46'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x47')]);router['post'](_0x4c26('0x48'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x3a')]('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0x4c26('0xb')](),controller['queueNotify'](_0x4c26('0x49')));router['get']('/sms/queues/:id',auth[_0x4c26('0xb')](),controller[_0x4c26('0x4a')]);router[_0x4c26('0x7')](_0x4c26('0x4b'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x4c')]);router[_0x4c26('0x39')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x4c26('0x4d')]);module[_0x4c26('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f367f0b..b7be043 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 _0x207c=['moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','then','error','code','result','status','json','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','INTERACTION','interface','agent','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','Message','messageId','Interaction','queue','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','MessageId','From','*,*,*,*'];(function(_0x3d65b6,_0x3d906f){var _0x5b7be4=function(_0x59c934){while(--_0x59c934){_0x3d65b6['push'](_0x3d65b6['shift']());}};_0x5b7be4(++_0x3d906f);}(_0x207c,0x1e8));var _0xc207=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x207c[_0x8ae98b];return _0xc30bd4;};'use strict';var BPromise=require('bluebird');var moment=require(_0xc207('0x0'));var _=require(_0xc207('0x1'));var util=require(_0xc207('0x2'));var db=require(_0xc207('0x3'))['db'];var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var jayson=require(_0xc207('0x6'));var amiClient=jayson['client'][_0xc207('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0xc207('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){var _0x3c579f=_0x59ff6f?_0x59ff6f:amiClient;return _0x3c579f['request'](_0x314561,_0x3395e4)[_0xc207('0x8')](function(_0x817576){if(_0x817576[_0xc207('0x9')]){if(_0x817576[_0xc207('0x9')][_0xc207('0xa')]===0x1f4){return _0xad159b(_0x817576[_0xc207('0x9')]['message']);}return _0x25cb97(_0x817576['error']['message']);}else{_0x25cb97(_0x817576[_0xc207('0xb')]);}})['catch'](function(_0x2741f3){_0xad159b(_0x2741f3);});});}function respondWithResult(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xc8;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0xc')](_0x59d401)[_0xc207('0xd')](_0x3e1108);}return _0x2782ce[_0xc207('0xe')](0x194);};}function handleError(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0x1f4;return function(_0xc62672){logger[_0xc207('0x9')](_0xc62672[_0xc207('0xf')]);if(_0xc62672[_0xc207('0x10')]){delete _0xc62672['name'];}_0xe993a0['status'](_0x51e967)['send'](_0xc62672);};}function findById(_0x1cebfa){return function(_0x6e793d){if(!_[_0xc207('0x11')](_0x1cebfa)&&!_[_0xc207('0x11')](_0x6e793d)&&!_['isNil'](_0x6e793d[_0xc207('0x12')])){return _[_0xc207('0x13')](_0x6e793d[_0xc207('0x12')],function(_0x5f288e){return _0x5f288e['id']==_0x1cebfa;});}return null;};}exports[_0xc207('0x14')]=function(_0x488cc0,_0x42c8ba){return respondWithRpcPromise(_0xc207('0x15'),_0x488cc0[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x42c8ba,null))[_0xc207('0x17')](handleError(_0x42c8ba,null));};exports[_0xc207('0x18')]=function(_0x35c0b0,_0x464dea){return respondWithRpcPromise(_0xc207('0x19'),_[_0xc207('0x1a')](_0x35c0b0[_0xc207('0x16')],_0x35c0b0[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x464dea,null))['catch'](handleError(_0x464dea,null));};exports[_0xc207('0x1c')]=function(_0x5cda23,_0x2e89c5){return respondWithRpcPromise(_0xc207('0x1d'),_[_0xc207('0x1a')](_0x5cda23[_0xc207('0x16')],_0x5cda23[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x2e89c5,null))[_0xc207('0x17')](handleError(_0x2e89c5,null));};exports[_0xc207('0x1e')]=function(_0xa52138,_0x2385f7){return respondWithRpcPromise(_0xc207('0x1f'),_0xa52138[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x2385f7,null))[_0xc207('0x17')](handleError(_0x2385f7,null));};exports[_0xc207('0x20')]=function(_0x56a066,_0x1e1440){return respondWithRpcPromise('VoiceQueues',_0x56a066['query'])[_0xc207('0x8')](findById(_0x56a066[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x1e1440,null))[_0xc207('0x17')](handleError(_0x1e1440,null));};exports[_0xc207('0x21')]=function(_0x478af7,_0xe5e848){return respondWithRpcPromise(_0xc207('0x22'),_[_0xc207('0x1a')](_0x478af7[_0xc207('0x23')],_0x478af7[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0xe5e848,null))[_0xc207('0x17')](handleError(_0xe5e848,null));};exports[_0xc207('0x24')]=function(_0xc6a7ce,_0x3f79e8){return respondWithRpcPromise(_0xc207('0x25'),_[_0xc207('0x1a')](_0xc6a7ce[_0xc207('0x16')],_0xc6a7ce['params']))[_0xc207('0x8')](respondWithResult(_0x3f79e8,null))[_0xc207('0x17')](handleError(_0x3f79e8,null));};exports[_0xc207('0x26')]=function(_0x448df1,_0x24df00){return respondWithRpcPromise(_0xc207('0x27'),_0x448df1['query'])[_0xc207('0x8')](respondWithResult(_0x24df00,null))[_0xc207('0x17')](handleError(_0x24df00,null));};exports[_0xc207('0x28')]=function(_0x1d12fa,_0x58e906){return respondWithRpcPromise(_0xc207('0x29'),_[_0xc207('0x1a')](_0x1d12fa[_0xc207('0x16')],_0x1d12fa[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x58e906,null))[_0xc207('0x17')](handleError(_0x58e906,null));};exports[_0xc207('0x2a')]=function(_0x458de9,_0x586776){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x458de9[_0xc207('0x16')],_0x458de9[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x586776,null))[_0xc207('0x17')](handleError(_0x586776,null));};exports['voiceQueuesChannelRedirect']=function(_0x3bfbf4,_0x433c0f){return respondWithRpcPromise(_0xc207('0x2b'),_[_0xc207('0x1a')](_0x3bfbf4[_0xc207('0x16')],_0x3bfbf4['params']))[_0xc207('0x8')](respondWithResult(_0x433c0f,null))[_0xc207('0x17')](handleError(_0x433c0f,null));};exports['outbound']=function(_0x21dd42,_0x49bada){return respondWithRpcPromise(_0xc207('0x2c'),_0x21dd42[_0xc207('0x16')])['then'](respondWithResult(_0x49bada,null))[_0xc207('0x17')](handleError(_0x49bada,null));};exports[_0xc207('0x2d')]=function(_0x3313b1,_0x502dde){return respondWithRpcPromise('OutboundChannels',_0x3313b1[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x502dde,null))[_0xc207('0x17')](handleError(_0x502dde,null));};exports[_0xc207('0x2e')]=function(_0x4c3e29,_0x3a6f45){var _0x47cdc4;return respondWithRpcPromise('Agents',_0x4c3e29['query'])['then'](function(_0x20cb64){_0x47cdc4=_0x20cb64;return respondWithRpcPromise(_0xc207('0x2f'),_0x4c3e29[_0xc207('0x16')],routingClient);})['then'](function(_0x1dd71e){return _[_0xc207('0x1a')]({},_0x1dd71e,_0x47cdc4);})[_0xc207('0x8')](respondWithResult(_0x3a6f45,null))[_0xc207('0x17')](handleError(_0x3a6f45,null));};exports['agentCapacity']=function(_0x47d43a,_0x223349){if(_0x47d43a[_0xc207('0x23')]&&_0x47d43a[_0xc207('0x23')][_0xc207('0x30')]&&_0x47d43a['user']&&_0x47d43a[_0xc207('0x31')][_0xc207('0x10')]){for(var _0x3a935a in _0x47d43a[_0xc207('0x23')][_0xc207('0x30')]){if(_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0xc207('0x32')](_0x3a935a)){db[_0xc207('0x33')]['findAll']({'where':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')][_0xc207('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a]&&_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0xc207('0x34')]?{'$notIn':_0x47d43a['body'][_0xc207('0x30')][_0x3a935a]}:{'$ne':null}}})[_0xc207('0x8')](function(_0x17da25){var _0x5b50cf=moment()[_0xc207('0x35')](_0xc207('0x36'));for(var _0x2967ad=0x0,_0x45536e=_0x17da25['length'];_0x2967ad<_0x45536e;_0x2967ad+=0x1){_0x17da25[_0x2967ad]['updateAttributes']({'exitAt':_0x5b50cf});}});for(var _0x11ce5a=0x0;_0x11ce5a<_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0xc207('0x34')];_0x11ce5a+=0x1){db[_0xc207('0x33')][_0xc207('0x37')]({'where':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')][_0xc207('0x10')],'type':_0xc207('0x38'),'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0x11ce5a],'exitAt':null},'defaults':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')]['name'],'interface':_['isNil'](_0x47d43a[_0xc207('0x31')][_0xc207('0x39')])?util[_0xc207('0x35')]('SIP/%s',_0x47d43a[_0xc207('0x31')][_0xc207('0x10')]):_0x47d43a[_0xc207('0x31')][_0xc207('0x39')],'type':'INTERACTION','enterAt':moment()[_0xc207('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xc207('0x3a'),'internal':_0x47d43a['user']['internal'],'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0x11ce5a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x47d43a['params']['id'],'capacity':_0x47d43a['body'][_0xc207('0x3b')]},routingClient)[_0xc207('0x8')](respondWithResult(_0x223349,null))[_0xc207('0x17')](handleError(_0x223349,null));};exports[_0xc207('0x3c')]=function(_0x173acf,_0x35e967){return respondWithRpcPromise(_0xc207('0x3d'),_0x173acf[_0xc207('0x16')])['then'](respondWithResult(_0x35e967,null))[_0xc207('0x17')](handleError(_0x35e967,null));};exports[_0xc207('0x3e')]=function(_0x5aedd3,_0x55e0c5){return respondWithRpcPromise(_0xc207('0x3f'),_0x5aedd3['query'])['then'](respondWithResult(_0x55e0c5,null))[_0xc207('0x17')](handleError(_0x55e0c5,null));};exports[_0xc207('0x40')]=function(_0x356c8c,_0x3b2448){return respondWithRpcPromise(_0xc207('0x41'),_0x356c8c[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x3b2448,null))[_0xc207('0x17')](handleError(_0x3b2448,null));};exports[_0xc207('0x42')]=function(_0x278717,_0x2fcfee){return respondWithRpcPromise('ChatQueues',_0x278717['query'],routingClient)[_0xc207('0x8')](respondWithResult(_0x2fcfee,null))[_0xc207('0x17')](handleError(_0x2fcfee,null));};exports[_0xc207('0x43')]=function(_0x313580,_0xaff7a0){return respondWithRpcPromise(_0xc207('0x44'),_0x313580[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x313580[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0xaff7a0,null))[_0xc207('0x17')](handleError(_0xaff7a0,null));};exports[_0xc207('0x45')]=function(_0x19637d,_0x6d387e){return respondWithRpcPromise('MailQueues',_0x19637d[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x6d387e,null))[_0xc207('0x17')](handleError(_0x6d387e,null));};exports[_0xc207('0x46')]=function(_0x464263,_0x45ad58){return respondWithRpcPromise(_0xc207('0x47'),_0x464263['query'],routingClient)[_0xc207('0x8')](findById(_0x464263[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x45ad58,null))[_0xc207('0x17')](handleError(_0x45ad58,null));};exports['mailAccounts']=function(_0xc7812,_0x4f4b58){return respondWithRpcPromise('MailAccounts',_0xc7812[_0xc207('0x16')],mailClient)[_0xc207('0x8')](respondWithResult(_0x4f4b58,null))[_0xc207('0x17')](handleError(_0x4f4b58,null));};exports[_0xc207('0x48')]=function(_0x441d5f,_0x3b1b4c){return respondWithRpcPromise(_0xc207('0x49'),_0x441d5f[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x3b1b4c,null))[_0xc207('0x17')](handleError(_0x3b1b4c,null));};exports[_0xc207('0x4a')]=function(_0x2f97bf,_0x416e85){return respondWithRpcPromise(_0xc207('0x49'),_0x2f97bf[_0xc207('0x16')],routingClient)['then'](findById(_0x2f97bf[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x416e85,null))[_0xc207('0x17')](handleError(_0x416e85,null));};exports[_0xc207('0x4b')]=function(_0x2ade23,_0x52dec1){return respondWithRpcPromise('SmsQueues',_0x2ade23[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x52dec1,null))[_0xc207('0x17')](handleError(_0x52dec1,null));};exports['showSmsQueues']=function(_0x31182c,_0x1cefa3){return respondWithRpcPromise(_0xc207('0x4c'),_0x31182c['query'],routingClient)['then'](findById(_0x31182c[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x1cefa3,null))[_0xc207('0x17')](handleError(_0x1cefa3,null));};exports[_0xc207('0x4d')]=function(_0x3cca53,_0x4b197){return respondWithRpcPromise(_0xc207('0x4e'),_0x3cca53[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x4b197,null))[_0xc207('0x17')](handleError(_0x4b197,null));};exports['showWhatsappQueues']=function(_0x289f7c,_0x85ecad){return respondWithRpcPromise(_0xc207('0x4e'),_0x289f7c[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x289f7c[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x85ecad,null))[_0xc207('0x17')](handleError(_0x85ecad,null));};exports[_0xc207('0x4f')]=function(_0x28f467,_0x203686){return respondWithRpcPromise('FaxQueues',_0x28f467[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x203686,null))[_0xc207('0x17')](handleError(_0x203686,null));};exports[_0xc207('0x50')]=function(_0x584a40,_0x586c41){return respondWithRpcPromise(_0xc207('0x51'),_0x584a40[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x584a40[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x586c41,null))[_0xc207('0x17')](handleError(_0x586c41,null));};exports[_0xc207('0x52')]=function(_0x440fc2,_0x5a04d5){return respondWithRpcPromise(_0xc207('0x53'),_0x440fc2[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x5a04d5,null))['catch'](handleError(_0x5a04d5,null));};exports[_0xc207('0x54')]=function(_0x488c1f,_0x1290e4){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x488c1f[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x1290e4,null))['catch'](handleError(_0x1290e4,null));};exports[_0xc207('0x55')]=function(_0x4c0ef0,_0x446fe8){return respondWithRpcPromise(_0xc207('0x56'),_0x4c0ef0[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x446fe8,null))[_0xc207('0x17')](handleError(_0x446fe8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4b9342,_0x3d1659){return respondWithRpcPromise(_0xc207('0x57'),_0x4b9342['query'],routingClient)[_0xc207('0x8')](respondWithResult(_0x3d1659,null))[_0xc207('0x17')](handleError(_0x3d1659,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x10ab93,_0x13954e){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x10ab93[_0xc207('0x16')],routingClient)[_0xc207('0x8')](function(_0x3748de){if(_0x10ab93[_0xc207('0x16')][_0xc207('0x58')]!==undefined){var _0xef037c=_(_0x3748de['rows'])['filter']([_0x10ab93[_0xc207('0x16')][_0xc207('0x58')],_0x10ab93[_0xc207('0x1b')]['id']])[_0xc207('0x59')](_0xc207('0x5a'))['uniq']()[_0xc207('0x5b')]();return _0x3748de['rows'][_0xc207('0x5c')](function(_0x97f43){return _0xef037c[_0xc207('0x5d')](_0x97f43[_0xc207('0x5a')])>-0x1;});}else{return _0x3748de[_0xc207('0x12')][_0xc207('0x5c')](function(_0x49ebe1){return _0x49ebe1[_0xc207('0x5a')]===parseInt(_0x10ab93[_0xc207('0x1b')]['id']);});}})['then'](respondWithResult(_0x13954e,null))[_0xc207('0x17')](handleError(_0x13954e,null));};exports[_0xc207('0x5e')]=function(_0x36e8b1,_0x3cb12d){return respondWithRpcPromise(_0xc207('0x5f'),_0x36e8b1[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x3cb12d,null))[_0xc207('0x17')](handleError(_0x3cb12d,null));};exports[_0xc207('0x60')]=function(_0x281c71,_0x473560){return respondWithRpcPromise(_0xc207('0x61'),_0x281c71[_0xc207('0x16')],routingClient)['then'](respondWithResult(_0x473560,null))[_0xc207('0x17')](handleError(_0x473560,null));};exports[_0xc207('0x62')]=function(_0x2f4efd,_0x266e65){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2f4efd[_0xc207('0x16')],routingClient)['then'](respondWithResult(_0x266e65,null))[_0xc207('0x17')](handleError(_0x266e65,null));};exports['queueNotify']=function(_0x53cb21){return function(_0x2967e6,_0x220293){var _0x383f83,_0x3adfeb;var _0x20089a=_[_0xc207('0x63')](_0x53cb21);var _0x51b775=_0x53cb21===_0xc207('0x64')?'Website':_0xc207('0x65');return db[_0x20089a+_0xc207('0x66')][_0xc207('0x67')]({'raw':!![],'where':{'id':_0x2967e6[_0xc207('0x1b')]['id']}})['then'](function(_0x25731c){if(_[_0xc207('0x11')](_0x25731c)){throw new Error(_0x20089a+'\x20Queue\x20not\x20found');}_0x383f83=_0x25731c;return db[_0x20089a+_0xc207('0x68')][_0xc207('0x67')]({'where':{'id':_0x2967e6[_0xc207('0x23')][_0xc207('0x69')]},'include':[{'model':db[_0x20089a+'Interaction'],'as':_0xc207('0x6a')},{'model':db[_0x20089a+_0x51b775],'as':_0xc207('0x65')}]});})[_0xc207('0x8')](function(_0x297ee0){if(_['isNil'](_0x297ee0)){throw new Error(_0x20089a+'\x20Message\x20not\x20found');}_0x3adfeb=_0x297ee0;return _0x297ee0['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x273b30={'uniqueid':_0x53cb21+'.'+_0x3adfeb['id']+'.'+_0x3adfeb[_0xc207('0x6a')]['id'],'FromUserId':_0x2967e6[_0xc207('0x31')]['id'],'type':_0xc207('0x6b')};_0x273b30[_0x20089a+'MessageId']=_0x3adfeb['id'];_0x273b30[_0x20089a+'InteractionId']=_0x3adfeb[_0xc207('0x6a')]['id'];_0x273b30['From'+_0x20089a+_0x51b775+'Id']=_0x3adfeb['Account']['id'];_0x273b30['To'+_0x20089a+_0xc207('0x6c')]=_0x383f83['id'];return db[_0x20089a+_0xc207('0x6d')][_0xc207('0x6e')](_0x273b30);})[_0xc207('0x8')](function(){return respondWithRpcPromise(_0xc207('0x6f'),{'channel':_0x53cb21,'interaction':_0x3adfeb['Interaction'],'message':_0x3adfeb,'account':_0x3adfeb[_0xc207('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x383f83[_0xc207('0x10')]+','+(_0x3adfeb[_0xc207('0x65')][_0xc207('0x70')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x220293,null))[_0xc207('0x17')](handleError(_0x220293,null));};};exports[_0xc207('0x71')]=function(_0x1841a4,_0x7d4f9c){var _0x4e5b1c,_0x4d05e5;if(_[_0xc207('0x11')](_0x1841a4['body'][_0xc207('0x72')])){throw new Error(_0xc207('0x73'));}var _0x211884=_0x1841a4[_0xc207('0x23')][_0xc207('0x72')];var _0x5a7bc9=_[_0xc207('0x63')](_0x211884);var _0x328016=_0x211884===_0xc207('0x64')?_0xc207('0x74'):_0xc207('0x65');return db[_0xc207('0x75')][_0xc207('0x67')]({'raw':!![],'where':{'id':_0x1841a4[_0xc207('0x1b')]['id'],'role':_0xc207('0x3a')}})[_0xc207('0x8')](function(_0x48213b){if(_[_0xc207('0x11')](_0x48213b)){throw new Error('Agent\x20not\x20found');}_0x4e5b1c=_0x48213b;return db[_0x5a7bc9+'Message'][_0xc207('0x67')]({'where':{'id':_0x1841a4[_0xc207('0x23')]['messageId']},'include':[{'model':db[_0x5a7bc9+'Interaction'],'as':_0xc207('0x6a')},{'model':db[_0x5a7bc9+_0x328016],'as':_0xc207('0x65')}]});})[_0xc207('0x8')](function(_0x41b655){if(_['isNil'](_0x41b655)){throw new Error(_0x5a7bc9+_0xc207('0x76'));}_0x4d05e5=_0x41b655;return _0x41b655['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xc207('0x8')](function(){var _0x1c7886={'uniqueid':_0x211884+'.'+_0x4d05e5['id']+'.'+_0x4d05e5[_0xc207('0x6a')]['id'],'FromUserId':_0x1841a4[_0xc207('0x31')]['id'],'type':_0xc207('0x6b'),'ToUserId':_0x4e5b1c['id']};_0x1c7886[_0x5a7bc9+_0xc207('0x77')]=_0x4d05e5['id'];_0x1c7886[_0x5a7bc9+'InteractionId']=_0x4d05e5[_0xc207('0x6a')]['id'];_0x1c7886[_0xc207('0x78')+_0x5a7bc9+_0x328016+'Id']=_0x4d05e5['Account']['id'];return db[_0x5a7bc9+'TransferReport']['create'](_0x1c7886);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x211884,'interaction':_0x4d05e5[_0xc207('0x6a')],'message':_0x4d05e5,'account':_0x4d05e5[_0xc207('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xc207('0x3a'),'appdata':_0x4e5b1c['name']+','+(_0x4d05e5[_0xc207('0x65')]['agentTransferTimeout']||0x12c),'interval':_0xc207('0x79')}]},routingClient);})[_0xc207('0x8')](respondWithResult(_0x7d4f9c,null))[_0xc207('0x17')](handleError(_0x7d4f9c,null));}; \ No newline at end of file +var _0xeff8=['error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','format','length','updateAttributes','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','messageId','update','InteractionId','create','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xeff8,0x186));var _0x8eff=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xeff8[_0x3f4891];return _0x54f2d8;};'use strict';var BPromise=require(_0x8eff('0x0'));var moment=require(_0x8eff('0x1'));var _=require('lodash');var util=require(_0x8eff('0x2'));var db=require(_0x8eff('0x3'))['db'];var logger=require(_0x8eff('0x4'))('api');var jayson=require(_0x8eff('0x5'));var amiClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232a});var mailClient=jayson[_0x8eff('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){var _0x17f22b=_0x491f01?_0x491f01:amiClient;return _0x17f22b[_0x8eff('0x8')](_0x3409bc,_0x323b2)['then'](function(_0x56f120){if(_0x56f120[_0x8eff('0x9')]){if(_0x56f120[_0x8eff('0x9')][_0x8eff('0xa')]===0x1f4){return _0x19557f(_0x56f120['error'][_0x8eff('0xb')]);}return _0x3fb9ee(_0x56f120[_0x8eff('0x9')]['message']);}else{_0x3fb9ee(_0x56f120[_0x8eff('0xc')]);}})[_0x8eff('0xd')](function(_0x559143){_0x19557f(_0x559143);});});}function respondWithResult(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xc8;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0xe')](_0x45f280)[_0x8eff('0xf')](_0x43c914);}return _0x4a399e[_0x8eff('0x10')](0x194);};}function handleError(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0x1f4;return function(_0x212a2e){logger[_0x8eff('0x9')](_0x212a2e[_0x8eff('0x11')]);if(_0x212a2e[_0x8eff('0x12')]){delete _0x212a2e[_0x8eff('0x12')];}_0x56efdf[_0x8eff('0xe')](_0x3e7c01)[_0x8eff('0x13')](_0x212a2e);};}function findById(_0x16a4eb){return function(_0x427902){if(!_[_0x8eff('0x14')](_0x16a4eb)&&!_['isNil'](_0x427902)&&!_[_0x8eff('0x14')](_0x427902[_0x8eff('0x15')])){return _[_0x8eff('0x16')](_0x427902[_0x8eff('0x15')],function(_0x2cd7c5){return _0x2cd7c5['id']==_0x16a4eb;});}return null;};}exports[_0x8eff('0x17')]=function(_0x38f5ee,_0x399d96){return respondWithRpcPromise(_0x8eff('0x18'),_0x38f5ee[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x399d96,null))[_0x8eff('0xd')](handleError(_0x399d96,null));};exports[_0x8eff('0x1b')]=function(_0x2a7337,_0xdbb7b5){return respondWithRpcPromise(_0x8eff('0x1c'),_['merge'](_0x2a7337[_0x8eff('0x19')],_0x2a7337[_0x8eff('0x1d')]))['then'](respondWithResult(_0xdbb7b5,null))[_0x8eff('0xd')](handleError(_0xdbb7b5,null));};exports['voiceChannelStopMixMonitor']=function(_0x2fe360,_0x23c030){return respondWithRpcPromise(_0x8eff('0x1e'),_[_0x8eff('0x1f')](_0x2fe360[_0x8eff('0x19')],_0x2fe360['params']))[_0x8eff('0x1a')](respondWithResult(_0x23c030,null))[_0x8eff('0xd')](handleError(_0x23c030,null));};exports['voiceQueues']=function(_0x15b66f,_0x5ec3d7){return respondWithRpcPromise(_0x8eff('0x20'),_0x15b66f[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x5ec3d7,null))[_0x8eff('0xd')](handleError(_0x5ec3d7,null));};exports[_0x8eff('0x21')]=function(_0x2e8067,_0x516173){return respondWithRpcPromise(_0x8eff('0x20'),_0x2e8067[_0x8eff('0x19')])[_0x8eff('0x1a')](findById(_0x2e8067[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x516173,null))[_0x8eff('0xd')](handleError(_0x516173,null));};exports['updateVoiceQueue']=function(_0x4ed3b8,_0x44dcdb){return respondWithRpcPromise(_0x8eff('0x22'),_[_0x8eff('0x1f')](_0x4ed3b8['body'],_0x4ed3b8[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x44dcdb,null))[_0x8eff('0xd')](handleError(_0x44dcdb,null));};exports[_0x8eff('0x23')]=function(_0x25b98e,_0x2c5727){return respondWithRpcPromise(_0x8eff('0x24'),_[_0x8eff('0x1f')](_0x25b98e[_0x8eff('0x19')],_0x25b98e[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x2c5727,null))[_0x8eff('0xd')](handleError(_0x2c5727,null));};exports['voiceQueuesChannels']=function(_0x2ad4b7,_0x165f8e){return respondWithRpcPromise(_0x8eff('0x25'),_0x2ad4b7[_0x8eff('0x19')])['then'](respondWithResult(_0x165f8e,null))[_0x8eff('0xd')](handleError(_0x165f8e,null));};exports[_0x8eff('0x26')]=function(_0x4c4220,_0x4e1256){return respondWithRpcPromise(_0x8eff('0x27'),_[_0x8eff('0x1f')](_0x4c4220['query'],_0x4c4220['params']))['then'](respondWithResult(_0x4e1256,null))[_0x8eff('0xd')](handleError(_0x4e1256,null));};exports['voiceQueuesChannelHangup']=function(_0x45d9d4,_0x59c9cc){return respondWithRpcPromise(_0x8eff('0x28'),_[_0x8eff('0x1f')](_0x45d9d4[_0x8eff('0x19')],_0x45d9d4[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x59c9cc,null))[_0x8eff('0xd')](handleError(_0x59c9cc,null));};exports['voiceQueuesChannelRedirect']=function(_0xd95908,_0x5907e0){return respondWithRpcPromise(_0x8eff('0x29'),_['merge'](_0xd95908[_0x8eff('0x19')],_0xd95908[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x5907e0,null))[_0x8eff('0xd')](handleError(_0x5907e0,null));};exports['outbound']=function(_0x2eb4bb,_0x170a33){return respondWithRpcPromise(_0x8eff('0x2a'),_0x2eb4bb['query'])[_0x8eff('0x1a')](respondWithResult(_0x170a33,null))[_0x8eff('0xd')](handleError(_0x170a33,null));};exports[_0x8eff('0x2b')]=function(_0x345bc7,_0x721c71){return respondWithRpcPromise(_0x8eff('0x2c'),_0x345bc7[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x721c71,null))[_0x8eff('0xd')](handleError(_0x721c71,null));};exports['agents']=function(_0x54a2d9,_0xf67cf3){var _0x114f8e;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9[_0x8eff('0x19')])[_0x8eff('0x1a')](function(_0x1ba78a){_0x114f8e=_0x1ba78a;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9['query'],routingClient);})[_0x8eff('0x1a')](function(_0x1c7332){return _['merge']({},_0x1c7332,_0x114f8e);})[_0x8eff('0x1a')](respondWithResult(_0xf67cf3,null))[_0x8eff('0xd')](handleError(_0xf67cf3,null));};exports[_0x8eff('0x2e')]=function(_0x18309b,_0xdc5e2f){if(_0x18309b[_0x8eff('0x2f')]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]&&_0x18309b[_0x8eff('0x31')]&&_0x18309b['user'][_0x8eff('0x12')]){for(var _0x27a8c9 in _0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]){if(_0x18309b[_0x8eff('0x2f')]['interaction'][_0x8eff('0x32')](_0x27a8c9)){db['MemberReport'][_0x8eff('0x33')]({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'exitAt':null,'uniqueid':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9]['length']?{'$notIn':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]}:{'$ne':null}}})[_0x8eff('0x1a')](function(_0x3bf913){var _0x22f173=moment()[_0x8eff('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x28cb8e=0x0,_0x51aa5d=_0x3bf913[_0x8eff('0x36')];_0x28cb8e<_0x51aa5d;_0x28cb8e+=0x1){_0x3bf913[_0x28cb8e][_0x8eff('0x37')]({'exitAt':_0x22f173});}});for(var _0x577a2b=0x0;_0x577a2b<_0x18309b['body']['interaction'][_0x27a8c9]['length'];_0x577a2b+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b],'exitAt':null},'defaults':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'interface':_[_0x8eff('0x14')](_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')])?util['format'](_0x8eff('0x39'),_0x18309b['user'][_0x8eff('0x12')]):_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')],'type':_0x8eff('0x34'),'enterAt':moment()[_0x8eff('0x35')](_0x8eff('0x3a')),'role':_0x8eff('0x3b'),'internal':_0x18309b[_0x8eff('0x31')][_0x8eff('0x3c')],'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b]}});}}}}return respondWithRpcPromise(_0x8eff('0x3d'),{'id':_0x18309b['params']['id'],'capacity':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x3e')]},routingClient)[_0x8eff('0x1a')](respondWithResult(_0xdc5e2f,null))[_0x8eff('0xd')](handleError(_0xdc5e2f,null));};exports[_0x8eff('0x3f')]=function(_0x2de7fd,_0x16473d){return respondWithRpcPromise(_0x8eff('0x40'),_0x2de7fd[_0x8eff('0x19')])['then'](respondWithResult(_0x16473d,null))['catch'](handleError(_0x16473d,null));};exports[_0x8eff('0x41')]=function(_0x36e2fd,_0x430f5e){return respondWithRpcPromise(_0x8eff('0x42'),_0x36e2fd[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x430f5e,null))['catch'](handleError(_0x430f5e,null));};exports[_0x8eff('0x43')]=function(_0x1ca203,_0x1d0a8e){return respondWithRpcPromise('Campaigns',_0x1ca203[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x1d0a8e,null))[_0x8eff('0xd')](handleError(_0x1d0a8e,null));};exports[_0x8eff('0x44')]=function(_0x549e88,_0x40de1d){return respondWithRpcPromise(_0x8eff('0x45'),_0x549e88[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x40de1d,null))[_0x8eff('0xd')](handleError(_0x40de1d,null));};exports[_0x8eff('0x46')]=function(_0x3f646d,_0x575b0e){return respondWithRpcPromise(_0x8eff('0x45'),_0x3f646d[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x3f646d[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x575b0e,null))['catch'](handleError(_0x575b0e,null));};exports[_0x8eff('0x47')]=function(_0x16b968,_0x5d79b){return respondWithRpcPromise('MailQueues',_0x16b968[_0x8eff('0x19')],routingClient)['then'](respondWithResult(_0x5d79b,null))[_0x8eff('0xd')](handleError(_0x5d79b,null));};exports[_0x8eff('0x48')]=function(_0x23ed92,_0xfecdd8){return respondWithRpcPromise(_0x8eff('0x49'),_0x23ed92[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x23ed92['params']['id']))['then'](respondWithResult(_0xfecdd8,null))[_0x8eff('0xd')](handleError(_0xfecdd8,null));};exports['mailAccounts']=function(_0x3bfeac,_0x375ed3){return respondWithRpcPromise(_0x8eff('0x4a'),_0x3bfeac[_0x8eff('0x19')],mailClient)[_0x8eff('0x1a')](respondWithResult(_0x375ed3,null))['catch'](handleError(_0x375ed3,null));};exports[_0x8eff('0x4b')]=function(_0x36afc3,_0x1813df){return respondWithRpcPromise(_0x8eff('0x4c'),_0x36afc3[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1813df,null))['catch'](handleError(_0x1813df,null));};exports[_0x8eff('0x4d')]=function(_0x5c0ea3,_0x2e45c2){return respondWithRpcPromise(_0x8eff('0x4c'),_0x5c0ea3['query'],routingClient)[_0x8eff('0x1a')](findById(_0x5c0ea3[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x2e45c2,null))[_0x8eff('0xd')](handleError(_0x2e45c2,null));};exports[_0x8eff('0x4e')]=function(_0x35467c,_0xabdd84){return respondWithRpcPromise(_0x8eff('0x4f'),_0x35467c['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xabdd84,null))['catch'](handleError(_0xabdd84,null));};exports['showSmsQueues']=function(_0x1a748f,_0x47626e){return respondWithRpcPromise('SmsQueues',_0x1a748f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x1a748f['params']['id']))[_0x8eff('0x1a')](respondWithResult(_0x47626e,null))[_0x8eff('0xd')](handleError(_0x47626e,null));};exports['whatsappQueues']=function(_0xc70ecc,_0x1c6ee1){return respondWithRpcPromise(_0x8eff('0x50'),_0xc70ecc[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1c6ee1,null))[_0x8eff('0xd')](handleError(_0x1c6ee1,null));};exports[_0x8eff('0x51')]=function(_0x58c9e6,_0x479a4b){return respondWithRpcPromise(_0x8eff('0x50'),_0x58c9e6[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x58c9e6[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x479a4b,null))[_0x8eff('0xd')](handleError(_0x479a4b,null));};exports[_0x8eff('0x52')]=function(_0x4f1c54,_0x593a18){return respondWithRpcPromise(_0x8eff('0x53'),_0x4f1c54['query'],routingClient)['then'](respondWithResult(_0x593a18,null))['catch'](handleError(_0x593a18,null));};exports[_0x8eff('0x54')]=function(_0x436db2,_0x461026){return respondWithRpcPromise(_0x8eff('0x53'),_0x436db2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x436db2[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x461026,null))['catch'](handleError(_0x461026,null));};exports[_0x8eff('0x55')]=function(_0x5492df,_0x42efc6){return respondWithRpcPromise(_0x8eff('0x56'),_0x5492df[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x42efc6,null))[_0x8eff('0xd')](handleError(_0x42efc6,null));};exports[_0x8eff('0x57')]=function(_0x570728,_0x3db0d8){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x570728[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x3db0d8,null))[_0x8eff('0xd')](handleError(_0x3db0d8,null));};exports[_0x8eff('0x58')]=function(_0x41d7e2,_0x2f30cb){return respondWithRpcPromise(_0x8eff('0x59'),_0x41d7e2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x2f30cb,null))['catch'](handleError(_0x2f30cb,null));};exports[_0x8eff('0x5a')]=function(_0x73b49f,_0x1299b5){return respondWithRpcPromise(_0x8eff('0x5b'),_0x73b49f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1299b5,null))[_0x8eff('0xd')](handleError(_0x1299b5,null));};exports[_0x8eff('0x5c')]=function(_0x3350b8,_0x123673){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3350b8['query'],routingClient)['then'](function(_0x5f3443){if(_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')]!==undefined){var _0x2a15ba=_(_0x5f3443[_0x8eff('0x15')])[_0x8eff('0x5e')]([_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')],_0x3350b8['params']['id']])[_0x8eff('0x5f')](_0x8eff('0x60'))[_0x8eff('0x61')]()[_0x8eff('0x62')]();return _0x5f3443['rows'][_0x8eff('0x5e')](function(_0x34ca22){return _0x2a15ba['indexOf'](_0x34ca22[_0x8eff('0x60')])>-0x1;});}else{return _0x5f3443[_0x8eff('0x15')][_0x8eff('0x5e')](function(_0x47e24f){return _0x47e24f['queue_id']===parseInt(_0x3350b8['params']['id']);});}})[_0x8eff('0x1a')](respondWithResult(_0x123673,null))[_0x8eff('0xd')](handleError(_0x123673,null));};exports[_0x8eff('0x63')]=function(_0x168465,_0xaca1b5){return respondWithRpcPromise(_0x8eff('0x64'),_0x168465[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xaca1b5,null))[_0x8eff('0xd')](handleError(_0xaca1b5,null));};exports[_0x8eff('0x65')]=function(_0x4272e8,_0x5c8a83){return respondWithRpcPromise(_0x8eff('0x66'),_0x4272e8['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x5c8a83,null))[_0x8eff('0xd')](handleError(_0x5c8a83,null));};exports['faxQueuesWaitingInteractions']=function(_0x9c448b,_0x536b6f){return respondWithRpcPromise(_0x8eff('0x67'),_0x9c448b[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x536b6f,null))[_0x8eff('0xd')](handleError(_0x536b6f,null));};exports[_0x8eff('0x68')]=function(_0x4a4603){return function(_0x842ad7,_0x56fd7d){var _0xd5edc5,_0x19768b;var _0x30c321=_[_0x8eff('0x69')](_0x4a4603);var _0x52be06=_0x4a4603===_0x8eff('0x6a')?_0x8eff('0x6b'):_0x8eff('0x6c');return db[_0x30c321+_0x8eff('0x6d')]['findOne']({'raw':!![],'where':{'id':_0x842ad7[_0x8eff('0x1d')]['id']}})[_0x8eff('0x1a')](function(_0x10e26f){if(_[_0x8eff('0x14')](_0x10e26f)){throw new Error(_0x30c321+_0x8eff('0x6e'));}_0xd5edc5=_0x10e26f;return db[_0x30c321+'Message'][_0x8eff('0x6f')]({'where':{'id':_0x842ad7[_0x8eff('0x2f')]['messageId']},'include':[{'model':db[_0x30c321+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x30c321+_0x52be06],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0xe31924){if(_[_0x8eff('0x14')](_0xe31924)){throw new Error(_0x30c321+_0x8eff('0x71'));}_0x19768b=_0xe31924;return _0xe31924['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x522e5f={'uniqueid':_0x4a4603+'.'+_0x19768b['id']+'.'+_0x19768b[_0x8eff('0x70')]['id'],'FromUserId':_0x842ad7[_0x8eff('0x31')]['id'],'type':'queue'};_0x522e5f[_0x30c321+_0x8eff('0x72')]=_0x19768b['id'];_0x522e5f[_0x30c321+'InteractionId']=_0x19768b['Interaction']['id'];_0x522e5f[_0x8eff('0x73')+_0x30c321+_0x52be06+'Id']=_0x19768b['Account']['id'];_0x522e5f['To'+_0x30c321+_0x8eff('0x74')]=_0xd5edc5['id'];return db[_0x30c321+_0x8eff('0x75')]['create'](_0x522e5f);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x4a4603,'interaction':_0x19768b['Interaction'],'message':_0x19768b,'account':_0x19768b[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x77'),'appdata':_0xd5edc5[_0x8eff('0x12')]+','+(_0x19768b[_0x8eff('0x6c')][_0x8eff('0x78')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x56fd7d,null))[_0x8eff('0xd')](handleError(_0x56fd7d,null));};};exports[_0x8eff('0x7a')]=function(_0x4aa16e,_0x4f7209){var _0x4c9436,_0x338269;if(_[_0x8eff('0x14')](_0x4aa16e[_0x8eff('0x2f')]['channel'])){throw new Error(_0x8eff('0x7b'));}var _0x35cf4c=_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x7c')];var _0x2c9646=_[_0x8eff('0x69')](_0x35cf4c);var _0x5ee248=_0x35cf4c===_0x8eff('0x6a')?'Website':_0x8eff('0x6c');return db[_0x8eff('0x7d')][_0x8eff('0x6f')]({'raw':!![],'where':{'id':_0x4aa16e[_0x8eff('0x1d')]['id'],'role':_0x8eff('0x3b')}})[_0x8eff('0x1a')](function(_0x476701){if(_['isNil'](_0x476701)){throw new Error(_0x8eff('0x7e'));}_0x4c9436=_0x476701;return db[_0x2c9646+_0x8eff('0x7f')][_0x8eff('0x6f')]({'where':{'id':_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x80')]},'include':[{'model':db[_0x2c9646+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x2c9646+_0x5ee248],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0x488a69){if(_['isNil'](_0x488a69)){throw new Error(_0x2c9646+_0x8eff('0x71'));}_0x338269=_0x488a69;return _0x488a69[_0x8eff('0x81')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x58db46={'uniqueid':_0x35cf4c+'.'+_0x338269['id']+'.'+_0x338269[_0x8eff('0x70')]['id'],'FromUserId':_0x4aa16e['user']['id'],'type':'queue','ToUserId':_0x4c9436['id']};_0x58db46[_0x2c9646+_0x8eff('0x72')]=_0x338269['id'];_0x58db46[_0x2c9646+_0x8eff('0x82')]=_0x338269[_0x8eff('0x70')]['id'];_0x58db46[_0x8eff('0x73')+_0x2c9646+_0x5ee248+'Id']=_0x338269[_0x8eff('0x6c')]['id'];return db[_0x2c9646+_0x8eff('0x75')][_0x8eff('0x83')](_0x58db46);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x35cf4c,'interaction':_0x338269[_0x8eff('0x70')],'message':_0x338269,'account':_0x338269[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x3b'),'appdata':_0x4c9436['name']+','+(_0x338269[_0x8eff('0x6c')][_0x8eff('0x84')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x4f7209,null))[_0x8eff('0xd')](handleError(_0x4f7209,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 238c588..10dad95 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 _0x7cdd=['fs-extra','../../config/environment','./schedule.controller','get','index','/:id','show','/:id/run','run','post','isAuthenticated','create','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x15f852,_0x530d85){var _0x387460=function(_0x4aa3df){while(--_0x4aa3df){_0x15f852['push'](_0x15f852['shift']());}};_0x387460(++_0x530d85);}(_0x7cdd,0x164));var _0xd7cd=function(_0x2b1f35,_0xc9169f){_0x2b1f35=_0x2b1f35-0x0;var _0x22d6f5=_0x7cdd[_0x2b1f35];return _0x22d6f5;};'use strict';var multer=require(_0xd7cd('0x0'));var util=require(_0xd7cd('0x1'));var path=require(_0xd7cd('0x2'));var timeout=require(_0xd7cd('0x3'));var express=require(_0xd7cd('0x4'));var router=express['Router']();var fs_extra=require(_0xd7cd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd7cd('0x6'));var controller=require(_0xd7cd('0x7'));router[_0xd7cd('0x8')]('/',auth['isAuthenticated'](),controller[_0xd7cd('0x9')]);router[_0xd7cd('0x8')](_0xd7cd('0xa'),auth['isAuthenticated'](),controller[_0xd7cd('0xb')]);router[_0xd7cd('0x8')](_0xd7cd('0xc'),auth['isAuthenticated'](),controller[_0xd7cd('0xd')]);router[_0xd7cd('0xe')]('/',auth[_0xd7cd('0xf')](),controller[_0xd7cd('0x10')]);router['put'](_0xd7cd('0xa'),auth[_0xd7cd('0xf')](),controller['update']);router[_0xd7cd('0x11')](_0xd7cd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd7cd('0x12')]=router; \ No newline at end of file +var _0x60ee=['run','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','get','index','isAuthenticated','show','/:id/run'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x60ee,0x75));var _0xe60e=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x60ee[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0xe60e('0x0'));var util=require(_0xe60e('0x1'));var path=require('path');var timeout=require(_0xe60e('0x2'));var express=require(_0xe60e('0x3'));var router=express[_0xe60e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe60e('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xe60e('0x6')]('/',auth['isAuthenticated'](),controller[_0xe60e('0x7')]);router['get']('/:id',auth[_0xe60e('0x8')](),controller[_0xe60e('0x9')]);router[_0xe60e('0x6')](_0xe60e('0xa'),auth[_0xe60e('0x8')](),controller[_0xe60e('0xb')]);router['post']('/',auth[_0xe60e('0x8')](),controller['create']);router['put'](_0xe60e('0xc'),auth[_0xe60e('0x8')](),controller[_0xe60e('0xd')]);router[_0xe60e('0xe')](_0xe60e('0xc'),auth[_0xe60e('0x8')](),controller[_0xe60e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b897dcb..0faef66 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 _0xcd43=['csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','months','days','minutes','pdf','xlsx'];(function(_0x555b03,_0x354313){var _0x39aea3=function(_0x1a5a02){while(--_0x1a5a02){_0x555b03['push'](_0x555b03['shift']());}};_0x39aea3(++_0x354313);}(_0xcd43,0x1c3));var _0x3cd4=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xcd43[_0x367361];return _0x195d2d;};'use strict';var Sequelize=require(_0x3cd4('0x0'));module[_0x3cd4('0x1')]={'name':{'type':Sequelize[_0x3cd4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3cd4('0x2')]},'active':{'type':Sequelize[_0x3cd4('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3cd4('0x4')},'startAt':{'type':Sequelize[_0x3cd4('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3cd4('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3cd4('0x6')]('years',_0x3cd4('0x7'),_0x3cd4('0x8'),'weeks',_0x3cd4('0x9'),'hours',_0x3cd4('0xa')),'allowNull':![],'defaultValue':_0x3cd4('0x9')},'output':{'type':Sequelize[_0x3cd4('0x6')]('csv',_0x3cd4('0xb'),_0x3cd4('0xc')),'allowNull':![],'defaultValue':_0x3cd4('0xd')},'type':{'type':Sequelize[_0x3cd4('0x6')]('custom','default'),'allowNull':![],'defaultValue':_0x3cd4('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x3cd4('0x2')]},'cc':{'type':Sequelize[_0x3cd4('0xf')]},'bcc':{'type':Sequelize[_0x3cd4('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x3cd4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x357b=['days','csv','pdf','default','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','hours','minutes'];(function(_0x5a0824,_0x402173){var _0xf9f1dd=function(_0x44027c){while(--_0x44027c){_0x5a0824['push'](_0x5a0824['shift']());}};_0xf9f1dd(++_0x402173);}(_0x357b,0xeb));var _0xb357=function(_0x256f9b,_0x503fbc){_0x256f9b=_0x256f9b-0x0;var _0x3f5c47=_0x357b[_0x256f9b];return _0x3f5c47;};'use strict';var Sequelize=require(_0xb357('0x0'));module[_0xb357('0x1')]={'name':{'type':Sequelize[_0xb357('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb357('0x2')],'allowNull':![],'defaultValue':_0xb357('0x3')},'startAt':{'type':Sequelize[_0xb357('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb357('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb357('0x6')](_0xb357('0x7'),_0xb357('0x8'),'months',_0xb357('0x9'),'days',_0xb357('0xa'),_0xb357('0xb')),'allowNull':![],'defaultValue':_0xb357('0xc')},'output':{'type':Sequelize['ENUM'](_0xb357('0xd'),_0xb357('0xe'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom',_0xb357('0xf')),'allowNull':![],'defaultValue':_0xb357('0x10')},'sendMail':{'type':Sequelize[_0xb357('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xb357('0x2')]},'cc':{'type':Sequelize[_0xb357('0x12')]},'bcc':{'type':Sequelize[_0xb357('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 9d59e9d..4a55b8d 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 _0x98c2=['status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','error','stack','name','send','index','map','Schedule','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','length','include','find','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','run','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x98c2,0x1db));var _0x298c=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x98c2[_0x1e3c16];return _0x47a0c9;};'use strict';var emlformat=require(_0x298c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x298c('0x1'));var jsonpatch=require(_0x298c('0x2'));var rp=require(_0x298c('0x3'));var moment=require('moment');var BPromise=require(_0x298c('0x4'));var Mustache=require(_0x298c('0x5'));var util=require('util');var path=require(_0x298c('0x6'));var sox=require(_0x298c('0x7'));var csv=require(_0x298c('0x8'));var ejs=require(_0x298c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x298c('0xa'));var jsforce=require(_0x298c('0xb'));var deskjs=require(_0x298c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x298c('0xd'));var Papa=require(_0x298c('0xe'));var Redis=require('ioredis');var authService=require(_0x298c('0xf'));var qs=require(_0x298c('0x10'));var as=require(_0x298c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x298c('0x12'))('api');var utils=require(_0x298c('0x13'));var config=require(_0x298c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13ed99,_0x1d7216){_0x1d7216=_0x1d7216||0xcc;return function(_0x4d0c70){if(_0x4d0c70){return _0x13ed99[_0x298c('0x15')](_0x1d7216);}return _0x13ed99['status'](_0x1d7216)[_0x298c('0x16')]();};}function respondWithResult(_0x452a98,_0x531c0e){_0x531c0e=_0x531c0e||0xc8;return function(_0x6389df){if(_0x6389df){return _0x452a98[_0x298c('0x17')](_0x531c0e)[_0x298c('0x18')](_0x6389df);}};}function respondWithFilteredResult(_0x4f29c6,_0x2d92ad){return function(_0x100bc1){if(_0x100bc1){var _0x379db4=typeof _0x2d92ad['offset']===_0x298c('0x19')&&typeof _0x2d92ad['limit']==='undefined';var _0x2d308e=_0x100bc1['count'];var _0x361ab8=_0x379db4?0x0:_0x2d92ad[_0x298c('0x1a')];var _0x2b7404=_0x379db4?_0x100bc1[_0x298c('0x1b')]:_0x2d92ad[_0x298c('0x1a')]+_0x2d92ad[_0x298c('0x1c')];var _0x1f1783;if(_0x2b7404>=_0x2d308e){_0x2b7404=_0x2d308e;_0x1f1783=0xc8;}else{_0x1f1783=0xce;}_0x4f29c6[_0x298c('0x17')](_0x1f1783);return _0x4f29c6[_0x298c('0x1d')](_0x298c('0x1e'),_0x361ab8+'-'+_0x2b7404+'/'+_0x2d308e)[_0x298c('0x18')](_0x100bc1);}return null;};}function patchUpdates(_0x18c109){return function(_0x72ccbc){try{jsonpatch[_0x298c('0x1f')](_0x72ccbc,_0x18c109,!![]);}catch(_0x452081){return BPromise[_0x298c('0x20')](_0x452081);}return _0x72ccbc[_0x298c('0x21')]();};}function saveUpdates(_0x2713f7,_0x1ad066){return function(_0x3557a7){if(_0x3557a7){return _0x3557a7[_0x298c('0x22')](_0x2713f7)[_0x298c('0x23')](function(_0xea7c7e){return _0xea7c7e;});}return null;};}function removeEntity(_0x25672c,_0x16d39a){return function(_0x22df93){if(_0x22df93){return _0x22df93[_0x298c('0x24')]()[_0x298c('0x23')](function(){var _0x1674ae=_0x22df93[_0x298c('0x25')]({'plain':!![]});var _0x5dae4c=_0x298c('0x26');return db['UserProfileResource'][_0x298c('0x24')]({'where':{'type':_0x5dae4c,'resourceId':_0x1674ae['id']}})[_0x298c('0x23')](function(){return _0x22df93;});})['then'](function(){_0x25672c[_0x298c('0x17')](0xcc)[_0x298c('0x16')]();});}};}function handleEntityNotFound(_0x2c48b8,_0x516235){return function(_0x385ada){if(!_0x385ada){_0x2c48b8['sendStatus'](0x194);}return _0x385ada;};}function handleError(_0x5b3f0c,_0x469918){_0x469918=_0x469918||0x1f4;return function(_0x3a9c24){logger[_0x298c('0x27')](_0x3a9c24[_0x298c('0x28')]);if(_0x3a9c24[_0x298c('0x29')]){delete _0x3a9c24[_0x298c('0x29')];}_0x5b3f0c[_0x298c('0x17')](_0x469918)[_0x298c('0x2a')](_0x3a9c24);};}exports[_0x298c('0x2b')]=function(_0x25dda1,_0x43cc72){var _0x6036d7={},_0x1e7b34={},_0x1afa80={'count':0x0,'rows':[]};var _0x474a60=_[_0x298c('0x2c')](db[_0x298c('0x2d')][_0x298c('0x2e')],function(_0x27782f){return{'name':_0x27782f['fieldName'],'type':_0x27782f[_0x298c('0x2f')][_0x298c('0x30')]};});_0x1e7b34['model']=_[_0x298c('0x2c')](_0x474a60,'name');_0x1e7b34[_0x298c('0x31')]=_[_0x298c('0x32')](_0x25dda1[_0x298c('0x31')]);_0x1e7b34['filters']=_[_0x298c('0x33')](_0x1e7b34[_0x298c('0x34')],_0x1e7b34[_0x298c('0x31')]);_0x6036d7[_0x298c('0x35')]=_['intersection'](_0x1e7b34[_0x298c('0x34')],qs[_0x298c('0x36')](_0x25dda1[_0x298c('0x31')][_0x298c('0x36')]));_0x6036d7[_0x298c('0x35')]=_0x6036d7['attributes']['length']?_0x6036d7['attributes']:_0x1e7b34[_0x298c('0x34')];if(!_0x25dda1[_0x298c('0x31')][_0x298c('0x37')](_0x298c('0x38'))){_0x6036d7[_0x298c('0x1c')]=qs[_0x298c('0x1c')](_0x25dda1[_0x298c('0x31')][_0x298c('0x1c')]);_0x6036d7[_0x298c('0x1a')]=qs[_0x298c('0x1a')](_0x25dda1['query'][_0x298c('0x1a')]);}_0x6036d7[_0x298c('0x39')]=qs['sort'](_0x25dda1[_0x298c('0x31')][_0x298c('0x3a')]);_0x6036d7[_0x298c('0x3b')]=qs[_0x298c('0x3c')](_['pick'](_0x25dda1[_0x298c('0x31')],_0x1e7b34['filters']),_0x474a60);if(_0x25dda1[_0x298c('0x31')][_0x298c('0x3d')]){_0x6036d7[_0x298c('0x3b')]=_[_0x298c('0x3e')](_0x6036d7[_0x298c('0x3b')],{'$or':_['map'](_0x474a60,function(_0x41e326){if(_0x41e326[_0x298c('0x2f')]!==_0x298c('0x3f')){var _0x1e2cf6={};_0x1e2cf6[_0x41e326['name']]={'$like':'%'+_0x25dda1[_0x298c('0x31')][_0x298c('0x3d')]+'%'};return _0x1e2cf6;}})});}_0x6036d7=_['merge']({},_0x6036d7,_0x25dda1[_0x298c('0x40')]);var _0x154fc0={'where':_0x6036d7[_0x298c('0x3b')]};return db[_0x298c('0x2d')]['count'](_0x154fc0)[_0x298c('0x23')](function(_0x58a3dd){_0x1afa80[_0x298c('0x1b')]=_0x58a3dd;if(_0x25dda1[_0x298c('0x31')][_0x298c('0x41')]){_0x6036d7['include']=[{'all':!![]}];}return db[_0x298c('0x2d')]['findAll'](_0x6036d7);})[_0x298c('0x23')](function(_0x40a136){_0x1afa80[_0x298c('0x42')]=_0x40a136;return _0x1afa80;})[_0x298c('0x23')](respondWithFilteredResult(_0x43cc72,_0x6036d7))[_0x298c('0x43')](handleError(_0x43cc72,null));};exports['show']=function(_0x4a51b2,_0x2a5eb2){var _0xe9dc38={'raw':![],'where':{'id':_0x4a51b2[_0x298c('0x44')]['id']}},_0x1873ed={};_0x1873ed['model']=_['keys'](db['Schedule']['rawAttributes']);_0x1873ed[_0x298c('0x31')]=_[_0x298c('0x32')](_0x4a51b2[_0x298c('0x31')]);_0x1873ed[_0x298c('0x3c')]=_['intersection'](_0x1873ed[_0x298c('0x34')],_0x1873ed[_0x298c('0x31')]);_0xe9dc38[_0x298c('0x35')]=_[_0x298c('0x33')](_0x1873ed['model'],qs['fields'](_0x4a51b2[_0x298c('0x31')][_0x298c('0x36')]));_0xe9dc38[_0x298c('0x35')]=_0xe9dc38[_0x298c('0x35')][_0x298c('0x45')]?_0xe9dc38[_0x298c('0x35')]:_0x1873ed[_0x298c('0x34')];if(_0x4a51b2[_0x298c('0x31')][_0x298c('0x41')]){_0xe9dc38[_0x298c('0x46')]=[{'all':!![]}];}_0xe9dc38=_[_0x298c('0x3e')]({},_0xe9dc38,_0x4a51b2[_0x298c('0x40')]);return db[_0x298c('0x2d')][_0x298c('0x47')](_0xe9dc38)[_0x298c('0x23')](handleEntityNotFound(_0x2a5eb2,null))['then'](respondWithResult(_0x2a5eb2,null))[_0x298c('0x43')](handleError(_0x2a5eb2,null));};exports[_0x298c('0x48')]=function(_0x12a7a0,_0x55fcbb){return db[_0x298c('0x2d')]['create'](_0x12a7a0[_0x298c('0x49')],{})[_0x298c('0x23')](function(_0x36c671){var _0x5171da=_0x12a7a0[_0x298c('0x4a')]['get']({'plain':!![]});if(!_0x5171da)throw new Error(_0x298c('0x4b'));if(_0x5171da[_0x298c('0x4c')]===_0x298c('0x4a')){var _0x48c841=_0x36c671[_0x298c('0x25')]({'plain':!![]});var _0x133fb6=_0x298c('0x26');return db[_0x298c('0x4d')][_0x298c('0x47')]({'where':{'name':_0x133fb6,'userProfileId':_0x5171da[_0x298c('0x4e')]},'raw':!![]})[_0x298c('0x23')](function(_0x3f8484){if(_0x3f8484&&_0x3f8484[_0x298c('0x4f')]===0x0){return db[_0x298c('0x50')][_0x298c('0x48')]({'name':_0x48c841[_0x298c('0x29')],'resourceId':_0x48c841['id'],'type':_0x3f8484['name'],'sectionId':_0x3f8484['id']},{})[_0x298c('0x23')](function(){return _0x36c671;});}else{return _0x36c671;}})['catch'](function(_0x6331){logger[_0x298c('0x27')](_0x298c('0x51'),_0x6331);throw _0x6331;});}return _0x36c671;})[_0x298c('0x23')](respondWithResult(_0x55fcbb,0xc9))[_0x298c('0x43')](handleError(_0x55fcbb,null));};exports[_0x298c('0x22')]=function(_0x206bfa,_0x250560){if(_0x206bfa[_0x298c('0x49')]['id']){delete _0x206bfa[_0x298c('0x49')]['id'];}return db[_0x298c('0x2d')][_0x298c('0x47')]({'where':{'id':_0x206bfa[_0x298c('0x44')]['id']}})['then'](handleEntityNotFound(_0x250560,null))['then'](saveUpdates(_0x206bfa[_0x298c('0x49')],null))[_0x298c('0x23')](respondWithResult(_0x250560,null))[_0x298c('0x43')](handleError(_0x250560,null));};exports[_0x298c('0x24')]=function(_0xb8291,_0x362935){return db[_0x298c('0x2d')]['find']({'where':{'id':_0xb8291[_0x298c('0x44')]['id']}})[_0x298c('0x23')](handleEntityNotFound(_0x362935,null))[_0x298c('0x23')](removeEntity(_0x362935,null))[_0x298c('0x43')](handleError(_0x362935,null));};exports[_0x298c('0x52')]=function(_0x5d4da4,_0x19c4fd,_0x2f5ea0){var _0x595740=require('../../config/schedule');return db[_0x298c('0x2d')][_0x298c('0x47')]({'where':{'id':_0x5d4da4['params']['id']},'raw':!![]})[_0x298c('0x23')](handleEntityNotFound(_0x19c4fd,null))[_0x298c('0x23')](function(){_0x595740[_0x298c('0x52')](_0x5d4da4[_0x298c('0x44')]['id']);})['then'](respondWithStatusCode(_0x19c4fd,null))[_0x298c('0x43')](handleError(_0x19c4fd,null));}; \ No newline at end of file +var _0xc906=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','Scheduler','UserProfileResource','sendStatus','name','send','index','map','Schedule','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0xc906,0x71));var _0x6c90=function(_0xaa9385,_0x12443b){_0xaa9385=_0xaa9385-0x0;var _0x1cae6f=_0xc906[_0xaa9385];return _0x1cae6f;};'use strict';var emlformat=require(_0x6c90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c90('0x1'));var jsonpatch=require(_0x6c90('0x2'));var rp=require(_0x6c90('0x3'));var moment=require(_0x6c90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c90('0x5'));var util=require(_0x6c90('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c90('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c90('0x8'));var _=require(_0x6c90('0x9'));var squel=require(_0x6c90('0xa'));var crypto=require(_0x6c90('0xb'));var jsforce=require(_0x6c90('0xc'));var deskjs=require(_0x6c90('0xd'));var toCsv=require(_0x6c90('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6c90('0xe'));var authService=require(_0x6c90('0xf'));var qs=require(_0x6c90('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c90('0x11'));var logger=require('../../config/logger')(_0x6c90('0x12'));var utils=require(_0x6c90('0x13'));var config=require(_0x6c90('0x14'));var licenseUtil=require(_0x6c90('0x15'));var db=require(_0x6c90('0x16'))['db'];function respondWithStatusCode(_0x190183,_0xe6b449){_0xe6b449=_0xe6b449||0xcc;return function(_0x17a941){if(_0x17a941){return _0x190183['sendStatus'](_0xe6b449);}return _0x190183[_0x6c90('0x17')](_0xe6b449)[_0x6c90('0x18')]();};}function respondWithResult(_0x421f92,_0x509da7){_0x509da7=_0x509da7||0xc8;return function(_0x5e20e6){if(_0x5e20e6){return _0x421f92[_0x6c90('0x17')](_0x509da7)[_0x6c90('0x19')](_0x5e20e6);}};}function respondWithFilteredResult(_0x5d5aea,_0x42d6e9){return function(_0x553cd4){if(_0x553cd4){var _0x4670ff=typeof _0x42d6e9[_0x6c90('0x1a')]===_0x6c90('0x1b')&&typeof _0x42d6e9[_0x6c90('0x1c')]==='undefined';var _0x2e83fa=_0x553cd4[_0x6c90('0x1d')];var _0x282e93=_0x4670ff?0x0:_0x42d6e9['offset'];var _0x3ec5ab=_0x4670ff?_0x553cd4[_0x6c90('0x1d')]:_0x42d6e9['offset']+_0x42d6e9['limit'];var _0x55d247;if(_0x3ec5ab>=_0x2e83fa){_0x3ec5ab=_0x2e83fa;_0x55d247=0xc8;}else{_0x55d247=0xce;}_0x5d5aea[_0x6c90('0x17')](_0x55d247);return _0x5d5aea[_0x6c90('0x1e')]('Content-Range',_0x282e93+'-'+_0x3ec5ab+'/'+_0x2e83fa)[_0x6c90('0x19')](_0x553cd4);}return null;};}function patchUpdates(_0x306509){return function(_0x2ed1f1){try{jsonpatch[_0x6c90('0x1f')](_0x2ed1f1,_0x306509,!![]);}catch(_0x57c640){return BPromise[_0x6c90('0x20')](_0x57c640);}return _0x2ed1f1['save']();};}function saveUpdates(_0x1eba17,_0x500484){return function(_0x4940dd){if(_0x4940dd){return _0x4940dd['update'](_0x1eba17)['then'](function(_0x187976){return _0x187976;});}return null;};}function removeEntity(_0x70a27e,_0x31af41){return function(_0xf84f5a){if(_0xf84f5a){return _0xf84f5a[_0x6c90('0x21')]()[_0x6c90('0x22')](function(){var _0x190fa8=_0xf84f5a['get']({'plain':!![]});var _0x2223c9=_0x6c90('0x23');return db[_0x6c90('0x24')][_0x6c90('0x21')]({'where':{'type':_0x2223c9,'resourceId':_0x190fa8['id']}})[_0x6c90('0x22')](function(){return _0xf84f5a;});})[_0x6c90('0x22')](function(){_0x70a27e[_0x6c90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59252a,_0x1d3787){return function(_0x1e89e4){if(!_0x1e89e4){_0x59252a[_0x6c90('0x25')](0x194);}return _0x1e89e4;};}function handleError(_0x2e6fb2,_0xaa7a84){_0xaa7a84=_0xaa7a84||0x1f4;return function(_0x21e68e){logger['error'](_0x21e68e['stack']);if(_0x21e68e[_0x6c90('0x26')]){delete _0x21e68e[_0x6c90('0x26')];}_0x2e6fb2[_0x6c90('0x17')](_0xaa7a84)[_0x6c90('0x27')](_0x21e68e);};}exports[_0x6c90('0x28')]=function(_0x22b856,_0x5dc49c){var _0x23a46e={},_0x55f209={},_0x17e460={'count':0x0,'rows':[]};var _0x447d6a=_[_0x6c90('0x29')](db[_0x6c90('0x2a')][_0x6c90('0x2b')],function(_0x134ab3){return{'name':_0x134ab3['fieldName'],'type':_0x134ab3[_0x6c90('0x2c')]['key']};});_0x55f209['model']=_[_0x6c90('0x29')](_0x447d6a,_0x6c90('0x26'));_0x55f209[_0x6c90('0x2d')]=_[_0x6c90('0x2e')](_0x22b856[_0x6c90('0x2d')]);_0x55f209[_0x6c90('0x2f')]=_[_0x6c90('0x30')](_0x55f209[_0x6c90('0x31')],_0x55f209[_0x6c90('0x2d')]);_0x23a46e[_0x6c90('0x32')]=_[_0x6c90('0x30')](_0x55f209[_0x6c90('0x31')],qs['fields'](_0x22b856['query'][_0x6c90('0x33')]));_0x23a46e['attributes']=_0x23a46e[_0x6c90('0x32')][_0x6c90('0x34')]?_0x23a46e[_0x6c90('0x32')]:_0x55f209[_0x6c90('0x31')];if(!_0x22b856['query'][_0x6c90('0x35')](_0x6c90('0x36'))){_0x23a46e[_0x6c90('0x1c')]=qs['limit'](_0x22b856[_0x6c90('0x2d')]['limit']);_0x23a46e[_0x6c90('0x1a')]=qs['offset'](_0x22b856[_0x6c90('0x2d')]['offset']);}_0x23a46e[_0x6c90('0x37')]=qs[_0x6c90('0x38')](_0x22b856['query'][_0x6c90('0x38')]);_0x23a46e['where']=qs[_0x6c90('0x2f')](_[_0x6c90('0x39')](_0x22b856[_0x6c90('0x2d')],_0x55f209[_0x6c90('0x2f')]),_0x447d6a);if(_0x22b856[_0x6c90('0x2d')][_0x6c90('0x3a')]){_0x23a46e[_0x6c90('0x3b')]=_[_0x6c90('0x3c')](_0x23a46e[_0x6c90('0x3b')],{'$or':_['map'](_0x447d6a,function(_0x435e99){if(_0x435e99[_0x6c90('0x2c')]!==_0x6c90('0x3d')){var _0x216fc1={};_0x216fc1[_0x435e99[_0x6c90('0x26')]]={'$like':'%'+_0x22b856[_0x6c90('0x2d')][_0x6c90('0x3a')]+'%'};return _0x216fc1;}})});}_0x23a46e=_[_0x6c90('0x3c')]({},_0x23a46e,_0x22b856[_0x6c90('0x3e')]);var _0x2e9399={'where':_0x23a46e[_0x6c90('0x3b')]};return db[_0x6c90('0x2a')][_0x6c90('0x1d')](_0x2e9399)[_0x6c90('0x22')](function(_0x507b55){_0x17e460[_0x6c90('0x1d')]=_0x507b55;if(_0x22b856[_0x6c90('0x2d')][_0x6c90('0x3f')]){_0x23a46e['include']=[{'all':!![]}];}return db['Schedule'][_0x6c90('0x40')](_0x23a46e);})['then'](function(_0x590eae){_0x17e460[_0x6c90('0x41')]=_0x590eae;return _0x17e460;})[_0x6c90('0x22')](respondWithFilteredResult(_0x5dc49c,_0x23a46e))[_0x6c90('0x42')](handleError(_0x5dc49c,null));};exports[_0x6c90('0x43')]=function(_0xd0aec5,_0x2ef5d4){var _0x415573={'raw':![],'where':{'id':_0xd0aec5[_0x6c90('0x44')]['id']}},_0x2f81e5={};_0x2f81e5[_0x6c90('0x31')]=_['keys'](db[_0x6c90('0x2a')][_0x6c90('0x2b')]);_0x2f81e5[_0x6c90('0x2d')]=_[_0x6c90('0x2e')](_0xd0aec5['query']);_0x2f81e5['filters']=_[_0x6c90('0x30')](_0x2f81e5[_0x6c90('0x31')],_0x2f81e5[_0x6c90('0x2d')]);_0x415573[_0x6c90('0x32')]=_[_0x6c90('0x30')](_0x2f81e5[_0x6c90('0x31')],qs['fields'](_0xd0aec5[_0x6c90('0x2d')][_0x6c90('0x33')]));_0x415573[_0x6c90('0x32')]=_0x415573['attributes']['length']?_0x415573['attributes']:_0x2f81e5[_0x6c90('0x31')];if(_0xd0aec5['query'][_0x6c90('0x3f')]){_0x415573['include']=[{'all':!![]}];}_0x415573=_[_0x6c90('0x3c')]({},_0x415573,_0xd0aec5[_0x6c90('0x3e')]);return db[_0x6c90('0x2a')]['find'](_0x415573)[_0x6c90('0x22')](handleEntityNotFound(_0x2ef5d4,null))[_0x6c90('0x22')](respondWithResult(_0x2ef5d4,null))[_0x6c90('0x42')](handleError(_0x2ef5d4,null));};exports[_0x6c90('0x45')]=function(_0x391b34,_0x538aad){return db[_0x6c90('0x2a')][_0x6c90('0x45')](_0x391b34[_0x6c90('0x46')],{})['then'](function(_0x655daa){var _0x57620c=_0x391b34[_0x6c90('0x47')][_0x6c90('0x48')]({'plain':!![]});if(!_0x57620c)throw new Error(_0x6c90('0x49'));if(_0x57620c['role']==='user'){var _0x19df98=_0x655daa[_0x6c90('0x48')]({'plain':!![]});var _0x1c68a4=_0x6c90('0x23');return db[_0x6c90('0x4a')]['find']({'where':{'name':_0x1c68a4,'userProfileId':_0x57620c[_0x6c90('0x4b')]},'raw':!![]})[_0x6c90('0x22')](function(_0x3ab892){if(_0x3ab892&&_0x3ab892[_0x6c90('0x4c')]===0x0){return db[_0x6c90('0x24')][_0x6c90('0x45')]({'name':_0x19df98['name'],'resourceId':_0x19df98['id'],'type':_0x3ab892[_0x6c90('0x26')],'sectionId':_0x3ab892['id']},{})[_0x6c90('0x22')](function(){return _0x655daa;});}else{return _0x655daa;}})['catch'](function(_0x303759){logger[_0x6c90('0x4d')](_0x6c90('0x4e'),_0x303759);throw _0x303759;});}return _0x655daa;})[_0x6c90('0x22')](respondWithResult(_0x538aad,0xc9))[_0x6c90('0x42')](handleError(_0x538aad,null));};exports[_0x6c90('0x4f')]=function(_0xbff985,_0x5470c0){if(_0xbff985[_0x6c90('0x46')]['id']){delete _0xbff985[_0x6c90('0x46')]['id'];}return db[_0x6c90('0x2a')][_0x6c90('0x50')]({'where':{'id':_0xbff985['params']['id']}})[_0x6c90('0x22')](handleEntityNotFound(_0x5470c0,null))[_0x6c90('0x22')](saveUpdates(_0xbff985[_0x6c90('0x46')],null))[_0x6c90('0x22')](respondWithResult(_0x5470c0,null))[_0x6c90('0x42')](handleError(_0x5470c0,null));};exports[_0x6c90('0x21')]=function(_0x589277,_0x4a1df0){return db['Schedule'][_0x6c90('0x50')]({'where':{'id':_0x589277['params']['id']}})[_0x6c90('0x22')](handleEntityNotFound(_0x4a1df0,null))[_0x6c90('0x22')](removeEntity(_0x4a1df0,null))['catch'](handleError(_0x4a1df0,null));};exports[_0x6c90('0x51')]=function(_0x4ee8f,_0x4aab44,_0x40bdb0){var _0x4ca216=require(_0x6c90('0x52'));return db['Schedule'][_0x6c90('0x50')]({'where':{'id':_0x4ee8f[_0x6c90('0x44')]['id']},'raw':!![]})[_0x6c90('0x22')](handleEntityNotFound(_0x4aab44,null))[_0x6c90('0x22')](function(){_0x4ca216[_0x6c90('0x51')](_0x4ee8f[_0x6c90('0x44')]['id']);})[_0x6c90('0x22')](respondWithStatusCode(_0x4aab44,null))[_0x6c90('0x42')](handleError(_0x4aab44,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 8500ae2..3babca7 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 _0x357c=['tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','Schedule'];(function(_0x106a8e,_0x1b2145){var _0x47baf6=function(_0x5a5022){while(--_0x5a5022){_0x106a8e['push'](_0x106a8e['shift']());}};_0x47baf6(++_0x1b2145);}(_0x357c,0x1b1));var _0xc357=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x357c[_0x2c6810];return _0x213881;};'use strict';var _=require(_0xc357('0x0'));var util=require(_0xc357('0x1'));var logger=require(_0xc357('0x2'))(_0xc357('0x3'));var moment=require(_0xc357('0x4'));var BPromise=require(_0xc357('0x5'));var rp=require(_0xc357('0x6'));var fs=require('fs');var path=require(_0xc357('0x7'));var rimraf=require(_0xc357('0x8'));var config=require(_0xc357('0x9'));var attributes=require('./schedule.attributes');module['exports']=function(_0x2b758e,_0x2b5955){return _0x2b758e['define'](_0xc357('0xa'),attributes,{'tableName':_0xc357('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa2d=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./schedule.attributes','exports','tools_schedules','lodash'];(function(_0x5c7ae3,_0x241a97){var _0x32226b=function(_0x1eb5ba){while(--_0x1eb5ba){_0x5c7ae3['push'](_0x5c7ae3['shift']());}};_0x32226b(++_0x241a97);}(_0xaa2d,0xba));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdaa2('0x0'));var util=require(_0xdaa2('0x1'));var logger=require(_0xdaa2('0x2'))(_0xdaa2('0x3'));var moment=require(_0xdaa2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdaa2('0x5'));var rimraf=require(_0xdaa2('0x6'));var config=require(_0xdaa2('0x7'));var attributes=require(_0xdaa2('0x8'));module[_0xdaa2('0x9')]=function(_0x5bb588,_0x527f9f){return _0x5bb588['define']('Schedule',attributes,{'tableName':_0xdaa2('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 aaeed16..cb27a5a 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 _0x9c96=['Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x9c96,0x126));var _0x69c9=function(_0x91928a,_0x587f7a){_0x91928a=_0x91928a-0x0;var _0x6882ba=_0x9c96[_0x91928a];return _0x6882ba;};'use strict';var _=require(_0x69c9('0x0'));var util=require(_0x69c9('0x1'));var moment=require(_0x69c9('0x2'));var BPromise=require(_0x69c9('0x3'));var rs=require(_0x69c9('0x4'));var fs=require('fs');var Redis=require(_0x69c9('0x5'));var db=require(_0x69c9('0x6'))['db'];var utils=require(_0x69c9('0x7'));var logger=require('../../config/logger')(_0x69c9('0x8'));var config=require(_0x69c9('0x9'));var jayson=require(_0x69c9('0xa'));var client=jayson[_0x69c9('0xb')][_0x69c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d3ee6,_0x39731e,_0x140d74){return new BPromise(function(_0x2cfe6c,_0x1973ea){return client[_0x69c9('0xd')](_0x4d3ee6,_0x140d74)[_0x69c9('0xe')](function(_0x4a31d1){logger[_0x69c9('0xf')](_0x69c9('0x10'),_0x39731e,'request\x20sent');logger[_0x69c9('0x11')](_0x69c9('0x12'),_0x39731e,_0x69c9('0x13'),JSON[_0x69c9('0x14')](_0x4a31d1));if(_0x4a31d1[_0x69c9('0x15')]){if(_0x4a31d1[_0x69c9('0x15')]['code']===0x1f4){logger[_0x69c9('0x15')]('Schedule,\x20%s,\x20%s',_0x39731e,_0x4a31d1['error']['message']);return _0x1973ea(_0x4a31d1['error'][_0x69c9('0x16')]);}logger[_0x69c9('0x15')](_0x69c9('0x10'),_0x39731e,_0x4a31d1[_0x69c9('0x15')]['message']);return _0x2cfe6c(_0x4a31d1[_0x69c9('0x15')][_0x69c9('0x16')]);}else{logger['info'](_0x69c9('0x10'),_0x39731e,_0x69c9('0x13'));_0x2cfe6c(_0x4a31d1[_0x69c9('0x17')]['message']);}})['catch'](function(_0xa7fdb){logger[_0x69c9('0x15')](_0x69c9('0x10'),_0x39731e,_0xa7fdb);_0x1973ea(_0xa7fdb);});});} \ No newline at end of file +var _0xc42d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x2d7d4d,_0x2a94e9){var _0x3291c0=function(_0x327025){while(--_0x327025){_0x2d7d4d['push'](_0x2d7d4d['shift']());}};_0x3291c0(++_0x2a94e9);}(_0xc42d,0x11c));var _0xdc42=function(_0x6a2f45,_0xe43c67){_0x6a2f45=_0x6a2f45-0x0;var _0x3b9cb3=_0xc42d[_0x6a2f45];return _0x3b9cb3;};'use strict';var _=require(_0xdc42('0x0'));var util=require(_0xdc42('0x1'));var moment=require(_0xdc42('0x2'));var BPromise=require(_0xdc42('0x3'));var rs=require(_0xdc42('0x4'));var fs=require('fs');var Redis=require(_0xdc42('0x5'));var db=require(_0xdc42('0x6'))['db'];var utils=require(_0xdc42('0x7'));var logger=require(_0xdc42('0x8'))(_0xdc42('0x9'));var config=require(_0xdc42('0xa'));var jayson=require(_0xdc42('0xb'));var client=jayson['client'][_0xdc42('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x348923,_0x40ae47,_0x375897){return new BPromise(function(_0x5be533,_0x1bff3e){return client[_0xdc42('0xd')](_0x348923,_0x375897)[_0xdc42('0xe')](function(_0x12ffe3){logger[_0xdc42('0xf')](_0xdc42('0x10'),_0x40ae47,_0xdc42('0x11'));logger[_0xdc42('0x12')](_0xdc42('0x13'),_0x40ae47,_0xdc42('0x11'),JSON[_0xdc42('0x14')](_0x12ffe3));if(_0x12ffe3[_0xdc42('0x15')]){if(_0x12ffe3['error']['code']===0x1f4){logger[_0xdc42('0x15')]('Schedule,\x20%s,\x20%s',_0x40ae47,_0x12ffe3['error']['message']);return _0x1bff3e(_0x12ffe3['error'][_0xdc42('0x16')]);}logger['error'](_0xdc42('0x10'),_0x40ae47,_0x12ffe3[_0xdc42('0x15')][_0xdc42('0x16')]);return _0x5be533(_0x12ffe3[_0xdc42('0x15')][_0xdc42('0x16')]);}else{logger[_0xdc42('0xf')](_0xdc42('0x10'),_0x40ae47,_0xdc42('0x11'));_0x5be533(_0x12ffe3['result']['message']);}})[_0xdc42('0x17')](function(_0x1d4559){logger[_0xdc42('0x15')]('Schedule,\x20%s,\x20%s',_0x40ae47,_0x1d4559);_0x1bff3e(_0x1d4559);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d5c2eb3..232605f 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 _0x2729=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','create','put','update','delete'];(function(_0x49305f,_0x2691c2){var _0x4b4e5e=function(_0x2c763b){while(--_0x2c763b){_0x49305f['push'](_0x49305f['shift']());}};_0x4b4e5e(++_0x2691c2);}(_0x2729,0xaa));var _0x9272=function(_0x43d94d,_0x2f167d){_0x43d94d=_0x43d94d-0x0;var _0x5aa4ff=_0x2729[_0x43d94d];return _0x5aa4ff;};'use strict';var multer=require(_0x9272('0x0'));var util=require(_0x9272('0x1'));var path=require('path');var timeout=require(_0x9272('0x2'));var express=require(_0x9272('0x3'));var router=express[_0x9272('0x4')]();var fs_extra=require(_0x9272('0x5'));var auth=require(_0x9272('0x6'));var interaction=require(_0x9272('0x7'));var config=require(_0x9272('0x8'));var controller=require('./screenRecording.controller');router[_0x9272('0x9')]('/',auth[_0x9272('0xa')](),controller[_0x9272('0xb')]);router['get']('/describe',auth[_0x9272('0xa')](),controller[_0x9272('0xc')]);router['get'](_0x9272('0xd'),auth[_0x9272('0xa')](),controller[_0x9272('0xe')]);router[_0x9272('0x9')](_0x9272('0xf'),auth[_0x9272('0xa')](),controller[_0x9272('0x10')]);router[_0x9272('0x11')]('/',auth[_0x9272('0xa')](),controller[_0x9272('0x12')]);router[_0x9272('0x13')](_0x9272('0xd'),auth[_0x9272('0xa')](),controller[_0x9272('0x14')]);router[_0x9272('0x15')]('/:id',auth[_0x9272('0xa')](),controller[_0x9272('0x16')]);module[_0x9272('0x17')]=router; \ No newline at end of file +var _0x26c3=['isAuthenticated','show','/:id/download','download','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x283d0c,_0x3f0e67){var _0x1c91f5=function(_0x40369e){while(--_0x40369e){_0x283d0c['push'](_0x283d0c['shift']());}};_0x1c91f5(++_0x3f0e67);}(_0x26c3,0x1c2));var _0x326c=function(_0x318050,_0x49ceb8){_0x318050=_0x318050-0x0;var _0x1a189d=_0x26c3[_0x318050];return _0x1a189d;};'use strict';var multer=require(_0x326c('0x0'));var util=require(_0x326c('0x1'));var path=require(_0x326c('0x2'));var timeout=require(_0x326c('0x3'));var express=require(_0x326c('0x4'));var router=express[_0x326c('0x5')]();var fs_extra=require(_0x326c('0x6'));var auth=require(_0x326c('0x7'));var interaction=require(_0x326c('0x8'));var config=require(_0x326c('0x9'));var controller=require('./screenRecording.controller');router[_0x326c('0xa')]('/',auth['isAuthenticated'](),controller[_0x326c('0xb')]);router[_0x326c('0xa')]('/describe',auth[_0x326c('0xc')](),controller['describe']);router[_0x326c('0xa')]('/:id',auth[_0x326c('0xc')](),controller[_0x326c('0xd')]);router['get'](_0x326c('0xe'),auth[_0x326c('0xc')](),controller[_0x326c('0xf')]);router[_0x326c('0x10')]('/',auth[_0x326c('0xc')](),controller['create']);router[_0x326c('0x11')](_0x326c('0x12'),auth[_0x326c('0xc')](),controller[_0x326c('0x13')]);router[_0x326c('0x14')]('/:id',auth[_0x326c('0xc')](),controller['destroy']);module[_0x326c('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c2199fd..620b431 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 _0xb78e=['getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL'];(function(_0x49f856,_0x26dc54){var _0x1bacb6=function(_0xd115b3){while(--_0xd115b3){_0x49f856['push'](_0x49f856['shift']());}};_0x1bacb6(++_0x26dc54);}(_0xb78e,0x1c9));var _0xeb78=function(_0x3ed954,_0x19696a){_0x3ed954=_0x3ed954-0x0;var _0x2c7c3f=_0xb78e[_0x3ed954];return _0x2c7c3f;};'use strict';var Sequelize=require(_0xeb78('0x0'));var moment=require(_0xeb78('0x1'));var path=require('path');var config=require(_0xeb78('0x2'));module[_0xeb78('0x3')]={'format':{'type':Sequelize[_0xeb78('0x4')],'get':function(){return this[_0xeb78('0x5')](_0xeb78('0x6'))?path[_0xeb78('0x7')](this[_0xeb78('0x5')](_0xeb78('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeb78('0x8')]},'value':{'type':Sequelize[_0xeb78('0x8')],'set':function(_0x1ccc2f){var _0x30c884=_0x1ccc2f[_0xeb78('0x9')](/\\/g,'/');this[_0xeb78('0xa')](_0xeb78('0x6'),_0x30c884);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xeb78('0xb')],'set':function(_0x1c941d){this[_0xeb78('0xa')](_0xeb78('0xc'),moment()[_0xeb78('0xd')](_0x1c941d,'ms'));this[_0xeb78('0xa')](_0xeb78('0xe'),moment());this[_0xeb78('0xa')](_0xeb78('0xf'),_0x1c941d);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xeb78('0x5')](_0xeb78('0xc')))[_0xeb78('0x10')](_0xeb78('0x11'))[_0xeb78('0x12')]();}},'closedAt':{'type':Sequelize[_0xeb78('0x13')],'get':function(){return moment(this[_0xeb78('0x5')](_0xeb78('0xe')))[_0xeb78('0x10')](_0xeb78('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0xeb78('0x13')],'get':function(){return moment(this[_0xeb78('0x5')]('createdAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xeb78('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xeb78('0x5')](_0xeb78('0x14')))['format'](_0xeb78('0x11'))['toString']();}}}; \ No newline at end of file +var _0x2515=['subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','value','INTEGER'];(function(_0x5a0f26,_0x4bee1f){var _0x1f42b2=function(_0x198d0a){while(--_0x198d0a){_0x5a0f26['push'](_0x5a0f26['shift']());}};_0x1f42b2(++_0x4bee1f);}(_0x2515,0x1c2));var _0x5251=function(_0x586d12,_0x44383c){_0x586d12=_0x586d12-0x0;var _0x217a33=_0x2515[_0x586d12];return _0x217a33;};'use strict';var Sequelize=require(_0x5251('0x0'));var moment=require(_0x5251('0x1'));var path=require('path');var config=require(_0x5251('0x2'));module[_0x5251('0x3')]={'format':{'type':Sequelize[_0x5251('0x4')],'get':function(){return this[_0x5251('0x5')]('value')?path[_0x5251('0x6')](this[_0x5251('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x5251('0x7')]},'channel':{'type':Sequelize[_0x5251('0x7')]},'value':{'type':Sequelize[_0x5251('0x7')],'set':function(_0x3f4749){var _0x107910=_0x3f4749[_0x5251('0x8')](/\\/g,'/');this[_0x5251('0x9')](_0x5251('0xa'),_0x107910);}},'rating':{'type':Sequelize[_0x5251('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5251('0xb')],'set':function(_0x2bec99){this[_0x5251('0x9')]('startedAt',moment()[_0x5251('0xc')](_0x2bec99,'ms'));this[_0x5251('0x9')](_0x5251('0xd'),moment());this['setDataValue'](_0x5251('0xe'),_0x2bec99);}},'startedAt':{'type':Sequelize[_0x5251('0xf')],'get':function(){return moment(this[_0x5251('0x5')](_0x5251('0x10')))[_0x5251('0x11')](_0x5251('0x12'))[_0x5251('0x13')]();}},'closedAt':{'type':Sequelize[_0x5251('0xf')],'get':function(){return moment(this[_0x5251('0x5')](_0x5251('0xd')))[_0x5251('0x11')](_0x5251('0x12'))[_0x5251('0x13')]();}},'createdAt':{'type':Sequelize[_0x5251('0xf')],'get':function(){return moment(this[_0x5251('0x5')](_0x5251('0x14')))[_0x5251('0x11')](_0x5251('0x12'))[_0x5251('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5251('0x5')](_0x5251('0x15')))[_0x5251('0x11')](_0x5251('0x12'))[_0x5251('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c271512..5f90f66 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(_0x34b1b8,_0x54c9bf){var _0x542dd8=function(_0xff3f89){while(--_0xff3f89){_0x34b1b8['push'](_0x34b1b8['shift']());}};_0x542dd8(++_0x54c9bf);}(_0x4c4e,0x152));var _0xe4c4=function(_0x20b07d,_0x469187){_0x20b07d=_0x20b07d-0x0;var _0x418210=_0x4c4e[_0x20b07d];return _0x418210;};'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 _0x008c=['papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x008c,0x188));var _0xc008=function(_0x18d9fc,_0x1f5eb3){_0x18d9fc=_0x18d9fc-0x0;var _0x191f05=_0x008c[_0x18d9fc];return _0x191f05;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index bf98d67..2a91469 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 _0x3fff=['../../config/logger','api','moment','request-promise','path','./screenRecording.attributes','exports','lodash','util'];(function(_0x4d954f,_0x41c1df){var _0x2c6db2=function(_0x2ab407){while(--_0x2ab407){_0x4d954f['push'](_0x4d954f['shift']());}};_0x2c6db2(++_0x41c1df);}(_0x3fff,0x1e4));var _0xf3ff=function(_0xde8111,_0x15702c){_0xde8111=_0xde8111-0x0;var _0x29af0b=_0x3fff[_0xde8111];return _0x29af0b;};'use strict';var _=require(_0xf3ff('0x0'));var util=require(_0xf3ff('0x1'));var logger=require(_0xf3ff('0x2'))(_0xf3ff('0x3'));var moment=require(_0xf3ff('0x4'));var BPromise=require('bluebird');var rp=require(_0xf3ff('0x5'));var fs=require('fs');var path=require(_0xf3ff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf3ff('0x7'));module[_0xf3ff('0x8')]=function(_0x1b51e9,_0x566dd0){return _0x1b51e9['define']('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2619=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5d75ff,_0x5bc7ac){var _0x1c1894=function(_0x1fcade){while(--_0x1fcade){_0x5d75ff['push'](_0x5d75ff['shift']());}};_0x1c1894(++_0x5bc7ac);}(_0x2619,0xf5));var _0x9261=function(_0x48f4d3,_0x4bfb9e){_0x48f4d3=_0x48f4d3-0x0;var _0x461c3b=_0x2619[_0x48f4d3];return _0x461c3b;};'use strict';var _=require(_0x9261('0x0'));var util=require(_0x9261('0x1'));var logger=require(_0x9261('0x2'))(_0x9261('0x3'));var moment=require(_0x9261('0x4'));var BPromise=require(_0x9261('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9261('0x6'));var rimraf=require('rimraf');var config=require(_0x9261('0x7'));var attributes=require(_0x9261('0x8'));module[_0x9261('0x9')]=function(_0xbda838,_0x32e887){return _0xbda838[_0x9261('0xa')](_0x9261('0xb'),attributes,{'tableName':_0x9261('0xc'),'paranoid':![],'indexes':[{'name':_0x9261('0xd'),'fields':[_0x9261('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 86c0dfc..9282469 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 _0x05b6=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x20c205,_0x39bc5e){var _0x3d6cf2=function(_0x209286){while(--_0x209286){_0x20c205['push'](_0x20c205['shift']());}};_0x3d6cf2(++_0x39bc5e);}(_0x05b6,0x1c8));var _0x605b=function(_0x3fbb91,_0x5ec106){_0x3fbb91=_0x3fbb91-0x0;var _0x3eb213=_0x05b6[_0x3fbb91];return _0x3eb213;};'use strict';var _=require(_0x605b('0x0'));var util=require('util');var moment=require(_0x605b('0x1'));var BPromise=require(_0x605b('0x2'));var rs=require(_0x605b('0x3'));var fs=require('fs');var Redis=require(_0x605b('0x4'));var db=require(_0x605b('0x5'))['db'];var utils=require(_0x605b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x605b('0x7'));var jayson=require(_0x605b('0x8'));var client=jayson[_0x605b('0x9')][_0x605b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x369e36,_0x3bc844,_0x5d3cb7){return new BPromise(function(_0x2a93c7,_0x4de2dd){return client[_0x605b('0xb')](_0x369e36,_0x5d3cb7)[_0x605b('0xc')](function(_0x573506){logger['info'](_0x605b('0xd'),_0x3bc844,_0x605b('0xe'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x3bc844,_0x605b('0xe'),JSON['stringify'](_0x573506));if(_0x573506[_0x605b('0xf')]){if(_0x573506[_0x605b('0xf')][_0x605b('0x10')]===0x1f4){logger['error'](_0x605b('0xd'),_0x3bc844,_0x573506[_0x605b('0xf')][_0x605b('0x11')]);return _0x4de2dd(_0x573506[_0x605b('0xf')]['message']);}logger[_0x605b('0xf')](_0x605b('0xd'),_0x3bc844,_0x573506[_0x605b('0xf')]['message']);return _0x2a93c7(_0x573506[_0x605b('0xf')]['message']);}else{logger[_0x605b('0x12')](_0x605b('0xd'),_0x3bc844,'request\x20sent');_0x2a93c7(_0x573506['result'][_0x605b('0x11')]);}})[_0x605b('0x13')](function(_0x17849e){logger[_0x605b('0xf')](_0x605b('0xd'),_0x3bc844,_0x17849e);_0x4de2dd(_0x17849e);});});} \ No newline at end of file +var _0x0aab=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x0aab,0xf7));var _0xb0aa=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x0aab[_0x2fdce0];return _0x36f07e;};'use strict';var _=require(_0xb0aa('0x0'));var util=require(_0xb0aa('0x1'));var moment=require('moment');var BPromise=require(_0xb0aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0aa('0x3'));var db=require(_0xb0aa('0x4'))['db'];var utils=require(_0xb0aa('0x5'));var logger=require(_0xb0aa('0x6'))(_0xb0aa('0x7'));var config=require(_0xb0aa('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x88778a,_0x4a2fdd,_0x3ba385){return new BPromise(function(_0x2bc59a,_0x199486){return client[_0xb0aa('0x9')](_0x88778a,_0x3ba385)[_0xb0aa('0xa')](function(_0xa1401a){logger['info'](_0xb0aa('0xb'),_0x4a2fdd,'request\x20sent');logger[_0xb0aa('0xc')](_0xb0aa('0xd'),_0x4a2fdd,_0xb0aa('0xe'),JSON['stringify'](_0xa1401a));if(_0xa1401a[_0xb0aa('0xf')]){if(_0xa1401a[_0xb0aa('0xf')][_0xb0aa('0x10')]===0x1f4){logger['error'](_0xb0aa('0xb'),_0x4a2fdd,_0xa1401a[_0xb0aa('0xf')][_0xb0aa('0x11')]);return _0x199486(_0xa1401a['error'][_0xb0aa('0x11')]);}logger[_0xb0aa('0xf')](_0xb0aa('0xb'),_0x4a2fdd,_0xa1401a[_0xb0aa('0xf')][_0xb0aa('0x11')]);return _0x2bc59a(_0xa1401a[_0xb0aa('0xf')][_0xb0aa('0x11')]);}else{logger[_0xb0aa('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x4a2fdd,_0xb0aa('0xe'));_0x2bc59a(_0xa1401a[_0xb0aa('0x13')][_0xb0aa('0x11')]);}})[_0xb0aa('0x14')](function(_0x3d2784){logger[_0xb0aa('0xf')](_0xb0aa('0xb'),_0x4a2fdd,_0x3d2784);_0x199486(_0x3d2784);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 00574d4..887d785 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 _0xbed5=['root','server/files/images/logos/','format','%s%s','originalname','post','single','logologin','extname','file','preferred','addPreferred','favicon','addFavicon','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','getDate','/:id','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join'];(function(_0xd99f27,_0x2cabf9){var _0x4725ab=function(_0x45188d){while(--_0x45188d){_0xd99f27['push'](_0xd99f27['shift']());}};_0x4725ab(++_0x2cabf9);}(_0xbed5,0x1ef));var _0x5bed=function(_0x4293be,_0x4cf6d0){_0x4293be=_0x4293be-0x0;var _0x366840=_0xbed5[_0x4293be];return _0x366840;};'use strict';var multer=require(_0x5bed('0x0'));var util=require(_0x5bed('0x1'));var path=require(_0x5bed('0x2'));var timeout=require('connect-timeout');var express=require(_0x5bed('0x3'));var router=express[_0x5bed('0x4')]();var fs_extra=require(_0x5bed('0x5'));var auth=require(_0x5bed('0x6'));var interaction=require(_0x5bed('0x7'));var config=require(_0x5bed('0x8'));var controller=require(_0x5bed('0x9'));router[_0x5bed('0xa')]('/',auth['isAuthenticated'](),controller[_0x5bed('0xb')]);router['get']('/now',controller[_0x5bed('0xc')]);router['get'](_0x5bed('0xd'),controller['show']);router[_0x5bed('0xa')](_0x5bed('0xe'),controller['getLogo']);router['get'](_0x5bed('0xf'),controller[_0x5bed('0x10')]);router[_0x5bed('0xa')](_0x5bed('0x11'),controller[_0x5bed('0x12')]);router[_0x5bed('0xa')](_0x5bed('0x13'),controller[_0x5bed('0x14')]);router[_0x5bed('0xa')](_0x5bed('0x15'),controller[_0x5bed('0x16')]);var upload=multer({'storage':multer[_0x5bed('0x17')]({'destination':function(_0x4aee1f,_0x19d574,_0x127b25){_0x127b25(null,path[_0x5bed('0x18')](config[_0x5bed('0x19')],_0x5bed('0x1a')));},'filename':function(_0x4ea390,_0x5e785c,_0x40b491){_0x40b491(null,util[_0x5bed('0x1b')](_0x5bed('0x1c'),'logo',path['extname'](_0x5e785c[_0x5bed('0x1d')])));}})});router[_0x5bed('0x1e')](_0x5bed('0xe'),upload[_0x5bed('0x1f')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cba3f,_0x3c3765,_0xd20c64){_0xd20c64(null,path[_0x5bed('0x18')](config[_0x5bed('0x19')],_0x5bed('0x1a')));},'filename':function(_0x559f78,_0x5d9983,_0x131bb6){_0x131bb6(null,util['format'](_0x5bed('0x1c'),_0x5bed('0x20'),path[_0x5bed('0x21')](_0x5d9983['originalname'])));}})});router[_0x5bed('0x1e')](_0x5bed('0xf'),upload['single'](_0x5bed('0x22')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39c929,_0x8f478e,_0x1c03c0){_0x1c03c0(null,path['join'](config['root'],_0x5bed('0x1a')));},'filename':function(_0x490921,_0x1bb624,_0xa1c251){_0xa1c251(null,util[_0x5bed('0x1b')](_0x5bed('0x1c'),_0x5bed('0x23'),path['extname'](_0x1bb624[_0x5bed('0x1d')])));}})});router[_0x5bed('0x1e')](_0x5bed('0x13'),upload['single'](_0x5bed('0x22')),controller[_0x5bed('0x24')]);var upload=multer({'storage':multer[_0x5bed('0x17')]({'destination':function(_0x16dba8,_0x6abfab,_0xc56e70){_0xc56e70(null,path[_0x5bed('0x18')](config[_0x5bed('0x19')],'server/files/images/logos/'));},'filename':function(_0x40caad,_0x313d56,_0x4168bc){_0x4168bc(null,util[_0x5bed('0x1b')]('%s%s',_0x5bed('0x25'),path['extname'](_0x313d56['originalname'])));}})});router['post']('/:id/favicon',upload[_0x5bed('0x1f')](_0x5bed('0x22')),controller[_0x5bed('0x26')]);router['put'](_0x5bed('0xd'),auth['isAuthenticated'](),controller['update']);module[_0x5bed('0x27')]=router; \ No newline at end of file +var _0x54ca=['/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','format','originalname','post','single','file','addLogo','diskStorage','server/files/images/logos/','%s%s','addLogoLogin','preferred','extname','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','../../config/environment','./setting.controller','get','isAuthenticated','index'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x54ca,0x71));var _0xa54c=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0x54ca[_0x4f6f84];return _0x20d989;};'use strict';var multer=require(_0xa54c('0x0'));var util=require('util');var path=require(_0xa54c('0x1'));var timeout=require(_0xa54c('0x2'));var express=require(_0xa54c('0x3'));var router=express[_0xa54c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa54c('0x5'));var controller=require(_0xa54c('0x6'));router[_0xa54c('0x7')]('/',auth[_0xa54c('0x8')](),controller[_0xa54c('0x9')]);router[_0xa54c('0x7')](_0xa54c('0xa'),controller[_0xa54c('0xb')]);router[_0xa54c('0x7')](_0xa54c('0xc'),controller['show']);router[_0xa54c('0x7')](_0xa54c('0xd'),controller[_0xa54c('0xe')]);router[_0xa54c('0x7')](_0xa54c('0xf'),controller[_0xa54c('0x10')]);router[_0xa54c('0x7')]('/:id/gdpr',controller['gdpr']);router['get'](_0xa54c('0x11'),controller[_0xa54c('0x12')]);router['get'](_0xa54c('0x13'),controller[_0xa54c('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a591b,_0x111ba8,_0x276fa3){_0x276fa3(null,path[_0xa54c('0x15')](config[_0xa54c('0x16')],'server/files/images/logos/'));},'filename':function(_0x8068bb,_0x426af9,_0x10ca10){_0x10ca10(null,util[_0xa54c('0x17')]('%s%s','logo',path['extname'](_0x426af9[_0xa54c('0x18')])));}})});router[_0xa54c('0x19')]('/:id/logo',upload[_0xa54c('0x1a')](_0xa54c('0x1b')),controller[_0xa54c('0x1c')]);var upload=multer({'storage':multer[_0xa54c('0x1d')]({'destination':function(_0x486a77,_0x274d7e,_0x23368e){_0x23368e(null,path[_0xa54c('0x15')](config[_0xa54c('0x16')],_0xa54c('0x1e')));},'filename':function(_0x18d336,_0x2e2f15,_0x3316fb){_0x3316fb(null,util[_0xa54c('0x17')](_0xa54c('0x1f'),'logologin',path['extname'](_0x2e2f15[_0xa54c('0x18')])));}})});router['post'](_0xa54c('0xf'),upload['single'](_0xa54c('0x1b')),controller[_0xa54c('0x20')]);var upload=multer({'storage':multer[_0xa54c('0x1d')]({'destination':function(_0x5f3d6f,_0x2e0ae,_0xe09378){_0xe09378(null,path[_0xa54c('0x15')](config['root'],_0xa54c('0x1e')));},'filename':function(_0x2ce50c,_0x3077e7,_0x2bd4b8){_0x2bd4b8(null,util['format'](_0xa54c('0x1f'),_0xa54c('0x21'),path[_0xa54c('0x22')](_0x3077e7[_0xa54c('0x18')])));}})});router[_0xa54c('0x19')](_0xa54c('0x11'),upload[_0xa54c('0x1a')](_0xa54c('0x1b')),controller[_0xa54c('0x23')]);var upload=multer({'storage':multer[_0xa54c('0x1d')]({'destination':function(_0x55795b,_0x4590e5,_0x2d0319){_0x2d0319(null,path[_0xa54c('0x15')](config[_0xa54c('0x16')],_0xa54c('0x1e')));},'filename':function(_0x3a361a,_0x1b4df4,_0x230a8b){_0x230a8b(null,util[_0xa54c('0x17')](_0xa54c('0x1f'),_0xa54c('0x24'),path[_0xa54c('0x22')](_0x1b4df4[_0xa54c('0x18')])));}})});router[_0xa54c('0x19')]('/:id/favicon',upload[_0xa54c('0x1a')](_0xa54c('0x1b')),controller[_0xa54c('0x25')]);router[_0xa54c('0x26')](_0xa54c('0xc'),auth['isAuthenticated'](),controller[_0xa54c('0x27')]);module[_0xa54c('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 73f4d63..d9f6ccb 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3d867a,_0xef01ff){var _0x39e95a=function(_0x2b1c31){while(--_0x2b1c31){_0x3d867a['push'](_0x3d867a['shift']());}};_0x39e95a(++_0xef01ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd8b0=['alternate','UNSIGNED','sequelize','exports','min_mailbox','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0d8b('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0d8b('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':_0x0d8b('0x5')},'logo':{'type':Sequelize[_0x0d8b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0d8b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0d8b('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x0d8b('0x4')]},'turnpassword':{'type':Sequelize[_0x0d8b('0x4')]},'pageTitle':{'type':Sequelize[_0x0d8b('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0d8b('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':_0x0d8b('0x7')},'chatTimeout':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0d8b('0x4')]},'defaultPreferred':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0d8b('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0d8b('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0d8b('0x3')]},'transcribeRegion':{'type':Sequelize[_0x0d8b('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0d8b('0x3')]},'sentimentRegion':{'type':Sequelize[_0x0d8b('0x4')]},'language':{'type':Sequelize[_0x0d8b('0x4')]},'bucket':{'type':Sequelize[_0x0d8b('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x0d8b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 7b34279..ccadf46 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 _0x323f=['jayson/promise','client','http','request','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Setting','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','body','addLogo','file','filename','logo','getLogo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','defaultLogo','default_loginLogo.svg','securePassword','addPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x52f279,_0x359767){var _0x3bdbc4=function(_0x4e48b8){while(--_0x4e48b8){_0x52f279['push'](_0x52f279['shift']());}};_0x3bdbc4(++_0x359767);}(_0x323f,0xde));var _0xf323=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x323f[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf323('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf323('0x1'));var rp=require('request-promise');var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var Mustache=require(_0xf323('0x4'));var util=require(_0xf323('0x5'));var path=require('path');var sox=require(_0xf323('0x6'));var csv=require('to-csv');var ejs=require(_0xf323('0x7'));var fs=require('fs');var fs_extra=require(_0xf323('0x8'));var _=require(_0xf323('0x9'));var squel=require(_0xf323('0xa'));var crypto=require(_0xf323('0xb'));var jsforce=require(_0xf323('0xc'));var deskjs=require(_0xf323('0xd'));var toCsv=require(_0xf323('0xe'));var querystring=require(_0xf323('0xf'));var Papa=require('papaparse');var Redis=require(_0xf323('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf323('0x11'));var logger=require(_0xf323('0x12'))(_0xf323('0x13'));var utils=require('../../config/utils');var config=require(_0xf323('0x14'));var licenseUtil=require(_0xf323('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf323('0x16'));var client=jayson[_0xf323('0x17')][_0xf323('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xcac862,_0x12b083,_0x2c5afb,_0x5a6888){return new BPromise(function(_0x32d36c,_0x37eff7){var _0xd95389=_0x5a6888||client;return _0xd95389[_0xf323('0x19')](_0xcac862,_0x2c5afb)['then'](function(_0x4053bf){logger['info']('Setting,\x20%s,\x20%s',_0x12b083,_0xf323('0x1a'));logger['debug'](_0xf323('0x1b'),_0x12b083,'request\x20sent',JSON[_0xf323('0x1c')](_0x4053bf));if(_0x4053bf[_0xf323('0x1d')]){if(_0x4053bf[_0xf323('0x1d')][_0xf323('0x1e')]===0x1f4){logger[_0xf323('0x1d')](_0xf323('0x1f'),_0x12b083,_0x4053bf['error']['message']);return _0x37eff7(_0x4053bf[_0xf323('0x1d')]['message']);}logger['error'](_0xf323('0x1f'),_0x12b083,_0x4053bf[_0xf323('0x1d')]['message']);return _0x32d36c(_0x4053bf[_0xf323('0x1d')][_0xf323('0x20')]);}else{logger[_0xf323('0x21')]('Setting,\x20%s,\x20%s',_0x12b083,_0xf323('0x1a'));_0x32d36c(_0x4053bf[_0xf323('0x22')]['message']);}})[_0xf323('0x23')](function(_0x170a18){logger[_0xf323('0x1d')]('Setting,\x20%s,\x20%s',_0x12b083,_0x170a18);_0x37eff7(_0x170a18);});});}function respondWithStatusCode(_0x21374a,_0x2dba99){_0x2dba99=_0x2dba99||0xcc;return function(_0x190262){if(_0x190262){return _0x21374a[_0xf323('0x24')](_0x2dba99);}return _0x21374a[_0xf323('0x25')](_0x2dba99)[_0xf323('0x26')]();};}function respondWithResult(_0xe15d1f,_0x5a38c6){_0x5a38c6=_0x5a38c6||0xc8;return function(_0xe4b40d){if(_0xe4b40d){return _0xe15d1f[_0xf323('0x25')](_0x5a38c6)[_0xf323('0x27')](_0xe4b40d);}};}function respondWithFilteredResult(_0x1db0af,_0x850901){return function(_0x58fcd1){if(_0x58fcd1){var _0x4e57d5=typeof _0x850901[_0xf323('0x28')]==='undefined'&&typeof _0x850901['limit']===_0xf323('0x29');var _0x529cf3=_0x58fcd1[_0xf323('0x2a')];var _0x535834=_0x4e57d5?0x0:_0x850901[_0xf323('0x28')];var _0xe6c8aa=_0x4e57d5?_0x58fcd1[_0xf323('0x2a')]:_0x850901[_0xf323('0x28')]+_0x850901['limit'];var _0x8d4dd1;if(_0xe6c8aa>=_0x529cf3){_0xe6c8aa=_0x529cf3;_0x8d4dd1=0xc8;}else{_0x8d4dd1=0xce;}_0x1db0af[_0xf323('0x25')](_0x8d4dd1);return _0x1db0af[_0xf323('0x2b')](_0xf323('0x2c'),_0x535834+'-'+_0xe6c8aa+'/'+_0x529cf3)['json'](_0x58fcd1);}return null;};}function patchUpdates(_0x4a8a50){return function(_0x29a76c){try{jsonpatch[_0xf323('0x2d')](_0x29a76c,_0x4a8a50,!![]);}catch(_0x22ef15){return BPromise[_0xf323('0x2e')](_0x22ef15);}return _0x29a76c['save']();};}function saveUpdates(_0x162d8b,_0x3873b0){return function(_0x90118e){if(_0x90118e){return _0x90118e[_0xf323('0x2f')](_0x162d8b)[_0xf323('0x30')](function(_0x212be9){return _0x212be9;});}return null;};}function removeEntity(_0x2a036a,_0x4d7c0b){return function(_0x4b7054){if(_0x4b7054){return _0x4b7054[_0xf323('0x31')]()[_0xf323('0x30')](function(){_0x2a036a['status'](0xcc)[_0xf323('0x26')]();});}};}function handleEntityNotFound(_0x5a3d2b,_0xa0b7a0){return function(_0x26cc4f){if(!_0x26cc4f){_0x5a3d2b['sendStatus'](0x194);}return _0x26cc4f;};}function handleError(_0x2609f1,_0x42c505){_0x42c505=_0x42c505||0x1f4;return function(_0x3708ba){logger[_0xf323('0x1d')](_0x3708ba[_0xf323('0x32')]);if(_0x3708ba['name']){delete _0x3708ba[_0xf323('0x33')];}_0x2609f1[_0xf323('0x25')](_0x42c505)[_0xf323('0x34')](_0x3708ba);};}exports[_0xf323('0x35')]=function(_0x526fbc,_0x1f1dcd){var _0x40380a={},_0x14ef51={},_0x420443={'count':0x0,'rows':[]};var _0x53d535=_[_0xf323('0x36')](db[_0xf323('0x37')]['rawAttributes'],function(_0x3768c){return{'name':_0x3768c['fieldName'],'type':_0x3768c[_0xf323('0x38')][_0xf323('0x39')]};});_0x14ef51[_0xf323('0x3a')]=_[_0xf323('0x36')](_0x53d535,'name');_0x14ef51[_0xf323('0x3b')]=_[_0xf323('0x3c')](_0x526fbc[_0xf323('0x3b')]);_0x14ef51[_0xf323('0x3d')]=_[_0xf323('0x3e')](_0x14ef51['model'],_0x14ef51['query']);_0x40380a[_0xf323('0x3f')]=_[_0xf323('0x3e')](_0x14ef51[_0xf323('0x3a')],qs[_0xf323('0x40')](_0x526fbc[_0xf323('0x3b')][_0xf323('0x40')]));_0x40380a[_0xf323('0x3f')]=_0x40380a[_0xf323('0x3f')][_0xf323('0x41')]?_0x40380a[_0xf323('0x3f')]:_0x14ef51['model'];if(!_0x526fbc[_0xf323('0x3b')][_0xf323('0x42')](_0xf323('0x43'))){_0x40380a[_0xf323('0x44')]=qs[_0xf323('0x44')](_0x526fbc[_0xf323('0x3b')][_0xf323('0x44')]);_0x40380a['offset']=qs[_0xf323('0x28')](_0x526fbc[_0xf323('0x3b')][_0xf323('0x28')]);}_0x40380a[_0xf323('0x45')]=qs[_0xf323('0x46')](_0x526fbc[_0xf323('0x3b')][_0xf323('0x46')]);_0x40380a[_0xf323('0x47')]=qs[_0xf323('0x3d')](_[_0xf323('0x48')](_0x526fbc[_0xf323('0x3b')],_0x14ef51[_0xf323('0x3d')]),_0x53d535);if(_0x526fbc[_0xf323('0x3b')][_0xf323('0x49')]){_0x40380a[_0xf323('0x47')]=_[_0xf323('0x4a')](_0x40380a['where'],{'$or':_[_0xf323('0x36')](_0x53d535,function(_0x542ede){if(_0x542ede[_0xf323('0x38')]!==_0xf323('0x4b')){var _0x12accf={};_0x12accf[_0x542ede['name']]={'$like':'%'+_0x526fbc[_0xf323('0x3b')][_0xf323('0x49')]+'%'};return _0x12accf;}})});}_0x40380a=_[_0xf323('0x4a')]({},_0x40380a,_0x526fbc[_0xf323('0x4c')]);var _0x41f7ad={'where':_0x40380a[_0xf323('0x47')]};return db[_0xf323('0x37')]['count'](_0x41f7ad)[_0xf323('0x30')](function(_0x3502e3){_0x420443[_0xf323('0x2a')]=_0x3502e3;if(_0x526fbc['query'][_0xf323('0x4d')]){_0x40380a[_0xf323('0x4e')]=[{'all':!![]}];}return db[_0xf323('0x37')][_0xf323('0x4f')](_0x40380a);})[_0xf323('0x30')](function(_0x5238ae){_0x420443['rows']=_0x5238ae;return _0x420443;})['then'](respondWithFilteredResult(_0x1f1dcd,_0x40380a))[_0xf323('0x23')](handleError(_0x1f1dcd,null));};exports[_0xf323('0x50')]=function(_0x496fc3,_0x1a75c4){var _0x222a4d={'raw':![],'where':{'id':_0x496fc3[_0xf323('0x51')]['id']}},_0x2000b5={};_0x2000b5[_0xf323('0x3a')]=_['keys'](db[_0xf323('0x37')][_0xf323('0x52')]);_0x2000b5[_0xf323('0x3b')]=_['keys'](_0x496fc3[_0xf323('0x3b')]);_0x2000b5[_0xf323('0x3d')]=_['intersection'](_0x2000b5[_0xf323('0x3a')],_0x2000b5[_0xf323('0x3b')]);_0x222a4d['attributes']=_['intersection'](_0x2000b5[_0xf323('0x3a')],qs[_0xf323('0x40')](_0x496fc3[_0xf323('0x3b')]['fields']));_0x222a4d[_0xf323('0x3f')]=_0x222a4d['attributes'][_0xf323('0x41')]?_0x222a4d[_0xf323('0x3f')]:_0x2000b5[_0xf323('0x3a')];if(_0x496fc3[_0xf323('0x3b')][_0xf323('0x4d')]){_0x222a4d[_0xf323('0x4e')]=[{'all':!![]}];}_0x222a4d=_[_0xf323('0x4a')]({},_0x222a4d,_0x496fc3[_0xf323('0x4c')]);return db['Setting'][_0xf323('0x53')](_0x222a4d)[_0xf323('0x30')](handleEntityNotFound(_0x1a75c4,null))['then'](respondWithResult(_0x1a75c4,null))[_0xf323('0x23')](handleError(_0x1a75c4,null));};exports[_0xf323('0x2f')]=function(_0x59c846,_0x2e1434){if(_0x59c846[_0xf323('0x54')]['id']){delete _0x59c846['body']['id'];}return db[_0xf323('0x37')][_0xf323('0x53')]({'where':{'id':_0x59c846[_0xf323('0x51')]['id']}})[_0xf323('0x30')](handleEntityNotFound(_0x2e1434,null))[_0xf323('0x30')](saveUpdates(_0x59c846[_0xf323('0x54')],null))[_0xf323('0x30')](respondWithResult(_0x2e1434,null))[_0xf323('0x23')](handleError(_0x2e1434,null));};exports[_0xf323('0x55')]=function(_0x598269,_0x523a5f,_0x154fb3){if(_0x598269[_0xf323('0x56')]&&_0x598269[_0xf323('0x56')][_0xf323('0x57')]){_0x598269['body'][_0xf323('0x58')]=_0x598269[_0xf323('0x56')][_0xf323('0x57')];}return db[_0xf323('0x37')][_0xf323('0x53')]({'where':{'id':_0x598269['params']['id']}})['then'](handleEntityNotFound(_0x523a5f,null))['then'](saveUpdates(_0x598269['body'],null))['then'](respondWithResult(_0x523a5f,null))[_0xf323('0x23')](handleError(_0x523a5f,null));};exports['addLogoLogin']=function(_0x2e1593,_0x448f99,_0x52ca3a){if(_0x2e1593[_0xf323('0x56')]&&_0x2e1593[_0xf323('0x56')][_0xf323('0x57')]){_0x2e1593[_0xf323('0x54')]['loginLogo']=_0x2e1593['file'][_0xf323('0x57')];}return db['Setting'][_0xf323('0x53')]({'where':{'id':_0x2e1593[_0xf323('0x51')]['id']}})[_0xf323('0x30')](handleEntityNotFound(_0x448f99,null))[_0xf323('0x30')](saveUpdates(_0x2e1593[_0xf323('0x54')],null))['then'](respondWithResult(_0x448f99,null))[_0xf323('0x23')](handleError(_0x448f99,null));};var utilLicense=require(_0xf323('0x15'));exports[_0xf323('0x59')]=function(_0x253d06,_0x51af2f,_0x138ce9){var _0xaac4d0=_0xf323('0x5a');var _0x139262={'custom':![]};return utilLicense[_0xf323('0x5b')]()['then'](function(_0x34d001){if(_0x34d001){_0x139262=_0x34d001;}return db[_0xf323('0x37')][_0xf323('0x53')]({'where':{'id':_0x253d06[_0xf323('0x51')]['id']},'attributes':[_0xf323('0x58'),_0xf323('0x5c'),'preferred',_0xf323('0x5d'),'defaultLogo',_0xf323('0x5e'),_0xf323('0x5f'),_0xf323('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x51af2f,null))[_0xf323('0x30')](function(_0x38c4fb){if(_0x38c4fb){var _0x4be4c7=_0x38c4fb[_0xf323('0x58')]&&fs[_0xf323('0x61')](path[_0xf323('0x62')](config['root'],_0xaac4d0,_[_0xf323('0x63')](_0x38c4fb[_0xf323('0x58')])))?path['join'](config[_0xf323('0x64')],_0xaac4d0,_[_0xf323('0x63')](_0x38c4fb[_0xf323('0x58')])):path[_0xf323('0x62')](config[_0xf323('0x64')],_0xaac4d0,_['toLower'](_0xf323('0x65')));var _0x167166=_0xf323('0x66')+_[_0xf323('0x67')](_0xf323('0x58'));if(_0x38c4fb[_0x167166]||!_0x139262[_0xf323('0x68')]){_0x4be4c7=path[_0xf323('0x62')](config[_0xf323('0x64')],_0xaac4d0,_[_0xf323('0x63')]('default_logo.svg'));}if(!fs['existsSync'](_0x4be4c7)){throw new db[(_0xf323('0x69'))][(_0xf323('0x6a'))](_[_0xf323('0x67')](_0xf323('0x58'))+_0xf323('0x6b'));}return _0x51af2f[_0xf323('0x6c')](_0x4be4c7);}})[_0xf323('0x23')](handleError(_0x51af2f,null));};var utilLicense=require(_0xf323('0x15'));exports[_0xf323('0x6d')]=function(_0x3e7110,_0x2e9fef,_0x50a1b2){var _0x3a2e65='server/files/images/logos';var _0x4b79c1={'custom':![]};return utilLicense[_0xf323('0x5b')]()[_0xf323('0x30')](function(_0x4d816c){if(_0x4d816c){_0x4b79c1=_0x4d816c;}return db[_0xf323('0x37')][_0xf323('0x53')]({'where':{'id':_0x3e7110[_0xf323('0x51')]['id']},'attributes':[_0xf323('0x58'),'loginLogo',_0xf323('0x6e'),_0xf323('0x5d'),_0xf323('0x6f'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xf323('0x30')](handleEntityNotFound(_0x2e9fef,null))[_0xf323('0x30')](function(_0x2519ec){if(_0x2519ec){var _0x17ec3f=_0x2519ec[_0xf323('0x5c')]&&fs[_0xf323('0x61')](path[_0xf323('0x62')](config['root'],_0x3a2e65,_[_0xf323('0x63')](_0x2519ec[_0xf323('0x5c')])))?path[_0xf323('0x62')](config[_0xf323('0x64')],_0x3a2e65,_['toLower'](_0x2519ec[_0xf323('0x5c')])):path['join'](config[_0xf323('0x64')],_0x3a2e65,_[_0xf323('0x63')](_0xf323('0x70')));var _0x4bcacd='default'+_[_0xf323('0x67')](_0xf323('0x5c'));if(_0x2519ec[_0x4bcacd]||!_0x4b79c1['custom']){_0x17ec3f=path[_0xf323('0x62')](config[_0xf323('0x64')],_0x3a2e65,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xf323('0x61')](_0x17ec3f)){throw new db[(_0xf323('0x69'))][(_0xf323('0x6a'))](_['upperFirst'](_0xf323('0x5c'))+_0xf323('0x6b'));}return _0x2e9fef[_0xf323('0x6c')](_0x17ec3f);}})[_0xf323('0x23')](handleError(_0x2e9fef,null));};exports['gdpr']=function(_0x1602dd,_0x39fb37){return db[_0xf323('0x37')][_0xf323('0x53')]({'where':{'id':_0x1602dd[_0xf323('0x51')]['id']},'attributes':[_0xf323('0x71')]})[_0xf323('0x30')](respondWithResult(_0x39fb37,null))[_0xf323('0x23')](handleError(_0x39fb37,null));};exports[_0xf323('0x72')]=function(_0x557d1a,_0x230735,_0x1a7e32){if(_0x557d1a[_0xf323('0x56')]&&_0x557d1a['file'][_0xf323('0x57')]){_0x557d1a['body'][_0xf323('0x6e')]=_0x557d1a[_0xf323('0x56')]['filename'];}return db[_0xf323('0x37')]['find']({'where':{'id':_0x557d1a['params']['id']}})[_0xf323('0x30')](handleEntityNotFound(_0x230735,null))[_0xf323('0x30')](saveUpdates(_0x557d1a['body'],null))[_0xf323('0x30')](respondWithResult(_0x230735,null))[_0xf323('0x23')](handleError(_0x230735,null));};var utilLicense=require(_0xf323('0x15'));exports['getPreferred']=function(_0x152860,_0x4adb24,_0x5bac0c){var _0x7ff447='server/files/images/logos';var _0x58d82f={'custom':![]};return utilLicense['getLicense']()[_0xf323('0x30')](function(_0x199b25){if(_0x199b25){_0x58d82f=_0x199b25;}return db[_0xf323('0x37')][_0xf323('0x53')]({'where':{'id':_0x152860[_0xf323('0x51')]['id']},'attributes':[_0xf323('0x58'),_0xf323('0x5c'),_0xf323('0x6e'),'favicon',_0xf323('0x6f'),_0xf323('0x5e'),'defaultPreferred',_0xf323('0x60')],'raw':!![]});})[_0xf323('0x30')](handleEntityNotFound(_0x4adb24,null))['then'](function(_0x5d9f09){if(_0x5d9f09){var _0x41cbd8=_0x5d9f09['preferred']&&fs[_0xf323('0x61')](path[_0xf323('0x62')](config[_0xf323('0x64')],_0x7ff447,_[_0xf323('0x63')](_0x5d9f09['preferred'])))?path[_0xf323('0x62')](config[_0xf323('0x64')],_0x7ff447,_['toLower'](_0x5d9f09[_0xf323('0x6e')])):path[_0xf323('0x62')](config[_0xf323('0x64')],_0x7ff447,_['toLower'](_0xf323('0x73')));var _0x2fce69='default'+_[_0xf323('0x67')]('preferred');if(_0x5d9f09[_0x2fce69]||!_0x58d82f[_0xf323('0x68')]||!_0x58d82f[_0xf323('0x6e')]){_0x41cbd8=path['join'](config[_0xf323('0x64')],_0x7ff447,_[_0xf323('0x63')](_0xf323('0x73')));}if(!fs[_0xf323('0x61')](_0x41cbd8)){throw new db[(_0xf323('0x69'))][(_0xf323('0x6a'))](_[_0xf323('0x67')]('preferred')+'\x20not\x20found');}return _0x4adb24[_0xf323('0x6c')](_0x41cbd8);}})[_0xf323('0x23')](handleError(_0x4adb24,null));};exports['addFavicon']=function(_0x43ddb5,_0xacdbbc,_0x34df6a){if(_0x43ddb5[_0xf323('0x56')]&&_0x43ddb5[_0xf323('0x56')][_0xf323('0x57')]){_0x43ddb5[_0xf323('0x54')][_0xf323('0x5d')]=_0x43ddb5['file']['filename'];}return db[_0xf323('0x37')][_0xf323('0x53')]({'where':{'id':_0x43ddb5[_0xf323('0x51')]['id']}})[_0xf323('0x30')](handleEntityNotFound(_0xacdbbc,null))[_0xf323('0x30')](saveUpdates(_0x43ddb5[_0xf323('0x54')],null))['then'](respondWithResult(_0xacdbbc,null))['catch'](handleError(_0xacdbbc,null));};var utilLicense=require(_0xf323('0x15'));exports[_0xf323('0x74')]=function(_0x4001f7,_0x5a779a,_0x1b8be9){var _0x5b1452=_0xf323('0x5a');var _0x4cac39={'custom':![]};return utilLicense['getLicense']()[_0xf323('0x30')](function(_0x5452c1){if(_0x5452c1){_0x4cac39=_0x5452c1;}return db[_0xf323('0x37')][_0xf323('0x53')]({'where':{'id':_0x4001f7[_0xf323('0x51')]['id']},'attributes':[_0xf323('0x58'),_0xf323('0x5c'),_0xf323('0x6e'),_0xf323('0x5d'),_0xf323('0x6f'),_0xf323('0x5e'),_0xf323('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5a779a,null))['then'](function(_0x3f9f86){if(_0x3f9f86){var _0x318410=_0x3f9f86[_0xf323('0x5d')]&&fs[_0xf323('0x61')](path['join'](config[_0xf323('0x64')],_0x5b1452,_['toLower'](_0x3f9f86[_0xf323('0x5d')])))?path['join'](config[_0xf323('0x64')],_0x5b1452,_['toLower'](_0x3f9f86[_0xf323('0x5d')])):path[_0xf323('0x62')](config[_0xf323('0x64')],_0x5b1452,_[_0xf323('0x63')](_0xf323('0x75')));var _0x29a898=_0xf323('0x66')+_['upperFirst']('favicon');if(_0x3f9f86[_0x29a898]||!_0x4cac39['custom']){_0x318410=path[_0xf323('0x62')](config['root'],_0x5b1452,_[_0xf323('0x63')](_0xf323('0x75')));}if(!fs[_0xf323('0x61')](_0x318410)){throw new db[(_0xf323('0x69'))][(_0xf323('0x6a'))](_['upperFirst']('favicon')+_0xf323('0x6b'));}return _0x5a779a[_0xf323('0x6c')](_0x318410);}})['catch'](handleError(_0x5a779a,null));};exports[_0xf323('0x76')]=function(_0x24c523,_0x171c1c){var _0x4c1bad={'offset':moment()[_0xf323('0x77')]()};_0x4c1bad['now']=moment()[_0xf323('0x77')](_0x4c1bad['offset'])[_0xf323('0x78')](_0xf323('0x79'));return _0x171c1c[_0xf323('0x25')](0xc8)[_0xf323('0x34')](_0x4c1bad);}; \ No newline at end of file +var _0x782b=['stringify','error','message','result','catch','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','destroy','then','sendStatus','stack','name','index','Setting','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','length','find','body','file','filename','params','getLicense','loginLogo','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','favicon','defaultLogo','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x782b,0xd1));var _0xb782=function(_0x513f04,_0x979225){_0x513f04=_0x513f04-0x0;var _0x4498f2=_0x782b[_0x513f04];return _0x4498f2;};'use strict';var emlformat=require(_0xb782('0x0'));var rimraf=require(_0xb782('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb782('0x2'));var rp=require(_0xb782('0x3'));var moment=require('moment');var BPromise=require(_0xb782('0x4'));var Mustache=require(_0xb782('0x5'));var util=require('util');var path=require(_0xb782('0x6'));var sox=require('sox');var csv=require(_0xb782('0x7'));var ejs=require(_0xb782('0x8'));var fs=require('fs');var fs_extra=require(_0xb782('0x9'));var _=require(_0xb782('0xa'));var squel=require(_0xb782('0xb'));var crypto=require(_0xb782('0xc'));var jsforce=require(_0xb782('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb782('0x7'));var querystring=require(_0xb782('0xe'));var Papa=require(_0xb782('0xf'));var Redis=require(_0xb782('0x10'));var authService=require(_0xb782('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb782('0x12'));var logger=require(_0xb782('0x13'))(_0xb782('0x14'));var utils=require(_0xb782('0x15'));var config=require(_0xb782('0x16'));var licenseUtil=require(_0xb782('0x17'));var db=require(_0xb782('0x18'))['db'];var jayson=require(_0xb782('0x19'));var client=jayson[_0xb782('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf2cc,_0x528d0c,_0x2eb944,_0x4cb133){return new BPromise(function(_0xe4e4fc,_0x406827){var _0x51983b=_0x4cb133||client;return _0x51983b[_0xb782('0x1b')](_0x5cf2cc,_0x2eb944)['then'](function(_0x13485c){logger[_0xb782('0x1c')](_0xb782('0x1d'),_0x528d0c,_0xb782('0x1e'));logger[_0xb782('0x1f')](_0xb782('0x20'),_0x528d0c,_0xb782('0x1e'),JSON[_0xb782('0x21')](_0x13485c));if(_0x13485c['error']){if(_0x13485c[_0xb782('0x22')]['code']===0x1f4){logger[_0xb782('0x22')](_0xb782('0x1d'),_0x528d0c,_0x13485c['error'][_0xb782('0x23')]);return _0x406827(_0x13485c[_0xb782('0x22')][_0xb782('0x23')]);}logger['error'](_0xb782('0x1d'),_0x528d0c,_0x13485c['error'][_0xb782('0x23')]);return _0xe4e4fc(_0x13485c[_0xb782('0x22')][_0xb782('0x23')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x528d0c,_0xb782('0x1e'));_0xe4e4fc(_0x13485c[_0xb782('0x24')][_0xb782('0x23')]);}})[_0xb782('0x25')](function(_0x2487a5){logger[_0xb782('0x22')](_0xb782('0x1d'),_0x528d0c,_0x2487a5);_0x406827(_0x2487a5);});});}function respondWithStatusCode(_0xee5de,_0x2a86f3){_0x2a86f3=_0x2a86f3||0xcc;return function(_0x29990b){if(_0x29990b){return _0xee5de['sendStatus'](_0x2a86f3);}return _0xee5de[_0xb782('0x26')](_0x2a86f3)[_0xb782('0x27')]();};}function respondWithResult(_0x2561d5,_0x413d72){_0x413d72=_0x413d72||0xc8;return function(_0x10a478){if(_0x10a478){return _0x2561d5[_0xb782('0x26')](_0x413d72)['json'](_0x10a478);}};}function respondWithFilteredResult(_0x459bef,_0x50d8db){return function(_0x548fd5){if(_0x548fd5){var _0x560269=typeof _0x50d8db[_0xb782('0x28')]==='undefined'&&typeof _0x50d8db[_0xb782('0x29')]===_0xb782('0x2a');var _0x4af637=_0x548fd5[_0xb782('0x2b')];var _0x24db64=_0x560269?0x0:_0x50d8db[_0xb782('0x28')];var _0x2829d5=_0x560269?_0x548fd5['count']:_0x50d8db['offset']+_0x50d8db[_0xb782('0x29')];var _0x282eb4;if(_0x2829d5>=_0x4af637){_0x2829d5=_0x4af637;_0x282eb4=0xc8;}else{_0x282eb4=0xce;}_0x459bef[_0xb782('0x26')](_0x282eb4);return _0x459bef['set'](_0xb782('0x2c'),_0x24db64+'-'+_0x2829d5+'/'+_0x4af637)[_0xb782('0x2d')](_0x548fd5);}return null;};}function patchUpdates(_0x3bad12){return function(_0x56b4e7){try{jsonpatch['apply'](_0x56b4e7,_0x3bad12,!![]);}catch(_0x595c60){return BPromise[_0xb782('0x2e')](_0x595c60);}return _0x56b4e7[_0xb782('0x2f')]();};}function saveUpdates(_0x5a8320,_0x39ad7a){return function(_0x18db4b){if(_0x18db4b){return _0x18db4b[_0xb782('0x30')](_0x5a8320)['then'](function(_0x4d3d01){return _0x4d3d01;});}return null;};}function removeEntity(_0x14c8b6,_0xf77691){return function(_0x1cad38){if(_0x1cad38){return _0x1cad38[_0xb782('0x31')]()[_0xb782('0x32')](function(){_0x14c8b6[_0xb782('0x26')](0xcc)[_0xb782('0x27')]();});}};}function handleEntityNotFound(_0x3aac11,_0x5924d6){return function(_0xb79fff){if(!_0xb79fff){_0x3aac11[_0xb782('0x33')](0x194);}return _0xb79fff;};}function handleError(_0x54a57f,_0x1b5926){_0x1b5926=_0x1b5926||0x1f4;return function(_0x45bfeb){logger['error'](_0x45bfeb[_0xb782('0x34')]);if(_0x45bfeb[_0xb782('0x35')]){delete _0x45bfeb[_0xb782('0x35')];}_0x54a57f[_0xb782('0x26')](_0x1b5926)['send'](_0x45bfeb);};}exports[_0xb782('0x36')]=function(_0xc1fc3,_0x5925fe){var _0x5c272f={},_0x5de8c6={},_0x5f3946={'count':0x0,'rows':[]};var _0x31c207=_['map'](db[_0xb782('0x37')][_0xb782('0x38')],function(_0x2af98a){return{'name':_0x2af98a['fieldName'],'type':_0x2af98a[_0xb782('0x39')][_0xb782('0x3a')]};});_0x5de8c6[_0xb782('0x3b')]=_[_0xb782('0x3c')](_0x31c207,'name');_0x5de8c6[_0xb782('0x3d')]=_[_0xb782('0x3e')](_0xc1fc3[_0xb782('0x3d')]);_0x5de8c6[_0xb782('0x3f')]=_['intersection'](_0x5de8c6[_0xb782('0x3b')],_0x5de8c6[_0xb782('0x3d')]);_0x5c272f[_0xb782('0x40')]=_[_0xb782('0x41')](_0x5de8c6[_0xb782('0x3b')],qs[_0xb782('0x42')](_0xc1fc3[_0xb782('0x3d')][_0xb782('0x42')]));_0x5c272f['attributes']=_0x5c272f[_0xb782('0x40')]['length']?_0x5c272f[_0xb782('0x40')]:_0x5de8c6[_0xb782('0x3b')];if(!_0xc1fc3[_0xb782('0x3d')][_0xb782('0x43')](_0xb782('0x44'))){_0x5c272f['limit']=qs[_0xb782('0x29')](_0xc1fc3[_0xb782('0x3d')][_0xb782('0x29')]);_0x5c272f[_0xb782('0x28')]=qs['offset'](_0xc1fc3[_0xb782('0x3d')]['offset']);}_0x5c272f['order']=qs[_0xb782('0x45')](_0xc1fc3[_0xb782('0x3d')][_0xb782('0x45')]);_0x5c272f['where']=qs[_0xb782('0x3f')](_['pick'](_0xc1fc3[_0xb782('0x3d')],_0x5de8c6['filters']),_0x31c207);if(_0xc1fc3[_0xb782('0x3d')]['filter']){_0x5c272f[_0xb782('0x46')]=_[_0xb782('0x47')](_0x5c272f[_0xb782('0x46')],{'$or':_[_0xb782('0x3c')](_0x31c207,function(_0x17de5f){if(_0x17de5f[_0xb782('0x39')]!==_0xb782('0x48')){var _0xa22a8a={};_0xa22a8a[_0x17de5f[_0xb782('0x35')]]={'$like':'%'+_0xc1fc3['query'][_0xb782('0x49')]+'%'};return _0xa22a8a;}})});}_0x5c272f=_['merge']({},_0x5c272f,_0xc1fc3[_0xb782('0x4a')]);var _0x3f103a={'where':_0x5c272f['where']};return db[_0xb782('0x37')][_0xb782('0x2b')](_0x3f103a)[_0xb782('0x32')](function(_0x5b796d){_0x5f3946[_0xb782('0x2b')]=_0x5b796d;if(_0xc1fc3[_0xb782('0x3d')][_0xb782('0x4b')]){_0x5c272f[_0xb782('0x4c')]=[{'all':!![]}];}return db[_0xb782('0x37')]['findAll'](_0x5c272f);})[_0xb782('0x32')](function(_0x1a8ce7){_0x5f3946[_0xb782('0x4d')]=_0x1a8ce7;return _0x5f3946;})['then'](respondWithFilteredResult(_0x5925fe,_0x5c272f))[_0xb782('0x25')](handleError(_0x5925fe,null));};exports[_0xb782('0x4e')]=function(_0x261f5d,_0x48b153){var _0x3b28dc={'raw':![],'where':{'id':_0x261f5d['params']['id']}},_0x4ed591={};_0x4ed591[_0xb782('0x3b')]=_[_0xb782('0x3e')](db[_0xb782('0x37')][_0xb782('0x38')]);_0x4ed591[_0xb782('0x3d')]=_[_0xb782('0x3e')](_0x261f5d['query']);_0x4ed591[_0xb782('0x3f')]=_[_0xb782('0x41')](_0x4ed591[_0xb782('0x3b')],_0x4ed591[_0xb782('0x3d')]);_0x3b28dc[_0xb782('0x40')]=_[_0xb782('0x41')](_0x4ed591[_0xb782('0x3b')],qs[_0xb782('0x42')](_0x261f5d[_0xb782('0x3d')]['fields']));_0x3b28dc[_0xb782('0x40')]=_0x3b28dc[_0xb782('0x40')][_0xb782('0x4f')]?_0x3b28dc['attributes']:_0x4ed591['model'];if(_0x261f5d['query'][_0xb782('0x4b')]){_0x3b28dc[_0xb782('0x4c')]=[{'all':!![]}];}_0x3b28dc=_[_0xb782('0x47')]({},_0x3b28dc,_0x261f5d['options']);return db[_0xb782('0x37')][_0xb782('0x50')](_0x3b28dc)[_0xb782('0x32')](handleEntityNotFound(_0x48b153,null))[_0xb782('0x32')](respondWithResult(_0x48b153,null))['catch'](handleError(_0x48b153,null));};exports[_0xb782('0x30')]=function(_0xabf218,_0xb75f32){if(_0xabf218[_0xb782('0x51')]['id']){delete _0xabf218[_0xb782('0x51')]['id'];}return db[_0xb782('0x37')]['find']({'where':{'id':_0xabf218['params']['id']}})[_0xb782('0x32')](handleEntityNotFound(_0xb75f32,null))[_0xb782('0x32')](saveUpdates(_0xabf218[_0xb782('0x51')],null))[_0xb782('0x32')](respondWithResult(_0xb75f32,null))['catch'](handleError(_0xb75f32,null));};exports['addLogo']=function(_0xd06286,_0x12fa9e,_0x2c0ac5){if(_0xd06286[_0xb782('0x52')]&&_0xd06286[_0xb782('0x52')][_0xb782('0x53')]){_0xd06286['body']['logo']=_0xd06286['file'][_0xb782('0x53')];}return db[_0xb782('0x37')]['find']({'where':{'id':_0xd06286[_0xb782('0x54')]['id']}})[_0xb782('0x32')](handleEntityNotFound(_0x12fa9e,null))[_0xb782('0x32')](saveUpdates(_0xd06286[_0xb782('0x51')],null))[_0xb782('0x32')](respondWithResult(_0x12fa9e,null))['catch'](handleError(_0x12fa9e,null));};exports['addLogoLogin']=function(_0xaed303,_0x587a85,_0x3ca733){if(_0xaed303[_0xb782('0x52')]&&_0xaed303[_0xb782('0x52')][_0xb782('0x53')]){_0xaed303['body']['loginLogo']=_0xaed303[_0xb782('0x52')]['filename'];}return db['Setting'][_0xb782('0x50')]({'where':{'id':_0xaed303[_0xb782('0x54')]['id']}})[_0xb782('0x32')](handleEntityNotFound(_0x587a85,null))[_0xb782('0x32')](saveUpdates(_0xaed303['body'],null))[_0xb782('0x32')](respondWithResult(_0x587a85,null))[_0xb782('0x25')](handleError(_0x587a85,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x2ccc36,_0xb55b08,_0x2c8cab){var _0x18f795='server/files/images/logos';var _0x1a8dd4={'custom':![]};return utilLicense[_0xb782('0x55')]()[_0xb782('0x32')](function(_0x3122f2){if(_0x3122f2){_0x1a8dd4=_0x3122f2;}return db[_0xb782('0x37')]['find']({'where':{'id':_0x2ccc36[_0xb782('0x54')]['id']},'attributes':['logo',_0xb782('0x56'),_0xb782('0x57'),'favicon','defaultLogo',_0xb782('0x58'),_0xb782('0x59'),_0xb782('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0xb55b08,null))[_0xb782('0x32')](function(_0x40db1a){if(_0x40db1a){var _0x36c877=_0x40db1a[_0xb782('0x5b')]&&fs[_0xb782('0x5c')](path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x18f795,_['toLower'](_0x40db1a[_0xb782('0x5b')])))?path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x18f795,_[_0xb782('0x5f')](_0x40db1a[_0xb782('0x5b')])):path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x18f795,_['toLower']('default_logo.svg'));var _0x4958fb=_0xb782('0x60')+_[_0xb782('0x61')](_0xb782('0x5b'));if(_0x40db1a[_0x4958fb]||!_0x1a8dd4[_0xb782('0x62')]){_0x36c877=path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x18f795,_[_0xb782('0x5f')](_0xb782('0x63')));}if(!fs[_0xb782('0x5c')](_0x36c877)){throw new db[(_0xb782('0x64'))][(_0xb782('0x65'))](_[_0xb782('0x61')](_0xb782('0x5b'))+_0xb782('0x66'));}return _0xb55b08[_0xb782('0x67')](_0x36c877);}})[_0xb782('0x25')](handleError(_0xb55b08,null));};var utilLicense=require(_0xb782('0x17'));exports[_0xb782('0x68')]=function(_0xf380b5,_0xd75583,_0x504757){var _0x2f3c6f=_0xb782('0x69');var _0x272277={'custom':![]};return utilLicense[_0xb782('0x55')]()[_0xb782('0x32')](function(_0x15f67b){if(_0x15f67b){_0x272277=_0x15f67b;}return db[_0xb782('0x37')][_0xb782('0x50')]({'where':{'id':_0xf380b5['params']['id']},'attributes':[_0xb782('0x5b'),_0xb782('0x56'),_0xb782('0x57'),_0xb782('0x6a'),_0xb782('0x6b'),_0xb782('0x58'),'defaultPreferred',_0xb782('0x5a')],'raw':!![]});})[_0xb782('0x32')](handleEntityNotFound(_0xd75583,null))[_0xb782('0x32')](function(_0x1f41f5){if(_0x1f41f5){var _0x31d7e3=_0x1f41f5[_0xb782('0x56')]&&fs[_0xb782('0x5c')](path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x2f3c6f,_[_0xb782('0x5f')](_0x1f41f5['loginLogo'])))?path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x2f3c6f,_['toLower'](_0x1f41f5[_0xb782('0x56')])):path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x2f3c6f,_[_0xb782('0x5f')](_0xb782('0x6c')));var _0x2eb8b9=_0xb782('0x60')+_[_0xb782('0x61')](_0xb782('0x56'));if(_0x1f41f5[_0x2eb8b9]||!_0x272277[_0xb782('0x62')]){_0x31d7e3=path[_0xb782('0x5d')](config['root'],_0x2f3c6f,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x31d7e3)){throw new db[(_0xb782('0x64'))][(_0xb782('0x65'))](_['upperFirst']('loginLogo')+_0xb782('0x66'));}return _0xd75583[_0xb782('0x67')](_0x31d7e3);}})[_0xb782('0x25')](handleError(_0xd75583,null));};exports[_0xb782('0x6d')]=function(_0x39b394,_0x2d7611){return db[_0xb782('0x37')]['find']({'where':{'id':_0x39b394[_0xb782('0x54')]['id']},'attributes':[_0xb782('0x6e')]})['then'](respondWithResult(_0x2d7611,null))['catch'](handleError(_0x2d7611,null));};exports[_0xb782('0x6f')]=function(_0x5f461b,_0x241e38,_0x37f97d){if(_0x5f461b['file']&&_0x5f461b[_0xb782('0x52')][_0xb782('0x53')]){_0x5f461b[_0xb782('0x51')][_0xb782('0x57')]=_0x5f461b['file']['filename'];}return db[_0xb782('0x37')]['find']({'where':{'id':_0x5f461b['params']['id']}})[_0xb782('0x32')](handleEntityNotFound(_0x241e38,null))['then'](saveUpdates(_0x5f461b[_0xb782('0x51')],null))[_0xb782('0x32')](respondWithResult(_0x241e38,null))[_0xb782('0x25')](handleError(_0x241e38,null));};var utilLicense=require(_0xb782('0x17'));exports[_0xb782('0x70')]=function(_0x42c7c6,_0x3179f0,_0x110918){var _0xb42529=_0xb782('0x69');var _0x531a87={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x53b3dc){if(_0x53b3dc){_0x531a87=_0x53b3dc;}return db['Setting']['find']({'where':{'id':_0x42c7c6[_0xb782('0x54')]['id']},'attributes':[_0xb782('0x5b'),_0xb782('0x56'),_0xb782('0x57'),_0xb782('0x6a'),_0xb782('0x6b'),_0xb782('0x58'),_0xb782('0x59'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3179f0,null))['then'](function(_0x5b2326){if(_0x5b2326){var _0x226690=_0x5b2326[_0xb782('0x57')]&&fs[_0xb782('0x5c')](path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0xb42529,_[_0xb782('0x5f')](_0x5b2326[_0xb782('0x57')])))?path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0xb42529,_['toLower'](_0x5b2326[_0xb782('0x57')])):path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0xb42529,_['toLower'](_0xb782('0x71')));var _0xb9f2=_0xb782('0x60')+_[_0xb782('0x61')](_0xb782('0x57'));if(_0x5b2326[_0xb9f2]||!_0x531a87[_0xb782('0x62')]||!_0x531a87[_0xb782('0x57')]){_0x226690=path[_0xb782('0x5d')](config['root'],_0xb42529,_['toLower']('default_preferred.png'));}if(!fs[_0xb782('0x5c')](_0x226690)){throw new db[(_0xb782('0x64'))]['ValidationError'](_['upperFirst'](_0xb782('0x57'))+_0xb782('0x66'));}return _0x3179f0['download'](_0x226690);}})[_0xb782('0x25')](handleError(_0x3179f0,null));};exports['addFavicon']=function(_0x4ba9b9,_0x17f281,_0x25a1d9){if(_0x4ba9b9['file']&&_0x4ba9b9[_0xb782('0x52')]['filename']){_0x4ba9b9['body'][_0xb782('0x6a')]=_0x4ba9b9[_0xb782('0x52')][_0xb782('0x53')];}return db['Setting'][_0xb782('0x50')]({'where':{'id':_0x4ba9b9[_0xb782('0x54')]['id']}})[_0xb782('0x32')](handleEntityNotFound(_0x17f281,null))[_0xb782('0x32')](saveUpdates(_0x4ba9b9[_0xb782('0x51')],null))[_0xb782('0x32')](respondWithResult(_0x17f281,null))[_0xb782('0x25')](handleError(_0x17f281,null));};var utilLicense=require('../../config/license/util');exports[_0xb782('0x72')]=function(_0x334b24,_0x4ee2e9,_0x599e98){var _0x216a21=_0xb782('0x69');var _0x4e3187={'custom':![]};return utilLicense[_0xb782('0x55')]()[_0xb782('0x32')](function(_0x141cb7){if(_0x141cb7){_0x4e3187=_0x141cb7;}return db[_0xb782('0x37')][_0xb782('0x50')]({'where':{'id':_0x334b24['params']['id']},'attributes':[_0xb782('0x5b'),_0xb782('0x56'),_0xb782('0x57'),_0xb782('0x6a'),_0xb782('0x6b'),_0xb782('0x58'),_0xb782('0x59'),_0xb782('0x5a')],'raw':!![]});})[_0xb782('0x32')](handleEntityNotFound(_0x4ee2e9,null))[_0xb782('0x32')](function(_0xc21766){if(_0xc21766){var _0x532857=_0xc21766['favicon']&&fs['existsSync'](path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x216a21,_[_0xb782('0x5f')](_0xc21766[_0xb782('0x6a')])))?path[_0xb782('0x5d')](config['root'],_0x216a21,_[_0xb782('0x5f')](_0xc21766[_0xb782('0x6a')])):path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x216a21,_[_0xb782('0x5f')](_0xb782('0x73')));var _0x549280='default'+_[_0xb782('0x61')](_0xb782('0x6a'));if(_0xc21766[_0x549280]||!_0x4e3187['custom']){_0x532857=path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x216a21,_[_0xb782('0x5f')](_0xb782('0x73')));}if(!fs[_0xb782('0x5c')](_0x532857)){throw new db[(_0xb782('0x64'))][(_0xb782('0x65'))](_[_0xb782('0x61')](_0xb782('0x6a'))+_0xb782('0x66'));}return _0x4ee2e9[_0xb782('0x67')](_0x532857);}})['catch'](handleError(_0x4ee2e9,null));};exports[_0xb782('0x74')]=function(_0x28642b,_0x430022){var _0x337aa0={'offset':moment()[_0xb782('0x75')]()};_0x337aa0[_0xb782('0x76')]=moment()[_0xb782('0x75')](_0x337aa0['offset'])[_0xb782('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x430022[_0xb782('0x26')](0xc8)[_0xb782('0x78')](_0x337aa0);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 0ed6825..a55647a 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x338263,_0x32aed4){var _0x23652c=function(_0x56fea3){while(--_0x56fea3){_0x338263['push'](_0x338263['shift']());}};_0x23652c(++_0x32aed4);}(_0x34e8,0x12c));var _0x834e=function(_0x42b8cb,_0x597c17){_0x42b8cb=_0x42b8cb-0x0;var _0x405480=_0x34e8[_0x42b8cb];return _0x405480;};'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/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index beb09f7..bafc4e7 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 _0xb2f6=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model'];(function(_0x3d7cc4,_0x47bc65){var _0x264015=function(_0x21ca80){while(--_0x21ca80){_0x3d7cc4['push'](_0x3d7cc4['shift']());}};_0x264015(++_0x47bc65);}(_0xb2f6,0x160));var _0x6b2f=function(_0x5a9050,_0x57e5a9){_0x5a9050=_0x5a9050-0x0;var _0x23839b=_0xb2f6[_0x5a9050];return _0x23839b;};'use strict';var _=require(_0x6b2f('0x0'));var util=require('util');var moment=require(_0x6b2f('0x1'));var BPromise=require(_0x6b2f('0x2'));var rs=require(_0x6b2f('0x3'));var fs=require('fs');var Redis=require(_0x6b2f('0x4'));var db=require(_0x6b2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b2f('0x6'))(_0x6b2f('0x7'));var config=require(_0x6b2f('0x8'));var jayson=require(_0x6b2f('0x9'));var client=jayson[_0x6b2f('0xa')][_0x6b2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51d303,_0x4bcbda,_0x138a4d){return new BPromise(function(_0x48b36a,_0x461d1f){return client[_0x6b2f('0xc')](_0x51d303,_0x138a4d)[_0x6b2f('0xd')](function(_0x2a0da4){logger[_0x6b2f('0xe')](_0x6b2f('0xf'),_0x4bcbda,_0x6b2f('0x10'));logger['debug'](_0x6b2f('0x11'),_0x4bcbda,_0x6b2f('0x10'),JSON[_0x6b2f('0x12')](_0x2a0da4));if(_0x2a0da4[_0x6b2f('0x13')]){if(_0x2a0da4['error']['code']===0x1f4){logger[_0x6b2f('0x13')](_0x6b2f('0xf'),_0x4bcbda,_0x2a0da4[_0x6b2f('0x13')][_0x6b2f('0x14')]);return _0x461d1f(_0x2a0da4[_0x6b2f('0x13')][_0x6b2f('0x14')]);}logger['error'](_0x6b2f('0xf'),_0x4bcbda,_0x2a0da4[_0x6b2f('0x13')][_0x6b2f('0x14')]);return _0x48b36a(_0x2a0da4['error'][_0x6b2f('0x14')]);}else{logger['info'](_0x6b2f('0xf'),_0x4bcbda,_0x6b2f('0x10'));_0x48b36a(_0x2a0da4[_0x6b2f('0x15')][_0x6b2f('0x14')]);}})['catch'](function(_0x3d4b8d){logger['error'](_0x6b2f('0xf'),_0x4bcbda,_0x3d4b8d);_0x461d1f(_0x3d4b8d);});});}exports[_0x6b2f('0x16')]=function(_0x487fa5){var _0x3245f1=this;return new Promise(function(_0x429364,_0x1d5604){return db[_0x6b2f('0x17')][_0x6b2f('0x18')]({'raw':_0x487fa5[_0x6b2f('0x19')]?_0x487fa5['options'][_0x6b2f('0x1a')]===undefined?!![]:![]:!![],'where':_0x487fa5[_0x6b2f('0x19')]?_0x487fa5[_0x6b2f('0x19')][_0x6b2f('0x1b')]||null:null,'attributes':_0x487fa5[_0x6b2f('0x19')]?_0x487fa5['options'][_0x6b2f('0x1c')]||null:null,'include':_0x487fa5[_0x6b2f('0x19')]?_0x487fa5[_0x6b2f('0x19')][_0x6b2f('0x1d')]?_[_0x6b2f('0x1e')](_0x487fa5['options'][_0x6b2f('0x1d')],function(_0x10e78c){return{'model':db[_0x10e78c[_0x6b2f('0x1f')]],'as':_0x10e78c['as'],'attributes':_0x10e78c[_0x6b2f('0x1c')],'include':_0x10e78c[_0x6b2f('0x1d')]?_[_0x6b2f('0x1e')](_0x10e78c[_0x6b2f('0x1d')],function(_0x52eed1){return{'model':db[_0x52eed1[_0x6b2f('0x1f')]],'as':_0x52eed1['as'],'attributes':_0x52eed1[_0x6b2f('0x1c')],'include':_0x52eed1['include']?_[_0x6b2f('0x1e')](_0x52eed1['include'],function(_0x173f34){return{'model':db[_0x173f34[_0x6b2f('0x1f')]],'as':_0x173f34['as'],'attributes':_0x173f34[_0x6b2f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6b2f('0xd')](function(_0x596cf9){logger[_0x6b2f('0xe')]('ShowSetting',_0x487fa5);logger['debug'](_0x6b2f('0x16'),_0x487fa5,JSON['stringify'](_0x596cf9));_0x429364(_0x596cf9);})['catch'](function(_0x162f3c){logger[_0x6b2f('0x13')](_0x6b2f('0x16'),_0x162f3c[_0x6b2f('0x14')],_0x487fa5);_0x1d5604(_0x3245f1[_0x6b2f('0x13')](0x1f4,_0x162f3c[_0x6b2f('0x14')]));});});}; \ No newline at end of file +var _0xcc56=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowSetting','Setting','find','options','raw','attributes','map','include','model','lodash','util','moment','bluebird'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0xcc56,0xa1));var _0x6cc5=function(_0x154f39,_0x2ae186){_0x154f39=_0x154f39-0x0;var _0x592a9d=_0xcc56[_0x154f39];return _0x592a9d;};'use strict';var _=require(_0x6cc5('0x0'));var util=require(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require(_0x6cc5('0x3'));var rs=require(_0x6cc5('0x4'));var fs=require('fs');var Redis=require(_0x6cc5('0x5'));var db=require(_0x6cc5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6cc5('0x7'));var config=require(_0x6cc5('0x8'));var jayson=require(_0x6cc5('0x9'));var client=jayson[_0x6cc5('0xa')][_0x6cc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x471bf6,_0x315f4f,_0x100c06){return new BPromise(function(_0x4ffa5e,_0x90e2ea){return client[_0x6cc5('0xc')](_0x471bf6,_0x100c06)[_0x6cc5('0xd')](function(_0x56047d){logger['info'](_0x6cc5('0xe'),_0x315f4f,'request\x20sent');logger[_0x6cc5('0xf')](_0x6cc5('0x10'),_0x315f4f,_0x6cc5('0x11'),JSON[_0x6cc5('0x12')](_0x56047d));if(_0x56047d[_0x6cc5('0x13')]){if(_0x56047d['error'][_0x6cc5('0x14')]===0x1f4){logger[_0x6cc5('0x13')](_0x6cc5('0xe'),_0x315f4f,_0x56047d[_0x6cc5('0x13')]['message']);return _0x90e2ea(_0x56047d[_0x6cc5('0x13')][_0x6cc5('0x15')]);}logger['error'](_0x6cc5('0xe'),_0x315f4f,_0x56047d['error'][_0x6cc5('0x15')]);return _0x4ffa5e(_0x56047d['error'][_0x6cc5('0x15')]);}else{logger[_0x6cc5('0x16')](_0x6cc5('0xe'),_0x315f4f,_0x6cc5('0x11'));_0x4ffa5e(_0x56047d['result'][_0x6cc5('0x15')]);}})[_0x6cc5('0x17')](function(_0x5b585c){logger[_0x6cc5('0x13')](_0x6cc5('0xe'),_0x315f4f,_0x5b585c);_0x90e2ea(_0x5b585c);});});}exports[_0x6cc5('0x18')]=function(_0x5b8556){var _0x131f55=this;return new Promise(function(_0x50916e,_0x5d435e){return db[_0x6cc5('0x19')][_0x6cc5('0x1a')]({'raw':_0x5b8556[_0x6cc5('0x1b')]?_0x5b8556['options'][_0x6cc5('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b8556[_0x6cc5('0x1b')]?_0x5b8556[_0x6cc5('0x1b')]['where']||null:null,'attributes':_0x5b8556['options']?_0x5b8556[_0x6cc5('0x1b')][_0x6cc5('0x1d')]||null:null,'include':_0x5b8556['options']?_0x5b8556[_0x6cc5('0x1b')]['include']?_[_0x6cc5('0x1e')](_0x5b8556[_0x6cc5('0x1b')][_0x6cc5('0x1f')],function(_0x4c06d4){return{'model':db[_0x4c06d4['model']],'as':_0x4c06d4['as'],'attributes':_0x4c06d4[_0x6cc5('0x1d')],'include':_0x4c06d4['include']?_[_0x6cc5('0x1e')](_0x4c06d4['include'],function(_0x57f2ce){return{'model':db[_0x57f2ce[_0x6cc5('0x20')]],'as':_0x57f2ce['as'],'attributes':_0x57f2ce[_0x6cc5('0x1d')],'include':_0x57f2ce[_0x6cc5('0x1f')]?_[_0x6cc5('0x1e')](_0x57f2ce[_0x6cc5('0x1f')],function(_0x117198){return{'model':db[_0x117198[_0x6cc5('0x20')]],'as':_0x117198['as'],'attributes':_0x117198[_0x6cc5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6cc5('0xd')](function(_0x30825e){logger[_0x6cc5('0x16')](_0x6cc5('0x18'),_0x5b8556);logger['debug'](_0x6cc5('0x18'),_0x5b8556,JSON['stringify'](_0x30825e));_0x50916e(_0x30825e);})['catch'](function(_0x155923){logger['error'](_0x6cc5('0x18'),_0x155923[_0x6cc5('0x15')],_0x5b8556);_0x5d435e(_0x131f55[_0x6cc5('0x13')](0x1f4,_0x155923[_0x6cc5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 41c6ec9..7c8bf7d 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0xda86e8,_0x4483f3){var _0x55769c=function(_0x73847c){while(--_0x73847c){_0xda86e8['push'](_0xda86e8['shift']());}};_0x55769c(++_0x4483f3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _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(_0x1c5926,_0x42bd89){var _0x1a7b33=function(_0x12a278){while(--_0x12a278){_0x1c5926['push'](_0x1c5926['shift']());}};_0x1a7b33(++_0x42bd89);}(_0x6aa7,0x178));var _0x76aa=function(_0x2da4c0,_0x32a0b2){_0x2da4c0=_0x2da4c0-0x0;var _0x30d90a=_0x6aa7[_0x2da4c0];return _0x30d90a;};'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 37d20e6..26c51d6 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 _0xb4fb=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','csc','intelepeer','BOOLEAN','INTEGER'];(function(_0x3220c2,_0x19f3db){var _0x5bbed2=function(_0x33e252){while(--_0x33e252){_0x3220c2['push'](_0x3220c2['shift']());}};_0x5bbed2(++_0x19f3db);}(_0xb4fb,0xe0));var _0xbb4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4fb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xbb4f('0x0'));var rs=require('randomstring');module[_0xbb4f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xbb4f('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbb4f('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbb4f('0x4')](_0xbb4f('0x5'),_0xbb4f('0x6'),_0xbb4f('0x7'),_0xbb4f('0x8'),_0xbb4f('0x9'),'clickatell','bandwidth',_0xbb4f('0xa'),'infobip',_0xbb4f('0xb'))},'accountSid':{'type':Sequelize[_0xbb4f('0x2')]},'authId':{'type':Sequelize[_0xbb4f('0x2')]},'authToken':{'type':Sequelize[_0xbb4f('0x2')]},'smsMethod':{'type':Sequelize[_0xbb4f('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xbb4f('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xbb4f('0x2')]},'accountId':{'type':Sequelize[_0xbb4f('0x2')]},'senderString':{'type':Sequelize[_0xbb4f('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbb4f('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbb4f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbb4f('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb4f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb4f('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbb4f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbb4f('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x57768a){if(!_0x57768a)this[_0xbb4f('0xe')](_0xbb4f('0xf'),null);this[_0xbb4f('0xe')](_0xbb4f('0x10'),_0x57768a);}}}; \ No newline at end of file +var _0x13e6=['INTEGER','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x35dff8,_0x94094f){var _0x486bd0=function(_0x35d63a){while(--_0x35d63a){_0x35dff8['push'](_0x35dff8['shift']());}};_0x486bd0(++_0x94094f);}(_0x13e6,0x96));var _0x613e=function(_0x2d5ffe,_0x22d481){_0x2d5ffe=_0x2d5ffe-0x0;var _0x17ef5d=_0x13e6[_0x2d5ffe];return _0x17ef5d;};'use strict';var Sequelize=require(_0x613e('0x0'));var rs=require(_0x613e('0x1'));module[_0x613e('0x2')]={'name':{'type':Sequelize[_0x613e('0x3')],'unique':_0x613e('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x613e('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x613e('0x3')],'defaultValue':function(){return rs[_0x613e('0x5')]();}},'phone':{'type':Sequelize[_0x613e('0x3')]},'type':{'type':Sequelize[_0x613e('0x6')](_0x613e('0x7'),'skebby',_0x613e('0x8'),_0x613e('0x9'),_0x613e('0xa'),_0x613e('0xb'),_0x613e('0xc'),_0x613e('0xd'),'infobip',_0x613e('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x613e('0x3')]},'authToken':{'type':Sequelize[_0x613e('0x3')]},'smsMethod':{'type':Sequelize[_0x613e('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x613e('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x613e('0x3')]},'senderString':{'type':Sequelize[_0x613e('0x3')]},'deliveryReport':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x613e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x613e('0x10')],'defaultValue':function(){return _0x613e('0x11');}},'notificationSound':{'type':Sequelize[_0x613e('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x613e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x613e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x613e('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a7e90){if(!_0x2a7e90)this['setDataValue'](_0x613e('0x13'),null);this['setDataValue'](_0x613e('0x14'),_0x2a7e90);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b880508..ef1c294 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 _0x7af9=['isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','updatedAt','DESC','list','omit','Contacts','SmsInteraction','interaction','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','internal','Tags','color','tag','to\x20is\x20mandatory','List','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','request','then','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsAccount,\x20%s,\x20%s','message','info','request\x20sent','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','SmsAccountId','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','CompanyId','mobile','twilio','from','From','Body','MessageSid','sender','text','clicksend','messageId','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7af9,0x140));var _0x97af=function(_0x2a0245,_0x53eedb){_0x2a0245=_0x2a0245-0x0;var _0x55e063=_0x7af9[_0x2a0245];return _0x55e063;};'use strict';var emlformat=require(_0x97af('0x0'));var rimraf=require(_0x97af('0x1'));var zipdir=require(_0x97af('0x2'));var jsonpatch=require(_0x97af('0x3'));var rp=require(_0x97af('0x4'));var moment=require(_0x97af('0x5'));var BPromise=require(_0x97af('0x6'));var Mustache=require('mustache');var util=require(_0x97af('0x7'));var path=require(_0x97af('0x8'));var sox=require(_0x97af('0x9'));var csv=require(_0x97af('0xa'));var ejs=require(_0x97af('0xb'));var fs=require('fs');var fs_extra=require(_0x97af('0xc'));var _=require(_0x97af('0xd'));var squel=require(_0x97af('0xe'));var crypto=require('crypto');var jsforce=require(_0x97af('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x97af('0xa'));var querystring=require('querystring');var Papa=require(_0x97af('0x10'));var Redis=require(_0x97af('0x11'));var authService=require(_0x97af('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x97af('0x13'));var hardwareService=require(_0x97af('0x14'));var logger=require(_0x97af('0x15'))(_0x97af('0x16'));var utils=require(_0x97af('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x97af('0x18'));var db=require(_0x97af('0x19'))['db'];config[_0x97af('0x1a')]=_[_0x97af('0x1b')](config[_0x97af('0x1a')],{'host':_0x97af('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x97af('0x1a')]));require(_0x97af('0x1d'))[_0x97af('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x5ea6fc,_0x16ad54,_0x457cf3,_0x592873){return new BPromise(function(_0x54f558,_0x1ebd41){var _0x2b575a=_0x592873||client;return _0x2b575a[_0x97af('0x1f')](_0x5ea6fc,_0x457cf3)[_0x97af('0x20')](function(_0x5b7551){logger['info']('SmsAccount,\x20%s,\x20%s',_0x16ad54,'request\x20sent');logger[_0x97af('0x21')](_0x97af('0x22'),_0x16ad54,'request\x20sent',JSON[_0x97af('0x23')](_0x5b7551));if(_0x5b7551['error']){if(_0x5b7551['error'][_0x97af('0x24')]===0x1f4){logger[_0x97af('0x25')](_0x97af('0x26'),_0x16ad54,_0x5b7551['error']['message']);return _0x1ebd41(_0x5b7551['error'][_0x97af('0x27')]);}logger['error'](_0x97af('0x26'),_0x16ad54,_0x5b7551['error'][_0x97af('0x27')]);return _0x54f558(_0x5b7551[_0x97af('0x25')]['message']);}else{logger[_0x97af('0x28')](_0x97af('0x26'),_0x16ad54,_0x97af('0x29'));_0x54f558(_0x5b7551[_0x97af('0x2a')][_0x97af('0x27')]);}})[_0x97af('0x2b')](function(_0x222612){logger[_0x97af('0x25')]('SmsAccount,\x20%s,\x20%s',_0x16ad54,_0x222612);_0x1ebd41(_0x222612);});});}function respondWithStatusCode(_0x37d57b,_0x28819f){_0x28819f=_0x28819f||0xcc;return function(_0x943cb0){if(_0x943cb0){return _0x37d57b[_0x97af('0x2c')](_0x28819f);}return _0x37d57b['status'](_0x28819f)[_0x97af('0x2d')]();};}function respondWithResult(_0x2cc307,_0x1fa0d6){_0x1fa0d6=_0x1fa0d6||0xc8;return function(_0x4e4c44){if(_0x4e4c44){return _0x2cc307[_0x97af('0x2e')](_0x1fa0d6)[_0x97af('0x2f')](_0x4e4c44);}};}function respondWithFilteredResult(_0x5f0b5f,_0x5c6cb3){return function(_0x3f43d2){if(_0x3f43d2){var _0x4d686b=typeof _0x5c6cb3[_0x97af('0x30')]===_0x97af('0x31')&&typeof _0x5c6cb3[_0x97af('0x32')]===_0x97af('0x31');var _0x1bb2eb=_0x3f43d2['count'];var _0x853c20=_0x4d686b?0x0:_0x5c6cb3[_0x97af('0x30')];var _0x390fcd=_0x4d686b?_0x3f43d2[_0x97af('0x33')]:_0x5c6cb3['offset']+_0x5c6cb3[_0x97af('0x32')];var _0x1d2716;if(_0x390fcd>=_0x1bb2eb){_0x390fcd=_0x1bb2eb;_0x1d2716=0xc8;}else{_0x1d2716=0xce;}_0x5f0b5f[_0x97af('0x2e')](_0x1d2716);return _0x5f0b5f[_0x97af('0x34')](_0x97af('0x35'),_0x853c20+'-'+_0x390fcd+'/'+_0x1bb2eb)['json'](_0x3f43d2);}return null;};}function patchUpdates(_0x5b3880){return function(_0x34e97e){try{jsonpatch[_0x97af('0x36')](_0x34e97e,_0x5b3880,!![]);}catch(_0x25ba69){return BPromise['reject'](_0x25ba69);}return _0x34e97e[_0x97af('0x37')]();};}function saveUpdates(_0xc71e03,_0x33576){return function(_0x1f36c2){if(_0x1f36c2){return _0x1f36c2[_0x97af('0x38')](_0xc71e03)[_0x97af('0x20')](function(_0x2f6a80){return _0x2f6a80;});}return null;};}function removeEntity(_0x171b58,_0x3a4246){return function(_0x2a5e64){if(_0x2a5e64){return _0x2a5e64['destroy']()[_0x97af('0x20')](function(){var _0x350253=_0x2a5e64[_0x97af('0x39')]({'plain':!![]});var _0x145ab=_0x97af('0x3a');return db[_0x97af('0x3b')]['destroy']({'where':{'type':_0x145ab,'resourceId':_0x350253['id']}})['then'](function(){return _0x2a5e64;});})['then'](function(){_0x171b58[_0x97af('0x2e')](0xcc)[_0x97af('0x2d')]();});}};}function handleEntityNotFound(_0x39ab20,_0x179f35){return function(_0x1233cc){if(!_0x1233cc){_0x39ab20[_0x97af('0x2c')](0x194);}return _0x1233cc;};}function handleError(_0x1710d5,_0x38ce17){_0x38ce17=_0x38ce17||0x1f4;return function(_0x47464d){logger['error'](_0x47464d[_0x97af('0x3c')]);if(_0x47464d[_0x97af('0x3d')]){delete _0x47464d[_0x97af('0x3d')];}_0x1710d5[_0x97af('0x2e')](_0x38ce17)[_0x97af('0x3e')](_0x47464d);};}exports[_0x97af('0x3f')]=function(_0x33d091,_0x347586){var _0x48136e={'include':[{'model':db[_0x97af('0x40')],'as':_0x97af('0x41')}]},_0x474b17={},_0x2f36bf={'count':0x0,'rows':[]};var _0x339a4b=_[_0x97af('0x42')](db[_0x97af('0x43')]['rawAttributes'],function(_0x3ff6bd){return{'name':_0x3ff6bd[_0x97af('0x44')],'type':_0x3ff6bd[_0x97af('0x45')][_0x97af('0x46')]};});_0x474b17[_0x97af('0x47')]=_[_0x97af('0x42')](_0x339a4b,_0x97af('0x3d'));_0x474b17[_0x97af('0x48')]=_[_0x97af('0x49')](_0x33d091[_0x97af('0x48')]);_0x474b17[_0x97af('0x4a')]=_[_0x97af('0x4b')](_0x474b17[_0x97af('0x47')],_0x474b17['query']);_0x48136e[_0x97af('0x4c')]=_[_0x97af('0x4b')](_0x474b17[_0x97af('0x47')],qs[_0x97af('0x4d')](_0x33d091[_0x97af('0x48')]['fields']));_0x48136e['attributes']=_0x48136e[_0x97af('0x4c')][_0x97af('0x4e')]?_0x48136e[_0x97af('0x4c')]:_0x474b17[_0x97af('0x47')];if(!_0x33d091[_0x97af('0x48')][_0x97af('0x4f')]('nolimit')){_0x48136e[_0x97af('0x32')]=qs[_0x97af('0x32')](_0x33d091['query'][_0x97af('0x32')]);_0x48136e[_0x97af('0x30')]=qs[_0x97af('0x30')](_0x33d091[_0x97af('0x48')][_0x97af('0x30')]);}_0x48136e[_0x97af('0x50')]=qs[_0x97af('0x51')](_0x33d091[_0x97af('0x48')][_0x97af('0x51')]);_0x48136e[_0x97af('0x52')]=qs['filters'](_['pick'](_0x33d091[_0x97af('0x48')],_0x474b17['filters']),_0x339a4b);if(_0x33d091[_0x97af('0x48')][_0x97af('0x53')]){_0x48136e[_0x97af('0x52')]=_[_0x97af('0x54')](_0x48136e[_0x97af('0x52')],{'$or':_[_0x97af('0x42')](_0x339a4b,function(_0x1db0c9){if(_0x1db0c9[_0x97af('0x45')]!==_0x97af('0x55')){var _0x3b615d={};_0x3b615d[_0x1db0c9['name']]={'$like':'%'+_0x33d091[_0x97af('0x48')][_0x97af('0x53')]+'%'};return _0x3b615d;}})});}_0x48136e=_[_0x97af('0x54')]({},_0x48136e,_0x33d091[_0x97af('0x56')]);var _0x321fa8={'where':_0x48136e['where']};return db[_0x97af('0x43')][_0x97af('0x33')](_0x321fa8)[_0x97af('0x20')](function(_0x4f1d71){_0x2f36bf['count']=_0x4f1d71;if(_0x33d091[_0x97af('0x48')][_0x97af('0x57')]){_0x48136e[_0x97af('0x58')]=[{'all':!![]}];}return db[_0x97af('0x43')][_0x97af('0x59')](_0x48136e);})[_0x97af('0x20')](function(_0x3240a8){_0x2f36bf[_0x97af('0x5a')]=_0x3240a8;return _0x2f36bf;})[_0x97af('0x20')](respondWithFilteredResult(_0x347586,_0x48136e))[_0x97af('0x2b')](handleError(_0x347586,null));};exports[_0x97af('0x5b')]=function(_0xdc05b1,_0x4b9f8f){var _0xfb2da7={'raw':![],'where':{'id':_0xdc05b1['params']['id']},'include':[{'model':db[_0x97af('0x40')],'as':_0x97af('0x41')}]},_0x5605dc={};_0x5605dc[_0x97af('0x47')]=_['keys'](db[_0x97af('0x43')][_0x97af('0x5c')]);_0x5605dc[_0x97af('0x48')]=_[_0x97af('0x49')](_0xdc05b1[_0x97af('0x48')]);_0x5605dc[_0x97af('0x4a')]=_[_0x97af('0x4b')](_0x5605dc[_0x97af('0x47')],_0x5605dc[_0x97af('0x48')]);_0xfb2da7[_0x97af('0x4c')]=_[_0x97af('0x4b')](_0x5605dc[_0x97af('0x47')],qs[_0x97af('0x4d')](_0xdc05b1['query'][_0x97af('0x4d')]));_0xfb2da7[_0x97af('0x4c')]=_0xfb2da7[_0x97af('0x4c')][_0x97af('0x4e')]?_0xfb2da7[_0x97af('0x4c')]:_0x5605dc['model'];if(_0xdc05b1[_0x97af('0x48')][_0x97af('0x57')]){_0xfb2da7[_0x97af('0x58')]=[{'all':!![]}];}_0xfb2da7=_[_0x97af('0x54')]({},_0xfb2da7,_0xdc05b1[_0x97af('0x56')]);return db['SmsAccount'][_0x97af('0x5d')](_0xfb2da7)['then'](handleEntityNotFound(_0x4b9f8f,null))['then'](respondWithResult(_0x4b9f8f,null))['catch'](handleError(_0x4b9f8f,null));};exports[_0x97af('0x5e')]=function(_0x39e868,_0x810911){return db[_0x97af('0x43')][_0x97af('0x5e')](_0x39e868[_0x97af('0x5f')],{})[_0x97af('0x20')](function(_0x8f6438){var _0x3952d5=_0x39e868[_0x97af('0x60')]['get']({'plain':!![]});if(!_0x3952d5)throw new Error(_0x97af('0x61'));if(_0x3952d5[_0x97af('0x62')]===_0x97af('0x60')){var _0x1ce6d1=_0x8f6438[_0x97af('0x39')]({'plain':!![]});var _0x565eae=_0x97af('0x3a');return db[_0x97af('0x63')][_0x97af('0x5d')]({'where':{'name':_0x565eae,'userProfileId':_0x3952d5[_0x97af('0x64')]},'raw':!![]})[_0x97af('0x20')](function(_0x3352de){if(_0x3352de&&_0x3352de['autoAssociation']===0x0){return db[_0x97af('0x3b')][_0x97af('0x5e')]({'name':_0x1ce6d1[_0x97af('0x3d')],'resourceId':_0x1ce6d1['id'],'type':_0x3352de[_0x97af('0x3d')],'sectionId':_0x3352de['id']},{})[_0x97af('0x20')](function(){return _0x8f6438;});}else{return _0x8f6438;}})['catch'](function(_0x18ea12){logger[_0x97af('0x25')](_0x97af('0x65'),_0x18ea12);throw _0x18ea12;});}return _0x8f6438;})[_0x97af('0x20')](respondWithResult(_0x810911,0xc9))[_0x97af('0x2b')](handleError(_0x810911,null));};exports[_0x97af('0x38')]=function(_0x39a34a,_0x3e42ee){if(_0x39a34a[_0x97af('0x5f')]['id']){delete _0x39a34a[_0x97af('0x5f')]['id'];}return db[_0x97af('0x43')][_0x97af('0x5d')]({'where':{'id':_0x39a34a[_0x97af('0x66')]['id']},'include':[{'model':db[_0x97af('0x40')],'as':_0x97af('0x41')}]})[_0x97af('0x20')](handleEntityNotFound(_0x3e42ee,null))['then'](saveUpdates(_0x39a34a[_0x97af('0x5f')],null))[_0x97af('0x20')](respondWithResult(_0x3e42ee,null))[_0x97af('0x2b')](handleError(_0x3e42ee,null));};exports['destroy']=function(_0x5742d5,_0x509a42){return db['SmsAccount'][_0x97af('0x5d')]({'where':{'id':_0x5742d5[_0x97af('0x66')]['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x509a42,null))['then'](removeEntity(_0x509a42,null))['catch'](handleError(_0x509a42,null));};exports[_0x97af('0x67')]=function(_0x28713e,_0x979cf2){return db[_0x97af('0x43')][_0x97af('0x67')]()['then'](respondWithResult(_0x979cf2,null))['catch'](handleError(_0x979cf2,null));};exports[_0x97af('0x68')]=function(_0x5724e5,_0x57cb37,_0x2187b6){if(_0x5724e5[_0x97af('0x5f')]['id']){delete _0x5724e5['body']['id'];}return db[_0x97af('0x43')][_0x97af('0x5d')]({'where':{'id':_0x5724e5['params']['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x57cb37,null))[_0x97af('0x20')](function(_0x281015){if(_0x281015){_0x5724e5[_0x97af('0x5f')]['SmsAccountId']=_0x281015['id'];return db[_0x97af('0x69')]['create'](_0x5724e5[_0x97af('0x5f')]);}})[_0x97af('0x20')](respondWithResult(_0x57cb37,null))[_0x97af('0x2b')](handleError(_0x57cb37,null));};exports[_0x97af('0x6a')]=function(_0x5c5341,_0x1bb44d,_0x1485cb){var _0x551ff1={'raw':![],'where':{}};var _0x188841={};var _0x4fe040={'count':0x0,'rows':[]};return db[_0x97af('0x43')][_0x97af('0x6b')]({'where':{'id':_0x5c5341[_0x97af('0x66')]['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x1bb44d,null))[_0x97af('0x20')](function(_0x4f5b52){if(_0x4f5b52){_0x188841[_0x97af('0x47')]=_[_0x97af('0x49')](db[_0x97af('0x69')]['rawAttributes']);_0x188841[_0x97af('0x48')]=_['keys'](_0x5c5341['query']);_0x188841['filters']=_['intersection'](_0x188841[_0x97af('0x47')],_0x188841[_0x97af('0x48')]);_0x551ff1[_0x97af('0x4c')]=_[_0x97af('0x4b')](_0x188841[_0x97af('0x47')],qs[_0x97af('0x4d')](_0x5c5341['query'][_0x97af('0x4d')]));_0x551ff1['attributes']=_0x551ff1[_0x97af('0x4c')][_0x97af('0x4e')]?_0x551ff1[_0x97af('0x4c')]:_0x188841[_0x97af('0x47')];if(!_0x5c5341[_0x97af('0x48')]['hasOwnProperty'](_0x97af('0x6c'))){_0x551ff1[_0x97af('0x32')]=qs[_0x97af('0x32')](_0x5c5341['query']['limit']);_0x551ff1[_0x97af('0x30')]=qs[_0x97af('0x30')](_0x5c5341[_0x97af('0x48')][_0x97af('0x30')]);}_0x551ff1[_0x97af('0x50')]=qs['sort'](_0x5c5341[_0x97af('0x48')][_0x97af('0x51')]);_0x551ff1[_0x97af('0x52')]=qs[_0x97af('0x4a')](_[_0x97af('0x6d')](_0x5c5341[_0x97af('0x48')],_0x188841[_0x97af('0x4a')]));_0x551ff1[_0x97af('0x52')]['SmsAccountId']=_0x4f5b52['id'];if(_0x5c5341[_0x97af('0x48')][_0x97af('0x53')]){_0x551ff1[_0x97af('0x52')]=_[_0x97af('0x54')](_0x551ff1[_0x97af('0x52')],{'$or':_[_0x97af('0x42')](_0x551ff1[_0x97af('0x4c')],function(_0x53a10a){var _0x3a39a3={};_0x3a39a3[_0x53a10a]={'$like':'%'+_0x5c5341[_0x97af('0x48')][_0x97af('0x53')]+'%'};return _0x3a39a3;})});}_0x551ff1=_[_0x97af('0x54')]({},_0x551ff1,_0x5c5341[_0x97af('0x56')]);return db[_0x97af('0x69')][_0x97af('0x33')]({'where':_0x551ff1[_0x97af('0x52')]})[_0x97af('0x20')](function(_0xa3f500){_0x4fe040[_0x97af('0x33')]=_0xa3f500;if(_0x5c5341[_0x97af('0x48')][_0x97af('0x57')]){_0x551ff1[_0x97af('0x58')]=[{'all':!![]}];}return db[_0x97af('0x69')]['findAll'](_0x551ff1);})[_0x97af('0x20')](function(_0x24a738){_0x4fe040[_0x97af('0x5a')]=_0x24a738;return _0x4fe040;});}})[_0x97af('0x20')](respondWithFilteredResult(_0x1bb44d,_0x551ff1))[_0x97af('0x2b')](handleError(_0x1bb44d,null));};exports[_0x97af('0x6e')]=function(_0x4676e1,_0x2712c0,_0x463902){return db[_0x97af('0x43')][_0x97af('0x5d')]({'where':{'id':_0x4676e1['params']['id']}})['then'](handleEntityNotFound(_0x2712c0,null))[_0x97af('0x20')](function(_0x4bee95){if(_0x4bee95){return _0x4bee95[_0x97af('0x6e')](_0x4676e1[_0x97af('0x48')][_0x97af('0x6f')]);}})[_0x97af('0x20')](respondWithStatusCode(_0x2712c0,null))[_0x97af('0x2b')](handleError(_0x2712c0,null));};exports[_0x97af('0x70')]=function(_0x367ca3,_0x30a97d,_0x3a271c){if(_0x367ca3[_0x97af('0x5f')]['id']){delete _0x367ca3[_0x97af('0x5f')]['id'];}return db[_0x97af('0x43')][_0x97af('0x5d')]({'where':{'id':_0x367ca3[_0x97af('0x66')]['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x30a97d,null))[_0x97af('0x20')](function(_0x5a2cea){if(_0x5a2cea){_0x367ca3[_0x97af('0x5f')][_0x97af('0x71')]=_0x5a2cea['id'];return db['CannedAnswer'][_0x97af('0x5e')](_0x367ca3[_0x97af('0x5f')]);}})[_0x97af('0x20')](respondWithResult(_0x30a97d,null))[_0x97af('0x2b')](handleError(_0x30a97d,null));};exports[_0x97af('0x72')]=function(_0x1f6d1d,_0x1efa0e,_0x3ae2b4){var _0x1b5601={'raw':![],'where':{}};var _0x55b2cc={};var _0xe210d5={'count':0x0,'rows':[]};return db[_0x97af('0x43')][_0x97af('0x6b')]({'where':{'id':_0x1f6d1d[_0x97af('0x66')]['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x1efa0e,null))[_0x97af('0x20')](function(_0x49755a){if(_0x49755a){_0x55b2cc[_0x97af('0x47')]=_['keys'](db[_0x97af('0x73')][_0x97af('0x5c')]);_0x55b2cc[_0x97af('0x48')]=_['keys'](_0x1f6d1d[_0x97af('0x48')]);_0x55b2cc[_0x97af('0x4a')]=_[_0x97af('0x4b')](_0x55b2cc[_0x97af('0x47')],_0x55b2cc[_0x97af('0x48')]);_0x1b5601[_0x97af('0x4c')]=_['intersection'](_0x55b2cc['model'],qs[_0x97af('0x4d')](_0x1f6d1d[_0x97af('0x48')][_0x97af('0x4d')]));_0x1b5601['attributes']=_0x1b5601[_0x97af('0x4c')][_0x97af('0x4e')]?_0x1b5601[_0x97af('0x4c')]:_0x55b2cc['model'];if(!_0x1f6d1d[_0x97af('0x48')][_0x97af('0x4f')](_0x97af('0x6c'))){_0x1b5601[_0x97af('0x32')]=qs['limit'](_0x1f6d1d['query'][_0x97af('0x32')]);_0x1b5601[_0x97af('0x30')]=qs[_0x97af('0x30')](_0x1f6d1d[_0x97af('0x48')][_0x97af('0x30')]);}_0x1b5601[_0x97af('0x50')]=qs[_0x97af('0x51')](_0x1f6d1d[_0x97af('0x48')][_0x97af('0x51')]);_0x1b5601[_0x97af('0x52')]=qs[_0x97af('0x4a')](_[_0x97af('0x6d')](_0x1f6d1d[_0x97af('0x48')],_0x55b2cc[_0x97af('0x4a')]));_0x1b5601[_0x97af('0x52')][_0x97af('0x71')]=_0x49755a['id'];if(_0x1f6d1d['query'][_0x97af('0x53')]){_0x1b5601['where']=_['merge'](_0x1b5601[_0x97af('0x52')],{'$or':_[_0x97af('0x42')](_0x1b5601[_0x97af('0x4c')],function(_0x5013bc){var _0x3c9ca1={};_0x3c9ca1[_0x5013bc]={'$like':'%'+_0x1f6d1d['query'][_0x97af('0x53')]+'%'};return _0x3c9ca1;})});}_0x1b5601=_[_0x97af('0x54')]({},_0x1b5601,_0x1f6d1d[_0x97af('0x56')]);return db[_0x97af('0x73')][_0x97af('0x33')]({'where':_0x1b5601['where']})[_0x97af('0x20')](function(_0x317734){_0xe210d5[_0x97af('0x33')]=_0x317734;if(_0x1f6d1d[_0x97af('0x48')][_0x97af('0x57')]){_0x1b5601[_0x97af('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x97af('0x59')](_0x1b5601);})[_0x97af('0x20')](function(_0x2778e3){_0xe210d5[_0x97af('0x5a')]=_0x2778e3;return _0xe210d5;});}})[_0x97af('0x20')](respondWithFilteredResult(_0x1efa0e,_0x1b5601))[_0x97af('0x2b')](handleError(_0x1efa0e,null));};exports[_0x97af('0x74')]=function(_0x2f57a8,_0x47ba17,_0x4d900d){return db[_0x97af('0x43')][_0x97af('0x5d')]({'where':{'id':_0x2f57a8['params']['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x47ba17,null))[_0x97af('0x20')](function(_0x22c4ee){if(_0x22c4ee){return _0x22c4ee[_0x97af('0x74')](_0x2f57a8[_0x97af('0x48')]['ids']);}})[_0x97af('0x20')](respondWithStatusCode(_0x47ba17,null))['catch'](handleError(_0x47ba17,null));};exports[_0x97af('0x75')]=function(_0x2ffc17,_0x2a6356,_0x73fe64){var _0x5172af={'channel':_0x97af('0x76')};var _0x3cac23=[];var _0x57fceb=[];var _0x599532={};return db[_0x97af('0x43')]['find']({'where':{'id':_0x2ffc17[_0x97af('0x66')]['id']},'include':[{'model':db[_0x97af('0x77')],'as':_0x97af('0x78')}]})[_0x97af('0x20')](handleEntityNotFound(_0x2a6356,null))[_0x97af('0x20')](function(_0x27b920){_0x5172af[_0x97af('0x79')]=_0x27b920;_0x5172af[_0x97af('0x7a')]=_[_0x97af('0x7b')](_0x27b920[_0x97af('0x78')],[_0x97af('0x7c')],[_0x97af('0x7d')]);if(_0x5172af['account'][_0x97af('0x78')]){delete _0x5172af[_0x97af('0x79')]['Applications'];}return db[_0x97af('0x7e')]['describe']();})[_0x97af('0x20')](function(_0x5c0414){if(!_0x5c0414){throw new db[(_0x97af('0x7f'))][(_0x97af('0x80'))](_0x97af('0x81'));}_0x3cac23=_['difference'](_[_0x97af('0x49')](_0x5c0414),[_0x97af('0x82'),'updatedAt']);_0x57fceb=_[_0x97af('0x83')](_[_0x97af('0x49')](_0x5c0414),['createdAt','updatedAt',_0x97af('0x84'),'ListId']);_0x5172af[_0x97af('0x5f')]={'mapKey':_0x97af('0x85')};if(_0x5172af[_0x97af('0x79')][_0x97af('0x45')]){switch(_0x5172af[_0x97af('0x79')]['type']){case _0x97af('0x86'):_0x5172af['body'][_0x97af('0x87')]=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x88')];_0x5172af[_0x97af('0x5f')][_0x97af('0x5f')]=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x89')];_0x5172af[_0x97af('0x5f')]['messageId']=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x8a')];break;case'skebby':_0x5172af[_0x97af('0x5f')][_0x97af('0x87')]='+'+_0x2ffc17[_0x97af('0x5f')][_0x97af('0x8b')];_0x5172af[_0x97af('0x5f')][_0x97af('0x5f')]=_0x2ffc17['body'][_0x97af('0x8c')];break;case'connectel':_0x5172af['body'][_0x97af('0x87')]=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x87')];_0x5172af[_0x97af('0x5f')][_0x97af('0x5f')]=_0x2ffc17['body'][_0x97af('0x27')];break;case _0x97af('0x8d'):_0x5172af[_0x97af('0x5f')][_0x97af('0x87')]=_0x2ffc17[_0x97af('0x5f')]['from'];_0x5172af[_0x97af('0x5f')][_0x97af('0x5f')]=_0x2ffc17['body']['body'];_0x5172af[_0x97af('0x5f')][_0x97af('0x8e')]=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x8f')];break;case _0x97af('0x90'):_0x5172af[_0x97af('0x5f')][_0x97af('0x87')]=_0x2ffc17[_0x97af('0x5f')]['From'];_0x5172af[_0x97af('0x5f')][_0x97af('0x5f')]=_0x2ffc17[_0x97af('0x5f')]['Text'];_0x5172af[_0x97af('0x5f')]['messageId']=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x91')];break;case _0x97af('0x92'):_0x5172af[_0x97af('0x5f')][_0x97af('0x87')]='+'+_0x2ffc17[_0x97af('0x5f')][_0x97af('0x93')][0x0][_0x97af('0x87')];_0x5172af[_0x97af('0x5f')][_0x97af('0x5f')]=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x93')][0x0][_0x97af('0x8c')];_0x5172af[_0x97af('0x5f')][_0x97af('0x8e')]=_0x2ffc17[_0x97af('0x5f')]['results'][0x0][_0x97af('0x8e')];break;case _0x97af('0x94'):_0x5172af[_0x97af('0x5f')]['from']=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x95')];_0x5172af[_0x97af('0x5f')][_0x97af('0x5f')]=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x96')][_0x97af('0x27')];break;case _0x97af('0x97'):_0x5172af[_0x97af('0x5f')]['from']=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x98')];_0x5172af[_0x97af('0x5f')]['body']=_0x2ffc17[_0x97af('0x5f')]['text'];_0x5172af[_0x97af('0x5f')][_0x97af('0x8e')]=_0x2ffc17[_0x97af('0x5f')]['replyMessageId'];break;case _0x97af('0x99'):_0x5172af[_0x97af('0x5f')][_0x97af('0x8e')]=_0x2ffc17[_0x97af('0x5f')][0x0]['message']['id'];_0x5172af[_0x97af('0x5f')][_0x97af('0x87')]=_0x2ffc17[_0x97af('0x5f')][0x0][_0x97af('0x27')][_0x97af('0x87')];_0x5172af[_0x97af('0x5f')]['body']=_0x2ffc17[_0x97af('0x5f')][0x0][_0x97af('0x27')][_0x97af('0x8c')];break;case _0x97af('0x9a'):_0x5172af[_0x97af('0x5f')][_0x97af('0x87')]=_0x2ffc17[_0x97af('0x5f')]['from'];_0x5172af['body']['body']=_0x2ffc17[_0x97af('0x5f')][_0x97af('0x27')];_0x5172af[_0x97af('0x5f')][_0x97af('0x8e')]=_0x2ffc17['body'][_0x97af('0x9b')];break;}}if(_0x5172af[_0x97af('0x5f')]['id']){delete _0x5172af[_0x97af('0x5f')]['id'];}if(_[_0x97af('0x9c')](_0x5172af[_0x97af('0x5f')][_0x97af('0x87')])){throw new db[(_0x97af('0x7f'))][(_0x97af('0x80'))](_0x97af('0x9d'));}if(_[_0x97af('0x9c')](_0x5172af[_0x97af('0x5f')]['body'])||_0x5172af[_0x97af('0x5f')]['body']===''){throw new db['Sequelize'][(_0x97af('0x80'))](_0x97af('0x9e'));}if(_[_0x97af('0x9c')](_0x5172af[_0x97af('0x5f')][_0x97af('0x9f')])){throw new db[(_0x97af('0x7f'))]['ValidationError'](_0x97af('0xa0')+_0x57fceb);}if(!_['includes'](_0x57fceb,_0x5172af[_0x97af('0x5f')][_0x97af('0x9f')])){throw new db[(_0x97af('0x7f'))][(_0x97af('0x80'))](_0x97af('0xa1')+_0x57fceb);}_0x599532[_0x5172af[_0x97af('0x5f')]['mapKey']]=_0x5172af[_0x97af('0x5f')][_0x97af('0x87')];return db[_0x97af('0xa2')][_0x97af('0x5d')]({'where':{'id':_0x5172af[_0x97af('0x79')][_0x97af('0xa3')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x599532,'limit':0x1,'order':[[_0x97af('0xa4'),_0x97af('0xa5')]]}]});})[_0x97af('0x20')](handleEntityNotFound(_0x2a6356,null))[_0x97af('0x20')](function(_0x9b4e51){if(_0x9b4e51){_0x5172af[_0x97af('0xa6')]=_[_0x97af('0xa7')](_0x9b4e51,[_0x97af('0xa8')]);if(_0x9b4e51[_0x97af('0xa8')]['length']){return _0x9b4e51[_0x97af('0xa8')][0x0];}var _0x1d1409=_['defaults'](_0x5172af[_0x97af('0x5f')],{'firstName':_0x5172af['body'][_0x97af('0x87')],'ListId':_0x9b4e51['id']});_0x1d1409[_0x5172af[_0x97af('0x5f')][_0x97af('0x9f')]]=_0x5172af[_0x97af('0x5f')][_0x97af('0x87')];return db['CmContact'][_0x97af('0x5e')](_0x1d1409,{'fields':_0x3cac23,'raw':!![]});}})[_0x97af('0x20')](handleEntityNotFound(_0x2a6356,null))['then'](function(_0x4db585){if(_0x4db585){_0x5172af['contact']=_0x4db585;var _0x444954={'ContactId':_0x4db585['id'],'phone':_0x5172af['body'][_0x97af('0x87')],'SmsAccountId':_0x2ffc17[_0x97af('0x66')]['id']};var _0x422033={'ContactId':_0x4db585['id'],'SmsAccountId':_0x2ffc17[_0x97af('0x66')]['id'],'closed':![]};return db[_0x97af('0xa9')][_0x97af('0x5d')]({'where':_0x422033})[_0x97af('0x20')](function(_0x3990e6){if(_0x3990e6){return[_0x3990e6,![]];}return db[_0x97af('0xa9')][_0x97af('0x5e')](_0x444954)[_0x97af('0x20')](function(_0x33fbd0){return[_0x33fbd0,!![]];});});}})['spread'](function(_0x3881db,_0xee22f5){_0x5172af['interaction']=_0x3881db[_0x97af('0x39')]({'plain':!![]});_0x5172af[_0x97af('0xaa')]['created']=![];if(_0xee22f5){if(_0x5172af[_0x97af('0x79')]['autoclose']){_0x5172af['applications'][_0x97af('0xab')]({'id':0x0,'priority':_0x5172af[_0x97af('0x7a')][_0x97af('0x4e')]+0x1,'app':_0x97af('0xac'),'appdata':_0x97af('0xad'),'interval':_0x97af('0xae')});}_0x5172af['interaction'][_0x97af('0xaf')]=!![];}return db[_0x97af('0xb0')][_0x97af('0x5e')]({'phone':_0x5172af['body'][_0x97af('0x87')],'messageId':_0x5172af[_0x97af('0x5f')][_0x97af('0x8e')],'body':_0x5172af[_0x97af('0x5f')]['body'],'SmsAccountId':_0x2ffc17[_0x97af('0x66')]['id'],'SmsInteractionId':_0x3881db['id'],'direction':'in','ContactId':_0x3881db[_0x97af('0xb1')],'AttachmentId':_0x5172af[_0x97af('0x5f')][_0x97af('0xb2')]});})[_0x97af('0x20')](function(_0x47349c){_0x5172af[_0x97af('0x27')]=_0x47349c;if(_0x5172af[_0x97af('0xaa')][_0x97af('0xb3')]){return db[_0x97af('0xb4')]['find']({'attributes':['id',_0x97af('0x3d')],'where':{'id':_0x5172af[_0x97af('0xaa')][_0x97af('0xb3')]}})[_0x97af('0x20')](function(_0x1ec076){if(_0x1ec076){_0x5172af[_0x97af('0x7a')][_0x97af('0xb5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1ec076['name']+','+(_0x5172af[_0x97af('0x79')][_0x97af('0xb6')]||0xa),'interval':_0x97af('0xae')});}return respondWithRpcPromise(_0x97af('0xb7'),_0x97af('0xb8'),_0x5172af);});}return respondWithRpcPromise(_0x97af('0xb7'),_0x97af('0xb8'),_0x5172af);})[_0x97af('0x20')](function(_0x5693bd){if(_0x5693bd){var _0x39e442=0xc8;var _0x3510f6='receiveMessage';logger['info'](_0x97af('0x22'),_0x3510f6,_0x39e442,_0x97af('0xb9'));logger[_0x97af('0x21')](_0x97af('0xba'),_0x3510f6,_0x39e442,_0x97af('0xb9'),JSON['stringify'](_0x5693bd));if(_0x5172af[_0x97af('0x79')][_0x97af('0x45')]===_0x97af('0x86')){return _0x2a6356[_0x97af('0x2e')](_0x39e442)[_0x97af('0x34')](_0x97af('0xbb'),_0x97af('0xbc'))[_0x97af('0x3e')](_0x97af('0xbd'));}else{return _0x2a6356[_0x97af('0x2e')](_0x39e442)[_0x97af('0x2f')](_0x5693bd);}}})[_0x97af('0x2b')](handleError(_0x2a6356,null));};exports[_0x97af('0xbe')]=function(_0x7a7c20,_0x5023f9){var _0x36fdc8=_0x7a7c20[_0x97af('0x66')]['id'];var _0x9539ad=_0x7a7c20[_0x97af('0x5f')];var _0x14cbd5=0xc8;var _0x55b22e=null;return db[_0x97af('0xbf')][_0x97af('0xc0')]({'isolationLevel':db[_0x97af('0xbf')][_0x97af('0xc1')][_0x97af('0xc2')][_0x97af('0xc3')]},function(_0x4638cb){return db[_0x97af('0x43')]['findOne']({'where':{'id':_0x36fdc8},'transaction':_0x4638cb})['then'](function(_0x4c0b3b){if(_0x4c0b3b){return db[_0x97af('0x77')][_0x97af('0xc4')]({'where':{'SmsAccountId':_0x36fdc8},'transaction':_0x4638cb})['then'](function(){var _0x5a609a=_[_0x97af('0x42')](_0x9539ad,function(_0x28006f){_0x28006f[_0x97af('0x71')]=_0x36fdc8;return _0x28006f;});return db[_0x97af('0x77')][_0x97af('0xc5')](_0x5a609a,{'transaction':_0x4638cb});});}else{_0x14cbd5=0x194;_0x55b22e=[];}});})[_0x97af('0x20')](function(){if(_0x14cbd5!==0x194){return db['SmsApplication'][_0x97af('0xc6')]({'where':{'SmsAccountId':_0x36fdc8},'order':_0x97af('0x7c')})[_0x97af('0x20')](function(_0x1184c3){_0x55b22e=_0x1184c3;});}})['catch'](function(_0x3ead3a){_0x14cbd5=0x1f4;logger['error'](_0x3ead3a['stack']);if(_0x3ead3a['name']){delete _0x3ead3a[_0x97af('0x3d')];}_0x55b22e=_0x3ead3a;})[_0x97af('0xc7')](function(){if(_0x55b22e===null){_0x5023f9[_0x97af('0x2c')](_0x14cbd5);}else{if(_0x14cbd5===0x1f4){_0x5023f9['status'](_0x14cbd5)[_0x97af('0x3e')](_0x55b22e);}else{_0x5023f9[_0x97af('0x2e')](_0x14cbd5)[_0x97af('0x2f')](_0x55b22e);}}});};exports[_0x97af('0xc8')]=function(_0x70dd0c,_0x9e897f,_0x407990){var _0x241b10={};var _0x1d6e88={};var _0x5903b6;var _0x50723c;return db[_0x97af('0x43')]['findOne']({'where':{'id':_0x70dd0c[_0x97af('0x66')]['id']}})['then'](handleEntityNotFound(_0x9e897f,null))[_0x97af('0x20')](function(_0x57eb07){if(_0x57eb07){_0x5903b6=_0x57eb07;_0x1d6e88[_0x97af('0x47')]=_[_0x97af('0x49')](db['SmsApplication'][_0x97af('0x5c')]);_0x1d6e88[_0x97af('0x48')]=_[_0x97af('0x49')](_0x70dd0c['query']);_0x1d6e88['filters']=_['intersection'](_0x1d6e88['model'],_0x1d6e88[_0x97af('0x48')]);_0x241b10[_0x97af('0x4c')]=_['intersection'](_0x1d6e88['model'],qs['fields'](_0x70dd0c[_0x97af('0x48')][_0x97af('0x4d')]));_0x241b10[_0x97af('0x4c')]=_0x241b10[_0x97af('0x4c')][_0x97af('0x4e')]?_0x241b10[_0x97af('0x4c')]:_0x1d6e88[_0x97af('0x47')];_0x241b10[_0x97af('0x50')]=qs[_0x97af('0x51')](_0x70dd0c['query'][_0x97af('0x51')]);_0x241b10['where']=qs[_0x97af('0x4a')](_[_0x97af('0x6d')](_0x70dd0c[_0x97af('0x48')],_0x1d6e88[_0x97af('0x4a')]));if(_0x70dd0c[_0x97af('0x48')][_0x97af('0x53')]){_0x241b10[_0x97af('0x52')]=_[_0x97af('0x54')](_0x241b10['where'],{'$or':_[_0x97af('0x42')](_0x241b10[_0x97af('0x4c')],function(_0xa5af8a){var _0x4b5135={};_0x4b5135[_0xa5af8a]={'$like':'%'+_0x70dd0c[_0x97af('0x48')][_0x97af('0x53')]+'%'};return _0x4b5135;})});}_0x241b10=_[_0x97af('0x54')]({},_0x241b10,_0x70dd0c[_0x97af('0x56')]);return _0x5903b6[_0x97af('0xc8')](_0x241b10);}})[_0x97af('0x20')](function(_0x1817c4){if(_0x1817c4){_0x50723c=_0x1817c4['length'];if(!_0x70dd0c[_0x97af('0x48')]['hasOwnProperty'](_0x97af('0x6c'))){_0x241b10[_0x97af('0x32')]=qs['limit'](_0x70dd0c[_0x97af('0x48')][_0x97af('0x32')]);_0x241b10[_0x97af('0x30')]=qs[_0x97af('0x30')](_0x70dd0c[_0x97af('0x48')]['offset']);}return _0x5903b6[_0x97af('0xc8')](_0x241b10);}})[_0x97af('0x20')](function(_0x23ce36){if(_0x23ce36){return _0x23ce36?{'count':_0x50723c,'rows':_0x23ce36}:null;}})[_0x97af('0x20')](respondWithResult(_0x9e897f,null))[_0x97af('0x2b')](handleError(_0x9e897f,null));};exports[_0x97af('0xc9')]=function(_0x3b6f0c,_0x2a9773,_0x2ba692){var _0x1a6e6c={'raw':![],'where':{}};var _0x597302={};var _0x41e402={'count':0x0,'rows':[]};return db['SmsAccount'][_0x97af('0x6b')]({'where':{'id':_0x3b6f0c['params']['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x2a9773,null))['then'](function(_0xda4c5b){if(_0xda4c5b){_0x597302['model']=_[_0x97af('0x49')](db[_0x97af('0xa9')][_0x97af('0x5c')]);_0x597302[_0x97af('0x48')]=_['keys'](_0x3b6f0c[_0x97af('0x48')]);_0x597302[_0x97af('0x4a')]=_[_0x97af('0x4b')](_0x597302[_0x97af('0x47')],_0x597302[_0x97af('0x48')]);_0x1a6e6c[_0x97af('0x4c')]=_[_0x97af('0x4b')](_0x597302[_0x97af('0x47')],qs[_0x97af('0x4d')](_0x3b6f0c[_0x97af('0x48')]['fields']));_0x1a6e6c[_0x97af('0x4c')]=_0x1a6e6c[_0x97af('0x4c')][_0x97af('0x4e')]?_0x1a6e6c['attributes']:_0x597302[_0x97af('0x47')];if(!_0x3b6f0c[_0x97af('0x48')][_0x97af('0x4f')](_0x97af('0x6c'))){_0x1a6e6c[_0x97af('0x32')]=qs[_0x97af('0x32')](_0x3b6f0c[_0x97af('0x48')]['limit']);_0x1a6e6c[_0x97af('0x30')]=qs[_0x97af('0x30')](_0x3b6f0c[_0x97af('0x48')][_0x97af('0x30')]);}_0x1a6e6c[_0x97af('0x50')]=qs[_0x97af('0x51')](_0x3b6f0c[_0x97af('0x48')][_0x97af('0x51')]);_0x1a6e6c[_0x97af('0x52')]=qs['filters'](_[_0x97af('0x6d')](_0x3b6f0c[_0x97af('0x48')],_0x597302[_0x97af('0x4a')]));_0x1a6e6c['where']['SmsAccountId']=_0xda4c5b['id'];if(_0x3b6f0c[_0x97af('0x48')][_0x97af('0x53')]){_0x1a6e6c[_0x97af('0x52')]=_[_0x97af('0x54')](_0x1a6e6c['where'],{'$or':_[_0x97af('0x42')](_0x1a6e6c['attributes'],function(_0x25589b){var _0x3682d7={};_0x3682d7[_0x25589b]={'$like':'%'+_0x3b6f0c[_0x97af('0x48')]['filter']+'%'};return _0x3682d7;})});}_0x1a6e6c=_[_0x97af('0x54')]({},_0x1a6e6c,_0x3b6f0c[_0x97af('0x56')]);return db[_0x97af('0xa9')][_0x97af('0x33')]({'where':_0x1a6e6c['where']})[_0x97af('0x20')](function(_0x5797ce){_0x41e402[_0x97af('0x33')]=_0x5797ce;if(_0x3b6f0c[_0x97af('0x48')][_0x97af('0x57')]){_0x1a6e6c['include']=[{'model':db[_0x97af('0x7e')],'as':_0x97af('0xca'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x97af('0x3d'),'fullname',_0x97af('0xcb')],'required':![]},{'model':db['Tag'],'as':_0x97af('0xcc'),'attributes':['id',_0x97af('0x3d'),_0x97af('0xcd')],'where':_0x3b6f0c['query'][_0x97af('0xce')]?{'id':_0x3b6f0c['query']['tag']}:undefined,'required':_0x3b6f0c['query'][_0x97af('0xce')]?!![]:![]}];}return db[_0x97af('0xa9')][_0x97af('0x59')](_0x1a6e6c);})[_0x97af('0x20')](function(_0x531391){_0x41e402[_0x97af('0x5a')]=_0x531391;return _0x41e402;});}})[_0x97af('0x20')](respondWithFilteredResult(_0x2a9773,_0x1a6e6c))[_0x97af('0x2b')](handleError(_0x2a9773,null));};exports['send']=function(_0x302620,_0x9fad09,_0xa1a4e9){var _0x4a6f64,_0x40b30e,_0x57eec4;if(_[_0x97af('0x9c')](_0x302620[_0x97af('0x5f')]['body'])||_0x302620[_0x97af('0x5f')][_0x97af('0x5f')]===''){throw new db['Sequelize']['ValidationError'](_0x97af('0x9e'));}if(_[_0x97af('0x9c')](_0x302620[_0x97af('0x5f')]['to'])){throw new db[(_0x97af('0x7f'))]['ValidationError'](_0x97af('0xcf'));}_0x4a6f64=_0x302620[_0x97af('0x5f')]['to'];return db['SmsAccount'][_0x97af('0x5d')]({'where':{'id':_0x302620[_0x97af('0x66')]['id']},'include':[{'model':db[_0x97af('0xa2')],'as':_0x97af('0xd0'),'include':[{'model':db[_0x97af('0x7e')],'as':_0x97af('0xa8'),'where':{'mobile':_0x4a6f64},'limit':0x1,'order':[['updatedAt',_0x97af('0xa5')]]}]}]})[_0x97af('0x20')](handleEntityNotFound(_0x9fad09,null))[_0x97af('0x20')](function(_0x1f00b2){if(_0x1f00b2&&_0x1f00b2[_0x97af('0xd0')]){_0x40b30e=_0x1f00b2['get']({'plain':!![]});if(_0x40b30e[_0x97af('0xd0')]&&_0x40b30e[_0x97af('0xd0')][_0x97af('0xa8')][_0x97af('0x4e')]){return _0x40b30e[_0x97af('0xd0')][_0x97af('0xa8')][0x0];}return db[_0x97af('0x7e')][_0x97af('0x5e')](_['defaults'](_0x302620[_0x97af('0x5f')],{'firstName':_0x4a6f64,'mobile':_0x4a6f64,'phone':_0x4a6f64,'ListId':_0x40b30e[_0x97af('0xa3')]}));}})[_0x97af('0x20')](handleEntityNotFound(_0x9fad09,null))[_0x97af('0x20')](function(_0x3cff4d){if(_0x3cff4d){_0x57eec4=_0x3cff4d;return db[_0x97af('0xa9')][_0x97af('0x5d')]({'where':{'ContactId':_0x57eec4['id'],'closed':![],'SmsAccountId':_0x40b30e['id']}})[_0x97af('0x20')](function(_0x456cfb){if(_0x456cfb){return[_0x456cfb,![]];}return db[_0x97af('0xa9')][_0x97af('0x5e')]({'UserId':_0x302620['user']['id'],'ContactId':_0x57eec4['id'],'SmsAccountId':_0x40b30e['id'],'phone':_0x4a6f64,'firstMsgDirection':'out','Messages':[_[_0x97af('0x54')](_0x302620[_0x97af('0x5f')],{'read':![],'body':_0x302620['body'][_0x97af('0x5f')],'phone':_0x4a6f64,'SmsAccountId':_0x40b30e['id'],'UserId':_0x302620[_0x97af('0x60')]['id'],'ContactId':_0x57eec4['id']})]},{'include':[{'model':db[_0x97af('0xb0')],'as':_0x97af('0xd1')}]})[_0x97af('0x20')](function(_0x24b949){return[_0x24b949,!![]];});});}})[_0x97af('0xd2')](function(_0x583d53,_0x275991){if(_0x275991){return _0x583d53;}return db[_0x97af('0xb0')][_0x97af('0x5e')](_['merge'](_0x302620[_0x97af('0x5f')],{'read':![],'body':_0x302620[_0x97af('0x5f')][_0x97af('0x5f')],'phone':_0x4a6f64,'SmsAccountId':_0x40b30e['id'],'SmsInteractionId':_0x583d53['id'],'UserId':_0x302620[_0x97af('0x60')]['id'],'ContactId':_0x57eec4['id']}))[_0x97af('0x20')](function(_0x3099f6){_0x583d53['dataValues'][_0x97af('0xd1')]=[];_0x583d53[_0x97af('0xd3')][_0x97af('0xd1')][_0x97af('0xab')](_0x3099f6[_0x97af('0xd3')]);return _0x583d53;});})[_0x97af('0x20')](respondWithResult(_0x9fad09,null))[_0x97af('0x2b')](handleError(_0x9fad09,null));};exports['status']=function(_0x402efd,_0x20c5cf,_0xdd5086){if(_0x402efd[_0x97af('0x5f')]['id']){delete _0x402efd['body']['id'];}var _0x92ac46,_0x2b951d,_0x125357;return db[_0x97af('0x43')]['find']({'where':{'id':_0x402efd[_0x97af('0x66')]['id']}})['then'](handleEntityNotFound(_0x20c5cf,null))[_0x97af('0x20')](function(_0x75f9ef){if(_0x75f9ef){_0x125357=_0x75f9ef;logger['debug'](_0x97af('0x22'),'status',_0x97af('0xd4'),_0x75f9ef[_0x97af('0x45')],util[_0x97af('0xd5')](_0x402efd[_0x97af('0x5f')],{'showHidden':![],'depth':null}));switch(_0x75f9ef['type']){case _0x97af('0xd6'):if(_0x402efd['body'][_0x97af('0xd7')]&&_0x402efd[_0x97af('0x5f')][_0x97af('0x2e')]){_0x2b951d=_0x402efd['body'][_0x97af('0x2e')];return db[_0x97af('0xb0')][_0x97af('0x5d')]({'where':{'messageId':_0x402efd[_0x97af('0x5f')][_0x97af('0xd7')]}});}break;case _0x97af('0xd8'):if(_0x402efd[_0x97af('0x5f')][_0x97af('0xd9')]&&_0x402efd[_0x97af('0x5f')][_0x97af('0xda')]){_0x2b951d=_0x402efd['body']['statusInt'];return db[_0x97af('0xb0')]['find']({'where':{'messageId':_0x402efd[_0x97af('0x5f')][_0x97af('0xd9')]}});}break;case'clicksend':if(_0x402efd[_0x97af('0x5f')][_0x97af('0x8f')]&&_0x402efd[_0x97af('0x5f')]['status_code']){_0x2b951d=_0x402efd[_0x97af('0x5f')][_0x97af('0xdb')];return db[_0x97af('0xb0')][_0x97af('0x5d')]({'where':{'messageId':_0x402efd[_0x97af('0x5f')][_0x97af('0x8f')]}});}break;case _0x97af('0x92'):var _0x2799f5=_0x402efd[_0x97af('0x5f')]['results'][0x0];if(_0x2799f5[_0x97af('0x8e')]&&_0x2799f5[_0x97af('0x2e')][_0x97af('0xdc')]==='DELIVERED'){_0x2b951d=_0x2799f5[_0x97af('0x2e')]['groupName'];return db[_0x97af('0xb0')][_0x97af('0x5d')]({'where':{'messageId':_0x2799f5[_0x97af('0x8e')]}});}break;case _0x97af('0x97'):if(_0x402efd[_0x97af('0x5f')][_0x97af('0x8e')]&&_0x402efd[_0x97af('0x5f')][_0x97af('0x2e')]){_0x2b951d=_0x402efd[_0x97af('0x5f')][_0x97af('0x2e')];return db[_0x97af('0xb0')]['find']({'where':{'messageId':_0x402efd[_0x97af('0x5f')]['messageId']}});}break;case _0x97af('0x99'):if(_0x402efd[_0x97af('0x5f')][0x0]['message']['id']){_0x2b951d=_0x402efd[_0x97af('0x5f')][0x0]['type'];return db[_0x97af('0xb0')][_0x97af('0x5d')]({'where':{'messageId':_0x402efd[_0x97af('0x5f')][0x0][_0x97af('0x27')]['id']}});}break;case _0x97af('0x9a'):if(_0x402efd['body']['redif']&&_0x402efd[_0x97af('0x5f')][_0x97af('0x2e')]){_0x2b951d=_0x402efd['body'][_0x97af('0x2e')];return db[_0x97af('0xb0')][_0x97af('0x5d')]({'where':{'messageId':_0x402efd[_0x97af('0x5f')][_0x97af('0xdd')]}});}break;}}})['then'](handleEntityNotFound(_0x20c5cf,null))[_0x97af('0x20')](function(_0x5b35d4){if(_0x5b35d4){_0x92ac46=_0x5b35d4;switch(_0x125357[_0x97af('0x45')]){case'skebby':if(_0x2b951d===_0x97af('0xde')){return _0x92ac46['update']({'read':!![]});}else{logger[_0x97af('0x25')](_0x97af('0x22'),_0x97af('0x2e'),_0x97af('0xd6'),util[_0x97af('0xd5')](_0x402efd[_0x97af('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x97af('0xd8'):if(_0x2b951d==='1'){return _0x92ac46[_0x97af('0x38')]({'read':!![]});}else{logger[_0x97af('0x25')](_0x97af('0x22'),_0x97af('0x2e'),_0x97af('0xd6'),util[_0x97af('0xd5')](_0x402efd[_0x97af('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x97af('0x8d'):if(!_0x402efd[_0x97af('0x5f')][_0x97af('0xdf')]&&_0x2b951d>=0xc8&&_0x2b951d<=0xce){return _0x92ac46[_0x97af('0x38')]({'read':!![]});}else{logger[_0x97af('0x25')](_0x97af('0x22'),_0x97af('0x2e'),_0x97af('0x8d'),util[_0x97af('0xd5')](_0x402efd[_0x97af('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x97af('0x92'):var _0x2eee6f=_0x402efd[_0x97af('0x5f')][_0x97af('0x93')][0x0];if(_0x2eee6f['status'][_0x97af('0xdc')]===_0x97af('0xde')){return _0x92ac46[_0x97af('0x38')]({'read':!![]});}else{logger[_0x97af('0x25')](_0x97af('0x22'),_0x97af('0x2e'),'infobip',util[_0x97af('0xd5')](_0x402efd[_0x97af('0x5f')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2b951d==_0x97af('0xe0')||_0x2b951d=='RECEIVED_BY_RECIPIENT'){return _0x92ac46[_0x97af('0x38')]({'read':!![]});}else{logger[_0x97af('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x97af('0x2e'),_0x97af('0x97'),util['inspect'](_0x402efd[_0x97af('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x97af('0x99'):if(_0x2b951d==_0x97af('0xe1')){return _0x92ac46[_0x97af('0x38')]({'read':!![]});}else{logger[_0x97af('0x25')](_0x97af('0x22'),_0x97af('0x2e'),_0x97af('0x99'),util[_0x97af('0xd5')](_0x402efd[_0x97af('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x97af('0x9a'):if(_0x2b951d===_0x97af('0xe2')||_0x2b951d===_0x97af('0xe3')){return _0x92ac46[_0x97af('0x38')]({'read':!![]});}else{logger[_0x97af('0x25')](_0x97af('0x22'),_0x97af('0x2e'),'intelepeer',util[_0x97af('0xd5')](_0x402efd[_0x97af('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x92ac46;}})[_0x97af('0x20')](respondWithResult(_0x20c5cf,null))[_0x97af('0x2b')](handleError(_0x20c5cf,null));};exports[_0x97af('0xe4')]=function(_0x3d8d34,_0x59570b,_0x10897a){var _0x266737,_0x464e4e,_0x594054;return db[_0x97af('0x43')][_0x97af('0x5d')]({'where':{'id':_0x3d8d34[_0x97af('0x66')]['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x59570b,null))['then'](function(_0x5ab5e5){if(_0x5ab5e5){_0x594054=_0x5ab5e5;logger[_0x97af('0x21')](_0x97af('0x22'),_0x97af('0x2e'),'received\x20delivery\x20report\x20from',_0x5ab5e5[_0x97af('0x45')],util[_0x97af('0xd5')](_0x3d8d34[_0x97af('0x48')],{'showHidden':![],'depth':null}));switch(_0x5ab5e5[_0x97af('0x45')]){case _0x97af('0x94'):if(_0x3d8d34[_0x97af('0x48')][_0x97af('0xe5')]&&_0x3d8d34[_0x97af('0x48')][_0x97af('0xe6')]){_0x464e4e=_0x3d8d34[_0x97af('0x48')][_0x97af('0xe6')];return db[_0x97af('0xb0')][_0x97af('0x5d')]({'where':{'messageId':_0x3d8d34[_0x97af('0x48')][_0x97af('0xe5')]}});}break;}}})[_0x97af('0x20')](handleEntityNotFound(_0x59570b,null))[_0x97af('0x20')](function(_0x101820){if(_0x101820){_0x266737=_0x101820;switch(_0x594054[_0x97af('0x45')]){case _0x97af('0x94'):if(_0x464e4e==='2'||_0x464e4e==='6'){return _0x266737[_0x97af('0x38')]({'read':!![]});}else{logger['error'](_0x97af('0x22'),'status',_0x97af('0x94'),util['inspect'](_0x3d8d34['query'],{'showHidden':![],'depth':null}));};break;}return _0x266737;}})['then'](respondWithResult(_0x59570b,null))[_0x97af('0x2b')](handleError(_0x59570b,null));};exports[_0x97af('0xe7')]=function(_0xab97a1,_0x290d4a,_0x1a820c){return db[_0x97af('0x43')][_0x97af('0x5d')]({'where':{'id':_0xab97a1[_0x97af('0x66')]['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x290d4a,null))[_0x97af('0x20')](function(_0x48f03f){if(_0x48f03f){return _0x48f03f['addAgents'](_0xab97a1[_0x97af('0x5f')]['ids'],_[_0x97af('0xa7')](_0xab97a1[_0x97af('0x5f')],['ids','id'])||{})[_0x97af('0xd2')](function(_0x58e953){for(var _0x590c0f=0x0;_0x590c0f<_0xab97a1[_0x97af('0x5f')][_0x97af('0x6f')][_0x97af('0x4e')];_0x590c0f+=0x1){socket[_0x97af('0xe8')](_0x97af('0xe9'),{'UserId':Number(_0xab97a1[_0x97af('0x5f')][_0x97af('0x6f')][_0x590c0f]),'SmsAccountId':Number(_0xab97a1[_0x97af('0x66')]['id'])});}return _0x58e953;});}})[_0x97af('0x20')](respondWithResult(_0x290d4a,null))[_0x97af('0x2b')](handleError(_0x290d4a,null));};exports[_0x97af('0xea')]=function(_0x5b2d36,_0x59dc52,_0x52e2d0){return db[_0x97af('0x43')][_0x97af('0x5d')]({'where':{'id':_0x5b2d36[_0x97af('0x66')]['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x59dc52,null))[_0x97af('0x20')](function(_0x5be877){if(_0x5be877){return _0x5be877[_0x97af('0xea')](_0x5b2d36[_0x97af('0x48')][_0x97af('0x6f')])[_0x97af('0x20')](function(){if(_[_0x97af('0xeb')](_0x5b2d36[_0x97af('0x48')][_0x97af('0x6f')])){for(var _0x74b8e4=0x0;_0x74b8e4<_0x5b2d36[_0x97af('0x48')][_0x97af('0x6f')][_0x97af('0x4e')];_0x74b8e4+=0x1){socket[_0x97af('0xe8')](_0x97af('0xec'),{'UserId':Number(_0x5b2d36[_0x97af('0x48')][_0x97af('0x6f')][_0x74b8e4]),'SmsAccountId':Number(_0x5b2d36[_0x97af('0x66')]['id'])});}}else{socket[_0x97af('0xe8')](_0x97af('0xec'),{'UserId':Number(_0x5b2d36[_0x97af('0x48')][_0x97af('0x6f')]),'SmsAccountId':Number(_0x5b2d36[_0x97af('0x66')]['id'])});}});}})[_0x97af('0x20')](respondWithStatusCode(_0x59dc52,null))[_0x97af('0x2b')](handleError(_0x59dc52,null));};exports[_0x97af('0xed')]=function(_0x5a7b30,_0x2c979b,_0x1e8de5){var _0x1f60a7={};var _0x3ce7f0={};var _0x12eae7;var _0x4a59b5;return db[_0x97af('0x43')][_0x97af('0x6b')]({'where':{'id':_0x5a7b30['params']['id']}})[_0x97af('0x20')](handleEntityNotFound(_0x2c979b,null))[_0x97af('0x20')](function(_0x4e9e75){if(_0x4e9e75){_0x12eae7=_0x4e9e75;_0x3ce7f0['model']=_[_0x97af('0x49')](db['User'][_0x97af('0x5c')]);_0x3ce7f0[_0x97af('0x48')]=_[_0x97af('0x49')](_0x5a7b30['query']);_0x3ce7f0[_0x97af('0x4a')]=_['intersection'](_0x3ce7f0[_0x97af('0x47')],_0x3ce7f0[_0x97af('0x48')]);_0x1f60a7['attributes']=_[_0x97af('0x4b')](_0x3ce7f0['model'],qs[_0x97af('0x4d')](_0x5a7b30['query'][_0x97af('0x4d')]));_0x1f60a7[_0x97af('0x4c')]=_0x1f60a7[_0x97af('0x4c')][_0x97af('0x4e')]?_0x1f60a7[_0x97af('0x4c')]:_0x3ce7f0['model'];_0x1f60a7[_0x97af('0x50')]=qs[_0x97af('0x51')](_0x5a7b30[_0x97af('0x48')][_0x97af('0x51')]);_0x1f60a7[_0x97af('0x52')]=qs[_0x97af('0x4a')](_[_0x97af('0x6d')](_0x5a7b30[_0x97af('0x48')],_0x3ce7f0[_0x97af('0x4a')]));if(_0x5a7b30[_0x97af('0x48')][_0x97af('0x53')]){_0x1f60a7['where']=_[_0x97af('0x54')](_0x1f60a7['where'],{'$or':_['map'](_0x1f60a7['attributes'],function(_0x358d6f){var _0x201249={};_0x201249[_0x358d6f]={'$like':'%'+_0x5a7b30[_0x97af('0x48')][_0x97af('0x53')]+'%'};return _0x201249;})});}_0x1f60a7=_['merge']({},_0x1f60a7,_0x5a7b30[_0x97af('0x56')]);return _0x12eae7[_0x97af('0xed')](_0x1f60a7);}})[_0x97af('0x20')](function(_0x2c7482){if(_0x2c7482){_0x4a59b5=_0x2c7482[_0x97af('0x4e')];if(!_0x5a7b30[_0x97af('0x48')][_0x97af('0x4f')](_0x97af('0x6c'))){_0x1f60a7['limit']=qs[_0x97af('0x32')](_0x5a7b30[_0x97af('0x48')][_0x97af('0x32')]);_0x1f60a7[_0x97af('0x30')]=qs[_0x97af('0x30')](_0x5a7b30[_0x97af('0x48')][_0x97af('0x30')]);}return _0x12eae7[_0x97af('0xed')](_0x1f60a7);}})[_0x97af('0x20')](function(_0x38f2e0){if(_0x38f2e0){return _0x38f2e0?{'count':_0x4a59b5,'rows':_0x38f2e0}:null;}})['then'](respondWithResult(_0x2c979b,null))[_0x97af('0x2b')](handleError(_0x2c979b,null));}; \ No newline at end of file +var _0x9113=['rows','show','mandatoryDispositionPause','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','merge','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','mobile','From','Body','messageId','MessageSid','skebby','sender','connectel','from','clicksend','plivo','results','csc','originatingAddress','clickatell','fromNumber','text','bandwidth','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','twilio','set','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','priority','finally','getApplications','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','dataValues','Messages','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','SmsAccount,\x20%s,\x20%s','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x20d390,_0x4e14ef){var _0x2ce0c5=function(_0xbcbb62){while(--_0xbcbb62){_0x20d390['push'](_0x20d390['shift']());}};_0x2ce0c5(++_0x4e14ef);}(_0x9113,0x90));var _0x3911=function(_0x1d6a95,_0x24a509){_0x1d6a95=_0x1d6a95-0x0;var _0x466efd=_0x9113[_0x1d6a95];return _0x466efd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3911('0x0'));var zipdir=require(_0x3911('0x1'));var jsonpatch=require(_0x3911('0x2'));var rp=require(_0x3911('0x3'));var moment=require(_0x3911('0x4'));var BPromise=require(_0x3911('0x5'));var Mustache=require(_0x3911('0x6'));var util=require('util');var path=require(_0x3911('0x7'));var sox=require('sox');var csv=require(_0x3911('0x8'));var ejs=require(_0x3911('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3911('0xa'));var squel=require(_0x3911('0xb'));var crypto=require(_0x3911('0xc'));var jsforce=require(_0x3911('0xd'));var deskjs=require(_0x3911('0xe'));var toCsv=require(_0x3911('0x8'));var querystring=require(_0x3911('0xf'));var Papa=require(_0x3911('0x10'));var Redis=require(_0x3911('0x11'));var authService=require(_0x3911('0x12'));var qs=require(_0x3911('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3911('0x14'));var logger=require(_0x3911('0x15'))(_0x3911('0x16'));var utils=require(_0x3911('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3911('0x18'));var db=require(_0x3911('0x19'))['db'];config[_0x3911('0x1a')]=_['defaults'](config[_0x3911('0x1a')],{'host':_0x3911('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0x3911('0x1c')](socket);var jayson=require(_0x3911('0x1d'));var client=jayson[_0x3911('0x1e')][_0x3911('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1b8431,_0x2e77f3,_0x1fc69d,_0x1f3015){return new BPromise(function(_0x259145,_0x4499be){var _0x1fa7a4=_0x1f3015||client;return _0x1fa7a4[_0x3911('0x20')](_0x1b8431,_0x1fc69d)[_0x3911('0x21')](function(_0x23a0e2){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2e77f3,_0x3911('0x22'));logger['debug'](_0x3911('0x23'),_0x2e77f3,_0x3911('0x22'),JSON[_0x3911('0x24')](_0x23a0e2));if(_0x23a0e2[_0x3911('0x25')]){if(_0x23a0e2['error'][_0x3911('0x26')]===0x1f4){logger[_0x3911('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2e77f3,_0x23a0e2[_0x3911('0x25')][_0x3911('0x27')]);return _0x4499be(_0x23a0e2[_0x3911('0x25')]['message']);}logger[_0x3911('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2e77f3,_0x23a0e2[_0x3911('0x25')]['message']);return _0x259145(_0x23a0e2[_0x3911('0x25')]['message']);}else{logger[_0x3911('0x28')](_0x3911('0x29'),_0x2e77f3,_0x3911('0x22'));_0x259145(_0x23a0e2['result'][_0x3911('0x27')]);}})[_0x3911('0x2a')](function(_0x377670){logger[_0x3911('0x25')](_0x3911('0x29'),_0x2e77f3,_0x377670);_0x4499be(_0x377670);});});}function respondWithStatusCode(_0x371404,_0x555dfb){_0x555dfb=_0x555dfb||0xcc;return function(_0x5b5757){if(_0x5b5757){return _0x371404[_0x3911('0x2b')](_0x555dfb);}return _0x371404['status'](_0x555dfb)['end']();};}function respondWithResult(_0x14f248,_0x48a306){_0x48a306=_0x48a306||0xc8;return function(_0x278af1){if(_0x278af1){return _0x14f248[_0x3911('0x2c')](_0x48a306)[_0x3911('0x2d')](_0x278af1);}};}function respondWithFilteredResult(_0x55c263,_0x22efbb){return function(_0x13d0e8){if(_0x13d0e8){var _0x29f8ee=typeof _0x22efbb[_0x3911('0x2e')]===_0x3911('0x2f')&&typeof _0x22efbb[_0x3911('0x30')]==='undefined';var _0x5ba8f5=_0x13d0e8[_0x3911('0x31')];var _0x212916=_0x29f8ee?0x0:_0x22efbb[_0x3911('0x2e')];var _0x46fb54=_0x29f8ee?_0x13d0e8[_0x3911('0x31')]:_0x22efbb[_0x3911('0x2e')]+_0x22efbb['limit'];var _0x41a52c;if(_0x46fb54>=_0x5ba8f5){_0x46fb54=_0x5ba8f5;_0x41a52c=0xc8;}else{_0x41a52c=0xce;}_0x55c263[_0x3911('0x2c')](_0x41a52c);return _0x55c263['set'](_0x3911('0x32'),_0x212916+'-'+_0x46fb54+'/'+_0x5ba8f5)['json'](_0x13d0e8);}return null;};}function patchUpdates(_0xd074a9){return function(_0x57e71f){try{jsonpatch[_0x3911('0x33')](_0x57e71f,_0xd074a9,!![]);}catch(_0x15bdf5){return BPromise[_0x3911('0x34')](_0x15bdf5);}return _0x57e71f['save']();};}function saveUpdates(_0x13ed4b,_0x12e3af){return function(_0x308033){if(_0x308033){return _0x308033[_0x3911('0x35')](_0x13ed4b)[_0x3911('0x21')](function(_0x5a802d){return _0x5a802d;});}return null;};}function removeEntity(_0x1641e7,_0x4f7ef3){return function(_0x2eb742){if(_0x2eb742){return _0x2eb742['destroy']()[_0x3911('0x21')](function(){var _0x4c0ee8=_0x2eb742[_0x3911('0x36')]({'plain':!![]});var _0xe618c9=_0x3911('0x37');return db[_0x3911('0x38')][_0x3911('0x39')]({'where':{'type':_0xe618c9,'resourceId':_0x4c0ee8['id']}})['then'](function(){return _0x2eb742;});})['then'](function(){_0x1641e7[_0x3911('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24b71c,_0x48bfc2){return function(_0x114cf0){if(!_0x114cf0){_0x24b71c[_0x3911('0x2b')](0x194);}return _0x114cf0;};}function handleError(_0x51e6f0,_0x52d9ac){_0x52d9ac=_0x52d9ac||0x1f4;return function(_0x3bee72){logger[_0x3911('0x25')](_0x3bee72[_0x3911('0x3a')]);if(_0x3bee72[_0x3911('0x3b')]){delete _0x3bee72[_0x3911('0x3b')];}_0x51e6f0[_0x3911('0x2c')](_0x52d9ac)[_0x3911('0x3c')](_0x3bee72);};}exports[_0x3911('0x3d')]=function(_0x521269,_0x8a75c){var _0x288502={'include':[{'model':db[_0x3911('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5c4796={},_0x1a1bc8={'count':0x0,'rows':[]};var _0x1a613f=_['map'](db[_0x3911('0x3f')][_0x3911('0x40')],function(_0x4a2cf6){return{'name':_0x4a2cf6[_0x3911('0x41')],'type':_0x4a2cf6['type']['key']};});_0x5c4796['model']=_[_0x3911('0x42')](_0x1a613f,_0x3911('0x3b'));_0x5c4796[_0x3911('0x43')]=_['keys'](_0x521269[_0x3911('0x43')]);_0x5c4796[_0x3911('0x44')]=_[_0x3911('0x45')](_0x5c4796['model'],_0x5c4796[_0x3911('0x43')]);_0x288502[_0x3911('0x46')]=_[_0x3911('0x45')](_0x5c4796[_0x3911('0x47')],qs['fields'](_0x521269[_0x3911('0x43')][_0x3911('0x48')]));_0x288502[_0x3911('0x46')]=_0x288502[_0x3911('0x46')]['length']?_0x288502[_0x3911('0x46')]:_0x5c4796[_0x3911('0x47')];if(!_0x521269[_0x3911('0x43')][_0x3911('0x49')](_0x3911('0x4a'))){_0x288502['limit']=qs['limit'](_0x521269['query'][_0x3911('0x30')]);_0x288502['offset']=qs[_0x3911('0x2e')](_0x521269[_0x3911('0x43')]['offset']);}_0x288502[_0x3911('0x4b')]=qs[_0x3911('0x4c')](_0x521269[_0x3911('0x43')][_0x3911('0x4c')]);_0x288502['where']=qs[_0x3911('0x44')](_[_0x3911('0x4d')](_0x521269[_0x3911('0x43')],_0x5c4796[_0x3911('0x44')]),_0x1a613f);if(_0x521269[_0x3911('0x43')][_0x3911('0x4e')]){_0x288502[_0x3911('0x4f')]=_['merge'](_0x288502[_0x3911('0x4f')],{'$or':_[_0x3911('0x42')](_0x1a613f,function(_0x28fed5){if(_0x28fed5[_0x3911('0x50')]!==_0x3911('0x51')){var _0x4fb191={};_0x4fb191[_0x28fed5['name']]={'$like':'%'+_0x521269['query'][_0x3911('0x4e')]+'%'};return _0x4fb191;}})});}_0x288502=_['merge']({},_0x288502,_0x521269[_0x3911('0x52')]);var _0xa0a599={'where':_0x288502['where']};return db[_0x3911('0x3f')][_0x3911('0x31')](_0xa0a599)['then'](function(_0x180693){_0x1a1bc8[_0x3911('0x31')]=_0x180693;if(_0x521269[_0x3911('0x43')][_0x3911('0x53')]){_0x288502[_0x3911('0x54')]=[{'all':!![]}];}return db[_0x3911('0x3f')][_0x3911('0x55')](_0x288502);})[_0x3911('0x21')](function(_0x555db9){_0x1a1bc8[_0x3911('0x56')]=_0x555db9;return _0x1a1bc8;})[_0x3911('0x21')](respondWithFilteredResult(_0x8a75c,_0x288502))[_0x3911('0x2a')](handleError(_0x8a75c,null));};exports[_0x3911('0x57')]=function(_0x3745b3,_0x1a573d){var _0x15e28f={'raw':![],'where':{'id':_0x3745b3['params']['id']},'include':[{'model':db[_0x3911('0x3e')],'as':_0x3911('0x58')}]},_0xe03567={};_0xe03567[_0x3911('0x47')]=_[_0x3911('0x59')](db[_0x3911('0x3f')][_0x3911('0x40')]);_0xe03567[_0x3911('0x43')]=_['keys'](_0x3745b3[_0x3911('0x43')]);_0xe03567[_0x3911('0x44')]=_[_0x3911('0x45')](_0xe03567[_0x3911('0x47')],_0xe03567['query']);_0x15e28f[_0x3911('0x46')]=_[_0x3911('0x45')](_0xe03567[_0x3911('0x47')],qs[_0x3911('0x48')](_0x3745b3[_0x3911('0x43')][_0x3911('0x48')]));_0x15e28f[_0x3911('0x46')]=_0x15e28f[_0x3911('0x46')][_0x3911('0x5a')]?_0x15e28f['attributes']:_0xe03567[_0x3911('0x47')];if(_0x3745b3[_0x3911('0x43')][_0x3911('0x53')]){_0x15e28f[_0x3911('0x54')]=[{'all':!![]}];}_0x15e28f=_['merge']({},_0x15e28f,_0x3745b3[_0x3911('0x52')]);return db[_0x3911('0x3f')][_0x3911('0x5b')](_0x15e28f)[_0x3911('0x21')](handleEntityNotFound(_0x1a573d,null))['then'](respondWithResult(_0x1a573d,null))[_0x3911('0x2a')](handleError(_0x1a573d,null));};exports[_0x3911('0x5c')]=function(_0x1d87f8,_0xcf36c5){return db[_0x3911('0x3f')][_0x3911('0x5c')](_0x1d87f8[_0x3911('0x5d')],{})[_0x3911('0x21')](function(_0x3582a0){var _0x4197f0=_0x1d87f8['user']['get']({'plain':!![]});if(!_0x4197f0)throw new Error(_0x3911('0x5e'));if(_0x4197f0[_0x3911('0x5f')]===_0x3911('0x60')){var _0x2ef12e=_0x3582a0[_0x3911('0x36')]({'plain':!![]});var _0x275303=_0x3911('0x37');return db[_0x3911('0x61')][_0x3911('0x5b')]({'where':{'name':_0x275303,'userProfileId':_0x4197f0[_0x3911('0x62')]},'raw':!![]})['then'](function(_0x444f33){if(_0x444f33&&_0x444f33[_0x3911('0x63')]===0x0){return db[_0x3911('0x38')][_0x3911('0x5c')]({'name':_0x2ef12e['name'],'resourceId':_0x2ef12e['id'],'type':_0x444f33['name'],'sectionId':_0x444f33['id']},{})[_0x3911('0x21')](function(){return _0x3582a0;});}else{return _0x3582a0;}})[_0x3911('0x2a')](function(_0x42e24e){logger['error'](_0x3911('0x64'),_0x42e24e);throw _0x42e24e;});}return _0x3582a0;})[_0x3911('0x21')](respondWithResult(_0xcf36c5,0xc9))[_0x3911('0x2a')](handleError(_0xcf36c5,null));};exports[_0x3911('0x35')]=function(_0x1a8ac3,_0x2e432c){if(_0x1a8ac3[_0x3911('0x5d')]['id']){delete _0x1a8ac3[_0x3911('0x5d')]['id'];}return db[_0x3911('0x3f')]['find']({'where':{'id':_0x1a8ac3[_0x3911('0x65')]['id']},'include':[{'model':db[_0x3911('0x3e')],'as':_0x3911('0x58')}]})[_0x3911('0x21')](handleEntityNotFound(_0x2e432c,null))[_0x3911('0x21')](saveUpdates(_0x1a8ac3[_0x3911('0x5d')],null))[_0x3911('0x21')](respondWithResult(_0x2e432c,null))[_0x3911('0x2a')](handleError(_0x2e432c,null));};exports['destroy']=function(_0x47056f,_0x241918){return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x47056f[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x241918,null))[_0x3911('0x21')](removeEntity(_0x241918,null))[_0x3911('0x2a')](handleError(_0x241918,null));};exports[_0x3911('0x66')]=function(_0x403fdb,_0x4b58df){return db[_0x3911('0x3f')][_0x3911('0x66')]()[_0x3911('0x21')](respondWithResult(_0x4b58df,null))[_0x3911('0x2a')](handleError(_0x4b58df,null));};exports[_0x3911('0x67')]=function(_0x2f5e7f,_0x5d3d4b,_0x9ff3fc){if(_0x2f5e7f[_0x3911('0x5d')]['id']){delete _0x2f5e7f[_0x3911('0x5d')]['id'];}return db['SmsAccount'][_0x3911('0x5b')]({'where':{'id':_0x2f5e7f['params']['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x5d3d4b,null))[_0x3911('0x21')](function(_0x5cb07a){if(_0x5cb07a){_0x2f5e7f[_0x3911('0x5d')][_0x3911('0x68')]=_0x5cb07a['id'];return db[_0x3911('0x69')]['create'](_0x2f5e7f['body']);}})[_0x3911('0x21')](respondWithResult(_0x5d3d4b,null))[_0x3911('0x2a')](handleError(_0x5d3d4b,null));};exports[_0x3911('0x6a')]=function(_0x54fc4c,_0x5aa11c,_0x69adfe){var _0x5ca000={'raw':![],'where':{}};var _0x46d434={};var _0x3e40e4={'count':0x0,'rows':[]};return db[_0x3911('0x3f')]['findOne']({'where':{'id':_0x54fc4c[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x5aa11c,null))[_0x3911('0x21')](function(_0x46d090){if(_0x46d090){_0x46d434[_0x3911('0x47')]=_[_0x3911('0x59')](db[_0x3911('0x69')][_0x3911('0x40')]);_0x46d434[_0x3911('0x43')]=_[_0x3911('0x59')](_0x54fc4c[_0x3911('0x43')]);_0x46d434[_0x3911('0x44')]=_[_0x3911('0x45')](_0x46d434['model'],_0x46d434[_0x3911('0x43')]);_0x5ca000[_0x3911('0x46')]=_[_0x3911('0x45')](_0x46d434[_0x3911('0x47')],qs[_0x3911('0x48')](_0x54fc4c[_0x3911('0x43')]['fields']));_0x5ca000[_0x3911('0x46')]=_0x5ca000['attributes'][_0x3911('0x5a')]?_0x5ca000[_0x3911('0x46')]:_0x46d434[_0x3911('0x47')];if(!_0x54fc4c[_0x3911('0x43')][_0x3911('0x49')](_0x3911('0x4a'))){_0x5ca000[_0x3911('0x30')]=qs['limit'](_0x54fc4c[_0x3911('0x43')]['limit']);_0x5ca000[_0x3911('0x2e')]=qs[_0x3911('0x2e')](_0x54fc4c[_0x3911('0x43')][_0x3911('0x2e')]);}_0x5ca000[_0x3911('0x4b')]=qs['sort'](_0x54fc4c[_0x3911('0x43')][_0x3911('0x4c')]);_0x5ca000[_0x3911('0x4f')]=qs[_0x3911('0x44')](_['pick'](_0x54fc4c['query'],_0x46d434[_0x3911('0x44')]));_0x5ca000[_0x3911('0x4f')][_0x3911('0x68')]=_0x46d090['id'];if(_0x54fc4c['query'][_0x3911('0x4e')]){_0x5ca000[_0x3911('0x4f')]=_[_0x3911('0x6b')](_0x5ca000[_0x3911('0x4f')],{'$or':_[_0x3911('0x42')](_0x5ca000[_0x3911('0x46')],function(_0x3d61dd){var _0x22891e={};_0x22891e[_0x3d61dd]={'$like':'%'+_0x54fc4c['query'][_0x3911('0x4e')]+'%'};return _0x22891e;})});}_0x5ca000=_[_0x3911('0x6b')]({},_0x5ca000,_0x54fc4c[_0x3911('0x52')]);return db[_0x3911('0x69')]['count']({'where':_0x5ca000[_0x3911('0x4f')]})['then'](function(_0x5de59b){_0x3e40e4[_0x3911('0x31')]=_0x5de59b;if(_0x54fc4c[_0x3911('0x43')][_0x3911('0x53')]){_0x5ca000[_0x3911('0x54')]=[{'all':!![]}];}return db[_0x3911('0x69')][_0x3911('0x55')](_0x5ca000);})[_0x3911('0x21')](function(_0x332b57){_0x3e40e4['rows']=_0x332b57;return _0x3e40e4;});}})[_0x3911('0x21')](respondWithFilteredResult(_0x5aa11c,_0x5ca000))[_0x3911('0x2a')](handleError(_0x5aa11c,null));};exports['removeDispositions']=function(_0x5cd472,_0x50f862,_0x4d90ad){return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x5cd472[_0x3911('0x65')]['id']}})['then'](handleEntityNotFound(_0x50f862,null))[_0x3911('0x21')](function(_0x4b88a7){if(_0x4b88a7){return _0x4b88a7[_0x3911('0x6c')](_0x5cd472[_0x3911('0x43')][_0x3911('0x6d')]);}})[_0x3911('0x21')](respondWithStatusCode(_0x50f862,null))[_0x3911('0x2a')](handleError(_0x50f862,null));};exports['addAnswer']=function(_0x494e45,_0x4c90bc,_0x2cdefc){if(_0x494e45[_0x3911('0x5d')]['id']){delete _0x494e45[_0x3911('0x5d')]['id'];}return db[_0x3911('0x3f')]['find']({'where':{'id':_0x494e45['params']['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x4c90bc,null))[_0x3911('0x21')](function(_0x1c6695){if(_0x1c6695){_0x494e45[_0x3911('0x5d')][_0x3911('0x68')]=_0x1c6695['id'];return db[_0x3911('0x6e')]['create'](_0x494e45['body']);}})[_0x3911('0x21')](respondWithResult(_0x4c90bc,null))[_0x3911('0x2a')](handleError(_0x4c90bc,null));};exports[_0x3911('0x6f')]=function(_0x4714cd,_0x5ab108,_0x1b640f){var _0x386b2b={'raw':![],'where':{}};var _0x40215d={};var _0x48e21a={'count':0x0,'rows':[]};return db[_0x3911('0x3f')]['findOne']({'where':{'id':_0x4714cd[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x5ab108,null))[_0x3911('0x21')](function(_0xde5187){if(_0xde5187){_0x40215d['model']=_[_0x3911('0x59')](db['CannedAnswer'][_0x3911('0x40')]);_0x40215d[_0x3911('0x43')]=_[_0x3911('0x59')](_0x4714cd['query']);_0x40215d[_0x3911('0x44')]=_[_0x3911('0x45')](_0x40215d[_0x3911('0x47')],_0x40215d['query']);_0x386b2b[_0x3911('0x46')]=_[_0x3911('0x45')](_0x40215d[_0x3911('0x47')],qs[_0x3911('0x48')](_0x4714cd[_0x3911('0x43')][_0x3911('0x48')]));_0x386b2b[_0x3911('0x46')]=_0x386b2b['attributes'][_0x3911('0x5a')]?_0x386b2b[_0x3911('0x46')]:_0x40215d[_0x3911('0x47')];if(!_0x4714cd[_0x3911('0x43')]['hasOwnProperty']('nolimit')){_0x386b2b[_0x3911('0x30')]=qs[_0x3911('0x30')](_0x4714cd[_0x3911('0x43')][_0x3911('0x30')]);_0x386b2b[_0x3911('0x2e')]=qs[_0x3911('0x2e')](_0x4714cd['query'][_0x3911('0x2e')]);}_0x386b2b['order']=qs[_0x3911('0x4c')](_0x4714cd[_0x3911('0x43')][_0x3911('0x4c')]);_0x386b2b[_0x3911('0x4f')]=qs[_0x3911('0x44')](_['pick'](_0x4714cd[_0x3911('0x43')],_0x40215d[_0x3911('0x44')]));_0x386b2b[_0x3911('0x4f')][_0x3911('0x68')]=_0xde5187['id'];if(_0x4714cd[_0x3911('0x43')][_0x3911('0x4e')]){_0x386b2b[_0x3911('0x4f')]=_[_0x3911('0x6b')](_0x386b2b[_0x3911('0x4f')],{'$or':_[_0x3911('0x42')](_0x386b2b[_0x3911('0x46')],function(_0x63fd0f){var _0x577d29={};_0x577d29[_0x63fd0f]={'$like':'%'+_0x4714cd[_0x3911('0x43')][_0x3911('0x4e')]+'%'};return _0x577d29;})});}_0x386b2b=_['merge']({},_0x386b2b,_0x4714cd[_0x3911('0x52')]);return db['CannedAnswer'][_0x3911('0x31')]({'where':_0x386b2b[_0x3911('0x4f')]})[_0x3911('0x21')](function(_0x65cb3a){_0x48e21a[_0x3911('0x31')]=_0x65cb3a;if(_0x4714cd[_0x3911('0x43')][_0x3911('0x53')]){_0x386b2b[_0x3911('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3911('0x55')](_0x386b2b);})['then'](function(_0x271e2f){_0x48e21a[_0x3911('0x56')]=_0x271e2f;return _0x48e21a;});}})[_0x3911('0x21')](respondWithFilteredResult(_0x5ab108,_0x386b2b))[_0x3911('0x2a')](handleError(_0x5ab108,null));};exports[_0x3911('0x70')]=function(_0x512faa,_0x592e82,_0x58cded){return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x512faa[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x592e82,null))['then'](function(_0xa917c4){if(_0xa917c4){return _0xa917c4['removeAnswers'](_0x512faa[_0x3911('0x43')][_0x3911('0x6d')]);}})[_0x3911('0x21')](respondWithStatusCode(_0x592e82,null))['catch'](handleError(_0x592e82,null));};exports[_0x3911('0x71')]=function(_0x24cafe,_0x5d40ee,_0x5a4bbd){var _0x35bbff={'channel':_0x3911('0x72')};var _0x30f855=[];var _0x1e1cbe=[];var _0x2613c2={};return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x24cafe[_0x3911('0x65')]['id']},'include':[{'model':db[_0x3911('0x73')],'as':'Applications'}]})[_0x3911('0x21')](handleEntityNotFound(_0x5d40ee,null))[_0x3911('0x21')](function(_0xfb9b5f){_0x35bbff[_0x3911('0x74')]=_0xfb9b5f;_0x35bbff[_0x3911('0x75')]=_['orderBy'](_0xfb9b5f[_0x3911('0x76')],['priority'],['asc']);if(_0x35bbff[_0x3911('0x74')][_0x3911('0x76')]){delete _0x35bbff[_0x3911('0x74')]['Applications'];}return db[_0x3911('0x77')][_0x3911('0x66')]();})['then'](function(_0x3f7efc){if(!_0x3f7efc){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))](_0x3911('0x7a'));}_0x30f855=_['difference'](_[_0x3911('0x59')](_0x3f7efc),[_0x3911('0x7b'),_0x3911('0x7c')]);_0x1e1cbe=_[_0x3911('0x7d')](_[_0x3911('0x59')](_0x3f7efc),[_0x3911('0x7b'),_0x3911('0x7c'),'CompanyId',_0x3911('0x7e')]);_0x35bbff[_0x3911('0x5d')]={'mapKey':_0x3911('0x7f')};if(_0x35bbff[_0x3911('0x74')][_0x3911('0x50')]){switch(_0x35bbff[_0x3911('0x74')]['type']){case'twilio':_0x35bbff[_0x3911('0x5d')]['from']=_0x24cafe[_0x3911('0x5d')][_0x3911('0x80')];_0x35bbff[_0x3911('0x5d')]['body']=_0x24cafe[_0x3911('0x5d')][_0x3911('0x81')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x82')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x83')];break;case _0x3911('0x84'):_0x35bbff[_0x3911('0x5d')]['from']='+'+_0x24cafe[_0x3911('0x5d')][_0x3911('0x85')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')]['text'];break;case _0x3911('0x86'):_0x35bbff[_0x3911('0x5d')]['from']=_0x24cafe['body'][_0x3911('0x87')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x27')];break;case _0x3911('0x88'):_0x35bbff['body'][_0x3911('0x87')]=_0x24cafe['body'][_0x3911('0x87')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe['body'][_0x3911('0x5d')];_0x35bbff[_0x3911('0x5d')]['messageId']=_0x24cafe[_0x3911('0x5d')]['message_id'];break;case _0x3911('0x89'):_0x35bbff['body']['from']=_0x24cafe[_0x3911('0x5d')][_0x3911('0x80')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')]['Text'];_0x35bbff['body'][_0x3911('0x82')]=_0x24cafe[_0x3911('0x5d')]['MessageUUID'];break;case'infobip':_0x35bbff['body'][_0x3911('0x87')]='+'+_0x24cafe[_0x3911('0x5d')][_0x3911('0x8a')][0x0][_0x3911('0x87')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe['body'][_0x3911('0x8a')][0x0]['text'];_0x35bbff[_0x3911('0x5d')][_0x3911('0x82')]=_0x24cafe['body'][_0x3911('0x8a')][0x0]['messageId'];break;case _0x3911('0x8b'):_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x8c')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')]['segmentedMessage'][_0x3911('0x27')];break;case _0x3911('0x8d'):_0x35bbff[_0x3911('0x5d')]['from']=_0x24cafe[_0x3911('0x5d')][_0x3911('0x8e')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x8f')];_0x35bbff[_0x3911('0x5d')]['messageId']=_0x24cafe['body']['replyMessageId'];break;case _0x3911('0x90'):_0x35bbff[_0x3911('0x5d')]['messageId']=_0x24cafe[_0x3911('0x5d')][0x0][_0x3911('0x27')]['id'];_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')]=_0x24cafe['body'][0x0][_0x3911('0x27')][_0x3911('0x87')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')][0x0][_0x3911('0x27')][_0x3911('0x8f')];break;case _0x3911('0x91'):_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x87')];_0x35bbff['body']['body']=_0x24cafe[_0x3911('0x5d')]['message'];_0x35bbff['body'][_0x3911('0x82')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x92')];break;}}if(_0x35bbff[_0x3911('0x5d')]['id']){delete _0x35bbff[_0x3911('0x5d')]['id'];}if(_[_0x3911('0x93')](_0x35bbff[_0x3911('0x5d')]['from'])){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))]('from\x20is\x20mandatory');}if(_[_0x3911('0x93')](_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')])||_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]===''){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3911('0x93')](_0x35bbff[_0x3911('0x5d')][_0x3911('0x94')])){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))](_0x3911('0x95')+_0x1e1cbe);}if(!_['includes'](_0x1e1cbe,_0x35bbff['body'][_0x3911('0x94')])){throw new db['Sequelize'][(_0x3911('0x79'))](_0x3911('0x96')+_0x1e1cbe);}_0x2613c2[_0x35bbff[_0x3911('0x5d')][_0x3911('0x94')]]=_0x35bbff[_0x3911('0x5d')]['from'];return db[_0x3911('0x97')][_0x3911('0x5b')]({'where':{'id':_0x35bbff[_0x3911('0x74')]['ListId']},'include':[{'model':db[_0x3911('0x77')],'as':_0x3911('0x98'),'where':_0x2613c2,'limit':0x1,'order':[[_0x3911('0x7c'),_0x3911('0x99')]]}]});})['then'](handleEntityNotFound(_0x5d40ee,null))[_0x3911('0x21')](function(_0x3a958a){if(_0x3a958a){_0x35bbff[_0x3911('0x9a')]=_[_0x3911('0x9b')](_0x3a958a,['Contacts']);if(_0x3a958a[_0x3911('0x98')][_0x3911('0x5a')]){return _0x3a958a[_0x3911('0x98')][0x0];}var _0x228a74=_[_0x3911('0x9c')](_0x35bbff['body'],{'firstName':_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')],'ListId':_0x3a958a['id']});_0x228a74[_0x35bbff['body'][_0x3911('0x94')]]=_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')];return db[_0x3911('0x77')][_0x3911('0x5c')](_0x228a74,{'fields':_0x30f855,'raw':!![]});}})[_0x3911('0x21')](handleEntityNotFound(_0x5d40ee,null))[_0x3911('0x21')](function(_0x1a689d){if(_0x1a689d){_0x35bbff['contact']=_0x1a689d;var _0x353ce7={'ContactId':_0x1a689d['id'],'phone':_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')],'SmsAccountId':_0x24cafe[_0x3911('0x65')]['id']};var _0x157944={'ContactId':_0x1a689d['id'],'SmsAccountId':_0x24cafe[_0x3911('0x65')]['id'],'closed':![]};return db[_0x3911('0x9d')]['find']({'where':_0x157944})['then'](function(_0x1f3a99){if(_0x1f3a99){return[_0x1f3a99,![]];}return db[_0x3911('0x9d')][_0x3911('0x5c')](_0x353ce7)['then'](function(_0x459640){return[_0x459640,!![]];});});}})[_0x3911('0x9e')](function(_0x11b80c,_0xe82834){_0x35bbff[_0x3911('0x9f')]=_0x11b80c[_0x3911('0x36')]({'plain':!![]});_0x35bbff[_0x3911('0x9f')][_0x3911('0xa0')]=![];if(_0xe82834){if(_0x35bbff[_0x3911('0x74')][_0x3911('0xa1')]){_0x35bbff[_0x3911('0x75')][_0x3911('0xa2')]({'id':0x0,'priority':_0x35bbff[_0x3911('0x75')][_0x3911('0x5a')]+0x1,'app':_0x3911('0xa3'),'appdata':_0x3911('0xa4'),'interval':_0x3911('0xa5')});}_0x35bbff['interaction']['created']=!![];}return db[_0x3911('0xa6')][_0x3911('0x5c')]({'phone':_0x35bbff[_0x3911('0x5d')]['from'],'messageId':_0x35bbff[_0x3911('0x5d')][_0x3911('0x82')],'body':_0x35bbff[_0x3911('0x5d')]['body'],'SmsAccountId':_0x24cafe[_0x3911('0x65')]['id'],'SmsInteractionId':_0x11b80c['id'],'direction':'in','ContactId':_0x11b80c['ContactId'],'AttachmentId':_0x35bbff[_0x3911('0x5d')][_0x3911('0xa7')]});})[_0x3911('0x21')](function(_0x1eeac3){_0x35bbff[_0x3911('0x27')]=_0x1eeac3;if(_0x35bbff[_0x3911('0x9f')][_0x3911('0xa8')]){return db[_0x3911('0xa9')]['find']({'attributes':['id','name'],'where':{'id':_0x35bbff['interaction'][_0x3911('0xa8')]}})[_0x3911('0x21')](function(_0x3c030d){if(_0x3c030d){_0x35bbff['applications'][_0x3911('0xaa')]({'id':0x0,'priority':0x0,'app':_0x3911('0xab'),'appdata':_0x3c030d[_0x3911('0x3b')]+','+(_0x35bbff[_0x3911('0x74')][_0x3911('0xac')]||0xa),'interval':_0x3911('0xa5')});}return respondWithRpcPromise(_0x3911('0xad'),_0x3911('0xae'),_0x35bbff);});}return respondWithRpcPromise(_0x3911('0xad'),_0x3911('0xae'),_0x35bbff);})[_0x3911('0x21')](function(_0x35b0bd){if(_0x35b0bd){var _0x307ff9=0xc8;var _0x3e25f9=_0x3911('0xaf');logger[_0x3911('0x28')](_0x3911('0x23'),_0x3e25f9,_0x307ff9,_0x3911('0xb0'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3e25f9,_0x307ff9,_0x3911('0xb0'),JSON[_0x3911('0x24')](_0x35b0bd));if(_0x35bbff[_0x3911('0x74')][_0x3911('0x50')]===_0x3911('0xb1')){return _0x5d40ee[_0x3911('0x2c')](_0x307ff9)[_0x3911('0xb2')]('Content-Type',_0x3911('0xb3'))[_0x3911('0x3c')](_0x3911('0xb4'));}else{return _0x5d40ee[_0x3911('0x2c')](_0x307ff9)['json'](_0x35b0bd);}}})[_0x3911('0x2a')](handleError(_0x5d40ee,null));};exports[_0x3911('0xb5')]=function(_0x27ab67,_0x4445bc){var _0x287d39=_0x27ab67[_0x3911('0x65')]['id'];var _0x1d2907=_0x27ab67[_0x3911('0x5d')];var _0x2a847f=0xc8;var _0xda60c5=null;return db[_0x3911('0xb6')][_0x3911('0xb7')]({'isolationLevel':db['sequelize'][_0x3911('0xb8')][_0x3911('0xb9')][_0x3911('0xba')]},function(_0x418e0e){return db[_0x3911('0x3f')][_0x3911('0xbb')]({'where':{'id':_0x287d39},'transaction':_0x418e0e})['then'](function(_0x40931b){if(_0x40931b){return db[_0x3911('0x73')][_0x3911('0x39')]({'where':{'SmsAccountId':_0x287d39},'transaction':_0x418e0e})[_0x3911('0x21')](function(){var _0x310522=_[_0x3911('0x42')](_0x1d2907,function(_0x207da4){_0x207da4[_0x3911('0x68')]=_0x287d39;return _0x207da4;});return db[_0x3911('0x73')]['bulkCreate'](_0x310522,{'transaction':_0x418e0e});});}else{_0x2a847f=0x194;_0xda60c5=[];}});})[_0x3911('0x21')](function(){if(_0x2a847f!==0x194){return db[_0x3911('0x73')][_0x3911('0xbc')]({'where':{'SmsAccountId':_0x287d39},'order':_0x3911('0xbd')})['then'](function(_0x13acff){_0xda60c5=_0x13acff;});}})[_0x3911('0x2a')](function(_0x326ee8){_0x2a847f=0x1f4;logger[_0x3911('0x25')](_0x326ee8['stack']);if(_0x326ee8['name']){delete _0x326ee8[_0x3911('0x3b')];}_0xda60c5=_0x326ee8;})[_0x3911('0xbe')](function(){if(_0xda60c5===null){_0x4445bc['sendStatus'](_0x2a847f);}else{if(_0x2a847f===0x1f4){_0x4445bc[_0x3911('0x2c')](_0x2a847f)['send'](_0xda60c5);}else{_0x4445bc[_0x3911('0x2c')](_0x2a847f)[_0x3911('0x2d')](_0xda60c5);}}});};exports[_0x3911('0xbf')]=function(_0x38ddce,_0xa633a3,_0x4c4cd6){var _0x2ba4bd={};var _0x2b934a={};var _0x59decb;var _0x420174;return db[_0x3911('0x3f')][_0x3911('0xbb')]({'where':{'id':_0x38ddce[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0xa633a3,null))['then'](function(_0x1cf658){if(_0x1cf658){_0x59decb=_0x1cf658;_0x2b934a[_0x3911('0x47')]=_['keys'](db[_0x3911('0x73')][_0x3911('0x40')]);_0x2b934a[_0x3911('0x43')]=_[_0x3911('0x59')](_0x38ddce[_0x3911('0x43')]);_0x2b934a['filters']=_[_0x3911('0x45')](_0x2b934a[_0x3911('0x47')],_0x2b934a[_0x3911('0x43')]);_0x2ba4bd[_0x3911('0x46')]=_[_0x3911('0x45')](_0x2b934a[_0x3911('0x47')],qs['fields'](_0x38ddce['query']['fields']));_0x2ba4bd[_0x3911('0x46')]=_0x2ba4bd[_0x3911('0x46')][_0x3911('0x5a')]?_0x2ba4bd[_0x3911('0x46')]:_0x2b934a['model'];_0x2ba4bd[_0x3911('0x4b')]=qs[_0x3911('0x4c')](_0x38ddce[_0x3911('0x43')][_0x3911('0x4c')]);_0x2ba4bd[_0x3911('0x4f')]=qs[_0x3911('0x44')](_[_0x3911('0x4d')](_0x38ddce[_0x3911('0x43')],_0x2b934a['filters']));if(_0x38ddce[_0x3911('0x43')]['filter']){_0x2ba4bd[_0x3911('0x4f')]=_[_0x3911('0x6b')](_0x2ba4bd[_0x3911('0x4f')],{'$or':_['map'](_0x2ba4bd[_0x3911('0x46')],function(_0x2d363b){var _0x5eed1c={};_0x5eed1c[_0x2d363b]={'$like':'%'+_0x38ddce[_0x3911('0x43')]['filter']+'%'};return _0x5eed1c;})});}_0x2ba4bd=_['merge']({},_0x2ba4bd,_0x38ddce[_0x3911('0x52')]);return _0x59decb['getApplications'](_0x2ba4bd);}})[_0x3911('0x21')](function(_0xadf2){if(_0xadf2){_0x420174=_0xadf2[_0x3911('0x5a')];if(!_0x38ddce['query'][_0x3911('0x49')](_0x3911('0x4a'))){_0x2ba4bd[_0x3911('0x30')]=qs[_0x3911('0x30')](_0x38ddce[_0x3911('0x43')][_0x3911('0x30')]);_0x2ba4bd['offset']=qs[_0x3911('0x2e')](_0x38ddce[_0x3911('0x43')][_0x3911('0x2e')]);}return _0x59decb[_0x3911('0xbf')](_0x2ba4bd);}})[_0x3911('0x21')](function(_0x511a84){if(_0x511a84){return _0x511a84?{'count':_0x420174,'rows':_0x511a84}:null;}})[_0x3911('0x21')](respondWithResult(_0xa633a3,null))[_0x3911('0x2a')](handleError(_0xa633a3,null));};exports['getInteractions']=function(_0x2bd5d6,_0x2308ba,_0x1fd47e){var _0x5d83a6={'raw':![],'where':{}};var _0x55dedd={};var _0x2c23ca={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3911('0xbb')]({'where':{'id':_0x2bd5d6[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x2308ba,null))[_0x3911('0x21')](function(_0x4d2cfd){if(_0x4d2cfd){_0x55dedd['model']=_[_0x3911('0x59')](db['SmsInteraction']['rawAttributes']);_0x55dedd['query']=_[_0x3911('0x59')](_0x2bd5d6[_0x3911('0x43')]);_0x55dedd[_0x3911('0x44')]=_[_0x3911('0x45')](_0x55dedd[_0x3911('0x47')],_0x55dedd[_0x3911('0x43')]);_0x5d83a6[_0x3911('0x46')]=_[_0x3911('0x45')](_0x55dedd[_0x3911('0x47')],qs['fields'](_0x2bd5d6[_0x3911('0x43')]['fields']));_0x5d83a6[_0x3911('0x46')]=_0x5d83a6[_0x3911('0x46')][_0x3911('0x5a')]?_0x5d83a6[_0x3911('0x46')]:_0x55dedd[_0x3911('0x47')];if(!_0x2bd5d6[_0x3911('0x43')][_0x3911('0x49')](_0x3911('0x4a'))){_0x5d83a6['limit']=qs['limit'](_0x2bd5d6['query'][_0x3911('0x30')]);_0x5d83a6['offset']=qs[_0x3911('0x2e')](_0x2bd5d6[_0x3911('0x43')][_0x3911('0x2e')]);}_0x5d83a6['order']=qs[_0x3911('0x4c')](_0x2bd5d6[_0x3911('0x43')][_0x3911('0x4c')]);_0x5d83a6[_0x3911('0x4f')]=qs[_0x3911('0x44')](_[_0x3911('0x4d')](_0x2bd5d6[_0x3911('0x43')],_0x55dedd[_0x3911('0x44')]));_0x5d83a6['where'][_0x3911('0x68')]=_0x4d2cfd['id'];if(_0x2bd5d6[_0x3911('0x43')]['filter']){_0x5d83a6[_0x3911('0x4f')]=_[_0x3911('0x6b')](_0x5d83a6[_0x3911('0x4f')],{'$or':_['map'](_0x5d83a6['attributes'],function(_0x482986){var _0x9ab512={};_0x9ab512[_0x482986]={'$like':'%'+_0x2bd5d6[_0x3911('0x43')][_0x3911('0x4e')]+'%'};return _0x9ab512;})});}_0x5d83a6=_[_0x3911('0x6b')]({},_0x5d83a6,_0x2bd5d6[_0x3911('0x52')]);return db['SmsInteraction'][_0x3911('0x31')]({'where':_0x5d83a6['where']})[_0x3911('0x21')](function(_0x3f0370){_0x2c23ca[_0x3911('0x31')]=_0x3f0370;if(_0x2bd5d6[_0x3911('0x43')][_0x3911('0x53')]){_0x5d83a6[_0x3911('0x54')]=[{'model':db[_0x3911('0x77')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x3911('0x3b'),_0x3911('0xc0'),_0x3911('0xc1')],'required':![]},{'model':db[_0x3911('0xc2')],'as':_0x3911('0xc3'),'attributes':['id',_0x3911('0x3b'),_0x3911('0xc4')],'where':_0x2bd5d6[_0x3911('0x43')][_0x3911('0xc5')]?{'id':_0x2bd5d6[_0x3911('0x43')][_0x3911('0xc5')]}:undefined,'required':_0x2bd5d6[_0x3911('0x43')][_0x3911('0xc5')]?!![]:![]}];}return db[_0x3911('0x9d')]['findAll'](_0x5d83a6);})['then'](function(_0x56ccb6){_0x2c23ca[_0x3911('0x56')]=_0x56ccb6;return _0x2c23ca;});}})[_0x3911('0x21')](respondWithFilteredResult(_0x2308ba,_0x5d83a6))[_0x3911('0x2a')](handleError(_0x2308ba,null));};exports[_0x3911('0x3c')]=function(_0x50e85f,_0x3f86a2,_0x1f475e){var _0x389a7d,_0x3d7bf8,_0x384838;if(_['isNil'](_0x50e85f['body']['body'])||_0x50e85f[_0x3911('0x5d')][_0x3911('0x5d')]===''){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))](_0x3911('0xc6'));}if(_[_0x3911('0x93')](_0x50e85f[_0x3911('0x5d')]['to'])){throw new db[(_0x3911('0x78'))]['ValidationError'](_0x3911('0xc7'));}_0x389a7d=_0x50e85f[_0x3911('0x5d')]['to'];return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x50e85f[_0x3911('0x65')]['id']},'include':[{'model':db[_0x3911('0x97')],'as':_0x3911('0xc8'),'include':[{'model':db[_0x3911('0x77')],'as':_0x3911('0x98'),'where':{'mobile':_0x389a7d},'limit':0x1,'order':[[_0x3911('0x7c'),_0x3911('0x99')]]}]}]})['then'](handleEntityNotFound(_0x3f86a2,null))[_0x3911('0x21')](function(_0x30d2cc){if(_0x30d2cc&&_0x30d2cc[_0x3911('0xc8')]){_0x3d7bf8=_0x30d2cc[_0x3911('0x36')]({'plain':!![]});if(_0x3d7bf8[_0x3911('0xc8')]&&_0x3d7bf8[_0x3911('0xc8')][_0x3911('0x98')][_0x3911('0x5a')]){return _0x3d7bf8[_0x3911('0xc8')][_0x3911('0x98')][0x0];}return db[_0x3911('0x77')][_0x3911('0x5c')](_[_0x3911('0x9c')](_0x50e85f['body'],{'firstName':_0x389a7d,'mobile':_0x389a7d,'phone':_0x389a7d,'ListId':_0x3d7bf8[_0x3911('0x7e')]}));}})[_0x3911('0x21')](handleEntityNotFound(_0x3f86a2,null))['then'](function(_0x588257){if(_0x588257){_0x384838=_0x588257;return db['SmsInteraction'][_0x3911('0x5b')]({'where':{'ContactId':_0x384838['id'],'closed':![],'SmsAccountId':_0x3d7bf8['id']}})['then'](function(_0x17b75b){if(_0x17b75b){return[_0x17b75b,![]];}return db['SmsInteraction'][_0x3911('0x5c')]({'UserId':_0x50e85f[_0x3911('0x60')]['id'],'ContactId':_0x384838['id'],'SmsAccountId':_0x3d7bf8['id'],'phone':_0x389a7d,'firstMsgDirection':_0x3911('0xc9'),'Messages':[_[_0x3911('0x6b')](_0x50e85f[_0x3911('0x5d')],{'read':![],'body':_0x50e85f[_0x3911('0x5d')][_0x3911('0x5d')],'phone':_0x389a7d,'SmsAccountId':_0x3d7bf8['id'],'UserId':_0x50e85f[_0x3911('0x60')]['id'],'ContactId':_0x384838['id']})]},{'include':[{'model':db[_0x3911('0xa6')],'as':'Messages'}]})[_0x3911('0x21')](function(_0x14d9eb){return[_0x14d9eb,!![]];});});}})[_0x3911('0x9e')](function(_0x13c9d8,_0xdcdb7f){if(_0xdcdb7f){return _0x13c9d8;}return db['SmsMessage'][_0x3911('0x5c')](_[_0x3911('0x6b')](_0x50e85f[_0x3911('0x5d')],{'read':![],'body':_0x50e85f[_0x3911('0x5d')][_0x3911('0x5d')],'phone':_0x389a7d,'SmsAccountId':_0x3d7bf8['id'],'SmsInteractionId':_0x13c9d8['id'],'UserId':_0x50e85f[_0x3911('0x60')]['id'],'ContactId':_0x384838['id']}))[_0x3911('0x21')](function(_0x1ba3a7){_0x13c9d8[_0x3911('0xca')]['Messages']=[];_0x13c9d8[_0x3911('0xca')][_0x3911('0xcb')][_0x3911('0xa2')](_0x1ba3a7[_0x3911('0xca')]);return _0x13c9d8;});})[_0x3911('0x21')](respondWithResult(_0x3f86a2,null))[_0x3911('0x2a')](handleError(_0x3f86a2,null));};exports['status']=function(_0x2729b9,_0x35c18e,_0x243e7b){if(_0x2729b9[_0x3911('0x5d')]['id']){delete _0x2729b9['body']['id'];}var _0x41ce99,_0x169ccd,_0x468d80;return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x2729b9[_0x3911('0x65')]['id']}})['then'](handleEntityNotFound(_0x35c18e,null))[_0x3911('0x21')](function(_0x210fa3){if(_0x210fa3){_0x468d80=_0x210fa3;logger[_0x3911('0xcc')](_0x3911('0x23'),'status',_0x3911('0xcd'),_0x210fa3[_0x3911('0x50')],util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));switch(_0x210fa3[_0x3911('0x50')]){case _0x3911('0x84'):if(_0x2729b9[_0x3911('0x5d')][_0x3911('0xcf')]&&_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')]){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')];return db[_0x3911('0xa6')][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9[_0x3911('0x5d')][_0x3911('0xcf')]}});}break;case'connectel':if(_0x2729b9['body'][_0x3911('0xd0')]&&_0x2729b9[_0x3911('0x5d')]['statusInt']){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0xd1')];return db[_0x3911('0xa6')]['find']({'where':{'messageId':_0x2729b9[_0x3911('0x5d')][_0x3911('0xd0')]}});}break;case _0x3911('0x88'):if(_0x2729b9[_0x3911('0x5d')][_0x3911('0xd2')]&&_0x2729b9[_0x3911('0x5d')][_0x3911('0xd3')]){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0xd3')];return db[_0x3911('0xa6')][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9['body'][_0x3911('0xd2')]}});}break;case _0x3911('0xd4'):var _0x20edaf=_0x2729b9[_0x3911('0x5d')][_0x3911('0x8a')][0x0];if(_0x20edaf['messageId']&&_0x20edaf['status'][_0x3911('0xd5')]===_0x3911('0xd6')){_0x169ccd=_0x20edaf['status']['groupName'];return db[_0x3911('0xa6')]['find']({'where':{'messageId':_0x20edaf[_0x3911('0x82')]}});}break;case _0x3911('0x8d'):if(_0x2729b9[_0x3911('0x5d')][_0x3911('0x82')]&&_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')]){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')];return db['SmsMessage'][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9['body'][_0x3911('0x82')]}});}break;case _0x3911('0x90'):if(_0x2729b9['body'][0x0][_0x3911('0x27')]['id']){_0x169ccd=_0x2729b9[_0x3911('0x5d')][0x0][_0x3911('0x50')];return db[_0x3911('0xa6')][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9['body'][0x0]['message']['id']}});}break;case _0x3911('0x91'):if(_0x2729b9[_0x3911('0x5d')]['redif']&&_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')]){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')];return db['SmsMessage'][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9[_0x3911('0x5d')][_0x3911('0xd7')]}});}break;}}})[_0x3911('0x21')](handleEntityNotFound(_0x35c18e,null))[_0x3911('0x21')](function(_0x10f7f0){if(_0x10f7f0){_0x41ce99=_0x10f7f0;switch(_0x468d80['type']){case'skebby':if(_0x169ccd===_0x3911('0xd6')){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger['error'](_0x3911('0x23'),_0x3911('0x2c'),_0x3911('0x84'),util['inspect'](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0x86'):if(_0x169ccd==='1'){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),_0x3911('0x2c'),'skebby',util['inspect'](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0x88'):if(!_0x2729b9[_0x3911('0x5d')][_0x3911('0xd8')]&&_0x169ccd>=0xc8&&_0x169ccd<=0xce){return _0x41ce99['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3911('0x2c'),_0x3911('0x88'),util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0xd4'):var _0x2042de=_0x2729b9[_0x3911('0x5d')]['results'][0x0];if(_0x2042de[_0x3911('0x2c')][_0x3911('0xd5')]==='DELIVERED'){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3911('0x2c'),_0x3911('0xd4'),util['inspect'](_0x2729b9['body'],{'showHidden':![],'depth':null}));}break;case _0x3911('0x8d'):if(_0x169ccd==_0x3911('0xd9')||_0x169ccd==_0x3911('0xda')){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),_0x3911('0x2c'),'clickatell',util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0x90'):if(_0x169ccd==_0x3911('0xdb')){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),_0x3911('0x2c'),_0x3911('0x90'),util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0x91'):if(_0x169ccd===_0x3911('0xdc')||_0x169ccd===_0x3911('0xdd')){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),_0x3911('0x2c'),_0x3911('0x91'),util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x41ce99;}})[_0x3911('0x21')](respondWithResult(_0x35c18e,null))['catch'](handleError(_0x35c18e,null));};exports[_0x3911('0xde')]=function(_0x3e68e8,_0x2a3a89,_0x4f87fa){var _0x135754,_0x3d856f,_0x35297f;return db[_0x3911('0x3f')]['find']({'where':{'id':_0x3e68e8['params']['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x2a3a89,null))[_0x3911('0x21')](function(_0x5e2df3){if(_0x5e2df3){_0x35297f=_0x5e2df3;logger[_0x3911('0xcc')](_0x3911('0x23'),_0x3911('0x2c'),_0x3911('0xcd'),_0x5e2df3[_0x3911('0x50')],util[_0x3911('0xce')](_0x3e68e8[_0x3911('0x43')],{'showHidden':![],'depth':null}));switch(_0x5e2df3[_0x3911('0x50')]){case _0x3911('0x8b'):if(_0x3e68e8[_0x3911('0x43')]['message-id']&&_0x3e68e8['query']['state']){_0x3d856f=_0x3e68e8['query']['state'];return db[_0x3911('0xa6')][_0x3911('0x5b')]({'where':{'messageId':_0x3e68e8[_0x3911('0x43')]['message-id']}});}break;}}})[_0x3911('0x21')](handleEntityNotFound(_0x2a3a89,null))['then'](function(_0x2c66){if(_0x2c66){_0x135754=_0x2c66;switch(_0x35297f['type']){case _0x3911('0x8b'):if(_0x3d856f==='2'||_0x3d856f==='6'){return _0x135754[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),'status',_0x3911('0x8b'),util[_0x3911('0xce')](_0x3e68e8[_0x3911('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x135754;}})[_0x3911('0x21')](respondWithResult(_0x2a3a89,null))['catch'](handleError(_0x2a3a89,null));};exports[_0x3911('0xdf')]=function(_0x3910f8,_0x2f46eb,_0x4a1cfe){return db['SmsAccount'][_0x3911('0x5b')]({'where':{'id':_0x3910f8['params']['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x2f46eb,null))[_0x3911('0x21')](function(_0x265654){if(_0x265654){return _0x265654[_0x3911('0xdf')](_0x3910f8[_0x3911('0x5d')][_0x3911('0x6d')],_[_0x3911('0x9b')](_0x3910f8[_0x3911('0x5d')],[_0x3911('0x6d'),'id'])||{})[_0x3911('0x9e')](function(_0x2e6682){for(var _0x496418=0x0;_0x496418<_0x3910f8[_0x3911('0x5d')][_0x3911('0x6d')][_0x3911('0x5a')];_0x496418+=0x1){socket[_0x3911('0xe0')](_0x3911('0xe1'),{'UserId':Number(_0x3910f8[_0x3911('0x5d')][_0x3911('0x6d')][_0x496418]),'SmsAccountId':Number(_0x3910f8[_0x3911('0x65')]['id'])});}return _0x2e6682;});}})[_0x3911('0x21')](respondWithResult(_0x2f46eb,null))[_0x3911('0x2a')](handleError(_0x2f46eb,null));};exports[_0x3911('0xe2')]=function(_0x1a6b21,_0x5592c2,_0x273d15){return db['SmsAccount']['find']({'where':{'id':_0x1a6b21[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x5592c2,null))['then'](function(_0x22fff8){if(_0x22fff8){return _0x22fff8[_0x3911('0xe2')](_0x1a6b21[_0x3911('0x43')][_0x3911('0x6d')])['then'](function(){if(_[_0x3911('0xe3')](_0x1a6b21['query'][_0x3911('0x6d')])){for(var _0x3f5166=0x0;_0x3f5166<_0x1a6b21[_0x3911('0x43')]['ids'][_0x3911('0x5a')];_0x3f5166+=0x1){socket[_0x3911('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x1a6b21[_0x3911('0x43')][_0x3911('0x6d')][_0x3f5166]),'SmsAccountId':Number(_0x1a6b21[_0x3911('0x65')]['id'])});}}else{socket[_0x3911('0xe0')](_0x3911('0xe4'),{'UserId':Number(_0x1a6b21[_0x3911('0x43')][_0x3911('0x6d')]),'SmsAccountId':Number(_0x1a6b21['params']['id'])});}});}})[_0x3911('0x21')](respondWithStatusCode(_0x5592c2,null))[_0x3911('0x2a')](handleError(_0x5592c2,null));};exports[_0x3911('0xe5')]=function(_0x3d2e34,_0x1c531a,_0x546bd3){var _0x390c19={};var _0x4989c1={};var _0x194647;var _0x1f4dcf;return db['SmsAccount']['findOne']({'where':{'id':_0x3d2e34[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x1c531a,null))[_0x3911('0x21')](function(_0x5d4d8a){if(_0x5d4d8a){_0x194647=_0x5d4d8a;_0x4989c1['model']=_[_0x3911('0x59')](db[_0x3911('0xa9')][_0x3911('0x40')]);_0x4989c1['query']=_[_0x3911('0x59')](_0x3d2e34['query']);_0x4989c1['filters']=_[_0x3911('0x45')](_0x4989c1[_0x3911('0x47')],_0x4989c1['query']);_0x390c19[_0x3911('0x46')]=_['intersection'](_0x4989c1[_0x3911('0x47')],qs[_0x3911('0x48')](_0x3d2e34[_0x3911('0x43')][_0x3911('0x48')]));_0x390c19[_0x3911('0x46')]=_0x390c19['attributes']['length']?_0x390c19[_0x3911('0x46')]:_0x4989c1['model'];_0x390c19['order']=qs[_0x3911('0x4c')](_0x3d2e34[_0x3911('0x43')]['sort']);_0x390c19['where']=qs[_0x3911('0x44')](_['pick'](_0x3d2e34[_0x3911('0x43')],_0x4989c1[_0x3911('0x44')]));if(_0x3d2e34[_0x3911('0x43')][_0x3911('0x4e')]){_0x390c19['where']=_['merge'](_0x390c19[_0x3911('0x4f')],{'$or':_[_0x3911('0x42')](_0x390c19[_0x3911('0x46')],function(_0x4ce396){var _0x1e5127={};_0x1e5127[_0x4ce396]={'$like':'%'+_0x3d2e34[_0x3911('0x43')]['filter']+'%'};return _0x1e5127;})});}_0x390c19=_['merge']({},_0x390c19,_0x3d2e34[_0x3911('0x52')]);return _0x194647[_0x3911('0xe5')](_0x390c19);}})[_0x3911('0x21')](function(_0x596168){if(_0x596168){_0x1f4dcf=_0x596168[_0x3911('0x5a')];if(!_0x3d2e34['query'][_0x3911('0x49')](_0x3911('0x4a'))){_0x390c19[_0x3911('0x30')]=qs[_0x3911('0x30')](_0x3d2e34['query'][_0x3911('0x30')]);_0x390c19[_0x3911('0x2e')]=qs[_0x3911('0x2e')](_0x3d2e34[_0x3911('0x43')][_0x3911('0x2e')]);}return _0x194647[_0x3911('0xe5')](_0x390c19);}})['then'](function(_0x1e9785){if(_0x1e9785){return _0x1e9785?{'count':_0x1f4dcf,'rows':_0x1e9785}:null;}})['then'](respondWithResult(_0x1c531a,null))[_0x3911('0x2a')](handleError(_0x1c531a,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ab0fd89..0e19535 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 _0xdbad=['exports','events','SmsAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdbad,0x13c));var _0xddba=function(_0x3adfcd,_0x453886){_0x3adfcd=_0x3adfcd-0x0;var _0x239322=_0xdbad[_0x3adfcd];return _0x239322;};'use strict';var EventEmitter=require(_0xddba('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xddba('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xddba('0x2')](0x0);var events={'afterCreate':_0xddba('0x3'),'afterUpdate':'update','afterDestroy':_0xddba('0x4')};function emitEvent(_0x4fe067){return function(_0x56f375,_0x46f833,_0x5ee069){SmsAccountEvents[_0xddba('0x5')](_0x4fe067+':'+_0x56f375['id'],_0x56f375);SmsAccountEvents[_0xddba('0x5')](_0x4fe067,_0x56f375);_0x5ee069(null);};}for(var e in events){if(events[_0xddba('0x6')](e)){var event=events[e];SmsAccount[_0xddba('0x7')](e,emitEvent(event));}}module[_0xddba('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x479a=['events','../../mysqldb','SmsAccount','save','emit','hasOwnProperty','hook','exports'];(function(_0x22f924,_0x17b3db){var _0x558899=function(_0x1c7474){while(--_0x1c7474){_0x22f924['push'](_0x22f924['shift']());}};_0x558899(++_0x17b3db);}(_0x479a,0x158));var _0xa479=function(_0x415024,_0x53fed2){_0x415024=_0x415024-0x0;var _0x238cbd=_0x479a[_0x415024];return _0x238cbd;};'use strict';var EventEmitter=require(_0xa479('0x0'));var SmsAccount=require(_0xa479('0x1'))['db'][_0xa479('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa479('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e2a12){return function(_0x3bd9c5,_0x3793a2,_0x246e6f){SmsAccountEvents[_0xa479('0x4')](_0x3e2a12+':'+_0x3bd9c5['id'],_0x3bd9c5);SmsAccountEvents[_0xa479('0x4')](_0x3e2a12,_0x3bd9c5);_0x246e6f(null);};}for(var e in events){if(events[_0xa479('0x5')](e)){var event=events[e];SmsAccount[_0xa479('0x6')](e,emitEvent(event));}}module[_0xa479('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index eb2d0c0..431e4ad 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 _0x684b=['path','rimraf','../../config/environment','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0x684b,0x10d));var _0xb684=function(_0xc87b8c,_0xcadd0){_0xc87b8c=_0xc87b8c-0x0;var _0x242c16=_0x684b[_0xc87b8c];return _0x242c16;};'use strict';var _=require(_0xb684('0x0'));var util=require(_0xb684('0x1'));var logger=require(_0xb684('0x2'))(_0xb684('0x3'));var moment=require(_0xb684('0x4'));var BPromise=require(_0xb684('0x5'));var rp=require(_0xb684('0x6'));var fs=require('fs');var path=require(_0xb684('0x7'));var rimraf=require(_0xb684('0x8'));var config=require(_0xb684('0x9'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x4a9088,_0x1ad7f9){return _0x4a9088['define'](_0xb684('0xa'),attributes,{'tableName':_0xb684('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee8f=['exports','define','SmsAccount','sms_accounts','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x2830f9,_0x509012){var _0x556ca8=function(_0x55f604){while(--_0x55f604){_0x2830f9['push'](_0x2830f9['shift']());}};_0x556ca8(++_0x509012);}(_0xee8f,0xf4));var _0xfee8=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xee8f[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xfee8('0x0'));var logger=require(_0xfee8('0x1'))(_0xfee8('0x2'));var moment=require('moment');var BPromise=require(_0xfee8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfee8('0x4'));var rimraf=require(_0xfee8('0x5'));var config=require(_0xfee8('0x6'));var attributes=require(_0xfee8('0x7'));module[_0xfee8('0x8')]=function(_0x1b8218,_0x714426){return _0x1b8218[_0xfee8('0x9')](_0xfee8('0xa'),attributes,{'tableName':_0xfee8('0xb'),'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 9e46e4a..d25d795 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 _0xeb2f=['http','defaults','redis','socket.io-emitter','./smsAccount.socket','request','info','request\x20sent','debug','stringify','code','error','SmsAccount,\x20%s,\x20%s','message','SmsAccount','find','options','raw','attributes','map','include','model','then','ShowSmsAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x312440,_0x10c4aa){var _0x145314=function(_0x508530){while(--_0x508530){_0x312440['push'](_0x312440['shift']());}};_0x145314(++_0x10c4aa);}(_0xeb2f,0x177));var _0xfeb2=function(_0x40ff79,_0x578a04){_0x40ff79=_0x40ff79-0x0;var _0x32234c=_0xeb2f[_0x40ff79];return _0x32234c;};'use strict';var _=require(_0xfeb2('0x0'));var util=require('util');var moment=require(_0xfeb2('0x1'));var BPromise=require(_0xfeb2('0x2'));var rs=require(_0xfeb2('0x3'));var fs=require('fs');var Redis=require(_0xfeb2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfeb2('0x5'));var logger=require('../../config/logger')(_0xfeb2('0x6'));var config=require(_0xfeb2('0x7'));var jayson=require(_0xfeb2('0x8'));var client=jayson[_0xfeb2('0x9')][_0xfeb2('0xa')]({'port':0x232a});config['redis']=_[_0xfeb2('0xb')](config[_0xfeb2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfeb2('0xd'))(new Redis(config[_0xfeb2('0xc')]));require(_0xfeb2('0xe'))['register'](socket);function respondWithRpcPromise(_0x29b452,_0x3301b2,_0x33d4db){return new BPromise(function(_0x50197b,_0x3e7644){return client[_0xfeb2('0xf')](_0x29b452,_0x33d4db)['then'](function(_0xd1c73f){logger[_0xfeb2('0x10')]('SmsAccount,\x20%s,\x20%s',_0x3301b2,_0xfeb2('0x11'));logger[_0xfeb2('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3301b2,_0xfeb2('0x11'),JSON[_0xfeb2('0x13')](_0xd1c73f));if(_0xd1c73f['error']){if(_0xd1c73f['error'][_0xfeb2('0x14')]===0x1f4){logger[_0xfeb2('0x15')](_0xfeb2('0x16'),_0x3301b2,_0xd1c73f[_0xfeb2('0x15')]['message']);return _0x3e7644(_0xd1c73f[_0xfeb2('0x15')][_0xfeb2('0x17')]);}logger[_0xfeb2('0x15')](_0xfeb2('0x16'),_0x3301b2,_0xd1c73f[_0xfeb2('0x15')]['message']);return _0x50197b(_0xd1c73f['error']['message']);}else{logger[_0xfeb2('0x10')](_0xfeb2('0x16'),_0x3301b2,_0xfeb2('0x11'));_0x50197b(_0xd1c73f['result'][_0xfeb2('0x17')]);}})['catch'](function(_0x4bd3da){logger[_0xfeb2('0x15')]('SmsAccount,\x20%s,\x20%s',_0x3301b2,_0x4bd3da);_0x3e7644(_0x4bd3da);});});}exports['ShowSmsAccount']=function(_0x377437){var _0x3d15a4=this;return new Promise(function(_0x16b6bb,_0x23e335){return db[_0xfeb2('0x18')][_0xfeb2('0x19')]({'raw':_0x377437[_0xfeb2('0x1a')]?_0x377437['options'][_0xfeb2('0x1b')]===undefined?!![]:![]:!![],'where':_0x377437[_0xfeb2('0x1a')]?_0x377437[_0xfeb2('0x1a')]['where']||null:null,'attributes':_0x377437[_0xfeb2('0x1a')]?_0x377437['options'][_0xfeb2('0x1c')]||null:null,'include':_0x377437[_0xfeb2('0x1a')]?_0x377437[_0xfeb2('0x1a')]['include']?_[_0xfeb2('0x1d')](_0x377437[_0xfeb2('0x1a')][_0xfeb2('0x1e')],function(_0x4c8e5b){return{'model':db[_0x4c8e5b[_0xfeb2('0x1f')]],'as':_0x4c8e5b['as'],'attributes':_0x4c8e5b[_0xfeb2('0x1c')],'include':_0x4c8e5b[_0xfeb2('0x1e')]?_['map'](_0x4c8e5b['include'],function(_0x325ff3){return{'model':db[_0x325ff3[_0xfeb2('0x1f')]],'as':_0x325ff3['as'],'attributes':_0x325ff3[_0xfeb2('0x1c')],'include':_0x325ff3[_0xfeb2('0x1e')]?_[_0xfeb2('0x1d')](_0x325ff3[_0xfeb2('0x1e')],function(_0x3ea10c){return{'model':db[_0x3ea10c[_0xfeb2('0x1f')]],'as':_0x3ea10c['as'],'attributes':_0x3ea10c[_0xfeb2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfeb2('0x20')](function(_0x4c4133){logger[_0xfeb2('0x10')](_0xfeb2('0x21'),_0x377437);logger['debug'](_0xfeb2('0x21'),_0x377437,JSON[_0xfeb2('0x13')](_0x4c4133));_0x16b6bb(_0x4c4133);})[_0xfeb2('0x22')](function(_0x2c66a6){logger['error']('ShowSmsAccount',_0x2c66a6[_0xfeb2('0x17')],_0x377437);_0x23e335(_0x3d15a4[_0xfeb2('0x15')](0x1f4,_0x2c66a6['message']));});});}; \ No newline at end of file +var _0xa66b=['error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x501831,_0x4d0b01){var _0x3ac5d5=function(_0x400174){while(--_0x400174){_0x501831['push'](_0x501831['shift']());}};_0x3ac5d5(++_0x4d0b01);}(_0xa66b,0x180));var _0xba66=function(_0x5e4ffa,_0x56154d){_0x5e4ffa=_0x5e4ffa-0x0;var _0x43a656=_0xa66b[_0x5e4ffa];return _0x43a656;};'use strict';var _=require('lodash');var util=require(_0xba66('0x0'));var moment=require(_0xba66('0x1'));var BPromise=require(_0xba66('0x2'));var rs=require(_0xba66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba66('0x4'))['db'];var utils=require(_0xba66('0x5'));var logger=require(_0xba66('0x6'))(_0xba66('0x7'));var config=require(_0xba66('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xba66('0x9')][_0xba66('0xa')]({'port':0x232a});config['redis']=_[_0xba66('0xb')](config[_0xba66('0xc')],{'host':_0xba66('0xd'),'port':0x18eb});var socket=require(_0xba66('0xe'))(new Redis(config[_0xba66('0xc')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x217dfc,_0x285c62,_0xd70571){return new BPromise(function(_0x29f5a3,_0x30f4ee){return client[_0xba66('0xf')](_0x217dfc,_0xd70571)[_0xba66('0x10')](function(_0x5da6de){logger[_0xba66('0x11')](_0xba66('0x12'),_0x285c62,_0xba66('0x13'));logger[_0xba66('0x14')](_0xba66('0x15'),_0x285c62,'request\x20sent',JSON[_0xba66('0x16')](_0x5da6de));if(_0x5da6de[_0xba66('0x17')]){if(_0x5da6de[_0xba66('0x17')][_0xba66('0x18')]===0x1f4){logger[_0xba66('0x17')](_0xba66('0x12'),_0x285c62,_0x5da6de['error']['message']);return _0x30f4ee(_0x5da6de[_0xba66('0x17')][_0xba66('0x19')]);}logger[_0xba66('0x17')](_0xba66('0x12'),_0x285c62,_0x5da6de[_0xba66('0x17')][_0xba66('0x19')]);return _0x29f5a3(_0x5da6de[_0xba66('0x17')][_0xba66('0x19')]);}else{logger[_0xba66('0x11')]('SmsAccount,\x20%s,\x20%s',_0x285c62,_0xba66('0x13'));_0x29f5a3(_0x5da6de['result'][_0xba66('0x19')]);}})[_0xba66('0x1a')](function(_0x4cd991){logger[_0xba66('0x17')]('SmsAccount,\x20%s,\x20%s',_0x285c62,_0x4cd991);_0x30f4ee(_0x4cd991);});});}exports[_0xba66('0x1b')]=function(_0x20d252){var _0x568de4=this;return new Promise(function(_0x31f746,_0x50c239){return db[_0xba66('0x1c')][_0xba66('0x1d')]({'raw':_0x20d252[_0xba66('0x1e')]?_0x20d252[_0xba66('0x1e')][_0xba66('0x1f')]===undefined?!![]:![]:!![],'where':_0x20d252[_0xba66('0x1e')]?_0x20d252[_0xba66('0x1e')][_0xba66('0x20')]||null:null,'attributes':_0x20d252[_0xba66('0x1e')]?_0x20d252[_0xba66('0x1e')]['attributes']||null:null,'include':_0x20d252[_0xba66('0x1e')]?_0x20d252[_0xba66('0x1e')][_0xba66('0x21')]?_[_0xba66('0x22')](_0x20d252[_0xba66('0x1e')]['include'],function(_0x52f8b2){return{'model':db[_0x52f8b2[_0xba66('0x23')]],'as':_0x52f8b2['as'],'attributes':_0x52f8b2[_0xba66('0x24')],'include':_0x52f8b2[_0xba66('0x21')]?_['map'](_0x52f8b2[_0xba66('0x21')],function(_0x250601){return{'model':db[_0x250601[_0xba66('0x23')]],'as':_0x250601['as'],'attributes':_0x250601[_0xba66('0x24')],'include':_0x250601[_0xba66('0x21')]?_[_0xba66('0x22')](_0x250601[_0xba66('0x21')],function(_0x1d0150){return{'model':db[_0x1d0150[_0xba66('0x23')]],'as':_0x1d0150['as'],'attributes':_0x1d0150[_0xba66('0x24')]};}):[]};}):[]};}):[]:[]})[_0xba66('0x10')](function(_0x1610da){logger[_0xba66('0x11')](_0xba66('0x1b'),_0x20d252);logger[_0xba66('0x14')](_0xba66('0x1b'),_0x20d252,JSON[_0xba66('0x16')](_0x1610da));_0x31f746(_0x1610da);})[_0xba66('0x1a')](function(_0x417ac2){logger['error'](_0xba66('0x1b'),_0x417ac2[_0xba66('0x19')],_0x20d252);_0x50c239(_0x568de4['error'](0x1f4,_0x417ac2['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index e56824c..305fa02 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 3534277..9116a14 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x46415c,_0x11c85e){var _0x5983e0=function(_0x316127){while(--_0x316127){_0x46415c['push'](_0x46415c['shift']());}};_0x5983e0(++_0x11c85e);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x40dbb2,_0x258f53){var _0x14e768=function(_0x538843){while(--_0x538843){_0x40dbb2['push'](_0x40dbb2['shift']());}};_0x14e768(++_0x258f53);}(_0x008c,0x188));var _0xc008=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x008c[_0xbec8e6];return _0x4aa6f2;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ecc7fd4..df4e8eb 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 _0x6f76=['*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x543f55,_0x3c3828){var _0xce8f8f=function(_0x1d5d39){while(--_0x1d5d39){_0x543f55['push'](_0x543f55['shift']());}};_0xce8f8f(++_0x3c3828);}(_0x6f76,0xc4));var _0x66f7=function(_0x154079,_0x2b89cb){_0x154079=_0x154079-0x0;var _0x4f0bdb=_0x6f76[_0x154079];return _0x4f0bdb;};'use strict';var Sequelize=require('sequelize');module[_0x66f7('0x0')]={'priority':{'type':Sequelize[_0x66f7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x66f7('0x2')],'allowNull':![],'defaultValue':_0x66f7('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x66f7('0x2')]},'interval':{'type':Sequelize[_0x66f7('0x2')],'defaultValue':_0x66f7('0x4')}}; \ No newline at end of file +var _0x168a=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x168a,0x19d));var _0xa168=function(_0x297153,_0x238b8f){_0x297153=_0x297153-0x0;var _0x308d7e=_0x168a[_0x297153];return _0x308d7e;};'use strict';var Sequelize=require(_0xa168('0x0'));module[_0xa168('0x1')]={'priority':{'type':Sequelize[_0xa168('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa168('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa168('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa168('0x3')],'defaultValue':_0xa168('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 25e7e38..8a48920 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 _0x8e4c=['apply','reject','save','update','then','error','stack','name','index','map','SmsApplication','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json'];(function(_0x570435,_0x3fd1bb){var _0x5084c1=function(_0x29ab8a){while(--_0x29ab8a){_0x570435['push'](_0x570435['shift']());}};_0x5084c1(++_0x3fd1bb);}(_0x8e4c,0x14b));var _0xc8e4=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0x8e4c[_0x5de1bc];return _0x19f4b8;};'use strict';var emlformat=require(_0xc8e4('0x0'));var rimraf=require(_0xc8e4('0x1'));var zipdir=require(_0xc8e4('0x2'));var jsonpatch=require(_0xc8e4('0x3'));var rp=require('request-promise');var moment=require(_0xc8e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc8e4('0x5'));var util=require(_0xc8e4('0x6'));var path=require(_0xc8e4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8e4('0x8'));var _=require(_0xc8e4('0x9'));var squel=require(_0xc8e4('0xa'));var crypto=require(_0xc8e4('0xb'));var jsforce=require(_0xc8e4('0xc'));var deskjs=require(_0xc8e4('0xd'));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(_0xc8e4('0xe'));var as=require(_0xc8e4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc8e4('0x10'));var utils=require(_0xc8e4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc8e4('0x12'));var db=require(_0xc8e4('0x13'))['db'];function respondWithStatusCode(_0x3a1b01,_0x9a66de){_0x9a66de=_0x9a66de||0xcc;return function(_0x33d99d){if(_0x33d99d){return _0x3a1b01[_0xc8e4('0x14')](_0x9a66de);}return _0x3a1b01[_0xc8e4('0x15')](_0x9a66de)[_0xc8e4('0x16')]();};}function respondWithResult(_0xdb5fec,_0x2ff103){_0x2ff103=_0x2ff103||0xc8;return function(_0x47b5b8){if(_0x47b5b8){return _0xdb5fec[_0xc8e4('0x15')](_0x2ff103)['json'](_0x47b5b8);}};}function respondWithFilteredResult(_0x58c8da,_0x2b089f){return function(_0x452906){if(_0x452906){var _0x45b5f7=typeof _0x2b089f[_0xc8e4('0x17')]===_0xc8e4('0x18')&&typeof _0x2b089f[_0xc8e4('0x19')]==='undefined';var _0x3fb80a=_0x452906[_0xc8e4('0x1a')];var _0xe62ec8=_0x45b5f7?0x0:_0x2b089f[_0xc8e4('0x17')];var _0x501f56=_0x45b5f7?_0x452906['count']:_0x2b089f[_0xc8e4('0x17')]+_0x2b089f[_0xc8e4('0x19')];var _0x1c2278;if(_0x501f56>=_0x3fb80a){_0x501f56=_0x3fb80a;_0x1c2278=0xc8;}else{_0x1c2278=0xce;}_0x58c8da[_0xc8e4('0x15')](_0x1c2278);return _0x58c8da[_0xc8e4('0x1b')]('Content-Range',_0xe62ec8+'-'+_0x501f56+'/'+_0x3fb80a)[_0xc8e4('0x1c')](_0x452906);}return null;};}function patchUpdates(_0x35fba7){return function(_0x2c4344){try{jsonpatch[_0xc8e4('0x1d')](_0x2c4344,_0x35fba7,!![]);}catch(_0x2d6d24){return BPromise[_0xc8e4('0x1e')](_0x2d6d24);}return _0x2c4344[_0xc8e4('0x1f')]();};}function saveUpdates(_0x4ebc67,_0x126593){return function(_0xf43699){if(_0xf43699){return _0xf43699[_0xc8e4('0x20')](_0x4ebc67)[_0xc8e4('0x21')](function(_0x2d555b){return _0x2d555b;});}return null;};}function removeEntity(_0x37bfc4,_0x242fd3){return function(_0x5123b0){if(_0x5123b0){return _0x5123b0['destroy']()['then'](function(){_0x37bfc4[_0xc8e4('0x15')](0xcc)[_0xc8e4('0x16')]();});}};}function handleEntityNotFound(_0xbb65f1,_0x338488){return function(_0xd4d1c5){if(!_0xd4d1c5){_0xbb65f1[_0xc8e4('0x14')](0x194);}return _0xd4d1c5;};}function handleError(_0xa9a5a2,_0x314221){_0x314221=_0x314221||0x1f4;return function(_0x160078){logger[_0xc8e4('0x22')](_0x160078[_0xc8e4('0x23')]);if(_0x160078[_0xc8e4('0x24')]){delete _0x160078[_0xc8e4('0x24')];}_0xa9a5a2['status'](_0x314221)['send'](_0x160078);};}exports[_0xc8e4('0x25')]=function(_0x206d63,_0x5d41fe){var _0xebd4c9={},_0x3cba92={},_0x222073={'count':0x0,'rows':[]};var _0x57057f=_[_0xc8e4('0x26')](db[_0xc8e4('0x27')]['rawAttributes'],function(_0x3da6fb){return{'name':_0x3da6fb[_0xc8e4('0x28')],'type':_0x3da6fb[_0xc8e4('0x29')][_0xc8e4('0x2a')]};});_0x3cba92[_0xc8e4('0x2b')]=_[_0xc8e4('0x26')](_0x57057f,'name');_0x3cba92['query']=_[_0xc8e4('0x2c')](_0x206d63['query']);_0x3cba92[_0xc8e4('0x2d')]=_[_0xc8e4('0x2e')](_0x3cba92[_0xc8e4('0x2b')],_0x3cba92[_0xc8e4('0x2f')]);_0xebd4c9[_0xc8e4('0x30')]=_[_0xc8e4('0x2e')](_0x3cba92[_0xc8e4('0x2b')],qs[_0xc8e4('0x31')](_0x206d63[_0xc8e4('0x2f')][_0xc8e4('0x31')]));_0xebd4c9[_0xc8e4('0x30')]=_0xebd4c9[_0xc8e4('0x30')][_0xc8e4('0x32')]?_0xebd4c9['attributes']:_0x3cba92[_0xc8e4('0x2b')];if(!_0x206d63[_0xc8e4('0x2f')][_0xc8e4('0x33')](_0xc8e4('0x34'))){_0xebd4c9[_0xc8e4('0x19')]=qs['limit'](_0x206d63[_0xc8e4('0x2f')][_0xc8e4('0x19')]);_0xebd4c9[_0xc8e4('0x17')]=qs['offset'](_0x206d63[_0xc8e4('0x2f')][_0xc8e4('0x17')]);}_0xebd4c9[_0xc8e4('0x35')]=qs['sort'](_0x206d63[_0xc8e4('0x2f')]['sort']);_0xebd4c9[_0xc8e4('0x36')]=qs[_0xc8e4('0x2d')](_[_0xc8e4('0x37')](_0x206d63[_0xc8e4('0x2f')],_0x3cba92[_0xc8e4('0x2d')]),_0x57057f);if(_0x206d63[_0xc8e4('0x2f')][_0xc8e4('0x38')]){_0xebd4c9[_0xc8e4('0x36')]=_[_0xc8e4('0x39')](_0xebd4c9[_0xc8e4('0x36')],{'$or':_['map'](_0x57057f,function(_0x2439e6){if(_0x2439e6['type']!==_0xc8e4('0x3a')){var _0x1d221c={};_0x1d221c[_0x2439e6[_0xc8e4('0x24')]]={'$like':'%'+_0x206d63[_0xc8e4('0x2f')][_0xc8e4('0x38')]+'%'};return _0x1d221c;}})});}_0xebd4c9=_[_0xc8e4('0x39')]({},_0xebd4c9,_0x206d63['options']);var _0x1bc00c={'where':_0xebd4c9[_0xc8e4('0x36')]};return db[_0xc8e4('0x27')][_0xc8e4('0x1a')](_0x1bc00c)[_0xc8e4('0x21')](function(_0x2c5797){_0x222073['count']=_0x2c5797;if(_0x206d63['query'][_0xc8e4('0x3b')]){_0xebd4c9[_0xc8e4('0x3c')]=[{'all':!![]}];}return db['SmsApplication'][_0xc8e4('0x3d')](_0xebd4c9);})[_0xc8e4('0x21')](function(_0x3a82f9){_0x222073[_0xc8e4('0x3e')]=_0x3a82f9;return _0x222073;})[_0xc8e4('0x21')](respondWithFilteredResult(_0x5d41fe,_0xebd4c9))[_0xc8e4('0x3f')](handleError(_0x5d41fe,null));};exports[_0xc8e4('0x40')]=function(_0x46afb2,_0x1fd6e6){var _0x292782={'raw':!![],'where':{'id':_0x46afb2[_0xc8e4('0x41')]['id']}},_0x25a319={};_0x25a319['model']=_[_0xc8e4('0x2c')](db['SmsApplication'][_0xc8e4('0x42')]);_0x25a319[_0xc8e4('0x2f')]=_[_0xc8e4('0x2c')](_0x46afb2[_0xc8e4('0x2f')]);_0x25a319[_0xc8e4('0x2d')]=_[_0xc8e4('0x2e')](_0x25a319[_0xc8e4('0x2b')],_0x25a319[_0xc8e4('0x2f')]);_0x292782[_0xc8e4('0x30')]=_[_0xc8e4('0x2e')](_0x25a319[_0xc8e4('0x2b')],qs[_0xc8e4('0x31')](_0x46afb2[_0xc8e4('0x2f')][_0xc8e4('0x31')]));_0x292782[_0xc8e4('0x30')]=_0x292782['attributes'][_0xc8e4('0x32')]?_0x292782[_0xc8e4('0x30')]:_0x25a319['model'];if(_0x46afb2[_0xc8e4('0x2f')][_0xc8e4('0x3b')]){_0x292782[_0xc8e4('0x3c')]=[{'all':!![]}];}_0x292782=_[_0xc8e4('0x39')]({},_0x292782,_0x46afb2[_0xc8e4('0x43')]);return db[_0xc8e4('0x27')][_0xc8e4('0x44')](_0x292782)[_0xc8e4('0x21')](handleEntityNotFound(_0x1fd6e6,null))[_0xc8e4('0x21')](respondWithResult(_0x1fd6e6,null))[_0xc8e4('0x3f')](handleError(_0x1fd6e6,null));};exports[_0xc8e4('0x45')]=function(_0xbd1e7d,_0x16b04d){return db[_0xc8e4('0x27')][_0xc8e4('0x45')](_0xbd1e7d[_0xc8e4('0x46')],{})[_0xc8e4('0x21')](respondWithResult(_0x16b04d,0xc9))[_0xc8e4('0x3f')](handleError(_0x16b04d,null));};exports['update']=function(_0x218305,_0x5ebb94){if(_0x218305[_0xc8e4('0x46')]['id']){delete _0x218305[_0xc8e4('0x46')]['id'];}return db[_0xc8e4('0x27')][_0xc8e4('0x44')]({'where':{'id':_0x218305[_0xc8e4('0x41')]['id']}})[_0xc8e4('0x21')](handleEntityNotFound(_0x5ebb94,null))[_0xc8e4('0x21')](saveUpdates(_0x218305[_0xc8e4('0x46')],null))[_0xc8e4('0x21')](respondWithResult(_0x5ebb94,null))[_0xc8e4('0x3f')](handleError(_0x5ebb94,null));};exports[_0xc8e4('0x47')]=function(_0x8cf989,_0x9c0c63){return db[_0xc8e4('0x27')][_0xc8e4('0x44')]({'where':{'id':_0x8cf989['params']['id']}})[_0xc8e4('0x21')](handleEntityNotFound(_0x9c0c63,null))[_0xc8e4('0x21')](removeEntity(_0x9c0c63,null))['catch'](handleError(_0x9c0c63,null));}; \ No newline at end of file +var _0x84d9=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','params','includeAll','options','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x33d50d,_0x3c5b8c){var _0x2dc536=function(_0x4f6049){while(--_0x4f6049){_0x33d50d['push'](_0x33d50d['shift']());}};_0x2dc536(++_0x3c5b8c);}(_0x84d9,0x10a));var _0x984d=function(_0x3c52a5,_0x43b85b){_0x3c52a5=_0x3c52a5-0x0;var _0x35803f=_0x84d9[_0x3c52a5];return _0x35803f;};'use strict';var emlformat=require(_0x984d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x984d('0x1'));var jsonpatch=require(_0x984d('0x2'));var rp=require(_0x984d('0x3'));var moment=require('moment');var BPromise=require(_0x984d('0x4'));var Mustache=require(_0x984d('0x5'));var util=require('util');var path=require(_0x984d('0x6'));var sox=require(_0x984d('0x7'));var csv=require(_0x984d('0x8'));var ejs=require(_0x984d('0x9'));var fs=require('fs');var fs_extra=require(_0x984d('0xa'));var _=require(_0x984d('0xb'));var squel=require(_0x984d('0xc'));var crypto=require('crypto');var jsforce=require(_0x984d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x984d('0x8'));var querystring=require(_0x984d('0xe'));var Papa=require(_0x984d('0xf'));var Redis=require('ioredis');var authService=require(_0x984d('0x10'));var qs=require(_0x984d('0x11'));var as=require(_0x984d('0x12'));var hardwareService=require(_0x984d('0x13'));var logger=require('../../config/logger')(_0x984d('0x14'));var utils=require('../../config/utils');var config=require(_0x984d('0x15'));var licenseUtil=require(_0x984d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9ed4a2,_0x2e9c09){_0x2e9c09=_0x2e9c09||0xcc;return function(_0x81fa00){if(_0x81fa00){return _0x9ed4a2[_0x984d('0x17')](_0x2e9c09);}return _0x9ed4a2[_0x984d('0x18')](_0x2e9c09)[_0x984d('0x19')]();};}function respondWithResult(_0x3429df,_0x3217a5){_0x3217a5=_0x3217a5||0xc8;return function(_0x119a30){if(_0x119a30){return _0x3429df[_0x984d('0x18')](_0x3217a5)[_0x984d('0x1a')](_0x119a30);}};}function respondWithFilteredResult(_0x2be52f,_0x475278){return function(_0x302385){if(_0x302385){var _0x2f9072=typeof _0x475278[_0x984d('0x1b')]===_0x984d('0x1c')&&typeof _0x475278['limit']===_0x984d('0x1c');var _0x5dca4c=_0x302385['count'];var _0x4d818d=_0x2f9072?0x0:_0x475278[_0x984d('0x1b')];var _0x56b2d5=_0x2f9072?_0x302385['count']:_0x475278[_0x984d('0x1b')]+_0x475278[_0x984d('0x1d')];var _0x2d9cf8;if(_0x56b2d5>=_0x5dca4c){_0x56b2d5=_0x5dca4c;_0x2d9cf8=0xc8;}else{_0x2d9cf8=0xce;}_0x2be52f[_0x984d('0x18')](_0x2d9cf8);return _0x2be52f['set'](_0x984d('0x1e'),_0x4d818d+'-'+_0x56b2d5+'/'+_0x5dca4c)[_0x984d('0x1a')](_0x302385);}return null;};}function patchUpdates(_0xc785bb){return function(_0x22f399){try{jsonpatch[_0x984d('0x1f')](_0x22f399,_0xc785bb,!![]);}catch(_0x5d0697){return BPromise[_0x984d('0x20')](_0x5d0697);}return _0x22f399[_0x984d('0x21')]();};}function saveUpdates(_0x4ec103,_0x1fd49d){return function(_0x213e63){if(_0x213e63){return _0x213e63['update'](_0x4ec103)['then'](function(_0x11f74f){return _0x11f74f;});}return null;};}function removeEntity(_0xf73d7d,_0x412359){return function(_0x1377ea){if(_0x1377ea){return _0x1377ea[_0x984d('0x22')]()[_0x984d('0x23')](function(){_0xf73d7d[_0x984d('0x18')](0xcc)[_0x984d('0x19')]();});}};}function handleEntityNotFound(_0x2463e0,_0x1590eb){return function(_0x5ee610){if(!_0x5ee610){_0x2463e0[_0x984d('0x17')](0x194);}return _0x5ee610;};}function handleError(_0x16414e,_0x12e533){_0x12e533=_0x12e533||0x1f4;return function(_0x49e57c){logger[_0x984d('0x24')](_0x49e57c[_0x984d('0x25')]);if(_0x49e57c[_0x984d('0x26')]){delete _0x49e57c['name'];}_0x16414e[_0x984d('0x18')](_0x12e533)[_0x984d('0x27')](_0x49e57c);};}exports[_0x984d('0x28')]=function(_0x5b6518,_0x29e1a4){var _0x27686f={},_0x3d8592={},_0x2c6de7={'count':0x0,'rows':[]};var _0x5a7cef=_[_0x984d('0x29')](db[_0x984d('0x2a')][_0x984d('0x2b')],function(_0x11318a){return{'name':_0x11318a[_0x984d('0x2c')],'type':_0x11318a['type']['key']};});_0x3d8592[_0x984d('0x2d')]=_[_0x984d('0x29')](_0x5a7cef,_0x984d('0x26'));_0x3d8592[_0x984d('0x2e')]=_[_0x984d('0x2f')](_0x5b6518['query']);_0x3d8592[_0x984d('0x30')]=_['intersection'](_0x3d8592[_0x984d('0x2d')],_0x3d8592[_0x984d('0x2e')]);_0x27686f[_0x984d('0x31')]=_[_0x984d('0x32')](_0x3d8592['model'],qs[_0x984d('0x33')](_0x5b6518['query']['fields']));_0x27686f[_0x984d('0x31')]=_0x27686f[_0x984d('0x31')][_0x984d('0x34')]?_0x27686f['attributes']:_0x3d8592[_0x984d('0x2d')];if(!_0x5b6518[_0x984d('0x2e')]['hasOwnProperty']('nolimit')){_0x27686f['limit']=qs[_0x984d('0x1d')](_0x5b6518['query'][_0x984d('0x1d')]);_0x27686f['offset']=qs[_0x984d('0x1b')](_0x5b6518['query'][_0x984d('0x1b')]);}_0x27686f[_0x984d('0x35')]=qs[_0x984d('0x36')](_0x5b6518[_0x984d('0x2e')][_0x984d('0x36')]);_0x27686f[_0x984d('0x37')]=qs[_0x984d('0x30')](_[_0x984d('0x38')](_0x5b6518[_0x984d('0x2e')],_0x3d8592['filters']),_0x5a7cef);if(_0x5b6518[_0x984d('0x2e')][_0x984d('0x39')]){_0x27686f[_0x984d('0x37')]=_[_0x984d('0x3a')](_0x27686f[_0x984d('0x37')],{'$or':_['map'](_0x5a7cef,function(_0x2bfb2c){if(_0x2bfb2c['type']!==_0x984d('0x3b')){var _0x3a06e8={};_0x3a06e8[_0x2bfb2c[_0x984d('0x26')]]={'$like':'%'+_0x5b6518['query'][_0x984d('0x39')]+'%'};return _0x3a06e8;}})});}_0x27686f=_[_0x984d('0x3a')]({},_0x27686f,_0x5b6518['options']);var _0x11765e={'where':_0x27686f['where']};return db[_0x984d('0x2a')][_0x984d('0x3c')](_0x11765e)[_0x984d('0x23')](function(_0x3d9d5a){_0x2c6de7[_0x984d('0x3c')]=_0x3d9d5a;if(_0x5b6518[_0x984d('0x2e')]['includeAll']){_0x27686f[_0x984d('0x3d')]=[{'all':!![]}];}return db[_0x984d('0x2a')][_0x984d('0x3e')](_0x27686f);})['then'](function(_0x395233){_0x2c6de7[_0x984d('0x3f')]=_0x395233;return _0x2c6de7;})[_0x984d('0x23')](respondWithFilteredResult(_0x29e1a4,_0x27686f))[_0x984d('0x40')](handleError(_0x29e1a4,null));};exports['show']=function(_0x56063f,_0x4e3d2f){var _0x5ba3e7={'raw':!![],'where':{'id':_0x56063f[_0x984d('0x41')]['id']}},_0x22a03c={};_0x22a03c[_0x984d('0x2d')]=_[_0x984d('0x2f')](db[_0x984d('0x2a')][_0x984d('0x2b')]);_0x22a03c[_0x984d('0x2e')]=_['keys'](_0x56063f[_0x984d('0x2e')]);_0x22a03c[_0x984d('0x30')]=_[_0x984d('0x32')](_0x22a03c[_0x984d('0x2d')],_0x22a03c['query']);_0x5ba3e7[_0x984d('0x31')]=_[_0x984d('0x32')](_0x22a03c[_0x984d('0x2d')],qs[_0x984d('0x33')](_0x56063f['query'][_0x984d('0x33')]));_0x5ba3e7[_0x984d('0x31')]=_0x5ba3e7[_0x984d('0x31')][_0x984d('0x34')]?_0x5ba3e7['attributes']:_0x22a03c['model'];if(_0x56063f['query'][_0x984d('0x42')]){_0x5ba3e7[_0x984d('0x3d')]=[{'all':!![]}];}_0x5ba3e7=_[_0x984d('0x3a')]({},_0x5ba3e7,_0x56063f[_0x984d('0x43')]);return db['SmsApplication'][_0x984d('0x44')](_0x5ba3e7)[_0x984d('0x23')](handleEntityNotFound(_0x4e3d2f,null))['then'](respondWithResult(_0x4e3d2f,null))[_0x984d('0x40')](handleError(_0x4e3d2f,null));};exports[_0x984d('0x45')]=function(_0x192c4b,_0x57ccd9){return db[_0x984d('0x2a')]['create'](_0x192c4b[_0x984d('0x46')],{})[_0x984d('0x23')](respondWithResult(_0x57ccd9,0xc9))[_0x984d('0x40')](handleError(_0x57ccd9,null));};exports[_0x984d('0x47')]=function(_0x319109,_0xe1605){if(_0x319109['body']['id']){delete _0x319109[_0x984d('0x46')]['id'];}return db[_0x984d('0x2a')][_0x984d('0x44')]({'where':{'id':_0x319109[_0x984d('0x41')]['id']}})[_0x984d('0x23')](handleEntityNotFound(_0xe1605,null))[_0x984d('0x23')](saveUpdates(_0x319109[_0x984d('0x46')],null))['then'](respondWithResult(_0xe1605,null))['catch'](handleError(_0xe1605,null));};exports['destroy']=function(_0x227c69,_0x123bc4){return db[_0x984d('0x2a')][_0x984d('0x44')]({'where':{'id':_0x227c69[_0x984d('0x41')]['id']}})[_0x984d('0x23')](handleEntityNotFound(_0x123bc4,null))[_0x984d('0x23')](removeEntity(_0x123bc4,null))[_0x984d('0x40')](handleError(_0x123bc4,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5b79c54..45d8f64 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 _0x9438=['request-promise','path','rimraf','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x44ab8c,_0x185623){var _0x360567=function(_0x751c63){while(--_0x751c63){_0x44ab8c['push'](_0x44ab8c['shift']());}};_0x360567(++_0x185623);}(_0x9438,0x1cb));var _0x8943=function(_0x34633b,_0x1c5d92){_0x34633b=_0x34633b-0x0;var _0xa34f3d=_0x9438[_0x34633b];return _0xa34f3d;};'use strict';var _=require(_0x8943('0x0'));var util=require(_0x8943('0x1'));var logger=require(_0x8943('0x2'))(_0x8943('0x3'));var moment=require(_0x8943('0x4'));var BPromise=require(_0x8943('0x5'));var rp=require(_0x8943('0x6'));var fs=require('fs');var path=require(_0x8943('0x7'));var rimraf=require(_0x8943('0x8'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x8943('0x9')]=function(_0x240579,_0x505e2a){return _0x240579[_0x8943('0xa')](_0x8943('0xb'),attributes,{'tableName':_0x8943('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8943('0xd'),'collate':_0x8943('0xe')});}; \ No newline at end of file +var _0x9677=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','sms_applications'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9677,0xc2));var _0x7967=function(_0x4b4c68,_0x14d416){_0x4b4c68=_0x4b4c68-0x0;var _0x1686e6=_0x9677[_0x4b4c68];return _0x1686e6;};'use strict';var _=require(_0x7967('0x0'));var util=require(_0x7967('0x1'));var logger=require(_0x7967('0x2'))(_0x7967('0x3'));var moment=require('moment');var BPromise=require(_0x7967('0x4'));var rp=require(_0x7967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7967('0x6'));var attributes=require('./smsApplication.attributes');module[_0x7967('0x7')]=function(_0x2c95db,_0x40d405){return _0x2c95db[_0x7967('0x8')]('SmsApplication',attributes,{'tableName':_0x7967('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7967('0xa'),'collate':_0x7967('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 059c7fd..4a40971 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 _0x1921=['rpc','../../config/environment','jayson/promise','client','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1921,0xf2));var _0x1192=function(_0x4bf649,_0x285041){_0x4bf649=_0x4bf649-0x0;var _0x216f4c=_0x1921[_0x4bf649];return _0x216f4c;};'use strict';var _=require(_0x1192('0x0'));var util=require('util');var moment=require(_0x1192('0x1'));var BPromise=require(_0x1192('0x2'));var rs=require(_0x1192('0x3'));var fs=require('fs');var Redis=require(_0x1192('0x4'));var db=require(_0x1192('0x5'))['db'];var utils=require(_0x1192('0x6'));var logger=require(_0x1192('0x7'))(_0x1192('0x8'));var config=require(_0x1192('0x9'));var jayson=require(_0x1192('0xa'));var client=jayson[_0x1192('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56989b,_0x350776,_0x1df881){return new BPromise(function(_0x19ed6f,_0x2d7ae4){return client[_0x1192('0xc')](_0x56989b,_0x1df881)[_0x1192('0xd')](function(_0x1fc22e){logger[_0x1192('0xe')]('SmsApplication,\x20%s,\x20%s',_0x350776,'request\x20sent');logger[_0x1192('0xf')](_0x1192('0x10'),_0x350776,_0x1192('0x11'),JSON[_0x1192('0x12')](_0x1fc22e));if(_0x1fc22e[_0x1192('0x13')]){if(_0x1fc22e[_0x1192('0x13')][_0x1192('0x14')]===0x1f4){logger['error'](_0x1192('0x15'),_0x350776,_0x1fc22e['error'][_0x1192('0x16')]);return _0x2d7ae4(_0x1fc22e[_0x1192('0x13')]['message']);}logger[_0x1192('0x13')](_0x1192('0x15'),_0x350776,_0x1fc22e[_0x1192('0x13')]['message']);return _0x19ed6f(_0x1fc22e[_0x1192('0x13')][_0x1192('0x16')]);}else{logger['info'](_0x1192('0x15'),_0x350776,_0x1192('0x11'));_0x19ed6f(_0x1fc22e[_0x1192('0x17')]['message']);}})[_0x1192('0x18')](function(_0x5ed569){logger[_0x1192('0x13')](_0x1192('0x15'),_0x350776,_0x5ed569);_0x2d7ae4(_0x5ed569);});});} \ No newline at end of file +var _0x794b=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x49eb23,_0xa64e13){var _0x450ca1=function(_0x269487){while(--_0x269487){_0x49eb23['push'](_0x49eb23['shift']());}};_0x450ca1(++_0xa64e13);}(_0x794b,0x1c2));var _0xb794=function(_0x5a98a8,_0x4c1bf9){_0x5a98a8=_0x5a98a8-0x0;var _0x5c019d=_0x794b[_0x5a98a8];return _0x5c019d;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var rs=require(_0xb794('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb794('0x4'));var logger=require(_0xb794('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb794('0x6'));var client=jayson[_0xb794('0x7')][_0xb794('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20e4d4,_0x231206,_0x340863){return new BPromise(function(_0x5d099b,_0x30f03f){return client[_0xb794('0x9')](_0x20e4d4,_0x340863)[_0xb794('0xa')](function(_0xc3dde7){logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,_0xb794('0xd'));logger[_0xb794('0xe')](_0xb794('0xf'),_0x231206,_0xb794('0xd'),JSON[_0xb794('0x10')](_0xc3dde7));if(_0xc3dde7[_0xb794('0x11')]){if(_0xc3dde7[_0xb794('0x11')][_0xb794('0x12')]===0x1f4){logger[_0xb794('0x11')](_0xb794('0xc'),_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x30f03f(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}logger[_0xb794('0x11')]('SmsApplication,\x20%s,\x20%s',_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x5d099b(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}else{logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,'request\x20sent');_0x5d099b(_0xc3dde7[_0xb794('0x14')][_0xb794('0x13')]);}})['catch'](function(_0x408766){logger[_0xb794('0x11')]('SmsApplication,\x20%s,\x20%s',_0x231206,_0x408766);_0x30f03f(_0x408766);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 4e51ef7..47c716c 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 _0x1775=['/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1775,0x1db));var _0x5177=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1775[_0x1facfa];return _0x9ec701;};'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('0xa')](_0x5177('0xf'),auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5177('0x11')]);router[_0x5177('0xa')](_0x5177('0x12'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);router['post']('/',auth[_0x5177('0xb')](),controller[_0x5177('0x14')]);router[_0x5177('0x15')](_0x5177('0x16'),auth[_0x5177('0xb')](),controller[_0x5177('0x17')]);router[_0x5177('0x15')](_0x5177('0x18'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')](_0x5177('0x1a'),_0x5177('0x1b')),controller[_0x5177('0x1c')]);router[_0x5177('0x1d')](_0x5177('0xf'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')](_0x5177('0x1a'),_0x5177('0x1e')),controller['update']);router[_0x5177('0x1f')](_0x5177('0xf'),auth[_0x5177('0xb')](),interaction[_0x5177('0x19')]('sms',_0x5177('0x20')),controller[_0x5177('0x21')]);router[_0x5177('0x1f')]('/:id/tags',auth[_0x5177('0xb')](),controller['removeTags']);module[_0x5177('0x22')]=router; \ No newline at end of file +var _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x1abb95,_0x3a47d3){var _0xa65a62=function(_0x58ab39){while(--_0x58ab39){_0x1abb95['push'](_0x1abb95['shift']());}};_0xa65a62(++_0x3a47d3);}(_0x3c81,0x102));var _0x13c8=function(_0x34bf70,_0x38db47){_0x34bf70=_0x34bf70-0x0;var _0x6e4a20=_0x3c81[_0x34bf70];return _0x6e4a20;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('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(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 3882370..3c4be0d 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 _0x13fe=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5609d9,_0x1ddb0e){var _0x287b84=function(_0x39c3d4){while(--_0x39c3d4){_0x5609d9['push'](_0x5609d9['shift']());}};_0x287b84(++_0x1ddb0e);}(_0x13fe,0x138));var _0xe13f=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x13fe[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0xe13f('0x0'));var moment=require(_0xe13f('0x1'));module[_0xe13f('0x2')]={'closed':{'type':Sequelize[_0xe13f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe13f('0x4')]},'disposition':{'type':Sequelize[_0xe13f('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe13f('0x5')]},'note':{'type':Sequelize[_0xe13f('0x5')]},'phone':{'type':Sequelize[_0xe13f('0x5')]},'read1stAt':{'type':Sequelize[_0xe13f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe13f('0x6')]('in',_0xe13f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe13f('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe13f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf611=['STRING','DATE','ENUM','out','moment','exports','BOOLEAN'];(function(_0x37c94f,_0x2f1a92){var _0x4463a1=function(_0x1004d9){while(--_0x1004d9){_0x37c94f['push'](_0x37c94f['shift']());}};_0x4463a1(++_0x2f1a92);}(_0xf611,0x7b));var _0x1f61=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xf611[_0x5ac0f0];return _0x4aceec;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1f61('0x0'));module[_0x1f61('0x1')]={'closed':{'type':Sequelize[_0x1f61('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1f61('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1f61('0x3')]},'read1stAt':{'type':Sequelize[_0x1f61('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1f61('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1f61('0x5')]('in',_0x1f61('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1f61('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ad3e5ec..3766265 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 _0x41e7=['renderFile','transcript-','.pdf','Sms','createPdfFromHTML','log','unlinkSync','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','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','error','name','send','Users','map','fullname','TagIds','split','Tags','catch','index','rawAttributes','type','query','keys','filters','intersection','model','attributes','length','nolimit','sort','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','left_join','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','tools_tags','expr','parseSearch','search','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','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','buildExpression','start','some','compact','where','i.SmsAccountId\x20IN\x20?','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`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','SELECT','clone','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','SmsAccountId','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','push','all','show','params','includeAll','include','options','SmsInteraction','create','body','destroy','describe','SmsMessage','omit','ids','getMessages','hasOwnProperty','SmsInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','spread','emit','download','unix','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','User','CmContact','Contact','lastName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','closed','closedAt','disposition','direction','out','firstName'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0x41e7,0x1c9));var _0x741e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x41e7[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x741e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x741e('0x1'));var jsonpatch=require(_0x741e('0x2'));var rp=require(_0x741e('0x3'));var moment=require(_0x741e('0x4'));var BPromise=require(_0x741e('0x5'));var Mustache=require('mustache');var util=require(_0x741e('0x6'));var path=require(_0x741e('0x7'));var sox=require(_0x741e('0x8'));var csv=require(_0x741e('0x9'));var ejs=require(_0x741e('0xa'));var fs=require('fs');var fs_extra=require(_0x741e('0xb'));var _=require(_0x741e('0xc'));var squel=require(_0x741e('0xd'));var crypto=require('crypto');var jsforce=require(_0x741e('0xe'));var deskjs=require(_0x741e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x741e('0x10'));var Papa=require(_0x741e('0x11'));var Redis=require(_0x741e('0x12'));var authService=require(_0x741e('0x13'));var qs=require(_0x741e('0x14'));var as=require(_0x741e('0x15'));var pdf=require(_0x741e('0x16'));var hardwareService=require(_0x741e('0x17'));var logger=require('../../config/logger')(_0x741e('0x18'));var utils=require(_0x741e('0x19'));var config=require(_0x741e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x741e('0x1b'))['db'];config[_0x741e('0x1c')]=_[_0x741e('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x741e('0x1e'))(new Redis(config[_0x741e('0x1c')]));require(_0x741e('0x1f'))[_0x741e('0x20')](socket);function respondWithStatusCode(_0x544623,_0x823a8f){_0x823a8f=_0x823a8f||0xcc;return function(_0x52181c){if(_0x52181c){return _0x544623[_0x741e('0x21')](_0x823a8f);}return _0x544623[_0x741e('0x22')](_0x823a8f)[_0x741e('0x23')]();};}function respondWithResult(_0x2836b5,_0x3041c4){_0x3041c4=_0x3041c4||0xc8;return function(_0x37884f){if(_0x37884f){return _0x2836b5[_0x741e('0x22')](_0x3041c4)[_0x741e('0x24')](_0x37884f);}};}function respondWithFilteredResult(_0x4e5590,_0x583771){return function(_0x265bbe){if(_0x265bbe){var _0x4b3349=typeof _0x583771[_0x741e('0x25')]==='undefined'&&typeof _0x583771[_0x741e('0x26')]===_0x741e('0x27');var _0x46ccb7=_0x265bbe[_0x741e('0x28')];var _0x311aa9=_0x4b3349?0x0:_0x583771['offset'];var _0x407e46=_0x4b3349?_0x265bbe[_0x741e('0x28')]:_0x583771[_0x741e('0x25')]+_0x583771[_0x741e('0x26')];var _0x1ab4ed;if(_0x407e46>=_0x46ccb7){_0x407e46=_0x46ccb7;_0x1ab4ed=0xc8;}else{_0x1ab4ed=0xce;}_0x4e5590[_0x741e('0x22')](_0x1ab4ed);return _0x4e5590[_0x741e('0x29')](_0x741e('0x2a'),_0x311aa9+'-'+_0x407e46+'/'+_0x46ccb7)[_0x741e('0x24')](_0x265bbe);}return null;};}function patchUpdates(_0x41a491){return function(_0x54795c){try{jsonpatch[_0x741e('0x2b')](_0x54795c,_0x41a491,!![]);}catch(_0x5ebfd7){return BPromise[_0x741e('0x2c')](_0x5ebfd7);}return _0x54795c['save']();};}function saveUpdates(_0xd2c2e4,_0x38635f){return function(_0x12dd91){if(_0x12dd91){return _0x12dd91['update'](_0xd2c2e4)[_0x741e('0x2d')](function(_0x1fcadb){return _0x1fcadb;});}return null;};}function removeEntity(_0x5107d6,_0x1b19ee){return function(_0xe87668){if(_0xe87668){return _0xe87668['destroy']()['then'](function(){_0x5107d6[_0x741e('0x22')](0xcc)[_0x741e('0x23')]();});}};}function handleEntityNotFound(_0x4dd010,_0x18b628){return function(_0x37bbfb){if(!_0x37bbfb){_0x4dd010[_0x741e('0x21')](0x194);}return _0x37bbfb;};}function handleError(_0x10f0da,_0x5eab47){_0x5eab47=_0x5eab47||0x1f4;return function(_0x303b80){logger[_0x741e('0x2e')](_0x303b80['stack']);if(_0x303b80[_0x741e('0x2f')]){delete _0x303b80['name'];}_0x10f0da[_0x741e('0x22')](_0x5eab47)[_0x741e('0x30')](_0x303b80);};}function getInteractionUsers(_0x3ae016,_0x3569e2){return new BPromise(function(_0x232b89,_0x299594){try{if(_0x3569e2[_0x3ae016['id']]){_0x3ae016[_0x741e('0x31')]=_[_0x741e('0x32')](_0x3569e2[_0x3ae016['id']],function(_0x3c49c0){return{'id':_0x3c49c0['id'],'fullname':_0x3c49c0[_0x741e('0x33')]};});}}catch(_0x3904a6){_0x299594(_0x3904a6);}_0x232b89(_0x3ae016);});}function getInteractionTags(_0x15be7c,_0x13e984){return new BPromise(function(_0x24cab7,_0x1e91dd){try{if(_0x15be7c[_0x741e('0x34')]){_0x15be7c['Tags']=[];_0x15be7c['TagIds'][_0x741e('0x35')](',')['forEach'](function(_0x1903ac){_0x15be7c[_0x741e('0x36')]['push'](_0x13e984[_0x1903ac]);});}delete _0x15be7c[_0x741e('0x34')];}catch(_0x13ef74){_0x1e91dd(_0x13ef74);}_0x24cab7(_0x15be7c);});}function updateSmsInteraction(_0x4ef05f,_0x5e75e9,_0x230c3f){return new BPromise(function(_0x45b885,_0x5bc6f7){return getInteractionUsers(_0x4ef05f,_0x230c3f)[_0x741e('0x2d')](function(_0x38a8bf){return getInteractionTags(_0x38a8bf,_0x5e75e9);})[_0x741e('0x2d')](function(_0x35fff6){_0x45b885(_0x35fff6);})[_0x741e('0x37')](function(_0xec34d7){_0x5bc6f7(_0xec34d7);});});}exports[_0x741e('0x38')]=function(_0x6257b4,_0x113108){var _0xb39c62={},_0x16772a={},_0x490c9e={'count':0x0,'rows':[]};var _0x2ca4d1=_[_0x741e('0x32')](db['SmsInteraction'][_0x741e('0x39')],function(_0x19d81d){return{'name':_0x19d81d['fieldName'],'type':_0x19d81d[_0x741e('0x3a')]['key']};});_0x16772a['model']=_[_0x741e('0x32')](_0x2ca4d1,_0x741e('0x2f'));_0x16772a[_0x741e('0x3b')]=_[_0x741e('0x3c')](_0x6257b4[_0x741e('0x3b')]);_0x16772a[_0x741e('0x3d')]=_[_0x741e('0x3e')](_0x16772a[_0x741e('0x3f')],_0x16772a['query']);_0xb39c62[_0x741e('0x40')]=_[_0x741e('0x3e')](_0x16772a[_0x741e('0x3f')],qs['fields'](_0x6257b4[_0x741e('0x3b')]['fields']));_0xb39c62['attributes']=_0xb39c62['attributes'][_0x741e('0x41')]?_0xb39c62[_0x741e('0x40')]:_0x16772a[_0x741e('0x3f')];if(!_0x6257b4[_0x741e('0x3b')]['hasOwnProperty'](_0x741e('0x42'))){_0xb39c62['limit']=qs[_0x741e('0x26')](_0x6257b4[_0x741e('0x3b')][_0x741e('0x26')]);_0xb39c62['offset']=qs['offset'](_0x6257b4[_0x741e('0x3b')][_0x741e('0x25')]);}_0xb39c62['order']=qs[_0x741e('0x43')](_0x6257b4[_0x741e('0x3b')][_0x741e('0x43')]);_0xb39c62['where']=qs['filters'](_[_0x741e('0x44')](_0x6257b4[_0x741e('0x3b')],_0x16772a[_0x741e('0x3d')]),_0x2ca4d1);var _0x2bf508=[];var _0x3f0315=squel[_0x741e('0x45')]()[_0x741e('0x46')]('id')[_0x741e('0x46')](_0x741e('0x2f'))[_0x741e('0x46')](_0x741e('0x47'))[_0x741e('0x48')]('tools_tags');var _0x1fc510=squel['select']()['field'](_0x741e('0x49'))['field'](_0x741e('0x4a'))['field'](_0x741e('0x4b'))['from']('user_has_sms_interactions','ui')[_0x741e('0x4c')]('users','u','u.id\x20=\x20ui.UserId');var _0x38d775=squel[_0x741e('0x45')]()[_0x741e('0x48')]('sms_interactions','i')[_0x741e('0x4c')](_0x741e('0x4d'),'c',_0x741e('0x4e'))['left_join'](_0x741e('0x4f'),'o',_0x741e('0x50'))[_0x741e('0x4c')](_0x741e('0x51'),'a',_0x741e('0x52'))['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0x741e('0x4c')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0x741e('0x53'),'t','t.id\x20=\x20it.TagId');var _0x254ac7=squel['expr']();var _0x4fb7f2=[];var _0x2b60ab=squel[_0x741e('0x54')]();var _0x3176ef;if(_0x6257b4['query']['search']){_0x3176ef=as[_0x741e('0x55')](_0x6257b4[_0x741e('0x3b')][_0x741e('0x56')]);var _0x2ea2d6=_0x3176ef['sqlOperator'];for(var _0x574415=0x0;_0x574415<_0x3176ef[_0x741e('0x57')]['length'];_0x574415++){var _0x438e70=_0x3176ef[_0x741e('0x57')][_0x574415];var _0x548601='i';var _0x2407ec=_[_0x741e('0x58')](_0x2ca4d1,[_0x741e('0x2f'),_0x438e70[_0x741e('0x46')]]);if(!_0x2407ec){switch(_0x438e70[_0x741e('0x46')]){case _0x741e('0x59'):if(_0x438e70[_0x741e('0x5a')]==0x1){_0x38d775['having']('`'+_0x438e70[_0x741e('0x46')]+_0x741e('0x5b'));}else{_0x38d775[_0x741e('0x5c')]('`'+_0x438e70[_0x741e('0x46')]+_0x741e('0x5d'));}break;case'Contact':if(_0x438e70[_0x741e('0x5e')]===_0x741e('0x5f')){if(_0x438e70[_0x741e('0x5a')][_0x741e('0x35')]('\x20')[_0x741e('0x41')]>0x1){_0x254ac7[_0x2ea2d6](_0x741e('0x60'),qs[_0x741e('0x61')](_0x438e70[_0x741e('0x5a')]),null);}else{var _0x4b942a='%'+_0x438e70[_0x741e('0x5a')]+'%';_0x254ac7[_0x2ea2d6](_0x741e('0x62'),_0x4b942a,_0x4b942a,_0x4b942a);}}else{_0x2407ec=_[_0x741e('0x58')](_0x2ca4d1,[_0x741e('0x2f'),_0x741e('0x63')]);_0x438e70['field']=_0x741e('0x63');_0x4e772a=as['buildExpression'](_0x548601,_0x2407ec[_0x741e('0x3a')],_0x438e70);_0x254ac7[_0x2ea2d6](_0x4e772a[_0x741e('0x64')],_0x4e772a[_0x741e('0x5a')]['start'],_0x4e772a['value']['end']);}break;case _0x741e('0x65'):var _0x202b5b=_0x438e70[_0x741e('0x5a')][_0x741e('0x35')](',')[_0x741e('0x32')](function(_0x1d21e7){return Number(_0x1d21e7);});_0x202b5b[_0x741e('0x66')](function(_0x13213b){_0x2b60ab['or'](_0x741e('0x67'),'%,'+_0x13213b+',%');});_0x4fb7f2=_[_0x741e('0x68')](_0x4fb7f2,_0x202b5b);break;case'User':if(_0x438e70[_0x741e('0x5e')]===_0x741e('0x5f')){_0x254ac7[_0x2ea2d6](_0x741e('0x69'),'%'+_0x438e70[_0x741e('0x5a')]+'%',null);}else{_0x2407ec=_['find'](_0x2ca4d1,[_0x741e('0x2f'),'UserId']);_0x438e70[_0x741e('0x46')]=_0x741e('0x6a');_0x4e772a=as[_0x741e('0x6b')](_0x548601,_0x2407ec[_0x741e('0x3a')],_0x438e70);_0x254ac7[_0x2ea2d6](_0x4e772a[_0x741e('0x64')],_0x4e772a['value'][_0x741e('0x6c')],_0x4e772a['value'][_0x741e('0x23')]);}break;case'body':_0x4e772a=as['buildExpression']('me',null,_0x438e70);_0x254ac7[_0x2ea2d6](_0x4e772a[_0x741e('0x64')],_0x4e772a[_0x741e('0x5a')][_0x741e('0x6c')],_0x4e772a[_0x741e('0x5a')][_0x741e('0x23')]);break;}}else{var _0x4e772a=as[_0x741e('0x6b')](_0x548601,_0x2407ec[_0x741e('0x3a')],_0x438e70);_0x254ac7[_0x2ea2d6](_0x4e772a[_0x741e('0x64')],_0x4e772a[_0x741e('0x5a')]['start'],_0x4e772a['value'][_0x741e('0x23')]);}}}else{var _0x3c17d5=_(_0x6257b4[_0x741e('0x3b')])[_0x741e('0x3c')]()[_0x741e('0x32')](function(_0x5f597f){return _[_0x741e('0x6d')](_0x2ca4d1,[_0x741e('0x2f'),_0x5f597f])?_0x5f597f:undefined;})[_0x741e('0x6e')]()['value']();if(!_['isEmpty'](_0x3c17d5)){_0x3c17d5[_0x741e('0x66')](function(_0x19b90f){if(_0x19b90f==='SmsAccountId'){_0x38d775[_0x741e('0x6f')](_0x741e('0x70'),[]['concat'](_0x6257b4[_0x741e('0x3b')][_0x19b90f]));}else if(_0x19b90f===_0x741e('0x71')){var _0x5dae5e=JSON['parse'](_0x6257b4[_0x741e('0x3b')][_0x19b90f])[_0x741e('0x72')];var _0x4777e1=JSON[_0x741e('0x73')](_0x6257b4[_0x741e('0x3b')][_0x19b90f])['$lte'];_0x38d775[_0x741e('0x6f')](_0x741e('0x74'),_0x5dae5e,_0x4777e1);}else{if(_0x6257b4[_0x741e('0x3b')][_0x19b90f]==='null'){_0x38d775[_0x741e('0x6f')]('i.'+_0x19b90f+_0x741e('0x75'));}else{_0x38d775[_0x741e('0x6f')]('i.'+_0x19b90f+_0x741e('0x76'),_0x6257b4[_0x741e('0x3b')][_0x19b90f]);}}});}if(_0x6257b4['query'][_0x741e('0x77')]){if(_0x6257b4[_0x741e('0x3b')]['read']==0x1){_0x38d775[_0x741e('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x38d775['having'](_0x741e('0x78'));}}if(_0x6257b4[_0x741e('0x3b')][_0x741e('0x79')]){_0x4fb7f2=_[_0x741e('0x7a')](_0x6257b4[_0x741e('0x3b')]['tag'])?_0x6257b4[_0x741e('0x3b')][_0x741e('0x79')]:new Array(_0x6257b4['query'][_0x741e('0x79')]);_0x4fb7f2[_0x741e('0x66')](function(_0x334e91){_0x2b60ab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x334e91+',%');});}if(_0x6257b4[_0x741e('0x3b')][_0x741e('0x7b')]){var _0x136518=_0x6257b4[_0x741e('0x3b')][_0x741e('0x7b')][_0x741e('0x7c')]('\x5c','\x5c\x5c')[_0x741e('0x7c')](/'/g,'\x27\x27');if(qs[_0x741e('0x7d')](_0x136518)){_0x254ac7['or'](_0x741e('0x7e'),_0x136518+'%')['or'](_0x741e('0x7f'),_0x136518+'%');}else{_0x254ac7['or'](_0x741e('0x80'),qs['getFullTextValue'](_0x136518))['or'](_0x741e('0x81'),_0x136518+'%');}}}_0x38d775[_0x741e('0x6f')](_0x254ac7);_0x38d775['group'](_0x741e('0x82'));var _0x416ae2={'type':db[_0x741e('0x83')]['QueryTypes'][_0x741e('0x84')],'raw':!![]};var _0x1f6253=_0x38d775[_0x741e('0x85')]();_0x1f6253['field'](_0x741e('0x82'));_0x1f6253[_0x741e('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x741e('0x59'));if(_0xb39c62[_0x741e('0x86')]){_0xb39c62[_0x741e('0x86')]['forEach'](function(_0x12d908){var _0x2216a4=_0x12d908[0x0]===_0x741e('0x87')?_0x12d908[0x0]:'i.'+_0x12d908[0x0];_0x38d775[_0x741e('0x86')](_0x2216a4,_0x12d908[0x1]===_0x741e('0x88')?![]:!![]);});}if(!_[_0x741e('0x89')](_0x4fb7f2)){_0x38d775[_0x741e('0x5c')](_0x2b60ab);_0x1f6253[_0x741e('0x6f')](_0x741e('0x8a'),_0x4fb7f2);}BPromise['resolve']()[_0x741e('0x2d')](function(){if(!_0x3176ef){if(_0x6257b4[_0x741e('0x3b')][_0x741e('0x8b')])return;_0x1f6253[_0x741e('0x6f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x38d775[_0x741e('0x6f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x6257b4[_0x741e('0x8c')]['role']!=='agent')return;return _0x6257b4[_0x741e('0x8c')][_0x741e('0x8d')]({'attributes':['id'],'raw':!![]})[_0x741e('0x2d')](function(_0x4cc28d){if(_[_0x741e('0x89')](_0x4cc28d)){_0x1f6253['where'](_0x741e('0x8e'));_0x38d775['where'](_0x741e('0x8e'));}else{_0x1f6253[_0x741e('0x6f')](_0x741e('0x70'),_[_0x741e('0x32')](_0x4cc28d,'id'));_0x38d775[_0x741e('0x6f')](_0x741e('0x70'),_[_0x741e('0x32')](_0x4cc28d,'id'));}});})['then'](function(){if(_0x6257b4[_0x741e('0x8c')]['role']===_0x741e('0x8f')&&!_0x3176ef&&!_0x6257b4['query']['SmsAccountId'])return[];return db['sequelize'][_0x741e('0x3b')](_0x1f6253[_0x741e('0x90')](),_0x416ae2);})['then'](function(_0x27f1fb){_0x490c9e['count']=_0x27f1fb[_0x741e('0x41')];if(_0x490c9e[_0x741e('0x28')]===0x0)return[];return db[_0x741e('0x91')][_0x741e('0x3b')](_0x3f0315['toString'](),_0x416ae2)[_0x741e('0x2d')](function(_0x2141ba){_0x2bf508=_[_0x741e('0x92')](_0x2141ba,'id');_0x416ae2=_[_0x741e('0x93')](_0x416ae2,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6257b4[_0x741e('0x3b')][_0x741e('0x94')]){_0xb39c62[_0x741e('0x40')][_0x741e('0x66')](function(_0x12e6c3){_0x38d775[_0x741e('0x46')]('i.'+_0x12e6c3);});}else{_0x38d775[_0x741e('0x46')](_0x741e('0x95'),_0x741e('0x59'));_0x38d775[_0x741e('0x46')](_0x741e('0x96'),_0x741e('0x97'));_0x38d775[_0x741e('0x46')](_0x741e('0x98'),_0x741e('0x99'));_0x38d775[_0x741e('0x46')]('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');_0x38d775['field'](_0x741e('0x9a'));_0x38d775[_0x741e('0x46')]('c.firstName',_0x741e('0x9b'));_0x38d775[_0x741e('0x46')]('c.lastName',_0x741e('0x9c'));_0x38d775[_0x741e('0x46')](_0x741e('0x9d'),_0x741e('0x9e'));_0x38d775['field']('c.phone',_0x741e('0x9f'));_0x38d775['field'](_0x741e('0xa0'),_0x741e('0xa1'));_0x38d775[_0x741e('0x46')](_0x741e('0xa2'),'Contact.fax');_0x38d775[_0x741e('0x46')](_0x741e('0xa3'),'Owner.fullname');_0x38d775[_0x741e('0x46')](_0x741e('0xa4'),_0x741e('0xa5'));_0x38d775[_0x741e('0x46')](_0x741e('0xa6'),_0x741e('0x34'));}if(_0xb39c62[_0x741e('0x26')])_0x38d775[_0x741e('0x26')](_0xb39c62[_0x741e('0x26')]);if(_0xb39c62[_0x741e('0x25')])_0x38d775[_0x741e('0x25')](_0xb39c62[_0x741e('0x25')]);return db['sequelize']['query'](_0x38d775[_0x741e('0x90')](),_0x416ae2);})[_0x741e('0x2d')](function(_0x19e56c){if(_0x19e56c[_0x741e('0x41')]>0x0)_0x1fc510['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x741e('0x32')](_0x19e56c,'id'));return db['sequelize'][_0x741e('0x3b')](_0x1fc510['toString'](),_0x416ae2)[_0x741e('0x2d')](function(_0xd14607){var _0x4d0674=_['groupBy'](_0xd14607,'SmsInteractionId');var _0x2aff5c=[];_0x19e56c[_0x741e('0x66')](function(_0x447efc){_0x2aff5c[_0x741e('0xa7')](updateSmsInteraction(_0x447efc,_0x2bf508,_0x4d0674));});return BPromise[_0x741e('0xa8')](_0x2aff5c);});});})[_0x741e('0x2d')](function(_0xaaaa55){_0x490c9e['rows']=_0xaaaa55;return _0x490c9e;})[_0x741e('0x2d')](respondWithFilteredResult(_0x113108,_0xb39c62))[_0x741e('0x37')](handleError(_0x113108,null));};exports[_0x741e('0xa9')]=function(_0xb1b864,_0x4d899f){var _0x52e199={'raw':![],'where':{'id':_0xb1b864[_0x741e('0xaa')]['id']}},_0x2fe66e={};_0x2fe66e['model']=_[_0x741e('0x3c')](db['SmsInteraction'][_0x741e('0x39')]);_0x2fe66e[_0x741e('0x3b')]=_['keys'](_0xb1b864[_0x741e('0x3b')]);_0x2fe66e[_0x741e('0x3d')]=_['intersection'](_0x2fe66e['model'],_0x2fe66e['query']);_0x52e199['attributes']=_[_0x741e('0x3e')](_0x2fe66e[_0x741e('0x3f')],qs[_0x741e('0x94')](_0xb1b864['query']['fields']));_0x52e199[_0x741e('0x40')]=_0x52e199[_0x741e('0x40')]['length']?_0x52e199[_0x741e('0x40')]:_0x2fe66e[_0x741e('0x3f')];if(_0xb1b864['query'][_0x741e('0xab')]){_0x52e199[_0x741e('0xac')]=[{'all':!![]}];}_0x52e199=_[_0x741e('0x93')]({},_0x52e199,_0xb1b864[_0x741e('0xad')]);return db[_0x741e('0xae')][_0x741e('0x58')](_0x52e199)[_0x741e('0x2d')](handleEntityNotFound(_0x4d899f,null))['then'](respondWithResult(_0x4d899f,null))[_0x741e('0x37')](handleError(_0x4d899f,null));};exports[_0x741e('0xaf')]=function(_0x1125c7,_0x17d169){return db['SmsInteraction']['create'](_0x1125c7[_0x741e('0xb0')],{})[_0x741e('0x2d')](respondWithResult(_0x17d169,0xc9))[_0x741e('0x37')](handleError(_0x17d169,null));};exports['update']=function(_0x22eafe,_0x5698cf){if(_0x22eafe[_0x741e('0xb0')]['id']){delete _0x22eafe['body']['id'];}return db[_0x741e('0xae')]['find']({'where':{'id':_0x22eafe[_0x741e('0xaa')]['id']}})[_0x741e('0x2d')](handleEntityNotFound(_0x5698cf,null))[_0x741e('0x2d')](saveUpdates(_0x22eafe['body'],null))[_0x741e('0x2d')](respondWithResult(_0x5698cf,null))[_0x741e('0x37')](handleError(_0x5698cf,null));};exports[_0x741e('0xb1')]=function(_0x45fb11,_0x17bc5b){return db[_0x741e('0xae')]['find']({'where':{'id':_0x45fb11[_0x741e('0xaa')]['id']}})['then'](handleEntityNotFound(_0x17bc5b,null))['then'](removeEntity(_0x17bc5b,null))[_0x741e('0x37')](handleError(_0x17bc5b,null));};exports[_0x741e('0xb2')]=function(_0x799146,_0x274515){return db['SmsInteraction'][_0x741e('0xb2')]()[_0x741e('0x2d')](respondWithResult(_0x274515,null))[_0x741e('0x37')](handleError(_0x274515,null));};exports['addMessage']=function(_0x41f80e,_0x49bc01,_0x4e27ed){return db[_0x741e('0xb3')][_0x741e('0x58')]({'where':{'id':_0x41f80e[_0x741e('0xaa')]['id']}})[_0x741e('0x2d')](handleEntityNotFound(_0x49bc01,null))[_0x741e('0x2d')](function(_0x42602a){if(_0x42602a){return _0x42602a['addMessage'](_0x41f80e['body']['ids'],_[_0x741e('0xb4')](_0x41f80e[_0x741e('0xb0')],[_0x741e('0xb5'),'id'])||{});}})['then'](respondWithResult(_0x49bc01,null))[_0x741e('0x37')](handleError(_0x49bc01,null));};exports[_0x741e('0xb6')]=function(_0x4e74ff,_0x2ee178,_0x5d180f){var _0x2a0f15={'raw':![],'where':{}};var _0x29767b={};var _0x5c5f28={'count':0x0,'rows':[]};return db[_0x741e('0xae')]['findOne']({'where':{'id':_0x4e74ff[_0x741e('0xaa')]['id']}})[_0x741e('0x2d')](handleEntityNotFound(_0x2ee178,null))[_0x741e('0x2d')](function(_0x17898f){if(_0x17898f){_0x29767b[_0x741e('0x3f')]=_[_0x741e('0x3c')](db[_0x741e('0xb3')][_0x741e('0x39')]);_0x29767b['query']=_[_0x741e('0x3c')](_0x4e74ff[_0x741e('0x3b')]);_0x29767b[_0x741e('0x3d')]=_[_0x741e('0x3e')](_0x29767b[_0x741e('0x3f')],_0x29767b[_0x741e('0x3b')]);_0x2a0f15[_0x741e('0x40')]=_[_0x741e('0x3e')](_0x29767b[_0x741e('0x3f')],qs[_0x741e('0x94')](_0x4e74ff['query'][_0x741e('0x94')]));_0x2a0f15[_0x741e('0x40')]=_0x2a0f15[_0x741e('0x40')][_0x741e('0x41')]?_0x2a0f15['attributes']:_0x29767b[_0x741e('0x3f')];if(!_0x4e74ff['query'][_0x741e('0xb7')]('nolimit')){_0x2a0f15['limit']=qs[_0x741e('0x26')](_0x4e74ff[_0x741e('0x3b')][_0x741e('0x26')]);_0x2a0f15[_0x741e('0x25')]=qs[_0x741e('0x25')](_0x4e74ff[_0x741e('0x3b')]['offset']);}_0x2a0f15[_0x741e('0x86')]=qs[_0x741e('0x43')](_0x4e74ff['query'][_0x741e('0x43')]);_0x2a0f15[_0x741e('0x6f')]=qs[_0x741e('0x3d')](_[_0x741e('0x44')](_0x4e74ff[_0x741e('0x3b')],_0x29767b['filters']));_0x2a0f15[_0x741e('0x6f')][_0x741e('0xb8')]=_0x17898f['id'];if(_0x4e74ff[_0x741e('0x3b')][_0x741e('0x7b')]){_0x2a0f15['where']=_['merge'](_0x2a0f15[_0x741e('0x6f')],{'$or':_[_0x741e('0x32')](_0x2a0f15[_0x741e('0x40')],function(_0x48bb1a){var _0x1ffec5={};_0x1ffec5[_0x48bb1a]={'$like':'%'+_0x4e74ff[_0x741e('0x3b')]['filter']+'%'};return _0x1ffec5;})});}if(_0x4e74ff[_0x741e('0x3b')][_0x741e('0x72')]){var _0x4bea4b=_0x4e74ff[_0x741e('0x3b')][_0x741e('0x72')][_0x741e('0x35')](',');var _0x16065a={};_0x16065a[_0x4bea4b[0x0]]={'$gte':moment(_0x4bea4b[0x1])['format'](_0x741e('0xb9'))};_0x2a0f15[_0x741e('0x6f')]=_[_0x741e('0x93')](_0x2a0f15[_0x741e('0x6f')],_0x16065a);}_0x2a0f15=_[_0x741e('0x93')]({},_0x2a0f15,_0x4e74ff['options']);return db[_0x741e('0xb3')][_0x741e('0x28')]({'where':_0x2a0f15[_0x741e('0x6f')]})[_0x741e('0x2d')](function(_0x72092){_0x5c5f28[_0x741e('0x28')]=_0x72092;if(_0x4e74ff['query']['includeAll']){_0x2a0f15[_0x741e('0xac')]=[{'all':!![]}];}return db['SmsMessage'][_0x741e('0xba')](_0x2a0f15);})[_0x741e('0x2d')](function(_0x2782ed){_0x5c5f28[_0x741e('0xbb')]=_0x2782ed;return _0x5c5f28;});}})[_0x741e('0x2d')](respondWithFilteredResult(_0x2ee178,_0x2a0f15))[_0x741e('0x37')](handleError(_0x2ee178,null));};exports['addTags']=function(_0x1919f6,_0x31b377,_0x38db6e){return db[_0x741e('0xae')][_0x741e('0x58')]({'where':{'id':_0x1919f6[_0x741e('0xaa')]['id']}})[_0x741e('0x2d')](handleEntityNotFound(_0x31b377,null))['then'](function(_0xa89614){if(_0xa89614){return _0xa89614[_0x741e('0xbc')](_0x1919f6[_0x741e('0xb0')]['ids'],_[_0x741e('0xb4')](_0x1919f6[_0x741e('0xb0')],[_0x741e('0xb5'),'id'])||{})[_0x741e('0xbd')](function(){return db[_0x741e('0x65')]['findAll']({'attributes':['id',_0x741e('0x2f'),_0x741e('0x47')],'where':{'id':_0x1919f6['body'][_0x741e('0xb5')]}});})['then'](function(_0x2dea85){socket[_0x741e('0xbe')]('smsInteractionTags:save',{'id':Number(_0x1919f6['params']['id']),'tags':_0x2dea85||[]});return{'id':Number(_0x1919f6[_0x741e('0xaa')]['id']),'tags':_0x2dea85||[]};});}})[_0x741e('0x2d')](respondWithResult(_0x31b377,null))[_0x741e('0x37')](handleError(_0x31b377,null));};exports['removeTags']=function(_0x507d39,_0x2f1880,_0x3b5f9f){return db['SmsInteraction'][_0x741e('0x58')]({'where':{'id':_0x507d39[_0x741e('0xaa')]['id']}})[_0x741e('0x2d')](handleEntityNotFound(_0x2f1880,null))['then'](function(_0x552824){if(_0x552824){return _0x552824['removeTags'](_0x507d39[_0x741e('0x3b')]['ids']);}})[_0x741e('0x2d')](respondWithStatusCode(_0x2f1880,null))['catch'](handleError(_0x2f1880,null));};exports[_0x741e('0xbf')]=function(_0x27a5fb,_0x2da248){var _0x1935a8=moment()[_0x741e('0xc0')]()[_0x741e('0x90')]();var _0x43165c=path[_0x741e('0xc1')](config[_0x741e('0xc2')],'server',_0x741e('0xc3'),_0x741e('0xc4'));var _0x3357da=path[_0x741e('0xc1')](config[_0x741e('0xc2')],_0x741e('0xc5'),_0x741e('0xc3'),_0x741e('0xc6'));var _0x497169=path['join'](_0x43165c,_0x1935a8);var _0x22a317=util[_0x741e('0xc7')](_0x741e('0xc8'),_0x27a5fb[_0x741e('0xaa')]['id'],_0x1935a8);var _0x261255=path[_0x741e('0xc1')](_0x43165c,_0x22a317);var _0x38f4e1=[];_0x38f4e1[_0x741e('0xa7')]({'model':db['User'],'as':_0x741e('0xc9'),'attributes':['id',_0x741e('0x33')],'raw':!![]});_0x38f4e1['push']({'model':db[_0x741e('0xca')],'as':_0x741e('0xcb'),'attributes':['id','firstName',_0x741e('0xcc')],'raw':!![]});var _0x4c0753=[{'model':db[_0x741e('0xb3')],'as':_0x741e('0xcd'),'attributes':['id',_0x741e('0xb0'),_0x741e('0x71'),'direction',_0x741e('0xce'),_0x741e('0x77')],'include':_0x38f4e1}];_0x4c0753['push']({'model':db[_0x741e('0xcf')],'as':_0x741e('0xd0'),'attributes':['id',_0x741e('0x2f')]});_0x4c0753[_0x741e('0xa7')]({'model':db['User'],'as':_0x741e('0xd1'),'attributes':['id',_0x741e('0x33')]});return db[_0x741e('0xae')][_0x741e('0x58')]({'where':{'id':_0x27a5fb[_0x741e('0xaa')]['id']},'include':_0x4c0753})[_0x741e('0x2d')](handleEntityNotFound(_0x2da248,null))[_0x741e('0x2d')](function(_0x1b4639){if(_0x1b4639){var _0x28f68a=_0x1b4639[_0x741e('0xd2')]({'plain':!![]});fs[_0x741e('0xd3')](_0x497169);var _0x4df2d3={'channel':'Sms','account':_0x28f68a[_0x741e('0xd0')][_0x741e('0x2f')],'agent':_0x28f68a[_0x741e('0xd1')]?_0x28f68a[_0x741e('0xd1')][_0x741e('0x33')]:'N.A.','createdAt':moment(_0x28f68a[_0x741e('0x71')])['format'](_0x741e('0xb9'))[_0x741e('0x90')](),'closedAt':_0x28f68a[_0x741e('0xd4')]?moment(_0x28f68a[_0x741e('0xd5')])['format'](_0x741e('0xb9'))[_0x741e('0x90')]():'','disposition':_0x28f68a[_0x741e('0xd6')],'messages':_(_0x28f68a['Messages'])['filter']({'secret':![]})[_0x741e('0x32')](function(_0x5d9e09){return{'date':moment(_0x5d9e09[_0x741e('0x71')])[_0x741e('0xc7')](_0x741e('0xb9'))[_0x741e('0x90')](),'sender':_0x5d9e09[_0x741e('0xd7')]===_0x741e('0xd8')?_0x5d9e09[_0x741e('0xc9')]?_0x5d9e09[_0x741e('0xc9')]['fullname']:'System':_0x5d9e09['Contact'][_0x741e('0xd9')]+(_0x5d9e09[_0x741e('0xcb')][_0x741e('0xcc')]?'\x20'+_0x5d9e09[_0x741e('0xcb')]['lastName']:''),'body':_0x5d9e09[_0x741e('0xb0')],'direction':_0x5d9e09[_0x741e('0xd7')]===_0x741e('0xd8')?'A':'C','secret':_0x5d9e09[_0x741e('0xce')],'read':_0x5d9e09[_0x741e('0x77')]};})[_0x741e('0x5a')]()};return ejs[_0x741e('0xda')](path[_0x741e('0xc1')](config[_0x741e('0xc2')],'server','views','downloadInteraction.ejs'),{'interaction':_0x4df2d3})[_0x741e('0x2d')](function(_0x5a69d4){var _0x18600d=path['join'](_0x497169,_0x741e('0xdb')+_0x28f68a['id']+'-'+_0x1935a8+_0x741e('0xdc'));var _0x1463af={'path':_0x18600d,'channel':_0x741e('0xdd'),'interactionId':_0x28f68a['id']};return pdf[_0x741e('0xde')](_0x5a69d4,_0x1463af);})[_0x741e('0x2d')](function(){return new BPromise(function(_0x537044,_0x2f22f8){zipdir(_0x497169,{'saveTo':_0x261255},function(_0x90d195,_0x47e00b){if(_0x90d195)return _0x2f22f8(_0x90d195);return _0x537044(_0x47e00b);});})[_0x741e('0x2d')](function(){return new BPromise(function(_0x3b50d4,_0x8c337d){rimraf(_0x497169,function(_0x3c20e9){if(_0x3c20e9)_0x8c337d(_0x3c20e9);return _0x3b50d4();});});})['then'](function(){return _0x2da248[_0x741e('0xbf')](_0x261255,_0x22a317,function(_0x426d9f){if(_0x426d9f){console[_0x741e('0xdf')]('err',_0x426d9f);}else{fs[_0x741e('0xe0')](_0x261255);}});});});}else{return _0x2da248[_0x741e('0x21')](0xc8);}})[_0x741e('0x37')](handleError(_0x2da248,null));}; \ No newline at end of file +var _0xb1ef=['contactName','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','agent','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','rows','show','intersection','includeAll','include','options','create','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','$gte','format','findAll','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','direction','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','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','search','parseSearch','sqlOperator','conditions','value','`\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','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','type','body','some','isEmpty','SmsAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`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)','getFullTextValue','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xb1ef,0x146));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xfb1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb1e('0x1'));var jsonpatch=require(_0xfb1e('0x2'));var rp=require('request-promise');var moment=require(_0xfb1e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfb1e('0x4'));var util=require(_0xfb1e('0x5'));var path=require('path');var sox=require(_0xfb1e('0x6'));var csv=require('to-csv');var ejs=require(_0xfb1e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfb1e('0x8'));var crypto=require(_0xfb1e('0x9'));var jsforce=require(_0xfb1e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfb1e('0xb'));var querystring=require(_0xfb1e('0xc'));var Papa=require(_0xfb1e('0xd'));var Redis=require('ioredis');var authService=require(_0xfb1e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfb1e('0xf'));var pdf=require(_0xfb1e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb1e('0x11'))(_0xfb1e('0x12'));var utils=require(_0xfb1e('0x13'));var config=require(_0xfb1e('0x14'));var licenseUtil=require(_0xfb1e('0x15'));var db=require(_0xfb1e('0x16'))['db'];config[_0xfb1e('0x17')]=_['defaults'](config[_0xfb1e('0x17')],{'host':_0xfb1e('0x18'),'port':0x18eb});var socket=require(_0xfb1e('0x19'))(new Redis(config[_0xfb1e('0x17')]));require(_0xfb1e('0x1a'))[_0xfb1e('0x1b')](socket);function respondWithStatusCode(_0x5201f1,_0x138f71){_0x138f71=_0x138f71||0xcc;return function(_0x70a008){if(_0x70a008){return _0x5201f1['sendStatus'](_0x138f71);}return _0x5201f1[_0xfb1e('0x1c')](_0x138f71)[_0xfb1e('0x1d')]();};}function respondWithResult(_0x3c7277,_0x338b9a){_0x338b9a=_0x338b9a||0xc8;return function(_0x2e312b){if(_0x2e312b){return _0x3c7277[_0xfb1e('0x1c')](_0x338b9a)[_0xfb1e('0x1e')](_0x2e312b);}};}function respondWithFilteredResult(_0x4d1a45,_0x1820e2){return function(_0x18909e){if(_0x18909e){var _0x2ed8a0=typeof _0x1820e2[_0xfb1e('0x1f')]===_0xfb1e('0x20')&&typeof _0x1820e2[_0xfb1e('0x21')]===_0xfb1e('0x20');var _0x27c705=_0x18909e['count'];var _0x41c882=_0x2ed8a0?0x0:_0x1820e2[_0xfb1e('0x1f')];var _0x2b8c7b=_0x2ed8a0?_0x18909e[_0xfb1e('0x22')]:_0x1820e2['offset']+_0x1820e2[_0xfb1e('0x21')];var _0x23f138;if(_0x2b8c7b>=_0x27c705){_0x2b8c7b=_0x27c705;_0x23f138=0xc8;}else{_0x23f138=0xce;}_0x4d1a45['status'](_0x23f138);return _0x4d1a45[_0xfb1e('0x23')](_0xfb1e('0x24'),_0x41c882+'-'+_0x2b8c7b+'/'+_0x27c705)[_0xfb1e('0x1e')](_0x18909e);}return null;};}function patchUpdates(_0x3efb79){return function(_0x3bdd80){try{jsonpatch[_0xfb1e('0x25')](_0x3bdd80,_0x3efb79,!![]);}catch(_0x26c7e4){return BPromise[_0xfb1e('0x26')](_0x26c7e4);}return _0x3bdd80[_0xfb1e('0x27')]();};}function saveUpdates(_0x5d2d1a,_0x507909){return function(_0x561455){if(_0x561455){return _0x561455[_0xfb1e('0x28')](_0x5d2d1a)['then'](function(_0x3eb09d){return _0x3eb09d;});}return null;};}function removeEntity(_0x16c328,_0x27abb3){return function(_0x1cf77e){if(_0x1cf77e){return _0x1cf77e[_0xfb1e('0x29')]()[_0xfb1e('0x2a')](function(){_0x16c328[_0xfb1e('0x1c')](0xcc)[_0xfb1e('0x1d')]();});}};}function handleEntityNotFound(_0x538083,_0x447a93){return function(_0x260eb2){if(!_0x260eb2){_0x538083[_0xfb1e('0x2b')](0x194);}return _0x260eb2;};}function handleError(_0x25fe9d,_0x3b891c){_0x3b891c=_0x3b891c||0x1f4;return function(_0x483f67){logger[_0xfb1e('0x2c')](_0x483f67[_0xfb1e('0x2d')]);if(_0x483f67[_0xfb1e('0x2e')]){delete _0x483f67[_0xfb1e('0x2e')];}_0x25fe9d[_0xfb1e('0x1c')](_0x3b891c)[_0xfb1e('0x2f')](_0x483f67);};}function getInteractionUsers(_0x40b534,_0x496942){return new BPromise(function(_0x466833,_0x399de0){try{if(_0x496942[_0x40b534['id']]){_0x40b534[_0xfb1e('0x30')]=_[_0xfb1e('0x31')](_0x496942[_0x40b534['id']],function(_0xc30036){return{'id':_0xc30036['id'],'fullname':_0xc30036['fullname']};});}}catch(_0x3048e3){_0x399de0(_0x3048e3);}_0x466833(_0x40b534);});}function getInteractionTags(_0x1b4d3b,_0xd8abfd){return new BPromise(function(_0x47d5c4,_0x4aecca){try{if(_0x1b4d3b[_0xfb1e('0x32')]){_0x1b4d3b[_0xfb1e('0x33')]=[];_0x1b4d3b[_0xfb1e('0x32')][_0xfb1e('0x34')](',')[_0xfb1e('0x35')](function(_0x31890d){_0x1b4d3b['Tags']['push'](_0xd8abfd[_0x31890d]);});}delete _0x1b4d3b[_0xfb1e('0x32')];}catch(_0x5a0dc6){_0x4aecca(_0x5a0dc6);}_0x47d5c4(_0x1b4d3b);});}function updateSmsInteraction(_0x3111b8,_0x58a476,_0x4c51d4){return new BPromise(function(_0x555537,_0x31ed6b){return getInteractionUsers(_0x3111b8,_0x4c51d4)[_0xfb1e('0x2a')](function(_0x178abf){return getInteractionTags(_0x178abf,_0x58a476);})[_0xfb1e('0x2a')](function(_0x40024b){_0x555537(_0x40024b);})[_0xfb1e('0x36')](function(_0x3bcaf6){_0x31ed6b(_0x3bcaf6);});});}exports[_0xfb1e('0x37')]=function(_0x27d5dc,_0x3ac27a){var _0x438ba0={},_0x8f58b7={},_0x4a0e0f={'count':0x0,'rows':[]};var _0x3e6608=_[_0xfb1e('0x31')](db[_0xfb1e('0x38')][_0xfb1e('0x39')],function(_0x99abcf){return{'name':_0x99abcf[_0xfb1e('0x3a')],'type':_0x99abcf['type'][_0xfb1e('0x3b')]};});_0x8f58b7[_0xfb1e('0x3c')]=_['map'](_0x3e6608,_0xfb1e('0x2e'));_0x8f58b7[_0xfb1e('0x3d')]=_[_0xfb1e('0x3e')](_0x27d5dc[_0xfb1e('0x3d')]);_0x8f58b7['filters']=_['intersection'](_0x8f58b7[_0xfb1e('0x3c')],_0x8f58b7['query']);_0x438ba0[_0xfb1e('0x3f')]=_['intersection'](_0x8f58b7[_0xfb1e('0x3c')],qs[_0xfb1e('0x40')](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x40')]));_0x438ba0[_0xfb1e('0x3f')]=_0x438ba0['attributes'][_0xfb1e('0x41')]?_0x438ba0[_0xfb1e('0x3f')]:_0x8f58b7[_0xfb1e('0x3c')];if(!_0x27d5dc['query']['hasOwnProperty']('nolimit')){_0x438ba0[_0xfb1e('0x21')]=qs[_0xfb1e('0x21')](_0x27d5dc[_0xfb1e('0x3d')]['limit']);_0x438ba0[_0xfb1e('0x1f')]=qs[_0xfb1e('0x1f')](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x1f')]);}_0x438ba0[_0xfb1e('0x42')]=qs['sort'](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x43')]);_0x438ba0[_0xfb1e('0x44')]=qs[_0xfb1e('0x45')](_[_0xfb1e('0x46')](_0x27d5dc[_0xfb1e('0x3d')],_0x8f58b7[_0xfb1e('0x45')]),_0x3e6608);var _0x47f955=[];var _0x4fe474=squel[_0xfb1e('0x47')]()[_0xfb1e('0x48')]('id')[_0xfb1e('0x48')](_0xfb1e('0x2e'))['field'](_0xfb1e('0x49'))[_0xfb1e('0x4a')](_0xfb1e('0x4b'));var _0x1f9080=squel[_0xfb1e('0x47')]()[_0xfb1e('0x48')](_0xfb1e('0x4c'))['field'](_0xfb1e('0x4d'))[_0xfb1e('0x48')](_0xfb1e('0x4e'))[_0xfb1e('0x4a')]('user_has_sms_interactions','ui')['left_join']('users','u',_0xfb1e('0x4f'));var _0x9293a7=squel['select']()[_0xfb1e('0x4a')](_0xfb1e('0x50'),'i')[_0xfb1e('0x51')](_0xfb1e('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xfb1e('0x51')](_0xfb1e('0x53'),'o',_0xfb1e('0x54'))['left_join'](_0xfb1e('0x55'),'a',_0xfb1e('0x56'))[_0xfb1e('0x51')](_0xfb1e('0x57'),'me',_0xfb1e('0x58'))[_0xfb1e('0x51')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xfb1e('0x4b'),'t',_0xfb1e('0x59'));var _0xddc426=squel[_0xfb1e('0x5a')]();var _0x576d38=[];var _0x119c71=squel[_0xfb1e('0x5a')]();var _0x336129;if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x5b')]){_0x336129=as[_0xfb1e('0x5c')](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x5b')]);var _0x28c35a=_0x336129[_0xfb1e('0x5d')];for(var _0x24b093=0x0;_0x24b093<_0x336129[_0xfb1e('0x5e')]['length'];_0x24b093++){var _0x95299d=_0x336129[_0xfb1e('0x5e')][_0x24b093];var _0x49b6ad='i';var _0x24ecc0=_['find'](_0x3e6608,[_0xfb1e('0x2e'),_0x95299d['field']]);if(!_0x24ecc0){switch(_0x95299d['field']){case'unreadMessages':if(_0x95299d[_0xfb1e('0x5f')]==0x1){_0x9293a7['having']('`'+_0x95299d[_0xfb1e('0x48')]+'`\x20=\x200');}else{_0x9293a7['having']('`'+_0x95299d['field']+_0xfb1e('0x60'));}break;case _0xfb1e('0x61'):if(_0x95299d[_0xfb1e('0x62')]===_0xfb1e('0x63')){if(_0x95299d[_0xfb1e('0x5f')]['split']('\x20')[_0xfb1e('0x41')]>0x1){_0xddc426[_0x28c35a](_0xfb1e('0x64'),qs['getFullTextValue'](_0x95299d[_0xfb1e('0x5f')]),null);}else{var _0xf4e328='%'+_0x95299d[_0xfb1e('0x5f')]+'%';_0xddc426[_0x28c35a](_0xfb1e('0x65'),_0xf4e328,_0xf4e328,_0xf4e328);}}else{_0x24ecc0=_[_0xfb1e('0x66')](_0x3e6608,[_0xfb1e('0x2e'),_0xfb1e('0x67')]);_0x95299d[_0xfb1e('0x48')]='ContactId';_0x3ddd79=as[_0xfb1e('0x68')](_0x49b6ad,_0x24ecc0['type'],_0x95299d);_0xddc426[_0x28c35a](_0x3ddd79[_0xfb1e('0x69')],_0x3ddd79[_0xfb1e('0x5f')][_0xfb1e('0x6a')],_0x3ddd79[_0xfb1e('0x5f')]['end']);}break;case _0xfb1e('0x6b'):var _0x2719a6=_0x95299d[_0xfb1e('0x5f')][_0xfb1e('0x34')](',')[_0xfb1e('0x31')](function(_0x158a96){return Number(_0x158a96);});_0x2719a6[_0xfb1e('0x35')](function(_0x40c055){_0x119c71['or'](_0xfb1e('0x6c'),'%,'+_0x40c055+',%');});_0x576d38=_[_0xfb1e('0x6d')](_0x576d38,_0x2719a6);break;case'User':if(_0x95299d[_0xfb1e('0x62')]==='$substring'){_0xddc426[_0x28c35a](_0xfb1e('0x6e'),'%'+_0x95299d['value']+'%',null);}else{_0x24ecc0=_[_0xfb1e('0x66')](_0x3e6608,['name',_0xfb1e('0x6f')]);_0x95299d['field']=_0xfb1e('0x6f');_0x3ddd79=as[_0xfb1e('0x68')](_0x49b6ad,_0x24ecc0[_0xfb1e('0x70')],_0x95299d);_0xddc426[_0x28c35a](_0x3ddd79[_0xfb1e('0x69')],_0x3ddd79[_0xfb1e('0x5f')][_0xfb1e('0x6a')],_0x3ddd79[_0xfb1e('0x5f')][_0xfb1e('0x1d')]);}break;case _0xfb1e('0x71'):_0x3ddd79=as[_0xfb1e('0x68')]('me',null,_0x95299d);_0xddc426[_0x28c35a](_0x3ddd79[_0xfb1e('0x69')],_0x3ddd79[_0xfb1e('0x5f')][_0xfb1e('0x6a')],_0x3ddd79[_0xfb1e('0x5f')]['end']);break;}}else{var _0x3ddd79=as['buildExpression'](_0x49b6ad,_0x24ecc0[_0xfb1e('0x70')],_0x95299d);_0xddc426[_0x28c35a](_0x3ddd79[_0xfb1e('0x69')],_0x3ddd79['value']['start'],_0x3ddd79['value'][_0xfb1e('0x1d')]);}}}else{var _0x635734=_(_0x27d5dc['query'])[_0xfb1e('0x3e')]()[_0xfb1e('0x31')](function(_0x522901){return _[_0xfb1e('0x72')](_0x3e6608,[_0xfb1e('0x2e'),_0x522901])?_0x522901:undefined;})['compact']()[_0xfb1e('0x5f')]();if(!_[_0xfb1e('0x73')](_0x635734)){_0x635734[_0xfb1e('0x35')](function(_0x429754){if(_0x429754===_0xfb1e('0x74')){_0x9293a7[_0xfb1e('0x44')]('i.SmsAccountId\x20IN\x20?',[][_0xfb1e('0x75')](_0x27d5dc[_0xfb1e('0x3d')][_0x429754]));}else if(_0x429754===_0xfb1e('0x76')){var _0x1bd37c=JSON[_0xfb1e('0x77')](_0x27d5dc[_0xfb1e('0x3d')][_0x429754])['$gte'];var _0x7017f8=JSON[_0xfb1e('0x77')](_0x27d5dc[_0xfb1e('0x3d')][_0x429754])[_0xfb1e('0x78')];_0x9293a7[_0xfb1e('0x44')](_0xfb1e('0x79'),_0x1bd37c,_0x7017f8);}else{if(_0x27d5dc[_0xfb1e('0x3d')][_0x429754]===_0xfb1e('0x7a')){_0x9293a7[_0xfb1e('0x44')]('i.'+_0x429754+'\x20IS\x20NULL');}else{_0x9293a7[_0xfb1e('0x44')]('i.'+_0x429754+_0xfb1e('0x7b'),_0x27d5dc['query'][_0x429754]);}}});}if(_0x27d5dc['query'][_0xfb1e('0x7c')]){if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x7c')]==0x1){_0x9293a7[_0xfb1e('0x7d')](_0xfb1e('0x7e'));}else{_0x9293a7['having'](_0xfb1e('0x7f'));}}if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x80')]){_0x576d38=_[_0xfb1e('0x81')](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x80')])?_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x80')]:new Array(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x80')]);_0x576d38[_0xfb1e('0x35')](function(_0x496ea1){_0x119c71['or'](_0xfb1e('0x6c'),'%,'+_0x496ea1+',%');});}if(_0x27d5dc['query'][_0xfb1e('0x82')]){var _0x1341af=_0x27d5dc['query'][_0xfb1e('0x82')][_0xfb1e('0x83')]('\x5c','\x5c\x5c')[_0xfb1e('0x83')](/'/g,'\x27\x27');if(qs[_0xfb1e('0x84')](_0x1341af)){_0xddc426['or'](_0xfb1e('0x85'),_0x1341af+'%')['or'](_0xfb1e('0x86'),_0x1341af+'%');}else{_0xddc426['or'](_0xfb1e('0x87'),qs[_0xfb1e('0x88')](_0x1341af))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1341af+'%');}}}_0x9293a7[_0xfb1e('0x44')](_0xddc426);_0x9293a7[_0xfb1e('0x89')](_0xfb1e('0x8a'));var _0x2f5a18={'type':db[_0xfb1e('0x8b')]['QueryTypes'][_0xfb1e('0x8c')],'raw':!![]};var _0x154165=_0x9293a7[_0xfb1e('0x8d')]();_0x154165[_0xfb1e('0x48')]('i.id');_0x154165[_0xfb1e('0x48')](_0xfb1e('0x8e'),_0xfb1e('0x8f'));if(_0x438ba0[_0xfb1e('0x42')]){_0x438ba0['order'][_0xfb1e('0x35')](function(_0x570a8e){var _0x154ab7=_0x570a8e[0x0]===_0xfb1e('0x90')?_0x570a8e[0x0]:'i.'+_0x570a8e[0x0];_0x9293a7[_0xfb1e('0x42')](_0x154ab7,_0x570a8e[0x1]==='DESC'?![]:!![]);});}if(!_[_0xfb1e('0x73')](_0x576d38)){_0x9293a7[_0xfb1e('0x7d')](_0x119c71);_0x154165[_0xfb1e('0x44')]('t.id\x20IN\x20?',_0x576d38);}BPromise['resolve']()[_0xfb1e('0x2a')](function(){if(!_0x336129){if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x74')])return;_0x154165['where'](_0xfb1e('0x91'));_0x9293a7['where'](_0xfb1e('0x91'));return;}if(_0x27d5dc[_0xfb1e('0x92')][_0xfb1e('0x93')]!=='agent')return;return _0x27d5dc[_0xfb1e('0x92')][_0xfb1e('0x94')]({'attributes':['id'],'raw':!![]})[_0xfb1e('0x2a')](function(_0x3ca46d){if(_[_0xfb1e('0x73')](_0x3ca46d)){_0x154165['where'](_0xfb1e('0x95'));_0x9293a7[_0xfb1e('0x44')](_0xfb1e('0x95'));}else{_0x154165[_0xfb1e('0x44')](_0xfb1e('0x96'),_[_0xfb1e('0x31')](_0x3ca46d,'id'));_0x9293a7[_0xfb1e('0x44')](_0xfb1e('0x96'),_['map'](_0x3ca46d,'id'));}});})[_0xfb1e('0x2a')](function(){if(_0x27d5dc[_0xfb1e('0x92')][_0xfb1e('0x93')]===_0xfb1e('0x97')&&!_0x336129&&!_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x74')])return[];return db[_0xfb1e('0x98')][_0xfb1e('0x3d')](_0x154165[_0xfb1e('0x99')](),_0x2f5a18);})[_0xfb1e('0x2a')](function(_0x2be7ff){_0x4a0e0f[_0xfb1e('0x22')]=_0x2be7ff[_0xfb1e('0x41')];if(_0x4a0e0f['count']===0x0)return[];return db['sequelize'][_0xfb1e('0x3d')](_0x4fe474[_0xfb1e('0x99')](),_0x2f5a18)[_0xfb1e('0x2a')](function(_0x3028ab){_0x47f955=_['keyBy'](_0x3028ab,'id');_0x2f5a18=_[_0xfb1e('0x9a')](_0x2f5a18,{'model':db[_0xfb1e('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x40')]){_0x438ba0['attributes'][_0xfb1e('0x35')](function(_0x3eafbb){_0x9293a7[_0xfb1e('0x48')]('i.'+_0x3eafbb);});}else{_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0x8e'),_0xfb1e('0x8f'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0x9b'),_0xfb1e('0x9c'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0x9d'),_0xfb1e('0x9e'));_0x9293a7['field']('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',_0xfb1e('0x90'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0x9f'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa0'),_0xfb1e('0xa1'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa2'),'Contact.lastName');_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa3'),_0xfb1e('0xa4'));_0x9293a7['field'](_0xfb1e('0xa5'),_0xfb1e('0xa6'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa7'),'Contact.mobile');_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa8'),_0xfb1e('0xa9'));_0x9293a7['field']('o.fullname','Owner.fullname');_0x9293a7[_0xfb1e('0x48')]('o.internal',_0xfb1e('0xaa'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xab'),_0xfb1e('0x32'));}if(_0x438ba0[_0xfb1e('0x21')])_0x9293a7[_0xfb1e('0x21')](_0x438ba0['limit']);if(_0x438ba0[_0xfb1e('0x1f')])_0x9293a7[_0xfb1e('0x1f')](_0x438ba0[_0xfb1e('0x1f')]);return db['sequelize']['query'](_0x9293a7[_0xfb1e('0x99')](),_0x2f5a18);})[_0xfb1e('0x2a')](function(_0x35c7a2){if(_0x35c7a2[_0xfb1e('0x41')]>0x0)_0x1f9080[_0xfb1e('0x44')](_0xfb1e('0xac'),_[_0xfb1e('0x31')](_0x35c7a2,'id'));return db[_0xfb1e('0x98')][_0xfb1e('0x3d')](_0x1f9080['toString'](),_0x2f5a18)[_0xfb1e('0x2a')](function(_0x2028be){var _0x229ca6=_['groupBy'](_0x2028be,_0xfb1e('0xad'));var _0x4f0ccf=[];_0x35c7a2['forEach'](function(_0x28e5e0){_0x4f0ccf[_0xfb1e('0xae')](updateSmsInteraction(_0x28e5e0,_0x47f955,_0x229ca6));});return BPromise[_0xfb1e('0xaf')](_0x4f0ccf);});});})[_0xfb1e('0x2a')](function(_0x7254b2){_0x4a0e0f[_0xfb1e('0xb0')]=_0x7254b2;return _0x4a0e0f;})[_0xfb1e('0x2a')](respondWithFilteredResult(_0x3ac27a,_0x438ba0))['catch'](handleError(_0x3ac27a,null));};exports[_0xfb1e('0xb1')]=function(_0x5d95cf,_0x56478d){var _0x49c140={'raw':![],'where':{'id':_0x5d95cf['params']['id']}},_0x590efc={};_0x590efc[_0xfb1e('0x3c')]=_[_0xfb1e('0x3e')](db[_0xfb1e('0x38')]['rawAttributes']);_0x590efc[_0xfb1e('0x3d')]=_['keys'](_0x5d95cf['query']);_0x590efc[_0xfb1e('0x45')]=_[_0xfb1e('0xb2')](_0x590efc[_0xfb1e('0x3c')],_0x590efc[_0xfb1e('0x3d')]);_0x49c140[_0xfb1e('0x3f')]=_[_0xfb1e('0xb2')](_0x590efc[_0xfb1e('0x3c')],qs[_0xfb1e('0x40')](_0x5d95cf['query'][_0xfb1e('0x40')]));_0x49c140['attributes']=_0x49c140[_0xfb1e('0x3f')][_0xfb1e('0x41')]?_0x49c140[_0xfb1e('0x3f')]:_0x590efc['model'];if(_0x5d95cf[_0xfb1e('0x3d')][_0xfb1e('0xb3')]){_0x49c140[_0xfb1e('0xb4')]=[{'all':!![]}];}_0x49c140=_[_0xfb1e('0x9a')]({},_0x49c140,_0x5d95cf[_0xfb1e('0xb5')]);return db[_0xfb1e('0x38')][_0xfb1e('0x66')](_0x49c140)[_0xfb1e('0x2a')](handleEntityNotFound(_0x56478d,null))['then'](respondWithResult(_0x56478d,null))[_0xfb1e('0x36')](handleError(_0x56478d,null));};exports[_0xfb1e('0xb6')]=function(_0x1e2153,_0x3d6f82){return db[_0xfb1e('0x38')][_0xfb1e('0xb6')](_0x1e2153[_0xfb1e('0x71')],{})[_0xfb1e('0x2a')](respondWithResult(_0x3d6f82,0xc9))[_0xfb1e('0x36')](handleError(_0x3d6f82,null));};exports[_0xfb1e('0x28')]=function(_0x1294ae,_0x14c852){if(_0x1294ae[_0xfb1e('0x71')]['id']){delete _0x1294ae['body']['id'];}return db[_0xfb1e('0x38')]['find']({'where':{'id':_0x1294ae[_0xfb1e('0xb7')]['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x14c852,null))[_0xfb1e('0x2a')](saveUpdates(_0x1294ae['body'],null))[_0xfb1e('0x2a')](respondWithResult(_0x14c852,null))[_0xfb1e('0x36')](handleError(_0x14c852,null));};exports['destroy']=function(_0x25ad7f,_0x1c3059){return db[_0xfb1e('0x38')][_0xfb1e('0x66')]({'where':{'id':_0x25ad7f['params']['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x1c3059,null))['then'](removeEntity(_0x1c3059,null))['catch'](handleError(_0x1c3059,null));};exports[_0xfb1e('0xb8')]=function(_0x55c991,_0x2471a1){return db[_0xfb1e('0x38')][_0xfb1e('0xb8')]()[_0xfb1e('0x2a')](respondWithResult(_0x2471a1,null))[_0xfb1e('0x36')](handleError(_0x2471a1,null));};exports[_0xfb1e('0xb9')]=function(_0x49741d,_0x142ff4,_0x574638){return db[_0xfb1e('0xba')]['find']({'where':{'id':_0x49741d['params']['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x142ff4,null))[_0xfb1e('0x2a')](function(_0x44b027){if(_0x44b027){return _0x44b027[_0xfb1e('0xb9')](_0x49741d[_0xfb1e('0x71')][_0xfb1e('0xbb')],_[_0xfb1e('0xbc')](_0x49741d[_0xfb1e('0x71')],[_0xfb1e('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x142ff4,null))[_0xfb1e('0x36')](handleError(_0x142ff4,null));};exports[_0xfb1e('0xbd')]=function(_0x22fe46,_0x30d01e,_0xd4baf3){var _0x275d59={'raw':![],'where':{}};var _0x4ee58d={};var _0x41db91={'count':0x0,'rows':[]};return db[_0xfb1e('0x38')][_0xfb1e('0xbe')]({'where':{'id':_0x22fe46[_0xfb1e('0xb7')]['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x30d01e,null))[_0xfb1e('0x2a')](function(_0x415fe6){if(_0x415fe6){_0x4ee58d[_0xfb1e('0x3c')]=_[_0xfb1e('0x3e')](db[_0xfb1e('0xba')][_0xfb1e('0x39')]);_0x4ee58d[_0xfb1e('0x3d')]=_[_0xfb1e('0x3e')](_0x22fe46[_0xfb1e('0x3d')]);_0x4ee58d[_0xfb1e('0x45')]=_[_0xfb1e('0xb2')](_0x4ee58d[_0xfb1e('0x3c')],_0x4ee58d['query']);_0x275d59[_0xfb1e('0x3f')]=_['intersection'](_0x4ee58d['model'],qs['fields'](_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x40')]));_0x275d59[_0xfb1e('0x3f')]=_0x275d59[_0xfb1e('0x3f')][_0xfb1e('0x41')]?_0x275d59['attributes']:_0x4ee58d['model'];if(!_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0xbf')](_0xfb1e('0xc0'))){_0x275d59[_0xfb1e('0x21')]=qs[_0xfb1e('0x21')](_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x21')]);_0x275d59[_0xfb1e('0x1f')]=qs[_0xfb1e('0x1f')](_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x1f')]);}_0x275d59['order']=qs[_0xfb1e('0x43')](_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x43')]);_0x275d59[_0xfb1e('0x44')]=qs[_0xfb1e('0x45')](_['pick'](_0x22fe46[_0xfb1e('0x3d')],_0x4ee58d[_0xfb1e('0x45')]));_0x275d59['where'][_0xfb1e('0xad')]=_0x415fe6['id'];if(_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x82')]){_0x275d59[_0xfb1e('0x44')]=_[_0xfb1e('0x9a')](_0x275d59['where'],{'$or':_['map'](_0x275d59[_0xfb1e('0x3f')],function(_0xd67e63){var _0x92838e={};_0x92838e[_0xd67e63]={'$like':'%'+_0x22fe46[_0xfb1e('0x3d')]['filter']+'%'};return _0x92838e;})});}if(_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0xc1')]){var _0x1af8d6=_0x22fe46['query']['$gte'][_0xfb1e('0x34')](',');var _0x516ce5={};_0x516ce5[_0x1af8d6[0x0]]={'$gte':moment(_0x1af8d6[0x1])[_0xfb1e('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x275d59[_0xfb1e('0x44')]=_['merge'](_0x275d59[_0xfb1e('0x44')],_0x516ce5);}_0x275d59=_[_0xfb1e('0x9a')]({},_0x275d59,_0x22fe46['options']);return db[_0xfb1e('0xba')][_0xfb1e('0x22')]({'where':_0x275d59[_0xfb1e('0x44')]})[_0xfb1e('0x2a')](function(_0x229133){_0x41db91[_0xfb1e('0x22')]=_0x229133;if(_0x22fe46['query'][_0xfb1e('0xb3')]){_0x275d59['include']=[{'all':!![]}];}return db[_0xfb1e('0xba')][_0xfb1e('0xc3')](_0x275d59);})['then'](function(_0x33de8e){_0x41db91[_0xfb1e('0xb0')]=_0x33de8e;return _0x41db91;});}})[_0xfb1e('0x2a')](respondWithFilteredResult(_0x30d01e,_0x275d59))[_0xfb1e('0x36')](handleError(_0x30d01e,null));};exports[_0xfb1e('0xc4')]=function(_0x287c9e,_0x59cf6e,_0x5bfcf2){return db[_0xfb1e('0x38')][_0xfb1e('0x66')]({'where':{'id':_0x287c9e['params']['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x59cf6e,null))[_0xfb1e('0x2a')](function(_0x4e174b){if(_0x4e174b){return _0x4e174b[_0xfb1e('0xc5')](_0x287c9e[_0xfb1e('0x71')][_0xfb1e('0xbb')],_[_0xfb1e('0xbc')](_0x287c9e[_0xfb1e('0x71')],[_0xfb1e('0xbb'),'id'])||{})[_0xfb1e('0xc6')](function(){return db['Tag'][_0xfb1e('0xc3')]({'attributes':['id',_0xfb1e('0x2e'),_0xfb1e('0x49')],'where':{'id':_0x287c9e[_0xfb1e('0x71')][_0xfb1e('0xbb')]}});})[_0xfb1e('0x2a')](function(_0x220f18){socket['emit'](_0xfb1e('0xc7'),{'id':Number(_0x287c9e[_0xfb1e('0xb7')]['id']),'tags':_0x220f18||[]});return{'id':Number(_0x287c9e[_0xfb1e('0xb7')]['id']),'tags':_0x220f18||[]};});}})[_0xfb1e('0x2a')](respondWithResult(_0x59cf6e,null))[_0xfb1e('0x36')](handleError(_0x59cf6e,null));};exports[_0xfb1e('0xc8')]=function(_0x163ff6,_0x8be1af,_0x413533){return db[_0xfb1e('0x38')][_0xfb1e('0x66')]({'where':{'id':_0x163ff6[_0xfb1e('0xb7')]['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x8be1af,null))[_0xfb1e('0x2a')](function(_0xdbc81a){if(_0xdbc81a){return _0xdbc81a[_0xfb1e('0xc8')](_0x163ff6[_0xfb1e('0x3d')][_0xfb1e('0xbb')]);}})[_0xfb1e('0x2a')](respondWithStatusCode(_0x8be1af,null))[_0xfb1e('0x36')](handleError(_0x8be1af,null));};exports[_0xfb1e('0xc9')]=function(_0x13a1f3,_0x1868a9){var _0x235315=moment()[_0xfb1e('0xca')]()[_0xfb1e('0x99')]();var _0x98d68a=path[_0xfb1e('0xcb')](config[_0xfb1e('0xcc')],_0xfb1e('0xcd'),'files',_0xfb1e('0xce'));var _0xc3bf07=path[_0xfb1e('0xcb')](config[_0xfb1e('0xcc')],'server',_0xfb1e('0xcf'),_0xfb1e('0xd0'));var _0x5cd2a0=path[_0xfb1e('0xcb')](_0x98d68a,_0x235315);var _0x59df81=util['format'](_0xfb1e('0xd1'),_0x13a1f3['params']['id'],_0x235315);var _0x716a49=path[_0xfb1e('0xcb')](_0x98d68a,_0x59df81);var _0x372266=[];_0x372266[_0xfb1e('0xae')]({'model':db[_0xfb1e('0xd2')],'as':_0xfb1e('0xd2'),'attributes':['id',_0xfb1e('0xd3')],'raw':!![]});_0x372266[_0xfb1e('0xae')]({'model':db[_0xfb1e('0xd4')],'as':_0xfb1e('0x61'),'attributes':['id',_0xfb1e('0xd5'),_0xfb1e('0xd6')],'raw':!![]});var _0x3be41d=[{'model':db[_0xfb1e('0xba')],'as':'Messages','attributes':['id','body',_0xfb1e('0x76'),_0xfb1e('0xd7'),_0xfb1e('0xd8'),_0xfb1e('0x7c')],'include':_0x372266}];_0x3be41d[_0xfb1e('0xae')]({'model':db[_0xfb1e('0xd9')],'as':_0xfb1e('0xda'),'attributes':['id','name']});_0x3be41d[_0xfb1e('0xae')]({'model':db['User'],'as':'Owner','attributes':['id',_0xfb1e('0xd3')]});return db['SmsInteraction'][_0xfb1e('0x66')]({'where':{'id':_0x13a1f3[_0xfb1e('0xb7')]['id']},'include':_0x3be41d})[_0xfb1e('0x2a')](handleEntityNotFound(_0x1868a9,null))[_0xfb1e('0x2a')](function(_0x3e4017){if(_0x3e4017){var _0x489e3a=_0x3e4017[_0xfb1e('0xdb')]({'plain':!![]});fs[_0xfb1e('0xdc')](_0x5cd2a0);var _0x29d2d4={'channel':_0xfb1e('0xdd'),'account':_0x489e3a[_0xfb1e('0xda')][_0xfb1e('0x2e')],'agent':_0x489e3a[_0xfb1e('0xde')]?_0x489e3a[_0xfb1e('0xde')]['fullname']:_0xfb1e('0xdf'),'createdAt':moment(_0x489e3a[_0xfb1e('0x76')])[_0xfb1e('0xc2')](_0xfb1e('0xe0'))[_0xfb1e('0x99')](),'closedAt':_0x489e3a['closed']?moment(_0x489e3a['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x489e3a[_0xfb1e('0xe1')],'messages':_(_0x489e3a['Messages'])[_0xfb1e('0x82')]({'secret':![]})[_0xfb1e('0x31')](function(_0x1a3579){return{'date':moment(_0x1a3579[_0xfb1e('0x76')])[_0xfb1e('0xc2')](_0xfb1e('0xe0'))['toString'](),'sender':_0x1a3579[_0xfb1e('0xd7')]===_0xfb1e('0xe2')?_0x1a3579[_0xfb1e('0xd2')]?_0x1a3579[_0xfb1e('0xd2')][_0xfb1e('0xd3')]:_0xfb1e('0xe3'):_0x1a3579[_0xfb1e('0x61')][_0xfb1e('0xd5')]+(_0x1a3579[_0xfb1e('0x61')][_0xfb1e('0xd6')]?'\x20'+_0x1a3579[_0xfb1e('0x61')][_0xfb1e('0xd6')]:''),'body':_0x1a3579['body'],'direction':_0x1a3579[_0xfb1e('0xd7')]==='out'?'A':'C','secret':_0x1a3579[_0xfb1e('0xd8')],'read':_0x1a3579[_0xfb1e('0x7c')]};})[_0xfb1e('0x5f')]()};return ejs[_0xfb1e('0xe4')](path[_0xfb1e('0xcb')](config[_0xfb1e('0xcc')],'server',_0xfb1e('0xe5'),'downloadInteraction.ejs'),{'interaction':_0x29d2d4})['then'](function(_0x2725d8){var _0x1a980b=path[_0xfb1e('0xcb')](_0x5cd2a0,_0xfb1e('0xe6')+_0x489e3a['id']+'-'+_0x235315+_0xfb1e('0xe7'));var _0x3bd5bc={'path':_0x1a980b,'channel':_0xfb1e('0xdd'),'interactionId':_0x489e3a['id']};return pdf[_0xfb1e('0xe8')](_0x2725d8,_0x3bd5bc);})[_0xfb1e('0x2a')](function(){return new BPromise(function(_0x1c01cb,_0x40ad61){zipdir(_0x5cd2a0,{'saveTo':_0x716a49},function(_0x2c26b1,_0x4f0391){if(_0x2c26b1)return _0x40ad61(_0x2c26b1);return _0x1c01cb(_0x4f0391);});})[_0xfb1e('0x2a')](function(){return new BPromise(function(_0x45c124,_0x1c1a4e){rimraf(_0x5cd2a0,function(_0x1ad3c0){if(_0x1ad3c0)_0x1c1a4e(_0x1ad3c0);return _0x45c124();});});})[_0xfb1e('0x2a')](function(){return _0x1868a9[_0xfb1e('0xc9')](_0x716a49,_0x59df81,function(_0x366c17){if(_0x366c17){console[_0xfb1e('0xe9')](_0xfb1e('0xea'),_0x366c17);}else{fs['unlinkSync'](_0x716a49);}});});});}else{return _0x1868a9[_0xfb1e('0x2b')](0xc8);}})[_0xfb1e('0x36')](handleError(_0x1868a9,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 44dc66f..9f8b593 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 _0x66fa=['remove','getUsers','then','setDataValue','map','findAll','emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x5a4e93,_0x1eee27){var _0x2d3cd9=function(_0x265b03){while(--_0x265b03){_0x5a4e93['push'](_0x5a4e93['shift']());}};_0x2d3cd9(++_0x1eee27);}(_0x66fa,0x117));var _0xa66f=function(_0x4f38f9,_0x363d07){_0x4f38f9=_0x4f38f9-0x0;var _0x1cffec=_0x66fa[_0x4f38f9];return _0x1cffec;};'use strict';var EventEmitter=require(_0xa66f('0x0'));var SmsInteraction=require(_0xa66f('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa66f('0x1'))['db'][_0xa66f('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa66f('0x3')](0x0);var events={'afterCreate':_0xa66f('0x4'),'afterUpdate':_0xa66f('0x5'),'afterDestroy':_0xa66f('0x6')};function emitEvent(_0x3f4904){return function(_0x5ebea5,_0x4fd9d0,_0x2239d3){_0x5ebea5[_0xa66f('0x7')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x8')](function(_0x1d02fc){_0x5ebea5[_0xa66f('0x9')]('Users',_0x1d02fc[_0xa66f('0xa')](function(_0x4f6717){return{'id':_0x4f6717['id']};}));return SmsMessage[_0xa66f('0xb')]({'where':{'SmsInteractionId':_0x5ebea5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x101e10){_0x5ebea5['setDataValue']('unreadMessages',_0x101e10['length']);SmsInteractionEvents[_0xa66f('0xc')](_0x3f4904+':'+_0x5ebea5['id'],_0x5ebea5);SmsInteractionEvents[_0xa66f('0xc')](_0x3f4904,_0x5ebea5);_0x2239d3(null);})['catch'](_0x2239d3(null));};}for(var e in events){if(events[_0xa66f('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xa66f('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x558a01,_0x5239e3){var _0x319bb8=function(_0x4a95d8){while(--_0x4a95d8){_0x558a01['push'](_0x558a01['shift']());}};_0x319bb8(++_0x5239e3);}(_0xef0f,0x168));var _0xfef0=function(_0x1ec8f9,_0x9348b2){_0x1ec8f9=_0x1ec8f9-0x0;var _0x417145=_0xef0f[_0x1ec8f9];return _0x417145;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('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 448ba43..737fa42 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 _0xf9ff=['api','moment','bluebird','request-promise','../../config/environment','define','SmsInteraction','sms_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x4ddbf5,_0x233f7e){var _0x325fdf=function(_0x49edf7){while(--_0x49edf7){_0x4ddbf5['push'](_0x4ddbf5['shift']());}};_0x325fdf(++_0x233f7e);}(_0xf9ff,0x16a));var _0xff9f=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xf9ff[_0x455c6c];return _0x488242;};'use strict';var _=require(_0xff9f('0x0'));var util=require('util');var logger=require(_0xff9f('0x1'))(_0xff9f('0x2'));var moment=require(_0xff9f('0x3'));var BPromise=require(_0xff9f('0x4'));var rp=require(_0xff9f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff9f('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x4570a4,_0x47bd61){return _0x4570a4[_0xff9f('0x7')](_0xff9f('0x8'),attributes,{'tableName':_0xff9f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28a2b2,_0xbe8a54,_0x655a70){if(_0x28a2b2['changed'](_0xff9f('0xa'))){_0x28a2b2['closedAt']=moment()[_0xff9f('0xb')](_0xff9f('0xc'));}_0x655a70(null,_0x28a2b2);}}});}; \ No newline at end of file +var _0x13bf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','format','lodash','util','../../config/logger'];(function(_0xb0ee18,_0x36a014){var _0x165c69=function(_0x2dc2d0){while(--_0x2dc2d0){_0xb0ee18['push'](_0xb0ee18['shift']());}};_0x165c69(++_0x36a014);}(_0x13bf,0x1c8));var _0xf13b=function(_0x4a5dc7,_0x8b8bbb){_0x4a5dc7=_0x4a5dc7-0x0;var _0x4653c9=_0x13bf[_0x4a5dc7];return _0x4653c9;};'use strict';var _=require(_0xf13b('0x0'));var util=require(_0xf13b('0x1'));var logger=require(_0xf13b('0x2'))(_0xf13b('0x3'));var moment=require(_0xf13b('0x4'));var BPromise=require(_0xf13b('0x5'));var rp=require(_0xf13b('0x6'));var fs=require('fs');var path=require(_0xf13b('0x7'));var rimraf=require(_0xf13b('0x8'));var config=require(_0xf13b('0x9'));var attributes=require(_0xf13b('0xa'));module['exports']=function(_0x4f8655,_0x1e0db3){return _0x4f8655[_0xf13b('0xb')](_0xf13b('0xc'),attributes,{'tableName':_0xf13b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x442f9b,_0x44a292,_0x306414){if(_0x442f9b[_0xf13b('0xe')](_0xf13b('0xf'))){_0x442f9b['closedAt']=moment()[_0xf13b('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x306414(null,_0x442f9b);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index e2f06f7..020dc17 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 _0xfd48=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToSmsInteraction','addTags','ids','AddTags','lodash','bluebird','randomstring'];(function(_0x3ef2b9,_0x181bcf){var _0x42ff00=function(_0x9a7c6a){while(--_0x9a7c6a){_0x3ef2b9['push'](_0x3ef2b9['shift']());}};_0x42ff00(++_0x181bcf);}(_0xfd48,0xe7));var _0x8fd4=function(_0x153899,_0x5b19a4){_0x153899=_0x153899-0x0;var _0xb8e403=_0xfd48[_0x153899];return _0xb8e403;};'use strict';var _=require(_0x8fd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8fd4('0x1'));var rs=require(_0x8fd4('0x2'));var fs=require('fs');var Redis=require(_0x8fd4('0x3'));var db=require(_0x8fd4('0x4'))['db'];var utils=require(_0x8fd4('0x5'));var logger=require(_0x8fd4('0x6'))(_0x8fd4('0x7'));var config=require(_0x8fd4('0x8'));var jayson=require(_0x8fd4('0x9'));var client=jayson[_0x8fd4('0xa')][_0x8fd4('0xb')]({'port':0x232a});config[_0x8fd4('0xc')]=_['defaults'](config[_0x8fd4('0xc')],{'host':_0x8fd4('0xd'),'port':0x18eb});var socket=require(_0x8fd4('0xe'))(new Redis(config[_0x8fd4('0xc')]));require('./smsInteraction.socket')[_0x8fd4('0xf')](socket);function respondWithRpcPromise(_0x3fa111,_0x2b5ac7,_0x1ba1c7){return new BPromise(function(_0x5b20c4,_0x41a6d2){return client[_0x8fd4('0x10')](_0x3fa111,_0x1ba1c7)[_0x8fd4('0x11')](function(_0x3af496){logger[_0x8fd4('0x12')](_0x8fd4('0x13'),_0x2b5ac7,_0x8fd4('0x14'));logger[_0x8fd4('0x15')](_0x8fd4('0x16'),_0x2b5ac7,_0x8fd4('0x14'),JSON[_0x8fd4('0x17')](_0x3af496));if(_0x3af496[_0x8fd4('0x18')]){if(_0x3af496['error']['code']===0x1f4){logger[_0x8fd4('0x18')](_0x8fd4('0x13'),_0x2b5ac7,_0x3af496[_0x8fd4('0x18')][_0x8fd4('0x19')]);return _0x41a6d2(_0x3af496[_0x8fd4('0x18')][_0x8fd4('0x19')]);}logger[_0x8fd4('0x18')](_0x8fd4('0x13'),_0x2b5ac7,_0x3af496[_0x8fd4('0x18')][_0x8fd4('0x19')]);return _0x5b20c4(_0x3af496['error'][_0x8fd4('0x19')]);}else{logger[_0x8fd4('0x12')](_0x8fd4('0x13'),_0x2b5ac7,'request\x20sent');_0x5b20c4(_0x3af496['result'][_0x8fd4('0x19')]);}})['catch'](function(_0x3c51b0){logger[_0x8fd4('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x2b5ac7,_0x3c51b0);_0x41a6d2(_0x3c51b0);});});}exports[_0x8fd4('0x1a')]=function(_0x269a5d){var _0x25f90f=this;return new Promise(function(_0x47e78f,_0x4ea80a){return db[_0x8fd4('0x1b')][_0x8fd4('0x1c')](_0x269a5d['body'],{'raw':_0x269a5d['options']?_0x269a5d[_0x8fd4('0x1d')][_0x8fd4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x269a5d[_0x8fd4('0x1d')]?_0x269a5d[_0x8fd4('0x1d')][_0x8fd4('0x1f')]||null:null,'attributes':_0x269a5d[_0x8fd4('0x1d')]?_0x269a5d[_0x8fd4('0x1d')][_0x8fd4('0x20')]||null:null,'limit':_0x269a5d[_0x8fd4('0x1d')]?_0x269a5d['options'][_0x8fd4('0x21')]||null:null})['then'](function(_0x1ba00b){logger[_0x8fd4('0x12')](_0x8fd4('0x1a'),_0x269a5d);logger[_0x8fd4('0x15')](_0x8fd4('0x1a'),_0x269a5d,JSON['stringify'](_0x1ba00b));_0x47e78f(_0x1ba00b);})[_0x8fd4('0x22')](function(_0x19c457){logger[_0x8fd4('0x18')](_0x8fd4('0x1a'),_0x19c457[_0x8fd4('0x19')],_0x269a5d);_0x4ea80a(_0x25f90f['error'](0x1f4,_0x19c457[_0x8fd4('0x19')]));});});};exports[_0x8fd4('0x23')]=function(_0x50746c){return new Promise(function(_0x593b1e,_0x2529b7){return db[_0x8fd4('0x1b')]['find']({'where':_0x50746c[_0x8fd4('0x1d')]?_0x50746c['options'][_0x8fd4('0x1f')]||null:null})[_0x8fd4('0x11')](function(_0x57c4c5){if(_0x57c4c5){return _0x57c4c5[_0x8fd4('0x24')](_0x50746c['body']['ids'],_['omit'](_0x50746c['body'],[_0x8fd4('0x25'),'id'])||{});}})['spread'](function(_0x1beb2c){logger[_0x8fd4('0x12')](_0x8fd4('0x26'),_0x50746c);logger[_0x8fd4('0x15')](_0x8fd4('0x26'),_0x50746c,JSON[_0x8fd4('0x17')](_0x1beb2c));_0x593b1e(_0x1beb2c);})[_0x8fd4('0x22')](function(_0x43c849){logger[_0x8fd4('0x18')](_0x8fd4('0x26'),_0x43c849['message'],_0x50746c);_0x2529b7(_this[_0x8fd4('0x18')](0x1f4,_0x43c849[_0x8fd4('0x19')]));});});}; \ No newline at end of file +var _0x3adf=['omit','body','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','addTags','ids'];(function(_0x381172,_0xf1af48){var _0x251bf3=function(_0x34c0de){while(--_0x34c0de){_0x381172['push'](_0x381172['shift']());}};_0x251bf3(++_0xf1af48);}(_0x3adf,0xd5));var _0xf3ad=function(_0x3439bc,_0xc03879){_0x3439bc=_0x3439bc-0x0;var _0x484801=_0x3adf[_0x3439bc];return _0x484801;};'use strict';var _=require(_0xf3ad('0x0'));var util=require(_0xf3ad('0x1'));var moment=require('moment');var BPromise=require(_0xf3ad('0x2'));var rs=require(_0xf3ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3ad('0x4'))['db'];var utils=require(_0xf3ad('0x5'));var logger=require(_0xf3ad('0x6'))(_0xf3ad('0x7'));var config=require(_0xf3ad('0x8'));var jayson=require(_0xf3ad('0x9'));var client=jayson['client'][_0xf3ad('0xa')]({'port':0x232a});config['redis']=_[_0xf3ad('0xb')](config[_0xf3ad('0xc')],{'host':_0xf3ad('0xd'),'port':0x18eb});var socket=require(_0xf3ad('0xe'))(new Redis(config[_0xf3ad('0xc')]));require(_0xf3ad('0xf'))[_0xf3ad('0x10')](socket);function respondWithRpcPromise(_0x26a24a,_0x5c2ee1,_0x43de42){return new BPromise(function(_0x1f32fe,_0x4f36f9){return client[_0xf3ad('0x11')](_0x26a24a,_0x43de42)[_0xf3ad('0x12')](function(_0x41adb8){logger[_0xf3ad('0x13')](_0xf3ad('0x14'),_0x5c2ee1,_0xf3ad('0x15'));logger[_0xf3ad('0x16')](_0xf3ad('0x17'),_0x5c2ee1,_0xf3ad('0x15'),JSON[_0xf3ad('0x18')](_0x41adb8));if(_0x41adb8['error']){if(_0x41adb8['error']['code']===0x1f4){logger['error'](_0xf3ad('0x14'),_0x5c2ee1,_0x41adb8[_0xf3ad('0x19')]['message']);return _0x4f36f9(_0x41adb8[_0xf3ad('0x19')][_0xf3ad('0x1a')]);}logger[_0xf3ad('0x19')](_0xf3ad('0x14'),_0x5c2ee1,_0x41adb8[_0xf3ad('0x19')]['message']);return _0x1f32fe(_0x41adb8[_0xf3ad('0x19')][_0xf3ad('0x1a')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x5c2ee1,'request\x20sent');_0x1f32fe(_0x41adb8[_0xf3ad('0x1b')][_0xf3ad('0x1a')]);}})[_0xf3ad('0x1c')](function(_0x44db35){logger[_0xf3ad('0x19')](_0xf3ad('0x14'),_0x5c2ee1,_0x44db35);_0x4f36f9(_0x44db35);});});}exports[_0xf3ad('0x1d')]=function(_0x57da2f){var _0xcb1502=this;return new Promise(function(_0x28f215,_0x4f0123){return db['SmsInteraction'][_0xf3ad('0x1e')](_0x57da2f['body'],{'raw':_0x57da2f[_0xf3ad('0x1f')]?_0x57da2f['options'][_0xf3ad('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57da2f[_0xf3ad('0x1f')]?_0x57da2f[_0xf3ad('0x1f')][_0xf3ad('0x21')]||null:null,'attributes':_0x57da2f[_0xf3ad('0x1f')]?_0x57da2f['options'][_0xf3ad('0x22')]||null:null,'limit':_0x57da2f['options']?_0x57da2f[_0xf3ad('0x1f')][_0xf3ad('0x23')]||null:null})[_0xf3ad('0x12')](function(_0x5df931){logger[_0xf3ad('0x13')](_0xf3ad('0x1d'),_0x57da2f);logger[_0xf3ad('0x16')]('UpdateSmsInteraction',_0x57da2f,JSON[_0xf3ad('0x18')](_0x5df931));_0x28f215(_0x5df931);})[_0xf3ad('0x1c')](function(_0x34c8ec){logger[_0xf3ad('0x19')](_0xf3ad('0x1d'),_0x34c8ec[_0xf3ad('0x1a')],_0x57da2f);_0x4f0123(_0xcb1502[_0xf3ad('0x19')](0x1f4,_0x34c8ec[_0xf3ad('0x1a')]));});});};exports[_0xf3ad('0x24')]=function(_0x58e079){return new Promise(function(_0x4e50ff,_0x23270e){return db['SmsInteraction']['find']({'where':_0x58e079[_0xf3ad('0x1f')]?_0x58e079[_0xf3ad('0x1f')][_0xf3ad('0x21')]||null:null})[_0xf3ad('0x12')](function(_0x2ec2af){if(_0x2ec2af){return _0x2ec2af[_0xf3ad('0x25')](_0x58e079['body'][_0xf3ad('0x26')],_[_0xf3ad('0x27')](_0x58e079[_0xf3ad('0x28')],[_0xf3ad('0x26'),'id'])||{});}})['spread'](function(_0x271bd9){logger[_0xf3ad('0x13')](_0xf3ad('0x29'),_0x58e079);logger['debug'](_0xf3ad('0x29'),_0x58e079,JSON[_0xf3ad('0x18')](_0x271bd9));_0x4e50ff(_0x271bd9);})[_0xf3ad('0x1c')](function(_0xdafd20){logger[_0xf3ad('0x19')](_0xf3ad('0x29'),_0xdafd20['message'],_0x58e079);_0x23270e(_this[_0xf3ad('0x19')](0x1f4,_0xdafd20[_0xf3ad('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 34b8667..086b6cc 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 _0xab29=['smsInteraction:','./smsInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x4f16c8,_0x151bf0){var _0x57c4a2=function(_0x31f0c0){while(--_0x31f0c0){_0x4f16c8['push'](_0x4f16c8['shift']());}};_0x57c4a2(++_0x151bf0);}(_0xab29,0x81));var _0x9ab2=function(_0x30fe50,_0x17952e){_0x30fe50=_0x30fe50-0x0;var _0x573d17=_0xab29[_0x30fe50];return _0x573d17;};'use strict';var SmsInteractionEvents=require(_0x9ab2('0x0'));var events=['save',_0x9ab2('0x1'),_0x9ab2('0x2')];function createListener(_0x5bb013,_0x462b5a){return function(_0x34da26){_0x462b5a[_0x9ab2('0x3')](_0x5bb013,_0x34da26);};}function removeListener(_0x269046,_0x3d40fe){return function(){SmsInteractionEvents[_0x9ab2('0x4')](_0x269046,_0x3d40fe);};}exports[_0x9ab2('0x5')]=function(_0x33c02e){for(var _0x12c793=0x0,_0x197ea9=events[_0x9ab2('0x6')];_0x12c793<_0x197ea9;_0x12c793++){var _0x33efcb=events[_0x12c793];var _0x431d6b=createListener(_0x9ab2('0x7')+_0x33efcb,_0x33c02e);SmsInteractionEvents['on'](_0x33efcb,_0x431d6b);}}; \ No newline at end of file +var _0xe253=['./smsInteraction.events','save','remove','update','emit','length','smsInteraction:'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xe253,0x196));var _0x3e25=function(_0x143a0e,_0x7862c){_0x143a0e=_0x143a0e-0x0;var _0x3c96de=_0xe253[_0x143a0e];return _0x3c96de;};'use strict';var SmsInteractionEvents=require(_0x3e25('0x0'));var events=[_0x3e25('0x1'),_0x3e25('0x2'),_0x3e25('0x3')];function createListener(_0xf277d9,_0x20e415){return function(_0x396794){_0x20e415[_0x3e25('0x4')](_0xf277d9,_0x396794);};}function removeListener(_0x5e6cd9,_0x59469b){return function(){SmsInteractionEvents['removeListener'](_0x5e6cd9,_0x59469b);};}exports['register']=function(_0x33404a){for(var _0x2233e1=0x0,_0x18b96f=events[_0x3e25('0x5')];_0x2233e1<_0x18b96f;_0x2233e1++){var _0x26eba6=events[_0x2233e1];var _0x4934e6=createListener(_0x3e25('0x6')+_0x26eba6,_0x33404a);SmsInteractionEvents['on'](_0x26eba6,_0x4934e6);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d6772b7..a9afc95 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 _0x20fb=['get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','/:id/status','status','put','update','accept','/:id/reject','reject','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x20fb,0x1b2));var _0xb20f=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x20fb[_0x164eca];return _0x2ce562;};'use strict';var multer=require(_0xb20f('0x0'));var util=require(_0xb20f('0x1'));var path=require(_0xb20f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb20f('0x3')]();var fs_extra=require(_0xb20f('0x4'));var auth=require(_0xb20f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb20f('0x6'));var controller=require(_0xb20f('0x7'));router[_0xb20f('0x8')]('/',auth['isAuthenticated'](),controller[_0xb20f('0x9')]);router[_0xb20f('0x8')](_0xb20f('0xa'),auth[_0xb20f('0xb')](),controller[_0xb20f('0xc')]);router[_0xb20f('0x8')](_0xb20f('0xd'),auth[_0xb20f('0xb')](),controller[_0xb20f('0xe')]);router[_0xb20f('0xf')]('/',auth[_0xb20f('0xb')](),interaction[_0xb20f('0x10')]('sms','smsmessage:create'),controller['create']);router[_0xb20f('0xf')](_0xb20f('0x11'),controller[_0xb20f('0x12')]);router[_0xb20f('0x13')](_0xb20f('0xd'),auth[_0xb20f('0xb')](),controller[_0xb20f('0x14')]);router[_0xb20f('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xb20f('0x15')]);router[_0xb20f('0x13')](_0xb20f('0x16'),auth[_0xb20f('0xb')](),controller[_0xb20f('0x17')]);router['delete'](_0xb20f('0xd'),auth['isAuthenticated'](),controller[_0xb20f('0x18')]);module[_0xb20f('0x19')]=router; \ No newline at end of file +var _0x7916=['post','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','reject','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','/describe','describe','show','tracked','sms','create'];(function(_0x5190b8,_0x28ffad){var _0x3a9c02=function(_0x5df0fc){while(--_0x5df0fc){_0x5190b8['push'](_0x5190b8['shift']());}};_0x3a9c02(++_0x28ffad);}(_0x7916,0x128));var _0x6791=function(_0x28b3a5,_0x54d002){_0x28b3a5=_0x28b3a5-0x0;var _0x323f59=_0x7916[_0x28b3a5];return _0x323f59;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['post']('/',auth[_0x6791('0x8')](),interaction[_0x6791('0xd')](_0x6791('0xe'),'smsmessage:create'),controller[_0x6791('0xf')]);router[_0x6791('0x10')](_0x6791('0x11'),controller[_0x6791('0x12')]);router[_0x6791('0x13')](_0x6791('0x14'),auth[_0x6791('0x8')](),controller[_0x6791('0x15')]);router[_0x6791('0x13')](_0x6791('0x16'),auth[_0x6791('0x8')](),controller['accept']);router['put'](_0x6791('0x17'),auth['isAuthenticated'](),controller[_0x6791('0x18')]);router['delete'](_0x6791('0x14'),auth[_0x6791('0x8')](),controller['destroy']);module[_0x6791('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index b20a69b..5e89d34 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 _0xec32=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xec32,0xb8));var _0x2ec3=function(_0x5b00fe,_0x4e5a0a){_0x5b00fe=_0x5b00fe-0x0;var _0x5aee5c=_0xec32[_0x5b00fe];return _0x5aee5c;};'use strict';var Sequelize=require(_0x2ec3('0x0'));module[_0x2ec3('0x1')]={'body':{'type':Sequelize[_0x2ec3('0x2')](_0x2ec3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2ec3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2ec3('0x5')]('in','out'),'defaultValue':_0x2ec3('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2ec3('0x7')]},'readAt':{'type':Sequelize[_0x2ec3('0x8')]},'secret':{'type':Sequelize[_0x2ec3('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2ec3('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc69b=['exports','medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize'];(function(_0x14c309,_0x373331){var _0x3bc8da=function(_0x180f4c){while(--_0x180f4c){_0x14c309['push'](_0x14c309['shift']());}};_0x3bc8da(++_0x373331);}(_0xc69b,0x1d3));var _0xbc69=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0xc69b[_0x5a99db];return _0x3aad62;};'use strict';var Sequelize=require(_0xbc69('0x0'));module[_0xbc69('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbc69('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbc69('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbc69('0x4')]('in',_0xbc69('0x5')),'defaultValue':_0xbc69('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbc69('0x6')](0xbe)},'phone':{'type':Sequelize[_0xbc69('0x6')]},'readAt':{'type':Sequelize[_0xbc69('0x7')]},'secret':{'type':Sequelize[_0xbc69('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbc69('0x6')]},'providerResponse':{'type':Sequelize[_0xbc69('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index fda120a..21d2ec7 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 _0xe98c=['destroy','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','get','SmsInteraction','SmsInteractionId','UserId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','role','RejectMessage','rejectMessage','Sequelize','motionChannel','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsMessage.socket','jayson/promise','http','client','request','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','then','stack','name','index','SmsMessage','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','fields','find','create','body','update'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xe98c,0xd3));var _0xce98=function(_0x4caff1,_0x4d7ce1){_0x4caff1=_0x4caff1-0x0;var _0x2e088f=_0xe98c[_0x4caff1];return _0x2e088f;};'use strict';var emlformat=require(_0xce98('0x0'));var rimraf=require(_0xce98('0x1'));var zipdir=require(_0xce98('0x2'));var jsonpatch=require(_0xce98('0x3'));var rp=require(_0xce98('0x4'));var moment=require('moment');var BPromise=require(_0xce98('0x5'));var Mustache=require(_0xce98('0x6'));var util=require(_0xce98('0x7'));var path=require(_0xce98('0x8'));var sox=require(_0xce98('0x9'));var csv=require(_0xce98('0xa'));var ejs=require(_0xce98('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce98('0xc'));var squel=require(_0xce98('0xd'));var crypto=require(_0xce98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xce98('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce98('0x10'));var Papa=require('papaparse');var Redis=require(_0xce98('0x11'));var authService=require(_0xce98('0x12'));var qs=require(_0xce98('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce98('0x14'));var logger=require(_0xce98('0x15'))(_0xce98('0x16'));var utils=require('../../config/utils');var config=require(_0xce98('0x17'));var licenseUtil=require(_0xce98('0x18'));var db=require(_0xce98('0x19'))['db'];config[_0xce98('0x1a')]=_[_0xce98('0x1b')](config[_0xce98('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce98('0x1a')]));require(_0xce98('0x1c'))['register'](socket);var jayson=require(_0xce98('0x1d'));var client=jayson['client'][_0xce98('0x1e')]({'port':0x232c});var client9002=jayson[_0xce98('0x1f')][_0xce98('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xd68d7d,_0x176b15,_0x3460f5,_0x2613b0){return new BPromise(function(_0x1944e2,_0x147392){var _0x4d69a1=_0x2613b0||client;return _0x4d69a1[_0xce98('0x20')](_0xd68d7d,_0x3460f5)['then'](function(_0xd0ef6e){logger[_0xce98('0x21')](_0xce98('0x22'),_0x176b15,'request\x20sent');logger[_0xce98('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x176b15,_0xce98('0x24'),JSON[_0xce98('0x25')](_0xd0ef6e));if(_0xd0ef6e['error']){if(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x27')]===0x1f4){logger[_0xce98('0x26')](_0xce98('0x22'),_0x176b15,_0xd0ef6e[_0xce98('0x26')]['message']);return _0x147392(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x28')]);}logger[_0xce98('0x26')](_0xce98('0x22'),_0x176b15,_0xd0ef6e[_0xce98('0x26')]['message']);return _0x1944e2(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x28')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x176b15,_0xce98('0x24'));_0x1944e2(_0xd0ef6e[_0xce98('0x29')][_0xce98('0x28')]);}})[_0xce98('0x2a')](function(_0x21b681){logger['error'](_0xce98('0x22'),_0x176b15,_0x21b681);_0x147392(_0x21b681);});});}function respondWithStatusCode(_0x4368f4,_0x5ccc1f){_0x5ccc1f=_0x5ccc1f||0xcc;return function(_0x163eb6){if(_0x163eb6){return _0x4368f4['sendStatus'](_0x5ccc1f);}return _0x4368f4[_0xce98('0x2b')](_0x5ccc1f)[_0xce98('0x2c')]();};}function respondWithResult(_0x3987aa,_0x53d3ef){_0x53d3ef=_0x53d3ef||0xc8;return function(_0x422677){if(_0x422677){return _0x3987aa[_0xce98('0x2b')](_0x53d3ef)['json'](_0x422677);}};}function respondWithFilteredResult(_0x3849e8,_0x54132b){return function(_0x50a3c5){if(_0x50a3c5){var _0x12f180=typeof _0x54132b['offset']===_0xce98('0x2d')&&typeof _0x54132b[_0xce98('0x2e')]===_0xce98('0x2d');var _0xb80887=_0x50a3c5[_0xce98('0x2f')];var _0x3df91d=_0x12f180?0x0:_0x54132b[_0xce98('0x30')];var _0x2e6b4a=_0x12f180?_0x50a3c5[_0xce98('0x2f')]:_0x54132b[_0xce98('0x30')]+_0x54132b[_0xce98('0x2e')];var _0x1af843;if(_0x2e6b4a>=_0xb80887){_0x2e6b4a=_0xb80887;_0x1af843=0xc8;}else{_0x1af843=0xce;}_0x3849e8[_0xce98('0x2b')](_0x1af843);return _0x3849e8[_0xce98('0x31')](_0xce98('0x32'),_0x3df91d+'-'+_0x2e6b4a+'/'+_0xb80887)[_0xce98('0x33')](_0x50a3c5);}return null;};}function patchUpdates(_0x2559e9){return function(_0x200647){try{jsonpatch['apply'](_0x200647,_0x2559e9,!![]);}catch(_0x15685e){return BPromise[_0xce98('0x34')](_0x15685e);}return _0x200647['save']();};}function saveUpdates(_0x389a2a,_0x27cebc){return function(_0x4f7d44){if(_0x4f7d44){return _0x4f7d44['update'](_0x389a2a)['then'](function(_0x517efa){return _0x517efa;});}return null;};}function removeEntity(_0x297384,_0x414c8b){return function(_0xdc7f88){if(_0xdc7f88){return _0xdc7f88['destroy']()[_0xce98('0x35')](function(){_0x297384[_0xce98('0x2b')](0xcc)[_0xce98('0x2c')]();});}};}function handleEntityNotFound(_0x102e79,_0x2ef325){return function(_0xee4629){if(!_0xee4629){_0x102e79['sendStatus'](0x194);}return _0xee4629;};}function handleError(_0x14da15,_0x15f7e5){_0x15f7e5=_0x15f7e5||0x1f4;return function(_0x1534a6){logger[_0xce98('0x26')](_0x1534a6[_0xce98('0x36')]);if(_0x1534a6['name']){delete _0x1534a6[_0xce98('0x37')];}_0x14da15[_0xce98('0x2b')](_0x15f7e5)['send'](_0x1534a6);};}exports[_0xce98('0x38')]=function(_0xc25a4d,_0x9bc65e){var _0x2d26aa={},_0x57f010={},_0x4e07cb={'count':0x0,'rows':[]};var _0x2f9c4b=_['map'](db[_0xce98('0x39')]['rawAttributes'],function(_0x530d0d){return{'name':_0x530d0d[_0xce98('0x3a')],'type':_0x530d0d[_0xce98('0x3b')][_0xce98('0x3c')]};});_0x57f010[_0xce98('0x3d')]=_[_0xce98('0x3e')](_0x2f9c4b,_0xce98('0x37'));_0x57f010['query']=_[_0xce98('0x3f')](_0xc25a4d[_0xce98('0x40')]);_0x57f010[_0xce98('0x41')]=_[_0xce98('0x42')](_0x57f010[_0xce98('0x3d')],_0x57f010[_0xce98('0x40')]);_0x2d26aa[_0xce98('0x43')]=_[_0xce98('0x42')](_0x57f010[_0xce98('0x3d')],qs['fields'](_0xc25a4d[_0xce98('0x40')]['fields']));_0x2d26aa[_0xce98('0x43')]=_0x2d26aa[_0xce98('0x43')][_0xce98('0x44')]?_0x2d26aa['attributes']:_0x57f010['model'];if(!_0xc25a4d['query'][_0xce98('0x45')](_0xce98('0x46'))){_0x2d26aa[_0xce98('0x2e')]=qs['limit'](_0xc25a4d[_0xce98('0x40')][_0xce98('0x2e')]);_0x2d26aa['offset']=qs['offset'](_0xc25a4d[_0xce98('0x40')][_0xce98('0x30')]);}_0x2d26aa[_0xce98('0x47')]=qs[_0xce98('0x48')](_0xc25a4d[_0xce98('0x40')][_0xce98('0x48')]);_0x2d26aa['where']=qs[_0xce98('0x41')](_['pick'](_0xc25a4d[_0xce98('0x40')],_0x57f010[_0xce98('0x41')]),_0x2f9c4b);if(_0xc25a4d['query'][_0xce98('0x49')]){_0x2d26aa['where']=_[_0xce98('0x4a')](_0x2d26aa[_0xce98('0x4b')],{'$or':_[_0xce98('0x3e')](_0x2f9c4b,function(_0x327ab1){if(_0x327ab1[_0xce98('0x3b')]!==_0xce98('0x4c')){var _0x222ea5={};_0x222ea5[_0x327ab1['name']]={'$like':'%'+_0xc25a4d[_0xce98('0x40')]['filter']+'%'};return _0x222ea5;}})});}_0x2d26aa=_[_0xce98('0x4a')]({},_0x2d26aa,_0xc25a4d[_0xce98('0x4d')]);var _0x15628d={'where':_0x2d26aa['where']};return db[_0xce98('0x39')][_0xce98('0x2f')](_0x15628d)[_0xce98('0x35')](function(_0x59a868){_0x4e07cb[_0xce98('0x2f')]=_0x59a868;if(_0xc25a4d[_0xce98('0x40')][_0xce98('0x4e')]){_0x2d26aa[_0xce98('0x4f')]=[{'all':!![]}];}return db[_0xce98('0x39')][_0xce98('0x50')](_0x2d26aa);})[_0xce98('0x35')](function(_0x342a6f){_0x4e07cb['rows']=_0x342a6f;return _0x4e07cb;})[_0xce98('0x35')](respondWithFilteredResult(_0x9bc65e,_0x2d26aa))['catch'](handleError(_0x9bc65e,null));};exports[_0xce98('0x51')]=function(_0x1fb9e1,_0x458382){var _0x2db0a2={'raw':!![],'where':{'id':_0x1fb9e1[_0xce98('0x52')]['id']}},_0x295cca={};_0x295cca[_0xce98('0x3d')]=_[_0xce98('0x3f')](db['SmsMessage'][_0xce98('0x53')]);_0x295cca[_0xce98('0x40')]=_[_0xce98('0x3f')](_0x1fb9e1[_0xce98('0x40')]);_0x295cca[_0xce98('0x41')]=_[_0xce98('0x42')](_0x295cca[_0xce98('0x3d')],_0x295cca['query']);_0x2db0a2[_0xce98('0x43')]=_[_0xce98('0x42')](_0x295cca['model'],qs['fields'](_0x1fb9e1[_0xce98('0x40')][_0xce98('0x54')]));_0x2db0a2['attributes']=_0x2db0a2[_0xce98('0x43')][_0xce98('0x44')]?_0x2db0a2[_0xce98('0x43')]:_0x295cca[_0xce98('0x3d')];if(_0x1fb9e1['query'][_0xce98('0x4e')]){_0x2db0a2[_0xce98('0x4f')]=[{'all':!![]}];}_0x2db0a2=_[_0xce98('0x4a')]({},_0x2db0a2,_0x1fb9e1['options']);return db[_0xce98('0x39')][_0xce98('0x55')](_0x2db0a2)[_0xce98('0x35')](handleEntityNotFound(_0x458382,null))[_0xce98('0x35')](respondWithResult(_0x458382,null))[_0xce98('0x2a')](handleError(_0x458382,null));};exports[_0xce98('0x56')]=function(_0x1ff630,_0xfa5e6f){return db['SmsMessage'][_0xce98('0x56')](_0x1ff630[_0xce98('0x57')],{})[_0xce98('0x35')](respondWithResult(_0xfa5e6f,0xc9))[_0xce98('0x2a')](handleError(_0xfa5e6f,null));};exports[_0xce98('0x58')]=function(_0x179f13,_0x5d541e){if(_0x179f13[_0xce98('0x57')]['id']){delete _0x179f13[_0xce98('0x57')]['id'];}return db['SmsMessage'][_0xce98('0x55')]({'where':{'id':_0x179f13[_0xce98('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d541e,null))[_0xce98('0x35')](saveUpdates(_0x179f13[_0xce98('0x57')],null))['then'](respondWithResult(_0x5d541e,null))[_0xce98('0x2a')](handleError(_0x5d541e,null));};exports[_0xce98('0x59')]=function(_0xcfce73,_0x2e9ec5){return db[_0xce98('0x39')][_0xce98('0x55')]({'where':{'id':_0xcfce73[_0xce98('0x52')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x2e9ec5,null))[_0xce98('0x35')](removeEntity(_0x2e9ec5,null))[_0xce98('0x2a')](handleError(_0x2e9ec5,null));};exports[_0xce98('0x5a')]=function(_0x5b3990,_0x4682c4){return db['SmsMessage']['describe']()[_0xce98('0x35')](respondWithResult(_0x4682c4,null))[_0xce98('0x2a')](handleError(_0x4682c4,null));};var interaction_log=require('../../config/logger')(_0xce98('0x5b'));exports[_0xce98('0x5c')]=function(_0x366500,_0x2e662c,_0x3c3a0f){var _0x2946d0={'agent':{},'channel':_0xce98('0x5d')};if(_0x366500[_0xce98('0x57')]['id']){delete _0x366500['body']['id'];}_0x366500[_0xce98('0x57')][_0xce98('0x5e')]=!![];_0x366500[_0xce98('0x57')]['readAt']=moment()[_0xce98('0x5f')](_0xce98('0x60'));_0x366500[_0xce98('0x57')]['UserId']=_0x366500['body']['UserId']||_0x366500['user']['id'];_0x2946d0['agent']['id']=_0x366500[_0xce98('0x57')]['UserId'];return db[_0xce98('0x39')][_0xce98('0x55')]({'where':{'id':_0x366500[_0xce98('0x52')]['id'],'UserId':null}})[_0xce98('0x35')](handleEntityNotFound(_0x2e662c,null))['then'](saveUpdates(_0x366500['body'],null))['then'](function(_0x3f951c){if(_0x3f951c){_0x2946d0[_0xce98('0x28')]=_0x3f951c[_0xce98('0x61')]({'plain':!![]});return db[_0xce98('0x62')]['find']({'where':{'id':_0x3f951c[_0xce98('0x63')]}});}return null;})[_0xce98('0x35')](handleEntityNotFound(_0x2e662c,null))[_0xce98('0x35')](function(_0x2a0119){if(_0x2a0119){return _0x2a0119[_0xce98('0x58')]({'UserId':_0x366500[_0xce98('0x57')][_0xce98('0x64')],'read1stAt':_[_0xce98('0x65')](_0x2a0119[_0xce98('0x66')])?moment()['format'](_0xce98('0x60')):undefined});}return null;})[_0xce98('0x35')](function(_0x112e28){if(_0x112e28){_0x2946d0[_0xce98('0x67')]=_0x112e28['get']({'plain':!![]});interaction_log['info'](_0xce98('0x68'),_0x366500['user']['id'],_0x366500['user'][_0xce98('0x37')],_0x366500[_0xce98('0x69')]['role'],_0x2946d0['interaction']['id'],_0x366500[_0xce98('0x57')]?JSON[_0xce98('0x25')](_0x366500['body']):_0xce98('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xce98('0x6b'),_0x2946d0);}return null;})['then'](function(_0x1590e5){var _0x4f3763=_0xce98('0x6c')+_0x1590e5[_0xce98('0x28')][_0xce98('0x6d')];return db[_0xce98('0x6e')][_0xce98('0x40')](_0x4f3763,{'type':db['Sequelize'][_0xce98('0x6f')][_0xce98('0x70')],'raw':!![]})['then'](function(_0x17a605){return _0x17a605;});})[_0xce98('0x35')](function(_0x500512){if(_0x500512){_0x2946d0['message'][_0xce98('0x71')]=_0x500512[0x0];if(!_0x366500[_0xce98('0x57')][_0xce98('0x64')])return;return db[_0xce98('0x72')][_0xce98('0x55')]({'where':{'id':_0x366500[_0xce98('0x57')][_0xce98('0x64')],'role':_0xce98('0x73')},'attributes':['id',_0xce98('0x37'),_0xce98('0x74'),'email',_0xce98('0x75')],'raw':!![]});}return null;})['then'](function(_0x36c5b3){if(!_0x36c5b3)return null;_0x2946d0[_0xce98('0x28')][_0xce98('0x73')]=_0x36c5b3;return _0x2946d0;})[_0xce98('0x35')](function(_0x34f093){if(_0x34f093){if(_0x366500[_0xce98('0x57')][_0xce98('0x76')]){_0x2946d0[_0xce98('0x28')][_0xce98('0x77')]=util[_0xce98('0x5f')](_0xce98('0x78'),_0x366500[_0xce98('0x69')][_0xce98('0x37')]);_0x2946d0[_0xce98('0x28')]['channel']=_0x2946d0[_0xce98('0x79')];_0x2946d0['message']['motionChannel']=_0x2946d0[_0xce98('0x79')];_0x2946d0['message'][_0xce98('0x7a')]=_0xce98('0x5c');return respondWithRpcPromise(_0xce98('0x7b'),_0xce98('0x7b'),{'event':_0xce98('0x7c'),'message':_0x2946d0['message']},client9002)[_0xce98('0x35')](function(){return _0x2946d0;});}return _0x2946d0;}return null;})['then'](respondWithResult(_0x2e662c,null))[_0xce98('0x2a')](handleError(_0x2e662c,null));};var interaction_log=require('../../config/logger')(_0xce98('0x5b'));exports[_0xce98('0x34')]=function(_0x2cc6c9,_0x30c8c7,_0x35c226){var _0x1bf662={'agent':{},'channel':_0xce98('0x5d')};if(_0x2cc6c9['body']['id']){delete _0x2cc6c9[_0xce98('0x57')]['id'];}_0x2cc6c9[_0xce98('0x57')][_0xce98('0x64')]=_0x2cc6c9[_0xce98('0x57')]['UserId']||_0x2cc6c9[_0xce98('0x69')]['id'];_0x1bf662[_0xce98('0x73')]['id']=_0x2cc6c9[_0xce98('0x57')][_0xce98('0x64')];return db[_0xce98('0x39')][_0xce98('0x55')]({'where':{'id':_0x2cc6c9[_0xce98('0x52')]['id'],'UserId':null}})[_0xce98('0x35')](handleEntityNotFound(_0x30c8c7,null))[_0xce98('0x35')](function(_0x72a7e4){if(_0x72a7e4){_0x1bf662['message']=_0x72a7e4[_0xce98('0x61')]({'plain':!![]});return db['SmsInteraction'][_0xce98('0x55')]({'where':{'id':_0x72a7e4['SmsInteractionId']}});}return null;})[_0xce98('0x35')](handleEntityNotFound(_0x30c8c7,null))[_0xce98('0x35')](function(_0x2fa241){if(_0x2fa241){_0x1bf662[_0xce98('0x67')]=_0x2fa241[_0xce98('0x61')]({'plain':!![]});interaction_log[_0xce98('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2cc6c9[_0xce98('0x69')]['id'],_0x2cc6c9[_0xce98('0x69')]['name'],_0x2cc6c9[_0xce98('0x69')][_0xce98('0x7d')],_0x1bf662[_0xce98('0x67')]['id'],_0x2cc6c9[_0xce98('0x57')]?JSON[_0xce98('0x25')](_0x2cc6c9[_0xce98('0x57')]):_0xce98('0x6a'));return respondWithRpcPromise(_0xce98('0x7e'),_0xce98('0x7f'),_0x1bf662);}return null;})[_0xce98('0x35')](function(_0x1c5104){var _0x33b45c=_0xce98('0x6c')+_0x1c5104[_0xce98('0x28')][_0xce98('0x6d')];return db[_0xce98('0x6e')][_0xce98('0x40')](_0x33b45c,{'type':db[_0xce98('0x80')][_0xce98('0x6f')][_0xce98('0x70')],'raw':!![]})['then'](function(_0x17aef0){return _0x17aef0;});})[_0xce98('0x35')](function(_0x389e44){if(_0x389e44){_0x1bf662[_0xce98('0x28')]['contact']=_0x389e44[0x0];if(!_0x2cc6c9['body'][_0xce98('0x64')])return;return db[_0xce98('0x72')][_0xce98('0x55')]({'where':{'id':_0x2cc6c9[_0xce98('0x57')][_0xce98('0x64')],'role':_0xce98('0x73')},'attributes':['id',_0xce98('0x37'),_0xce98('0x74'),'email','internal'],'raw':!![]});}return null;})[_0xce98('0x35')](function(_0x33219a){if(!_0x33219a)return null;_0x1bf662[_0xce98('0x28')][_0xce98('0x73')]=_0x33219a;return _0x1bf662;})[_0xce98('0x35')](function(_0x4a7ffa){if(_0x4a7ffa){_0x4a7ffa[_0xce98('0x28')][_0xce98('0x77')]=util[_0xce98('0x5f')](_0xce98('0x78'),_0x2cc6c9[_0xce98('0x69')][_0xce98('0x37')]);_0x4a7ffa[_0xce98('0x28')]['channel']=_0x1bf662['channel'];_0x4a7ffa['message'][_0xce98('0x81')]=_0x1bf662[_0xce98('0x79')];_0x4a7ffa[_0xce98('0x28')][_0xce98('0x7a')]=_0xce98('0x34');respondWithRpcPromise(_0xce98('0x7b'),_0xce98('0x7b'),{'event':_0xce98('0x82'),'message':_0x4a7ffa['message']},client9002);return _0x1bf662;}return null;})['then'](respondWithResult(_0x30c8c7,null))[_0xce98('0x2a')](handleError(_0x30c8c7,null));};exports['status']=function(_0x3caba2,_0x5b8cf5,_0x279139){if(_0x3caba2[_0xce98('0x57')]['id']){delete _0x3caba2[_0xce98('0x57')]['id'];}var _0x46e9d0;return db['SmsMessage'][_0xce98('0x55')]({'where':{'id':_0x3caba2[_0xce98('0x52')]['id']}})['then'](handleEntityNotFound(_0x5b8cf5,null))[_0xce98('0x35')](function(_0x5ef73a){if(_0x5ef73a){_0x46e9d0=_0x5ef73a;return db[_0xce98('0x83')]['find']({'where':{'id':_0x5ef73a[_0xce98('0x84')]}});}})['then'](handleEntityNotFound(_0x5b8cf5,null))[_0xce98('0x35')](function(_0x11a533){if(_0x11a533){logger[_0xce98('0x23')](_0xce98('0x85'),_0xce98('0x2b'),_0xce98('0x86'),_0x11a533['type'],util['inspect'](_0x3caba2[_0xce98('0x57')],{'showHidden':![],'depth':null}));switch(_0x11a533['type']){case _0xce98('0x87'):if(_0x3caba2[_0xce98('0x57')][_0xce98('0x88')]&&_0x3caba2[_0xce98('0x57')][_0xce98('0x88')]===_0x46e9d0[_0xce98('0x89')]){return _0x46e9d0[_0xce98('0x58')]({'read':!![]});}else{logger['error'](_0xce98('0x8a'),_0xce98('0x2b'),_0xce98('0x87'),util[_0xce98('0x8b')](_0x3caba2[_0xce98('0x57')],{'showHidden':![],'depth':null}));}break;case _0xce98('0x8c'):if(_0x3caba2[_0xce98('0x57')][_0xce98('0x8d')]&&_0x3caba2['body']['MessageUUID']===_0x46e9d0[_0xce98('0x89')]&&_[_0xce98('0x8e')](['sent',_0xce98('0x8f')],_0x3caba2[_0xce98('0x57')][_0xce98('0x90')])>=0x0){return _0x46e9d0[_0xce98('0x58')]({'read':!![]});}else{logger[_0xce98('0x26')](_0xce98('0x8a'),_0xce98('0x2b'),_0xce98('0x91'),util['inspect'](_0x3caba2[_0xce98('0x57')],{'showHidden':![],'depth':null}));}break;case _0xce98('0x92'):var _0x1a3ac7=_0x3caba2[_0xce98('0x57')][_0xce98('0x93')][0x0];if(_0x1a3ac7['status'][_0xce98('0x94')]===_0xce98('0x95')){return _0x46e9d0[_0xce98('0x58')]({'read':!![]});}else{logger[_0xce98('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xce98('0x92'),util[_0xce98('0x8b')](_0x3caba2['body'],{'showHidden':![],'depth':null}));}break;}return _0x46e9d0;}})[_0xce98('0x35')](respondWithResult(_0x5b8cf5,null))[_0xce98('0x2a')](handleError(_0x5b8cf5,null));}; \ No newline at end of file +var _0xe34f=['[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','QueryTypes','SELECT','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','show','params','length','create','body','update','describe','../../config/logger','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe34f,0xbc));var _0xfe34=function(_0x86d9dc,_0x382631){_0x86d9dc=_0x86d9dc-0x0;var _0x4cdbf3=_0xe34f[_0x86d9dc];return _0x4cdbf3;};'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(_0xfe34('0x0'));var moment=require(_0xfe34('0x1'));var BPromise=require(_0xfe34('0x2'));var Mustache=require(_0xfe34('0x3'));var util=require(_0xfe34('0x4'));var path=require(_0xfe34('0x5'));var sox=require(_0xfe34('0x6'));var csv=require('to-csv');var ejs=require(_0xfe34('0x7'));var fs=require('fs');var fs_extra=require(_0xfe34('0x8'));var _=require(_0xfe34('0x9'));var squel=require(_0xfe34('0xa'));var crypto=require(_0xfe34('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe34('0xc'));var querystring=require(_0xfe34('0xd'));var Papa=require(_0xfe34('0xe'));var Redis=require(_0xfe34('0xf'));var authService=require(_0xfe34('0x10'));var qs=require(_0xfe34('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfe34('0x12'));var config=require(_0xfe34('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe34('0x14'))['db'];config[_0xfe34('0x15')]=_[_0xfe34('0x16')](config[_0xfe34('0x15')],{'host':_0xfe34('0x17'),'port':0x18eb});var socket=require(_0xfe34('0x18'))(new Redis(config['redis']));require(_0xfe34('0x19'))[_0xfe34('0x1a')](socket);var jayson=require(_0xfe34('0x1b'));var client=jayson[_0xfe34('0x1c')][_0xfe34('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xfe34('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3acbda,_0x2cdaa5,_0x40927b,_0x53099b){return new BPromise(function(_0x53b469,_0x543d77){var _0x2ce838=_0x53099b||client;return _0x2ce838['request'](_0x3acbda,_0x40927b)['then'](function(_0x495b48){logger[_0xfe34('0x1e')](_0xfe34('0x1f'),_0x2cdaa5,_0xfe34('0x20'));logger[_0xfe34('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2cdaa5,_0xfe34('0x20'),JSON[_0xfe34('0x22')](_0x495b48));if(_0x495b48[_0xfe34('0x23')]){if(_0x495b48[_0xfe34('0x23')][_0xfe34('0x24')]===0x1f4){logger[_0xfe34('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2cdaa5,_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);return _0x543d77(_0x495b48[_0xfe34('0x23')]['message']);}logger[_0xfe34('0x23')](_0xfe34('0x1f'),_0x2cdaa5,_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);return _0x53b469(_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);}else{logger[_0xfe34('0x1e')](_0xfe34('0x1f'),_0x2cdaa5,_0xfe34('0x20'));_0x53b469(_0x495b48[_0xfe34('0x26')]['message']);}})[_0xfe34('0x27')](function(_0x257c3c){logger['error'](_0xfe34('0x1f'),_0x2cdaa5,_0x257c3c);_0x543d77(_0x257c3c);});});}function respondWithStatusCode(_0x524b55,_0x5a0db6){_0x5a0db6=_0x5a0db6||0xcc;return function(_0xdec4c7){if(_0xdec4c7){return _0x524b55['sendStatus'](_0x5a0db6);}return _0x524b55['status'](_0x5a0db6)[_0xfe34('0x28')]();};}function respondWithResult(_0x27c895,_0x48a886){_0x48a886=_0x48a886||0xc8;return function(_0x372886){if(_0x372886){return _0x27c895[_0xfe34('0x29')](_0x48a886)[_0xfe34('0x2a')](_0x372886);}};}function respondWithFilteredResult(_0x3ab3e5,_0x58eba7){return function(_0x4d153b){if(_0x4d153b){var _0x59e06b=typeof _0x58eba7[_0xfe34('0x2b')]===_0xfe34('0x2c')&&typeof _0x58eba7[_0xfe34('0x2d')]===_0xfe34('0x2c');var _0x550e44=_0x4d153b[_0xfe34('0x2e')];var _0x44adf0=_0x59e06b?0x0:_0x58eba7['offset'];var _0x345c00=_0x59e06b?_0x4d153b[_0xfe34('0x2e')]:_0x58eba7[_0xfe34('0x2b')]+_0x58eba7['limit'];var _0x435670;if(_0x345c00>=_0x550e44){_0x345c00=_0x550e44;_0x435670=0xc8;}else{_0x435670=0xce;}_0x3ab3e5[_0xfe34('0x29')](_0x435670);return _0x3ab3e5[_0xfe34('0x2f')](_0xfe34('0x30'),_0x44adf0+'-'+_0x345c00+'/'+_0x550e44)['json'](_0x4d153b);}return null;};}function patchUpdates(_0x3694ab){return function(_0xd2f3df){try{jsonpatch['apply'](_0xd2f3df,_0x3694ab,!![]);}catch(_0x187cf0){return BPromise[_0xfe34('0x31')](_0x187cf0);}return _0xd2f3df[_0xfe34('0x32')]();};}function saveUpdates(_0x1f09e4,_0x38ffc6){return function(_0x54bc7a){if(_0x54bc7a){return _0x54bc7a['update'](_0x1f09e4)[_0xfe34('0x33')](function(_0x486339){return _0x486339;});}return null;};}function removeEntity(_0x2b3e1e,_0x3ae5aa){return function(_0x1a3b9c){if(_0x1a3b9c){return _0x1a3b9c[_0xfe34('0x34')]()[_0xfe34('0x33')](function(){_0x2b3e1e[_0xfe34('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f5039,_0x275a81){return function(_0xa7d1d4){if(!_0xa7d1d4){_0x2f5039[_0xfe34('0x35')](0x194);}return _0xa7d1d4;};}function handleError(_0x147870,_0x28ee1b){_0x28ee1b=_0x28ee1b||0x1f4;return function(_0x34b812){logger[_0xfe34('0x23')](_0x34b812[_0xfe34('0x36')]);if(_0x34b812[_0xfe34('0x37')]){delete _0x34b812[_0xfe34('0x37')];}_0x147870[_0xfe34('0x29')](_0x28ee1b)[_0xfe34('0x38')](_0x34b812);};}exports[_0xfe34('0x39')]=function(_0x1589f9,_0x46c857){var _0x16d7ea={},_0x1f463a={},_0xefb472={'count':0x0,'rows':[]};var _0x4c1c71=_[_0xfe34('0x3a')](db['SmsMessage'][_0xfe34('0x3b')],function(_0x5900a3){return{'name':_0x5900a3[_0xfe34('0x3c')],'type':_0x5900a3[_0xfe34('0x3d')][_0xfe34('0x3e')]};});_0x1f463a[_0xfe34('0x3f')]=_['map'](_0x4c1c71,'name');_0x1f463a['query']=_[_0xfe34('0x40')](_0x1589f9['query']);_0x1f463a[_0xfe34('0x41')]=_[_0xfe34('0x42')](_0x1f463a[_0xfe34('0x3f')],_0x1f463a[_0xfe34('0x43')]);_0x16d7ea[_0xfe34('0x44')]=_[_0xfe34('0x42')](_0x1f463a[_0xfe34('0x3f')],qs[_0xfe34('0x45')](_0x1589f9[_0xfe34('0x43')][_0xfe34('0x45')]));_0x16d7ea[_0xfe34('0x44')]=_0x16d7ea[_0xfe34('0x44')]['length']?_0x16d7ea[_0xfe34('0x44')]:_0x1f463a[_0xfe34('0x3f')];if(!_0x1589f9[_0xfe34('0x43')][_0xfe34('0x46')]('nolimit')){_0x16d7ea[_0xfe34('0x2d')]=qs[_0xfe34('0x2d')](_0x1589f9['query'][_0xfe34('0x2d')]);_0x16d7ea['offset']=qs[_0xfe34('0x2b')](_0x1589f9['query'][_0xfe34('0x2b')]);}_0x16d7ea['order']=qs[_0xfe34('0x47')](_0x1589f9[_0xfe34('0x43')][_0xfe34('0x47')]);_0x16d7ea[_0xfe34('0x48')]=qs[_0xfe34('0x41')](_[_0xfe34('0x49')](_0x1589f9[_0xfe34('0x43')],_0x1f463a['filters']),_0x4c1c71);if(_0x1589f9[_0xfe34('0x43')][_0xfe34('0x4a')]){_0x16d7ea['where']=_[_0xfe34('0x4b')](_0x16d7ea['where'],{'$or':_[_0xfe34('0x3a')](_0x4c1c71,function(_0x7762c7){if(_0x7762c7[_0xfe34('0x3d')]!==_0xfe34('0x4c')){var _0x455563={};_0x455563[_0x7762c7[_0xfe34('0x37')]]={'$like':'%'+_0x1589f9[_0xfe34('0x43')][_0xfe34('0x4a')]+'%'};return _0x455563;}})});}_0x16d7ea=_[_0xfe34('0x4b')]({},_0x16d7ea,_0x1589f9[_0xfe34('0x4d')]);var _0x345985={'where':_0x16d7ea[_0xfe34('0x48')]};return db[_0xfe34('0x4e')][_0xfe34('0x2e')](_0x345985)[_0xfe34('0x33')](function(_0x4dc971){_0xefb472[_0xfe34('0x2e')]=_0x4dc971;if(_0x1589f9['query'][_0xfe34('0x4f')]){_0x16d7ea[_0xfe34('0x50')]=[{'all':!![]}];}return db[_0xfe34('0x4e')]['findAll'](_0x16d7ea);})['then'](function(_0x4707d4){_0xefb472['rows']=_0x4707d4;return _0xefb472;})['then'](respondWithFilteredResult(_0x46c857,_0x16d7ea))[_0xfe34('0x27')](handleError(_0x46c857,null));};exports[_0xfe34('0x51')]=function(_0x1ed876,_0x408390){var _0x510db3={'raw':!![],'where':{'id':_0x1ed876[_0xfe34('0x52')]['id']}},_0x232622={};_0x232622[_0xfe34('0x3f')]=_[_0xfe34('0x40')](db[_0xfe34('0x4e')][_0xfe34('0x3b')]);_0x232622[_0xfe34('0x43')]=_[_0xfe34('0x40')](_0x1ed876['query']);_0x232622[_0xfe34('0x41')]=_[_0xfe34('0x42')](_0x232622[_0xfe34('0x3f')],_0x232622[_0xfe34('0x43')]);_0x510db3['attributes']=_[_0xfe34('0x42')](_0x232622[_0xfe34('0x3f')],qs[_0xfe34('0x45')](_0x1ed876['query']['fields']));_0x510db3['attributes']=_0x510db3[_0xfe34('0x44')][_0xfe34('0x53')]?_0x510db3['attributes']:_0x232622[_0xfe34('0x3f')];if(_0x1ed876['query'][_0xfe34('0x4f')]){_0x510db3[_0xfe34('0x50')]=[{'all':!![]}];}_0x510db3=_[_0xfe34('0x4b')]({},_0x510db3,_0x1ed876[_0xfe34('0x4d')]);return db[_0xfe34('0x4e')]['find'](_0x510db3)[_0xfe34('0x33')](handleEntityNotFound(_0x408390,null))[_0xfe34('0x33')](respondWithResult(_0x408390,null))[_0xfe34('0x27')](handleError(_0x408390,null));};exports[_0xfe34('0x54')]=function(_0x5f3232,_0x56a6dc){return db[_0xfe34('0x4e')][_0xfe34('0x54')](_0x5f3232[_0xfe34('0x55')],{})[_0xfe34('0x33')](respondWithResult(_0x56a6dc,0xc9))['catch'](handleError(_0x56a6dc,null));};exports[_0xfe34('0x56')]=function(_0x450ebe,_0x1ef0eb){if(_0x450ebe[_0xfe34('0x55')]['id']){delete _0x450ebe['body']['id'];}return db[_0xfe34('0x4e')]['find']({'where':{'id':_0x450ebe[_0xfe34('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ef0eb,null))[_0xfe34('0x33')](saveUpdates(_0x450ebe[_0xfe34('0x55')],null))[_0xfe34('0x33')](respondWithResult(_0x1ef0eb,null))[_0xfe34('0x27')](handleError(_0x1ef0eb,null));};exports[_0xfe34('0x34')]=function(_0x249e9a,_0x1cc5bb){return db[_0xfe34('0x4e')]['find']({'where':{'id':_0x249e9a[_0xfe34('0x52')]['id']}})[_0xfe34('0x33')](handleEntityNotFound(_0x1cc5bb,null))[_0xfe34('0x33')](removeEntity(_0x1cc5bb,null))['catch'](handleError(_0x1cc5bb,null));};exports[_0xfe34('0x57')]=function(_0x12e354,_0x4daf0f){return db[_0xfe34('0x4e')]['describe']()['then'](respondWithResult(_0x4daf0f,null))[_0xfe34('0x27')](handleError(_0x4daf0f,null));};var interaction_log=require(_0xfe34('0x58'))(_0xfe34('0x59'));exports[_0xfe34('0x5a')]=function(_0x4042d6,_0x26fe36,_0x3f56b3){var _0x3bc3e8={'agent':{},'channel':_0xfe34('0x5b')};if(_0x4042d6['body']['id']){delete _0x4042d6[_0xfe34('0x55')]['id'];}_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5c')]=!![];_0x4042d6[_0xfe34('0x55')]['readAt']=moment()[_0xfe34('0x5d')](_0xfe34('0x5e'));_0x4042d6['body'][_0xfe34('0x5f')]=_0x4042d6[_0xfe34('0x55')]['UserId']||_0x4042d6[_0xfe34('0x60')]['id'];_0x3bc3e8['agent']['id']=_0x4042d6['body']['UserId'];return db[_0xfe34('0x4e')][_0xfe34('0x61')]({'where':{'id':_0x4042d6[_0xfe34('0x52')]['id'],'UserId':null}})[_0xfe34('0x33')](handleEntityNotFound(_0x26fe36,null))[_0xfe34('0x33')](saveUpdates(_0x4042d6['body'],null))[_0xfe34('0x33')](function(_0x50c798){if(_0x50c798){_0x3bc3e8[_0xfe34('0x25')]=_0x50c798[_0xfe34('0x62')]({'plain':!![]});return db[_0xfe34('0x63')][_0xfe34('0x61')]({'where':{'id':_0x50c798[_0xfe34('0x64')]}});}return null;})[_0xfe34('0x33')](handleEntityNotFound(_0x26fe36,null))[_0xfe34('0x33')](function(_0x428c85){if(_0x428c85){return _0x428c85['update']({'UserId':_0x4042d6['body'][_0xfe34('0x5f')],'read1stAt':_[_0xfe34('0x65')](_0x428c85[_0xfe34('0x66')])?moment()[_0xfe34('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfe34('0x33')](function(_0x2b05dd){if(_0x2b05dd){_0x3bc3e8[_0xfe34('0x67')]=_0x2b05dd[_0xfe34('0x62')]({'plain':!![]});interaction_log[_0xfe34('0x1e')](_0xfe34('0x68'),_0x4042d6[_0xfe34('0x60')]['id'],_0x4042d6[_0xfe34('0x60')]['name'],_0x4042d6[_0xfe34('0x60')]['role'],_0x3bc3e8[_0xfe34('0x67')]['id'],_0x4042d6[_0xfe34('0x55')]?JSON['stringify'](_0x4042d6[_0xfe34('0x55')]):'null');return respondWithRpcPromise(_0xfe34('0x69'),_0xfe34('0x6a'),_0x3bc3e8);}return null;})[_0xfe34('0x33')](function(_0xd55b0a){var _0x2a7724=_0xfe34('0x6b')+_0xd55b0a[_0xfe34('0x25')]['ContactId'];return db[_0xfe34('0x6c')]['query'](_0x2a7724,{'type':db[_0xfe34('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xfe34('0x33')](function(_0x33ee25){return _0x33ee25;});})[_0xfe34('0x33')](function(_0x10385f){if(_0x10385f){_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x6e')]=_0x10385f[0x0];if(!_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5f')])return;return db[_0xfe34('0x6f')][_0xfe34('0x61')]({'where':{'id':_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5f')],'role':_0xfe34('0x70')},'attributes':['id','name',_0xfe34('0x71'),_0xfe34('0x72'),_0xfe34('0x73')],'raw':!![]});}return null;})[_0xfe34('0x33')](function(_0x7b7a1){if(!_0x7b7a1)return null;_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x70')]=_0x7b7a1;return _0x3bc3e8;})[_0xfe34('0x33')](function(_0x543228){if(_0x543228){if(_0x4042d6[_0xfe34('0x55')][_0xfe34('0x74')]){_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x75')]=util[_0xfe34('0x5d')](_0xfe34('0x76'),_0x4042d6['user'][_0xfe34('0x37')]);_0x3bc3e8[_0xfe34('0x25')]['channel']=_0x3bc3e8[_0xfe34('0x77')];_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x78')]=_0x3bc3e8[_0xfe34('0x77')];_0x3bc3e8['message'][_0xfe34('0x79')]=_0xfe34('0x5a');return respondWithRpcPromise(_0xfe34('0x7a'),_0xfe34('0x7a'),{'event':'acceptmessage','message':_0x3bc3e8['message']},client9002)[_0xfe34('0x33')](function(){return _0x3bc3e8;});}return _0x3bc3e8;}return null;})[_0xfe34('0x33')](respondWithResult(_0x26fe36,null))[_0xfe34('0x27')](handleError(_0x26fe36,null));};var interaction_log=require('../../config/logger')(_0xfe34('0x59'));exports[_0xfe34('0x31')]=function(_0x5b51a6,_0x5d5f83,_0x3c9acc){var _0x31d35e={'agent':{},'channel':_0xfe34('0x5b')};if(_0x5b51a6[_0xfe34('0x55')]['id']){delete _0x5b51a6[_0xfe34('0x55')]['id'];}_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')]=_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')]||_0x5b51a6['user']['id'];_0x31d35e[_0xfe34('0x70')]['id']=_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')];return db[_0xfe34('0x4e')][_0xfe34('0x61')]({'where':{'id':_0x5b51a6['params']['id'],'UserId':null}})[_0xfe34('0x33')](handleEntityNotFound(_0x5d5f83,null))[_0xfe34('0x33')](function(_0x2edaf3){if(_0x2edaf3){_0x31d35e[_0xfe34('0x25')]=_0x2edaf3[_0xfe34('0x62')]({'plain':!![]});return db['SmsInteraction'][_0xfe34('0x61')]({'where':{'id':_0x2edaf3[_0xfe34('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x5d5f83,null))['then'](function(_0x33cf98){if(_0x33cf98){_0x31d35e[_0xfe34('0x67')]=_0x33cf98[_0xfe34('0x62')]({'plain':!![]});interaction_log[_0xfe34('0x1e')](_0xfe34('0x7b'),_0x5b51a6[_0xfe34('0x60')]['id'],_0x5b51a6['user']['name'],_0x5b51a6[_0xfe34('0x60')][_0xfe34('0x7c')],_0x31d35e[_0xfe34('0x67')]['id'],_0x5b51a6[_0xfe34('0x55')]?JSON[_0xfe34('0x22')](_0x5b51a6['body']):_0xfe34('0x7d'));return respondWithRpcPromise(_0xfe34('0x7e'),_0xfe34('0x7f'),_0x31d35e);}return null;})['then'](function(_0x176539){var _0x1ff46f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x176539[_0xfe34('0x25')][_0xfe34('0x80')];return db[_0xfe34('0x6c')]['query'](_0x1ff46f,{'type':db[_0xfe34('0x6d')][_0xfe34('0x81')][_0xfe34('0x82')],'raw':!![]})['then'](function(_0x55a509){return _0x55a509;});})['then'](function(_0x48e922){if(_0x48e922){_0x31d35e[_0xfe34('0x25')]['contact']=_0x48e922[0x0];if(!_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')])return;return db[_0xfe34('0x6f')]['find']({'where':{'id':_0x5b51a6['body'][_0xfe34('0x5f')],'role':_0xfe34('0x70')},'attributes':['id',_0xfe34('0x37'),_0xfe34('0x71'),_0xfe34('0x72'),_0xfe34('0x73')],'raw':!![]});}return null;})[_0xfe34('0x33')](function(_0x2188a1){if(!_0x2188a1)return null;_0x31d35e['message'][_0xfe34('0x70')]=_0x2188a1;return _0x31d35e;})[_0xfe34('0x33')](function(_0xc857da){if(_0xc857da){_0xc857da[_0xfe34('0x25')][_0xfe34('0x75')]=util[_0xfe34('0x5d')](_0xfe34('0x76'),_0x5b51a6[_0xfe34('0x60')][_0xfe34('0x37')]);_0xc857da[_0xfe34('0x25')]['channel']=_0x31d35e['channel'];_0xc857da[_0xfe34('0x25')][_0xfe34('0x78')]=_0x31d35e['channel'];_0xc857da[_0xfe34('0x25')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xfe34('0x83'),'message':_0xc857da['message']},client9002);return _0x31d35e;}return null;})[_0xfe34('0x33')](respondWithResult(_0x5d5f83,null))[_0xfe34('0x27')](handleError(_0x5d5f83,null));};exports[_0xfe34('0x29')]=function(_0x36f3d8,_0x31cd81,_0x1fd630){if(_0x36f3d8[_0xfe34('0x55')]['id']){delete _0x36f3d8['body']['id'];}var _0x39dc30;return db['SmsMessage']['find']({'where':{'id':_0x36f3d8[_0xfe34('0x52')]['id']}})[_0xfe34('0x33')](handleEntityNotFound(_0x31cd81,null))[_0xfe34('0x33')](function(_0x1ea241){if(_0x1ea241){_0x39dc30=_0x1ea241;return db['SmsAccount'][_0xfe34('0x61')]({'where':{'id':_0x1ea241[_0xfe34('0x84')]}});}})[_0xfe34('0x33')](handleEntityNotFound(_0x31cd81,null))['then'](function(_0x46980f){if(_0x46980f){logger[_0xfe34('0x21')](_0xfe34('0x85'),_0xfe34('0x29'),'received\x20delivery\x20report\x20from',_0x46980f[_0xfe34('0x3d')],util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));switch(_0x46980f[_0xfe34('0x3d')]){case _0xfe34('0x87'):if(_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x88')]&&_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x88')]===_0x39dc30['messageId']){return _0x39dc30[_0xfe34('0x56')]({'read':!![]});}else{logger[_0xfe34('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe34('0x29'),'twilio',util['inspect'](_0x36f3d8['body'],{'showHidden':![],'depth':null}));}break;case _0xfe34('0x89'):if(_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x8a')]&&_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x8a')]===_0x39dc30[_0xfe34('0x8b')]&&_['indexOf'](['sent',_0xfe34('0x8c')],_0x36f3d8['body'][_0xfe34('0x8d')])>=0x0){return _0x39dc30[_0xfe34('0x56')]({'read':!![]});}else{logger[_0xfe34('0x23')](_0xfe34('0x8e'),_0xfe34('0x29'),_0xfe34('0x8f'),util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3556a0=_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x90')][0x0];if(_0x3556a0['status'][_0xfe34('0x91')]==='DELIVERED'){return _0x39dc30['update']({'read':!![]});}else{logger[_0xfe34('0x23')](_0xfe34('0x8e'),_0xfe34('0x29'),'infobip',util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x39dc30;}})['then'](respondWithResult(_0x31cd81,null))[_0xfe34('0x27')](handleError(_0x31cd81,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a489237..7bf270e 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 _0x7b81=['SmsMessage','setMaxListeners','remove','emit','exports','events'];(function(_0x3bdde7,_0x5949fd){var _0xf94a37=function(_0x588c7b){while(--_0x588c7b){_0x3bdde7['push'](_0x3bdde7['shift']());}};_0xf94a37(++_0x5949fd);}(_0x7b81,0x7d));var _0x17b8=function(_0x571d70,_0x311888){_0x571d70=_0x571d70-0x0;var _0x48f094=_0x7b81[_0x571d70];return _0x48f094;};'use strict';var EventEmitter=require(_0x17b8('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x17b8('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x17b8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x17b8('0x3')};function emitEvent(_0x3dcac9){return function(_0x25a451,_0x1f76ce,_0x3a4504){SmsMessageEvents['emit'](_0x3dcac9+':'+_0x25a451['id'],_0x25a451);SmsMessageEvents[_0x17b8('0x4')](_0x3dcac9,_0x25a451);_0x3a4504(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x17b8('0x5')]=SmsMessageEvents; \ No newline at end of file +var _0x5eb0=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x30da4f,_0xc61977){var _0x370dac=function(_0xf16d8c){while(--_0xf16d8c){_0x30da4f['push'](_0x30da4f['shift']());}};_0x370dac(++_0xc61977);}(_0x5eb0,0x82));var _0x05eb=function(_0x4ad476,_0x1345c3){_0x4ad476=_0x4ad476-0x0;var _0x5adea9=_0x5eb0[_0x4ad476];return _0x5adea9;};'use strict';var EventEmitter=require(_0x05eb('0x0'));var SmsMessage=require(_0x05eb('0x1'))['db'][_0x05eb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x05eb('0x3')](0x0);var events={'afterCreate':_0x05eb('0x4'),'afterUpdate':_0x05eb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x396b95){return function(_0x1efd51,_0x1c7b21,_0x40da63){SmsMessageEvents[_0x05eb('0x6')](_0x396b95+':'+_0x1efd51['id'],_0x1efd51);SmsMessageEvents[_0x05eb('0x6')](_0x396b95,_0x1efd51);_0x40da63(null);};}for(var e in events){if(events[_0x05eb('0x7')](e)){var event=events[e];SmsMessage[_0x05eb('0x8')](e,emitEvent(event));}}module[_0x05eb('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index dfed329..88da22b 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 _0xbe65=['twilio','accountSid','authToken','phone','messages','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','body','smsMethod','sender','login?username=','username','&password=','GET','split','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','message_id','update','clickSend','plivo','remote','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','error','out','SmsAccount','SmsAccountId','type'];(function(_0x3cf772,_0x31e205){var _0x4dfa3b=function(_0x581928){while(--_0x581928){_0x3cf772['push'](_0x3cf772['shift']());}};_0x4dfa3b(++_0x31e205);}(_0xbe65,0xd3));var _0x5be6=function(_0x30b710,_0x4477d1){_0x30b710=_0x30b710-0x0;var _0x205edf=_0xbe65[_0x30b710];return _0x205edf;};'use strict';var _=require(_0x5be6('0x0'));var util=require(_0x5be6('0x1'));var logger=require(_0x5be6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5be6('0x3'));var config=require(_0x5be6('0x4'));var attributes=require(_0x5be6('0x5'));module[_0x5be6('0x6')]=function(_0x710848,_0x4aea05){return _0x710848[_0x5be6('0x7')](_0x5be6('0x8'),attributes,{'tableName':_0x5be6('0x9'),'paranoid':![],'indexes':[{'name':_0x5be6('0xa'),'fields':[_0x5be6('0xa')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x5be6('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a9dab,_0x5c9441,_0x29e0e0){var _0x505bc5=_0x710848[_0x5be6('0xc')];var _0x200f09=_0x5a9dab[_0x5be6('0xd')]({'plain':!![]});if(_0x200f09[_0x5be6('0xe')][_0x5be6('0xf')]()==='in'||_0x200f09[_0x5be6('0xe')]['toLowerCase']()==='out'&&!_0x200f09[_0x5be6('0x10')]&&!_[_0x5be6('0x11')](_0x200f09[_0x5be6('0x12')])&&!_['isNil'](_0x200f09[_0x5be6('0x13')])){_0x505bc5[_0x5be6('0x14')][_0x5be6('0x15')]({'where':{'id':_0x200f09[_0x5be6('0x13')]}})[_0x5be6('0x16')](function(_0x3253e9){if(_0x3253e9){_0x3253e9['update']({'lastMsgAt':_0x200f09[_0x5be6('0x17')],'lastMsgDirection':_0x200f09[_0x5be6('0xe')][_0x5be6('0xf')]()});}})['catch'](function(_0x44ca5a){console[_0x5be6('0x18')](_0x44ca5a);});}if(_0x200f09['direction']===_0x5be6('0x19')&&!_0x200f09[_0x5be6('0x10')]){var _0x1f249d;_0x505bc5[_0x5be6('0x1a')]['find']({'where':{'id':_0x200f09[_0x5be6('0x1b')]},'raw':!![]})[_0x5be6('0x16')](function(_0x1d7b46){_0x1f249d=_0x1d7b46;if(_0x1f249d&&_0x1f249d[_0x5be6('0x1c')]){switch(_0x1f249d[_0x5be6('0x1c')]){case _0x5be6('0x1d'):var _0x9ed977=require('twilio');if(_0x1f249d[_0x5be6('0x1e')]&&_0x1f249d[_0x5be6('0x1f')]&&_0x1f249d[_0x5be6('0x20')]){var _0x30bb2e=new _0x9ed977(_0x1f249d['accountSid'],_0x1f249d[_0x5be6('0x1f')]);_0x30bb2e[_0x5be6('0x21')]['create']({'body':_0x200f09['body'],'to':_0x200f09[_0x5be6('0x20')],'from':_0x1f249d[_0x5be6('0x20')],'statusCallback':_0x1f249d['remote']+_0x5be6('0x22')+_0x200f09['id']+_0x5be6('0x23')+_0x1f249d[_0x5be6('0x24')]})['then'](function(_0x3c1c79){if(_0x3c1c79[_0x5be6('0x25')]){return _0x5a9dab['update']({'messageId':_0x3c1c79[_0x5be6('0x25')]});}})[_0x5be6('0x26')](function(_0x287d17){logger[_0x5be6('0x18')](_0x5be6('0x27'),'afterCreate',_0x5be6('0x1d'),util['inspect'](_0x287d17,{'showHidden':![],'depth':null}));});}else{logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x5be6('0x29'):var _0x4b5364=_0x5be6('0x2a');if(_0x1f249d['username']&&_0x1f249d[_0x5be6('0x2b')]){var _0x262959={'recipient':[_0x200f09[_0x5be6('0x20')]],'message':_0x200f09[_0x5be6('0x2c')],'message_type':_0x1f249d[_0x5be6('0x2d')]};if(_0x1f249d[_0x5be6('0x2d')]&&_0x1f249d[_0x5be6('0x2d')]!=='SI'){_0x262959[_0x5be6('0x2e')]=_0x1f249d[_0x5be6('0x20')];}var _0x5ac63b={'url':_0x4b5364+_0x5be6('0x2f')+_0x1f249d[_0x5be6('0x30')]+_0x5be6('0x31')+_0x1f249d[_0x5be6('0x2b')],'method':_0x5be6('0x32')};rp(_0x5ac63b)[_0x5be6('0x16')](function(_0x2733e7){var _0x14df97=_0x2733e7[_0x5be6('0x33')](';');var _0xf0104a={'user_key':_0x14df97[0x0],'session_key':_0x14df97[0x1]};_0x5ac63b={'url':_0x4b5364+'sms','method':_0x5be6('0x34'),'headers':{'user_key':_0xf0104a['user_key'],'Session_key':_0xf0104a[_0x5be6('0x35')]},'json':!![],'body':_0x262959};return rp(_0x5ac63b);})['then'](function(_0x20ca75){if(_0x20ca75[_0x5be6('0x36')]>=0x1){var _0x3b62f4={'messageId':_0x20ca75[_0x5be6('0x37')]};if(_0x1f249d[_0x5be6('0x2d')]!=='GP'||!_0x1f249d[_0x5be6('0x38')]){_0x3b62f4[_0x5be6('0x39')]=!![];}return _0x5a9dab['update'](_0x3b62f4);}else{return logger['error'](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x29'),util['inspect'](_0x20ca75,{'showHidden':![],'depth':null}));}})[_0x5be6('0x26')](function(_0x55c6be){return logger[_0x5be6('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5be6('0x28'),_0x5be6('0x29'),util[_0x5be6('0x3a')](_0x55c6be,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5be6('0x27'),'afterCreate',_0x5be6('0x29'),_0x5be6('0x3b'));}break;case _0x5be6('0x3c'):if(_0x1f249d[_0x5be6('0x1f')]){var _0x9e7ceb={'recipient':_0x200f09[_0x5be6('0x20')],'message':_0x200f09['body'],'sender':_0x1f249d[_0x5be6('0x3d')]||_0x1f249d[_0x5be6('0x20')],'authorization':_0x1f249d[_0x5be6('0x1f')]};var _0x5c9441={'method':_0x5be6('0x34'),'uri':_0x5be6('0x3e'),'body':_0x9e7ceb,'json':!![]};rp(_0x5c9441)[_0x5be6('0x16')](function(_0x1a40b6){var _0x143991={'messageId':_0x1a40b6[_0x5be6('0x3f')]};if(!_0x1f249d[_0x5be6('0x38')]){_0x143991[_0x5be6('0x39')]=!![];}return _0x5a9dab['update'](_0x143991);})[_0x5be6('0x26')](function(_0x43c237){logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x3c'),util['inspect'](_0x43c237,{'showHidden':![],'depth':null}));});}else{logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0x5be6('0x40'):if(_0x1f249d[_0x5be6('0x30')]&&_0x1f249d[_0x5be6('0x2b')]){var _0x9e7ceb={'messages':[{'source':_0x5be6('0x41'),'to':_0x200f09['phone'],'body':_0x200f09[_0x5be6('0x2c')],'from':_0x1f249d[_0x5be6('0x3d')]||_0x1f249d[_0x5be6('0x20')]}]};var _0xe85f7c=util[_0x5be6('0x42')]('%s:%s',_0x1f249d[_0x5be6('0x30')],_0x1f249d[_0x5be6('0x2b')]);var _0x5c9441={'method':_0x5be6('0x34'),'uri':_0x5be6('0x43'),'body':_0x9e7ceb,'headers':{'Authorization':util[_0x5be6('0x42')](_0x5be6('0x44'),new Buffer(_0xe85f7c)[_0x5be6('0x45')]('base64'))},'json':!![]};rp(_0x5c9441)['then'](function(_0x436a02){if(_0x436a02['http_code']>=0xc8&&_0x436a02[_0x5be6('0x46')]<=0xce){if(_0x436a02[_0x5be6('0x47')]&&_0x436a02[_0x5be6('0x47')]['queued_count']>0x0){var _0x49d74c=_[_0x5be6('0x48')](_0x436a02[_0x5be6('0x47')]['messages']);var _0x9b194d={'messageId':_0x49d74c[_0x5be6('0x49')]};if(!_0x1f249d[_0x5be6('0x38')]){_0x9b194d[_0x5be6('0x39')]=!![];}return _0x5a9dab[_0x5be6('0x4a')](_0x9b194d);}else{logger[_0x5be6('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5be6('0x28'),_0x5be6('0x4b'),util[_0x5be6('0x3a')](_0x436a02,{'showHidden':![],'depth':null}));}}else{logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x4b'),util[_0x5be6('0x3a')](_0x436a02,{'showHidden':![],'depth':null}));}})[_0x5be6('0x26')](function(_0x19d1c8){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5be6('0x4b'),util[_0x5be6('0x3a')](_0x19d1c8,{'showHidden':![],'depth':null}));});}else{logger[_0x5be6('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5be6('0x4b'),_0x5be6('0x3b'));}break;case _0x5be6('0x4c'):if(_0x1f249d['authId']&&_0x1f249d[_0x5be6('0x1f')]){var _0x9e7ceb={'dst':_0x200f09[_0x5be6('0x20')],'text':_0x200f09[_0x5be6('0x2c')],'src':_0x1f249d[_0x5be6('0x3d')]||_0x1f249d[_0x5be6('0x20')],'url':_0x1f249d[_0x5be6('0x4d')]+_0x5be6('0x22')+_0x200f09['id']+_0x5be6('0x23')+_0x1f249d['token']};var _0xe85f7c=util[_0x5be6('0x42')](_0x5be6('0x4e'),_0x1f249d[_0x5be6('0x4f')],_0x1f249d[_0x5be6('0x1f')]);var _0x5c9441={'method':_0x5be6('0x34'),'uri':util[_0x5be6('0x42')](_0x5be6('0x50'),_0x1f249d[_0x5be6('0x4f')]),'body':_0x9e7ceb,'headers':{'Authorization':util['format'](_0x5be6('0x44'),new Buffer(_0xe85f7c)[_0x5be6('0x45')](_0x5be6('0x51')))},'json':!![]};rp(_0x5c9441)['then'](function(_0x5d8fd4){var _0x155290={'messageId':_0x5d8fd4[_0x5be6('0x52')][0x0]};return _0x5a9dab[_0x5be6('0x4a')](_0x155290);})[_0x5be6('0x26')](function(_0x170489){logger['error'](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x4c'),util[_0x5be6('0x3a')](_0x170489,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x5be6('0x53'):if(_0x1f249d[_0x5be6('0x30')]&&_0x1f249d['password']){if(_0x1f249d[_0x5be6('0x54')]){var _0x1556bd={'method':_0x5be6('0x34'),'uri':_0x1f249d[_0x5be6('0x54')]+_0x5be6('0x55'),'body':{'username':_0x1f249d['username'],'password':_0x1f249d[_0x5be6('0x2b')]},'json':!![]};return rp(_0x1556bd)[_0x5be6('0x16')](function(_0x115bbb){var _0x48ce0d={'method':_0x5be6('0x34'),'uri':_0x1f249d[_0x5be6('0x54')]+_0x5be6('0x56'),'body':{'messages':[{'from':_0x1f249d[_0x5be6('0x20')],'destinations':[{'to':_0x200f09[_0x5be6('0x20')]}],'text':_0x200f09[_0x5be6('0x2c')],'notifyUrl':_0x1f249d['remote']+'/api/sms/messages/'+_0x200f09['id']+'/status?token='+_0x1f249d[_0x5be6('0x24')],'notifyContentType':_0x5be6('0x57'),'callbackData':_0x1f249d[_0x5be6('0x20')]+';'+_0x200f09['body']}]},'headers':{'Authorization':_0x5be6('0x58')+_0x115bbb[_0x5be6('0x24')]},'json':!![]};return rp(_0x48ce0d)[_0x5be6('0x16')](function(_0x4edb7c){if(_0x4edb7c['messages']){var _0x108769={'messageId':_0x4edb7c['messages'][0x0][_0x5be6('0xa')]};if(!_0x1f249d[_0x5be6('0x38')]){_0x108769['read']=!![];}return _0x5a9dab['update'](_0x108769);}else{return logger[_0x5be6('0x18')](_0x5be6('0x27'),'afterCreate',_0x5be6('0x53'),util[_0x5be6('0x3a')](_0x4edb7c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4eaa54){return logger[_0x5be6('0x18')](_0x5be6('0x27'),'afterCreate','infobip',util[_0x5be6('0x3a')](_0x4eaa54,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5be6('0x27'),'afterCreate','infobip',_0x5be6('0x59'));}}else{logger[_0x5be6('0x18')](_0x5be6('0x27'),'afterCreate',_0x5be6('0x53'),_0x5be6('0x3b'));}break;case _0x5be6('0x5a'):var _0x23035e=require('crypto');if(_0x1f249d[_0x5be6('0x5b')]){var _0x36df73={};_0x36df73[_0x5be6('0x5c')]=_0x1f249d['username'];_0x36df73[_0x5be6('0x20')]=_0x200f09[_0x5be6('0x20')];_0x36df73[_0x5be6('0x2e')]=_0x1f249d[_0x5be6('0x20')];_0x36df73[_0x5be6('0x5d')]=_0x200f09['body'];_0x36df73[_0x5be6('0x5e')]=+new Date();var _0x3ca5a5='';var _0x345812='';var _0x42d6fb=Object[_0x5be6('0x5f')](_0x36df73);_0x42d6fb[_0x5be6('0x60')]();for(var _0x51678f=0x0;_0x51678f<_0x42d6fb[_0x5be6('0x61')];_0x51678f++){if(_0x3ca5a5!=''){_0x3ca5a5+='&';}_0x3ca5a5+=_0x42d6fb[_0x51678f]+'='+encodeURIComponent(_0x36df73[_0x42d6fb[_0x51678f]]);_0x345812+=_0x36df73[_0x42d6fb[_0x51678f]];}_0x345812+=_0x1f249d['apiKey'];_0x345812=_0x23035e[_0x5be6('0x62')](_0x5be6('0x63'))['update'](_0x345812)[_0x5be6('0x64')]('hex');if(_0x3ca5a5!==''){_0x3ca5a5+='&';}_0x3ca5a5+=_0x5be6('0x65')+_0x345812;var _0x5ac63b={'method':_0x5be6('0x32'),'uri':_0x1f249d['baseUrl']+_0x5be6('0x66')+_0x3ca5a5,'json':!![]};return rp(_0x5ac63b)['then'](function(_0x5aedec){var _0x29dbbb=Object[_0x5be6('0x5f')](_0x5aedec);if(_0x5aedec[_0x29dbbb[0x0]][_0x5be6('0x18')]&&parseInt(_0x5aedec[_0x29dbbb[0x0]]['error'])===0x0){var _0x53491c={'messageId':_0x5aedec[_0x29dbbb[0x0]]['id_sms']};if(!_0x1f249d[_0x5be6('0x38')]){_0x53491c[_0x5be6('0x39')]=!![];}return _0x5a9dab[_0x5be6('0x4a')](_0x53491c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5be6('0x5a'),util[_0x5be6('0x3a')](_0x5aedec[_0x5be6('0x18')],{'showHidden':![],'depth':null}));}})[_0x5be6('0x26')](function(_0x5e1e1c){return logger[_0x5be6('0x18')](_0x5be6('0x27'),'afterCreate',_0x5be6('0x5a'),util['inspect'](_0x5e1e1c,{'showHidden':![],'depth':null}));});}else{logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0x5be6('0x67'):if(_0x1f249d['apiKey']){var _0x1e1d59={'method':_0x5be6('0x34'),'uri':_0x5be6('0x68'),'headers':{'Authorization':_0x1f249d[_0x5be6('0x5b')]},'body':{'content':_0x200f09[_0x5be6('0x2c')],'to':[_0x200f09[_0x5be6('0x20')]],'from':_0x1f249d[_0x5be6('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0x5be6('0x69')},'json':!![]};rp(_0x1e1d59)[_0x5be6('0x16')](function(_0xdeb255){if(!_0xdeb255[_0x5be6('0x18')]){var _0x46ce82={'messageId':_0xdeb255[_0x5be6('0x21')][0x0][_0x5be6('0x6a')]};if(!_0x1f249d[_0x5be6('0x38')]){_0x46ce82[_0x5be6('0x39')]=!![];}return _0x5a9dab[_0x5be6('0x4a')](_0x46ce82);}else{return logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x67'),util['inspect'](_0xdeb255[_0x5be6('0x18')],{'showHidden':![],'depth':null}));}})[_0x5be6('0x26')](function(_0x1ce735){return logger[_0x5be6('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5be6('0x28'),_0x5be6('0x67'),util['inspect'](_0x1ce735,{'showHidden':![],'depth':null}));});}else{logger[_0x5be6('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',_0x5be6('0x6b'));}break;case _0x5be6('0x6c'):if(_0x1f249d[_0x5be6('0x30')]&&_0x1f249d['password']){var _0xe85f7c=util[_0x5be6('0x42')](_0x5be6('0x4e'),_0x1f249d[_0x5be6('0x30')],_0x1f249d[_0x5be6('0x2b')]);var _0x5c9441={'method':_0x5be6('0x34'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1f249d[_0x5be6('0x6d')]+_0x5be6('0x6e'),'body':{'to':[_0x200f09['phone']],'text':_0x200f09[_0x5be6('0x2c')],'from':_0x1f249d[_0x5be6('0x20')],'applicationId':_0x1f249d['applicationId']},'headers':{'Authorization':util[_0x5be6('0x42')](_0x5be6('0x44'),new Buffer(_0xe85f7c)[_0x5be6('0x45')](_0x5be6('0x51')))},'json':!![]};rp(_0x5c9441)[_0x5be6('0x16')](function(_0x40de28){if(_0x40de28['id']){var _0x27cbaa={'messageId':_0x40de28['id']};return _0x5a9dab[_0x5be6('0x4a')](_0x27cbaa);}else{logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x6c'),util[_0x5be6('0x3a')](_0x40de28,{'showHidden':![],'depth':null}));}})[_0x5be6('0x26')](function(_0x5c8d15){logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x6c'),util[_0x5be6('0x3a')](_0x5c8d15,{'showHidden':![],'depth':null}));});}else{logger[_0x5be6('0x18')](_0x5be6('0x27'),'afterCreate','bandwidth',_0x5be6('0x3b'));}break;case _0x5be6('0x6f'):if(_0x1f249d[_0x5be6('0x5b')]){var _0x67d7d4={};var _0x5ac63b={'method':_0x5be6('0x34'),'uri':_0x5be6('0x70'),'headers':{'Authorization':_0x5be6('0x71')+_0x1f249d[_0x5be6('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x1f249d[_0x5be6('0x20')],'to':_0x200f09[_0x5be6('0x20')],'text':_0x200f09[_0x5be6('0x2c')]},'json':!![]};return rp(_0x5ac63b)[_0x5be6('0x16')](function(_0x319b4b){if(_0x319b4b[_0x5be6('0x72')]==0xca){_0x67d7d4[_0x5be6('0x73')]=_0x319b4b;var _0x560212={'method':_0x5be6('0x34'),'uri':_0x5be6('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x1f249d['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x67d7d4['message']['refid']},'json':!![]};return rp(_0x560212)[_0x5be6('0x16')](function(_0x209a98){_0x67d7d4[_0x5be6('0x75')]=_0x209a98;var _0x56b729={'messageId':_0x67d7d4[_0x5be6('0x73')]['refid'],'read':!![]};return _0x5a9dab['update'](_0x56b729);});}else{return logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),_0x5be6('0x6f'),util['inspect'](_0x319b4b,{'showHidden':![],'depth':null}));}})[_0x5be6('0x26')](function(_0x1be259){return logger[_0x5be6('0x18')](_0x5be6('0x27'),_0x5be6('0x28'),'intelepeer',util[_0x5be6('0x3a')](_0x1be259,{'showHidden':![],'depth':null}));});}else{return logger[_0x5be6('0x18')](_0x5be6('0x27'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0x5be6('0x76')](function(){_0x29e0e0();});}else{_0x29e0e0();}}},'charset':'utf8mb4','collate':_0x5be6('0x77')});}; \ No newline at end of file +var _0x976b=['/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','apiKey','text','timestamp','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','uuid','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','intelepeer','finally','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','error','out','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','remote','/status?token=','token','sid','catch','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','POST','session_key','total_sent','internal_order_id','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId'];(function(_0x2b92b7,_0x221988){var _0x8e2195=function(_0x4dd094){while(--_0x4dd094){_0x2b92b7['push'](_0x2b92b7['shift']());}};_0x8e2195(++_0x221988);}(_0x976b,0x117));var _0xb976=function(_0x5f3d47,_0x2329b8){_0x5f3d47=_0x5f3d47-0x0;var _0x42a103=_0x976b[_0x5f3d47];return _0x42a103;};'use strict';var _=require(_0xb976('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb976('0x1'));var moment=require(_0xb976('0x2'));var BPromise=require(_0xb976('0x3'));var rp=require(_0xb976('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb976('0x5'));var config=require('../../config/environment');var attributes=require(_0xb976('0x6'));module[_0xb976('0x7')]=function(_0x5362cf,_0x429fc6){return _0x5362cf['define'](_0xb976('0x8'),attributes,{'tableName':_0xb976('0x9'),'paranoid':![],'indexes':[{'name':_0xb976('0xa'),'fields':[_0xb976('0xa')]},{'name':_0xb976('0xb'),'fields':['body'],'type':_0xb976('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x334204,_0x14739f,_0x461d00){var _0x28ebed=_0x5362cf[_0xb976('0xd')];var _0x568062=_0x334204[_0xb976('0xe')]({'plain':!![]});if(_0x568062[_0xb976('0xf')][_0xb976('0x10')]()==='in'||_0x568062['direction'][_0xb976('0x10')]()==='out'&&!_0x568062[_0xb976('0x11')]&&!_[_0xb976('0x12')](_0x568062[_0xb976('0x13')])&&!_['isNil'](_0x568062[_0xb976('0x14')])){_0x28ebed['SmsInteraction'][_0xb976('0x15')]({'where':{'id':_0x568062[_0xb976('0x14')]}})[_0xb976('0x16')](function(_0x253d54){if(_0x253d54){_0x253d54[_0xb976('0x17')]({'lastMsgAt':_0x568062[_0xb976('0x18')],'lastMsgDirection':_0x568062[_0xb976('0xf')][_0xb976('0x10')]()});}})['catch'](function(_0x30d2b6){console[_0xb976('0x19')](_0x30d2b6);});}if(_0x568062[_0xb976('0xf')]===_0xb976('0x1a')&&!_0x568062['secret']){var _0x320bdc;_0x28ebed['SmsAccount'][_0xb976('0x1b')]({'where':{'id':_0x568062[_0xb976('0x1c')]},'raw':!![]})[_0xb976('0x16')](function(_0x41dbfc){_0x320bdc=_0x41dbfc;if(_0x320bdc&&_0x320bdc['type']){switch(_0x320bdc[_0xb976('0x1d')]){case _0xb976('0x1e'):var _0x404527=require('twilio');if(_0x320bdc[_0xb976('0x1f')]&&_0x320bdc[_0xb976('0x20')]&&_0x320bdc['phone']){var _0x5291c4=new _0x404527(_0x320bdc[_0xb976('0x1f')],_0x320bdc[_0xb976('0x20')]);_0x5291c4[_0xb976('0x21')][_0xb976('0x22')]({'body':_0x568062[_0xb976('0x23')],'to':_0x568062[_0xb976('0x24')],'from':_0x320bdc[_0xb976('0x24')],'statusCallback':_0x320bdc[_0xb976('0x25')]+'/api/sms/messages/'+_0x568062['id']+_0xb976('0x26')+_0x320bdc[_0xb976('0x27')]})[_0xb976('0x16')](function(_0x1d3955){if(_0x1d3955[_0xb976('0x28')]){return _0x334204['update']({'messageId':_0x1d3955[_0xb976('0x28')]});}})[_0xb976('0x29')](function(_0x401fa1){logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb976('0x1e'),util[_0xb976('0x2a')](_0x401fa1,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),_0xb976('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xb976('0x2c'):var _0x3fc788=_0xb976('0x2d');if(_0x320bdc['username']&&_0x320bdc[_0xb976('0x2e')]){var _0xb2517d={'recipient':[_0x568062['phone']],'message':_0x568062['body'],'message_type':_0x320bdc['smsMethod']};if(_0x320bdc[_0xb976('0x2f')]&&_0x320bdc[_0xb976('0x2f')]!=='SI'){_0xb2517d[_0xb976('0x30')]=_0x320bdc['phone'];}var _0x591ea9={'url':_0x3fc788+_0xb976('0x31')+_0x320bdc[_0xb976('0x32')]+_0xb976('0x33')+_0x320bdc[_0xb976('0x2e')],'method':_0xb976('0x34')};rp(_0x591ea9)[_0xb976('0x16')](function(_0x346b7b){var _0x5551c8=_0x346b7b['split'](';');var _0xfcd38b={'user_key':_0x5551c8[0x0],'session_key':_0x5551c8[0x1]};_0x591ea9={'url':_0x3fc788+'sms','method':_0xb976('0x35'),'headers':{'user_key':_0xfcd38b['user_key'],'Session_key':_0xfcd38b[_0xb976('0x36')]},'json':!![],'body':_0xb2517d};return rp(_0x591ea9);})[_0xb976('0x16')](function(_0x2bffa4){if(_0x2bffa4[_0xb976('0x37')]>=0x1){var _0x36e033={'messageId':_0x2bffa4[_0xb976('0x38')]};if(_0x320bdc['smsMethod']!=='GP'||!_0x320bdc[_0xb976('0x39')]){_0x36e033[_0xb976('0x3a')]=!![];}return _0x334204[_0xb976('0x17')](_0x36e033);}else{return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x2c'),util[_0xb976('0x2a')](_0x2bffa4,{'showHidden':![],'depth':null}));}})['catch'](function(_0x247ceb){return logger['error'](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x2c'),util[_0xb976('0x2a')](_0x247ceb,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x2c'),_0xb976('0x3c'));}break;case _0xb976('0x3d'):if(_0x320bdc[_0xb976('0x20')]){var _0x1f4568={'recipient':_0x568062[_0xb976('0x24')],'message':_0x568062[_0xb976('0x23')],'sender':_0x320bdc[_0xb976('0x3e')]||_0x320bdc[_0xb976('0x24')],'authorization':_0x320bdc[_0xb976('0x20')]};var _0x14739f={'method':_0xb976('0x35'),'uri':_0xb976('0x3f'),'body':_0x1f4568,'json':!![]};rp(_0x14739f)['then'](function(_0x1052c3){var _0x14b14f={'messageId':_0x1052c3[_0xb976('0x40')]};if(!_0x320bdc['deliveryReport']){_0x14b14f[_0xb976('0x3a')]=!![];}return _0x334204['update'](_0x14b14f);})[_0xb976('0x29')](function(_0x90e9a5){logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x3d'),util[_0xb976('0x2a')](_0x90e9a5,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x3d'),_0xb976('0x41'));}break;case _0xb976('0x42'):if(_0x320bdc[_0xb976('0x32')]&&_0x320bdc[_0xb976('0x2e')]){var _0x1f4568={'messages':[{'source':_0xb976('0x43'),'to':_0x568062[_0xb976('0x24')],'body':_0x568062[_0xb976('0x23')],'from':_0x320bdc[_0xb976('0x3e')]||_0x320bdc[_0xb976('0x24')]}]};var _0x5de74c=util[_0xb976('0x44')](_0xb976('0x45'),_0x320bdc[_0xb976('0x32')],_0x320bdc[_0xb976('0x2e')]);var _0x14739f={'method':_0xb976('0x35'),'uri':_0xb976('0x46'),'body':_0x1f4568,'headers':{'Authorization':util[_0xb976('0x44')](_0xb976('0x47'),new Buffer(_0x5de74c)['toString'](_0xb976('0x48')))},'json':!![]};rp(_0x14739f)[_0xb976('0x16')](function(_0x4e20eb){if(_0x4e20eb['http_code']>=0xc8&&_0x4e20eb[_0xb976('0x49')]<=0xce){if(_0x4e20eb[_0xb976('0x4a')]&&_0x4e20eb[_0xb976('0x4a')][_0xb976('0x4b')]>0x0){var _0x4638ac=_[_0xb976('0x4c')](_0x4e20eb[_0xb976('0x4a')][_0xb976('0x21')]);var _0x423151={'messageId':_0x4638ac[_0xb976('0x4d')]};if(!_0x320bdc[_0xb976('0x39')]){_0x423151[_0xb976('0x3a')]=!![];}return _0x334204[_0xb976('0x17')](_0x423151);}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),'clickSend',util[_0xb976('0x2a')](_0x4e20eb,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xb976('0x3b'),'afterCreate',_0xb976('0x4e'),util[_0xb976('0x2a')](_0x4e20eb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x455bc2){logger[_0xb976('0x19')](_0xb976('0x3b'),'afterCreate',_0xb976('0x4e'),util[_0xb976('0x2a')](_0x455bc2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x4e'),_0xb976('0x3c'));}break;case _0xb976('0x4f'):if(_0x320bdc[_0xb976('0x50')]&&_0x320bdc[_0xb976('0x20')]){var _0x1f4568={'dst':_0x568062[_0xb976('0x24')],'text':_0x568062[_0xb976('0x23')],'src':_0x320bdc['senderString']||_0x320bdc[_0xb976('0x24')],'url':_0x320bdc[_0xb976('0x25')]+_0xb976('0x51')+_0x568062['id']+'/status?token='+_0x320bdc['token']};var _0x5de74c=util[_0xb976('0x44')]('%s:%s',_0x320bdc[_0xb976('0x50')],_0x320bdc['authToken']);var _0x14739f={'method':'POST','uri':util[_0xb976('0x44')](_0xb976('0x52'),_0x320bdc[_0xb976('0x50')]),'body':_0x1f4568,'headers':{'Authorization':util[_0xb976('0x44')](_0xb976('0x47'),new Buffer(_0x5de74c)[_0xb976('0x53')]('base64'))},'json':!![]};rp(_0x14739f)[_0xb976('0x16')](function(_0x34f5a7){var _0x2a652b={'messageId':_0x34f5a7[_0xb976('0x54')][0x0]};return _0x334204[_0xb976('0x17')](_0x2a652b);})['catch'](function(_0x4809cf){logger['error'](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x4f'),util[_0xb976('0x2a')](_0x4809cf,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x4f'),_0xb976('0x55'));}break;case _0xb976('0x56'):if(_0x320bdc[_0xb976('0x32')]&&_0x320bdc['password']){if(_0x320bdc[_0xb976('0x57')]){var _0x43fe30={'method':'POST','uri':_0x320bdc['baseUrl']+_0xb976('0x58'),'body':{'username':_0x320bdc['username'],'password':_0x320bdc[_0xb976('0x2e')]},'json':!![]};return rp(_0x43fe30)['then'](function(_0x5f22ee){var _0x518884={'method':_0xb976('0x35'),'uri':_0x320bdc['baseUrl']+_0xb976('0x59'),'body':{'messages':[{'from':_0x320bdc[_0xb976('0x24')],'destinations':[{'to':_0x568062['phone']}],'text':_0x568062[_0xb976('0x23')],'notifyUrl':_0x320bdc[_0xb976('0x25')]+_0xb976('0x51')+_0x568062['id']+_0xb976('0x26')+_0x320bdc['token'],'notifyContentType':_0xb976('0x5a'),'callbackData':_0x320bdc[_0xb976('0x24')]+';'+_0x568062[_0xb976('0x23')]}]},'headers':{'Authorization':_0xb976('0x5b')+_0x5f22ee[_0xb976('0x27')]},'json':!![]};return rp(_0x518884)[_0xb976('0x16')](function(_0x1bdae5){if(_0x1bdae5[_0xb976('0x21')]){var _0xfc9362={'messageId':_0x1bdae5[_0xb976('0x21')][0x0][_0xb976('0xa')]};if(!_0x320bdc['deliveryReport']){_0xfc9362['read']=!![];}return _0x334204[_0xb976('0x17')](_0xfc9362);}else{return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x56'),util[_0xb976('0x2a')](_0x1bdae5,{'showHidden':![],'depth':null}));}});})[_0xb976('0x29')](function(_0x133810){return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x56'),util['inspect'](_0x133810,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb976('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),_0xb976('0x56'),_0xb976('0x3c'));}break;case _0xb976('0x5c'):var _0x131858=require('crypto');if(_0x320bdc[_0xb976('0x5d')]){var _0xeca03c={};_0xeca03c['login']=_0x320bdc['username'];_0xeca03c[_0xb976('0x24')]=_0x568062[_0xb976('0x24')];_0xeca03c[_0xb976('0x30')]=_0x320bdc[_0xb976('0x24')];_0xeca03c[_0xb976('0x5e')]=_0x568062['body'];_0xeca03c[_0xb976('0x5f')]=+new Date();var _0x5f1876='';var _0x21854e='';var _0x4b1ab2=Object[_0xb976('0x60')](_0xeca03c);_0x4b1ab2['sort']();for(var _0x43b327=0x0;_0x43b327<_0x4b1ab2[_0xb976('0x61')];_0x43b327++){if(_0x5f1876!=''){_0x5f1876+='&';}_0x5f1876+=_0x4b1ab2[_0x43b327]+'='+encodeURIComponent(_0xeca03c[_0x4b1ab2[_0x43b327]]);_0x21854e+=_0xeca03c[_0x4b1ab2[_0x43b327]];}_0x21854e+=_0x320bdc['apiKey'];_0x21854e=_0x131858[_0xb976('0x62')](_0xb976('0x63'))[_0xb976('0x17')](_0x21854e)[_0xb976('0x64')](_0xb976('0x65'));if(_0x5f1876!==''){_0x5f1876+='&';}_0x5f1876+=_0xb976('0x66')+_0x21854e;var _0x591ea9={'method':_0xb976('0x34'),'uri':_0x320bdc[_0xb976('0x57')]+_0xb976('0x67')+_0x5f1876,'json':!![]};return rp(_0x591ea9)[_0xb976('0x16')](function(_0x27c814){var _0x510ef8=Object['keys'](_0x27c814);if(_0x27c814[_0x510ef8[0x0]][_0xb976('0x19')]&&parseInt(_0x27c814[_0x510ef8[0x0]][_0xb976('0x19')])===0x0){var _0x225494={'messageId':_0x27c814[_0x510ef8[0x0]]['id_sms']};if(!_0x320bdc['deliveryReport']){_0x225494['read']=!![];}return _0x334204[_0xb976('0x17')](_0x225494);}else{return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x5c'),util[_0xb976('0x2a')](_0x27c814[_0xb976('0x19')],{'showHidden':![],'depth':null}));}})[_0xb976('0x29')](function(_0x15c847){return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x5c'),util[_0xb976('0x2a')](_0x15c847,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',_0xb976('0x68'));}break;case _0xb976('0x69'):if(_0x320bdc[_0xb976('0x5d')]){var _0x122ad2={'method':_0xb976('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x320bdc['apiKey']},'body':{'content':_0x568062[_0xb976('0x23')],'to':[_0x568062[_0xb976('0x24')]],'from':_0x320bdc['phone'],'binary':![],'clientMessageId':_0xb976('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x122ad2)[_0xb976('0x16')](function(_0x425e38){if(!_0x425e38[_0xb976('0x19')]){var _0x2cb8e9={'messageId':_0x425e38[_0xb976('0x21')][0x0]['apiMessageId']};if(!_0x320bdc['deliveryReport']){_0x2cb8e9[_0xb976('0x3a')]=!![];}return _0x334204[_0xb976('0x17')](_0x2cb8e9);}else{return logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),'clickatell',util['inspect'](_0x425e38['error'],{'showHidden':![],'depth':null}));}})[_0xb976('0x29')](function(_0x568b3a){return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x69'),util['inspect'](_0x568b3a,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),'afterCreate','clickatell',_0xb976('0x68'));}break;case _0xb976('0x6b'):if(_0x320bdc[_0xb976('0x32')]&&_0x320bdc[_0xb976('0x2e')]){var _0x5de74c=util[_0xb976('0x44')](_0xb976('0x45'),_0x320bdc[_0xb976('0x32')],_0x320bdc['password']);var _0x14739f={'method':_0xb976('0x35'),'uri':_0xb976('0x6c')+_0x320bdc[_0xb976('0x6d')]+_0xb976('0x6e'),'body':{'to':[_0x568062['phone']],'text':_0x568062[_0xb976('0x23')],'from':_0x320bdc[_0xb976('0x24')],'applicationId':_0x320bdc['applicationId']},'headers':{'Authorization':util[_0xb976('0x44')](_0xb976('0x47'),new Buffer(_0x5de74c)[_0xb976('0x53')](_0xb976('0x48')))},'json':!![]};rp(_0x14739f)[_0xb976('0x16')](function(_0x5f47aa){if(_0x5f47aa['id']){var _0x36efa8={'messageId':_0x5f47aa['id']};return _0x334204[_0xb976('0x17')](_0x36efa8);}else{logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),'bandwidth',util['inspect'](_0x5f47aa,{'showHidden':![],'depth':null}));}})['catch'](function(_0x104198){logger[_0xb976('0x19')](_0xb976('0x3b'),'afterCreate',_0xb976('0x6b'),util['inspect'](_0x104198,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),'bandwidth',_0xb976('0x3c'));}break;case'intelepeer':if(_0x320bdc[_0xb976('0x5d')]){var _0x4e5201={};var _0x591ea9={'method':_0xb976('0x35'),'uri':_0xb976('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x320bdc[_0xb976('0x5d')],'Content-Type':_0xb976('0x5a')},'body':{'from':_0x320bdc[_0xb976('0x24')],'to':_0x568062[_0xb976('0x24')],'text':_0x568062[_0xb976('0x23')]},'json':!![]};return rp(_0x591ea9)[_0xb976('0x16')](function(_0x27326a){if(_0x27326a[_0xb976('0x70')]==0xca){_0x4e5201[_0xb976('0x71')]=_0x27326a;var _0x41c234={'method':_0xb976('0x35'),'uri':_0xb976('0x72'),'headers':{'Authorization':_0xb976('0x73')+_0x320bdc[_0xb976('0x5d')],'Content-Type':_0xb976('0x5a')},'body':{'refid':_0x4e5201['message'][_0xb976('0x74')]},'json':!![]};return rp(_0x41c234)['then'](function(_0x3bf7c5){_0x4e5201['status']=_0x3bf7c5;var _0x19e776={'messageId':_0x4e5201[_0xb976('0x71')][_0xb976('0x74')],'read':!![]};return _0x334204[_0xb976('0x17')](_0x19e776);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),_0xb976('0x75'),util[_0xb976('0x2a')](_0x27326a,{'showHidden':![],'depth':null}));}})[_0xb976('0x29')](function(_0x415934){return logger['error'](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x75'),util[_0xb976('0x2a')](_0x415934,{'showHidden':![],'depth':null}));});}else{return logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xb976('0x76')](function(){_0x461d00();});}else{_0x461d00();}}},'charset':'utf8mb4','collate':_0xb976('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index a216780..0429616 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 _0x8a1a=['body','options','raw','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x3e6d6e,_0x18b48b){var _0x2da2cb=function(_0x423214){while(--_0x423214){_0x3e6d6e['push'](_0x3e6d6e['shift']());}};_0x2da2cb(++_0x18b48b);}(_0x8a1a,0x196));var _0xa8a1=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x8a1a[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0xa8a1('0x0'));var util=require(_0xa8a1('0x1'));var moment=require('moment');var BPromise=require(_0xa8a1('0x2'));var rs=require(_0xa8a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa8a1('0x4'))(_0xa8a1('0x5'));var config=require(_0xa8a1('0x6'));var jayson=require(_0xa8a1('0x7'));var client=jayson[_0xa8a1('0x8')]['http']({'port':0x232a});config[_0xa8a1('0x9')]=_['defaults'](config[_0xa8a1('0x9')],{'host':_0xa8a1('0xa'),'port':0x18eb});var socket=require(_0xa8a1('0xb'))(new Redis(config[_0xa8a1('0x9')]));require('./smsMessage.socket')[_0xa8a1('0xc')](socket);function respondWithRpcPromise(_0x57332b,_0x3c3bc0,_0x31b4ee){return new BPromise(function(_0x5e5de1,_0x292f27){return client[_0xa8a1('0xd')](_0x57332b,_0x31b4ee)[_0xa8a1('0xe')](function(_0x146cd3){logger[_0xa8a1('0xf')](_0xa8a1('0x10'),_0x3c3bc0,_0xa8a1('0x11'));logger[_0xa8a1('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3c3bc0,_0xa8a1('0x11'),JSON[_0xa8a1('0x13')](_0x146cd3));if(_0x146cd3[_0xa8a1('0x14')]){if(_0x146cd3[_0xa8a1('0x14')][_0xa8a1('0x15')]===0x1f4){logger[_0xa8a1('0x14')]('SmsMessage,\x20%s,\x20%s',_0x3c3bc0,_0x146cd3[_0xa8a1('0x14')][_0xa8a1('0x16')]);return _0x292f27(_0x146cd3[_0xa8a1('0x14')]['message']);}logger[_0xa8a1('0x14')]('SmsMessage,\x20%s,\x20%s',_0x3c3bc0,_0x146cd3['error'][_0xa8a1('0x16')]);return _0x5e5de1(_0x146cd3[_0xa8a1('0x14')][_0xa8a1('0x16')]);}else{logger[_0xa8a1('0xf')](_0xa8a1('0x10'),_0x3c3bc0,_0xa8a1('0x11'));_0x5e5de1(_0x146cd3[_0xa8a1('0x17')][_0xa8a1('0x16')]);}})[_0xa8a1('0x18')](function(_0x3c70a7){logger['error'](_0xa8a1('0x10'),_0x3c3bc0,_0x3c70a7);_0x292f27(_0x3c70a7);});});}exports[_0xa8a1('0x19')]=function(_0x43c9ca){var _0x39579b=this;return new Promise(function(_0x2b9792,_0x36ea45){return db[_0xa8a1('0x1a')][_0xa8a1('0x1b')](_0x43c9ca[_0xa8a1('0x1c')],{'raw':_0x43c9ca[_0xa8a1('0x1d')]?_0x43c9ca[_0xa8a1('0x1d')][_0xa8a1('0x1e')]===undefined?!![]:![]:!![]})[_0xa8a1('0xe')](function(_0x280507){logger[_0xa8a1('0xf')](_0xa8a1('0x19'),_0x43c9ca);logger[_0xa8a1('0x12')](_0xa8a1('0x19'),_0x43c9ca,JSON['stringify'](_0x280507));_0x2b9792(_0x280507);})[_0xa8a1('0x18')](function(_0x558145){logger[_0xa8a1('0x14')](_0xa8a1('0x19'),_0x558145[_0xa8a1('0x16')],_0x43c9ca);_0x36ea45(_0x39579b[_0xa8a1('0x14')](0x1f4,_0x558145['message']));});});}; \ No newline at end of file +var _0xd996=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsMessage','create','body','raw','CreateSmsMessage','lodash','util','moment'];(function(_0xa8a364,_0x4f2e15){var _0x30ddcc=function(_0x109b50){while(--_0x109b50){_0xa8a364['push'](_0xa8a364['shift']());}};_0x30ddcc(++_0x4f2e15);}(_0xd996,0x1ec));var _0x6d99=function(_0x234d56,_0x4eee01){_0x234d56=_0x234d56-0x0;var _0xd47811=_0xd996[_0x234d56];return _0xd47811;};'use strict';var _=require(_0x6d99('0x0'));var util=require(_0x6d99('0x1'));var moment=require(_0x6d99('0x2'));var BPromise=require(_0x6d99('0x3'));var rs=require(_0x6d99('0x4'));var fs=require('fs');var Redis=require(_0x6d99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d99('0x6'));var logger=require(_0x6d99('0x7'))(_0x6d99('0x8'));var config=require(_0x6d99('0x9'));var jayson=require(_0x6d99('0xa'));var client=jayson[_0x6d99('0xb')][_0x6d99('0xc')]({'port':0x232a});config[_0x6d99('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6d99('0xe'))(new Redis(config[_0x6d99('0xd')]));require(_0x6d99('0xf'))['register'](socket);function respondWithRpcPromise(_0xbbea3b,_0x1ee896,_0x285b68){return new BPromise(function(_0x4e9daa,_0x5a9540){return client[_0x6d99('0x10')](_0xbbea3b,_0x285b68)[_0x6d99('0x11')](function(_0x292523){logger['info'](_0x6d99('0x12'),_0x1ee896,_0x6d99('0x13'));logger[_0x6d99('0x14')](_0x6d99('0x15'),_0x1ee896,_0x6d99('0x13'),JSON[_0x6d99('0x16')](_0x292523));if(_0x292523[_0x6d99('0x17')]){if(_0x292523[_0x6d99('0x17')][_0x6d99('0x18')]===0x1f4){logger[_0x6d99('0x17')]('SmsMessage,\x20%s,\x20%s',_0x1ee896,_0x292523[_0x6d99('0x17')][_0x6d99('0x19')]);return _0x5a9540(_0x292523[_0x6d99('0x17')][_0x6d99('0x19')]);}logger[_0x6d99('0x17')]('SmsMessage,\x20%s,\x20%s',_0x1ee896,_0x292523[_0x6d99('0x17')][_0x6d99('0x19')]);return _0x4e9daa(_0x292523[_0x6d99('0x17')][_0x6d99('0x19')]);}else{logger['info'](_0x6d99('0x12'),_0x1ee896,_0x6d99('0x13'));_0x4e9daa(_0x292523[_0x6d99('0x1a')][_0x6d99('0x19')]);}})[_0x6d99('0x1b')](function(_0x132586){logger[_0x6d99('0x17')]('SmsMessage,\x20%s,\x20%s',_0x1ee896,_0x132586);_0x5a9540(_0x132586);});});}exports['CreateSmsMessage']=function(_0x28ea89){var _0x1c83a9=this;return new Promise(function(_0x313bec,_0x3c467e){return db[_0x6d99('0x1c')][_0x6d99('0x1d')](_0x28ea89[_0x6d99('0x1e')],{'raw':_0x28ea89['options']?_0x28ea89['options'][_0x6d99('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x21715b){logger['info'](_0x6d99('0x20'),_0x28ea89);logger[_0x6d99('0x14')]('CreateSmsMessage',_0x28ea89,JSON[_0x6d99('0x16')](_0x21715b));_0x313bec(_0x21715b);})[_0x6d99('0x1b')](function(_0x37c294){logger[_0x6d99('0x17')]('CreateSmsMessage',_0x37c294[_0x6d99('0x19')],_0x28ea89);_0x3c467e(_0x1c83a9[_0x6d99('0x17')](0x1f4,_0x37c294[_0x6d99('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 2af5114..cc76c99 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 _0x9d18=['emit','removeListener','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x27a073,_0x6395a4){var _0x125f26=function(_0x2d1888){while(--_0x2d1888){_0x27a073['push'](_0x27a073['shift']());}};_0x125f26(++_0x6395a4);}(_0x9d18,0x6c));var _0x89d1=function(_0x40b330,_0x42458b){_0x40b330=_0x40b330-0x0;var _0x27ae9a=_0x9d18[_0x40b330];return _0x27ae9a;};'use strict';var SmsMessageEvents=require(_0x89d1('0x0'));var events=[_0x89d1('0x1'),_0x89d1('0x2'),_0x89d1('0x3')];function createListener(_0x8df7b1,_0x4665af){return function(_0x5177af){_0x4665af[_0x89d1('0x4')](_0x8df7b1,_0x5177af);};}function removeListener(_0x3aca71,_0xd360b2){return function(){SmsMessageEvents[_0x89d1('0x5')](_0x3aca71,_0xd360b2);};}exports['register']=function(_0x5b74c3){for(var _0x5f37bc=0x0,_0x29eaeb=events[_0x89d1('0x6')];_0x5f37bc<_0x29eaeb;_0x5f37bc++){var _0x2bd0a3=events[_0x5f37bc];var _0x3285ed=createListener(_0x89d1('0x7')+_0x2bd0a3,_0x5b74c3);SmsMessageEvents['on'](_0x2bd0a3,_0x3285ed);}}; \ No newline at end of file +var _0xf091=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0xf091,0x19b));var _0x1f09=function(_0x3c3127,_0x44a3c6){_0x3c3127=_0x3c3127-0x0;var _0x1de229=_0xf091[_0x3c3127];return _0x1de229;};'use strict';var SmsMessageEvents=require(_0x1f09('0x0'));var events=[_0x1f09('0x1'),_0x1f09('0x2'),_0x1f09('0x3')];function createListener(_0x3aa2a6,_0x2f5d99){return function(_0x26dad7){_0x2f5d99[_0x1f09('0x4')](_0x3aa2a6,_0x26dad7);};}function removeListener(_0x190140,_0x1a44fe){return function(){SmsMessageEvents[_0x1f09('0x5')](_0x190140,_0x1a44fe);};}exports[_0x1f09('0x6')]=function(_0x101700){for(var _0x121b6d=0x0,_0x2741d8=events[_0x1f09('0x7')];_0x121b6d<_0x2741d8;_0x121b6d++){var _0x2f9a5f=events[_0x121b6d];var _0x1a39e7=createListener(_0x1f09('0x8')+_0x2f9a5f,_0x101700);SmsMessageEvents['on'](_0x2f9a5f,_0x1a39e7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a4dbff7..7e6d4bd 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 _0x43d5=['index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get'];(function(_0x311da3,_0x5040f3){var _0x3fea5a=function(_0x1d1085){while(--_0x1d1085){_0x311da3['push'](_0x311da3['shift']());}};_0x3fea5a(++_0x5040f3);}(_0x43d5,0xc7));var _0x543d=function(_0x4237d1,_0x19d0f5){_0x4237d1=_0x4237d1-0x0;var _0x49482a=_0x43d5[_0x4237d1];return _0x49482a;};'use strict';var multer=require(_0x543d('0x0'));var util=require(_0x543d('0x1'));var path=require('path');var timeout=require(_0x543d('0x2'));var express=require(_0x543d('0x3'));var router=express[_0x543d('0x4')]();var fs_extra=require(_0x543d('0x5'));var auth=require(_0x543d('0x6'));var interaction=require(_0x543d('0x7'));var config=require(_0x543d('0x8'));var controller=require(_0x543d('0x9'));router[_0x543d('0xa')]('/',auth['isAuthenticated'](),controller[_0x543d('0xb')]);router[_0x543d('0xa')](_0x543d('0xc'),auth[_0x543d('0xd')](),controller[_0x543d('0xe')]);router[_0x543d('0xa')](_0x543d('0xf'),auth['isAuthenticated'](),controller[_0x543d('0x10')]);router[_0x543d('0xa')](_0x543d('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0x543d('0xa')](_0x543d('0x12'),auth[_0x543d('0xd')](),controller['getTeams']);router['get'](_0x543d('0x13'),auth[_0x543d('0xd')](),controller[_0x543d('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x543d('0x15')]);router[_0x543d('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x543d('0x17')]);router[_0x543d('0x16')](_0x543d('0x13'),auth[_0x543d('0xd')](),controller[_0x543d('0x18')]);router['put'](_0x543d('0xf'),auth[_0x543d('0xd')](),controller['update']);router[_0x543d('0x19')](_0x543d('0xf'),auth[_0x543d('0xd')](),controller[_0x543d('0x1a')]);router[_0x543d('0x19')](_0x543d('0x12'),auth[_0x543d('0xd')](),controller[_0x543d('0x1b')]);router['delete'](_0x543d('0x13'),auth[_0x543d('0xd')](),controller[_0x543d('0x1c')]);module[_0x543d('0x1d')]=router; \ No newline at end of file +var _0x6216=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/users','getAgents','create','/:id/teams','addTeams','post','addAgents','put','update','destroy','removeTeams','delete','removeAgents','multer','util','express','Router','fs-extra'];(function(_0x51790c,_0x452a6b){var _0x3c4aa5=function(_0x2c6328){while(--_0x2c6328){_0x51790c['push'](_0x51790c['shift']());}};_0x3c4aa5(++_0x452a6b);}(_0x6216,0x113));var _0x6621=function(_0x2bbbab,_0x53275f){_0x2bbbab=_0x2bbbab-0x0;var _0x18816b=_0x6216[_0x2bbbab];return _0x18816b;};'use strict';var multer=require(_0x6621('0x0'));var util=require(_0x6621('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6621('0x2'));var router=express[_0x6621('0x3')]();var fs_extra=require(_0x6621('0x4'));var auth=require(_0x6621('0x5'));var interaction=require(_0x6621('0x6'));var config=require(_0x6621('0x7'));var controller=require('./smsQueue.controller');router[_0x6621('0x8')]('/',auth[_0x6621('0x9')](),controller[_0x6621('0xa')]);router[_0x6621('0x8')](_0x6621('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6621('0x8')](_0x6621('0xc'),auth[_0x6621('0x9')](),controller[_0x6621('0xd')]);router['get'](_0x6621('0xe'),auth[_0x6621('0x9')](),controller['getMembers']);router[_0x6621('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x6621('0x8')](_0x6621('0xf'),auth[_0x6621('0x9')](),controller[_0x6621('0x10')]);router['post']('/',auth[_0x6621('0x9')](),controller[_0x6621('0x11')]);router['post'](_0x6621('0x12'),auth[_0x6621('0x9')](),controller[_0x6621('0x13')]);router[_0x6621('0x14')](_0x6621('0xf'),auth[_0x6621('0x9')](),controller[_0x6621('0x15')]);router[_0x6621('0x16')](_0x6621('0xc'),auth[_0x6621('0x9')](),controller[_0x6621('0x17')]);router['delete']('/:id',auth[_0x6621('0x9')](),controller[_0x6621('0x18')]);router['delete'](_0x6621('0x12'),auth['isAuthenticated'](),controller[_0x6621('0x19')]);router[_0x6621('0x1a')]('/:id/users',auth[_0x6621('0x9')](),controller[_0x6621('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 688b83d..8b5cd8b 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 _0xa1bb=['exports','STRING','name','ENUM','beepall','roundrobin'];(function(_0x3ac130,_0x4de592){var _0x440514=function(_0x16f1b3){while(--_0x16f1b3){_0x3ac130['push'](_0x3ac130['shift']());}};_0x440514(++_0x4de592);}(_0xa1bb,0xf6));var _0xba1b=function(_0x49da7c,_0x449131){_0x49da7c=_0x49da7c-0x0;var _0x5b6908=_0xa1bb[_0x49da7c];return _0x5b6908;};'use strict';var Sequelize=require('sequelize');module[_0xba1b('0x0')]={'name':{'type':Sequelize[_0xba1b('0x1')],'unique':_0xba1b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xba1b('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba1b('0x3')]('rrmemory',_0xba1b('0x4'),_0xba1b('0x5'))}}; \ No newline at end of file +var _0x880f=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x880f,0xc1));var _0xf880=function(_0x361cfe,_0x2929be){_0x361cfe=_0x361cfe-0x0;var _0x1218bd=_0x880f[_0x361cfe];return _0x1218bd;};'use strict';var Sequelize=require(_0xf880('0x0'));module[_0xf880('0x1')]={'name':{'type':Sequelize[_0xf880('0x2')],'unique':_0xf880('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf880('0x2')]},'timeout':{'type':Sequelize[_0xf880('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf880('0x5'),_0xf880('0x6'),_0xf880('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 337849f..bf097f3 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 _0xe91c=['VIRTUAL','filter','merge','includeAll','include','rows','show','params','keys','rawAttributes','intersection','length','create','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','pick','SmsQueueId','options','UserSmsQueue','findAll','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','body','ids','online','voicePause','interface','findOrCreate','emit','userSmsQueue:save','removeTeams','Agents','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','index','SmsQueue','fieldName','type','key','map','query','filters','model','fields','attributes','order','sort','where'];(function(_0x5ca15f,_0x19ce28){var _0x55d478=function(_0x2f3ff7){while(--_0x2f3ff7){_0x5ca15f['push'](_0x5ca15f['shift']());}};_0x55d478(++_0x19ce28);}(_0xe91c,0xe1));var _0xce91=function(_0x4d7ddc,_0x5d679e){_0x4d7ddc=_0x4d7ddc-0x0;var _0x117bf6=_0xe91c[_0x4d7ddc];return _0x117bf6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce91('0x0'));var zipdir=require(_0xce91('0x1'));var jsonpatch=require(_0xce91('0x2'));var rp=require(_0xce91('0x3'));var moment=require(_0xce91('0x4'));var BPromise=require(_0xce91('0x5'));var Mustache=require(_0xce91('0x6'));var util=require('util');var path=require(_0xce91('0x7'));var sox=require(_0xce91('0x8'));var csv=require('to-csv');var ejs=require(_0xce91('0x9'));var fs=require('fs');var fs_extra=require(_0xce91('0xa'));var _=require(_0xce91('0xb'));var squel=require(_0xce91('0xc'));var crypto=require(_0xce91('0xd'));var jsforce=require(_0xce91('0xe'));var deskjs=require(_0xce91('0xf'));var toCsv=require(_0xce91('0x10'));var querystring=require(_0xce91('0x11'));var Papa=require(_0xce91('0x12'));var Redis=require(_0xce91('0x13'));var authService=require(_0xce91('0x14'));var qs=require(_0xce91('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce91('0x16'));var logger=require(_0xce91('0x17'))(_0xce91('0x18'));var utils=require(_0xce91('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xce91('0x1a'));var db=require('../../mysqldb')['db'];config[_0xce91('0x1b')]=_[_0xce91('0x1c')](config[_0xce91('0x1b')],{'host':_0xce91('0x1d'),'port':0x18eb});var socket=require(_0xce91('0x1e'))(new Redis(config[_0xce91('0x1b')]));require(_0xce91('0x1f'))['register'](socket);function respondWithStatusCode(_0x342458,_0x41fadb){_0x41fadb=_0x41fadb||0xcc;return function(_0x36c75c){if(_0x36c75c){return _0x342458['sendStatus'](_0x41fadb);}return _0x342458['status'](_0x41fadb)[_0xce91('0x20')]();};}function respondWithResult(_0x308d51,_0xaa4f12){_0xaa4f12=_0xaa4f12||0xc8;return function(_0x42e898){if(_0x42e898){return _0x308d51[_0xce91('0x21')](_0xaa4f12)[_0xce91('0x22')](_0x42e898);}};}function respondWithFilteredResult(_0x53f0d7,_0x4e82a5){return function(_0x51d179){if(_0x51d179){var _0x22edd7=typeof _0x4e82a5[_0xce91('0x23')]===_0xce91('0x24')&&typeof _0x4e82a5[_0xce91('0x25')]===_0xce91('0x24');var _0x3e8355=_0x51d179[_0xce91('0x26')];var _0x2e033b=_0x22edd7?0x0:_0x4e82a5['offset'];var _0x1664d7=_0x22edd7?_0x51d179[_0xce91('0x26')]:_0x4e82a5['offset']+_0x4e82a5[_0xce91('0x25')];var _0x567f55;if(_0x1664d7>=_0x3e8355){_0x1664d7=_0x3e8355;_0x567f55=0xc8;}else{_0x567f55=0xce;}_0x53f0d7[_0xce91('0x21')](_0x567f55);return _0x53f0d7[_0xce91('0x27')](_0xce91('0x28'),_0x2e033b+'-'+_0x1664d7+'/'+_0x3e8355)[_0xce91('0x22')](_0x51d179);}return null;};}function patchUpdates(_0x580d73){return function(_0x443d29){try{jsonpatch['apply'](_0x443d29,_0x580d73,!![]);}catch(_0x122dcd){return BPromise[_0xce91('0x29')](_0x122dcd);}return _0x443d29[_0xce91('0x2a')]();};}function saveUpdates(_0x717d9b,_0x2bb7c6){return function(_0x3baaf8){if(_0x3baaf8){return _0x3baaf8[_0xce91('0x2b')](_0x717d9b)[_0xce91('0x2c')](function(_0x515f1f){return _0x515f1f;});}return null;};}function removeEntity(_0x97895d,_0x25786b){return function(_0x56b6aa){if(_0x56b6aa){return _0x56b6aa[_0xce91('0x2d')]()['then'](function(){var _0x175453=_0x56b6aa[_0xce91('0x2e')]({'plain':!![]});var _0x2242a3='SmsQueues';return db[_0xce91('0x2f')][_0xce91('0x2d')]({'where':{'type':_0x2242a3,'resourceId':_0x175453['id']}})['then'](function(){return _0x56b6aa;});})[_0xce91('0x2c')](function(){_0x97895d[_0xce91('0x21')](0xcc)[_0xce91('0x20')]();});}};}function handleEntityNotFound(_0x1a6e20,_0x55a651){return function(_0x556e09){if(!_0x556e09){_0x1a6e20[_0xce91('0x30')](0x194);}return _0x556e09;};}function handleError(_0x10c3ff,_0x245117){_0x245117=_0x245117||0x1f4;return function(_0x247bf0){logger[_0xce91('0x31')](_0x247bf0['stack']);if(_0x247bf0[_0xce91('0x32')]){delete _0x247bf0['name'];}_0x10c3ff[_0xce91('0x21')](_0x245117)['send'](_0x247bf0);};}exports[_0xce91('0x33')]=function(_0x96c972,_0x9df2a2){var _0x10775a={},_0x545a2d={},_0xfa2ccd={'count':0x0,'rows':[]};var _0x43a0b7=_['map'](db[_0xce91('0x34')]['rawAttributes'],function(_0x5980df){return{'name':_0x5980df[_0xce91('0x35')],'type':_0x5980df[_0xce91('0x36')][_0xce91('0x37')]};});_0x545a2d['model']=_[_0xce91('0x38')](_0x43a0b7,'name');_0x545a2d['query']=_['keys'](_0x96c972[_0xce91('0x39')]);_0x545a2d[_0xce91('0x3a')]=_['intersection'](_0x545a2d[_0xce91('0x3b')],_0x545a2d[_0xce91('0x39')]);_0x10775a['attributes']=_['intersection'](_0x545a2d['model'],qs[_0xce91('0x3c')](_0x96c972[_0xce91('0x39')][_0xce91('0x3c')]));_0x10775a['attributes']=_0x10775a[_0xce91('0x3d')]['length']?_0x10775a[_0xce91('0x3d')]:_0x545a2d['model'];if(!_0x96c972[_0xce91('0x39')]['hasOwnProperty']('nolimit')){_0x10775a[_0xce91('0x25')]=qs[_0xce91('0x25')](_0x96c972['query'][_0xce91('0x25')]);_0x10775a[_0xce91('0x23')]=qs[_0xce91('0x23')](_0x96c972['query']['offset']);}_0x10775a[_0xce91('0x3e')]=qs[_0xce91('0x3f')](_0x96c972[_0xce91('0x39')][_0xce91('0x3f')]);_0x10775a[_0xce91('0x40')]=qs[_0xce91('0x3a')](_['pick'](_0x96c972[_0xce91('0x39')],_0x545a2d[_0xce91('0x3a')]),_0x43a0b7);if(_0x96c972['query']['filter']){_0x10775a[_0xce91('0x40')]=_['merge'](_0x10775a[_0xce91('0x40')],{'$or':_[_0xce91('0x38')](_0x43a0b7,function(_0x676a87){if(_0x676a87[_0xce91('0x36')]!==_0xce91('0x41')){var _0x1c3b41={};_0x1c3b41[_0x676a87[_0xce91('0x32')]]={'$like':'%'+_0x96c972['query'][_0xce91('0x42')]+'%'};return _0x1c3b41;}})});}_0x10775a=_[_0xce91('0x43')]({},_0x10775a,_0x96c972['options']);var _0x259f36={'where':_0x10775a[_0xce91('0x40')]};return db['SmsQueue'][_0xce91('0x26')](_0x259f36)[_0xce91('0x2c')](function(_0x295e3a){_0xfa2ccd[_0xce91('0x26')]=_0x295e3a;if(_0x96c972[_0xce91('0x39')][_0xce91('0x44')]){_0x10775a[_0xce91('0x45')]=[{'all':!![]}];}return db[_0xce91('0x34')]['findAll'](_0x10775a);})[_0xce91('0x2c')](function(_0x116eb5){_0xfa2ccd[_0xce91('0x46')]=_0x116eb5;return _0xfa2ccd;})['then'](respondWithFilteredResult(_0x9df2a2,_0x10775a))['catch'](handleError(_0x9df2a2,null));};exports[_0xce91('0x47')]=function(_0x1e29bb,_0x353351){var _0x45758c={'raw':!![],'where':{'id':_0x1e29bb[_0xce91('0x48')]['id']}},_0x164316={};_0x164316[_0xce91('0x3b')]=_[_0xce91('0x49')](db[_0xce91('0x34')][_0xce91('0x4a')]);_0x164316[_0xce91('0x39')]=_[_0xce91('0x49')](_0x1e29bb[_0xce91('0x39')]);_0x164316['filters']=_['intersection'](_0x164316[_0xce91('0x3b')],_0x164316[_0xce91('0x39')]);_0x45758c[_0xce91('0x3d')]=_[_0xce91('0x4b')](_0x164316[_0xce91('0x3b')],qs['fields'](_0x1e29bb[_0xce91('0x39')][_0xce91('0x3c')]));_0x45758c[_0xce91('0x3d')]=_0x45758c[_0xce91('0x3d')][_0xce91('0x4c')]?_0x45758c[_0xce91('0x3d')]:_0x164316[_0xce91('0x3b')];if(_0x1e29bb[_0xce91('0x39')][_0xce91('0x44')]){_0x45758c[_0xce91('0x45')]=[{'all':!![]}];}_0x45758c=_[_0xce91('0x43')]({},_0x45758c,_0x1e29bb['options']);return db[_0xce91('0x34')]['find'](_0x45758c)['then'](handleEntityNotFound(_0x353351,null))[_0xce91('0x2c')](respondWithResult(_0x353351,null))['catch'](handleError(_0x353351,null));};exports['create']=function(_0x246f25,_0x47b52d){return db[_0xce91('0x34')][_0xce91('0x4d')](_0x246f25['body'],{})[_0xce91('0x2c')](function(_0x2f23ef){var _0x15c722=_0x246f25['user']['get']({'plain':!![]});if(!_0x15c722)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c722[_0xce91('0x4e')]==='user'){var _0x2654bd=_0x2f23ef['get']({'plain':!![]});var _0x314f0d='SmsQueues';return db[_0xce91('0x4f')][_0xce91('0x50')]({'where':{'name':_0x314f0d,'userProfileId':_0x15c722[_0xce91('0x51')]},'raw':!![]})[_0xce91('0x2c')](function(_0x5db3f6){if(_0x5db3f6&&_0x5db3f6[_0xce91('0x52')]===0x0){return db['UserProfileResource'][_0xce91('0x4d')]({'name':_0x2654bd[_0xce91('0x32')],'resourceId':_0x2654bd['id'],'type':_0x5db3f6['name'],'sectionId':_0x5db3f6['id']},{})[_0xce91('0x2c')](function(){return _0x2f23ef;});}else{return _0x2f23ef;}})[_0xce91('0x53')](function(_0x268f14){logger[_0xce91('0x31')](_0xce91('0x54'),_0x268f14);throw _0x268f14;});}return _0x2f23ef;})[_0xce91('0x2c')](respondWithResult(_0x47b52d,0xc9))[_0xce91('0x53')](handleError(_0x47b52d,null));};exports[_0xce91('0x2b')]=function(_0x2895fb,_0x1fa559){if(_0x2895fb['body']['id']){delete _0x2895fb['body']['id'];}return db[_0xce91('0x34')][_0xce91('0x50')]({'where':{'id':_0x2895fb[_0xce91('0x48')]['id']}})[_0xce91('0x2c')](handleEntityNotFound(_0x1fa559,null))[_0xce91('0x2c')](saveUpdates(_0x2895fb['body'],null))[_0xce91('0x2c')](respondWithResult(_0x1fa559,null))[_0xce91('0x53')](handleError(_0x1fa559,null));};exports['destroy']=function(_0x12b5bf,_0x210bba){return db['SmsQueue']['find']({'where':{'id':_0x12b5bf[_0xce91('0x48')]['id']}})[_0xce91('0x2c')](handleEntityNotFound(_0x210bba,null))[_0xce91('0x2c')](removeEntity(_0x210bba,null))[_0xce91('0x53')](handleError(_0x210bba,null));};exports[_0xce91('0x55')]=function(_0x33544c,_0x358f31){return db[_0xce91('0x34')]['describe']()['then'](respondWithResult(_0x358f31,null))['catch'](handleError(_0x358f31,null));};exports[_0xce91('0x56')]=function(_0x53d615,_0x55544b,_0x14aa57){var _0x16610b={'raw':!![],'where':{}},_0x32a28f={},_0x4db164;return db['SmsQueue'][_0xce91('0x57')]({'where':{'id':_0x53d615['params']['id']}})[_0xce91('0x2c')](handleEntityNotFound(_0x55544b,null))[_0xce91('0x2c')](function(_0x44864a){if(_0x44864a){_0x4db164=_0x44864a[_0xce91('0x2e')]({'plain':!![]});_0x32a28f[_0xce91('0x3b')]=_[_0xce91('0x49')](db['UserSmsQueue'][_0xce91('0x4a')]);_0x32a28f[_0xce91('0x39')]=_[_0xce91('0x49')](_0x53d615[_0xce91('0x39')]);_0x32a28f[_0xce91('0x3a')]=_[_0xce91('0x4b')](_0x32a28f[_0xce91('0x3b')],_0x32a28f[_0xce91('0x39')]);_0x16610b[_0xce91('0x3d')]=_[_0xce91('0x4b')](_0x32a28f[_0xce91('0x3b')],qs[_0xce91('0x3c')](_0x53d615['query'][_0xce91('0x3c')]));_0x16610b[_0xce91('0x3d')]=_0x16610b[_0xce91('0x3d')][_0xce91('0x4c')]?_0x16610b[_0xce91('0x3d')]:_0x32a28f['model'];if(!_0x53d615[_0xce91('0x39')]['hasOwnProperty'](_0xce91('0x58'))){_0x16610b[_0xce91('0x25')]=qs[_0xce91('0x25')](_0x53d615[_0xce91('0x39')][_0xce91('0x25')]);_0x16610b[_0xce91('0x23')]=qs['offset'](_0x53d615[_0xce91('0x39')][_0xce91('0x23')]);}_0x16610b[_0xce91('0x3e')]=qs['sort'](_0x53d615[_0xce91('0x39')][_0xce91('0x3f')]);_0x16610b[_0xce91('0x40')]=qs['filters'](_[_0xce91('0x59')](_0x53d615[_0xce91('0x39')],_0x32a28f[_0xce91('0x3a')]));_0x16610b[_0xce91('0x40')][_0xce91('0x5a')]=_0x44864a['id'];if(_0x53d615['query'][_0xce91('0x42')]){_0x16610b[_0xce91('0x40')]=_['merge'](_0x16610b[_0xce91('0x40')],{'$or':_['map'](_0x16610b[_0xce91('0x3d')],function(_0x2222fd){var _0x2282a6={};_0x2282a6[_0x2222fd]={'$like':'%'+_0x53d615[_0xce91('0x39')]['filter']+'%'};return _0x2282a6;})});}_0x16610b=_[_0xce91('0x43')]({},_0x16610b,_0x53d615[_0xce91('0x5b')]);return db[_0xce91('0x5c')][_0xce91('0x5d')](_0x16610b);}})['then'](function(_0x3600fe){if(_0x3600fe){return db['User'][_0xce91('0x5e')]({'where':{'id':_[_0xce91('0x38')](_0x3600fe,_0xce91('0x5f')),'role':'agent'},'attributes':['id',_0xce91('0x32'),_0xce91('0x60'),_0xce91('0x61'),_0xce91('0x62')]});}})[_0xce91('0x2c')](function(_0x1c8a49){if(_0x1c8a49){return{'count':_0x1c8a49['count'],'rows':_[_0xce91('0x38')](_0x1c8a49['rows'],function(_0x2c194c){return{'membername':_0x2c194c[_0xce91('0x32')],'UserId':_0x2c194c['id'],'queue_name':_0x4db164[_0xce91('0x32')],'SmsQueueId':_0x4db164['id'],'interface':util[_0xce91('0x63')](_0xce91('0x64'),_0xce91('0x65'),_0x2c194c['name']),'penalty':0x0,'paused':_0x2c194c[_0xce91('0x60')],'createdAt':_0x2c194c[_0xce91('0x62')],'updatedAt':_0x2c194c[_0xce91('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xce91('0x2c')](respondWithFilteredResult(_0x55544b,_0x16610b))[_0xce91('0x53')](handleError(_0x55544b,null));};exports[_0xce91('0x66')]=function(_0x1392b9,_0x31e1eb,_0x5c91f9){var _0x558024={};var _0x103278={};var _0x375d59;var _0xd4b139;return db[_0xce91('0x34')][_0xce91('0x57')]({'where':{'id':_0x1392b9['params']['id']}})[_0xce91('0x2c')](handleEntityNotFound(_0x31e1eb,null))[_0xce91('0x2c')](function(_0x1130a2){if(_0x1130a2){_0x375d59=_0x1130a2;_0x103278['model']=_[_0xce91('0x49')](db[_0xce91('0x67')][_0xce91('0x4a')]);_0x103278[_0xce91('0x39')]=_[_0xce91('0x49')](_0x1392b9[_0xce91('0x39')]);_0x103278[_0xce91('0x3a')]=_['intersection'](_0x103278[_0xce91('0x3b')],_0x103278[_0xce91('0x39')]);_0x558024[_0xce91('0x3d')]=_[_0xce91('0x4b')](_0x103278[_0xce91('0x3b')],qs[_0xce91('0x3c')](_0x1392b9[_0xce91('0x39')][_0xce91('0x3c')]));_0x558024[_0xce91('0x3d')]=_0x558024[_0xce91('0x3d')][_0xce91('0x4c')]?_0x558024['attributes']:_0x103278[_0xce91('0x3b')];_0x558024[_0xce91('0x3e')]=qs[_0xce91('0x3f')](_0x1392b9['query']['sort']);_0x558024[_0xce91('0x40')]=qs[_0xce91('0x3a')](_[_0xce91('0x59')](_0x1392b9[_0xce91('0x39')],_0x103278[_0xce91('0x3a')]));if(_0x1392b9[_0xce91('0x39')][_0xce91('0x42')]){_0x558024[_0xce91('0x40')]=_[_0xce91('0x43')](_0x558024[_0xce91('0x40')],{'$or':_[_0xce91('0x38')](_0x558024[_0xce91('0x3d')],function(_0x80333f){var _0x326342={};_0x326342[_0x80333f]={'$like':'%'+_0x1392b9[_0xce91('0x39')][_0xce91('0x42')]+'%'};return _0x326342;})});}_0x558024=_[_0xce91('0x43')]({},_0x558024,_0x1392b9[_0xce91('0x5b')]);return _0x375d59[_0xce91('0x66')](_0x558024);}})[_0xce91('0x2c')](function(_0x2d612f){if(_0x2d612f){_0xd4b139=_0x2d612f[_0xce91('0x4c')];if(!_0x1392b9[_0xce91('0x39')][_0xce91('0x68')](_0xce91('0x58'))){_0x558024['limit']=qs['limit'](_0x1392b9[_0xce91('0x39')][_0xce91('0x25')]);_0x558024[_0xce91('0x23')]=qs['offset'](_0x1392b9['query'][_0xce91('0x23')]);}return _0x375d59['getTeams'](_0x558024);}})[_0xce91('0x2c')](function(_0x154052){if(_0x154052){return _0x154052?{'count':_0xd4b139,'rows':_0x154052}:null;}})['then'](respondWithResult(_0x31e1eb,null))['catch'](handleError(_0x31e1eb,null));};exports[_0xce91('0x69')]=function(_0x2318fc,_0x40c292,_0x1bc9a5){var _0x2a95d0=_0x2318fc[_0xce91('0x6a')][_0xce91('0x6b')];return db['Team'][_0xce91('0x5d')]({'where':{'id':_0x2a95d0},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xce91('0x6c'),_0xce91('0x6d'),_0xce91('0x6e')],'raw':!![]}]})[_0xce91('0x2c')](function(_0x5ad98a){if(_0x5ad98a){var _0x685f0c=_['flatMap'](_0x5ad98a,function(_0x590f7f){var _0x2eb80a=_0x590f7f['get']({'plain':!![]});return _0x2eb80a['Agents'];});return db[_0xce91('0x34')]['find']({'where':{'id':_0x2318fc[_0xce91('0x48')]['id']}})[_0xce91('0x2c')](function(_0x2f58a8){return db['sequelize']['transaction'](function(_0x5dedee){return _0x2f58a8['addTeams'](_0x2a95d0,{'transaction':_0x5dedee})[_0xce91('0x2c')](function(){return BPromise['each'](_0x685f0c,function(_0x3dcdb7){return db[_0xce91('0x5c')][_0xce91('0x6f')]({'where':{'UserId':_0x3dcdb7['id'],'SmsQueueId':_0x2318fc[_0xce91('0x48')]['id']},'transaction':_0x5dedee});});})['then'](function(){_0x685f0c['forEach'](function(_0x4feded){socket[_0xce91('0x70')](_0xce91('0x71'),{'UserId':_0x4feded['id'],'SmsQueueId':_0x2f58a8['id']});});});});});}})['then'](respondWithStatusCode(_0x40c292,null))['catch'](handleError(_0x40c292,null));};exports[_0xce91('0x72')]=function(_0xe46345,_0x415398,_0x1f2b2e){return db[_0xce91('0x67')][_0xce91('0x5d')]({'where':{'id':_0xe46345[_0xce91('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xce91('0x73'),'attributes':['id'],'raw':!![]}]})[_0xce91('0x2c')](handleEntityNotFound(_0x415398,null))[_0xce91('0x2c')](function(_0x60367){var _0x874fdf=_[_0xce91('0x38')](_0x60367,'id');var _0xcbe511=[];var _0x2f2a72=[];var _0x4a9943=squel['select']();_0x4a9943[_0xce91('0x74')](_0xce91('0x75'))[_0xce91('0x76')](_0xce91('0x77'),'tq')['join'](_0xce91('0x78'),'ut',_0xce91('0x79'))['where'](_0xce91('0x7a'),_0xe46345[_0xce91('0x48')]['id']);for(var _0x1299b5=0x0;_0x1299b5<_0x60367[_0xce91('0x4c')];_0x1299b5+=0x1){let _0x1b7680=_0x60367[_0x1299b5];for(var _0x5daa47=0x0;_0x5daa47<_0x1b7680[_0xce91('0x73')]['length'];_0x5daa47+=0x1){let _0x5aabd6=_0x1b7680[_0xce91('0x73')][_0x5daa47];var _0x1eef8d=_0x4a9943[_0xce91('0x7b')]();_0x1eef8d[_0xce91('0x40')](_0xce91('0x7c'),_0x5aabd6['id']);_0x2f2a72[_0xce91('0x7d')](db['sequelize'][_0xce91('0x39')](_0x1eef8d[_0xce91('0x7e')](),{'type':db[_0xce91('0x7f')]['QueryTypes'][_0xce91('0x80')]})[_0xce91('0x2c')](function(_0x416643){if(_0x416643['length']===0x1){return _0x5aabd6['id'];}else{var _0x54338a=_[_0xce91('0x81')](_[_0xce91('0x38')](_0x416643,_0xce91('0x82')),function(_0x3d6191){return _[_0xce91('0x83')](_0x874fdf,_0x3d6191);});if(_0x54338a){return _0x5aabd6['id'];}}}));}}return BPromise[_0xce91('0x84')](_0x2f2a72)[_0xce91('0x2c')](function(_0x3a4254){_0xcbe511=_(_0xcbe511)['union'](_0x3a4254)[_0xce91('0x85')]()[_0xce91('0x86')]();return db[_0xce91('0x34')]['find']({'where':{'id':_0xe46345[_0xce91('0x48')]['id']}})[_0xce91('0x2c')](function(_0x373915){return db[_0xce91('0x7f')]['transaction'](function(_0x171fcc){return _0x373915[_0xce91('0x72')](_0xe46345[_0xce91('0x39')][_0xce91('0x6b')],{'transaction':_0x171fcc})[_0xce91('0x2c')](function(){if(!_[_0xce91('0x87')](_0xcbe511)){return _0x373915[_0xce91('0x88')](_0xcbe511,{'transaction':_0x171fcc});}})[_0xce91('0x2c')](function(){_0xcbe511[_0xce91('0x89')](function(_0x3bbe81){socket[_0xce91('0x70')](_0xce91('0x8a'),{'UserId':_0x3bbe81,'SmsQueueId':_0x373915['id']});});});});});});})[_0xce91('0x2c')](respondWithStatusCode(_0x415398,null))[_0xce91('0x53')](handleError(_0x415398,null));};exports['addAgents']=function(_0x502b3f,_0x1084a6,_0x29a9fb){return db[_0xce91('0x34')][_0xce91('0x50')]({'where':{'id':_0x502b3f[_0xce91('0x48')]['id']}})[_0xce91('0x2c')](handleEntityNotFound(_0x1084a6,null))[_0xce91('0x2c')](function(_0x5a47e8){if(_0x5a47e8){return _0x5a47e8[_0xce91('0x8b')](_0x502b3f[_0xce91('0x6a')]['ids'],_[_0xce91('0x8c')](_0x502b3f[_0xce91('0x6a')],[_0xce91('0x6b'),'id'])||{})[_0xce91('0x8d')](function(_0x526efb){for(var _0x5f1b9d=0x0;_0x5f1b9d<_0x502b3f[_0xce91('0x6a')]['ids'][_0xce91('0x4c')];_0x5f1b9d+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x502b3f[_0xce91('0x6a')][_0xce91('0x6b')][_0x5f1b9d]),'SmsQueueId':Number(_0x502b3f[_0xce91('0x48')]['id'])});}return _0x526efb;});}})['then'](respondWithResult(_0x1084a6,null))[_0xce91('0x53')](handleError(_0x1084a6,null));};exports['removeAgents']=function(_0x173595,_0x3ba38b,_0xf6db70){return db[_0xce91('0x34')]['find']({'where':{'id':_0x173595[_0xce91('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ba38b,null))[_0xce91('0x2c')](function(_0x33bff0){if(_0x33bff0){return _0x33bff0[_0xce91('0x88')](_0x173595[_0xce91('0x39')][_0xce91('0x6b')])[_0xce91('0x2c')](function(){if(_[_0xce91('0x8e')](_0x173595[_0xce91('0x39')]['ids'])){for(var _0x363c70=0x0;_0x363c70<_0x173595[_0xce91('0x39')]['ids']['length'];_0x363c70+=0x1){socket[_0xce91('0x70')](_0xce91('0x8a'),{'UserId':Number(_0x173595[_0xce91('0x39')][_0xce91('0x6b')][_0x363c70]),'SmsQueueId':Number(_0x173595[_0xce91('0x48')]['id'])});}}else{socket[_0xce91('0x70')](_0xce91('0x8a'),{'UserId':Number(_0x173595[_0xce91('0x39')][_0xce91('0x6b')]),'SmsQueueId':Number(_0x173595[_0xce91('0x48')]['id'])});}});}})[_0xce91('0x2c')](respondWithStatusCode(_0x3ba38b,null))[_0xce91('0x53')](handleError(_0x3ba38b,null));};exports[_0xce91('0x8f')]=function(_0x3c56ab,_0x2c8b4d,_0x556a57){var _0xd99b69={};var _0x34da43={};var _0x3eac06;var _0x2bda58;return db[_0xce91('0x34')][_0xce91('0x57')]({'where':{'id':_0x3c56ab[_0xce91('0x48')]['id']}})[_0xce91('0x2c')](handleEntityNotFound(_0x2c8b4d,null))['then'](function(_0x520810){if(_0x520810){_0x3eac06=_0x520810;_0x34da43[_0xce91('0x3b')]=_[_0xce91('0x49')](db[_0xce91('0x90')][_0xce91('0x4a')]);_0x34da43['query']=_['keys'](_0x3c56ab[_0xce91('0x39')]);_0x34da43[_0xce91('0x3a')]=_['intersection'](_0x34da43[_0xce91('0x3b')],_0x34da43['query']);_0xd99b69[_0xce91('0x3d')]=_[_0xce91('0x4b')](_0x34da43[_0xce91('0x3b')],qs[_0xce91('0x3c')](_0x3c56ab[_0xce91('0x39')]['fields']));_0xd99b69['attributes']=_0xd99b69[_0xce91('0x3d')]['length']?_0xd99b69[_0xce91('0x3d')]:_0x34da43['model'];_0xd99b69['order']=qs[_0xce91('0x3f')](_0x3c56ab[_0xce91('0x39')][_0xce91('0x3f')]);_0xd99b69['where']=qs[_0xce91('0x3a')](_[_0xce91('0x59')](_0x3c56ab[_0xce91('0x39')],_0x34da43['filters']));if(_0x3c56ab[_0xce91('0x39')]['filter']){_0xd99b69[_0xce91('0x40')]=_[_0xce91('0x43')](_0xd99b69['where'],{'$or':_[_0xce91('0x38')](_0xd99b69[_0xce91('0x3d')],function(_0x4857f3){var _0x3880fa={};_0x3880fa[_0x4857f3]={'$like':'%'+_0x3c56ab[_0xce91('0x39')]['filter']+'%'};return _0x3880fa;})});}_0xd99b69=_[_0xce91('0x43')]({},_0xd99b69,_0x3c56ab['options']);return _0x3eac06[_0xce91('0x8f')](_0xd99b69);}})[_0xce91('0x2c')](function(_0x546ba3){if(_0x546ba3){_0x2bda58=_0x546ba3['length'];if(!_0x3c56ab[_0xce91('0x39')]['hasOwnProperty'](_0xce91('0x58'))){_0xd99b69[_0xce91('0x25')]=qs[_0xce91('0x25')](_0x3c56ab[_0xce91('0x39')]['limit']);_0xd99b69[_0xce91('0x23')]=qs['offset'](_0x3c56ab[_0xce91('0x39')][_0xce91('0x23')]);}return _0x3eac06[_0xce91('0x8f')](_0xd99b69);}})[_0xce91('0x2c')](function(_0x30c868){if(_0x30c868){return _0x30c868?{'count':_0x2bda58,'rows':_0x30c868}:null;}})[_0xce91('0x2c')](respondWithResult(_0x2c8b4d,null))[_0xce91('0x53')](handleError(_0x2c8b4d,null));}; \ No newline at end of file +var _0x6b1e=['union','compact','value','isEmpty','userSmsQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','hasOwnProperty','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','SmsQueues','UserProfileResource','end','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','findAll','rows','show','params','keys','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','UserId','agent','createdAt','format','%s/%s','smsPause','updatedAt','getTeams','Team','online','voicePause','interface','Agents','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','all'];(function(_0x4f33ee,_0x4d0f6d){var _0x307e2d=function(_0x2020aa){while(--_0x2020aa){_0x4f33ee['push'](_0x4f33ee['shift']());}};_0x307e2d(++_0x4d0f6d);}(_0x6b1e,0x9a));var _0xe6b1=function(_0x2d3141,_0x5969fb){_0x2d3141=_0x2d3141-0x0;var _0x21b6f7=_0x6b1e[_0x2d3141];return _0x21b6f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6b1('0x0'));var rp=require(_0xe6b1('0x1'));var moment=require(_0xe6b1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe6b1('0x3'));var util=require(_0xe6b1('0x4'));var path=require('path');var sox=require(_0xe6b1('0x5'));var csv=require('to-csv');var ejs=require(_0xe6b1('0x6'));var fs=require('fs');var fs_extra=require(_0xe6b1('0x7'));var _=require(_0xe6b1('0x8'));var squel=require(_0xe6b1('0x9'));var crypto=require(_0xe6b1('0xa'));var jsforce=require(_0xe6b1('0xb'));var deskjs=require(_0xe6b1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe6b1('0xd'));var Papa=require(_0xe6b1('0xe'));var Redis=require(_0xe6b1('0xf'));var authService=require(_0xe6b1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe6b1('0x11'));var hardwareService=require(_0xe6b1('0x12'));var logger=require('../../config/logger')(_0xe6b1('0x13'));var utils=require(_0xe6b1('0x14'));var config=require(_0xe6b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6b1('0x16'))['db'];config[_0xe6b1('0x17')]=_[_0xe6b1('0x18')](config['redis'],{'host':_0xe6b1('0x19'),'port':0x18eb});var socket=require(_0xe6b1('0x1a'))(new Redis(config['redis']));require(_0xe6b1('0x1b'))[_0xe6b1('0x1c')](socket);function respondWithStatusCode(_0x2e7475,_0x56c39a){_0x56c39a=_0x56c39a||0xcc;return function(_0x530e38){if(_0x530e38){return _0x2e7475[_0xe6b1('0x1d')](_0x56c39a);}return _0x2e7475[_0xe6b1('0x1e')](_0x56c39a)['end']();};}function respondWithResult(_0x197438,_0x49b0f1){_0x49b0f1=_0x49b0f1||0xc8;return function(_0x3bc7d8){if(_0x3bc7d8){return _0x197438[_0xe6b1('0x1e')](_0x49b0f1)[_0xe6b1('0x1f')](_0x3bc7d8);}};}function respondWithFilteredResult(_0x38502f,_0x2cf96a){return function(_0x146634){if(_0x146634){var _0xf2c902=typeof _0x2cf96a[_0xe6b1('0x20')]===_0xe6b1('0x21')&&typeof _0x2cf96a[_0xe6b1('0x22')]===_0xe6b1('0x21');var _0x3bc7c2=_0x146634['count'];var _0x4daa62=_0xf2c902?0x0:_0x2cf96a[_0xe6b1('0x20')];var _0x5b0c7d=_0xf2c902?_0x146634[_0xe6b1('0x23')]:_0x2cf96a['offset']+_0x2cf96a[_0xe6b1('0x22')];var _0x2773bf;if(_0x5b0c7d>=_0x3bc7c2){_0x5b0c7d=_0x3bc7c2;_0x2773bf=0xc8;}else{_0x2773bf=0xce;}_0x38502f[_0xe6b1('0x1e')](_0x2773bf);return _0x38502f[_0xe6b1('0x24')](_0xe6b1('0x25'),_0x4daa62+'-'+_0x5b0c7d+'/'+_0x3bc7c2)['json'](_0x146634);}return null;};}function patchUpdates(_0x27843f){return function(_0x262f34){try{jsonpatch[_0xe6b1('0x26')](_0x262f34,_0x27843f,!![]);}catch(_0x45334d){return BPromise[_0xe6b1('0x27')](_0x45334d);}return _0x262f34[_0xe6b1('0x28')]();};}function saveUpdates(_0x311d08,_0x511795){return function(_0x2580c2){if(_0x2580c2){return _0x2580c2['update'](_0x311d08)['then'](function(_0x4a7840){return _0x4a7840;});}return null;};}function removeEntity(_0x2532d6,_0x43a5e0){return function(_0x2112c7){if(_0x2112c7){return _0x2112c7[_0xe6b1('0x29')]()[_0xe6b1('0x2a')](function(){var _0x135477=_0x2112c7[_0xe6b1('0x2b')]({'plain':!![]});var _0xd6ed1b=_0xe6b1('0x2c');return db[_0xe6b1('0x2d')][_0xe6b1('0x29')]({'where':{'type':_0xd6ed1b,'resourceId':_0x135477['id']}})[_0xe6b1('0x2a')](function(){return _0x2112c7;});})['then'](function(){_0x2532d6[_0xe6b1('0x1e')](0xcc)[_0xe6b1('0x2e')]();});}};}function handleEntityNotFound(_0x5eb115,_0xfd5f90){return function(_0x9ed3e8){if(!_0x9ed3e8){_0x5eb115[_0xe6b1('0x1d')](0x194);}return _0x9ed3e8;};}function handleError(_0x5e8d73,_0x216b0a){_0x216b0a=_0x216b0a||0x1f4;return function(_0x1e5e1d){logger[_0xe6b1('0x2f')](_0x1e5e1d[_0xe6b1('0x30')]);if(_0x1e5e1d[_0xe6b1('0x31')]){delete _0x1e5e1d[_0xe6b1('0x31')];}_0x5e8d73['status'](_0x216b0a)[_0xe6b1('0x32')](_0x1e5e1d);};}exports[_0xe6b1('0x33')]=function(_0x8b8226,_0x548672){var _0xfe89e1={},_0x3db105={},_0x2988e5={'count':0x0,'rows':[]};var _0x72cb28=_[_0xe6b1('0x34')](db[_0xe6b1('0x35')][_0xe6b1('0x36')],function(_0x2d8709){return{'name':_0x2d8709[_0xe6b1('0x37')],'type':_0x2d8709['type']['key']};});_0x3db105[_0xe6b1('0x38')]=_[_0xe6b1('0x34')](_0x72cb28,_0xe6b1('0x31'));_0x3db105['query']=_['keys'](_0x8b8226[_0xe6b1('0x39')]);_0x3db105[_0xe6b1('0x3a')]=_['intersection'](_0x3db105[_0xe6b1('0x38')],_0x3db105[_0xe6b1('0x39')]);_0xfe89e1[_0xe6b1('0x3b')]=_[_0xe6b1('0x3c')](_0x3db105[_0xe6b1('0x38')],qs[_0xe6b1('0x3d')](_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x3d')]));_0xfe89e1['attributes']=_0xfe89e1[_0xe6b1('0x3b')][_0xe6b1('0x3e')]?_0xfe89e1[_0xe6b1('0x3b')]:_0x3db105[_0xe6b1('0x38')];if(!_0x8b8226['query']['hasOwnProperty'](_0xe6b1('0x3f'))){_0xfe89e1[_0xe6b1('0x22')]=qs[_0xe6b1('0x22')](_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x22')]);_0xfe89e1['offset']=qs[_0xe6b1('0x20')](_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x20')]);}_0xfe89e1[_0xe6b1('0x40')]=qs[_0xe6b1('0x41')](_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x41')]);_0xfe89e1[_0xe6b1('0x42')]=qs[_0xe6b1('0x3a')](_[_0xe6b1('0x43')](_0x8b8226[_0xe6b1('0x39')],_0x3db105['filters']),_0x72cb28);if(_0x8b8226[_0xe6b1('0x39')]['filter']){_0xfe89e1[_0xe6b1('0x42')]=_[_0xe6b1('0x44')](_0xfe89e1[_0xe6b1('0x42')],{'$or':_[_0xe6b1('0x34')](_0x72cb28,function(_0x32260d){if(_0x32260d[_0xe6b1('0x45')]!=='VIRTUAL'){var _0xf27b3a={};_0xf27b3a[_0x32260d[_0xe6b1('0x31')]]={'$like':'%'+_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x46')]+'%'};return _0xf27b3a;}})});}_0xfe89e1=_[_0xe6b1('0x44')]({},_0xfe89e1,_0x8b8226['options']);var _0x1ae074={'where':_0xfe89e1[_0xe6b1('0x42')]};return db[_0xe6b1('0x35')][_0xe6b1('0x23')](_0x1ae074)[_0xe6b1('0x2a')](function(_0x4b4e23){_0x2988e5[_0xe6b1('0x23')]=_0x4b4e23;if(_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x47')]){_0xfe89e1[_0xe6b1('0x48')]=[{'all':!![]}];}return db[_0xe6b1('0x35')][_0xe6b1('0x49')](_0xfe89e1);})[_0xe6b1('0x2a')](function(_0x319fa1){_0x2988e5[_0xe6b1('0x4a')]=_0x319fa1;return _0x2988e5;})[_0xe6b1('0x2a')](respondWithFilteredResult(_0x548672,_0xfe89e1))['catch'](handleError(_0x548672,null));};exports[_0xe6b1('0x4b')]=function(_0x11bd14,_0x2ac5d9){var _0x410004={'raw':!![],'where':{'id':_0x11bd14[_0xe6b1('0x4c')]['id']}},_0x1c9b6e={};_0x1c9b6e[_0xe6b1('0x38')]=_[_0xe6b1('0x4d')](db['SmsQueue'][_0xe6b1('0x36')]);_0x1c9b6e['query']=_[_0xe6b1('0x4d')](_0x11bd14[_0xe6b1('0x39')]);_0x1c9b6e[_0xe6b1('0x3a')]=_['intersection'](_0x1c9b6e[_0xe6b1('0x38')],_0x1c9b6e[_0xe6b1('0x39')]);_0x410004[_0xe6b1('0x3b')]=_[_0xe6b1('0x3c')](_0x1c9b6e[_0xe6b1('0x38')],qs[_0xe6b1('0x3d')](_0x11bd14['query']['fields']));_0x410004[_0xe6b1('0x3b')]=_0x410004[_0xe6b1('0x3b')]['length']?_0x410004[_0xe6b1('0x3b')]:_0x1c9b6e[_0xe6b1('0x38')];if(_0x11bd14[_0xe6b1('0x39')][_0xe6b1('0x47')]){_0x410004[_0xe6b1('0x48')]=[{'all':!![]}];}_0x410004=_[_0xe6b1('0x44')]({},_0x410004,_0x11bd14[_0xe6b1('0x4e')]);return db['SmsQueue']['find'](_0x410004)[_0xe6b1('0x2a')](handleEntityNotFound(_0x2ac5d9,null))['then'](respondWithResult(_0x2ac5d9,null))[_0xe6b1('0x4f')](handleError(_0x2ac5d9,null));};exports[_0xe6b1('0x50')]=function(_0x51c935,_0x532457){return db['SmsQueue'][_0xe6b1('0x50')](_0x51c935['body'],{})[_0xe6b1('0x2a')](function(_0x11b555){var _0x4e83f6=_0x51c935[_0xe6b1('0x51')][_0xe6b1('0x2b')]({'plain':!![]});if(!_0x4e83f6)throw new Error(_0xe6b1('0x52'));if(_0x4e83f6[_0xe6b1('0x53')]===_0xe6b1('0x51')){var _0x406f73=_0x11b555[_0xe6b1('0x2b')]({'plain':!![]});var _0x215da7=_0xe6b1('0x2c');return db[_0xe6b1('0x54')][_0xe6b1('0x55')]({'where':{'name':_0x215da7,'userProfileId':_0x4e83f6[_0xe6b1('0x56')]},'raw':!![]})[_0xe6b1('0x2a')](function(_0x104edd){if(_0x104edd&&_0x104edd[_0xe6b1('0x57')]===0x0){return db[_0xe6b1('0x2d')][_0xe6b1('0x50')]({'name':_0x406f73[_0xe6b1('0x31')],'resourceId':_0x406f73['id'],'type':_0x104edd['name'],'sectionId':_0x104edd['id']},{})[_0xe6b1('0x2a')](function(){return _0x11b555;});}else{return _0x11b555;}})[_0xe6b1('0x4f')](function(_0x1e5929){logger['error'](_0xe6b1('0x58'),_0x1e5929);throw _0x1e5929;});}return _0x11b555;})[_0xe6b1('0x2a')](respondWithResult(_0x532457,0xc9))[_0xe6b1('0x4f')](handleError(_0x532457,null));};exports['update']=function(_0x52b16c,_0x3c6d76){if(_0x52b16c['body']['id']){delete _0x52b16c[_0xe6b1('0x59')]['id'];}return db['SmsQueue'][_0xe6b1('0x55')]({'where':{'id':_0x52b16c[_0xe6b1('0x4c')]['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x3c6d76,null))[_0xe6b1('0x2a')](saveUpdates(_0x52b16c['body'],null))[_0xe6b1('0x2a')](respondWithResult(_0x3c6d76,null))[_0xe6b1('0x4f')](handleError(_0x3c6d76,null));};exports['destroy']=function(_0x304aa5,_0x26ea1a){return db[_0xe6b1('0x35')][_0xe6b1('0x55')]({'where':{'id':_0x304aa5[_0xe6b1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26ea1a,null))['then'](removeEntity(_0x26ea1a,null))[_0xe6b1('0x4f')](handleError(_0x26ea1a,null));};exports[_0xe6b1('0x5a')]=function(_0x10247a,_0x547a18){return db[_0xe6b1('0x35')]['describe']()['then'](respondWithResult(_0x547a18,null))[_0xe6b1('0x4f')](handleError(_0x547a18,null));};exports[_0xe6b1('0x5b')]=function(_0x1776d1,_0x5e9638,_0x229203){var _0xfb7cf5={'raw':!![],'where':{}},_0x480f80={},_0x30be72;return db[_0xe6b1('0x35')][_0xe6b1('0x5c')]({'where':{'id':_0x1776d1[_0xe6b1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e9638,null))['then'](function(_0x1bd913){if(_0x1bd913){_0x30be72=_0x1bd913[_0xe6b1('0x2b')]({'plain':!![]});_0x480f80[_0xe6b1('0x38')]=_[_0xe6b1('0x4d')](db[_0xe6b1('0x5d')]['rawAttributes']);_0x480f80['query']=_[_0xe6b1('0x4d')](_0x1776d1['query']);_0x480f80['filters']=_[_0xe6b1('0x3c')](_0x480f80['model'],_0x480f80[_0xe6b1('0x39')]);_0xfb7cf5[_0xe6b1('0x3b')]=_['intersection'](_0x480f80[_0xe6b1('0x38')],qs['fields'](_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x3d')]));_0xfb7cf5[_0xe6b1('0x3b')]=_0xfb7cf5['attributes']['length']?_0xfb7cf5[_0xe6b1('0x3b')]:_0x480f80['model'];if(!_0x1776d1[_0xe6b1('0x39')]['hasOwnProperty'](_0xe6b1('0x3f'))){_0xfb7cf5[_0xe6b1('0x22')]=qs[_0xe6b1('0x22')](_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x22')]);_0xfb7cf5[_0xe6b1('0x20')]=qs[_0xe6b1('0x20')](_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x20')]);}_0xfb7cf5[_0xe6b1('0x40')]=qs[_0xe6b1('0x41')](_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x41')]);_0xfb7cf5[_0xe6b1('0x42')]=qs[_0xe6b1('0x3a')](_[_0xe6b1('0x43')](_0x1776d1['query'],_0x480f80[_0xe6b1('0x3a')]));_0xfb7cf5[_0xe6b1('0x42')][_0xe6b1('0x5e')]=_0x1bd913['id'];if(_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x46')]){_0xfb7cf5[_0xe6b1('0x42')]=_['merge'](_0xfb7cf5[_0xe6b1('0x42')],{'$or':_[_0xe6b1('0x34')](_0xfb7cf5['attributes'],function(_0x6b6aa3){var _0x2d86ac={};_0x2d86ac[_0x6b6aa3]={'$like':'%'+_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x46')]+'%'};return _0x2d86ac;})});}_0xfb7cf5=_[_0xe6b1('0x44')]({},_0xfb7cf5,_0x1776d1[_0xe6b1('0x4e')]);return db[_0xe6b1('0x5d')][_0xe6b1('0x49')](_0xfb7cf5);}})[_0xe6b1('0x2a')](function(_0x53b4e8){if(_0x53b4e8){return db[_0xe6b1('0x5f')]['findAndCountAll']({'where':{'id':_[_0xe6b1('0x34')](_0x53b4e8,_0xe6b1('0x60')),'role':_0xe6b1('0x61')},'attributes':['id',_0xe6b1('0x31'),'smsPause','updatedAt',_0xe6b1('0x62')]});}})[_0xe6b1('0x2a')](function(_0x3c25e8){if(_0x3c25e8){return{'count':_0x3c25e8[_0xe6b1('0x23')],'rows':_['map'](_0x3c25e8['rows'],function(_0x47c712){return{'membername':_0x47c712[_0xe6b1('0x31')],'UserId':_0x47c712['id'],'queue_name':_0x30be72['name'],'SmsQueueId':_0x30be72['id'],'interface':util[_0xe6b1('0x63')](_0xe6b1('0x64'),'SIP',_0x47c712['name']),'penalty':0x0,'paused':_0x47c712[_0xe6b1('0x65')],'createdAt':_0x47c712[_0xe6b1('0x62')],'updatedAt':_0x47c712[_0xe6b1('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe6b1('0x2a')](respondWithFilteredResult(_0x5e9638,_0xfb7cf5))[_0xe6b1('0x4f')](handleError(_0x5e9638,null));};exports[_0xe6b1('0x67')]=function(_0x56bc64,_0x1cb403,_0x279180){var _0x4e6bca={};var _0x8c0357={};var _0x2698e4;var _0x5d3b93;return db[_0xe6b1('0x35')][_0xe6b1('0x5c')]({'where':{'id':_0x56bc64['params']['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x1cb403,null))[_0xe6b1('0x2a')](function(_0x4e7a67){if(_0x4e7a67){_0x2698e4=_0x4e7a67;_0x8c0357['model']=_[_0xe6b1('0x4d')](db[_0xe6b1('0x68')][_0xe6b1('0x36')]);_0x8c0357['query']=_[_0xe6b1('0x4d')](_0x56bc64[_0xe6b1('0x39')]);_0x8c0357[_0xe6b1('0x3a')]=_['intersection'](_0x8c0357[_0xe6b1('0x38')],_0x8c0357['query']);_0x4e6bca[_0xe6b1('0x3b')]=_[_0xe6b1('0x3c')](_0x8c0357['model'],qs[_0xe6b1('0x3d')](_0x56bc64['query']['fields']));_0x4e6bca[_0xe6b1('0x3b')]=_0x4e6bca[_0xe6b1('0x3b')][_0xe6b1('0x3e')]?_0x4e6bca['attributes']:_0x8c0357[_0xe6b1('0x38')];_0x4e6bca[_0xe6b1('0x40')]=qs[_0xe6b1('0x41')](_0x56bc64['query'][_0xe6b1('0x41')]);_0x4e6bca['where']=qs[_0xe6b1('0x3a')](_[_0xe6b1('0x43')](_0x56bc64[_0xe6b1('0x39')],_0x8c0357[_0xe6b1('0x3a')]));if(_0x56bc64['query'][_0xe6b1('0x46')]){_0x4e6bca[_0xe6b1('0x42')]=_[_0xe6b1('0x44')](_0x4e6bca[_0xe6b1('0x42')],{'$or':_[_0xe6b1('0x34')](_0x4e6bca['attributes'],function(_0x2daff4){var _0x533bbb={};_0x533bbb[_0x2daff4]={'$like':'%'+_0x56bc64['query']['filter']+'%'};return _0x533bbb;})});}_0x4e6bca=_[_0xe6b1('0x44')]({},_0x4e6bca,_0x56bc64[_0xe6b1('0x4e')]);return _0x2698e4[_0xe6b1('0x67')](_0x4e6bca);}})[_0xe6b1('0x2a')](function(_0x1f773e){if(_0x1f773e){_0x5d3b93=_0x1f773e[_0xe6b1('0x3e')];if(!_0x56bc64[_0xe6b1('0x39')]['hasOwnProperty'](_0xe6b1('0x3f'))){_0x4e6bca[_0xe6b1('0x22')]=qs[_0xe6b1('0x22')](_0x56bc64[_0xe6b1('0x39')][_0xe6b1('0x22')]);_0x4e6bca[_0xe6b1('0x20')]=qs[_0xe6b1('0x20')](_0x56bc64['query'][_0xe6b1('0x20')]);}return _0x2698e4['getTeams'](_0x4e6bca);}})['then'](function(_0x349aa2){if(_0x349aa2){return _0x349aa2?{'count':_0x5d3b93,'rows':_0x349aa2}:null;}})['then'](respondWithResult(_0x1cb403,null))[_0xe6b1('0x4f')](handleError(_0x1cb403,null));};exports['addTeams']=function(_0xc46f12,_0x4649bd,_0x5975d6){var _0x19ce55=_0xc46f12[_0xe6b1('0x59')]['ids'];return db['Team']['findAll']({'where':{'id':_0x19ce55},'attributes':['id'],'include':[{'model':db[_0xe6b1('0x5f')],'as':'Agents','attributes':['id','name',_0xe6b1('0x69'),_0xe6b1('0x6a'),_0xe6b1('0x6b')],'raw':!![]}]})[_0xe6b1('0x2a')](function(_0x418c74){if(_0x418c74){var _0x1cec7e=_['flatMap'](_0x418c74,function(_0x3ed66b){var _0x73ec2c=_0x3ed66b[_0xe6b1('0x2b')]({'plain':!![]});return _0x73ec2c[_0xe6b1('0x6c')];});return db['SmsQueue'][_0xe6b1('0x55')]({'where':{'id':_0xc46f12[_0xe6b1('0x4c')]['id']}})[_0xe6b1('0x2a')](function(_0x3c88b0){return db[_0xe6b1('0x6d')][_0xe6b1('0x6e')](function(_0x1d74e5){return _0x3c88b0[_0xe6b1('0x6f')](_0x19ce55,{'transaction':_0x1d74e5})[_0xe6b1('0x2a')](function(){return BPromise['each'](_0x1cec7e,function(_0x1acd10){return db[_0xe6b1('0x5d')]['findOrCreate']({'where':{'UserId':_0x1acd10['id'],'SmsQueueId':_0xc46f12[_0xe6b1('0x4c')]['id']},'transaction':_0x1d74e5});});})[_0xe6b1('0x2a')](function(){_0x1cec7e[_0xe6b1('0x70')](function(_0x1e52fc){socket[_0xe6b1('0x71')](_0xe6b1('0x72'),{'UserId':_0x1e52fc['id'],'SmsQueueId':_0x3c88b0['id']});});});});});}})[_0xe6b1('0x2a')](respondWithStatusCode(_0x4649bd,null))[_0xe6b1('0x4f')](handleError(_0x4649bd,null));};exports[_0xe6b1('0x73')]=function(_0x77d1ac,_0x336fc4,_0x147752){return db[_0xe6b1('0x68')][_0xe6b1('0x49')]({'where':{'id':_0x77d1ac['query'][_0xe6b1('0x74')]},'attributes':['id'],'include':[{'model':db[_0xe6b1('0x5f')],'as':_0xe6b1('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x336fc4,null))[_0xe6b1('0x2a')](function(_0x12b583){var _0x2d764b=_[_0xe6b1('0x34')](_0x12b583,'id');var _0x7f6f96=[];var _0x421527=[];var _0x3e82f5=squel[_0xe6b1('0x75')]();_0x3e82f5[_0xe6b1('0x76')](_0xe6b1('0x77'))['from'](_0xe6b1('0x78'),'tq')[_0xe6b1('0x79')](_0xe6b1('0x7a'),'ut',_0xe6b1('0x7b'))[_0xe6b1('0x42')](_0xe6b1('0x7c'),_0x77d1ac[_0xe6b1('0x4c')]['id']);for(var _0x5b196e=0x0;_0x5b196e<_0x12b583['length'];_0x5b196e+=0x1){let _0x14973c=_0x12b583[_0x5b196e];for(var _0x5144c5=0x0;_0x5144c5<_0x14973c[_0xe6b1('0x6c')][_0xe6b1('0x3e')];_0x5144c5+=0x1){let _0x29ac82=_0x14973c[_0xe6b1('0x6c')][_0x5144c5];var _0x4158e2=_0x3e82f5[_0xe6b1('0x7d')]();_0x4158e2[_0xe6b1('0x42')]('ut.UserId\x20=\x20?',_0x29ac82['id']);_0x421527['push'](db['sequelize'][_0xe6b1('0x39')](_0x4158e2[_0xe6b1('0x7e')](),{'type':db[_0xe6b1('0x6d')][_0xe6b1('0x7f')][_0xe6b1('0x80')]})[_0xe6b1('0x2a')](function(_0x31291d){if(_0x31291d['length']===0x1){return _0x29ac82['id'];}else{var _0x198c3c=_[_0xe6b1('0x81')](_['map'](_0x31291d,_0xe6b1('0x82')),function(_0xf8165f){return _['includes'](_0x2d764b,_0xf8165f);});if(_0x198c3c){return _0x29ac82['id'];}}}));}}return BPromise[_0xe6b1('0x83')](_0x421527)[_0xe6b1('0x2a')](function(_0x48bef5){_0x7f6f96=_(_0x7f6f96)[_0xe6b1('0x84')](_0x48bef5)[_0xe6b1('0x85')]()[_0xe6b1('0x86')]();return db[_0xe6b1('0x35')][_0xe6b1('0x55')]({'where':{'id':_0x77d1ac[_0xe6b1('0x4c')]['id']}})['then'](function(_0xf7a8b5){return db['sequelize'][_0xe6b1('0x6e')](function(_0x5530be){return _0xf7a8b5[_0xe6b1('0x73')](_0x77d1ac[_0xe6b1('0x39')][_0xe6b1('0x74')],{'transaction':_0x5530be})[_0xe6b1('0x2a')](function(){if(!_[_0xe6b1('0x87')](_0x7f6f96)){return _0xf7a8b5['removeAgents'](_0x7f6f96,{'transaction':_0x5530be});}})['then'](function(){_0x7f6f96[_0xe6b1('0x70')](function(_0x44b8ad){socket[_0xe6b1('0x71')](_0xe6b1('0x88'),{'UserId':_0x44b8ad,'SmsQueueId':_0xf7a8b5['id']});});});});});});})[_0xe6b1('0x2a')](respondWithStatusCode(_0x336fc4,null))['catch'](handleError(_0x336fc4,null));};exports[_0xe6b1('0x89')]=function(_0x3d8c0d,_0x22cc08,_0x139a98){return db[_0xe6b1('0x35')][_0xe6b1('0x55')]({'where':{'id':_0x3d8c0d[_0xe6b1('0x4c')]['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x22cc08,null))[_0xe6b1('0x2a')](function(_0x27f166){if(_0x27f166){return _0x27f166[_0xe6b1('0x89')](_0x3d8c0d[_0xe6b1('0x59')][_0xe6b1('0x74')],_[_0xe6b1('0x8a')](_0x3d8c0d[_0xe6b1('0x59')],[_0xe6b1('0x74'),'id'])||{})['spread'](function(_0x30dd76){for(var _0x2d84fa=0x0;_0x2d84fa<_0x3d8c0d['body'][_0xe6b1('0x74')]['length'];_0x2d84fa+=0x1){socket[_0xe6b1('0x71')]('userSmsQueue:save',{'UserId':Number(_0x3d8c0d['body'][_0xe6b1('0x74')][_0x2d84fa]),'SmsQueueId':Number(_0x3d8c0d['params']['id'])});}return _0x30dd76;});}})[_0xe6b1('0x2a')](respondWithResult(_0x22cc08,null))['catch'](handleError(_0x22cc08,null));};exports[_0xe6b1('0x8b')]=function(_0x5c3dcf,_0x4f171c,_0x39c207){return db[_0xe6b1('0x35')][_0xe6b1('0x55')]({'where':{'id':_0x5c3dcf['params']['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x4f171c,null))[_0xe6b1('0x2a')](function(_0x3197e3){if(_0x3197e3){return _0x3197e3[_0xe6b1('0x8b')](_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')])[_0xe6b1('0x2a')](function(){if(_[_0xe6b1('0x8c')](_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')])){for(var _0x2ac8ee=0x0;_0x2ac8ee<_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')][_0xe6b1('0x3e')];_0x2ac8ee+=0x1){socket[_0xe6b1('0x71')](_0xe6b1('0x88'),{'UserId':Number(_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')][_0x2ac8ee]),'SmsQueueId':Number(_0x5c3dcf['params']['id'])});}}else{socket[_0xe6b1('0x71')](_0xe6b1('0x88'),{'UserId':Number(_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')]),'SmsQueueId':Number(_0x5c3dcf[_0xe6b1('0x4c')]['id'])});}});}})[_0xe6b1('0x2a')](respondWithStatusCode(_0x4f171c,null))[_0xe6b1('0x4f')](handleError(_0x4f171c,null));};exports[_0xe6b1('0x8d')]=function(_0x547072,_0x2feed9,_0x477d1d){var _0x52d486={};var _0x2f019b={};var _0x13385e;var _0x44c112;return db[_0xe6b1('0x35')][_0xe6b1('0x5c')]({'where':{'id':_0x547072[_0xe6b1('0x4c')]['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x2feed9,null))['then'](function(_0x321101){if(_0x321101){_0x13385e=_0x321101;_0x2f019b['model']=_['keys'](db[_0xe6b1('0x5f')][_0xe6b1('0x36')]);_0x2f019b['query']=_[_0xe6b1('0x4d')](_0x547072[_0xe6b1('0x39')]);_0x2f019b[_0xe6b1('0x3a')]=_[_0xe6b1('0x3c')](_0x2f019b[_0xe6b1('0x38')],_0x2f019b[_0xe6b1('0x39')]);_0x52d486[_0xe6b1('0x3b')]=_[_0xe6b1('0x3c')](_0x2f019b[_0xe6b1('0x38')],qs['fields'](_0x547072[_0xe6b1('0x39')][_0xe6b1('0x3d')]));_0x52d486[_0xe6b1('0x3b')]=_0x52d486[_0xe6b1('0x3b')]['length']?_0x52d486[_0xe6b1('0x3b')]:_0x2f019b[_0xe6b1('0x38')];_0x52d486['order']=qs['sort'](_0x547072[_0xe6b1('0x39')][_0xe6b1('0x41')]);_0x52d486['where']=qs[_0xe6b1('0x3a')](_[_0xe6b1('0x43')](_0x547072[_0xe6b1('0x39')],_0x2f019b[_0xe6b1('0x3a')]));if(_0x547072[_0xe6b1('0x39')][_0xe6b1('0x46')]){_0x52d486[_0xe6b1('0x42')]=_[_0xe6b1('0x44')](_0x52d486[_0xe6b1('0x42')],{'$or':_[_0xe6b1('0x34')](_0x52d486[_0xe6b1('0x3b')],function(_0x39b9e7){var _0x5032a2={};_0x5032a2[_0x39b9e7]={'$like':'%'+_0x547072['query'][_0xe6b1('0x46')]+'%'};return _0x5032a2;})});}_0x52d486=_[_0xe6b1('0x44')]({},_0x52d486,_0x547072[_0xe6b1('0x4e')]);return _0x13385e[_0xe6b1('0x8d')](_0x52d486);}})[_0xe6b1('0x2a')](function(_0x3ef627){if(_0x3ef627){_0x44c112=_0x3ef627[_0xe6b1('0x3e')];if(!_0x547072[_0xe6b1('0x39')][_0xe6b1('0x8e')](_0xe6b1('0x3f'))){_0x52d486['limit']=qs[_0xe6b1('0x22')](_0x547072[_0xe6b1('0x39')][_0xe6b1('0x22')]);_0x52d486[_0xe6b1('0x20')]=qs[_0xe6b1('0x20')](_0x547072[_0xe6b1('0x39')][_0xe6b1('0x20')]);}return _0x13385e[_0xe6b1('0x8d')](_0x52d486);}})[_0xe6b1('0x2a')](function(_0x47e798){if(_0x47e798){return _0x47e798?{'count':_0x44c112,'rows':_0x47e798}:null;}})[_0xe6b1('0x2a')](respondWithResult(_0x2feed9,null))[_0xe6b1('0x4f')](handleError(_0x2feed9,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 22a7796..c11e575 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 _0x3ccc=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb','SmsQueue'];(function(_0x2e854f,_0x498724){var _0x1f383a=function(_0xe8cd9){while(--_0xe8cd9){_0x2e854f['push'](_0x2e854f['shift']());}};_0x1f383a(++_0x498724);}(_0x3ccc,0x1ae));var _0xc3cc=function(_0x552041,_0xc34ee7){_0x552041=_0x552041-0x0;var _0x198a1a=_0x3ccc[_0x552041];return _0x198a1a;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xc3cc('0x0'))['db'][_0xc3cc('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc3cc('0x2')](0x0);var events={'afterCreate':_0xc3cc('0x3'),'afterUpdate':_0xc3cc('0x4'),'afterDestroy':_0xc3cc('0x5')};function emitEvent(_0x12782b){return function(_0x56b1aa,_0x4c12ae,_0x4f09a7){SmsQueueEvents[_0xc3cc('0x6')](_0x12782b+':'+_0x56b1aa['id'],_0x56b1aa);SmsQueueEvents[_0xc3cc('0x6')](_0x12782b,_0x56b1aa);_0x4f09a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xc3cc('0x7')](e,emitEvent(event));}}module[_0xc3cc('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x57f1=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x57f1,0x141));var _0x157f=function(_0x65f186,_0x5c6189){_0x65f186=_0x65f186-0x0;var _0x2f1122=_0x57f1[_0x65f186];return _0x2f1122;};'use strict';var EventEmitter=require(_0x157f('0x0'));var SmsQueue=require(_0x157f('0x1'))['db'][_0x157f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x157f('0x3')](0x0);var events={'afterCreate':_0x157f('0x4'),'afterUpdate':_0x157f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57f35d){return function(_0x207a87,_0x2e39a5,_0x434746){SmsQueueEvents[_0x157f('0x6')](_0x57f35d+':'+_0x207a87['id'],_0x207a87);SmsQueueEvents[_0x157f('0x6')](_0x57f35d,_0x207a87);_0x434746(null);};}for(var e in events){if(events[_0x157f('0x7')](e)){var event=events[e];SmsQueue[_0x157f('0x8')](e,emitEvent(event));}}module[_0x157f('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 16f0e70..4c36d70 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 _0x0251=['sms_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0251,0xaa));var _0x1025=function(_0x3f8c19,_0x21b96d){_0x3f8c19=_0x3f8c19-0x0;var _0x4d7b70=_0x0251[_0x3f8c19];return _0x4d7b70;};'use strict';var _=require(_0x1025('0x0'));var util=require('util');var logger=require(_0x1025('0x1'))(_0x1025('0x2'));var moment=require('moment');var BPromise=require(_0x1025('0x3'));var rp=require(_0x1025('0x4'));var fs=require('fs');var path=require(_0x1025('0x5'));var rimraf=require(_0x1025('0x6'));var config=require(_0x1025('0x7'));var attributes=require(_0x1025('0x8'));module[_0x1025('0x9')]=function(_0x2593a9,_0x287025){return _0x2593a9[_0x1025('0xa')](_0x1025('0xb'),attributes,{'tableName':_0x1025('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5879=['../../config/environment','define','SmsQueue','sms_queues','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x1d9e73,_0xf601d5){var _0x3a9687=function(_0x5c020d){while(--_0x5c020d){_0x1d9e73['push'](_0x1d9e73['shift']());}};_0x3a9687(++_0xf601d5);}(_0x5879,0xca));var _0x9587=function(_0x2319a1,_0x211d4a){_0x2319a1=_0x2319a1-0x0;var _0x2baead=_0x5879[_0x2319a1];return _0x2baead;};'use strict';var _=require(_0x9587('0x0'));var util=require(_0x9587('0x1'));var logger=require('../../config/logger')(_0x9587('0x2'));var moment=require(_0x9587('0x3'));var BPromise=require('bluebird');var rp=require(_0x9587('0x4'));var fs=require('fs');var path=require(_0x9587('0x5'));var rimraf=require(_0x9587('0x6'));var config=require(_0x9587('0x7'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x6fc8a9,_0x381137){return _0x6fc8a9[_0x9587('0x8')](_0x9587('0x9'),attributes,{'tableName':_0x9587('0xa'),'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 5248bfa..bc58195 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 _0xcbd3=['SmsQueue,\x20%s,\x20%s,\x20%s','error','SmsQueue,\x20%s,\x20%s','message','request\x20sent','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','model','stringify','ShowSmsQueue','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info','debug'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xcbd3,0x124));var _0x3cbd=function(_0x1de0cc,_0xcf125){_0x1de0cc=_0x1de0cc-0x0;var _0x1e19ae=_0xcbd3[_0x1de0cc];return _0x1e19ae;};'use strict';var _=require(_0x3cbd('0x0'));var util=require(_0x3cbd('0x1'));var moment=require(_0x3cbd('0x2'));var BPromise=require(_0x3cbd('0x3'));var rs=require(_0x3cbd('0x4'));var fs=require('fs');var Redis=require(_0x3cbd('0x5'));var db=require(_0x3cbd('0x6'))['db'];var utils=require(_0x3cbd('0x7'));var logger=require(_0x3cbd('0x8'))('rpc');var config=require(_0x3cbd('0x9'));var jayson=require(_0x3cbd('0xa'));var client=jayson[_0x3cbd('0xb')]['http']({'port':0x232a});config[_0x3cbd('0xc')]=_[_0x3cbd('0xd')](config[_0x3cbd('0xc')],{'host':_0x3cbd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3cbd('0xc')]));require('./smsQueue.socket')[_0x3cbd('0xf')](socket);function respondWithRpcPromise(_0x43859e,_0x302d65,_0x245077){return new BPromise(function(_0x2b1ee2,_0x51216b){return client[_0x3cbd('0x10')](_0x43859e,_0x245077)[_0x3cbd('0x11')](function(_0x344d26){logger[_0x3cbd('0x12')]('SmsQueue,\x20%s,\x20%s',_0x302d65,'request\x20sent');logger[_0x3cbd('0x13')](_0x3cbd('0x14'),_0x302d65,'request\x20sent',JSON['stringify'](_0x344d26));if(_0x344d26[_0x3cbd('0x15')]){if(_0x344d26[_0x3cbd('0x15')]['code']===0x1f4){logger['error'](_0x3cbd('0x16'),_0x302d65,_0x344d26[_0x3cbd('0x15')][_0x3cbd('0x17')]);return _0x51216b(_0x344d26[_0x3cbd('0x15')][_0x3cbd('0x17')]);}logger['error'](_0x3cbd('0x16'),_0x302d65,_0x344d26[_0x3cbd('0x15')][_0x3cbd('0x17')]);return _0x2b1ee2(_0x344d26['error']['message']);}else{logger[_0x3cbd('0x12')](_0x3cbd('0x16'),_0x302d65,_0x3cbd('0x18'));_0x2b1ee2(_0x344d26['result'][_0x3cbd('0x17')]);}})[_0x3cbd('0x19')](function(_0xcedd2e){logger[_0x3cbd('0x15')](_0x3cbd('0x16'),_0x302d65,_0xcedd2e);_0x51216b(_0xcedd2e);});});}exports[_0x3cbd('0x1a')]=function(_0x566e70){var _0x57276f=this;return new Promise(function(_0x46c534,_0x3969e3){return db[_0x3cbd('0x1b')]['findAll']({'raw':_0x566e70[_0x3cbd('0x1c')]?_0x566e70[_0x3cbd('0x1c')][_0x3cbd('0x1d')]===undefined?!![]:![]:!![],'where':_0x566e70['options']?_0x566e70[_0x3cbd('0x1c')][_0x3cbd('0x1e')]||null:null,'attributes':_0x566e70[_0x3cbd('0x1c')]?_0x566e70[_0x3cbd('0x1c')][_0x3cbd('0x1f')]||null:null,'limit':_0x566e70[_0x3cbd('0x1c')]?_0x566e70[_0x3cbd('0x1c')][_0x3cbd('0x20')]||null:null,'include':_0x566e70[_0x3cbd('0x1c')]?_0x566e70['options']['include']?_['map'](_0x566e70[_0x3cbd('0x1c')][_0x3cbd('0x21')],function(_0x2ba9b1){return{'model':db[_0x2ba9b1[_0x3cbd('0x22')]],'as':_0x2ba9b1['as'],'attributes':_0x2ba9b1[_0x3cbd('0x1f')],'include':_0x2ba9b1[_0x3cbd('0x21')]?_['map'](_0x2ba9b1[_0x3cbd('0x21')],function(_0x5d9b2c){return{'model':db[_0x5d9b2c['model']],'as':_0x5d9b2c['as'],'attributes':_0x5d9b2c['attributes'],'include':_0x5d9b2c[_0x3cbd('0x21')]?_['map'](_0x5d9b2c[_0x3cbd('0x21')],function(_0x1da1ed){return{'model':db[_0x1da1ed['model']],'as':_0x1da1ed['as'],'attributes':_0x1da1ed[_0x3cbd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3cbd('0x11')](function(_0x2d0509){logger[_0x3cbd('0x12')](_0x3cbd('0x1a'),_0x566e70);logger[_0x3cbd('0x13')](_0x3cbd('0x1a'),_0x566e70,JSON[_0x3cbd('0x23')](_0x2d0509));_0x46c534(_0x2d0509);})[_0x3cbd('0x19')](function(_0x4493ce){logger[_0x3cbd('0x15')](_0x3cbd('0x1a'),_0x4493ce[_0x3cbd('0x17')],_0x566e70);_0x3969e3(_0x57276f[_0x3cbd('0x15')](0x1f4,_0x4493ce[_0x3cbd('0x17')]));});});};exports[_0x3cbd('0x24')]=function(_0x1509ae){var _0x305e2f=this;return new Promise(function(_0x45edac,_0x19866f){return db[_0x3cbd('0x1b')][_0x3cbd('0x25')]({'raw':_0x1509ae[_0x3cbd('0x1c')]?_0x1509ae['options'][_0x3cbd('0x1d')]===undefined?!![]:![]:!![],'where':_0x1509ae[_0x3cbd('0x1c')]?_0x1509ae['options']['where']||null:null,'attributes':_0x1509ae[_0x3cbd('0x1c')]?_0x1509ae[_0x3cbd('0x1c')][_0x3cbd('0x1f')]||null:null,'include':_0x1509ae[_0x3cbd('0x1c')]?_0x1509ae[_0x3cbd('0x1c')][_0x3cbd('0x21')]?_[_0x3cbd('0x26')](_0x1509ae['options'][_0x3cbd('0x21')],function(_0x2cea80){return{'model':db[_0x2cea80[_0x3cbd('0x22')]],'as':_0x2cea80['as'],'attributes':_0x2cea80['attributes'],'include':_0x2cea80[_0x3cbd('0x21')]?_[_0x3cbd('0x26')](_0x2cea80[_0x3cbd('0x21')],function(_0x3624ee){return{'model':db[_0x3624ee[_0x3cbd('0x22')]],'as':_0x3624ee['as'],'attributes':_0x3624ee[_0x3cbd('0x1f')],'include':_0x3624ee['include']?_[_0x3cbd('0x26')](_0x3624ee[_0x3cbd('0x21')],function(_0x19be36){return{'model':db[_0x19be36['model']],'as':_0x19be36['as'],'attributes':_0x19be36[_0x3cbd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3cbd('0x11')](function(_0x421550){logger['info'](_0x3cbd('0x24'),_0x1509ae);logger[_0x3cbd('0x13')]('ShowSmsQueue',_0x1509ae,JSON[_0x3cbd('0x23')](_0x421550));_0x45edac(_0x421550);})[_0x3cbd('0x19')](function(_0x5cbf83){logger[_0x3cbd('0x15')]('ShowSmsQueue',_0x5cbf83[_0x3cbd('0x17')],_0x1509ae);_0x19866f(_0x305e2f[_0x3cbd('0x15')](0x1f4,_0x5cbf83[_0x3cbd('0x17')]));});});}; \ No newline at end of file +var _0xb7ad=['error','code','message','SmsQueue,\x20%s,\x20%s','request\x20sent','result','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','map','include','model','then','ShowSmsQueue','find','where','catch','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb7ad,0xa9));var _0xdb7a=function(_0x3fd8a1,_0x38e281){_0x3fd8a1=_0x3fd8a1-0x0;var _0xc9a56=_0xb7ad[_0x3fd8a1];return _0xc9a56;};'use strict';var _=require('lodash');var util=require(_0xdb7a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb7a('0x1'));var db=require(_0xdb7a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb7a('0x3'))(_0xdb7a('0x4'));var config=require(_0xdb7a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdb7a('0x6')][_0xdb7a('0x7')]({'port':0x232a});config[_0xdb7a('0x8')]=_[_0xdb7a('0x9')](config[_0xdb7a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb7a('0xa'))(new Redis(config[_0xdb7a('0x8')]));require('./smsQueue.socket')[_0xdb7a('0xb')](socket);function respondWithRpcPromise(_0x55cfff,_0xb57a0c,_0x3d6ee3){return new BPromise(function(_0x13b039,_0x52b47b){return client['request'](_0x55cfff,_0x3d6ee3)['then'](function(_0x1fb806){logger[_0xdb7a('0xc')]('SmsQueue,\x20%s,\x20%s',_0xb57a0c,'request\x20sent');logger[_0xdb7a('0xd')](_0xdb7a('0xe'),_0xb57a0c,'request\x20sent',JSON[_0xdb7a('0xf')](_0x1fb806));if(_0x1fb806[_0xdb7a('0x10')]){if(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x11')]===0x1f4){logger[_0xdb7a('0x10')]('SmsQueue,\x20%s,\x20%s',_0xb57a0c,_0x1fb806[_0xdb7a('0x10')]['message']);return _0x52b47b(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);}logger[_0xdb7a('0x10')](_0xdb7a('0x13'),_0xb57a0c,_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);return _0x13b039(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);}else{logger[_0xdb7a('0xc')](_0xdb7a('0x13'),_0xb57a0c,_0xdb7a('0x14'));_0x13b039(_0x1fb806[_0xdb7a('0x15')][_0xdb7a('0x12')]);}})['catch'](function(_0x1d8993){logger['error'](_0xdb7a('0x13'),_0xb57a0c,_0x1d8993);_0x52b47b(_0x1d8993);});});}exports[_0xdb7a('0x16')]=function(_0x20674b){var _0x3f90cc=this;return new Promise(function(_0x46ac0d,_0x49e9c7){return db[_0xdb7a('0x17')][_0xdb7a('0x18')]({'raw':_0x20674b[_0xdb7a('0x19')]?_0x20674b['options'][_0xdb7a('0x1a')]===undefined?!![]:![]:!![],'where':_0x20674b[_0xdb7a('0x19')]?_0x20674b['options']['where']||null:null,'attributes':_0x20674b[_0xdb7a('0x19')]?_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1b')]||null:null,'limit':_0x20674b[_0xdb7a('0x19')]?_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1c')]||null:null,'include':_0x20674b['options']?_0x20674b[_0xdb7a('0x19')]['include']?_[_0xdb7a('0x1d')](_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1e')],function(_0x550d02){return{'model':db[_0x550d02[_0xdb7a('0x1f')]],'as':_0x550d02['as'],'attributes':_0x550d02[_0xdb7a('0x1b')],'include':_0x550d02[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0x550d02[_0xdb7a('0x1e')],function(_0x4ce062){return{'model':db[_0x4ce062[_0xdb7a('0x1f')]],'as':_0x4ce062['as'],'attributes':_0x4ce062[_0xdb7a('0x1b')],'include':_0x4ce062[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0x4ce062[_0xdb7a('0x1e')],function(_0x454770){return{'model':db[_0x454770[_0xdb7a('0x1f')]],'as':_0x454770['as'],'attributes':_0x454770['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb7a('0x20')](function(_0x3ced59){logger[_0xdb7a('0xc')](_0xdb7a('0x16'),_0x20674b);logger[_0xdb7a('0xd')]('GetSmsQueue',_0x20674b,JSON[_0xdb7a('0xf')](_0x3ced59));_0x46ac0d(_0x3ced59);})['catch'](function(_0x4db3c9){logger['error'](_0xdb7a('0x16'),_0x4db3c9['message'],_0x20674b);_0x49e9c7(_0x3f90cc['error'](0x1f4,_0x4db3c9[_0xdb7a('0x12')]));});});};exports[_0xdb7a('0x21')]=function(_0x3145f3){var _0x520977=this;return new Promise(function(_0x2db3b0,_0x354ba9){return db['SmsQueue'][_0xdb7a('0x22')]({'raw':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3[_0xdb7a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3['options'][_0xdb7a('0x23')]||null:null,'attributes':_0x3145f3['options']?_0x3145f3[_0xdb7a('0x19')]['attributes']||null:null,'include':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3[_0xdb7a('0x19')]['include']?_[_0xdb7a('0x1d')](_0x3145f3[_0xdb7a('0x19')][_0xdb7a('0x1e')],function(_0xf33f1c){return{'model':db[_0xf33f1c['model']],'as':_0xf33f1c['as'],'attributes':_0xf33f1c[_0xdb7a('0x1b')],'include':_0xf33f1c[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0xf33f1c[_0xdb7a('0x1e')],function(_0xac76d2){return{'model':db[_0xac76d2[_0xdb7a('0x1f')]],'as':_0xac76d2['as'],'attributes':_0xac76d2[_0xdb7a('0x1b')],'include':_0xac76d2['include']?_[_0xdb7a('0x1d')](_0xac76d2['include'],function(_0x589d0c){return{'model':db[_0x589d0c['model']],'as':_0x589d0c['as'],'attributes':_0x589d0c[_0xdb7a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30ae17){logger['info'](_0xdb7a('0x21'),_0x3145f3);logger[_0xdb7a('0xd')](_0xdb7a('0x21'),_0x3145f3,JSON[_0xdb7a('0xf')](_0x30ae17));_0x2db3b0(_0x30ae17);})[_0xdb7a('0x24')](function(_0x4e037d){logger[_0xdb7a('0x10')](_0xdb7a('0x21'),_0x4e037d[_0xdb7a('0x12')],_0x3145f3);_0x354ba9(_0x520977[_0xdb7a('0x10')](0x1f4,_0x4e037d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8644f04..8e68f27 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 _0xc612=['smsQueue:','save','remove','emit','removeListener','register','length'];(function(_0x5412e4,_0x1a2e3a){var _0xd27c2a=function(_0x322340){while(--_0x322340){_0x5412e4['push'](_0x5412e4['shift']());}};_0xd27c2a(++_0x1a2e3a);}(_0xc612,0x166));var _0x2c61=function(_0x31760f,_0xacc31a){_0x31760f=_0x31760f-0x0;var _0xfca380=_0xc612[_0x31760f];return _0xfca380;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x2c61('0x0'),_0x2c61('0x1'),'update'];function createListener(_0x1ad2fd,_0x2ce081){return function(_0x39e077){_0x2ce081[_0x2c61('0x2')](_0x1ad2fd,_0x39e077);};}function removeListener(_0x42450c,_0x483db8){return function(){SmsQueueEvents[_0x2c61('0x3')](_0x42450c,_0x483db8);};}exports[_0x2c61('0x4')]=function(_0x102f07){for(var _0x1c660a=0x0,_0x390422=events[_0x2c61('0x5')];_0x1c660a<_0x390422;_0x1c660a++){var _0x17e989=events[_0x1c660a];var _0x50d2c7=createListener(_0x2c61('0x6')+_0x17e989,_0x102f07);SmsQueueEvents['on'](_0x17e989,_0x50d2c7);}}; \ No newline at end of file +var _0x2d43=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x3fb021,_0x5563b0){var _0x3346d4=function(_0x2bd32c){while(--_0x2bd32c){_0x3fb021['push'](_0x3fb021['shift']());}};_0x3346d4(++_0x5563b0);}(_0x2d43,0x1bd));var _0x32d4=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x2d43[_0xf0ec6e];return _0x8bbc27;};'use strict';var SmsQueueEvents=require(_0x32d4('0x0'));var events=[_0x32d4('0x1'),_0x32d4('0x2'),_0x32d4('0x3')];function createListener(_0x4f7ee6,_0x2e01d6){return function(_0xa6dae2){_0x2e01d6[_0x32d4('0x4')](_0x4f7ee6,_0xa6dae2);};}function removeListener(_0x2225f8,_0x718423){return function(){SmsQueueEvents[_0x32d4('0x5')](_0x2225f8,_0x718423);};}exports[_0x32d4('0x6')]=function(_0x5a91d1){for(var _0x5c31c8=0x0,_0x456eb7=events[_0x32d4('0x7')];_0x5c31c8<_0x456eb7;_0x5c31c8++){var _0x489829=events[_0x5c31c8];var _0x2d2167=createListener(_0x32d4('0x8')+_0x489829,_0x5a91d1);SmsQueueEvents['on'](_0x489829,_0x2d2167);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 28346c1..5539cc2 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 _0xbb6b=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x1107cc,_0x2dbdc2){var _0x4a50ca=function(_0x34cf75){while(--_0x34cf75){_0x1107cc['push'](_0x1107cc['shift']());}};_0x4a50ca(++_0x2dbdc2);}(_0xbb6b,0xa9));var _0xbbb6=function(_0x2e48d1,_0x9d6d72){_0x2e48d1=_0x2e48d1-0x0;var _0x20c03a=_0xbb6b[_0x2e48d1];return _0x20c03a;};'use strict';var multer=require(_0xbbb6('0x0'));var util=require(_0xbbb6('0x1'));var path=require(_0xbbb6('0x2'));var timeout=require(_0xbbb6('0x3'));var express=require(_0xbbb6('0x4'));var router=express['Router']();var fs_extra=require(_0xbbb6('0x5'));var auth=require(_0xbbb6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbb6('0x7'));var controller=require(_0xbbb6('0x8'));router[_0xbbb6('0x9')]('/',auth[_0xbbb6('0xa')](),controller[_0xbbb6('0xb')]);router[_0xbbb6('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xbbb6('0xc')]);router[_0xbbb6('0x9')](_0xbbb6('0xd'),auth[_0xbbb6('0xa')](),controller[_0xbbb6('0xe')]);router['post']('/',auth[_0xbbb6('0xa')](),controller[_0xbbb6('0xf')]);router[_0xbbb6('0x10')](_0xbbb6('0xd'),auth[_0xbbb6('0xa')](),controller[_0xbbb6('0x11')]);router[_0xbbb6('0x12')](_0xbbb6('0xd'),auth['isAuthenticated'](),controller[_0xbbb6('0x13')]);module[_0xbbb6('0x14')]=router; \ No newline at end of file +var _0x9dd4=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9dd4,0x157));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x49dd('0x0'));var util=require(_0x49dd('0x1'));var path=require('path');var timeout=require(_0x49dd('0x2'));var express=require(_0x49dd('0x3'));var router=express[_0x49dd('0x4')]();var fs_extra=require(_0x49dd('0x5'));var auth=require(_0x49dd('0x6'));var interaction=require(_0x49dd('0x7'));var config=require(_0x49dd('0x8'));var controller=require('./smsQueueReport.controller');router[_0x49dd('0x9')]('/',auth[_0x49dd('0xa')](),controller[_0x49dd('0xb')]);router[_0x49dd('0x9')]('/describe',auth[_0x49dd('0xa')](),controller[_0x49dd('0xc')]);router[_0x49dd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x49dd('0xd')]);router[_0x49dd('0xe')]('/',auth[_0x49dd('0xa')](),controller[_0x49dd('0xf')]);router[_0x49dd('0x10')]('/:id',auth[_0x49dd('0xa')](),controller[_0x49dd('0x11')]);router[_0x49dd('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x49dd('0x13')]);module[_0x49dd('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 057dc52..40c5de0 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 _0x9cfc=['STRING','DATE','moment','sequelize','exports'];(function(_0xc68cef,_0x2773fe){var _0x33783e=function(_0x517d7c){while(--_0x517d7c){_0xc68cef['push'](_0xc68cef['shift']());}};_0x33783e(++_0x2773fe);}(_0x9cfc,0x1b0));var _0xc9cf=function(_0x41835c,_0x138035){_0x41835c=_0x41835c-0x0;var _0x4b0168=_0x9cfc[_0x41835c];return _0x4b0168;};'use strict';var moment=require(_0xc9cf('0x0'));var Sequelize=require(_0xc9cf('0x1'));module[_0xc9cf('0x2')]={'uniqueid':{'type':Sequelize[_0xc9cf('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc9cf('0x4')]},'leaveAt':{'type':Sequelize[_0xc9cf('0x4')]},'acceptAt':{'type':Sequelize[_0xc9cf('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x25ea=['DATE','moment','sequelize','exports','STRING'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x25ea,0xc4));var _0xa25e=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0x25ea[_0xe4d6c6];return _0x3a8935;};'use strict';var moment=require(_0xa25e('0x0'));var Sequelize=require(_0xa25e('0x1'));module[_0xa25e('0x2')]={'uniqueid':{'type':Sequelize[_0xa25e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa25e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa25e('0x4')]},'acceptAt':{'type':Sequelize[_0xa25e('0x4')]},'exitAt':{'type':Sequelize[_0xa25e('0x4')]},'reason':{'type':Sequelize[_0xa25e('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 7f638fa..d1d5158 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 _0x828c=['nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','end','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x828c,0xf6));var _0xc828=function(_0x24431a,_0x52459a){_0x24431a=_0x24431a-0x0;var _0x454ec7=_0x828c[_0x24431a];return _0x454ec7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc828('0x0'));var zipdir=require(_0xc828('0x1'));var jsonpatch=require(_0xc828('0x2'));var rp=require(_0xc828('0x3'));var moment=require(_0xc828('0x4'));var BPromise=require(_0xc828('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc828('0x6'));var sox=require(_0xc828('0x7'));var csv=require('to-csv');var ejs=require(_0xc828('0x8'));var fs=require('fs');var fs_extra=require(_0xc828('0x9'));var _=require('lodash');var squel=require(_0xc828('0xa'));var crypto=require('crypto');var jsforce=require(_0xc828('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc828('0xc'));var Papa=require(_0xc828('0xd'));var Redis=require(_0xc828('0xe'));var authService=require(_0xc828('0xf'));var qs=require(_0xc828('0x10'));var as=require(_0xc828('0x11'));var hardwareService=require(_0xc828('0x12'));var logger=require(_0xc828('0x13'))(_0xc828('0x14'));var utils=require(_0xc828('0x15'));var config=require(_0xc828('0x16'));var licenseUtil=require(_0xc828('0x17'));var db=require(_0xc828('0x18'))['db'];function respondWithStatusCode(_0x18819b,_0x18888c){_0x18888c=_0x18888c||0xcc;return function(_0x20832d){if(_0x20832d){return _0x18819b[_0xc828('0x19')](_0x18888c);}return _0x18819b[_0xc828('0x1a')](_0x18888c)['end']();};}function respondWithResult(_0x11e657,_0x3ef300){_0x3ef300=_0x3ef300||0xc8;return function(_0x101de7){if(_0x101de7){return _0x11e657[_0xc828('0x1a')](_0x3ef300)['json'](_0x101de7);}};}function respondWithFilteredResult(_0x2e12ef,_0x1779d1){return function(_0x28a285){if(_0x28a285){var _0x2542ca=typeof _0x1779d1[_0xc828('0x1b')]===_0xc828('0x1c')&&typeof _0x1779d1[_0xc828('0x1d')]===_0xc828('0x1c');var _0x4375d0=_0x28a285['count'];var _0x35c940=_0x2542ca?0x0:_0x1779d1[_0xc828('0x1b')];var _0x3207be=_0x2542ca?_0x28a285[_0xc828('0x1e')]:_0x1779d1[_0xc828('0x1b')]+_0x1779d1[_0xc828('0x1d')];var _0x54e6c0;if(_0x3207be>=_0x4375d0){_0x3207be=_0x4375d0;_0x54e6c0=0xc8;}else{_0x54e6c0=0xce;}_0x2e12ef[_0xc828('0x1a')](_0x54e6c0);return _0x2e12ef[_0xc828('0x1f')]('Content-Range',_0x35c940+'-'+_0x3207be+'/'+_0x4375d0)[_0xc828('0x20')](_0x28a285);}return null;};}function patchUpdates(_0x3aea2d){return function(_0x36c7d5){try{jsonpatch['apply'](_0x36c7d5,_0x3aea2d,!![]);}catch(_0x1c96d8){return BPromise[_0xc828('0x21')](_0x1c96d8);}return _0x36c7d5[_0xc828('0x22')]();};}function saveUpdates(_0x334505,_0x565d12){return function(_0x2ad0f0){if(_0x2ad0f0){return _0x2ad0f0[_0xc828('0x23')](_0x334505)[_0xc828('0x24')](function(_0x45b7b2){return _0x45b7b2;});}return null;};}function removeEntity(_0x564972,_0x57d9a0){return function(_0x16357d){if(_0x16357d){return _0x16357d['destroy']()[_0xc828('0x24')](function(){_0x564972[_0xc828('0x1a')](0xcc)[_0xc828('0x25')]();});}};}function handleEntityNotFound(_0x3ee04e,_0x462d00){return function(_0x582eb7){if(!_0x582eb7){_0x3ee04e[_0xc828('0x19')](0x194);}return _0x582eb7;};}function handleError(_0x30be43,_0x115d8b){_0x115d8b=_0x115d8b||0x1f4;return function(_0x514951){logger['error'](_0x514951[_0xc828('0x26')]);if(_0x514951[_0xc828('0x27')]){delete _0x514951[_0xc828('0x27')];}_0x30be43[_0xc828('0x1a')](_0x115d8b)[_0xc828('0x28')](_0x514951);};}exports[_0xc828('0x29')]=function(_0x3b6ebc,_0xdee679){var _0x492422={},_0x5b75ca={},_0x3a6a68={'count':0x0,'rows':[]};var _0x2d8826=_[_0xc828('0x2a')](db[_0xc828('0x2b')]['rawAttributes'],function(_0x12b02c){return{'name':_0x12b02c[_0xc828('0x2c')],'type':_0x12b02c[_0xc828('0x2d')][_0xc828('0x2e')]};});_0x5b75ca[_0xc828('0x2f')]=_[_0xc828('0x2a')](_0x2d8826,_0xc828('0x27'));_0x5b75ca[_0xc828('0x30')]=_[_0xc828('0x31')](_0x3b6ebc['query']);_0x5b75ca['filters']=_['intersection'](_0x5b75ca[_0xc828('0x2f')],_0x5b75ca[_0xc828('0x30')]);_0x492422[_0xc828('0x32')]=_['intersection'](_0x5b75ca[_0xc828('0x2f')],qs[_0xc828('0x33')](_0x3b6ebc[_0xc828('0x30')]['fields']));_0x492422[_0xc828('0x32')]=_0x492422[_0xc828('0x32')][_0xc828('0x34')]?_0x492422['attributes']:_0x5b75ca[_0xc828('0x2f')];if(!_0x3b6ebc[_0xc828('0x30')][_0xc828('0x35')](_0xc828('0x36'))){_0x492422[_0xc828('0x1d')]=qs[_0xc828('0x1d')](_0x3b6ebc['query']['limit']);_0x492422[_0xc828('0x1b')]=qs[_0xc828('0x1b')](_0x3b6ebc[_0xc828('0x30')]['offset']);}_0x492422['order']=qs[_0xc828('0x37')](_0x3b6ebc[_0xc828('0x30')][_0xc828('0x37')]);_0x492422['where']=qs['filters'](_['pick'](_0x3b6ebc[_0xc828('0x30')],_0x5b75ca[_0xc828('0x38')]),_0x2d8826);if(_0x3b6ebc['query'][_0xc828('0x39')]){_0x492422['where']=_['merge'](_0x492422[_0xc828('0x3a')],{'$or':_[_0xc828('0x2a')](_0x2d8826,function(_0x18aaf6){if(_0x18aaf6['type']!==_0xc828('0x3b')){var _0x538551={};_0x538551[_0x18aaf6[_0xc828('0x27')]]={'$like':'%'+_0x3b6ebc[_0xc828('0x30')][_0xc828('0x39')]+'%'};return _0x538551;}})});}_0x492422=_[_0xc828('0x3c')]({},_0x492422,_0x3b6ebc[_0xc828('0x3d')]);var _0xfe83cb={'where':_0x492422[_0xc828('0x3a')]};return db['SmsQueueReport'][_0xc828('0x1e')](_0xfe83cb)[_0xc828('0x24')](function(_0x218b3f){_0x3a6a68[_0xc828('0x1e')]=_0x218b3f;if(_0x3b6ebc[_0xc828('0x30')][_0xc828('0x3e')]){_0x492422[_0xc828('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xc828('0x40')](_0x492422);})['then'](function(_0x48eee0){_0x3a6a68[_0xc828('0x41')]=_0x48eee0;return _0x3a6a68;})['then'](respondWithFilteredResult(_0xdee679,_0x492422))[_0xc828('0x42')](handleError(_0xdee679,null));};exports[_0xc828('0x43')]=function(_0x461dc5,_0x181e7b){var _0x201c46={'raw':!![],'where':{'id':_0x461dc5[_0xc828('0x44')]['id']}},_0x1a3b96={};_0x1a3b96['model']=_[_0xc828('0x31')](db['SmsQueueReport']['rawAttributes']);_0x1a3b96['query']=_['keys'](_0x461dc5[_0xc828('0x30')]);_0x1a3b96[_0xc828('0x38')]=_[_0xc828('0x45')](_0x1a3b96[_0xc828('0x2f')],_0x1a3b96[_0xc828('0x30')]);_0x201c46['attributes']=_[_0xc828('0x45')](_0x1a3b96['model'],qs[_0xc828('0x33')](_0x461dc5[_0xc828('0x30')][_0xc828('0x33')]));_0x201c46[_0xc828('0x32')]=_0x201c46['attributes'][_0xc828('0x34')]?_0x201c46[_0xc828('0x32')]:_0x1a3b96[_0xc828('0x2f')];if(_0x461dc5[_0xc828('0x30')][_0xc828('0x3e')]){_0x201c46['include']=[{'all':!![]}];}_0x201c46=_[_0xc828('0x3c')]({},_0x201c46,_0x461dc5['options']);return db[_0xc828('0x2b')]['find'](_0x201c46)['then'](handleEntityNotFound(_0x181e7b,null))[_0xc828('0x24')](respondWithResult(_0x181e7b,null))['catch'](handleError(_0x181e7b,null));};exports[_0xc828('0x46')]=function(_0x483176,_0x852b8b){return db['SmsQueueReport']['create'](_0x483176[_0xc828('0x47')],{})[_0xc828('0x24')](respondWithResult(_0x852b8b,0xc9))[_0xc828('0x42')](handleError(_0x852b8b,null));};exports[_0xc828('0x23')]=function(_0x588fd0,_0x1fb016){if(_0x588fd0[_0xc828('0x47')]['id']){delete _0x588fd0[_0xc828('0x47')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x588fd0[_0xc828('0x44')]['id']}})[_0xc828('0x24')](handleEntityNotFound(_0x1fb016,null))[_0xc828('0x24')](saveUpdates(_0x588fd0[_0xc828('0x47')],null))[_0xc828('0x24')](respondWithResult(_0x1fb016,null))[_0xc828('0x42')](handleError(_0x1fb016,null));};exports[_0xc828('0x48')]=function(_0x15b8ab,_0x2585a4){return db[_0xc828('0x2b')][_0xc828('0x49')]({'where':{'id':_0x15b8ab[_0xc828('0x44')]['id']}})['then'](handleEntityNotFound(_0x2585a4,null))['then'](removeEntity(_0x2585a4,null))[_0xc828('0x42')](handleError(_0x2585a4,null));};exports[_0xc828('0x4a')]=function(_0x453dba,_0x24b2a1){return db[_0xc828('0x2b')][_0xc828('0x4a')]()[_0xc828('0x24')](respondWithResult(_0x24b2a1,null))[_0xc828('0x42')](handleError(_0x24b2a1,null));}; \ No newline at end of file +var _0xfec8=['order','sort','where','pick','filter','merge','VIRTUAL','SmsQueueReport','includeAll','findAll','rows','show','params','keys','rawAttributes','options','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0xd32b91,_0x2b6353){var _0x146be7=function(_0x82e4f6){while(--_0x82e4f6){_0xd32b91['push'](_0xd32b91['shift']());}};_0x146be7(++_0x2b6353);}(_0xfec8,0x1e2));var _0x8fec=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0xfec8[_0x146a85];return _0x1b59bf;};'use strict';var emlformat=require(_0x8fec('0x0'));var rimraf=require(_0x8fec('0x1'));var zipdir=require(_0x8fec('0x2'));var jsonpatch=require(_0x8fec('0x3'));var rp=require(_0x8fec('0x4'));var moment=require(_0x8fec('0x5'));var BPromise=require(_0x8fec('0x6'));var Mustache=require(_0x8fec('0x7'));var util=require(_0x8fec('0x8'));var path=require(_0x8fec('0x9'));var sox=require(_0x8fec('0xa'));var csv=require(_0x8fec('0xb'));var ejs=require(_0x8fec('0xc'));var fs=require('fs');var fs_extra=require(_0x8fec('0xd'));var _=require(_0x8fec('0xe'));var squel=require(_0x8fec('0xf'));var crypto=require(_0x8fec('0x10'));var jsforce=require(_0x8fec('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8fec('0x12'));var Papa=require(_0x8fec('0x13'));var Redis=require('ioredis');var authService=require(_0x8fec('0x14'));var qs=require(_0x8fec('0x15'));var as=require(_0x8fec('0x16'));var hardwareService=require(_0x8fec('0x17'));var logger=require(_0x8fec('0x18'))(_0x8fec('0x19'));var utils=require('../../config/utils');var config=require(_0x8fec('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8fec('0x1b'))['db'];function respondWithStatusCode(_0x47e85f,_0x33da51){_0x33da51=_0x33da51||0xcc;return function(_0x175d2a){if(_0x175d2a){return _0x47e85f[_0x8fec('0x1c')](_0x33da51);}return _0x47e85f[_0x8fec('0x1d')](_0x33da51)[_0x8fec('0x1e')]();};}function respondWithResult(_0x335dcf,_0x1c8dc6){_0x1c8dc6=_0x1c8dc6||0xc8;return function(_0x4ee4c0){if(_0x4ee4c0){return _0x335dcf[_0x8fec('0x1d')](_0x1c8dc6)[_0x8fec('0x1f')](_0x4ee4c0);}};}function respondWithFilteredResult(_0x388584,_0x3ddd2e){return function(_0x593734){if(_0x593734){var _0x4cf3cf=typeof _0x3ddd2e[_0x8fec('0x20')]===_0x8fec('0x21')&&typeof _0x3ddd2e[_0x8fec('0x22')]===_0x8fec('0x21');var _0x5bb254=_0x593734[_0x8fec('0x23')];var _0x308f74=_0x4cf3cf?0x0:_0x3ddd2e[_0x8fec('0x20')];var _0x13e0a8=_0x4cf3cf?_0x593734[_0x8fec('0x23')]:_0x3ddd2e[_0x8fec('0x20')]+_0x3ddd2e[_0x8fec('0x22')];var _0x8d84b7;if(_0x13e0a8>=_0x5bb254){_0x13e0a8=_0x5bb254;_0x8d84b7=0xc8;}else{_0x8d84b7=0xce;}_0x388584[_0x8fec('0x1d')](_0x8d84b7);return _0x388584['set'](_0x8fec('0x24'),_0x308f74+'-'+_0x13e0a8+'/'+_0x5bb254)[_0x8fec('0x1f')](_0x593734);}return null;};}function patchUpdates(_0x2ff688){return function(_0x4db21f){try{jsonpatch['apply'](_0x4db21f,_0x2ff688,!![]);}catch(_0x22932f){return BPromise[_0x8fec('0x25')](_0x22932f);}return _0x4db21f[_0x8fec('0x26')]();};}function saveUpdates(_0x20c908,_0x3e8550){return function(_0xb9db6a){if(_0xb9db6a){return _0xb9db6a[_0x8fec('0x27')](_0x20c908)[_0x8fec('0x28')](function(_0x51c76a){return _0x51c76a;});}return null;};}function removeEntity(_0x31d21b,_0x2998f1){return function(_0x13b32b){if(_0x13b32b){return _0x13b32b[_0x8fec('0x29')]()[_0x8fec('0x28')](function(){_0x31d21b[_0x8fec('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1431,_0x475a4b){return function(_0x5e7eed){if(!_0x5e7eed){_0x5b1431[_0x8fec('0x1c')](0x194);}return _0x5e7eed;};}function handleError(_0xfeb6c8,_0x4d1e4e){_0x4d1e4e=_0x4d1e4e||0x1f4;return function(_0xd46525){logger['error'](_0xd46525['stack']);if(_0xd46525[_0x8fec('0x2a')]){delete _0xd46525[_0x8fec('0x2a')];}_0xfeb6c8[_0x8fec('0x1d')](_0x4d1e4e)[_0x8fec('0x2b')](_0xd46525);};}exports[_0x8fec('0x2c')]=function(_0x28bfa4,_0x50d6a9){var _0x3fd91a={},_0x591cc8={},_0x376e9f={'count':0x0,'rows':[]};var _0x4287cf=_[_0x8fec('0x2d')](db['SmsQueueReport']['rawAttributes'],function(_0x413b46){return{'name':_0x413b46[_0x8fec('0x2e')],'type':_0x413b46[_0x8fec('0x2f')][_0x8fec('0x30')]};});_0x591cc8[_0x8fec('0x31')]=_[_0x8fec('0x2d')](_0x4287cf,'name');_0x591cc8['query']=_['keys'](_0x28bfa4[_0x8fec('0x32')]);_0x591cc8[_0x8fec('0x33')]=_[_0x8fec('0x34')](_0x591cc8[_0x8fec('0x31')],_0x591cc8[_0x8fec('0x32')]);_0x3fd91a[_0x8fec('0x35')]=_[_0x8fec('0x34')](_0x591cc8[_0x8fec('0x31')],qs['fields'](_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x36')]));_0x3fd91a[_0x8fec('0x35')]=_0x3fd91a[_0x8fec('0x35')][_0x8fec('0x37')]?_0x3fd91a[_0x8fec('0x35')]:_0x591cc8['model'];if(!_0x28bfa4[_0x8fec('0x32')]['hasOwnProperty'](_0x8fec('0x38'))){_0x3fd91a['limit']=qs[_0x8fec('0x22')](_0x28bfa4['query'][_0x8fec('0x22')]);_0x3fd91a['offset']=qs[_0x8fec('0x20')](_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x20')]);}_0x3fd91a[_0x8fec('0x39')]=qs['sort'](_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x3a')]);_0x3fd91a[_0x8fec('0x3b')]=qs[_0x8fec('0x33')](_[_0x8fec('0x3c')](_0x28bfa4[_0x8fec('0x32')],_0x591cc8[_0x8fec('0x33')]),_0x4287cf);if(_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x3d')]){_0x3fd91a[_0x8fec('0x3b')]=_[_0x8fec('0x3e')](_0x3fd91a[_0x8fec('0x3b')],{'$or':_[_0x8fec('0x2d')](_0x4287cf,function(_0x243dad){if(_0x243dad[_0x8fec('0x2f')]!==_0x8fec('0x3f')){var _0x3bd108={};_0x3bd108[_0x243dad[_0x8fec('0x2a')]]={'$like':'%'+_0x28bfa4['query'][_0x8fec('0x3d')]+'%'};return _0x3bd108;}})});}_0x3fd91a=_[_0x8fec('0x3e')]({},_0x3fd91a,_0x28bfa4['options']);var _0x49d328={'where':_0x3fd91a['where']};return db[_0x8fec('0x40')][_0x8fec('0x23')](_0x49d328)[_0x8fec('0x28')](function(_0x29275){_0x376e9f['count']=_0x29275;if(_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x41')]){_0x3fd91a['include']=[{'all':!![]}];}return db[_0x8fec('0x40')][_0x8fec('0x42')](_0x3fd91a);})[_0x8fec('0x28')](function(_0xbb74e6){_0x376e9f[_0x8fec('0x43')]=_0xbb74e6;return _0x376e9f;})[_0x8fec('0x28')](respondWithFilteredResult(_0x50d6a9,_0x3fd91a))['catch'](handleError(_0x50d6a9,null));};exports[_0x8fec('0x44')]=function(_0x176614,_0x5a829d){var _0x331d31={'raw':!![],'where':{'id':_0x176614[_0x8fec('0x45')]['id']}},_0x52de12={};_0x52de12[_0x8fec('0x31')]=_[_0x8fec('0x46')](db[_0x8fec('0x40')][_0x8fec('0x47')]);_0x52de12[_0x8fec('0x32')]=_['keys'](_0x176614[_0x8fec('0x32')]);_0x52de12['filters']=_[_0x8fec('0x34')](_0x52de12[_0x8fec('0x31')],_0x52de12['query']);_0x331d31[_0x8fec('0x35')]=_['intersection'](_0x52de12[_0x8fec('0x31')],qs[_0x8fec('0x36')](_0x176614[_0x8fec('0x32')]['fields']));_0x331d31[_0x8fec('0x35')]=_0x331d31[_0x8fec('0x35')][_0x8fec('0x37')]?_0x331d31[_0x8fec('0x35')]:_0x52de12[_0x8fec('0x31')];if(_0x176614[_0x8fec('0x32')]['includeAll']){_0x331d31['include']=[{'all':!![]}];}_0x331d31=_[_0x8fec('0x3e')]({},_0x331d31,_0x176614[_0x8fec('0x48')]);return db[_0x8fec('0x40')]['find'](_0x331d31)[_0x8fec('0x28')](handleEntityNotFound(_0x5a829d,null))[_0x8fec('0x28')](respondWithResult(_0x5a829d,null))['catch'](handleError(_0x5a829d,null));};exports[_0x8fec('0x49')]=function(_0x4ced54,_0x7bd3fa){return db['SmsQueueReport'][_0x8fec('0x49')](_0x4ced54[_0x8fec('0x4a')],{})['then'](respondWithResult(_0x7bd3fa,0xc9))[_0x8fec('0x4b')](handleError(_0x7bd3fa,null));};exports[_0x8fec('0x27')]=function(_0x8120e5,_0x546c83){if(_0x8120e5[_0x8fec('0x4a')]['id']){delete _0x8120e5['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x8120e5[_0x8fec('0x45')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x546c83,null))[_0x8fec('0x28')](saveUpdates(_0x8120e5[_0x8fec('0x4a')],null))[_0x8fec('0x28')](respondWithResult(_0x546c83,null))[_0x8fec('0x4b')](handleError(_0x546c83,null));};exports[_0x8fec('0x29')]=function(_0x35c596,_0x29b7fd){return db[_0x8fec('0x40')]['find']({'where':{'id':_0x35c596[_0x8fec('0x45')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x29b7fd,null))[_0x8fec('0x28')](removeEntity(_0x29b7fd,null))[_0x8fec('0x4b')](handleError(_0x29b7fd,null));};exports[_0x8fec('0x4c')]=function(_0xb6c620,_0x37fc58){return db[_0x8fec('0x40')][_0x8fec('0x4c')]()[_0x8fec('0x28')](respondWithResult(_0x37fc58,null))[_0x8fec('0x4b')](handleError(_0x37fc58,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0347f72..4bb43f0 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x207bd5,_0x300b89){var _0x4c1122=function(_0x21e2f5){while(--_0x21e2f5){_0x207bd5['push'](_0x207bd5['shift']());}};_0x4c1122(++_0x300b89);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 532e728..a4e0e2f 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 _0x5729=['create','body','options','raw','then','UpdateSmsQueueReport','update','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x27a997,_0x85f149){var _0x5aa288=function(_0x38f03c){while(--_0x38f03c){_0x27a997['push'](_0x27a997['shift']());}};_0x5aa288(++_0x85f149);}(_0x5729,0x13f));var _0x9572=function(_0x433795,_0x253d09){_0x433795=_0x433795-0x0;var _0x27661e=_0x5729[_0x433795];return _0x27661e;};'use strict';var _=require('lodash');var util=require(_0x9572('0x0'));var moment=require(_0x9572('0x1'));var BPromise=require(_0x9572('0x2'));var rs=require(_0x9572('0x3'));var fs=require('fs');var Redis=require(_0x9572('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9572('0x5'))(_0x9572('0x6'));var config=require('../../config/environment');var jayson=require(_0x9572('0x7'));var client=jayson[_0x9572('0x8')][_0x9572('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xee9b6e,_0x1cc0db,_0x488b16){return new BPromise(function(_0x3dcf48,_0x72e628){return client[_0x9572('0xa')](_0xee9b6e,_0x488b16)['then'](function(_0x38c936){logger[_0x9572('0xb')](_0x9572('0xc'),_0x1cc0db,_0x9572('0xd'));logger[_0x9572('0xe')](_0x9572('0xf'),_0x1cc0db,'request\x20sent',JSON[_0x9572('0x10')](_0x38c936));if(_0x38c936[_0x9572('0x11')]){if(_0x38c936[_0x9572('0x11')]['code']===0x1f4){logger[_0x9572('0x11')](_0x9572('0xc'),_0x1cc0db,_0x38c936[_0x9572('0x11')][_0x9572('0x12')]);return _0x72e628(_0x38c936[_0x9572('0x11')][_0x9572('0x12')]);}logger[_0x9572('0x11')](_0x9572('0xc'),_0x1cc0db,_0x38c936[_0x9572('0x11')][_0x9572('0x12')]);return _0x3dcf48(_0x38c936['error'][_0x9572('0x12')]);}else{logger[_0x9572('0xb')](_0x9572('0xc'),_0x1cc0db,_0x9572('0xd'));_0x3dcf48(_0x38c936['result']['message']);}})[_0x9572('0x13')](function(_0x44e2f8){logger[_0x9572('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1cc0db,_0x44e2f8);_0x72e628(_0x44e2f8);});});}exports[_0x9572('0x14')]=function(_0x34be51){var _0x599c71=this;return new Promise(function(_0x5c56d5,_0x1d08c4){return db[_0x9572('0x15')][_0x9572('0x16')](_0x34be51[_0x9572('0x17')],{'raw':_0x34be51[_0x9572('0x18')]?_0x34be51['options'][_0x9572('0x19')]===undefined?!![]:![]:!![]})[_0x9572('0x1a')](function(_0x3e9cb7){logger[_0x9572('0xb')](_0x9572('0x14'),_0x34be51);logger[_0x9572('0xe')](_0x9572('0x14'),_0x34be51,JSON[_0x9572('0x10')](_0x3e9cb7));_0x5c56d5(_0x3e9cb7);})['catch'](function(_0x16e41d){logger['error'](_0x9572('0x14'),_0x16e41d[_0x9572('0x12')],_0x34be51);_0x1d08c4(_0x599c71[_0x9572('0x11')](0x1f4,_0x16e41d[_0x9572('0x12')]));});});};exports[_0x9572('0x1b')]=function(_0x2cbc95){var _0x34c651=this;return new Promise(function(_0x3666cd,_0x32ec52){return db['SmsQueueReport'][_0x9572('0x1c')](_0x2cbc95[_0x9572('0x17')],{'raw':_0x2cbc95['options']?_0x2cbc95['options'][_0x9572('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cbc95['options']?_0x2cbc95[_0x9572('0x18')]['where']||null:null,'attributes':_0x2cbc95[_0x9572('0x18')]?_0x2cbc95[_0x9572('0x18')][_0x9572('0x1d')]||null:null,'limit':_0x2cbc95[_0x9572('0x18')]?_0x2cbc95[_0x9572('0x18')][_0x9572('0x1e')]||null:null})[_0x9572('0x1a')](function(_0x2ae4c8){logger[_0x9572('0xb')](_0x9572('0x1b'),_0x2cbc95);logger[_0x9572('0xe')](_0x9572('0x1b'),_0x2cbc95,JSON[_0x9572('0x10')](_0x2ae4c8));_0x3666cd(_0x2ae4c8);})[_0x9572('0x13')](function(_0x111a28){logger[_0x9572('0x11')]('UpdateSmsQueueReport',_0x111a28[_0x9572('0x12')],_0x2cbc95);_0x32ec52(_0x34c651[_0x9572('0x11')](0x1f4,_0x111a28[_0x9572('0x12')]));});});}; \ No newline at end of file +var _0xa060=['UpdateSmsQueueReport','update','where','limit','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','stringify'];(function(_0x4532de,_0x3b275b){var _0x44172e=function(_0x4fff0e){while(--_0x4fff0e){_0x4532de['push'](_0x4532de['shift']());}};_0x44172e(++_0x3b275b);}(_0xa060,0xd7));var _0x0a06=function(_0x3c964f,_0x196ebb){_0x3c964f=_0x3c964f-0x0;var _0x34abae=_0xa060[_0x3c964f];return _0x34abae;};'use strict';var _=require(_0x0a06('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a06('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a06('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a06('0x3'))(_0x0a06('0x4'));var config=require(_0x0a06('0x5'));var jayson=require(_0x0a06('0x6'));var client=jayson[_0x0a06('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e64ac,_0x4692e7,_0x481a0b){return new BPromise(function(_0x1b0069,_0x955ca6){return client[_0x0a06('0x8')](_0x3e64ac,_0x481a0b)['then'](function(_0x1b165){logger[_0x0a06('0x9')](_0x0a06('0xa'),_0x4692e7,_0x0a06('0xb'));logger[_0x0a06('0xc')](_0x0a06('0xd'),_0x4692e7,'request\x20sent',JSON['stringify'](_0x1b165));if(_0x1b165[_0x0a06('0xe')]){if(_0x1b165[_0x0a06('0xe')][_0x0a06('0xf')]===0x1f4){logger[_0x0a06('0xe')](_0x0a06('0xa'),_0x4692e7,_0x1b165['error'][_0x0a06('0x10')]);return _0x955ca6(_0x1b165['error'][_0x0a06('0x10')]);}logger['error'](_0x0a06('0xa'),_0x4692e7,_0x1b165['error'][_0x0a06('0x10')]);return _0x1b0069(_0x1b165['error'][_0x0a06('0x10')]);}else{logger[_0x0a06('0x9')](_0x0a06('0xa'),_0x4692e7,_0x0a06('0xb'));_0x1b0069(_0x1b165[_0x0a06('0x11')][_0x0a06('0x10')]);}})['catch'](function(_0x27edad){logger['error'](_0x0a06('0xa'),_0x4692e7,_0x27edad);_0x955ca6(_0x27edad);});});}exports[_0x0a06('0x12')]=function(_0x2c7e62){var _0x4b7e5b=this;return new Promise(function(_0x27b746,_0x22a4ff){return db[_0x0a06('0x13')]['create'](_0x2c7e62[_0x0a06('0x14')],{'raw':_0x2c7e62[_0x0a06('0x15')]?_0x2c7e62[_0x0a06('0x15')][_0x0a06('0x16')]===undefined?!![]:![]:!![]})[_0x0a06('0x17')](function(_0x365da5){logger[_0x0a06('0x9')](_0x0a06('0x12'),_0x2c7e62);logger[_0x0a06('0xc')](_0x0a06('0x12'),_0x2c7e62,JSON[_0x0a06('0x18')](_0x365da5));_0x27b746(_0x365da5);})['catch'](function(_0x2c9b34){logger[_0x0a06('0xe')]('CreateSmsQueueReport',_0x2c9b34[_0x0a06('0x10')],_0x2c7e62);_0x22a4ff(_0x4b7e5b[_0x0a06('0xe')](0x1f4,_0x2c9b34[_0x0a06('0x10')]));});});};exports[_0x0a06('0x19')]=function(_0x39453){var _0xdbbdb9=this;return new Promise(function(_0x367d8b,_0x11ad8e){return db[_0x0a06('0x13')][_0x0a06('0x1a')](_0x39453[_0x0a06('0x14')],{'raw':_0x39453[_0x0a06('0x15')]?_0x39453['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39453[_0x0a06('0x15')]?_0x39453[_0x0a06('0x15')][_0x0a06('0x1b')]||null:null,'attributes':_0x39453['options']?_0x39453['options']['attributes']||null:null,'limit':_0x39453[_0x0a06('0x15')]?_0x39453[_0x0a06('0x15')][_0x0a06('0x1c')]||null:null})[_0x0a06('0x17')](function(_0x5a5115){logger[_0x0a06('0x9')]('UpdateSmsQueueReport',_0x39453);logger[_0x0a06('0xc')](_0x0a06('0x19'),_0x39453,JSON[_0x0a06('0x18')](_0x5a5115));_0x367d8b(_0x5a5115);})[_0x0a06('0x1d')](function(_0x2d4bc3){logger[_0x0a06('0xe')]('UpdateSmsQueueReport',_0x2d4bc3[_0x0a06('0x10')],_0x39453);_0x11ad8e(_0xdbbdb9[_0x0a06('0xe')](0x1f4,_0x2d4bc3[_0x0a06('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7d56eb0..c61870f 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 _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x5272d9,_0x2d5513){var _0x464524=function(_0x584f9c){while(--_0x584f9c){_0x5272d9['push'](_0x5272d9['shift']());}};_0x464524(++_0x2d5513);}(_0x5178,0x171));var _0x8517=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5178[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./smsTransferReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe015=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x5e3f9c,_0x2aa1e4){var _0x4ffb8e=function(_0x3009e7){while(--_0x3009e7){_0x5e3f9c['push'](_0x5e3f9c['shift']());}};_0x4ffb8e(++_0x2aa1e4);}(_0xe015,0x13b));var _0x5e01=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe015[_0x138adb];return _0x1b27f2;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9e76890..bf7a30a 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x487e12,_0x5ef95b){var _0x3f31a0=function(_0x17b7db){while(--_0x17b7db){_0x487e12['push'](_0x487e12['shift']());}};_0x3f31a0(++_0x5ef95b);}(_0xedd9,0xfc));var _0x9edd=function(_0x435b1a,_0x2fccdd){_0x435b1a=_0x435b1a-0x0;var _0x40fe3c=_0xedd9[_0x435b1a];return _0x40fe3c;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x19044f,_0x35a8f7){var _0x2c3507=function(_0x452940){while(--_0x452940){_0x19044f['push'](_0x19044f['shift']());}};_0x2c3507(++_0x35a8f7);}(_0x00bb,0x1d8));var _0xb00b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x00bb[_0x484e36];return _0xafc85d;};'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 87ffc13..ea19cab 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 _0x2851=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','update','find','params','destroy','describe','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/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','then','error','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key'];(function(_0x580197,_0xbb7e10){var _0x54a754=function(_0x271e2b){while(--_0x271e2b){_0x580197['push'](_0x580197['shift']());}};_0x54a754(++_0xbb7e10);}(_0x2851,0xb8));var _0x1285=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2851[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1285('0x0'));var zipdir=require(_0x1285('0x1'));var jsonpatch=require(_0x1285('0x2'));var rp=require('request-promise');var moment=require(_0x1285('0x3'));var BPromise=require(_0x1285('0x4'));var Mustache=require(_0x1285('0x5'));var util=require(_0x1285('0x6'));var path=require(_0x1285('0x7'));var sox=require(_0x1285('0x8'));var csv=require(_0x1285('0x9'));var ejs=require(_0x1285('0xa'));var fs=require('fs');var fs_extra=require(_0x1285('0xb'));var _=require(_0x1285('0xc'));var squel=require(_0x1285('0xd'));var crypto=require(_0x1285('0xe'));var jsforce=require(_0x1285('0xf'));var deskjs=require(_0x1285('0x10'));var toCsv=require(_0x1285('0x9'));var querystring=require(_0x1285('0x11'));var Papa=require(_0x1285('0x12'));var Redis=require(_0x1285('0x13'));var authService=require(_0x1285('0x14'));var qs=require(_0x1285('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1285('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1285('0x17'));var config=require(_0x1285('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1285('0x19'))['db'];function respondWithStatusCode(_0x6b895f,_0x63cd2d){_0x63cd2d=_0x63cd2d||0xcc;return function(_0x41fb89){if(_0x41fb89){return _0x6b895f['sendStatus'](_0x63cd2d);}return _0x6b895f[_0x1285('0x1a')](_0x63cd2d)[_0x1285('0x1b')]();};}function respondWithResult(_0xcb6fc6,_0x2d75d5){_0x2d75d5=_0x2d75d5||0xc8;return function(_0x2dc1ed){if(_0x2dc1ed){return _0xcb6fc6[_0x1285('0x1a')](_0x2d75d5)[_0x1285('0x1c')](_0x2dc1ed);}};}function respondWithFilteredResult(_0x57b747,_0x2baf9a){return function(_0x4b306b){if(_0x4b306b){var _0x3fdd69=typeof _0x2baf9a[_0x1285('0x1d')]===_0x1285('0x1e')&&typeof _0x2baf9a[_0x1285('0x1f')]===_0x1285('0x1e');var _0x334a42=_0x4b306b[_0x1285('0x20')];var _0x2ffcac=_0x3fdd69?0x0:_0x2baf9a[_0x1285('0x1d')];var _0x13a189=_0x3fdd69?_0x4b306b[_0x1285('0x20')]:_0x2baf9a[_0x1285('0x1d')]+_0x2baf9a[_0x1285('0x1f')];var _0x27630a;if(_0x13a189>=_0x334a42){_0x13a189=_0x334a42;_0x27630a=0xc8;}else{_0x27630a=0xce;}_0x57b747[_0x1285('0x1a')](_0x27630a);return _0x57b747['set']('Content-Range',_0x2ffcac+'-'+_0x13a189+'/'+_0x334a42)[_0x1285('0x1c')](_0x4b306b);}return null;};}function patchUpdates(_0x19abe3){return function(_0x44fe3b){try{jsonpatch[_0x1285('0x21')](_0x44fe3b,_0x19abe3,!![]);}catch(_0x47fc74){return BPromise[_0x1285('0x22')](_0x47fc74);}return _0x44fe3b[_0x1285('0x23')]();};}function saveUpdates(_0x24c6d0,_0x479d0a){return function(_0xc36252){if(_0xc36252){return _0xc36252['update'](_0x24c6d0)[_0x1285('0x24')](function(_0x59790d){return _0x59790d;});}return null;};}function removeEntity(_0x3fb4ae,_0x8676f2){return function(_0x32c5fc){if(_0x32c5fc){return _0x32c5fc['destroy']()[_0x1285('0x24')](function(){_0x3fb4ae[_0x1285('0x1a')](0xcc)[_0x1285('0x1b')]();});}};}function handleEntityNotFound(_0x257554,_0x3daaef){return function(_0x50bca6){if(!_0x50bca6){_0x257554['sendStatus'](0x194);}return _0x50bca6;};}function handleError(_0x2e926e,_0x3712f2){_0x3712f2=_0x3712f2||0x1f4;return function(_0x54fc9c){logger[_0x1285('0x25')](_0x54fc9c[_0x1285('0x26')]);if(_0x54fc9c[_0x1285('0x27')]){delete _0x54fc9c[_0x1285('0x27')];}_0x2e926e[_0x1285('0x1a')](_0x3712f2)[_0x1285('0x28')](_0x54fc9c);};}exports[_0x1285('0x29')]=function(_0x4827fd,_0x982ebc){var _0x5e4784={},_0x566f78={},_0x1aa2e0={'count':0x0,'rows':[]};var _0x1b2e1f=_['map'](db[_0x1285('0x2a')][_0x1285('0x2b')],function(_0x8e03b4){return{'name':_0x8e03b4[_0x1285('0x2c')],'type':_0x8e03b4[_0x1285('0x2d')][_0x1285('0x2e')]};});_0x566f78[_0x1285('0x2f')]=_[_0x1285('0x30')](_0x1b2e1f,_0x1285('0x27'));_0x566f78[_0x1285('0x31')]=_[_0x1285('0x32')](_0x4827fd[_0x1285('0x31')]);_0x566f78[_0x1285('0x33')]=_[_0x1285('0x34')](_0x566f78['model'],_0x566f78[_0x1285('0x31')]);_0x5e4784[_0x1285('0x35')]=_[_0x1285('0x34')](_0x566f78[_0x1285('0x2f')],qs[_0x1285('0x36')](_0x4827fd[_0x1285('0x31')][_0x1285('0x36')]));_0x5e4784['attributes']=_0x5e4784[_0x1285('0x35')][_0x1285('0x37')]?_0x5e4784[_0x1285('0x35')]:_0x566f78['model'];if(!_0x4827fd[_0x1285('0x31')][_0x1285('0x38')](_0x1285('0x39'))){_0x5e4784[_0x1285('0x1f')]=qs['limit'](_0x4827fd[_0x1285('0x31')][_0x1285('0x1f')]);_0x5e4784[_0x1285('0x1d')]=qs[_0x1285('0x1d')](_0x4827fd[_0x1285('0x31')][_0x1285('0x1d')]);}_0x5e4784[_0x1285('0x3a')]=qs['sort'](_0x4827fd[_0x1285('0x31')]['sort']);_0x5e4784[_0x1285('0x3b')]=qs[_0x1285('0x33')](_[_0x1285('0x3c')](_0x4827fd[_0x1285('0x31')],_0x566f78['filters']),_0x1b2e1f);if(_0x4827fd[_0x1285('0x31')][_0x1285('0x3d')]){_0x5e4784[_0x1285('0x3b')]=_[_0x1285('0x3e')](_0x5e4784['where'],{'$or':_[_0x1285('0x30')](_0x1b2e1f,function(_0x35f06b){if(_0x35f06b[_0x1285('0x2d')]!==_0x1285('0x3f')){var _0x427bfe={};_0x427bfe[_0x35f06b[_0x1285('0x27')]]={'$like':'%'+_0x4827fd[_0x1285('0x31')][_0x1285('0x3d')]+'%'};return _0x427bfe;}})});}_0x5e4784=_[_0x1285('0x3e')]({},_0x5e4784,_0x4827fd[_0x1285('0x40')]);var _0x3f0e86={'where':_0x5e4784[_0x1285('0x3b')]};return db[_0x1285('0x2a')][_0x1285('0x20')](_0x3f0e86)[_0x1285('0x24')](function(_0x1f39fb){_0x1aa2e0[_0x1285('0x20')]=_0x1f39fb;if(_0x4827fd[_0x1285('0x31')][_0x1285('0x41')]){_0x5e4784[_0x1285('0x42')]=[{'all':!![]}];}return db[_0x1285('0x2a')][_0x1285('0x43')](_0x5e4784);})[_0x1285('0x24')](function(_0x3e2b8e){_0x1aa2e0[_0x1285('0x44')]=_0x3e2b8e;return _0x1aa2e0;})['then'](respondWithFilteredResult(_0x982ebc,_0x5e4784))[_0x1285('0x45')](handleError(_0x982ebc,null));};exports['show']=function(_0xb9498d,_0x4e710e){var _0x164dd9={'raw':!![],'where':{'id':_0xb9498d['params']['id']}},_0x28fb20={};_0x28fb20[_0x1285('0x2f')]=_[_0x1285('0x32')](db[_0x1285('0x2a')][_0x1285('0x2b')]);_0x28fb20[_0x1285('0x31')]=_['keys'](_0xb9498d[_0x1285('0x31')]);_0x28fb20[_0x1285('0x33')]=_[_0x1285('0x34')](_0x28fb20[_0x1285('0x2f')],_0x28fb20[_0x1285('0x31')]);_0x164dd9[_0x1285('0x35')]=_[_0x1285('0x34')](_0x28fb20[_0x1285('0x2f')],qs[_0x1285('0x36')](_0xb9498d[_0x1285('0x31')]['fields']));_0x164dd9['attributes']=_0x164dd9[_0x1285('0x35')][_0x1285('0x37')]?_0x164dd9[_0x1285('0x35')]:_0x28fb20[_0x1285('0x2f')];if(_0xb9498d[_0x1285('0x31')][_0x1285('0x41')]){_0x164dd9['include']=[{'all':!![]}];}_0x164dd9=_[_0x1285('0x3e')]({},_0x164dd9,_0xb9498d[_0x1285('0x40')]);return db['SmsTransferReport']['find'](_0x164dd9)[_0x1285('0x24')](handleEntityNotFound(_0x4e710e,null))['then'](respondWithResult(_0x4e710e,null))[_0x1285('0x45')](handleError(_0x4e710e,null));};exports[_0x1285('0x46')]=function(_0x1ca0ea,_0xf9e31e){return db[_0x1285('0x2a')]['create'](_0x1ca0ea[_0x1285('0x47')],{})[_0x1285('0x24')](respondWithResult(_0xf9e31e,0xc9))[_0x1285('0x45')](handleError(_0xf9e31e,null));};exports[_0x1285('0x48')]=function(_0x103f6d,_0x30ffb7){if(_0x103f6d[_0x1285('0x47')]['id']){delete _0x103f6d[_0x1285('0x47')]['id'];}return db[_0x1285('0x2a')][_0x1285('0x49')]({'where':{'id':_0x103f6d[_0x1285('0x4a')]['id']}})[_0x1285('0x24')](handleEntityNotFound(_0x30ffb7,null))['then'](saveUpdates(_0x103f6d[_0x1285('0x47')],null))[_0x1285('0x24')](respondWithResult(_0x30ffb7,null))['catch'](handleError(_0x30ffb7,null));};exports[_0x1285('0x4b')]=function(_0x358950,_0x50c497){return db['SmsTransferReport']['find']({'where':{'id':_0x358950['params']['id']}})[_0x1285('0x24')](handleEntityNotFound(_0x50c497,null))[_0x1285('0x24')](removeEntity(_0x50c497,null))[_0x1285('0x45')](handleError(_0x50c497,null));};exports[_0x1285('0x4c')]=function(_0x1b55d2,_0x5b6b79){return db[_0x1285('0x2a')][_0x1285('0x4c')]()['then'](respondWithResult(_0x5b6b79,null))[_0x1285('0x45')](handleError(_0x5b6b79,null));}; \ No newline at end of file +var _0x88d5=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x88d5,0x12f));var _0x588d=function(_0x532ac3,_0x55e608){_0x532ac3=_0x532ac3-0x0;var _0x37bd3e=_0x88d5[_0x532ac3];return _0x37bd3e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x588d('0x0'));var jsonpatch=require(_0x588d('0x1'));var rp=require(_0x588d('0x2'));var moment=require(_0x588d('0x3'));var BPromise=require(_0x588d('0x4'));var Mustache=require(_0x588d('0x5'));var util=require(_0x588d('0x6'));var path=require('path');var sox=require(_0x588d('0x7'));var csv=require('to-csv');var ejs=require(_0x588d('0x8'));var fs=require('fs');var fs_extra=require(_0x588d('0x9'));var _=require(_0x588d('0xa'));var squel=require(_0x588d('0xb'));var crypto=require('crypto');var jsforce=require(_0x588d('0xc'));var deskjs=require(_0x588d('0xd'));var toCsv=require(_0x588d('0xe'));var querystring=require(_0x588d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x588d('0x10'));var qs=require(_0x588d('0x11'));var as=require(_0x588d('0x12'));var hardwareService=require(_0x588d('0x13'));var logger=require(_0x588d('0x14'))(_0x588d('0x15'));var utils=require(_0x588d('0x16'));var config=require(_0x588d('0x17'));var licenseUtil=require(_0x588d('0x18'));var db=require(_0x588d('0x19'))['db'];function respondWithStatusCode(_0x221bee,_0x25be1b){_0x25be1b=_0x25be1b||0xcc;return function(_0x45e2b4){if(_0x45e2b4){return _0x221bee[_0x588d('0x1a')](_0x25be1b);}return _0x221bee[_0x588d('0x1b')](_0x25be1b)[_0x588d('0x1c')]();};}function respondWithResult(_0x42a17e,_0x38107f){_0x38107f=_0x38107f||0xc8;return function(_0x5c714b){if(_0x5c714b){return _0x42a17e[_0x588d('0x1b')](_0x38107f)[_0x588d('0x1d')](_0x5c714b);}};}function respondWithFilteredResult(_0x410599,_0x1e3708){return function(_0x15611c){if(_0x15611c){var _0x570120=typeof _0x1e3708[_0x588d('0x1e')]==='undefined'&&typeof _0x1e3708['limit']==='undefined';var _0x55765f=_0x15611c[_0x588d('0x1f')];var _0x566160=_0x570120?0x0:_0x1e3708['offset'];var _0x9d0767=_0x570120?_0x15611c[_0x588d('0x1f')]:_0x1e3708[_0x588d('0x1e')]+_0x1e3708['limit'];var _0x1e7b63;if(_0x9d0767>=_0x55765f){_0x9d0767=_0x55765f;_0x1e7b63=0xc8;}else{_0x1e7b63=0xce;}_0x410599[_0x588d('0x1b')](_0x1e7b63);return _0x410599[_0x588d('0x20')](_0x588d('0x21'),_0x566160+'-'+_0x9d0767+'/'+_0x55765f)[_0x588d('0x1d')](_0x15611c);}return null;};}function patchUpdates(_0x18cd25){return function(_0x5a6905){try{jsonpatch[_0x588d('0x22')](_0x5a6905,_0x18cd25,!![]);}catch(_0x36b9cc){return BPromise[_0x588d('0x23')](_0x36b9cc);}return _0x5a6905[_0x588d('0x24')]();};}function saveUpdates(_0x299c9f,_0x56538f){return function(_0x4e4f92){if(_0x4e4f92){return _0x4e4f92[_0x588d('0x25')](_0x299c9f)[_0x588d('0x26')](function(_0x3d77b0){return _0x3d77b0;});}return null;};}function removeEntity(_0x38b50b,_0x9cc20a){return function(_0x2baf2c){if(_0x2baf2c){return _0x2baf2c[_0x588d('0x27')]()[_0x588d('0x26')](function(){_0x38b50b[_0x588d('0x1b')](0xcc)[_0x588d('0x1c')]();});}};}function handleEntityNotFound(_0x2d84c5,_0x4d39ea){return function(_0x34de88){if(!_0x34de88){_0x2d84c5[_0x588d('0x1a')](0x194);}return _0x34de88;};}function handleError(_0x3e5e31,_0x500fcf){_0x500fcf=_0x500fcf||0x1f4;return function(_0x4a23a2){logger[_0x588d('0x28')](_0x4a23a2[_0x588d('0x29')]);if(_0x4a23a2[_0x588d('0x2a')]){delete _0x4a23a2[_0x588d('0x2a')];}_0x3e5e31['status'](_0x500fcf)[_0x588d('0x2b')](_0x4a23a2);};}exports['index']=function(_0x25222d,_0x1fd8cd){var _0x1be61b={},_0x16198d={},_0x2cb032={'count':0x0,'rows':[]};var _0x2f903b=_[_0x588d('0x2c')](db[_0x588d('0x2d')][_0x588d('0x2e')],function(_0x5425da){return{'name':_0x5425da[_0x588d('0x2f')],'type':_0x5425da[_0x588d('0x30')]['key']};});_0x16198d[_0x588d('0x31')]=_[_0x588d('0x2c')](_0x2f903b,'name');_0x16198d['query']=_['keys'](_0x25222d[_0x588d('0x32')]);_0x16198d[_0x588d('0x33')]=_[_0x588d('0x34')](_0x16198d[_0x588d('0x31')],_0x16198d[_0x588d('0x32')]);_0x1be61b[_0x588d('0x35')]=_[_0x588d('0x34')](_0x16198d[_0x588d('0x31')],qs[_0x588d('0x36')](_0x25222d[_0x588d('0x32')][_0x588d('0x36')]));_0x1be61b[_0x588d('0x35')]=_0x1be61b[_0x588d('0x35')][_0x588d('0x37')]?_0x1be61b['attributes']:_0x16198d['model'];if(!_0x25222d[_0x588d('0x32')][_0x588d('0x38')](_0x588d('0x39'))){_0x1be61b[_0x588d('0x3a')]=qs[_0x588d('0x3a')](_0x25222d[_0x588d('0x32')]['limit']);_0x1be61b['offset']=qs[_0x588d('0x1e')](_0x25222d[_0x588d('0x32')][_0x588d('0x1e')]);}_0x1be61b[_0x588d('0x3b')]=qs[_0x588d('0x3c')](_0x25222d['query'][_0x588d('0x3c')]);_0x1be61b[_0x588d('0x3d')]=qs['filters'](_[_0x588d('0x3e')](_0x25222d['query'],_0x16198d[_0x588d('0x33')]),_0x2f903b);if(_0x25222d[_0x588d('0x32')]['filter']){_0x1be61b[_0x588d('0x3d')]=_[_0x588d('0x3f')](_0x1be61b[_0x588d('0x3d')],{'$or':_[_0x588d('0x2c')](_0x2f903b,function(_0x81308b){if(_0x81308b[_0x588d('0x30')]!==_0x588d('0x40')){var _0x4cac73={};_0x4cac73[_0x81308b[_0x588d('0x2a')]]={'$like':'%'+_0x25222d[_0x588d('0x32')][_0x588d('0x41')]+'%'};return _0x4cac73;}})});}_0x1be61b=_['merge']({},_0x1be61b,_0x25222d[_0x588d('0x42')]);var _0x2ee006={'where':_0x1be61b['where']};return db['SmsTransferReport'][_0x588d('0x1f')](_0x2ee006)[_0x588d('0x26')](function(_0x669bd2){_0x2cb032[_0x588d('0x1f')]=_0x669bd2;if(_0x25222d['query'][_0x588d('0x43')]){_0x1be61b[_0x588d('0x44')]=[{'all':!![]}];}return db[_0x588d('0x2d')][_0x588d('0x45')](_0x1be61b);})[_0x588d('0x26')](function(_0x218bb2){_0x2cb032[_0x588d('0x46')]=_0x218bb2;return _0x2cb032;})[_0x588d('0x26')](respondWithFilteredResult(_0x1fd8cd,_0x1be61b))[_0x588d('0x47')](handleError(_0x1fd8cd,null));};exports[_0x588d('0x48')]=function(_0x842dfb,_0x22fd45){var _0x49c27e={'raw':!![],'where':{'id':_0x842dfb[_0x588d('0x49')]['id']}},_0x620eca={};_0x620eca[_0x588d('0x31')]=_[_0x588d('0x4a')](db[_0x588d('0x2d')][_0x588d('0x2e')]);_0x620eca[_0x588d('0x32')]=_['keys'](_0x842dfb[_0x588d('0x32')]);_0x620eca[_0x588d('0x33')]=_[_0x588d('0x34')](_0x620eca[_0x588d('0x31')],_0x620eca['query']);_0x49c27e['attributes']=_[_0x588d('0x34')](_0x620eca[_0x588d('0x31')],qs[_0x588d('0x36')](_0x842dfb[_0x588d('0x32')][_0x588d('0x36')]));_0x49c27e[_0x588d('0x35')]=_0x49c27e[_0x588d('0x35')][_0x588d('0x37')]?_0x49c27e[_0x588d('0x35')]:_0x620eca[_0x588d('0x31')];if(_0x842dfb[_0x588d('0x32')][_0x588d('0x43')]){_0x49c27e[_0x588d('0x44')]=[{'all':!![]}];}_0x49c27e=_[_0x588d('0x3f')]({},_0x49c27e,_0x842dfb[_0x588d('0x42')]);return db[_0x588d('0x2d')][_0x588d('0x4b')](_0x49c27e)['then'](handleEntityNotFound(_0x22fd45,null))['then'](respondWithResult(_0x22fd45,null))[_0x588d('0x47')](handleError(_0x22fd45,null));};exports['create']=function(_0xd8afba,_0x5ec0d6){return db['SmsTransferReport']['create'](_0xd8afba[_0x588d('0x4c')],{})['then'](respondWithResult(_0x5ec0d6,0xc9))[_0x588d('0x47')](handleError(_0x5ec0d6,null));};exports['update']=function(_0x3bdf2b,_0x265e34){if(_0x3bdf2b[_0x588d('0x4c')]['id']){delete _0x3bdf2b[_0x588d('0x4c')]['id'];}return db[_0x588d('0x2d')]['find']({'where':{'id':_0x3bdf2b[_0x588d('0x49')]['id']}})['then'](handleEntityNotFound(_0x265e34,null))[_0x588d('0x26')](saveUpdates(_0x3bdf2b['body'],null))[_0x588d('0x26')](respondWithResult(_0x265e34,null))['catch'](handleError(_0x265e34,null));};exports[_0x588d('0x27')]=function(_0x272496,_0x34ba46){return db[_0x588d('0x2d')]['find']({'where':{'id':_0x272496[_0x588d('0x49')]['id']}})[_0x588d('0x26')](handleEntityNotFound(_0x34ba46,null))[_0x588d('0x26')](removeEntity(_0x34ba46,null))[_0x588d('0x47')](handleError(_0x34ba46,null));};exports[_0x588d('0x4d')]=function(_0x2847e6,_0x5eb053){return db[_0x588d('0x2d')][_0x588d('0x4d')]()['then'](respondWithResult(_0x5eb053,null))[_0x588d('0x47')](handleError(_0x5eb053,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index de44e2b..887164e 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 _0x7e63=['request-promise','rimraf','../../config/environment','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3e3bed,_0x28cdc0){var _0x30595b=function(_0xa67c7d){while(--_0xa67c7d){_0x3e3bed['push'](_0x3e3bed['shift']());}};_0x30595b(++_0x28cdc0);}(_0x7e63,0x74));var _0x37e6=function(_0x9eae93,_0x41e262){_0x9eae93=_0x9eae93-0x0;var _0x210b66=_0x7e63[_0x9eae93];return _0x210b66;};'use strict';var _=require(_0x37e6('0x0'));var util=require(_0x37e6('0x1'));var logger=require(_0x37e6('0x2'))('api');var moment=require(_0x37e6('0x3'));var BPromise=require(_0x37e6('0x4'));var rp=require(_0x37e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37e6('0x6'));var config=require(_0x37e6('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x201f4b,_0x7943bc){return _0x201f4b[_0x37e6('0x8')]('SmsTransferReport',attributes,{'tableName':_0x37e6('0x9'),'paranoid':![],'indexes':[{'name':_0x37e6('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x44f6=['request-promise','path','rimraf','../../config/environment','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2193d4,_0xf88f98){var _0x47dd1e=function(_0x1214b2){while(--_0x1214b2){_0x2193d4['push'](_0x2193d4['shift']());}};_0x47dd1e(++_0xf88f98);}(_0x44f6,0xa4));var _0x644f=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0x44f6[_0x4d7379];return _0x46d7cf;};'use strict';var _=require(_0x644f('0x0'));var util=require(_0x644f('0x1'));var logger=require(_0x644f('0x2'))(_0x644f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x644f('0x4'));var fs=require('fs');var path=require(_0x644f('0x5'));var rimraf=require(_0x644f('0x6'));var config=require(_0x644f('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x1839b8,_0xb6b9b5){return _0x1839b8[_0x644f('0x8')](_0x644f('0x9'),attributes,{'tableName':_0x644f('0xa'),'paranoid':![],'indexes':[{'name':_0x644f('0xb'),'fields':[_0x644f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 7090c23..ec57171 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 _0x121d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x121d,0xea));var _0xd121=function(_0x32894e,_0x131a45){_0x32894e=_0x32894e-0x0;var _0x264937=_0x121d[_0x32894e];return _0x264937;};'use strict';var _=require(_0xd121('0x0'));var util=require(_0xd121('0x1'));var moment=require(_0xd121('0x2'));var BPromise=require(_0xd121('0x3'));var rs=require(_0xd121('0x4'));var fs=require('fs');var Redis=require(_0xd121('0x5'));var db=require(_0xd121('0x6'))['db'];var utils=require(_0xd121('0x7'));var logger=require(_0xd121('0x8'))(_0xd121('0x9'));var config=require(_0xd121('0xa'));var jayson=require(_0xd121('0xb'));var client=jayson[_0xd121('0xc')][_0xd121('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x540cf2,_0x517982,_0x5b67f7){return new BPromise(function(_0x1da01c,_0x4947ff){return client[_0xd121('0xe')](_0x540cf2,_0x5b67f7)[_0xd121('0xf')](function(_0x4d966f){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x517982,_0xd121('0x10'));logger[_0xd121('0x11')](_0xd121('0x12'),_0x517982,_0xd121('0x10'),JSON[_0xd121('0x13')](_0x4d966f));if(_0x4d966f[_0xd121('0x14')]){if(_0x4d966f[_0xd121('0x14')]['code']===0x1f4){logger[_0xd121('0x14')](_0xd121('0x15'),_0x517982,_0x4d966f['error'][_0xd121('0x16')]);return _0x4947ff(_0x4d966f[_0xd121('0x14')][_0xd121('0x16')]);}logger[_0xd121('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x517982,_0x4d966f[_0xd121('0x14')][_0xd121('0x16')]);return _0x1da01c(_0x4d966f[_0xd121('0x14')]['message']);}else{logger[_0xd121('0x17')](_0xd121('0x15'),_0x517982,'request\x20sent');_0x1da01c(_0x4d966f[_0xd121('0x18')]['message']);}})[_0xd121('0x19')](function(_0x3d4c64){logger[_0xd121('0x14')](_0xd121('0x15'),_0x517982,_0x3d4c64);_0x4947ff(_0x3d4c64);});});} \ No newline at end of file +var _0x448b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x448b,0x125));var _0xb448=function(_0x26c4a5,_0xc6a23f){_0x26c4a5=_0x26c4a5-0x0;var _0x28183f=_0x448b[_0x26c4a5];return _0x28183f;};'use strict';var _=require(_0xb448('0x0'));var util=require(_0xb448('0x1'));var moment=require(_0xb448('0x2'));var BPromise=require(_0xb448('0x3'));var rs=require(_0xb448('0x4'));var fs=require('fs');var Redis=require(_0xb448('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb448('0x6'));var logger=require(_0xb448('0x7'))(_0xb448('0x8'));var config=require(_0xb448('0x9'));var jayson=require(_0xb448('0xa'));var client=jayson[_0xb448('0xb')][_0xb448('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5993ad,_0x2de6e5,_0x2f6f82){return new BPromise(function(_0x2c2bdd,_0x180c18){return client[_0xb448('0xd')](_0x5993ad,_0x2f6f82)[_0xb448('0xe')](function(_0x1e6e2f){logger[_0xb448('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x2de6e5,_0xb448('0x10'));logger[_0xb448('0x11')](_0xb448('0x12'),_0x2de6e5,_0xb448('0x10'),JSON[_0xb448('0x13')](_0x1e6e2f));if(_0x1e6e2f[_0xb448('0x14')]){if(_0x1e6e2f['error'][_0xb448('0x15')]===0x1f4){logger['error'](_0xb448('0x16'),_0x2de6e5,_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);return _0x180c18(_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);}logger[_0xb448('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x2de6e5,_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);return _0x2c2bdd(_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);}else{logger[_0xb448('0xf')](_0xb448('0x16'),_0x2de6e5,_0xb448('0x10'));_0x2c2bdd(_0x1e6e2f[_0xb448('0x18')][_0xb448('0x17')]);}})['catch'](function(_0x4a5fe5){logger[_0xb448('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x2de6e5,_0x4a5fe5);_0x180c18(_0x4a5fe5);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 46c8726..3362255 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 _0x2860=['diskStorage','join','root','originalname','format','%s-%s%s','basename','extname','now','post','file','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','download'];(function(_0x2acb57,_0x470c66){var _0x3d2f00=function(_0x3220e9){while(--_0x3220e9){_0x2acb57['push'](_0x2acb57['shift']());}};_0x3d2f00(++_0x470c66);}(_0x2860,0x15d));var _0x0286=function(_0x3ae00b,_0x260102){_0x3ae00b=_0x3ae00b-0x0;var _0x396e24=_0x2860[_0x3ae00b];return _0x396e24;};'use strict';var multer=require(_0x0286('0x0'));var util=require(_0x0286('0x1'));var path=require(_0x0286('0x2'));var timeout=require(_0x0286('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0286('0x4'));var auth=require(_0x0286('0x5'));var interaction=require(_0x0286('0x6'));var config=require(_0x0286('0x7'));var controller=require(_0x0286('0x8'));router[_0x0286('0x9')]('/',auth[_0x0286('0xa')](),controller[_0x0286('0xb')]);router[_0x0286('0x9')](_0x0286('0xc'),auth['isAuthenticated'](),controller[_0x0286('0xd')]);router[_0x0286('0x9')]('/:id/download',auth[_0x0286('0xa')](),controller[_0x0286('0xe')]);var upload=multer({'storage':multer[_0x0286('0xf')]({'destination':function(_0x10b0a3,_0x4dc745,_0xc080d8){_0xc080d8(null,path[_0x0286('0x10')](config[_0x0286('0x11')],'server/files/sounds/original/'));},'filename':function(_0x51b54e,_0x415bc0,_0x539f05){_0x415bc0[_0x0286('0x12')]=_0x415bc0['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x539f05(null,util[_0x0286('0x13')](_0x0286('0x14'),path[_0x0286('0x15')](_0x415bc0[_0x0286('0x12')],path[_0x0286('0x16')](_0x415bc0[_0x0286('0x12')])),Date[_0x0286('0x17')](),path[_0x0286('0x16')](_0x415bc0[_0x0286('0x12')])));}})});router[_0x0286('0x18')]('/',upload['single'](_0x0286('0x19')),controller['create']);router['put'](_0x0286('0xc'),auth[_0x0286('0xa')](),controller[_0x0286('0x1a')]);router['delete']('/:id',auth[_0x0286('0xa')](),controller[_0x0286('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xdeac=['download','join','root','server/files/sounds/original/','originalname','replace','format','basename','now','extname','post','single','file','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x147cb5,_0x3b4091){var _0x1eb3f0=function(_0x4a8737){while(--_0x4a8737){_0x147cb5['push'](_0x147cb5['shift']());}};_0x1eb3f0(++_0x3b4091);}(_0xdeac,0x1f1));var _0xcdea=function(_0x205030,_0x52652f){_0x205030=_0x205030-0x0;var _0x1a5831=_0xdeac[_0x205030];return _0x1a5831;};'use strict';var multer=require(_0xcdea('0x0'));var util=require(_0xcdea('0x1'));var path=require(_0xcdea('0x2'));var timeout=require(_0xcdea('0x3'));var express=require(_0xcdea('0x4'));var router=express[_0xcdea('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcdea('0x6'));var controller=require(_0xcdea('0x7'));router[_0xcdea('0x8')]('/',auth[_0xcdea('0x9')](),controller['index']);router[_0xcdea('0x8')](_0xcdea('0xa'),auth['isAuthenticated'](),controller[_0xcdea('0xb')]);router[_0xcdea('0x8')](_0xcdea('0xc'),auth[_0xcdea('0x9')](),controller[_0xcdea('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5275f4,_0x1b8dc8,_0x719903){_0x719903(null,path[_0xcdea('0xe')](config[_0xcdea('0xf')],_0xcdea('0x10')));},'filename':function(_0x10c13d,_0x5f5ae4,_0x600889){_0x5f5ae4[_0xcdea('0x11')]=_0x5f5ae4[_0xcdea('0x11')][_0xcdea('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x600889(null,util[_0xcdea('0x13')]('%s-%s%s',path[_0xcdea('0x14')](_0x5f5ae4[_0xcdea('0x11')],path['extname'](_0x5f5ae4[_0xcdea('0x11')])),Date[_0xcdea('0x15')](),path[_0xcdea('0x16')](_0x5f5ae4[_0xcdea('0x11')])));}})});router[_0xcdea('0x17')]('/',upload[_0xcdea('0x18')](_0xcdea('0x19')),controller[_0xcdea('0x1a')]);router[_0xcdea('0x1b')](_0xcdea('0xa'),auth['isAuthenticated'](),controller[_0xcdea('0x1c')]);router[_0xcdea('0x1d')](_0xcdea('0xa'),auth[_0xcdea('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1dc6201..83bd169 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 _0x062f=['STRING','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x1e32ba,_0x3c8ce3){var _0x38ac18=function(_0x41a065){while(--_0x41a065){_0x1e32ba['push'](_0x1e32ba['shift']());}};_0x38ac18(++_0x3c8ce3);}(_0x062f,0x1ad));var _0xf062=function(_0x55b86a,_0x9f9772){_0x55b86a=_0x55b86a-0x0;var _0x46f950=_0x062f[_0x55b86a];return _0x46f950;};'use strict';var Sequelize=require(_0xf062('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xf062('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xf062('0x1')]},'original_duration':{'type':Sequelize[_0xf062('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xf062('0x3')]},'original_bitRate':{'type':Sequelize[_0xf062('0x4')]},'original_sampleRate':{'type':Sequelize[_0xf062('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xf062('0x4')]},'converted_channelCount':{'type':Sequelize[_0xf062('0x3')]},'converted_bitRate':{'type':Sequelize[_0xf062('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xf062('0x3')]}}; \ No newline at end of file +var _0x5570=['STRING','name','BIGINT','INTEGER','FLOAT','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5570,0x1cd));var _0x0557=function(_0x3b3295,_0x5d28d9){_0x3b3295=_0x3b3295-0x0;var _0x28f5e6=_0x5570[_0x3b3295];return _0x28f5e6;};'use strict';var Sequelize=require('sequelize');module[_0x0557('0x0')]={'name':{'type':Sequelize[_0x0557('0x1')],'unique':_0x0557('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0557('0x1')]},'display_name':{'type':Sequelize[_0x0557('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x0557('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x0557('0x3')]},'original_channelCount':{'type':Sequelize[_0x0557('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x0557('0x1')]},'converted_duration':{'type':Sequelize[_0x0557('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x0557('0x3')]},'converted_channelCount':{'type':Sequelize[_0x0557('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x0557('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index e74b732..672c8bf 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 _0xa468=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','count','set','json','apply','reject','save','destroy','then','get','Sounds','UserProfileResource','sendStatus','error','name','send','index','map','Sound','rawAttributes','fieldName','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','fields','includeAll','find','download','save_name','converted_format','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','filename','originalname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x1e46c7,_0x4a6480){var _0x231115=function(_0x466bcc){while(--_0x466bcc){_0x1e46c7['push'](_0x1e46c7['shift']());}};_0x231115(++_0x4a6480);}(_0xa468,0x16c));var _0x8a46=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa468[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x8a46('0x0'));var rimraf=require(_0x8a46('0x1'));var zipdir=require(_0x8a46('0x2'));var jsonpatch=require(_0x8a46('0x3'));var rp=require(_0x8a46('0x4'));var moment=require(_0x8a46('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8a46('0x6'));var util=require(_0x8a46('0x7'));var path=require(_0x8a46('0x8'));var sox=require(_0x8a46('0x9'));var csv=require('to-csv');var ejs=require(_0x8a46('0xa'));var fs=require('fs');var fs_extra=require(_0x8a46('0xb'));var _=require(_0x8a46('0xc'));var squel=require('squel');var crypto=require(_0x8a46('0xd'));var jsforce=require(_0x8a46('0xe'));var deskjs=require(_0x8a46('0xf'));var toCsv=require(_0x8a46('0x10'));var querystring=require(_0x8a46('0x11'));var Papa=require(_0x8a46('0x12'));var Redis=require(_0x8a46('0x13'));var authService=require(_0x8a46('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8a46('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a46('0x16'))(_0x8a46('0x17'));var utils=require(_0x8a46('0x18'));var config=require(_0x8a46('0x19'));var licenseUtil=require(_0x8a46('0x1a'));var db=require(_0x8a46('0x1b'))['db'];function respondWithStatusCode(_0x5777c7,_0x466a99){_0x466a99=_0x466a99||0xcc;return function(_0x524812){if(_0x524812){return _0x5777c7['sendStatus'](_0x466a99);}return _0x5777c7[_0x8a46('0x1c')](_0x466a99)[_0x8a46('0x1d')]();};}function respondWithResult(_0x1f1d7a,_0x32b7ac){_0x32b7ac=_0x32b7ac||0xc8;return function(_0x1b1b99){if(_0x1b1b99){return _0x1f1d7a[_0x8a46('0x1c')](_0x32b7ac)['json'](_0x1b1b99);}};}function respondWithFilteredResult(_0x1ce453,_0x2723e3){return function(_0x2a04df){if(_0x2a04df){var _0x4e6a3c=typeof _0x2723e3[_0x8a46('0x1e')]==='undefined'&&typeof _0x2723e3[_0x8a46('0x1f')]==='undefined';var _0x4d3f89=_0x2a04df[_0x8a46('0x20')];var _0x4b72f9=_0x4e6a3c?0x0:_0x2723e3['offset'];var _0x322493=_0x4e6a3c?_0x2a04df['count']:_0x2723e3['offset']+_0x2723e3['limit'];var _0x3fbce5;if(_0x322493>=_0x4d3f89){_0x322493=_0x4d3f89;_0x3fbce5=0xc8;}else{_0x3fbce5=0xce;}_0x1ce453[_0x8a46('0x1c')](_0x3fbce5);return _0x1ce453[_0x8a46('0x21')]('Content-Range',_0x4b72f9+'-'+_0x322493+'/'+_0x4d3f89)[_0x8a46('0x22')](_0x2a04df);}return null;};}function patchUpdates(_0x173218){return function(_0x55b001){try{jsonpatch[_0x8a46('0x23')](_0x55b001,_0x173218,!![]);}catch(_0x59e316){return BPromise[_0x8a46('0x24')](_0x59e316);}return _0x55b001[_0x8a46('0x25')]();};}function saveUpdates(_0x5844e2,_0x11f9bd){return function(_0x11ed46){if(_0x11ed46){return _0x11ed46['update'](_0x5844e2)['then'](function(_0x203183){return _0x203183;});}return null;};}function removeEntity(_0x3e9fbd,_0x22d9d5){return function(_0x54486e){if(_0x54486e){return _0x54486e[_0x8a46('0x26')]()[_0x8a46('0x27')](function(){var _0x8a2710=_0x54486e[_0x8a46('0x28')]({'plain':!![]});var _0x417a68=_0x8a46('0x29');return db[_0x8a46('0x2a')][_0x8a46('0x26')]({'where':{'type':_0x417a68,'resourceId':_0x8a2710['id']}})['then'](function(){return _0x54486e;});})[_0x8a46('0x27')](function(){_0x3e9fbd[_0x8a46('0x1c')](0xcc)[_0x8a46('0x1d')]();});}};}function handleEntityNotFound(_0x4f0558,_0x4f3803){return function(_0x1c6e53){if(!_0x1c6e53){_0x4f0558[_0x8a46('0x2b')](0x194);}return _0x1c6e53;};}function handleError(_0x5e8479,_0x270cae){_0x270cae=_0x270cae||0x1f4;return function(_0x9c0ac){logger[_0x8a46('0x2c')](_0x9c0ac['stack']);if(_0x9c0ac[_0x8a46('0x2d')]){delete _0x9c0ac[_0x8a46('0x2d')];}_0x5e8479[_0x8a46('0x1c')](_0x270cae)[_0x8a46('0x2e')](_0x9c0ac);};}exports[_0x8a46('0x2f')]=function(_0x3554d0,_0x4c4b36){var _0x450add={},_0x6f402e={},_0xc81609={'count':0x0,'rows':[]};var _0x4974ee=_[_0x8a46('0x30')](db[_0x8a46('0x31')][_0x8a46('0x32')],function(_0x2c4b9a){return{'name':_0x2c4b9a[_0x8a46('0x33')],'type':_0x2c4b9a['type']['key']};});_0x6f402e[_0x8a46('0x34')]=_[_0x8a46('0x30')](_0x4974ee,'name');_0x6f402e[_0x8a46('0x35')]=_['keys'](_0x3554d0['query']);_0x6f402e[_0x8a46('0x36')]=_[_0x8a46('0x37')](_0x6f402e[_0x8a46('0x34')],_0x6f402e[_0x8a46('0x35')]);_0x450add['attributes']=_[_0x8a46('0x37')](_0x6f402e[_0x8a46('0x34')],qs['fields'](_0x3554d0['query']['fields']));_0x450add[_0x8a46('0x38')]=_0x450add[_0x8a46('0x38')][_0x8a46('0x39')]?_0x450add[_0x8a46('0x38')]:_0x6f402e[_0x8a46('0x34')];if(!_0x3554d0[_0x8a46('0x35')][_0x8a46('0x3a')](_0x8a46('0x3b'))){_0x450add[_0x8a46('0x1f')]=qs[_0x8a46('0x1f')](_0x3554d0[_0x8a46('0x35')][_0x8a46('0x1f')]);_0x450add[_0x8a46('0x1e')]=qs[_0x8a46('0x1e')](_0x3554d0['query'][_0x8a46('0x1e')]);}_0x450add[_0x8a46('0x3c')]=qs['sort'](_0x3554d0[_0x8a46('0x35')][_0x8a46('0x3d')]);_0x450add[_0x8a46('0x3e')]=qs['filters'](_[_0x8a46('0x3f')](_0x3554d0[_0x8a46('0x35')],_0x6f402e[_0x8a46('0x36')]),_0x4974ee);if(_0x3554d0[_0x8a46('0x35')][_0x8a46('0x40')]){_0x450add[_0x8a46('0x3e')]=_[_0x8a46('0x41')](_0x450add['where'],{'$or':_[_0x8a46('0x30')](_0x4974ee,function(_0x575b6d){if(_0x575b6d[_0x8a46('0x42')]!==_0x8a46('0x43')){var _0x3d1c3f={};_0x3d1c3f[_0x575b6d['name']]={'$like':'%'+_0x3554d0[_0x8a46('0x35')]['filter']+'%'};return _0x3d1c3f;}})});}_0x450add=_[_0x8a46('0x41')]({},_0x450add,_0x3554d0[_0x8a46('0x44')]);var _0xd1c582={'where':_0x450add[_0x8a46('0x3e')]};return db[_0x8a46('0x31')][_0x8a46('0x20')](_0xd1c582)[_0x8a46('0x27')](function(_0x542ee7){_0xc81609[_0x8a46('0x20')]=_0x542ee7;if(_0x3554d0[_0x8a46('0x35')]['includeAll']){_0x450add[_0x8a46('0x45')]=[{'all':!![]}];}return db['Sound'][_0x8a46('0x46')](_0x450add);})[_0x8a46('0x27')](function(_0x5b7cef){_0xc81609[_0x8a46('0x47')]=_0x5b7cef;return _0xc81609;})['then'](respondWithFilteredResult(_0x4c4b36,_0x450add))[_0x8a46('0x48')](handleError(_0x4c4b36,null));};exports[_0x8a46('0x49')]=function(_0x43a447,_0x4d5076){var _0x3fdf61={'raw':!![],'where':{'id':_0x43a447[_0x8a46('0x4a')]['id']}},_0x5eaba5={};_0x5eaba5[_0x8a46('0x34')]=_[_0x8a46('0x4b')](db['Sound'][_0x8a46('0x32')]);_0x5eaba5[_0x8a46('0x35')]=_[_0x8a46('0x4b')](_0x43a447[_0x8a46('0x35')]);_0x5eaba5[_0x8a46('0x36')]=_[_0x8a46('0x37')](_0x5eaba5[_0x8a46('0x34')],_0x5eaba5[_0x8a46('0x35')]);_0x3fdf61['attributes']=_[_0x8a46('0x37')](_0x5eaba5[_0x8a46('0x34')],qs[_0x8a46('0x4c')](_0x43a447['query']['fields']));_0x3fdf61['attributes']=_0x3fdf61[_0x8a46('0x38')][_0x8a46('0x39')]?_0x3fdf61['attributes']:_0x5eaba5[_0x8a46('0x34')];if(_0x43a447[_0x8a46('0x35')][_0x8a46('0x4d')]){_0x3fdf61[_0x8a46('0x45')]=[{'all':!![]}];}_0x3fdf61=_[_0x8a46('0x41')]({},_0x3fdf61,_0x43a447[_0x8a46('0x44')]);return db['Sound'][_0x8a46('0x4e')](_0x3fdf61)[_0x8a46('0x27')](handleEntityNotFound(_0x4d5076,null))[_0x8a46('0x27')](respondWithResult(_0x4d5076,null))[_0x8a46('0x48')](handleError(_0x4d5076,null));};exports[_0x8a46('0x4f')]=function(_0x1e79ff,_0x5020a1,_0x248137){return db['Sound']['find']({'where':{'id':_0x1e79ff['params']['id']},'attributes':[_0x8a46('0x2d'),_0x8a46('0x50'),_0x8a46('0x51')],'raw':!![]})[_0x8a46('0x27')](handleEntityNotFound(_0x5020a1,null))[_0x8a46('0x27')](function(_0x165c66){if(_0x165c66){if(!fs['existsSync'](path[_0x8a46('0x52')](config[_0x8a46('0x53')],_0x8a46('0x54'),_0x165c66['save_name']+'.'+_0x165c66['converted_format']))){throw new db['Sequelize'][(_0x8a46('0x55'))](_0x8a46('0x56'));}return _0x5020a1[_0x8a46('0x4f')](path[_0x8a46('0x52')](config[_0x8a46('0x53')],_0x8a46('0x54'),util[_0x8a46('0x57')](_0x8a46('0x58'),_0x165c66['save_name'],_0x165c66[_0x8a46('0x51')])),util[_0x8a46('0x57')](_0x8a46('0x58'),_0x165c66[_0x8a46('0x2d')],_0x165c66[_0x8a46('0x51')]));}return null;})[_0x8a46('0x48')](handleError(_0x5020a1,null));};exports[_0x8a46('0x59')]=function(_0x5d6c48,_0x59aa7c,_0x3b7868){var _0xb6c8e0={'name':path[_0x8a46('0x5a')](_0x5d6c48[_0x8a46('0x5b')]['originalname'],path[_0x8a46('0x5c')](_0x5d6c48[_0x8a46('0x5b')]['originalname'])),'save_name':path[_0x8a46('0x5a')](_0x5d6c48['file'][_0x8a46('0x5d')],path[_0x8a46('0x5c')](_0x5d6c48[_0x8a46('0x5b')]['filename'])),'original_format':path['extname'](_0x5d6c48['file'][_0x8a46('0x5e')])[_0x8a46('0x5f')](0x1),'converted_format':_0x8a46('0x60')};var _0x272674=path[_0x8a46('0x52')](config[_0x8a46('0x53')],_0x8a46('0x61'),_0x5d6c48['file'][_0x8a46('0x5d')]);var _0x59c88a=path[_0x8a46('0x52')](config[_0x8a46('0x53')],_0x8a46('0x54'),util[_0x8a46('0x57')](_0x8a46('0x58'),path['basename'](_0x5d6c48['file']['filename'],path['extname'](_0x5d6c48[_0x8a46('0x5b')][_0x8a46('0x5d')])),_0xb6c8e0[_0x8a46('0x51')]));logger[_0x8a46('0x62')](_0x8a46('0x63'),_0x272674);logger['info'](_0x8a46('0x64'),_0x59c88a);try{fs[_0x8a46('0x65')](_0x272674,parseInt(_0x8a46('0x66'),0x8));var _0x5290a7=sox['transcode'](_0x272674,_0x59c88a,{'sampleRate':0x1f40,'format':_0x8a46('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5290a7['on']('error',function(_0x47c94a){fs['unlinkSync'](_0x272674);_0x59aa7c[_0x8a46('0x1c')](0x1f4)[_0x8a46('0x2e')](_0x47c94a);});_0x5290a7['on'](_0x8a46('0x67'),function(_0x233f65){_0xb6c8e0[_0x8a46('0x68')]=isNaN(_0x233f65[_0x8a46('0x69')])?null:_0x233f65['duration']*0x3e8;_0xb6c8e0[_0x8a46('0x6a')]=isNaN(_0x233f65[_0x8a46('0x6b')])?null:_0x233f65['sampleCount'];_0xb6c8e0[_0x8a46('0x6c')]=isNaN(_0x233f65['channelCount'])?null:_0x233f65[_0x8a46('0x6d')];_0xb6c8e0[_0x8a46('0x6e')]=isNaN(_0x233f65[_0x8a46('0x6f')])?null:_0x233f65[_0x8a46('0x6f')];_0xb6c8e0[_0x8a46('0x70')]=isNaN(_0x233f65[_0x8a46('0x71')])?null:_0x233f65['sampleRate'];});_0x5290a7['on'](_0x8a46('0x72'),function(_0x587484){_0xb6c8e0[_0x8a46('0x73')]=isNaN(_0x587484['duration'])?null:_0x587484[_0x8a46('0x69')]*0x3e8;_0xb6c8e0['converted_sampleCount']=isNaN(_0x587484[_0x8a46('0x6b')])?null:_0x587484['sampleCount'];_0xb6c8e0[_0x8a46('0x74')]=isNaN(_0x587484[_0x8a46('0x6d')])?null:_0x587484[_0x8a46('0x6d')];_0xb6c8e0[_0x8a46('0x75')]=isNaN(_0x587484[_0x8a46('0x6f')])?null:_0x587484['bitRate'];_0xb6c8e0[_0x8a46('0x76')]=isNaN(_0x587484['sampleRate'])?null:_0x587484[_0x8a46('0x71')];});_0x5290a7['on'](_0x8a46('0x1d'),function(){fs['chmodSync'](_0x59c88a,parseInt(_0x8a46('0x66'),0x8));return db['Sound'][_0x8a46('0x59')](_0xb6c8e0)[_0x8a46('0x27')](function(_0x55690f){var _0x10da5f={'role':_0x5d6c48[_0x8a46('0x77')][_0x8a46('0x78')],'userProfileId':_0x5d6c48[_0x8a46('0x77')]['userProfileId']};if(!_0x10da5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10da5f[_0x8a46('0x78')]===_0x8a46('0x79')){var _0x4c4add=_0x55690f[_0x8a46('0x28')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x8a46('0x29'),'userProfileId':_0x10da5f['userProfileId']},'raw':!![]})['then'](function(_0x4a73f7){if(_0x4a73f7&&_0x4a73f7['autoAssociation']===0x0){return db[_0x8a46('0x2a')][_0x8a46('0x59')]({'name':_0x4c4add[_0x8a46('0x2d')],'resourceId':_0x4c4add['id'],'type':_0x4a73f7[_0x8a46('0x2d')],'sectionId':_0x4a73f7['id']},{})[_0x8a46('0x27')](function(){return _0x55690f;});}else{return _0x55690f;}})[_0x8a46('0x48')](function(_0x4cbcb6){logger[_0x8a46('0x2c')](_0x8a46('0x7a'),_0x4cbcb6);throw _0x4cbcb6;});}return _0x55690f;})[_0x8a46('0x27')](respondWithResult(_0x59aa7c,null))['catch'](handleError(_0x59aa7c,null));});_0x5290a7[_0x8a46('0x7b')]();}catch(_0x1511a6){_0x59aa7c[_0x8a46('0x1c')](0x1f4)[_0x8a46('0x2e')](_0x1511a6);}};exports[_0x8a46('0x7c')]=function(_0x5563e0,_0x5ac096,_0x43ab4b){return db[_0x8a46('0x31')][_0x8a46('0x4e')]({'where':{'id':_0x5563e0[_0x8a46('0x4a')]['id']}})[_0x8a46('0x27')](handleEntityNotFound(_0x5ac096,null))[_0x8a46('0x27')](saveUpdates(_[_0x8a46('0x3f')](_0x5563e0[_0x8a46('0x77')],[_0x8a46('0x2d'),_0x8a46('0x7d')]),null))[_0x8a46('0x27')](respondWithResult(_0x5ac096,null))[_0x8a46('0x48')](handleError(_0x5ac096,null));};exports[_0x8a46('0x7e')]=function(_0x2f5124,_0x142cbd,_0xbf3c36){return db['Sound'][_0x8a46('0x4e')]({'where':{'id':_0x2f5124[_0x8a46('0x4a')]['id']}})['then'](function(_0x22ff55){if(_0x22ff55){return _0x22ff55['destroy']();}})[_0x8a46('0x27')](function(_0x5e8d25){var _0x446176=path['join'](config[_0x8a46('0x53')],'server/files/sounds/original',util['format']('%s.%s',_0x5e8d25[_0x8a46('0x50')],_0x5e8d25['original_format']));var _0x1cb3a9=path[_0x8a46('0x52')](config[_0x8a46('0x53')],'server/files/sounds/converted',util['format'](_0x8a46('0x58'),_0x5e8d25[_0x8a46('0x50')],_0x5e8d25[_0x8a46('0x51')]));fs['unlinkSync'](_0x446176);fs[_0x8a46('0x7f')](_0x1cb3a9);return _0x5e8d25;})['then'](function(_0x9a8935){if(_0x9a8935){return _0x142cbd['status'](0xcc)['end']();}})[_0x8a46('0x27')](handleEntityNotFound(_0x142cbd,null))[_0x8a46('0x48')](handleError(_0x142cbd,null));}; \ No newline at end of file +var _0x557c=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','get','Sounds','UserProfileResource','name','index','Sound','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','download','save_name','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','converted_format','create','basename','file','extname','originalname','substring','server/files/sounds/original','filename','info','chmodSync','0777','transcode','wav','unlinkSync','send','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','description','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','fs-extra','squel','crypto'];(function(_0x33cfb4,_0x20e6e5){var _0x492910=function(_0x2c706d){while(--_0x2c706d){_0x33cfb4['push'](_0x33cfb4['shift']());}};_0x492910(++_0x20e6e5);}(_0x557c,0x70));var _0xc557=function(_0x1386a3,_0x13087c){_0x1386a3=_0x1386a3-0x0;var _0x3ba3c9=_0x557c[_0x1386a3];return _0x3ba3c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc557('0x0'));var zipdir=require(_0xc557('0x1'));var jsonpatch=require(_0xc557('0x2'));var rp=require(_0xc557('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc557('0x4'));var path=require(_0xc557('0x5'));var sox=require('sox');var csv=require(_0xc557('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc557('0x7'));var _=require('lodash');var squel=require(_0xc557('0x8'));var crypto=require(_0xc557('0x9'));var jsforce=require(_0xc557('0xa'));var deskjs=require(_0xc557('0xb'));var toCsv=require(_0xc557('0x6'));var querystring=require(_0xc557('0xc'));var Papa=require(_0xc557('0xd'));var Redis=require(_0xc557('0xe'));var authService=require(_0xc557('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc557('0x10'));var hardwareService=require(_0xc557('0x11'));var logger=require(_0xc557('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc557('0x13'));var licenseUtil=require(_0xc557('0x14'));var db=require(_0xc557('0x15'))['db'];function respondWithStatusCode(_0x4793e4,_0x2fcdcd){_0x2fcdcd=_0x2fcdcd||0xcc;return function(_0x24b18e){if(_0x24b18e){return _0x4793e4[_0xc557('0x16')](_0x2fcdcd);}return _0x4793e4[_0xc557('0x17')](_0x2fcdcd)[_0xc557('0x18')]();};}function respondWithResult(_0x50859e,_0x4ffdf5){_0x4ffdf5=_0x4ffdf5||0xc8;return function(_0x25ab8f){if(_0x25ab8f){return _0x50859e[_0xc557('0x17')](_0x4ffdf5)['json'](_0x25ab8f);}};}function respondWithFilteredResult(_0x5b4986,_0x416e9a){return function(_0xf271cc){if(_0xf271cc){var _0xa7c240=typeof _0x416e9a[_0xc557('0x19')]===_0xc557('0x1a')&&typeof _0x416e9a[_0xc557('0x1b')]==='undefined';var _0x49d383=_0xf271cc[_0xc557('0x1c')];var _0x577643=_0xa7c240?0x0:_0x416e9a[_0xc557('0x19')];var _0x526c59=_0xa7c240?_0xf271cc[_0xc557('0x1c')]:_0x416e9a[_0xc557('0x19')]+_0x416e9a[_0xc557('0x1b')];var _0x47dc6b;if(_0x526c59>=_0x49d383){_0x526c59=_0x49d383;_0x47dc6b=0xc8;}else{_0x47dc6b=0xce;}_0x5b4986[_0xc557('0x17')](_0x47dc6b);return _0x5b4986['set'](_0xc557('0x1d'),_0x577643+'-'+_0x526c59+'/'+_0x49d383)[_0xc557('0x1e')](_0xf271cc);}return null;};}function patchUpdates(_0x57f8d5){return function(_0x4e52ac){try{jsonpatch[_0xc557('0x1f')](_0x4e52ac,_0x57f8d5,!![]);}catch(_0x32db4b){return BPromise[_0xc557('0x20')](_0x32db4b);}return _0x4e52ac['save']();};}function saveUpdates(_0x35899d,_0x450be6){return function(_0x39e539){if(_0x39e539){return _0x39e539['update'](_0x35899d)[_0xc557('0x21')](function(_0x3643f8){return _0x3643f8;});}return null;};}function removeEntity(_0x14fb36,_0x59315){return function(_0x1ac595){if(_0x1ac595){return _0x1ac595[_0xc557('0x22')]()[_0xc557('0x21')](function(){var _0x4522ba=_0x1ac595[_0xc557('0x23')]({'plain':!![]});var _0x2559ff=_0xc557('0x24');return db[_0xc557('0x25')][_0xc557('0x22')]({'where':{'type':_0x2559ff,'resourceId':_0x4522ba['id']}})[_0xc557('0x21')](function(){return _0x1ac595;});})[_0xc557('0x21')](function(){_0x14fb36[_0xc557('0x17')](0xcc)[_0xc557('0x18')]();});}};}function handleEntityNotFound(_0xc85d20,_0x3dcb02){return function(_0x33cc86){if(!_0x33cc86){_0xc85d20[_0xc557('0x16')](0x194);}return _0x33cc86;};}function handleError(_0x2c8e15,_0x1be31c){_0x1be31c=_0x1be31c||0x1f4;return function(_0x164ff8){logger['error'](_0x164ff8['stack']);if(_0x164ff8[_0xc557('0x26')]){delete _0x164ff8['name'];}_0x2c8e15[_0xc557('0x17')](_0x1be31c)['send'](_0x164ff8);};}exports[_0xc557('0x27')]=function(_0x58f3bc,_0x1030a2){var _0xebda30={},_0x7c67ba={},_0x49912a={'count':0x0,'rows':[]};var _0xf0e7e2=_['map'](db[_0xc557('0x28')]['rawAttributes'],function(_0x150802){return{'name':_0x150802[_0xc557('0x29')],'type':_0x150802[_0xc557('0x2a')][_0xc557('0x2b')]};});_0x7c67ba[_0xc557('0x2c')]=_['map'](_0xf0e7e2,_0xc557('0x26'));_0x7c67ba[_0xc557('0x2d')]=_['keys'](_0x58f3bc['query']);_0x7c67ba[_0xc557('0x2e')]=_[_0xc557('0x2f')](_0x7c67ba[_0xc557('0x2c')],_0x7c67ba['query']);_0xebda30[_0xc557('0x30')]=_[_0xc557('0x2f')](_0x7c67ba['model'],qs['fields'](_0x58f3bc[_0xc557('0x2d')][_0xc557('0x31')]));_0xebda30[_0xc557('0x30')]=_0xebda30[_0xc557('0x30')][_0xc557('0x32')]?_0xebda30['attributes']:_0x7c67ba[_0xc557('0x2c')];if(!_0x58f3bc[_0xc557('0x2d')][_0xc557('0x33')](_0xc557('0x34'))){_0xebda30[_0xc557('0x1b')]=qs[_0xc557('0x1b')](_0x58f3bc[_0xc557('0x2d')][_0xc557('0x1b')]);_0xebda30[_0xc557('0x19')]=qs[_0xc557('0x19')](_0x58f3bc[_0xc557('0x2d')][_0xc557('0x19')]);}_0xebda30[_0xc557('0x35')]=qs[_0xc557('0x36')](_0x58f3bc[_0xc557('0x2d')][_0xc557('0x36')]);_0xebda30[_0xc557('0x37')]=qs['filters'](_['pick'](_0x58f3bc[_0xc557('0x2d')],_0x7c67ba[_0xc557('0x2e')]),_0xf0e7e2);if(_0x58f3bc['query'][_0xc557('0x38')]){_0xebda30['where']=_['merge'](_0xebda30[_0xc557('0x37')],{'$or':_[_0xc557('0x39')](_0xf0e7e2,function(_0x353a53){if(_0x353a53[_0xc557('0x2a')]!==_0xc557('0x3a')){var _0x436595={};_0x436595[_0x353a53[_0xc557('0x26')]]={'$like':'%'+_0x58f3bc[_0xc557('0x2d')][_0xc557('0x38')]+'%'};return _0x436595;}})});}_0xebda30=_[_0xc557('0x3b')]({},_0xebda30,_0x58f3bc[_0xc557('0x3c')]);var _0x3fdaca={'where':_0xebda30[_0xc557('0x37')]};return db['Sound']['count'](_0x3fdaca)['then'](function(_0x28c798){_0x49912a['count']=_0x28c798;if(_0x58f3bc[_0xc557('0x2d')][_0xc557('0x3d')]){_0xebda30[_0xc557('0x3e')]=[{'all':!![]}];}return db[_0xc557('0x28')][_0xc557('0x3f')](_0xebda30);})[_0xc557('0x21')](function(_0x320580){_0x49912a[_0xc557('0x40')]=_0x320580;return _0x49912a;})[_0xc557('0x21')](respondWithFilteredResult(_0x1030a2,_0xebda30))[_0xc557('0x41')](handleError(_0x1030a2,null));};exports[_0xc557('0x42')]=function(_0x4aad05,_0x35a56e){var _0x1ee0cc={'raw':!![],'where':{'id':_0x4aad05[_0xc557('0x43')]['id']}},_0x910dc6={};_0x910dc6['model']=_[_0xc557('0x44')](db['Sound'][_0xc557('0x45')]);_0x910dc6['query']=_[_0xc557('0x44')](_0x4aad05['query']);_0x910dc6['filters']=_[_0xc557('0x2f')](_0x910dc6['model'],_0x910dc6[_0xc557('0x2d')]);_0x1ee0cc[_0xc557('0x30')]=_['intersection'](_0x910dc6[_0xc557('0x2c')],qs[_0xc557('0x31')](_0x4aad05[_0xc557('0x2d')][_0xc557('0x31')]));_0x1ee0cc[_0xc557('0x30')]=_0x1ee0cc['attributes'][_0xc557('0x32')]?_0x1ee0cc[_0xc557('0x30')]:_0x910dc6[_0xc557('0x2c')];if(_0x4aad05[_0xc557('0x2d')][_0xc557('0x3d')]){_0x1ee0cc[_0xc557('0x3e')]=[{'all':!![]}];}_0x1ee0cc=_['merge']({},_0x1ee0cc,_0x4aad05['options']);return db[_0xc557('0x28')][_0xc557('0x46')](_0x1ee0cc)['then'](handleEntityNotFound(_0x35a56e,null))[_0xc557('0x21')](respondWithResult(_0x35a56e,null))[_0xc557('0x41')](handleError(_0x35a56e,null));};exports[_0xc557('0x47')]=function(_0x43669d,_0x1ab464,_0x51284e){return db['Sound']['find']({'where':{'id':_0x43669d['params']['id']},'attributes':[_0xc557('0x26'),_0xc557('0x48'),'converted_format'],'raw':!![]})[_0xc557('0x21')](handleEntityNotFound(_0x1ab464,null))['then'](function(_0x1ecb05){if(_0x1ecb05){if(!fs[_0xc557('0x49')](path[_0xc557('0x4a')](config[_0xc557('0x4b')],_0xc557('0x4c'),_0x1ecb05[_0xc557('0x48')]+'.'+_0x1ecb05['converted_format']))){throw new db[(_0xc557('0x4d'))]['ValidationError'](_0xc557('0x4e'));}return _0x1ab464['download'](path[_0xc557('0x4a')](config['root'],_0xc557('0x4c'),util[_0xc557('0x4f')]('%s.%s',_0x1ecb05[_0xc557('0x48')],_0x1ecb05[_0xc557('0x50')])),util['format']('%s.%s',_0x1ecb05[_0xc557('0x26')],_0x1ecb05[_0xc557('0x50')]));}return null;})[_0xc557('0x41')](handleError(_0x1ab464,null));};exports[_0xc557('0x51')]=function(_0xc3b663,_0x48600c,_0xbd6051){var _0x4cbd76={'name':path[_0xc557('0x52')](_0xc3b663[_0xc557('0x53')]['originalname'],path[_0xc557('0x54')](_0xc3b663['file'][_0xc557('0x55')])),'save_name':path['basename'](_0xc3b663['file']['filename'],path[_0xc557('0x54')](_0xc3b663[_0xc557('0x53')]['filename'])),'original_format':path[_0xc557('0x54')](_0xc3b663[_0xc557('0x53')][_0xc557('0x55')])[_0xc557('0x56')](0x1),'converted_format':'wav'};var _0x22a118=path[_0xc557('0x4a')](config['root'],_0xc557('0x57'),_0xc3b663['file'][_0xc557('0x58')]);var _0xf81c34=path[_0xc557('0x4a')](config[_0xc557('0x4b')],'server/files/sounds/converted',util['format']('%s.%s',path[_0xc557('0x52')](_0xc3b663[_0xc557('0x53')][_0xc557('0x58')],path[_0xc557('0x54')](_0xc3b663['file']['filename'])),_0x4cbd76[_0xc557('0x50')]));logger[_0xc557('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x22a118);logger[_0xc557('0x59')]('Sound\x20upload\x20destination:\x20%s',_0xf81c34);try{fs[_0xc557('0x5a')](_0x22a118,parseInt(_0xc557('0x5b'),0x8));var _0x558102=sox[_0xc557('0x5c')](_0x22a118,_0xf81c34,{'sampleRate':0x1f40,'format':_0xc557('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x558102['on']('error',function(_0x3d0551){fs[_0xc557('0x5e')](_0x22a118);_0x48600c[_0xc557('0x17')](0x1f4)[_0xc557('0x5f')](_0x3d0551);});_0x558102['on']('src',function(_0x1d755c){_0x4cbd76[_0xc557('0x60')]=isNaN(_0x1d755c['duration'])?null:_0x1d755c[_0xc557('0x61')]*0x3e8;_0x4cbd76[_0xc557('0x62')]=isNaN(_0x1d755c[_0xc557('0x63')])?null:_0x1d755c[_0xc557('0x63')];_0x4cbd76[_0xc557('0x64')]=isNaN(_0x1d755c[_0xc557('0x65')])?null:_0x1d755c[_0xc557('0x65')];_0x4cbd76[_0xc557('0x66')]=isNaN(_0x1d755c[_0xc557('0x67')])?null:_0x1d755c['bitRate'];_0x4cbd76[_0xc557('0x68')]=isNaN(_0x1d755c[_0xc557('0x69')])?null:_0x1d755c[_0xc557('0x69')];});_0x558102['on'](_0xc557('0x6a'),function(_0x2cb170){_0x4cbd76[_0xc557('0x6b')]=isNaN(_0x2cb170[_0xc557('0x61')])?null:_0x2cb170[_0xc557('0x61')]*0x3e8;_0x4cbd76['converted_sampleCount']=isNaN(_0x2cb170[_0xc557('0x63')])?null:_0x2cb170['sampleCount'];_0x4cbd76['converted_channelCount']=isNaN(_0x2cb170[_0xc557('0x65')])?null:_0x2cb170['channelCount'];_0x4cbd76[_0xc557('0x6c')]=isNaN(_0x2cb170[_0xc557('0x67')])?null:_0x2cb170[_0xc557('0x67')];_0x4cbd76['converted_sampleRate']=isNaN(_0x2cb170[_0xc557('0x69')])?null:_0x2cb170[_0xc557('0x69')];});_0x558102['on'](_0xc557('0x18'),function(){fs[_0xc557('0x5a')](_0xf81c34,parseInt(_0xc557('0x5b'),0x8));return db[_0xc557('0x28')][_0xc557('0x51')](_0x4cbd76)['then'](function(_0x5003b8){var _0x5a6b76={'role':_0xc3b663['body'][_0xc557('0x6d')],'userProfileId':_0xc3b663[_0xc557('0x6e')]['userProfileId']};if(!_0x5a6b76)throw new Error(_0xc557('0x6f'));if(_0x5a6b76[_0xc557('0x6d')]===_0xc557('0x70')){var _0x369323=_0x5003b8[_0xc557('0x23')]({'plain':!![]});return db['UserProfileSection'][_0xc557('0x46')]({'where':{'name':'Sounds','userProfileId':_0x5a6b76[_0xc557('0x71')]},'raw':!![]})[_0xc557('0x21')](function(_0x2e0759){if(_0x2e0759&&_0x2e0759[_0xc557('0x72')]===0x0){return db['UserProfileResource']['create']({'name':_0x369323[_0xc557('0x26')],'resourceId':_0x369323['id'],'type':_0x2e0759[_0xc557('0x26')],'sectionId':_0x2e0759['id']},{})[_0xc557('0x21')](function(){return _0x5003b8;});}else{return _0x5003b8;}})[_0xc557('0x41')](function(_0x3aaa61){logger['error'](_0xc557('0x73'),_0x3aaa61);throw _0x3aaa61;});}return _0x5003b8;})[_0xc557('0x21')](respondWithResult(_0x48600c,null))[_0xc557('0x41')](handleError(_0x48600c,null));});_0x558102[_0xc557('0x74')]();}catch(_0x55c000){_0x48600c['status'](0x1f4)[_0xc557('0x5f')](_0x55c000);}};exports[_0xc557('0x75')]=function(_0x5c9eee,_0x4f9873,_0x170a01){return db['Sound'][_0xc557('0x46')]({'where':{'id':_0x5c9eee['params']['id']}})[_0xc557('0x21')](handleEntityNotFound(_0x4f9873,null))[_0xc557('0x21')](saveUpdates(_[_0xc557('0x76')](_0x5c9eee[_0xc557('0x6e')],[_0xc557('0x26'),_0xc557('0x77')]),null))[_0xc557('0x21')](respondWithResult(_0x4f9873,null))[_0xc557('0x41')](handleError(_0x4f9873,null));};exports[_0xc557('0x78')]=function(_0x3abc20,_0x5057ff,_0x4b3ab7){return db[_0xc557('0x28')]['find']({'where':{'id':_0x3abc20['params']['id']}})['then'](function(_0x4f31f1){if(_0x4f31f1){return _0x4f31f1[_0xc557('0x22')]();}})[_0xc557('0x21')](function(_0x465467){var _0x39b503=path[_0xc557('0x4a')](config[_0xc557('0x4b')],_0xc557('0x57'),util[_0xc557('0x4f')]('%s.%s',_0x465467[_0xc557('0x48')],_0x465467[_0xc557('0x79')]));var _0x534153=path[_0xc557('0x4a')](config[_0xc557('0x4b')],_0xc557('0x4c'),util[_0xc557('0x4f')]('%s.%s',_0x465467[_0xc557('0x48')],_0x465467['converted_format']));fs['unlinkSync'](_0x39b503);fs['unlinkSync'](_0x534153);return _0x465467;})[_0xc557('0x21')](function(_0x36a608){if(_0x36a608){return _0x5057ff[_0xc557('0x17')](0xcc)[_0xc557('0x18')]();}})['then'](handleEntityNotFound(_0x5057ff,null))[_0xc557('0x41')](handleError(_0x5057ff,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e4d4089..f3cadf1 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 _0xf9b6=['moment','bluebird','rimraf','./sound.attributes','define','Sound','tools_sounds','lodash','util','../../config/logger','api'];(function(_0x43762c,_0x48ff0f){var _0x4a85e0=function(_0x452e89){while(--_0x452e89){_0x43762c['push'](_0x43762c['shift']());}};_0x4a85e0(++_0x48ff0f);}(_0xf9b6,0x1bf));var _0x6f9b=function(_0x32b4aa,_0x12eba6){_0x32b4aa=_0x32b4aa-0x0;var _0x473160=_0xf9b6[_0x32b4aa];return _0x473160;};'use strict';var _=require(_0x6f9b('0x0'));var util=require(_0x6f9b('0x1'));var logger=require(_0x6f9b('0x2'))(_0x6f9b('0x3'));var moment=require(_0x6f9b('0x4'));var BPromise=require(_0x6f9b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f9b('0x6'));var config=require('../../config/environment');var attributes=require(_0x6f9b('0x7'));module['exports']=function(_0xf1b5a2,_0x579733){return _0xf1b5a2[_0x6f9b('0x8')](_0x6f9b('0x9'),attributes,{'tableName':_0x6f9b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7be=['Sound','bluebird','path','./sound.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7be,0x1f3));var _0xef7b=function(_0x4becbc,_0x175cf4){_0x4becbc=_0x4becbc-0x0;var _0x2f160d=_0xf7be[_0x4becbc];return _0x2f160d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xef7b('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef7b('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef7b('0x2'));module[_0xef7b('0x3')]=function(_0x31d50f,_0x3e9560){return _0x31d50f[_0xef7b('0x4')](_0xef7b('0x5'),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 9b733c8..ecb73ea 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 _0xa6db=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','ShowSound','Sound','options','raw','attributes','model','include','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5987ae,_0x202985){var _0x4a444d=function(_0x361ca1){while(--_0x361ca1){_0x5987ae['push'](_0x5987ae['shift']());}};_0x4a444d(++_0x202985);}(_0xa6db,0x84));var _0xba6d=function(_0x47ec53,_0x5106fd){_0x47ec53=_0x47ec53-0x0;var _0x54eb20=_0xa6db[_0x47ec53];return _0x54eb20;};'use strict';var _=require(_0xba6d('0x0'));var util=require(_0xba6d('0x1'));var moment=require(_0xba6d('0x2'));var BPromise=require(_0xba6d('0x3'));var rs=require(_0xba6d('0x4'));var fs=require('fs');var Redis=require(_0xba6d('0x5'));var db=require(_0xba6d('0x6'))['db'];var utils=require(_0xba6d('0x7'));var logger=require(_0xba6d('0x8'))(_0xba6d('0x9'));var config=require(_0xba6d('0xa'));var jayson=require(_0xba6d('0xb'));var client=jayson[_0xba6d('0xc')][_0xba6d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x423d86,_0x157ef7,_0x44dbf4){return new BPromise(function(_0x3e940b,_0x3ba5c5){return client[_0xba6d('0xe')](_0x423d86,_0x44dbf4)[_0xba6d('0xf')](function(_0x19a5ee){logger['info'](_0xba6d('0x10'),_0x157ef7,'request\x20sent');logger[_0xba6d('0x11')](_0xba6d('0x12'),_0x157ef7,_0xba6d('0x13'),JSON[_0xba6d('0x14')](_0x19a5ee));if(_0x19a5ee[_0xba6d('0x15')]){if(_0x19a5ee[_0xba6d('0x15')][_0xba6d('0x16')]===0x1f4){logger[_0xba6d('0x15')](_0xba6d('0x10'),_0x157ef7,_0x19a5ee[_0xba6d('0x15')]['message']);return _0x3ba5c5(_0x19a5ee[_0xba6d('0x15')][_0xba6d('0x17')]);}logger[_0xba6d('0x15')](_0xba6d('0x10'),_0x157ef7,_0x19a5ee[_0xba6d('0x15')][_0xba6d('0x17')]);return _0x3e940b(_0x19a5ee[_0xba6d('0x15')][_0xba6d('0x17')]);}else{logger[_0xba6d('0x18')](_0xba6d('0x10'),_0x157ef7,'request\x20sent');_0x3e940b(_0x19a5ee[_0xba6d('0x19')][_0xba6d('0x17')]);}})['catch'](function(_0x1b570c){logger[_0xba6d('0x15')](_0xba6d('0x10'),_0x157ef7,_0x1b570c);_0x3ba5c5(_0x1b570c);});});}exports[_0xba6d('0x1a')]=function(_0x2ecf57){var _0x22fa45=this;return new Promise(function(_0x53c6d1,_0x56a343){return db[_0xba6d('0x1b')]['find']({'raw':_0x2ecf57['options']?_0x2ecf57[_0xba6d('0x1c')][_0xba6d('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ecf57[_0xba6d('0x1c')]?_0x2ecf57[_0xba6d('0x1c')]['where']||null:null,'attributes':_0x2ecf57[_0xba6d('0x1c')]?_0x2ecf57[_0xba6d('0x1c')][_0xba6d('0x1e')]||null:null,'include':_0x2ecf57[_0xba6d('0x1c')]?_0x2ecf57['options']['include']?_['map'](_0x2ecf57[_0xba6d('0x1c')]['include'],function(_0x50723d){return{'model':db[_0x50723d[_0xba6d('0x1f')]],'as':_0x50723d['as'],'attributes':_0x50723d[_0xba6d('0x1e')],'include':_0x50723d[_0xba6d('0x20')]?_[_0xba6d('0x21')](_0x50723d[_0xba6d('0x20')],function(_0x1c1f3b){return{'model':db[_0x1c1f3b[_0xba6d('0x1f')]],'as':_0x1c1f3b['as'],'attributes':_0x1c1f3b[_0xba6d('0x1e')],'include':_0x1c1f3b[_0xba6d('0x20')]?_[_0xba6d('0x21')](_0x1c1f3b['include'],function(_0xebedc9){return{'model':db[_0xebedc9[_0xba6d('0x1f')]],'as':_0xebedc9['as'],'attributes':_0xebedc9[_0xba6d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xba6d('0xf')](function(_0x267109){logger[_0xba6d('0x18')](_0xba6d('0x1a'),_0x2ecf57);logger['debug'](_0xba6d('0x1a'),_0x2ecf57,JSON[_0xba6d('0x14')](_0x267109));_0x53c6d1(_0x267109);})[_0xba6d('0x22')](function(_0xdf8857){logger['error'](_0xba6d('0x1a'),_0xdf8857[_0xba6d('0x17')],_0x2ecf57);_0x56a343(_0x22fa45[_0xba6d('0x15')](0x1f4,_0xdf8857[_0xba6d('0x17')]));});});}; \ No newline at end of file +var _0xfeb6=['request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','error','code','message','ShowSound','Sound','find','options','where','attributes','include','map','model','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfeb6,0xaa));var _0x6feb=function(_0x1a68fc,_0x5e4468){_0x1a68fc=_0x1a68fc-0x0;var _0x19afc2=_0xfeb6[_0x1a68fc];return _0x19afc2;};'use strict';var _=require(_0x6feb('0x0'));var util=require(_0x6feb('0x1'));var moment=require(_0x6feb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6feb('0x3'));var fs=require('fs');var Redis=require(_0x6feb('0x4'));var db=require(_0x6feb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6feb('0x6'));var jayson=require(_0x6feb('0x7'));var client=jayson[_0x6feb('0x8')][_0x6feb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1114f0,_0x451c4c,_0x356dcb){return new BPromise(function(_0x1f0642,_0x12a5da){return client[_0x6feb('0xa')](_0x1114f0,_0x356dcb)[_0x6feb('0xb')](function(_0x4d9889){logger[_0x6feb('0xc')](_0x6feb('0xd'),_0x451c4c,'request\x20sent');logger[_0x6feb('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x451c4c,_0x6feb('0xf'),JSON['stringify'](_0x4d9889));if(_0x4d9889[_0x6feb('0x10')]){if(_0x4d9889[_0x6feb('0x10')][_0x6feb('0x11')]===0x1f4){logger[_0x6feb('0x10')](_0x6feb('0xd'),_0x451c4c,_0x4d9889['error'][_0x6feb('0x12')]);return _0x12a5da(_0x4d9889['error'][_0x6feb('0x12')]);}logger[_0x6feb('0x10')]('Sound,\x20%s,\x20%s',_0x451c4c,_0x4d9889[_0x6feb('0x10')][_0x6feb('0x12')]);return _0x1f0642(_0x4d9889[_0x6feb('0x10')][_0x6feb('0x12')]);}else{logger[_0x6feb('0xc')](_0x6feb('0xd'),_0x451c4c,_0x6feb('0xf'));_0x1f0642(_0x4d9889['result'][_0x6feb('0x12')]);}})['catch'](function(_0x207465){logger[_0x6feb('0x10')](_0x6feb('0xd'),_0x451c4c,_0x207465);_0x12a5da(_0x207465);});});}exports[_0x6feb('0x13')]=function(_0x44da17){var _0x48408b=this;return new Promise(function(_0x421d19,_0x56e92f){return db[_0x6feb('0x14')][_0x6feb('0x15')]({'raw':_0x44da17[_0x6feb('0x16')]?_0x44da17['options']['raw']===undefined?!![]:![]:!![],'where':_0x44da17[_0x6feb('0x16')]?_0x44da17[_0x6feb('0x16')][_0x6feb('0x17')]||null:null,'attributes':_0x44da17['options']?_0x44da17[_0x6feb('0x16')][_0x6feb('0x18')]||null:null,'include':_0x44da17[_0x6feb('0x16')]?_0x44da17[_0x6feb('0x16')][_0x6feb('0x19')]?_[_0x6feb('0x1a')](_0x44da17[_0x6feb('0x16')][_0x6feb('0x19')],function(_0x1f75a2){return{'model':db[_0x1f75a2[_0x6feb('0x1b')]],'as':_0x1f75a2['as'],'attributes':_0x1f75a2[_0x6feb('0x18')],'include':_0x1f75a2[_0x6feb('0x19')]?_['map'](_0x1f75a2['include'],function(_0x2f9d93){return{'model':db[_0x2f9d93[_0x6feb('0x1b')]],'as':_0x2f9d93['as'],'attributes':_0x2f9d93[_0x6feb('0x18')],'include':_0x2f9d93[_0x6feb('0x19')]?_['map'](_0x2f9d93[_0x6feb('0x19')],function(_0x205667){return{'model':db[_0x205667['model']],'as':_0x205667['as'],'attributes':_0x205667[_0x6feb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6feb('0xb')](function(_0x264e31){logger[_0x6feb('0xc')]('ShowSound',_0x44da17);logger['debug'](_0x6feb('0x13'),_0x44da17,JSON[_0x6feb('0x1c')](_0x264e31));_0x421d19(_0x264e31);})[_0x6feb('0x1d')](function(_0x5d2a99){logger[_0x6feb('0x10')](_0x6feb('0x13'),_0x5d2a99[_0x6feb('0x12')],_0x44da17);_0x56e92f(_0x48408b[_0x6feb('0x10')](0x1f4,_0x5d2a99[_0x6feb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 416cf0b..9ede6fe 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x336d88,_0x300c76){var _0x46eaec=function(_0x1ee440){while(--_0x1ee440){_0x336d88['push'](_0x336d88['shift']());}};_0x46eaec(++_0x300c76);}(_0xac4a,0x13f));var _0xaac4=function(_0x2ac65c,_0x351398){_0x2ac65c=_0x2ac65c-0x0;var _0x498f39=_0xac4a[_0x2ac65c];return _0x498f39;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x4fd14f,_0x4f40e5){var _0x377eb0=function(_0x127e9e){while(--_0x127e9e){_0x4fd14f['push'](_0x4fd14f['shift']());}};_0x377eb0(++_0x4f40e5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a0bd0f9..9b2bf0b 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 _0x44f7=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x41777a,_0x3e9d1d){var _0x147d8b=function(_0x29b7dd){while(--_0x29b7dd){_0x41777a['push'](_0x41777a['shift']());}};_0x147d8b(++_0x3e9d1d);}(_0x44f7,0x11e));var _0x744f=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x44f7[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0x744f('0x0'));module[_0x744f('0x1')]={'uniqueid':{'type':Sequelize[_0x744f('0x2')]},'body':{'type':Sequelize[_0x744f('0x3')](_0x744f('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x744f('0x5')]('in',_0x744f('0x6')),'defaultValue':_0x744f('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x744f('0x2')]},'providerResponse':{'type':Sequelize[_0x744f('0x3')]}}; \ No newline at end of file +var _0x0ff1=['ENUM','STRING','medium'];(function(_0x58b2d5,_0x1817a2){var _0x5d3b6f=function(_0x52781b){while(--_0x52781b){_0x58b2d5['push'](_0x58b2d5['shift']());}};_0x5d3b6f(++_0x1817a2);}(_0x0ff1,0xb2));var _0x10ff=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x0ff1[_0x31bab3];return _0x4fd382;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x10ff('0x0')]},'body':{'type':Sequelize['TEXT'](_0x10ff('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x10ff('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1957d64..3253c91 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 _0x8481=['key','query','keys','intersection','model','attributes','nolimit','order','where','filters','filter','VIRTUAL','options','includeAll','SquareMessage','findAll','rows','catch','show','rawAttributes','fields','length','include','merge','create','body','update','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','error','stack','name','send','map','fieldName','type'];(function(_0xbb9c6,_0x19957e){var _0x2ef027=function(_0x42b196){while(--_0x42b196){_0xbb9c6['push'](_0xbb9c6['shift']());}};_0x2ef027(++_0x19957e);}(_0x8481,0x1c7));var _0x1848=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x8481[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require(_0x1848('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1848('0x1'));var jsonpatch=require(_0x1848('0x2'));var rp=require(_0x1848('0x3'));var moment=require(_0x1848('0x4'));var BPromise=require(_0x1848('0x5'));var Mustache=require(_0x1848('0x6'));var util=require(_0x1848('0x7'));var path=require(_0x1848('0x8'));var sox=require('sox');var csv=require(_0x1848('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1848('0xa'));var jsforce=require(_0x1848('0xb'));var deskjs=require(_0x1848('0xc'));var toCsv=require(_0x1848('0x9'));var querystring=require(_0x1848('0xd'));var Papa=require('papaparse');var Redis=require(_0x1848('0xe'));var authService=require(_0x1848('0xf'));var qs=require(_0x1848('0x10'));var as=require(_0x1848('0x11'));var hardwareService=require(_0x1848('0x12'));var logger=require(_0x1848('0x13'))(_0x1848('0x14'));var utils=require(_0x1848('0x15'));var config=require(_0x1848('0x16'));var licenseUtil=require(_0x1848('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20cdc6,_0x45222b){_0x45222b=_0x45222b||0xcc;return function(_0x4f1f7b){if(_0x4f1f7b){return _0x20cdc6['sendStatus'](_0x45222b);}return _0x20cdc6[_0x1848('0x18')](_0x45222b)[_0x1848('0x19')]();};}function respondWithResult(_0x4eb5dd,_0x3b2770){_0x3b2770=_0x3b2770||0xc8;return function(_0x325246){if(_0x325246){return _0x4eb5dd[_0x1848('0x18')](_0x3b2770)[_0x1848('0x1a')](_0x325246);}};}function respondWithFilteredResult(_0x514ef9,_0x43a5bd){return function(_0x1d717a){if(_0x1d717a){var _0x1ba98c=typeof _0x43a5bd['offset']===_0x1848('0x1b')&&typeof _0x43a5bd[_0x1848('0x1c')]===_0x1848('0x1b');var _0x50b3d7=_0x1d717a[_0x1848('0x1d')];var _0x25a2ee=_0x1ba98c?0x0:_0x43a5bd[_0x1848('0x1e')];var _0x48efb6=_0x1ba98c?_0x1d717a[_0x1848('0x1d')]:_0x43a5bd['offset']+_0x43a5bd[_0x1848('0x1c')];var _0x49d4ba;if(_0x48efb6>=_0x50b3d7){_0x48efb6=_0x50b3d7;_0x49d4ba=0xc8;}else{_0x49d4ba=0xce;}_0x514ef9[_0x1848('0x18')](_0x49d4ba);return _0x514ef9['set'](_0x1848('0x1f'),_0x25a2ee+'-'+_0x48efb6+'/'+_0x50b3d7)['json'](_0x1d717a);}return null;};}function patchUpdates(_0x25c2a3){return function(_0x50e85c){try{jsonpatch[_0x1848('0x20')](_0x50e85c,_0x25c2a3,!![]);}catch(_0x9a0605){return BPromise[_0x1848('0x21')](_0x9a0605);}return _0x50e85c['save']();};}function saveUpdates(_0x1d87f8,_0x1941db){return function(_0x22f8a3){if(_0x22f8a3){return _0x22f8a3['update'](_0x1d87f8)['then'](function(_0xebffdb){return _0xebffdb;});}return null;};}function removeEntity(_0x55e139,_0x1e7e08){return function(_0x26b4b6){if(_0x26b4b6){return _0x26b4b6['destroy']()[_0x1848('0x22')](function(){_0x55e139[_0x1848('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ad7e,_0x44aa86){return function(_0x2dcb49){if(!_0x2dcb49){_0x15ad7e['sendStatus'](0x194);}return _0x2dcb49;};}function handleError(_0x4f3d28,_0x22cac2){_0x22cac2=_0x22cac2||0x1f4;return function(_0x41c797){logger[_0x1848('0x23')](_0x41c797[_0x1848('0x24')]);if(_0x41c797[_0x1848('0x25')]){delete _0x41c797[_0x1848('0x25')];}_0x4f3d28['status'](_0x22cac2)[_0x1848('0x26')](_0x41c797);};}exports['index']=function(_0x440e3b,_0x40b786){var _0x2f171a={},_0x429305={},_0x100d98={'count':0x0,'rows':[]};var _0x490686=_[_0x1848('0x27')](db['SquareMessage']['rawAttributes'],function(_0xcce2e6){return{'name':_0xcce2e6[_0x1848('0x28')],'type':_0xcce2e6[_0x1848('0x29')][_0x1848('0x2a')]};});_0x429305['model']=_[_0x1848('0x27')](_0x490686,_0x1848('0x25'));_0x429305[_0x1848('0x2b')]=_[_0x1848('0x2c')](_0x440e3b['query']);_0x429305['filters']=_[_0x1848('0x2d')](_0x429305[_0x1848('0x2e')],_0x429305[_0x1848('0x2b')]);_0x2f171a[_0x1848('0x2f')]=_[_0x1848('0x2d')](_0x429305[_0x1848('0x2e')],qs['fields'](_0x440e3b['query']['fields']));_0x2f171a[_0x1848('0x2f')]=_0x2f171a[_0x1848('0x2f')]['length']?_0x2f171a[_0x1848('0x2f')]:_0x429305[_0x1848('0x2e')];if(!_0x440e3b[_0x1848('0x2b')]['hasOwnProperty'](_0x1848('0x30'))){_0x2f171a[_0x1848('0x1c')]=qs[_0x1848('0x1c')](_0x440e3b[_0x1848('0x2b')][_0x1848('0x1c')]);_0x2f171a[_0x1848('0x1e')]=qs[_0x1848('0x1e')](_0x440e3b['query'][_0x1848('0x1e')]);}_0x2f171a[_0x1848('0x31')]=qs['sort'](_0x440e3b[_0x1848('0x2b')]['sort']);_0x2f171a[_0x1848('0x32')]=qs[_0x1848('0x33')](_['pick'](_0x440e3b[_0x1848('0x2b')],_0x429305[_0x1848('0x33')]),_0x490686);if(_0x440e3b['query'][_0x1848('0x34')]){_0x2f171a[_0x1848('0x32')]=_['merge'](_0x2f171a[_0x1848('0x32')],{'$or':_[_0x1848('0x27')](_0x490686,function(_0x5d0bf4){if(_0x5d0bf4['type']!==_0x1848('0x35')){var _0x37d6af={};_0x37d6af[_0x5d0bf4[_0x1848('0x25')]]={'$like':'%'+_0x440e3b[_0x1848('0x2b')][_0x1848('0x34')]+'%'};return _0x37d6af;}})});}_0x2f171a=_['merge']({},_0x2f171a,_0x440e3b[_0x1848('0x36')]);var _0x1781cb={'where':_0x2f171a['where']};return db['SquareMessage']['count'](_0x1781cb)[_0x1848('0x22')](function(_0x261926){_0x100d98[_0x1848('0x1d')]=_0x261926;if(_0x440e3b['query'][_0x1848('0x37')]){_0x2f171a['include']=[{'all':!![]}];}return db[_0x1848('0x38')][_0x1848('0x39')](_0x2f171a);})[_0x1848('0x22')](function(_0x45458a){_0x100d98[_0x1848('0x3a')]=_0x45458a;return _0x100d98;})[_0x1848('0x22')](respondWithFilteredResult(_0x40b786,_0x2f171a))[_0x1848('0x3b')](handleError(_0x40b786,null));};exports[_0x1848('0x3c')]=function(_0x3c072a,_0xa1e3ee){var _0x2ea364={'raw':!![],'where':{'id':_0x3c072a['params']['id']}},_0x3b97f1={};_0x3b97f1[_0x1848('0x2e')]=_['keys'](db['SquareMessage'][_0x1848('0x3d')]);_0x3b97f1[_0x1848('0x2b')]=_[_0x1848('0x2c')](_0x3c072a[_0x1848('0x2b')]);_0x3b97f1[_0x1848('0x33')]=_[_0x1848('0x2d')](_0x3b97f1[_0x1848('0x2e')],_0x3b97f1[_0x1848('0x2b')]);_0x2ea364['attributes']=_[_0x1848('0x2d')](_0x3b97f1['model'],qs[_0x1848('0x3e')](_0x3c072a[_0x1848('0x2b')]['fields']));_0x2ea364[_0x1848('0x2f')]=_0x2ea364[_0x1848('0x2f')][_0x1848('0x3f')]?_0x2ea364[_0x1848('0x2f')]:_0x3b97f1['model'];if(_0x3c072a[_0x1848('0x2b')][_0x1848('0x37')]){_0x2ea364[_0x1848('0x40')]=[{'all':!![]}];}_0x2ea364=_[_0x1848('0x41')]({},_0x2ea364,_0x3c072a['options']);return db[_0x1848('0x38')]['find'](_0x2ea364)['then'](handleEntityNotFound(_0xa1e3ee,null))['then'](respondWithResult(_0xa1e3ee,null))['catch'](handleError(_0xa1e3ee,null));};exports[_0x1848('0x42')]=function(_0x434d1a,_0x4a329c){return db[_0x1848('0x38')]['create'](_0x434d1a[_0x1848('0x43')],{})[_0x1848('0x22')](respondWithResult(_0x4a329c,0xc9))[_0x1848('0x3b')](handleError(_0x4a329c,null));};exports[_0x1848('0x44')]=function(_0x221e3b,_0x366acc){if(_0x221e3b[_0x1848('0x43')]['id']){delete _0x221e3b[_0x1848('0x43')]['id'];}return db[_0x1848('0x38')][_0x1848('0x45')]({'where':{'id':_0x221e3b[_0x1848('0x46')]['id']}})[_0x1848('0x22')](handleEntityNotFound(_0x366acc,null))[_0x1848('0x22')](saveUpdates(_0x221e3b[_0x1848('0x43')],null))[_0x1848('0x22')](respondWithResult(_0x366acc,null))['catch'](handleError(_0x366acc,null));};exports['destroy']=function(_0x5e4a61,_0x4361ab){return db['SquareMessage']['find']({'where':{'id':_0x5e4a61[_0x1848('0x46')]['id']}})['then'](handleEntityNotFound(_0x4361ab,null))[_0x1848('0x22')](removeEntity(_0x4361ab,null))[_0x1848('0x3b')](handleError(_0x4361ab,null));}; \ No newline at end of file +var _0x8747=['hasOwnProperty','nolimit','order','sort','filter','where','merge','map','options','SquareMessage','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x8747,0xab));var _0x7874=function(_0x220610,_0x3b80b4){_0x220610=_0x220610-0x0;var _0x42f444=_0x8747[_0x220610];return _0x42f444;};'use strict';var emlformat=require(_0x7874('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7874('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7874('0x2'));var moment=require(_0x7874('0x3'));var BPromise=require(_0x7874('0x4'));var Mustache=require(_0x7874('0x5'));var util=require(_0x7874('0x6'));var path=require(_0x7874('0x7'));var sox=require(_0x7874('0x8'));var csv=require('to-csv');var ejs=require(_0x7874('0x9'));var fs=require('fs');var fs_extra=require(_0x7874('0xa'));var _=require(_0x7874('0xb'));var squel=require(_0x7874('0xc'));var crypto=require(_0x7874('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7874('0xe'));var toCsv=require(_0x7874('0xf'));var querystring=require(_0x7874('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7874('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7874('0x12'));var hardwareService=require(_0x7874('0x13'));var logger=require(_0x7874('0x14'))(_0x7874('0x15'));var utils=require(_0x7874('0x16'));var config=require(_0x7874('0x17'));var licenseUtil=require(_0x7874('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54b095,_0x3993ca){_0x3993ca=_0x3993ca||0xcc;return function(_0x26a13d){if(_0x26a13d){return _0x54b095[_0x7874('0x19')](_0x3993ca);}return _0x54b095[_0x7874('0x1a')](_0x3993ca)[_0x7874('0x1b')]();};}function respondWithResult(_0x27485a,_0x7270b){_0x7270b=_0x7270b||0xc8;return function(_0x1f495d){if(_0x1f495d){return _0x27485a['status'](_0x7270b)[_0x7874('0x1c')](_0x1f495d);}};}function respondWithFilteredResult(_0x54a8ac,_0x55c050){return function(_0x8908b2){if(_0x8908b2){var _0x7ebfef=typeof _0x55c050['offset']===_0x7874('0x1d')&&typeof _0x55c050[_0x7874('0x1e')]===_0x7874('0x1d');var _0x137842=_0x8908b2['count'];var _0x284d4a=_0x7ebfef?0x0:_0x55c050[_0x7874('0x1f')];var _0x74b34=_0x7ebfef?_0x8908b2[_0x7874('0x20')]:_0x55c050[_0x7874('0x1f')]+_0x55c050[_0x7874('0x1e')];var _0x1397b3;if(_0x74b34>=_0x137842){_0x74b34=_0x137842;_0x1397b3=0xc8;}else{_0x1397b3=0xce;}_0x54a8ac[_0x7874('0x1a')](_0x1397b3);return _0x54a8ac['set'](_0x7874('0x21'),_0x284d4a+'-'+_0x74b34+'/'+_0x137842)[_0x7874('0x1c')](_0x8908b2);}return null;};}function patchUpdates(_0x2c4229){return function(_0x5bd7b3){try{jsonpatch[_0x7874('0x22')](_0x5bd7b3,_0x2c4229,!![]);}catch(_0x2cc510){return BPromise[_0x7874('0x23')](_0x2cc510);}return _0x5bd7b3['save']();};}function saveUpdates(_0x158860,_0x42bacc){return function(_0x53238b){if(_0x53238b){return _0x53238b[_0x7874('0x24')](_0x158860)['then'](function(_0xbcceb){return _0xbcceb;});}return null;};}function removeEntity(_0x4223e7,_0x5dad45){return function(_0x5eb82c){if(_0x5eb82c){return _0x5eb82c[_0x7874('0x25')]()[_0x7874('0x26')](function(){_0x4223e7[_0x7874('0x1a')](0xcc)[_0x7874('0x1b')]();});}};}function handleEntityNotFound(_0x10ad9f,_0x37be21){return function(_0x321f05){if(!_0x321f05){_0x10ad9f['sendStatus'](0x194);}return _0x321f05;};}function handleError(_0x5cf375,_0x3e359e){_0x3e359e=_0x3e359e||0x1f4;return function(_0x1eb494){logger[_0x7874('0x27')](_0x1eb494[_0x7874('0x28')]);if(_0x1eb494[_0x7874('0x29')]){delete _0x1eb494['name'];}_0x5cf375[_0x7874('0x1a')](_0x3e359e)[_0x7874('0x2a')](_0x1eb494);};}exports[_0x7874('0x2b')]=function(_0x4ecec2,_0x3957a4){var _0x33f244={},_0x452887={},_0x216204={'count':0x0,'rows':[]};var _0x2f7d48=_['map'](db['SquareMessage'][_0x7874('0x2c')],function(_0x14681e){return{'name':_0x14681e[_0x7874('0x2d')],'type':_0x14681e[_0x7874('0x2e')][_0x7874('0x2f')]};});_0x452887['model']=_['map'](_0x2f7d48,'name');_0x452887[_0x7874('0x30')]=_['keys'](_0x4ecec2['query']);_0x452887[_0x7874('0x31')]=_['intersection'](_0x452887[_0x7874('0x32')],_0x452887['query']);_0x33f244['attributes']=_[_0x7874('0x33')](_0x452887[_0x7874('0x32')],qs['fields'](_0x4ecec2['query'][_0x7874('0x34')]));_0x33f244[_0x7874('0x35')]=_0x33f244[_0x7874('0x35')]['length']?_0x33f244[_0x7874('0x35')]:_0x452887[_0x7874('0x32')];if(!_0x4ecec2[_0x7874('0x30')][_0x7874('0x36')](_0x7874('0x37'))){_0x33f244[_0x7874('0x1e')]=qs[_0x7874('0x1e')](_0x4ecec2[_0x7874('0x30')][_0x7874('0x1e')]);_0x33f244['offset']=qs['offset'](_0x4ecec2[_0x7874('0x30')][_0x7874('0x1f')]);}_0x33f244[_0x7874('0x38')]=qs[_0x7874('0x39')](_0x4ecec2[_0x7874('0x30')][_0x7874('0x39')]);_0x33f244['where']=qs[_0x7874('0x31')](_['pick'](_0x4ecec2['query'],_0x452887[_0x7874('0x31')]),_0x2f7d48);if(_0x4ecec2['query'][_0x7874('0x3a')]){_0x33f244[_0x7874('0x3b')]=_[_0x7874('0x3c')](_0x33f244[_0x7874('0x3b')],{'$or':_[_0x7874('0x3d')](_0x2f7d48,function(_0x28274e){if(_0x28274e[_0x7874('0x2e')]!=='VIRTUAL'){var _0x5bd7a1={};_0x5bd7a1[_0x28274e[_0x7874('0x29')]]={'$like':'%'+_0x4ecec2[_0x7874('0x30')][_0x7874('0x3a')]+'%'};return _0x5bd7a1;}})});}_0x33f244=_[_0x7874('0x3c')]({},_0x33f244,_0x4ecec2[_0x7874('0x3e')]);var _0x25e6c7={'where':_0x33f244[_0x7874('0x3b')]};return db[_0x7874('0x3f')][_0x7874('0x20')](_0x25e6c7)[_0x7874('0x26')](function(_0x5676cf){_0x216204['count']=_0x5676cf;if(_0x4ecec2[_0x7874('0x30')][_0x7874('0x40')]){_0x33f244[_0x7874('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0x7874('0x42')](_0x33f244);})[_0x7874('0x26')](function(_0x1a8db6){_0x216204[_0x7874('0x43')]=_0x1a8db6;return _0x216204;})[_0x7874('0x26')](respondWithFilteredResult(_0x3957a4,_0x33f244))[_0x7874('0x44')](handleError(_0x3957a4,null));};exports[_0x7874('0x45')]=function(_0x48bf38,_0xb76ad9){var _0x8dc916={'raw':!![],'where':{'id':_0x48bf38[_0x7874('0x46')]['id']}},_0x43f96d={};_0x43f96d[_0x7874('0x32')]=_['keys'](db['SquareMessage'][_0x7874('0x2c')]);_0x43f96d[_0x7874('0x30')]=_[_0x7874('0x47')](_0x48bf38[_0x7874('0x30')]);_0x43f96d[_0x7874('0x31')]=_[_0x7874('0x33')](_0x43f96d[_0x7874('0x32')],_0x43f96d[_0x7874('0x30')]);_0x8dc916[_0x7874('0x35')]=_[_0x7874('0x33')](_0x43f96d[_0x7874('0x32')],qs[_0x7874('0x34')](_0x48bf38[_0x7874('0x30')][_0x7874('0x34')]));_0x8dc916[_0x7874('0x35')]=_0x8dc916['attributes']['length']?_0x8dc916[_0x7874('0x35')]:_0x43f96d[_0x7874('0x32')];if(_0x48bf38[_0x7874('0x30')][_0x7874('0x40')]){_0x8dc916['include']=[{'all':!![]}];}_0x8dc916=_['merge']({},_0x8dc916,_0x48bf38[_0x7874('0x3e')]);return db[_0x7874('0x3f')][_0x7874('0x48')](_0x8dc916)[_0x7874('0x26')](handleEntityNotFound(_0xb76ad9,null))[_0x7874('0x26')](respondWithResult(_0xb76ad9,null))[_0x7874('0x44')](handleError(_0xb76ad9,null));};exports[_0x7874('0x49')]=function(_0x4f998d,_0x494f2b){return db['SquareMessage'][_0x7874('0x49')](_0x4f998d['body'],{})[_0x7874('0x26')](respondWithResult(_0x494f2b,0xc9))[_0x7874('0x44')](handleError(_0x494f2b,null));};exports[_0x7874('0x24')]=function(_0x12b975,_0x4c4c2c){if(_0x12b975['body']['id']){delete _0x12b975[_0x7874('0x4a')]['id'];}return db['SquareMessage'][_0x7874('0x48')]({'where':{'id':_0x12b975[_0x7874('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c4c2c,null))[_0x7874('0x26')](saveUpdates(_0x12b975[_0x7874('0x4a')],null))[_0x7874('0x26')](respondWithResult(_0x4c4c2c,null))['catch'](handleError(_0x4c4c2c,null));};exports[_0x7874('0x25')]=function(_0x8c3591,_0x463c6e){return db[_0x7874('0x3f')][_0x7874('0x48')]({'where':{'id':_0x8c3591[_0x7874('0x46')]['id']}})[_0x7874('0x26')](handleEntityNotFound(_0x463c6e,null))[_0x7874('0x26')](removeEntity(_0x463c6e,null))[_0x7874('0x44')](handleError(_0x463c6e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 437bf5f..7b55acd 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 _0xb027=['api','moment','request-promise','path','rimraf','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb027,0x111));var _0x7b02=function(_0x27d462,_0x3704d8){_0x27d462=_0x27d462-0x0;var _0x3fc3c1=_0xb027[_0x27d462];return _0x3fc3c1;};'use strict';var _=require(_0x7b02('0x0'));var util=require(_0x7b02('0x1'));var logger=require(_0x7b02('0x2'))(_0x7b02('0x3'));var moment=require(_0x7b02('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b02('0x5'));var fs=require('fs');var path=require(_0x7b02('0x6'));var rimraf=require(_0x7b02('0x7'));var config=require('../../config/environment');var attributes=require(_0x7b02('0x8'));module[_0x7b02('0x9')]=function(_0x3d7014,_0x342860){return _0x3d7014['define'](_0x7b02('0xa'),attributes,{'tableName':_0x7b02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d49=['SquareMessage','square_messages','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x2abe3c,_0x3fb781){var _0x52ea50=function(_0x1ecbcf){while(--_0x1ecbcf){_0x2abe3c['push'](_0x2abe3c['shift']());}};_0x52ea50(++_0x3fb781);}(_0x8d49,0xf4));var _0x98d4=function(_0x41c829,_0x2c6986){_0x41c829=_0x41c829-0x0;var _0x12ad1a=_0x8d49[_0x41c829];return _0x12ad1a;};'use strict';var _=require(_0x98d4('0x0'));var util=require(_0x98d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x98d4('0x2'));var BPromise=require(_0x98d4('0x3'));var rp=require(_0x98d4('0x4'));var fs=require('fs');var path=require(_0x98d4('0x5'));var rimraf=require(_0x98d4('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x98d4('0x7')]=function(_0x1f79e0,_0x4f236e){return _0x1f79e0[_0x98d4('0x8')](_0x98d4('0x9'),attributes,{'tableName':_0x98d4('0xa'),'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 d0a8293..7668065 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 _0xba88=['CreateSquareMessage','SquareMessage','create','body','options','raw','debug','stringify','catch','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','error','code','SquareMessage,\x20%s,\x20%s','message','result'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0xba88,0x1e4));var _0x8ba8=function(_0x573f73,_0x500eee){_0x573f73=_0x573f73-0x0;var _0xfe6186=_0xba88[_0x573f73];return _0xfe6186;};'use strict';var _=require('lodash');var util=require(_0x8ba8('0x0'));var moment=require(_0x8ba8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ba8('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ba8('0x3'))(_0x8ba8('0x4'));var config=require(_0x8ba8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8ba8('0x6')][_0x8ba8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2df2ca,_0x25709e,_0x4f98b9){return new BPromise(function(_0x14b4a1,_0x3b4847){return client[_0x8ba8('0x8')](_0x2df2ca,_0x4f98b9)[_0x8ba8('0x9')](function(_0x67a64a){logger[_0x8ba8('0xa')]('SquareMessage,\x20%s,\x20%s',_0x25709e,'request\x20sent');logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x25709e,'request\x20sent',JSON['stringify'](_0x67a64a));if(_0x67a64a[_0x8ba8('0xb')]){if(_0x67a64a[_0x8ba8('0xb')][_0x8ba8('0xc')]===0x1f4){logger[_0x8ba8('0xb')](_0x8ba8('0xd'),_0x25709e,_0x67a64a[_0x8ba8('0xb')][_0x8ba8('0xe')]);return _0x3b4847(_0x67a64a[_0x8ba8('0xb')][_0x8ba8('0xe')]);}logger[_0x8ba8('0xb')](_0x8ba8('0xd'),_0x25709e,_0x67a64a[_0x8ba8('0xb')][_0x8ba8('0xe')]);return _0x14b4a1(_0x67a64a[_0x8ba8('0xb')]['message']);}else{logger[_0x8ba8('0xa')]('SquareMessage,\x20%s,\x20%s',_0x25709e,'request\x20sent');_0x14b4a1(_0x67a64a[_0x8ba8('0xf')]['message']);}})['catch'](function(_0xd9bd86){logger[_0x8ba8('0xb')](_0x8ba8('0xd'),_0x25709e,_0xd9bd86);_0x3b4847(_0xd9bd86);});});}exports[_0x8ba8('0x10')]=function(_0xa7e6e9){var _0x44cf50=this;return new Promise(function(_0x149dfb,_0xfade8c){return db[_0x8ba8('0x11')][_0x8ba8('0x12')](_0xa7e6e9[_0x8ba8('0x13')],{'raw':_0xa7e6e9['options']?_0xa7e6e9[_0x8ba8('0x14')][_0x8ba8('0x15')]===undefined?!![]:![]:!![]})[_0x8ba8('0x9')](function(_0x9da49){logger[_0x8ba8('0xa')](_0x8ba8('0x10'),_0xa7e6e9);logger[_0x8ba8('0x16')](_0x8ba8('0x10'),_0xa7e6e9,JSON[_0x8ba8('0x17')](_0x9da49));_0x149dfb(_0x9da49);})[_0x8ba8('0x18')](function(_0x2cd2f2){logger[_0x8ba8('0xb')](_0x8ba8('0x10'),_0x2cd2f2[_0x8ba8('0xe')],_0xa7e6e9);_0xfade8c(_0x44cf50[_0x8ba8('0xb')](0x1f4,_0x2cd2f2['message']));});});}; \ No newline at end of file +var _0x94c7=['create','body','options','raw','then','stringify','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x4da7da,_0x17974b){var _0x30485d=function(_0x1d654e){while(--_0x1d654e){_0x4da7da['push'](_0x4da7da['shift']());}};_0x30485d(++_0x17974b);}(_0x94c7,0xa2));var _0x794c=function(_0x4fb2ca,_0x28a5ac){_0x4fb2ca=_0x4fb2ca-0x0;var _0x1e16a6=_0x94c7[_0x4fb2ca];return _0x1e16a6;};'use strict';var _=require('lodash');var util=require(_0x794c('0x0'));var moment=require(_0x794c('0x1'));var BPromise=require('bluebird');var rs=require(_0x794c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x794c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x794c('0x4'));var jayson=require(_0x794c('0x5'));var client=jayson[_0x794c('0x6')][_0x794c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e0fac,_0x142a66,_0x8e5826){return new BPromise(function(_0x12248e,_0x2e4f83){return client['request'](_0x3e0fac,_0x8e5826)['then'](function(_0x8e2bae){logger[_0x794c('0x8')](_0x794c('0x9'),_0x142a66,_0x794c('0xa'));logger[_0x794c('0xb')](_0x794c('0xc'),_0x142a66,'request\x20sent',JSON['stringify'](_0x8e2bae));if(_0x8e2bae[_0x794c('0xd')]){if(_0x8e2bae['error'][_0x794c('0xe')]===0x1f4){logger[_0x794c('0xd')]('SquareMessage,\x20%s,\x20%s',_0x142a66,_0x8e2bae[_0x794c('0xd')][_0x794c('0xf')]);return _0x2e4f83(_0x8e2bae[_0x794c('0xd')][_0x794c('0xf')]);}logger[_0x794c('0xd')](_0x794c('0x9'),_0x142a66,_0x8e2bae[_0x794c('0xd')]['message']);return _0x12248e(_0x8e2bae['error'][_0x794c('0xf')]);}else{logger[_0x794c('0x8')](_0x794c('0x9'),_0x142a66,_0x794c('0xa'));_0x12248e(_0x8e2bae[_0x794c('0x10')][_0x794c('0xf')]);}})[_0x794c('0x11')](function(_0x31f2b8){logger[_0x794c('0xd')](_0x794c('0x9'),_0x142a66,_0x31f2b8);_0x2e4f83(_0x31f2b8);});});}exports[_0x794c('0x12')]=function(_0x173f71){var _0x1f6893=this;return new Promise(function(_0x201adc,_0x2d6190){return db[_0x794c('0x13')][_0x794c('0x14')](_0x173f71[_0x794c('0x15')],{'raw':_0x173f71[_0x794c('0x16')]?_0x173f71[_0x794c('0x16')][_0x794c('0x17')]===undefined?!![]:![]:!![]})[_0x794c('0x18')](function(_0x5357a2){logger[_0x794c('0x8')](_0x794c('0x12'),_0x173f71);logger[_0x794c('0xb')]('CreateSquareMessage',_0x173f71,JSON[_0x794c('0x19')](_0x5357a2));_0x201adc(_0x5357a2);})[_0x794c('0x11')](function(_0x3dd2d8){logger[_0x794c('0xd')](_0x794c('0x12'),_0x3dd2d8['message'],_0x173f71);_0x2d6190(_0x1f6893['error'](0x1f4,_0x3dd2d8['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 2ef93e0..a65ec4d 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 _0xb881=['index','show','/:id/test','test','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated'];(function(_0x3a0224,_0x518b92){var _0x16f4bc=function(_0x45dec0){while(--_0x45dec0){_0x3a0224['push'](_0x3a0224['shift']());}};_0x16f4bc(++_0x518b92);}(_0xb881,0x170));var _0x1b88=function(_0x58fa29,_0x1135f2){_0x58fa29=_0x58fa29-0x0;var _0x59044e=_0xb881[_0x58fa29];return _0x59044e;};'use strict';var multer=require(_0x1b88('0x0'));var util=require(_0x1b88('0x1'));var path=require('path');var timeout=require(_0x1b88('0x2'));var express=require(_0x1b88('0x3'));var router=express[_0x1b88('0x4')]();var fs_extra=require(_0x1b88('0x5'));var auth=require(_0x1b88('0x6'));var interaction=require(_0x1b88('0x7'));var config=require(_0x1b88('0x8'));var controller=require(_0x1b88('0x9'));router[_0x1b88('0xa')]('/',auth[_0x1b88('0xb')](),controller[_0x1b88('0xc')]);router[_0x1b88('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1b88('0xd')]);router[_0x1b88('0xa')](_0x1b88('0xe'),auth['isAuthenticated'](),timeout('15s'),controller[_0x1b88('0xf')]);router['post']('/',auth[_0x1b88('0xb')](),controller['create']);router['put']('/:id',auth[_0x1b88('0xb')](),controller['update']);router[_0x1b88('0x10')](_0x1b88('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b88('0x12')]=router; \ No newline at end of file +var _0x7b43=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','test','post','put','/:id','update'];(function(_0x4a5a0a,_0x1597fc){var _0x560c97=function(_0x470fe4){while(--_0x470fe4){_0x4a5a0a['push'](_0x4a5a0a['shift']());}};_0x560c97(++_0x1597fc);}(_0x7b43,0x16b));var _0x37b4=function(_0x2536a6,_0x4f453e){_0x2536a6=_0x2536a6-0x0;var _0x2ba3fb=_0x7b43[_0x2536a6];return _0x2ba3fb;};'use strict';var multer=require(_0x37b4('0x0'));var util=require(_0x37b4('0x1'));var path=require(_0x37b4('0x2'));var timeout=require(_0x37b4('0x3'));var express=require(_0x37b4('0x4'));var router=express['Router']();var fs_extra=require(_0x37b4('0x5'));var auth=require(_0x37b4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x37b4('0x7'));var controller=require(_0x37b4('0x8'));router[_0x37b4('0x9')]('/',auth[_0x37b4('0xa')](),controller[_0x37b4('0xb')]);router['get']('/:id',auth[_0x37b4('0xa')](),controller['show']);router['get']('/:id/test',auth[_0x37b4('0xa')](),timeout('15s'),controller[_0x37b4('0xc')]);router[_0x37b4('0xd')]('/',auth[_0x37b4('0xa')](),controller['create']);router[_0x37b4('0xe')](_0x37b4('0xf'),auth[_0x37b4('0xa')](),controller[_0x37b4('0x10')]);router[_0x37b4('0x11')](_0x37b4('0xf'),auth[_0x37b4('0xa')](),controller['destroy']);module[_0x37b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d316c6e..3067ffa 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 _0x1da6=['sequelize','exports','STRING','name'];(function(_0x2f4fe7,_0x5119bf){var _0x40d436=function(_0x26b05d){while(--_0x26b05d){_0x2f4fe7['push'](_0x2f4fe7['shift']());}};_0x40d436(++_0x5119bf);}(_0x1da6,0x7c));var _0x61da=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x1da6[_0xb3b452];return _0x238983;};'use strict';var Sequelize=require(_0x61da('0x0'));module[_0x61da('0x1')]={'name':{'type':Sequelize[_0x61da('0x2')],'unique':_0x61da('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x61da('0x2')]},'description':{'type':Sequelize[_0x61da('0x2')]}}; \ No newline at end of file +var _0xdf94=['STRING','name','sequelize','exports'];(function(_0x1b6dde,_0x256aea){var _0x522e62=function(_0x4a02d7){while(--_0x4a02d7){_0x1b6dde['push'](_0x1b6dde['shift']());}};_0x522e62(++_0x256aea);}(_0xdf94,0x15e));var _0x4df9=function(_0x86f27e,_0x16ee71){_0x86f27e=_0x86f27e-0x0;var _0x2a5f11=_0xdf94[_0x86f27e];return _0x2a5f11;};'use strict';var Sequelize=require(_0x4df9('0x0'));module[_0x4df9('0x1')]={'name':{'type':Sequelize[_0x4df9('0x2')],'unique':_0x4df9('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4df9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 7ed30a6..1f7f0dd 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 _0xcafc=['mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','ODBC','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','params','SquareOdbc','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','dsn','openSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0xcafc,0x1a8));var _0xccaf=function(_0x5af08c,_0x50dab0){_0x5af08c=_0x5af08c-0x0;var _0x233265=_0xcafc[_0x5af08c];return _0x233265;};'use strict';var emlformat=require(_0xccaf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccaf('0x1'));var jsonpatch=require(_0xccaf('0x2'));var rp=require(_0xccaf('0x3'));var moment=require(_0xccaf('0x4'));var BPromise=require(_0xccaf('0x5'));var Mustache=require(_0xccaf('0x6'));var util=require(_0xccaf('0x7'));var path=require(_0xccaf('0x8'));var sox=require(_0xccaf('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccaf('0xa'));var _=require(_0xccaf('0xb'));var squel=require(_0xccaf('0xc'));var crypto=require('crypto');var jsforce=require(_0xccaf('0xd'));var deskjs=require(_0xccaf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xccaf('0xf'));var Papa=require(_0xccaf('0x10'));var Redis=require(_0xccaf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xccaf('0x12'));var as=require(_0xccaf('0x13'));var hardwareService=require(_0xccaf('0x14'));var logger=require(_0xccaf('0x15'))('api');var utils=require(_0xccaf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xccaf('0x17'));var db=require(_0xccaf('0x18'))['db'];function respondWithStatusCode(_0x39cccd,_0x6c95bd){_0x6c95bd=_0x6c95bd||0xcc;return function(_0x45f495){if(_0x45f495){return _0x39cccd[_0xccaf('0x19')](_0x6c95bd);}return _0x39cccd['status'](_0x6c95bd)['end']();};}function respondWithResult(_0x21f6b4,_0x210f43){_0x210f43=_0x210f43||0xc8;return function(_0x28dde7){if(_0x28dde7){return _0x21f6b4[_0xccaf('0x1a')](_0x210f43)[_0xccaf('0x1b')](_0x28dde7);}};}function respondWithFilteredResult(_0x55d1c6,_0x3c8ddb){return function(_0x2adc61){if(_0x2adc61){var _0x102f5b=typeof _0x3c8ddb[_0xccaf('0x1c')]===_0xccaf('0x1d')&&typeof _0x3c8ddb[_0xccaf('0x1e')]==='undefined';var _0x295767=_0x2adc61[_0xccaf('0x1f')];var _0xc5a7ef=_0x102f5b?0x0:_0x3c8ddb[_0xccaf('0x1c')];var _0x43bf2b=_0x102f5b?_0x2adc61[_0xccaf('0x1f')]:_0x3c8ddb['offset']+_0x3c8ddb[_0xccaf('0x1e')];var _0x3c1f80;if(_0x43bf2b>=_0x295767){_0x43bf2b=_0x295767;_0x3c1f80=0xc8;}else{_0x3c1f80=0xce;}_0x55d1c6['status'](_0x3c1f80);return _0x55d1c6['set'](_0xccaf('0x20'),_0xc5a7ef+'-'+_0x43bf2b+'/'+_0x295767)[_0xccaf('0x1b')](_0x2adc61);}return null;};}function patchUpdates(_0x260304){return function(_0x53185b){try{jsonpatch['apply'](_0x53185b,_0x260304,!![]);}catch(_0x53c5ee){return BPromise[_0xccaf('0x21')](_0x53c5ee);}return _0x53185b['save']();};}function saveUpdates(_0x270dc6,_0x415199){return function(_0x5a2bb4){if(_0x5a2bb4){return _0x5a2bb4[_0xccaf('0x22')](_0x270dc6)[_0xccaf('0x23')](function(_0x2f638e){return _0x2f638e;});}return null;};}function removeEntity(_0x31320c,_0x378f50){return function(_0x151208){if(_0x151208){return _0x151208[_0xccaf('0x24')]()[_0xccaf('0x23')](function(){var _0xae0d50=_0x151208['get']({'plain':!![]});var _0x4ab6ab=_0xccaf('0x25');return db['UserProfileResource'][_0xccaf('0x24')]({'where':{'type':_0x4ab6ab,'resourceId':_0xae0d50['id']}})[_0xccaf('0x23')](function(){return _0x151208;});})['then'](function(){_0x31320c['status'](0xcc)[_0xccaf('0x26')]();});}};}function handleEntityNotFound(_0x595377,_0x539bd0){return function(_0x35458a){if(!_0x35458a){_0x595377[_0xccaf('0x19')](0x194);}return _0x35458a;};}function handleError(_0x139f79,_0x4ba5ea){_0x4ba5ea=_0x4ba5ea||0x1f4;return function(_0x1f9fb6){logger[_0xccaf('0x27')](_0x1f9fb6[_0xccaf('0x28')]);if(_0x1f9fb6[_0xccaf('0x29')]){delete _0x1f9fb6[_0xccaf('0x29')];}_0x139f79[_0xccaf('0x1a')](_0x4ba5ea)[_0xccaf('0x2a')](_0x1f9fb6);};}exports[_0xccaf('0x2b')]=function(_0x343f9f,_0x5d6d4a){var _0x34f16c={},_0x1ba6e3={},_0x5db1d3={'count':0x0,'rows':[]};var _0x30eed8=_['map'](db['SquareOdbc'][_0xccaf('0x2c')],function(_0x21c3f1){return{'name':_0x21c3f1[_0xccaf('0x2d')],'type':_0x21c3f1['type'][_0xccaf('0x2e')]};});_0x1ba6e3[_0xccaf('0x2f')]=_[_0xccaf('0x30')](_0x30eed8,'name');_0x1ba6e3['query']=_[_0xccaf('0x31')](_0x343f9f[_0xccaf('0x32')]);_0x1ba6e3['filters']=_[_0xccaf('0x33')](_0x1ba6e3['model'],_0x1ba6e3['query']);_0x34f16c['attributes']=_['intersection'](_0x1ba6e3[_0xccaf('0x2f')],qs['fields'](_0x343f9f[_0xccaf('0x32')][_0xccaf('0x34')]));_0x34f16c[_0xccaf('0x35')]=_0x34f16c[_0xccaf('0x35')][_0xccaf('0x36')]?_0x34f16c['attributes']:_0x1ba6e3['model'];if(!_0x343f9f[_0xccaf('0x32')][_0xccaf('0x37')](_0xccaf('0x38'))){_0x34f16c['limit']=qs[_0xccaf('0x1e')](_0x343f9f['query'][_0xccaf('0x1e')]);_0x34f16c[_0xccaf('0x1c')]=qs[_0xccaf('0x1c')](_0x343f9f[_0xccaf('0x32')][_0xccaf('0x1c')]);}_0x34f16c[_0xccaf('0x39')]=qs[_0xccaf('0x3a')](_0x343f9f[_0xccaf('0x32')][_0xccaf('0x3a')]);_0x34f16c[_0xccaf('0x3b')]=qs[_0xccaf('0x3c')](_[_0xccaf('0x3d')](_0x343f9f[_0xccaf('0x32')],_0x1ba6e3[_0xccaf('0x3c')]),_0x30eed8);if(_0x343f9f[_0xccaf('0x32')][_0xccaf('0x3e')]){_0x34f16c[_0xccaf('0x3b')]=_['merge'](_0x34f16c[_0xccaf('0x3b')],{'$or':_[_0xccaf('0x30')](_0x30eed8,function(_0x1a2867){if(_0x1a2867[_0xccaf('0x3f')]!==_0xccaf('0x40')){var _0x1fcd64={};_0x1fcd64[_0x1a2867['name']]={'$like':'%'+_0x343f9f[_0xccaf('0x32')][_0xccaf('0x3e')]+'%'};return _0x1fcd64;}})});}_0x34f16c=_[_0xccaf('0x41')]({},_0x34f16c,_0x343f9f[_0xccaf('0x42')]);var _0x4d33df={'where':_0x34f16c[_0xccaf('0x3b')]};return db['SquareOdbc'][_0xccaf('0x1f')](_0x4d33df)[_0xccaf('0x23')](function(_0x422eff){_0x5db1d3['count']=_0x422eff;if(_0x343f9f[_0xccaf('0x32')][_0xccaf('0x43')]){_0x34f16c[_0xccaf('0x44')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x34f16c);})[_0xccaf('0x23')](function(_0x8a7f34){_0x5db1d3[_0xccaf('0x45')]=_0x8a7f34;return _0x5db1d3;})[_0xccaf('0x23')](respondWithFilteredResult(_0x5d6d4a,_0x34f16c))[_0xccaf('0x46')](handleError(_0x5d6d4a,null));};exports['show']=function(_0x4cf20c,_0x305642){var _0x3bd228={'raw':!![],'where':{'id':_0x4cf20c[_0xccaf('0x47')]['id']}},_0x77b5ca={};_0x77b5ca['model']=_[_0xccaf('0x31')](db[_0xccaf('0x48')][_0xccaf('0x2c')]);_0x77b5ca[_0xccaf('0x32')]=_[_0xccaf('0x31')](_0x4cf20c[_0xccaf('0x32')]);_0x77b5ca[_0xccaf('0x3c')]=_[_0xccaf('0x33')](_0x77b5ca[_0xccaf('0x2f')],_0x77b5ca[_0xccaf('0x32')]);_0x3bd228[_0xccaf('0x35')]=_[_0xccaf('0x33')](_0x77b5ca['model'],qs[_0xccaf('0x34')](_0x4cf20c[_0xccaf('0x32')][_0xccaf('0x34')]));_0x3bd228[_0xccaf('0x35')]=_0x3bd228[_0xccaf('0x35')]['length']?_0x3bd228[_0xccaf('0x35')]:_0x77b5ca[_0xccaf('0x2f')];if(_0x4cf20c[_0xccaf('0x32')][_0xccaf('0x43')]){_0x3bd228[_0xccaf('0x44')]=[{'all':!![]}];}_0x3bd228=_[_0xccaf('0x41')]({},_0x3bd228,_0x4cf20c[_0xccaf('0x42')]);return db[_0xccaf('0x48')]['find'](_0x3bd228)[_0xccaf('0x23')](handleEntityNotFound(_0x305642,null))[_0xccaf('0x23')](respondWithResult(_0x305642,null))[_0xccaf('0x46')](handleError(_0x305642,null));};exports['create']=function(_0x325997,_0x4d52a1){return db[_0xccaf('0x48')]['create'](_0x325997[_0xccaf('0x49')],{})[_0xccaf('0x23')](function(_0x288e07){var _0x4b31bf=_0x325997['user'][_0xccaf('0x4a')]({'plain':!![]});if(!_0x4b31bf)throw new Error(_0xccaf('0x4b'));if(_0x4b31bf[_0xccaf('0x4c')]===_0xccaf('0x4d')){var _0x33c571=_0x288e07[_0xccaf('0x4a')]({'plain':!![]});var _0x242308='ODBC';return db[_0xccaf('0x4e')]['find']({'where':{'name':_0x242308,'userProfileId':_0x4b31bf[_0xccaf('0x4f')]},'raw':!![]})[_0xccaf('0x23')](function(_0x1c9163){if(_0x1c9163&&_0x1c9163['autoAssociation']===0x0){return db[_0xccaf('0x50')][_0xccaf('0x51')]({'name':_0x33c571[_0xccaf('0x29')],'resourceId':_0x33c571['id'],'type':_0x1c9163[_0xccaf('0x29')],'sectionId':_0x1c9163['id']},{})[_0xccaf('0x23')](function(){return _0x288e07;});}else{return _0x288e07;}})['catch'](function(_0x35d643){logger['error'](_0xccaf('0x52'),_0x35d643);throw _0x35d643;});}return _0x288e07;})['then'](respondWithResult(_0x4d52a1,0xc9))[_0xccaf('0x46')](handleError(_0x4d52a1,null));};exports[_0xccaf('0x22')]=function(_0x37948f,_0x296a0c){if(_0x37948f[_0xccaf('0x49')]['id']){delete _0x37948f['body']['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x37948f[_0xccaf('0x47')]['id']}})[_0xccaf('0x23')](handleEntityNotFound(_0x296a0c,null))[_0xccaf('0x23')](saveUpdates(_0x37948f[_0xccaf('0x49')],null))[_0xccaf('0x23')](respondWithResult(_0x296a0c,null))[_0xccaf('0x46')](handleError(_0x296a0c,null));};exports[_0xccaf('0x24')]=function(_0x25fb3c,_0x298f18){return db['SquareOdbc'][_0xccaf('0x53')]({'where':{'id':_0x25fb3c[_0xccaf('0x47')]['id']}})['then'](handleEntityNotFound(_0x298f18,null))[_0xccaf('0x23')](removeEntity(_0x298f18,null))['catch'](handleError(_0x298f18,null));};exports['test']=function(_0x194edd,_0x273059,_0x5063cc){var _0x2e710f;return db[_0xccaf('0x48')][_0xccaf('0x53')]({'where':{'id':_0x194edd['params']['id']},'attributes':['id',_0xccaf('0x54')]})['then'](handleEntityNotFound(_0x273059,null))[_0xccaf('0x23')](function(_0x111c48){if(_0x111c48){var _0x2d2209=require('odbc')();_0x2d2209[_0xccaf('0x55')](_0x111c48[_0xccaf('0x54')]);_0x2d2209['closeSync']();return _0x111c48;}})[_0xccaf('0x23')](respondWithResult(_0x273059,null))[_0xccaf('0x46')](handleError(_0x273059,null));}; \ No newline at end of file +var _0xea93=['openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','send','SquareOdbc','rawAttributes','fieldName','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','map','type','VIRTUAL','includeAll','include','catch','show','merge','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','odbc'];(function(_0x33ed8d,_0x3087d5){var _0x517aea=function(_0x12357b){while(--_0x12357b){_0x33ed8d['push'](_0x33ed8d['shift']());}};_0x517aea(++_0x3087d5);}(_0xea93,0x1ac));var _0x3ea9=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0xea93[_0x383dbb];return _0x6e8bde;};'use strict';var emlformat=require(_0x3ea9('0x0'));var rimraf=require(_0x3ea9('0x1'));var zipdir=require(_0x3ea9('0x2'));var jsonpatch=require(_0x3ea9('0x3'));var rp=require(_0x3ea9('0x4'));var moment=require(_0x3ea9('0x5'));var BPromise=require(_0x3ea9('0x6'));var Mustache=require('mustache');var util=require(_0x3ea9('0x7'));var path=require(_0x3ea9('0x8'));var sox=require('sox');var csv=require(_0x3ea9('0x9'));var ejs=require(_0x3ea9('0xa'));var fs=require('fs');var fs_extra=require(_0x3ea9('0xb'));var _=require(_0x3ea9('0xc'));var squel=require('squel');var crypto=require(_0x3ea9('0xd'));var jsforce=require(_0x3ea9('0xe'));var deskjs=require(_0x3ea9('0xf'));var toCsv=require(_0x3ea9('0x9'));var querystring=require('querystring');var Papa=require(_0x3ea9('0x10'));var Redis=require(_0x3ea9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3ea9('0x12'));var as=require(_0x3ea9('0x13'));var hardwareService=require(_0x3ea9('0x14'));var logger=require('../../config/logger')(_0x3ea9('0x15'));var utils=require(_0x3ea9('0x16'));var config=require(_0x3ea9('0x17'));var licenseUtil=require(_0x3ea9('0x18'));var db=require(_0x3ea9('0x19'))['db'];function respondWithStatusCode(_0x1e38da,_0x22e2a0){_0x22e2a0=_0x22e2a0||0xcc;return function(_0x3baec2){if(_0x3baec2){return _0x1e38da[_0x3ea9('0x1a')](_0x22e2a0);}return _0x1e38da[_0x3ea9('0x1b')](_0x22e2a0)[_0x3ea9('0x1c')]();};}function respondWithResult(_0x15419a,_0x26e604){_0x26e604=_0x26e604||0xc8;return function(_0x2c047b){if(_0x2c047b){return _0x15419a[_0x3ea9('0x1b')](_0x26e604)[_0x3ea9('0x1d')](_0x2c047b);}};}function respondWithFilteredResult(_0x520961,_0x195899){return function(_0xadac28){if(_0xadac28){var _0x1db48c=typeof _0x195899[_0x3ea9('0x1e')]===_0x3ea9('0x1f')&&typeof _0x195899[_0x3ea9('0x20')]===_0x3ea9('0x1f');var _0x42c3f8=_0xadac28[_0x3ea9('0x21')];var _0x31bad0=_0x1db48c?0x0:_0x195899['offset'];var _0x2270d3=_0x1db48c?_0xadac28['count']:_0x195899[_0x3ea9('0x1e')]+_0x195899[_0x3ea9('0x20')];var _0x34448b;if(_0x2270d3>=_0x42c3f8){_0x2270d3=_0x42c3f8;_0x34448b=0xc8;}else{_0x34448b=0xce;}_0x520961['status'](_0x34448b);return _0x520961[_0x3ea9('0x22')](_0x3ea9('0x23'),_0x31bad0+'-'+_0x2270d3+'/'+_0x42c3f8)[_0x3ea9('0x1d')](_0xadac28);}return null;};}function patchUpdates(_0x1aa414){return function(_0x34253f){try{jsonpatch['apply'](_0x34253f,_0x1aa414,!![]);}catch(_0x51d9be){return BPromise['reject'](_0x51d9be);}return _0x34253f[_0x3ea9('0x24')]();};}function saveUpdates(_0x12fb7b,_0x5cf310){return function(_0x4c3c21){if(_0x4c3c21){return _0x4c3c21[_0x3ea9('0x25')](_0x12fb7b)[_0x3ea9('0x26')](function(_0xc691fb){return _0xc691fb;});}return null;};}function removeEntity(_0x3f5cd1,_0x183634){return function(_0xc6eed1){if(_0xc6eed1){return _0xc6eed1[_0x3ea9('0x27')]()[_0x3ea9('0x26')](function(){var _0x3812ba=_0xc6eed1[_0x3ea9('0x28')]({'plain':!![]});var _0x54b9c0=_0x3ea9('0x29');return db[_0x3ea9('0x2a')][_0x3ea9('0x27')]({'where':{'type':_0x54b9c0,'resourceId':_0x3812ba['id']}})[_0x3ea9('0x26')](function(){return _0xc6eed1;});})[_0x3ea9('0x26')](function(){_0x3f5cd1[_0x3ea9('0x1b')](0xcc)[_0x3ea9('0x1c')]();});}};}function handleEntityNotFound(_0x4ed383,_0x20da48){return function(_0x174bbb){if(!_0x174bbb){_0x4ed383[_0x3ea9('0x1a')](0x194);}return _0x174bbb;};}function handleError(_0x5083ad,_0x4b611a){_0x4b611a=_0x4b611a||0x1f4;return function(_0x215869){logger[_0x3ea9('0x2b')](_0x215869[_0x3ea9('0x2c')]);if(_0x215869['name']){delete _0x215869['name'];}_0x5083ad['status'](_0x4b611a)[_0x3ea9('0x2d')](_0x215869);};}exports['index']=function(_0x34e42f,_0x255924){var _0x3cfdf7={},_0x5d938e={},_0x883b08={'count':0x0,'rows':[]};var _0x4b3ece=_['map'](db[_0x3ea9('0x2e')][_0x3ea9('0x2f')],function(_0x3928e4){return{'name':_0x3928e4[_0x3ea9('0x30')],'type':_0x3928e4['type'][_0x3ea9('0x31')]};});_0x5d938e[_0x3ea9('0x32')]=_['map'](_0x4b3ece,_0x3ea9('0x33'));_0x5d938e[_0x3ea9('0x34')]=_['keys'](_0x34e42f[_0x3ea9('0x34')]);_0x5d938e[_0x3ea9('0x35')]=_['intersection'](_0x5d938e['model'],_0x5d938e[_0x3ea9('0x34')]);_0x3cfdf7[_0x3ea9('0x36')]=_[_0x3ea9('0x37')](_0x5d938e[_0x3ea9('0x32')],qs[_0x3ea9('0x38')](_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x38')]));_0x3cfdf7[_0x3ea9('0x36')]=_0x3cfdf7['attributes'][_0x3ea9('0x39')]?_0x3cfdf7[_0x3ea9('0x36')]:_0x5d938e['model'];if(!_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x3a')]('nolimit')){_0x3cfdf7[_0x3ea9('0x20')]=qs[_0x3ea9('0x20')](_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x20')]);_0x3cfdf7[_0x3ea9('0x1e')]=qs[_0x3ea9('0x1e')](_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x1e')]);}_0x3cfdf7[_0x3ea9('0x3b')]=qs[_0x3ea9('0x3c')](_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x3c')]);_0x3cfdf7['where']=qs[_0x3ea9('0x35')](_['pick'](_0x34e42f[_0x3ea9('0x34')],_0x5d938e['filters']),_0x4b3ece);if(_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x3d')]){_0x3cfdf7[_0x3ea9('0x3e')]=_['merge'](_0x3cfdf7[_0x3ea9('0x3e')],{'$or':_[_0x3ea9('0x3f')](_0x4b3ece,function(_0x1b34f1){if(_0x1b34f1[_0x3ea9('0x40')]!==_0x3ea9('0x41')){var _0x122a1c={};_0x122a1c[_0x1b34f1[_0x3ea9('0x33')]]={'$like':'%'+_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x3d')]+'%'};return _0x122a1c;}})});}_0x3cfdf7=_['merge']({},_0x3cfdf7,_0x34e42f['options']);var _0x26e700={'where':_0x3cfdf7['where']};return db[_0x3ea9('0x2e')]['count'](_0x26e700)[_0x3ea9('0x26')](function(_0x2c6bf4){_0x883b08[_0x3ea9('0x21')]=_0x2c6bf4;if(_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x42')]){_0x3cfdf7[_0x3ea9('0x43')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3cfdf7);})[_0x3ea9('0x26')](function(_0x4d48ca){_0x883b08['rows']=_0x4d48ca;return _0x883b08;})[_0x3ea9('0x26')](respondWithFilteredResult(_0x255924,_0x3cfdf7))[_0x3ea9('0x44')](handleError(_0x255924,null));};exports[_0x3ea9('0x45')]=function(_0x5de7f9,_0x5deffa){var _0x5d18df={'raw':!![],'where':{'id':_0x5de7f9['params']['id']}},_0x399ecb={};_0x399ecb['model']=_['keys'](db[_0x3ea9('0x2e')][_0x3ea9('0x2f')]);_0x399ecb[_0x3ea9('0x34')]=_['keys'](_0x5de7f9[_0x3ea9('0x34')]);_0x399ecb[_0x3ea9('0x35')]=_[_0x3ea9('0x37')](_0x399ecb['model'],_0x399ecb[_0x3ea9('0x34')]);_0x5d18df['attributes']=_[_0x3ea9('0x37')](_0x399ecb[_0x3ea9('0x32')],qs[_0x3ea9('0x38')](_0x5de7f9['query'][_0x3ea9('0x38')]));_0x5d18df[_0x3ea9('0x36')]=_0x5d18df[_0x3ea9('0x36')][_0x3ea9('0x39')]?_0x5d18df[_0x3ea9('0x36')]:_0x399ecb['model'];if(_0x5de7f9[_0x3ea9('0x34')][_0x3ea9('0x42')]){_0x5d18df[_0x3ea9('0x43')]=[{'all':!![]}];}_0x5d18df=_[_0x3ea9('0x46')]({},_0x5d18df,_0x5de7f9[_0x3ea9('0x47')]);return db[_0x3ea9('0x2e')][_0x3ea9('0x48')](_0x5d18df)[_0x3ea9('0x26')](handleEntityNotFound(_0x5deffa,null))['then'](respondWithResult(_0x5deffa,null))[_0x3ea9('0x44')](handleError(_0x5deffa,null));};exports[_0x3ea9('0x49')]=function(_0x59c36e,_0xdeea9e){return db[_0x3ea9('0x2e')][_0x3ea9('0x49')](_0x59c36e[_0x3ea9('0x4a')],{})[_0x3ea9('0x26')](function(_0xf2334a){var _0xffcb7b=_0x59c36e[_0x3ea9('0x4b')]['get']({'plain':!![]});if(!_0xffcb7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xffcb7b['role']===_0x3ea9('0x4b')){var _0x1f9eac=_0xf2334a[_0x3ea9('0x28')]({'plain':!![]});var _0x369eda=_0x3ea9('0x29');return db[_0x3ea9('0x4c')][_0x3ea9('0x48')]({'where':{'name':_0x369eda,'userProfileId':_0xffcb7b[_0x3ea9('0x4d')]},'raw':!![]})[_0x3ea9('0x26')](function(_0x4116d5){if(_0x4116d5&&_0x4116d5[_0x3ea9('0x4e')]===0x0){return db[_0x3ea9('0x2a')][_0x3ea9('0x49')]({'name':_0x1f9eac[_0x3ea9('0x33')],'resourceId':_0x1f9eac['id'],'type':_0x4116d5['name'],'sectionId':_0x4116d5['id']},{})[_0x3ea9('0x26')](function(){return _0xf2334a;});}else{return _0xf2334a;}})[_0x3ea9('0x44')](function(_0x2b310a){logger[_0x3ea9('0x2b')](_0x3ea9('0x4f'),_0x2b310a);throw _0x2b310a;});}return _0xf2334a;})[_0x3ea9('0x26')](respondWithResult(_0xdeea9e,0xc9))['catch'](handleError(_0xdeea9e,null));};exports[_0x3ea9('0x25')]=function(_0x186a3c,_0x2e4f31){if(_0x186a3c[_0x3ea9('0x4a')]['id']){delete _0x186a3c[_0x3ea9('0x4a')]['id'];}return db['SquareOdbc'][_0x3ea9('0x48')]({'where':{'id':_0x186a3c[_0x3ea9('0x50')]['id']}})[_0x3ea9('0x26')](handleEntityNotFound(_0x2e4f31,null))[_0x3ea9('0x26')](saveUpdates(_0x186a3c[_0x3ea9('0x4a')],null))[_0x3ea9('0x26')](respondWithResult(_0x2e4f31,null))[_0x3ea9('0x44')](handleError(_0x2e4f31,null));};exports['destroy']=function(_0x2fdf33,_0x4b58ba){return db[_0x3ea9('0x2e')][_0x3ea9('0x48')]({'where':{'id':_0x2fdf33[_0x3ea9('0x50')]['id']}})[_0x3ea9('0x26')](handleEntityNotFound(_0x4b58ba,null))['then'](removeEntity(_0x4b58ba,null))[_0x3ea9('0x44')](handleError(_0x4b58ba,null));};exports['test']=function(_0x5bbe39,_0x47b97e,_0x441fe6){var _0x3388b1;return db[_0x3ea9('0x2e')]['find']({'where':{'id':_0x5bbe39[_0x3ea9('0x50')]['id']},'attributes':['id','dsn']})[_0x3ea9('0x26')](handleEntityNotFound(_0x47b97e,null))[_0x3ea9('0x26')](function(_0x484879){if(_0x484879){var _0x136452=require(_0x3ea9('0x51'))();_0x136452[_0x3ea9('0x52')](_0x484879[_0x3ea9('0x53')]);_0x136452[_0x3ea9('0x54')]();return _0x484879;}})[_0x3ea9('0x26')](respondWithResult(_0x47b97e,null))['catch'](handleError(_0x47b97e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d5192ce..4a22fa8 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 _0xd59c=['../../config/environment','exports','define','SquareOdbc','lodash','util','../../config/logger','api','moment'];(function(_0x50fa55,_0x5824d9){var _0x278b36=function(_0xeb6360){while(--_0xeb6360){_0x50fa55['push'](_0x50fa55['shift']());}};_0x278b36(++_0x5824d9);}(_0xd59c,0x12d));var _0xcd59=function(_0x4cb48d,_0x268d5c){_0x4cb48d=_0x4cb48d-0x0;var _0x3a805b=_0xd59c[_0x4cb48d];return _0x3a805b;};'use strict';var _=require(_0xcd59('0x0'));var util=require(_0xcd59('0x1'));var logger=require(_0xcd59('0x2'))(_0xcd59('0x3'));var moment=require(_0xcd59('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcd59('0x5'));var attributes=require('./squareOdbc.attributes');module[_0xcd59('0x6')]=function(_0x414482,_0x1ca4d2){return _0x414482[_0xcd59('0x7')](_0xcd59('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfe6=['util','../../config/logger','moment','request-promise','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x14f3f4,_0x33e4cc){var _0x14931c=function(_0x2bd570){while(--_0x2bd570){_0x14f3f4['push'](_0x14f3f4['shift']());}};_0x14931c(++_0x33e4cc);}(_0xbfe6,0x112));var _0x6bfe=function(_0x4940c4,_0x44bf9e){_0x4940c4=_0x4940c4-0x0;var _0x1f8347=_0xbfe6[_0x4940c4];return _0x1f8347;};'use strict';var _=require(_0x6bfe('0x0'));var util=require(_0x6bfe('0x1'));var logger=require(_0x6bfe('0x2'))('api');var moment=require(_0x6bfe('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bfe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6bfe('0x5'));var attributes=require(_0x6bfe('0x6'));module[_0x6bfe('0x7')]=function(_0x7cf64c,_0x4587f5){return _0x7cf64c[_0x6bfe('0x8')](_0x6bfe('0x9'),attributes,{'tableName':_0x6bfe('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 246b370..cdf8a2f 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 _0x1b2f=['find','options','raw','where','include','map','model','ShowSquareOdbc','debug','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc'];(function(_0x2cd91f,_0x343632){var _0x24a06a=function(_0x5e68d3){while(--_0x5e68d3){_0x2cd91f['push'](_0x2cd91f['shift']());}};_0x24a06a(++_0x343632);}(_0x1b2f,0xa4));var _0xf1b2=function(_0x40858c,_0x4fdd5f){_0x40858c=_0x40858c-0x0;var _0x50aec1=_0x1b2f[_0x40858c];return _0x50aec1;};'use strict';var _=require('lodash');var util=require(_0xf1b2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf1b2('0x1'));var fs=require('fs');var Redis=require(_0xf1b2('0x2'));var db=require(_0xf1b2('0x3'))['db'];var utils=require(_0xf1b2('0x4'));var logger=require(_0xf1b2('0x5'))(_0xf1b2('0x6'));var config=require(_0xf1b2('0x7'));var jayson=require(_0xf1b2('0x8'));var client=jayson[_0xf1b2('0x9')][_0xf1b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16f0c8,_0x3dfd73,_0x349cfe){return new BPromise(function(_0x3c4d11,_0x435f8b){return client[_0xf1b2('0xb')](_0x16f0c8,_0x349cfe)['then'](function(_0x566fc1){logger[_0xf1b2('0xc')](_0xf1b2('0xd'),_0x3dfd73,'request\x20sent');logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3dfd73,_0xf1b2('0xe'),JSON[_0xf1b2('0xf')](_0x566fc1));if(_0x566fc1[_0xf1b2('0x10')]){if(_0x566fc1[_0xf1b2('0x10')][_0xf1b2('0x11')]===0x1f4){logger[_0xf1b2('0x10')](_0xf1b2('0xd'),_0x3dfd73,_0x566fc1['error'][_0xf1b2('0x12')]);return _0x435f8b(_0x566fc1[_0xf1b2('0x10')]['message']);}logger[_0xf1b2('0x10')](_0xf1b2('0xd'),_0x3dfd73,_0x566fc1['error'][_0xf1b2('0x12')]);return _0x3c4d11(_0x566fc1[_0xf1b2('0x10')][_0xf1b2('0x12')]);}else{logger[_0xf1b2('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x3dfd73,_0xf1b2('0xe'));_0x3c4d11(_0x566fc1[_0xf1b2('0x13')][_0xf1b2('0x12')]);}})[_0xf1b2('0x14')](function(_0x53335f){logger[_0xf1b2('0x10')](_0xf1b2('0xd'),_0x3dfd73,_0x53335f);_0x435f8b(_0x53335f);});});}exports['ShowSquareOdbc']=function(_0x2159fa){var _0x1d0a95=this;return new Promise(function(_0x3994ae,_0x5a1d52){return db[_0xf1b2('0x15')][_0xf1b2('0x16')]({'raw':_0x2159fa['options']?_0x2159fa[_0xf1b2('0x17')][_0xf1b2('0x18')]===undefined?!![]:![]:!![],'where':_0x2159fa[_0xf1b2('0x17')]?_0x2159fa[_0xf1b2('0x17')][_0xf1b2('0x19')]||null:null,'attributes':_0x2159fa[_0xf1b2('0x17')]?_0x2159fa[_0xf1b2('0x17')]['attributes']||null:null,'include':_0x2159fa[_0xf1b2('0x17')]?_0x2159fa[_0xf1b2('0x17')][_0xf1b2('0x1a')]?_[_0xf1b2('0x1b')](_0x2159fa[_0xf1b2('0x17')][_0xf1b2('0x1a')],function(_0x24da7){return{'model':db[_0x24da7['model']],'as':_0x24da7['as'],'attributes':_0x24da7['attributes'],'include':_0x24da7[_0xf1b2('0x1a')]?_['map'](_0x24da7[_0xf1b2('0x1a')],function(_0x1398fe){return{'model':db[_0x1398fe['model']],'as':_0x1398fe['as'],'attributes':_0x1398fe['attributes'],'include':_0x1398fe[_0xf1b2('0x1a')]?_[_0xf1b2('0x1b')](_0x1398fe[_0xf1b2('0x1a')],function(_0x45af76){return{'model':db[_0x45af76[_0xf1b2('0x1c')]],'as':_0x45af76['as'],'attributes':_0x45af76['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bfd0e){logger['info'](_0xf1b2('0x1d'),_0x2159fa);logger[_0xf1b2('0x1e')](_0xf1b2('0x1d'),_0x2159fa,JSON[_0xf1b2('0xf')](_0x1bfd0e));_0x3994ae(_0x1bfd0e);})[_0xf1b2('0x14')](function(_0x140a74){logger[_0xf1b2('0x10')](_0xf1b2('0x1d'),_0x140a74['message'],_0x2159fa);_0x5a1d52(_0x1d0a95[_0xf1b2('0x10')](0x1f4,_0x140a74['message']));});});}; \ No newline at end of file +var _0x7c4c=['include','map','model','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','raw','options','where','attributes'];(function(_0xe87fcb,_0x290f06){var _0x38f676=function(_0x314a86){while(--_0x314a86){_0xe87fcb['push'](_0xe87fcb['shift']());}};_0x38f676(++_0x290f06);}(_0x7c4c,0x1bd));var _0xc7c4=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x7c4c[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require('lodash');var util=require(_0xc7c4('0x0'));var moment=require(_0xc7c4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7c4('0x2'));var db=require(_0xc7c4('0x3'))['db'];var utils=require(_0xc7c4('0x4'));var logger=require(_0xc7c4('0x5'))(_0xc7c4('0x6'));var config=require(_0xc7c4('0x7'));var jayson=require(_0xc7c4('0x8'));var client=jayson[_0xc7c4('0x9')][_0xc7c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55fa73,_0x3e0160,_0x5441b2){return new BPromise(function(_0x8b417,_0x47bd46){return client[_0xc7c4('0xb')](_0x55fa73,_0x5441b2)[_0xc7c4('0xc')](function(_0x26adf1){logger[_0xc7c4('0xd')](_0xc7c4('0xe'),_0x3e0160,_0xc7c4('0xf'));logger[_0xc7c4('0x10')](_0xc7c4('0x11'),_0x3e0160,_0xc7c4('0xf'),JSON[_0xc7c4('0x12')](_0x26adf1));if(_0x26adf1[_0xc7c4('0x13')]){if(_0x26adf1[_0xc7c4('0x13')][_0xc7c4('0x14')]===0x1f4){logger[_0xc7c4('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x3e0160,_0x26adf1['error'][_0xc7c4('0x15')]);return _0x47bd46(_0x26adf1['error']['message']);}logger[_0xc7c4('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x3e0160,_0x26adf1[_0xc7c4('0x13')][_0xc7c4('0x15')]);return _0x8b417(_0x26adf1[_0xc7c4('0x13')][_0xc7c4('0x15')]);}else{logger['info'](_0xc7c4('0xe'),_0x3e0160,_0xc7c4('0xf'));_0x8b417(_0x26adf1[_0xc7c4('0x16')][_0xc7c4('0x15')]);}})[_0xc7c4('0x17')](function(_0xbc62e9){logger[_0xc7c4('0x13')](_0xc7c4('0xe'),_0x3e0160,_0xbc62e9);_0x47bd46(_0xbc62e9);});});}exports[_0xc7c4('0x18')]=function(_0xc4b571){var _0x1137de=this;return new Promise(function(_0x43348e,_0x2f4a3c){return db[_0xc7c4('0x19')][_0xc7c4('0x1a')]({'raw':_0xc4b571['options']?_0xc4b571['options'][_0xc7c4('0x1b')]===undefined?!![]:![]:!![],'where':_0xc4b571['options']?_0xc4b571[_0xc7c4('0x1c')][_0xc7c4('0x1d')]||null:null,'attributes':_0xc4b571[_0xc7c4('0x1c')]?_0xc4b571['options'][_0xc7c4('0x1e')]||null:null,'include':_0xc4b571[_0xc7c4('0x1c')]?_0xc4b571[_0xc7c4('0x1c')][_0xc7c4('0x1f')]?_[_0xc7c4('0x20')](_0xc4b571['options'][_0xc7c4('0x1f')],function(_0x31f862){return{'model':db[_0x31f862[_0xc7c4('0x21')]],'as':_0x31f862['as'],'attributes':_0x31f862[_0xc7c4('0x1e')],'include':_0x31f862['include']?_[_0xc7c4('0x20')](_0x31f862[_0xc7c4('0x1f')],function(_0x22cd97){return{'model':db[_0x22cd97[_0xc7c4('0x21')]],'as':_0x22cd97['as'],'attributes':_0x22cd97[_0xc7c4('0x1e')],'include':_0x22cd97[_0xc7c4('0x1f')]?_[_0xc7c4('0x20')](_0x22cd97[_0xc7c4('0x1f')],function(_0x4875b7){return{'model':db[_0x4875b7[_0xc7c4('0x21')]],'as':_0x4875b7['as'],'attributes':_0x4875b7[_0xc7c4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc7c4('0xc')](function(_0x13e266){logger[_0xc7c4('0xd')](_0xc7c4('0x18'),_0xc4b571);logger[_0xc7c4('0x10')]('ShowSquareOdbc',_0xc4b571,JSON[_0xc7c4('0x12')](_0x13e266));_0x43348e(_0x13e266);})[_0xc7c4('0x17')](function(_0x5589ca){logger[_0xc7c4('0x13')]('ShowSquareOdbc',_0x5589ca[_0xc7c4('0x15')],_0xc4b571);_0x2f4a3c(_0x1137de[_0xc7c4('0x13')](0x1f4,_0x5589ca[_0xc7c4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f360c6b..a615574 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 _0x21ad=['get','isAuthenticated','/:id','/:id/users','getUsers','post','create','addUsers','put','update','destroy','delete','removeUsers','multer','path','connect-timeout','express','fs-extra','../../config/environment','./squareProject.controller'];(function(_0x2e7553,_0x39f65b){var _0x3d1ddf=function(_0x49b1a0){while(--_0x49b1a0){_0x2e7553['push'](_0x2e7553['shift']());}};_0x3d1ddf(++_0x39f65b);}(_0x21ad,0x85));var _0xd21a=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x21ad[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xd21a('0x0'));var util=require('util');var path=require(_0xd21a('0x1'));var timeout=require(_0xd21a('0x2'));var express=require(_0xd21a('0x3'));var router=express['Router']();var fs_extra=require(_0xd21a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd21a('0x5'));var controller=require(_0xd21a('0x6'));router[_0xd21a('0x7')]('/',auth[_0xd21a('0x8')](),controller['index']);router[_0xd21a('0x7')](_0xd21a('0x9'),auth[_0xd21a('0x8')](),controller['show']);router[_0xd21a('0x7')](_0xd21a('0xa'),auth['isAuthenticated'](),controller[_0xd21a('0xb')]);router[_0xd21a('0xc')]('/',auth['isAuthenticated'](),controller[_0xd21a('0xd')]);router[_0xd21a('0xc')](_0xd21a('0xa'),auth[_0xd21a('0x8')](),controller[_0xd21a('0xe')]);router[_0xd21a('0xf')]('/:id',auth[_0xd21a('0x8')](),controller[_0xd21a('0x10')]);router['delete'](_0xd21a('0x9'),auth[_0xd21a('0x8')](),controller[_0xd21a('0x11')]);router[_0xd21a('0x12')](_0xd21a('0xa'),auth[_0xd21a('0x8')](),controller[_0xd21a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x96f2=['fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','/:id','isAuthenticated','show','/:id/users','getUsers','post','put','update','destroy','delete','exports','multer','path','connect-timeout','express'];(function(_0x3e50bd,_0x47b16f){var _0x18866=function(_0xa90213){while(--_0xa90213){_0x3e50bd['push'](_0x3e50bd['shift']());}};_0x18866(++_0x47b16f);}(_0x96f2,0xb0));var _0x296f=function(_0x956cb,_0x4f0365){_0x956cb=_0x956cb-0x0;var _0x49954a=_0x96f2[_0x956cb];return _0x49954a;};'use strict';var multer=require(_0x296f('0x0'));var util=require('util');var path=require(_0x296f('0x1'));var timeout=require(_0x296f('0x2'));var express=require(_0x296f('0x3'));var router=express['Router']();var fs_extra=require(_0x296f('0x4'));var auth=require(_0x296f('0x5'));var interaction=require(_0x296f('0x6'));var config=require('../../config/environment');var controller=require(_0x296f('0x7'));router[_0x296f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x296f('0x8')](_0x296f('0x9'),auth[_0x296f('0xa')](),controller[_0x296f('0xb')]);router[_0x296f('0x8')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller[_0x296f('0xd')]);router[_0x296f('0xe')]('/',auth[_0x296f('0xa')](),controller['create']);router[_0x296f('0xe')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller['addUsers']);router[_0x296f('0xf')](_0x296f('0x9'),auth[_0x296f('0xa')](),controller[_0x296f('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x296f('0x11')]);router[_0x296f('0x12')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller['removeUsers']);module[_0x296f('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 48f7c20..f1870d9 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 _0x292c=['preproduction','toString','utf8','long','production','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x292c,0x66));var _0xc292=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x292c[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0xc292('0x0'));module['exports']={'name':{'type':Sequelize[_0xc292('0x1')],'unique':_0xc292('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc292('0x1')]},'notes':{'type':Sequelize[_0xc292('0x3')]},'preproduction':{'type':Sequelize[_0xc292('0x4')]('long'),'get':function(){if(this[_0xc292('0x5')]('preproduction')){return this['getDataValue'](_0xc292('0x6'))[_0xc292('0x7')](_0xc292('0x8'));}}},'production':{'type':Sequelize[_0xc292('0x4')](_0xc292('0x9')),'get':function(){if(this[_0xc292('0x5')](_0xc292('0xa'))){return this[_0xc292('0x5')](_0xc292('0xa'))[_0xc292('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0xc292('0xb')]},'publishedAt':{'type':Sequelize[_0xc292('0xb')]}}; \ No newline at end of file +var _0xdfdb=['production','DATE','sequelize','STRING','BLOB','long','preproduction','getDataValue','toString'];(function(_0x273c0a,_0x25e14c){var _0x3b67eb=function(_0x1230b7){while(--_0x1230b7){_0x273c0a['push'](_0x273c0a['shift']());}};_0x3b67eb(++_0x25e14c);}(_0xdfdb,0xa4));var _0xbdfd=function(_0x1712d2,_0x493af7){_0x1712d2=_0x1712d2-0x0;var _0x4538d6=_0xdfdb[_0x1712d2];return _0x4538d6;};'use strict';var Sequelize=require(_0xbdfd('0x0'));module['exports']={'name':{'type':Sequelize[_0xbdfd('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbdfd('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xbdfd('0x2')](_0xbdfd('0x3')),'get':function(){if(this['getDataValue'](_0xbdfd('0x4'))){return this[_0xbdfd('0x5')](_0xbdfd('0x4'))[_0xbdfd('0x6')]('utf8');}}},'production':{'type':Sequelize[_0xbdfd('0x2')](_0xbdfd('0x3')),'get':function(){if(this[_0xbdfd('0x5')](_0xbdfd('0x7'))){return this[_0xbdfd('0x5')](_0xbdfd('0x7'))[_0xbdfd('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0xbdfd('0x8')]},'publishedAt':{'type':Sequelize[_0xbdfd('0x8')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 3608ca3..6a48598 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 _0x929e=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareProject','findAll','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','find','addUsers','params','ids','omit','removeUsers','isArray','userSquareProject:remove','getUsers','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','name','map','rawAttributes','fieldName','type','model','query','keys'];(function(_0xddfa28,_0x34962d){var _0x4f10ae=function(_0x417785){while(--_0x417785){_0xddfa28['push'](_0xddfa28['shift']());}};_0x4f10ae(++_0x34962d);}(_0x929e,0xe5));var _0xe929=function(_0x16cb4c,_0x2144c9){_0x16cb4c=_0x16cb4c-0x0;var _0x3ea5d7=_0x929e[_0x16cb4c];return _0x3ea5d7;};'use strict';var emlformat=require(_0xe929('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe929('0x1'));var jsonpatch=require(_0xe929('0x2'));var rp=require(_0xe929('0x3'));var moment=require(_0xe929('0x4'));var BPromise=require(_0xe929('0x5'));var Mustache=require('mustache');var util=require(_0xe929('0x6'));var path=require(_0xe929('0x7'));var sox=require(_0xe929('0x8'));var csv=require(_0xe929('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe929('0xa'));var _=require(_0xe929('0xb'));var squel=require(_0xe929('0xc'));var crypto=require(_0xe929('0xd'));var jsforce=require(_0xe929('0xe'));var deskjs=require(_0xe929('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe929('0x10'));var Redis=require('ioredis');var authService=require(_0xe929('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe929('0x12'));var hardwareService=require(_0xe929('0x13'));var logger=require('../../config/logger')(_0xe929('0x14'));var utils=require(_0xe929('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe929('0x16'))['db'];config[_0xe929('0x17')]=_['defaults'](config[_0xe929('0x17')],{'host':_0xe929('0x18'),'port':0x18eb});var socket=require(_0xe929('0x19'))(new Redis(config['redis']));require(_0xe929('0x1a'))[_0xe929('0x1b')](socket);function respondWithStatusCode(_0x523d89,_0x1d7c8d){_0x1d7c8d=_0x1d7c8d||0xcc;return function(_0x1ba836){if(_0x1ba836){return _0x523d89[_0xe929('0x1c')](_0x1d7c8d);}return _0x523d89[_0xe929('0x1d')](_0x1d7c8d)[_0xe929('0x1e')]();};}function respondWithResult(_0x17bb0c,_0x225ace){_0x225ace=_0x225ace||0xc8;return function(_0x339188){if(_0x339188){return _0x17bb0c['status'](_0x225ace)[_0xe929('0x1f')](_0x339188);}};}function respondWithFilteredResult(_0x272b92,_0x79224d){return function(_0x4a5a94){if(_0x4a5a94){var _0x33d847=typeof _0x79224d[_0xe929('0x20')]===_0xe929('0x21')&&typeof _0x79224d['limit']===_0xe929('0x21');var _0x5551bc=_0x4a5a94[_0xe929('0x22')];var _0x2e93f6=_0x33d847?0x0:_0x79224d['offset'];var _0x50d5df=_0x33d847?_0x4a5a94[_0xe929('0x22')]:_0x79224d['offset']+_0x79224d[_0xe929('0x23')];var _0x1eddb6;if(_0x50d5df>=_0x5551bc){_0x50d5df=_0x5551bc;_0x1eddb6=0xc8;}else{_0x1eddb6=0xce;}_0x272b92['status'](_0x1eddb6);return _0x272b92['set'](_0xe929('0x24'),_0x2e93f6+'-'+_0x50d5df+'/'+_0x5551bc)[_0xe929('0x1f')](_0x4a5a94);}return null;};}function patchUpdates(_0x38c894){return function(_0x59e60d){try{jsonpatch[_0xe929('0x25')](_0x59e60d,_0x38c894,!![]);}catch(_0x446999){return BPromise[_0xe929('0x26')](_0x446999);}return _0x59e60d[_0xe929('0x27')]();};}function saveUpdates(_0x2e2137,_0x22de73){return function(_0x5f062f){if(_0x5f062f){return _0x5f062f[_0xe929('0x28')](_0x2e2137)[_0xe929('0x29')](function(_0x4a87ef){return _0x4a87ef;});}return null;};}function removeEntity(_0x3f30eb,_0x4b62f8){return function(_0x2279d1){if(_0x2279d1){return _0x2279d1[_0xe929('0x2a')]()[_0xe929('0x29')](function(){var _0x1b00cf=_0x2279d1[_0xe929('0x2b')]({'plain':!![]});var _0x712c15=_0xe929('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x712c15,'resourceId':_0x1b00cf['id']}})['then'](function(){return _0x2279d1;});})[_0xe929('0x29')](function(){_0x3f30eb[_0xe929('0x1d')](0xcc)[_0xe929('0x1e')]();});}};}function handleEntityNotFound(_0x3c0f6b,_0xc84241){return function(_0x498667){if(!_0x498667){_0x3c0f6b[_0xe929('0x1c')](0x194);}return _0x498667;};}function handleError(_0x4bb089,_0xc8a3d4){_0xc8a3d4=_0xc8a3d4||0x1f4;return function(_0x4f5c55){logger['error'](_0x4f5c55['stack']);if(_0x4f5c55[_0xe929('0x2d')]){delete _0x4f5c55[_0xe929('0x2d')];}_0x4bb089[_0xe929('0x1d')](_0xc8a3d4)['send'](_0x4f5c55);};}exports['index']=function(_0x2251a7,_0x46f6e2){var _0x36315f={},_0x488f76={},_0x464a77={'count':0x0,'rows':[]};var _0xab5203=_[_0xe929('0x2e')](db['SquareProject'][_0xe929('0x2f')],function(_0xaafbae){return{'name':_0xaafbae[_0xe929('0x30')],'type':_0xaafbae[_0xe929('0x31')]['key']};});_0x488f76[_0xe929('0x32')]=_[_0xe929('0x2e')](_0xab5203,_0xe929('0x2d'));_0x488f76[_0xe929('0x33')]=_[_0xe929('0x34')](_0x2251a7[_0xe929('0x33')]);_0x488f76[_0xe929('0x35')]=_[_0xe929('0x36')](_0x488f76[_0xe929('0x32')],_0x488f76['query']);_0x36315f['attributes']=_[_0xe929('0x36')](_0x488f76['model'],qs[_0xe929('0x37')](_0x2251a7[_0xe929('0x33')][_0xe929('0x37')]));_0x36315f[_0xe929('0x38')]=_0x36315f[_0xe929('0x38')][_0xe929('0x39')]?_0x36315f['attributes']:_0x488f76[_0xe929('0x32')];if(!_0x2251a7['query'][_0xe929('0x3a')](_0xe929('0x3b'))){_0x36315f[_0xe929('0x23')]=qs['limit'](_0x2251a7[_0xe929('0x33')][_0xe929('0x23')]);_0x36315f[_0xe929('0x20')]=qs[_0xe929('0x20')](_0x2251a7[_0xe929('0x33')][_0xe929('0x20')]);}_0x36315f[_0xe929('0x3c')]=qs[_0xe929('0x3d')](_0x2251a7[_0xe929('0x33')][_0xe929('0x3d')]);_0x36315f[_0xe929('0x3e')]=qs[_0xe929('0x35')](_[_0xe929('0x3f')](_0x2251a7[_0xe929('0x33')],_0x488f76[_0xe929('0x35')]),_0xab5203);if(_0x2251a7['query']['filter']){_0x36315f[_0xe929('0x3e')]=_[_0xe929('0x40')](_0x36315f[_0xe929('0x3e')],{'$or':_[_0xe929('0x2e')](_0xab5203,function(_0x212964){if(_0x212964[_0xe929('0x31')]!==_0xe929('0x41')){var _0x34e865={};_0x34e865[_0x212964['name']]={'$like':'%'+_0x2251a7[_0xe929('0x33')][_0xe929('0x42')]+'%'};return _0x34e865;}})});}_0x36315f=_[_0xe929('0x40')]({},_0x36315f,_0x2251a7[_0xe929('0x43')]);var _0x132032={'where':_0x36315f[_0xe929('0x3e')]};return db[_0xe929('0x44')]['count'](_0x132032)[_0xe929('0x29')](function(_0x1ac8f3){_0x464a77['count']=_0x1ac8f3;if(_0x2251a7[_0xe929('0x33')]['includeAll']){_0x36315f['include']=[{'all':!![]}];}return db[_0xe929('0x44')][_0xe929('0x45')](_0x36315f);})['then'](function(_0x1a5f2e){_0x464a77[_0xe929('0x46')]=_0x1a5f2e;return _0x464a77;})[_0xe929('0x29')](respondWithFilteredResult(_0x46f6e2,_0x36315f))[_0xe929('0x47')](handleError(_0x46f6e2,null));};exports[_0xe929('0x48')]=function(_0x47bf9e,_0x43f163){var _0x3f4d40={'raw':![],'where':{'id':_0x47bf9e['params']['id']}},_0x32ef86={};_0x32ef86[_0xe929('0x32')]=_[_0xe929('0x34')](db['SquareProject'][_0xe929('0x2f')]);_0x32ef86[_0xe929('0x33')]=_[_0xe929('0x34')](_0x47bf9e[_0xe929('0x33')]);_0x32ef86[_0xe929('0x35')]=_[_0xe929('0x36')](_0x32ef86[_0xe929('0x32')],_0x32ef86[_0xe929('0x33')]);_0x3f4d40[_0xe929('0x38')]=_[_0xe929('0x36')](_0x32ef86[_0xe929('0x32')],qs[_0xe929('0x37')](_0x47bf9e[_0xe929('0x33')][_0xe929('0x37')]));_0x3f4d40[_0xe929('0x38')]=_0x3f4d40[_0xe929('0x38')][_0xe929('0x39')]?_0x3f4d40[_0xe929('0x38')]:_0x32ef86[_0xe929('0x32')];if(_0x47bf9e['query'][_0xe929('0x49')]){_0x3f4d40['include']=[{'all':!![]}];}_0x3f4d40=_['merge']({},_0x3f4d40,_0x47bf9e[_0xe929('0x43')]);return db['SquareProject']['find'](_0x3f4d40)[_0xe929('0x29')](handleEntityNotFound(_0x43f163,null))[_0xe929('0x29')](respondWithResult(_0x43f163,null))[_0xe929('0x47')](handleError(_0x43f163,null));};exports[_0xe929('0x4a')]=function(_0x434cb8,_0x19652d){return db[_0xe929('0x44')][_0xe929('0x4a')](_0x434cb8[_0xe929('0x4b')],{})['then'](function(_0x452bbc){var _0x282863=_0x434cb8[_0xe929('0x4c')]['get']({'plain':!![]});if(!_0x282863)throw new Error(_0xe929('0x4d'));if(_0x282863[_0xe929('0x4e')]==='user'){var _0xeb2ae9=_0x452bbc[_0xe929('0x2b')]({'plain':!![]});var _0x1e9083=_0xe929('0x2c');return db[_0xe929('0x4f')]['find']({'where':{'name':_0x1e9083,'userProfileId':_0x282863[_0xe929('0x50')]},'raw':!![]})[_0xe929('0x29')](function(_0x5b73ec){if(_0x5b73ec&&_0x5b73ec[_0xe929('0x51')]===0x0){return db[_0xe929('0x52')][_0xe929('0x4a')]({'name':_0xeb2ae9[_0xe929('0x2d')],'resourceId':_0xeb2ae9['id'],'type':_0x5b73ec[_0xe929('0x2d')],'sectionId':_0x5b73ec['id']},{})[_0xe929('0x29')](function(){return _0x452bbc;});}else{return _0x452bbc;}})['catch'](function(_0x3d4c73){logger[_0xe929('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d4c73);throw _0x3d4c73;});}return _0x452bbc;})[_0xe929('0x29')](respondWithResult(_0x19652d,0xc9))[_0xe929('0x47')](handleError(_0x19652d,null));};exports[_0xe929('0x28')]=function(_0x1ecddc,_0x570510){if(_0x1ecddc['body']['id']){delete _0x1ecddc[_0xe929('0x4b')]['id'];}return db[_0xe929('0x44')][_0xe929('0x54')]({'where':{'id':_0x1ecddc['params']['id']}})[_0xe929('0x29')](handleEntityNotFound(_0x570510,null))[_0xe929('0x29')](saveUpdates(_0x1ecddc['body'],null))[_0xe929('0x29')](respondWithResult(_0x570510,null))[_0xe929('0x47')](handleError(_0x570510,null));};exports[_0xe929('0x2a')]=function(_0xd6a5ba,_0x28aca2){return db[_0xe929('0x44')][_0xe929('0x54')]({'where':{'id':_0xd6a5ba['params']['id']}})[_0xe929('0x29')](handleEntityNotFound(_0x28aca2,null))[_0xe929('0x29')](removeEntity(_0x28aca2,null))[_0xe929('0x47')](handleError(_0x28aca2,null));};exports[_0xe929('0x55')]=function(_0xc61035,_0x1feda8,_0x9409ed){return db[_0xe929('0x44')][_0xe929('0x54')]({'where':{'id':_0xc61035[_0xe929('0x56')]['id']}})[_0xe929('0x29')](handleEntityNotFound(_0x1feda8,null))['then'](function(_0x2a0c3d){if(_0x2a0c3d){return _0x2a0c3d['addUsers'](_0xc61035[_0xe929('0x4b')][_0xe929('0x57')],_[_0xe929('0x58')](_0xc61035[_0xe929('0x4b')],[_0xe929('0x57'),'id'])||{});}})['then'](respondWithResult(_0x1feda8,null))['catch'](handleError(_0x1feda8,null));};exports[_0xe929('0x59')]=function(_0x58b568,_0x38bfb2,_0x12581c){return db[_0xe929('0x44')]['find']({'where':{'id':_0x58b568[_0xe929('0x56')]['id']}})[_0xe929('0x29')](handleEntityNotFound(_0x38bfb2,null))['then'](function(_0x45e35a){if(_0x45e35a){return _0x45e35a['removeUsers'](_0x58b568['query'][_0xe929('0x57')])[_0xe929('0x29')](function(){if(_[_0xe929('0x5a')](_0x58b568[_0xe929('0x33')][_0xe929('0x57')])){for(var _0x1abd10=0x0;_0x1abd10<_0x58b568[_0xe929('0x33')][_0xe929('0x57')][_0xe929('0x39')];_0x1abd10+=0x1){socket['emit'](_0xe929('0x5b'),{'UserId':Number(_0x58b568['query']['ids'][_0x1abd10]),'SquareProjectId':Number(_0x58b568['params']['id'])});}}else{socket['emit'](_0xe929('0x5b'),{'UserId':Number(_0x58b568['query'][_0xe929('0x57')]),'SquareProjectId':Number(_0x58b568[_0xe929('0x56')]['id'])});}});}})[_0xe929('0x29')](respondWithStatusCode(_0x38bfb2,null))[_0xe929('0x47')](handleError(_0x38bfb2,null));};exports[_0xe929('0x5c')]=function(_0x4c0cc9,_0x3a509e,_0x42c686){var _0x2d2139={};var _0x23fda3={};var _0x104d7a;var _0xe55bd7;return db[_0xe929('0x44')]['findOne']({'where':{'id':_0x4c0cc9[_0xe929('0x56')]['id']}})[_0xe929('0x29')](handleEntityNotFound(_0x3a509e,null))[_0xe929('0x29')](function(_0x466975){if(_0x466975){_0x104d7a=_0x466975;_0x23fda3[_0xe929('0x32')]=_[_0xe929('0x34')](db[_0xe929('0x5d')]['rawAttributes']);_0x23fda3[_0xe929('0x33')]=_[_0xe929('0x34')](_0x4c0cc9[_0xe929('0x33')]);_0x23fda3['filters']=_[_0xe929('0x36')](_0x23fda3[_0xe929('0x32')],_0x23fda3[_0xe929('0x33')]);_0x2d2139[_0xe929('0x38')]=_[_0xe929('0x36')](_0x23fda3[_0xe929('0x32')],qs[_0xe929('0x37')](_0x4c0cc9[_0xe929('0x33')][_0xe929('0x37')]));_0x2d2139[_0xe929('0x38')]=_0x2d2139[_0xe929('0x38')][_0xe929('0x39')]?_0x2d2139['attributes']:_0x23fda3[_0xe929('0x32')];_0x2d2139[_0xe929('0x3c')]=qs[_0xe929('0x3d')](_0x4c0cc9[_0xe929('0x33')][_0xe929('0x3d')]);_0x2d2139[_0xe929('0x3e')]=qs['filters'](_[_0xe929('0x3f')](_0x4c0cc9[_0xe929('0x33')],_0x23fda3['filters']));if(_0x4c0cc9['query']['filter']){_0x2d2139[_0xe929('0x3e')]=_[_0xe929('0x40')](_0x2d2139[_0xe929('0x3e')],{'$or':_[_0xe929('0x2e')](_0x2d2139[_0xe929('0x38')],function(_0x5234f0){var _0x3e1d6c={};_0x3e1d6c[_0x5234f0]={'$like':'%'+_0x4c0cc9[_0xe929('0x33')]['filter']+'%'};return _0x3e1d6c;})});}_0x2d2139=_[_0xe929('0x40')]({},_0x2d2139,_0x4c0cc9[_0xe929('0x43')]);return _0x104d7a[_0xe929('0x5c')](_0x2d2139);}})[_0xe929('0x29')](function(_0x382b5f){if(_0x382b5f){_0xe55bd7=_0x382b5f[_0xe929('0x39')];if(!_0x4c0cc9[_0xe929('0x33')][_0xe929('0x3a')](_0xe929('0x3b'))){_0x2d2139[_0xe929('0x23')]=qs[_0xe929('0x23')](_0x4c0cc9[_0xe929('0x33')]['limit']);_0x2d2139['offset']=qs[_0xe929('0x20')](_0x4c0cc9[_0xe929('0x33')][_0xe929('0x20')]);}return _0x104d7a[_0xe929('0x5c')](_0x2d2139);}})[_0xe929('0x29')](function(_0x1926a6){if(_0x1926a6){return _0x1926a6?{'count':_0xe55bd7,'rows':_0x1926a6}:null;}})[_0xe929('0x29')](respondWithResult(_0x3a509e,null))[_0xe929('0x47')](handleError(_0x3a509e,null));}; \ No newline at end of file +var _0x5be6=['count','set','Content-Range','apply','reject','update','then','destroy','SquareProjects','error','stack','name','send','index','map','SquareProject','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','findOne','User','pick','options','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5be6,0x164));var _0x65be=function(_0xc0cee7,_0x13b9fd){_0xc0cee7=_0xc0cee7-0x0;var _0x5d8b3c=_0x5be6[_0xc0cee7];return _0x5d8b3c;};'use strict';var emlformat=require(_0x65be('0x0'));var rimraf=require(_0x65be('0x1'));var zipdir=require(_0x65be('0x2'));var jsonpatch=require(_0x65be('0x3'));var rp=require('request-promise');var moment=require(_0x65be('0x4'));var BPromise=require(_0x65be('0x5'));var Mustache=require('mustache');var util=require(_0x65be('0x6'));var path=require(_0x65be('0x7'));var sox=require(_0x65be('0x8'));var csv=require(_0x65be('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65be('0xa'));var _=require(_0x65be('0xb'));var squel=require('squel');var crypto=require(_0x65be('0xc'));var jsforce=require(_0x65be('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x65be('0x9'));var querystring=require(_0x65be('0xe'));var Papa=require('papaparse');var Redis=require(_0x65be('0xf'));var authService=require(_0x65be('0x10'));var qs=require(_0x65be('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65be('0x12'));var logger=require(_0x65be('0x13'))('api');var utils=require(_0x65be('0x14'));var config=require(_0x65be('0x15'));var licenseUtil=require(_0x65be('0x16'));var db=require('../../mysqldb')['db'];config[_0x65be('0x17')]=_[_0x65be('0x18')](config[_0x65be('0x17')],{'host':_0x65be('0x19'),'port':0x18eb});var socket=require(_0x65be('0x1a'))(new Redis(config[_0x65be('0x17')]));require(_0x65be('0x1b'))[_0x65be('0x1c')](socket);function respondWithStatusCode(_0x58be1d,_0x5e2f24){_0x5e2f24=_0x5e2f24||0xcc;return function(_0x10cf90){if(_0x10cf90){return _0x58be1d[_0x65be('0x1d')](_0x5e2f24);}return _0x58be1d[_0x65be('0x1e')](_0x5e2f24)[_0x65be('0x1f')]();};}function respondWithResult(_0x31845b,_0x25a502){_0x25a502=_0x25a502||0xc8;return function(_0x18a03c){if(_0x18a03c){return _0x31845b[_0x65be('0x1e')](_0x25a502)[_0x65be('0x20')](_0x18a03c);}};}function respondWithFilteredResult(_0x26bbb5,_0x3e9fe1){return function(_0x1c4c48){if(_0x1c4c48){var _0x1e9357=typeof _0x3e9fe1[_0x65be('0x21')]===_0x65be('0x22')&&typeof _0x3e9fe1[_0x65be('0x23')]===_0x65be('0x22');var _0x2c728d=_0x1c4c48['count'];var _0x88346f=_0x1e9357?0x0:_0x3e9fe1['offset'];var _0x4b4d9d=_0x1e9357?_0x1c4c48[_0x65be('0x24')]:_0x3e9fe1[_0x65be('0x21')]+_0x3e9fe1[_0x65be('0x23')];var _0x534915;if(_0x4b4d9d>=_0x2c728d){_0x4b4d9d=_0x2c728d;_0x534915=0xc8;}else{_0x534915=0xce;}_0x26bbb5['status'](_0x534915);return _0x26bbb5[_0x65be('0x25')](_0x65be('0x26'),_0x88346f+'-'+_0x4b4d9d+'/'+_0x2c728d)[_0x65be('0x20')](_0x1c4c48);}return null;};}function patchUpdates(_0x3c474d){return function(_0x11dd9a){try{jsonpatch[_0x65be('0x27')](_0x11dd9a,_0x3c474d,!![]);}catch(_0x49c50e){return BPromise[_0x65be('0x28')](_0x49c50e);}return _0x11dd9a['save']();};}function saveUpdates(_0x1cfe59,_0x391077){return function(_0x4c1ec1){if(_0x4c1ec1){return _0x4c1ec1[_0x65be('0x29')](_0x1cfe59)[_0x65be('0x2a')](function(_0x4837e1){return _0x4837e1;});}return null;};}function removeEntity(_0x4c8002,_0x7f9cc){return function(_0x1b7a95){if(_0x1b7a95){return _0x1b7a95[_0x65be('0x2b')]()[_0x65be('0x2a')](function(){var _0x3d01fb=_0x1b7a95['get']({'plain':!![]});var _0x5fcf5b=_0x65be('0x2c');return db['UserProfileResource'][_0x65be('0x2b')]({'where':{'type':_0x5fcf5b,'resourceId':_0x3d01fb['id']}})['then'](function(){return _0x1b7a95;});})[_0x65be('0x2a')](function(){_0x4c8002['status'](0xcc)[_0x65be('0x1f')]();});}};}function handleEntityNotFound(_0x2db2a4,_0x5c0954){return function(_0x59d549){if(!_0x59d549){_0x2db2a4['sendStatus'](0x194);}return _0x59d549;};}function handleError(_0x3d4215,_0x40ffc5){_0x40ffc5=_0x40ffc5||0x1f4;return function(_0x5a3d9d){logger[_0x65be('0x2d')](_0x5a3d9d[_0x65be('0x2e')]);if(_0x5a3d9d[_0x65be('0x2f')]){delete _0x5a3d9d['name'];}_0x3d4215['status'](_0x40ffc5)[_0x65be('0x30')](_0x5a3d9d);};}exports[_0x65be('0x31')]=function(_0x54d25c,_0x22387c){var _0x210a96={},_0x4ef4e6={},_0x566456={'count':0x0,'rows':[]};var _0x332807=_[_0x65be('0x32')](db[_0x65be('0x33')]['rawAttributes'],function(_0x6c4add){return{'name':_0x6c4add[_0x65be('0x34')],'type':_0x6c4add[_0x65be('0x35')]['key']};});_0x4ef4e6[_0x65be('0x36')]=_[_0x65be('0x32')](_0x332807,'name');_0x4ef4e6['query']=_['keys'](_0x54d25c['query']);_0x4ef4e6[_0x65be('0x37')]=_[_0x65be('0x38')](_0x4ef4e6['model'],_0x4ef4e6[_0x65be('0x39')]);_0x210a96[_0x65be('0x3a')]=_[_0x65be('0x38')](_0x4ef4e6[_0x65be('0x36')],qs[_0x65be('0x3b')](_0x54d25c[_0x65be('0x39')][_0x65be('0x3b')]));_0x210a96[_0x65be('0x3a')]=_0x210a96[_0x65be('0x3a')][_0x65be('0x3c')]?_0x210a96[_0x65be('0x3a')]:_0x4ef4e6['model'];if(!_0x54d25c[_0x65be('0x39')][_0x65be('0x3d')](_0x65be('0x3e'))){_0x210a96[_0x65be('0x23')]=qs['limit'](_0x54d25c[_0x65be('0x39')][_0x65be('0x23')]);_0x210a96['offset']=qs[_0x65be('0x21')](_0x54d25c[_0x65be('0x39')][_0x65be('0x21')]);}_0x210a96[_0x65be('0x3f')]=qs[_0x65be('0x40')](_0x54d25c['query']['sort']);_0x210a96[_0x65be('0x41')]=qs[_0x65be('0x37')](_['pick'](_0x54d25c['query'],_0x4ef4e6['filters']),_0x332807);if(_0x54d25c[_0x65be('0x39')][_0x65be('0x42')]){_0x210a96['where']=_[_0x65be('0x43')](_0x210a96[_0x65be('0x41')],{'$or':_[_0x65be('0x32')](_0x332807,function(_0x3a2884){if(_0x3a2884[_0x65be('0x35')]!=='VIRTUAL'){var _0x18f6be={};_0x18f6be[_0x3a2884[_0x65be('0x2f')]]={'$like':'%'+_0x54d25c[_0x65be('0x39')]['filter']+'%'};return _0x18f6be;}})});}_0x210a96=_[_0x65be('0x43')]({},_0x210a96,_0x54d25c['options']);var _0x424615={'where':_0x210a96[_0x65be('0x41')]};return db[_0x65be('0x33')][_0x65be('0x24')](_0x424615)[_0x65be('0x2a')](function(_0xf2a20b){_0x566456['count']=_0xf2a20b;if(_0x54d25c[_0x65be('0x39')][_0x65be('0x44')]){_0x210a96[_0x65be('0x45')]=[{'all':!![]}];}return db[_0x65be('0x33')]['findAll'](_0x210a96);})[_0x65be('0x2a')](function(_0x5c8e47){_0x566456[_0x65be('0x46')]=_0x5c8e47;return _0x566456;})['then'](respondWithFilteredResult(_0x22387c,_0x210a96))[_0x65be('0x47')](handleError(_0x22387c,null));};exports[_0x65be('0x48')]=function(_0x8673fe,_0x1aa98a){var _0x5dccb7={'raw':![],'where':{'id':_0x8673fe[_0x65be('0x49')]['id']}},_0x43b688={};_0x43b688[_0x65be('0x36')]=_[_0x65be('0x4a')](db[_0x65be('0x33')][_0x65be('0x4b')]);_0x43b688['query']=_[_0x65be('0x4a')](_0x8673fe[_0x65be('0x39')]);_0x43b688['filters']=_[_0x65be('0x38')](_0x43b688[_0x65be('0x36')],_0x43b688[_0x65be('0x39')]);_0x5dccb7['attributes']=_[_0x65be('0x38')](_0x43b688[_0x65be('0x36')],qs[_0x65be('0x3b')](_0x8673fe[_0x65be('0x39')][_0x65be('0x3b')]));_0x5dccb7[_0x65be('0x3a')]=_0x5dccb7[_0x65be('0x3a')]['length']?_0x5dccb7[_0x65be('0x3a')]:_0x43b688[_0x65be('0x36')];if(_0x8673fe['query'][_0x65be('0x44')]){_0x5dccb7[_0x65be('0x45')]=[{'all':!![]}];}_0x5dccb7=_[_0x65be('0x43')]({},_0x5dccb7,_0x8673fe['options']);return db[_0x65be('0x33')][_0x65be('0x4c')](_0x5dccb7)[_0x65be('0x2a')](handleEntityNotFound(_0x1aa98a,null))[_0x65be('0x2a')](respondWithResult(_0x1aa98a,null))['catch'](handleError(_0x1aa98a,null));};exports[_0x65be('0x4d')]=function(_0x625b35,_0x13d366){return db[_0x65be('0x33')]['create'](_0x625b35[_0x65be('0x4e')],{})[_0x65be('0x2a')](function(_0x3d1684){var _0x48b22d=_0x625b35[_0x65be('0x4f')][_0x65be('0x50')]({'plain':!![]});if(!_0x48b22d)throw new Error(_0x65be('0x51'));if(_0x48b22d[_0x65be('0x52')]===_0x65be('0x4f')){var _0x180b44=_0x3d1684[_0x65be('0x50')]({'plain':!![]});var _0x1782ec=_0x65be('0x2c');return db[_0x65be('0x53')]['find']({'where':{'name':_0x1782ec,'userProfileId':_0x48b22d[_0x65be('0x54')]},'raw':!![]})[_0x65be('0x2a')](function(_0x19abc7){if(_0x19abc7&&_0x19abc7[_0x65be('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x180b44[_0x65be('0x2f')],'resourceId':_0x180b44['id'],'type':_0x19abc7[_0x65be('0x2f')],'sectionId':_0x19abc7['id']},{})['then'](function(){return _0x3d1684;});}else{return _0x3d1684;}})[_0x65be('0x47')](function(_0x1e3c88){logger[_0x65be('0x2d')](_0x65be('0x56'),_0x1e3c88);throw _0x1e3c88;});}return _0x3d1684;})[_0x65be('0x2a')](respondWithResult(_0x13d366,0xc9))[_0x65be('0x47')](handleError(_0x13d366,null));};exports[_0x65be('0x29')]=function(_0x54a014,_0x3dbc2b){if(_0x54a014[_0x65be('0x4e')]['id']){delete _0x54a014[_0x65be('0x4e')]['id'];}return db[_0x65be('0x33')][_0x65be('0x4c')]({'where':{'id':_0x54a014[_0x65be('0x49')]['id']}})[_0x65be('0x2a')](handleEntityNotFound(_0x3dbc2b,null))[_0x65be('0x2a')](saveUpdates(_0x54a014['body'],null))[_0x65be('0x2a')](respondWithResult(_0x3dbc2b,null))[_0x65be('0x47')](handleError(_0x3dbc2b,null));};exports['destroy']=function(_0x2aae3e,_0x5aa3df){return db[_0x65be('0x33')][_0x65be('0x4c')]({'where':{'id':_0x2aae3e[_0x65be('0x49')]['id']}})[_0x65be('0x2a')](handleEntityNotFound(_0x5aa3df,null))['then'](removeEntity(_0x5aa3df,null))[_0x65be('0x47')](handleError(_0x5aa3df,null));};exports['addUsers']=function(_0x264d73,_0x1917f3,_0x434c9d){return db['SquareProject'][_0x65be('0x4c')]({'where':{'id':_0x264d73[_0x65be('0x49')]['id']}})['then'](handleEntityNotFound(_0x1917f3,null))[_0x65be('0x2a')](function(_0x2166ff){if(_0x2166ff){return _0x2166ff[_0x65be('0x57')](_0x264d73[_0x65be('0x4e')][_0x65be('0x58')],_[_0x65be('0x59')](_0x264d73['body'],['ids','id'])||{});}})[_0x65be('0x2a')](respondWithResult(_0x1917f3,null))['catch'](handleError(_0x1917f3,null));};exports[_0x65be('0x5a')]=function(_0x1af538,_0x20f2cb,_0x5f4be8){return db['SquareProject'][_0x65be('0x4c')]({'where':{'id':_0x1af538[_0x65be('0x49')]['id']}})['then'](handleEntityNotFound(_0x20f2cb,null))[_0x65be('0x2a')](function(_0x2895d8){if(_0x2895d8){return _0x2895d8['removeUsers'](_0x1af538[_0x65be('0x39')]['ids'])[_0x65be('0x2a')](function(){if(_[_0x65be('0x5b')](_0x1af538[_0x65be('0x39')][_0x65be('0x58')])){for(var _0x4d069b=0x0;_0x4d069b<_0x1af538[_0x65be('0x39')][_0x65be('0x58')]['length'];_0x4d069b+=0x1){socket['emit'](_0x65be('0x5c'),{'UserId':Number(_0x1af538[_0x65be('0x39')]['ids'][_0x4d069b]),'SquareProjectId':Number(_0x1af538[_0x65be('0x49')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x1af538[_0x65be('0x39')][_0x65be('0x58')]),'SquareProjectId':Number(_0x1af538[_0x65be('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x20f2cb,null))[_0x65be('0x47')](handleError(_0x20f2cb,null));};exports['getUsers']=function(_0x393ced,_0x3d5e48,_0xfd69d){var _0x2b776d={};var _0x16d874={};var _0x57ca15;var _0x510b87;return db['SquareProject'][_0x65be('0x5d')]({'where':{'id':_0x393ced['params']['id']}})[_0x65be('0x2a')](handleEntityNotFound(_0x3d5e48,null))['then'](function(_0x17feb1){if(_0x17feb1){_0x57ca15=_0x17feb1;_0x16d874[_0x65be('0x36')]=_[_0x65be('0x4a')](db[_0x65be('0x5e')][_0x65be('0x4b')]);_0x16d874[_0x65be('0x39')]=_['keys'](_0x393ced[_0x65be('0x39')]);_0x16d874[_0x65be('0x37')]=_['intersection'](_0x16d874['model'],_0x16d874[_0x65be('0x39')]);_0x2b776d[_0x65be('0x3a')]=_[_0x65be('0x38')](_0x16d874[_0x65be('0x36')],qs[_0x65be('0x3b')](_0x393ced[_0x65be('0x39')][_0x65be('0x3b')]));_0x2b776d[_0x65be('0x3a')]=_0x2b776d[_0x65be('0x3a')][_0x65be('0x3c')]?_0x2b776d[_0x65be('0x3a')]:_0x16d874[_0x65be('0x36')];_0x2b776d[_0x65be('0x3f')]=qs[_0x65be('0x40')](_0x393ced['query'][_0x65be('0x40')]);_0x2b776d[_0x65be('0x41')]=qs[_0x65be('0x37')](_[_0x65be('0x5f')](_0x393ced[_0x65be('0x39')],_0x16d874[_0x65be('0x37')]));if(_0x393ced[_0x65be('0x39')][_0x65be('0x42')]){_0x2b776d[_0x65be('0x41')]=_['merge'](_0x2b776d[_0x65be('0x41')],{'$or':_['map'](_0x2b776d[_0x65be('0x3a')],function(_0x11ef8f){var _0x3018a5={};_0x3018a5[_0x11ef8f]={'$like':'%'+_0x393ced['query'][_0x65be('0x42')]+'%'};return _0x3018a5;})});}_0x2b776d=_[_0x65be('0x43')]({},_0x2b776d,_0x393ced[_0x65be('0x60')]);return _0x57ca15[_0x65be('0x61')](_0x2b776d);}})[_0x65be('0x2a')](function(_0x1b9f4a){if(_0x1b9f4a){_0x510b87=_0x1b9f4a[_0x65be('0x3c')];if(!_0x393ced[_0x65be('0x39')]['hasOwnProperty'](_0x65be('0x3e'))){_0x2b776d[_0x65be('0x23')]=qs[_0x65be('0x23')](_0x393ced['query']['limit']);_0x2b776d[_0x65be('0x21')]=qs['offset'](_0x393ced[_0x65be('0x39')][_0x65be('0x21')]);}return _0x57ca15[_0x65be('0x61')](_0x2b776d);}})[_0x65be('0x2a')](function(_0x1d334f){if(_0x1d334f){return _0x1d334f?{'count':_0x510b87,'rows':_0x1d334f}:null;}})[_0x65be('0x2a')](respondWithResult(_0x3d5e48,null))[_0x65be('0x47')](handleError(_0x3d5e48,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f849917..fe223c6 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 _0x2d51=['remove','emit','hasOwnProperty','hook','exports','events','SquareProject','update'];(function(_0x3246ee,_0x4b9b26){var _0xc7c978=function(_0x59cc77){while(--_0x59cc77){_0x3246ee['push'](_0x3246ee['shift']());}};_0xc7c978(++_0x4b9b26);}(_0x2d51,0xfd));var _0x12d5=function(_0x278c1a,_0x2538f6){_0x278c1a=_0x278c1a-0x0;var _0x12eba5=_0x2d51[_0x278c1a];return _0x12eba5;};'use strict';var EventEmitter=require(_0x12d5('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x12d5('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x12d5('0x2'),'afterDestroy':_0x12d5('0x3')};function emitEvent(_0x1d2084){return function(_0x23a0bb,_0x37758d,_0x49beb5){SquareProjectEvents[_0x12d5('0x4')](_0x1d2084+':'+_0x23a0bb['id'],_0x23a0bb);SquareProjectEvents[_0x12d5('0x4')](_0x1d2084,_0x23a0bb);_0x49beb5(null);};}for(var e in events){if(events[_0x12d5('0x5')](e)){var event=events[e];SquareProject[_0x12d5('0x6')](e,emitEvent(event));}}module[_0x12d5('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x6ed9=['../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x429d9e,_0x35a02f){var _0x4ced0d=function(_0x5a7868){while(--_0x5a7868){_0x429d9e['push'](_0x429d9e['shift']());}};_0x4ced0d(++_0x35a02f);}(_0x6ed9,0x1e9));var _0x96ed=function(_0x26cbb1,_0x48349d){_0x26cbb1=_0x26cbb1-0x0;var _0x608bee=_0x6ed9[_0x26cbb1];return _0x608bee;};'use strict';var EventEmitter=require(_0x96ed('0x0'));var SquareProject=require(_0x96ed('0x1'))['db'][_0x96ed('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x96ed('0x3')](0x0);var events={'afterCreate':_0x96ed('0x4'),'afterUpdate':'update','afterDestroy':_0x96ed('0x5')};function emitEvent(_0x206d40){return function(_0x1e0816,_0x53581a,_0x34b689){SquareProjectEvents[_0x96ed('0x6')](_0x206d40+':'+_0x1e0816['id'],_0x1e0816);SquareProjectEvents['emit'](_0x206d40,_0x1e0816);_0x34b689(null);};}for(var e in events){if(events[_0x96ed('0x7')](e)){var event=events[e];SquareProject[_0x96ed('0x8')](e,emitEvent(event));}}module[_0x96ed('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index af6f290..1177851 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 _0xd89e=['savedAt','production','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','square_projects','changed'];(function(_0x169f24,_0x324251){var _0x24e37e=function(_0x256af0){while(--_0x256af0){_0x169f24['push'](_0x169f24['shift']());}};_0x24e37e(++_0x324251);}(_0xd89e,0x1d3));var _0xed89=function(_0x22cecf,_0x4f7338){_0x22cecf=_0x22cecf-0x0;var _0x559b05=_0xd89e[_0x22cecf];return _0x559b05;};'use strict';var _=require(_0xed89('0x0'));var util=require(_0xed89('0x1'));var logger=require(_0xed89('0x2'))(_0xed89('0x3'));var moment=require(_0xed89('0x4'));var BPromise=require(_0xed89('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed89('0x6'));var rimraf=require(_0xed89('0x7'));var config=require(_0xed89('0x8'));var attributes=require('./squareProject.attributes');module[_0xed89('0x9')]=function(_0x1fa48c,_0x4f790e){return _0x1fa48c[_0xed89('0xa')]('SquareProject',attributes,{'tableName':_0xed89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5597bf,_0xeb09db,_0x267534){if(_0x5597bf[_0xed89('0xc')]('preproduction')){_0x5597bf[_0xed89('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5597bf[_0xed89('0xc')](_0xed89('0xe'))){_0x5597bf['publishedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x267534(null,_0x5597bf);}}});}; \ No newline at end of file +var _0xdee6=['../../config/environment','exports','define','square_projects','changed','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x250f93,_0x4d6d01){var _0x55d6f3=function(_0x273605){while(--_0x273605){_0x250f93['push'](_0x250f93['shift']());}};_0x55d6f3(++_0x4d6d01);}(_0xdee6,0x169));var _0x6dee=function(_0x6ec4b,_0x1eacad){_0x6ec4b=_0x6ec4b-0x0;var _0x3ddf9c=_0xdee6[_0x6ec4b];return _0x3ddf9c;};'use strict';var _=require(_0x6dee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6dee('0x1'));var moment=require(_0x6dee('0x2'));var BPromise=require(_0x6dee('0x3'));var rp=require(_0x6dee('0x4'));var fs=require('fs');var path=require(_0x6dee('0x5'));var rimraf=require(_0x6dee('0x6'));var config=require(_0x6dee('0x7'));var attributes=require('./squareProject.attributes');module[_0x6dee('0x8')]=function(_0x521130,_0x1905c1){return _0x521130[_0x6dee('0x9')]('SquareProject',attributes,{'tableName':_0x6dee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b0de2,_0xbb4c54,_0x136077){if(_0x5b0de2[_0x6dee('0xb')]('preproduction')){_0x5b0de2['savedAt']=moment()[_0x6dee('0xc')](_0x6dee('0xd'));}if(_0x5b0de2[_0x6dee('0xb')](_0x6dee('0xe'))){_0x5b0de2[_0x6dee('0xf')]=moment()[_0x6dee('0xc')](_0x6dee('0xd'));}_0x136077(null,_0x5b0de2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 89d079f..11bca95 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 _0xc1e7=['request\x20sent','debug','stringify','error','code','message','result','SquareProject','find','options','raw','attributes','include','model','map','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','client','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s'];(function(_0x2bfcad,_0x5d382d){var _0x86b35d=function(_0x3294bd){while(--_0x3294bd){_0x2bfcad['push'](_0x2bfcad['shift']());}};_0x86b35d(++_0x5d382d);}(_0xc1e7,0x139));var _0x7c1e=function(_0x27b949,_0x1f090f){_0x27b949=_0x27b949-0x0;var _0x17b9c8=_0xc1e7[_0x27b949];return _0x17b9c8;};'use strict';var _=require(_0x7c1e('0x0'));var util=require(_0x7c1e('0x1'));var moment=require('moment');var BPromise=require(_0x7c1e('0x2'));var rs=require(_0x7c1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c1e('0x4'));var logger=require(_0x7c1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c1e('0x6')]['http']({'port':0x232a});config['redis']=_[_0x7c1e('0x7')](config[_0x7c1e('0x8')],{'host':_0x7c1e('0x9'),'port':0x18eb});var socket=require(_0x7c1e('0xa'))(new Redis(config[_0x7c1e('0x8')]));require(_0x7c1e('0xb'))[_0x7c1e('0xc')](socket);function respondWithRpcPromise(_0x1a2b9,_0x92a8d8,_0x44a63c){return new BPromise(function(_0x2e9b24,_0x3074f2){return client[_0x7c1e('0xd')](_0x1a2b9,_0x44a63c)[_0x7c1e('0xe')](function(_0x1d187b){logger[_0x7c1e('0xf')](_0x7c1e('0x10'),_0x92a8d8,_0x7c1e('0x11'));logger[_0x7c1e('0x12')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x92a8d8,_0x7c1e('0x11'),JSON[_0x7c1e('0x13')](_0x1d187b));if(_0x1d187b['error']){if(_0x1d187b[_0x7c1e('0x14')][_0x7c1e('0x15')]===0x1f4){logger['error'](_0x7c1e('0x10'),_0x92a8d8,_0x1d187b[_0x7c1e('0x14')][_0x7c1e('0x16')]);return _0x3074f2(_0x1d187b[_0x7c1e('0x14')][_0x7c1e('0x16')]);}logger[_0x7c1e('0x14')]('SquareProject,\x20%s,\x20%s',_0x92a8d8,_0x1d187b['error']['message']);return _0x2e9b24(_0x1d187b[_0x7c1e('0x14')][_0x7c1e('0x16')]);}else{logger['info'](_0x7c1e('0x10'),_0x92a8d8,'request\x20sent');_0x2e9b24(_0x1d187b[_0x7c1e('0x17')]['message']);}})['catch'](function(_0x2263ec){logger[_0x7c1e('0x14')](_0x7c1e('0x10'),_0x92a8d8,_0x2263ec);_0x3074f2(_0x2263ec);});});}exports['ShowSquareProject']=function(_0x2bb552){var _0x1f1248=this;return new Promise(function(_0x247ff0,_0x2ea2be){return db[_0x7c1e('0x18')][_0x7c1e('0x19')]({'raw':_0x2bb552[_0x7c1e('0x1a')]?_0x2bb552[_0x7c1e('0x1a')][_0x7c1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2bb552[_0x7c1e('0x1a')]?_0x2bb552[_0x7c1e('0x1a')]['where']||null:null,'attributes':_0x2bb552[_0x7c1e('0x1a')]?_0x2bb552[_0x7c1e('0x1a')][_0x7c1e('0x1c')]||null:null,'include':_0x2bb552['options']?_0x2bb552[_0x7c1e('0x1a')]['include']?_['map'](_0x2bb552[_0x7c1e('0x1a')][_0x7c1e('0x1d')],function(_0x2093ea){return{'model':db[_0x2093ea[_0x7c1e('0x1e')]],'as':_0x2093ea['as'],'attributes':_0x2093ea['attributes'],'include':_0x2093ea[_0x7c1e('0x1d')]?_['map'](_0x2093ea[_0x7c1e('0x1d')],function(_0x3c86cf){return{'model':db[_0x3c86cf[_0x7c1e('0x1e')]],'as':_0x3c86cf['as'],'attributes':_0x3c86cf[_0x7c1e('0x1c')],'include':_0x3c86cf['include']?_[_0x7c1e('0x1f')](_0x3c86cf[_0x7c1e('0x1d')],function(_0x59149f){return{'model':db[_0x59149f[_0x7c1e('0x1e')]],'as':_0x59149f['as'],'attributes':_0x59149f[_0x7c1e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfd43ca){logger['info']('ShowSquareProject',_0x2bb552);logger[_0x7c1e('0x12')]('ShowSquareProject',_0x2bb552,JSON[_0x7c1e('0x13')](_0xfd43ca));_0x247ff0(_0xfd43ca);})[_0x7c1e('0x20')](function(_0x5ba10c){logger[_0x7c1e('0x14')]('ShowSquareProject',_0x5ba10c[_0x7c1e('0x16')],_0x2bb552);_0x2ea2be(_0x1f1248[_0x7c1e('0x14')](0x1f4,_0x5ba10c[_0x7c1e('0x16')]));});});}; \ No newline at end of file +var _0xb01c=['socket.io-emitter','redis','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','find','options','where','include','map','attributes','model','ShowSquareProject','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost'];(function(_0x39a1be,_0x598284){var _0x2d4f3d=function(_0x29dd97){while(--_0x29dd97){_0x39a1be['push'](_0x39a1be['shift']());}};_0x2d4f3d(++_0x598284);}(_0xb01c,0x1e0));var _0xcb01=function(_0x3e08e1,_0x408343){_0x3e08e1=_0x3e08e1-0x0;var _0x4626fb=_0xb01c[_0x3e08e1];return _0x4626fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcb01('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb01('0x1'));var db=require(_0xcb01('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb01('0x3'))(_0xcb01('0x4'));var config=require('../../config/environment');var jayson=require(_0xcb01('0x5'));var client=jayson[_0xcb01('0x6')][_0xcb01('0x7')]({'port':0x232a});config['redis']=_[_0xcb01('0x8')](config['redis'],{'host':_0xcb01('0x9'),'port':0x18eb});var socket=require(_0xcb01('0xa'))(new Redis(config[_0xcb01('0xb')]));require(_0xcb01('0xc'))[_0xcb01('0xd')](socket);function respondWithRpcPromise(_0x3b23b7,_0x5c3ef2,_0x10d20a){return new BPromise(function(_0x4e9a24,_0xefe0ea){return client[_0xcb01('0xe')](_0x3b23b7,_0x10d20a)[_0xcb01('0xf')](function(_0x50f11b){logger['info'](_0xcb01('0x10'),_0x5c3ef2,'request\x20sent');logger[_0xcb01('0x11')](_0xcb01('0x12'),_0x5c3ef2,_0xcb01('0x13'),JSON[_0xcb01('0x14')](_0x50f11b));if(_0x50f11b['error']){if(_0x50f11b[_0xcb01('0x15')][_0xcb01('0x16')]===0x1f4){logger['error'](_0xcb01('0x10'),_0x5c3ef2,_0x50f11b[_0xcb01('0x15')]['message']);return _0xefe0ea(_0x50f11b[_0xcb01('0x15')][_0xcb01('0x17')]);}logger[_0xcb01('0x15')](_0xcb01('0x10'),_0x5c3ef2,_0x50f11b[_0xcb01('0x15')][_0xcb01('0x17')]);return _0x4e9a24(_0x50f11b[_0xcb01('0x15')]['message']);}else{logger[_0xcb01('0x18')](_0xcb01('0x10'),_0x5c3ef2,_0xcb01('0x13'));_0x4e9a24(_0x50f11b[_0xcb01('0x19')][_0xcb01('0x17')]);}})[_0xcb01('0x1a')](function(_0x48767d){logger[_0xcb01('0x15')](_0xcb01('0x10'),_0x5c3ef2,_0x48767d);_0xefe0ea(_0x48767d);});});}exports['ShowSquareProject']=function(_0x87d91a){var _0x1efcad=this;return new Promise(function(_0x5a6221,_0x272fd5){return db['SquareProject'][_0xcb01('0x1b')]({'raw':_0x87d91a['options']?_0x87d91a[_0xcb01('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x87d91a[_0xcb01('0x1c')]?_0x87d91a[_0xcb01('0x1c')][_0xcb01('0x1d')]||null:null,'attributes':_0x87d91a['options']?_0x87d91a[_0xcb01('0x1c')]['attributes']||null:null,'include':_0x87d91a[_0xcb01('0x1c')]?_0x87d91a[_0xcb01('0x1c')][_0xcb01('0x1e')]?_[_0xcb01('0x1f')](_0x87d91a['options'][_0xcb01('0x1e')],function(_0x2a1316){return{'model':db[_0x2a1316['model']],'as':_0x2a1316['as'],'attributes':_0x2a1316[_0xcb01('0x20')],'include':_0x2a1316[_0xcb01('0x1e')]?_[_0xcb01('0x1f')](_0x2a1316[_0xcb01('0x1e')],function(_0x46adf3){return{'model':db[_0x46adf3[_0xcb01('0x21')]],'as':_0x46adf3['as'],'attributes':_0x46adf3[_0xcb01('0x20')],'include':_0x46adf3[_0xcb01('0x1e')]?_['map'](_0x46adf3[_0xcb01('0x1e')],function(_0x4bf7d2){return{'model':db[_0x4bf7d2['model']],'as':_0x4bf7d2['as'],'attributes':_0x4bf7d2[_0xcb01('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcb01('0xf')](function(_0x348bd1){logger[_0xcb01('0x18')](_0xcb01('0x22'),_0x87d91a);logger['debug'](_0xcb01('0x22'),_0x87d91a,JSON[_0xcb01('0x14')](_0x348bd1));_0x5a6221(_0x348bd1);})[_0xcb01('0x1a')](function(_0x29962a){logger[_0xcb01('0x15')]('ShowSquareProject',_0x29962a[_0xcb01('0x17')],_0x87d91a);_0x272fd5(_0x1efcad[_0xcb01('0x15')](0x1f4,_0x29962a[_0xcb01('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f33c4c6..53afe76 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 _0xda12=['update','removeListener','register','length','squareProject:','save','remove'];(function(_0x1849cb,_0x16d069){var _0x54790d=function(_0x3b645c){while(--_0x3b645c){_0x1849cb['push'](_0x1849cb['shift']());}};_0x54790d(++_0x16d069);}(_0xda12,0x1e8));var _0x2da1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xda12[_0x4a9fb1];return _0x348672;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x2da1('0x0'),_0x2da1('0x1'),_0x2da1('0x2')];function createListener(_0xeb4894,_0x16d560){return function(_0x2beaa1){_0x16d560['emit'](_0xeb4894,_0x2beaa1);};}function removeListener(_0x31fef5,_0x5818d5){return function(){SquareProjectEvents[_0x2da1('0x3')](_0x31fef5,_0x5818d5);};}exports[_0x2da1('0x4')]=function(_0x41cd1c){for(var _0x5b1e0b=0x0,_0x517fe8=events[_0x2da1('0x5')];_0x5b1e0b<_0x517fe8;_0x5b1e0b++){var _0x3e7ab3=events[_0x5b1e0b];var _0x1a5241=createListener(_0x2da1('0x6')+_0x3e7ab3,_0x41cd1c);SquareProjectEvents['on'](_0x3e7ab3,_0x1a5241);}}; \ No newline at end of file +var _0x065e=['register','length','squareProject:','./squareProject.events','remove','update','emit','removeListener'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x065e,0xeb));var _0xe065=function(_0x515e90,_0x386b65){_0x515e90=_0x515e90-0x0;var _0x58b5e1=_0x065e[_0x515e90];return _0x58b5e1;};'use strict';var SquareProjectEvents=require(_0xe065('0x0'));var events=['save',_0xe065('0x1'),_0xe065('0x2')];function createListener(_0x53f66e,_0x506251){return function(_0x3019bb){_0x506251[_0xe065('0x3')](_0x53f66e,_0x3019bb);};}function removeListener(_0x399f47,_0x5894c2){return function(){SquareProjectEvents[_0xe065('0x4')](_0x399f47,_0x5894c2);};}exports[_0xe065('0x5')]=function(_0x1749af){for(var _0x2110eb=0x0,_0x550308=events[_0xe065('0x6')];_0x2110eb<_0x550308;_0x2110eb++){var _0x15fd1d=events[_0x2110eb];var _0x5020ce=createListener(_0xe065('0x7')+_0x15fd1d,_0x1749af);SquareProjectEvents['on'](_0x15fd1d,_0x5020ce);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 7f9f2ac..e1cc9d8 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0xae17ab,_0x3f46c1){var _0x4bd6fc=function(_0x5228bf){while(--_0x5228bf){_0xae17ab['push'](_0xae17ab['shift']());}};_0x4bd6fc(++_0x3f46c1);}(_0xe14b,0x93));var _0xbe14=function(_0xae66d4,_0x196774){_0xae66d4=_0xae66d4-0x0;var _0x3fcaaa=_0xe14b[_0xae66d4];return _0x3fcaaa;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0295,0x1f0));var _0x5029=function(_0x2caf41,_0x5b398e){_0x2caf41=_0x2caf41-0x0;var _0x5ca4de=_0x0295[_0x2caf41];return _0x5ca4de;};'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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3abb83e..57fe925 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 _0xae24=['VIRTUAL','savePath','sequelize','STRING'];(function(_0x89ff7d,_0x1941d3){var _0x37f742=function(_0x371fa3){while(--_0x371fa3){_0x89ff7d['push'](_0x89ff7d['shift']());}};_0x37f742(++_0x1941d3);}(_0xae24,0x182));var _0x4ae2=function(_0x14c14a,_0x5bc705){_0x14c14a=_0x14c14a-0x0;var _0x5ee3f5=_0xae24[_0x14c14a];return _0x5ee3f5;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ae2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4ae2('0x1')]},'context':{'type':Sequelize[_0x4ae2('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ae2('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4ae2('0x1')]},'saveName':{'type':Sequelize[_0x4ae2('0x1')]},'filename':{'type':Sequelize[_0x4ae2('0x1')]},'savePath':{'type':Sequelize[_0x4ae2('0x1')]},'format':{'type':Sequelize[_0x4ae2('0x2')],'get':function(){var _0x307247='';var _0x4f2e84=this['getDataValue'](_0x4ae2('0x3'));if(_0x4f2e84){_0x307247=_0x4f2e84['substring'](_0x4f2e84['lastIndexOf']('.'));}return _0x307247;}}}; \ No newline at end of file +var _0x038b=['lastIndexOf','exports','STRING','VIRTUAL','substring'];(function(_0x24c279,_0x22009b){var _0x32fcea=function(_0xbe254c){while(--_0xbe254c){_0x24c279['push'](_0x24c279['shift']());}};_0x32fcea(++_0x22009b);}(_0x038b,0x114));var _0xb038=function(_0x1ba1c2,_0x290640){_0x1ba1c2=_0x1ba1c2-0x0;var _0x3bc0c2=_0x038b[_0x1ba1c2];return _0x3bc0c2;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'callerid':{'type':Sequelize[_0xb038('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb038('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xb038('0x1')]},'saveName':{'type':Sequelize[_0xb038('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb038('0x2')],'get':function(){var _0x1b077a='';var _0x1534a9=this['getDataValue']('savePath');if(_0x1534a9){_0x1b077a=_0x1534a9[_0xb038('0x3')](_0x1534a9[_0xb038('0x4')]('.'));}return _0x1b077a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ac1174c..5d7734f 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 _0xde16=['%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','Entity\x20not\x20found','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','info','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','SquareRecording','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','include','findAll','show','params','options','find','catch','body','download','../../components/encryptor','uniqueid','savePath','format'];(function(_0x163498,_0x24d05a){var _0x432ee3=function(_0x133c7b){while(--_0x133c7b){_0x163498['push'](_0x163498['shift']());}};_0x432ee3(++_0x24d05a);}(_0xde16,0x6a));var _0x6de1=function(_0x5f37d4,_0x337bc0){_0x5f37d4=_0x5f37d4-0x0;var _0x35dba2=_0xde16[_0x5f37d4];return _0x35dba2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6de1('0x0'));var jsonpatch=require(_0x6de1('0x1'));var rp=require(_0x6de1('0x2'));var moment=require(_0x6de1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6de1('0x4'));var util=require(_0x6de1('0x5'));var path=require(_0x6de1('0x6'));var sox=require(_0x6de1('0x7'));var csv=require(_0x6de1('0x8'));var ejs=require(_0x6de1('0x9'));var fs=require('fs');var fs_extra=require(_0x6de1('0xa'));var _=require(_0x6de1('0xb'));var squel=require('squel');var crypto=require(_0x6de1('0xc'));var jsforce=require(_0x6de1('0xd'));var deskjs=require(_0x6de1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6de1('0xf'));var Papa=require('papaparse');var Redis=require(_0x6de1('0x10'));var authService=require(_0x6de1('0x11'));var qs=require(_0x6de1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6de1('0x13'))(_0x6de1('0x14'));var utils=require(_0x6de1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6de1('0x16'));var db=require(_0x6de1('0x17'))['db'];function respondWithStatusCode(_0x191300,_0x5505be){_0x5505be=_0x5505be||0xcc;return function(_0x1ec631){if(_0x1ec631){return _0x191300['sendStatus'](_0x5505be);}return _0x191300['status'](_0x5505be)['end']();};}function respondWithResult(_0x386b78,_0x36cb74){_0x36cb74=_0x36cb74||0xc8;return function(_0x4d4cb6){if(_0x4d4cb6){return _0x386b78[_0x6de1('0x18')](_0x36cb74)['json'](_0x4d4cb6);}};}function respondWithFilteredResult(_0x22930d,_0x3b6e24){return function(_0x37bf67){if(_0x37bf67){var _0x544b1e=typeof _0x3b6e24[_0x6de1('0x19')]===_0x6de1('0x1a')&&typeof _0x3b6e24[_0x6de1('0x1b')]===_0x6de1('0x1a');var _0x4e0ad1=_0x37bf67['count'];var _0x551535=_0x544b1e?0x0:_0x3b6e24[_0x6de1('0x19')];var _0x1d49c6=_0x544b1e?_0x37bf67[_0x6de1('0x1c')]:_0x3b6e24[_0x6de1('0x19')]+_0x3b6e24['limit'];var _0xdcfa2b;if(_0x1d49c6>=_0x4e0ad1){_0x1d49c6=_0x4e0ad1;_0xdcfa2b=0xc8;}else{_0xdcfa2b=0xce;}_0x22930d[_0x6de1('0x18')](_0xdcfa2b);return _0x22930d[_0x6de1('0x1d')](_0x6de1('0x1e'),_0x551535+'-'+_0x1d49c6+'/'+_0x4e0ad1)['json'](_0x37bf67);}return null;};}function patchUpdates(_0x57d2ae){return function(_0x2c5ce2){try{jsonpatch['apply'](_0x2c5ce2,_0x57d2ae,!![]);}catch(_0x5dd3d2){return BPromise[_0x6de1('0x1f')](_0x5dd3d2);}return _0x2c5ce2[_0x6de1('0x20')]();};}function saveUpdates(_0x5ac0b4,_0x10f64d){return function(_0x184436){if(_0x184436){return _0x184436[_0x6de1('0x21')](_0x5ac0b4)[_0x6de1('0x22')](function(_0x23cd76){return _0x23cd76;});}return null;};}function removeEntity(_0x4b3764,_0x172222){return function(_0x18cf1f){if(_0x18cf1f){return _0x18cf1f[_0x6de1('0x23')]()['then'](function(){_0x4b3764[_0x6de1('0x18')](0xcc)[_0x6de1('0x24')]();});}};}function handleEntityNotFound(_0x2f66a0,_0x2a24bd){return function(_0x1b6f73){if(!_0x1b6f73){_0x2f66a0[_0x6de1('0x25')](0x194);}return _0x1b6f73;};}function handleError(_0x2175ba,_0x216ff3){_0x216ff3=_0x216ff3||0x1f4;return function(_0x9f8de3){logger[_0x6de1('0x26')](_0x9f8de3[_0x6de1('0x27')]);if(_0x9f8de3[_0x6de1('0x28')]){delete _0x9f8de3[_0x6de1('0x28')];}_0x2175ba['status'](_0x216ff3)[_0x6de1('0x29')](_0x9f8de3);};}exports['index']=function(_0x5e00a2,_0xf442e5){var _0x13a997={},_0x58317c={},_0x3285b1={'count':0x0,'rows':[]};var _0x1a2101=_[_0x6de1('0x2a')](db[_0x6de1('0x2b')][_0x6de1('0x2c')],function(_0x58f927){return{'name':_0x58f927['fieldName'],'type':_0x58f927[_0x6de1('0x2d')][_0x6de1('0x2e')]};});_0x58317c[_0x6de1('0x2f')]=_['map'](_0x1a2101,_0x6de1('0x28'));_0x58317c['query']=_[_0x6de1('0x30')](_0x5e00a2[_0x6de1('0x31')]);_0x58317c[_0x6de1('0x32')]=_['intersection'](_0x58317c[_0x6de1('0x2f')],_0x58317c[_0x6de1('0x31')]);_0x13a997['attributes']=_[_0x6de1('0x33')](_0x58317c[_0x6de1('0x2f')],qs[_0x6de1('0x34')](_0x5e00a2[_0x6de1('0x31')]['fields']));_0x13a997[_0x6de1('0x35')]=_0x13a997[_0x6de1('0x35')][_0x6de1('0x36')]?_0x13a997[_0x6de1('0x35')]:_0x58317c[_0x6de1('0x2f')];if(!_0x5e00a2[_0x6de1('0x31')]['hasOwnProperty']('nolimit')){_0x13a997[_0x6de1('0x1b')]=qs['limit'](_0x5e00a2[_0x6de1('0x31')][_0x6de1('0x1b')]);_0x13a997[_0x6de1('0x19')]=qs[_0x6de1('0x19')](_0x5e00a2['query'][_0x6de1('0x19')]);}_0x13a997[_0x6de1('0x37')]=qs[_0x6de1('0x38')](_0x5e00a2[_0x6de1('0x31')][_0x6de1('0x38')]);_0x13a997[_0x6de1('0x39')]=qs[_0x6de1('0x32')](_['pick'](_0x5e00a2[_0x6de1('0x31')],_0x58317c[_0x6de1('0x32')]),_0x1a2101);if(_0x5e00a2['query']['filter']){_0x13a997[_0x6de1('0x39')]=_[_0x6de1('0x3a')](_0x13a997[_0x6de1('0x39')],{'$or':_['map'](_0x1a2101,function(_0x312348){if(_0x312348['type']!==_0x6de1('0x3b')){var _0x5ce93b={};_0x5ce93b[_0x312348[_0x6de1('0x28')]]={'$like':'%'+_0x5e00a2[_0x6de1('0x31')][_0x6de1('0x3c')]+'%'};return _0x5ce93b;}})});}_0x13a997=_['merge']({},_0x13a997,_0x5e00a2['options']);var _0x3c51da={'where':_0x13a997[_0x6de1('0x39')]};return db['SquareRecording']['count'](_0x3c51da)['then'](function(_0x5a21a5){_0x3285b1[_0x6de1('0x1c')]=_0x5a21a5;if(_0x5e00a2['query']['includeAll']){_0x13a997[_0x6de1('0x3d')]=[{'all':!![]}];}return db[_0x6de1('0x2b')][_0x6de1('0x3e')](_0x13a997);})['then'](function(_0x2c4e63){_0x3285b1['rows']=_0x2c4e63;return _0x3285b1;})[_0x6de1('0x22')](respondWithFilteredResult(_0xf442e5,_0x13a997))['catch'](handleError(_0xf442e5,null));};exports[_0x6de1('0x3f')]=function(_0x3fac64,_0x53c6b7){var _0x3c3f81={'raw':!![],'where':{'id':_0x3fac64[_0x6de1('0x40')]['id']}},_0x41e921={};_0x41e921['model']=_[_0x6de1('0x30')](db[_0x6de1('0x2b')][_0x6de1('0x2c')]);_0x41e921['query']=_[_0x6de1('0x30')](_0x3fac64[_0x6de1('0x31')]);_0x41e921[_0x6de1('0x32')]=_['intersection'](_0x41e921['model'],_0x41e921[_0x6de1('0x31')]);_0x3c3f81[_0x6de1('0x35')]=_[_0x6de1('0x33')](_0x41e921['model'],qs['fields'](_0x3fac64['query'][_0x6de1('0x34')]));_0x3c3f81['attributes']=_0x3c3f81[_0x6de1('0x35')][_0x6de1('0x36')]?_0x3c3f81[_0x6de1('0x35')]:_0x41e921[_0x6de1('0x2f')];if(_0x3fac64[_0x6de1('0x31')]['includeAll']){_0x3c3f81['include']=[{'all':!![]}];}_0x3c3f81=_[_0x6de1('0x3a')]({},_0x3c3f81,_0x3fac64[_0x6de1('0x41')]);return db[_0x6de1('0x2b')][_0x6de1('0x42')](_0x3c3f81)['then'](handleEntityNotFound(_0x53c6b7,null))[_0x6de1('0x22')](respondWithResult(_0x53c6b7,null))[_0x6de1('0x43')](handleError(_0x53c6b7,null));};exports['create']=function(_0x3211db,_0x1d5eeb){return db[_0x6de1('0x2b')]['create'](_0x3211db[_0x6de1('0x44')],{})['then'](respondWithResult(_0x1d5eeb,0xc9))[_0x6de1('0x43')](handleError(_0x1d5eeb,null));};exports[_0x6de1('0x21')]=function(_0xbadca7,_0x27e698){if(_0xbadca7[_0x6de1('0x44')]['id']){delete _0xbadca7[_0x6de1('0x44')]['id'];}return db[_0x6de1('0x2b')][_0x6de1('0x42')]({'where':{'id':_0xbadca7[_0x6de1('0x40')]['id']}})[_0x6de1('0x22')](handleEntityNotFound(_0x27e698,null))[_0x6de1('0x22')](saveUpdates(_0xbadca7[_0x6de1('0x44')],null))[_0x6de1('0x22')](respondWithResult(_0x27e698,null))[_0x6de1('0x43')](handleError(_0x27e698,null));};exports[_0x6de1('0x45')]=function(_0x539c4c,_0x9b6f2b,_0x15d653){var _0x36b90e=require(_0x6de1('0x46'));var _0x5c8a05=![];var _0x4bb438={};if(_0x539c4c[_0x6de1('0x31')][_0x6de1('0x2d')]&&_0x539c4c[_0x6de1('0x31')][_0x6de1('0x2d')]==='uniqueid'){_0x4bb438[_0x6de1('0x47')]=_0x539c4c[_0x6de1('0x40')]['id'];}else{_0x4bb438['id']=_0x539c4c[_0x6de1('0x40')]['id'];}return db[_0x6de1('0x2b')][_0x6de1('0x42')]({'where':_0x4bb438,'attributes':['id',_0x6de1('0x48'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x9b6f2b,null))[_0x6de1('0x22')](function(_0x14eccc){if(_0x14eccc){var _0x14a2c4=_0x14eccc['savePath'];var _0x3ef967=util[_0x6de1('0x49')](_0x6de1('0x4a'),_0x14a2c4);if(fs[_0x6de1('0x4b')](_0x3ef967)){_0x5c8a05=!![];return _0x36b90e[_0x6de1('0x4c')](_0x3ef967,_0x14a2c4,config[_0x6de1('0x4d')]['recording'])[_0x6de1('0x22')](function(){return _0x14eccc;});}return _0x14eccc;}})[_0x6de1('0x22')](function(_0x59cfcf){if(_0x59cfcf){var _0x5702ef=_0x59cfcf[_0x6de1('0x48')];if(!fs[_0x6de1('0x4b')](_0x5702ef)){throw new db[(_0x6de1('0x4e'))][(_0x6de1('0x4f'))](_0x6de1('0x50'));}if(_0x59cfcf[_0x6de1('0x51')]){return _0x9b6f2b[_0x6de1('0x45')](_0x5702ef,_0x59cfcf[_0x6de1('0x51')]+path[_0x6de1('0x52')](_0x5702ef),function(){if(_0x5c8a05){fs[_0x6de1('0x53')](_0x5702ef);}});}else{return _0x9b6f2b[_0x6de1('0x45')](_0x5702ef,function(_0x34fc6d){if(_0x5c8a05){fs[_0x6de1('0x53')](_0x5702ef);}});}}})[_0x6de1('0x43')](function(_0x4a20d3){if(_0x4a20d3['message']===_0x6de1('0x50')){_0x9b6f2b[_0x6de1('0x18')](0x194)[_0x6de1('0x29')](_0x6de1('0x54'));}else{return handleError(_0x9b6f2b,null);}});};exports[_0x6de1('0x23')]=function(_0x4a134a,_0x104533){return db['SquareRecording']['find']({'where':{'id':_0x4a134a[_0x6de1('0x40')]['id']}})[_0x6de1('0x22')](function(_0x25b348){if(_['isNil'](_0x25b348)){throw new ReferenceError(_0x6de1('0x55'));}return _0x25b348;})[_0x6de1('0x22')](function(_0x5c0220){var _0x3791dc=_0x5c0220['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3791dc);if(!_['isNil'](_0x5c0220[_0x6de1('0x48')])&&fs['existsSync'](_0x3791dc)){logger['info'](_0x6de1('0x56')+_0x3791dc+_0x6de1('0x57'));fs[_0x6de1('0x58')](_0x3791dc);}_0x3791dc=_0x3791dc+'.cypher';if(!_['isNil'](_0x5c0220[_0x6de1('0x48')])&&fs['existsSync'](_0x3791dc)){logger[_0x6de1('0x59')](_0x6de1('0x56')+_0x3791dc+_0x6de1('0x57'));fs['unlinkSync'](_0x3791dc);}return _0x5c0220;})[_0x6de1('0x22')](function(_0x50ec6e){if(!_0x50ec6e)throw new InternalError();return _0x50ec6e[_0x6de1('0x23')]();})[_0x6de1('0x22')](function(){_0x104533[_0x6de1('0x18')](0xcc)[_0x6de1('0x24')]();})[_0x6de1('0x43')](handleError(_0x104533,null));}; \ No newline at end of file +var _0x2d8c=['desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','catch','params','include','options','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce'];(function(_0x844da8,_0x1372c3){var _0x53495a=function(_0x4347ab){while(--_0x4347ab){_0x844da8['push'](_0x844da8['shift']());}};_0x53495a(++_0x1372c3);}(_0x2d8c,0x1e6));var _0xc2d8=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x2d8c[_0x59616b];return _0x5c4523;};'use strict';var emlformat=require(_0xc2d8('0x0'));var rimraf=require(_0xc2d8('0x1'));var zipdir=require(_0xc2d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc2d8('0x3'));var moment=require(_0xc2d8('0x4'));var BPromise=require(_0xc2d8('0x5'));var Mustache=require(_0xc2d8('0x6'));var util=require(_0xc2d8('0x7'));var path=require(_0xc2d8('0x8'));var sox=require(_0xc2d8('0x9'));var csv=require(_0xc2d8('0xa'));var ejs=require(_0xc2d8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc2d8('0xc'));var crypto=require('crypto');var jsforce=require(_0xc2d8('0xd'));var deskjs=require(_0xc2d8('0xe'));var toCsv=require(_0xc2d8('0xa'));var querystring=require(_0xc2d8('0xf'));var Papa=require('papaparse');var Redis=require(_0xc2d8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc2d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2d8('0x12'));var logger=require(_0xc2d8('0x13'))('api');var utils=require(_0xc2d8('0x14'));var config=require(_0xc2d8('0x15'));var licenseUtil=require(_0xc2d8('0x16'));var db=require(_0xc2d8('0x17'))['db'];function respondWithStatusCode(_0x3e93f3,_0x2bd00c){_0x2bd00c=_0x2bd00c||0xcc;return function(_0x1ad066){if(_0x1ad066){return _0x3e93f3[_0xc2d8('0x18')](_0x2bd00c);}return _0x3e93f3[_0xc2d8('0x19')](_0x2bd00c)[_0xc2d8('0x1a')]();};}function respondWithResult(_0xbbf048,_0x22b77e){_0x22b77e=_0x22b77e||0xc8;return function(_0x159b52){if(_0x159b52){return _0xbbf048[_0xc2d8('0x19')](_0x22b77e)[_0xc2d8('0x1b')](_0x159b52);}};}function respondWithFilteredResult(_0x3a8c30,_0x551f36){return function(_0xf721c0){if(_0xf721c0){var _0x27c11a=typeof _0x551f36[_0xc2d8('0x1c')]==='undefined'&&typeof _0x551f36[_0xc2d8('0x1d')]===_0xc2d8('0x1e');var _0x4ed6b7=_0xf721c0[_0xc2d8('0x1f')];var _0x14f126=_0x27c11a?0x0:_0x551f36[_0xc2d8('0x1c')];var _0x5c9652=_0x27c11a?_0xf721c0[_0xc2d8('0x1f')]:_0x551f36['offset']+_0x551f36[_0xc2d8('0x1d')];var _0x2c7ffd;if(_0x5c9652>=_0x4ed6b7){_0x5c9652=_0x4ed6b7;_0x2c7ffd=0xc8;}else{_0x2c7ffd=0xce;}_0x3a8c30[_0xc2d8('0x19')](_0x2c7ffd);return _0x3a8c30['set'](_0xc2d8('0x20'),_0x14f126+'-'+_0x5c9652+'/'+_0x4ed6b7)[_0xc2d8('0x1b')](_0xf721c0);}return null;};}function patchUpdates(_0x50a039){return function(_0x2dbde1){try{jsonpatch[_0xc2d8('0x21')](_0x2dbde1,_0x50a039,!![]);}catch(_0x33cd6d){return BPromise[_0xc2d8('0x22')](_0x33cd6d);}return _0x2dbde1[_0xc2d8('0x23')]();};}function saveUpdates(_0xccdac8,_0x44a406){return function(_0x156706){if(_0x156706){return _0x156706[_0xc2d8('0x24')](_0xccdac8)[_0xc2d8('0x25')](function(_0x4e117b){return _0x4e117b;});}return null;};}function removeEntity(_0x4e3e7f,_0x43fb2a){return function(_0x104c7a){if(_0x104c7a){return _0x104c7a[_0xc2d8('0x26')]()[_0xc2d8('0x25')](function(){_0x4e3e7f[_0xc2d8('0x19')](0xcc)[_0xc2d8('0x1a')]();});}};}function handleEntityNotFound(_0x106a38,_0xfbbc00){return function(_0x5bcda3){if(!_0x5bcda3){_0x106a38[_0xc2d8('0x18')](0x194);}return _0x5bcda3;};}function handleError(_0x42f82e,_0x215fc5){_0x215fc5=_0x215fc5||0x1f4;return function(_0x237e4b){logger[_0xc2d8('0x27')](_0x237e4b[_0xc2d8('0x28')]);if(_0x237e4b[_0xc2d8('0x29')]){delete _0x237e4b[_0xc2d8('0x29')];}_0x42f82e[_0xc2d8('0x19')](_0x215fc5)['send'](_0x237e4b);};}exports[_0xc2d8('0x2a')]=function(_0x13fc76,_0x3f8f76){var _0x2e7502={},_0xee91a8={},_0x459d19={'count':0x0,'rows':[]};var _0x4e5488=_[_0xc2d8('0x2b')](db[_0xc2d8('0x2c')][_0xc2d8('0x2d')],function(_0x428da3){return{'name':_0x428da3[_0xc2d8('0x2e')],'type':_0x428da3[_0xc2d8('0x2f')][_0xc2d8('0x30')]};});_0xee91a8[_0xc2d8('0x31')]=_[_0xc2d8('0x2b')](_0x4e5488,'name');_0xee91a8['query']=_[_0xc2d8('0x32')](_0x13fc76['query']);_0xee91a8['filters']=_['intersection'](_0xee91a8[_0xc2d8('0x31')],_0xee91a8[_0xc2d8('0x33')]);_0x2e7502[_0xc2d8('0x34')]=_[_0xc2d8('0x35')](_0xee91a8[_0xc2d8('0x31')],qs[_0xc2d8('0x36')](_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x36')]));_0x2e7502[_0xc2d8('0x34')]=_0x2e7502[_0xc2d8('0x34')][_0xc2d8('0x37')]?_0x2e7502[_0xc2d8('0x34')]:_0xee91a8[_0xc2d8('0x31')];if(!_0x13fc76['query'][_0xc2d8('0x38')]('nolimit')){_0x2e7502['limit']=qs['limit'](_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x1d')]);_0x2e7502[_0xc2d8('0x1c')]=qs[_0xc2d8('0x1c')](_0x13fc76[_0xc2d8('0x33')]['offset']);}_0x2e7502[_0xc2d8('0x39')]=qs[_0xc2d8('0x3a')](_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x3a')]);_0x2e7502[_0xc2d8('0x3b')]=qs[_0xc2d8('0x3c')](_[_0xc2d8('0x3d')](_0x13fc76['query'],_0xee91a8[_0xc2d8('0x3c')]),_0x4e5488);if(_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x3e')]){_0x2e7502[_0xc2d8('0x3b')]=_[_0xc2d8('0x3f')](_0x2e7502['where'],{'$or':_[_0xc2d8('0x2b')](_0x4e5488,function(_0x1a0b57){if(_0x1a0b57[_0xc2d8('0x2f')]!=='VIRTUAL'){var _0x2a8099={};_0x2a8099[_0x1a0b57[_0xc2d8('0x29')]]={'$like':'%'+_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x3e')]+'%'};return _0x2a8099;}})});}_0x2e7502=_['merge']({},_0x2e7502,_0x13fc76['options']);var _0x257d24={'where':_0x2e7502[_0xc2d8('0x3b')]};return db['SquareRecording'][_0xc2d8('0x1f')](_0x257d24)[_0xc2d8('0x25')](function(_0x57730c){_0x459d19[_0xc2d8('0x1f')]=_0x57730c;if(_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x40')]){_0x2e7502['include']=[{'all':!![]}];}return db[_0xc2d8('0x2c')][_0xc2d8('0x41')](_0x2e7502);})[_0xc2d8('0x25')](function(_0x4e9ff8){_0x459d19[_0xc2d8('0x42')]=_0x4e9ff8;return _0x459d19;})[_0xc2d8('0x25')](respondWithFilteredResult(_0x3f8f76,_0x2e7502))[_0xc2d8('0x43')](handleError(_0x3f8f76,null));};exports['show']=function(_0x214029,_0x59ba72){var _0x1ca3d4={'raw':!![],'where':{'id':_0x214029[_0xc2d8('0x44')]['id']}},_0x38cf52={};_0x38cf52[_0xc2d8('0x31')]=_[_0xc2d8('0x32')](db[_0xc2d8('0x2c')][_0xc2d8('0x2d')]);_0x38cf52['query']=_[_0xc2d8('0x32')](_0x214029['query']);_0x38cf52['filters']=_['intersection'](_0x38cf52[_0xc2d8('0x31')],_0x38cf52[_0xc2d8('0x33')]);_0x1ca3d4[_0xc2d8('0x34')]=_[_0xc2d8('0x35')](_0x38cf52[_0xc2d8('0x31')],qs[_0xc2d8('0x36')](_0x214029[_0xc2d8('0x33')][_0xc2d8('0x36')]));_0x1ca3d4[_0xc2d8('0x34')]=_0x1ca3d4[_0xc2d8('0x34')]['length']?_0x1ca3d4[_0xc2d8('0x34')]:_0x38cf52[_0xc2d8('0x31')];if(_0x214029[_0xc2d8('0x33')][_0xc2d8('0x40')]){_0x1ca3d4[_0xc2d8('0x45')]=[{'all':!![]}];}_0x1ca3d4=_['merge']({},_0x1ca3d4,_0x214029[_0xc2d8('0x46')]);return db[_0xc2d8('0x2c')]['find'](_0x1ca3d4)[_0xc2d8('0x25')](handleEntityNotFound(_0x59ba72,null))[_0xc2d8('0x25')](respondWithResult(_0x59ba72,null))['catch'](handleError(_0x59ba72,null));};exports[_0xc2d8('0x47')]=function(_0x525803,_0x265205){return db[_0xc2d8('0x2c')][_0xc2d8('0x47')](_0x525803[_0xc2d8('0x48')],{})[_0xc2d8('0x25')](respondWithResult(_0x265205,0xc9))[_0xc2d8('0x43')](handleError(_0x265205,null));};exports[_0xc2d8('0x24')]=function(_0x50acf0,_0x55221f){if(_0x50acf0[_0xc2d8('0x48')]['id']){delete _0x50acf0['body']['id'];}return db[_0xc2d8('0x2c')][_0xc2d8('0x49')]({'where':{'id':_0x50acf0[_0xc2d8('0x44')]['id']}})['then'](handleEntityNotFound(_0x55221f,null))[_0xc2d8('0x25')](saveUpdates(_0x50acf0[_0xc2d8('0x48')],null))['then'](respondWithResult(_0x55221f,null))[_0xc2d8('0x43')](handleError(_0x55221f,null));};exports[_0xc2d8('0x4a')]=function(_0x1b05ba,_0x39494b,_0x2d7425){var _0x3273ed=require(_0xc2d8('0x4b'));var _0xd11425=![];var _0x5c677f={};if(_0x1b05ba[_0xc2d8('0x33')][_0xc2d8('0x2f')]&&_0x1b05ba[_0xc2d8('0x33')][_0xc2d8('0x2f')]===_0xc2d8('0x4c')){_0x5c677f['uniqueid']=_0x1b05ba[_0xc2d8('0x44')]['id'];}else{_0x5c677f['id']=_0x1b05ba['params']['id'];}return db[_0xc2d8('0x2c')][_0xc2d8('0x49')]({'where':_0x5c677f,'attributes':['id',_0xc2d8('0x4d'),_0xc2d8('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x39494b,null))[_0xc2d8('0x25')](function(_0x44e66c){if(_0x44e66c){var _0xa6ad41=_0x44e66c[_0xc2d8('0x4d')];var _0x273b18=util[_0xc2d8('0x4f')](_0xc2d8('0x50'),_0xa6ad41);if(fs[_0xc2d8('0x51')](_0x273b18)){_0xd11425=!![];return _0x3273ed[_0xc2d8('0x52')](_0x273b18,_0xa6ad41,config[_0xc2d8('0x53')][_0xc2d8('0x54')])[_0xc2d8('0x25')](function(){return _0x44e66c;});}return _0x44e66c;}})[_0xc2d8('0x25')](function(_0x5a7b86){if(_0x5a7b86){var _0x2c8c23=_0x5a7b86[_0xc2d8('0x4d')];if(!fs[_0xc2d8('0x51')](_0x2c8c23)){throw new db[(_0xc2d8('0x55'))][(_0xc2d8('0x56'))](_0xc2d8('0x57'));}if(_0x5a7b86['filename']){return _0x39494b[_0xc2d8('0x4a')](_0x2c8c23,_0x5a7b86[_0xc2d8('0x4e')]+path[_0xc2d8('0x58')](_0x2c8c23),function(){if(_0xd11425){fs[_0xc2d8('0x59')](_0x2c8c23);}});}else{return _0x39494b[_0xc2d8('0x4a')](_0x2c8c23,function(_0x4d84ee){if(_0xd11425){fs[_0xc2d8('0x59')](_0x2c8c23);}});}}})[_0xc2d8('0x43')](function(_0x1f1d0e){if(_0x1f1d0e[_0xc2d8('0x5a')]==='SquareRecording\x20not\x20found'){_0x39494b[_0xc2d8('0x19')](0x194)[_0xc2d8('0x5b')](_0xc2d8('0x5c'));}else{return handleError(_0x39494b,null);}});};exports['destroy']=function(_0x56731f,_0x2d68dd){return db['SquareRecording'][_0xc2d8('0x49')]({'where':{'id':_0x56731f[_0xc2d8('0x44')]['id']}})[_0xc2d8('0x25')](function(_0x3b937c){if(_[_0xc2d8('0x5d')](_0x3b937c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3b937c;})[_0xc2d8('0x25')](function(_0xbdf9c4){var _0x364c51=_0xbdf9c4[_0xc2d8('0x4d')];logger['info'](_0xc2d8('0x5e'),_0x364c51);if(!_[_0xc2d8('0x5d')](_0xbdf9c4[_0xc2d8('0x4d')])&&fs[_0xc2d8('0x51')](_0x364c51)){logger[_0xc2d8('0x5f')]('File:\x20\x22'+_0x364c51+_0xc2d8('0x60'));fs[_0xc2d8('0x61')](_0x364c51);}_0x364c51=_0x364c51+_0xc2d8('0x62');if(!_[_0xc2d8('0x5d')](_0xbdf9c4['savePath'])&&fs['existsSync'](_0x364c51)){logger['info'](_0xc2d8('0x63')+_0x364c51+_0xc2d8('0x60'));fs[_0xc2d8('0x61')](_0x364c51);}return _0xbdf9c4;})[_0xc2d8('0x25')](function(_0x460d27){if(!_0x460d27)throw new InternalError();return _0x460d27[_0xc2d8('0x26')]();})[_0xc2d8('0x25')](function(){_0x2d68dd[_0xc2d8('0x19')](0xcc)[_0xc2d8('0x1a')]();})[_0xc2d8('0x43')](handleError(_0x2d68dd,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index dca7175..c3be376 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 _0xa6b0=['rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','moment','bluebird','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x33e08e,_0xc23943){_0x33e08e=_0x33e08e-0x0;var _0xd6665a=_0xa6b0[_0x33e08e];return _0xd6665a;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d04=['../../config/environment','./squareRecording.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 90a52c8..b7c5140 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 _0x57c9=['debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording','create','body','options','raw','then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x164f7d,_0x265b2b){var _0x2a5376=function(_0x1d2015){while(--_0x1d2015){_0x164f7d['push'](_0x164f7d['shift']());}};_0x2a5376(++_0x265b2b);}(_0x57c9,0xd2));var _0x957c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x57c9[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x957c('0x0'));var util=require(_0x957c('0x1'));var moment=require(_0x957c('0x2'));var BPromise=require(_0x957c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x957c('0x4'))['db'];var utils=require(_0x957c('0x5'));var logger=require(_0x957c('0x6'))('rpc');var config=require(_0x957c('0x7'));var jayson=require(_0x957c('0x8'));var client=jayson[_0x957c('0x9')][_0x957c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1291f9,_0x34ab12,_0x5a28bb){return new BPromise(function(_0x55a727,_0x3ebc21){return client[_0x957c('0xb')](_0x1291f9,_0x5a28bb)['then'](function(_0x421c1c){logger[_0x957c('0xc')]('SquareRecording,\x20%s,\x20%s',_0x34ab12,_0x957c('0xd'));logger[_0x957c('0xe')](_0x957c('0xf'),_0x34ab12,_0x957c('0xd'),JSON['stringify'](_0x421c1c));if(_0x421c1c[_0x957c('0x10')]){if(_0x421c1c['error'][_0x957c('0x11')]===0x1f4){logger[_0x957c('0x10')]('SquareRecording,\x20%s,\x20%s',_0x34ab12,_0x421c1c[_0x957c('0x10')][_0x957c('0x12')]);return _0x3ebc21(_0x421c1c[_0x957c('0x10')][_0x957c('0x12')]);}logger[_0x957c('0x10')](_0x957c('0x13'),_0x34ab12,_0x421c1c[_0x957c('0x10')]['message']);return _0x55a727(_0x421c1c['error'][_0x957c('0x12')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x34ab12,_0x957c('0xd'));_0x55a727(_0x421c1c[_0x957c('0x14')][_0x957c('0x12')]);}})[_0x957c('0x15')](function(_0x2ddf89){logger[_0x957c('0x10')](_0x957c('0x13'),_0x34ab12,_0x2ddf89);_0x3ebc21(_0x2ddf89);});});}exports[_0x957c('0x16')]=function(_0x2e2d3b){var _0x435fab=this;return new Promise(function(_0x52ce95,_0x59b1d4){return db['SquareRecording'][_0x957c('0x17')](_0x2e2d3b[_0x957c('0x18')],{'raw':_0x2e2d3b[_0x957c('0x19')]?_0x2e2d3b[_0x957c('0x19')][_0x957c('0x1a')]===undefined?!![]:![]:!![]})[_0x957c('0x1b')](function(_0x5d2a5a){logger[_0x957c('0xc')](_0x957c('0x16'),_0x2e2d3b);logger[_0x957c('0xe')](_0x957c('0x16'),_0x2e2d3b,JSON['stringify'](_0x5d2a5a));_0x52ce95(_0x5d2a5a);})[_0x957c('0x15')](function(_0xde83da){logger[_0x957c('0x10')]('CreateSquareRecording',_0xde83da[_0x957c('0x12')],_0x2e2d3b);_0x59b1d4(_0x435fab[_0x957c('0x10')](0x1f4,_0xde83da[_0x957c('0x12')]));});});}; \ No newline at end of file +var _0x3c01=['options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','body'];(function(_0x1ee04b,_0x554b3d){var _0x412848=function(_0x11917a){while(--_0x11917a){_0x1ee04b['push'](_0x1ee04b['shift']());}};_0x412848(++_0x554b3d);}(_0x3c01,0x16a));var _0x13c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3c01[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x13c0('0x0'));var moment=require(_0x13c0('0x1'));var BPromise=require(_0x13c0('0x2'));var rs=require(_0x13c0('0x3'));var fs=require('fs');var Redis=require(_0x13c0('0x4'));var db=require(_0x13c0('0x5'))['db'];var utils=require(_0x13c0('0x6'));var logger=require(_0x13c0('0x7'))(_0x13c0('0x8'));var config=require(_0x13c0('0x9'));var jayson=require(_0x13c0('0xa'));var client=jayson[_0x13c0('0xb')][_0x13c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x589088,_0x3ffeec,_0xd62bc2){return new BPromise(function(_0x5ad515,_0x2baaf6){return client[_0x13c0('0xd')](_0x589088,_0xd62bc2)[_0x13c0('0xe')](function(_0x1e9939){logger[_0x13c0('0xf')](_0x13c0('0x10'),_0x3ffeec,_0x13c0('0x11'));logger[_0x13c0('0x12')](_0x13c0('0x13'),_0x3ffeec,_0x13c0('0x11'),JSON[_0x13c0('0x14')](_0x1e9939));if(_0x1e9939[_0x13c0('0x15')]){if(_0x1e9939[_0x13c0('0x15')]['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3ffeec,_0x1e9939[_0x13c0('0x15')][_0x13c0('0x16')]);return _0x2baaf6(_0x1e9939[_0x13c0('0x15')][_0x13c0('0x16')]);}logger['error'](_0x13c0('0x10'),_0x3ffeec,_0x1e9939['error'][_0x13c0('0x16')]);return _0x5ad515(_0x1e9939[_0x13c0('0x15')][_0x13c0('0x16')]);}else{logger['info'](_0x13c0('0x10'),_0x3ffeec,'request\x20sent');_0x5ad515(_0x1e9939['result'][_0x13c0('0x16')]);}})[_0x13c0('0x17')](function(_0x2a5764){logger[_0x13c0('0x15')](_0x13c0('0x10'),_0x3ffeec,_0x2a5764);_0x2baaf6(_0x2a5764);});});}exports[_0x13c0('0x18')]=function(_0x2f7a5f){var _0x435b16=this;return new Promise(function(_0x2b8228,_0x3ad89f){return db[_0x13c0('0x19')][_0x13c0('0x1a')](_0x2f7a5f[_0x13c0('0x1b')],{'raw':_0x2f7a5f[_0x13c0('0x1c')]?_0x2f7a5f[_0x13c0('0x1c')][_0x13c0('0x1d')]===undefined?!![]:![]:!![]})[_0x13c0('0xe')](function(_0x406ed3){logger['info']('CreateSquareRecording',_0x2f7a5f);logger[_0x13c0('0x12')]('CreateSquareRecording',_0x2f7a5f,JSON[_0x13c0('0x14')](_0x406ed3));_0x2b8228(_0x406ed3);})[_0x13c0('0x17')](function(_0x4d21bd){logger['error'](_0x13c0('0x18'),_0x4d21bd['message'],_0x2f7a5f);_0x3ad89f(_0x435b16[_0x13c0('0x15')](0x1f4,_0x4d21bd[_0x13c0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ef2f6fb..7489c76 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xff7c9e,_0x3b0d4d){var _0x31af3d=function(_0x22c6b2){while(--_0x22c6b2){_0xff7c9e['push'](_0xff7c9e['shift']());}};_0x31af3d(++_0x3b0d4d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x542f45,_0x58705f){var _0x499fc8=function(_0x4d2fbb){while(--_0x4d2fbb){_0x542f45['push'](_0x542f45['shift']());}};_0x499fc8(++_0x58705f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 996655b..2c1a3c6 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 _0x1ad3=['BOOLEAN','STRING','DATE'];(function(_0x5a6a35,_0x3207d4){var _0x1a8d4b=function(_0x3ce9e0){while(--_0x3ce9e0){_0x5a6a35['push'](_0x5a6a35['shift']());}};_0x1a8d4b(++_0x3207d4);}(_0x1ad3,0xd6));var _0x31ad=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x1ad3[_0x468a77];return _0x2d1c33;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x31ad('0x0')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x31ad('0x0')]},'channel':{'type':Sequelize[_0x31ad('0x0')]},'language':{'type':Sequelize[_0x31ad('0x0')]},'type':{'type':Sequelize[_0x31ad('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x31ad('0x0')]},'callerid':{'type':Sequelize[_0x31ad('0x0')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x31ad('0x0')]},'callingani2':{'type':Sequelize[_0x31ad('0x0')]},'callington':{'type':Sequelize[_0x31ad('0x0')]},'callingtns':{'type':Sequelize[_0x31ad('0x0')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x31ad('0x0')]},'context':{'type':Sequelize[_0x31ad('0x0')]},'extension':{'type':Sequelize[_0x31ad('0x0')]},'priority':{'type':Sequelize[_0x31ad('0x0')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x31ad('0x0')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x31ad('0x1')]},'leaveAt':{'type':Sequelize[_0x31ad('0x1')]},'bot':{'type':Sequelize[_0x31ad('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x74d5=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x206e79,_0x5e5cf2){var _0x89597c=function(_0x581ea1){while(--_0x581ea1){_0x206e79['push'](_0x206e79['shift']());}};_0x89597c(++_0x5e5cf2);}(_0x74d5,0x13b));var _0x574d=function(_0x4266b4,_0x4859ad){_0x4266b4=_0x4266b4-0x0;var _0x1442aa=_0x74d5[_0x4266b4];return _0x1442aa;};'use strict';var Sequelize=require(_0x574d('0x0'));module[_0x574d('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x574d('0x2')]},'request':{'type':Sequelize[_0x574d('0x2')]},'channel':{'type':Sequelize[_0x574d('0x2')]},'language':{'type':Sequelize[_0x574d('0x2')]},'type':{'type':Sequelize[_0x574d('0x2')]},'uniqueid':{'type':Sequelize[_0x574d('0x2')]},'version':{'type':Sequelize[_0x574d('0x2')]},'callerid':{'type':Sequelize[_0x574d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x574d('0x2')]},'callingani2':{'type':Sequelize[_0x574d('0x2')]},'callington':{'type':Sequelize[_0x574d('0x2')]},'callingtns':{'type':Sequelize[_0x574d('0x2')]},'dnid':{'type':Sequelize[_0x574d('0x2')]},'rdnis':{'type':Sequelize[_0x574d('0x2')]},'context':{'type':Sequelize[_0x574d('0x2')]},'extension':{'type':Sequelize[_0x574d('0x2')]},'priority':{'type':Sequelize[_0x574d('0x2')]},'enhanced':{'type':Sequelize[_0x574d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x574d('0x2')]},'project_name':{'type':Sequelize[_0x574d('0x2')]},'joinAt':{'type':Sequelize[_0x574d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x574d('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 3c46676..99eb1e3 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 _0xb3e3=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','includeAll','SquareReport','findAll','rows','catch','params','keys','include','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0xb3e3,0x114));var _0x3b3e=function(_0x828eee,_0x3f1299){_0x828eee=_0x828eee-0x0;var _0x513622=_0xb3e3[_0x828eee];return _0x513622;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b3e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b3e('0x1'));var rp=require(_0x3b3e('0x2'));var moment=require('moment');var BPromise=require(_0x3b3e('0x3'));var Mustache=require(_0x3b3e('0x4'));var util=require('util');var path=require(_0x3b3e('0x5'));var sox=require(_0x3b3e('0x6'));var csv=require('to-csv');var ejs=require(_0x3b3e('0x7'));var fs=require('fs');var fs_extra=require(_0x3b3e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b3e('0x9'));var jsforce=require(_0x3b3e('0xa'));var deskjs=require(_0x3b3e('0xb'));var toCsv=require(_0x3b3e('0xc'));var querystring=require(_0x3b3e('0xd'));var Papa=require('papaparse');var Redis=require(_0x3b3e('0xe'));var authService=require(_0x3b3e('0xf'));var qs=require(_0x3b3e('0x10'));var as=require(_0x3b3e('0x11'));var hardwareService=require(_0x3b3e('0x12'));var logger=require('../../config/logger')(_0x3b3e('0x13'));var utils=require(_0x3b3e('0x14'));var config=require(_0x3b3e('0x15'));var licenseUtil=require(_0x3b3e('0x16'));var db=require(_0x3b3e('0x17'))['db'];function respondWithStatusCode(_0x4d5909,_0x4abb56){_0x4abb56=_0x4abb56||0xcc;return function(_0x4bff49){if(_0x4bff49){return _0x4d5909[_0x3b3e('0x18')](_0x4abb56);}return _0x4d5909[_0x3b3e('0x19')](_0x4abb56)[_0x3b3e('0x1a')]();};}function respondWithResult(_0x4a1578,_0x4c18e8){_0x4c18e8=_0x4c18e8||0xc8;return function(_0xb0cf58){if(_0xb0cf58){return _0x4a1578[_0x3b3e('0x19')](_0x4c18e8)[_0x3b3e('0x1b')](_0xb0cf58);}};}function respondWithFilteredResult(_0xc90756,_0x1f919a){return function(_0x1f871a){if(_0x1f871a){var _0x35e08d=typeof _0x1f919a[_0x3b3e('0x1c')]===_0x3b3e('0x1d')&&typeof _0x1f919a[_0x3b3e('0x1e')]===_0x3b3e('0x1d');var _0x2753a3=_0x1f871a[_0x3b3e('0x1f')];var _0x97c72f=_0x35e08d?0x0:_0x1f919a[_0x3b3e('0x1c')];var _0x176229=_0x35e08d?_0x1f871a[_0x3b3e('0x1f')]:_0x1f919a[_0x3b3e('0x1c')]+_0x1f919a[_0x3b3e('0x1e')];var _0x3b5d57;if(_0x176229>=_0x2753a3){_0x176229=_0x2753a3;_0x3b5d57=0xc8;}else{_0x3b5d57=0xce;}_0xc90756[_0x3b3e('0x19')](_0x3b5d57);return _0xc90756[_0x3b3e('0x20')](_0x3b3e('0x21'),_0x97c72f+'-'+_0x176229+'/'+_0x2753a3)[_0x3b3e('0x1b')](_0x1f871a);}return null;};}function patchUpdates(_0xd827d9){return function(_0x2680c8){try{jsonpatch[_0x3b3e('0x22')](_0x2680c8,_0xd827d9,!![]);}catch(_0x5e08c4){return BPromise[_0x3b3e('0x23')](_0x5e08c4);}return _0x2680c8[_0x3b3e('0x24')]();};}function saveUpdates(_0x3daec6,_0x38a835){return function(_0x13fc06){if(_0x13fc06){return _0x13fc06[_0x3b3e('0x25')](_0x3daec6)['then'](function(_0x1df24a){return _0x1df24a;});}return null;};}function removeEntity(_0x59ac85,_0x19e4ff){return function(_0x29ddaf){if(_0x29ddaf){return _0x29ddaf[_0x3b3e('0x26')]()[_0x3b3e('0x27')](function(){_0x59ac85[_0x3b3e('0x19')](0xcc)[_0x3b3e('0x1a')]();});}};}function handleEntityNotFound(_0x1f4e8d,_0xfb819a){return function(_0x13520e){if(!_0x13520e){_0x1f4e8d[_0x3b3e('0x18')](0x194);}return _0x13520e;};}function handleError(_0x4f3dc1,_0x57b99b){_0x57b99b=_0x57b99b||0x1f4;return function(_0x4a81ff){logger[_0x3b3e('0x28')](_0x4a81ff['stack']);if(_0x4a81ff[_0x3b3e('0x29')]){delete _0x4a81ff[_0x3b3e('0x29')];}_0x4f3dc1[_0x3b3e('0x19')](_0x57b99b)[_0x3b3e('0x2a')](_0x4a81ff);};}exports[_0x3b3e('0x2b')]=function(_0x2a9190,_0xc40dea){var _0x3236ec={},_0x21af47={},_0x209987={'count':0x0,'rows':[]};var _0x77a3e6=_[_0x3b3e('0x2c')](db['SquareReport'][_0x3b3e('0x2d')],function(_0x4e24f9){return{'name':_0x4e24f9[_0x3b3e('0x2e')],'type':_0x4e24f9[_0x3b3e('0x2f')][_0x3b3e('0x30')]};});_0x21af47['model']=_[_0x3b3e('0x2c')](_0x77a3e6,'name');_0x21af47[_0x3b3e('0x31')]=_['keys'](_0x2a9190[_0x3b3e('0x31')]);_0x21af47[_0x3b3e('0x32')]=_[_0x3b3e('0x33')](_0x21af47[_0x3b3e('0x34')],_0x21af47['query']);_0x3236ec[_0x3b3e('0x35')]=_[_0x3b3e('0x33')](_0x21af47[_0x3b3e('0x34')],qs[_0x3b3e('0x36')](_0x2a9190['query'][_0x3b3e('0x36')]));_0x3236ec[_0x3b3e('0x35')]=_0x3236ec[_0x3b3e('0x35')][_0x3b3e('0x37')]?_0x3236ec['attributes']:_0x21af47['model'];if(!_0x2a9190[_0x3b3e('0x31')][_0x3b3e('0x38')]('nolimit')){_0x3236ec[_0x3b3e('0x1e')]=qs[_0x3b3e('0x1e')](_0x2a9190[_0x3b3e('0x31')][_0x3b3e('0x1e')]);_0x3236ec['offset']=qs[_0x3b3e('0x1c')](_0x2a9190['query'][_0x3b3e('0x1c')]);}_0x3236ec['order']=qs['sort'](_0x2a9190['query']['sort']);_0x3236ec[_0x3b3e('0x39')]=qs[_0x3b3e('0x32')](_[_0x3b3e('0x3a')](_0x2a9190[_0x3b3e('0x31')],_0x21af47[_0x3b3e('0x32')]),_0x77a3e6);if(_0x2a9190['query'][_0x3b3e('0x3b')]){_0x3236ec[_0x3b3e('0x39')]=_[_0x3b3e('0x3c')](_0x3236ec[_0x3b3e('0x39')],{'$or':_[_0x3b3e('0x2c')](_0x77a3e6,function(_0x4a69ee){if(_0x4a69ee[_0x3b3e('0x2f')]!==_0x3b3e('0x3d')){var _0x13edc5={};_0x13edc5[_0x4a69ee[_0x3b3e('0x29')]]={'$like':'%'+_0x2a9190[_0x3b3e('0x31')][_0x3b3e('0x3b')]+'%'};return _0x13edc5;}})});}_0x3236ec=_[_0x3b3e('0x3c')]({},_0x3236ec,_0x2a9190['options']);var _0x578fe7={'where':_0x3236ec[_0x3b3e('0x39')]};return db['SquareReport'][_0x3b3e('0x1f')](_0x578fe7)['then'](function(_0x1b1032){_0x209987[_0x3b3e('0x1f')]=_0x1b1032;if(_0x2a9190[_0x3b3e('0x31')][_0x3b3e('0x3e')]){_0x3236ec['include']=[{'all':!![]}];}return db[_0x3b3e('0x3f')][_0x3b3e('0x40')](_0x3236ec);})[_0x3b3e('0x27')](function(_0x153ea4){_0x209987[_0x3b3e('0x41')]=_0x153ea4;return _0x209987;})[_0x3b3e('0x27')](respondWithFilteredResult(_0xc40dea,_0x3236ec))[_0x3b3e('0x42')](handleError(_0xc40dea,null));};exports['show']=function(_0x5c34db,_0x56ad34){var _0x1e8576={'raw':!![],'where':{'id':_0x5c34db[_0x3b3e('0x43')]['id']}},_0xfe4095={};_0xfe4095[_0x3b3e('0x34')]=_[_0x3b3e('0x44')](db[_0x3b3e('0x3f')][_0x3b3e('0x2d')]);_0xfe4095[_0x3b3e('0x31')]=_[_0x3b3e('0x44')](_0x5c34db['query']);_0xfe4095[_0x3b3e('0x32')]=_[_0x3b3e('0x33')](_0xfe4095[_0x3b3e('0x34')],_0xfe4095['query']);_0x1e8576[_0x3b3e('0x35')]=_[_0x3b3e('0x33')](_0xfe4095[_0x3b3e('0x34')],qs['fields'](_0x5c34db['query'][_0x3b3e('0x36')]));_0x1e8576[_0x3b3e('0x35')]=_0x1e8576['attributes'][_0x3b3e('0x37')]?_0x1e8576[_0x3b3e('0x35')]:_0xfe4095[_0x3b3e('0x34')];if(_0x5c34db[_0x3b3e('0x31')]['includeAll']){_0x1e8576[_0x3b3e('0x45')]=[{'all':!![]}];}_0x1e8576=_[_0x3b3e('0x3c')]({},_0x1e8576,_0x5c34db[_0x3b3e('0x46')]);return db['SquareReport'][_0x3b3e('0x47')](_0x1e8576)[_0x3b3e('0x27')](handleEntityNotFound(_0x56ad34,null))[_0x3b3e('0x27')](respondWithResult(_0x56ad34,null))[_0x3b3e('0x42')](handleError(_0x56ad34,null));};exports[_0x3b3e('0x48')]=function(_0x5c536b,_0x3f3134){return db[_0x3b3e('0x3f')][_0x3b3e('0x48')](_0x5c536b[_0x3b3e('0x49')],{})[_0x3b3e('0x27')](respondWithResult(_0x3f3134,0xc9))[_0x3b3e('0x42')](handleError(_0x3f3134,null));};exports['update']=function(_0x484740,_0x3f5e5a){if(_0x484740[_0x3b3e('0x49')]['id']){delete _0x484740[_0x3b3e('0x49')]['id'];}return db[_0x3b3e('0x3f')][_0x3b3e('0x47')]({'where':{'id':_0x484740[_0x3b3e('0x43')]['id']}})[_0x3b3e('0x27')](handleEntityNotFound(_0x3f5e5a,null))[_0x3b3e('0x27')](saveUpdates(_0x484740['body'],null))[_0x3b3e('0x27')](respondWithResult(_0x3f5e5a,null))['catch'](handleError(_0x3f5e5a,null));};exports['destroy']=function(_0x200805,_0x3a019b){return db[_0x3b3e('0x3f')][_0x3b3e('0x47')]({'where':{'id':_0x200805[_0x3b3e('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a019b,null))[_0x3b3e('0x27')](removeEntity(_0x3a019b,null))[_0x3b3e('0x42')](handleError(_0x3a019b,null));};exports[_0x3b3e('0x4a')]=function(_0x1b8aea,_0x1a6cd2){return db[_0x3b3e('0x3f')][_0x3b3e('0x4a')]()['then'](respondWithResult(_0x1a6cd2,null))['catch'](handleError(_0x1a6cd2,null));}; \ No newline at end of file +var _0xc719=['util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x35f636,_0x1f40ef){var _0x2e871b=function(_0x4b686a){while(--_0x4b686a){_0x35f636['push'](_0x35f636['shift']());}};_0x2e871b(++_0x1f40ef);}(_0xc719,0x8e));var _0x9c71=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0xc719[_0x389832];return _0x59429e;};'use strict';var emlformat=require(_0x9c71('0x0'));var rimraf=require(_0x9c71('0x1'));var zipdir=require(_0x9c71('0x2'));var jsonpatch=require(_0x9c71('0x3'));var rp=require('request-promise');var moment=require(_0x9c71('0x4'));var BPromise=require(_0x9c71('0x5'));var Mustache=require('mustache');var util=require(_0x9c71('0x6'));var path=require(_0x9c71('0x7'));var sox=require(_0x9c71('0x8'));var csv=require('to-csv');var ejs=require(_0x9c71('0x9'));var fs=require('fs');var fs_extra=require(_0x9c71('0xa'));var _=require(_0x9c71('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9c71('0xc'));var toCsv=require(_0x9c71('0xd'));var querystring=require(_0x9c71('0xe'));var Papa=require(_0x9c71('0xf'));var Redis=require(_0x9c71('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c71('0x11'));var logger=require(_0x9c71('0x12'))(_0x9c71('0x13'));var utils=require(_0x9c71('0x14'));var config=require(_0x9c71('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c71('0x16'))['db'];function respondWithStatusCode(_0x326ae8,_0x2bc028){_0x2bc028=_0x2bc028||0xcc;return function(_0x51867d){if(_0x51867d){return _0x326ae8[_0x9c71('0x17')](_0x2bc028);}return _0x326ae8[_0x9c71('0x18')](_0x2bc028)[_0x9c71('0x19')]();};}function respondWithResult(_0x3a098f,_0x82fae6){_0x82fae6=_0x82fae6||0xc8;return function(_0x24e7e7){if(_0x24e7e7){return _0x3a098f[_0x9c71('0x18')](_0x82fae6)[_0x9c71('0x1a')](_0x24e7e7);}};}function respondWithFilteredResult(_0x11701f,_0x5d8a40){return function(_0x257d6d){if(_0x257d6d){var _0xf21ea4=typeof _0x5d8a40[_0x9c71('0x1b')]===_0x9c71('0x1c')&&typeof _0x5d8a40[_0x9c71('0x1d')]===_0x9c71('0x1c');var _0x2a94ac=_0x257d6d['count'];var _0x47435a=_0xf21ea4?0x0:_0x5d8a40[_0x9c71('0x1b')];var _0x3483ff=_0xf21ea4?_0x257d6d[_0x9c71('0x1e')]:_0x5d8a40[_0x9c71('0x1b')]+_0x5d8a40['limit'];var _0xc1b51a;if(_0x3483ff>=_0x2a94ac){_0x3483ff=_0x2a94ac;_0xc1b51a=0xc8;}else{_0xc1b51a=0xce;}_0x11701f['status'](_0xc1b51a);return _0x11701f[_0x9c71('0x1f')](_0x9c71('0x20'),_0x47435a+'-'+_0x3483ff+'/'+_0x2a94ac)[_0x9c71('0x1a')](_0x257d6d);}return null;};}function patchUpdates(_0x5f2af8){return function(_0x2ff5c5){try{jsonpatch[_0x9c71('0x21')](_0x2ff5c5,_0x5f2af8,!![]);}catch(_0x4e5637){return BPromise['reject'](_0x4e5637);}return _0x2ff5c5[_0x9c71('0x22')]();};}function saveUpdates(_0x352655,_0x34c532){return function(_0x1a6be8){if(_0x1a6be8){return _0x1a6be8['update'](_0x352655)['then'](function(_0x13d663){return _0x13d663;});}return null;};}function removeEntity(_0x5fbb6d,_0x4f6143){return function(_0x51cc04){if(_0x51cc04){return _0x51cc04[_0x9c71('0x23')]()[_0x9c71('0x24')](function(){_0x5fbb6d[_0x9c71('0x18')](0xcc)[_0x9c71('0x19')]();});}};}function handleEntityNotFound(_0x5cc312,_0x5e9499){return function(_0xa8baa5){if(!_0xa8baa5){_0x5cc312[_0x9c71('0x17')](0x194);}return _0xa8baa5;};}function handleError(_0x42f751,_0x1b42a8){_0x1b42a8=_0x1b42a8||0x1f4;return function(_0x2734e4){logger[_0x9c71('0x25')](_0x2734e4['stack']);if(_0x2734e4[_0x9c71('0x26')]){delete _0x2734e4[_0x9c71('0x26')];}_0x42f751[_0x9c71('0x18')](_0x1b42a8)[_0x9c71('0x27')](_0x2734e4);};}exports[_0x9c71('0x28')]=function(_0x465cd8,_0x2ab41f){var _0x1ac6c6={},_0x20d715={},_0x299a71={'count':0x0,'rows':[]};var _0x319391=_[_0x9c71('0x29')](db[_0x9c71('0x2a')][_0x9c71('0x2b')],function(_0xb85ad0){return{'name':_0xb85ad0[_0x9c71('0x2c')],'type':_0xb85ad0[_0x9c71('0x2d')][_0x9c71('0x2e')]};});_0x20d715[_0x9c71('0x2f')]=_[_0x9c71('0x29')](_0x319391,_0x9c71('0x26'));_0x20d715[_0x9c71('0x30')]=_['keys'](_0x465cd8['query']);_0x20d715[_0x9c71('0x31')]=_['intersection'](_0x20d715[_0x9c71('0x2f')],_0x20d715[_0x9c71('0x30')]);_0x1ac6c6[_0x9c71('0x32')]=_[_0x9c71('0x33')](_0x20d715['model'],qs[_0x9c71('0x34')](_0x465cd8[_0x9c71('0x30')]['fields']));_0x1ac6c6[_0x9c71('0x32')]=_0x1ac6c6[_0x9c71('0x32')]['length']?_0x1ac6c6[_0x9c71('0x32')]:_0x20d715[_0x9c71('0x2f')];if(!_0x465cd8['query']['hasOwnProperty'](_0x9c71('0x35'))){_0x1ac6c6['limit']=qs[_0x9c71('0x1d')](_0x465cd8[_0x9c71('0x30')][_0x9c71('0x1d')]);_0x1ac6c6[_0x9c71('0x1b')]=qs[_0x9c71('0x1b')](_0x465cd8[_0x9c71('0x30')][_0x9c71('0x1b')]);}_0x1ac6c6['order']=qs[_0x9c71('0x36')](_0x465cd8[_0x9c71('0x30')][_0x9c71('0x36')]);_0x1ac6c6['where']=qs[_0x9c71('0x31')](_[_0x9c71('0x37')](_0x465cd8['query'],_0x20d715[_0x9c71('0x31')]),_0x319391);if(_0x465cd8[_0x9c71('0x30')][_0x9c71('0x38')]){_0x1ac6c6[_0x9c71('0x39')]=_[_0x9c71('0x3a')](_0x1ac6c6['where'],{'$or':_[_0x9c71('0x29')](_0x319391,function(_0x247959){if(_0x247959[_0x9c71('0x2d')]!==_0x9c71('0x3b')){var _0x291221={};_0x291221[_0x247959[_0x9c71('0x26')]]={'$like':'%'+_0x465cd8['query'][_0x9c71('0x38')]+'%'};return _0x291221;}})});}_0x1ac6c6=_[_0x9c71('0x3a')]({},_0x1ac6c6,_0x465cd8[_0x9c71('0x3c')]);var _0x82a301={'where':_0x1ac6c6[_0x9c71('0x39')]};return db[_0x9c71('0x2a')]['count'](_0x82a301)[_0x9c71('0x24')](function(_0x35a0f2){_0x299a71[_0x9c71('0x1e')]=_0x35a0f2;if(_0x465cd8[_0x9c71('0x30')][_0x9c71('0x3d')]){_0x1ac6c6['include']=[{'all':!![]}];}return db[_0x9c71('0x2a')][_0x9c71('0x3e')](_0x1ac6c6);})['then'](function(_0x2b7c5c){_0x299a71[_0x9c71('0x3f')]=_0x2b7c5c;return _0x299a71;})['then'](respondWithFilteredResult(_0x2ab41f,_0x1ac6c6))['catch'](handleError(_0x2ab41f,null));};exports[_0x9c71('0x40')]=function(_0x525b9b,_0x46a945){var _0x15f3b8={'raw':!![],'where':{'id':_0x525b9b[_0x9c71('0x41')]['id']}},_0x22f00a={};_0x22f00a['model']=_['keys'](db['SquareReport'][_0x9c71('0x2b')]);_0x22f00a[_0x9c71('0x30')]=_[_0x9c71('0x42')](_0x525b9b['query']);_0x22f00a[_0x9c71('0x31')]=_['intersection'](_0x22f00a[_0x9c71('0x2f')],_0x22f00a[_0x9c71('0x30')]);_0x15f3b8[_0x9c71('0x32')]=_[_0x9c71('0x33')](_0x22f00a[_0x9c71('0x2f')],qs['fields'](_0x525b9b[_0x9c71('0x30')][_0x9c71('0x34')]));_0x15f3b8[_0x9c71('0x32')]=_0x15f3b8[_0x9c71('0x32')][_0x9c71('0x43')]?_0x15f3b8[_0x9c71('0x32')]:_0x22f00a[_0x9c71('0x2f')];if(_0x525b9b[_0x9c71('0x30')][_0x9c71('0x3d')]){_0x15f3b8[_0x9c71('0x44')]=[{'all':!![]}];}_0x15f3b8=_[_0x9c71('0x3a')]({},_0x15f3b8,_0x525b9b[_0x9c71('0x3c')]);return db['SquareReport']['find'](_0x15f3b8)[_0x9c71('0x24')](handleEntityNotFound(_0x46a945,null))[_0x9c71('0x24')](respondWithResult(_0x46a945,null))[_0x9c71('0x45')](handleError(_0x46a945,null));};exports['create']=function(_0x258985,_0x3b4864){return db[_0x9c71('0x2a')][_0x9c71('0x46')](_0x258985[_0x9c71('0x47')],{})['then'](respondWithResult(_0x3b4864,0xc9))['catch'](handleError(_0x3b4864,null));};exports['update']=function(_0x468960,_0x3bd336){if(_0x468960[_0x9c71('0x47')]['id']){delete _0x468960[_0x9c71('0x47')]['id'];}return db[_0x9c71('0x2a')][_0x9c71('0x48')]({'where':{'id':_0x468960[_0x9c71('0x41')]['id']}})[_0x9c71('0x24')](handleEntityNotFound(_0x3bd336,null))[_0x9c71('0x24')](saveUpdates(_0x468960[_0x9c71('0x47')],null))[_0x9c71('0x24')](respondWithResult(_0x3bd336,null))['catch'](handleError(_0x3bd336,null));};exports[_0x9c71('0x23')]=function(_0xe5a27,_0x3523c6){return db[_0x9c71('0x2a')][_0x9c71('0x48')]({'where':{'id':_0xe5a27[_0x9c71('0x41')]['id']}})[_0x9c71('0x24')](handleEntityNotFound(_0x3523c6,null))[_0x9c71('0x24')](removeEntity(_0x3523c6,null))[_0x9c71('0x45')](handleError(_0x3523c6,null));};exports['describe']=function(_0x2ae405,_0x307811){return db[_0x9c71('0x2a')][_0x9c71('0x49')]()['then'](respondWithResult(_0x307811,null))[_0x9c71('0x45')](handleError(_0x307811,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b0cc486..6f95fc0 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 _0xbaa5=['report_square','uid_pname','project_name','leaveAt','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','SquareReport'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xbaa5,0x18c));var _0x5baa=function(_0x47469d,_0x60b2d1){_0x47469d=_0x47469d-0x0;var _0x5a0e51=_0xbaa5[_0x47469d];return _0x5a0e51;};'use strict';var _=require('lodash');var util=require(_0x5baa('0x0'));var logger=require(_0x5baa('0x1'))(_0x5baa('0x2'));var moment=require('moment');var BPromise=require(_0x5baa('0x3'));var rp=require(_0x5baa('0x4'));var fs=require('fs');var path=require(_0x5baa('0x5'));var rimraf=require(_0x5baa('0x6'));var config=require(_0x5baa('0x7'));var attributes=require(_0x5baa('0x8'));module['exports']=function(_0x470f2f,_0x196bf8){return _0x470f2f['define'](_0x5baa('0x9'),attributes,{'tableName':_0x5baa('0xa'),'paranoid':![],'indexes':[{'name':_0x5baa('0xb'),'fields':['uniqueid',_0x5baa('0xc')]},{'name':'leaveAt','fields':[_0x5baa('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e6c=['moment','request-promise','path','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','api'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x1e6c,0x1df));var _0xc1e6=function(_0x22ed4b,_0x20609c){_0x22ed4b=_0x22ed4b-0x0;var _0x4e9cf6=_0x1e6c[_0x22ed4b];return _0x4e9cf6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc1e6('0x0'));var moment=require(_0xc1e6('0x1'));var BPromise=require('bluebird');var rp=require(_0xc1e6('0x2'));var fs=require('fs');var path=require(_0xc1e6('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc1e6('0x4'));module[_0xc1e6('0x5')]=function(_0x27b92a,_0x532983){return _0x27b92a[_0xc1e6('0x6')](_0xc1e6('0x7'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xc1e6('0x8'),'fields':[_0xc1e6('0x9'),_0xc1e6('0xa')]},{'name':'leaveAt','fields':[_0xc1e6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 66133ec..2eec571 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 _0x620b=['SquareReport,\x20%s,\x20%s','result','catch','SquareReport','create','body','options','CreateSquareReport','stringify','UpdateSquareReport','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5cf102,_0x3e000d){var _0x44913a=function(_0x77ed83){while(--_0x77ed83){_0x5cf102['push'](_0x5cf102['shift']());}};_0x44913a(++_0x3e000d);}(_0x620b,0x1b1));var _0xb620=function(_0x4ff928,_0x221965){_0x4ff928=_0x4ff928-0x0;var _0x505fb1=_0x620b[_0x4ff928];return _0x505fb1;};'use strict';var _=require(_0xb620('0x0'));var util=require('util');var moment=require(_0xb620('0x1'));var BPromise=require(_0xb620('0x2'));var rs=require(_0xb620('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb620('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb620('0x5'))(_0xb620('0x6'));var config=require(_0xb620('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb620('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x523f47,_0x311432,_0x475f93){return new BPromise(function(_0x374a31,_0x39a40e){return client[_0xb620('0x9')](_0x523f47,_0x475f93)[_0xb620('0xa')](function(_0x108bee){logger[_0xb620('0xb')]('SquareReport,\x20%s,\x20%s',_0x311432,_0xb620('0xc'));logger[_0xb620('0xd')](_0xb620('0xe'),_0x311432,_0xb620('0xc'),JSON['stringify'](_0x108bee));if(_0x108bee[_0xb620('0xf')]){if(_0x108bee[_0xb620('0xf')]['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x311432,_0x108bee['error'][_0xb620('0x10')]);return _0x39a40e(_0x108bee[_0xb620('0xf')][_0xb620('0x10')]);}logger['error'](_0xb620('0x11'),_0x311432,_0x108bee[_0xb620('0xf')][_0xb620('0x10')]);return _0x374a31(_0x108bee['error']['message']);}else{logger[_0xb620('0xb')](_0xb620('0x11'),_0x311432,'request\x20sent');_0x374a31(_0x108bee[_0xb620('0x12')]['message']);}})[_0xb620('0x13')](function(_0x3f61a3){logger[_0xb620('0xf')](_0xb620('0x11'),_0x311432,_0x3f61a3);_0x39a40e(_0x3f61a3);});});}exports['CreateSquareReport']=function(_0x5a3852){var _0x29bcf0=this;return new Promise(function(_0x51372f,_0x5162e5){return db[_0xb620('0x14')][_0xb620('0x15')](_0x5a3852[_0xb620('0x16')],{'raw':_0x5a3852[_0xb620('0x17')]?_0x5a3852[_0xb620('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xb620('0xa')](function(_0x4bbdb7){logger[_0xb620('0xb')]('CreateSquareReport',_0x5a3852);logger[_0xb620('0xd')](_0xb620('0x18'),_0x5a3852,JSON[_0xb620('0x19')](_0x4bbdb7));_0x51372f(_0x4bbdb7);})[_0xb620('0x13')](function(_0xd49c23){logger['error']('CreateSquareReport',_0xd49c23[_0xb620('0x10')],_0x5a3852);_0x5162e5(_0x29bcf0[_0xb620('0xf')](0x1f4,_0xd49c23[_0xb620('0x10')]));});});};exports[_0xb620('0x1a')]=function(_0x3d462e){var _0x7058f7=this;return new Promise(function(_0x301e59,_0x104ab7){return db[_0xb620('0x14')]['update'](_0x3d462e[_0xb620('0x16')],{'raw':_0x3d462e[_0xb620('0x17')]?_0x3d462e[_0xb620('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d462e[_0xb620('0x17')]?_0x3d462e[_0xb620('0x17')][_0xb620('0x1b')]||null:null,'attributes':_0x3d462e[_0xb620('0x17')]?_0x3d462e[_0xb620('0x17')][_0xb620('0x1c')]||null:null,'limit':_0x3d462e[_0xb620('0x17')]?_0x3d462e[_0xb620('0x17')][_0xb620('0x1d')]||null:null})['then'](function(_0x327aaa){logger[_0xb620('0xb')](_0xb620('0x1a'),_0x3d462e);logger[_0xb620('0xd')]('UpdateSquareReport',_0x3d462e,JSON[_0xb620('0x19')](_0x327aaa));_0x301e59(_0x327aaa);})['catch'](function(_0x17dbdb){logger[_0xb620('0xf')](_0xb620('0x1a'),_0x17dbdb[_0xb620('0x10')],_0x3d462e);_0x104ab7(_0x7058f7[_0xb620('0xf')](0x1f4,_0x17dbdb[_0xb620('0x10')]));});});}; \ No newline at end of file +var _0x434c=['body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','update','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','create'];(function(_0x57402b,_0x496013){var _0xaeadd5=function(_0x327eef){while(--_0x327eef){_0x57402b['push'](_0x57402b['shift']());}};_0xaeadd5(++_0x496013);}(_0x434c,0x174));var _0xc434=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x434c[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xc434('0x0'));var moment=require(_0xc434('0x1'));var BPromise=require(_0xc434('0x2'));var rs=require(_0xc434('0x3'));var fs=require('fs');var Redis=require(_0xc434('0x4'));var db=require(_0xc434('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc434('0x6'))(_0xc434('0x7'));var config=require(_0xc434('0x8'));var jayson=require(_0xc434('0x9'));var client=jayson[_0xc434('0xa')][_0xc434('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2771dd,_0x44e21f,_0x85a273){return new BPromise(function(_0x132d82,_0x152d4e){return client[_0xc434('0xc')](_0x2771dd,_0x85a273)[_0xc434('0xd')](function(_0x2a1ca2){logger[_0xc434('0xe')]('SquareReport,\x20%s,\x20%s',_0x44e21f,_0xc434('0xf'));logger[_0xc434('0x10')](_0xc434('0x11'),_0x44e21f,_0xc434('0xf'),JSON[_0xc434('0x12')](_0x2a1ca2));if(_0x2a1ca2['error']){if(_0x2a1ca2[_0xc434('0x13')]['code']===0x1f4){logger[_0xc434('0x13')](_0xc434('0x14'),_0x44e21f,_0x2a1ca2['error'][_0xc434('0x15')]);return _0x152d4e(_0x2a1ca2[_0xc434('0x13')][_0xc434('0x15')]);}logger[_0xc434('0x13')](_0xc434('0x14'),_0x44e21f,_0x2a1ca2[_0xc434('0x13')]['message']);return _0x132d82(_0x2a1ca2['error'][_0xc434('0x15')]);}else{logger[_0xc434('0xe')](_0xc434('0x14'),_0x44e21f,_0xc434('0xf'));_0x132d82(_0x2a1ca2['result'][_0xc434('0x15')]);}})[_0xc434('0x16')](function(_0x42b101){logger['error']('SquareReport,\x20%s,\x20%s',_0x44e21f,_0x42b101);_0x152d4e(_0x42b101);});});}exports['CreateSquareReport']=function(_0x4921cd){var _0x5cc1ce=this;return new Promise(function(_0x2040cd,_0x530c32){return db['SquareReport'][_0xc434('0x17')](_0x4921cd[_0xc434('0x18')],{'raw':_0x4921cd[_0xc434('0x19')]?_0x4921cd[_0xc434('0x19')][_0xc434('0x1a')]===undefined?!![]:![]:!![]})[_0xc434('0xd')](function(_0x234b19){logger[_0xc434('0xe')](_0xc434('0x1b'),_0x4921cd);logger[_0xc434('0x10')](_0xc434('0x1b'),_0x4921cd,JSON[_0xc434('0x12')](_0x234b19));_0x2040cd(_0x234b19);})[_0xc434('0x16')](function(_0x7ad996){logger[_0xc434('0x13')]('CreateSquareReport',_0x7ad996['message'],_0x4921cd);_0x530c32(_0x5cc1ce[_0xc434('0x13')](0x1f4,_0x7ad996[_0xc434('0x15')]));});});};exports[_0xc434('0x1c')]=function(_0x33ff0b){var _0x457b7b=this;return new Promise(function(_0x2fd290,_0x5d2029){return db[_0xc434('0x1d')][_0xc434('0x1e')](_0x33ff0b[_0xc434('0x18')],{'raw':_0x33ff0b['options']?_0x33ff0b['options'][_0xc434('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ff0b[_0xc434('0x19')]?_0x33ff0b[_0xc434('0x19')][_0xc434('0x1f')]||null:null,'attributes':_0x33ff0b['options']?_0x33ff0b['options'][_0xc434('0x20')]||null:null,'limit':_0x33ff0b[_0xc434('0x19')]?_0x33ff0b[_0xc434('0x19')]['limit']||null:null})[_0xc434('0xd')](function(_0x31ffdc){logger[_0xc434('0xe')]('UpdateSquareReport',_0x33ff0b);logger[_0xc434('0x10')](_0xc434('0x1c'),_0x33ff0b,JSON[_0xc434('0x12')](_0x31ffdc));_0x2fd290(_0x31ffdc);})[_0xc434('0x16')](function(_0x1ce304){logger[_0xc434('0x13')](_0xc434('0x1c'),_0x1ce304[_0xc434('0x15')],_0x33ff0b);_0x5d2029(_0x457b7b[_0xc434('0x13')](0x1f4,_0x1ce304[_0xc434('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 62b85ab..ea08e95 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 _0x5d77=['update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','show','put'];(function(_0x12ab7e,_0x435244){var _0xf9de20=function(_0x480b56){while(--_0x480b56){_0x12ab7e['push'](_0x12ab7e['shift']());}};_0xf9de20(++_0x435244);}(_0x5d77,0x193));var _0x75d7=function(_0x18949e,_0x5b4d53){_0x18949e=_0x18949e-0x0;var _0x2dbab3=_0x5d77[_0x18949e];return _0x2dbab3;};'use strict';var multer=require(_0x75d7('0x0'));var util=require(_0x75d7('0x1'));var path=require(_0x75d7('0x2'));var timeout=require(_0x75d7('0x3'));var express=require(_0x75d7('0x4'));var router=express[_0x75d7('0x5')]();var fs_extra=require(_0x75d7('0x6'));var auth=require(_0x75d7('0x7'));var interaction=require(_0x75d7('0x8'));var config=require('../../config/environment');var controller=require(_0x75d7('0x9'));router[_0x75d7('0xa')]('/',auth[_0x75d7('0xb')](),controller[_0x75d7('0xc')]);router[_0x75d7('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x75d7('0xa')]('/:id',auth[_0x75d7('0xb')](),controller[_0x75d7('0xd')]);router['post']('/',auth[_0x75d7('0xb')](),controller['create']);router[_0x75d7('0xe')]('/:id',auth[_0x75d7('0xb')](),controller[_0x75d7('0xf')]);router[_0x75d7('0x10')](_0x75d7('0x11'),auth[_0x75d7('0xb')](),controller[_0x75d7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x369c=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x369c,0x17b));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc369('0x0'));var path=require(_0xc369('0x1'));var timeout=require(_0xc369('0x2'));var express=require(_0xc369('0x3'));var router=express[_0xc369('0x4')]();var fs_extra=require(_0xc369('0x5'));var auth=require(_0xc369('0x6'));var interaction=require(_0xc369('0x7'));var config=require('../../config/environment');var controller=require(_0xc369('0x8'));router[_0xc369('0x9')]('/',auth[_0xc369('0xa')](),controller[_0xc369('0xb')]);router[_0xc369('0x9')](_0xc369('0xc'),auth[_0xc369('0xa')](),controller['describe']);router[_0xc369('0x9')](_0xc369('0xd'),auth['isAuthenticated'](),controller[_0xc369('0xe')]);router[_0xc369('0xf')]('/',auth[_0xc369('0xa')](),controller[_0xc369('0x10')]);router[_0xc369('0x11')](_0xc369('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xc369('0x12')](_0xc369('0xd'),auth[_0xc369('0xa')](),controller[_0xc369('0x13')]);module[_0xc369('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index ed0279f..6415f98 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 _0xa4b3=['sequelize','STRING','TEXT'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xa4b3,0xc9));var _0x3a4b=function(_0x3bd447,_0xe66643){_0x3bd447=_0x3bd447-0x0;var _0x51740c=_0xa4b3[_0x3bd447];return _0x51740c;};'use strict';var Sequelize=require(_0x3a4b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3a4b('0x1')]},'node':{'type':Sequelize[_0x3a4b('0x1')]},'application':{'type':Sequelize[_0x3a4b('0x1')]},'data':{'type':Sequelize[_0x3a4b('0x2')]},'project_name':{'type':Sequelize[_0x3a4b('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x52e3=['STRING','exports'];(function(_0x231110,_0xce98a6){var _0x3d850c=function(_0x1658b3){while(--_0x1658b3){_0x231110['push'](_0x231110['shift']());}};_0x3d850c(++_0xce98a6);}(_0x52e3,0x11b));var _0x352e=function(_0x2a816b,_0x21eef){_0x2a816b=_0x2a816b-0x0;var _0x1a9aaa=_0x52e3[_0x2a816b];return _0x1a9aaa;};'use strict';var Sequelize=require('sequelize');module[_0x352e('0x0')]={'uniqueid':{'type':Sequelize[_0x352e('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x352e('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x352e('0x1')]},'callerid':{'type':Sequelize[_0x352e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a6ca727..e66f354 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 _0x32b9=['filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters'];(function(_0x4f4902,_0x2de251){var _0x3f350a=function(_0x5bf866){while(--_0x5bf866){_0x4f4902['push'](_0x4f4902['shift']());}};_0x3f350a(++_0x2de251);}(_0x32b9,0xf0));var _0x932b=function(_0x4c9fb3,_0x70c50d){_0x4c9fb3=_0x4c9fb3-0x0;var _0x5e7b18=_0x32b9[_0x4c9fb3];return _0x5e7b18;};'use strict';var emlformat=require(_0x932b('0x0'));var rimraf=require(_0x932b('0x1'));var zipdir=require(_0x932b('0x2'));var jsonpatch=require(_0x932b('0x3'));var rp=require(_0x932b('0x4'));var moment=require(_0x932b('0x5'));var BPromise=require(_0x932b('0x6'));var Mustache=require(_0x932b('0x7'));var util=require('util');var path=require(_0x932b('0x8'));var sox=require('sox');var csv=require(_0x932b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x932b('0xa'));var _=require('lodash');var squel=require(_0x932b('0xb'));var crypto=require('crypto');var jsforce=require(_0x932b('0xc'));var deskjs=require(_0x932b('0xd'));var toCsv=require(_0x932b('0x9'));var querystring=require('querystring');var Papa=require(_0x932b('0xe'));var Redis=require('ioredis');var authService=require(_0x932b('0xf'));var qs=require(_0x932b('0x10'));var as=require(_0x932b('0x11'));var hardwareService=require(_0x932b('0x12'));var logger=require(_0x932b('0x13'))(_0x932b('0x14'));var utils=require('../../config/utils');var config=require(_0x932b('0x15'));var licenseUtil=require(_0x932b('0x16'));var db=require(_0x932b('0x17'))['db'];function respondWithStatusCode(_0x129f0a,_0x19a35f){_0x19a35f=_0x19a35f||0xcc;return function(_0x20e1b0){if(_0x20e1b0){return _0x129f0a[_0x932b('0x18')](_0x19a35f);}return _0x129f0a['status'](_0x19a35f)[_0x932b('0x19')]();};}function respondWithResult(_0x5324c4,_0x87aad2){_0x87aad2=_0x87aad2||0xc8;return function(_0x39c487){if(_0x39c487){return _0x5324c4[_0x932b('0x1a')](_0x87aad2)['json'](_0x39c487);}};}function respondWithFilteredResult(_0x3c3bd7,_0x3ee266){return function(_0xcd6cfd){if(_0xcd6cfd){var _0x31567b=typeof _0x3ee266[_0x932b('0x1b')]===_0x932b('0x1c')&&typeof _0x3ee266['limit']==='undefined';var _0x241458=_0xcd6cfd['count'];var _0x45cc0a=_0x31567b?0x0:_0x3ee266[_0x932b('0x1b')];var _0x50a942=_0x31567b?_0xcd6cfd[_0x932b('0x1d')]:_0x3ee266[_0x932b('0x1b')]+_0x3ee266[_0x932b('0x1e')];var _0x78a394;if(_0x50a942>=_0x241458){_0x50a942=_0x241458;_0x78a394=0xc8;}else{_0x78a394=0xce;}_0x3c3bd7[_0x932b('0x1a')](_0x78a394);return _0x3c3bd7[_0x932b('0x1f')](_0x932b('0x20'),_0x45cc0a+'-'+_0x50a942+'/'+_0x241458)[_0x932b('0x21')](_0xcd6cfd);}return null;};}function patchUpdates(_0x1d61d0){return function(_0x1729c1){try{jsonpatch['apply'](_0x1729c1,_0x1d61d0,!![]);}catch(_0x1e555d){return BPromise[_0x932b('0x22')](_0x1e555d);}return _0x1729c1['save']();};}function saveUpdates(_0x427462,_0x100478){return function(_0xa192f4){if(_0xa192f4){return _0xa192f4['update'](_0x427462)[_0x932b('0x23')](function(_0x16aca3){return _0x16aca3;});}return null;};}function removeEntity(_0x3acd61,_0x11d49d){return function(_0x1c3053){if(_0x1c3053){return _0x1c3053[_0x932b('0x24')]()['then'](function(){_0x3acd61[_0x932b('0x1a')](0xcc)[_0x932b('0x19')]();});}};}function handleEntityNotFound(_0x222054,_0x155458){return function(_0x38d07c){if(!_0x38d07c){_0x222054[_0x932b('0x18')](0x194);}return _0x38d07c;};}function handleError(_0x3b44db,_0x429f70){_0x429f70=_0x429f70||0x1f4;return function(_0x3c90ec){logger[_0x932b('0x25')](_0x3c90ec[_0x932b('0x26')]);if(_0x3c90ec[_0x932b('0x27')]){delete _0x3c90ec[_0x932b('0x27')];}_0x3b44db[_0x932b('0x1a')](_0x429f70)[_0x932b('0x28')](_0x3c90ec);};}exports[_0x932b('0x29')]=function(_0x5ce232,_0x4aa1bc){var _0x52a0d3={},_0x5da376={},_0x4231c2={'count':0x0,'rows':[]};var _0x3cfadb=_[_0x932b('0x2a')](db[_0x932b('0x2b')][_0x932b('0x2c')],function(_0x25f2e6){return{'name':_0x25f2e6[_0x932b('0x2d')],'type':_0x25f2e6[_0x932b('0x2e')][_0x932b('0x2f')]};});_0x5da376[_0x932b('0x30')]=_[_0x932b('0x2a')](_0x3cfadb,_0x932b('0x27'));_0x5da376[_0x932b('0x31')]=_['keys'](_0x5ce232[_0x932b('0x31')]);_0x5da376['filters']=_[_0x932b('0x32')](_0x5da376['model'],_0x5da376[_0x932b('0x31')]);_0x52a0d3[_0x932b('0x33')]=_['intersection'](_0x5da376['model'],qs[_0x932b('0x34')](_0x5ce232[_0x932b('0x31')][_0x932b('0x34')]));_0x52a0d3[_0x932b('0x33')]=_0x52a0d3[_0x932b('0x33')]['length']?_0x52a0d3[_0x932b('0x33')]:_0x5da376[_0x932b('0x30')];if(!_0x5ce232['query'][_0x932b('0x35')](_0x932b('0x36'))){_0x52a0d3[_0x932b('0x1e')]=qs['limit'](_0x5ce232[_0x932b('0x31')][_0x932b('0x1e')]);_0x52a0d3['offset']=qs[_0x932b('0x1b')](_0x5ce232[_0x932b('0x31')][_0x932b('0x1b')]);}_0x52a0d3[_0x932b('0x37')]=qs[_0x932b('0x38')](_0x5ce232[_0x932b('0x31')]['sort']);_0x52a0d3[_0x932b('0x39')]=qs['filters'](_[_0x932b('0x3a')](_0x5ce232[_0x932b('0x31')],_0x5da376[_0x932b('0x3b')]),_0x3cfadb);if(_0x5ce232[_0x932b('0x31')][_0x932b('0x3c')]){_0x52a0d3[_0x932b('0x39')]=_['merge'](_0x52a0d3['where'],{'$or':_[_0x932b('0x2a')](_0x3cfadb,function(_0x44352f){if(_0x44352f[_0x932b('0x2e')]!=='VIRTUAL'){var _0x4384d0={};_0x4384d0[_0x44352f[_0x932b('0x27')]]={'$like':'%'+_0x5ce232['query'][_0x932b('0x3c')]+'%'};return _0x4384d0;}})});}_0x52a0d3=_[_0x932b('0x3d')]({},_0x52a0d3,_0x5ce232[_0x932b('0x3e')]);var _0x34920f={'where':_0x52a0d3[_0x932b('0x39')]};return db[_0x932b('0x2b')]['count'](_0x34920f)[_0x932b('0x23')](function(_0x2635a5){_0x4231c2[_0x932b('0x1d')]=_0x2635a5;if(_0x5ce232[_0x932b('0x31')][_0x932b('0x3f')]){_0x52a0d3[_0x932b('0x40')]=[{'all':!![]}];}return db[_0x932b('0x2b')][_0x932b('0x41')](_0x52a0d3);})[_0x932b('0x23')](function(_0xc1c0a6){_0x4231c2[_0x932b('0x42')]=_0xc1c0a6;return _0x4231c2;})['then'](respondWithFilteredResult(_0x4aa1bc,_0x52a0d3))['catch'](handleError(_0x4aa1bc,null));};exports[_0x932b('0x43')]=function(_0x87f007,_0x3019a6){var _0x4a4081={'raw':!![],'where':{'id':_0x87f007[_0x932b('0x44')]['id']}},_0x3cf4b4={};_0x3cf4b4['model']=_[_0x932b('0x45')](db[_0x932b('0x2b')]['rawAttributes']);_0x3cf4b4[_0x932b('0x31')]=_[_0x932b('0x45')](_0x87f007[_0x932b('0x31')]);_0x3cf4b4[_0x932b('0x3b')]=_[_0x932b('0x32')](_0x3cf4b4[_0x932b('0x30')],_0x3cf4b4['query']);_0x4a4081[_0x932b('0x33')]=_[_0x932b('0x32')](_0x3cf4b4[_0x932b('0x30')],qs['fields'](_0x87f007[_0x932b('0x31')][_0x932b('0x34')]));_0x4a4081['attributes']=_0x4a4081[_0x932b('0x33')]['length']?_0x4a4081[_0x932b('0x33')]:_0x3cf4b4[_0x932b('0x30')];if(_0x87f007[_0x932b('0x31')]['includeAll']){_0x4a4081[_0x932b('0x40')]=[{'all':!![]}];}_0x4a4081=_[_0x932b('0x3d')]({},_0x4a4081,_0x87f007[_0x932b('0x3e')]);return db['SquareDetailsReport'][_0x932b('0x46')](_0x4a4081)['then'](handleEntityNotFound(_0x3019a6,null))[_0x932b('0x23')](respondWithResult(_0x3019a6,null))[_0x932b('0x47')](handleError(_0x3019a6,null));};exports[_0x932b('0x48')]=function(_0x5e878a,_0x254b0f){return db[_0x932b('0x2b')]['create'](_0x5e878a['body'],{})[_0x932b('0x23')](respondWithResult(_0x254b0f,0xc9))[_0x932b('0x47')](handleError(_0x254b0f,null));};exports['update']=function(_0x562ce8,_0x9821f0){if(_0x562ce8[_0x932b('0x49')]['id']){delete _0x562ce8[_0x932b('0x49')]['id'];}return db[_0x932b('0x2b')][_0x932b('0x46')]({'where':{'id':_0x562ce8['params']['id']}})[_0x932b('0x23')](handleEntityNotFound(_0x9821f0,null))['then'](saveUpdates(_0x562ce8[_0x932b('0x49')],null))['then'](respondWithResult(_0x9821f0,null))[_0x932b('0x47')](handleError(_0x9821f0,null));};exports[_0x932b('0x24')]=function(_0x4266dc,_0x4a265f){return db[_0x932b('0x2b')][_0x932b('0x46')]({'where':{'id':_0x4266dc['params']['id']}})[_0x932b('0x23')](handleEntityNotFound(_0x4a265f,null))['then'](removeEntity(_0x4a265f,null))['catch'](handleError(_0x4a265f,null));};exports[_0x932b('0x4a')]=function(_0xc54488,_0x492997){return db[_0x932b('0x2b')][_0x932b('0x4a')]()[_0x932b('0x23')](respondWithResult(_0x492997,null))[_0x932b('0x47')](handleError(_0x492997,null));}; \ No newline at end of file +var _0x4a39=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','json','apply','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x4a39,0x65));var _0x94a3=function(_0x45ed09,_0x4deb08){_0x45ed09=_0x45ed09-0x0;var _0x1938a5=_0x4a39[_0x45ed09];return _0x1938a5;};'use strict';var emlformat=require(_0x94a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94a3('0x2'));var moment=require(_0x94a3('0x3'));var BPromise=require(_0x94a3('0x4'));var Mustache=require(_0x94a3('0x5'));var util=require(_0x94a3('0x6'));var path=require('path');var sox=require(_0x94a3('0x7'));var csv=require('to-csv');var ejs=require(_0x94a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94a3('0x9'));var squel=require(_0x94a3('0xa'));var crypto=require(_0x94a3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x94a3('0xc'));var toCsv=require(_0x94a3('0xd'));var querystring=require(_0x94a3('0xe'));var Papa=require(_0x94a3('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x94a3('0x10'));var as=require(_0x94a3('0x11'));var hardwareService=require(_0x94a3('0x12'));var logger=require(_0x94a3('0x13'))(_0x94a3('0x14'));var utils=require(_0x94a3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x94a3('0x16'))['db'];function respondWithStatusCode(_0x37ab4a,_0x20c0c8){_0x20c0c8=_0x20c0c8||0xcc;return function(_0x3d129c){if(_0x3d129c){return _0x37ab4a[_0x94a3('0x17')](_0x20c0c8);}return _0x37ab4a[_0x94a3('0x18')](_0x20c0c8)[_0x94a3('0x19')]();};}function respondWithResult(_0x53f647,_0x419595){_0x419595=_0x419595||0xc8;return function(_0x540c72){if(_0x540c72){return _0x53f647[_0x94a3('0x18')](_0x419595)['json'](_0x540c72);}};}function respondWithFilteredResult(_0x45889d,_0x584b5a){return function(_0x452679){if(_0x452679){var _0x364cee=typeof _0x584b5a['offset']===_0x94a3('0x1a')&&typeof _0x584b5a['limit']===_0x94a3('0x1a');var _0x536237=_0x452679['count'];var _0x2453b5=_0x364cee?0x0:_0x584b5a[_0x94a3('0x1b')];var _0x1f8701=_0x364cee?_0x452679[_0x94a3('0x1c')]:_0x584b5a[_0x94a3('0x1b')]+_0x584b5a[_0x94a3('0x1d')];var _0x3147eb;if(_0x1f8701>=_0x536237){_0x1f8701=_0x536237;_0x3147eb=0xc8;}else{_0x3147eb=0xce;}_0x45889d['status'](_0x3147eb);return _0x45889d[_0x94a3('0x1e')]('Content-Range',_0x2453b5+'-'+_0x1f8701+'/'+_0x536237)[_0x94a3('0x1f')](_0x452679);}return null;};}function patchUpdates(_0x3aa2b4){return function(_0x1f6b52){try{jsonpatch[_0x94a3('0x20')](_0x1f6b52,_0x3aa2b4,!![]);}catch(_0x564e96){return BPromise['reject'](_0x564e96);}return _0x1f6b52[_0x94a3('0x21')]();};}function saveUpdates(_0x360611,_0x5617b7){return function(_0x4d8209){if(_0x4d8209){return _0x4d8209[_0x94a3('0x22')](_0x360611)[_0x94a3('0x23')](function(_0x5b77ed){return _0x5b77ed;});}return null;};}function removeEntity(_0x3f9724,_0xf08d6){return function(_0x3b6060){if(_0x3b6060){return _0x3b6060[_0x94a3('0x24')]()['then'](function(){_0x3f9724[_0x94a3('0x18')](0xcc)[_0x94a3('0x19')]();});}};}function handleEntityNotFound(_0x1af70d,_0x16fcd9){return function(_0x13f68a){if(!_0x13f68a){_0x1af70d['sendStatus'](0x194);}return _0x13f68a;};}function handleError(_0x56de6f,_0x41f140){_0x41f140=_0x41f140||0x1f4;return function(_0x59e0ef){logger['error'](_0x59e0ef[_0x94a3('0x25')]);if(_0x59e0ef[_0x94a3('0x26')]){delete _0x59e0ef['name'];}_0x56de6f[_0x94a3('0x18')](_0x41f140)[_0x94a3('0x27')](_0x59e0ef);};}exports[_0x94a3('0x28')]=function(_0x4fd2d9,_0x4c132b){var _0x24b4a8={},_0x3f3048={},_0x19ca45={'count':0x0,'rows':[]};var _0x2a169a=_[_0x94a3('0x29')](db[_0x94a3('0x2a')][_0x94a3('0x2b')],function(_0x5d48df){return{'name':_0x5d48df['fieldName'],'type':_0x5d48df[_0x94a3('0x2c')][_0x94a3('0x2d')]};});_0x3f3048[_0x94a3('0x2e')]=_[_0x94a3('0x29')](_0x2a169a,_0x94a3('0x26'));_0x3f3048[_0x94a3('0x2f')]=_[_0x94a3('0x30')](_0x4fd2d9[_0x94a3('0x2f')]);_0x3f3048[_0x94a3('0x31')]=_['intersection'](_0x3f3048[_0x94a3('0x2e')],_0x3f3048[_0x94a3('0x2f')]);_0x24b4a8['attributes']=_[_0x94a3('0x32')](_0x3f3048[_0x94a3('0x2e')],qs[_0x94a3('0x33')](_0x4fd2d9['query'][_0x94a3('0x33')]));_0x24b4a8[_0x94a3('0x34')]=_0x24b4a8[_0x94a3('0x34')][_0x94a3('0x35')]?_0x24b4a8[_0x94a3('0x34')]:_0x3f3048[_0x94a3('0x2e')];if(!_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x36')](_0x94a3('0x37'))){_0x24b4a8[_0x94a3('0x1d')]=qs['limit'](_0x4fd2d9[_0x94a3('0x2f')]['limit']);_0x24b4a8['offset']=qs[_0x94a3('0x1b')](_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x1b')]);}_0x24b4a8[_0x94a3('0x38')]=qs[_0x94a3('0x39')](_0x4fd2d9[_0x94a3('0x2f')]['sort']);_0x24b4a8[_0x94a3('0x3a')]=qs[_0x94a3('0x31')](_[_0x94a3('0x3b')](_0x4fd2d9[_0x94a3('0x2f')],_0x3f3048[_0x94a3('0x31')]),_0x2a169a);if(_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x3c')]){_0x24b4a8[_0x94a3('0x3a')]=_['merge'](_0x24b4a8[_0x94a3('0x3a')],{'$or':_[_0x94a3('0x29')](_0x2a169a,function(_0xd8082f){if(_0xd8082f[_0x94a3('0x2c')]!==_0x94a3('0x3d')){var _0x10b432={};_0x10b432[_0xd8082f[_0x94a3('0x26')]]={'$like':'%'+_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x3c')]+'%'};return _0x10b432;}})});}_0x24b4a8=_[_0x94a3('0x3e')]({},_0x24b4a8,_0x4fd2d9[_0x94a3('0x3f')]);var _0x2dd845={'where':_0x24b4a8['where']};return db['SquareDetailsReport']['count'](_0x2dd845)[_0x94a3('0x23')](function(_0xa91ec3){_0x19ca45['count']=_0xa91ec3;if(_0x4fd2d9['query'][_0x94a3('0x40')]){_0x24b4a8['include']=[{'all':!![]}];}return db[_0x94a3('0x2a')][_0x94a3('0x41')](_0x24b4a8);})[_0x94a3('0x23')](function(_0x3f8bf7){_0x19ca45[_0x94a3('0x42')]=_0x3f8bf7;return _0x19ca45;})[_0x94a3('0x23')](respondWithFilteredResult(_0x4c132b,_0x24b4a8))[_0x94a3('0x43')](handleError(_0x4c132b,null));};exports[_0x94a3('0x44')]=function(_0x5b6af8,_0x50083a){var _0x209147={'raw':!![],'where':{'id':_0x5b6af8[_0x94a3('0x45')]['id']}},_0x1088b1={};_0x1088b1[_0x94a3('0x2e')]=_['keys'](db[_0x94a3('0x2a')][_0x94a3('0x2b')]);_0x1088b1[_0x94a3('0x2f')]=_[_0x94a3('0x30')](_0x5b6af8['query']);_0x1088b1[_0x94a3('0x31')]=_[_0x94a3('0x32')](_0x1088b1[_0x94a3('0x2e')],_0x1088b1[_0x94a3('0x2f')]);_0x209147['attributes']=_[_0x94a3('0x32')](_0x1088b1[_0x94a3('0x2e')],qs[_0x94a3('0x33')](_0x5b6af8[_0x94a3('0x2f')][_0x94a3('0x33')]));_0x209147['attributes']=_0x209147[_0x94a3('0x34')][_0x94a3('0x35')]?_0x209147[_0x94a3('0x34')]:_0x1088b1['model'];if(_0x5b6af8[_0x94a3('0x2f')][_0x94a3('0x40')]){_0x209147[_0x94a3('0x46')]=[{'all':!![]}];}_0x209147=_[_0x94a3('0x3e')]({},_0x209147,_0x5b6af8[_0x94a3('0x3f')]);return db['SquareDetailsReport'][_0x94a3('0x47')](_0x209147)['then'](handleEntityNotFound(_0x50083a,null))[_0x94a3('0x23')](respondWithResult(_0x50083a,null))[_0x94a3('0x43')](handleError(_0x50083a,null));};exports[_0x94a3('0x48')]=function(_0x49d80d,_0x4a713e){return db[_0x94a3('0x2a')][_0x94a3('0x48')](_0x49d80d['body'],{})[_0x94a3('0x23')](respondWithResult(_0x4a713e,0xc9))[_0x94a3('0x43')](handleError(_0x4a713e,null));};exports[_0x94a3('0x22')]=function(_0xf0ee6e,_0x48a4dc){if(_0xf0ee6e[_0x94a3('0x49')]['id']){delete _0xf0ee6e['body']['id'];}return db[_0x94a3('0x2a')][_0x94a3('0x47')]({'where':{'id':_0xf0ee6e[_0x94a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x48a4dc,null))[_0x94a3('0x23')](saveUpdates(_0xf0ee6e['body'],null))['then'](respondWithResult(_0x48a4dc,null))[_0x94a3('0x43')](handleError(_0x48a4dc,null));};exports[_0x94a3('0x24')]=function(_0x77ebab,_0x37403f){return db[_0x94a3('0x2a')]['find']({'where':{'id':_0x77ebab[_0x94a3('0x45')]['id']}})[_0x94a3('0x23')](handleEntityNotFound(_0x37403f,null))[_0x94a3('0x23')](removeEntity(_0x37403f,null))[_0x94a3('0x43')](handleError(_0x37403f,null));};exports[_0x94a3('0x4a')]=function(_0x5df1ac,_0xe27b03){return db[_0x94a3('0x2a')][_0x94a3('0x4a')]()['then'](respondWithResult(_0xe27b03,null))[_0x94a3('0x43')](handleError(_0xe27b03,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1fece9c..d8f4602 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 _0x9c32=['./squareReportDetail.attributes','define','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c32,0x163));var _0x29c3=function(_0x1cf53d,_0xdb8608){_0x1cf53d=_0x1cf53d-0x0;var _0x47bb91=_0x9c32[_0x1cf53d];return _0x47bb91;};'use strict';var _=require(_0x29c3('0x0'));var util=require(_0x29c3('0x1'));var logger=require(_0x29c3('0x2'))(_0x29c3('0x3'));var moment=require(_0x29c3('0x4'));var BPromise=require('bluebird');var rp=require(_0x29c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x29c3('0x6'));var config=require(_0x29c3('0x7'));var attributes=require(_0x29c3('0x8'));module['exports']=function(_0x14c9ec,_0x2e8a14){return _0x14c9ec[_0x29c3('0x9')]('SquareDetailsReport',attributes,{'tableName':_0x29c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe444=['request-promise','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','moment','bluebird'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xe444,0x16d));var _0x4e44=function(_0x2de4af,_0x2d6b8b){_0x2de4af=_0x2de4af-0x0;var _0x2e4317=_0xe444[_0x2de4af];return _0x2e4317;};'use strict';var _=require(_0x4e44('0x0'));var util=require(_0x4e44('0x1'));var logger=require(_0x4e44('0x2'))('api');var moment=require(_0x4e44('0x3'));var BPromise=require(_0x4e44('0x4'));var rp=require(_0x4e44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e44('0x6'));module[_0x4e44('0x7')]=function(_0x4e3543,_0x25d94e){return _0x4e3543[_0x4e44('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x4e44('0x9'),'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 9413519..a88d77c 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 _0xd7a0=['SquareDetailsReport,\x20%s,\x20%s','catch','CreateSquareDetailsReport','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd7a0,0x163));var _0x0d7a=function(_0x348b5c,_0xfd43ac){_0x348b5c=_0x348b5c-0x0;var _0x301562=_0xd7a0[_0x348b5c];return _0x301562;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var moment=require('moment');var BPromise=require(_0x0d7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d7a('0x3'));var db=require(_0x0d7a('0x4'))['db'];var utils=require(_0x0d7a('0x5'));var logger=require(_0x0d7a('0x6'))(_0x0d7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d7a('0x8'));var client=jayson[_0x0d7a('0x9')][_0x0d7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16461e,_0x22b404,_0x371b7d){return new BPromise(function(_0x1514ae,_0x55d585){return client[_0x0d7a('0xb')](_0x16461e,_0x371b7d)[_0x0d7a('0xc')](function(_0x450d42){logger[_0x0d7a('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'));logger[_0x0d7a('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'),JSON[_0x0d7a('0x10')](_0x450d42));if(_0x450d42[_0x0d7a('0x11')]){if(_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x22b404,_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x13')]);return _0x55d585(_0x450d42[_0x0d7a('0x11')]['message']);}logger[_0x0d7a('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x22b404,_0x450d42['error'][_0x0d7a('0x13')]);return _0x1514ae(_0x450d42['error'][_0x0d7a('0x13')]);}else{logger[_0x0d7a('0xd')](_0x0d7a('0x14'),_0x22b404,_0x0d7a('0xe'));_0x1514ae(_0x450d42['result'][_0x0d7a('0x13')]);}})[_0x0d7a('0x15')](function(_0x497cbb){logger[_0x0d7a('0x11')](_0x0d7a('0x14'),_0x22b404,_0x497cbb);_0x55d585(_0x497cbb);});});}exports[_0x0d7a('0x16')]=function(_0x406b0c){var _0x5c54a6=this;return new Promise(function(_0x2180fa,_0x4cfcdc){return db['SquareDetailsReport']['create'](_0x406b0c['body'],{'raw':_0x406b0c[_0x0d7a('0x17')]?_0x406b0c['options'][_0x0d7a('0x18')]===undefined?!![]:![]:!![]})[_0x0d7a('0xc')](function(_0x4c997f){logger[_0x0d7a('0xd')](_0x0d7a('0x16'),_0x406b0c);logger[_0x0d7a('0xf')](_0x0d7a('0x16'),_0x406b0c,JSON['stringify'](_0x4c997f));_0x2180fa(_0x4c997f);})[_0x0d7a('0x15')](function(_0x2c11b6){logger[_0x0d7a('0x11')]('CreateSquareDetailsReport',_0x2c11b6['message'],_0x406b0c);_0x4cfcdc(_0x5c54a6[_0x0d7a('0x11')](0x1f4,_0x2c11b6[_0x0d7a('0x13')]));});});}; \ No newline at end of file +var _0x2b65=['info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x48e359,_0x4ce2b8){var _0x1ece43=function(_0x542fa4){while(--_0x542fa4){_0x48e359['push'](_0x48e359['shift']());}};_0x1ece43(++_0x4ce2b8);}(_0x2b65,0x131));var _0x52b6=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0x2b65[_0xaf25ae];return _0x49732d;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d451f,_0x70579,_0x1af78f){return new BPromise(function(_0x432726,_0x27c5b9){return client['request'](_0x2d451f,_0x1af78f)[_0x52b6('0xd')](function(_0x1c2cb5){logger[_0x52b6('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x70579,_0x52b6('0xf'));logger[_0x52b6('0x10')](_0x52b6('0x11'),_0x70579,_0x52b6('0xf'),JSON['stringify'](_0x1c2cb5));if(_0x1c2cb5[_0x52b6('0x12')]){if(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x13')]===0x1f4){logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')]['message']);return _0x27c5b9(_0x1c2cb5[_0x52b6('0x12')]['message']);}logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);return _0x432726(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);}else{logger[_0x52b6('0xe')](_0x52b6('0x14'),_0x70579,_0x52b6('0xf'));_0x432726(_0x1c2cb5[_0x52b6('0x16')][_0x52b6('0x15')]);}})[_0x52b6('0x17')](function(_0x307594){logger[_0x52b6('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x70579,_0x307594);_0x27c5b9(_0x307594);});});}exports[_0x52b6('0x18')]=function(_0x2fa3ed){var _0x9bab0a=this;return new Promise(function(_0x47d203,_0x36d376){return db[_0x52b6('0x19')]['create'](_0x2fa3ed['body'],{'raw':_0x2fa3ed[_0x52b6('0x1a')]?_0x2fa3ed['options'][_0x52b6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2e472f){logger[_0x52b6('0xe')](_0x52b6('0x18'),_0x2fa3ed);logger[_0x52b6('0x10')]('CreateSquareDetailsReport',_0x2fa3ed,JSON[_0x52b6('0x1c')](_0x2e472f));_0x47d203(_0x2e472f);})[_0x52b6('0x17')](function(_0x1246db){logger[_0x52b6('0x12')](_0x52b6('0x18'),_0x1246db[_0x52b6('0x15')],_0x2fa3ed);_0x36d376(_0x9bab0a[_0x52b6('0x12')](0x1f4,_0x1246db[_0x52b6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d877871..4737859 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 _0x5f0b=['isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','get','index','/process/:pid/kill'];(function(_0x4a68ba,_0x32d2e7){var _0x11c5c5=function(_0x4a1cf6){while(--_0x4a1cf6){_0x4a68ba['push'](_0x4a68ba['shift']());}};_0x11c5c5(++_0x32d2e7);}(_0x5f0b,0x16b));var _0xb5f0=function(_0x44e8eb,_0x23f033){_0x44e8eb=_0x44e8eb-0x0;var _0x27ea5e=_0x5f0b[_0x44e8eb];return _0x27ea5e;};'use strict';var express=require(_0xb5f0('0x0'));var router=express[_0xb5f0('0x1')]();var auth=require(_0xb5f0('0x2'));var controller=require('./system.controller');router[_0xb5f0('0x3')]('/',auth['isAuthenticated'](),controller[_0xb5f0('0x4')]);router['get'](_0xb5f0('0x5'),auth[_0xb5f0('0x6')](),controller[_0xb5f0('0x7')]);module[_0xb5f0('0x8')]=router; \ No newline at end of file +var _0xd693=['isAuthenticated','index','killProcess','exports','express','Router','./system.controller','get'];(function(_0x3d573e,_0x5a32a2){var _0x5d16e7=function(_0x4b892f){while(--_0x4b892f){_0x3d573e['push'](_0x3d573e['shift']());}};_0x5d16e7(++_0x5a32a2);}(_0xd693,0xc4));var _0x3d69=function(_0x237f45,_0x45987a){_0x237f45=_0x237f45-0x0;var _0x268b78=_0xd693[_0x237f45];return _0x268b78;};'use strict';var express=require(_0x3d69('0x0'));var router=express[_0x3d69('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3d69('0x2'));router[_0x3d69('0x3')]('/',auth[_0x3d69('0x4')](),controller[_0x3d69('0x5')]);router[_0x3d69('0x3')]('/process/:pid/kill',auth[_0x3d69('0x4')](),controller[_0x3d69('0x6')]);module[_0x3d69('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index bb62bcd..8c2e6c1 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 _0x855b=['lodash','error','inspect','name','status','index','getAllData','then','catch','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!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','../../config/logger','api','util','bluebird'];(function(_0x4e94c0,_0x55f4be){var _0x283615=function(_0x43d037){while(--_0x43d037){_0x4e94c0['push'](_0x4e94c0['shift']());}};_0x283615(++_0x55f4be);}(_0x855b,0xd3));var _0xb855=function(_0x5bb2a4,_0x4abfb7){_0x5bb2a4=_0x5bb2a4-0x0;var _0x174d79=_0x855b[_0x5bb2a4];return _0x174d79;};'use strict';var info=require(_0xb855('0x0'));var exec=require('child_process')['exec'];var logger=require(_0xb855('0x1'))(_0xb855('0x2'));var util=require(_0xb855('0x3'));var BPromise=require(_0xb855('0x4'));var _=require(_0xb855('0x5'));function handleError(_0x342a54,_0x5bf1e9,_0x2ab344){_0x5bf1e9=_0x5bf1e9||0x1f4;return function(_0x2a1dae){logger[_0xb855('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2ab344,_0x5bf1e9,util[_0xb855('0x7')](_0x2a1dae,{'showHidden':![],'depth':null}));delete _0x2a1dae[_0xb855('0x8')];_0x342a54[_0xb855('0x9')](_0x5bf1e9)['send'](_0x2a1dae);};}exports[_0xb855('0xa')]=function(_0x4bdca9,_0x504e63){return info[_0xb855('0xb')]()[_0xb855('0xc')](function(_0xdb5f88){return _0x504e63[_0xb855('0x9')](0xc8)['json'](_0xdb5f88);})[_0xb855('0xd')](function(_0x50c566){return _0x504e63['status'](0x1f4)[_0xb855('0xe')](_0x50c566);});};exports[_0xb855('0xf')]=function(_0x171d8d,_0x44ed41){var _0x1132ce=[_0xb855('0x10')];return new BPromise(function(_0xf22212,_0x48efc9){return exec(util[_0xb855('0x11')](_0xb855('0x12'),_0x171d8d[_0xb855('0x13')][_0xb855('0x14')]),function(_0x528035,_0x3b4c79,_0xb3041d){if(_0x528035){return _0x48efc9(_0x528035);}return _0xf22212(_0x3b4c79);});})[_0xb855('0xc')](function(_0x17a680){var _0x143c5f=![];var _0x361f84=_0x17a680[_0xb855('0x15')](/\n/);for(var _0x179799=0x0,_0x129d70=_0x1132ce['length'];_0x179799<_0x129d70,_0x143c5f===![];_0x179799+=0x1){if(_0x17a680[_0xb855('0x16')](_0x1132ce[_0x179799])>=0x0){_0x143c5f=!![];}}if(!_0x143c5f){throw new Error(util['format'](_0xb855('0x17'),_0x171d8d[_0xb855('0x13')][_0xb855('0x14')]));}process[_0xb855('0x18')](_0x171d8d[_0xb855('0x13')]['pid'],_0xb855('0x19'));return _0x44ed41[_0xb855('0x9')](0xc8)[_0xb855('0xe')]({'message':util[_0xb855('0x11')](_0xb855('0x1a'),_0x171d8d['params'][_0xb855('0x14')])});})[_0xb855('0xd')](handleError(_0x44ed41,null,_0xb855('0xf')));}; \ No newline at end of file +var _0x21ed=['api','bluebird','lodash','inspect','name','status','send','index','getAllData','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','../../config/logger'];(function(_0x1fe5a2,_0x4c96ce){var _0x3e97c1=function(_0x6fafd0){while(--_0x6fafd0){_0x1fe5a2['push'](_0x1fe5a2['shift']());}};_0x3e97c1(++_0x4c96ce);}(_0x21ed,0xf6));var _0xd21e=function(_0x4476ba,_0x5596c4){_0x4476ba=_0x4476ba-0x0;var _0x283ca8=_0x21ed[_0x4476ba];return _0x283ca8;};'use strict';var info=require(_0xd21e('0x0'));var exec=require(_0xd21e('0x1'))[_0xd21e('0x2')];var logger=require(_0xd21e('0x3'))(_0xd21e('0x4'));var util=require('util');var BPromise=require(_0xd21e('0x5'));var _=require(_0xd21e('0x6'));function handleError(_0x176abe,_0x540d67,_0x35a056){_0x540d67=_0x540d67||0x1f4;return function(_0x1e8d45){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x35a056,_0x540d67,util[_0xd21e('0x7')](_0x1e8d45,{'showHidden':![],'depth':null}));delete _0x1e8d45[_0xd21e('0x8')];_0x176abe[_0xd21e('0x9')](_0x540d67)[_0xd21e('0xa')](_0x1e8d45);};}exports[_0xd21e('0xb')]=function(_0xfdcde1,_0x2be040){return info[_0xd21e('0xc')]()['then'](function(_0x1749e7){return _0x2be040[_0xd21e('0x9')](0xc8)['json'](_0x1749e7);})['catch'](function(_0x10304e){return _0x2be040[_0xd21e('0x9')](0x1f4)[_0xd21e('0xd')](_0x10304e);});};exports['killProcess']=function(_0x5c6cdd,_0x200f0a){var _0xa3eafb=['components/import/cm'];return new BPromise(function(_0x351b36,_0x16b872){return exec(util[_0xd21e('0xe')](_0xd21e('0xf'),_0x5c6cdd[_0xd21e('0x10')]['pid']),function(_0x36489d,_0x293854,_0x4fa23d){if(_0x36489d){return _0x16b872(_0x36489d);}return _0x351b36(_0x293854);});})['then'](function(_0x5305e8){var _0x23ff34=![];var _0x2adb9a=_0x5305e8[_0xd21e('0x11')](/\n/);for(var _0x322fe0=0x0,_0x24b2bd=_0xa3eafb[_0xd21e('0x12')];_0x322fe0<_0x24b2bd,_0x23ff34===![];_0x322fe0+=0x1){if(_0x5305e8[_0xd21e('0x13')](_0xa3eafb[_0x322fe0])>=0x0){_0x23ff34=!![];}}if(!_0x23ff34){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5c6cdd['params'][_0xd21e('0x14')]));}process[_0xd21e('0x15')](_0x5c6cdd[_0xd21e('0x10')]['pid'],'SIGINT');return _0x200f0a['status'](0xc8)['json']({'message':util[_0xd21e('0xe')](_0xd21e('0x16'),_0x5c6cdd[_0xd21e('0x10')][_0xd21e('0x14')])});})[_0xd21e('0x17')](handleError(_0x200f0a,null,_0xd21e('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 56fee65..8e60534 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 _0xc260=['Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','util','path','connect-timeout'];(function(_0x31380c,_0x1c4d55){var _0x555000=function(_0x4447d8){while(--_0x4447d8){_0x31380c['push'](_0x31380c['shift']());}};_0x555000(++_0x1c4d55);}(_0xc260,0x151));var _0x0c26=function(_0x1e5bd8,_0x3260ab){_0x1e5bd8=_0x1e5bd8-0x0;var _0x547713=_0xc260[_0x1e5bd8];return _0x547713;};'use strict';var multer=require('multer');var util=require(_0x0c26('0x0'));var path=require(_0x0c26('0x1'));var timeout=require(_0x0c26('0x2'));var express=require('express');var router=express[_0x0c26('0x3')]();var fs_extra=require(_0x0c26('0x4'));var auth=require(_0x0c26('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0c26('0x6'));var controller=require(_0x0c26('0x7'));router[_0x0c26('0x8')]('/',auth[_0x0c26('0x9')](),controller['index']);router[_0x0c26('0x8')]('/:id',auth[_0x0c26('0x9')](),controller[_0x0c26('0xa')]);router['post']('/',auth[_0x0c26('0x9')](),controller[_0x0c26('0xb')]);router[_0x0c26('0xc')](_0x0c26('0xd'),auth[_0x0c26('0x9')](),controller[_0x0c26('0xe')]);router[_0x0c26('0xf')]('/:id',auth[_0x0c26('0x9')](),controller[_0x0c26('0x10')]);module['exports']=router; \ No newline at end of file +var _0x13cf=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated','show','post','create'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x13cf,0x13f));var _0xf13c=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x13cf[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0xf13c('0x0'));var util=require(_0xf13c('0x1'));var path=require(_0xf13c('0x2'));var timeout=require(_0xf13c('0x3'));var express=require(_0xf13c('0x4'));var router=express[_0xf13c('0x5')]();var fs_extra=require(_0xf13c('0x6'));var auth=require(_0xf13c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf13c('0x8'));var controller=require(_0xf13c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf13c('0xa')]);router[_0xf13c('0xb')](_0xf13c('0xc'),auth[_0xf13c('0xd')](),controller[_0xf13c('0xe')]);router[_0xf13c('0xf')]('/',auth[_0xf13c('0xd')](),controller[_0xf13c('0x10')]);router[_0xf13c('0x11')](_0xf13c('0xc'),auth[_0xf13c('0xd')](),controller['update']);router[_0xf13c('0x12')]('/:id',auth[_0xf13c('0xd')](),controller[_0xf13c('0x13')]);module[_0xf13c('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7cf8e18..fbc8947 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 _0x119c=['STRING','#0091EA','exports','name'];(function(_0xdb1911,_0x2f20db){var _0x2c47bd=function(_0x3a5cc1){while(--_0x3a5cc1){_0xdb1911['push'](_0xdb1911['shift']());}};_0x2c47bd(++_0x2f20db);}(_0x119c,0xea));var _0xc119=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x119c[_0x4bd06e];return _0x85ebb;};'use strict';var Sequelize=require('sequelize');module[_0xc119('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc119('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc119('0x2')],'defaultValue':_0xc119('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7cd6=['sequelize','exports','STRING','name'];(function(_0x44dcad,_0x2d1b9c){var _0x3cdc33=function(_0x21228b){while(--_0x21228b){_0x44dcad['push'](_0x44dcad['shift']());}};_0x3cdc33(++_0x2d1b9c);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x145f12,_0xef0a67){_0x145f12=_0x145f12-0x0;var _0x4db13b=_0x7cd6[_0x145f12];return _0x4db13b;};'use strict';var Sequelize=require(_0x67cd('0x0'));module[_0x67cd('0x1')]={'name':{'type':Sequelize[_0x67cd('0x2')],'unique':_0x67cd('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x67cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ca94b8a..3a111c1 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 _0xaa88=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','get','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','Tag','includeAll','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Tags','UserProfileSection','userProfileId','autoAssociation','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1f848e,_0x2aff9c){var _0x1b592b=function(_0x5a58bb){while(--_0x5a58bb){_0x1f848e['push'](_0x1f848e['shift']());}};_0x1b592b(++_0x2aff9c);}(_0xaa88,0x137));var _0x8aa8=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0xaa88[_0x3d9b04];return _0x557936;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){var _0xe978ab=_0x3ca7dc[_0x8aa8('0x25')]({'plain':!![]});var _0x547a7b='Tags';return db[_0x8aa8('0x26')][_0x8aa8('0x27')]({'where':{'type':_0x547a7b,'resourceId':_0xe978ab['id']}})[_0x8aa8('0x24')](function(){return _0x3ca7dc;});})[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc34a,_0x49d561){return function(_0x2a0ff2){if(!_0x2a0ff2){_0x2bc34a[_0x8aa8('0x19')](0x194);}return _0x2a0ff2;};}function handleError(_0x15ff33,_0x519ac0){_0x519ac0=_0x519ac0||0x1f4;return function(_0x4c5c5c){logger[_0x8aa8('0x28')](_0x4c5c5c['stack']);if(_0x4c5c5c[_0x8aa8('0x29')]){delete _0x4c5c5c[_0x8aa8('0x29')];}_0x15ff33[_0x8aa8('0x1a')](_0x519ac0)[_0x8aa8('0x2a')](_0x4c5c5c);};}exports[_0x8aa8('0x2b')]=function(_0x4d5c2e,_0x267f4c){var _0x3003e5={},_0x4b67f5={},_0x99f74e={'count':0x0,'rows':[]};var _0xee2f61=_[_0x8aa8('0x2c')](db['Tag'][_0x8aa8('0x2d')],function(_0x3a0dce){return{'name':_0x3a0dce[_0x8aa8('0x2e')],'type':_0x3a0dce[_0x8aa8('0x2f')][_0x8aa8('0x30')]};});_0x4b67f5[_0x8aa8('0x31')]=_[_0x8aa8('0x2c')](_0xee2f61,_0x8aa8('0x29'));_0x4b67f5[_0x8aa8('0x32')]=_[_0x8aa8('0x33')](_0x4d5c2e[_0x8aa8('0x32')]);_0x4b67f5['filters']=_['intersection'](_0x4b67f5[_0x8aa8('0x31')],_0x4b67f5[_0x8aa8('0x32')]);_0x3003e5[_0x8aa8('0x34')]=_[_0x8aa8('0x35')](_0x4b67f5[_0x8aa8('0x31')],qs[_0x8aa8('0x36')](_0x4d5c2e['query']['fields']));_0x3003e5[_0x8aa8('0x34')]=_0x3003e5['attributes'][_0x8aa8('0x37')]?_0x3003e5[_0x8aa8('0x34')]:_0x4b67f5[_0x8aa8('0x31')];if(!_0x4d5c2e['query'][_0x8aa8('0x38')](_0x8aa8('0x39'))){_0x3003e5[_0x8aa8('0x1f')]=qs['limit'](_0x4d5c2e['query'][_0x8aa8('0x1f')]);_0x3003e5[_0x8aa8('0x1d')]=qs['offset'](_0x4d5c2e[_0x8aa8('0x32')][_0x8aa8('0x1d')]);}_0x3003e5['order']=qs[_0x8aa8('0x3a')](_0x4d5c2e['query']['sort']);_0x3003e5[_0x8aa8('0x3b')]=qs['filters'](_[_0x8aa8('0x3c')](_0x4d5c2e[_0x8aa8('0x32')],_0x4b67f5[_0x8aa8('0x3d')]),_0xee2f61);if(_0x4d5c2e[_0x8aa8('0x32')]['filter']){_0x3003e5[_0x8aa8('0x3b')]=_[_0x8aa8('0x3e')](_0x3003e5['where'],{'$or':_[_0x8aa8('0x2c')](_0xee2f61,function(_0xc770ec){if(_0xc770ec['type']!==_0x8aa8('0x3f')){var _0x3c6115={};_0x3c6115[_0xc770ec[_0x8aa8('0x29')]]={'$like':'%'+_0x4d5c2e[_0x8aa8('0x32')][_0x8aa8('0x40')]+'%'};return _0x3c6115;}})});}_0x3003e5=_[_0x8aa8('0x3e')]({},_0x3003e5,_0x4d5c2e[_0x8aa8('0x41')]);var _0x3fb265={'where':_0x3003e5[_0x8aa8('0x3b')]};return db[_0x8aa8('0x42')][_0x8aa8('0x20')](_0x3fb265)[_0x8aa8('0x24')](function(_0x17c730){_0x99f74e[_0x8aa8('0x20')]=_0x17c730;if(_0x4d5c2e[_0x8aa8('0x32')][_0x8aa8('0x43')]){_0x3003e5['include']=[{'all':!![]}];}return db[_0x8aa8('0x42')]['findAll'](_0x3003e5);})['then'](function(_0x572132){_0x99f74e[_0x8aa8('0x44')]=_0x572132;return _0x99f74e;})['then'](respondWithFilteredResult(_0x267f4c,_0x3003e5))['catch'](handleError(_0x267f4c,null));};exports[_0x8aa8('0x45')]=function(_0x4da4d8,_0x1ddf7f){var _0x5d8a6a={'raw':!![],'where':{'id':_0x4da4d8[_0x8aa8('0x46')]['id']}},_0x5a132a={};_0x5a132a[_0x8aa8('0x31')]=_[_0x8aa8('0x33')](db[_0x8aa8('0x42')][_0x8aa8('0x2d')]);_0x5a132a[_0x8aa8('0x32')]=_[_0x8aa8('0x33')](_0x4da4d8['query']);_0x5a132a[_0x8aa8('0x3d')]=_['intersection'](_0x5a132a[_0x8aa8('0x31')],_0x5a132a[_0x8aa8('0x32')]);_0x5d8a6a[_0x8aa8('0x34')]=_[_0x8aa8('0x35')](_0x5a132a[_0x8aa8('0x31')],qs[_0x8aa8('0x36')](_0x4da4d8['query']['fields']));_0x5d8a6a[_0x8aa8('0x34')]=_0x5d8a6a[_0x8aa8('0x34')]['length']?_0x5d8a6a[_0x8aa8('0x34')]:_0x5a132a[_0x8aa8('0x31')];if(_0x4da4d8[_0x8aa8('0x32')]['includeAll']){_0x5d8a6a['include']=[{'all':!![]}];}_0x5d8a6a=_['merge']({},_0x5d8a6a,_0x4da4d8['options']);return db[_0x8aa8('0x42')][_0x8aa8('0x47')](_0x5d8a6a)['then'](handleEntityNotFound(_0x1ddf7f,null))[_0x8aa8('0x24')](respondWithResult(_0x1ddf7f,null))[_0x8aa8('0x48')](handleError(_0x1ddf7f,null));};exports[_0x8aa8('0x49')]=function(_0x1aa1b6,_0x20384a){return db[_0x8aa8('0x42')]['create'](_0x1aa1b6['body'],{})[_0x8aa8('0x24')](function(_0x546988){var _0x20c368=_0x1aa1b6['user'][_0x8aa8('0x25')]({'plain':!![]});if(!_0x20c368)throw new Error(_0x8aa8('0x4a'));if(_0x20c368[_0x8aa8('0x4b')]===_0x8aa8('0x4c')){var _0x36de37=_0x546988[_0x8aa8('0x25')]({'plain':!![]});var _0x997597=_0x8aa8('0x4d');return db[_0x8aa8('0x4e')][_0x8aa8('0x47')]({'where':{'name':_0x997597,'userProfileId':_0x20c368[_0x8aa8('0x4f')]},'raw':!![]})[_0x8aa8('0x24')](function(_0x4fc51d){if(_0x4fc51d&&_0x4fc51d[_0x8aa8('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x36de37['name'],'resourceId':_0x36de37['id'],'type':_0x4fc51d[_0x8aa8('0x29')],'sectionId':_0x4fc51d['id']},{})['then'](function(){return _0x546988;});}else{return _0x546988;}})[_0x8aa8('0x48')](function(_0x1474fd){logger[_0x8aa8('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1474fd);throw _0x1474fd;});}return _0x546988;})[_0x8aa8('0x24')](respondWithResult(_0x20384a,0xc9))[_0x8aa8('0x48')](handleError(_0x20384a,null));};exports[_0x8aa8('0x51')]=function(_0x24f34e,_0x4ccb77){if(_0x24f34e['body']['id']){delete _0x24f34e[_0x8aa8('0x52')]['id'];}return db[_0x8aa8('0x42')][_0x8aa8('0x47')]({'where':{'id':_0x24f34e[_0x8aa8('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ccb77,null))['then'](saveUpdates(_0x24f34e[_0x8aa8('0x52')],null))[_0x8aa8('0x24')](respondWithResult(_0x4ccb77,null))[_0x8aa8('0x48')](handleError(_0x4ccb77,null));};exports['destroy']=function(_0x33e9ae,_0x3a814f){return db['Tag']['find']({'where':{'id':_0x33e9ae['params']['id']}})['then'](handleEntityNotFound(_0x3a814f,null))[_0x8aa8('0x24')](removeEntity(_0x3a814f,null))['catch'](handleError(_0x3a814f,null));}; \ No newline at end of file +var _0x4b1f=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','Tags','UserProfileResource','error','stack','name','send','Tag','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','findAll','catch','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x4b1f,0x195));var _0xf4b1=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x4b1f[_0x819464];return _0x49dcc0;};'use strict';var emlformat=require(_0xf4b1('0x0'));var rimraf=require(_0xf4b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4b1('0x2'));var rp=require(_0xf4b1('0x3'));var moment=require(_0xf4b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf4b1('0x5'));var util=require(_0xf4b1('0x6'));var path=require(_0xf4b1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4b1('0x8'));var fs=require('fs');var fs_extra=require(_0xf4b1('0x9'));var _=require(_0xf4b1('0xa'));var squel=require(_0xf4b1('0xb'));var crypto=require(_0xf4b1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4b1('0xd'));var Papa=require('papaparse');var Redis=require(_0xf4b1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf4b1('0xf'));var hardwareService=require(_0xf4b1('0x10'));var logger=require(_0xf4b1('0x11'))(_0xf4b1('0x12'));var utils=require(_0xf4b1('0x13'));var config=require(_0xf4b1('0x14'));var licenseUtil=require(_0xf4b1('0x15'));var db=require(_0xf4b1('0x16'))['db'];function respondWithStatusCode(_0x38afbb,_0xf66b4c){_0xf66b4c=_0xf66b4c||0xcc;return function(_0x2c4eb9){if(_0x2c4eb9){return _0x38afbb[_0xf4b1('0x17')](_0xf66b4c);}return _0x38afbb[_0xf4b1('0x18')](_0xf66b4c)['end']();};}function respondWithResult(_0x591476,_0x3ea6f3){_0x3ea6f3=_0x3ea6f3||0xc8;return function(_0x5cbc25){if(_0x5cbc25){return _0x591476['status'](_0x3ea6f3)[_0xf4b1('0x19')](_0x5cbc25);}};}function respondWithFilteredResult(_0x51c39f,_0x5764b1){return function(_0x293f59){if(_0x293f59){var _0x4968f4=typeof _0x5764b1['offset']==='undefined'&&typeof _0x5764b1['limit']===_0xf4b1('0x1a');var _0x3ee70a=_0x293f59['count'];var _0x3b378e=_0x4968f4?0x0:_0x5764b1[_0xf4b1('0x1b')];var _0x322b38=_0x4968f4?_0x293f59[_0xf4b1('0x1c')]:_0x5764b1[_0xf4b1('0x1b')]+_0x5764b1[_0xf4b1('0x1d')];var _0x5b0214;if(_0x322b38>=_0x3ee70a){_0x322b38=_0x3ee70a;_0x5b0214=0xc8;}else{_0x5b0214=0xce;}_0x51c39f[_0xf4b1('0x18')](_0x5b0214);return _0x51c39f[_0xf4b1('0x1e')]('Content-Range',_0x3b378e+'-'+_0x322b38+'/'+_0x3ee70a)[_0xf4b1('0x19')](_0x293f59);}return null;};}function patchUpdates(_0x30c239){return function(_0x56ef48){try{jsonpatch[_0xf4b1('0x1f')](_0x56ef48,_0x30c239,!![]);}catch(_0x559a64){return BPromise[_0xf4b1('0x20')](_0x559a64);}return _0x56ef48[_0xf4b1('0x21')]();};}function saveUpdates(_0x5c50e8,_0x20013c){return function(_0x29b8c1){if(_0x29b8c1){return _0x29b8c1[_0xf4b1('0x22')](_0x5c50e8)[_0xf4b1('0x23')](function(_0x58376d){return _0x58376d;});}return null;};}function removeEntity(_0x92b390,_0x474212){return function(_0x4b6c08){if(_0x4b6c08){return _0x4b6c08[_0xf4b1('0x24')]()['then'](function(){var _0x15cfc4=_0x4b6c08['get']({'plain':!![]});var _0x238fbe=_0xf4b1('0x25');return db[_0xf4b1('0x26')]['destroy']({'where':{'type':_0x238fbe,'resourceId':_0x15cfc4['id']}})[_0xf4b1('0x23')](function(){return _0x4b6c08;});})['then'](function(){_0x92b390[_0xf4b1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29493b,_0x447ae7){return function(_0x5d28af){if(!_0x5d28af){_0x29493b[_0xf4b1('0x17')](0x194);}return _0x5d28af;};}function handleError(_0x23693b,_0x5bd8ee){_0x5bd8ee=_0x5bd8ee||0x1f4;return function(_0x125bf4){logger[_0xf4b1('0x27')](_0x125bf4[_0xf4b1('0x28')]);if(_0x125bf4[_0xf4b1('0x29')]){delete _0x125bf4[_0xf4b1('0x29')];}_0x23693b[_0xf4b1('0x18')](_0x5bd8ee)[_0xf4b1('0x2a')](_0x125bf4);};}exports['index']=function(_0x56ee5e,_0x31c13c){var _0xff9a65={},_0x1cbcff={},_0x29b9f9={'count':0x0,'rows':[]};var _0x35d81b=_['map'](db[_0xf4b1('0x2b')][_0xf4b1('0x2c')],function(_0xa6bdd7){return{'name':_0xa6bdd7[_0xf4b1('0x2d')],'type':_0xa6bdd7[_0xf4b1('0x2e')][_0xf4b1('0x2f')]};});_0x1cbcff[_0xf4b1('0x30')]=_[_0xf4b1('0x31')](_0x35d81b,'name');_0x1cbcff[_0xf4b1('0x32')]=_['keys'](_0x56ee5e['query']);_0x1cbcff['filters']=_[_0xf4b1('0x33')](_0x1cbcff[_0xf4b1('0x30')],_0x1cbcff[_0xf4b1('0x32')]);_0xff9a65[_0xf4b1('0x34')]=_[_0xf4b1('0x33')](_0x1cbcff[_0xf4b1('0x30')],qs[_0xf4b1('0x35')](_0x56ee5e[_0xf4b1('0x32')]['fields']));_0xff9a65[_0xf4b1('0x34')]=_0xff9a65['attributes'][_0xf4b1('0x36')]?_0xff9a65[_0xf4b1('0x34')]:_0x1cbcff['model'];if(!_0x56ee5e[_0xf4b1('0x32')][_0xf4b1('0x37')](_0xf4b1('0x38'))){_0xff9a65[_0xf4b1('0x1d')]=qs[_0xf4b1('0x1d')](_0x56ee5e['query'][_0xf4b1('0x1d')]);_0xff9a65['offset']=qs[_0xf4b1('0x1b')](_0x56ee5e['query'][_0xf4b1('0x1b')]);}_0xff9a65[_0xf4b1('0x39')]=qs[_0xf4b1('0x3a')](_0x56ee5e['query'][_0xf4b1('0x3a')]);_0xff9a65[_0xf4b1('0x3b')]=qs[_0xf4b1('0x3c')](_[_0xf4b1('0x3d')](_0x56ee5e[_0xf4b1('0x32')],_0x1cbcff[_0xf4b1('0x3c')]),_0x35d81b);if(_0x56ee5e[_0xf4b1('0x32')]['filter']){_0xff9a65[_0xf4b1('0x3b')]=_[_0xf4b1('0x3e')](_0xff9a65[_0xf4b1('0x3b')],{'$or':_[_0xf4b1('0x31')](_0x35d81b,function(_0x39de7f){if(_0x39de7f[_0xf4b1('0x2e')]!=='VIRTUAL'){var _0x33879b={};_0x33879b[_0x39de7f[_0xf4b1('0x29')]]={'$like':'%'+_0x56ee5e['query']['filter']+'%'};return _0x33879b;}})});}_0xff9a65=_[_0xf4b1('0x3e')]({},_0xff9a65,_0x56ee5e[_0xf4b1('0x3f')]);var _0x439c9d={'where':_0xff9a65[_0xf4b1('0x3b')]};return db[_0xf4b1('0x2b')][_0xf4b1('0x1c')](_0x439c9d)[_0xf4b1('0x23')](function(_0x1600b6){_0x29b9f9['count']=_0x1600b6;if(_0x56ee5e[_0xf4b1('0x32')]['includeAll']){_0xff9a65['include']=[{'all':!![]}];}return db['Tag'][_0xf4b1('0x40')](_0xff9a65);})[_0xf4b1('0x23')](function(_0x28b9f2){_0x29b9f9['rows']=_0x28b9f2;return _0x29b9f9;})[_0xf4b1('0x23')](respondWithFilteredResult(_0x31c13c,_0xff9a65))[_0xf4b1('0x41')](handleError(_0x31c13c,null));};exports[_0xf4b1('0x42')]=function(_0x5597d5,_0x13c130){var _0x15845a={'raw':!![],'where':{'id':_0x5597d5['params']['id']}},_0x1f856c={};_0x1f856c[_0xf4b1('0x30')]=_['keys'](db[_0xf4b1('0x2b')][_0xf4b1('0x2c')]);_0x1f856c[_0xf4b1('0x32')]=_['keys'](_0x5597d5[_0xf4b1('0x32')]);_0x1f856c[_0xf4b1('0x3c')]=_['intersection'](_0x1f856c[_0xf4b1('0x30')],_0x1f856c[_0xf4b1('0x32')]);_0x15845a[_0xf4b1('0x34')]=_[_0xf4b1('0x33')](_0x1f856c['model'],qs['fields'](_0x5597d5[_0xf4b1('0x32')][_0xf4b1('0x35')]));_0x15845a['attributes']=_0x15845a[_0xf4b1('0x34')]['length']?_0x15845a[_0xf4b1('0x34')]:_0x1f856c['model'];if(_0x5597d5[_0xf4b1('0x32')][_0xf4b1('0x43')]){_0x15845a['include']=[{'all':!![]}];}_0x15845a=_[_0xf4b1('0x3e')]({},_0x15845a,_0x5597d5[_0xf4b1('0x3f')]);return db[_0xf4b1('0x2b')][_0xf4b1('0x44')](_0x15845a)[_0xf4b1('0x23')](handleEntityNotFound(_0x13c130,null))[_0xf4b1('0x23')](respondWithResult(_0x13c130,null))[_0xf4b1('0x41')](handleError(_0x13c130,null));};exports[_0xf4b1('0x45')]=function(_0x4e6e04,_0x4a9761){return db[_0xf4b1('0x2b')][_0xf4b1('0x45')](_0x4e6e04['body'],{})[_0xf4b1('0x23')](function(_0x3476b3){var _0x21dc3b=_0x4e6e04[_0xf4b1('0x46')][_0xf4b1('0x47')]({'plain':!![]});if(!_0x21dc3b)throw new Error(_0xf4b1('0x48'));if(_0x21dc3b[_0xf4b1('0x49')]===_0xf4b1('0x46')){var _0x29c3c1=_0x3476b3[_0xf4b1('0x47')]({'plain':!![]});var _0x407ecf=_0xf4b1('0x25');return db[_0xf4b1('0x4a')][_0xf4b1('0x44')]({'where':{'name':_0x407ecf,'userProfileId':_0x21dc3b[_0xf4b1('0x4b')]},'raw':!![]})[_0xf4b1('0x23')](function(_0xacaa0e){if(_0xacaa0e&&_0xacaa0e[_0xf4b1('0x4c')]===0x0){return db[_0xf4b1('0x26')][_0xf4b1('0x45')]({'name':_0x29c3c1[_0xf4b1('0x29')],'resourceId':_0x29c3c1['id'],'type':_0xacaa0e[_0xf4b1('0x29')],'sectionId':_0xacaa0e['id']},{})[_0xf4b1('0x23')](function(){return _0x3476b3;});}else{return _0x3476b3;}})[_0xf4b1('0x41')](function(_0x389ad7){logger[_0xf4b1('0x27')](_0xf4b1('0x4d'),_0x389ad7);throw _0x389ad7;});}return _0x3476b3;})[_0xf4b1('0x23')](respondWithResult(_0x4a9761,0xc9))['catch'](handleError(_0x4a9761,null));};exports[_0xf4b1('0x22')]=function(_0x479e71,_0x5bdd65){if(_0x479e71[_0xf4b1('0x4e')]['id']){delete _0x479e71[_0xf4b1('0x4e')]['id'];}return db['Tag'][_0xf4b1('0x44')]({'where':{'id':_0x479e71[_0xf4b1('0x4f')]['id']}})[_0xf4b1('0x23')](handleEntityNotFound(_0x5bdd65,null))['then'](saveUpdates(_0x479e71['body'],null))[_0xf4b1('0x23')](respondWithResult(_0x5bdd65,null))[_0xf4b1('0x41')](handleError(_0x5bdd65,null));};exports[_0xf4b1('0x24')]=function(_0x38938f,_0x402e6c){return db[_0xf4b1('0x2b')][_0xf4b1('0x44')]({'where':{'id':_0x38938f[_0xf4b1('0x4f')]['id']}})[_0xf4b1('0x23')](handleEntityNotFound(_0x402e6c,null))[_0xf4b1('0x23')](removeEntity(_0x402e6c,null))[_0xf4b1('0x41')](handleError(_0x402e6c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d9e8f95..1f5214b 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 _0x7733=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7733,0x132));var _0x3773=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x7733[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x3773('0x0'));var util=require(_0x3773('0x1'));var logger=require(_0x3773('0x2'))('api');var moment=require(_0x3773('0x3'));var BPromise=require(_0x3773('0x4'));var rp=require(_0x3773('0x5'));var fs=require('fs');var path=require(_0x3773('0x6'));var rimraf=require(_0x3773('0x7'));var config=require(_0x3773('0x8'));var attributes=require(_0x3773('0x9'));module[_0x3773('0xa')]=function(_0x11b671,_0x24d6e8){return _0x11b671[_0x3773('0xb')](_0x3773('0xc'),attributes,{'tableName':_0x3773('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce1e=['tools_tags','lodash','util','api','bluebird','request-promise','path','../../config/environment','./tag.attributes','Tag'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xce1e,0x97));var _0xece1=function(_0x59d024,_0x579b1f){_0x59d024=_0x59d024-0x0;var _0x1f6149=_0xce1e[_0x59d024];return _0x1f6149;};'use strict';var _=require(_0xece1('0x0'));var util=require(_0xece1('0x1'));var logger=require('../../config/logger')(_0xece1('0x2'));var moment=require('moment');var BPromise=require(_0xece1('0x3'));var rp=require(_0xece1('0x4'));var fs=require('fs');var path=require(_0xece1('0x5'));var rimraf=require('rimraf');var config=require(_0xece1('0x6'));var attributes=require(_0xece1('0x7'));module['exports']=function(_0x5f1a12,_0x53a3c1){return _0x5f1a12['define'](_0xece1('0x8'),attributes,{'tableName':_0xece1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index adc5253..1d43ff1 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 _0x01fe=['http','request','then','info','request\x20sent','debug','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x41ac9f,_0x5ce5e2){var _0x1ce6ef=function(_0x15fc44){while(--_0x15fc44){_0x41ac9f['push'](_0x41ac9f['shift']());}};_0x1ce6ef(++_0x5ce5e2);}(_0x01fe,0x102));var _0xe01f=function(_0x25a261,_0x195995){_0x25a261=_0x25a261-0x0;var _0x33685f=_0x01fe[_0x25a261];return _0x33685f;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var moment=require(_0xe01f('0x1'));var BPromise=require(_0xe01f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe01f('0x3'))['db'];var utils=require(_0xe01f('0x4'));var logger=require(_0xe01f('0x5'))(_0xe01f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe01f('0x7'));var client=jayson['client'][_0xe01f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b754f,_0x45431b,_0x40376f){return new BPromise(function(_0x377881,_0x4d1775){return client[_0xe01f('0x9')](_0x3b754f,_0x40376f)[_0xe01f('0xa')](function(_0x47dc30){logger[_0xe01f('0xb')]('Tag,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'));logger[_0xe01f('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x45431b,_0xe01f('0xc'),JSON['stringify'](_0x47dc30));if(_0x47dc30[_0xe01f('0xe')]){if(_0x47dc30[_0xe01f('0xe')][_0xe01f('0xf')]===0x1f4){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x4d1775(_0x47dc30[_0xe01f('0xe')]['message']);}logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);return _0x377881(_0x47dc30[_0xe01f('0xe')][_0xe01f('0x11')]);}else{logger[_0xe01f('0xb')]('Tag,\x20%s,\x20%s',_0x45431b,'request\x20sent');_0x377881(_0x47dc30['result'][_0xe01f('0x11')]);}})[_0xe01f('0x12')](function(_0x88606f){logger[_0xe01f('0xe')](_0xe01f('0x10'),_0x45431b,_0x88606f);_0x4d1775(_0x88606f);});});} \ No newline at end of file +var _0x0f9f=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1b2b63,_0x52b35f){var _0x3e59e5=function(_0x50f119){while(--_0x50f119){_0x1b2b63['push'](_0x1b2b63['shift']());}};_0x3e59e5(++_0x52b35f);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x30a006,_0x143f3a){_0x30a006=_0x30a006-0x0;var _0x393403=_0x0f9f[_0x30a006];return _0x393403;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var BPromise=require(_0xf0f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f9('0x3'));var db=require(_0xf0f9('0x4'))['db'];var utils=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var jayson=require(_0xf0f9('0x9'));var client=jayson[_0xf0f9('0xa')][_0xf0f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45694e,_0x51a0ed,_0x448cf5){return new BPromise(function(_0x294b42,_0x5d1753){return client[_0xf0f9('0xc')](_0x45694e,_0x448cf5)[_0xf0f9('0xd')](function(_0x2d72c9){logger['info'](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));logger[_0xf0f9('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x51a0ed,'request\x20sent',JSON[_0xf0f9('0x11')](_0x2d72c9));if(_0x2d72c9[_0xf0f9('0x12')]){if(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x13')]===0x1f4){logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x5d1753(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x294b42(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}else{logger[_0xf0f9('0x15')](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));_0x294b42(_0x2d72c9[_0xf0f9('0x16')][_0xf0f9('0x14')]);}})[_0xf0f9('0x17')](function(_0x677b32){logger[_0xf0f9('0x12')]('Tag,\x20%s,\x20%s',_0x51a0ed,_0x677b32);_0x5d1753(_0x677b32);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d3a3ffc..19f824a 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 1ba993d..24e3daf 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 _0xbaf0=['name','exports','STRING'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x2b9148,_0x48a4a6){var _0xfcaeae=function(_0x16abc4){while(--_0x16abc4){_0x2b9148['push'](_0x2b9148['shift']());}};_0xfcaeae(++_0x48a4a6);}(_0x2032,0xd9));var _0x2203=function(_0x4a0500,_0xeb95fe){_0x4a0500=_0x4a0500-0x0;var _0x2a7b9a=_0x2032[_0x4a0500];return _0x2a7b9a;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2312444..9fe8db6 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 _0x706b=['UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','options','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','emit','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Chat','Queue:remove','getAgents','nolimit','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','Team','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','ChatQueueId'];(function(_0x199906,_0x4b2987){var _0x10722c=function(_0x3110da){while(--_0x3110da){_0x199906['push'](_0x199906['shift']());}};_0x10722c(++_0x4b2987);}(_0x706b,0xd6));var _0xb706=function(_0x9c4300,_0x1077c5){_0x9c4300=_0x9c4300-0x0;var _0x3cde86=_0x706b[_0x9c4300];return _0x3cde86;};'use strict';var emlformat=require(_0xb706('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb706('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb706('0x2'));var moment=require(_0xb706('0x3'));var BPromise=require(_0xb706('0x4'));var Mustache=require(_0xb706('0x5'));var util=require('util');var path=require(_0xb706('0x6'));var sox=require(_0xb706('0x7'));var csv=require(_0xb706('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb706('0x9'));var squel=require('squel');var crypto=require(_0xb706('0xa'));var jsforce=require(_0xb706('0xb'));var deskjs=require(_0xb706('0xc'));var toCsv=require(_0xb706('0x8'));var querystring=require(_0xb706('0xd'));var Papa=require(_0xb706('0xe'));var Redis=require('ioredis');var authService=require(_0xb706('0xf'));var qs=require(_0xb706('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb706('0x11'));var logger=require(_0xb706('0x12'))(_0xb706('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb706('0x14'));var db=require(_0xb706('0x15'))['db'];config[_0xb706('0x16')]=_[_0xb706('0x17')](config['redis'],{'host':_0xb706('0x18'),'port':0x18eb});var socket=require(_0xb706('0x19'))(new Redis(config[_0xb706('0x16')]));require(_0xb706('0x1a'))[_0xb706('0x1b')](socket);function respondWithStatusCode(_0x3fd850,_0x80d068){_0x80d068=_0x80d068||0xcc;return function(_0x2982d3){if(_0x2982d3){return _0x3fd850['sendStatus'](_0x80d068);}return _0x3fd850['status'](_0x80d068)[_0xb706('0x1c')]();};}function respondWithResult(_0x229f68,_0x3a276b){_0x3a276b=_0x3a276b||0xc8;return function(_0x428fb2){if(_0x428fb2){return _0x229f68[_0xb706('0x1d')](_0x3a276b)[_0xb706('0x1e')](_0x428fb2);}};}function respondWithFilteredResult(_0x48a9f9,_0x574cc8){return function(_0x21cef0){if(_0x21cef0){var _0x52d016=typeof _0x574cc8['offset']===_0xb706('0x1f')&&typeof _0x574cc8[_0xb706('0x20')]===_0xb706('0x1f');var _0xe8ded7=_0x21cef0[_0xb706('0x21')];var _0x36572a=_0x52d016?0x0:_0x574cc8[_0xb706('0x22')];var _0x31404f=_0x52d016?_0x21cef0[_0xb706('0x21')]:_0x574cc8[_0xb706('0x22')]+_0x574cc8[_0xb706('0x20')];var _0x10be07;if(_0x31404f>=_0xe8ded7){_0x31404f=_0xe8ded7;_0x10be07=0xc8;}else{_0x10be07=0xce;}_0x48a9f9[_0xb706('0x1d')](_0x10be07);return _0x48a9f9[_0xb706('0x23')](_0xb706('0x24'),_0x36572a+'-'+_0x31404f+'/'+_0xe8ded7)[_0xb706('0x1e')](_0x21cef0);}return null;};}function patchUpdates(_0x3fbb5b){return function(_0x8a2108){try{jsonpatch['apply'](_0x8a2108,_0x3fbb5b,!![]);}catch(_0x2bab97){return BPromise[_0xb706('0x25')](_0x2bab97);}return _0x8a2108['save']();};}function saveUpdates(_0x3eb8d1,_0x5e5e09){return function(_0x4b5225){if(_0x4b5225){return _0x4b5225[_0xb706('0x26')](_0x3eb8d1)[_0xb706('0x27')](function(_0x2154ea){return _0x2154ea;});}return null;};}function handleEntityNotFound(_0x5cd21a,_0x52e8f5){return function(_0x42bb6e){if(!_0x42bb6e){_0x5cd21a[_0xb706('0x28')](0x194);}return _0x42bb6e;};}function handleError(_0x10076a,_0xac7548){_0xac7548=_0xac7548||0x1f4;return function(_0x224b08){logger[_0xb706('0x29')](_0x224b08[_0xb706('0x2a')]);if(_0x224b08[_0xb706('0x2b')]){delete _0x224b08[_0xb706('0x2b')];}_0x10076a[_0xb706('0x1d')](_0xac7548)[_0xb706('0x2c')](_0x224b08);};}exports[_0xb706('0x2d')]=function(_0x5729c3,_0x276fec){var _0x217006={},_0x232a10={},_0x37e516={'count':0x0,'rows':[]};var _0x466e73=_[_0xb706('0x2e')](db['Team']['rawAttributes'],function(_0x3e442a){return{'name':_0x3e442a[_0xb706('0x2f')],'type':_0x3e442a[_0xb706('0x30')][_0xb706('0x31')]};});_0x232a10['model']=_['map'](_0x466e73,'name');_0x232a10['query']=_[_0xb706('0x32')](_0x5729c3['query']);_0x232a10['filters']=_[_0xb706('0x33')](_0x232a10[_0xb706('0x34')],_0x232a10[_0xb706('0x35')]);_0x217006[_0xb706('0x36')]=_['intersection'](_0x232a10[_0xb706('0x34')],qs['fields'](_0x5729c3['query'][_0xb706('0x37')]));_0x217006[_0xb706('0x36')]=_0x217006[_0xb706('0x36')][_0xb706('0x38')]?_0x217006[_0xb706('0x36')]:_0x232a10[_0xb706('0x34')];if(!_0x5729c3[_0xb706('0x35')][_0xb706('0x39')]('nolimit')){_0x217006[_0xb706('0x20')]=qs[_0xb706('0x20')](_0x5729c3['query'][_0xb706('0x20')]);_0x217006[_0xb706('0x22')]=qs['offset'](_0x5729c3[_0xb706('0x35')]['offset']);}_0x217006[_0xb706('0x3a')]=qs[_0xb706('0x3b')](_0x5729c3['query'][_0xb706('0x3b')]);_0x217006['where']=qs[_0xb706('0x3c')](_[_0xb706('0x3d')](_0x5729c3['query'],_0x232a10['filters']),_0x466e73);if(_0x5729c3['query'][_0xb706('0x3e')]){_0x217006[_0xb706('0x3f')]=_[_0xb706('0x40')](_0x217006['where'],{'$or':_[_0xb706('0x2e')](_0x466e73,function(_0x5e0275){if(_0x5e0275[_0xb706('0x30')]!==_0xb706('0x41')){var _0x455cf0={};_0x455cf0[_0x5e0275[_0xb706('0x2b')]]={'$like':'%'+_0x5729c3[_0xb706('0x35')][_0xb706('0x3e')]+'%'};return _0x455cf0;}})});}_0x217006=_[_0xb706('0x40')]({},_0x217006,_0x5729c3['options']);var _0x20c95c={'where':_0x217006['where']};return db[_0xb706('0x42')][_0xb706('0x21')](_0x20c95c)[_0xb706('0x27')](function(_0x3fb4d0){_0x37e516['count']=_0x3fb4d0;if(_0x5729c3[_0xb706('0x35')][_0xb706('0x43')]){_0x217006['include']=[{'all':!![]}];}return db['Team'][_0xb706('0x44')](_0x217006);})[_0xb706('0x27')](function(_0xe5c991){_0x37e516[_0xb706('0x45')]=_0xe5c991;return _0x37e516;})[_0xb706('0x27')](respondWithFilteredResult(_0x276fec,_0x217006))[_0xb706('0x46')](handleError(_0x276fec,null));};exports['show']=function(_0x128aaa,_0x3a1f55){var _0x3a88b7={'raw':![],'where':{'id':_0x128aaa[_0xb706('0x47')]['id']}},_0x3950a6={};_0x3950a6[_0xb706('0x34')]=_[_0xb706('0x32')](db[_0xb706('0x42')][_0xb706('0x48')]);_0x3950a6[_0xb706('0x35')]=_[_0xb706('0x32')](_0x128aaa[_0xb706('0x35')]);_0x3950a6[_0xb706('0x3c')]=_['intersection'](_0x3950a6[_0xb706('0x34')],_0x3950a6[_0xb706('0x35')]);_0x3a88b7[_0xb706('0x36')]=_[_0xb706('0x33')](_0x3950a6[_0xb706('0x34')],qs[_0xb706('0x37')](_0x128aaa[_0xb706('0x35')]['fields']));_0x3a88b7['attributes']=_0x3a88b7[_0xb706('0x36')][_0xb706('0x38')]?_0x3a88b7[_0xb706('0x36')]:_0x3950a6[_0xb706('0x34')];if(_0x128aaa[_0xb706('0x35')]['includeAll']){_0x3a88b7[_0xb706('0x49')]=[{'all':!![]}];}_0x3a88b7=_[_0xb706('0x40')]({},_0x3a88b7,_0x128aaa['options']);return db['Team'][_0xb706('0x4a')](_0x3a88b7)[_0xb706('0x27')](handleEntityNotFound(_0x3a1f55,null))[_0xb706('0x27')](respondWithResult(_0x3a1f55,null))[_0xb706('0x46')](handleError(_0x3a1f55,null));};exports['create']=function(_0x39291d,_0x45c7c3){return db[_0xb706('0x42')][_0xb706('0x4b')](_0x39291d[_0xb706('0x4c')],{})[_0xb706('0x27')](function(_0x4200fc){var _0x128c2e=_0x39291d['user'][_0xb706('0x4d')]({'plain':!![]});if(!_0x128c2e)throw new Error(_0xb706('0x4e'));if(_0x128c2e['role']===_0xb706('0x4f')){var _0xc9b97=_0x4200fc[_0xb706('0x4d')]({'plain':!![]});var _0x384ffd='Teams';return db[_0xb706('0x50')][_0xb706('0x4a')]({'where':{'name':_0x384ffd,'userProfileId':_0x128c2e[_0xb706('0x51')]},'raw':!![]})[_0xb706('0x27')](function(_0x3b64bc){if(_0x3b64bc&&_0x3b64bc[_0xb706('0x52')]===0x0){return db[_0xb706('0x53')][_0xb706('0x4b')]({'name':_0xc9b97[_0xb706('0x2b')],'resourceId':_0xc9b97['id'],'type':_0x3b64bc[_0xb706('0x2b')],'sectionId':_0x3b64bc['id']},{})[_0xb706('0x27')](function(){return _0x4200fc;});}else{return _0x4200fc;}})[_0xb706('0x46')](function(_0x540f00){logger['error'](_0xb706('0x54'),_0x540f00);throw _0x540f00;});}return _0x4200fc;})[_0xb706('0x27')](respondWithResult(_0x45c7c3,0xc9))[_0xb706('0x46')](handleError(_0x45c7c3,null));};exports[_0xb706('0x26')]=function(_0x4ccb8b,_0x2b3920){if(_0x4ccb8b[_0xb706('0x4c')]['id']){delete _0x4ccb8b['body']['id'];}return db[_0xb706('0x42')]['find']({'where':{'id':_0x4ccb8b['params']['id']}})[_0xb706('0x27')](handleEntityNotFound(_0x2b3920,null))[_0xb706('0x27')](saveUpdates(_0x4ccb8b[_0xb706('0x4c')],null))[_0xb706('0x27')](respondWithResult(_0x2b3920,null))['catch'](handleError(_0x2b3920,null));};exports[_0xb706('0x55')]=function(_0x5b8e26,_0x5c8bb2){var _0x53bf3d=_0x5b8e26[_0xb706('0x47')]['id'];var _0x2d192d=[];return db[_0xb706('0x56')][_0xb706('0x57')](function(_0x1dd50d){var _0x300a7a='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x53bf3d;return db[_0xb706('0x56')][_0xb706('0x35')](_0x300a7a,{'type':db['Sequelize']['QueryTypes'][_0xb706('0x58')],'raw':!![],'transaction':_0x1dd50d})[_0xb706('0x27')](function(_0xb88b5c){_0x2d192d=_['map'](_0xb88b5c,function(_0x27a9b3){return Number(_0x27a9b3[_0xb706('0x59')]);});})[_0xb706('0x27')](function(){var _0x4cccbd=_0xb706('0x5a')+_0x53bf3d;return db[_0xb706('0x56')][_0xb706('0x35')](_0x4cccbd,{'type':db['Sequelize'][_0xb706('0x5b')]['SELECT'],'raw':!![],'transaction':_0x1dd50d});})['then'](function(_0x20179d){var _0x1494bf=_[_0xb706('0x2e')](_0x20179d,function(_0x28435e){return Number(_0x28435e['VoiceQueueId']);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x2d192d},'VoiceQueueId':{'$in':_0x1494bf}},'transaction':_0x1dd50d});})[_0xb706('0x27')](function(){var _0x1d7b28=_0xb706('0x5c')+_0x53bf3d;return db[_0xb706('0x56')][_0xb706('0x35')](_0x1d7b28,{'type':db['Sequelize'][_0xb706('0x5b')][_0xb706('0x58')],'raw':!![],'transaction':_0x1dd50d});})[_0xb706('0x27')](function(_0x599165){var _0x526dca=_[_0xb706('0x2e')](_0x599165,function(_0x148933){return Number(_0x148933[_0xb706('0x5d')]);});return db[_0xb706('0x5e')][_0xb706('0x55')]({'where':{'UserId':{'$in':_0x2d192d},'MailQueueId':{'$in':_0x526dca}},'transaction':_0x1dd50d});})['then'](function(){var _0x307075=_0xb706('0x5f')+_0x53bf3d;return db[_0xb706('0x56')][_0xb706('0x35')](_0x307075,{'type':db['Sequelize'][_0xb706('0x5b')][_0xb706('0x58')],'raw':!![],'transaction':_0x1dd50d});})[_0xb706('0x27')](function(_0x25e29f){var _0x42d6c7=_[_0xb706('0x2e')](_0x25e29f,function(_0x41fe96){return Number(_0x41fe96['SmsQueueId']);});return db[_0xb706('0x60')]['destroy']({'where':{'UserId':{'$in':_0x2d192d},'SmsQueueId':{'$in':_0x42d6c7}},'transaction':_0x1dd50d});})['then'](function(){var _0x223c53='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x53bf3d;return db[_0xb706('0x56')][_0xb706('0x35')](_0x223c53,{'type':db['Sequelize'][_0xb706('0x5b')][_0xb706('0x58')],'raw':!![],'transaction':_0x1dd50d});})[_0xb706('0x27')](function(_0x13a109){var _0x4d9d14=_[_0xb706('0x2e')](_0x13a109,function(_0x1abfc9){return Number(_0x1abfc9[_0xb706('0x61')]);});return db[_0xb706('0x62')][_0xb706('0x55')]({'where':{'UserId':{'$in':_0x2d192d},'ChatQueueId':{'$in':_0x4d9d14}},'transaction':_0x1dd50d});})[_0xb706('0x27')](function(){var _0x47dbaf=_0xb706('0x63')+_0x53bf3d;return db[_0xb706('0x56')][_0xb706('0x35')](_0x47dbaf,{'type':db[_0xb706('0x64')][_0xb706('0x5b')][_0xb706('0x58')],'raw':!![],'transaction':_0x1dd50d});})[_0xb706('0x27')](function(_0x1b36f5){var _0x3fa7aa=_['map'](_0x1b36f5,function(_0x273fe6){return Number(_0x273fe6[_0xb706('0x65')]);});return db[_0xb706('0x66')][_0xb706('0x55')]({'where':{'UserId':{'$in':_0x2d192d},'FaxQueueId':{'$in':_0x3fa7aa}},'transaction':_0x1dd50d});})[_0xb706('0x27')](function(){var _0x1b568d=_0xb706('0x67')+_0x53bf3d;return db[_0xb706('0x56')][_0xb706('0x35')](_0x1b568d,{'type':db['Sequelize'][_0xb706('0x5b')][_0xb706('0x58')],'raw':!![],'transaction':_0x1dd50d});})[_0xb706('0x27')](function(_0x103dd5){var _0x1703ef=_[_0xb706('0x2e')](_0x103dd5,function(_0x40eb9c){return Number(_0x40eb9c[_0xb706('0x68')]);});return db[_0xb706('0x69')][_0xb706('0x55')]({'where':{'UserId':{'$in':_0x2d192d},'OpenchannelQueueId':{'$in':_0x1703ef}},'transaction':_0x1dd50d});})[_0xb706('0x27')](function(){var _0x44215f=_0xb706('0x6a')+_0x53bf3d;return db[_0xb706('0x56')]['query'](_0x44215f,{'type':db[_0xb706('0x64')][_0xb706('0x5b')][_0xb706('0x58')],'raw':!![],'transaction':_0x1dd50d});})[_0xb706('0x27')](function(_0x4a8d1a){var _0x2803c5=_['map'](_0x4a8d1a,function(_0x11b1af){return Number(_0x11b1af[_0xb706('0x6b')]);});return db[_0xb706('0x6c')][_0xb706('0x55')]({'where':{'UserId':{'$in':_0x2d192d},'WhatsappQueueId':{'$in':_0x2803c5}},'transaction':_0x1dd50d});})['then'](function(){return db[_0xb706('0x6d')]['find']({'where':{'TeamId':_0x53bf3d}});})['then'](function(_0x563536){if(_0x563536===null){return;}return db[_0xb706('0x6e')][_0xb706('0x55')]({'where':{'UserId':{'$in':_0x2d192d},'VoicePrefixId':_0x563536[_0xb706('0x6f')]},'transaction':_0x1dd50d});})[_0xb706('0x27')](function(){return db[_0xb706('0x42')]['destroy']({'where':{'id':_0x53bf3d},'cascade':!![],'transaction':_0x1dd50d});})[_0xb706('0x27')](function(_0x13521e){if(_0x13521e===0x0){_0x5c8bb2['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xb706('0x55')]({'where':{'type':'Teams','resourceId':_0x53bf3d},'cascade':!![],'transaction':_0x1dd50d})[_0xb706('0x27')](function(){_0x5c8bb2['status'](0xcc)['end']();});}})[_0xb706('0x46')](function(_0x304b0f){_0x5c8bb2[_0xb706('0x1d')](0x1f4)[_0xb706('0x2c')](_0x304b0f);});});};exports['getQueues']=function(_0x3f2693,_0x4c3367,_0x542e08){return db[_0xb706('0x42')][_0xb706('0x70')]({'where':{'id':_0x3f2693[_0xb706('0x47')]['id']}})[_0xb706('0x27')](handleEntityNotFound(_0x4c3367,null))['then'](function(_0x14fa0c){if(!_0x3f2693[_0xb706('0x35')][_0xb706('0x71')]||!utils[_0xb706('0x72')](_0x3f2693[_0xb706('0x35')][_0xb706('0x71')])){throw new db[(_0xb706('0x64'))][(_0xb706('0x73'))](_0xb706('0x74'));}var _0xf66dc={};var _0x4f8973={};_0x4f8973[_0xb706('0x34')]=_[_0xb706('0x32')](db[_[_0xb706('0x75')](_0x3f2693['query'][_0xb706('0x71')][_0xb706('0x76')]())+_0xb706('0x77')][_0xb706('0x48')]);_0x4f8973['query']=_[_0xb706('0x32')](_0x3f2693['query']);_0x4f8973[_0xb706('0x3c')]=_[_0xb706('0x33')](_0x4f8973[_0xb706('0x34')],_0x4f8973[_0xb706('0x35')]);_0xf66dc[_0xb706('0x36')]=_[_0xb706('0x33')](_0x4f8973[_0xb706('0x34')],qs[_0xb706('0x37')](_0x3f2693['query']['fields']));_0xf66dc[_0xb706('0x36')]=_0xf66dc[_0xb706('0x36')][_0xb706('0x38')]?_0xf66dc['attributes']:_0x4f8973[_0xb706('0x34')];_0xf66dc[_0xb706('0x20')]=qs[_0xb706('0x20')](_0x3f2693[_0xb706('0x35')]['limit']);_0xf66dc[_0xb706('0x22')]=qs['offset'](_0x3f2693[_0xb706('0x35')][_0xb706('0x22')]);_0xf66dc[_0xb706('0x3a')]=qs[_0xb706('0x3b')](_0x3f2693['query'][_0xb706('0x3b')]);_0xf66dc[_0xb706('0x3f')]=qs['filters'](_['pick'](_0x3f2693[_0xb706('0x35')],_0x4f8973[_0xb706('0x3c')]));_0xf66dc=_[_0xb706('0x40')]({},_0xf66dc,_0x3f2693[_0xb706('0x78')]);return _0x14fa0c[_0xb706('0x4d')+_[_0xb706('0x75')](_0x3f2693[_0xb706('0x35')][_0xb706('0x71')]['toLowerCase']())+_0xb706('0x79')](_0xf66dc);})[_0xb706('0x27')](respondWithResult(_0x4c3367,null))[_0xb706('0x46')](handleError(_0x4c3367,null));};exports[_0xb706('0x7a')]=function(_0x54e4c5,_0x283f5c,_0x20e52b){return db['Team'][_0xb706('0x70')]({'where':{'id':_0x54e4c5[_0xb706('0x47')]['id']}})[_0xb706('0x27')](function(_0x1950d9){if(_0x1950d9){if(!_0x54e4c5[_0xb706('0x4c')][_0xb706('0x71')]||!utils[_0xb706('0x72')](_0x54e4c5[_0xb706('0x4c')][_0xb706('0x71')])){throw new db['Sequelize'][(_0xb706('0x73'))](_0xb706('0x74'));}return _0x1950d9[_0xb706('0x7b')+_[_0xb706('0x75')](_0x54e4c5['body'][_0xb706('0x71')][_0xb706('0x76')]())+_0xb706('0x79')](_0x54e4c5[_0xb706('0x4c')][_0xb706('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x283f5c,null))[_0xb706('0x27')](respondWithStatusCode(_0x283f5c,null))[_0xb706('0x46')](handleError(_0x283f5c,null));};exports[_0xb706('0x7d')]=function(_0x1a754a,_0xe874f7,_0x2bff26){return db['Team']['findOne']({'where':{'id':_0x1a754a[_0xb706('0x47')]['id']}})['then'](function(_0x581c73){if(_0x581c73){if(!_0x1a754a[_0xb706('0x35')][_0xb706('0x71')]||!utils[_0xb706('0x72')](_0x1a754a[_0xb706('0x35')][_0xb706('0x71')])){throw new db[(_0xb706('0x64'))][(_0xb706('0x73'))](_0xb706('0x74'));}return _0x581c73[_0xb706('0x7e')+_[_0xb706('0x75')](_0x1a754a[_0xb706('0x35')][_0xb706('0x71')]['toLowerCase']())+'Queues'](_0x1a754a[_0xb706('0x35')][_0xb706('0x7c')]);}return null;})[_0xb706('0x27')](handleEntityNotFound(_0xe874f7,null))[_0xb706('0x27')](respondWithStatusCode(_0xe874f7,null))[_0xb706('0x46')](handleError(_0xe874f7,null));};exports[_0xb706('0x7f')]=function(_0x1f7b17,_0x3914fa){var _0x265751=_[_0xb706('0x80')](_0x1f7b17[_0xb706('0x4c')][_0xb706('0x7c')])?_0x1f7b17[_0xb706('0x4c')]['ids']:[_0x1f7b17[_0xb706('0x4c')][_0xb706('0x7c')]];var _0x5e54d4=_0x1f7b17[_0xb706('0x47')]['id'];return db[_0xb706('0x42')][_0xb706('0x4a')]({'where':{'id':_0x5e54d4}})[_0xb706('0x27')](handleEntityNotFound(_0x3914fa,null))[_0xb706('0x27')](function(_0x37c014){if(_0x37c014){var _0x25cf54=[_0xb706('0x81'),'Chat',_0xb706('0x82'),_0xb706('0x83'),_0xb706('0x84'),_0xb706('0x85'),_0xb706('0x86')];return db[_0xb706('0x56')]['transaction'](function(_0x41b16e){var _0x304dc0=_['map'](_0x25cf54,function(_0x2ad64b){var _0xbb0c80={'attributes':['id',_0xb706('0x2b')]};if(_0x2ad64b===_0xb706('0x81')){_0xbb0c80[_0xb706('0x87')]={'attributes':[_0xb706('0x88')]};}return _0x37c014[_0xb706('0x4d')+_0x2ad64b+_0xb706('0x79')](_0xbb0c80)[_0xb706('0x27')](function(_0x14891c){var _0x29d760=_[_0xb706('0x2e')](_0x14891c,function(_0x2cd2c9){var _0x298f7e=_[_0xb706('0x2e')](_0x265751,function(_0xfc67d6){var _0x1d6031={'where':{'UserId':_0xfc67d6,[_0x2ad64b+_0xb706('0x89')]:_0x2cd2c9['id']},'transaction':_0x41b16e};if(_0x2ad64b===_0xb706('0x81')){_0x1d6031[_0xb706('0x17')]={'penalty':_0x2cd2c9[_0xb706('0x8a')][_0xb706('0x88')]};}return db['User'+_0x2ad64b+_0xb706('0x77')]['findOrCreate'](_0x1d6031)[_0xb706('0x27')](function(){socket[_0xb706('0x8b')](_0xb706('0x4f')+_0x2ad64b+'Queue:save',{'UserId':_0xfc67d6,[_0x2ad64b+'QueueId']:_0x2cd2c9['id']});if(_0x2ad64b!==_0xb706('0x81')){return;}return db[_0xb706('0x8c')][_0xb706('0x44')]({'where':{'id':_0x265751,'online':0x1},'attributes':['id',_0xb706('0x2b'),_0xb706('0x8d'),_0xb706('0x8e'),_0xb706('0x8f')],'raw':!![]})[_0xb706('0x27')](function(_0x1d2fd1){var _0x20008d=_[_0xb706('0x2e')](_0x1d2fd1,function(_0x36be12){return db[_0xb706('0x90')][_0xb706('0x91')]({'membername':_0x36be12['name'],'UserId':_0x36be12['id'],'queue_name':_0x2cd2c9[_0xb706('0x2b')],'VoiceQueueId':_0x2cd2c9['id'],'interface':_[_0xb706('0x92')](_0x36be12[_0xb706('0x8f')])?util[_0xb706('0x93')](_0xb706('0x94'),_0x36be12[_0xb706('0x2b')]):_0x36be12[_0xb706('0x8f')],'paused':_0x36be12[_0xb706('0x8e')]||![],'penalty':_0x2cd2c9[_0xb706('0x8a')][_0xb706('0x88')]},{'transaction':_0x41b16e});});return Promise['all'](_0x20008d);});});});return Promise[_0xb706('0x95')](_0x298f7e);});return Promise[_0xb706('0x95')](_0x29d760);})[_0xb706('0x27')](function(){return db[_0xb706('0x6d')][_0xb706('0x70')]({'where':{'teamId':_0x5e54d4}})['then'](function(_0xa1958f){if(_0xa1958f){var _0x1bf671=_[_0xb706('0x2e')](_0x265751,function(_0x7bdf0b){db[_0xb706('0x6e')][_0xb706('0x91')]({'UserId':_0x7bdf0b,'VoicePrefixId':_0xa1958f[_0xb706('0x6f')]});});return Promise[_0xb706('0x95')](_0x1bf671);}});});});return Promise['all'](_0x304dc0)[_0xb706('0x27')](function(){return _0x37c014[_0xb706('0x7f')](_0x265751,{'transaction':_0x41b16e})[_0xb706('0x96')](function(_0xf56328){return _0xf56328;});});});}})[_0xb706('0x27')](respondWithResult(_0x3914fa,null))[_0xb706('0x46')](handleError(_0x3914fa,null));};exports[_0xb706('0x97')]=function(_0x5b3ef2,_0x400b9c){var _0x179d25=_[_0xb706('0x80')](_0x5b3ef2['query'][_0xb706('0x7c')])?_0x5b3ef2[_0xb706('0x35')][_0xb706('0x7c')]:[_0x5b3ef2[_0xb706('0x35')][_0xb706('0x7c')]];var _0x3cd687=_0x5b3ef2[_0xb706('0x47')]['id'];return db['Team'][_0xb706('0x4a')]({'where':{'id':_0x3cd687}})[_0xb706('0x27')](handleEntityNotFound(_0x400b9c,null))[_0xb706('0x27')](function(_0x5b2a57){if(_0x5b2a57){var _0x1188e2=[_0xb706('0x81'),_0xb706('0x98'),_0xb706('0x82'),_0xb706('0x83'),_0xb706('0x84'),_0xb706('0x85'),_0xb706('0x86')];return db['sequelize']['transaction'](function(_0x3edc7a){var _0x357126=_['map'](_0x1188e2,function(_0x700c0d){var _0x134cdf={'attributes':['id',_0xb706('0x2b')]};return _0x5b2a57[_0xb706('0x4d')+_0x700c0d+'Queues'](_0x134cdf)['then'](function(_0x5d4ab2){var _0x40d687=_[_0xb706('0x2e')](_0x5d4ab2,function(_0x277274){return _0x277274[_0xb706('0x97')](_0x179d25,{'transaction':_0x3edc7a})[_0xb706('0x27')](function(){var _0x4f7ea8=_[_0xb706('0x2e')](_0x179d25,function(_0xcdd34b){socket[_0xb706('0x8b')](_0xb706('0x4f')+_0x700c0d+_0xb706('0x99'),{'UserId':Number(_0xcdd34b),[_0x700c0d+_0xb706('0x89')]:_0x277274['id']});if(_0x700c0d!=='Voice'){return;}return db[_0xb706('0x90')]['destroy']({'where':{'VoiceQueueId':_0x277274['id'],'UserId':_0xcdd34b},'transaction':_0x3edc7a});});return Promise[_0xb706('0x95')](_0x4f7ea8);});});return Promise[_0xb706('0x95')](_0x40d687);});});return Promise[_0xb706('0x95')](_0x357126)[_0xb706('0x27')](function(){return _0x5b2a57['removeAgents'](_0x179d25,{'transaction':_0x3edc7a});})[_0xb706('0x27')](function(){return db[_0xb706('0x6d')][_0xb706('0x70')]({'where':{'teamId':_0x3cd687}})['then'](function(_0x5431b3){if(_0x5431b3){var _0x211d92=_[_0xb706('0x2e')](_0x179d25,function(_0x500b49){db[_0xb706('0x6e')][_0xb706('0x55')]({'where':{'UserId':_0x500b49,'VoicePrefixId':_0x5431b3[_0xb706('0x6f')]}});});return Promise[_0xb706('0x95')](_0x211d92);}});});});}})['then'](respondWithStatusCode(_0x400b9c,null))[_0xb706('0x46')](handleError(_0x400b9c,null));};exports[_0xb706('0x9a')]=function(_0x1750e0,_0x4c3e0b,_0x14dd6b){var _0x1ff077={};var _0x1f98be={};var _0x43a2a0;var _0x4e6ca9;return db[_0xb706('0x42')][_0xb706('0x70')]({'where':{'id':_0x1750e0[_0xb706('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c3e0b,null))[_0xb706('0x27')](function(_0x54228d){if(_0x54228d){_0x43a2a0=_0x54228d;_0x1f98be[_0xb706('0x34')]=_['keys'](db['User'][_0xb706('0x48')]);_0x1f98be[_0xb706('0x35')]=_[_0xb706('0x32')](_0x1750e0['query']);_0x1f98be[_0xb706('0x3c')]=_['intersection'](_0x1f98be[_0xb706('0x34')],_0x1f98be[_0xb706('0x35')]);_0x1ff077[_0xb706('0x36')]=_[_0xb706('0x33')](_0x1f98be[_0xb706('0x34')],qs[_0xb706('0x37')](_0x1750e0[_0xb706('0x35')]['fields']));_0x1ff077[_0xb706('0x36')]=_0x1ff077[_0xb706('0x36')][_0xb706('0x38')]?_0x1ff077[_0xb706('0x36')]:_0x1f98be['model'];_0x1ff077['order']=qs[_0xb706('0x3b')](_0x1750e0[_0xb706('0x35')]['sort']);_0x1ff077[_0xb706('0x3f')]=qs['filters'](_['pick'](_0x1750e0[_0xb706('0x35')],_0x1f98be[_0xb706('0x3c')]));if(_0x1750e0[_0xb706('0x35')][_0xb706('0x3e')]){_0x1ff077[_0xb706('0x3f')]=_['merge'](_0x1ff077[_0xb706('0x3f')],{'$or':_['map'](_0x1ff077['attributes'],function(_0x4f9d7d){var _0x24b3c3={};_0x24b3c3[_0x4f9d7d]={'$like':'%'+_0x1750e0[_0xb706('0x35')][_0xb706('0x3e')]+'%'};return _0x24b3c3;})});}_0x1ff077=_['merge']({},_0x1ff077,_0x1750e0[_0xb706('0x78')]);return _0x43a2a0[_0xb706('0x9a')](_0x1ff077);}})['then'](function(_0x5b013d){if(_0x5b013d){_0x4e6ca9=_0x5b013d[_0xb706('0x38')];if(!_0x1750e0['query']['hasOwnProperty'](_0xb706('0x9b'))){_0x1ff077[_0xb706('0x20')]=qs['limit'](_0x1750e0['query']['limit']);_0x1ff077['offset']=qs[_0xb706('0x22')](_0x1750e0[_0xb706('0x35')][_0xb706('0x22')]);}return _0x43a2a0[_0xb706('0x9a')](_0x1ff077);}})[_0xb706('0x27')](function(_0x49ab4d){if(_0x49ab4d){return _0x49ab4d?{'count':_0x4e6ca9,'rows':_0x49ab4d}:null;}})[_0xb706('0x27')](respondWithResult(_0x4c3e0b,null))['catch'](handleError(_0x4c3e0b,null));}; \ No newline at end of file +var _0xa141=['where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','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','destroy','sequelize','Sequelize','QueryTypes','SELECT','UserId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','add','ids','removeQueues','remove','addAgents','Chat','Mail','Sms','Openchannel','Whatsapp','transaction','through','penalty','QueueId','Voice','TeamVoiceQueue','emit','User','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','isArray','Queue:remove','getAgents','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','Team','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter'];(function(_0x3fa78c,_0x18b0f2){var _0x4cbcc9=function(_0x5163b6){while(--_0x5163b6){_0x3fa78c['push'](_0x3fa78c['shift']());}};_0x4cbcc9(++_0x18b0f2);}(_0xa141,0xfc));var _0x1a14=function(_0x1637df,_0x20b9f9){_0x1637df=_0x1637df-0x0;var _0x2dd4ae=_0xa141[_0x1637df];return _0x2dd4ae;};'use strict';var emlformat=require(_0x1a14('0x0'));var rimraf=require(_0x1a14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a14('0x2'));var rp=require(_0x1a14('0x3'));var moment=require(_0x1a14('0x4'));var BPromise=require(_0x1a14('0x5'));var Mustache=require(_0x1a14('0x6'));var util=require(_0x1a14('0x7'));var path=require(_0x1a14('0x8'));var sox=require(_0x1a14('0x9'));var csv=require(_0x1a14('0xa'));var ejs=require(_0x1a14('0xb'));var fs=require('fs');var fs_extra=require(_0x1a14('0xc'));var _=require(_0x1a14('0xd'));var squel=require(_0x1a14('0xe'));var crypto=require(_0x1a14('0xf'));var jsforce=require(_0x1a14('0x10'));var deskjs=require(_0x1a14('0x11'));var toCsv=require(_0x1a14('0xa'));var querystring=require(_0x1a14('0x12'));var Papa=require(_0x1a14('0x13'));var Redis=require(_0x1a14('0x14'));var authService=require(_0x1a14('0x15'));var qs=require(_0x1a14('0x16'));var as=require(_0x1a14('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a14('0x18'))(_0x1a14('0x19'));var utils=require(_0x1a14('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a14('0x1b'))['db'];config[_0x1a14('0x1c')]=_[_0x1a14('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a14('0x1e'))(new Redis(config[_0x1a14('0x1c')]));require(_0x1a14('0x1f'))[_0x1a14('0x20')](socket);function respondWithStatusCode(_0x15196c,_0x1bda11){_0x1bda11=_0x1bda11||0xcc;return function(_0xba448f){if(_0xba448f){return _0x15196c[_0x1a14('0x21')](_0x1bda11);}return _0x15196c['status'](_0x1bda11)[_0x1a14('0x22')]();};}function respondWithResult(_0x1127ce,_0x4214b6){_0x4214b6=_0x4214b6||0xc8;return function(_0x2234c1){if(_0x2234c1){return _0x1127ce[_0x1a14('0x23')](_0x4214b6)[_0x1a14('0x24')](_0x2234c1);}};}function respondWithFilteredResult(_0x5a8322,_0x51cff5){return function(_0x4c530e){if(_0x4c530e){var _0x333aac=typeof _0x51cff5['offset']===_0x1a14('0x25')&&typeof _0x51cff5['limit']===_0x1a14('0x25');var _0x39e97=_0x4c530e['count'];var _0x41a4fa=_0x333aac?0x0:_0x51cff5[_0x1a14('0x26')];var _0x18edf8=_0x333aac?_0x4c530e[_0x1a14('0x27')]:_0x51cff5[_0x1a14('0x26')]+_0x51cff5[_0x1a14('0x28')];var _0x5e63f6;if(_0x18edf8>=_0x39e97){_0x18edf8=_0x39e97;_0x5e63f6=0xc8;}else{_0x5e63f6=0xce;}_0x5a8322[_0x1a14('0x23')](_0x5e63f6);return _0x5a8322[_0x1a14('0x29')](_0x1a14('0x2a'),_0x41a4fa+'-'+_0x18edf8+'/'+_0x39e97)['json'](_0x4c530e);}return null;};}function patchUpdates(_0x522eba){return function(_0x1855cf){try{jsonpatch[_0x1a14('0x2b')](_0x1855cf,_0x522eba,!![]);}catch(_0x36eeb5){return BPromise[_0x1a14('0x2c')](_0x36eeb5);}return _0x1855cf[_0x1a14('0x2d')]();};}function saveUpdates(_0xccf6fb,_0x33206e){return function(_0x5e1af0){if(_0x5e1af0){return _0x5e1af0[_0x1a14('0x2e')](_0xccf6fb)[_0x1a14('0x2f')](function(_0x46c6db){return _0x46c6db;});}return null;};}function handleEntityNotFound(_0x4a86ba,_0x1e80df){return function(_0x41aaac){if(!_0x41aaac){_0x4a86ba[_0x1a14('0x21')](0x194);}return _0x41aaac;};}function handleError(_0x5198b3,_0x5dca82){_0x5dca82=_0x5dca82||0x1f4;return function(_0x1a4be1){logger[_0x1a14('0x30')](_0x1a4be1[_0x1a14('0x31')]);if(_0x1a4be1['name']){delete _0x1a4be1[_0x1a14('0x32')];}_0x5198b3[_0x1a14('0x23')](_0x5dca82)[_0x1a14('0x33')](_0x1a4be1);};}exports[_0x1a14('0x34')]=function(_0x44cde9,_0x41b5f7){var _0x224a47={},_0x2ed67e={},_0xc3ca94={'count':0x0,'rows':[]};var _0x48390c=_['map'](db[_0x1a14('0x35')][_0x1a14('0x36')],function(_0x1ec461){return{'name':_0x1ec461[_0x1a14('0x37')],'type':_0x1ec461['type'][_0x1a14('0x38')]};});_0x2ed67e['model']=_[_0x1a14('0x39')](_0x48390c,_0x1a14('0x32'));_0x2ed67e['query']=_[_0x1a14('0x3a')](_0x44cde9[_0x1a14('0x3b')]);_0x2ed67e[_0x1a14('0x3c')]=_[_0x1a14('0x3d')](_0x2ed67e[_0x1a14('0x3e')],_0x2ed67e['query']);_0x224a47[_0x1a14('0x3f')]=_['intersection'](_0x2ed67e['model'],qs['fields'](_0x44cde9[_0x1a14('0x3b')][_0x1a14('0x40')]));_0x224a47[_0x1a14('0x3f')]=_0x224a47[_0x1a14('0x3f')][_0x1a14('0x41')]?_0x224a47[_0x1a14('0x3f')]:_0x2ed67e[_0x1a14('0x3e')];if(!_0x44cde9[_0x1a14('0x3b')]['hasOwnProperty'](_0x1a14('0x42'))){_0x224a47[_0x1a14('0x28')]=qs[_0x1a14('0x28')](_0x44cde9[_0x1a14('0x3b')][_0x1a14('0x28')]);_0x224a47[_0x1a14('0x26')]=qs[_0x1a14('0x26')](_0x44cde9[_0x1a14('0x3b')]['offset']);}_0x224a47[_0x1a14('0x43')]=qs[_0x1a14('0x44')](_0x44cde9[_0x1a14('0x3b')][_0x1a14('0x44')]);_0x224a47['where']=qs[_0x1a14('0x3c')](_['pick'](_0x44cde9[_0x1a14('0x3b')],_0x2ed67e[_0x1a14('0x3c')]),_0x48390c);if(_0x44cde9[_0x1a14('0x3b')][_0x1a14('0x45')]){_0x224a47[_0x1a14('0x46')]=_[_0x1a14('0x47')](_0x224a47[_0x1a14('0x46')],{'$or':_[_0x1a14('0x39')](_0x48390c,function(_0x34ba0e){if(_0x34ba0e[_0x1a14('0x48')]!==_0x1a14('0x49')){var _0x59a876={};_0x59a876[_0x34ba0e[_0x1a14('0x32')]]={'$like':'%'+_0x44cde9['query'][_0x1a14('0x45')]+'%'};return _0x59a876;}})});}_0x224a47=_['merge']({},_0x224a47,_0x44cde9['options']);var _0x40a18d={'where':_0x224a47['where']};return db[_0x1a14('0x35')][_0x1a14('0x27')](_0x40a18d)[_0x1a14('0x2f')](function(_0x4eebb5){_0xc3ca94[_0x1a14('0x27')]=_0x4eebb5;if(_0x44cde9[_0x1a14('0x3b')]['includeAll']){_0x224a47[_0x1a14('0x4a')]=[{'all':!![]}];}return db[_0x1a14('0x35')][_0x1a14('0x4b')](_0x224a47);})[_0x1a14('0x2f')](function(_0x30f227){_0xc3ca94[_0x1a14('0x4c')]=_0x30f227;return _0xc3ca94;})[_0x1a14('0x2f')](respondWithFilteredResult(_0x41b5f7,_0x224a47))[_0x1a14('0x4d')](handleError(_0x41b5f7,null));};exports[_0x1a14('0x4e')]=function(_0x136ab6,_0x3c92b7){var _0x3144a6={'raw':![],'where':{'id':_0x136ab6[_0x1a14('0x4f')]['id']}},_0x26a42f={};_0x26a42f[_0x1a14('0x3e')]=_[_0x1a14('0x3a')](db['Team']['rawAttributes']);_0x26a42f[_0x1a14('0x3b')]=_[_0x1a14('0x3a')](_0x136ab6[_0x1a14('0x3b')]);_0x26a42f[_0x1a14('0x3c')]=_[_0x1a14('0x3d')](_0x26a42f[_0x1a14('0x3e')],_0x26a42f[_0x1a14('0x3b')]);_0x3144a6['attributes']=_[_0x1a14('0x3d')](_0x26a42f['model'],qs[_0x1a14('0x40')](_0x136ab6['query'][_0x1a14('0x40')]));_0x3144a6[_0x1a14('0x3f')]=_0x3144a6[_0x1a14('0x3f')][_0x1a14('0x41')]?_0x3144a6['attributes']:_0x26a42f[_0x1a14('0x3e')];if(_0x136ab6[_0x1a14('0x3b')][_0x1a14('0x50')]){_0x3144a6[_0x1a14('0x4a')]=[{'all':!![]}];}_0x3144a6=_[_0x1a14('0x47')]({},_0x3144a6,_0x136ab6[_0x1a14('0x51')]);return db[_0x1a14('0x35')][_0x1a14('0x52')](_0x3144a6)[_0x1a14('0x2f')](handleEntityNotFound(_0x3c92b7,null))[_0x1a14('0x2f')](respondWithResult(_0x3c92b7,null))[_0x1a14('0x4d')](handleError(_0x3c92b7,null));};exports[_0x1a14('0x53')]=function(_0x5c671d,_0x2e1fd8){return db['Team'][_0x1a14('0x53')](_0x5c671d[_0x1a14('0x54')],{})[_0x1a14('0x2f')](function(_0x5a0f63){var _0x3d013d=_0x5c671d[_0x1a14('0x55')][_0x1a14('0x56')]({'plain':!![]});if(!_0x3d013d)throw new Error(_0x1a14('0x57'));if(_0x3d013d[_0x1a14('0x58')]===_0x1a14('0x55')){var _0x56d41d=_0x5a0f63['get']({'plain':!![]});var _0x3ab086='Teams';return db['UserProfileSection'][_0x1a14('0x52')]({'where':{'name':_0x3ab086,'userProfileId':_0x3d013d[_0x1a14('0x59')]},'raw':!![]})[_0x1a14('0x2f')](function(_0xae961d){if(_0xae961d&&_0xae961d[_0x1a14('0x5a')]===0x0){return db[_0x1a14('0x5b')][_0x1a14('0x53')]({'name':_0x56d41d[_0x1a14('0x32')],'resourceId':_0x56d41d['id'],'type':_0xae961d[_0x1a14('0x32')],'sectionId':_0xae961d['id']},{})[_0x1a14('0x2f')](function(){return _0x5a0f63;});}else{return _0x5a0f63;}})[_0x1a14('0x4d')](function(_0x5ecfc2){logger[_0x1a14('0x30')](_0x1a14('0x5c'),_0x5ecfc2);throw _0x5ecfc2;});}return _0x5a0f63;})[_0x1a14('0x2f')](respondWithResult(_0x2e1fd8,0xc9))[_0x1a14('0x4d')](handleError(_0x2e1fd8,null));};exports[_0x1a14('0x2e')]=function(_0x189ec2,_0x3880e7){if(_0x189ec2[_0x1a14('0x54')]['id']){delete _0x189ec2[_0x1a14('0x54')]['id'];}return db[_0x1a14('0x35')][_0x1a14('0x52')]({'where':{'id':_0x189ec2[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](handleEntityNotFound(_0x3880e7,null))[_0x1a14('0x2f')](saveUpdates(_0x189ec2[_0x1a14('0x54')],null))[_0x1a14('0x2f')](respondWithResult(_0x3880e7,null))[_0x1a14('0x4d')](handleError(_0x3880e7,null));};exports[_0x1a14('0x5d')]=function(_0x1b25ce,_0x56544e){var _0x531abc=_0x1b25ce['params']['id'];var _0x4c9ac8=[];return db['sequelize']['transaction'](function(_0x3edabb){var _0x55952f='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x531abc;return db[_0x1a14('0x5e')]['query'](_0x55952f,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb})['then'](function(_0x2fbfee){_0x4c9ac8=_[_0x1a14('0x39')](_0x2fbfee,function(_0x35bd5a){return Number(_0x35bd5a[_0x1a14('0x62')]);});})[_0x1a14('0x2f')](function(){var _0xd54342='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x531abc;return db[_0x1a14('0x5e')][_0x1a14('0x3b')](_0xd54342,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})['then'](function(_0x4bc2a8){var _0x38bcff=_[_0x1a14('0x39')](_0x4bc2a8,function(_0x204b95){return Number(_0x204b95['VoiceQueueId']);});return db[_0x1a14('0x63')]['destroy']({'where':{'UserId':{'$in':_0x4c9ac8},'VoiceQueueId':{'$in':_0x38bcff}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0xfad1f8=_0x1a14('0x64')+_0x531abc;return db['sequelize'][_0x1a14('0x3b')](_0xfad1f8,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x43f01f){var _0x142773=_['map'](_0x43f01f,function(_0x35ce05){return Number(_0x35ce05[_0x1a14('0x65')]);});return db[_0x1a14('0x66')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'MailQueueId':{'$in':_0x142773}},'transaction':_0x3edabb});})['then'](function(){var _0x62e232=_0x1a14('0x67')+_0x531abc;return db['sequelize']['query'](_0x62e232,{'type':db[_0x1a14('0x5f')]['QueryTypes'][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x76326a){var _0xdc0590=_['map'](_0x76326a,function(_0xe14541){return Number(_0xe14541[_0x1a14('0x68')]);});return db[_0x1a14('0x69')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'SmsQueueId':{'$in':_0xdc0590}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0x496789=_0x1a14('0x6a')+_0x531abc;return db[_0x1a14('0x5e')]['query'](_0x496789,{'type':db[_0x1a14('0x5f')]['QueryTypes'][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})['then'](function(_0x5876a2){var _0x23c4a8=_['map'](_0x5876a2,function(_0x184d24){return Number(_0x184d24[_0x1a14('0x6b')]);});return db['UserChatQueue'][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'ChatQueueId':{'$in':_0x23c4a8}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0x15e761='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x531abc;return db[_0x1a14('0x5e')]['query'](_0x15e761,{'type':db['Sequelize'][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x3adbde){var _0x1a3148=_[_0x1a14('0x39')](_0x3adbde,function(_0x3a5c59){return Number(_0x3a5c59[_0x1a14('0x6c')]);});return db[_0x1a14('0x6d')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'FaxQueueId':{'$in':_0x1a3148}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0x21c266=_0x1a14('0x6e')+_0x531abc;return db[_0x1a14('0x5e')][_0x1a14('0x3b')](_0x21c266,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')]['SELECT'],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x20914b){var _0x2936e6=_[_0x1a14('0x39')](_0x20914b,function(_0x270068){return Number(_0x270068[_0x1a14('0x6f')]);});return db[_0x1a14('0x70')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'OpenchannelQueueId':{'$in':_0x2936e6}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0x43189=_0x1a14('0x71')+_0x531abc;return db[_0x1a14('0x5e')]['query'](_0x43189,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x2607ca){var _0x27a669=_['map'](_0x2607ca,function(_0x69193c){return Number(_0x69193c[_0x1a14('0x72')]);});return db['UserWhatsappQueue'][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'WhatsappQueueId':{'$in':_0x27a669}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){return db[_0x1a14('0x73')][_0x1a14('0x52')]({'where':{'TeamId':_0x531abc}});})[_0x1a14('0x2f')](function(_0x2408c2){if(_0x2408c2===null){return;}return db[_0x1a14('0x74')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'VoicePrefixId':_0x2408c2[_0x1a14('0x75')]},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){return db[_0x1a14('0x35')][_0x1a14('0x5d')]({'where':{'id':_0x531abc},'cascade':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x4287f5){if(_0x4287f5===0x0){_0x56544e[_0x1a14('0x21')](0x194);}else{return db[_0x1a14('0x5b')][_0x1a14('0x5d')]({'where':{'type':_0x1a14('0x76'),'resourceId':_0x531abc},'cascade':!![],'transaction':_0x3edabb})[_0x1a14('0x2f')](function(){_0x56544e[_0x1a14('0x23')](0xcc)[_0x1a14('0x22')]();});}})[_0x1a14('0x4d')](function(_0x4abc69){_0x56544e['status'](0x1f4)['send'](_0x4abc69);});});};exports[_0x1a14('0x77')]=function(_0x4bd83f,_0x2fba13,_0x54d97b){return db[_0x1a14('0x35')][_0x1a14('0x78')]({'where':{'id':_0x4bd83f[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](handleEntityNotFound(_0x2fba13,null))[_0x1a14('0x2f')](function(_0x312436){if(!_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x79')]||!utils[_0x1a14('0x7a')](_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x79')])){throw new db[(_0x1a14('0x5f'))][(_0x1a14('0x7b'))](_0x1a14('0x7c'));}var _0x257160={};var _0x11ca43={};_0x11ca43[_0x1a14('0x3e')]=_['keys'](db[_[_0x1a14('0x7d')](_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x79')][_0x1a14('0x7e')]())+_0x1a14('0x7f')][_0x1a14('0x36')]);_0x11ca43[_0x1a14('0x3b')]=_[_0x1a14('0x3a')](_0x4bd83f[_0x1a14('0x3b')]);_0x11ca43['filters']=_[_0x1a14('0x3d')](_0x11ca43[_0x1a14('0x3e')],_0x11ca43['query']);_0x257160[_0x1a14('0x3f')]=_[_0x1a14('0x3d')](_0x11ca43[_0x1a14('0x3e')],qs[_0x1a14('0x40')](_0x4bd83f['query'][_0x1a14('0x40')]));_0x257160[_0x1a14('0x3f')]=_0x257160[_0x1a14('0x3f')]['length']?_0x257160[_0x1a14('0x3f')]:_0x11ca43[_0x1a14('0x3e')];_0x257160['limit']=qs[_0x1a14('0x28')](_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x28')]);_0x257160['offset']=qs['offset'](_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x26')]);_0x257160[_0x1a14('0x43')]=qs[_0x1a14('0x44')](_0x4bd83f[_0x1a14('0x3b')]['sort']);_0x257160[_0x1a14('0x46')]=qs[_0x1a14('0x3c')](_[_0x1a14('0x80')](_0x4bd83f['query'],_0x11ca43['filters']));_0x257160=_[_0x1a14('0x47')]({},_0x257160,_0x4bd83f[_0x1a14('0x51')]);return _0x312436['get'+_[_0x1a14('0x7d')](_0x4bd83f[_0x1a14('0x3b')]['channel'][_0x1a14('0x7e')]())+_0x1a14('0x81')](_0x257160);})[_0x1a14('0x2f')](respondWithResult(_0x2fba13,null))[_0x1a14('0x4d')](handleError(_0x2fba13,null));};exports['addQueues']=function(_0x52cf6e,_0x3c19eb,_0x4bb095){return db['Team'][_0x1a14('0x78')]({'where':{'id':_0x52cf6e[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](function(_0x56ef2c){if(_0x56ef2c){if(!_0x52cf6e[_0x1a14('0x54')]['channel']||!utils[_0x1a14('0x7a')](_0x52cf6e[_0x1a14('0x54')][_0x1a14('0x79')])){throw new db[(_0x1a14('0x5f'))][(_0x1a14('0x7b'))](_0x1a14('0x7c'));}return _0x56ef2c[_0x1a14('0x82')+_[_0x1a14('0x7d')](_0x52cf6e['body']['channel']['toLowerCase']())+_0x1a14('0x81')](_0x52cf6e['body'][_0x1a14('0x83')]);}return null;})['then'](handleEntityNotFound(_0x3c19eb,null))[_0x1a14('0x2f')](respondWithStatusCode(_0x3c19eb,null))[_0x1a14('0x4d')](handleError(_0x3c19eb,null));};exports[_0x1a14('0x84')]=function(_0x4933fe,_0x12b12b,_0x5f3e60){return db[_0x1a14('0x35')][_0x1a14('0x78')]({'where':{'id':_0x4933fe[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](function(_0x528aa9){if(_0x528aa9){if(!_0x4933fe[_0x1a14('0x3b')][_0x1a14('0x79')]||!utils['isValidChannel'](_0x4933fe[_0x1a14('0x3b')][_0x1a14('0x79')])){throw new db['Sequelize']['ValidationError'](_0x1a14('0x7c'));}return _0x528aa9[_0x1a14('0x85')+_[_0x1a14('0x7d')](_0x4933fe['query']['channel'][_0x1a14('0x7e')]())+_0x1a14('0x81')](_0x4933fe['query'][_0x1a14('0x83')]);}return null;})[_0x1a14('0x2f')](handleEntityNotFound(_0x12b12b,null))[_0x1a14('0x2f')](respondWithStatusCode(_0x12b12b,null))['catch'](handleError(_0x12b12b,null));};exports[_0x1a14('0x86')]=function(_0x1dc825,_0xc3cf79){var _0xa6cc90=_['isArray'](_0x1dc825[_0x1a14('0x54')]['ids'])?_0x1dc825['body'][_0x1a14('0x83')]:[_0x1dc825['body']['ids']];var _0x4ebc33=_0x1dc825[_0x1a14('0x4f')]['id'];return db[_0x1a14('0x35')][_0x1a14('0x52')]({'where':{'id':_0x4ebc33}})[_0x1a14('0x2f')](handleEntityNotFound(_0xc3cf79,null))[_0x1a14('0x2f')](function(_0x21aa7d){if(_0x21aa7d){var _0x9498f1=['Voice',_0x1a14('0x87'),_0x1a14('0x88'),_0x1a14('0x89'),'Fax',_0x1a14('0x8a'),_0x1a14('0x8b')];return db[_0x1a14('0x5e')][_0x1a14('0x8c')](function(_0x5a38a0){var _0x48f288=_[_0x1a14('0x39')](_0x9498f1,function(_0x4f16ed){var _0xc0df3c={'attributes':['id','name']};if(_0x4f16ed==='Voice'){_0xc0df3c[_0x1a14('0x8d')]={'attributes':[_0x1a14('0x8e')]};}return _0x21aa7d[_0x1a14('0x56')+_0x4f16ed+'Queues'](_0xc0df3c)[_0x1a14('0x2f')](function(_0x2431de){var _0x372cb7=_[_0x1a14('0x39')](_0x2431de,function(_0x168645){var _0x406558=_['map'](_0xa6cc90,function(_0x3df0ec){var _0x16aa40={'where':{'UserId':_0x3df0ec,[_0x4f16ed+_0x1a14('0x8f')]:_0x168645['id']},'transaction':_0x5a38a0};if(_0x4f16ed===_0x1a14('0x90')){_0x16aa40[_0x1a14('0x1d')]={'penalty':_0x168645[_0x1a14('0x91')]['penalty']};}return db['User'+_0x4f16ed+'Queue']['findOrCreate'](_0x16aa40)[_0x1a14('0x2f')](function(){socket[_0x1a14('0x92')](_0x1a14('0x55')+_0x4f16ed+'Queue:save',{'UserId':_0x3df0ec,[_0x4f16ed+_0x1a14('0x8f')]:_0x168645['id']});if(_0x4f16ed!==_0x1a14('0x90')){return;}return db[_0x1a14('0x93')][_0x1a14('0x4b')]({'where':{'id':_0xa6cc90,'online':0x1},'attributes':['id','name',_0x1a14('0x94'),'voicePause',_0x1a14('0x95')],'raw':!![]})[_0x1a14('0x2f')](function(_0x38a231){var _0x22de36=_[_0x1a14('0x39')](_0x38a231,function(_0x5e42ea){return db[_0x1a14('0x96')][_0x1a14('0x97')]({'membername':_0x5e42ea[_0x1a14('0x32')],'UserId':_0x5e42ea['id'],'queue_name':_0x168645[_0x1a14('0x32')],'VoiceQueueId':_0x168645['id'],'interface':_[_0x1a14('0x98')](_0x5e42ea['interface'])?util[_0x1a14('0x99')](_0x1a14('0x9a'),_0x5e42ea[_0x1a14('0x32')]):_0x5e42ea['interface'],'paused':_0x5e42ea['voicePause']||![],'penalty':_0x168645['TeamVoiceQueue'][_0x1a14('0x8e')]},{'transaction':_0x5a38a0});});return Promise['all'](_0x22de36);});});});return Promise[_0x1a14('0x9b')](_0x406558);});return Promise[_0x1a14('0x9b')](_0x372cb7);})['then'](function(){return db[_0x1a14('0x73')][_0x1a14('0x78')]({'where':{'teamId':_0x4ebc33}})[_0x1a14('0x2f')](function(_0x245f18){if(_0x245f18){var _0x107886=_['map'](_0xa6cc90,function(_0x2a9ec2){db[_0x1a14('0x74')]['upsert']({'UserId':_0x2a9ec2,'VoicePrefixId':_0x245f18[_0x1a14('0x75')]});});return Promise[_0x1a14('0x9b')](_0x107886);}});});});return Promise[_0x1a14('0x9b')](_0x48f288)[_0x1a14('0x2f')](function(){return _0x21aa7d[_0x1a14('0x86')](_0xa6cc90,{'transaction':_0x5a38a0})[_0x1a14('0x9c')](function(_0x391aec){return _0x391aec;});});});}})[_0x1a14('0x2f')](respondWithResult(_0xc3cf79,null))[_0x1a14('0x4d')](handleError(_0xc3cf79,null));};exports[_0x1a14('0x9d')]=function(_0x5e37bd,_0x4c9290){var _0x47c00a=_[_0x1a14('0x9e')](_0x5e37bd[_0x1a14('0x3b')]['ids'])?_0x5e37bd['query'][_0x1a14('0x83')]:[_0x5e37bd[_0x1a14('0x3b')][_0x1a14('0x83')]];var _0x49ca13=_0x5e37bd[_0x1a14('0x4f')]['id'];return db['Team'][_0x1a14('0x52')]({'where':{'id':_0x49ca13}})[_0x1a14('0x2f')](handleEntityNotFound(_0x4c9290,null))[_0x1a14('0x2f')](function(_0xf57085){if(_0xf57085){var _0x1f24b8=[_0x1a14('0x90'),'Chat',_0x1a14('0x88'),_0x1a14('0x89'),'Fax',_0x1a14('0x8a'),'Whatsapp'];return db[_0x1a14('0x5e')][_0x1a14('0x8c')](function(_0x20e151){var _0x485273=_['map'](_0x1f24b8,function(_0x526d54){var _0x316d19={'attributes':['id',_0x1a14('0x32')]};return _0xf57085[_0x1a14('0x56')+_0x526d54+_0x1a14('0x81')](_0x316d19)[_0x1a14('0x2f')](function(_0x74943c){var _0x7b0cdc=_['map'](_0x74943c,function(_0x59d005){return _0x59d005['removeAgents'](_0x47c00a,{'transaction':_0x20e151})['then'](function(){var _0x50bbd6=_['map'](_0x47c00a,function(_0x2b57a3){socket[_0x1a14('0x92')](_0x1a14('0x55')+_0x526d54+_0x1a14('0x9f'),{'UserId':Number(_0x2b57a3),[_0x526d54+_0x1a14('0x8f')]:_0x59d005['id']});if(_0x526d54!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x1a14('0x5d')]({'where':{'VoiceQueueId':_0x59d005['id'],'UserId':_0x2b57a3},'transaction':_0x20e151});});return Promise[_0x1a14('0x9b')](_0x50bbd6);});});return Promise['all'](_0x7b0cdc);});});return Promise[_0x1a14('0x9b')](_0x485273)[_0x1a14('0x2f')](function(){return _0xf57085[_0x1a14('0x9d')](_0x47c00a,{'transaction':_0x20e151});})['then'](function(){return db[_0x1a14('0x73')][_0x1a14('0x78')]({'where':{'teamId':_0x49ca13}})[_0x1a14('0x2f')](function(_0x2a9c46){if(_0x2a9c46){var _0x69e732=_['map'](_0x47c00a,function(_0x5d08f3){db[_0x1a14('0x74')][_0x1a14('0x5d')]({'where':{'UserId':_0x5d08f3,'VoicePrefixId':_0x2a9c46[_0x1a14('0x75')]}});});return Promise['all'](_0x69e732);}});});});}})[_0x1a14('0x2f')](respondWithStatusCode(_0x4c9290,null))[_0x1a14('0x4d')](handleError(_0x4c9290,null));};exports[_0x1a14('0xa0')]=function(_0x551380,_0x4d4480,_0x5f3a86){var _0x52b6cc={};var _0xb365d2={};var _0xf3c854;var _0x401be0;return db[_0x1a14('0x35')][_0x1a14('0x78')]({'where':{'id':_0x551380[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](handleEntityNotFound(_0x4d4480,null))[_0x1a14('0x2f')](function(_0x45e12c){if(_0x45e12c){_0xf3c854=_0x45e12c;_0xb365d2['model']=_['keys'](db['User'][_0x1a14('0x36')]);_0xb365d2[_0x1a14('0x3b')]=_[_0x1a14('0x3a')](_0x551380[_0x1a14('0x3b')]);_0xb365d2[_0x1a14('0x3c')]=_[_0x1a14('0x3d')](_0xb365d2[_0x1a14('0x3e')],_0xb365d2[_0x1a14('0x3b')]);_0x52b6cc['attributes']=_[_0x1a14('0x3d')](_0xb365d2[_0x1a14('0x3e')],qs[_0x1a14('0x40')](_0x551380[_0x1a14('0x3b')][_0x1a14('0x40')]));_0x52b6cc['attributes']=_0x52b6cc[_0x1a14('0x3f')]['length']?_0x52b6cc[_0x1a14('0x3f')]:_0xb365d2['model'];_0x52b6cc['order']=qs[_0x1a14('0x44')](_0x551380['query'][_0x1a14('0x44')]);_0x52b6cc['where']=qs['filters'](_['pick'](_0x551380[_0x1a14('0x3b')],_0xb365d2[_0x1a14('0x3c')]));if(_0x551380[_0x1a14('0x3b')]['filter']){_0x52b6cc[_0x1a14('0x46')]=_['merge'](_0x52b6cc[_0x1a14('0x46')],{'$or':_[_0x1a14('0x39')](_0x52b6cc[_0x1a14('0x3f')],function(_0x3517aa){var _0x619759={};_0x619759[_0x3517aa]={'$like':'%'+_0x551380[_0x1a14('0x3b')][_0x1a14('0x45')]+'%'};return _0x619759;})});}_0x52b6cc=_[_0x1a14('0x47')]({},_0x52b6cc,_0x551380['options']);return _0xf3c854[_0x1a14('0xa0')](_0x52b6cc);}})[_0x1a14('0x2f')](function(_0x278f15){if(_0x278f15){_0x401be0=_0x278f15[_0x1a14('0x41')];if(!_0x551380[_0x1a14('0x3b')]['hasOwnProperty'](_0x1a14('0x42'))){_0x52b6cc[_0x1a14('0x28')]=qs[_0x1a14('0x28')](_0x551380[_0x1a14('0x3b')]['limit']);_0x52b6cc[_0x1a14('0x26')]=qs[_0x1a14('0x26')](_0x551380[_0x1a14('0x3b')][_0x1a14('0x26')]);}return _0xf3c854['getAgents'](_0x52b6cc);}})[_0x1a14('0x2f')](function(_0x5014de){if(_0x5014de){return _0x5014de?{'count':_0x401be0,'rows':_0x5014de}:null;}})['then'](respondWithResult(_0x4d4480,null))[_0x1a14('0x4d')](handleError(_0x4d4480,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 1f13d8c..72767c6 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 _0x8b54=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x3a678e,_0x4d297c){var _0x2e62e7=function(_0x8cf1a9){while(--_0x8cf1a9){_0x3a678e['push'](_0x3a678e['shift']());}};_0x2e62e7(++_0x4d297c);}(_0x8b54,0x1bc));var _0x48b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b54[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x48b5('0x0'));var Team=require(_0x48b5('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x48b5('0x2'),'afterUpdate':_0x48b5('0x3'),'afterDestroy':_0x48b5('0x4')};function emitEvent(_0xa52246){return function(_0x351212,_0x5227a8,_0x3f7f55){TeamEvents['emit'](_0xa52246+':'+_0x351212['id'],_0x351212);TeamEvents[_0x48b5('0x5')](_0xa52246,_0x351212);_0x3f7f55(null);};}for(var e in events){if(events[_0x48b5('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x48b5('0x7')]=TeamEvents; \ No newline at end of file +var _0x26a1=['remove','emit','hasOwnProperty','hook','Team','save','update'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x26a1,0x115));var _0x126a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x26a1[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x126a('0x0')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x126a('0x1'),'afterUpdate':_0x126a('0x2'),'afterDestroy':_0x126a('0x3')};function emitEvent(_0x50b957){return function(_0x2376c5,_0x3149c1,_0x3f4abf){TeamEvents[_0x126a('0x4')](_0x50b957+':'+_0x2376c5['id'],_0x2376c5);TeamEvents['emit'](_0x50b957,_0x2376c5);_0x3f4abf(null);};}for(var e in events){if(events[_0x126a('0x5')](e)){var event=events[e];Team[_0x126a('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8e54317..bd7aa44 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 _0xfe3f=['bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','lodash','../../config/logger','moment'];(function(_0x22d5ca,_0x418dbd){var _0x43d2bf=function(_0x179762){while(--_0x179762){_0x22d5ca['push'](_0x22d5ca['shift']());}};_0x43d2bf(++_0x418dbd);}(_0xfe3f,0x75));var _0xffe3=function(_0xc7e8c1,_0x412a01){_0xc7e8c1=_0xc7e8c1-0x0;var _0x30d27a=_0xfe3f[_0xc7e8c1];return _0x30d27a;};'use strict';var _=require(_0xffe3('0x0'));var util=require('util');var logger=require(_0xffe3('0x1'))('api');var moment=require(_0xffe3('0x2'));var BPromise=require(_0xffe3('0x3'));var rp=require(_0xffe3('0x4'));var fs=require('fs');var path=require(_0xffe3('0x5'));var rimraf=require(_0xffe3('0x6'));var config=require(_0xffe3('0x7'));var attributes=require(_0xffe3('0x8'));module[_0xffe3('0x9')]=function(_0x81bbd6,_0x3a7baa){return _0x81bbd6[_0xffe3('0xa')](_0xffe3('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x980f=['./team.attributes','exports','define','Team','teams','lodash','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x550d42,_0xfc363c){var _0x450795=function(_0x3bb9a0){while(--_0x3bb9a0){_0x550d42['push'](_0x550d42['shift']());}};_0x450795(++_0xfc363c);}(_0x980f,0x91));var _0xf980=function(_0x3db17b,_0x154758){_0x3db17b=_0x3db17b-0x0;var _0x40035f=_0x980f[_0x3db17b];return _0x40035f;};'use strict';var _=require(_0xf980('0x0'));var util=require('util');var logger=require(_0xf980('0x1'))('api');var moment=require(_0xf980('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf980('0x3'));var config=require(_0xf980('0x4'));var attributes=require(_0xf980('0x5'));module[_0xf980('0x6')]=function(_0x5c21c4,_0x117e74){return _0x5c21c4[_0xf980('0x7')](_0xf980('0x8'),attributes,{'tableName':_0xf980('0x9'),'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 3099f80..3363717 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 _0x81fb=['localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x81fb,0x196));var _0xb81f=function(_0x55b4b1,_0x386ead){_0x55b4b1=_0x55b4b1-0x0;var _0x95c169=_0x81fb[_0x55b4b1];return _0x95c169;};'use strict';var _=require(_0xb81f('0x0'));var util=require(_0xb81f('0x1'));var moment=require('moment');var BPromise=require(_0xb81f('0x2'));var rs=require(_0xb81f('0x3'));var fs=require('fs');var Redis=require(_0xb81f('0x4'));var db=require(_0xb81f('0x5'))['db'];var utils=require(_0xb81f('0x6'));var logger=require(_0xb81f('0x7'))(_0xb81f('0x8'));var config=require(_0xb81f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb81f('0xa')][_0xb81f('0xb')]({'port':0x232a});config['redis']=_[_0xb81f('0xc')](config[_0xb81f('0xd')],{'host':_0xb81f('0xe'),'port':0x18eb});var socket=require(_0xb81f('0xf'))(new Redis(config[_0xb81f('0xd')]));require(_0xb81f('0x10'))[_0xb81f('0x11')](socket);function respondWithRpcPromise(_0x12c35d,_0x4f26fa,_0x4a3a00){return new BPromise(function(_0x1d92aa,_0xfd9790){return client[_0xb81f('0x12')](_0x12c35d,_0x4a3a00)[_0xb81f('0x13')](function(_0x37a961){logger['info'](_0xb81f('0x14'),_0x4f26fa,_0xb81f('0x15'));logger[_0xb81f('0x16')](_0xb81f('0x17'),_0x4f26fa,_0xb81f('0x15'),JSON[_0xb81f('0x18')](_0x37a961));if(_0x37a961[_0xb81f('0x19')]){if(_0x37a961[_0xb81f('0x19')][_0xb81f('0x1a')]===0x1f4){logger[_0xb81f('0x19')](_0xb81f('0x14'),_0x4f26fa,_0x37a961['error'][_0xb81f('0x1b')]);return _0xfd9790(_0x37a961[_0xb81f('0x19')][_0xb81f('0x1b')]);}logger[_0xb81f('0x19')](_0xb81f('0x14'),_0x4f26fa,_0x37a961[_0xb81f('0x19')][_0xb81f('0x1b')]);return _0x1d92aa(_0x37a961['error'][_0xb81f('0x1b')]);}else{logger['info'](_0xb81f('0x14'),_0x4f26fa,'request\x20sent');_0x1d92aa(_0x37a961[_0xb81f('0x1c')][_0xb81f('0x1b')]);}})[_0xb81f('0x1d')](function(_0x2d053f){logger[_0xb81f('0x19')](_0xb81f('0x14'),_0x4f26fa,_0x2d053f);_0xfd9790(_0x2d053f);});});} \ No newline at end of file +var _0x84dd=['socket.io-emitter','request','then','info','request\x20sent','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x42226a,_0x53a100){var _0x46f24b=function(_0x40c7ef){while(--_0x40c7ef){_0x42226a['push'](_0x42226a['shift']());}};_0x46f24b(++_0x53a100);}(_0x84dd,0x1cd));var _0xd84d=function(_0x1efe89,_0x33e4b1){_0x1efe89=_0x1efe89-0x0;var _0x203b94=_0x84dd[_0x1efe89];return _0x203b94;};'use strict';var _=require(_0xd84d('0x0'));var util=require(_0xd84d('0x1'));var moment=require(_0xd84d('0x2'));var BPromise=require(_0xd84d('0x3'));var rs=require(_0xd84d('0x4'));var fs=require('fs');var Redis=require(_0xd84d('0x5'));var db=require(_0xd84d('0x6'))['db'];var utils=require(_0xd84d('0x7'));var logger=require('../../config/logger')(_0xd84d('0x8'));var config=require('../../config/environment');var jayson=require(_0xd84d('0x9'));var client=jayson[_0xd84d('0xa')]['http']({'port':0x232a});config[_0xd84d('0xb')]=_[_0xd84d('0xc')](config[_0xd84d('0xb')],{'host':_0xd84d('0xd'),'port':0x18eb});var socket=require(_0xd84d('0xe'))(new Redis(config[_0xd84d('0xb')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x17d803,_0x1a5ee6,_0x445764){return new BPromise(function(_0x59865b,_0x5280ea){return client[_0xd84d('0xf')](_0x17d803,_0x445764)[_0xd84d('0x10')](function(_0x35282f){logger[_0xd84d('0x11')]('Team,\x20%s,\x20%s',_0x1a5ee6,_0xd84d('0x12'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x1a5ee6,_0xd84d('0x12'),JSON[_0xd84d('0x13')](_0x35282f));if(_0x35282f[_0xd84d('0x14')]){if(_0x35282f['error']['code']===0x1f4){logger['error'](_0xd84d('0x15'),_0x1a5ee6,_0x35282f[_0xd84d('0x14')][_0xd84d('0x16')]);return _0x5280ea(_0x35282f[_0xd84d('0x14')]['message']);}logger[_0xd84d('0x14')](_0xd84d('0x15'),_0x1a5ee6,_0x35282f['error']['message']);return _0x59865b(_0x35282f[_0xd84d('0x14')]['message']);}else{logger['info'](_0xd84d('0x15'),_0x1a5ee6,'request\x20sent');_0x59865b(_0x35282f[_0xd84d('0x17')]['message']);}})[_0xd84d('0x18')](function(_0x2d5614){logger[_0xd84d('0x14')](_0xd84d('0x15'),_0x1a5ee6,_0x2d5614);_0x5280ea(_0x2d5614);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 9d72c77..c814806 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 _0x45bb=['update','removeListener','register','team:','./team.events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x45bb,0xd1));var _0xb45b=function(_0xd76828,_0x27e947){_0xd76828=_0xd76828-0x0;var _0x5b9244=_0x45bb[_0xd76828];return _0x5b9244;};'use strict';var TeamEvents=require(_0xb45b('0x0'));var events=['save','remove',_0xb45b('0x1')];function createListener(_0x7448f1,_0x20f3d8){return function(_0x4cb2b6){_0x20f3d8['emit'](_0x7448f1,_0x4cb2b6);};}function removeListener(_0xec3106,_0x3d6839){return function(){TeamEvents[_0xb45b('0x2')](_0xec3106,_0x3d6839);};}exports[_0xb45b('0x3')]=function(_0x266813){for(var _0x319f53=0x0,_0x4fc69e=events['length'];_0x319f53<_0x4fc69e;_0x319f53++){var _0x30064e=events[_0x319f53];var _0x39bb61=createListener(_0xb45b('0x4')+_0x30064e,_0x266813);TeamEvents['on'](_0x30064e,_0x39bb61);}}; \ No newline at end of file +var _0x8f5d=['team:','./team.events','remove','emit','removeListener','register','length'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x8f5d,0x10b));var _0xd8f5=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8f5d[_0x5d6456];return _0x4d66c1;};'use strict';var TeamEvents=require(_0xd8f5('0x0'));var events=['save',_0xd8f5('0x1'),'update'];function createListener(_0x420cf0,_0x5dd77f){return function(_0x481ffc){_0x5dd77f[_0xd8f5('0x2')](_0x420cf0,_0x481ffc);};}function removeListener(_0x288a7a,_0x398075){return function(){TeamEvents[_0xd8f5('0x3')](_0x288a7a,_0x398075);};}exports[_0xd8f5('0x4')]=function(_0x407db3){for(var _0x2f8a1a=0x0,_0x2a28a0=events[_0xd8f5('0x5')];_0x2f8a1a<_0x2a28a0;_0x2f8a1a++){var _0xdbc726=events[_0x2f8a1a];var _0x3aff4e=createListener(_0xd8f5('0x6')+_0xdbc726,_0x407db3);TeamEvents['on'](_0xdbc726,_0x3aff4e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 82b417d..00d21c7 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 _0x5bbd=['exports','INTEGER','sequelize'];(function(_0x1e384d,_0xf98b3e){var _0x19654d=function(_0x33cd2c){while(--_0x33cd2c){_0x1e384d['push'](_0x1e384d['shift']());}};_0x19654d(++_0xf98b3e);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd5bb('0x0'));module[_0xd5bb('0x1')]={'TeamId':{'type':Sequelize[_0xd5bb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd5bb('0x2')]}}; \ No newline at end of file +var _0xe860=['exports','INTEGER','sequelize'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0xe860,0x188));var _0x0e86=function(_0x1c9ae7,_0x4818bb){_0x1c9ae7=_0x1c9ae7-0x0;var _0x2d400d=_0xe860[_0x1c9ae7];return _0x2d400d;};'use strict';var Sequelize=require(_0x0e86('0x0'));module[_0x0e86('0x1')]={'TeamId':{'type':Sequelize[_0x0e86('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x0e86('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2038c0a..2a52ab3 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 _0x4e65=['api','moment','bluebird','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util','../../config/logger'];(function(_0x1f175e,_0x25487c){var _0x4ab74c=function(_0x301e14){while(--_0x301e14){_0x1f175e['push'](_0x1f175e['shift']());}};_0x4ab74c(++_0x25487c);}(_0x4e65,0xc4));var _0x54e6=function(_0x379fdb,_0x5b8315){_0x379fdb=_0x379fdb-0x0;var _0x203985=_0x4e65[_0x379fdb];return _0x203985;};'use strict';var _=require('lodash');var util=require(_0x54e6('0x0'));var logger=require(_0x54e6('0x1'))(_0x54e6('0x2'));var moment=require(_0x54e6('0x3'));var BPromise=require(_0x54e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x54e6('0x5'));var config=require(_0x54e6('0x6'));var attributes=require(_0x54e6('0x7'));module[_0x54e6('0x8')]=function(_0x23b09a,_0x5d1ffc){return _0x23b09a[_0x54e6('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x54e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb574=['./teamVoicePrefix.attributes','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x126261,_0x2854fe){var _0x416163=function(_0xdb10b1){while(--_0xdb10b1){_0x126261['push'](_0x126261['shift']());}};_0x416163(++_0x2854fe);}(_0xb574,0x106));var _0x4b57=function(_0x390b49,_0x480451){_0x390b49=_0x390b49-0x0;var _0x5a98a5=_0xb574[_0x390b49];return _0x5a98a5;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('TeamVoicePrefix',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 40a6308..889f616 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x45977c,_0x7eaed0){var _0x399413=function(_0x41cc76){while(--_0x41cc76){_0x45977c['push'](_0x45977c['shift']());}};_0x399413(++_0x7eaed0);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xccb24f,_0x2285f8){var _0x15b8cc=function(_0x13bd1a){while(--_0x13bd1a){_0xccb24f['push'](_0xccb24f['shift']());}};_0x15b8cc(++_0x2285f8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xcb91[_0x5774be];return _0x4914b4;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index e804c9e..068b01e 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 _0x2942=['sequelize','exports','INTEGER'];(function(_0x16f6e7,_0x2c16b4){var _0x81831a=function(_0x1b2d49){while(--_0x1b2d49){_0x16f6e7['push'](_0x16f6e7['shift']());}};_0x81831a(++_0x2c16b4);}(_0x2942,0x15f));var _0x2294=function(_0x4aba79,_0x1acd82){_0x4aba79=_0x4aba79-0x0;var _0x15a66a=_0x2942[_0x4aba79];return _0x15a66a;};'use strict';var Sequelize=require(_0x2294('0x0'));module[_0x2294('0x1')]={'penalty':{'type':Sequelize[_0x2294('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbf48=['exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbf48,0x1d0));var _0x8bf4=function(_0x1cd7bd,_0x342c01){_0x1cd7bd=_0x1cd7bd-0x0;var _0x8e474b=_0xbf48[_0x1cd7bd];return _0x8e474b;};'use strict';var Sequelize=require('sequelize');module[_0x8bf4('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 1a3700b..f95f347 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 _0x39a9=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define'];(function(_0x5bac95,_0x2b8a59){var _0x61361e=function(_0x33652d){while(--_0x33652d){_0x5bac95['push'](_0x5bac95['shift']());}};_0x61361e(++_0x2b8a59);}(_0x39a9,0x1d0));var _0x939a=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x39a9[_0x5d1044];return _0x3cd90e;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var logger=require(_0x939a('0x2'))(_0x939a('0x3'));var moment=require(_0x939a('0x4'));var BPromise=require(_0x939a('0x5'));var rp=require(_0x939a('0x6'));var fs=require('fs');var path=require(_0x939a('0x7'));var rimraf=require(_0x939a('0x8'));var config=require(_0x939a('0x9'));var attributes=require(_0x939a('0xa'));module['exports']=function(_0x5793fe,_0xed3974){return _0x5793fe[_0x939a('0xb')](_0x939a('0xc'),attributes,{'tableName':_0x939a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x562d=['path','../../config/environment','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x481bd9,_0x522cbf){var _0x16d271=function(_0x48cf50){while(--_0x48cf50){_0x481bd9['push'](_0x481bd9['shift']());}};_0x16d271(++_0x522cbf);}(_0x562d,0xe1));var _0xd562=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0x562d[_0x4fa438];return _0x4e3958;};'use strict';var _=require(_0xd562('0x0'));var util=require(_0xd562('0x1'));var logger=require(_0xd562('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd562('0x3'));var rp=require(_0xd562('0x4'));var fs=require('fs');var path=require(_0xd562('0x5'));var rimraf=require('rimraf');var config=require(_0xd562('0x6'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x1d05e9,_0x46bf9b){return _0x1d05e9[_0xd562('0x7')](_0xd562('0x8'),attributes,{'tableName':_0xd562('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 bee3f4e..2e4ffe7 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 _0x12dc=['then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1a34b9,_0x546fd5){var _0x31cf0f=function(_0x35ad7a){while(--_0x35ad7a){_0x1a34b9['push'](_0x1a34b9['shift']());}};_0x31cf0f(++_0x546fd5);}(_0x12dc,0xb4));var _0xc12d=function(_0x43d890,_0xfec884){_0x43d890=_0x43d890-0x0;var _0x45f1b6=_0x12dc[_0x43d890];return _0x45f1b6;};'use strict';var _=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var moment=require('moment');var BPromise=require(_0xc12d('0x2'));var rs=require(_0xc12d('0x3'));var fs=require('fs');var Redis=require(_0xc12d('0x4'));var db=require(_0xc12d('0x5'))['db'];var utils=require(_0xc12d('0x6'));var logger=require(_0xc12d('0x7'))(_0xc12d('0x8'));var config=require(_0xc12d('0x9'));var jayson=require(_0xc12d('0xa'));var client=jayson['client'][_0xc12d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb47653,_0x3f831b,_0x468429){return new BPromise(function(_0x38a0a2,_0x3cbd03){return client['request'](_0xb47653,_0x468429)[_0xc12d('0xc')](function(_0x25ff0a){logger['info'](_0xc12d('0xd'),_0x3f831b,_0xc12d('0xe'));logger[_0xc12d('0xf')](_0xc12d('0x10'),_0x3f831b,_0xc12d('0xe'),JSON[_0xc12d('0x11')](_0x25ff0a));if(_0x25ff0a[_0xc12d('0x12')]){if(_0x25ff0a[_0xc12d('0x12')][_0xc12d('0x13')]===0x1f4){logger[_0xc12d('0x12')](_0xc12d('0xd'),_0x3f831b,_0x25ff0a[_0xc12d('0x12')][_0xc12d('0x14')]);return _0x3cbd03(_0x25ff0a[_0xc12d('0x12')][_0xc12d('0x14')]);}logger['error'](_0xc12d('0xd'),_0x3f831b,_0x25ff0a[_0xc12d('0x12')]['message']);return _0x38a0a2(_0x25ff0a[_0xc12d('0x12')][_0xc12d('0x14')]);}else{logger[_0xc12d('0x15')](_0xc12d('0xd'),_0x3f831b,_0xc12d('0xe'));_0x38a0a2(_0x25ff0a[_0xc12d('0x16')][_0xc12d('0x14')]);}})[_0xc12d('0x17')](function(_0x39d962){logger[_0xc12d('0x12')](_0xc12d('0xd'),_0x3f831b,_0x39d962);_0x3cbd03(_0x39d962);});});} \ No newline at end of file +var _0x2b84=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x5169ca,_0x2356e5){var _0x13f00d=function(_0xd31006){while(--_0xd31006){_0x5169ca['push'](_0x5169ca['shift']());}};_0x13f00d(++_0x2356e5);}(_0x2b84,0x105));var _0x42b8=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x2b84[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x42b8('0x0'));var util=require('util');var moment=require(_0x42b8('0x1'));var BPromise=require(_0x42b8('0x2'));var rs=require(_0x42b8('0x3'));var fs=require('fs');var Redis=require(_0x42b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42b8('0x5'));var logger=require(_0x42b8('0x6'))(_0x42b8('0x7'));var config=require(_0x42b8('0x8'));var jayson=require(_0x42b8('0x9'));var client=jayson[_0x42b8('0xa')][_0x42b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57e9a,_0x593975,_0x17bf95){return new BPromise(function(_0x57830c,_0x213fec){return client['request'](_0x57e9a,_0x17bf95)['then'](function(_0x3f79f6){logger[_0x42b8('0xc')](_0x42b8('0xd'),_0x593975,_0x42b8('0xe'));logger[_0x42b8('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x593975,_0x42b8('0xe'),JSON[_0x42b8('0x10')](_0x3f79f6));if(_0x3f79f6[_0x42b8('0x11')]){if(_0x3f79f6['error'][_0x42b8('0x12')]===0x1f4){logger[_0x42b8('0x11')](_0x42b8('0xd'),_0x593975,_0x3f79f6['error'][_0x42b8('0x13')]);return _0x213fec(_0x3f79f6[_0x42b8('0x11')]['message']);}logger[_0x42b8('0x11')](_0x42b8('0xd'),_0x593975,_0x3f79f6[_0x42b8('0x11')][_0x42b8('0x13')]);return _0x57830c(_0x3f79f6[_0x42b8('0x11')][_0x42b8('0x13')]);}else{logger[_0x42b8('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x593975,'request\x20sent');_0x57830c(_0x3f79f6[_0x42b8('0x14')][_0x42b8('0x13')]);}})[_0x42b8('0x15')](function(_0x59be69){logger[_0x42b8('0x11')](_0x42b8('0xd'),_0x593975,_0x59be69);_0x213fec(_0x59be69);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b747e48..98aa69c 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 _0x3c8b=['../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','post','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x52edbc,_0x237a2b){_0x52edbc=_0x52edbc-0x0;var _0xea0a2a=_0x3c8b[_0x52edbc];return _0xea0a2a;};'use strict';var multer=require('multer');var util=require(_0xb3c8('0x0'));var path=require('path');var timeout=require(_0xb3c8('0x1'));var express=require(_0xb3c8('0x2'));var router=express[_0xb3c8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb3c8('0x4'));var interaction=require(_0xb3c8('0x5'));var config=require(_0xb3c8('0x6'));var controller=require(_0xb3c8('0x7'));router[_0xb3c8('0x8')]('/',auth[_0xb3c8('0x9')](),controller[_0xb3c8('0xa')]);router[_0xb3c8('0x8')]('/:id',auth[_0xb3c8('0x9')](),controller['show']);router[_0xb3c8('0xb')]('/',auth[_0xb3c8('0x9')](),controller['create']);router['put']('/:id',auth[_0xb3c8('0x9')](),controller[_0xb3c8('0xc')]);router[_0xb3c8('0xd')]('/:id',auth[_0xb3c8('0x9')](),controller[_0xb3c8('0xe')]);module[_0xb3c8('0xf')]=router; \ No newline at end of file +var _0x002d=['./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0x002d,0xca));var _0xd002=function(_0x32755b,_0x4268f6){_0x32755b=_0x32755b-0x0;var _0x147662=_0x002d[_0x32755b];return _0x147662;};'use strict';var multer=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var path=require(_0xd002('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd002('0x3')]();var fs_extra=require(_0xd002('0x4'));var auth=require(_0xd002('0x5'));var interaction=require(_0xd002('0x6'));var config=require(_0xd002('0x7'));var controller=require(_0xd002('0x8'));router[_0xd002('0x9')]('/',auth[_0xd002('0xa')](),controller[_0xd002('0xb')]);router[_0xd002('0x9')](_0xd002('0xc'),auth[_0xd002('0xa')](),controller[_0xd002('0xd')]);router[_0xd002('0xe')]('/',auth[_0xd002('0xa')](),controller[_0xd002('0xf')]);router[_0xd002('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd002('0x11')]);router[_0xd002('0x12')](_0xd002('0xc'),auth['isAuthenticated'](),controller[_0xd002('0x13')]);module[_0xd002('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 1c995b6..aa9c098 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 _0x5033=['exports','STRING','sequelize'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5033,0xb9));var _0x3503=function(_0x34b728,_0x47d7bb){_0x34b728=_0x34b728-0x0;var _0x346125=_0x5033[_0x34b728];return _0x346125;};'use strict';var Sequelize=require(_0x3503('0x0'));module[_0x3503('0x1')]={'name':{'type':Sequelize[_0x3503('0x2')]},'description':{'type':Sequelize[_0x3503('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8d24=['TEXT','sequelize','exports','STRING'];(function(_0x1079b6,_0x573618){var _0x2acc84=function(_0x42e4ee){while(--_0x42e4ee){_0x1079b6['push'](_0x1079b6['shift']());}};_0x2acc84(++_0x573618);}(_0x8d24,0x155));var _0x48d2=function(_0x55c06b,_0x1ab2da){_0x55c06b=_0x55c06b-0x0;var _0x12eb36=_0x8d24[_0x55c06b];return _0x12eb36;};'use strict';var Sequelize=require(_0x48d2('0x0'));module[_0x48d2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x48d2('0x2')]},'html':{'type':Sequelize[_0x48d2('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5d4658b..e684065 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 _0xd849=['includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','apply','update','then','destroy','get','Templates','end','error','stack','name','index','map','Template','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x31416e,_0x1abf1a){var _0x346c98=function(_0x58c09a){while(--_0x58c09a){_0x31416e['push'](_0x31416e['shift']());}};_0x346c98(++_0x1abf1a);}(_0xd849,0xaf));var _0x9d84=function(_0x5e2f89,_0x7b2df8){_0x5e2f89=_0x5e2f89-0x0;var _0x30ebe6=_0xd849[_0x5e2f89];return _0x30ebe6;};'use strict';var emlformat=require(_0x9d84('0x0'));var rimraf=require(_0x9d84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9d84('0x2'));var Mustache=require(_0x9d84('0x3'));var util=require('util');var path=require(_0x9d84('0x4'));var sox=require(_0x9d84('0x5'));var csv=require(_0x9d84('0x6'));var ejs=require(_0x9d84('0x7'));var fs=require('fs');var fs_extra=require(_0x9d84('0x8'));var _=require('lodash');var squel=require(_0x9d84('0x9'));var crypto=require('crypto');var jsforce=require(_0x9d84('0xa'));var deskjs=require(_0x9d84('0xb'));var toCsv=require(_0x9d84('0x6'));var querystring=require(_0x9d84('0xc'));var Papa=require(_0x9d84('0xd'));var Redis=require(_0x9d84('0xe'));var authService=require(_0x9d84('0xf'));var qs=require(_0x9d84('0x10'));var as=require(_0x9d84('0x11'));var hardwareService=require(_0x9d84('0x12'));var logger=require('../../config/logger')(_0x9d84('0x13'));var utils=require(_0x9d84('0x14'));var config=require(_0x9d84('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d84('0x16'))['db'];function respondWithStatusCode(_0x518e97,_0x5df68f){_0x5df68f=_0x5df68f||0xcc;return function(_0x4506e1){if(_0x4506e1){return _0x518e97['sendStatus'](_0x5df68f);}return _0x518e97[_0x9d84('0x17')](_0x5df68f)['end']();};}function respondWithResult(_0x59f61a,_0x138e6a){_0x138e6a=_0x138e6a||0xc8;return function(_0x257a0d){if(_0x257a0d){return _0x59f61a[_0x9d84('0x17')](_0x138e6a)[_0x9d84('0x18')](_0x257a0d);}};}function respondWithFilteredResult(_0xb8d2fe,_0x1fc9d2){return function(_0x4ff663){if(_0x4ff663){var _0xb4f888=typeof _0x1fc9d2[_0x9d84('0x19')]===_0x9d84('0x1a')&&typeof _0x1fc9d2['limit']===_0x9d84('0x1a');var _0x3b64d2=_0x4ff663[_0x9d84('0x1b')];var _0x9a4a8b=_0xb4f888?0x0:_0x1fc9d2['offset'];var _0x3f4a65=_0xb4f888?_0x4ff663[_0x9d84('0x1b')]:_0x1fc9d2[_0x9d84('0x19')]+_0x1fc9d2[_0x9d84('0x1c')];var _0x48b608;if(_0x3f4a65>=_0x3b64d2){_0x3f4a65=_0x3b64d2;_0x48b608=0xc8;}else{_0x48b608=0xce;}_0xb8d2fe[_0x9d84('0x17')](_0x48b608);return _0xb8d2fe['set']('Content-Range',_0x9a4a8b+'-'+_0x3f4a65+'/'+_0x3b64d2)[_0x9d84('0x18')](_0x4ff663);}return null;};}function patchUpdates(_0x191bc3){return function(_0xc17a04){try{jsonpatch[_0x9d84('0x1d')](_0xc17a04,_0x191bc3,!![]);}catch(_0xdf726){return BPromise['reject'](_0xdf726);}return _0xc17a04['save']();};}function saveUpdates(_0xbc7d25,_0x59750f){return function(_0x459076){if(_0x459076){return _0x459076[_0x9d84('0x1e')](_0xbc7d25)[_0x9d84('0x1f')](function(_0x2a52c4){return _0x2a52c4;});}return null;};}function removeEntity(_0x3601ec,_0x77a240){return function(_0x4cb4ea){if(_0x4cb4ea){return _0x4cb4ea[_0x9d84('0x20')]()[_0x9d84('0x1f')](function(){var _0x1f1ca0=_0x4cb4ea[_0x9d84('0x21')]({'plain':!![]});var _0x552fec=_0x9d84('0x22');return db['UserProfileResource'][_0x9d84('0x20')]({'where':{'type':_0x552fec,'resourceId':_0x1f1ca0['id']}})[_0x9d84('0x1f')](function(){return _0x4cb4ea;});})[_0x9d84('0x1f')](function(){_0x3601ec['status'](0xcc)[_0x9d84('0x23')]();});}};}function handleEntityNotFound(_0x15268d,_0x43f35a){return function(_0x505d63){if(!_0x505d63){_0x15268d['sendStatus'](0x194);}return _0x505d63;};}function handleError(_0x3b5059,_0x8ba3bb){_0x8ba3bb=_0x8ba3bb||0x1f4;return function(_0x178a82){logger[_0x9d84('0x24')](_0x178a82[_0x9d84('0x25')]);if(_0x178a82[_0x9d84('0x26')]){delete _0x178a82['name'];}_0x3b5059[_0x9d84('0x17')](_0x8ba3bb)['send'](_0x178a82);};}exports[_0x9d84('0x27')]=function(_0x2f30b1,_0xb04fb7){var _0x17e632={},_0x158fd5={},_0x42955a={'count':0x0,'rows':[]};var _0x596bc1=_[_0x9d84('0x28')](db[_0x9d84('0x29')][_0x9d84('0x2a')],function(_0x18aafc){return{'name':_0x18aafc['fieldName'],'type':_0x18aafc['type'][_0x9d84('0x2b')]};});_0x158fd5[_0x9d84('0x2c')]=_[_0x9d84('0x28')](_0x596bc1,_0x9d84('0x26'));_0x158fd5[_0x9d84('0x2d')]=_[_0x9d84('0x2e')](_0x2f30b1[_0x9d84('0x2d')]);_0x158fd5[_0x9d84('0x2f')]=_[_0x9d84('0x30')](_0x158fd5['model'],_0x158fd5[_0x9d84('0x2d')]);_0x17e632[_0x9d84('0x31')]=_[_0x9d84('0x30')](_0x158fd5[_0x9d84('0x2c')],qs[_0x9d84('0x32')](_0x2f30b1[_0x9d84('0x2d')]['fields']));_0x17e632[_0x9d84('0x31')]=_0x17e632[_0x9d84('0x31')][_0x9d84('0x33')]?_0x17e632[_0x9d84('0x31')]:_0x158fd5[_0x9d84('0x2c')];if(!_0x2f30b1['query'][_0x9d84('0x34')](_0x9d84('0x35'))){_0x17e632[_0x9d84('0x1c')]=qs[_0x9d84('0x1c')](_0x2f30b1[_0x9d84('0x2d')][_0x9d84('0x1c')]);_0x17e632[_0x9d84('0x19')]=qs[_0x9d84('0x19')](_0x2f30b1[_0x9d84('0x2d')]['offset']);}_0x17e632[_0x9d84('0x36')]=qs[_0x9d84('0x37')](_0x2f30b1[_0x9d84('0x2d')][_0x9d84('0x37')]);_0x17e632[_0x9d84('0x38')]=qs[_0x9d84('0x2f')](_[_0x9d84('0x39')](_0x2f30b1[_0x9d84('0x2d')],_0x158fd5[_0x9d84('0x2f')]),_0x596bc1);if(_0x2f30b1[_0x9d84('0x2d')][_0x9d84('0x3a')]){_0x17e632[_0x9d84('0x38')]=_[_0x9d84('0x3b')](_0x17e632[_0x9d84('0x38')],{'$or':_[_0x9d84('0x28')](_0x596bc1,function(_0xaff2e4){if(_0xaff2e4[_0x9d84('0x3c')]!==_0x9d84('0x3d')){var _0x5b7f6f={};_0x5b7f6f[_0xaff2e4[_0x9d84('0x26')]]={'$like':'%'+_0x2f30b1[_0x9d84('0x2d')][_0x9d84('0x3a')]+'%'};return _0x5b7f6f;}})});}_0x17e632=_[_0x9d84('0x3b')]({},_0x17e632,_0x2f30b1['options']);var _0x57f125={'where':_0x17e632[_0x9d84('0x38')]};return db[_0x9d84('0x29')][_0x9d84('0x1b')](_0x57f125)[_0x9d84('0x1f')](function(_0x5c55ce){_0x42955a[_0x9d84('0x1b')]=_0x5c55ce;if(_0x2f30b1[_0x9d84('0x2d')][_0x9d84('0x3e')]){_0x17e632[_0x9d84('0x3f')]=[{'all':!![]}];}return db[_0x9d84('0x29')][_0x9d84('0x40')](_0x17e632);})[_0x9d84('0x1f')](function(_0x4f2d54){_0x42955a[_0x9d84('0x41')]=_0x4f2d54;return _0x42955a;})['then'](respondWithFilteredResult(_0xb04fb7,_0x17e632))['catch'](handleError(_0xb04fb7,null));};exports[_0x9d84('0x42')]=function(_0x43e84a,_0xfd6a11){var _0x36ccfd={'raw':!![],'where':{'id':_0x43e84a[_0x9d84('0x43')]['id']}},_0x5e67d0={};_0x5e67d0[_0x9d84('0x2c')]=_['keys'](db[_0x9d84('0x29')][_0x9d84('0x2a')]);_0x5e67d0[_0x9d84('0x2d')]=_[_0x9d84('0x2e')](_0x43e84a['query']);_0x5e67d0[_0x9d84('0x2f')]=_[_0x9d84('0x30')](_0x5e67d0[_0x9d84('0x2c')],_0x5e67d0[_0x9d84('0x2d')]);_0x36ccfd[_0x9d84('0x31')]=_[_0x9d84('0x30')](_0x5e67d0['model'],qs[_0x9d84('0x32')](_0x43e84a[_0x9d84('0x2d')][_0x9d84('0x32')]));_0x36ccfd[_0x9d84('0x31')]=_0x36ccfd[_0x9d84('0x31')][_0x9d84('0x33')]?_0x36ccfd['attributes']:_0x5e67d0[_0x9d84('0x2c')];if(_0x43e84a['query'][_0x9d84('0x3e')]){_0x36ccfd[_0x9d84('0x3f')]=[{'all':!![]}];}_0x36ccfd=_[_0x9d84('0x3b')]({},_0x36ccfd,_0x43e84a[_0x9d84('0x44')]);return db['Template'][_0x9d84('0x45')](_0x36ccfd)[_0x9d84('0x1f')](handleEntityNotFound(_0xfd6a11,null))[_0x9d84('0x1f')](respondWithResult(_0xfd6a11,null))[_0x9d84('0x46')](handleError(_0xfd6a11,null));};exports[_0x9d84('0x47')]=function(_0x4935ad,_0x57d6d8){return db[_0x9d84('0x29')][_0x9d84('0x47')](_0x4935ad[_0x9d84('0x48')],{})['then'](function(_0x454f7f){var _0x42aaba=_0x4935ad[_0x9d84('0x49')]['get']({'plain':!![]});if(!_0x42aaba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42aaba[_0x9d84('0x4a')]===_0x9d84('0x49')){var _0x2af481=_0x454f7f[_0x9d84('0x21')]({'plain':!![]});var _0x2af0b1=_0x9d84('0x22');return db[_0x9d84('0x4b')][_0x9d84('0x45')]({'where':{'name':_0x2af0b1,'userProfileId':_0x42aaba['userProfileId']},'raw':!![]})[_0x9d84('0x1f')](function(_0x38f703){if(_0x38f703&&_0x38f703[_0x9d84('0x4c')]===0x0){return db[_0x9d84('0x4d')][_0x9d84('0x47')]({'name':_0x2af481[_0x9d84('0x26')],'resourceId':_0x2af481['id'],'type':_0x38f703[_0x9d84('0x26')],'sectionId':_0x38f703['id']},{})['then'](function(){return _0x454f7f;});}else{return _0x454f7f;}})[_0x9d84('0x46')](function(_0x2d0340){logger[_0x9d84('0x24')](_0x9d84('0x4e'),_0x2d0340);throw _0x2d0340;});}return _0x454f7f;})[_0x9d84('0x1f')](respondWithResult(_0x57d6d8,0xc9))[_0x9d84('0x46')](handleError(_0x57d6d8,null));};exports['update']=function(_0x4145db,_0x1d0a12){if(_0x4145db[_0x9d84('0x48')]['id']){delete _0x4145db[_0x9d84('0x48')]['id'];}return db[_0x9d84('0x29')][_0x9d84('0x45')]({'where':{'id':_0x4145db[_0x9d84('0x43')]['id']}})[_0x9d84('0x1f')](handleEntityNotFound(_0x1d0a12,null))['then'](saveUpdates(_0x4145db[_0x9d84('0x48')],null))[_0x9d84('0x1f')](respondWithResult(_0x1d0a12,null))[_0x9d84('0x46')](handleError(_0x1d0a12,null));};exports[_0x9d84('0x20')]=function(_0x298e2e,_0x382c6f){return db[_0x9d84('0x29')][_0x9d84('0x45')]({'where':{'id':_0x298e2e['params']['id']}})[_0x9d84('0x1f')](handleEntityNotFound(_0x382c6f,null))[_0x9d84('0x1f')](removeEntity(_0x382c6f,null))['catch'](handleError(_0x382c6f,null));}; \ No newline at end of file +var _0x05ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','Template','fieldName','model','query','keys'];(function(_0x2584b8,_0x5e096c){var _0x28a489=function(_0x438912){while(--_0x438912){_0x2584b8['push'](_0x2584b8['shift']());}};_0x28a489(++_0x5e096c);}(_0x05ef,0x175));var _0xf05e=function(_0x39d024,_0x5c5797){_0x39d024=_0x39d024-0x0;var _0x311bdd=_0x05ef[_0x39d024];return _0x311bdd;};'use strict';var emlformat=require(_0xf05e('0x0'));var rimraf=require(_0xf05e('0x1'));var zipdir=require(_0xf05e('0x2'));var jsonpatch=require(_0xf05e('0x3'));var rp=require(_0xf05e('0x4'));var moment=require(_0xf05e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf05e('0x6'));var path=require(_0xf05e('0x7'));var sox=require(_0xf05e('0x8'));var csv=require(_0xf05e('0x9'));var ejs=require(_0xf05e('0xa'));var fs=require('fs');var fs_extra=require(_0xf05e('0xb'));var _=require(_0xf05e('0xc'));var squel=require('squel');var crypto=require(_0xf05e('0xd'));var jsforce=require(_0xf05e('0xe'));var deskjs=require(_0xf05e('0xf'));var toCsv=require(_0xf05e('0x9'));var querystring=require(_0xf05e('0x10'));var Papa=require(_0xf05e('0x11'));var Redis=require(_0xf05e('0x12'));var authService=require(_0xf05e('0x13'));var qs=require(_0xf05e('0x14'));var as=require(_0xf05e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf05e('0x16'));var utils=require(_0xf05e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf05e('0x18'));var db=require(_0xf05e('0x19'))['db'];function respondWithStatusCode(_0x1529a4,_0x3f4c2e){_0x3f4c2e=_0x3f4c2e||0xcc;return function(_0x5a07da){if(_0x5a07da){return _0x1529a4[_0xf05e('0x1a')](_0x3f4c2e);}return _0x1529a4[_0xf05e('0x1b')](_0x3f4c2e)[_0xf05e('0x1c')]();};}function respondWithResult(_0x54cc02,_0x49ce4e){_0x49ce4e=_0x49ce4e||0xc8;return function(_0x596483){if(_0x596483){return _0x54cc02['status'](_0x49ce4e)[_0xf05e('0x1d')](_0x596483);}};}function respondWithFilteredResult(_0x359a99,_0x44f837){return function(_0x245968){if(_0x245968){var _0x375af2=typeof _0x44f837[_0xf05e('0x1e')]===_0xf05e('0x1f')&&typeof _0x44f837[_0xf05e('0x20')]==='undefined';var _0x546ba1=_0x245968[_0xf05e('0x21')];var _0x767218=_0x375af2?0x0:_0x44f837[_0xf05e('0x1e')];var _0x493e3d=_0x375af2?_0x245968['count']:_0x44f837[_0xf05e('0x1e')]+_0x44f837[_0xf05e('0x20')];var _0xd61178;if(_0x493e3d>=_0x546ba1){_0x493e3d=_0x546ba1;_0xd61178=0xc8;}else{_0xd61178=0xce;}_0x359a99[_0xf05e('0x1b')](_0xd61178);return _0x359a99[_0xf05e('0x22')](_0xf05e('0x23'),_0x767218+'-'+_0x493e3d+'/'+_0x546ba1)[_0xf05e('0x1d')](_0x245968);}return null;};}function patchUpdates(_0x25567a){return function(_0x4b5990){try{jsonpatch[_0xf05e('0x24')](_0x4b5990,_0x25567a,!![]);}catch(_0x423f72){return BPromise[_0xf05e('0x25')](_0x423f72);}return _0x4b5990[_0xf05e('0x26')]();};}function saveUpdates(_0x46351a,_0x5b5f41){return function(_0x10f95e){if(_0x10f95e){return _0x10f95e[_0xf05e('0x27')](_0x46351a)['then'](function(_0x3dad5c){return _0x3dad5c;});}return null;};}function removeEntity(_0x1bafb6,_0x538a36){return function(_0x3415b7){if(_0x3415b7){return _0x3415b7['destroy']()['then'](function(){var _0xaaadcb=_0x3415b7['get']({'plain':!![]});var _0x3e33ab='Templates';return db['UserProfileResource'][_0xf05e('0x28')]({'where':{'type':_0x3e33ab,'resourceId':_0xaaadcb['id']}})[_0xf05e('0x29')](function(){return _0x3415b7;});})[_0xf05e('0x29')](function(){_0x1bafb6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x305bed,_0x424060){return function(_0x4d92f1){if(!_0x4d92f1){_0x305bed[_0xf05e('0x1a')](0x194);}return _0x4d92f1;};}function handleError(_0x473774,_0x4218b2){_0x4218b2=_0x4218b2||0x1f4;return function(_0x43d46f){logger[_0xf05e('0x2a')](_0x43d46f[_0xf05e('0x2b')]);if(_0x43d46f[_0xf05e('0x2c')]){delete _0x43d46f['name'];}_0x473774[_0xf05e('0x1b')](_0x4218b2)['send'](_0x43d46f);};}exports[_0xf05e('0x2d')]=function(_0x11ab82,_0x4bc362){var _0x2afd94={},_0x302c21={},_0x3fec78={'count':0x0,'rows':[]};var _0x5342c8=_[_0xf05e('0x2e')](db[_0xf05e('0x2f')]['rawAttributes'],function(_0x4d40c9){return{'name':_0x4d40c9[_0xf05e('0x30')],'type':_0x4d40c9['type']['key']};});_0x302c21[_0xf05e('0x31')]=_['map'](_0x5342c8,_0xf05e('0x2c'));_0x302c21[_0xf05e('0x32')]=_[_0xf05e('0x33')](_0x11ab82[_0xf05e('0x32')]);_0x302c21['filters']=_[_0xf05e('0x34')](_0x302c21[_0xf05e('0x31')],_0x302c21[_0xf05e('0x32')]);_0x2afd94[_0xf05e('0x35')]=_['intersection'](_0x302c21[_0xf05e('0x31')],qs[_0xf05e('0x36')](_0x11ab82[_0xf05e('0x32')]['fields']));_0x2afd94['attributes']=_0x2afd94[_0xf05e('0x35')][_0xf05e('0x37')]?_0x2afd94[_0xf05e('0x35')]:_0x302c21[_0xf05e('0x31')];if(!_0x11ab82[_0xf05e('0x32')][_0xf05e('0x38')](_0xf05e('0x39'))){_0x2afd94[_0xf05e('0x20')]=qs[_0xf05e('0x20')](_0x11ab82[_0xf05e('0x32')][_0xf05e('0x20')]);_0x2afd94[_0xf05e('0x1e')]=qs[_0xf05e('0x1e')](_0x11ab82[_0xf05e('0x32')]['offset']);}_0x2afd94['order']=qs[_0xf05e('0x3a')](_0x11ab82[_0xf05e('0x32')]['sort']);_0x2afd94[_0xf05e('0x3b')]=qs['filters'](_['pick'](_0x11ab82['query'],_0x302c21[_0xf05e('0x3c')]),_0x5342c8);if(_0x11ab82[_0xf05e('0x32')][_0xf05e('0x3d')]){_0x2afd94[_0xf05e('0x3b')]=_[_0xf05e('0x3e')](_0x2afd94[_0xf05e('0x3b')],{'$or':_[_0xf05e('0x2e')](_0x5342c8,function(_0x4d1a39){if(_0x4d1a39[_0xf05e('0x3f')]!=='VIRTUAL'){var _0x25e130={};_0x25e130[_0x4d1a39[_0xf05e('0x2c')]]={'$like':'%'+_0x11ab82[_0xf05e('0x32')][_0xf05e('0x3d')]+'%'};return _0x25e130;}})});}_0x2afd94=_[_0xf05e('0x3e')]({},_0x2afd94,_0x11ab82[_0xf05e('0x40')]);var _0x386ccd={'where':_0x2afd94['where']};return db['Template']['count'](_0x386ccd)['then'](function(_0x5d5b8a){_0x3fec78['count']=_0x5d5b8a;if(_0x11ab82[_0xf05e('0x32')][_0xf05e('0x41')]){_0x2afd94[_0xf05e('0x42')]=[{'all':!![]}];}return db[_0xf05e('0x2f')][_0xf05e('0x43')](_0x2afd94);})[_0xf05e('0x29')](function(_0x5614b8){_0x3fec78[_0xf05e('0x44')]=_0x5614b8;return _0x3fec78;})[_0xf05e('0x29')](respondWithFilteredResult(_0x4bc362,_0x2afd94))[_0xf05e('0x45')](handleError(_0x4bc362,null));};exports[_0xf05e('0x46')]=function(_0x24c99c,_0x33b81d){var _0x288f10={'raw':!![],'where':{'id':_0x24c99c[_0xf05e('0x47')]['id']}},_0x269e25={};_0x269e25['model']=_[_0xf05e('0x33')](db[_0xf05e('0x2f')][_0xf05e('0x48')]);_0x269e25['query']=_[_0xf05e('0x33')](_0x24c99c[_0xf05e('0x32')]);_0x269e25[_0xf05e('0x3c')]=_[_0xf05e('0x34')](_0x269e25[_0xf05e('0x31')],_0x269e25[_0xf05e('0x32')]);_0x288f10[_0xf05e('0x35')]=_[_0xf05e('0x34')](_0x269e25[_0xf05e('0x31')],qs[_0xf05e('0x36')](_0x24c99c[_0xf05e('0x32')]['fields']));_0x288f10[_0xf05e('0x35')]=_0x288f10[_0xf05e('0x35')]['length']?_0x288f10[_0xf05e('0x35')]:_0x269e25[_0xf05e('0x31')];if(_0x24c99c[_0xf05e('0x32')][_0xf05e('0x41')]){_0x288f10[_0xf05e('0x42')]=[{'all':!![]}];}_0x288f10=_[_0xf05e('0x3e')]({},_0x288f10,_0x24c99c[_0xf05e('0x40')]);return db['Template']['find'](_0x288f10)['then'](handleEntityNotFound(_0x33b81d,null))['then'](respondWithResult(_0x33b81d,null))[_0xf05e('0x45')](handleError(_0x33b81d,null));};exports[_0xf05e('0x49')]=function(_0x410a6d,_0x245a3f){return db[_0xf05e('0x2f')][_0xf05e('0x49')](_0x410a6d[_0xf05e('0x4a')],{})[_0xf05e('0x29')](function(_0x23d293){var _0x181d13=_0x410a6d[_0xf05e('0x4b')][_0xf05e('0x4c')]({'plain':!![]});if(!_0x181d13)throw new Error(_0xf05e('0x4d'));if(_0x181d13[_0xf05e('0x4e')]===_0xf05e('0x4b')){var _0x5bbc10=_0x23d293[_0xf05e('0x4c')]({'plain':!![]});var _0x5720f2=_0xf05e('0x4f');return db[_0xf05e('0x50')][_0xf05e('0x51')]({'where':{'name':_0x5720f2,'userProfileId':_0x181d13[_0xf05e('0x52')]},'raw':!![]})[_0xf05e('0x29')](function(_0xbef5c0){if(_0xbef5c0&&_0xbef5c0['autoAssociation']===0x0){return db[_0xf05e('0x53')]['create']({'name':_0x5bbc10[_0xf05e('0x2c')],'resourceId':_0x5bbc10['id'],'type':_0xbef5c0[_0xf05e('0x2c')],'sectionId':_0xbef5c0['id']},{})['then'](function(){return _0x23d293;});}else{return _0x23d293;}})[_0xf05e('0x45')](function(_0x28e84e){logger['error'](_0xf05e('0x54'),_0x28e84e);throw _0x28e84e;});}return _0x23d293;})[_0xf05e('0x29')](respondWithResult(_0x245a3f,0xc9))['catch'](handleError(_0x245a3f,null));};exports[_0xf05e('0x27')]=function(_0x23ef70,_0x1c05a6){if(_0x23ef70[_0xf05e('0x4a')]['id']){delete _0x23ef70['body']['id'];}return db[_0xf05e('0x2f')]['find']({'where':{'id':_0x23ef70[_0xf05e('0x47')]['id']}})[_0xf05e('0x29')](handleEntityNotFound(_0x1c05a6,null))[_0xf05e('0x29')](saveUpdates(_0x23ef70[_0xf05e('0x4a')],null))[_0xf05e('0x29')](respondWithResult(_0x1c05a6,null))[_0xf05e('0x45')](handleError(_0x1c05a6,null));};exports['destroy']=function(_0x120f88,_0x2aa667){return db[_0xf05e('0x2f')][_0xf05e('0x51')]({'where':{'id':_0x120f88[_0xf05e('0x47')]['id']}})[_0xf05e('0x29')](handleEntityNotFound(_0x2aa667,null))[_0xf05e('0x29')](removeEntity(_0x2aa667,null))['catch'](handleError(_0x2aa667,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c471643..e8d9e8c 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 _0xce39=['moment','request-promise','rimraf','../../config/environment','./template.attributes','Template','tools_templates','lodash','util','api'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xce39,0x11f));var _0x9ce3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce39[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ce3('0x0'));var util=require(_0x9ce3('0x1'));var logger=require('../../config/logger')(_0x9ce3('0x2'));var moment=require(_0x9ce3('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ce3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ce3('0x5'));var config=require(_0x9ce3('0x6'));var attributes=require(_0x9ce3('0x7'));module['exports']=function(_0xd366e,_0x5ddf7a){return _0xd366e['define'](_0x9ce3('0x8'),attributes,{'tableName':_0x9ce3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf52=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./template.attributes','exports','define'];(function(_0x469da9,_0x37a5e0){var _0x63f0ca=function(_0x427913){while(--_0x427913){_0x469da9['push'](_0x469da9['shift']());}};_0x63f0ca(++_0x37a5e0);}(_0xcf52,0xb5));var _0x2cf5=function(_0x5a0aa6,_0x399b13){_0x5a0aa6=_0x5a0aa6-0x0;var _0x577dea=_0xcf52[_0x5a0aa6];return _0x577dea;};'use strict';var _=require(_0x2cf5('0x0'));var util=require(_0x2cf5('0x1'));var logger=require(_0x2cf5('0x2'))(_0x2cf5('0x3'));var moment=require(_0x2cf5('0x4'));var BPromise=require(_0x2cf5('0x5'));var rp=require(_0x2cf5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2cf5('0x7'));var attributes=require(_0x2cf5('0x8'));module[_0x2cf5('0x9')]=function(_0x1d93b4,_0x35c176){return _0x1d93b4[_0x2cf5('0xa')]('Template',attributes,{'tableName':_0x2cf5('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 0a55394..9fc7d3c 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 _0x66ee=['GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch'];(function(_0x18b5fd,_0x5ea562){var _0x1adb88=function(_0x4c1349){while(--_0x4c1349){_0x18b5fd['push'](_0x18b5fd['shift']());}};_0x1adb88(++_0x5ea562);}(_0x66ee,0xb4));var _0xe66e=function(_0x3b4d9e,_0x50544e){_0x3b4d9e=_0x3b4d9e-0x0;var _0x226d99=_0x66ee[_0x3b4d9e];return _0x226d99;};'use strict';var _=require('lodash');var util=require(_0xe66e('0x0'));var moment=require(_0xe66e('0x1'));var BPromise=require(_0xe66e('0x2'));var rs=require(_0xe66e('0x3'));var fs=require('fs');var Redis=require(_0xe66e('0x4'));var db=require(_0xe66e('0x5'))['db'];var utils=require(_0xe66e('0x6'));var logger=require(_0xe66e('0x7'))(_0xe66e('0x8'));var config=require(_0xe66e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe66e('0xa')][_0xe66e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16b5f5,_0x5eb0af,_0x57b034){return new BPromise(function(_0x1eeac3,_0x1dd85f){return client[_0xe66e('0xc')](_0x16b5f5,_0x57b034)[_0xe66e('0xd')](function(_0x34e9f5){logger[_0xe66e('0xe')]('Template,\x20%s,\x20%s',_0x5eb0af,_0xe66e('0xf'));logger[_0xe66e('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x5eb0af,'request\x20sent',JSON[_0xe66e('0x11')](_0x34e9f5));if(_0x34e9f5[_0xe66e('0x12')]){if(_0x34e9f5[_0xe66e('0x12')][_0xe66e('0x13')]===0x1f4){logger['error'](_0xe66e('0x14'),_0x5eb0af,_0x34e9f5[_0xe66e('0x12')][_0xe66e('0x15')]);return _0x1dd85f(_0x34e9f5[_0xe66e('0x12')][_0xe66e('0x15')]);}logger[_0xe66e('0x12')](_0xe66e('0x14'),_0x5eb0af,_0x34e9f5[_0xe66e('0x12')][_0xe66e('0x15')]);return _0x1eeac3(_0x34e9f5[_0xe66e('0x12')][_0xe66e('0x15')]);}else{logger[_0xe66e('0xe')](_0xe66e('0x14'),_0x5eb0af,_0xe66e('0xf'));_0x1eeac3(_0x34e9f5[_0xe66e('0x16')]['message']);}})[_0xe66e('0x17')](function(_0x1a14ba){logger['error'](_0xe66e('0x14'),_0x5eb0af,_0x1a14ba);_0x1dd85f(_0x1a14ba);});});}exports[_0xe66e('0x18')]=function(_0xa90457){var _0x1691c4=this;return new Promise(function(_0x1c95b4,_0x39199d){return db[_0xe66e('0x19')]['findAll']({'raw':_0xa90457['options']?_0xa90457[_0xe66e('0x1a')][_0xe66e('0x1b')]===undefined?!![]:![]:!![],'where':_0xa90457['options']?_0xa90457[_0xe66e('0x1a')][_0xe66e('0x1c')]||null:null,'attributes':_0xa90457['options']?_0xa90457['options'][_0xe66e('0x1d')]||null:null,'limit':_0xa90457['options']?_0xa90457['options'][_0xe66e('0x1e')]||null:null,'include':_0xa90457[_0xe66e('0x1a')]?_0xa90457['options'][_0xe66e('0x1f')]?_[_0xe66e('0x20')](_0xa90457['options']['include'],function(_0x3cd697){return{'model':db[_0x3cd697['model']],'as':_0x3cd697['as'],'attributes':_0x3cd697[_0xe66e('0x1d')],'include':_0x3cd697[_0xe66e('0x1f')]?_[_0xe66e('0x20')](_0x3cd697['include'],function(_0xccf76d){return{'model':db[_0xccf76d[_0xe66e('0x21')]],'as':_0xccf76d['as'],'attributes':_0xccf76d[_0xe66e('0x1d')],'include':_0xccf76d[_0xe66e('0x1f')]?_[_0xe66e('0x20')](_0xccf76d[_0xe66e('0x1f')],function(_0xc4631f){return{'model':db[_0xc4631f[_0xe66e('0x21')]],'as':_0xc4631f['as'],'attributes':_0xc4631f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xafb198){logger['info'](_0xe66e('0x18'),_0xa90457);logger[_0xe66e('0x10')]('GetTemplate',_0xa90457,JSON[_0xe66e('0x11')](_0xafb198));_0x1c95b4(_0xafb198);})['catch'](function(_0xbd355f){logger['error'](_0xe66e('0x18'),_0xbd355f[_0xe66e('0x15')],_0xa90457);_0x39199d(_0x1691c4[_0xe66e('0x12')](0x1f4,_0xbd355f['message']));});});}; \ No newline at end of file +var _0x7f39=['then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTemplate','Template','options','where','attributes','limit','include','map','model','stringify','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x3d351f,_0xf83131){var _0x2717c7=function(_0x44203e){while(--_0x44203e){_0x3d351f['push'](_0x3d351f['shift']());}};_0x2717c7(++_0xf83131);}(_0x7f39,0xfc));var _0x97f3=function(_0x23cd34,_0xe7e8f7){_0x23cd34=_0x23cd34-0x0;var _0x1e1e48=_0x7f39[_0x23cd34];return _0x1e1e48;};'use strict';var _=require(_0x97f3('0x0'));var util=require('util');var moment=require(_0x97f3('0x1'));var BPromise=require('bluebird');var rs=require(_0x97f3('0x2'));var fs=require('fs');var Redis=require(_0x97f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x97f3('0x4'));var logger=require(_0x97f3('0x5'))('rpc');var config=require(_0x97f3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x97f3('0x7')][_0x97f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d0ec1,_0x9a27bd,_0x54958d){return new BPromise(function(_0x9894a1,_0x6985a9){return client['request'](_0x5d0ec1,_0x54958d)[_0x97f3('0x9')](function(_0x91fc07){logger[_0x97f3('0xa')](_0x97f3('0xb'),_0x9a27bd,_0x97f3('0xc'));logger[_0x97f3('0xd')](_0x97f3('0xe'),_0x9a27bd,_0x97f3('0xc'),JSON['stringify'](_0x91fc07));if(_0x91fc07[_0x97f3('0xf')]){if(_0x91fc07[_0x97f3('0xf')]['code']===0x1f4){logger[_0x97f3('0xf')](_0x97f3('0xb'),_0x9a27bd,_0x91fc07[_0x97f3('0xf')][_0x97f3('0x10')]);return _0x6985a9(_0x91fc07[_0x97f3('0xf')][_0x97f3('0x10')]);}logger[_0x97f3('0xf')]('Template,\x20%s,\x20%s',_0x9a27bd,_0x91fc07[_0x97f3('0xf')]['message']);return _0x9894a1(_0x91fc07[_0x97f3('0xf')][_0x97f3('0x10')]);}else{logger[_0x97f3('0xa')]('Template,\x20%s,\x20%s',_0x9a27bd,_0x97f3('0xc'));_0x9894a1(_0x91fc07[_0x97f3('0x11')]['message']);}})[_0x97f3('0x12')](function(_0x5a4eff){logger['error']('Template,\x20%s,\x20%s',_0x9a27bd,_0x5a4eff);_0x6985a9(_0x5a4eff);});});}exports[_0x97f3('0x13')]=function(_0x584aa1){var _0x3a29fa=this;return new Promise(function(_0x3ccaf6,_0x318531){return db[_0x97f3('0x14')]['findAll']({'raw':_0x584aa1['options']?_0x584aa1[_0x97f3('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x584aa1[_0x97f3('0x15')]?_0x584aa1['options'][_0x97f3('0x16')]||null:null,'attributes':_0x584aa1[_0x97f3('0x15')]?_0x584aa1[_0x97f3('0x15')][_0x97f3('0x17')]||null:null,'limit':_0x584aa1[_0x97f3('0x15')]?_0x584aa1[_0x97f3('0x15')][_0x97f3('0x18')]||null:null,'include':_0x584aa1[_0x97f3('0x15')]?_0x584aa1[_0x97f3('0x15')][_0x97f3('0x19')]?_[_0x97f3('0x1a')](_0x584aa1[_0x97f3('0x15')][_0x97f3('0x19')],function(_0x40be5b){return{'model':db[_0x40be5b[_0x97f3('0x1b')]],'as':_0x40be5b['as'],'attributes':_0x40be5b[_0x97f3('0x17')],'include':_0x40be5b[_0x97f3('0x19')]?_[_0x97f3('0x1a')](_0x40be5b[_0x97f3('0x19')],function(_0x515127){return{'model':db[_0x515127[_0x97f3('0x1b')]],'as':_0x515127['as'],'attributes':_0x515127['attributes'],'include':_0x515127[_0x97f3('0x19')]?_[_0x97f3('0x1a')](_0x515127[_0x97f3('0x19')],function(_0x58b286){return{'model':db[_0x58b286[_0x97f3('0x1b')]],'as':_0x58b286['as'],'attributes':_0x58b286[_0x97f3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x97f3('0x9')](function(_0x4ca36e){logger[_0x97f3('0xa')](_0x97f3('0x13'),_0x584aa1);logger[_0x97f3('0xd')](_0x97f3('0x13'),_0x584aa1,JSON[_0x97f3('0x1c')](_0x4ca36e));_0x3ccaf6(_0x4ca36e);})[_0x97f3('0x12')](function(_0x4cc1ec){logger[_0x97f3('0xf')](_0x97f3('0x13'),_0x4cc1ec['message'],_0x584aa1);_0x318531(_0x3a29fa[_0x97f3('0xf')](0x1f4,_0x4cc1ec[_0x97f3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 708879d..fa64a84 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 _0x95a2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','get','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','delete','destroy','exports','multer','util'];(function(_0x319c65,_0x2ed6b9){var _0x34f381=function(_0x1118a8){while(--_0x1118a8){_0x319c65['push'](_0x319c65['shift']());}};_0x34f381(++_0x2ed6b9);}(_0x95a2,0x120));var _0x295a=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x95a2[_0x476b00];return _0x44ec8e;};'use strict';var multer=require(_0x295a('0x0'));var util=require(_0x295a('0x1'));var path=require('path');var timeout=require(_0x295a('0x2'));var express=require(_0x295a('0x3'));var router=express[_0x295a('0x4')]();var fs_extra=require(_0x295a('0x5'));var auth=require(_0x295a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x295a('0x7'));var controller=require(_0x295a('0x8'));router['get']('/',auth[_0x295a('0x9')](),controller[_0x295a('0xa')]);router['get'](_0x295a('0xb'),auth[_0x295a('0x9')](),controller[_0x295a('0xc')]);router['get'](_0x295a('0xd'),auth[_0x295a('0x9')](),controller[_0x295a('0xe')]);router[_0x295a('0xf')]('/:id/any_conditions',auth[_0x295a('0x9')](),controller[_0x295a('0x10')]);router[_0x295a('0xf')]('/:id/actions',auth[_0x295a('0x9')](),controller[_0x295a('0x11')]);router[_0x295a('0x12')]('/',auth['isAuthenticated'](),controller[_0x295a('0x13')]);router[_0x295a('0x12')](_0x295a('0xd'),auth[_0x295a('0x9')](),controller[_0x295a('0x14')]);router[_0x295a('0x12')](_0x295a('0x15'),auth['isAuthenticated'](),controller[_0x295a('0x16')]);router[_0x295a('0x12')](_0x295a('0x17'),auth[_0x295a('0x9')](),controller[_0x295a('0x18')]);router[_0x295a('0x19')](_0x295a('0xb'),auth[_0x295a('0x9')](),controller['update']);router[_0x295a('0x1a')]('/:id',auth[_0x295a('0x9')](),controller[_0x295a('0x1b')]);module[_0x295a('0x1c')]=router; \ No newline at end of file +var _0x9a89=['index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0x9a89,0xce));var _0x99a8=function(_0x13bf1f,_0x257897){_0x13bf1f=_0x13bf1f-0x0;var _0x195dc5=_0x9a89[_0x13bf1f];return _0x195dc5;};'use strict';var multer=require(_0x99a8('0x0'));var util=require(_0x99a8('0x1'));var path=require(_0x99a8('0x2'));var timeout=require(_0x99a8('0x3'));var express=require(_0x99a8('0x4'));var router=express['Router']();var fs_extra=require(_0x99a8('0x5'));var auth=require(_0x99a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99a8('0x7'));var controller=require('./trigger.controller');router[_0x99a8('0x8')]('/',auth[_0x99a8('0x9')](),controller[_0x99a8('0xa')]);router[_0x99a8('0x8')]('/:id',auth[_0x99a8('0x9')](),controller[_0x99a8('0xb')]);router['get'](_0x99a8('0xc'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x99a8('0x8')](_0x99a8('0xd'),auth[_0x99a8('0x9')](),controller[_0x99a8('0xe')]);router[_0x99a8('0x8')](_0x99a8('0xf'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x10')]);router[_0x99a8('0x11')]('/',auth[_0x99a8('0x9')](),controller[_0x99a8('0x12')]);router['post'](_0x99a8('0xc'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x13')]);router['post'](_0x99a8('0xd'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x14')]);router[_0x99a8('0x11')](_0x99a8('0xf'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x15')]);router[_0x99a8('0x16')](_0x99a8('0x17'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x18')]);router[_0x99a8('0x19')](_0x99a8('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0x99a8('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 617b6a5..a46c473 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 _0x956f=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4105d3,_0x2adb2a){var _0x3930df=function(_0xa3af2f){while(--_0xa3af2f){_0x4105d3['push'](_0x4105d3['shift']());}};_0x3930df(++_0x2adb2a);}(_0x956f,0x198));var _0xf956=function(_0x5d1d99,_0x10ca23){_0x5d1d99=_0x5d1d99-0x0;var _0x2957ec=_0x956f[_0x5d1d99];return _0x2957ec;};'use strict';var Sequelize=require(_0xf956('0x0'));module[_0xf956('0x1')]={'name':{'type':Sequelize[_0xf956('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf956('0x2')]},'status':{'type':Sequelize[_0xf956('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xffbc=['STRING','sequelize','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xffbc,0x142));var _0xcffb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xffbc[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xcffb('0x0'));module[_0xcffb('0x1')]={'name':{'type':Sequelize[_0xcffb('0x2')]},'channel':{'type':Sequelize[_0xcffb('0x2')]},'description':{'type':Sequelize[_0xcffb('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4532a51..0d168be 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 _0xd8a6=['addAnyCondition','getAllConditions','findOne','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addAllCondition','TriggerAllId','Condition'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xd8a6,0x6c));var _0x6d8a=function(_0x5a2bbd,_0x542ede){_0x5a2bbd=_0x5a2bbd-0x0;var _0x42bbe8=_0xd8a6[_0x5a2bbd];return _0x42bbe8;};'use strict';var emlformat=require(_0x6d8a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6d8a('0x1'));var BPromise=require(_0x6d8a('0x2'));var Mustache=require(_0x6d8a('0x3'));var util=require(_0x6d8a('0x4'));var path=require(_0x6d8a('0x5'));var sox=require(_0x6d8a('0x6'));var csv=require(_0x6d8a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d8a('0x8'));var _=require(_0x6d8a('0x9'));var squel=require(_0x6d8a('0xa'));var crypto=require(_0x6d8a('0xb'));var jsforce=require(_0x6d8a('0xc'));var deskjs=require(_0x6d8a('0xd'));var toCsv=require(_0x6d8a('0x7'));var querystring=require(_0x6d8a('0xe'));var Papa=require(_0x6d8a('0xf'));var Redis=require('ioredis');var authService=require(_0x6d8a('0x10'));var qs=require(_0x6d8a('0x11'));var as=require(_0x6d8a('0x12'));var hardwareService=require(_0x6d8a('0x13'));var logger=require(_0x6d8a('0x14'))(_0x6d8a('0x15'));var utils=require(_0x6d8a('0x16'));var config=require(_0x6d8a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d8a('0x18'))['db'];function respondWithStatusCode(_0x1a7f84,_0x1a9886){_0x1a9886=_0x1a9886||0xcc;return function(_0x50ac56){if(_0x50ac56){return _0x1a7f84[_0x6d8a('0x19')](_0x1a9886);}return _0x1a7f84[_0x6d8a('0x1a')](_0x1a9886)[_0x6d8a('0x1b')]();};}function respondWithResult(_0x6e6b0,_0x2f67e9){_0x2f67e9=_0x2f67e9||0xc8;return function(_0x26b5ed){if(_0x26b5ed){return _0x6e6b0['status'](_0x2f67e9)[_0x6d8a('0x1c')](_0x26b5ed);}};}function respondWithFilteredResult(_0x18a33b,_0xf814e5){return function(_0x19e8a6){if(_0x19e8a6){var _0x1d2a8a=typeof _0xf814e5[_0x6d8a('0x1d')]===_0x6d8a('0x1e')&&typeof _0xf814e5[_0x6d8a('0x1f')]===_0x6d8a('0x1e');var _0x5c6107=_0x19e8a6[_0x6d8a('0x20')];var _0x2f81e1=_0x1d2a8a?0x0:_0xf814e5[_0x6d8a('0x1d')];var _0x2b7446=_0x1d2a8a?_0x19e8a6[_0x6d8a('0x20')]:_0xf814e5[_0x6d8a('0x1d')]+_0xf814e5[_0x6d8a('0x1f')];var _0x547425;if(_0x2b7446>=_0x5c6107){_0x2b7446=_0x5c6107;_0x547425=0xc8;}else{_0x547425=0xce;}_0x18a33b[_0x6d8a('0x1a')](_0x547425);return _0x18a33b[_0x6d8a('0x21')](_0x6d8a('0x22'),_0x2f81e1+'-'+_0x2b7446+'/'+_0x5c6107)[_0x6d8a('0x1c')](_0x19e8a6);}return null;};}function patchUpdates(_0x1f74f4){return function(_0x27e2c4){try{jsonpatch[_0x6d8a('0x23')](_0x27e2c4,_0x1f74f4,!![]);}catch(_0xe2fd7){return BPromise[_0x6d8a('0x24')](_0xe2fd7);}return _0x27e2c4[_0x6d8a('0x25')]();};}function saveUpdates(_0x300e48,_0x503d61){return function(_0xef8057){if(_0xef8057){return _0xef8057[_0x6d8a('0x26')](_0x300e48)[_0x6d8a('0x27')](function(_0x4db7f3){return _0x4db7f3;});}return null;};}function removeEntity(_0x332d3b,_0x58d1f4){return function(_0x4caae9){if(_0x4caae9){return _0x4caae9['destroy']()[_0x6d8a('0x27')](function(){var _0x1aece7=_0x4caae9[_0x6d8a('0x28')]({'plain':!![]});var _0x1aafe7=_0x6d8a('0x29');return db[_0x6d8a('0x2a')][_0x6d8a('0x2b')]({'where':{'type':_0x1aafe7,'resourceId':_0x1aece7['id']}})[_0x6d8a('0x27')](function(){return _0x4caae9;});})['then'](function(){_0x332d3b['status'](0xcc)[_0x6d8a('0x1b')]();});}};}function handleEntityNotFound(_0x5267f9,_0x37b950){return function(_0xdd4764){if(!_0xdd4764){_0x5267f9[_0x6d8a('0x19')](0x194);}return _0xdd4764;};}function handleError(_0x430170,_0x1503d9){_0x1503d9=_0x1503d9||0x1f4;return function(_0x557abd){logger[_0x6d8a('0x2c')](_0x557abd[_0x6d8a('0x2d')]);if(_0x557abd[_0x6d8a('0x2e')]){delete _0x557abd[_0x6d8a('0x2e')];}_0x430170[_0x6d8a('0x1a')](_0x1503d9)[_0x6d8a('0x2f')](_0x557abd);};}exports[_0x6d8a('0x30')]=function(_0x23a01b,_0x54ab85){var _0x232cb6={},_0x5c1be3={},_0x1a218d={'count':0x0,'rows':[]};var _0x21a621=_[_0x6d8a('0x31')](db[_0x6d8a('0x32')][_0x6d8a('0x33')],function(_0x3eb42b){return{'name':_0x3eb42b[_0x6d8a('0x34')],'type':_0x3eb42b['type'][_0x6d8a('0x35')]};});_0x5c1be3['model']=_[_0x6d8a('0x31')](_0x21a621,_0x6d8a('0x2e'));_0x5c1be3[_0x6d8a('0x36')]=_[_0x6d8a('0x37')](_0x23a01b[_0x6d8a('0x36')]);_0x5c1be3[_0x6d8a('0x38')]=_[_0x6d8a('0x39')](_0x5c1be3[_0x6d8a('0x3a')],_0x5c1be3[_0x6d8a('0x36')]);_0x232cb6[_0x6d8a('0x3b')]=_[_0x6d8a('0x39')](_0x5c1be3[_0x6d8a('0x3a')],qs[_0x6d8a('0x3c')](_0x23a01b[_0x6d8a('0x36')][_0x6d8a('0x3c')]));_0x232cb6[_0x6d8a('0x3b')]=_0x232cb6[_0x6d8a('0x3b')]['length']?_0x232cb6[_0x6d8a('0x3b')]:_0x5c1be3[_0x6d8a('0x3a')];if(!_0x23a01b[_0x6d8a('0x36')][_0x6d8a('0x3d')]('nolimit')){_0x232cb6['limit']=qs[_0x6d8a('0x1f')](_0x23a01b['query'][_0x6d8a('0x1f')]);_0x232cb6[_0x6d8a('0x1d')]=qs[_0x6d8a('0x1d')](_0x23a01b['query'][_0x6d8a('0x1d')]);}_0x232cb6[_0x6d8a('0x3e')]=qs[_0x6d8a('0x3f')](_0x23a01b[_0x6d8a('0x36')]['sort']);_0x232cb6[_0x6d8a('0x40')]=qs[_0x6d8a('0x38')](_[_0x6d8a('0x41')](_0x23a01b[_0x6d8a('0x36')],_0x5c1be3['filters']),_0x21a621);if(_0x23a01b['query'][_0x6d8a('0x42')]){_0x232cb6['where']=_['merge'](_0x232cb6[_0x6d8a('0x40')],{'$or':_[_0x6d8a('0x31')](_0x21a621,function(_0xe9a457){if(_0xe9a457[_0x6d8a('0x43')]!==_0x6d8a('0x44')){var _0x5bd71a={};_0x5bd71a[_0xe9a457[_0x6d8a('0x2e')]]={'$like':'%'+_0x23a01b[_0x6d8a('0x36')]['filter']+'%'};return _0x5bd71a;}})});}_0x232cb6=_['merge']({},_0x232cb6,_0x23a01b[_0x6d8a('0x45')]);var _0x3ded13={'where':_0x232cb6[_0x6d8a('0x40')]};return db['Trigger'][_0x6d8a('0x20')](_0x3ded13)[_0x6d8a('0x27')](function(_0x5c4eba){_0x1a218d['count']=_0x5c4eba;if(_0x23a01b[_0x6d8a('0x36')]['includeAll']){_0x232cb6[_0x6d8a('0x46')]=[{'all':!![]}];}return db[_0x6d8a('0x32')][_0x6d8a('0x47')](_0x232cb6);})[_0x6d8a('0x27')](function(_0x47c49f){_0x1a218d['rows']=_0x47c49f;return _0x1a218d;})[_0x6d8a('0x27')](respondWithFilteredResult(_0x54ab85,_0x232cb6))[_0x6d8a('0x48')](handleError(_0x54ab85,null));};exports[_0x6d8a('0x49')]=function(_0x802d73,_0x2af442){var _0x933a1e={'raw':![],'where':{'id':_0x802d73[_0x6d8a('0x4a')]['id']}},_0x4652b7={};_0x4652b7[_0x6d8a('0x3a')]=_[_0x6d8a('0x37')](db[_0x6d8a('0x32')][_0x6d8a('0x33')]);_0x4652b7[_0x6d8a('0x36')]=_[_0x6d8a('0x37')](_0x802d73['query']);_0x4652b7[_0x6d8a('0x38')]=_['intersection'](_0x4652b7[_0x6d8a('0x3a')],_0x4652b7[_0x6d8a('0x36')]);_0x933a1e[_0x6d8a('0x3b')]=_[_0x6d8a('0x39')](_0x4652b7[_0x6d8a('0x3a')],qs[_0x6d8a('0x3c')](_0x802d73[_0x6d8a('0x36')][_0x6d8a('0x3c')]));_0x933a1e[_0x6d8a('0x3b')]=_0x933a1e[_0x6d8a('0x3b')][_0x6d8a('0x4b')]?_0x933a1e[_0x6d8a('0x3b')]:_0x4652b7['model'];if(_0x802d73[_0x6d8a('0x36')][_0x6d8a('0x4c')]){_0x933a1e[_0x6d8a('0x46')]=[{'all':!![]}];}_0x933a1e=_[_0x6d8a('0x4d')]({},_0x933a1e,_0x802d73['options']);return db[_0x6d8a('0x32')]['find'](_0x933a1e)[_0x6d8a('0x27')](handleEntityNotFound(_0x2af442,null))[_0x6d8a('0x27')](respondWithResult(_0x2af442,null))[_0x6d8a('0x48')](handleError(_0x2af442,null));};exports[_0x6d8a('0x4e')]=function(_0x241151,_0x55ed40){return db[_0x6d8a('0x32')]['create'](_0x241151[_0x6d8a('0x4f')],{})[_0x6d8a('0x27')](function(_0x141c61){var _0x1d8813=_0x241151[_0x6d8a('0x50')]['get']({'plain':!![]});if(!_0x1d8813)throw new Error(_0x6d8a('0x51'));if(_0x1d8813[_0x6d8a('0x52')]==='user'){var _0x2224b7=_0x141c61['get']({'plain':!![]});var _0x346721=_0x6d8a('0x29');return db[_0x6d8a('0x53')]['find']({'where':{'name':_0x346721,'userProfileId':_0x1d8813['userProfileId']},'raw':!![]})[_0x6d8a('0x27')](function(_0x32168f){if(_0x32168f&&_0x32168f[_0x6d8a('0x54')]===0x0){return db[_0x6d8a('0x2a')][_0x6d8a('0x4e')]({'name':_0x2224b7['name'],'resourceId':_0x2224b7['id'],'type':_0x32168f[_0x6d8a('0x2e')],'sectionId':_0x32168f['id']},{})[_0x6d8a('0x27')](function(){return _0x141c61;});}else{return _0x141c61;}})[_0x6d8a('0x48')](function(_0x401940){logger[_0x6d8a('0x2c')](_0x6d8a('0x55'),_0x401940);throw _0x401940;});}return _0x141c61;})[_0x6d8a('0x27')](respondWithResult(_0x55ed40,0xc9))[_0x6d8a('0x48')](handleError(_0x55ed40,null));};exports[_0x6d8a('0x26')]=function(_0x2bbf67,_0x2f9ac2){if(_0x2bbf67[_0x6d8a('0x4f')]['id']){delete _0x2bbf67[_0x6d8a('0x4f')]['id'];}return db[_0x6d8a('0x32')][_0x6d8a('0x56')]({'where':{'id':_0x2bbf67[_0x6d8a('0x4a')]['id']}})[_0x6d8a('0x27')](handleEntityNotFound(_0x2f9ac2,null))['then'](saveUpdates(_0x2bbf67[_0x6d8a('0x4f')],null))[_0x6d8a('0x27')](respondWithResult(_0x2f9ac2,null))[_0x6d8a('0x48')](handleError(_0x2f9ac2,null));};exports[_0x6d8a('0x2b')]=function(_0x31cb7f,_0x10c574){return db[_0x6d8a('0x32')][_0x6d8a('0x56')]({'where':{'id':_0x31cb7f['params']['id']}})[_0x6d8a('0x27')](handleEntityNotFound(_0x10c574,null))[_0x6d8a('0x27')](removeEntity(_0x10c574,null))[_0x6d8a('0x48')](handleError(_0x10c574,null));};exports[_0x6d8a('0x57')]=function(_0x2bf5cf,_0x7449ad,_0x29a7ff){if(_0x2bf5cf['body']['id']){delete _0x2bf5cf[_0x6d8a('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x2bf5cf[_0x6d8a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7449ad,null))[_0x6d8a('0x27')](function(_0x467eaf){if(_0x467eaf){_0x2bf5cf[_0x6d8a('0x4f')][_0x6d8a('0x58')]=_0x467eaf['id'];return db[_0x6d8a('0x59')][_0x6d8a('0x4e')](_0x2bf5cf['body']);}})[_0x6d8a('0x27')](respondWithResult(_0x7449ad,null))[_0x6d8a('0x48')](handleError(_0x7449ad,null));};exports[_0x6d8a('0x5a')]=function(_0x5b6ff6,_0x1b5476,_0x4f8b20){if(_0x5b6ff6['body']['id']){delete _0x5b6ff6[_0x6d8a('0x4f')]['id'];}return db[_0x6d8a('0x32')][_0x6d8a('0x56')]({'where':{'id':_0x5b6ff6[_0x6d8a('0x4a')]['id']}})[_0x6d8a('0x27')](handleEntityNotFound(_0x1b5476,null))[_0x6d8a('0x27')](function(_0x3ef901){if(_0x3ef901){_0x5b6ff6[_0x6d8a('0x4f')]['TriggerAnyId']=_0x3ef901['id'];return db[_0x6d8a('0x59')]['create'](_0x5b6ff6[_0x6d8a('0x4f')]);}})['then'](respondWithResult(_0x1b5476,null))[_0x6d8a('0x48')](handleError(_0x1b5476,null));};exports[_0x6d8a('0x5b')]=function(_0x1cf3c4,_0x23dcd9,_0x1ce6a2){var _0x248e0c={};var _0x38a3b1={};var _0x3b11d7;var _0x407ed0;return db['Trigger'][_0x6d8a('0x5c')]({'where':{'id':_0x1cf3c4[_0x6d8a('0x4a')]['id']}})[_0x6d8a('0x27')](handleEntityNotFound(_0x23dcd9,null))['then'](function(_0x336637){if(_0x336637){_0x3b11d7=_0x336637;_0x38a3b1[_0x6d8a('0x3a')]=_[_0x6d8a('0x37')](db[_0x6d8a('0x59')][_0x6d8a('0x33')]);_0x38a3b1[_0x6d8a('0x36')]=_[_0x6d8a('0x37')](_0x1cf3c4[_0x6d8a('0x36')]);_0x38a3b1['filters']=_[_0x6d8a('0x39')](_0x38a3b1['model'],_0x38a3b1[_0x6d8a('0x36')]);_0x248e0c['attributes']=_['intersection'](_0x38a3b1[_0x6d8a('0x3a')],qs[_0x6d8a('0x3c')](_0x1cf3c4[_0x6d8a('0x36')]['fields']));_0x248e0c[_0x6d8a('0x3b')]=_0x248e0c[_0x6d8a('0x3b')][_0x6d8a('0x4b')]?_0x248e0c['attributes']:_0x38a3b1[_0x6d8a('0x3a')];_0x248e0c['order']=qs['sort'](_0x1cf3c4[_0x6d8a('0x36')]['sort']);_0x248e0c[_0x6d8a('0x40')]=qs[_0x6d8a('0x38')](_[_0x6d8a('0x41')](_0x1cf3c4[_0x6d8a('0x36')],_0x38a3b1[_0x6d8a('0x38')]));if(_0x1cf3c4['query'][_0x6d8a('0x42')]){_0x248e0c[_0x6d8a('0x40')]=_['merge'](_0x248e0c[_0x6d8a('0x40')],{'$or':_[_0x6d8a('0x31')](_0x248e0c[_0x6d8a('0x3b')],function(_0x4af1bf){var _0x3b932c={};_0x3b932c[_0x4af1bf]={'$like':'%'+_0x1cf3c4[_0x6d8a('0x36')]['filter']+'%'};return _0x3b932c;})});}_0x248e0c=_[_0x6d8a('0x4d')]({},_0x248e0c,_0x1cf3c4[_0x6d8a('0x45')]);return _0x3b11d7[_0x6d8a('0x5b')](_0x248e0c);}})[_0x6d8a('0x27')](function(_0x1cf438){if(_0x1cf438){_0x407ed0=_0x1cf438[_0x6d8a('0x4b')];if(!_0x1cf3c4[_0x6d8a('0x36')][_0x6d8a('0x3d')](_0x6d8a('0x5d'))){_0x248e0c[_0x6d8a('0x1f')]=qs['limit'](_0x1cf3c4[_0x6d8a('0x36')][_0x6d8a('0x1f')]);_0x248e0c['offset']=qs['offset'](_0x1cf3c4['query'][_0x6d8a('0x1d')]);}return _0x3b11d7[_0x6d8a('0x5b')](_0x248e0c);}})[_0x6d8a('0x27')](function(_0x23418a){if(_0x23418a){return _0x23418a?{'count':_0x407ed0,'rows':_0x23418a}:null;}})[_0x6d8a('0x27')](respondWithResult(_0x23dcd9,null))[_0x6d8a('0x48')](handleError(_0x23dcd9,null));};exports[_0x6d8a('0x5e')]=function(_0x262cf9,_0xfa7611,_0x58e5a7){var _0x183b3c={};var _0x180df={};var _0x429f4f;var _0x1df34a;return db[_0x6d8a('0x32')][_0x6d8a('0x5c')]({'where':{'id':_0x262cf9[_0x6d8a('0x4a')]['id']}})[_0x6d8a('0x27')](handleEntityNotFound(_0xfa7611,null))[_0x6d8a('0x27')](function(_0x428030){if(_0x428030){_0x429f4f=_0x428030;_0x180df[_0x6d8a('0x3a')]=_[_0x6d8a('0x37')](db['Condition'][_0x6d8a('0x33')]);_0x180df[_0x6d8a('0x36')]=_[_0x6d8a('0x37')](_0x262cf9[_0x6d8a('0x36')]);_0x180df['filters']=_[_0x6d8a('0x39')](_0x180df[_0x6d8a('0x3a')],_0x180df[_0x6d8a('0x36')]);_0x183b3c[_0x6d8a('0x3b')]=_['intersection'](_0x180df[_0x6d8a('0x3a')],qs[_0x6d8a('0x3c')](_0x262cf9[_0x6d8a('0x36')][_0x6d8a('0x3c')]));_0x183b3c[_0x6d8a('0x3b')]=_0x183b3c['attributes'][_0x6d8a('0x4b')]?_0x183b3c[_0x6d8a('0x3b')]:_0x180df[_0x6d8a('0x3a')];_0x183b3c[_0x6d8a('0x3e')]=qs[_0x6d8a('0x3f')](_0x262cf9['query'][_0x6d8a('0x3f')]);_0x183b3c[_0x6d8a('0x40')]=qs[_0x6d8a('0x38')](_[_0x6d8a('0x41')](_0x262cf9['query'],_0x180df[_0x6d8a('0x38')]));if(_0x262cf9[_0x6d8a('0x36')][_0x6d8a('0x42')]){_0x183b3c[_0x6d8a('0x40')]=_[_0x6d8a('0x4d')](_0x183b3c[_0x6d8a('0x40')],{'$or':_[_0x6d8a('0x31')](_0x183b3c['attributes'],function(_0x15c35e){var _0x1dc7b6={};_0x1dc7b6[_0x15c35e]={'$like':'%'+_0x262cf9[_0x6d8a('0x36')][_0x6d8a('0x42')]+'%'};return _0x1dc7b6;})});}_0x183b3c=_['merge']({},_0x183b3c,_0x262cf9['options']);return _0x429f4f[_0x6d8a('0x5e')](_0x183b3c);}})[_0x6d8a('0x27')](function(_0xa34fc){if(_0xa34fc){_0x1df34a=_0xa34fc[_0x6d8a('0x4b')];if(!_0x262cf9[_0x6d8a('0x36')][_0x6d8a('0x3d')](_0x6d8a('0x5d'))){_0x183b3c['limit']=qs['limit'](_0x262cf9[_0x6d8a('0x36')][_0x6d8a('0x1f')]);_0x183b3c[_0x6d8a('0x1d')]=qs['offset'](_0x262cf9[_0x6d8a('0x36')][_0x6d8a('0x1d')]);}return _0x429f4f['getAnyConditions'](_0x183b3c);}})[_0x6d8a('0x27')](function(_0xe4fb8){if(_0xe4fb8){return _0xe4fb8?{'count':_0x1df34a,'rows':_0xe4fb8}:null;}})['then'](respondWithResult(_0xfa7611,null))[_0x6d8a('0x48')](handleError(_0xfa7611,null));};exports[_0x6d8a('0x5f')]=function(_0x429303,_0x173e40,_0x5eaa87){if(_0x429303[_0x6d8a('0x4f')]['id']){delete _0x429303[_0x6d8a('0x4f')]['id'];}return db[_0x6d8a('0x32')][_0x6d8a('0x56')]({'where':{'id':_0x429303[_0x6d8a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x173e40,null))['then'](function(_0x128dcd){if(_0x128dcd){_0x429303[_0x6d8a('0x4f')][_0x6d8a('0x60')]=_0x128dcd['id'];return db[_0x6d8a('0x61')][_0x6d8a('0x4e')](_0x429303[_0x6d8a('0x4f')]);}})[_0x6d8a('0x27')](respondWithResult(_0x173e40,null))[_0x6d8a('0x48')](handleError(_0x173e40,null));};exports[_0x6d8a('0x62')]=function(_0x499edb,_0x1482a9,_0x3d95ec){var _0x3b0f38={};var _0x3bd6f3={};var _0xe340bf;var _0x54baa7;return db[_0x6d8a('0x32')][_0x6d8a('0x5c')]({'where':{'id':_0x499edb[_0x6d8a('0x4a')]['id']}})[_0x6d8a('0x27')](handleEntityNotFound(_0x1482a9,null))[_0x6d8a('0x27')](function(_0x467e9e){if(_0x467e9e){_0xe340bf=_0x467e9e;_0x3bd6f3[_0x6d8a('0x3a')]=_[_0x6d8a('0x37')](db[_0x6d8a('0x61')][_0x6d8a('0x33')]);_0x3bd6f3['query']=_[_0x6d8a('0x37')](_0x499edb['query']);_0x3bd6f3[_0x6d8a('0x38')]=_[_0x6d8a('0x39')](_0x3bd6f3[_0x6d8a('0x3a')],_0x3bd6f3['query']);_0x3b0f38['attributes']=_[_0x6d8a('0x39')](_0x3bd6f3[_0x6d8a('0x3a')],qs[_0x6d8a('0x3c')](_0x499edb[_0x6d8a('0x36')][_0x6d8a('0x3c')]));_0x3b0f38[_0x6d8a('0x3b')]=_0x3b0f38[_0x6d8a('0x3b')]['length']?_0x3b0f38[_0x6d8a('0x3b')]:_0x3bd6f3[_0x6d8a('0x3a')];_0x3b0f38[_0x6d8a('0x3e')]=qs[_0x6d8a('0x3f')](_0x499edb[_0x6d8a('0x36')]['sort']);_0x3b0f38[_0x6d8a('0x40')]=qs[_0x6d8a('0x38')](_[_0x6d8a('0x41')](_0x499edb[_0x6d8a('0x36')],_0x3bd6f3[_0x6d8a('0x38')]));if(_0x499edb[_0x6d8a('0x36')]['filter']){_0x3b0f38['where']=_[_0x6d8a('0x4d')](_0x3b0f38[_0x6d8a('0x40')],{'$or':_['map'](_0x3b0f38[_0x6d8a('0x3b')],function(_0x5e96ad){var _0x39d58c={};_0x39d58c[_0x5e96ad]={'$like':'%'+_0x499edb[_0x6d8a('0x36')][_0x6d8a('0x42')]+'%'};return _0x39d58c;})});}_0x3b0f38=_['merge']({},_0x3b0f38,_0x499edb['options']);return _0xe340bf['getActions'](_0x3b0f38);}})['then'](function(_0x5c454c){if(_0x5c454c){_0x54baa7=_0x5c454c[_0x6d8a('0x4b')];if(!_0x499edb[_0x6d8a('0x36')]['hasOwnProperty']('nolimit')){_0x3b0f38[_0x6d8a('0x1f')]=qs['limit'](_0x499edb[_0x6d8a('0x36')][_0x6d8a('0x1f')]);_0x3b0f38[_0x6d8a('0x1d')]=qs[_0x6d8a('0x1d')](_0x499edb[_0x6d8a('0x36')][_0x6d8a('0x1d')]);}return _0xe340bf[_0x6d8a('0x62')](_0x3b0f38);}})['then'](function(_0x2c10eb){if(_0x2c10eb){return _0x2c10eb?{'count':_0x54baa7,'rows':_0x2c10eb}:null;}})[_0x6d8a('0x27')](respondWithResult(_0x1482a9,null))[_0x6d8a('0x48')](handleError(_0x1482a9,null));}; \ No newline at end of file +var _0xe0ca=['path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','map','Trigger','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','includeAll','include','catch','rawAttributes','find','create','user','role','UserProfileSection','autoAssociation','body','addAllCondition','params','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','order','hasOwnProperty','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x553956,_0x57a991){var _0x2e4172=function(_0x2b5dda){while(--_0x2b5dda){_0x553956['push'](_0x553956['shift']());}};_0x2e4172(++_0x57a991);}(_0xe0ca,0xab));var _0xae0c=function(_0x20c893,_0xbef2b4){_0x20c893=_0x20c893-0x0;var _0xc705e8=_0xe0ca[_0x20c893];return _0xc705e8;};'use strict';var emlformat=require(_0xae0c('0x0'));var rimraf=require(_0xae0c('0x1'));var zipdir=require(_0xae0c('0x2'));var jsonpatch=require(_0xae0c('0x3'));var rp=require(_0xae0c('0x4'));var moment=require(_0xae0c('0x5'));var BPromise=require(_0xae0c('0x6'));var Mustache=require(_0xae0c('0x7'));var util=require(_0xae0c('0x8'));var path=require(_0xae0c('0x9'));var sox=require(_0xae0c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae0c('0xb'));var _=require('lodash');var squel=require(_0xae0c('0xc'));var crypto=require(_0xae0c('0xd'));var jsforce=require(_0xae0c('0xe'));var deskjs=require(_0xae0c('0xf'));var toCsv=require(_0xae0c('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae0c('0x11'));var qs=require(_0xae0c('0x12'));var as=require(_0xae0c('0x13'));var hardwareService=require(_0xae0c('0x14'));var logger=require('../../config/logger')(_0xae0c('0x15'));var utils=require(_0xae0c('0x16'));var config=require(_0xae0c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xae0c('0x18'))['db'];function respondWithStatusCode(_0x5c1314,_0x2bff7e){_0x2bff7e=_0x2bff7e||0xcc;return function(_0x4fc8c6){if(_0x4fc8c6){return _0x5c1314[_0xae0c('0x19')](_0x2bff7e);}return _0x5c1314['status'](_0x2bff7e)[_0xae0c('0x1a')]();};}function respondWithResult(_0x40ea45,_0x2d0962){_0x2d0962=_0x2d0962||0xc8;return function(_0xd0d8f3){if(_0xd0d8f3){return _0x40ea45[_0xae0c('0x1b')](_0x2d0962)['json'](_0xd0d8f3);}};}function respondWithFilteredResult(_0x123ea0,_0x25e787){return function(_0x13fc86){if(_0x13fc86){var _0x241cea=typeof _0x25e787[_0xae0c('0x1c')]===_0xae0c('0x1d')&&typeof _0x25e787[_0xae0c('0x1e')]===_0xae0c('0x1d');var _0x3496b2=_0x13fc86['count'];var _0x1b8af8=_0x241cea?0x0:_0x25e787['offset'];var _0x5a4b09=_0x241cea?_0x13fc86[_0xae0c('0x1f')]:_0x25e787[_0xae0c('0x1c')]+_0x25e787['limit'];var _0x29e076;if(_0x5a4b09>=_0x3496b2){_0x5a4b09=_0x3496b2;_0x29e076=0xc8;}else{_0x29e076=0xce;}_0x123ea0[_0xae0c('0x1b')](_0x29e076);return _0x123ea0[_0xae0c('0x20')](_0xae0c('0x21'),_0x1b8af8+'-'+_0x5a4b09+'/'+_0x3496b2)[_0xae0c('0x22')](_0x13fc86);}return null;};}function patchUpdates(_0xfc8a09){return function(_0x1bf3e0){try{jsonpatch[_0xae0c('0x23')](_0x1bf3e0,_0xfc8a09,!![]);}catch(_0x401098){return BPromise[_0xae0c('0x24')](_0x401098);}return _0x1bf3e0['save']();};}function saveUpdates(_0x4db30a,_0x1237dc){return function(_0x4c4217){if(_0x4c4217){return _0x4c4217['update'](_0x4db30a)[_0xae0c('0x25')](function(_0x9fa298){return _0x9fa298;});}return null;};}function removeEntity(_0xb56d4a,_0x3e6619){return function(_0x4e4ebd){if(_0x4e4ebd){return _0x4e4ebd[_0xae0c('0x26')]()[_0xae0c('0x25')](function(){var _0xe1fe1e=_0x4e4ebd[_0xae0c('0x27')]({'plain':!![]});var _0x380a4b=_0xae0c('0x28');return db[_0xae0c('0x29')][_0xae0c('0x26')]({'where':{'type':_0x380a4b,'resourceId':_0xe1fe1e['id']}})['then'](function(){return _0x4e4ebd;});})[_0xae0c('0x25')](function(){_0xb56d4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5fc061,_0x76e6d4){return function(_0x5ece28){if(!_0x5ece28){_0x5fc061[_0xae0c('0x19')](0x194);}return _0x5ece28;};}function handleError(_0x5d0c77,_0x4d0bc1){_0x4d0bc1=_0x4d0bc1||0x1f4;return function(_0x250057){logger[_0xae0c('0x2a')](_0x250057[_0xae0c('0x2b')]);if(_0x250057['name']){delete _0x250057[_0xae0c('0x2c')];}_0x5d0c77[_0xae0c('0x1b')](_0x4d0bc1)[_0xae0c('0x2d')](_0x250057);};}exports['index']=function(_0x3b5267,_0x342560){var _0x325369={},_0x5c0a8e={},_0x331ca2={'count':0x0,'rows':[]};var _0x3de5bf=_[_0xae0c('0x2e')](db[_0xae0c('0x2f')]['rawAttributes'],function(_0xdcb34c){return{'name':_0xdcb34c[_0xae0c('0x30')],'type':_0xdcb34c[_0xae0c('0x31')]['key']};});_0x5c0a8e[_0xae0c('0x32')]=_[_0xae0c('0x2e')](_0x3de5bf,_0xae0c('0x2c'));_0x5c0a8e[_0xae0c('0x33')]=_[_0xae0c('0x34')](_0x3b5267[_0xae0c('0x33')]);_0x5c0a8e[_0xae0c('0x35')]=_[_0xae0c('0x36')](_0x5c0a8e['model'],_0x5c0a8e[_0xae0c('0x33')]);_0x325369[_0xae0c('0x37')]=_['intersection'](_0x5c0a8e[_0xae0c('0x32')],qs[_0xae0c('0x38')](_0x3b5267['query'][_0xae0c('0x38')]));_0x325369[_0xae0c('0x37')]=_0x325369[_0xae0c('0x37')][_0xae0c('0x39')]?_0x325369[_0xae0c('0x37')]:_0x5c0a8e[_0xae0c('0x32')];if(!_0x3b5267['query']['hasOwnProperty'](_0xae0c('0x3a'))){_0x325369[_0xae0c('0x1e')]=qs[_0xae0c('0x1e')](_0x3b5267[_0xae0c('0x33')][_0xae0c('0x1e')]);_0x325369[_0xae0c('0x1c')]=qs[_0xae0c('0x1c')](_0x3b5267['query'][_0xae0c('0x1c')]);}_0x325369['order']=qs[_0xae0c('0x3b')](_0x3b5267[_0xae0c('0x33')][_0xae0c('0x3b')]);_0x325369['where']=qs['filters'](_[_0xae0c('0x3c')](_0x3b5267[_0xae0c('0x33')],_0x5c0a8e[_0xae0c('0x35')]),_0x3de5bf);if(_0x3b5267[_0xae0c('0x33')][_0xae0c('0x3d')]){_0x325369[_0xae0c('0x3e')]=_[_0xae0c('0x3f')](_0x325369['where'],{'$or':_[_0xae0c('0x2e')](_0x3de5bf,function(_0x8471d4){if(_0x8471d4[_0xae0c('0x31')]!=='VIRTUAL'){var _0x135615={};_0x135615[_0x8471d4[_0xae0c('0x2c')]]={'$like':'%'+_0x3b5267[_0xae0c('0x33')][_0xae0c('0x3d')]+'%'};return _0x135615;}})});}_0x325369=_[_0xae0c('0x3f')]({},_0x325369,_0x3b5267[_0xae0c('0x40')]);var _0x392041={'where':_0x325369[_0xae0c('0x3e')]};return db[_0xae0c('0x2f')][_0xae0c('0x1f')](_0x392041)[_0xae0c('0x25')](function(_0x53f6d0){_0x331ca2[_0xae0c('0x1f')]=_0x53f6d0;if(_0x3b5267[_0xae0c('0x33')][_0xae0c('0x41')]){_0x325369[_0xae0c('0x42')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x325369);})[_0xae0c('0x25')](function(_0x2de871){_0x331ca2['rows']=_0x2de871;return _0x331ca2;})[_0xae0c('0x25')](respondWithFilteredResult(_0x342560,_0x325369))[_0xae0c('0x43')](handleError(_0x342560,null));};exports['show']=function(_0x2a0dc0,_0x3f2d86){var _0xf29d03={'raw':![],'where':{'id':_0x2a0dc0['params']['id']}},_0x50b712={};_0x50b712[_0xae0c('0x32')]=_[_0xae0c('0x34')](db[_0xae0c('0x2f')][_0xae0c('0x44')]);_0x50b712[_0xae0c('0x33')]=_[_0xae0c('0x34')](_0x2a0dc0[_0xae0c('0x33')]);_0x50b712['filters']=_[_0xae0c('0x36')](_0x50b712['model'],_0x50b712[_0xae0c('0x33')]);_0xf29d03[_0xae0c('0x37')]=_[_0xae0c('0x36')](_0x50b712[_0xae0c('0x32')],qs['fields'](_0x2a0dc0['query']['fields']));_0xf29d03['attributes']=_0xf29d03[_0xae0c('0x37')][_0xae0c('0x39')]?_0xf29d03[_0xae0c('0x37')]:_0x50b712[_0xae0c('0x32')];if(_0x2a0dc0['query'][_0xae0c('0x41')]){_0xf29d03[_0xae0c('0x42')]=[{'all':!![]}];}_0xf29d03=_[_0xae0c('0x3f')]({},_0xf29d03,_0x2a0dc0[_0xae0c('0x40')]);return db['Trigger'][_0xae0c('0x45')](_0xf29d03)[_0xae0c('0x25')](handleEntityNotFound(_0x3f2d86,null))[_0xae0c('0x25')](respondWithResult(_0x3f2d86,null))['catch'](handleError(_0x3f2d86,null));};exports[_0xae0c('0x46')]=function(_0x541c6f,_0x5ac3ec){return db[_0xae0c('0x2f')][_0xae0c('0x46')](_0x541c6f['body'],{})[_0xae0c('0x25')](function(_0x84985e){var _0x218950=_0x541c6f[_0xae0c('0x47')]['get']({'plain':!![]});if(!_0x218950)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x218950[_0xae0c('0x48')]==='user'){var _0x2e4295=_0x84985e[_0xae0c('0x27')]({'plain':!![]});var _0x287698='Triggers';return db[_0xae0c('0x49')][_0xae0c('0x45')]({'where':{'name':_0x287698,'userProfileId':_0x218950['userProfileId']},'raw':!![]})[_0xae0c('0x25')](function(_0x437c86){if(_0x437c86&&_0x437c86[_0xae0c('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x2e4295[_0xae0c('0x2c')],'resourceId':_0x2e4295['id'],'type':_0x437c86[_0xae0c('0x2c')],'sectionId':_0x437c86['id']},{})[_0xae0c('0x25')](function(){return _0x84985e;});}else{return _0x84985e;}})['catch'](function(_0x378b60){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x378b60);throw _0x378b60;});}return _0x84985e;})['then'](respondWithResult(_0x5ac3ec,0xc9))[_0xae0c('0x43')](handleError(_0x5ac3ec,null));};exports['update']=function(_0x5f26ca,_0x3e822b){if(_0x5f26ca[_0xae0c('0x4b')]['id']){delete _0x5f26ca[_0xae0c('0x4b')]['id'];}return db[_0xae0c('0x2f')]['find']({'where':{'id':_0x5f26ca['params']['id']}})['then'](handleEntityNotFound(_0x3e822b,null))[_0xae0c('0x25')](saveUpdates(_0x5f26ca['body'],null))[_0xae0c('0x25')](respondWithResult(_0x3e822b,null))[_0xae0c('0x43')](handleError(_0x3e822b,null));};exports['destroy']=function(_0x4b7af2,_0x1afb23){return db[_0xae0c('0x2f')]['find']({'where':{'id':_0x4b7af2['params']['id']}})['then'](handleEntityNotFound(_0x1afb23,null))[_0xae0c('0x25')](removeEntity(_0x1afb23,null))[_0xae0c('0x43')](handleError(_0x1afb23,null));};exports[_0xae0c('0x4c')]=function(_0xa1553f,_0x44c691,_0x1452a1){if(_0xa1553f[_0xae0c('0x4b')]['id']){delete _0xa1553f[_0xae0c('0x4b')]['id'];}return db[_0xae0c('0x2f')][_0xae0c('0x45')]({'where':{'id':_0xa1553f[_0xae0c('0x4d')]['id']}})[_0xae0c('0x25')](handleEntityNotFound(_0x44c691,null))[_0xae0c('0x25')](function(_0x55ec3e){if(_0x55ec3e){_0xa1553f[_0xae0c('0x4b')][_0xae0c('0x4e')]=_0x55ec3e['id'];return db[_0xae0c('0x4f')][_0xae0c('0x46')](_0xa1553f[_0xae0c('0x4b')]);}})['then'](respondWithResult(_0x44c691,null))[_0xae0c('0x43')](handleError(_0x44c691,null));};exports['addAnyCondition']=function(_0x26473e,_0x5d1813,_0xb9744d){if(_0x26473e['body']['id']){delete _0x26473e['body']['id'];}return db['Trigger'][_0xae0c('0x45')]({'where':{'id':_0x26473e[_0xae0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d1813,null))[_0xae0c('0x25')](function(_0x49bb2a){if(_0x49bb2a){_0x26473e[_0xae0c('0x4b')][_0xae0c('0x50')]=_0x49bb2a['id'];return db[_0xae0c('0x4f')][_0xae0c('0x46')](_0x26473e[_0xae0c('0x4b')]);}})[_0xae0c('0x25')](respondWithResult(_0x5d1813,null))[_0xae0c('0x43')](handleError(_0x5d1813,null));};exports[_0xae0c('0x51')]=function(_0x3ece4b,_0x5a4f73,_0x2ff95a){var _0x4f8318={};var _0x505b82={};var _0x1440f1;var _0x5ad881;return db[_0xae0c('0x2f')][_0xae0c('0x52')]({'where':{'id':_0x3ece4b[_0xae0c('0x4d')]['id']}})[_0xae0c('0x25')](handleEntityNotFound(_0x5a4f73,null))[_0xae0c('0x25')](function(_0x734603){if(_0x734603){_0x1440f1=_0x734603;_0x505b82[_0xae0c('0x32')]=_[_0xae0c('0x34')](db['Condition'][_0xae0c('0x44')]);_0x505b82['query']=_[_0xae0c('0x34')](_0x3ece4b['query']);_0x505b82[_0xae0c('0x35')]=_[_0xae0c('0x36')](_0x505b82[_0xae0c('0x32')],_0x505b82[_0xae0c('0x33')]);_0x4f8318[_0xae0c('0x37')]=_[_0xae0c('0x36')](_0x505b82[_0xae0c('0x32')],qs[_0xae0c('0x38')](_0x3ece4b['query']['fields']));_0x4f8318[_0xae0c('0x37')]=_0x4f8318['attributes'][_0xae0c('0x39')]?_0x4f8318['attributes']:_0x505b82[_0xae0c('0x32')];_0x4f8318[_0xae0c('0x53')]=qs[_0xae0c('0x3b')](_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x3b')]);_0x4f8318['where']=qs[_0xae0c('0x35')](_[_0xae0c('0x3c')](_0x3ece4b[_0xae0c('0x33')],_0x505b82[_0xae0c('0x35')]));if(_0x3ece4b[_0xae0c('0x33')]['filter']){_0x4f8318[_0xae0c('0x3e')]=_[_0xae0c('0x3f')](_0x4f8318[_0xae0c('0x3e')],{'$or':_['map'](_0x4f8318['attributes'],function(_0x577a5b){var _0x2c91ba={};_0x2c91ba[_0x577a5b]={'$like':'%'+_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x3d')]+'%'};return _0x2c91ba;})});}_0x4f8318=_[_0xae0c('0x3f')]({},_0x4f8318,_0x3ece4b[_0xae0c('0x40')]);return _0x1440f1[_0xae0c('0x51')](_0x4f8318);}})['then'](function(_0x171af2){if(_0x171af2){_0x5ad881=_0x171af2[_0xae0c('0x39')];if(!_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x54')](_0xae0c('0x3a'))){_0x4f8318['limit']=qs[_0xae0c('0x1e')](_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x1e')]);_0x4f8318['offset']=qs[_0xae0c('0x1c')](_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x1c')]);}return _0x1440f1[_0xae0c('0x51')](_0x4f8318);}})[_0xae0c('0x25')](function(_0xa7ea15){if(_0xa7ea15){return _0xa7ea15?{'count':_0x5ad881,'rows':_0xa7ea15}:null;}})[_0xae0c('0x25')](respondWithResult(_0x5a4f73,null))[_0xae0c('0x43')](handleError(_0x5a4f73,null));};exports['getAnyConditions']=function(_0x5b3f14,_0x4d98e1,_0x245451){var _0x176cab={};var _0x3c8204={};var _0x209d73;var _0x4c79c6;return db['Trigger']['findOne']({'where':{'id':_0x5b3f14[_0xae0c('0x4d')]['id']}})[_0xae0c('0x25')](handleEntityNotFound(_0x4d98e1,null))['then'](function(_0x4fb4c9){if(_0x4fb4c9){_0x209d73=_0x4fb4c9;_0x3c8204[_0xae0c('0x32')]=_[_0xae0c('0x34')](db['Condition'][_0xae0c('0x44')]);_0x3c8204['query']=_[_0xae0c('0x34')](_0x5b3f14[_0xae0c('0x33')]);_0x3c8204['filters']=_[_0xae0c('0x36')](_0x3c8204['model'],_0x3c8204['query']);_0x176cab['attributes']=_[_0xae0c('0x36')](_0x3c8204[_0xae0c('0x32')],qs[_0xae0c('0x38')](_0x5b3f14[_0xae0c('0x33')]['fields']));_0x176cab['attributes']=_0x176cab[_0xae0c('0x37')][_0xae0c('0x39')]?_0x176cab[_0xae0c('0x37')]:_0x3c8204['model'];_0x176cab[_0xae0c('0x53')]=qs[_0xae0c('0x3b')](_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x3b')]);_0x176cab[_0xae0c('0x3e')]=qs[_0xae0c('0x35')](_[_0xae0c('0x3c')](_0x5b3f14[_0xae0c('0x33')],_0x3c8204[_0xae0c('0x35')]));if(_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x3d')]){_0x176cab[_0xae0c('0x3e')]=_[_0xae0c('0x3f')](_0x176cab[_0xae0c('0x3e')],{'$or':_['map'](_0x176cab[_0xae0c('0x37')],function(_0xa78aef){var _0x32e779={};_0x32e779[_0xa78aef]={'$like':'%'+_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x3d')]+'%'};return _0x32e779;})});}_0x176cab=_['merge']({},_0x176cab,_0x5b3f14[_0xae0c('0x40')]);return _0x209d73['getAnyConditions'](_0x176cab);}})['then'](function(_0x2d67e7){if(_0x2d67e7){_0x4c79c6=_0x2d67e7[_0xae0c('0x39')];if(!_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x54')](_0xae0c('0x3a'))){_0x176cab[_0xae0c('0x1e')]=qs['limit'](_0x5b3f14['query'][_0xae0c('0x1e')]);_0x176cab[_0xae0c('0x1c')]=qs['offset'](_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x1c')]);}return _0x209d73[_0xae0c('0x55')](_0x176cab);}})[_0xae0c('0x25')](function(_0x4a659e){if(_0x4a659e){return _0x4a659e?{'count':_0x4c79c6,'rows':_0x4a659e}:null;}})[_0xae0c('0x25')](respondWithResult(_0x4d98e1,null))[_0xae0c('0x43')](handleError(_0x4d98e1,null));};exports[_0xae0c('0x56')]=function(_0x3d8bd9,_0x165e0a,_0x19b161){if(_0x3d8bd9[_0xae0c('0x4b')]['id']){delete _0x3d8bd9['body']['id'];}return db[_0xae0c('0x2f')]['find']({'where':{'id':_0x3d8bd9[_0xae0c('0x4d')]['id']}})[_0xae0c('0x25')](handleEntityNotFound(_0x165e0a,null))[_0xae0c('0x25')](function(_0x5e238d){if(_0x5e238d){_0x3d8bd9['body'][_0xae0c('0x57')]=_0x5e238d['id'];return db['Action'][_0xae0c('0x46')](_0x3d8bd9[_0xae0c('0x4b')]);}})['then'](respondWithResult(_0x165e0a,null))[_0xae0c('0x43')](handleError(_0x165e0a,null));};exports[_0xae0c('0x58')]=function(_0x105e05,_0x1e5aa0,_0x2710cf){var _0xa61b7c={};var _0x10edb5={};var _0x21a264;var _0x31c268;return db[_0xae0c('0x2f')]['findOne']({'where':{'id':_0x105e05[_0xae0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e5aa0,null))[_0xae0c('0x25')](function(_0x3bfc2d){if(_0x3bfc2d){_0x21a264=_0x3bfc2d;_0x10edb5[_0xae0c('0x32')]=_[_0xae0c('0x34')](db[_0xae0c('0x59')][_0xae0c('0x44')]);_0x10edb5['query']=_[_0xae0c('0x34')](_0x105e05[_0xae0c('0x33')]);_0x10edb5[_0xae0c('0x35')]=_[_0xae0c('0x36')](_0x10edb5[_0xae0c('0x32')],_0x10edb5[_0xae0c('0x33')]);_0xa61b7c[_0xae0c('0x37')]=_[_0xae0c('0x36')](_0x10edb5[_0xae0c('0x32')],qs[_0xae0c('0x38')](_0x105e05[_0xae0c('0x33')][_0xae0c('0x38')]));_0xa61b7c['attributes']=_0xa61b7c[_0xae0c('0x37')][_0xae0c('0x39')]?_0xa61b7c[_0xae0c('0x37')]:_0x10edb5[_0xae0c('0x32')];_0xa61b7c[_0xae0c('0x53')]=qs[_0xae0c('0x3b')](_0x105e05['query'][_0xae0c('0x3b')]);_0xa61b7c[_0xae0c('0x3e')]=qs[_0xae0c('0x35')](_[_0xae0c('0x3c')](_0x105e05[_0xae0c('0x33')],_0x10edb5[_0xae0c('0x35')]));if(_0x105e05[_0xae0c('0x33')][_0xae0c('0x3d')]){_0xa61b7c[_0xae0c('0x3e')]=_[_0xae0c('0x3f')](_0xa61b7c[_0xae0c('0x3e')],{'$or':_[_0xae0c('0x2e')](_0xa61b7c[_0xae0c('0x37')],function(_0x3219b1){var _0x2906b6={};_0x2906b6[_0x3219b1]={'$like':'%'+_0x105e05[_0xae0c('0x33')][_0xae0c('0x3d')]+'%'};return _0x2906b6;})});}_0xa61b7c=_['merge']({},_0xa61b7c,_0x105e05[_0xae0c('0x40')]);return _0x21a264['getActions'](_0xa61b7c);}})[_0xae0c('0x25')](function(_0x424aa2){if(_0x424aa2){_0x31c268=_0x424aa2['length'];if(!_0x105e05['query'][_0xae0c('0x54')](_0xae0c('0x3a'))){_0xa61b7c[_0xae0c('0x1e')]=qs[_0xae0c('0x1e')](_0x105e05[_0xae0c('0x33')][_0xae0c('0x1e')]);_0xa61b7c[_0xae0c('0x1c')]=qs[_0xae0c('0x1c')](_0x105e05['query'][_0xae0c('0x1c')]);}return _0x21a264[_0xae0c('0x58')](_0xa61b7c);}})[_0xae0c('0x25')](function(_0x7c717d){if(_0x7c717d){return _0x7c717d?{'count':_0x31c268,'rows':_0x7c717d}:null;}})['then'](respondWithResult(_0x1e5aa0,null))[_0xae0c('0x43')](handleError(_0x1e5aa0,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e1ad00b..dc8010f 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 _0x3e9d=['Trigger','tools_triggers','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./trigger.attributes','exports'];(function(_0x478fe5,_0x3bf70b){var _0x371ba3=function(_0x677f27){while(--_0x677f27){_0x478fe5['push'](_0x478fe5['shift']());}};_0x371ba3(++_0x3bf70b);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x183d78,_0x2b2120){_0x183d78=_0x183d78-0x0;var _0x13dffd=_0x3e9d[_0x183d78];return _0x13dffd;};'use strict';var _=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var logger=require('../../config/logger')(_0xd3e9('0x2'));var moment=require(_0xd3e9('0x3'));var BPromise=require(_0xd3e9('0x4'));var rp=require(_0xd3e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3e9('0x6'));var attributes=require(_0xd3e9('0x7'));module[_0xd3e9('0x8')]=function(_0x3dea0a,_0x568eea){return _0x3dea0a['define'](_0xd3e9('0x9'),attributes,{'tableName':_0xd3e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x758e=['Trigger','lodash','api','moment','bluebird','rimraf','../../config/environment','./trigger.attributes','exports','define'];(function(_0x2a20a5,_0x3ac660){var _0x37bd9b=function(_0xa8a2c){while(--_0xa8a2c){_0x2a20a5['push'](_0x2a20a5['shift']());}};_0x37bd9b(++_0x3ac660);}(_0x758e,0x1af));var _0xe758=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x758e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe758('0x1'));var moment=require(_0xe758('0x2'));var BPromise=require(_0xe758('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe758('0x4'));var config=require(_0xe758('0x5'));var attributes=require(_0xe758('0x6'));module[_0xe758('0x7')]=function(_0x5a2226,_0x2cdf89){return _0x5a2226[_0xe758('0x8')](_0xe758('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 209a678..5dc604b 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 _0x8fc7=['ShowTrigger','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','catch','Trigger','options','raw','attributes','limit','include','map','model','GetTrigger'];(function(_0x1f3fc9,_0x59811f){var _0x4488fc=function(_0x1e398c){while(--_0x1e398c){_0x1f3fc9['push'](_0x1f3fc9['shift']());}};_0x4488fc(++_0x59811f);}(_0x8fc7,0x182));var _0x78fc=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x8fc7[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require('lodash');var util=require(_0x78fc('0x0'));var moment=require(_0x78fc('0x1'));var BPromise=require(_0x78fc('0x2'));var rs=require(_0x78fc('0x3'));var fs=require('fs');var Redis=require(_0x78fc('0x4'));var db=require(_0x78fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x78fc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x78fc('0x7')][_0x78fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c84da,_0x56be57,_0x3d3cc9){return new BPromise(function(_0x1486d9,_0x37240c){return client[_0x78fc('0x9')](_0x3c84da,_0x3d3cc9)[_0x78fc('0xa')](function(_0x467b1b){logger[_0x78fc('0xb')]('Trigger,\x20%s,\x20%s',_0x56be57,_0x78fc('0xc'));logger[_0x78fc('0xd')](_0x78fc('0xe'),_0x56be57,_0x78fc('0xc'),JSON[_0x78fc('0xf')](_0x467b1b));if(_0x467b1b[_0x78fc('0x10')]){if(_0x467b1b['error'][_0x78fc('0x11')]===0x1f4){logger[_0x78fc('0x10')](_0x78fc('0x12'),_0x56be57,_0x467b1b[_0x78fc('0x10')][_0x78fc('0x13')]);return _0x37240c(_0x467b1b[_0x78fc('0x10')][_0x78fc('0x13')]);}logger[_0x78fc('0x10')](_0x78fc('0x12'),_0x56be57,_0x467b1b[_0x78fc('0x10')][_0x78fc('0x13')]);return _0x1486d9(_0x467b1b[_0x78fc('0x10')][_0x78fc('0x13')]);}else{logger[_0x78fc('0xb')]('Trigger,\x20%s,\x20%s',_0x56be57,_0x78fc('0xc'));_0x1486d9(_0x467b1b['result'][_0x78fc('0x13')]);}})[_0x78fc('0x14')](function(_0x4a991b){logger[_0x78fc('0x10')]('Trigger,\x20%s,\x20%s',_0x56be57,_0x4a991b);_0x37240c(_0x4a991b);});});}exports['GetTrigger']=function(_0x1fc14b){var _0x4c7caa=this;return new Promise(function(_0x2a73d0,_0x4875ad){return db[_0x78fc('0x15')]['findAll']({'raw':_0x1fc14b[_0x78fc('0x16')]?_0x1fc14b[_0x78fc('0x16')][_0x78fc('0x17')]===undefined?!![]:![]:!![],'where':_0x1fc14b[_0x78fc('0x16')]?_0x1fc14b[_0x78fc('0x16')]['where']||null:null,'attributes':_0x1fc14b[_0x78fc('0x16')]?_0x1fc14b[_0x78fc('0x16')][_0x78fc('0x18')]||null:null,'limit':_0x1fc14b['options']?_0x1fc14b[_0x78fc('0x16')][_0x78fc('0x19')]||null:null,'include':_0x1fc14b[_0x78fc('0x16')]?_0x1fc14b[_0x78fc('0x16')][_0x78fc('0x1a')]?_[_0x78fc('0x1b')](_0x1fc14b[_0x78fc('0x16')][_0x78fc('0x1a')],function(_0x399530){return{'model':db[_0x399530[_0x78fc('0x1c')]],'as':_0x399530['as'],'attributes':_0x399530['attributes'],'include':_0x399530[_0x78fc('0x1a')]?_[_0x78fc('0x1b')](_0x399530[_0x78fc('0x1a')],function(_0x2eda45){return{'model':db[_0x2eda45['model']],'as':_0x2eda45['as'],'attributes':_0x2eda45['attributes'],'include':_0x2eda45[_0x78fc('0x1a')]?_['map'](_0x2eda45[_0x78fc('0x1a')],function(_0x33b643){return{'model':db[_0x33b643['model']],'as':_0x33b643['as'],'attributes':_0x33b643[_0x78fc('0x18')]};}):[]};}):[]};}):[]:[]})[_0x78fc('0xa')](function(_0x4cfab3){logger[_0x78fc('0xb')](_0x78fc('0x1d'),_0x1fc14b);logger['debug']('GetTrigger',_0x1fc14b,JSON[_0x78fc('0xf')](_0x4cfab3));_0x2a73d0(_0x4cfab3);})[_0x78fc('0x14')](function(_0x57d39a){logger[_0x78fc('0x10')]('GetTrigger',_0x57d39a[_0x78fc('0x13')],_0x1fc14b);_0x4875ad(_0x4c7caa[_0x78fc('0x10')](0x1f4,_0x57d39a[_0x78fc('0x13')]));});});};exports[_0x78fc('0x1e')]=function(_0x209d0c){var _0x2a7547=this;return new Promise(function(_0x52755b,_0x176ea5){return db[_0x78fc('0x15')][_0x78fc('0x1f')]({'raw':_0x209d0c['options']?_0x209d0c[_0x78fc('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x209d0c[_0x78fc('0x16')]?_0x209d0c[_0x78fc('0x16')]['where']||null:null,'attributes':_0x209d0c['options']?_0x209d0c[_0x78fc('0x16')][_0x78fc('0x18')]||null:null,'include':_0x209d0c[_0x78fc('0x16')]?_0x209d0c[_0x78fc('0x16')][_0x78fc('0x1a')]?_[_0x78fc('0x1b')](_0x209d0c[_0x78fc('0x16')][_0x78fc('0x1a')],function(_0x59e45e){return{'model':db[_0x59e45e[_0x78fc('0x1c')]],'as':_0x59e45e['as'],'attributes':_0x59e45e[_0x78fc('0x18')],'include':_0x59e45e[_0x78fc('0x1a')]?_[_0x78fc('0x1b')](_0x59e45e['include'],function(_0x54a07f){return{'model':db[_0x54a07f[_0x78fc('0x1c')]],'as':_0x54a07f['as'],'attributes':_0x54a07f[_0x78fc('0x18')],'include':_0x54a07f[_0x78fc('0x1a')]?_[_0x78fc('0x1b')](_0x54a07f['include'],function(_0x2966e0){return{'model':db[_0x2966e0[_0x78fc('0x1c')]],'as':_0x2966e0['as'],'attributes':_0x2966e0[_0x78fc('0x18')]};}):[]};}):[]};}):[]:[]})[_0x78fc('0xa')](function(_0x5713f3){logger[_0x78fc('0xb')]('ShowTrigger',_0x209d0c);logger[_0x78fc('0xd')](_0x78fc('0x1e'),_0x209d0c,JSON[_0x78fc('0xf')](_0x5713f3));_0x52755b(_0x5713f3);})[_0x78fc('0x14')](function(_0x137295){logger[_0x78fc('0x10')]('ShowTrigger',_0x137295['message'],_0x209d0c);_0x176ea5(_0x2a7547[_0x78fc('0x10')](0x1f4,_0x137295['message']));});});}; \ No newline at end of file +var _0x354b=['error','message','info','result','catch','GetTrigger','findAll','options','where','map','include','model','attributes','debug','ShowTrigger','Trigger','find','raw','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x33de28,_0x542c6d){var _0x49605d=function(_0x20e139){while(--_0x20e139){_0x33de28['push'](_0x33de28['shift']());}};_0x49605d(++_0x542c6d);}(_0x354b,0xad));var _0xb354=function(_0x107aaa,_0x2dafc4){_0x107aaa=_0x107aaa-0x0;var _0x13154a=_0x354b[_0x107aaa];return _0x13154a;};'use strict';var _=require('lodash');var util=require(_0xb354('0x0'));var moment=require('moment');var BPromise=require(_0xb354('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb354('0x2'));var logger=require(_0xb354('0x3'))(_0xb354('0x4'));var config=require(_0xb354('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb354('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1ac3e2,_0xb1a55c,_0x457812){return new BPromise(function(_0x136a8b,_0x8b8553){return client[_0xb354('0x7')](_0x1ac3e2,_0x457812)[_0xb354('0x8')](function(_0x5e7c2a){logger['info'](_0xb354('0x9'),_0xb1a55c,'request\x20sent');logger['debug'](_0xb354('0xa'),_0xb1a55c,_0xb354('0xb'),JSON[_0xb354('0xc')](_0x5e7c2a));if(_0x5e7c2a[_0xb354('0xd')]){if(_0x5e7c2a[_0xb354('0xd')]['code']===0x1f4){logger[_0xb354('0xd')](_0xb354('0x9'),_0xb1a55c,_0x5e7c2a[_0xb354('0xd')][_0xb354('0xe')]);return _0x8b8553(_0x5e7c2a['error'][_0xb354('0xe')]);}logger['error'](_0xb354('0x9'),_0xb1a55c,_0x5e7c2a['error'][_0xb354('0xe')]);return _0x136a8b(_0x5e7c2a[_0xb354('0xd')]['message']);}else{logger[_0xb354('0xf')](_0xb354('0x9'),_0xb1a55c,'request\x20sent');_0x136a8b(_0x5e7c2a[_0xb354('0x10')]['message']);}})[_0xb354('0x11')](function(_0x4893c0){logger[_0xb354('0xd')](_0xb354('0x9'),_0xb1a55c,_0x4893c0);_0x8b8553(_0x4893c0);});});}exports[_0xb354('0x12')]=function(_0xbe6a55){var _0x208d39=this;return new Promise(function(_0x23af8d,_0x2fca36){return db['Trigger'][_0xb354('0x13')]({'raw':_0xbe6a55[_0xb354('0x14')]?_0xbe6a55[_0xb354('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xbe6a55[_0xb354('0x14')]?_0xbe6a55[_0xb354('0x14')][_0xb354('0x15')]||null:null,'attributes':_0xbe6a55[_0xb354('0x14')]?_0xbe6a55[_0xb354('0x14')]['attributes']||null:null,'limit':_0xbe6a55[_0xb354('0x14')]?_0xbe6a55[_0xb354('0x14')]['limit']||null:null,'include':_0xbe6a55['options']?_0xbe6a55[_0xb354('0x14')]['include']?_[_0xb354('0x16')](_0xbe6a55[_0xb354('0x14')][_0xb354('0x17')],function(_0x20dd35){return{'model':db[_0x20dd35[_0xb354('0x18')]],'as':_0x20dd35['as'],'attributes':_0x20dd35[_0xb354('0x19')],'include':_0x20dd35[_0xb354('0x17')]?_[_0xb354('0x16')](_0x20dd35[_0xb354('0x17')],function(_0x5cd1af){return{'model':db[_0x5cd1af[_0xb354('0x18')]],'as':_0x5cd1af['as'],'attributes':_0x5cd1af['attributes'],'include':_0x5cd1af[_0xb354('0x17')]?_['map'](_0x5cd1af[_0xb354('0x17')],function(_0x550b88){return{'model':db[_0x550b88[_0xb354('0x18')]],'as':_0x550b88['as'],'attributes':_0x550b88[_0xb354('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb354('0x8')](function(_0x4b6836){logger[_0xb354('0xf')]('GetTrigger',_0xbe6a55);logger[_0xb354('0x1a')]('GetTrigger',_0xbe6a55,JSON[_0xb354('0xc')](_0x4b6836));_0x23af8d(_0x4b6836);})[_0xb354('0x11')](function(_0x101895){logger[_0xb354('0xd')](_0xb354('0x12'),_0x101895['message'],_0xbe6a55);_0x2fca36(_0x208d39[_0xb354('0xd')](0x1f4,_0x101895[_0xb354('0xe')]));});});};exports[_0xb354('0x1b')]=function(_0xdd8335){var _0x28fd4d=this;return new Promise(function(_0x4054c0,_0x5ad0f1){return db[_0xb354('0x1c')][_0xb354('0x1d')]({'raw':_0xdd8335[_0xb354('0x14')]?_0xdd8335['options'][_0xb354('0x1e')]===undefined?!![]:![]:!![],'where':_0xdd8335[_0xb354('0x14')]?_0xdd8335[_0xb354('0x14')]['where']||null:null,'attributes':_0xdd8335[_0xb354('0x14')]?_0xdd8335[_0xb354('0x14')]['attributes']||null:null,'include':_0xdd8335[_0xb354('0x14')]?_0xdd8335[_0xb354('0x14')][_0xb354('0x17')]?_[_0xb354('0x16')](_0xdd8335[_0xb354('0x14')][_0xb354('0x17')],function(_0x226a97){return{'model':db[_0x226a97['model']],'as':_0x226a97['as'],'attributes':_0x226a97[_0xb354('0x19')],'include':_0x226a97['include']?_[_0xb354('0x16')](_0x226a97[_0xb354('0x17')],function(_0x44f7eb){return{'model':db[_0x44f7eb[_0xb354('0x18')]],'as':_0x44f7eb['as'],'attributes':_0x44f7eb['attributes'],'include':_0x44f7eb[_0xb354('0x17')]?_['map'](_0x44f7eb[_0xb354('0x17')],function(_0x678a22){return{'model':db[_0x678a22[_0xb354('0x18')]],'as':_0x678a22['as'],'attributes':_0x678a22[_0xb354('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb354('0x8')](function(_0x263f9b){logger[_0xb354('0xf')](_0xb354('0x1b'),_0xdd8335);logger[_0xb354('0x1a')]('ShowTrigger',_0xdd8335,JSON[_0xb354('0xc')](_0x263f9b));_0x4054c0(_0x263f9b);})['catch'](function(_0x25f3ad){logger['error'](_0xb354('0x1b'),_0x25f3ad[_0xb354('0xe')],_0xdd8335);_0x5ad0f1(_0x28fd4d['error'](0x1f4,_0x25f3ad[_0xb354('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 92f0624..5099dbb 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 _0x682c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','get','show','post','clone','create','put','/:id','delete','destroy','multer','util','path'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x682c,0xba));var _0xc682=function(_0x541b78,_0xea3bdb){_0x541b78=_0x541b78-0x0;var _0xf5a5be=_0x682c[_0x541b78];return _0xf5a5be;};'use strict';var multer=require(_0xc682('0x0'));var util=require(_0xc682('0x1'));var path=require(_0xc682('0x2'));var timeout=require(_0xc682('0x3'));var express=require(_0xc682('0x4'));var router=express[_0xc682('0x5')]();var fs_extra=require(_0xc682('0x6'));var auth=require(_0xc682('0x7'));var interaction=require(_0xc682('0x8'));var config=require('../../config/environment');var controller=require(_0xc682('0x9'));router['get']('/',auth[_0xc682('0xa')](),controller[_0xc682('0xb')]);router[_0xc682('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xc682('0xd')]);router[_0xc682('0xe')]('/:id/clone',auth[_0xc682('0xa')](),controller[_0xc682('0xf')]);router['post']('/',auth[_0xc682('0xa')](),controller[_0xc682('0x10')]);router[_0xc682('0x11')](_0xc682('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xc682('0x13')](_0xc682('0x12'),auth[_0xc682('0xa')](),controller[_0xc682('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7cba=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','clone','post','create','put','update','delete'];(function(_0x2d2949,_0x397ca6){var _0x2eab93=function(_0x127984){while(--_0x127984){_0x2d2949['push'](_0x2d2949['shift']());}};_0x2eab93(++_0x397ca6);}(_0x7cba,0xfd));var _0xa7cb=function(_0x52de97,_0xfb3572){_0x52de97=_0x52de97-0x0;var _0x1ed4e9=_0x7cba[_0x52de97];return _0x1ed4e9;};'use strict';var multer=require(_0xa7cb('0x0'));var util=require(_0xa7cb('0x1'));var path=require('path');var timeout=require(_0xa7cb('0x2'));var express=require(_0xa7cb('0x3'));var router=express[_0xa7cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa7cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa7cb('0x6'));var controller=require('./trunk.controller');router[_0xa7cb('0x7')]('/',auth[_0xa7cb('0x8')](),controller['index']);router[_0xa7cb('0x7')](_0xa7cb('0x9'),auth[_0xa7cb('0x8')](),controller[_0xa7cb('0xa')]);router['post']('/:id/clone',auth[_0xa7cb('0x8')](),controller[_0xa7cb('0xb')]);router[_0xa7cb('0xc')]('/',auth[_0xa7cb('0x8')](),controller[_0xa7cb('0xd')]);router[_0xa7cb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa7cb('0xf')]);router[_0xa7cb('0x10')](_0xa7cb('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xa7cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8784946..ba1ca36 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 _0xfe91=['user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','nonat','outgoing','yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update','update,nonat','BOOLEAN','sequelize','exports','STRING','friend'];(function(_0x59689c,_0x36f091){var _0x12f635=function(_0x3cb0b2){while(--_0x3cb0b2){_0x59689c['push'](_0x59689c['shift']());}};_0x12f635(++_0x36f091);}(_0xfe91,0x134));var _0x1fe9=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xfe91[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require(_0x1fe9('0x0'));module[_0x1fe9('0x1')]={'name':{'type':Sequelize[_0x1fe9('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1fe9('0x3'),_0x1fe9('0x4'),_0x1fe9('0x5')),'allowNull':![],'defaultValue':_0x1fe9('0x3')},'context':{'type':Sequelize[_0x1fe9('0x2')],'allowNull':![],'defaultValue':_0x1fe9('0x6')},'callingpres':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x8'),_0x1fe9('0x9'),_0x1fe9('0xa'),_0x1fe9('0xb'),_0x1fe9('0xc'),_0x1fe9('0xd'),'PROHIB_FAILED_SCREEN',_0x1fe9('0xe'))},'deny':{'type':Sequelize[_0x1fe9('0x2')]},'permit':{'type':Sequelize[_0x1fe9('0x2')]},'secret':{'type':Sequelize[_0x1fe9('0x2')]},'md5secret':{'type':Sequelize[_0x1fe9('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x1fe9('0x2')],'defaultValue':_0x1fe9('0xf'),'set':function(_0x4a1ab4){this[_0x1fe9('0x10')](_0x1fe9('0x11'),_0x4a1ab4?_0x4a1ab4[_0x1fe9('0x12')](','):null);},'get':function(){return this[_0x1fe9('0x13')](_0x1fe9('0x11'))?this[_0x1fe9('0x13')](_0x1fe9('0x11'))['split'](','):null;},'comment':_0x1fe9('0x14')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x1fe9('0x15'),_0x1fe9('0x16'),_0x1fe9('0x17'),_0x1fe9('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1fe9('0x7')]('yes','no',_0x1fe9('0x19'),'update',_0x1fe9('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1fe9('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x1fe9('0x1c'),'set':function(_0x97dcc9){this[_0x1fe9('0x10')](_0x1fe9('0x1d'),_0x97dcc9?_0x97dcc9['join'](','):null);},'get':function(){return this[_0x1fe9('0x13')](_0x1fe9('0x1d'))?this[_0x1fe9('0x13')](_0x1fe9('0x1d'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x1fe9('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1fe9('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x1fe9('0x2')]},'language':{'type':Sequelize[_0x1fe9('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1fe9('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1fe9('0x2')],'defaultValue':_0x1fe9('0x1e')},'allow':{'type':Sequelize[_0x1fe9('0x2')],'allowNull':![],'defaultValue':_0x1fe9('0x1f'),'set':function(_0x571958){this[_0x1fe9('0x10')](_0x1fe9('0x20'),_0x571958?_0x571958[_0x1fe9('0x12')](';'):_0x1fe9('0x1f'));},'get':function(){return this[_0x1fe9('0x13')](_0x1fe9('0x20'))?this[_0x1fe9('0x13')](_0x1fe9('0x20'))[_0x1fe9('0x21')](';'):null;},'comment':_0x1fe9('0x22')},'autoframing':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no')},'insecure':{'type':Sequelize[_0x1fe9('0x2')],'defaultValue':'port,invite','set':function(_0x1c8399){this[_0x1fe9('0x10')]('insecure',_0x1c8399?_0x1c8399[_0x1fe9('0x12')](','):null);},'get':function(){return this['getDataValue'](_0x1fe9('0x23'))?this[_0x1fe9('0x13')](_0x1fe9('0x23'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no',_0x1fe9('0x24'))},'promiscredir':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no')},'accountcode':{'type':Sequelize[_0x1fe9('0x25')](0xb)},'setvar':{'type':Sequelize[_0x1fe9('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x1fe9('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x1fe9('0x7')]('yes','no'),'defaultValue':_0x1fe9('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x1fe9('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x1fe9('0x2')]},'template':{'type':Sequelize[_0x1fe9('0x2')]},'videosupport':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1fe9('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x1fe9('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x1fe9('0x27'),_0x1fe9('0x28'),_0x1fe9('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x2a'),_0x1fe9('0x2b')),'defaultValue':_0x1fe9('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x1fe9('0x2')]},'regexten':{'type':Sequelize[_0x1fe9('0x2')]},'fromdomain':{'type':Sequelize[_0x1fe9('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1fe9('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1fe9('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x1fe9('0x2')]},'defaultuser':{'type':Sequelize[_0x1fe9('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1fe9('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1fe9('0x2')]},'callbackextension':{'type':Sequelize[_0x1fe9('0x2')]},'timert1':{'type':Sequelize[_0x1fe9('0x25')](0xb)},'timerb':{'type':Sequelize[_0x1fe9('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x1fe9('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x1fe9('0x2')]},'maxforwards':{'type':Sequelize[_0x1fe9('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x1fe9('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no',_0x1fe9('0x2c'),_0x1fe9('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x1fe9('0x2')]},'dtlscipher':{'type':Sequelize[_0x1fe9('0x2')]},'dtlscafile':{'type':Sequelize[_0x1fe9('0x2')]},'dtlscapath':{'type':Sequelize[_0x1fe9('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x1fe9('0x2e'),_0x1fe9('0x2f'),_0x1fe9('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1fe9('0x2')]},'usereqphone':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x1fe9('0x2')]},'call_limit':{'type':Sequelize[_0x1fe9('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x1fe9('0x7')](_0x1fe9('0x1b'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1fe9('0x2')]},'mohsuggest':{'type':Sequelize[_0x1fe9('0x2')]},'parkinglot':{'type':Sequelize[_0x1fe9('0x2')]},'description':{'type':Sequelize[_0x1fe9('0x2')]},'host':{'type':Sequelize[_0x1fe9('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x1fe9('0x1b'),'no',_0x1fe9('0x19'),_0x1fe9('0x31'),_0x1fe9('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1fe9('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1fe9('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1fe9('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x47ee=['PROHIB_FAILED_SCREEN','PROHIB','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x4607e1,_0x596f78){var _0x22f1b2=function(_0x122dcc){while(--_0x122dcc){_0x4607e1['push'](_0x4607e1['shift']());}};_0x22f1b2(++_0x596f78);}(_0x47ee,0x19c));var _0xe47e=function(_0x4fc4ff,_0xce32e3){_0x4fc4ff=_0x4fc4ff-0x0;var _0x1e9495=_0x47ee[_0x4fc4ff];return _0x1e9495;};'use strict';var Sequelize=require(_0xe47e('0x0'));module[_0xe47e('0x1')]={'name':{'type':Sequelize[_0xe47e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe47e('0x3')]('friend','user',_0xe47e('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe47e('0x2')],'allowNull':![],'defaultValue':_0xe47e('0x5')},'callingpres':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x6'),_0xe47e('0x7'),_0xe47e('0x8'),_0xe47e('0x9'),_0xe47e('0xa'),_0xe47e('0xb'),_0xe47e('0xc'),_0xe47e('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xe47e('0x2')]},'md5secret':{'type':Sequelize[_0xe47e('0x2')]},'remotesecret':{'type':Sequelize[_0xe47e('0x2')]},'transport':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':'udp','set':function(_0x152775){this['setDataValue']('transport',_0x152775?_0x152775[_0xe47e('0xe')](','):null);},'get':function(){return this[_0xe47e('0xf')]('transport')?this['getDataValue'](_0xe47e('0x10'))[_0xe47e('0x11')](','):null;},'comment':_0xe47e('0x12')},'dtmfmode':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x13'),_0xe47e('0x14'),_0xe47e('0x15'),'inband',_0xe47e('0x16')),'defaultValue':_0xe47e('0x13')},'directmedia':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no',_0xe47e('0x18'),_0xe47e('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe47e('0x2')]},'directmediadeny':{'type':Sequelize[_0xe47e('0x2')]},'nat':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':_0xe47e('0x1a'),'set':function(_0x26424a){this[_0xe47e('0x1b')]('nat',_0x26424a?_0x26424a[_0xe47e('0xe')](','):null);},'get':function(){return this[_0xe47e('0xf')](_0xe47e('0x1c'))?this['getDataValue'](_0xe47e('0x1c'))[_0xe47e('0x11')](','):null;},'comment':_0xe47e('0x1d')},'callgroup':{'type':Sequelize[_0xe47e('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe47e('0x2')]},'pickupgroup':{'type':Sequelize[_0xe47e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe47e('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xe47e('0x1e')},'allow':{'type':Sequelize[_0xe47e('0x2')],'allowNull':![],'defaultValue':_0xe47e('0x1f'),'set':function(_0x1a22dd){this[_0xe47e('0x1b')](_0xe47e('0x20'),_0x1a22dd?_0x1a22dd['join'](';'):_0xe47e('0x1f'));},'get':function(){return this[_0xe47e('0xf')](_0xe47e('0x20'))?this[_0xe47e('0xf')](_0xe47e('0x20'))[_0xe47e('0x11')](';'):null;},'comment':_0xe47e('0x21')},'autoframing':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xe47e('0x22'),'set':function(_0x280f83){this[_0xe47e('0x1b')]('insecure',_0x280f83?_0x280f83['join'](','):null);},'get':function(){return this[_0xe47e('0xf')]('insecure')?this[_0xe47e('0xf')](_0xe47e('0x23'))[_0xe47e('0x11')](','):null;},'comment':_0xe47e('0x24')},'trustrpid':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no',_0xe47e('0x25'))},'promiscredir':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'accountcode':{'type':Sequelize[_0xe47e('0x26')](0xb)},'setvar':{'type':Sequelize[_0xe47e('0x2')]},'callerid':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':_0xe47e('0x27')},'amaflags':{'type':Sequelize[_0xe47e('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xe47e('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xe47e('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xe47e('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xe47e('0x2')]},'template':{'type':Sequelize[_0xe47e('0x2')]},'videosupport':{'type':Sequelize[_0xe47e('0x3')]('yes','no',_0xe47e('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe47e('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe47e('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xe47e('0x2')]},'session_timers':{'type':Sequelize[_0xe47e('0x3')]('accept','refuse',_0xe47e('0x29'))},'session_expires':{'type':Sequelize[_0xe47e('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xe47e('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x2a'),_0xe47e('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xe47e('0x2')]},'regexten':{'type':Sequelize[_0xe47e('0x2')]},'fromdomain':{'type':Sequelize[_0xe47e('0x2')]},'fromuser':{'type':Sequelize[_0xe47e('0x2')]},'port':{'type':Sequelize[_0xe47e('0x26')](0x5)},'qualify':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xe47e('0x2')]},'defaultuser':{'type':Sequelize[_0xe47e('0x2')]},'rtptimeout':{'type':Sequelize[_0xe47e('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe47e('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe47e('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xe47e('0x3')]('yes','no',_0xe47e('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe47e('0x2')]},'callbackextension':{'type':Sequelize[_0xe47e('0x2')]},'timert1':{'type':Sequelize[_0xe47e('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xe47e('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xe47e('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xe47e('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xe47e('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'force_avp':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'icesupport':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xe47e('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no',_0xe47e('0x2d'),_0xe47e('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xe47e('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xe47e('0x2')]},'dtlscipher':{'type':Sequelize[_0xe47e('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x2f'),_0xe47e('0x30'),_0xe47e('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe47e('0x2')]},'usereqphone':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe47e('0x2')]},'recordofffeature':{'type':Sequelize[_0xe47e('0x2')]},'call_limit':{'type':Sequelize[_0xe47e('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xe47e('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'vmexten':{'type':Sequelize[_0xe47e('0x2')]},'mohinterpret':{'type':Sequelize[_0xe47e('0x2')]},'mohsuggest':{'type':Sequelize[_0xe47e('0x2')]},'parkinglot':{'type':Sequelize[_0xe47e('0x2')]},'description':{'type':Sequelize[_0xe47e('0x2')]},'host':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':_0xe47e('0x32')},'canreinvite':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no',_0xe47e('0x18'),'update',_0xe47e('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe47e('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xe47e('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe47e('0x2')],'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 11fcb60..7d35b6e 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 _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','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','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x1dc929,_0x51b2f9){var _0x4b28d9=function(_0x2b0797){while(--_0x2b0797){_0x1dc929['push'](_0x1dc929['shift']());}};_0x4b28d9(++_0x51b2f9);}(_0xe14d,0x1ee));var _0xde14=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xe14d[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file +var _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x1c9b47,_0x3de6e1){var _0x500213=function(_0x3b0429){while(--_0x3b0429){_0x1c9b47['push'](_0x1c9b47['shift']());}};_0x500213(++_0x3de6e1);}(_0xedd9,0xfc));var _0x9edd=function(_0x85e229,_0x36af95){_0x85e229=_0x85e229-0x0;var _0x440d7c=_0xedd9[_0x85e229];return _0x440d7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 45cf515..daf4b30 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 _0xfafe=['path','../../config/environment','define','lodash','util','moment','bluebird','request-promise'];(function(_0x17c2e8,_0x1ed798){var _0x452f70=function(_0x10da7c){while(--_0x10da7c){_0x17c2e8['push'](_0x17c2e8['shift']());}};_0x452f70(++_0x1ed798);}(_0xfafe,0xdb));var _0xefaf=function(_0x235750,_0x256ddb){_0x235750=_0x235750-0x0;var _0xf5c632=_0xfafe[_0x235750];return _0xf5c632;};'use strict';var _=require(_0xefaf('0x0'));var util=require(_0xefaf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xefaf('0x2'));var BPromise=require(_0xefaf('0x3'));var rp=require(_0xefaf('0x4'));var fs=require('fs');var path=require(_0xefaf('0x5'));var rimraf=require('rimraf');var config=require(_0xefaf('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x28c8a3,_0x5d2601){return _0x28c8a3[_0xefaf('0x7')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8e4=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x38db3a,_0x244702){var _0x2ead95=function(_0x558eab){while(--_0x558eab){_0x38db3a['push'](_0x38db3a['shift']());}};_0x2ead95(++_0x244702);}(_0xe8e4,0x1e1));var _0x4e8e=function(_0x5c73ca,_0x39cd89){_0x5c73ca=_0x5c73ca-0x0;var _0x38d017=_0xe8e4[_0x5c73ca];return _0x38d017;};'use strict';var _=require(_0x4e8e('0x0'));var util=require(_0x4e8e('0x1'));var logger=require(_0x4e8e('0x2'))('api');var moment=require(_0x4e8e('0x3'));var BPromise=require(_0x4e8e('0x4'));var rp=require(_0x4e8e('0x5'));var fs=require('fs');var path=require(_0x4e8e('0x6'));var rimraf=require(_0x4e8e('0x7'));var config=require(_0x4e8e('0x8'));var attributes=require(_0x4e8e('0x9'));module[_0x4e8e('0xa')]=function(_0x42a789,_0x33138f){return _0x42a789[_0x4e8e('0xb')](_0x4e8e('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 532a7ce..77c3de0 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 _0xe0da=['stringify','ShowTrunk','Trunk','find','raw','where','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','code','error','message','result','options','attributes','include','map','model','GetTrunk','debug'];(function(_0x3e7435,_0x4ec46a){var _0x53eadd=function(_0x349ae9){while(--_0x349ae9){_0x3e7435['push'](_0x3e7435['shift']());}};_0x53eadd(++_0x4ec46a);}(_0xe0da,0x16f));var _0xae0d=function(_0x5a4f3f,_0x4f5f71){_0x5a4f3f=_0x5a4f3f-0x0;var _0xc03078=_0xe0da[_0x5a4f3f];return _0xc03078;};'use strict';var _=require('lodash');var util=require(_0xae0d('0x0'));var moment=require(_0xae0d('0x1'));var BPromise=require(_0xae0d('0x2'));var rs=require(_0xae0d('0x3'));var fs=require('fs');var Redis=require(_0xae0d('0x4'));var db=require(_0xae0d('0x5'))['db'];var utils=require(_0xae0d('0x6'));var logger=require(_0xae0d('0x7'))(_0xae0d('0x8'));var config=require(_0xae0d('0x9'));var jayson=require(_0xae0d('0xa'));var client=jayson['client'][_0xae0d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x203e4d,_0x4c3fb8,_0x9a2f1c){return new BPromise(function(_0x22f556,_0x15f976){return client[_0xae0d('0xc')](_0x203e4d,_0x9a2f1c)[_0xae0d('0xd')](function(_0x5d89d1){logger[_0xae0d('0xe')](_0xae0d('0xf'),_0x4c3fb8,_0xae0d('0x10'));logger['debug'](_0xae0d('0x11'),_0x4c3fb8,'request\x20sent',JSON['stringify'](_0x5d89d1));if(_0x5d89d1['error']){if(_0x5d89d1['error'][_0xae0d('0x12')]===0x1f4){logger[_0xae0d('0x13')](_0xae0d('0xf'),_0x4c3fb8,_0x5d89d1['error']['message']);return _0x15f976(_0x5d89d1[_0xae0d('0x13')]['message']);}logger[_0xae0d('0x13')](_0xae0d('0xf'),_0x4c3fb8,_0x5d89d1[_0xae0d('0x13')]['message']);return _0x22f556(_0x5d89d1[_0xae0d('0x13')][_0xae0d('0x14')]);}else{logger[_0xae0d('0xe')]('Trunk,\x20%s,\x20%s',_0x4c3fb8,_0xae0d('0x10'));_0x22f556(_0x5d89d1[_0xae0d('0x15')][_0xae0d('0x14')]);}})['catch'](function(_0x4e47ab){logger[_0xae0d('0x13')](_0xae0d('0xf'),_0x4c3fb8,_0x4e47ab);_0x15f976(_0x4e47ab);});});}exports['GetTrunk']=function(_0xef14ec){var _0x9059a8=this;return new Promise(function(_0x38c51a,_0x352ccc){return db['Trunk']['findAll']({'raw':_0xef14ec['options']?_0xef14ec['options']['raw']===undefined?!![]:![]:!![],'where':_0xef14ec['options']?_0xef14ec[_0xae0d('0x16')]['where']||null:null,'attributes':_0xef14ec[_0xae0d('0x16')]?_0xef14ec[_0xae0d('0x16')][_0xae0d('0x17')]||null:null,'limit':_0xef14ec[_0xae0d('0x16')]?_0xef14ec[_0xae0d('0x16')]['limit']||null:null,'include':_0xef14ec[_0xae0d('0x16')]?_0xef14ec[_0xae0d('0x16')][_0xae0d('0x18')]?_[_0xae0d('0x19')](_0xef14ec[_0xae0d('0x16')][_0xae0d('0x18')],function(_0x547904){return{'model':db[_0x547904[_0xae0d('0x1a')]],'as':_0x547904['as'],'attributes':_0x547904[_0xae0d('0x17')],'include':_0x547904[_0xae0d('0x18')]?_[_0xae0d('0x19')](_0x547904[_0xae0d('0x18')],function(_0x62eb0){return{'model':db[_0x62eb0['model']],'as':_0x62eb0['as'],'attributes':_0x62eb0[_0xae0d('0x17')],'include':_0x62eb0['include']?_[_0xae0d('0x19')](_0x62eb0[_0xae0d('0x18')],function(_0x3cd0dd){return{'model':db[_0x3cd0dd[_0xae0d('0x1a')]],'as':_0x3cd0dd['as'],'attributes':_0x3cd0dd[_0xae0d('0x17')]};}):[]};}):[]};}):[]:[]})[_0xae0d('0xd')](function(_0x47934d){logger[_0xae0d('0xe')](_0xae0d('0x1b'),_0xef14ec);logger[_0xae0d('0x1c')](_0xae0d('0x1b'),_0xef14ec,JSON[_0xae0d('0x1d')](_0x47934d));_0x38c51a(_0x47934d);})['catch'](function(_0x51f5a1){logger[_0xae0d('0x13')](_0xae0d('0x1b'),_0x51f5a1[_0xae0d('0x14')],_0xef14ec);_0x352ccc(_0x9059a8[_0xae0d('0x13')](0x1f4,_0x51f5a1[_0xae0d('0x14')]));});});};exports[_0xae0d('0x1e')]=function(_0x2ff4fb){var _0x397d70=this;return new Promise(function(_0x5dbb50,_0x158e60){return db[_0xae0d('0x1f')][_0xae0d('0x20')]({'raw':_0x2ff4fb[_0xae0d('0x16')]?_0x2ff4fb[_0xae0d('0x16')][_0xae0d('0x21')]===undefined?!![]:![]:!![],'where':_0x2ff4fb[_0xae0d('0x16')]?_0x2ff4fb['options'][_0xae0d('0x22')]||null:null,'attributes':_0x2ff4fb['options']?_0x2ff4fb[_0xae0d('0x16')][_0xae0d('0x17')]||null:null,'include':_0x2ff4fb[_0xae0d('0x16')]?_0x2ff4fb[_0xae0d('0x16')][_0xae0d('0x18')]?_[_0xae0d('0x19')](_0x2ff4fb['options'][_0xae0d('0x18')],function(_0x405f8d){return{'model':db[_0x405f8d[_0xae0d('0x1a')]],'as':_0x405f8d['as'],'attributes':_0x405f8d[_0xae0d('0x17')],'include':_0x405f8d['include']?_[_0xae0d('0x19')](_0x405f8d[_0xae0d('0x18')],function(_0x1f1226){return{'model':db[_0x1f1226[_0xae0d('0x1a')]],'as':_0x1f1226['as'],'attributes':_0x1f1226[_0xae0d('0x17')],'include':_0x1f1226[_0xae0d('0x18')]?_['map'](_0x1f1226[_0xae0d('0x18')],function(_0x1931f5){return{'model':db[_0x1931f5[_0xae0d('0x1a')]],'as':_0x1931f5['as'],'attributes':_0x1931f5[_0xae0d('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cab92){logger[_0xae0d('0xe')](_0xae0d('0x1e'),_0x2ff4fb);logger[_0xae0d('0x1c')](_0xae0d('0x1e'),_0x2ff4fb,JSON[_0xae0d('0x1d')](_0x5cab92));_0x5dbb50(_0x5cab92);})[_0xae0d('0x23')](function(_0x16db32){logger[_0xae0d('0x13')](_0xae0d('0x1e'),_0x16db32[_0xae0d('0x14')],_0x2ff4fb);_0x158e60(_0x397d70['error'](0x1f4,_0x16db32[_0xae0d('0x14')]));});});}; \ No newline at end of file +var _0xde68=['Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','stringify','ShowTrunk','find','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xde68,0x94));var _0x8de6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xde68[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x8de6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8de6('0x1'));var fs=require('fs');var Redis=require(_0x8de6('0x2'));var db=require(_0x8de6('0x3'))['db'];var utils=require(_0x8de6('0x4'));var logger=require('../../config/logger')(_0x8de6('0x5'));var config=require('../../config/environment');var jayson=require(_0x8de6('0x6'));var client=jayson[_0x8de6('0x7')][_0x8de6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11ef32,_0x4f5186,_0x26c356){return new BPromise(function(_0x333612,_0x56c3dc){return client[_0x8de6('0x9')](_0x11ef32,_0x26c356)[_0x8de6('0xa')](function(_0x182717){logger[_0x8de6('0xb')](_0x8de6('0xc'),_0x4f5186,_0x8de6('0xd'));logger[_0x8de6('0xe')](_0x8de6('0xf'),_0x4f5186,_0x8de6('0xd'),JSON['stringify'](_0x182717));if(_0x182717['error']){if(_0x182717['error']['code']===0x1f4){logger[_0x8de6('0x10')]('Trunk,\x20%s,\x20%s',_0x4f5186,_0x182717[_0x8de6('0x10')]['message']);return _0x56c3dc(_0x182717[_0x8de6('0x10')][_0x8de6('0x11')]);}logger[_0x8de6('0x10')]('Trunk,\x20%s,\x20%s',_0x4f5186,_0x182717[_0x8de6('0x10')][_0x8de6('0x11')]);return _0x333612(_0x182717[_0x8de6('0x10')][_0x8de6('0x11')]);}else{logger['info'](_0x8de6('0xc'),_0x4f5186,'request\x20sent');_0x333612(_0x182717['result'][_0x8de6('0x11')]);}})[_0x8de6('0x12')](function(_0x211f08){logger[_0x8de6('0x10')](_0x8de6('0xc'),_0x4f5186,_0x211f08);_0x56c3dc(_0x211f08);});});}exports[_0x8de6('0x13')]=function(_0x1e0774){var _0x201517=this;return new Promise(function(_0x5929bb,_0x388f74){return db[_0x8de6('0x14')]['findAll']({'raw':_0x1e0774['options']?_0x1e0774[_0x8de6('0x15')][_0x8de6('0x16')]===undefined?!![]:![]:!![],'where':_0x1e0774[_0x8de6('0x15')]?_0x1e0774[_0x8de6('0x15')][_0x8de6('0x17')]||null:null,'attributes':_0x1e0774[_0x8de6('0x15')]?_0x1e0774[_0x8de6('0x15')][_0x8de6('0x18')]||null:null,'limit':_0x1e0774[_0x8de6('0x15')]?_0x1e0774['options'][_0x8de6('0x19')]||null:null,'include':_0x1e0774[_0x8de6('0x15')]?_0x1e0774[_0x8de6('0x15')][_0x8de6('0x1a')]?_['map'](_0x1e0774[_0x8de6('0x15')][_0x8de6('0x1a')],function(_0x123c4f){return{'model':db[_0x123c4f[_0x8de6('0x1b')]],'as':_0x123c4f['as'],'attributes':_0x123c4f[_0x8de6('0x18')],'include':_0x123c4f[_0x8de6('0x1a')]?_[_0x8de6('0x1c')](_0x123c4f[_0x8de6('0x1a')],function(_0x3a0387){return{'model':db[_0x3a0387[_0x8de6('0x1b')]],'as':_0x3a0387['as'],'attributes':_0x3a0387[_0x8de6('0x18')],'include':_0x3a0387[_0x8de6('0x1a')]?_[_0x8de6('0x1c')](_0x3a0387['include'],function(_0x381c0c){return{'model':db[_0x381c0c[_0x8de6('0x1b')]],'as':_0x381c0c['as'],'attributes':_0x381c0c[_0x8de6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8de6('0xa')](function(_0x428711){logger['info'](_0x8de6('0x13'),_0x1e0774);logger[_0x8de6('0xe')](_0x8de6('0x13'),_0x1e0774,JSON[_0x8de6('0x1d')](_0x428711));_0x5929bb(_0x428711);})['catch'](function(_0x277218){logger[_0x8de6('0x10')]('GetTrunk',_0x277218[_0x8de6('0x11')],_0x1e0774);_0x388f74(_0x201517[_0x8de6('0x10')](0x1f4,_0x277218['message']));});});};exports[_0x8de6('0x1e')]=function(_0x167b7c){var _0xba9801=this;return new Promise(function(_0x550729,_0x32c4ac){return db[_0x8de6('0x14')][_0x8de6('0x1f')]({'raw':_0x167b7c['options']?_0x167b7c['options'][_0x8de6('0x16')]===undefined?!![]:![]:!![],'where':_0x167b7c[_0x8de6('0x15')]?_0x167b7c[_0x8de6('0x15')][_0x8de6('0x17')]||null:null,'attributes':_0x167b7c['options']?_0x167b7c[_0x8de6('0x15')]['attributes']||null:null,'include':_0x167b7c[_0x8de6('0x15')]?_0x167b7c[_0x8de6('0x15')]['include']?_[_0x8de6('0x1c')](_0x167b7c[_0x8de6('0x15')]['include'],function(_0x23efc5){return{'model':db[_0x23efc5[_0x8de6('0x1b')]],'as':_0x23efc5['as'],'attributes':_0x23efc5['attributes'],'include':_0x23efc5[_0x8de6('0x1a')]?_['map'](_0x23efc5[_0x8de6('0x1a')],function(_0xbabf99){return{'model':db[_0xbabf99[_0x8de6('0x1b')]],'as':_0xbabf99['as'],'attributes':_0xbabf99['attributes'],'include':_0xbabf99['include']?_[_0x8de6('0x1c')](_0xbabf99[_0x8de6('0x1a')],function(_0x2c7808){return{'model':db[_0x2c7808['model']],'as':_0x2c7808['as'],'attributes':_0x2c7808['attributes']};}):[]};}):[]};}):[]:[]})[_0x8de6('0xa')](function(_0x17de34){logger[_0x8de6('0xb')](_0x8de6('0x1e'),_0x167b7c);logger[_0x8de6('0xe')](_0x8de6('0x1e'),_0x167b7c,JSON[_0x8de6('0x1d')](_0x17de34));_0x550729(_0x17de34);})['catch'](function(_0x5bb0ae){logger[_0x8de6('0x10')](_0x8de6('0x1e'),_0x5bb0ae[_0x8de6('0x11')],_0x167b7c);_0x32c4ac(_0xba9801[_0x8de6('0x10')](0x1f4,_0x5bb0ae[_0x8de6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 03c5986..d02cdee 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 _0xcd1e=['/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','addQueues','join','server/files/images/','format','%s-%s','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts'];(function(_0x485c3c,_0x5041c5){var _0x3a599d=function(_0x468fa1){while(--_0x468fa1){_0x485c3c['push'](_0x485c3c['shift']());}};_0x3a599d(++_0x5041c5);}(_0xcd1e,0x19f));var _0xecd1=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcd1e[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0xecd1('0x0'));var path=require(_0xecd1('0x1'));var timeout=require('connect-timeout');var express=require(_0xecd1('0x2'));var router=express['Router']();var fs_extra=require(_0xecd1('0x3'));var auth=require(_0xecd1('0x4'));var interaction=require(_0xecd1('0x5'));var config=require(_0xecd1('0x6'));var controller=require(_0xecd1('0x7'));router[_0xecd1('0x8')]('/',auth[_0xecd1('0x9')](),controller[_0xecd1('0xa')]);router['get'](_0xecd1('0xb'),auth[_0xecd1('0x9')](),controller['describe']);router['get']('/whoami',auth[_0xecd1('0x9')](),controller[_0xecd1('0xc')]);router['get'](_0xecd1('0xd'),auth['isAuthenticated'](),controller[_0xecd1('0xe')]);router['get'](_0xecd1('0xf'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x10')]);router[_0xecd1('0x8')](_0xecd1('0x11'),controller['getAvatar']);router[_0xecd1('0x8')](_0xecd1('0x12'),auth[_0xecd1('0x9')](),controller['getOpenTabs']);router[_0xecd1('0x8')]('/:id/contacts',auth[_0xecd1('0x9')](),controller['getContacts']);router[_0xecd1('0x8')](_0xecd1('0x13'),auth['isAuthenticated'](),controller[_0xecd1('0x14')]);router[_0xecd1('0x8')](_0xecd1('0x15'),auth['isAuthenticated'](),controller[_0xecd1('0x16')]);router[_0xecd1('0x8')](_0xecd1('0x17'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x18')]);router[_0xecd1('0x8')](_0xecd1('0x19'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x1a')]);router[_0xecd1('0x8')](_0xecd1('0x1b'),auth[_0xecd1('0x9')](),controller['getScreenRecordings']);router[_0xecd1('0x8')](_0xecd1('0x1c'),auth['isAuthenticated'](),controller[_0xecd1('0x1d')]);router['get'](_0xecd1('0x1e'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x1f')]);router[_0xecd1('0x8')]('/:id/mail/interactions',auth[_0xecd1('0x9')](),controller[_0xecd1('0x20')]);router[_0xecd1('0x8')]('/:id/sms/interactions',auth[_0xecd1('0x9')](),controller['getSmsInteractions']);router[_0xecd1('0x8')](_0xecd1('0x21'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x22')]);router[_0xecd1('0x8')]('/:id/whatsapp/interactions',auth[_0xecd1('0x9')](),controller[_0xecd1('0x23')]);router[_0xecd1('0x8')](_0xecd1('0x24'),auth['isAuthenticated'](),controller[_0xecd1('0x25')]);router[_0xecd1('0x8')](_0xecd1('0x26'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x27')]);router[_0xecd1('0x8')](_0xecd1('0x28'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x29')]);router[_0xecd1('0x8')](_0xecd1('0x2a'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x2b')]);router[_0xecd1('0x8')]('/:id/fax_accounts',auth[_0xecd1('0x9')](),controller[_0xecd1('0x2c')]);router[_0xecd1('0x8')](_0xecd1('0x2d'),auth['isAuthenticated'](),controller[_0xecd1('0x2e')]);router[_0xecd1('0x8')]('/:id/openchannel_accounts',auth[_0xecd1('0x9')](),controller[_0xecd1('0x2f')]);router[_0xecd1('0x8')](_0xecd1('0x30'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x31')]);router[_0xecd1('0x8')](_0xecd1('0x32'),auth['isAuthenticated'](),controller[_0xecd1('0x33')]);router[_0xecd1('0x8')](_0xecd1('0x34'),auth[_0xecd1('0x9')](),controller['getWhatsappAccounts']);router[_0xecd1('0x8')](_0xecd1('0x35'),auth[_0xecd1('0x9')](),controller['getSquareProjects']);router[_0xecd1('0x8')](_0xecd1('0x36'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x37')]);router[_0xecd1('0x8')](_0xecd1('0x38'),auth[_0xecd1('0x9')](),controller['getApiKey']);router[_0xecd1('0x39')](_0xecd1('0x3a'),auth['isAuthenticated'](),controller[_0xecd1('0x3b')]);router[_0xecd1('0x39')]('/',auth[_0xecd1('0x9')](),controller[_0xecd1('0x3c')]);router[_0xecd1('0x39')](_0xecd1('0x3d'),auth['isAuthenticated'](),controller[_0xecd1('0x3e')]);router[_0xecd1('0x39')]('/:id/queues',auth[_0xecd1('0x9')](),controller[_0xecd1('0x3f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x43a858,_0x5506cb,_0x512747){_0x512747(null,path[_0xecd1('0x40')](config['root'],_0xecd1('0x41')));},'filename':function(_0x677989,_0x265438,_0x211942){_0x211942(null,util[_0xecd1('0x42')](_0xecd1('0x43'),Date['now'](),_0x265438[_0xecd1('0x44')]));}})});router[_0xecd1('0x39')](_0xecd1('0x11'),upload['single'](_0xecd1('0x45')),controller[_0xecd1('0x46')]);router[_0xecd1('0x39')](_0xecd1('0x47'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x48')]);router[_0xecd1('0x39')](_0xecd1('0x49'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x4a')]);router['post'](_0xecd1('0x4b'),auth[_0xecd1('0x9')](),controller['pause']);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0xecd1('0x4c')]);router['post'](_0xecd1('0x24'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x4d')]);router['post'](_0xecd1('0x4e'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x4f')]);router[_0xecd1('0x39')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xecd1('0x50')]);router[_0xecd1('0x39')](_0xecd1('0x51'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x52')]);router['post']('/:id/sms_interactions',auth[_0xecd1('0x9')](),controller[_0xecd1('0x53')]);router[_0xecd1('0x39')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xecd1('0x39')](_0xecd1('0x54'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x55')]);router[_0xecd1('0x39')]('/:id/fax_accounts',auth[_0xecd1('0x9')](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth[_0xecd1('0x9')](),controller[_0xecd1('0x56')]);router['post'](_0xecd1('0x57'),auth['isAuthenticated'](),controller[_0xecd1('0x58')]);router[_0xecd1('0x39')](_0xecd1('0x30'),auth['isAuthenticated'](),controller[_0xecd1('0x59')]);router[_0xecd1('0x39')](_0xecd1('0x32'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x5a')]);router[_0xecd1('0x39')](_0xecd1('0x34'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x5b')]);router[_0xecd1('0x39')]('/:id/square_projects',auth['isAuthenticated'](),controller['addSquareProjects']);router[_0xecd1('0x39')]('/:id/api_key',auth[_0xecd1('0x9')](),controller[_0xecd1('0x5c')]);router[_0xecd1('0x5d')]('/:id',auth[_0xecd1('0x9')](),controller['update']);router['put'](_0xecd1('0x5e'),auth['isAuthenticated'](),controller[_0xecd1('0x5f')]);router[_0xecd1('0x60')](_0xecd1('0x13'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x61')]);router[_0xecd1('0x60')](_0xecd1('0x24'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x62')]);router['delete'](_0xecd1('0xf'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x63')]);router[_0xecd1('0x60')](_0xecd1('0x4e'),auth['isAuthenticated'](),controller[_0xecd1('0x64')]);router[_0xecd1('0x60')](_0xecd1('0x65'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x66')]);router[_0xecd1('0x60')](_0xecd1('0x51'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x67')]);router[_0xecd1('0x60')]('/:id/sms_interactions',auth[_0xecd1('0x9')](),controller[_0xecd1('0x68')]);router['delete'](_0xecd1('0x69'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x6a')]);router[_0xecd1('0x60')](_0xecd1('0x54'),auth['isAuthenticated'](),controller[_0xecd1('0x6b')]);router[_0xecd1('0x60')](_0xecd1('0x6c'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0xecd1('0x2d'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x6d')]);router['delete']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xecd1('0x6e')]);router[_0xecd1('0x60')]('/:id/sms_accounts',auth[_0xecd1('0x9')](),controller[_0xecd1('0x6f')]);router[_0xecd1('0x60')]('/:id/chat_websites',auth[_0xecd1('0x9')](),controller[_0xecd1('0x70')]);router['delete'](_0xecd1('0x34'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x71')]);router[_0xecd1('0x60')](_0xecd1('0x35'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x72')]);router[_0xecd1('0x60')](_0xecd1('0x38'),auth[_0xecd1('0x9')](),controller[_0xecd1('0x73')]);module[_0xecd1('0x74')]=router; \ No newline at end of file +var _0xe136=['/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addSquareProjects','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','/:id','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions'];(function(_0x4b2478,_0x585c05){var _0x44a043=function(_0x34faa2){while(--_0x34faa2){_0x4b2478['push'](_0x4b2478['shift']());}};_0x44a043(++_0x585c05);}(_0xe136,0x96));var _0x6e13=function(_0xc1ed4b,_0x5ea4fc){_0xc1ed4b=_0xc1ed4b-0x0;var _0x49a6db=_0xe136[_0xc1ed4b];return _0x49a6db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6e13('0x0'));var timeout=require(_0x6e13('0x1'));var express=require(_0x6e13('0x2'));var router=express[_0x6e13('0x3')]();var fs_extra=require(_0x6e13('0x4'));var auth=require(_0x6e13('0x5'));var interaction=require(_0x6e13('0x6'));var config=require(_0x6e13('0x7'));var controller=require(_0x6e13('0x8'));router[_0x6e13('0x9')]('/',auth[_0x6e13('0xa')](),controller[_0x6e13('0xb')]);router[_0x6e13('0x9')](_0x6e13('0xc'),auth[_0x6e13('0xa')](),controller[_0x6e13('0xd')]);router[_0x6e13('0x9')](_0x6e13('0xe'),auth['isAuthenticated'](),controller['whoami']);router[_0x6e13('0x9')](_0x6e13('0xf'),auth[_0x6e13('0xa')](),controller['getPresence']);router[_0x6e13('0x9')](_0x6e13('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x6e13('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x6e13('0x9')](_0x6e13('0x11'),auth[_0x6e13('0xa')](),controller['getOpenTabs']);router['get'](_0x6e13('0x12'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x13')]);router['get'](_0x6e13('0x14'),auth[_0x6e13('0xa')](),controller['getQueues']);router[_0x6e13('0x9')](_0x6e13('0x15'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x16')]);router['get'](_0x6e13('0x17'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x18')]);router[_0x6e13('0x9')](_0x6e13('0x19'),auth['isAuthenticated'](),controller[_0x6e13('0x1a')]);router[_0x6e13('0x9')](_0x6e13('0x1b'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x1c')]);router[_0x6e13('0x9')](_0x6e13('0x1d'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x6e13('0x9')](_0x6e13('0x1e'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x1f')]);router[_0x6e13('0x9')](_0x6e13('0x20'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x21')]);router[_0x6e13('0x9')](_0x6e13('0x22'),auth['isAuthenticated'](),controller[_0x6e13('0x23')]);router['get'](_0x6e13('0x24'),auth[_0x6e13('0xa')](),controller['getFaxInteractions']);router[_0x6e13('0x9')](_0x6e13('0x25'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x26')]);router['get'](_0x6e13('0x27'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x28')]);router['get'](_0x6e13('0x29'),auth['isAuthenticated'](),controller[_0x6e13('0x2a')]);router[_0x6e13('0x9')](_0x6e13('0x2b'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x2c')]);router[_0x6e13('0x9')]('/:id/prefixes',auth[_0x6e13('0xa')](),controller[_0x6e13('0x2d')]);router['get'](_0x6e13('0x2e'),auth[_0x6e13('0xa')](),controller['getFaxAccounts']);router[_0x6e13('0x9')](_0x6e13('0x2f'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x30')]);router[_0x6e13('0x9')](_0x6e13('0x31'),auth['isAuthenticated'](),controller[_0x6e13('0x32')]);router['get'](_0x6e13('0x33'),auth[_0x6e13('0xa')](),controller['getSmsAccounts']);router['get']('/:id/chat_websites',auth[_0x6e13('0xa')](),controller[_0x6e13('0x34')]);router[_0x6e13('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x6e13('0x35')]);router[_0x6e13('0x9')](_0x6e13('0x36'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x37')]);router[_0x6e13('0x9')](_0x6e13('0x38'),auth['isAuthenticated'](),controller[_0x6e13('0x39')]);router[_0x6e13('0x9')](_0x6e13('0x3a'),auth['isAuthenticated'](),controller[_0x6e13('0x3b')]);router[_0x6e13('0x3c')](_0x6e13('0x12'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x3d')]);router[_0x6e13('0x3c')]('/',auth[_0x6e13('0xa')](),controller[_0x6e13('0x3e')]);router[_0x6e13('0x3c')]('/create_many',auth['isAuthenticated'](),controller[_0x6e13('0x3f')]);router[_0x6e13('0x3c')](_0x6e13('0x14'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x40')]);var upload=multer({'storage':multer[_0x6e13('0x41')]({'destination':function(_0x25248c,_0x472cc8,_0xbf86c6){_0xbf86c6(null,path[_0x6e13('0x42')](config[_0x6e13('0x43')],_0x6e13('0x44')));},'filename':function(_0x764538,_0x1d9779,_0x180fc9){_0x180fc9(null,util[_0x6e13('0x45')](_0x6e13('0x46'),Date[_0x6e13('0x47')](),_0x1d9779[_0x6e13('0x48')]));}})});router['post'](_0x6e13('0x49'),upload[_0x6e13('0x4a')](_0x6e13('0x4b')),controller[_0x6e13('0x4c')]);router[_0x6e13('0x3c')]('/:id/login',auth['isAuthenticated'](),controller[_0x6e13('0x4d')]);router['post'](_0x6e13('0x4e'),auth['isAuthenticated'](),controller[_0x6e13('0x4f')]);router[_0x6e13('0x3c')](_0x6e13('0x50'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x51')]);router['post'](_0x6e13('0x52'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x53')]);router[_0x6e13('0x3c')]('/:id/teams',auth[_0x6e13('0xa')](),controller[_0x6e13('0x54')]);router[_0x6e13('0x3c')](_0x6e13('0x55'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x56')]);router[_0x6e13('0x3c')](_0x6e13('0x57'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x58')]);router[_0x6e13('0x3c')](_0x6e13('0x59'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post'](_0x6e13('0x5a'),auth[_0x6e13('0xa')](),controller['addSmsInteractions']);router[_0x6e13('0x3c')](_0x6e13('0x5b'),auth['isAuthenticated'](),controller[_0x6e13('0x5c')]);router[_0x6e13('0x3c')](_0x6e13('0x5d'),auth[_0x6e13('0xa')](),controller['addWhatsappInteractions']);router[_0x6e13('0x3c')]('/:id/fax_accounts',auth[_0x6e13('0xa')](),controller[_0x6e13('0x5e')]);router[_0x6e13('0x3c')](_0x6e13('0x2f'),auth[_0x6e13('0xa')](),controller['addMailAccounts']);router[_0x6e13('0x3c')](_0x6e13('0x31'),auth[_0x6e13('0xa')](),controller['addOpenchannelAccounts']);router['post'](_0x6e13('0x33'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x5f')]);router[_0x6e13('0x3c')](_0x6e13('0x60'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x61')]);router[_0x6e13('0x3c')](_0x6e13('0x62'),auth[_0x6e13('0xa')](),controller['addWhatsappAccounts']);router[_0x6e13('0x3c')](_0x6e13('0x36'),auth['isAuthenticated'](),controller[_0x6e13('0x63')]);router[_0x6e13('0x3c')](_0x6e13('0x3a'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x64')]);router['put'](_0x6e13('0x10'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x65')]);router[_0x6e13('0x66')](_0x6e13('0x67'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x68')]);router[_0x6e13('0x69')]('/:id/queues',auth[_0x6e13('0xa')](),controller[_0x6e13('0x6a')]);router['delete']('/:id/teams',auth[_0x6e13('0xa')](),controller[_0x6e13('0x6b')]);router[_0x6e13('0x69')](_0x6e13('0x10'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x6c')]);router[_0x6e13('0x69')]('/:id/chat_interactions',auth[_0x6e13('0xa')](),controller[_0x6e13('0x6d')]);router[_0x6e13('0x69')](_0x6e13('0x57'),auth[_0x6e13('0xa')](),controller['removeMailInteractions']);router['delete'](_0x6e13('0x59'),auth[_0x6e13('0xa')](),controller['removeFaxInteractions']);router[_0x6e13('0x69')](_0x6e13('0x5a'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x6e')]);router[_0x6e13('0x69')](_0x6e13('0x5b'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x6f')]);router[_0x6e13('0x69')]('/:id/whatsapp_interactions',auth[_0x6e13('0xa')](),controller[_0x6e13('0x70')]);router[_0x6e13('0x69')]('/:id/fax_accounts',auth[_0x6e13('0xa')](),controller[_0x6e13('0x71')]);router['delete']('/:id/mail_accounts',auth[_0x6e13('0xa')](),controller['removeMailAccounts']);router['delete'](_0x6e13('0x31'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x72')]);router[_0x6e13('0x69')](_0x6e13('0x33'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x73')]);router[_0x6e13('0x69')](_0x6e13('0x60'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x74')]);router['delete'](_0x6e13('0x62'),auth['isAuthenticated'](),controller[_0x6e13('0x75')]);router[_0x6e13('0x69')](_0x6e13('0x36'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x76')]);router[_0x6e13('0x69')](_0x6e13('0x3a'),auth['isAuthenticated'](),controller[_0x6e13('0x77')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index e7702ff..7c455c4 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 _0x56dc=['dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','defaultuser','The\x20name\x20of\x20the\x20user','setDataValue','fullname','callerid','format','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','passive','nonat','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup'];(function(_0x4ea728,_0x3ba8a8){var _0x290764=function(_0x35f0e0){while(--_0x35f0e0){_0x4ea728['push'](_0x4ea728['shift']());}};_0x290764(++_0x3ba8a8);}(_0x56dc,0x188));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc56d('0x0'));var moment=require(_0xc56d('0x1'));var util=require(_0xc56d('0x2'));var _=require('lodash');module[_0xc56d('0x3')]={'name':{'type':Sequelize[_0xc56d('0x4')],'allowNull':![],'unique':_0xc56d('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x96a65d){this['setDataValue'](_0xc56d('0x5'),_0x96a65d);this['setDataValue'](_0xc56d('0x6'),_0x96a65d);},'comment':_0xc56d('0x7')},'fullname':{'type':Sequelize[_0xc56d('0x4')],'allowNull':![],'set':function(_0x519b24){this[_0xc56d('0x8')](_0xc56d('0x9'),_0x519b24);this['setDataValue'](_0xc56d('0xa'),util[_0xc56d('0xb')]('\x22%s\x22\x20<%s>',_0x519b24,this['getDataValue'](_0xc56d('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc56d('0x4')],'allowNull':![],'unique':_0xc56d('0xd'),'validate':{'isEmail':!![]},'set':function(_0x3c3d3a){if(_0x3c3d3a){this[_0xc56d('0x8')]('email',_0x3c3d3a[_0xc56d('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0xc56d('0xf'),_0xc56d('0x10'),_0xc56d('0x11'),_0xc56d('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc56d('0x4')],'defaultValue':_0xc56d('0x13')},'internal':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':![],'unique':_0xc56d('0xc'),'set':function(_0x3bf589){this[_0xc56d('0x8')](_0xc56d('0xc'),_0x3bf589);this['setDataValue']('accountcode',_0x3bf589);this[_0xc56d('0x8')](_0xc56d('0xa'),util[_0xc56d('0xb')](_0xc56d('0x15'),this[_0xc56d('0x16')](_0xc56d('0x9')),_0x3bf589));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc56d('0x4')]},'mobile':{'type':Sequelize[_0xc56d('0x4')]},'address':{'type':Sequelize[_0xc56d('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xc56d('0x4')]},'city':{'type':Sequelize[_0xc56d('0x4')]},'country':{'type':Sequelize[_0xc56d('0x4')]},'online':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc56d('0x18')]},'voicePause':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc56d('0x4')],'defaultValue':_0xc56d('0x19')},'lastPauseAt':{'type':Sequelize[_0xc56d('0x18')]},'chatCapacity':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc56d('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc56d('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![],'defaultValue':_0xc56d('0x1a')},'ipaddr':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x1c'),'user',_0xc56d('0x1d')),'allowNull':!![],'defaultValue':_0xc56d('0x1c')},'context':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![],'defaultValue':_0xc56d('0x1e')},'callingpres':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x1f'),_0xc56d('0x20'),_0xc56d('0x21'),_0xc56d('0x22'),'PROHIB_NOT_SCREENED',_0xc56d('0x23'),_0xc56d('0x24'),_0xc56d('0x25')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc56d('0x26'),'set':function(_0x53b0b6){this[_0xc56d('0x8')](_0xc56d('0x27'),_0x53b0b6?_0x53b0b6[_0xc56d('0x28')](','):null);},'get':function(){return this[_0xc56d('0x16')](_0xc56d('0x27'))?this['getDataValue'](_0xc56d('0x27'))[_0xc56d('0x29')](','):null;},'comment':_0xc56d('0x2a')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xc56d('0x2b'),_0xc56d('0x2c'),_0xc56d('0x2d'),_0xc56d('0x2e')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no','nonat',_0xc56d('0x30'),_0xc56d('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![],'defaultValue':_0xc56d('0x32'),'set':function(_0x3daef7){this[_0xc56d('0x8')](_0xc56d('0x33'),_0x3daef7?_0x3daef7[_0xc56d('0x28')](','):null);},'get':function(){return this['getDataValue'](_0xc56d('0x33'))?this[_0xc56d('0x16')](_0xc56d('0x33'))[_0xc56d('0x29')](','):null;},'comment':_0xc56d('0x34')},'callgroup':{'type':Sequelize[_0xc56d('0x4')]},'namedcallgroup':{'type':Sequelize[_0xc56d('0x4')]},'pickupgroup':{'type':Sequelize[_0xc56d('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xc56d('0x4')]},'language':{'type':Sequelize[_0xc56d('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc56d('0x4')]},'disallow':{'type':Sequelize[_0xc56d('0x4')],'allowNull':![],'defaultValue':_0xc56d('0x35')},'allow':{'type':Sequelize[_0xc56d('0x4')],'allowNull':![],'defaultValue':_0xc56d('0x36'),'set':function(_0x11ab37){this['setDataValue'](_0xc56d('0x37'),_0x11ab37?_0x11ab37[_0xc56d('0x28')](';'):_0xc56d('0x36'));},'get':function(){return this[_0xc56d('0x16')]('allow')?this['getDataValue'](_0xc56d('0x37'))[_0xc56d('0x29')](';'):null;},'comment':_0xc56d('0x38')},'autoframing':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![],'set':function(_0x2e31cb){this[_0xc56d('0x8')]('insecure',_0x2e31cb?_0x2e31cb[_0xc56d('0x28')](','):null);},'get':function(){return this[_0xc56d('0x16')](_0xc56d('0x39'))?this[_0xc56d('0x16')](_0xc56d('0x39'))[_0xc56d('0x29')](','):null;},'comment':_0xc56d('0x3a')},'trustrpid':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc56d('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no',_0xc56d('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![],'defaultValue':_0xc56d('0x3c')},'amaflags':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc56d('0x1b')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no',_0xc56d('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc56d('0x1b')]('accept',_0xc56d('0x3e'),_0xc56d('0x3f')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x40'),_0xc56d('0x41')),'allowNull':!![],'defaultValue':_0xc56d('0x41')},'t38pt_usertpsource':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![],'defaultValue':_0xc56d('0x2f')},'keepalive':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xc56d('0x42'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc56d('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc56d('0x1b')](_0xc56d('0x2f'),'no',_0xc56d('0x43'),_0xc56d('0x30'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc56d('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xc56d('0x18')]},'passwordResetAt':{'type':Sequelize[_0xc56d('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc56d('0x44')]},'showWebBar':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x0,'set':function(_0x3b6ff0){this[_0xc56d('0x8')](_0xc56d('0x45'),_0x3b6ff0);var _0x3a43af=this[_0xc56d('0x46')]({'plain':!![]});switch(_0x3b6ff0){case 0x0:case 0x1:var _0x4ce81a=_0x3a43af[_0xc56d('0x27')]?_[_0xc56d('0x47')](_0x3a43af[_0xc56d('0x27')])?_0x3a43af[_0xc56d('0x27')]['join']():_0x3a43af[_0xc56d('0x27')]:_0xc56d('0x26');if(_0x4ce81a===_0xc56d('0x48')){_0x4ce81a=_0xc56d('0x26');}this[_0xc56d('0x8')]('transport',_0x4ce81a);this['setDataValue']('encryption','no');this[_0xc56d('0x8')](_0xc56d('0x49'),null);this[_0xc56d('0x8')](_0xc56d('0x4a'),null);this[_0xc56d('0x8')]('icesupport',null);this[_0xc56d('0x8')](_0xc56d('0x4b'),null);this[_0xc56d('0x8')](_0xc56d('0x4c'),null);this['setDataValue'](_0xc56d('0x4d'),null);this[_0xc56d('0x8')](_0xc56d('0x4e'),null);this[_0xc56d('0x8')](_0xc56d('0x4f'),null);this[_0xc56d('0x8')](_0xc56d('0x50'),'no');break;case 0x2:this[_0xc56d('0x8')]('transport',_0xc56d('0x48'));this[_0xc56d('0x8')]('encryption',_0xc56d('0x2f'));this['setDataValue']('avpf',_0xc56d('0x2f'));this['setDataValue']('force_avp',_0xc56d('0x2f'));this[_0xc56d('0x8')](_0xc56d('0x51'),'yes');this[_0xc56d('0x8')](_0xc56d('0x4b'),_0xc56d('0x2f'));this['setDataValue']('dtlsverify','no');this[_0xc56d('0x8')](_0xc56d('0x4d'),_0xc56d('0x52'));this[_0xc56d('0x8')](_0xc56d('0x4e'),_0x3a43af[_0xc56d('0x4e')]||_0xc56d('0x53'));this[_0xc56d('0x8')]('dtlsprivatekey',_0x3a43af[_0xc56d('0x4f')]||_0xc56d('0x54'));this[_0xc56d('0x8')](_0xc56d('0x50'),_0xc56d('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0xc56d('0x44')],'set':function(_0x226bce){this[_0xc56d('0x8')]('permissions',_0x226bce?_0x226bce[_0xc56d('0x28')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this['getDataValue'](_0xc56d('0x55'))[_0xc56d('0x29')](','),function(_0xc207f4){return parseInt(_0xc207f4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc56d('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc56d('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xc56d('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xc56d('0x56'))?this[_0xc56d('0x16')](_0xc56d('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xc56d('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc56d('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![],'set':function(_0x54f754){if(typeof _0x54f754===_0xc56d('0x57')){var _0x2f9813=_0x54f754==='1'?!![]:_0x54f754==='0'?![]:_0x54f754===_0xc56d('0x58')?!![]:_0x54f754==='false'?![]:![];this[_0xc56d('0x8')](_0xc56d('0x59'),_0x2f9813);}else{this[_0xc56d('0x8')](_0xc56d('0x59'),_0x54f754);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1bf022){this[_0xc56d('0x8')](_0xc56d('0x5a'),_0x1bf022);if(_0x1bf022===!![]){this['setDataValue'](_0xc56d('0x5b'),moment());this[_0xc56d('0x8')](_0xc56d('0x5c'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xc56d('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc56d('0x14')](0x5)[_0xc56d('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xc56d('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0245=['force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','actpass','TEXT','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','wss','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','email','toLowerCase','ENUM','agent','telephone','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','INTEGER','dynamic','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing'];(function(_0xeb4208,_0x26c08c){var _0x317fc8=function(_0x36e15e){while(--_0x36e15e){_0xeb4208['push'](_0xeb4208['shift']());}};_0x317fc8(++_0x26c08c);}(_0x0245,0x14a));var _0x5024=function(_0x38f705,_0x7ad8e){_0x38f705=_0x38f705-0x0;var _0x4d512b=_0x0245[_0x38f705];return _0x4d512b;};'use strict';var Sequelize=require(_0x5024('0x0'));var moment=require(_0x5024('0x1'));var util=require(_0x5024('0x2'));var _=require(_0x5024('0x3'));module[_0x5024('0x4')]={'name':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2a51d0){this[_0x5024('0x6')](_0x5024('0x7'),_0x2a51d0);this[_0x5024('0x6')](_0x5024('0x8'),_0x2a51d0);},'comment':_0x5024('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x39c896){this[_0x5024('0x6')](_0x5024('0xa'),_0x39c896);this[_0x5024('0x6')](_0x5024('0xb'),util[_0x5024('0xc')]('\x22%s\x22\x20<%s>',_0x39c896,this['getDataValue'](_0x5024('0xd'))));}},'alias':{'type':Sequelize[_0x5024('0x5')]},'email':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3dd588){if(_0x3dd588){this[_0x5024('0x6')](_0x5024('0xe'),_0x3dd588[_0x5024('0xf')]());}}},'role':{'type':Sequelize[_0x5024('0x10')]('admin','user',_0x5024('0x11'),_0x5024('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5024('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x5024('0xd'),'set':function(_0x3179aa){this[_0x5024('0x6')]('internal',_0x3179aa);this[_0x5024('0x6')]('accountcode',_0x3179aa);this[_0x5024('0x6')](_0x5024('0xb'),util['format'](_0x5024('0x13'),this[_0x5024('0x14')]('fullname'),_0x3179aa));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5024('0x5')]},'mobile':{'type':Sequelize[_0x5024('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x5024('0x5')]},'userpic':{'type':Sequelize[_0x5024('0x5')]},'city':{'type':Sequelize[_0x5024('0x5')]},'country':{'type':Sequelize[_0x5024('0x5')]},'online':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x5024('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5024('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x5024('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5024('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5024('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'defaultValue':_0x5024('0x18')},'ipaddr':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x5024('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x5024('0x19'),_0x5024('0x1a'),_0x5024('0x1b')),'allowNull':!![],'defaultValue':_0x5024('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x1c'),_0x5024('0x1d'),_0x5024('0x1e'),_0x5024('0x1f'),_0x5024('0x20'),_0x5024('0x21'),_0x5024('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'defaultValue':_0x5024('0x23'),'set':function(_0x109fc8){this['setDataValue']('transport',_0x109fc8?_0x109fc8['join'](','):null);},'get':function(){return this[_0x5024('0x14')](_0x5024('0x24'))?this[_0x5024('0x14')]('transport')['split'](','):null;},'comment':_0x5024('0x25')},'dtmfmode':{'type':Sequelize[_0x5024('0x10')]('rfc2833','info',_0x5024('0x26'),_0x5024('0x27'),_0x5024('0x28')),'allowNull':!![],'defaultValue':_0x5024('0x29')},'directmedia':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no',_0x5024('0x2b'),_0x5024('0x2c'),_0x5024('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'defaultValue':_0x5024('0x2e'),'set':function(_0x66bfe4){this['setDataValue'](_0x5024('0x2f'),_0x66bfe4?_0x66bfe4[_0x5024('0x30')](','):null);},'get':function(){return this[_0x5024('0x14')](_0x5024('0x2f'))?this[_0x5024('0x14')](_0x5024('0x2f'))[_0x5024('0x31')](','):null;},'comment':_0x5024('0x32')},'callgroup':{'type':Sequelize[_0x5024('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5024('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x5024('0x5')]},'language':{'type':Sequelize[_0x5024('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'defaultValue':_0x5024('0x33')},'allow':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'defaultValue':_0x5024('0x34'),'set':function(_0x4f377e){this[_0x5024('0x6')](_0x5024('0x35'),_0x4f377e?_0x4f377e['join'](';'):_0x5024('0x34'));},'get':function(){return this[_0x5024('0x14')](_0x5024('0x35'))?this[_0x5024('0x14')]('allow')['split'](';'):null;},'comment':_0x5024('0x36')},'autoframing':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'set':function(_0x423d17){this['setDataValue'](_0x5024('0x37'),_0x423d17?_0x423d17[_0x5024('0x30')](','):null);},'get':function(){return this[_0x5024('0x14')](_0x5024('0x37'))?this[_0x5024('0x14')](_0x5024('0x37'))[_0x5024('0x31')](','):null;},'comment':_0x5024('0x38')},'trustrpid':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5024('0x10')]('yes','no',_0x5024('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'defaultValue':_0x5024('0x3a')},'amaflags':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x5024('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x5024('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no',_0x5024('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x3c'),_0x5024('0x3d'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x3e'),_0x5024('0x3f')),'allowNull':!![],'defaultValue':_0x5024('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x5024('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x5024('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no',_0x5024('0x40'),_0x5024('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x5024('0x42'),'passive',_0x5024('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x5024('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x5024('0x2a'),'no',_0x5024('0x2b'),_0x5024('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5024('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x5024('0x16')]},'passwordResetAt':{'type':Sequelize[_0x5024('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5024('0x44')]},'showWebBar':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0,'set':function(_0xfa86d5){this['setDataValue'](_0x5024('0x45'),_0xfa86d5);var _0x58d18c=this[_0x5024('0x46')]({'plain':!![]});switch(_0xfa86d5){case 0x0:case 0x1:var _0x526d38=_0x58d18c[_0x5024('0x24')]?_[_0x5024('0x47')](_0x58d18c[_0x5024('0x24')])?_0x58d18c[_0x5024('0x24')]['join']():_0x58d18c[_0x5024('0x24')]:_0x5024('0x23');if(_0x526d38==='wss'){_0x526d38=_0x5024('0x23');}this[_0x5024('0x6')](_0x5024('0x24'),_0x526d38);this[_0x5024('0x6')](_0x5024('0x48'),'no');this[_0x5024('0x6')](_0x5024('0x49'),null);this[_0x5024('0x6')](_0x5024('0x4a'),null);this['setDataValue'](_0x5024('0x4b'),null);this[_0x5024('0x6')]('dtlsenable',null);this[_0x5024('0x6')](_0x5024('0x4c'),null);this['setDataValue'](_0x5024('0x4d'),null);this['setDataValue']('dtlscertfile',null);this[_0x5024('0x6')](_0x5024('0x4e'),null);this[_0x5024('0x6')](_0x5024('0x4f'),'no');break;case 0x2:this['setDataValue'](_0x5024('0x24'),_0x5024('0x50'));this['setDataValue'](_0x5024('0x48'),_0x5024('0x2a'));this['setDataValue'](_0x5024('0x49'),_0x5024('0x2a'));this[_0x5024('0x6')](_0x5024('0x4a'),_0x5024('0x2a'));this['setDataValue']('icesupport',_0x5024('0x2a'));this[_0x5024('0x6')](_0x5024('0x51'),_0x5024('0x2a'));this[_0x5024('0x6')](_0x5024('0x4c'),'no');this[_0x5024('0x6')]('dtlssetup',_0x5024('0x43'));this[_0x5024('0x6')](_0x5024('0x52'),_0x58d18c[_0x5024('0x52')]||_0x5024('0x53'));this[_0x5024('0x6')](_0x5024('0x4e'),_0x58d18c[_0x5024('0x4e')]||'/etc/pki/tls/private/motion.key');this[_0x5024('0x6')](_0x5024('0x4f'),_0x5024('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x5024('0x44')],'set':function(_0x4308ec){this[_0x5024('0x6')](_0x5024('0x54'),_0x4308ec?_0x4308ec[_0x5024('0x30')](','):[]);},'get':function(){return this[_0x5024('0x14')](_0x5024('0x54'))?_['map'](this[_0x5024('0x14')](_0x5024('0x54'))['split'](','),function(_0x2235ca){return parseInt(_0x2235ca,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5024('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5024('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5024('0x55')],'get':function(){return this[_0x5024('0x14')](_0x5024('0x56'))?this[_0x5024('0x14')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![],'set':function(_0x39eb7b){if(typeof _0x39eb7b===_0x5024('0x57')){var _0x57fed0=_0x39eb7b==='1'?!![]:_0x39eb7b==='0'?![]:_0x39eb7b===_0x5024('0x58')?!![]:_0x39eb7b===_0x5024('0x59')?![]:![];this[_0x5024('0x6')](_0x5024('0x5a'),_0x57fed0);}else{this[_0x5024('0x6')]('screenrecording',_0x39eb7b);}}},'blocked':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![],'set':function(_0x2b49d6){this[_0x5024('0x6')](_0x5024('0x5b'),_0x2b49d6);if(_0x2b49d6===!![]){this['setDataValue']('blockedAt',moment());this[_0x5024('0x6')](_0x5024('0x5c'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5024('0x17')](0x5)[_0x5024('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index e6e7321..847d434 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 _0x8e3f=['Queue','pick','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','ScreenRecording','UserId','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','smsPause','whatsapppause','pauseType','manual','%s%s','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','getSmsQueues','Sms','Whatsapp','Fax','getOpenchannelQueues','Openchannel','getDataValue','Queue:save','UserVoicePrefix','VoicePrefixId','removeTeams','Mail','getFaxQueues','flatten','transaction','TeamVoicePrefix','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$gte','$ne','$eq','$not','$notBetween','$in','$notIn','$notLike','$iLike','$like','$overlap','$contains','$contained','$any','firstName','lastName','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','teams','queues','inbound','toString','asc','desc','substring','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','toUpperCase','ui.','InteractionId','field','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','lodash','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','User,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','role','admin','Users','Agents','agent','filter','map','value','includes','find','name','UserProfileResource','stack','send','index','User','rawAttributes','type','key','password','salt','query','includeAll','include','attributes','push','findAll','rows','length','chat','dataValues','fax','openchannel','show','params','model','differenceBy','keys','filters','intersection','fields','merge','openTabs','mail','body','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','internal','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','fullname','permissions','101','102','103','113','110','104','105','106','108','109','100','111','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','each','isEmpty','telephone','compact','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','voice','VoiceQueue','format','SIP/%s','voicePause','penalty','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','emit','Queue:remove','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','root','server/files/images/','getOpenTabs','sms','whatsapp','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','order','sort','where','options','List','Tag','Tags','color','tag','hasOwnProperty','nolimit','getQueues'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0xf8e3('0x0'));var BPromise=require(_0xf8e3('0x1'));var util=require(_0xf8e3('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xf8e3('0x3'));var squel=require(_0xf8e3('0x4'));var jayson=require(_0xf8e3('0x5'));var Redis=require('ioredis');var authService=require(_0xf8e3('0x6'));var qs=require(_0xf8e3('0x7'));var logger=require('../../config/logger')(_0xf8e3('0x8'));var utils=require(_0xf8e3('0x9'));var config=require(_0xf8e3('0xa'));var licenseUtil=require(_0xf8e3('0xb'));var db=require('../../mysqldb')['db'];var socket=require(_0xf8e3('0xc'))(new Redis(config[_0xf8e3('0xd')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);config[_0xf8e3('0xd')]=_[_0xf8e3('0x10')](config[_0xf8e3('0xd')],{'host':_0xf8e3('0x11'),'port':0x18eb});var client=jayson[_0xf8e3('0x12')][_0xf8e3('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x28f5f0,_0xe584cd,_0x5e4b87,_0xb7d14f){return new BPromise(function(_0x1e6d9c,_0x3b6ac6){var _0x4888eb=_0xb7d14f||client;return _0x4888eb[_0xf8e3('0x14')](_0x28f5f0,_0x5e4b87)[_0xf8e3('0x15')](function(_0x336790){logger[_0xf8e3('0x16')]('User,\x20%s,\x20%s',_0xe584cd,_0xf8e3('0x17'));logger[_0xf8e3('0x18')](_0xf8e3('0x19'),_0xe584cd,'request\x20sent',JSON[_0xf8e3('0x1a')](_0x336790));if(_0x336790['error']){if(_0x336790[_0xf8e3('0x1b')][_0xf8e3('0x1c')]===0x1f4){logger[_0xf8e3('0x1b')]('User,\x20%s,\x20%s',_0xe584cd,_0x336790['error'][_0xf8e3('0x1d')]);return _0x3b6ac6(_0x336790[_0xf8e3('0x1b')][_0xf8e3('0x1d')]);}logger[_0xf8e3('0x1b')](_0xf8e3('0x1e'),_0xe584cd,_0x336790[_0xf8e3('0x1b')][_0xf8e3('0x1d')]);return _0x1e6d9c(_0x336790[_0xf8e3('0x1b')][_0xf8e3('0x1d')]);}else{logger[_0xf8e3('0x16')]('User,\x20%s,\x20%s',_0xe584cd,_0xf8e3('0x17'));_0x1e6d9c(_0x336790[_0xf8e3('0x1f')][_0xf8e3('0x1d')]);}})[_0xf8e3('0x20')](function(_0x3128ad){logger[_0xf8e3('0x1b')](_0xf8e3('0x1e'),_0xe584cd,_0x3128ad);_0x3b6ac6(_0x3128ad);});});}function respondWithStatusCode(_0x3fff85,_0x5b99b1){_0x5b99b1=_0x5b99b1||0xcc;return function(_0xe5102b){if(_0xe5102b){return _0x3fff85[_0xf8e3('0x21')](_0x5b99b1);}return _0x3fff85[_0xf8e3('0x22')](_0x5b99b1)[_0xf8e3('0x23')]();};}function respondWithResult(_0x4a1e5f,_0x39df34){_0x39df34=_0x39df34||0xc8;return function(_0x4b3705){if(_0x4b3705){return _0x4a1e5f[_0xf8e3('0x22')](_0x39df34)[_0xf8e3('0x24')](_0x4b3705);}};}function respondWithFilteredResult(_0x33d526,_0x2dc856){return function(_0x1f4b68){if(_0x1f4b68){var _0x3ac384=typeof _0x2dc856['offset']===_0xf8e3('0x25')&&typeof _0x2dc856[_0xf8e3('0x26')]===_0xf8e3('0x25');var _0x417b42=_0x1f4b68[_0xf8e3('0x27')];var _0x3b41a1=_0x3ac384?0x0:_0x2dc856[_0xf8e3('0x28')];var _0x157a2d=_0x3ac384?_0x1f4b68['count']:_0x2dc856[_0xf8e3('0x28')]+_0x2dc856[_0xf8e3('0x26')];var _0x12ebd2;if(_0x157a2d>=_0x417b42){_0x157a2d=_0x417b42;_0x12ebd2=0xc8;}else{_0x12ebd2=0xce;}_0x33d526[_0xf8e3('0x22')](_0x12ebd2);return _0x33d526[_0xf8e3('0x29')](_0xf8e3('0x2a'),_0x3b41a1+'-'+_0x157a2d+'/'+_0x417b42)[_0xf8e3('0x24')](_0x1f4b68);}return null;};}function saveUpdates(_0xfaf15d){return function(_0x4f2ae9){if(_0x4f2ae9){return _0x4f2ae9[_0xf8e3('0x2b')](_0xfaf15d)[_0xf8e3('0x15')](function(_0x492694){return _0x492694;});}return null;};}function removeEntity(_0x28b2f2){return function(_0x567153){if(_0x567153){return _0x567153[_0xf8e3('0x2c')]()[_0xf8e3('0x15')](function(){var _0x40f64d=_0x567153[_0xf8e3('0x2d')]({'plain':!![]});if(_0x40f64d[_0xf8e3('0x2e')]===_0xf8e3('0x2f'))return;var _0xb9c26=[{'name':_0xf8e3('0x30'),'value':'user','ignore':!![]},{'name':_0xf8e3('0x31'),'value':_0xf8e3('0x32'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x5cc1ed=_(_0xb9c26)[_0xf8e3('0x33')]('ignore')[_0xf8e3('0x34')](_0xf8e3('0x35'))[_0xf8e3('0x35')]();if(_[_0xf8e3('0x36')](_0x5cc1ed,_0x40f64d['role'])){return;}var _0x581a97=_[_0xf8e3('0x37')](_0xb9c26,[_0xf8e3('0x35'),_0x40f64d[_0xf8e3('0x2e')]])[_0xf8e3('0x38')];return db[_0xf8e3('0x39')][_0xf8e3('0x2c')]({'where':{'type':_0x581a97,'resourceId':_0x40f64d['id']}})['then'](function(){return _0x567153;});})[_0xf8e3('0x15')](function(){_0x28b2f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eaa03){return function(_0x1e8878){if(!_0x1e8878){_0x1eaa03[_0xf8e3('0x21')](0x194);}return _0x1e8878;};}function handleError(_0x1b7af2,_0x4cb46a){_0x4cb46a=_0x4cb46a||0x1f4;return function(_0x5ece46){logger[_0xf8e3('0x1b')](_0x5ece46[_0xf8e3('0x3a')]);if(_0x5ece46['name']){delete _0x5ece46[_0xf8e3('0x38')];}_0x1b7af2[_0xf8e3('0x22')](_0x4cb46a)[_0xf8e3('0x3b')](_0x5ece46);};}exports[_0xf8e3('0x3c')]=function(_0x547f53,_0x53cfea){var _0x5d307e={},_0x22b65e={'count':0x0,'rows':[]};var _0xcd2ffe=_(db[_0xf8e3('0x3d')][_0xf8e3('0x3e')])['map'](function(_0xee2e34){return{'name':_0xee2e34['fieldName'],'type':_0xee2e34[_0xf8e3('0x3f')][_0xf8e3('0x40')]};})[_0xf8e3('0x33')](function(_0x10e225){return!_[_0xf8e3('0x36')]([_0xf8e3('0x41'),_0xf8e3('0x42')],_0x10e225[_0xf8e3('0x38')]);})[_0xf8e3('0x35')]();_0x5d307e=qs['getOptions'](_0xcd2ffe,_0x547f53);var _0x211620={'where':_0x5d307e['where']};return db[_0xf8e3('0x3d')][_0xf8e3('0x27')](_0x211620)[_0xf8e3('0x15')](function(_0x9a6b37){_0x22b65e[_0xf8e3('0x27')]=_0x9a6b37;if(_0x547f53[_0xf8e3('0x43')][_0xf8e3('0x44')]){_0x5d307e[_0xf8e3('0x45')]=[{'all':!![]}];}if(!_['includes'](_0x5d307e[_0xf8e3('0x46')],'id')){_0x5d307e[_0xf8e3('0x46')][_0xf8e3('0x47')]('id');}return db[_0xf8e3('0x3d')][_0xf8e3('0x48')](_0x5d307e);})[_0xf8e3('0x15')](function(_0x792190){_0x22b65e[_0xf8e3('0x49')]=_0x792190;if(_0x547f53['query']['openTabs']==='true'){var _0x30fecf=[];for(var _0x3d3ea5=0x0;_0x3d3ea5<_0x22b65e['rows'][_0xf8e3('0x4a')];_0x3d3ea5++){_0x30fecf['push'](get_open_tabs(_0xf8e3('0x4b'),_0x22b65e[_0xf8e3('0x49')][_0x3d3ea5]['dataValues']));_0x30fecf[_0xf8e3('0x47')](get_open_tabs('sms',_0x22b65e[_0xf8e3('0x49')][_0x3d3ea5][_0xf8e3('0x4c')]));_0x30fecf['push'](get_open_tabs(_0xf8e3('0x4d'),_0x22b65e[_0xf8e3('0x49')][_0x3d3ea5][_0xf8e3('0x4c')]));_0x30fecf[_0xf8e3('0x47')](get_open_tabs('mail',_0x22b65e['rows'][_0x3d3ea5]['dataValues']));_0x30fecf[_0xf8e3('0x47')](get_open_tabs(_0xf8e3('0x4e'),_0x22b65e[_0xf8e3('0x49')][_0x3d3ea5]['dataValues']));_0x30fecf[_0xf8e3('0x47')](get_open_tabs('whatsapp',_0x22b65e[_0xf8e3('0x49')][_0x3d3ea5][_0xf8e3('0x4c')]));}return BPromise['all'](_0x30fecf)['then'](function(_0x128234){return _0x22b65e;});}else{return _0x22b65e;}})[_0xf8e3('0x15')](respondWithFilteredResult(_0x53cfea,_0x5d307e))[_0xf8e3('0x20')](handleError(_0x53cfea,null));};exports[_0xf8e3('0x4f')]=function(_0x3b790f,_0x1fc2a6){var _0x3b56ed={'raw':![],'where':{'id':_0x3b790f[_0xf8e3('0x50')]['id']}},_0x2a58e2={};_0x2a58e2[_0xf8e3('0x51')]=_[_0xf8e3('0x52')](_['keys'](db[_0xf8e3('0x3d')][_0xf8e3('0x3e')]),[_0xf8e3('0x41'),_0xf8e3('0x42')]);_0x2a58e2[_0xf8e3('0x43')]=_[_0xf8e3('0x53')](_0x3b790f['query']);_0x2a58e2[_0xf8e3('0x54')]=_[_0xf8e3('0x55')](_0x2a58e2[_0xf8e3('0x51')],_0x2a58e2[_0xf8e3('0x43')]);_0x3b56ed[_0xf8e3('0x46')]=_[_0xf8e3('0x55')](_0x2a58e2['model'],qs[_0xf8e3('0x56')](_0x3b790f[_0xf8e3('0x43')][_0xf8e3('0x56')]));_0x3b56ed[_0xf8e3('0x46')]=_0x3b56ed[_0xf8e3('0x46')][_0xf8e3('0x4a')]?_0x3b56ed['attributes']:_0x2a58e2[_0xf8e3('0x51')];if(_0x3b790f[_0xf8e3('0x43')][_0xf8e3('0x44')]){_0x3b56ed[_0xf8e3('0x45')]=[{'all':!![]}];}_0x3b56ed=_[_0xf8e3('0x57')]({},_0x3b56ed,_0x3b790f['options']);if(!_[_0xf8e3('0x36')](_0x3b56ed[_0xf8e3('0x46')],'id')){_0x3b56ed[_0xf8e3('0x46')]['push']('id');}return db['User'][_0xf8e3('0x37')](_0x3b56ed)[_0xf8e3('0x15')](handleEntityNotFound(_0x1fc2a6,null))[_0xf8e3('0x15')](function(_0x3ad7f1){var _0x58ad2f=[];values=_0x3ad7f1;if(_0x3b790f[_0xf8e3('0x43')][_0xf8e3('0x58')]==='true'){_0x58ad2f['push'](get_open_tabs(_0xf8e3('0x4b'),_0x3ad7f1[_0xf8e3('0x4c')]));_0x58ad2f[_0xf8e3('0x47')](get_open_tabs('sms',_0x3ad7f1['dataValues']));_0x58ad2f['push'](get_open_tabs(_0xf8e3('0x4e'),_0x3ad7f1[_0xf8e3('0x4c')]));_0x58ad2f['push'](get_open_tabs('whatsapp',_0x3ad7f1['dataValues']));_0x58ad2f[_0xf8e3('0x47')](get_open_tabs(_0xf8e3('0x4d'),_0x3ad7f1['dataValues']));_0x58ad2f[_0xf8e3('0x47')](get_open_tabs(_0xf8e3('0x59'),_0x3ad7f1[_0xf8e3('0x4c')]));return BPromise['all'](_0x58ad2f);}else{return values;}})['then'](function(_0x524fbc){return values;})['then'](respondWithResult(_0x1fc2a6,null))[_0xf8e3('0x20')](handleError(_0x1fc2a6,null));};exports[_0xf8e3('0x2b')]=function(_0x3ef144,_0x447efe){if(_0x3ef144[_0xf8e3('0x5a')]['id']){delete _0x3ef144[_0xf8e3('0x5a')]['id'];}delete _0x3ef144[_0xf8e3('0x5a')][_0xf8e3('0x2e')];return db[_0xf8e3('0x3d')]['find']({'where':{'id':_0x3ef144['params']['id']}})[_0xf8e3('0x15')](handleEntityNotFound(_0x447efe,null))[_0xf8e3('0x15')](saveUpdates(_0x3ef144[_0xf8e3('0x5a')],null))['then'](respondWithResult(_0x447efe,null))[_0xf8e3('0x20')](handleError(_0x447efe,null));};exports[_0xf8e3('0x5b')]=function(_0x4879c7,_0x48bb3f){return db[_0xf8e3('0x3d')][_0xf8e3('0x5b')]()[_0xf8e3('0x15')](respondWithResult(_0x48bb3f,null))[_0xf8e3('0x20')](handleError(_0x48bb3f,null));};exports['addContacts']=function(_0x5bd7bf,_0x37751e){return db[_0xf8e3('0x3d')][_0xf8e3('0x37')]({'where':{'id':_0x5bd7bf[_0xf8e3('0x50')]['id']}})['then'](handleEntityNotFound(_0x37751e,null))['then'](function(_0x324ad5){if(_0x324ad5){return _0x324ad5[_0xf8e3('0x5c')](_0x5bd7bf['body'][_0xf8e3('0x5d')],_[_0xf8e3('0x5e')](_0x5bd7bf[_0xf8e3('0x5a')],[_0xf8e3('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x37751e,null))[_0xf8e3('0x20')](handleError(_0x37751e,null));};function validateUser(_0x5d2ecf){return new BPromise(function(_0x217979,_0x1cad38){if(_0x5d2ecf['internal'])return _0x217979(_0x5d2ecf);return db[_0xf8e3('0x5f')][_0xf8e3('0x60')](0x1)['then'](function(_0x232d83){if(_0x232d83[_0xf8e3('0x61')])authService[_0xf8e3('0x62')](_0x5d2ecf[_0xf8e3('0x41')]);db['User'][_0xf8e3('0x63')](_0xf8e3('0x64'))[_0xf8e3('0x15')](function(_0x3c214f){if(_[_0xf8e3('0x65')](_0x3c214f)){_0x5d2ecf[_0xf8e3('0x64')]=_0x232d83[_0xf8e3('0x66')]||0x1;return;}if(_[_0xf8e3('0x65')](_0x232d83[_0xf8e3('0x66')])||_0x232d83[_0xf8e3('0x66')]===_0x3c214f){_0x5d2ecf[_0xf8e3('0x64')]=_0x3c214f+0x1;return;}if(_0x232d83[_0xf8e3('0x66')]>_0x3c214f){_0x5d2ecf['internal']=_0x232d83['min_internal'];return;}return db[_0xf8e3('0x67')][_0xf8e3('0x43')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xf8e3('0x67')][_0xf8e3('0x68')][_0xf8e3('0x69')]})[_0xf8e3('0x15')](function(_0x18a810){if(_0x18a810&&_0x18a810['length']){for(var _0x3e501c=0x0,_0x1dcd23=_0x18a810['length'];_0x3e501c<_0x1dcd23&&_[_0xf8e3('0x65')](_0x5d2ecf['internal']);_0x3e501c++){if(_0x232d83[_0xf8e3('0x66')]<=_0x18a810[_0x3e501c]['from']){_0x5d2ecf[_0xf8e3('0x64')]=_0x18a810[_0x3e501c][_0xf8e3('0x6a')];}else if(_0x232d83[_0xf8e3('0x66')]>_0x18a810[_0x3e501c][_0xf8e3('0x6a')]&&_0x232d83[_0xf8e3('0x66')]<=_0x18a810[_0x3e501c]['to']){_0x5d2ecf['internal']=_0x232d83[_0xf8e3('0x66')];}}}if(_[_0xf8e3('0x65')](_0x5d2ecf[_0xf8e3('0x64')])){_0x5d2ecf[_0xf8e3('0x64')]=_0x3c214f+0x1;}return _0x217979(_0x5d2ecf);});});})[_0xf8e3('0x20')](function(_0x3852d1){_0x1cad38(_0x3852d1);});});}function updateUser(_0x459562){return new BPromise(function(_0x2ccd34,_0x3ddc19){try{if(_0x459562[_0xf8e3('0x6b')]){_0x459562[_0xf8e3('0x6c')]=_0x459562[_0xf8e3('0x64')];_0x459562['VoiceMail']={'mailbox':_0x459562[_0xf8e3('0x64')],'password':_0x459562[_0xf8e3('0x41')],'fullname':_0x459562[_0xf8e3('0x6d')],'email':_0x459562['email']};}if(_0x459562[_0xf8e3('0x2e')]===_0xf8e3('0x32')){if(!_0x459562[_0xf8e3('0x6e')])_0x459562[_0xf8e3('0x6e')]=[_0xf8e3('0x6f'),_0xf8e3('0x70'),_0xf8e3('0x71'),_0xf8e3('0x72'),_0xf8e3('0x73'),_0xf8e3('0x74'),_0xf8e3('0x75'),_0xf8e3('0x76'),'107',_0xf8e3('0x77'),_0xf8e3('0x78'),_0xf8e3('0x79'),_0xf8e3('0x7a'),'114','115'];}_0x2ccd34(_0x459562);}catch(_0x11aa1d){_0x3ddc19(_0x11aa1d);}});}exports[_0xf8e3('0x7b')]=function(_0x4c8707,_0x5bedc7){if(_0x4c8707[_0xf8e3('0x7c')][_0xf8e3('0x2e')]==='agent')throw new Error(_0xf8e3('0x7d'));if(_0x4c8707[_0xf8e3('0x5a')][_0xf8e3('0x2e')]===_0xf8e3('0x7c')&&_0x4c8707[_0xf8e3('0x7c')]['role']!==_0xf8e3('0x2f')){throw new Error(_0xf8e3('0x7e'));}if(_0x4c8707['body']['role']===_0xf8e3('0x2f')&&_0x4c8707[_0xf8e3('0x7c')][_0xf8e3('0x2e')]!==_0xf8e3('0x2f')){throw new Error(_0xf8e3('0x7f'));}return licenseUtil[_0xf8e3('0x80')]([_0x4c8707[_0xf8e3('0x5a')]])[_0xf8e3('0x15')](function(){return validateUser(_0x4c8707['body']);})[_0xf8e3('0x15')](function(_0x2c9a8e){return updateUser(_0x2c9a8e)[_0xf8e3('0x15')](function(_0x16f087){if(_0x16f087[_0xf8e3('0x2e')]===_0xf8e3('0x2f')){_0x16f087['settingsEnabled']=_0x4c8707[_0xf8e3('0x7c')][_0xf8e3('0x81')];delete _0x16f087[_0xf8e3('0x82')];}return _0x16f087;});})['then'](function(_0x47a748){return db[_0xf8e3('0x3d')][_0xf8e3('0x7b')](_0x47a748,{'include':[{'model':db[_0xf8e3('0x83')],'as':_0xf8e3('0x83')}]});})[_0xf8e3('0x15')](function(_0x5b8840){if(_0x4c8707[_0xf8e3('0x5a')][_0xf8e3('0x2e')]===_0xf8e3('0x7c'))return _0x5b8840;if(_0x4c8707[_0xf8e3('0x7c')][_0xf8e3('0x2e')]!==_0xf8e3('0x7c'))return _0x5b8840;return db[_0xf8e3('0x84')][_0xf8e3('0x37')]({'where':{'name':_0x5b8840[_0xf8e3('0x2e')]==='agent'?_0xf8e3('0x31'):_0xf8e3('0x85'),'userProfileId':_0x4c8707[_0xf8e3('0x7c')][_0xf8e3('0x82')]},'raw':!![]})[_0xf8e3('0x15')](function(_0xb2f16e){if(!_0xb2f16e||_0xb2f16e[_0xf8e3('0x86')]!=0x0)return _0x5b8840;return db['UserProfileResource']['create']({'name':_0x5b8840[_0xf8e3('0x38')],'resourceId':_0x5b8840['id'],'type':_0xb2f16e[_0xf8e3('0x38')],'sectionId':_0xb2f16e['id']},{})['then'](function(){return _0x5b8840;});})[_0xf8e3('0x20')](function(_0x2412f9){logger[_0xf8e3('0x1b')](_0xf8e3('0x87'),_0x2412f9);throw _0x2412f9;});})[_0xf8e3('0x15')](respondWithResult(_0x5bedc7,0xc9))[_0xf8e3('0x20')](handleError(_0x5bedc7,null));};exports[_0xf8e3('0x88')]=function(_0x4b5a1f,_0xddfaee){var _0x2121f3=_0x4b5a1f[_0xf8e3('0x5a')];var _0xc8c987=[];if(_0x4b5a1f[_0xf8e3('0x7c')][_0xf8e3('0x2e')]===_0xf8e3('0x32'))throw new Error(_0xf8e3('0x7d'));if(_[_0xf8e3('0x89')](_0x2121f3,[_0xf8e3('0x2e'),_0xf8e3('0x7c')])&&_0x4b5a1f['user']['role']!==_0xf8e3('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xf8e3('0x89')](_0x2121f3,['role',_0xf8e3('0x2f')])&&_0x4b5a1f[_0xf8e3('0x7c')][_0xf8e3('0x2e')]!=='admin'){throw new Error(_0xf8e3('0x8a'));}return licenseUtil[_0xf8e3('0x80')](_0x2121f3)[_0xf8e3('0x15')](function(){return validateUser(_0x2121f3[0x0]);})[_0xf8e3('0x15')](function(){for(var _0x3619cd=0x1;_0x3619cd<_0x2121f3['length'];_0x3619cd++){var _0xec1ff5=_0x2121f3[_0x3619cd-0x1]['internal'];if(!_0x2121f3[_0x3619cd][_0xf8e3('0x64')])_0x2121f3[_0x3619cd][_0xf8e3('0x64')]=_0xec1ff5+0x1;_0xc8c987[_0xf8e3('0x47')](validateUser(_0x2121f3[_0x3619cd]));}return BPromise[_0xf8e3('0x8b')](_0xc8c987);})[_0xf8e3('0x15')](function(){_0xc8c987=[];for(var _0x3243b5=0x0;_0x3243b5<_0x2121f3[_0xf8e3('0x4a')];_0x3243b5++){_0xc8c987['push'](updateUser(_0x2121f3[_0x3243b5]));}return BPromise[_0xf8e3('0x8b')](_0xc8c987);})[_0xf8e3('0x15')](function(){return BPromise[_0xf8e3('0x8c')](_0x2121f3,function(_0x1a9ba6){return db['User'][_0xf8e3('0x7b')](_0x1a9ba6,{'include':[{'model':db[_0xf8e3('0x83')],'as':_0xf8e3('0x83')}]})[_0xf8e3('0x15')](function(_0x22fa2f){_0x1a9ba6['id']=_0x22fa2f['id'];return _0x1a9ba6;});});})[_0xf8e3('0x15')](function(_0x477589){if(_0x4b5a1f[_0xf8e3('0x5a')]['role']==='user')return _0x477589;if(_0x4b5a1f[_0xf8e3('0x7c')][_0xf8e3('0x2e')]!==_0xf8e3('0x7c'))return _0x477589;var _0x161347=_[_0xf8e3('0x89')](_0x477589,function(_0x12bc5b){return _0x12bc5b[_0xf8e3('0x2e')]==='agent'||_0x12bc5b[_0xf8e3('0x2e')]==='telephone';});if(!_0x161347)return _0x477589;return db[_0xf8e3('0x84')][_0xf8e3('0x48')]({'where':{'name':{'$or':[_0xf8e3('0x31'),_0xf8e3('0x85')]},'userProfileId':_0x4b5a1f['user'][_0xf8e3('0x82')]},'raw':!![]})['then'](function(_0x567d66){if(_[_0xf8e3('0x8d')](_0x567d66)||!_[_0xf8e3('0x89')](_0x567d66,[_0xf8e3('0x86'),0x0]))return _0x477589;_0xc8c987=[];var _0x2db4e4=_(_0x567d66)['map'](function(_0x4e7821){if(_0x4e7821[_0xf8e3('0x86')]===0x1)return;return _0x4e7821[_0xf8e3('0x38')]==='Agents'?'agent':_0xf8e3('0x8e');})[_0xf8e3('0x8f')]()['value']();for(var _0x1844da=0x0;_0x1844da<_0x477589[_0xf8e3('0x4a')];_0x1844da++){if(!_[_0xf8e3('0x36')](_0x2db4e4,_0x477589[_0x1844da][_0xf8e3('0x2e')]))return;var _0x1bae38=_0x477589[_0x1844da][_0xf8e3('0x2e')]===_0xf8e3('0x32')?'Agents':_0xf8e3('0x85');_0xc8c987[_0xf8e3('0x47')](db['UserProfileResource'][_0xf8e3('0x7b')]({'name':_0x477589[_0x1844da]['name'],'resourceId':_0x477589[_0x1844da]['id'],'type':_0x1bae38,'sectionId':_[_0xf8e3('0x37')](_0x567d66,[_0xf8e3('0x38'),_0x1bae38])['id']},{}));}return BPromise[_0xf8e3('0x8b')](_0xc8c987);});})['then'](respondWithResult(_0xddfaee,0xc9))[_0xf8e3('0x20')](handleError(_0xddfaee,null));};exports['changePassword']=function(_0x153c80,_0x41ca1b){if(_0x153c80[_0xf8e3('0x5a')]['id']){delete _0x153c80[_0xf8e3('0x5a')]['id'];}return db['User']['find']({'where':{'id':_0x153c80[_0xf8e3('0x50')]['id']}})[_0xf8e3('0x15')](function(_0x268855){if(!_0x268855)return null;if(_0x268855['id']===_0x153c80[_0xf8e3('0x7c')]['id']){if(!_0x153c80[_0xf8e3('0x5a')][_0xf8e3('0x90')]||!_0x153c80['body'][_0xf8e3('0x91')]){throw new db[(_0xf8e3('0x92'))][(_0xf8e3('0x93'))](_0xf8e3('0x94'));}if(!_0x268855['authenticate'](_0x153c80[_0xf8e3('0x5a')]['oldPassword'])){throw new db[(_0xf8e3('0x92'))][(_0xf8e3('0x93'))]('Wrong\x20credentials');}if(_0x153c80[_0xf8e3('0x5a')]['oldPassword']===_0x153c80[_0xf8e3('0x5a')][_0xf8e3('0x91')]){throw new db['Sequelize'][(_0xf8e3('0x93'))](_0xf8e3('0x95'));}}else if(_0x153c80['user'][_0xf8e3('0x2e')]===_0xf8e3('0x2f')){if(!_0x153c80[_0xf8e3('0x5a')][_0xf8e3('0x91')]){throw new db[(_0xf8e3('0x92'))][(_0xf8e3('0x93'))](_0xf8e3('0x96'));}}else if(_0x153c80[_0xf8e3('0x7c')][_0xf8e3('0x2e')]===_0xf8e3('0x7c')){if(!_0x153c80[_0xf8e3('0x5a')][_0xf8e3('0x91')]){throw new db['Sequelize'][(_0xf8e3('0x93'))](_0xf8e3('0x96'));}if(_0x268855[_0xf8e3('0x2e')]!=='agent'){throw new db[(_0xf8e3('0x92'))][(_0xf8e3('0x93'))](_0xf8e3('0x7d'));}}else{throw new db[(_0xf8e3('0x92'))][(_0xf8e3('0x93'))](_0xf8e3('0x7d'));}return _0x268855;})[_0xf8e3('0x15')](handleEntityNotFound(_0x41ca1b,null))['then'](function(_0x513b90){return db[_0xf8e3('0x5f')][_0xf8e3('0x97')]({'attributes':['id','securePassword',_0xf8e3('0x98'),_0xf8e3('0x99')]})['then'](function(_0x45919d){if(_0x45919d[_0xf8e3('0x61')])authService[_0xf8e3('0x62')](_0x153c80[_0xf8e3('0x5a')][_0xf8e3('0x91')]);if(!_0x45919d['enforcePasswordHistory']||!_0x513b90[_0xf8e3('0x9a')])return _0x513b90;authService[_0xf8e3('0x9b')](_0x153c80['body'][_0xf8e3('0x91')],_0x513b90[_0xf8e3('0x9a')],_0x45919d[_0xf8e3('0x99')]);return _0x513b90;})[_0xf8e3('0x15')](saveUpdates({'password':_0x153c80[_0xf8e3('0x5a')][_0xf8e3('0x91')],'passwordResetAt':_0x153c80[_0xf8e3('0x7c')]['id']==_0x153c80['params']['id']?moment():null,'previousPasswords':authService[_0xf8e3('0x9c')](_0x153c80[_0xf8e3('0x5a')]['newPassword'],_0x513b90['previousPasswords'])},null));})['then'](respondWithResult(_0x41ca1b,null))[_0xf8e3('0x20')](handleError(_0x41ca1b,null));};exports[_0xf8e3('0x9d')]=function(_0x417af2,_0x29f5d0){var _0x4622b1=_0x417af2[_0xf8e3('0x5a')][_0xf8e3('0x9e')];return db['User']['find']({'where':{'id':_0x417af2[_0xf8e3('0x50')]['id']},'attributes':['id','name','role',_0xf8e3('0x9f'),_0xf8e3('0xa0'),'voicePause',_0xf8e3('0xa1')]})[_0xf8e3('0x15')](handleEntityNotFound(_0x29f5d0,null))[_0xf8e3('0x15')](function(_0x2c4060){if(_0x2c4060){if(!utils[_0xf8e3('0xa2')](_0x4622b1)){throw new db[(_0xf8e3('0x92'))][(_0xf8e3('0x93'))](_0xf8e3('0xa3'));}return _0x2c4060[_0xf8e3('0xa4')+_[_0xf8e3('0xa5')](_0x4622b1[_0xf8e3('0xa6')]())+_0xf8e3('0xa7')](_0x417af2[_0xf8e3('0x5a')][_0xf8e3('0x5d')],{'penalty':_0x417af2[_0xf8e3('0x5a')]['penalty']||0x0})[_0xf8e3('0xa8')](function(_0x3de54e){for(var _0x4cb7c0=0x0;_0x4cb7c0<_0x417af2[_0xf8e3('0x5a')]['ids']['length'];_0x4cb7c0+=0x1){var _0x5a66ee={'UserId':Number(_0x417af2[_0xf8e3('0x50')]['id'])};_0x5a66ee[_[_0xf8e3('0xa5')](_0x4622b1['toLowerCase']())+_0xf8e3('0xa9')]=Number(_0x417af2[_0xf8e3('0x5a')][_0xf8e3('0x5d')][_0x4cb7c0]);socket['emit'](_0xf8e3('0x7c')+_[_0xf8e3('0xa5')](_0x4622b1[_0xf8e3('0xa6')]())+'Queue:save',_0x5a66ee);}return _0x3de54e;})[_0xf8e3('0x15')](function(){if(_0x4622b1===_0xf8e3('0xaa')){return db[_0xf8e3('0xab')]['findAll']({'where':{'id':_0x417af2[_0xf8e3('0x5a')][_0xf8e3('0x5d')]||[]},'raw':!![],'attributes':['id',_0xf8e3('0x38')]});}})[_0xf8e3('0x15')](function(_0x239890){var _0x446bf8=_0x2c4060['get']({'plain':!![]});var _0x14b346=[];if(_0x4622b1===_0xf8e3('0xaa')&&_0x446bf8['role']===_0xf8e3('0x32')&&_0x446bf8[_0xf8e3('0x9f')]){for(var _0xcf534f=0x0;_0xcf534f<_0x239890[_0xf8e3('0x4a')];_0xcf534f+=0x1){_0x14b346['push']({'membername':_0x446bf8[_0xf8e3('0x38')],'UserId':_0x446bf8['id'],'queue_name':_0x239890[_0xcf534f]['name'],'VoiceQueueId':_0x239890[_0xcf534f]['id'],'interface':_[_0xf8e3('0x65')](_0x446bf8['interface'])?util[_0xf8e3('0xac')](_0xf8e3('0xad'),_0x446bf8['name']):_0x446bf8[_0xf8e3('0xa1')],'paused':_0x446bf8[_0xf8e3('0xae')]||![],'penalty':_0x417af2[_0xf8e3('0x5a')][_0xf8e3('0xaf')]||0x0});}return BPromise[_0xf8e3('0x8c')](_0x14b346,function(_0x1b02c8){return db[_0xf8e3('0xb0')][_0xf8e3('0xb1')](_0x1b02c8);});}return _0x2c4060;});}})[_0xf8e3('0x15')](respondWithStatusCode(_0x29f5d0,null))[_0xf8e3('0x20')](handleError(_0x29f5d0,null));};exports[_0xf8e3('0xb2')]=function(_0xba6c1a,_0x4508d2){var _0x430f5b;return db[_0xf8e3('0x3d')][_0xf8e3('0x37')]({'where':{'id':_0xba6c1a['params']['id']},'attributes':['id',_0xf8e3('0x38'),'role']})[_0xf8e3('0x15')](handleEntityNotFound(_0x4508d2,null))[_0xf8e3('0x15')](function(_0x50b249){if(_0x50b249){_0x430f5b=_0x50b249;if(!_0xba6c1a[_0xf8e3('0x43')]['channel']||!utils[_0xf8e3('0xa2')](_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x9e')])){throw new db[(_0xf8e3('0x92'))]['ValidationError'](_0xf8e3('0xa3'));}return _0x50b249[_0xf8e3('0xb3')+_[_0xf8e3('0xa5')](_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x9e')][_0xf8e3('0xa6')]())+'Queues'](_0xba6c1a[_0xf8e3('0x43')]['ids']);}})['then'](function(_0x490b3c){if(_[_0xf8e3('0xb4')](_0xba6c1a['query']['ids'])){for(var _0x537cf0=0x0;_0x537cf0<_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x5d')][_0xf8e3('0x4a')];_0x537cf0+=0x1){var _0x5399b5={'UserId':Number(_0xba6c1a[_0xf8e3('0x50')]['id'])};_0x5399b5[_[_0xf8e3('0xa5')](_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x9e')][_0xf8e3('0xa6')]())+_0xf8e3('0xa9')]=Number(_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x5d')][_0x537cf0]);socket[_0xf8e3('0xb5')](_0xf8e3('0x7c')+_[_0xf8e3('0xa5')](_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x9e')][_0xf8e3('0xa6')]())+_0xf8e3('0xb6'),_0x5399b5);}}else{var _0x5399b5={'UserId':Number(_0xba6c1a[_0xf8e3('0x50')]['id'])};_0x5399b5[_[_0xf8e3('0xa5')](_0xba6c1a['query'][_0xf8e3('0x9e')]['toLowerCase']())+_0xf8e3('0xa9')]=Number(_0xba6c1a[_0xf8e3('0x43')]['ids']);socket[_0xf8e3('0xb5')]('user'+_[_0xf8e3('0xa5')](_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x9e')][_0xf8e3('0xa6')]())+_0xf8e3('0xb6'),_0x5399b5);}return _0x490b3c;})[_0xf8e3('0x15')](function(){if(_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x9e')]===_0xf8e3('0xaa')){return db[_0xf8e3('0xb0')][_0xf8e3('0x2c')]({'where':{'UserId':_0xba6c1a[_0xf8e3('0x50')]['id'],'VoiceQueueId':_0xba6c1a[_0xf8e3('0x43')][_0xf8e3('0x5d')]},'individualHooks':!![]})[_0xf8e3('0x15')](function(){return _0x430f5b;});}return _0x430f5b;})[_0xf8e3('0x15')](respondWithStatusCode(_0x4508d2,null))[_0xf8e3('0x20')](handleError(_0x4508d2,null));};exports['addAvatar']=function(_0x463566,_0x37d5c9){_0x463566[_0xf8e3('0x5a')][_0xf8e3('0xb7')]=_0x463566[_0xf8e3('0xb8')][_0xf8e3('0xb9')];return db[_0xf8e3('0x3d')][_0xf8e3('0x37')]({'where':{'id':_0x463566[_0xf8e3('0x50')]['id']}})[_0xf8e3('0x15')](handleEntityNotFound(_0x37d5c9,null))[_0xf8e3('0x15')](saveUpdates(_0x463566[_0xf8e3('0x5a')],null))[_0xf8e3('0x15')](respondWithResult(_0x37d5c9,null))[_0xf8e3('0x20')](handleError(_0x37d5c9,null));};exports[_0xf8e3('0xba')]=function(_0x3cf809,_0x4d2cdb){var _0x3f4924=path[_0xf8e3('0xbb')](config['root'],_0xf8e3('0xbc'));return db[_0xf8e3('0x3d')][_0xf8e3('0x37')]({'where':{'id':_0x3cf809['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xf8e3('0x15')](handleEntityNotFound(_0x4d2cdb,null))['then'](function(_0x445091){if(_0x445091){if(_['isNil'](_0x445091['userpic'])){return _0x4d2cdb[_0xf8e3('0xbd')](_0x3f4924);}else{if(!fs['existsSync'](path[_0xf8e3('0xbb')](config[_0xf8e3('0xbe')],'server/files/images/',_0x445091['userpic']))){return _0x4d2cdb[_0xf8e3('0xbd')](_0x3f4924);}return _0x4d2cdb['download'](path[_0xf8e3('0xbb')](config[_0xf8e3('0xbe')],_0xf8e3('0xbf'),_0x445091['userpic']));}}})[_0xf8e3('0x20')](handleError(_0x4d2cdb,null));};exports[_0xf8e3('0xc0')]=function(_0x33cf45,_0xfd0019){return db[_0xf8e3('0x3d')][_0xf8e3('0x37')]({'where':{'id':_0x33cf45[_0xf8e3('0x50')]['id']},'attributes':['id']})[_0xf8e3('0x15')](handleEntityNotFound(_0xfd0019,null))[_0xf8e3('0x15')](function(_0xe70da7){var _0x3bffa9=[];values=_0xe70da7[_0xf8e3('0x4c')];_0x3bffa9[_0xf8e3('0x47')](get_open_tabs(_0xf8e3('0x4b'),_0xe70da7['dataValues']));_0x3bffa9['push'](get_open_tabs(_0xf8e3('0xc1'),_0xe70da7['dataValues']));_0x3bffa9[_0xf8e3('0x47')](get_open_tabs(_0xf8e3('0x4e'),_0xe70da7['dataValues']));_0x3bffa9[_0xf8e3('0x47')](get_open_tabs(_0xf8e3('0xc2'),_0xe70da7[_0xf8e3('0x4c')]));_0x3bffa9[_0xf8e3('0x47')](get_open_tabs(_0xf8e3('0x4d'),_0xe70da7[_0xf8e3('0x4c')]));_0x3bffa9[_0xf8e3('0x47')](get_open_tabs(_0xf8e3('0x59'),_0xe70da7[_0xf8e3('0x4c')]));return BPromise['all'](_0x3bffa9);})[_0xf8e3('0x15')](function(_0x3996fe){var _0x5e026c=[];if(_0x3996fe){for(var _0x15fa6f=0x0;_0x15fa6f=_0x2e1e63){_0x1a0acd=_0x2e1e63;_0x3a4fca=0xc8;}else{_0x3a4fca=0xce;}_0x4ca150[_0x5adb('0x1d')](_0x3a4fca);return _0x4ca150[_0x5adb('0x23')](_0x5adb('0x24'),_0x1feecf+'-'+_0x1a0acd+'/'+_0x2e1e63)['json'](_0x373cc3);}return null;};}function saveUpdates(_0x49992e){return function(_0x5d457e){if(_0x5d457e){return _0x5d457e[_0x5adb('0x25')](_0x49992e)[_0x5adb('0x26')](function(_0x60a672){return _0x60a672;});}return null;};}function removeEntity(_0x512bab){return function(_0x137a5c){if(_0x137a5c){return _0x137a5c['destroy']()[_0x5adb('0x26')](function(){var _0x34b793=_0x137a5c[_0x5adb('0x27')]({'plain':!![]});if(_0x34b793[_0x5adb('0x28')]===_0x5adb('0x29'))return;var _0x3145f2=[{'name':_0x5adb('0x2a'),'value':_0x5adb('0x2b'),'ignore':!![]},{'name':_0x5adb('0x2c'),'value':_0x5adb('0x2d'),'ignore':![]},{'name':'Telephones','value':_0x5adb('0x2e'),'ignore':![]}];var _0x4c8b2e=_(_0x3145f2)[_0x5adb('0x2f')](_0x5adb('0x30'))['map'](_0x5adb('0x31'))[_0x5adb('0x31')]();if(_[_0x5adb('0x32')](_0x4c8b2e,_0x34b793['role'])){return;}var _0x173789=_[_0x5adb('0x33')](_0x3145f2,['value',_0x34b793['role']])[_0x5adb('0x34')];return db['UserProfileResource'][_0x5adb('0x35')]({'where':{'type':_0x173789,'resourceId':_0x34b793['id']}})[_0x5adb('0x26')](function(){return _0x137a5c;});})[_0x5adb('0x26')](function(){_0x512bab[_0x5adb('0x1d')](0xcc)[_0x5adb('0x1e')]();});}};}function handleEntityNotFound(_0x5ece39){return function(_0x2f7abe){if(!_0x2f7abe){_0x5ece39[_0x5adb('0x36')](0x194);}return _0x2f7abe;};}function handleError(_0x1c3a5c,_0x54851b){_0x54851b=_0x54851b||0x1f4;return function(_0x4c8870){logger[_0x5adb('0x19')](_0x4c8870[_0x5adb('0x37')]);if(_0x4c8870['name']){delete _0x4c8870[_0x5adb('0x34')];}_0x1c3a5c['status'](_0x54851b)[_0x5adb('0x38')](_0x4c8870);};}exports['index']=function(_0x11cb37,_0x4d052f){var _0x1d9681={},_0x23a1db={'count':0x0,'rows':[]};var _0x4ccb27=_(db[_0x5adb('0x39')]['rawAttributes'])[_0x5adb('0x3a')](function(_0x34e828){return{'name':_0x34e828[_0x5adb('0x3b')],'type':_0x34e828['type'][_0x5adb('0x3c')]};})[_0x5adb('0x2f')](function(_0xcdaf8e){return!_[_0x5adb('0x32')]([_0x5adb('0x3d'),'salt'],_0xcdaf8e['name']);})['value']();_0x1d9681=qs['getOptions'](_0x4ccb27,_0x11cb37);var _0x427c71={'where':_0x1d9681[_0x5adb('0x3e')]};return db[_0x5adb('0x39')][_0x5adb('0x3f')](_0x427c71)[_0x5adb('0x26')](function(_0xd1c3c2){_0x23a1db[_0x5adb('0x3f')]=_0xd1c3c2;if(_0x11cb37[_0x5adb('0x40')]['includeAll']){_0x1d9681['include']=[{'all':!![]}];}if(!_[_0x5adb('0x32')](_0x1d9681['attributes'],'id')){_0x1d9681[_0x5adb('0x41')][_0x5adb('0x42')]('id');}return db[_0x5adb('0x39')][_0x5adb('0x43')](_0x1d9681);})[_0x5adb('0x26')](function(_0x522ee5){_0x23a1db[_0x5adb('0x44')]=_0x522ee5;if(_0x11cb37[_0x5adb('0x40')]['openTabs']===_0x5adb('0x45')){var _0x1a256c=[];for(var _0x5833c8=0x0;_0x5833c8<_0x23a1db[_0x5adb('0x44')][_0x5adb('0x46')];_0x5833c8++){_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x47'),_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs('sms',_0x23a1db['rows'][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x49'),_0x23a1db[_0x5adb('0x44')][_0x5833c8]['dataValues']));_0x1a256c['push'](get_open_tabs(_0x5adb('0x4a'),_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4b'),_0x23a1db['rows'][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs('whatsapp',_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));}return BPromise[_0x5adb('0x4c')](_0x1a256c)[_0x5adb('0x26')](function(_0x186bd2){return _0x23a1db;});}else{return _0x23a1db;}})[_0x5adb('0x26')](respondWithFilteredResult(_0x4d052f,_0x1d9681))[_0x5adb('0x1c')](handleError(_0x4d052f,null));};exports[_0x5adb('0x4d')]=function(_0x49e1a1,_0x3a925b){var _0x57dc8b={'raw':![],'where':{'id':_0x49e1a1['params']['id']}},_0x51bc49={};_0x51bc49[_0x5adb('0x4e')]=_[_0x5adb('0x4f')](_[_0x5adb('0x50')](db['User'][_0x5adb('0x51')]),['password',_0x5adb('0x52')]);_0x51bc49[_0x5adb('0x40')]=_[_0x5adb('0x50')](_0x49e1a1['query']);_0x51bc49[_0x5adb('0x53')]=_['intersection'](_0x51bc49[_0x5adb('0x4e')],_0x51bc49[_0x5adb('0x40')]);_0x57dc8b['attributes']=_[_0x5adb('0x54')](_0x51bc49[_0x5adb('0x4e')],qs[_0x5adb('0x55')](_0x49e1a1[_0x5adb('0x40')][_0x5adb('0x55')]));_0x57dc8b['attributes']=_0x57dc8b[_0x5adb('0x41')][_0x5adb('0x46')]?_0x57dc8b[_0x5adb('0x41')]:_0x51bc49[_0x5adb('0x4e')];if(_0x49e1a1['query'][_0x5adb('0x56')]){_0x57dc8b[_0x5adb('0x57')]=[{'all':!![]}];}_0x57dc8b=_[_0x5adb('0x58')]({},_0x57dc8b,_0x49e1a1['options']);if(!_[_0x5adb('0x32')](_0x57dc8b[_0x5adb('0x41')],'id')){_0x57dc8b[_0x5adb('0x41')][_0x5adb('0x42')]('id');}return db['User'][_0x5adb('0x33')](_0x57dc8b)[_0x5adb('0x26')](handleEntityNotFound(_0x3a925b,null))[_0x5adb('0x26')](function(_0x2cee37){var _0xa25ac3=[];values=_0x2cee37;if(_0x49e1a1['query'][_0x5adb('0x59')]==='true'){_0xa25ac3[_0x5adb('0x42')](get_open_tabs('chat',_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x5a'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3['push'](get_open_tabs(_0x5adb('0x4b'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs('whatsapp',_0x2cee37['dataValues']));_0xa25ac3['push'](get_open_tabs(_0x5adb('0x49'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4a'),_0x2cee37[_0x5adb('0x48')]));return BPromise[_0x5adb('0x4c')](_0xa25ac3);}else{return values;}})[_0x5adb('0x26')](function(_0x8d7810){return values;})[_0x5adb('0x26')](respondWithResult(_0x3a925b,null))[_0x5adb('0x1c')](handleError(_0x3a925b,null));};exports[_0x5adb('0x25')]=function(_0x1df439,_0x2c2357){if(_0x1df439['body']['id']){delete _0x1df439['body']['id'];}delete _0x1df439[_0x5adb('0x5b')][_0x5adb('0x28')];return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x1df439['params']['id']}})[_0x5adb('0x26')](handleEntityNotFound(_0x2c2357,null))[_0x5adb('0x26')](saveUpdates(_0x1df439['body'],null))[_0x5adb('0x26')](respondWithResult(_0x2c2357,null))[_0x5adb('0x1c')](handleError(_0x2c2357,null));};exports[_0x5adb('0x5c')]=function(_0x5edd60,_0x30d185){return db[_0x5adb('0x39')][_0x5adb('0x5c')]()[_0x5adb('0x26')](respondWithResult(_0x30d185,null))[_0x5adb('0x1c')](handleError(_0x30d185,null));};exports[_0x5adb('0x5d')]=function(_0x513f26,_0x836b91){return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x513f26['params']['id']}})[_0x5adb('0x26')](handleEntityNotFound(_0x836b91,null))[_0x5adb('0x26')](function(_0x343aa4){if(_0x343aa4){return _0x343aa4['addContacts'](_0x513f26[_0x5adb('0x5b')]['ids'],_[_0x5adb('0x5e')](_0x513f26[_0x5adb('0x5b')],[_0x5adb('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x836b91,null))[_0x5adb('0x1c')](handleError(_0x836b91,null));};function validateUser(_0x3627d1){return new BPromise(function(_0x539814,_0x12711e){if(_0x3627d1[_0x5adb('0x60')])return _0x539814(_0x3627d1);return db[_0x5adb('0x61')][_0x5adb('0x62')](0x1)['then'](function(_0x4290bb){if(_0x4290bb[_0x5adb('0x63')])authService[_0x5adb('0x64')](_0x3627d1[_0x5adb('0x3d')]);db['User']['max'](_0x5adb('0x60'))['then'](function(_0x4d635f){if(_['isNil'](_0x4d635f)){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')]||0x1;return;}if(_['isNil'](_0x4290bb[_0x5adb('0x65')])||_0x4290bb[_0x5adb('0x65')]===_0x4d635f){_0x3627d1[_0x5adb('0x60')]=_0x4d635f+0x1;return;}if(_0x4290bb[_0x5adb('0x65')]>_0x4d635f){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')];return;}return db[_0x5adb('0x66')][_0x5adb('0x40')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x5adb('0x67')]})[_0x5adb('0x26')](function(_0x3a0d1b){if(_0x3a0d1b&&_0x3a0d1b[_0x5adb('0x46')]){for(var _0x1f59bb=0x0,_0x2f6ef7=_0x3a0d1b[_0x5adb('0x46')];_0x1f59bb<_0x2f6ef7&&_[_0x5adb('0x68')](_0x3627d1['internal']);_0x1f59bb++){if(_0x4290bb['min_internal']<=_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')]){_0x3627d1[_0x5adb('0x60')]=_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')];}else if(_0x4290bb[_0x5adb('0x65')]>_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')]&&_0x4290bb[_0x5adb('0x65')]<=_0x3a0d1b[_0x1f59bb]['to']){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')];}}}if(_[_0x5adb('0x68')](_0x3627d1[_0x5adb('0x60')])){_0x3627d1['internal']=_0x4d635f+0x1;}return _0x539814(_0x3627d1);});});})[_0x5adb('0x1c')](function(_0x294a24){_0x12711e(_0x294a24);});});}function updateUser(_0x25ac26){return new BPromise(function(_0x5d3aa4,_0x31f041){try{if(_0x25ac26[_0x5adb('0x6a')]){_0x25ac26['mailbox']=_0x25ac26[_0x5adb('0x60')];_0x25ac26['VoiceMail']={'mailbox':_0x25ac26[_0x5adb('0x60')],'password':_0x25ac26[_0x5adb('0x3d')],'fullname':_0x25ac26['fullname'],'email':_0x25ac26[_0x5adb('0x6b')]};}if(_0x25ac26[_0x5adb('0x28')]===_0x5adb('0x2d')){if(!_0x25ac26[_0x5adb('0x6c')])_0x25ac26[_0x5adb('0x6c')]=[_0x5adb('0x6d'),_0x5adb('0x6e'),_0x5adb('0x6f'),'113',_0x5adb('0x70'),_0x5adb('0x71'),_0x5adb('0x72'),'106','107',_0x5adb('0x73'),'109',_0x5adb('0x74'),_0x5adb('0x75'),_0x5adb('0x76'),'115'];}_0x5d3aa4(_0x25ac26);}catch(_0x3a9735){_0x31f041(_0x3a9735);}});}exports[_0x5adb('0x77')]=function(_0x2e3df9,_0x3ecc56){if(_0x2e3df9[_0x5adb('0x2b')]['role']===_0x5adb('0x2d'))throw new Error(_0x5adb('0x78'));if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]==='user'&&_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error(_0x5adb('0x79'));}if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x29')&&_0x2e3df9['user'][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x5adb('0x7a')]([_0x2e3df9[_0x5adb('0x5b')]])['then'](function(){return validateUser(_0x2e3df9[_0x5adb('0x5b')]);})['then'](function(_0x372354){return updateUser(_0x372354)[_0x5adb('0x26')](function(_0x4a2ebc){if(_0x4a2ebc[_0x5adb('0x28')]==='admin'){_0x4a2ebc[_0x5adb('0x7b')]=_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x7b')];delete _0x4a2ebc[_0x5adb('0x7c')];}return _0x4a2ebc;});})[_0x5adb('0x26')](function(_0x4dbcd9){return db[_0x5adb('0x39')][_0x5adb('0x77')](_0x4dbcd9,{'include':[{'model':db[_0x5adb('0x7d')],'as':_0x5adb('0x7d')}]});})['then'](function(_0x5e875c){if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x2b'))return _0x5e875c;if(_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x2b'))return _0x5e875c;return db[_0x5adb('0x7e')]['find']({'where':{'name':_0x5e875c[_0x5adb('0x28')]===_0x5adb('0x2d')?_0x5adb('0x2c'):_0x5adb('0x7f'),'userProfileId':_0x2e3df9['user'][_0x5adb('0x7c')]},'raw':!![]})[_0x5adb('0x26')](function(_0x243016){if(!_0x243016||_0x243016[_0x5adb('0x80')]!=0x0)return _0x5e875c;return db[_0x5adb('0x81')][_0x5adb('0x77')]({'name':_0x5e875c[_0x5adb('0x34')],'resourceId':_0x5e875c['id'],'type':_0x243016[_0x5adb('0x34')],'sectionId':_0x243016['id']},{})[_0x5adb('0x26')](function(){return _0x5e875c;});})['catch'](function(_0x2a3e17){logger[_0x5adb('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a3e17);throw _0x2a3e17;});})[_0x5adb('0x26')](respondWithResult(_0x3ecc56,0xc9))[_0x5adb('0x1c')](handleError(_0x3ecc56,null));};exports[_0x5adb('0x82')]=function(_0x3bb3fc,_0x200221){var _0x1bbc2e=_0x3bb3fc[_0x5adb('0x5b')];var _0x350bb1=[];if(_0x3bb3fc['user'][_0x5adb('0x28')]===_0x5adb('0x2d'))throw new Error('Unauthorized');if(_[_0x5adb('0x83')](_0x1bbc2e,[_0x5adb('0x28'),_0x5adb('0x2b')])&&_0x3bb3fc['user']['role']!==_0x5adb('0x29')){throw new Error(_0x5adb('0x79'));}if(_[_0x5adb('0x83')](_0x1bbc2e,['role',_0x5adb('0x29')])&&_0x3bb3fc[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error(_0x5adb('0x84'));}return licenseUtil[_0x5adb('0x7a')](_0x1bbc2e)[_0x5adb('0x26')](function(){return validateUser(_0x1bbc2e[0x0]);})[_0x5adb('0x26')](function(){for(var _0x28bd33=0x1;_0x28bd33<_0x1bbc2e[_0x5adb('0x46')];_0x28bd33++){var _0x423b80=_0x1bbc2e[_0x28bd33-0x1][_0x5adb('0x60')];if(!_0x1bbc2e[_0x28bd33]['internal'])_0x1bbc2e[_0x28bd33]['internal']=_0x423b80+0x1;_0x350bb1[_0x5adb('0x42')](validateUser(_0x1bbc2e[_0x28bd33]));}return BPromise[_0x5adb('0x4c')](_0x350bb1);})['then'](function(){_0x350bb1=[];for(var _0x3f6975=0x0;_0x3f6975<_0x1bbc2e[_0x5adb('0x46')];_0x3f6975++){_0x350bb1[_0x5adb('0x42')](updateUser(_0x1bbc2e[_0x3f6975]));}return BPromise[_0x5adb('0x4c')](_0x350bb1);})[_0x5adb('0x26')](function(){return BPromise[_0x5adb('0x85')](_0x1bbc2e,function(_0x15626b){return db[_0x5adb('0x39')][_0x5adb('0x77')](_0x15626b,{'include':[{'model':db['VoiceMail'],'as':_0x5adb('0x7d')}]})[_0x5adb('0x26')](function(_0x273785){_0x15626b['id']=_0x273785['id'];return _0x15626b;});});})['then'](function(_0x312a90){if(_0x3bb3fc[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x2b'))return _0x312a90;if(_0x3bb3fc[_0x5adb('0x2b')][_0x5adb('0x28')]!=='user')return _0x312a90;var _0x13a4aa=_[_0x5adb('0x83')](_0x312a90,function(_0x3fb91b){return _0x3fb91b[_0x5adb('0x28')]===_0x5adb('0x2d')||_0x3fb91b[_0x5adb('0x28')]===_0x5adb('0x2e');});if(!_0x13a4aa)return _0x312a90;return db[_0x5adb('0x7e')][_0x5adb('0x43')]({'where':{'name':{'$or':[_0x5adb('0x2c'),'Telephones']},'userProfileId':_0x3bb3fc[_0x5adb('0x2b')]['userProfileId']},'raw':!![]})[_0x5adb('0x26')](function(_0x2e0a49){if(_[_0x5adb('0x86')](_0x2e0a49)||!_[_0x5adb('0x83')](_0x2e0a49,[_0x5adb('0x80'),0x0]))return _0x312a90;_0x350bb1=[];var _0x5c7b1b=_(_0x2e0a49)['map'](function(_0x1aa301){if(_0x1aa301[_0x5adb('0x80')]===0x1)return;return _0x1aa301[_0x5adb('0x34')]===_0x5adb('0x2c')?_0x5adb('0x2d'):_0x5adb('0x2e');})['compact']()['value']();for(var _0x38c4a5=0x0;_0x38c4a5<_0x312a90[_0x5adb('0x46')];_0x38c4a5++){if(!_[_0x5adb('0x32')](_0x5c7b1b,_0x312a90[_0x38c4a5]['role']))return;var _0x542626=_0x312a90[_0x38c4a5][_0x5adb('0x28')]==='agent'?_0x5adb('0x2c'):_0x5adb('0x7f');_0x350bb1['push'](db['UserProfileResource'][_0x5adb('0x77')]({'name':_0x312a90[_0x38c4a5]['name'],'resourceId':_0x312a90[_0x38c4a5]['id'],'type':_0x542626,'sectionId':_['find'](_0x2e0a49,[_0x5adb('0x34'),_0x542626])['id']},{}));}return BPromise[_0x5adb('0x4c')](_0x350bb1);});})[_0x5adb('0x26')](respondWithResult(_0x200221,0xc9))[_0x5adb('0x1c')](handleError(_0x200221,null));};exports[_0x5adb('0x87')]=function(_0x133ea9,_0xa51ffc){if(_0x133ea9[_0x5adb('0x5b')]['id']){delete _0x133ea9[_0x5adb('0x5b')]['id'];}return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x133ea9[_0x5adb('0x88')]['id']}})[_0x5adb('0x26')](function(_0x4f4898){if(!_0x4f4898)return null;if(_0x4f4898['id']===_0x133ea9[_0x5adb('0x2b')]['id']){if(!_0x133ea9['body'][_0x5adb('0x89')]||!_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x8d'));}if(!_0x4f4898[_0x5adb('0x8e')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x89')])){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x8f'));}if(_0x133ea9['body'][_0x5adb('0x89')]===_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x90'));}}else if(_0x133ea9[_0x5adb('0x2b')][_0x5adb('0x28')]==='admin'){if(!_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))]['ValidationError'](_0x5adb('0x91'));}}else if(_0x133ea9['user'][_0x5adb('0x28')]==='user'){if(!_0x133ea9['body'][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x91'));}if(_0x4f4898[_0x5adb('0x28')]!==_0x5adb('0x2d')){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x78'));}}else{throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x78'));}return _0x4f4898;})['then'](handleEntityNotFound(_0xa51ffc,null))[_0x5adb('0x26')](function(_0x521dde){return db[_0x5adb('0x61')][_0x5adb('0x92')]({'attributes':['id','securePassword',_0x5adb('0x93'),_0x5adb('0x94')]})['then'](function(_0x4b367d){if(_0x4b367d[_0x5adb('0x63')])authService[_0x5adb('0x64')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]);if(!_0x4b367d[_0x5adb('0x93')]||!_0x521dde[_0x5adb('0x95')])return _0x521dde;authService['validatePasswordHistory'](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')],_0x521dde[_0x5adb('0x95')],_0x4b367d[_0x5adb('0x94')]);return _0x521dde;})[_0x5adb('0x26')](saveUpdates({'password':_0x133ea9['body']['newPassword'],'passwordResetAt':_0x133ea9[_0x5adb('0x2b')]['id']==_0x133ea9[_0x5adb('0x88')]['id']?moment():null,'previousPasswords':authService[_0x5adb('0x96')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')],_0x521dde[_0x5adb('0x95')])},null));})[_0x5adb('0x26')](respondWithResult(_0xa51ffc,null))[_0x5adb('0x1c')](handleError(_0xa51ffc,null));};exports[_0x5adb('0x97')]=function(_0x4fedea,_0x2102f3){var _0x2d7264=_0x4fedea['body']['channel'];return db['User'][_0x5adb('0x33')]({'where':{'id':_0x4fedea[_0x5adb('0x88')]['id']},'attributes':['id',_0x5adb('0x34'),'role','online',_0x5adb('0x98'),_0x5adb('0x99'),_0x5adb('0x9a')]})[_0x5adb('0x26')](handleEntityNotFound(_0x2102f3,null))[_0x5adb('0x26')](function(_0x44cd22){if(_0x44cd22){if(!utils['isValidChannel'](_0x2d7264)){throw new db['Sequelize'][(_0x5adb('0x8c'))]('Unknown\x20channel');}return _0x44cd22[_0x5adb('0x9b')+_[_0x5adb('0x9c')](_0x2d7264['toLowerCase']())+_0x5adb('0x9d')](_0x4fedea[_0x5adb('0x5b')][_0x5adb('0x5f')],{'penalty':_0x4fedea[_0x5adb('0x5b')]['penalty']||0x0})[_0x5adb('0x9e')](function(_0x398188){for(var _0x21a51f=0x0;_0x21a51f<_0x4fedea[_0x5adb('0x5b')]['ids'][_0x5adb('0x46')];_0x21a51f+=0x1){var _0x559938={'UserId':Number(_0x4fedea[_0x5adb('0x88')]['id'])};_0x559938[_[_0x5adb('0x9c')](_0x2d7264[_0x5adb('0x9f')]())+_0x5adb('0xa0')]=Number(_0x4fedea[_0x5adb('0x5b')][_0x5adb('0x5f')][_0x21a51f]);socket['emit'](_0x5adb('0x2b')+_[_0x5adb('0x9c')](_0x2d7264[_0x5adb('0x9f')]())+_0x5adb('0xa1'),_0x559938);}return _0x398188;})['then'](function(){if(_0x2d7264===_0x5adb('0xa2')){return db['VoiceQueue']['findAll']({'where':{'id':_0x4fedea['body'][_0x5adb('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x1d3771){var _0x143f33=_0x44cd22[_0x5adb('0x27')]({'plain':!![]});var _0x2d6898=[];if(_0x2d7264===_0x5adb('0xa2')&&_0x143f33[_0x5adb('0x28')]===_0x5adb('0x2d')&&_0x143f33['online']){for(var _0x59d227=0x0;_0x59d227<_0x1d3771[_0x5adb('0x46')];_0x59d227+=0x1){_0x2d6898['push']({'membername':_0x143f33[_0x5adb('0x34')],'UserId':_0x143f33['id'],'queue_name':_0x1d3771[_0x59d227][_0x5adb('0x34')],'VoiceQueueId':_0x1d3771[_0x59d227]['id'],'interface':_[_0x5adb('0x68')](_0x143f33[_0x5adb('0x9a')])?util[_0x5adb('0xa3')](_0x5adb('0xa4'),_0x143f33[_0x5adb('0x34')]):_0x143f33[_0x5adb('0x9a')],'paused':_0x143f33[_0x5adb('0x99')]||![],'penalty':_0x4fedea[_0x5adb('0x5b')][_0x5adb('0xa5')]||0x0});}return BPromise[_0x5adb('0x85')](_0x2d6898,function(_0x4871b1){return db['UserVoiceQueueRt'][_0x5adb('0xa6')](_0x4871b1);});}return _0x44cd22;});}})[_0x5adb('0x26')](respondWithStatusCode(_0x2102f3,null))[_0x5adb('0x1c')](handleError(_0x2102f3,null));};exports[_0x5adb('0xa7')]=function(_0x587101,_0x477b6d){var _0x380ccc;return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x587101[_0x5adb('0x88')]['id']},'attributes':['id','name','role']})[_0x5adb('0x26')](handleEntityNotFound(_0x477b6d,null))['then'](function(_0x182975){if(_0x182975){_0x380ccc=_0x182975;if(!_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]||!utils[_0x5adb('0xa9')](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')])){throw new db['Sequelize'][(_0x5adb('0x8c'))](_0x5adb('0xaa'));}return _0x182975[_0x5adb('0xab')+_[_0x5adb('0x9c')](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')][_0x5adb('0x9f')]())+'Queues'](_0x587101['query']['ids']);}})[_0x5adb('0x26')](function(_0x5ae730){if(_[_0x5adb('0xac')](_0x587101['query']['ids'])){for(var _0x3420fa=0x0;_0x3420fa<_0x587101[_0x5adb('0x40')]['ids']['length'];_0x3420fa+=0x1){var _0x272f92={'UserId':Number(_0x587101[_0x5adb('0x88')]['id'])};_0x272f92[_[_0x5adb('0x9c')](_0x587101['query'][_0x5adb('0xa8')]['toLowerCase']())+'QueueId']=Number(_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')][_0x3420fa]);socket[_0x5adb('0xad')]('user'+_['capitalize'](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]['toLowerCase']())+'Queue:remove',_0x272f92);}}else{var _0x272f92={'UserId':Number(_0x587101[_0x5adb('0x88')]['id'])};_0x272f92[_['capitalize'](_0x587101[_0x5adb('0x40')]['channel'][_0x5adb('0x9f')]())+'QueueId']=Number(_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')]);socket[_0x5adb('0xad')](_0x5adb('0x2b')+_[_0x5adb('0x9c')](_0x587101['query'][_0x5adb('0xa8')][_0x5adb('0x9f')]())+_0x5adb('0xae'),_0x272f92);}return _0x5ae730;})['then'](function(){if(_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]===_0x5adb('0xa2')){return db[_0x5adb('0xaf')]['destroy']({'where':{'UserId':_0x587101[_0x5adb('0x88')]['id'],'VoiceQueueId':_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x380ccc;});}return _0x380ccc;})[_0x5adb('0x26')](respondWithStatusCode(_0x477b6d,null))['catch'](handleError(_0x477b6d,null));};exports[_0x5adb('0xb0')]=function(_0x2ccc31,_0x20ad43){_0x2ccc31[_0x5adb('0x5b')][_0x5adb('0xb1')]=_0x2ccc31['file']['filename'];return db['User'][_0x5adb('0x33')]({'where':{'id':_0x2ccc31['params']['id']}})['then'](handleEntityNotFound(_0x20ad43,null))[_0x5adb('0x26')](saveUpdates(_0x2ccc31[_0x5adb('0x5b')],null))[_0x5adb('0x26')](respondWithResult(_0x20ad43,null))[_0x5adb('0x1c')](handleError(_0x20ad43,null));};exports[_0x5adb('0xb2')]=function(_0x2d58b8,_0x2a9cc9){var _0x338404=path['join'](config[_0x5adb('0xb3')],_0x5adb('0xb4'));return db['User'][_0x5adb('0x33')]({'where':{'id':_0x2d58b8[_0x5adb('0x88')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x5adb('0x26')](handleEntityNotFound(_0x2a9cc9,null))['then'](function(_0x3bff0c){if(_0x3bff0c){if(_[_0x5adb('0x68')](_0x3bff0c[_0x5adb('0xb1')])){return _0x2a9cc9[_0x5adb('0xb5')](_0x338404);}else{if(!fs[_0x5adb('0xb6')](path[_0x5adb('0xb7')](config[_0x5adb('0xb3')],_0x5adb('0xb8'),_0x3bff0c['userpic']))){return _0x2a9cc9[_0x5adb('0xb5')](_0x338404);}return _0x2a9cc9['download'](path[_0x5adb('0xb7')](config['root'],_0x5adb('0xb8'),_0x3bff0c['userpic']));}}})[_0x5adb('0x1c')](handleError(_0x2a9cc9,null));};exports[_0x5adb('0xb9')]=function(_0x123e79,_0x759016){return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x123e79[_0x5adb('0x88')]['id']},'attributes':['id']})[_0x5adb('0x26')](handleEntityNotFound(_0x759016,null))[_0x5adb('0x26')](function(_0x1ee4c8){var _0x35e182=[];values=_0x1ee4c8[_0x5adb('0x48')];_0x35e182[_0x5adb('0x42')](get_open_tabs('chat',_0x1ee4c8[_0x5adb('0x48')]));_0x35e182['push'](get_open_tabs(_0x5adb('0x5a'),_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs('openchannel',_0x1ee4c8['dataValues']));_0x35e182['push'](get_open_tabs('whatsapp',_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x49'),_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4a'),_0x1ee4c8[_0x5adb('0x48')]));return BPromise[_0x5adb('0x4c')](_0x35e182);})[_0x5adb('0x26')](function(_0x5c6ef6){var _0x39bf82=[];if(_0x5c6ef6){for(var _0x5100a3=0x0;_0x5100a3=_0x1675ef[_0x26a5('0x4f')]){throw new Error(_0x26a5('0x50'));}})[_0x26a5('0xe')](function(){if(_0x1239f8){return db[_0x26a5('0x28')]['destroy']({'where':{'membername':_0x1239f8[_0x26a5('0x24')]},'individualHooks':!![]});}})[_0x26a5('0xe')](function(){if(_0x1239f8){return _0x1239f8[_0x26a5('0x51')]({'raw':!![]});}})['then'](function(_0xf0ea23){if(_0x1239f8){if(_0xf0ea23){var _0x106760=[];_0x2ce809=_0xf0ea23;if(_0x2ce809[_0x26a5('0x2b')]){for(var _0x542dcb=0x0;_0x542dcb<_0x2ce809['length'];_0x542dcb++){_0x106760[_0x26a5('0x2f')](db[_0x26a5('0x28')]['upsert']({'membername':_0x1239f8[_0x26a5('0x24')],'UserId':_0x1239f8['id'],'queue_name':_0x2ce809[_0x542dcb][_0x26a5('0x24')],'VoiceQueueId':_0x2ce809[_0x542dcb]['id'],'interface':_0x4468ab,'paused':_0x1239f8[_0x26a5('0x4a')]||![],'penalty':_0x2ce809[_0x542dcb][_0x26a5('0x52')]||0x0}));}return BPromise[_0x26a5('0x45')](_0x106760);}}}})[_0x26a5('0xe')](function(){if(_0x1239f8){return db[_0x26a5('0x35')]['findAll']({'where':{'membername':_0x1239f8[_0x26a5('0x24')],'exitAt':null}});}})[_0x26a5('0xe')](function(_0x5dbb0c){if(_0x1239f8){if(_0x5dbb0c&&_0x5dbb0c['length']){var _0x1a3df6=[];_0x5dbb0c['forEach'](function(_0x20fcbd){_0x1a3df6[_0x26a5('0x2f')](_0x20fcbd[_0x26a5('0x29')]({'exitAt':moment()[_0x26a5('0x2c')](_0x26a5('0x36'))}));});return BPromise[_0x26a5('0x45')](_0x1a3df6);}}})[_0x26a5('0xe')](function(_0x4bdf5e){if(_0x1239f8){var _0x31bb3f=[];var _0x39dcca=[];var _0x4d0433=utils['getChannels']();var _0xf9d80d={'membername':_0x1239f8[_0x26a5('0x24')],'interface':_0x4468ab,'enterAt':moment()['format'](_0x26a5('0x36')),'role':_0x1239f8[_0x26a5('0x25')],'internal':_0x1239f8[_0x26a5('0x26')]};_0x4d0433[_0x26a5('0x2e')](function(_0x540755){_0x31bb3f[_0x26a5('0x2f')](_[_0x26a5('0x53')]({'channel':_0x540755,'type':_0x26a5('0x54'),'data1':_0x26a5('0x55'),'data2':_0x4468ab},_0xf9d80d));if(_0x1239f8[_0x26a5('0x4a')]){_0x39dcca[_0x26a5('0x2f')](_[_0x26a5('0x53')]({'channel':_0x540755,'type':_0x26a5('0x2a'),'data1':'LOGININPAUSE'},_0xf9d80d));}});return db[_0x26a5('0x35')][_0x26a5('0x56')](_0x31bb3f[_0x26a5('0x57')](_0x39dcca),{'individualHooks':!![]});}})[_0x26a5('0xe')](function(){if(_0x1239f8){return _0x1239f8['update']({'online':!![],'lastLoginAt':moment()[_0x26a5('0x2c')](_0x26a5('0x36')),'voicePause':_0x1239f8[_0x26a5('0x4a')]||![],'mailPause':_0x1239f8[_0x26a5('0x4a')]||![],'chatPause':_0x1239f8[_0x26a5('0x4a')]||![],'faxPause':_0x1239f8[_0x26a5('0x4a')]||![],'smsPause':_0x1239f8['loginInPause']||![],'openchannelPause':_0x1239f8[_0x26a5('0x4a')]||![],'pauseType':_0x1239f8['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x26a5('0x2c')](_0x26a5('0x36')),'interface':_0x4468ab});}})[_0x26a5('0xe')](function(_0x3c091f){_0xc5011d(_0x3c091f);})[_0x26a5('0x16')](function(_0x5b2ebd){_0x28c356(_0x49d03d['error'](0x1f4,_0x5b2ebd['message']));});});}; \ No newline at end of file +var _0x492a=['update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','format','SIP/%s','PAUSE','body','DEFAULT\x20PAUSE','role','bulkCreate','UnpauseUser','channel','voice','system','mail','chat','sms','whatsapp','set','%s%s','UserVoiceQueueRt','all','LogoutUser','findOne','destroy','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','findAll','options','raw','where','attributes','limit','include','map','model','ShowUser','User','find','PauseUser','name','internal','interface'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x492a,0xea));var _0xa492=function(_0x2ad52e,_0x954699){_0x2ad52e=_0x2ad52e-0x0;var _0x3fa370=_0x492a[_0x2ad52e];return _0x3fa370;};'use strict';var _=require(_0xa492('0x0'));var util=require(_0xa492('0x1'));var moment=require(_0xa492('0x2'));var BPromise=require(_0xa492('0x3'));var rs=require(_0xa492('0x4'));var fs=require('fs');var Redis=require(_0xa492('0x5'));var db=require(_0xa492('0x6'))['db'];var utils=require(_0xa492('0x7'));var logger=require(_0xa492('0x8'))(_0xa492('0x9'));var config=require(_0xa492('0xa'));var jayson=require(_0xa492('0xb'));var client=jayson[_0xa492('0xc')][_0xa492('0xd')]({'port':0x232a});config['redis']=_[_0xa492('0xe')](config['redis'],{'host':_0xa492('0xf'),'port':0x18eb});var socket=require(_0xa492('0x10'))(new Redis(config[_0xa492('0x11')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x3e3d26,_0x2aa5c0,_0x4201ed){return new BPromise(function(_0x4aa5d7,_0x6b867b){return client[_0xa492('0x12')](_0x3e3d26,_0x4201ed)[_0xa492('0x13')](function(_0x16961a){logger[_0xa492('0x14')](_0xa492('0x15'),_0x2aa5c0,_0xa492('0x16'));logger[_0xa492('0x17')](_0xa492('0x18'),_0x2aa5c0,_0xa492('0x16'),JSON[_0xa492('0x19')](_0x16961a));if(_0x16961a['error']){if(_0x16961a[_0xa492('0x1a')][_0xa492('0x1b')]===0x1f4){logger[_0xa492('0x1a')](_0xa492('0x15'),_0x2aa5c0,_0x16961a['error'][_0xa492('0x1c')]);return _0x6b867b(_0x16961a['error']['message']);}logger[_0xa492('0x1a')](_0xa492('0x15'),_0x2aa5c0,_0x16961a[_0xa492('0x1a')][_0xa492('0x1c')]);return _0x4aa5d7(_0x16961a[_0xa492('0x1a')]['message']);}else{logger[_0xa492('0x14')](_0xa492('0x15'),_0x2aa5c0,_0xa492('0x16'));_0x4aa5d7(_0x16961a[_0xa492('0x1d')][_0xa492('0x1c')]);}})[_0xa492('0x1e')](function(_0x2f864f){logger[_0xa492('0x1a')](_0xa492('0x15'),_0x2aa5c0,_0x2f864f);_0x6b867b(_0x2f864f);});});}exports[_0xa492('0x1f')]=function(_0x1017b4){var _0xee9feb=this;return new Promise(function(_0x15ac12,_0x49396e){return db['User'][_0xa492('0x20')]({'raw':_0x1017b4[_0xa492('0x21')]?_0x1017b4['options'][_0xa492('0x22')]===undefined?!![]:![]:!![],'where':_0x1017b4[_0xa492('0x21')]?_0x1017b4[_0xa492('0x21')][_0xa492('0x23')]||null:null,'attributes':_0x1017b4[_0xa492('0x21')]?_0x1017b4[_0xa492('0x21')][_0xa492('0x24')]||null:null,'limit':_0x1017b4[_0xa492('0x21')]?_0x1017b4[_0xa492('0x21')][_0xa492('0x25')]||null:null,'include':_0x1017b4[_0xa492('0x21')]?_0x1017b4[_0xa492('0x21')][_0xa492('0x26')]?_[_0xa492('0x27')](_0x1017b4[_0xa492('0x21')][_0xa492('0x26')],function(_0x5d232e){return{'model':db[_0x5d232e[_0xa492('0x28')]],'as':_0x5d232e['as'],'attributes':_0x5d232e[_0xa492('0x24')],'include':_0x5d232e[_0xa492('0x26')]?_['map'](_0x5d232e[_0xa492('0x26')],function(_0x9575f2){return{'model':db[_0x9575f2['model']],'as':_0x9575f2['as'],'attributes':_0x9575f2[_0xa492('0x24')],'include':_0x9575f2[_0xa492('0x26')]?_[_0xa492('0x27')](_0x9575f2['include'],function(_0x50857b){return{'model':db[_0x50857b[_0xa492('0x28')]],'as':_0x50857b['as'],'attributes':_0x50857b[_0xa492('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52e000){logger[_0xa492('0x14')](_0xa492('0x1f'),_0x1017b4);logger[_0xa492('0x17')]('GetUser',_0x1017b4,JSON['stringify'](_0x52e000));_0x15ac12(_0x52e000);})[_0xa492('0x1e')](function(_0x2bb919){logger[_0xa492('0x1a')](_0xa492('0x1f'),_0x2bb919[_0xa492('0x1c')],_0x1017b4);_0x49396e(_0xee9feb[_0xa492('0x1a')](0x1f4,_0x2bb919['message']));});});};exports[_0xa492('0x29')]=function(_0x5812eb){var _0x186ef5=this;return new Promise(function(_0x557caf,_0xdfaaa4){return db[_0xa492('0x2a')][_0xa492('0x2b')]({'raw':_0x5812eb['options']?_0x5812eb[_0xa492('0x21')][_0xa492('0x22')]===undefined?!![]:![]:!![],'where':_0x5812eb['options']?_0x5812eb[_0xa492('0x21')][_0xa492('0x23')]||null:null,'attributes':_0x5812eb[_0xa492('0x21')]?_0x5812eb[_0xa492('0x21')][_0xa492('0x24')]||null:null,'include':_0x5812eb[_0xa492('0x21')]?_0x5812eb['options']['include']?_[_0xa492('0x27')](_0x5812eb[_0xa492('0x21')][_0xa492('0x26')],function(_0x5a1fb6){return{'model':db[_0x5a1fb6['model']],'as':_0x5a1fb6['as'],'attributes':_0x5a1fb6['attributes'],'include':_0x5a1fb6[_0xa492('0x26')]?_['map'](_0x5a1fb6['include'],function(_0x301244){return{'model':db[_0x301244['model']],'as':_0x301244['as'],'attributes':_0x301244[_0xa492('0x24')],'include':_0x301244[_0xa492('0x26')]?_[_0xa492('0x27')](_0x301244['include'],function(_0x39dafb){return{'model':db[_0x39dafb[_0xa492('0x28')]],'as':_0x39dafb['as'],'attributes':_0x39dafb[_0xa492('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa492('0x13')](function(_0x51a6ad){logger[_0xa492('0x14')](_0xa492('0x29'),_0x5812eb);logger[_0xa492('0x17')]('ShowUser',_0x5812eb,JSON[_0xa492('0x19')](_0x51a6ad));_0x557caf(_0x51a6ad);})[_0xa492('0x1e')](function(_0x309918){logger[_0xa492('0x1a')](_0xa492('0x29'),_0x309918[_0xa492('0x1c')],_0x5812eb);_0xdfaaa4(_0x186ef5[_0xa492('0x1a')](0x1f4,_0x309918[_0xa492('0x1c')]));});});};exports[_0xa492('0x2c')]=function(_0x528a28){var _0x3ff50f=this;return new Promise(function(_0x43cab7,_0x42364d){var _0x7609a3;return db[_0xa492('0x2a')]['find']({'where':_0x528a28['options'][_0xa492('0x23')]||{},'attributes':['id',_0xa492('0x2d'),'role',_0xa492('0x2e'),_0xa492('0x2f')]})[_0xa492('0x13')](function(_0x5e0bcf){if(_0x5e0bcf){_0x7609a3=_0x5e0bcf;return db['UserVoiceQueueRt'][_0xa492('0x30')]({'paused':0x1},{'where':{'UserId':_0x7609a3['id']},'individualHooks':!![]});}})['then'](function(){if(_0x7609a3){return db[_0xa492('0x31')][_0xa492('0x20')]({'where':{'membername':_0x7609a3[_0xa492('0x2d')],'type':'PAUSE','exitAt':null}});}})[_0xa492('0x13')](function(_0x147140){if(_0x7609a3){if(_0x147140&&_0x147140[_0xa492('0x32')]){var _0x2b8748=moment()['format'](_0xa492('0x33'));for(var _0x2bab7a=0x0,_0x56a688=_0x147140[_0xa492('0x32')];_0x2bab7a<_0x56a688;_0x2bab7a++){_0x147140[_0x2bab7a][_0xa492('0x34')]({'exitAt':_0x2b8748});}}}})[_0xa492('0x13')](function(){if(_0x7609a3){var _0x1d6228=[];var _0x77de70=utils[_0xa492('0x35')]();_0x77de70[_0xa492('0x36')](function(_0x1adab7){_0x1d6228[_0xa492('0x37')]({'channel':_0x1adab7,'membername':_0x7609a3[_0xa492('0x2d')],'interface':_[_0xa492('0x38')](_0x7609a3[_0xa492('0x2f')])?util[_0xa492('0x39')](_0xa492('0x3a'),_0x7609a3[_0xa492('0x2d')]):_0x7609a3[_0xa492('0x2f')],'type':_0xa492('0x3b'),'enterAt':moment()[_0xa492('0x39')](_0xa492('0x33')),'data1':_0x528a28[_0xa492('0x3c')]['type']||_0xa492('0x3d'),'role':_0x7609a3[_0xa492('0x3e')],'internal':_0x7609a3['internal'],'uniqueid':_0x528a28['body']['uniqueid']||null});});return db[_0xa492('0x31')][_0xa492('0x3f')](_0x1d6228,{'individualHooks':!![]});}})[_0xa492('0x13')](function(){if(_0x7609a3){return _0x7609a3['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x528a28['body']['type']||_0xa492('0x3d'),'lastPauseAt':moment()[_0xa492('0x39')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xa492('0x13')](function(_0x123ce4){_0x43cab7(_0x123ce4);})[_0xa492('0x1e')](function(_0x3ffc35){_0x42364d(_0x3ff50f['error'](0x1f4,_0x3ffc35['message']));});});};exports[_0xa492('0x40')]=function(_0x47cf4e){var _0x2f3197=this;return new Promise(function(_0x95de4a,_0xc2a4ff){var _0x3106ed;return db['User']['findOne']({'where':_0x47cf4e[_0xa492('0x21')][_0xa492('0x23')]||{},'attributes':['id',_0xa492('0x2d')]})['then'](function(_0x53e023){if(_0x53e023){_0x3106ed=_0x53e023;if(_0x47cf4e[_0xa492('0x3c')][_0xa492('0x41')]&&!utils['isValidChannel'](_0x47cf4e['body'][_0xa492('0x41')])){throw new Error('Unknown\x20channel');}switch(_0x47cf4e[_0xa492('0x3c')][_0xa492('0x41')]){case _0xa492('0x42'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x3106ed['id']}})[_0xa492('0x13')](function(){return db[_0xa492('0x31')][_0xa492('0x2b')]({'where':{'channel':_0x47cf4e[_0xa492('0x3c')]['channel'],'membername':_0x3106ed[_0xa492('0x2d')],'type':_0xa492('0x3b'),'exitAt':null}});})[_0xa492('0x13')](function(_0x519a27){if(_0x519a27){return _0x519a27[_0xa492('0x30')]({'exitAt':moment()['format'](_0xa492('0x33')),'data2':_0xa492('0x43')},{'individualHooks':!![]});}return null;})[_0xa492('0x13')](function(){return _0x3106ed[_0xa492('0x30')]({'voicePause':![]});});case _0xa492('0x44'):case _0xa492('0x45'):case'fax':case _0xa492('0x46'):case'openchannel':case _0xa492('0x47'):return db[_0xa492('0x31')][_0xa492('0x2b')]({'where':{'channel':_0x47cf4e[_0xa492('0x3c')][_0xa492('0x41')],'membername':_0x3106ed[_0xa492('0x2d')],'type':'PAUSE','exitAt':null}})[_0xa492('0x13')](function(_0x4f1a2b){return _0x4f1a2b[_0xa492('0x30')]({'exitAt':moment()['format'](_0xa492('0x33')),'data2':_0xa492('0x43')},{'individualHooks':!![]});})[_0xa492('0x13')](function(){var _0xc0f82a={};_[_0xa492('0x48')](_0xc0f82a,util['format'](_0xa492('0x49'),_0x47cf4e[_0xa492('0x3c')]['channel'],'Pause'),![]);return _0x3106ed[_0xa492('0x30')](_0xc0f82a);});default:return db[_0xa492('0x4a')][_0xa492('0x30')]({'paused':0x0},{'where':{'UserId':_0x3106ed['id']}})['then'](function(){return db[_0xa492('0x31')][_0xa492('0x20')]({'where':{'membername':_0x3106ed[_0xa492('0x2d')],'type':_0xa492('0x3b'),'exitAt':null}});})['then'](function(_0x19c591){var _0x5aeede=[];_0x19c591[_0xa492('0x36')](function(_0x3cdcb4){_0x5aeede[_0xa492('0x37')](_0x3cdcb4[_0xa492('0x30')]({'exitAt':moment()[_0xa492('0x39')](_0xa492('0x33')),'data2':_0xa492('0x43')}));});return BPromise[_0xa492('0x4b')](_0x5aeede);})[_0xa492('0x13')](function(){return _0x3106ed[_0xa492('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x4a76b8){_0x95de4a(_0x4a76b8);})['catch'](function(_0x2dea8f){_0xc2a4ff(_0x2f3197[_0xa492('0x1a')](0x1f4,_0x2dea8f[_0xa492('0x1c')]));});});};exports[_0xa492('0x4c')]=function(_0x1695c5){var _0x42688b=this;return new Promise(function(_0x107fe1,_0x43a9c7){var _0x25fa4f;return db[_0xa492('0x2a')][_0xa492('0x4d')]({'where':_0x1695c5[_0xa492('0x21')]['where']||{},'attributes':['id','name']})[_0xa492('0x13')](function(_0x473250){if(_0x473250){_0x25fa4f=_0x473250;return db[_0xa492('0x4a')][_0xa492('0x4e')]({'where':{'membername':_0x25fa4f[_0xa492('0x2d')]},'individualHooks':!![]});}})[_0xa492('0x13')](function(){if(_0x25fa4f){return db[_0xa492('0x31')][_0xa492('0x20')]({'where':{'membername':_0x25fa4f[_0xa492('0x2d')],'exitAt':null}});}})[_0xa492('0x13')](function(_0x4a68b4){if(_0x25fa4f){if(_0x4a68b4&&_0x4a68b4[_0xa492('0x32')]){var _0x296421=[];_0x4a68b4[_0xa492('0x36')](function(_0x4f70cc){_0x296421[_0xa492('0x37')](_0x4f70cc[_0xa492('0x30')]({'exitAt':moment()[_0xa492('0x39')](_0xa492('0x33'))}));});return BPromise['all'](_0x296421);}}})[_0xa492('0x13')](function(){if(_0x25fa4f){return _0x25fa4f[_0xa492('0x30')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa492('0x13')](function(_0x33b614){_0x107fe1(_0x33b614);})[_0xa492('0x1e')](function(_0x4de50c){_0x43a9c7(_0x42688b['error'](0x1f4,_0x4de50c[_0xa492('0x1c')]));});});};exports[_0xa492('0x4f')]=function(_0x1a78cf){var _0x306747=this;return new Promise(function(_0x6d8c71,_0x5015ee){var _0x48947b;var _0x292351;var _0x1a5ca5;var _0x180150;return db['User'][_0xa492('0x4d')]({'where':_0x1a78cf[_0xa492('0x21')][_0xa492('0x23')]||{},'attributes':['id','name',_0xa492('0x3e'),_0xa492('0x50'),_0xa492('0x51'),'internal',_0xa492('0x52'),'interface']})[_0xa492('0x13')](function(_0x45e758){if(_0x45e758){_0x48947b=_0x45e758;_0x180150=_0x1a78cf[_0xa492('0x3c')][_0xa492('0x2f')]?_0x1a78cf[_0xa492('0x3c')][_0xa492('0x2f')]:util[_0xa492('0x39')](_0xa492('0x3a'),_0x48947b[_0xa492('0x2d')]);return db[_0xa492('0x2a')][_0xa492('0x53')]({'where':{'role':_0xa492('0x54'),'online':!![],'id':{'$ne':_0x48947b['id']}}});}})[_0xa492('0x13')](function(_0x4e2b87){if(_0x4e2b87){_0x1a5ca5=_0x4e2b87;return require('../../config/license/util')[_0xa492('0x55')]();}})[_0xa492('0x13')](function(_0x30972b){if(_0x30972b&&_0x30972b[_0xa492('0x56')]&&_0x1a5ca5>=_0x30972b[_0xa492('0x56')]){throw new Error(_0xa492('0x57'));}})[_0xa492('0x13')](function(){if(_0x48947b){return db[_0xa492('0x4a')][_0xa492('0x4e')]({'where':{'membername':_0x48947b[_0xa492('0x2d')]},'individualHooks':!![]});}})[_0xa492('0x13')](function(){if(_0x48947b){return _0x48947b[_0xa492('0x58')]({'raw':!![]});}})['then'](function(_0x25c039){if(_0x48947b){if(_0x25c039){var _0x2c4004=[];_0x292351=_0x25c039;if(_0x292351[_0xa492('0x32')]){for(var _0x35e251=0x0;_0x35e251<_0x292351[_0xa492('0x32')];_0x35e251++){_0x2c4004[_0xa492('0x37')](db[_0xa492('0x4a')]['upsert']({'membername':_0x48947b['name'],'UserId':_0x48947b['id'],'queue_name':_0x292351[_0x35e251][_0xa492('0x2d')],'VoiceQueueId':_0x292351[_0x35e251]['id'],'interface':_0x180150,'paused':_0x48947b['loginInPause']||![],'penalty':_0x292351[_0x35e251][_0xa492('0x59')]||0x0}));}return BPromise[_0xa492('0x4b')](_0x2c4004);}}}})[_0xa492('0x13')](function(){if(_0x48947b){return db[_0xa492('0x31')][_0xa492('0x20')]({'where':{'membername':_0x48947b['name'],'exitAt':null}});}})[_0xa492('0x13')](function(_0x2efb8f){if(_0x48947b){if(_0x2efb8f&&_0x2efb8f[_0xa492('0x32')]){var _0x1940e4=[];_0x2efb8f[_0xa492('0x36')](function(_0x1cbc83){_0x1940e4[_0xa492('0x37')](_0x1cbc83[_0xa492('0x30')]({'exitAt':moment()[_0xa492('0x39')](_0xa492('0x33'))}));});return BPromise[_0xa492('0x4b')](_0x1940e4);}}})[_0xa492('0x13')](function(_0x96e2d2){if(_0x48947b){var _0x383ef3=[];var _0x24c085=[];var _0x82e782=utils['getChannels']();var _0x35547d={'membername':_0x48947b[_0xa492('0x2d')],'interface':_0x180150,'enterAt':moment()[_0xa492('0x39')](_0xa492('0x33')),'role':_0x48947b[_0xa492('0x3e')],'internal':_0x48947b['internal']};_0x82e782[_0xa492('0x36')](function(_0x34db30){_0x383ef3['push'](_[_0xa492('0x5a')]({'channel':_0x34db30,'type':_0xa492('0x5b'),'data1':_0xa492('0x5c'),'data2':_0x180150},_0x35547d));if(_0x48947b['loginInPause']){_0x24c085['push'](_[_0xa492('0x5a')]({'channel':_0x34db30,'type':_0xa492('0x3b'),'data1':_0xa492('0x5d')},_0x35547d));}});return db['MemberReport'][_0xa492('0x3f')](_0x383ef3['concat'](_0x24c085),{'individualHooks':!![]});}})[_0xa492('0x13')](function(){if(_0x48947b){return _0x48947b[_0xa492('0x30')]({'online':!![],'lastLoginAt':moment()[_0xa492('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x48947b['loginInPause']||![],'mailPause':_0x48947b[_0xa492('0x52')]||![],'chatPause':_0x48947b[_0xa492('0x52')]||![],'faxPause':_0x48947b[_0xa492('0x52')]||![],'smsPause':_0x48947b[_0xa492('0x52')]||![],'openchannelPause':_0x48947b[_0xa492('0x52')]||![],'pauseType':_0x48947b['loginInPause']?_0xa492('0x5d'):null,'lastPauseAt':moment()['format'](_0xa492('0x33')),'interface':_0x180150});}})[_0xa492('0x13')](function(_0x3500a7){_0x6d8c71(_0x3500a7);})[_0xa492('0x1e')](function(_0x258744){_0x5015ee(_0x306747[_0xa492('0x1a')](0x1f4,_0x258744[_0xa492('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8b58ee2..0d9085b 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 _0x297a=['remove','removeListener','register','./user.events','save'];(function(_0x18a71e,_0x1887ec){var _0x6a2ef7=function(_0x195001){while(--_0x195001){_0x18a71e['push'](_0x18a71e['shift']());}};_0x6a2ef7(++_0x1887ec);}(_0x297a,0x17a));var _0xa297=function(_0x57202e,_0x51c81f){_0x57202e=_0x57202e-0x0;var _0x3dc668=_0x297a[_0x57202e];return _0x3dc668;};'use strict';var UserEvents=require(_0xa297('0x0'));var events=[_0xa297('0x1'),_0xa297('0x2'),'update'];function createListener(_0x42f673,_0xd12bf3){return function(_0x22dd1a){_0xd12bf3['emit'](_0x42f673,_0x22dd1a);};}function removeListener(_0x3ba76b,_0x1562df){return function(){UserEvents[_0xa297('0x3')](_0x3ba76b,_0x1562df);};}exports[_0xa297('0x4')]=function(_0x4d6cbf){for(var _0x5a2fd7=0x0,_0x198431=events['length'];_0x5a2fd7<_0x198431;_0x5a2fd7++){var _0x40b9dd=events[_0x5a2fd7];var _0x1b0da9=createListener('user:'+_0x40b9dd,_0x4d6cbf);UserEvents['on'](_0x40b9dd,_0x1b0da9);}}; \ No newline at end of file +var _0x6675=['./user.events','save','remove','emit','removeListener','register','length','user:'];(function(_0x54b03a,_0x7e31af){var _0x3f4388=function(_0x451e6d){while(--_0x451e6d){_0x54b03a['push'](_0x54b03a['shift']());}};_0x3f4388(++_0x7e31af);}(_0x6675,0x130));var _0x5667=function(_0x2b4575,_0x398753){_0x2b4575=_0x2b4575-0x0;var _0x30ad1c=_0x6675[_0x2b4575];return _0x30ad1c;};'use strict';var UserEvents=require(_0x5667('0x0'));var events=[_0x5667('0x1'),_0x5667('0x2'),'update'];function createListener(_0x55e53b,_0x5df881){return function(_0x4e3946){_0x5df881[_0x5667('0x3')](_0x55e53b,_0x4e3946);};}function removeListener(_0x50ad36,_0x490448){return function(){UserEvents[_0x5667('0x4')](_0x50ad36,_0x490448);};}exports[_0x5667('0x5')]=function(_0x69af2c){for(var _0x2f432f=0x0,_0x2e607f=events[_0x5667('0x6')];_0x2f432f<_0x2e607f;_0x2f432f++){var _0x4eb341=events[_0x2f432f];var _0x4caac5=createListener(_0x5667('0x7')+_0x4eb341,_0x69af2c);UserEvents['on'](_0x4eb341,_0x4caac5);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c143092..4bf0df5 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2e6458,_0x57d896){var _0x205b8c=function(_0x5b1186){while(--_0x5b1186){_0x2e6458['push'](_0x2e6458['shift']());}};_0x205b8c(++_0x57d896);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2562c6,_0x5e6df4){var _0x50f5e6=function(_0x20a555){while(--_0x20a555){_0x2562c6['push'](_0x2562c6['shift']());}};_0x50f5e6(++_0x5e6df4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index dfe6531..48d9fc5 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 _0x196e=['sequelize','exports','INTEGER'];(function(_0x3eb307,_0x311906){var _0x378017=function(_0x517c52){while(--_0x517c52){_0x3eb307['push'](_0x3eb307['shift']());}};_0x378017(++_0x311906);}(_0x196e,0xcc));var _0xe196=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x196e[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0xe196('0x0'));module[_0xe196('0x1')]={'penalty':{'type':Sequelize[_0xe196('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x18b8=['sequelize','exports','INTEGER'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x18b8,0x10e));var _0x818b=function(_0x3d35cf,_0x4b13b2){_0x3d35cf=_0x3d35cf-0x0;var _0x323c68=_0x18b8[_0x3d35cf];return _0x323c68;};'use strict';var Sequelize=require(_0x818b('0x0'));module[_0x818b('0x1')]={'penalty':{'type':Sequelize[_0x818b('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 c7e6635..3ed0d29 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 _0xb2fa=['bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','lodash','util','../../config/logger','moment'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xb2fa,0x132));var _0xab2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb2fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xab2f('0x0'));var util=require(_0xab2f('0x1'));var logger=require(_0xab2f('0x2'))('api');var moment=require(_0xab2f('0x3'));var BPromise=require(_0xab2f('0x4'));var rp=require(_0xab2f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab2f('0x6'));var config=require(_0xab2f('0x7'));var attributes=require(_0xab2f('0x8'));module['exports']=function(_0x21e7c9,_0x382963){return _0x21e7c9['define'](_0xab2f('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffb0=['api','moment','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x359622,_0xb98516){var _0x26a55e=function(_0x1515b8){while(--_0x1515b8){_0x359622['push'](_0x359622['shift']());}};_0x26a55e(++_0xb98516);}(_0xffb0,0x1d1));var _0x0ffb=function(_0x4b7681,_0x42def1){_0x4b7681=_0x4b7681-0x0;var _0x3eb020=_0xffb0[_0x4b7681];return _0x3eb020;};'use strict';var _=require(_0x0ffb('0x0'));var util=require(_0x0ffb('0x1'));var logger=require(_0x0ffb('0x2'))(_0x0ffb('0x3'));var moment=require(_0x0ffb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ffb('0x5'));var config=require(_0x0ffb('0x6'));var attributes=require(_0x0ffb('0x7'));module[_0x0ffb('0x8')]=function(_0x310d2c,_0x524280){return _0x310d2c[_0x0ffb('0x9')](_0x0ffb('0xa'),attributes,{'tableName':_0x0ffb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 733c2b6..9f5e18e 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 _0x1fe1=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x1fe1,0x19b));var _0x11fe=function(_0x295f66,_0x2b545b){_0x295f66=_0x295f66-0x0;var _0x3fd093=_0x1fe1[_0x295f66];return _0x3fd093;};'use strict';var _=require(_0x11fe('0x0'));var util=require(_0x11fe('0x1'));var moment=require(_0x11fe('0x2'));var BPromise=require(_0x11fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11fe('0x4'));var db=require(_0x11fe('0x5'))['db'];var utils=require(_0x11fe('0x6'));var logger=require(_0x11fe('0x7'))(_0x11fe('0x8'));var config=require(_0x11fe('0x9'));var jayson=require(_0x11fe('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6bc56b,_0x541edb,_0x44cea1){return new BPromise(function(_0x6064e9,_0x4e2353){return client[_0x11fe('0xb')](_0x6bc56b,_0x44cea1)[_0x11fe('0xc')](function(_0x2b1817){logger[_0x11fe('0xd')](_0x11fe('0xe'),_0x541edb,'request\x20sent');logger[_0x11fe('0xf')](_0x11fe('0x10'),_0x541edb,_0x11fe('0x11'),JSON[_0x11fe('0x12')](_0x2b1817));if(_0x2b1817['error']){if(_0x2b1817[_0x11fe('0x13')][_0x11fe('0x14')]===0x1f4){logger[_0x11fe('0x13')](_0x11fe('0xe'),_0x541edb,_0x2b1817[_0x11fe('0x13')][_0x11fe('0x15')]);return _0x4e2353(_0x2b1817['error'][_0x11fe('0x15')]);}logger[_0x11fe('0x13')](_0x11fe('0xe'),_0x541edb,_0x2b1817['error'][_0x11fe('0x15')]);return _0x6064e9(_0x2b1817[_0x11fe('0x13')][_0x11fe('0x15')]);}else{logger[_0x11fe('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x541edb,_0x11fe('0x11'));_0x6064e9(_0x2b1817[_0x11fe('0x16')][_0x11fe('0x15')]);}})[_0x11fe('0x17')](function(_0x41f47d){logger[_0x11fe('0x13')](_0x11fe('0xe'),_0x541edb,_0x41f47d);_0x4e2353(_0x41f47d);});});} \ No newline at end of file +var _0x5d78=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x81d395,_0x45d7a9){var _0xed9574=function(_0x3b9044){while(--_0x3b9044){_0x81d395['push'](_0x81d395['shift']());}};_0xed9574(++_0x45d7a9);}(_0x5d78,0x1d2));var _0x85d7=function(_0x4ac937,_0x13f2a0){_0x4ac937=_0x4ac937-0x0;var _0x53a0bd=_0x5d78[_0x4ac937];return _0x53a0bd;};'use strict';var _=require(_0x85d7('0x0'));var util=require(_0x85d7('0x1'));var moment=require(_0x85d7('0x2'));var BPromise=require(_0x85d7('0x3'));var rs=require(_0x85d7('0x4'));var fs=require('fs');var Redis=require(_0x85d7('0x5'));var db=require(_0x85d7('0x6'))['db'];var utils=require(_0x85d7('0x7'));var logger=require(_0x85d7('0x8'))(_0x85d7('0x9'));var config=require('../../config/environment');var jayson=require(_0x85d7('0xa'));var client=jayson[_0x85d7('0xb')][_0x85d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37b351,_0x2d63a5,_0x205e47){return new BPromise(function(_0x6ac8db,_0x2ec342){return client[_0x85d7('0xd')](_0x37b351,_0x205e47)['then'](function(_0x2266b9){logger['info'](_0x85d7('0xe'),_0x2d63a5,_0x85d7('0xf'));logger['debug'](_0x85d7('0x10'),_0x2d63a5,_0x85d7('0xf'),JSON[_0x85d7('0x11')](_0x2266b9));if(_0x2266b9[_0x85d7('0x12')]){if(_0x2266b9[_0x85d7('0x12')][_0x85d7('0x13')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2d63a5,_0x2266b9['error']['message']);return _0x2ec342(_0x2266b9['error'][_0x85d7('0x14')]);}logger['error'](_0x85d7('0xe'),_0x2d63a5,_0x2266b9[_0x85d7('0x12')]['message']);return _0x6ac8db(_0x2266b9[_0x85d7('0x12')][_0x85d7('0x14')]);}else{logger['info'](_0x85d7('0xe'),_0x2d63a5,_0x85d7('0xf'));_0x6ac8db(_0x2266b9[_0x85d7('0x15')][_0x85d7('0x14')]);}})[_0x85d7('0x16')](function(_0x1b5679){logger['error'](_0x85d7('0xe'),_0x2d63a5,_0x1b5679);_0x2ec342(_0x1b5679);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 40a46e5..90085e5 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(_0x311c35,_0x54a2b0){var _0x31ff65=function(_0x2efbe1){while(--_0x2efbe1){_0x311c35['push'](_0x311c35['shift']());}};_0x31ff65(++_0x54a2b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x17a8dd,_0x5d6331){var _0x1d370d=function(_0x722a79){while(--_0x722a79){_0x17a8dd['push'](_0x17a8dd['shift']());}};_0x1d370d(++_0x5d6331);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xcb91[_0x16b1a5];return _0x475e25;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d5509cb..426586e 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 _0x3e35=['STRING','sequelize','exports','INTEGER'];(function(_0x24afd3,_0xcc36f0){var _0xffe96f=function(_0x4f9cb0){while(--_0x4f9cb0){_0x24afd3['push'](_0x24afd3['shift']());}};_0xffe96f(++_0xcc36f0);}(_0x3e35,0x111));var _0x53e3=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x3e35[_0x79b649];return _0x1af9b1;};'use strict';var Sequelize=require(_0x53e3('0x0'));module[_0x53e3('0x1')]={'penalty':{'type':Sequelize[_0x53e3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x53e3('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x53e3('0x3')]}}; \ No newline at end of file +var _0xcdb4=['exports','STRING','sequelize'];(function(_0x58d16d,_0x4ece6f){var _0x223288=function(_0x2862b7){while(--_0x2862b7){_0x58d16d['push'](_0x58d16d['shift']());}};_0x223288(++_0x4ece6f);}(_0xcdb4,0x104));var _0x4cdb=function(_0x55e994,_0x188ba5){_0x55e994=_0x55e994-0x0;var _0x6d575=_0xcdb4[_0x55e994];return _0x6d575;};'use strict';var Sequelize=require(_0x4cdb('0x0'));module[_0x4cdb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4cdb('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9bb49c0..e5f1f88 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 _0x296c=['moment','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','lodash','../../config/logger','api'];(function(_0x5d246d,_0x8e46d5){var _0x1cfedf=function(_0x107058){while(--_0x107058){_0x5d246d['push'](_0x5d246d['shift']());}};_0x1cfedf(++_0x8e46d5);}(_0x296c,0xf7));var _0xc296=function(_0xbe6d85,_0x296fed){_0xbe6d85=_0xbe6d85-0x0;var _0x595074=_0x296c[_0xbe6d85];return _0x595074;};'use strict';var _=require(_0xc296('0x0'));var util=require('util');var logger=require(_0xc296('0x1'))(_0xc296('0x2'));var moment=require(_0xc296('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc296('0x4'));var rimraf=require(_0xc296('0x5'));var config=require(_0xc296('0x6'));var attributes=require(_0xc296('0x7'));module['exports']=function(_0xb12fbf,_0x33211b){return _0xb12fbf[_0xc296('0x8')](_0xc296('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe213=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xe56a1e,_0x39967a){var _0xd2443d=function(_0xda6b71){while(--_0xda6b71){_0xe56a1e['push'](_0xe56a1e['shift']());}};_0xd2443d(++_0x39967a);}(_0xe213,0x19b));var _0x3e21=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xe213[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x3e21('0x0'));var util=require(_0x3e21('0x1'));var logger=require(_0x3e21('0x2'))(_0x3e21('0x3'));var moment=require(_0x3e21('0x4'));var BPromise=require(_0x3e21('0x5'));var rp=require(_0x3e21('0x6'));var fs=require('fs');var path=require(_0x3e21('0x7'));var rimraf=require(_0x3e21('0x8'));var config=require(_0x3e21('0x9'));var attributes=require(_0x3e21('0xa'));module[_0x3e21('0xb')]=function(_0x3980f0,_0x6302ad){return _0x3980f0[_0x3e21('0xc')](_0x3e21('0xd'),attributes,{'tableName':_0x3e21('0xe'),'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 de575d8..df04731 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 _0xcef5=['client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x45694f,_0x4cd365){var _0x443ccd=function(_0x48ae72){while(--_0x48ae72){_0x45694f['push'](_0x45694f['shift']());}};_0x443ccd(++_0x4cd365);}(_0xcef5,0xf6));var _0x5cef=function(_0x27b521,_0x5bc532){_0x27b521=_0x27b521-0x0;var _0x1805f1=_0xcef5[_0x27b521];return _0x1805f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5cef('0x0'));var rs=require(_0x5cef('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cef('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cef('0x3'))('rpc');var config=require(_0x5cef('0x4'));var jayson=require(_0x5cef('0x5'));var client=jayson[_0x5cef('0x6')][_0x5cef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x368d5c,_0x4ca00e,_0x295f3b){return new BPromise(function(_0x3a3f1d,_0x1e3ef1){return client['request'](_0x368d5c,_0x295f3b)[_0x5cef('0x8')](function(_0x3f1dde){logger[_0x5cef('0x9')](_0x5cef('0xa'),_0x4ca00e,_0x5cef('0xb'));logger['debug'](_0x5cef('0xc'),_0x4ca00e,_0x5cef('0xb'),JSON[_0x5cef('0xd')](_0x3f1dde));if(_0x3f1dde['error']){if(_0x3f1dde[_0x5cef('0xe')][_0x5cef('0xf')]===0x1f4){logger[_0x5cef('0xe')](_0x5cef('0xa'),_0x4ca00e,_0x3f1dde[_0x5cef('0xe')][_0x5cef('0x10')]);return _0x1e3ef1(_0x3f1dde['error'][_0x5cef('0x10')]);}logger[_0x5cef('0xe')](_0x5cef('0xa'),_0x4ca00e,_0x3f1dde[_0x5cef('0xe')]['message']);return _0x3a3f1d(_0x3f1dde[_0x5cef('0xe')]['message']);}else{logger[_0x5cef('0x9')](_0x5cef('0xa'),_0x4ca00e,_0x5cef('0xb'));_0x3a3f1d(_0x3f1dde['result'][_0x5cef('0x10')]);}})[_0x5cef('0x11')](function(_0x39f29b){logger[_0x5cef('0xe')](_0x5cef('0xa'),_0x4ca00e,_0x39f29b);_0x1e3ef1(_0x39f29b);});});} \ No newline at end of file +var _0xa082=['jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x462c58,_0x16026f){var _0x967300=function(_0x3ad41c){while(--_0x3ad41c){_0x462c58['push'](_0x462c58['shift']());}};_0x967300(++_0x16026f);}(_0xa082,0x122));var _0x2a08=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa082[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x2a08('0x0'));var util=require('util');var moment=require(_0x2a08('0x1'));var BPromise=require(_0x2a08('0x2'));var rs=require(_0x2a08('0x3'));var fs=require('fs');var Redis=require(_0x2a08('0x4'));var db=require(_0x2a08('0x5'))['db'];var utils=require(_0x2a08('0x6'));var logger=require(_0x2a08('0x7'))(_0x2a08('0x8'));var config=require('../../config/environment');var jayson=require(_0x2a08('0x9'));var client=jayson[_0x2a08('0xa')][_0x2a08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b264d,_0x2546df,_0x8b5c38){return new BPromise(function(_0x38dfbf,_0x1fc913){return client[_0x2a08('0xc')](_0x2b264d,_0x8b5c38)[_0x2a08('0xd')](function(_0x2c98a4){logger[_0x2a08('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2546df,'request\x20sent');logger['debug'](_0x2a08('0xf'),_0x2546df,_0x2a08('0x10'),JSON['stringify'](_0x2c98a4));if(_0x2c98a4[_0x2a08('0x11')]){if(_0x2c98a4[_0x2a08('0x11')][_0x2a08('0x12')]===0x1f4){logger[_0x2a08('0x11')](_0x2a08('0x13'),_0x2546df,_0x2c98a4[_0x2a08('0x11')][_0x2a08('0x14')]);return _0x1fc913(_0x2c98a4[_0x2a08('0x11')][_0x2a08('0x14')]);}logger['error'](_0x2a08('0x13'),_0x2546df,_0x2c98a4[_0x2a08('0x11')][_0x2a08('0x14')]);return _0x38dfbf(_0x2c98a4[_0x2a08('0x11')]['message']);}else{logger['info'](_0x2a08('0x13'),_0x2546df,'request\x20sent');_0x38dfbf(_0x2c98a4[_0x2a08('0x15')]['message']);}})[_0x2a08('0x16')](function(_0x5e0724){logger[_0x2a08('0x11')](_0x2a08('0x13'),_0x2546df,_0x5e0724);_0x1fc913(_0x5e0724);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index bcbba0d..44c5356 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x15ada9,_0x50f0a2){var _0x587361=function(_0x332a97){while(--_0x332a97){_0x15ada9['push'](_0x15ada9['shift']());}};_0x587361(++_0x50f0a2);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47a4af,_0x4ef90b){var _0x25a0b1=function(_0x385630){while(--_0x385630){_0x47a4af['push'](_0x47a4af['shift']());}};_0x25a0b1(++_0x4ef90b);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2591699..d41bd10 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 _0xc777=['exports','sequelize'];(function(_0x9067c8,_0x386bdb){var _0x1f6f8a=function(_0x36d25c){while(--_0x36d25c){_0x9067c8['push'](_0x9067c8['shift']());}};_0x1f6f8a(++_0x386bdb);}(_0xc777,0x1b7));var _0x7c77=function(_0x50a0d0,_0x3c79b6){_0x50a0d0=_0x50a0d0-0x0;var _0x53e7a6=_0xc777[_0x50a0d0];return _0x53e7a6;};'use strict';var Sequelize=require(_0x7c77('0x0'));module[_0x7c77('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xece2=['sequelize','INTEGER'];(function(_0x1b948b,_0x5c0ad3){var _0x17a451=function(_0x143d58){while(--_0x143d58){_0x1b948b['push'](_0x1b948b['shift']());}};_0x17a451(++_0x5c0ad3);}(_0xece2,0x1f2));var _0x2ece=function(_0xa9478f,_0x3717ee){_0xa9478f=_0xa9478f-0x0;var _0x332c0a=_0xece2[_0xa9478f];return _0x332c0a;};'use strict';var Sequelize=require(_0x2ece('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2ece('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 5ae8fc7..3dfb6a4 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 _0x4ea3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','user_has_mail_queues','lodash'];(function(_0x2f34f2,_0x4f49d8){var _0x35f87d=function(_0x1b4e43){while(--_0x1b4e43){_0x2f34f2['push'](_0x2f34f2['shift']());}};_0x35f87d(++_0x4f49d8);}(_0x4ea3,0x9b));var _0x34ea=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4ea3[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x34ea('0x0'));var util=require('util');var logger=require(_0x34ea('0x1'))(_0x34ea('0x2'));var moment=require(_0x34ea('0x3'));var BPromise=require(_0x34ea('0x4'));var rp=require(_0x34ea('0x5'));var fs=require('fs');var path=require(_0x34ea('0x6'));var rimraf=require(_0x34ea('0x7'));var config=require(_0x34ea('0x8'));var attributes=require(_0x34ea('0x9'));module[_0x34ea('0xa')]=function(_0x9d704d,_0x143366){return _0x9d704d['define']('UserMailQueue',attributes,{'tableName':_0x34ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41d6=['bluebird','request-promise','path','../../config/environment','define','UserMailQueue','user_has_mail_queues','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x41d6,0x1c9));var _0x641d=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x41d6[_0x16b992];return _0x385c78;};'use strict';var _=require('lodash');var util=require(_0x641d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x641d('0x1'));var BPromise=require(_0x641d('0x2'));var rp=require(_0x641d('0x3'));var fs=require('fs');var path=require(_0x641d('0x4'));var rimraf=require('rimraf');var config=require(_0x641d('0x5'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x2eff03,_0x1b1d62){return _0x2eff03[_0x641d('0x6')](_0x641d('0x7'),attributes,{'tableName':_0x641d('0x8'),'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 75cc1b2..ecafe5c 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(_0x351b52,_0xfbd9ab){var _0x1db268=function(_0x36aab1){while(--_0x36aab1){_0x351b52['push'](_0x351b52['shift']());}};_0x1db268(++_0xfbd9ab);}(_0x6aa7,0x178));var _0x76aa=function(_0x1f6d0b,_0x591550){_0x1f6d0b=_0x1f6d0b-0x0;var _0x523380=_0x6aa7[_0x1f6d0b];return _0x523380;};'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 _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\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(_0x114abb,_0x12461f){var _0x2502b1=function(_0x84baf9){while(--_0x84baf9){_0x114abb['push'](_0x114abb['shift']());}};_0x2502b1(++_0x12461f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x7fbe[_0x26da89];return _0xc95b7b;};'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/userNotification/index.js b/server/api/userNotification/index.js index c9e518c..72d3fd1 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 _0x453c=['express','Router','fs-extra','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','multer','util','path','connect-timeout'];(function(_0x3d39e5,_0xc26f28){var _0x4e48ca=function(_0x2c8f9e){while(--_0x2c8f9e){_0x3d39e5['push'](_0x3d39e5['shift']());}};_0x4e48ca(++_0xc26f28);}(_0x453c,0x128));var _0xc453=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x453c[_0x12ca5f];return _0xfc3ae9;};'use strict';var multer=require(_0xc453('0x0'));var util=require(_0xc453('0x1'));var path=require(_0xc453('0x2'));var timeout=require(_0xc453('0x3'));var express=require(_0xc453('0x4'));var router=express[_0xc453('0x5')]();var fs_extra=require(_0xc453('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc453('0x7'));var controller=require(_0xc453('0x8'));router[_0xc453('0x9')]('/',auth[_0xc453('0xa')](),controller['sendUserNotification']);module[_0xc453('0xb')]=router; \ No newline at end of file +var _0x898f=['sendUserNotification','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated'];(function(_0x4f7de8,_0x22a44d){var _0x2b10b9=function(_0x48ab2d){while(--_0x48ab2d){_0x4f7de8['push'](_0x4f7de8['shift']());}};_0x2b10b9(++_0x22a44d);}(_0x898f,0x151));var _0xf898=function(_0x80260a,_0x22f959){_0x80260a=_0x80260a-0x0;var _0x53bd2f=_0x898f[_0x80260a];return _0x53bd2f;};'use strict';var multer=require(_0xf898('0x0'));var util=require(_0xf898('0x1'));var path=require('path');var timeout=require(_0xf898('0x2'));var express=require(_0xf898('0x3'));var router=express[_0xf898('0x4')]();var fs_extra=require(_0xf898('0x5'));var auth=require(_0xf898('0x6'));var interaction=require(_0xf898('0x7'));var config=require(_0xf898('0x8'));var controller=require('./userNotification.controller');router[_0xf898('0x9')]('/',auth[_0xf898('0xa')](),controller[_0xf898('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b500c8a..e98965c 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 _0xbc1c=['sequelize','exports','TEXT'];(function(_0x13323a,_0x281e09){var _0x2f7c92=function(_0x39b259){while(--_0x39b259){_0x13323a['push'](_0x13323a['shift']());}};_0x2f7c92(++_0x281e09);}(_0xbc1c,0x168));var _0xcbc1=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0xbc1c[_0x27b423];return _0x5c11b8;};'use strict';var Sequelize=require(_0xcbc1('0x0'));module[_0xcbc1('0x1')]={'body':{'type':Sequelize[_0xcbc1('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xcbc1('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xab3e=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xab3e,0xc3));var _0xeab3=function(_0x1a3ce1,_0x53014d){_0x1a3ce1=_0x1a3ce1-0x0;var _0x2ea09f=_0xab3e[_0x1a3ce1];return _0x2ea09f;};'use strict';var Sequelize=require(_0xeab3('0x0'));module[_0xeab3('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xeab3('0x2')]},'recipientsId':{'type':Sequelize[_0xeab3('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xeab3('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 69c42ca..5a52e0a 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 _0x16d8=['smsqueue','voicequeue','whatsappqueue','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','union','ids','queue','Queue','push','all','catch','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','sendStatus','error','stack','send','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x16d8,0x154));var _0x816d=function(_0x33475a,_0x46a6b8){_0x33475a=_0x33475a-0x0;var _0x327bb4=_0x16d8[_0x33475a];return _0x327bb4;};'use strict';var emlformat=require(_0x816d('0x0'));var rimraf=require(_0x816d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x816d('0x2'));var rp=require(_0x816d('0x3'));var moment=require(_0x816d('0x4'));var BPromise=require(_0x816d('0x5'));var Mustache=require(_0x816d('0x6'));var util=require(_0x816d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x816d('0x8'));var ejs=require(_0x816d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x816d('0xa'));var crypto=require('crypto');var jsforce=require(_0x816d('0xb'));var deskjs=require(_0x816d('0xc'));var toCsv=require(_0x816d('0x8'));var querystring=require(_0x816d('0xd'));var Papa=require(_0x816d('0xe'));var Redis=require(_0x816d('0xf'));var authService=require(_0x816d('0x10'));var qs=require(_0x816d('0x11'));var as=require(_0x816d('0x12'));var hardwareService=require(_0x816d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x816d('0x14'));var config=require(_0x816d('0x15'));var licenseUtil=require(_0x816d('0x16'));var db=require(_0x816d('0x17'))['db'];config['redis']=_[_0x816d('0x18')](config[_0x816d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x816d('0x1a'))(new Redis(config[_0x816d('0x19')]));require(_0x816d('0x1b'))[_0x816d('0x1c')](socket);function respondWithStatusCode(_0x16fca0,_0x552355){_0x552355=_0x552355||0xcc;return function(_0x489be8){if(_0x489be8){return _0x16fca0['sendStatus'](_0x552355);}return _0x16fca0[_0x816d('0x1d')](_0x552355)[_0x816d('0x1e')]();};}function respondWithResult(_0x9d74e6,_0x137ad0){_0x137ad0=_0x137ad0||0xc8;return function(_0x30d330){if(_0x30d330){return _0x9d74e6[_0x816d('0x1d')](_0x137ad0)[_0x816d('0x1f')](_0x30d330);}};}function respondWithFilteredResult(_0x1f3a4f,_0x9916de){return function(_0x4fd892){if(_0x4fd892){var _0xf631b3=typeof _0x9916de[_0x816d('0x20')]==='undefined'&&typeof _0x9916de['limit']===_0x816d('0x21');var _0x253864=_0x4fd892['count'];var _0x35caee=_0xf631b3?0x0:_0x9916de[_0x816d('0x20')];var _0x39103e=_0xf631b3?_0x4fd892[_0x816d('0x22')]:_0x9916de['offset']+_0x9916de[_0x816d('0x23')];var _0x3c32b2;if(_0x39103e>=_0x253864){_0x39103e=_0x253864;_0x3c32b2=0xc8;}else{_0x3c32b2=0xce;}_0x1f3a4f['status'](_0x3c32b2);return _0x1f3a4f['set'](_0x816d('0x24'),_0x35caee+'-'+_0x39103e+'/'+_0x253864)[_0x816d('0x1f')](_0x4fd892);}return null;};}function patchUpdates(_0x3aabbb){return function(_0xe591de){try{jsonpatch[_0x816d('0x25')](_0xe591de,_0x3aabbb,!![]);}catch(_0x3ac0dd){return BPromise['reject'](_0x3ac0dd);}return _0xe591de[_0x816d('0x26')]();};}function saveUpdates(_0x4507a9,_0x1824f0){return function(_0x49d030){if(_0x49d030){return _0x49d030['update'](_0x4507a9)[_0x816d('0x27')](function(_0x48df73){return _0x48df73;});}return null;};}function removeEntity(_0x3739cf,_0x20a7d4){return function(_0x30e943){if(_0x30e943){return _0x30e943[_0x816d('0x28')]()['then'](function(){_0x3739cf[_0x816d('0x1d')](0xcc)[_0x816d('0x1e')]();});}};}function handleEntityNotFound(_0x2977f8,_0x3d677f){return function(_0x2dfb7f){if(!_0x2dfb7f){_0x2977f8[_0x816d('0x29')](0x194);}return _0x2dfb7f;};}function handleError(_0x56a30c,_0x43aacd){_0x43aacd=_0x43aacd||0x1f4;return function(_0x43a609){logger[_0x816d('0x2a')](_0x43a609[_0x816d('0x2b')]);if(_0x43a609['name']){delete _0x43a609['name'];}_0x56a30c[_0x816d('0x1d')](_0x43aacd)[_0x816d('0x2c')](_0x43a609);};}exports[_0x816d('0x2d')]=function(_0x1278a1,_0x56c79e,_0x298fe5){if(!_0x1278a1['body']['hasOwnProperty']('text')&&!_0x1278a1[_0x816d('0x2e')][_0x816d('0x2f')]('TemplateId')){throw new db[(_0x816d('0x30'))][(_0x816d('0x31'))](_0x816d('0x32'));}else{if(_0x1278a1[_0x816d('0x2e')][_0x816d('0x2f')]('TemplateId')&&!_0x1278a1['body'][_0x816d('0x2f')](_0x816d('0x33'))){throw new db[(_0x816d('0x30'))][(_0x816d('0x31'))](_0x816d('0x34'));}if(!_0x1278a1[_0x816d('0x2e')][_0x816d('0x2f')](_0x816d('0x35'))){throw new db['Sequelize'][(_0x816d('0x31'))](_0x816d('0x36'));}else{try{var _0x3b60fd=JSON[_0x816d('0x37')](_0x1278a1['body']['recipients']);}catch(_0x3f4a68){logger['error'](_0x3f4a68);throw new db[(_0x816d('0x30'))][(_0x816d('0x31'))](_0x816d('0x38'));}var _0x5696e8=['chatqueue',_0x816d('0x39'),_0x816d('0x3a'),_0x816d('0x3b'),_0x816d('0x3c'),_0x816d('0x3d'),_0x816d('0x3e'),'team',_0x816d('0x3f')];if(_[_0x816d('0x40')](_0x3b60fd,function(_0xb64b01){return!_[_0x816d('0x41')](_0x5696e8,_0xb64b01[_0x816d('0x42')]['toLowerCase']());})){throw new db[(_0x816d('0x30'))][(_0x816d('0x31'))](_0x816d('0x43'));}}}var _0x14886e={};_0x14886e[_0x816d('0x44')]=_0x1278a1[_0x816d('0x2e')][_0x816d('0x2f')]('senderName')?_0x1278a1['body'][_0x816d('0x44')]:_0x1278a1[_0x816d('0x3f')]['fullname'];_0x14886e[_0x816d('0x45')]=_[_0x816d('0x46')](_0x1278a1[_0x816d('0x2e')][_0x816d('0x45')])?null:_0x1278a1['body'][_0x816d('0x45')];_0x14886e[_0x816d('0x47')]=_0x1278a1[_0x816d('0x2e')]['beep']||![];_0x14886e[_0x816d('0x48')]=_0x1278a1[_0x816d('0x3f')]['id'];return getContent(_0x1278a1[_0x816d('0x2e')])['then'](function(_0x41ddff){_0x14886e['body']=_0x41ddff;return getRecipients(_0x3b60fd);})[_0x816d('0x27')](function(_0x2fb318){_0x14886e[_0x816d('0x49')]=_[_0x816d('0x4a')](_0x2fb318)[_0x816d('0x4b')](',');return db[_0x816d('0x4c')][_0x816d('0x4d')](function(_0x2b7055){return db['UserNotification']['create'](_0x14886e,{'raw':!![],'transaction':_0x2b7055})[_0x816d('0x27')](function(_0x5d876b){var _0x4be341={'sender':_0x14886e[_0x816d('0x44')],'description':_0x14886e[_0x816d('0x45')],'content':_0x14886e[_0x816d('0x2e')],'beep':_0x14886e[_0x816d('0x47')]};_0x2fb318[_0x816d('0x4e')](function(_0x3609e4){_0x4be341[_0x816d('0x4f')]=_0x3609e4;socket[_0x816d('0x50')](_0x816d('0x51'),_0x4be341);});return _0x5d876b;});});})[_0x816d('0x27')](respondWithResult(_0x56c79e,0xc9))['catch'](handleError(_0x56c79e,null));};function getContent(_0x322f10){return new BPromise(function(_0x97d336,_0x371eaa){if(_0x322f10['text']){_0x97d336(_0x322f10[_0x816d('0x52')]);return;}return db[_0x816d('0x53')][_0x816d('0x54')]({'attributes':[_0x816d('0x55')],'where':{'id':_0x322f10[_0x816d('0x56')]},'raw':!![]})[_0x816d('0x27')](function(_0x3a9122){if(!_0x3a9122)throw new db[(_0x816d('0x30'))][(_0x816d('0x31'))](_0x816d('0x57'));var _0x3fa9c8=Mustache[_0x816d('0x58')](_0x3a9122[_0x816d('0x55')],_0x322f10['view']);_0x97d336(_0x3fa9c8);})['catch'](function(_0x123af3){_0x371eaa(_0x123af3);});});}function getRecipients(_0x2d2f7a){return new BPromise(function(_0x3f4ab0,_0x4e73a4){var _0x45a622=[];var _0x3fd646=[];_0x2d2f7a[_0x816d('0x4e')](function(_0x49eea7){var _0x42a29a=_[_0x816d('0x59')](_0x49eea7[_0x816d('0x42')][_0x816d('0x5a')]());if(_0x42a29a==='User'){_0x45a622=_[_0x816d('0x5b')](_0x45a622,_0x49eea7[_0x816d('0x5c')]);}else{if(_[_0x816d('0x41')](_0x42a29a,'queue'))_0x42a29a=_0x42a29a['replace'](_0x816d('0x5d'),_0x816d('0x5e'));_0x49eea7[_0x816d('0x5c')][_0x816d('0x4e')](function(_0x25a82e){_0x3fd646[_0x816d('0x5f')](getAgents(_0x42a29a,_0x25a82e));});}});return BPromise[_0x816d('0x60')](_0x3fd646)[_0x816d('0x27')](function(_0x110606){_0x45a622=_[_0x816d('0x5b')](_0x45a622,_['flatten'](_0x110606));_0x3f4ab0(_0x45a622);})[_0x816d('0x61')](function(_0x1c6952){_0x4e73a4(_0x1c6952);});});}function getAgents(_0x47a47b,_0x4552c2){return new BPromise(function(_0x4293b5,_0x4e3af2){return db[_0x47a47b]['findOne']({'where':{'id':_0x4552c2}})['then'](function(_0x23adfb){return _0x23adfb[_0x816d('0x62')]({'attributes':['id'],'raw':!![]})[_0x816d('0x27')](function(_0x5cb5b0){var _0x1bb7df=_[_0x816d('0x63')](_0x5cb5b0,'id');_0x4293b5(_0x1bb7df);});})['catch'](function(_0x3e7fa6){_0x4e3af2(_0x3e7fa6);});});} \ No newline at end of file +var _0x4593=['status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','catch','Template','findOne','render','html','startCase','User','union','ids','queue','Queue','push','all','getAgents','map','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register'];(function(_0x3383b1,_0x4866e8){var _0x1f0df1=function(_0x2e3f89){while(--_0x2e3f89){_0x3383b1['push'](_0x3383b1['shift']());}};_0x1f0df1(++_0x4866e8);}(_0x4593,0x10d));var _0x3459=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0x4593[_0x9c8b4a];return _0x198bef;};'use strict';var emlformat=require(_0x3459('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3459('0x1'));var moment=require(_0x3459('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3459('0x3'));var util=require('util');var path=require(_0x3459('0x4'));var sox=require(_0x3459('0x5'));var csv=require(_0x3459('0x6'));var ejs=require(_0x3459('0x7'));var fs=require('fs');var fs_extra=require(_0x3459('0x8'));var _=require('lodash');var squel=require(_0x3459('0x9'));var crypto=require(_0x3459('0xa'));var jsforce=require(_0x3459('0xb'));var deskjs=require(_0x3459('0xc'));var toCsv=require(_0x3459('0x6'));var querystring=require('querystring');var Papa=require(_0x3459('0xd'));var Redis=require(_0x3459('0xe'));var authService=require(_0x3459('0xf'));var qs=require(_0x3459('0x10'));var as=require(_0x3459('0x11'));var hardwareService=require(_0x3459('0x12'));var logger=require(_0x3459('0x13'))(_0x3459('0x14'));var utils=require('../../config/utils');var config=require(_0x3459('0x15'));var licenseUtil=require(_0x3459('0x16'));var db=require(_0x3459('0x17'))['db'];config[_0x3459('0x18')]=_['defaults'](config[_0x3459('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3459('0x19'))(new Redis(config['redis']));require(_0x3459('0x1a'))[_0x3459('0x1b')](socket);function respondWithStatusCode(_0x1f4e89,_0x2cd344){_0x2cd344=_0x2cd344||0xcc;return function(_0x3483bc){if(_0x3483bc){return _0x1f4e89['sendStatus'](_0x2cd344);}return _0x1f4e89[_0x3459('0x1c')](_0x2cd344)[_0x3459('0x1d')]();};}function respondWithResult(_0x51e304,_0x8a15c4){_0x8a15c4=_0x8a15c4||0xc8;return function(_0x25b715){if(_0x25b715){return _0x51e304[_0x3459('0x1c')](_0x8a15c4)['json'](_0x25b715);}};}function respondWithFilteredResult(_0xb7d8e1,_0x39e991){return function(_0x357617){if(_0x357617){var _0x51bbbb=typeof _0x39e991[_0x3459('0x1e')]===_0x3459('0x1f')&&typeof _0x39e991[_0x3459('0x20')]==='undefined';var _0x329881=_0x357617[_0x3459('0x21')];var _0x6ea335=_0x51bbbb?0x0:_0x39e991['offset'];var _0x25c3a2=_0x51bbbb?_0x357617[_0x3459('0x21')]:_0x39e991[_0x3459('0x1e')]+_0x39e991[_0x3459('0x20')];var _0x4f79eb;if(_0x25c3a2>=_0x329881){_0x25c3a2=_0x329881;_0x4f79eb=0xc8;}else{_0x4f79eb=0xce;}_0xb7d8e1[_0x3459('0x1c')](_0x4f79eb);return _0xb7d8e1[_0x3459('0x22')](_0x3459('0x23'),_0x6ea335+'-'+_0x25c3a2+'/'+_0x329881)[_0x3459('0x24')](_0x357617);}return null;};}function patchUpdates(_0x511e52){return function(_0x59e9ad){try{jsonpatch['apply'](_0x59e9ad,_0x511e52,!![]);}catch(_0x53c853){return BPromise[_0x3459('0x25')](_0x53c853);}return _0x59e9ad[_0x3459('0x26')]();};}function saveUpdates(_0xc57a6e,_0x301dd2){return function(_0x473933){if(_0x473933){return _0x473933[_0x3459('0x27')](_0xc57a6e)[_0x3459('0x28')](function(_0xc96821){return _0xc96821;});}return null;};}function removeEntity(_0x1a0bee,_0x259c75){return function(_0x4e1bc0){if(_0x4e1bc0){return _0x4e1bc0['destroy']()[_0x3459('0x28')](function(){_0x1a0bee['status'](0xcc)[_0x3459('0x1d')]();});}};}function handleEntityNotFound(_0x2fecbd,_0xc5d4a1){return function(_0x5a22b2){if(!_0x5a22b2){_0x2fecbd['sendStatus'](0x194);}return _0x5a22b2;};}function handleError(_0x1f49fd,_0x9f27cc){_0x9f27cc=_0x9f27cc||0x1f4;return function(_0x247bad){logger[_0x3459('0x29')](_0x247bad[_0x3459('0x2a')]);if(_0x247bad[_0x3459('0x2b')]){delete _0x247bad[_0x3459('0x2b')];}_0x1f49fd['status'](_0x9f27cc)[_0x3459('0x2c')](_0x247bad);};}exports['sendUserNotification']=function(_0xcff0df,_0x128ca7,_0x4aab64){if(!_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')](_0x3459('0x2f'))&&!_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')](_0x3459('0x30'))){throw new db[(_0x3459('0x31'))][(_0x3459('0x32'))](_0x3459('0x33'));}else{if(_0xcff0df[_0x3459('0x2d')]['hasOwnProperty'](_0x3459('0x30'))&&!_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')](_0x3459('0x34'))){throw new db[(_0x3459('0x31'))][(_0x3459('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')](_0x3459('0x35'))){throw new db[(_0x3459('0x31'))][(_0x3459('0x32'))](_0x3459('0x36'));}else{try{var _0x437185=JSON[_0x3459('0x37')](_0xcff0df['body']['recipients']);}catch(_0x11d785){logger[_0x3459('0x29')](_0x11d785);throw new db[(_0x3459('0x31'))][(_0x3459('0x32'))](_0x3459('0x38'));}var _0xbde364=['chatqueue',_0x3459('0x39'),_0x3459('0x3a'),_0x3459('0x3b'),_0x3459('0x3c'),'voicequeue',_0x3459('0x3d'),_0x3459('0x3e'),_0x3459('0x3f')];if(_[_0x3459('0x40')](_0x437185,function(_0x1b4282){return!_[_0x3459('0x41')](_0xbde364,_0x1b4282[_0x3459('0x42')][_0x3459('0x43')]());})){throw new db['Sequelize'][(_0x3459('0x32'))](_0x3459('0x44'));}}}var _0x3040c1={};_0x3040c1[_0x3459('0x45')]=_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')]('senderName')?_0xcff0df[_0x3459('0x2d')][_0x3459('0x45')]:_0xcff0df[_0x3459('0x3f')][_0x3459('0x46')];_0x3040c1[_0x3459('0x47')]=_[_0x3459('0x48')](_0xcff0df[_0x3459('0x2d')][_0x3459('0x47')])?null:_0xcff0df[_0x3459('0x2d')][_0x3459('0x47')];_0x3040c1[_0x3459('0x49')]=_0xcff0df['body'][_0x3459('0x49')]||![];_0x3040c1[_0x3459('0x4a')]=_0xcff0df[_0x3459('0x3f')]['id'];return getContent(_0xcff0df['body'])[_0x3459('0x28')](function(_0x39f3c2){_0x3040c1['body']=_0x39f3c2;return getRecipients(_0x437185);})[_0x3459('0x28')](function(_0x5bd214){_0x3040c1[_0x3459('0x4b')]=_[_0x3459('0x4c')](_0x5bd214)[_0x3459('0x4d')](',');return db[_0x3459('0x4e')][_0x3459('0x4f')](function(_0x4b7408){return db['UserNotification'][_0x3459('0x50')](_0x3040c1,{'raw':!![],'transaction':_0x4b7408})[_0x3459('0x28')](function(_0x47692d){var _0x58b2fa={'sender':_0x3040c1['senderName'],'description':_0x3040c1[_0x3459('0x47')],'content':_0x3040c1['body'],'beep':_0x3040c1[_0x3459('0x49')]};_0x5bd214[_0x3459('0x51')](function(_0x5922f7){_0x58b2fa[_0x3459('0x52')]=_0x5922f7;socket[_0x3459('0x53')]('userNotification:send',_0x58b2fa);});return _0x47692d;});});})[_0x3459('0x28')](respondWithResult(_0x128ca7,0xc9))[_0x3459('0x54')](handleError(_0x128ca7,null));};function getContent(_0x4be2d3){return new BPromise(function(_0xf6ad8,_0xf94651){if(_0x4be2d3['text']){_0xf6ad8(_0x4be2d3['text']);return;}return db[_0x3459('0x55')][_0x3459('0x56')]({'attributes':['html'],'where':{'id':_0x4be2d3[_0x3459('0x30')]},'raw':!![]})[_0x3459('0x28')](function(_0x442892){if(!_0x442892)throw new db['Sequelize'][(_0x3459('0x32'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3656b2=Mustache[_0x3459('0x57')](_0x442892[_0x3459('0x58')],_0x4be2d3[_0x3459('0x34')]);_0xf6ad8(_0x3656b2);})[_0x3459('0x54')](function(_0x39b34e){_0xf94651(_0x39b34e);});});}function getRecipients(_0x3312a7){return new BPromise(function(_0x7b76c3,_0x132db0){var _0x82f23b=[];var _0x475cb2=[];_0x3312a7[_0x3459('0x51')](function(_0x57c534){var _0x187e4b=_[_0x3459('0x59')](_0x57c534[_0x3459('0x42')][_0x3459('0x43')]());if(_0x187e4b===_0x3459('0x5a')){_0x82f23b=_[_0x3459('0x5b')](_0x82f23b,_0x57c534[_0x3459('0x5c')]);}else{if(_['includes'](_0x187e4b,'queue'))_0x187e4b=_0x187e4b['replace'](_0x3459('0x5d'),_0x3459('0x5e'));_0x57c534[_0x3459('0x5c')][_0x3459('0x51')](function(_0x26481d){_0x475cb2[_0x3459('0x5f')](getAgents(_0x187e4b,_0x26481d));});}});return BPromise[_0x3459('0x60')](_0x475cb2)[_0x3459('0x28')](function(_0x5c706b){_0x82f23b=_[_0x3459('0x5b')](_0x82f23b,_['flatten'](_0x5c706b));_0x7b76c3(_0x82f23b);})[_0x3459('0x54')](function(_0x1b2715){_0x132db0(_0x1b2715);});});}function getAgents(_0x5e00f6,_0x55e8e3){return new BPromise(function(_0x587913,_0x75be59){return db[_0x5e00f6][_0x3459('0x56')]({'where':{'id':_0x55e8e3}})[_0x3459('0x28')](function(_0x111dc9){return _0x111dc9[_0x3459('0x61')]({'attributes':['id'],'raw':!![]})[_0x3459('0x28')](function(_0x31e37f){var _0x1fc7ab=_[_0x3459('0x62')](_0x31e37f,'id');_0x587913(_0x1fc7ab);});})[_0x3459('0x54')](function(_0x47091d){_0x75be59(_0x47091d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9b00be9..dd5b52d 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 _0x03da=['emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x03da,0xd1));var _0xa03d=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x03da[_0x42c118];return _0x112ebd;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xa03d('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x337e24){return function(_0x503b4c,_0x558754,_0x4d8abd){UserNotificationEvents[_0xa03d('0x1')](_0x337e24+':'+_0x503b4c['id'],_0x503b4c);UserNotificationEvents[_0xa03d('0x1')](_0x337e24,_0x503b4c);_0x4d8abd(null);};}for(var e in events){if(events[_0xa03d('0x2')](e)){var event=events[e];UserNotification[_0xa03d('0x3')](e,emitEvent(event));}}module[_0xa03d('0x4')]=UserNotificationEvents; \ No newline at end of file +var _0x8023=['save','remove','emit','hasOwnProperty','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x2fb98a,_0x28ceb6){var _0x5f561a=function(_0x53fb19){while(--_0x53fb19){_0x2fb98a['push'](_0x2fb98a['shift']());}};_0x5f561a(++_0x28ceb6);}(_0x8023,0x1e5));var _0x3802=function(_0x1d6e03,_0x392652){_0x1d6e03=_0x1d6e03-0x0;var _0x5179cb=_0x8023[_0x1d6e03];return _0x5179cb;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x3802('0x0'))['db'][_0x3802('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3802('0x2')](0x0);var events={'afterCreate':_0x3802('0x3'),'afterUpdate':'update','afterDestroy':_0x3802('0x4')};function emitEvent(_0x26e246){return function(_0x13bd35,_0x16de33,_0x231931){UserNotificationEvents[_0x3802('0x5')](_0x26e246+':'+_0x13bd35['id'],_0x13bd35);UserNotificationEvents['emit'](_0x26e246,_0x13bd35);_0x231931(null);};}for(var e in events){if(events[_0x3802('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x3802('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 35ea7e4..3aa4512 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 _0x6eaf=['./userNotification.attributes','UserNotification','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','rimraf'];(function(_0x35c571,_0x33e0b1){var _0x22cf8d=function(_0xa7a205){while(--_0xa7a205){_0x35c571['push'](_0x35c571['shift']());}};_0x22cf8d(++_0x33e0b1);}(_0x6eaf,0x1d8));var _0xf6ea=function(_0x117b5d,_0x7adf5c){_0x117b5d=_0x117b5d-0x0;var _0x199c3d=_0x6eaf[_0x117b5d];return _0x199c3d;};'use strict';var _=require('lodash');var util=require(_0xf6ea('0x0'));var logger=require(_0xf6ea('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf6ea('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6ea('0x3'));var rimraf=require(_0xf6ea('0x4'));var config=require('../../config/environment');var attributes=require(_0xf6ea('0x5'));module['exports']=function(_0x22949d,_0x3fe7c0){return _0x22949d['define'](_0xf6ea('0x6'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6ea('0x7'),'collate':_0xf6ea('0x8')});}; \ No newline at end of file +var _0xb748=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x33795f,_0x1952ab){var _0x243f54=function(_0x2fb2e4){while(--_0x2fb2e4){_0x33795f['push'](_0x33795f['shift']());}};_0x243f54(++_0x1952ab);}(_0xb748,0x1c7));var _0x8b74=function(_0x4d8247,_0xc819ab){_0x4d8247=_0x4d8247-0x0;var _0x3dc9ff=_0xb748[_0x4d8247];return _0x3dc9ff;};'use strict';var _=require(_0x8b74('0x0'));var util=require(_0x8b74('0x1'));var logger=require('../../config/logger')(_0x8b74('0x2'));var moment=require(_0x8b74('0x3'));var BPromise=require(_0x8b74('0x4'));var rp=require(_0x8b74('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b74('0x6'));var config=require(_0x8b74('0x7'));var attributes=require('./userNotification.attributes');module[_0x8b74('0x8')]=function(_0x22139c,_0x5388e1){return _0x22139c[_0x8b74('0x9')](_0x8b74('0xa'),attributes,{'tableName':_0x8b74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b74('0xc'),'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 8ad7a3a..c088675 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 _0x9fee=['redis','defaults','socket.io-emitter','./userNotification.socket','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x2482d6,_0x4f4e47){var _0x578839=function(_0x45132c){while(--_0x45132c){_0x2482d6['push'](_0x2482d6['shift']());}};_0x578839(++_0x4f4e47);}(_0x9fee,0x1f0));var _0xe9fe=function(_0x51e902,_0xacf919){_0x51e902=_0x51e902-0x0;var _0x3e328d=_0x9fee[_0x51e902];return _0x3e328d;};'use strict';var _=require('lodash');var util=require(_0xe9fe('0x0'));var moment=require(_0xe9fe('0x1'));var BPromise=require(_0xe9fe('0x2'));var rs=require(_0xe9fe('0x3'));var fs=require('fs');var Redis=require(_0xe9fe('0x4'));var db=require(_0xe9fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9fe('0x6'));var config=require(_0xe9fe('0x7'));var jayson=require(_0xe9fe('0x8'));var client=jayson['client'][_0xe9fe('0x9')]({'port':0x232a});config[_0xe9fe('0xa')]=_[_0xe9fe('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe9fe('0xc'))(new Redis(config[_0xe9fe('0xa')]));require(_0xe9fe('0xd'))['register'](socket);function respondWithRpcPromise(_0x52b516,_0x139a86,_0x4688c4){return new BPromise(function(_0x46599a,_0x1d2f6a){return client['request'](_0x52b516,_0x4688c4)[_0xe9fe('0xe')](function(_0x458e71){logger[_0xe9fe('0xf')](_0xe9fe('0x10'),_0x139a86,_0xe9fe('0x11'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x139a86,'request\x20sent',JSON[_0xe9fe('0x12')](_0x458e71));if(_0x458e71[_0xe9fe('0x13')]){if(_0x458e71['error'][_0xe9fe('0x14')]===0x1f4){logger[_0xe9fe('0x13')](_0xe9fe('0x10'),_0x139a86,_0x458e71[_0xe9fe('0x13')]['message']);return _0x1d2f6a(_0x458e71[_0xe9fe('0x13')]['message']);}logger[_0xe9fe('0x13')](_0xe9fe('0x10'),_0x139a86,_0x458e71['error']['message']);return _0x46599a(_0x458e71[_0xe9fe('0x13')][_0xe9fe('0x15')]);}else{logger[_0xe9fe('0xf')](_0xe9fe('0x10'),_0x139a86,_0xe9fe('0x11'));_0x46599a(_0x458e71[_0xe9fe('0x16')][_0xe9fe('0x15')]);}})['catch'](function(_0x36a456){logger[_0xe9fe('0x13')]('UserNotification,\x20%s,\x20%s',_0x139a86,_0x36a456);_0x1d2f6a(_0x36a456);});});} \ No newline at end of file +var _0x1908=['defaults','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x346f5a,_0x33de62){var _0x2c1254=function(_0x20c734){while(--_0x20c734){_0x346f5a['push'](_0x346f5a['shift']());}};_0x2c1254(++_0x33de62);}(_0x1908,0x6d));var _0x8190=function(_0x344cdb,_0x5f1dd5){_0x344cdb=_0x344cdb-0x0;var _0x181706=_0x1908[_0x344cdb];return _0x181706;};'use strict';var _=require(_0x8190('0x0'));var util=require(_0x8190('0x1'));var moment=require(_0x8190('0x2'));var BPromise=require(_0x8190('0x3'));var rs=require(_0x8190('0x4'));var fs=require('fs');var Redis=require(_0x8190('0x5'));var db=require(_0x8190('0x6'))['db'];var utils=require(_0x8190('0x7'));var logger=require(_0x8190('0x8'))(_0x8190('0x9'));var config=require(_0x8190('0xa'));var jayson=require(_0x8190('0xb'));var client=jayson[_0x8190('0xc')][_0x8190('0xd')]({'port':0x232a});config[_0x8190('0xe')]=_[_0x8190('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8190('0x10'))(new Redis(config['redis']));require('./userNotification.socket')[_0x8190('0x11')](socket);function respondWithRpcPromise(_0x53402a,_0x3873ab,_0x1da6e8){return new BPromise(function(_0x55b4ac,_0x390ec9){return client[_0x8190('0x12')](_0x53402a,_0x1da6e8)[_0x8190('0x13')](function(_0x33a9d9){logger[_0x8190('0x14')](_0x8190('0x15'),_0x3873ab,_0x8190('0x16'));logger[_0x8190('0x17')](_0x8190('0x18'),_0x3873ab,'request\x20sent',JSON[_0x8190('0x19')](_0x33a9d9));if(_0x33a9d9[_0x8190('0x1a')]){if(_0x33a9d9[_0x8190('0x1a')][_0x8190('0x1b')]===0x1f4){logger[_0x8190('0x1a')](_0x8190('0x15'),_0x3873ab,_0x33a9d9[_0x8190('0x1a')][_0x8190('0x1c')]);return _0x390ec9(_0x33a9d9[_0x8190('0x1a')]['message']);}logger[_0x8190('0x1a')](_0x8190('0x15'),_0x3873ab,_0x33a9d9[_0x8190('0x1a')][_0x8190('0x1c')]);return _0x55b4ac(_0x33a9d9[_0x8190('0x1a')]['message']);}else{logger[_0x8190('0x14')]('UserNotification,\x20%s,\x20%s',_0x3873ab,_0x8190('0x16'));_0x55b4ac(_0x33a9d9[_0x8190('0x1d')][_0x8190('0x1c')]);}})[_0x8190('0x1e')](function(_0x58990a){logger[_0x8190('0x1a')](_0x8190('0x15'),_0x3873ab,_0x58990a);_0x390ec9(_0x58990a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 839871b..0e28f7e 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 _0xeed2=['userNotification:','./userNotification.events','save','emit','removeListener','register'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeed2,0xbb));var _0x2eed=function(_0x1e4d5a,_0x2fcfd5){_0x1e4d5a=_0x1e4d5a-0x0;var _0x1605ce=_0xeed2[_0x1e4d5a];return _0x1605ce;};'use strict';var UserNotificationEvents=require(_0x2eed('0x0'));var events=[_0x2eed('0x1'),'remove','update'];function createListener(_0x4da438,_0x3aac31){return function(_0x408e44){_0x3aac31[_0x2eed('0x2')](_0x4da438,_0x408e44);};}function removeListener(_0x45a689,_0x1e5fd2){return function(){UserNotificationEvents[_0x2eed('0x3')](_0x45a689,_0x1e5fd2);};}exports[_0x2eed('0x4')]=function(_0x4802ad){for(var _0x5e4353=0x0,_0x3d74ee=events['length'];_0x5e4353<_0x3d74ee;_0x5e4353++){var _0x4bea15=events[_0x5e4353];var _0x9f2b4e=createListener(_0x2eed('0x5')+_0x4bea15,_0x4802ad);UserNotificationEvents['on'](_0x4bea15,_0x9f2b4e);}}; \ No newline at end of file +var _0x3acf=['./userNotification.events','save','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x3acf,0xcf));var _0xf3ac=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x3acf[_0x55821d];return _0x58ea8a;};'use strict';var UserNotificationEvents=require(_0xf3ac('0x0'));var events=[_0xf3ac('0x1'),_0xf3ac('0x2'),_0xf3ac('0x3')];function createListener(_0x14a841,_0x1efd0d){return function(_0x3249e4){_0x1efd0d[_0xf3ac('0x4')](_0x14a841,_0x3249e4);};}function removeListener(_0x1e01d1,_0x500e80){return function(){UserNotificationEvents[_0xf3ac('0x5')](_0x1e01d1,_0x500e80);};}exports[_0xf3ac('0x6')]=function(_0x56781e){for(var _0x3bc75f=0x0,_0x1986fe=events[_0xf3ac('0x7')];_0x3bc75f<_0x1986fe;_0x3bc75f++){var _0x531bc4=events[_0x3bc75f];var _0x59613f=createListener(_0xf3ac('0x8')+_0x531bc4,_0x56781e);UserNotificationEvents['on'](_0x531bc4,_0x59613f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d55efb1..df13033 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x23f990,_0x2ea554){var _0x26220d=function(_0x5beb5d){while(--_0x5beb5d){_0x23f990['push'](_0x23f990['shift']());}};_0x26220d(++_0x2ea554);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x481778,_0x3591a2){var _0x180616=function(_0x21c66b){while(--_0x21c66b){_0x481778['push'](_0x481778['shift']());}};_0x180616(++_0x3591a2);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0f68000..1eadb64 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 _0x6379=['sequelize','exports','INTEGER'];(function(_0x3db1db,_0x210653){var _0x4e8a72=function(_0x30bd88){while(--_0x30bd88){_0x3db1db['push'](_0x3db1db['shift']());}};_0x4e8a72(++_0x210653);}(_0x6379,0x84));var _0x9637=function(_0x3f0c06,_0x3d0ecf){_0x3f0c06=_0x3f0c06-0x0;var _0x507d9f=_0x6379[_0x3f0c06];return _0x507d9f;};'use strict';var Sequelize=require(_0x9637('0x0'));module[_0x9637('0x1')]={'penalty':{'type':Sequelize[_0x9637('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20ae=['sequelize','exports'];(function(_0x28a594,_0x4a8ddf){var _0x4db9f5=function(_0x2e2cce){while(--_0x2e2cce){_0x28a594['push'](_0x28a594['shift']());}};_0x4db9f5(++_0x4a8ddf);}(_0x20ae,0x120));var _0xe20a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x20ae[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xe20a('0x0'));module[_0xe20a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 857d834..3c7c0e0 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 _0x9d92=['api','moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','lodash','util','../../config/logger'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9d92,0x105));var _0x29d9=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x9d92[_0x77773a];return _0x1091a2;};'use strict';var _=require(_0x29d9('0x0'));var util=require(_0x29d9('0x1'));var logger=require(_0x29d9('0x2'))(_0x29d9('0x3'));var moment=require(_0x29d9('0x4'));var BPromise=require(_0x29d9('0x5'));var rp=require(_0x29d9('0x6'));var fs=require('fs');var path=require(_0x29d9('0x7'));var rimraf=require('rimraf');var config=require(_0x29d9('0x8'));var attributes=require(_0x29d9('0x9'));module['exports']=function(_0x31f424,_0x1e25a2){return _0x31f424['define'](_0x29d9('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdf9=['user_has_openchannel_queues','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0xd820ed,_0x2eeaa6){var _0x11a8ad=function(_0x2086a8){while(--_0x2086a8){_0xd820ed['push'](_0xd820ed['shift']());}};_0x11a8ad(++_0x2eeaa6);}(_0xcdf9,0x196));var _0x9cdf=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0xcdf9[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x9cdf('0x0'));var util=require(_0x9cdf('0x1'));var logger=require(_0x9cdf('0x2'))(_0x9cdf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9cdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cdf('0x5'));var config=require(_0x9cdf('0x6'));var attributes=require(_0x9cdf('0x7'));module['exports']=function(_0x3ecda9,_0x56f751){return _0x3ecda9['define']('UserOpenchannelQueue',attributes,{'tableName':_0x9cdf('0x8'),'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 67de45f..7f26724 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 _0x8d06=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x37b02b,_0x269e38){var _0x1f7eb8=function(_0x4e4afb){while(--_0x4e4afb){_0x37b02b['push'](_0x37b02b['shift']());}};_0x1f7eb8(++_0x269e38);}(_0x8d06,0xd7));var _0x68d0=function(_0x1a95eb,_0x280179){_0x1a95eb=_0x1a95eb-0x0;var _0x4027bc=_0x8d06[_0x1a95eb];return _0x4027bc;};'use strict';var _=require('lodash');var util=require(_0x68d0('0x0'));var moment=require(_0x68d0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68d0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x68d0('0x3'));var logger=require(_0x68d0('0x4'))(_0x68d0('0x5'));var config=require(_0x68d0('0x6'));var jayson=require(_0x68d0('0x7'));var client=jayson[_0x68d0('0x8')][_0x68d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44cf51,_0x5aacfe,_0x4cd9dc){return new BPromise(function(_0x502f76,_0x313102){return client[_0x68d0('0xa')](_0x44cf51,_0x4cd9dc)[_0x68d0('0xb')](function(_0x2d7368){logger[_0x68d0('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5aacfe,_0x68d0('0xd'));logger['debug'](_0x68d0('0xe'),_0x5aacfe,'request\x20sent',JSON[_0x68d0('0xf')](_0x2d7368));if(_0x2d7368['error']){if(_0x2d7368[_0x68d0('0x10')][_0x68d0('0x11')]===0x1f4){logger[_0x68d0('0x10')](_0x68d0('0x12'),_0x5aacfe,_0x2d7368[_0x68d0('0x10')][_0x68d0('0x13')]);return _0x313102(_0x2d7368['error'][_0x68d0('0x13')]);}logger[_0x68d0('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5aacfe,_0x2d7368[_0x68d0('0x10')][_0x68d0('0x13')]);return _0x502f76(_0x2d7368[_0x68d0('0x10')][_0x68d0('0x13')]);}else{logger[_0x68d0('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5aacfe,_0x68d0('0xd'));_0x502f76(_0x2d7368[_0x68d0('0x14')]['message']);}})[_0x68d0('0x15')](function(_0xe410cf){logger[_0x68d0('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5aacfe,_0xe410cf);_0x313102(_0xe410cf);});});} \ No newline at end of file +var _0xb8a4=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x5433c1,_0x345879){var _0x5849f2=function(_0x4562ac){while(--_0x4562ac){_0x5433c1['push'](_0x5433c1['shift']());}};_0x5849f2(++_0x345879);}(_0xb8a4,0x182));var _0x4b8a=function(_0x58bf72,_0x270672){_0x58bf72=_0x58bf72-0x0;var _0x5ac3aa=_0xb8a4[_0x58bf72];return _0x5ac3aa;};'use strict';var _=require(_0x4b8a('0x0'));var util=require(_0x4b8a('0x1'));var moment=require(_0x4b8a('0x2'));var BPromise=require(_0x4b8a('0x3'));var rs=require(_0x4b8a('0x4'));var fs=require('fs');var Redis=require(_0x4b8a('0x5'));var db=require(_0x4b8a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b8a('0x7'))('rpc');var config=require(_0x4b8a('0x8'));var jayson=require(_0x4b8a('0x9'));var client=jayson[_0x4b8a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46adf2,_0x544298,_0x20f56d){return new BPromise(function(_0x27be6e,_0x266fd1){return client[_0x4b8a('0xb')](_0x46adf2,_0x20f56d)[_0x4b8a('0xc')](function(_0x3b14de){logger['info'](_0x4b8a('0xd'),_0x544298,_0x4b8a('0xe'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x544298,_0x4b8a('0xe'),JSON[_0x4b8a('0xf')](_0x3b14de));if(_0x3b14de['error']){if(_0x3b14de[_0x4b8a('0x10')][_0x4b8a('0x11')]===0x1f4){logger[_0x4b8a('0x10')](_0x4b8a('0xd'),_0x544298,_0x3b14de[_0x4b8a('0x10')][_0x4b8a('0x12')]);return _0x266fd1(_0x3b14de[_0x4b8a('0x10')][_0x4b8a('0x12')]);}logger['error'](_0x4b8a('0xd'),_0x544298,_0x3b14de[_0x4b8a('0x10')]['message']);return _0x27be6e(_0x3b14de[_0x4b8a('0x10')][_0x4b8a('0x12')]);}else{logger[_0x4b8a('0x13')](_0x4b8a('0xd'),_0x544298,_0x4b8a('0xe'));_0x27be6e(_0x3b14de[_0x4b8a('0x14')][_0x4b8a('0x12')]);}})['catch'](function(_0x38b2cf){logger[_0x4b8a('0x10')](_0x4b8a('0xd'),_0x544298,_0x38b2cf);_0x266fd1(_0x38b2cf);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e86e2ec..90c5762 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 _0xdc97=['put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','/:id/clone','post','addSections','addResources'];(function(_0x10e835,_0x2d85f6){var _0xaf4e25=function(_0xee2b7c){while(--_0xee2b7c){_0x10e835['push'](_0x10e835['shift']());}};_0xaf4e25(++_0x2d85f6);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3e36f8,_0x6309b5){_0x3e36f8=_0x3e36f8-0x0;var _0x1dd042=_0xdc97[_0x3e36f8];return _0x1dd042;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['get'](_0x7dc9('0xd'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xe')]);router[_0x7dc9('0x8')](_0x7dc9('0xf'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7dc9('0x11'),auth[_0x7dc9('0x9')](),controller['clone']);router[_0x7dc9('0x12')](_0x7dc9('0xd'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x13')]);router[_0x7dc9('0x12')](_0x7dc9('0xf'),auth['isAuthenticated'](),controller[_0x7dc9('0x14')]);router[_0x7dc9('0x15')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x16')]);router[_0x7dc9('0x17')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x18')]);router['delete'](_0x7dc9('0xd'),auth['isAuthenticated'](),controller[_0x7dc9('0x19')]);router[_0x7dc9('0x17')]('/:id/resources',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x1a')]);module[_0x7dc9('0x1b')]=router; \ No newline at end of file +var _0xeb83=['/:id','update','delete','destroy','removeSections','exports','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources'];(function(_0x54f0ac,_0x5380fd){var _0x28b8ab=function(_0x11c12f){while(--_0x11c12f){_0x54f0ac['push'](_0x54f0ac['shift']());}};_0x28b8ab(++_0x5380fd);}(_0xeb83,0x1c6));var _0x3eb8=function(_0x131c44,_0x2733a2){_0x131c44=_0x131c44-0x0;var _0x47d063=_0xeb83[_0x131c44];return _0x47d063;};'use strict';var multer=require('multer');var util=require(_0x3eb8('0x0'));var path=require(_0x3eb8('0x1'));var timeout=require('connect-timeout');var express=require(_0x3eb8('0x2'));var router=express[_0x3eb8('0x3')]();var fs_extra=require(_0x3eb8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3eb8('0x5'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x3eb8('0x6')]('/',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x8')]);router['get'](_0x3eb8('0x9'),auth[_0x3eb8('0x7')](),controller[_0x3eb8('0xa')]);router['get']('/:id',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0xb')]);router[_0x3eb8('0x6')](_0x3eb8('0xc'),auth[_0x3eb8('0x7')](),controller[_0x3eb8('0xd')]);router[_0x3eb8('0x6')](_0x3eb8('0xe'),auth['isAuthenticated'](),controller[_0x3eb8('0xf')]);router[_0x3eb8('0x10')]('/',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x11')]);router[_0x3eb8('0x10')](_0x3eb8('0x12'),auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x13')]);router[_0x3eb8('0x10')](_0x3eb8('0xc'),auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x14')]);router[_0x3eb8('0x10')]('/:id/resources',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x15')]);router['put'](_0x3eb8('0x16'),auth['isAuthenticated'](),controller[_0x3eb8('0x17')]);router[_0x3eb8('0x18')]('/:id',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x19')]);router[_0x3eb8('0x18')]('/:id/sections',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x1a')]);router['delete']('/:id/resources',auth[_0x3eb8('0x7')](),controller['removeResources']);module[_0x3eb8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 10952f8..fdd0354 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 _0xa427=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x2b0ed8,_0x38d0de){var _0x31b2c5=function(_0x19221a){while(--_0x19221a){_0x2b0ed8['push'](_0x2b0ed8['shift']());}};_0x31b2c5(++_0x38d0de);}(_0xa427,0xdd));var _0x7a42=function(_0x91814a,_0x1eefaa){_0x91814a=_0x91814a-0x0;var _0x2038de=_0xa427[_0x91814a];return _0x2038de;};'use strict';var Sequelize=require(_0x7a42('0x0'));module[_0x7a42('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x7a42('0x2')],'set':function(_0x4f5b04){this[_0x7a42('0x3')](_0x7a42('0x4'),_0x4f5b04?_0x4f5b04[_0x7a42('0x5')](''):[]);},'get':function(){return this[_0x7a42('0x6')]('crudPermissions')?this[_0x7a42('0x6')](_0x7a42('0x4'))[_0x7a42('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7a42('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7a42('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7a42('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7a42('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7a42('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7a42('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7a42('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7a42('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7a42('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf8fc=['getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions'];(function(_0x4a1794,_0x5c4c1f){var _0x46858a=function(_0x183b8d){while(--_0x183b8d){_0x4a1794['push'](_0x4a1794['shift']());}};_0x46858a(++_0x5c4c1f);}(_0xf8fc,0x7b));var _0xcf8f=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xf8fc[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0xcf8f('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf8f('0x1')],'allowNull':![],'unique':_0xcf8f('0x2')},'crudPermissions':{'type':Sequelize[_0xcf8f('0x1')],'set':function(_0x394cf2){this[_0xcf8f('0x3')]('crudPermissions',_0x394cf2?_0x394cf2['join'](''):[]);},'get':function(){return this['getDataValue'](_0xcf8f('0x4'))?this[_0xcf8f('0x5')]('crudPermissions')[_0xcf8f('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 12bcbe1..c721519 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 _0xd0da=['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','./userProfile.socket','register','status','limit','count','offset','set','json','apply','reject','then','sendStatus','error','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','catch','find','get','omit','createdAt','updatedAt','body','transaction','UserProfileSection','each','autoAssociation','sectionId','Resources','UserProfileResource','update','destroy','addSections','sequelize','userProfileId','push','removeSections','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0xd0da,0x1b1));var _0xad0d=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xd0da[_0x547add];return _0x2ed1f3;};'use strict';var emlformat=require(_0xad0d('0x0'));var rimraf=require(_0xad0d('0x1'));var zipdir=require(_0xad0d('0x2'));var jsonpatch=require(_0xad0d('0x3'));var rp=require(_0xad0d('0x4'));var moment=require('moment');var BPromise=require(_0xad0d('0x5'));var Mustache=require(_0xad0d('0x6'));var util=require(_0xad0d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xad0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad0d('0x9'));var squel=require(_0xad0d('0xa'));var crypto=require(_0xad0d('0xb'));var jsforce=require(_0xad0d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xad0d('0x8'));var querystring=require(_0xad0d('0xd'));var Papa=require(_0xad0d('0xe'));var Redis=require(_0xad0d('0xf'));var authService=require(_0xad0d('0x10'));var qs=require(_0xad0d('0x11'));var as=require(_0xad0d('0x12'));var hardwareService=require(_0xad0d('0x13'));var logger=require(_0xad0d('0x14'))(_0xad0d('0x15'));var utils=require(_0xad0d('0x16'));var config=require(_0xad0d('0x17'));var licenseUtil=require(_0xad0d('0x18'));var db=require('../../mysqldb')['db'];config[_0xad0d('0x19')]=_[_0xad0d('0x1a')](config['redis'],{'host':_0xad0d('0x1b'),'port':0x18eb});var socket=require(_0xad0d('0x1c'))(new Redis(config['redis']));require(_0xad0d('0x1d'))[_0xad0d('0x1e')](socket);function respondWithStatusCode(_0x5973a4,_0x2cab04){_0x2cab04=_0x2cab04||0xcc;return function(_0x698ee){if(_0x698ee){return _0x5973a4['sendStatus'](_0x2cab04);}return _0x5973a4[_0xad0d('0x1f')](_0x2cab04)['end']();};}function respondWithResult(_0x56d253,_0x3efaab){_0x3efaab=_0x3efaab||0xc8;return function(_0x3677b5){if(_0x3677b5){return _0x56d253[_0xad0d('0x1f')](_0x3efaab)['json'](_0x3677b5);}};}function respondWithFilteredResult(_0x1cac0c,_0x2f3bb3){return function(_0x5862bd){if(_0x5862bd){var _0xb6c032=typeof _0x2f3bb3['offset']==='undefined'&&typeof _0x2f3bb3[_0xad0d('0x20')]==='undefined';var _0x439484=_0x5862bd[_0xad0d('0x21')];var _0x3f77b1=_0xb6c032?0x0:_0x2f3bb3['offset'];var _0x490bb9=_0xb6c032?_0x5862bd[_0xad0d('0x21')]:_0x2f3bb3[_0xad0d('0x22')]+_0x2f3bb3[_0xad0d('0x20')];var _0x542bd8;if(_0x490bb9>=_0x439484){_0x490bb9=_0x439484;_0x542bd8=0xc8;}else{_0x542bd8=0xce;}_0x1cac0c['status'](_0x542bd8);return _0x1cac0c[_0xad0d('0x23')]('Content-Range',_0x3f77b1+'-'+_0x490bb9+'/'+_0x439484)[_0xad0d('0x24')](_0x5862bd);}return null;};}function patchUpdates(_0x129e80){return function(_0x3dd9a4){try{jsonpatch[_0xad0d('0x25')](_0x3dd9a4,_0x129e80,!![]);}catch(_0xefaf5f){return BPromise[_0xad0d('0x26')](_0xefaf5f);}return _0x3dd9a4['save']();};}function saveUpdates(_0x171757,_0x45f401){return function(_0x59499a){if(_0x59499a){return _0x59499a['update'](_0x171757)[_0xad0d('0x27')](function(_0x3e510e){return _0x3e510e;});}return null;};}function removeEntity(_0x444eda,_0x4ed3c8){return function(_0x3f70a6){if(_0x3f70a6){return _0x3f70a6['destroy']()[_0xad0d('0x27')](function(){_0x444eda[_0xad0d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481e1a,_0x3111fd){return function(_0x434221){if(!_0x434221){_0x481e1a[_0xad0d('0x28')](0x194);}return _0x434221;};}function handleError(_0x54a0c1,_0x472706){_0x472706=_0x472706||0x1f4;return function(_0x62dfed){logger[_0xad0d('0x29')](_0x62dfed['stack']);if(_0x62dfed[_0xad0d('0x2a')]){delete _0x62dfed[_0xad0d('0x2a')];}_0x54a0c1['status'](_0x472706)[_0xad0d('0x2b')](_0x62dfed);};}exports[_0xad0d('0x2c')]=function(_0x20bb3d,_0x11c203){var _0x185b9e={},_0x36c0f9={},_0x299752={'count':0x0,'rows':[]};var _0x4372e3=_[_0xad0d('0x2d')](db[_0xad0d('0x2e')][_0xad0d('0x2f')],function(_0x53ebdf){return{'name':_0x53ebdf[_0xad0d('0x30')],'type':_0x53ebdf['type'][_0xad0d('0x31')]};});_0x36c0f9[_0xad0d('0x32')]=_[_0xad0d('0x2d')](_0x4372e3,_0xad0d('0x2a'));_0x36c0f9['query']=_[_0xad0d('0x33')](_0x20bb3d[_0xad0d('0x34')]);_0x36c0f9['filters']=_[_0xad0d('0x35')](_0x36c0f9[_0xad0d('0x32')],_0x36c0f9[_0xad0d('0x34')]);_0x185b9e[_0xad0d('0x36')]=_[_0xad0d('0x35')](_0x36c0f9['model'],qs[_0xad0d('0x37')](_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x37')]));_0x185b9e[_0xad0d('0x36')]=_0x185b9e['attributes'][_0xad0d('0x38')]?_0x185b9e['attributes']:_0x36c0f9[_0xad0d('0x32')];if(!_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x39')]('nolimit')){_0x185b9e[_0xad0d('0x20')]=qs[_0xad0d('0x20')](_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x20')]);_0x185b9e[_0xad0d('0x22')]=qs[_0xad0d('0x22')](_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x22')]);}_0x185b9e['order']=qs[_0xad0d('0x3a')](_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x3a')]);_0x185b9e[_0xad0d('0x3b')]=qs['filters'](_[_0xad0d('0x3c')](_0x20bb3d[_0xad0d('0x34')],_0x36c0f9[_0xad0d('0x3d')]),_0x4372e3);if(_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x3e')]){_0x185b9e['where']=_['merge'](_0x185b9e[_0xad0d('0x3b')],{'$or':_['map'](_0x4372e3,function(_0x3b617d){if(_0x3b617d[_0xad0d('0x3f')]!==_0xad0d('0x40')){var _0x3041f8={};_0x3041f8[_0x3b617d[_0xad0d('0x2a')]]={'$like':'%'+_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x3e')]+'%'};return _0x3041f8;}})});}_0x185b9e=_[_0xad0d('0x41')]({},_0x185b9e,_0x20bb3d[_0xad0d('0x42')]);var _0x539d55={'where':_0x185b9e[_0xad0d('0x3b')]};return db[_0xad0d('0x2e')][_0xad0d('0x21')](_0x539d55)[_0xad0d('0x27')](function(_0x3a1775){_0x299752[_0xad0d('0x21')]=_0x3a1775;if(_0x20bb3d[_0xad0d('0x34')][_0xad0d('0x43')]){_0x185b9e[_0xad0d('0x44')]=[{'all':!![]}];}return db[_0xad0d('0x2e')][_0xad0d('0x45')](_0x185b9e);})[_0xad0d('0x27')](function(_0x336ac8){_0x299752[_0xad0d('0x46')]=_0x336ac8;return _0x299752;})[_0xad0d('0x27')](respondWithFilteredResult(_0x11c203,_0x185b9e))['catch'](handleError(_0x11c203,null));};exports[_0xad0d('0x47')]=function(_0x8816f0,_0x20f0f6){var _0xb9ba8c={'raw':![],'where':{'id':_0x8816f0[_0xad0d('0x48')]['id']}},_0x416b6e={};_0x416b6e[_0xad0d('0x32')]=_[_0xad0d('0x33')](db[_0xad0d('0x2e')][_0xad0d('0x2f')]);_0x416b6e['query']=_[_0xad0d('0x33')](_0x8816f0[_0xad0d('0x34')]);_0x416b6e[_0xad0d('0x3d')]=_['intersection'](_0x416b6e[_0xad0d('0x32')],_0x416b6e[_0xad0d('0x34')]);_0xb9ba8c['attributes']=_[_0xad0d('0x35')](_0x416b6e['model'],qs[_0xad0d('0x37')](_0x8816f0['query']['fields']));_0xb9ba8c['attributes']=_0xb9ba8c['attributes'][_0xad0d('0x38')]?_0xb9ba8c['attributes']:_0x416b6e['model'];if(_0x8816f0['query'][_0xad0d('0x43')]){_0xb9ba8c['include']=[{'all':!![]}];}_0xb9ba8c=_['merge']({},_0xb9ba8c,_0x8816f0[_0xad0d('0x42')]);return db[_0xad0d('0x2e')]['find'](_0xb9ba8c)[_0xad0d('0x27')](handleEntityNotFound(_0x20f0f6,null))[_0xad0d('0x27')](respondWithResult(_0x20f0f6,null))['catch'](handleError(_0x20f0f6,null));};exports[_0xad0d('0x49')]=function(_0x3ef5e7,_0x32bad5){return db[_0xad0d('0x2e')][_0xad0d('0x49')](_0x3ef5e7['body'],{})[_0xad0d('0x27')](respondWithResult(_0x32bad5,0xc9))[_0xad0d('0x4a')](handleError(_0x32bad5,null));};exports['clone']=function(_0x5ece67,_0x323b1e){var _0x2ced7c={'where':{'id':_0x5ece67[_0xad0d('0x48')]['id']}},_0x140eac={};_0x140eac['model']=_[_0xad0d('0x33')](db[_0xad0d('0x2e')][_0xad0d('0x2f')]);_0x2ced7c['attributes']=_[_0xad0d('0x35')](_0x140eac[_0xad0d('0x32')],qs[_0xad0d('0x37')](_0x5ece67[_0xad0d('0x34')][_0xad0d('0x37')]));_0x2ced7c[_0xad0d('0x36')]=_0x2ced7c[_0xad0d('0x36')][_0xad0d('0x38')]?_0x2ced7c['attributes']:_0x140eac['model'];if(_0x5ece67[_0xad0d('0x34')][_0xad0d('0x43')]){_0x2ced7c[_0xad0d('0x44')]=[{'all':!![]}];}_0x2ced7c=_[_0xad0d('0x41')]({},_0x2ced7c,_0x5ece67[_0xad0d('0x42')]);return db[_0xad0d('0x2e')][_0xad0d('0x4b')](_0x2ced7c)[_0xad0d('0x27')](handleEntityNotFound(_0x323b1e,null))['then'](function(_0x19dd26){if(_0x19dd26){var _0x5b8b02=_0x19dd26[_0xad0d('0x4c')]({'plain':!![]});_0x5b8b02=qs[_0xad0d('0x4d')](_0x5b8b02,['id',_0xad0d('0x4e'),_0xad0d('0x4f'),'crudPermissions']);_0x5ece67[_0xad0d('0x50')]=_[_0xad0d('0x4d')](_0x5ece67['body'],['id',_0xad0d('0x4e'),_0xad0d('0x4f')]);return db['sequelize'][_0xad0d('0x51')](function(_0x1e34ab){return db[_0xad0d('0x2e')]['create'](_[_0xad0d('0x41')](_0x5b8b02,_0x5ece67[_0xad0d('0x50')]),{'include':_0x5ece67['query'][_0xad0d('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x1e34ab})[_0xad0d('0x27')](function(_0x5cffc5){var _0x4658c9=_0x5cffc5[_0xad0d('0x4c')]({'plain':!![]});return db[_0xad0d('0x52')][_0xad0d('0x45')]({'where':{'userProfileId':_0x5ece67[_0xad0d('0x48')]['id']},'raw':!![]})[_0xad0d('0x27')](function(_0x265076){if(_0x265076){return BPromise[_0xad0d('0x53')](_0x265076,function(_0x93b874){return new BPromise(function(_0x3de9f1,_0x4519c9){if(_0x93b874['autoAssociation']===null||_0x93b874[_0xad0d('0x54')]===0x1)_0x3de9f1(null);return db['UserProfileResource'][_0xad0d('0x45')]({'where':{'sectionId':_0x93b874['id']},'raw':!![]})['then'](function(_0x503037){var _0x5ef2e2=_[_0xad0d('0x2d')](_0x503037,function(_0x3a7268){return qs[_0xad0d('0x4d')](_0x3a7268,['id',_0xad0d('0x4e'),_0xad0d('0x4f'),_0xad0d('0x55')]);});_0x3de9f1(_0x5ef2e2);})[_0xad0d('0x4a')](function(_0x11b492){_0x4519c9(_0x11b492);});})['then'](function(_0x4f7cc9){var _0x313b3e=qs['omit'](_0x93b874,['id','createdAt',_0xad0d('0x4f')]);_0x313b3e['userProfileId']=_0x4658c9['id'];if(_0x4f7cc9)_0x313b3e[_0xad0d('0x56')]=_0x4f7cc9;return _0x313b3e;})[_0xad0d('0x27')](function(_0x597ddb){return db[_0xad0d('0x52')][_0xad0d('0x49')](_0x597ddb,{'include':[{'model':db[_0xad0d('0x57')],'as':_0xad0d('0x56')}],'raw':!![],'transaction':_0x1e34ab});});})[_0xad0d('0x27')](function(){return _0x4658c9;});}});});});}})[_0xad0d('0x27')](respondWithResult(_0x323b1e,0xc9))[_0xad0d('0x4a')](handleError(_0x323b1e,null));};exports[_0xad0d('0x58')]=function(_0x299d09,_0x15404b){if(_0x299d09[_0xad0d('0x50')]['id']){delete _0x299d09[_0xad0d('0x50')]['id'];}return db[_0xad0d('0x2e')][_0xad0d('0x4b')]({'where':{'id':_0x299d09['params']['id']}})[_0xad0d('0x27')](handleEntityNotFound(_0x15404b,null))[_0xad0d('0x27')](saveUpdates(_0x299d09[_0xad0d('0x50')],null))['then'](respondWithResult(_0x15404b,null))['catch'](handleError(_0x15404b,null));};exports[_0xad0d('0x59')]=function(_0x47bd94,_0xaa56ed){return db[_0xad0d('0x2e')][_0xad0d('0x4b')]({'where':{'id':_0x47bd94[_0xad0d('0x48')]['id']}})[_0xad0d('0x27')](handleEntityNotFound(_0xaa56ed,null))[_0xad0d('0x27')](removeEntity(_0xaa56ed,null))['catch'](handleError(_0xaa56ed,null));};exports['describe']=function(_0x10958f,_0x4c3768){return db[_0xad0d('0x2e')]['describe']()['then'](respondWithResult(_0x4c3768,null))[_0xad0d('0x4a')](handleError(_0x4c3768,null));};exports[_0xad0d('0x5a')]=function(_0x2a3509,_0x11cf4a){var _0x222b3a=_0x2a3509['body'];return db[_0xad0d('0x2e')][_0xad0d('0x4b')]({'where':{'id':_0x2a3509[_0xad0d('0x48')]['id']}})['then'](handleEntityNotFound(_0x11cf4a,null))[_0xad0d('0x27')](function(_0x530297){if(_0x530297){return db[_0xad0d('0x5b')][_0xad0d('0x51')](function(_0x52ccb8){return db[_0xad0d('0x52')][_0xad0d('0x59')]({'where':{'userProfileId':_0x2a3509[_0xad0d('0x48')]['id'],'sectionId':_[_0xad0d('0x2d')](_0x222b3a,function(_0x3f5899){return _0x3f5899[_0xad0d('0x55')];})},'transaction':_0x52ccb8})['then'](function(){var _0x21cc0f=_['map'](_0x222b3a,function(_0x2dafe6){_0x2dafe6[_0xad0d('0x5c')]=_0x2a3509[_0xad0d('0x48')]['id'];return _0x2dafe6;});var _0x37664f=[];return BPromise[_0xad0d('0x53')](_0x21cc0f,function(_0xc077d7){return db[_0xad0d('0x52')][_0xad0d('0x49')](_0xc077d7,{'include':[{'model':db['UserProfileResource'],'as':_0xad0d('0x56')}],'raw':!![],'transaction':_0x52ccb8})[_0xad0d('0x27')](function(_0x92aa13){_0x37664f[_0xad0d('0x5d')](_0x92aa13['get']({'plain':!![]}));});})[_0xad0d('0x27')](function(){return _0x37664f;});});});}})[_0xad0d('0x27')](function(_0x32de95){return _0x32de95;})[_0xad0d('0x27')](respondWithResult(_0x11cf4a,null))[_0xad0d('0x4a')](handleError(_0x11cf4a,null));};exports[_0xad0d('0x5e')]=function(_0x11e002,_0xc257b4){var _0x2db0c2;return db[_0xad0d('0x2e')]['find']({'where':{'id':_0x11e002['params']['id']},'attributes':['id',_0xad0d('0x2a')]})['then'](handleEntityNotFound(_0xc257b4,null))['then'](function(_0x2f8dcb){if(_0x2f8dcb){_0x2db0c2=_0x2f8dcb;return db[_0xad0d('0x52')][_0xad0d('0x59')]({'where':{'userProfileId':_0x11e002['params']['id'],'sectionId':_0x11e002[_0xad0d('0x34')]['ids']}});}})[_0xad0d('0x27')](function(){return _0x2db0c2;})[_0xad0d('0x27')](respondWithStatusCode(_0xc257b4,null))[_0xad0d('0x4a')](handleError(_0xc257b4,null));};exports[_0xad0d('0x5f')]=function(_0xfddadb,_0x48c584){var _0x382b18=[];var _0x10120d=[];return db[_0xad0d('0x52')][_0xad0d('0x45')]({'where':{'userProfileId':_0xfddadb[_0xad0d('0x48')]['id']},'raw':!![]})['then'](function(_0x26d5d3){_0x382b18=_[_0xad0d('0x3e')](_0x26d5d3,function(_0x47a4c6){return _0x47a4c6['enabled']===0x1||_[_0xad0d('0x60')]([0x3eb,0x709],_0x47a4c6['sectionId']);});if(!_[_0xad0d('0x61')](_0x382b18)){return _['map'](_0x382b18,function(_0x1df5cb){return _0x1df5cb[_0xad0d('0x55')];});}else{return;}})[_0xad0d('0x27')](function(_0x3ca170){if(_0x3ca170)_0x10120d=_0x3ca170;if(_[_0xad0d('0x60')](_0x10120d,0x64)){var _0x35195a=_[_0xad0d('0x4b')](_0x382b18,{'sectionId':0x64});return hasDefaultDashboard(_0x35195a)[_0xad0d('0x27')](function(_0x437307){return _[_0xad0d('0x2d')](_0x382b18,function(_0xe1c7a6){if(_0xe1c7a6[_0xad0d('0x55')]===0x64){_0xe1c7a6[_0xad0d('0x62')]=_0x437307;}return _0xe1c7a6;});});}else{return;}})['then'](function(_0x12063c){if(_0x12063c)_0x382b18=_0x12063c;if(_[_0xad0d('0x60')](_0x10120d,0x3eb)){var _0xfe3458=_[_0xad0d('0x4b')](_0x382b18,{'sectionId':0x3eb});return getCustomDashboards(_0xfe3458)[_0xad0d('0x27')](function(_0x135f52){return _[_0xad0d('0x2d')](_0x382b18,function(_0x19d5b7){if(_0xfe3458[_0xad0d('0x63')]){if(_0x19d5b7['sectionId']===0x3eb){_0x19d5b7['subsections']=_0x135f52;}}else{if(_0x19d5b7[_0xad0d('0x55')]===0x64){_0x19d5b7['subsections']=_0x135f52;}}return _0x19d5b7;});});}else{return;}})[_0xad0d('0x27')](function(_0x51f4e2){if(_0x51f4e2)_0x382b18=_0x51f4e2;if(_[_0xad0d('0x60')](_0x10120d,0x709)){var _0x3f70a7=_[_0xad0d('0x4b')](_0x382b18,{'sectionId':0x709});return getPlugins(_0x3f70a7)[_0xad0d('0x27')](function(_0x554f78){if(_0x3f70a7[_0xad0d('0x63')]){return _[_0xad0d('0x2d')](_0x382b18,function(_0x5e64cf){if(_0x5e64cf[_0xad0d('0x55')]===0x709){_0x5e64cf[_0xad0d('0x62')]=_0x554f78;}return _0x5e64cf;});}else{var _0x152332={'sectionId':0x76c,'enabled':0x1,'subsections':_0x554f78};var _0x428e83=_[_0xad0d('0x2d')](_0x382b18);_0x428e83['push'](_0x152332);return _0x428e83;}});}else{return;}})['then'](function(_0x59841c){if(_0x59841c)_0x382b18=_0x59841c;return _[_0xad0d('0x3e')](_0x382b18,['enabled',0x1]);})[_0xad0d('0x27')](respondWithResult(_0x48c584,null))[_0xad0d('0x4a')](handleError(_0x48c584,null));};function hasDefaultDashboard(_0x29c4b8){var _0x51f788=[0x65];return new BPromise(function(_0x572196,_0x486b23){try{if(_0x29c4b8[_0xad0d('0x54')]){_0x572196(_0x51f788);}else{return db['UserProfileResource'][_0xad0d('0x64')]({'where':{'sectionId':_0x29c4b8['id']},'raw':!![]})['then'](function(_0x29c307){_0x29c307?_0x572196(_0x51f788):_0x572196();});}}catch(_0x461ba8){_0x486b23(_0x461ba8);}});}function getCustomDashboards(_0x476bb4){var _0x3a6373=[];return new BPromise(function(_0x469987,_0xcfde6){try{if(_0x476bb4['autoAssociation']){return db[_0xad0d('0x65')][_0xad0d('0x45')]({'raw':!![]})['then'](function(_0x207a06){_0x207a06['forEach'](function(_0x259d65){_0x3a6373[_0xad0d('0x5d')](_0x259d65['id']+0x1869f);});_0x469987(_0x3a6373);});}else{return db[_0xad0d('0x57')]['findAll']({'where':{'sectionId':_0x476bb4['id']},'raw':!![]})['then'](function(_0x9436a5){_0x9436a5[_0xad0d('0x66')](function(_0x41a462){_0x3a6373[_0xad0d('0x5d')](_0x41a462[_0xad0d('0x67')]+0x1869f);});_0x469987(_0x3a6373);});}}catch(_0x2b3dfc){_0xcfde6(_0x2b3dfc);}});}function getPlugins(_0x100dc4){var _0x46e828=[];return new BPromise(function(_0x1e418f,_0x53bfbe){try{if(_0x100dc4[_0xad0d('0x54')]){return db[_0xad0d('0x68')][_0xad0d('0x45')]({'raw':!![]})[_0xad0d('0x27')](function(_0x3530c1){_0x3530c1[_0xad0d('0x66')](function(_0x3b54f3){_0x46e828[_0xad0d('0x5d')](_0x3b54f3['id']+0x15b38);});_0x1e418f(_0x46e828);});}else{return db[_0xad0d('0x57')][_0xad0d('0x45')]({'where':{'sectionId':_0x100dc4['id']},'raw':!![]})[_0xad0d('0x27')](function(_0x529c53){_0x529c53[_0xad0d('0x66')](function(_0x9e3216){_0x46e828[_0xad0d('0x5d')](_0x9e3216[_0xad0d('0x67')]+0x15b38);});_0x1e418f(_0x46e828);});}}catch(_0x1d2116){_0x53bfbe(_0x1d2116);}});}exports['addResources']=function(_0x167f0f,_0x10fd8f){return db[_0xad0d('0x2e')]['find']({'where':{'id':_0x167f0f['params']['id']}})[_0xad0d('0x27')](handleEntityNotFound(_0x10fd8f,null))[_0xad0d('0x27')](function(_0x118180){if(_0x118180){return db['sequelize']['transaction'](function(_0x4b8691){return db[_0xad0d('0x52')][_0xad0d('0x45')]({'where':{'userProfileId':_0x167f0f[_0xad0d('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x13892d){if(_0x13892d){return db[_0xad0d('0x52')]['destroy']({'where':{'userProfileId':_0x167f0f[_0xad0d('0x48')]['id'],'id':_[_0xad0d('0x2d')](_0x13892d,function(_0x34f3db){return _0x34f3db['id'];})},'transaction':_0x4b8691});}})[_0xad0d('0x27')](function(_0x3b05ef){var _0x15a94e=_[_0xad0d('0x2d')](_0x167f0f[_0xad0d('0x50')],function(_0x3d8e4a){_0x3d8e4a[_0xad0d('0x5c')]=_0x167f0f[_0xad0d('0x48')]['id'];return _0x3d8e4a;});return db[_0xad0d('0x52')]['bulkCreate'](_0x15a94e,{'raw':!![],'transaction':_0x4b8691});})[_0xad0d('0x27')](function(_0x4f33f2){var _0x28a7b3=_[_0xad0d('0x3e')](_[_0xad0d('0x2d')](_0x4f33f2,function(_0x37d48){return _0x37d48['get']({'plain':!![]});}),{'includeAll':![]});if(_0x28a7b3){return db[_0xad0d('0x52')][_0xad0d('0x45')]({'where':{'userProfileId':_0x167f0f[_0xad0d('0x48')]['id'],'sectionId':_['map'](_0x28a7b3,function(_0x2d2620){return _0x2d2620['sectionId'];})},'attributes':['id',_0xad0d('0x55')],'raw':!![]})[_0xad0d('0x27')](function(_0x19c57d){var _0x1b3def=_['map'](_0x167f0f[_0xad0d('0x50')],function(_0x5e065c){_0x5e065c[_0xad0d('0x5c')]=_0x167f0f[_0xad0d('0x48')]['id'];return _0x5e065c;});return db[_0xad0d('0x57')][_0xad0d('0x69')](_0x1b3def,{'raw':!![],'transaction':_0x4b8691});});}})[_0xad0d('0x4a')](handleError(_0x10fd8f,null));});}})['then'](function(_0x5f22ce){var _0x3820ed=_['map'](_0x5f22ce,function(_0x3b909c){return _0x3b909c[_0xad0d('0x4c')]({'plain':!![]});});})[_0xad0d('0x27')](respondWithResult(_0x10fd8f,null))[_0xad0d('0x4a')](handleError(_0x10fd8f,null));};exports[_0xad0d('0x6a')]=function(_0x5dff1a,_0x21c59f,_0x12e3a3){return db['UserProfile'][_0xad0d('0x4b')]({'where':{'id':_0x5dff1a[_0xad0d('0x48')]['id']}})[_0xad0d('0x27')](handleEntityNotFound(_0x21c59f,null))['then'](function(_0x2f9ac7){if(_0x2f9ac7){return _0x2f9ac7[_0xad0d('0x6a')](_0x5dff1a['query'][_0xad0d('0x6b')]);}})[_0xad0d('0x27')](respondWithStatusCode(_0x21c59f,null))[_0xad0d('0x4a')](handleError(_0x21c59f,null));};exports[_0xad0d('0x6c')]=function(_0x1e40b4,_0x32e6ff){var _0x4cdec6={};if(!_0x1e40b4[_0xad0d('0x34')][_0xad0d('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x1e40b4[_0xad0d('0x34')][_0xad0d('0x39')](_0xad0d('0x6e'))){_0x4cdec6[_0xad0d('0x20')]=qs[_0xad0d('0x20')](_0x1e40b4[_0xad0d('0x34')]['limit']);_0x4cdec6[_0xad0d('0x22')]=qs['offset'](_0x1e40b4[_0xad0d('0x34')][_0xad0d('0x22')]);}return db[_0xad0d('0x2e')][_0xad0d('0x4b')]({'where':{'id':_0x1e40b4[_0xad0d('0x48')]['id']}})[_0xad0d('0x27')](function(_0x17d86e){if(!_0x17d86e)throw new Error(_0xad0d('0x6f')+_0x1e40b4[_0xad0d('0x48')]['id']);return db[_0xad0d('0x2e')][_0xad0d('0x6c')](_0x1e40b4);})[_0xad0d('0x27')](respondWithFilteredResult(_0x32e6ff,_0x4cdec6))[_0xad0d('0x4a')](handleError(_0x32e6ff,null));}; \ No newline at end of file +var _0x160c=['omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','get','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','body','describe','addSections','each','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','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','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','fieldName','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','options','includeAll','include','UserProfile','findAll','rows','catch','show','params','rawAttributes','find','create','clone'];(function(_0x687549,_0x2a09eb){var _0x44e4a0=function(_0xef9ff1){while(--_0xef9ff1){_0x687549['push'](_0x687549['shift']());}};_0x44e4a0(++_0x2a09eb);}(_0x160c,0x181));var _0xc160=function(_0x359438,_0x374f93){_0x359438=_0x359438-0x0;var _0x52b3b4=_0x160c[_0x359438];return _0x52b3b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc160('0x0'));var zipdir=require(_0xc160('0x1'));var jsonpatch=require(_0xc160('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc160('0x3'));var util=require('util');var path=require(_0xc160('0x4'));var sox=require(_0xc160('0x5'));var csv=require(_0xc160('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc160('0x7'));var _=require('lodash');var squel=require(_0xc160('0x8'));var crypto=require('crypto');var jsforce=require(_0xc160('0x9'));var deskjs=require(_0xc160('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc160('0xb'));var Papa=require(_0xc160('0xc'));var Redis=require('ioredis');var authService=require(_0xc160('0xd'));var qs=require(_0xc160('0xe'));var as=require(_0xc160('0xf'));var hardwareService=require(_0xc160('0x10'));var logger=require(_0xc160('0x11'))(_0xc160('0x12'));var utils=require(_0xc160('0x13'));var config=require(_0xc160('0x14'));var licenseUtil=require(_0xc160('0x15'));var db=require('../../mysqldb')['db'];config[_0xc160('0x16')]=_[_0xc160('0x17')](config['redis'],{'host':_0xc160('0x18'),'port':0x18eb});var socket=require(_0xc160('0x19'))(new Redis(config[_0xc160('0x16')]));require('./userProfile.socket')[_0xc160('0x1a')](socket);function respondWithStatusCode(_0x5e1aa7,_0x279b73){_0x279b73=_0x279b73||0xcc;return function(_0xc3f481){if(_0xc3f481){return _0x5e1aa7['sendStatus'](_0x279b73);}return _0x5e1aa7[_0xc160('0x1b')](_0x279b73)['end']();};}function respondWithResult(_0x35f233,_0x2d2985){_0x2d2985=_0x2d2985||0xc8;return function(_0x3be8c2){if(_0x3be8c2){return _0x35f233['status'](_0x2d2985)['json'](_0x3be8c2);}};}function respondWithFilteredResult(_0x1c320d,_0x453d5e){return function(_0x6120d5){if(_0x6120d5){var _0x54e6e0=typeof _0x453d5e[_0xc160('0x1c')]===_0xc160('0x1d')&&typeof _0x453d5e[_0xc160('0x1e')]===_0xc160('0x1d');var _0x4cf313=_0x6120d5[_0xc160('0x1f')];var _0x15b53c=_0x54e6e0?0x0:_0x453d5e['offset'];var _0x3319e5=_0x54e6e0?_0x6120d5[_0xc160('0x1f')]:_0x453d5e[_0xc160('0x1c')]+_0x453d5e[_0xc160('0x1e')];var _0x41bb1e;if(_0x3319e5>=_0x4cf313){_0x3319e5=_0x4cf313;_0x41bb1e=0xc8;}else{_0x41bb1e=0xce;}_0x1c320d['status'](_0x41bb1e);return _0x1c320d[_0xc160('0x20')](_0xc160('0x21'),_0x15b53c+'-'+_0x3319e5+'/'+_0x4cf313)[_0xc160('0x22')](_0x6120d5);}return null;};}function patchUpdates(_0x143c18){return function(_0x2c1b64){try{jsonpatch[_0xc160('0x23')](_0x2c1b64,_0x143c18,!![]);}catch(_0x2804ad){return BPromise[_0xc160('0x24')](_0x2804ad);}return _0x2c1b64[_0xc160('0x25')]();};}function saveUpdates(_0x432a48,_0x5a47d0){return function(_0x4cad5c){if(_0x4cad5c){return _0x4cad5c[_0xc160('0x26')](_0x432a48)['then'](function(_0x7d235e){return _0x7d235e;});}return null;};}function removeEntity(_0x63d33d,_0x2d5d3f){return function(_0x494fd8){if(_0x494fd8){return _0x494fd8[_0xc160('0x27')]()[_0xc160('0x28')](function(){_0x63d33d[_0xc160('0x1b')](0xcc)[_0xc160('0x29')]();});}};}function handleEntityNotFound(_0x2a0a5e,_0x54da23){return function(_0xba4803){if(!_0xba4803){_0x2a0a5e[_0xc160('0x2a')](0x194);}return _0xba4803;};}function handleError(_0xfe7ae9,_0x2c25ee){_0x2c25ee=_0x2c25ee||0x1f4;return function(_0xa10de0){logger[_0xc160('0x2b')](_0xa10de0[_0xc160('0x2c')]);if(_0xa10de0['name']){delete _0xa10de0[_0xc160('0x2d')];}_0xfe7ae9[_0xc160('0x1b')](_0x2c25ee)[_0xc160('0x2e')](_0xa10de0);};}exports['index']=function(_0x5109c1,_0x44930d){var _0x5b0a81={},_0x233cb2={},_0x2ba357={'count':0x0,'rows':[]};var _0x2ba69=_['map'](db['UserProfile']['rawAttributes'],function(_0x5bcd80){return{'name':_0x5bcd80[_0xc160('0x2f')],'type':_0x5bcd80[_0xc160('0x30')][_0xc160('0x31')]};});_0x233cb2['model']=_[_0xc160('0x32')](_0x2ba69,'name');_0x233cb2['query']=_[_0xc160('0x33')](_0x5109c1[_0xc160('0x34')]);_0x233cb2['filters']=_[_0xc160('0x35')](_0x233cb2[_0xc160('0x36')],_0x233cb2[_0xc160('0x34')]);_0x5b0a81[_0xc160('0x37')]=_[_0xc160('0x35')](_0x233cb2[_0xc160('0x36')],qs[_0xc160('0x38')](_0x5109c1['query']['fields']));_0x5b0a81[_0xc160('0x37')]=_0x5b0a81['attributes'][_0xc160('0x39')]?_0x5b0a81[_0xc160('0x37')]:_0x233cb2[_0xc160('0x36')];if(!_0x5109c1[_0xc160('0x34')][_0xc160('0x3a')]('nolimit')){_0x5b0a81['limit']=qs[_0xc160('0x1e')](_0x5109c1[_0xc160('0x34')][_0xc160('0x1e')]);_0x5b0a81[_0xc160('0x1c')]=qs['offset'](_0x5109c1['query']['offset']);}_0x5b0a81[_0xc160('0x3b')]=qs[_0xc160('0x3c')](_0x5109c1[_0xc160('0x34')][_0xc160('0x3c')]);_0x5b0a81['where']=qs[_0xc160('0x3d')](_[_0xc160('0x3e')](_0x5109c1['query'],_0x233cb2[_0xc160('0x3d')]),_0x2ba69);if(_0x5109c1['query'][_0xc160('0x3f')]){_0x5b0a81['where']=_[_0xc160('0x40')](_0x5b0a81[_0xc160('0x41')],{'$or':_[_0xc160('0x32')](_0x2ba69,function(_0x454cb1){if(_0x454cb1[_0xc160('0x30')]!=='VIRTUAL'){var _0x3aa2a9={};_0x3aa2a9[_0x454cb1[_0xc160('0x2d')]]={'$like':'%'+_0x5109c1[_0xc160('0x34')][_0xc160('0x3f')]+'%'};return _0x3aa2a9;}})});}_0x5b0a81=_[_0xc160('0x40')]({},_0x5b0a81,_0x5109c1[_0xc160('0x42')]);var _0x4282e8={'where':_0x5b0a81[_0xc160('0x41')]};return db['UserProfile'][_0xc160('0x1f')](_0x4282e8)[_0xc160('0x28')](function(_0x5c3c26){_0x2ba357[_0xc160('0x1f')]=_0x5c3c26;if(_0x5109c1[_0xc160('0x34')][_0xc160('0x43')]){_0x5b0a81[_0xc160('0x44')]=[{'all':!![]}];}return db[_0xc160('0x45')][_0xc160('0x46')](_0x5b0a81);})[_0xc160('0x28')](function(_0x499d70){_0x2ba357[_0xc160('0x47')]=_0x499d70;return _0x2ba357;})[_0xc160('0x28')](respondWithFilteredResult(_0x44930d,_0x5b0a81))[_0xc160('0x48')](handleError(_0x44930d,null));};exports[_0xc160('0x49')]=function(_0x238376,_0x561512){var _0x488868={'raw':![],'where':{'id':_0x238376[_0xc160('0x4a')]['id']}},_0x7e533b={};_0x7e533b['model']=_['keys'](db[_0xc160('0x45')][_0xc160('0x4b')]);_0x7e533b['query']=_[_0xc160('0x33')](_0x238376[_0xc160('0x34')]);_0x7e533b[_0xc160('0x3d')]=_[_0xc160('0x35')](_0x7e533b['model'],_0x7e533b[_0xc160('0x34')]);_0x488868[_0xc160('0x37')]=_[_0xc160('0x35')](_0x7e533b[_0xc160('0x36')],qs[_0xc160('0x38')](_0x238376['query']['fields']));_0x488868[_0xc160('0x37')]=_0x488868[_0xc160('0x37')][_0xc160('0x39')]?_0x488868[_0xc160('0x37')]:_0x7e533b[_0xc160('0x36')];if(_0x238376['query']['includeAll']){_0x488868[_0xc160('0x44')]=[{'all':!![]}];}_0x488868=_[_0xc160('0x40')]({},_0x488868,_0x238376[_0xc160('0x42')]);return db[_0xc160('0x45')][_0xc160('0x4c')](_0x488868)[_0xc160('0x28')](handleEntityNotFound(_0x561512,null))[_0xc160('0x28')](respondWithResult(_0x561512,null))['catch'](handleError(_0x561512,null));};exports[_0xc160('0x4d')]=function(_0x3fa809,_0x254d3b){return db[_0xc160('0x45')][_0xc160('0x4d')](_0x3fa809['body'],{})[_0xc160('0x28')](respondWithResult(_0x254d3b,0xc9))['catch'](handleError(_0x254d3b,null));};exports[_0xc160('0x4e')]=function(_0x37770e,_0x12433c){var _0x5af8dc={'where':{'id':_0x37770e[_0xc160('0x4a')]['id']}},_0x590a94={};_0x590a94[_0xc160('0x36')]=_[_0xc160('0x33')](db[_0xc160('0x45')][_0xc160('0x4b')]);_0x5af8dc[_0xc160('0x37')]=_['intersection'](_0x590a94[_0xc160('0x36')],qs[_0xc160('0x38')](_0x37770e[_0xc160('0x34')][_0xc160('0x38')]));_0x5af8dc[_0xc160('0x37')]=_0x5af8dc['attributes'][_0xc160('0x39')]?_0x5af8dc['attributes']:_0x590a94[_0xc160('0x36')];if(_0x37770e[_0xc160('0x34')][_0xc160('0x43')]){_0x5af8dc[_0xc160('0x44')]=[{'all':!![]}];}_0x5af8dc=_[_0xc160('0x40')]({},_0x5af8dc,_0x37770e[_0xc160('0x42')]);return db[_0xc160('0x45')][_0xc160('0x4c')](_0x5af8dc)[_0xc160('0x28')](handleEntityNotFound(_0x12433c,null))[_0xc160('0x28')](function(_0x1e4f72){if(_0x1e4f72){var _0x263ef2=_0x1e4f72['get']({'plain':!![]});_0x263ef2=qs[_0xc160('0x4f')](_0x263ef2,['id',_0xc160('0x50'),'updatedAt',_0xc160('0x51')]);_0x37770e['body']=_[_0xc160('0x4f')](_0x37770e['body'],['id','createdAt',_0xc160('0x52')]);return db[_0xc160('0x53')][_0xc160('0x54')](function(_0x2a115a){return db['UserProfile'][_0xc160('0x4d')](_[_0xc160('0x40')](_0x263ef2,_0x37770e['body']),{'include':_0x37770e[_0xc160('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2a115a})['then'](function(_0x1eae66){var _0xd6319a=_0x1eae66[_0xc160('0x55')]({'plain':!![]});return db['UserProfileSection'][_0xc160('0x46')]({'where':{'userProfileId':_0x37770e[_0xc160('0x4a')]['id']},'raw':!![]})[_0xc160('0x28')](function(_0x69a61f){if(_0x69a61f){return BPromise['each'](_0x69a61f,function(_0x3772fd){return new BPromise(function(_0x4e798c,_0x398b11){if(_0x3772fd[_0xc160('0x56')]===null||_0x3772fd[_0xc160('0x56')]===0x1)_0x4e798c(null);return db['UserProfileResource'][_0xc160('0x46')]({'where':{'sectionId':_0x3772fd['id']},'raw':!![]})[_0xc160('0x28')](function(_0x395bf6){var _0xe32451=_['map'](_0x395bf6,function(_0x4d08ef){return qs[_0xc160('0x4f')](_0x4d08ef,['id',_0xc160('0x50'),_0xc160('0x52'),_0xc160('0x57')]);});_0x4e798c(_0xe32451);})[_0xc160('0x48')](function(_0x5376e5){_0x398b11(_0x5376e5);});})[_0xc160('0x28')](function(_0x4c3f9f){var _0x15e045=qs[_0xc160('0x4f')](_0x3772fd,['id',_0xc160('0x50'),_0xc160('0x52')]);_0x15e045[_0xc160('0x58')]=_0xd6319a['id'];if(_0x4c3f9f)_0x15e045[_0xc160('0x59')]=_0x4c3f9f;return _0x15e045;})[_0xc160('0x28')](function(_0x5796d6){return db[_0xc160('0x5a')]['create'](_0x5796d6,{'include':[{'model':db[_0xc160('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0x2a115a});});})['then'](function(){return _0xd6319a;});}});});});}})[_0xc160('0x28')](respondWithResult(_0x12433c,0xc9))[_0xc160('0x48')](handleError(_0x12433c,null));};exports[_0xc160('0x26')]=function(_0x56fa91,_0x209526){if(_0x56fa91[_0xc160('0x5c')]['id']){delete _0x56fa91[_0xc160('0x5c')]['id'];}return db[_0xc160('0x45')][_0xc160('0x4c')]({'where':{'id':_0x56fa91[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](handleEntityNotFound(_0x209526,null))[_0xc160('0x28')](saveUpdates(_0x56fa91['body'],null))[_0xc160('0x28')](respondWithResult(_0x209526,null))[_0xc160('0x48')](handleError(_0x209526,null));};exports[_0xc160('0x27')]=function(_0x55f0a1,_0x53c1d7){return db[_0xc160('0x45')][_0xc160('0x4c')]({'where':{'id':_0x55f0a1[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](handleEntityNotFound(_0x53c1d7,null))[_0xc160('0x28')](removeEntity(_0x53c1d7,null))[_0xc160('0x48')](handleError(_0x53c1d7,null));};exports[_0xc160('0x5d')]=function(_0x49c4fc,_0x2e4473){return db['UserProfile']['describe']()['then'](respondWithResult(_0x2e4473,null))[_0xc160('0x48')](handleError(_0x2e4473,null));};exports[_0xc160('0x5e')]=function(_0x5bcc29,_0x17fbe3){var _0x1fc05a=_0x5bcc29['body'];return db[_0xc160('0x45')]['find']({'where':{'id':_0x5bcc29['params']['id']}})['then'](handleEntityNotFound(_0x17fbe3,null))[_0xc160('0x28')](function(_0x3c5ac5){if(_0x3c5ac5){return db[_0xc160('0x53')]['transaction'](function(_0x7dbe09){return db[_0xc160('0x5a')][_0xc160('0x27')]({'where':{'userProfileId':_0x5bcc29[_0xc160('0x4a')]['id'],'sectionId':_[_0xc160('0x32')](_0x1fc05a,function(_0x6b794b){return _0x6b794b[_0xc160('0x57')];})},'transaction':_0x7dbe09})[_0xc160('0x28')](function(){var _0x4f4cdb=_[_0xc160('0x32')](_0x1fc05a,function(_0x1ac236){_0x1ac236[_0xc160('0x58')]=_0x5bcc29['params']['id'];return _0x1ac236;});var _0x2de627=[];return BPromise[_0xc160('0x5f')](_0x4f4cdb,function(_0x39e0d3){return db[_0xc160('0x5a')][_0xc160('0x4d')](_0x39e0d3,{'include':[{'model':db['UserProfileResource'],'as':_0xc160('0x59')}],'raw':!![],'transaction':_0x7dbe09})[_0xc160('0x28')](function(_0x318cff){_0x2de627[_0xc160('0x60')](_0x318cff[_0xc160('0x55')]({'plain':!![]}));});})['then'](function(){return _0x2de627;});});});}})[_0xc160('0x28')](function(_0x4d0d09){return _0x4d0d09;})[_0xc160('0x28')](respondWithResult(_0x17fbe3,null))[_0xc160('0x48')](handleError(_0x17fbe3,null));};exports[_0xc160('0x61')]=function(_0x44b858,_0x182eca){var _0x19de74;return db['UserProfile'][_0xc160('0x4c')]({'where':{'id':_0x44b858[_0xc160('0x4a')]['id']},'attributes':['id',_0xc160('0x2d')]})[_0xc160('0x28')](handleEntityNotFound(_0x182eca,null))[_0xc160('0x28')](function(_0x3a0a01){if(_0x3a0a01){_0x19de74=_0x3a0a01;return db[_0xc160('0x5a')]['destroy']({'where':{'userProfileId':_0x44b858[_0xc160('0x4a')]['id'],'sectionId':_0x44b858[_0xc160('0x34')]['ids']}});}})[_0xc160('0x28')](function(){return _0x19de74;})[_0xc160('0x28')](respondWithStatusCode(_0x182eca,null))[_0xc160('0x48')](handleError(_0x182eca,null));};exports[_0xc160('0x62')]=function(_0x8b14a6,_0x2b03d5){var _0x25ae66=[];var _0x54b0f6=[];return db[_0xc160('0x5a')]['findAll']({'where':{'userProfileId':_0x8b14a6[_0xc160('0x4a')]['id']},'raw':!![]})[_0xc160('0x28')](function(_0x1d0963){_0x25ae66=_[_0xc160('0x3f')](_0x1d0963,function(_0x3f7345){return _0x3f7345[_0xc160('0x63')]===0x1||_[_0xc160('0x64')]([0x3eb,0x709],_0x3f7345['sectionId']);});if(!_[_0xc160('0x65')](_0x25ae66)){return _[_0xc160('0x32')](_0x25ae66,function(_0x17931f){return _0x17931f[_0xc160('0x57')];});}else{return;}})[_0xc160('0x28')](function(_0x362844){if(_0x362844)_0x54b0f6=_0x362844;if(_[_0xc160('0x64')](_0x54b0f6,0x64)){var _0x4afbb5=_[_0xc160('0x4c')](_0x25ae66,{'sectionId':0x64});return hasDefaultDashboard(_0x4afbb5)[_0xc160('0x28')](function(_0x1f2c03){return _[_0xc160('0x32')](_0x25ae66,function(_0x2e69c3){if(_0x2e69c3[_0xc160('0x57')]===0x64){_0x2e69c3[_0xc160('0x66')]=_0x1f2c03;}return _0x2e69c3;});});}else{return;}})['then'](function(_0x2d2fa5){if(_0x2d2fa5)_0x25ae66=_0x2d2fa5;if(_[_0xc160('0x64')](_0x54b0f6,0x3eb)){var _0x2cf2ad=_[_0xc160('0x4c')](_0x25ae66,{'sectionId':0x3eb});return getCustomDashboards(_0x2cf2ad)['then'](function(_0x3ed718){return _['map'](_0x25ae66,function(_0x577b0a){if(_0x2cf2ad[_0xc160('0x63')]){if(_0x577b0a[_0xc160('0x57')]===0x3eb){_0x577b0a[_0xc160('0x66')]=_0x3ed718;}}else{if(_0x577b0a[_0xc160('0x57')]===0x64){_0x577b0a[_0xc160('0x66')]=_0x3ed718;}}return _0x577b0a;});});}else{return;}})[_0xc160('0x28')](function(_0x1ff3a9){if(_0x1ff3a9)_0x25ae66=_0x1ff3a9;if(_[_0xc160('0x64')](_0x54b0f6,0x709)){var _0x375ed7=_['find'](_0x25ae66,{'sectionId':0x709});return getPlugins(_0x375ed7)['then'](function(_0x5d2b2d){if(_0x375ed7['enabled']){return _[_0xc160('0x32')](_0x25ae66,function(_0x1cf618){if(_0x1cf618[_0xc160('0x57')]===0x709){_0x1cf618[_0xc160('0x66')]=_0x5d2b2d;}return _0x1cf618;});}else{var _0x5d3e56={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5d2b2d};var _0x4637d9=_['map'](_0x25ae66);_0x4637d9[_0xc160('0x60')](_0x5d3e56);return _0x4637d9;}});}else{return;}})[_0xc160('0x28')](function(_0x4f9320){if(_0x4f9320)_0x25ae66=_0x4f9320;return _[_0xc160('0x3f')](_0x25ae66,['enabled',0x1]);})[_0xc160('0x28')](respondWithResult(_0x2b03d5,null))[_0xc160('0x48')](handleError(_0x2b03d5,null));};function hasDefaultDashboard(_0x4c23fd){var _0x1e953c=[0x65];return new BPromise(function(_0x9db10e,_0x31e38b){try{if(_0x4c23fd[_0xc160('0x56')]){_0x9db10e(_0x1e953c);}else{return db[_0xc160('0x5b')][_0xc160('0x67')]({'where':{'sectionId':_0x4c23fd['id']},'raw':!![]})[_0xc160('0x28')](function(_0x58d2eb){_0x58d2eb?_0x9db10e(_0x1e953c):_0x9db10e();});}}catch(_0x3cbfad){_0x31e38b(_0x3cbfad);}});}function getCustomDashboards(_0x32dbee){var _0x42357f=[];return new BPromise(function(_0x2e1393,_0x2e5028){try{if(_0x32dbee['autoAssociation']){return db[_0xc160('0x68')]['findAll']({'raw':!![]})['then'](function(_0x3431aa){_0x3431aa[_0xc160('0x69')](function(_0xd6593b){_0x42357f['push'](_0xd6593b['id']+0x1869f);});_0x2e1393(_0x42357f);});}else{return db[_0xc160('0x5b')][_0xc160('0x46')]({'where':{'sectionId':_0x32dbee['id']},'raw':!![]})[_0xc160('0x28')](function(_0x2468ab){_0x2468ab['forEach'](function(_0x2b37aa){_0x42357f[_0xc160('0x60')](_0x2b37aa[_0xc160('0x6a')]+0x1869f);});_0x2e1393(_0x42357f);});}}catch(_0xb995a5){_0x2e5028(_0xb995a5);}});}function getPlugins(_0xe73690){var _0x200c04=[];return new BPromise(function(_0x20144b,_0x7b1f09){try{if(_0xe73690[_0xc160('0x56')]){return db['Plugin']['findAll']({'raw':!![]})[_0xc160('0x28')](function(_0x3c944d){_0x3c944d['forEach'](function(_0x3eea5c){_0x200c04[_0xc160('0x60')](_0x3eea5c['id']+0x15b38);});_0x20144b(_0x200c04);});}else{return db[_0xc160('0x5b')]['findAll']({'where':{'sectionId':_0xe73690['id']},'raw':!![]})['then'](function(_0x5232f4){_0x5232f4[_0xc160('0x69')](function(_0x5dc018){_0x200c04[_0xc160('0x60')](_0x5dc018[_0xc160('0x6a')]+0x15b38);});_0x20144b(_0x200c04);});}}catch(_0x1247ff){_0x7b1f09(_0x1247ff);}});}exports[_0xc160('0x6b')]=function(_0x43b601,_0xf508ba){return db[_0xc160('0x45')][_0xc160('0x4c')]({'where':{'id':_0x43b601[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](handleEntityNotFound(_0xf508ba,null))['then'](function(_0x5d2e8a){if(_0x5d2e8a){return db['sequelize'][_0xc160('0x54')](function(_0x3cadb2){return db[_0xc160('0x5a')]['findAll']({'where':{'userProfileId':_0x43b601[_0xc160('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xc160('0x28')](function(_0x370bc0){if(_0x370bc0){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x43b601[_0xc160('0x4a')]['id'],'id':_[_0xc160('0x32')](_0x370bc0,function(_0x15ba6a){return _0x15ba6a['id'];})},'transaction':_0x3cadb2});}})['then'](function(_0x33960c){var _0x2e02ee=_['map'](_0x43b601[_0xc160('0x5c')],function(_0x5a23cd){_0x5a23cd[_0xc160('0x58')]=_0x43b601[_0xc160('0x4a')]['id'];return _0x5a23cd;});return db[_0xc160('0x5a')][_0xc160('0x6c')](_0x2e02ee,{'raw':!![],'transaction':_0x3cadb2});})[_0xc160('0x28')](function(_0x2f537a){var _0x17356e=_[_0xc160('0x3f')](_['map'](_0x2f537a,function(_0x4b861b){return _0x4b861b[_0xc160('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x17356e){return db[_0xc160('0x5a')][_0xc160('0x46')]({'where':{'userProfileId':_0x43b601[_0xc160('0x4a')]['id'],'sectionId':_[_0xc160('0x32')](_0x17356e,function(_0x200c4d){return _0x200c4d['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xc160('0x28')](function(_0x13f711){var _0x2fd6bf=_[_0xc160('0x32')](_0x43b601[_0xc160('0x5c')],function(_0x30741d){_0x30741d['userProfileId']=_0x43b601['params']['id'];return _0x30741d;});return db['UserProfileResource'][_0xc160('0x6c')](_0x2fd6bf,{'raw':!![],'transaction':_0x3cadb2});});}})[_0xc160('0x48')](handleError(_0xf508ba,null));});}})[_0xc160('0x28')](function(_0x2da0d8){var _0x13e509=_[_0xc160('0x32')](_0x2da0d8,function(_0x39cee7){return _0x39cee7[_0xc160('0x55')]({'plain':!![]});});})[_0xc160('0x28')](respondWithResult(_0xf508ba,null))[_0xc160('0x48')](handleError(_0xf508ba,null));};exports['removeResources']=function(_0x3c2ff3,_0x186a27,_0x4e47c2){return db[_0xc160('0x45')][_0xc160('0x4c')]({'where':{'id':_0x3c2ff3[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](handleEntityNotFound(_0x186a27,null))[_0xc160('0x28')](function(_0x58516a){if(_0x58516a){return _0x58516a[_0xc160('0x6d')](_0x3c2ff3['query'][_0xc160('0x6e')]);}})[_0xc160('0x28')](respondWithStatusCode(_0x186a27,null))[_0xc160('0x48')](handleError(_0x186a27,null));};exports['getResources']=function(_0x221ae9,_0x3c3e3c){var _0x2fd2d0={};if(!_0x221ae9['query'][_0xc160('0x6f')])throw new Error(_0xc160('0x70'));if(!_0x221ae9[_0xc160('0x34')]['hasOwnProperty'](_0xc160('0x71'))){_0x2fd2d0[_0xc160('0x1e')]=qs[_0xc160('0x1e')](_0x221ae9[_0xc160('0x34')][_0xc160('0x1e')]);_0x2fd2d0[_0xc160('0x1c')]=qs['offset'](_0x221ae9[_0xc160('0x34')][_0xc160('0x1c')]);}return db['UserProfile'][_0xc160('0x4c')]({'where':{'id':_0x221ae9[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](function(_0x502ef7){if(!_0x502ef7)throw new Error(_0xc160('0x72')+_0x221ae9[_0xc160('0x4a')]['id']);return db['UserProfile'][_0xc160('0x73')](_0x221ae9);})[_0xc160('0x28')](respondWithFilteredResult(_0x3c3e3c,_0x2fd2d0))[_0xc160('0x48')](handleError(_0x3c3e3c,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 2d4b1d4..e632db0 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 _0x6931=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x56f604,_0x31e0fc){var _0x5c3f23=function(_0x507065){while(--_0x507065){_0x56f604['push'](_0x56f604['shift']());}};_0x5c3f23(++_0x31e0fc);}(_0x6931,0x1a9));var _0x1693=function(_0x471b93,_0x3ce579){_0x471b93=_0x471b93-0x0;var _0x1bc440=_0x6931[_0x471b93];return _0x1bc440;};'use strict';var EventEmitter=require(_0x1693('0x0'));var UserProfile=require(_0x1693('0x1'))['db'][_0x1693('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1693('0x3')](0x0);var events={'afterCreate':_0x1693('0x4'),'afterUpdate':_0x1693('0x5'),'afterDestroy':_0x1693('0x6')};function emitEvent(_0x2cb142){return function(_0x59d148,_0x19ff1c,_0x2ca960){UserProfileEvents[_0x1693('0x7')](_0x2cb142+':'+_0x59d148['id'],_0x59d148);UserProfileEvents[_0x1693('0x7')](_0x2cb142,_0x59d148);_0x2ca960(null);};}for(var e in events){if(events[_0x1693('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1693('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x565e=['UserProfile','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x16e5a2,_0x32f03d){var _0x20ba84=function(_0x3ab02b){while(--_0x3ab02b){_0x16e5a2['push'](_0x16e5a2['shift']());}};_0x20ba84(++_0x32f03d);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xe565('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xe565('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe565('0x2')](0x0);var events={'afterCreate':_0xe565('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x42e589){return function(_0x33fd83,_0x14f472,_0x1b6e64){UserProfileEvents[_0xe565('0x4')](_0x42e589+':'+_0x33fd83['id'],_0x33fd83);UserProfileEvents[_0xe565('0x4')](_0x42e589,_0x33fd83);_0x1b6e64(null);};}for(var e in events){if(events[_0xe565('0x5')](e)){var event=events[e];UserProfile[_0xe565('0x6')](e,emitEvent(event));}}module[_0xe565('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 007db89..101ff78 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 _0xc1c6=['query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','autoAssociation','all','model','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','count','CmContact','Tag','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','then','map','catch','findAll','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','contacts','parentSections','Lists','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','voicemails','VoiceMail','VoiceRecording','Agents','membername','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','dispositions','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','SELECT','select','ui.','InteractionId','ui.createdAt','from','_interactions','ui.UserId\x20=\x20?','sequelize'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x324091,_0x18514a){_0x324091=_0x324091-0x0;var _0x463d8d=_0xc1c6[_0x324091];return _0x463d8d;};'use strict';var _=require(_0x6c1c('0x0'));var attributes=require(_0x6c1c('0x1'));var qs=require(_0x6c1c('0x2'));var squel=require('squel');module[_0x6c1c('0x3')]=function(_0x4c33ca){var _0x426398=_0x4c33ca[_0x6c1c('0x4')];function _0x265d2c(_0x59f799,_0x56ed6f){return new Promise(function(_0x32af84,_0x524a6b){if(!_0x56ed6f)return _0x32af84(null);var _0x50c1bb=_0x56ed6f['filter']?{[_0x56ed6f[_0x6c1c('0x5')][_0x6c1c('0x6')]]:_0x56ed6f[_0x6c1c('0x5')][_0x6c1c('0x7')]}:undefined;return _0x426398[_0x59f799]['findAll']({'where':_0x50c1bb,'raw':!![]})[_0x6c1c('0x8')](function(_0x3ca985){_0x56ed6f['associatedResources']=_[_0x6c1c('0x9')](_0x3ca985,'id');_0x32af84(_0x56ed6f);})[_0x6c1c('0xa')](function(_0xb3bd12){_0x524a6b(_0xb3bd12);});});}function _0x1137e8(_0x49fb01,_0x3a25a2){return new Promise(function(_0x2a4fd4,_0x40cebf){var _0x5af308=_0x49fb01[_0x6c1c('0x5')]?{[_0x49fb01[_0x6c1c('0x5')][_0x6c1c('0x6')]]:_0x49fb01['filter'][_0x6c1c('0x7')]}:undefined;return _0x426398[_0x49fb01['model']][_0x6c1c('0xb')]({'where':_0x5af308,'raw':!![]})[_0x6c1c('0x8')](function(_0x2d279e){_0x3a25a2[_0x6c1c('0xc')]=_[_0x6c1c('0x9')](_0x2d279e,function(_0x3f532c){return _0x3f532c[_0x6c1c('0xd')];});_0x2a4fd4(_0x3a25a2);})[_0x6c1c('0xa')](function(_0x448f35){_0x40cebf(_0x448f35);});});}function _0x5f3758(_0x3df1b7,_0x174657,_0x5214ee){if(!_0x174657)return Promise[_0x6c1c('0xe')](null);return new Promise(function(_0x237cac,_0x494ffc){return _0x426398[_0x6c1c('0xf')]['findAll']({'where':{'sectionId':_0x174657['id']},'raw':!![]})[_0x6c1c('0x8')](function(_0x1a0ab9){if(_0x3df1b7['field']&&_0x3df1b7[_0x6c1c('0x6')]!=='id'){_0x174657['associatedResources']=_[_0x6c1c('0x9')](_0x1a0ab9,function(_0x3527bf){return _0x3527bf[_0x3df1b7[_0x6c1c('0x6')]];});}else{if(_0x5214ee===_0x6c1c('0x10')){_0x174657[_0x6c1c('0xc')]=_[_0x6c1c('0x9')](_0x1a0ab9,function(_0x1993c5){return{'id':_0x1993c5[_0x6c1c('0x11')],'type':_0x1993c5[_0x6c1c('0x12')]};});}else{_0x174657[_0x6c1c('0xc')]=_[_0x6c1c('0x9')](_0x1a0ab9,function(_0x450b1f){return _0x450b1f[_0x6c1c('0x11')];});}}_0x237cac(_0x174657);})[_0x6c1c('0xa')](function(_0x31fed2){_0x494ffc(_0x31fed2);});});}function _0x19c269(_0x2319d3,_0x12c638){var _0x3a3f13={'parentSections':[]};switch(_0x2319d3[_0x6c1c('0x13')]()){case _0x6c1c('0x14'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x16');break;case _0x6c1c('0x17'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x18');break;case _0x6c1c('0x19'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x1a');_0x3a3f13['parentSections']=[{'name':_0x6c1c('0x1b'),'field':'name','foreignKey':_0x6c1c('0x1c')}];break;case'projects':_0x3a3f13[_0x6c1c('0x15')]='JscriptyProject';break;case _0x6c1c('0x1d'):_0x3a3f13[_0x6c1c('0x15')]='CmContact';_0x3a3f13[_0x6c1c('0x1e')]=[{'name':_0x6c1c('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0x6c1c('0x20'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x21');break;case _0x6c1c('0x22'):_0x3a3f13['childModel']='CmCompany';break;case _0x6c1c('0x23'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x24');break;case _0x6c1c('0x25'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x26');break;case'chatwebsites':_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x27');break;case'faxqueues':_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x28');break;case _0x6c1c('0x29'):_0x3a3f13[_0x6c1c('0x15')]='FaxAccount';break;case _0x6c1c('0x2a'):case _0x6c1c('0x2b'):case _0x6c1c('0x2c'):_0x3a3f13['childModel']=_0x6c1c('0x2d');break;case'contexts':_0x3a3f13[_0x6c1c('0x15')]='VoiceContext';break;case _0x6c1c('0x2e'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x2f');break;case'voicerecordings':_0x3a3f13['childModel']=_0x6c1c('0x30');_0x3a3f13[_0x6c1c('0x1e')]=[{'name':_0x6c1c('0x31'),'field':'name','foreignKey':_0x6c1c('0x32'),'model':'User','filter':{'field':'role','value':[_0x6c1c('0x33')]}},{'name':_0x6c1c('0x34'),'field':_0x6c1c('0xd'),'foreignKey':_0x6c1c('0x32'),'model':'User','filter':{'field':_0x6c1c('0x35'),'value':[_0x6c1c('0x36')]}},{'name':_0x6c1c('0x37'),'field':_0x6c1c('0xd'),'foreignKey':_0x6c1c('0x38'),'model':_0x6c1c('0x39'),'filter':{'field':_0x6c1c('0x12'),'value':[_0x6c1c('0x3a')]}},{'name':_0x6c1c('0x3b'),'field':_0x6c1c('0xd'),'foreignKey':'queue','model':_0x6c1c('0x39'),'filter':{'field':_0x6c1c('0x12'),'value':[_0x6c1c('0x3c')]}}];break;case _0x6c1c('0x3d'):_0x3a3f13[_0x6c1c('0x15')]='VoiceMusicOnHold';break;case'chanspies':_0x3a3f13['childModel']=_0x6c1c('0x3e');break;case'voiceprefixes':_0x3a3f13['childModel']=_0x6c1c('0x3f');break;case _0x6c1c('0x40'):_0x3a3f13['childModel']=_0x6c1c('0x41');break;case _0x6c1c('0x42'):_0x3a3f13[_0x6c1c('0x15')]='MailQueue';break;case _0x6c1c('0x43'):_0x3a3f13[_0x6c1c('0x15')]='MailAccount';break;case _0x6c1c('0x44'):_0x3a3f13['childModel']=_0x6c1c('0x45');break;case _0x6c1c('0x46'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x47');break;case _0x6c1c('0x48'):_0x3a3f13['childModel']=_0x6c1c('0x49');break;case _0x6c1c('0x4a'):_0x3a3f13[_0x6c1c('0x15')]='SmsQueue';break;case _0x6c1c('0x4b'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x4c');break;case _0x6c1c('0x4d'):_0x3a3f13[_0x6c1c('0x15')]='WhatsappQueue';break;case _0x6c1c('0x4e'):_0x3a3f13['childModel']='WhatsappAccount';break;case'teams':_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x4f');break;case _0x6c1c('0x50'):case _0x6c1c('0x51'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x39');if(_0x12c638){_0x3a3f13[_0x6c1c('0x1e')]=[{'name':_0x6c1c('0x37')},{'name':'QueueCampaigns'}];}break;case _0x6c1c('0x52'):case _0x6c1c('0x53'):case'telephones':_0x3a3f13[_0x6c1c('0x15')]='User';if(_0x12c638){_0x3a3f13[_0x6c1c('0x1e')]=[{'name':_0x6c1c('0x54'),'filter':{'field':_0x6c1c('0x35'),'value':[_0x6c1c('0x55'),_0x6c1c('0x56')]},'ignore':!![]},{'name':'Agents'},{'name':_0x6c1c('0x34')}];}break;case'zendeskaccounts':_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x57');break;case _0x6c1c('0x58'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x59');break;case _0x6c1c('0x5a'):_0x3a3f13['childModel']=_0x6c1c('0x5b');break;case _0x6c1c('0x5c'):_0x3a3f13['childModel']=_0x6c1c('0x5d');break;case _0x6c1c('0x5e'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x5f');break;case'zohoaccounts':_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x60');break;case _0x6c1c('0x61'):_0x3a3f13['childModel']='User';break;case'cannedanswers':_0x3a3f13['childModel']='CannedAnswer';break;case _0x6c1c('0x62'):_0x3a3f13[_0x6c1c('0x15')]='Disposition';break;case _0x6c1c('0x63'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x64');break;case'intervals':_0x3a3f13['childModel']=_0x6c1c('0x65');break;case _0x6c1c('0x66'):_0x3a3f13['childModel']=_0x6c1c('0x67');break;case _0x6c1c('0x68'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x69');break;case _0x6c1c('0x6a'):_0x3a3f13[_0x6c1c('0x15')]='Sound';break;case _0x6c1c('0x6b'):_0x3a3f13[_0x6c1c('0x15')]='Tag';break;case'templates':_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x6c');break;case _0x6c1c('0x6d'):_0x3a3f13['childModel']=_0x6c1c('0x6e');break;case _0x6c1c('0x6f'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x70');break;case'variables':_0x3a3f13['childModel']=_0x6c1c('0x71');break;case _0x6c1c('0x72'):_0x3a3f13[_0x6c1c('0x15')]='Plugin';break;case'extractedreports':_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x10');_0x3a3f13['parentSections']=[{'name':_0x6c1c('0x73'),'field':'id','foreignKey':_0x6c1c('0x74')}];break;case _0x6c1c('0x75'):_0x3a3f13[_0x6c1c('0x15')]=_0x6c1c('0x76');break;}return _0x3a3f13;}function _0x24c993(_0x4f027a,_0x398bca){var _0x5a2692=_0x4f027a[_0x6c1c('0x77')](0x0)[_0x6c1c('0x78')]()+_0x4f027a[_0x6c1c('0x79')](0x1);var _0x319820={'type':_0x426398['Sequelize']['QueryTypes'][_0x6c1c('0x7a')],'raw':!![]};return new Promise(function(_0x3255e1,_0x612be2){var _0x54da73=squel[_0x6c1c('0x7b')]()[_0x6c1c('0x6')](_0x6c1c('0x7c')+_0x5a2692+_0x6c1c('0x7d'),'id')[_0x6c1c('0x6')](_0x6c1c('0x7e'))[_0x6c1c('0x7f')]('user_has_'+_0x4f027a+_0x6c1c('0x80'),'ui')['where'](_0x6c1c('0x81'),_0x398bca['id']);return _0x426398[_0x6c1c('0x82')][_0x6c1c('0x83')](_0x54da73[_0x6c1c('0x84')](),_0x319820)['then'](function(_0x43423e){_0x398bca[_0x5a2692+_0x6c1c('0x85')]=_0x43423e;_0x3255e1(_0x43423e);})[_0x6c1c('0xa')](function(_0x1de8c9){_0x612be2(_0x1de8c9);});});}return _0x4c33ca[_0x6c1c('0x86')](_0x6c1c('0x87'),attributes,{'tableName':_0x6c1c('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x458c01){var _0x2d248c={'raw':![],'where':{}};var _0x13963a={};var _0x26ee48={'count':0x0,'rows':[]};var _0x4fa646=_0x458c01[_0x6c1c('0x83')][_0x6c1c('0x89')];var _0x18cb06=_0x458c01[_0x6c1c('0x83')][_0x6c1c('0x8a')]||![];var _0x59bd3f=_0x19c269(_0x4fa646,_0x18cb06);if(!_0x59bd3f[_0x6c1c('0x15')])throw new Error(_0x6c1c('0x8b')+_0x4fa646+'\x27');var _0x494a6f=[{'name':_0x4fa646}];if(!_[_0x6c1c('0x8c')](_0x59bd3f[_0x6c1c('0x1e')]))_0x494a6f=_0x59bd3f[_0x6c1c('0x1e')];var _0x552718=[];for(var _0x3d3ed=0x0;_0x3d3ed<_0x494a6f[_0x6c1c('0x8d')];_0x3d3ed++){_0x552718[_0x6c1c('0x8e')](_0x426398[_0x6c1c('0x8f')][_0x6c1c('0x90')]({'where':{'userProfileId':_0x458c01[_0x6c1c('0x91')]['id'],'name':_0x494a6f[_0x3d3ed]['name']},'raw':!![]}));}return Promise['all'](_0x552718)[_0x6c1c('0x8')](function(_0x153ff1){var _0x5a35a1=_['filter'](_0x153ff1,function(_0x5f125d){return _0x5f125d?_0x5f125d:undefined;});var _0x45da13=_[_0x6c1c('0x5')](_0x494a6f,[_0x6c1c('0x92'),!![]]);var _0x5a7298=_['isEmpty'](_0x5a35a1)&&_[_0x6c1c('0x8c')](_0x45da13)?null:_['union'](_0x45da13,_0x5a35a1);if(!_0x5a7298)return null;var _0x5e3c65=[];for(var _0x4f3ade=0x0;_0x4f3ade<_0x5a7298[_0x6c1c('0x8d')];_0x4f3ade++){var _0x1e20a9=_[_0x6c1c('0x90')](_0x494a6f,function(_0x42ae1b){return _0x5a7298[_0x4f3ade]?_0x42ae1b[_0x6c1c('0xd')]===_0x5a7298[_0x4f3ade][_0x6c1c('0xd')]:null;});if(_0x1e20a9){if(_0x5a7298[_0x4f3ade]['ignore']){_0x5e3c65[_0x6c1c('0x8e')](_0x265d2c(_0x59bd3f[_0x6c1c('0x15')],_0x5a7298[_0x4f3ade]));}else{if(!_0x5a7298[_0x4f3ade][_0x6c1c('0x93')]){_0x5e3c65['push'](_0x5f3758(_0x1e20a9,_0x5a7298[_0x4f3ade],_0x59bd3f['childModel']));}else{if(_0x1e20a9['model']){_0x5e3c65[_0x6c1c('0x8e')](_0x1137e8(_0x1e20a9,_0x5a7298[_0x4f3ade]));}}}}}return Promise[_0x6c1c('0x94')](_0x5e3c65);})['then'](function(_0x10e499){var _0x579ca3=_0x10e499;var _0x40a0c5=null;if(_0x579ca3){_0x40a0c5=_0x579ca3[_0x6c1c('0x8d')]===0x1?_0x579ca3[0x0]:null;}if(!_0x40a0c5&&!_0x579ca3)return _0x26ee48;var _0x1a9489=_0x426398[_0x59bd3f[_0x6c1c('0x15')]]['rawAttributes'];_0x13963a[_0x6c1c('0x95')]=_[_0x6c1c('0x96')](_0x1a9489);_0x13963a['query']=_['keys'](_0x458c01[_0x6c1c('0x83')]);_0x13963a[_0x6c1c('0x97')]=_[_0x6c1c('0x98')](_0x13963a['model'],_0x13963a[_0x6c1c('0x83')]);_0x2d248c[_0x6c1c('0x99')]=_['intersection'](_0x13963a['model'],qs['fields'](_0x458c01['query'][_0x6c1c('0x9a')]));_0x2d248c['attributes']=_0x2d248c[_0x6c1c('0x99')][_0x6c1c('0x8d')]?_0x2d248c[_0x6c1c('0x99')]:_0x13963a['model'];if(!_0x458c01[_0x6c1c('0x83')][_0x6c1c('0x9b')](_0x6c1c('0x9c'))){_0x2d248c[_0x6c1c('0x9d')]=qs[_0x6c1c('0x9d')](_0x458c01['query'][_0x6c1c('0x9d')]);_0x2d248c['offset']=qs[_0x6c1c('0x9e')](_0x458c01[_0x6c1c('0x83')][_0x6c1c('0x9e')]);}_0x2d248c[_0x6c1c('0x9f')]=qs[_0x6c1c('0xa0')](_0x458c01[_0x6c1c('0x83')][_0x6c1c('0xa0')]);_0x2d248c[_0x6c1c('0xa1')]=qs['filters'](_[_0x6c1c('0xa2')](_0x458c01['query'],_0x13963a['filters']));if(_0x458c01[_0x6c1c('0x83')][_0x6c1c('0x5')]){_0x2d248c[_0x6c1c('0xa1')]=_[_0x6c1c('0xa3')](_0x2d248c['where'],{'$or':_[_0x6c1c('0x9')](_0x1a9489,function(_0x4c7856){if(_0x4c7856[_0x6c1c('0x12')]['key']!==_0x6c1c('0xa4')){var _0x23332d={};_0x23332d[_0x4c7856[_0x6c1c('0x6')]]={'$like':'%'+_0x458c01['query'][_0x6c1c('0x5')]+'%'};return _0x23332d;}})});}var _0xa9a844=[];var _0x19a26b=null;var _0x4b5801={};if(_0x40a0c5){_0x19a26b=_[_0x6c1c('0x90')](_0x494a6f,[_0x6c1c('0xd'),_0x40a0c5[_0x6c1c('0xd')]]);if(_0x19a26b[_0x6c1c('0x6')]){_0x4b5801={};if(_0x59bd3f['childModel']===_0x6c1c('0x10')){_0x4b5801[_0x19a26b[_0x6c1c('0xa5')]]=_[_0x6c1c('0x9')](_0x40a0c5[_0x6c1c('0xc')],'id');}else{_0x4b5801[_0x19a26b[_0x6c1c('0xa5')]]=_0x40a0c5['associatedResources'];}_0xa9a844[_0x6c1c('0x8e')](_0x4b5801);}else{_0x2d248c[_0x6c1c('0xa1')]['id']=_0x40a0c5[_0x6c1c('0xc')];}}else{for(var _0x1a5476=0x0;_0x1a5476<_0x579ca3['length'];_0x1a5476++){_0x19a26b=_[_0x6c1c('0x90')](_0x494a6f,[_0x6c1c('0xd'),_0x579ca3[_0x1a5476][_0x6c1c('0xd')]]);if(_0x19a26b['field']){_0x4b5801={};_0x4b5801[_0x19a26b[_0x6c1c('0xa5')]]=_0x579ca3[_0x1a5476][_0x6c1c('0xc')];_0xa9a844['push'](_0x4b5801);}else{if(!_0x2d248c[_0x6c1c('0xa1')]['id'])_0x2d248c['where']['id']=[];_0x579ca3[_0x1a5476][_0x6c1c('0xc')][_0x6c1c('0xa6')](function(_0x246682){_0x2d248c[_0x6c1c('0xa1')]['id']['push'](_0x246682);});}}}if(!_[_0x6c1c('0x8c')](_0xa9a844)){_0x2d248c[_0x6c1c('0xa1')]=_[_0x6c1c('0xa3')](_0x2d248c['where'],{'$and':{'$or':_0xa9a844}});}_0x2d248c=_[_0x6c1c('0xa3')]({},_0x2d248c,_0x458c01[_0x6c1c('0xa7')]);if(_0x40a0c5&&!_0x40a0c5[_0x6c1c('0x93')]&&_0x59bd3f[_0x6c1c('0x15')]==='AnalyticExtractedReport'){if(_0x458c01[_0x6c1c('0x83')][_0x6c1c('0xa8')]){_0x2d248c[_0x6c1c('0xa9')]=[{'all':!![]}];}return _0x426398[_0x59bd3f['childModel']][_0x6c1c('0xb')](_0x2d248c)['then'](function(_0x29c5c8){var _0x27a9ea=[];_0x29c5c8[_0x6c1c('0xa6')](function(_0x1fd7ec){var _0x29da07;switch(_0x1fd7ec[_0x6c1c('0xaa')]){case _0x6c1c('0xab'):_0x29da07=_[_0x6c1c('0x90')](_0x40a0c5['associatedResources'],function(_0x426d7c){return _0x426d7c['id']===_0x1fd7ec['reportId']&&_0x426d7c[_0x6c1c('0x12')]===_0x6c1c('0xac');});break;case _0x6c1c('0xad'):_0x29da07=_[_0x6c1c('0x90')](_0x40a0c5['associatedResources'],function(_0x357e1a){return _0x357e1a['id']===_0x1fd7ec[_0x6c1c('0x74')]&&_0x357e1a[_0x6c1c('0x12')]==='CustomReports';});break;}if(_0x29da07)_0x27a9ea[_0x6c1c('0x8e')](_0x1fd7ec);});_0x26ee48[_0x6c1c('0xae')]=_0x27a9ea['length'];_0x26ee48['rows']=_0x27a9ea;return _0x26ee48;});}else{return _0x426398[_0x59bd3f[_0x6c1c('0x15')]][_0x6c1c('0xae')]({'where':_0x2d248c[_0x6c1c('0xa1')]})[_0x6c1c('0x8')](function(_0x305cc2){_0x26ee48[_0x6c1c('0xae')]=_0x305cc2;if(_0x458c01[_0x6c1c('0x83')][_0x6c1c('0xa8')]){if(_0x59bd3f[_0x6c1c('0x15')]===_0x6c1c('0xaf')){_0x2d248c[_0x6c1c('0xa9')]=[{'model':_0x426398[_0x6c1c('0xb0')],'as':'Tags','attributes':['id',_0x6c1c('0xd'),_0x6c1c('0xb1')],'required':_0x458c01[_0x6c1c('0x83')][_0x6c1c('0xb2')]?!![]:![]},{'model':_0x426398[_0x6c1c('0xb0')],'as':_0x6c1c('0xb3'),'attributes':['id',_0x6c1c('0xd'),'color'],'through':_0x458c01[_0x6c1c('0x83')]['tag']?{'attributes':[],'where':{'TagId':_0x458c01['query'][_0x6c1c('0xb2')]||undefined}}:{},'required':_0x458c01[_0x6c1c('0x83')][_0x6c1c('0xb2')]?!![]:![]}];}else{_0x2d248c[_0x6c1c('0xa9')]=[{'all':!![]}];}}return _0x426398[_0x59bd3f[_0x6c1c('0x15')]][_0x6c1c('0xb')](_0x2d248c);})[_0x6c1c('0x8')](function(_0x2a2797){_0x26ee48[_0x6c1c('0xb4')]=_0x2a2797;if(_0x4fa646===_0x6c1c('0x31')&&_0x458c01['query'][_0x6c1c('0xb5')]===_0x6c1c('0xb6')){var _0x1a0da8=[];for(var _0x3efe9c=0x0;_0x3efe9c<_0x26ee48[_0x6c1c('0xb4')][_0x6c1c('0x8d')];_0x3efe9c++){_0x1a0da8[_0x6c1c('0x8e')](_0x24c993(_0x6c1c('0xb7'),_0x26ee48['rows'][_0x3efe9c][_0x6c1c('0xb8')]));_0x1a0da8[_0x6c1c('0x8e')](_0x24c993(_0x6c1c('0xb9'),_0x26ee48[_0x6c1c('0xb4')][_0x3efe9c][_0x6c1c('0xb8')]));_0x1a0da8[_0x6c1c('0x8e')](_0x24c993(_0x6c1c('0xba'),_0x26ee48[_0x6c1c('0xb4')][_0x3efe9c][_0x6c1c('0xb8')]));_0x1a0da8[_0x6c1c('0x8e')](_0x24c993(_0x6c1c('0xbb'),_0x26ee48[_0x6c1c('0xb4')][_0x3efe9c][_0x6c1c('0xb8')]));_0x1a0da8[_0x6c1c('0x8e')](_0x24c993('openchannel',_0x26ee48['rows'][_0x3efe9c][_0x6c1c('0xb8')]));_0x1a0da8['push'](_0x24c993(_0x6c1c('0xbc'),_0x26ee48[_0x6c1c('0xb4')][_0x3efe9c][_0x6c1c('0xb8')]));}return Promise[_0x6c1c('0x94')](_0x1a0da8)[_0x6c1c('0x8')](function(){return _0x26ee48;});}return _0x26ee48;});}});}}});}; \ No newline at end of file +var _0xa6b0=['filter','field','value','findAll','associatedResources','map','catch','then','name','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','projectName','projects','contacts','CmContact','Lists','ListId','CmList','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','type','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','pauses','Pause','scheduler','sounds','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','reportId','charAt','toUpperCase','slice','select','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','section','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','limit','offset','sort','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','custom','CustomReports','count','rows','Tags','color','tag','openTabs','chat','sms','dataValues','fax','mail','whatsapp','lodash','./userProfile.attributes','exports'];(function(_0x46f6d4,_0x5e0d7a){var _0x1f016b=function(_0x27756){while(--_0x27756){_0x46f6d4['push'](_0x46f6d4['shift']());}};_0x1f016b(++_0x5e0d7a);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x3daebc,_0x9cb8da){_0x3daebc=_0x3daebc-0x0;var _0x29eef1=_0xa6b0[_0x3daebc];return _0x29eef1;};'use strict';var _=require(_0x0a6b('0x0'));var attributes=require(_0x0a6b('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x0a6b('0x2')]=function(_0x2c0d7f){var _0x13d4d5=_0x2c0d7f['models'];function _0x29ff80(_0x33e8c3,_0x195697){return new Promise(function(_0xc7140c,_0x3dc2b0){if(!_0x195697)return _0xc7140c(null);var _0x3b6967=_0x195697[_0x0a6b('0x3')]?{[_0x195697[_0x0a6b('0x3')][_0x0a6b('0x4')]]:_0x195697[_0x0a6b('0x3')][_0x0a6b('0x5')]}:undefined;return _0x13d4d5[_0x33e8c3][_0x0a6b('0x6')]({'where':_0x3b6967,'raw':!![]})['then'](function(_0x493948){_0x195697[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x493948,'id');_0xc7140c(_0x195697);})[_0x0a6b('0x9')](function(_0x25ad47){_0x3dc2b0(_0x25ad47);});});}function _0x81a412(_0xe681c9,_0x1489c5){return new Promise(function(_0x405046,_0x8bbed9){var _0x354e10=_0xe681c9[_0x0a6b('0x3')]?{[_0xe681c9[_0x0a6b('0x3')][_0x0a6b('0x4')]]:_0xe681c9[_0x0a6b('0x3')]['value']}:undefined;return _0x13d4d5[_0xe681c9['model']][_0x0a6b('0x6')]({'where':_0x354e10,'raw':!![]})[_0x0a6b('0xa')](function(_0x2abc4e){_0x1489c5[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x2abc4e,function(_0x45fc9f){return _0x45fc9f[_0x0a6b('0xb')];});_0x405046(_0x1489c5);})[_0x0a6b('0x9')](function(_0x1205a3){_0x8bbed9(_0x1205a3);});});}function _0x9d7aba(_0x4797d1,_0xa36d75,_0x1538f4){if(!_0xa36d75)return Promise['resolve'](null);return new Promise(function(_0x290f7f,_0x4d0e3b){return _0x13d4d5[_0x0a6b('0xc')][_0x0a6b('0x6')]({'where':{'sectionId':_0xa36d75['id']},'raw':!![]})[_0x0a6b('0xa')](function(_0x1ad45d){if(_0x4797d1['field']&&_0x4797d1[_0x0a6b('0x4')]!=='id'){_0xa36d75[_0x0a6b('0x7')]=_['map'](_0x1ad45d,function(_0x19848c){return _0x19848c[_0x4797d1[_0x0a6b('0x4')]];});}else{if(_0x1538f4===_0x0a6b('0xd')){_0xa36d75['associatedResources']=_[_0x0a6b('0x8')](_0x1ad45d,function(_0x93a465){return{'id':_0x93a465[_0x0a6b('0xe')],'type':_0x93a465['type']};});}else{_0xa36d75[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x1ad45d,function(_0xe4c2b9){return _0xe4c2b9[_0x0a6b('0xe')];});}}_0x290f7f(_0xa36d75);})[_0x0a6b('0x9')](function(_0x53848c){_0x4d0e3b(_0x53848c);});});}function _0x1e5065(_0xdda188,_0x3d153f){var _0x5c77fb={'parentSections':[]};switch(_0xdda188[_0x0a6b('0xf')]()){case _0x0a6b('0x10'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x12');break;case _0x0a6b('0x13'):_0x5c77fb['childModel']=_0x0a6b('0x14');break;case _0x0a6b('0x15'):_0x5c77fb[_0x0a6b('0x11')]='SquareRecording';_0x5c77fb[_0x0a6b('0x16')]=[{'name':'SquareProjects','field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x17')}];break;case _0x0a6b('0x18'):_0x5c77fb['childModel']='JscriptyProject';break;case _0x0a6b('0x19'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1a');_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x1b'),'field':'id','foreignKey':_0x0a6b('0x1c')}];break;case'lists':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1d');break;case'companies':_0x5c77fb[_0x0a6b('0x11')]='CmCompany';break;case'globalcustomfields':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1e');break;case _0x0a6b('0x1f'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x20');break;case'chatwebsites':_0x5c77fb['childModel']=_0x0a6b('0x21');break;case _0x0a6b('0x22'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x23');break;case'faxaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x24');break;case'inboundroutes':case'internalroutes':case _0x0a6b('0x25'):_0x5c77fb[_0x0a6b('0x11')]='VoiceExtension';break;case _0x0a6b('0x26'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x27');break;case _0x0a6b('0x28'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x29');break;case _0x0a6b('0x2a'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2b');_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x2c'),'field':_0x0a6b('0xb'),'foreignKey':'membername','model':_0x0a6b('0x2d'),'filter':{'field':_0x0a6b('0x2e'),'value':['agent']}},{'name':_0x0a6b('0x2f'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x30'),'model':_0x0a6b('0x2d'),'filter':{'field':_0x0a6b('0x2e'),'value':[_0x0a6b('0x31')]}},{'name':_0x0a6b('0x32'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x33'),'model':'VoiceQueue','filter':{'field':_0x0a6b('0x34'),'value':[_0x0a6b('0x35')]}},{'name':_0x0a6b('0x36'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x33'),'model':_0x0a6b('0x37'),'filter':{'field':_0x0a6b('0x34'),'value':[_0x0a6b('0x38')]}}];break;case _0x0a6b('0x39'):_0x5c77fb['childModel']=_0x0a6b('0x3a');break;case _0x0a6b('0x3b'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x3c');break;case _0x0a6b('0x3d'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x3e');break;case _0x0a6b('0x3f'):_0x5c77fb[_0x0a6b('0x11')]='Campaign';break;case _0x0a6b('0x40'):_0x5c77fb['childModel']='MailQueue';break;case _0x0a6b('0x41'):_0x5c77fb['childModel']='MailAccount';break;case _0x0a6b('0x42'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x43');break;case'openchannelqueues':_0x5c77fb[_0x0a6b('0x11')]='OpenchannelQueue';break;case'openchannelaccounts':_0x5c77fb[_0x0a6b('0x11')]='OpenchannelAccount';break;case _0x0a6b('0x44'):_0x5c77fb['childModel']=_0x0a6b('0x45');break;case'smsaccounts':_0x5c77fb['childModel']=_0x0a6b('0x46');break;case _0x0a6b('0x47'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x48');break;case'whatsappaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x49');break;case _0x0a6b('0x4a'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x4b');break;case _0x0a6b('0x4c'):case _0x0a6b('0x4d'):_0x5c77fb['childModel']=_0x0a6b('0x37');if(_0x3d153f){_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x32')},{'name':_0x0a6b('0x36')}];}break;case _0x0a6b('0x4e'):case _0x0a6b('0x4f'):case _0x0a6b('0x50'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2d');if(_0x3d153f){_0x5c77fb['parentSections']=[{'name':_0x0a6b('0x51'),'filter':{'field':_0x0a6b('0x2e'),'value':[_0x0a6b('0x52'),_0x0a6b('0x53')]},'ignore':!![]},{'name':_0x0a6b('0x2c')},{'name':_0x0a6b('0x2f')}];}break;case _0x0a6b('0x54'):_0x5c77fb['childModel']='ZendeskAccount';break;case _0x0a6b('0x55'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x56');break;case _0x0a6b('0x57'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x58');break;case _0x0a6b('0x59'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5a');break;case'deskaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5b');break;case _0x0a6b('0x5c'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5d');break;case'vtigeraccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2d');break;case _0x0a6b('0x5e'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5f');break;case _0x0a6b('0x60'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x61');break;case _0x0a6b('0x62'):_0x5c77fb[_0x0a6b('0x11')]='Dashboard';break;case'intervals':_0x5c77fb[_0x0a6b('0x11')]='Interval';break;case _0x0a6b('0x63'):_0x5c77fb['childModel']=_0x0a6b('0x64');break;case _0x0a6b('0x65'):_0x5c77fb[_0x0a6b('0x11')]='Schedule';break;case _0x0a6b('0x66'):_0x5c77fb[_0x0a6b('0x11')]='Sound';break;case _0x0a6b('0x67'):_0x5c77fb['childModel']=_0x0a6b('0x68');break;case _0x0a6b('0x69'):_0x5c77fb['childModel']=_0x0a6b('0x6a');break;case'triggers':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x6b');break;case _0x0a6b('0x6c'):_0x5c77fb['childModel']=_0x0a6b('0x6d');break;case _0x0a6b('0x6e'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x6f');break;case _0x0a6b('0x70'):_0x5c77fb[_0x0a6b('0x11')]='Plugin';break;case'extractedreports':_0x5c77fb['childModel']=_0x0a6b('0xd');_0x5c77fb['parentSections']=[{'name':_0x0a6b('0x71'),'field':'id','foreignKey':_0x0a6b('0x72')}];break;case'metrics':_0x5c77fb['childModel']='AnalyticMetric';break;}return _0x5c77fb;}function _0x19e9a6(_0x187c12,_0x4b7f32){var _0xb84ccf=_0x187c12[_0x0a6b('0x73')](0x0)[_0x0a6b('0x74')]()+_0x187c12[_0x0a6b('0x75')](0x1);var _0x2ebd68={'type':_0x13d4d5['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x40cba9,_0x2fb572){var _0x58d4ce=squel[_0x0a6b('0x76')]()['field'](_0x0a6b('0x77')+_0xb84ccf+_0x0a6b('0x78'),'id')[_0x0a6b('0x4')](_0x0a6b('0x79'))[_0x0a6b('0x7a')]('user_has_'+_0x187c12+_0x0a6b('0x7b'),'ui')[_0x0a6b('0x7c')](_0x0a6b('0x7d'),_0x4b7f32['id']);return _0x13d4d5[_0x0a6b('0x7e')]['query'](_0x58d4ce[_0x0a6b('0x7f')](),_0x2ebd68)[_0x0a6b('0xa')](function(_0x292c87){_0x4b7f32[_0xb84ccf+_0x0a6b('0x80')]=_0x292c87;_0x40cba9(_0x292c87);})[_0x0a6b('0x9')](function(_0x581738){_0x2fb572(_0x581738);});});}return _0x2c0d7f[_0x0a6b('0x81')](_0x0a6b('0x82'),attributes,{'tableName':_0x0a6b('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x24b829){var _0x16c13a={'raw':![],'where':{}};var _0x1f4e0d={};var _0x1f715b={'count':0x0,'rows':[]};var _0xa1b7e7=_0x24b829['query'][_0x0a6b('0x84')];var _0x10830a=_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x86')]||![];var _0x583b01=_0x1e5065(_0xa1b7e7,_0x10830a);if(!_0x583b01[_0x0a6b('0x11')])throw new Error(_0x0a6b('0x87')+_0xa1b7e7+'\x27');var _0x3b2a20=[{'name':_0xa1b7e7}];if(!_[_0x0a6b('0x88')](_0x583b01[_0x0a6b('0x16')]))_0x3b2a20=_0x583b01[_0x0a6b('0x16')];var _0x3db026=[];for(var _0x45f990=0x0;_0x45f990<_0x3b2a20[_0x0a6b('0x89')];_0x45f990++){_0x3db026[_0x0a6b('0x8a')](_0x13d4d5[_0x0a6b('0x8b')][_0x0a6b('0x8c')]({'where':{'userProfileId':_0x24b829[_0x0a6b('0x8d')]['id'],'name':_0x3b2a20[_0x45f990][_0x0a6b('0xb')]},'raw':!![]}));}return Promise[_0x0a6b('0x8e')](_0x3db026)['then'](function(_0x55b386){var _0x3703c3=_[_0x0a6b('0x3')](_0x55b386,function(_0x4a3161){return _0x4a3161?_0x4a3161:undefined;});var _0x4502aa=_[_0x0a6b('0x3')](_0x3b2a20,[_0x0a6b('0x8f'),!![]]);var _0x21b9dc=_[_0x0a6b('0x88')](_0x3703c3)&&_[_0x0a6b('0x88')](_0x4502aa)?null:_[_0x0a6b('0x90')](_0x4502aa,_0x3703c3);if(!_0x21b9dc)return null;var _0x47d2c7=[];for(var _0x16f42f=0x0;_0x16f42f<_0x21b9dc[_0x0a6b('0x89')];_0x16f42f++){var _0x240426=_['find'](_0x3b2a20,function(_0x3b6b10){return _0x21b9dc[_0x16f42f]?_0x3b6b10['name']===_0x21b9dc[_0x16f42f][_0x0a6b('0xb')]:null;});if(_0x240426){if(_0x21b9dc[_0x16f42f][_0x0a6b('0x8f')]){_0x47d2c7[_0x0a6b('0x8a')](_0x29ff80(_0x583b01[_0x0a6b('0x11')],_0x21b9dc[_0x16f42f]));}else{if(!_0x21b9dc[_0x16f42f][_0x0a6b('0x91')]){_0x47d2c7[_0x0a6b('0x8a')](_0x9d7aba(_0x240426,_0x21b9dc[_0x16f42f],_0x583b01[_0x0a6b('0x11')]));}else{if(_0x240426['model']){_0x47d2c7[_0x0a6b('0x8a')](_0x81a412(_0x240426,_0x21b9dc[_0x16f42f]));}}}}}return Promise[_0x0a6b('0x8e')](_0x47d2c7);})[_0x0a6b('0xa')](function(_0x356d70){var _0x374dbd=_0x356d70;var _0x56db5d=null;if(_0x374dbd){_0x56db5d=_0x374dbd[_0x0a6b('0x89')]===0x1?_0x374dbd[0x0]:null;}if(!_0x56db5d&&!_0x374dbd)return _0x1f715b;var _0x5bf4d7=_0x13d4d5[_0x583b01['childModel']][_0x0a6b('0x92')];_0x1f4e0d[_0x0a6b('0x93')]=_[_0x0a6b('0x94')](_0x5bf4d7);_0x1f4e0d[_0x0a6b('0x85')]=_[_0x0a6b('0x94')](_0x24b829[_0x0a6b('0x85')]);_0x1f4e0d[_0x0a6b('0x95')]=_[_0x0a6b('0x96')](_0x1f4e0d[_0x0a6b('0x93')],_0x1f4e0d[_0x0a6b('0x85')]);_0x16c13a[_0x0a6b('0x97')]=_[_0x0a6b('0x96')](_0x1f4e0d['model'],qs[_0x0a6b('0x98')](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x98')]));_0x16c13a[_0x0a6b('0x97')]=_0x16c13a['attributes'][_0x0a6b('0x89')]?_0x16c13a['attributes']:_0x1f4e0d[_0x0a6b('0x93')];if(!_0x24b829[_0x0a6b('0x85')]['hasOwnProperty']('nolimit')){_0x16c13a[_0x0a6b('0x99')]=qs['limit'](_0x24b829[_0x0a6b('0x85')]['limit']);_0x16c13a[_0x0a6b('0x9a')]=qs['offset'](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x9a')]);}_0x16c13a['order']=qs['sort'](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x9b')]);_0x16c13a[_0x0a6b('0x7c')]=qs[_0x0a6b('0x95')](_['pick'](_0x24b829[_0x0a6b('0x85')],_0x1f4e0d['filters']));if(_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x3')]){_0x16c13a[_0x0a6b('0x7c')]=_[_0x0a6b('0x9c')](_0x16c13a[_0x0a6b('0x7c')],{'$or':_[_0x0a6b('0x8')](_0x5bf4d7,function(_0x157c6f){if(_0x157c6f[_0x0a6b('0x34')]['key']!==_0x0a6b('0x9d')){var _0x5e565a={};_0x5e565a[_0x157c6f[_0x0a6b('0x4')]]={'$like':'%'+_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x3')]+'%'};return _0x5e565a;}})});}var _0x3ea550=[];var _0x4d9cfe=null;var _0x94db76={};if(_0x56db5d){_0x4d9cfe=_[_0x0a6b('0x8c')](_0x3b2a20,['name',_0x56db5d[_0x0a6b('0xb')]]);if(_0x4d9cfe['field']){_0x94db76={};if(_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0xd')){_0x94db76[_0x4d9cfe['foreignKey']]=_['map'](_0x56db5d[_0x0a6b('0x7')],'id');}else{_0x94db76[_0x4d9cfe[_0x0a6b('0x9e')]]=_0x56db5d['associatedResources'];}_0x3ea550[_0x0a6b('0x8a')](_0x94db76);}else{_0x16c13a[_0x0a6b('0x7c')]['id']=_0x56db5d['associatedResources'];}}else{for(var _0x33231d=0x0;_0x33231d<_0x374dbd[_0x0a6b('0x89')];_0x33231d++){_0x4d9cfe=_[_0x0a6b('0x8c')](_0x3b2a20,['name',_0x374dbd[_0x33231d][_0x0a6b('0xb')]]);if(_0x4d9cfe[_0x0a6b('0x4')]){_0x94db76={};_0x94db76[_0x4d9cfe[_0x0a6b('0x9e')]]=_0x374dbd[_0x33231d][_0x0a6b('0x7')];_0x3ea550['push'](_0x94db76);}else{if(!_0x16c13a[_0x0a6b('0x7c')]['id'])_0x16c13a['where']['id']=[];_0x374dbd[_0x33231d]['associatedResources'][_0x0a6b('0x9f')](function(_0x204626){_0x16c13a[_0x0a6b('0x7c')]['id'][_0x0a6b('0x8a')](_0x204626);});}}}if(!_['isEmpty'](_0x3ea550)){_0x16c13a[_0x0a6b('0x7c')]=_[_0x0a6b('0x9c')](_0x16c13a[_0x0a6b('0x7c')],{'$and':{'$or':_0x3ea550}});}_0x16c13a=_[_0x0a6b('0x9c')]({},_0x16c13a,_0x24b829[_0x0a6b('0xa0')]);if(_0x56db5d&&!_0x56db5d[_0x0a6b('0x91')]&&_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0xd')){if(_0x24b829[_0x0a6b('0x85')][_0x0a6b('0xa1')]){_0x16c13a[_0x0a6b('0xa2')]=[{'all':!![]}];}return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0x6')](_0x16c13a)['then'](function(_0x482878){var _0x38c60d=[];_0x482878['forEach'](function(_0x2d73c2){var _0xb5e93d;switch(_0x2d73c2['reportType']){case _0x0a6b('0xa3'):_0xb5e93d=_[_0x0a6b('0x8c')](_0x56db5d[_0x0a6b('0x7')],function(_0x3158e9){return _0x3158e9['id']===_0x2d73c2['reportId']&&_0x3158e9[_0x0a6b('0x34')]==='DefaultReports';});break;case _0x0a6b('0xa4'):_0xb5e93d=_[_0x0a6b('0x8c')](_0x56db5d[_0x0a6b('0x7')],function(_0x74ce8d){return _0x74ce8d['id']===_0x2d73c2[_0x0a6b('0x72')]&&_0x74ce8d[_0x0a6b('0x34')]===_0x0a6b('0xa5');});break;}if(_0xb5e93d)_0x38c60d[_0x0a6b('0x8a')](_0x2d73c2);});_0x1f715b[_0x0a6b('0xa6')]=_0x38c60d[_0x0a6b('0x89')];_0x1f715b[_0x0a6b('0xa7')]=_0x38c60d;return _0x1f715b;});}else{return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0xa6')]({'where':_0x16c13a[_0x0a6b('0x7c')]})['then'](function(_0x4387d0){_0x1f715b[_0x0a6b('0xa6')]=_0x4387d0;if(_0x24b829['query'][_0x0a6b('0xa1')]){if(_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0x1a')){_0x16c13a['include']=[{'model':_0x13d4d5[_0x0a6b('0x68')],'as':_0x0a6b('0xa8'),'attributes':['id',_0x0a6b('0xb'),'color'],'required':_0x24b829[_0x0a6b('0x85')]['tag']?!![]:![]},{'model':_0x13d4d5[_0x0a6b('0x68')],'as':'ThroughTags','attributes':['id',_0x0a6b('0xb'),_0x0a6b('0xa9')],'through':_0x24b829['query']['tag']?{'attributes':[],'where':{'TagId':_0x24b829['query'][_0x0a6b('0xaa')]||undefined}}:{},'required':_0x24b829[_0x0a6b('0x85')][_0x0a6b('0xaa')]?!![]:![]}];}else{_0x16c13a[_0x0a6b('0xa2')]=[{'all':!![]}];}}return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0x6')](_0x16c13a);})[_0x0a6b('0xa')](function(_0x4b9e79){_0x1f715b[_0x0a6b('0xa7')]=_0x4b9e79;if(_0xa1b7e7===_0x0a6b('0x2c')&&_0x24b829['query'][_0x0a6b('0xab')]==='true'){var _0x5b8e37=[];for(var _0x25a602=0x0;_0x25a602<_0x1f715b[_0x0a6b('0xa7')]['length'];_0x25a602++){_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xac'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602]['dataValues']));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xad'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xaf'),_0x1f715b['rows'][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37['push'](_0x19e9a6(_0x0a6b('0xb0'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6('openchannel',_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37['push'](_0x19e9a6(_0x0a6b('0xb1'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));}return Promise[_0x0a6b('0x8e')](_0x5b8e37)['then'](function(){return _0x1f715b;});}return _0x1f715b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2bb2134..4e7e54c 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 _0xaafc=['localhost','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults'];(function(_0x4b51cd,_0x101350){var _0x14460d=function(_0x17bbff){while(--_0x17bbff){_0x4b51cd['push'](_0x4b51cd['shift']());}};_0x14460d(++_0x101350);}(_0xaafc,0x176));var _0xcaaf=function(_0x131321,_0x257fd8){_0x131321=_0x131321-0x0;var _0x51232a=_0xaafc[_0x131321];return _0x51232a;};'use strict';var _=require('lodash');var util=require(_0xcaaf('0x0'));var moment=require(_0xcaaf('0x1'));var BPromise=require(_0xcaaf('0x2'));var rs=require(_0xcaaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaaf('0x4'))['db'];var utils=require(_0xcaaf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcaaf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcaaf('0x7')]['http']({'port':0x232a});config[_0xcaaf('0x8')]=_[_0xcaaf('0x9')](config[_0xcaaf('0x8')],{'host':_0xcaaf('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcaaf('0x8')]));require('./userProfile.socket')[_0xcaaf('0xb')](socket);function respondWithRpcPromise(_0x54dc9d,_0x94f4d6,_0x5f11b0){return new BPromise(function(_0x163ced,_0x12f13d){return client[_0xcaaf('0xc')](_0x54dc9d,_0x5f11b0)[_0xcaaf('0xd')](function(_0x3c6e77){logger[_0xcaaf('0xe')](_0xcaaf('0xf'),_0x94f4d6,_0xcaaf('0x10'));logger[_0xcaaf('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x94f4d6,_0xcaaf('0x10'),JSON[_0xcaaf('0x12')](_0x3c6e77));if(_0x3c6e77[_0xcaaf('0x13')]){if(_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x14')]===0x1f4){logger[_0xcaaf('0x13')](_0xcaaf('0xf'),_0x94f4d6,_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x15')]);return _0x12f13d(_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x15')]);}logger['error'](_0xcaaf('0xf'),_0x94f4d6,_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x15')]);return _0x163ced(_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x15')]);}else{logger[_0xcaaf('0xe')]('UserProfile,\x20%s,\x20%s',_0x94f4d6,_0xcaaf('0x10'));_0x163ced(_0x3c6e77[_0xcaaf('0x16')]['message']);}})[_0xcaaf('0x17')](function(_0x2c988c){logger[_0xcaaf('0x13')](_0xcaaf('0xf'),_0x94f4d6,_0x2c988c);_0x12f13d(_0x2c988c);});});} \ No newline at end of file +var _0x4888=['../../config/environment','jayson/promise','client','http','redis','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x19543c,_0x3d0c26){var _0x41e0de=function(_0x1bd03a){while(--_0x1bd03a){_0x19543c['push'](_0x19543c['shift']());}};_0x41e0de(++_0x3d0c26);}(_0x4888,0x198));var _0x8488=function(_0x4989fe,_0x201e34){_0x4989fe=_0x4989fe-0x0;var _0x4afd24=_0x4888[_0x4989fe];return _0x4afd24;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});config[_0x8488('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0xc')]));require(_0x8488('0xd'))['register'](socket);function respondWithRpcPromise(_0x19c994,_0x1334fe,_0x98223){return new BPromise(function(_0x19a2ee,_0x515ea8){return client[_0x8488('0xe')](_0x19c994,_0x98223)[_0x8488('0xf')](function(_0x468896){logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,'request\x20sent');logger[_0x8488('0x12')](_0x8488('0x13'),_0x1334fe,'request\x20sent',JSON['stringify'](_0x468896));if(_0x468896[_0x8488('0x14')]){if(_0x468896['error'][_0x8488('0x15')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1334fe,_0x468896[_0x8488('0x14')][_0x8488('0x16')]);return _0x515ea8(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x468896[_0x8488('0x14')]['message']);return _0x19a2ee(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}else{logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,_0x8488('0x17'));_0x19a2ee(_0x468896[_0x8488('0x18')][_0x8488('0x16')]);}})[_0x8488('0x19')](function(_0x514c31){logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x514c31);_0x515ea8(_0x514c31);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 956b85a..dcb3602 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 _0x6fc2=['length','userProfile:','./userProfile.events','remove','update','emit','register'];(function(_0x2c8972,_0x1aff63){var _0x5d1e22=function(_0x56428c){while(--_0x56428c){_0x2c8972['push'](_0x2c8972['shift']());}};_0x5d1e22(++_0x1aff63);}(_0x6fc2,0x64));var _0x26fc=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x6fc2[_0x2112d4];return _0x434972;};'use strict';var UserProfileEvents=require(_0x26fc('0x0'));var events=['save',_0x26fc('0x1'),_0x26fc('0x2')];function createListener(_0x295075,_0x50e4cd){return function(_0x294643){_0x50e4cd[_0x26fc('0x3')](_0x295075,_0x294643);};}function removeListener(_0x12b54f,_0x4a4f6a){return function(){UserProfileEvents['removeListener'](_0x12b54f,_0x4a4f6a);};}exports[_0x26fc('0x4')]=function(_0x3c9cd1){for(var _0x4e255b=0x0,_0x15580b=events[_0x26fc('0x5')];_0x4e255b<_0x15580b;_0x4e255b++){var _0xe38e60=events[_0x4e255b];var _0x10b9f6=createListener(_0x26fc('0x6')+_0xe38e60,_0x3c9cd1);UserProfileEvents['on'](_0xe38e60,_0x10b9f6);}}; \ No newline at end of file +var _0x8c1e=['length','userProfile:','./userProfile.events','save','remove','update','register'];(function(_0x4bcd6a,_0x413d41){var _0x28b6b=function(_0x4c857e){while(--_0x4c857e){_0x4bcd6a['push'](_0x4bcd6a['shift']());}};_0x28b6b(++_0x413d41);}(_0x8c1e,0xf7));var _0xe8c1=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x8c1e[_0x599f41];return _0x2e4d58;};'use strict';var UserProfileEvents=require(_0xe8c1('0x0'));var events=[_0xe8c1('0x1'),_0xe8c1('0x2'),_0xe8c1('0x3')];function createListener(_0x586aa5,_0x48203f){return function(_0x490c7e){_0x48203f['emit'](_0x586aa5,_0x490c7e);};}function removeListener(_0x1e3406,_0x4aca1a){return function(){UserProfileEvents['removeListener'](_0x1e3406,_0x4aca1a);};}exports[_0xe8c1('0x4')]=function(_0x10670a){for(var _0x55aac2=0x0,_0x1e60d5=events[_0xe8c1('0x5')];_0x55aac2<_0x1e60d5;_0x55aac2++){var _0x3fd9b1=events[_0x55aac2];var _0x1fce07=createListener(_0xe8c1('0x6')+_0x3fd9b1,_0x10670a);UserProfileEvents['on'](_0x3fd9b1,_0x1fce07);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 7e28f91..f233bbb 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 _0x75be=['express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','delete','destroy','exports','multer','path'];(function(_0x22dcba,_0x315637){var _0x330c1c=function(_0x4aba19){while(--_0x4aba19){_0x22dcba['push'](_0x22dcba['shift']());}};_0x330c1c(++_0x315637);}(_0x75be,0x11b));var _0xe75b=function(_0x5177b9,_0x48f3df){_0x5177b9=_0x5177b9-0x0;var _0x46419b=_0x75be[_0x5177b9];return _0x46419b;};'use strict';var multer=require(_0xe75b('0x0'));var util=require('util');var path=require(_0xe75b('0x1'));var timeout=require('connect-timeout');var express=require(_0xe75b('0x2'));var router=express[_0xe75b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe75b('0x4'));var interaction=require(_0xe75b('0x5'));var config=require('../../config/environment');var controller=require(_0xe75b('0x6'));router[_0xe75b('0x7')]('/',auth[_0xe75b('0x8')](),controller[_0xe75b('0x9')]);router[_0xe75b('0x7')](_0xe75b('0xa'),auth[_0xe75b('0x8')](),controller[_0xe75b('0xb')]);router[_0xe75b('0x7')]('/:id',auth[_0xe75b('0x8')](),controller['show']);router[_0xe75b('0xc')]('/',auth['isAuthenticated'](),controller[_0xe75b('0xd')]);router[_0xe75b('0xe')](_0xe75b('0xf'),auth[_0xe75b('0x8')](),controller['update']);router[_0xe75b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe75b('0x11')]);module[_0xe75b('0x12')]=router; \ No newline at end of file +var _0x2352=['create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x40e402,_0x1e59cd){var _0x4738d7=function(_0xfc213d){while(--_0xfc213d){_0x40e402['push'](_0x40e402['shift']());}};_0x4738d7(++_0x1e59cd);}(_0x2352,0x156));var _0x2235=function(_0x27839b,_0x387853){_0x27839b=_0x27839b-0x0;var _0x46fad9=_0x2352[_0x27839b];return _0x46fad9;};'use strict';var multer=require(_0x2235('0x0'));var util=require(_0x2235('0x1'));var path=require(_0x2235('0x2'));var timeout=require(_0x2235('0x3'));var express=require(_0x2235('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2235('0x5'));var config=require(_0x2235('0x6'));var controller=require(_0x2235('0x7'));router[_0x2235('0x8')]('/',auth[_0x2235('0x9')](),controller[_0x2235('0xa')]);router['get'](_0x2235('0xb'),auth[_0x2235('0x9')](),controller[_0x2235('0xc')]);router[_0x2235('0x8')]('/:id',auth[_0x2235('0x9')](),controller[_0x2235('0xd')]);router[_0x2235('0xe')]('/',auth[_0x2235('0x9')](),controller[_0x2235('0xf')]);router[_0x2235('0x10')](_0x2235('0x11'),auth['isAuthenticated'](),controller[_0x2235('0x12')]);router[_0x2235('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2235('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f3375af..ccc8893 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 _0x567d=['STRING','exports'];(function(_0x56a6b6,_0x3e35a9){var _0x47a5b4=function(_0x348a5c){while(--_0x348a5c){_0x56a6b6['push'](_0x56a6b6['shift']());}};_0x47a5b4(++_0x3e35a9);}(_0x567d,0x93));var _0xd567=function(_0x357e51,_0x455cb3){_0x357e51=_0x357e51-0x0;var _0x2a8d9a=_0x567d[_0x357e51];return _0x2a8d9a;};'use strict';var Sequelize=require('sequelize');module[_0xd567('0x0')]={'name':{'type':Sequelize[_0xd567('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xd567('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x365e=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x365e,0xcd));var _0xe365=function(_0x14d2c7,_0x468f7c){_0x14d2c7=_0x14d2c7-0x0;var _0x1a9801=_0x365e[_0x14d2c7];return _0x1a9801;};'use strict';var Sequelize=require('sequelize');module[_0xe365('0x0')]={'name':{'type':Sequelize[_0xe365('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xe365('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 8432d2b..ab78f27 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 _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x101d5b,_0x40cfd){var _0x382a50=function(_0x2fd131){while(--_0x2fd131){_0x101d5b['push'](_0x101d5b['shift']());}};_0x382a50(++_0x40cfd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2449c8,_0x517beb){_0x2449c8=_0x2449c8-0x0;var _0x3540ed=_0x5f2f[_0x2449c8];return _0x3540ed;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file +var _0x1261=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','UserProfileResource','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xbcb528,_0x1deefc){var _0x5f5446=function(_0x2837a9){while(--_0x2837a9){_0xbcb528['push'](_0xbcb528['shift']());}};_0x5f5446(++_0x1deefc);}(_0x1261,0x144));var _0x1126=function(_0x132fb6,_0x7a257b){_0x132fb6=_0x132fb6-0x0;var _0x2ca9d5=_0x1261[_0x132fb6];return _0x2ca9d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['UserProfileResource'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['UserProfileResource']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));};exports[_0x1126('0x45')]=function(_0x52a9a4,_0x3cb44c){return db[_0x1126('0x29')][_0x1126('0x45')]()[_0x1126('0x25')](respondWithResult(_0x3cb44c,null))['catch'](handleError(_0x3cb44c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ddfdfa0..a33ece6 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 _0xcd54=['compositeIndex','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource'];(function(_0x35ad5c,_0x58ccf7){var _0x2bd8aa=function(_0x426bdf){while(--_0x426bdf){_0x35ad5c['push'](_0x35ad5c['shift']());}};_0x2bd8aa(++_0x58ccf7);}(_0xcd54,0x123));var _0x4cd5=function(_0x11c327,_0x1132c0){_0x11c327=_0x11c327-0x0;var _0x151829=_0xcd54[_0x11c327];return _0x151829;};'use strict';var _=require(_0x4cd5('0x0'));var util=require(_0x4cd5('0x1'));var logger=require(_0x4cd5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4cd5('0x3'));var fs=require('fs');var path=require(_0x4cd5('0x4'));var rimraf=require(_0x4cd5('0x5'));var config=require(_0x4cd5('0x6'));var attributes=require(_0x4cd5('0x7'));module['exports']=function(_0xa266b1,_0x3767b9){return _0xa266b1['define'](_0x4cd5('0x8'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x4cd5('0x9'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa41=['resourceId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','compositeIndex'];(function(_0x21949f,_0x4a61ab){var _0xff3003=function(_0x194af5){while(--_0x194af5){_0x21949f['push'](_0x21949f['shift']());}};_0xff3003(++_0x4a61ab);}(_0xfa41,0x16d));var _0x1fa4=function(_0xf02353,_0x5d599b){_0xf02353=_0xf02353-0x0;var _0x59f7df=_0xfa41[_0xf02353];return _0x59f7df;};'use strict';var _=require(_0x1fa4('0x0'));var util=require(_0x1fa4('0x1'));var logger=require('../../config/logger')(_0x1fa4('0x2'));var moment=require(_0x1fa4('0x3'));var BPromise=require(_0x1fa4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fa4('0x5'));var rimraf=require(_0x1fa4('0x6'));var config=require(_0x1fa4('0x7'));var attributes=require(_0x1fa4('0x8'));module[_0x1fa4('0x9')]=function(_0x280c2b,_0x19135c){return _0x280c2b['define'](_0x1fa4('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x1fa4('0xb'),'fields':[_0x1fa4('0xc'),'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 6b27f62..631d6aa 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 _0xee1f=['request','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x489d51,_0x433289){var _0x2451d3=function(_0x5143f3){while(--_0x5143f3){_0x489d51['push'](_0x489d51['shift']());}};_0x2451d3(++_0x433289);}(_0xee1f,0x8f));var _0xfee1=function(_0x31e3d9,_0x5ddc23){_0x31e3d9=_0x31e3d9-0x0;var _0x341935=_0xee1f[_0x31e3d9];return _0x341935;};'use strict';var _=require(_0xfee1('0x0'));var util=require('util');var moment=require(_0xfee1('0x1'));var BPromise=require('bluebird');var rs=require(_0xfee1('0x2'));var fs=require('fs');var Redis=require(_0xfee1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfee1('0x4'))(_0xfee1('0x5'));var config=require(_0xfee1('0x6'));var jayson=require(_0xfee1('0x7'));var client=jayson[_0xfee1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46db22,_0x10e7fc,_0x34774a){return new BPromise(function(_0x472ea2,_0x535d24){return client[_0xfee1('0x9')](_0x46db22,_0x34774a)['then'](function(_0x87b06d){logger[_0xfee1('0xa')](_0xfee1('0xb'),_0x10e7fc,'request\x20sent');logger[_0xfee1('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x10e7fc,_0xfee1('0xd'),JSON[_0xfee1('0xe')](_0x87b06d));if(_0x87b06d[_0xfee1('0xf')]){if(_0x87b06d[_0xfee1('0xf')][_0xfee1('0x10')]===0x1f4){logger[_0xfee1('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x10e7fc,_0x87b06d[_0xfee1('0xf')]['message']);return _0x535d24(_0x87b06d[_0xfee1('0xf')]['message']);}logger[_0xfee1('0xf')](_0xfee1('0xb'),_0x10e7fc,_0x87b06d['error'][_0xfee1('0x11')]);return _0x472ea2(_0x87b06d['error']['message']);}else{logger[_0xfee1('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x10e7fc,_0xfee1('0xd'));_0x472ea2(_0x87b06d[_0xfee1('0x12')]['message']);}})['catch'](function(_0x11a72f){logger['error'](_0xfee1('0xb'),_0x10e7fc,_0x11a72f);_0x535d24(_0x11a72f);});});} \ No newline at end of file +var _0x4546=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x23cd42,_0x2f7c60){var _0x5bd4ed=function(_0x2cdfb2){while(--_0x2cdfb2){_0x23cd42['push'](_0x23cd42['shift']());}};_0x5bd4ed(++_0x2f7c60);}(_0x4546,0x101));var _0x6454=function(_0x3b9b2e,_0x2b4045){_0x3b9b2e=_0x3b9b2e-0x0;var _0x49d29f=_0x4546[_0x3b9b2e];return _0x49d29f;};'use strict';var _=require(_0x6454('0x0'));var util=require('util');var moment=require(_0x6454('0x1'));var BPromise=require(_0x6454('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6454('0x3'));var db=require(_0x6454('0x4'))['db'];var utils=require(_0x6454('0x5'));var logger=require(_0x6454('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6454('0x7'));var client=jayson[_0x6454('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xadba89,_0x2fd82c,_0x4ddb69){return new BPromise(function(_0x8a9eb5,_0x2b4fe9){return client[_0x6454('0x9')](_0xadba89,_0x4ddb69)[_0x6454('0xa')](function(_0x4b491a){logger[_0x6454('0xb')](_0x6454('0xc'),_0x2fd82c,_0x6454('0xd'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2fd82c,_0x6454('0xd'),JSON[_0x6454('0xe')](_0x4b491a));if(_0x4b491a[_0x6454('0xf')]){if(_0x4b491a[_0x6454('0xf')][_0x6454('0x10')]===0x1f4){logger[_0x6454('0xf')](_0x6454('0xc'),_0x2fd82c,_0x4b491a[_0x6454('0xf')][_0x6454('0x11')]);return _0x2b4fe9(_0x4b491a['error'][_0x6454('0x11')]);}logger[_0x6454('0xf')](_0x6454('0xc'),_0x2fd82c,_0x4b491a['error']['message']);return _0x8a9eb5(_0x4b491a[_0x6454('0xf')]['message']);}else{logger[_0x6454('0xb')](_0x6454('0xc'),_0x2fd82c,_0x6454('0xd'));_0x8a9eb5(_0x4b491a[_0x6454('0x12')][_0x6454('0x11')]);}})[_0x6454('0x13')](function(_0x4d6e63){logger['error'](_0x6454('0xc'),_0x2fd82c,_0x4d6e63);_0x2b4fe9(_0x4d6e63);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 390a493..acda79e 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 _0xc1ab=['get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc1ab,0x74));var _0xbc1a=function(_0x4169b7,_0x4dc964){_0x4169b7=_0x4169b7-0x0;var _0x1e1005=_0xc1ab[_0x4169b7];return _0x1e1005;};'use strict';var multer=require('multer');var util=require(_0xbc1a('0x0'));var path=require(_0xbc1a('0x1'));var timeout=require(_0xbc1a('0x2'));var express=require(_0xbc1a('0x3'));var router=express[_0xbc1a('0x4')]();var fs_extra=require(_0xbc1a('0x5'));var auth=require(_0xbc1a('0x6'));var interaction=require(_0xbc1a('0x7'));var config=require(_0xbc1a('0x8'));var controller=require(_0xbc1a('0x9'));router[_0xbc1a('0xa')]('/',auth[_0xbc1a('0xb')](),controller[_0xbc1a('0xc')]);router[_0xbc1a('0xa')](_0xbc1a('0xd'),auth[_0xbc1a('0xb')](),controller[_0xbc1a('0xe')]);router[_0xbc1a('0xa')](_0xbc1a('0xf'),auth[_0xbc1a('0xb')](),controller[_0xbc1a('0x10')]);router['post']('/',auth[_0xbc1a('0xb')](),controller['create']);router[_0xbc1a('0x11')]('/:id',auth[_0xbc1a('0xb')](),controller[_0xbc1a('0x12')]);router['delete'](_0xbc1a('0xf'),auth['isAuthenticated'](),controller[_0xbc1a('0x13')]);module[_0xbc1a('0x14')]=router; \ No newline at end of file +var _0x7f7e=['isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe'];(function(_0x43f0d2,_0x231789){var _0x53cc0b=function(_0x490802){while(--_0x490802){_0x43f0d2['push'](_0x43f0d2['shift']());}};_0x53cc0b(++_0x231789);}(_0x7f7e,0x8e));var _0xe7f7=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7f7e[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xe7f7('0x0'));var util=require(_0xe7f7('0x1'));var path=require(_0xe7f7('0x2'));var timeout=require(_0xe7f7('0x3'));var express=require('express');var router=express[_0xe7f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7f7('0x5'));var interaction=require(_0xe7f7('0x6'));var config=require(_0xe7f7('0x7'));var controller=require(_0xe7f7('0x8'));router[_0xe7f7('0x9')]('/',auth['isAuthenticated'](),controller[_0xe7f7('0xa')]);router[_0xe7f7('0x9')](_0xe7f7('0xb'),auth[_0xe7f7('0xc')](),controller[_0xe7f7('0xd')]);router[_0xe7f7('0x9')](_0xe7f7('0xe'),auth['isAuthenticated'](),controller[_0xe7f7('0xf')]);router[_0xe7f7('0x10')]('/',auth[_0xe7f7('0xc')](),controller[_0xe7f7('0x11')]);router[_0xe7f7('0x12')](_0xe7f7('0xe'),auth[_0xe7f7('0xc')](),controller['update']);router[_0xe7f7('0x13')](_0xe7f7('0xe'),auth[_0xe7f7('0xc')](),controller[_0xe7f7('0x14')]);module[_0xe7f7('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 2227f3f..7f29f96 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 _0x1399=['sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue'];(function(_0x564f1e,_0x45fc17){var _0x3fd66d=function(_0x18c11b){while(--_0x18c11b){_0x564f1e['push'](_0x564f1e['shift']());}};_0x3fd66d(++_0x45fc17);}(_0x1399,0x16c));var _0x9139=function(_0xe4976c,_0x50e724){_0xe4976c=_0xe4976c-0x0;var _0xb69102=_0x1399[_0xe4976c];return _0xb69102;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x9139('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x9139('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x9139('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x9139('0x2')],'set':function(_0x28f155){this[_0x9139('0x4')](_0x9139('0x5'),_0x28f155?_0x28f155['join'](''):[]);},'get':function(){return this['getDataValue'](_0x9139('0x5'))?this[_0x9139('0x6')](_0x9139('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0xb7e7=['crudPermissions','getDataValue','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x154544,_0x1b0f6c){var _0x7b4302=function(_0xa52974){while(--_0xa52974){_0x154544['push'](_0x154544['shift']());}};_0x7b4302(++_0x1b0f6c);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7b7e('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x31d0ed){this[_0x7b7e('0x4')](_0x7b7e('0x5'),_0x31d0ed?_0x31d0ed['join'](''):[]);},'get':function(){return this['getDataValue'](_0x7b7e('0x5'))?this[_0x7b7e('0x6')](_0x7b7e('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c36de56..63bfed7 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 _0x55b5=['update','then','destroy','sendStatus','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','model','map','keys','intersection','attributes','fields','length','query','hasOwnProperty','order','sort','filters','filter','where','merge','options','include','findAll','catch','show','params','find','body','describe','eml-format','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x55b5,0x13e));var _0x555b=function(_0x36fc37,_0x1653e8){_0x36fc37=_0x36fc37-0x0;var _0x99b55e=_0x55b5[_0x36fc37];return _0x99b55e;};'use strict';var emlformat=require(_0x555b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x555b('0x1'));var rp=require('request-promise');var moment=require(_0x555b('0x2'));var BPromise=require(_0x555b('0x3'));var Mustache=require('mustache');var util=require(_0x555b('0x4'));var path=require(_0x555b('0x5'));var sox=require(_0x555b('0x6'));var csv=require('to-csv');var ejs=require(_0x555b('0x7'));var fs=require('fs');var fs_extra=require(_0x555b('0x8'));var _=require(_0x555b('0x9'));var squel=require(_0x555b('0xa'));var crypto=require(_0x555b('0xb'));var jsforce=require(_0x555b('0xc'));var deskjs=require(_0x555b('0xd'));var toCsv=require(_0x555b('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x555b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x555b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x555b('0x11'));var logger=require('../../config/logger')(_0x555b('0x12'));var utils=require(_0x555b('0x13'));var config=require(_0x555b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x555b('0x15'))['db'];function respondWithStatusCode(_0xcf41dd,_0x231dcd){_0x231dcd=_0x231dcd||0xcc;return function(_0x363517){if(_0x363517){return _0xcf41dd['sendStatus'](_0x231dcd);}return _0xcf41dd[_0x555b('0x16')](_0x231dcd)[_0x555b('0x17')]();};}function respondWithResult(_0x26bc11,_0x53f2bb){_0x53f2bb=_0x53f2bb||0xc8;return function(_0x2eed94){if(_0x2eed94){return _0x26bc11[_0x555b('0x16')](_0x53f2bb)[_0x555b('0x18')](_0x2eed94);}};}function respondWithFilteredResult(_0x247363,_0x49e5f0){return function(_0x5c196a){if(_0x5c196a){var _0x345ed8=typeof _0x49e5f0[_0x555b('0x19')]===_0x555b('0x1a')&&typeof _0x49e5f0[_0x555b('0x1b')]===_0x555b('0x1a');var _0x308285=_0x5c196a['count'];var _0xbe08ee=_0x345ed8?0x0:_0x49e5f0[_0x555b('0x19')];var _0x3ee1bd=_0x345ed8?_0x5c196a[_0x555b('0x1c')]:_0x49e5f0['offset']+_0x49e5f0[_0x555b('0x1b')];var _0x1af4a9;if(_0x3ee1bd>=_0x308285){_0x3ee1bd=_0x308285;_0x1af4a9=0xc8;}else{_0x1af4a9=0xce;}_0x247363[_0x555b('0x16')](_0x1af4a9);return _0x247363[_0x555b('0x1d')](_0x555b('0x1e'),_0xbe08ee+'-'+_0x3ee1bd+'/'+_0x308285)[_0x555b('0x18')](_0x5c196a);}return null;};}function patchUpdates(_0x588618){return function(_0x4b98df){try{jsonpatch['apply'](_0x4b98df,_0x588618,!![]);}catch(_0xb8f3b3){return BPromise['reject'](_0xb8f3b3);}return _0x4b98df[_0x555b('0x1f')]();};}function saveUpdates(_0x3b04d7,_0xdbf98c){return function(_0x5a12e1){if(_0x5a12e1){return _0x5a12e1[_0x555b('0x20')](_0x3b04d7)[_0x555b('0x21')](function(_0x412839){return _0x412839;});}return null;};}function removeEntity(_0x273e1d,_0x30be6d){return function(_0x5eb05e){if(_0x5eb05e){return _0x5eb05e[_0x555b('0x22')]()[_0x555b('0x21')](function(){_0x273e1d[_0x555b('0x16')](0xcc)[_0x555b('0x17')]();});}};}function handleEntityNotFound(_0x58a94d,_0x55541e){return function(_0x32080f){if(!_0x32080f){_0x58a94d[_0x555b('0x23')](0x194);}return _0x32080f;};}function handleError(_0x1cb865,_0x5f4438){_0x5f4438=_0x5f4438||0x1f4;return function(_0x4726d6){logger[_0x555b('0x24')](_0x4726d6[_0x555b('0x25')]);if(_0x4726d6[_0x555b('0x26')]){delete _0x4726d6[_0x555b('0x26')];}_0x1cb865[_0x555b('0x16')](_0x5f4438)[_0x555b('0x27')](_0x4726d6);};}exports[_0x555b('0x28')]=function(_0x21b6b7,_0x50b38c){var _0x49a23d={},_0x26e8b5={},_0x26bb13={'count':0x0,'rows':[]};var _0x2b2cd2=_['map'](db[_0x555b('0x29')][_0x555b('0x2a')],function(_0x221975){return{'name':_0x221975[_0x555b('0x2b')],'type':_0x221975[_0x555b('0x2c')][_0x555b('0x2d')]};});_0x26e8b5[_0x555b('0x2e')]=_[_0x555b('0x2f')](_0x2b2cd2,_0x555b('0x26'));_0x26e8b5['query']=_[_0x555b('0x30')](_0x21b6b7['query']);_0x26e8b5['filters']=_[_0x555b('0x31')](_0x26e8b5[_0x555b('0x2e')],_0x26e8b5['query']);_0x49a23d[_0x555b('0x32')]=_[_0x555b('0x31')](_0x26e8b5['model'],qs[_0x555b('0x33')](_0x21b6b7['query']['fields']));_0x49a23d[_0x555b('0x32')]=_0x49a23d[_0x555b('0x32')][_0x555b('0x34')]?_0x49a23d[_0x555b('0x32')]:_0x26e8b5[_0x555b('0x2e')];if(!_0x21b6b7[_0x555b('0x35')][_0x555b('0x36')]('nolimit')){_0x49a23d[_0x555b('0x1b')]=qs[_0x555b('0x1b')](_0x21b6b7['query'][_0x555b('0x1b')]);_0x49a23d[_0x555b('0x19')]=qs['offset'](_0x21b6b7[_0x555b('0x35')][_0x555b('0x19')]);}_0x49a23d[_0x555b('0x37')]=qs[_0x555b('0x38')](_0x21b6b7[_0x555b('0x35')][_0x555b('0x38')]);_0x49a23d['where']=qs[_0x555b('0x39')](_['pick'](_0x21b6b7[_0x555b('0x35')],_0x26e8b5[_0x555b('0x39')]),_0x2b2cd2);if(_0x21b6b7['query'][_0x555b('0x3a')]){_0x49a23d[_0x555b('0x3b')]=_[_0x555b('0x3c')](_0x49a23d[_0x555b('0x3b')],{'$or':_[_0x555b('0x2f')](_0x2b2cd2,function(_0x237538){if(_0x237538[_0x555b('0x2c')]!=='VIRTUAL'){var _0x1add81={};_0x1add81[_0x237538[_0x555b('0x26')]]={'$like':'%'+_0x21b6b7[_0x555b('0x35')][_0x555b('0x3a')]+'%'};return _0x1add81;}})});}_0x49a23d=_[_0x555b('0x3c')]({},_0x49a23d,_0x21b6b7[_0x555b('0x3d')]);var _0x4af198={'where':_0x49a23d[_0x555b('0x3b')]};return db[_0x555b('0x29')][_0x555b('0x1c')](_0x4af198)[_0x555b('0x21')](function(_0x164744){_0x26bb13['count']=_0x164744;if(_0x21b6b7[_0x555b('0x35')]['includeAll']){_0x49a23d[_0x555b('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x555b('0x3f')](_0x49a23d);})[_0x555b('0x21')](function(_0x4cef9c){_0x26bb13['rows']=_0x4cef9c;return _0x26bb13;})[_0x555b('0x21')](respondWithFilteredResult(_0x50b38c,_0x49a23d))[_0x555b('0x40')](handleError(_0x50b38c,null));};exports[_0x555b('0x41')]=function(_0xb7c9ce,_0x4931e7){var _0x536032={'raw':![],'where':{'id':_0xb7c9ce[_0x555b('0x42')]['id']}},_0x23d593={};_0x23d593[_0x555b('0x2e')]=_[_0x555b('0x30')](db[_0x555b('0x29')][_0x555b('0x2a')]);_0x23d593['query']=_[_0x555b('0x30')](_0xb7c9ce['query']);_0x23d593[_0x555b('0x39')]=_[_0x555b('0x31')](_0x23d593['model'],_0x23d593[_0x555b('0x35')]);_0x536032['attributes']=_[_0x555b('0x31')](_0x23d593[_0x555b('0x2e')],qs[_0x555b('0x33')](_0xb7c9ce['query'][_0x555b('0x33')]));_0x536032[_0x555b('0x32')]=_0x536032['attributes'][_0x555b('0x34')]?_0x536032[_0x555b('0x32')]:_0x23d593['model'];if(_0xb7c9ce[_0x555b('0x35')]['includeAll']){_0x536032[_0x555b('0x3e')]=[{'all':!![]}];}_0x536032=_[_0x555b('0x3c')]({},_0x536032,_0xb7c9ce['options']);return db['UserProfileSection'][_0x555b('0x43')](_0x536032)['then'](handleEntityNotFound(_0x4931e7,null))[_0x555b('0x21')](respondWithResult(_0x4931e7,null))[_0x555b('0x40')](handleError(_0x4931e7,null));};exports['create']=function(_0x5a9091,_0x494e68){return db['UserProfileSection']['create'](_0x5a9091[_0x555b('0x44')],{})['then'](respondWithResult(_0x494e68,0xc9))['catch'](handleError(_0x494e68,null));};exports[_0x555b('0x20')]=function(_0x421d11,_0x2a085b){if(_0x421d11[_0x555b('0x44')]['id']){delete _0x421d11[_0x555b('0x44')]['id'];}return db[_0x555b('0x29')][_0x555b('0x43')]({'where':{'id':_0x421d11['params']['id']}})[_0x555b('0x21')](handleEntityNotFound(_0x2a085b,null))[_0x555b('0x21')](saveUpdates(_0x421d11[_0x555b('0x44')],null))['then'](respondWithResult(_0x2a085b,null))[_0x555b('0x40')](handleError(_0x2a085b,null));};exports[_0x555b('0x22')]=function(_0x44dd92,_0x371028){return db['UserProfileSection']['find']({'where':{'id':_0x44dd92[_0x555b('0x42')]['id']}})[_0x555b('0x21')](handleEntityNotFound(_0x371028,null))[_0x555b('0x21')](removeEntity(_0x371028,null))['catch'](handleError(_0x371028,null));};exports[_0x555b('0x45')]=function(_0x9f89fd,_0x25f322){return db[_0x555b('0x29')][_0x555b('0x45')]()[_0x555b('0x21')](respondWithResult(_0x25f322,null))[_0x555b('0x40')](handleError(_0x25f322,null));}; \ No newline at end of file +var _0x899f=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','error','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','name','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','zip-dir','request-promise'];(function(_0x24279b,_0x11d28b){var _0x54c150=function(_0x44c305){while(--_0x44c305){_0x24279b['push'](_0x24279b['shift']());}};_0x54c150(++_0x11d28b);}(_0x899f,0xd5));var _0xf899=function(_0x100d58,_0x50e00d){_0x100d58=_0x100d58-0x0;var _0xc4e7c1=_0x899f[_0x100d58];return _0xc4e7c1;};'use strict';var emlformat=require(_0xf899('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf899('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf899('0x2'));var moment=require(_0xf899('0x3'));var BPromise=require(_0xf899('0x4'));var Mustache=require(_0xf899('0x5'));var util=require(_0xf899('0x6'));var path=require(_0xf899('0x7'));var sox=require(_0xf899('0x8'));var csv=require(_0xf899('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf899('0xa'));var _=require(_0xf899('0xb'));var squel=require(_0xf899('0xc'));var crypto=require(_0xf899('0xd'));var jsforce=require(_0xf899('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf899('0xf'));var authService=require(_0xf899('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf899('0x11'));var logger=require(_0xf899('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf899('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db27e,_0x39893b){_0x39893b=_0x39893b||0xcc;return function(_0x44a3dc){if(_0x44a3dc){return _0x4db27e[_0xf899('0x14')](_0x39893b);}return _0x4db27e[_0xf899('0x15')](_0x39893b)[_0xf899('0x16')]();};}function respondWithResult(_0x33c48e,_0x2ca9cc){_0x2ca9cc=_0x2ca9cc||0xc8;return function(_0x33f186){if(_0x33f186){return _0x33c48e[_0xf899('0x15')](_0x2ca9cc)[_0xf899('0x17')](_0x33f186);}};}function respondWithFilteredResult(_0x335ca5,_0x316bc0){return function(_0x559e1f){if(_0x559e1f){var _0x52a3bb=typeof _0x316bc0[_0xf899('0x18')]==='undefined'&&typeof _0x316bc0[_0xf899('0x19')]===_0xf899('0x1a');var _0x56505e=_0x559e1f[_0xf899('0x1b')];var _0x507671=_0x52a3bb?0x0:_0x316bc0['offset'];var _0xc4351f=_0x52a3bb?_0x559e1f[_0xf899('0x1b')]:_0x316bc0[_0xf899('0x18')]+_0x316bc0[_0xf899('0x19')];var _0x563b66;if(_0xc4351f>=_0x56505e){_0xc4351f=_0x56505e;_0x563b66=0xc8;}else{_0x563b66=0xce;}_0x335ca5['status'](_0x563b66);return _0x335ca5['set']('Content-Range',_0x507671+'-'+_0xc4351f+'/'+_0x56505e)['json'](_0x559e1f);}return null;};}function patchUpdates(_0x188a50){return function(_0x8ffab1){try{jsonpatch[_0xf899('0x1c')](_0x8ffab1,_0x188a50,!![]);}catch(_0x1f37aa){return BPromise[_0xf899('0x1d')](_0x1f37aa);}return _0x8ffab1[_0xf899('0x1e')]();};}function saveUpdates(_0xf6a9fb,_0x5e4460){return function(_0x9bddf9){if(_0x9bddf9){return _0x9bddf9[_0xf899('0x1f')](_0xf6a9fb)[_0xf899('0x20')](function(_0x515404){return _0x515404;});}return null;};}function removeEntity(_0x4dc0e8,_0x15410c){return function(_0x271fba){if(_0x271fba){return _0x271fba[_0xf899('0x21')]()[_0xf899('0x20')](function(){_0x4dc0e8[_0xf899('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4996,_0x596db6){return function(_0x2368ec){if(!_0x2368ec){_0x2b4996[_0xf899('0x14')](0x194);}return _0x2368ec;};}function handleError(_0x27a579,_0x66f8a8){_0x66f8a8=_0x66f8a8||0x1f4;return function(_0x135436){logger[_0xf899('0x22')](_0x135436['stack']);if(_0x135436['name']){delete _0x135436['name'];}_0x27a579[_0xf899('0x15')](_0x66f8a8)[_0xf899('0x23')](_0x135436);};}exports[_0xf899('0x24')]=function(_0xfacb01,_0xd8c532){var _0x13eed0={},_0x1df120={},_0xea8065={'count':0x0,'rows':[]};var _0xcf8709=_[_0xf899('0x25')](db[_0xf899('0x26')][_0xf899('0x27')],function(_0x581865){return{'name':_0x581865[_0xf899('0x28')],'type':_0x581865[_0xf899('0x29')][_0xf899('0x2a')]};});_0x1df120[_0xf899('0x2b')]=_[_0xf899('0x25')](_0xcf8709,'name');_0x1df120['query']=_[_0xf899('0x2c')](_0xfacb01[_0xf899('0x2d')]);_0x1df120[_0xf899('0x2e')]=_[_0xf899('0x2f')](_0x1df120[_0xf899('0x2b')],_0x1df120[_0xf899('0x2d')]);_0x13eed0[_0xf899('0x30')]=_[_0xf899('0x2f')](_0x1df120[_0xf899('0x2b')],qs['fields'](_0xfacb01[_0xf899('0x2d')][_0xf899('0x31')]));_0x13eed0[_0xf899('0x30')]=_0x13eed0[_0xf899('0x30')][_0xf899('0x32')]?_0x13eed0[_0xf899('0x30')]:_0x1df120['model'];if(!_0xfacb01[_0xf899('0x2d')][_0xf899('0x33')](_0xf899('0x34'))){_0x13eed0['limit']=qs['limit'](_0xfacb01[_0xf899('0x2d')]['limit']);_0x13eed0[_0xf899('0x18')]=qs[_0xf899('0x18')](_0xfacb01[_0xf899('0x2d')][_0xf899('0x18')]);}_0x13eed0['order']=qs[_0xf899('0x35')](_0xfacb01['query'][_0xf899('0x35')]);_0x13eed0[_0xf899('0x36')]=qs[_0xf899('0x2e')](_[_0xf899('0x37')](_0xfacb01[_0xf899('0x2d')],_0x1df120['filters']),_0xcf8709);if(_0xfacb01[_0xf899('0x2d')][_0xf899('0x38')]){_0x13eed0[_0xf899('0x36')]=_['merge'](_0x13eed0['where'],{'$or':_[_0xf899('0x25')](_0xcf8709,function(_0x5520d8){if(_0x5520d8[_0xf899('0x29')]!==_0xf899('0x39')){var _0x14f09e={};_0x14f09e[_0x5520d8[_0xf899('0x3a')]]={'$like':'%'+_0xfacb01[_0xf899('0x2d')][_0xf899('0x38')]+'%'};return _0x14f09e;}})});}_0x13eed0=_[_0xf899('0x3b')]({},_0x13eed0,_0xfacb01['options']);var _0x478626={'where':_0x13eed0[_0xf899('0x36')]};return db[_0xf899('0x26')]['count'](_0x478626)[_0xf899('0x20')](function(_0xb838a5){_0xea8065[_0xf899('0x1b')]=_0xb838a5;if(_0xfacb01['query'][_0xf899('0x3c')]){_0x13eed0['include']=[{'all':!![]}];}return db[_0xf899('0x26')][_0xf899('0x3d')](_0x13eed0);})[_0xf899('0x20')](function(_0x140a4e){_0xea8065[_0xf899('0x3e')]=_0x140a4e;return _0xea8065;})[_0xf899('0x20')](respondWithFilteredResult(_0xd8c532,_0x13eed0))[_0xf899('0x3f')](handleError(_0xd8c532,null));};exports[_0xf899('0x40')]=function(_0x39d7de,_0x4e3766){var _0x562f81={'raw':![],'where':{'id':_0x39d7de[_0xf899('0x41')]['id']}},_0x4bfc68={};_0x4bfc68[_0xf899('0x2b')]=_[_0xf899('0x2c')](db[_0xf899('0x26')][_0xf899('0x27')]);_0x4bfc68[_0xf899('0x2d')]=_[_0xf899('0x2c')](_0x39d7de['query']);_0x4bfc68[_0xf899('0x2e')]=_[_0xf899('0x2f')](_0x4bfc68[_0xf899('0x2b')],_0x4bfc68['query']);_0x562f81['attributes']=_[_0xf899('0x2f')](_0x4bfc68[_0xf899('0x2b')],qs[_0xf899('0x31')](_0x39d7de['query'][_0xf899('0x31')]));_0x562f81[_0xf899('0x30')]=_0x562f81[_0xf899('0x30')]['length']?_0x562f81[_0xf899('0x30')]:_0x4bfc68[_0xf899('0x2b')];if(_0x39d7de[_0xf899('0x2d')][_0xf899('0x3c')]){_0x562f81[_0xf899('0x42')]=[{'all':!![]}];}_0x562f81=_[_0xf899('0x3b')]({},_0x562f81,_0x39d7de[_0xf899('0x43')]);return db[_0xf899('0x26')][_0xf899('0x44')](_0x562f81)[_0xf899('0x20')](handleEntityNotFound(_0x4e3766,null))[_0xf899('0x20')](respondWithResult(_0x4e3766,null))['catch'](handleError(_0x4e3766,null));};exports['create']=function(_0x19095a,_0x9f0737){return db[_0xf899('0x26')][_0xf899('0x45')](_0x19095a['body'],{})[_0xf899('0x20')](respondWithResult(_0x9f0737,0xc9))['catch'](handleError(_0x9f0737,null));};exports[_0xf899('0x1f')]=function(_0x3c3e1b,_0x117435){if(_0x3c3e1b[_0xf899('0x46')]['id']){delete _0x3c3e1b[_0xf899('0x46')]['id'];}return db[_0xf899('0x26')][_0xf899('0x44')]({'where':{'id':_0x3c3e1b[_0xf899('0x41')]['id']}})[_0xf899('0x20')](handleEntityNotFound(_0x117435,null))[_0xf899('0x20')](saveUpdates(_0x3c3e1b[_0xf899('0x46')],null))['then'](respondWithResult(_0x117435,null))[_0xf899('0x3f')](handleError(_0x117435,null));};exports[_0xf899('0x21')]=function(_0x515934,_0xc7e3fc){return db['UserProfileSection']['find']({'where':{'id':_0x515934['params']['id']}})['then'](handleEntityNotFound(_0xc7e3fc,null))['then'](removeEntity(_0xc7e3fc,null))[_0xf899('0x3f')](handleError(_0xc7e3fc,null));};exports[_0xf899('0x47')]=function(_0x35dbf6,_0x32be3e){return db[_0xf899('0x26')][_0xf899('0x47')]()[_0xf899('0x20')](respondWithResult(_0x32be3e,null))['catch'](handleError(_0x32be3e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 48a2b27..14b384a 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 _0x7b80=['bluebird','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','../../config/logger','moment'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x7b80,0x18f));var _0x07b8=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7b80[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x07b8('0x0'));var util=require(_0x07b8('0x1'));var logger=require(_0x07b8('0x2'))('api');var moment=require(_0x07b8('0x3'));var BPromise=require(_0x07b8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x07b8('0x5'));var config=require(_0x07b8('0x6'));var attributes=require(_0x07b8('0x7'));module[_0x07b8('0x8')]=function(_0x245efa,_0x16d263){return _0x245efa[_0x07b8('0x9')](_0x07b8('0xa'),attributes,{'tableName':_0x07b8('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x07b8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1a9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger'];(function(_0x26618e,_0xbe9238){var _0x5dec4c=function(_0x15016d){while(--_0x15016d){_0x26618e['push'](_0x26618e['shift']());}};_0x5dec4c(++_0xbe9238);}(_0xf1a9,0xdb));var _0x9f1a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xf1a9[_0x491a7f];return _0x3d8f44;};'use strict';var _=require('lodash');var util=require(_0x9f1a('0x0'));var logger=require(_0x9f1a('0x1'))('api');var moment=require(_0x9f1a('0x2'));var BPromise=require(_0x9f1a('0x3'));var rp=require(_0x9f1a('0x4'));var fs=require('fs');var path=require(_0x9f1a('0x5'));var rimraf=require(_0x9f1a('0x6'));var config=require(_0x9f1a('0x7'));var attributes=require(_0x9f1a('0x8'));module[_0x9f1a('0x9')]=function(_0x42d2d6,_0x532956){return _0x42d2d6['define']('UserProfileSection',attributes,{'tableName':_0x9f1a('0xa'),'paranoid':![],'indexes':[{'name':_0x9f1a('0xb'),'fields':[_0x9f1a('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index df880d4..7f68ec9 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 _0x22f3=['UserProfileSection,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','code'];(function(_0x5a0b65,_0x3bc1bc){var _0x2b228b=function(_0x5bbdcc){while(--_0x5bbdcc){_0x5a0b65['push'](_0x5a0b65['shift']());}};_0x2b228b(++_0x3bc1bc);}(_0x22f3,0x73));var _0x322f=function(_0x42506f,_0x6adadb){_0x42506f=_0x42506f-0x0;var _0x7a6b4b=_0x22f3[_0x42506f];return _0x7a6b4b;};'use strict';var _=require(_0x322f('0x0'));var util=require(_0x322f('0x1'));var moment=require(_0x322f('0x2'));var BPromise=require('bluebird');var rs=require(_0x322f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x322f('0x4'))['db'];var utils=require(_0x322f('0x5'));var logger=require(_0x322f('0x6'))('rpc');var config=require(_0x322f('0x7'));var jayson=require(_0x322f('0x8'));var client=jayson[_0x322f('0x9')][_0x322f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x514221,_0x41ca9c,_0x3b64c6){return new BPromise(function(_0x4d4b9f,_0x4d1251){return client[_0x322f('0xb')](_0x514221,_0x3b64c6)[_0x322f('0xc')](function(_0x47c2ed){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x41ca9c,'request\x20sent');logger[_0x322f('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x41ca9c,_0x322f('0xe'),JSON['stringify'](_0x47c2ed));if(_0x47c2ed[_0x322f('0xf')]){if(_0x47c2ed[_0x322f('0xf')][_0x322f('0x10')]===0x1f4){logger[_0x322f('0xf')](_0x322f('0x11'),_0x41ca9c,_0x47c2ed[_0x322f('0xf')][_0x322f('0x12')]);return _0x4d1251(_0x47c2ed['error'][_0x322f('0x12')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x41ca9c,_0x47c2ed[_0x322f('0xf')][_0x322f('0x12')]);return _0x4d4b9f(_0x47c2ed[_0x322f('0xf')]['message']);}else{logger[_0x322f('0x13')](_0x322f('0x11'),_0x41ca9c,_0x322f('0xe'));_0x4d4b9f(_0x47c2ed[_0x322f('0x14')]['message']);}})[_0x322f('0x15')](function(_0x45c943){logger[_0x322f('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x41ca9c,_0x45c943);_0x4d1251(_0x45c943);});});} \ No newline at end of file +var _0xa9c0=['UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','client','http','request','UserProfileSection,\x20%s,\x20%s','debug'];(function(_0x246890,_0x46b964){var _0x2b2a5a=function(_0x4f1232){while(--_0x4f1232){_0x246890['push'](_0x246890['shift']());}};_0x2b2a5a(++_0x46b964);}(_0xa9c0,0x19f));var _0x0a9c=function(_0x376d95,_0x9fe843){_0x376d95=_0x376d95-0x0;var _0x159820=_0xa9c0[_0x376d95];return _0x159820;};'use strict';var _=require('lodash');var util=require(_0x0a9c('0x0'));var moment=require(_0x0a9c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9c('0x3'));var logger=require(_0x0a9c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a9c('0x5')][_0x0a9c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x45ec54,_0x568b35,_0x51f1ff){return new BPromise(function(_0x2e9551,_0x430134){return client[_0x0a9c('0x7')](_0x45ec54,_0x51f1ff)['then'](function(_0x296b9b){logger['info'](_0x0a9c('0x8'),_0x568b35,'request\x20sent');logger[_0x0a9c('0x9')](_0x0a9c('0xa'),_0x568b35,'request\x20sent',JSON['stringify'](_0x296b9b));if(_0x296b9b[_0x0a9c('0xb')]){if(_0x296b9b['error'][_0x0a9c('0xc')]===0x1f4){logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x296b9b['error'][_0x0a9c('0xd')]);return _0x430134(_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);}logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);return _0x2e9551(_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);}else{logger[_0x0a9c('0xe')](_0x0a9c('0x8'),_0x568b35,'request\x20sent');_0x2e9551(_0x296b9b[_0x0a9c('0xf')][_0x0a9c('0xd')]);}})[_0x0a9c('0x10')](function(_0x8066d4){logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x8066d4);_0x430134(_0x8066d4);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 4681d9e..1117695 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x32a773,_0x57b5c7){var _0x430dcb=function(_0x209f30){while(--_0x209f30){_0x32a773['push'](_0x32a773['shift']());}};_0x430dcb(++_0x57b5c7);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x582ff9,_0x387072){var _0x393292=function(_0x434f86){while(--_0x434f86){_0x582ff9['push'](_0x582ff9['shift']());}};_0x393292(++_0x387072);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xcb91[_0x376db5];return _0x304c17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 71750e2..f15ecee 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 _0xcf6a=['INTEGER','sequelize','exports'];(function(_0x376e5a,_0x2b7bd3){var _0x582bbb=function(_0x523d85){while(--_0x523d85){_0x376e5a['push'](_0x376e5a['shift']());}};_0x582bbb(++_0x2b7bd3);}(_0xcf6a,0xbb));var _0xacf6=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xcf6a[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require(_0xacf6('0x0'));module[_0xacf6('0x1')]={'penalty':{'type':Sequelize[_0xacf6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x79fd=['exports'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x79fd,0x1bd));var _0xd79f=function(_0x583760,_0x562849){_0x583760=_0x583760-0x0;var _0x5bc274=_0x79fd[_0x583760];return _0x5bc274;};'use strict';var Sequelize=require('sequelize');module[_0xd79f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 2961eeb..34cc9cd 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 _0x6363=['define','UserSmsQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x1cbb29,_0x1e9873){var _0x1bc3c9=function(_0x2f1220){while(--_0x2f1220){_0x1cbb29['push'](_0x1cbb29['shift']());}};_0x1bc3c9(++_0x1e9873);}(_0x6363,0x13a));var _0x3636=function(_0x2f9b40,_0x1837ff){_0x2f9b40=_0x2f9b40-0x0;var _0x42e9f0=_0x6363[_0x2f9b40];return _0x42e9f0;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var logger=require(_0x3636('0x1'))(_0x3636('0x2'));var moment=require(_0x3636('0x3'));var BPromise=require(_0x3636('0x4'));var rp=require(_0x3636('0x5'));var fs=require('fs');var path=require(_0x3636('0x6'));var rimraf=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var attributes=require(_0x3636('0x9'));module[_0x3636('0xa')]=function(_0x15728f,_0x1f94ef){return _0x15728f[_0x3636('0xb')](_0x3636('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4317=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x76ef31,_0x2825ce){var _0x1c80b3=function(_0x3e15bf){while(--_0x3e15bf){_0x76ef31['push'](_0x76ef31['shift']());}};_0x1c80b3(++_0x2825ce);}(_0x4317,0x7c));var _0x7431=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4317[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index f2028d7..4250222 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 _0x8c7e=['client','http','request','then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','../../config/utils','jayson/promise'];(function(_0x3573c1,_0x110869){var _0x1a7c62=function(_0x35cb1d){while(--_0x35cb1d){_0x3573c1['push'](_0x3573c1['shift']());}};_0x1a7c62(++_0x110869);}(_0x8c7e,0x126));var _0xe8c7=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0x8c7e[_0x4eaa4c];return _0x15aec6;};'use strict';var _=require(_0xe8c7('0x0'));var util=require(_0xe8c7('0x1'));var moment=require(_0xe8c7('0x2'));var BPromise=require(_0xe8c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8c7('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe8c7('0x5'));var client=jayson[_0xe8c7('0x6')][_0xe8c7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ef53d,_0x216ec5,_0x48fdda){return new BPromise(function(_0x3e519e,_0x13b668){return client[_0xe8c7('0x8')](_0x5ef53d,_0x48fdda)[_0xe8c7('0x9')](function(_0x4751e7){logger['info'](_0xe8c7('0xa'),_0x216ec5,'request\x20sent');logger[_0xe8c7('0xb')](_0xe8c7('0xc'),_0x216ec5,'request\x20sent',JSON[_0xe8c7('0xd')](_0x4751e7));if(_0x4751e7[_0xe8c7('0xe')]){if(_0x4751e7[_0xe8c7('0xe')][_0xe8c7('0xf')]===0x1f4){logger[_0xe8c7('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x216ec5,_0x4751e7[_0xe8c7('0xe')][_0xe8c7('0x10')]);return _0x13b668(_0x4751e7[_0xe8c7('0xe')][_0xe8c7('0x10')]);}logger[_0xe8c7('0xe')](_0xe8c7('0xa'),_0x216ec5,_0x4751e7[_0xe8c7('0xe')]['message']);return _0x3e519e(_0x4751e7[_0xe8c7('0xe')]['message']);}else{logger['info'](_0xe8c7('0xa'),_0x216ec5,_0xe8c7('0x11'));_0x3e519e(_0x4751e7[_0xe8c7('0x12')][_0xe8c7('0x10')]);}})[_0xe8c7('0x13')](function(_0x128121){logger[_0xe8c7('0xe')](_0xe8c7('0xa'),_0x216ec5,_0x128121);_0x13b668(_0x128121);});});} \ No newline at end of file +var _0x6bc0=['randomstring','../../config/logger','../../config/environment','http','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','code','UserSmsQueue,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6bc0,0x152));var _0x06bc=function(_0x2fdb3e,_0x29af7f){_0x2fdb3e=_0x2fdb3e-0x0;var _0x2dd4ed=_0x6bc0[_0x2fdb3e];return _0x2dd4ed;};'use strict';var _=require(_0x06bc('0x0'));var util=require(_0x06bc('0x1'));var moment=require(_0x06bc('0x2'));var BPromise=require(_0x06bc('0x3'));var rs=require(_0x06bc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x06bc('0x5'))('rpc');var config=require(_0x06bc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x06bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f83af,_0x11a50f,_0x1ead88){return new BPromise(function(_0x5059fb,_0x419503){return client['request'](_0x4f83af,_0x1ead88)[_0x06bc('0x8')](function(_0x2d532e){logger[_0x06bc('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x11a50f,_0x06bc('0xa'));logger[_0x06bc('0xb')](_0x06bc('0xc'),_0x11a50f,_0x06bc('0xa'),JSON['stringify'](_0x2d532e));if(_0x2d532e['error']){if(_0x2d532e['error'][_0x06bc('0xd')]===0x1f4){logger['error'](_0x06bc('0xe'),_0x11a50f,_0x2d532e[_0x06bc('0xf')][_0x06bc('0x10')]);return _0x419503(_0x2d532e['error'][_0x06bc('0x10')]);}logger[_0x06bc('0xf')](_0x06bc('0xe'),_0x11a50f,_0x2d532e[_0x06bc('0xf')][_0x06bc('0x10')]);return _0x5059fb(_0x2d532e['error'][_0x06bc('0x10')]);}else{logger[_0x06bc('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x11a50f,_0x06bc('0xa'));_0x5059fb(_0x2d532e['result'][_0x06bc('0x10')]);}})[_0x06bc('0x11')](function(_0x5491d6){logger[_0x06bc('0xf')](_0x06bc('0xe'),_0x11a50f,_0x5491d6);_0x419503(_0x5491d6);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 1269d49..4f75778 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 _0x2e0c=['sequelize'];(function(_0x2aae5b,_0x14b687){var _0x444648=function(_0x1581d5){while(--_0x1581d5){_0x2aae5b['push'](_0x2aae5b['shift']());}};_0x444648(++_0x14b687);}(_0x2e0c,0x13a));var _0xc2e0=function(_0xe0eb73,_0x5e8190){_0xe0eb73=_0xe0eb73-0x0;var _0x1e5036=_0x2e0c[_0xe0eb73];return _0x1e5036;};'use strict';var Sequelize=require(_0xc2e0('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x65f2=['sequelize','exports','INTEGER'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0x65f2,0x144));var _0x265f=function(_0x53bbcb,_0x33f004){_0x53bbcb=_0x53bbcb-0x0;var _0x4abaf8=_0x65f2[_0x53bbcb];return _0x4abaf8;};'use strict';var Sequelize=require(_0x265f('0x0'));module[_0x265f('0x1')]={'UserId':{'type':Sequelize[_0x265f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x265f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 4db5cac..fa26006 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(_0x2b1f9a,_0x557af0){var _0x1121c8=function(_0xc0efc0){while(--_0xc0efc0){_0x2b1f9a['push'](_0x2b1f9a['shift']());}};_0x1121c8(++_0x557af0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x26246c,_0xe9658e){var _0x394b08=function(_0x47620c){while(--_0x47620c){_0x26246c['push'](_0x26246c['shift']());}};_0x394b08(++_0xe9658e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d96650e..e76029b 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xc68650,_0x258343){var _0x57bd40=function(_0x8d9e8c){while(--_0x8d9e8c){_0xc68650['push'](_0xc68650['shift']());}};_0x57bd40(++_0x258343);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a5cfb,_0x37ed01){var _0x334936=function(_0x344895){while(--_0x344895){_0x5a5cfb['push'](_0x5a5cfb['shift']());}};_0x334936(++_0x37ed01);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index a4de128..7391922 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 _0x65b5=['sequelize','exports','INTEGER'];(function(_0x3985f3,_0xa9a894){var _0x2def37=function(_0x386f69){while(--_0x386f69){_0x3985f3['push'](_0x3985f3['shift']());}};_0x2def37(++_0xa9a894);}(_0x65b5,0xd2));var _0x565b=function(_0x2eb8fa,_0x295f4f){_0x2eb8fa=_0x2eb8fa-0x0;var _0xe26256=_0x65b5[_0x2eb8fa];return _0xe26256;};'use strict';var Sequelize=require(_0x565b('0x0'));module[_0x565b('0x1')]={'penalty':{'type':Sequelize[_0x565b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe900=['exports','sequelize'];(function(_0x165fd9,_0x211612){var _0x536cdf=function(_0x350c6a){while(--_0x350c6a){_0x165fd9['push'](_0x165fd9['shift']());}};_0x536cdf(++_0x211612);}(_0xe900,0x14b));var _0x0e90=function(_0x1ada4c,_0xa8b56b){_0x1ada4c=_0x1ada4c-0x0;var _0x56d384=_0xe900[_0x1ada4c];return _0x56d384;};'use strict';var Sequelize=require(_0x0e90('0x0'));module[_0x0e90('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 4a0e693..57a3abf 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 _0x89cd=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x43d012,_0x286e4d){var _0x52e052=function(_0x497c03){while(--_0x497c03){_0x43d012['push'](_0x43d012['shift']());}};_0x52e052(++_0x286e4d);}(_0x89cd,0x120));var _0xd89c=function(_0x4fd51c,_0x212fca){_0x4fd51c=_0x4fd51c-0x0;var _0xde5b62=_0x89cd[_0x4fd51c];return _0xde5b62;};'use strict';var _=require('lodash');var util=require(_0xd89c('0x0'));var logger=require(_0xd89c('0x1'))(_0xd89c('0x2'));var moment=require(_0xd89c('0x3'));var BPromise=require(_0xd89c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd89c('0x5'));var rimraf=require(_0xd89c('0x6'));var config=require(_0xd89c('0x7'));var attributes=require(_0xd89c('0x8'));module['exports']=function(_0x42158b,_0x2c1b95){return _0x42158b[_0xd89c('0x9')](_0xd89c('0xa'),attributes,{'tableName':_0xd89c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8459=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x5abc05,_0x3034a3){var _0x38ff18=function(_0x12fac4){while(--_0x12fac4){_0x5abc05['push'](_0x5abc05['shift']());}};_0x38ff18(++_0x3034a3);}(_0x8459,0x12b));var _0x9845=function(_0x1d51e3,_0x1efd27){_0x1d51e3=_0x1d51e3-0x0;var _0x27807d=_0x8459[_0x1d51e3];return _0x27807d;};'use strict';var _=require('lodash');var util=require(_0x9845('0x0'));var logger=require(_0x9845('0x1'))(_0x9845('0x2'));var moment=require('moment');var BPromise=require(_0x9845('0x3'));var rp=require(_0x9845('0x4'));var fs=require('fs');var path=require(_0x9845('0x5'));var rimraf=require(_0x9845('0x6'));var config=require(_0x9845('0x7'));var attributes=require(_0x9845('0x8'));module[_0x9845('0x9')]=function(_0x300cb9,_0x4f2635){return _0x300cb9[_0x9845('0xa')](_0x9845('0xb'),attributes,{'tableName':_0x9845('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 1e57555..ea831c3 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 _0x446d=['client','http','info','request\x20sent','debug','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x513a87,_0x1d8ea2){var _0x55bb38=function(_0x35c562){while(--_0x35c562){_0x513a87['push'](_0x513a87['shift']());}};_0x55bb38(++_0x1d8ea2);}(_0x446d,0xe6));var _0xd446=function(_0xf8973d,_0x56a803){_0xf8973d=_0xf8973d-0x0;var _0x1c46bc=_0x446d[_0xf8973d];return _0x1c46bc;};'use strict';var _=require('lodash');var util=require(_0xd446('0x0'));var moment=require(_0xd446('0x1'));var BPromise=require(_0xd446('0x2'));var rs=require(_0xd446('0x3'));var fs=require('fs');var Redis=require(_0xd446('0x4'));var db=require(_0xd446('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd446('0x6'))(_0xd446('0x7'));var config=require(_0xd446('0x8'));var jayson=require(_0xd446('0x9'));var client=jayson[_0xd446('0xa')][_0xd446('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a64bc,_0x2ccaa4,_0x459cc5){return new BPromise(function(_0x1e895f,_0x37ff89){return client['request'](_0x1a64bc,_0x459cc5)['then'](function(_0x1433b0){logger[_0xd446('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2ccaa4,_0xd446('0xd'));logger[_0xd446('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2ccaa4,'request\x20sent',JSON['stringify'](_0x1433b0));if(_0x1433b0[_0xd446('0xf')]){if(_0x1433b0[_0xd446('0xf')][_0xd446('0x10')]===0x1f4){logger[_0xd446('0xf')](_0xd446('0x11'),_0x2ccaa4,_0x1433b0[_0xd446('0xf')][_0xd446('0x12')]);return _0x37ff89(_0x1433b0[_0xd446('0xf')][_0xd446('0x12')]);}logger[_0xd446('0xf')](_0xd446('0x11'),_0x2ccaa4,_0x1433b0[_0xd446('0xf')][_0xd446('0x12')]);return _0x1e895f(_0x1433b0[_0xd446('0xf')][_0xd446('0x12')]);}else{logger[_0xd446('0xc')](_0xd446('0x11'),_0x2ccaa4,_0xd446('0xd'));_0x1e895f(_0x1433b0['result'][_0xd446('0x12')]);}})[_0xd446('0x13')](function(_0x642f7){logger[_0xd446('0xf')](_0xd446('0x11'),_0x2ccaa4,_0x642f7);_0x37ff89(_0x642f7);});});} \ No newline at end of file +var _0x51a3=['stringify','error','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x51a3,0x125));var _0x351a=function(_0x4ec6d3,_0xb6b27a){_0x4ec6d3=_0x4ec6d3-0x0;var _0xe46287=_0x51a3[_0x4ec6d3];return _0xe46287;};'use strict';var _=require('lodash');var util=require(_0x351a('0x0'));var moment=require(_0x351a('0x1'));var BPromise=require(_0x351a('0x2'));var rs=require(_0x351a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x351a('0x4'));var logger=require(_0x351a('0x5'))(_0x351a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x351a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd53691,_0x163bd2,_0x3f81e9){return new BPromise(function(_0x54e690,_0xb8c2cf){return client['request'](_0xd53691,_0x3f81e9)['then'](function(_0x3aad10){logger[_0x351a('0x8')](_0x351a('0x9'),_0x163bd2,_0x351a('0xa'));logger[_0x351a('0xb')](_0x351a('0xc'),_0x163bd2,'request\x20sent',JSON[_0x351a('0xd')](_0x3aad10));if(_0x3aad10[_0x351a('0xe')]){if(_0x3aad10[_0x351a('0xe')]['code']===0x1f4){logger[_0x351a('0xe')](_0x351a('0x9'),_0x163bd2,_0x3aad10[_0x351a('0xe')]['message']);return _0xb8c2cf(_0x3aad10['error'][_0x351a('0xf')]);}logger[_0x351a('0xe')](_0x351a('0x9'),_0x163bd2,_0x3aad10['error']['message']);return _0x54e690(_0x3aad10[_0x351a('0xe')][_0x351a('0xf')]);}else{logger[_0x351a('0x8')](_0x351a('0x9'),_0x163bd2,'request\x20sent');_0x54e690(_0x3aad10[_0x351a('0x10')][_0x351a('0xf')]);}})['catch'](function(_0x3dc6e3){logger[_0x351a('0xe')](_0x351a('0x9'),_0x163bd2,_0x3dc6e3);_0xb8c2cf(_0x3dc6e3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 21aa01f..519056f 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4f3039,_0x100a43){var _0x13218c=function(_0x55c86e){while(--_0x55c86e){_0x4f3039['push'](_0x4f3039['shift']());}};_0x13218c(++_0x100a43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x45a869,_0x109443){var _0x48af40=function(_0x420a94){while(--_0x420a94){_0x45a869['push'](_0x45a869['shift']());}};_0x48af40(++_0x109443);}(_0x70e0,0x17b));var _0x070e=function(_0x5bb17c,_0x5c6d2c){_0x5bb17c=_0x5bb17c-0x0;var _0x2bfff6=_0x70e0[_0x5bb17c];return _0x2bfff6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index d2b8b84..01d28c4 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 _0xd5d0=['INTEGER','Required\x20by\x20Asterisk','STRING','sequelize'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xd5d0,0x153));var _0x0d5d=function(_0x59cbfb,_0x37321f){_0x59cbfb=_0x59cbfb-0x0;var _0x3c512c=_0xd5d0[_0x59cbfb];return _0x3c512c;};'use strict';var Sequelize=require(_0x0d5d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0d5d('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0d5d('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x0d5d('0x2')},'UserId':{'type':Sequelize[_0x0d5d('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0d5d('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x0d5d('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0d5d('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0d5d('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x0d5d('0x2')},'penalty':{'type':Sequelize[_0x0d5d('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x0d5d('0x1')](0xb),'defaultValue':0x0,'comment':_0x0d5d('0x2')}}; \ No newline at end of file +var _0xd484=['STRING','queue_interface','Required\x20by\x20Asterisk','sequelize','exports','INTEGER'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd484,0xff));var _0x4d48=function(_0x1f3b69,_0x2ea063){_0x1f3b69=_0x1f3b69-0x0;var _0x3f84c4=_0xd484[_0x1f3b69];return _0x3f84c4;};'use strict';var Sequelize=require(_0x4d48('0x0'));module[_0x4d48('0x1')]={'uniqueid':{'type':Sequelize[_0x4d48('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x4d48('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x4d48('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4d48('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x4d48('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4d48('0x3')],'allowNull':![],'unique':_0x4d48('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4d48('0x2')](0xb),'defaultValue':0x0,'comment':_0x4d48('0x5')},'paused':{'type':Sequelize[_0x4d48('0x2')](0xb),'defaultValue':0x0,'comment':_0x4d48('0x5')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index eaf5232..9678b0f 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 _0x00cf=['UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x00cf,0xda));var _0xf00c=function(_0x374cd9,_0x118a5a){_0x374cd9=_0x374cd9-0x0;var _0x16b8d9=_0x00cf[_0x374cd9];return _0x16b8d9;};'use strict';var EventEmitter=require(_0xf00c('0x0'));var UserVoiceQueueRt=require(_0xf00c('0x1'))['db'][_0xf00c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf00c('0x3')](0x0);var events={'afterCreate':_0xf00c('0x4'),'afterUpdate':_0xf00c('0x5'),'afterDestroy':_0xf00c('0x6')};function emitEvent(_0x39d4c0){return function(_0x2707e2,_0x453f59,_0xc6efbd){UserVoiceQueueRtEvents[_0xf00c('0x7')](_0x39d4c0+':'+_0x2707e2['id'],_0x2707e2);UserVoiceQueueRtEvents[_0xf00c('0x7')](_0x39d4c0,_0x2707e2);_0xc6efbd(null);};}for(var e in events){if(events[_0xf00c('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xf00c('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x826e=['events','UserVoiceQueueRt','emit','hasOwnProperty','hook','exports'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x826e,0x72));var _0xe826=function(_0x462a54,_0x373b1c){_0x462a54=_0x462a54-0x0;var _0x4df2b0=_0x826e[_0x462a54];return _0x4df2b0;};'use strict';var EventEmitter=require(_0xe826('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xe826('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5872f4){return function(_0x47d89b,_0x49bcdc,_0x5256c2){UserVoiceQueueRtEvents[_0xe826('0x2')](_0x5872f4+':'+_0x47d89b['id'],_0x47d89b);UserVoiceQueueRtEvents[_0xe826('0x2')](_0x5872f4,_0x47d89b);_0x5256c2(null);};}for(var e in events){if(events[_0xe826('0x3')](e)){var event=events[e];UserVoiceQueueRt[_0xe826('0x4')](e,emitEvent(event));}}module[_0xe826('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3faedd3..ab8800c 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 _0x0711=['exports','define','user_has_voice_queues_rt','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x35ba3f,_0x481358){var _0x140889=function(_0x5e7201){while(--_0x5e7201){_0x35ba3f['push'](_0x35ba3f['shift']());}};_0x140889(++_0x481358);}(_0x0711,0xd4));var _0x1071=function(_0x47404e,_0x286834){_0x47404e=_0x47404e-0x0;var _0x5f4967=_0x0711[_0x47404e];return _0x5f4967;};'use strict';var _=require(_0x1071('0x0'));var util=require('util');var logger=require(_0x1071('0x1'))(_0x1071('0x2'));var moment=require('moment');var BPromise=require(_0x1071('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1071('0x4'));var rimraf=require(_0x1071('0x5'));var config=require(_0x1071('0x6'));var attributes=require(_0x1071('0x7'));module[_0x1071('0x8')]=function(_0x1e9cb8,_0xad0656){return _0x1e9cb8[_0x1071('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0x1071('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e50=['user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x0e50,0x151));var _0x00e5=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x0e50[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x00e5('0x0'));var util=require('util');var logger=require(_0x00e5('0x1'))(_0x00e5('0x2'));var moment=require(_0x00e5('0x3'));var BPromise=require(_0x00e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00e5('0x5'));var rimraf=require(_0x00e5('0x6'));var config=require(_0x00e5('0x7'));var attributes=require(_0x00e5('0x8'));module[_0x00e5('0x9')]=function(_0x2e8d06,_0x1f82ea){return _0x2e8d06['define'](_0x00e5('0xa'),attributes,{'tableName':_0x00e5('0xb'),'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 1eb1539..d922880 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 _0x6184=['redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ea954,_0x4810c1){var _0x2c2b94=function(_0x1dfc67){while(--_0x1dfc67){_0x1ea954['push'](_0x1ea954['shift']());}};_0x2c2b94(++_0x4810c1);}(_0x6184,0x1d2));var _0x4618=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0x6184[_0x4ffa64];return _0x5da001;};'use strict';var _=require(_0x4618('0x0'));var util=require(_0x4618('0x1'));var moment=require(_0x4618('0x2'));var BPromise=require(_0x4618('0x3'));var rs=require(_0x4618('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4618('0x5'));var config=require(_0x4618('0x6'));var jayson=require(_0x4618('0x7'));var client=jayson[_0x4618('0x8')][_0x4618('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4618('0xa')],{'host':_0x4618('0xb'),'port':0x18eb});var socket=require(_0x4618('0xc'))(new Redis(config[_0x4618('0xa')]));require(_0x4618('0xd'))[_0x4618('0xe')](socket);function respondWithRpcPromise(_0x475d8d,_0x5f50b9,_0x1c3eb3){return new BPromise(function(_0x35db44,_0x276c80){return client[_0x4618('0xf')](_0x475d8d,_0x1c3eb3)[_0x4618('0x10')](function(_0x1981fa){logger['info'](_0x4618('0x11'),_0x5f50b9,_0x4618('0x12'));logger[_0x4618('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5f50b9,_0x4618('0x12'),JSON['stringify'](_0x1981fa));if(_0x1981fa[_0x4618('0x14')]){if(_0x1981fa['error']['code']===0x1f4){logger[_0x4618('0x14')](_0x4618('0x11'),_0x5f50b9,_0x1981fa[_0x4618('0x14')][_0x4618('0x15')]);return _0x276c80(_0x1981fa['error'][_0x4618('0x15')]);}logger[_0x4618('0x14')](_0x4618('0x11'),_0x5f50b9,_0x1981fa['error']['message']);return _0x35db44(_0x1981fa[_0x4618('0x14')][_0x4618('0x15')]);}else{logger[_0x4618('0x16')](_0x4618('0x11'),_0x5f50b9,'request\x20sent');_0x35db44(_0x1981fa[_0x4618('0x17')][_0x4618('0x15')]);}})[_0x4618('0x18')](function(_0x4b4dd5){logger[_0x4618('0x14')](_0x4618('0x11'),_0x5f50b9,_0x4b4dd5);_0x276c80(_0x4b4dd5);});});}exports[_0x4618('0x19')]=function(_0x517ccc){var _0xb2a209=this;return new Promise(function(_0x437069,_0x409fd2){return db[_0x4618('0x1a')][_0x4618('0x1b')]({'raw':_0x517ccc[_0x4618('0x1c')]?_0x517ccc[_0x4618('0x1c')][_0x4618('0x1d')]===undefined?!![]:![]:!![],'where':_0x517ccc[_0x4618('0x1c')]?_0x517ccc[_0x4618('0x1c')][_0x4618('0x1e')]||null:null,'attributes':[[db[_0x4618('0x1f')]['fn'](_0x4618('0x20'),db[_0x4618('0x1f')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x4618('0x21')]]})[_0x4618('0x10')](function(_0x3a85d7){logger['info'](_0x4618('0x19'),_0x517ccc);logger[_0x4618('0x13')](_0x4618('0x19'),_0x517ccc,JSON['stringify'](_0x3a85d7));_0x437069(_0x3a85d7);})[_0x4618('0x18')](function(_0x2627c0){logger[_0x4618('0x14')](_0x4618('0x19'),_0x2627c0['message'],_0x517ccc);_0x409fd2(_0xb2a209[_0x4618('0x14')](0x1f4,_0x2627c0[_0x4618('0x15')]));});});}; \ No newline at end of file +var _0x479f=['literal','`paused`\x20=\x201,\x201,\x20null','then','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','sequelize','COUNT'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x479f,0x6f));var _0xf479=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x479f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf479('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf479('0x1'));var fs=require('fs');var Redis=require(_0xf479('0x2'));var db=require(_0xf479('0x3'))['db'];var utils=require(_0xf479('0x4'));var logger=require(_0xf479('0x5'))(_0xf479('0x6'));var config=require(_0xf479('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf479('0x8')][_0xf479('0x9')]({'port':0x232a});config['redis']=_[_0xf479('0xa')](config[_0xf479('0xb')],{'host':_0xf479('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf479('0xb')]));require(_0xf479('0xd'))[_0xf479('0xe')](socket);function respondWithRpcPromise(_0xade841,_0x467bb8,_0x987636){return new BPromise(function(_0xfcf146,_0x5adb70){return client[_0xf479('0xf')](_0xade841,_0x987636)['then'](function(_0x6af595){logger['info'](_0xf479('0x10'),_0x467bb8,_0xf479('0x11'));logger[_0xf479('0x12')](_0xf479('0x13'),_0x467bb8,_0xf479('0x11'),JSON[_0xf479('0x14')](_0x6af595));if(_0x6af595[_0xf479('0x15')]){if(_0x6af595[_0xf479('0x15')][_0xf479('0x16')]===0x1f4){logger[_0xf479('0x15')](_0xf479('0x10'),_0x467bb8,_0x6af595['error'][_0xf479('0x17')]);return _0x5adb70(_0x6af595['error'][_0xf479('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x467bb8,_0x6af595[_0xf479('0x15')][_0xf479('0x17')]);return _0xfcf146(_0x6af595[_0xf479('0x15')][_0xf479('0x17')]);}else{logger[_0xf479('0x18')](_0xf479('0x10'),_0x467bb8,_0xf479('0x11'));_0xfcf146(_0x6af595[_0xf479('0x19')][_0xf479('0x17')]);}})[_0xf479('0x1a')](function(_0xdbecc5){logger[_0xf479('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x467bb8,_0xdbecc5);_0x5adb70(_0xdbecc5);});});}exports[_0xf479('0x1b')]=function(_0x2aa31e){var _0x171465=this;return new Promise(function(_0xf634a7,_0x18c01f){return db['UserVoiceQueueRt'][_0xf479('0x1c')]({'raw':_0x2aa31e[_0xf479('0x1d')]?_0x2aa31e[_0xf479('0x1d')][_0xf479('0x1e')]===undefined?!![]:![]:!![],'where':_0x2aa31e[_0xf479('0x1d')]?_0x2aa31e['options']['where']||null:null,'attributes':[[db[_0xf479('0x1f')]['fn'](_0xf479('0x20'),db[_0xf479('0x1f')]['fn']('IF',db[_0xf479('0x1f')][_0xf479('0x21')](_0xf479('0x22')))),'outboundQueuePauses']]})[_0xf479('0x23')](function(_0x41274f){logger['info'](_0xf479('0x1b'),_0x2aa31e);logger[_0xf479('0x12')](_0xf479('0x1b'),_0x2aa31e,JSON[_0xf479('0x14')](_0x41274f));_0xf634a7(_0x41274f);})['catch'](function(_0x22f4b8){logger[_0xf479('0x15')](_0xf479('0x1b'),_0x22f4b8[_0xf479('0x17')],_0x2aa31e);_0x18c01f(_0x171465['error'](0x1f4,_0x22f4b8[_0xf479('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 798978f..2b89214 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 _0x938d=['./userVoiceQueueRt.events','save','update','removeListener','length'];(function(_0x23fcbd,_0x5a9934){var _0x3f6360=function(_0x1a9d59){while(--_0x1a9d59){_0x23fcbd['push'](_0x23fcbd['shift']());}};_0x3f6360(++_0x5a9934);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0xd938('0x0'));var events=[_0xd938('0x1'),'remove',_0xd938('0x2')];function createListener(_0x29cf5f,_0x221132){return function(_0x5349c7){_0x221132['emit'](_0x29cf5f,_0x5349c7);};}function removeListener(_0xc9f24b,_0x429911){return function(){UserVoiceQueueRtEvents[_0xd938('0x3')](_0xc9f24b,_0x429911);};}exports['register']=function(_0x3a81d2){for(var _0xb5e113=0x0,_0x1ed46b=events[_0xd938('0x4')];_0xb5e113<_0x1ed46b;_0xb5e113++){var _0x678164=events[_0xb5e113];var _0x419e0b=createListener('userVoiceQueueRt:'+_0x678164,_0x3a81d2);UserVoiceQueueRtEvents['on'](_0x678164,_0x419e0b);}}; \ No newline at end of file +var _0xea31=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xea31,0x6b));var _0x1ea3=function(_0x320932,_0x592a84){_0x320932=_0x320932-0x0;var _0xb5908=_0xea31[_0x320932];return _0xb5908;};'use strict';var UserVoiceQueueRtEvents=require(_0x1ea3('0x0'));var events=['save',_0x1ea3('0x1'),_0x1ea3('0x2')];function createListener(_0x3b1d99,_0x153625){return function(_0x2dc24e){_0x153625[_0x1ea3('0x3')](_0x3b1d99,_0x2dc24e);};}function removeListener(_0x1142f1,_0x555620){return function(){UserVoiceQueueRtEvents[_0x1ea3('0x4')](_0x1142f1,_0x555620);};}exports[_0x1ea3('0x5')]=function(_0x6810da){for(var _0x27c695=0x0,_0x13e6fb=events['length'];_0x27c695<_0x13e6fb;_0x27c695++){var _0x1fa3a8=events[_0x27c695];var _0x1b578e=createListener(_0x1ea3('0x6')+_0x1fa3a8,_0x6810da);UserVoiceQueueRtEvents['on'](_0x1fa3a8,_0x1b578e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index bfa3bbe..5942c40 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x55abdc,_0xc008b5){var _0xd8d97f=function(_0x3d72ac){while(--_0x3d72ac){_0x55abdc['push'](_0x55abdc['shift']());}};_0xd8d97f(++_0xc008b5);}(_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(_0x285c4d,_0x31cef6){var _0x538a56=function(_0x5adbc0){while(--_0x5adbc0){_0x285c4d['push'](_0x285c4d['shift']());}};_0x538a56(++_0x31cef6);}(_0x70e0,0x17b));var _0x070e=function(_0x2e5173,_0x8af9db){_0x2e5173=_0x2e5173-0x0;var _0x18c805=_0x70e0[_0x2e5173];return _0x18c805;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3d9013c..6a95bee 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 _0x38ec=['INTEGER','sequelize','exports'];(function(_0x3d32c5,_0x348802){var _0x1d676e=function(_0x1c4234){while(--_0x1c4234){_0x3d32c5['push'](_0x3d32c5['shift']());}};_0x1d676e(++_0x348802);}(_0x38ec,0xfa));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc38e('0x0'));module[_0xc38e('0x1')]={'penalty':{'type':Sequelize[_0xc38e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe057=['sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe057,0x8e));var _0x7e05=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xe057[_0x38c632];return _0x12737e;};'use strict';var Sequelize=require(_0x7e05('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 468948b..8c4bfbb 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 _0xc947=['UserWhatsappQueue','lodash','../../config/logger','api','moment','path','../../config/environment','exports','define'];(function(_0xdb576,_0x13705e){var _0x98a94b=function(_0x4c1533){while(--_0x4c1533){_0xdb576['push'](_0xdb576['shift']());}};_0x98a94b(++_0x13705e);}(_0xc947,0x169));var _0x7c94=function(_0x54c2d2,_0x3df46c){_0x54c2d2=_0x54c2d2-0x0;var _0x2bd554=_0xc947[_0x54c2d2];return _0x2bd554;};'use strict';var _=require(_0x7c94('0x0'));var util=require('util');var logger=require(_0x7c94('0x1'))(_0x7c94('0x2'));var moment=require(_0x7c94('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c94('0x4'));var rimraf=require('rimraf');var config=require(_0x7c94('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0x7c94('0x6')]=function(_0x22adae,_0x59375b){return _0x22adae[_0x7c94('0x7')](_0x7c94('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x588e=['bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x51eb77,_0x436673){var _0x4b26fe=function(_0x4db9dc){while(--_0x4db9dc){_0x51eb77['push'](_0x51eb77['shift']());}};_0x4b26fe(++_0x436673);}(_0x588e,0x188));var _0xe588=function(_0x17e3c7,_0x1cfc59){_0x17e3c7=_0x17e3c7-0x0;var _0x4e0af9=_0x588e[_0x17e3c7];return _0x4e0af9;};'use strict';var _=require(_0xe588('0x0'));var util=require(_0xe588('0x1'));var logger=require(_0xe588('0x2'))(_0xe588('0x3'));var moment=require('moment');var BPromise=require(_0xe588('0x4'));var rp=require(_0xe588('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe588('0x6'));var config=require(_0xe588('0x7'));var attributes=require(_0xe588('0x8'));module[_0xe588('0x9')]=function(_0x392528,_0x15ea1a){return _0x392528[_0xe588('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xe588('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 4d7627a..e860c1c 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 _0x337e=['rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x43e45d,_0x287b69){var _0x44ee61=function(_0x497563){while(--_0x497563){_0x43e45d['push'](_0x43e45d['shift']());}};_0x44ee61(++_0x287b69);}(_0x337e,0x162));var _0xe337=function(_0x4d446d,_0x4ca224){_0x4d446d=_0x4d446d-0x0;var _0x416ca8=_0x337e[_0x4d446d];return _0x416ca8;};'use strict';var _=require(_0xe337('0x0'));var util=require(_0xe337('0x1'));var moment=require(_0xe337('0x2'));var BPromise=require(_0xe337('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe337('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe337('0x5'));var logger=require('../../config/logger')(_0xe337('0x6'));var config=require(_0xe337('0x7'));var jayson=require(_0xe337('0x8'));var client=jayson[_0xe337('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2294ef,_0x34d1f1,_0x5c215b){return new BPromise(function(_0x3fc52b,_0x448023){return client[_0xe337('0xa')](_0x2294ef,_0x5c215b)[_0xe337('0xb')](function(_0x29c107){logger[_0xe337('0xc')](_0xe337('0xd'),_0x34d1f1,_0xe337('0xe'));logger[_0xe337('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x34d1f1,_0xe337('0xe'),JSON[_0xe337('0x10')](_0x29c107));if(_0x29c107['error']){if(_0x29c107['error']['code']===0x1f4){logger['error'](_0xe337('0xd'),_0x34d1f1,_0x29c107[_0xe337('0x11')]['message']);return _0x448023(_0x29c107[_0xe337('0x11')][_0xe337('0x12')]);}logger['error'](_0xe337('0xd'),_0x34d1f1,_0x29c107[_0xe337('0x11')][_0xe337('0x12')]);return _0x3fc52b(_0x29c107['error'][_0xe337('0x12')]);}else{logger[_0xe337('0xc')](_0xe337('0xd'),_0x34d1f1,'request\x20sent');_0x3fc52b(_0x29c107['result'][_0xe337('0x12')]);}})[_0xe337('0x13')](function(_0x4b6941){logger['error'](_0xe337('0xd'),_0x34d1f1,_0x4b6941);_0x448023(_0x4b6941);});});} \ No newline at end of file +var _0xd56c=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd56c,0xd2));var _0xcd56=function(_0x4ac5c0,_0x575aae){_0x4ac5c0=_0x4ac5c0-0x0;var _0x26154c=_0xd56c[_0x4ac5c0];return _0x26154c;};'use strict';var _=require(_0xcd56('0x0'));var util=require('util');var moment=require(_0xcd56('0x1'));var BPromise=require(_0xcd56('0x2'));var rs=require(_0xcd56('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd56('0x4'))['db'];var utils=require(_0xcd56('0x5'));var logger=require(_0xcd56('0x6'))('rpc');var config=require(_0xcd56('0x7'));var jayson=require(_0xcd56('0x8'));var client=jayson[_0xcd56('0x9')][_0xcd56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c0f34,_0x12273e,_0x52f376){return new BPromise(function(_0xe22576,_0x5cc0aa){return client[_0xcd56('0xb')](_0x2c0f34,_0x52f376)[_0xcd56('0xc')](function(_0x227f1d){logger[_0xcd56('0xd')](_0xcd56('0xe'),_0x12273e,_0xcd56('0xf'));logger['debug'](_0xcd56('0x10'),_0x12273e,_0xcd56('0xf'),JSON['stringify'](_0x227f1d));if(_0x227f1d[_0xcd56('0x11')]){if(_0x227f1d['error'][_0xcd56('0x12')]===0x1f4){logger[_0xcd56('0x11')](_0xcd56('0xe'),_0x12273e,_0x227f1d[_0xcd56('0x11')][_0xcd56('0x13')]);return _0x5cc0aa(_0x227f1d[_0xcd56('0x11')][_0xcd56('0x13')]);}logger[_0xcd56('0x11')](_0xcd56('0xe'),_0x12273e,_0x227f1d[_0xcd56('0x11')][_0xcd56('0x13')]);return _0xe22576(_0x227f1d[_0xcd56('0x11')][_0xcd56('0x13')]);}else{logger[_0xcd56('0xd')](_0xcd56('0xe'),_0x12273e,_0xcd56('0xf'));_0xe22576(_0x227f1d[_0xcd56('0x14')][_0xcd56('0x13')]);}})['catch'](function(_0x2a9ba8){logger['error'](_0xcd56('0xe'),_0x12273e,_0x2a9ba8);_0x5cc0aa(_0x2a9ba8);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 83de0c0..e9e628a 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 _0xa1a5=['/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x42d1c8,_0xc13c44){var _0x22f990=function(_0x3ce85f){while(--_0x3ce85f){_0x42d1c8['push'](_0x42d1c8['shift']());}};_0x22f990(++_0xc13c44);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x228cb5,_0x854201){_0x228cb5=_0x228cb5-0x0;var _0x577170=_0xa1a5[_0x228cb5];return _0x577170;};'use strict';var multer=require(_0x5a1a('0x0'));var util=require('util');var path=require(_0x5a1a('0x1'));var timeout=require(_0x5a1a('0x2'));var express=require(_0x5a1a('0x3'));var router=express[_0x5a1a('0x4')]();var fs_extra=require(_0x5a1a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5a1a('0x6'));var config=require(_0x5a1a('0x7'));var controller=require(_0x5a1a('0x8'));router[_0x5a1a('0x9')]('/',auth[_0x5a1a('0xa')](),controller[_0x5a1a('0xb')]);router[_0x5a1a('0x9')]('/:id',auth[_0x5a1a('0xa')](),controller[_0x5a1a('0xc')]);router[_0x5a1a('0xd')]('/',auth[_0x5a1a('0xa')](),controller[_0x5a1a('0xe')]);router[_0x5a1a('0xf')](_0x5a1a('0x10'),auth[_0x5a1a('0xa')](),controller[_0x5a1a('0x11')]);router['delete'](_0x5a1a('0x10'),auth[_0x5a1a('0xa')](),controller[_0x5a1a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1306=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x260f7b,_0x55199e){var _0x555862=function(_0x12259f){while(--_0x12259f){_0x260f7b['push'](_0x260f7b['shift']());}};_0x555862(++_0x55199e);}(_0x1306,0x17a));var _0x6130=function(_0x5e091d,_0xc1d2a4){_0x5e091d=_0x5e091d-0x0;var _0x2d799f=_0x1306[_0x5e091d];return _0x2d799f;};'use strict';var multer=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var path=require(_0x6130('0x2'));var timeout=require(_0x6130('0x3'));var express=require(_0x6130('0x4'));var router=express[_0x6130('0x5')]();var fs_extra=require(_0x6130('0x6'));var auth=require(_0x6130('0x7'));var interaction=require(_0x6130('0x8'));var config=require(_0x6130('0x9'));var controller=require(_0x6130('0xa'));router[_0x6130('0xb')]('/',auth[_0x6130('0xc')](),controller[_0x6130('0xd')]);router[_0x6130('0xb')](_0x6130('0xe'),auth[_0x6130('0xc')](),controller[_0x6130('0xf')]);router[_0x6130('0x10')]('/',auth[_0x6130('0xc')](),controller[_0x6130('0x11')]);router[_0x6130('0x12')](_0x6130('0xe'),auth[_0x6130('0xc')](),controller[_0x6130('0x13')]);router[_0x6130('0x14')](_0x6130('0xe'),auth[_0x6130('0xc')](),controller[_0x6130('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index eadb86b..03487fc 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 _0x9e43=['STRING','name','sequelize','exports'];(function(_0x1125ef,_0x89658){var _0x5155e8=function(_0x562f5c){while(--_0x562f5c){_0x1125ef['push'](_0x1125ef['shift']());}};_0x5155e8(++_0x89658);}(_0x9e43,0x18a));var _0x39e4=function(_0x5bb207,_0x157700){_0x5bb207=_0x5bb207-0x0;var _0x4b198e=_0x9e43[_0x5bb207];return _0x4b198e;};'use strict';var Sequelize=require(_0x39e4('0x0'));module[_0x39e4('0x1')]={'name':{'type':Sequelize[_0x39e4('0x2')],'unique':_0x39e4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x39e4('0x2')]}}; \ No newline at end of file +var _0x2a2f=['STRING','sequelize','exports'];(function(_0x58d13b,_0x1aac94){var _0x1ca85d=function(_0x1205bd){while(--_0x1205bd){_0x58d13b['push'](_0x58d13b['shift']());}};_0x1ca85d(++_0x1aac94);}(_0x2a2f,0x1c6));var _0xf2a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2a2f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xf2a2('0x0'));module[_0xf2a2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf2a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 60b5e34..cb48b71 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 _0x98bf=['save','update','then','destroy','get','Variables','end','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98bf,0x83));var _0xf98b=function(_0x5eacaf,_0xdea236){_0x5eacaf=_0x5eacaf-0x0;var _0x5c7f7f=_0x98bf[_0x5eacaf];return _0x5c7f7f;};'use strict';var emlformat=require(_0xf98b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf98b('0x1'));var jsonpatch=require(_0xf98b('0x2'));var rp=require('request-promise');var moment=require(_0xf98b('0x3'));var BPromise=require(_0xf98b('0x4'));var Mustache=require(_0xf98b('0x5'));var util=require(_0xf98b('0x6'));var path=require('path');var sox=require(_0xf98b('0x7'));var csv=require(_0xf98b('0x8'));var ejs=require(_0xf98b('0x9'));var fs=require('fs');var fs_extra=require(_0xf98b('0xa'));var _=require(_0xf98b('0xb'));var squel=require(_0xf98b('0xc'));var crypto=require(_0xf98b('0xd'));var jsforce=require(_0xf98b('0xe'));var deskjs=require(_0xf98b('0xf'));var toCsv=require(_0xf98b('0x8'));var querystring=require('querystring');var Papa=require(_0xf98b('0x10'));var Redis=require(_0xf98b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf98b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf98b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf98b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbd83fa,_0x27eaa1){_0x27eaa1=_0x27eaa1||0xcc;return function(_0x4dad75){if(_0x4dad75){return _0xbd83fa[_0xf98b('0x15')](_0x27eaa1);}return _0xbd83fa[_0xf98b('0x16')](_0x27eaa1)['end']();};}function respondWithResult(_0x49fa86,_0x39e143){_0x39e143=_0x39e143||0xc8;return function(_0x549c39){if(_0x549c39){return _0x49fa86[_0xf98b('0x16')](_0x39e143)['json'](_0x549c39);}};}function respondWithFilteredResult(_0x5e418e,_0x10a2eb){return function(_0x2f0a9b){if(_0x2f0a9b){var _0x5897ac=typeof _0x10a2eb['offset']===_0xf98b('0x17')&&typeof _0x10a2eb[_0xf98b('0x18')]===_0xf98b('0x17');var _0x2e7294=_0x2f0a9b['count'];var _0x1c477e=_0x5897ac?0x0:_0x10a2eb['offset'];var _0x31a8bc=_0x5897ac?_0x2f0a9b[_0xf98b('0x19')]:_0x10a2eb[_0xf98b('0x1a')]+_0x10a2eb[_0xf98b('0x18')];var _0x2d515b;if(_0x31a8bc>=_0x2e7294){_0x31a8bc=_0x2e7294;_0x2d515b=0xc8;}else{_0x2d515b=0xce;}_0x5e418e[_0xf98b('0x16')](_0x2d515b);return _0x5e418e['set'](_0xf98b('0x1b'),_0x1c477e+'-'+_0x31a8bc+'/'+_0x2e7294)[_0xf98b('0x1c')](_0x2f0a9b);}return null;};}function patchUpdates(_0x4cab36){return function(_0x38c0f8){try{jsonpatch[_0xf98b('0x1d')](_0x38c0f8,_0x4cab36,!![]);}catch(_0x3d0b92){return BPromise[_0xf98b('0x1e')](_0x3d0b92);}return _0x38c0f8[_0xf98b('0x1f')]();};}function saveUpdates(_0x4f4edb,_0x50f082){return function(_0x3539e3){if(_0x3539e3){return _0x3539e3[_0xf98b('0x20')](_0x4f4edb)[_0xf98b('0x21')](function(_0x1e7f0f){return _0x1e7f0f;});}return null;};}function removeEntity(_0x576a47,_0x242b5f){return function(_0x1d4ebb){if(_0x1d4ebb){return _0x1d4ebb[_0xf98b('0x22')]()[_0xf98b('0x21')](function(){var _0x159bad=_0x1d4ebb[_0xf98b('0x23')]({'plain':!![]});var _0x45944f=_0xf98b('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x45944f,'resourceId':_0x159bad['id']}})[_0xf98b('0x21')](function(){return _0x1d4ebb;});})[_0xf98b('0x21')](function(){_0x576a47[_0xf98b('0x16')](0xcc)[_0xf98b('0x25')]();});}};}function handleEntityNotFound(_0x5d4d3a,_0x3f13ca){return function(_0x4260df){if(!_0x4260df){_0x5d4d3a[_0xf98b('0x15')](0x194);}return _0x4260df;};}function handleError(_0x1c035e,_0x3bed5a){_0x3bed5a=_0x3bed5a||0x1f4;return function(_0x4ffb86){logger[_0xf98b('0x26')](_0x4ffb86[_0xf98b('0x27')]);if(_0x4ffb86[_0xf98b('0x28')]){delete _0x4ffb86['name'];}_0x1c035e[_0xf98b('0x16')](_0x3bed5a)[_0xf98b('0x29')](_0x4ffb86);};}exports[_0xf98b('0x2a')]=function(_0x4855fe,_0x4ffa34){var _0x222029={},_0x3cd7d8={},_0x498342={'count':0x0,'rows':[]};var _0x3065d4=_['map'](db[_0xf98b('0x2b')][_0xf98b('0x2c')],function(_0x14a65a){return{'name':_0x14a65a[_0xf98b('0x2d')],'type':_0x14a65a[_0xf98b('0x2e')][_0xf98b('0x2f')]};});_0x3cd7d8[_0xf98b('0x30')]=_[_0xf98b('0x31')](_0x3065d4,_0xf98b('0x28'));_0x3cd7d8[_0xf98b('0x32')]=_[_0xf98b('0x33')](_0x4855fe[_0xf98b('0x32')]);_0x3cd7d8[_0xf98b('0x34')]=_[_0xf98b('0x35')](_0x3cd7d8['model'],_0x3cd7d8[_0xf98b('0x32')]);_0x222029[_0xf98b('0x36')]=_[_0xf98b('0x35')](_0x3cd7d8[_0xf98b('0x30')],qs[_0xf98b('0x37')](_0x4855fe[_0xf98b('0x32')][_0xf98b('0x37')]));_0x222029[_0xf98b('0x36')]=_0x222029[_0xf98b('0x36')][_0xf98b('0x38')]?_0x222029[_0xf98b('0x36')]:_0x3cd7d8[_0xf98b('0x30')];if(!_0x4855fe[_0xf98b('0x32')][_0xf98b('0x39')](_0xf98b('0x3a'))){_0x222029['limit']=qs[_0xf98b('0x18')](_0x4855fe[_0xf98b('0x32')]['limit']);_0x222029[_0xf98b('0x1a')]=qs[_0xf98b('0x1a')](_0x4855fe[_0xf98b('0x32')][_0xf98b('0x1a')]);}_0x222029[_0xf98b('0x3b')]=qs[_0xf98b('0x3c')](_0x4855fe[_0xf98b('0x32')][_0xf98b('0x3c')]);_0x222029[_0xf98b('0x3d')]=qs['filters'](_['pick'](_0x4855fe[_0xf98b('0x32')],_0x3cd7d8[_0xf98b('0x34')]),_0x3065d4);if(_0x4855fe[_0xf98b('0x32')][_0xf98b('0x3e')]){_0x222029[_0xf98b('0x3d')]=_[_0xf98b('0x3f')](_0x222029['where'],{'$or':_[_0xf98b('0x31')](_0x3065d4,function(_0x3f5a45){if(_0x3f5a45['type']!==_0xf98b('0x40')){var _0x208606={};_0x208606[_0x3f5a45[_0xf98b('0x28')]]={'$like':'%'+_0x4855fe['query'][_0xf98b('0x3e')]+'%'};return _0x208606;}})});}_0x222029=_[_0xf98b('0x3f')]({},_0x222029,_0x4855fe[_0xf98b('0x41')]);var _0x33a5d0={'where':_0x222029[_0xf98b('0x3d')]};return db[_0xf98b('0x2b')][_0xf98b('0x19')](_0x33a5d0)[_0xf98b('0x21')](function(_0xf00650){_0x498342['count']=_0xf00650;if(_0x4855fe['query'][_0xf98b('0x42')]){_0x222029[_0xf98b('0x43')]=[{'all':!![]}];}return db[_0xf98b('0x2b')][_0xf98b('0x44')](_0x222029);})[_0xf98b('0x21')](function(_0x5dc501){_0x498342['rows']=_0x5dc501;return _0x498342;})[_0xf98b('0x21')](respondWithFilteredResult(_0x4ffa34,_0x222029))[_0xf98b('0x45')](handleError(_0x4ffa34,null));};exports[_0xf98b('0x46')]=function(_0x208dc6,_0x3caec8){var _0x38a365={'raw':!![],'where':{'id':_0x208dc6['params']['id']}},_0x1d25cb={};_0x1d25cb[_0xf98b('0x30')]=_[_0xf98b('0x33')](db['Variable']['rawAttributes']);_0x1d25cb[_0xf98b('0x32')]=_[_0xf98b('0x33')](_0x208dc6['query']);_0x1d25cb[_0xf98b('0x34')]=_[_0xf98b('0x35')](_0x1d25cb[_0xf98b('0x30')],_0x1d25cb['query']);_0x38a365[_0xf98b('0x36')]=_[_0xf98b('0x35')](_0x1d25cb[_0xf98b('0x30')],qs[_0xf98b('0x37')](_0x208dc6['query'][_0xf98b('0x37')]));_0x38a365[_0xf98b('0x36')]=_0x38a365[_0xf98b('0x36')][_0xf98b('0x38')]?_0x38a365[_0xf98b('0x36')]:_0x1d25cb[_0xf98b('0x30')];if(_0x208dc6[_0xf98b('0x32')]['includeAll']){_0x38a365[_0xf98b('0x43')]=[{'all':!![]}];}_0x38a365=_[_0xf98b('0x3f')]({},_0x38a365,_0x208dc6[_0xf98b('0x41')]);return db[_0xf98b('0x2b')][_0xf98b('0x47')](_0x38a365)['then'](handleEntityNotFound(_0x3caec8,null))[_0xf98b('0x21')](respondWithResult(_0x3caec8,null))[_0xf98b('0x45')](handleError(_0x3caec8,null));};exports[_0xf98b('0x48')]=function(_0x2e627a,_0x21abf2){return db[_0xf98b('0x2b')]['create'](_0x2e627a[_0xf98b('0x49')],{})[_0xf98b('0x21')](function(_0x55d75c){var _0x28ce49=_0x2e627a[_0xf98b('0x4a')][_0xf98b('0x23')]({'plain':!![]});if(!_0x28ce49)throw new Error(_0xf98b('0x4b'));if(_0x28ce49['role']==='user'){var _0x41ed21=_0x55d75c[_0xf98b('0x23')]({'plain':!![]});var _0x1949e7='Variables';return db[_0xf98b('0x4c')][_0xf98b('0x47')]({'where':{'name':_0x1949e7,'userProfileId':_0x28ce49[_0xf98b('0x4d')]},'raw':!![]})[_0xf98b('0x21')](function(_0xbc110c){if(_0xbc110c&&_0xbc110c[_0xf98b('0x4e')]===0x0){return db['UserProfileResource'][_0xf98b('0x48')]({'name':_0x41ed21[_0xf98b('0x28')],'resourceId':_0x41ed21['id'],'type':_0xbc110c['name'],'sectionId':_0xbc110c['id']},{})[_0xf98b('0x21')](function(){return _0x55d75c;});}else{return _0x55d75c;}})[_0xf98b('0x45')](function(_0x27a9ee){logger[_0xf98b('0x26')](_0xf98b('0x4f'),_0x27a9ee);throw _0x27a9ee;});}return _0x55d75c;})[_0xf98b('0x21')](respondWithResult(_0x21abf2,0xc9))['catch'](handleError(_0x21abf2,null));};exports['update']=function(_0x791c60,_0x132107){if(_0x791c60[_0xf98b('0x49')]['id']){delete _0x791c60[_0xf98b('0x49')]['id'];}return db[_0xf98b('0x2b')][_0xf98b('0x47')]({'where':{'id':_0x791c60[_0xf98b('0x50')]['id']}})['then'](handleEntityNotFound(_0x132107,null))[_0xf98b('0x21')](saveUpdates(_0x791c60[_0xf98b('0x49')],null))[_0xf98b('0x21')](respondWithResult(_0x132107,null))[_0xf98b('0x45')](handleError(_0x132107,null));};exports[_0xf98b('0x22')]=function(_0xd1b067,_0x3fd6bf){return db[_0xf98b('0x2b')][_0xf98b('0x47')]({'where':{'id':_0xd1b067['params']['id']}})[_0xf98b('0x21')](handleEntityNotFound(_0x3fd6bf,null))['then'](removeEntity(_0x3fd6bf,null))[_0xf98b('0x45')](handleError(_0x3fd6bf,null));}; \ No newline at end of file +var _0xec9b=['name','index','map','rawAttributes','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','Variable','include','rows','catch','show','params','length','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','Variables','UserProfileResource','destroy','error'];(function(_0x140ff2,_0x11f760){var _0x54ebe8=function(_0x6dc17c){while(--_0x6dc17c){_0x140ff2['push'](_0x140ff2['shift']());}};_0x54ebe8(++_0x11f760);}(_0xec9b,0x1b3));var _0xbec9=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0xec9b[_0x407bd8];return _0x20b6c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbec9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbec9('0x1'));var moment=require(_0xbec9('0x2'));var BPromise=require(_0xbec9('0x3'));var Mustache=require(_0xbec9('0x4'));var util=require(_0xbec9('0x5'));var path=require(_0xbec9('0x6'));var sox=require('sox');var csv=require(_0xbec9('0x7'));var ejs=require(_0xbec9('0x8'));var fs=require('fs');var fs_extra=require(_0xbec9('0x9'));var _=require(_0xbec9('0xa'));var squel=require(_0xbec9('0xb'));var crypto=require(_0xbec9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbec9('0xd'));var toCsv=require(_0xbec9('0x7'));var querystring=require(_0xbec9('0xe'));var Papa=require(_0xbec9('0xf'));var Redis=require('ioredis');var authService=require(_0xbec9('0x10'));var qs=require(_0xbec9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbec9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbec9('0x13'));var config=require(_0xbec9('0x14'));var licenseUtil=require(_0xbec9('0x15'));var db=require(_0xbec9('0x16'))['db'];function respondWithStatusCode(_0x1eae02,_0x1b03de){_0x1b03de=_0x1b03de||0xcc;return function(_0x27ea64){if(_0x27ea64){return _0x1eae02[_0xbec9('0x17')](_0x1b03de);}return _0x1eae02[_0xbec9('0x18')](_0x1b03de)['end']();};}function respondWithResult(_0x24215a,_0x4ebf57){_0x4ebf57=_0x4ebf57||0xc8;return function(_0xe7ee38){if(_0xe7ee38){return _0x24215a[_0xbec9('0x18')](_0x4ebf57)[_0xbec9('0x19')](_0xe7ee38);}};}function respondWithFilteredResult(_0x2419a8,_0xe5b2ae){return function(_0x20e595){if(_0x20e595){var _0x42b836=typeof _0xe5b2ae[_0xbec9('0x1a')]==='undefined'&&typeof _0xe5b2ae['limit']===_0xbec9('0x1b');var _0x2d7f8f=_0x20e595['count'];var _0x4b8d6b=_0x42b836?0x0:_0xe5b2ae[_0xbec9('0x1a')];var _0x14cd51=_0x42b836?_0x20e595[_0xbec9('0x1c')]:_0xe5b2ae[_0xbec9('0x1a')]+_0xe5b2ae[_0xbec9('0x1d')];var _0x4c5d8f;if(_0x14cd51>=_0x2d7f8f){_0x14cd51=_0x2d7f8f;_0x4c5d8f=0xc8;}else{_0x4c5d8f=0xce;}_0x2419a8[_0xbec9('0x18')](_0x4c5d8f);return _0x2419a8[_0xbec9('0x1e')](_0xbec9('0x1f'),_0x4b8d6b+'-'+_0x14cd51+'/'+_0x2d7f8f)[_0xbec9('0x19')](_0x20e595);}return null;};}function patchUpdates(_0x3b240e){return function(_0x560760){try{jsonpatch['apply'](_0x560760,_0x3b240e,!![]);}catch(_0x365c08){return BPromise[_0xbec9('0x20')](_0x365c08);}return _0x560760['save']();};}function saveUpdates(_0x1aa5e3,_0x160edb){return function(_0x3e4a7a){if(_0x3e4a7a){return _0x3e4a7a[_0xbec9('0x21')](_0x1aa5e3)[_0xbec9('0x22')](function(_0x3758b8){return _0x3758b8;});}return null;};}function removeEntity(_0x415852,_0x2f1b36){return function(_0xc9e10a){if(_0xc9e10a){return _0xc9e10a['destroy']()['then'](function(){var _0x2428d4=_0xc9e10a['get']({'plain':!![]});var _0x23518a=_0xbec9('0x23');return db[_0xbec9('0x24')][_0xbec9('0x25')]({'where':{'type':_0x23518a,'resourceId':_0x2428d4['id']}})[_0xbec9('0x22')](function(){return _0xc9e10a;});})[_0xbec9('0x22')](function(){_0x415852[_0xbec9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5064c3,_0x3b206b){return function(_0x236da0){if(!_0x236da0){_0x5064c3[_0xbec9('0x17')](0x194);}return _0x236da0;};}function handleError(_0x3ff49b,_0x3a08d4){_0x3a08d4=_0x3a08d4||0x1f4;return function(_0x362dd4){logger[_0xbec9('0x26')](_0x362dd4['stack']);if(_0x362dd4[_0xbec9('0x27')]){delete _0x362dd4[_0xbec9('0x27')];}_0x3ff49b[_0xbec9('0x18')](_0x3a08d4)['send'](_0x362dd4);};}exports[_0xbec9('0x28')]=function(_0x1dad6e,_0x442cee){var _0x19d560={},_0x5969c7={},_0x1bf33b={'count':0x0,'rows':[]};var _0x2430ee=_[_0xbec9('0x29')](db['Variable'][_0xbec9('0x2a')],function(_0x14087b){return{'name':_0x14087b['fieldName'],'type':_0x14087b[_0xbec9('0x2b')]['key']};});_0x5969c7[_0xbec9('0x2c')]=_[_0xbec9('0x29')](_0x2430ee,_0xbec9('0x27'));_0x5969c7['query']=_[_0xbec9('0x2d')](_0x1dad6e[_0xbec9('0x2e')]);_0x5969c7['filters']=_[_0xbec9('0x2f')](_0x5969c7['model'],_0x5969c7[_0xbec9('0x2e')]);_0x19d560['attributes']=_[_0xbec9('0x2f')](_0x5969c7[_0xbec9('0x2c')],qs[_0xbec9('0x30')](_0x1dad6e['query'][_0xbec9('0x30')]));_0x19d560[_0xbec9('0x31')]=_0x19d560[_0xbec9('0x31')]['length']?_0x19d560['attributes']:_0x5969c7[_0xbec9('0x2c')];if(!_0x1dad6e[_0xbec9('0x2e')][_0xbec9('0x32')](_0xbec9('0x33'))){_0x19d560[_0xbec9('0x1d')]=qs[_0xbec9('0x1d')](_0x1dad6e[_0xbec9('0x2e')]['limit']);_0x19d560[_0xbec9('0x1a')]=qs[_0xbec9('0x1a')](_0x1dad6e[_0xbec9('0x2e')][_0xbec9('0x1a')]);}_0x19d560[_0xbec9('0x34')]=qs[_0xbec9('0x35')](_0x1dad6e[_0xbec9('0x2e')]['sort']);_0x19d560['where']=qs[_0xbec9('0x36')](_[_0xbec9('0x37')](_0x1dad6e[_0xbec9('0x2e')],_0x5969c7['filters']),_0x2430ee);if(_0x1dad6e[_0xbec9('0x2e')][_0xbec9('0x38')]){_0x19d560[_0xbec9('0x39')]=_[_0xbec9('0x3a')](_0x19d560[_0xbec9('0x39')],{'$or':_[_0xbec9('0x29')](_0x2430ee,function(_0x4da78b){if(_0x4da78b[_0xbec9('0x2b')]!==_0xbec9('0x3b')){var _0x285c4d={};_0x285c4d[_0x4da78b[_0xbec9('0x27')]]={'$like':'%'+_0x1dad6e[_0xbec9('0x2e')][_0xbec9('0x38')]+'%'};return _0x285c4d;}})});}_0x19d560=_[_0xbec9('0x3a')]({},_0x19d560,_0x1dad6e['options']);var _0xac97b5={'where':_0x19d560[_0xbec9('0x39')]};return db[_0xbec9('0x3c')][_0xbec9('0x1c')](_0xac97b5)['then'](function(_0xd3c98d){_0x1bf33b[_0xbec9('0x1c')]=_0xd3c98d;if(_0x1dad6e[_0xbec9('0x2e')]['includeAll']){_0x19d560[_0xbec9('0x3d')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x19d560);})[_0xbec9('0x22')](function(_0x278e36){_0x1bf33b[_0xbec9('0x3e')]=_0x278e36;return _0x1bf33b;})['then'](respondWithFilteredResult(_0x442cee,_0x19d560))[_0xbec9('0x3f')](handleError(_0x442cee,null));};exports[_0xbec9('0x40')]=function(_0x59cc28,_0x2a0123){var _0x47dcd6={'raw':!![],'where':{'id':_0x59cc28[_0xbec9('0x41')]['id']}},_0x353b50={};_0x353b50[_0xbec9('0x2c')]=_['keys'](db[_0xbec9('0x3c')][_0xbec9('0x2a')]);_0x353b50[_0xbec9('0x2e')]=_['keys'](_0x59cc28[_0xbec9('0x2e')]);_0x353b50[_0xbec9('0x36')]=_['intersection'](_0x353b50[_0xbec9('0x2c')],_0x353b50[_0xbec9('0x2e')]);_0x47dcd6['attributes']=_['intersection'](_0x353b50[_0xbec9('0x2c')],qs[_0xbec9('0x30')](_0x59cc28[_0xbec9('0x2e')][_0xbec9('0x30')]));_0x47dcd6[_0xbec9('0x31')]=_0x47dcd6[_0xbec9('0x31')][_0xbec9('0x42')]?_0x47dcd6[_0xbec9('0x31')]:_0x353b50['model'];if(_0x59cc28[_0xbec9('0x2e')][_0xbec9('0x43')]){_0x47dcd6[_0xbec9('0x3d')]=[{'all':!![]}];}_0x47dcd6=_[_0xbec9('0x3a')]({},_0x47dcd6,_0x59cc28[_0xbec9('0x44')]);return db[_0xbec9('0x3c')][_0xbec9('0x45')](_0x47dcd6)[_0xbec9('0x22')](handleEntityNotFound(_0x2a0123,null))[_0xbec9('0x22')](respondWithResult(_0x2a0123,null))[_0xbec9('0x3f')](handleError(_0x2a0123,null));};exports['create']=function(_0x2168d7,_0x317564){return db['Variable'][_0xbec9('0x46')](_0x2168d7[_0xbec9('0x47')],{})[_0xbec9('0x22')](function(_0x166b1d){var _0x33cdff=_0x2168d7[_0xbec9('0x48')][_0xbec9('0x49')]({'plain':!![]});if(!_0x33cdff)throw new Error(_0xbec9('0x4a'));if(_0x33cdff['role']==='user'){var _0x328628=_0x166b1d[_0xbec9('0x49')]({'plain':!![]});var _0x3f808b=_0xbec9('0x23');return db[_0xbec9('0x4b')][_0xbec9('0x45')]({'where':{'name':_0x3f808b,'userProfileId':_0x33cdff[_0xbec9('0x4c')]},'raw':!![]})[_0xbec9('0x22')](function(_0x2df16a){if(_0x2df16a&&_0x2df16a[_0xbec9('0x4d')]===0x0){return db[_0xbec9('0x24')][_0xbec9('0x46')]({'name':_0x328628[_0xbec9('0x27')],'resourceId':_0x328628['id'],'type':_0x2df16a[_0xbec9('0x27')],'sectionId':_0x2df16a['id']},{})[_0xbec9('0x22')](function(){return _0x166b1d;});}else{return _0x166b1d;}})[_0xbec9('0x3f')](function(_0x3a0cbe){logger[_0xbec9('0x26')](_0xbec9('0x4e'),_0x3a0cbe);throw _0x3a0cbe;});}return _0x166b1d;})['then'](respondWithResult(_0x317564,0xc9))[_0xbec9('0x3f')](handleError(_0x317564,null));};exports[_0xbec9('0x21')]=function(_0x5ea532,_0x31217d){if(_0x5ea532[_0xbec9('0x47')]['id']){delete _0x5ea532[_0xbec9('0x47')]['id'];}return db[_0xbec9('0x3c')][_0xbec9('0x45')]({'where':{'id':_0x5ea532[_0xbec9('0x41')]['id']}})[_0xbec9('0x22')](handleEntityNotFound(_0x31217d,null))['then'](saveUpdates(_0x5ea532[_0xbec9('0x47')],null))['then'](respondWithResult(_0x31217d,null))[_0xbec9('0x3f')](handleError(_0x31217d,null));};exports[_0xbec9('0x25')]=function(_0x47093f,_0x2335c3){return db[_0xbec9('0x3c')][_0xbec9('0x45')]({'where':{'id':_0x47093f[_0xbec9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2335c3,null))[_0xbec9('0x22')](removeEntity(_0x2335c3,null))[_0xbec9('0x3f')](handleError(_0x2335c3,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index f6999a4..77c1ef9 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 _0x3503=['api','moment','bluebird','request-promise','path','rimraf','./variable.attributes','exports','Variable','tools_variables'];(function(_0x164619,_0x1ef6f9){var _0x250786=function(_0x4445ae){while(--_0x4445ae){_0x164619['push'](_0x164619['shift']());}};_0x250786(++_0x1ef6f9);}(_0x3503,0x118));var _0x3350=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3503[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3350('0x0'));var moment=require(_0x3350('0x1'));var BPromise=require(_0x3350('0x2'));var rp=require(_0x3350('0x3'));var fs=require('fs');var path=require(_0x3350('0x4'));var rimraf=require(_0x3350('0x5'));var config=require('../../config/environment');var attributes=require(_0x3350('0x6'));module[_0x3350('0x7')]=function(_0x275371,_0x5b5959){return _0x275371['define'](_0x3350('0x8'),attributes,{'tableName':_0x3350('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa06b=['lodash','util','../../config/logger','api','request-promise','rimraf','./variable.attributes','exports','define','Variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa06b,0x1a4));var _0xba06=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa06b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xba06('0x0'));var util=require(_0xba06('0x1'));var logger=require(_0xba06('0x2'))(_0xba06('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba06('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba06('0x5'));var config=require('../../config/environment');var attributes=require(_0xba06('0x6'));module[_0xba06('0x7')]=function(_0x5f0de9,_0x237a98){return _0x5f0de9[_0xba06('0x8')](_0xba06('0x9'),attributes,{'tableName':'tools_variables','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 8983429..7b99a91 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x2c42a5,_0x2d1b8f){var _0x50ef99=function(_0x1415f4){while(--_0x1415f4){_0x2c42a5['push'](_0x2c42a5['shift']());}};_0x50ef99(++_0x2d1b8f);}(_0x6aa7,0x178));var _0x76aa=function(_0x5494f7,_0x1b0372){_0x5494f7=_0x5494f7-0x0;var _0x12ba05=_0x6aa7[_0x5494f7];return _0x12ba05;};'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);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x3c74c1,_0x375ac5){var _0x6c4d44=function(_0x48b826){while(--_0x48b826){_0x3c74c1['push'](_0x3c74c1['shift']());}};_0x6c4d44(++_0x375ac5);}(_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']('Variable,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 68c8438..4fafa5b 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 _0x89d6=['express','Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','migrations','exports'];(function(_0x254035,_0x2a8ed5){var _0x28c831=function(_0xfab489){while(--_0xfab489){_0x254035['push'](_0x254035['shift']());}};_0x28c831(++_0x2a8ed5);}(_0x89d6,0xaa));var _0x689d=function(_0x242b12,_0xda87b0){_0x242b12=_0x242b12-0x0;var _0x59ee49=_0x89d6[_0x242b12];return _0x59ee49;};'use strict';var express=require(_0x689d('0x0'));var router=express[_0x689d('0x1')]();var auth=require(_0x689d('0x2'));var controller=require(_0x689d('0x3'));router[_0x689d('0x4')]('/',controller[_0x689d('0x5')]);router[_0x689d('0x4')]('/fetch',auth[_0x689d('0x6')](),auth[_0x689d('0x7')](),controller[_0x689d('0x8')]);router['get'](_0x689d('0x9'),auth[_0x689d('0x6')](),auth['canUpdate'](),controller[_0x689d('0xa')]);router[_0x689d('0x4')](_0x689d('0xb'),auth[_0x689d('0x6')](),auth[_0x689d('0x7')](),controller[_0x689d('0xc')]);router[_0x689d('0x4')](_0x689d('0xd'),auth[_0x689d('0x6')](),controller[_0x689d('0xe')]);router[_0x689d('0x4')]('/migrations',controller[_0x689d('0xf')]);module[_0x689d('0x10')]=router; \ No newline at end of file +var _0xfc85=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','./version.controller','get'];(function(_0x560481,_0x355f78){var _0x208896=function(_0x3e1ba1){while(--_0x3e1ba1){_0x560481['push'](_0x560481['shift']());}};_0x208896(++_0x355f78);}(_0xfc85,0x95));var _0x5fc8=function(_0x45d8eb,_0x37959c){_0x45d8eb=_0x45d8eb-0x0;var _0xb86014=_0xfc85[_0x45d8eb];return _0xb86014;};'use strict';var express=require(_0x5fc8('0x0'));var router=express[_0x5fc8('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5fc8('0x2'));router[_0x5fc8('0x3')]('/',controller[_0x5fc8('0x4')]);router[_0x5fc8('0x3')](_0x5fc8('0x5'),auth[_0x5fc8('0x6')](),auth[_0x5fc8('0x7')](),controller[_0x5fc8('0x8')]);router[_0x5fc8('0x3')](_0x5fc8('0x9'),auth['isAuthenticated'](),auth[_0x5fc8('0x7')](),controller[_0x5fc8('0xa')]);router[_0x5fc8('0x3')](_0x5fc8('0xb'),auth[_0x5fc8('0x6')](),auth[_0x5fc8('0x7')](),controller[_0x5fc8('0xc')]);router[_0x5fc8('0x3')](_0x5fc8('0xd'),auth['isAuthenticated'](),controller[_0x5fc8('0xe')]);router[_0x5fc8('0x3')]('/migrations',controller[_0x5fc8('0xf')]);module[_0x5fc8('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 34e8f61..807488c 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 _0x8679=['npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','root','length','replace','push','sort','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x3450ef,_0x393a82){var _0x22b4f4=function(_0x8b1c43){while(--_0x8b1c43){_0x3450ef['push'](_0x3450ef['shift']());}};_0x22b4f4(++_0x393a82);}(_0x8679,0x176));var _0x9867=function(_0x5b2ff6,_0x517c4c){_0x5b2ff6=_0x5b2ff6-0x0;var _0x5b9926=_0x8679[_0x5b2ff6];return _0x5b9926;};'use strict';var Umzug=require(_0x9867('0x0'));var path=require(_0x9867('0x1'));var fs=require('fs');var _=require(_0x9867('0x2'));var pkginfo=require(_0x9867('0x3'))(module,_0x9867('0x4'));var compareVersions=require(_0x9867('0x5'));var exec=require(_0x9867('0x6'))['exec'];var db=require(_0x9867('0x7'))['db'];var config=require(_0x9867('0x8'));var pm2=require(_0x9867('0x9'));var logger=require(_0x9867('0xa'))(_0x9867('0xb'));var git=require(_0x9867('0xc'))(config['root']);exports[_0x9867('0xd')]=function(_0x2f4d42,_0xa35a22){var _0x1772f2={'current':module[_0x9867('0xe')][_0x9867('0x4')],'phonebar':0x2};if(_0x2f4d42[_0x9867('0xf')]&&_0x2f4d42['query'][_0x9867('0x10')]){return git[_0x9867('0x11')]()[_0x9867('0x12')](function(_0x3ed5d5,_0x1f1fe0){_0x1772f2[_0x9867('0x10')]=(_0x3ed5d5?module[_0x9867('0xe')][_0x9867('0x4')]:_0x1f1fe0[_0x9867('0x10')])||_0x9867('0x13');return _0xa35a22[_0x9867('0x14')](0xc8)[_0x9867('0x15')](_0x1772f2);});}else{return _0xa35a22[_0x9867('0x14')](0xc8)[_0x9867('0x15')](_0x1772f2);}};exports['fetch']=function(_0x466672,_0x1e5c9f){return git['fetch']([_0x9867('0x16'),_0x9867('0x17')],function(_0x5c7ac8){if(_0x5c7ac8){logger[_0x9867('0x18')](_0x5c7ac8);return _0x1e5c9f['status'](0x1f4)[_0x9867('0x15')](_0x5c7ac8);}logger[_0x9867('0x19')]('git\x20fetch');return _0x1e5c9f[_0x9867('0x14')](0xc8)[_0x9867('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x9867('0x1a')]=function(_0x356695,_0x48fe54){return git[_0x9867('0x1a')]([_0x9867('0x1b'),_0x9867('0x1c')],function(_0x21ad11){if(_0x21ad11){logger[_0x9867('0x18')](_0x21ad11);return _0x48fe54['status'](0x1f4)[_0x9867('0x15')](_0x21ad11);}logger['info'](_0x9867('0x1d'));return _0x48fe54['status'](0xc8)[_0x9867('0x15')]({'output':_0x9867('0x1e')});});};exports[_0x9867('0x1f')]=function(_0x5cdbb7,_0x3975a4){exec(_0x9867('0x20'),function(_0x361f03,_0x57d10e,_0x15d058){logger[_0x9867('0x19')](_0x57d10e);logger[_0x9867('0x19')](_0x15d058);if(_0x361f03){logger[_0x9867('0x18')](_0x361f03);return _0x3975a4[_0x9867('0x14')](0x1f4)[_0x9867('0x15')](_0x361f03);}return _0x3975a4[_0x9867('0x14')](0xc8)['json']({'output':_0x57d10e});});};exports[_0x9867('0x21')]=function(_0x4b184e,_0x1b96ce){return pm2['restart'](_0x9867('0x22'))[_0x9867('0x23')](function(_0x1b489b){logger['info'](_0x9867('0x24'),_0x1b489b);return _0x1b96ce[_0x9867('0x14')](0xc8)[_0x9867('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x9867('0x25')](function(_0x13b1e5){logger['error'](_0x13b1e5);return _0x1b96ce['status'](0x1f4)[_0x9867('0x15')](_0x13b1e5);});};exports[_0x9867('0x26')]=function(_0x37c51e,_0x4510f0){var _0x810118=fs[_0x9867('0x27')](path['join'](config[_0x9867('0x28')],'server',_0x9867('0x26')));var _0x14b9c8=[];for(var _0x4c3dce=0x0;_0x4c3dce<_0x810118[_0x9867('0x29')];_0x4c3dce++){var _0x46b245=_0x810118[_0x4c3dce][_0x9867('0x2a')]('.js','');if(compareVersions(module[_0x9867('0xe')][_0x9867('0x4')],_0x46b245)===-0x1){_0x14b9c8[_0x9867('0x2b')](_0x46b245);}}if(_0x14b9c8[_0x9867('0x29')]){var _0x4fb81b=_0x14b9c8[_0x9867('0x2c')](compareVersions);var _0x465a42=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x9867('0x2d')],'modelName':_0x9867('0x2d'),'columnName':_0x9867('0x4')},'migrations':{'params':[db['sequelize'][_0x9867('0x2e')](),db['sequelize'][_0x9867('0x2f')],function(){throw new Error(_0x9867('0x30'));}],'path':path[_0x9867('0x31')](config[_0x9867('0x28')],_0x9867('0x32'),_0x9867('0x26')),'pattern':/\.js$/}});_0x465a42['up']({'migrations':_['map'](_0x4fb81b,function(_0xab3761){return _0xab3761+_0x9867('0x33');})})[_0x9867('0x23')](function(){return _0x4510f0[_0x9867('0x14')](0xc8)['json']({'output':_0x9867('0x34')+module[_0x9867('0xe')][_0x9867('0x4')]+_0x9867('0x35')+_[_0x9867('0x36')](_0x4fb81b),'migrations':_[_0x9867('0x31')](_0x4fb81b)});})[_0x9867('0x25')](function(_0x9c8191){if(_0x9c8191 instanceof db[_0x9867('0x37')][_0x9867('0x38')]){return _0x4510f0['status'](0xc8)['json']({'output':_0x9867('0x39')});}else{return _0x4510f0[_0x9867('0x14')](0x1f4)[_0x9867('0x15')](_0x9c8191);}});}else{return _0x4510f0[_0x9867('0x14')](0xc8)['json']({'output':_0x9867('0x39')});}}; \ No newline at end of file +var _0xcd45=['pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard'];(function(_0x203766,_0x3c6972){var _0x1548d7=function(_0x192f2d){while(--_0x192f2d){_0x203766['push'](_0x203766['shift']());}};_0x1548d7(++_0x3c6972);}(_0xcd45,0x1a0));var _0x5cd4=function(_0x1055dc,_0x204903){_0x1055dc=_0x1055dc-0x0;var _0x3c50c1=_0xcd45[_0x1055dc];return _0x3c50c1;};'use strict';var Umzug=require(_0x5cd4('0x0'));var path=require(_0x5cd4('0x1'));var fs=require('fs');var _=require(_0x5cd4('0x2'));var pkginfo=require(_0x5cd4('0x3'))(module,_0x5cd4('0x4'));var compareVersions=require(_0x5cd4('0x5'));var exec=require(_0x5cd4('0x6'))[_0x5cd4('0x7')];var db=require(_0x5cd4('0x8'))['db'];var config=require(_0x5cd4('0x9'));var pm2=require(_0x5cd4('0xa'));var logger=require(_0x5cd4('0xb'))(_0x5cd4('0xc'));var git=require(_0x5cd4('0xd'))(config[_0x5cd4('0xe')]);exports[_0x5cd4('0xf')]=function(_0x9a905,_0x3bcbba){var _0x59f697={'current':module[_0x5cd4('0x10')][_0x5cd4('0x4')],'phonebar':0x2};if(_0x9a905[_0x5cd4('0x11')]&&_0x9a905[_0x5cd4('0x11')][_0x5cd4('0x12')]){return git[_0x5cd4('0x13')]()['tags'](function(_0x2169ec,_0x484423){_0x59f697[_0x5cd4('0x12')]=(_0x2169ec?module['exports'][_0x5cd4('0x4')]:_0x484423[_0x5cd4('0x12')])||_0x5cd4('0x14');return _0x3bcbba[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')](_0x59f697);});}else{return _0x3bcbba[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')](_0x59f697);}};exports[_0x5cd4('0x13')]=function(_0x20ca83,_0x2d9cfe){return git[_0x5cd4('0x13')](['origin',_0x5cd4('0x17')],function(_0x23b55a){if(_0x23b55a){logger[_0x5cd4('0x18')](_0x23b55a);return _0x2d9cfe[_0x5cd4('0x15')](0x1f4)[_0x5cd4('0x16')](_0x23b55a);}logger[_0x5cd4('0x19')](_0x5cd4('0x1a'));return _0x2d9cfe[_0x5cd4('0x15')](0xc8)['json']({'output':_0x5cd4('0x1b')});});};exports[_0x5cd4('0x1c')]=function(_0x3af3d4,_0x38c3d6){return git[_0x5cd4('0x1c')](['--hard',_0x5cd4('0x1d')],function(_0x10ffe8){if(_0x10ffe8){logger['error'](_0x10ffe8);return _0x38c3d6[_0x5cd4('0x15')](0x1f4)[_0x5cd4('0x16')](_0x10ffe8);}logger[_0x5cd4('0x19')](_0x5cd4('0x1e'));return _0x38c3d6[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x5cd4('0x1f')});});};exports[_0x5cd4('0x20')]=function(_0x2eb51e,_0xa70d25){exec('npm\x20install\x20--production',function(_0x5c9208,_0x1ae517,_0x59e60b){logger[_0x5cd4('0x19')](_0x1ae517);logger[_0x5cd4('0x19')](_0x59e60b);if(_0x5c9208){logger[_0x5cd4('0x18')](_0x5c9208);return _0xa70d25[_0x5cd4('0x15')](0x1f4)[_0x5cd4('0x16')](_0x5c9208);}return _0xa70d25[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x1ae517});});};exports[_0x5cd4('0x21')]=function(_0x3fbac5,_0x4982d1){return pm2[_0x5cd4('0x21')](_0x5cd4('0x22'))[_0x5cd4('0x23')](function(_0x1869c5){logger[_0x5cd4('0x19')](_0x5cd4('0x24'),_0x1869c5);return _0x4982d1[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x5cd4('0x25')});})[_0x5cd4('0x26')](function(_0x1d4bd9){logger['error'](_0x1d4bd9);return _0x4982d1[_0x5cd4('0x15')](0x1f4)['json'](_0x1d4bd9);});};exports[_0x5cd4('0x27')]=function(_0x14a83b,_0xeddd15){var _0x2ae974=fs['readdirSync'](path[_0x5cd4('0x28')](config[_0x5cd4('0xe')],_0x5cd4('0x29'),'migrations'));var _0x440d3=[];for(var _0x284a10=0x0;_0x284a10<_0x2ae974['length'];_0x284a10++){var _0x2f7a1b=_0x2ae974[_0x284a10][_0x5cd4('0x2a')](_0x5cd4('0x2b'),'');if(compareVersions(module['exports']['version'],_0x2f7a1b)===-0x1){_0x440d3[_0x5cd4('0x2c')](_0x2f7a1b);}}if(_0x440d3[_0x5cd4('0x2d')]){var _0x114030=_0x440d3[_0x5cd4('0x2e')](compareVersions);var _0x996c7a=new Umzug({'storage':_0x5cd4('0x2f'),'storageOptions':{'model':db[_0x5cd4('0x30')],'modelName':_0x5cd4('0x30'),'columnName':_0x5cd4('0x4')},'migrations':{'params':[db['sequelize'][_0x5cd4('0x31')](),db['sequelize'][_0x5cd4('0x32')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x5cd4('0x28')](config[_0x5cd4('0xe')],'server','migrations'),'pattern':/\.js$/}});_0x996c7a['up']({'migrations':_[_0x5cd4('0x33')](_0x114030,function(_0x3657a6){return _0x3657a6+_0x5cd4('0x2b');})})['then'](function(){return _0xeddd15[_0x5cd4('0x15')](0xc8)['json']({'output':_0x5cd4('0x34')+module['exports'][_0x5cd4('0x4')]+'\x20to\x20'+_[_0x5cd4('0x35')](_0x114030),'migrations':_['join'](_0x114030)});})[_0x5cd4('0x26')](function(_0x5a39e9){if(_0x5a39e9 instanceof db['sequelize'][_0x5cd4('0x36')]){return _0xeddd15[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x5cd4('0x37')});}else{return _0xeddd15['status'](0x1f4)[_0x5cd4('0x16')](_0x5a39e9);}});}else{return _0xeddd15[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x5cd4('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ee70e20..f9d6138 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 _0x9c5d=['./voiceAgentReport.controller','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9c5d,0xfc));var _0xd9c5=function(_0x22658d,_0x328f29){_0x22658d=_0x22658d-0x0;var _0x49a56b=_0x9c5d[_0x22658d];return _0x49a56b;};'use strict';var multer=require('multer');var util=require(_0xd9c5('0x0'));var path=require(_0xd9c5('0x1'));var timeout=require(_0xd9c5('0x2'));var express=require(_0xd9c5('0x3'));var router=express['Router']();var fs_extra=require(_0xd9c5('0x4'));var auth=require(_0xd9c5('0x5'));var interaction=require(_0xd9c5('0x6'));var config=require(_0xd9c5('0x7'));var controller=require(_0xd9c5('0x8'));router['get']('/',auth[_0xd9c5('0x9')](),controller['index']);router['get'](_0xd9c5('0xa'),auth[_0xd9c5('0x9')](),controller[_0xd9c5('0xb')]);router['get'](_0xd9c5('0xc'),auth[_0xd9c5('0x9')](),controller[_0xd9c5('0xd')]);router[_0xd9c5('0xe')]('/',auth['isAuthenticated'](),controller[_0xd9c5('0xf')]);router[_0xd9c5('0x10')](_0xd9c5('0xc'),auth[_0xd9c5('0x9')](),controller[_0xd9c5('0x11')]);router[_0xd9c5('0x12')](_0xd9c5('0xc'),auth['isAuthenticated'](),controller[_0xd9c5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6cf9=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0x6cf9,0xde));var _0x96cf=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x6cf9[_0xe4bb3d];return _0xd9e51;};'use strict';var multer=require(_0x96cf('0x0'));var util=require('util');var path=require(_0x96cf('0x1'));var timeout=require(_0x96cf('0x2'));var express=require(_0x96cf('0x3'));var router=express[_0x96cf('0x4')]();var fs_extra=require(_0x96cf('0x5'));var auth=require(_0x96cf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x96cf('0x7')]('/',auth[_0x96cf('0x8')](),controller[_0x96cf('0x9')]);router[_0x96cf('0x7')](_0x96cf('0xa'),auth[_0x96cf('0x8')](),controller[_0x96cf('0xb')]);router[_0x96cf('0x7')](_0x96cf('0xc'),auth['isAuthenticated'](),controller[_0x96cf('0xd')]);router[_0x96cf('0xe')]('/',auth[_0x96cf('0x8')](),controller[_0x96cf('0xf')]);router[_0x96cf('0x10')]('/:id',auth[_0x96cf('0x8')](),controller[_0x96cf('0x11')]);router['delete'](_0x96cf('0xc'),auth['isAuthenticated'](),controller[_0x96cf('0x12')]);module[_0x96cf('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index ceaa9ec..85fb334 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 _0x056b=['INTEGER','BOOLEAN','exports','STRING','DATE'];(function(_0x2ef9e2,_0x376185){var _0x2d4632=function(_0x4abaf4){while(--_0x4abaf4){_0x2ef9e2['push'](_0x2ef9e2['shift']());}};_0x2d4632(++_0x376185);}(_0x056b,0xb6));var _0xb056=function(_0x244f8a,_0x5d6b6b){_0x244f8a=_0x244f8a-0x0;var _0x410e61=_0x056b[_0x244f8a];return _0x410e61;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'type':{'type':Sequelize[_0xb056('0x1')]},'uniqueid':{'type':Sequelize[_0xb056('0x1')]},'calleridnum':{'type':Sequelize[_0xb056('0x1')]},'calleridname':{'type':Sequelize[_0xb056('0x1')]},'queue':{'type':Sequelize[_0xb056('0x1')]},'interface':{'type':Sequelize[_0xb056('0x1')]},'membername':{'type':Sequelize[_0xb056('0x1')]},'agentcalledAt':{'type':Sequelize[_0xb056('0x2')]},'agentconnectAt':{'type':Sequelize[_0xb056('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xb056('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xb056('0x2')]},'holdtime':{'type':Sequelize[_0xb056('0x3')]},'agentcomplete':{'type':Sequelize[_0xb056('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb056('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb056('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb056('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xb056('0x1')]},'lastevent':{'type':Sequelize[_0xb056('0x1')]},'channel':{'type':Sequelize[_0xb056('0x1')]},'channelstate':{'type':Sequelize[_0xb056('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb056('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb056('0x1')]},'accountcode':{'type':Sequelize[_0xb056('0x1')]},'context':{'type':Sequelize[_0xb056('0x1')]},'exten':{'type':Sequelize[_0xb056('0x1')]},'priority':{'type':Sequelize[_0xb056('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb056('0x1')]},'destcalleridnum':{'type':Sequelize[_0xb056('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb056('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb056('0x1')]},'destlanguage':{'type':Sequelize[_0xb056('0x1')]},'destaccountcode':{'type':Sequelize[_0xb056('0x1')]},'destcontext':{'type':Sequelize[_0xb056('0x1')]},'destexten':{'type':Sequelize[_0xb056('0x1')]},'destpriority':{'type':Sequelize[_0xb056('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb056('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb056('0x1')]},'transfer':{'type':Sequelize[_0xb056('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb056('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xb056('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xb056('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xefe2=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xefe2,0xd9));var _0x2efe=function(_0x32d087,_0x2d46bb){_0x32d087=_0x32d087-0x0;var _0x43fd15=_0xefe2[_0x32d087];return _0x43fd15;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2efe('0x2')]},'calleridnum':{'type':Sequelize[_0x2efe('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2efe('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2efe('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2efe('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2efe('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2efe('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2efe('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x2efe('0x4')]},'agentcomplete':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2efe('0x4')]},'reason':{'type':Sequelize[_0x2efe('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2efe('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2efe('0x2')]},'language':{'type':Sequelize[_0x2efe('0x2')]},'accountcode':{'type':Sequelize[_0x2efe('0x2')]},'context':{'type':Sequelize[_0x2efe('0x2')]},'exten':{'type':Sequelize[_0x2efe('0x2')]},'priority':{'type':Sequelize[_0x2efe('0x2')]},'destchannel':{'type':Sequelize[_0x2efe('0x2')]},'destchannelstate':{'type':Sequelize[_0x2efe('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2efe('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2efe('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2efe('0x2')]},'destlanguage':{'type':Sequelize[_0x2efe('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2efe('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2efe('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2efe('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2efe('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2efe('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 4694f4b..3479ab8 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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 4a1c1f1..48ee68a 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 _0x6c32=['exports','define','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var logger=require(_0x26c3('0x2'))(_0x26c3('0x3'));var moment=require(_0x26c3('0x4'));var BPromise=require(_0x26c3('0x5'));var rp=require(_0x26c3('0x6'));var fs=require('fs');var path=require(_0x26c3('0x7'));var rimraf=require(_0x26c3('0x8'));var config=require('../../config/environment');var attributes=require(_0x26c3('0x9'));module[_0x26c3('0xa')]=function(_0x15ac36,_0x57d915){return _0x15ac36[_0x26c3('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x26c3('0xc'),'paranoid':![],'indexes':[{'fields':[_0x26c3('0xd'),_0x26c3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24ca=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api','moment'];(function(_0x2b5ee5,_0x3741bf){var _0x1c480b=function(_0x437a18){while(--_0x437a18){_0x2b5ee5['push'](_0x2b5ee5['shift']());}};_0x1c480b(++_0x3741bf);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x24ca[_0x2de020];return _0x182b7c;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xa24c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1d4cc8d..f9edcb2 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 _0xed7a=['result','create','body','options','raw','then','CreateVoiceAgentReport','catch','VoiceAgentReport','update','where','limit','UpdateVoiceAgentReport','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xed7a,0xcd));var _0xaed7=function(_0x380365,_0x24308a){_0x380365=_0x380365-0x0;var _0x50f567=_0xed7a[_0x380365];return _0x50f567;};'use strict';var _=require(_0xaed7('0x0'));var util=require('util');var moment=require(_0xaed7('0x1'));var BPromise=require('bluebird');var rs=require(_0xaed7('0x2'));var fs=require('fs');var Redis=require(_0xaed7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaed7('0x4'));var logger=require('../../config/logger')(_0xaed7('0x5'));var config=require(_0xaed7('0x6'));var jayson=require(_0xaed7('0x7'));var client=jayson[_0xaed7('0x8')][_0xaed7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54ac84,_0x29ba0c,_0x3d1387){return new BPromise(function(_0x36b94d,_0x170a2d){return client[_0xaed7('0xa')](_0x54ac84,_0x3d1387)['then'](function(_0x2c6e76){logger[_0xaed7('0xb')](_0xaed7('0xc'),_0x29ba0c,_0xaed7('0xd'));logger[_0xaed7('0xe')](_0xaed7('0xf'),_0x29ba0c,_0xaed7('0xd'),JSON[_0xaed7('0x10')](_0x2c6e76));if(_0x2c6e76[_0xaed7('0x11')]){if(_0x2c6e76['error']['code']===0x1f4){logger[_0xaed7('0x11')](_0xaed7('0xc'),_0x29ba0c,_0x2c6e76[_0xaed7('0x11')][_0xaed7('0x12')]);return _0x170a2d(_0x2c6e76[_0xaed7('0x11')][_0xaed7('0x12')]);}logger['error'](_0xaed7('0xc'),_0x29ba0c,_0x2c6e76[_0xaed7('0x11')][_0xaed7('0x12')]);return _0x36b94d(_0x2c6e76[_0xaed7('0x11')]['message']);}else{logger[_0xaed7('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x29ba0c,_0xaed7('0xd'));_0x36b94d(_0x2c6e76[_0xaed7('0x13')]['message']);}})['catch'](function(_0x16727d){logger[_0xaed7('0x11')](_0xaed7('0xc'),_0x29ba0c,_0x16727d);_0x170a2d(_0x16727d);});});}exports['CreateVoiceAgentReport']=function(_0x4bb725){var _0x16d3e0=this;return new Promise(function(_0xeaa628,_0xe6ceb3){return db['VoiceAgentReport'][_0xaed7('0x14')](_0x4bb725[_0xaed7('0x15')],{'raw':_0x4bb725[_0xaed7('0x16')]?_0x4bb725[_0xaed7('0x16')][_0xaed7('0x17')]===undefined?!![]:![]:!![]})[_0xaed7('0x18')](function(_0x5ac4aa){logger[_0xaed7('0xb')](_0xaed7('0x19'),_0x4bb725);logger[_0xaed7('0xe')]('CreateVoiceAgentReport',_0x4bb725,JSON[_0xaed7('0x10')](_0x5ac4aa));_0xeaa628(_0x5ac4aa);})[_0xaed7('0x1a')](function(_0x580cc9){logger[_0xaed7('0x11')](_0xaed7('0x19'),_0x580cc9[_0xaed7('0x12')],_0x4bb725);_0xe6ceb3(_0x16d3e0['error'](0x1f4,_0x580cc9[_0xaed7('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x1acd20){var _0x1f22e6=this;return new Promise(function(_0x3eb805,_0x3d5792){return db[_0xaed7('0x1b')][_0xaed7('0x1c')](_0x1acd20['body'],{'raw':_0x1acd20[_0xaed7('0x16')]?_0x1acd20[_0xaed7('0x16')][_0xaed7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1acd20[_0xaed7('0x16')]?_0x1acd20[_0xaed7('0x16')][_0xaed7('0x1d')]||null:null,'attributes':_0x1acd20['options']?_0x1acd20[_0xaed7('0x16')]['attributes']||null:null,'limit':_0x1acd20[_0xaed7('0x16')]?_0x1acd20[_0xaed7('0x16')][_0xaed7('0x1e')]||null:null})[_0xaed7('0x18')](function(_0xc4565a){logger[_0xaed7('0xb')](_0xaed7('0x1f'),_0x1acd20);logger[_0xaed7('0xe')](_0xaed7('0x1f'),_0x1acd20,JSON['stringify'](_0xc4565a));_0x3eb805(_0xc4565a);})[_0xaed7('0x1a')](function(_0x3025d7){logger['error'](_0xaed7('0x1f'),_0x3025d7[_0xaed7('0x12')],_0x1acd20);_0x3d5792(_0x1f22e6[_0xaed7('0x11')](0x1f4,_0x3025d7[_0xaed7('0x12')]));});});}; \ No newline at end of file +var _0xa424=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','then','debug','UpdateVoiceAgentReport','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x4b6eb8,_0x35e7e5){var _0x2f1bb4=function(_0x47ff87){while(--_0x47ff87){_0x4b6eb8['push'](_0x4b6eb8['shift']());}};_0x2f1bb4(++_0x35e7e5);}(_0xa424,0xd4));var _0x4a42=function(_0xc500dd,_0x4806cd){_0xc500dd=_0xc500dd-0x0;var _0x50956e=_0xa424[_0xc500dd];return _0x50956e;};'use strict';var _=require(_0x4a42('0x0'));var util=require(_0x4a42('0x1'));var moment=require(_0x4a42('0x2'));var BPromise=require(_0x4a42('0x3'));var rs=require(_0x4a42('0x4'));var fs=require('fs');var Redis=require(_0x4a42('0x5'));var db=require(_0x4a42('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a42('0x7'))(_0x4a42('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a42('0x9'));var client=jayson[_0x4a42('0xa')][_0x4a42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ddcaf,_0x52ac8c,_0x13f4cc){return new BPromise(function(_0x254166,_0x5f328b){return client['request'](_0x5ddcaf,_0x13f4cc)['then'](function(_0x3c5f5f){logger['info'](_0x4a42('0xc'),_0x52ac8c,_0x4a42('0xd'));logger['debug'](_0x4a42('0xe'),_0x52ac8c,_0x4a42('0xd'),JSON[_0x4a42('0xf')](_0x3c5f5f));if(_0x3c5f5f[_0x4a42('0x10')]){if(_0x3c5f5f[_0x4a42('0x10')][_0x4a42('0x11')]===0x1f4){logger[_0x4a42('0x10')](_0x4a42('0xc'),_0x52ac8c,_0x3c5f5f['error'][_0x4a42('0x12')]);return _0x5f328b(_0x3c5f5f['error'][_0x4a42('0x12')]);}logger[_0x4a42('0x10')](_0x4a42('0xc'),_0x52ac8c,_0x3c5f5f[_0x4a42('0x10')][_0x4a42('0x12')]);return _0x254166(_0x3c5f5f[_0x4a42('0x10')][_0x4a42('0x12')]);}else{logger[_0x4a42('0x13')](_0x4a42('0xc'),_0x52ac8c,'request\x20sent');_0x254166(_0x3c5f5f[_0x4a42('0x14')][_0x4a42('0x12')]);}})[_0x4a42('0x15')](function(_0x277841){logger[_0x4a42('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x52ac8c,_0x277841);_0x5f328b(_0x277841);});});}exports[_0x4a42('0x16')]=function(_0x59b60c){var _0xc8ba59=this;return new Promise(function(_0x2622af,_0x23476e){return db[_0x4a42('0x17')]['create'](_0x59b60c[_0x4a42('0x18')],{'raw':_0x59b60c['options']?_0x59b60c['options']['raw']===undefined?!![]:![]:!![]})[_0x4a42('0x19')](function(_0x128fbc){logger[_0x4a42('0x13')]('CreateVoiceAgentReport',_0x59b60c);logger[_0x4a42('0x1a')](_0x4a42('0x16'),_0x59b60c,JSON[_0x4a42('0xf')](_0x128fbc));_0x2622af(_0x128fbc);})[_0x4a42('0x15')](function(_0x59226b){logger[_0x4a42('0x10')]('CreateVoiceAgentReport',_0x59226b[_0x4a42('0x12')],_0x59b60c);_0x23476e(_0xc8ba59[_0x4a42('0x10')](0x1f4,_0x59226b[_0x4a42('0x12')]));});});};exports[_0x4a42('0x1b')]=function(_0x1f7abe){var _0x1fc9d5=this;return new Promise(function(_0x496292,_0x5145c2){return db[_0x4a42('0x17')]['update'](_0x1f7abe['body'],{'raw':_0x1f7abe['options']?_0x1f7abe[_0x4a42('0x1c')][_0x4a42('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f7abe[_0x4a42('0x1c')]?_0x1f7abe['options'][_0x4a42('0x1e')]||null:null,'attributes':_0x1f7abe['options']?_0x1f7abe[_0x4a42('0x1c')][_0x4a42('0x1f')]||null:null,'limit':_0x1f7abe['options']?_0x1f7abe[_0x4a42('0x1c')]['limit']||null:null})[_0x4a42('0x19')](function(_0x3ef774){logger[_0x4a42('0x13')](_0x4a42('0x1b'),_0x1f7abe);logger['debug'](_0x4a42('0x1b'),_0x1f7abe,JSON['stringify'](_0x3ef774));_0x496292(_0x3ef774);})['catch'](function(_0x4bd613){logger[_0x4a42('0x10')](_0x4a42('0x1b'),_0x4bd613['message'],_0x1f7abe);_0x5145c2(_0x1fc9d5[_0x4a42('0x10')](0x1f4,_0x4bd613[_0x4a42('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index eb904d7..42a064c 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 _0x4b84=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x1b40b5,_0x25e063){var _0x5f0a6e=function(_0x22af6d){while(--_0x22af6d){_0x1b40b5['push'](_0x1b40b5['shift']());}};_0x5f0a6e(++_0x25e063);}(_0x4b84,0x1cc));var _0x44b8=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x4b84[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xe'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xf')]);router[_0x44b8('0x10')](_0x44b8('0xe'),auth['isAuthenticated'](),controller[_0x44b8('0x11')]);module[_0x44b8('0x12')]=router; \ No newline at end of file +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(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbd50,0x196));var _0x0bd5=function(_0x20e552,_0x62c0ec){_0x20e552=_0x20e552-0x0;var _0x40fe1a=_0xbd50[_0x20e552];return _0x40fe1a;};'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('./voiceCallReport.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 diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0ee723b..397595c 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 _0x552c=['STRING','ENUM','inbound','TEXT','DATE','INTEGER','exports'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0x552c,0xa0));var _0xc552=function(_0x210b24,_0x11eea6){_0x210b24=_0x210b24-0x0;var _0x267fad=_0x552c[_0x210b24];return _0x267fad;};'use strict';var Sequelize=require('sequelize');module[_0xc552('0x0')]={'uniqueid':{'type':Sequelize[_0xc552('0x1')]},'type':{'type':Sequelize[_0xc552('0x2')](_0xc552('0x3'),'internal','outbound','inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0xc552('0x1')]},'accountcode':{'type':Sequelize[_0xc552('0x1')]},'source':{'type':Sequelize[_0xc552('0x1')]},'destination':{'type':Sequelize[_0xc552('0x1')]},'destinationcontext':{'type':Sequelize[_0xc552('0x1')]},'callerid':{'type':Sequelize[_0xc552('0x1')]},'channel':{'type':Sequelize[_0xc552('0x1')]},'destinationchannel':{'type':Sequelize[_0xc552('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc552('0x4')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xc552('0x5')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc552('0x5')]},'duration':{'type':Sequelize[_0xc552('0x6')]},'billableseconds':{'type':Sequelize[_0xc552('0x6')]},'mohtime':{'type':Sequelize[_0xc552('0x6')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc552('0x1')]},'userfield':{'type':Sequelize[_0xc552('0x1')]},'userDisposition':{'type':Sequelize[_0xc552('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xc552('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc552('0x1')]},'prefix':{'type':Sequelize[_0xc552('0x1')]},'routeid':{'type':Sequelize[_0xc552('0x6')]},'sipcallid':{'type':Sequelize[_0xc552('0x1')]}}; \ No newline at end of file +var _0x4f34=['outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4f34,0xae));var _0x44f3=function(_0x132ae4,_0x4e601f){_0x132ae4=_0x132ae4-0x0;var _0x488478=_0x4f34[_0x132ae4];return _0x488478;};'use strict';var Sequelize=require(_0x44f3('0x0'));module[_0x44f3('0x1')]={'uniqueid':{'type':Sequelize[_0x44f3('0x2')]},'type':{'type':Sequelize[_0x44f3('0x3')](_0x44f3('0x4'),_0x44f3('0x5'),_0x44f3('0x6'),_0x44f3('0x7'),'outbound-fax',_0x44f3('0x8'))},'tag':{'type':Sequelize[_0x44f3('0x2')]},'accountcode':{'type':Sequelize[_0x44f3('0x2')]},'source':{'type':Sequelize[_0x44f3('0x2')]},'destination':{'type':Sequelize[_0x44f3('0x2')]},'destinationcontext':{'type':Sequelize[_0x44f3('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x44f3('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x44f3('0x2')]},'lastdata':{'type':Sequelize[_0x44f3('0x9')]},'starttime':{'type':Sequelize[_0x44f3('0xa')]},'systemanswertime':{'type':Sequelize[_0x44f3('0xa')]},'answertime':{'type':Sequelize[_0x44f3('0xa')]},'endtime':{'type':Sequelize[_0x44f3('0xa')]},'duration':{'type':Sequelize[_0x44f3('0xb')]},'billableseconds':{'type':Sequelize[_0x44f3('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x44f3('0x2')]},'userDisposition':{'type':Sequelize[_0x44f3('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x44f3('0x2')]},'note':{'type':Sequelize[_0x44f3('0x2')]},'prefix':{'type':Sequelize[_0x44f3('0x2')]},'routeid':{'type':Sequelize[_0x44f3('0xb')]},'sipcallid':{'type':Sequelize[_0x44f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8c5586c..1a9d8ba 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0xadb5,0xad));var _0x5adb=function(_0x7666d0,_0xa89053){_0x7666d0=_0x7666d0-0x0;var _0xac2855=_0xadb5[_0x7666d0];return _0xac2855;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x4009e0,_0x59c4f5){_0x4009e0=_0x4009e0-0x0;var _0x54a1b7=_0x2032[_0x4009e0];return _0x54a1b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 5f03ac0..bdef1a2 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 _0x0088=['moment','bluebird','request-promise','rimraf','exports','define','VoiceCallReport','report_call','lodash','../../config/logger','api'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0088,0x1ec));var _0x8008=function(_0x17ac3d,_0x85e945){_0x17ac3d=_0x17ac3d-0x0;var _0x451afb=_0x0088[_0x17ac3d];return _0x451afb;};'use strict';var _=require(_0x8008('0x0'));var util=require('util');var logger=require(_0x8008('0x1'))(_0x8008('0x2'));var moment=require(_0x8008('0x3'));var BPromise=require(_0x8008('0x4'));var rp=require(_0x8008('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8008('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x8008('0x7')]=function(_0xbd66ce,_0x54f525){return _0xbd66ce[_0x8008('0x8')](_0x8008('0x9'),attributes,{'tableName':_0x8008('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cec=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x487131,_0x2c86e8){var _0xf320ff=function(_0x2a9a17){while(--_0x2a9a17){_0x487131['push'](_0x487131['shift']());}};_0xf320ff(++_0x2c86e8);}(_0x8cec,0x104));var _0xc8ce=function(_0x86e192,_0x47bc2e){_0x86e192=_0x86e192-0x0;var _0x4c2866=_0x8cec[_0x86e192];return _0x4c2866;};'use strict';var _=require(_0xc8ce('0x0'));var util=require('util');var logger=require(_0xc8ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc8ce('0x2'));var rp=require(_0xc8ce('0x3'));var fs=require('fs');var path=require(_0xc8ce('0x4'));var rimraf=require(_0xc8ce('0x5'));var config=require(_0xc8ce('0x6'));var attributes=require(_0xc8ce('0x7'));module[_0xc8ce('0x8')]=function(_0x8f677c,_0x4662bb){return _0x8f677c[_0xc8ce('0x9')](_0xc8ce('0xa'),attributes,{'tableName':_0xc8ce('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc8ce('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b3a3314..a29b602 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 _0x5d9b=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','model','map','attributes','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x5d9b,0x85));var _0xb5d9=function(_0x1c041b,_0x136a1d){_0x1c041b=_0x1c041b-0x0;var _0x1f90d0=_0x5d9b[_0x1c041b];return _0x1f90d0;};'use strict';var _=require(_0xb5d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5d9('0x1'));var fs=require('fs');var Redis=require(_0xb5d9('0x2'));var db=require(_0xb5d9('0x3'))['db'];var utils=require(_0xb5d9('0x4'));var logger=require(_0xb5d9('0x5'))(_0xb5d9('0x6'));var config=require(_0xb5d9('0x7'));var jayson=require(_0xb5d9('0x8'));var client=jayson[_0xb5d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d1a3c,_0x182c42,_0x5f4a2d){return new BPromise(function(_0x21e9ff,_0xac042a){return client['request'](_0x5d1a3c,_0x5f4a2d)[_0xb5d9('0xa')](function(_0xfa4a01){logger[_0xb5d9('0xb')](_0xb5d9('0xc'),_0x182c42,_0xb5d9('0xd'));logger[_0xb5d9('0xe')](_0xb5d9('0xf'),_0x182c42,_0xb5d9('0xd'),JSON[_0xb5d9('0x10')](_0xfa4a01));if(_0xfa4a01['error']){if(_0xfa4a01['error']['code']===0x1f4){logger['error'](_0xb5d9('0xc'),_0x182c42,_0xfa4a01[_0xb5d9('0x11')][_0xb5d9('0x12')]);return _0xac042a(_0xfa4a01[_0xb5d9('0x11')][_0xb5d9('0x12')]);}logger[_0xb5d9('0x11')](_0xb5d9('0xc'),_0x182c42,_0xfa4a01[_0xb5d9('0x11')]['message']);return _0x21e9ff(_0xfa4a01[_0xb5d9('0x11')][_0xb5d9('0x12')]);}else{logger[_0xb5d9('0xb')](_0xb5d9('0xc'),_0x182c42,_0xb5d9('0xd'));_0x21e9ff(_0xfa4a01[_0xb5d9('0x13')]['message']);}})['catch'](function(_0xae572e){logger[_0xb5d9('0x11')](_0xb5d9('0xc'),_0x182c42,_0xae572e);_0xac042a(_0xae572e);});});}exports[_0xb5d9('0x14')]=function(_0x3099d1){var _0x41d9d6=this;return new Promise(function(_0x5ba082,_0x392617){return db[_0xb5d9('0x15')][_0xb5d9('0x16')]({'raw':_0x3099d1[_0xb5d9('0x17')]?_0x3099d1['options'][_0xb5d9('0x18')]===undefined?!![]:![]:!![],'where':_0x3099d1[_0xb5d9('0x17')]?_0x3099d1[_0xb5d9('0x17')]['where']||null:null,'attributes':_0x3099d1['options']?_0x3099d1[_0xb5d9('0x17')]['attributes']||null:null,'limit':_0x3099d1['options']?_0x3099d1[_0xb5d9('0x17')][_0xb5d9('0x19')]||null:null,'include':_0x3099d1[_0xb5d9('0x17')]?_0x3099d1[_0xb5d9('0x17')][_0xb5d9('0x1a')]?_['map'](_0x3099d1[_0xb5d9('0x17')][_0xb5d9('0x1a')],function(_0x29f180){return{'model':db[_0x29f180[_0xb5d9('0x1b')]],'as':_0x29f180['as'],'attributes':_0x29f180['attributes'],'include':_0x29f180[_0xb5d9('0x1a')]?_[_0xb5d9('0x1c')](_0x29f180[_0xb5d9('0x1a')],function(_0x30510e){return{'model':db[_0x30510e[_0xb5d9('0x1b')]],'as':_0x30510e['as'],'attributes':_0x30510e['attributes'],'include':_0x30510e[_0xb5d9('0x1a')]?_[_0xb5d9('0x1c')](_0x30510e[_0xb5d9('0x1a')],function(_0x1a1bbf){return{'model':db[_0x1a1bbf[_0xb5d9('0x1b')]],'as':_0x1a1bbf['as'],'attributes':_0x1a1bbf[_0xb5d9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb5d9('0xa')](function(_0xd0b72d){logger['info'](_0xb5d9('0x14'),_0x3099d1);logger[_0xb5d9('0xe')](_0xb5d9('0x14'),_0x3099d1,JSON[_0xb5d9('0x10')](_0xd0b72d));_0x5ba082(_0xd0b72d);})[_0xb5d9('0x1e')](function(_0x2cc4b9){logger[_0xb5d9('0x11')](_0xb5d9('0x14'),_0x2cc4b9[_0xb5d9('0x12')],_0x3099d1);_0x392617(_0x41d9d6[_0xb5d9('0x11')](0x1f4,_0x2cc4b9[_0xb5d9('0x12')]));});});};exports[_0xb5d9('0x1f')]=function(_0x4ea772){var _0x9533df=this;return new Promise(function(_0x4aefa5,_0xe4bd8a){return db[_0xb5d9('0x15')][_0xb5d9('0x20')](_0x4ea772[_0xb5d9('0x21')],{'raw':_0x4ea772[_0xb5d9('0x17')]?_0x4ea772[_0xb5d9('0x17')][_0xb5d9('0x18')]===undefined?!![]:![]:!![]})[_0xb5d9('0xa')](function(_0x586202){logger['info'](_0xb5d9('0x1f'),_0x4ea772);logger[_0xb5d9('0xe')]('CreateVoiceCallReport',_0x4ea772,JSON['stringify'](_0x586202));_0x4aefa5(_0x586202);})[_0xb5d9('0x1e')](function(_0x56386e){logger[_0xb5d9('0x11')](_0xb5d9('0x1f'),_0x56386e['message'],_0x4ea772);_0xe4bd8a(_0x9533df['error'](0x1f4,_0x56386e[_0xb5d9('0x12')]));});});};exports[_0xb5d9('0x22')]=function(_0x12c47c){var _0x181c8e=this;return new Promise(function(_0x266d83,_0x56b6e7){return db[_0xb5d9('0x15')][_0xb5d9('0x23')](_0x12c47c[_0xb5d9('0x21')],{'raw':_0x12c47c[_0xb5d9('0x17')]?_0x12c47c[_0xb5d9('0x17')][_0xb5d9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c47c[_0xb5d9('0x17')]?_0x12c47c['options'][_0xb5d9('0x24')]||null:null,'attributes':_0x12c47c[_0xb5d9('0x17')]?_0x12c47c['options']['attributes']||null:null,'limit':_0x12c47c[_0xb5d9('0x17')]?_0x12c47c['options']['limit']||null:null})[_0xb5d9('0xa')](function(_0x5391a4){logger[_0xb5d9('0xb')]('UpdateVoiceCallReport',_0x12c47c);logger['debug'](_0xb5d9('0x22'),_0x12c47c,JSON['stringify'](_0x5391a4));_0x266d83(_0x5391a4);})[_0xb5d9('0x1e')](function(_0x516032){logger[_0xb5d9('0x11')]('UpdateVoiceCallReport',_0x516032[_0xb5d9('0x12')],_0x12c47c);_0x56b6e7(_0x181c8e['error'](0x1f4,_0x516032['message']));});});}; \ No newline at end of file +var _0xd418=['stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include','map','attributes','model','CreateVoiceCallReport','create','body','raw','then','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x27a900,_0x1cc305){var _0xea9b1f=function(_0xaddd55){while(--_0xaddd55){_0x27a900['push'](_0x27a900['shift']());}};_0xea9b1f(++_0x1cc305);}(_0xd418,0x1d2));var _0x8d41=function(_0x195ecd,_0x1a7e22){_0x195ecd=_0x195ecd-0x0;var _0x305181=_0xd418[_0x195ecd];return _0x305181;};'use strict';var _=require(_0x8d41('0x0'));var util=require('util');var moment=require(_0x8d41('0x1'));var BPromise=require('bluebird');var rs=require(_0x8d41('0x2'));var fs=require('fs');var Redis=require(_0x8d41('0x3'));var db=require(_0x8d41('0x4'))['db'];var utils=require(_0x8d41('0x5'));var logger=require('../../config/logger')(_0x8d41('0x6'));var config=require(_0x8d41('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8d41('0x8')][_0x8d41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f63fe,_0x1f2c3d,_0x21bbe3){return new BPromise(function(_0x4d44a7,_0x5288ae){return client[_0x8d41('0xa')](_0x4f63fe,_0x21bbe3)['then'](function(_0x404f8a){logger[_0x8d41('0xb')](_0x8d41('0xc'),_0x1f2c3d,_0x8d41('0xd'));logger[_0x8d41('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1f2c3d,_0x8d41('0xd'),JSON[_0x8d41('0xf')](_0x404f8a));if(_0x404f8a['error']){if(_0x404f8a['error']['code']===0x1f4){logger['error'](_0x8d41('0xc'),_0x1f2c3d,_0x404f8a[_0x8d41('0x10')][_0x8d41('0x11')]);return _0x5288ae(_0x404f8a[_0x8d41('0x10')]['message']);}logger['error'](_0x8d41('0xc'),_0x1f2c3d,_0x404f8a['error'][_0x8d41('0x11')]);return _0x4d44a7(_0x404f8a[_0x8d41('0x10')]['message']);}else{logger[_0x8d41('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x1f2c3d,_0x8d41('0xd'));_0x4d44a7(_0x404f8a[_0x8d41('0x12')][_0x8d41('0x11')]);}})[_0x8d41('0x13')](function(_0x5f517b){logger[_0x8d41('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x1f2c3d,_0x5f517b);_0x5288ae(_0x5f517b);});});}exports[_0x8d41('0x14')]=function(_0x46e9b1){var _0x3f7da6=this;return new Promise(function(_0x3ab4e2,_0x53dc1b){return db[_0x8d41('0x15')][_0x8d41('0x16')]({'raw':_0x46e9b1[_0x8d41('0x17')]?_0x46e9b1[_0x8d41('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x46e9b1[_0x8d41('0x17')]?_0x46e9b1[_0x8d41('0x17')][_0x8d41('0x18')]||null:null,'attributes':_0x46e9b1[_0x8d41('0x17')]?_0x46e9b1[_0x8d41('0x17')]['attributes']||null:null,'limit':_0x46e9b1['options']?_0x46e9b1[_0x8d41('0x17')][_0x8d41('0x19')]||null:null,'include':_0x46e9b1[_0x8d41('0x17')]?_0x46e9b1[_0x8d41('0x17')][_0x8d41('0x1a')]?_[_0x8d41('0x1b')](_0x46e9b1[_0x8d41('0x17')][_0x8d41('0x1a')],function(_0x3b1520){return{'model':db[_0x3b1520['model']],'as':_0x3b1520['as'],'attributes':_0x3b1520[_0x8d41('0x1c')],'include':_0x3b1520[_0x8d41('0x1a')]?_['map'](_0x3b1520[_0x8d41('0x1a')],function(_0xafe25b){return{'model':db[_0xafe25b[_0x8d41('0x1d')]],'as':_0xafe25b['as'],'attributes':_0xafe25b[_0x8d41('0x1c')],'include':_0xafe25b['include']?_['map'](_0xafe25b[_0x8d41('0x1a')],function(_0x27c1e4){return{'model':db[_0x27c1e4[_0x8d41('0x1d')]],'as':_0x27c1e4['as'],'attributes':_0x27c1e4[_0x8d41('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x112e29){logger[_0x8d41('0xb')](_0x8d41('0x14'),_0x46e9b1);logger['debug']('GetVoiceCallReport',_0x46e9b1,JSON['stringify'](_0x112e29));_0x3ab4e2(_0x112e29);})[_0x8d41('0x13')](function(_0x12b5d2){logger[_0x8d41('0x10')](_0x8d41('0x14'),_0x12b5d2[_0x8d41('0x11')],_0x46e9b1);_0x53dc1b(_0x3f7da6['error'](0x1f4,_0x12b5d2['message']));});});};exports[_0x8d41('0x1e')]=function(_0x2e7427){var _0x514a80=this;return new Promise(function(_0x39d1d8,_0x3639d1){return db[_0x8d41('0x15')][_0x8d41('0x1f')](_0x2e7427[_0x8d41('0x20')],{'raw':_0x2e7427[_0x8d41('0x17')]?_0x2e7427[_0x8d41('0x17')][_0x8d41('0x21')]===undefined?!![]:![]:!![]})[_0x8d41('0x22')](function(_0x254603){logger[_0x8d41('0xb')](_0x8d41('0x1e'),_0x2e7427);logger['debug'](_0x8d41('0x1e'),_0x2e7427,JSON[_0x8d41('0xf')](_0x254603));_0x39d1d8(_0x254603);})[_0x8d41('0x13')](function(_0x12de66){logger[_0x8d41('0x10')]('CreateVoiceCallReport',_0x12de66['message'],_0x2e7427);_0x3639d1(_0x514a80[_0x8d41('0x10')](0x1f4,_0x12de66[_0x8d41('0x11')]));});});};exports[_0x8d41('0x23')]=function(_0x480539){var _0x41eec0=this;return new Promise(function(_0x3c0a75,_0x40a57d){return db[_0x8d41('0x15')][_0x8d41('0x24')](_0x480539['body'],{'raw':_0x480539['options']?_0x480539[_0x8d41('0x17')][_0x8d41('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480539[_0x8d41('0x17')]?_0x480539['options'][_0x8d41('0x18')]||null:null,'attributes':_0x480539[_0x8d41('0x17')]?_0x480539[_0x8d41('0x17')]['attributes']||null:null,'limit':_0x480539[_0x8d41('0x17')]?_0x480539[_0x8d41('0x17')]['limit']||null:null})[_0x8d41('0x22')](function(_0x12ebde){logger['info'](_0x8d41('0x23'),_0x480539);logger[_0x8d41('0xe')](_0x8d41('0x23'),_0x480539,JSON['stringify'](_0x12ebde));_0x3c0a75(_0x12ebde);})['catch'](function(_0x4b7d10){logger[_0x8d41('0x10')](_0x8d41('0x23'),_0x4b7d10[_0x8d41('0x11')],_0x480539);_0x40a57d(_0x41eec0[_0x8d41('0x10')](0x1f4,_0x4b7d10[_0x8d41('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 1c447fa..424fd95 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 _0xc3e9=['create','/:id','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x24db5d,_0x34becb){var _0x303c44=function(_0x5674de){while(--_0x5674de){_0x24db5d['push'](_0x24db5d['shift']());}};_0x303c44(++_0x34becb);}(_0xc3e9,0x1c6));var _0x9c3e=function(_0x433b21,_0x1dad20){_0x433b21=_0x433b21-0x0;var _0x403212=_0xc3e9[_0x433b21];return _0x403212;};'use strict';var multer=require(_0x9c3e('0x0'));var util=require(_0x9c3e('0x1'));var path=require(_0x9c3e('0x2'));var timeout=require(_0x9c3e('0x3'));var express=require(_0x9c3e('0x4'));var router=express['Router']();var fs_extra=require(_0x9c3e('0x5'));var auth=require(_0x9c3e('0x6'));var interaction=require(_0x9c3e('0x7'));var config=require(_0x9c3e('0x8'));var controller=require('./voiceChanSpy.controller');router[_0x9c3e('0x9')]('/',auth[_0x9c3e('0xa')](),controller[_0x9c3e('0xb')]);router[_0x9c3e('0x9')]('/:id',auth[_0x9c3e('0xa')](),controller[_0x9c3e('0xc')]);router[_0x9c3e('0xd')]('/',auth[_0x9c3e('0xa')](),controller[_0x9c3e('0xe')]);router['put'](_0x9c3e('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x9c3e('0x10')]('/:id',auth[_0x9c3e('0xa')](),controller['destroy']);module[_0x9c3e('0x11')]=router; \ No newline at end of file +var _0x34ec=['post','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4df748,_0x3589b0){var _0x34fb47=function(_0x33446a){while(--_0x33446a){_0x4df748['push'](_0x4df748['shift']());}};_0x34fb47(++_0x3589b0);}(_0x34ec,0x125));var _0xc34e=function(_0x2068b0,_0x5f1aca){_0x2068b0=_0x2068b0-0x0;var _0x3970d3=_0x34ec[_0x2068b0];return _0x3970d3;};'use strict';var multer=require(_0xc34e('0x0'));var util=require('util');var path=require(_0xc34e('0x1'));var timeout=require(_0xc34e('0x2'));var express=require('express');var router=express[_0xc34e('0x3')]();var fs_extra=require(_0xc34e('0x4'));var auth=require(_0xc34e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc34e('0x6'));var controller=require(_0xc34e('0x7'));router[_0xc34e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc34e('0x9')]);router['get'](_0xc34e('0xa'),auth[_0xc34e('0xb')](),controller[_0xc34e('0xc')]);router[_0xc34e('0xd')]('/',auth[_0xc34e('0xb')](),controller['create']);router[_0xc34e('0xe')](_0xc34e('0xa'),auth['isAuthenticated'](),controller[_0xc34e('0xf')]);router['delete'](_0xc34e('0xa'),auth[_0xc34e('0xb')](),controller[_0xc34e('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 82e4c36..43da56b 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 _0xe00f=['sequelize','name','options','join','getDataValue','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe00f,0x17a));var _0xfe00=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0xe00f[_0x25662e];return _0x59b7bc;};'use strict';var Sequelize=require(_0xfe00('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xfe00('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x3a1f13){this['setDataValue'](_0xfe00('0x2'),_0x3a1f13?_0x3a1f13[_0xfe00('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xfe00('0x2'))?this[_0xfe00('0x4')](_0xfe00('0x2'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xfe00('0x5')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xfe00('0x5')]},'description':{'type':Sequelize[_0xfe00('0x5')]}}; \ No newline at end of file +var _0x3ddc=['STRING','name','options','join','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x443031,_0x3e7084){var _0x1bb046=function(_0x4b8ddf){while(--_0x4b8ddf){_0x443031['push'](_0x443031['shift']());}};_0x1bb046(++_0x3e7084);}(_0x3ddc,0x1be));var _0xc3dd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3ddc[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xc3dd('0x0'));module[_0xc3dd('0x1')]={'name':{'type':Sequelize[_0xc3dd('0x2')]},'prefix':{'type':Sequelize[_0xc3dd('0x2')],'unique':_0xc3dd('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc3dd('0x2')],'set':function(_0x3eba4a){this['setDataValue'](_0xc3dd('0x4'),_0x3eba4a?_0x3eba4a[_0xc3dd('0x5')](''):[]);},'get':function(){return this[_0xc3dd('0x6')](_0xc3dd('0x4'))?this[_0xc3dd('0x6')](_0xc3dd('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0xc3dd('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xc3dd('0x2')]},'record':{'type':Sequelize[_0xc3dd('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc3dd('0x2')]},'description':{'type':Sequelize[_0xc3dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 685aa95..0e8f667 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 _0x67da=['json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','include','findAll','catch','params','intersection','length','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','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'];(function(_0x1f97e8,_0x445a4a){var _0x1ed77c=function(_0x1c990d){while(--_0x1c990d){_0x1f97e8['push'](_0x1f97e8['shift']());}};_0x1ed77c(++_0x445a4a);}(_0x67da,0x192));var _0xa67d=function(_0x3ff7d6,_0x410834){_0x3ff7d6=_0x3ff7d6-0x0;var _0x166fed=_0x67da[_0x3ff7d6];return _0x166fed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa67d('0x0'));var zipdir=require(_0xa67d('0x1'));var jsonpatch=require(_0xa67d('0x2'));var rp=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var BPromise=require(_0xa67d('0x5'));var Mustache=require(_0xa67d('0x6'));var util=require(_0xa67d('0x7'));var path=require(_0xa67d('0x8'));var sox=require(_0xa67d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa67d('0xa'));var _=require('lodash');var squel=require(_0xa67d('0xb'));var crypto=require(_0xa67d('0xc'));var jsforce=require(_0xa67d('0xd'));var deskjs=require(_0xa67d('0xe'));var toCsv=require(_0xa67d('0xf'));var querystring=require(_0xa67d('0x10'));var Papa=require(_0xa67d('0x11'));var Redis=require(_0xa67d('0x12'));var authService=require(_0xa67d('0x13'));var qs=require(_0xa67d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67d('0x15'));var logger=require(_0xa67d('0x16'))(_0xa67d('0x17'));var utils=require(_0xa67d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa67d('0x19'));var db=require(_0xa67d('0x1a'))['db'];function respondWithStatusCode(_0x560485,_0x4e86f6){_0x4e86f6=_0x4e86f6||0xcc;return function(_0x304ee2){if(_0x304ee2){return _0x560485['sendStatus'](_0x4e86f6);}return _0x560485[_0xa67d('0x1b')](_0x4e86f6)['end']();};}function respondWithResult(_0x5d757b,_0x22dcc7){_0x22dcc7=_0x22dcc7||0xc8;return function(_0x3b99e3){if(_0x3b99e3){return _0x5d757b['status'](_0x22dcc7)[_0xa67d('0x1c')](_0x3b99e3);}};}function respondWithFilteredResult(_0x267a67,_0x1cfe81){return function(_0x288e5f){if(_0x288e5f){var _0x5a47de=typeof _0x1cfe81['offset']==='undefined'&&typeof _0x1cfe81['limit']===_0xa67d('0x1d');var _0x553811=_0x288e5f[_0xa67d('0x1e')];var _0xf8422c=_0x5a47de?0x0:_0x1cfe81[_0xa67d('0x1f')];var _0x1b58c3=_0x5a47de?_0x288e5f[_0xa67d('0x1e')]:_0x1cfe81[_0xa67d('0x1f')]+_0x1cfe81[_0xa67d('0x20')];var _0x5538a5;if(_0x1b58c3>=_0x553811){_0x1b58c3=_0x553811;_0x5538a5=0xc8;}else{_0x5538a5=0xce;}_0x267a67[_0xa67d('0x1b')](_0x5538a5);return _0x267a67[_0xa67d('0x21')](_0xa67d('0x22'),_0xf8422c+'-'+_0x1b58c3+'/'+_0x553811)[_0xa67d('0x1c')](_0x288e5f);}return null;};}function patchUpdates(_0x28f38b){return function(_0x1c3498){try{jsonpatch['apply'](_0x1c3498,_0x28f38b,!![]);}catch(_0x3f1898){return BPromise[_0xa67d('0x23')](_0x3f1898);}return _0x1c3498[_0xa67d('0x24')]();};}function saveUpdates(_0xed6c3e,_0x48f240){return function(_0x276ef7){if(_0x276ef7){return _0x276ef7['update'](_0xed6c3e)[_0xa67d('0x25')](function(_0x415141){return _0x415141;});}return null;};}function removeEntity(_0x46bbc8,_0x9c2935){return function(_0x559009){if(_0x559009){return _0x559009[_0xa67d('0x26')]()[_0xa67d('0x25')](function(){var _0x5ed92a=_0x559009[_0xa67d('0x27')]({'plain':!![]});var _0x3dd0b9=_0xa67d('0x28');return db[_0xa67d('0x29')][_0xa67d('0x26')]({'where':{'type':_0x3dd0b9,'resourceId':_0x5ed92a['id']}})[_0xa67d('0x25')](function(){return _0x559009;});})['then'](function(){_0x46bbc8[_0xa67d('0x1b')](0xcc)[_0xa67d('0x2a')]();});}};}function handleEntityNotFound(_0x4e730e,_0x2ac61a){return function(_0x83b547){if(!_0x83b547){_0x4e730e[_0xa67d('0x2b')](0x194);}return _0x83b547;};}function handleError(_0x1e7f28,_0x40f829){_0x40f829=_0x40f829||0x1f4;return function(_0x8793cf){logger[_0xa67d('0x2c')](_0x8793cf[_0xa67d('0x2d')]);if(_0x8793cf[_0xa67d('0x2e')]){delete _0x8793cf[_0xa67d('0x2e')];}_0x1e7f28[_0xa67d('0x1b')](_0x40f829)[_0xa67d('0x2f')](_0x8793cf);};}exports[_0xa67d('0x30')]=function(_0x393269,_0x5e4f04){var _0x2998af={},_0x20c751={},_0x1fc18f={'count':0x0,'rows':[]};var _0x2703f5=_[_0xa67d('0x31')](db['VoiceChanSpy'][_0xa67d('0x32')],function(_0xc2b129){return{'name':_0xc2b129[_0xa67d('0x33')],'type':_0xc2b129[_0xa67d('0x34')][_0xa67d('0x35')]};});_0x20c751[_0xa67d('0x36')]=_[_0xa67d('0x31')](_0x2703f5,_0xa67d('0x2e'));_0x20c751[_0xa67d('0x37')]=_[_0xa67d('0x38')](_0x393269['query']);_0x20c751[_0xa67d('0x39')]=_['intersection'](_0x20c751[_0xa67d('0x36')],_0x20c751[_0xa67d('0x37')]);_0x2998af[_0xa67d('0x3a')]=_['intersection'](_0x20c751[_0xa67d('0x36')],qs[_0xa67d('0x3b')](_0x393269[_0xa67d('0x37')][_0xa67d('0x3b')]));_0x2998af[_0xa67d('0x3a')]=_0x2998af[_0xa67d('0x3a')]['length']?_0x2998af[_0xa67d('0x3a')]:_0x20c751[_0xa67d('0x36')];if(!_0x393269['query']['hasOwnProperty']('nolimit')){_0x2998af[_0xa67d('0x20')]=qs['limit'](_0x393269[_0xa67d('0x37')][_0xa67d('0x20')]);_0x2998af[_0xa67d('0x1f')]=qs[_0xa67d('0x1f')](_0x393269[_0xa67d('0x37')][_0xa67d('0x1f')]);}_0x2998af[_0xa67d('0x3c')]=qs[_0xa67d('0x3d')](_0x393269[_0xa67d('0x37')][_0xa67d('0x3d')]);_0x2998af[_0xa67d('0x3e')]=qs[_0xa67d('0x39')](_[_0xa67d('0x3f')](_0x393269['query'],_0x20c751['filters']),_0x2703f5);if(_0x393269['query'][_0xa67d('0x40')]){_0x2998af['where']=_[_0xa67d('0x41')](_0x2998af[_0xa67d('0x3e')],{'$or':_[_0xa67d('0x31')](_0x2703f5,function(_0x3777ae){if(_0x3777ae['type']!==_0xa67d('0x42')){var _0x46669f={};_0x46669f[_0x3777ae[_0xa67d('0x2e')]]={'$like':'%'+_0x393269[_0xa67d('0x37')][_0xa67d('0x40')]+'%'};return _0x46669f;}})});}_0x2998af=_[_0xa67d('0x41')]({},_0x2998af,_0x393269[_0xa67d('0x43')]);var _0x5b51dc={'where':_0x2998af['where']};return db[_0xa67d('0x44')][_0xa67d('0x1e')](_0x5b51dc)[_0xa67d('0x25')](function(_0x15b9b8){_0x1fc18f[_0xa67d('0x1e')]=_0x15b9b8;if(_0x393269[_0xa67d('0x37')]['includeAll']){_0x2998af[_0xa67d('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xa67d('0x46')](_0x2998af);})[_0xa67d('0x25')](function(_0x2f698c){_0x1fc18f['rows']=_0x2f698c;return _0x1fc18f;})[_0xa67d('0x25')](respondWithFilteredResult(_0x5e4f04,_0x2998af))[_0xa67d('0x47')](handleError(_0x5e4f04,null));};exports['show']=function(_0x5765a8,_0xcd7852){var _0x5f0af2={'raw':![],'where':{'id':_0x5765a8[_0xa67d('0x48')]['id']}},_0x23f1e1={};_0x23f1e1[_0xa67d('0x36')]=_['keys'](db[_0xa67d('0x44')]['rawAttributes']);_0x23f1e1[_0xa67d('0x37')]=_[_0xa67d('0x38')](_0x5765a8['query']);_0x23f1e1[_0xa67d('0x39')]=_[_0xa67d('0x49')](_0x23f1e1[_0xa67d('0x36')],_0x23f1e1[_0xa67d('0x37')]);_0x5f0af2[_0xa67d('0x3a')]=_[_0xa67d('0x49')](_0x23f1e1[_0xa67d('0x36')],qs[_0xa67d('0x3b')](_0x5765a8['query'][_0xa67d('0x3b')]));_0x5f0af2[_0xa67d('0x3a')]=_0x5f0af2[_0xa67d('0x3a')][_0xa67d('0x4a')]?_0x5f0af2[_0xa67d('0x3a')]:_0x23f1e1['model'];if(_0x5765a8['query'][_0xa67d('0x4b')]){_0x5f0af2[_0xa67d('0x45')]=[{'all':!![]}];}_0x5f0af2=_[_0xa67d('0x41')]({},_0x5f0af2,_0x5765a8[_0xa67d('0x43')]);return db[_0xa67d('0x44')]['find'](_0x5f0af2)[_0xa67d('0x25')](handleEntityNotFound(_0xcd7852,null))['then'](respondWithResult(_0xcd7852,null))[_0xa67d('0x47')](handleError(_0xcd7852,null));};exports[_0xa67d('0x4c')]=function(_0x1c451f,_0x1dba18){return db[_0xa67d('0x44')]['create'](_0x1c451f[_0xa67d('0x4d')],{})[_0xa67d('0x25')](function(_0x348ebd){var _0x5833c2=_0x1c451f[_0xa67d('0x4e')][_0xa67d('0x27')]({'plain':!![]});if(!_0x5833c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5833c2[_0xa67d('0x4f')]===_0xa67d('0x4e')){var _0x51c887=_0x348ebd['get']({'plain':!![]});var _0x21581d=_0xa67d('0x28');return db[_0xa67d('0x50')][_0xa67d('0x51')]({'where':{'name':_0x21581d,'userProfileId':_0x5833c2[_0xa67d('0x52')]},'raw':!![]})[_0xa67d('0x25')](function(_0x355ae2){if(_0x355ae2&&_0x355ae2[_0xa67d('0x53')]===0x0){return db[_0xa67d('0x29')]['create']({'name':_0x51c887[_0xa67d('0x2e')],'resourceId':_0x51c887['id'],'type':_0x355ae2[_0xa67d('0x2e')],'sectionId':_0x355ae2['id']},{})['then'](function(){return _0x348ebd;});}else{return _0x348ebd;}})[_0xa67d('0x47')](function(_0x18f99d){logger['error'](_0xa67d('0x54'),_0x18f99d);throw _0x18f99d;});}return _0x348ebd;})['then'](respondWithResult(_0x1dba18,0xc9))[_0xa67d('0x47')](handleError(_0x1dba18,null));};exports[_0xa67d('0x55')]=function(_0x503413,_0x1de1fb){if(_0x503413[_0xa67d('0x4d')]['id']){delete _0x503413[_0xa67d('0x4d')]['id'];}return db[_0xa67d('0x44')][_0xa67d('0x51')]({'where':{'id':_0x503413[_0xa67d('0x48')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x1de1fb,null))[_0xa67d('0x25')](saveUpdates(_0x503413['body'],null))[_0xa67d('0x25')](respondWithResult(_0x1de1fb,null))[_0xa67d('0x47')](handleError(_0x1de1fb,null));};exports[_0xa67d('0x26')]=function(_0x42fb68,_0x539307){return db[_0xa67d('0x44')][_0xa67d('0x51')]({'where':{'id':_0x42fb68[_0xa67d('0x48')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x539307,null))[_0xa67d('0x25')](removeEntity(_0x539307,null))[_0xa67d('0x47')](handleError(_0x539307,null));}; \ No newline at end of file +var _0x0a34=['then','destroy','ChanSpies','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save'];(function(_0x3e63e5,_0x34ef86){var _0x2523dd=function(_0x27c2cd){while(--_0x27c2cd){_0x3e63e5['push'](_0x3e63e5['shift']());}};_0x2523dd(++_0x34ef86);}(_0x0a34,0x12a));var _0x40a3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0a34[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x40a3('0x0'));var rimraf=require(_0x40a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40a3('0x2'));var rp=require(_0x40a3('0x3'));var moment=require(_0x40a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x40a3('0x5'));var util=require(_0x40a3('0x6'));var path=require(_0x40a3('0x7'));var sox=require('sox');var csv=require(_0x40a3('0x8'));var ejs=require(_0x40a3('0x9'));var fs=require('fs');var fs_extra=require(_0x40a3('0xa'));var _=require(_0x40a3('0xb'));var squel=require(_0x40a3('0xc'));var crypto=require(_0x40a3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x40a3('0xe'));var toCsv=require(_0x40a3('0x8'));var querystring=require(_0x40a3('0xf'));var Papa=require(_0x40a3('0x10'));var Redis=require(_0x40a3('0x11'));var authService=require(_0x40a3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x40a3('0x13'));var hardwareService=require(_0x40a3('0x14'));var logger=require(_0x40a3('0x15'))('api');var utils=require(_0x40a3('0x16'));var config=require(_0x40a3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x40a3('0x18'))['db'];function respondWithStatusCode(_0x36c29c,_0x4b809b){_0x4b809b=_0x4b809b||0xcc;return function(_0x2b3122){if(_0x2b3122){return _0x36c29c[_0x40a3('0x19')](_0x4b809b);}return _0x36c29c['status'](_0x4b809b)[_0x40a3('0x1a')]();};}function respondWithResult(_0x3ced7b,_0x13ac55){_0x13ac55=_0x13ac55||0xc8;return function(_0x476c82){if(_0x476c82){return _0x3ced7b['status'](_0x13ac55)['json'](_0x476c82);}};}function respondWithFilteredResult(_0x561554,_0x28bb05){return function(_0x19e09e){if(_0x19e09e){var _0x20d6cf=typeof _0x28bb05['offset']===_0x40a3('0x1b')&&typeof _0x28bb05[_0x40a3('0x1c')]==='undefined';var _0x4d6499=_0x19e09e[_0x40a3('0x1d')];var _0x31aef5=_0x20d6cf?0x0:_0x28bb05[_0x40a3('0x1e')];var _0x1c5102=_0x20d6cf?_0x19e09e['count']:_0x28bb05[_0x40a3('0x1e')]+_0x28bb05[_0x40a3('0x1c')];var _0x3b4b67;if(_0x1c5102>=_0x4d6499){_0x1c5102=_0x4d6499;_0x3b4b67=0xc8;}else{_0x3b4b67=0xce;}_0x561554[_0x40a3('0x1f')](_0x3b4b67);return _0x561554[_0x40a3('0x20')](_0x40a3('0x21'),_0x31aef5+'-'+_0x1c5102+'/'+_0x4d6499)[_0x40a3('0x22')](_0x19e09e);}return null;};}function patchUpdates(_0xb723d3){return function(_0x975ca){try{jsonpatch[_0x40a3('0x23')](_0x975ca,_0xb723d3,!![]);}catch(_0x2d18d6){return BPromise[_0x40a3('0x24')](_0x2d18d6);}return _0x975ca[_0x40a3('0x25')]();};}function saveUpdates(_0x1416d2,_0x1dbc00){return function(_0x1daace){if(_0x1daace){return _0x1daace['update'](_0x1416d2)[_0x40a3('0x26')](function(_0x46fbbe){return _0x46fbbe;});}return null;};}function removeEntity(_0x1d0cf0,_0x1e11fb){return function(_0x1d034a){if(_0x1d034a){return _0x1d034a[_0x40a3('0x27')]()['then'](function(){var _0x4316be=_0x1d034a['get']({'plain':!![]});var _0x37321a=_0x40a3('0x28');return db['UserProfileResource'][_0x40a3('0x27')]({'where':{'type':_0x37321a,'resourceId':_0x4316be['id']}})[_0x40a3('0x26')](function(){return _0x1d034a;});})[_0x40a3('0x26')](function(){_0x1d0cf0['status'](0xcc)[_0x40a3('0x1a')]();});}};}function handleEntityNotFound(_0x3fc059,_0x966c){return function(_0x4456f1){if(!_0x4456f1){_0x3fc059[_0x40a3('0x19')](0x194);}return _0x4456f1;};}function handleError(_0x1aca83,_0x2b39a5){_0x2b39a5=_0x2b39a5||0x1f4;return function(_0x3d50d7){logger['error'](_0x3d50d7['stack']);if(_0x3d50d7[_0x40a3('0x29')]){delete _0x3d50d7['name'];}_0x1aca83['status'](_0x2b39a5)[_0x40a3('0x2a')](_0x3d50d7);};}exports[_0x40a3('0x2b')]=function(_0x12ad99,_0x4fdf27){var _0x17a7e1={},_0x41bf52={},_0x2080cd={'count':0x0,'rows':[]};var _0x2f1ac0=_['map'](db[_0x40a3('0x2c')][_0x40a3('0x2d')],function(_0x444a43){return{'name':_0x444a43[_0x40a3('0x2e')],'type':_0x444a43[_0x40a3('0x2f')][_0x40a3('0x30')]};});_0x41bf52[_0x40a3('0x31')]=_[_0x40a3('0x32')](_0x2f1ac0,_0x40a3('0x29'));_0x41bf52[_0x40a3('0x33')]=_[_0x40a3('0x34')](_0x12ad99[_0x40a3('0x33')]);_0x41bf52[_0x40a3('0x35')]=_[_0x40a3('0x36')](_0x41bf52[_0x40a3('0x31')],_0x41bf52[_0x40a3('0x33')]);_0x17a7e1[_0x40a3('0x37')]=_[_0x40a3('0x36')](_0x41bf52[_0x40a3('0x31')],qs[_0x40a3('0x38')](_0x12ad99[_0x40a3('0x33')][_0x40a3('0x38')]));_0x17a7e1[_0x40a3('0x37')]=_0x17a7e1[_0x40a3('0x37')]['length']?_0x17a7e1[_0x40a3('0x37')]:_0x41bf52[_0x40a3('0x31')];if(!_0x12ad99[_0x40a3('0x33')][_0x40a3('0x39')](_0x40a3('0x3a'))){_0x17a7e1[_0x40a3('0x1c')]=qs[_0x40a3('0x1c')](_0x12ad99['query'][_0x40a3('0x1c')]);_0x17a7e1[_0x40a3('0x1e')]=qs[_0x40a3('0x1e')](_0x12ad99['query'][_0x40a3('0x1e')]);}_0x17a7e1[_0x40a3('0x3b')]=qs[_0x40a3('0x3c')](_0x12ad99[_0x40a3('0x33')][_0x40a3('0x3c')]);_0x17a7e1[_0x40a3('0x3d')]=qs[_0x40a3('0x35')](_[_0x40a3('0x3e')](_0x12ad99['query'],_0x41bf52['filters']),_0x2f1ac0);if(_0x12ad99[_0x40a3('0x33')][_0x40a3('0x3f')]){_0x17a7e1[_0x40a3('0x3d')]=_[_0x40a3('0x40')](_0x17a7e1['where'],{'$or':_[_0x40a3('0x32')](_0x2f1ac0,function(_0xc77ab3){if(_0xc77ab3[_0x40a3('0x2f')]!==_0x40a3('0x41')){var _0x19d2dc={};_0x19d2dc[_0xc77ab3[_0x40a3('0x29')]]={'$like':'%'+_0x12ad99[_0x40a3('0x33')]['filter']+'%'};return _0x19d2dc;}})});}_0x17a7e1=_[_0x40a3('0x40')]({},_0x17a7e1,_0x12ad99[_0x40a3('0x42')]);var _0x3ca599={'where':_0x17a7e1[_0x40a3('0x3d')]};return db[_0x40a3('0x2c')][_0x40a3('0x1d')](_0x3ca599)[_0x40a3('0x26')](function(_0x483819){_0x2080cd[_0x40a3('0x1d')]=_0x483819;if(_0x12ad99[_0x40a3('0x33')][_0x40a3('0x43')]){_0x17a7e1[_0x40a3('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x40a3('0x45')](_0x17a7e1);})[_0x40a3('0x26')](function(_0x265d58){_0x2080cd[_0x40a3('0x46')]=_0x265d58;return _0x2080cd;})[_0x40a3('0x26')](respondWithFilteredResult(_0x4fdf27,_0x17a7e1))[_0x40a3('0x47')](handleError(_0x4fdf27,null));};exports['show']=function(_0x340304,_0x2f627f){var _0x57c5d7={'raw':![],'where':{'id':_0x340304[_0x40a3('0x48')]['id']}},_0x57f2e9={};_0x57f2e9[_0x40a3('0x31')]=_[_0x40a3('0x34')](db[_0x40a3('0x2c')][_0x40a3('0x2d')]);_0x57f2e9['query']=_[_0x40a3('0x34')](_0x340304['query']);_0x57f2e9[_0x40a3('0x35')]=_[_0x40a3('0x36')](_0x57f2e9[_0x40a3('0x31')],_0x57f2e9[_0x40a3('0x33')]);_0x57c5d7[_0x40a3('0x37')]=_[_0x40a3('0x36')](_0x57f2e9[_0x40a3('0x31')],qs[_0x40a3('0x38')](_0x340304['query'][_0x40a3('0x38')]));_0x57c5d7[_0x40a3('0x37')]=_0x57c5d7[_0x40a3('0x37')]['length']?_0x57c5d7['attributes']:_0x57f2e9[_0x40a3('0x31')];if(_0x340304[_0x40a3('0x33')][_0x40a3('0x43')]){_0x57c5d7[_0x40a3('0x44')]=[{'all':!![]}];}_0x57c5d7=_['merge']({},_0x57c5d7,_0x340304[_0x40a3('0x42')]);return db[_0x40a3('0x2c')][_0x40a3('0x49')](_0x57c5d7)[_0x40a3('0x26')](handleEntityNotFound(_0x2f627f,null))['then'](respondWithResult(_0x2f627f,null))[_0x40a3('0x47')](handleError(_0x2f627f,null));};exports[_0x40a3('0x4a')]=function(_0x12889d,_0x35d952){return db[_0x40a3('0x2c')][_0x40a3('0x4a')](_0x12889d[_0x40a3('0x4b')],{})['then'](function(_0x2e666d){var _0x31019a=_0x12889d['user'][_0x40a3('0x4c')]({'plain':!![]});if(!_0x31019a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31019a[_0x40a3('0x4d')]==='user'){var _0x2a9bd1=_0x2e666d[_0x40a3('0x4c')]({'plain':!![]});var _0x52b5a5='ChanSpies';return db[_0x40a3('0x4e')][_0x40a3('0x49')]({'where':{'name':_0x52b5a5,'userProfileId':_0x31019a[_0x40a3('0x4f')]},'raw':!![]})[_0x40a3('0x26')](function(_0x2e1211){if(_0x2e1211&&_0x2e1211[_0x40a3('0x50')]===0x0){return db[_0x40a3('0x51')][_0x40a3('0x4a')]({'name':_0x2a9bd1[_0x40a3('0x29')],'resourceId':_0x2a9bd1['id'],'type':_0x2e1211[_0x40a3('0x29')],'sectionId':_0x2e1211['id']},{})[_0x40a3('0x26')](function(){return _0x2e666d;});}else{return _0x2e666d;}})[_0x40a3('0x47')](function(_0x4d84cd){logger[_0x40a3('0x52')](_0x40a3('0x53'),_0x4d84cd);throw _0x4d84cd;});}return _0x2e666d;})[_0x40a3('0x26')](respondWithResult(_0x35d952,0xc9))[_0x40a3('0x47')](handleError(_0x35d952,null));};exports['update']=function(_0x26644e,_0x558b77){if(_0x26644e[_0x40a3('0x4b')]['id']){delete _0x26644e['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x26644e[_0x40a3('0x48')]['id']}})[_0x40a3('0x26')](handleEntityNotFound(_0x558b77,null))[_0x40a3('0x26')](saveUpdates(_0x26644e[_0x40a3('0x4b')],null))[_0x40a3('0x26')](respondWithResult(_0x558b77,null))[_0x40a3('0x47')](handleError(_0x558b77,null));};exports[_0x40a3('0x27')]=function(_0x2e4eec,_0x4ed27b){return db['VoiceChanSpy']['find']({'where':{'id':_0x2e4eec[_0x40a3('0x48')]['id']}})[_0x40a3('0x26')](handleEntityNotFound(_0x4ed27b,null))[_0x40a3('0x26')](removeEntity(_0x4ed27b,null))['catch'](handleError(_0x4ed27b,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 997e8f0..6e1871e 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 _0x6ee5=['bulkCreate','lodash','bluebird','from-sip','format','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','User','findAll','agent','then','exports','VoiceChanSpy','voice_chanspy','VoiceExtension','catch','destroy'];(function(_0x4522e0,_0x540b4b){var _0x482ecc=function(_0x237a88){while(--_0x237a88){_0x4522e0['push'](_0x4522e0['shift']());}};_0x482ecc(++_0x540b4b);}(_0x6ee5,0xb5));var _0x56ee=function(_0xd67f2,_0x323e58){_0xd67f2=_0xd67f2-0x0;var _0x4230b1=_0x6ee5[_0xd67f2];return _0x4230b1;};'use strict';var _=require(_0x56ee('0x0'));var util=require('util');var BPromise=require(_0x56ee('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x19a174,_0x5a6e4e,_0x457f1d){var _0x5d233b=0x1;var _0x3d19f8=[];var _0x8890c7={'context':_0x5a6e4e['context']||_0x56ee('0x2'),'exten':util[_0x56ee('0x3')]('%s%s',_0x19a174[_0x56ee('0x4')],_0x457f1d),'type':_0x56ee('0x5'),'isApp':![],'ChanSpyId':_0x19a174['id'],'UserId':_0x5a6e4e['id']};_0x3d19f8[_0x56ee('0x6')](_[_0x56ee('0x7')]({'app':_0x56ee('0x8'),'appdata':util['format'](_0x56ee('0x9'),_0x56ee('0xa')),'priority':_0x5d233b++},_0x8890c7));if(_0x19a174[_0x56ee('0xb')]){_0x3d19f8['push'](_[_0x56ee('0x7')]({'app':_0x56ee('0xc'),'appdata':util[_0x56ee('0x3')](_0x56ee('0xd'),_0x19a174[_0x56ee('0xe')]),'priority':_0x5d233b++},_0x8890c7));}if(_0x19a174[_0x56ee('0xf')]){_0x3d19f8[_0x56ee('0x6')](_[_0x56ee('0x7')]({'app':_0x56ee('0x10'),'appdata':_0x19a174[_0x56ee('0x11')],'priority':_0x5d233b++},_0x8890c7));}_0x3d19f8[_0x56ee('0x6')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0x56ee('0x12'),_0x5a6e4e[_0x56ee('0x13')],_0x19a174[_0x56ee('0x14')]?_0x19a174[_0x56ee('0x14')]['join'](''):''),'priority':_0x5d233b++},_0x8890c7));if(_0x19a174['record']){_0x3d19f8[_0x56ee('0x6')](_[_0x56ee('0x7')]({'app':_0x56ee('0x15'),'priority':_0x5d233b++},_0x8890c7));}return _0x3d19f8;};var getChanSpyApplications=function(_0x33eb59,_0x180991){var _0x460728=[];for(var _0x53c23c=0x0,_0x247594=0x1;_0x53c23c<_0x180991[_0x56ee('0x16')];_0x53c23c++,_0x247594=0x1){_0x460728=_0x460728[_0x56ee('0x17')](getUserApplications(_0x33eb59,_0x180991[_0x53c23c],_0x180991[_0x53c23c][_0x56ee('0x18')]));if(_0x180991[_0x53c23c][_0x56ee('0x18')]!=_0x180991[_0x53c23c][_0x56ee('0x13')]){_0x460728=_0x460728['concat'](getUserApplications(_0x33eb59,_0x180991[_0x53c23c],_0x180991[_0x53c23c][_0x56ee('0x13')]));}}return _0x460728;};var getChanSpyPromise=function(_0x54af4e,_0x35f6a3){return new BPromise(function(_0x244cf6,_0x3c7858){return _0x54af4e[_0x56ee('0x19')][_0x56ee('0x1a')]({'attributes':['id',_0x56ee('0x13'),'internal'],'where':{'role':_0x56ee('0x1b'),'chanspy':!![]},'raw':!![]})[_0x56ee('0x1c')](function(_0x56f16f){if(_0x56f16f){return _0x244cf6(getChanSpyApplications(_0x35f6a3,_0x56f16f));}return _0x244cf6([]);})['catch'](function(_0x27c765){_0x3c7858(_0x27c765);});});};module[_0x56ee('0x1d')]=function(_0xf416c,_0x414a25){var _0x19eaf8=_0xf416c['models'];return _0xf416c['define'](_0x56ee('0x1e'),attributes,{'tableName':_0x56ee('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x567369,_0x171a14,_0x12ac8a){return getChanSpyPromise(_0x19eaf8,_0x567369)[_0x56ee('0x1c')](function(_0x47c092){if(_0x47c092&&_0x47c092[_0x56ee('0x16')]){return _0x19eaf8[_0x56ee('0x20')]['bulkCreate'](_0x47c092);}})[_0x56ee('0x1c')](function(){_0x12ac8a();})[_0x56ee('0x21')](function(_0x67c0b7){_0x12ac8a(_0x67c0b7);});},'afterUpdate':function(_0x508aea,_0x1c219e,_0x21fcdb){return _0x19eaf8[_0x56ee('0x20')][_0x56ee('0x22')]({'where':{'ChanSpyId':_0x508aea['id']}})[_0x56ee('0x1c')](function(){return getChanSpyPromise(_0x19eaf8,_0x508aea);})[_0x56ee('0x1c')](function(_0x2f2ed3){if(_0x2f2ed3&&_0x2f2ed3['length']){return _0x19eaf8[_0x56ee('0x20')][_0x56ee('0x23')](_0x2f2ed3);}})['then'](function(){_0x21fcdb();})[_0x56ee('0x21')](function(_0x3e6661){_0x21fcdb(_0x3e6661);});},'afterDestroy':function(_0x446bac,_0x4a3fa6,_0x554f9d){return _0x19eaf8[_0x56ee('0x20')][_0x56ee('0x22')]({'where':{'ChanSpyId':_0x446bac['id']}})[_0x56ee('0x1c')](function(){_0x554f9d();})['catch'](function(_0x4a2331){_0x554f9d(_0x4a2331);});}}});}; \ No newline at end of file +var _0x504c=['VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s','options','internal','name','concat','User','findAll','agent','then','exports','models','define'];(function(_0x378830,_0xb532d7){var _0x4e4348=function(_0x496bc4){while(--_0x496bc4){_0x378830['push'](_0x378830['shift']());}};_0x4e4348(++_0xb532d7);}(_0x504c,0x13f));var _0xc504=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x504c[_0x58efa6];return _0x5d643c;};'use strict';var _=require(_0xc504('0x0'));var util=require(_0xc504('0x1'));var BPromise=require(_0xc504('0x2'));var attributes=require(_0xc504('0x3'));var getUserApplications=function(_0x1f6d82,_0x2c3dea,_0xe292a1){var _0x29cd8=0x1;var _0x590521=[];var _0x4f4481={'context':_0x2c3dea[_0xc504('0x4')]||_0xc504('0x5'),'exten':util[_0xc504('0x6')]('%s%s',_0x1f6d82[_0xc504('0x7')],_0xe292a1),'type':_0xc504('0x8'),'isApp':![],'ChanSpyId':_0x1f6d82['id'],'UserId':_0x2c3dea['id']};_0x590521[_0xc504('0x9')](_['merge']({'app':_0xc504('0xa'),'appdata':util[_0xc504('0x6')](_0xc504('0xb'),_0xc504('0xc')),'priority':_0x29cd8++},_0x4f4481));if(_0x1f6d82[_0xc504('0xd')]){_0x590521['push'](_[_0xc504('0xe')]({'app':_0xc504('0xf'),'appdata':util[_0xc504('0x6')](_0xc504('0x10'),_0x1f6d82['recordingFormat']),'priority':_0x29cd8++},_0x4f4481));}if(_0x1f6d82['auth']){_0x590521[_0xc504('0x9')](_['merge']({'app':_0xc504('0x11'),'appdata':_0x1f6d82[_0xc504('0x12')],'priority':_0x29cd8++},_0x4f4481));}_0x590521[_0xc504('0x9')](_[_0xc504('0xe')]({'app':_0xc504('0x13'),'appdata':util[_0xc504('0x6')](_0xc504('0x14'),_0x2c3dea['name'],_0x1f6d82[_0xc504('0x15')]?_0x1f6d82[_0xc504('0x15')]['join'](''):''),'priority':_0x29cd8++},_0x4f4481));if(_0x1f6d82['record']){_0x590521[_0xc504('0x9')](_[_0xc504('0xe')]({'app':'StopMixMonitor','priority':_0x29cd8++},_0x4f4481));}return _0x590521;};var getChanSpyApplications=function(_0x504907,_0x65fbef){var _0xd92bb5=[];for(var _0x3d11e3=0x0,_0x51cda7=0x1;_0x3d11e3<_0x65fbef['length'];_0x3d11e3++,_0x51cda7=0x1){_0xd92bb5=_0xd92bb5['concat'](getUserApplications(_0x504907,_0x65fbef[_0x3d11e3],_0x65fbef[_0x3d11e3][_0xc504('0x16')]));if(_0x65fbef[_0x3d11e3][_0xc504('0x16')]!=_0x65fbef[_0x3d11e3][_0xc504('0x17')]){_0xd92bb5=_0xd92bb5[_0xc504('0x18')](getUserApplications(_0x504907,_0x65fbef[_0x3d11e3],_0x65fbef[_0x3d11e3][_0xc504('0x17')]));}}return _0xd92bb5;};var getChanSpyPromise=function(_0xd2de07,_0x716e07){return new BPromise(function(_0x4b4c0e,_0x563b6f){return _0xd2de07[_0xc504('0x19')][_0xc504('0x1a')]({'attributes':['id',_0xc504('0x17'),'internal'],'where':{'role':_0xc504('0x1b'),'chanspy':!![]},'raw':!![]})[_0xc504('0x1c')](function(_0x840d20){if(_0x840d20){return _0x4b4c0e(getChanSpyApplications(_0x716e07,_0x840d20));}return _0x4b4c0e([]);})['catch'](function(_0x1d208e){_0x563b6f(_0x1d208e);});});};module[_0xc504('0x1d')]=function(_0x20b047,_0x5a2020){var _0x2ad34e=_0x20b047[_0xc504('0x1e')];return _0x20b047[_0xc504('0x1f')](_0xc504('0x20'),attributes,{'tableName':_0xc504('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a6b87,_0x3d8490,_0x13b85c){return getChanSpyPromise(_0x2ad34e,_0x2a6b87)[_0xc504('0x1c')](function(_0x28304b){if(_0x28304b&&_0x28304b['length']){return _0x2ad34e[_0xc504('0x22')][_0xc504('0x23')](_0x28304b);}})[_0xc504('0x1c')](function(){_0x13b85c();})[_0xc504('0x24')](function(_0x1701ca){_0x13b85c(_0x1701ca);});},'afterUpdate':function(_0x2df89d,_0x125079,_0x5bbe5a){return _0x2ad34e[_0xc504('0x22')][_0xc504('0x25')]({'where':{'ChanSpyId':_0x2df89d['id']}})[_0xc504('0x1c')](function(){return getChanSpyPromise(_0x2ad34e,_0x2df89d);})['then'](function(_0x46ab36){if(_0x46ab36&&_0x46ab36[_0xc504('0x26')]){return _0x2ad34e[_0xc504('0x22')][_0xc504('0x23')](_0x46ab36);}})[_0xc504('0x1c')](function(){_0x5bbe5a();})[_0xc504('0x24')](function(_0x5904aa){_0x5bbe5a(_0x5904aa);});},'afterDestroy':function(_0x35a84d,_0x1970c1,_0x2680d3){return _0x2ad34e[_0xc504('0x22')][_0xc504('0x25')]({'where':{'ChanSpyId':_0x35a84d['id']}})[_0xc504('0x1c')](function(){_0x2680d3();})['catch'](function(_0x1385cb){_0x2680d3(_0x1385cb);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index fe42ddd..93a2f40 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 _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x12c664,_0x25c58e){var _0x30961a=function(_0xa9576f){while(--_0xa9576f){_0x12c664['push'](_0x12c664['shift']());}};_0x30961a(++_0x25c58e);}(_0x878f,0x173));var _0xf878=function(_0x246f81,_0x2aaea8){_0x246f81=_0x246f81-0x0;var _0x285dc0=_0x878f[_0x246f81];return _0x285dc0;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file +var _0xac4a=['VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x3a0be9,_0x4cb812){_0x3a0be9=_0x3a0be9-0x0;var _0x31a9de=_0xac4a[_0x3a0be9];return _0x31a9de;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index a7ff310..32d9252 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 _0x5088=['exports','util','path','Router','../../components/auth/service','get','/:id','isAuthenticated','show','create','put','delete','destroy'];(function(_0x2831d3,_0x2b10fc){var _0x331ca7=function(_0x5df5f2){while(--_0x5df5f2){_0x2831d3['push'](_0x2831d3['shift']());}};_0x331ca7(++_0x2b10fc);}(_0x5088,0x76));var _0x8508=function(_0x531607,_0x73fa88){_0x531607=_0x531607-0x0;var _0x1b1fbb=_0x5088[_0x531607];return _0x1b1fbb;};'use strict';var multer=require('multer');var util=require(_0x8508('0x0'));var path=require(_0x8508('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8508('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8508('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x8508('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8508('0x4')](_0x8508('0x5'),auth[_0x8508('0x6')](),controller[_0x8508('0x7')]);router['post']('/',auth[_0x8508('0x6')](),controller[_0x8508('0x8')]);router[_0x8508('0x9')](_0x8508('0x5'),auth[_0x8508('0x6')](),controller['update']);router[_0x8508('0xa')](_0x8508('0x5'),auth[_0x8508('0x6')](),controller[_0x8508('0xb')]);module[_0x8508('0xc')]=router; \ No newline at end of file +var _0xf3cc=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util'];(function(_0x256d13,_0x412205){var _0x1017b8=function(_0x14a4b6){while(--_0x14a4b6){_0x256d13['push'](_0x256d13['shift']());}};_0x1017b8(++_0x412205);}(_0xf3cc,0x12e));var _0xcf3c=function(_0x3c1304,_0x219ae5){_0x3c1304=_0x3c1304-0x0;var _0x11b071=_0xf3cc[_0x3c1304];return _0x11b071;};'use strict';var multer=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var path=require(_0xcf3c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcf3c('0x3'));var auth=require(_0xcf3c('0x4'));var interaction=require(_0xcf3c('0x5'));var config=require(_0xcf3c('0x6'));var controller=require(_0xcf3c('0x7'));router[_0xcf3c('0x8')]('/',auth['isAuthenticated'](),controller[_0xcf3c('0x9')]);router[_0xcf3c('0x8')](_0xcf3c('0xa'),auth[_0xcf3c('0xb')](),controller[_0xcf3c('0xc')]);router[_0xcf3c('0xd')]('/',auth['isAuthenticated'](),controller[_0xcf3c('0xe')]);router[_0xcf3c('0xf')]('/:id',auth[_0xcf3c('0xb')](),controller[_0xcf3c('0x10')]);router[_0xcf3c('0x11')](_0xcf3c('0xa'),auth[_0xcf3c('0xb')](),controller['destroy']);module[_0xcf3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 5874223..1d6b68c 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 _0xc3bd=['sequelize','exports','STRING','BOOLEAN'];(function(_0xb31f66,_0x2a0fa4){var _0x9634b0=function(_0x11d6ae){while(--_0x11d6ae){_0xb31f66['push'](_0xb31f66['shift']());}};_0x9634b0(++_0x2a0fa4);}(_0xc3bd,0xe4));var _0xdc3b=function(_0x245c23,_0x1d7066){_0x245c23=_0x245c23-0x0;var _0x3b1bb1=_0xc3bd[_0x245c23];return _0x3b1bb1;};'use strict';var Sequelize=require(_0xdc3b('0x0'));module[_0xdc3b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xdc3b('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xdc3b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb478=['sequelize','STRING','name','BOOLEAN'];(function(_0x476f98,_0x5d1b4e){var _0xd54987=function(_0x11511b){while(--_0x11511b){_0x476f98['push'](_0x476f98['shift']());}};_0xd54987(++_0x5d1b4e);}(_0xb478,0x140));var _0x8b47=function(_0x1c66f1,_0x53c85c){_0x1c66f1=_0x1c66f1-0x0;var _0x682d89=_0xb478[_0x1c66f1];return _0x682d89;};'use strict';var Sequelize=require(_0x8b47('0x0'));module['exports']={'name':{'type':Sequelize[_0x8b47('0x1')],'unique':_0x8b47('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8b47('0x3')],'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 a936c55..b5676e6 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 _0x7256=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','root','join','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','show','params','merge','find','create','body','readFileSync','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','role','UserProfileSection'];(function(_0x28edd9,_0x25d4c7){var _0x582a41=function(_0x307489){while(--_0x307489){_0x28edd9['push'](_0x28edd9['shift']());}};_0x582a41(++_0x25d4c7);}(_0x7256,0x6d));var _0x6725=function(_0x15f83a,_0x16c43c){_0x15f83a=_0x15f83a-0x0;var _0x3af215=_0x7256[_0x15f83a];return _0x3af215;};'use strict';var emlformat=require(_0x6725('0x0'));var rimraf=require(_0x6725('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6725('0x2'));var moment=require(_0x6725('0x3'));var BPromise=require(_0x6725('0x4'));var Mustache=require(_0x6725('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6725('0x6'));var csv=require('to-csv');var ejs=require(_0x6725('0x7'));var fs=require('fs');var fs_extra=require(_0x6725('0x8'));var _=require('lodash');var squel=require(_0x6725('0x9'));var crypto=require('crypto');var jsforce=require(_0x6725('0xa'));var deskjs=require(_0x6725('0xb'));var toCsv=require(_0x6725('0xc'));var querystring=require(_0x6725('0xd'));var Papa=require('papaparse');var Redis=require(_0x6725('0xe'));var authService=require(_0x6725('0xf'));var qs=require(_0x6725('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6725('0x11'));var logger=require(_0x6725('0x12'))(_0x6725('0x13'));var utils=require('../../config/utils');var config=require(_0x6725('0x14'));var licenseUtil=require(_0x6725('0x15'));var db=require(_0x6725('0x16'))['db'];var jayson=require(_0x6725('0x17'));var client=jayson[_0x6725('0x18')][_0x6725('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4d9b84,_0x5a9ad5,_0x2654f1,_0xbb3d00){return new BPromise(function(_0x54d67c,_0x158652){var _0x406398=_0xbb3d00||client;return _0x406398[_0x6725('0x1a')](_0x4d9b84,_0x2654f1)[_0x6725('0x1b')](function(_0x227535){logger['info'](_0x6725('0x1c'),_0x5a9ad5,'request\x20sent');logger[_0x6725('0x1d')](_0x6725('0x1e'),_0x5a9ad5,_0x6725('0x1f'),JSON['stringify'](_0x227535));if(_0x227535[_0x6725('0x20')]){if(_0x227535['error'][_0x6725('0x21')]===0x1f4){logger[_0x6725('0x20')](_0x6725('0x1c'),_0x5a9ad5,_0x227535[_0x6725('0x20')][_0x6725('0x22')]);return _0x158652(_0x227535[_0x6725('0x20')][_0x6725('0x22')]);}logger[_0x6725('0x20')]('VoiceContext,\x20%s,\x20%s',_0x5a9ad5,_0x227535['error'][_0x6725('0x22')]);return _0x54d67c(_0x227535[_0x6725('0x20')][_0x6725('0x22')]);}else{logger[_0x6725('0x23')](_0x6725('0x1c'),_0x5a9ad5,'request\x20sent');_0x54d67c(_0x227535[_0x6725('0x24')]['message']);}})[_0x6725('0x25')](function(_0x506ffa){logger[_0x6725('0x20')]('VoiceContext,\x20%s,\x20%s',_0x5a9ad5,_0x506ffa);_0x158652(_0x506ffa);});});}function respondWithStatusCode(_0x3edbd0,_0x45114a){_0x45114a=_0x45114a||0xcc;return function(_0x2bc99b){if(_0x2bc99b){return _0x3edbd0[_0x6725('0x26')](_0x45114a);}return _0x3edbd0[_0x6725('0x27')](_0x45114a)[_0x6725('0x28')]();};}function respondWithResult(_0x390d6c,_0x2cf071){_0x2cf071=_0x2cf071||0xc8;return function(_0xe37df4){if(_0xe37df4){return _0x390d6c[_0x6725('0x27')](_0x2cf071)['json'](_0xe37df4);}};}function respondWithFilteredResult(_0x2be500,_0x462052){return function(_0x15d136){if(_0x15d136){var _0x3e51e3=typeof _0x462052['offset']==='undefined'&&typeof _0x462052[_0x6725('0x29')]==='undefined';var _0x562779=_0x15d136[_0x6725('0x2a')];var _0x5ad43b=_0x3e51e3?0x0:_0x462052['offset'];var _0x2a0e13=_0x3e51e3?_0x15d136[_0x6725('0x2a')]:_0x462052[_0x6725('0x2b')]+_0x462052['limit'];var _0x4432a1;if(_0x2a0e13>=_0x562779){_0x2a0e13=_0x562779;_0x4432a1=0xc8;}else{_0x4432a1=0xce;}_0x2be500[_0x6725('0x27')](_0x4432a1);return _0x2be500[_0x6725('0x2c')](_0x6725('0x2d'),_0x5ad43b+'-'+_0x2a0e13+'/'+_0x562779)[_0x6725('0x2e')](_0x15d136);}return null;};}function patchUpdates(_0x1dce91){return function(_0x33675d){try{jsonpatch[_0x6725('0x2f')](_0x33675d,_0x1dce91,!![]);}catch(_0x3582e3){return BPromise['reject'](_0x3582e3);}return _0x33675d['save']();};}function saveUpdates(_0x4cd9df,_0x4aa0b6){return function(_0x53414e){if(_0x53414e){return _0x53414e['update'](_0x4cd9df)[_0x6725('0x1b')](function(_0x3ce4d0){return _0x3ce4d0;});}return null;};}function removeEntity(_0x374b1b,_0xbc8c64){return function(_0x486b97){if(_0x486b97){return _0x486b97[_0x6725('0x30')]()[_0x6725('0x1b')](function(){var _0x420713=_0x486b97[_0x6725('0x31')]({'plain':!![]});var _0x2ed50d=_0x6725('0x32');return db[_0x6725('0x33')][_0x6725('0x30')]({'where':{'type':_0x2ed50d,'resourceId':_0x420713['id']}})['then'](function(){return _0x486b97;});})['then'](function(){_0x374b1b[_0x6725('0x27')](0xcc)[_0x6725('0x28')]();});}};}function handleEntityNotFound(_0x95aee3,_0x1aa6be){return function(_0x588c18){if(!_0x588c18){_0x95aee3[_0x6725('0x26')](0x194);}return _0x588c18;};}function handleError(_0x55f82d,_0x27a060){_0x27a060=_0x27a060||0x1f4;return function(_0x5c23d2){logger[_0x6725('0x20')](_0x5c23d2[_0x6725('0x34')]);if(_0x5c23d2['name']){delete _0x5c23d2[_0x6725('0x35')];}_0x55f82d['status'](_0x27a060)[_0x6725('0x36')](_0x5c23d2);};}exports[_0x6725('0x37')]=function(_0x4c2d44,_0x3e3a6d){var _0x249671={},_0x375e45={},_0x1e9074={'count':0x0,'rows':[]};var _0x5af543=_[_0x6725('0x38')](db[_0x6725('0x39')][_0x6725('0x3a')],function(_0x224cbf){return{'name':_0x224cbf['fieldName'],'type':_0x224cbf[_0x6725('0x3b')]['key']};});_0x375e45[_0x6725('0x3c')]=_[_0x6725('0x38')](_0x5af543,_0x6725('0x35'));_0x375e45[_0x6725('0x3d')]=_[_0x6725('0x3e')](_0x4c2d44[_0x6725('0x3d')]);_0x375e45[_0x6725('0x3f')]=_['intersection'](_0x375e45['model'],_0x375e45[_0x6725('0x3d')]);_0x249671['attributes']=_[_0x6725('0x40')](_0x375e45[_0x6725('0x3c')],qs[_0x6725('0x41')](_0x4c2d44[_0x6725('0x3d')][_0x6725('0x41')]));_0x249671['attributes']=_0x249671[_0x6725('0x42')][_0x6725('0x43')]?_0x249671[_0x6725('0x42')]:_0x375e45[_0x6725('0x3c')];if(!_0x4c2d44[_0x6725('0x3d')][_0x6725('0x44')](_0x6725('0x45'))){_0x249671[_0x6725('0x29')]=qs['limit'](_0x4c2d44[_0x6725('0x3d')][_0x6725('0x29')]);_0x249671[_0x6725('0x2b')]=qs['offset'](_0x4c2d44[_0x6725('0x3d')][_0x6725('0x2b')]);}_0x249671[_0x6725('0x46')]=qs[_0x6725('0x47')](_0x4c2d44[_0x6725('0x3d')][_0x6725('0x47')]);_0x249671[_0x6725('0x48')]=qs['filters'](_[_0x6725('0x49')](_0x4c2d44[_0x6725('0x3d')],_0x375e45['filters']),_0x5af543);if(_0x4c2d44[_0x6725('0x3d')][_0x6725('0x4a')]){_0x249671[_0x6725('0x48')]=_['merge'](_0x249671[_0x6725('0x48')],{'$or':_[_0x6725('0x38')](_0x5af543,function(_0x4afc5f){if(_0x4afc5f[_0x6725('0x3b')]!==_0x6725('0x4b')){var _0x3be896={};_0x3be896[_0x4afc5f[_0x6725('0x35')]]={'$like':'%'+_0x4c2d44[_0x6725('0x3d')][_0x6725('0x4a')]+'%'};return _0x3be896;}})});}_0x249671=_['merge']({},_0x249671,_0x4c2d44[_0x6725('0x4c')]);var _0x53160f={'where':_0x249671[_0x6725('0x48')]};return db[_0x6725('0x39')][_0x6725('0x2a')](_0x53160f)[_0x6725('0x1b')](function(_0x54990c){_0x1e9074['count']=_0x54990c;if(_0x4c2d44['query']['includeAll']){_0x249671[_0x6725('0x4d')]=[{'all':!![]}];}return db[_0x6725('0x39')][_0x6725('0x4e')](_0x249671);})[_0x6725('0x1b')](function(_0x587aa2){_0x1e9074['rows']=_0x587aa2;return _0x1e9074;})[_0x6725('0x1b')](respondWithFilteredResult(_0x3e3a6d,_0x249671))[_0x6725('0x25')](handleError(_0x3e3a6d,null));};exports[_0x6725('0x4f')]=function(_0x3aea0b,_0x57f063){var _0x26bb60={'raw':![],'where':{'id':_0x3aea0b[_0x6725('0x50')]['id']}},_0x2eaf4b={};_0x2eaf4b['model']=_[_0x6725('0x3e')](db[_0x6725('0x39')][_0x6725('0x3a')]);_0x2eaf4b[_0x6725('0x3d')]=_[_0x6725('0x3e')](_0x3aea0b[_0x6725('0x3d')]);_0x2eaf4b[_0x6725('0x3f')]=_['intersection'](_0x2eaf4b['model'],_0x2eaf4b[_0x6725('0x3d')]);_0x26bb60[_0x6725('0x42')]=_[_0x6725('0x40')](_0x2eaf4b['model'],qs[_0x6725('0x41')](_0x3aea0b[_0x6725('0x3d')][_0x6725('0x41')]));_0x26bb60['attributes']=_0x26bb60[_0x6725('0x42')][_0x6725('0x43')]?_0x26bb60[_0x6725('0x42')]:_0x2eaf4b[_0x6725('0x3c')];if(_0x3aea0b[_0x6725('0x3d')]['includeAll']){_0x26bb60['include']=[{'all':!![]}];}_0x26bb60=_[_0x6725('0x51')]({},_0x26bb60,_0x3aea0b[_0x6725('0x4c')]);return db[_0x6725('0x39')][_0x6725('0x52')](_0x26bb60)[_0x6725('0x1b')](handleEntityNotFound(_0x57f063,null))[_0x6725('0x1b')](respondWithResult(_0x57f063,null))['catch'](handleError(_0x57f063,null));};exports[_0x6725('0x53')]=function(_0x477627,_0x14f5f1,_0x2a9800){var _0x335757;return db[_0x6725('0x39')][_0x6725('0x53')](_0x477627[_0x6725('0x54')],{'raw':!![]})[_0x6725('0x1b')](function(_0x4a7267){_0x335757=_0x4a7267;return db[_0x6725('0x39')][_0x6725('0x4e')]({'raw':!![]});})[_0x6725('0x1b')](function(_0x3224af){var _0x50fa0f=fs[_0x6725('0x55')](path['join'](config['root'],_0x6725('0x56')),_0x6725('0x57'));var _0x193d4d=ejs[_0x6725('0x58')](_0x50fa0f,{'contexts':_0x3224af||[]});fs[_0x6725('0x59')](_0x6725('0x5a'),_0x193d4d);})['then'](function(){return respondWithRpcPromise(_0x6725('0x5b'),'create',{'module':_0x6725('0x5c')});})[_0x6725('0x1b')](function(){var _0x194d46=_0x477627[_0x6725('0x5d')][_0x6725('0x31')]({'plain':!![]});if(!_0x194d46)throw new Error(_0x6725('0x5e'));if(_0x194d46[_0x6725('0x5f')]==='user'){var _0x1464a7=_0x335757[_0x6725('0x31')]({'plain':!![]});return db[_0x6725('0x60')][_0x6725('0x52')]({'where':{'name':_0x6725('0x32'),'userProfileId':_0x194d46[_0x6725('0x61')]},'raw':!![]})[_0x6725('0x1b')](function(_0x4b2771){if(_0x4b2771&&_0x4b2771[_0x6725('0x62')]===0x0){return db[_0x6725('0x33')][_0x6725('0x53')]({'name':_0x1464a7[_0x6725('0x35')],'resourceId':_0x1464a7['id'],'type':_0x4b2771[_0x6725('0x35')],'sectionId':_0x4b2771['id']},{})[_0x6725('0x1b')](function(){return _0x335757;});}else{return _0x335757;}})['catch'](function(_0x105531){logger[_0x6725('0x20')](_0x6725('0x63'),_0x105531);throw _0x105531;});}return _0x335757;})[_0x6725('0x1b')](respondWithResult(_0x14f5f1,0xc9))['catch'](handleError(_0x14f5f1,null));};exports[_0x6725('0x64')]=function(_0x44f4f0,_0x4b8d78,_0x226817){var _0x10b8ee;return db[_0x6725('0x39')][_0x6725('0x52')]({'where':{'id':_0x44f4f0[_0x6725('0x50')]['id']}})[_0x6725('0x1b')](handleEntityNotFound(_0x4b8d78,null))['then'](saveUpdates(_0x44f4f0[_0x6725('0x54')],null))[_0x6725('0x1b')](function(_0x4dfa37){if(_0x4dfa37){_0x10b8ee=_0x4dfa37;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x6725('0x1b')](function(_0x4fdda8){var _0x280e9b=fs['readFileSync'](path['join'](config[_0x6725('0x65')],_0x6725('0x56')),_0x6725('0x57'));var _0x24c285=ejs[_0x6725('0x58')](_0x280e9b,{'contexts':_0x4fdda8||[]});fs[_0x6725('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x24c285);})[_0x6725('0x1b')](function(){return respondWithRpcPromise(_0x6725('0x5b'),'update',{'module':_0x6725('0x5c')});})[_0x6725('0x1b')](function(){return _0x10b8ee;})[_0x6725('0x1b')](respondWithResult(_0x4b8d78,null))[_0x6725('0x25')](handleError(_0x4b8d78,null));};exports[_0x6725('0x30')]=function(_0x3c77ac,_0x54673a,_0x56b012){var _0x209672;return db['VoiceContext'][_0x6725('0x52')]({'where':{'id':_0x3c77ac[_0x6725('0x50')]['id']}})['then'](handleEntityNotFound(_0x54673a,null))[_0x6725('0x1b')](removeEntity(_0x54673a,null))[_0x6725('0x1b')](function(){return db[_0x6725('0x39')][_0x6725('0x4e')]({'raw':!![]});})['then'](function(_0x3bb5ed){var _0xd67ebd=fs[_0x6725('0x55')](path[_0x6725('0x66')](config[_0x6725('0x65')],_0x6725('0x56')),'utf8');var _0x4eca69=ejs[_0x6725('0x58')](_0xd67ebd,{'contexts':_0x3bb5ed});fs[_0x6725('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4eca69);return respondWithRpcPromise('Reload',_0x6725('0x30'),{'module':_0x6725('0x5c')});})[_0x6725('0x25')](handleError(_0x54673a,null));}; \ No newline at end of file +var _0x0e85=['order','sort','where','filters','filter','merge','includeAll','include','findAll','params','keys','find','create','body','join','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','writeFileSync','chan_sip.so','readFileSync','server/files/templates/context.ejs','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0e85,0x146));var _0x50e8=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x0e85[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x1'));var rp=require(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require(_0x50e8('0x4'));var Mustache=require(_0x50e8('0x5'));var util=require(_0x50e8('0x6'));var path=require(_0x50e8('0x7'));var sox=require(_0x50e8('0x8'));var csv=require(_0x50e8('0x9'));var ejs=require(_0x50e8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50e8('0xb'));var squel=require(_0x50e8('0xc'));var crypto=require('crypto');var jsforce=require(_0x50e8('0xd'));var deskjs=require(_0x50e8('0xe'));var toCsv=require(_0x50e8('0x9'));var querystring=require(_0x50e8('0xf'));var Papa=require(_0x50e8('0x10'));var Redis=require(_0x50e8('0x11'));var authService=require(_0x50e8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50e8('0x13'));var logger=require(_0x50e8('0x14'))(_0x50e8('0x15'));var utils=require(_0x50e8('0x16'));var config=require(_0x50e8('0x17'));var licenseUtil=require(_0x50e8('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x50e8('0x19'));var client=jayson['client'][_0x50e8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x339092,_0x5751ab,_0x3bce4a,_0x429c9e){return new BPromise(function(_0x350572,_0x37eb73){var _0x3cbaa3=_0x429c9e||client;return _0x3cbaa3[_0x50e8('0x1b')](_0x339092,_0x3bce4a)[_0x50e8('0x1c')](function(_0x7bad63){logger['info'](_0x50e8('0x1d'),_0x5751ab,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5751ab,_0x50e8('0x1e'),JSON[_0x50e8('0x1f')](_0x7bad63));if(_0x7bad63[_0x50e8('0x20')]){if(_0x7bad63[_0x50e8('0x20')][_0x50e8('0x21')]===0x1f4){logger[_0x50e8('0x20')](_0x50e8('0x1d'),_0x5751ab,_0x7bad63[_0x50e8('0x20')][_0x50e8('0x22')]);return _0x37eb73(_0x7bad63['error']['message']);}logger['error'](_0x50e8('0x1d'),_0x5751ab,_0x7bad63['error']['message']);return _0x350572(_0x7bad63[_0x50e8('0x20')]['message']);}else{logger[_0x50e8('0x23')](_0x50e8('0x1d'),_0x5751ab,_0x50e8('0x1e'));_0x350572(_0x7bad63[_0x50e8('0x24')]['message']);}})[_0x50e8('0x25')](function(_0x4b36bd){logger[_0x50e8('0x20')](_0x50e8('0x1d'),_0x5751ab,_0x4b36bd);_0x37eb73(_0x4b36bd);});});}function respondWithStatusCode(_0x5a0bd6,_0x25c22a){_0x25c22a=_0x25c22a||0xcc;return function(_0x4f71ab){if(_0x4f71ab){return _0x5a0bd6[_0x50e8('0x26')](_0x25c22a);}return _0x5a0bd6[_0x50e8('0x27')](_0x25c22a)[_0x50e8('0x28')]();};}function respondWithResult(_0x3912c6,_0xd82a64){_0xd82a64=_0xd82a64||0xc8;return function(_0x1491ea){if(_0x1491ea){return _0x3912c6[_0x50e8('0x27')](_0xd82a64)[_0x50e8('0x29')](_0x1491ea);}};}function respondWithFilteredResult(_0x575b2c,_0x16a455){return function(_0x23aecf){if(_0x23aecf){var _0x275723=typeof _0x16a455[_0x50e8('0x2a')]===_0x50e8('0x2b')&&typeof _0x16a455[_0x50e8('0x2c')]===_0x50e8('0x2b');var _0x8214d1=_0x23aecf[_0x50e8('0x2d')];var _0x54a5ce=_0x275723?0x0:_0x16a455[_0x50e8('0x2a')];var _0x4d3d3a=_0x275723?_0x23aecf['count']:_0x16a455[_0x50e8('0x2a')]+_0x16a455['limit'];var _0x5b50ee;if(_0x4d3d3a>=_0x8214d1){_0x4d3d3a=_0x8214d1;_0x5b50ee=0xc8;}else{_0x5b50ee=0xce;}_0x575b2c[_0x50e8('0x27')](_0x5b50ee);return _0x575b2c[_0x50e8('0x2e')](_0x50e8('0x2f'),_0x54a5ce+'-'+_0x4d3d3a+'/'+_0x8214d1)[_0x50e8('0x29')](_0x23aecf);}return null;};}function patchUpdates(_0x3e8b1e){return function(_0x52be94){try{jsonpatch[_0x50e8('0x30')](_0x52be94,_0x3e8b1e,!![]);}catch(_0xece87){return BPromise[_0x50e8('0x31')](_0xece87);}return _0x52be94[_0x50e8('0x32')]();};}function saveUpdates(_0x595e70,_0x594f7a){return function(_0xbbd7fa){if(_0xbbd7fa){return _0xbbd7fa[_0x50e8('0x33')](_0x595e70)['then'](function(_0x40c90c){return _0x40c90c;});}return null;};}function removeEntity(_0x285ee5,_0x2a8929){return function(_0x3b7d7b){if(_0x3b7d7b){return _0x3b7d7b[_0x50e8('0x34')]()[_0x50e8('0x1c')](function(){var _0x5a9c6c=_0x3b7d7b[_0x50e8('0x35')]({'plain':!![]});var _0x558540='Contexts';return db[_0x50e8('0x36')][_0x50e8('0x34')]({'where':{'type':_0x558540,'resourceId':_0x5a9c6c['id']}})[_0x50e8('0x1c')](function(){return _0x3b7d7b;});})[_0x50e8('0x1c')](function(){_0x285ee5[_0x50e8('0x27')](0xcc)[_0x50e8('0x28')]();});}};}function handleEntityNotFound(_0x5e91f0,_0x332577){return function(_0x82cb3d){if(!_0x82cb3d){_0x5e91f0[_0x50e8('0x26')](0x194);}return _0x82cb3d;};}function handleError(_0x25c19d,_0x3f7ecc){_0x3f7ecc=_0x3f7ecc||0x1f4;return function(_0x3878f5){logger[_0x50e8('0x20')](_0x3878f5[_0x50e8('0x37')]);if(_0x3878f5[_0x50e8('0x38')]){delete _0x3878f5[_0x50e8('0x38')];}_0x25c19d[_0x50e8('0x27')](_0x3f7ecc)[_0x50e8('0x39')](_0x3878f5);};}exports['index']=function(_0x1a92d9,_0xd70319){var _0x119c83={},_0x49164f={},_0xeac0a3={'count':0x0,'rows':[]};var _0x355ee0=_[_0x50e8('0x3a')](db[_0x50e8('0x3b')][_0x50e8('0x3c')],function(_0x397b5e){return{'name':_0x397b5e[_0x50e8('0x3d')],'type':_0x397b5e[_0x50e8('0x3e')]['key']};});_0x49164f[_0x50e8('0x3f')]=_['map'](_0x355ee0,_0x50e8('0x38'));_0x49164f[_0x50e8('0x40')]=_['keys'](_0x1a92d9[_0x50e8('0x40')]);_0x49164f['filters']=_[_0x50e8('0x41')](_0x49164f[_0x50e8('0x3f')],_0x49164f[_0x50e8('0x40')]);_0x119c83[_0x50e8('0x42')]=_[_0x50e8('0x41')](_0x49164f[_0x50e8('0x3f')],qs[_0x50e8('0x43')](_0x1a92d9[_0x50e8('0x40')][_0x50e8('0x43')]));_0x119c83[_0x50e8('0x42')]=_0x119c83['attributes'][_0x50e8('0x44')]?_0x119c83[_0x50e8('0x42')]:_0x49164f[_0x50e8('0x3f')];if(!_0x1a92d9['query'][_0x50e8('0x45')]('nolimit')){_0x119c83[_0x50e8('0x2c')]=qs[_0x50e8('0x2c')](_0x1a92d9[_0x50e8('0x40')][_0x50e8('0x2c')]);_0x119c83[_0x50e8('0x2a')]=qs[_0x50e8('0x2a')](_0x1a92d9[_0x50e8('0x40')][_0x50e8('0x2a')]);}_0x119c83[_0x50e8('0x46')]=qs[_0x50e8('0x47')](_0x1a92d9['query'][_0x50e8('0x47')]);_0x119c83[_0x50e8('0x48')]=qs[_0x50e8('0x49')](_['pick'](_0x1a92d9['query'],_0x49164f[_0x50e8('0x49')]),_0x355ee0);if(_0x1a92d9['query'][_0x50e8('0x4a')]){_0x119c83[_0x50e8('0x48')]=_[_0x50e8('0x4b')](_0x119c83[_0x50e8('0x48')],{'$or':_[_0x50e8('0x3a')](_0x355ee0,function(_0x5676c4){if(_0x5676c4[_0x50e8('0x3e')]!=='VIRTUAL'){var _0x1a00b2={};_0x1a00b2[_0x5676c4[_0x50e8('0x38')]]={'$like':'%'+_0x1a92d9[_0x50e8('0x40')][_0x50e8('0x4a')]+'%'};return _0x1a00b2;}})});}_0x119c83=_[_0x50e8('0x4b')]({},_0x119c83,_0x1a92d9['options']);var _0x144fde={'where':_0x119c83['where']};return db['VoiceContext'][_0x50e8('0x2d')](_0x144fde)['then'](function(_0x21bf0c){_0xeac0a3[_0x50e8('0x2d')]=_0x21bf0c;if(_0x1a92d9['query'][_0x50e8('0x4c')]){_0x119c83[_0x50e8('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x50e8('0x4e')](_0x119c83);})[_0x50e8('0x1c')](function(_0x2dc3ae){_0xeac0a3['rows']=_0x2dc3ae;return _0xeac0a3;})[_0x50e8('0x1c')](respondWithFilteredResult(_0xd70319,_0x119c83))[_0x50e8('0x25')](handleError(_0xd70319,null));};exports['show']=function(_0x5ccbeb,_0x1328a2){var _0x1f309c={'raw':![],'where':{'id':_0x5ccbeb[_0x50e8('0x4f')]['id']}},_0x254a21={};_0x254a21['model']=_[_0x50e8('0x50')](db[_0x50e8('0x3b')][_0x50e8('0x3c')]);_0x254a21[_0x50e8('0x40')]=_[_0x50e8('0x50')](_0x5ccbeb[_0x50e8('0x40')]);_0x254a21[_0x50e8('0x49')]=_['intersection'](_0x254a21[_0x50e8('0x3f')],_0x254a21[_0x50e8('0x40')]);_0x1f309c['attributes']=_[_0x50e8('0x41')](_0x254a21['model'],qs[_0x50e8('0x43')](_0x5ccbeb[_0x50e8('0x40')][_0x50e8('0x43')]));_0x1f309c[_0x50e8('0x42')]=_0x1f309c[_0x50e8('0x42')]['length']?_0x1f309c[_0x50e8('0x42')]:_0x254a21['model'];if(_0x5ccbeb['query']['includeAll']){_0x1f309c[_0x50e8('0x4d')]=[{'all':!![]}];}_0x1f309c=_['merge']({},_0x1f309c,_0x5ccbeb['options']);return db['VoiceContext'][_0x50e8('0x51')](_0x1f309c)[_0x50e8('0x1c')](handleEntityNotFound(_0x1328a2,null))[_0x50e8('0x1c')](respondWithResult(_0x1328a2,null))['catch'](handleError(_0x1328a2,null));};exports[_0x50e8('0x52')]=function(_0x4389e7,_0x5d11e8,_0x43621b){var _0xb99890;return db[_0x50e8('0x3b')][_0x50e8('0x52')](_0x4389e7[_0x50e8('0x53')],{'raw':!![]})[_0x50e8('0x1c')](function(_0x46754a){_0xb99890=_0x46754a;return db[_0x50e8('0x3b')][_0x50e8('0x4e')]({'raw':!![]});})['then'](function(_0xa956ec){var _0x2a9636=fs['readFileSync'](path[_0x50e8('0x54')](config[_0x50e8('0x55')],'server/files/templates/context.ejs'),_0x50e8('0x56'));var _0x1d7ef2=ejs[_0x50e8('0x57')](_0x2a9636,{'contexts':_0xa956ec||[]});fs['writeFileSync'](_0x50e8('0x58'),_0x1d7ef2);})[_0x50e8('0x1c')](function(){return respondWithRpcPromise(_0x50e8('0x59'),_0x50e8('0x52'),{'module':'chan_sip.so'});})['then'](function(){var _0x32e43f=_0x4389e7[_0x50e8('0x5a')]['get']({'plain':!![]});if(!_0x32e43f)throw new Error(_0x50e8('0x5b'));if(_0x32e43f['role']===_0x50e8('0x5a')){var _0x588e33=_0xb99890[_0x50e8('0x35')]({'plain':!![]});return db['UserProfileSection'][_0x50e8('0x51')]({'where':{'name':'Contexts','userProfileId':_0x32e43f[_0x50e8('0x5c')]},'raw':!![]})[_0x50e8('0x1c')](function(_0x34c139){if(_0x34c139&&_0x34c139[_0x50e8('0x5d')]===0x0){return db[_0x50e8('0x36')][_0x50e8('0x52')]({'name':_0x588e33['name'],'resourceId':_0x588e33['id'],'type':_0x34c139['name'],'sectionId':_0x34c139['id']},{})[_0x50e8('0x1c')](function(){return _0xb99890;});}else{return _0xb99890;}})[_0x50e8('0x25')](function(_0x4fbcf4){logger['error'](_0x50e8('0x5e'),_0x4fbcf4);throw _0x4fbcf4;});}return _0xb99890;})['then'](respondWithResult(_0x5d11e8,0xc9))[_0x50e8('0x25')](handleError(_0x5d11e8,null));};exports[_0x50e8('0x33')]=function(_0x390056,_0x434f32,_0x167b57){var _0xc7c7df;return db[_0x50e8('0x3b')]['find']({'where':{'id':_0x390056[_0x50e8('0x4f')]['id']}})[_0x50e8('0x1c')](handleEntityNotFound(_0x434f32,null))['then'](saveUpdates(_0x390056[_0x50e8('0x53')],null))[_0x50e8('0x1c')](function(_0x4658c8){if(_0x4658c8){_0xc7c7df=_0x4658c8;return db['VoiceContext'][_0x50e8('0x4e')]({'raw':!![]});}})[_0x50e8('0x1c')](function(_0x39cb5c){var _0x42b7d5=fs['readFileSync'](path[_0x50e8('0x54')](config[_0x50e8('0x55')],'server/files/templates/context.ejs'),_0x50e8('0x56'));var _0x5222d6=ejs[_0x50e8('0x57')](_0x42b7d5,{'contexts':_0x39cb5c||[]});fs[_0x50e8('0x5f')](_0x50e8('0x58'),_0x5222d6);})[_0x50e8('0x1c')](function(){return respondWithRpcPromise(_0x50e8('0x59'),'update',{'module':_0x50e8('0x60')});})[_0x50e8('0x1c')](function(){return _0xc7c7df;})['then'](respondWithResult(_0x434f32,null))[_0x50e8('0x25')](handleError(_0x434f32,null));};exports[_0x50e8('0x34')]=function(_0x180e10,_0xcc821d,_0x18512b){var _0x40e8ea;return db[_0x50e8('0x3b')]['find']({'where':{'id':_0x180e10['params']['id']}})[_0x50e8('0x1c')](handleEntityNotFound(_0xcc821d,null))[_0x50e8('0x1c')](removeEntity(_0xcc821d,null))[_0x50e8('0x1c')](function(){return db[_0x50e8('0x3b')][_0x50e8('0x4e')]({'raw':!![]});})['then'](function(_0x5b1224){var _0x5e1cf0=fs[_0x50e8('0x61')](path[_0x50e8('0x54')](config[_0x50e8('0x55')],_0x50e8('0x62')),_0x50e8('0x56'));var _0x7ddf9b=ejs['render'](_0x5e1cf0,{'contexts':_0x5b1224});fs[_0x50e8('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x7ddf9b);return respondWithRpcPromise(_0x50e8('0x59'),'destroy',{'module':_0x50e8('0x60')});})[_0x50e8('0x25')](handleError(_0xcc821d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index cda438d..47b3875 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 _0x0215=['bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','util','../../config/logger','api','moment'];(function(_0x1f878e,_0x13047){var _0x59f9ba=function(_0x2e8b32){while(--_0x2e8b32){_0x1f878e['push'](_0x1f878e['shift']());}};_0x59f9ba(++_0x13047);}(_0x0215,0x140));var _0x5021=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x0215[_0x2b45b5];return _0x1d9c06;};'use strict';var _=require('lodash');var util=require(_0x5021('0x0'));var logger=require(_0x5021('0x1'))(_0x5021('0x2'));var moment=require(_0x5021('0x3'));var BPromise=require(_0x5021('0x4'));var rp=require(_0x5021('0x5'));var fs=require('fs');var path=require(_0x5021('0x6'));var rimraf=require('rimraf');var config=require(_0x5021('0x7'));var attributes=require(_0x5021('0x8'));module[_0x5021('0x9')]=function(_0xe04415,_0x3d2bd5){return _0xe04415[_0x5021('0xa')](_0x5021('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b70=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash'];(function(_0x1f8d29,_0x295837){var _0x5e5adf=function(_0x533cf5){while(--_0x533cf5){_0x1f8d29['push'](_0x1f8d29['shift']());}};_0x5e5adf(++_0x295837);}(_0x0b70,0x192));var _0x00b7=function(_0x3c2ccc,_0x44120d){_0x3c2ccc=_0x3c2ccc-0x0;var _0x306570=_0x0b70[_0x3c2ccc];return _0x306570;};'use strict';var _=require(_0x00b7('0x0'));var util=require(_0x00b7('0x1'));var logger=require(_0x00b7('0x2'))(_0x00b7('0x3'));var moment=require(_0x00b7('0x4'));var BPromise=require('bluebird');var rp=require(_0x00b7('0x5'));var fs=require('fs');var path=require(_0x00b7('0x6'));var rimraf=require(_0x00b7('0x7'));var config=require(_0x00b7('0x8'));var attributes=require(_0x00b7('0x9'));module[_0x00b7('0xa')]=function(_0x345cb4,_0x434115){return _0x345cb4[_0x00b7('0xb')]('VoiceContext',attributes,{'tableName':_0x00b7('0xc'),'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 c53f7ea..b17ea41 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 _0x705f=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4c8d54,_0x446909){var _0x1b1ef0=function(_0x4357e6){while(--_0x4357e6){_0x4c8d54['push'](_0x4c8d54['shift']());}};_0x1b1ef0(++_0x446909);}(_0x705f,0x75));var _0xf705=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x705f[_0xaf29da];return _0x295c51;};'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 _0x1564=['debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s'];(function(_0x2868fb,_0x2165dd){var _0x1f2744=function(_0x580d38){while(--_0x580d38){_0x2868fb['push'](_0x2868fb['shift']());}};_0x1f2744(++_0x2165dd);}(_0x1564,0x125));var _0x4156=function(_0x357b8c,_0x315ad2){_0x357b8c=_0x357b8c-0x0;var _0x148add=_0x1564[_0x357b8c];return _0x148add;};'use strict';var _=require(_0x4156('0x0'));var util=require(_0x4156('0x1'));var moment=require(_0x4156('0x2'));var BPromise=require(_0x4156('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4156('0x4'));var db=require(_0x4156('0x5'))['db'];var utils=require(_0x4156('0x6'));var logger=require(_0x4156('0x7'))(_0x4156('0x8'));var config=require(_0x4156('0x9'));var jayson=require(_0x4156('0xa'));var client=jayson[_0x4156('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a49d1,_0x5d0d0b,_0x2dcaf1){return new BPromise(function(_0x492aec,_0x347f0e){return client[_0x4156('0xc')](_0x5a49d1,_0x2dcaf1)['then'](function(_0x276ad6){logger[_0x4156('0xd')](_0x4156('0xe'),_0x5d0d0b,'request\x20sent');logger[_0x4156('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5d0d0b,_0x4156('0x10'),JSON[_0x4156('0x11')](_0x276ad6));if(_0x276ad6['error']){if(_0x276ad6[_0x4156('0x12')][_0x4156('0x13')]===0x1f4){logger[_0x4156('0x12')](_0x4156('0xe'),_0x5d0d0b,_0x276ad6[_0x4156('0x12')][_0x4156('0x14')]);return _0x347f0e(_0x276ad6[_0x4156('0x12')][_0x4156('0x14')]);}logger['error'](_0x4156('0xe'),_0x5d0d0b,_0x276ad6[_0x4156('0x12')][_0x4156('0x14')]);return _0x492aec(_0x276ad6[_0x4156('0x12')][_0x4156('0x14')]);}else{logger['info'](_0x4156('0xe'),_0x5d0d0b,'request\x20sent');_0x492aec(_0x276ad6['result'][_0x4156('0x14')]);}})[_0x4156('0x15')](function(_0x70e570){logger[_0x4156('0x12')](_0x4156('0xe'),_0x5d0d0b,_0x70e570);_0x347f0e(_0x70e570);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d7c95e1..8d2ebb4 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 _0x6b7b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','get','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xccf547,_0x333750){var _0x5a8b2e=function(_0x3f59ca){while(--_0x3f59ca){_0xccf547['push'](_0xccf547['shift']());}};_0x5a8b2e(++_0x333750);}(_0x6b7b,0x7f));var _0xb6b7=function(_0x554038,_0x48ce43){_0x554038=_0x554038-0x0;var _0x51ecf2=_0x6b7b[_0x554038];return _0x51ecf2;};'use strict';var multer=require(_0xb6b7('0x0'));var util=require(_0xb6b7('0x1'));var path=require(_0xb6b7('0x2'));var timeout=require(_0xb6b7('0x3'));var express=require(_0xb6b7('0x4'));var router=express[_0xb6b7('0x5')]();var fs_extra=require(_0xb6b7('0x6'));var auth=require(_0xb6b7('0x7'));var interaction=require(_0xb6b7('0x8'));var config=require(_0xb6b7('0x9'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xb6b7('0xa')](),controller['index']);router['get']('/describe',auth[_0xb6b7('0xa')](),controller[_0xb6b7('0xb')]);router[_0xb6b7('0xc')](_0xb6b7('0xd'),auth[_0xb6b7('0xa')](),controller[_0xb6b7('0xe')]);router['post']('/',auth[_0xb6b7('0xa')](),controller[_0xb6b7('0xf')]);router['put']('/:id',auth[_0xb6b7('0xa')](),controller[_0xb6b7('0x10')]);router[_0xb6b7('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb6b7('0x12')]=router; \ No newline at end of file +var _0x2e35=['post','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/:id'];(function(_0x1a644d,_0xfeada0){var _0x58be40=function(_0x454483){while(--_0x454483){_0x1a644d['push'](_0x1a644d['shift']());}};_0x58be40(++_0xfeada0);}(_0x2e35,0x1d0));var _0x52e3=function(_0x247db1,_0x23dc20){_0x247db1=_0x247db1-0x0;var _0x221742=_0x2e35[_0x247db1];return _0x221742;};'use strict';var multer=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var path=require(_0x52e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x52e3('0x3'));var router=express[_0x52e3('0x4')]();var fs_extra=require(_0x52e3('0x5'));var auth=require(_0x52e3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x52e3('0x7'));var controller=require(_0x52e3('0x8'));router[_0x52e3('0x9')]('/',auth[_0x52e3('0xa')](),controller['index']);router['get']('/describe',auth[_0x52e3('0xa')](),controller['describe']);router['get'](_0x52e3('0xb'),auth[_0x52e3('0xa')](),controller['show']);router[_0x52e3('0xc')]('/',auth[_0x52e3('0xa')](),controller['create']);router[_0x52e3('0xd')]('/:id',auth[_0x52e3('0xa')](),controller[_0x52e3('0xe')]);router[_0x52e3('0xf')]('/:id',auth[_0x52e3('0xa')](),controller[_0x52e3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 328e2bd..d497429 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 _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x4da6cc,_0x45dae7){var _0x1224da=function(_0x5641ce){while(--_0x5641ce){_0x4da6cc['push'](_0x4da6cc['shift']());}};_0x1224da(++_0x45dae7);}(_0xedd9,0xfc));var _0x9edd=function(_0xdcfd9c,_0x4588e4){_0xdcfd9c=_0xdcfd9c-0x0;var _0x48e652=_0xedd9[_0xdcfd9c];return _0x48e652;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x483734,_0x2da8dc){var _0x6686c2=function(_0x46b320){while(--_0x46b320){_0x483734['push'](_0x483734['shift']());}};_0x6686c2(++_0x2da8dc);}(_0x425d,0x1e0));var _0xd425=function(_0x502ea4,_0x56ae9d){_0x502ea4=_0x502ea4-0x0;var _0x159978=_0x425d[_0x502ea4];return _0x159978;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 841e2b7..ea422e8 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 _0xea45=['include','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','VoiceDialReport','map','keys','query','filters','attributes','length','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','catch','show','params','model','intersection','fields'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xea45,0x1c8));var _0x5ea4=function(_0x2b9c43,_0x49b9cd){_0x2b9c43=_0x2b9c43-0x0;var _0x3e3c32=_0xea45[_0x2b9c43];return _0x3e3c32;};'use strict';var emlformat=require(_0x5ea4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5ea4('0x1'));var rp=require(_0x5ea4('0x2'));var moment=require(_0x5ea4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5ea4('0x4'));var util=require(_0x5ea4('0x5'));var path=require(_0x5ea4('0x6'));var sox=require(_0x5ea4('0x7'));var csv=require(_0x5ea4('0x8'));var ejs=require(_0x5ea4('0x9'));var fs=require('fs');var fs_extra=require(_0x5ea4('0xa'));var _=require(_0x5ea4('0xb'));var squel=require(_0x5ea4('0xc'));var crypto=require(_0x5ea4('0xd'));var jsforce=require(_0x5ea4('0xe'));var deskjs=require(_0x5ea4('0xf'));var toCsv=require(_0x5ea4('0x8'));var querystring=require(_0x5ea4('0x10'));var Papa=require(_0x5ea4('0x11'));var Redis=require(_0x5ea4('0x12'));var authService=require(_0x5ea4('0x13'));var qs=require(_0x5ea4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ea4('0x15'));var logger=require('../../config/logger')(_0x5ea4('0x16'));var utils=require('../../config/utils');var config=require(_0x5ea4('0x17'));var licenseUtil=require(_0x5ea4('0x18'));var db=require(_0x5ea4('0x19'))['db'];function respondWithStatusCode(_0xeeb7ce,_0x141cd6){_0x141cd6=_0x141cd6||0xcc;return function(_0xcedc04){if(_0xcedc04){return _0xeeb7ce[_0x5ea4('0x1a')](_0x141cd6);}return _0xeeb7ce['status'](_0x141cd6)[_0x5ea4('0x1b')]();};}function respondWithResult(_0x44a529,_0x1434cb){_0x1434cb=_0x1434cb||0xc8;return function(_0x2f9115){if(_0x2f9115){return _0x44a529[_0x5ea4('0x1c')](_0x1434cb)[_0x5ea4('0x1d')](_0x2f9115);}};}function respondWithFilteredResult(_0x955c7b,_0x1e63ad){return function(_0x21efdb){if(_0x21efdb){var _0x92296=typeof _0x1e63ad[_0x5ea4('0x1e')]==='undefined'&&typeof _0x1e63ad[_0x5ea4('0x1f')]===_0x5ea4('0x20');var _0xf5e5a6=_0x21efdb[_0x5ea4('0x21')];var _0x17e4fc=_0x92296?0x0:_0x1e63ad[_0x5ea4('0x1e')];var _0x3a2567=_0x92296?_0x21efdb['count']:_0x1e63ad['offset']+_0x1e63ad[_0x5ea4('0x1f')];var _0x143b33;if(_0x3a2567>=_0xf5e5a6){_0x3a2567=_0xf5e5a6;_0x143b33=0xc8;}else{_0x143b33=0xce;}_0x955c7b[_0x5ea4('0x1c')](_0x143b33);return _0x955c7b[_0x5ea4('0x22')](_0x5ea4('0x23'),_0x17e4fc+'-'+_0x3a2567+'/'+_0xf5e5a6)[_0x5ea4('0x1d')](_0x21efdb);}return null;};}function patchUpdates(_0x25ab12){return function(_0x4201ce){try{jsonpatch[_0x5ea4('0x24')](_0x4201ce,_0x25ab12,!![]);}catch(_0x2b3ef4){return BPromise[_0x5ea4('0x25')](_0x2b3ef4);}return _0x4201ce[_0x5ea4('0x26')]();};}function saveUpdates(_0x4b6de1,_0x3cd1e1){return function(_0x4bf588){if(_0x4bf588){return _0x4bf588[_0x5ea4('0x27')](_0x4b6de1)[_0x5ea4('0x28')](function(_0x36b618){return _0x36b618;});}return null;};}function removeEntity(_0x22afc2,_0x2f673a){return function(_0x70eab6){if(_0x70eab6){return _0x70eab6['destroy']()[_0x5ea4('0x28')](function(){_0x22afc2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d692,_0x2bee2d){return function(_0x405585){if(!_0x405585){_0x29d692[_0x5ea4('0x1a')](0x194);}return _0x405585;};}function handleError(_0x3386ed,_0x48412d){_0x48412d=_0x48412d||0x1f4;return function(_0x14d875){logger[_0x5ea4('0x29')](_0x14d875[_0x5ea4('0x2a')]);if(_0x14d875[_0x5ea4('0x2b')]){delete _0x14d875[_0x5ea4('0x2b')];}_0x3386ed[_0x5ea4('0x1c')](_0x48412d)[_0x5ea4('0x2c')](_0x14d875);};}exports[_0x5ea4('0x2d')]=function(_0x5e6f76,_0x10c83e){var _0x7f72f4={},_0x350586={},_0x317ed0={'count':0x0,'rows':[]};var _0x528bb1=_['map'](db[_0x5ea4('0x2e')]['rawAttributes'],function(_0x51023f){return{'name':_0x51023f['fieldName'],'type':_0x51023f['type']['key']};});_0x350586['model']=_[_0x5ea4('0x2f')](_0x528bb1,_0x5ea4('0x2b'));_0x350586['query']=_[_0x5ea4('0x30')](_0x5e6f76[_0x5ea4('0x31')]);_0x350586[_0x5ea4('0x32')]=_['intersection'](_0x350586['model'],_0x350586[_0x5ea4('0x31')]);_0x7f72f4[_0x5ea4('0x33')]=_['intersection'](_0x350586['model'],qs['fields'](_0x5e6f76[_0x5ea4('0x31')]['fields']));_0x7f72f4[_0x5ea4('0x33')]=_0x7f72f4[_0x5ea4('0x33')][_0x5ea4('0x34')]?_0x7f72f4['attributes']:_0x350586['model'];if(!_0x5e6f76['query']['hasOwnProperty'](_0x5ea4('0x35'))){_0x7f72f4[_0x5ea4('0x1f')]=qs[_0x5ea4('0x1f')](_0x5e6f76[_0x5ea4('0x31')][_0x5ea4('0x1f')]);_0x7f72f4[_0x5ea4('0x1e')]=qs[_0x5ea4('0x1e')](_0x5e6f76[_0x5ea4('0x31')]['offset']);}_0x7f72f4[_0x5ea4('0x36')]=qs[_0x5ea4('0x37')](_0x5e6f76[_0x5ea4('0x31')][_0x5ea4('0x37')]);_0x7f72f4[_0x5ea4('0x38')]=qs[_0x5ea4('0x32')](_[_0x5ea4('0x39')](_0x5e6f76[_0x5ea4('0x31')],_0x350586[_0x5ea4('0x32')]),_0x528bb1);if(_0x5e6f76[_0x5ea4('0x31')]['filter']){_0x7f72f4[_0x5ea4('0x38')]=_['merge'](_0x7f72f4[_0x5ea4('0x38')],{'$or':_[_0x5ea4('0x2f')](_0x528bb1,function(_0x5abd3f){if(_0x5abd3f[_0x5ea4('0x3a')]!=='VIRTUAL'){var _0x289971={};_0x289971[_0x5abd3f[_0x5ea4('0x2b')]]={'$like':'%'+_0x5e6f76[_0x5ea4('0x31')][_0x5ea4('0x3b')]+'%'};return _0x289971;}})});}_0x7f72f4=_[_0x5ea4('0x3c')]({},_0x7f72f4,_0x5e6f76[_0x5ea4('0x3d')]);var _0x4e7a5c={'where':_0x7f72f4['where']};return db['VoiceDialReport'][_0x5ea4('0x21')](_0x4e7a5c)[_0x5ea4('0x28')](function(_0x5c8983){_0x317ed0[_0x5ea4('0x21')]=_0x5c8983;if(_0x5e6f76[_0x5ea4('0x31')][_0x5ea4('0x3e')]){_0x7f72f4['include']=[{'all':!![]}];}return db[_0x5ea4('0x2e')]['findAll'](_0x7f72f4);})['then'](function(_0x5dab60){_0x317ed0['rows']=_0x5dab60;return _0x317ed0;})[_0x5ea4('0x28')](respondWithFilteredResult(_0x10c83e,_0x7f72f4))[_0x5ea4('0x3f')](handleError(_0x10c83e,null));};exports[_0x5ea4('0x40')]=function(_0x3a3701,_0x3d5fd0){var _0x11ff2d={'raw':!![],'where':{'id':_0x3a3701[_0x5ea4('0x41')]['id']}},_0x25a642={};_0x25a642[_0x5ea4('0x42')]=_[_0x5ea4('0x30')](db['VoiceDialReport']['rawAttributes']);_0x25a642[_0x5ea4('0x31')]=_[_0x5ea4('0x30')](_0x3a3701[_0x5ea4('0x31')]);_0x25a642[_0x5ea4('0x32')]=_['intersection'](_0x25a642[_0x5ea4('0x42')],_0x25a642['query']);_0x11ff2d[_0x5ea4('0x33')]=_[_0x5ea4('0x43')](_0x25a642['model'],qs[_0x5ea4('0x44')](_0x3a3701['query']['fields']));_0x11ff2d[_0x5ea4('0x33')]=_0x11ff2d[_0x5ea4('0x33')]['length']?_0x11ff2d[_0x5ea4('0x33')]:_0x25a642[_0x5ea4('0x42')];if(_0x3a3701['query'][_0x5ea4('0x3e')]){_0x11ff2d[_0x5ea4('0x45')]=[{'all':!![]}];}_0x11ff2d=_[_0x5ea4('0x3c')]({},_0x11ff2d,_0x3a3701['options']);return db[_0x5ea4('0x2e')][_0x5ea4('0x46')](_0x11ff2d)[_0x5ea4('0x28')](handleEntityNotFound(_0x3d5fd0,null))[_0x5ea4('0x28')](respondWithResult(_0x3d5fd0,null))[_0x5ea4('0x3f')](handleError(_0x3d5fd0,null));};exports[_0x5ea4('0x47')]=function(_0x265ef0,_0x25b033){return db[_0x5ea4('0x2e')]['create'](_0x265ef0[_0x5ea4('0x48')],{})[_0x5ea4('0x28')](respondWithResult(_0x25b033,0xc9))[_0x5ea4('0x3f')](handleError(_0x25b033,null));};exports[_0x5ea4('0x27')]=function(_0x1f604e,_0x29dfbf){if(_0x1f604e[_0x5ea4('0x48')]['id']){delete _0x1f604e[_0x5ea4('0x48')]['id'];}return db[_0x5ea4('0x2e')][_0x5ea4('0x46')]({'where':{'id':_0x1f604e[_0x5ea4('0x41')]['id']}})[_0x5ea4('0x28')](handleEntityNotFound(_0x29dfbf,null))[_0x5ea4('0x28')](saveUpdates(_0x1f604e[_0x5ea4('0x48')],null))[_0x5ea4('0x28')](respondWithResult(_0x29dfbf,null))[_0x5ea4('0x3f')](handleError(_0x29dfbf,null));};exports[_0x5ea4('0x49')]=function(_0x37547d,_0x49aae8){return db[_0x5ea4('0x2e')][_0x5ea4('0x46')]({'where':{'id':_0x37547d[_0x5ea4('0x41')]['id']}})[_0x5ea4('0x28')](handleEntityNotFound(_0x49aae8,null))['then'](removeEntity(_0x49aae8,null))[_0x5ea4('0x3f')](handleError(_0x49aae8,null));};exports[_0x5ea4('0x4a')]=function(_0x110745,_0x256502){return db[_0x5ea4('0x2e')]['describe']()[_0x5ea4('0x28')](respondWithResult(_0x256502,null))[_0x5ea4('0x3f')](handleError(_0x256502,null));}; \ No newline at end of file +var _0x34c8=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','key','model','keys'];(function(_0x3eb578,_0x59e0af){var _0x7f3c90=function(_0x673688){while(--_0x673688){_0x3eb578['push'](_0x3eb578['shift']());}};_0x7f3c90(++_0x59e0af);}(_0x34c8,0xb2));var _0x834c=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x34c8[_0x2aea9e];return _0x430b92;};'use strict';var emlformat=require(_0x834c('0x0'));var rimraf=require(_0x834c('0x1'));var zipdir=require(_0x834c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834c('0x3'));var moment=require(_0x834c('0x4'));var BPromise=require(_0x834c('0x5'));var Mustache=require(_0x834c('0x6'));var util=require(_0x834c('0x7'));var path=require('path');var sox=require(_0x834c('0x8'));var csv=require('to-csv');var ejs=require(_0x834c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x834c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x834c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x834c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x834c('0xd'));var qs=require(_0x834c('0xe'));var as=require(_0x834c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x834c('0x10'))(_0x834c('0x11'));var utils=require(_0x834c('0x12'));var config=require(_0x834c('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ab64d,_0x504195){_0x504195=_0x504195||0xcc;return function(_0x2bc157){if(_0x2bc157){return _0x5ab64d[_0x834c('0x14')](_0x504195);}return _0x5ab64d[_0x834c('0x15')](_0x504195)[_0x834c('0x16')]();};}function respondWithResult(_0x5973d0,_0x57361d){_0x57361d=_0x57361d||0xc8;return function(_0x5b4c03){if(_0x5b4c03){return _0x5973d0['status'](_0x57361d)[_0x834c('0x17')](_0x5b4c03);}};}function respondWithFilteredResult(_0x1eea5c,_0x4d298e){return function(_0x55c98e){if(_0x55c98e){var _0x4b884e=typeof _0x4d298e[_0x834c('0x18')]===_0x834c('0x19')&&typeof _0x4d298e[_0x834c('0x1a')]==='undefined';var _0x39520c=_0x55c98e['count'];var _0xadbdab=_0x4b884e?0x0:_0x4d298e[_0x834c('0x18')];var _0x3e6322=_0x4b884e?_0x55c98e['count']:_0x4d298e[_0x834c('0x18')]+_0x4d298e[_0x834c('0x1a')];var _0x33e468;if(_0x3e6322>=_0x39520c){_0x3e6322=_0x39520c;_0x33e468=0xc8;}else{_0x33e468=0xce;}_0x1eea5c[_0x834c('0x15')](_0x33e468);return _0x1eea5c[_0x834c('0x1b')](_0x834c('0x1c'),_0xadbdab+'-'+_0x3e6322+'/'+_0x39520c)[_0x834c('0x17')](_0x55c98e);}return null;};}function patchUpdates(_0x896aed){return function(_0x58511e){try{jsonpatch[_0x834c('0x1d')](_0x58511e,_0x896aed,!![]);}catch(_0x30cc97){return BPromise[_0x834c('0x1e')](_0x30cc97);}return _0x58511e['save']();};}function saveUpdates(_0x3a868b,_0x2195d6){return function(_0x477a88){if(_0x477a88){return _0x477a88[_0x834c('0x1f')](_0x3a868b)[_0x834c('0x20')](function(_0xe399c1){return _0xe399c1;});}return null;};}function removeEntity(_0x3f442d,_0x23f65e){return function(_0x57b9a6){if(_0x57b9a6){return _0x57b9a6[_0x834c('0x21')]()[_0x834c('0x20')](function(){_0x3f442d[_0x834c('0x15')](0xcc)[_0x834c('0x16')]();});}};}function handleEntityNotFound(_0x262b01,_0x1f08f4){return function(_0x98db90){if(!_0x98db90){_0x262b01[_0x834c('0x14')](0x194);}return _0x98db90;};}function handleError(_0x9dbd12,_0xc3411){_0xc3411=_0xc3411||0x1f4;return function(_0x5999c6){logger[_0x834c('0x22')](_0x5999c6[_0x834c('0x23')]);if(_0x5999c6['name']){delete _0x5999c6[_0x834c('0x24')];}_0x9dbd12[_0x834c('0x15')](_0xc3411)[_0x834c('0x25')](_0x5999c6);};}exports[_0x834c('0x26')]=function(_0x5dc08c,_0x452a61){var _0x5b67f5={},_0x31e41f={},_0x52ae61={'count':0x0,'rows':[]};var _0x253669=_[_0x834c('0x27')](db[_0x834c('0x28')]['rawAttributes'],function(_0x225d60){return{'name':_0x225d60['fieldName'],'type':_0x225d60['type'][_0x834c('0x29')]};});_0x31e41f[_0x834c('0x2a')]=_[_0x834c('0x27')](_0x253669,_0x834c('0x24'));_0x31e41f['query']=_[_0x834c('0x2b')](_0x5dc08c[_0x834c('0x2c')]);_0x31e41f[_0x834c('0x2d')]=_[_0x834c('0x2e')](_0x31e41f[_0x834c('0x2a')],_0x31e41f[_0x834c('0x2c')]);_0x5b67f5[_0x834c('0x2f')]=_[_0x834c('0x2e')](_0x31e41f[_0x834c('0x2a')],qs[_0x834c('0x30')](_0x5dc08c[_0x834c('0x2c')][_0x834c('0x30')]));_0x5b67f5['attributes']=_0x5b67f5[_0x834c('0x2f')]['length']?_0x5b67f5[_0x834c('0x2f')]:_0x31e41f[_0x834c('0x2a')];if(!_0x5dc08c['query'][_0x834c('0x31')](_0x834c('0x32'))){_0x5b67f5['limit']=qs[_0x834c('0x1a')](_0x5dc08c[_0x834c('0x2c')][_0x834c('0x1a')]);_0x5b67f5['offset']=qs['offset'](_0x5dc08c[_0x834c('0x2c')]['offset']);}_0x5b67f5[_0x834c('0x33')]=qs['sort'](_0x5dc08c[_0x834c('0x2c')][_0x834c('0x34')]);_0x5b67f5[_0x834c('0x35')]=qs[_0x834c('0x2d')](_[_0x834c('0x36')](_0x5dc08c[_0x834c('0x2c')],_0x31e41f['filters']),_0x253669);if(_0x5dc08c[_0x834c('0x2c')][_0x834c('0x37')]){_0x5b67f5[_0x834c('0x35')]=_[_0x834c('0x38')](_0x5b67f5[_0x834c('0x35')],{'$or':_['map'](_0x253669,function(_0x2ec1cb){if(_0x2ec1cb[_0x834c('0x39')]!==_0x834c('0x3a')){var _0x974a0f={};_0x974a0f[_0x2ec1cb[_0x834c('0x24')]]={'$like':'%'+_0x5dc08c['query'][_0x834c('0x37')]+'%'};return _0x974a0f;}})});}_0x5b67f5=_[_0x834c('0x38')]({},_0x5b67f5,_0x5dc08c[_0x834c('0x3b')]);var _0x5cf079={'where':_0x5b67f5[_0x834c('0x35')]};return db[_0x834c('0x28')][_0x834c('0x3c')](_0x5cf079)[_0x834c('0x20')](function(_0x43dc3d){_0x52ae61['count']=_0x43dc3d;if(_0x5dc08c[_0x834c('0x2c')][_0x834c('0x3d')]){_0x5b67f5[_0x834c('0x3e')]=[{'all':!![]}];}return db[_0x834c('0x28')][_0x834c('0x3f')](_0x5b67f5);})[_0x834c('0x20')](function(_0x5c9bda){_0x52ae61[_0x834c('0x40')]=_0x5c9bda;return _0x52ae61;})[_0x834c('0x20')](respondWithFilteredResult(_0x452a61,_0x5b67f5))[_0x834c('0x41')](handleError(_0x452a61,null));};exports[_0x834c('0x42')]=function(_0x118914,_0x47c8fd){var _0x1cf02c={'raw':!![],'where':{'id':_0x118914[_0x834c('0x43')]['id']}},_0x4c93b5={};_0x4c93b5[_0x834c('0x2a')]=_[_0x834c('0x2b')](db[_0x834c('0x28')][_0x834c('0x44')]);_0x4c93b5[_0x834c('0x2c')]=_[_0x834c('0x2b')](_0x118914[_0x834c('0x2c')]);_0x4c93b5[_0x834c('0x2d')]=_[_0x834c('0x2e')](_0x4c93b5['model'],_0x4c93b5[_0x834c('0x2c')]);_0x1cf02c[_0x834c('0x2f')]=_['intersection'](_0x4c93b5[_0x834c('0x2a')],qs[_0x834c('0x30')](_0x118914[_0x834c('0x2c')][_0x834c('0x30')]));_0x1cf02c[_0x834c('0x2f')]=_0x1cf02c[_0x834c('0x2f')][_0x834c('0x45')]?_0x1cf02c['attributes']:_0x4c93b5[_0x834c('0x2a')];if(_0x118914['query'][_0x834c('0x3d')]){_0x1cf02c[_0x834c('0x3e')]=[{'all':!![]}];}_0x1cf02c=_[_0x834c('0x38')]({},_0x1cf02c,_0x118914['options']);return db[_0x834c('0x28')][_0x834c('0x46')](_0x1cf02c)[_0x834c('0x20')](handleEntityNotFound(_0x47c8fd,null))[_0x834c('0x20')](respondWithResult(_0x47c8fd,null))[_0x834c('0x41')](handleError(_0x47c8fd,null));};exports[_0x834c('0x47')]=function(_0x385df6,_0x5e300e){return db[_0x834c('0x28')][_0x834c('0x47')](_0x385df6[_0x834c('0x48')],{})[_0x834c('0x20')](respondWithResult(_0x5e300e,0xc9))[_0x834c('0x41')](handleError(_0x5e300e,null));};exports['update']=function(_0x5dbd02,_0x5af008){if(_0x5dbd02[_0x834c('0x48')]['id']){delete _0x5dbd02['body']['id'];}return db[_0x834c('0x28')]['find']({'where':{'id':_0x5dbd02[_0x834c('0x43')]['id']}})[_0x834c('0x20')](handleEntityNotFound(_0x5af008,null))[_0x834c('0x20')](saveUpdates(_0x5dbd02[_0x834c('0x48')],null))['then'](respondWithResult(_0x5af008,null))[_0x834c('0x41')](handleError(_0x5af008,null));};exports[_0x834c('0x21')]=function(_0x647cbb,_0x279676){return db[_0x834c('0x28')][_0x834c('0x46')]({'where':{'id':_0x647cbb[_0x834c('0x43')]['id']}})[_0x834c('0x20')](handleEntityNotFound(_0x279676,null))[_0x834c('0x20')](removeEntity(_0x279676,null))[_0x834c('0x41')](handleError(_0x279676,null));};exports[_0x834c('0x49')]=function(_0x3e4a51,_0x47b5b2){return db['VoiceDialReport'][_0x834c('0x49')]()[_0x834c('0x20')](respondWithResult(_0x47b5b2,null))[_0x834c('0x41')](handleError(_0x47b5b2,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5b27770..30e6807 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 _0xd55c=['lodash','util','../../config/logger','api','moment','path','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid'];(function(_0x44914d,_0x321bda){var _0x503f19=function(_0x1a376c){while(--_0x1a376c){_0x44914d['push'](_0x44914d['shift']());}};_0x503f19(++_0x321bda);}(_0xd55c,0x14a));var _0xcd55=function(_0x5f151f,_0x7720ab){_0x5f151f=_0x5f151f-0x0;var _0xe8fa25=_0xd55c[_0x5f151f];return _0xe8fa25;};'use strict';var _=require(_0xcd55('0x0'));var util=require(_0xcd55('0x1'));var logger=require(_0xcd55('0x2'))(_0xcd55('0x3'));var moment=require(_0xcd55('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd55('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcd55('0x6'));module[_0xcd55('0x7')]=function(_0x5b8a49,_0x46fa3d){return _0x5b8a49[_0xcd55('0x8')](_0xcd55('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xcd55('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x98d4=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment','bluebird','path'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x98d4,0xf6));var _0x498d=function(_0xa3b71c,_0x530eb2){_0xa3b71c=_0xa3b71c-0x0;var _0x545100=_0x98d4[_0xa3b71c];return _0x545100;};'use strict';var _=require(_0x498d('0x0'));var util=require(_0x498d('0x1'));var logger=require('../../config/logger')(_0x498d('0x2'));var moment=require(_0x498d('0x3'));var BPromise=require(_0x498d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x498d('0x5'));var rimraf=require(_0x498d('0x6'));var config=require(_0x498d('0x7'));var attributes=require(_0x498d('0x8'));module[_0x498d('0x9')]=function(_0x16979b,_0x540b60){return _0x16979b[_0x498d('0xa')](_0x498d('0xb'),attributes,{'tableName':_0x498d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x498d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6e46be4..1ec71f1 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 _0x1885=['jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x37dd5a,_0x4fc629){var _0x244812=function(_0x46211f){while(--_0x46211f){_0x37dd5a['push'](_0x37dd5a['shift']());}};_0x244812(++_0x4fc629);}(_0x1885,0x183));var _0x5188=function(_0x3daaf7,_0x4de0b4){_0x3daaf7=_0x3daaf7-0x0;var _0x14d95b=_0x1885[_0x3daaf7];return _0x14d95b;};'use strict';var _=require(_0x5188('0x0'));var util=require(_0x5188('0x1'));var moment=require(_0x5188('0x2'));var BPromise=require('bluebird');var rs=require(_0x5188('0x3'));var fs=require('fs');var Redis=require(_0x5188('0x4'));var db=require(_0x5188('0x5'))['db'];var utils=require(_0x5188('0x6'));var logger=require(_0x5188('0x7'))(_0x5188('0x8'));var config=require('../../config/environment');var jayson=require(_0x5188('0x9'));var client=jayson['client'][_0x5188('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x78224a,_0x213632,_0x404cb6){return new BPromise(function(_0x5eaf6c,_0xec449b){return client[_0x5188('0xb')](_0x78224a,_0x404cb6)[_0x5188('0xc')](function(_0x5e309a){logger[_0x5188('0xd')](_0x5188('0xe'),_0x213632,_0x5188('0xf'));logger[_0x5188('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x213632,_0x5188('0xf'),JSON[_0x5188('0x11')](_0x5e309a));if(_0x5e309a[_0x5188('0x12')]){if(_0x5e309a[_0x5188('0x12')][_0x5188('0x13')]===0x1f4){logger[_0x5188('0x12')](_0x5188('0xe'),_0x213632,_0x5e309a[_0x5188('0x12')]['message']);return _0xec449b(_0x5e309a[_0x5188('0x12')][_0x5188('0x14')]);}logger[_0x5188('0x12')](_0x5188('0xe'),_0x213632,_0x5e309a[_0x5188('0x12')][_0x5188('0x14')]);return _0x5eaf6c(_0x5e309a[_0x5188('0x12')]['message']);}else{logger[_0x5188('0xd')](_0x5188('0xe'),_0x213632,_0x5188('0xf'));_0x5eaf6c(_0x5e309a[_0x5188('0x15')]['message']);}})['catch'](function(_0x131c69){logger[_0x5188('0x12')](_0x5188('0xe'),_0x213632,_0x131c69);_0xec449b(_0x131c69);});});}exports['CreateVoiceDialReport']=function(_0x8faae5){var _0xcc1eec=this;return new Promise(function(_0x487e36,_0x5572a0){return db[_0x5188('0x16')][_0x5188('0x17')](_0x8faae5[_0x5188('0x18')],{'raw':_0x8faae5['options']?_0x8faae5[_0x5188('0x19')][_0x5188('0x1a')]===undefined?!![]:![]:!![]})[_0x5188('0xc')](function(_0xfbbc8d){logger[_0x5188('0xd')](_0x5188('0x1b'),_0x8faae5);logger['debug'](_0x5188('0x1b'),_0x8faae5,JSON[_0x5188('0x11')](_0xfbbc8d));_0x487e36(_0xfbbc8d);})[_0x5188('0x1c')](function(_0x3cfb1e){logger[_0x5188('0x12')](_0x5188('0x1b'),_0x3cfb1e[_0x5188('0x14')],_0x8faae5);_0x5572a0(_0xcc1eec[_0x5188('0x12')](0x1f4,_0x3cfb1e[_0x5188('0x14')]));});});};exports[_0x5188('0x1d')]=function(_0x2854a3){var _0x4e749f=this;return new Promise(function(_0x38b79a,_0x42f7e7){return db[_0x5188('0x16')][_0x5188('0x1e')](_0x2854a3[_0x5188('0x18')],{'raw':_0x2854a3[_0x5188('0x19')]?_0x2854a3[_0x5188('0x19')][_0x5188('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2854a3[_0x5188('0x19')]?_0x2854a3[_0x5188('0x19')][_0x5188('0x1f')]||null:null,'attributes':_0x2854a3[_0x5188('0x19')]?_0x2854a3[_0x5188('0x19')][_0x5188('0x20')]||null:null,'limit':_0x2854a3[_0x5188('0x19')]?_0x2854a3[_0x5188('0x19')]['limit']||null:null})[_0x5188('0xc')](function(_0x34d2ca){logger[_0x5188('0xd')](_0x5188('0x1d'),_0x2854a3);logger[_0x5188('0x10')]('UpdateVoiceDialReport',_0x2854a3,JSON[_0x5188('0x11')](_0x34d2ca));_0x38b79a(_0x34d2ca);})[_0x5188('0x1c')](function(_0x4c3a88){logger[_0x5188('0x12')]('UpdateVoiceDialReport',_0x4c3a88[_0x5188('0x14')],_0x2854a3);_0x42f7e7(_0x4e749f['error'](0x1f4,_0x4c3a88[_0x5188('0x14')]));});});}; \ No newline at end of file +var _0x90d2=['jayson/promise','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','options','raw','update','body','where','attributes','limit','debug','UpdateVoiceDialReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x15023f,_0x342b87){var _0x1d3400=function(_0x4408ac){while(--_0x4408ac){_0x15023f['push'](_0x15023f['shift']());}};_0x1d3400(++_0x342b87);}(_0x90d2,0x1aa));var _0x290d=function(_0x18b73e,_0x39b3f2){_0x18b73e=_0x18b73e-0x0;var _0x25fa91=_0x90d2[_0x18b73e];return _0x25fa91;};'use strict';var _=require('lodash');var util=require(_0x290d('0x0'));var moment=require(_0x290d('0x1'));var BPromise=require(_0x290d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x290d('0x3'));var db=require(_0x290d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x290d('0x5'))(_0x290d('0x6'));var config=require(_0x290d('0x7'));var jayson=require(_0x290d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b586c,_0x4f39bb,_0x5b5a11){return new BPromise(function(_0x4619be,_0x38c793){return client['request'](_0x2b586c,_0x5b5a11)[_0x290d('0x9')](function(_0x3efebe){logger[_0x290d('0xa')](_0x290d('0xb'),_0x4f39bb,_0x290d('0xc'));logger['debug'](_0x290d('0xd'),_0x4f39bb,_0x290d('0xc'),JSON[_0x290d('0xe')](_0x3efebe));if(_0x3efebe[_0x290d('0xf')]){if(_0x3efebe[_0x290d('0xf')][_0x290d('0x10')]===0x1f4){logger[_0x290d('0xf')](_0x290d('0xb'),_0x4f39bb,_0x3efebe[_0x290d('0xf')][_0x290d('0x11')]);return _0x38c793(_0x3efebe[_0x290d('0xf')]['message']);}logger[_0x290d('0xf')](_0x290d('0xb'),_0x4f39bb,_0x3efebe[_0x290d('0xf')][_0x290d('0x11')]);return _0x4619be(_0x3efebe[_0x290d('0xf')][_0x290d('0x11')]);}else{logger['info'](_0x290d('0xb'),_0x4f39bb,'request\x20sent');_0x4619be(_0x3efebe[_0x290d('0x12')][_0x290d('0x11')]);}})[_0x290d('0x13')](function(_0x3647fc){logger[_0x290d('0xf')](_0x290d('0xb'),_0x4f39bb,_0x3647fc);_0x38c793(_0x3647fc);});});}exports[_0x290d('0x14')]=function(_0x22644e){var _0x310efb=this;return new Promise(function(_0x9ae7b6,_0x1ab66f){return db['VoiceDialReport'][_0x290d('0x15')](_0x22644e['body'],{'raw':_0x22644e[_0x290d('0x16')]?_0x22644e['options'][_0x290d('0x17')]===undefined?!![]:![]:!![]})[_0x290d('0x9')](function(_0x36c5ee){logger[_0x290d('0xa')](_0x290d('0x14'),_0x22644e);logger['debug']('CreateVoiceDialReport',_0x22644e,JSON['stringify'](_0x36c5ee));_0x9ae7b6(_0x36c5ee);})['catch'](function(_0x1fda33){logger[_0x290d('0xf')](_0x290d('0x14'),_0x1fda33[_0x290d('0x11')],_0x22644e);_0x1ab66f(_0x310efb[_0x290d('0xf')](0x1f4,_0x1fda33['message']));});});};exports['UpdateVoiceDialReport']=function(_0x4dbcdf){var _0xf378f2=this;return new Promise(function(_0x5203b8,_0x1ed444){return db['VoiceDialReport'][_0x290d('0x18')](_0x4dbcdf[_0x290d('0x19')],{'raw':_0x4dbcdf[_0x290d('0x16')]?_0x4dbcdf[_0x290d('0x16')][_0x290d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dbcdf[_0x290d('0x16')]?_0x4dbcdf[_0x290d('0x16')][_0x290d('0x1a')]||null:null,'attributes':_0x4dbcdf['options']?_0x4dbcdf[_0x290d('0x16')][_0x290d('0x1b')]||null:null,'limit':_0x4dbcdf[_0x290d('0x16')]?_0x4dbcdf[_0x290d('0x16')][_0x290d('0x1c')]||null:null})[_0x290d('0x9')](function(_0x3cd2b6){logger[_0x290d('0xa')]('UpdateVoiceDialReport',_0x4dbcdf);logger[_0x290d('0x1d')](_0x290d('0x1e'),_0x4dbcdf,JSON['stringify'](_0x3cd2b6));_0x5203b8(_0x3cd2b6);})[_0x290d('0x13')](function(_0x8d2410){logger[_0x290d('0xf')](_0x290d('0x1e'),_0x8d2410['message'],_0x4dbcdf);_0x1ed444(_0xf378f2[_0x290d('0xf')](0x1f4,_0x8d2410[_0x290d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 67c1d09..79c9526 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 _0x889e=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','/:id','show','post','addApplications','put','delete','destroy','exports','util','connect-timeout'];(function(_0x312fca,_0xb8495b){var _0x36ccec=function(_0x1f4eed){while(--_0x1f4eed){_0x312fca['push'](_0x312fca['shift']());}};_0x36ccec(++_0xb8495b);}(_0x889e,0x1eb));var _0xe889=function(_0x30cb05,_0x2c8a67){_0x30cb05=_0x30cb05-0x0;var _0xd9a6e3=_0x889e[_0x30cb05];return _0xd9a6e3;};'use strict';var multer=require('multer');var util=require(_0xe889('0x0'));var path=require('path');var timeout=require(_0xe889('0x1'));var express=require(_0xe889('0x2'));var router=express['Router']();var fs_extra=require(_0xe889('0x3'));var auth=require(_0xe889('0x4'));var interaction=require(_0xe889('0x5'));var config=require(_0xe889('0x6'));var controller=require(_0xe889('0x7'));router['get']('/',auth[_0xe889('0x8')](),controller['index']);router['get'](_0xe889('0x9'),auth[_0xe889('0x8')](),controller[_0xe889('0xa')]);router[_0xe889('0xb')]('/',auth[_0xe889('0x8')](),controller['create']);router[_0xe889('0xb')]('/:id/applications',auth[_0xe889('0x8')](),controller[_0xe889('0xc')]);router[_0xe889('0xd')]('/:id',auth[_0xe889('0x8')](),controller['update']);router[_0xe889('0xe')](_0xe889('0x9'),auth[_0xe889('0x8')](),controller[_0xe889('0xf')]);module[_0xe889('0x10')]=router; \ No newline at end of file +var _0xd8f4=['index','isAuthenticated','show','post','create','addApplications','put','/:id','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x71aa20,_0x1c935b){var _0x5a2cbc=function(_0x440efd){while(--_0x440efd){_0x71aa20['push'](_0x71aa20['shift']());}};_0x5a2cbc(++_0x1c935b);}(_0xd8f4,0xbd));var _0x4d8f=function(_0x3fc8fd,_0x3d1544){_0x3fc8fd=_0x3fc8fd-0x0;var _0x111320=_0xd8f4[_0x3fc8fd];return _0x111320;};'use strict';var multer=require(_0x4d8f('0x0'));var util=require(_0x4d8f('0x1'));var path=require(_0x4d8f('0x2'));var timeout=require(_0x4d8f('0x3'));var express=require(_0x4d8f('0x4'));var router=express['Router']();var fs_extra=require(_0x4d8f('0x5'));var auth=require(_0x4d8f('0x6'));var interaction=require(_0x4d8f('0x7'));var config=require(_0x4d8f('0x8'));var controller=require(_0x4d8f('0x9'));router[_0x4d8f('0xa')]('/',auth['isAuthenticated'](),controller[_0x4d8f('0xb')]);router['get']('/:id',auth[_0x4d8f('0xc')](),controller[_0x4d8f('0xd')]);router[_0x4d8f('0xe')]('/',auth['isAuthenticated'](),controller[_0x4d8f('0xf')]);router['post']('/:id/applications',auth[_0x4d8f('0xc')](),controller[_0x4d8f('0x10')]);router[_0x4d8f('0x11')](_0x4d8f('0x12'),auth['isAuthenticated'](),controller[_0x4d8f('0x13')]);router['delete'](_0x4d8f('0x12'),auth[_0x4d8f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 89a95fb..034cfca 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 _0xde51=['any','*,*,*,*','INTEGER','BOOLEAN','wav','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','system'];(function(_0x5c0a44,_0x2874e6){var _0x3fe5b1=function(_0x33e1bd){while(--_0x33e1bd){_0x5c0a44['push'](_0x5c0a44['shift']());}};_0x3fe5b1(++_0x2874e6);}(_0xde51,0x1d6));var _0x1de5=function(_0x2a84d6,_0x538497){_0x2a84d6=_0x2a84d6-0x0;var _0x55c2ea=_0xde51[_0x2a84d6];return _0x55c2ea;};'use strict';var Sequelize=require('sequelize');module[_0x1de5('0x0')]={'context':{'type':Sequelize[_0x1de5('0x1')],'allowNull':![],'unique':_0x1de5('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1de5('0x1')],'allowNull':![],'unique':_0x1de5('0x2')},'priority':{'type':Sequelize[_0x1de5('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x1de5('0x2')},'tag':{'type':Sequelize[_0x1de5('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x1de5('0x1')],'allowNull':![],'defaultValue':_0x1de5('0x3')},'appdata':{'type':Sequelize[_0x1de5('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x1de5('0x4'),_0x1de5('0x5'),_0x1de5('0x6'),_0x1de5('0x7'),_0x1de5('0x8'),_0x1de5('0x9'),_0x1de5('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x1de5('0x1')]},'interval':{'type':Sequelize[_0x1de5('0x1')],'allowNull':![],'defaultValue':_0x1de5('0xb')},'IntervalId':{'type':Sequelize[_0x1de5('0xc')]},'isApp':{'type':Sequelize[_0x1de5('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1de5('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x1de5('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1de5('0xc')]},'recordingFormat':{'type':Sequelize[_0x1de5('0x1')],'defaultValue':_0x1de5('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4cfb2b){return this['getDataValue']('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xfcae=['exten','sequelize','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL'];(function(_0x10cb21,_0xf036f){var _0x94db5d=function(_0x329b2b){while(--_0x329b2b){_0x10cb21['push'](_0x10cb21['shift']());}};_0x94db5d(++_0xf036f);}(_0xfcae,0xb1));var _0xefca=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xfcae[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xefca('0x0'));module['exports']={'context':{'type':Sequelize[_0xefca('0x1')],'allowNull':![],'unique':_0xefca('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xefca('0x2')},'priority':{'type':Sequelize[_0xefca('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xefca('0x2')},'tag':{'type':Sequelize[_0xefca('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xefca('0x3')},'appdata':{'type':Sequelize[_0xefca('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xefca('0x4')]('inbound',_0xefca('0x5'),_0xefca('0x6'),_0xefca('0x7'),'outbound-fax',_0xefca('0x8'),_0xefca('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xefca('0x1')]},'interval':{'type':Sequelize[_0xefca('0x1')],'allowNull':![],'defaultValue':_0xefca('0xa')},'IntervalId':{'type':Sequelize[_0xefca('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xefca('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xefca('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xefca('0xb')]},'recordingFormat':{'type':Sequelize[_0xefca('0x1')],'defaultValue':_0xefca('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xefca('0xe')],'get':function(_0x4e40cb){return this['getDataValue'](_0xefca('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a7fd1e4..cc0e86d 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 _0x09ba=['startsWith','body','exten','concat','user','role','inbound','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','alias','context','addApplications','sequelize','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','priority','finally','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','find','type','name','destroy','then','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0x09ba,0xcf));var _0xa09b=function(_0x5bb736,_0x32c198){_0x5bb736=_0x5bb736-0x0;var _0x483aad=_0x09ba[_0x5bb736];return _0x483aad;};'use strict';var _=require(_0xa09b('0x0'));var Redis=require('ioredis');var qs=require(_0xa09b('0x1'));var logger=require('../../config/logger')(_0xa09b('0x2'));var config=require(_0xa09b('0x3'));var db=require(_0xa09b('0x4'))['db'];config['redis']=_[_0xa09b('0x5')](config[_0xa09b('0x6')],{'host':_0xa09b('0x7'),'port':0x18eb});var socket=require(_0xa09b('0x8'))(new Redis(config[_0xa09b('0x6')]));require(_0xa09b('0x9'))[_0xa09b('0xa')](socket);function respondWithStatusCode(_0xb36eb6,_0x52dc0f){_0x52dc0f=_0x52dc0f||0xcc;return function(_0x195e2a){if(_0x195e2a){return _0xb36eb6[_0xa09b('0xb')](_0x52dc0f);}return _0xb36eb6['status'](_0x52dc0f)[_0xa09b('0xc')]();};}function respondWithResult(_0x5dc646,_0x1e2f41){_0x1e2f41=_0x1e2f41||0xc8;return function(_0x5bf469){if(_0x5bf469){return _0x5dc646[_0xa09b('0xd')](_0x1e2f41)[_0xa09b('0xe')](_0x5bf469);}};}function respondWithFilteredResult(_0x51d50a,_0x2a0e96){return function(_0x38a9d1){if(_0x38a9d1){var _0x256458=typeof _0x2a0e96[_0xa09b('0xf')]==='undefined'&&typeof _0x2a0e96['limit']===_0xa09b('0x10');var _0x304d62=_0x38a9d1['count'];var _0x55bf9b=_0x256458?0x0:_0x2a0e96['offset'];var _0x573a59=_0x256458?_0x38a9d1[_0xa09b('0x11')]:_0x2a0e96[_0xa09b('0xf')]+_0x2a0e96['limit'];var _0x15b302;if(_0x573a59>=_0x304d62){_0x573a59=_0x304d62;_0x15b302=0xc8;}else{_0x15b302=0xce;}_0x51d50a[_0xa09b('0xd')](_0x15b302);return _0x51d50a[_0xa09b('0x12')](_0xa09b('0x13'),_0x55bf9b+'-'+_0x573a59+'/'+_0x304d62)[_0xa09b('0xe')](_0x38a9d1);}return null;};}function removeEntity(_0x50a32a){return function(_0x810368){if(_0x810368){return _0x810368['destroy']()['then'](function(){var _0x3f7ca0=_0x810368[_0xa09b('0x14')]({'plain':!![]});var _0x344739=[{'name':_0xa09b('0x15'),'value':'inbound','ignore':![]},{'name':_0xa09b('0x16'),'value':_0xa09b('0x17'),'ignore':![]},{'name':_0xa09b('0x18'),'value':_0xa09b('0x19'),'ignore':![]}];var _0x3ee38d=_(_0x344739)[_0xa09b('0x1a')](_0xa09b('0x1b'))['map'](_0xa09b('0x1c'))[_0xa09b('0x1c')]();if(_['includes'](_0x3ee38d,_0x3f7ca0['type'])){return;}var _0x4c926d=_[_0xa09b('0x1d')](_0x344739,['value',_0x3f7ca0[_0xa09b('0x1e')]])[_0xa09b('0x1f')];return db['UserProfileResource'][_0xa09b('0x20')]({'where':{'type':_0x4c926d,'resourceId':_0x3f7ca0['id']}})[_0xa09b('0x21')](function(){return _0x810368;});})[_0xa09b('0x21')](function(){_0x50a32a['status'](0xcc)[_0xa09b('0xc')]();});}};}function handleEntityNotFound(_0x5e7689){return function(_0x20f9a3){if(!_0x20f9a3){_0x5e7689['sendStatus'](0x194);}return _0x20f9a3;};}function handleError(_0x376310,_0x4b9cc6){_0x4b9cc6=_0x4b9cc6||0x1f4;return function(_0x223f50){logger[_0xa09b('0x22')](_0x223f50[_0xa09b('0x23')]);if(_0x223f50[_0xa09b('0x1f')]){delete _0x223f50[_0xa09b('0x1f')];}_0x376310[_0xa09b('0xd')](_0x4b9cc6)[_0xa09b('0x24')](_0x223f50);};}exports[_0xa09b('0x25')]=function(_0x57dfca,_0x3f360f){var _0x371671={},_0x34482b={},_0x35a96e={'count':0x0,'rows':[]};var _0x4e9310=_['map'](db[_0xa09b('0x26')][_0xa09b('0x27')],function(_0x4de27e){return{'name':_0x4de27e[_0xa09b('0x28')],'type':_0x4de27e['type']['key']};});_0x34482b[_0xa09b('0x29')]=_[_0xa09b('0x2a')](_0x4e9310,'name');_0x34482b[_0xa09b('0x2b')]=_[_0xa09b('0x2c')](_0x57dfca[_0xa09b('0x2b')]);_0x34482b[_0xa09b('0x2d')]=_[_0xa09b('0x2e')](_0x34482b[_0xa09b('0x29')],_0x34482b[_0xa09b('0x2b')]);_0x371671[_0xa09b('0x2f')]=_[_0xa09b('0x2e')](_0x34482b[_0xa09b('0x29')],qs['fields'](_0x57dfca[_0xa09b('0x2b')][_0xa09b('0x30')]));_0x371671[_0xa09b('0x2f')]=_0x371671[_0xa09b('0x2f')][_0xa09b('0x31')]?_0x371671[_0xa09b('0x2f')]:_0x34482b[_0xa09b('0x29')];if(!_0x57dfca[_0xa09b('0x2b')][_0xa09b('0x32')](_0xa09b('0x33'))){_0x371671[_0xa09b('0x34')]=qs['limit'](_0x57dfca[_0xa09b('0x2b')][_0xa09b('0x34')]);_0x371671['offset']=qs[_0xa09b('0xf')](_0x57dfca[_0xa09b('0x2b')][_0xa09b('0xf')]);}_0x371671[_0xa09b('0x35')]=qs[_0xa09b('0x36')](_0x57dfca[_0xa09b('0x2b')]['sort']);_0x371671['where']=qs[_0xa09b('0x2d')](_['pick'](_0x57dfca['query'],_0x34482b[_0xa09b('0x2d')]),_0x4e9310);if(_0x57dfca['query'][_0xa09b('0x1a')]){_0x371671['where']=_[_0xa09b('0x37')](_0x371671['where'],{'$or':_[_0xa09b('0x2a')](_0x4e9310,function(_0x45f482){if(_0x45f482[_0xa09b('0x1e')]!==_0xa09b('0x38')){var _0x1c8f9b={};_0x1c8f9b[_0x45f482[_0xa09b('0x1f')]]={'$like':'%'+_0x57dfca[_0xa09b('0x2b')][_0xa09b('0x1a')]+'%'};return _0x1c8f9b;}})});}_0x371671=_['merge']({},_0x371671,_0x57dfca['options']);var _0x165a3f={'where':_0x371671['where']};return db[_0xa09b('0x26')][_0xa09b('0x11')](_0x165a3f)['then'](function(_0x36bef1){_0x35a96e[_0xa09b('0x11')]=_0x36bef1;if(_0x57dfca['query']['includeAll']){_0x371671[_0xa09b('0x39')]=[{'all':!![]}];}return db[_0xa09b('0x26')][_0xa09b('0x3a')](_0x371671);})['then'](function(_0x4b6351){_0x35a96e[_0xa09b('0x3b')]=_0x4b6351;return _0x35a96e;})['then'](respondWithFilteredResult(_0x3f360f,_0x371671))[_0xa09b('0x3c')](handleError(_0x3f360f,null));};exports[_0xa09b('0x3d')]=function(_0x254aa3,_0x17ef27){var _0x27acbc={'raw':![],'where':{'id':_0x254aa3[_0xa09b('0x3e')]['id']}},_0x59e9b1={};_0x59e9b1[_0xa09b('0x29')]=_[_0xa09b('0x2c')](db[_0xa09b('0x26')][_0xa09b('0x27')]);_0x59e9b1['query']=_[_0xa09b('0x2c')](_0x254aa3[_0xa09b('0x2b')]);_0x59e9b1[_0xa09b('0x2d')]=_['intersection'](_0x59e9b1['model'],_0x59e9b1[_0xa09b('0x2b')]);_0x27acbc[_0xa09b('0x2f')]=_[_0xa09b('0x2e')](_0x59e9b1[_0xa09b('0x29')],qs['fields'](_0x254aa3[_0xa09b('0x2b')]['fields']));_0x27acbc[_0xa09b('0x2f')]=_0x27acbc['attributes'][_0xa09b('0x31')]?_0x27acbc[_0xa09b('0x2f')]:_0x59e9b1[_0xa09b('0x29')];if(_0x254aa3[_0xa09b('0x2b')][_0xa09b('0x3f')]){_0x27acbc[_0xa09b('0x39')]=[{'all':!![]}];}_0x27acbc=_[_0xa09b('0x37')]({},_0x27acbc,_0x254aa3[_0xa09b('0x40')]);return db[_0xa09b('0x26')][_0xa09b('0x1d')](_0x27acbc)[_0xa09b('0x21')](handleEntityNotFound(_0x17ef27,null))['then'](respondWithResult(_0x17ef27,null))[_0xa09b('0x3c')](handleError(_0x17ef27,null));};exports[_0xa09b('0x20')]=function(_0x316b65,_0x1816f1){return db[_0xa09b('0x26')][_0xa09b('0x1d')]({'where':{'id':_0x316b65[_0xa09b('0x3e')]['id']}})[_0xa09b('0x21')](handleEntityNotFound(_0x1816f1,null))[_0xa09b('0x21')](removeEntity(_0x1816f1,null))[_0xa09b('0x3c')](handleError(_0x1816f1,null));};exports[_0xa09b('0x41')]=function(_0x45f500,_0xfd8b26){if(_0x45f500['body'][_0xa09b('0x1e')]===_0xa09b('0x17')&&!_[_0xa09b('0x42')](_0x45f500[_0xa09b('0x43')]['exten'],'_')){_0x45f500[_0xa09b('0x43')][_0xa09b('0x44')]='_'[_0xa09b('0x45')](_0x45f500[_0xa09b('0x43')][_0xa09b('0x44')]);}return db[_0xa09b('0x26')][_0xa09b('0x41')](_0x45f500[_0xa09b('0x43')],{'raw':![]})['then'](function(_0x4997fe){var _0x2c4344=_0x45f500[_0xa09b('0x46')][_0xa09b('0x14')]({'plain':!![]});if(!_0x2c4344)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c4344[_0xa09b('0x47')]==='user'){var _0x935c7e=_0x4997fe[_0xa09b('0x14')]({'plain':!![]});var _0x288e52=[{'name':_0xa09b('0x15'),'value':_0xa09b('0x48')},{'name':_0xa09b('0x16'),'value':'outbound'},{'name':_0xa09b('0x18'),'value':_0xa09b('0x19')}];var _0x104491=_[_0xa09b('0x1d')](_0x288e52,[_0xa09b('0x1c'),_0x935c7e[_0xa09b('0x1e')]])[_0xa09b('0x1f')];return db['UserProfileSection'][_0xa09b('0x1d')]({'where':{'name':_0x104491,'userProfileId':_0x2c4344[_0xa09b('0x49')]},'raw':!![]})[_0xa09b('0x21')](function(_0x576b6f){if(_0x576b6f&&_0x576b6f['autoAssociation']===0x0){return db[_0xa09b('0x4a')][_0xa09b('0x41')]({'name':_0x935c7e[_0xa09b('0x1f')],'resourceId':_0x935c7e['id'],'type':_0x576b6f[_0xa09b('0x1f')],'sectionId':_0x576b6f['id']},{})[_0xa09b('0x21')](function(){return _0x4997fe;});}else{return _0x4997fe;}})['catch'](function(_0x23b804){logger['error'](_0xa09b('0x4b'),_0x23b804);throw _0x23b804;});}return _0x4997fe;})[_0xa09b('0x21')](respondWithResult(_0xfd8b26,0xc9))['catch'](handleError(_0xfd8b26,null));};exports[_0xa09b('0x4c')]=function(_0x16c18a,_0x39198a){if(_0x16c18a[_0xa09b('0x43')]['id']){delete _0x16c18a[_0xa09b('0x43')]['id'];}return db[_0xa09b('0x26')][_0xa09b('0x1d')]({'where':{'id':_0x16c18a[_0xa09b('0x3e')]['id']}})[_0xa09b('0x21')](handleEntityNotFound(_0x39198a,null))['then'](function(_0x4349d4){if(_0x4349d4){return db[_0xa09b('0x26')]['update'](_['pick'](_0x16c18a[_0xa09b('0x43')],[_0xa09b('0x44'),'context','description',_0xa09b('0x4d'),'cutdigits','mandatoryDisposition',_0xa09b('0x4e')]),{'where':{'context':_0x4349d4[_0xa09b('0x4f')],'exten':_0x4349d4['exten']},'individualHooks':!![]})[_0xa09b('0x21')](function(_0x267a87){return _0x267a87;});}return null;})[_0xa09b('0x21')](respondWithStatusCode(_0x39198a,null))[_0xa09b('0x3c')](handleError(_0x39198a,null));};exports[_0xa09b('0x50')]=function(_0x3b85fb,_0x552d03){var _0x3b5da3=_0x3b85fb[_0xa09b('0x3e')]['id'];var _0x33ccf0=_0x3b85fb[_0xa09b('0x43')];var _0x4905bc=0xc8;var _0x3cf7df=null;return db[_0xa09b('0x51')]['transaction']({'isolationLevel':db['sequelize'][_0xa09b('0x52')]['ISOLATION_LEVELS'][_0xa09b('0x53')]},function(_0x4e1c74){return db['VoiceExtension']['findOne']({'where':{'id':_0x3b5da3},'transaction':_0x4e1c74})[_0xa09b('0x21')](function(_0x53b7c0){if(_0x53b7c0){return db[_0xa09b('0x26')][_0xa09b('0x20')]({'where':{'VoiceExtensionId':_0x3b5da3},'transaction':_0x4e1c74})[_0xa09b('0x21')](function(){var _0x51c937=_[_0xa09b('0x2a')](_0x33ccf0,function(_0x2b590a){_0x2b590a[_0xa09b('0x54')]=_0x3b5da3;_0x2b590a[_0xa09b('0x55')]=!![];return _0x2b590a;});return _0x53b7c0[_0xa09b('0x56')](_0x51c937);})[_0xa09b('0x21')](function(_0x21ff5c){return db[_0xa09b('0x26')][_0xa09b('0x57')](_0x21ff5c,{'transaction':_0x4e1c74});});}else{_0x4905bc=0x194;_0x3cf7df=[];}});})[_0xa09b('0x21')](function(){if(_0x4905bc!==0x194){return db['VoiceExtension'][_0xa09b('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3b5da3},'order':_0xa09b('0x59')})[_0xa09b('0x21')](function(_0x29db11){_0x3cf7df=_0x29db11;});}})[_0xa09b('0x3c')](function(_0x435a63){_0x4905bc=0x1f4;logger[_0xa09b('0x22')](_0x435a63[_0xa09b('0x23')]);if(_0x435a63['name']){delete _0x435a63[_0xa09b('0x1f')];}_0x3cf7df=_0x435a63;})[_0xa09b('0x5a')](function(){if(_0x3cf7df===null){_0x552d03[_0xa09b('0xb')](_0x4905bc);}else{if(_0x4905bc===0x1f4){_0x552d03[_0xa09b('0xd')](_0x4905bc)[_0xa09b('0x24')](_0x3cf7df);}else{_0x552d03[_0xa09b('0xd')](_0x4905bc)[_0xa09b('0xe')](_0x3cf7df);}}});}; \ No newline at end of file +var _0x1aee=['concat','role','user','InboundRoutes','internal','find','UserProfileSection','userProfileId','autoAssociation','error','update','context','description','cutdigits','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','findAndCountAll','priority','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','name','UserProfileResource','stack','send','VoiceExtension','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten'];(function(_0x511324,_0x5b2951){var _0x493eb2=function(_0x545e00){while(--_0x545e00){_0x511324['push'](_0x511324['shift']());}};_0x493eb2(++_0x5b2951);}(_0x1aee,0x7b));var _0xe1ae=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x1aee[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0xe1ae('0x0'));var Redis=require(_0xe1ae('0x1'));var qs=require(_0xe1ae('0x2'));var logger=require(_0xe1ae('0x3'))(_0xe1ae('0x4'));var config=require(_0xe1ae('0x5'));var db=require(_0xe1ae('0x6'))['db'];config['redis']=_[_0xe1ae('0x7')](config['redis'],{'host':_0xe1ae('0x8'),'port':0x18eb});var socket=require(_0xe1ae('0x9'))(new Redis(config[_0xe1ae('0xa')]));require(_0xe1ae('0xb'))[_0xe1ae('0xc')](socket);function respondWithStatusCode(_0x11ee77,_0x5958b9){_0x5958b9=_0x5958b9||0xcc;return function(_0x20d780){if(_0x20d780){return _0x11ee77[_0xe1ae('0xd')](_0x5958b9);}return _0x11ee77[_0xe1ae('0xe')](_0x5958b9)[_0xe1ae('0xf')]();};}function respondWithResult(_0x18f203,_0xb03a53){_0xb03a53=_0xb03a53||0xc8;return function(_0x46b9a1){if(_0x46b9a1){return _0x18f203[_0xe1ae('0xe')](_0xb03a53)[_0xe1ae('0x10')](_0x46b9a1);}};}function respondWithFilteredResult(_0x1b6297,_0x343b09){return function(_0x35b1b8){if(_0x35b1b8){var _0x148c07=typeof _0x343b09[_0xe1ae('0x11')]===_0xe1ae('0x12')&&typeof _0x343b09[_0xe1ae('0x13')]==='undefined';var _0x331ab5=_0x35b1b8['count'];var _0x9d3eb3=_0x148c07?0x0:_0x343b09[_0xe1ae('0x11')];var _0x1c5719=_0x148c07?_0x35b1b8[_0xe1ae('0x14')]:_0x343b09[_0xe1ae('0x11')]+_0x343b09[_0xe1ae('0x13')];var _0x77adfe;if(_0x1c5719>=_0x331ab5){_0x1c5719=_0x331ab5;_0x77adfe=0xc8;}else{_0x77adfe=0xce;}_0x1b6297[_0xe1ae('0xe')](_0x77adfe);return _0x1b6297[_0xe1ae('0x15')]('Content-Range',_0x9d3eb3+'-'+_0x1c5719+'/'+_0x331ab5)[_0xe1ae('0x10')](_0x35b1b8);}return null;};}function removeEntity(_0x19d491){return function(_0x501f56){if(_0x501f56){return _0x501f56[_0xe1ae('0x16')]()[_0xe1ae('0x17')](function(){var _0x55ead0=_0x501f56[_0xe1ae('0x18')]({'plain':!![]});var _0x24cc9a=[{'name':'InboundRoutes','value':_0xe1ae('0x19'),'ignore':![]},{'name':_0xe1ae('0x1a'),'value':_0xe1ae('0x1b'),'ignore':![]},{'name':_0xe1ae('0x1c'),'value':'internal','ignore':![]}];var _0x6be98b=_(_0x24cc9a)[_0xe1ae('0x1d')](_0xe1ae('0x1e'))[_0xe1ae('0x1f')](_0xe1ae('0x20'))['value']();if(_[_0xe1ae('0x21')](_0x6be98b,_0x55ead0[_0xe1ae('0x22')])){return;}var _0x2d6c12=_['find'](_0x24cc9a,[_0xe1ae('0x20'),_0x55ead0[_0xe1ae('0x22')]])[_0xe1ae('0x23')];return db[_0xe1ae('0x24')]['destroy']({'where':{'type':_0x2d6c12,'resourceId':_0x55ead0['id']}})[_0xe1ae('0x17')](function(){return _0x501f56;});})[_0xe1ae('0x17')](function(){_0x19d491[_0xe1ae('0xe')](0xcc)[_0xe1ae('0xf')]();});}};}function handleEntityNotFound(_0x1f39cf){return function(_0x5066c0){if(!_0x5066c0){_0x1f39cf['sendStatus'](0x194);}return _0x5066c0;};}function handleError(_0x219af0,_0x45dbf9){_0x45dbf9=_0x45dbf9||0x1f4;return function(_0x5b81a4){logger['error'](_0x5b81a4[_0xe1ae('0x25')]);if(_0x5b81a4['name']){delete _0x5b81a4[_0xe1ae('0x23')];}_0x219af0[_0xe1ae('0xe')](_0x45dbf9)[_0xe1ae('0x26')](_0x5b81a4);};}exports['index']=function(_0x26826f,_0x268cc5){var _0x4d9e03={},_0x567873={},_0x35dc7a={'count':0x0,'rows':[]};var _0x21fd29=_[_0xe1ae('0x1f')](db[_0xe1ae('0x27')][_0xe1ae('0x28')],function(_0xaad2c1){return{'name':_0xaad2c1['fieldName'],'type':_0xaad2c1[_0xe1ae('0x22')][_0xe1ae('0x29')]};});_0x567873[_0xe1ae('0x2a')]=_[_0xe1ae('0x1f')](_0x21fd29,_0xe1ae('0x23'));_0x567873['query']=_[_0xe1ae('0x2b')](_0x26826f[_0xe1ae('0x2c')]);_0x567873['filters']=_[_0xe1ae('0x2d')](_0x567873[_0xe1ae('0x2a')],_0x567873[_0xe1ae('0x2c')]);_0x4d9e03[_0xe1ae('0x2e')]=_[_0xe1ae('0x2d')](_0x567873['model'],qs[_0xe1ae('0x2f')](_0x26826f[_0xe1ae('0x2c')][_0xe1ae('0x2f')]));_0x4d9e03['attributes']=_0x4d9e03[_0xe1ae('0x2e')][_0xe1ae('0x30')]?_0x4d9e03[_0xe1ae('0x2e')]:_0x567873[_0xe1ae('0x2a')];if(!_0x26826f[_0xe1ae('0x2c')]['hasOwnProperty'](_0xe1ae('0x31'))){_0x4d9e03[_0xe1ae('0x13')]=qs[_0xe1ae('0x13')](_0x26826f['query'][_0xe1ae('0x13')]);_0x4d9e03[_0xe1ae('0x11')]=qs['offset'](_0x26826f[_0xe1ae('0x2c')]['offset']);}_0x4d9e03[_0xe1ae('0x32')]=qs[_0xe1ae('0x33')](_0x26826f[_0xe1ae('0x2c')][_0xe1ae('0x33')]);_0x4d9e03[_0xe1ae('0x34')]=qs[_0xe1ae('0x35')](_[_0xe1ae('0x36')](_0x26826f[_0xe1ae('0x2c')],_0x567873[_0xe1ae('0x35')]),_0x21fd29);if(_0x26826f[_0xe1ae('0x2c')]['filter']){_0x4d9e03[_0xe1ae('0x34')]=_['merge'](_0x4d9e03['where'],{'$or':_[_0xe1ae('0x1f')](_0x21fd29,function(_0x111890){if(_0x111890[_0xe1ae('0x22')]!==_0xe1ae('0x37')){var _0x1d7db2={};_0x1d7db2[_0x111890[_0xe1ae('0x23')]]={'$like':'%'+_0x26826f[_0xe1ae('0x2c')]['filter']+'%'};return _0x1d7db2;}})});}_0x4d9e03=_[_0xe1ae('0x38')]({},_0x4d9e03,_0x26826f[_0xe1ae('0x39')]);var _0x7a1bf9={'where':_0x4d9e03['where']};return db['VoiceExtension'][_0xe1ae('0x14')](_0x7a1bf9)[_0xe1ae('0x17')](function(_0x512772){_0x35dc7a['count']=_0x512772;if(_0x26826f['query'][_0xe1ae('0x3a')]){_0x4d9e03[_0xe1ae('0x3b')]=[{'all':!![]}];}return db[_0xe1ae('0x27')][_0xe1ae('0x3c')](_0x4d9e03);})[_0xe1ae('0x17')](function(_0x4dc318){_0x35dc7a[_0xe1ae('0x3d')]=_0x4dc318;return _0x35dc7a;})[_0xe1ae('0x17')](respondWithFilteredResult(_0x268cc5,_0x4d9e03))[_0xe1ae('0x3e')](handleError(_0x268cc5,null));};exports[_0xe1ae('0x3f')]=function(_0x285a74,_0x272722){var _0x5d1dfd={'raw':![],'where':{'id':_0x285a74[_0xe1ae('0x40')]['id']}},_0x23dd45={};_0x23dd45[_0xe1ae('0x2a')]=_[_0xe1ae('0x2b')](db[_0xe1ae('0x27')][_0xe1ae('0x28')]);_0x23dd45['query']=_['keys'](_0x285a74[_0xe1ae('0x2c')]);_0x23dd45[_0xe1ae('0x35')]=_[_0xe1ae('0x2d')](_0x23dd45[_0xe1ae('0x2a')],_0x23dd45['query']);_0x5d1dfd[_0xe1ae('0x2e')]=_['intersection'](_0x23dd45[_0xe1ae('0x2a')],qs['fields'](_0x285a74[_0xe1ae('0x2c')][_0xe1ae('0x2f')]));_0x5d1dfd['attributes']=_0x5d1dfd[_0xe1ae('0x2e')]['length']?_0x5d1dfd['attributes']:_0x23dd45[_0xe1ae('0x2a')];if(_0x285a74[_0xe1ae('0x2c')][_0xe1ae('0x3a')]){_0x5d1dfd[_0xe1ae('0x3b')]=[{'all':!![]}];}_0x5d1dfd=_[_0xe1ae('0x38')]({},_0x5d1dfd,_0x285a74[_0xe1ae('0x39')]);return db['VoiceExtension']['find'](_0x5d1dfd)['then'](handleEntityNotFound(_0x272722,null))[_0xe1ae('0x17')](respondWithResult(_0x272722,null))[_0xe1ae('0x3e')](handleError(_0x272722,null));};exports[_0xe1ae('0x16')]=function(_0x43efcf,_0x2c1421){return db[_0xe1ae('0x27')]['find']({'where':{'id':_0x43efcf[_0xe1ae('0x40')]['id']}})[_0xe1ae('0x17')](handleEntityNotFound(_0x2c1421,null))[_0xe1ae('0x17')](removeEntity(_0x2c1421,null))['catch'](handleError(_0x2c1421,null));};exports[_0xe1ae('0x41')]=function(_0x57199b,_0x5b1b93){if(_0x57199b[_0xe1ae('0x42')][_0xe1ae('0x22')]==='outbound'&&!_[_0xe1ae('0x43')](_0x57199b[_0xe1ae('0x42')][_0xe1ae('0x44')],'_')){_0x57199b[_0xe1ae('0x42')][_0xe1ae('0x44')]='_'[_0xe1ae('0x45')](_0x57199b[_0xe1ae('0x42')][_0xe1ae('0x44')]);}return db[_0xe1ae('0x27')][_0xe1ae('0x41')](_0x57199b['body'],{'raw':![]})['then'](function(_0x2a6919){var _0x205b31=_0x57199b['user'][_0xe1ae('0x18')]({'plain':!![]});if(!_0x205b31)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x205b31[_0xe1ae('0x46')]===_0xe1ae('0x47')){var _0x29acee=_0x2a6919[_0xe1ae('0x18')]({'plain':!![]});var _0xbcebc=[{'name':_0xe1ae('0x48'),'value':_0xe1ae('0x19')},{'name':'OutboundRoutes','value':_0xe1ae('0x1b')},{'name':_0xe1ae('0x1c'),'value':_0xe1ae('0x49')}];var _0x2cb44e=_[_0xe1ae('0x4a')](_0xbcebc,[_0xe1ae('0x20'),_0x29acee['type']])[_0xe1ae('0x23')];return db[_0xe1ae('0x4b')][_0xe1ae('0x4a')]({'where':{'name':_0x2cb44e,'userProfileId':_0x205b31[_0xe1ae('0x4c')]},'raw':!![]})[_0xe1ae('0x17')](function(_0x2e1b9a){if(_0x2e1b9a&&_0x2e1b9a[_0xe1ae('0x4d')]===0x0){return db[_0xe1ae('0x24')][_0xe1ae('0x41')]({'name':_0x29acee[_0xe1ae('0x23')],'resourceId':_0x29acee['id'],'type':_0x2e1b9a[_0xe1ae('0x23')],'sectionId':_0x2e1b9a['id']},{})[_0xe1ae('0x17')](function(){return _0x2a6919;});}else{return _0x2a6919;}})[_0xe1ae('0x3e')](function(_0x22c31f){logger[_0xe1ae('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22c31f);throw _0x22c31f;});}return _0x2a6919;})[_0xe1ae('0x17')](respondWithResult(_0x5b1b93,0xc9))[_0xe1ae('0x3e')](handleError(_0x5b1b93,null));};exports[_0xe1ae('0x4f')]=function(_0x440750,_0x4d6a05){if(_0x440750[_0xe1ae('0x42')]['id']){delete _0x440750[_0xe1ae('0x42')]['id'];}return db['VoiceExtension'][_0xe1ae('0x4a')]({'where':{'id':_0x440750[_0xe1ae('0x40')]['id']}})[_0xe1ae('0x17')](handleEntityNotFound(_0x4d6a05,null))[_0xe1ae('0x17')](function(_0x332279){if(_0x332279){return db[_0xe1ae('0x27')][_0xe1ae('0x4f')](_['pick'](_0x440750['body'],['exten',_0xe1ae('0x50'),_0xe1ae('0x51'),'recordingFormat',_0xe1ae('0x52'),'mandatoryDisposition',_0xe1ae('0x53')]),{'where':{'context':_0x332279[_0xe1ae('0x50')],'exten':_0x332279[_0xe1ae('0x44')]},'individualHooks':!![]})[_0xe1ae('0x17')](function(_0x2a9240){return _0x2a9240;});}return null;})[_0xe1ae('0x17')](respondWithStatusCode(_0x4d6a05,null))[_0xe1ae('0x3e')](handleError(_0x4d6a05,null));};exports[_0xe1ae('0x54')]=function(_0xdbff88,_0xba1a8){var _0x5b3776=_0xdbff88['params']['id'];var _0xd4f159=_0xdbff88[_0xe1ae('0x42')];var _0x235e6a=0xc8;var _0x462994=null;return db[_0xe1ae('0x55')][_0xe1ae('0x56')]({'isolationLevel':db[_0xe1ae('0x55')][_0xe1ae('0x57')]['ISOLATION_LEVELS'][_0xe1ae('0x58')]},function(_0x4bec16){return db['VoiceExtension'][_0xe1ae('0x59')]({'where':{'id':_0x5b3776},'transaction':_0x4bec16})[_0xe1ae('0x17')](function(_0x35cd1b){if(_0x35cd1b){return db[_0xe1ae('0x27')][_0xe1ae('0x16')]({'where':{'VoiceExtensionId':_0x5b3776},'transaction':_0x4bec16})[_0xe1ae('0x17')](function(){var _0x2ce2e9=_[_0xe1ae('0x1f')](_0xd4f159,function(_0xec39b3){_0xec39b3['VoiceExtensionId']=_0x5b3776;_0xec39b3[_0xe1ae('0x5a')]=!![];return _0xec39b3;});return _0x35cd1b[_0xe1ae('0x5b')](_0x2ce2e9);})[_0xe1ae('0x17')](function(_0x31038f){return db['VoiceExtension'][_0xe1ae('0x5c')](_0x31038f,{'transaction':_0x4bec16});});}else{_0x235e6a=0x194;_0x462994=[];}});})[_0xe1ae('0x17')](function(){if(_0x235e6a!==0x194){return db[_0xe1ae('0x27')][_0xe1ae('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5b3776},'order':_0xe1ae('0x5e')})[_0xe1ae('0x17')](function(_0x4f2c49){_0x462994=_0x4f2c49;});}})['catch'](function(_0x48b67d){_0x235e6a=0x1f4;logger['error'](_0x48b67d[_0xe1ae('0x25')]);if(_0x48b67d['name']){delete _0x48b67d[_0xe1ae('0x23')];}_0x462994=_0x48b67d;})[_0xe1ae('0x5f')](function(){if(_0x462994===null){_0xba1a8[_0xe1ae('0xd')](_0x235e6a);}else{if(_0x235e6a===0x1f4){_0xba1a8[_0xe1ae('0xe')](_0x235e6a)[_0xe1ae('0x26')](_0x462994);}else{_0xba1a8[_0xe1ae('0xe')](_0x235e6a)['json'](_0x462994);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4f39307..00ae344 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 _0x4a2a=['exports','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x481f4d,_0x3e1188){var _0x4e7f9e=function(_0x4176b0){while(--_0x4176b0){_0x481f4d['push'](_0x481f4d['shift']());}};_0x4e7f9e(++_0x3e1188);}(_0x4a2a,0x111));var _0xa4a2=function(_0x586629,_0x3d2073){_0x586629=_0x586629-0x0;var _0x101f8b=_0x4a2a[_0x586629];return _0x101f8b;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xa4a2('0x0'))['db'][_0xa4a2('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa4a2('0x2')](0x0);var events={'afterCreate':_0xa4a2('0x3'),'afterUpdate':_0xa4a2('0x4'),'afterDestroy':_0xa4a2('0x5')};function emitEvent(_0x3013b7){return function(_0x1ba54a,_0x1350db,_0x1e6e18){VoiceExtensionEvents['emit'](_0x3013b7+':'+_0x1ba54a['id'],_0x1ba54a);VoiceExtensionEvents[_0xa4a2('0x6')](_0x3013b7,_0x1ba54a);_0x1e6e18(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xa4a2('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x9bf2=['update','remove','emit','hook','exports','events','VoiceExtension','setMaxListeners','save'];(function(_0x45370c,_0x4fa896){var _0x3aa71a=function(_0x40ce53){while(--_0x40ce53){_0x45370c['push'](_0x45370c['shift']());}};_0x3aa71a(++_0x4fa896);}(_0x9bf2,0x137));var _0x29bf=function(_0xdae077,_0x206a0b){_0xdae077=_0xdae077-0x0;var _0x3868e4=_0x9bf2[_0xdae077];return _0x3868e4;};'use strict';var EventEmitter=require(_0x29bf('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x29bf('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x29bf('0x2')](0x0);var events={'afterCreate':_0x29bf('0x3'),'afterUpdate':_0x29bf('0x4'),'afterDestroy':_0x29bf('0x5')};function emitEvent(_0x404555){return function(_0x3ebc43,_0x50e655,_0x42b5ca){VoiceExtensionEvents[_0x29bf('0x6')](_0x404555+':'+_0x3ebc43['id'],_0x3ebc43);VoiceExtensionEvents[_0x29bf('0x6')](_0x404555,_0x3ebc43);_0x42b5ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x29bf('0x7')](e,emitEvent(event));}}module[_0x29bf('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 deb96c1..147f10f 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 _0xf380=['playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','./voiceExtension.attributes','models','type','Set','CDR(type)=','exten','alias','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','url','length','phone','prefix','split','SIP','join','options','param','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','IntervalId','then','interval','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xf380,0xb9));var _0x0f38=function(_0x2ff752,_0x36ca9b){_0x2ff752=_0x2ff752-0x0;var _0xb3472e=_0xf380[_0x2ff752];return _0xb3472e;};'use strict';var _=require('lodash');var attributes=require(_0x0f38('0x0'));module['exports']=function(_0x45c305){var _0x5ce271=_0x45c305[_0x0f38('0x1')];function _0x1c3fba(_0x3bb0e3){var _0x38db31=0x2;var _0x2ad344=[{'type':_0x3bb0e3[_0x0f38('0x2')],'app':_0x0f38('0x3'),'appdata':_0x0f38('0x4')+_0x3bb0e3[_0x0f38('0x2')],'context':_0x3bb0e3['context'],'exten':_0x3bb0e3[_0x0f38('0x5')],'priority':_0x38db31++,'VoiceExtensionId':_0x3bb0e3['id']},{'type':_0x3bb0e3[_0x0f38('0x2')],'app':_0x3bb0e3[_0x0f38('0x6')]?_0x0f38('0x3'):'NoOp','appdata':_0x3bb0e3[_0x0f38('0x6')]?'CDR(routeAlias)='+_0x3bb0e3[_0x0f38('0x6')]:'No\x20alias\x20set','context':_0x3bb0e3[_0x0f38('0x7')],'exten':_0x3bb0e3[_0x0f38('0x5')],'priority':_0x38db31++,'VoiceExtensionId':_0x3bb0e3['id']}];if(_0x3bb0e3[_0x0f38('0x2')]===_0x0f38('0x8')){_0x2ad344[_0x0f38('0x9')]({'type':_0x0f38('0x8'),'app':_0x0f38('0x3'),'appdata':_0x0f38('0xa')+_0x3bb0e3['id'],'context':_0x3bb0e3[_0x0f38('0x7')],'exten':_0x3bb0e3['exten'],'priority':_0x38db31++,'VoiceExtensionId':_0x3bb0e3['id']});}_0x2ad344[_0x0f38('0x9')]({'type':_0x3bb0e3[_0x0f38('0x2')],'app':_0x0f38('0x3'),'appdata':_0x0f38('0xb'),'context':_0x3bb0e3['context'],'exten':_0x3bb0e3[_0x0f38('0x5')],'priority':_0x38db31++,'VoiceExtensionId':_0x3bb0e3['id']},{'type':_0x3bb0e3[_0x0f38('0x2')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3bb0e3[_0x0f38('0x7')],'exten':_0x3bb0e3[_0x0f38('0x5')],'priority':_0x38db31++,'VoiceExtensionId':_0x3bb0e3['id']},{'type':_0x3bb0e3[_0x0f38('0x2')],'app':_0x0f38('0x3'),'appdata':_0x0f38('0xc'),'context':_0x3bb0e3[_0x0f38('0x7')],'exten':_0x3bb0e3[_0x0f38('0x5')],'priority':_0x38db31++,'VoiceExtensionId':_0x3bb0e3['id']});return _0x2ad344;}function _0x24dd33(_0x5c1c5d){var _0x23ec13=0x2;var _0xe27f6=[{'type':_0x0f38('0xd'),'app':'Set','appdata':_0x0f38('0xe'),'context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':_0x5c1c5d[_0x0f38('0x6')]?_0x0f38('0x3'):_0x0f38('0xf'),'appdata':_0x5c1c5d['alias']?'CDR(routeAlias)='+_0x5c1c5d[_0x0f38('0x6')]:'No\x20alias\x20set','context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':_0x0f38('0x3'),'appdata':_0x0f38('0x10')+(_0x5c1c5d['cutdigits']?_0x0f38('0x11')+_0x5c1c5d[_0x0f38('0x12')]+'}':_0x0f38('0x13')),'context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d['exten'],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':_0x0f38('0x3'),'appdata':_0x0f38('0xa')+_0x5c1c5d['id'],'context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':_0x0f38('0x14'),'appdata':_0x0f38('0x15')+(_0x23ec13+0x2)+_0x0f38('0x16')+(_0x23ec13+0x1)+')','context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':_0x0f38('0x3'),'appdata':_0x5c1c5d[_0x0f38('0x12')]?'CDR(prefix)=${EXTEN:0:'+_0x5c1c5d[_0x0f38('0x12')]+'}':_0x0f38('0x17'),'context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':'Set','appdata':_0x0f38('0xb'),'context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':'Set','appdata':_0x0f38('0x18'),'context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d['exten'],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':_0x0f38('0x3'),'appdata':_0x0f38('0x19')+_0x5c1c5d['id'],'context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d['exten'],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']}];if(_0x5c1c5d[_0x0f38('0x1a')](_0x0f38('0x1b'))&&_0x5c1c5d[_0x0f38('0x1b')]!=='none'){_0xe27f6[_0x0f38('0x9')]({'type':'outbound','app':_0x0f38('0x3'),'appdata':_0x0f38('0x1c'),'context':_0x5c1c5d['context'],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']},{'type':_0x0f38('0xd'),'app':_0x0f38('0x3'),'appdata':_0x0f38('0x1d')+_0x5c1c5d[_0x0f38('0x1b')]||_0x0f38('0x1e'),'context':_0x5c1c5d[_0x0f38('0x7')],'exten':_0x5c1c5d[_0x0f38('0x5')],'priority':_0x23ec13++,'VoiceExtensionId':_0x5c1c5d['id']});}return _0xe27f6;}function _0x1a0d07(_0xd9d43d,_0x347f40){var _0x44a6a3=[{'name':_0x0f38('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x0f38('0x20'),'param':0x3}];var _0x22dbe2={};var _0x270465=_0x347f40['split'](',');var _0x4f83d4=[];for(var _0x1ca380=0x0;_0x1ca380<_0x44a6a3[_0x0f38('0x21')];_0x1ca380++){switch(_0x44a6a3[_0x1ca380]['name']){case'trunk':_0x22dbe2['trunk']=_0x270465[_0x44a6a3[_0x1ca380]['param']]['split']('/')[0x1];_0x22dbe2[_0x0f38('0x22')]=_0x270465[_0x44a6a3[_0x1ca380]['param']]['split']('/')[0x2];_0x22dbe2[_0x0f38('0x23')]=_0x22dbe2[_0x0f38('0x22')]?_0x22dbe2[_0x0f38('0x22')][_0x0f38('0x24')]('$')[0x0]:undefined;_0x22dbe2[_0x0f38('0x22')]=_0xd9d43d[_0x0f38('0x12')]?(_0x22dbe2[_0x0f38('0x23')]||'')+_0x0f38('0x11')+_0xd9d43d[_0x0f38('0x12')]+'}':(_0x22dbe2[_0x0f38('0x23')]||'')+'${EXTEN}';_0x4f83d4[_0x44a6a3[_0x1ca380]['param']]=[_0x0f38('0x25'),_0x22dbe2[_0x0f38('0x1f')],_0x22dbe2[_0x0f38('0x22')]][_0x0f38('0x26')]('/');break;case _0x0f38('0x27'):_0x22dbe2[_0x0f38('0x27')]=_0x270465[_0x44a6a3[_0x1ca380][_0x0f38('0x28')]];if(_0xd9d43d[_0x0f38('0x1b')]!=='none'){if(_0x22dbe2['options']['indexOf'](_0x0f38('0x29'))<0x0){_0x22dbe2[_0x0f38('0x27')]+=_0x0f38('0x29');}}else{_0x22dbe2[_0x0f38('0x27')]=_0x22dbe2[_0x0f38('0x27')][_0x0f38('0x2a')](_0x0f38('0x29'),'');}_0x4f83d4[_0x44a6a3[_0x1ca380][_0x0f38('0x28')]]=_0x22dbe2[_0x0f38('0x27')];break;default:_0x4f83d4[_0x44a6a3[_0x1ca380][_0x0f38('0x28')]]=_0x270465[_0x44a6a3[_0x1ca380][_0x0f38('0x28')]];}}return _0x4f83d4[_0x0f38('0x26')](',');}function _0x35e8f1(_0x4ade0d,_0x531ac5,_0x459713){return new Promise(function(_0xd1fb45,_0x1a837e){var _0x459867=[];if(_[_0x0f38('0x2b')](_0x531ac5))return _0xd1fb45(_0x459867);_0x5ce271['Interval'][_0x0f38('0x2c')]({'attributes':['id','interval',_0x0f38('0x2d')],'raw':!![]})[_0x0f38('0x2e')](function(_0x476a66){for(var _0x338c65=0x0,_0x1f1627=0x0;_0x338c65<_0x531ac5[_0x0f38('0x21')];_0x338c65++,_0x1f1627=0x0){var _0x1a529a=_0x531ac5[_0x338c65];var _0x14702c=[];var _0x11de74=[];delete _0x1a529a['id'];if(_0x1a529a[_0x0f38('0x2f')]!=='*,*,*,*'){_0x1a529a[_0x0f38('0x30')]=[_0x1a529a['interval']];}else{_0x1a529a[_0x0f38('0x30')]=_0x1a529a[_0x0f38('0x2d')]?_[_0x0f38('0x31')](_['filter'](_0x476a66,{'IntervalId':_0x1a529a[_0x0f38('0x2d')]}),_0x0f38('0x2f')):[];}_0x1a529a[_0x0f38('0x7')]=_0x4ade0d[_0x0f38('0x7')];_0x1a529a[_0x0f38('0x5')]=_0x4ade0d[_0x0f38('0x5')];if(_0x1a529a[_0x0f38('0x2')])_0x1a529a[_0x0f38('0x2')]=_0x1a529a[_0x0f38('0x2')][_0x0f38('0x32')]();if(_0x4ade0d['type']==='outbound'){if(_0x1a529a[_0x0f38('0x1a')](_0x0f38('0x33'))&&_0x1a529a[_0x0f38('0x33')]&&_0x1a529a['tag']!=='--'){_0x14702c['push']({'type':_0x1a529a[_0x0f38('0x2')][_0x0f38('0x32')](),'app':_0x0f38('0x3'),'appdata':_0x0f38('0x34')+_0x1a529a[_0x0f38('0x33')],'context':_0x4ade0d[_0x0f38('0x7')],'exten':_0x4ade0d['exten'],'priority':_0x1a529a[_0x0f38('0x30')][_0x0f38('0x21')]+_0x459713+_0x1f1627++,'VoiceExtensionId':_0x4ade0d['id']});}_0x14702c[_0x0f38('0x9')]({'type':_0x1a529a[_0x0f38('0x2')][_0x0f38('0x32')](),'app':_0x0f38('0x14'),'appdata':_0x0f38('0x35')+(_0x1a529a[_0x0f38('0x36')]?_0x0f38('0x37')+_0x1a529a[_0x0f38('0x36')]+')':_0x0f38('0x38')),'context':_0x4ade0d[_0x0f38('0x7')],'exten':_0x4ade0d[_0x0f38('0x5')],'priority':_0x1a529a[_0x0f38('0x30')][_0x0f38('0x21')]+_0x459713+_0x1f1627++,'VoiceExtensionId':_0x4ade0d['id']});}else{if(_0x1a529a[_0x0f38('0x1a')]('answer')){if([_0x0f38('0x39'),_0x0f38('0x3a')][_0x0f38('0x3b')](_0x1a529a[_0x0f38('0x3c')][_0x0f38('0x32')]())&&_0x1a529a[_0x0f38('0x3d')]!==_0x0f38('0x3e')){if(_0x1a529a[_0x0f38('0x3f')]){_0x14702c[_0x0f38('0x9')]({'type':_0x1a529a['type'][_0x0f38('0x32')](),'app':_0x0f38('0x14'),'appdata':_0x0f38('0x40'),'context':_0x4ade0d[_0x0f38('0x7')],'exten':_0x4ade0d['exten'],'priority':_0x1a529a[_0x0f38('0x30')]['length']+_0x459713+_0x1f1627++,'VoiceExtensionId':_0x4ade0d['id']});_0x14702c[_0x0f38('0x9')]({'type':_0x1a529a[_0x0f38('0x2')][_0x0f38('0x32')](),'app':'Set','appdata':_0x0f38('0x41'),'context':_0x4ade0d[_0x0f38('0x7')],'exten':_0x4ade0d[_0x0f38('0x5')],'priority':_0x1a529a[_0x0f38('0x30')][_0x0f38('0x21')]+_0x459713+_0x1f1627++,'VoiceExtensionId':_0x4ade0d['id']});}else{_0x14702c[_0x0f38('0x9')]({'type':_0x1a529a[_0x0f38('0x2')][_0x0f38('0x32')](),'app':_0x0f38('0x14'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4ade0d[_0x0f38('0x7')],'exten':_0x4ade0d['exten'],'priority':_0x1a529a[_0x0f38('0x30')][_0x0f38('0x21')]+_0x459713+_0x1f1627++,'VoiceExtensionId':_0x4ade0d['id']});_0x14702c[_0x0f38('0x9')]({'type':_0x1a529a[_0x0f38('0x2')]['toLowerCase'](),'app':_0x0f38('0x3'),'appdata':_0x0f38('0x42'),'context':_0x4ade0d['context'],'exten':_0x4ade0d[_0x0f38('0x5')],'priority':_0x1a529a[_0x0f38('0x30')][_0x0f38('0x21')]+_0x459713+_0x1f1627++,'VoiceExtensionId':_0x4ade0d['id']});}}}}for(var _0xfc82a0=0x0;_0xfc82a0<_0x1a529a[_0x0f38('0x30')][_0x0f38('0x21')];_0xfc82a0++){var _0x3c4682=_0x459713+_0x1a529a[_0x0f38('0x30')][_0x0f38('0x21')];var _0x55eacf=_0xfc82a0===_0x1a529a[_0x0f38('0x30')][_0x0f38('0x21')]-0x1?_0x459713+_0x14702c[_0x0f38('0x21')]+_0x11de74[_0x0f38('0x21')]+0x2:_0x459713+_0xfc82a0+0x1;_0x14702c[_0x0f38('0x43')](_0xfc82a0,0x0,{'type':_0x4ade0d[_0x0f38('0x2')],'app':_0x0f38('0x44'),'appdata':_0x1a529a['intervals'][_0xfc82a0]+'?'+_0x4ade0d[_0x0f38('0x7')]+_0x0f38('0x45')+_0x3c4682+':'+_0x4ade0d[_0x0f38('0x7')]+',${EXTEN},'+_0x55eacf,'exten':_0x4ade0d[_0x0f38('0x5')],'context':_0x4ade0d['context'],'priority':_0x459713+_0xfc82a0,'VoiceExtensionId':_0x4ade0d['id']});}if(_0x1a529a[_0x0f38('0x3d')]===_0x0f38('0x46'))_0x1a529a[_0x0f38('0x47')]=_0x1a0d07(_0x4ade0d,_0x1a529a[_0x0f38('0x47')]);_0x1a529a[_0x0f38('0x48')]=_0x14702c[_0x0f38('0x21')]?_[_0x0f38('0x49')](_0x14702c)[_0x0f38('0x48')]+0x1:_0x459713;_0x459867=_['concat'](_0x459867,_0x14702c,[_0x1a529a],_0x11de74);_0x459713=_[_0x0f38('0x49')](_0x459867)[_0x0f38('0x48')]+0x1;}return _0xd1fb45(_0x459867);})[_0x0f38('0x4a')](function(_0x20f214){_0x1a837e(_0x20f214);});});}return _0x45c305[_0x0f38('0x4b')](_0x0f38('0x4c'),attributes,{'tableName':_0x0f38('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x316380){var _0x24493e=this[_0x0f38('0x4e')]({'plain':!![]});var _0x5e399c=_0x24493e[_0x0f38('0x2')]===_0x0f38('0xd')?_0x24dd33(_0x24493e):_0x1c3fba(_0x24493e);return _0x35e8f1(_0x24493e,_0x316380,_['last'](_0x5e399c)[_0x0f38('0x48')]+0x1)[_0x0f38('0x2e')](function(_0x22a2a5){var _0x5b9d23=_[_0x0f38('0x4f')](_0x5e399c,_0x22a2a5);_0x5b9d23[_0x0f38('0x9')]({'type':_0x24493e[_0x0f38('0x2')],'app':_0x0f38('0x50'),'exten':_0x24493e[_0x0f38('0x5')],'context':_0x24493e[_0x0f38('0x7')],'priority':_[_0x0f38('0x49')](_0x5b9d23)[_0x0f38('0x48')]+0x1,'VoiceExtensionId':_0x24493e['id']});return _0x5b9d23;});}}});}; \ No newline at end of file +var _0x649b=['appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','exports','type','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','exten','inbound','push','Set','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','length','name','param','split','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial'];(function(_0x21a33e,_0x818168){var _0x40b07f=function(_0x282f45){while(--_0x282f45){_0x21a33e['push'](_0x21a33e['shift']());}};_0x40b07f(++_0x818168);}(_0x649b,0x166));var _0xb649=function(_0x149643,_0x9fef37){_0x149643=_0x149643-0x0;var _0x4bda3a=_0x649b[_0x149643];return _0x4bda3a;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0xb649('0x0')]=function(_0x1fd3a2){var _0x4ede93=_0x1fd3a2['models'];function _0xd0360e(_0x54800b){var _0x9422ae=0x2;var _0x20a3fd=[{'type':_0x54800b[_0xb649('0x1')],'app':'Set','appdata':_0xb649('0x2')+_0x54800b[_0xb649('0x1')],'context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b['exten'],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b['type'],'app':_0x54800b[_0xb649('0x4')]?'Set':_0xb649('0x5'),'appdata':_0x54800b[_0xb649('0x4')]?_0xb649('0x6')+_0x54800b[_0xb649('0x4')]:'No\x20alias\x20set','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']}];if(_0x54800b[_0xb649('0x1')]===_0xb649('0x8')){_0x20a3fd['push']({'type':_0xb649('0x8'),'app':'Set','appdata':'CDR(routeid)='+_0x54800b['id'],'context':_0x54800b['context'],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']});}_0x20a3fd[_0xb649('0x9')]({'type':_0x54800b[_0xb649('0x1')],'app':_0xb649('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b[_0xb649('0x1')],'app':'Set','appdata':_0xb649('0xb'),'context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b[_0xb649('0x1')],'app':_0xb649('0xa'),'appdata':'MONITOR_OPTIONS=ab','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']});return _0x20a3fd;}function _0x11e3c9(_0x5e455a){var _0x36c236=0x2;var _0x1030c6=[{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0xb649('0xd'),'context':_0x5e455a['context'],'exten':_0x5e455a['exten'],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0x5e455a[_0xb649('0x4')]?_0xb649('0xa'):_0xb649('0x5'),'appdata':_0x5e455a[_0xb649('0x4')]?_0xb649('0x6')+_0x5e455a[_0xb649('0x4')]:_0xb649('0xe'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':'Set','appdata':_0xb649('0xf')+(_0x5e455a[_0xb649('0x10')]?_0xb649('0x11')+_0x5e455a[_0xb649('0x10')]+'}':'${EXTEN}'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x12')+_0x5e455a['id'],'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0x13'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x36c236+0x2)+'):Goto('+(_0x36c236+0x1)+')','context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0x5e455a['cutdigits']?_0xb649('0x14')+_0x5e455a[_0xb649('0x10')]+'}':_0xb649('0x15'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0x16'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0xb'),'context':_0x5e455a['context'],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x17'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0xb649('0x18')+_0x5e455a['id'],'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']}];if(_0x5e455a[_0xb649('0x19')](_0xb649('0x1a'))&&_0x5e455a[_0xb649('0x1a')]!==_0xb649('0x1b')){_0x1030c6['push']({'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0x1c'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x1d')+_0x5e455a['recordingFormat']||_0xb649('0x1e'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']});}return _0x1030c6;}function _0x31a574(_0x384520,_0x1356ec){var _0x4c991d=[{'name':_0xb649('0x1f'),'param':0x0},{'name':_0xb649('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0xb649('0x21'),'param':0x3}];var _0x35dd88={};var _0x2a3883=_0x1356ec['split'](',');var _0x32bce9=[];for(var _0x127ed3=0x0;_0x127ed3<_0x4c991d[_0xb649('0x22')];_0x127ed3++){switch(_0x4c991d[_0x127ed3][_0xb649('0x23')]){case _0xb649('0x1f'):_0x35dd88[_0xb649('0x1f')]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]][_0xb649('0x25')]('/')[0x1];_0x35dd88[_0xb649('0x26')]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]][_0xb649('0x25')]('/')[0x2];_0x35dd88[_0xb649('0x27')]=_0x35dd88[_0xb649('0x26')]?_0x35dd88[_0xb649('0x26')]['split']('$')[0x0]:undefined;_0x35dd88[_0xb649('0x26')]=_0x384520[_0xb649('0x10')]?(_0x35dd88[_0xb649('0x27')]||'')+'${EXTEN:'+_0x384520[_0xb649('0x10')]+'}':(_0x35dd88[_0xb649('0x27')]||'')+'${EXTEN}';_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=[_0xb649('0x28'),_0x35dd88[_0xb649('0x1f')],_0x35dd88[_0xb649('0x26')]][_0xb649('0x29')]('/');break;case'options':_0x35dd88['options']=_0x2a3883[_0x4c991d[_0x127ed3]['param']];if(_0x384520[_0xb649('0x1a')]!==_0xb649('0x1b')){if(_0x35dd88[_0xb649('0x2a')][_0xb649('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x35dd88[_0xb649('0x2a')]+=_0xb649('0x2c');}}else{_0x35dd88['options']=_0x35dd88[_0xb649('0x2a')][_0xb649('0x2d')](_0xb649('0x2c'),'');}_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=_0x35dd88[_0xb649('0x2a')];break;default:_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]];}}return _0x32bce9[_0xb649('0x29')](',');}function _0x1c75bd(_0x47feb1,_0x112f2f,_0x49e6ea){return new Promise(function(_0x228a60,_0x36eb4d){var _0x5d6b5f=[];if(_[_0xb649('0x2e')](_0x112f2f))return _0x228a60(_0x5d6b5f);_0x4ede93[_0xb649('0x2f')][_0xb649('0x30')]({'attributes':['id',_0xb649('0x31'),_0xb649('0x32')],'raw':!![]})[_0xb649('0x33')](function(_0x305750){for(var _0x48aa9b=0x0,_0x90c06d=0x0;_0x48aa9b<_0x112f2f[_0xb649('0x22')];_0x48aa9b++,_0x90c06d=0x0){var _0x37dbfa=_0x112f2f[_0x48aa9b];var _0x170ce6=[];var _0x3092e2=[];delete _0x37dbfa['id'];if(_0x37dbfa['interval']!==_0xb649('0x34')){_0x37dbfa['intervals']=[_0x37dbfa['interval']];}else{_0x37dbfa[_0xb649('0x35')]=_0x37dbfa[_0xb649('0x32')]?_[_0xb649('0x36')](_[_0xb649('0x37')](_0x305750,{'IntervalId':_0x37dbfa[_0xb649('0x32')]}),'interval'):[];}_0x37dbfa[_0xb649('0x3')]=_0x47feb1[_0xb649('0x3')];_0x37dbfa[_0xb649('0x7')]=_0x47feb1[_0xb649('0x7')];if(_0x37dbfa['type'])_0x37dbfa['type']=_0x37dbfa[_0xb649('0x1')]['toLowerCase']();if(_0x47feb1[_0xb649('0x1')]===_0xb649('0xc')){if(_0x37dbfa[_0xb649('0x19')](_0xb649('0x38'))&&_0x37dbfa['tag']&&_0x37dbfa[_0xb649('0x38')]!=='--'){_0x170ce6['push']({'type':_0x37dbfa['type']['toLowerCase'](),'app':_0xb649('0xa'),'appdata':_0xb649('0x39')+_0x37dbfa[_0xb649('0x38')],'context':_0x47feb1['context'],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}_0x170ce6[_0xb649('0x9')]({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0x13'),'appdata':_0xb649('0x3b')+(_0x37dbfa[_0xb649('0x3c')]?_0xb649('0x3d')+_0x37dbfa['callerID']+')':_0xb649('0x3e')),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}else{if(_0x37dbfa['hasOwnProperty'](_0xb649('0x3f'))){if([_0xb649('0x40'),_0xb649('0x41')][_0xb649('0x42')](_0x37dbfa[_0xb649('0x43')][_0xb649('0x3a')]())&&_0x37dbfa[_0xb649('0x44')]!==_0xb649('0x45')){if(_0x37dbfa[_0xb649('0x3f')]){_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0x13'),'appdata':_0xb649('0x46'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1['exten'],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':'Set','appdata':_0xb649('0x47'),'context':_0x47feb1['context'],'exten':_0x47feb1['exten'],'priority':_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}else{_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':'ExecIf','appdata':_0xb649('0x48'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa['intervals'][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});_0x170ce6[_0xb649('0x9')]({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0xa'),'appdata':_0xb649('0x49'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}}}}for(var _0x1cdc67=0x0;_0x1cdc67<_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')];_0x1cdc67++){var _0x39cf25=_0x49e6ea+_0x37dbfa['intervals'][_0xb649('0x22')];var _0x440fbf=_0x1cdc67===_0x37dbfa['intervals'][_0xb649('0x22')]-0x1?_0x49e6ea+_0x170ce6[_0xb649('0x22')]+_0x3092e2[_0xb649('0x22')]+0x2:_0x49e6ea+_0x1cdc67+0x1;_0x170ce6[_0xb649('0x4a')](_0x1cdc67,0x0,{'type':_0x47feb1[_0xb649('0x1')],'app':'GotoIfTime','appdata':_0x37dbfa[_0xb649('0x35')][_0x1cdc67]+'?'+_0x47feb1['context']+_0xb649('0x4b')+_0x39cf25+':'+_0x47feb1['context']+_0xb649('0x4b')+_0x440fbf,'exten':_0x47feb1['exten'],'context':_0x47feb1['context'],'priority':_0x49e6ea+_0x1cdc67,'VoiceExtensionId':_0x47feb1['id']});}if(_0x37dbfa['appType']===_0xb649('0x4c'))_0x37dbfa[_0xb649('0x4d')]=_0x31a574(_0x47feb1,_0x37dbfa['appdata']);_0x37dbfa[_0xb649('0x4e')]=_0x170ce6['length']?_[_0xb649('0x4f')](_0x170ce6)[_0xb649('0x4e')]+0x1:_0x49e6ea;_0x5d6b5f=_[_0xb649('0x50')](_0x5d6b5f,_0x170ce6,[_0x37dbfa],_0x3092e2);_0x49e6ea=_['last'](_0x5d6b5f)[_0xb649('0x4e')]+0x1;}return _0x228a60(_0x5d6b5f);})[_0xb649('0x51')](function(_0x5467fd){_0x36eb4d(_0x5467fd);});});}return _0x1fd3a2[_0xb649('0x52')](_0xb649('0x53'),attributes,{'tableName':_0xb649('0x54'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x166c62){var _0x30461e=this[_0xb649('0x55')]({'plain':!![]});var _0x5bb222=_0x30461e[_0xb649('0x1')]===_0xb649('0xc')?_0x11e3c9(_0x30461e):_0xd0360e(_0x30461e);return _0x1c75bd(_0x30461e,_0x166c62,_[_0xb649('0x4f')](_0x5bb222)[_0xb649('0x4e')]+0x1)[_0xb649('0x33')](function(_0x2fffd3){var _0x468040=_[_0xb649('0x50')](_0x5bb222,_0x2fffd3);_0x468040[_0xb649('0x9')]({'type':_0x30461e[_0xb649('0x1')],'app':_0xb649('0x56'),'exten':_0x30461e[_0xb649('0x7')],'context':_0x30461e['context'],'priority':_[_0xb649('0x4f')](_0x468040)[_0xb649('0x4e')]+0x1,'VoiceExtensionId':_0x30461e['id']});return _0x468040;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 534ab40..3025d0f 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 _0x56a4=['model','stringify','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','raw','options','limit','include','map','attributes'];(function(_0x22bc48,_0x59b5ee){var _0x545e3a=function(_0x2c07ec){while(--_0x2c07ec){_0x22bc48['push'](_0x22bc48['shift']());}};_0x545e3a(++_0x59b5ee);}(_0x56a4,0x11b));var _0x456a=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0x56a4[_0x4f4c53];return _0x568ff1;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x456a('0xa')],{'host':_0x456a('0xb'),'port':0x18eb});var socket=require(_0x456a('0xc'))(new Redis(config['redis']));require(_0x456a('0xd'))['register'](socket);function respondWithRpcPromise(_0xb56df,_0x29073f,_0x3bb712){return new BPromise(function(_0x3b57ac,_0x2706a7){return client[_0x456a('0xe')](_0xb56df,_0x3bb712)[_0x456a('0xf')](function(_0xe60506){logger[_0x456a('0x10')](_0x456a('0x11'),_0x29073f,_0x456a('0x12'));logger['debug'](_0x456a('0x13'),_0x29073f,'request\x20sent',JSON['stringify'](_0xe60506));if(_0xe60506[_0x456a('0x14')]){if(_0xe60506[_0x456a('0x14')][_0x456a('0x15')]===0x1f4){logger[_0x456a('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);return _0x2706a7(_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);}logger[_0x456a('0x14')](_0x456a('0x11'),_0x29073f,_0xe60506['error'][_0x456a('0x16')]);return _0x3b57ac(_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);}else{logger[_0x456a('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0x456a('0x12'));_0x3b57ac(_0xe60506[_0x456a('0x17')][_0x456a('0x16')]);}})['catch'](function(_0x3d06b4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x29073f,_0x3d06b4);_0x2706a7(_0x3d06b4);});});}exports[_0x456a('0x18')]=function(_0x562cfa){var _0x44d79a=this;return new Promise(function(_0x4b48bf,_0x962b6d){return db[_0x456a('0x19')]['findAll']({'raw':_0x562cfa['options']?_0x562cfa['options'][_0x456a('0x1a')]===undefined?!![]:![]:!![],'where':_0x562cfa[_0x456a('0x1b')]?_0x562cfa[_0x456a('0x1b')]['where']||null:null,'attributes':_0x562cfa[_0x456a('0x1b')]?_0x562cfa['options']['attributes']||null:null,'limit':_0x562cfa['options']?_0x562cfa[_0x456a('0x1b')][_0x456a('0x1c')]||null:null,'include':_0x562cfa[_0x456a('0x1b')]?_0x562cfa['options'][_0x456a('0x1d')]?_[_0x456a('0x1e')](_0x562cfa['options'][_0x456a('0x1d')],function(_0x561097){return{'model':db[_0x561097['model']],'as':_0x561097['as'],'attributes':_0x561097[_0x456a('0x1f')],'include':_0x561097['include']?_[_0x456a('0x1e')](_0x561097['include'],function(_0x1ee212){return{'model':db[_0x1ee212[_0x456a('0x20')]],'as':_0x1ee212['as'],'attributes':_0x1ee212[_0x456a('0x1f')],'include':_0x1ee212[_0x456a('0x1d')]?_[_0x456a('0x1e')](_0x1ee212[_0x456a('0x1d')],function(_0x46f3b3){return{'model':db[_0x46f3b3[_0x456a('0x20')]],'as':_0x46f3b3['as'],'attributes':_0x46f3b3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48205d){logger[_0x456a('0x10')](_0x456a('0x18'),_0x562cfa);logger['debug'](_0x456a('0x18'),_0x562cfa,JSON[_0x456a('0x21')](_0x48205d));_0x4b48bf(_0x48205d);})[_0x456a('0x22')](function(_0x336993){logger[_0x456a('0x14')]('GetVoiceExtension',_0x336993[_0x456a('0x16')],_0x562cfa);_0x962b6d(_0x44d79a[_0x456a('0x14')](0x1f4,_0x336993[_0x456a('0x16')]));});});}; \ No newline at end of file +var _0x5353=['raw','where','limit','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./voiceExtension.socket','register','request','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','info','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','options'];(function(_0x5ebf5d,_0x26b9db){var _0x5f5c47=function(_0x536fcb){while(--_0x536fcb){_0x5ebf5d['push'](_0x5ebf5d['shift']());}};_0x5f5c47(++_0x26b9db);}(_0x5353,0x12f));var _0x3535=function(_0x4f7cf9,_0x201b84){_0x4f7cf9=_0x4f7cf9-0x0;var _0x488cb1=_0x5353[_0x4f7cf9];return _0x488cb1;};'use strict';var _=require(_0x3535('0x0'));var util=require('util');var moment=require(_0x3535('0x1'));var BPromise=require(_0x3535('0x2'));var rs=require(_0x3535('0x3'));var fs=require('fs');var Redis=require(_0x3535('0x4'));var db=require(_0x3535('0x5'))['db'];var utils=require(_0x3535('0x6'));var logger=require(_0x3535('0x7'))(_0x3535('0x8'));var config=require(_0x3535('0x9'));var jayson=require(_0x3535('0xa'));var client=jayson['client'][_0x3535('0xb')]({'port':0x232a});config['redis']=_[_0x3535('0xc')](config[_0x3535('0xd')],{'host':_0x3535('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3535('0xd')]));require(_0x3535('0xf'))[_0x3535('0x10')](socket);function respondWithRpcPromise(_0xc5edc4,_0x6a429b,_0x3cfb11){return new BPromise(function(_0x5ca511,_0x73c90c){return client[_0x3535('0x11')](_0xc5edc4,_0x3cfb11)['then'](function(_0x3889b6){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x6a429b,_0x3535('0x12'));logger[_0x3535('0x13')](_0x3535('0x14'),_0x6a429b,_0x3535('0x12'),JSON[_0x3535('0x15')](_0x3889b6));if(_0x3889b6[_0x3535('0x16')]){if(_0x3889b6[_0x3535('0x16')]['code']===0x1f4){logger[_0x3535('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x6a429b,_0x3889b6[_0x3535('0x16')][_0x3535('0x17')]);return _0x73c90c(_0x3889b6[_0x3535('0x16')]['message']);}logger[_0x3535('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x6a429b,_0x3889b6[_0x3535('0x16')]['message']);return _0x5ca511(_0x3889b6['error'][_0x3535('0x17')]);}else{logger[_0x3535('0x18')](_0x3535('0x19'),_0x6a429b,_0x3535('0x12'));_0x5ca511(_0x3889b6[_0x3535('0x1a')][_0x3535('0x17')]);}})[_0x3535('0x1b')](function(_0x10a897){logger[_0x3535('0x16')](_0x3535('0x19'),_0x6a429b,_0x10a897);_0x73c90c(_0x10a897);});});}exports[_0x3535('0x1c')]=function(_0x3739a9){var _0x578763=this;return new Promise(function(_0x57ccd4,_0xfea414){return db['VoiceExtension']['findAll']({'raw':_0x3739a9[_0x3535('0x1d')]?_0x3739a9[_0x3535('0x1d')][_0x3535('0x1e')]===undefined?!![]:![]:!![],'where':_0x3739a9['options']?_0x3739a9['options'][_0x3535('0x1f')]||null:null,'attributes':_0x3739a9['options']?_0x3739a9[_0x3535('0x1d')]['attributes']||null:null,'limit':_0x3739a9[_0x3535('0x1d')]?_0x3739a9['options'][_0x3535('0x20')]||null:null,'include':_0x3739a9['options']?_0x3739a9['options'][_0x3535('0x21')]?_[_0x3535('0x22')](_0x3739a9['options'][_0x3535('0x21')],function(_0x213f35){return{'model':db[_0x213f35[_0x3535('0x23')]],'as':_0x213f35['as'],'attributes':_0x213f35[_0x3535('0x24')],'include':_0x213f35['include']?_[_0x3535('0x22')](_0x213f35[_0x3535('0x21')],function(_0x177ecd){return{'model':db[_0x177ecd[_0x3535('0x23')]],'as':_0x177ecd['as'],'attributes':_0x177ecd[_0x3535('0x24')],'include':_0x177ecd[_0x3535('0x21')]?_[_0x3535('0x22')](_0x177ecd[_0x3535('0x21')],function(_0x4c993a){return{'model':db[_0x4c993a[_0x3535('0x23')]],'as':_0x4c993a['as'],'attributes':_0x4c993a[_0x3535('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2594d7){logger[_0x3535('0x18')](_0x3535('0x1c'),_0x3739a9);logger['debug']('GetVoiceExtension',_0x3739a9,JSON[_0x3535('0x15')](_0x2594d7));_0x57ccd4(_0x2594d7);})[_0x3535('0x1b')](function(_0x5918e4){logger[_0x3535('0x16')](_0x3535('0x1c'),_0x5918e4[_0x3535('0x17')],_0x3739a9);_0xfea414(_0x578763[_0x3535('0x16')](0x1f4,_0x5918e4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8f42caa..b32f557 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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x4c1c90,_0x5df03b){var _0xba124d=function(_0x4c76c9){while(--_0x4c76c9){_0x4c1c90['push'](_0x4c1c90['shift']());}};_0xba124d(++_0x5df03b);}(_0x5fab,0x177));var _0xb5fa=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x5fab[_0x7d62cb];return _0x3a6266;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x3b7df2,_0x471eee){var _0x4f0911=function(_0x38a53a){while(--_0x38a53a){_0x3b7df2['push'](_0x3b7df2['shift']());}};_0x4f0911(++_0x471eee);}(_0xabce,0x103));var _0xeabc=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xabce[_0x32d457];return _0x338386;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d4a38d8..f530346 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 _0x7b84=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x597e02,_0x44fa23){var _0x899e5b=function(_0x15e3c1){while(--_0x15e3c1){_0x597e02['push'](_0x597e02['shift']());}};_0x899e5b(++_0x44fa23);}(_0x7b84,0x17c));var _0x47b8=function(_0x37fe83,_0x4a8ce2){_0x37fe83=_0x37fe83-0x0;var _0xd06263=_0x7b84[_0x37fe83];return _0xd06263;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0x11')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0x15')](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);module[_0x47b8('0x17')]=router; \ No newline at end of file +var _0x5496=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get','isAuthenticated','show','getMessages','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x8d0299,_0x53861b){var _0x3434d7=function(_0x9d8cb2){while(--_0x9d8cb2){_0x8d0299['push'](_0x8d0299['shift']());}};_0x3434d7(++_0x53861b);}(_0x5496,0x175));var _0x6549=function(_0x2625c3,_0x2a6c8f){_0x2625c3=_0x2625c3-0x0;var _0x30139c=_0x5496[_0x2625c3];return _0x30139c;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id/messages',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')]('/',auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router[_0x6549('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6549('0x11')]);router[_0x6549('0x12')](_0x6549('0x13'),auth[_0x6549('0xb')](),controller[_0x6549('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 69aae21..92b71f6 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 _0xa5ab=['yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM'];(function(_0x17d56c,_0x5ef81f){var _0x2164e2=function(_0x3887fb){while(--_0x3887fb){_0x17d56c['push'](_0x17d56c['shift']());}};_0x2164e2(++_0x5ef81f);}(_0xa5ab,0xb7));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xba5a('0x0')]},'context':{'type':Sequelize[_0xba5a('0x0')],'defaultValue':_0xba5a('0x1'),'unique':_0xba5a('0x2')},'mailbox':{'type':Sequelize[_0xba5a('0x0')],'defaultValue':'','allowNull':![],'unique':_0xba5a('0x2')},'password':{'type':Sequelize[_0xba5a('0x0')]},'fullname':{'type':Sequelize[_0xba5a('0x0')]},'email':{'type':Sequelize[_0xba5a('0x0')],'validate':{'isEmail':!![]},'set':function(_0x1e6d81){this[_0xba5a('0x3')](_0xba5a('0x4'),typeof _0x1e6d81===_0xba5a('0x5')&&_0x1e6d81[_0xba5a('0x6')]()?_0x1e6d81['trim']():null);}},'pager':{'type':Sequelize[_0xba5a('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xba5a('0x7')},'attach':{'type':Sequelize[_0xba5a('0x8')]('yes','no'),'defaultValue':_0xba5a('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xba5a('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xba5a('0x0')]},'callback':{'type':Sequelize[_0xba5a('0x0')]},'review':{'type':Sequelize[_0xba5a('0x8')](_0xba5a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xba5a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xba5a('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xba5a('0x8')](_0xba5a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xba5a('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xba5a('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xba5a('0x8')](_0xba5a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xba5a('0x8')](_0xba5a('0x9'),'no'),'defaultValue':_0xba5a('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xba5a('0x8')](_0xba5a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xba5a('0x8')](_0xba5a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xba5a('0x8')](_0xba5a('0x9'),'no'),'defaultValue':_0xba5a('0x9'),'allowNull':![]},'stamp':{'type':_0xba5a('0xb')},'emailsubject':{'type':Sequelize[_0xba5a('0x0')]},'emailbody':{'type':Sequelize[_0xba5a('0x0')]},'maxsecs':{'type':Sequelize[_0xba5a('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xba5a('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xba5a('0xd')],'get':function(){return this['getDataValue']('fullname')+_0xba5a('0xe')+this['getDataValue'](_0xba5a('0xf'));}}}; \ No newline at end of file +var _0x7908=['string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','sequelize','STRING','contest_mailbox','email'];(function(_0x1c1f32,_0x5a78ef){var _0x3741b9=function(_0x1c6b83){while(--_0x1c6b83){_0x1c1f32['push'](_0x1c1f32['shift']());}};_0x3741b9(++_0x5a78ef);}(_0x7908,0x13e));var _0x8790=function(_0x8c9a85,_0x41a83e){_0x8c9a85=_0x8c9a85-0x0;var _0x126984=_0x7908[_0x8c9a85];return _0x126984;};'use strict';var Sequelize=require(_0x8790('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8790('0x1')],'defaultValue':'from-voicemail','unique':_0x8790('0x2')},'mailbox':{'type':Sequelize[_0x8790('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8790('0x2')},'password':{'type':Sequelize[_0x8790('0x1')]},'fullname':{'type':Sequelize[_0x8790('0x1')]},'email':{'type':Sequelize[_0x8790('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4787d6){this['setDataValue'](_0x8790('0x3'),typeof _0x4787d6===_0x8790('0x4')&&_0x4787d6[_0x8790('0x5')]()?_0x4787d6['trim']():null);}},'pager':{'type':Sequelize[_0x8790('0x1')]},'tz':{'type':Sequelize[_0x8790('0x1')],'defaultValue':_0x8790('0x6')},'attach':{'type':Sequelize[_0x8790('0x7')]('yes','no'),'defaultValue':_0x8790('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':_0x8790('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8790('0x1')]},'callback':{'type':Sequelize[_0x8790('0x1')]},'review':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8790('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8790('0x8'),'no'),'defaultValue':_0x8790('0x8'),'allowNull':![]},'stamp':{'type':_0x8790('0xa')},'emailsubject':{'type':Sequelize[_0x8790('0x1')]},'emailbody':{'type':Sequelize[_0x8790('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8790('0xb')],'get':function(){return this[_0x8790('0xc')](_0x8790('0xd'))+'\x20-\x20'+this[_0x8790('0xc')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2bcc3de..0f01360 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 _0x1775=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','params','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','rawAttributes','mailbox','options','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','name','send','index','VoiceMail','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x9071b5,_0x221464){var _0x55dc51=function(_0x115ac4){while(--_0x115ac4){_0x9071b5['push'](_0x9071b5['shift']());}};_0x55dc51(++_0x221464);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){var _0x2503ef=_0x3b39b5['get']({'plain':!![]});var _0x564139=_0x5177('0x2a');return db[_0x5177('0x2b')]['destroy']({'where':{'type':_0x564139,'resourceId':_0x2503ef['id']}})[_0x5177('0x28')](function(){return _0x3b39b5;});})['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)[_0x5177('0x1e')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x1c')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x2c')]){delete _0x1cef5d[_0x5177('0x2c')];}_0x7f86e[_0x5177('0x1d')](_0xe98ff1)[_0x5177('0x2d')](_0x1cef5d);};}exports[_0x5177('0x2e')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x2f')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x30')],'type':_0x172b36[_0x5177('0x31')]['key']};});_0x49f6f1['model']=_[_0x5177('0x32')](_0x2233a2,_0x5177('0x2c'));_0x49f6f1[_0x5177('0x33')]=_[_0x5177('0x34')](_0x8134f9[_0x5177('0x33')]);_0x49f6f1[_0x5177('0x35')]=_[_0x5177('0x36')](_0x49f6f1[_0x5177('0x37')],_0x49f6f1['query']);_0x72dced[_0x5177('0x38')]=_[_0x5177('0x36')](_0x49f6f1['model'],qs[_0x5177('0x39')](_0x8134f9[_0x5177('0x33')][_0x5177('0x39')]));_0x72dced[_0x5177('0x38')]=_0x72dced[_0x5177('0x38')][_0x5177('0x3a')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x37')];if(!_0x8134f9[_0x5177('0x33')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x72dced[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x8134f9[_0x5177('0x33')]['limit']);_0x72dced[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x8134f9[_0x5177('0x33')][_0x5177('0x3f')]);_0x72dced[_0x5177('0x40')]=qs[_0x5177('0x35')](_[_0x5177('0x41')](_0x8134f9[_0x5177('0x33')],_0x49f6f1[_0x5177('0x35')]),_0x2233a2);if(_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]){_0x72dced[_0x5177('0x40')]=_[_0x5177('0x43')](_0x72dced['where'],{'$or':_[_0x5177('0x32')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x44')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x2c')]]={'$like':'%'+_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x40')]};return db[_0x5177('0x2f')][_0x5177('0x22')](_0x210510)[_0x5177('0x28')](function(_0x3e710d){_0x42e1db[_0x5177('0x22')]=_0x3e710d;if(_0x8134f9[_0x5177('0x33')]['includeAll']){_0x72dced[_0x5177('0x45')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x72dced);})[_0x5177('0x28')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x28')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':!![],'where':{'id':_0x46c833[_0x5177('0x46')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x37')]=_[_0x5177('0x34')](db['VoiceMail']['rawAttributes']);_0x3776b8[_0x5177('0x33')]=_['keys'](_0x46c833[_0x5177('0x33')]);_0x3776b8[_0x5177('0x35')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],_0x3776b8['query']);_0x262c71[_0x5177('0x38')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],qs[_0x5177('0x39')](_0x46c833[_0x5177('0x33')][_0x5177('0x39')]));_0x262c71[_0x5177('0x38')]=_0x262c71[_0x5177('0x38')][_0x5177('0x3a')]?_0x262c71[_0x5177('0x38')]:_0x3776b8[_0x5177('0x37')];if(_0x46c833['query'][_0x5177('0x47')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x2f')][_0x5177('0x48')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x28')](respondWithResult(_0x1769cd,null))[_0x5177('0x49')](handleError(_0x1769cd,null));};exports[_0x5177('0x4a')]=function(_0x4891fe,_0x1d4ae4){return db['VoiceMail']['create'](_0x4891fe['body'],{})[_0x5177('0x28')](function(_0x37d5dd){var _0x1300d7=_0x4891fe['user']['get']({'plain':!![]});if(!_0x1300d7)throw new Error(_0x5177('0x4b'));if(_0x1300d7['role']===_0x5177('0x4c')){var _0x9dd7a2=_0x37d5dd[_0x5177('0x4d')]({'plain':!![]});var _0x31a6e1=_0x5177('0x2a');return db[_0x5177('0x4e')][_0x5177('0x48')]({'where':{'name':_0x31a6e1,'userProfileId':_0x1300d7[_0x5177('0x4f')]},'raw':!![]})[_0x5177('0x28')](function(_0x217aca){if(_0x217aca&&_0x217aca[_0x5177('0x50')]===0x0){return db[_0x5177('0x2b')][_0x5177('0x4a')]({'name':_0x9dd7a2['name'],'resourceId':_0x9dd7a2['id'],'type':_0x217aca['name'],'sectionId':_0x217aca['id']},{})[_0x5177('0x28')](function(){return _0x37d5dd;});}else{return _0x37d5dd;}})['catch'](function(_0x649c6f){logger['error'](_0x5177('0x51'),_0x649c6f);throw _0x649c6f;});}return _0x37d5dd;})[_0x5177('0x28')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x49')](handleError(_0x1d4ae4,null));};exports['update']=function(_0x5be224,_0x19884e){if(_0x5be224[_0x5177('0x52')]['id']){delete _0x5be224[_0x5177('0x52')]['id'];}return db[_0x5177('0x2f')]['find']({'where':{'id':_0x5be224['params']['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x19884e,null))[_0x5177('0x28')](saveUpdates(_0x5be224[_0x5177('0x52')],null))[_0x5177('0x28')](respondWithResult(_0x19884e,null))['catch'](handleError(_0x19884e,null));};exports[_0x5177('0x29')]=function(_0x143aff,_0x3a18ad){return db['VoiceMail'][_0x5177('0x48')]({'where':{'id':_0x143aff[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x3a18ad,null))['then'](removeEntity(_0x3a18ad,null))[_0x5177('0x49')](handleError(_0x3a18ad,null));};exports['getMessages']=function(_0x40dfd6,_0x39fb92,_0x3268bd){return db['VoiceMail'][_0x5177('0x53')]({'where':{'id':_0x40dfd6[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x39fb92,null))[_0x5177('0x28')](function(_0xc7a59e){var _0x74589e;var _0x37380c={},_0x267599={};_0x267599['model']=_['keys'](db['VoiceMailMessage'][_0x5177('0x54')]);_0x267599[_0x5177('0x33')]=_[_0x5177('0x34')](_0x40dfd6[_0x5177('0x33')]);_0x267599[_0x5177('0x35')]=_[_0x5177('0x36')](_0x267599['model'],_0x267599['query']);_0x37380c[_0x5177('0x38')]=_[_0x5177('0x36')](_0x267599[_0x5177('0x37')],qs[_0x5177('0x39')](_0x40dfd6[_0x5177('0x33')][_0x5177('0x39')]));_0x37380c[_0x5177('0x38')]=_0x37380c[_0x5177('0x38')][_0x5177('0x3a')]?_0x37380c['attributes']:_0x267599[_0x5177('0x37')];if(!_0x40dfd6[_0x5177('0x33')]['hasOwnProperty'](_0x5177('0x3c'))){_0x37380c[_0x5177('0x3d')]=qs['limit'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x3d')]);_0x37380c[_0x5177('0x20')]=qs['offset'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x20')]);}_0x37380c['order']=qs['sort'](_0x40dfd6[_0x5177('0x33')]['sort']);_0x37380c[_0x5177('0x40')]=qs['filters'](_[_0x5177('0x41')](_0x40dfd6[_0x5177('0x33')],_0x267599['filters']));if(_0x40dfd6[_0x5177('0x33')][_0x5177('0x42')]){_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c[_0x5177('0x40')],{'$or':_[_0x5177('0x32')](_0x37380c[_0x5177('0x38')],function(_0x58ebdd){var _0x26b733={};_0x26b733[_0x58ebdd]={'$like':'%'+_0x40dfd6['query']['filter']+'%'};return _0x26b733;})});}_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c['where'],{'mailboxuser':_0xc7a59e[_0x5177('0x55')]});_0x37380c=_[_0x5177('0x43')]({},_0x37380c,_0x40dfd6[_0x5177('0x56')]);return db[_0x5177('0x57')][_0x5177('0x58')](_0x37380c)[_0x5177('0x28')](respondWithFilteredResult(_0x39fb92,_0x37380c));})[_0x5177('0x49')](handleError(_0x39fb92,null));}; \ No newline at end of file +var _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','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','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x5dc1d6,_0x4c1848){var _0x518227=function(_0x209764){while(--_0x209764){_0x5dc1d6['push'](_0x5dc1d6['shift']());}};_0x518227(++_0x4c1848);}(_0x34b7,0x196));var _0x734b=function(_0x7ce8a5,_0xa18e08){_0x7ce8a5=_0x7ce8a5-0x0;var _0x42d2f5=_0x34b7[_0x7ce8a5];return _0x42d2f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4801f07..455da66 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 _0x5cff=['api','moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger'];(function(_0x5852ac,_0xe2ae4d){var _0x5f255d=function(_0x2f5489){while(--_0x2f5489){_0x5852ac['push'](_0x5852ac['shift']());}};_0x5f255d(++_0xe2ae4d);}(_0x5cff,0x185));var _0xf5cf=function(_0x33a97b,_0x291407){_0x33a97b=_0x33a97b-0x0;var _0x13d691=_0x5cff[_0x33a97b];return _0x13d691;};'use strict';var _=require(_0xf5cf('0x0'));var util=require(_0xf5cf('0x1'));var logger=require(_0xf5cf('0x2'))(_0xf5cf('0x3'));var moment=require(_0xf5cf('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5cf('0x5'));var rimraf=require(_0xf5cf('0x6'));var config=require(_0xf5cf('0x7'));var attributes=require(_0xf5cf('0x8'));module[_0xf5cf('0x9')]=function(_0x3d8f28,_0x40b144){return _0x3d8f28[_0xf5cf('0xa')]('VoiceMail',attributes,{'tableName':_0xf5cf('0xb'),'paranoid':![],'indexes':[{'name':_0xf5cf('0xc'),'fields':['mailbox',_0xf5cf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa979=['exports','define','VoiceMail','mailbox','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0xe43a53,_0x2c1e45){var _0x45687a=function(_0x4d2adc){while(--_0x4d2adc){_0xe43a53['push'](_0xe43a53['shift']());}};_0x45687a(++_0x2c1e45);}(_0xa979,0xac));var _0x9a97=function(_0x1b2781,_0x50b74d){_0x1b2781=_0x1b2781-0x0;var _0x226750=_0xa979[_0x1b2781];return _0x226750;};'use strict';var _=require(_0x9a97('0x0'));var util=require(_0x9a97('0x1'));var logger=require(_0x9a97('0x2'))(_0x9a97('0x3'));var moment=require('moment');var BPromise=require(_0x9a97('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a97('0x5'));var rimraf=require(_0x9a97('0x6'));var config=require(_0x9a97('0x7'));var attributes=require('./voiceMail.attributes');module[_0x9a97('0x8')]=function(_0x183ea6,_0x3b3806){return _0x183ea6[_0x9a97('0x9')](_0x9a97('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x9a97('0xb'),'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 dc4e946..0d61751 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 _0x86cd=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0xc0f7fd,_0x9fdffc){var _0x46fa94=function(_0x951c97){while(--_0x951c97){_0xc0f7fd['push'](_0xc0f7fd['shift']());}};_0x46fa94(++_0x9fdffc);}(_0x86cd,0xa4));var _0xd86c=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x86cd[_0x43a37c];return _0x5d1d40;};'use strict';var _=require(_0xd86c('0x0'));var util=require(_0xd86c('0x1'));var moment=require(_0xd86c('0x2'));var BPromise=require(_0xd86c('0x3'));var rs=require(_0xd86c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd86c('0x5'));var logger=require(_0xd86c('0x6'))(_0xd86c('0x7'));var config=require(_0xd86c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd86c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x312534,_0x936e56,_0x34213b){return new BPromise(function(_0x28ba5c,_0x28ab87){return client[_0xd86c('0xa')](_0x312534,_0x34213b)['then'](function(_0x906daa){logger[_0xd86c('0xb')](_0xd86c('0xc'),_0x936e56,_0xd86c('0xd'));logger[_0xd86c('0xe')](_0xd86c('0xf'),_0x936e56,_0xd86c('0xd'),JSON[_0xd86c('0x10')](_0x906daa));if(_0x906daa[_0xd86c('0x11')]){if(_0x906daa[_0xd86c('0x11')][_0xd86c('0x12')]===0x1f4){logger['error'](_0xd86c('0xc'),_0x936e56,_0x906daa[_0xd86c('0x11')][_0xd86c('0x13')]);return _0x28ab87(_0x906daa['error']['message']);}logger['error'](_0xd86c('0xc'),_0x936e56,_0x906daa[_0xd86c('0x11')][_0xd86c('0x13')]);return _0x28ba5c(_0x906daa[_0xd86c('0x11')]['message']);}else{logger['info'](_0xd86c('0xc'),_0x936e56,_0xd86c('0xd'));_0x28ba5c(_0x906daa['result'][_0xd86c('0x13')]);}})[_0xd86c('0x14')](function(_0x17f65f){logger[_0xd86c('0x11')](_0xd86c('0xc'),_0x936e56,_0x17f65f);_0x28ab87(_0x17f65f);});});} \ No newline at end of file +var _0x75ed=['jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x75ed,0xad));var _0xd75e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x75ed[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xd75e('0x0'));var moment=require(_0xd75e('0x1'));var BPromise=require('bluebird');var rs=require(_0xd75e('0x2'));var fs=require('fs');var Redis=require(_0xd75e('0x3'));var db=require(_0xd75e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd75e('0x5'))(_0xd75e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd75e('0x7'));var client=jayson[_0xd75e('0x8')][_0xd75e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278549,_0x47ef7c,_0x304e21){return new BPromise(function(_0x1d0175,_0x56f9fc){return client['request'](_0x278549,_0x304e21)[_0xd75e('0xa')](function(_0x220ec3){logger[_0xd75e('0xb')](_0xd75e('0xc'),_0x47ef7c,_0xd75e('0xd'));logger[_0xd75e('0xe')](_0xd75e('0xf'),_0x47ef7c,_0xd75e('0xd'),JSON['stringify'](_0x220ec3));if(_0x220ec3[_0xd75e('0x10')]){if(_0x220ec3[_0xd75e('0x10')][_0xd75e('0x11')]===0x1f4){logger[_0xd75e('0x10')]('VoiceMail,\x20%s,\x20%s',_0x47ef7c,_0x220ec3[_0xd75e('0x10')][_0xd75e('0x12')]);return _0x56f9fc(_0x220ec3[_0xd75e('0x10')][_0xd75e('0x12')]);}logger['error'](_0xd75e('0xc'),_0x47ef7c,_0x220ec3[_0xd75e('0x10')][_0xd75e('0x12')]);return _0x1d0175(_0x220ec3[_0xd75e('0x10')][_0xd75e('0x12')]);}else{logger[_0xd75e('0xb')]('VoiceMail,\x20%s,\x20%s',_0x47ef7c,_0xd75e('0xd'));_0x1d0175(_0x220ec3[_0xd75e('0x13')][_0xd75e('0x12')]);}})['catch'](function(_0x2fe35a){logger[_0xd75e('0x10')]('VoiceMail,\x20%s,\x20%s',_0x47ef7c,_0x2fe35a);_0x56f9fc(_0x2fe35a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index b4e0b1c..c032af7 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 _0x1647=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','show','/:id/download','download','post','create','put'];(function(_0x39733b,_0x40e4f0){var _0x1e5113=function(_0x3f3aaa){while(--_0x3f3aaa){_0x39733b['push'](_0x39733b['shift']());}};_0x1e5113(++_0x40e4f0);}(_0x1647,0x123));var _0x7164=function(_0x132c29,_0x56c3a0){_0x132c29=_0x132c29-0x0;var _0x3940ed=_0x1647[_0x132c29];return _0x3940ed;};'use strict';var multer=require('multer');var util=require(_0x7164('0x0'));var path=require(_0x7164('0x1'));var timeout=require(_0x7164('0x2'));var express=require(_0x7164('0x3'));var router=express['Router']();var fs_extra=require(_0x7164('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7164('0x5'));var config=require(_0x7164('0x6'));var controller=require(_0x7164('0x7'));router['get']('/',auth[_0x7164('0x8')](),controller[_0x7164('0x9')]);router[_0x7164('0xa')]('/:id',auth[_0x7164('0x8')](),controller[_0x7164('0xb')]);router['get'](_0x7164('0xc'),auth[_0x7164('0x8')](),controller[_0x7164('0xd')]);router[_0x7164('0xe')]('/',auth[_0x7164('0x8')](),controller[_0x7164('0xf')]);router[_0x7164('0x10')](_0x7164('0x11'),auth[_0x7164('0x8')](),controller[_0x7164('0x12')]);router[_0x7164('0x13')](_0x7164('0x11'),auth[_0x7164('0x8')](),controller[_0x7164('0x14')]);module[_0x7164('0x15')]=router; \ No newline at end of file +var _0x2226=['isAuthenticated','index','/:id','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','get'];(function(_0x467602,_0x4ff9d7){var _0x507133=function(_0x41c544){while(--_0x41c544){_0x467602['push'](_0x467602['shift']());}};_0x507133(++_0x4ff9d7);}(_0x2226,0xda));var _0x6222=function(_0xfa2e1e,_0x4002ed){_0xfa2e1e=_0xfa2e1e-0x0;var _0x2f1d12=_0x2226[_0xfa2e1e];return _0x2f1d12;};'use strict';var multer=require(_0x6222('0x0'));var util=require('util');var path=require(_0x6222('0x1'));var timeout=require(_0x6222('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6222('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6222('0x4'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x6222('0x5')]('/',auth[_0x6222('0x6')](),controller[_0x6222('0x7')]);router['get'](_0x6222('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x6222('0x5')]('/:id/download',auth[_0x6222('0x6')](),controller[_0x6222('0x9')]);router[_0x6222('0xa')]('/',auth[_0x6222('0x6')](),controller[_0x6222('0xb')]);router['put']('/:id',auth[_0x6222('0x6')](),controller[_0x6222('0xc')]);router[_0x6222('0xd')](_0x6222('0x8'),auth['isAuthenticated'](),controller[_0x6222('0xe')]);module[_0x6222('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a7ce5e8..f627f2a 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 _0x92cf=['sequelize','exports','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x92cf,0x1a8));var _0xf92c=function(_0x2741d1,_0x501426){_0x2741d1=_0x2741d1-0x0;var _0x521e37=_0x92cf[_0x2741d1];return _0x521e37;};'use strict';var Sequelize=require(_0xf92c('0x0'));module[_0xf92c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x165e76){return this[_0xf92c('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf92c('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xf92c('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xf92c('0x6'),'defaultValue':Sequelize['literal'](_0xf92c('0x7'))}}; \ No newline at end of file +var _0x525e=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x43a6d5,_0x2edd68){var _0x28b871=function(_0x4ac546){while(--_0x4ac546){_0x43a6d5['push'](_0x43a6d5['shift']());}};_0x28b871(++_0x2edd68);}(_0x525e,0x8e));var _0xe525=function(_0x3e226a,_0x390a9b){_0x3e226a=_0x3e226a-0x0;var _0x1d826f=_0x525e[_0x3e226a];return _0x1d826f;};'use strict';var Sequelize=require(_0xe525('0x0'));module[_0xe525('0x1')]={'name':{'type':Sequelize[_0xe525('0x2')],'get':function(_0x3f29d9){return this[_0xe525('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe525('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xe525('0x6')](_0xe525('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xe525('0x8')](_0xe525('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 8dbca87..4156fdc 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 _0xa308=['merge','VIRTUAL','options','includeAll','findAll','catch','params','intersection','include','find','create','body','update','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','model','differenceBy','map','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x4004a1,_0x3aa42a){var _0x1eac1c=function(_0x3480a3){while(--_0x3480a3){_0x4004a1['push'](_0x4004a1['shift']());}};_0x1eac1c(++_0x3aa42a);}(_0xa308,0x1ca));var _0x8a30=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0xa308[_0x138836];return _0x322688;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a30('0x0'));var zipdir=require(_0x8a30('0x1'));var jsonpatch=require(_0x8a30('0x2'));var rp=require(_0x8a30('0x3'));var moment=require(_0x8a30('0x4'));var BPromise=require(_0x8a30('0x5'));var Mustache=require(_0x8a30('0x6'));var util=require(_0x8a30('0x7'));var path=require('path');var sox=require(_0x8a30('0x8'));var csv=require(_0x8a30('0x9'));var ejs=require(_0x8a30('0xa'));var fs=require('fs');var fs_extra=require(_0x8a30('0xb'));var _=require(_0x8a30('0xc'));var squel=require(_0x8a30('0xd'));var crypto=require(_0x8a30('0xe'));var jsforce=require(_0x8a30('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8a30('0x9'));var querystring=require(_0x8a30('0x10'));var Papa=require(_0x8a30('0x11'));var Redis=require(_0x8a30('0x12'));var authService=require(_0x8a30('0x13'));var qs=require(_0x8a30('0x14'));var as=require(_0x8a30('0x15'));var hardwareService=require(_0x8a30('0x16'));var logger=require('../../config/logger')(_0x8a30('0x17'));var utils=require(_0x8a30('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8a30('0x19'));var db=require(_0x8a30('0x1a'))['db'];function respondWithStatusCode(_0x5369ff,_0x5b22d3){_0x5b22d3=_0x5b22d3||0xcc;return function(_0x3f1bc7){if(_0x3f1bc7){return _0x5369ff['sendStatus'](_0x5b22d3);}return _0x5369ff[_0x8a30('0x1b')](_0x5b22d3)[_0x8a30('0x1c')]();};}function respondWithResult(_0x304289,_0x1b8646){_0x1b8646=_0x1b8646||0xc8;return function(_0x4686b6){if(_0x4686b6){return _0x304289[_0x8a30('0x1b')](_0x1b8646)[_0x8a30('0x1d')](_0x4686b6);}};}function respondWithFilteredResult(_0x40205c,_0x5760b9){return function(_0xe24c47){if(_0xe24c47){var _0x5058ca=typeof _0x5760b9[_0x8a30('0x1e')]==='undefined'&&typeof _0x5760b9[_0x8a30('0x1f')]===_0x8a30('0x20');var _0x4238b8=_0xe24c47[_0x8a30('0x21')];var _0x46d9d1=_0x5058ca?0x0:_0x5760b9[_0x8a30('0x1e')];var _0x25905b=_0x5058ca?_0xe24c47[_0x8a30('0x21')]:_0x5760b9[_0x8a30('0x1e')]+_0x5760b9[_0x8a30('0x1f')];var _0x137bf0;if(_0x25905b>=_0x4238b8){_0x25905b=_0x4238b8;_0x137bf0=0xc8;}else{_0x137bf0=0xce;}_0x40205c[_0x8a30('0x1b')](_0x137bf0);return _0x40205c[_0x8a30('0x22')](_0x8a30('0x23'),_0x46d9d1+'-'+_0x25905b+'/'+_0x4238b8)[_0x8a30('0x1d')](_0xe24c47);}return null;};}function patchUpdates(_0x4e72f9){return function(_0xd6c109){try{jsonpatch[_0x8a30('0x24')](_0xd6c109,_0x4e72f9,!![]);}catch(_0x1d1dd5){return BPromise['reject'](_0x1d1dd5);}return _0xd6c109[_0x8a30('0x25')]();};}function saveUpdates(_0x42363f,_0x356d89){return function(_0x1a2b3f){if(_0x1a2b3f){return _0x1a2b3f['update'](_0x42363f)['then'](function(_0x46b62f){return _0x46b62f;});}return null;};}function removeEntity(_0x1b2e00,_0x2bd8a5){return function(_0x489eb5){if(_0x489eb5){return _0x489eb5[_0x8a30('0x26')]()[_0x8a30('0x27')](function(){_0x1b2e00[_0x8a30('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e55c9,_0x5e165c){return function(_0x416d8){if(!_0x416d8){_0x5e55c9[_0x8a30('0x28')](0x194);}return _0x416d8;};}function handleError(_0x464930,_0x950ec5){_0x950ec5=_0x950ec5||0x1f4;return function(_0x38ae7c){logger[_0x8a30('0x29')](_0x38ae7c[_0x8a30('0x2a')]);if(_0x38ae7c[_0x8a30('0x2b')]){delete _0x38ae7c[_0x8a30('0x2b')];}_0x464930[_0x8a30('0x1b')](_0x950ec5)[_0x8a30('0x2c')](_0x38ae7c);};}exports[_0x8a30('0x2d')]=function(_0x4a0889,_0x36fe6d){var _0x14634d={},_0x3be1b5={},_0x8e5a3c={'count':0x0,'rows':[]};var _0x3f6022=_['map'](db[_0x8a30('0x2e')][_0x8a30('0x2f')],function(_0x91d299){return{'name':_0x91d299[_0x8a30('0x30')],'type':_0x91d299['type']['key']};});_0x3be1b5[_0x8a30('0x31')]=_[_0x8a30('0x32')](_[_0x8a30('0x33')](_0x3f6022,_0x8a30('0x2b')),['name']);_0x3be1b5['query']=_[_0x8a30('0x34')](_0x4a0889[_0x8a30('0x35')]);_0x3be1b5[_0x8a30('0x36')]=_['intersection'](_0x3be1b5[_0x8a30('0x31')],_0x3be1b5[_0x8a30('0x35')]);_0x14634d[_0x8a30('0x37')]=_['intersection'](_0x3be1b5[_0x8a30('0x31')],qs[_0x8a30('0x38')](_0x4a0889[_0x8a30('0x35')]['fields']));_0x14634d['attributes']=_0x14634d[_0x8a30('0x37')][_0x8a30('0x39')]?_0x14634d[_0x8a30('0x37')]:_0x3be1b5[_0x8a30('0x31')];if(!_0x4a0889[_0x8a30('0x35')][_0x8a30('0x3a')]('nolimit')){_0x14634d[_0x8a30('0x1f')]=qs[_0x8a30('0x1f')](_0x4a0889[_0x8a30('0x35')][_0x8a30('0x1f')]);_0x14634d[_0x8a30('0x1e')]=qs[_0x8a30('0x1e')](_0x4a0889[_0x8a30('0x35')]['offset']);}_0x14634d[_0x8a30('0x3b')]=qs[_0x8a30('0x3c')](_0x4a0889['query']['sort']);_0x14634d[_0x8a30('0x3d')]=qs[_0x8a30('0x36')](_[_0x8a30('0x3e')](_0x4a0889[_0x8a30('0x35')],_0x3be1b5[_0x8a30('0x36')]),_0x3f6022);if(_0x4a0889[_0x8a30('0x35')][_0x8a30('0x3f')]){_0x14634d[_0x8a30('0x3d')]=_[_0x8a30('0x40')](_0x14634d[_0x8a30('0x3d')],{'$or':_[_0x8a30('0x33')](_0x3f6022,function(_0x35fec1){if(_0x35fec1['type']!==_0x8a30('0x41')){var _0x2aa710={};_0x2aa710[_0x35fec1[_0x8a30('0x2b')]]={'$like':'%'+_0x4a0889[_0x8a30('0x35')]['filter']+'%'};return _0x2aa710;}})});}_0x14634d=_[_0x8a30('0x40')]({},_0x14634d,_0x4a0889[_0x8a30('0x42')]);var _0xb473a9={'where':_0x14634d['where']};return db[_0x8a30('0x2e')][_0x8a30('0x21')](_0xb473a9)[_0x8a30('0x27')](function(_0x587648){_0x8e5a3c[_0x8a30('0x21')]=_0x587648;if(_0x4a0889['query'][_0x8a30('0x43')]){_0x14634d['include']=[{'all':!![]}];}return db[_0x8a30('0x2e')][_0x8a30('0x44')](_0x14634d);})[_0x8a30('0x27')](function(_0x5c091d){_0x8e5a3c['rows']=_0x5c091d;return _0x8e5a3c;})[_0x8a30('0x27')](respondWithFilteredResult(_0x36fe6d,_0x14634d))[_0x8a30('0x45')](handleError(_0x36fe6d,null));};exports['show']=function(_0x4dfbb6,_0xe51a3f){var _0x172541={'raw':!![],'where':{'id':_0x4dfbb6[_0x8a30('0x46')]['id']}},_0x28292a={};_0x28292a[_0x8a30('0x31')]=_[_0x8a30('0x34')](db[_0x8a30('0x2e')]['rawAttributes']);_0x28292a[_0x8a30('0x35')]=_[_0x8a30('0x34')](_0x4dfbb6[_0x8a30('0x35')]);_0x28292a[_0x8a30('0x36')]=_['intersection'](_0x28292a[_0x8a30('0x31')],_0x28292a[_0x8a30('0x35')]);_0x172541[_0x8a30('0x37')]=_[_0x8a30('0x47')](_0x28292a[_0x8a30('0x31')],qs[_0x8a30('0x38')](_0x4dfbb6[_0x8a30('0x35')][_0x8a30('0x38')]));_0x172541[_0x8a30('0x37')]=_0x172541['attributes'][_0x8a30('0x39')]?_0x172541[_0x8a30('0x37')]:_0x28292a[_0x8a30('0x31')];if(_0x4dfbb6[_0x8a30('0x35')][_0x8a30('0x43')]){_0x172541[_0x8a30('0x48')]=[{'all':!![]}];}_0x172541=_[_0x8a30('0x40')]({},_0x172541,_0x4dfbb6[_0x8a30('0x42')]);return db[_0x8a30('0x2e')][_0x8a30('0x49')](_0x172541)['then'](handleEntityNotFound(_0xe51a3f,null))[_0x8a30('0x27')](respondWithResult(_0xe51a3f,null))[_0x8a30('0x45')](handleError(_0xe51a3f,null));};exports['create']=function(_0x585f62,_0x1127c7){return db[_0x8a30('0x2e')][_0x8a30('0x4a')](_0x585f62[_0x8a30('0x4b')],{})[_0x8a30('0x27')](respondWithResult(_0x1127c7,0xc9))['catch'](handleError(_0x1127c7,null));};exports[_0x8a30('0x4c')]=function(_0x580775,_0x117391){if(_0x580775[_0x8a30('0x4b')]['id']){delete _0x580775[_0x8a30('0x4b')]['id'];}return db[_0x8a30('0x2e')]['find']({'where':{'id':_0x580775[_0x8a30('0x46')]['id']}})[_0x8a30('0x27')](handleEntityNotFound(_0x117391,null))['then'](saveUpdates(_0x580775[_0x8a30('0x4b')],null))[_0x8a30('0x27')](respondWithResult(_0x117391,null))[_0x8a30('0x45')](handleError(_0x117391,null));};exports[_0x8a30('0x26')]=function(_0x5943dc,_0x2bcea0){return db[_0x8a30('0x2e')][_0x8a30('0x49')]({'where':{'id':_0x5943dc[_0x8a30('0x46')]['id']}})[_0x8a30('0x27')](handleEntityNotFound(_0x2bcea0,null))[_0x8a30('0x27')](removeEntity(_0x2bcea0,null))[_0x8a30('0x45')](handleError(_0x2bcea0,null));};exports[_0x8a30('0x4d')]=function(_0x249ba9,_0x44f9c0,_0x4a279c){return db[_0x8a30('0x2e')][_0x8a30('0x49')]({'where':{'id':_0x249ba9['params']['id']},'attributes':['id',_0x8a30('0x4e'),'msg_id']})[_0x8a30('0x27')](handleEntityNotFound(_0x44f9c0,null))['then'](function(_0x268040){if(_0x268040){if(!_0x268040[_0x8a30('0x4e')]){throw new db['Sequelize'][(_0x8a30('0x4f'))](_0x8a30('0x50'));}var _0x1eaa55={'Content-Type':_0x8a30('0x51'),'Content-Disposition':_0x8a30('0x52')};if(_0x268040[_0x8a30('0x53')]){_0x1eaa55[_0x8a30('0x54')]=_0x8a30('0x55')+_0x268040[_0x8a30('0x53')]+_0x8a30('0x56');}_0x44f9c0[_0x8a30('0x22')](_0x1eaa55);return _0x44f9c0[_0x8a30('0x2c')](new Buffer(_0x268040['recording']));}})[_0x8a30('0x45')](handleError(_0x44f9c0,null));}; \ No newline at end of file +var _0x4319=['catch','show','params','includeAll','include','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows'];(function(_0x5f3c0e,_0x5324d9){var _0x581009=function(_0x41d176){while(--_0x41d176){_0x5f3c0e['push'](_0x5f3c0e['shift']());}};_0x581009(++_0x5324d9);}(_0x4319,0x111));var _0x9431=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0x4319[_0x2dd22e];return _0x257b01;};'use strict';var emlformat=require(_0x9431('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9431('0x1'));var jsonpatch=require(_0x9431('0x2'));var rp=require('request-promise');var moment=require(_0x9431('0x3'));var BPromise=require(_0x9431('0x4'));var Mustache=require(_0x9431('0x5'));var util=require(_0x9431('0x6'));var path=require(_0x9431('0x7'));var sox=require('sox');var csv=require(_0x9431('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9431('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9431('0xa'));var toCsv=require(_0x9431('0x8'));var querystring=require(_0x9431('0xb'));var Papa=require(_0x9431('0xc'));var Redis=require('ioredis');var authService=require(_0x9431('0xd'));var qs=require(_0x9431('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9431('0xf'));var logger=require(_0x9431('0x10'))(_0x9431('0x11'));var utils=require(_0x9431('0x12'));var config=require(_0x9431('0x13'));var licenseUtil=require(_0x9431('0x14'));var db=require(_0x9431('0x15'))['db'];function respondWithStatusCode(_0x325124,_0x46bb3d){_0x46bb3d=_0x46bb3d||0xcc;return function(_0xb857a8){if(_0xb857a8){return _0x325124[_0x9431('0x16')](_0x46bb3d);}return _0x325124[_0x9431('0x17')](_0x46bb3d)[_0x9431('0x18')]();};}function respondWithResult(_0x2aea18,_0x26b944){_0x26b944=_0x26b944||0xc8;return function(_0x2bce2a){if(_0x2bce2a){return _0x2aea18[_0x9431('0x17')](_0x26b944)[_0x9431('0x19')](_0x2bce2a);}};}function respondWithFilteredResult(_0xb0702,_0x23daf2){return function(_0x4a121a){if(_0x4a121a){var _0x59205d=typeof _0x23daf2[_0x9431('0x1a')]===_0x9431('0x1b')&&typeof _0x23daf2['limit']==='undefined';var _0x30b533=_0x4a121a[_0x9431('0x1c')];var _0x21c7e6=_0x59205d?0x0:_0x23daf2[_0x9431('0x1a')];var _0x4decdc=_0x59205d?_0x4a121a['count']:_0x23daf2[_0x9431('0x1a')]+_0x23daf2[_0x9431('0x1d')];var _0x2ea1bc;if(_0x4decdc>=_0x30b533){_0x4decdc=_0x30b533;_0x2ea1bc=0xc8;}else{_0x2ea1bc=0xce;}_0xb0702[_0x9431('0x17')](_0x2ea1bc);return _0xb0702[_0x9431('0x1e')](_0x9431('0x1f'),_0x21c7e6+'-'+_0x4decdc+'/'+_0x30b533)['json'](_0x4a121a);}return null;};}function patchUpdates(_0x26a238){return function(_0xd913ea){try{jsonpatch[_0x9431('0x20')](_0xd913ea,_0x26a238,!![]);}catch(_0x29e342){return BPromise['reject'](_0x29e342);}return _0xd913ea[_0x9431('0x21')]();};}function saveUpdates(_0x1f4b6a,_0x633e60){return function(_0x55ddbd){if(_0x55ddbd){return _0x55ddbd[_0x9431('0x22')](_0x1f4b6a)[_0x9431('0x23')](function(_0x15d9cb){return _0x15d9cb;});}return null;};}function removeEntity(_0x2217b0,_0x54dc71){return function(_0x25ab7b){if(_0x25ab7b){return _0x25ab7b[_0x9431('0x24')]()[_0x9431('0x23')](function(){_0x2217b0[_0x9431('0x17')](0xcc)[_0x9431('0x18')]();});}};}function handleEntityNotFound(_0x365bfd,_0x12a32b){return function(_0x51a5b1){if(!_0x51a5b1){_0x365bfd['sendStatus'](0x194);}return _0x51a5b1;};}function handleError(_0x248154,_0x2bb316){_0x2bb316=_0x2bb316||0x1f4;return function(_0x50768b){logger[_0x9431('0x25')](_0x50768b[_0x9431('0x26')]);if(_0x50768b[_0x9431('0x27')]){delete _0x50768b[_0x9431('0x27')];}_0x248154[_0x9431('0x17')](_0x2bb316)[_0x9431('0x28')](_0x50768b);};}exports['index']=function(_0x40402f,_0x582305){var _0x500105={},_0x2eec6b={},_0x1b7bca={'count':0x0,'rows':[]};var _0x481f19=_[_0x9431('0x29')](db[_0x9431('0x2a')][_0x9431('0x2b')],function(_0x3b883f){return{'name':_0x3b883f[_0x9431('0x2c')],'type':_0x3b883f['type'][_0x9431('0x2d')]};});_0x2eec6b[_0x9431('0x2e')]=_[_0x9431('0x2f')](_[_0x9431('0x29')](_0x481f19,_0x9431('0x27')),[_0x9431('0x27')]);_0x2eec6b[_0x9431('0x30')]=_[_0x9431('0x31')](_0x40402f['query']);_0x2eec6b[_0x9431('0x32')]=_[_0x9431('0x33')](_0x2eec6b[_0x9431('0x2e')],_0x2eec6b[_0x9431('0x30')]);_0x500105[_0x9431('0x34')]=_[_0x9431('0x33')](_0x2eec6b['model'],qs[_0x9431('0x35')](_0x40402f[_0x9431('0x30')][_0x9431('0x35')]));_0x500105[_0x9431('0x34')]=_0x500105['attributes'][_0x9431('0x36')]?_0x500105[_0x9431('0x34')]:_0x2eec6b[_0x9431('0x2e')];if(!_0x40402f[_0x9431('0x30')][_0x9431('0x37')](_0x9431('0x38'))){_0x500105[_0x9431('0x1d')]=qs[_0x9431('0x1d')](_0x40402f[_0x9431('0x30')]['limit']);_0x500105[_0x9431('0x1a')]=qs[_0x9431('0x1a')](_0x40402f['query'][_0x9431('0x1a')]);}_0x500105[_0x9431('0x39')]=qs[_0x9431('0x3a')](_0x40402f['query'][_0x9431('0x3a')]);_0x500105[_0x9431('0x3b')]=qs['filters'](_[_0x9431('0x3c')](_0x40402f[_0x9431('0x30')],_0x2eec6b[_0x9431('0x32')]),_0x481f19);if(_0x40402f[_0x9431('0x30')][_0x9431('0x3d')]){_0x500105[_0x9431('0x3b')]=_[_0x9431('0x3e')](_0x500105[_0x9431('0x3b')],{'$or':_['map'](_0x481f19,function(_0x3e20de){if(_0x3e20de['type']!==_0x9431('0x3f')){var _0x3489fb={};_0x3489fb[_0x3e20de[_0x9431('0x27')]]={'$like':'%'+_0x40402f[_0x9431('0x30')][_0x9431('0x3d')]+'%'};return _0x3489fb;}})});}_0x500105=_[_0x9431('0x3e')]({},_0x500105,_0x40402f[_0x9431('0x40')]);var _0x58e7e8={'where':_0x500105[_0x9431('0x3b')]};return db['VoiceMailMessage'][_0x9431('0x1c')](_0x58e7e8)[_0x9431('0x23')](function(_0x39e87c){_0x1b7bca[_0x9431('0x1c')]=_0x39e87c;if(_0x40402f[_0x9431('0x30')]['includeAll']){_0x500105['include']=[{'all':!![]}];}return db[_0x9431('0x2a')][_0x9431('0x41')](_0x500105);})['then'](function(_0x4f96f5){_0x1b7bca[_0x9431('0x42')]=_0x4f96f5;return _0x1b7bca;})[_0x9431('0x23')](respondWithFilteredResult(_0x582305,_0x500105))[_0x9431('0x43')](handleError(_0x582305,null));};exports[_0x9431('0x44')]=function(_0x2fae12,_0x457e4e){var _0x55b35f={'raw':!![],'where':{'id':_0x2fae12[_0x9431('0x45')]['id']}},_0x1bce70={};_0x1bce70[_0x9431('0x2e')]=_[_0x9431('0x31')](db[_0x9431('0x2a')][_0x9431('0x2b')]);_0x1bce70[_0x9431('0x30')]=_[_0x9431('0x31')](_0x2fae12[_0x9431('0x30')]);_0x1bce70[_0x9431('0x32')]=_[_0x9431('0x33')](_0x1bce70[_0x9431('0x2e')],_0x1bce70[_0x9431('0x30')]);_0x55b35f['attributes']=_['intersection'](_0x1bce70[_0x9431('0x2e')],qs['fields'](_0x2fae12['query']['fields']));_0x55b35f[_0x9431('0x34')]=_0x55b35f[_0x9431('0x34')][_0x9431('0x36')]?_0x55b35f[_0x9431('0x34')]:_0x1bce70['model'];if(_0x2fae12[_0x9431('0x30')][_0x9431('0x46')]){_0x55b35f[_0x9431('0x47')]=[{'all':!![]}];}_0x55b35f=_[_0x9431('0x3e')]({},_0x55b35f,_0x2fae12['options']);return db['VoiceMailMessage'][_0x9431('0x48')](_0x55b35f)[_0x9431('0x23')](handleEntityNotFound(_0x457e4e,null))[_0x9431('0x23')](respondWithResult(_0x457e4e,null))[_0x9431('0x43')](handleError(_0x457e4e,null));};exports[_0x9431('0x49')]=function(_0xe71b6c,_0x5f4c46){return db[_0x9431('0x2a')]['create'](_0xe71b6c[_0x9431('0x4a')],{})[_0x9431('0x23')](respondWithResult(_0x5f4c46,0xc9))['catch'](handleError(_0x5f4c46,null));};exports[_0x9431('0x22')]=function(_0x32aaba,_0x39d534){if(_0x32aaba[_0x9431('0x4a')]['id']){delete _0x32aaba[_0x9431('0x4a')]['id'];}return db[_0x9431('0x2a')]['find']({'where':{'id':_0x32aaba[_0x9431('0x45')]['id']}})[_0x9431('0x23')](handleEntityNotFound(_0x39d534,null))[_0x9431('0x23')](saveUpdates(_0x32aaba[_0x9431('0x4a')],null))[_0x9431('0x23')](respondWithResult(_0x39d534,null))[_0x9431('0x43')](handleError(_0x39d534,null));};exports['destroy']=function(_0xb5462b,_0x80602f){return db['VoiceMailMessage']['find']({'where':{'id':_0xb5462b[_0x9431('0x45')]['id']}})[_0x9431('0x23')](handleEntityNotFound(_0x80602f,null))['then'](removeEntity(_0x80602f,null))[_0x9431('0x43')](handleError(_0x80602f,null));};exports[_0x9431('0x4b')]=function(_0x1e8cf0,_0x41953f,_0x1a1aad){return db[_0x9431('0x2a')][_0x9431('0x48')]({'where':{'id':_0x1e8cf0['params']['id']},'attributes':['id',_0x9431('0x4c'),_0x9431('0x4d')]})[_0x9431('0x23')](handleEntityNotFound(_0x41953f,null))[_0x9431('0x23')](function(_0x238644){if(_0x238644){if(!_0x238644[_0x9431('0x4c')]){throw new db[(_0x9431('0x4e'))][(_0x9431('0x4f'))](_0x9431('0x50'));}var _0x14d96e={'Content-Type':'audio/wav','Content-Disposition':_0x9431('0x51')};if(_0x238644['msg_id']){_0x14d96e[_0x9431('0x52')]=_0x9431('0x53')+_0x238644['msg_id']+_0x9431('0x54');}_0x41953f['set'](_0x14d96e);return _0x41953f['send'](new Buffer(_0x238644[_0x9431('0x4c')]));}})[_0x9431('0x43')](handleError(_0x41953f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ffe1b6f..f698a45 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 _0xadd2=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x3dac71,_0x4dc62d){var _0x60d901=function(_0x2e4507){while(--_0x2e4507){_0x3dac71['push'](_0x3dac71['shift']());}};_0x60d901(++_0x4dc62d);}(_0xadd2,0x8c));var _0x2add=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xadd2[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x2add('0x0'));var util=require(_0x2add('0x1'));var logger=require('../../config/logger')(_0x2add('0x2'));var moment=require(_0x2add('0x3'));var BPromise=require(_0x2add('0x4'));var rp=require(_0x2add('0x5'));var fs=require('fs');var path=require(_0x2add('0x6'));var rimraf=require('rimraf');var config=require(_0x2add('0x7'));var attributes=require(_0x2add('0x8'));module[_0x2add('0x9')]=function(_0x532afd,_0x138f82){return _0x532afd[_0x2add('0xa')](_0x2add('0xb'),attributes,{'tableName':_0x2add('0xc'),'paranoid':![],'indexes':[{'name':_0x2add('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x2b74=['dir','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0x2b74,0x109));var _0x42b7=function(_0x328972,_0x15c834){_0x328972=_0x328972-0x0;var _0x67a1cf=_0x2b74[_0x328972];return _0x67a1cf;};'use strict';var _=require(_0x42b7('0x0'));var util=require(_0x42b7('0x1'));var logger=require(_0x42b7('0x2'))('api');var moment=require(_0x42b7('0x3'));var BPromise=require(_0x42b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42b7('0x5'));var rimraf=require(_0x42b7('0x6'));var config=require('../../config/environment');var attributes=require(_0x42b7('0x7'));module['exports']=function(_0x1c0162,_0x1a908a){return _0x1c0162[_0x42b7('0x8')](_0x42b7('0x9'),attributes,{'tableName':_0x42b7('0xa'),'paranoid':![],'indexes':[{'name':_0x42b7('0xb'),'fields':[_0x42b7('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 203033e..b0c2324 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 _0x833d=['VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2b4ecf,_0x58a97){var _0x34faa4=function(_0x10210e){while(--_0x10210e){_0x2b4ecf['push'](_0x2b4ecf['shift']());}};_0x34faa4(++_0x58a97);}(_0x833d,0xba));var _0xd833=function(_0x3d545c,_0x416d99){_0x3d545c=_0x3d545c-0x0;var _0x7f25c6=_0x833d[_0x3d545c];return _0x7f25c6;};'use strict';var _=require(_0xd833('0x0'));var util=require('util');var moment=require(_0xd833('0x1'));var BPromise=require(_0xd833('0x2'));var rs=require(_0xd833('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd833('0x4'));var logger=require(_0xd833('0x5'))('rpc');var config=require(_0xd833('0x6'));var jayson=require(_0xd833('0x7'));var client=jayson[_0xd833('0x8')][_0xd833('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8e93b6,_0x574305,_0x4c9456){return new BPromise(function(_0x4825ae,_0x48de62){return client['request'](_0x8e93b6,_0x4c9456)[_0xd833('0xa')](function(_0x5b35f4){logger[_0xd833('0xb')](_0xd833('0xc'),_0x574305,'request\x20sent');logger[_0xd833('0xd')](_0xd833('0xe'),_0x574305,_0xd833('0xf'),JSON[_0xd833('0x10')](_0x5b35f4));if(_0x5b35f4['error']){if(_0x5b35f4[_0xd833('0x11')][_0xd833('0x12')]===0x1f4){logger['error'](_0xd833('0xc'),_0x574305,_0x5b35f4[_0xd833('0x11')]['message']);return _0x48de62(_0x5b35f4[_0xd833('0x11')][_0xd833('0x13')]);}logger[_0xd833('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x574305,_0x5b35f4[_0xd833('0x11')]['message']);return _0x4825ae(_0x5b35f4['error'][_0xd833('0x13')]);}else{logger[_0xd833('0xb')](_0xd833('0xc'),_0x574305,_0xd833('0xf'));_0x4825ae(_0x5b35f4[_0xd833('0x14')][_0xd833('0x13')]);}})[_0xd833('0x15')](function(_0x1d1db2){logger[_0xd833('0x11')](_0xd833('0xc'),_0x574305,_0x1d1db2);_0x48de62(_0x1d1db2);});});} \ No newline at end of file +var _0x3abf=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x3313a3,_0x3dca09){var _0x4fd1f3=function(_0x3309ee){while(--_0x3309ee){_0x3313a3['push'](_0x3313a3['shift']());}};_0x4fd1f3(++_0x3dca09);}(_0x3abf,0x127));var _0xf3ab=function(_0xfe7250,_0x5f43df){_0xfe7250=_0xfe7250-0x0;var _0x4b8ab3=_0x3abf[_0xfe7250];return _0x4b8ab3;};'use strict';var _=require(_0xf3ab('0x0'));var util=require(_0xf3ab('0x1'));var moment=require(_0xf3ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3ab('0x3'));var fs=require('fs');var Redis=require(_0xf3ab('0x4'));var db=require(_0xf3ab('0x5'))['db'];var utils=require(_0xf3ab('0x6'));var logger=require(_0xf3ab('0x7'))(_0xf3ab('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3ab('0x9'));var client=jayson['client'][_0xf3ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x328746,_0x4e5e50,_0x2c8668){return new BPromise(function(_0xb400c7,_0x401ebb){return client[_0xf3ab('0xb')](_0x328746,_0x2c8668)[_0xf3ab('0xc')](function(_0x260ced){logger[_0xf3ab('0xd')](_0xf3ab('0xe'),_0x4e5e50,_0xf3ab('0xf'));logger['debug'](_0xf3ab('0x10'),_0x4e5e50,_0xf3ab('0xf'),JSON[_0xf3ab('0x11')](_0x260ced));if(_0x260ced[_0xf3ab('0x12')]){if(_0x260ced[_0xf3ab('0x12')][_0xf3ab('0x13')]===0x1f4){logger['error'](_0xf3ab('0xe'),_0x4e5e50,_0x260ced[_0xf3ab('0x12')][_0xf3ab('0x14')]);return _0x401ebb(_0x260ced[_0xf3ab('0x12')]['message']);}logger[_0xf3ab('0x12')](_0xf3ab('0xe'),_0x4e5e50,_0x260ced[_0xf3ab('0x12')][_0xf3ab('0x14')]);return _0xb400c7(_0x260ced[_0xf3ab('0x12')][_0xf3ab('0x14')]);}else{logger['info'](_0xf3ab('0xe'),_0x4e5e50,_0xf3ab('0xf'));_0xb400c7(_0x260ced[_0xf3ab('0x15')][_0xf3ab('0x14')]);}})[_0xf3ab('0x16')](function(_0x6984e9){logger['error'](_0xf3ab('0xe'),_0x4e5e50,_0x6984e9);_0x401ebb(_0x6984e9);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index c4f48f8..6e12014 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 _0x317d=['update','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','/:id/sounds','isAuthenticated','getSounds','post','addSound','put'];(function(_0x30417e,_0x33b3a1){var _0x549274=function(_0x45ac3f){while(--_0x45ac3f){_0x30417e['push'](_0x30417e['shift']());}};_0x549274(++_0x33b3a1);}(_0x317d,0x1cd));var _0xd317=function(_0x427bc2,_0x4e4334){_0x427bc2=_0x427bc2-0x0;var _0x36c8ce=_0x317d[_0x427bc2];return _0x36c8ce;};'use strict';var multer=require(_0xd317('0x0'));var util=require(_0xd317('0x1'));var path=require(_0xd317('0x2'));var timeout=require('connect-timeout');var express=require(_0xd317('0x3'));var router=express[_0xd317('0x4')]();var fs_extra=require(_0xd317('0x5'));var auth=require(_0xd317('0x6'));var interaction=require(_0xd317('0x7'));var config=require(_0xd317('0x8'));var controller=require(_0xd317('0x9'));router[_0xd317('0xa')]('/',auth['isAuthenticated'](),controller[_0xd317('0xb')]);router[_0xd317('0xa')](_0xd317('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd317('0xd'),auth[_0xd317('0xe')](),controller[_0xd317('0xf')]);router[_0xd317('0x10')]('/',auth[_0xd317('0xe')](),controller['create']);router[_0xd317('0x10')](_0xd317('0xd'),auth['isAuthenticated'](),controller[_0xd317('0x11')]);router[_0xd317('0x12')](_0xd317('0xc'),auth[_0xd317('0xe')](),controller[_0xd317('0x13')]);router['delete'](_0xd317('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xd317('0x14')](_0xd317('0x15'),auth['isAuthenticated'](),controller[_0xd317('0x16')]);module[_0xd317('0x17')]=router; \ No newline at end of file +var _0x8bc1=['removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id','show','/:id/sounds','post','create','isAuthenticated','addSound','put','update','delete','destroy','/:id/sounds/:id2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bc1,0xa3));var _0x18bc=function(_0x18b981,_0x120eb9){_0x18b981=_0x18b981-0x0;var _0x269c38=_0x8bc1[_0x18b981];return _0x269c38;};'use strict';var multer=require(_0x18bc('0x0'));var util=require(_0x18bc('0x1'));var path=require(_0x18bc('0x2'));var timeout=require(_0x18bc('0x3'));var express=require(_0x18bc('0x4'));var router=express[_0x18bc('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x18bc('0x6'));var config=require('../../config/environment');var controller=require(_0x18bc('0x7'));router[_0x18bc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x18bc('0x8')](_0x18bc('0x9'),auth['isAuthenticated'](),controller[_0x18bc('0xa')]);router[_0x18bc('0x8')](_0x18bc('0xb'),auth['isAuthenticated'](),controller['getSounds']);router[_0x18bc('0xc')]('/',auth['isAuthenticated'](),controller[_0x18bc('0xd')]);router[_0x18bc('0xc')](_0x18bc('0xb'),auth[_0x18bc('0xe')](),controller[_0x18bc('0xf')]);router[_0x18bc('0x10')](_0x18bc('0x9'),auth[_0x18bc('0xe')](),controller[_0x18bc('0x11')]);router[_0x18bc('0x12')](_0x18bc('0x9'),auth[_0x18bc('0xe')](),controller[_0x18bc('0x13')]);router[_0x18bc('0x12')](_0x18bc('0x14'),auth[_0x18bc('0xe')](),controller[_0x18bc('0x15')]);module[_0x18bc('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7b7b16b..33e3e1c 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 _0xdbae=['alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','custom','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x12f8c6,_0x54d2d8){var _0xe9ae4a=function(_0x2d5b63){while(--_0x2d5b63){_0x12f8c6['push'](_0x12f8c6['shift']());}};_0xe9ae4a(++_0x54d2d8);}(_0xdbae,0x67));var _0xedba=function(_0x3f3b02,_0x3870c2){_0x3f3b02=_0x3f3b02-0x0;var _0x1f42f1=_0xdbae[_0x3f3b02];return _0x1f42f1;};'use strict';var Sequelize=require(_0xedba('0x0'));module['exports']={'name':{'type':Sequelize[_0xedba('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xedba('0x2'),_0xedba('0x3'),_0xedba('0x4'),_0xedba('0x5'),_0xedba('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0xedba('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xedba('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xedba('0x1')],'allowNull':!![],'defaultValue':_0xedba('0x7')},'format':{'type':Sequelize[_0xedba('0x1')],'allowNull':!![]},'stamp':{'type':_0xedba('0x8')},'defaultEntry':{'type':Sequelize[_0xedba('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xab85=['exports','STRING','name','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x501c00,_0x1dc98b){var _0x5ad836=function(_0x21299f){while(--_0x21299f){_0x501c00['push'](_0x501c00['shift']());}};_0x5ad836(++_0x1dc98b);}(_0xab85,0x1df));var _0x5ab8=function(_0x1a8472,_0x28eb63){_0x1a8472=_0x1a8472-0x0;var _0x2b5240=_0xab85[_0x1a8472];return _0x2b5240;};'use strict';var Sequelize=require(_0x5ab8('0x0'));module[_0x5ab8('0x1')]={'name':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':![],'unique':_0x5ab8('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x5ab8('0x4'),_0x5ab8('0x5'),_0x5ab8('0x6'),_0x5ab8('0x7'),_0x5ab8('0x8')),'allowNull':!![],'defaultValue':_0x5ab8('0x4')},'directory':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':!![],'defaultValue':_0x5ab8('0x9')},'format':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':!![]},'stamp':{'type':_0x5ab8('0xa')},'defaultEntry':{'type':Sequelize[_0x5ab8('0xb')],'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 62a90d6..47441d6 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 _0xb40c=['0777','user','get','role','find','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','ValidationError','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','Sequelize','message','removeSound','id2','getSounds','filter','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','rows','show','intersection','length','options','catch','body','params','sequelize','transaction','join','root','server/files/moh','mode','mkdirSync','directory'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xb40c,0x93));var _0xcb40=function(_0x810c7d,_0x167fae){_0x810c7d=_0x810c7d-0x0;var _0x3111ad=_0xb40c[_0x810c7d];return _0x3111ad;};'use strict';var emlformat=require(_0xcb40('0x0'));var rimraf=require(_0xcb40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb40('0x2'));var rp=require(_0xcb40('0x3'));var moment=require(_0xcb40('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb40('0x5'));var util=require(_0xcb40('0x6'));var path=require('path');var sox=require(_0xcb40('0x7'));var csv=require(_0xcb40('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb40('0x9'));var _=require(_0xcb40('0xa'));var squel=require(_0xcb40('0xb'));var crypto=require(_0xcb40('0xc'));var jsforce=require(_0xcb40('0xd'));var deskjs=require(_0xcb40('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcb40('0xf'));var Papa=require(_0xcb40('0x10'));var Redis=require(_0xcb40('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb40('0x12'));var hardwareService=require(_0xcb40('0x13'));var logger=require(_0xcb40('0x14'))(_0xcb40('0x15'));var utils=require(_0xcb40('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcb40('0x17'));var db=require(_0xcb40('0x18'))['db'];function respondWithStatusCode(_0x181a39,_0x5dbe0b){_0x5dbe0b=_0x5dbe0b||0xcc;return function(_0x1d9f8c){if(_0x1d9f8c){return _0x181a39[_0xcb40('0x19')](_0x5dbe0b);}return _0x181a39[_0xcb40('0x1a')](_0x5dbe0b)[_0xcb40('0x1b')]();};}function respondWithResult(_0x4239f3,_0x5911e0){_0x5911e0=_0x5911e0||0xc8;return function(_0x138c6e){if(_0x138c6e){return _0x4239f3[_0xcb40('0x1a')](_0x5911e0)['json'](_0x138c6e);}};}function respondWithFilteredResult(_0x285b02,_0x3ba3bb){return function(_0x5af057){if(_0x5af057){var _0x21f1b1=typeof _0x3ba3bb[_0xcb40('0x1c')]===_0xcb40('0x1d')&&typeof _0x3ba3bb['limit']===_0xcb40('0x1d');var _0x7f92ef=_0x5af057['count'];var _0xa5474d=_0x21f1b1?0x0:_0x3ba3bb[_0xcb40('0x1c')];var _0x5c0e22=_0x21f1b1?_0x5af057[_0xcb40('0x1e')]:_0x3ba3bb[_0xcb40('0x1c')]+_0x3ba3bb[_0xcb40('0x1f')];var _0x5cd96;if(_0x5c0e22>=_0x7f92ef){_0x5c0e22=_0x7f92ef;_0x5cd96=0xc8;}else{_0x5cd96=0xce;}_0x285b02['status'](_0x5cd96);return _0x285b02[_0xcb40('0x20')](_0xcb40('0x21'),_0xa5474d+'-'+_0x5c0e22+'/'+_0x7f92ef)[_0xcb40('0x22')](_0x5af057);}return null;};}function patchUpdates(_0x2c7f43){return function(_0x5d7d99){try{jsonpatch[_0xcb40('0x23')](_0x5d7d99,_0x2c7f43,!![]);}catch(_0x36054b){return BPromise[_0xcb40('0x24')](_0x36054b);}return _0x5d7d99[_0xcb40('0x25')]();};}function saveUpdates(_0x342daa,_0x4e4e28){return function(_0x56f648){if(_0x56f648){return _0x56f648[_0xcb40('0x26')](_0x342daa)[_0xcb40('0x27')](function(_0x2a1e17){return _0x2a1e17;});}return null;};}function removeEntity(_0x50ac32,_0x119547){return function(_0x4cc78d){if(_0x4cc78d){return _0x4cc78d['destroy']()[_0xcb40('0x27')](function(){var _0x57785d=_0x4cc78d['get']({'plain':!![]});var _0x14fda7='MusicOnHolds';return db['UserProfileResource'][_0xcb40('0x28')]({'where':{'type':_0x14fda7,'resourceId':_0x57785d['id']}})[_0xcb40('0x27')](function(){return _0x4cc78d;});})[_0xcb40('0x27')](function(){_0x50ac32['status'](0xcc)[_0xcb40('0x1b')]();});}};}function handleEntityNotFound(_0x34ecec,_0x5290f7){return function(_0x2e7fed){if(!_0x2e7fed){_0x34ecec[_0xcb40('0x19')](0x194);}return _0x2e7fed;};}function handleError(_0x4797a3,_0x561898){_0x561898=_0x561898||0x1f4;return function(_0x596f59){logger[_0xcb40('0x29')](_0x596f59['stack']);if(_0x596f59[_0xcb40('0x2a')]){delete _0x596f59[_0xcb40('0x2a')];}_0x4797a3[_0xcb40('0x1a')](_0x561898)[_0xcb40('0x2b')](_0x596f59);};}exports[_0xcb40('0x2c')]=function(_0x2ec26b,_0x5612d1){var _0x58210b={},_0x3ab3fe={},_0x38efc3={'count':0x0,'rows':[]};var _0x37b943=_[_0xcb40('0x2d')](db[_0xcb40('0x2e')][_0xcb40('0x2f')],function(_0x97b0b){return{'name':_0x97b0b[_0xcb40('0x30')],'type':_0x97b0b[_0xcb40('0x31')][_0xcb40('0x32')]};});_0x3ab3fe[_0xcb40('0x33')]=_['map'](_0x37b943,_0xcb40('0x2a'));_0x3ab3fe[_0xcb40('0x34')]=_[_0xcb40('0x35')](_0x2ec26b[_0xcb40('0x34')]);_0x3ab3fe[_0xcb40('0x36')]=_['intersection'](_0x3ab3fe[_0xcb40('0x33')],_0x3ab3fe[_0xcb40('0x34')]);_0x58210b[_0xcb40('0x37')]=_['intersection'](_0x3ab3fe['model'],qs['fields'](_0x2ec26b[_0xcb40('0x34')][_0xcb40('0x38')]));_0x58210b[_0xcb40('0x37')]=_0x58210b['attributes']['length']?_0x58210b[_0xcb40('0x37')]:_0x3ab3fe[_0xcb40('0x33')];if(!_0x2ec26b[_0xcb40('0x34')][_0xcb40('0x39')](_0xcb40('0x3a'))){_0x58210b[_0xcb40('0x1f')]=qs[_0xcb40('0x1f')](_0x2ec26b[_0xcb40('0x34')][_0xcb40('0x1f')]);_0x58210b[_0xcb40('0x1c')]=qs[_0xcb40('0x1c')](_0x2ec26b['query'][_0xcb40('0x1c')]);}_0x58210b[_0xcb40('0x3b')]=qs[_0xcb40('0x3c')](_0x2ec26b['query'][_0xcb40('0x3c')]);delete _0x2ec26b[_0xcb40('0x34')][_0xcb40('0x3c')];_0x58210b[_0xcb40('0x3d')]=qs['filters'](_[_0xcb40('0x3e')](_0x2ec26b[_0xcb40('0x34')],_0x3ab3fe[_0xcb40('0x36')]),_0x37b943);if(_0x2ec26b[_0xcb40('0x34')]['filter']){_0x58210b['where']=_['merge'](_0x58210b[_0xcb40('0x3d')],{'$or':_[_0xcb40('0x2d')](_0x37b943,function(_0x39cf98){if(_0x39cf98[_0xcb40('0x31')]!==_0xcb40('0x3f')){var _0x1c2313={};_0x1c2313[_0x39cf98[_0xcb40('0x2a')]]={'$like':'%'+_0x2ec26b[_0xcb40('0x34')]['filter']+'%'};return _0x1c2313;}})});}_0x58210b=_[_0xcb40('0x40')]({},_0x58210b,_0x2ec26b['options']);var _0x29e2ea={'where':_0x58210b[_0xcb40('0x3d')]};return db[_0xcb40('0x2e')][_0xcb40('0x1e')](_0x29e2ea)[_0xcb40('0x27')](function(_0x2f5ef4){_0x38efc3[_0xcb40('0x1e')]=_0x2f5ef4;if(_0x2ec26b[_0xcb40('0x34')][_0xcb40('0x41')]){_0x58210b[_0xcb40('0x42')]=[{'all':!![]}];}return db[_0xcb40('0x2e')]['findAll'](_0x58210b);})[_0xcb40('0x27')](function(_0x1bcbfa){_0x38efc3[_0xcb40('0x43')]=_0x1bcbfa;return _0x38efc3;})['then'](respondWithFilteredResult(_0x5612d1,_0x58210b))['catch'](handleError(_0x5612d1,null));};exports[_0xcb40('0x44')]=function(_0x2127c4,_0x4d9fda){var _0x5b1026={'raw':![],'where':{'id':_0x2127c4['params']['id']}},_0x4d98c9={};_0x4d98c9['model']=_[_0xcb40('0x35')](db[_0xcb40('0x2e')][_0xcb40('0x2f')]);_0x4d98c9[_0xcb40('0x34')]=_[_0xcb40('0x35')](_0x2127c4[_0xcb40('0x34')]);_0x4d98c9[_0xcb40('0x36')]=_[_0xcb40('0x45')](_0x4d98c9[_0xcb40('0x33')],_0x4d98c9[_0xcb40('0x34')]);_0x5b1026[_0xcb40('0x37')]=_[_0xcb40('0x45')](_0x4d98c9[_0xcb40('0x33')],qs['fields'](_0x2127c4[_0xcb40('0x34')][_0xcb40('0x38')]));_0x5b1026[_0xcb40('0x37')]=_0x5b1026['attributes'][_0xcb40('0x46')]?_0x5b1026[_0xcb40('0x37')]:_0x4d98c9[_0xcb40('0x33')];if(_0x2127c4[_0xcb40('0x34')][_0xcb40('0x41')]){_0x5b1026['include']=[{'all':!![]}];}_0x5b1026=_['merge']({},_0x5b1026,_0x2127c4[_0xcb40('0x47')]);return db[_0xcb40('0x2e')]['find'](_0x5b1026)[_0xcb40('0x27')](handleEntityNotFound(_0x4d9fda,null))['then'](respondWithResult(_0x4d9fda,null))[_0xcb40('0x48')](handleError(_0x4d9fda,null));};exports['update']=function(_0x3cac32,_0x4135ef){if(_0x3cac32[_0xcb40('0x49')]['id']){delete _0x3cac32[_0xcb40('0x49')]['id'];}return db[_0xcb40('0x2e')]['find']({'where':{'id':_0x3cac32[_0xcb40('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4135ef,null))[_0xcb40('0x27')](saveUpdates(_0x3cac32[_0xcb40('0x49')],null))[_0xcb40('0x27')](respondWithResult(_0x4135ef,null))[_0xcb40('0x48')](handleError(_0x4135ef,null));};exports['create']=function(_0x2b20bb,_0x36bfae,_0x3b1164){return db[_0xcb40('0x4b')][_0xcb40('0x4c')](function(_0x366f9a){if(_0x2b20bb[_0xcb40('0x49')]['mode']==='files'){_0x2b20bb[_0xcb40('0x49')]['directory']=path[_0xcb40('0x4d')](config[_0xcb40('0x4e')],_0xcb40('0x4f'),_0x2b20bb['body'][_0xcb40('0x2a')]);}return db['VoiceMusicOnHold']['create'](_0x2b20bb[_0xcb40('0x49')],{'transaction':_0x366f9a})[_0xcb40('0x27')](function(_0x20b1e5){if(_0x2b20bb[_0xcb40('0x49')][_0xcb40('0x50')]==='files'){fs[_0xcb40('0x51')](_0x20b1e5[_0xcb40('0x52')],parseInt(_0xcb40('0x53'),0x8));}var _0x142702=_0x2b20bb[_0xcb40('0x54')][_0xcb40('0x55')]({'plain':!![]});if(!_0x142702)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x142702[_0xcb40('0x56')]===_0xcb40('0x54')){var _0x293e50=_0x20b1e5[_0xcb40('0x55')]({'plain':!![]});return db['UserProfileSection'][_0xcb40('0x57')]({'where':{'name':_0xcb40('0x58'),'userProfileId':_0x142702[_0xcb40('0x59')]},'raw':!![]})['then'](function(_0x3b587c){if(_0x3b587c&&_0x3b587c[_0xcb40('0x5a')]===0x0){return db[_0xcb40('0x5b')]['create']({'name':_0x293e50['name'],'resourceId':_0x293e50['id'],'type':_0x3b587c[_0xcb40('0x2a')],'sectionId':_0x3b587c['id']},{})[_0xcb40('0x27')](function(){return _0x20b1e5;});}else{return _0x20b1e5;}})['catch'](function(_0x3648d7){logger[_0xcb40('0x29')](_0xcb40('0x5c'),_0x3648d7);});}return _0x20b1e5;});})[_0xcb40('0x27')](respondWithResult(_0x36bfae,0xc9))[_0xcb40('0x48')](handleError(_0x36bfae,null));};exports[_0xcb40('0x28')]=function(_0x4794bd,_0x2886ec,_0x2bf508){var _0x1bc124;return db[_0xcb40('0x2e')][_0xcb40('0x57')]({'where':{'id':_0x4794bd['params']['id']}})[_0xcb40('0x27')](function(_0x37e9d5){if(_0x37e9d5){return db['sequelize'][_0xcb40('0x4c')](function(_0x31561b){return _0x37e9d5[_0xcb40('0x28')]({'transaction':_0x31561b,'raw':!![]})[_0xcb40('0x27')](function(_0x855977){if(_0x855977[_0xcb40('0x52')]){fs['readdirSync'](_0x855977[_0xcb40('0x52')])[_0xcb40('0x5d')](function(_0x199da0){fs[_0xcb40('0x5e')](path[_0xcb40('0x4d')](_0x855977[_0xcb40('0x52')],_0x199da0));});fs[_0xcb40('0x5f')](_0x855977[_0xcb40('0x52')]);}return _0x855977;});})[_0xcb40('0x48')](function(_0x42e428){throw new db['Sequelize'][(_0xcb40('0x60'))](_0x42e428['message']);});}})[_0xcb40('0x27')](handleEntityNotFound(_0x2886ec,null))[_0xcb40('0x27')](removeEntity(_0x2886ec,null))[_0xcb40('0x48')](handleError(_0x2886ec,null));};exports['addSound']=function(_0x16f302,_0x5da830,_0x2341b4){return db[_0xcb40('0x4b')][_0xcb40('0x4c')](function(_0x444c3){var _0x39cf54;return db[_0xcb40('0x2e')][_0xcb40('0x57')]({'where':{'id':_0x16f302[_0xcb40('0x4a')]['id']}})[_0xcb40('0x27')](function(_0x57fde5){if(_0x57fde5){_0x39cf54=_0x57fde5;return _0x57fde5[_0xcb40('0x61')](_0x16f302[_0xcb40('0x49')]['id'],{'transaction':_0x444c3});}})[_0xcb40('0x27')](function(_0x5315d8){if(_0x5315d8){return db[_0xcb40('0x62')][_0xcb40('0x63')]({'where':{'id':_0x16f302[_0xcb40('0x49')]['id']},'attributes':['id','name',_0xcb40('0x64'),'converted_format',_0xcb40('0x65')],'raw':!![]});}})[_0xcb40('0x27')](function(_0x342ef3){if(_0x342ef3){var _0x31e28e=path['join'](config[_0xcb40('0x4e')],_0xcb40('0x66'),util[_0xcb40('0x67')](_0xcb40('0x68'),path[_0xcb40('0x69')](_0x342ef3[_0xcb40('0x64')],path[_0xcb40('0x6a')](_0x342ef3[_0xcb40('0x64')])),_0x342ef3[_0xcb40('0x6b')]));var _0x462e93=path[_0xcb40('0x4d')](config[_0xcb40('0x4e')],_0xcb40('0x4f'),_0x39cf54[_0xcb40('0x2a')],util[_0xcb40('0x67')]('%s.%s',_0x342ef3[_0xcb40('0x2a')],_0x342ef3['converted_format']));fs[_0xcb40('0x6c')](_0x31e28e,_0x462e93);return _0x342ef3;}})[_0xcb40('0x48')](function(_0x2cb771){throw new db[(_0xcb40('0x6d'))][(_0xcb40('0x60'))](_0x2cb771[_0xcb40('0x6e')]);});})[_0xcb40('0x27')](handleEntityNotFound(_0x5da830,null))[_0xcb40('0x27')](respondWithResult(_0x5da830,0xc9))[_0xcb40('0x48')](handleError(_0x5da830,null));};exports[_0xcb40('0x6f')]=function(_0x3568be,_0x1d3b1d,_0x20b48e){return db['sequelize'][_0xcb40('0x4c')](function(_0x1af0e6){var _0x3cb3d7;return db[_0xcb40('0x2e')][_0xcb40('0x63')]({'where':{'id':_0x3568be[_0xcb40('0x4a')]['id']}})[_0xcb40('0x27')](handleEntityNotFound(_0x1d3b1d,null))[_0xcb40('0x27')](function(_0x456107){if(_0x456107){_0x3cb3d7=_0x456107;return _0x456107[_0xcb40('0x6f')](_0x3568be[_0xcb40('0x4a')][_0xcb40('0x70')]);}})[_0xcb40('0x27')](function(_0x544311){if(_0x544311){return db[_0xcb40('0x62')][_0xcb40('0x63')]({'where':{'id':_0x3568be['params']['id2']},'attributes':['id','name',_0xcb40('0x64'),_0xcb40('0x6b'),_0xcb40('0x65')],'raw':!![]});}})[_0xcb40('0x27')](function(_0x5f1733){if(_0x5f1733){fs[_0xcb40('0x5e')](path['join'](_0x3cb3d7[_0xcb40('0x52')],util[_0xcb40('0x67')](_0xcb40('0x68'),_0x5f1733[_0xcb40('0x2a')],_0x5f1733['converted_format'])));return _0x5f1733;}})[_0xcb40('0x48')](function(_0x2cb694){throw new db[(_0xcb40('0x6d'))][(_0xcb40('0x60'))](_0x2cb694[_0xcb40('0x6e')]);});})[_0xcb40('0x27')](handleEntityNotFound(_0x1d3b1d,null))[_0xcb40('0x27')](respondWithStatusCode(_0x1d3b1d,0xcc))[_0xcb40('0x48')](handleError(_0x1d3b1d,null));};exports[_0xcb40('0x71')]=function(_0x53a70d,_0x42c4aa,_0x586c78){var _0xc4320c={};var _0x616c53={};var _0x3b5b4a;var _0x2bbe53;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x53a70d[_0xcb40('0x4a')]['id']}})[_0xcb40('0x27')](handleEntityNotFound(_0x42c4aa,null))[_0xcb40('0x27')](function(_0x52c135){if(_0x52c135){_0x3b5b4a=_0x52c135;_0x616c53[_0xcb40('0x33')]=_['keys'](db[_0xcb40('0x62')][_0xcb40('0x2f')]);_0x616c53['query']=_['keys'](_0x53a70d[_0xcb40('0x34')]);_0x616c53[_0xcb40('0x36')]=_['intersection'](_0x616c53['model'],_0x616c53[_0xcb40('0x34')]);_0xc4320c[_0xcb40('0x37')]=_[_0xcb40('0x45')](_0x616c53[_0xcb40('0x33')],qs['fields'](_0x53a70d['query'][_0xcb40('0x38')]));_0xc4320c[_0xcb40('0x37')]=_0xc4320c['attributes'][_0xcb40('0x46')]?_0xc4320c[_0xcb40('0x37')]:_0x616c53[_0xcb40('0x33')];_0xc4320c[_0xcb40('0x3b')]=qs[_0xcb40('0x3c')](_0x53a70d[_0xcb40('0x34')][_0xcb40('0x3c')]);_0xc4320c[_0xcb40('0x3d')]=qs['filters'](_[_0xcb40('0x3e')](_0x53a70d['query'],_0x616c53[_0xcb40('0x36')]));if(_0x53a70d['query'][_0xcb40('0x72')]){_0xc4320c[_0xcb40('0x3d')]=_[_0xcb40('0x40')](_0xc4320c['where'],{'$or':_[_0xcb40('0x2d')](_0xc4320c[_0xcb40('0x37')],function(_0x27463){var _0x26cb48={};_0x26cb48[_0x27463]={'$like':'%'+_0x53a70d[_0xcb40('0x34')][_0xcb40('0x72')]+'%'};return _0x26cb48;})});}_0xc4320c=_[_0xcb40('0x40')]({},_0xc4320c,_0x53a70d[_0xcb40('0x47')]);return _0x3b5b4a['getSounds'](_0xc4320c);}})[_0xcb40('0x27')](function(_0x2424bf){if(_0x2424bf){_0x2bbe53=_0x2424bf['length'];if(!_0x53a70d[_0xcb40('0x34')][_0xcb40('0x39')](_0xcb40('0x3a'))){_0xc4320c[_0xcb40('0x1f')]=qs[_0xcb40('0x1f')](_0x53a70d[_0xcb40('0x34')][_0xcb40('0x1f')]);_0xc4320c[_0xcb40('0x1c')]=qs[_0xcb40('0x1c')](_0x53a70d[_0xcb40('0x34')][_0xcb40('0x1c')]);}return _0x3b5b4a[_0xcb40('0x71')](_0xc4320c);}})[_0xcb40('0x27')](function(_0x168822){if(_0x168822){return _0x168822?{'count':_0x2bbe53,'rows':_0x168822}:null;}})[_0xcb40('0x27')](respondWithResult(_0x42c4aa,null))[_0xcb40('0x48')](handleError(_0x42c4aa,null));}; \ No newline at end of file +var _0x382a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','sequelize','transaction','files','directory','join','root','mode','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','create','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','converted_format','server/files/moh','symlinkSync','removeSound','id2','getSounds','options','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x200276,_0x3a39b5){var _0x496325=function(_0x36551d){while(--_0x36551d){_0x200276['push'](_0x200276['shift']());}};_0x496325(++_0x3a39b5);}(_0x382a,0xd3));var _0xa382=function(_0x2d50be,_0x4e2d7c){_0x2d50be=_0x2d50be-0x0;var _0x2d3545=_0x382a[_0x2d50be];return _0x2d3545;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa382('0x0'));var zipdir=require(_0xa382('0x1'));var jsonpatch=require(_0xa382('0x2'));var rp=require(_0xa382('0x3'));var moment=require(_0xa382('0x4'));var BPromise=require(_0xa382('0x5'));var Mustache=require('mustache');var util=require(_0xa382('0x6'));var path=require(_0xa382('0x7'));var sox=require('sox');var csv=require(_0xa382('0x8'));var ejs=require(_0xa382('0x9'));var fs=require('fs');var fs_extra=require(_0xa382('0xa'));var _=require('lodash');var squel=require(_0xa382('0xb'));var crypto=require(_0xa382('0xc'));var jsforce=require(_0xa382('0xd'));var deskjs=require(_0xa382('0xe'));var toCsv=require(_0xa382('0x8'));var querystring=require(_0xa382('0xf'));var Papa=require('papaparse');var Redis=require(_0xa382('0x10'));var authService=require(_0xa382('0x11'));var qs=require(_0xa382('0x12'));var as=require(_0xa382('0x13'));var hardwareService=require(_0xa382('0x14'));var logger=require(_0xa382('0x15'))(_0xa382('0x16'));var utils=require(_0xa382('0x17'));var config=require(_0xa382('0x18'));var licenseUtil=require(_0xa382('0x19'));var db=require(_0xa382('0x1a'))['db'];function respondWithStatusCode(_0x4bce44,_0x37839e){_0x37839e=_0x37839e||0xcc;return function(_0x29e141){if(_0x29e141){return _0x4bce44['sendStatus'](_0x37839e);}return _0x4bce44[_0xa382('0x1b')](_0x37839e)[_0xa382('0x1c')]();};}function respondWithResult(_0x55617d,_0x3b4187){_0x3b4187=_0x3b4187||0xc8;return function(_0x5eddee){if(_0x5eddee){return _0x55617d[_0xa382('0x1b')](_0x3b4187)[_0xa382('0x1d')](_0x5eddee);}};}function respondWithFilteredResult(_0x2aada2,_0x249cdd){return function(_0x146bcf){if(_0x146bcf){var _0x3a5549=typeof _0x249cdd['offset']===_0xa382('0x1e')&&typeof _0x249cdd[_0xa382('0x1f')]===_0xa382('0x1e');var _0x2acc35=_0x146bcf[_0xa382('0x20')];var _0x3553f9=_0x3a5549?0x0:_0x249cdd['offset'];var _0x473c93=_0x3a5549?_0x146bcf[_0xa382('0x20')]:_0x249cdd['offset']+_0x249cdd['limit'];var _0x2c25f5;if(_0x473c93>=_0x2acc35){_0x473c93=_0x2acc35;_0x2c25f5=0xc8;}else{_0x2c25f5=0xce;}_0x2aada2['status'](_0x2c25f5);return _0x2aada2[_0xa382('0x21')]('Content-Range',_0x3553f9+'-'+_0x473c93+'/'+_0x2acc35)['json'](_0x146bcf);}return null;};}function patchUpdates(_0x5ad13d){return function(_0x54afad){try{jsonpatch[_0xa382('0x22')](_0x54afad,_0x5ad13d,!![]);}catch(_0x4e6cfd){return BPromise['reject'](_0x4e6cfd);}return _0x54afad[_0xa382('0x23')]();};}function saveUpdates(_0x457165,_0xfb2179){return function(_0x45d353){if(_0x45d353){return _0x45d353[_0xa382('0x24')](_0x457165)[_0xa382('0x25')](function(_0x2f340d){return _0x2f340d;});}return null;};}function removeEntity(_0x407421,_0x5569cf){return function(_0x4d6122){if(_0x4d6122){return _0x4d6122[_0xa382('0x26')]()['then'](function(){var _0xfb814d=_0x4d6122[_0xa382('0x27')]({'plain':!![]});var _0x17c53b=_0xa382('0x28');return db[_0xa382('0x29')][_0xa382('0x26')]({'where':{'type':_0x17c53b,'resourceId':_0xfb814d['id']}})[_0xa382('0x25')](function(){return _0x4d6122;});})[_0xa382('0x25')](function(){_0x407421[_0xa382('0x1b')](0xcc)[_0xa382('0x1c')]();});}};}function handleEntityNotFound(_0x13d8d3,_0x286b31){return function(_0x5e2076){if(!_0x5e2076){_0x13d8d3[_0xa382('0x2a')](0x194);}return _0x5e2076;};}function handleError(_0x2ea882,_0x3ba3da){_0x3ba3da=_0x3ba3da||0x1f4;return function(_0x30b3fe){logger[_0xa382('0x2b')](_0x30b3fe[_0xa382('0x2c')]);if(_0x30b3fe[_0xa382('0x2d')]){delete _0x30b3fe[_0xa382('0x2d')];}_0x2ea882[_0xa382('0x1b')](_0x3ba3da)[_0xa382('0x2e')](_0x30b3fe);};}exports['index']=function(_0x6cbaab,_0x55561e){var _0x3c6249={},_0x1d48fa={},_0x49743f={'count':0x0,'rows':[]};var _0x11aef0=_[_0xa382('0x2f')](db[_0xa382('0x30')]['rawAttributes'],function(_0x45f65b){return{'name':_0x45f65b[_0xa382('0x31')],'type':_0x45f65b[_0xa382('0x32')][_0xa382('0x33')]};});_0x1d48fa[_0xa382('0x34')]=_[_0xa382('0x2f')](_0x11aef0,'name');_0x1d48fa['query']=_[_0xa382('0x35')](_0x6cbaab['query']);_0x1d48fa[_0xa382('0x36')]=_[_0xa382('0x37')](_0x1d48fa[_0xa382('0x34')],_0x1d48fa[_0xa382('0x38')]);_0x3c6249['attributes']=_['intersection'](_0x1d48fa[_0xa382('0x34')],qs[_0xa382('0x39')](_0x6cbaab[_0xa382('0x38')]['fields']));_0x3c6249['attributes']=_0x3c6249[_0xa382('0x3a')][_0xa382('0x3b')]?_0x3c6249[_0xa382('0x3a')]:_0x1d48fa[_0xa382('0x34')];if(!_0x6cbaab['query'][_0xa382('0x3c')](_0xa382('0x3d'))){_0x3c6249[_0xa382('0x1f')]=qs[_0xa382('0x1f')](_0x6cbaab[_0xa382('0x38')]['limit']);_0x3c6249['offset']=qs['offset'](_0x6cbaab[_0xa382('0x38')][_0xa382('0x3e')]);}_0x3c6249[_0xa382('0x3f')]=qs[_0xa382('0x40')](_0x6cbaab[_0xa382('0x38')]['sort']);delete _0x6cbaab[_0xa382('0x38')][_0xa382('0x40')];_0x3c6249['where']=qs[_0xa382('0x36')](_[_0xa382('0x41')](_0x6cbaab[_0xa382('0x38')],_0x1d48fa[_0xa382('0x36')]),_0x11aef0);if(_0x6cbaab['query'][_0xa382('0x42')]){_0x3c6249[_0xa382('0x43')]=_[_0xa382('0x44')](_0x3c6249[_0xa382('0x43')],{'$or':_[_0xa382('0x2f')](_0x11aef0,function(_0x2af882){if(_0x2af882[_0xa382('0x32')]!==_0xa382('0x45')){var _0x1750b9={};_0x1750b9[_0x2af882[_0xa382('0x2d')]]={'$like':'%'+_0x6cbaab[_0xa382('0x38')][_0xa382('0x42')]+'%'};return _0x1750b9;}})});}_0x3c6249=_['merge']({},_0x3c6249,_0x6cbaab['options']);var _0x28ef32={'where':_0x3c6249[_0xa382('0x43')]};return db[_0xa382('0x30')][_0xa382('0x20')](_0x28ef32)['then'](function(_0x4e9fe9){_0x49743f[_0xa382('0x20')]=_0x4e9fe9;if(_0x6cbaab[_0xa382('0x38')][_0xa382('0x46')]){_0x3c6249[_0xa382('0x47')]=[{'all':!![]}];}return db[_0xa382('0x30')][_0xa382('0x48')](_0x3c6249);})[_0xa382('0x25')](function(_0x532d91){_0x49743f[_0xa382('0x49')]=_0x532d91;return _0x49743f;})[_0xa382('0x25')](respondWithFilteredResult(_0x55561e,_0x3c6249))[_0xa382('0x4a')](handleError(_0x55561e,null));};exports[_0xa382('0x4b')]=function(_0x14e325,_0x55e74e){var _0x80721c={'raw':![],'where':{'id':_0x14e325[_0xa382('0x4c')]['id']}},_0x3e8771={};_0x3e8771[_0xa382('0x34')]=_[_0xa382('0x35')](db[_0xa382('0x30')][_0xa382('0x4d')]);_0x3e8771[_0xa382('0x38')]=_[_0xa382('0x35')](_0x14e325[_0xa382('0x38')]);_0x3e8771[_0xa382('0x36')]=_[_0xa382('0x37')](_0x3e8771[_0xa382('0x34')],_0x3e8771[_0xa382('0x38')]);_0x80721c[_0xa382('0x3a')]=_['intersection'](_0x3e8771[_0xa382('0x34')],qs[_0xa382('0x39')](_0x14e325[_0xa382('0x38')][_0xa382('0x39')]));_0x80721c[_0xa382('0x3a')]=_0x80721c[_0xa382('0x3a')][_0xa382('0x3b')]?_0x80721c['attributes']:_0x3e8771[_0xa382('0x34')];if(_0x14e325[_0xa382('0x38')][_0xa382('0x46')]){_0x80721c['include']=[{'all':!![]}];}_0x80721c=_[_0xa382('0x44')]({},_0x80721c,_0x14e325['options']);return db[_0xa382('0x30')][_0xa382('0x4e')](_0x80721c)[_0xa382('0x25')](handleEntityNotFound(_0x55e74e,null))[_0xa382('0x25')](respondWithResult(_0x55e74e,null))['catch'](handleError(_0x55e74e,null));};exports[_0xa382('0x24')]=function(_0x1fb84c,_0x8b97d5){if(_0x1fb84c['body']['id']){delete _0x1fb84c[_0xa382('0x4f')]['id'];}return db[_0xa382('0x30')][_0xa382('0x4e')]({'where':{'id':_0x1fb84c[_0xa382('0x4c')]['id']}})['then'](handleEntityNotFound(_0x8b97d5,null))['then'](saveUpdates(_0x1fb84c['body'],null))[_0xa382('0x25')](respondWithResult(_0x8b97d5,null))['catch'](handleError(_0x8b97d5,null));};exports['create']=function(_0x55da4c,_0x20c71b,_0x368ec1){return db[_0xa382('0x50')][_0xa382('0x51')](function(_0x1b82db){if(_0x55da4c[_0xa382('0x4f')]['mode']===_0xa382('0x52')){_0x55da4c[_0xa382('0x4f')][_0xa382('0x53')]=path[_0xa382('0x54')](config[_0xa382('0x55')],'server/files/moh',_0x55da4c[_0xa382('0x4f')]['name']);}return db[_0xa382('0x30')]['create'](_0x55da4c[_0xa382('0x4f')],{'transaction':_0x1b82db})[_0xa382('0x25')](function(_0x1f82d9){if(_0x55da4c[_0xa382('0x4f')][_0xa382('0x56')]===_0xa382('0x52')){fs[_0xa382('0x57')](_0x1f82d9['directory'],parseInt(_0xa382('0x58'),0x8));}var _0x340a8c=_0x55da4c[_0xa382('0x59')]['get']({'plain':!![]});if(!_0x340a8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x340a8c[_0xa382('0x5a')]===_0xa382('0x59')){var _0x4f9c65=_0x1f82d9[_0xa382('0x27')]({'plain':!![]});return db[_0xa382('0x5b')]['find']({'where':{'name':_0xa382('0x28'),'userProfileId':_0x340a8c[_0xa382('0x5c')]},'raw':!![]})[_0xa382('0x25')](function(_0x20cc00){if(_0x20cc00&&_0x20cc00[_0xa382('0x5d')]===0x0){return db[_0xa382('0x29')][_0xa382('0x5e')]({'name':_0x4f9c65[_0xa382('0x2d')],'resourceId':_0x4f9c65['id'],'type':_0x20cc00[_0xa382('0x2d')],'sectionId':_0x20cc00['id']},{})[_0xa382('0x25')](function(){return _0x1f82d9;});}else{return _0x1f82d9;}})[_0xa382('0x4a')](function(_0x47b452){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47b452);});}return _0x1f82d9;});})[_0xa382('0x25')](respondWithResult(_0x20c71b,0xc9))[_0xa382('0x4a')](handleError(_0x20c71b,null));};exports[_0xa382('0x26')]=function(_0x587e0b,_0x2c0377,_0x29403c){var _0x449051;return db['VoiceMusicOnHold'][_0xa382('0x4e')]({'where':{'id':_0x587e0b['params']['id']}})[_0xa382('0x25')](function(_0x15ef1d){if(_0x15ef1d){return db['sequelize'][_0xa382('0x51')](function(_0x87f53f){return _0x15ef1d[_0xa382('0x26')]({'transaction':_0x87f53f,'raw':!![]})[_0xa382('0x25')](function(_0xd34763){if(_0xd34763[_0xa382('0x53')]){fs['readdirSync'](_0xd34763[_0xa382('0x53')])['forEach'](function(_0x545b87){fs[_0xa382('0x5f')](path[_0xa382('0x54')](_0xd34763[_0xa382('0x53')],_0x545b87));});fs[_0xa382('0x60')](_0xd34763[_0xa382('0x53')]);}return _0xd34763;});})[_0xa382('0x4a')](function(_0x2071e5){throw new db[(_0xa382('0x61'))][(_0xa382('0x62'))](_0x2071e5[_0xa382('0x63')]);});}})[_0xa382('0x25')](handleEntityNotFound(_0x2c0377,null))['then'](removeEntity(_0x2c0377,null))[_0xa382('0x4a')](handleError(_0x2c0377,null));};exports[_0xa382('0x64')]=function(_0x363639,_0x811018,_0x58283a){return db[_0xa382('0x50')]['transaction'](function(_0x50a75d){var _0x5afeaf;return db[_0xa382('0x30')][_0xa382('0x4e')]({'where':{'id':_0x363639[_0xa382('0x4c')]['id']}})[_0xa382('0x25')](function(_0x5147d1){if(_0x5147d1){_0x5afeaf=_0x5147d1;return _0x5147d1['addSound'](_0x363639['body']['id'],{'transaction':_0x50a75d});}})[_0xa382('0x25')](function(_0x3fe88b){if(_0x3fe88b){return db[_0xa382('0x65')][_0xa382('0x66')]({'where':{'id':_0x363639[_0xa382('0x4f')]['id']},'attributes':['id','name',_0xa382('0x67'),'converted_format',_0xa382('0x68')],'raw':!![]});}})[_0xa382('0x25')](function(_0x1b8590){if(_0x1b8590){var _0x358415=path[_0xa382('0x54')](config[_0xa382('0x55')],_0xa382('0x69'),util[_0xa382('0x6a')](_0xa382('0x6b'),path['basename'](_0x1b8590[_0xa382('0x67')],path['extname'](_0x1b8590[_0xa382('0x67')])),_0x1b8590[_0xa382('0x6c')]));var _0xd34a92=path['join'](config[_0xa382('0x55')],_0xa382('0x6d'),_0x5afeaf[_0xa382('0x2d')],util['format'](_0xa382('0x6b'),_0x1b8590[_0xa382('0x2d')],_0x1b8590[_0xa382('0x6c')]));fs[_0xa382('0x6e')](_0x358415,_0xd34a92);return _0x1b8590;}})[_0xa382('0x4a')](function(_0x110263){throw new db[(_0xa382('0x61'))][(_0xa382('0x62'))](_0x110263[_0xa382('0x63')]);});})[_0xa382('0x25')](handleEntityNotFound(_0x811018,null))[_0xa382('0x25')](respondWithResult(_0x811018,0xc9))[_0xa382('0x4a')](handleError(_0x811018,null));};exports[_0xa382('0x6f')]=function(_0x5e597e,_0xd79282,_0x485769){return db[_0xa382('0x50')]['transaction'](function(_0x12200e){var _0x5ab5f1;return db[_0xa382('0x30')][_0xa382('0x66')]({'where':{'id':_0x5e597e[_0xa382('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd79282,null))['then'](function(_0x3ef18c){if(_0x3ef18c){_0x5ab5f1=_0x3ef18c;return _0x3ef18c['removeSound'](_0x5e597e['params'][_0xa382('0x70')]);}})[_0xa382('0x25')](function(_0x41af14){if(_0x41af14){return db[_0xa382('0x65')][_0xa382('0x66')]({'where':{'id':_0x5e597e[_0xa382('0x4c')][_0xa382('0x70')]},'attributes':['id',_0xa382('0x2d'),_0xa382('0x67'),_0xa382('0x6c'),_0xa382('0x68')],'raw':!![]});}})[_0xa382('0x25')](function(_0x1ccdd5){if(_0x1ccdd5){fs['unlinkSync'](path[_0xa382('0x54')](_0x5ab5f1[_0xa382('0x53')],util[_0xa382('0x6a')](_0xa382('0x6b'),_0x1ccdd5['name'],_0x1ccdd5[_0xa382('0x6c')])));return _0x1ccdd5;}})[_0xa382('0x4a')](function(_0x501bd3){throw new db[(_0xa382('0x61'))][(_0xa382('0x62'))](_0x501bd3[_0xa382('0x63')]);});})[_0xa382('0x25')](handleEntityNotFound(_0xd79282,null))[_0xa382('0x25')](respondWithStatusCode(_0xd79282,0xcc))[_0xa382('0x4a')](handleError(_0xd79282,null));};exports[_0xa382('0x71')]=function(_0x15fd7a,_0x283101,_0xb490d5){var _0x5c76fb={};var _0x154970={};var _0x3a8eb8;var _0x5e875e;return db[_0xa382('0x30')][_0xa382('0x66')]({'where':{'id':_0x15fd7a[_0xa382('0x4c')]['id']}})[_0xa382('0x25')](handleEntityNotFound(_0x283101,null))[_0xa382('0x25')](function(_0x539ffb){if(_0x539ffb){_0x3a8eb8=_0x539ffb;_0x154970['model']=_[_0xa382('0x35')](db[_0xa382('0x65')][_0xa382('0x4d')]);_0x154970[_0xa382('0x38')]=_[_0xa382('0x35')](_0x15fd7a[_0xa382('0x38')]);_0x154970['filters']=_['intersection'](_0x154970[_0xa382('0x34')],_0x154970[_0xa382('0x38')]);_0x5c76fb[_0xa382('0x3a')]=_[_0xa382('0x37')](_0x154970['model'],qs['fields'](_0x15fd7a[_0xa382('0x38')][_0xa382('0x39')]));_0x5c76fb['attributes']=_0x5c76fb[_0xa382('0x3a')][_0xa382('0x3b')]?_0x5c76fb[_0xa382('0x3a')]:_0x154970['model'];_0x5c76fb[_0xa382('0x3f')]=qs[_0xa382('0x40')](_0x15fd7a[_0xa382('0x38')][_0xa382('0x40')]);_0x5c76fb[_0xa382('0x43')]=qs[_0xa382('0x36')](_['pick'](_0x15fd7a[_0xa382('0x38')],_0x154970[_0xa382('0x36')]));if(_0x15fd7a[_0xa382('0x38')][_0xa382('0x42')]){_0x5c76fb['where']=_['merge'](_0x5c76fb[_0xa382('0x43')],{'$or':_[_0xa382('0x2f')](_0x5c76fb[_0xa382('0x3a')],function(_0x21bab4){var _0x1abfc3={};_0x1abfc3[_0x21bab4]={'$like':'%'+_0x15fd7a['query'][_0xa382('0x42')]+'%'};return _0x1abfc3;})});}_0x5c76fb=_['merge']({},_0x5c76fb,_0x15fd7a[_0xa382('0x72')]);return _0x3a8eb8[_0xa382('0x71')](_0x5c76fb);}})[_0xa382('0x25')](function(_0x5217d0){if(_0x5217d0){_0x5e875e=_0x5217d0['length'];if(!_0x15fd7a[_0xa382('0x38')]['hasOwnProperty'](_0xa382('0x3d'))){_0x5c76fb[_0xa382('0x1f')]=qs[_0xa382('0x1f')](_0x15fd7a['query'][_0xa382('0x1f')]);_0x5c76fb[_0xa382('0x3e')]=qs['offset'](_0x15fd7a[_0xa382('0x38')][_0xa382('0x3e')]);}return _0x3a8eb8['getSounds'](_0x5c76fb);}})['then'](function(_0x22b9d0){if(_0x22b9d0){return _0x22b9d0?{'count':_0x5e875e,'rows':_0x22b9d0}:null;}})[_0xa382('0x25')](respondWithResult(_0x283101,null))['catch'](handleError(_0x283101,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 59d2800..5f9da70 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 _0x5cf1=['VoiceMusicOnHold','voice_musiconhold','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5cf1,0x1c4));var _0x15cf=function(_0x2483f6,_0x70bc75){_0x2483f6=_0x2483f6-0x0;var _0x44f7b9=_0x5cf1[_0x2483f6];return _0x44f7b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x15cf('0x0'));var moment=require(_0x15cf('0x1'));var BPromise=require('bluebird');var rp=require(_0x15cf('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15cf('0x3'));var config=require(_0x15cf('0x4'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x15cf('0x5')]=function(_0x74c465,_0x33b312){return _0x74c465[_0x15cf('0x6')](_0x15cf('0x7'),attributes,{'tableName':_0x15cf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe26b=['lodash','../../config/logger','api','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x406b98,_0x5e21bb){var _0x5c2247=function(_0x3cbcb2){while(--_0x3cbcb2){_0x406b98['push'](_0x406b98['shift']());}};_0x5c2247(++_0x5e21bb);}(_0xe26b,0x197));var _0xbe26=function(_0x55bb77,_0x182e95){_0x55bb77=_0x55bb77-0x0;var _0x1510f8=_0xe26b[_0x55bb77];return _0x1510f8;};'use strict';var _=require(_0xbe26('0x0'));var util=require('util');var logger=require(_0xbe26('0x1'))(_0xbe26('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe26('0x3'));var rimraf=require(_0xbe26('0x4'));var config=require(_0xbe26('0x5'));var attributes=require(_0xbe26('0x6'));module[_0xbe26('0x7')]=function(_0x55c5cb,_0x349ac6){return _0x55c5cb[_0xbe26('0x8')](_0xbe26('0x9'),attributes,{'tableName':_0xbe26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 647adbe..a0ba0c8 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 _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(_0x5dbdaf,_0x3754d9){var _0x11ed1e=function(_0x229684){while(--_0x229684){_0x5dbdaf['push'](_0x5dbdaf['shift']());}};_0x11ed1e(++_0x3754d9);}(_0xedd9,0xfc));var _0x9edd=function(_0x2fd93c,_0x3d8354){_0x2fd93c=_0x2fd93c-0x0;var _0x127a71=_0xedd9[_0x2fd93c];return _0x127a71;};'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 +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a6308,_0x259b99){var _0x423c0d=function(_0x5f3d7b){while(--_0x5f3d7b){_0x3a6308['push'](_0x3a6308['shift']());}};_0x423c0d(++_0x259b99);}(_0xe706,0xa3));var _0x6e70=function(_0x15a93a,_0x4822e4){_0x15a93a=_0x15a93a-0x0;var _0x592780=_0xe706[_0x15a93a];return _0x592780;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 874e243..ea86a25 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 _0x925e=['delete','destroy','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','put','update'];(function(_0x3d16d7,_0x461674){var _0x757c0f=function(_0xfa9391){while(--_0xfa9391){_0x3d16d7['push'](_0x3d16d7['shift']());}};_0x757c0f(++_0x461674);}(_0x925e,0x199));var _0xe925=function(_0x316061,_0x1f9f53){_0x316061=_0x316061-0x0;var _0x443672=_0x925e[_0x316061];return _0x443672;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe925('0x0'));var timeout=require(_0xe925('0x1'));var express=require(_0xe925('0x2'));var router=express['Router']();var fs_extra=require(_0xe925('0x3'));var auth=require(_0xe925('0x4'));var interaction=require(_0xe925('0x5'));var config=require(_0xe925('0x6'));var controller=require(_0xe925('0x7'));router[_0xe925('0x8')]('/',auth[_0xe925('0x9')](),controller[_0xe925('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe925('0xb')]);router['get'](_0xe925('0xc'),auth['isAuthenticated'](),controller[_0xe925('0xd')]);router[_0xe925('0x8')](_0xe925('0xe'),auth[_0xe925('0x9')](),controller[_0xe925('0xf')]);router[_0xe925('0x8')](_0xe925('0x10'),auth[_0xe925('0x9')](),controller[_0xe925('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe925('0x12')]);router[_0xe925('0x13')]('/:id/users',auth[_0xe925('0x9')](),controller[_0xe925('0x14')]);router[_0xe925('0x13')](_0xe925('0x10'),auth[_0xe925('0x9')](),controller['addTeams']);router[_0xe925('0x15')](_0xe925('0xc'),auth[_0xe925('0x9')](),controller[_0xe925('0x16')]);router[_0xe925('0x17')](_0xe925('0xc'),auth[_0xe925('0x9')](),controller[_0xe925('0x18')]);router[_0xe925('0x17')](_0xe925('0xe'),auth[_0xe925('0x9')](),controller[_0xe925('0x19')]);router['delete'](_0xe925('0x10'),auth[_0xe925('0x9')](),controller['removeTeams']);module[_0xe925('0x1a')]=router; \ No newline at end of file +var _0x3248=['show','getAgents','/:id/teams','create','post','/:id/users','addTeams','put','update','delete','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x1db73f,_0x4ae98f){var _0x5511ee=function(_0x5654b6){while(--_0x5654b6){_0x1db73f['push'](_0x1db73f['shift']());}};_0x5511ee(++_0x4ae98f);}(_0x3248,0x1bc));var _0x8324=function(_0x56e75e,_0x140bb0){_0x56e75e=_0x56e75e-0x0;var _0x58f4a3=_0x3248[_0x56e75e];return _0x58f4a3;};'use strict';var multer=require('multer');var util=require(_0x8324('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8324('0x1'));var router=express[_0x8324('0x2')]();var fs_extra=require(_0x8324('0x3'));var auth=require(_0x8324('0x4'));var interaction=require(_0x8324('0x5'));var config=require(_0x8324('0x6'));var controller=require('./voicePrefix.controller');router[_0x8324('0x7')]('/',auth[_0x8324('0x8')](),controller['index']);router[_0x8324('0x7')](_0x8324('0x9'),auth[_0x8324('0x8')](),controller[_0x8324('0xa')]);router['get'](_0x8324('0xb'),auth[_0x8324('0x8')](),controller[_0x8324('0xc')]);router[_0x8324('0x7')]('/:id/users',auth[_0x8324('0x8')](),controller[_0x8324('0xd')]);router['get'](_0x8324('0xe'),auth[_0x8324('0x8')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller[_0x8324('0xf')]);router[_0x8324('0x10')](_0x8324('0x11'),auth[_0x8324('0x8')](),controller['addAgents']);router[_0x8324('0x10')](_0x8324('0xe'),auth[_0x8324('0x8')](),controller[_0x8324('0x12')]);router[_0x8324('0x13')]('/:id',auth[_0x8324('0x8')](),controller[_0x8324('0x14')]);router[_0x8324('0x15')](_0x8324('0xb'),auth[_0x8324('0x8')](),controller['destroy']);router[_0x8324('0x15')](_0x8324('0x11'),auth[_0x8324('0x8')](),controller[_0x8324('0x16')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module[_0x8324('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index c3eb5bf..cc3b692 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 _0x2938=['sequelize','exports','STRING','name','VIRTUAL','system-','INTEGER'];(function(_0x363e32,_0xd85826){var _0x3b762c=function(_0x1a7e3b){while(--_0x1a7e3b){_0x363e32['push'](_0x363e32['shift']());}};_0x3b762c(++_0xd85826);}(_0x2938,0x69));var _0x8293=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2938[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x8293('0x0'));module[_0x8293('0x1')]={'name':{'type':Sequelize[_0x8293('0x2')],'allowNull':![],'unique':_0x8293('0x3')},'prefix':{'type':Sequelize[_0x8293('0x4')],'get':function(_0x3435b4){return _0x8293('0x5')+this['getDataValue'](_0x8293('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x8293('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x8293('0x6')]}}; \ No newline at end of file +var _0xc8e3=['getDataValue','exports','STRING','name','VIRTUAL'];(function(_0xebb7ec,_0x5d9dc7){var _0x46c0e9=function(_0x4757d1){while(--_0x4757d1){_0xebb7ec['push'](_0xebb7ec['shift']());}};_0x46c0e9(++_0x5d9dc7);}(_0xc8e3,0x1e1));var _0x3c8e=function(_0x570803,_0x4374fd){_0x570803=_0x570803-0x0;var _0x458832=_0xc8e3[_0x570803];return _0x458832;};'use strict';var Sequelize=require('sequelize');module[_0x3c8e('0x0')]={'name':{'type':Sequelize[_0x3c8e('0x1')],'allowNull':![],'unique':_0x3c8e('0x2')},'prefix':{'type':Sequelize[_0x3c8e('0x3')],'get':function(_0x53e2a2){return'system-'+this[_0x3c8e('0x4')](_0x3c8e('0x2'))+'-';}},'description':{'type':Sequelize[_0x3c8e('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4234713..0d4c8aa 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 _0xcf66=['error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','body','get','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','emit','userVoicePrefix:remove','findOne','User','getAgents','Team','getTeams','online','voicePause','interface','flatMap','Agents','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','isEmpty','removeAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','VoicePrefixes','UserProfileResource','sendStatus'];(function(_0x28f2a1,_0x5d5c8f){var _0x3cb633=function(_0x339240){while(--_0x339240){_0x28f2a1['push'](_0x28f2a1['shift']());}};_0x3cb633(++_0x5d5c8f);}(_0xcf66,0x71));var _0x6cf6=function(_0x441e59,_0x2a5d7b){_0x441e59=_0x441e59-0x0;var _0x432918=_0xcf66[_0x441e59];return _0x432918;};'use strict';var emlformat=require(_0x6cf6('0x0'));var rimraf=require(_0x6cf6('0x1'));var zipdir=require(_0x6cf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cf6('0x5'));var path=require(_0x6cf6('0x6'));var sox=require('sox');var csv=require(_0x6cf6('0x7'));var ejs=require(_0x6cf6('0x8'));var fs=require('fs');var fs_extra=require(_0x6cf6('0x9'));var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x7'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6cf6('0x14')]=_[_0x6cf6('0x15')](config[_0x6cf6('0x14')],{'host':_0x6cf6('0x16'),'port':0x18eb});var socket=require(_0x6cf6('0x17'))(new Redis(config[_0x6cf6('0x14')]));require('./voicePrefix.socket')[_0x6cf6('0x18')](socket);function respondWithStatusCode(_0x494ece,_0x4dbae8){_0x4dbae8=_0x4dbae8||0xcc;return function(_0x18360e){if(_0x18360e){return _0x494ece['sendStatus'](_0x4dbae8);}return _0x494ece[_0x6cf6('0x19')](_0x4dbae8)[_0x6cf6('0x1a')]();};}function respondWithResult(_0x2d23ab,_0x74486a){_0x74486a=_0x74486a||0xc8;return function(_0x2b6d7b){if(_0x2b6d7b){return _0x2d23ab[_0x6cf6('0x19')](_0x74486a)[_0x6cf6('0x1b')](_0x2b6d7b);}};}function respondWithFilteredResult(_0x39ec25,_0x18c2f9){return function(_0x2ca2b1){if(_0x2ca2b1){var _0x5e8b11=typeof _0x18c2f9[_0x6cf6('0x1c')]===_0x6cf6('0x1d')&&typeof _0x18c2f9[_0x6cf6('0x1e')]==='undefined';var _0x18abd9=_0x2ca2b1[_0x6cf6('0x1f')];var _0x101e39=_0x5e8b11?0x0:_0x18c2f9[_0x6cf6('0x1c')];var _0x440634=_0x5e8b11?_0x2ca2b1[_0x6cf6('0x1f')]:_0x18c2f9[_0x6cf6('0x1c')]+_0x18c2f9['limit'];var _0x19f2cd;if(_0x440634>=_0x18abd9){_0x440634=_0x18abd9;_0x19f2cd=0xc8;}else{_0x19f2cd=0xce;}_0x39ec25[_0x6cf6('0x19')](_0x19f2cd);return _0x39ec25[_0x6cf6('0x20')](_0x6cf6('0x21'),_0x101e39+'-'+_0x440634+'/'+_0x18abd9)[_0x6cf6('0x1b')](_0x2ca2b1);}return null;};}function patchUpdates(_0x470ea4){return function(_0x41344f){try{jsonpatch[_0x6cf6('0x22')](_0x41344f,_0x470ea4,!![]);}catch(_0x5b2767){return BPromise['reject'](_0x5b2767);}return _0x41344f[_0x6cf6('0x23')]();};}function saveUpdates(_0x59f838,_0x45ce6e){return function(_0x18c8cd){if(_0x18c8cd){return _0x18c8cd[_0x6cf6('0x24')](_0x59f838)[_0x6cf6('0x25')](function(_0x3f9871){return _0x3f9871;});}return null;};}function removeEntity(_0x565fad,_0x1c966e){return function(_0x4e0e85){if(_0x4e0e85){return _0x4e0e85[_0x6cf6('0x26')]()[_0x6cf6('0x25')](function(){var _0x3eaa31=_0x4e0e85['get']({'plain':!![]});var _0xf4eec5=_0x6cf6('0x27');return db[_0x6cf6('0x28')][_0x6cf6('0x26')]({'where':{'type':_0xf4eec5,'resourceId':_0x3eaa31['id']}})['then'](function(){return _0x4e0e85;});})['then'](function(){_0x565fad[_0x6cf6('0x19')](0xcc)[_0x6cf6('0x1a')]();});}};}function handleEntityNotFound(_0x57099f,_0x5869e9){return function(_0x5ccc8f){if(!_0x5ccc8f){_0x57099f[_0x6cf6('0x29')](0x194);}return _0x5ccc8f;};}function handleError(_0x52717d,_0x4ceeb9){_0x4ceeb9=_0x4ceeb9||0x1f4;return function(_0x519a70){logger[_0x6cf6('0x2a')](_0x519a70[_0x6cf6('0x2b')]);if(_0x519a70[_0x6cf6('0x2c')]){delete _0x519a70[_0x6cf6('0x2c')];}_0x52717d[_0x6cf6('0x19')](_0x4ceeb9)['send'](_0x519a70);};}exports[_0x6cf6('0x2d')]=function(_0x2ae422,_0x356340){var _0x535b28={},_0x3c4b7a={},_0x145363={'count':0x0,'rows':[]};var _0xfcb0e5=_[_0x6cf6('0x2e')](db[_0x6cf6('0x2f')][_0x6cf6('0x30')],function(_0x11f66d){return{'name':_0x11f66d[_0x6cf6('0x31')],'type':_0x11f66d[_0x6cf6('0x32')][_0x6cf6('0x33')]};});_0x3c4b7a[_0x6cf6('0x34')]=_[_0x6cf6('0x2e')](_0xfcb0e5,_0x6cf6('0x2c'));_0x3c4b7a[_0x6cf6('0x35')]=_[_0x6cf6('0x36')](_0x2ae422[_0x6cf6('0x35')]);_0x3c4b7a[_0x6cf6('0x37')]=_[_0x6cf6('0x38')](_0x3c4b7a['model'],_0x3c4b7a[_0x6cf6('0x35')]);_0x535b28[_0x6cf6('0x39')]=_[_0x6cf6('0x38')](_0x3c4b7a[_0x6cf6('0x34')],qs[_0x6cf6('0x3a')](_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x3a')]));_0x535b28[_0x6cf6('0x39')]=_0x535b28[_0x6cf6('0x39')][_0x6cf6('0x3b')]?_0x535b28[_0x6cf6('0x39')]:_0x3c4b7a['model'];if(!_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x3c')](_0x6cf6('0x3d'))){_0x535b28[_0x6cf6('0x1e')]=qs[_0x6cf6('0x1e')](_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x1e')]);_0x535b28[_0x6cf6('0x1c')]=qs[_0x6cf6('0x1c')](_0x2ae422['query'][_0x6cf6('0x1c')]);}_0x535b28[_0x6cf6('0x3e')]=qs[_0x6cf6('0x3f')](_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x3f')]);_0x535b28[_0x6cf6('0x40')]=qs[_0x6cf6('0x37')](_[_0x6cf6('0x41')](_0x2ae422[_0x6cf6('0x35')],_0x3c4b7a['filters']),_0xfcb0e5);if(_0x2ae422[_0x6cf6('0x35')]['filter']){_0x535b28[_0x6cf6('0x40')]=_[_0x6cf6('0x42')](_0x535b28[_0x6cf6('0x40')],{'$or':_[_0x6cf6('0x2e')](_0xfcb0e5,function(_0x2cf96b){if(_0x2cf96b[_0x6cf6('0x32')]!==_0x6cf6('0x43')){var _0x26b817={};_0x26b817[_0x2cf96b['name']]={'$like':'%'+_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x44')]+'%'};return _0x26b817;}})});}_0x535b28=_['merge']({},_0x535b28,_0x2ae422[_0x6cf6('0x45')]);var _0x41c16a={'where':_0x535b28[_0x6cf6('0x40')]};return db['VoicePrefix'][_0x6cf6('0x1f')](_0x41c16a)[_0x6cf6('0x25')](function(_0x51d915){_0x145363[_0x6cf6('0x1f')]=_0x51d915;if(_0x2ae422[_0x6cf6('0x35')][_0x6cf6('0x46')]){_0x535b28[_0x6cf6('0x47')]=[{'all':!![]}];}return db[_0x6cf6('0x2f')][_0x6cf6('0x48')](_0x535b28);})[_0x6cf6('0x25')](function(_0x5a2ef8){_0x145363[_0x6cf6('0x49')]=_0x5a2ef8;return _0x145363;})['then'](respondWithFilteredResult(_0x356340,_0x535b28))[_0x6cf6('0x4a')](handleError(_0x356340,null));};exports[_0x6cf6('0x4b')]=function(_0x4927d4,_0x18efca){var _0x14dd21={'raw':![],'where':{'id':_0x4927d4[_0x6cf6('0x4c')]['id']}},_0x235f37={};_0x235f37[_0x6cf6('0x34')]=_['keys'](db[_0x6cf6('0x2f')][_0x6cf6('0x30')]);_0x235f37[_0x6cf6('0x35')]=_['keys'](_0x4927d4[_0x6cf6('0x35')]);_0x235f37[_0x6cf6('0x37')]=_[_0x6cf6('0x38')](_0x235f37['model'],_0x235f37[_0x6cf6('0x35')]);_0x14dd21['attributes']=_['intersection'](_0x235f37[_0x6cf6('0x34')],qs[_0x6cf6('0x3a')](_0x4927d4[_0x6cf6('0x35')][_0x6cf6('0x3a')]));_0x14dd21[_0x6cf6('0x39')]=_0x14dd21[_0x6cf6('0x39')][_0x6cf6('0x3b')]?_0x14dd21[_0x6cf6('0x39')]:_0x235f37[_0x6cf6('0x34')];if(_0x4927d4[_0x6cf6('0x35')][_0x6cf6('0x46')]){_0x14dd21[_0x6cf6('0x47')]=[{'all':!![]}];}_0x14dd21=_[_0x6cf6('0x42')]({},_0x14dd21,_0x4927d4['options']);return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')](_0x14dd21)['then'](handleEntityNotFound(_0x18efca,null))['then'](respondWithResult(_0x18efca,null))[_0x6cf6('0x4a')](handleError(_0x18efca,null));};exports[_0x6cf6('0x26')]=function(_0x1db524,_0x20a106){return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')]({'where':{'id':_0x1db524['params']['id']}})[_0x6cf6('0x25')](handleEntityNotFound(_0x20a106,null))[_0x6cf6('0x25')](removeEntity(_0x20a106,null))[_0x6cf6('0x4a')](handleError(_0x20a106,null));};exports['describe']=function(_0x5df6d3,_0x211b89){return db[_0x6cf6('0x2f')][_0x6cf6('0x4e')]()[_0x6cf6('0x25')](respondWithResult(_0x211b89,null))[_0x6cf6('0x4a')](handleError(_0x211b89,null));};exports[_0x6cf6('0x4f')]=function(_0x2cb470,_0x3e8aee){var _0x3800fe;return db[_0x6cf6('0x50')]['transaction'](function(_0x217072){return db[_0x6cf6('0x2f')][_0x6cf6('0x4f')](_0x2cb470[_0x6cf6('0x51')],{'transaction':_0x217072})[_0x6cf6('0x25')](function(_0x31947d){_0x3800fe=_0x31947d[_0x6cf6('0x52')]({'plain':!![]});return db[_0x6cf6('0x53')][_0x6cf6('0x4d')]({'where':{'id':_0x3800fe[_0x6cf6('0x54')]},'raw':!![]})[_0x6cf6('0x25')](function(_0x4fb831){return createVoicePrefixExtensions(_0x3800fe,_0x4fb831,_0x217072);});});})[_0x6cf6('0x25')](function(){var _0x4ec56b=_0x2cb470[_0x6cf6('0x55')][_0x6cf6('0x52')]({'plain':!![]});if(!_0x4ec56b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec56b[_0x6cf6('0x56')]===_0x6cf6('0x55')){var _0x4699d5=_0x3800fe;return db[_0x6cf6('0x57')][_0x6cf6('0x4d')]({'where':{'name':_0x6cf6('0x27'),'userProfileId':_0x4ec56b['userProfileId']},'raw':!![]})[_0x6cf6('0x25')](function(_0x167356){if(_0x167356&&_0x167356[_0x6cf6('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x4699d5[_0x6cf6('0x2c')],'resourceId':_0x4699d5['id'],'type':_0x167356[_0x6cf6('0x2c')],'sectionId':_0x167356['id']},{})['then'](function(){return _0x3800fe;});}else{return _0x3800fe;}})[_0x6cf6('0x4a')](function(_0x3559ab){logger[_0x6cf6('0x2a')](_0x6cf6('0x59'),_0x3559ab);throw _0x3559ab;});}return _0x3800fe;})[_0x6cf6('0x25')](respondWithResult(_0x3e8aee,null))['catch'](handleError(_0x3e8aee,null));};function Extension(_0x3e7e5b,_0x40b31f,_0x57f26b,_0x4cd6fe){this[_0x6cf6('0x5a')]=_0x6cf6('0x5b');this[_0x6cf6('0x5c')]=_0x3e7e5b;this[_0x6cf6('0x5d')]=_0x57f26b;this[_0x6cf6('0x32')]='system';this['description']=_0x6cf6('0x5e');this[_0x6cf6('0x5f')]=_0x40b31f;this[_0x6cf6('0x60')]=_0x4cd6fe;}function createVoicePrefixExtensions(_0x238002,_0xf8c052,_0x591a24){return new BPromise(function(_0x51dfcf,_0x52df24){var _0x39c857=new Extension(formatPrefixName(_0x238002[_0x6cf6('0x61')]),0x1,_0x6cf6('0x62'),_0x6cf6('0x63'));_0x39c857['VoicePrefixId']=_0x238002['id'];return db[_0x6cf6('0x53')]['create'](_0x39c857,{'transaction':_0x591a24})[_0x6cf6('0x25')](function(_0x54ef08){var _0x3842ff=_0x54ef08[_0x6cf6('0x52')]({'plain':!![]});var _0x2f2ee3=_[_0x6cf6('0x2e')](addVoicePrefixExtensions(_0x238002,_0xf8c052),function(_0x38ebcc){_0x38ebcc['VoiceExtensionId']=_0x3842ff['id'];_0x38ebcc[_0x6cf6('0x64')]=_0x238002['id'];return _0x38ebcc;});return db['VoiceExtension'][_0x6cf6('0x65')](_0x2f2ee3,{'transaction':_0x591a24})['then'](function(_0x4363f7){if(!_0x4363f7){return _0x52df24('Extensions\x20creation\x20failed');}else{return _0x51dfcf(_0x4363f7);}})[_0x6cf6('0x4a')](function(_0x42daab){return _0x52df24(_0x42daab);});});;});};function addVoicePrefixExtensions(_0x5df21f,_0x3b4cb){var _0x15ae6c=[];var _0x1c98c2=formatPrefixName(_0x5df21f[_0x6cf6('0x61')]);_0x15ae6c[_0x6cf6('0x66')](new Extension(_0x1c98c2,0x2,_0x6cf6('0x67'),_0x6cf6('0x68')+_0x5df21f['name']));if(_0x5df21f['callerIdAll']){_0x15ae6c[_0x6cf6('0x66')](new Extension(_0x1c98c2,0x3,_0x6cf6('0x67'),'PREFIX-CALLERIDALL='+_0x5df21f[_0x6cf6('0x69')]));}else{_0x15ae6c['push'](new Extension(_0x1c98c2,0x3,'NoOp',_0x6cf6('0x6a')));}_0x15ae6c['push'](new Extension(_0x1c98c2,0x4,'goto',_0x3b4cb[_0x6cf6('0x5a')]+','+_0x6cf6('0x6b')+(0x8+_0x5df21f[_0x6cf6('0x2c')]['length'])+'}'+','+0x1));return _0x15ae6c;}function formatPrefixName(_0x18b60c){var _0x4a2451='_';for(var _0x2dedba=0x0;_0x2dedba<_0x18b60c[_0x6cf6('0x3b')];_0x2dedba++){if(_0x18b60c['charAt'](_0x2dedba)=='-'){_0x4a2451+=_0x18b60c[_0x6cf6('0x6c')](_0x2dedba);}else{_0x4a2451+='['+_0x18b60c[_0x6cf6('0x6c')](_0x2dedba)+']';}}_0x4a2451+='.';return _0x4a2451;}exports[_0x6cf6('0x24')]=function(_0x421819,_0xa36ee1,_0x40ea5e){var _0x59180d=_0x421819[_0x6cf6('0x51')];_0x59180d[_0x6cf6('0x61')]=_0x6cf6('0x6d')+_0x59180d[_0x6cf6('0x2c')]+'-';return db[_0x6cf6('0x50')][_0x6cf6('0x6e')](function(_0x55ea84){return db['VoicePrefix']['update'](_0x59180d,{'where':{'id':_0x59180d['id']},'transaction':_0x55ea84})[_0x6cf6('0x25')](function(){return db['VoiceExtension'][_0x6cf6('0x26')]({'where':{'VoicePrefixId':_0x59180d['id']},'transaction':_0x55ea84})['then'](function(){return db[_0x6cf6('0x53')][_0x6cf6('0x4d')]({'where':{'id':_0x59180d['VoiceExtensionId']},'raw':!![]})[_0x6cf6('0x25')](function(_0xd11d4b){return createVoicePrefixExtensions(_0x59180d,_0xd11d4b,_0x55ea84);});});});})[_0x6cf6('0x25')](function(){return db['VoicePrefix'][_0x6cf6('0x6f')](_0x59180d['id']);})['then'](respondWithResult(_0xa36ee1,null))[_0x6cf6('0x4a')](handleError(_0xa36ee1,null));};exports[_0x6cf6('0x70')]=function(_0x1635dc,_0x308076,_0x33b436){return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')]({'where':{'id':_0x1635dc['params']['id']}})[_0x6cf6('0x25')](handleEntityNotFound(_0x308076,null))['then'](function(_0x3f3d67){if(_0x3f3d67){return _0x3f3d67[_0x6cf6('0x70')](_0x1635dc[_0x6cf6('0x51')][_0x6cf6('0x71')],_['omit'](_0x1635dc['body'],[_0x6cf6('0x71'),'id'])||{})[_0x6cf6('0x72')](function(_0x1a0c49){for(var _0x3060d=0x0;_0x3060d<_0x1635dc[_0x6cf6('0x51')][_0x6cf6('0x71')]['length'];_0x3060d+=0x1){socket['emit'](_0x6cf6('0x73'),{'UserId':Number(_0x1635dc['body'][_0x6cf6('0x71')][_0x3060d]),'VoicePrefixId':Number(_0x1635dc[_0x6cf6('0x4c')]['id'])});}return _0x1a0c49;});}})[_0x6cf6('0x25')](respondWithResult(_0x308076,null))[_0x6cf6('0x4a')](handleError(_0x308076,null));};exports['removeAgents']=function(_0x4435bc,_0x4c5f0d,_0x49cf03){return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')]({'where':{'id':_0x4435bc['params']['id']}})[_0x6cf6('0x25')](handleEntityNotFound(_0x4c5f0d,null))[_0x6cf6('0x25')](function(_0x37fa59){if(_0x37fa59){return _0x37fa59['removeAgents'](_0x4435bc[_0x6cf6('0x35')][_0x6cf6('0x71')])[_0x6cf6('0x25')](function(){if(_['isArray'](_0x4435bc['query'][_0x6cf6('0x71')])){for(var _0x5189b6=0x0;_0x5189b6<_0x4435bc['query'][_0x6cf6('0x71')][_0x6cf6('0x3b')];_0x5189b6+=0x1){socket[_0x6cf6('0x74')](_0x6cf6('0x75'),{'UserId':Number(_0x4435bc[_0x6cf6('0x35')][_0x6cf6('0x71')][_0x5189b6]),'VoicePrefixId':Number(_0x4435bc[_0x6cf6('0x4c')]['id'])});}}else{socket[_0x6cf6('0x74')](_0x6cf6('0x75'),{'UserId':Number(_0x4435bc['query'][_0x6cf6('0x71')]),'VoicePrefixId':Number(_0x4435bc[_0x6cf6('0x4c')]['id'])});}});}})[_0x6cf6('0x25')](respondWithStatusCode(_0x4c5f0d,null))['catch'](handleError(_0x4c5f0d,null));};exports['getAgents']=function(_0x38b830,_0x169a33,_0x204f3d){var _0x1c254d={};var _0x38652f={};var _0x1fee93;var _0x5e953e;return db[_0x6cf6('0x2f')][_0x6cf6('0x76')]({'where':{'id':_0x38b830[_0x6cf6('0x4c')]['id']}})[_0x6cf6('0x25')](handleEntityNotFound(_0x169a33,null))[_0x6cf6('0x25')](function(_0x260a62){if(_0x260a62){_0x1fee93=_0x260a62;_0x38652f[_0x6cf6('0x34')]=_['keys'](db[_0x6cf6('0x77')][_0x6cf6('0x30')]);_0x38652f['query']=_[_0x6cf6('0x36')](_0x38b830[_0x6cf6('0x35')]);_0x38652f[_0x6cf6('0x37')]=_['intersection'](_0x38652f[_0x6cf6('0x34')],_0x38652f[_0x6cf6('0x35')]);_0x1c254d[_0x6cf6('0x39')]=_[_0x6cf6('0x38')](_0x38652f[_0x6cf6('0x34')],qs[_0x6cf6('0x3a')](_0x38b830['query']['fields']));_0x1c254d['attributes']=_0x1c254d[_0x6cf6('0x39')]['length']?_0x1c254d[_0x6cf6('0x39')]:_0x38652f[_0x6cf6('0x34')];_0x1c254d['order']=qs[_0x6cf6('0x3f')](_0x38b830[_0x6cf6('0x35')][_0x6cf6('0x3f')]);_0x1c254d[_0x6cf6('0x40')]=qs[_0x6cf6('0x37')](_['pick'](_0x38b830[_0x6cf6('0x35')],_0x38652f[_0x6cf6('0x37')]));if(_0x38b830[_0x6cf6('0x35')]['filter']){_0x1c254d['where']=_[_0x6cf6('0x42')](_0x1c254d[_0x6cf6('0x40')],{'$or':_[_0x6cf6('0x2e')](_0x1c254d[_0x6cf6('0x39')],function(_0x296664){var _0x1841b5={};_0x1841b5[_0x296664]={'$like':'%'+_0x38b830[_0x6cf6('0x35')]['filter']+'%'};return _0x1841b5;})});}_0x1c254d=_[_0x6cf6('0x42')]({},_0x1c254d,_0x38b830[_0x6cf6('0x45')]);return _0x1fee93[_0x6cf6('0x78')](_0x1c254d);}})['then'](function(_0x27c0cb){if(_0x27c0cb){_0x5e953e=_0x27c0cb[_0x6cf6('0x3b')];if(!_0x38b830[_0x6cf6('0x35')][_0x6cf6('0x3c')]('nolimit')){_0x1c254d[_0x6cf6('0x1e')]=qs[_0x6cf6('0x1e')](_0x38b830[_0x6cf6('0x35')][_0x6cf6('0x1e')]);_0x1c254d[_0x6cf6('0x1c')]=qs[_0x6cf6('0x1c')](_0x38b830[_0x6cf6('0x35')]['offset']);}return _0x1fee93['getAgents'](_0x1c254d);}})['then'](function(_0x5b1385){if(_0x5b1385){return _0x5b1385?{'count':_0x5e953e,'rows':_0x5b1385}:null;}})[_0x6cf6('0x25')](respondWithResult(_0x169a33,null))[_0x6cf6('0x4a')](handleError(_0x169a33,null));};exports['getTeams']=function(_0x165121,_0x16f407,_0x558601){var _0x41b355={};var _0x4fb1d9={};var _0x5b4b7c;var _0x267856;return db[_0x6cf6('0x2f')][_0x6cf6('0x76')]({'where':{'id':_0x165121[_0x6cf6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x16f407,null))[_0x6cf6('0x25')](function(_0x12196d){if(_0x12196d){_0x5b4b7c=_0x12196d;_0x4fb1d9['model']=_[_0x6cf6('0x36')](db[_0x6cf6('0x79')]['rawAttributes']);_0x4fb1d9[_0x6cf6('0x35')]=_['keys'](_0x165121[_0x6cf6('0x35')]);_0x4fb1d9['filters']=_[_0x6cf6('0x38')](_0x4fb1d9[_0x6cf6('0x34')],_0x4fb1d9['query']);_0x41b355[_0x6cf6('0x39')]=_['intersection'](_0x4fb1d9['model'],qs[_0x6cf6('0x3a')](_0x165121[_0x6cf6('0x35')][_0x6cf6('0x3a')]));_0x41b355[_0x6cf6('0x39')]=_0x41b355['attributes'][_0x6cf6('0x3b')]?_0x41b355[_0x6cf6('0x39')]:_0x4fb1d9[_0x6cf6('0x34')];_0x41b355[_0x6cf6('0x3e')]=qs[_0x6cf6('0x3f')](_0x165121[_0x6cf6('0x35')][_0x6cf6('0x3f')]);_0x41b355[_0x6cf6('0x40')]=qs[_0x6cf6('0x37')](_[_0x6cf6('0x41')](_0x165121[_0x6cf6('0x35')],_0x4fb1d9[_0x6cf6('0x37')]));if(_0x165121[_0x6cf6('0x35')][_0x6cf6('0x44')]){_0x41b355[_0x6cf6('0x40')]=_[_0x6cf6('0x42')](_0x41b355[_0x6cf6('0x40')],{'$or':_[_0x6cf6('0x2e')](_0x41b355[_0x6cf6('0x39')],function(_0x44ec79){var _0x506275={};_0x506275[_0x44ec79]={'$like':'%'+_0x165121[_0x6cf6('0x35')][_0x6cf6('0x44')]+'%'};return _0x506275;})});}_0x41b355=_[_0x6cf6('0x42')]({},_0x41b355,_0x165121[_0x6cf6('0x45')]);return _0x5b4b7c[_0x6cf6('0x7a')](_0x41b355);}})[_0x6cf6('0x25')](function(_0x1013cb){if(_0x1013cb){_0x267856=_0x1013cb['length'];if(!_0x165121['query']['hasOwnProperty'](_0x6cf6('0x3d'))){_0x41b355['limit']=qs[_0x6cf6('0x1e')](_0x165121[_0x6cf6('0x35')]['limit']);_0x41b355['offset']=qs[_0x6cf6('0x1c')](_0x165121['query'][_0x6cf6('0x1c')]);}return _0x5b4b7c[_0x6cf6('0x7a')](_0x41b355);}})[_0x6cf6('0x25')](function(_0x1ff190){if(_0x1ff190){return _0x1ff190?{'count':_0x267856,'rows':_0x1ff190}:null;}})[_0x6cf6('0x25')](respondWithResult(_0x16f407,null))[_0x6cf6('0x4a')](handleError(_0x16f407,null));};exports['addTeams']=function(_0x14cafd,_0x43e3ff,_0x5bf895){var _0x42098b=_0x14cafd[_0x6cf6('0x51')]['ids'];var _0x200234;return db[_0x6cf6('0x79')][_0x6cf6('0x48')]({'where':{'id':_0x42098b},'attributes':['id'],'include':[{'model':db[_0x6cf6('0x77')],'as':'Agents','attributes':['id',_0x6cf6('0x2c'),_0x6cf6('0x7b'),_0x6cf6('0x7c'),_0x6cf6('0x7d')],'raw':!![]}]})['then'](function(_0xc0ecf4){if(_0xc0ecf4){_0x200234=_0xc0ecf4;var _0x17b193=_[_0x6cf6('0x7e')](_0xc0ecf4,function(_0x2b083f){var _0x54422f=_0x2b083f['get']({'plain':!![]});return _0x54422f[_0x6cf6('0x7f')];});return db[_0x6cf6('0x2f')][_0x6cf6('0x4d')]({'where':{'id':_0x14cafd[_0x6cf6('0x4c')]['id']}})['then'](function(_0x4a5e51){return db[_0x6cf6('0x50')][_0x6cf6('0x6e')](function(_0xb9cbc3){return _0x4a5e51[_0x6cf6('0x80')](_0x42098b,{'transaction':_0xb9cbc3})[_0x6cf6('0x25')](function(){return BPromise[_0x6cf6('0x81')](_0x200234,function(_0x53f0a3){return db[_0x6cf6('0x82')][_0x6cf6('0x83')]({'TeamId':_0x53f0a3['id'],'VoicePrefixId':_0x14cafd[_0x6cf6('0x4c')]['id']},{'transaction':_0xb9cbc3});});})[_0x6cf6('0x25')](function(){return BPromise[_0x6cf6('0x81')](_0x17b193,function(_0x450ffb){return db[_0x6cf6('0x84')][_0x6cf6('0x85')]({'where':{'UserId':_0x450ffb['id'],'VoicePrefixId':_0x14cafd[_0x6cf6('0x4c')]['id']},'transaction':_0xb9cbc3});});})[_0x6cf6('0x25')](function(){_0x17b193[_0x6cf6('0x86')](function(_0x476abd){socket[_0x6cf6('0x74')](_0x6cf6('0x73'),{'UserId':_0x476abd['id'],'VoicePrefixId':_0x4a5e51['id']});});});});});}})[_0x6cf6('0x25')](respondWithStatusCode(_0x43e3ff,null))[_0x6cf6('0x4a')](handleError(_0x43e3ff,null));};exports['removeTeams']=function(_0x17b497,_0x1f5c50,_0x46ecdb){return db['Team']['findAll']({'where':{'id':_0x17b497['query'][_0x6cf6('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6cf6('0x25')](handleEntityNotFound(_0x1f5c50,null))[_0x6cf6('0x25')](function(_0x41aae0){var _0x208719=_['map'](_0x41aae0,'id');var _0x395343=[];var _0x4669b2=[];var _0x91f143=squel[_0x6cf6('0x87')]();_0x91f143[_0x6cf6('0x88')](_0x6cf6('0x89'))[_0x6cf6('0x8a')](_0x6cf6('0x8b'),'tq')[_0x6cf6('0x8c')](_0x6cf6('0x8d'),'ut',_0x6cf6('0x8e'))[_0x6cf6('0x40')](_0x6cf6('0x8f'),_0x17b497['params']['id']);for(var _0x210578=0x0;_0x210578<_0x41aae0['length'];_0x210578+=0x1){let _0xeff7c=_0x41aae0[_0x210578];for(var _0x5e90f0=0x0;_0x5e90f0<_0xeff7c[_0x6cf6('0x7f')][_0x6cf6('0x3b')];_0x5e90f0+=0x1){let _0x193ad7=_0xeff7c['Agents'][_0x5e90f0];var _0x50def2=_0x91f143[_0x6cf6('0x90')]();_0x50def2[_0x6cf6('0x40')](_0x6cf6('0x91'),_0x193ad7['id']);_0x4669b2[_0x6cf6('0x66')](db['sequelize']['query'](_0x50def2[_0x6cf6('0x92')](),{'type':db['sequelize'][_0x6cf6('0x93')][_0x6cf6('0x94')]})[_0x6cf6('0x25')](function(_0x279675){if(_0x279675[_0x6cf6('0x3b')]===0x1){return _0x193ad7['id'];}else{var _0x3e0d2d=_[_0x6cf6('0x95')](_[_0x6cf6('0x2e')](_0x279675,'TeamId'),function(_0x414e9e){return _[_0x6cf6('0x96')](_0x208719,_0x414e9e);});if(_0x3e0d2d){return _0x193ad7['id'];}}}));}}return BPromise[_0x6cf6('0x97')](_0x4669b2)[_0x6cf6('0x25')](function(_0x1b32e6){_0x395343=_(_0x395343)['union'](_0x1b32e6)[_0x6cf6('0x98')]()['value']();return db['VoicePrefix'][_0x6cf6('0x4d')]({'where':{'id':_0x17b497['params']['id']}})['then'](function(_0x2ca336){return db[_0x6cf6('0x50')][_0x6cf6('0x6e')](function(_0x3a1d61){return _0x2ca336['removeTeams'](_0x17b497[_0x6cf6('0x35')]['ids'],{'transaction':_0x3a1d61})[_0x6cf6('0x25')](function(){if(!_[_0x6cf6('0x99')](_0x395343)){return _0x2ca336[_0x6cf6('0x9a')](_0x395343,{'transaction':_0x3a1d61});}})[_0x6cf6('0x25')](function(){_0x395343[_0x6cf6('0x86')](function(_0x48e595){socket[_0x6cf6('0x74')](_0x6cf6('0x75'),{'UserId':_0x48e595,'VoicePrefixId':_0x2ca336['id']});});});});});});})[_0x6cf6('0x25')](respondWithStatusCode(_0x1f5c50,null))[_0x6cf6('0x4a')](handleError(_0x1f5c50,null));}; \ No newline at end of file +var _0x8603=['send','map','VoicePrefix','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','findOrCreate','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','includes','all','union','compact','forEach','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8603,0x190));var _0x3860=function(_0x3b9326,_0x2bd1a0){_0x3b9326=_0x3b9326-0x0;var _0x17a26a=_0x8603[_0x3b9326];return _0x17a26a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x46264d,_0x54dbc3){_0x54dbc3=_0x54dbc3||0xcc;return function(_0x3d861d){if(_0x3d861d){return _0x46264d[_0x3860('0x1b')](_0x54dbc3);}return _0x46264d[_0x3860('0x1c')](_0x54dbc3)[_0x3860('0x1d')]();};}function respondWithResult(_0x1055b3,_0xfa0c9a){_0xfa0c9a=_0xfa0c9a||0xc8;return function(_0x2d8a3a){if(_0x2d8a3a){return _0x1055b3[_0x3860('0x1c')](_0xfa0c9a)[_0x3860('0x1e')](_0x2d8a3a);}};}function respondWithFilteredResult(_0x3c0d91,_0x3e51b4){return function(_0x45b799){if(_0x45b799){var _0x4b6b15=typeof _0x3e51b4['offset']===_0x3860('0x1f')&&typeof _0x3e51b4[_0x3860('0x20')]===_0x3860('0x1f');var _0x53fc63=_0x45b799[_0x3860('0x21')];var _0x145b26=_0x4b6b15?0x0:_0x3e51b4[_0x3860('0x22')];var _0x3af33a=_0x4b6b15?_0x45b799[_0x3860('0x21')]:_0x3e51b4[_0x3860('0x22')]+_0x3e51b4[_0x3860('0x20')];var _0x1f8891;if(_0x3af33a>=_0x53fc63){_0x3af33a=_0x53fc63;_0x1f8891=0xc8;}else{_0x1f8891=0xce;}_0x3c0d91[_0x3860('0x1c')](_0x1f8891);return _0x3c0d91[_0x3860('0x23')](_0x3860('0x24'),_0x145b26+'-'+_0x3af33a+'/'+_0x53fc63)[_0x3860('0x1e')](_0x45b799);}return null;};}function patchUpdates(_0x280ea9){return function(_0x9eaaa1){try{jsonpatch[_0x3860('0x25')](_0x9eaaa1,_0x280ea9,!![]);}catch(_0x564efd){return BPromise[_0x3860('0x26')](_0x564efd);}return _0x9eaaa1[_0x3860('0x27')]();};}function saveUpdates(_0x2b91f2,_0x301e03){return function(_0x20bb1e){if(_0x20bb1e){return _0x20bb1e['update'](_0x2b91f2)[_0x3860('0x28')](function(_0x568515){return _0x568515;});}return null;};}function removeEntity(_0x577750,_0xfa9705){return function(_0x1c4bbc){if(_0x1c4bbc){return _0x1c4bbc['destroy']()['then'](function(){var _0x5f42d5=_0x1c4bbc[_0x3860('0x29')]({'plain':!![]});var _0x3ebc5b=_0x3860('0x2a');return db[_0x3860('0x2b')][_0x3860('0x2c')]({'where':{'type':_0x3ebc5b,'resourceId':_0x5f42d5['id']}})[_0x3860('0x28')](function(){return _0x1c4bbc;});})['then'](function(){_0x577750['status'](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x1f1809,_0x5a9af2){return function(_0x2551f4){if(!_0x2551f4){_0x1f1809[_0x3860('0x1b')](0x194);}return _0x2551f4;};}function handleError(_0x10d9e4,_0x426e6c){_0x426e6c=_0x426e6c||0x1f4;return function(_0x3628f7){logger['error'](_0x3628f7[_0x3860('0x2d')]);if(_0x3628f7[_0x3860('0x2e')]){delete _0x3628f7[_0x3860('0x2e')];}_0x10d9e4['status'](_0x426e6c)[_0x3860('0x2f')](_0x3628f7);};}exports['index']=function(_0x294b3a,_0x4825f0){var _0x1c498c={},_0x2e542a={},_0x24cf39={'count':0x0,'rows':[]};var _0x47e350=_[_0x3860('0x30')](db[_0x3860('0x31')]['rawAttributes'],function(_0x1c94cc){return{'name':_0x1c94cc['fieldName'],'type':_0x1c94cc[_0x3860('0x32')][_0x3860('0x33')]};});_0x2e542a[_0x3860('0x34')]=_[_0x3860('0x30')](_0x47e350,_0x3860('0x2e'));_0x2e542a[_0x3860('0x35')]=_[_0x3860('0x36')](_0x294b3a['query']);_0x2e542a[_0x3860('0x37')]=_[_0x3860('0x38')](_0x2e542a['model'],_0x2e542a[_0x3860('0x35')]);_0x1c498c[_0x3860('0x39')]=_[_0x3860('0x38')](_0x2e542a['model'],qs['fields'](_0x294b3a[_0x3860('0x35')][_0x3860('0x3a')]));_0x1c498c[_0x3860('0x39')]=_0x1c498c[_0x3860('0x39')]['length']?_0x1c498c['attributes']:_0x2e542a[_0x3860('0x34')];if(!_0x294b3a[_0x3860('0x35')][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1c498c[_0x3860('0x20')]=qs['limit'](_0x294b3a[_0x3860('0x35')][_0x3860('0x20')]);_0x1c498c['offset']=qs['offset'](_0x294b3a[_0x3860('0x35')][_0x3860('0x22')]);}_0x1c498c[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x294b3a[_0x3860('0x35')]['sort']);_0x1c498c[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x294b3a[_0x3860('0x35')],_0x2e542a['filters']),_0x47e350);if(_0x294b3a[_0x3860('0x35')][_0x3860('0x41')]){_0x1c498c['where']=_[_0x3860('0x42')](_0x1c498c[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x47e350,function(_0xf346e){if(_0xf346e['type']!==_0x3860('0x43')){var _0x47141b={};_0x47141b[_0xf346e[_0x3860('0x2e')]]={'$like':'%'+_0x294b3a['query'][_0x3860('0x41')]+'%'};return _0x47141b;}})});}_0x1c498c=_['merge']({},_0x1c498c,_0x294b3a[_0x3860('0x44')]);var _0x424801={'where':_0x1c498c[_0x3860('0x3f')]};return db[_0x3860('0x31')][_0x3860('0x21')](_0x424801)[_0x3860('0x28')](function(_0x4e0a44){_0x24cf39[_0x3860('0x21')]=_0x4e0a44;if(_0x294b3a[_0x3860('0x35')]['includeAll']){_0x1c498c['include']=[{'all':!![]}];}return db[_0x3860('0x31')][_0x3860('0x45')](_0x1c498c);})['then'](function(_0x164a77){_0x24cf39[_0x3860('0x46')]=_0x164a77;return _0x24cf39;})['then'](respondWithFilteredResult(_0x4825f0,_0x1c498c))[_0x3860('0x47')](handleError(_0x4825f0,null));};exports[_0x3860('0x48')]=function(_0x392dc3,_0x37e5c3){var _0x14f5b2={'raw':![],'where':{'id':_0x392dc3[_0x3860('0x49')]['id']}},_0x3fa282={};_0x3fa282[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x31')][_0x3860('0x4a')]);_0x3fa282[_0x3860('0x35')]=_[_0x3860('0x36')](_0x392dc3['query']);_0x3fa282[_0x3860('0x37')]=_['intersection'](_0x3fa282[_0x3860('0x34')],_0x3fa282[_0x3860('0x35')]);_0x14f5b2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x3fa282[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x392dc3[_0x3860('0x35')][_0x3860('0x3a')]));_0x14f5b2['attributes']=_0x14f5b2[_0x3860('0x39')][_0x3860('0x4b')]?_0x14f5b2[_0x3860('0x39')]:_0x3fa282['model'];if(_0x392dc3[_0x3860('0x35')][_0x3860('0x4c')]){_0x14f5b2[_0x3860('0x4d')]=[{'all':!![]}];}_0x14f5b2=_[_0x3860('0x42')]({},_0x14f5b2,_0x392dc3['options']);return db['VoicePrefix'][_0x3860('0x4e')](_0x14f5b2)['then'](handleEntityNotFound(_0x37e5c3,null))[_0x3860('0x28')](respondWithResult(_0x37e5c3,null))[_0x3860('0x47')](handleError(_0x37e5c3,null));};exports[_0x3860('0x2c')]=function(_0x52456e,_0x29c52d){return db['VoicePrefix'][_0x3860('0x4e')]({'where':{'id':_0x52456e['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x29c52d,null))[_0x3860('0x28')](removeEntity(_0x29c52d,null))[_0x3860('0x47')](handleError(_0x29c52d,null));};exports['describe']=function(_0x4876ab,_0x4408b5){return db[_0x3860('0x31')]['describe']()[_0x3860('0x28')](respondWithResult(_0x4408b5,null))['catch'](handleError(_0x4408b5,null));};exports[_0x3860('0x4f')]=function(_0x1267e1,_0x254631){var _0x233eee;return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x3fad85){return db['VoicePrefix'][_0x3860('0x4f')](_0x1267e1[_0x3860('0x52')],{'transaction':_0x3fad85})[_0x3860('0x28')](function(_0x137789){_0x233eee=_0x137789[_0x3860('0x29')]({'plain':!![]});return db[_0x3860('0x53')]['find']({'where':{'id':_0x233eee[_0x3860('0x54')]},'raw':!![]})[_0x3860('0x28')](function(_0x19a26d){return createVoicePrefixExtensions(_0x233eee,_0x19a26d,_0x3fad85);});});})[_0x3860('0x28')](function(){var _0x3a55e7=_0x1267e1[_0x3860('0x55')][_0x3860('0x29')]({'plain':!![]});if(!_0x3a55e7)throw new Error(_0x3860('0x56'));if(_0x3a55e7['role']===_0x3860('0x55')){var _0x2ff0bf=_0x233eee;return db['UserProfileSection'][_0x3860('0x4e')]({'where':{'name':_0x3860('0x2a'),'userProfileId':_0x3a55e7[_0x3860('0x57')]},'raw':!![]})['then'](function(_0x17d2df){if(_0x17d2df&&_0x17d2df['autoAssociation']===0x0){return db[_0x3860('0x2b')][_0x3860('0x4f')]({'name':_0x2ff0bf[_0x3860('0x2e')],'resourceId':_0x2ff0bf['id'],'type':_0x17d2df[_0x3860('0x2e')],'sectionId':_0x17d2df['id']},{})[_0x3860('0x28')](function(){return _0x233eee;});}else{return _0x233eee;}})[_0x3860('0x47')](function(_0x1a4f58){logger[_0x3860('0x58')](_0x3860('0x59'),_0x1a4f58);throw _0x1a4f58;});}return _0x233eee;})[_0x3860('0x28')](respondWithResult(_0x254631,null))[_0x3860('0x47')](handleError(_0x254631,null));};function Extension(_0x2bac24,_0x58147d,_0x5ce9a4,_0x5111e0){this[_0x3860('0x5a')]='from-sip';this['exten']=_0x2bac24;this[_0x3860('0x5b')]=_0x5ce9a4;this[_0x3860('0x32')]=_0x3860('0x5c');this[_0x3860('0x5d')]=_0x3860('0x5e');this[_0x3860('0x5f')]=_0x58147d;this['appdata']=_0x5111e0;}function createVoicePrefixExtensions(_0x49ec68,_0x4df47b,_0x1d6c70){return new BPromise(function(_0x1c1da4,_0x2d1646){var _0x5ec169=new Extension(formatPrefixName(_0x49ec68[_0x3860('0x60')]),0x1,'NoOp',_0x3860('0x61'));_0x5ec169[_0x3860('0x62')]=_0x49ec68['id'];return db['VoiceExtension'][_0x3860('0x4f')](_0x5ec169,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0xfe45d8){var _0x27f817=_0xfe45d8['get']({'plain':!![]});var _0x18cc37=_[_0x3860('0x30')](addVoicePrefixExtensions(_0x49ec68,_0x4df47b),function(_0x17f248){_0x17f248['VoiceExtensionId']=_0x27f817['id'];_0x17f248['VoicePrefixId']=_0x49ec68['id'];return _0x17f248;});return db[_0x3860('0x53')][_0x3860('0x63')](_0x18cc37,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0x1ca0e7){if(!_0x1ca0e7){return _0x2d1646(_0x3860('0x64'));}else{return _0x1c1da4(_0x1ca0e7);}})[_0x3860('0x47')](function(_0x5d0210){return _0x2d1646(_0x5d0210);});});;});};function addVoicePrefixExtensions(_0x2d916a,_0x4fe4e8){var _0x5db8f9=[];var _0x15fa2d=formatPrefixName(_0x2d916a[_0x3860('0x60')]);_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x2,_0x3860('0x66'),_0x3860('0x67')+_0x2d916a[_0x3860('0x2e')]));if(_0x2d916a['callerIdAll']){_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x66'),_0x3860('0x68')+_0x2d916a[_0x3860('0x69')]));}else{_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x6a'),'No\x20callerid\x20available'));}_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x4,_0x3860('0x6b'),_0x4fe4e8[_0x3860('0x5a')]+','+'${EXTEN:'+(0x8+_0x2d916a['name'][_0x3860('0x4b')])+'}'+','+0x1));return _0x5db8f9;}function formatPrefixName(_0x2d425d){var _0x11c2c8='_';for(var _0x3b7a76=0x0;_0x3b7a76<_0x2d425d[_0x3860('0x4b')];_0x3b7a76++){if(_0x2d425d['charAt'](_0x3b7a76)=='-'){_0x11c2c8+=_0x2d425d['charAt'](_0x3b7a76);}else{_0x11c2c8+='['+_0x2d425d[_0x3860('0x6c')](_0x3b7a76)+']';}}_0x11c2c8+='.';return _0x11c2c8;}exports[_0x3860('0x6d')]=function(_0x47e144,_0x5d9416,_0x2fd2ec){var _0x38ad4e=_0x47e144['body'];_0x38ad4e[_0x3860('0x60')]=_0x3860('0x6e')+_0x38ad4e[_0x3860('0x2e')]+'-';return db[_0x3860('0x50')]['transaction'](function(_0x1e8c5c){return db[_0x3860('0x31')]['update'](_0x38ad4e,{'where':{'id':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')][_0x3860('0x2c')]({'where':{'VoicePrefixId':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')]['find']({'where':{'id':_0x38ad4e[_0x3860('0x54')]},'raw':!![]})['then'](function(_0x543574){return createVoicePrefixExtensions(_0x38ad4e,_0x543574,_0x1e8c5c);});});});})[_0x3860('0x28')](function(){return db['VoicePrefix'][_0x3860('0x6f')](_0x38ad4e['id']);})[_0x3860('0x28')](respondWithResult(_0x5d9416,null))[_0x3860('0x47')](handleError(_0x5d9416,null));};exports[_0x3860('0x70')]=function(_0x19f717,_0x43c5a1,_0x4b3447){return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x19f717[_0x3860('0x49')]['id']}})['then'](handleEntityNotFound(_0x43c5a1,null))[_0x3860('0x28')](function(_0x55661a){if(_0x55661a){return _0x55661a[_0x3860('0x70')](_0x19f717[_0x3860('0x52')]['ids'],_[_0x3860('0x71')](_0x19f717[_0x3860('0x52')],[_0x3860('0x72'),'id'])||{})['spread'](function(_0x572707){for(var _0x5a282a=0x0;_0x5a282a<_0x19f717['body'][_0x3860('0x72')][_0x3860('0x4b')];_0x5a282a+=0x1){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':Number(_0x19f717['body']['ids'][_0x5a282a]),'VoicePrefixId':Number(_0x19f717[_0x3860('0x49')]['id'])});}return _0x572707;});}})[_0x3860('0x28')](respondWithResult(_0x43c5a1,null))[_0x3860('0x47')](handleError(_0x43c5a1,null));};exports[_0x3860('0x75')]=function(_0x4b0652,_0x3a7c0c,_0x306560){return db['VoicePrefix']['find']({'where':{'id':_0x4b0652[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x3a7c0c,null))[_0x3860('0x28')](function(_0x27894f){if(_0x27894f){return _0x27894f['removeAgents'](_0x4b0652['query'][_0x3860('0x72')])['then'](function(){if(_[_0x3860('0x76')](_0x4b0652[_0x3860('0x35')]['ids'])){for(var _0x4e7713=0x0;_0x4e7713<_0x4b0652['query'][_0x3860('0x72')][_0x3860('0x4b')];_0x4e7713+=0x1){socket['emit'](_0x3860('0x77'),{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')][_0x4e7713]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}}else{socket[_0x3860('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}});}})[_0x3860('0x28')](respondWithStatusCode(_0x3a7c0c,null))[_0x3860('0x47')](handleError(_0x3a7c0c,null));};exports['getAgents']=function(_0x313366,_0xf57e80,_0x2f3759){var _0x41ee6f={};var _0x28fcb6={};var _0x543c98;var _0x532370;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x313366[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0xf57e80,null))[_0x3860('0x28')](function(_0x293c60){if(_0x293c60){_0x543c98=_0x293c60;_0x28fcb6[_0x3860('0x34')]=_['keys'](db[_0x3860('0x79')][_0x3860('0x4a')]);_0x28fcb6['query']=_[_0x3860('0x36')](_0x313366[_0x3860('0x35')]);_0x28fcb6[_0x3860('0x37')]=_['intersection'](_0x28fcb6[_0x3860('0x34')],_0x28fcb6[_0x3860('0x35')]);_0x41ee6f['attributes']=_[_0x3860('0x38')](_0x28fcb6['model'],qs[_0x3860('0x3a')](_0x313366[_0x3860('0x35')]['fields']));_0x41ee6f[_0x3860('0x39')]=_0x41ee6f[_0x3860('0x39')][_0x3860('0x4b')]?_0x41ee6f[_0x3860('0x39')]:_0x28fcb6[_0x3860('0x34')];_0x41ee6f['order']=qs[_0x3860('0x3e')](_0x313366[_0x3860('0x35')][_0x3860('0x3e')]);_0x41ee6f[_0x3860('0x3f')]=qs[_0x3860('0x37')](_['pick'](_0x313366['query'],_0x28fcb6[_0x3860('0x37')]));if(_0x313366[_0x3860('0x35')]['filter']){_0x41ee6f[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x41ee6f[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x41ee6f['attributes'],function(_0x3a0719){var _0x5a2f99={};_0x5a2f99[_0x3a0719]={'$like':'%'+_0x313366[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x5a2f99;})});}_0x41ee6f=_[_0x3860('0x42')]({},_0x41ee6f,_0x313366[_0x3860('0x44')]);return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})[_0x3860('0x28')](function(_0x467b1b){if(_0x467b1b){_0x532370=_0x467b1b['length'];if(!_0x313366[_0x3860('0x35')][_0x3860('0x3b')]('nolimit')){_0x41ee6f['limit']=qs['limit'](_0x313366['query'][_0x3860('0x20')]);_0x41ee6f[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x313366[_0x3860('0x35')][_0x3860('0x22')]);}return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})['then'](function(_0x204da6){if(_0x204da6){return _0x204da6?{'count':_0x532370,'rows':_0x204da6}:null;}})['then'](respondWithResult(_0xf57e80,null))[_0x3860('0x47')](handleError(_0xf57e80,null));};exports[_0x3860('0x7b')]=function(_0x897ea0,_0x221229,_0x459b6c){var _0x1108d2={};var _0x23d7f0={};var _0x52987a;var _0xcd4bd3;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x897ea0['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x221229,null))[_0x3860('0x28')](function(_0x1c87bd){if(_0x1c87bd){_0x52987a=_0x1c87bd;_0x23d7f0['model']=_[_0x3860('0x36')](db[_0x3860('0x7c')][_0x3860('0x4a')]);_0x23d7f0[_0x3860('0x35')]=_['keys'](_0x897ea0[_0x3860('0x35')]);_0x23d7f0[_0x3860('0x37')]=_[_0x3860('0x38')](_0x23d7f0['model'],_0x23d7f0[_0x3860('0x35')]);_0x1108d2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x23d7f0['model'],qs[_0x3860('0x3a')](_0x897ea0[_0x3860('0x35')][_0x3860('0x3a')]));_0x1108d2['attributes']=_0x1108d2[_0x3860('0x39')][_0x3860('0x4b')]?_0x1108d2[_0x3860('0x39')]:_0x23d7f0['model'];_0x1108d2[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x897ea0[_0x3860('0x35')]['sort']);_0x1108d2[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x897ea0['query'],_0x23d7f0[_0x3860('0x37')]));if(_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]){_0x1108d2[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x1108d2[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x1108d2[_0x3860('0x39')],function(_0x3f808c){var _0x1de607={};_0x1de607[_0x3f808c]={'$like':'%'+_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x1de607;})});}_0x1108d2=_[_0x3860('0x42')]({},_0x1108d2,_0x897ea0[_0x3860('0x44')]);return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})[_0x3860('0x28')](function(_0x46661f){if(_0x46661f){_0xcd4bd3=_0x46661f[_0x3860('0x4b')];if(!_0x897ea0['query'][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1108d2[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x897ea0[_0x3860('0x35')][_0x3860('0x20')]);_0x1108d2[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x897ea0[_0x3860('0x35')][_0x3860('0x22')]);}return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})['then'](function(_0x252c19){if(_0x252c19){return _0x252c19?{'count':_0xcd4bd3,'rows':_0x252c19}:null;}})[_0x3860('0x28')](respondWithResult(_0x221229,null))[_0x3860('0x47')](handleError(_0x221229,null));};exports[_0x3860('0x7d')]=function(_0x4a929e,_0x1a1994,_0x2ece36){var _0x2fcf2c=_0x4a929e[_0x3860('0x52')]['ids'];var _0x280747;return db['Team']['findAll']({'where':{'id':_0x2fcf2c},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id',_0x3860('0x2e'),_0x3860('0x7f'),_0x3860('0x80'),_0x3860('0x81')],'raw':!![]}]})[_0x3860('0x28')](function(_0x273fed){if(_0x273fed){_0x280747=_0x273fed;var _0x3e4a88=_[_0x3860('0x82')](_0x273fed,function(_0x4677b0){var _0x559c=_0x4677b0[_0x3860('0x29')]({'plain':!![]});return _0x559c['Agents'];});return db[_0x3860('0x31')]['find']({'where':{'id':_0x4a929e[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x5891d8){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x1a9158){return _0x5891d8[_0x3860('0x7d')](_0x2fcf2c,{'transaction':_0x1a9158})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x280747,function(_0x12296a){return db['TeamVoicePrefix'][_0x3860('0x84')]({'TeamId':_0x12296a['id'],'VoicePrefixId':_0x4a929e[_0x3860('0x49')]['id']},{'transaction':_0x1a9158});});})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x3e4a88,function(_0x469ae6){return db['UserVoicePrefix'][_0x3860('0x85')]({'where':{'UserId':_0x469ae6['id'],'VoicePrefixId':_0x4a929e['params']['id']},'transaction':_0x1a9158});});})['then'](function(){_0x3e4a88['forEach'](function(_0x1059a4){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':_0x1059a4['id'],'VoicePrefixId':_0x5891d8['id']});});});});});}})[_0x3860('0x28')](respondWithStatusCode(_0x1a1994,null))[_0x3860('0x47')](handleError(_0x1a1994,null));};exports[_0x3860('0x86')]=function(_0x270ca1,_0xe24a1d,_0x59c203){return db[_0x3860('0x7c')][_0x3860('0x45')]({'where':{'id':_0x270ca1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x28')](handleEntityNotFound(_0xe24a1d,null))['then'](function(_0x1fe2d8){var _0x4f07f3=_[_0x3860('0x30')](_0x1fe2d8,'id');var _0x5c196e=[];var _0x41fd53=[];var _0xf91fc2=squel['select']();_0xf91fc2[_0x3860('0x87')](_0x3860('0x88'))['from'](_0x3860('0x89'),'tq')[_0x3860('0x8a')](_0x3860('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3860('0x3f')]('VoicePrefixId\x20=\x20?',_0x270ca1[_0x3860('0x49')]['id']);for(var _0x18b845=0x0;_0x18b845<_0x1fe2d8['length'];_0x18b845+=0x1){let _0x20edc7=_0x1fe2d8[_0x18b845];for(var _0x2d8581=0x0;_0x2d8581<_0x20edc7[_0x3860('0x7e')][_0x3860('0x4b')];_0x2d8581+=0x1){let _0x2d4744=_0x20edc7['Agents'][_0x2d8581];var _0x410bf4=_0xf91fc2[_0x3860('0x8c')]();_0x410bf4['where']('ut.UserId\x20=\x20?',_0x2d4744['id']);_0x41fd53[_0x3860('0x65')](db['sequelize'][_0x3860('0x35')](_0x410bf4[_0x3860('0x8d')](),{'type':db['sequelize'][_0x3860('0x8e')]['SELECT']})[_0x3860('0x28')](function(_0x4b8128){if(_0x4b8128[_0x3860('0x4b')]===0x1){return _0x2d4744['id'];}else{var _0x24788d=_[_0x3860('0x8f')](_[_0x3860('0x30')](_0x4b8128,'TeamId'),function(_0x25a8f7){return _[_0x3860('0x90')](_0x4f07f3,_0x25a8f7);});if(_0x24788d){return _0x2d4744['id'];}}}));}}return BPromise[_0x3860('0x91')](_0x41fd53)[_0x3860('0x28')](function(_0x4b7f2a){_0x5c196e=_(_0x5c196e)[_0x3860('0x92')](_0x4b7f2a)[_0x3860('0x93')]()['value']();return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x270ca1[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x514374){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0xd2167f){return _0x514374[_0x3860('0x86')](_0x270ca1['query'][_0x3860('0x72')],{'transaction':_0xd2167f})['then'](function(){if(!_['isEmpty'](_0x5c196e)){return _0x514374['removeAgents'](_0x5c196e,{'transaction':_0xd2167f});}})[_0x3860('0x28')](function(){_0x5c196e[_0x3860('0x94')](function(_0x1a6929){socket['emit'](_0x3860('0x77'),{'UserId':_0x1a6929,'VoicePrefixId':_0x514374['id']});});});});});});})['then'](respondWithStatusCode(_0xe24a1d,null))[_0x3860('0x47')](handleError(_0xe24a1d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b945dc0..dd61022 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 _0xd3de=['exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','emit','hook'];(function(_0x48a05d,_0x219867){var _0x4f365e=function(_0x8ac7bf){while(--_0x8ac7bf){_0x48a05d['push'](_0x48a05d['shift']());}};_0x4f365e(++_0x219867);}(_0xd3de,0x131));var _0xed3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd3de[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0xed3d('0x0'));var VoicePrefix=require(_0xed3d('0x1'))['db'][_0xed3d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xed3d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed3d('0x4'),'afterDestroy':'remove'};function emitEvent(_0xd9eb01){return function(_0x4fb756,_0x3aad07,_0x2e5201){VoicePrefixEvents[_0xed3d('0x5')](_0xd9eb01+':'+_0x4fb756['id'],_0x4fb756);VoicePrefixEvents['emit'](_0xd9eb01,_0x4fb756);_0x2e5201(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xed3d('0x6')](e,emitEvent(event));}}module[_0xed3d('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xc055=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x5b9964,_0xbcb1b1){var _0x50d64e=function(_0x52bda4){while(--_0x52bda4){_0x5b9964['push'](_0x5b9964['shift']());}};_0x50d64e(++_0xbcb1b1);}(_0xc055,0x155));var _0x5c05=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0xc055[_0x479509];return _0x382da8;};'use strict';var EventEmitter=require(_0x5c05('0x0'));var VoicePrefix=require(_0x5c05('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c05('0x2'),'afterUpdate':_0x5c05('0x3'),'afterDestroy':_0x5c05('0x4')};function emitEvent(_0x91d343){return function(_0x1f82e3,_0x5b36b6,_0x291e86){VoicePrefixEvents['emit'](_0x91d343+':'+_0x1f82e3['id'],_0x1f82e3);VoicePrefixEvents['emit'](_0x91d343,_0x1f82e3);_0x291e86(null);};}for(var e in events){if(events[_0x5c05('0x5')](e)){var event=events[e];VoicePrefix[_0x5c05('0x6')](e,emitEvent(event));}}module[_0x5c05('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 07a74ca..46bb693 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 _0x0adc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','lodash','../../config/logger','api'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x0adc,0xf9));var _0xc0ad=function(_0x12ccd7,_0x3d33fe){_0x12ccd7=_0x12ccd7-0x0;var _0x175aff=_0x0adc[_0x12ccd7];return _0x175aff;};'use strict';var _=require(_0xc0ad('0x0'));var util=require('util');var logger=require(_0xc0ad('0x1'))(_0xc0ad('0x2'));var moment=require(_0xc0ad('0x3'));var BPromise=require(_0xc0ad('0x4'));var rp=require(_0xc0ad('0x5'));var fs=require('fs');var path=require(_0xc0ad('0x6'));var rimraf=require(_0xc0ad('0x7'));var config=require(_0xc0ad('0x8'));var attributes=require(_0xc0ad('0x9'));module['exports']=function(_0x3b1011,_0x1573d2){return _0x3b1011[_0xc0ad('0xa')](_0xc0ad('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb952=['bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x19b351,_0x547358){var _0x104803=function(_0x412161){while(--_0x412161){_0x19b351['push'](_0x19b351['shift']());}};_0x104803(++_0x547358);}(_0xb952,0x18e));var _0x2b95=function(_0x1e6858,_0xa987a){_0x1e6858=_0x1e6858-0x0;var _0x53a22e=_0xb952[_0x1e6858];return _0x53a22e;};'use strict';var _=require(_0x2b95('0x0'));var util=require(_0x2b95('0x1'));var logger=require(_0x2b95('0x2'))(_0x2b95('0x3'));var moment=require(_0x2b95('0x4'));var BPromise=require(_0x2b95('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b95('0x6'));var config=require(_0x2b95('0x7'));var attributes=require(_0x2b95('0x8'));module[_0x2b95('0x9')]=function(_0x233fe2,_0x2be3fb){return _0x233fe2[_0x2b95('0xa')](_0x2b95('0xb'),attributes,{'tableName':_0x2b95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 755d046..09d49ef 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 _0x02ca=['then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x02ca,0x97));var _0xa02c=function(_0x14d1f2,_0x4e1ebb){_0x14d1f2=_0x14d1f2-0x0;var _0x32dc59=_0x02ca[_0x14d1f2];return _0x32dc59;};'use strict';var _=require(_0xa02c('0x0'));var util=require('util');var moment=require(_0xa02c('0x1'));var BPromise=require(_0xa02c('0x2'));var rs=require(_0xa02c('0x3'));var fs=require('fs');var Redis=require(_0xa02c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa02c('0x5'));var logger=require(_0xa02c('0x6'))(_0xa02c('0x7'));var config=require(_0xa02c('0x8'));var jayson=require(_0xa02c('0x9'));var client=jayson[_0xa02c('0xa')][_0xa02c('0xb')]({'port':0x232a});config[_0xa02c('0xc')]=_[_0xa02c('0xd')](config[_0xa02c('0xc')],{'host':_0xa02c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa02c('0xc')]));require(_0xa02c('0xf'))[_0xa02c('0x10')](socket);function respondWithRpcPromise(_0x30e1aa,_0x14ffc2,_0x565373){return new BPromise(function(_0x5c553f,_0x50df17){return client['request'](_0x30e1aa,_0x565373)[_0xa02c('0x11')](function(_0x14c96f){logger[_0xa02c('0x12')](_0xa02c('0x13'),_0x14ffc2,'request\x20sent');logger[_0xa02c('0x14')](_0xa02c('0x15'),_0x14ffc2,_0xa02c('0x16'),JSON[_0xa02c('0x17')](_0x14c96f));if(_0x14c96f['error']){if(_0x14c96f[_0xa02c('0x18')][_0xa02c('0x19')]===0x1f4){logger[_0xa02c('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x14ffc2,_0x14c96f[_0xa02c('0x18')][_0xa02c('0x1a')]);return _0x50df17(_0x14c96f['error'][_0xa02c('0x1a')]);}logger[_0xa02c('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x14ffc2,_0x14c96f[_0xa02c('0x18')][_0xa02c('0x1a')]);return _0x5c553f(_0x14c96f[_0xa02c('0x18')]['message']);}else{logger[_0xa02c('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x14ffc2,'request\x20sent');_0x5c553f(_0x14c96f['result'][_0xa02c('0x1a')]);}})[_0xa02c('0x1b')](function(_0x16ac46){logger['error'](_0xa02c('0x13'),_0x14ffc2,_0x16ac46);_0x50df17(_0x16ac46);});});} \ No newline at end of file +var _0x01a6=['http','redis','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x01a6,0x162));var _0x601a=function(_0x41ee9f,_0x3047f0){_0x41ee9f=_0x41ee9f-0x0;var _0x5c589d=_0x01a6[_0x41ee9f];return _0x5c589d;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var moment=require(_0x601a('0x1'));var BPromise=require(_0x601a('0x2'));var rs=require(_0x601a('0x3'));var fs=require('fs');var Redis=require(_0x601a('0x4'));var db=require(_0x601a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x601a('0x6'))('rpc');var config=require(_0x601a('0x7'));var jayson=require(_0x601a('0x8'));var client=jayson[_0x601a('0x9')][_0x601a('0xa')]({'port':0x232a});config[_0x601a('0xb')]=_['defaults'](config['redis'],{'host':_0x601a('0xc'),'port':0x18eb});var socket=require(_0x601a('0xd'))(new Redis(config[_0x601a('0xb')]));require('./voicePrefix.socket')[_0x601a('0xe')](socket);function respondWithRpcPromise(_0x2e9f4f,_0x5c9073,_0x44b2b6){return new BPromise(function(_0x2eb393,_0x51ed58){return client[_0x601a('0xf')](_0x2e9f4f,_0x44b2b6)[_0x601a('0x10')](function(_0x3fec87){logger[_0x601a('0x11')](_0x601a('0x12'),_0x5c9073,_0x601a('0x13'));logger[_0x601a('0x14')](_0x601a('0x15'),_0x5c9073,_0x601a('0x13'),JSON[_0x601a('0x16')](_0x3fec87));if(_0x3fec87[_0x601a('0x17')]){if(_0x3fec87['error'][_0x601a('0x18')]===0x1f4){logger[_0x601a('0x17')](_0x601a('0x12'),_0x5c9073,_0x3fec87[_0x601a('0x17')][_0x601a('0x19')]);return _0x51ed58(_0x3fec87[_0x601a('0x17')]['message']);}logger[_0x601a('0x17')](_0x601a('0x12'),_0x5c9073,_0x3fec87[_0x601a('0x17')][_0x601a('0x19')]);return _0x2eb393(_0x3fec87['error'][_0x601a('0x19')]);}else{logger['info'](_0x601a('0x12'),_0x5c9073,_0x601a('0x13'));_0x2eb393(_0x3fec87[_0x601a('0x1a')][_0x601a('0x19')]);}})[_0x601a('0x1b')](function(_0x47230b){logger[_0x601a('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x5c9073,_0x47230b);_0x51ed58(_0x47230b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b7da6ce..a2cc6e0 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 _0xc112=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x5db841,_0x4715de){var _0x4ae4b1=function(_0x222963){while(--_0x222963){_0x5db841['push'](_0x5db841['shift']());}};_0x4ae4b1(++_0x4715de);}(_0xc112,0xec));var _0x2c11=function(_0x1cbb16,_0x341dce){_0x1cbb16=_0x1cbb16-0x0;var _0x2899d8=_0xc112[_0x1cbb16];return _0x2899d8;};'use strict';var VoicePrefixEvents=require(_0x2c11('0x0'));var events=[_0x2c11('0x1'),_0x2c11('0x2'),'update'];function createListener(_0x8542d8,_0x40da2e){return function(_0x26e2a3){_0x40da2e[_0x2c11('0x3')](_0x8542d8,_0x26e2a3);};}function removeListener(_0xaa8492,_0x3a1cda){return function(){VoicePrefixEvents[_0x2c11('0x4')](_0xaa8492,_0x3a1cda);};}exports[_0x2c11('0x5')]=function(_0x2337d0){for(var _0x5c4748=0x0,_0x5c2399=events[_0x2c11('0x6')];_0x5c4748<_0x5c2399;_0x5c4748++){var _0x1fada4=events[_0x5c4748];var _0x29dfcf=createListener(_0x2c11('0x7')+_0x1fada4,_0x2337d0);VoicePrefixEvents['on'](_0x1fada4,_0x29dfcf);}}; \ No newline at end of file +var _0x915a=['update','removeListener','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x53e9c0,_0x2e9102){var _0x539b09=function(_0x27ec99){while(--_0x27ec99){_0x53e9c0['push'](_0x53e9c0['shift']());}};_0x539b09(++_0x2e9102);}(_0x915a,0x1d2));var _0xa915=function(_0x571dfc,_0x5e6532){_0x571dfc=_0x571dfc-0x0;var _0xc11974=_0x915a[_0x571dfc];return _0xc11974;};'use strict';var VoicePrefixEvents=require(_0xa915('0x0'));var events=[_0xa915('0x1'),_0xa915('0x2'),_0xa915('0x3')];function createListener(_0x3a5781,_0x5aa65b){return function(_0x1ca3fc){_0x5aa65b['emit'](_0x3a5781,_0x1ca3fc);};}function removeListener(_0x59bc2b,_0x1106ee){return function(){VoicePrefixEvents[_0xa915('0x4')](_0x59bc2b,_0x1106ee);};}exports[_0xa915('0x5')]=function(_0xb6900c){for(var _0x1ed01d=0x0,_0x3f5e00=events['length'];_0x1ed01d<_0x3f5e00;_0x1ed01d++){var _0x483a83=events[_0x1ed01d];var _0x3f5b1b=createListener(_0xa915('0x6')+_0x483a83,_0xb6900c);VoicePrefixEvents['on'](_0x483a83,_0x3f5b1b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3c1f6e7..64698f5 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1526a9,_0x48fb64){var _0x9f4049=function(_0x13271a){while(--_0x13271a){_0x1526a9['push'](_0x1526a9['shift']());}};_0x9f4049(++_0x48fb64);}(_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['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x22d1ef,_0x4a5152){var _0x47c5a3=function(_0x9a2c48){while(--_0x9a2c48){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x47c5a3(++_0x4a5152);}(_0xb10b,0x12a));var _0xbb10=function(_0x2adae0,_0x4fa150){_0x2adae0=_0x2adae0-0x0;var _0x4bbb68=_0xb10b[_0x2adae0];return _0x4bbb68;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index afa87b6..a04c2a7 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 _0x436d=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered','getDataValue','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','predictive','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x1e633e,_0x6f47e1){var _0x4c6d74=function(_0x3a6a2d){while(--_0x3a6a2d){_0x1e633e['push'](_0x1e633e['shift']());}};_0x4c6d74(++_0x6f47e1);}(_0x436d,0x1b9));var _0xd436=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x436d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xd436('0x0')]={'name':{'type':Sequelize[_0xd436('0x1')],'allowNull':![],'unique':_0xd436('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x4'),_0xd436('0x5')),'allowNull':![],'defaultValue':_0xd436('0x4')},'musiconhold':{'type':Sequelize[_0xd436('0x1')],'defaultValue':_0xd436('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xd436('0x3')]('rr',_0xd436('0x7'),'leastrecent',_0xd436('0x8'),_0xd436('0x9'),_0xd436('0xa'),_0xd436('0xb'),_0xd436('0xc'),_0xd436('0xd')),'allowNull':![],'defaultValue':_0xd436('0x7'),'set':function(_0x27c40e){this['setDataValue']('strategy',_0x27c40e?_0x27c40e:_0xd436('0xa'));},'get':function(){var _0xba074c=this['getDataValue']('type');var _0x25bf89=this[_0xd436('0xe')](_0xd436('0xf'));var _0x2e8bc8=this[_0xd436('0xe')]('strategy');if(_0xba074c===_0xd436('0x4')){return _0x2e8bc8;}if(_0x25bf89===_0xd436('0x10')&&_0x2e8bc8===_0xd436('0xa')||_0x25bf89===_0xd436('0x10')&&_0x2e8bc8===_0xd436('0x11')){return _0x2e8bc8;}if(_0x25bf89===_0xd436('0x12')||_0x25bf89==='predictive'||_0x25bf89===_0xd436('0x13')){return _0x2e8bc8;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xd436('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd436('0x14')](0xb)},'timeout':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd436('0x1')]},'weight':{'type':Sequelize[_0xd436('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xd436('0x15'),'no'),'defaultValue':_0xd436('0x15')},'autopause':{'type':Sequelize['ENUM'](_0xd436('0x15'),'no',_0xd436('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd436('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd436('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd436('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xd436('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xd436('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x15'),'no'),'defaultValue':_0xd436('0x15')},'announce_holdtime':{'type':Sequelize[_0xd436('0x3')]('yes','no',_0xd436('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xd436('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd436('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd436('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xd436('0x1')]},'queue_youarenext':{'type':Sequelize[_0xd436('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd436('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xd436('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd436('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd436('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xd436('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd436('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xd436('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xd436('0x1')]},'queue_less_than':{'type':Sequelize[_0xd436('0x1')]},'periodic_announce':{'type':Sequelize[_0xd436('0x18')],'set':function(_0x351ec2){this[_0xd436('0x19')](_0xd436('0x1a'),_0x351ec2?_0x351ec2[_0xd436('0x1b')](','):[]);},'get':function(){return this['getDataValue'](_0xd436('0x1a'))?this['getDataValue']('periodic_announce')[_0xd436('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xd436('0x1')],'defaultValue':_0xd436('0x15'),'set':function(_0x3c9030){this[_0xd436('0x19')](_0xd436('0x1d'),_0x3c9030?_0x3c9030[_0xd436('0x1b')](','):undefined);},'get':function(){return this[_0xd436('0xe')](_0xd436('0x1d'))?this['getDataValue'](_0xd436('0x1d'))[_0xd436('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd436('0x1')],'defaultValue':'no','set':function(_0x4f4fdf){this[_0xd436('0x19')](_0xd436('0x1e'),_0x4f4fdf?_0x4f4fdf['join'](','):undefined);},'get':function(){return this[_0xd436('0xe')]('leavewhenempty')?this[_0xd436('0xe')](_0xd436('0x1e'))[_0xd436('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xd436('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd436('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd436('0x1')]},'acw':{'type':Sequelize[_0xd436('0x1f')],'defaultValue':0x0,'set':function(_0x4d9ca5){this[_0xd436('0x19')](_0xd436('0x20'),_0x4d9ca5);if(_0x4d9ca5){if(this[_0xd436('0xe')](_0xd436('0x21'))<0x2){this['setDataValue'](_0xd436('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd436('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd436('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x22'),_0xd436('0x12'),'power',_0xd436('0x23'),_0xd436('0x10')),'defaultValue':_0xd436('0x12'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xd436('0x14')](0x4)[_0xd436('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xd436('0x14')](0x4)[_0xd436('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xd436('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd436('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x26'),_0xd436('0x27')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xd436('0x28')](0x2)[_0xd436('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd436('0x29')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xd436('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd436('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd436('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xd436('0x14')](0x3)[_0xd436('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xd436('0x1')],'defaultValue':_0xd436('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xd436('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd436('0x2c')},'dialQueueProject':{'type':Sequelize[_0xd436('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd436('0x14')](0x3)[_0xd436('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd436('0x14')](0x5)[_0xd436('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd436('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xd436('0x14')](0x3)[_0xd436('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd436('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd436('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd436('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd436('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd436('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd436('0x14')](0x5)[_0xd436('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd436('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd436('0x14')](0x3)[_0xd436('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd436('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd436('0x32')},'dialPrefix':{'type':Sequelize[_0xd436('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xd436('0x33'),_0xd436('0x34'),_0xd436('0x35')),'defaultValue':_0xd436('0x33')},'dialAMDActive':{'type':Sequelize[_0xd436('0x1f')],'defaultValue':0x0,'comment':_0xd436('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0xd436('0x14')](0x9)[_0xd436('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd436('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xd436('0x14')](0x9)[_0xd436('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd436('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd436('0x14')](0x9)[_0xd436('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd436('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0xd436('0x14')](0x9)[_0xd436('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd436('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd436('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd436('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xd436('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd436('0x14')](0x5)[_0xd436('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd436('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd436('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd436('0x3d')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xd436('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd436('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd436('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd436('0x3')](_0xd436('0x40'),'ASC'),'defaultValue':_0xd436('0x40')},'dialQueueProject2':{'type':Sequelize[_0xd436('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd436('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd436('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd436('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xd436('0x14')](0x3)[_0xd436('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd436('0x14')](0x3)[_0xd436('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd436('0x14')](0x5)[_0xd436('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd436('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd436('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xd436('0x14')](0x5)[_0xd436('0x24')],'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':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd436('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd436('0x42')},'dialMachineMaxRetry':{'type':Sequelize[_0xd436('0x14')](0x3)[_0xd436('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd436('0x43')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd436('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd436('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd436('0x14')](0x5)[_0xd436('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd436('0x14')],'allowNull':!![],'comment':_0xd436('0x44')},'mandatoryDisposition':{'type':Sequelize[_0xd436('0x1f')],'defaultValue':![],'comment':_0xd436('0x45'),'set':function(_0xdcaa9){if(!_0xdcaa9)this[_0xd436('0x19')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xd436('0x46'),_0xdcaa9);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd436('0x14')](0x3)[_0xd436('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd436('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd436('0x1f')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8c1c=['always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','name','ENUM','inbound','outbound','STRING','default','ringall','linear','wrandom','rrordered','setDataValue','rrmemory','type','getDataValue','dialMethod','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c1c,0x1e6));var _0xc8c1=function(_0x3e4dac,_0x168c36){_0x3e4dac=_0x3e4dac-0x0;var _0x592f8c=_0x8c1c[_0x3e4dac];return _0x592f8c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc8c1('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x2'),_0xc8c1('0x3')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':_0xc8c1('0x5')},'announce':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc8c1('0x1')]('rr',_0xc8c1('0x6'),'leastrecent','fewestcalls','random','rrmemory',_0xc8c1('0x7'),_0xc8c1('0x8'),_0xc8c1('0x9')),'allowNull':![],'defaultValue':_0xc8c1('0x6'),'set':function(_0x3c1001){this[_0xc8c1('0xa')]('strategy',_0x3c1001?_0x3c1001:_0xc8c1('0xb'));},'get':function(){var _0x10064f=this['getDataValue'](_0xc8c1('0xc'));var _0x21e34e=this[_0xc8c1('0xd')](_0xc8c1('0xe'));var _0x227b6f=this[_0xc8c1('0xd')](_0xc8c1('0xf'));if(_0x10064f===_0xc8c1('0x2')){return _0x227b6f;}if(_0x21e34e===_0xc8c1('0x10')&&_0x227b6f===_0xc8c1('0xb')||_0x21e34e===_0xc8c1('0x10')&&_0x227b6f===_0xc8c1('0x11')){return _0x227b6f;}if(_0x21e34e===_0xc8c1('0x12')||_0x21e34e===_0xc8c1('0x13')||_0x21e34e===_0xc8c1('0x14')){return _0x227b6f;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc8c1('0x15')](0xb)},'timeout':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc8c1('0x4')]},'weight':{'type':Sequelize[_0xc8c1('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xc8c1('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc8c1('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc8c1('0x1')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc8c1('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc8c1('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':_0xc8c1('0x16')},'announce_holdtime':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no',_0xc8c1('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xc8c1('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc8c1('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc8c1('0x4')]},'queue_youarenext':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc8c1('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xc8c1('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xc8c1('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xc8c1('0x18')],'set':function(_0x40d38f){this[_0xc8c1('0xa')](_0xc8c1('0x19'),_0x40d38f?_0x40d38f[_0xc8c1('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xc8c1('0x19'))?this[_0xc8c1('0xd')](_0xc8c1('0x19'))[_0xc8c1('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':_0xc8c1('0x16'),'set':function(_0xf3e41c){this[_0xc8c1('0xa')](_0xc8c1('0x1c'),_0xf3e41c?_0xf3e41c['join'](','):undefined);},'get':function(){return this[_0xc8c1('0xd')](_0xc8c1('0x1c'))?this[_0xc8c1('0xd')](_0xc8c1('0x1c'))[_0xc8c1('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':'no','set':function(_0x401568){this['setDataValue'](_0xc8c1('0x1d'),_0x401568?_0x401568[_0xc8c1('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xc8c1('0x1d'))?this[_0xc8c1('0xd')](_0xc8c1('0x1d'))[_0xc8c1('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc8c1('0x4')]},'description':{'type':Sequelize[_0xc8c1('0x4')]},'acw':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':0x0,'set':function(_0x229b23){this[_0xc8c1('0xa')](_0xc8c1('0x1f'),_0x229b23);if(_0x229b23){if(this[_0xc8c1('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0xc8c1('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':0x0,'comment':_0xc8c1('0x21')},'dialMethod':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x22'),_0xc8c1('0x12'),'power',_0xc8c1('0x13'),_0xc8c1('0x10')),'defaultValue':_0xc8c1('0x12'),'comment':_0xc8c1('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xc8c1('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc8c1('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc8c1('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xc8c1('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc8c1('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x28'),'dropRate'),'defaultValue':'dropRate','comment':_0xc8c1('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc8c1('0x2a')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc8c1('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc8c1('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc8c1('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xc8c1('0x2d'),'comment':_0xc8c1('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x2f')},'dialQueueProject':{'type':Sequelize[_0xc8c1('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'comment':_0xc8c1('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc8c1('0x34')},'dialTimezone':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc8c1('0x35'),_0xc8c1('0x36'),_0xc8c1('0x37')),'defaultValue':_0xc8c1('0x35')},'dialAMDActive':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc8c1('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc8c1('0x38')},'dialAMDGreeting':{'type':Sequelize[_0xc8c1('0x15')](0x9)[_0xc8c1('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc8c1('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc8c1('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc8c1('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc8c1('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc8c1('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc8c1('0x15')](0x9)[_0xc8c1('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc8c1('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc8c1('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc8c1('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc8c1('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc8c1('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc8c1('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x3f'),_0xc8c1('0x40')),'defaultValue':_0xc8c1('0x3f')},'dialQueueProject2':{'type':Sequelize[_0xc8c1('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc8c1('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc8c1('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc8c1('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc8c1('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':![],'comment':_0xc8c1('0x4a'),'set':function(_0x295184){if(!_0x295184)this['setDataValue'](_0xc8c1('0x4b'),null);this[_0xc8c1('0xa')](_0xc8c1('0x4c'),_0x295184);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc8c1('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 84e3fbd..820e7d3 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 _0x5b55=['util','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','UserProfileResource','stack','name','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','catch','show','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','omit','user','UserProfileSection','userProfileId','getHoppers','CmHopper','findAll','rows','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','format','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','phone','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','ContactId','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x5b55,0xb0));var _0x55b5=function(_0x4005fe,_0x1fc3c1){_0x4005fe=_0x4005fe-0x0;var _0x50022d=_0x5b55[_0x4005fe];return _0x50022d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55b5('0x0'));var zipdir=require(_0x55b5('0x1'));var jsonpatch=require(_0x55b5('0x2'));var rp=require(_0x55b5('0x3'));var moment=require('moment');var BPromise=require(_0x55b5('0x4'));var Mustache=require(_0x55b5('0x5'));var util=require(_0x55b5('0x6'));var path=require('path');var sox=require(_0x55b5('0x7'));var csv=require(_0x55b5('0x8'));var ejs=require(_0x55b5('0x9'));var fs=require('fs');var fs_extra=require(_0x55b5('0xa'));var _=require(_0x55b5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x55b5('0x8'));var querystring=require(_0x55b5('0xc'));var Papa=require(_0x55b5('0xd'));var Redis=require('ioredis');var authService=require(_0x55b5('0xe'));var qs=require(_0x55b5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55b5('0x10'));var logger=require(_0x55b5('0x11'))(_0x55b5('0x12'));var utils=require(_0x55b5('0x13'));var config=require(_0x55b5('0x14'));var licenseUtil=require(_0x55b5('0x15'));var db=require(_0x55b5('0x16'))['db'];config[_0x55b5('0x17')]=_[_0x55b5('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55b5('0x17')]));require(_0x55b5('0x19'))[_0x55b5('0x1a')](socket);function respondWithStatusCode(_0x24985b,_0x10a2b3){_0x10a2b3=_0x10a2b3||0xcc;return function(_0x1e7c51){if(_0x1e7c51){return _0x24985b[_0x55b5('0x1b')](_0x10a2b3);}return _0x24985b[_0x55b5('0x1c')](_0x10a2b3)[_0x55b5('0x1d')]();};}function respondWithResult(_0x216e23,_0x11ab95){_0x11ab95=_0x11ab95||0xc8;return function(_0x400300){if(_0x400300){return _0x216e23[_0x55b5('0x1c')](_0x11ab95)[_0x55b5('0x1e')](_0x400300);}};}function respondWithFilteredResult(_0x588784,_0xe1a176){return function(_0x3d66b6){if(_0x3d66b6){var _0x2c323f=typeof _0xe1a176[_0x55b5('0x1f')]==='undefined'&&typeof _0xe1a176[_0x55b5('0x20')]===_0x55b5('0x21');var _0x45ec8c=_0x3d66b6[_0x55b5('0x22')];var _0x3bf8c6=_0x2c323f?0x0:_0xe1a176[_0x55b5('0x1f')];var _0xc0dc48=_0x2c323f?_0x3d66b6['count']:_0xe1a176[_0x55b5('0x1f')]+_0xe1a176[_0x55b5('0x20')];var _0x148a96;if(_0xc0dc48>=_0x45ec8c){_0xc0dc48=_0x45ec8c;_0x148a96=0xc8;}else{_0x148a96=0xce;}_0x588784[_0x55b5('0x1c')](_0x148a96);return _0x588784[_0x55b5('0x23')](_0x55b5('0x24'),_0x3bf8c6+'-'+_0xc0dc48+'/'+_0x45ec8c)[_0x55b5('0x1e')](_0x3d66b6);}return null;};}function patchUpdates(_0x5237ba){return function(_0xd2e2b7){try{jsonpatch[_0x55b5('0x25')](_0xd2e2b7,_0x5237ba,!![]);}catch(_0xf77938){return BPromise[_0x55b5('0x26')](_0xf77938);}return _0xd2e2b7[_0x55b5('0x27')]();};}function saveUpdates(_0x3ab2ec,_0x1e18eb){return function(_0x5d09e4){if(_0x5d09e4){return _0x5d09e4[_0x55b5('0x28')](_0x3ab2ec)['then'](function(_0x1dcb67){return _0x1dcb67;});}return null;};}function removeEntity(_0x560782,_0x4a7099){return function(_0x4686b5){if(_0x4686b5){return _0x4686b5[_0x55b5('0x29')]()[_0x55b5('0x2a')](function(){var _0x5d92c3=_0x4686b5[_0x55b5('0x2b')]({'plain':!![]});var _0x34938f=[{'name':'VoiceQueues','value':_0x55b5('0x2c'),'ignore':![]},{'name':_0x55b5('0x2d'),'value':_0x55b5('0x2e'),'ignore':![]}];var _0x2cab37=_(_0x34938f)[_0x55b5('0x2f')](_0x55b5('0x30'))[_0x55b5('0x31')](_0x55b5('0x32'))[_0x55b5('0x32')]();if(_[_0x55b5('0x33')](_0x2cab37,_0x5d92c3['type'])){return;}var _0x3efc8b=_[_0x55b5('0x34')](_0x34938f,[_0x55b5('0x32'),_0x5d92c3[_0x55b5('0x35')]])['name'];return db[_0x55b5('0x36')][_0x55b5('0x29')]({'where':{'type':_0x3efc8b,'resourceId':_0x5d92c3['id']}})[_0x55b5('0x2a')](function(){return _0x4686b5;});})[_0x55b5('0x2a')](function(){_0x560782[_0x55b5('0x1c')](0xcc)[_0x55b5('0x1d')]();});}};}function handleEntityNotFound(_0x17aeb8,_0x41780e){return function(_0x528689){if(!_0x528689){_0x17aeb8[_0x55b5('0x1b')](0x194);}return _0x528689;};}function handleError(_0x531a13,_0x2c9289){_0x2c9289=_0x2c9289||0x1f4;return function(_0x1c2514){logger['error'](_0x1c2514[_0x55b5('0x37')]);if(_0x1c2514[_0x55b5('0x38')]){delete _0x1c2514['name'];}_0x531a13[_0x55b5('0x1c')](_0x2c9289)['send'](_0x1c2514);};}exports['index']=function(_0x4b6341,_0x3e0c4c){var _0x20b738={},_0x2e4796={},_0x2c14d2={'count':0x0,'rows':[]};var _0x23de79=_['map'](db[_0x55b5('0x39')][_0x55b5('0x3a')],function(_0x18a36c){return{'name':_0x18a36c[_0x55b5('0x3b')],'type':_0x18a36c[_0x55b5('0x35')][_0x55b5('0x3c')]};});_0x2e4796['model']=_[_0x55b5('0x31')](_0x23de79,_0x55b5('0x38'));_0x2e4796[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x4b6341['query']);_0x2e4796[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x2e4796[_0x55b5('0x41')],_0x2e4796['query']);_0x20b738['attributes']=_[_0x55b5('0x40')](_0x2e4796['model'],qs[_0x55b5('0x42')](_0x4b6341[_0x55b5('0x3d')][_0x55b5('0x42')]));_0x20b738[_0x55b5('0x43')]=_0x20b738['attributes'][_0x55b5('0x44')]?_0x20b738[_0x55b5('0x43')]:_0x2e4796[_0x55b5('0x41')];if(!_0x4b6341[_0x55b5('0x3d')][_0x55b5('0x45')](_0x55b5('0x46'))){_0x20b738[_0x55b5('0x20')]=qs['limit'](_0x4b6341['query'][_0x55b5('0x20')]);_0x20b738[_0x55b5('0x1f')]=qs[_0x55b5('0x1f')](_0x4b6341[_0x55b5('0x3d')][_0x55b5('0x1f')]);}_0x20b738[_0x55b5('0x47')]=qs[_0x55b5('0x48')](_0x4b6341[_0x55b5('0x3d')]['sort']);_0x20b738[_0x55b5('0x49')]=qs[_0x55b5('0x3f')](_[_0x55b5('0x4a')](_0x4b6341[_0x55b5('0x3d')],_0x2e4796[_0x55b5('0x3f')]),_0x23de79);if(_0x4b6341[_0x55b5('0x3d')][_0x55b5('0x2f')]){_0x20b738[_0x55b5('0x49')]=_[_0x55b5('0x4b')](_0x20b738[_0x55b5('0x49')],{'$or':_[_0x55b5('0x31')](_0x23de79,function(_0x2ddff9){if(_0x2ddff9[_0x55b5('0x35')]!=='VIRTUAL'){var _0x1e77c4={};_0x1e77c4[_0x2ddff9['name']]={'$like':'%'+_0x4b6341[_0x55b5('0x3d')][_0x55b5('0x2f')]+'%'};return _0x1e77c4;}})});}_0x20b738=_['merge']({},_0x20b738,_0x4b6341['options']);var _0x2ccd84={'where':_0x20b738[_0x55b5('0x49')]};return db[_0x55b5('0x39')]['count'](_0x2ccd84)[_0x55b5('0x2a')](function(_0x3b7b19){_0x2c14d2[_0x55b5('0x22')]=_0x3b7b19;if(_0x4b6341['query'][_0x55b5('0x4c')]){_0x20b738[_0x55b5('0x4d')]=[{'all':!![]}];}return db[_0x55b5('0x39')]['findAll'](_0x20b738);})[_0x55b5('0x2a')](function(_0x377cac){_0x2c14d2['rows']=_0x377cac;return _0x2c14d2;})[_0x55b5('0x2a')](respondWithFilteredResult(_0x3e0c4c,_0x20b738))[_0x55b5('0x4e')](handleError(_0x3e0c4c,null));};exports[_0x55b5('0x4f')]=function(_0x17376e,_0x3b5d53){var _0x167064={'raw':![],'where':{'id':_0x17376e['params']['id']}},_0x186698={};_0x186698[_0x55b5('0x41')]=_[_0x55b5('0x3e')](db['VoiceQueue'][_0x55b5('0x3a')]);_0x186698[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x17376e[_0x55b5('0x3d')]);_0x186698[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x186698[_0x55b5('0x41')],_0x186698['query']);_0x167064[_0x55b5('0x43')]=_[_0x55b5('0x40')](_0x186698[_0x55b5('0x41')],qs[_0x55b5('0x42')](_0x17376e['query'][_0x55b5('0x42')]));_0x167064[_0x55b5('0x43')]=_0x167064[_0x55b5('0x43')][_0x55b5('0x44')]?_0x167064[_0x55b5('0x43')]:_0x186698[_0x55b5('0x41')];if(_0x17376e['query']['includeAll']){_0x167064[_0x55b5('0x4d')]=[{'all':!![]}];}_0x167064=_[_0x55b5('0x4b')]({},_0x167064,_0x17376e[_0x55b5('0x50')]);return db[_0x55b5('0x39')][_0x55b5('0x34')](_0x167064)[_0x55b5('0x2a')](handleEntityNotFound(_0x3b5d53,null))[_0x55b5('0x2a')](respondWithResult(_0x3b5d53,null))[_0x55b5('0x4e')](handleError(_0x3b5d53,null));};exports[_0x55b5('0x51')]=function(_0x5bdafa,_0x104421){return db[_0x55b5('0x39')][_0x55b5('0x51')](_0x5bdafa[_0x55b5('0x52')],{})[_0x55b5('0x2a')](function(_0xf95079){var _0x1b70ad=_0x5bdafa['user'][_0x55b5('0x2b')]({'plain':!![]});if(!_0x1b70ad)throw new Error(_0x55b5('0x53'));if(_0x1b70ad[_0x55b5('0x54')]==='user'){var _0x117eb7=_0xf95079[_0x55b5('0x2b')]({'plain':!![]});var _0x15f89e=[{'name':_0x55b5('0x55'),'value':_0x55b5('0x2c')},{'name':_0x55b5('0x2d'),'value':_0x55b5('0x2e')}];var _0x2f2210=_[_0x55b5('0x34')](_0x15f89e,[_0x55b5('0x32'),_0x117eb7[_0x55b5('0x35')]])[_0x55b5('0x38')];return db['UserProfileSection'][_0x55b5('0x34')]({'where':{'name':_0x2f2210,'userProfileId':_0x1b70ad['userProfileId']},'raw':!![]})[_0x55b5('0x2a')](function(_0x37ad4d){if(_0x37ad4d&&_0x37ad4d[_0x55b5('0x56')]===0x0){return db[_0x55b5('0x36')][_0x55b5('0x51')]({'name':_0x117eb7['name'],'resourceId':_0x117eb7['id'],'type':_0x37ad4d[_0x55b5('0x38')],'sectionId':_0x37ad4d['id']},{})['then'](function(){return _0xf95079;});}else{return _0xf95079;}})['catch'](function(_0x28aea5){logger[_0x55b5('0x57')](_0x55b5('0x58'),_0x28aea5);throw _0x28aea5;});}return _0xf95079;})['then'](respondWithResult(_0x104421,0xc9))['catch'](handleError(_0x104421,null));};exports['clone']=function(_0x15323b,_0x14ec7c){var _0x55eda9={'where':{'id':_0x15323b[_0x55b5('0x59')]['id']}},_0x841ead={};_0x841ead[_0x55b5('0x41')]=_[_0x55b5('0x3e')](db['VoiceQueue']['rawAttributes']);_0x55eda9['attributes']=_['intersection'](_0x841ead[_0x55b5('0x41')],qs[_0x55b5('0x42')](_0x15323b[_0x55b5('0x3d')][_0x55b5('0x42')]));_0x55eda9[_0x55b5('0x43')]=_0x55eda9[_0x55b5('0x43')]['length']?_0x55eda9[_0x55b5('0x43')]:_0x841ead[_0x55b5('0x41')];if(_0x15323b[_0x55b5('0x3d')][_0x55b5('0x4c')]){_0x55eda9[_0x55b5('0x4d')]=[{'all':!![]}];}_0x55eda9=_[_0x55b5('0x4b')]({},_0x55eda9,_0x15323b[_0x55b5('0x50')]);return db[_0x55b5('0x39')][_0x55b5('0x34')](_0x55eda9)[_0x55b5('0x2a')](handleEntityNotFound(_0x14ec7c,null))['then'](function(_0x23f76d){if(_0x23f76d){var _0x59da2d=_0x23f76d[_0x55b5('0x2b')]({'plain':!![]});_0x59da2d=qs['omit'](_0x59da2d,['id',_0x55b5('0x5a'),_0x55b5('0x5b')]);_0x15323b[_0x55b5('0x52')]=_[_0x55b5('0x5c')](_0x15323b['body'],['id',_0x55b5('0x5a'),_0x55b5('0x5b')]);return db[_0x55b5('0x39')][_0x55b5('0x51')](_[_0x55b5('0x4b')](_0x59da2d,_0x15323b[_0x55b5('0x52')]),{'include':_0x15323b[_0x55b5('0x3d')][_0x55b5('0x4c')]?[{'all':!![]}]:undefined})[_0x55b5('0x2a')](function(_0x374c57){var _0x578514=_0x15323b[_0x55b5('0x5d')][_0x55b5('0x2b')]({'plain':!![]});if(!_0x578514)throw new Error(_0x55b5('0x53'));if(_0x578514[_0x55b5('0x54')]===_0x55b5('0x5d')){var _0x529e09=_0x374c57[_0x55b5('0x2b')]({'plain':!![]});var _0x1b602f=[{'name':_0x55b5('0x55'),'value':_0x55b5('0x2c')},{'name':_0x55b5('0x2d'),'value':_0x55b5('0x2e')}];var _0x5eca85=_[_0x55b5('0x34')](_0x1b602f,['value',_0x529e09[_0x55b5('0x35')]])['name'];return db[_0x55b5('0x5e')][_0x55b5('0x34')]({'where':{'name':_0x5eca85,'userProfileId':_0x578514[_0x55b5('0x5f')]},'raw':!![]})[_0x55b5('0x2a')](function(_0x343344){if(_0x343344&&_0x343344[_0x55b5('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x529e09[_0x55b5('0x38')],'resourceId':_0x529e09['id'],'type':_0x343344[_0x55b5('0x38')],'sectionId':_0x343344['id']},{})['then'](function(){return _0x374c57;});}else{return _0x374c57;}})['catch'](function(_0x202387){logger['error'](_0x55b5('0x58'),_0x202387);throw _0x202387;});}return _0x374c57;});}})['then'](respondWithResult(_0x14ec7c,0xc9))['catch'](handleError(_0x14ec7c,null));};exports[_0x55b5('0x28')]=function(_0x3a5e83,_0x425e05){if(_0x3a5e83[_0x55b5('0x52')]['id']){delete _0x3a5e83['body']['id'];}return db[_0x55b5('0x39')]['find']({'where':{'id':_0x3a5e83[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x425e05,null))[_0x55b5('0x2a')](saveUpdates(_0x3a5e83['body'],null))[_0x55b5('0x2a')](respondWithResult(_0x425e05,null))[_0x55b5('0x4e')](handleError(_0x425e05,null));};exports[_0x55b5('0x29')]=function(_0x4a63bc,_0x4a4ad6){return db['VoiceQueue']['find']({'where':{'id':_0x4a63bc[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x4a4ad6,null))[_0x55b5('0x2a')](removeEntity(_0x4a4ad6,null))[_0x55b5('0x4e')](handleError(_0x4a4ad6,null));};exports[_0x55b5('0x60')]=function(_0x1a66f3,_0x46a183,_0x155394){var _0x1bc482={'raw':![],'where':{}};var _0x425330={};var _0x1a3146={'count':0x0,'rows':[]};return db[_0x55b5('0x39')]['findOne']({'where':{'id':_0x1a66f3[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x46a183,null))['then'](function(_0x1a73c7){if(_0x1a73c7){_0x425330[_0x55b5('0x41')]=_['keys'](db['CmHopper'][_0x55b5('0x3a')]);_0x425330[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x1a66f3[_0x55b5('0x3d')]);_0x425330[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x425330[_0x55b5('0x41')],_0x425330[_0x55b5('0x3d')]);_0x1bc482[_0x55b5('0x43')]=_[_0x55b5('0x40')](_0x425330[_0x55b5('0x41')],qs[_0x55b5('0x42')](_0x1a66f3['query']['fields']));_0x1bc482[_0x55b5('0x43')]=_0x1bc482[_0x55b5('0x43')]['length']?_0x1bc482['attributes']:_0x425330['model'];if(!_0x1a66f3['query']['hasOwnProperty']('nolimit')){_0x1bc482[_0x55b5('0x20')]=qs[_0x55b5('0x20')](_0x1a66f3['query'][_0x55b5('0x20')]);_0x1bc482[_0x55b5('0x1f')]=qs[_0x55b5('0x1f')](_0x1a66f3[_0x55b5('0x3d')]['offset']);}_0x1bc482[_0x55b5('0x47')]=qs[_0x55b5('0x48')](_0x1a66f3[_0x55b5('0x3d')][_0x55b5('0x48')]);_0x1bc482['where']=qs[_0x55b5('0x3f')](_[_0x55b5('0x4a')](_0x1a66f3[_0x55b5('0x3d')],_0x425330[_0x55b5('0x3f')]));_0x1bc482['where']['VoiceQueueId']=_0x1a73c7['id'];if(_0x1a66f3['query']['filter']){_0x1bc482[_0x55b5('0x49')]=_[_0x55b5('0x4b')](_0x1bc482[_0x55b5('0x49')],{'$or':_['map'](_0x1bc482[_0x55b5('0x43')],function(_0x14cc29){var _0x2dda67={};_0x2dda67[_0x14cc29]={'$like':'%'+_0x1a66f3['query'][_0x55b5('0x2f')]+'%'};return _0x2dda67;})});}_0x1bc482=_['merge']({},_0x1bc482,_0x1a66f3[_0x55b5('0x50')]);return db[_0x55b5('0x61')][_0x55b5('0x22')]({'where':_0x1bc482[_0x55b5('0x49')]})[_0x55b5('0x2a')](function(_0x5b8576){_0x1a3146[_0x55b5('0x22')]=_0x5b8576;if(_0x1a66f3[_0x55b5('0x3d')][_0x55b5('0x4c')]){_0x1bc482[_0x55b5('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0x55b5('0x62')](_0x1bc482);})[_0x55b5('0x2a')](function(_0x285a63){_0x1a3146[_0x55b5('0x63')]=_0x285a63;return _0x1a3146;});}})[_0x55b5('0x2a')](respondWithFilteredResult(_0x46a183,_0x1bc482))['catch'](handleError(_0x46a183,null));};exports[_0x55b5('0x64')]=function(_0x384c6e,_0x5bffd5,_0xfc50ff){var _0x4e1559={'raw':!![],'where':{}};var _0x349e12={};var _0x374c2f={'count':0x0,'rows':[]};return db[_0x55b5('0x39')][_0x55b5('0x65')]({'where':{'id':_0x384c6e[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x5bffd5,null))['then'](function(_0x510441){if(_0x510441){_0x349e12[_0x55b5('0x41')]=_[_0x55b5('0x3e')](db['CmHopperHistory'][_0x55b5('0x3a')]);_0x349e12[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x384c6e[_0x55b5('0x3d')]);_0x349e12[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x349e12[_0x55b5('0x41')],_0x349e12[_0x55b5('0x3d')]);_0x4e1559[_0x55b5('0x43')]=_['intersection'](_0x349e12[_0x55b5('0x41')],qs['fields'](_0x384c6e['query'][_0x55b5('0x42')]));_0x4e1559[_0x55b5('0x43')]=_0x4e1559[_0x55b5('0x43')]['length']?_0x4e1559[_0x55b5('0x43')]:_0x349e12[_0x55b5('0x41')];if(!_0x384c6e[_0x55b5('0x3d')]['hasOwnProperty'](_0x55b5('0x46'))){_0x4e1559[_0x55b5('0x20')]=qs['limit'](_0x384c6e['query'][_0x55b5('0x20')]);_0x4e1559[_0x55b5('0x1f')]=qs[_0x55b5('0x1f')](_0x384c6e[_0x55b5('0x3d')][_0x55b5('0x1f')]);}_0x4e1559['order']=qs['sort'](_0x384c6e[_0x55b5('0x3d')]['sort']);_0x4e1559[_0x55b5('0x49')]=qs[_0x55b5('0x3f')](_[_0x55b5('0x4a')](_0x384c6e[_0x55b5('0x3d')],_0x349e12[_0x55b5('0x3f')]));_0x4e1559[_0x55b5('0x49')]['VoiceQueueId']=_0x510441['id'];if(_0x384c6e[_0x55b5('0x3d')][_0x55b5('0x2f')]){_0x4e1559[_0x55b5('0x49')]=_['merge'](_0x4e1559[_0x55b5('0x49')],{'$or':_['map'](_0x4e1559[_0x55b5('0x43')],function(_0x3b0f76){var _0x2b72fb={};_0x2b72fb[_0x3b0f76]={'$like':'%'+_0x384c6e['query'][_0x55b5('0x2f')]+'%'};return _0x2b72fb;})});}_0x4e1559=_[_0x55b5('0x4b')]({},_0x4e1559,_0x384c6e[_0x55b5('0x50')]);return db[_0x55b5('0x66')][_0x55b5('0x22')]({'where':_0x4e1559[_0x55b5('0x49')]})[_0x55b5('0x2a')](function(_0x5c2b43){_0x374c2f[_0x55b5('0x22')]=_0x5c2b43;if(_0x384c6e[_0x55b5('0x3d')][_0x55b5('0x4c')]){_0x4e1559[_0x55b5('0x4d')]=[{'all':!![]}];}return db[_0x55b5('0x66')][_0x55b5('0x62')](_0x4e1559);})[_0x55b5('0x2a')](function(_0x51cf53){_0x374c2f[_0x55b5('0x63')]=_0x51cf53;return _0x374c2f;});}})[_0x55b5('0x2a')](respondWithFilteredResult(_0x5bffd5,_0x4e1559))[_0x55b5('0x4e')](handleError(_0x5bffd5,null));};exports['getHopperFinals']=function(_0x5c5977,_0x245c42,_0x40769f){var _0x40028c={'raw':!![],'where':{}};var _0xe6c2e6={};var _0x4d07db={'count':0x0,'rows':[]};return db[_0x55b5('0x39')][_0x55b5('0x65')]({'where':{'id':_0x5c5977[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x245c42,null))[_0x55b5('0x2a')](function(_0xbc65b2){if(_0xbc65b2){_0xe6c2e6[_0x55b5('0x41')]=_['keys'](db[_0x55b5('0x67')]['rawAttributes']);_0xe6c2e6[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x5c5977[_0x55b5('0x3d')]);_0xe6c2e6[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0xe6c2e6['model'],_0xe6c2e6[_0x55b5('0x3d')]);_0x40028c[_0x55b5('0x43')]=_[_0x55b5('0x40')](_0xe6c2e6[_0x55b5('0x41')],qs['fields'](_0x5c5977[_0x55b5('0x3d')][_0x55b5('0x42')]));_0x40028c[_0x55b5('0x43')]=_0x40028c[_0x55b5('0x43')][_0x55b5('0x44')]?_0x40028c[_0x55b5('0x43')]:_0xe6c2e6['model'];if(!_0x5c5977[_0x55b5('0x3d')][_0x55b5('0x45')](_0x55b5('0x46'))){_0x40028c[_0x55b5('0x20')]=qs[_0x55b5('0x20')](_0x5c5977['query'][_0x55b5('0x20')]);_0x40028c[_0x55b5('0x1f')]=qs['offset'](_0x5c5977[_0x55b5('0x3d')][_0x55b5('0x1f')]);}_0x40028c[_0x55b5('0x47')]=qs[_0x55b5('0x48')](_0x5c5977['query'][_0x55b5('0x48')]);_0x40028c[_0x55b5('0x49')]=qs['filters'](_['pick'](_0x5c5977['query'],_0xe6c2e6[_0x55b5('0x3f')]));_0x40028c[_0x55b5('0x49')][_0x55b5('0x68')]=_0xbc65b2['id'];if(_0x5c5977[_0x55b5('0x3d')][_0x55b5('0x2f')]){_0x40028c[_0x55b5('0x49')]=_[_0x55b5('0x4b')](_0x40028c[_0x55b5('0x49')],{'$or':_[_0x55b5('0x31')](_0x40028c[_0x55b5('0x43')],function(_0xc7cc98){var _0x8255b1={};_0x8255b1[_0xc7cc98]={'$like':'%'+_0x5c5977['query'][_0x55b5('0x2f')]+'%'};return _0x8255b1;})});}_0x40028c=_[_0x55b5('0x4b')]({},_0x40028c,_0x5c5977['options']);return db[_0x55b5('0x67')][_0x55b5('0x22')]({'where':_0x40028c[_0x55b5('0x49')]})['then'](function(_0x306cf9){_0x4d07db[_0x55b5('0x22')]=_0x306cf9;if(_0x5c5977[_0x55b5('0x3d')][_0x55b5('0x4c')]){_0x40028c['include']=[{'all':!![]}];}return db[_0x55b5('0x67')][_0x55b5('0x62')](_0x40028c);})[_0x55b5('0x2a')](function(_0x29da56){_0x4d07db['rows']=_0x29da56;return _0x4d07db;});}})[_0x55b5('0x2a')](respondWithFilteredResult(_0x245c42,_0x40028c))[_0x55b5('0x4e')](handleError(_0x245c42,null));};exports[_0x55b5('0x69')]=function(_0x3ac6cc,_0x5f472f,_0x3815ab){var _0x18680f={'raw':!![],'where':{}};var _0x1f3609={};var _0x2a20e6={'count':0x0,'rows':[]};return db[_0x55b5('0x39')]['findOne']({'where':{'id':_0x3ac6cc[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x5f472f,null))['then'](function(_0x54ca47){if(_0x54ca47){_0x1f3609[_0x55b5('0x41')]=_[_0x55b5('0x3e')](db['CmHopperBlack']['rawAttributes']);_0x1f3609[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x3ac6cc['query']);_0x1f3609[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x1f3609[_0x55b5('0x41')],_0x1f3609['query']);_0x18680f[_0x55b5('0x43')]=_[_0x55b5('0x40')](_0x1f3609[_0x55b5('0x41')],qs['fields'](_0x3ac6cc[_0x55b5('0x3d')]['fields']));_0x18680f[_0x55b5('0x43')]=_0x18680f['attributes'][_0x55b5('0x44')]?_0x18680f[_0x55b5('0x43')]:_0x1f3609[_0x55b5('0x41')];if(!_0x3ac6cc[_0x55b5('0x3d')][_0x55b5('0x45')]('nolimit')){_0x18680f[_0x55b5('0x20')]=qs[_0x55b5('0x20')](_0x3ac6cc[_0x55b5('0x3d')][_0x55b5('0x20')]);_0x18680f[_0x55b5('0x1f')]=qs[_0x55b5('0x1f')](_0x3ac6cc[_0x55b5('0x3d')]['offset']);}_0x18680f['order']=qs[_0x55b5('0x48')](_0x3ac6cc[_0x55b5('0x3d')][_0x55b5('0x48')]);_0x18680f[_0x55b5('0x49')]=qs[_0x55b5('0x3f')](_['pick'](_0x3ac6cc[_0x55b5('0x3d')],_0x1f3609[_0x55b5('0x3f')]));_0x18680f[_0x55b5('0x49')][_0x55b5('0x68')]=_0x54ca47['id'];if(_0x3ac6cc[_0x55b5('0x3d')][_0x55b5('0x2f')]){_0x18680f[_0x55b5('0x49')]=_[_0x55b5('0x4b')](_0x18680f[_0x55b5('0x49')],{'$or':_[_0x55b5('0x31')](_0x18680f[_0x55b5('0x43')],function(_0x386164){var _0x38b2f4={};_0x38b2f4[_0x386164]={'$like':'%'+_0x3ac6cc[_0x55b5('0x3d')][_0x55b5('0x2f')]+'%'};return _0x38b2f4;})});}_0x18680f=_['merge']({},_0x18680f,_0x3ac6cc[_0x55b5('0x50')]);return db[_0x55b5('0x6a')][_0x55b5('0x22')]({'where':_0x18680f[_0x55b5('0x49')]})[_0x55b5('0x2a')](function(_0x55a015){_0x2a20e6[_0x55b5('0x22')]=_0x55a015;if(_0x3ac6cc[_0x55b5('0x3d')]['includeAll']){_0x18680f[_0x55b5('0x4d')]=[{'all':!![]}];}return db[_0x55b5('0x6a')]['findAll'](_0x18680f);})[_0x55b5('0x2a')](function(_0x2ca335){_0x2a20e6['rows']=_0x2ca335;return _0x2a20e6;});}})[_0x55b5('0x2a')](respondWithFilteredResult(_0x5f472f,_0x18680f))[_0x55b5('0x4e')](handleError(_0x5f472f,null));};exports[_0x55b5('0x6b')]=function(_0x3fcaca,_0x2134e2,_0xea2326){var _0x438b91={};var _0x5ce459={};var _0x6195f6;var _0xcc2f0b;return db[_0x55b5('0x39')]['findOne']({'where':{'id':_0x3fcaca[_0x55b5('0x59')]['id']}})['then'](handleEntityNotFound(_0x2134e2,null))['then'](function(_0x4d87cb){if(_0x4d87cb){_0x6195f6=_0x4d87cb;_0x5ce459[_0x55b5('0x41')]=_[_0x55b5('0x3e')](db[_0x55b5('0x6c')]['rawAttributes']);_0x5ce459[_0x55b5('0x3d')]=_['keys'](_0x3fcaca[_0x55b5('0x3d')]);_0x5ce459[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x5ce459['model'],_0x5ce459[_0x55b5('0x3d')]);_0x438b91[_0x55b5('0x43')]=_['intersection'](_0x5ce459[_0x55b5('0x41')],qs['fields'](_0x3fcaca[_0x55b5('0x3d')][_0x55b5('0x42')]));_0x438b91[_0x55b5('0x43')]=_0x438b91[_0x55b5('0x43')][_0x55b5('0x44')]?_0x438b91[_0x55b5('0x43')]:_0x5ce459[_0x55b5('0x41')];_0x438b91[_0x55b5('0x47')]=qs['sort'](_0x3fcaca['query'][_0x55b5('0x48')]);_0x438b91[_0x55b5('0x49')]=qs['filters'](_[_0x55b5('0x4a')](_0x3fcaca[_0x55b5('0x3d')],_0x5ce459[_0x55b5('0x3f')]));if(_0x3fcaca['query'][_0x55b5('0x2f')]){_0x438b91[_0x55b5('0x49')]=_[_0x55b5('0x4b')](_0x438b91['where'],{'$or':_[_0x55b5('0x31')](_0x438b91[_0x55b5('0x43')],function(_0x38477c){var _0x4ef365={};_0x4ef365[_0x38477c]={'$like':'%'+_0x3fcaca['query'][_0x55b5('0x2f')]+'%'};return _0x4ef365;})});}_0x438b91=_[_0x55b5('0x4b')]({},_0x438b91,_0x3fcaca[_0x55b5('0x50')]);return _0x6195f6[_0x55b5('0x6b')](_0x438b91);}})[_0x55b5('0x2a')](function(_0x2b9b08){if(_0x2b9b08){_0xcc2f0b=_0x2b9b08[_0x55b5('0x44')];if(!_0x3fcaca[_0x55b5('0x3d')][_0x55b5('0x45')](_0x55b5('0x46'))){_0x438b91['limit']=qs['limit'](_0x3fcaca[_0x55b5('0x3d')][_0x55b5('0x20')]);_0x438b91[_0x55b5('0x1f')]=qs['offset'](_0x3fcaca[_0x55b5('0x3d')][_0x55b5('0x1f')]);}return _0x6195f6[_0x55b5('0x6b')](_0x438b91);}})[_0x55b5('0x2a')](function(_0x596559){if(_0x596559){return _0x596559?{'count':_0xcc2f0b,'rows':_0x596559}:null;}})[_0x55b5('0x2a')](respondWithResult(_0x2134e2,null))['catch'](handleError(_0x2134e2,null));};exports[_0x55b5('0x6d')]=function(_0x3d38b8,_0x148c97,_0x9d18cc){var _0x57115a=_0x3d38b8[_0x55b5('0x52')]['teams'];var _0x536e95=_[_0x55b5('0x31')](_0x57115a,'id');return db['Team'][_0x55b5('0x62')]({'where':{'id':_0x536e95},'attributes':['id'],'include':[{'model':db[_0x55b5('0x6e')],'as':'Agents','attributes':['id',_0x55b5('0x38'),_0x55b5('0x6f'),'voicePause',_0x55b5('0x70')],'raw':!![]}]})[_0x55b5('0x2a')](function(_0x119210){if(_0x119210){var _0x36551f=_[_0x55b5('0x71')](_0x119210,function(_0x1ebe67){var _0x4b2393=_0x1ebe67[_0x55b5('0x2b')]({'plain':!![]});_0x4b2393[_0x55b5('0x72')][_0x55b5('0x73')](function(_0x2f616a){_0x2f616a['penalty']=_[_0x55b5('0x34')](_0x57115a,{'id':_0x4b2393['id']})[_0x55b5('0x74')];});return _0x4b2393[_0x55b5('0x72')];});return db['VoiceQueue'][_0x55b5('0x34')]({'where':{'id':_0x3d38b8[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](function(_0x67917b){return db[_0x55b5('0x75')][_0x55b5('0x76')](function(_0x4bd08a){return _0x67917b['addTeams'](_0x536e95,{'transaction':_0x4bd08a})[_0x55b5('0x2a')](function(){return BPromise[_0x55b5('0x77')](_0x57115a,function(_0x14ccc6){return db[_0x55b5('0x78')][_0x55b5('0x79')]({'TeamId':_0x14ccc6['id'],'VoiceQueueId':_0x3d38b8[_0x55b5('0x59')]['id'],'penalty':_0x14ccc6[_0x55b5('0x74')]},{'transaction':_0x4bd08a});});})[_0x55b5('0x2a')](function(){return BPromise[_0x55b5('0x77')](_0x36551f,function(_0x217f64){return db[_0x55b5('0x7a')][_0x55b5('0x7b')]({'where':{'UserId':_0x217f64['id'],'VoiceQueueId':_0x3d38b8[_0x55b5('0x59')]['id']},'defaults':{'penalty':_0x217f64['penalty']},'transaction':_0x4bd08a});});})['then'](function(){return BPromise[_0x55b5('0x77')](_[_0x55b5('0x2f')](_0x36551f,{'online':!![]}),function(_0x45f307){return db[_0x55b5('0x7c')][_0x55b5('0x79')]({'membername':_0x45f307[_0x55b5('0x38')],'UserId':_0x45f307['id'],'queue_name':_0x67917b[_0x55b5('0x38')],'VoiceQueueId':_0x67917b['id'],'interface':_[_0x55b5('0x7d')](_0x45f307[_0x55b5('0x70')])?util['format'](_0x55b5('0x7e'),_0x45f307['name']):_0x45f307[_0x55b5('0x70')],'paused':_0x45f307[_0x55b5('0x7f')]||![],'penalty':_0x45f307['penalty']},{'transaction':_0x4bd08a});});})[_0x55b5('0x2a')](function(){_0x36551f['forEach'](function(_0x324edd){socket[_0x55b5('0x80')](_0x55b5('0x81'),{'UserId':_0x324edd['id'],'VoiceQueueId':_0x67917b['id']});});});});});}})[_0x55b5('0x2a')](respondWithStatusCode(_0x148c97,null))[_0x55b5('0x4e')](handleError(_0x148c97,null));};exports[_0x55b5('0x82')]=function(_0x3f237c,_0x2d9a42,_0x1bee85){return db['Team'][_0x55b5('0x62')]({'where':{'id':_0x3f237c[_0x55b5('0x3d')][_0x55b5('0x83')]},'attributes':['id'],'include':[{'model':db[_0x55b5('0x6e')],'as':_0x55b5('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2d9a42,null))[_0x55b5('0x2a')](function(_0x4718d7){var _0x362748=_[_0x55b5('0x31')](_0x4718d7,'id');var _0xbbfa9e=[];var _0x2392b7=[];var _0x17103b=squel[_0x55b5('0x84')]();_0x17103b[_0x55b5('0x85')]('tq.TeamId')[_0x55b5('0x86')]('team_has_voice_queues','tq')[_0x55b5('0x87')](_0x55b5('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x55b5('0x49')](_0x55b5('0x89'),_0x3f237c['params']['id']);for(var _0x566bda=0x0;_0x566bda<_0x4718d7[_0x55b5('0x44')];_0x566bda+=0x1){let _0x25b8d2=_0x4718d7[_0x566bda];for(var _0x574538=0x0;_0x574538<_0x25b8d2[_0x55b5('0x72')]['length'];_0x574538+=0x1){let _0x3a1a35=_0x25b8d2[_0x55b5('0x72')][_0x574538];var _0x3dfeec=_0x17103b[_0x55b5('0x8a')]();_0x3dfeec['where'](_0x55b5('0x8b'),_0x3a1a35['id']);_0x2392b7[_0x55b5('0x8c')](db[_0x55b5('0x75')][_0x55b5('0x3d')](_0x3dfeec[_0x55b5('0x8d')](),{'type':db['sequelize'][_0x55b5('0x8e')][_0x55b5('0x8f')]})[_0x55b5('0x2a')](function(_0x219248){if(_0x219248[_0x55b5('0x44')]===0x1){return _0x3a1a35['id'];}else{var _0x2d72e9=_['every'](_['map'](_0x219248,_0x55b5('0x90')),function(_0x109a8b){return _[_0x55b5('0x33')](_0x362748,_0x109a8b);});if(_0x2d72e9){return _0x3a1a35['id'];}}}));}}return BPromise[_0x55b5('0x91')](_0x2392b7)[_0x55b5('0x2a')](function(_0x2fa6ff){_0xbbfa9e=_(_0xbbfa9e)['union'](_0x2fa6ff)[_0x55b5('0x92')]()[_0x55b5('0x32')]();return db[_0x55b5('0x39')][_0x55b5('0x34')]({'where':{'id':_0x3f237c[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](function(_0x43b292){return db[_0x55b5('0x75')][_0x55b5('0x76')](function(_0xffd4d){return _0x43b292['removeTeams'](_0x3f237c['query'][_0x55b5('0x83')],{'transaction':_0xffd4d})[_0x55b5('0x2a')](function(){if(!_[_0x55b5('0x93')](_0xbbfa9e)){return _0x43b292[_0x55b5('0x94')](_0xbbfa9e,{'transaction':_0xffd4d})[_0x55b5('0x2a')](function(){return db[_0x55b5('0x7c')][_0x55b5('0x29')]({'where':{'VoiceQueueId':_0x3f237c[_0x55b5('0x59')]['id'],'UserId':_0xbbfa9e},'transaction':_0xffd4d});});}})['then'](function(){_0xbbfa9e[_0x55b5('0x73')](function(_0x7619e1){socket[_0x55b5('0x80')](_0x55b5('0x95'),{'UserId':_0x7619e1,'VoiceQueueId':_0x43b292['id']});});});});});});})[_0x55b5('0x2a')](respondWithStatusCode(_0x2d9a42,null))[_0x55b5('0x4e')](handleError(_0x2d9a42,null));};exports[_0x55b5('0x96')]=function(_0x78534b,_0x3f36cf,_0x2134b8){var _0x491ead,_0x162765;return db[_0x55b5('0x39')][_0x55b5('0x34')]({'where':{'id':_0x78534b[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x3f36cf,null))[_0x55b5('0x2a')](function(_0x41e65e){if(_0x41e65e){_0x162765=_0x41e65e;return _0x41e65e[_0x55b5('0x96')](_0x78534b['body'][_0x55b5('0x83')],_[_0x55b5('0x5c')](_0x78534b[_0x55b5('0x52')],[_0x55b5('0x83'),'id'])||{})[_0x55b5('0x97')](function(_0x217de6){for(var _0x567983=0x0;_0x567983<_0x78534b[_0x55b5('0x52')][_0x55b5('0x83')][_0x55b5('0x44')];_0x567983+=0x1){socket[_0x55b5('0x80')](_0x55b5('0x81'),{'UserId':Number(_0x78534b['body'][_0x55b5('0x83')][_0x567983]),'VoiceQueueId':Number(_0x78534b[_0x55b5('0x59')]['id'])});}return _0x217de6;});}})[_0x55b5('0x2a')](function(_0xb91170){_0x491ead=_0xb91170||[];if(_0x162765){return db[_0x55b5('0x6e')][_0x55b5('0x62')]({'where':{'id':_0x78534b[_0x55b5('0x52')][_0x55b5('0x83')]},'attributes':['id',_0x55b5('0x38'),'online',_0x55b5('0x7f'),_0x55b5('0x70')],'raw':!![]});}})[_0x55b5('0x2a')](function(_0x175492){if(!_[_0x55b5('0x93')](_0x175492)){var _0x111d65=[];for(var _0x1f06f3=0x0;_0x1f06f3<_0x175492[_0x55b5('0x44')];_0x1f06f3++){if(_0x175492[_0x1f06f3]['online']){_0x111d65[_0x55b5('0x8c')](db[_0x55b5('0x7c')][_0x55b5('0x79')]({'membername':_0x175492[_0x1f06f3][_0x55b5('0x38')],'UserId':_0x175492[_0x1f06f3]['id'],'queue_name':_0x162765[_0x55b5('0x38')],'VoiceQueueId':_0x162765['id'],'interface':_[_0x55b5('0x7d')](_0x175492[_0x1f06f3][_0x55b5('0x70')])?util[_0x55b5('0x98')](_0x55b5('0x7e'),_0x175492[_0x1f06f3][_0x55b5('0x38')]):_0x175492[_0x1f06f3]['interface'],'paused':_0x175492[_0x1f06f3][_0x55b5('0x7f')]||![],'penalty':_0x78534b[_0x55b5('0x52')][_0x55b5('0x74')]||0x0}));}}return BPromise[_0x55b5('0x91')](_0x111d65);}})['then'](function(){return _0x491ead;})[_0x55b5('0x2a')](respondWithResult(_0x3f36cf,null))[_0x55b5('0x4e')](handleError(_0x3f36cf,null));};exports[_0x55b5('0x94')]=function(_0x500736,_0x24925b,_0x722b65){return db[_0x55b5('0x39')]['find']({'where':{'id':_0x500736[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x24925b,null))[_0x55b5('0x2a')](function(_0x39fd2f){if(_0x39fd2f){return _0x39fd2f[_0x55b5('0x94')](_0x500736['query']['ids'])['then'](function(){if(_[_0x55b5('0x99')](_0x500736[_0x55b5('0x3d')][_0x55b5('0x83')])){for(var _0x4b8cbc=0x0;_0x4b8cbc<_0x500736['query'][_0x55b5('0x83')][_0x55b5('0x44')];_0x4b8cbc+=0x1){socket['emit'](_0x55b5('0x95'),{'UserId':Number(_0x500736[_0x55b5('0x3d')]['ids'][_0x4b8cbc]),'VoiceQueueId':Number(_0x500736['params']['id'])});}}else{socket[_0x55b5('0x80')](_0x55b5('0x95'),{'UserId':Number(_0x500736[_0x55b5('0x3d')]['ids']),'VoiceQueueId':Number(_0x500736[_0x55b5('0x59')]['id'])});}});}})[_0x55b5('0x2a')](function(_0x46bf51){return db[_0x55b5('0x7c')][_0x55b5('0x29')]({'where':{'VoiceQueueId':_0x500736[_0x55b5('0x59')]['id'],'UserId':_0x500736[_0x55b5('0x3d')][_0x55b5('0x83')]}})[_0x55b5('0x2a')](function(){return _0x46bf51;});})[_0x55b5('0x2a')](respondWithStatusCode(_0x24925b,null))[_0x55b5('0x4e')](handleError(_0x24925b,null));};exports[_0x55b5('0x9a')]=function(_0x29103f,_0x252bd3,_0x1d62b2){var _0x35b621={};var _0x170fd6={};var _0xeb4dfc;var _0x245619;return db[_0x55b5('0x39')][_0x55b5('0x65')]({'where':{'id':_0x29103f[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x252bd3,null))[_0x55b5('0x2a')](function(_0x9174ee){if(_0x9174ee){_0xeb4dfc=_0x9174ee;_0x170fd6['model']=_['keys'](db[_0x55b5('0x6e')][_0x55b5('0x3a')]);_0x170fd6[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x29103f[_0x55b5('0x3d')]);_0x170fd6[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x170fd6[_0x55b5('0x41')],_0x170fd6['query']);_0x35b621[_0x55b5('0x43')]=_[_0x55b5('0x40')](_0x170fd6[_0x55b5('0x41')],qs[_0x55b5('0x42')](_0x29103f['query'][_0x55b5('0x42')]));_0x35b621[_0x55b5('0x43')]=_0x35b621['attributes'][_0x55b5('0x44')]?_0x35b621['attributes']:_0x170fd6[_0x55b5('0x41')];_0x35b621['order']=qs[_0x55b5('0x48')](_0x29103f[_0x55b5('0x3d')]['sort']);_0x35b621[_0x55b5('0x49')]=qs[_0x55b5('0x3f')](_[_0x55b5('0x4a')](_0x29103f['query'],_0x170fd6[_0x55b5('0x3f')]));if(_0x29103f[_0x55b5('0x3d')][_0x55b5('0x2f')]){_0x35b621[_0x55b5('0x49')]=_['merge'](_0x35b621[_0x55b5('0x49')],{'$or':_[_0x55b5('0x31')](_0x35b621[_0x55b5('0x43')],function(_0x3e49bc){var _0x42fc3f={};_0x42fc3f[_0x3e49bc]={'$like':'%'+_0x29103f[_0x55b5('0x3d')][_0x55b5('0x2f')]+'%'};return _0x42fc3f;})});}_0x35b621=_['merge']({},_0x35b621,_0x29103f['options']);return _0xeb4dfc['getAgents'](_0x35b621);}})[_0x55b5('0x2a')](function(_0x1910bd){if(_0x1910bd){_0x245619=_0x1910bd[_0x55b5('0x44')];if(!_0x29103f[_0x55b5('0x3d')][_0x55b5('0x45')](_0x55b5('0x46'))){_0x35b621[_0x55b5('0x20')]=qs['limit'](_0x29103f[_0x55b5('0x3d')][_0x55b5('0x20')]);_0x35b621['offset']=qs[_0x55b5('0x1f')](_0x29103f[_0x55b5('0x3d')]['offset']);}return _0xeb4dfc[_0x55b5('0x9a')](_0x35b621);}})['then'](function(_0x27e799){if(_0x27e799){return _0x27e799?{'count':_0x245619,'rows':_0x27e799}:null;}})[_0x55b5('0x2a')](respondWithResult(_0x252bd3,null))[_0x55b5('0x4e')](handleError(_0x252bd3,null));};exports[_0x55b5('0x9b')]=function(_0x4a959c,_0x23fa65,_0x184514){var _0x7c3108={};var _0x3cfdeb={};var _0x3a9163;var _0x54b942;return db[_0x55b5('0x39')]['findOne']({'where':{'id':_0x4a959c['params']['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x23fa65,null))[_0x55b5('0x2a')](function(_0x375989){if(_0x375989){_0x3a9163=_0x375989;_0x3cfdeb[_0x55b5('0x41')]=_['keys'](db['UserVoiceQueueRt'][_0x55b5('0x3a')]);_0x3cfdeb[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x4a959c[_0x55b5('0x3d')]);_0x3cfdeb[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x3cfdeb['model'],_0x3cfdeb['query']);_0x7c3108[_0x55b5('0x43')]=_['intersection'](_0x3cfdeb[_0x55b5('0x41')],qs['fields'](_0x4a959c[_0x55b5('0x3d')][_0x55b5('0x42')]));_0x7c3108[_0x55b5('0x43')]=_0x7c3108[_0x55b5('0x43')]['length']?_0x7c3108[_0x55b5('0x43')]:_0x3cfdeb[_0x55b5('0x41')];_0x7c3108[_0x55b5('0x47')]=qs[_0x55b5('0x48')](_0x4a959c[_0x55b5('0x3d')][_0x55b5('0x48')]);_0x7c3108[_0x55b5('0x49')]=qs['filters'](_[_0x55b5('0x4a')](_0x4a959c['query'],_0x3cfdeb[_0x55b5('0x3f')]));if(_0x4a959c[_0x55b5('0x3d')]['filter']){_0x7c3108[_0x55b5('0x49')]=_[_0x55b5('0x4b')](_0x7c3108['where'],{'$or':_[_0x55b5('0x31')](_0x7c3108[_0x55b5('0x43')],function(_0x245254){var _0x2cb78f={};_0x2cb78f[_0x245254]={'$like':'%'+_0x4a959c[_0x55b5('0x3d')][_0x55b5('0x2f')]+'%'};return _0x2cb78f;})});}_0x7c3108=_[_0x55b5('0x4b')]({},_0x7c3108,_0x4a959c[_0x55b5('0x50')]);return _0x3a9163[_0x55b5('0x9b')](_0x7c3108);}})[_0x55b5('0x2a')](function(_0x25fab5){if(_0x25fab5){_0x54b942=_0x25fab5['length'];if(!_0x4a959c[_0x55b5('0x3d')][_0x55b5('0x45')](_0x55b5('0x46'))){_0x7c3108[_0x55b5('0x20')]=qs['limit'](_0x4a959c[_0x55b5('0x3d')][_0x55b5('0x20')]);_0x7c3108[_0x55b5('0x1f')]=qs[_0x55b5('0x1f')](_0x4a959c[_0x55b5('0x3d')][_0x55b5('0x1f')]);}return _0x3a9163[_0x55b5('0x9b')](_0x7c3108);}})[_0x55b5('0x2a')](function(_0x263688){return _0x263688?{'count':_0x54b942,'rows':_0x263688}:null;})[_0x55b5('0x2a')](respondWithResult(_0x23fa65,null))['catch'](handleError(_0x23fa65,null));};exports[_0x55b5('0x9c')]=function(_0x2e6924,_0x481e21,_0x2193ad){var _0x166cf3={};var _0x4631e5={};var _0x2b9e66;var _0x297e15;return db['VoiceQueue'][_0x55b5('0x65')]({'where':{'id':_0x2e6924[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x481e21,null))[_0x55b5('0x2a')](function(_0x37ea57){if(_0x37ea57){_0x2b9e66=_0x37ea57;_0x4631e5[_0x55b5('0x41')]=_['keys'](db[_0x55b5('0x9d')][_0x55b5('0x3a')]);_0x4631e5[_0x55b5('0x3d')]=_[_0x55b5('0x3e')](_0x2e6924[_0x55b5('0x3d')]);_0x4631e5[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x4631e5[_0x55b5('0x41')],_0x4631e5[_0x55b5('0x3d')]);_0x166cf3[_0x55b5('0x43')]=_[_0x55b5('0x40')](_0x4631e5['model'],qs['fields'](_0x2e6924[_0x55b5('0x3d')][_0x55b5('0x42')]));_0x166cf3[_0x55b5('0x43')]=_0x166cf3[_0x55b5('0x43')][_0x55b5('0x44')]?_0x166cf3['attributes']:_0x4631e5['model'];_0x166cf3[_0x55b5('0x47')]=qs[_0x55b5('0x48')](_0x2e6924[_0x55b5('0x3d')][_0x55b5('0x48')]);_0x166cf3[_0x55b5('0x49')]=qs[_0x55b5('0x3f')](_[_0x55b5('0x4a')](_0x2e6924['query'],_0x4631e5[_0x55b5('0x3f')]));if(_0x2e6924[_0x55b5('0x3d')]['filter']){_0x166cf3[_0x55b5('0x49')]=_['merge'](_0x166cf3[_0x55b5('0x49')],{'$or':_[_0x55b5('0x31')](_0x166cf3[_0x55b5('0x43')],function(_0x19921b){var _0x31ff7e={};_0x31ff7e[_0x19921b]={'$like':'%'+_0x2e6924['query'][_0x55b5('0x2f')]+'%'};return _0x31ff7e;})});}_0x166cf3=_[_0x55b5('0x4b')]({},_0x166cf3,_0x2e6924[_0x55b5('0x50')]);return _0x2b9e66[_0x55b5('0x9c')](_0x166cf3);}})[_0x55b5('0x2a')](function(_0x2d6e5d){if(_0x2d6e5d){_0x297e15=_0x2d6e5d[_0x55b5('0x44')];if(!_0x2e6924[_0x55b5('0x3d')][_0x55b5('0x45')](_0x55b5('0x46'))){_0x166cf3[_0x55b5('0x20')]=qs[_0x55b5('0x20')](_0x2e6924[_0x55b5('0x3d')][_0x55b5('0x20')]);_0x166cf3['offset']=qs[_0x55b5('0x1f')](_0x2e6924[_0x55b5('0x3d')][_0x55b5('0x1f')]);}return _0x2b9e66['getLists'](_0x166cf3);}})['then'](function(_0x20b0b1){if(_0x20b0b1){return _0x20b0b1?{'count':_0x297e15,'rows':_0x20b0b1}:null;}})[_0x55b5('0x2a')](respondWithResult(_0x481e21,null))[_0x55b5('0x4e')](handleError(_0x481e21,null));};exports['addLists']=function(_0x499ed8,_0xf2d388,_0x50ed70){var _0xe80150,_0x47450d;return db['VoiceQueue'][_0x55b5('0x34')]({'where':{'id':_0x499ed8[_0x55b5('0x59')]['id']}})['then'](handleEntityNotFound(_0xf2d388,null))['then'](function(_0x976fdb){if(_0x976fdb){_0x47450d=_0x976fdb;return _0x976fdb['addLists'](_0x499ed8[_0x55b5('0x52')][_0x55b5('0x83')],_[_0x55b5('0x5c')](_0x499ed8[_0x55b5('0x52')],[_0x55b5('0x83'),'id'])||{});}return null;})[_0x55b5('0x97')](function(_0x431fcf){var _0xb79281;_0xe80150=_0x431fcf||[];var _0x3f7ae8=[];if(_0x431fcf){for(var _0x30ccea=0x0;_0x30ccea<_0x431fcf[_0x55b5('0x44')];_0x30ccea+=0x1){var _0x4ef487=_0x431fcf[_0x30ccea][_0x55b5('0x2b')]({'plain':!![]});_0x47450d[_0x55b5('0x9e')]=_0x499ed8[_0x55b5('0x52')][_0x55b5('0x9e')]?_0x499ed8['body'][_0x55b5('0x9e')]:_0x47450d['dialCheckDuplicateType'];switch(_0x47450d[_0x55b5('0x9e')]){case _0x55b5('0x9f'):_0xb79281=squel[_0x55b5('0xa0')]()[_0x55b5('0xa1')](_0x55b5('0xa2'))[_0x55b5('0xa3')](['phone',_0x55b5('0xa4'),'ContactId','ListId',_0x55b5('0x68'),_0x55b5('0x5a'),_0x55b5('0x5b')],squel[_0x55b5('0x84')]()['field']('phone',_0x55b5('0xa5'))['field'](_0x55b5('0xa6'),'scheduledAt')['field']('id','ContactId')[_0x55b5('0x85')](_0x4ef487[_0x55b5('0xa7')][_0x55b5('0x8d')](),_0x55b5('0xa8'))[_0x55b5('0x85')](_0x499ed8['params']['id'][_0x55b5('0x8d')](),'VoiceQueueId')[_0x55b5('0x85')](_0x55b5('0xa6'),_0x55b5('0x5a'))[_0x55b5('0x85')](_0x55b5('0xa6'),_0x55b5('0x5b'))[_0x55b5('0x86')](_0x55b5('0xa9'))[_0x55b5('0x49')](_0x55b5('0xaa'))[_0x55b5('0x49')]('ListId\x20=\x20?',_0x4ef487[_0x55b5('0xa7')][_0x55b5('0x8d')]())[_0x55b5('0x49')](_0x55b5('0xab'))[_0x55b5('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x55b5('0x84')]()[_0x55b5('0x85')]('COALESCE(calleridnum,\x27\x27)')[_0x55b5('0x86')](_0x55b5('0xac'))['where']('VoiceQueueId\x20=\x20?',_0x499ed8[_0x55b5('0x59')]['id'][_0x55b5('0x8d')]()))[_0x55b5('0x49')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x55b5('0x85')](_0x55b5('0xad'))[_0x55b5('0x86')](_0x55b5('0xa2'))[_0x55b5('0x49')]('VoiceQueueId\x20=\x20?',_0x499ed8[_0x55b5('0x59')]['id'][_0x55b5('0x8d')]())))[_0x55b5('0x8d')]();break;case _0x55b5('0xae'):_0xb79281=squel[_0x55b5('0xa0')]()[_0x55b5('0xa1')]('cm_hopper')[_0x55b5('0xa3')]([_0x55b5('0xa5'),_0x55b5('0xa4'),'ContactId','ListId',_0x55b5('0x68'),_0x55b5('0x5a'),'updatedAt'],squel[_0x55b5('0x84')]()[_0x55b5('0x85')](_0x55b5('0xa5'),_0x55b5('0xa5'))['field'](_0x55b5('0xa6'),_0x55b5('0xa4'))[_0x55b5('0x85')]('id',_0x55b5('0xaf'))[_0x55b5('0x85')](_0x4ef487[_0x55b5('0xa7')]['toString'](),'ListId')[_0x55b5('0x85')](_0x499ed8[_0x55b5('0x59')]['id'][_0x55b5('0x8d')](),'VoiceQueueId')[_0x55b5('0x85')](_0x55b5('0xa6'),'createdAt')['field'](_0x55b5('0xa6'),'updatedAt')[_0x55b5('0x86')]('cm_contacts')[_0x55b5('0x49')](_0x55b5('0xaa'))[_0x55b5('0x49')](_0x55b5('0xb0'),_0x4ef487[_0x55b5('0xa7')][_0x55b5('0x8d')]())[_0x55b5('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0x55b5('0x49')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x55b5('0x85')](_0x55b5('0xad'))[_0x55b5('0x86')](_0x55b5('0xa2'))['where'](_0x55b5('0x89'),_0x499ed8[_0x55b5('0x59')]['id'][_0x55b5('0x8d')]())))[_0x55b5('0x8d')]();break;default:_0xb79281=squel['insert']()['into'](_0x55b5('0xa2'))[_0x55b5('0xa3')]([_0x55b5('0xa5'),'scheduledAt','ContactId',_0x55b5('0xa8'),_0x55b5('0x68'),'createdAt',_0x55b5('0x5b')],squel[_0x55b5('0x84')]()['field'](_0x55b5('0xa5'),_0x55b5('0xa5'))[_0x55b5('0x85')]('NOW()',_0x55b5('0xa4'))[_0x55b5('0x85')]('id',_0x55b5('0xaf'))[_0x55b5('0x85')](_0x4ef487['CmListId'][_0x55b5('0x8d')](),_0x55b5('0xa8'))[_0x55b5('0x85')](_0x499ed8[_0x55b5('0x59')]['id'][_0x55b5('0x8d')](),_0x55b5('0x68'))[_0x55b5('0x85')](_0x55b5('0xa6'),_0x55b5('0x5a'))['field'](_0x55b5('0xa6'),'updatedAt')[_0x55b5('0x86')](_0x55b5('0xa9'))[_0x55b5('0x49')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x4ef487[_0x55b5('0xa7')]['toString']())[_0x55b5('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0x55b5('0x8d')]();}_0x3f7ae8[_0x55b5('0x8c')](db[_0x55b5('0x75')][_0x55b5('0x3d')](_0xb79281));}return BPromise[_0x55b5('0x91')](_0x3f7ae8);}})[_0x55b5('0x2a')](function(){return _0xe80150;})['then'](respondWithResult(_0xf2d388,null))[_0x55b5('0x4e')](handleError(_0xf2d388,null));};exports['removeLists']=function(_0x57ab32,_0x20589c,_0x116ab2){return db[_0x55b5('0x39')][_0x55b5('0x34')]({'where':{'id':_0x57ab32[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x20589c,null))[_0x55b5('0x2a')](function(_0x225ba5){if(_0x225ba5){return _0x225ba5[_0x55b5('0xb1')](_0x57ab32[_0x55b5('0x3d')][_0x55b5('0x83')]);}})[_0x55b5('0x2a')](function(_0x5d744b){if(_0x5d744b){return db['CmHopper'][_0x55b5('0x29')]({'where':{'ListId':_0x57ab32[_0x55b5('0x3d')]['ids'],'VoiceQueueId':_0x57ab32[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](function(){return _0x5d744b;});}})[_0x55b5('0x2a')](respondWithStatusCode(_0x20589c,null))[_0x55b5('0x4e')](handleError(_0x20589c,null));};exports['getBlackLists']=function(_0x315ae6,_0x50c197,_0x3e9852){var _0x36b97d={};var _0x1fb72a={};var _0x4fdd9e;var _0x91c7d3;return db[_0x55b5('0x39')][_0x55b5('0x65')]({'where':{'id':_0x315ae6['params']['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x50c197,null))[_0x55b5('0x2a')](function(_0x1c65d1){if(_0x1c65d1){_0x4fdd9e=_0x1c65d1;_0x1fb72a[_0x55b5('0x41')]=_[_0x55b5('0x3e')](db[_0x55b5('0x9d')]['rawAttributes']);_0x1fb72a['query']=_[_0x55b5('0x3e')](_0x315ae6[_0x55b5('0x3d')]);_0x1fb72a[_0x55b5('0x3f')]=_[_0x55b5('0x40')](_0x1fb72a[_0x55b5('0x41')],_0x1fb72a[_0x55b5('0x3d')]);_0x36b97d[_0x55b5('0x43')]=_[_0x55b5('0x40')](_0x1fb72a['model'],qs[_0x55b5('0x42')](_0x315ae6[_0x55b5('0x3d')][_0x55b5('0x42')]));_0x36b97d[_0x55b5('0x43')]=_0x36b97d[_0x55b5('0x43')]['length']?_0x36b97d['attributes']:_0x1fb72a['model'];_0x36b97d[_0x55b5('0x47')]=qs[_0x55b5('0x48')](_0x315ae6[_0x55b5('0x3d')]['sort']);_0x36b97d[_0x55b5('0x49')]=qs[_0x55b5('0x3f')](_[_0x55b5('0x4a')](_0x315ae6['query'],_0x1fb72a['filters']));if(_0x315ae6[_0x55b5('0x3d')][_0x55b5('0x2f')]){_0x36b97d[_0x55b5('0x49')]=_['merge'](_0x36b97d['where'],{'$or':_[_0x55b5('0x31')](_0x36b97d[_0x55b5('0x43')],function(_0x426510){var _0x52b278={};_0x52b278[_0x426510]={'$like':'%'+_0x315ae6[_0x55b5('0x3d')]['filter']+'%'};return _0x52b278;})});}_0x36b97d=_[_0x55b5('0x4b')]({},_0x36b97d,_0x315ae6[_0x55b5('0x50')]);return _0x4fdd9e[_0x55b5('0xb2')](_0x36b97d);}})[_0x55b5('0x2a')](function(_0x5921ee){if(_0x5921ee){_0x91c7d3=_0x5921ee['length'];if(!_0x315ae6[_0x55b5('0x3d')][_0x55b5('0x45')](_0x55b5('0x46'))){_0x36b97d[_0x55b5('0x20')]=qs[_0x55b5('0x20')](_0x315ae6['query'][_0x55b5('0x20')]);_0x36b97d[_0x55b5('0x1f')]=qs[_0x55b5('0x1f')](_0x315ae6['query'][_0x55b5('0x1f')]);}return _0x4fdd9e[_0x55b5('0xb2')](_0x36b97d);}})[_0x55b5('0x2a')](function(_0x361b50){if(_0x361b50){return _0x361b50?{'count':_0x91c7d3,'rows':_0x361b50}:null;}})[_0x55b5('0x2a')](respondWithResult(_0x50c197,null))[_0x55b5('0x4e')](handleError(_0x50c197,null));};exports[_0x55b5('0xb3')]=function(_0x38b56c,_0x4519eb,_0x52110c){var _0x28e8fb,_0x1de179;return db[_0x55b5('0x39')]['find']({'where':{'id':_0x38b56c[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0x4519eb,null))[_0x55b5('0x2a')](function(_0x5e1c85){if(_0x5e1c85){_0x1de179=_0x5e1c85;return _0x5e1c85[_0x55b5('0xb3')](_0x38b56c[_0x55b5('0x52')][_0x55b5('0x83')],_[_0x55b5('0x5c')](_0x38b56c['body'],[_0x55b5('0x83'),'id'])||{});}return null;})[_0x55b5('0x97')](function(_0x614022){var _0x50efc6;_0x28e8fb=_0x614022||[];var _0x3c3592=[];if(_0x614022){for(var _0x21c553=0x0;_0x21c553<_0x614022[_0x55b5('0x44')];_0x21c553+=0x1){var _0x2528b5=_0x614022[_0x21c553]['get']({'plain':!![]});_0x50efc6=squel[_0x55b5('0xa0')]()[_0x55b5('0xa1')](_0x55b5('0xb4'))[_0x55b5('0xa3')]([_0x55b5('0xa5'),_0x55b5('0xaf'),_0x55b5('0xa8'),_0x55b5('0x68'),_0x55b5('0x5a'),_0x55b5('0x5b')],squel[_0x55b5('0x84')]()[_0x55b5('0x85')](_0x55b5('0xa5'),'phone')['field']('id',_0x55b5('0xaf'))[_0x55b5('0x85')](_0x2528b5[_0x55b5('0xa7')]['toString'](),'ListId')[_0x55b5('0x85')](_0x38b56c[_0x55b5('0x59')]['id'][_0x55b5('0x8d')](),_0x55b5('0x68'))['field'](_0x55b5('0xa6'),'createdAt')[_0x55b5('0x85')]('NOW()',_0x55b5('0x5b'))[_0x55b5('0x86')](_0x55b5('0xa9'))[_0x55b5('0x49')](_0x55b5('0xaa'))[_0x55b5('0x49')](_0x55b5('0xb0'),_0x2528b5[_0x55b5('0xa7')][_0x55b5('0x8d')]())[_0x55b5('0x49')](_0x55b5('0xab')))[_0x55b5('0x8d')]();_0x3c3592[_0x55b5('0x8c')](db['sequelize'][_0x55b5('0x3d')](_0x50efc6));}return BPromise[_0x55b5('0x91')](_0x3c3592);}})[_0x55b5('0x2a')](function(){return _0x28e8fb;})[_0x55b5('0x2a')](respondWithResult(_0x4519eb,null))[_0x55b5('0x4e')](handleError(_0x4519eb,null));};exports[_0x55b5('0xb5')]=function(_0x32eaa5,_0xa65cf2,_0x2c9e9a){return db[_0x55b5('0x39')]['find']({'where':{'id':_0x32eaa5[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](handleEntityNotFound(_0xa65cf2,null))['then'](function(_0x11c621){if(_0x11c621){return _0x11c621[_0x55b5('0xb5')](_0x32eaa5[_0x55b5('0x3d')]['ids']);}})[_0x55b5('0x2a')](function(_0x3d28f5){if(_0x3d28f5){return db[_0x55b5('0x6a')][_0x55b5('0x29')]({'where':{'ListId':_0x32eaa5[_0x55b5('0x3d')]['ids'],'VoiceQueueId':_0x32eaa5[_0x55b5('0x59')]['id']}})[_0x55b5('0x2a')](function(){return _0x3d28f5;});}})[_0x55b5('0x2a')](respondWithStatusCode(_0xa65cf2,null))[_0x55b5('0x4e')](handleError(_0xa65cf2,null));}; \ No newline at end of file +var _0xb397=['UserVoiceQueueRt','upsert','isNil','format','SIP/%s','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_queues','VoiceQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','ids','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','online','push','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','phone','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','removeLists','getBlackLists','addBlackLists','removeBlackLists','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','find','type','name','UserProfileResource','destroy','error','send','index','VoiceQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','order','VoiceQueueId','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','voicePause','interface','penalty','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0xb397,0x1af));var _0x7b39=function(_0x11c3d1,_0x22a48d){_0x11c3d1=_0x11c3d1-0x0;var _0x4ee373=_0xb397[_0x11c3d1];return _0x4ee373;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b39('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b39('0x1'));var rp=require(_0x7b39('0x2'));var moment=require(_0x7b39('0x3'));var BPromise=require(_0x7b39('0x4'));var Mustache=require(_0x7b39('0x5'));var util=require(_0x7b39('0x6'));var path=require('path');var sox=require(_0x7b39('0x7'));var csv=require('to-csv');var ejs=require(_0x7b39('0x8'));var fs=require('fs');var fs_extra=require(_0x7b39('0x9'));var _=require(_0x7b39('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b39('0xb'));var deskjs=require(_0x7b39('0xc'));var toCsv=require(_0x7b39('0xd'));var querystring=require(_0x7b39('0xe'));var Papa=require('papaparse');var Redis=require(_0x7b39('0xf'));var authService=require(_0x7b39('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b39('0x11'));var hardwareService=require(_0x7b39('0x12'));var logger=require('../../config/logger')(_0x7b39('0x13'));var utils=require(_0x7b39('0x14'));var config=require(_0x7b39('0x15'));var licenseUtil=require(_0x7b39('0x16'));var db=require(_0x7b39('0x17'))['db'];config[_0x7b39('0x18')]=_[_0x7b39('0x19')](config[_0x7b39('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b39('0x1a'))(new Redis(config['redis']));require(_0x7b39('0x1b'))[_0x7b39('0x1c')](socket);function respondWithStatusCode(_0x518ec2,_0x124fd3){_0x124fd3=_0x124fd3||0xcc;return function(_0x1d8be5){if(_0x1d8be5){return _0x518ec2[_0x7b39('0x1d')](_0x124fd3);}return _0x518ec2[_0x7b39('0x1e')](_0x124fd3)[_0x7b39('0x1f')]();};}function respondWithResult(_0x377b40,_0x1895d9){_0x1895d9=_0x1895d9||0xc8;return function(_0x46a8f9){if(_0x46a8f9){return _0x377b40['status'](_0x1895d9)[_0x7b39('0x20')](_0x46a8f9);}};}function respondWithFilteredResult(_0x422979,_0x5eb85d){return function(_0x184f4){if(_0x184f4){var _0x3b2dbf=typeof _0x5eb85d['offset']===_0x7b39('0x21')&&typeof _0x5eb85d[_0x7b39('0x22')]==='undefined';var _0x48c352=_0x184f4[_0x7b39('0x23')];var _0xc69113=_0x3b2dbf?0x0:_0x5eb85d[_0x7b39('0x24')];var _0x2a947f=_0x3b2dbf?_0x184f4[_0x7b39('0x23')]:_0x5eb85d[_0x7b39('0x24')]+_0x5eb85d[_0x7b39('0x22')];var _0x2809b7;if(_0x2a947f>=_0x48c352){_0x2a947f=_0x48c352;_0x2809b7=0xc8;}else{_0x2809b7=0xce;}_0x422979[_0x7b39('0x1e')](_0x2809b7);return _0x422979['set']('Content-Range',_0xc69113+'-'+_0x2a947f+'/'+_0x48c352)[_0x7b39('0x20')](_0x184f4);}return null;};}function patchUpdates(_0x11a836){return function(_0x12d4f8){try{jsonpatch[_0x7b39('0x25')](_0x12d4f8,_0x11a836,!![]);}catch(_0x278e4c){return BPromise[_0x7b39('0x26')](_0x278e4c);}return _0x12d4f8[_0x7b39('0x27')]();};}function saveUpdates(_0x1c8a4f,_0x2e55f5){return function(_0x540b90){if(_0x540b90){return _0x540b90[_0x7b39('0x28')](_0x1c8a4f)['then'](function(_0x13ac20){return _0x13ac20;});}return null;};}function removeEntity(_0x2afaa4,_0x5c9898){return function(_0x396977){if(_0x396977){return _0x396977['destroy']()[_0x7b39('0x29')](function(){var _0x549c1d=_0x396977['get']({'plain':!![]});var _0x1313dc=[{'name':_0x7b39('0x2a'),'value':_0x7b39('0x2b'),'ignore':![]},{'name':_0x7b39('0x2c'),'value':_0x7b39('0x2d'),'ignore':![]}];var _0x986aeb=_(_0x1313dc)[_0x7b39('0x2e')](_0x7b39('0x2f'))[_0x7b39('0x30')]('value')[_0x7b39('0x31')]();if(_['includes'](_0x986aeb,_0x549c1d['type'])){return;}var _0x4ab898=_[_0x7b39('0x32')](_0x1313dc,['value',_0x549c1d[_0x7b39('0x33')]])[_0x7b39('0x34')];return db[_0x7b39('0x35')][_0x7b39('0x36')]({'where':{'type':_0x4ab898,'resourceId':_0x549c1d['id']}})['then'](function(){return _0x396977;});})[_0x7b39('0x29')](function(){_0x2afaa4[_0x7b39('0x1e')](0xcc)[_0x7b39('0x1f')]();});}};}function handleEntityNotFound(_0x18deb5,_0x1b5b74){return function(_0x1405b1){if(!_0x1405b1){_0x18deb5[_0x7b39('0x1d')](0x194);}return _0x1405b1;};}function handleError(_0x123eaa,_0xcd8be){_0xcd8be=_0xcd8be||0x1f4;return function(_0x3bf7eb){logger[_0x7b39('0x37')](_0x3bf7eb['stack']);if(_0x3bf7eb[_0x7b39('0x34')]){delete _0x3bf7eb[_0x7b39('0x34')];}_0x123eaa[_0x7b39('0x1e')](_0xcd8be)[_0x7b39('0x38')](_0x3bf7eb);};}exports[_0x7b39('0x39')]=function(_0x299d75,_0x1e620e){var _0x2914d3={},_0x2430b5={},_0x2e21af={'count':0x0,'rows':[]};var _0x33e706=_['map'](db[_0x7b39('0x3a')]['rawAttributes'],function(_0x440fc0){return{'name':_0x440fc0[_0x7b39('0x3b')],'type':_0x440fc0[_0x7b39('0x33')][_0x7b39('0x3c')]};});_0x2430b5[_0x7b39('0x3d')]=_[_0x7b39('0x30')](_0x33e706,_0x7b39('0x34'));_0x2430b5[_0x7b39('0x3e')]=_['keys'](_0x299d75[_0x7b39('0x3e')]);_0x2430b5[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x2430b5[_0x7b39('0x3d')],_0x2430b5['query']);_0x2914d3[_0x7b39('0x41')]=_['intersection'](_0x2430b5['model'],qs[_0x7b39('0x42')](_0x299d75[_0x7b39('0x3e')]['fields']));_0x2914d3['attributes']=_0x2914d3[_0x7b39('0x41')][_0x7b39('0x43')]?_0x2914d3[_0x7b39('0x41')]:_0x2430b5[_0x7b39('0x3d')];if(!_0x299d75[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x2914d3[_0x7b39('0x22')]=qs[_0x7b39('0x22')](_0x299d75['query']['limit']);_0x2914d3['offset']=qs[_0x7b39('0x24')](_0x299d75['query'][_0x7b39('0x24')]);}_0x2914d3['order']=qs[_0x7b39('0x46')](_0x299d75['query'][_0x7b39('0x46')]);_0x2914d3[_0x7b39('0x47')]=qs['filters'](_[_0x7b39('0x48')](_0x299d75[_0x7b39('0x3e')],_0x2430b5['filters']),_0x33e706);if(_0x299d75[_0x7b39('0x3e')][_0x7b39('0x2e')]){_0x2914d3[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x2914d3[_0x7b39('0x47')],{'$or':_[_0x7b39('0x30')](_0x33e706,function(_0xa535a5){if(_0xa535a5['type']!==_0x7b39('0x4a')){var _0x2e335c={};_0x2e335c[_0xa535a5[_0x7b39('0x34')]]={'$like':'%'+_0x299d75[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x2e335c;}})});}_0x2914d3=_[_0x7b39('0x49')]({},_0x2914d3,_0x299d75[_0x7b39('0x4b')]);var _0x313214={'where':_0x2914d3[_0x7b39('0x47')]};return db[_0x7b39('0x3a')]['count'](_0x313214)[_0x7b39('0x29')](function(_0x219c97){_0x2e21af[_0x7b39('0x23')]=_0x219c97;if(_0x299d75['query'][_0x7b39('0x4c')]){_0x2914d3[_0x7b39('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x7b39('0x4e')](_0x2914d3);})[_0x7b39('0x29')](function(_0x5429f4){_0x2e21af['rows']=_0x5429f4;return _0x2e21af;})[_0x7b39('0x29')](respondWithFilteredResult(_0x1e620e,_0x2914d3))['catch'](handleError(_0x1e620e,null));};exports['show']=function(_0x1bbb60,_0x17221e){var _0x1b43cf={'raw':![],'where':{'id':_0x1bbb60[_0x7b39('0x4f')]['id']}},_0x1611a7={};_0x1611a7[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db['VoiceQueue']['rawAttributes']);_0x1611a7['query']=_[_0x7b39('0x50')](_0x1bbb60[_0x7b39('0x3e')]);_0x1611a7[_0x7b39('0x3f')]=_['intersection'](_0x1611a7['model'],_0x1611a7['query']);_0x1b43cf[_0x7b39('0x41')]=_['intersection'](_0x1611a7['model'],qs[_0x7b39('0x42')](_0x1bbb60[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x1b43cf[_0x7b39('0x41')]=_0x1b43cf['attributes'][_0x7b39('0x43')]?_0x1b43cf['attributes']:_0x1611a7[_0x7b39('0x3d')];if(_0x1bbb60[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x1b43cf[_0x7b39('0x4d')]=[{'all':!![]}];}_0x1b43cf=_[_0x7b39('0x49')]({},_0x1b43cf,_0x1bbb60['options']);return db[_0x7b39('0x3a')]['find'](_0x1b43cf)[_0x7b39('0x29')](handleEntityNotFound(_0x17221e,null))[_0x7b39('0x29')](respondWithResult(_0x17221e,null))[_0x7b39('0x51')](handleError(_0x17221e,null));};exports[_0x7b39('0x52')]=function(_0x5738f3,_0x5283cc){return db[_0x7b39('0x3a')][_0x7b39('0x52')](_0x5738f3[_0x7b39('0x53')],{})[_0x7b39('0x29')](function(_0x336a02){var _0x15ddf1=_0x5738f3['user'][_0x7b39('0x54')]({'plain':!![]});if(!_0x15ddf1)throw new Error(_0x7b39('0x55'));if(_0x15ddf1[_0x7b39('0x56')]===_0x7b39('0x57')){var _0x30ecb9=_0x336a02[_0x7b39('0x54')]({'plain':!![]});var _0x4118bc=[{'name':_0x7b39('0x2a'),'value':_0x7b39('0x2b')},{'name':'QueueCampaigns','value':_0x7b39('0x2d')}];var _0xe3a139=_['find'](_0x4118bc,[_0x7b39('0x31'),_0x30ecb9['type']])[_0x7b39('0x34')];return db[_0x7b39('0x58')][_0x7b39('0x32')]({'where':{'name':_0xe3a139,'userProfileId':_0x15ddf1[_0x7b39('0x59')]},'raw':!![]})[_0x7b39('0x29')](function(_0x38a1e6){if(_0x38a1e6&&_0x38a1e6[_0x7b39('0x5a')]===0x0){return db[_0x7b39('0x35')][_0x7b39('0x52')]({'name':_0x30ecb9[_0x7b39('0x34')],'resourceId':_0x30ecb9['id'],'type':_0x38a1e6[_0x7b39('0x34')],'sectionId':_0x38a1e6['id']},{})[_0x7b39('0x29')](function(){return _0x336a02;});}else{return _0x336a02;}})[_0x7b39('0x51')](function(_0x3b4238){logger[_0x7b39('0x37')](_0x7b39('0x5b'),_0x3b4238);throw _0x3b4238;});}return _0x336a02;})['then'](respondWithResult(_0x5283cc,0xc9))[_0x7b39('0x51')](handleError(_0x5283cc,null));};exports['clone']=function(_0x405474,_0x3891f5){var _0x12e966={'where':{'id':_0x405474['params']['id']}},_0x3b90d9={};_0x3b90d9[_0x7b39('0x3d')]=_['keys'](db[_0x7b39('0x3a')][_0x7b39('0x5c')]);_0x12e966['attributes']=_['intersection'](_0x3b90d9[_0x7b39('0x3d')],qs[_0x7b39('0x42')](_0x405474['query'][_0x7b39('0x42')]));_0x12e966[_0x7b39('0x41')]=_0x12e966[_0x7b39('0x41')][_0x7b39('0x43')]?_0x12e966[_0x7b39('0x41')]:_0x3b90d9[_0x7b39('0x3d')];if(_0x405474[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x12e966[_0x7b39('0x4d')]=[{'all':!![]}];}_0x12e966=_[_0x7b39('0x49')]({},_0x12e966,_0x405474[_0x7b39('0x4b')]);return db['VoiceQueue']['find'](_0x12e966)[_0x7b39('0x29')](handleEntityNotFound(_0x3891f5,null))[_0x7b39('0x29')](function(_0x4ee686){if(_0x4ee686){var _0x1cc40f=_0x4ee686[_0x7b39('0x54')]({'plain':!![]});_0x1cc40f=qs[_0x7b39('0x5d')](_0x1cc40f,['id',_0x7b39('0x5e'),_0x7b39('0x5f')]);_0x405474[_0x7b39('0x53')]=_[_0x7b39('0x5d')](_0x405474['body'],['id',_0x7b39('0x5e'),_0x7b39('0x5f')]);return db[_0x7b39('0x3a')][_0x7b39('0x52')](_[_0x7b39('0x49')](_0x1cc40f,_0x405474[_0x7b39('0x53')]),{'include':_0x405474[_0x7b39('0x3e')][_0x7b39('0x4c')]?[{'all':!![]}]:undefined})[_0x7b39('0x29')](function(_0x2097b9){var _0x3fa16a=_0x405474['user'][_0x7b39('0x54')]({'plain':!![]});if(!_0x3fa16a)throw new Error(_0x7b39('0x55'));if(_0x3fa16a[_0x7b39('0x56')]===_0x7b39('0x57')){var _0x44c523=_0x2097b9[_0x7b39('0x54')]({'plain':!![]});var _0x47d180=[{'name':_0x7b39('0x2a'),'value':'inbound'},{'name':_0x7b39('0x2c'),'value':'outbound'}];var _0x2b535a=_['find'](_0x47d180,[_0x7b39('0x31'),_0x44c523[_0x7b39('0x33')]])[_0x7b39('0x34')];return db[_0x7b39('0x58')][_0x7b39('0x32')]({'where':{'name':_0x2b535a,'userProfileId':_0x3fa16a[_0x7b39('0x59')]},'raw':!![]})[_0x7b39('0x29')](function(_0x590a0f){if(_0x590a0f&&_0x590a0f[_0x7b39('0x5a')]===0x0){return db[_0x7b39('0x35')]['create']({'name':_0x44c523['name'],'resourceId':_0x44c523['id'],'type':_0x590a0f['name'],'sectionId':_0x590a0f['id']},{})[_0x7b39('0x29')](function(){return _0x2097b9;});}else{return _0x2097b9;}})[_0x7b39('0x51')](function(_0x419544){logger[_0x7b39('0x37')](_0x7b39('0x5b'),_0x419544);throw _0x419544;});}return _0x2097b9;});}})[_0x7b39('0x29')](respondWithResult(_0x3891f5,0xc9))['catch'](handleError(_0x3891f5,null));};exports[_0x7b39('0x28')]=function(_0x49a242,_0x365887){if(_0x49a242[_0x7b39('0x53')]['id']){delete _0x49a242[_0x7b39('0x53')]['id'];}return db['VoiceQueue'][_0x7b39('0x32')]({'where':{'id':_0x49a242[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x365887,null))[_0x7b39('0x29')](saveUpdates(_0x49a242[_0x7b39('0x53')],null))[_0x7b39('0x29')](respondWithResult(_0x365887,null))['catch'](handleError(_0x365887,null));};exports[_0x7b39('0x36')]=function(_0x3155a1,_0x54616d){return db[_0x7b39('0x3a')]['find']({'where':{'id':_0x3155a1[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x54616d,null))[_0x7b39('0x29')](removeEntity(_0x54616d,null))[_0x7b39('0x51')](handleError(_0x54616d,null));};exports[_0x7b39('0x60')]=function(_0x4d70ca,_0x206616,_0x291c52){var _0x2961d8={'raw':![],'where':{}};var _0x4e5861={};var _0x5d0425={'count':0x0,'rows':[]};return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x4d70ca[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x206616,null))['then'](function(_0x39b841){if(_0x39b841){_0x4e5861[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x62')][_0x7b39('0x5c')]);_0x4e5861[_0x7b39('0x3e')]=_['keys'](_0x4d70ca[_0x7b39('0x3e')]);_0x4e5861[_0x7b39('0x3f')]=_['intersection'](_0x4e5861[_0x7b39('0x3d')],_0x4e5861[_0x7b39('0x3e')]);_0x2961d8['attributes']=_['intersection'](_0x4e5861[_0x7b39('0x3d')],qs[_0x7b39('0x42')](_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x2961d8[_0x7b39('0x41')]=_0x2961d8['attributes']['length']?_0x2961d8[_0x7b39('0x41')]:_0x4e5861[_0x7b39('0x3d')];if(!_0x4d70ca['query'][_0x7b39('0x44')](_0x7b39('0x45'))){_0x2961d8[_0x7b39('0x22')]=qs['limit'](_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x2961d8[_0x7b39('0x24')]=qs['offset'](_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x24')]);}_0x2961d8[_0x7b39('0x63')]=qs[_0x7b39('0x46')](_0x4d70ca[_0x7b39('0x3e')]['sort']);_0x2961d8[_0x7b39('0x47')]=qs['filters'](_[_0x7b39('0x48')](_0x4d70ca[_0x7b39('0x3e')],_0x4e5861[_0x7b39('0x3f')]));_0x2961d8['where'][_0x7b39('0x64')]=_0x39b841['id'];if(_0x4d70ca[_0x7b39('0x3e')]['filter']){_0x2961d8[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x2961d8[_0x7b39('0x47')],{'$or':_['map'](_0x2961d8['attributes'],function(_0x5995f2){var _0x54ea24={};_0x54ea24[_0x5995f2]={'$like':'%'+_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x54ea24;})});}_0x2961d8=_[_0x7b39('0x49')]({},_0x2961d8,_0x4d70ca[_0x7b39('0x4b')]);return db[_0x7b39('0x62')][_0x7b39('0x23')]({'where':_0x2961d8[_0x7b39('0x47')]})[_0x7b39('0x29')](function(_0x3edea2){_0x5d0425['count']=_0x3edea2;if(_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x2961d8[_0x7b39('0x4d')]=[{'all':!![]}];}return db[_0x7b39('0x62')][_0x7b39('0x4e')](_0x2961d8);})[_0x7b39('0x29')](function(_0x17a23f){_0x5d0425['rows']=_0x17a23f;return _0x5d0425;});}})[_0x7b39('0x29')](respondWithFilteredResult(_0x206616,_0x2961d8))[_0x7b39('0x51')](handleError(_0x206616,null));};exports[_0x7b39('0x65')]=function(_0x4a8189,_0x3f157f,_0x1218bf){var _0x2ec298={'raw':!![],'where':{}};var _0x2f2c66={};var _0x162d9e={'count':0x0,'rows':[]};return db[_0x7b39('0x3a')]['findOne']({'where':{'id':_0x4a8189['params']['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x3f157f,null))['then'](function(_0x4f37df){if(_0x4f37df){_0x2f2c66[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x66')][_0x7b39('0x5c')]);_0x2f2c66[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0x4a8189['query']);_0x2f2c66[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x2f2c66[_0x7b39('0x3d')],_0x2f2c66['query']);_0x2ec298[_0x7b39('0x41')]=_['intersection'](_0x2f2c66[_0x7b39('0x3d')],qs['fields'](_0x4a8189[_0x7b39('0x3e')]['fields']));_0x2ec298[_0x7b39('0x41')]=_0x2ec298[_0x7b39('0x41')][_0x7b39('0x43')]?_0x2ec298[_0x7b39('0x41')]:_0x2f2c66['model'];if(!_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x2ec298[_0x7b39('0x22')]=qs[_0x7b39('0x22')](_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x2ec298[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x4a8189[_0x7b39('0x3e')]['offset']);}_0x2ec298[_0x7b39('0x63')]=qs['sort'](_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x2ec298[_0x7b39('0x47')]=qs['filters'](_[_0x7b39('0x48')](_0x4a8189[_0x7b39('0x3e')],_0x2f2c66['filters']));_0x2ec298[_0x7b39('0x47')]['VoiceQueueId']=_0x4f37df['id'];if(_0x4a8189['query'][_0x7b39('0x2e')]){_0x2ec298[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x2ec298['where'],{'$or':_[_0x7b39('0x30')](_0x2ec298['attributes'],function(_0x3f4ef9){var _0x49eb21={};_0x49eb21[_0x3f4ef9]={'$like':'%'+_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x49eb21;})});}_0x2ec298=_[_0x7b39('0x49')]({},_0x2ec298,_0x4a8189[_0x7b39('0x4b')]);return db[_0x7b39('0x66')][_0x7b39('0x23')]({'where':_0x2ec298[_0x7b39('0x47')]})['then'](function(_0x4a9ca9){_0x162d9e[_0x7b39('0x23')]=_0x4a9ca9;if(_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x2ec298[_0x7b39('0x4d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7b39('0x4e')](_0x2ec298);})[_0x7b39('0x29')](function(_0x41c26d){_0x162d9e[_0x7b39('0x67')]=_0x41c26d;return _0x162d9e;});}})[_0x7b39('0x29')](respondWithFilteredResult(_0x3f157f,_0x2ec298))[_0x7b39('0x51')](handleError(_0x3f157f,null));};exports[_0x7b39('0x68')]=function(_0x5c607c,_0x5ef365,_0x269fe7){var _0x29ce7d={'raw':!![],'where':{}};var _0x332ece={};var _0x31db73={'count':0x0,'rows':[]};return db[_0x7b39('0x3a')]['findOne']({'where':{'id':_0x5c607c[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x5ef365,null))[_0x7b39('0x29')](function(_0x218a9e){if(_0x218a9e){_0x332ece[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x69')][_0x7b39('0x5c')]);_0x332ece['query']=_['keys'](_0x5c607c[_0x7b39('0x3e')]);_0x332ece[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x332ece[_0x7b39('0x3d')],_0x332ece[_0x7b39('0x3e')]);_0x29ce7d[_0x7b39('0x41')]=_['intersection'](_0x332ece[_0x7b39('0x3d')],qs['fields'](_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x29ce7d['attributes']=_0x29ce7d[_0x7b39('0x41')]['length']?_0x29ce7d['attributes']:_0x332ece[_0x7b39('0x3d')];if(!_0x5c607c['query'][_0x7b39('0x44')](_0x7b39('0x45'))){_0x29ce7d[_0x7b39('0x22')]=qs['limit'](_0x5c607c[_0x7b39('0x3e')]['limit']);_0x29ce7d[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x24')]);}_0x29ce7d[_0x7b39('0x63')]=qs['sort'](_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x29ce7d[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0x5c607c['query'],_0x332ece[_0x7b39('0x3f')]));_0x29ce7d[_0x7b39('0x47')][_0x7b39('0x64')]=_0x218a9e['id'];if(_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x2e')]){_0x29ce7d[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x29ce7d['where'],{'$or':_[_0x7b39('0x30')](_0x29ce7d[_0x7b39('0x41')],function(_0xc80964){var _0x396b84={};_0x396b84[_0xc80964]={'$like':'%'+_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x396b84;})});}_0x29ce7d=_[_0x7b39('0x49')]({},_0x29ce7d,_0x5c607c[_0x7b39('0x4b')]);return db[_0x7b39('0x69')][_0x7b39('0x23')]({'where':_0x29ce7d[_0x7b39('0x47')]})[_0x7b39('0x29')](function(_0x634e60){_0x31db73['count']=_0x634e60;if(_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x29ce7d[_0x7b39('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7b39('0x4e')](_0x29ce7d);})[_0x7b39('0x29')](function(_0x34d31b){_0x31db73[_0x7b39('0x67')]=_0x34d31b;return _0x31db73;});}})[_0x7b39('0x29')](respondWithFilteredResult(_0x5ef365,_0x29ce7d))['catch'](handleError(_0x5ef365,null));};exports[_0x7b39('0x6a')]=function(_0x252e32,_0x59310,_0x4efc35){var _0x194265={'raw':!![],'where':{}};var _0x1978d1={};var _0x4202b4={'count':0x0,'rows':[]};return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x252e32[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x59310,null))['then'](function(_0x4158ab){if(_0x4158ab){_0x1978d1['model']=_[_0x7b39('0x50')](db[_0x7b39('0x6b')][_0x7b39('0x5c')]);_0x1978d1[_0x7b39('0x3e')]=_['keys'](_0x252e32[_0x7b39('0x3e')]);_0x1978d1['filters']=_[_0x7b39('0x40')](_0x1978d1['model'],_0x1978d1[_0x7b39('0x3e')]);_0x194265[_0x7b39('0x41')]=_['intersection'](_0x1978d1[_0x7b39('0x3d')],qs['fields'](_0x252e32[_0x7b39('0x3e')]['fields']));_0x194265[_0x7b39('0x41')]=_0x194265[_0x7b39('0x41')][_0x7b39('0x43')]?_0x194265[_0x7b39('0x41')]:_0x1978d1[_0x7b39('0x3d')];if(!_0x252e32[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x194265['limit']=qs[_0x7b39('0x22')](_0x252e32['query'][_0x7b39('0x22')]);_0x194265[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x252e32[_0x7b39('0x3e')][_0x7b39('0x24')]);}_0x194265[_0x7b39('0x63')]=qs[_0x7b39('0x46')](_0x252e32[_0x7b39('0x3e')]['sort']);_0x194265[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0x252e32[_0x7b39('0x3e')],_0x1978d1['filters']));_0x194265[_0x7b39('0x47')][_0x7b39('0x64')]=_0x4158ab['id'];if(_0x252e32[_0x7b39('0x3e')][_0x7b39('0x2e')]){_0x194265[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x194265['where'],{'$or':_[_0x7b39('0x30')](_0x194265[_0x7b39('0x41')],function(_0x536344){var _0x4b1826={};_0x4b1826[_0x536344]={'$like':'%'+_0x252e32[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x4b1826;})});}_0x194265=_[_0x7b39('0x49')]({},_0x194265,_0x252e32['options']);return db['CmHopperBlack']['count']({'where':_0x194265[_0x7b39('0x47')]})[_0x7b39('0x29')](function(_0x2cb184){_0x4202b4[_0x7b39('0x23')]=_0x2cb184;if(_0x252e32[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x194265[_0x7b39('0x4d')]=[{'all':!![]}];}return db[_0x7b39('0x6b')]['findAll'](_0x194265);})[_0x7b39('0x29')](function(_0x1075f9){_0x4202b4['rows']=_0x1075f9;return _0x4202b4;});}})[_0x7b39('0x29')](respondWithFilteredResult(_0x59310,_0x194265))['catch'](handleError(_0x59310,null));};exports[_0x7b39('0x6c')]=function(_0x528ab3,_0x538b63,_0x53c3bf){var _0x1dcd1f={};var _0x408d60={};var _0x29b0dd;var _0x320871;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x528ab3[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x538b63,null))[_0x7b39('0x29')](function(_0x18be5c){if(_0x18be5c){_0x29b0dd=_0x18be5c;_0x408d60['model']=_[_0x7b39('0x50')](db[_0x7b39('0x6d')][_0x7b39('0x5c')]);_0x408d60['query']=_[_0x7b39('0x50')](_0x528ab3['query']);_0x408d60[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x408d60['model'],_0x408d60[_0x7b39('0x3e')]);_0x1dcd1f['attributes']=_['intersection'](_0x408d60[_0x7b39('0x3d')],qs[_0x7b39('0x42')](_0x528ab3[_0x7b39('0x3e')]['fields']));_0x1dcd1f[_0x7b39('0x41')]=_0x1dcd1f[_0x7b39('0x41')][_0x7b39('0x43')]?_0x1dcd1f[_0x7b39('0x41')]:_0x408d60['model'];_0x1dcd1f[_0x7b39('0x63')]=qs[_0x7b39('0x46')](_0x528ab3[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x1dcd1f[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_['pick'](_0x528ab3[_0x7b39('0x3e')],_0x408d60[_0x7b39('0x3f')]));if(_0x528ab3[_0x7b39('0x3e')][_0x7b39('0x2e')]){_0x1dcd1f['where']=_[_0x7b39('0x49')](_0x1dcd1f[_0x7b39('0x47')],{'$or':_[_0x7b39('0x30')](_0x1dcd1f[_0x7b39('0x41')],function(_0x579bbf){var _0x291735={};_0x291735[_0x579bbf]={'$like':'%'+_0x528ab3[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x291735;})});}_0x1dcd1f=_[_0x7b39('0x49')]({},_0x1dcd1f,_0x528ab3[_0x7b39('0x4b')]);return _0x29b0dd[_0x7b39('0x6c')](_0x1dcd1f);}})['then'](function(_0xd93a96){if(_0xd93a96){_0x320871=_0xd93a96[_0x7b39('0x43')];if(!_0x528ab3[_0x7b39('0x3e')]['hasOwnProperty'](_0x7b39('0x45'))){_0x1dcd1f[_0x7b39('0x22')]=qs['limit'](_0x528ab3[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x1dcd1f[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x528ab3[_0x7b39('0x3e')]['offset']);}return _0x29b0dd[_0x7b39('0x6c')](_0x1dcd1f);}})[_0x7b39('0x29')](function(_0x16b22f){if(_0x16b22f){return _0x16b22f?{'count':_0x320871,'rows':_0x16b22f}:null;}})[_0x7b39('0x29')](respondWithResult(_0x538b63,null))[_0x7b39('0x51')](handleError(_0x538b63,null));};exports[_0x7b39('0x6e')]=function(_0x34fa91,_0x447349,_0x49a0fa){var _0xcdb529=_0x34fa91['body'][_0x7b39('0x6f')];var _0x5ed0f8=_['map'](_0xcdb529,'id');return db[_0x7b39('0x6d')][_0x7b39('0x4e')]({'where':{'id':_0x5ed0f8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b39('0x70'),'attributes':['id',_0x7b39('0x34'),'online',_0x7b39('0x71'),_0x7b39('0x72')],'raw':!![]}]})['then'](function(_0x13ba26){if(_0x13ba26){var _0x4b6071=_['flatMap'](_0x13ba26,function(_0x41bbe0){var _0x4f0f48=_0x41bbe0[_0x7b39('0x54')]({'plain':!![]});_0x4f0f48[_0x7b39('0x70')]['forEach'](function(_0x49e67e){_0x49e67e[_0x7b39('0x73')]=_[_0x7b39('0x32')](_0xcdb529,{'id':_0x4f0f48['id']})['penalty'];});return _0x4f0f48['Agents'];});return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0x34fa91[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](function(_0x20ae32){return db['sequelize'][_0x7b39('0x74')](function(_0x32b6ff){return _0x20ae32['addTeams'](_0x5ed0f8,{'transaction':_0x32b6ff})[_0x7b39('0x29')](function(){return BPromise[_0x7b39('0x75')](_0xcdb529,function(_0x20ea32){return db[_0x7b39('0x76')]['upsert']({'TeamId':_0x20ea32['id'],'VoiceQueueId':_0x34fa91['params']['id'],'penalty':_0x20ea32[_0x7b39('0x73')]},{'transaction':_0x32b6ff});});})[_0x7b39('0x29')](function(){return BPromise[_0x7b39('0x75')](_0x4b6071,function(_0x165ca9){return db[_0x7b39('0x77')][_0x7b39('0x78')]({'where':{'UserId':_0x165ca9['id'],'VoiceQueueId':_0x34fa91['params']['id']},'defaults':{'penalty':_0x165ca9[_0x7b39('0x73')]},'transaction':_0x32b6ff});});})[_0x7b39('0x29')](function(){return BPromise[_0x7b39('0x75')](_[_0x7b39('0x2e')](_0x4b6071,{'online':!![]}),function(_0x5e16e3){return db[_0x7b39('0x79')][_0x7b39('0x7a')]({'membername':_0x5e16e3['name'],'UserId':_0x5e16e3['id'],'queue_name':_0x20ae32[_0x7b39('0x34')],'VoiceQueueId':_0x20ae32['id'],'interface':_[_0x7b39('0x7b')](_0x5e16e3['interface'])?util[_0x7b39('0x7c')](_0x7b39('0x7d'),_0x5e16e3['name']):_0x5e16e3['interface'],'paused':_0x5e16e3['voicePause']||![],'penalty':_0x5e16e3[_0x7b39('0x73')]},{'transaction':_0x32b6ff});});})[_0x7b39('0x29')](function(){_0x4b6071[_0x7b39('0x7e')](function(_0x3f78c0){socket['emit']('userVoiceQueue:save',{'UserId':_0x3f78c0['id'],'VoiceQueueId':_0x20ae32['id']});});});});});}})[_0x7b39('0x29')](respondWithStatusCode(_0x447349,null))[_0x7b39('0x51')](handleError(_0x447349,null));};exports[_0x7b39('0x7f')]=function(_0x4beaea,_0xdb678c,_0x11e380){return db[_0x7b39('0x6d')]['findAll']({'where':{'id':_0x4beaea[_0x7b39('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b39('0x70'),'attributes':['id'],'raw':!![]}]})[_0x7b39('0x29')](handleEntityNotFound(_0xdb678c,null))[_0x7b39('0x29')](function(_0x19e5f5){var _0x1f62a1=_[_0x7b39('0x30')](_0x19e5f5,'id');var _0x2566f=[];var _0x244faf=[];var _0x2f953d=squel['select']();_0x2f953d[_0x7b39('0x80')](_0x7b39('0x81'))[_0x7b39('0x82')](_0x7b39('0x83'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7b39('0x47')](_0x7b39('0x84'),_0x4beaea[_0x7b39('0x4f')]['id']);for(var _0x4b866d=0x0;_0x4b866d<_0x19e5f5[_0x7b39('0x43')];_0x4b866d+=0x1){let _0x2fd366=_0x19e5f5[_0x4b866d];for(var _0x8679af=0x0;_0x8679af<_0x2fd366[_0x7b39('0x70')][_0x7b39('0x43')];_0x8679af+=0x1){let _0x578643=_0x2fd366[_0x7b39('0x70')][_0x8679af];var _0x2ec372=_0x2f953d[_0x7b39('0x85')]();_0x2ec372[_0x7b39('0x47')]('ut.UserId\x20=\x20?',_0x578643['id']);_0x244faf['push'](db[_0x7b39('0x86')]['query'](_0x2ec372[_0x7b39('0x87')](),{'type':db[_0x7b39('0x86')][_0x7b39('0x88')][_0x7b39('0x89')]})[_0x7b39('0x29')](function(_0x308da3){if(_0x308da3['length']===0x1){return _0x578643['id'];}else{var _0x5442f6=_[_0x7b39('0x8a')](_[_0x7b39('0x30')](_0x308da3,'TeamId'),function(_0x3635d5){return _[_0x7b39('0x8b')](_0x1f62a1,_0x3635d5);});if(_0x5442f6){return _0x578643['id'];}}}));}}return BPromise[_0x7b39('0x8c')](_0x244faf)[_0x7b39('0x29')](function(_0xded5bb){_0x2566f=_(_0x2566f)[_0x7b39('0x8d')](_0xded5bb)[_0x7b39('0x8e')]()[_0x7b39('0x31')]();return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0x4beaea[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](function(_0x369177){return db[_0x7b39('0x86')][_0x7b39('0x74')](function(_0xb71a08){return _0x369177[_0x7b39('0x7f')](_0x4beaea[_0x7b39('0x3e')][_0x7b39('0x8f')],{'transaction':_0xb71a08})[_0x7b39('0x29')](function(){if(!_[_0x7b39('0x90')](_0x2566f)){return _0x369177[_0x7b39('0x91')](_0x2566f,{'transaction':_0xb71a08})[_0x7b39('0x29')](function(){return db[_0x7b39('0x79')][_0x7b39('0x36')]({'where':{'VoiceQueueId':_0x4beaea[_0x7b39('0x4f')]['id'],'UserId':_0x2566f},'transaction':_0xb71a08});});}})[_0x7b39('0x29')](function(){_0x2566f['forEach'](function(_0x9de47c){socket[_0x7b39('0x92')](_0x7b39('0x93'),{'UserId':_0x9de47c,'VoiceQueueId':_0x369177['id']});});});});});});})[_0x7b39('0x29')](respondWithStatusCode(_0xdb678c,null))['catch'](handleError(_0xdb678c,null));};exports['addAgents']=function(_0x2e7959,_0x17f2b9,_0x189a47){var _0x2450c6,_0x463c64;return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0x2e7959[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x17f2b9,null))['then'](function(_0x33e1f9){if(_0x33e1f9){_0x463c64=_0x33e1f9;return _0x33e1f9[_0x7b39('0x94')](_0x2e7959[_0x7b39('0x53')]['ids'],_['omit'](_0x2e7959[_0x7b39('0x53')],['ids','id'])||{})[_0x7b39('0x95')](function(_0x2e804b){for(var _0x349b41=0x0;_0x349b41<_0x2e7959[_0x7b39('0x53')]['ids']['length'];_0x349b41+=0x1){socket['emit'](_0x7b39('0x96'),{'UserId':Number(_0x2e7959[_0x7b39('0x53')][_0x7b39('0x8f')][_0x349b41]),'VoiceQueueId':Number(_0x2e7959[_0x7b39('0x4f')]['id'])});}return _0x2e804b;});}})[_0x7b39('0x29')](function(_0x3b6ae5){_0x2450c6=_0x3b6ae5||[];if(_0x463c64){return db[_0x7b39('0x97')][_0x7b39('0x4e')]({'where':{'id':_0x2e7959[_0x7b39('0x53')][_0x7b39('0x8f')]},'attributes':['id',_0x7b39('0x34'),_0x7b39('0x98'),'voicePause',_0x7b39('0x72')],'raw':!![]});}})[_0x7b39('0x29')](function(_0x8bafca){if(!_['isEmpty'](_0x8bafca)){var _0x106e11=[];for(var _0x52c6b=0x0;_0x52c6b<_0x8bafca['length'];_0x52c6b++){if(_0x8bafca[_0x52c6b][_0x7b39('0x98')]){_0x106e11[_0x7b39('0x99')](db[_0x7b39('0x79')]['upsert']({'membername':_0x8bafca[_0x52c6b]['name'],'UserId':_0x8bafca[_0x52c6b]['id'],'queue_name':_0x463c64[_0x7b39('0x34')],'VoiceQueueId':_0x463c64['id'],'interface':_[_0x7b39('0x7b')](_0x8bafca[_0x52c6b]['interface'])?util['format'](_0x7b39('0x7d'),_0x8bafca[_0x52c6b]['name']):_0x8bafca[_0x52c6b][_0x7b39('0x72')],'paused':_0x8bafca[_0x52c6b][_0x7b39('0x71')]||![],'penalty':_0x2e7959[_0x7b39('0x53')][_0x7b39('0x73')]||0x0}));}}return BPromise['all'](_0x106e11);}})[_0x7b39('0x29')](function(){return _0x2450c6;})['then'](respondWithResult(_0x17f2b9,null))[_0x7b39('0x51')](handleError(_0x17f2b9,null));};exports['removeAgents']=function(_0x53c15a,_0x3bbd15,_0x61edf4){return db[_0x7b39('0x3a')]['find']({'where':{'id':_0x53c15a[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3bbd15,null))[_0x7b39('0x29')](function(_0xbf71b0){if(_0xbf71b0){return _0xbf71b0[_0x7b39('0x91')](_0x53c15a[_0x7b39('0x3e')]['ids'])[_0x7b39('0x29')](function(){if(_['isArray'](_0x53c15a[_0x7b39('0x3e')][_0x7b39('0x8f')])){for(var _0x12d278=0x0;_0x12d278<_0x53c15a[_0x7b39('0x3e')][_0x7b39('0x8f')]['length'];_0x12d278+=0x1){socket[_0x7b39('0x92')](_0x7b39('0x93'),{'UserId':Number(_0x53c15a['query'][_0x7b39('0x8f')][_0x12d278]),'VoiceQueueId':Number(_0x53c15a[_0x7b39('0x4f')]['id'])});}}else{socket[_0x7b39('0x92')](_0x7b39('0x93'),{'UserId':Number(_0x53c15a[_0x7b39('0x3e')][_0x7b39('0x8f')]),'VoiceQueueId':Number(_0x53c15a['params']['id'])});}});}})['then'](function(_0x4afe39){return db[_0x7b39('0x79')]['destroy']({'where':{'VoiceQueueId':_0x53c15a[_0x7b39('0x4f')]['id'],'UserId':_0x53c15a[_0x7b39('0x3e')]['ids']}})[_0x7b39('0x29')](function(){return _0x4afe39;});})[_0x7b39('0x29')](respondWithStatusCode(_0x3bbd15,null))[_0x7b39('0x51')](handleError(_0x3bbd15,null));};exports['getAgents']=function(_0xf2f6b3,_0x1c6fd7,_0x1bde77){var _0x5df5a9={};var _0x4e2ae8={};var _0x5283da;var _0x352931;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0xf2f6b3[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x1c6fd7,null))[_0x7b39('0x29')](function(_0x42233e){if(_0x42233e){_0x5283da=_0x42233e;_0x4e2ae8[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x97')][_0x7b39('0x5c')]);_0x4e2ae8[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0xf2f6b3['query']);_0x4e2ae8[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x4e2ae8[_0x7b39('0x3d')],_0x4e2ae8['query']);_0x5df5a9[_0x7b39('0x41')]=_[_0x7b39('0x40')](_0x4e2ae8['model'],qs[_0x7b39('0x42')](_0xf2f6b3['query'][_0x7b39('0x42')]));_0x5df5a9['attributes']=_0x5df5a9['attributes'][_0x7b39('0x43')]?_0x5df5a9[_0x7b39('0x41')]:_0x4e2ae8[_0x7b39('0x3d')];_0x5df5a9['order']=qs['sort'](_0xf2f6b3[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x5df5a9[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0xf2f6b3[_0x7b39('0x3e')],_0x4e2ae8['filters']));if(_0xf2f6b3['query'][_0x7b39('0x2e')]){_0x5df5a9[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x5df5a9['where'],{'$or':_[_0x7b39('0x30')](_0x5df5a9['attributes'],function(_0x16ddae){var _0x4bb620={};_0x4bb620[_0x16ddae]={'$like':'%'+_0xf2f6b3[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x4bb620;})});}_0x5df5a9=_['merge']({},_0x5df5a9,_0xf2f6b3[_0x7b39('0x4b')]);return _0x5283da[_0x7b39('0x9a')](_0x5df5a9);}})['then'](function(_0x22377b){if(_0x22377b){_0x352931=_0x22377b[_0x7b39('0x43')];if(!_0xf2f6b3['query'][_0x7b39('0x44')](_0x7b39('0x45'))){_0x5df5a9['limit']=qs[_0x7b39('0x22')](_0xf2f6b3[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x5df5a9[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0xf2f6b3['query'][_0x7b39('0x24')]);}return _0x5283da[_0x7b39('0x9a')](_0x5df5a9);}})[_0x7b39('0x29')](function(_0x40efcb){if(_0x40efcb){return _0x40efcb?{'count':_0x352931,'rows':_0x40efcb}:null;}})[_0x7b39('0x29')](respondWithResult(_0x1c6fd7,null))[_0x7b39('0x51')](handleError(_0x1c6fd7,null));};exports[_0x7b39('0x9b')]=function(_0x3fcbd0,_0x3aed8e,_0x37e4cf){var _0x2ebcb7={};var _0x136410={};var _0x412d23;var _0x2066df;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x3fcbd0[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x3aed8e,null))[_0x7b39('0x29')](function(_0x3098cc){if(_0x3098cc){_0x412d23=_0x3098cc;_0x136410[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x79')]['rawAttributes']);_0x136410[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0x3fcbd0[_0x7b39('0x3e')]);_0x136410[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x136410[_0x7b39('0x3d')],_0x136410['query']);_0x2ebcb7[_0x7b39('0x41')]=_[_0x7b39('0x40')](_0x136410['model'],qs[_0x7b39('0x42')](_0x3fcbd0[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x2ebcb7[_0x7b39('0x41')]=_0x2ebcb7[_0x7b39('0x41')][_0x7b39('0x43')]?_0x2ebcb7[_0x7b39('0x41')]:_0x136410['model'];_0x2ebcb7['order']=qs[_0x7b39('0x46')](_0x3fcbd0['query'][_0x7b39('0x46')]);_0x2ebcb7[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0x3fcbd0[_0x7b39('0x3e')],_0x136410['filters']));if(_0x3fcbd0['query'][_0x7b39('0x2e')]){_0x2ebcb7[_0x7b39('0x47')]=_['merge'](_0x2ebcb7[_0x7b39('0x47')],{'$or':_['map'](_0x2ebcb7[_0x7b39('0x41')],function(_0x34e0c4){var _0x5e8ef5={};_0x5e8ef5[_0x34e0c4]={'$like':'%'+_0x3fcbd0[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x5e8ef5;})});}_0x2ebcb7=_[_0x7b39('0x49')]({},_0x2ebcb7,_0x3fcbd0[_0x7b39('0x4b')]);return _0x412d23[_0x7b39('0x9b')](_0x2ebcb7);}})[_0x7b39('0x29')](function(_0x270642){if(_0x270642){_0x2066df=_0x270642[_0x7b39('0x43')];if(!_0x3fcbd0['query'][_0x7b39('0x44')]('nolimit')){_0x2ebcb7[_0x7b39('0x22')]=qs['limit'](_0x3fcbd0['query'][_0x7b39('0x22')]);_0x2ebcb7[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x3fcbd0[_0x7b39('0x3e')][_0x7b39('0x24')]);}return _0x412d23[_0x7b39('0x9b')](_0x2ebcb7);}})[_0x7b39('0x29')](function(_0x5617d2){return _0x5617d2?{'count':_0x2066df,'rows':_0x5617d2}:null;})[_0x7b39('0x29')](respondWithResult(_0x3aed8e,null))[_0x7b39('0x51')](handleError(_0x3aed8e,null));};exports[_0x7b39('0x9c')]=function(_0x9affca,_0x494c7f,_0x388e0c){var _0x4083ce={};var _0x29ac31={};var _0x4500;var _0x172030;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x9affca[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x494c7f,null))[_0x7b39('0x29')](function(_0x1bb6d3){if(_0x1bb6d3){_0x4500=_0x1bb6d3;_0x29ac31[_0x7b39('0x3d')]=_['keys'](db[_0x7b39('0x9d')][_0x7b39('0x5c')]);_0x29ac31[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0x9affca['query']);_0x29ac31[_0x7b39('0x3f')]=_['intersection'](_0x29ac31['model'],_0x29ac31[_0x7b39('0x3e')]);_0x4083ce[_0x7b39('0x41')]=_[_0x7b39('0x40')](_0x29ac31['model'],qs[_0x7b39('0x42')](_0x9affca[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x4083ce[_0x7b39('0x41')]=_0x4083ce[_0x7b39('0x41')]['length']?_0x4083ce[_0x7b39('0x41')]:_0x29ac31[_0x7b39('0x3d')];_0x4083ce[_0x7b39('0x63')]=qs[_0x7b39('0x46')](_0x9affca['query'][_0x7b39('0x46')]);_0x4083ce['where']=qs[_0x7b39('0x3f')](_['pick'](_0x9affca[_0x7b39('0x3e')],_0x29ac31[_0x7b39('0x3f')]));if(_0x9affca['query'][_0x7b39('0x2e')]){_0x4083ce[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x4083ce['where'],{'$or':_[_0x7b39('0x30')](_0x4083ce[_0x7b39('0x41')],function(_0x4e984b){var _0x5cd30e={};_0x5cd30e[_0x4e984b]={'$like':'%'+_0x9affca[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x5cd30e;})});}_0x4083ce=_[_0x7b39('0x49')]({},_0x4083ce,_0x9affca[_0x7b39('0x4b')]);return _0x4500[_0x7b39('0x9c')](_0x4083ce);}})[_0x7b39('0x29')](function(_0x5011c8){if(_0x5011c8){_0x172030=_0x5011c8[_0x7b39('0x43')];if(!_0x9affca[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x4083ce[_0x7b39('0x22')]=qs[_0x7b39('0x22')](_0x9affca[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x4083ce[_0x7b39('0x24')]=qs['offset'](_0x9affca[_0x7b39('0x3e')]['offset']);}return _0x4500[_0x7b39('0x9c')](_0x4083ce);}})[_0x7b39('0x29')](function(_0x2ae90d){if(_0x2ae90d){return _0x2ae90d?{'count':_0x172030,'rows':_0x2ae90d}:null;}})[_0x7b39('0x29')](respondWithResult(_0x494c7f,null))[_0x7b39('0x51')](handleError(_0x494c7f,null));};exports[_0x7b39('0x9e')]=function(_0x5d245c,_0x169ade,_0x20f3a5){var _0x4937c1,_0x142552;return db['VoiceQueue']['find']({'where':{'id':_0x5d245c['params']['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x169ade,null))[_0x7b39('0x29')](function(_0x166bcf){if(_0x166bcf){_0x142552=_0x166bcf;return _0x166bcf[_0x7b39('0x9e')](_0x5d245c[_0x7b39('0x53')]['ids'],_[_0x7b39('0x5d')](_0x5d245c[_0x7b39('0x53')],[_0x7b39('0x8f'),'id'])||{});}return null;})[_0x7b39('0x95')](function(_0x586742){var _0x1bf5c2;_0x4937c1=_0x586742||[];var _0x30d2d4=[];if(_0x586742){for(var _0x4df9e5=0x0;_0x4df9e5<_0x586742[_0x7b39('0x43')];_0x4df9e5+=0x1){var _0x2da029=_0x586742[_0x4df9e5][_0x7b39('0x54')]({'plain':!![]});_0x142552[_0x7b39('0x9f')]=_0x5d245c[_0x7b39('0x53')][_0x7b39('0x9f')]?_0x5d245c['body']['dialCheckDuplicateType']:_0x142552['dialCheckDuplicateType'];switch(_0x142552[_0x7b39('0x9f')]){case _0x7b39('0xa0'):_0x1bf5c2=squel[_0x7b39('0xa1')]()[_0x7b39('0xa2')](_0x7b39('0xa3'))[_0x7b39('0xa4')](['phone','scheduledAt',_0x7b39('0xa5'),_0x7b39('0xa6'),_0x7b39('0x64'),'createdAt',_0x7b39('0x5f')],squel[_0x7b39('0xa7')]()['field']('phone',_0x7b39('0xa8'))[_0x7b39('0x80')](_0x7b39('0xa9'),'scheduledAt')[_0x7b39('0x80')]('id',_0x7b39('0xa5'))[_0x7b39('0x80')](_0x2da029[_0x7b39('0xaa')][_0x7b39('0x87')](),_0x7b39('0xa6'))['field'](_0x5d245c['params']['id'][_0x7b39('0x87')](),'VoiceQueueId')[_0x7b39('0x80')](_0x7b39('0xa9'),'createdAt')['field']('NOW()',_0x7b39('0x5f'))[_0x7b39('0x82')](_0x7b39('0xab'))[_0x7b39('0x47')](_0x7b39('0xac'))[_0x7b39('0x47')](_0x7b39('0xad'),_0x2da029[_0x7b39('0xaa')]['toString']())[_0x7b39('0x47')](_0x7b39('0xae'))['where'](_0x7b39('0xaf'),squel['select']()[_0x7b39('0x80')]('COALESCE(calleridnum,\x27\x27)')[_0x7b39('0x82')](_0x7b39('0xb0'))[_0x7b39('0x47')](_0x7b39('0x84'),_0x5d245c['params']['id']['toString']()))['where'](_0x7b39('0xaf'),squel[_0x7b39('0xa7')]()[_0x7b39('0x80')](_0x7b39('0xb1'))['from'](_0x7b39('0xa3'))[_0x7b39('0x47')](_0x7b39('0x84'),_0x5d245c[_0x7b39('0x4f')]['id'][_0x7b39('0x87')]())))['toString']();break;case _0x7b39('0xb2'):_0x1bf5c2=squel[_0x7b39('0xa1')]()[_0x7b39('0xa2')](_0x7b39('0xa3'))[_0x7b39('0xa4')]([_0x7b39('0xa8'),_0x7b39('0xb3'),'ContactId',_0x7b39('0xa6'),_0x7b39('0x64'),_0x7b39('0x5e'),_0x7b39('0x5f')],squel[_0x7b39('0xa7')]()[_0x7b39('0x80')](_0x7b39('0xa8'),'phone')[_0x7b39('0x80')](_0x7b39('0xa9'),_0x7b39('0xb3'))[_0x7b39('0x80')]('id',_0x7b39('0xa5'))['field'](_0x2da029[_0x7b39('0xaa')][_0x7b39('0x87')](),'ListId')['field'](_0x5d245c[_0x7b39('0x4f')]['id'][_0x7b39('0x87')](),'VoiceQueueId')[_0x7b39('0x80')]('NOW()',_0x7b39('0x5e'))['field'](_0x7b39('0xa9'),_0x7b39('0x5f'))['from'](_0x7b39('0xab'))[_0x7b39('0x47')](_0x7b39('0xac'))['where'](_0x7b39('0xad'),_0x2da029['CmListId']['toString']())[_0x7b39('0x47')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x7b39('0xaf'),squel[_0x7b39('0xa7')]()[_0x7b39('0x80')](_0x7b39('0xb1'))['from'](_0x7b39('0xa3'))['where'](_0x7b39('0x84'),_0x5d245c[_0x7b39('0x4f')]['id'][_0x7b39('0x87')]())))[_0x7b39('0x87')]();break;default:_0x1bf5c2=squel[_0x7b39('0xa1')]()[_0x7b39('0xa2')](_0x7b39('0xa3'))[_0x7b39('0xa4')]([_0x7b39('0xa8'),'scheduledAt',_0x7b39('0xa5'),_0x7b39('0xa6'),_0x7b39('0x64'),_0x7b39('0x5e'),_0x7b39('0x5f')],squel[_0x7b39('0xa7')]()['field'](_0x7b39('0xa8'),_0x7b39('0xa8'))[_0x7b39('0x80')](_0x7b39('0xa9'),_0x7b39('0xb3'))[_0x7b39('0x80')]('id',_0x7b39('0xa5'))[_0x7b39('0x80')](_0x2da029[_0x7b39('0xaa')][_0x7b39('0x87')](),_0x7b39('0xa6'))[_0x7b39('0x80')](_0x5d245c[_0x7b39('0x4f')]['id']['toString'](),_0x7b39('0x64'))[_0x7b39('0x80')]('NOW()',_0x7b39('0x5e'))['field'](_0x7b39('0xa9'),_0x7b39('0x5f'))['from']('cm_contacts')[_0x7b39('0x47')](_0x7b39('0xac'))[_0x7b39('0x47')](_0x7b39('0xad'),_0x2da029[_0x7b39('0xaa')][_0x7b39('0x87')]())[_0x7b39('0x47')](_0x7b39('0xae')))[_0x7b39('0x87')]();}_0x30d2d4[_0x7b39('0x99')](db['sequelize'][_0x7b39('0x3e')](_0x1bf5c2));}return BPromise[_0x7b39('0x8c')](_0x30d2d4);}})[_0x7b39('0x29')](function(){return _0x4937c1;})['then'](respondWithResult(_0x169ade,null))[_0x7b39('0x51')](handleError(_0x169ade,null));};exports[_0x7b39('0xb4')]=function(_0x5123cb,_0x3b1e86,_0x5b3664){return db[_0x7b39('0x3a')]['find']({'where':{'id':_0x5123cb[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x3b1e86,null))[_0x7b39('0x29')](function(_0x4a1968){if(_0x4a1968){return _0x4a1968['removeLists'](_0x5123cb[_0x7b39('0x3e')]['ids']);}})[_0x7b39('0x29')](function(_0x2c9e15){if(_0x2c9e15){return db[_0x7b39('0x62')]['destroy']({'where':{'ListId':_0x5123cb[_0x7b39('0x3e')][_0x7b39('0x8f')],'VoiceQueueId':_0x5123cb[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](function(){return _0x2c9e15;});}})['then'](respondWithStatusCode(_0x3b1e86,null))[_0x7b39('0x51')](handleError(_0x3b1e86,null));};exports[_0x7b39('0xb5')]=function(_0x59e101,_0x4e47b0,_0x64b54e){var _0x25606e={};var _0x42b2a0={};var _0x3693ec;var _0x214283;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x59e101[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x4e47b0,null))[_0x7b39('0x29')](function(_0x2e0146){if(_0x2e0146){_0x3693ec=_0x2e0146;_0x42b2a0[_0x7b39('0x3d')]=_['keys'](db[_0x7b39('0x9d')]['rawAttributes']);_0x42b2a0[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0x59e101[_0x7b39('0x3e')]);_0x42b2a0[_0x7b39('0x3f')]=_['intersection'](_0x42b2a0[_0x7b39('0x3d')],_0x42b2a0[_0x7b39('0x3e')]);_0x25606e[_0x7b39('0x41')]=_[_0x7b39('0x40')](_0x42b2a0['model'],qs[_0x7b39('0x42')](_0x59e101[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x25606e['attributes']=_0x25606e[_0x7b39('0x41')][_0x7b39('0x43')]?_0x25606e['attributes']:_0x42b2a0[_0x7b39('0x3d')];_0x25606e[_0x7b39('0x63')]=qs['sort'](_0x59e101[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x25606e[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0x59e101['query'],_0x42b2a0[_0x7b39('0x3f')]));if(_0x59e101['query'][_0x7b39('0x2e')]){_0x25606e[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x25606e[_0x7b39('0x47')],{'$or':_['map'](_0x25606e[_0x7b39('0x41')],function(_0x37da96){var _0x5e8502={};_0x5e8502[_0x37da96]={'$like':'%'+_0x59e101[_0x7b39('0x3e')]['filter']+'%'};return _0x5e8502;})});}_0x25606e=_[_0x7b39('0x49')]({},_0x25606e,_0x59e101[_0x7b39('0x4b')]);return _0x3693ec[_0x7b39('0xb5')](_0x25606e);}})['then'](function(_0x5d4d0f){if(_0x5d4d0f){_0x214283=_0x5d4d0f['length'];if(!_0x59e101[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x25606e['limit']=qs[_0x7b39('0x22')](_0x59e101[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x25606e[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x59e101[_0x7b39('0x3e')][_0x7b39('0x24')]);}return _0x3693ec[_0x7b39('0xb5')](_0x25606e);}})['then'](function(_0x2e1678){if(_0x2e1678){return _0x2e1678?{'count':_0x214283,'rows':_0x2e1678}:null;}})[_0x7b39('0x29')](respondWithResult(_0x4e47b0,null))[_0x7b39('0x51')](handleError(_0x4e47b0,null));};exports[_0x7b39('0xb6')]=function(_0xef80d7,_0x4fa7f8,_0x16c9c9){var _0x5e5835,_0x5026e8;return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0xef80d7[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x4fa7f8,null))[_0x7b39('0x29')](function(_0xdd2757){if(_0xdd2757){_0x5026e8=_0xdd2757;return _0xdd2757[_0x7b39('0xb6')](_0xef80d7[_0x7b39('0x53')][_0x7b39('0x8f')],_['omit'](_0xef80d7[_0x7b39('0x53')],[_0x7b39('0x8f'),'id'])||{});}return null;})[_0x7b39('0x95')](function(_0x33675d){var _0x5c5ed9;_0x5e5835=_0x33675d||[];var _0x3b3a53=[];if(_0x33675d){for(var _0x12d541=0x0;_0x12d541<_0x33675d[_0x7b39('0x43')];_0x12d541+=0x1){var _0x210c86=_0x33675d[_0x12d541][_0x7b39('0x54')]({'plain':!![]});_0x5c5ed9=squel['insert']()['into']('cm_hopper_black')[_0x7b39('0xa4')]([_0x7b39('0xa8'),'ContactId',_0x7b39('0xa6'),_0x7b39('0x64'),'createdAt',_0x7b39('0x5f')],squel[_0x7b39('0xa7')]()[_0x7b39('0x80')](_0x7b39('0xa8'),_0x7b39('0xa8'))[_0x7b39('0x80')]('id',_0x7b39('0xa5'))[_0x7b39('0x80')](_0x210c86[_0x7b39('0xaa')][_0x7b39('0x87')](),_0x7b39('0xa6'))['field'](_0xef80d7['params']['id'][_0x7b39('0x87')](),_0x7b39('0x64'))[_0x7b39('0x80')]('NOW()',_0x7b39('0x5e'))[_0x7b39('0x80')](_0x7b39('0xa9'),_0x7b39('0x5f'))[_0x7b39('0x82')](_0x7b39('0xab'))[_0x7b39('0x47')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x210c86[_0x7b39('0xaa')]['toString']())[_0x7b39('0x47')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3b3a53[_0x7b39('0x99')](db[_0x7b39('0x86')][_0x7b39('0x3e')](_0x5c5ed9));}return BPromise['all'](_0x3b3a53);}})[_0x7b39('0x29')](function(){return _0x5e5835;})[_0x7b39('0x29')](respondWithResult(_0x4fa7f8,null))[_0x7b39('0x51')](handleError(_0x4fa7f8,null));};exports['removeBlackLists']=function(_0x40af56,_0x5776cf,_0x289726){return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0x40af56[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5776cf,null))['then'](function(_0x487a62){if(_0x487a62){return _0x487a62[_0x7b39('0xb7')](_0x40af56[_0x7b39('0x3e')][_0x7b39('0x8f')]);}})[_0x7b39('0x29')](function(_0x36104a){if(_0x36104a){return db[_0x7b39('0x6b')][_0x7b39('0x36')]({'where':{'ListId':_0x40af56['query'][_0x7b39('0x8f')],'VoiceQueueId':_0x40af56[_0x7b39('0x4f')]['id']}})['then'](function(){return _0x36104a;});}})[_0x7b39('0x29')](respondWithStatusCode(_0x5776cf,null))[_0x7b39('0x51')](handleError(_0x5776cf,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f824158..8e7e5d0 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 _0xf706=['hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','save','update','remove','emit'];(function(_0x3e319e,_0x199f33){var _0xcc04b=function(_0x5c1b50){while(--_0x5c1b50){_0x3e319e['push'](_0x3e319e['shift']());}};_0xcc04b(++_0x199f33);}(_0xf706,0x185));var _0x6f70=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xf706[_0x1c8c28];return _0x1f59b4;};'use strict';var EventEmitter=require(_0x6f70('0x0'));var VoiceQueue=require(_0x6f70('0x1'))['db'][_0x6f70('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6f70('0x3'),'afterUpdate':_0x6f70('0x4'),'afterDestroy':_0x6f70('0x5')};function emitEvent(_0x5e888f){return function(_0x15ce6c,_0x1af61b,_0x1c93af){VoiceQueueEvents[_0x6f70('0x6')](_0x5e888f+':'+_0x15ce6c['id'],_0x15ce6c);VoiceQueueEvents[_0x6f70('0x6')](_0x5e888f,_0x15ce6c);_0x1c93af(null);};}for(var e in events){if(events[_0x6f70('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x6f70('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xfa74=['update','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x1303c5,_0x38490d){var _0x3c1e22=function(_0x446100){while(--_0x446100){_0x1303c5['push'](_0x1303c5['shift']());}};_0x3c1e22(++_0x38490d);}(_0xfa74,0xaf));var _0x4fa7=function(_0x5de1d2,_0x3ed732){_0x5de1d2=_0x5de1d2-0x0;var _0x327771=_0xfa74[_0x5de1d2];return _0x327771;};'use strict';var EventEmitter=require(_0x4fa7('0x0'));var VoiceQueue=require(_0x4fa7('0x1'))['db'][_0x4fa7('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4fa7('0x3')](0x0);var events={'afterCreate':_0x4fa7('0x4'),'afterUpdate':_0x4fa7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x50f385){return function(_0x11030d,_0x41153f,_0x448a64){VoiceQueueEvents[_0x4fa7('0x6')](_0x50f385+':'+_0x11030d['id'],_0x11030d);VoiceQueueEvents['emit'](_0x50f385,_0x11030d);_0x448a64(null);};}for(var e in events){if(events[_0x4fa7('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x4fa7('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 2589374..467578b 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x552cb3,_0x2b0216){var _0x1cac5f=function(_0x4adf7c){while(--_0x4adf7c){_0x552cb3['push'](_0x552cb3['shift']());}};_0x1cac5f(++_0x2b0216);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c3ba5,_0x4a8ee9){_0x2c3ba5=_0x2c3ba5-0x0;var _0x100b9f=_0xedd9[_0x2c3ba5];return _0x100b9f;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x52a40a,_0x428073){var _0x80bd65=function(_0x20ef33){while(--_0x20ef33){_0x52a40a['push'](_0x52a40a['shift']());}};_0x80bd65(++_0x428073);}(_0xedd9,0xfc));var _0x9edd=function(_0x49a7c2,_0x1c50a0){_0x49a7c2=_0x49a7c2-0x0;var _0x47e727=_0xedd9[_0x49a7c2];return _0x47e727;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a35673a..420b3a3 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 _0x9172=['attributes','limit','map','include','model','stringify','ShowVoiceQueue','lodash','util','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x9172,0x197));var _0x2917=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x9172[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x2917('0x0'));var util=require(_0x2917('0x1'));var moment=require(_0x2917('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2917('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2917('0x4'));var config=require(_0x2917('0x5'));var jayson=require(_0x2917('0x6'));var client=jayson[_0x2917('0x7')][_0x2917('0x8')]({'port':0x232a});config[_0x2917('0x9')]=_[_0x2917('0xa')](config[_0x2917('0x9')],{'host':_0x2917('0xb'),'port':0x18eb});var socket=require(_0x2917('0xc'))(new Redis(config[_0x2917('0x9')]));require(_0x2917('0xd'))[_0x2917('0xe')](socket);function respondWithRpcPromise(_0x51fd27,_0x4ca97b,_0x2633b9){return new BPromise(function(_0x2578de,_0x9cc9b7){return client[_0x2917('0xf')](_0x51fd27,_0x2633b9)[_0x2917('0x10')](function(_0x343057){logger[_0x2917('0x11')](_0x2917('0x12'),_0x4ca97b,_0x2917('0x13'));logger[_0x2917('0x14')](_0x2917('0x15'),_0x4ca97b,_0x2917('0x13'),JSON['stringify'](_0x343057));if(_0x343057[_0x2917('0x16')]){if(_0x343057['error'][_0x2917('0x17')]===0x1f4){logger[_0x2917('0x16')](_0x2917('0x12'),_0x4ca97b,_0x343057[_0x2917('0x16')]['message']);return _0x9cc9b7(_0x343057[_0x2917('0x16')][_0x2917('0x18')]);}logger[_0x2917('0x16')](_0x2917('0x12'),_0x4ca97b,_0x343057[_0x2917('0x16')][_0x2917('0x18')]);return _0x2578de(_0x343057[_0x2917('0x16')]['message']);}else{logger[_0x2917('0x11')](_0x2917('0x12'),_0x4ca97b,'request\x20sent');_0x2578de(_0x343057[_0x2917('0x19')][_0x2917('0x18')]);}})[_0x2917('0x1a')](function(_0x4cf61f){logger[_0x2917('0x16')](_0x2917('0x12'),_0x4ca97b,_0x4cf61f);_0x9cc9b7(_0x4cf61f);});});}exports[_0x2917('0x1b')]=function(_0x34a04b){var _0x2391b7=this;return new Promise(function(_0x1b256c,_0x47cb87){return db[_0x2917('0x1c')][_0x2917('0x1d')]({'raw':_0x34a04b[_0x2917('0x1e')]?_0x34a04b[_0x2917('0x1e')][_0x2917('0x1f')]===undefined?!![]:![]:!![],'where':_0x34a04b['options']?_0x34a04b[_0x2917('0x1e')][_0x2917('0x20')]||null:null,'attributes':_0x34a04b[_0x2917('0x1e')]?_0x34a04b[_0x2917('0x1e')][_0x2917('0x21')]||null:null,'limit':_0x34a04b[_0x2917('0x1e')]?_0x34a04b[_0x2917('0x1e')][_0x2917('0x22')]||null:null,'include':_0x34a04b[_0x2917('0x1e')]?_0x34a04b[_0x2917('0x1e')]['include']?_[_0x2917('0x23')](_0x34a04b[_0x2917('0x1e')][_0x2917('0x24')],function(_0x2fb815){return{'model':db[_0x2fb815[_0x2917('0x25')]],'as':_0x2fb815['as'],'attributes':_0x2fb815[_0x2917('0x21')],'include':_0x2fb815[_0x2917('0x24')]?_[_0x2917('0x23')](_0x2fb815[_0x2917('0x24')],function(_0xc7a0a4){return{'model':db[_0xc7a0a4['model']],'as':_0xc7a0a4['as'],'attributes':_0xc7a0a4[_0x2917('0x21')],'include':_0xc7a0a4[_0x2917('0x24')]?_[_0x2917('0x23')](_0xc7a0a4['include'],function(_0x2b79a7){return{'model':db[_0x2b79a7['model']],'as':_0x2b79a7['as'],'attributes':_0x2b79a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x2917('0x10')](function(_0xc91189){logger['info'](_0x2917('0x1b'),_0x34a04b);logger[_0x2917('0x14')](_0x2917('0x1b'),_0x34a04b,JSON[_0x2917('0x26')](_0xc91189));_0x1b256c(_0xc91189);})['catch'](function(_0x4b5cc0){logger[_0x2917('0x16')](_0x2917('0x1b'),_0x4b5cc0[_0x2917('0x18')],_0x34a04b);_0x47cb87(_0x2391b7['error'](0x1f4,_0x4b5cc0[_0x2917('0x18')]));});});};exports[_0x2917('0x27')]=function(_0x46c9c2){var _0x42e5f8=this;return new Promise(function(_0x41bbdf,_0x28b5be){return db[_0x2917('0x1c')]['find']({'raw':_0x46c9c2[_0x2917('0x1e')]?_0x46c9c2[_0x2917('0x1e')][_0x2917('0x1f')]===undefined?!![]:![]:!![],'where':_0x46c9c2['options']?_0x46c9c2['options'][_0x2917('0x20')]||null:null,'attributes':_0x46c9c2[_0x2917('0x1e')]?_0x46c9c2[_0x2917('0x1e')]['attributes']||null:null,'include':_0x46c9c2[_0x2917('0x1e')]?_0x46c9c2[_0x2917('0x1e')][_0x2917('0x24')]?_['map'](_0x46c9c2[_0x2917('0x1e')][_0x2917('0x24')],function(_0x4225e6){return{'model':db[_0x4225e6['model']],'as':_0x4225e6['as'],'attributes':_0x4225e6['attributes'],'include':_0x4225e6['include']?_[_0x2917('0x23')](_0x4225e6['include'],function(_0x3419db){return{'model':db[_0x3419db[_0x2917('0x25')]],'as':_0x3419db['as'],'attributes':_0x3419db[_0x2917('0x21')],'include':_0x3419db[_0x2917('0x24')]?_[_0x2917('0x23')](_0x3419db['include'],function(_0x32e3f9){return{'model':db[_0x32e3f9['model']],'as':_0x32e3f9['as'],'attributes':_0x32e3f9[_0x2917('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2917('0x10')](function(_0x21d4f6){logger[_0x2917('0x11')]('ShowVoiceQueue',_0x46c9c2);logger[_0x2917('0x14')](_0x2917('0x27'),_0x46c9c2,JSON[_0x2917('0x26')](_0x21d4f6));_0x41bbdf(_0x21d4f6);})['catch'](function(_0x1b2e71){logger[_0x2917('0x16')]('ShowVoiceQueue',_0x1b2e71['message'],_0x46c9c2);_0x28b5be(_0x42e5f8[_0x2917('0x16')](0x1f4,_0x1b2e71[_0x2917('0x18')]));});});}; \ No newline at end of file +var _0x7218=['request','then','info','debug','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','map','include','model','stringify','catch','ShowVoiceQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x487de6,_0x2db671){var _0x3dcac9=function(_0x40dbc4){while(--_0x40dbc4){_0x487de6['push'](_0x487de6['shift']());}};_0x3dcac9(++_0x2db671);}(_0x7218,0x176));var _0x8721=function(_0x1175ac,_0x533135){_0x1175ac=_0x1175ac-0x0;var _0xba6299=_0x7218[_0x1175ac];return _0xba6299;};'use strict';var _=require(_0x8721('0x0'));var util=require(_0x8721('0x1'));var moment=require(_0x8721('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8721('0x3'));var db=require(_0x8721('0x4'))['db'];var utils=require(_0x8721('0x5'));var logger=require(_0x8721('0x6'))(_0x8721('0x7'));var config=require(_0x8721('0x8'));var jayson=require(_0x8721('0x9'));var client=jayson['client'][_0x8721('0xa')]({'port':0x232a});config[_0x8721('0xb')]=_['defaults'](config[_0x8721('0xb')],{'host':_0x8721('0xc'),'port':0x18eb});var socket=require(_0x8721('0xd'))(new Redis(config[_0x8721('0xb')]));require(_0x8721('0xe'))[_0x8721('0xf')](socket);function respondWithRpcPromise(_0xcb79b7,_0x18415c,_0x317780){return new BPromise(function(_0x297519,_0x27fad4){return client[_0x8721('0x10')](_0xcb79b7,_0x317780)[_0x8721('0x11')](function(_0x470fe2){logger[_0x8721('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x18415c,'request\x20sent');logger[_0x8721('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x18415c,_0x8721('0x14'),JSON['stringify'](_0x470fe2));if(_0x470fe2[_0x8721('0x15')]){if(_0x470fe2[_0x8721('0x15')][_0x8721('0x16')]===0x1f4){logger['error'](_0x8721('0x17'),_0x18415c,_0x470fe2[_0x8721('0x15')][_0x8721('0x18')]);return _0x27fad4(_0x470fe2[_0x8721('0x15')][_0x8721('0x18')]);}logger[_0x8721('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x18415c,_0x470fe2[_0x8721('0x15')]['message']);return _0x297519(_0x470fe2[_0x8721('0x15')]['message']);}else{logger[_0x8721('0x12')](_0x8721('0x17'),_0x18415c,'request\x20sent');_0x297519(_0x470fe2[_0x8721('0x19')]['message']);}})['catch'](function(_0xb01117){logger[_0x8721('0x15')](_0x8721('0x17'),_0x18415c,_0xb01117);_0x27fad4(_0xb01117);});});}exports[_0x8721('0x1a')]=function(_0x4cd135){var _0x1f4525=this;return new Promise(function(_0x394a34,_0x21c575){return db[_0x8721('0x1b')][_0x8721('0x1c')]({'raw':_0x4cd135['options']?_0x4cd135[_0x8721('0x1d')][_0x8721('0x1e')]===undefined?!![]:![]:!![],'where':_0x4cd135[_0x8721('0x1d')]?_0x4cd135['options'][_0x8721('0x1f')]||null:null,'attributes':_0x4cd135[_0x8721('0x1d')]?_0x4cd135[_0x8721('0x1d')][_0x8721('0x20')]||null:null,'limit':_0x4cd135[_0x8721('0x1d')]?_0x4cd135[_0x8721('0x1d')]['limit']||null:null,'include':_0x4cd135[_0x8721('0x1d')]?_0x4cd135[_0x8721('0x1d')]['include']?_[_0x8721('0x21')](_0x4cd135[_0x8721('0x1d')][_0x8721('0x22')],function(_0x1f417f){return{'model':db[_0x1f417f[_0x8721('0x23')]],'as':_0x1f417f['as'],'attributes':_0x1f417f[_0x8721('0x20')],'include':_0x1f417f[_0x8721('0x22')]?_[_0x8721('0x21')](_0x1f417f[_0x8721('0x22')],function(_0xf229b4){return{'model':db[_0xf229b4[_0x8721('0x23')]],'as':_0xf229b4['as'],'attributes':_0xf229b4['attributes'],'include':_0xf229b4[_0x8721('0x22')]?_[_0x8721('0x21')](_0xf229b4[_0x8721('0x22')],function(_0x3465b7){return{'model':db[_0x3465b7['model']],'as':_0x3465b7['as'],'attributes':_0x3465b7[_0x8721('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8721('0x11')](function(_0x27d18d){logger[_0x8721('0x12')](_0x8721('0x1a'),_0x4cd135);logger[_0x8721('0x13')]('GetVoiceQueue',_0x4cd135,JSON[_0x8721('0x24')](_0x27d18d));_0x394a34(_0x27d18d);})[_0x8721('0x25')](function(_0xdad525){logger[_0x8721('0x15')](_0x8721('0x1a'),_0xdad525[_0x8721('0x18')],_0x4cd135);_0x21c575(_0x1f4525[_0x8721('0x15')](0x1f4,_0xdad525[_0x8721('0x18')]));});});};exports[_0x8721('0x26')]=function(_0x2fa635){var _0x1612f5=this;return new Promise(function(_0x4e27e4,_0x41b2bd){return db[_0x8721('0x1b')]['find']({'raw':_0x2fa635[_0x8721('0x1d')]?_0x2fa635['options']['raw']===undefined?!![]:![]:!![],'where':_0x2fa635[_0x8721('0x1d')]?_0x2fa635[_0x8721('0x1d')][_0x8721('0x1f')]||null:null,'attributes':_0x2fa635[_0x8721('0x1d')]?_0x2fa635[_0x8721('0x1d')][_0x8721('0x20')]||null:null,'include':_0x2fa635[_0x8721('0x1d')]?_0x2fa635[_0x8721('0x1d')]['include']?_[_0x8721('0x21')](_0x2fa635[_0x8721('0x1d')][_0x8721('0x22')],function(_0x4b0b7b){return{'model':db[_0x4b0b7b[_0x8721('0x23')]],'as':_0x4b0b7b['as'],'attributes':_0x4b0b7b['attributes'],'include':_0x4b0b7b['include']?_[_0x8721('0x21')](_0x4b0b7b[_0x8721('0x22')],function(_0x2c14df){return{'model':db[_0x2c14df[_0x8721('0x23')]],'as':_0x2c14df['as'],'attributes':_0x2c14df['attributes'],'include':_0x2c14df[_0x8721('0x22')]?_[_0x8721('0x21')](_0x2c14df[_0x8721('0x22')],function(_0xbe21b8){return{'model':db[_0xbe21b8[_0x8721('0x23')]],'as':_0xbe21b8['as'],'attributes':_0xbe21b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x8721('0x11')](function(_0x5cbf43){logger[_0x8721('0x12')](_0x8721('0x26'),_0x2fa635);logger[_0x8721('0x13')](_0x8721('0x26'),_0x2fa635,JSON['stringify'](_0x5cbf43));_0x4e27e4(_0x5cbf43);})[_0x8721('0x25')](function(_0x18484f){logger[_0x8721('0x15')](_0x8721('0x26'),_0x18484f['message'],_0x2fa635);_0x41b2bd(_0x1612f5['error'](0x1f4,_0x18484f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8dab64d..df38c62 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 _0x2342=['update','removeListener','register','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x361937,_0x5e46f7){var _0x4905a=function(_0x10123c){while(--_0x10123c){_0x361937['push'](_0x361937['shift']());}};_0x4905a(++_0x5e46f7);}(_0x2342,0x1c4));var _0x2234=function(_0x27fd5a,_0x3ce111){_0x27fd5a=_0x27fd5a-0x0;var _0x362f9a=_0x2342[_0x27fd5a];return _0x362f9a;};'use strict';var VoiceQueueEvents=require(_0x2234('0x0'));var events=[_0x2234('0x1'),_0x2234('0x2'),_0x2234('0x3')];function createListener(_0x4fe69c,_0x5ae55c){return function(_0x8d882f){_0x5ae55c['emit'](_0x4fe69c,_0x8d882f);};}function removeListener(_0x1d8553,_0x52f91b){return function(){VoiceQueueEvents[_0x2234('0x4')](_0x1d8553,_0x52f91b);};}exports[_0x2234('0x5')]=function(_0x51b192){for(var _0x449881=0x0,_0x205e11=events['length'];_0x449881<_0x205e11;_0x449881++){var _0x59d71b=events[_0x449881];var _0x91a6d9=createListener(_0x2234('0x6')+_0x59d71b,_0x51b192);VoiceQueueEvents['on'](_0x59d71b,_0x91a6d9);}}; \ No newline at end of file +var _0x943e=['voiceQueue:','./voiceQueue.events','save','emit','length'];(function(_0x350a01,_0x5ed763){var _0xc17c6b=function(_0x31aaec){while(--_0x31aaec){_0x350a01['push'](_0x350a01['shift']());}};_0xc17c6b(++_0x5ed763);}(_0x943e,0xb5));var _0xe943=function(_0x471452,_0x157074){_0x471452=_0x471452-0x0;var _0x1220ac=_0x943e[_0x471452];return _0x1220ac;};'use strict';var VoiceQueueEvents=require(_0xe943('0x0'));var events=[_0xe943('0x1'),'remove','update'];function createListener(_0x13ddd8,_0x523ccf){return function(_0x4a13b9){_0x523ccf[_0xe943('0x2')](_0x13ddd8,_0x4a13b9);};}function removeListener(_0x5085f2,_0x27febe){return function(){VoiceQueueEvents['removeListener'](_0x5085f2,_0x27febe);};}exports['register']=function(_0x5c1350){for(var _0x39b4d6=0x0,_0x462aaf=events[_0xe943('0x3')];_0x39b4d6<_0x462aaf;_0x39b4d6++){var _0x33974d=events[_0x39b4d6];var _0xf2ced2=createListener(_0xe943('0x4')+_0x33974d,_0x5c1350);VoiceQueueEvents['on'](_0x33974d,_0xf2ced2);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index bbec0f4..16b26af 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 _0xe441=['post','create','/:id','update','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport'];(function(_0x41f682,_0x167520){var _0x13f69c=function(_0x469f2e){while(--_0x469f2e){_0x41f682['push'](_0x41f682['shift']());}};_0x13f69c(++_0x167520);}(_0xe441,0x110));var _0x1e44=function(_0x205ff8,_0x4a84df){_0x205ff8=_0x205ff8-0x0;var _0x3c302c=_0xe441[_0x205ff8];return _0x3c302c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e44('0x0'));var timeout=require(_0x1e44('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e44('0x2'));var auth=require(_0x1e44('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1e44('0x4'));var controller=require(_0x1e44('0x5'));router[_0x1e44('0x6')]('/',auth[_0x1e44('0x7')](),controller[_0x1e44('0x8')]);router[_0x1e44('0x6')](_0x1e44('0x9'),auth[_0x1e44('0x7')](),controller[_0x1e44('0xa')]);router[_0x1e44('0x6')](_0x1e44('0xb'),auth[_0x1e44('0x7')](),controller[_0x1e44('0xc')]);router[_0x1e44('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1e44('0xd')]('/',auth['isAuthenticated'](),controller[_0x1e44('0xe')]);router['put'](_0x1e44('0xf'),auth['isAuthenticated'](),controller[_0x1e44('0x10')]);router['delete'](_0x1e44('0xf'),auth['isAuthenticated'](),controller[_0x1e44('0x11')]);module[_0x1e44('0x12')]=router; \ No newline at end of file +var _0xf980=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','put','update','delete','destroy','util','Router','fs-extra'];(function(_0x3dbd97,_0x5a0738){var _0x44f649=function(_0x2e5498){while(--_0x2e5498){_0x3dbd97['push'](_0x3dbd97['shift']());}};_0x44f649(++_0x5a0738);}(_0xf980,0x96));var _0x0f98=function(_0x3babb2,_0x4e832d){_0x3babb2=_0x3babb2-0x0;var _0x43e8fd=_0xf980[_0x3babb2];return _0x43e8fd;};'use strict';var multer=require('multer');var util=require(_0x0f98('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0f98('0x1')]();var fs_extra=require(_0x0f98('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f98('0x3'));var controller=require(_0x0f98('0x4'));router[_0x0f98('0x5')]('/',auth[_0x0f98('0x6')](),controller['index']);router['get'](_0x0f98('0x7'),auth[_0x0f98('0x6')](),controller[_0x0f98('0x8')]);router[_0x0f98('0x5')](_0x0f98('0x9'),auth[_0x0f98('0x6')](),controller[_0x0f98('0xa')]);router[_0x0f98('0x5')](_0x0f98('0xb'),auth[_0x0f98('0x6')](),controller[_0x0f98('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0f98('0xd')](_0x0f98('0xb'),auth[_0x0f98('0x6')](),controller[_0x0f98('0xe')]);router[_0x0f98('0xf')](_0x0f98('0xb'),auth['isAuthenticated'](),controller[_0x0f98('0x10')]);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 fe8dc8f..d0e9216 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 _0x8636=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x272abb,_0x26f0f0){var _0x4b70fd=function(_0x18a196){while(--_0x18a196){_0x272abb['push'](_0x272abb['shift']());}};_0x4b70fd(++_0x26f0f0);}(_0x8636,0x190));var _0x6863=function(_0x4baf82,_0x4e05f3){_0x4baf82=_0x4baf82-0x0;var _0x3985bd=_0x8636[_0x4baf82];return _0x3985bd;};'use strict';var Sequelize=require(_0x6863('0x0'));var moment=require(_0x6863('0x1'));module[_0x6863('0x2')]={'type':{'type':Sequelize[_0x6863('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6863('0x3')]},'queue':{'type':Sequelize[_0x6863('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6863('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6863('0x4')],'set':function(_0x4debd8){var _0x554ff6=moment(_0x4debd8);var _0x1a2f9c=moment(this[_0x6863('0x5')](_0x6863('0x6')))[_0x6863('0x7')](_0x6863('0x8'));var _0x1fe330=_0x554ff6['diff'](_0x1a2f9c,'seconds');this['setDataValue']('queuecallerleaveAt',_0x4debd8);this[_0x6863('0x9')](_0x6863('0xa'),_0x1fe330||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x6863('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6863('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x6863('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6863('0x4')]},'queuecallerexit':{'type':Sequelize[_0x6863('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6863('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6863('0x3')],'comment':_0x6863('0xd')},'originalposition':{'type':Sequelize[_0x6863('0xb')]},'channel':{'type':Sequelize[_0x6863('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6863('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6863('0x3')]},'context':{'type':Sequelize[_0x6863('0x3')]},'exten':{'type':Sequelize[_0x6863('0x3')]},'priority':{'type':Sequelize[_0x6863('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x6863('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6863('0x3')]},'transfer':{'type':Sequelize[_0x6863('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x6863('0xe')},'transferexten':{'type':Sequelize[_0x6863('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6863('0x3')]},'disposition':{'type':Sequelize[_0x6863('0x3')]},'secondDisposition':{'type':Sequelize[_0x6863('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6863('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x6863('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa6c3=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x2c21fa,_0x5f0a10){var _0x5aafc6=function(_0x1eb171){while(--_0x1eb171){_0x2c21fa['push'](_0x2c21fa['shift']());}};_0x5aafc6(++_0x5f0a10);}(_0xa6c3,0x148));var _0x3a6c=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xa6c3[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0x3a6c('0x0'));var moment=require('moment');module[_0x3a6c('0x1')]={'type':{'type':Sequelize[_0x3a6c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a6c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3a6c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x3a6c('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x3a6c('0x3')],'set':function(_0x274c80){var _0x12111f=moment(_0x274c80);var _0x27ea0f=moment(this[_0x3a6c('0x4')](_0x3a6c('0x5')))[_0x3a6c('0x6')](_0x3a6c('0x7'));var _0xba66b5=_0x12111f[_0x3a6c('0x8')](_0x27ea0f,_0x3a6c('0x9'));this[_0x3a6c('0xa')](_0x3a6c('0xb'),_0x274c80);this[_0x3a6c('0xa')](_0x3a6c('0xc'),_0xba66b5||null);}},'position':{'type':Sequelize[_0x3a6c('0xd')]},'count':{'type':Sequelize[_0x3a6c('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3a6c('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x3a6c('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3a6c('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3a6c('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x3a6c('0x2')],'comment':_0x3a6c('0xf')},'originalposition':{'type':Sequelize[_0x3a6c('0xd')]},'channel':{'type':Sequelize[_0x3a6c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3a6c('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3a6c('0x2')]},'context':{'type':Sequelize[_0x3a6c('0x2')]},'exten':{'type':Sequelize[_0x3a6c('0x2')]},'priority':{'type':Sequelize[_0x3a6c('0x2')]},'holdtime':{'type':Sequelize[_0x3a6c('0xd')]},'mohtime':{'type':Sequelize[_0x3a6c('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3a6c('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3a6c('0x2')],'comment':_0x3a6c('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3a6c('0x2')]},'secondDisposition':{'type':Sequelize[_0x3a6c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3a6c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x3a6c('0xd')],'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 3463cfa..e89285b 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 _0x07c7=['../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','register','end','status','json','undefined','limit','count','offset','set','save','update','then','sendStatus','error','name','send','index','VoiceQueueReport','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rawAttributes','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1d69bc,_0x3fb317){var _0x1482ae=function(_0x23519f){while(--_0x23519f){_0x1d69bc['push'](_0x1d69bc['shift']());}};_0x1482ae(++_0x3fb317);}(_0x07c7,0x12a));var _0x707c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x07c7[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x707c('0x0'));var rimraf=require(_0x707c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x707c('0x2'));var rp=require(_0x707c('0x3'));var moment=require(_0x707c('0x4'));var BPromise=require(_0x707c('0x5'));var Mustache=require(_0x707c('0x6'));var util=require(_0x707c('0x7'));var path=require(_0x707c('0x8'));var sox=require(_0x707c('0x9'));var csv=require(_0x707c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x707c('0xb'));var _=require(_0x707c('0xc'));var squel=require(_0x707c('0xd'));var crypto=require(_0x707c('0xe'));var jsforce=require(_0x707c('0xf'));var deskjs=require(_0x707c('0x10'));var toCsv=require(_0x707c('0xa'));var querystring=require('querystring');var Papa=require(_0x707c('0x11'));var Redis=require(_0x707c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x707c('0x13'));var as=require(_0x707c('0x14'));var hardwareService=require(_0x707c('0x15'));var logger=require(_0x707c('0x16'))(_0x707c('0x17'));var utils=require(_0x707c('0x18'));var config=require(_0x707c('0x19'));var licenseUtil=require(_0x707c('0x1a'));var db=require(_0x707c('0x1b'))['db'];config['redis']=_['defaults'](config[_0x707c('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x707c('0x1d'))(new Redis(config[_0x707c('0x1c')]));require(_0x707c('0x1e'))[_0x707c('0x1f')](socket);function respondWithStatusCode(_0x500859,_0x2211bc){_0x2211bc=_0x2211bc||0xcc;return function(_0x76f042){if(_0x76f042){return _0x500859['sendStatus'](_0x2211bc);}return _0x500859['status'](_0x2211bc)[_0x707c('0x20')]();};}function respondWithResult(_0x38de0c,_0x59e55f){_0x59e55f=_0x59e55f||0xc8;return function(_0x4aaf4f){if(_0x4aaf4f){return _0x38de0c[_0x707c('0x21')](_0x59e55f)[_0x707c('0x22')](_0x4aaf4f);}};}function respondWithFilteredResult(_0x47a792,_0x32bba4){return function(_0x4d01b9){if(_0x4d01b9){var _0x22a84d=typeof _0x32bba4['offset']===_0x707c('0x23')&&typeof _0x32bba4[_0x707c('0x24')]===_0x707c('0x23');var _0x321096=_0x4d01b9[_0x707c('0x25')];var _0x552f65=_0x22a84d?0x0:_0x32bba4[_0x707c('0x26')];var _0x3a99c5=_0x22a84d?_0x4d01b9['count']:_0x32bba4[_0x707c('0x26')]+_0x32bba4[_0x707c('0x24')];var _0x3d82bb;if(_0x3a99c5>=_0x321096){_0x3a99c5=_0x321096;_0x3d82bb=0xc8;}else{_0x3d82bb=0xce;}_0x47a792[_0x707c('0x21')](_0x3d82bb);return _0x47a792[_0x707c('0x27')]('Content-Range',_0x552f65+'-'+_0x3a99c5+'/'+_0x321096)[_0x707c('0x22')](_0x4d01b9);}return null;};}function patchUpdates(_0x1cd32f){return function(_0x15a180){try{jsonpatch['apply'](_0x15a180,_0x1cd32f,!![]);}catch(_0x5e2191){return BPromise['reject'](_0x5e2191);}return _0x15a180[_0x707c('0x28')]();};}function saveUpdates(_0x480df0,_0x4f749c){return function(_0x46bce1){if(_0x46bce1){return _0x46bce1[_0x707c('0x29')](_0x480df0)[_0x707c('0x2a')](function(_0x3b9f92){return _0x3b9f92;});}return null;};}function removeEntity(_0xe01f1c,_0x58957e){return function(_0x7d61df){if(_0x7d61df){return _0x7d61df['destroy']()[_0x707c('0x2a')](function(){_0xe01f1c[_0x707c('0x21')](0xcc)[_0x707c('0x20')]();});}};}function handleEntityNotFound(_0x42003f,_0x3b5885){return function(_0x148ab5){if(!_0x148ab5){_0x42003f[_0x707c('0x2b')](0x194);}return _0x148ab5;};}function handleError(_0x5988d7,_0x4607c8){_0x4607c8=_0x4607c8||0x1f4;return function(_0x3b4dac){logger[_0x707c('0x2c')](_0x3b4dac['stack']);if(_0x3b4dac['name']){delete _0x3b4dac[_0x707c('0x2d')];}_0x5988d7[_0x707c('0x21')](_0x4607c8)[_0x707c('0x2e')](_0x3b4dac);};}exports[_0x707c('0x2f')]=function(_0x581592,_0x376571){var _0x5cecc5={},_0x4ab6e1={},_0x5368c9={'count':0x0,'rows':[]};var _0x1cb44c=_['map'](db[_0x707c('0x30')]['rawAttributes'],function(_0x342014){return{'name':_0x342014[_0x707c('0x31')],'type':_0x342014[_0x707c('0x32')]['key']};});_0x4ab6e1[_0x707c('0x33')]=_[_0x707c('0x34')](_0x1cb44c,_0x707c('0x2d'));_0x4ab6e1[_0x707c('0x35')]=_[_0x707c('0x36')](_0x581592[_0x707c('0x35')]);_0x4ab6e1[_0x707c('0x37')]=_[_0x707c('0x38')](_0x4ab6e1[_0x707c('0x33')],_0x4ab6e1['query']);_0x5cecc5[_0x707c('0x39')]=_[_0x707c('0x38')](_0x4ab6e1['model'],qs[_0x707c('0x3a')](_0x581592[_0x707c('0x35')][_0x707c('0x3a')]));_0x5cecc5[_0x707c('0x39')]=_0x5cecc5[_0x707c('0x39')][_0x707c('0x3b')]?_0x5cecc5[_0x707c('0x39')]:_0x4ab6e1['model'];if(!_0x581592['query'][_0x707c('0x3c')](_0x707c('0x3d'))){_0x5cecc5[_0x707c('0x24')]=qs[_0x707c('0x24')](_0x581592[_0x707c('0x35')][_0x707c('0x24')]);_0x5cecc5[_0x707c('0x26')]=qs[_0x707c('0x26')](_0x581592[_0x707c('0x35')][_0x707c('0x26')]);}_0x5cecc5[_0x707c('0x3e')]=qs['sort'](_0x581592[_0x707c('0x35')][_0x707c('0x3f')]);_0x5cecc5['where']=qs['filters'](_['pick'](_0x581592[_0x707c('0x35')],_0x4ab6e1[_0x707c('0x37')]),_0x1cb44c);if(_0x581592[_0x707c('0x35')]['filter']){_0x5cecc5[_0x707c('0x40')]=_['merge'](_0x5cecc5[_0x707c('0x40')],{'$or':_[_0x707c('0x34')](_0x1cb44c,function(_0x4da5dc){if(_0x4da5dc[_0x707c('0x32')]!=='VIRTUAL'){var _0x33f099={};_0x33f099[_0x4da5dc[_0x707c('0x2d')]]={'$like':'%'+_0x581592[_0x707c('0x35')][_0x707c('0x41')]+'%'};return _0x33f099;}})});}_0x5cecc5=_[_0x707c('0x42')]({},_0x5cecc5,_0x581592[_0x707c('0x43')]);var _0xab429={'where':_0x5cecc5[_0x707c('0x40')]};return db[_0x707c('0x30')][_0x707c('0x25')](_0xab429)[_0x707c('0x2a')](function(_0x2c01fd){_0x5368c9[_0x707c('0x25')]=_0x2c01fd;if(_0x581592[_0x707c('0x35')][_0x707c('0x44')]){_0x5cecc5[_0x707c('0x45')]=[{'all':!![]}];}return db[_0x707c('0x30')][_0x707c('0x46')](_0x5cecc5);})[_0x707c('0x2a')](function(_0xe242c3){_0x5368c9[_0x707c('0x47')]=_0xe242c3;return _0x5368c9;})[_0x707c('0x2a')](respondWithFilteredResult(_0x376571,_0x5cecc5))[_0x707c('0x48')](handleError(_0x376571,null));};exports[_0x707c('0x49')]=function(_0x286253,_0x4e9b66){var _0x2ff968={'raw':![],'where':{'id':_0x286253[_0x707c('0x4a')]['id']}},_0x394819={};_0x394819[_0x707c('0x33')]=_['keys'](db[_0x707c('0x30')]['rawAttributes']);_0x394819[_0x707c('0x35')]=_[_0x707c('0x36')](_0x286253[_0x707c('0x35')]);_0x394819[_0x707c('0x37')]=_[_0x707c('0x38')](_0x394819[_0x707c('0x33')],_0x394819['query']);_0x2ff968[_0x707c('0x39')]=_['intersection'](_0x394819['model'],qs[_0x707c('0x3a')](_0x286253[_0x707c('0x35')][_0x707c('0x3a')]));_0x2ff968[_0x707c('0x39')]=_0x2ff968[_0x707c('0x39')]['length']?_0x2ff968[_0x707c('0x39')]:_0x394819[_0x707c('0x33')];if(_0x286253[_0x707c('0x35')]['includeAll']){_0x2ff968[_0x707c('0x45')]=[{'all':!![]}];}_0x2ff968=_[_0x707c('0x42')]({},_0x2ff968,_0x286253[_0x707c('0x43')]);return db[_0x707c('0x30')][_0x707c('0x4b')](_0x2ff968)[_0x707c('0x2a')](handleEntityNotFound(_0x4e9b66,null))['then'](respondWithResult(_0x4e9b66,null))[_0x707c('0x48')](handleError(_0x4e9b66,null));};exports[_0x707c('0x4c')]=function(_0x919493,_0x195cc2){return db[_0x707c('0x30')][_0x707c('0x4c')](_0x919493['body'],{})[_0x707c('0x2a')](respondWithResult(_0x195cc2,0xc9))[_0x707c('0x48')](handleError(_0x195cc2,null));};exports[_0x707c('0x29')]=function(_0x544338,_0x1d55a5){if(_0x544338[_0x707c('0x4d')]['id']){delete _0x544338['body']['id'];}return db['VoiceQueueReport'][_0x707c('0x4b')]({'where':{'id':_0x544338['params']['id']}})['then'](handleEntityNotFound(_0x1d55a5,null))[_0x707c('0x2a')](saveUpdates(_0x544338[_0x707c('0x4d')],null))[_0x707c('0x2a')](respondWithResult(_0x1d55a5,null))['catch'](handleError(_0x1d55a5,null));};exports['destroy']=function(_0x1e5a7f,_0x27edcf){return db[_0x707c('0x30')][_0x707c('0x4b')]({'where':{'id':_0x1e5a7f[_0x707c('0x4a')]['id']}})[_0x707c('0x2a')](handleEntityNotFound(_0x27edcf,null))[_0x707c('0x2a')](removeEntity(_0x27edcf,null))[_0x707c('0x48')](handleError(_0x27edcf,null));};exports[_0x707c('0x4e')]=function(_0x374c53,_0x15a941){return db['VoiceQueueReport'][_0x707c('0x4e')]()['then'](respondWithResult(_0x15a941,null))[_0x707c('0x48')](handleError(_0x15a941,null));};exports['getVoiceQueuesReport']=function(_0x35a598,_0x2a8256){var _0x5179f2={},_0x37b5ad={},_0x1ff0ed={'count':0x0,'rows':[]};_0x37b5ad[_0x707c('0x33')]=_[_0x707c('0x36')](db['VoiceQueueReport'][_0x707c('0x4f')]);_0x37b5ad[_0x707c('0x35')]=_['keys'](_0x35a598[_0x707c('0x35')]);_0x37b5ad[_0x707c('0x37')]=_[_0x707c('0x38')](_0x37b5ad[_0x707c('0x33')],_0x37b5ad[_0x707c('0x35')]);_0x5179f2[_0x707c('0x39')]=_[_0x707c('0x38')](_0x37b5ad[_0x707c('0x33')],qs['fields'](_0x35a598[_0x707c('0x35')][_0x707c('0x3a')]));_0x5179f2['attributes']=_0x5179f2['attributes'][_0x707c('0x3b')]?_0x5179f2[_0x707c('0x39')]:_0x37b5ad[_0x707c('0x33')];if(!_0x35a598['query'][_0x707c('0x3c')](_0x707c('0x3d'))){_0x5179f2[_0x707c('0x24')]=qs['limit'](_0x35a598['query'][_0x707c('0x24')]);_0x5179f2[_0x707c('0x26')]=qs[_0x707c('0x26')](_0x35a598[_0x707c('0x35')][_0x707c('0x26')]);}_0x5179f2[_0x707c('0x3e')]=qs[_0x707c('0x3f')](_0x35a598['query'][_0x707c('0x3f')]);_0x5179f2[_0x707c('0x40')]=qs['filters'](_['pick'](_0x35a598[_0x707c('0x35')],_0x37b5ad['filters']));if(_0x35a598[_0x707c('0x35')][_0x707c('0x41')]){_0x5179f2[_0x707c('0x40')]=_[_0x707c('0x42')](_0x5179f2['where'],{'$or':_[_0x707c('0x34')](_0x5179f2[_0x707c('0x39')],function(_0x22b7e8){var _0xd427a7={};_0xd427a7[_0x22b7e8]={'$like':'%'+_0x35a598[_0x707c('0x35')][_0x707c('0x41')]+'%'};return _0xd427a7;})});}_0x5179f2=_[_0x707c('0x42')]({},_0x5179f2,_0x35a598[_0x707c('0x43')]);var _0x10ae9e={'where':_0x5179f2[_0x707c('0x40')]};return db['VoiceQueueReport'][_0x707c('0x25')](_0x10ae9e)[_0x707c('0x2a')](function(_0x566d15){_0x1ff0ed[_0x707c('0x25')]=_0x566d15;if(_0x35a598[_0x707c('0x35')][_0x707c('0x44')]){_0x5179f2[_0x707c('0x45')]=[{'all':!![]}];}return db[_0x707c('0x30')][_0x707c('0x46')](_0x5179f2);})[_0x707c('0x2a')](function(_0x3ebda7){_0x1ff0ed['rows']=_0x3ebda7;return _0x1ff0ed;})[_0x707c('0x2a')](respondWithFilteredResult(_0x2a8256,_0x5179f2,_0x707c('0x50')))[_0x707c('0x48')](handleError(_0x2a8256,null,_0x707c('0x50')));}; \ No newline at end of file +var _0x2b65=['rimraf','zip-dir','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','end','json','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','VoiceQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','find','getVoiceQueuesReport','findAll','eml-format'];(function(_0x25bba0,_0x4bd142){var _0x3da505=function(_0x395d93){while(--_0x395d93){_0x25bba0['push'](_0x25bba0['shift']());}};_0x3da505(++_0x4bd142);}(_0x2b65,0x153));var _0x52b6=function(_0x12a04a,_0x4e3d1a){_0x12a04a=_0x12a04a-0x0;var _0x6d5409=_0x2b65[_0x12a04a];return _0x6d5409;};'use strict';var emlformat=require(_0x52b6('0x0'));var rimraf=require(_0x52b6('0x1'));var zipdir=require(_0x52b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x52b6('0x3'));var BPromise=require(_0x52b6('0x4'));var Mustache=require(_0x52b6('0x5'));var util=require(_0x52b6('0x6'));var path=require('path');var sox=require(_0x52b6('0x7'));var csv=require(_0x52b6('0x8'));var ejs=require(_0x52b6('0x9'));var fs=require('fs');var fs_extra=require(_0x52b6('0xa'));var _=require(_0x52b6('0xb'));var squel=require(_0x52b6('0xc'));var crypto=require(_0x52b6('0xd'));var jsforce=require(_0x52b6('0xe'));var deskjs=require(_0x52b6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x52b6('0x10'));var Papa=require(_0x52b6('0x11'));var Redis=require(_0x52b6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x52b6('0x13'));var as=require(_0x52b6('0x14'));var hardwareService=require(_0x52b6('0x15'));var logger=require(_0x52b6('0x16'))(_0x52b6('0x17'));var utils=require(_0x52b6('0x18'));var config=require(_0x52b6('0x19'));var licenseUtil=require(_0x52b6('0x1a'));var db=require(_0x52b6('0x1b'))['db'];config[_0x52b6('0x1c')]=_[_0x52b6('0x1d')](config[_0x52b6('0x1c')],{'host':_0x52b6('0x1e'),'port':0x18eb});var socket=require(_0x52b6('0x1f'))(new Redis(config[_0x52b6('0x1c')]));require(_0x52b6('0x20'))['register'](socket);function respondWithStatusCode(_0x13dd3e,_0x5eb513){_0x5eb513=_0x5eb513||0xcc;return function(_0x56f186){if(_0x56f186){return _0x13dd3e['sendStatus'](_0x5eb513);}return _0x13dd3e['status'](_0x5eb513)[_0x52b6('0x21')]();};}function respondWithResult(_0x1b439d,_0x1615c7){_0x1615c7=_0x1615c7||0xc8;return function(_0x3fd7e0){if(_0x3fd7e0){return _0x1b439d['status'](_0x1615c7)[_0x52b6('0x22')](_0x3fd7e0);}};}function respondWithFilteredResult(_0x291a60,_0x21c53d){return function(_0xd8298){if(_0xd8298){var _0x5c367d=typeof _0x21c53d['offset']==='undefined'&&typeof _0x21c53d[_0x52b6('0x23')]==='undefined';var _0x56fb0c=_0xd8298[_0x52b6('0x24')];var _0x407508=_0x5c367d?0x0:_0x21c53d[_0x52b6('0x25')];var _0xa4f966=_0x5c367d?_0xd8298['count']:_0x21c53d['offset']+_0x21c53d['limit'];var _0x2775da;if(_0xa4f966>=_0x56fb0c){_0xa4f966=_0x56fb0c;_0x2775da=0xc8;}else{_0x2775da=0xce;}_0x291a60[_0x52b6('0x26')](_0x2775da);return _0x291a60[_0x52b6('0x27')](_0x52b6('0x28'),_0x407508+'-'+_0xa4f966+'/'+_0x56fb0c)['json'](_0xd8298);}return null;};}function patchUpdates(_0x328649){return function(_0x1bea7e){try{jsonpatch[_0x52b6('0x29')](_0x1bea7e,_0x328649,!![]);}catch(_0x31b634){return BPromise[_0x52b6('0x2a')](_0x31b634);}return _0x1bea7e[_0x52b6('0x2b')]();};}function saveUpdates(_0x11a07b,_0x2ed88b){return function(_0x34121c){if(_0x34121c){return _0x34121c[_0x52b6('0x2c')](_0x11a07b)[_0x52b6('0x2d')](function(_0x18409a){return _0x18409a;});}return null;};}function removeEntity(_0x576908,_0x3b754a){return function(_0x15b124){if(_0x15b124){return _0x15b124[_0x52b6('0x2e')]()[_0x52b6('0x2d')](function(){_0x576908[_0x52b6('0x26')](0xcc)[_0x52b6('0x21')]();});}};}function handleEntityNotFound(_0x433a99,_0x5f2630){return function(_0x1b7aa3){if(!_0x1b7aa3){_0x433a99[_0x52b6('0x2f')](0x194);}return _0x1b7aa3;};}function handleError(_0x4bd6c6,_0x440f8b){_0x440f8b=_0x440f8b||0x1f4;return function(_0x41fed3){logger[_0x52b6('0x30')](_0x41fed3['stack']);if(_0x41fed3[_0x52b6('0x31')]){delete _0x41fed3[_0x52b6('0x31')];}_0x4bd6c6[_0x52b6('0x26')](_0x440f8b)[_0x52b6('0x32')](_0x41fed3);};}exports['index']=function(_0x1d654e,_0x28b244){var _0x19e9e6={},_0x50ec98={},_0x2bd5a2={'count':0x0,'rows':[]};var _0x202064=_['map'](db[_0x52b6('0x33')]['rawAttributes'],function(_0x4994d7){return{'name':_0x4994d7[_0x52b6('0x34')],'type':_0x4994d7[_0x52b6('0x35')][_0x52b6('0x36')]};});_0x50ec98[_0x52b6('0x37')]=_['map'](_0x202064,_0x52b6('0x31'));_0x50ec98[_0x52b6('0x38')]=_[_0x52b6('0x39')](_0x1d654e[_0x52b6('0x38')]);_0x50ec98[_0x52b6('0x3a')]=_['intersection'](_0x50ec98[_0x52b6('0x37')],_0x50ec98[_0x52b6('0x38')]);_0x19e9e6[_0x52b6('0x3b')]=_[_0x52b6('0x3c')](_0x50ec98[_0x52b6('0x37')],qs['fields'](_0x1d654e[_0x52b6('0x38')][_0x52b6('0x3d')]));_0x19e9e6[_0x52b6('0x3b')]=_0x19e9e6[_0x52b6('0x3b')]['length']?_0x19e9e6['attributes']:_0x50ec98[_0x52b6('0x37')];if(!_0x1d654e[_0x52b6('0x38')]['hasOwnProperty'](_0x52b6('0x3e'))){_0x19e9e6[_0x52b6('0x23')]=qs[_0x52b6('0x23')](_0x1d654e[_0x52b6('0x38')]['limit']);_0x19e9e6[_0x52b6('0x25')]=qs[_0x52b6('0x25')](_0x1d654e[_0x52b6('0x38')][_0x52b6('0x25')]);}_0x19e9e6[_0x52b6('0x3f')]=qs[_0x52b6('0x40')](_0x1d654e[_0x52b6('0x38')]['sort']);_0x19e9e6[_0x52b6('0x41')]=qs['filters'](_[_0x52b6('0x42')](_0x1d654e[_0x52b6('0x38')],_0x50ec98[_0x52b6('0x3a')]),_0x202064);if(_0x1d654e[_0x52b6('0x38')][_0x52b6('0x43')]){_0x19e9e6['where']=_[_0x52b6('0x44')](_0x19e9e6[_0x52b6('0x41')],{'$or':_[_0x52b6('0x45')](_0x202064,function(_0x32fbee){if(_0x32fbee['type']!==_0x52b6('0x46')){var _0x526820={};_0x526820[_0x32fbee[_0x52b6('0x31')]]={'$like':'%'+_0x1d654e['query'][_0x52b6('0x43')]+'%'};return _0x526820;}})});}_0x19e9e6=_[_0x52b6('0x44')]({},_0x19e9e6,_0x1d654e[_0x52b6('0x47')]);var _0x57de22={'where':_0x19e9e6[_0x52b6('0x41')]};return db['VoiceQueueReport'][_0x52b6('0x24')](_0x57de22)[_0x52b6('0x2d')](function(_0x5a311c){_0x2bd5a2[_0x52b6('0x24')]=_0x5a311c;if(_0x1d654e[_0x52b6('0x38')][_0x52b6('0x48')]){_0x19e9e6[_0x52b6('0x49')]=[{'all':!![]}];}return db[_0x52b6('0x33')]['findAll'](_0x19e9e6);})[_0x52b6('0x2d')](function(_0x254174){_0x2bd5a2[_0x52b6('0x4a')]=_0x254174;return _0x2bd5a2;})[_0x52b6('0x2d')](respondWithFilteredResult(_0x28b244,_0x19e9e6))['catch'](handleError(_0x28b244,null));};exports[_0x52b6('0x4b')]=function(_0x1c23c0,_0x2aa238){var _0x117057={'raw':![],'where':{'id':_0x1c23c0[_0x52b6('0x4c')]['id']}},_0x2e8422={};_0x2e8422['model']=_[_0x52b6('0x39')](db['VoiceQueueReport'][_0x52b6('0x4d')]);_0x2e8422['query']=_[_0x52b6('0x39')](_0x1c23c0[_0x52b6('0x38')]);_0x2e8422[_0x52b6('0x3a')]=_[_0x52b6('0x3c')](_0x2e8422['model'],_0x2e8422[_0x52b6('0x38')]);_0x117057['attributes']=_['intersection'](_0x2e8422[_0x52b6('0x37')],qs['fields'](_0x1c23c0['query'][_0x52b6('0x3d')]));_0x117057['attributes']=_0x117057[_0x52b6('0x3b')][_0x52b6('0x4e')]?_0x117057[_0x52b6('0x3b')]:_0x2e8422[_0x52b6('0x37')];if(_0x1c23c0['query']['includeAll']){_0x117057[_0x52b6('0x49')]=[{'all':!![]}];}_0x117057=_[_0x52b6('0x44')]({},_0x117057,_0x1c23c0[_0x52b6('0x47')]);return db['VoiceQueueReport']['find'](_0x117057)[_0x52b6('0x2d')](handleEntityNotFound(_0x2aa238,null))[_0x52b6('0x2d')](respondWithResult(_0x2aa238,null))[_0x52b6('0x4f')](handleError(_0x2aa238,null));};exports[_0x52b6('0x50')]=function(_0x3669f6,_0x596434){return db['VoiceQueueReport'][_0x52b6('0x50')](_0x3669f6[_0x52b6('0x51')],{})[_0x52b6('0x2d')](respondWithResult(_0x596434,0xc9))[_0x52b6('0x4f')](handleError(_0x596434,null));};exports[_0x52b6('0x2c')]=function(_0x5559cd,_0x37fd5e){if(_0x5559cd['body']['id']){delete _0x5559cd[_0x52b6('0x51')]['id'];}return db[_0x52b6('0x33')][_0x52b6('0x52')]({'where':{'id':_0x5559cd[_0x52b6('0x4c')]['id']}})[_0x52b6('0x2d')](handleEntityNotFound(_0x37fd5e,null))['then'](saveUpdates(_0x5559cd[_0x52b6('0x51')],null))[_0x52b6('0x2d')](respondWithResult(_0x37fd5e,null))[_0x52b6('0x4f')](handleError(_0x37fd5e,null));};exports[_0x52b6('0x2e')]=function(_0x1b7866,_0x19263d){return db[_0x52b6('0x33')]['find']({'where':{'id':_0x1b7866['params']['id']}})[_0x52b6('0x2d')](handleEntityNotFound(_0x19263d,null))[_0x52b6('0x2d')](removeEntity(_0x19263d,null))['catch'](handleError(_0x19263d,null));};exports['describe']=function(_0x4f4453,_0x36bc9e){return db[_0x52b6('0x33')]['describe']()['then'](respondWithResult(_0x36bc9e,null))[_0x52b6('0x4f')](handleError(_0x36bc9e,null));};exports[_0x52b6('0x53')]=function(_0x2d3881,_0x41e85b){var _0x44730e={},_0x4a0822={},_0x1ee64d={'count':0x0,'rows':[]};_0x4a0822[_0x52b6('0x37')]=_[_0x52b6('0x39')](db[_0x52b6('0x33')][_0x52b6('0x4d')]);_0x4a0822[_0x52b6('0x38')]=_[_0x52b6('0x39')](_0x2d3881[_0x52b6('0x38')]);_0x4a0822['filters']=_[_0x52b6('0x3c')](_0x4a0822[_0x52b6('0x37')],_0x4a0822[_0x52b6('0x38')]);_0x44730e['attributes']=_[_0x52b6('0x3c')](_0x4a0822[_0x52b6('0x37')],qs[_0x52b6('0x3d')](_0x2d3881[_0x52b6('0x38')][_0x52b6('0x3d')]));_0x44730e[_0x52b6('0x3b')]=_0x44730e[_0x52b6('0x3b')]['length']?_0x44730e[_0x52b6('0x3b')]:_0x4a0822[_0x52b6('0x37')];if(!_0x2d3881[_0x52b6('0x38')]['hasOwnProperty'](_0x52b6('0x3e'))){_0x44730e[_0x52b6('0x23')]=qs[_0x52b6('0x23')](_0x2d3881[_0x52b6('0x38')][_0x52b6('0x23')]);_0x44730e['offset']=qs[_0x52b6('0x25')](_0x2d3881[_0x52b6('0x38')][_0x52b6('0x25')]);}_0x44730e[_0x52b6('0x3f')]=qs[_0x52b6('0x40')](_0x2d3881[_0x52b6('0x38')]['sort']);_0x44730e[_0x52b6('0x41')]=qs[_0x52b6('0x3a')](_[_0x52b6('0x42')](_0x2d3881[_0x52b6('0x38')],_0x4a0822[_0x52b6('0x3a')]));if(_0x2d3881[_0x52b6('0x38')][_0x52b6('0x43')]){_0x44730e['where']=_['merge'](_0x44730e[_0x52b6('0x41')],{'$or':_[_0x52b6('0x45')](_0x44730e[_0x52b6('0x3b')],function(_0x28d0c2){var _0x51ebe0={};_0x51ebe0[_0x28d0c2]={'$like':'%'+_0x2d3881[_0x52b6('0x38')][_0x52b6('0x43')]+'%'};return _0x51ebe0;})});}_0x44730e=_[_0x52b6('0x44')]({},_0x44730e,_0x2d3881['options']);var _0x472152={'where':_0x44730e[_0x52b6('0x41')]};return db[_0x52b6('0x33')][_0x52b6('0x24')](_0x472152)[_0x52b6('0x2d')](function(_0x263727){_0x1ee64d[_0x52b6('0x24')]=_0x263727;if(_0x2d3881[_0x52b6('0x38')][_0x52b6('0x48')]){_0x44730e[_0x52b6('0x49')]=[{'all':!![]}];}return db[_0x52b6('0x33')][_0x52b6('0x54')](_0x44730e);})[_0x52b6('0x2d')](function(_0x55267a){_0x1ee64d[_0x52b6('0x4a')]=_0x55267a;return _0x1ee64d;})[_0x52b6('0x2d')](respondWithFilteredResult(_0x41e85b,_0x44730e,_0x52b6('0x53')))['catch'](handleError(_0x41e85b,null,_0x52b6('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index fd68c2f..b62e041 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 _0xfbd1=['VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xfbd1,0x1a7));var _0x1fbd=function(_0x330939,_0x52dac5){_0x330939=_0x330939-0x0;var _0x4b5b43=_0xfbd1[_0x330939];return _0x4b5b43;};'use strict';var EventEmitter=require(_0x1fbd('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x1fbd('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1fbd('0x2')](0x0);var events={'afterCreate':_0x1fbd('0x3'),'afterUpdate':_0x1fbd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x7311a){return function(_0x16fbab,_0x372365,_0x412b11){VoiceQueueReportEvents[_0x1fbd('0x5')](_0x7311a+':'+_0x16fbab['id'],_0x16fbab);VoiceQueueReportEvents[_0x1fbd('0x5')](_0x7311a,_0x16fbab);_0x412b11(null);};}for(var e in events){if(events[_0x1fbd('0x6')](e)){var event=events[e];VoiceQueueReport[_0x1fbd('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x3118=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0x3118,0x1bb));var _0x8311=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x3118[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0x8311('0x0'));var VoiceQueueReport=require(_0x8311('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8311('0x2')](0x0);var events={'afterCreate':_0x8311('0x3'),'afterUpdate':'update','afterDestroy':_0x8311('0x4')};function emitEvent(_0x170a9c){return function(_0x1c0250,_0x4c3d72,_0x420792){VoiceQueueReportEvents[_0x8311('0x5')](_0x170a9c+':'+_0x1c0250['id'],_0x1c0250);VoiceQueueReportEvents[_0x8311('0x5')](_0x170a9c,_0x1c0250);_0x420792(null);};}for(var e in events){if(events[_0x8311('0x6')](e)){var event=events[e];VoiceQueueReport[_0x8311('0x7')](e,emitEvent(event));}}module[_0x8311('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c405a7a..59deb9a 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 _0xf498=['api','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','util','../../config/logger'];(function(_0x2c8265,_0x328583){var _0x1246ed=function(_0x51a26d){while(--_0x51a26d){_0x2c8265['push'](_0x2c8265['shift']());}};_0x1246ed(++_0x328583);}(_0xf498,0x16a));var _0x8f49=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xf498[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require(_0x8f49('0x0'));var logger=require(_0x8f49('0x1'))(_0x8f49('0x2'));var moment=require('moment');var BPromise=require(_0x8f49('0x3'));var rp=require(_0x8f49('0x4'));var fs=require('fs');var path=require(_0x8f49('0x5'));var rimraf=require('rimraf');var config=require(_0x8f49('0x6'));var attributes=require(_0x8f49('0x7'));module[_0x8f49('0x8')]=function(_0x51145e,_0x4ef60f){return _0x51145e[_0x8f49('0x9')](_0x8f49('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x8f49('0xb')]},{'fields':[_0x8f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69cd=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0x69cd,0x19d));var _0xd69c=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x69cd[_0x5eb22e];return _0x27fed5;};'use strict';var _=require(_0xd69c('0x0'));var util=require(_0xd69c('0x1'));var logger=require(_0xd69c('0x2'))(_0xd69c('0x3'));var moment=require(_0xd69c('0x4'));var BPromise=require(_0xd69c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd69c('0x6'));var rimraf=require(_0xd69c('0x7'));var config=require(_0xd69c('0x8'));var attributes=require(_0xd69c('0x9'));module[_0xd69c('0xa')]=function(_0xa83168,_0x33db18){return _0xa83168[_0xd69c('0xb')]('VoiceQueueReport',attributes,{'tableName':_0xd69c('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd69c('0xd')]},{'fields':[_0xd69c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index fcd4dde..d7b995b 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 _0x2630=['redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','body','CreateVoiceQueueReport','debug','stringify','UpdateVoiceQueueReport','update','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x570d11,_0x3d0c5b){var _0x57e786=function(_0x3f8ffa){while(--_0x3f8ffa){_0x570d11['push'](_0x570d11['shift']());}};_0x57e786(++_0x3d0c5b);}(_0x2630,0xa4));var _0x0263=function(_0x227dc1,_0x24eb83){_0x227dc1=_0x227dc1-0x0;var _0x19ac83=_0x2630[_0x227dc1];return _0x19ac83;};'use strict';var _=require(_0x0263('0x0'));var util=require(_0x0263('0x1'));var moment=require(_0x0263('0x2'));var BPromise=require(_0x0263('0x3'));var rs=require(_0x0263('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0263('0x5'))['db'];var utils=require(_0x0263('0x6'));var logger=require(_0x0263('0x7'))('rpc');var config=require(_0x0263('0x8'));var jayson=require(_0x0263('0x9'));var client=jayson[_0x0263('0xa')][_0x0263('0xb')]({'port':0x232a});config[_0x0263('0xc')]=_[_0x0263('0xd')](config[_0x0263('0xc')],{'host':_0x0263('0xe'),'port':0x18eb});var socket=require(_0x0263('0xf'))(new Redis(config[_0x0263('0xc')]));require(_0x0263('0x10'))['register'](socket);function respondWithRpcPromise(_0xb069d2,_0x4baa83,_0x45c78b){return new BPromise(function(_0x188568,_0xb71090){return client['request'](_0xb069d2,_0x45c78b)[_0x0263('0x11')](function(_0x3952eb){logger[_0x0263('0x12')](_0x0263('0x13'),_0x4baa83,_0x0263('0x14'));logger['debug'](_0x0263('0x15'),_0x4baa83,_0x0263('0x14'),JSON['stringify'](_0x3952eb));if(_0x3952eb['error']){if(_0x3952eb[_0x0263('0x16')][_0x0263('0x17')]===0x1f4){logger[_0x0263('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x4baa83,_0x3952eb['error'][_0x0263('0x18')]);return _0xb71090(_0x3952eb[_0x0263('0x16')][_0x0263('0x18')]);}logger['error'](_0x0263('0x13'),_0x4baa83,_0x3952eb['error']['message']);return _0x188568(_0x3952eb[_0x0263('0x16')][_0x0263('0x18')]);}else{logger['info'](_0x0263('0x13'),_0x4baa83,_0x0263('0x14'));_0x188568(_0x3952eb[_0x0263('0x19')][_0x0263('0x18')]);}})[_0x0263('0x1a')](function(_0x57d22c){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x4baa83,_0x57d22c);_0xb71090(_0x57d22c);});});}exports[_0x0263('0x1b')]=function(_0x3e7779){var _0x13352c=this;return new Promise(function(_0x1d2892,_0x4dc52f){return db[_0x0263('0x1c')][_0x0263('0x1d')]({'raw':_0x3e7779[_0x0263('0x1e')]?_0x3e7779[_0x0263('0x1e')][_0x0263('0x1f')]===undefined?!![]:![]:!![],'where':_0x3e7779[_0x0263('0x1e')]?_0x3e7779['options']['where']||null:null,'attributes':_0x3e7779[_0x0263('0x1e')]?_0x3e7779[_0x0263('0x1e')][_0x0263('0x20')]||null:null,'limit':_0x3e7779[_0x0263('0x1e')]?_0x3e7779['options'][_0x0263('0x21')]||null:null,'include':_0x3e7779[_0x0263('0x1e')]?_0x3e7779[_0x0263('0x1e')][_0x0263('0x22')]?_[_0x0263('0x23')](_0x3e7779[_0x0263('0x1e')]['include'],function(_0x4acf1f){return{'model':db[_0x4acf1f[_0x0263('0x24')]],'as':_0x4acf1f['as'],'attributes':_0x4acf1f[_0x0263('0x20')],'include':_0x4acf1f[_0x0263('0x22')]?_[_0x0263('0x23')](_0x4acf1f[_0x0263('0x22')],function(_0x204fc0){return{'model':db[_0x204fc0[_0x0263('0x24')]],'as':_0x204fc0['as'],'attributes':_0x204fc0[_0x0263('0x20')],'include':_0x204fc0['include']?_[_0x0263('0x23')](_0x204fc0[_0x0263('0x22')],function(_0x17f464){return{'model':db[_0x17f464[_0x0263('0x24')]],'as':_0x17f464['as'],'attributes':_0x17f464[_0x0263('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0263('0x11')](function(_0x8b4083){logger[_0x0263('0x12')]('GetVoiceQueueReport',_0x3e7779);logger['debug']('GetVoiceQueueReport',_0x3e7779,JSON['stringify'](_0x8b4083));_0x1d2892(_0x8b4083);})[_0x0263('0x1a')](function(_0x55b89c){logger[_0x0263('0x16')](_0x0263('0x1b'),_0x55b89c[_0x0263('0x18')],_0x3e7779);_0x4dc52f(_0x13352c[_0x0263('0x16')](0x1f4,_0x55b89c['message']));});});};exports['CreateVoiceQueueReport']=function(_0x121cbc){var _0x226a1e=this;return new Promise(function(_0x25c5f5,_0x734a81){return db[_0x0263('0x1c')]['create'](_0x121cbc[_0x0263('0x25')],{'raw':_0x121cbc[_0x0263('0x1e')]?_0x121cbc[_0x0263('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x0263('0x11')](function(_0x53978a){logger[_0x0263('0x12')](_0x0263('0x26'),_0x121cbc);logger[_0x0263('0x27')]('CreateVoiceQueueReport',_0x121cbc,JSON[_0x0263('0x28')](_0x53978a));_0x25c5f5(_0x53978a);})[_0x0263('0x1a')](function(_0x5634ca){logger['error'](_0x0263('0x26'),_0x5634ca[_0x0263('0x18')],_0x121cbc);_0x734a81(_0x226a1e[_0x0263('0x16')](0x1f4,_0x5634ca[_0x0263('0x18')]));});});};exports[_0x0263('0x29')]=function(_0x254235){var _0x3d3f0c=this;return new Promise(function(_0x56ddd7,_0x955107){return db[_0x0263('0x1c')][_0x0263('0x2a')](_0x254235[_0x0263('0x25')],{'raw':_0x254235['options']?_0x254235[_0x0263('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254235['options']?_0x254235['options'][_0x0263('0x2b')]||null:null,'attributes':_0x254235['options']?_0x254235[_0x0263('0x1e')][_0x0263('0x20')]||null:null,'limit':_0x254235['options']?_0x254235[_0x0263('0x1e')]['limit']||null:null})[_0x0263('0x11')](function(_0x2d98b7){logger['info'](_0x0263('0x29'),_0x254235);logger[_0x0263('0x27')]('UpdateVoiceQueueReport',_0x254235,JSON['stringify'](_0x2d98b7));_0x56ddd7(_0x2d98b7);})[_0x0263('0x1a')](function(_0x290e2c){logger['error'](_0x0263('0x29'),_0x290e2c['message'],_0x254235);_0x955107(_0x3d3f0c[_0x0263('0x16')](0x1f4,_0x290e2c['message']));});});}; \ No newline at end of file +var _0xe259=['limit','include','model','map','then','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','attributes'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xe259,0xd9));var _0x9e25=function(_0x5e0f1d,_0x5e7e6a){_0x5e0f1d=_0x5e0f1d-0x0;var _0xb801aa=_0xe259[_0x5e0f1d];return _0xb801aa;};'use strict';var _=require('lodash');var util=require(_0x9e25('0x0'));var moment=require(_0x9e25('0x1'));var BPromise=require(_0x9e25('0x2'));var rs=require(_0x9e25('0x3'));var fs=require('fs');var Redis=require(_0x9e25('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e25('0x5'));var logger=require(_0x9e25('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9e25('0x7')][_0x9e25('0x8')]({'port':0x232a});config[_0x9e25('0x9')]=_[_0x9e25('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9e25('0xb'))(new Redis(config[_0x9e25('0x9')]));require(_0x9e25('0xc'))[_0x9e25('0xd')](socket);function respondWithRpcPromise(_0x2099f3,_0x3ac266,_0x3c6252){return new BPromise(function(_0xaec723,_0x298acf){return client['request'](_0x2099f3,_0x3c6252)['then'](function(_0x3fe5e3){logger[_0x9e25('0xe')](_0x9e25('0xf'),_0x3ac266,'request\x20sent');logger[_0x9e25('0x10')](_0x9e25('0x11'),_0x3ac266,_0x9e25('0x12'),JSON[_0x9e25('0x13')](_0x3fe5e3));if(_0x3fe5e3[_0x9e25('0x14')]){if(_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x15')]===0x1f4){logger[_0x9e25('0x14')](_0x9e25('0xf'),_0x3ac266,_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x16')]);return _0x298acf(_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x16')]);}logger[_0x9e25('0x14')](_0x9e25('0xf'),_0x3ac266,_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x16')]);return _0xaec723(_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x16')]);}else{logger[_0x9e25('0xe')](_0x9e25('0xf'),_0x3ac266,_0x9e25('0x12'));_0xaec723(_0x3fe5e3[_0x9e25('0x17')][_0x9e25('0x16')]);}})[_0x9e25('0x18')](function(_0x3d43f1){logger[_0x9e25('0x14')](_0x9e25('0xf'),_0x3ac266,_0x3d43f1);_0x298acf(_0x3d43f1);});});}exports['GetVoiceQueueReport']=function(_0x1ff797){var _0xa9a94a=this;return new Promise(function(_0x26294a,_0xc6ee2){return db['VoiceQueueReport']['findAll']({'raw':_0x1ff797['options']?_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ff797['options']?_0x1ff797['options'][_0x9e25('0x1b')]||null:null,'attributes':_0x1ff797[_0x9e25('0x19')]?_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1c')]||null:null,'limit':_0x1ff797['options']?_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1d')]||null:null,'include':_0x1ff797[_0x9e25('0x19')]?_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1e')]?_['map'](_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1e')],function(_0x1ede28){return{'model':db[_0x1ede28[_0x9e25('0x1f')]],'as':_0x1ede28['as'],'attributes':_0x1ede28['attributes'],'include':_0x1ede28[_0x9e25('0x1e')]?_['map'](_0x1ede28[_0x9e25('0x1e')],function(_0x161120){return{'model':db[_0x161120[_0x9e25('0x1f')]],'as':_0x161120['as'],'attributes':_0x161120[_0x9e25('0x1c')],'include':_0x161120['include']?_[_0x9e25('0x20')](_0x161120[_0x9e25('0x1e')],function(_0x58b1f4){return{'model':db[_0x58b1f4[_0x9e25('0x1f')]],'as':_0x58b1f4['as'],'attributes':_0x58b1f4[_0x9e25('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9e25('0x21')](function(_0xdd8855){logger[_0x9e25('0xe')](_0x9e25('0x22'),_0x1ff797);logger[_0x9e25('0x10')]('GetVoiceQueueReport',_0x1ff797,JSON[_0x9e25('0x13')](_0xdd8855));_0x26294a(_0xdd8855);})[_0x9e25('0x18')](function(_0x537e83){logger['error']('GetVoiceQueueReport',_0x537e83[_0x9e25('0x16')],_0x1ff797);_0xc6ee2(_0xa9a94a['error'](0x1f4,_0x537e83[_0x9e25('0x16')]));});});};exports[_0x9e25('0x23')]=function(_0x4aad3b){var _0x353cb2=this;return new Promise(function(_0x26148b,_0x1345e9){return db[_0x9e25('0x24')][_0x9e25('0x25')](_0x4aad3b[_0x9e25('0x26')],{'raw':_0x4aad3b[_0x9e25('0x19')]?_0x4aad3b['options'][_0x9e25('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x91718e){logger[_0x9e25('0xe')](_0x9e25('0x23'),_0x4aad3b);logger['debug'](_0x9e25('0x23'),_0x4aad3b,JSON['stringify'](_0x91718e));_0x26148b(_0x91718e);})[_0x9e25('0x18')](function(_0x150f8d){logger[_0x9e25('0x14')](_0x9e25('0x23'),_0x150f8d['message'],_0x4aad3b);_0x1345e9(_0x353cb2[_0x9e25('0x14')](0x1f4,_0x150f8d[_0x9e25('0x16')]));});});};exports[_0x9e25('0x27')]=function(_0x21362f){var _0x23f0b7=this;return new Promise(function(_0x3c35fd,_0x1fb7e0){return db[_0x9e25('0x24')][_0x9e25('0x28')](_0x21362f[_0x9e25('0x26')],{'raw':_0x21362f['options']?_0x21362f[_0x9e25('0x19')][_0x9e25('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21362f[_0x9e25('0x19')]?_0x21362f['options'][_0x9e25('0x1b')]||null:null,'attributes':_0x21362f[_0x9e25('0x19')]?_0x21362f['options'][_0x9e25('0x1c')]||null:null,'limit':_0x21362f[_0x9e25('0x19')]?_0x21362f[_0x9e25('0x19')]['limit']||null:null})[_0x9e25('0x21')](function(_0x13c444){logger[_0x9e25('0xe')]('UpdateVoiceQueueReport',_0x21362f);logger['debug'](_0x9e25('0x27'),_0x21362f,JSON[_0x9e25('0x13')](_0x13c444));_0x3c35fd(_0x13c444);})['catch'](function(_0xe52131){logger[_0x9e25('0x14')](_0x9e25('0x27'),_0xe52131[_0x9e25('0x16')],_0x21362f);_0x1fb7e0(_0x23f0b7[_0x9e25('0x14')](0x1f4,_0xe52131[_0x9e25('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fb9e261..ec454b4 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 _0xfb15=['save','remove','update','emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x1f4564,_0x4cf78a){var _0x9554bd=function(_0x326871){while(--_0x326871){_0x1f4564['push'](_0x1f4564['shift']());}};_0x9554bd(++_0x4cf78a);}(_0xfb15,0x12f));var _0x5fb1=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfb15[_0x432682];return _0x463d05;};'use strict';var VoiceQueueReportEvents=require(_0x5fb1('0x0'));var events=[_0x5fb1('0x1'),_0x5fb1('0x2'),_0x5fb1('0x3')];function createListener(_0x3024e7,_0x307c96){return function(_0x5323db){_0x307c96[_0x5fb1('0x4')](_0x3024e7,_0x5323db);};}function removeListener(_0x253775,_0x3a82a1){return function(){VoiceQueueReportEvents[_0x5fb1('0x5')](_0x253775,_0x3a82a1);};}exports[_0x5fb1('0x6')]=function(_0x23e770){for(var _0x51a96b=0x0,_0x2e68c9=events['length'];_0x51a96b<_0x2e68c9;_0x51a96b++){var _0x55b282=events[_0x51a96b];var _0x267223=createListener(_0x5fb1('0x7')+_0x55b282,_0x23e770);VoiceQueueReportEvents['on'](_0x55b282,_0x267223);}}; \ No newline at end of file +var _0x28a0=['./voiceQueueReport.events','remove','update','removeListener','length','voiceQueueReport:'];(function(_0x25b274,_0x578748){var _0x367046=function(_0x160fd6){while(--_0x160fd6){_0x25b274['push'](_0x25b274['shift']());}};_0x367046(++_0x578748);}(_0x28a0,0x8a));var _0x028a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x28a0[_0x502c7d];return _0x30b7ed;};'use strict';var VoiceQueueReportEvents=require(_0x028a('0x0'));var events=['save',_0x028a('0x1'),_0x028a('0x2')];function createListener(_0x1ad626,_0x5a001b){return function(_0xdd2bf8){_0x5a001b['emit'](_0x1ad626,_0xdd2bf8);};}function removeListener(_0x5ad0b5,_0x499fd4){return function(){VoiceQueueReportEvents[_0x028a('0x3')](_0x5ad0b5,_0x499fd4);};}exports['register']=function(_0x132a95){for(var _0x43e0e5=0x0,_0x16436e=events[_0x028a('0x4')];_0x43e0e5<_0x16436e;_0x43e0e5++){var _0x3aa587=events[_0x43e0e5];var _0x233b9f=createListener(_0x028a('0x5')+_0x3aa587,_0x132a95);VoiceQueueReportEvents['on'](_0x3aa587,_0x233b9f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 4cb6e17..2f26549 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 _0x2904=['update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x5cca33,_0x1a1607){var _0x1fbc89=function(_0x22312e){while(--_0x22312e){_0x5cca33['push'](_0x5cca33['shift']());}};_0x1fbc89(++_0x1a1607);}(_0x2904,0x16b));var _0x4290=function(_0x23037e,_0x223914){_0x23037e=_0x23037e-0x0;var _0x4c5cf7=_0x2904[_0x23037e];return _0x4c5cf7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4290('0x0'));var express=require(_0x4290('0x1'));var router=express[_0x4290('0x2')]();var fs_extra=require(_0x4290('0x3'));var auth=require(_0x4290('0x4'));var interaction=require(_0x4290('0x5'));var config=require(_0x4290('0x6'));var controller=require(_0x4290('0x7'));router[_0x4290('0x8')]('/',auth[_0x4290('0x9')](),controller[_0x4290('0xa')]);router['get'](_0x4290('0xb'),auth[_0x4290('0x9')](),controller[_0x4290('0xc')]);router['post']('/',auth[_0x4290('0x9')](),controller[_0x4290('0xd')]);router[_0x4290('0xe')](_0x4290('0xb'),auth[_0x4290('0x9')](),controller[_0x4290('0xf')]);router[_0x4290('0x10')](_0x4290('0xb'),auth[_0x4290('0x9')](),controller[_0x4290('0x11')]);module['exports']=router; \ No newline at end of file +var _0x44d4=['exports','multer','express','Router','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x44d4,0x161));var _0x444d=function(_0x2e5a17,_0x558f0e){_0x2e5a17=_0x2e5a17-0x0;var _0x24f53d=_0x44d4[_0x2e5a17];return _0x24f53d;};'use strict';var multer=require(_0x444d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x444d('0x1'));var router=express[_0x444d('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x444d('0x3'));var controller=require(_0x444d('0x4'));router[_0x444d('0x5')]('/',auth[_0x444d('0x6')](),controller[_0x444d('0x7')]);router[_0x444d('0x5')](_0x444d('0x8'),auth['isAuthenticated'](),controller[_0x444d('0x9')]);router['post']('/',auth[_0x444d('0x6')](),controller[_0x444d('0xa')]);router[_0x444d('0xb')](_0x444d('0x8'),auth[_0x444d('0x6')](),controller[_0x444d('0xc')]);router[_0x444d('0xd')](_0x444d('0x8'),auth[_0x444d('0x6')](),controller[_0x444d('0xe')]);module[_0x444d('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index dde96f9..d6ca155 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 _0xa9c7=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9c7,0x148));var _0x7a9c=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xa9c7[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x7a9c('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x7a9c('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7a9c('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7a9c('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7a9c('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7a9c('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7a9c('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7a9c('0x2')],'allowNull':![],'defaultValue':moment()[_0x7a9c('0x3')](_0x7a9c('0x4'))}}; \ No newline at end of file +var _0x6636=['DATE','sequelize','moment','STRING'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x6636,0x119));var _0x6663=function(_0x505edd,_0x21da2d){_0x505edd=_0x505edd-0x0;var _0xd43afd=_0x6636[_0x505edd];return _0xd43afd;};'use strict';var Sequelize=require(_0x6663('0x0'));var moment=require(_0x6663('0x1'));module['exports']={'time':{'type':Sequelize[_0x6663('0x2')]},'callid':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6663('0x3')],'allowNull':![],'defaultValue':moment()['format']('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 3e86aa9..bd4edc5 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 _0x295d=['destroy','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x7e6630,_0x4a374d){var _0x4c9398=function(_0x20e5be){while(--_0x20e5be){_0x7e6630['push'](_0x7e6630['shift']());}};_0x4c9398(++_0x4a374d);}(_0x295d,0x6e));var _0xd295=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x295d[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0xd295('0x0'));var rimraf=require(_0xd295('0x1'));var zipdir=require(_0xd295('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd295('0x3'));var moment=require('moment');var BPromise=require(_0xd295('0x4'));var Mustache=require(_0xd295('0x5'));var util=require('util');var path=require(_0xd295('0x6'));var sox=require(_0xd295('0x7'));var csv=require(_0xd295('0x8'));var ejs=require(_0xd295('0x9'));var fs=require('fs');var fs_extra=require(_0xd295('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd295('0xb'));var deskjs=require(_0xd295('0xc'));var toCsv=require(_0xd295('0x8'));var querystring=require(_0xd295('0xd'));var Papa=require(_0xd295('0xe'));var Redis=require(_0xd295('0xf'));var authService=require(_0xd295('0x10'));var qs=require(_0xd295('0x11'));var as=require(_0xd295('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd295('0x13'))(_0xd295('0x14'));var utils=require(_0xd295('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bc1cf,_0x415bd3){_0x415bd3=_0x415bd3||0xcc;return function(_0x1c2172){if(_0x1c2172){return _0x2bc1cf[_0xd295('0x16')](_0x415bd3);}return _0x2bc1cf[_0xd295('0x17')](_0x415bd3)[_0xd295('0x18')]();};}function respondWithResult(_0x191442,_0x58fd82){_0x58fd82=_0x58fd82||0xc8;return function(_0x227cfb){if(_0x227cfb){return _0x191442['status'](_0x58fd82)[_0xd295('0x19')](_0x227cfb);}};}function respondWithFilteredResult(_0x1fdf74,_0x522366){return function(_0x790412){if(_0x790412){var _0x2558bb=typeof _0x522366[_0xd295('0x1a')]===_0xd295('0x1b')&&typeof _0x522366[_0xd295('0x1c')]===_0xd295('0x1b');var _0x35b46e=_0x790412[_0xd295('0x1d')];var _0x150550=_0x2558bb?0x0:_0x522366['offset'];var _0x1e698f=_0x2558bb?_0x790412['count']:_0x522366['offset']+_0x522366[_0xd295('0x1c')];var _0x2d1c7a;if(_0x1e698f>=_0x35b46e){_0x1e698f=_0x35b46e;_0x2d1c7a=0xc8;}else{_0x2d1c7a=0xce;}_0x1fdf74[_0xd295('0x17')](_0x2d1c7a);return _0x1fdf74[_0xd295('0x1e')](_0xd295('0x1f'),_0x150550+'-'+_0x1e698f+'/'+_0x35b46e)[_0xd295('0x19')](_0x790412);}return null;};}function patchUpdates(_0x38081e){return function(_0x49d645){try{jsonpatch[_0xd295('0x20')](_0x49d645,_0x38081e,!![]);}catch(_0x743fae){return BPromise['reject'](_0x743fae);}return _0x49d645[_0xd295('0x21')]();};}function saveUpdates(_0x10159a,_0x2a25cc){return function(_0x5e0573){if(_0x5e0573){return _0x5e0573[_0xd295('0x22')](_0x10159a)[_0xd295('0x23')](function(_0x456684){return _0x456684;});}return null;};}function removeEntity(_0x4d9cca,_0x56de86){return function(_0x5bc8b4){if(_0x5bc8b4){return _0x5bc8b4[_0xd295('0x24')]()[_0xd295('0x23')](function(){_0x4d9cca[_0xd295('0x17')](0xcc)[_0xd295('0x18')]();});}};}function handleEntityNotFound(_0x3f8d69,_0x186ece){return function(_0x3a500e){if(!_0x3a500e){_0x3f8d69[_0xd295('0x16')](0x194);}return _0x3a500e;};}function handleError(_0x2c2e98,_0x4b8233){_0x4b8233=_0x4b8233||0x1f4;return function(_0x1eeefa){logger[_0xd295('0x25')](_0x1eeefa[_0xd295('0x26')]);if(_0x1eeefa[_0xd295('0x27')]){delete _0x1eeefa[_0xd295('0x27')];}_0x2c2e98['status'](_0x4b8233)[_0xd295('0x28')](_0x1eeefa);};}exports[_0xd295('0x29')]=function(_0x40f5b9,_0x15b137){var _0x403e32={},_0x3978c2={},_0xbe9f08={'count':0x0,'rows':[]};var _0x1044be=_[_0xd295('0x2a')](db[_0xd295('0x2b')]['rawAttributes'],function(_0x24555e){return{'name':_0x24555e[_0xd295('0x2c')],'type':_0x24555e[_0xd295('0x2d')][_0xd295('0x2e')]};});_0x3978c2[_0xd295('0x2f')]=_[_0xd295('0x2a')](_0x1044be,_0xd295('0x27'));_0x3978c2[_0xd295('0x30')]=_[_0xd295('0x31')](_0x40f5b9[_0xd295('0x30')]);_0x3978c2[_0xd295('0x32')]=_[_0xd295('0x33')](_0x3978c2['model'],_0x3978c2[_0xd295('0x30')]);_0x403e32[_0xd295('0x34')]=_['intersection'](_0x3978c2[_0xd295('0x2f')],qs[_0xd295('0x35')](_0x40f5b9[_0xd295('0x30')]['fields']));_0x403e32[_0xd295('0x34')]=_0x403e32[_0xd295('0x34')][_0xd295('0x36')]?_0x403e32[_0xd295('0x34')]:_0x3978c2[_0xd295('0x2f')];if(!_0x40f5b9[_0xd295('0x30')][_0xd295('0x37')](_0xd295('0x38'))){_0x403e32[_0xd295('0x1c')]=qs[_0xd295('0x1c')](_0x40f5b9[_0xd295('0x30')][_0xd295('0x1c')]);_0x403e32[_0xd295('0x1a')]=qs[_0xd295('0x1a')](_0x40f5b9['query'][_0xd295('0x1a')]);}_0x403e32[_0xd295('0x39')]=qs[_0xd295('0x3a')](_0x40f5b9[_0xd295('0x30')][_0xd295('0x3a')]);_0x403e32['where']=qs[_0xd295('0x32')](_['pick'](_0x40f5b9[_0xd295('0x30')],_0x3978c2['filters']),_0x1044be);if(_0x40f5b9[_0xd295('0x30')][_0xd295('0x3b')]){_0x403e32[_0xd295('0x3c')]=_[_0xd295('0x3d')](_0x403e32[_0xd295('0x3c')],{'$or':_['map'](_0x1044be,function(_0x4c95d7){if(_0x4c95d7[_0xd295('0x2d')]!==_0xd295('0x3e')){var _0x3d655e={};_0x3d655e[_0x4c95d7[_0xd295('0x27')]]={'$like':'%'+_0x40f5b9[_0xd295('0x30')]['filter']+'%'};return _0x3d655e;}})});}_0x403e32=_[_0xd295('0x3d')]({},_0x403e32,_0x40f5b9['options']);var _0xb9a426={'where':_0x403e32[_0xd295('0x3c')]};return db[_0xd295('0x2b')][_0xd295('0x1d')](_0xb9a426)[_0xd295('0x23')](function(_0x3daf6){_0xbe9f08['count']=_0x3daf6;if(_0x40f5b9[_0xd295('0x30')]['includeAll']){_0x403e32[_0xd295('0x3f')]=[{'all':!![]}];}return db[_0xd295('0x2b')]['findAll'](_0x403e32);})[_0xd295('0x23')](function(_0x2ad597){_0xbe9f08[_0xd295('0x40')]=_0x2ad597;return _0xbe9f08;})[_0xd295('0x23')](respondWithFilteredResult(_0x15b137,_0x403e32))[_0xd295('0x41')](handleError(_0x15b137,null));};exports[_0xd295('0x42')]=function(_0x3ac105,_0x44a607){var _0x4addeb={'raw':!![],'where':{'id':_0x3ac105[_0xd295('0x43')]['id']}},_0x7e4d83={};_0x7e4d83[_0xd295('0x2f')]=_['keys'](db[_0xd295('0x2b')][_0xd295('0x44')]);_0x7e4d83[_0xd295('0x30')]=_[_0xd295('0x31')](_0x3ac105[_0xd295('0x30')]);_0x7e4d83[_0xd295('0x32')]=_[_0xd295('0x33')](_0x7e4d83[_0xd295('0x2f')],_0x7e4d83['query']);_0x4addeb['attributes']=_['intersection'](_0x7e4d83[_0xd295('0x2f')],qs[_0xd295('0x35')](_0x3ac105[_0xd295('0x30')][_0xd295('0x35')]));_0x4addeb[_0xd295('0x34')]=_0x4addeb[_0xd295('0x34')][_0xd295('0x36')]?_0x4addeb[_0xd295('0x34')]:_0x7e4d83['model'];if(_0x3ac105[_0xd295('0x30')][_0xd295('0x45')]){_0x4addeb['include']=[{'all':!![]}];}_0x4addeb=_['merge']({},_0x4addeb,_0x3ac105['options']);return db['VoiceQueuesLog'][_0xd295('0x46')](_0x4addeb)[_0xd295('0x23')](handleEntityNotFound(_0x44a607,null))[_0xd295('0x23')](respondWithResult(_0x44a607,null))[_0xd295('0x41')](handleError(_0x44a607,null));};exports[_0xd295('0x47')]=function(_0x58dda2,_0x370cbb){return db[_0xd295('0x2b')][_0xd295('0x47')](_0x58dda2['body'],{})['then'](respondWithResult(_0x370cbb,0xc9))[_0xd295('0x41')](handleError(_0x370cbb,null));};exports[_0xd295('0x22')]=function(_0xfaa970,_0x143579){if(_0xfaa970[_0xd295('0x48')]['id']){delete _0xfaa970[_0xd295('0x48')]['id'];}return db[_0xd295('0x2b')][_0xd295('0x46')]({'where':{'id':_0xfaa970['params']['id']}})[_0xd295('0x23')](handleEntityNotFound(_0x143579,null))['then'](saveUpdates(_0xfaa970[_0xd295('0x48')],null))[_0xd295('0x23')](respondWithResult(_0x143579,null))[_0xd295('0x41')](handleError(_0x143579,null));};exports[_0xd295('0x24')]=function(_0x34428b,_0x3931d2){return db[_0xd295('0x2b')][_0xd295('0x46')]({'where':{'id':_0x34428b['params']['id']}})[_0xd295('0x23')](handleEntityNotFound(_0x3931d2,null))[_0xd295('0x23')](removeEntity(_0x3931d2,null))['catch'](handleError(_0x3931d2,null));}; \ No newline at end of file +var _0xa11f=['fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','show','params','options','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes'];(function(_0x5f47e0,_0x4d77a2){var _0x203360=function(_0x155fb6){while(--_0x155fb6){_0x5f47e0['push'](_0x5f47e0['shift']());}};_0x203360(++_0x4d77a2);}(_0xa11f,0x134));var _0xfa11=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0xa11f[_0xaa6a4];return _0xdc31a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa11('0x0'));var zipdir=require(_0xfa11('0x1'));var jsonpatch=require(_0xfa11('0x2'));var rp=require(_0xfa11('0x3'));var moment=require(_0xfa11('0x4'));var BPromise=require(_0xfa11('0x5'));var Mustache=require('mustache');var util=require(_0xfa11('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfa11('0x7'));var ejs=require(_0xfa11('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfa11('0x9'));var crypto=require(_0xfa11('0xa'));var jsforce=require(_0xfa11('0xb'));var deskjs=require(_0xfa11('0xc'));var toCsv=require(_0xfa11('0x7'));var querystring=require(_0xfa11('0xd'));var Papa=require(_0xfa11('0xe'));var Redis=require('ioredis');var authService=require(_0xfa11('0xf'));var qs=require(_0xfa11('0x10'));var as=require(_0xfa11('0x11'));var hardwareService=require(_0xfa11('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xfa11('0x13'));var config=require(_0xfa11('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aed3c,_0xfbfbfe){_0xfbfbfe=_0xfbfbfe||0xcc;return function(_0x5cae6c){if(_0x5cae6c){return _0x1aed3c[_0xfa11('0x15')](_0xfbfbfe);}return _0x1aed3c[_0xfa11('0x16')](_0xfbfbfe)[_0xfa11('0x17')]();};}function respondWithResult(_0x2eef13,_0x4fddbb){_0x4fddbb=_0x4fddbb||0xc8;return function(_0x5390d3){if(_0x5390d3){return _0x2eef13[_0xfa11('0x16')](_0x4fddbb)[_0xfa11('0x18')](_0x5390d3);}};}function respondWithFilteredResult(_0x47e55e,_0x5e56c3){return function(_0x3ea782){if(_0x3ea782){var _0x5845bd=typeof _0x5e56c3[_0xfa11('0x19')]===_0xfa11('0x1a')&&typeof _0x5e56c3[_0xfa11('0x1b')]===_0xfa11('0x1a');var _0x18fb1c=_0x3ea782[_0xfa11('0x1c')];var _0x347118=_0x5845bd?0x0:_0x5e56c3[_0xfa11('0x19')];var _0x3c8edc=_0x5845bd?_0x3ea782['count']:_0x5e56c3['offset']+_0x5e56c3[_0xfa11('0x1b')];var _0x3b719a;if(_0x3c8edc>=_0x18fb1c){_0x3c8edc=_0x18fb1c;_0x3b719a=0xc8;}else{_0x3b719a=0xce;}_0x47e55e['status'](_0x3b719a);return _0x47e55e[_0xfa11('0x1d')]('Content-Range',_0x347118+'-'+_0x3c8edc+'/'+_0x18fb1c)[_0xfa11('0x18')](_0x3ea782);}return null;};}function patchUpdates(_0x2b1e1a){return function(_0x1356ca){try{jsonpatch[_0xfa11('0x1e')](_0x1356ca,_0x2b1e1a,!![]);}catch(_0x22cca1){return BPromise[_0xfa11('0x1f')](_0x22cca1);}return _0x1356ca[_0xfa11('0x20')]();};}function saveUpdates(_0x3c7be8,_0x24c3dc){return function(_0x4bcbfc){if(_0x4bcbfc){return _0x4bcbfc[_0xfa11('0x21')](_0x3c7be8)[_0xfa11('0x22')](function(_0x1417bd){return _0x1417bd;});}return null;};}function removeEntity(_0x341647,_0x1f83cd){return function(_0x41d19d){if(_0x41d19d){return _0x41d19d[_0xfa11('0x23')]()[_0xfa11('0x22')](function(){_0x341647['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a016e,_0x2d531a){return function(_0x6c0cc7){if(!_0x6c0cc7){_0x2a016e[_0xfa11('0x15')](0x194);}return _0x6c0cc7;};}function handleError(_0x1991ff,_0x376ec8){_0x376ec8=_0x376ec8||0x1f4;return function(_0x5da13c){logger[_0xfa11('0x24')](_0x5da13c[_0xfa11('0x25')]);if(_0x5da13c[_0xfa11('0x26')]){delete _0x5da13c[_0xfa11('0x26')];}_0x1991ff[_0xfa11('0x16')](_0x376ec8)[_0xfa11('0x27')](_0x5da13c);};}exports[_0xfa11('0x28')]=function(_0x172ff8,_0x52730c){var _0x44a8bb={},_0x4c7b40={},_0x23b98b={'count':0x0,'rows':[]};var _0xa350f0=_[_0xfa11('0x29')](db[_0xfa11('0x2a')][_0xfa11('0x2b')],function(_0x109a52){return{'name':_0x109a52[_0xfa11('0x2c')],'type':_0x109a52['type'][_0xfa11('0x2d')]};});_0x4c7b40[_0xfa11('0x2e')]=_[_0xfa11('0x29')](_0xa350f0,_0xfa11('0x26'));_0x4c7b40['query']=_[_0xfa11('0x2f')](_0x172ff8['query']);_0x4c7b40[_0xfa11('0x30')]=_[_0xfa11('0x31')](_0x4c7b40[_0xfa11('0x2e')],_0x4c7b40[_0xfa11('0x32')]);_0x44a8bb[_0xfa11('0x33')]=_[_0xfa11('0x31')](_0x4c7b40[_0xfa11('0x2e')],qs[_0xfa11('0x34')](_0x172ff8[_0xfa11('0x32')][_0xfa11('0x34')]));_0x44a8bb[_0xfa11('0x33')]=_0x44a8bb[_0xfa11('0x33')][_0xfa11('0x35')]?_0x44a8bb['attributes']:_0x4c7b40[_0xfa11('0x2e')];if(!_0x172ff8[_0xfa11('0x32')]['hasOwnProperty'](_0xfa11('0x36'))){_0x44a8bb[_0xfa11('0x1b')]=qs['limit'](_0x172ff8[_0xfa11('0x32')]['limit']);_0x44a8bb[_0xfa11('0x19')]=qs[_0xfa11('0x19')](_0x172ff8['query'][_0xfa11('0x19')]);}_0x44a8bb['order']=qs[_0xfa11('0x37')](_0x172ff8[_0xfa11('0x32')]['sort']);_0x44a8bb[_0xfa11('0x38')]=qs['filters'](_[_0xfa11('0x39')](_0x172ff8[_0xfa11('0x32')],_0x4c7b40['filters']),_0xa350f0);if(_0x172ff8[_0xfa11('0x32')]['filter']){_0x44a8bb['where']=_[_0xfa11('0x3a')](_0x44a8bb[_0xfa11('0x38')],{'$or':_['map'](_0xa350f0,function(_0x32c9ca){if(_0x32c9ca[_0xfa11('0x3b')]!==_0xfa11('0x3c')){var _0x4a4396={};_0x4a4396[_0x32c9ca['name']]={'$like':'%'+_0x172ff8[_0xfa11('0x32')][_0xfa11('0x3d')]+'%'};return _0x4a4396;}})});}_0x44a8bb=_['merge']({},_0x44a8bb,_0x172ff8['options']);var _0x2be465={'where':_0x44a8bb[_0xfa11('0x38')]};return db[_0xfa11('0x2a')][_0xfa11('0x1c')](_0x2be465)[_0xfa11('0x22')](function(_0x133ce9){_0x23b98b[_0xfa11('0x1c')]=_0x133ce9;if(_0x172ff8[_0xfa11('0x32')][_0xfa11('0x3e')]){_0x44a8bb[_0xfa11('0x3f')]=[{'all':!![]}];}return db[_0xfa11('0x2a')]['findAll'](_0x44a8bb);})['then'](function(_0x3b76cd){_0x23b98b[_0xfa11('0x40')]=_0x3b76cd;return _0x23b98b;})['then'](respondWithFilteredResult(_0x52730c,_0x44a8bb))['catch'](handleError(_0x52730c,null));};exports[_0xfa11('0x41')]=function(_0x268532,_0x429989){var _0x304f63={'raw':!![],'where':{'id':_0x268532[_0xfa11('0x42')]['id']}},_0x51934d={};_0x51934d[_0xfa11('0x2e')]=_['keys'](db['VoiceQueuesLog'][_0xfa11('0x2b')]);_0x51934d[_0xfa11('0x32')]=_[_0xfa11('0x2f')](_0x268532[_0xfa11('0x32')]);_0x51934d[_0xfa11('0x30')]=_[_0xfa11('0x31')](_0x51934d[_0xfa11('0x2e')],_0x51934d['query']);_0x304f63[_0xfa11('0x33')]=_[_0xfa11('0x31')](_0x51934d['model'],qs[_0xfa11('0x34')](_0x268532[_0xfa11('0x32')][_0xfa11('0x34')]));_0x304f63['attributes']=_0x304f63[_0xfa11('0x33')][_0xfa11('0x35')]?_0x304f63[_0xfa11('0x33')]:_0x51934d['model'];if(_0x268532[_0xfa11('0x32')]['includeAll']){_0x304f63[_0xfa11('0x3f')]=[{'all':!![]}];}_0x304f63=_[_0xfa11('0x3a')]({},_0x304f63,_0x268532[_0xfa11('0x43')]);return db[_0xfa11('0x2a')][_0xfa11('0x44')](_0x304f63)['then'](handleEntityNotFound(_0x429989,null))[_0xfa11('0x22')](respondWithResult(_0x429989,null))['catch'](handleError(_0x429989,null));};exports[_0xfa11('0x45')]=function(_0x2269fd,_0x281872){return db[_0xfa11('0x2a')][_0xfa11('0x45')](_0x2269fd[_0xfa11('0x46')],{})[_0xfa11('0x22')](respondWithResult(_0x281872,0xc9))['catch'](handleError(_0x281872,null));};exports[_0xfa11('0x21')]=function(_0x2c07ab,_0x24a144){if(_0x2c07ab[_0xfa11('0x46')]['id']){delete _0x2c07ab[_0xfa11('0x46')]['id'];}return db[_0xfa11('0x2a')][_0xfa11('0x44')]({'where':{'id':_0x2c07ab[_0xfa11('0x42')]['id']}})['then'](handleEntityNotFound(_0x24a144,null))[_0xfa11('0x22')](saveUpdates(_0x2c07ab[_0xfa11('0x46')],null))[_0xfa11('0x22')](respondWithResult(_0x24a144,null))['catch'](handleError(_0x24a144,null));};exports[_0xfa11('0x23')]=function(_0x431c4e,_0x2f2924){return db[_0xfa11('0x2a')][_0xfa11('0x44')]({'where':{'id':_0x431c4e[_0xfa11('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f2924,null))[_0xfa11('0x22')](removeEntity(_0x2f2924,null))[_0xfa11('0x47')](handleError(_0x2f2924,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 1485831..673f588 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 _0x09c1=['bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event','dtm','util','../../config/logger','moment'];(function(_0x4503f6,_0x3babaf){var _0x2277d1=function(_0x1c005a){while(--_0x1c005a){_0x4503f6['push'](_0x4503f6['shift']());}};_0x2277d1(++_0x3babaf);}(_0x09c1,0xb1));var _0x109c=function(_0x37b729,_0x8f10af){_0x37b729=_0x37b729-0x0;var _0x40cd25=_0x09c1[_0x37b729];return _0x40cd25;};'use strict';var _=require('lodash');var util=require(_0x109c('0x0'));var logger=require(_0x109c('0x1'))('api');var moment=require(_0x109c('0x2'));var BPromise=require(_0x109c('0x3'));var rp=require(_0x109c('0x4'));var fs=require('fs');var path=require(_0x109c('0x5'));var rimraf=require('rimraf');var config=require(_0x109c('0x6'));var attributes=require(_0x109c('0x7'));module['exports']=function(_0x369c4e,_0x17a333){return _0x369c4e[_0x109c('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x109c('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x109c('0xa'),_0x109c('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0cd2=['VoiceQueuesLog','voice_queues_log','event','dtm','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3b3d81,_0x119b4c){var _0x733e1a=function(_0x30a8c5){while(--_0x30a8c5){_0x3b3d81['push'](_0x3b3d81['shift']());}};_0x733e1a(++_0x119b4c);}(_0x0cd2,0x1cb));var _0x20cd=function(_0x3a6abb,_0x4d8e70){_0x3a6abb=_0x3a6abb-0x0;var _0x396555=_0x0cd2[_0x3a6abb];return _0x396555;};'use strict';var _=require(_0x20cd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x20cd('0x1'));var moment=require(_0x20cd('0x2'));var BPromise=require(_0x20cd('0x3'));var rp=require(_0x20cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20cd('0x5'));var config=require(_0x20cd('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x20cd('0x7')]=function(_0x2171fb,_0x5af7b0){return _0x2171fb[_0x20cd('0x8')](_0x20cd('0x9'),attributes,{'tableName':_0x20cd('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x20cd('0xb'),_0x20cd('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index c38f4cb..a561fc5 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 _0xe3db=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0xe3db,0xc8));var _0xbe3d=function(_0x5e7875,_0x4dcc49){_0x5e7875=_0x5e7875-0x0;var _0x3d3f3d=_0xe3db[_0x5e7875];return _0x3d3f3d;};'use strict';var _=require(_0xbe3d('0x0'));var util=require(_0xbe3d('0x1'));var moment=require('moment');var BPromise=require(_0xbe3d('0x2'));var rs=require(_0xbe3d('0x3'));var fs=require('fs');var Redis=require(_0xbe3d('0x4'));var db=require(_0xbe3d('0x5'))['db'];var utils=require(_0xbe3d('0x6'));var logger=require(_0xbe3d('0x7'))(_0xbe3d('0x8'));var config=require(_0xbe3d('0x9'));var jayson=require(_0xbe3d('0xa'));var client=jayson[_0xbe3d('0xb')][_0xbe3d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c255b,_0x314709,_0x90d1ab){return new BPromise(function(_0x24136a,_0x37e7c0){return client['request'](_0x4c255b,_0x90d1ab)[_0xbe3d('0xd')](function(_0x2aa8ff){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x314709,_0xbe3d('0xe'));logger[_0xbe3d('0xf')](_0xbe3d('0x10'),_0x314709,_0xbe3d('0xe'),JSON[_0xbe3d('0x11')](_0x2aa8ff));if(_0x2aa8ff[_0xbe3d('0x12')]){if(_0x2aa8ff[_0xbe3d('0x12')][_0xbe3d('0x13')]===0x1f4){logger[_0xbe3d('0x12')](_0xbe3d('0x14'),_0x314709,_0x2aa8ff[_0xbe3d('0x12')][_0xbe3d('0x15')]);return _0x37e7c0(_0x2aa8ff['error'][_0xbe3d('0x15')]);}logger[_0xbe3d('0x12')](_0xbe3d('0x14'),_0x314709,_0x2aa8ff[_0xbe3d('0x12')][_0xbe3d('0x15')]);return _0x24136a(_0x2aa8ff[_0xbe3d('0x12')][_0xbe3d('0x15')]);}else{logger[_0xbe3d('0x16')](_0xbe3d('0x14'),_0x314709,_0xbe3d('0xe'));_0x24136a(_0x2aa8ff[_0xbe3d('0x17')][_0xbe3d('0x15')]);}})[_0xbe3d('0x18')](function(_0x3f8630){logger['error'](_0xbe3d('0x14'),_0x314709,_0x3f8630);_0x37e7c0(_0x3f8630);});});} \ No newline at end of file +var _0x9dbe=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4bc494,_0x5edcab){var _0x14fa09=function(_0x2ae284){while(--_0x2ae284){_0x4bc494['push'](_0x4bc494['shift']());}};_0x14fa09(++_0x5edcab);}(_0x9dbe,0x1c4));var _0xe9db=function(_0x110660,_0x30405a){_0x110660=_0x110660-0x0;var _0x4be6e1=_0x9dbe[_0x110660];return _0x4be6e1;};'use strict';var _=require(_0xe9db('0x0'));var util=require(_0xe9db('0x1'));var moment=require(_0xe9db('0x2'));var BPromise=require(_0xe9db('0x3'));var rs=require(_0xe9db('0x4'));var fs=require('fs');var Redis=require(_0xe9db('0x5'));var db=require(_0xe9db('0x6'))['db'];var utils=require(_0xe9db('0x7'));var logger=require('../../config/logger')(_0xe9db('0x8'));var config=require(_0xe9db('0x9'));var jayson=require(_0xe9db('0xa'));var client=jayson['client'][_0xe9db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121004,_0x5ba220,_0x56ee55){return new BPromise(function(_0x129aca,_0x20f4d4){return client[_0xe9db('0xc')](_0x121004,_0x56ee55)[_0xe9db('0xd')](function(_0x423a27){logger[_0xe9db('0xe')](_0xe9db('0xf'),_0x5ba220,_0xe9db('0x10'));logger['debug'](_0xe9db('0x11'),_0x5ba220,_0xe9db('0x10'),JSON[_0xe9db('0x12')](_0x423a27));if(_0x423a27[_0xe9db('0x13')]){if(_0x423a27[_0xe9db('0x13')][_0xe9db('0x14')]===0x1f4){logger[_0xe9db('0x13')](_0xe9db('0xf'),_0x5ba220,_0x423a27[_0xe9db('0x13')][_0xe9db('0x15')]);return _0x20f4d4(_0x423a27['error'][_0xe9db('0x15')]);}logger['error'](_0xe9db('0xf'),_0x5ba220,_0x423a27['error'][_0xe9db('0x15')]);return _0x129aca(_0x423a27[_0xe9db('0x13')][_0xe9db('0x15')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5ba220,_0xe9db('0x10'));_0x129aca(_0x423a27['result'][_0xe9db('0x15')]);}})[_0xe9db('0x16')](function(_0x920d9b){logger[_0xe9db('0x13')](_0xe9db('0xf'),_0x5ba220,_0x920d9b);_0x20f4d4(_0x920d9b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index de63720..109c8e7 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 _0x8e36=['/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put'];(function(_0x531ad0,_0x273edc){var _0xb9a696=function(_0x5c2fa4){while(--_0x5c2fa4){_0x531ad0['push'](_0x531ad0['shift']());}};_0xb9a696(++_0x273edc);}(_0x8e36,0x9f));var _0x68e3=function(_0x20caa3,_0xb9358f){_0x20caa3=_0x20caa3-0x0;var _0x4d02cc=_0x8e36[_0x20caa3];return _0x4d02cc;};'use strict';var multer=require(_0x68e3('0x0'));var util=require(_0x68e3('0x1'));var path=require('path');var timeout=require(_0x68e3('0x2'));var express=require(_0x68e3('0x3'));var router=express[_0x68e3('0x4')]();var fs_extra=require(_0x68e3('0x5'));var auth=require(_0x68e3('0x6'));var interaction=require(_0x68e3('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x68e3('0x8')]('/',auth[_0x68e3('0x9')](),controller[_0x68e3('0xa')]);router[_0x68e3('0x8')](_0x68e3('0xb'),auth[_0x68e3('0x9')](),controller[_0x68e3('0xc')]);router[_0x68e3('0x8')]('/:id',auth[_0x68e3('0x9')](),controller[_0x68e3('0xd')]);router[_0x68e3('0x8')](_0x68e3('0xe'),auth['isAuthenticated'](),controller[_0x68e3('0xf')]);router[_0x68e3('0x8')](_0x68e3('0x10'),controller[_0x68e3('0x11')]);router[_0x68e3('0x8')](_0x68e3('0x12'),auth['isAuthenticated'](),controller[_0x68e3('0x13')]);router[_0x68e3('0x14')]('/',auth[_0x68e3('0x9')](),controller['create']);router[_0x68e3('0x14')]('/:id/transcribe',auth[_0x68e3('0x9')](),controller[_0x68e3('0x15')]);router[_0x68e3('0x16')](_0x68e3('0x17'),auth[_0x68e3('0x9')](),controller['update']);router[_0x68e3('0x18')]('/:id',auth[_0x68e3('0x9')](),controller['destroy']);module[_0x68e3('0x19')]=router; \ No newline at end of file +var _0x9c00=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5b9b11,_0x25ea00){var _0x4d8ec4=function(_0x562a7c){while(--_0x562a7c){_0x5b9b11['push'](_0x5b9b11['shift']());}};_0x4d8ec4(++_0x25ea00);}(_0x9c00,0x1a3));var _0x09c0=function(_0x197954,_0x3f61d0){_0x197954=_0x197954-0x0;var _0x231d54=_0x9c00[_0x197954];return _0x231d54;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require(_0x09c0('0x2'));var timeout=require(_0x09c0('0x3'));var express=require(_0x09c0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x5'));var interaction=require(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var controller=require(_0x09c0('0x8'));router[_0x09c0('0x9')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x9')]('/describe',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router['get'](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0x9')](_0x09c0('0xf'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0x9')](_0x09c0('0x11'),controller[_0x09c0('0x12')]);router[_0x09c0('0x9')](_0x09c0('0x13'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x14')]);router[_0x09c0('0x15')]('/',auth[_0x09c0('0xa')](),controller['create']);router[_0x09c0('0x15')](_0x09c0('0x13'),auth['isAuthenticated'](),controller[_0x09c0('0x16')]);router[_0x09c0('0x17')]('/:id',auth[_0x09c0('0xa')](),controller['update']);router['delete']('/:id',auth[_0x09c0('0xa')](),controller['destroy']);module[_0x09c0('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 cceedb8..c513e79 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(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 41e6495..139adf9 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 _0xb851=['error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe','download','../../components/encryptor','value','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','uniqueid','token','$and','push','recording','destroy','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','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','squel','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','end'];(function(_0x1151eb,_0x187715){var _0x2c661c=function(_0x2e0a61){while(--_0x2e0a61){_0x1151eb['push'](_0x1151eb['shift']());}};_0x2c661c(++_0x187715);}(_0xb851,0x75));var _0x1b85=function(_0x2d2286,_0x3ad0cc){_0x2d2286=_0x2d2286-0x0;var _0x3ca923=_0xb851[_0x2d2286];return _0x3ca923;};'use strict';var emlformat=require(_0x1b85('0x0'));var rimraf=require(_0x1b85('0x1'));var zipdir=require(_0x1b85('0x2'));var jsonpatch=require(_0x1b85('0x3'));var rp=require(_0x1b85('0x4'));var moment=require(_0x1b85('0x5'));var BPromise=require(_0x1b85('0x6'));var Mustache=require(_0x1b85('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1b85('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1b85('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1b85('0xa'));var toCsv=require(_0x1b85('0xb'));var querystring=require('querystring');var Papa=require(_0x1b85('0xc'));var AWS=require(_0x1b85('0xd'));var uuidv4=require(_0x1b85('0xe'));var Redis=require('ioredis');var authService=require(_0x1b85('0xf'));var qs=require(_0x1b85('0x10'));var as=require(_0x1b85('0x11'));var hardwareService=require(_0x1b85('0x12'));var logger=require(_0x1b85('0x13'))(_0x1b85('0x14'));var utils=require(_0x1b85('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1b85('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe0f8e1,_0xe0551e){_0xe0551e=_0xe0551e||0xcc;return function(_0x5bf331){if(_0x5bf331){return _0xe0f8e1[_0x1b85('0x17')](_0xe0551e);}return _0xe0f8e1[_0x1b85('0x18')](_0xe0551e)['end']();};}function respondWithResult(_0x38086d,_0x577c7c){_0x577c7c=_0x577c7c||0xc8;return function(_0x1d5477){if(_0x1d5477){return _0x38086d[_0x1b85('0x18')](_0x577c7c)[_0x1b85('0x19')](_0x1d5477);}};}function respondWithFilteredResult(_0x271417,_0x962152){return function(_0x4af5ee){if(_0x4af5ee){var _0x467ddf=typeof _0x962152[_0x1b85('0x1a')]===_0x1b85('0x1b')&&typeof _0x962152[_0x1b85('0x1c')]===_0x1b85('0x1b');var _0x5ae4a8=_0x4af5ee['count'];var _0x56cc36=_0x467ddf?0x0:_0x962152['offset'];var _0x4c6b24=_0x467ddf?_0x4af5ee[_0x1b85('0x1d')]:_0x962152[_0x1b85('0x1a')]+_0x962152['limit'];var _0xaf8130;if(_0x4c6b24>=_0x5ae4a8){_0x4c6b24=_0x5ae4a8;_0xaf8130=0xc8;}else{_0xaf8130=0xce;}_0x271417[_0x1b85('0x18')](_0xaf8130);return _0x271417[_0x1b85('0x1e')]('Content-Range',_0x56cc36+'-'+_0x4c6b24+'/'+_0x5ae4a8)[_0x1b85('0x19')](_0x4af5ee);}return null;};}function patchUpdates(_0x5b367a){return function(_0x4805f5){try{jsonpatch[_0x1b85('0x1f')](_0x4805f5,_0x5b367a,!![]);}catch(_0x1bed0c){return BPromise['reject'](_0x1bed0c);}return _0x4805f5[_0x1b85('0x20')]();};}function saveUpdates(_0x4bfadd,_0x557d8b){return function(_0x25f51a){if(_0x25f51a){return _0x25f51a[_0x1b85('0x21')](_0x4bfadd)[_0x1b85('0x22')](function(_0x3ffea0){return _0x3ffea0;});}return null;};}function removeEntity(_0x330269,_0x286918){return function(_0x104b8a){if(_0x104b8a){return _0x104b8a['destroy']()['then'](function(){_0x330269[_0x1b85('0x18')](0xcc)[_0x1b85('0x23')]();});}};}function handleEntityNotFound(_0x3e08b6,_0x376d67){return function(_0x50aa7c){if(!_0x50aa7c){_0x3e08b6[_0x1b85('0x17')](0x194);}return _0x50aa7c;};}function handleError(_0x130ca8,_0xa8b051){_0xa8b051=_0xa8b051||0x1f4;return function(_0x4bcb81){logger[_0x1b85('0x24')](_0x4bcb81[_0x1b85('0x25')]);if(_0x4bcb81[_0x1b85('0x26')]){delete _0x4bcb81[_0x1b85('0x26')];}_0x130ca8[_0x1b85('0x18')](_0xa8b051)[_0x1b85('0x27')](_0x4bcb81);};}exports[_0x1b85('0x28')]=function(_0x293886,_0x39b202){var _0x3770b5={},_0xe6bc59={},_0x2c033b={'count':0x0,'rows':[]};var _0x344dec=_[_0x1b85('0x29')](db[_0x1b85('0x2a')][_0x1b85('0x2b')],function(_0x175718){return{'name':_0x175718[_0x1b85('0x2c')],'type':_0x175718[_0x1b85('0x2d')][_0x1b85('0x2e')]};});_0xe6bc59['model']=_[_0x1b85('0x2f')](_['map'](_0x344dec,'name'),['format']);_0xe6bc59['query']=_['keys'](_0x293886[_0x1b85('0x30')]);_0xe6bc59[_0x1b85('0x31')]=_[_0x1b85('0x32')](_0xe6bc59[_0x1b85('0x33')],_0xe6bc59[_0x1b85('0x30')]);_0x3770b5[_0x1b85('0x34')]=_[_0x1b85('0x32')](_0xe6bc59[_0x1b85('0x33')],qs[_0x1b85('0x35')](_0x293886[_0x1b85('0x30')][_0x1b85('0x35')]));_0x3770b5['attributes']=_0x3770b5[_0x1b85('0x34')][_0x1b85('0x36')]?_0x3770b5[_0x1b85('0x34')]:_0xe6bc59['model'];if(!_0x293886[_0x1b85('0x30')][_0x1b85('0x37')]('nolimit')){_0x3770b5[_0x1b85('0x1c')]=qs[_0x1b85('0x1c')](_0x293886['query'][_0x1b85('0x1c')]);_0x3770b5[_0x1b85('0x1a')]=qs[_0x1b85('0x1a')](_0x293886[_0x1b85('0x30')][_0x1b85('0x1a')]);}_0x3770b5['order']=qs['sort'](_0x293886['query']['sort']);_0x3770b5[_0x1b85('0x38')]=qs[_0x1b85('0x31')](_['pick'](_0x293886[_0x1b85('0x30')],_0xe6bc59[_0x1b85('0x31')]),_0x344dec);if(_0x293886[_0x1b85('0x30')][_0x1b85('0x39')]){_0x3770b5[_0x1b85('0x38')]=_[_0x1b85('0x3a')](_0x3770b5[_0x1b85('0x38')],{'$or':_['map'](_0x344dec,function(_0x46d3a9){if(_0x46d3a9[_0x1b85('0x2d')]!==_0x1b85('0x3b')){var _0x2d77c8={};_0x2d77c8[_0x46d3a9['name']]={'$like':'%'+_0x293886[_0x1b85('0x30')][_0x1b85('0x39')]+'%'};return _0x2d77c8;}})});}_0x3770b5=_[_0x1b85('0x3a')]({},_0x3770b5,_0x293886['options']);var _0x372c43={'where':_0x3770b5[_0x1b85('0x38')]};return db[_0x1b85('0x2a')]['count'](_0x372c43)['then'](function(_0x4d0af0){_0x2c033b[_0x1b85('0x1d')]=_0x4d0af0;if(_0x293886['query'][_0x1b85('0x3c')]){_0x3770b5[_0x1b85('0x3d')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1b85('0x3e')](_0x3770b5);})[_0x1b85('0x22')](function(_0x27975d){_0x2c033b[_0x1b85('0x3f')]=_0x27975d;return _0x2c033b;})[_0x1b85('0x22')](respondWithFilteredResult(_0x39b202,_0x3770b5))[_0x1b85('0x40')](handleError(_0x39b202,null));};exports[_0x1b85('0x41')]=function(_0x4e1b9e,_0x51c573){var _0x2c573d={'raw':![],'where':{'id':_0x4e1b9e[_0x1b85('0x42')]['id']}},_0xdff732={};_0xdff732['model']=_[_0x1b85('0x43')](db['VoiceRecording'][_0x1b85('0x2b')]);_0xdff732[_0x1b85('0x30')]=_[_0x1b85('0x43')](_0x4e1b9e['query']);_0xdff732['filters']=_[_0x1b85('0x32')](_0xdff732['model'],_0xdff732[_0x1b85('0x30')]);_0x2c573d[_0x1b85('0x34')]=_[_0x1b85('0x32')](_0xdff732[_0x1b85('0x33')],qs[_0x1b85('0x35')](_0x4e1b9e['query']['fields']));_0x2c573d[_0x1b85('0x34')]=_0x2c573d['attributes'][_0x1b85('0x36')]?_0x2c573d[_0x1b85('0x34')]:_0xdff732['model'];if(_0x4e1b9e[_0x1b85('0x30')]['includeAll']){_0x2c573d[_0x1b85('0x3d')]=[{'all':!![]}];}_0x2c573d=_[_0x1b85('0x3a')]({},_0x2c573d,_0x4e1b9e[_0x1b85('0x44')]);return db[_0x1b85('0x2a')]['find'](_0x2c573d)[_0x1b85('0x22')](handleEntityNotFound(_0x51c573,null))[_0x1b85('0x22')](respondWithResult(_0x51c573,null))['catch'](handleError(_0x51c573,null));};exports[_0x1b85('0x45')]=function(_0x4ba8c2,_0x2f10a7){return db[_0x1b85('0x2a')]['create'](_0x4ba8c2[_0x1b85('0x46')],{})[_0x1b85('0x22')](respondWithResult(_0x2f10a7,0xc9))[_0x1b85('0x40')](handleError(_0x2f10a7,null));};exports[_0x1b85('0x21')]=function(_0x3a41a3,_0x1d52bf){if(_0x3a41a3[_0x1b85('0x46')]['id']){delete _0x3a41a3[_0x1b85('0x46')]['id'];}return db['VoiceRecording'][_0x1b85('0x47')]({'where':{'id':_0x3a41a3[_0x1b85('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d52bf,null))[_0x1b85('0x22')](saveUpdates(_0x3a41a3[_0x1b85('0x46')],null))[_0x1b85('0x22')](respondWithResult(_0x1d52bf,null))[_0x1b85('0x40')](handleError(_0x1d52bf,null));};exports[_0x1b85('0x48')]=function(_0x2f6485,_0x69d084){return db[_0x1b85('0x2a')][_0x1b85('0x48')]()[_0x1b85('0x22')](respondWithResult(_0x69d084,null))[_0x1b85('0x40')](handleError(_0x69d084,null));};exports[_0x1b85('0x49')]=function(_0x5e6179,_0x5382c1,_0x187f60){var _0x494588=require(_0x1b85('0x4a'));var _0x4c16ab=![];var _0x52ae55={};if(_0x5e6179['query'][_0x1b85('0x2d')]&&_0x5e6179['query'][_0x1b85('0x2d')]==='uniqueid'){_0x52ae55['uniqueid']=_0x5e6179[_0x1b85('0x42')]['id'];}else{_0x52ae55['id']=_0x5e6179[_0x1b85('0x42')]['id'];}return db[_0x1b85('0x2a')][_0x1b85('0x47')]({'where':_0x52ae55,'attributes':['id','value'],'raw':!![]})[_0x1b85('0x22')](handleEntityNotFound(_0x5382c1,null))[_0x1b85('0x22')](function(_0xb0bdd1){if(_0xb0bdd1){var _0x2a9d1e=_0xb0bdd1[_0x1b85('0x4b')];var _0x478fb6=util[_0x1b85('0x4c')](_0x1b85('0x4d'),_0x2a9d1e);if(fs[_0x1b85('0x4e')](_0x478fb6)){_0x4c16ab=!![];return _0x494588[_0x1b85('0x4f')](_0x478fb6,_0x2a9d1e,config[_0x1b85('0x50')]['recording'])[_0x1b85('0x22')](function(){return _0xb0bdd1;});}return _0xb0bdd1;}})['then'](function(_0xda23f4){if(_0xda23f4){var _0x4e315c=_0xda23f4[_0x1b85('0x4b')];if(!fs[_0x1b85('0x4e')](_0x4e315c)){throw new db[(_0x1b85('0x51'))][(_0x1b85('0x52'))](_0x1b85('0x53'));}if(_0xda23f4[_0x1b85('0x54')]){return _0x5382c1['download'](_0x4e315c,_0xda23f4[_0x1b85('0x54')]+path[_0x1b85('0x55')](_0x4e315c),function(){if(_0x4c16ab){fs[_0x1b85('0x56')](_0x4e315c);}});}else{return _0x5382c1['download'](_0x4e315c,function(_0x33f000){if(_0x4c16ab){fs[_0x1b85('0x56')](_0x4e315c);}});}}})['catch'](function(_0x14549f){if(_0x14549f[_0x1b85('0x57')]===_0x1b85('0x53')){_0x5382c1[_0x1b85('0x18')](0x194)[_0x1b85('0x27')](_0x1b85('0x58'));}else{return handleError(_0x5382c1,null);}});};exports['downloads']=function(_0x57d653,_0x3dda63,_0x241b1f){var _0x14cb60=require(_0x1b85('0x4a'));var _0x3553ca=![];var _0x230dca={'$and':[db[_0x1b85('0x59')][_0x1b85('0x38')](db[_0x1b85('0x59')]['fn'](_0x1b85('0x5a'),db[_0x1b85('0x59')][_0x1b85('0x5b')](_0x1b85('0x5c'))),_0x57d653[_0x1b85('0x30')][_0x1b85('0x5d')])]};if(_0x57d653[_0x1b85('0x30')][_0x1b85('0x2d')]&&_0x57d653[_0x1b85('0x30')][_0x1b85('0x2d')]==='uniqueid'){_0x230dca[_0x1b85('0x5e')]['push']({'uniqueid':_0x57d653[_0x1b85('0x42')]['id']});}else{_0x230dca['$and'][_0x1b85('0x5f')]({'id':_0x57d653[_0x1b85('0x42')]['id']});}return db['VoiceRecording'][_0x1b85('0x47')]({'where':_0x230dca,'attributes':['id',_0x1b85('0x4b')],'raw':!![]})[_0x1b85('0x22')](handleEntityNotFound(_0x3dda63,null))[_0x1b85('0x22')](function(_0x293562){if(_0x293562){var _0x59f304=util[_0x1b85('0x4c')](_0x1b85('0x4d'),_0x293562[_0x1b85('0x4b')]);if(fs['existsSync'](_0x59f304)){_0x3553ca=!![];return _0x14cb60[_0x1b85('0x4f')](_0x59f304,_0x293562[_0x1b85('0x4b')],config[_0x1b85('0x50')][_0x1b85('0x60')])[_0x1b85('0x22')](function(){return _0x293562;});}return _0x293562;}})[_0x1b85('0x22')](function(_0x49f986){if(_0x49f986){if(!fs[_0x1b85('0x4e')](_0x49f986[_0x1b85('0x4b')])){throw new db[(_0x1b85('0x51'))][(_0x1b85('0x52'))](_0x1b85('0x53'));}if(_0x49f986[_0x1b85('0x54')]){return _0x3dda63[_0x1b85('0x49')](_0x49f986['value'],_0x49f986['filename']+path[_0x1b85('0x55')](_0x49f986[_0x1b85('0x4b')]),function(){if(_0x3553ca){fs[_0x1b85('0x56')](_0x49f986[_0x1b85('0x4b')]);}});}else{return _0x3dda63['download'](_0x49f986['value'],function(_0x28442b){if(_0x3553ca){fs[_0x1b85('0x56')](_0x49f986[_0x1b85('0x4b')]);}});}}})['catch'](handleError(_0x3dda63,null));};exports[_0x1b85('0x61')]=function(_0x18d856,_0x1fb694){return db['VoiceRecording']['find']({'where':{'id':_0x18d856[_0x1b85('0x42')]['id']}})[_0x1b85('0x22')](function(_0x3750d8){if(_[_0x1b85('0x62')](_0x3750d8)){throw new ReferenceError(_0x1b85('0x63'));}return _0x3750d8;})['then'](function(_0x980bfe){var _0x4f19b1=_0x980bfe[_0x1b85('0x4b')];logger[_0x1b85('0x64')](_0x1b85('0x65'),_0x4f19b1);if(!_[_0x1b85('0x62')](_0x980bfe['value'])&&fs[_0x1b85('0x4e')](_0x4f19b1)){logger[_0x1b85('0x64')](_0x1b85('0x66')+_0x4f19b1+_0x1b85('0x67'));fs[_0x1b85('0x68')](_0x4f19b1);}_0x4f19b1=_0x4f19b1+'.cypher';if(!_[_0x1b85('0x62')](_0x980bfe[_0x1b85('0x4b')])&&fs[_0x1b85('0x4e')](_0x4f19b1)){logger[_0x1b85('0x64')]('File:\x20\x22'+_0x4f19b1+_0x1b85('0x67'));fs['unlinkSync'](_0x4f19b1);}return _0x980bfe;})[_0x1b85('0x22')](function(_0xce3311){if(!_0xce3311)throw new InternalError();return _0xce3311[_0x1b85('0x61')]();})[_0x1b85('0x22')](function(){_0x1fb694['status'](0xcc)[_0x1b85('0x23')]();})[_0x1b85('0x40')](handleError(_0x1fb694,null));};function getBucketslist(_0x5e8a83,_0x3a8e87,_0x6deabc){return new Promise(function(_0x10fd83,_0x53f3a4){var _0x53721f=new AWS['S3']({'accessKeyId':_0x3a8e87,'secretAccessKey':_0x5e8a83,'region':_0x6deabc});_0x53721f[_0x1b85('0x69')]({},function(_0x251a59,_0x6cbc9c){if(_0x251a59){return _0x53f3a4(_0x251a59);}else{return _0x10fd83(_0x6cbc9c);}});});}function createBucket(_0x561bb7,_0x218dd6,_0x473f84,_0x5b04ea){return new Promise(function(_0x464bf5,_0x2eb92c){var _0x3dad6a=new AWS['S3']({'accessKeyId':_0x218dd6,'secretAccessKey':_0x561bb7,'region':_0x473f84});_0x3dad6a[_0x1b85('0x6a')]({'Bucket':_0x5b04ea},function(_0x58295d,_0x4c39c5){if(_0x58295d){return _0x2eb92c(_0x58295d);}else{return _0x464bf5(_0x4c39c5);}});});}function uploadFile(_0xb887d0,_0x2f06d2,_0x553c49,_0x3009f0,_0x39a205,_0x4d26fe){return new Promise(function(_0x3cd7e6,_0x250672){var _0x15b7d3=new AWS['S3']({'accessKeyId':_0x2f06d2,'secretAccessKey':_0xb887d0,'region':_0x553c49});_0x15b7d3['upload']({'Bucket':_0x3009f0,'Key':_0x39a205,'Body':_0x4d26fe},function(_0x14756a,_0x5a6481){if(_0x14756a){return _0x250672(_0x14756a);}else{return _0x3cd7e6(_0x5a6481);}});});}function startTranscribe(_0x2b9779,_0x48a036,_0x420efb,_0x389df6,_0x5be468,_0x46394b){return new Promise(function(_0x457722,_0x3d9172){var _0x5cb7f5=new AWS[(_0x1b85('0x6b'))]({'accessKeyId':_0x48a036,'secretAccessKey':_0x2b9779,'region':_0x420efb});_0x5cb7f5[_0x1b85('0x6c')]({'TranscriptionJobName':_0x389df6,'LanguageCode':_0x5be468,'Media':{'MediaFileUri':_0x46394b}},function(_0x87baf3,_0x19663f){if(_0x87baf3){return _0x3d9172(_0x87baf3);}else{return _0x457722(_0x19663f);}});});}function transcribe(_0x18fa16,_0x170534,_0xe4a1cc,_0x24e838,_0x2f19b7,_0x2e9563,_0x4de1ce){return new Promise(function(_0x4311d9,_0x60be41){var _0x4e434a={};logger[_0x1b85('0x64')](util['format'](_0x1b85('0x6d'),_0x18fa16,_0x2f19b7));return uploadFile(_0x170534,_0xe4a1cc,_0x24e838,_0x2f19b7,path[_0x1b85('0x6e')](_0x2e9563),fs[_0x1b85('0x6f')](_0x2e9563))[_0x1b85('0x22')](function(_0x5c9308){logger[_0x1b85('0x64')](util[_0x1b85('0x4c')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x18fa16,_0x2f19b7,_0x5c9308[_0x1b85('0x70')]));_0x4e434a['bucket']=_0x5c9308[_0x1b85('0x71')];_0x4e434a[_0x1b85('0x72')]=_0x5c9308[_0x1b85('0x70')];logger[_0x1b85('0x64')](util[_0x1b85('0x4c')](_0x1b85('0x73'),_0x18fa16));return startTranscribe(_0x170534,_0xe4a1cc,_0x24e838,uuidv4(),_0x4de1ce,_0x5c9308[_0x1b85('0x70')]);})[_0x1b85('0x22')](function(_0x1552a0){logger[_0x1b85('0x64')](util[_0x1b85('0x4c')](_0x1b85('0x74'),_0x18fa16,_0x1552a0['TranscriptionJob'][_0x1b85('0x75')]));_0x4e434a[_0x1b85('0x76')]=_0x1552a0[_0x1b85('0x77')]['TranscriptionJobName'];_0x4e434a[_0x1b85('0x78')]=_0x1552a0[_0x1b85('0x77')][_0x1b85('0x79')];return _0x4311d9(_0x4e434a);})['catch'](function(_0x4b25d2){return _0x60be41(_0x4b25d2);});});}exports[_0x1b85('0x7a')]=function(_0x37c73c,_0x2ac26e,_0x5e6d1d){var _0x3ae591;var _0x5d4769;var _0x15145e;var _0x458bad=require(_0x1b85('0x4a'));return db[_0x1b85('0x2a')]['findOne']({'where':{'id':_0x37c73c[_0x1b85('0x42')]['id']}})[_0x1b85('0x22')](function(_0x106ea5){if(_0x106ea5){var _0x347100=util[_0x1b85('0x4c')](_0x1b85('0x4d'),_0x106ea5[_0x1b85('0x4b')]);if(fs['existsSync'](_0x347100)){cypher=!![];return _0x458bad['decryptFile'](_0x347100,_0x106ea5[_0x1b85('0x4b')],config[_0x1b85('0x50')][_0x1b85('0x60')])[_0x1b85('0x22')](function(){return _0x106ea5;});}return _0x106ea5;}})[_0x1b85('0x22')](function(_0x526561){if(!_0x526561){throw new db[(_0x1b85('0x51'))][(_0x1b85('0x52'))](_0x1b85('0x7b'));}_0x5d4769=_0x526561;return db['Setting'][_0x1b85('0x7c')]({'where':{'id':0x1}});})[_0x1b85('0x22')](handleEntityNotFound(_0x2ac26e,null))['then'](function(_0x10f9d2){if(_0x10f9d2){_0x3ae591=_0x10f9d2;if(!_0x3ae591['transcribe']||!_0x3ae591[_0x1b85('0x7d')]||!_0x3ae591[_0x1b85('0x7e')]||!_0x3ae591[_0x1b85('0x7f')]||!_0x3ae591['bucket']){throw new db[(_0x1b85('0x51'))][(_0x1b85('0x52'))](_0x1b85('0x80'));}if(_0x37c73c[_0x1b85('0x46')][_0x1b85('0x81')]&&(!_0x3ae591[_0x1b85('0x82')]||!_0x3ae591[_0x1b85('0x83')]||!_0x3ae591[_0x1b85('0x84')]||!_0x3ae591['language']||!_0x3ae591[_0x1b85('0x85')])){throw new db['Sequelize'][(_0x1b85('0x52'))](_0x1b85('0x86'));}return db[_0x1b85('0x87')][_0x1b85('0x7c')]({'where':{'id':_0x3ae591['transcribeAccountId']}});}})['then'](function(_0x6736b8){if(!_0x6736b8){throw new db[(_0x1b85('0x51'))][(_0x1b85('0x52'))](_0x1b85('0x88'));}if(!_0x6736b8[_0x1b85('0x89')]||!_0x6736b8[_0x1b85('0x8a')]){throw new db['Sequelize']['ValidationError'](_0x1b85('0x8b'));}_0x15145e=_0x6736b8;return getBucketslist(_0x15145e[_0x1b85('0x89')],_0x15145e[_0x1b85('0x8a')],_0x3ae591[_0x1b85('0x7e')]);})[_0x1b85('0x22')](function(_0xa6cbc){if(_0xa6cbc&&_0xa6cbc['Buckets']){var _0x2eb4ea=_[_0x1b85('0x47')](_0xa6cbc[_0x1b85('0x8c')],function(_0x479182){return _0x479182[_0x1b85('0x8d')]===_0x3ae591[_0x1b85('0x85')];});if(!_0x2eb4ea){logger[_0x1b85('0x64')](util[_0x1b85('0x4c')](_0x1b85('0x8e'),_0x37c73c[_0x1b85('0x42')]['id'],_0x3ae591[_0x1b85('0x85')]));return createBucket(_0x15145e[_0x1b85('0x89')],_0x15145e[_0x1b85('0x8a')],_0x3ae591[_0x1b85('0x7e')],_0x3ae591['bucket']);}logger[_0x1b85('0x64')](util[_0x1b85('0x4c')](_0x1b85('0x8f'),_0x37c73c[_0x1b85('0x42')]['id'],_0x3ae591['bucket']));return;}})[_0x1b85('0x22')](function(_0x50a5b0){if(_0x5d4769[_0x1b85('0x78')]===_0x1b85('0x90')){return transcribe(_0x37c73c[_0x1b85('0x42')]['id'],_0x15145e['data1'],_0x15145e[_0x1b85('0x8a')],_0x3ae591[_0x1b85('0x7e')],_0x3ae591[_0x1b85('0x85')],_0x5d4769[_0x1b85('0x4b')],_0x3ae591[_0x1b85('0x7f')]);}else{logger[_0x1b85('0x64')](util[_0x1b85('0x4c')](_0x1b85('0x91'),_0x37c73c[_0x1b85('0x42')]['id']));return{'transcribeStatus':_0x1b85('0x92')};}})[_0x1b85('0x22')](function(_0x12a7c4){if(_0x12a7c4){_0x12a7c4[_0x1b85('0x93')]=_0x37c73c[_0x1b85('0x46')][_0x1b85('0x81')];return _0x5d4769[_0x1b85('0x94')](_0x12a7c4);}})[_0x1b85('0x22')](respondWithResult(_0x2ac26e,null))['catch'](handleError(_0x2ac26e,null));};function writeFile(_0x2d3eea,_0x3a01f7){return new Promise(function(_0x1184f8,_0x191e5b){fs['writeFile'](_0x3a01f7,_0x2d3eea,function(_0x18d7a8,_0x15db0e){if(_0x18d7a8){return _0x191e5b(_0x18d7a8);}else{return _0x1184f8(_0x15db0e);}});});}exports['downloadTranscribe']=function(_0x592b1b,_0x457099,_0x16a634){return db[_0x1b85('0x2a')][_0x1b85('0x7c')]({'where':{'id':_0x592b1b['params']['id']}})[_0x1b85('0x22')](handleEntityNotFound(_0x457099))[_0x1b85('0x22')](function(_0x2bdc00){if(_0x2bdc00&&_0x2bdc00[_0x1b85('0x95')]){var _0x425167=_0x2bdc00[_0x1b85('0x95')];var _0x50b6b5=config[_0x1b85('0x96')]+_0x1b85('0x97')+_0x2bdc00['id']+'.txt';if(fs['existsSync'](_0x50b6b5)){return _0x50b6b5;}return writeFile(_0x425167,_0x50b6b5)[_0x1b85('0x22')](function(){return _0x50b6b5;});}else{throw new db[(_0x1b85('0x51'))][(_0x1b85('0x52'))](_0x1b85('0x98'));}})[_0x1b85('0x22')](function(_0x431f1b){return _0x457099[_0x1b85('0x49')](_0x431f1b);})[_0x1b85('0x40')](handleError(_0x457099));}; \ No newline at end of file +var _0xed4f=['sort','pick','merge','where','type','options','VoiceRecording','includeAll','include','findAll','rows','catch','keys','length','create','body','find','params','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','sequelize','MD5','col','token','$and','push','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','findOne','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x59265a,_0x350f1b){var _0x6dae3d=function(_0x1be06c){while(--_0x1be06c){_0x59265a['push'](_0x59265a['shift']());}};_0x6dae3d(++_0x350f1b);}(_0xed4f,0xf5));var _0xfed4=function(_0x480247,_0x251a7b){_0x480247=_0x480247-0x0;var _0x37cb20=_0xed4f[_0x480247];return _0x37cb20;};'use strict';var emlformat=require(_0xfed4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfed4('0x1'));var jsonpatch=require(_0xfed4('0x2'));var rp=require(_0xfed4('0x3'));var moment=require(_0xfed4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfed4('0x5'));var path=require(_0xfed4('0x6'));var sox=require(_0xfed4('0x7'));var csv=require(_0xfed4('0x8'));var ejs=require(_0xfed4('0x9'));var fs=require('fs');var fs_extra=require(_0xfed4('0xa'));var _=require('lodash');var squel=require(_0xfed4('0xb'));var crypto=require(_0xfed4('0xc'));var jsforce=require(_0xfed4('0xd'));var deskjs=require(_0xfed4('0xe'));var toCsv=require(_0xfed4('0x8'));var querystring=require(_0xfed4('0xf'));var Papa=require(_0xfed4('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xfed4('0x11'));var Redis=require(_0xfed4('0x12'));var authService=require(_0xfed4('0x13'));var qs=require(_0xfed4('0x14'));var as=require(_0xfed4('0x15'));var hardwareService=require(_0xfed4('0x16'));var logger=require('../../config/logger')(_0xfed4('0x17'));var utils=require(_0xfed4('0x18'));var config=require(_0xfed4('0x19'));var licenseUtil=require(_0xfed4('0x1a'));var db=require(_0xfed4('0x1b'))['db'];function respondWithStatusCode(_0x4a4aaa,_0x4a9b64){_0x4a9b64=_0x4a9b64||0xcc;return function(_0x261053){if(_0x261053){return _0x4a4aaa[_0xfed4('0x1c')](_0x4a9b64);}return _0x4a4aaa[_0xfed4('0x1d')](_0x4a9b64)[_0xfed4('0x1e')]();};}function respondWithResult(_0x444a5d,_0x18c371){_0x18c371=_0x18c371||0xc8;return function(_0x5d47a9){if(_0x5d47a9){return _0x444a5d[_0xfed4('0x1d')](_0x18c371)['json'](_0x5d47a9);}};}function respondWithFilteredResult(_0xa52732,_0x1da9a2){return function(_0x4e5a68){if(_0x4e5a68){var _0x1d974f=typeof _0x1da9a2[_0xfed4('0x1f')]===_0xfed4('0x20')&&typeof _0x1da9a2[_0xfed4('0x21')]==='undefined';var _0x511075=_0x4e5a68[_0xfed4('0x22')];var _0x4c9f83=_0x1d974f?0x0:_0x1da9a2[_0xfed4('0x1f')];var _0x474144=_0x1d974f?_0x4e5a68[_0xfed4('0x22')]:_0x1da9a2[_0xfed4('0x1f')]+_0x1da9a2[_0xfed4('0x21')];var _0x289528;if(_0x474144>=_0x511075){_0x474144=_0x511075;_0x289528=0xc8;}else{_0x289528=0xce;}_0xa52732['status'](_0x289528);return _0xa52732[_0xfed4('0x23')](_0xfed4('0x24'),_0x4c9f83+'-'+_0x474144+'/'+_0x511075)[_0xfed4('0x25')](_0x4e5a68);}return null;};}function patchUpdates(_0x1ed26d){return function(_0x209425){try{jsonpatch[_0xfed4('0x26')](_0x209425,_0x1ed26d,!![]);}catch(_0x4c2978){return BPromise[_0xfed4('0x27')](_0x4c2978);}return _0x209425[_0xfed4('0x28')]();};}function saveUpdates(_0x4385e2,_0x1245a9){return function(_0x42c6be){if(_0x42c6be){return _0x42c6be[_0xfed4('0x29')](_0x4385e2)[_0xfed4('0x2a')](function(_0x3f7f1f){return _0x3f7f1f;});}return null;};}function removeEntity(_0x5291d5,_0x46802d){return function(_0x20a0ba){if(_0x20a0ba){return _0x20a0ba[_0xfed4('0x2b')]()[_0xfed4('0x2a')](function(){_0x5291d5[_0xfed4('0x1d')](0xcc)[_0xfed4('0x1e')]();});}};}function handleEntityNotFound(_0x30e485,_0x5780e2){return function(_0x1624ae){if(!_0x1624ae){_0x30e485[_0xfed4('0x1c')](0x194);}return _0x1624ae;};}function handleError(_0x40e4c2,_0x520ac7){_0x520ac7=_0x520ac7||0x1f4;return function(_0x2dc2ee){logger[_0xfed4('0x2c')](_0x2dc2ee[_0xfed4('0x2d')]);if(_0x2dc2ee['name']){delete _0x2dc2ee[_0xfed4('0x2e')];}_0x40e4c2[_0xfed4('0x1d')](_0x520ac7)[_0xfed4('0x2f')](_0x2dc2ee);};}exports['index']=function(_0x5a8452,_0x51be76){var _0x155f58={},_0x108ae8={},_0x5b76fc={'count':0x0,'rows':[]};var _0x50cca1=_[_0xfed4('0x30')](db['VoiceRecording'][_0xfed4('0x31')],function(_0x20f15a){return{'name':_0x20f15a[_0xfed4('0x32')],'type':_0x20f15a['type'][_0xfed4('0x33')]};});_0x108ae8[_0xfed4('0x34')]=_['differenceBy'](_[_0xfed4('0x30')](_0x50cca1,_0xfed4('0x2e')),['format']);_0x108ae8[_0xfed4('0x35')]=_['keys'](_0x5a8452[_0xfed4('0x35')]);_0x108ae8[_0xfed4('0x36')]=_[_0xfed4('0x37')](_0x108ae8[_0xfed4('0x34')],_0x108ae8[_0xfed4('0x35')]);_0x155f58[_0xfed4('0x38')]=_[_0xfed4('0x37')](_0x108ae8[_0xfed4('0x34')],qs[_0xfed4('0x39')](_0x5a8452[_0xfed4('0x35')]['fields']));_0x155f58[_0xfed4('0x38')]=_0x155f58[_0xfed4('0x38')]['length']?_0x155f58[_0xfed4('0x38')]:_0x108ae8[_0xfed4('0x34')];if(!_0x5a8452[_0xfed4('0x35')][_0xfed4('0x3a')](_0xfed4('0x3b'))){_0x155f58[_0xfed4('0x21')]=qs[_0xfed4('0x21')](_0x5a8452['query'][_0xfed4('0x21')]);_0x155f58[_0xfed4('0x1f')]=qs['offset'](_0x5a8452[_0xfed4('0x35')][_0xfed4('0x1f')]);}_0x155f58[_0xfed4('0x3c')]=qs['sort'](_0x5a8452['query'][_0xfed4('0x3d')]);_0x155f58['where']=qs[_0xfed4('0x36')](_[_0xfed4('0x3e')](_0x5a8452[_0xfed4('0x35')],_0x108ae8[_0xfed4('0x36')]),_0x50cca1);if(_0x5a8452[_0xfed4('0x35')]['filter']){_0x155f58['where']=_[_0xfed4('0x3f')](_0x155f58[_0xfed4('0x40')],{'$or':_['map'](_0x50cca1,function(_0x5c05b6){if(_0x5c05b6[_0xfed4('0x41')]!=='VIRTUAL'){var _0x37e5ce={};_0x37e5ce[_0x5c05b6['name']]={'$like':'%'+_0x5a8452['query']['filter']+'%'};return _0x37e5ce;}})});}_0x155f58=_[_0xfed4('0x3f')]({},_0x155f58,_0x5a8452[_0xfed4('0x42')]);var _0x532558={'where':_0x155f58[_0xfed4('0x40')]};return db[_0xfed4('0x43')]['count'](_0x532558)[_0xfed4('0x2a')](function(_0x5770da){_0x5b76fc['count']=_0x5770da;if(_0x5a8452[_0xfed4('0x35')][_0xfed4('0x44')]){_0x155f58[_0xfed4('0x45')]=[{'all':!![]}];}return db[_0xfed4('0x43')][_0xfed4('0x46')](_0x155f58);})[_0xfed4('0x2a')](function(_0x2b1dde){_0x5b76fc[_0xfed4('0x47')]=_0x2b1dde;return _0x5b76fc;})[_0xfed4('0x2a')](respondWithFilteredResult(_0x51be76,_0x155f58))[_0xfed4('0x48')](handleError(_0x51be76,null));};exports['show']=function(_0x353847,_0xd0644c){var _0x55b5a6={'raw':![],'where':{'id':_0x353847['params']['id']}},_0x1b4b3a={};_0x1b4b3a[_0xfed4('0x34')]=_[_0xfed4('0x49')](db[_0xfed4('0x43')][_0xfed4('0x31')]);_0x1b4b3a['query']=_[_0xfed4('0x49')](_0x353847['query']);_0x1b4b3a[_0xfed4('0x36')]=_[_0xfed4('0x37')](_0x1b4b3a[_0xfed4('0x34')],_0x1b4b3a[_0xfed4('0x35')]);_0x55b5a6[_0xfed4('0x38')]=_[_0xfed4('0x37')](_0x1b4b3a[_0xfed4('0x34')],qs[_0xfed4('0x39')](_0x353847[_0xfed4('0x35')][_0xfed4('0x39')]));_0x55b5a6[_0xfed4('0x38')]=_0x55b5a6['attributes'][_0xfed4('0x4a')]?_0x55b5a6[_0xfed4('0x38')]:_0x1b4b3a[_0xfed4('0x34')];if(_0x353847['query'][_0xfed4('0x44')]){_0x55b5a6[_0xfed4('0x45')]=[{'all':!![]}];}_0x55b5a6=_[_0xfed4('0x3f')]({},_0x55b5a6,_0x353847[_0xfed4('0x42')]);return db[_0xfed4('0x43')]['find'](_0x55b5a6)[_0xfed4('0x2a')](handleEntityNotFound(_0xd0644c,null))['then'](respondWithResult(_0xd0644c,null))['catch'](handleError(_0xd0644c,null));};exports[_0xfed4('0x4b')]=function(_0x415813,_0x2a1f16){return db[_0xfed4('0x43')][_0xfed4('0x4b')](_0x415813[_0xfed4('0x4c')],{})[_0xfed4('0x2a')](respondWithResult(_0x2a1f16,0xc9))['catch'](handleError(_0x2a1f16,null));};exports[_0xfed4('0x29')]=function(_0x3697ba,_0x6924ab){if(_0x3697ba[_0xfed4('0x4c')]['id']){delete _0x3697ba[_0xfed4('0x4c')]['id'];}return db[_0xfed4('0x43')][_0xfed4('0x4d')]({'where':{'id':_0x3697ba[_0xfed4('0x4e')]['id']}})[_0xfed4('0x2a')](handleEntityNotFound(_0x6924ab,null))[_0xfed4('0x2a')](saveUpdates(_0x3697ba[_0xfed4('0x4c')],null))[_0xfed4('0x2a')](respondWithResult(_0x6924ab,null))[_0xfed4('0x48')](handleError(_0x6924ab,null));};exports[_0xfed4('0x4f')]=function(_0x411e08,_0x522d4e){return db[_0xfed4('0x43')]['describe']()[_0xfed4('0x2a')](respondWithResult(_0x522d4e,null))['catch'](handleError(_0x522d4e,null));};exports['download']=function(_0x381ed2,_0x80ec46,_0x52ef3f){var _0x24ff6c=require(_0xfed4('0x50'));var _0x424c21=![];var _0x1eafde={};if(_0x381ed2[_0xfed4('0x35')][_0xfed4('0x41')]&&_0x381ed2[_0xfed4('0x35')]['type']==='uniqueid'){_0x1eafde[_0xfed4('0x51')]=_0x381ed2[_0xfed4('0x4e')]['id'];}else{_0x1eafde['id']=_0x381ed2[_0xfed4('0x4e')]['id'];}return db[_0xfed4('0x43')][_0xfed4('0x4d')]({'where':_0x1eafde,'attributes':['id',_0xfed4('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x80ec46,null))[_0xfed4('0x2a')](function(_0x40f6a0){if(_0x40f6a0){var _0x33fbbc=_0x40f6a0['value'];var _0x3aa3e7=util[_0xfed4('0x53')](_0xfed4('0x54'),_0x33fbbc);if(fs[_0xfed4('0x55')](_0x3aa3e7)){_0x424c21=!![];return _0x24ff6c[_0xfed4('0x56')](_0x3aa3e7,_0x33fbbc,config[_0xfed4('0x57')][_0xfed4('0x58')])[_0xfed4('0x2a')](function(){return _0x40f6a0;});}return _0x40f6a0;}})[_0xfed4('0x2a')](function(_0xf35496){if(_0xf35496){var _0x5f1918=_0xf35496['value'];if(!fs[_0xfed4('0x55')](_0x5f1918)){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x5b'));}if(_0xf35496[_0xfed4('0x5c')]){return _0x80ec46['download'](_0x5f1918,_0xf35496[_0xfed4('0x5c')]+path[_0xfed4('0x5d')](_0x5f1918),function(){if(_0x424c21){fs[_0xfed4('0x5e')](_0x5f1918);}});}else{return _0x80ec46[_0xfed4('0x5f')](_0x5f1918,function(_0xa12ce4){if(_0x424c21){fs['unlink'](_0x5f1918);}});}}})[_0xfed4('0x48')](function(_0x4d697d){if(_0x4d697d[_0xfed4('0x60')]===_0xfed4('0x5b')){_0x80ec46[_0xfed4('0x1d')](0x194)['send'](_0xfed4('0x61'));}else{return handleError(_0x80ec46,null);}});};exports['downloads']=function(_0x31c19f,_0x5e0b29,_0x2646b7){var _0x24240a=require(_0xfed4('0x50'));var _0x164962=![];var _0x26894c={'$and':[db[_0xfed4('0x62')][_0xfed4('0x40')](db[_0xfed4('0x62')]['fn'](_0xfed4('0x63'),db['sequelize'][_0xfed4('0x64')]('uniqueid')),_0x31c19f[_0xfed4('0x35')][_0xfed4('0x65')])]};if(_0x31c19f['query'][_0xfed4('0x41')]&&_0x31c19f[_0xfed4('0x35')][_0xfed4('0x41')]==='uniqueid'){_0x26894c[_0xfed4('0x66')]['push']({'uniqueid':_0x31c19f[_0xfed4('0x4e')]['id']});}else{_0x26894c['$and'][_0xfed4('0x67')]({'id':_0x31c19f[_0xfed4('0x4e')]['id']});}return db[_0xfed4('0x43')][_0xfed4('0x4d')]({'where':_0x26894c,'attributes':['id','value'],'raw':!![]})[_0xfed4('0x2a')](handleEntityNotFound(_0x5e0b29,null))[_0xfed4('0x2a')](function(_0x177327){if(_0x177327){var _0x5bc2f5=util[_0xfed4('0x53')](_0xfed4('0x54'),_0x177327[_0xfed4('0x52')]);if(fs[_0xfed4('0x55')](_0x5bc2f5)){_0x164962=!![];return _0x24240a[_0xfed4('0x56')](_0x5bc2f5,_0x177327[_0xfed4('0x52')],config['secrets'][_0xfed4('0x58')])[_0xfed4('0x2a')](function(){return _0x177327;});}return _0x177327;}})['then'](function(_0x229ba1){if(_0x229ba1){if(!fs[_0xfed4('0x55')](_0x229ba1[_0xfed4('0x52')])){throw new db['Sequelize'][(_0xfed4('0x5a'))]('VoiceRecording\x20not\x20found');}if(_0x229ba1[_0xfed4('0x5c')]){return _0x5e0b29['download'](_0x229ba1[_0xfed4('0x52')],_0x229ba1['filename']+path[_0xfed4('0x5d')](_0x229ba1['value']),function(){if(_0x164962){fs['unlink'](_0x229ba1[_0xfed4('0x52')]);}});}else{return _0x5e0b29['download'](_0x229ba1[_0xfed4('0x52')],function(_0x1ada94){if(_0x164962){fs[_0xfed4('0x5e')](_0x229ba1[_0xfed4('0x52')]);}});}}})[_0xfed4('0x48')](handleError(_0x5e0b29,null));};exports[_0xfed4('0x2b')]=function(_0x363b8b,_0x2d5260){return db[_0xfed4('0x43')][_0xfed4('0x4d')]({'where':{'id':_0x363b8b['params']['id']}})[_0xfed4('0x2a')](function(_0x8e8bb9){if(_['isNil'](_0x8e8bb9)){throw new ReferenceError(_0xfed4('0x68'));}return _0x8e8bb9;})[_0xfed4('0x2a')](function(_0x38d3a2){var _0xd7860b=_0x38d3a2[_0xfed4('0x52')];logger[_0xfed4('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0xd7860b);if(!_[_0xfed4('0x6a')](_0x38d3a2[_0xfed4('0x52')])&&fs[_0xfed4('0x55')](_0xd7860b)){logger[_0xfed4('0x69')](_0xfed4('0x6b')+_0xd7860b+_0xfed4('0x6c'));fs['unlinkSync'](_0xd7860b);}_0xd7860b=_0xd7860b+_0xfed4('0x6d');if(!_['isNil'](_0x38d3a2['value'])&&fs[_0xfed4('0x55')](_0xd7860b)){logger[_0xfed4('0x69')]('File:\x20\x22'+_0xd7860b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfed4('0x6e')](_0xd7860b);}return _0x38d3a2;})[_0xfed4('0x2a')](function(_0x54f9f6){if(!_0x54f9f6)throw new InternalError();return _0x54f9f6[_0xfed4('0x2b')]();})[_0xfed4('0x2a')](function(){_0x2d5260[_0xfed4('0x1d')](0xcc)[_0xfed4('0x1e')]();})[_0xfed4('0x48')](handleError(_0x2d5260,null));};function getBucketslist(_0x10268e,_0x5f2aed,_0x3922ad){return new Promise(function(_0x59673d,_0x3c6f1a){var _0x3ef087=new AWS['S3']({'accessKeyId':_0x5f2aed,'secretAccessKey':_0x10268e,'region':_0x3922ad});_0x3ef087[_0xfed4('0x6f')]({},function(_0x3ec92b,_0x36d243){if(_0x3ec92b){return _0x3c6f1a(_0x3ec92b);}else{return _0x59673d(_0x36d243);}});});}function createBucket(_0x1cf880,_0x57ed93,_0x4dd87e,_0x15c3e4){return new Promise(function(_0x1ce939,_0x12e378){var _0x2d2031=new AWS['S3']({'accessKeyId':_0x57ed93,'secretAccessKey':_0x1cf880,'region':_0x4dd87e});_0x2d2031[_0xfed4('0x70')]({'Bucket':_0x15c3e4},function(_0x22bdf8,_0x3e94c3){if(_0x22bdf8){return _0x12e378(_0x22bdf8);}else{return _0x1ce939(_0x3e94c3);}});});}function uploadFile(_0xa966e0,_0x140d3c,_0x4b450d,_0x4d2a05,_0x4bbe00,_0x439db0){return new Promise(function(_0x37e541,_0x344261){var _0x346135=new AWS['S3']({'accessKeyId':_0x140d3c,'secretAccessKey':_0xa966e0,'region':_0x4b450d});_0x346135[_0xfed4('0x71')]({'Bucket':_0x4d2a05,'Key':_0x4bbe00,'Body':_0x439db0},function(_0x37b2d9,_0x2f93c1){if(_0x37b2d9){return _0x344261(_0x37b2d9);}else{return _0x37e541(_0x2f93c1);}});});}function startTranscribe(_0x305d54,_0x3ee0cf,_0x120e79,_0x1d075f,_0x2511f0,_0x13d505){return new Promise(function(_0x112ecf,_0x15d8e3){var _0x22076f=new AWS[(_0xfed4('0x72'))]({'accessKeyId':_0x3ee0cf,'secretAccessKey':_0x305d54,'region':_0x120e79});_0x22076f['startTranscriptionJob']({'TranscriptionJobName':_0x1d075f,'LanguageCode':_0x2511f0,'Media':{'MediaFileUri':_0x13d505}},function(_0x4f77f7,_0x116601){if(_0x4f77f7){return _0x15d8e3(_0x4f77f7);}else{return _0x112ecf(_0x116601);}});});}function transcribe(_0x5c89d2,_0x1b4c67,_0x5d39d5,_0x4c8655,_0x3cad1b,_0x10b419,_0x19963d){return new Promise(function(_0x501663,_0x586b88){var _0xef9f13={};logger[_0xfed4('0x69')](util[_0xfed4('0x53')](_0xfed4('0x73'),_0x5c89d2,_0x3cad1b));return uploadFile(_0x1b4c67,_0x5d39d5,_0x4c8655,_0x3cad1b,path['basename'](_0x10b419),fs[_0xfed4('0x74')](_0x10b419))[_0xfed4('0x2a')](function(_0x19e0f6){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x5c89d2,_0x3cad1b,_0x19e0f6[_0xfed4('0x75')]));_0xef9f13['bucket']=_0x19e0f6[_0xfed4('0x76')];_0xef9f13['location']=_0x19e0f6[_0xfed4('0x75')];logger[_0xfed4('0x69')](util[_0xfed4('0x53')](_0xfed4('0x77'),_0x5c89d2));return startTranscribe(_0x1b4c67,_0x5d39d5,_0x4c8655,uuidv4(),_0x19963d,_0x19e0f6[_0xfed4('0x75')]);})[_0xfed4('0x2a')](function(_0x10e6d4){logger['info'](util[_0xfed4('0x53')](_0xfed4('0x78'),_0x5c89d2,_0x10e6d4[_0xfed4('0x79')]['TranscriptionJobName']));_0xef9f13[_0xfed4('0x7a')]=_0x10e6d4[_0xfed4('0x79')][_0xfed4('0x7b')];_0xef9f13[_0xfed4('0x7c')]=_0x10e6d4[_0xfed4('0x79')]['TranscriptionJobStatus'];return _0x501663(_0xef9f13);})[_0xfed4('0x48')](function(_0x3b2b05){return _0x586b88(_0x3b2b05);});});}exports['runTranscribe']=function(_0x2f8ef5,_0x5f18bc,_0x5a13bb){var _0x2687a4;var _0x44b2f1;var _0x1b0160;var _0x318021=require(_0xfed4('0x50'));return db['VoiceRecording']['findOne']({'where':{'id':_0x2f8ef5[_0xfed4('0x4e')]['id']}})[_0xfed4('0x2a')](function(_0x439fa0){if(_0x439fa0){var _0x335fcc=util[_0xfed4('0x53')](_0xfed4('0x54'),_0x439fa0[_0xfed4('0x52')]);if(fs[_0xfed4('0x55')](_0x335fcc)){cypher=!![];return _0x318021['decryptFile'](_0x335fcc,_0x439fa0[_0xfed4('0x52')],config[_0xfed4('0x57')]['recording'])[_0xfed4('0x2a')](function(){return _0x439fa0;});}return _0x439fa0;}})[_0xfed4('0x2a')](function(_0x2abcb3){if(!_0x2abcb3){throw new db[(_0xfed4('0x59'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x44b2f1=_0x2abcb3;return db['Setting'][_0xfed4('0x7d')]({'where':{'id':0x1}});})[_0xfed4('0x2a')](handleEntityNotFound(_0x5f18bc,null))['then'](function(_0xd7f22c){if(_0xd7f22c){_0x2687a4=_0xd7f22c;if(!_0x2687a4[_0xfed4('0x7e')]||!_0x2687a4[_0xfed4('0x7f')]||!_0x2687a4[_0xfed4('0x80')]||!_0x2687a4['language']||!_0x2687a4['bucket']){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x81'));}if(_0x2f8ef5[_0xfed4('0x4c')][_0xfed4('0x82')]&&(!_0x2687a4[_0xfed4('0x83')]||!_0x2687a4[_0xfed4('0x84')]||!_0x2687a4['sentimentRegion']||!_0x2687a4[_0xfed4('0x85')]||!_0x2687a4[_0xfed4('0x86')])){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x87'));}return db[_0xfed4('0x88')][_0xfed4('0x7d')]({'where':{'id':_0x2687a4[_0xfed4('0x7f')]}});}})[_0xfed4('0x2a')](function(_0x940f3b){if(!_0x940f3b){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x89'));}if(!_0x940f3b[_0xfed4('0x8a')]||!_0x940f3b['data2']){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x8b'));}_0x1b0160=_0x940f3b;return getBucketslist(_0x1b0160['data1'],_0x1b0160[_0xfed4('0x8c')],_0x2687a4[_0xfed4('0x80')]);})[_0xfed4('0x2a')](function(_0x3bf509){if(_0x3bf509&&_0x3bf509[_0xfed4('0x8d')]){var _0x3de429=_['find'](_0x3bf509['Buckets'],function(_0x1d5bce){return _0x1d5bce['Name']===_0x2687a4['bucket'];});if(!_0x3de429){logger[_0xfed4('0x69')](util[_0xfed4('0x53')](_0xfed4('0x8e'),_0x2f8ef5[_0xfed4('0x4e')]['id'],_0x2687a4[_0xfed4('0x86')]));return createBucket(_0x1b0160[_0xfed4('0x8a')],_0x1b0160[_0xfed4('0x8c')],_0x2687a4[_0xfed4('0x80')],_0x2687a4['bucket']);}logger[_0xfed4('0x69')](util[_0xfed4('0x53')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2f8ef5[_0xfed4('0x4e')]['id'],_0x2687a4[_0xfed4('0x86')]));return;}})[_0xfed4('0x2a')](function(_0x230822){if(_0x44b2f1[_0xfed4('0x7c')]==='NEW'){return transcribe(_0x2f8ef5[_0xfed4('0x4e')]['id'],_0x1b0160[_0xfed4('0x8a')],_0x1b0160[_0xfed4('0x8c')],_0x2687a4[_0xfed4('0x80')],_0x2687a4['bucket'],_0x44b2f1[_0xfed4('0x52')],_0x2687a4[_0xfed4('0x85')]);}else{logger[_0xfed4('0x69')](util['format'](_0xfed4('0x8f'),_0x2f8ef5['params']['id']));return{'transcribeStatus':_0xfed4('0x90')};}})['then'](function(_0x6a7a38){if(_0x6a7a38){_0x6a7a38['tempSentiment']=_0x2f8ef5[_0xfed4('0x4c')][_0xfed4('0x82')];return _0x44b2f1[_0xfed4('0x91')](_0x6a7a38);}})['then'](respondWithResult(_0x5f18bc,null))[_0xfed4('0x48')](handleError(_0x5f18bc,null));};function writeFile(_0x18694c,_0x2d989c){return new Promise(function(_0x4b134b,_0x5554cd){fs[_0xfed4('0x92')](_0x2d989c,_0x18694c,function(_0x3ff87c,_0x49ee7a){if(_0x3ff87c){return _0x5554cd(_0x3ff87c);}else{return _0x4b134b(_0x49ee7a);}});});}exports[_0xfed4('0x93')]=function(_0x25b3c0,_0x5a4909,_0x292fe0){return db[_0xfed4('0x43')][_0xfed4('0x7d')]({'where':{'id':_0x25b3c0['params']['id']}})[_0xfed4('0x2a')](handleEntityNotFound(_0x5a4909))[_0xfed4('0x2a')](function(_0x48ceb8){if(_0x48ceb8&&_0x48ceb8[_0xfed4('0x94')]){var _0x7449da=_0x48ceb8[_0xfed4('0x94')];var _0x455a81=config[_0xfed4('0x95')]+_0xfed4('0x96')+_0x48ceb8['id']+_0xfed4('0x97');if(fs['existsSync'](_0x455a81)){return _0x455a81;}return writeFile(_0x7449da,_0x455a81)[_0xfed4('0x2a')](function(){return _0x455a81;});}else{throw new db[(_0xfed4('0x59'))]['ValidationError'](_0xfed4('0x98'));}})[_0xfed4('0x2a')](function(_0x313167){return _0x5a4909[_0xfed4('0x5f')](_0x313167);})[_0xfed4('0x48')](handleError(_0x5a4909));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2f2a60b..ce7895f 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 _0xcff2=['rimraf','../../config/environment','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4c10fe,_0x19e0b2){var _0x5d4ffe=function(_0x219ac8){while(--_0x219ac8){_0x4c10fe['push'](_0x4c10fe['shift']());}};_0x5d4ffe(++_0x19e0b2);}(_0xcff2,0x172));var _0x2cff=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0xcff2[_0x4191af];return _0x27bebf;};'use strict';var _=require(_0x2cff('0x0'));var util=require(_0x2cff('0x1'));var logger=require(_0x2cff('0x2'))('api');var moment=require(_0x2cff('0x3'));var BPromise=require(_0x2cff('0x4'));var rp=require(_0x2cff('0x5'));var fs=require('fs');var path=require(_0x2cff('0x6'));var rimraf=require(_0x2cff('0x7'));var config=require(_0x2cff('0x8'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x4904b5,_0x28f429){return _0x4904b5[_0x2cff('0x9')](_0x2cff('0xa'),attributes,{'tableName':_0x2cff('0xb'),'paranoid':![],'indexes':[{'name':_0x2cff('0xc'),'fields':[_0x2cff('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x87e1=['request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','lodash','util','../../config/logger','api','bluebird'];(function(_0x30efc1,_0xce84de){var _0x46d79e=function(_0x397ace){while(--_0x397ace){_0x30efc1['push'](_0x30efc1['shift']());}};_0x46d79e(++_0xce84de);}(_0x87e1,0xb1));var _0x187e=function(_0x52660e,_0x4bae6b){_0x52660e=_0x52660e-0x0;var _0x2fd1a3=_0x87e1[_0x52660e];return _0x2fd1a3;};'use strict';var _=require(_0x187e('0x0'));var util=require(_0x187e('0x1'));var logger=require(_0x187e('0x2'))(_0x187e('0x3'));var moment=require('moment');var BPromise=require(_0x187e('0x4'));var rp=require(_0x187e('0x5'));var fs=require('fs');var path=require(_0x187e('0x6'));var rimraf=require(_0x187e('0x7'));var config=require(_0x187e('0x8'));var attributes=require(_0x187e('0x9'));module[_0x187e('0xa')]=function(_0x22f398,_0x4e17ad){return _0x22f398[_0x187e('0xb')](_0x187e('0xc'),attributes,{'tableName':_0x187e('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 6e38ff5..ac1e358 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 _0xed1c=['jayson/promise','client','http','request','then','info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','catch','UpdateVoiceRecording','VoiceRecording','body','options','where','attributes','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xed1c,0xe4));var _0xced1=function(_0x54ac58,_0x574cc0){_0x54ac58=_0x54ac58-0x0;var _0x958bd0=_0xed1c[_0x54ac58];return _0x958bd0;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});}exports[_0xced1('0x14')]=function(_0x5a563a){var _0x56fc50=this;return new Promise(function(_0x2a92c8,_0x111fb0){return db[_0xced1('0x15')]['update'](_0x5a563a[_0xced1('0x16')],{'raw':_0x5a563a[_0xced1('0x17')]?_0x5a563a[_0xced1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a563a[_0xced1('0x17')]?_0x5a563a[_0xced1('0x17')][_0xced1('0x18')]||null:null,'attributes':_0x5a563a['options']?_0x5a563a[_0xced1('0x17')][_0xced1('0x19')]||null:null,'limit':_0x5a563a[_0xced1('0x17')]?_0x5a563a['options']['limit']||null:null})[_0xced1('0xa')](function(_0x41ee91){logger[_0xced1('0xb')](_0xced1('0x14'),_0x5a563a);logger[_0xced1('0x1a')]('UpdateVoiceRecording',_0x5a563a,JSON[_0xced1('0xe')](_0x41ee91));_0x2a92c8(_0x41ee91);})[_0xced1('0x13')](function(_0x4ea85e){logger['error'](_0xced1('0x14'),_0x4ea85e[_0xced1('0x11')],_0x5a563a);_0x111fb0(_0x56fc50[_0xced1('0xf')](0x1f4,_0x4ea85e[_0xced1('0x11')]));});});};exports[_0xced1('0x1b')]=function(_0x25b6e7){var _0x50c543=this;return new Promise(function(_0x181f6e,_0xf51411){var _0x43cdec=require(_0xced1('0x1c'));var _0x34dd2e;return db[_0xced1('0x1d')][_0xced1('0x1e')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xced1('0xa')](function(_0x4ef64e){_0x34dd2e=_0x4ef64e;return db[_0xced1('0x15')][_0xced1('0x1f')](_0x25b6e7[_0xced1('0x16')]);})[_0xced1('0xa')](function(_0x5f03cc){if(_0x34dd2e['callRecordingEncryption']&&fs[_0xced1('0x20')](_0x5f03cc[_0xced1('0x21')])){var _0x2bc785=util['format']('%s.cypher',_0x5f03cc['value']);return _0x43cdec[_0xced1('0x22')](_0x5f03cc[_0xced1('0x21')],_0x2bc785,config[_0xced1('0x23')][_0xced1('0x24')])['then'](function(){fs[_0xced1('0x25')](_0x5f03cc[_0xced1('0x21')]);logger[_0xced1('0xb')](_0xced1('0x26'));return _0x5f03cc;});}return _0x5f03cc;})[_0xced1('0xa')](function(_0x33ac43){logger[_0xced1('0xb')]('CreateVoiceRecording',_0x25b6e7);logger['debug'](_0xced1('0x1b'),_0x25b6e7,JSON[_0xced1('0xe')](_0x33ac43));_0x181f6e(_0x33ac43);})[_0xced1('0x13')](function(_0x7ebeb3){logger[_0xced1('0xf')](_0xced1('0x1b'),_0x7ebeb3['message'],_0x25b6e7);_0xf51411(_0x50c543['error'](0x1f4,_0x7ebeb3['message']));});});}; \ No newline at end of file +var _0xfcbb=['VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','encryptFile','recording','unlink','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xb9580,_0x441821){var _0x532515=function(_0x32ef38){while(--_0x32ef38){_0xb9580['push'](_0xb9580['shift']());}};_0x532515(++_0x441821);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x450f0b,_0x269b47){_0x450f0b=_0x450f0b-0x0;var _0x4bf3eb=_0xfcbb[_0x450f0b];return _0x4bf3eb;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['where']||null:null,'attributes':_0xba1d6['options']?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1a')]||null:null,'limit':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1b')]||null:null})['then'](function(_0x365d6c){logger[_0xbfcb('0xb')](_0xbfcb('0x16'),_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x365d6c));_0x3404aa(_0x365d6c);})[_0xbfcb('0x15')](function(_0x14e43c){logger[_0xbfcb('0x10')](_0xbfcb('0x16'),_0x14e43c[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x14e43c[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1c')]=function(_0x3e954d){var _0x2a1272=this;return new Promise(function(_0x5cd703,_0x3465f5){var _0x2881f8=require('../../components/encryptor');var _0x64a69;return db[_0xbfcb('0x1d')][_0xbfcb('0x1e')]({'attributes':['id',_0xbfcb('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xbfcb('0xa')](function(_0x3542e9){_0x64a69=_0x3542e9;return db[_0xbfcb('0x17')][_0xbfcb('0x20')](_0x3e954d[_0xbfcb('0x21')]);})[_0xbfcb('0xa')](function(_0x59719b){if(_0x64a69[_0xbfcb('0x1f')]&&fs[_0xbfcb('0x22')](_0x59719b[_0xbfcb('0x23')])){var _0x43de3c=util[_0xbfcb('0x24')](_0xbfcb('0x25'),_0x59719b[_0xbfcb('0x23')]);return _0x2881f8[_0xbfcb('0x26')](_0x59719b[_0xbfcb('0x23')],_0x43de3c,config['secrets'][_0xbfcb('0x27')])[_0xbfcb('0xa')](function(){fs[_0xbfcb('0x28')](_0x59719b[_0xbfcb('0x23')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x59719b;});}return _0x59719b;})[_0xbfcb('0xa')](function(_0x35925b){logger[_0xbfcb('0xb')](_0xbfcb('0x1c'),_0x3e954d);logger[_0xbfcb('0xd')](_0xbfcb('0x1c'),_0x3e954d,JSON[_0xbfcb('0xf')](_0x35925b));_0x5cd703(_0x35925b);})['catch'](function(_0x504d81){logger['error'](_0xbfcb('0x1c'),_0x504d81['message'],_0x3e954d);_0x3465f5(_0x2a1272[_0xbfcb('0x10')](0x1f4,_0x504d81[_0xbfcb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 88676c4..9d6a5aa 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 _0x785c=['put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x347edc,_0x22555c){var _0x5cd71c=function(_0x5c0cdf){while(--_0x5c0cdf){_0x347edc['push'](_0x347edc['shift']());}};_0x5cd71c(++_0x22555c);}(_0x785c,0xf3));var _0xc785=function(_0x1ac683,_0x53858e){_0x1ac683=_0x1ac683-0x0;var _0x45eb42=_0x785c[_0x1ac683];return _0x45eb42;};'use strict';var multer=require(_0xc785('0x0'));var util=require('util');var path=require(_0xc785('0x1'));var timeout=require(_0xc785('0x2'));var express=require(_0xc785('0x3'));var router=express[_0xc785('0x4')]();var fs_extra=require(_0xc785('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc785('0x6'));var config=require(_0xc785('0x7'));var controller=require(_0xc785('0x8'));router[_0xc785('0x9')]('/',auth[_0xc785('0xa')](),controller[_0xc785('0xb')]);router[_0xc785('0x9')]('/describe',auth[_0xc785('0xa')](),controller[_0xc785('0xc')]);router[_0xc785('0x9')](_0xc785('0xd'),auth[_0xc785('0xa')](),controller[_0xc785('0xe')]);router[_0xc785('0xf')]('/',auth[_0xc785('0xa')](),controller[_0xc785('0x10')]);router[_0xc785('0x11')](_0xc785('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xc785('0xa')](),controller[_0xc785('0x12')]);module[_0xc785('0x13')]=router; \ No newline at end of file +var _0x78aa=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x78aa,0x105));var _0xa78a=function(_0x455e8a,_0x17def6){_0x455e8a=_0x455e8a-0x0;var _0x132409=_0x78aa[_0x455e8a];return _0x132409;};'use strict';var multer=require(_0xa78a('0x0'));var util=require(_0xa78a('0x1'));var path=require(_0xa78a('0x2'));var timeout=require(_0xa78a('0x3'));var express=require(_0xa78a('0x4'));var router=express['Router']();var fs_extra=require(_0xa78a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa78a('0x6'));var config=require(_0xa78a('0x7'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xa78a('0x8')](),controller[_0xa78a('0x9')]);router[_0xa78a('0xa')](_0xa78a('0xb'),auth[_0xa78a('0x8')](),controller[_0xa78a('0xc')]);router['get'](_0xa78a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa78a('0xe')]('/',auth[_0xa78a('0x8')](),controller[_0xa78a('0xf')]);router[_0xa78a('0x10')](_0xa78a('0xd'),auth['isAuthenticated'](),controller[_0xa78a('0x11')]);router[_0xa78a('0x12')](_0xa78a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa78a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 30fb827..b7c9d57 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 _0xcb9f=['moment','exports','attended','STRING','ENUM','Yes','sequelize'];(function(_0x5b9a30,_0x2b3667){var _0x35f722=function(_0xfb962b){while(--_0xfb962b){_0x5b9a30['push'](_0x5b9a30['shift']());}};_0x35f722(++_0x2b3667);}(_0xcb9f,0xbc));var _0xfcb9=function(_0x4bdb33,_0x3a66dc){_0x4bdb33=_0x4bdb33-0x0;var _0x46c6a8=_0xcb9f[_0x4bdb33];return _0x46c6a8;};'use strict';var Sequelize=require(_0xfcb9('0x0'));var moment=require(_0xfcb9('0x1'));module[_0xfcb9('0x2')]={'type':{'type':Sequelize['ENUM']('blind',_0xfcb9('0x3'))},'result':{'type':Sequelize[_0xfcb9('0x4')]},'transfererchannel':{'type':Sequelize[_0xfcb9('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xfcb9('0x4')]},'transferercalleridname':{'type':Sequelize[_0xfcb9('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xfcb9('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xfcb9('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xfcb9('0x4')]},'transferercontext':{'type':Sequelize[_0xfcb9('0x4')]},'transfererexten':{'type':Sequelize[_0xfcb9('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xfcb9('0x4')]},'transfereechannel':{'type':Sequelize[_0xfcb9('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xfcb9('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xfcb9('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfcb9('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfcb9('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xfcb9('0x4')]},'transfereecontext':{'type':Sequelize[_0xfcb9('0x4')]},'transfereeexten':{'type':Sequelize[_0xfcb9('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xfcb9('0x4')]},'isexternal':{'type':Sequelize[_0xfcb9('0x5')](_0xfcb9('0x6'),'No')},'context':{'type':Sequelize[_0xfcb9('0x4')]},'extension':{'type':Sequelize[_0xfcb9('0x4')]}}; \ No newline at end of file +var _0x703f=['exports','ENUM','blind','attended','STRING','Yes'];(function(_0x2aa5a4,_0x51ed81){var _0x229dab=function(_0x4f62c9){while(--_0x4f62c9){_0x2aa5a4['push'](_0x2aa5a4['shift']());}};_0x229dab(++_0x51ed81);}(_0x703f,0x1b6));var _0xf703=function(_0x547f7e,_0x41c8dd){_0x547f7e=_0x547f7e-0x0;var _0x469b38=_0x703f[_0x547f7e];return _0x469b38;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xf703('0x0')]={'type':{'type':Sequelize[_0xf703('0x1')](_0xf703('0x2'),_0xf703('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf703('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xf703('0x4')]},'transferercalleridname':{'type':Sequelize[_0xf703('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf703('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xf703('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xf703('0x4')]},'transferercontext':{'type':Sequelize[_0xf703('0x4')]},'transfererexten':{'type':Sequelize[_0xf703('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xf703('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xf703('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf703('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf703('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xf703('0x4')]},'transfereecontext':{'type':Sequelize[_0xf703('0x4')]},'transfereeexten':{'type':Sequelize[_0xf703('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xf703('0x1')](_0xf703('0x5'),'No')},'context':{'type':Sequelize[_0xf703('0x4')]},'extension':{'type':Sequelize[_0xf703('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 839a550..8773f8e 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 _0xc74d=['keys','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','status','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','params'];(function(_0xbe48a,_0x4d3ec5){var _0x3eeda0=function(_0x2d758d){while(--_0x2d758d){_0xbe48a['push'](_0xbe48a['shift']());}};_0x3eeda0(++_0x4d3ec5);}(_0xc74d,0x1df));var _0xdc74=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc74d[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdc74('0x0'));var jsonpatch=require(_0xdc74('0x1'));var rp=require('request-promise');var moment=require(_0xdc74('0x2'));var BPromise=require(_0xdc74('0x3'));var Mustache=require(_0xdc74('0x4'));var util=require(_0xdc74('0x5'));var path=require(_0xdc74('0x6'));var sox=require(_0xdc74('0x7'));var csv=require('to-csv');var ejs=require(_0xdc74('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc74('0x9'));var squel=require(_0xdc74('0xa'));var crypto=require(_0xdc74('0xb'));var jsforce=require(_0xdc74('0xc'));var deskjs=require(_0xdc74('0xd'));var toCsv=require(_0xdc74('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdc74('0xf'));var qs=require(_0xdc74('0x10'));var as=require(_0xdc74('0x11'));var hardwareService=require(_0xdc74('0x12'));var logger=require(_0xdc74('0x13'))(_0xdc74('0x14'));var utils=require(_0xdc74('0x15'));var config=require(_0xdc74('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc74('0x17'))['db'];function respondWithStatusCode(_0x3abe27,_0xfd58f7){_0xfd58f7=_0xfd58f7||0xcc;return function(_0x4922e0){if(_0x4922e0){return _0x3abe27[_0xdc74('0x18')](_0xfd58f7);}return _0x3abe27['status'](_0xfd58f7)[_0xdc74('0x19')]();};}function respondWithResult(_0x2a5904,_0x34863b){_0x34863b=_0x34863b||0xc8;return function(_0x593482){if(_0x593482){return _0x2a5904['status'](_0x34863b)[_0xdc74('0x1a')](_0x593482);}};}function respondWithFilteredResult(_0x39ed6e,_0x5e613c){return function(_0x13f02e){if(_0x13f02e){var _0xb8a54b=typeof _0x5e613c[_0xdc74('0x1b')]===_0xdc74('0x1c')&&typeof _0x5e613c['limit']===_0xdc74('0x1c');var _0x3beab4=_0x13f02e[_0xdc74('0x1d')];var _0x5a40ed=_0xb8a54b?0x0:_0x5e613c[_0xdc74('0x1b')];var _0x5da561=_0xb8a54b?_0x13f02e[_0xdc74('0x1d')]:_0x5e613c[_0xdc74('0x1b')]+_0x5e613c[_0xdc74('0x1e')];var _0xf13ab4;if(_0x5da561>=_0x3beab4){_0x5da561=_0x3beab4;_0xf13ab4=0xc8;}else{_0xf13ab4=0xce;}_0x39ed6e['status'](_0xf13ab4);return _0x39ed6e[_0xdc74('0x1f')](_0xdc74('0x20'),_0x5a40ed+'-'+_0x5da561+'/'+_0x3beab4)[_0xdc74('0x1a')](_0x13f02e);}return null;};}function patchUpdates(_0x14421e){return function(_0xaf8bc3){try{jsonpatch[_0xdc74('0x21')](_0xaf8bc3,_0x14421e,!![]);}catch(_0x1a1b24){return BPromise[_0xdc74('0x22')](_0x1a1b24);}return _0xaf8bc3[_0xdc74('0x23')]();};}function saveUpdates(_0x27d8d8,_0x4cc17c){return function(_0x11c581){if(_0x11c581){return _0x11c581[_0xdc74('0x24')](_0x27d8d8)[_0xdc74('0x25')](function(_0xa7e995){return _0xa7e995;});}return null;};}function removeEntity(_0x5ac616,_0x376555){return function(_0x48f2a5){if(_0x48f2a5){return _0x48f2a5[_0xdc74('0x26')]()[_0xdc74('0x25')](function(){_0x5ac616['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cfb01,_0x4b5912){return function(_0x150db9){if(!_0x150db9){_0x3cfb01[_0xdc74('0x18')](0x194);}return _0x150db9;};}function handleError(_0x37a152,_0x13075d){_0x13075d=_0x13075d||0x1f4;return function(_0x5b85b8){logger[_0xdc74('0x27')](_0x5b85b8[_0xdc74('0x28')]);if(_0x5b85b8[_0xdc74('0x29')]){delete _0x5b85b8['name'];}_0x37a152[_0xdc74('0x2a')](_0x13075d)[_0xdc74('0x2b')](_0x5b85b8);};}exports[_0xdc74('0x2c')]=function(_0x3c20a1,_0x45845f){var _0x3f818c={},_0x124e38={},_0x416319={'count':0x0,'rows':[]};var _0x5597f9=_[_0xdc74('0x2d')](db['VoiceTransferReport'][_0xdc74('0x2e')],function(_0x584d31){return{'name':_0x584d31[_0xdc74('0x2f')],'type':_0x584d31[_0xdc74('0x30')][_0xdc74('0x31')]};});_0x124e38[_0xdc74('0x32')]=_[_0xdc74('0x2d')](_0x5597f9,_0xdc74('0x29'));_0x124e38[_0xdc74('0x33')]=_['keys'](_0x3c20a1['query']);_0x124e38['filters']=_[_0xdc74('0x34')](_0x124e38[_0xdc74('0x32')],_0x124e38[_0xdc74('0x33')]);_0x3f818c['attributes']=_[_0xdc74('0x34')](_0x124e38[_0xdc74('0x32')],qs[_0xdc74('0x35')](_0x3c20a1['query'][_0xdc74('0x35')]));_0x3f818c[_0xdc74('0x36')]=_0x3f818c[_0xdc74('0x36')][_0xdc74('0x37')]?_0x3f818c['attributes']:_0x124e38['model'];if(!_0x3c20a1[_0xdc74('0x33')][_0xdc74('0x38')](_0xdc74('0x39'))){_0x3f818c['limit']=qs[_0xdc74('0x1e')](_0x3c20a1[_0xdc74('0x33')][_0xdc74('0x1e')]);_0x3f818c[_0xdc74('0x1b')]=qs[_0xdc74('0x1b')](_0x3c20a1['query'][_0xdc74('0x1b')]);}_0x3f818c[_0xdc74('0x3a')]=qs[_0xdc74('0x3b')](_0x3c20a1[_0xdc74('0x33')][_0xdc74('0x3b')]);_0x3f818c[_0xdc74('0x3c')]=qs[_0xdc74('0x3d')](_[_0xdc74('0x3e')](_0x3c20a1['query'],_0x124e38[_0xdc74('0x3d')]),_0x5597f9);if(_0x3c20a1[_0xdc74('0x33')][_0xdc74('0x3f')]){_0x3f818c[_0xdc74('0x3c')]=_[_0xdc74('0x40')](_0x3f818c[_0xdc74('0x3c')],{'$or':_[_0xdc74('0x2d')](_0x5597f9,function(_0x5137ef){if(_0x5137ef[_0xdc74('0x30')]!==_0xdc74('0x41')){var _0x584209={};_0x584209[_0x5137ef['name']]={'$like':'%'+_0x3c20a1[_0xdc74('0x33')]['filter']+'%'};return _0x584209;}})});}_0x3f818c=_[_0xdc74('0x40')]({},_0x3f818c,_0x3c20a1[_0xdc74('0x42')]);var _0x21bb0d={'where':_0x3f818c[_0xdc74('0x3c')]};return db[_0xdc74('0x43')]['count'](_0x21bb0d)[_0xdc74('0x25')](function(_0x15d0eb){_0x416319[_0xdc74('0x1d')]=_0x15d0eb;if(_0x3c20a1[_0xdc74('0x33')][_0xdc74('0x44')]){_0x3f818c[_0xdc74('0x45')]=[{'all':!![]}];}return db[_0xdc74('0x43')][_0xdc74('0x46')](_0x3f818c);})[_0xdc74('0x25')](function(_0x45d352){_0x416319[_0xdc74('0x47')]=_0x45d352;return _0x416319;})[_0xdc74('0x25')](respondWithFilteredResult(_0x45845f,_0x3f818c))[_0xdc74('0x48')](handleError(_0x45845f,null));};exports['show']=function(_0x5b4e15,_0x48314b){var _0xf7eea7={'raw':!![],'where':{'id':_0x5b4e15[_0xdc74('0x49')]['id']}},_0x6c896d={};_0x6c896d[_0xdc74('0x32')]=_[_0xdc74('0x4a')](db[_0xdc74('0x43')][_0xdc74('0x2e')]);_0x6c896d[_0xdc74('0x33')]=_[_0xdc74('0x4a')](_0x5b4e15['query']);_0x6c896d[_0xdc74('0x3d')]=_['intersection'](_0x6c896d['model'],_0x6c896d['query']);_0xf7eea7['attributes']=_[_0xdc74('0x34')](_0x6c896d[_0xdc74('0x32')],qs['fields'](_0x5b4e15[_0xdc74('0x33')]['fields']));_0xf7eea7[_0xdc74('0x36')]=_0xf7eea7['attributes'][_0xdc74('0x37')]?_0xf7eea7['attributes']:_0x6c896d[_0xdc74('0x32')];if(_0x5b4e15[_0xdc74('0x33')][_0xdc74('0x44')]){_0xf7eea7[_0xdc74('0x45')]=[{'all':!![]}];}_0xf7eea7=_[_0xdc74('0x40')]({},_0xf7eea7,_0x5b4e15[_0xdc74('0x42')]);return db[_0xdc74('0x43')][_0xdc74('0x4b')](_0xf7eea7)[_0xdc74('0x25')](handleEntityNotFound(_0x48314b,null))[_0xdc74('0x25')](respondWithResult(_0x48314b,null))[_0xdc74('0x48')](handleError(_0x48314b,null));};exports[_0xdc74('0x4c')]=function(_0x4d6d37,_0x34ad79){return db[_0xdc74('0x43')][_0xdc74('0x4c')](_0x4d6d37[_0xdc74('0x4d')],{})[_0xdc74('0x25')](respondWithResult(_0x34ad79,0xc9))[_0xdc74('0x48')](handleError(_0x34ad79,null));};exports[_0xdc74('0x24')]=function(_0x28ee4a,_0x2ad3b7){if(_0x28ee4a['body']['id']){delete _0x28ee4a['body']['id'];}return db[_0xdc74('0x43')]['find']({'where':{'id':_0x28ee4a[_0xdc74('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ad3b7,null))[_0xdc74('0x25')](saveUpdates(_0x28ee4a[_0xdc74('0x4d')],null))['then'](respondWithResult(_0x2ad3b7,null))['catch'](handleError(_0x2ad3b7,null));};exports[_0xdc74('0x26')]=function(_0x4a7aa6,_0x12fdb6){return db[_0xdc74('0x43')][_0xdc74('0x4b')]({'where':{'id':_0x4a7aa6[_0xdc74('0x49')]['id']}})['then'](handleEntityNotFound(_0x12fdb6,null))[_0xdc74('0x25')](removeEntity(_0x12fdb6,null))[_0xdc74('0x48')](handleError(_0x12fdb6,null));};exports[_0xdc74('0x4e')]=function(_0x153134,_0x28085c){return db[_0xdc74('0x43')][_0xdc74('0x4e')]()[_0xdc74('0x25')](respondWithResult(_0x28085c,null))[_0xdc74('0x48')](handleError(_0x28085c,null));}; \ No newline at end of file +var _0x66af=['json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','options','includeAll','findAll','catch','show','params','intersection','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','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','../../config/license/util','sendStatus','status'];(function(_0x15ecbe,_0x471dbf){var _0x3ff86d=function(_0x579811){while(--_0x579811){_0x15ecbe['push'](_0x15ecbe['shift']());}};_0x3ff86d(++_0x471dbf);}(_0x66af,0xb9));var _0xf66a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x66af[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf66a('0x0'));var zipdir=require(_0xf66a('0x1'));var jsonpatch=require(_0xf66a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf66a('0x3'));var Mustache=require('mustache');var util=require(_0xf66a('0x4'));var path=require(_0xf66a('0x5'));var sox=require('sox');var csv=require(_0xf66a('0x6'));var ejs=require(_0xf66a('0x7'));var fs=require('fs');var fs_extra=require(_0xf66a('0x8'));var _=require(_0xf66a('0x9'));var squel=require(_0xf66a('0xa'));var crypto=require(_0xf66a('0xb'));var jsforce=require(_0xf66a('0xc'));var deskjs=require(_0xf66a('0xd'));var toCsv=require(_0xf66a('0x6'));var querystring=require(_0xf66a('0xe'));var Papa=require(_0xf66a('0xf'));var Redis=require(_0xf66a('0x10'));var authService=require(_0xf66a('0x11'));var qs=require(_0xf66a('0x12'));var as=require(_0xf66a('0x13'));var hardwareService=require(_0xf66a('0x14'));var logger=require(_0xf66a('0x15'))(_0xf66a('0x16'));var utils=require(_0xf66a('0x17'));var config=require(_0xf66a('0x18'));var licenseUtil=require(_0xf66a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f77,_0x13d15c){_0x13d15c=_0x13d15c||0xcc;return function(_0x3b9085){if(_0x3b9085){return _0x59f77[_0xf66a('0x1a')](_0x13d15c);}return _0x59f77['status'](_0x13d15c)['end']();};}function respondWithResult(_0x55b3fd,_0x14ca96){_0x14ca96=_0x14ca96||0xc8;return function(_0x2302f5){if(_0x2302f5){return _0x55b3fd[_0xf66a('0x1b')](_0x14ca96)[_0xf66a('0x1c')](_0x2302f5);}};}function respondWithFilteredResult(_0x3bdf17,_0x432989){return function(_0x1fb907){if(_0x1fb907){var _0x52047b=typeof _0x432989[_0xf66a('0x1d')]===_0xf66a('0x1e')&&typeof _0x432989[_0xf66a('0x1f')]===_0xf66a('0x1e');var _0xf552ce=_0x1fb907[_0xf66a('0x20')];var _0x3453df=_0x52047b?0x0:_0x432989[_0xf66a('0x1d')];var _0x3e777c=_0x52047b?_0x1fb907['count']:_0x432989[_0xf66a('0x1d')]+_0x432989[_0xf66a('0x1f')];var _0x458788;if(_0x3e777c>=_0xf552ce){_0x3e777c=_0xf552ce;_0x458788=0xc8;}else{_0x458788=0xce;}_0x3bdf17[_0xf66a('0x1b')](_0x458788);return _0x3bdf17[_0xf66a('0x21')]('Content-Range',_0x3453df+'-'+_0x3e777c+'/'+_0xf552ce)[_0xf66a('0x1c')](_0x1fb907);}return null;};}function patchUpdates(_0x44b106){return function(_0x40c7ae){try{jsonpatch[_0xf66a('0x22')](_0x40c7ae,_0x44b106,!![]);}catch(_0x392e92){return BPromise['reject'](_0x392e92);}return _0x40c7ae[_0xf66a('0x23')]();};}function saveUpdates(_0x283a1d,_0x143f08){return function(_0x5e9ac0){if(_0x5e9ac0){return _0x5e9ac0[_0xf66a('0x24')](_0x283a1d)[_0xf66a('0x25')](function(_0x4c16f1){return _0x4c16f1;});}return null;};}function removeEntity(_0x4d90b7,_0x5a4422){return function(_0x5098e0){if(_0x5098e0){return _0x5098e0[_0xf66a('0x26')]()[_0xf66a('0x25')](function(){_0x4d90b7[_0xf66a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38b2c4,_0x5c6fa3){return function(_0x2c91c3){if(!_0x2c91c3){_0x38b2c4[_0xf66a('0x1a')](0x194);}return _0x2c91c3;};}function handleError(_0x105567,_0x3cfb20){_0x3cfb20=_0x3cfb20||0x1f4;return function(_0x240891){logger['error'](_0x240891[_0xf66a('0x27')]);if(_0x240891[_0xf66a('0x28')]){delete _0x240891[_0xf66a('0x28')];}_0x105567[_0xf66a('0x1b')](_0x3cfb20)[_0xf66a('0x29')](_0x240891);};}exports['index']=function(_0x1d7db4,_0x5bc653){var _0x57f552={},_0x14388a={},_0x327e44={'count':0x0,'rows':[]};var _0xe04612=_[_0xf66a('0x2a')](db[_0xf66a('0x2b')][_0xf66a('0x2c')],function(_0x538f6f){return{'name':_0x538f6f[_0xf66a('0x2d')],'type':_0x538f6f[_0xf66a('0x2e')]['key']};});_0x14388a[_0xf66a('0x2f')]=_['map'](_0xe04612,'name');_0x14388a[_0xf66a('0x30')]=_[_0xf66a('0x31')](_0x1d7db4[_0xf66a('0x30')]);_0x14388a[_0xf66a('0x32')]=_['intersection'](_0x14388a[_0xf66a('0x2f')],_0x14388a[_0xf66a('0x30')]);_0x57f552[_0xf66a('0x33')]=_['intersection'](_0x14388a[_0xf66a('0x2f')],qs['fields'](_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x34')]));_0x57f552[_0xf66a('0x33')]=_0x57f552['attributes'][_0xf66a('0x35')]?_0x57f552[_0xf66a('0x33')]:_0x14388a[_0xf66a('0x2f')];if(!_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x36')]('nolimit')){_0x57f552[_0xf66a('0x1f')]=qs[_0xf66a('0x1f')](_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x1f')]);_0x57f552[_0xf66a('0x1d')]=qs[_0xf66a('0x1d')](_0x1d7db4['query'][_0xf66a('0x1d')]);}_0x57f552[_0xf66a('0x37')]=qs[_0xf66a('0x38')](_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x38')]);_0x57f552[_0xf66a('0x39')]=qs['filters'](_['pick'](_0x1d7db4[_0xf66a('0x30')],_0x14388a['filters']),_0xe04612);if(_0x1d7db4[_0xf66a('0x30')]['filter']){_0x57f552['where']=_[_0xf66a('0x3a')](_0x57f552[_0xf66a('0x39')],{'$or':_[_0xf66a('0x2a')](_0xe04612,function(_0x4d9b9b){if(_0x4d9b9b[_0xf66a('0x2e')]!=='VIRTUAL'){var _0x4a4c30={};_0x4a4c30[_0x4d9b9b['name']]={'$like':'%'+_0x1d7db4['query']['filter']+'%'};return _0x4a4c30;}})});}_0x57f552=_[_0xf66a('0x3a')]({},_0x57f552,_0x1d7db4[_0xf66a('0x3b')]);var _0x1f30e7={'where':_0x57f552[_0xf66a('0x39')]};return db[_0xf66a('0x2b')][_0xf66a('0x20')](_0x1f30e7)[_0xf66a('0x25')](function(_0x13f53d){_0x327e44[_0xf66a('0x20')]=_0x13f53d;if(_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x3c')]){_0x57f552['include']=[{'all':!![]}];}return db[_0xf66a('0x2b')][_0xf66a('0x3d')](_0x57f552);})['then'](function(_0x126972){_0x327e44['rows']=_0x126972;return _0x327e44;})[_0xf66a('0x25')](respondWithFilteredResult(_0x5bc653,_0x57f552))[_0xf66a('0x3e')](handleError(_0x5bc653,null));};exports[_0xf66a('0x3f')]=function(_0x34fc7a,_0x4da3fc){var _0x160f4f={'raw':!![],'where':{'id':_0x34fc7a[_0xf66a('0x40')]['id']}},_0x328ab8={};_0x328ab8[_0xf66a('0x2f')]=_[_0xf66a('0x31')](db['VoiceTransferReport'][_0xf66a('0x2c')]);_0x328ab8[_0xf66a('0x30')]=_[_0xf66a('0x31')](_0x34fc7a[_0xf66a('0x30')]);_0x328ab8[_0xf66a('0x32')]=_[_0xf66a('0x41')](_0x328ab8[_0xf66a('0x2f')],_0x328ab8[_0xf66a('0x30')]);_0x160f4f[_0xf66a('0x33')]=_[_0xf66a('0x41')](_0x328ab8[_0xf66a('0x2f')],qs[_0xf66a('0x34')](_0x34fc7a[_0xf66a('0x30')]['fields']));_0x160f4f[_0xf66a('0x33')]=_0x160f4f[_0xf66a('0x33')][_0xf66a('0x35')]?_0x160f4f[_0xf66a('0x33')]:_0x328ab8[_0xf66a('0x2f')];if(_0x34fc7a[_0xf66a('0x30')]['includeAll']){_0x160f4f[_0xf66a('0x42')]=[{'all':!![]}];}_0x160f4f=_['merge']({},_0x160f4f,_0x34fc7a['options']);return db[_0xf66a('0x2b')][_0xf66a('0x43')](_0x160f4f)[_0xf66a('0x25')](handleEntityNotFound(_0x4da3fc,null))[_0xf66a('0x25')](respondWithResult(_0x4da3fc,null))['catch'](handleError(_0x4da3fc,null));};exports[_0xf66a('0x44')]=function(_0x446835,_0x44e2b0){return db[_0xf66a('0x2b')][_0xf66a('0x44')](_0x446835[_0xf66a('0x45')],{})[_0xf66a('0x25')](respondWithResult(_0x44e2b0,0xc9))['catch'](handleError(_0x44e2b0,null));};exports[_0xf66a('0x24')]=function(_0x301d78,_0x31c4cf){if(_0x301d78[_0xf66a('0x45')]['id']){delete _0x301d78[_0xf66a('0x45')]['id'];}return db[_0xf66a('0x2b')][_0xf66a('0x43')]({'where':{'id':_0x301d78[_0xf66a('0x40')]['id']}})[_0xf66a('0x25')](handleEntityNotFound(_0x31c4cf,null))[_0xf66a('0x25')](saveUpdates(_0x301d78[_0xf66a('0x45')],null))[_0xf66a('0x25')](respondWithResult(_0x31c4cf,null))[_0xf66a('0x3e')](handleError(_0x31c4cf,null));};exports[_0xf66a('0x26')]=function(_0x46531e,_0x29d672){return db[_0xf66a('0x2b')]['find']({'where':{'id':_0x46531e['params']['id']}})['then'](handleEntityNotFound(_0x29d672,null))['then'](removeEntity(_0x29d672,null))[_0xf66a('0x3e')](handleError(_0x29d672,null));};exports[_0xf66a('0x46')]=function(_0x34fb17,_0x117314){return db[_0xf66a('0x2b')][_0xf66a('0x46')]()[_0xf66a('0x25')](respondWithResult(_0x117314,null))[_0xf66a('0x3e')](handleError(_0x117314,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b360e85..f022bb8 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 _0xe24e=['report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport'];(function(_0x25a013,_0x327e08){var _0x1bac05=function(_0x39c52c){while(--_0x39c52c){_0x25a013['push'](_0x25a013['shift']());}};_0x1bac05(++_0x327e08);}(_0xe24e,0x121));var _0xee24=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xe24e[_0x26462c];return _0x509a42;};'use strict';var _=require('lodash');var util=require(_0xee24('0x0'));var logger=require(_0xee24('0x1'))(_0xee24('0x2'));var moment=require(_0xee24('0x3'));var BPromise=require(_0xee24('0x4'));var rp=require(_0xee24('0x5'));var fs=require('fs');var path=require(_0xee24('0x6'));var rimraf=require('rimraf');var config=require(_0xee24('0x7'));var attributes=require(_0xee24('0x8'));module[_0xee24('0x9')]=function(_0x234a4b,_0xc35102){return _0x234a4b['define'](_0xee24('0xa'),attributes,{'tableName':_0xee24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5772=['define','VoiceTransferReport','lodash','../../config/logger','moment','bluebird','path','../../config/environment','exports'];(function(_0x3ddf16,_0x76f985){var _0x353de4=function(_0x49c878){while(--_0x49c878){_0x3ddf16['push'](_0x3ddf16['shift']());}};_0x353de4(++_0x76f985);}(_0x5772,0x107));var _0x2577=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x5772[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x2577('0x0'));var util=require('util');var logger=require(_0x2577('0x1'))('api');var moment=require(_0x2577('0x2'));var BPromise=require(_0x2577('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2577('0x4'));var rimraf=require('rimraf');var config=require(_0x2577('0x5'));var attributes=require('./voiceTransferReport.attributes');module[_0x2577('0x6')]=function(_0x53fe7f,_0x102313){return _0x53fe7f[_0x2577('0x7')](_0x2577('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index c4ef2d1..6812e5b 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 _0x50e2=['CreateVoiceTransferReport','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','body','options','raw'];(function(_0x54ca21,_0x589f57){var _0x4b248a=function(_0x3dac56){while(--_0x3dac56){_0x54ca21['push'](_0x54ca21['shift']());}};_0x4b248a(++_0x589f57);}(_0x50e2,0x152));var _0x250e=function(_0x45dd0e,_0x28e603){_0x45dd0e=_0x45dd0e-0x0;var _0x50e5ca=_0x50e2[_0x45dd0e];return _0x50e5ca;};'use strict';var _=require('lodash');var util=require(_0x250e('0x0'));var moment=require(_0x250e('0x1'));var BPromise=require(_0x250e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x250e('0x3'));var db=require(_0x250e('0x4'))['db'];var utils=require(_0x250e('0x5'));var logger=require(_0x250e('0x6'))(_0x250e('0x7'));var config=require(_0x250e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x250e('0x9')][_0x250e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xedeff5,_0x4d7ac0,_0x5450d3){return new BPromise(function(_0x2bb2a0,_0xafb0e7){return client['request'](_0xedeff5,_0x5450d3)[_0x250e('0xb')](function(_0x277e0e){logger[_0x250e('0xc')](_0x250e('0xd'),_0x4d7ac0,_0x250e('0xe'));logger[_0x250e('0xf')](_0x250e('0x10'),_0x4d7ac0,_0x250e('0xe'),JSON[_0x250e('0x11')](_0x277e0e));if(_0x277e0e[_0x250e('0x12')]){if(_0x277e0e['error'][_0x250e('0x13')]===0x1f4){logger[_0x250e('0x12')](_0x250e('0xd'),_0x4d7ac0,_0x277e0e['error']['message']);return _0xafb0e7(_0x277e0e[_0x250e('0x12')][_0x250e('0x14')]);}logger[_0x250e('0x12')](_0x250e('0xd'),_0x4d7ac0,_0x277e0e[_0x250e('0x12')][_0x250e('0x14')]);return _0x2bb2a0(_0x277e0e['error'][_0x250e('0x14')]);}else{logger[_0x250e('0xc')](_0x250e('0xd'),_0x4d7ac0,_0x250e('0xe'));_0x2bb2a0(_0x277e0e[_0x250e('0x15')][_0x250e('0x14')]);}})['catch'](function(_0x57bf93){logger[_0x250e('0x12')](_0x250e('0xd'),_0x4d7ac0,_0x57bf93);_0xafb0e7(_0x57bf93);});});}exports['CreateVoiceTransferReport']=function(_0x44bef1){var _0x546e88=this;return new Promise(function(_0x295817,_0x2194e7){return db['VoiceTransferReport'][_0x250e('0x16')](_0x44bef1[_0x250e('0x17')],{'raw':_0x44bef1[_0x250e('0x18')]?_0x44bef1[_0x250e('0x18')][_0x250e('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x383946){logger[_0x250e('0xc')](_0x250e('0x1a'),_0x44bef1);logger[_0x250e('0xf')](_0x250e('0x1a'),_0x44bef1,JSON[_0x250e('0x11')](_0x383946));_0x295817(_0x383946);})[_0x250e('0x1b')](function(_0x6eb68c){logger[_0x250e('0x12')](_0x250e('0x1a'),_0x6eb68c['message'],_0x44bef1);_0x2194e7(_0x546e88[_0x250e('0x12')](0x1f4,_0x6eb68c['message']));});});}; \ No newline at end of file +var _0xb9a8=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','options','raw','then','util','moment'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0xb9a8,0x12a));var _0x8b9a=function(_0x1a856a,_0x48b14e){_0x1a856a=_0x1a856a-0x0;var _0x56edf4=_0xb9a8[_0x1a856a];return _0x56edf4;};'use strict';var _=require('lodash');var util=require(_0x8b9a('0x0'));var moment=require(_0x8b9a('0x1'));var BPromise=require(_0x8b9a('0x2'));var rs=require(_0x8b9a('0x3'));var fs=require('fs');var Redis=require(_0x8b9a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8b9a('0x5'))(_0x8b9a('0x6'));var config=require(_0x8b9a('0x7'));var jayson=require(_0x8b9a('0x8'));var client=jayson[_0x8b9a('0x9')][_0x8b9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bdd97,_0x2ac442,_0x528c42){return new BPromise(function(_0x30be12,_0xb50292){return client['request'](_0x3bdd97,_0x528c42)['then'](function(_0x5133e3){logger[_0x8b9a('0xb')](_0x8b9a('0xc'),_0x2ac442,_0x8b9a('0xd'));logger[_0x8b9a('0xe')](_0x8b9a('0xf'),_0x2ac442,_0x8b9a('0xd'),JSON[_0x8b9a('0x10')](_0x5133e3));if(_0x5133e3[_0x8b9a('0x11')]){if(_0x5133e3[_0x8b9a('0x11')][_0x8b9a('0x12')]===0x1f4){logger[_0x8b9a('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2ac442,_0x5133e3[_0x8b9a('0x11')][_0x8b9a('0x13')]);return _0xb50292(_0x5133e3[_0x8b9a('0x11')][_0x8b9a('0x13')]);}logger[_0x8b9a('0x11')](_0x8b9a('0xc'),_0x2ac442,_0x5133e3['error'][_0x8b9a('0x13')]);return _0x30be12(_0x5133e3[_0x8b9a('0x11')][_0x8b9a('0x13')]);}else{logger[_0x8b9a('0xb')](_0x8b9a('0xc'),_0x2ac442,_0x8b9a('0xd'));_0x30be12(_0x5133e3['result'][_0x8b9a('0x13')]);}})[_0x8b9a('0x14')](function(_0x4c124e){logger[_0x8b9a('0x11')](_0x8b9a('0xc'),_0x2ac442,_0x4c124e);_0xb50292(_0x4c124e);});});}exports[_0x8b9a('0x15')]=function(_0x38ac60){var _0x56cb17=this;return new Promise(function(_0x5b94a9,_0x27fefc){return db['VoiceTransferReport']['create'](_0x38ac60['body'],{'raw':_0x38ac60[_0x8b9a('0x16')]?_0x38ac60[_0x8b9a('0x16')][_0x8b9a('0x17')]===undefined?!![]:![]:!![]})[_0x8b9a('0x18')](function(_0x3b4b8b){logger['info'](_0x8b9a('0x15'),_0x38ac60);logger['debug']('CreateVoiceTransferReport',_0x38ac60,JSON['stringify'](_0x3b4b8b));_0x5b94a9(_0x3b4b8b);})[_0x8b9a('0x14')](function(_0x2a5871){logger[_0x8b9a('0x11')]('CreateVoiceTransferReport',_0x2a5871[_0x8b9a('0x13')],_0x38ac60);_0x27fefc(_0x56cb17[_0x8b9a('0x11')](0x1f4,_0x2a5871[_0x8b9a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8ebd5d0..55ec8ae 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 _0x6f0d=['isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x199fcb,_0x4590e0){var _0x17a868=function(_0x1f5344){while(--_0x1f5344){_0x199fcb['push'](_0x199fcb['shift']());}};_0x17a868(++_0x4590e0);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x520748,_0xb83b9c){_0x520748=_0x520748-0x0;var _0x3c53a6=_0x6f0d[_0x520748];return _0x3c53a6;};'use strict';var express=require('express');var router=express[_0xd6f0('0x0')]();var auth=require(_0xd6f0('0x1'));var controller=require(_0xd6f0('0x2'));router[_0xd6f0('0x3')]('/originate',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0x6')]);router[_0xd6f0('0x3')](_0xd6f0('0x7'),auth['isAuthenticated'](),auth[_0xd6f0('0x5')](),controller['hangup']);router[_0xd6f0('0x3')](_0xd6f0('0x8'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller['answer']);router['post'](_0xd6f0('0x9'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xa')]);router[_0xd6f0('0x3')]('/unhold',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xb')]);router[_0xd6f0('0x3')]('/calls',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x3')](_0xd6f0('0xd'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xe')]);module[_0xd6f0('0xf')]=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x56844b,_0x4f0a52){var _0x567d29=function(_0x486d7d){while(--_0x486d7d){_0x56844b['push'](_0x56844b['shift']());}};_0x567d29(++_0x4f0a52);}(_0xdace,0xc5));var _0xedac=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xdace[_0x277107];return _0x1da046;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index e2a9b83..a7e638a 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 _0xf2cb=['all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls','rows','conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../config/environment','bluebird','client','http','ioredis','redis','defaults','socket.io-emitter','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','error','name','status','send','NotFound','then','message','result','catch','findOne','agent','VoiceChannels'];(function(_0x5895ff,_0x3e4a2a){var _0x132438=function(_0x40f153){while(--_0x40f153){_0x5895ff['push'](_0x5895ff['shift']());}};_0x132438(++_0x3e4a2a);}(_0xf2cb,0x130));var _0xbf2c=function(_0x5adc28,_0x32bf5b){_0x5adc28=_0x5adc28-0x0;var _0xf5b85e=_0xf2cb[_0x5adc28];return _0xf5b85e;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xbf2c('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xbf2c('0x1'));var util=require('util');var BPromise=require(_0xbf2c('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0xbf2c('0x3')][_0xbf2c('0x4')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xbf2c('0x5'));config[_0xbf2c('0x6')]=_[_0xbf2c('0x7')](config[_0xbf2c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xbf2c('0x8'))(new Redis(config['redis']));var Schema=require(_0xbf2c('0x9'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xbf2c('0xa'),'required':[!![],_0xbf2c('0xb')]},'callerId':{'type':_0xbf2c('0xa')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xbf2c('0xc'),'required':[!![],_0xbf2c('0xd')]},'sessionId':{'type':_0xbf2c('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbf2c('0xc'),'required':[!![],_0xbf2c('0xd')]},'sessionId':{'type':_0xbf2c('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xbf2c('0xc'),'required':[!![],_0xbf2c('0xd')]},'sessionId':{'type':'string','required':[!![],_0xbf2c('0xe')]},'transferNumber':{'type':_0xbf2c('0xa'),'required':[!![],_0xbf2c('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0xbf2c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xbf2c('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xbf2c('0xa'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xbf2c('0xc'),'required':[!![],_0xbf2c('0xd')]}});function emit(_0x2dc80e,_0x334900,_0x2af371){logger['info'](_0x2dc80e,_0x334900,JSON[_0xbf2c('0x10')](_0x2af371));io['to'](_0x2dc80e)['emit'](_0x334900,_0x2af371);}function handleError(_0x4ced7f){return function(_0x1df2ab){console[_0xbf2c('0x11')](_0xbf2c('0x12'),_0x1df2ab,_0x1df2ab instanceof RangeError);logger[_0xbf2c('0x13')](_0x1df2ab['stack']);if(_0x1df2ab instanceof RangeError){if(_0x1df2ab[_0xbf2c('0x14')]){delete _0x1df2ab[_0xbf2c('0x14')];}_0x4ced7f[_0xbf2c('0x15')](0x194)[_0xbf2c('0x16')](_0x1df2ab);}else{if(_0x1df2ab[_0xbf2c('0x14')]){delete _0x1df2ab[_0xbf2c('0x14')];}_0x4ced7f[_0xbf2c('0x15')](0x1f4)['send'](_0x1df2ab);}};}function checkError(){return function(_0x61248b){if(!_0x61248b){throw new RangeError(_0xbf2c('0x17'));}return _0x61248b;};}function respondWithRpcPromise(_0x96a759,_0xe6dad9){return new BPromise(function(_0x57873c,_0x2bc2ad){var _0x1f5515=amiClient;return _0x1f5515['request'](_0x96a759,_0xe6dad9)[_0xbf2c('0x18')](function(_0x356f26){if(_0x356f26[_0xbf2c('0x13')]){if(_0x356f26['error']['code']===0x1f4){return _0x2bc2ad(_0x356f26[_0xbf2c('0x13')][_0xbf2c('0x19')]);}return _0x57873c(_0x356f26[_0xbf2c('0x13')][_0xbf2c('0x19')]);}else{_0x57873c(_0x356f26[_0xbf2c('0x1a')]);}})[_0xbf2c('0x1b')](function(_0x11ffbe){_0x2bc2ad(_0x11ffbe);});});}function getAgent(_0x4df358){return db['User'][_0xbf2c('0x1c')]({'where':{'id':_0x4df358,'role':_0xbf2c('0x1d')}})[_0xbf2c('0x18')](checkError());}function getAgentCheckSession(_0x4314d6,_0x3ed68d){return new BPromise(function(_0x4a0257,_0x30ca){var _0x2976fa=respondWithRpcPromise(_0xbf2c('0x1e'));var _0x4f3191=getAgent(_0x4314d6);Promise[_0xbf2c('0x1f')]([_0x2976fa,_0x4f3191])['then'](function(_0x3a9130){var _0x3442fa=_0x3a9130[0x0];var _0x40e866=_0x3a9130[0x1];var _0x17238f=_[_0xbf2c('0x20')](_0x3442fa['rows'],function(_0x1e946c){return _0x1e946c[_0xbf2c('0x21')]==_0x40e866['id']&&_0x1e946c[_0xbf2c('0x22')]==_0x3ed68d;});if(_0x17238f[_0xbf2c('0x23')]==0x1){_0x4a0257(_0x40e866);}else{_0x30ca(new RangeError(_0xbf2c('0x24')+_0x3ed68d+_0xbf2c('0x25')));}});});}exports[_0xbf2c('0x26')]=function(_0x3462dd,_0x4d731d){logger[_0xbf2c('0x27')](_0xbf2c('0x28'),_0x3462dd[_0xbf2c('0x29')]);var _0x5b93aa=originateValidation['validate'](_0x3462dd[_0xbf2c('0x29')]);if(_0x5b93aa[_0xbf2c('0x23')]>0x0){return _0x4d731d[_0xbf2c('0x15')](0x190)[_0xbf2c('0x2a')](_0x5b93aa);}var _0x286634=_0x3462dd[_0xbf2c('0x29')][_0xbf2c('0x2b')];var _0x255cbc=_0x3462dd[_0xbf2c('0x29')]['callNumber'];var _0x218363=_0x3462dd[_0xbf2c('0x29')][_0xbf2c('0x2c')];var _0x3a0134=_0x3462dd[_0xbf2c('0x29')][_0xbf2c('0x2d')];return getAgent(_0x286634)[_0xbf2c('0x18')](function(_0x4722b3){logger['info'](_0xbf2c('0x2e'),_0x4722b3[_0xbf2c('0x14')]);emit(util[_0xbf2c('0x2f')]('user:%s',_0x4722b3[_0xbf2c('0x14')]),_0xbf2c('0x30'),{'callNumber':_0x255cbc,'callerId':_0x218363,'callbackUrl':_0x3a0134});return _0x4d731d[_0xbf2c('0x15')](0xc8)['json']({'error':![],'message':_0xbf2c('0x31')});})[_0xbf2c('0x1b')](handleError(_0x4d731d));};exports['hangup']=function(_0x5d683d,_0x47ab9a){logger['info']('hangup\x20fired:',_0x5d683d[_0xbf2c('0x29')]);var _0x13652a=hangupValidation[_0xbf2c('0x9')](_0x5d683d[_0xbf2c('0x29')]);if(_0x13652a[_0xbf2c('0x23')]>0x0){return _0x47ab9a[_0xbf2c('0x15')](0x190)[_0xbf2c('0x2a')](_0x13652a);}var _0x325581=_0x5d683d[_0xbf2c('0x29')][_0xbf2c('0x2b')];var _0x245eaf=_0x5d683d[_0xbf2c('0x29')][_0xbf2c('0x22')];return getAgent(_0x325581)[_0xbf2c('0x18')](function(_0x4776e0){logger[_0xbf2c('0x27')]('entityFound:',_0x4776e0[_0xbf2c('0x14')]);emit(util[_0xbf2c('0x2f')](_0xbf2c('0x32'),_0x4776e0[_0xbf2c('0x14')]),_0xbf2c('0x33'),{'sessionId':_0x245eaf});return _0x47ab9a[_0xbf2c('0x15')](0xc8)[_0xbf2c('0x2a')]({'error':![],'message':_0xbf2c('0x34')});})['catch'](handleError(_0x47ab9a));};exports[_0xbf2c('0x35')]=function(_0x2bccc2,_0x652066){logger[_0xbf2c('0x27')]('answer\x20fired:',_0x2bccc2[_0xbf2c('0x29')]);var _0x5067d2=answerValidation[_0xbf2c('0x9')](_0x2bccc2[_0xbf2c('0x29')]);if(_0x5067d2[_0xbf2c('0x23')]>0x0){return _0x652066[_0xbf2c('0x15')](0x190)[_0xbf2c('0x2a')](_0x5067d2);}var _0x14107c=_0x2bccc2['body'][_0xbf2c('0x2b')];var _0x55c3d7=_0x2bccc2['body'][_0xbf2c('0x22')];return getAgent(_0x14107c)['then'](function(_0x57ddb9){logger[_0xbf2c('0x27')](_0xbf2c('0x2e'),_0x57ddb9['name']);emit(util[_0xbf2c('0x2f')]('user:%s',_0x57ddb9[_0xbf2c('0x14')]),'webbar:answer',{'sessionId':_0x55c3d7});return _0x652066[_0xbf2c('0x15')](0xc8)[_0xbf2c('0x2a')]({'error':![],'message':_0xbf2c('0x36')});})[_0xbf2c('0x1b')](handleError(_0x652066));};exports[_0xbf2c('0x37')]=function(_0x4187cf,_0x54ce68){logger[_0xbf2c('0x27')](_0xbf2c('0x38'),_0x4187cf[_0xbf2c('0x29')]);var _0x1b50a6=holdValidation[_0xbf2c('0x9')](_0x4187cf['body']);if(_0x1b50a6['length']>0x0){return _0x54ce68[_0xbf2c('0x15')](0x190)['json'](_0x1b50a6);}var _0xa08482=_0x4187cf[_0xbf2c('0x29')][_0xbf2c('0x2b')];var _0x1750ec=_0x4187cf[_0xbf2c('0x29')][_0xbf2c('0x22')];return getAgent(_0xa08482)[_0xbf2c('0x18')](function(_0x1c3b78){logger[_0xbf2c('0x27')](_0xbf2c('0x2e'),_0x1c3b78[_0xbf2c('0x14')]);emit(util['format'](_0xbf2c('0x32'),_0x1c3b78[_0xbf2c('0x14')]),_0xbf2c('0x39'),{'sessionId':_0x1750ec});return _0x54ce68[_0xbf2c('0x15')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x54ce68));};exports[_0xbf2c('0x3a')]=function(_0x2451ba,_0x56c470){logger['info']('unhold\x20fired:',_0x2451ba[_0xbf2c('0x29')]);var _0x314f7b=unholdValidation[_0xbf2c('0x9')](_0x2451ba[_0xbf2c('0x29')]);if(_0x314f7b[_0xbf2c('0x23')]>0x0){return _0x56c470[_0xbf2c('0x15')](0x190)['json'](_0x314f7b);}var _0xfff73d=_0x2451ba[_0xbf2c('0x29')][_0xbf2c('0x2b')];var _0x3fa07e=_0x2451ba[_0xbf2c('0x29')][_0xbf2c('0x22')];return getAgent(_0xfff73d)[_0xbf2c('0x18')](function(_0x180aad){logger['info']('entityFound:',_0x180aad['name']);emit(util[_0xbf2c('0x2f')](_0xbf2c('0x32'),_0x180aad[_0xbf2c('0x14')]),_0xbf2c('0x3b'),{'sessionId':_0x3fa07e});return _0x56c470['status'](0xc8)[_0xbf2c('0x2a')]({'error':![],'message':_0xbf2c('0x3c')});})['catch'](handleError(_0x56c470));};exports[_0xbf2c('0x3d')]=function(_0xcbe3be,_0x20229f){logger['info']('calls\x20fired:',_0x20229f['body']);var _0x49cae6=callsValidation[_0xbf2c('0x9')](_0xcbe3be[_0xbf2c('0x29')]);if(_0x49cae6[_0xbf2c('0x23')]>0x0){return _0x20229f[_0xbf2c('0x15')](0x190)[_0xbf2c('0x2a')](_0x49cae6);}var _0x5c7321=_0xcbe3be[_0xbf2c('0x29')][_0xbf2c('0x2b')];var _0x58b66a=respondWithRpcPromise(_0xbf2c('0x1e'));var _0x3f0129=getAgent(_0x5c7321);return Promise['all']([_0x58b66a,_0x3f0129])['then'](function(_0x5062a3){var _0x363f77=_0x5062a3[0x0];var _0x5df133=_0x5062a3[0x1];var _0x5cf1df=_[_0xbf2c('0x20')](_0x363f77[_0xbf2c('0x3e')],function(_0x2b84c6){return _0x2b84c6[_0xbf2c('0x21')]==_0x5df133['id'];});return _0x20229f['status'](0xc8)['json']({'count':_0x5cf1df[_0xbf2c('0x23')],'rows':_0x5cf1df});})[_0xbf2c('0x1b')](handleError(_0x20229f));};exports[_0xbf2c('0x3f')]=function(_0x2960fc,_0x151341){logger['info']('conference\x20fired:',_0x2960fc[_0xbf2c('0x29')]);var _0x1a4bf7=conferenceValidation[_0xbf2c('0x9')](_0x2960fc[_0xbf2c('0x29')]);if(_0x1a4bf7[_0xbf2c('0x23')]>0x0){return _0x151341[_0xbf2c('0x15')](0x190)['json'](_0x1a4bf7);}var _0x5b37b1=_0x2960fc[_0xbf2c('0x29')][_0xbf2c('0x2b')];return getAgent(_0x5b37b1)[_0xbf2c('0x18')](function(_0x1b9f8d){logger[_0xbf2c('0x27')](_0xbf2c('0x2e'),_0x1b9f8d[_0xbf2c('0x14')]);emit(util[_0xbf2c('0x2f')](_0xbf2c('0x32'),_0x1b9f8d['name']),'webbar:conference');return _0x151341[_0xbf2c('0x15')](0xc8)[_0xbf2c('0x2a')]({'error':![],'message':_0xbf2c('0x40')});})[_0xbf2c('0x1b')](handleError(_0x151341));};exports['transfer']=function(_0x436c4d,_0x2a1816){logger[_0xbf2c('0x27')]('transfer\x20fired:',_0x436c4d[_0xbf2c('0x29')]);var _0x1aa7c3=transferValidation[_0xbf2c('0x9')](_0x436c4d[_0xbf2c('0x29')]);if(_0x1aa7c3['length']>0x0){return _0x2a1816[_0xbf2c('0x15')](0x190)[_0xbf2c('0x2a')](_0x1aa7c3);}var _0x425a46=_0x436c4d['body']['userId'];var _0x295790=_0x436c4d['body']['sessionId'];var _0x1e2d67=_0x436c4d[_0xbf2c('0x29')][_0xbf2c('0x41')];return getAgent(_0x425a46)[_0xbf2c('0x18')](function(_0x1d7bf8){logger['info']('entityFound:',_0x1d7bf8[_0xbf2c('0x14')]);emit(util[_0xbf2c('0x2f')]('user:%s',_0x1d7bf8[_0xbf2c('0x14')]),_0xbf2c('0x42'),{'sessionId':_0x295790,'transferNumber':_0x1e2d67});return _0x2a1816['status'](0xc8)[_0xbf2c('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0xbf2c('0x1b')](handleError(_0x2a1816));}; \ No newline at end of file +var _0xa74f=['user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','VoiceChannels','filter','rows','conference\x20fired:','webbar:conference','transfer','transferNumber','transfer\x20executed!','../../mysqldb','bluebird','jayson/promise','client','http','webbarapi','defaults','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','error','stack','name','status','send','message','catch','User','agent','then','all','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callerId','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','format','webbar:hangup','hangup\x20executed!','answer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa74f,0x9a));var _0xfa74=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0xa74f[_0x356e8d];return _0x39e65a;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xfa74('0x0'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xfa74('0x1'));var jayson=require(_0xfa74('0x2'));var amiClient=jayson[_0xfa74('0x3')][_0xfa74('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xfa74('0x5'));var Redis=require('ioredis');config['redis']=_[_0xfa74('0x6')](config[_0xfa74('0x7')],{'host':_0xfa74('0x8'),'port':0x18eb});var io=require(_0xfa74('0x9'))(new Redis(config[_0xfa74('0x7')]));var Schema=require(_0xfa74('0xa'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]},'callNumber':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0xd')]},'callerId':{'type':_0xfa74('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0xf')]},'transferNumber':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]}});function emit(_0x1f1de0,_0x3867f8,_0x40af70){logger[_0xfa74('0x11')](_0x1f1de0,_0x3867f8,JSON['stringify'](_0x40af70));io['to'](_0x1f1de0)[_0xfa74('0x12')](_0x3867f8,_0x40af70);}function handleError(_0xe0e33d){return function(_0x51dda1){console['log'](_0xfa74('0x13'),_0x51dda1,_0x51dda1 instanceof RangeError);logger[_0xfa74('0x14')](_0x51dda1[_0xfa74('0x15')]);if(_0x51dda1 instanceof RangeError){if(_0x51dda1['name']){delete _0x51dda1[_0xfa74('0x16')];}_0xe0e33d[_0xfa74('0x17')](0x194)[_0xfa74('0x18')](_0x51dda1);}else{if(_0x51dda1['name']){delete _0x51dda1[_0xfa74('0x16')];}_0xe0e33d[_0xfa74('0x17')](0x1f4)[_0xfa74('0x18')](_0x51dda1);}};}function checkError(){return function(_0x4a5ee4){if(!_0x4a5ee4){throw new RangeError('NotFound');}return _0x4a5ee4;};}function respondWithRpcPromise(_0x100851,_0x2257a0){return new BPromise(function(_0x9932db,_0xeaaa19){var _0x1a453d=amiClient;return _0x1a453d['request'](_0x100851,_0x2257a0)['then'](function(_0x3721bf){if(_0x3721bf['error']){if(_0x3721bf['error']['code']===0x1f4){return _0xeaaa19(_0x3721bf[_0xfa74('0x14')][_0xfa74('0x19')]);}return _0x9932db(_0x3721bf[_0xfa74('0x14')]['message']);}else{_0x9932db(_0x3721bf['result']);}})[_0xfa74('0x1a')](function(_0xeb6c11){_0xeaaa19(_0xeb6c11);});});}function getAgent(_0x5ed1c8){return db[_0xfa74('0x1b')]['findOne']({'where':{'id':_0x5ed1c8,'role':_0xfa74('0x1c')}})[_0xfa74('0x1d')](checkError());}function getAgentCheckSession(_0x55d8e4,_0x298388){return new BPromise(function(_0x1130de,_0x122415){var _0x218c86=respondWithRpcPromise('VoiceChannels');var _0xd9c55d=getAgent(_0x55d8e4);Promise[_0xfa74('0x1e')]([_0x218c86,_0xd9c55d])[_0xfa74('0x1d')](function(_0x57d90e){var _0x4d4bed=_0x57d90e[0x0];var _0x1322a4=_0x57d90e[0x1];var _0x8b706e=_['filter'](_0x4d4bed['rows'],function(_0x343466){return _0x343466['UserId']==_0x1322a4['id']&&_0x343466[_0xfa74('0x1f')]==_0x298388;});if(_0x8b706e['length']==0x1){_0x1130de(_0x1322a4);}else{_0x122415(new RangeError(_0xfa74('0x20')+_0x298388+_0xfa74('0x21')));}});});}exports[_0xfa74('0x22')]=function(_0xdd93e5,_0x4c506f){logger[_0xfa74('0x11')](_0xfa74('0x23'),_0xdd93e5[_0xfa74('0x24')]);var _0x16f9dc=originateValidation[_0xfa74('0xa')](_0xdd93e5[_0xfa74('0x24')]);if(_0x16f9dc[_0xfa74('0x25')]>0x0){return _0x4c506f['status'](0x190)[_0xfa74('0x26')](_0x16f9dc);}var _0x5a9f43=_0xdd93e5[_0xfa74('0x24')][_0xfa74('0x27')];var _0xcc5e32=_0xdd93e5[_0xfa74('0x24')]['callNumber'];var _0x5055d3=_0xdd93e5[_0xfa74('0x24')][_0xfa74('0x28')];var _0x44b725=_0xdd93e5[_0xfa74('0x24')]['callbackUrl'];return getAgent(_0x5a9f43)[_0xfa74('0x1d')](function(_0x231698){logger['info']('entityFound:',_0x231698['name']);emit(util['format']('user:%s',_0x231698[_0xfa74('0x16')]),_0xfa74('0x29'),{'callNumber':_0xcc5e32,'callerId':_0x5055d3,'callbackUrl':_0x44b725});return _0x4c506f[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x2a')});})[_0xfa74('0x1a')](handleError(_0x4c506f));};exports[_0xfa74('0x2b')]=function(_0x13475a,_0x1a2d52){logger['info'](_0xfa74('0x2c'),_0x13475a[_0xfa74('0x24')]);var _0x430339=hangupValidation[_0xfa74('0xa')](_0x13475a[_0xfa74('0x24')]);if(_0x430339[_0xfa74('0x25')]>0x0){return _0x1a2d52['status'](0x190)[_0xfa74('0x26')](_0x430339);}var _0x1f0806=_0x13475a[_0xfa74('0x24')][_0xfa74('0x27')];var _0x5853d4=_0x13475a[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x1f0806)[_0xfa74('0x1d')](function(_0x35f252){logger['info'](_0xfa74('0x2d'),_0x35f252[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')]('user:%s',_0x35f252['name']),_0xfa74('0x2f'),{'sessionId':_0x5853d4});return _0x1a2d52[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x30')});})['catch'](handleError(_0x1a2d52));};exports[_0xfa74('0x31')]=function(_0x171923,_0x54e66d){logger['info']('answer\x20fired:',_0x171923['body']);var _0x95c891=answerValidation[_0xfa74('0xa')](_0x171923[_0xfa74('0x24')]);if(_0x95c891[_0xfa74('0x25')]>0x0){return _0x54e66d[_0xfa74('0x17')](0x190)[_0xfa74('0x26')](_0x95c891);}var _0x7735c5=_0x171923['body'][_0xfa74('0x27')];var _0x3938c1=_0x171923[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x7735c5)[_0xfa74('0x1d')](function(_0x4af7d4){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x4af7d4[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x4af7d4[_0xfa74('0x16')]),_0xfa74('0x33'),{'sessionId':_0x3938c1});return _0x54e66d[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x34')});})['catch'](handleError(_0x54e66d));};exports[_0xfa74('0x35')]=function(_0x4ebb67,_0xb7db3){logger[_0xfa74('0x11')](_0xfa74('0x36'),_0x4ebb67[_0xfa74('0x24')]);var _0x4911a5=holdValidation[_0xfa74('0xa')](_0x4ebb67[_0xfa74('0x24')]);if(_0x4911a5['length']>0x0){return _0xb7db3[_0xfa74('0x17')](0x190)[_0xfa74('0x26')](_0x4911a5);}var _0x5cbb70=_0x4ebb67[_0xfa74('0x24')][_0xfa74('0x27')];var _0x26d239=_0x4ebb67[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x5cbb70)['then'](function(_0x54e06c){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x54e06c['name']);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x54e06c[_0xfa74('0x16')]),'webbar:hold',{'sessionId':_0x26d239});return _0xb7db3['status'](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x37')});})[_0xfa74('0x1a')](handleError(_0xb7db3));};exports[_0xfa74('0x38')]=function(_0x36508a,_0x3cb23d){logger[_0xfa74('0x11')](_0xfa74('0x39'),_0x36508a['body']);var _0x214994=unholdValidation[_0xfa74('0xa')](_0x36508a[_0xfa74('0x24')]);if(_0x214994[_0xfa74('0x25')]>0x0){return _0x3cb23d['status'](0x190)['json'](_0x214994);}var _0x3146de=_0x36508a['body'][_0xfa74('0x27')];var _0x221dc7=_0x36508a[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x3146de)[_0xfa74('0x1d')](function(_0x144c80){logger[_0xfa74('0x11')]('entityFound:',_0x144c80[_0xfa74('0x16')]);emit(util['format'](_0xfa74('0x32'),_0x144c80['name']),'webbar:unhold',{'sessionId':_0x221dc7});return _0x3cb23d[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x3cb23d));};exports[_0xfa74('0x3a')]=function(_0x1ab715,_0x8afe72){logger[_0xfa74('0x11')](_0xfa74('0x3b'),_0x8afe72[_0xfa74('0x24')]);var _0x1198f3=callsValidation[_0xfa74('0xa')](_0x1ab715[_0xfa74('0x24')]);if(_0x1198f3[_0xfa74('0x25')]>0x0){return _0x8afe72['status'](0x190)[_0xfa74('0x26')](_0x1198f3);}var _0xc89005=_0x1ab715['body']['userId'];var _0x3d88dc=respondWithRpcPromise(_0xfa74('0x3c'));var _0x99f568=getAgent(_0xc89005);return Promise[_0xfa74('0x1e')]([_0x3d88dc,_0x99f568])[_0xfa74('0x1d')](function(_0x5475f1){var _0x36cfc6=_0x5475f1[0x0];var _0x4d6235=_0x5475f1[0x1];var _0x26b398=_[_0xfa74('0x3d')](_0x36cfc6[_0xfa74('0x3e')],function(_0x480295){return _0x480295['UserId']==_0x4d6235['id'];});return _0x8afe72[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'count':_0x26b398[_0xfa74('0x25')],'rows':_0x26b398});})[_0xfa74('0x1a')](handleError(_0x8afe72));};exports['conference']=function(_0xe87727,_0x2f5c31){logger['info'](_0xfa74('0x3f'),_0xe87727[_0xfa74('0x24')]);var _0x1861af=conferenceValidation[_0xfa74('0xa')](_0xe87727['body']);if(_0x1861af[_0xfa74('0x25')]>0x0){return _0x2f5c31['status'](0x190)[_0xfa74('0x26')](_0x1861af);}var _0x3ceb9d=_0xe87727[_0xfa74('0x24')][_0xfa74('0x27')];return getAgent(_0x3ceb9d)[_0xfa74('0x1d')](function(_0x6a3790){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x6a3790[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x6a3790[_0xfa74('0x16')]),_0xfa74('0x40'));return _0x2f5c31[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':'conference\x20executed!'});})[_0xfa74('0x1a')](handleError(_0x2f5c31));};exports[_0xfa74('0x41')]=function(_0x5035dd,_0x57a923){logger[_0xfa74('0x11')]('transfer\x20fired:',_0x5035dd[_0xfa74('0x24')]);var _0x2e8174=transferValidation[_0xfa74('0xa')](_0x5035dd['body']);if(_0x2e8174[_0xfa74('0x25')]>0x0){return _0x57a923['status'](0x190)['json'](_0x2e8174);}var _0x1856ea=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x27')];var _0x414e31=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x1f')];var _0x70120d=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x42')];return getAgent(_0x1856ea)[_0xfa74('0x1d')](function(_0x2588bb){logger['info'](_0xfa74('0x2d'),_0x2588bb['name']);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x2588bb[_0xfa74('0x16')]),'webbar:transfer',{'sessionId':_0x414e31,'transferNumber':_0x70120d});return _0x57a923[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x43')});})['catch'](handleError(_0x57a923));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ce57376..893511b 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 _0x93e9=['/describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addApplications','/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0x93e9,0xcc));var _0x993e=function(_0x175196,_0x4bfaa0){_0x175196=_0x175196-0x0;var _0x3540db=_0x93e9[_0x175196];return _0x3540db;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getDispositions']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x993e('0x9')]('/:id/users',auth[_0x993e('0xa')](),controller['getAgents']);router['get'](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x12')]);router[_0x993e('0x13')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0x14')]);router[_0x993e('0x13')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller[_0x993e('0x15')]);router[_0x993e('0x13')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x16')]);router[_0x993e('0x13')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller['addAgents']);router[_0x993e('0x13')](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x18')]);router[_0x993e('0x13')](_0x993e('0x19'),controller['notify']);router[_0x993e('0x13')](_0x993e('0x1a'),auth[_0x993e('0xa')](),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0x1d')]);router['delete'](_0x993e('0xd'),auth['isAuthenticated'](),controller[_0x993e('0x1e')]);router[_0x993e('0x1f')](_0x993e('0xf'),auth['isAuthenticated'](),controller[_0x993e('0x20')]);router[_0x993e('0x1f')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x21')]);router[_0x993e('0x1f')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller[_0x993e('0x22')]);module[_0x993e('0x23')]=router; \ No newline at end of file +var _0xdb28=['removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','destroy'];(function(_0x25f051,_0x2fc208){var _0x41f941=function(_0x58cd32){while(--_0x58cd32){_0x25f051['push'](_0x25f051['shift']());}};_0x41f941(++_0x2fc208);}(_0xdb28,0x106));var _0x8db2=function(_0x143df2,_0x38827d){_0x143df2=_0x143df2-0x0;var _0x230770=_0xdb28[_0x143df2];return _0x230770;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./whatsappAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x15')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x15')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x17')]);router[_0x8db2('0x15')](_0x8db2('0x11'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x15')]('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x19')]);router[_0x8db2('0x15')](_0x8db2('0x1a'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['post']('/:id/notify',controller[_0x8db2('0x1c')]);router[_0x8db2('0x15')](_0x8db2('0x1d'),auth[_0x8db2('0xa')](),controller['send']);router[_0x8db2('0x1e')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x20')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x22')]);router[_0x8db2('0x20')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8db2('0x23')]);module[_0x8db2('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 491b123..eb97176 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 _0x50ba=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','randomstring','exports','STRING','name','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x117842,_0x1b5654){var _0x41c64a=function(_0x50a526){while(--_0x50a526){_0x117842['push'](_0x117842['shift']());}};_0x41c64a(++_0x1b5654);}(_0x50ba,0x1cc));var _0xa50b=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x50ba[_0x1663ae];return _0x30ffb8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa50b('0x0'));module[_0xa50b('0x1')]={'name':{'type':Sequelize[_0xa50b('0x2')],'unique':_0xa50b('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xa50b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa50b('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xa50b('0x4'),_0xa50b('0x5'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa50b('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa50b('0x6')],'defaultValue':function(){return _0xa50b('0x7');}},'notificationSound':{'type':Sequelize[_0xa50b('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa50b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa50b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa50b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa50b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa50b('0x9')],'comment':_0xa50b('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4d67da){if(!_0x4d67da){this[_0xa50b('0xb')]('mandatoryDispositionPauseId',null);}this[_0xa50b('0xb')]('mandatoryDisposition',_0x4d67da);}},'description':{'type':Sequelize[_0xa50b('0x2')]}}; \ No newline at end of file +var _0xd276=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xf35321,_0x2b8033){var _0x538d16=function(_0x1a66a0){while(--_0x1a66a0){_0xf35321['push'](_0xf35321['shift']());}};_0x538d16(++_0x2b8033);}(_0xd276,0x198));var _0x6d27=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd276[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x6d27('0x0'));var rs=require('randomstring');module[_0x6d27('0x1')]={'name':{'type':Sequelize[_0x6d27('0x2')],'unique':_0x6d27('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6d27('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6d27('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6d27('0x2')],'defaultValue':function(){return rs[_0x6d27('0x4')]();}},'phone':{'type':Sequelize[_0x6d27('0x2')]},'type':{'type':Sequelize[_0x6d27('0x5')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0x6d27('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6d27('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6d27('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6d27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6d27('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6d27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6d27('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d27('0x7')],'comment':_0x6d27('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6d27('0xa'),'set':function(_0x36924c){if(!_0x36924c){this[_0x6d27('0xb')](_0x6d27('0xc'),null);}this[_0x6d27('0xb')](_0x6d27('0xd'),_0x36924c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8e583f4..00b9f14 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 _0xead0=['startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','List','WhatsappInteraction','out','Messages','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/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','get','WhatsappAccounts','destroy','name','send','index','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','find','create','body','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Pause','describe','addDisposition','WhatsappAccountId','getDispositions','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','findOne','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','replace','whatsapp:','Body','messageId','sinch','notifications','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','ListId','CmContact','Contacts','DESC','defaults','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start'];(function(_0x54e69e,_0x583266){var _0xbb7ed7=function(_0x339a6a){while(--_0x339a6a){_0x54e69e['push'](_0x54e69e['shift']());}};_0xbb7ed7(++_0x583266);}(_0xead0,0x18f));var _0x0ead=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0xead0[_0x15a8fa];return _0x1355c2;};'use strict';var emlformat=require(_0x0ead('0x0'));var rimraf=require(_0x0ead('0x1'));var zipdir=require(_0x0ead('0x2'));var jsonpatch=require(_0x0ead('0x3'));var rp=require(_0x0ead('0x4'));var moment=require(_0x0ead('0x5'));var BPromise=require(_0x0ead('0x6'));var Mustache=require('mustache');var util=require(_0x0ead('0x7'));var path=require(_0x0ead('0x8'));var sox=require('sox');var csv=require(_0x0ead('0x9'));var ejs=require(_0x0ead('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ead('0xb'));var squel=require(_0x0ead('0xc'));var crypto=require(_0x0ead('0xd'));var jsforce=require(_0x0ead('0xe'));var deskjs=require(_0x0ead('0xf'));var toCsv=require(_0x0ead('0x9'));var querystring=require(_0x0ead('0x10'));var Papa=require(_0x0ead('0x11'));var Redis=require(_0x0ead('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0ead('0x13'));var as=require(_0x0ead('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ead('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0ead('0x16'));var licenseUtil=require(_0x0ead('0x17'));var db=require(_0x0ead('0x18'))['db'];config[_0x0ead('0x19')]=_['defaults'](config['redis'],{'host':_0x0ead('0x1a'),'port':0x18eb});var socket=require(_0x0ead('0x1b'))(new Redis(config[_0x0ead('0x19')]));require(_0x0ead('0x1c'))[_0x0ead('0x1d')](socket);var jayson=require(_0x0ead('0x1e'));var client=jayson[_0x0ead('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x411e87,_0xdd64d7,_0x38bdc3,_0x11d4f7){return new BPromise(function(_0x116bde,_0x56de9f){var _0x13a136=_0x11d4f7||client;return _0x13a136[_0x0ead('0x20')](_0x411e87,_0x38bdc3)[_0x0ead('0x21')](function(_0x34a050){logger[_0x0ead('0x22')](_0x0ead('0x23'),_0xdd64d7,_0x0ead('0x24'));logger[_0x0ead('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xdd64d7,_0x0ead('0x24'),JSON[_0x0ead('0x26')](_0x34a050));if(_0x34a050[_0x0ead('0x27')]){if(_0x34a050[_0x0ead('0x27')][_0x0ead('0x28')]===0x1f4){logger['error'](_0x0ead('0x23'),_0xdd64d7,_0x34a050[_0x0ead('0x27')][_0x0ead('0x29')]);return _0x56de9f(_0x34a050[_0x0ead('0x27')][_0x0ead('0x29')]);}logger[_0x0ead('0x27')](_0x0ead('0x23'),_0xdd64d7,_0x34a050[_0x0ead('0x27')][_0x0ead('0x29')]);return _0x116bde(_0x34a050['error'][_0x0ead('0x29')]);}else{logger['info'](_0x0ead('0x23'),_0xdd64d7,'request\x20sent');_0x116bde(_0x34a050[_0x0ead('0x2a')][_0x0ead('0x29')]);}})[_0x0ead('0x2b')](function(_0x205ad1){logger[_0x0ead('0x27')](_0x0ead('0x23'),_0xdd64d7,_0x205ad1);_0x56de9f(_0x205ad1);});});}function respondWithStatusCode(_0x2efbe4,_0x3e0629){_0x3e0629=_0x3e0629||0xcc;return function(_0x532be8){if(_0x532be8){return _0x2efbe4[_0x0ead('0x2c')](_0x3e0629);}return _0x2efbe4[_0x0ead('0x2d')](_0x3e0629)[_0x0ead('0x2e')]();};}function respondWithResult(_0x1f082d,_0x4ead92){_0x4ead92=_0x4ead92||0xc8;return function(_0x3772aa){if(_0x3772aa){return _0x1f082d[_0x0ead('0x2d')](_0x4ead92)[_0x0ead('0x2f')](_0x3772aa);}};}function respondWithFilteredResult(_0x113404,_0x2b7569){return function(_0x2c8d4b){if(_0x2c8d4b){var _0x8c2f4b=typeof _0x2b7569[_0x0ead('0x30')]===_0x0ead('0x31')&&typeof _0x2b7569[_0x0ead('0x32')]===_0x0ead('0x31');var _0x28a814=_0x2c8d4b[_0x0ead('0x33')];var _0x3f4714=_0x8c2f4b?0x0:_0x2b7569[_0x0ead('0x30')];var _0x2286e3=_0x8c2f4b?_0x2c8d4b[_0x0ead('0x33')]:_0x2b7569[_0x0ead('0x30')]+_0x2b7569[_0x0ead('0x32')];var _0x35d1f4;if(_0x2286e3>=_0x28a814){_0x2286e3=_0x28a814;_0x35d1f4=0xc8;}else{_0x35d1f4=0xce;}_0x113404[_0x0ead('0x2d')](_0x35d1f4);return _0x113404[_0x0ead('0x34')]('Content-Range',_0x3f4714+'-'+_0x2286e3+'/'+_0x28a814)[_0x0ead('0x2f')](_0x2c8d4b);}return null;};}function patchUpdates(_0x2b0812){return function(_0x41b158){try{jsonpatch[_0x0ead('0x35')](_0x41b158,_0x2b0812,!![]);}catch(_0x1018a9){return BPromise['reject'](_0x1018a9);}return _0x41b158[_0x0ead('0x36')]();};}function saveUpdates(_0x3c77ab,_0x12b3a2){return function(_0x1feaf1){if(_0x1feaf1){return _0x1feaf1[_0x0ead('0x37')](_0x3c77ab)[_0x0ead('0x21')](function(_0x40ad96){return _0x40ad96;});}return null;};}function removeEntity(_0x3cf8d4,_0x3ecb5){return function(_0x52738a){if(_0x52738a){return _0x52738a['destroy']()[_0x0ead('0x21')](function(){var _0x3116fe=_0x52738a[_0x0ead('0x38')]({'plain':!![]});var _0x4fc770=_0x0ead('0x39');return db['UserProfileResource'][_0x0ead('0x3a')]({'where':{'type':_0x4fc770,'resourceId':_0x3116fe['id']}})[_0x0ead('0x21')](function(){return _0x52738a;});})[_0x0ead('0x21')](function(){_0x3cf8d4[_0x0ead('0x2d')](0xcc)[_0x0ead('0x2e')]();});}};}function handleEntityNotFound(_0x499a59,_0x17a884){return function(_0x33804b){if(!_0x33804b){_0x499a59[_0x0ead('0x2c')](0x194);}return _0x33804b;};}function handleError(_0xf497fc,_0x13885f){_0x13885f=_0x13885f||0x1f4;return function(_0xd8ba42){logger[_0x0ead('0x27')](_0xd8ba42['stack']);if(_0xd8ba42['name']){delete _0xd8ba42[_0x0ead('0x3b')];}_0xf497fc[_0x0ead('0x2d')](_0x13885f)[_0x0ead('0x3c')](_0xd8ba42);};}exports[_0x0ead('0x3d')]=function(_0x386c95,_0x3a1e33){var _0x3f4a37={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xd345d9={},_0x3b3942={'count':0x0,'rows':[]};var _0x168c20=_[_0x0ead('0x3e')](db[_0x0ead('0x3f')][_0x0ead('0x40')],function(_0x572b3e){return{'name':_0x572b3e[_0x0ead('0x41')],'type':_0x572b3e[_0x0ead('0x42')][_0x0ead('0x43')]};});_0xd345d9[_0x0ead('0x44')]=_[_0x0ead('0x3e')](_0x168c20,'name');_0xd345d9[_0x0ead('0x45')]=_[_0x0ead('0x46')](_0x386c95['query']);_0xd345d9[_0x0ead('0x47')]=_[_0x0ead('0x48')](_0xd345d9[_0x0ead('0x44')],_0xd345d9[_0x0ead('0x45')]);_0x3f4a37[_0x0ead('0x49')]=_[_0x0ead('0x48')](_0xd345d9[_0x0ead('0x44')],qs[_0x0ead('0x4a')](_0x386c95[_0x0ead('0x45')][_0x0ead('0x4a')]));_0x3f4a37[_0x0ead('0x49')]=_0x3f4a37[_0x0ead('0x49')][_0x0ead('0x4b')]?_0x3f4a37[_0x0ead('0x49')]:_0xd345d9[_0x0ead('0x44')];if(!_0x386c95[_0x0ead('0x45')][_0x0ead('0x4c')](_0x0ead('0x4d'))){_0x3f4a37[_0x0ead('0x32')]=qs[_0x0ead('0x32')](_0x386c95['query'][_0x0ead('0x32')]);_0x3f4a37[_0x0ead('0x30')]=qs[_0x0ead('0x30')](_0x386c95[_0x0ead('0x45')][_0x0ead('0x30')]);}_0x3f4a37[_0x0ead('0x4e')]=qs[_0x0ead('0x4f')](_0x386c95[_0x0ead('0x45')][_0x0ead('0x4f')]);_0x3f4a37['where']=qs['filters'](_[_0x0ead('0x50')](_0x386c95[_0x0ead('0x45')],_0xd345d9[_0x0ead('0x47')]),_0x168c20);if(_0x386c95['query']['filter']){_0x3f4a37[_0x0ead('0x51')]=_[_0x0ead('0x52')](_0x3f4a37['where'],{'$or':_[_0x0ead('0x3e')](_0x168c20,function(_0x57002b){if(_0x57002b[_0x0ead('0x42')]!==_0x0ead('0x53')){var _0x33f983={};_0x33f983[_0x57002b[_0x0ead('0x3b')]]={'$like':'%'+_0x386c95['query'][_0x0ead('0x54')]+'%'};return _0x33f983;}})});}_0x3f4a37=_['merge']({},_0x3f4a37,_0x386c95[_0x0ead('0x55')]);var _0x278973={'where':_0x3f4a37[_0x0ead('0x51')]};return db['WhatsappAccount'][_0x0ead('0x33')](_0x278973)[_0x0ead('0x21')](function(_0x28d773){_0x3b3942['count']=_0x28d773;if(_0x386c95[_0x0ead('0x45')][_0x0ead('0x56')]){_0x3f4a37[_0x0ead('0x57')]=[{'all':!![]}];}return db[_0x0ead('0x3f')][_0x0ead('0x58')](_0x3f4a37);})[_0x0ead('0x21')](function(_0x3d5e75){_0x3b3942[_0x0ead('0x59')]=_0x3d5e75;return _0x3b3942;})[_0x0ead('0x21')](respondWithFilteredResult(_0x3a1e33,_0x3f4a37))[_0x0ead('0x2b')](handleError(_0x3a1e33,null));};exports[_0x0ead('0x5a')]=function(_0x5cf0f8,_0x427238){var _0x55dab7={'raw':![],'where':{'id':_0x5cf0f8['params']['id']},'include':[{'model':db['Pause'],'as':_0x0ead('0x5b')}]},_0x396587={};_0x396587['model']=_[_0x0ead('0x46')](db[_0x0ead('0x3f')]['rawAttributes']);_0x396587[_0x0ead('0x45')]=_[_0x0ead('0x46')](_0x5cf0f8[_0x0ead('0x45')]);_0x396587[_0x0ead('0x47')]=_['intersection'](_0x396587[_0x0ead('0x44')],_0x396587[_0x0ead('0x45')]);_0x55dab7[_0x0ead('0x49')]=_[_0x0ead('0x48')](_0x396587[_0x0ead('0x44')],qs[_0x0ead('0x4a')](_0x5cf0f8[_0x0ead('0x45')]['fields']));_0x55dab7['attributes']=_0x55dab7['attributes'][_0x0ead('0x4b')]?_0x55dab7[_0x0ead('0x49')]:_0x396587[_0x0ead('0x44')];if(_0x5cf0f8[_0x0ead('0x45')][_0x0ead('0x56')]){_0x55dab7[_0x0ead('0x57')]=[{'all':!![]}];}_0x55dab7=_[_0x0ead('0x52')]({},_0x55dab7,_0x5cf0f8[_0x0ead('0x55')]);return db[_0x0ead('0x3f')][_0x0ead('0x5c')](_0x55dab7)['then'](handleEntityNotFound(_0x427238,null))[_0x0ead('0x21')](respondWithResult(_0x427238,null))[_0x0ead('0x2b')](handleError(_0x427238,null));};exports[_0x0ead('0x5d')]=function(_0x83264,_0x1829cd){return db[_0x0ead('0x3f')][_0x0ead('0x5d')](_0x83264[_0x0ead('0x5e')],{})[_0x0ead('0x21')](function(_0x494f34){var _0x33dcaa=_0x83264[_0x0ead('0x5f')]['get']({'plain':!![]});if(!_0x33dcaa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33dcaa[_0x0ead('0x60')]===_0x0ead('0x5f')){var _0x56ffbf=_0x494f34[_0x0ead('0x38')]({'plain':!![]});var _0x4bcb16='WhatsappAccounts';return db['UserProfileSection'][_0x0ead('0x5c')]({'where':{'name':_0x4bcb16,'userProfileId':_0x33dcaa[_0x0ead('0x61')]},'raw':!![]})[_0x0ead('0x21')](function(_0x5d1641){if(_0x5d1641&&_0x5d1641['autoAssociation']===0x0){return db[_0x0ead('0x62')]['create']({'name':_0x56ffbf[_0x0ead('0x3b')],'resourceId':_0x56ffbf['id'],'type':_0x5d1641[_0x0ead('0x3b')],'sectionId':_0x5d1641['id']},{})[_0x0ead('0x21')](function(){return _0x494f34;});}else{return _0x494f34;}})[_0x0ead('0x2b')](function(_0x609e08){logger[_0x0ead('0x27')](_0x0ead('0x63'),_0x609e08);throw _0x609e08;});}return _0x494f34;})[_0x0ead('0x21')](respondWithResult(_0x1829cd,0xc9))[_0x0ead('0x2b')](handleError(_0x1829cd,null));};exports['update']=function(_0xa617cb,_0x294226){if(_0xa617cb[_0x0ead('0x5e')]['id']){delete _0xa617cb[_0x0ead('0x5e')]['id'];}return db[_0x0ead('0x3f')][_0x0ead('0x5c')]({'where':{'id':_0xa617cb[_0x0ead('0x64')]['id']},'include':[{'model':db[_0x0ead('0x65')],'as':_0x0ead('0x5b')}]})[_0x0ead('0x21')](handleEntityNotFound(_0x294226,null))[_0x0ead('0x21')](saveUpdates(_0xa617cb[_0x0ead('0x5e')],null))['then'](respondWithResult(_0x294226,null))[_0x0ead('0x2b')](handleError(_0x294226,null));};exports[_0x0ead('0x3a')]=function(_0x2e42fe,_0x59f32f){return db[_0x0ead('0x3f')][_0x0ead('0x5c')]({'where':{'id':_0x2e42fe[_0x0ead('0x64')]['id']}})[_0x0ead('0x21')](handleEntityNotFound(_0x59f32f,null))[_0x0ead('0x21')](removeEntity(_0x59f32f,null))[_0x0ead('0x2b')](handleError(_0x59f32f,null));};exports[_0x0ead('0x66')]=function(_0x2b94b1,_0x113bed){return db[_0x0ead('0x3f')][_0x0ead('0x66')]()[_0x0ead('0x21')](respondWithResult(_0x113bed,null))[_0x0ead('0x2b')](handleError(_0x113bed,null));};exports[_0x0ead('0x67')]=function(_0x1664cd,_0x3b7df0,_0x21617c){if(_0x1664cd['body']['id']){delete _0x1664cd[_0x0ead('0x5e')]['id'];}return db[_0x0ead('0x3f')][_0x0ead('0x5c')]({'where':{'id':_0x1664cd['params']['id']}})['then'](handleEntityNotFound(_0x3b7df0,null))[_0x0ead('0x21')](function(_0x443397){if(_0x443397){_0x1664cd[_0x0ead('0x5e')][_0x0ead('0x68')]=_0x443397['id'];return db['Disposition'][_0x0ead('0x5d')](_0x1664cd['body']);}})['then'](respondWithResult(_0x3b7df0,null))['catch'](handleError(_0x3b7df0,null));};exports[_0x0ead('0x69')]=function(_0x9e4990,_0x2d0d39,_0x922736){var _0x4659b4={'raw':![],'where':{}};var _0x57f02c={};var _0x588110={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x9e4990[_0x0ead('0x64')]['id']}})[_0x0ead('0x21')](handleEntityNotFound(_0x2d0d39,null))[_0x0ead('0x21')](function(_0x4817d1){if(_0x4817d1){_0x57f02c[_0x0ead('0x44')]=_[_0x0ead('0x46')](db[_0x0ead('0x6a')]['rawAttributes']);_0x57f02c['query']=_[_0x0ead('0x46')](_0x9e4990[_0x0ead('0x45')]);_0x57f02c[_0x0ead('0x47')]=_[_0x0ead('0x48')](_0x57f02c[_0x0ead('0x44')],_0x57f02c[_0x0ead('0x45')]);_0x4659b4[_0x0ead('0x49')]=_[_0x0ead('0x48')](_0x57f02c[_0x0ead('0x44')],qs['fields'](_0x9e4990[_0x0ead('0x45')]['fields']));_0x4659b4[_0x0ead('0x49')]=_0x4659b4[_0x0ead('0x49')][_0x0ead('0x4b')]?_0x4659b4[_0x0ead('0x49')]:_0x57f02c['model'];if(!_0x9e4990[_0x0ead('0x45')][_0x0ead('0x4c')](_0x0ead('0x4d'))){_0x4659b4[_0x0ead('0x32')]=qs['limit'](_0x9e4990['query'][_0x0ead('0x32')]);_0x4659b4[_0x0ead('0x30')]=qs[_0x0ead('0x30')](_0x9e4990['query'][_0x0ead('0x30')]);}_0x4659b4['order']=qs[_0x0ead('0x4f')](_0x9e4990[_0x0ead('0x45')][_0x0ead('0x4f')]);_0x4659b4[_0x0ead('0x51')]=qs[_0x0ead('0x47')](_[_0x0ead('0x50')](_0x9e4990[_0x0ead('0x45')],_0x57f02c[_0x0ead('0x47')]));_0x4659b4[_0x0ead('0x51')][_0x0ead('0x68')]=_0x4817d1['id'];if(_0x9e4990[_0x0ead('0x45')][_0x0ead('0x54')]){_0x4659b4[_0x0ead('0x51')]=_[_0x0ead('0x52')](_0x4659b4[_0x0ead('0x51')],{'$or':_[_0x0ead('0x3e')](_0x4659b4['attributes'],function(_0x26f31b){var _0x8c353f={};_0x8c353f[_0x26f31b]={'$like':'%'+_0x9e4990['query'][_0x0ead('0x54')]+'%'};return _0x8c353f;})});}_0x4659b4=_['merge']({},_0x4659b4,_0x9e4990[_0x0ead('0x55')]);return db[_0x0ead('0x6a')][_0x0ead('0x33')]({'where':_0x4659b4['where']})[_0x0ead('0x21')](function(_0x45931f){_0x588110[_0x0ead('0x33')]=_0x45931f;if(_0x9e4990['query'][_0x0ead('0x56')]){_0x4659b4['include']=[{'all':!![]}];}return db[_0x0ead('0x6a')][_0x0ead('0x58')](_0x4659b4);})[_0x0ead('0x21')](function(_0x424d78){_0x588110[_0x0ead('0x59')]=_0x424d78;return _0x588110;});}})['then'](respondWithFilteredResult(_0x2d0d39,_0x4659b4))[_0x0ead('0x2b')](handleError(_0x2d0d39,null));};exports[_0x0ead('0x6b')]=function(_0x4402c3,_0x5b29c4,_0x40bac6){return db[_0x0ead('0x3f')][_0x0ead('0x5c')]({'where':{'id':_0x4402c3[_0x0ead('0x64')]['id']}})['then'](handleEntityNotFound(_0x5b29c4,null))[_0x0ead('0x21')](function(_0x13d870){if(_0x13d870){return _0x13d870[_0x0ead('0x6b')](_0x4402c3['query'][_0x0ead('0x6c')]);}})[_0x0ead('0x21')](respondWithStatusCode(_0x5b29c4,null))[_0x0ead('0x2b')](handleError(_0x5b29c4,null));};exports['addAnswer']=function(_0xb2e40c,_0x172962,_0x4d9608){if(_0xb2e40c[_0x0ead('0x5e')]['id']){delete _0xb2e40c[_0x0ead('0x5e')]['id'];}return db[_0x0ead('0x3f')][_0x0ead('0x5c')]({'where':{'id':_0xb2e40c['params']['id']}})[_0x0ead('0x21')](handleEntityNotFound(_0x172962,null))[_0x0ead('0x21')](function(_0x475380){if(_0x475380){_0xb2e40c[_0x0ead('0x5e')][_0x0ead('0x68')]=_0x475380['id'];return db[_0x0ead('0x6d')][_0x0ead('0x5d')](_0xb2e40c[_0x0ead('0x5e')]);}})['then'](respondWithResult(_0x172962,null))['catch'](handleError(_0x172962,null));};exports[_0x0ead('0x6e')]=function(_0x57279e,_0x43f7a6,_0x51c8a5){var _0x137e69={'raw':![],'where':{}};var _0xd628a9={};var _0x255e47={'count':0x0,'rows':[]};return db[_0x0ead('0x3f')]['findOne']({'where':{'id':_0x57279e[_0x0ead('0x64')]['id']}})[_0x0ead('0x21')](handleEntityNotFound(_0x43f7a6,null))['then'](function(_0x3f37bc){if(_0x3f37bc){_0xd628a9[_0x0ead('0x44')]=_[_0x0ead('0x46')](db[_0x0ead('0x6d')][_0x0ead('0x40')]);_0xd628a9[_0x0ead('0x45')]=_[_0x0ead('0x46')](_0x57279e['query']);_0xd628a9[_0x0ead('0x47')]=_[_0x0ead('0x48')](_0xd628a9['model'],_0xd628a9[_0x0ead('0x45')]);_0x137e69[_0x0ead('0x49')]=_['intersection'](_0xd628a9[_0x0ead('0x44')],qs[_0x0ead('0x4a')](_0x57279e[_0x0ead('0x45')][_0x0ead('0x4a')]));_0x137e69[_0x0ead('0x49')]=_0x137e69[_0x0ead('0x49')]['length']?_0x137e69[_0x0ead('0x49')]:_0xd628a9[_0x0ead('0x44')];if(!_0x57279e[_0x0ead('0x45')][_0x0ead('0x4c')](_0x0ead('0x4d'))){_0x137e69[_0x0ead('0x32')]=qs[_0x0ead('0x32')](_0x57279e[_0x0ead('0x45')]['limit']);_0x137e69[_0x0ead('0x30')]=qs['offset'](_0x57279e['query'][_0x0ead('0x30')]);}_0x137e69[_0x0ead('0x4e')]=qs['sort'](_0x57279e[_0x0ead('0x45')]['sort']);_0x137e69[_0x0ead('0x51')]=qs['filters'](_[_0x0ead('0x50')](_0x57279e[_0x0ead('0x45')],_0xd628a9['filters']));_0x137e69['where'][_0x0ead('0x68')]=_0x3f37bc['id'];if(_0x57279e['query'][_0x0ead('0x54')]){_0x137e69[_0x0ead('0x51')]=_[_0x0ead('0x52')](_0x137e69['where'],{'$or':_['map'](_0x137e69['attributes'],function(_0x28ba46){var _0x52ef78={};_0x52ef78[_0x28ba46]={'$like':'%'+_0x57279e[_0x0ead('0x45')][_0x0ead('0x54')]+'%'};return _0x52ef78;})});}_0x137e69=_[_0x0ead('0x52')]({},_0x137e69,_0x57279e[_0x0ead('0x55')]);return db[_0x0ead('0x6d')][_0x0ead('0x33')]({'where':_0x137e69['where']})['then'](function(_0x51ed6a){_0x255e47[_0x0ead('0x33')]=_0x51ed6a;if(_0x57279e[_0x0ead('0x45')]['includeAll']){_0x137e69[_0x0ead('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x137e69);})[_0x0ead('0x21')](function(_0x38c8eb){_0x255e47['rows']=_0x38c8eb;return _0x255e47;});}})[_0x0ead('0x21')](respondWithFilteredResult(_0x43f7a6,_0x137e69))[_0x0ead('0x2b')](handleError(_0x43f7a6,null));};exports[_0x0ead('0x6f')]=function(_0x510a64,_0x3d0dee,_0x2efc16){return db[_0x0ead('0x3f')][_0x0ead('0x5c')]({'where':{'id':_0x510a64[_0x0ead('0x64')]['id']}})['then'](handleEntityNotFound(_0x3d0dee,null))['then'](function(_0x51d3f3){if(_0x51d3f3){return _0x51d3f3['removeAnswers'](_0x510a64['query'][_0x0ead('0x6c')]);}})[_0x0ead('0x21')](respondWithStatusCode(_0x3d0dee,null))[_0x0ead('0x2b')](handleError(_0x3d0dee,null));};exports['addAgents']=function(_0x897320,_0x2e645f,_0x44aafc){return db[_0x0ead('0x3f')][_0x0ead('0x5c')]({'where':{'id':_0x897320[_0x0ead('0x64')]['id']}})['then'](handleEntityNotFound(_0x2e645f,null))[_0x0ead('0x21')](function(_0x2a71b5){if(_0x2a71b5){return _0x2a71b5[_0x0ead('0x70')](_0x897320[_0x0ead('0x5e')]['ids'],_[_0x0ead('0x71')](_0x897320[_0x0ead('0x5e')],['ids','id'])||{})[_0x0ead('0x72')](function(_0x4e32fe){for(var _0x127d0a=0x0;_0x127d0a<_0x897320[_0x0ead('0x5e')][_0x0ead('0x6c')][_0x0ead('0x4b')];_0x127d0a+=0x1){socket['emit'](_0x0ead('0x73'),{'UserId':Number(_0x897320[_0x0ead('0x5e')][_0x0ead('0x6c')][_0x127d0a]),'WhatsappAccountId':Number(_0x897320[_0x0ead('0x64')]['id'])});}return _0x4e32fe;});}})['then'](respondWithResult(_0x2e645f,null))[_0x0ead('0x2b')](handleError(_0x2e645f,null));};exports['removeAgents']=function(_0xb26005,_0x2c8b54,_0x319f86){return db[_0x0ead('0x3f')][_0x0ead('0x5c')]({'where':{'id':_0xb26005['params']['id']}})[_0x0ead('0x21')](handleEntityNotFound(_0x2c8b54,null))[_0x0ead('0x21')](function(_0x65fc76){if(_0x65fc76){return _0x65fc76[_0x0ead('0x74')](_0xb26005[_0x0ead('0x45')]['ids'])[_0x0ead('0x21')](function(){if(_[_0x0ead('0x75')](_0xb26005[_0x0ead('0x45')][_0x0ead('0x6c')])){for(var _0x2dac2b=0x0;_0x2dac2b<_0xb26005[_0x0ead('0x45')][_0x0ead('0x6c')][_0x0ead('0x4b')];_0x2dac2b+=0x1){socket[_0x0ead('0x76')](_0x0ead('0x77'),{'UserId':Number(_0xb26005['query']['ids'][_0x2dac2b]),'WhatsappAccountId':Number(_0xb26005[_0x0ead('0x64')]['id'])});}}else{socket[_0x0ead('0x76')](_0x0ead('0x77'),{'UserId':Number(_0xb26005[_0x0ead('0x45')][_0x0ead('0x6c')]),'WhatsappAccountId':Number(_0xb26005[_0x0ead('0x64')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c8b54,null))[_0x0ead('0x2b')](handleError(_0x2c8b54,null));};exports['getAgents']=function(_0x1479ff,_0x4dcfcc,_0x25fe4c){var _0x2b7b44={};var _0x3cfa3b={};var _0x3eb660;var _0x36ef15;return db[_0x0ead('0x3f')][_0x0ead('0x78')]({'where':{'id':_0x1479ff[_0x0ead('0x64')]['id']}})[_0x0ead('0x21')](handleEntityNotFound(_0x4dcfcc,null))[_0x0ead('0x21')](function(_0x122f50){if(_0x122f50){_0x3eb660=_0x122f50;_0x3cfa3b[_0x0ead('0x44')]=_[_0x0ead('0x46')](db['User'][_0x0ead('0x40')]);_0x3cfa3b['query']=_[_0x0ead('0x46')](_0x1479ff[_0x0ead('0x45')]);_0x3cfa3b['filters']=_[_0x0ead('0x48')](_0x3cfa3b[_0x0ead('0x44')],_0x3cfa3b[_0x0ead('0x45')]);_0x2b7b44[_0x0ead('0x49')]=_[_0x0ead('0x48')](_0x3cfa3b[_0x0ead('0x44')],qs[_0x0ead('0x4a')](_0x1479ff['query'][_0x0ead('0x4a')]));_0x2b7b44[_0x0ead('0x49')]=_0x2b7b44[_0x0ead('0x49')]['length']?_0x2b7b44[_0x0ead('0x49')]:_0x3cfa3b[_0x0ead('0x44')];_0x2b7b44[_0x0ead('0x4e')]=qs[_0x0ead('0x4f')](_0x1479ff[_0x0ead('0x45')][_0x0ead('0x4f')]);_0x2b7b44[_0x0ead('0x51')]=qs[_0x0ead('0x47')](_[_0x0ead('0x50')](_0x1479ff[_0x0ead('0x45')],_0x3cfa3b[_0x0ead('0x47')]));if(_0x1479ff[_0x0ead('0x45')][_0x0ead('0x54')]){_0x2b7b44[_0x0ead('0x51')]=_[_0x0ead('0x52')](_0x2b7b44[_0x0ead('0x51')],{'$or':_[_0x0ead('0x3e')](_0x2b7b44[_0x0ead('0x49')],function(_0x3a960f){var _0x552f98={};_0x552f98[_0x3a960f]={'$like':'%'+_0x1479ff['query'][_0x0ead('0x54')]+'%'};return _0x552f98;})});}_0x2b7b44=_['merge']({},_0x2b7b44,_0x1479ff[_0x0ead('0x55')]);return _0x3eb660[_0x0ead('0x79')](_0x2b7b44);}})['then'](function(_0x3b8528){if(_0x3b8528){_0x36ef15=_0x3b8528[_0x0ead('0x4b')];if(!_0x1479ff[_0x0ead('0x45')][_0x0ead('0x4c')]('nolimit')){_0x2b7b44[_0x0ead('0x32')]=qs[_0x0ead('0x32')](_0x1479ff[_0x0ead('0x45')][_0x0ead('0x32')]);_0x2b7b44['offset']=qs[_0x0ead('0x30')](_0x1479ff[_0x0ead('0x45')][_0x0ead('0x30')]);}return _0x3eb660[_0x0ead('0x79')](_0x2b7b44);}})[_0x0ead('0x21')](function(_0x2c862e){if(_0x2c862e){return _0x2c862e?{'count':_0x36ef15,'rows':_0x2c862e}:null;}})[_0x0ead('0x21')](respondWithResult(_0x4dcfcc,null))[_0x0ead('0x2b')](handleError(_0x4dcfcc,null));};exports[_0x0ead('0x7a')]=function(_0x56724f,_0x3d3c5e){var _0x37c0aa=_0x56724f[_0x0ead('0x64')]['id'];var _0x6ab158=_0x56724f[_0x0ead('0x5e')];var _0x161102=0xc8;var _0x192111=null;return db[_0x0ead('0x7b')][_0x0ead('0x7c')]({'isolationLevel':db['sequelize'][_0x0ead('0x7d')]['ISOLATION_LEVELS'][_0x0ead('0x7e')]},function(_0x5ab48a){return db[_0x0ead('0x3f')][_0x0ead('0x78')]({'where':{'id':_0x37c0aa},'transaction':_0x5ab48a})[_0x0ead('0x21')](function(_0x522160){if(_0x522160){return db[_0x0ead('0x7f')][_0x0ead('0x3a')]({'where':{'WhatsappAccountId':_0x37c0aa},'transaction':_0x5ab48a})[_0x0ead('0x21')](function(){var _0x569c95=_[_0x0ead('0x3e')](_0x6ab158,function(_0x199eb3){_0x199eb3['WhatsappAccountId']=_0x37c0aa;return _0x199eb3;});return db[_0x0ead('0x7f')][_0x0ead('0x80')](_0x569c95,{'transaction':_0x5ab48a});});}else{_0x161102=0x194;_0x192111=[];}});})[_0x0ead('0x21')](function(){if(_0x161102!==0x194){return db[_0x0ead('0x7f')][_0x0ead('0x81')]({'where':{'WhatsappAccountId':_0x37c0aa},'order':_0x0ead('0x82')})['then'](function(_0x5ac5fb){_0x192111=_0x5ac5fb;});}})[_0x0ead('0x2b')](function(_0xf374f5){_0x161102=0x1f4;logger[_0x0ead('0x27')](_0xf374f5['stack']);if(_0xf374f5[_0x0ead('0x3b')]){delete _0xf374f5[_0x0ead('0x3b')];}_0x192111=_0xf374f5;})[_0x0ead('0x83')](function(){if(_0x192111===null){_0x3d3c5e[_0x0ead('0x2c')](_0x161102);}else{if(_0x161102===0x1f4){_0x3d3c5e[_0x0ead('0x2d')](_0x161102)[_0x0ead('0x3c')](_0x192111);}else{_0x3d3c5e[_0x0ead('0x2d')](_0x161102)['json'](_0x192111);}}});};exports[_0x0ead('0x84')]=function(_0x5ce75c,_0x4284bd,_0x3c407d){var _0x5eecb2={};var _0x42852a={};var _0x3cc75c;var _0x3d11d2;return db['WhatsappAccount'][_0x0ead('0x78')]({'where':{'id':_0x5ce75c[_0x0ead('0x64')]['id']}})[_0x0ead('0x21')](handleEntityNotFound(_0x4284bd,null))['then'](function(_0x4be04d){if(_0x4be04d){_0x3cc75c=_0x4be04d;_0x42852a[_0x0ead('0x44')]=_['keys'](db[_0x0ead('0x7f')]['rawAttributes']);_0x42852a[_0x0ead('0x45')]=_[_0x0ead('0x46')](_0x5ce75c[_0x0ead('0x45')]);_0x42852a[_0x0ead('0x47')]=_['intersection'](_0x42852a[_0x0ead('0x44')],_0x42852a[_0x0ead('0x45')]);_0x5eecb2[_0x0ead('0x49')]=_[_0x0ead('0x48')](_0x42852a[_0x0ead('0x44')],qs[_0x0ead('0x4a')](_0x5ce75c[_0x0ead('0x45')][_0x0ead('0x4a')]));_0x5eecb2[_0x0ead('0x49')]=_0x5eecb2[_0x0ead('0x49')][_0x0ead('0x4b')]?_0x5eecb2[_0x0ead('0x49')]:_0x42852a[_0x0ead('0x44')];_0x5eecb2[_0x0ead('0x4e')]=qs[_0x0ead('0x4f')](_0x5ce75c[_0x0ead('0x45')][_0x0ead('0x4f')]);_0x5eecb2[_0x0ead('0x51')]=qs[_0x0ead('0x47')](_[_0x0ead('0x50')](_0x5ce75c[_0x0ead('0x45')],_0x42852a['filters']));if(_0x5ce75c[_0x0ead('0x45')][_0x0ead('0x54')]){_0x5eecb2['where']=_[_0x0ead('0x52')](_0x5eecb2[_0x0ead('0x51')],{'$or':_[_0x0ead('0x3e')](_0x5eecb2['attributes'],function(_0x453229){var _0x2e1903={};_0x2e1903[_0x453229]={'$like':'%'+_0x5ce75c[_0x0ead('0x45')]['filter']+'%'};return _0x2e1903;})});}_0x5eecb2=_[_0x0ead('0x52')]({},_0x5eecb2,_0x5ce75c['options']);return _0x3cc75c[_0x0ead('0x84')](_0x5eecb2);}})[_0x0ead('0x21')](function(_0x77f09a){if(_0x77f09a){_0x3d11d2=_0x77f09a['length'];if(!_0x5ce75c[_0x0ead('0x45')][_0x0ead('0x4c')](_0x0ead('0x4d'))){_0x5eecb2[_0x0ead('0x32')]=qs[_0x0ead('0x32')](_0x5ce75c[_0x0ead('0x45')][_0x0ead('0x32')]);_0x5eecb2[_0x0ead('0x30')]=qs[_0x0ead('0x30')](_0x5ce75c[_0x0ead('0x45')][_0x0ead('0x30')]);}return _0x3cc75c['getApplications'](_0x5eecb2);}})[_0x0ead('0x21')](function(_0x119a26){if(_0x119a26){return _0x119a26?{'count':_0x3d11d2,'rows':_0x119a26}:null;}})[_0x0ead('0x21')](respondWithResult(_0x4284bd,null))['catch'](handleError(_0x4284bd,null));};exports[_0x0ead('0x85')]=function(_0x5b2a00,_0x2a8fe2,_0x433d55){var _0x20abac={'channel':_0x0ead('0x86')};var _0x5b06bf=[];var _0x390c48=[];var _0x169025={};return db['WhatsappAccount'][_0x0ead('0x5c')]({'where':{'id':_0x5b2a00['params']['id']},'include':[{'model':db[_0x0ead('0x7f')],'as':_0x0ead('0x87')}]})[_0x0ead('0x21')](handleEntityNotFound(_0x2a8fe2,null))[_0x0ead('0x21')](function(_0x4bc1ae){_0x20abac['account']=_0x4bc1ae;if(_0x20abac[_0x0ead('0x88')]&&_0x20abac['account']['type']==='sinch'&&_0x5b2a00[_0x0ead('0x5e')][_0x0ead('0x89')]){if(_0x5b2a00[_0x0ead('0x5e')][_0x0ead('0x89')][_0x0ead('0x4b')]===0x0)return;if(_0x5b2a00[_0x0ead('0x5e')][_0x0ead('0x89')][0x0][_0x0ead('0x8a')]!=='read')return;return db[_0x0ead('0x8b')][_0x0ead('0x37')]({'read':!![],'readAt':_0x5b2a00[_0x0ead('0x5e')]['statuses'][0x0][_0x0ead('0x8c')]},{'where':{'messageId':_0x5b2a00[_0x0ead('0x5e')][_0x0ead('0x89')][0x0][_0x0ead('0x8d')]},'individualHooks':!![]})['then'](function(_0x3eb706){return _0x2a8fe2[_0x0ead('0x2d')](0xc8)['json'](_0x3eb706);});}_0x20abac[_0x0ead('0x8e')]=_[_0x0ead('0x8f')](_0x4bc1ae[_0x0ead('0x87')],[_0x0ead('0x82')],[_0x0ead('0x90')]);if(_0x20abac['account'][_0x0ead('0x87')]){delete _0x20abac['account'][_0x0ead('0x87')];}return db['CmContact'][_0x0ead('0x66')]()[_0x0ead('0x21')](function(_0x59adc1){if(!_0x59adc1){throw new db[(_0x0ead('0x91'))][(_0x0ead('0x92'))](_0x0ead('0x93'));}_0x5b06bf=_[_0x0ead('0x94')](_[_0x0ead('0x46')](_0x59adc1),[_0x0ead('0x95'),_0x0ead('0x96')]);_0x390c48=_[_0x0ead('0x94')](_[_0x0ead('0x46')](_0x59adc1),[_0x0ead('0x95'),_0x0ead('0x96'),_0x0ead('0x97'),'ListId']);_0x20abac[_0x0ead('0x5e')]={'mapKey':_0x0ead('0x98')};if(_0x20abac['account']&&_0x20abac[_0x0ead('0x88')]['type']==='twilio'){_0x20abac[_0x0ead('0x5e')][_0x0ead('0x99')]=_0x5b2a00['body']['From'][_0x0ead('0x9a')](_0x0ead('0x9b'),'');_0x20abac['body']['body']=_0x5b2a00['body'][_0x0ead('0x9c')];_0x20abac['body'][_0x0ead('0x9d')]=_0x5b2a00[_0x0ead('0x5e')]['MessageSid'];}if(_0x20abac['account']&&_0x20abac['account']['type']===_0x0ead('0x9e')){_0x20abac[_0x0ead('0x5e')][_0x0ead('0x99')]=_0x5b2a00[_0x0ead('0x5e')][_0x0ead('0x9f')][0x0]['from'];_0x20abac[_0x0ead('0x5e')][_0x0ead('0x5e')]=_0x5b2a00[_0x0ead('0x5e')]['notifications'][0x0][_0x0ead('0x29')][_0x0ead('0x5e')];_0x20abac[_0x0ead('0x5e')][_0x0ead('0x9d')]=_0x5b2a00[_0x0ead('0x5e')]['notifications'][0x0][_0x0ead('0x8d')];}if(_0x20abac['body']['id']){delete _0x20abac[_0x0ead('0x5e')]['id'];}if(_[_0x0ead('0xa0')](_0x20abac[_0x0ead('0x5e')]['from'])){throw new db[(_0x0ead('0x91'))][(_0x0ead('0x92'))](_0x0ead('0xa1'));}if(_['isNil'](_0x20abac[_0x0ead('0x5e')][_0x0ead('0x5e')])||_0x20abac['body'][_0x0ead('0x5e')]===''){throw new db[(_0x0ead('0x91'))][(_0x0ead('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0ead('0xa0')](_0x20abac['body']['mapKey'])){throw new db['Sequelize'][(_0x0ead('0x92'))](_0x0ead('0xa2')+_0x390c48);}if(!_[_0x0ead('0xa3')](_0x390c48,_0x20abac['body'][_0x0ead('0xa4')])){throw new db[(_0x0ead('0x91'))][(_0x0ead('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x390c48);}_0x169025[_0x20abac[_0x0ead('0x5e')][_0x0ead('0xa4')]]=_0x20abac[_0x0ead('0x5e')][_0x0ead('0x99')];return db['CmList']['find']({'where':{'id':_0x20abac[_0x0ead('0x88')][_0x0ead('0xa5')]},'include':[{'model':db[_0x0ead('0xa6')],'as':_0x0ead('0xa7'),'where':_0x169025,'limit':0x1,'order':[[_0x0ead('0x96'),_0x0ead('0xa8')]]}]});})[_0x0ead('0x21')](handleEntityNotFound(_0x2a8fe2,null))['then'](function(_0xc0d195){if(_0xc0d195){_0x20abac['list']=_['omit'](_0xc0d195,[_0x0ead('0xa7')]);if(_0xc0d195[_0x0ead('0xa7')][_0x0ead('0x4b')]){return _0xc0d195[_0x0ead('0xa7')][0x0];}var _0x242a79=_[_0x0ead('0xa9')](_0x20abac[_0x0ead('0x5e')],{'firstName':_0x20abac[_0x0ead('0x5e')][_0x0ead('0x99')],'ListId':_0xc0d195['id']});_0x242a79[_0x20abac[_0x0ead('0x5e')]['mapKey']]=_0x20abac['body'][_0x0ead('0x99')];return db[_0x0ead('0xa6')][_0x0ead('0x5d')](_0x242a79,{'fields':_0x5b06bf,'raw':!![]});}})[_0x0ead('0x21')](handleEntityNotFound(_0x2a8fe2,null))[_0x0ead('0x21')](function(_0x2279e0){if(_0x2279e0){_0x20abac['contact']=_0x2279e0;var _0x287855={'ContactId':_0x2279e0['id'],'phone':_0x20abac[_0x0ead('0x5e')]['from'],'WhatsappAccountId':_0x5b2a00[_0x0ead('0x64')]['id']};var _0x2c72c7={'ContactId':_0x2279e0['id'],'WhatsappAccountId':_0x5b2a00['params']['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x2c72c7})[_0x0ead('0x21')](function(_0x3d9706){if(_0x3d9706){return[_0x3d9706,![]];}return db['WhatsappInteraction']['create'](_0x287855)[_0x0ead('0x21')](function(_0x1c71fb){return[_0x1c71fb,!![]];});});}})[_0x0ead('0x72')](function(_0x456bf5,_0x5209a6){_0x20abac[_0x0ead('0xaa')]=_0x456bf5[_0x0ead('0x38')]({'plain':!![]});_0x20abac['interaction']['created']=![];if(_0x5209a6){if(_0x20abac[_0x0ead('0x88')][_0x0ead('0xab')]){_0x20abac[_0x0ead('0x8e')][_0x0ead('0xac')]({'id':0x0,'priority':_0x20abac[_0x0ead('0x8e')][_0x0ead('0x4b')]+0x1,'app':_0x0ead('0xad'),'appdata':_0x0ead('0xae'),'interval':_0x0ead('0xaf')});}_0x20abac[_0x0ead('0xaa')][_0x0ead('0xb0')]=!![];}return db[_0x0ead('0x8b')][_0x0ead('0x5d')]({'phone':_0x20abac[_0x0ead('0x5e')][_0x0ead('0x99')],'messageId':_0x20abac[_0x0ead('0x5e')]['messageId'],'body':_0x20abac[_0x0ead('0x5e')][_0x0ead('0x5e')],'WhatsappAccountId':_0x5b2a00[_0x0ead('0x64')]['id'],'WhatsappInteractionId':_0x456bf5['id'],'direction':'in','ContactId':_0x456bf5[_0x0ead('0xb1')],'AttachmentId':_0x20abac[_0x0ead('0x5e')]['AttachmentId']});})[_0x0ead('0x21')](function(_0x510a2f){_0x20abac[_0x0ead('0x29')]=_0x510a2f;if(_0x20abac[_0x0ead('0xaa')][_0x0ead('0xb2')]){return db['User'][_0x0ead('0x5c')]({'attributes':['id',_0x0ead('0x3b')],'where':{'id':_0x20abac['interaction']['UserId']}})['then'](function(_0x6b0da6){if(_0x6b0da6){_0x20abac[_0x0ead('0x8e')][_0x0ead('0xb3')]({'id':0x0,'priority':0x0,'app':_0x0ead('0xb4'),'appdata':_0x6b0da6[_0x0ead('0x3b')]+','+(_0x20abac[_0x0ead('0x88')][_0x0ead('0xb5')]||0xa),'interval':_0x0ead('0xaf')});}return respondWithRpcPromise(_0x0ead('0xb6'),_0x0ead('0xb7'),_0x20abac);});}return respondWithRpcPromise(_0x0ead('0xb6'),_0x0ead('0xb7'),_0x20abac);})[_0x0ead('0x21')](function(_0x286778){if(_0x286778){var _0x3f6909=0xc8;var _0x28da60='receiveMessage';logger[_0x0ead('0x22')](_0x0ead('0xb8'),_0x28da60,_0x3f6909,_0x0ead('0xb9'));logger['debug'](_0x0ead('0xba'),_0x28da60,_0x3f6909,_0x0ead('0xb9'),JSON['stringify'](_0x286778));if(_0x20abac[_0x0ead('0x88')][_0x0ead('0x42')]===_0x0ead('0xbb')){return _0x2a8fe2[_0x0ead('0x2d')](_0x3f6909)[_0x0ead('0x34')]('Content-Type',_0x0ead('0xbc'))['send']('\x0a');}else{return _0x2a8fe2[_0x0ead('0x2d')](_0x3f6909)[_0x0ead('0x2f')](_0x286778);}}});})[_0x0ead('0x2b')](handleError(_0x2a8fe2,null));};exports[_0x0ead('0x3c')]=function(_0x107e1b,_0x10fc4e,_0x47799b){var _0x5709c5,_0x2ea6ff,_0x491291;if(_[_0x0ead('0xa0')](_0x107e1b[_0x0ead('0x5e')][_0x0ead('0x5e')])||_0x107e1b[_0x0ead('0x5e')][_0x0ead('0x5e')]===''){throw new db[(_0x0ead('0x91'))][(_0x0ead('0x92'))](_0x0ead('0xbd'));}if(_[_0x0ead('0xa0')](_0x107e1b[_0x0ead('0x5e')]['to'])){throw new db[(_0x0ead('0x91'))][(_0x0ead('0x92'))]('to\x20is\x20mandatory');}_0x5709c5=_0x107e1b[_0x0ead('0x5e')]['to'];return db[_0x0ead('0x3f')]['find']({'where':{'id':_0x107e1b['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0ead('0xa6')],'as':'Contacts','where':{'mobile':_0x5709c5},'limit':0x1,'order':[['updatedAt',_0x0ead('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x10fc4e,null))[_0x0ead('0x21')](function(_0x2e8362){if(_0x2e8362&&_0x2e8362['List']){_0x2ea6ff=_0x2e8362[_0x0ead('0x38')]({'plain':!![]});if(_0x2ea6ff[_0x0ead('0xbe')]&&_0x2ea6ff['List'][_0x0ead('0xa7')][_0x0ead('0x4b')]){return _0x2ea6ff[_0x0ead('0xbe')][_0x0ead('0xa7')][0x0];}return db[_0x0ead('0xa6')][_0x0ead('0x5d')](_['defaults'](_0x107e1b['body'],{'firstName':_0x5709c5,'mobile':_0x5709c5,'phone':_0x5709c5,'ListId':_0x2ea6ff['ListId']}));}})[_0x0ead('0x21')](handleEntityNotFound(_0x10fc4e,null))[_0x0ead('0x21')](function(_0x307e0c){if(_0x307e0c){_0x491291=_0x307e0c;return db[_0x0ead('0xbf')]['find']({'where':{'ContactId':_0x491291['id'],'closed':![],'WhatsappAccountId':_0x2ea6ff['id']}})[_0x0ead('0x21')](function(_0x3bfb14){if(_0x3bfb14){return[_0x3bfb14,![]];}return db['WhatsappInteraction'][_0x0ead('0x5d')]({'UserId':_0x107e1b[_0x0ead('0x5f')]['id'],'ContactId':_0x491291['id'],'WhatsappAccountId':_0x2ea6ff['id'],'phone':_0x5709c5,'firstMsgDirection':_0x0ead('0xc0'),'Messages':[_[_0x0ead('0x52')](_0x107e1b[_0x0ead('0x5e')],{'read':![],'body':_0x107e1b[_0x0ead('0x5e')][_0x0ead('0x5e')],'phone':_0x5709c5,'WhatsappAccountId':_0x2ea6ff['id'],'UserId':_0x107e1b['user']['id'],'ContactId':_0x491291['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x0ead('0xc1')}]})['then'](function(_0x37b4ad){return[_0x37b4ad,!![]];});});}})['spread'](function(_0x25e048,_0x6d6bb1){if(_0x6d6bb1){return _0x25e048;}return db[_0x0ead('0x8b')][_0x0ead('0x5d')](_[_0x0ead('0x52')](_0x107e1b[_0x0ead('0x5e')],{'read':![],'body':_0x107e1b[_0x0ead('0x5e')][_0x0ead('0x5e')],'phone':_0x5709c5,'WhatsappAccountId':_0x2ea6ff['id'],'WhatsappInteractionId':_0x25e048['id'],'UserId':_0x107e1b['user']['id'],'ContactId':_0x491291['id']}))[_0x0ead('0x21')](function(_0x44ec7f){_0x25e048['dataValues'][_0x0ead('0xc1')]=[];_0x25e048['dataValues']['Messages'][_0x0ead('0xac')](_0x44ec7f['dataValues']);return _0x25e048;});})[_0x0ead('0x21')](respondWithResult(_0x10fc4e,null))[_0x0ead('0x2b')](handleError(_0x10fc4e,null));}; \ No newline at end of file +var _0xf8d6=['mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','destroy','get','WhatsappAccounts','UserProfileResource','name','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','WhatsappAccount','includeAll','include','rows','show','Pause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','stack','send','getApplications','notify','whatsapp','account','sinch','statuses','state','WhatsappMessage','timestamp','Applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','messageId','from','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','CmContact','contact','interaction','created','autoclose','applications','push','ContactId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','to\x20is\x20mandatory','List','DESC','WhatsappInteraction','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x52bcc5,_0x114a44){var _0x3e6734=function(_0x3513d8){while(--_0x3513d8){_0x52bcc5['push'](_0x52bcc5['shift']());}};_0x3e6734(++_0x114a44);}(_0xf8d6,0xbc));var _0x6f8d=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xf8d6[_0xb6e2ea];return _0x2a57bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f8d('0x0'));var zipdir=require(_0x6f8d('0x1'));var jsonpatch=require(_0x6f8d('0x2'));var rp=require(_0x6f8d('0x3'));var moment=require(_0x6f8d('0x4'));var BPromise=require(_0x6f8d('0x5'));var Mustache=require(_0x6f8d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6f8d('0x7'));var csv=require(_0x6f8d('0x8'));var ejs=require(_0x6f8d('0x9'));var fs=require('fs');var fs_extra=require(_0x6f8d('0xa'));var _=require(_0x6f8d('0xb'));var squel=require(_0x6f8d('0xc'));var crypto=require(_0x6f8d('0xd'));var jsforce=require(_0x6f8d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f8d('0xf'));var authService=require(_0x6f8d('0x10'));var qs=require(_0x6f8d('0x11'));var as=require(_0x6f8d('0x12'));var hardwareService=require(_0x6f8d('0x13'));var logger=require(_0x6f8d('0x14'))('api');var utils=require(_0x6f8d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6f8d('0x16'));var db=require(_0x6f8d('0x17'))['db'];config[_0x6f8d('0x18')]=_[_0x6f8d('0x19')](config['redis'],{'host':_0x6f8d('0x1a'),'port':0x18eb});var socket=require(_0x6f8d('0x1b'))(new Redis(config['redis']));require(_0x6f8d('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6f8d('0x1d')][_0x6f8d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2919d2,_0x5cf15b,_0x81d378,_0x168bf7){return new BPromise(function(_0x531dee,_0x1e2fe2){var _0xe8e3b9=_0x168bf7||client;return _0xe8e3b9['request'](_0x2919d2,_0x81d378)[_0x6f8d('0x1f')](function(_0x112744){logger[_0x6f8d('0x20')](_0x6f8d('0x21'),_0x5cf15b,_0x6f8d('0x22'));logger['debug'](_0x6f8d('0x23'),_0x5cf15b,_0x6f8d('0x22'),JSON['stringify'](_0x112744));if(_0x112744[_0x6f8d('0x24')]){if(_0x112744[_0x6f8d('0x24')][_0x6f8d('0x25')]===0x1f4){logger[_0x6f8d('0x24')](_0x6f8d('0x21'),_0x5cf15b,_0x112744[_0x6f8d('0x24')][_0x6f8d('0x26')]);return _0x1e2fe2(_0x112744[_0x6f8d('0x24')]['message']);}logger[_0x6f8d('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5cf15b,_0x112744[_0x6f8d('0x24')][_0x6f8d('0x26')]);return _0x531dee(_0x112744[_0x6f8d('0x24')][_0x6f8d('0x26')]);}else{logger[_0x6f8d('0x20')](_0x6f8d('0x21'),_0x5cf15b,'request\x20sent');_0x531dee(_0x112744[_0x6f8d('0x27')][_0x6f8d('0x26')]);}})[_0x6f8d('0x28')](function(_0x7c8ef5){logger['error'](_0x6f8d('0x21'),_0x5cf15b,_0x7c8ef5);_0x1e2fe2(_0x7c8ef5);});});}function respondWithStatusCode(_0x1220ea,_0x3a33a0){_0x3a33a0=_0x3a33a0||0xcc;return function(_0x20b33c){if(_0x20b33c){return _0x1220ea[_0x6f8d('0x29')](_0x3a33a0);}return _0x1220ea['status'](_0x3a33a0)[_0x6f8d('0x2a')]();};}function respondWithResult(_0x27e412,_0x2726df){_0x2726df=_0x2726df||0xc8;return function(_0x58e846){if(_0x58e846){return _0x27e412[_0x6f8d('0x2b')](_0x2726df)[_0x6f8d('0x2c')](_0x58e846);}};}function respondWithFilteredResult(_0x3fa189,_0x5c4a90){return function(_0x3142d6){if(_0x3142d6){var _0x4bd214=typeof _0x5c4a90[_0x6f8d('0x2d')]===_0x6f8d('0x2e')&&typeof _0x5c4a90[_0x6f8d('0x2f')]===_0x6f8d('0x2e');var _0x5a7ed1=_0x3142d6['count'];var _0x44f030=_0x4bd214?0x0:_0x5c4a90[_0x6f8d('0x2d')];var _0x23fad8=_0x4bd214?_0x3142d6[_0x6f8d('0x30')]:_0x5c4a90[_0x6f8d('0x2d')]+_0x5c4a90[_0x6f8d('0x2f')];var _0x311aff;if(_0x23fad8>=_0x5a7ed1){_0x23fad8=_0x5a7ed1;_0x311aff=0xc8;}else{_0x311aff=0xce;}_0x3fa189[_0x6f8d('0x2b')](_0x311aff);return _0x3fa189[_0x6f8d('0x31')]('Content-Range',_0x44f030+'-'+_0x23fad8+'/'+_0x5a7ed1)[_0x6f8d('0x2c')](_0x3142d6);}return null;};}function patchUpdates(_0x5759ac){return function(_0x399161){try{jsonpatch[_0x6f8d('0x32')](_0x399161,_0x5759ac,!![]);}catch(_0x51dcb5){return BPromise['reject'](_0x51dcb5);}return _0x399161['save']();};}function saveUpdates(_0x213a4e,_0x1734dc){return function(_0x40a0e7){if(_0x40a0e7){return _0x40a0e7['update'](_0x213a4e)[_0x6f8d('0x1f')](function(_0x43397d){return _0x43397d;});}return null;};}function removeEntity(_0x38f4e9,_0x2abe44){return function(_0x245304){if(_0x245304){return _0x245304[_0x6f8d('0x33')]()['then'](function(){var _0x426f2f=_0x245304[_0x6f8d('0x34')]({'plain':!![]});var _0xe558f6=_0x6f8d('0x35');return db[_0x6f8d('0x36')][_0x6f8d('0x33')]({'where':{'type':_0xe558f6,'resourceId':_0x426f2f['id']}})['then'](function(){return _0x245304;});})[_0x6f8d('0x1f')](function(){_0x38f4e9[_0x6f8d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x483c97,_0x3c8b60){return function(_0x258fba){if(!_0x258fba){_0x483c97[_0x6f8d('0x29')](0x194);}return _0x258fba;};}function handleError(_0x58d9cf,_0x461408){_0x461408=_0x461408||0x1f4;return function(_0x4a9364){logger[_0x6f8d('0x24')](_0x4a9364['stack']);if(_0x4a9364[_0x6f8d('0x37')]){delete _0x4a9364[_0x6f8d('0x37')];}_0x58d9cf[_0x6f8d('0x2b')](_0x461408)['send'](_0x4a9364);};}exports[_0x6f8d('0x38')]=function(_0x5710dd,_0x1c66d9){var _0x5928be={'include':[{'model':db['Pause'],'as':_0x6f8d('0x39')}]},_0x58cbe1={},_0x578404={'count':0x0,'rows':[]};var _0x5b96ef=_[_0x6f8d('0x3a')](db['WhatsappAccount'][_0x6f8d('0x3b')],function(_0x37c0bb){return{'name':_0x37c0bb[_0x6f8d('0x3c')],'type':_0x37c0bb[_0x6f8d('0x3d')][_0x6f8d('0x3e')]};});_0x58cbe1[_0x6f8d('0x3f')]=_['map'](_0x5b96ef,_0x6f8d('0x37'));_0x58cbe1[_0x6f8d('0x40')]=_[_0x6f8d('0x41')](_0x5710dd[_0x6f8d('0x40')]);_0x58cbe1['filters']=_[_0x6f8d('0x42')](_0x58cbe1['model'],_0x58cbe1[_0x6f8d('0x40')]);_0x5928be['attributes']=_[_0x6f8d('0x42')](_0x58cbe1['model'],qs[_0x6f8d('0x43')](_0x5710dd['query'][_0x6f8d('0x43')]));_0x5928be['attributes']=_0x5928be[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x5928be[_0x6f8d('0x44')]:_0x58cbe1['model'];if(!_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x46')](_0x6f8d('0x47'))){_0x5928be[_0x6f8d('0x2f')]=qs[_0x6f8d('0x2f')](_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x2f')]);_0x5928be[_0x6f8d('0x2d')]=qs[_0x6f8d('0x2d')](_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x2d')]);}_0x5928be[_0x6f8d('0x48')]=qs[_0x6f8d('0x49')](_0x5710dd[_0x6f8d('0x40')]['sort']);_0x5928be[_0x6f8d('0x4a')]=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x5710dd[_0x6f8d('0x40')],_0x58cbe1['filters']),_0x5b96ef);if(_0x5710dd['query']['filter']){_0x5928be[_0x6f8d('0x4a')]=_['merge'](_0x5928be[_0x6f8d('0x4a')],{'$or':_[_0x6f8d('0x3a')](_0x5b96ef,function(_0x4fdf4c){if(_0x4fdf4c[_0x6f8d('0x3d')]!==_0x6f8d('0x4d')){var _0x22f9da={};_0x22f9da[_0x4fdf4c[_0x6f8d('0x37')]]={'$like':'%'+_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x4e')]+'%'};return _0x22f9da;}})});}_0x5928be=_[_0x6f8d('0x4f')]({},_0x5928be,_0x5710dd[_0x6f8d('0x50')]);var _0x4d8945={'where':_0x5928be[_0x6f8d('0x4a')]};return db[_0x6f8d('0x51')][_0x6f8d('0x30')](_0x4d8945)[_0x6f8d('0x1f')](function(_0x334015){_0x578404[_0x6f8d('0x30')]=_0x334015;if(_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x52')]){_0x5928be[_0x6f8d('0x53')]=[{'all':!![]}];}return db[_0x6f8d('0x51')]['findAll'](_0x5928be);})['then'](function(_0x86e621){_0x578404[_0x6f8d('0x54')]=_0x86e621;return _0x578404;})[_0x6f8d('0x1f')](respondWithFilteredResult(_0x1c66d9,_0x5928be))['catch'](handleError(_0x1c66d9,null));};exports[_0x6f8d('0x55')]=function(_0x3b8e09,_0x1ef2a7){var _0x5cd0c4={'raw':![],'where':{'id':_0x3b8e09['params']['id']},'include':[{'model':db[_0x6f8d('0x56')],'as':_0x6f8d('0x39')}]},_0x21fe09={};_0x21fe09[_0x6f8d('0x3f')]=_[_0x6f8d('0x41')](db[_0x6f8d('0x51')]['rawAttributes']);_0x21fe09[_0x6f8d('0x40')]=_['keys'](_0x3b8e09['query']);_0x21fe09[_0x6f8d('0x4b')]=_['intersection'](_0x21fe09[_0x6f8d('0x3f')],_0x21fe09['query']);_0x5cd0c4[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x21fe09[_0x6f8d('0x3f')],qs['fields'](_0x3b8e09[_0x6f8d('0x40')]['fields']));_0x5cd0c4[_0x6f8d('0x44')]=_0x5cd0c4[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x5cd0c4[_0x6f8d('0x44')]:_0x21fe09['model'];if(_0x3b8e09[_0x6f8d('0x40')][_0x6f8d('0x52')]){_0x5cd0c4['include']=[{'all':!![]}];}_0x5cd0c4=_[_0x6f8d('0x4f')]({},_0x5cd0c4,_0x3b8e09[_0x6f8d('0x50')]);return db['WhatsappAccount'][_0x6f8d('0x57')](_0x5cd0c4)[_0x6f8d('0x1f')](handleEntityNotFound(_0x1ef2a7,null))[_0x6f8d('0x1f')](respondWithResult(_0x1ef2a7,null))['catch'](handleError(_0x1ef2a7,null));};exports[_0x6f8d('0x58')]=function(_0x56c7e4,_0x19d21c){return db[_0x6f8d('0x51')][_0x6f8d('0x58')](_0x56c7e4[_0x6f8d('0x59')],{})[_0x6f8d('0x1f')](function(_0xc929df){var _0x14dbcd=_0x56c7e4['user'][_0x6f8d('0x34')]({'plain':!![]});if(!_0x14dbcd)throw new Error(_0x6f8d('0x5a'));if(_0x14dbcd['role']===_0x6f8d('0x5b')){var _0x31c694=_0xc929df['get']({'plain':!![]});var _0x35b3bc='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x35b3bc,'userProfileId':_0x14dbcd[_0x6f8d('0x5c')]},'raw':!![]})[_0x6f8d('0x1f')](function(_0x592c2d){if(_0x592c2d&&_0x592c2d[_0x6f8d('0x5d')]===0x0){return db['UserProfileResource'][_0x6f8d('0x58')]({'name':_0x31c694['name'],'resourceId':_0x31c694['id'],'type':_0x592c2d[_0x6f8d('0x37')],'sectionId':_0x592c2d['id']},{})[_0x6f8d('0x1f')](function(){return _0xc929df;});}else{return _0xc929df;}})[_0x6f8d('0x28')](function(_0x74b877){logger[_0x6f8d('0x24')](_0x6f8d('0x5e'),_0x74b877);throw _0x74b877;});}return _0xc929df;})[_0x6f8d('0x1f')](respondWithResult(_0x19d21c,0xc9))[_0x6f8d('0x28')](handleError(_0x19d21c,null));};exports[_0x6f8d('0x5f')]=function(_0x5c59a5,_0x54ba56){if(_0x5c59a5[_0x6f8d('0x59')]['id']){delete _0x5c59a5[_0x6f8d('0x59')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5c59a5['params']['id']},'include':[{'model':db[_0x6f8d('0x56')],'as':'mandatoryDispositionPause'}]})[_0x6f8d('0x1f')](handleEntityNotFound(_0x54ba56,null))[_0x6f8d('0x1f')](saveUpdates(_0x5c59a5[_0x6f8d('0x59')],null))[_0x6f8d('0x1f')](respondWithResult(_0x54ba56,null))[_0x6f8d('0x28')](handleError(_0x54ba56,null));};exports[_0x6f8d('0x33')]=function(_0x31df84,_0x455106){return db[_0x6f8d('0x51')][_0x6f8d('0x57')]({'where':{'id':_0x31df84[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x455106,null))[_0x6f8d('0x1f')](removeEntity(_0x455106,null))['catch'](handleError(_0x455106,null));};exports[_0x6f8d('0x61')]=function(_0xbcca74,_0xc71b7d){return db[_0x6f8d('0x51')][_0x6f8d('0x61')]()[_0x6f8d('0x1f')](respondWithResult(_0xc71b7d,null))[_0x6f8d('0x28')](handleError(_0xc71b7d,null));};exports[_0x6f8d('0x62')]=function(_0x17b99a,_0x579903,_0xe4d962){if(_0x17b99a[_0x6f8d('0x59')]['id']){delete _0x17b99a[_0x6f8d('0x59')]['id'];}return db['WhatsappAccount'][_0x6f8d('0x57')]({'where':{'id':_0x17b99a['params']['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x579903,null))[_0x6f8d('0x1f')](function(_0x452ce9){if(_0x452ce9){_0x17b99a[_0x6f8d('0x59')][_0x6f8d('0x63')]=_0x452ce9['id'];return db['Disposition'][_0x6f8d('0x58')](_0x17b99a[_0x6f8d('0x59')]);}})[_0x6f8d('0x1f')](respondWithResult(_0x579903,null))[_0x6f8d('0x28')](handleError(_0x579903,null));};exports[_0x6f8d('0x64')]=function(_0x5503d9,_0x4a1dab,_0x2ce54c){var _0x322166={'raw':![],'where':{}};var _0x1a78a3={};var _0x849218={'count':0x0,'rows':[]};return db[_0x6f8d('0x51')][_0x6f8d('0x65')]({'where':{'id':_0x5503d9[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x4a1dab,null))[_0x6f8d('0x1f')](function(_0xdc8cac){if(_0xdc8cac){_0x1a78a3[_0x6f8d('0x3f')]=_[_0x6f8d('0x41')](db[_0x6f8d('0x66')]['rawAttributes']);_0x1a78a3[_0x6f8d('0x40')]=_[_0x6f8d('0x41')](_0x5503d9[_0x6f8d('0x40')]);_0x1a78a3[_0x6f8d('0x4b')]=_[_0x6f8d('0x42')](_0x1a78a3['model'],_0x1a78a3[_0x6f8d('0x40')]);_0x322166[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x1a78a3[_0x6f8d('0x3f')],qs[_0x6f8d('0x43')](_0x5503d9[_0x6f8d('0x40')]['fields']));_0x322166[_0x6f8d('0x44')]=_0x322166[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x322166[_0x6f8d('0x44')]:_0x1a78a3[_0x6f8d('0x3f')];if(!_0x5503d9[_0x6f8d('0x40')]['hasOwnProperty'](_0x6f8d('0x47'))){_0x322166['limit']=qs[_0x6f8d('0x2f')](_0x5503d9[_0x6f8d('0x40')]['limit']);_0x322166[_0x6f8d('0x2d')]=qs['offset'](_0x5503d9[_0x6f8d('0x40')][_0x6f8d('0x2d')]);}_0x322166['order']=qs[_0x6f8d('0x49')](_0x5503d9[_0x6f8d('0x40')][_0x6f8d('0x49')]);_0x322166[_0x6f8d('0x4a')]=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x5503d9['query'],_0x1a78a3[_0x6f8d('0x4b')]));_0x322166[_0x6f8d('0x4a')][_0x6f8d('0x63')]=_0xdc8cac['id'];if(_0x5503d9[_0x6f8d('0x40')]['filter']){_0x322166[_0x6f8d('0x4a')]=_[_0x6f8d('0x4f')](_0x322166[_0x6f8d('0x4a')],{'$or':_[_0x6f8d('0x3a')](_0x322166[_0x6f8d('0x44')],function(_0x430a46){var _0x3c55b5={};_0x3c55b5[_0x430a46]={'$like':'%'+_0x5503d9[_0x6f8d('0x40')][_0x6f8d('0x4e')]+'%'};return _0x3c55b5;})});}_0x322166=_[_0x6f8d('0x4f')]({},_0x322166,_0x5503d9['options']);return db[_0x6f8d('0x66')]['count']({'where':_0x322166[_0x6f8d('0x4a')]})[_0x6f8d('0x1f')](function(_0x4ea976){_0x849218['count']=_0x4ea976;if(_0x5503d9[_0x6f8d('0x40')][_0x6f8d('0x52')]){_0x322166[_0x6f8d('0x53')]=[{'all':!![]}];}return db[_0x6f8d('0x66')][_0x6f8d('0x67')](_0x322166);})['then'](function(_0x39f3be){_0x849218[_0x6f8d('0x54')]=_0x39f3be;return _0x849218;});}})[_0x6f8d('0x1f')](respondWithFilteredResult(_0x4a1dab,_0x322166))[_0x6f8d('0x28')](handleError(_0x4a1dab,null));};exports[_0x6f8d('0x68')]=function(_0x5c3266,_0xc6ed3b,_0x353b0e){return db['WhatsappAccount'][_0x6f8d('0x57')]({'where':{'id':_0x5c3266[_0x6f8d('0x60')]['id']}})['then'](handleEntityNotFound(_0xc6ed3b,null))['then'](function(_0x55c056){if(_0x55c056){return _0x55c056[_0x6f8d('0x68')](_0x5c3266[_0x6f8d('0x40')][_0x6f8d('0x69')]);}})[_0x6f8d('0x1f')](respondWithStatusCode(_0xc6ed3b,null))[_0x6f8d('0x28')](handleError(_0xc6ed3b,null));};exports[_0x6f8d('0x6a')]=function(_0x577b2f,_0x594768,_0xde0b14){if(_0x577b2f['body']['id']){delete _0x577b2f[_0x6f8d('0x59')]['id'];}return db[_0x6f8d('0x51')][_0x6f8d('0x57')]({'where':{'id':_0x577b2f[_0x6f8d('0x60')]['id']}})['then'](handleEntityNotFound(_0x594768,null))[_0x6f8d('0x1f')](function(_0xf1677a){if(_0xf1677a){_0x577b2f[_0x6f8d('0x59')][_0x6f8d('0x63')]=_0xf1677a['id'];return db[_0x6f8d('0x6b')][_0x6f8d('0x58')](_0x577b2f[_0x6f8d('0x59')]);}})['then'](respondWithResult(_0x594768,null))[_0x6f8d('0x28')](handleError(_0x594768,null));};exports[_0x6f8d('0x6c')]=function(_0x1d45ad,_0x1330a4,_0x342d36){var _0x5f3f3c={'raw':![],'where':{}};var _0x577c2f={};var _0x245d84={'count':0x0,'rows':[]};return db[_0x6f8d('0x51')]['findOne']({'where':{'id':_0x1d45ad[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x1330a4,null))['then'](function(_0x442621){if(_0x442621){_0x577c2f[_0x6f8d('0x3f')]=_['keys'](db[_0x6f8d('0x6b')][_0x6f8d('0x3b')]);_0x577c2f[_0x6f8d('0x40')]=_[_0x6f8d('0x41')](_0x1d45ad[_0x6f8d('0x40')]);_0x577c2f['filters']=_['intersection'](_0x577c2f[_0x6f8d('0x3f')],_0x577c2f['query']);_0x5f3f3c[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x577c2f[_0x6f8d('0x3f')],qs[_0x6f8d('0x43')](_0x1d45ad[_0x6f8d('0x40')]['fields']));_0x5f3f3c[_0x6f8d('0x44')]=_0x5f3f3c['attributes'][_0x6f8d('0x45')]?_0x5f3f3c[_0x6f8d('0x44')]:_0x577c2f[_0x6f8d('0x3f')];if(!_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x46')](_0x6f8d('0x47'))){_0x5f3f3c[_0x6f8d('0x2f')]=qs['limit'](_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x2f')]);_0x5f3f3c[_0x6f8d('0x2d')]=qs[_0x6f8d('0x2d')](_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x2d')]);}_0x5f3f3c['order']=qs[_0x6f8d('0x49')](_0x1d45ad[_0x6f8d('0x40')]['sort']);_0x5f3f3c[_0x6f8d('0x4a')]=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x1d45ad['query'],_0x577c2f[_0x6f8d('0x4b')]));_0x5f3f3c['where'][_0x6f8d('0x63')]=_0x442621['id'];if(_0x1d45ad['query'][_0x6f8d('0x4e')]){_0x5f3f3c[_0x6f8d('0x4a')]=_['merge'](_0x5f3f3c[_0x6f8d('0x4a')],{'$or':_['map'](_0x5f3f3c[_0x6f8d('0x44')],function(_0x31c3a8){var _0x43311d={};_0x43311d[_0x31c3a8]={'$like':'%'+_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x4e')]+'%'};return _0x43311d;})});}_0x5f3f3c=_[_0x6f8d('0x4f')]({},_0x5f3f3c,_0x1d45ad[_0x6f8d('0x50')]);return db[_0x6f8d('0x6b')][_0x6f8d('0x30')]({'where':_0x5f3f3c[_0x6f8d('0x4a')]})[_0x6f8d('0x1f')](function(_0xb2790d){_0x245d84[_0x6f8d('0x30')]=_0xb2790d;if(_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x52')]){_0x5f3f3c['include']=[{'all':!![]}];}return db[_0x6f8d('0x6b')][_0x6f8d('0x67')](_0x5f3f3c);})[_0x6f8d('0x1f')](function(_0x49cf3a){_0x245d84[_0x6f8d('0x54')]=_0x49cf3a;return _0x245d84;});}})[_0x6f8d('0x1f')](respondWithFilteredResult(_0x1330a4,_0x5f3f3c))[_0x6f8d('0x28')](handleError(_0x1330a4,null));};exports[_0x6f8d('0x6d')]=function(_0x2a8a05,_0x3b82c4,_0x272aa5){return db[_0x6f8d('0x51')]['find']({'where':{'id':_0x2a8a05[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x3b82c4,null))[_0x6f8d('0x1f')](function(_0x2985b7){if(_0x2985b7){return _0x2985b7[_0x6f8d('0x6d')](_0x2a8a05[_0x6f8d('0x40')][_0x6f8d('0x69')]);}})['then'](respondWithStatusCode(_0x3b82c4,null))['catch'](handleError(_0x3b82c4,null));};exports[_0x6f8d('0x6e')]=function(_0xb3ad7f,_0x4e404e,_0x537099){return db[_0x6f8d('0x51')][_0x6f8d('0x57')]({'where':{'id':_0xb3ad7f['params']['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x4e404e,null))[_0x6f8d('0x1f')](function(_0x1503bb){if(_0x1503bb){return _0x1503bb[_0x6f8d('0x6e')](_0xb3ad7f[_0x6f8d('0x59')]['ids'],_[_0x6f8d('0x6f')](_0xb3ad7f[_0x6f8d('0x59')],['ids','id'])||{})[_0x6f8d('0x70')](function(_0x3879ae){for(var _0x51739a=0x0;_0x51739a<_0xb3ad7f['body']['ids'][_0x6f8d('0x45')];_0x51739a+=0x1){socket[_0x6f8d('0x71')](_0x6f8d('0x72'),{'UserId':Number(_0xb3ad7f['body']['ids'][_0x51739a]),'WhatsappAccountId':Number(_0xb3ad7f[_0x6f8d('0x60')]['id'])});}return _0x3879ae;});}})[_0x6f8d('0x1f')](respondWithResult(_0x4e404e,null))[_0x6f8d('0x28')](handleError(_0x4e404e,null));};exports[_0x6f8d('0x73')]=function(_0x459681,_0xfc9475,_0x3b1a0d){return db[_0x6f8d('0x51')]['find']({'where':{'id':_0x459681[_0x6f8d('0x60')]['id']}})['then'](handleEntityNotFound(_0xfc9475,null))[_0x6f8d('0x1f')](function(_0x4641c8){if(_0x4641c8){return _0x4641c8['removeAgents'](_0x459681['query'][_0x6f8d('0x69')])['then'](function(){if(_[_0x6f8d('0x74')](_0x459681[_0x6f8d('0x40')][_0x6f8d('0x69')])){for(var _0x2d3365=0x0;_0x2d3365<_0x459681[_0x6f8d('0x40')]['ids'][_0x6f8d('0x45')];_0x2d3365+=0x1){socket['emit'](_0x6f8d('0x75'),{'UserId':Number(_0x459681[_0x6f8d('0x40')]['ids'][_0x2d3365]),'WhatsappAccountId':Number(_0x459681[_0x6f8d('0x60')]['id'])});}}else{socket[_0x6f8d('0x71')](_0x6f8d('0x75'),{'UserId':Number(_0x459681[_0x6f8d('0x40')][_0x6f8d('0x69')]),'WhatsappAccountId':Number(_0x459681['params']['id'])});}});}})[_0x6f8d('0x1f')](respondWithStatusCode(_0xfc9475,null))['catch'](handleError(_0xfc9475,null));};exports[_0x6f8d('0x76')]=function(_0x5e5ce4,_0x1b3896,_0x35eeed){var _0x52c9b1={};var _0x1fb416={};var _0x17b3a4;var _0x1f8da4;return db[_0x6f8d('0x51')]['findOne']({'where':{'id':_0x5e5ce4[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x1b3896,null))[_0x6f8d('0x1f')](function(_0xfec292){if(_0xfec292){_0x17b3a4=_0xfec292;_0x1fb416[_0x6f8d('0x3f')]=_[_0x6f8d('0x41')](db[_0x6f8d('0x77')][_0x6f8d('0x3b')]);_0x1fb416[_0x6f8d('0x40')]=_[_0x6f8d('0x41')](_0x5e5ce4[_0x6f8d('0x40')]);_0x1fb416['filters']=_['intersection'](_0x1fb416[_0x6f8d('0x3f')],_0x1fb416[_0x6f8d('0x40')]);_0x52c9b1[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x1fb416['model'],qs[_0x6f8d('0x43')](_0x5e5ce4[_0x6f8d('0x40')][_0x6f8d('0x43')]));_0x52c9b1[_0x6f8d('0x44')]=_0x52c9b1[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x52c9b1[_0x6f8d('0x44')]:_0x1fb416['model'];_0x52c9b1[_0x6f8d('0x48')]=qs[_0x6f8d('0x49')](_0x5e5ce4['query'][_0x6f8d('0x49')]);_0x52c9b1['where']=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x5e5ce4[_0x6f8d('0x40')],_0x1fb416[_0x6f8d('0x4b')]));if(_0x5e5ce4[_0x6f8d('0x40')]['filter']){_0x52c9b1[_0x6f8d('0x4a')]=_['merge'](_0x52c9b1[_0x6f8d('0x4a')],{'$or':_[_0x6f8d('0x3a')](_0x52c9b1[_0x6f8d('0x44')],function(_0x67cfed){var _0x3ae945={};_0x3ae945[_0x67cfed]={'$like':'%'+_0x5e5ce4['query'][_0x6f8d('0x4e')]+'%'};return _0x3ae945;})});}_0x52c9b1=_['merge']({},_0x52c9b1,_0x5e5ce4[_0x6f8d('0x50')]);return _0x17b3a4[_0x6f8d('0x76')](_0x52c9b1);}})[_0x6f8d('0x1f')](function(_0x3c08e2){if(_0x3c08e2){_0x1f8da4=_0x3c08e2['length'];if(!_0x5e5ce4[_0x6f8d('0x40')][_0x6f8d('0x46')](_0x6f8d('0x47'))){_0x52c9b1[_0x6f8d('0x2f')]=qs[_0x6f8d('0x2f')](_0x5e5ce4['query'][_0x6f8d('0x2f')]);_0x52c9b1['offset']=qs['offset'](_0x5e5ce4['query'][_0x6f8d('0x2d')]);}return _0x17b3a4[_0x6f8d('0x76')](_0x52c9b1);}})[_0x6f8d('0x1f')](function(_0x3aa7e3){if(_0x3aa7e3){return _0x3aa7e3?{'count':_0x1f8da4,'rows':_0x3aa7e3}:null;}})[_0x6f8d('0x1f')](respondWithResult(_0x1b3896,null))[_0x6f8d('0x28')](handleError(_0x1b3896,null));};exports[_0x6f8d('0x78')]=function(_0x2cd1ef,_0x55f0ca){var _0x3ed2c4=_0x2cd1ef[_0x6f8d('0x60')]['id'];var _0x2086df=_0x2cd1ef['body'];var _0x364e68=0xc8;var _0x1d3601=null;return db['sequelize'][_0x6f8d('0x79')]({'isolationLevel':db[_0x6f8d('0x7a')][_0x6f8d('0x7b')][_0x6f8d('0x7c')]['READ_COMMITTED']},function(_0x28500){return db['WhatsappAccount'][_0x6f8d('0x65')]({'where':{'id':_0x3ed2c4},'transaction':_0x28500})['then'](function(_0x2093b1){if(_0x2093b1){return db[_0x6f8d('0x7d')][_0x6f8d('0x33')]({'where':{'WhatsappAccountId':_0x3ed2c4},'transaction':_0x28500})[_0x6f8d('0x1f')](function(){var _0x2bb3e9=_[_0x6f8d('0x3a')](_0x2086df,function(_0x5dd66c){_0x5dd66c[_0x6f8d('0x63')]=_0x3ed2c4;return _0x5dd66c;});return db['WhatsappApplication']['bulkCreate'](_0x2bb3e9,{'transaction':_0x28500});});}else{_0x364e68=0x194;_0x1d3601=[];}});})[_0x6f8d('0x1f')](function(){if(_0x364e68!==0x194){return db[_0x6f8d('0x7d')][_0x6f8d('0x7e')]({'where':{'WhatsappAccountId':_0x3ed2c4},'order':_0x6f8d('0x7f')})[_0x6f8d('0x1f')](function(_0x3c51b7){_0x1d3601=_0x3c51b7;});}})[_0x6f8d('0x28')](function(_0x15378b){_0x364e68=0x1f4;logger['error'](_0x15378b[_0x6f8d('0x80')]);if(_0x15378b[_0x6f8d('0x37')]){delete _0x15378b[_0x6f8d('0x37')];}_0x1d3601=_0x15378b;})['finally'](function(){if(_0x1d3601===null){_0x55f0ca['sendStatus'](_0x364e68);}else{if(_0x364e68===0x1f4){_0x55f0ca[_0x6f8d('0x2b')](_0x364e68)[_0x6f8d('0x81')](_0x1d3601);}else{_0x55f0ca[_0x6f8d('0x2b')](_0x364e68)[_0x6f8d('0x2c')](_0x1d3601);}}});};exports['getApplications']=function(_0x34c164,_0x455f7c,_0x575e10){var _0x532631={};var _0x428d5f={};var _0x23acb7;var _0x241c51;return db[_0x6f8d('0x51')][_0x6f8d('0x65')]({'where':{'id':_0x34c164[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x455f7c,null))[_0x6f8d('0x1f')](function(_0x337325){if(_0x337325){_0x23acb7=_0x337325;_0x428d5f['model']=_[_0x6f8d('0x41')](db['WhatsappApplication'][_0x6f8d('0x3b')]);_0x428d5f['query']=_[_0x6f8d('0x41')](_0x34c164['query']);_0x428d5f[_0x6f8d('0x4b')]=_[_0x6f8d('0x42')](_0x428d5f[_0x6f8d('0x3f')],_0x428d5f[_0x6f8d('0x40')]);_0x532631[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x428d5f[_0x6f8d('0x3f')],qs[_0x6f8d('0x43')](_0x34c164['query'][_0x6f8d('0x43')]));_0x532631[_0x6f8d('0x44')]=_0x532631[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x532631[_0x6f8d('0x44')]:_0x428d5f[_0x6f8d('0x3f')];_0x532631[_0x6f8d('0x48')]=qs['sort'](_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x49')]);_0x532631['where']=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x34c164[_0x6f8d('0x40')],_0x428d5f[_0x6f8d('0x4b')]));if(_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x4e')]){_0x532631[_0x6f8d('0x4a')]=_['merge'](_0x532631[_0x6f8d('0x4a')],{'$or':_[_0x6f8d('0x3a')](_0x532631['attributes'],function(_0x5df45b){var _0x3067ef={};_0x3067ef[_0x5df45b]={'$like':'%'+_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x4e')]+'%'};return _0x3067ef;})});}_0x532631=_[_0x6f8d('0x4f')]({},_0x532631,_0x34c164['options']);return _0x23acb7[_0x6f8d('0x82')](_0x532631);}})[_0x6f8d('0x1f')](function(_0x4d32e3){if(_0x4d32e3){_0x241c51=_0x4d32e3[_0x6f8d('0x45')];if(!_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x46')]('nolimit')){_0x532631['limit']=qs['limit'](_0x34c164['query'][_0x6f8d('0x2f')]);_0x532631[_0x6f8d('0x2d')]=qs[_0x6f8d('0x2d')](_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x2d')]);}return _0x23acb7['getApplications'](_0x532631);}})[_0x6f8d('0x1f')](function(_0x249edc){if(_0x249edc){return _0x249edc?{'count':_0x241c51,'rows':_0x249edc}:null;}})[_0x6f8d('0x1f')](respondWithResult(_0x455f7c,null))[_0x6f8d('0x28')](handleError(_0x455f7c,null));};exports[_0x6f8d('0x83')]=function(_0x100a8e,_0x5c67f0,_0x1183ce){var _0x2fe917={'channel':_0x6f8d('0x84')};var _0x143a53=[];var _0xf590c1=[];var _0x242e59={};return db[_0x6f8d('0x51')]['find']({'where':{'id':_0x100a8e[_0x6f8d('0x60')]['id']},'include':[{'model':db[_0x6f8d('0x7d')],'as':'Applications'}]})[_0x6f8d('0x1f')](handleEntityNotFound(_0x5c67f0,null))['then'](function(_0x1b3f3e){_0x2fe917['account']=_0x1b3f3e;if(_0x2fe917[_0x6f8d('0x85')]&&_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x3d')]===_0x6f8d('0x86')&&_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x87')]){if(_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x87')][_0x6f8d('0x45')]===0x0)return;if(_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x87')][0x0][_0x6f8d('0x88')]!=='read')return;return db[_0x6f8d('0x89')]['update']({'read':!![],'readAt':_0x100a8e[_0x6f8d('0x59')]['statuses'][0x0][_0x6f8d('0x8a')]},{'where':{'messageId':_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x87')][0x0]['message_id']},'individualHooks':!![]})[_0x6f8d('0x1f')](function(_0x3e1897){return _0x5c67f0[_0x6f8d('0x2b')](0xc8)[_0x6f8d('0x2c')](_0x3e1897);});}_0x2fe917['applications']=_['orderBy'](_0x1b3f3e[_0x6f8d('0x8b')],['priority'],[_0x6f8d('0x8c')]);if(_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x8b')]){delete _0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x8b')];}return db['CmContact'][_0x6f8d('0x61')]()[_0x6f8d('0x1f')](function(_0x165fb7){if(!_0x165fb7){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0x8f'));}_0x143a53=_['difference'](_[_0x6f8d('0x41')](_0x165fb7),[_0x6f8d('0x90'),'updatedAt']);_0xf590c1=_['difference'](_[_0x6f8d('0x41')](_0x165fb7),[_0x6f8d('0x90'),_0x6f8d('0x91'),_0x6f8d('0x92'),_0x6f8d('0x93')]);_0x2fe917[_0x6f8d('0x59')]={'mapKey':_0x6f8d('0x94')};if(_0x2fe917['account']&&_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x3d')]===_0x6f8d('0x95')){_0x2fe917[_0x6f8d('0x59')]['from']=_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x96')][_0x6f8d('0x97')](_0x6f8d('0x98'),'');_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x59')]=_0x100a8e['body'][_0x6f8d('0x99')];_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9a')]=_0x100a8e[_0x6f8d('0x59')]['MessageSid'];}if(_0x2fe917[_0x6f8d('0x85')]&&_0x2fe917['account'][_0x6f8d('0x3d')]===_0x6f8d('0x86')){_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9b')]=_0x100a8e['body'][_0x6f8d('0x9c')][0x0][_0x6f8d('0x9b')];_0x2fe917['body'][_0x6f8d('0x59')]=_0x100a8e[_0x6f8d('0x59')]['notifications'][0x0][_0x6f8d('0x26')][_0x6f8d('0x59')];_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9a')]=_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x9c')][0x0][_0x6f8d('0x9d')];}if(_0x2fe917[_0x6f8d('0x59')]['id']){delete _0x2fe917[_0x6f8d('0x59')]['id'];}if(_[_0x6f8d('0x9e')](_0x2fe917['body'][_0x6f8d('0x9b')])){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0x9f'));}if(_[_0x6f8d('0x9e')](_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x59')])||_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x59')]===''){throw new db[(_0x6f8d('0x8d'))]['ValidationError'](_0x6f8d('0xa0'));}if(_[_0x6f8d('0x9e')](_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0xa1')])){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0xa2')+_0xf590c1);}if(!_[_0x6f8d('0xa3')](_0xf590c1,_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0xa1')])){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0xa4')+_0xf590c1);}_0x242e59[_0x2fe917[_0x6f8d('0x59')]['mapKey']]=_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9b')];return db[_0x6f8d('0xa5')][_0x6f8d('0x57')]({'where':{'id':_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x93')]},'include':[{'model':db['CmContact'],'as':_0x6f8d('0xa6'),'where':_0x242e59,'limit':0x1,'order':[[_0x6f8d('0x91'),'DESC']]}]});})['then'](handleEntityNotFound(_0x5c67f0,null))[_0x6f8d('0x1f')](function(_0x44ae43){if(_0x44ae43){_0x2fe917[_0x6f8d('0xa7')]=_[_0x6f8d('0x6f')](_0x44ae43,[_0x6f8d('0xa6')]);if(_0x44ae43[_0x6f8d('0xa6')][_0x6f8d('0x45')]){return _0x44ae43['Contacts'][0x0];}var _0x69aea3=_[_0x6f8d('0x19')](_0x2fe917['body'],{'firstName':_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9b')],'ListId':_0x44ae43['id']});_0x69aea3[_0x2fe917['body']['mapKey']]=_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9b')];return db[_0x6f8d('0xa8')][_0x6f8d('0x58')](_0x69aea3,{'fields':_0x143a53,'raw':!![]});}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x5c67f0,null))[_0x6f8d('0x1f')](function(_0x713963){if(_0x713963){_0x2fe917[_0x6f8d('0xa9')]=_0x713963;var _0x1583b7={'ContactId':_0x713963['id'],'phone':_0x2fe917[_0x6f8d('0x59')]['from'],'WhatsappAccountId':_0x100a8e[_0x6f8d('0x60')]['id']};var _0x1d99c2={'ContactId':_0x713963['id'],'WhatsappAccountId':_0x100a8e[_0x6f8d('0x60')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x6f8d('0x57')]({'where':_0x1d99c2})[_0x6f8d('0x1f')](function(_0x21d608){if(_0x21d608){return[_0x21d608,![]];}return db['WhatsappInteraction'][_0x6f8d('0x58')](_0x1583b7)[_0x6f8d('0x1f')](function(_0x2e6e44){return[_0x2e6e44,!![]];});});}})['spread'](function(_0x45f16c,_0x4668ec){_0x2fe917[_0x6f8d('0xaa')]=_0x45f16c[_0x6f8d('0x34')]({'plain':!![]});_0x2fe917['interaction'][_0x6f8d('0xab')]=![];if(_0x4668ec){if(_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0xac')]){_0x2fe917[_0x6f8d('0xad')][_0x6f8d('0xae')]({'id':0x0,'priority':_0x2fe917['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x2fe917[_0x6f8d('0xaa')][_0x6f8d('0xab')]=!![];}return db[_0x6f8d('0x89')][_0x6f8d('0x58')]({'phone':_0x2fe917[_0x6f8d('0x59')]['from'],'messageId':_0x2fe917['body']['messageId'],'body':_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x59')],'WhatsappAccountId':_0x100a8e[_0x6f8d('0x60')]['id'],'WhatsappInteractionId':_0x45f16c['id'],'direction':'in','ContactId':_0x45f16c[_0x6f8d('0xaf')],'AttachmentId':_0x2fe917['body']['AttachmentId']});})[_0x6f8d('0x1f')](function(_0x58824a){_0x2fe917[_0x6f8d('0x26')]=_0x58824a;if(_0x2fe917[_0x6f8d('0xaa')]['UserId']){return db['User'][_0x6f8d('0x57')]({'attributes':['id',_0x6f8d('0x37')],'where':{'id':_0x2fe917[_0x6f8d('0xaa')][_0x6f8d('0xb0')]}})[_0x6f8d('0x1f')](function(_0xd8dfef){if(_0xd8dfef){_0x2fe917[_0x6f8d('0xad')][_0x6f8d('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xd8dfef[_0x6f8d('0x37')]+','+(_0x2fe917['account'][_0x6f8d('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6f8d('0xb3'),_0x6f8d('0xb4'),_0x2fe917);});}return respondWithRpcPromise('Start',_0x6f8d('0xb4'),_0x2fe917);})[_0x6f8d('0x1f')](function(_0x4dfa7e){if(_0x4dfa7e){var _0x49aee2=0xc8;var _0x1da3ef=_0x6f8d('0xb5');logger['info'](_0x6f8d('0x23'),_0x1da3ef,_0x49aee2,_0x6f8d('0xb6'));logger[_0x6f8d('0xb7')](_0x6f8d('0xb8'),_0x1da3ef,_0x49aee2,_0x6f8d('0xb6'),JSON[_0x6f8d('0xb9')](_0x4dfa7e));if(_0x2fe917[_0x6f8d('0x85')]['type']===_0x6f8d('0x95')){return _0x5c67f0['status'](_0x49aee2)['set'](_0x6f8d('0xba'),'text/xml')[_0x6f8d('0x81')](_0x6f8d('0xbb'));}else{return _0x5c67f0['status'](_0x49aee2)[_0x6f8d('0x2c')](_0x4dfa7e);}}});})[_0x6f8d('0x28')](handleError(_0x5c67f0,null));};exports[_0x6f8d('0x81')]=function(_0x5b210e,_0x253c3c,_0x182ba1){var _0x20e791,_0x229929,_0x17b044;if(_[_0x6f8d('0x9e')](_0x5b210e[_0x6f8d('0x59')][_0x6f8d('0x59')])||_0x5b210e['body'][_0x6f8d('0x59')]===''){throw new db['Sequelize'][(_0x6f8d('0x8e'))](_0x6f8d('0xa0'));}if(_[_0x6f8d('0x9e')](_0x5b210e[_0x6f8d('0x59')]['to'])){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0xbc'));}_0x20e791=_0x5b210e[_0x6f8d('0x59')]['to'];return db[_0x6f8d('0x51')][_0x6f8d('0x57')]({'where':{'id':_0x5b210e['params']['id']},'include':[{'model':db[_0x6f8d('0xa5')],'as':_0x6f8d('0xbd'),'include':[{'model':db['CmContact'],'as':_0x6f8d('0xa6'),'where':{'mobile':_0x20e791},'limit':0x1,'order':[['updatedAt',_0x6f8d('0xbe')]]}]}]})[_0x6f8d('0x1f')](handleEntityNotFound(_0x253c3c,null))[_0x6f8d('0x1f')](function(_0x5854ef){if(_0x5854ef&&_0x5854ef[_0x6f8d('0xbd')]){_0x229929=_0x5854ef[_0x6f8d('0x34')]({'plain':!![]});if(_0x229929[_0x6f8d('0xbd')]&&_0x229929[_0x6f8d('0xbd')][_0x6f8d('0xa6')][_0x6f8d('0x45')]){return _0x229929[_0x6f8d('0xbd')][_0x6f8d('0xa6')][0x0];}return db['CmContact'][_0x6f8d('0x58')](_[_0x6f8d('0x19')](_0x5b210e[_0x6f8d('0x59')],{'firstName':_0x20e791,'mobile':_0x20e791,'phone':_0x20e791,'ListId':_0x229929['ListId']}));}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x253c3c,null))[_0x6f8d('0x1f')](function(_0x3b4df9){if(_0x3b4df9){_0x17b044=_0x3b4df9;return db[_0x6f8d('0xbf')][_0x6f8d('0x57')]({'where':{'ContactId':_0x17b044['id'],'closed':![],'WhatsappAccountId':_0x229929['id']}})['then'](function(_0x5112f2){if(_0x5112f2){return[_0x5112f2,![]];}return db['WhatsappInteraction'][_0x6f8d('0x58')]({'UserId':_0x5b210e[_0x6f8d('0x5b')]['id'],'ContactId':_0x17b044['id'],'WhatsappAccountId':_0x229929['id'],'phone':_0x20e791,'firstMsgDirection':'out','Messages':[_[_0x6f8d('0x4f')](_0x5b210e[_0x6f8d('0x59')],{'read':![],'body':_0x5b210e['body']['body'],'phone':_0x20e791,'WhatsappAccountId':_0x229929['id'],'UserId':_0x5b210e['user']['id'],'ContactId':_0x17b044['id']})]},{'include':[{'model':db[_0x6f8d('0x89')],'as':_0x6f8d('0xc0')}]})['then'](function(_0x5797a6){return[_0x5797a6,!![]];});});}})[_0x6f8d('0x70')](function(_0x11a2bd,_0x1ba191){if(_0x1ba191){return _0x11a2bd;}return db['WhatsappMessage'][_0x6f8d('0x58')](_[_0x6f8d('0x4f')](_0x5b210e[_0x6f8d('0x59')],{'read':![],'body':_0x5b210e['body'][_0x6f8d('0x59')],'phone':_0x20e791,'WhatsappAccountId':_0x229929['id'],'WhatsappInteractionId':_0x11a2bd['id'],'UserId':_0x5b210e[_0x6f8d('0x5b')]['id'],'ContactId':_0x17b044['id']}))[_0x6f8d('0x1f')](function(_0x2cc9a0){_0x11a2bd[_0x6f8d('0xc1')][_0x6f8d('0xc0')]=[];_0x11a2bd[_0x6f8d('0xc1')][_0x6f8d('0xc0')][_0x6f8d('0xae')](_0x2cc9a0[_0x6f8d('0xc1')]);return _0x11a2bd;});})[_0x6f8d('0x1f')](respondWithResult(_0x253c3c,null))[_0x6f8d('0x28')](handleError(_0x253c3c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 50cb94b..da88d0c 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 _0x97b6=['save','remove','emit','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x1e11c2,_0x1bcbca){var _0x4faa44=function(_0x4c3bf3){while(--_0x4c3bf3){_0x1e11c2['push'](_0x1e11c2['shift']());}};_0x4faa44(++_0x1bcbca);}(_0x97b6,0x1e4));var _0x697b=function(_0x3f4568,_0x9eb0ee){_0x3f4568=_0x3f4568-0x0;var _0xee2340=_0x97b6[_0x3f4568];return _0xee2340;};'use strict';var EventEmitter=require(_0x697b('0x0'));var WhatsappAccount=require(_0x697b('0x1'))['db'][_0x697b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x697b('0x3')](0x0);var events={'afterCreate':_0x697b('0x4'),'afterUpdate':'update','afterDestroy':_0x697b('0x5')};function emitEvent(_0x51cbf7){return function(_0x2d6a24,_0x158d8e,_0x423422){WhatsappAccountEvents[_0x697b('0x6')](_0x51cbf7+':'+_0x2d6a24['id'],_0x2d6a24);WhatsappAccountEvents[_0x697b('0x6')](_0x51cbf7,_0x2d6a24);_0x423422(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x697b('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x4867=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x4867,0xc2));var _0x7486=function(_0xa1f3d9,_0x2a0fa4){_0xa1f3d9=_0xa1f3d9-0x0;var _0x5dcb0a=_0x4867[_0xa1f3d9];return _0x5dcb0a;};'use strict';var EventEmitter=require(_0x7486('0x0'));var WhatsappAccount=require(_0x7486('0x1'))['db'][_0x7486('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7486('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7486('0x4'),'afterDestroy':_0x7486('0x5')};function emitEvent(_0x42afdb){return function(_0x27e22a,_0x57d898,_0x1f036d){WhatsappAccountEvents['emit'](_0x42afdb+':'+_0x27e22a['id'],_0x27e22a);WhatsappAccountEvents[_0x7486('0x6')](_0x42afdb,_0x27e22a);_0x1f036d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x7486('0x7')](e,emitEvent(event));}}module[_0x7486('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 0cafa45..a2766b0 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 _0xa8fd=['request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa8fd,0x1c9));var _0xda8f=function(_0x1f41bc,_0x1e5d00){_0x1f41bc=_0x1f41bc-0x0;var _0x492c61=_0xa8fd[_0x1f41bc];return _0x492c61;};'use strict';var _=require(_0xda8f('0x0'));var util=require('util');var logger=require(_0xda8f('0x1'))(_0xda8f('0x2'));var moment=require(_0xda8f('0x3'));var BPromise=require(_0xda8f('0x4'));var rp=require(_0xda8f('0x5'));var fs=require('fs');var path=require(_0xda8f('0x6'));var rimraf=require(_0xda8f('0x7'));var config=require(_0xda8f('0x8'));var attributes=require(_0xda8f('0x9'));module[_0xda8f('0xa')]=function(_0x569085,_0x3675b3){return _0x569085['define']('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70b8=['./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3498e5,_0x1f78fd){var _0x3fe3fd=function(_0xa338e3){while(--_0xa338e3){_0x3498e5['push'](_0x3498e5['shift']());}};_0x3fe3fd(++_0x1f78fd);}(_0x70b8,0x178));var _0x870b=function(_0x1d7fe4,_0x39c93c){_0x1d7fe4=_0x1d7fe4-0x0;var _0x767e84=_0x70b8[_0x1d7fe4];return _0x767e84;};'use strict';var _=require('lodash');var util=require(_0x870b('0x0'));var logger=require(_0x870b('0x1'))(_0x870b('0x2'));var moment=require(_0x870b('0x3'));var BPromise=require(_0x870b('0x4'));var rp=require(_0x870b('0x5'));var fs=require('fs');var path=require(_0x870b('0x6'));var rimraf=require('rimraf');var config=require(_0x870b('0x7'));var attributes=require(_0x870b('0x8'));module['exports']=function(_0x221059,_0x2ddb55){return _0x221059[_0x870b('0x9')](_0x870b('0xa'),attributes,{'tableName':_0x870b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 9fb116d..d0e7b9b 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 _0x036e=['attributes','include','map','model','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where'];(function(_0x208af5,_0x1b1b24){var _0xe45b18=function(_0x35d0ad){while(--_0x35d0ad){_0x208af5['push'](_0x208af5['shift']());}};_0xe45b18(++_0x1b1b24);}(_0x036e,0x182));var _0xe036=function(_0x1c57ec,_0x4891b2){_0x1c57ec=_0x1c57ec-0x0;var _0x5beb4d=_0x036e[_0x1c57ec];return _0x5beb4d;};'use strict';var _=require(_0xe036('0x0'));var util=require(_0xe036('0x1'));var moment=require('moment');var BPromise=require(_0xe036('0x2'));var rs=require(_0xe036('0x3'));var fs=require('fs');var Redis=require(_0xe036('0x4'));var db=require(_0xe036('0x5'))['db'];var utils=require(_0xe036('0x6'));var logger=require('../../config/logger')(_0xe036('0x7'));var config=require(_0xe036('0x8'));var jayson=require(_0xe036('0x9'));var client=jayson[_0xe036('0xa')][_0xe036('0xb')]({'port':0x232a});config[_0xe036('0xc')]=_['defaults'](config[_0xe036('0xc')],{'host':_0xe036('0xd'),'port':0x18eb});var socket=require(_0xe036('0xe'))(new Redis(config['redis']));require(_0xe036('0xf'))['register'](socket);function respondWithRpcPromise(_0x264aba,_0x39eba9,_0x4b1a4f){return new BPromise(function(_0x5c6201,_0x3773cc){return client[_0xe036('0x10')](_0x264aba,_0x4b1a4f)['then'](function(_0x463a61){logger[_0xe036('0x11')](_0xe036('0x12'),_0x39eba9,_0xe036('0x13'));logger[_0xe036('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x39eba9,_0xe036('0x13'),JSON['stringify'](_0x463a61));if(_0x463a61[_0xe036('0x15')]){if(_0x463a61[_0xe036('0x15')][_0xe036('0x16')]===0x1f4){logger[_0xe036('0x15')](_0xe036('0x12'),_0x39eba9,_0x463a61[_0xe036('0x15')][_0xe036('0x17')]);return _0x3773cc(_0x463a61['error'][_0xe036('0x17')]);}logger[_0xe036('0x15')](_0xe036('0x12'),_0x39eba9,_0x463a61[_0xe036('0x15')][_0xe036('0x17')]);return _0x5c6201(_0x463a61[_0xe036('0x15')][_0xe036('0x17')]);}else{logger[_0xe036('0x11')](_0xe036('0x12'),_0x39eba9,_0xe036('0x13'));_0x5c6201(_0x463a61[_0xe036('0x18')][_0xe036('0x17')]);}})[_0xe036('0x19')](function(_0x506ba0){logger[_0xe036('0x15')](_0xe036('0x12'),_0x39eba9,_0x506ba0);_0x3773cc(_0x506ba0);});});}exports[_0xe036('0x1a')]=function(_0x2df1ca){var _0x2622b7=this;return new Promise(function(_0x59d84a,_0x28a292){return db[_0xe036('0x1b')][_0xe036('0x1c')]({'raw':_0x2df1ca[_0xe036('0x1d')]?_0x2df1ca[_0xe036('0x1d')][_0xe036('0x1e')]===undefined?!![]:![]:!![],'where':_0x2df1ca[_0xe036('0x1d')]?_0x2df1ca[_0xe036('0x1d')][_0xe036('0x1f')]||null:null,'attributes':_0x2df1ca[_0xe036('0x1d')]?_0x2df1ca['options'][_0xe036('0x20')]||null:null,'include':_0x2df1ca[_0xe036('0x1d')]?_0x2df1ca['options'][_0xe036('0x21')]?_[_0xe036('0x22')](_0x2df1ca[_0xe036('0x1d')][_0xe036('0x21')],function(_0x5457ec){return{'model':db[_0x5457ec[_0xe036('0x23')]],'as':_0x5457ec['as'],'attributes':_0x5457ec[_0xe036('0x20')],'include':_0x5457ec[_0xe036('0x21')]?_[_0xe036('0x22')](_0x5457ec[_0xe036('0x21')],function(_0x32cc24){return{'model':db[_0x32cc24[_0xe036('0x23')]],'as':_0x32cc24['as'],'attributes':_0x32cc24[_0xe036('0x20')],'include':_0x32cc24['include']?_[_0xe036('0x22')](_0x32cc24[_0xe036('0x21')],function(_0x386d9f){return{'model':db[_0x386d9f['model']],'as':_0x386d9f['as'],'attributes':_0x386d9f[_0xe036('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe036('0x24')](function(_0x277653){logger['info'](_0xe036('0x1a'),_0x2df1ca);logger[_0xe036('0x14')](_0xe036('0x1a'),_0x2df1ca,JSON[_0xe036('0x25')](_0x277653));_0x59d84a(_0x277653);})[_0xe036('0x19')](function(_0x3cd833){logger[_0xe036('0x15')](_0xe036('0x1a'),_0x3cd833[_0xe036('0x17')],_0x2df1ca);_0x28a292(_0x2622b7['error'](0x1f4,_0x3cd833[_0xe036('0x17')]));});});}; \ No newline at end of file +var _0xc830=['info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','stringify','catch','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then'];(function(_0x52e488,_0x347309){var _0x1a600f=function(_0x3a2e80){while(--_0x3a2e80){_0x52e488['push'](_0x52e488['shift']());}};_0x1a600f(++_0x347309);}(_0xc830,0x14d));var _0x0c83=function(_0x27ccb9,_0x4e0473){_0x27ccb9=_0x27ccb9-0x0;var _0x6253da=_0xc830[_0x27ccb9];return _0x6253da;};'use strict';var _=require(_0x0c83('0x0'));var util=require(_0x0c83('0x1'));var moment=require(_0x0c83('0x2'));var BPromise=require(_0x0c83('0x3'));var rs=require(_0x0c83('0x4'));var fs=require('fs');var Redis=require(_0x0c83('0x5'));var db=require(_0x0c83('0x6'))['db'];var utils=require(_0x0c83('0x7'));var logger=require(_0x0c83('0x8'))(_0x0c83('0x9'));var config=require(_0x0c83('0xa'));var jayson=require(_0x0c83('0xb'));var client=jayson['client'][_0x0c83('0xc')]({'port':0x232a});config[_0x0c83('0xd')]=_['defaults'](config[_0x0c83('0xd')],{'host':_0x0c83('0xe'),'port':0x18eb});var socket=require(_0x0c83('0xf'))(new Redis(config[_0x0c83('0xd')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x522410,_0x566cb7,_0x2487ff){return new BPromise(function(_0x4e2130,_0x4e3b5b){return client[_0x0c83('0x10')](_0x522410,_0x2487ff)[_0x0c83('0x11')](function(_0x449e32){logger[_0x0c83('0x12')](_0x0c83('0x13'),_0x566cb7,_0x0c83('0x14'));logger['debug'](_0x0c83('0x15'),_0x566cb7,_0x0c83('0x14'),JSON['stringify'](_0x449e32));if(_0x449e32[_0x0c83('0x16')]){if(_0x449e32[_0x0c83('0x16')][_0x0c83('0x17')]===0x1f4){logger[_0x0c83('0x16')](_0x0c83('0x13'),_0x566cb7,_0x449e32[_0x0c83('0x16')][_0x0c83('0x18')]);return _0x4e3b5b(_0x449e32[_0x0c83('0x16')][_0x0c83('0x18')]);}logger[_0x0c83('0x16')](_0x0c83('0x13'),_0x566cb7,_0x449e32['error'][_0x0c83('0x18')]);return _0x4e2130(_0x449e32['error'][_0x0c83('0x18')]);}else{logger[_0x0c83('0x12')](_0x0c83('0x13'),_0x566cb7,_0x0c83('0x14'));_0x4e2130(_0x449e32[_0x0c83('0x19')]['message']);}})['catch'](function(_0x3caf57){logger[_0x0c83('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x566cb7,_0x3caf57);_0x4e3b5b(_0x3caf57);});});}exports['ShowWhatsappAccount']=function(_0x28b376){var _0x5f206a=this;return new Promise(function(_0x8f139c,_0x2c25f8){return db[_0x0c83('0x1a')][_0x0c83('0x1b')]({'raw':_0x28b376['options']?_0x28b376[_0x0c83('0x1c')][_0x0c83('0x1d')]===undefined?!![]:![]:!![],'where':_0x28b376[_0x0c83('0x1c')]?_0x28b376[_0x0c83('0x1c')][_0x0c83('0x1e')]||null:null,'attributes':_0x28b376['options']?_0x28b376[_0x0c83('0x1c')][_0x0c83('0x1f')]||null:null,'include':_0x28b376[_0x0c83('0x1c')]?_0x28b376[_0x0c83('0x1c')][_0x0c83('0x20')]?_[_0x0c83('0x21')](_0x28b376[_0x0c83('0x1c')][_0x0c83('0x20')],function(_0x1a0e36){return{'model':db[_0x1a0e36[_0x0c83('0x22')]],'as':_0x1a0e36['as'],'attributes':_0x1a0e36[_0x0c83('0x1f')],'include':_0x1a0e36[_0x0c83('0x20')]?_[_0x0c83('0x21')](_0x1a0e36[_0x0c83('0x20')],function(_0x422e3a){return{'model':db[_0x422e3a[_0x0c83('0x22')]],'as':_0x422e3a['as'],'attributes':_0x422e3a['attributes'],'include':_0x422e3a[_0x0c83('0x20')]?_[_0x0c83('0x21')](_0x422e3a['include'],function(_0x51e994){return{'model':db[_0x51e994['model']],'as':_0x51e994['as'],'attributes':_0x51e994[_0x0c83('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0c83('0x11')](function(_0x5c5fdc){logger[_0x0c83('0x12')]('ShowWhatsappAccount',_0x28b376);logger[_0x0c83('0x23')]('ShowWhatsappAccount',_0x28b376,JSON[_0x0c83('0x24')](_0x5c5fdc));_0x8f139c(_0x5c5fdc);})[_0x0c83('0x25')](function(_0x53974e){logger[_0x0c83('0x16')](_0x0c83('0x26'),_0x53974e['message'],_0x28b376);_0x2c25f8(_0x5f206a[_0x0c83('0x16')](0x1f4,_0x53974e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index d9ead80..3b8f312 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 _0x2196=['save','remove','update','emit','removeListener','register','length','./whatsappAccount.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2196,0xb7));var _0x6219=function(_0x52c8e1,_0x596b96){_0x52c8e1=_0x52c8e1-0x0;var _0x4d3a7f=_0x2196[_0x52c8e1];return _0x4d3a7f;};'use strict';var WhatsappAccountEvents=require(_0x6219('0x0'));var events=[_0x6219('0x1'),_0x6219('0x2'),_0x6219('0x3')];function createListener(_0xf3d61a,_0x2ee8fc){return function(_0x2db52c){_0x2ee8fc[_0x6219('0x4')](_0xf3d61a,_0x2db52c);};}function removeListener(_0x3e1253,_0xaf3d97){return function(){WhatsappAccountEvents[_0x6219('0x5')](_0x3e1253,_0xaf3d97);};}exports[_0x6219('0x6')]=function(_0x28291e){for(var _0x5ca123=0x0,_0x56e51c=events[_0x6219('0x7')];_0x5ca123<_0x56e51c;_0x5ca123++){var _0x34e648=events[_0x5ca123];var _0x2b12eb=createListener('whatsappAccount:'+_0x34e648,_0x28291e);WhatsappAccountEvents['on'](_0x34e648,_0x2b12eb);}}; \ No newline at end of file +var _0x3ffa=['update','removeListener','register','length','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ffa,0x12b));var _0xa3ff=function(_0x632945,_0x55dc2d){_0x632945=_0x632945-0x0;var _0xcbe1c5=_0x3ffa[_0x632945];return _0xcbe1c5;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xa3ff('0x0'),'remove',_0xa3ff('0x1')];function createListener(_0xc62924,_0x2e7f3d){return function(_0x35d48b){_0x2e7f3d['emit'](_0xc62924,_0x35d48b);};}function removeListener(_0x318f90,_0x251d04){return function(){WhatsappAccountEvents[_0xa3ff('0x2')](_0x318f90,_0x251d04);};}exports[_0xa3ff('0x3')]=function(_0x108182){for(var _0x5930ad=0x0,_0x57328c=events[_0xa3ff('0x4')];_0x5930ad<_0x57328c;_0x5930ad++){var _0x42a5f3=events[_0x5930ad];var _0x3d5f20=createListener('whatsappAccount:'+_0x42a5f3,_0x108182);WhatsappAccountEvents['on'](_0x42a5f3,_0x3d5f20);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 00a91ab..e96f179 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 _0xb3a7=['isAuthenticated','index','show','post','create','delete','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0x5c418a,_0x5392ac){var _0x20f968=function(_0x4891b9){while(--_0x4891b9){_0x5c418a['push'](_0x5c418a['shift']());}};_0x20f968(++_0x5392ac);}(_0xb3a7,0x1d1));var _0x7b3a=function(_0x3dee4d,_0x48f262){_0x3dee4d=_0x3dee4d-0x0;var _0x23c10d=_0xb3a7[_0x3dee4d];return _0x23c10d;};'use strict';var multer=require(_0x7b3a('0x0'));var util=require(_0x7b3a('0x1'));var path=require('path');var timeout=require(_0x7b3a('0x2'));var express=require(_0x7b3a('0x3'));var router=express['Router']();var fs_extra=require(_0x7b3a('0x4'));var auth=require(_0x7b3a('0x5'));var interaction=require(_0x7b3a('0x6'));var config=require(_0x7b3a('0x7'));var controller=require(_0x7b3a('0x8'));router[_0x7b3a('0x9')]('/',auth[_0x7b3a('0xa')](),controller[_0x7b3a('0xb')]);router['get']('/:id',auth[_0x7b3a('0xa')](),controller[_0x7b3a('0xc')]);router[_0x7b3a('0xd')]('/',auth[_0x7b3a('0xa')](),controller[_0x7b3a('0xe')]);router['put']('/:id',auth[_0x7b3a('0xa')](),controller['update']);router[_0x7b3a('0xf')](_0x7b3a('0x10'),auth['isAuthenticated'](),controller[_0x7b3a('0x11')]);module[_0x7b3a('0x12')]=router; \ No newline at end of file +var _0x3a07=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3a07,0x73));var _0x73a0=function(_0x583345,_0x36bd3b){_0x583345=_0x583345-0x0;var _0x45778d=_0x3a07[_0x583345];return _0x45778d;};'use strict';var multer=require(_0x73a0('0x0'));var util=require(_0x73a0('0x1'));var path=require(_0x73a0('0x2'));var timeout=require(_0x73a0('0x3'));var express=require(_0x73a0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x73a0('0x5'));var interaction=require(_0x73a0('0x6'));var config=require(_0x73a0('0x7'));var controller=require('./whatsappApplication.controller');router[_0x73a0('0x8')]('/',auth['isAuthenticated'](),controller[_0x73a0('0x9')]);router[_0x73a0('0x8')](_0x73a0('0xa'),auth[_0x73a0('0xb')](),controller[_0x73a0('0xc')]);router[_0x73a0('0xd')]('/',auth[_0x73a0('0xb')](),controller[_0x73a0('0xe')]);router[_0x73a0('0xf')](_0x73a0('0xa'),auth[_0x73a0('0xb')](),controller[_0x73a0('0x10')]);router[_0x73a0('0x11')](_0x73a0('0xa'),auth[_0x73a0('0xb')](),controller[_0x73a0('0x12')]);module[_0x73a0('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 68bb36a..675f174 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 _0xd98d=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x19babc,_0x15ee62){var _0x31ccc8=function(_0x3fc7cd){while(--_0x3fc7cd){_0x19babc['push'](_0x19babc['shift']());}};_0x31ccc8(++_0x15ee62);}(_0xd98d,0x123));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdd98('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdd98('0x1')],'allowNull':![],'defaultValue':_0xdd98('0x2')},'appdata':{'type':Sequelize[_0xdd98('0x3')]()},'description':{'type':Sequelize[_0xdd98('0x1')]},'interval':{'type':Sequelize[_0xdd98('0x1')],'defaultValue':_0xdd98('0x4')}}; \ No newline at end of file +var _0x18e7=['INTEGER','noop','STRING'];(function(_0x1c4394,_0x24b2c5){var _0x3d3eb5=function(_0x57941a){while(--_0x57941a){_0x1c4394['push'](_0x1c4394['shift']());}};_0x3d3eb5(++_0x24b2c5);}(_0x18e7,0x129));var _0x718e=function(_0x2fa3ac,_0x28eeba){_0x2fa3ac=_0x2fa3ac-0x0;var _0x39809e=_0x18e7[_0x2fa3ac];return _0x39809e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x718e('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x718e('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x718e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7783d00..62f616e 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 _0x6afc=['rows','show','params','rawAttributes','find','catch','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappApplication','type','key','query','intersection','model','attributes','fields','length','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x6afc,0x16b));var _0xc6af=function(_0x56ea6d,_0x5306ca){_0x56ea6d=_0x56ea6d-0x0;var _0x5f4239=_0x6afc[_0x56ea6d];return _0x5f4239;};'use strict';var emlformat=require(_0xc6af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6af('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc6af('0x2'));var moment=require(_0xc6af('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6af('0x4'));var util=require(_0xc6af('0x5'));var path=require(_0xc6af('0x6'));var sox=require(_0xc6af('0x7'));var csv=require('to-csv');var ejs=require(_0xc6af('0x8'));var fs=require('fs');var fs_extra=require(_0xc6af('0x9'));var _=require(_0xc6af('0xa'));var squel=require(_0xc6af('0xb'));var crypto=require(_0xc6af('0xc'));var jsforce=require(_0xc6af('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc6af('0xe'));var querystring=require(_0xc6af('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc6af('0x10'));var qs=require(_0xc6af('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6af('0x12'));var logger=require(_0xc6af('0x13'))(_0xc6af('0x14'));var utils=require('../../config/utils');var config=require(_0xc6af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6af('0x16'))['db'];function respondWithStatusCode(_0x73a18b,_0x249554){_0x249554=_0x249554||0xcc;return function(_0x34c2f8){if(_0x34c2f8){return _0x73a18b[_0xc6af('0x17')](_0x249554);}return _0x73a18b[_0xc6af('0x18')](_0x249554)[_0xc6af('0x19')]();};}function respondWithResult(_0x2c8d30,_0x48be31){_0x48be31=_0x48be31||0xc8;return function(_0xb2f967){if(_0xb2f967){return _0x2c8d30[_0xc6af('0x18')](_0x48be31)[_0xc6af('0x1a')](_0xb2f967);}};}function respondWithFilteredResult(_0x2ef663,_0x12087d){return function(_0x165fea){if(_0x165fea){var _0x2a4b88=typeof _0x12087d[_0xc6af('0x1b')]===_0xc6af('0x1c')&&typeof _0x12087d[_0xc6af('0x1d')]===_0xc6af('0x1c');var _0x22366d=_0x165fea[_0xc6af('0x1e')];var _0x5dde9d=_0x2a4b88?0x0:_0x12087d[_0xc6af('0x1b')];var _0x3d75b8=_0x2a4b88?_0x165fea['count']:_0x12087d[_0xc6af('0x1b')]+_0x12087d[_0xc6af('0x1d')];var _0x28f9a9;if(_0x3d75b8>=_0x22366d){_0x3d75b8=_0x22366d;_0x28f9a9=0xc8;}else{_0x28f9a9=0xce;}_0x2ef663['status'](_0x28f9a9);return _0x2ef663[_0xc6af('0x1f')]('Content-Range',_0x5dde9d+'-'+_0x3d75b8+'/'+_0x22366d)[_0xc6af('0x1a')](_0x165fea);}return null;};}function patchUpdates(_0x488ca4){return function(_0xdd5f5b){try{jsonpatch[_0xc6af('0x20')](_0xdd5f5b,_0x488ca4,!![]);}catch(_0x1085b2){return BPromise[_0xc6af('0x21')](_0x1085b2);}return _0xdd5f5b[_0xc6af('0x22')]();};}function saveUpdates(_0x1e1ae,_0x85cc2c){return function(_0x1e0e37){if(_0x1e0e37){return _0x1e0e37[_0xc6af('0x23')](_0x1e1ae)[_0xc6af('0x24')](function(_0x3438aa){return _0x3438aa;});}return null;};}function removeEntity(_0x4bf7bf,_0x128933){return function(_0x4b1b68){if(_0x4b1b68){return _0x4b1b68[_0xc6af('0x25')]()[_0xc6af('0x24')](function(){_0x4bf7bf[_0xc6af('0x18')](0xcc)[_0xc6af('0x19')]();});}};}function handleEntityNotFound(_0x2f24c0,_0x5c844a){return function(_0x430795){if(!_0x430795){_0x2f24c0[_0xc6af('0x17')](0x194);}return _0x430795;};}function handleError(_0x35bb97,_0x38d134){_0x38d134=_0x38d134||0x1f4;return function(_0x4f931c){logger[_0xc6af('0x26')](_0x4f931c['stack']);if(_0x4f931c[_0xc6af('0x27')]){delete _0x4f931c[_0xc6af('0x27')];}_0x35bb97[_0xc6af('0x18')](_0x38d134)[_0xc6af('0x28')](_0x4f931c);};}exports[_0xc6af('0x29')]=function(_0x16c169,_0x4b98c8){var _0x1eabaa={},_0xf09541={},_0x173abf={'count':0x0,'rows':[]};var _0x165b64=_[_0xc6af('0x2a')](db[_0xc6af('0x2b')]['rawAttributes'],function(_0x3d8f1d){return{'name':_0x3d8f1d['fieldName'],'type':_0x3d8f1d[_0xc6af('0x2c')][_0xc6af('0x2d')]};});_0xf09541['model']=_[_0xc6af('0x2a')](_0x165b64,_0xc6af('0x27'));_0xf09541[_0xc6af('0x2e')]=_['keys'](_0x16c169[_0xc6af('0x2e')]);_0xf09541['filters']=_[_0xc6af('0x2f')](_0xf09541[_0xc6af('0x30')],_0xf09541['query']);_0x1eabaa[_0xc6af('0x31')]=_[_0xc6af('0x2f')](_0xf09541[_0xc6af('0x30')],qs['fields'](_0x16c169[_0xc6af('0x2e')][_0xc6af('0x32')]));_0x1eabaa['attributes']=_0x1eabaa[_0xc6af('0x31')][_0xc6af('0x33')]?_0x1eabaa[_0xc6af('0x31')]:_0xf09541[_0xc6af('0x30')];if(!_0x16c169[_0xc6af('0x2e')]['hasOwnProperty'](_0xc6af('0x34'))){_0x1eabaa['limit']=qs[_0xc6af('0x1d')](_0x16c169[_0xc6af('0x2e')][_0xc6af('0x1d')]);_0x1eabaa[_0xc6af('0x1b')]=qs[_0xc6af('0x1b')](_0x16c169['query'][_0xc6af('0x1b')]);}_0x1eabaa['order']=qs[_0xc6af('0x35')](_0x16c169[_0xc6af('0x2e')][_0xc6af('0x35')]);_0x1eabaa['where']=qs[_0xc6af('0x36')](_['pick'](_0x16c169[_0xc6af('0x2e')],_0xf09541['filters']),_0x165b64);if(_0x16c169[_0xc6af('0x2e')][_0xc6af('0x37')]){_0x1eabaa[_0xc6af('0x38')]=_['merge'](_0x1eabaa[_0xc6af('0x38')],{'$or':_[_0xc6af('0x2a')](_0x165b64,function(_0xf683ee){if(_0xf683ee[_0xc6af('0x2c')]!==_0xc6af('0x39')){var _0x257fd4={};_0x257fd4[_0xf683ee[_0xc6af('0x27')]]={'$like':'%'+_0x16c169[_0xc6af('0x2e')][_0xc6af('0x37')]+'%'};return _0x257fd4;}})});}_0x1eabaa=_[_0xc6af('0x3a')]({},_0x1eabaa,_0x16c169[_0xc6af('0x3b')]);var _0xf6098f={'where':_0x1eabaa[_0xc6af('0x38')]};return db[_0xc6af('0x2b')]['count'](_0xf6098f)[_0xc6af('0x24')](function(_0x51d257){_0x173abf[_0xc6af('0x1e')]=_0x51d257;if(_0x16c169[_0xc6af('0x2e')][_0xc6af('0x3c')]){_0x1eabaa[_0xc6af('0x3d')]=[{'all':!![]}];}return db[_0xc6af('0x2b')][_0xc6af('0x3e')](_0x1eabaa);})[_0xc6af('0x24')](function(_0x143e39){_0x173abf[_0xc6af('0x3f')]=_0x143e39;return _0x173abf;})[_0xc6af('0x24')](respondWithFilteredResult(_0x4b98c8,_0x1eabaa))['catch'](handleError(_0x4b98c8,null));};exports[_0xc6af('0x40')]=function(_0x1057ce,_0x46897d){var _0x365b48={'raw':!![],'where':{'id':_0x1057ce[_0xc6af('0x41')]['id']}},_0xcac00f={};_0xcac00f[_0xc6af('0x30')]=_['keys'](db['WhatsappApplication'][_0xc6af('0x42')]);_0xcac00f[_0xc6af('0x2e')]=_['keys'](_0x1057ce[_0xc6af('0x2e')]);_0xcac00f[_0xc6af('0x36')]=_['intersection'](_0xcac00f[_0xc6af('0x30')],_0xcac00f[_0xc6af('0x2e')]);_0x365b48[_0xc6af('0x31')]=_['intersection'](_0xcac00f['model'],qs['fields'](_0x1057ce['query'][_0xc6af('0x32')]));_0x365b48[_0xc6af('0x31')]=_0x365b48[_0xc6af('0x31')]['length']?_0x365b48[_0xc6af('0x31')]:_0xcac00f[_0xc6af('0x30')];if(_0x1057ce[_0xc6af('0x2e')][_0xc6af('0x3c')]){_0x365b48['include']=[{'all':!![]}];}_0x365b48=_['merge']({},_0x365b48,_0x1057ce['options']);return db[_0xc6af('0x2b')][_0xc6af('0x43')](_0x365b48)[_0xc6af('0x24')](handleEntityNotFound(_0x46897d,null))[_0xc6af('0x24')](respondWithResult(_0x46897d,null))[_0xc6af('0x44')](handleError(_0x46897d,null));};exports[_0xc6af('0x45')]=function(_0x15ffb2,_0x251311){return db['WhatsappApplication'][_0xc6af('0x45')](_0x15ffb2[_0xc6af('0x46')],{})['then'](respondWithResult(_0x251311,0xc9))[_0xc6af('0x44')](handleError(_0x251311,null));};exports[_0xc6af('0x23')]=function(_0x1696b3,_0x50c1b0){if(_0x1696b3[_0xc6af('0x46')]['id']){delete _0x1696b3['body']['id'];}return db[_0xc6af('0x2b')][_0xc6af('0x43')]({'where':{'id':_0x1696b3[_0xc6af('0x41')]['id']}})[_0xc6af('0x24')](handleEntityNotFound(_0x50c1b0,null))[_0xc6af('0x24')](saveUpdates(_0x1696b3[_0xc6af('0x46')],null))[_0xc6af('0x24')](respondWithResult(_0x50c1b0,null))[_0xc6af('0x44')](handleError(_0x50c1b0,null));};exports[_0xc6af('0x25')]=function(_0x47e83c,_0xc2219f){return db[_0xc6af('0x2b')][_0xc6af('0x43')]({'where':{'id':_0x47e83c[_0xc6af('0x41')]['id']}})['then'](handleEntityNotFound(_0xc2219f,null))[_0xc6af('0x24')](removeEntity(_0xc2219f,null))[_0xc6af('0x44')](handleError(_0xc2219f,null));}; \ No newline at end of file +var _0x627e=['status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','name','index','WhatsappApplication','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x276cce,_0x51d2f6){var _0x2a3894=function(_0x5248a1){while(--_0x5248a1){_0x276cce['push'](_0x276cce['shift']());}};_0x2a3894(++_0x51d2f6);}(_0x627e,0x14a));var _0xe627=function(_0x384de6,_0x3ea2f5){_0x384de6=_0x384de6-0x0;var _0x1b6d98=_0x627e[_0x384de6];return _0x1b6d98;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['WhatsappApplication']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2a55aa7..e6be92a 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 _0xd2bb=['util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xfd08e7,_0x57ccc3){var _0xa187cf=function(_0x4f3292){while(--_0x4f3292){_0xfd08e7['push'](_0xfd08e7['shift']());}};_0xa187cf(++_0x57ccc3);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x5cebf2,_0x18288d){_0x5cebf2=_0x5cebf2-0x0;var _0x1cdf42=_0xd2bb[_0x5cebf2];return _0x1cdf42;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd2b('0xc'),'collate':_0xbd2b('0xd')});}; \ No newline at end of file +var _0x689c=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x689c,0x9e));var _0xc689=function(_0x1a6aa9,_0x228c72){_0x1a6aa9=_0x1a6aa9-0x0;var _0x28a465=_0x689c[_0x1a6aa9];return _0x28a465;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc689('0x0'))(_0xc689('0x1'));var moment=require(_0xc689('0x2'));var BPromise=require(_0xc689('0x3'));var rp=require(_0xc689('0x4'));var fs=require('fs');var path=require(_0xc689('0x5'));var rimraf=require('rimraf');var config=require(_0xc689('0x6'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x3a4916,_0x28ce4c){return _0x3a4916[_0xc689('0x7')](_0xc689('0x8'),attributes,{'tableName':_0xc689('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc689('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index bfc11e3..ee78038 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x19cb0c,_0x5bd971){var _0x5d6a46=function(_0x3060ad){while(--_0x3060ad){_0x19cb0c['push'](_0x19cb0c['shift']());}};_0x5d6a46(++_0x5bd971);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x00bb[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x824143,_0x550e49){var _0x4c4a00=function(_0x4663c4){while(--_0x4663c4){_0x824143['push'](_0x824143['shift']());}};_0x4c4a00(++_0x550e49);}(_0xac9d,0x14d));var _0xdac9=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0xac9d[_0xaf025d];return _0x1c77cb;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6692dff..4b88727 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 _0x4c60=['update','delete','destroy','/:id/tags','multer','util','path','connect-timeout','Router','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0xc4c142,_0x392430){var _0x2c825e=function(_0xa91e6){while(--_0xa91e6){_0xc4c142['push'](_0xc4c142['shift']());}};_0x2c825e(++_0x392430);}(_0x4c60,0xc1));var _0x04c6=function(_0xe29be0,_0x21d5f8){_0xe29be0=_0xe29be0-0x0;var _0xf3214d=_0x4c60[_0xe29be0];return _0xf3214d;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['get'](_0x04c6('0xd'),auth[_0x04c6('0x7')](),controller['download']);router[_0x04c6('0xe')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0xf')]);router[_0x04c6('0xe')]('/:id/messages',auth[_0x04c6('0x7')](),controller[_0x04c6('0x10')]);router[_0x04c6('0xe')]('/:id/tags',auth[_0x04c6('0x7')](),interaction[_0x04c6('0x11')](_0x04c6('0x12'),_0x04c6('0x13')),controller[_0x04c6('0x14')]);router[_0x04c6('0x15')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),interaction['tracked'](_0x04c6('0x12'),_0x04c6('0x16')),controller[_0x04c6('0x17')]);router[_0x04c6('0x18')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),interaction[_0x04c6('0x11')](_0x04c6('0x12'),'whatsappinteraction:destroy'),controller[_0x04c6('0x19')]);router[_0x04c6('0x18')](_0x04c6('0x1a'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x53ec=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','create','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','removeTags','exports','multer'];(function(_0x3bf5c5,_0x5006d2){var _0x1bd3e0=function(_0x22c2f){while(--_0x22c2f){_0x3bf5c5['push'](_0x3bf5c5['shift']());}};_0x1bd3e0(++_0x5006d2);}(_0x53ec,0x192));var _0xc53e=function(_0x203a81,_0x37aefa){_0x203a81=_0x203a81-0x0;var _0x5b45f8=_0x53ec[_0x203a81];return _0x5b45f8;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/download',auth[_0xc53e('0x9')](),controller['download']);router['post']('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x11')]);router[_0xc53e('0x12')](_0xc53e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0xc53e('0x12')](_0xc53e('0x13'),auth[_0xc53e('0x9')](),interaction[_0xc53e('0x14')](_0xc53e('0x15'),_0xc53e('0x16')),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),interaction['tracked'](_0xc53e('0x15'),_0xc53e('0x19')),controller[_0xc53e('0x1a')]);router[_0xc53e('0x1b')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),interaction[_0xc53e('0x14')](_0xc53e('0x15'),_0xc53e('0x1c')),controller['destroy']);router['delete'](_0xc53e('0x13'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1d')]);module[_0xc53e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index ec4027f..37d9d96 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 _0x0619=['sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x36bf46,_0x3d8db9){var _0x1d0a72=function(_0x328e8d){while(--_0x328e8d){_0x36bf46['push'](_0x36bf46['shift']());}};_0x1d0a72(++_0x3d8db9);}(_0x0619,0x90));var _0x9061=function(_0x574f7c,_0x9292dd){_0x574f7c=_0x574f7c-0x0;var _0x2ac0eb=_0x0619[_0x574f7c];return _0x2ac0eb;};'use strict';var Sequelize=require(_0x9061('0x0'));var moment=require(_0x9061('0x1'));module[_0x9061('0x2')]={'closed':{'type':Sequelize[_0x9061('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9061('0x4')]},'secondDisposition':{'type':Sequelize[_0x9061('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9061('0x4')]},'note':{'type':Sequelize[_0x9061('0x4')]},'phone':{'type':Sequelize[_0x9061('0x4')]},'read1stAt':{'type':Sequelize[_0x9061('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x9061('0x6')]('in',_0x9061('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9061('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x9061('0x6')]('in',_0x9061('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5162=['BOOLEAN','sequelize','STRING','DATE','ENUM','out'];(function(_0x353150,_0x1ab0ef){var _0x3dc923=function(_0xd33b75){while(--_0xd33b75){_0x353150['push'](_0x353150['shift']());}};_0x3dc923(++_0x1ab0ef);}(_0x5162,0x103));var _0x2516=function(_0x49ccaa,_0x5944f2){_0x49ccaa=_0x49ccaa-0x0;var _0x2c1ae1=_0x5162[_0x49ccaa];return _0x2c1ae1;};'use strict';var Sequelize=require(_0x2516('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2516('0x1')]},'secondDisposition':{'type':Sequelize[_0x2516('0x1')]},'thirdDisposition':{'type':Sequelize[_0x2516('0x1')]},'note':{'type':Sequelize[_0x2516('0x1')]},'phone':{'type':Sequelize[_0x2516('0x1')]},'read1stAt':{'type':Sequelize[_0x2516('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x2516('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2516('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2516('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 1f371f6..f3ca904 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 _0x3de0=['QueryTypes','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','sequelize','toString','keyBy','merge','WhatsappInteraction','a.key','Account.key','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','rawAttributes','options','create','params','destroy','describe','addMessage','WhatsappMessage','ids','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','read','Account','Owner','fullname','get','Whatsapp','closed','existsSync','createReadStream','pipe','createWriteStream','out','basename','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','stack','name','Users','map','TagIds','split','Tags','push','catch','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','tools_tags','expr','search','conditions','find','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','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','body','start','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize'];(function(_0x4f3242,_0x391954){var _0x49844f=function(_0x5ee033){while(--_0x5ee033){_0x4f3242['push'](_0x4f3242['shift']());}};_0x49844f(++_0x391954);}(_0x3de0,0x143));var _0x03de=function(_0x36f957,_0x2eadf7){_0x36f957=_0x36f957-0x0;var _0x266b0c=_0x3de0[_0x36f957];return _0x266b0c;};'use strict';var emlformat=require(_0x03de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03de('0x1'));var jsonpatch=require(_0x03de('0x2'));var rp=require('request-promise');var moment=require(_0x03de('0x3'));var BPromise=require(_0x03de('0x4'));var Mustache=require('mustache');var util=require(_0x03de('0x5'));var path=require(_0x03de('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x03de('0x7'));var fs=require('fs');var fs_extra=require(_0x03de('0x8'));var _=require(_0x03de('0x9'));var squel=require(_0x03de('0xa'));var crypto=require(_0x03de('0xb'));var jsforce=require(_0x03de('0xc'));var deskjs=require(_0x03de('0xd'));var toCsv=require(_0x03de('0xe'));var querystring=require('querystring');var Papa=require(_0x03de('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x03de('0x10'));var as=require(_0x03de('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x03de('0x12'));var logger=require(_0x03de('0x13'))('api');var utils=require(_0x03de('0x14'));var config=require(_0x03de('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x03de('0x16'))['db'];config[_0x03de('0x17')]=_[_0x03de('0x18')](config[_0x03de('0x17')],{'host':_0x03de('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03de('0x17')]));require(_0x03de('0x1a'))[_0x03de('0x1b')](socket);function respondWithStatusCode(_0x4064a8,_0x5dcade){_0x5dcade=_0x5dcade||0xcc;return function(_0x453564){if(_0x453564){return _0x4064a8[_0x03de('0x1c')](_0x5dcade);}return _0x4064a8[_0x03de('0x1d')](_0x5dcade)[_0x03de('0x1e')]();};}function respondWithResult(_0x45fe9e,_0x2828f0){_0x2828f0=_0x2828f0||0xc8;return function(_0x9285c0){if(_0x9285c0){return _0x45fe9e[_0x03de('0x1d')](_0x2828f0)[_0x03de('0x1f')](_0x9285c0);}};}function respondWithFilteredResult(_0x54556d,_0x4835c0){return function(_0x3e9198){if(_0x3e9198){var _0x42962e=typeof _0x4835c0[_0x03de('0x20')]==='undefined'&&typeof _0x4835c0[_0x03de('0x21')]===_0x03de('0x22');var _0x32cb0e=_0x3e9198[_0x03de('0x23')];var _0x148725=_0x42962e?0x0:_0x4835c0[_0x03de('0x20')];var _0x3cb6ff=_0x42962e?_0x3e9198['count']:_0x4835c0['offset']+_0x4835c0['limit'];var _0x29686b;if(_0x3cb6ff>=_0x32cb0e){_0x3cb6ff=_0x32cb0e;_0x29686b=0xc8;}else{_0x29686b=0xce;}_0x54556d[_0x03de('0x1d')](_0x29686b);return _0x54556d['set'](_0x03de('0x24'),_0x148725+'-'+_0x3cb6ff+'/'+_0x32cb0e)[_0x03de('0x1f')](_0x3e9198);}return null;};}function patchUpdates(_0xebbd43){return function(_0x4bc6c8){try{jsonpatch[_0x03de('0x25')](_0x4bc6c8,_0xebbd43,!![]);}catch(_0x396a57){return BPromise['reject'](_0x396a57);}return _0x4bc6c8[_0x03de('0x26')]();};}function saveUpdates(_0x37b44f,_0x8c74aa){return function(_0xf03160){if(_0xf03160){return _0xf03160[_0x03de('0x27')](_0x37b44f)['then'](function(_0xf54687){return _0xf54687;});}return null;};}function removeEntity(_0x13ab64,_0x20bea7){return function(_0x1ed415){if(_0x1ed415){return _0x1ed415['destroy']()[_0x03de('0x28')](function(){_0x13ab64[_0x03de('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c371f,_0xb3fed8){return function(_0x2147b3){if(!_0x2147b3){_0x5c371f['sendStatus'](0x194);}return _0x2147b3;};}function handleError(_0x5d4fea,_0x261b19){_0x261b19=_0x261b19||0x1f4;return function(_0x17463b){logger['error'](_0x17463b[_0x03de('0x29')]);if(_0x17463b[_0x03de('0x2a')]){delete _0x17463b[_0x03de('0x2a')];}_0x5d4fea[_0x03de('0x1d')](_0x261b19)['send'](_0x17463b);};}function getInteractionUsers(_0x5bfae1,_0x191534){return new BPromise(function(_0xfe302d,_0x338ae1){try{if(_0x191534[_0x5bfae1['id']]){_0x5bfae1[_0x03de('0x2b')]=_[_0x03de('0x2c')](_0x191534[_0x5bfae1['id']],function(_0x7d35de){return{'id':_0x7d35de['id'],'fullname':_0x7d35de['fullname']};});}}catch(_0x2b4fea){_0x338ae1(_0x2b4fea);}_0xfe302d(_0x5bfae1);});}function getInteractionTags(_0x11289f,_0xab59a2){return new BPromise(function(_0x4399ed,_0x424262){try{if(_0x11289f[_0x03de('0x2d')]){_0x11289f['Tags']=[];_0x11289f[_0x03de('0x2d')][_0x03de('0x2e')](',')['forEach'](function(_0x422076){_0x11289f[_0x03de('0x2f')][_0x03de('0x30')](_0xab59a2[_0x422076]);});}delete _0x11289f[_0x03de('0x2d')];}catch(_0x4a1819){_0x424262(_0x4a1819);}_0x4399ed(_0x11289f);});}function updateWhatsappInteraction(_0x40a6dc,_0x2971a0,_0x38d968){return new BPromise(function(_0x147ac6,_0x54b182){return getInteractionUsers(_0x40a6dc,_0x38d968)[_0x03de('0x28')](function(_0xcaf5cf){return getInteractionTags(_0xcaf5cf,_0x2971a0);})[_0x03de('0x28')](function(_0x4930a6){_0x147ac6(_0x4930a6);})[_0x03de('0x31')](function(_0x39fa92){_0x54b182(_0x39fa92);});});}exports[_0x03de('0x32')]=function(_0x1c96a7,_0x46aa12){var _0x6290da={},_0xdb21c3={},_0x5bc7dd={'count':0x0,'rows':[]};var _0x10d0c8=_[_0x03de('0x2c')](db['WhatsappInteraction']['rawAttributes'],function(_0x2c13e9){return{'name':_0x2c13e9[_0x03de('0x33')],'type':_0x2c13e9[_0x03de('0x34')][_0x03de('0x35')]};});_0xdb21c3[_0x03de('0x36')]=_[_0x03de('0x2c')](_0x10d0c8,_0x03de('0x2a'));_0xdb21c3[_0x03de('0x37')]=_[_0x03de('0x38')](_0x1c96a7[_0x03de('0x37')]);_0xdb21c3[_0x03de('0x39')]=_[_0x03de('0x3a')](_0xdb21c3[_0x03de('0x36')],_0xdb21c3[_0x03de('0x37')]);_0x6290da[_0x03de('0x3b')]=_[_0x03de('0x3a')](_0xdb21c3[_0x03de('0x36')],qs[_0x03de('0x3c')](_0x1c96a7[_0x03de('0x37')][_0x03de('0x3c')]));_0x6290da['attributes']=_0x6290da[_0x03de('0x3b')][_0x03de('0x3d')]?_0x6290da['attributes']:_0xdb21c3[_0x03de('0x36')];if(!_0x1c96a7[_0x03de('0x37')][_0x03de('0x3e')](_0x03de('0x3f'))){_0x6290da[_0x03de('0x21')]=qs[_0x03de('0x21')](_0x1c96a7[_0x03de('0x37')][_0x03de('0x21')]);_0x6290da['offset']=qs[_0x03de('0x20')](_0x1c96a7[_0x03de('0x37')][_0x03de('0x20')]);}_0x6290da[_0x03de('0x40')]=qs[_0x03de('0x41')](_0x1c96a7[_0x03de('0x37')][_0x03de('0x41')]);_0x6290da[_0x03de('0x42')]=qs['filters'](_[_0x03de('0x43')](_0x1c96a7['query'],_0xdb21c3['filters']),_0x10d0c8);var _0x1e850a=[];var _0x447b23=squel[_0x03de('0x44')]()['field']('id')['field'](_0x03de('0x2a'))[_0x03de('0x45')](_0x03de('0x46'))[_0x03de('0x47')]('tools_tags');var _0x99b1a1=squel['select']()[_0x03de('0x45')](_0x03de('0x48'))[_0x03de('0x45')](_0x03de('0x49'))[_0x03de('0x45')](_0x03de('0x4a'))['from'](_0x03de('0x4b'),'ui')['left_join'](_0x03de('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x13d15c=squel[_0x03de('0x44')]()[_0x03de('0x47')]('whatsapp_interactions','i')['left_join'](_0x03de('0x4d'),'c',_0x03de('0x4e'))[_0x03de('0x4f')](_0x03de('0x4c'),'o',_0x03de('0x50'))[_0x03de('0x4f')](_0x03de('0x51'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x03de('0x4f')](_0x03de('0x52'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x03de('0x4f')](_0x03de('0x53'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x03de('0x4f')](_0x03de('0x54'),'t','t.id\x20=\x20it.TagId');var _0x2eef5b=squel['expr']();var _0x4b29b0=[];var _0x3f00b1=squel[_0x03de('0x55')]();var _0x2434bd;if(_0x1c96a7[_0x03de('0x37')][_0x03de('0x56')]){_0x2434bd=as['parseSearch'](_0x1c96a7['query'][_0x03de('0x56')]);var _0x536a9d=_0x2434bd['sqlOperator'];for(var _0x154cc6=0x0;_0x154cc6<_0x2434bd['conditions'][_0x03de('0x3d')];_0x154cc6++){var _0x237d50=_0x2434bd[_0x03de('0x57')][_0x154cc6];var _0x5c0a29='i';var _0x24edb2=_[_0x03de('0x58')](_0x10d0c8,['name',_0x237d50[_0x03de('0x45')]]);if(!_0x24edb2){switch(_0x237d50[_0x03de('0x45')]){case'unreadMessages':if(_0x237d50[_0x03de('0x59')]==0x1){_0x13d15c['having']('`'+_0x237d50[_0x03de('0x45')]+_0x03de('0x5a'));}else{_0x13d15c[_0x03de('0x5b')]('`'+_0x237d50[_0x03de('0x45')]+_0x03de('0x5c'));}break;case _0x03de('0x5d'):if(_0x237d50[_0x03de('0x5e')]===_0x03de('0x5f')){if(_0x237d50['value']['split']('\x20')[_0x03de('0x3d')]>0x1){_0x2eef5b[_0x536a9d](_0x03de('0x60'),qs[_0x03de('0x61')](_0x237d50['value']),null);}else{var _0x2dfed6='%'+_0x237d50[_0x03de('0x59')]+'%';_0x2eef5b[_0x536a9d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2dfed6,_0x2dfed6,_0x2dfed6);}}else{_0x24edb2=_['find'](_0x10d0c8,[_0x03de('0x2a'),'ContactId']);_0x237d50[_0x03de('0x45')]=_0x03de('0x62');_0x349fa1=as[_0x03de('0x63')](_0x5c0a29,_0x24edb2['type'],_0x237d50);_0x2eef5b[_0x536a9d](_0x349fa1[_0x03de('0x64')],_0x349fa1[_0x03de('0x59')]['start'],_0x349fa1[_0x03de('0x59')][_0x03de('0x1e')]);}break;case _0x03de('0x65'):var _0x58465e=_0x237d50[_0x03de('0x59')]['split'](',')[_0x03de('0x2c')](function(_0x2b2f42){return Number(_0x2b2f42);});_0x58465e[_0x03de('0x66')](function(_0x3d2274){_0x3f00b1['or'](_0x03de('0x67'),'%,'+_0x3d2274+',%');});_0x4b29b0=_['union'](_0x4b29b0,_0x58465e);break;case _0x03de('0x68'):if(_0x237d50['operator']===_0x03de('0x5f')){_0x2eef5b[_0x536a9d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x237d50[_0x03de('0x59')]+'%',null);}else{_0x24edb2=_['find'](_0x10d0c8,[_0x03de('0x2a'),_0x03de('0x69')]);_0x237d50[_0x03de('0x45')]='UserId';_0x349fa1=as[_0x03de('0x63')](_0x5c0a29,_0x24edb2[_0x03de('0x34')],_0x237d50);_0x2eef5b[_0x536a9d](_0x349fa1['text'],_0x349fa1[_0x03de('0x59')]['start'],_0x349fa1[_0x03de('0x59')][_0x03de('0x1e')]);}break;case _0x03de('0x6a'):_0x349fa1=as['buildExpression']('me',null,_0x237d50);_0x2eef5b[_0x536a9d](_0x349fa1['text'],_0x349fa1[_0x03de('0x59')][_0x03de('0x6b')],_0x349fa1[_0x03de('0x59')][_0x03de('0x1e')]);break;}}else{var _0x349fa1=as[_0x03de('0x63')](_0x5c0a29,_0x24edb2[_0x03de('0x34')],_0x237d50);_0x2eef5b[_0x536a9d](_0x349fa1[_0x03de('0x64')],_0x349fa1['value']['start'],_0x349fa1[_0x03de('0x59')][_0x03de('0x1e')]);}}}else{var _0x59d80d=_(_0x1c96a7[_0x03de('0x37')])[_0x03de('0x38')]()[_0x03de('0x2c')](function(_0x480890){return _[_0x03de('0x6c')](_0x10d0c8,[_0x03de('0x2a'),_0x480890])?_0x480890:undefined;})[_0x03de('0x6d')]()['value']();if(!_[_0x03de('0x6e')](_0x59d80d)){_0x59d80d[_0x03de('0x66')](function(_0x462970){if(_0x462970===_0x03de('0x6f')){_0x13d15c[_0x03de('0x42')]('i.WhatsappAccountId\x20IN\x20?',[][_0x03de('0x70')](_0x1c96a7[_0x03de('0x37')][_0x462970]));}else if(_0x462970===_0x03de('0x71')){var _0x2520fb=JSON['parse'](_0x1c96a7['query'][_0x462970])['$gte'];var _0x1735db=JSON['parse'](_0x1c96a7[_0x03de('0x37')][_0x462970])[_0x03de('0x72')];_0x13d15c[_0x03de('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2520fb,_0x1735db);}else{if(_0x1c96a7[_0x03de('0x37')][_0x462970]===_0x03de('0x73')){_0x13d15c[_0x03de('0x42')]('i.'+_0x462970+_0x03de('0x74'));}else{_0x13d15c['where']('i.'+_0x462970+_0x03de('0x75'),_0x1c96a7[_0x03de('0x37')][_0x462970]);}}});}if(_0x1c96a7['query']['read']){if(_0x1c96a7['query']['read']==0x1){_0x13d15c[_0x03de('0x5b')](_0x03de('0x76'));}else{_0x13d15c['having'](_0x03de('0x77'));}}if(_0x1c96a7[_0x03de('0x37')]['tag']){_0x4b29b0=_[_0x03de('0x78')](_0x1c96a7[_0x03de('0x37')]['tag'])?_0x1c96a7['query'][_0x03de('0x79')]:new Array(_0x1c96a7[_0x03de('0x37')][_0x03de('0x79')]);_0x4b29b0['forEach'](function(_0x4bcb3b){_0x3f00b1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4bcb3b+',%');});}if(_0x1c96a7[_0x03de('0x37')][_0x03de('0x7a')]){var _0x1ad5db=_0x1c96a7[_0x03de('0x37')][_0x03de('0x7a')][_0x03de('0x7b')]('\x5c','\x5c\x5c')[_0x03de('0x7b')](/'/g,'\x27\x27');if(qs[_0x03de('0x7c')](_0x1ad5db)){_0x2eef5b['or']('i.id\x20LIKE\x20?',_0x1ad5db+'%')['or'](_0x03de('0x7d'),_0x1ad5db+'%');}else{_0x2eef5b['or'](_0x03de('0x7e'),qs[_0x03de('0x61')](_0x1ad5db))['or'](_0x03de('0x7f'),_0x1ad5db+'%');}}}_0x13d15c[_0x03de('0x42')](_0x2eef5b);_0x13d15c[_0x03de('0x80')](_0x03de('0x81'));var _0x3d0968={'type':db[_0x03de('0x82')][_0x03de('0x83')]['SELECT'],'raw':!![]};var _0x143be2=_0x13d15c['clone']();_0x143be2[_0x03de('0x45')](_0x03de('0x81'));_0x143be2[_0x03de('0x45')](_0x03de('0x84'),'unreadMessages');if(_0x6290da[_0x03de('0x40')]){_0x6290da['order'][_0x03de('0x66')](function(_0x328412){var _0x323d24=_0x328412[0x0]===_0x03de('0x85')?_0x328412[0x0]:'i.'+_0x328412[0x0];_0x13d15c[_0x03de('0x40')](_0x323d24,_0x328412[0x1]===_0x03de('0x86')?![]:!![]);});}if(!_[_0x03de('0x6e')](_0x4b29b0)){_0x13d15c[_0x03de('0x5b')](_0x3f00b1);_0x143be2['where'](_0x03de('0x87'),_0x4b29b0);}BPromise[_0x03de('0x88')]()[_0x03de('0x28')](function(){if(!_0x2434bd){if(_0x1c96a7['query'][_0x03de('0x6f')])return;_0x143be2[_0x03de('0x42')](_0x03de('0x89'));_0x13d15c['where'](_0x03de('0x89'));return;}if(_0x1c96a7[_0x03de('0x8a')][_0x03de('0x8b')]!==_0x03de('0x8c'))return;return _0x1c96a7[_0x03de('0x8a')][_0x03de('0x8d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x30daf8){if(_['isEmpty'](_0x30daf8)){_0x143be2['where'](_0x03de('0x8e'));_0x13d15c[_0x03de('0x42')](_0x03de('0x8e'));}else{_0x143be2[_0x03de('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x03de('0x2c')](_0x30daf8,'id'));_0x13d15c['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x03de('0x2c')](_0x30daf8,'id'));}});})[_0x03de('0x28')](function(){if(_0x1c96a7[_0x03de('0x8a')][_0x03de('0x8b')]===_0x03de('0x8c')&&!_0x2434bd&&!_0x1c96a7[_0x03de('0x37')]['WhatsappAccountId'])return[];return db[_0x03de('0x8f')][_0x03de('0x37')](_0x143be2['toString'](),_0x3d0968);})['then'](function(_0x146eb3){_0x5bc7dd[_0x03de('0x23')]=_0x146eb3[_0x03de('0x3d')];if(_0x5bc7dd[_0x03de('0x23')]===0x0)return[];return db[_0x03de('0x8f')]['query'](_0x447b23[_0x03de('0x90')](),_0x3d0968)[_0x03de('0x28')](function(_0x292dee){_0x1e850a=_[_0x03de('0x91')](_0x292dee,'id');_0x3d0968=_[_0x03de('0x92')](_0x3d0968,{'model':db[_0x03de('0x93')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c96a7[_0x03de('0x37')][_0x03de('0x3c')]){_0x6290da[_0x03de('0x3b')][_0x03de('0x66')](function(_0x1c3184){_0x13d15c[_0x03de('0x45')]('i.'+_0x1c3184);});}else{_0x13d15c['field'](_0x03de('0x84'),'unreadMessages');_0x13d15c[_0x03de('0x45')](_0x03de('0x94'),_0x03de('0x95'));_0x13d15c[_0x03de('0x45')]('a.mandatoryDisposition',_0x03de('0x96'));_0x13d15c[_0x03de('0x45')]('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',_0x03de('0x85'));_0x13d15c[_0x03de('0x45')](_0x03de('0x97'));_0x13d15c[_0x03de('0x45')]('c.firstName','Contact.firstName');_0x13d15c['field'](_0x03de('0x98'),'Contact.lastName');_0x13d15c[_0x03de('0x45')](_0x03de('0x99'),'Contact.email');_0x13d15c[_0x03de('0x45')]('c.phone',_0x03de('0x9a'));_0x13d15c[_0x03de('0x45')](_0x03de('0x9b'),'Contact.mobile');_0x13d15c[_0x03de('0x45')](_0x03de('0x9c'),_0x03de('0x9d'));_0x13d15c[_0x03de('0x45')](_0x03de('0x9e'),_0x03de('0x9f'));_0x13d15c[_0x03de('0x45')](_0x03de('0xa0'),_0x03de('0xa1'));_0x13d15c[_0x03de('0x45')](_0x03de('0xa2'),'TagIds');}if(_0x6290da[_0x03de('0x21')])_0x13d15c[_0x03de('0x21')](_0x6290da[_0x03de('0x21')]);if(_0x6290da[_0x03de('0x20')])_0x13d15c['offset'](_0x6290da[_0x03de('0x20')]);return db[_0x03de('0x8f')][_0x03de('0x37')](_0x13d15c[_0x03de('0x90')](),_0x3d0968);})[_0x03de('0x28')](function(_0x4eeb0b){if(_0x4eeb0b[_0x03de('0x3d')]>0x0)_0x99b1a1[_0x03de('0x42')](_0x03de('0xa3'),_['map'](_0x4eeb0b,'id'));return db[_0x03de('0x8f')][_0x03de('0x37')](_0x99b1a1[_0x03de('0x90')](),_0x3d0968)['then'](function(_0x677818){var _0x439617=_[_0x03de('0xa4')](_0x677818,_0x03de('0xa5'));var _0x41ecf6=[];_0x4eeb0b[_0x03de('0x66')](function(_0x3baf68){_0x41ecf6[_0x03de('0x30')](updateWhatsappInteraction(_0x3baf68,_0x1e850a,_0x439617));});return BPromise[_0x03de('0xa6')](_0x41ecf6);});});})[_0x03de('0x28')](function(_0x1fb1c3){_0x5bc7dd[_0x03de('0xa7')]=_0x1fb1c3;return _0x5bc7dd;})[_0x03de('0x28')](respondWithFilteredResult(_0x46aa12,_0x6290da))[_0x03de('0x31')](handleError(_0x46aa12,null));};exports[_0x03de('0xa8')]=function(_0xfa03ad,_0x2171e4){var _0x47fdf8={'raw':![],'where':{'id':_0xfa03ad['params']['id']}},_0x1e847a={};_0x1e847a[_0x03de('0x36')]=_['keys'](db[_0x03de('0x93')][_0x03de('0xa9')]);_0x1e847a[_0x03de('0x37')]=_[_0x03de('0x38')](_0xfa03ad['query']);_0x1e847a[_0x03de('0x39')]=_['intersection'](_0x1e847a[_0x03de('0x36')],_0x1e847a['query']);_0x47fdf8['attributes']=_[_0x03de('0x3a')](_0x1e847a[_0x03de('0x36')],qs[_0x03de('0x3c')](_0xfa03ad['query'][_0x03de('0x3c')]));_0x47fdf8[_0x03de('0x3b')]=_0x47fdf8[_0x03de('0x3b')][_0x03de('0x3d')]?_0x47fdf8['attributes']:_0x1e847a['model'];if(_0xfa03ad[_0x03de('0x37')]['includeAll']){_0x47fdf8['include']=[{'all':!![]}];}_0x47fdf8=_[_0x03de('0x92')]({},_0x47fdf8,_0xfa03ad[_0x03de('0xaa')]);return db[_0x03de('0x93')]['find'](_0x47fdf8)[_0x03de('0x28')](handleEntityNotFound(_0x2171e4,null))[_0x03de('0x28')](respondWithResult(_0x2171e4,null))[_0x03de('0x31')](handleError(_0x2171e4,null));};exports[_0x03de('0xab')]=function(_0x475c57,_0x980882){return db['WhatsappInteraction'][_0x03de('0xab')](_0x475c57[_0x03de('0x6a')],{})[_0x03de('0x28')](respondWithResult(_0x980882,0xc9))['catch'](handleError(_0x980882,null));};exports[_0x03de('0x27')]=function(_0xe36ac8,_0x1734ab){if(_0xe36ac8[_0x03de('0x6a')]['id']){delete _0xe36ac8[_0x03de('0x6a')]['id'];}return db[_0x03de('0x93')]['find']({'where':{'id':_0xe36ac8[_0x03de('0xac')]['id']}})[_0x03de('0x28')](handleEntityNotFound(_0x1734ab,null))[_0x03de('0x28')](saveUpdates(_0xe36ac8[_0x03de('0x6a')],null))[_0x03de('0x28')](respondWithResult(_0x1734ab,null))[_0x03de('0x31')](handleError(_0x1734ab,null));};exports[_0x03de('0xad')]=function(_0x1b51de,_0x150031){return db[_0x03de('0x93')][_0x03de('0x58')]({'where':{'id':_0x1b51de[_0x03de('0xac')]['id']}})[_0x03de('0x28')](handleEntityNotFound(_0x150031,null))[_0x03de('0x28')](removeEntity(_0x150031,null))[_0x03de('0x31')](handleError(_0x150031,null));};exports[_0x03de('0xae')]=function(_0x22c201,_0x4760a4){return db[_0x03de('0x93')][_0x03de('0xae')]()[_0x03de('0x28')](respondWithResult(_0x4760a4,null))[_0x03de('0x31')](handleError(_0x4760a4,null));};exports[_0x03de('0xaf')]=function(_0x40fea2,_0x112a0a,_0x3256e8){return db[_0x03de('0xb0')]['find']({'where':{'id':_0x40fea2[_0x03de('0xac')]['id']}})[_0x03de('0x28')](handleEntityNotFound(_0x112a0a,null))[_0x03de('0x28')](function(_0x7d147c){if(_0x7d147c){return _0x7d147c[_0x03de('0xaf')](_0x40fea2[_0x03de('0x6a')][_0x03de('0xb1')],_['omit'](_0x40fea2[_0x03de('0x6a')],[_0x03de('0xb1'),'id'])||{});}})['then'](respondWithResult(_0x112a0a,null))[_0x03de('0x31')](handleError(_0x112a0a,null));};exports['getMessages']=function(_0x1e39e0,_0x2e51ba,_0x2b31f7){var _0x157dde={'raw':![],'where':{}};var _0x4ef9f9={};var _0x6412b7={'count':0x0,'rows':[]};return db[_0x03de('0x93')][_0x03de('0xb2')]({'where':{'id':_0x1e39e0['params']['id']}})[_0x03de('0x28')](handleEntityNotFound(_0x2e51ba,null))[_0x03de('0x28')](function(_0x1153dc){if(_0x1153dc){_0x4ef9f9[_0x03de('0x36')]=_[_0x03de('0x38')](db[_0x03de('0xb0')][_0x03de('0xa9')]);_0x4ef9f9[_0x03de('0x37')]=_[_0x03de('0x38')](_0x1e39e0[_0x03de('0x37')]);_0x4ef9f9[_0x03de('0x39')]=_[_0x03de('0x3a')](_0x4ef9f9['model'],_0x4ef9f9[_0x03de('0x37')]);_0x157dde[_0x03de('0x3b')]=_[_0x03de('0x3a')](_0x4ef9f9['model'],qs[_0x03de('0x3c')](_0x1e39e0[_0x03de('0x37')][_0x03de('0x3c')]));_0x157dde[_0x03de('0x3b')]=_0x157dde[_0x03de('0x3b')]['length']?_0x157dde[_0x03de('0x3b')]:_0x4ef9f9['model'];if(!_0x1e39e0['query'][_0x03de('0x3e')](_0x03de('0x3f'))){_0x157dde[_0x03de('0x21')]=qs[_0x03de('0x21')](_0x1e39e0[_0x03de('0x37')][_0x03de('0x21')]);_0x157dde[_0x03de('0x20')]=qs[_0x03de('0x20')](_0x1e39e0['query'][_0x03de('0x20')]);}_0x157dde[_0x03de('0x40')]=qs[_0x03de('0x41')](_0x1e39e0['query'][_0x03de('0x41')]);_0x157dde['where']=qs[_0x03de('0x39')](_[_0x03de('0x43')](_0x1e39e0[_0x03de('0x37')],_0x4ef9f9[_0x03de('0x39')]));_0x157dde[_0x03de('0x42')][_0x03de('0xa5')]=_0x1153dc['id'];if(_0x1e39e0[_0x03de('0x37')]['filter']){_0x157dde['where']=_[_0x03de('0x92')](_0x157dde[_0x03de('0x42')],{'$or':_[_0x03de('0x2c')](_0x157dde['attributes'],function(_0x3c7eb1){var _0x126e9f={};_0x126e9f[_0x3c7eb1]={'$like':'%'+_0x1e39e0[_0x03de('0x37')][_0x03de('0x7a')]+'%'};return _0x126e9f;})});}if(_0x1e39e0[_0x03de('0x37')][_0x03de('0xb3')]){var _0x171298=_0x1e39e0['query'][_0x03de('0xb3')][_0x03de('0x2e')](',');var _0xdb494={};_0xdb494[_0x171298[0x0]]={'$gte':moment(_0x171298[0x1])[_0x03de('0xb4')](_0x03de('0xb5'))};_0x157dde[_0x03de('0x42')]=_[_0x03de('0x92')](_0x157dde['where'],_0xdb494);}_0x157dde=_[_0x03de('0x92')]({},_0x157dde,_0x1e39e0[_0x03de('0xaa')]);return db['WhatsappMessage'][_0x03de('0x23')]({'where':_0x157dde['where']})[_0x03de('0x28')](function(_0x91b0b){_0x6412b7['count']=_0x91b0b;if(_0x1e39e0['query'][_0x03de('0xb6')]){_0x157dde[_0x03de('0xb7')]=[{'all':!![]}];}return db[_0x03de('0xb0')][_0x03de('0xb8')](_0x157dde);})['then'](function(_0x49ebbd){_0x6412b7[_0x03de('0xa7')]=_0x49ebbd;return _0x6412b7;});}})[_0x03de('0x28')](respondWithFilteredResult(_0x2e51ba,_0x157dde))[_0x03de('0x31')](handleError(_0x2e51ba,null));};exports[_0x03de('0xb9')]=function(_0x12cc15,_0x51cfe1,_0x447723){return db[_0x03de('0x93')]['find']({'where':{'id':_0x12cc15[_0x03de('0xac')]['id']}})[_0x03de('0x28')](handleEntityNotFound(_0x51cfe1,null))[_0x03de('0x28')](function(_0x4c8cab){if(_0x4c8cab){return _0x4c8cab['setTags'](_0x12cc15['body'][_0x03de('0xb1')],_[_0x03de('0xba')](_0x12cc15[_0x03de('0x6a')],[_0x03de('0xb1'),'id'])||{})[_0x03de('0xbb')](function(){return db[_0x03de('0x65')]['findAll']({'attributes':['id',_0x03de('0x2a'),_0x03de('0x46')],'where':{'id':_0x12cc15[_0x03de('0x6a')]['ids']}});})['then'](function(_0x497b1a){socket[_0x03de('0xbc')](_0x03de('0xbd'),{'id':Number(_0x12cc15[_0x03de('0xac')]['id']),'tags':_0x497b1a||[]});return{'id':Number(_0x12cc15[_0x03de('0xac')]['id']),'tags':_0x497b1a||[]};});}})['then'](respondWithResult(_0x51cfe1,null))[_0x03de('0x31')](handleError(_0x51cfe1,null));};exports[_0x03de('0xbe')]=function(_0x355d38,_0x123b9a,_0x252327){return db['WhatsappInteraction'][_0x03de('0x58')]({'where':{'id':_0x355d38[_0x03de('0xac')]['id']}})[_0x03de('0x28')](handleEntityNotFound(_0x123b9a,null))[_0x03de('0x28')](function(_0x3fa5a7){if(_0x3fa5a7){return _0x3fa5a7[_0x03de('0xbe')](_0x355d38[_0x03de('0x37')][_0x03de('0xb1')]);}})[_0x03de('0x28')](respondWithStatusCode(_0x123b9a,null))[_0x03de('0x31')](handleError(_0x123b9a,null));};exports[_0x03de('0xbf')]=function(_0x1ddf3a,_0x28793b){var _0x5c8429=moment()[_0x03de('0xc0')]()[_0x03de('0x90')]();var _0x2ba61d=path[_0x03de('0xc1')](config[_0x03de('0xc2')],'server',_0x03de('0xc3'),_0x03de('0xc4'));var _0x12f478=path[_0x03de('0xc1')](config[_0x03de('0xc2')],_0x03de('0xc5'),'files',_0x03de('0xc6'));var _0x777f48=path[_0x03de('0xc1')](_0x2ba61d,_0x5c8429);var _0x208ff6=util['format'](_0x03de('0xc7'),_0x1ddf3a['params']['id'],_0x5c8429);var _0x3a60c7=path[_0x03de('0xc1')](_0x2ba61d,_0x208ff6);var _0x26c5c7=[];_0x26c5c7[_0x03de('0x30')]({'model':db['User'],'as':_0x03de('0x68'),'attributes':['id','fullname'],'raw':!![]});_0x26c5c7['push']({'model':db[_0x03de('0xc8')],'as':_0x03de('0x5d'),'attributes':['id',_0x03de('0xc9'),_0x03de('0xca')],'raw':!![]});if(_0x1ddf3a[_0x03de('0x37')][_0x03de('0xc6')]){_0x26c5c7['push']({'model':db[_0x03de('0xcb')],'as':_0x03de('0xcb'),'raw':!![]});}var _0x2a5599=[{'model':db[_0x03de('0xb0')],'as':_0x03de('0xcc'),'attributes':['id',_0x03de('0x6a'),_0x03de('0x71'),_0x03de('0xcd'),_0x03de('0xce'),_0x03de('0xcf')],'include':_0x26c5c7}];_0x2a5599['push']({'model':db['WhatsappAccount'],'as':_0x03de('0xd0'),'attributes':['id',_0x03de('0x2a')]});_0x2a5599[_0x03de('0x30')]({'model':db[_0x03de('0x68')],'as':_0x03de('0xd1'),'attributes':['id',_0x03de('0xd2')]});return db[_0x03de('0x93')]['find']({'where':{'id':_0x1ddf3a['params']['id']},'include':_0x2a5599})[_0x03de('0x28')](handleEntityNotFound(_0x28793b,null))[_0x03de('0x28')](function(_0x4f65ec){if(_0x4f65ec){var _0xd33c04=_0x4f65ec[_0x03de('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x777f48);var _0x173f5b={'channel':_0x03de('0xd4'),'account':_0xd33c04['Account']['name'],'agent':_0xd33c04[_0x03de('0xd1')]?_0xd33c04[_0x03de('0xd1')]['fullname']:'N.A.','createdAt':moment(_0xd33c04['createdAt'])[_0x03de('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x03de('0x90')](),'closedAt':_0xd33c04[_0x03de('0xd5')]?moment(_0xd33c04['closedAt'])['format'](_0x03de('0xb5'))['toString']():'','disposition':_0xd33c04['disposition'],'messages':_(_0xd33c04[_0x03de('0xcc')])['filter']({'secret':![]})[_0x03de('0x2c')](function(_0x24fb0a){if(_0x24fb0a[_0x03de('0xcb')]){var _0x27927a=path[_0x03de('0xc1')](_0x12f478,_0x24fb0a[_0x03de('0xcb')]['basename']);if(fs[_0x03de('0xd6')](_0x27927a)){fs[_0x03de('0xd7')](_0x27927a)[_0x03de('0xd8')](fs[_0x03de('0xd9')](path[_0x03de('0xc1')](_0x777f48,_0x24fb0a['Attachment']['basename'])));}}return{'date':moment(_0x24fb0a[_0x03de('0x71')])[_0x03de('0xb4')](_0x03de('0xb5'))[_0x03de('0x90')](),'sender':_0x24fb0a[_0x03de('0xcd')]===_0x03de('0xda')?_0x24fb0a[_0x03de('0x68')]?_0x24fb0a[_0x03de('0x68')][_0x03de('0xd2')]:'System':_0x24fb0a[_0x03de('0x5d')][_0x03de('0xc9')]+(_0x24fb0a[_0x03de('0x5d')][_0x03de('0xca')]?'\x20'+_0x24fb0a[_0x03de('0x5d')][_0x03de('0xca')]:''),'body':_0x24fb0a[_0x03de('0xcb')]?_0x24fb0a[_0x03de('0xcb')][_0x03de('0xdb')]:_0x24fb0a[_0x03de('0x6a')],'direction':_0x24fb0a[_0x03de('0xcd')]===_0x03de('0xda')?'A':'C','secret':_0x24fb0a[_0x03de('0xce')],'read':_0x24fb0a[_0x03de('0xcf')],'attachment':_0x24fb0a[_0x03de('0xcb')]};})['value']()};return ejs[_0x03de('0xdc')](path[_0x03de('0xc1')](config[_0x03de('0xc2')],_0x03de('0xc5'),'views','downloadInteraction.ejs'),{'interaction':_0x173f5b})[_0x03de('0x28')](function(_0x475707){var _0x4a345b=path[_0x03de('0xc1')](_0x777f48,_0x03de('0xdd')+_0xd33c04['id']+'-'+_0x5c8429+_0x03de('0xde'));var _0x29fcec={'path':_0x4a345b,'channel':_0x03de('0xd4'),'interactionId':_0xd33c04['id']};return pdf[_0x03de('0xdf')](_0x475707,_0x29fcec);})[_0x03de('0x28')](function(){return new BPromise(function(_0xd51221,_0x5e1cd1){zipdir(_0x777f48,{'saveTo':_0x3a60c7},function(_0x3fa11a,_0x17203e){if(_0x3fa11a)return _0x5e1cd1(_0x3fa11a);return _0xd51221(_0x17203e);});})[_0x03de('0x28')](function(){return new BPromise(function(_0x44ffd6,_0x1e9a2d){rimraf(_0x777f48,function(_0x1841c4){if(_0x1841c4)_0x1e9a2d(_0x1841c4);return _0x44ffd6();});});})[_0x03de('0x28')](function(){return _0x28793b[_0x03de('0xbf')](_0x3a60c7,_0x208ff6,function(_0x5aa93c){if(_0x5aa93c){console[_0x03de('0xe0')](_0x03de('0xe1'),_0x5aa93c);}else{fs[_0x03de('0xe2')](_0x3a60c7);}});});});}else{return _0x28793b[_0x03de('0x1c')](0xc8);}})[_0x03de('0x31')](handleError(_0x28793b,null));}; \ No newline at end of file +var _0xf50b=['undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','field','color','from','select','u.id','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','length','conditions','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','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','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','WhatsappInteraction','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','contactName','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','options','catch','create','describe','addMessage','ids','omit','findOne','WhatsappMessage','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','basename','existsSync','createReadStream','pipe','out','renderFile','views','downloadInteraction.ejs','.pdf','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset'];(function(_0x43672a,_0x569b12){var _0x246d47=function(_0x3de4f3){while(--_0x3de4f3){_0x43672a['push'](_0x43672a['shift']());}};_0x246d47(++_0x569b12);}(_0xf50b,0xc8));var _0xbf50=function(_0x518025,_0x3076d9){_0x518025=_0x518025-0x0;var _0x5124a3=_0xf50b[_0x518025];return _0x5124a3;};'use strict';var emlformat=require(_0xbf50('0x0'));var rimraf=require(_0xbf50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf50('0x2'));var rp=require(_0xbf50('0x3'));var moment=require(_0xbf50('0x4'));var BPromise=require(_0xbf50('0x5'));var Mustache=require('mustache');var util=require(_0xbf50('0x6'));var path=require('path');var sox=require(_0xbf50('0x7'));var csv=require(_0xbf50('0x8'));var ejs=require(_0xbf50('0x9'));var fs=require('fs');var fs_extra=require(_0xbf50('0xa'));var _=require(_0xbf50('0xb'));var squel=require(_0xbf50('0xc'));var crypto=require(_0xbf50('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf50('0xe'));var toCsv=require(_0xbf50('0x8'));var querystring=require(_0xbf50('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbf50('0x10'));var qs=require(_0xbf50('0x11'));var as=require(_0xbf50('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xbf50('0x13'));var logger=require(_0xbf50('0x14'))(_0xbf50('0x15'));var utils=require(_0xbf50('0x16'));var config=require(_0xbf50('0x17'));var licenseUtil=require(_0xbf50('0x18'));var db=require(_0xbf50('0x19'))['db'];config['redis']=_[_0xbf50('0x1a')](config[_0xbf50('0x1b')],{'host':_0xbf50('0x1c'),'port':0x18eb});var socket=require(_0xbf50('0x1d'))(new Redis(config[_0xbf50('0x1b')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4b05bb,_0x101e5d){_0x101e5d=_0x101e5d||0xcc;return function(_0x5df099){if(_0x5df099){return _0x4b05bb[_0xbf50('0x1e')](_0x101e5d);}return _0x4b05bb[_0xbf50('0x1f')](_0x101e5d)[_0xbf50('0x20')]();};}function respondWithResult(_0x531729,_0xfa5164){_0xfa5164=_0xfa5164||0xc8;return function(_0x5be8ae){if(_0x5be8ae){return _0x531729[_0xbf50('0x1f')](_0xfa5164)[_0xbf50('0x21')](_0x5be8ae);}};}function respondWithFilteredResult(_0x33495f,_0x596142){return function(_0x17b416){if(_0x17b416){var _0x216254=typeof _0x596142[_0xbf50('0x22')]===_0xbf50('0x23')&&typeof _0x596142[_0xbf50('0x24')]==='undefined';var _0x433484=_0x17b416[_0xbf50('0x25')];var _0x54c011=_0x216254?0x0:_0x596142[_0xbf50('0x22')];var _0x21763f=_0x216254?_0x17b416['count']:_0x596142[_0xbf50('0x22')]+_0x596142[_0xbf50('0x24')];var _0x19cb84;if(_0x21763f>=_0x433484){_0x21763f=_0x433484;_0x19cb84=0xc8;}else{_0x19cb84=0xce;}_0x33495f[_0xbf50('0x1f')](_0x19cb84);return _0x33495f[_0xbf50('0x26')](_0xbf50('0x27'),_0x54c011+'-'+_0x21763f+'/'+_0x433484)[_0xbf50('0x21')](_0x17b416);}return null;};}function patchUpdates(_0x5e0eda){return function(_0x304bd5){try{jsonpatch[_0xbf50('0x28')](_0x304bd5,_0x5e0eda,!![]);}catch(_0x5fb909){return BPromise[_0xbf50('0x29')](_0x5fb909);}return _0x304bd5['save']();};}function saveUpdates(_0x3648bf,_0x219e99){return function(_0x31f9a8){if(_0x31f9a8){return _0x31f9a8[_0xbf50('0x2a')](_0x3648bf)[_0xbf50('0x2b')](function(_0x16e1e3){return _0x16e1e3;});}return null;};}function removeEntity(_0x4ff0be,_0xf970a1){return function(_0x30bfff){if(_0x30bfff){return _0x30bfff[_0xbf50('0x2c')]()['then'](function(){_0x4ff0be['status'](0xcc)[_0xbf50('0x20')]();});}};}function handleEntityNotFound(_0x53be2e,_0x3ca677){return function(_0x53707f){if(!_0x53707f){_0x53be2e[_0xbf50('0x1e')](0x194);}return _0x53707f;};}function handleError(_0x47b714,_0x3e45f9){_0x3e45f9=_0x3e45f9||0x1f4;return function(_0x105c9f){logger[_0xbf50('0x2d')](_0x105c9f[_0xbf50('0x2e')]);if(_0x105c9f[_0xbf50('0x2f')]){delete _0x105c9f[_0xbf50('0x2f')];}_0x47b714['status'](_0x3e45f9)[_0xbf50('0x30')](_0x105c9f);};}function getInteractionUsers(_0x18923b,_0x1bc9bc){return new BPromise(function(_0x173ebe,_0x2e4d55){try{if(_0x1bc9bc[_0x18923b['id']]){_0x18923b[_0xbf50('0x31')]=_[_0xbf50('0x32')](_0x1bc9bc[_0x18923b['id']],function(_0xc7df4c){return{'id':_0xc7df4c['id'],'fullname':_0xc7df4c['fullname']};});}}catch(_0x446f22){_0x2e4d55(_0x446f22);}_0x173ebe(_0x18923b);});}function getInteractionTags(_0x2662e1,_0x18b949){return new BPromise(function(_0x104063,_0x5a99d1){try{if(_0x2662e1[_0xbf50('0x33')]){_0x2662e1[_0xbf50('0x34')]=[];_0x2662e1[_0xbf50('0x33')][_0xbf50('0x35')](',')[_0xbf50('0x36')](function(_0x3c472e){_0x2662e1[_0xbf50('0x34')][_0xbf50('0x37')](_0x18b949[_0x3c472e]);});}delete _0x2662e1[_0xbf50('0x33')];}catch(_0x8f23c5){_0x5a99d1(_0x8f23c5);}_0x104063(_0x2662e1);});}function updateWhatsappInteraction(_0x192706,_0x53134d,_0x8128e0){return new BPromise(function(_0x44fe4a,_0x4b9a51){return getInteractionUsers(_0x192706,_0x8128e0)[_0xbf50('0x2b')](function(_0x2becfc){return getInteractionTags(_0x2becfc,_0x53134d);})[_0xbf50('0x2b')](function(_0x2268c3){_0x44fe4a(_0x2268c3);})['catch'](function(_0x2e7453){_0x4b9a51(_0x2e7453);});});}exports[_0xbf50('0x38')]=function(_0x351490,_0x6ff880){var _0x16ef05={},_0x52e8fa={},_0x44f8b1={'count':0x0,'rows':[]};var _0x410d5f=_['map'](db['WhatsappInteraction'][_0xbf50('0x39')],function(_0x16bde3){return{'name':_0x16bde3[_0xbf50('0x3a')],'type':_0x16bde3[_0xbf50('0x3b')]['key']};});_0x52e8fa[_0xbf50('0x3c')]=_['map'](_0x410d5f,_0xbf50('0x2f'));_0x52e8fa[_0xbf50('0x3d')]=_[_0xbf50('0x3e')](_0x351490[_0xbf50('0x3d')]);_0x52e8fa[_0xbf50('0x3f')]=_[_0xbf50('0x40')](_0x52e8fa[_0xbf50('0x3c')],_0x52e8fa[_0xbf50('0x3d')]);_0x16ef05[_0xbf50('0x41')]=_[_0xbf50('0x40')](_0x52e8fa['model'],qs['fields'](_0x351490['query'][_0xbf50('0x42')]));_0x16ef05['attributes']=_0x16ef05[_0xbf50('0x41')]['length']?_0x16ef05[_0xbf50('0x41')]:_0x52e8fa[_0xbf50('0x3c')];if(!_0x351490[_0xbf50('0x3d')]['hasOwnProperty'](_0xbf50('0x43'))){_0x16ef05[_0xbf50('0x24')]=qs[_0xbf50('0x24')](_0x351490[_0xbf50('0x3d')]['limit']);_0x16ef05[_0xbf50('0x22')]=qs[_0xbf50('0x22')](_0x351490[_0xbf50('0x3d')][_0xbf50('0x22')]);}_0x16ef05[_0xbf50('0x44')]=qs[_0xbf50('0x45')](_0x351490[_0xbf50('0x3d')][_0xbf50('0x45')]);_0x16ef05[_0xbf50('0x46')]=qs[_0xbf50('0x3f')](_[_0xbf50('0x47')](_0x351490[_0xbf50('0x3d')],_0x52e8fa[_0xbf50('0x3f')]),_0x410d5f);var _0x2fd9dc=[];var _0x151d17=squel['select']()[_0xbf50('0x48')]('id')[_0xbf50('0x48')]('name')['field'](_0xbf50('0x49'))[_0xbf50('0x4a')]('tools_tags');var _0x398290=squel[_0xbf50('0x4b')]()[_0xbf50('0x48')](_0xbf50('0x4c'))[_0xbf50('0x48')]('u.fullname')[_0xbf50('0x48')]('ui.WhatsappInteractionId')[_0xbf50('0x4a')]('user_has_whatsapp_interactions','ui')['left_join']('users','u',_0xbf50('0x4d'));var _0x5c38f1=squel[_0xbf50('0x4b')]()['from'](_0xbf50('0x4e'),'i')[_0xbf50('0x4f')](_0xbf50('0x50'),'c',_0xbf50('0x51'))['left_join'](_0xbf50('0x52'),'o',_0xbf50('0x53'))['left_join'](_0xbf50('0x54'),'a',_0xbf50('0x55'))[_0xbf50('0x4f')](_0xbf50('0x56'),'me',_0xbf50('0x57'))[_0xbf50('0x4f')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xbf50('0x4f')](_0xbf50('0x58'),'t','t.id\x20=\x20it.TagId');var _0x47aea7=squel['expr']();var _0x4c12b7=[];var _0xb92b08=squel[_0xbf50('0x59')]();var _0x5b77bc;if(_0x351490[_0xbf50('0x3d')]['search']){_0x5b77bc=as['parseSearch'](_0x351490[_0xbf50('0x3d')][_0xbf50('0x5a')]);var _0x2c4db6=_0x5b77bc['sqlOperator'];for(var _0x149015=0x0;_0x149015<_0x5b77bc['conditions'][_0xbf50('0x5b')];_0x149015++){var _0x2b3f89=_0x5b77bc[_0xbf50('0x5c')][_0x149015];var _0xfb3e4b='i';var _0x151208=_[_0xbf50('0x5d')](_0x410d5f,[_0xbf50('0x2f'),_0x2b3f89['field']]);if(!_0x151208){switch(_0x2b3f89[_0xbf50('0x48')]){case _0xbf50('0x5e'):if(_0x2b3f89['value']==0x1){_0x5c38f1[_0xbf50('0x5f')]('`'+_0x2b3f89[_0xbf50('0x48')]+_0xbf50('0x60'));}else{_0x5c38f1[_0xbf50('0x5f')]('`'+_0x2b3f89[_0xbf50('0x48')]+'`\x20>\x200');}break;case _0xbf50('0x61'):if(_0x2b3f89[_0xbf50('0x62')]===_0xbf50('0x63')){if(_0x2b3f89[_0xbf50('0x64')][_0xbf50('0x35')]('\x20')[_0xbf50('0x5b')]>0x1){_0x47aea7[_0x2c4db6](_0xbf50('0x65'),qs[_0xbf50('0x66')](_0x2b3f89['value']),null);}else{var _0x58104c='%'+_0x2b3f89[_0xbf50('0x64')]+'%';_0x47aea7[_0x2c4db6](_0xbf50('0x67'),_0x58104c,_0x58104c,_0x58104c);}}else{_0x151208=_[_0xbf50('0x5d')](_0x410d5f,[_0xbf50('0x2f'),_0xbf50('0x68')]);_0x2b3f89[_0xbf50('0x48')]=_0xbf50('0x68');_0x1c2d43=as[_0xbf50('0x69')](_0xfb3e4b,_0x151208[_0xbf50('0x3b')],_0x2b3f89);_0x47aea7[_0x2c4db6](_0x1c2d43['text'],_0x1c2d43[_0xbf50('0x64')][_0xbf50('0x6a')],_0x1c2d43[_0xbf50('0x64')][_0xbf50('0x20')]);}break;case _0xbf50('0x6b'):var _0x56b14e=_0x2b3f89[_0xbf50('0x64')][_0xbf50('0x35')](',')[_0xbf50('0x32')](function(_0x2643b3){return Number(_0x2643b3);});_0x56b14e[_0xbf50('0x36')](function(_0x113ce6){_0xb92b08['or'](_0xbf50('0x6c'),'%,'+_0x113ce6+',%');});_0x4c12b7=_['union'](_0x4c12b7,_0x56b14e);break;case'User':if(_0x2b3f89[_0xbf50('0x62')]===_0xbf50('0x63')){_0x47aea7[_0x2c4db6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2b3f89[_0xbf50('0x64')]+'%',null);}else{_0x151208=_['find'](_0x410d5f,['name',_0xbf50('0x6d')]);_0x2b3f89[_0xbf50('0x48')]=_0xbf50('0x6d');_0x1c2d43=as[_0xbf50('0x69')](_0xfb3e4b,_0x151208[_0xbf50('0x3b')],_0x2b3f89);_0x47aea7[_0x2c4db6](_0x1c2d43[_0xbf50('0x6e')],_0x1c2d43[_0xbf50('0x64')]['start'],_0x1c2d43[_0xbf50('0x64')][_0xbf50('0x20')]);}break;case _0xbf50('0x6f'):_0x1c2d43=as[_0xbf50('0x69')]('me',null,_0x2b3f89);_0x47aea7[_0x2c4db6](_0x1c2d43[_0xbf50('0x6e')],_0x1c2d43['value'][_0xbf50('0x6a')],_0x1c2d43[_0xbf50('0x64')][_0xbf50('0x20')]);break;}}else{var _0x1c2d43=as['buildExpression'](_0xfb3e4b,_0x151208[_0xbf50('0x3b')],_0x2b3f89);_0x47aea7[_0x2c4db6](_0x1c2d43[_0xbf50('0x6e')],_0x1c2d43['value'][_0xbf50('0x6a')],_0x1c2d43['value'][_0xbf50('0x20')]);}}}else{var _0x34aa21=_(_0x351490[_0xbf50('0x3d')])[_0xbf50('0x3e')]()[_0xbf50('0x32')](function(_0x576916){return _[_0xbf50('0x70')](_0x410d5f,[_0xbf50('0x2f'),_0x576916])?_0x576916:undefined;})[_0xbf50('0x71')]()[_0xbf50('0x64')]();if(!_[_0xbf50('0x72')](_0x34aa21)){_0x34aa21[_0xbf50('0x36')](function(_0x6adaa3){if(_0x6adaa3===_0xbf50('0x73')){_0x5c38f1[_0xbf50('0x46')]('i.WhatsappAccountId\x20IN\x20?',[][_0xbf50('0x74')](_0x351490['query'][_0x6adaa3]));}else if(_0x6adaa3===_0xbf50('0x75')){var _0x1ddd06=JSON[_0xbf50('0x76')](_0x351490[_0xbf50('0x3d')][_0x6adaa3])['$gte'];var _0xcb4885=JSON['parse'](_0x351490['query'][_0x6adaa3])[_0xbf50('0x77')];_0x5c38f1[_0xbf50('0x46')](_0xbf50('0x78'),_0x1ddd06,_0xcb4885);}else{if(_0x351490['query'][_0x6adaa3]===_0xbf50('0x79')){_0x5c38f1[_0xbf50('0x46')]('i.'+_0x6adaa3+'\x20IS\x20NULL');}else{_0x5c38f1['where']('i.'+_0x6adaa3+_0xbf50('0x7a'),_0x351490[_0xbf50('0x3d')][_0x6adaa3]);}}});}if(_0x351490[_0xbf50('0x3d')][_0xbf50('0x7b')]){if(_0x351490[_0xbf50('0x3d')]['read']==0x1){_0x5c38f1[_0xbf50('0x5f')](_0xbf50('0x7c'));}else{_0x5c38f1['having'](_0xbf50('0x7d'));}}if(_0x351490['query'][_0xbf50('0x7e')]){_0x4c12b7=_[_0xbf50('0x7f')](_0x351490[_0xbf50('0x3d')][_0xbf50('0x7e')])?_0x351490[_0xbf50('0x3d')][_0xbf50('0x7e')]:new Array(_0x351490[_0xbf50('0x3d')][_0xbf50('0x7e')]);_0x4c12b7['forEach'](function(_0x387c33){_0xb92b08['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x387c33+',%');});}if(_0x351490[_0xbf50('0x3d')][_0xbf50('0x80')]){var _0x30606c=_0x351490[_0xbf50('0x3d')][_0xbf50('0x80')][_0xbf50('0x81')]('\x5c','\x5c\x5c')[_0xbf50('0x81')](/'/g,'\x27\x27');if(qs[_0xbf50('0x82')](_0x30606c)){_0x47aea7['or']('i.id\x20LIKE\x20?',_0x30606c+'%')['or'](_0xbf50('0x83'),_0x30606c+'%');}else{_0x47aea7['or'](_0xbf50('0x84'),qs[_0xbf50('0x66')](_0x30606c))['or'](_0xbf50('0x85'),_0x30606c+'%');}}}_0x5c38f1[_0xbf50('0x46')](_0x47aea7);_0x5c38f1[_0xbf50('0x86')](_0xbf50('0x87'));var _0x1506af={'type':db[_0xbf50('0x88')][_0xbf50('0x89')]['SELECT'],'raw':!![]};var _0x564e29=_0x5c38f1[_0xbf50('0x8a')]();_0x564e29[_0xbf50('0x48')](_0xbf50('0x87'));_0x564e29[_0xbf50('0x48')](_0xbf50('0x8b'),'unreadMessages');if(_0x16ef05['order']){_0x16ef05['order'][_0xbf50('0x36')](function(_0xc86bb8){var _0x4befcc=_0xc86bb8[0x0]==='contactName'?_0xc86bb8[0x0]:'i.'+_0xc86bb8[0x0];_0x5c38f1[_0xbf50('0x44')](_0x4befcc,_0xc86bb8[0x1]===_0xbf50('0x8c')?![]:!![]);});}if(!_[_0xbf50('0x72')](_0x4c12b7)){_0x5c38f1[_0xbf50('0x5f')](_0xb92b08);_0x564e29[_0xbf50('0x46')](_0xbf50('0x8d'),_0x4c12b7);}BPromise[_0xbf50('0x8e')]()[_0xbf50('0x2b')](function(){if(!_0x5b77bc){if(_0x351490[_0xbf50('0x3d')][_0xbf50('0x73')])return;_0x564e29[_0xbf50('0x46')](_0xbf50('0x8f'));_0x5c38f1['where'](_0xbf50('0x8f'));return;}if(_0x351490[_0xbf50('0x90')][_0xbf50('0x91')]!==_0xbf50('0x92'))return;return _0x351490['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xbf50('0x2b')](function(_0x29c673){if(_[_0xbf50('0x72')](_0x29c673)){_0x564e29[_0xbf50('0x46')](_0xbf50('0x93'));_0x5c38f1['where'](_0xbf50('0x93'));}else{_0x564e29['where'](_0xbf50('0x94'),_[_0xbf50('0x32')](_0x29c673,'id'));_0x5c38f1[_0xbf50('0x46')](_0xbf50('0x94'),_[_0xbf50('0x32')](_0x29c673,'id'));}});})[_0xbf50('0x2b')](function(){if(_0x351490[_0xbf50('0x90')][_0xbf50('0x91')]==='agent'&&!_0x5b77bc&&!_0x351490[_0xbf50('0x3d')]['WhatsappAccountId'])return[];return db[_0xbf50('0x95')]['query'](_0x564e29[_0xbf50('0x96')](),_0x1506af);})[_0xbf50('0x2b')](function(_0x34fac7){_0x44f8b1[_0xbf50('0x25')]=_0x34fac7['length'];if(_0x44f8b1[_0xbf50('0x25')]===0x0)return[];return db['sequelize'][_0xbf50('0x3d')](_0x151d17[_0xbf50('0x96')](),_0x1506af)['then'](function(_0x5329c0){_0x2fd9dc=_[_0xbf50('0x97')](_0x5329c0,'id');_0x1506af=_[_0xbf50('0x98')](_0x1506af,{'model':db[_0xbf50('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x351490[_0xbf50('0x3d')][_0xbf50('0x42')]){_0x16ef05[_0xbf50('0x41')][_0xbf50('0x36')](function(_0x51ab29){_0x5c38f1[_0xbf50('0x48')]('i.'+_0x51ab29);});}else{_0x5c38f1['field'](_0xbf50('0x8b'),_0xbf50('0x5e'));_0x5c38f1[_0xbf50('0x48')]('a.key','Account.key');_0x5c38f1[_0xbf50('0x48')](_0xbf50('0x9a'),_0xbf50('0x9b'));_0x5c38f1[_0xbf50('0x48')](_0xbf50('0x9c'),_0xbf50('0x9d'));_0x5c38f1['field']('i.*');_0x5c38f1['field'](_0xbf50('0x9e'),_0xbf50('0x9f'));_0x5c38f1[_0xbf50('0x48')]('c.lastName','Contact.lastName');_0x5c38f1[_0xbf50('0x48')](_0xbf50('0xa0'),_0xbf50('0xa1'));_0x5c38f1[_0xbf50('0x48')](_0xbf50('0xa2'),_0xbf50('0xa3'));_0x5c38f1[_0xbf50('0x48')](_0xbf50('0xa4'),_0xbf50('0xa5'));_0x5c38f1['field'](_0xbf50('0xa6'),_0xbf50('0xa7'));_0x5c38f1[_0xbf50('0x48')](_0xbf50('0xa8'),'Owner.fullname');_0x5c38f1['field'](_0xbf50('0xa9'),_0xbf50('0xaa'));_0x5c38f1['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbf50('0x33'));}if(_0x16ef05[_0xbf50('0x24')])_0x5c38f1['limit'](_0x16ef05[_0xbf50('0x24')]);if(_0x16ef05[_0xbf50('0x22')])_0x5c38f1[_0xbf50('0x22')](_0x16ef05[_0xbf50('0x22')]);return db[_0xbf50('0x95')][_0xbf50('0x3d')](_0x5c38f1[_0xbf50('0x96')](),_0x1506af);})[_0xbf50('0x2b')](function(_0x384fcb){if(_0x384fcb[_0xbf50('0x5b')]>0x0)_0x398290[_0xbf50('0x46')](_0xbf50('0xab'),_[_0xbf50('0x32')](_0x384fcb,'id'));return db[_0xbf50('0x95')][_0xbf50('0x3d')](_0x398290['toString'](),_0x1506af)[_0xbf50('0x2b')](function(_0x45de71){var _0x317030=_[_0xbf50('0xac')](_0x45de71,_0xbf50('0xad'));var _0x24c6c7=[];_0x384fcb[_0xbf50('0x36')](function(_0x29fcf8){_0x24c6c7[_0xbf50('0x37')](updateWhatsappInteraction(_0x29fcf8,_0x2fd9dc,_0x317030));});return BPromise[_0xbf50('0xae')](_0x24c6c7);});});})[_0xbf50('0x2b')](function(_0x307cc9){_0x44f8b1[_0xbf50('0xaf')]=_0x307cc9;return _0x44f8b1;})[_0xbf50('0x2b')](respondWithFilteredResult(_0x6ff880,_0x16ef05))['catch'](handleError(_0x6ff880,null));};exports[_0xbf50('0xb0')]=function(_0x2ba42a,_0x3cb330){var _0x4a91f5={'raw':![],'where':{'id':_0x2ba42a[_0xbf50('0xb1')]['id']}},_0xe72018={};_0xe72018[_0xbf50('0x3c')]=_[_0xbf50('0x3e')](db[_0xbf50('0x99')][_0xbf50('0x39')]);_0xe72018[_0xbf50('0x3d')]=_[_0xbf50('0x3e')](_0x2ba42a[_0xbf50('0x3d')]);_0xe72018[_0xbf50('0x3f')]=_['intersection'](_0xe72018[_0xbf50('0x3c')],_0xe72018[_0xbf50('0x3d')]);_0x4a91f5[_0xbf50('0x41')]=_['intersection'](_0xe72018[_0xbf50('0x3c')],qs[_0xbf50('0x42')](_0x2ba42a[_0xbf50('0x3d')]['fields']));_0x4a91f5['attributes']=_0x4a91f5[_0xbf50('0x41')]['length']?_0x4a91f5[_0xbf50('0x41')]:_0xe72018[_0xbf50('0x3c')];if(_0x2ba42a[_0xbf50('0x3d')][_0xbf50('0xb2')]){_0x4a91f5[_0xbf50('0xb3')]=[{'all':!![]}];}_0x4a91f5=_[_0xbf50('0x98')]({},_0x4a91f5,_0x2ba42a[_0xbf50('0xb4')]);return db[_0xbf50('0x99')][_0xbf50('0x5d')](_0x4a91f5)[_0xbf50('0x2b')](handleEntityNotFound(_0x3cb330,null))[_0xbf50('0x2b')](respondWithResult(_0x3cb330,null))[_0xbf50('0xb5')](handleError(_0x3cb330,null));};exports[_0xbf50('0xb6')]=function(_0x4b384b,_0x48cde6){return db[_0xbf50('0x99')][_0xbf50('0xb6')](_0x4b384b[_0xbf50('0x6f')],{})[_0xbf50('0x2b')](respondWithResult(_0x48cde6,0xc9))[_0xbf50('0xb5')](handleError(_0x48cde6,null));};exports[_0xbf50('0x2a')]=function(_0x325c2a,_0xd16523){if(_0x325c2a['body']['id']){delete _0x325c2a[_0xbf50('0x6f')]['id'];}return db[_0xbf50('0x99')]['find']({'where':{'id':_0x325c2a[_0xbf50('0xb1')]['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0xd16523,null))[_0xbf50('0x2b')](saveUpdates(_0x325c2a['body'],null))[_0xbf50('0x2b')](respondWithResult(_0xd16523,null))[_0xbf50('0xb5')](handleError(_0xd16523,null));};exports[_0xbf50('0x2c')]=function(_0x1fd75e,_0x8503ea){return db[_0xbf50('0x99')][_0xbf50('0x5d')]({'where':{'id':_0x1fd75e[_0xbf50('0xb1')]['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0x8503ea,null))[_0xbf50('0x2b')](removeEntity(_0x8503ea,null))[_0xbf50('0xb5')](handleError(_0x8503ea,null));};exports[_0xbf50('0xb7')]=function(_0x9f3d2a,_0x621da8){return db[_0xbf50('0x99')][_0xbf50('0xb7')]()[_0xbf50('0x2b')](respondWithResult(_0x621da8,null))['catch'](handleError(_0x621da8,null));};exports[_0xbf50('0xb8')]=function(_0x326bc9,_0x3a64e3,_0x521b44){return db['WhatsappMessage'][_0xbf50('0x5d')]({'where':{'id':_0x326bc9['params']['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0x3a64e3,null))['then'](function(_0x1e185a){if(_0x1e185a){return _0x1e185a[_0xbf50('0xb8')](_0x326bc9['body'][_0xbf50('0xb9')],_[_0xbf50('0xba')](_0x326bc9['body'],[_0xbf50('0xb9'),'id'])||{});}})[_0xbf50('0x2b')](respondWithResult(_0x3a64e3,null))[_0xbf50('0xb5')](handleError(_0x3a64e3,null));};exports['getMessages']=function(_0x4ddcf2,_0x4d6380,_0x3447c8){var _0x47b969={'raw':![],'where':{}};var _0x332fe3={};var _0x5355f3={'count':0x0,'rows':[]};return db[_0xbf50('0x99')][_0xbf50('0xbb')]({'where':{'id':_0x4ddcf2[_0xbf50('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4d6380,null))[_0xbf50('0x2b')](function(_0xd73dcc){if(_0xd73dcc){_0x332fe3['model']=_[_0xbf50('0x3e')](db[_0xbf50('0xbc')]['rawAttributes']);_0x332fe3[_0xbf50('0x3d')]=_['keys'](_0x4ddcf2[_0xbf50('0x3d')]);_0x332fe3['filters']=_[_0xbf50('0x40')](_0x332fe3[_0xbf50('0x3c')],_0x332fe3[_0xbf50('0x3d')]);_0x47b969[_0xbf50('0x41')]=_[_0xbf50('0x40')](_0x332fe3['model'],qs[_0xbf50('0x42')](_0x4ddcf2[_0xbf50('0x3d')]['fields']));_0x47b969['attributes']=_0x47b969['attributes'][_0xbf50('0x5b')]?_0x47b969[_0xbf50('0x41')]:_0x332fe3['model'];if(!_0x4ddcf2[_0xbf50('0x3d')][_0xbf50('0xbd')](_0xbf50('0x43'))){_0x47b969['limit']=qs[_0xbf50('0x24')](_0x4ddcf2['query'][_0xbf50('0x24')]);_0x47b969[_0xbf50('0x22')]=qs[_0xbf50('0x22')](_0x4ddcf2['query'][_0xbf50('0x22')]);}_0x47b969['order']=qs[_0xbf50('0x45')](_0x4ddcf2[_0xbf50('0x3d')]['sort']);_0x47b969[_0xbf50('0x46')]=qs[_0xbf50('0x3f')](_[_0xbf50('0x47')](_0x4ddcf2[_0xbf50('0x3d')],_0x332fe3[_0xbf50('0x3f')]));_0x47b969['where'][_0xbf50('0xad')]=_0xd73dcc['id'];if(_0x4ddcf2['query'][_0xbf50('0x80')]){_0x47b969[_0xbf50('0x46')]=_[_0xbf50('0x98')](_0x47b969[_0xbf50('0x46')],{'$or':_[_0xbf50('0x32')](_0x47b969[_0xbf50('0x41')],function(_0x2a39ea){var _0x1baacd={};_0x1baacd[_0x2a39ea]={'$like':'%'+_0x4ddcf2[_0xbf50('0x3d')]['filter']+'%'};return _0x1baacd;})});}if(_0x4ddcf2[_0xbf50('0x3d')][_0xbf50('0xbe')]){var _0x2f2bfb=_0x4ddcf2['query'][_0xbf50('0xbe')][_0xbf50('0x35')](',');var _0x39c52f={};_0x39c52f[_0x2f2bfb[0x0]]={'$gte':moment(_0x2f2bfb[0x1])[_0xbf50('0xbf')](_0xbf50('0xc0'))};_0x47b969[_0xbf50('0x46')]=_['merge'](_0x47b969['where'],_0x39c52f);}_0x47b969=_[_0xbf50('0x98')]({},_0x47b969,_0x4ddcf2[_0xbf50('0xb4')]);return db[_0xbf50('0xbc')][_0xbf50('0x25')]({'where':_0x47b969[_0xbf50('0x46')]})[_0xbf50('0x2b')](function(_0x5cf8c3){_0x5355f3[_0xbf50('0x25')]=_0x5cf8c3;if(_0x4ddcf2[_0xbf50('0x3d')][_0xbf50('0xb2')]){_0x47b969[_0xbf50('0xb3')]=[{'all':!![]}];}return db[_0xbf50('0xbc')][_0xbf50('0xc1')](_0x47b969);})[_0xbf50('0x2b')](function(_0xa10acd){_0x5355f3[_0xbf50('0xaf')]=_0xa10acd;return _0x5355f3;});}})[_0xbf50('0x2b')](respondWithFilteredResult(_0x4d6380,_0x47b969))['catch'](handleError(_0x4d6380,null));};exports['addTags']=function(_0x158f2d,_0x361bb2,_0x1b302c){return db['WhatsappInteraction'][_0xbf50('0x5d')]({'where':{'id':_0x158f2d[_0xbf50('0xb1')]['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0x361bb2,null))['then'](function(_0x4bb6f2){if(_0x4bb6f2){return _0x4bb6f2['setTags'](_0x158f2d['body']['ids'],_[_0xbf50('0xba')](_0x158f2d[_0xbf50('0x6f')],[_0xbf50('0xb9'),'id'])||{})['spread'](function(){return db[_0xbf50('0x6b')][_0xbf50('0xc1')]({'attributes':['id','name',_0xbf50('0x49')],'where':{'id':_0x158f2d['body'][_0xbf50('0xb9')]}});})[_0xbf50('0x2b')](function(_0x2aee50){socket[_0xbf50('0xc2')](_0xbf50('0xc3'),{'id':Number(_0x158f2d['params']['id']),'tags':_0x2aee50||[]});return{'id':Number(_0x158f2d[_0xbf50('0xb1')]['id']),'tags':_0x2aee50||[]};});}})[_0xbf50('0x2b')](respondWithResult(_0x361bb2,null))[_0xbf50('0xb5')](handleError(_0x361bb2,null));};exports[_0xbf50('0xc4')]=function(_0xecabf4,_0x43ea33,_0xe35d5){return db['WhatsappInteraction']['find']({'where':{'id':_0xecabf4[_0xbf50('0xb1')]['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0x43ea33,null))['then'](function(_0x41620a){if(_0x41620a){return _0x41620a[_0xbf50('0xc4')](_0xecabf4[_0xbf50('0x3d')][_0xbf50('0xb9')]);}})[_0xbf50('0x2b')](respondWithStatusCode(_0x43ea33,null))[_0xbf50('0xb5')](handleError(_0x43ea33,null));};exports[_0xbf50('0xc5')]=function(_0x2171bc,_0x1ad876){var _0xc35d7b=moment()[_0xbf50('0xc6')]()['toString']();var _0x1d93ab=path['join'](config[_0xbf50('0xc7')],_0xbf50('0xc8'),_0xbf50('0xc9'),_0xbf50('0xca'));var _0x3f1686=path[_0xbf50('0xcb')](config[_0xbf50('0xc7')],'server',_0xbf50('0xc9'),_0xbf50('0xcc'));var _0x2b3ee1=path[_0xbf50('0xcb')](_0x1d93ab,_0xc35d7b);var _0x4e7098=util[_0xbf50('0xbf')](_0xbf50('0xcd'),_0x2171bc[_0xbf50('0xb1')]['id'],_0xc35d7b);var _0x29a27d=path[_0xbf50('0xcb')](_0x1d93ab,_0x4e7098);var _0x2122b7=[];_0x2122b7[_0xbf50('0x37')]({'model':db[_0xbf50('0xce')],'as':_0xbf50('0xce'),'attributes':['id',_0xbf50('0xcf')],'raw':!![]});_0x2122b7['push']({'model':db[_0xbf50('0xd0')],'as':'Contact','attributes':['id',_0xbf50('0xd1'),_0xbf50('0xd2')],'raw':!![]});if(_0x2171bc[_0xbf50('0x3d')][_0xbf50('0xcc')]){_0x2122b7['push']({'model':db[_0xbf50('0xd3')],'as':_0xbf50('0xd3'),'raw':!![]});}var _0x5169cc=[{'model':db[_0xbf50('0xbc')],'as':_0xbf50('0xd4'),'attributes':['id',_0xbf50('0x6f'),_0xbf50('0x75'),_0xbf50('0xd5'),_0xbf50('0xd6'),_0xbf50('0x7b')],'include':_0x2122b7}];_0x5169cc[_0xbf50('0x37')]({'model':db[_0xbf50('0xd7')],'as':_0xbf50('0xd8'),'attributes':['id',_0xbf50('0x2f')]});_0x5169cc[_0xbf50('0x37')]({'model':db['User'],'as':'Owner','attributes':['id',_0xbf50('0xcf')]});return db[_0xbf50('0x99')][_0xbf50('0x5d')]({'where':{'id':_0x2171bc[_0xbf50('0xb1')]['id']},'include':_0x5169cc})[_0xbf50('0x2b')](handleEntityNotFound(_0x1ad876,null))['then'](function(_0x175d0d){if(_0x175d0d){var _0x65aa54=_0x175d0d[_0xbf50('0xd9')]({'plain':!![]});fs[_0xbf50('0xda')](_0x2b3ee1);var _0x28fad7={'channel':_0xbf50('0xdb'),'account':_0x65aa54[_0xbf50('0xd8')][_0xbf50('0x2f')],'agent':_0x65aa54[_0xbf50('0xdc')]?_0x65aa54[_0xbf50('0xdc')][_0xbf50('0xcf')]:_0xbf50('0xdd'),'createdAt':moment(_0x65aa54[_0xbf50('0x75')])['format'](_0xbf50('0xc0'))['toString'](),'closedAt':_0x65aa54[_0xbf50('0xde')]?moment(_0x65aa54['closedAt'])[_0xbf50('0xbf')](_0xbf50('0xc0'))[_0xbf50('0x96')]():'','disposition':_0x65aa54['disposition'],'messages':_(_0x65aa54[_0xbf50('0xd4')])[_0xbf50('0x80')]({'secret':![]})['map'](function(_0x1ab97d){if(_0x1ab97d[_0xbf50('0xd3')]){var _0x187223=path[_0xbf50('0xcb')](_0x3f1686,_0x1ab97d[_0xbf50('0xd3')][_0xbf50('0xdf')]);if(fs[_0xbf50('0xe0')](_0x187223)){fs[_0xbf50('0xe1')](_0x187223)[_0xbf50('0xe2')](fs['createWriteStream'](path['join'](_0x2b3ee1,_0x1ab97d[_0xbf50('0xd3')][_0xbf50('0xdf')])));}}return{'date':moment(_0x1ab97d['createdAt'])[_0xbf50('0xbf')](_0xbf50('0xc0'))[_0xbf50('0x96')](),'sender':_0x1ab97d[_0xbf50('0xd5')]===_0xbf50('0xe3')?_0x1ab97d['User']?_0x1ab97d['User']['fullname']:'System':_0x1ab97d['Contact'][_0xbf50('0xd1')]+(_0x1ab97d[_0xbf50('0x61')]['lastName']?'\x20'+_0x1ab97d[_0xbf50('0x61')][_0xbf50('0xd2')]:''),'body':_0x1ab97d[_0xbf50('0xd3')]?_0x1ab97d[_0xbf50('0xd3')][_0xbf50('0xdf')]:_0x1ab97d[_0xbf50('0x6f')],'direction':_0x1ab97d[_0xbf50('0xd5')]===_0xbf50('0xe3')?'A':'C','secret':_0x1ab97d['secret'],'read':_0x1ab97d[_0xbf50('0x7b')],'attachment':_0x1ab97d['Attachment']};})['value']()};return ejs[_0xbf50('0xe4')](path[_0xbf50('0xcb')](config[_0xbf50('0xc7')],_0xbf50('0xc8'),_0xbf50('0xe5'),_0xbf50('0xe6')),{'interaction':_0x28fad7})[_0xbf50('0x2b')](function(_0x49d7ae){var _0x453f77=path['join'](_0x2b3ee1,'transcript-'+_0x65aa54['id']+'-'+_0xc35d7b+_0xbf50('0xe7'));var _0x4ac69b={'path':_0x453f77,'channel':'Whatsapp','interactionId':_0x65aa54['id']};return pdf['createPdfFromHTML'](_0x49d7ae,_0x4ac69b);})[_0xbf50('0x2b')](function(){return new BPromise(function(_0x4a630c,_0x33c9cf){zipdir(_0x2b3ee1,{'saveTo':_0x29a27d},function(_0x3c678b,_0x3e9d7e){if(_0x3c678b)return _0x33c9cf(_0x3c678b);return _0x4a630c(_0x3e9d7e);});})[_0xbf50('0x2b')](function(){return new BPromise(function(_0x412626,_0x417b6d){rimraf(_0x2b3ee1,function(_0x47eb59){if(_0x47eb59)_0x417b6d(_0x47eb59);return _0x412626();});});})[_0xbf50('0x2b')](function(){return _0x1ad876['download'](_0x29a27d,_0x4e7098,function(_0x33e4b3){if(_0x33e4b3){console[_0xbf50('0xe8')](_0xbf50('0xe9'),_0x33e4b3);}else{fs[_0xbf50('0xea')](_0x29a27d);}});});});}else{return _0x1ad876[_0xbf50('0x1e')](0xc8);}})['catch'](handleError(_0x1ad876,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 0cbec37..593c31b 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 _0x9348=['WhatsappMessage','save','update','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x31d788,_0x47acde){var _0x220984=function(_0x31cffa){while(--_0x31cffa){_0x31d788['push'](_0x31d788['shift']());}};_0x220984(++_0x47acde);}(_0x9348,0x10d));var _0x8934=function(_0x53838e,_0x5c3cd2){_0x53838e=_0x53838e-0x0;var _0x38e8ee=_0x9348[_0x53838e];return _0x38e8ee;};'use strict';var EventEmitter=require(_0x8934('0x0'));var WhatsappInteraction=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var WhatsappMessage=require(_0x8934('0x1'))['db'][_0x8934('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':_0x8934('0x5'),'afterDestroy':'remove'};function emitEvent(_0x34f94c){return function(_0x923aa3,_0xefbef9,_0x2bce03){_0x923aa3[_0x8934('0x6')]({'attributes':['id'],'raw':!![]})[_0x8934('0x7')](function(_0x512f30){_0x923aa3[_0x8934('0x8')](_0x8934('0x9'),_0x512f30[_0x8934('0xa')](function(_0x53cbdf){return{'id':_0x53cbdf['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x923aa3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5336f0){_0x923aa3[_0x8934('0x8')]('unreadMessages',_0x5336f0[_0x8934('0xb')]);WhatsappInteractionEvents[_0x8934('0xc')](_0x34f94c+':'+_0x923aa3['id'],_0x923aa3);WhatsappInteractionEvents[_0x8934('0xc')](_0x34f94c,_0x923aa3);_0x2bce03(null);})[_0x8934('0xd')](_0x2bce03(null));};}for(var e in events){if(events[_0x8934('0xe')](e)){var event=events[e];WhatsappInteraction[_0x8934('0xf')](e,emitEvent(event));}}module[_0x8934('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1cc3=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x1cc3,0x11b));var _0x31cc=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1cc3[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x31cc('0x0'));var WhatsappInteraction=require(_0x31cc('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x31cc('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x31cc('0x2')](0x0);var events={'afterCreate':_0x31cc('0x3'),'afterUpdate':_0x31cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x103c04){return function(_0xebc7cc,_0x32b9a6,_0x541da0){_0xebc7cc[_0x31cc('0x5')]({'attributes':['id'],'raw':!![]})[_0x31cc('0x6')](function(_0x306896){_0xebc7cc[_0x31cc('0x7')](_0x31cc('0x8'),_0x306896[_0x31cc('0x9')](function(_0x6ac277){return{'id':_0x6ac277['id']};}));return WhatsappMessage[_0x31cc('0xa')]({'where':{'WhatsappInteractionId':_0xebc7cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31cc('0x6')](function(_0x5a96bf){_0xebc7cc[_0x31cc('0x7')](_0x31cc('0xb'),_0x5a96bf[_0x31cc('0xc')]);WhatsappInteractionEvents[_0x31cc('0xd')](_0x103c04+':'+_0xebc7cc['id'],_0xebc7cc);WhatsappInteractionEvents[_0x31cc('0xd')](_0x103c04,_0xebc7cc);_0x541da0(null);})[_0x31cc('0xe')](_0x541da0(null));};}for(var e in events){if(events[_0x31cc('0xf')](e)){var event=events[e];WhatsappInteraction[_0x31cc('0x10')](e,emitEvent(event));}}module[_0x31cc('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 367acd0..a288086 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 _0x8946=['../../config/logger','api','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8946,0x193));var _0x6894=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x8946[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x6894('0x0'));var util=require(_0x6894('0x1'));var logger=require(_0x6894('0x2'))(_0x6894('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6894('0x4'));var rimraf=require('rimraf');var config=require(_0x6894('0x5'));var attributes=require(_0x6894('0x6'));module[_0x6894('0x7')]=function(_0x1a6c56,_0x14a518){return _0x1a6c56[_0x6894('0x8')](_0x6894('0x9'),attributes,{'tableName':_0x6894('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4486fc,_0x5b2556,_0x1e71e8){if(_0x4486fc[_0x6894('0xb')](_0x6894('0xc'))){_0x4486fc[_0x6894('0xd')]=moment()['format'](_0x6894('0xe'));}_0x1e71e8(null,_0x4486fc);}}});}; \ No newline at end of file +var _0xc6a6=['define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x1c1bd5,_0x2f079c){var _0x3eb95b=function(_0x3b0ee2){while(--_0x3b0ee2){_0x1c1bd5['push'](_0x1c1bd5['shift']());}};_0x3eb95b(++_0x2f079c);}(_0xc6a6,0x1a6));var _0x6c6a=function(_0x15e2fc,_0x41b843){_0x15e2fc=_0x15e2fc-0x0;var _0x58db64=_0xc6a6[_0x15e2fc];return _0x58db64;};'use strict';var _=require('lodash');var util=require(_0x6c6a('0x0'));var logger=require(_0x6c6a('0x1'))('api');var moment=require(_0x6c6a('0x2'));var BPromise=require(_0x6c6a('0x3'));var rp=require(_0x6c6a('0x4'));var fs=require('fs');var path=require(_0x6c6a('0x5'));var rimraf=require(_0x6c6a('0x6'));var config=require(_0x6c6a('0x7'));var attributes=require(_0x6c6a('0x8'));module[_0x6c6a('0x9')]=function(_0x48d8bf,_0x2452cb){return _0x48d8bf[_0x6c6a('0xa')](_0x6c6a('0xb'),attributes,{'tableName':_0x6c6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52eb3c,_0x22671e,_0x22aff2){if(_0x52eb3c[_0x6c6a('0xd')](_0x6c6a('0xe'))){_0x52eb3c[_0x6c6a('0xf')]=moment()[_0x6c6a('0x10')](_0x6c6a('0x11'));}_0x22aff2(null,_0x52eb3c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index ea83011..28609d0 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 _0x2b33=['AddTags','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','register','request','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','WhatsappInteraction','options','raw','where','attributes','limit','then','UpdateWhatsappInteraction','find','body','ids','omit'];(function(_0x743d3c,_0x830baf){var _0x365acd=function(_0x7539b9){while(--_0x7539b9){_0x743d3c['push'](_0x743d3c['shift']());}};_0x365acd(++_0x830baf);}(_0x2b33,0xba));var _0x32b3=function(_0x12d0ed,_0x54f3f6){_0x12d0ed=_0x12d0ed-0x0;var _0x1bea4e=_0x2b33[_0x12d0ed];return _0x1bea4e;};'use strict';var _=require(_0x32b3('0x0'));var util=require('util');var moment=require(_0x32b3('0x1'));var BPromise=require(_0x32b3('0x2'));var rs=require(_0x32b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32b3('0x4'));var logger=require(_0x32b3('0x5'))(_0x32b3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x32b3('0x7')][_0x32b3('0x8')]({'port':0x232a});config[_0x32b3('0x9')]=_['defaults'](config[_0x32b3('0x9')],{'host':_0x32b3('0xa'),'port':0x18eb});var socket=require(_0x32b3('0xb'))(new Redis(config[_0x32b3('0x9')]));require('./whatsappInteraction.socket')[_0x32b3('0xc')](socket);function respondWithRpcPromise(_0x44b69f,_0x2539ed,_0x334ebc){return new BPromise(function(_0x3f1b21,_0x1cd33a){return client[_0x32b3('0xd')](_0x44b69f,_0x334ebc)['then'](function(_0x1ec088){logger['info'](_0x32b3('0xe'),_0x2539ed,_0x32b3('0xf'));logger[_0x32b3('0x10')](_0x32b3('0x11'),_0x2539ed,_0x32b3('0xf'),JSON[_0x32b3('0x12')](_0x1ec088));if(_0x1ec088[_0x32b3('0x13')]){if(_0x1ec088['error']['code']===0x1f4){logger[_0x32b3('0x13')](_0x32b3('0xe'),_0x2539ed,_0x1ec088[_0x32b3('0x13')][_0x32b3('0x14')]);return _0x1cd33a(_0x1ec088[_0x32b3('0x13')][_0x32b3('0x14')]);}logger[_0x32b3('0x13')](_0x32b3('0xe'),_0x2539ed,_0x1ec088[_0x32b3('0x13')]['message']);return _0x3f1b21(_0x1ec088['error'][_0x32b3('0x14')]);}else{logger[_0x32b3('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x2539ed,'request\x20sent');_0x3f1b21(_0x1ec088[_0x32b3('0x16')]['message']);}})[_0x32b3('0x17')](function(_0x3fb613){logger[_0x32b3('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x2539ed,_0x3fb613);_0x1cd33a(_0x3fb613);});});}exports['UpdateWhatsappInteraction']=function(_0x4020df){var _0x31c818=this;return new Promise(function(_0x5508c5,_0x4e3db1){return db[_0x32b3('0x18')]['update'](_0x4020df['body'],{'raw':_0x4020df[_0x32b3('0x19')]?_0x4020df[_0x32b3('0x19')][_0x32b3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4020df[_0x32b3('0x19')]?_0x4020df[_0x32b3('0x19')][_0x32b3('0x1b')]||null:null,'attributes':_0x4020df[_0x32b3('0x19')]?_0x4020df[_0x32b3('0x19')][_0x32b3('0x1c')]||null:null,'limit':_0x4020df[_0x32b3('0x19')]?_0x4020df[_0x32b3('0x19')][_0x32b3('0x1d')]||null:null})[_0x32b3('0x1e')](function(_0x11c1b3){logger[_0x32b3('0x15')]('UpdateWhatsappInteraction',_0x4020df);logger[_0x32b3('0x10')](_0x32b3('0x1f'),_0x4020df,JSON[_0x32b3('0x12')](_0x11c1b3));_0x5508c5(_0x11c1b3);})[_0x32b3('0x17')](function(_0x3b92c9){logger[_0x32b3('0x13')](_0x32b3('0x1f'),_0x3b92c9[_0x32b3('0x14')],_0x4020df);_0x4e3db1(_0x31c818[_0x32b3('0x13')](0x1f4,_0x3b92c9['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x288071){return new Promise(function(_0x1f2d5c,_0x4757e3){return db[_0x32b3('0x18')][_0x32b3('0x20')]({'where':_0x288071[_0x32b3('0x19')]?_0x288071['options'][_0x32b3('0x1b')]||null:null})[_0x32b3('0x1e')](function(_0x1ddc8b){if(_0x1ddc8b){return _0x1ddc8b['addTags'](_0x288071[_0x32b3('0x21')][_0x32b3('0x22')],_[_0x32b3('0x23')](_0x288071[_0x32b3('0x21')],[_0x32b3('0x22'),'id'])||{});}})['spread'](function(_0x200fa8){logger[_0x32b3('0x15')](_0x32b3('0x24'),_0x288071);logger[_0x32b3('0x10')]('AddTags',_0x288071,JSON['stringify'](_0x200fa8));_0x1f2d5c(_0x200fa8);})[_0x32b3('0x17')](function(_0x54c6ed){logger[_0x32b3('0x13')](_0x32b3('0x24'),_0x54c6ed[_0x32b3('0x14')],_0x288071);_0x4757e3(_this[_0x32b3('0x13')](0x1f4,_0x54c6ed[_0x32b3('0x14')]));});});}; \ No newline at end of file +var _0xcdca=['where','attributes','limit','debug','catch','addTags','body','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw'];(function(_0x4f4fa8,_0x455a27){var _0x563b7a=function(_0x32b71b){while(--_0x32b71b){_0x4f4fa8['push'](_0x4f4fa8['shift']());}};_0x563b7a(++_0x455a27);}(_0xcdca,0xfb));var _0xacdc=function(_0x25a01d,_0x5aabf0){_0x25a01d=_0x25a01d-0x0;var _0x5b2ab4=_0xcdca[_0x25a01d];return _0x5b2ab4;};'use strict';var _=require('lodash');var util=require(_0xacdc('0x0'));var moment=require(_0xacdc('0x1'));var BPromise=require('bluebird');var rs=require(_0xacdc('0x2'));var fs=require('fs');var Redis=require(_0xacdc('0x3'));var db=require(_0xacdc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xacdc('0x5'));var jayson=require(_0xacdc('0x6'));var client=jayson[_0xacdc('0x7')][_0xacdc('0x8')]({'port':0x232a});config[_0xacdc('0x9')]=_['defaults'](config['redis'],{'host':_0xacdc('0xa'),'port':0x18eb});var socket=require(_0xacdc('0xb'))(new Redis(config['redis']));require(_0xacdc('0xc'))[_0xacdc('0xd')](socket);function respondWithRpcPromise(_0x37f8d6,_0x4157d2,_0x372b7a){return new BPromise(function(_0x37f7b3,_0x5860f2){return client[_0xacdc('0xe')](_0x37f8d6,_0x372b7a)[_0xacdc('0xf')](function(_0x43b9f9){logger[_0xacdc('0x10')](_0xacdc('0x11'),_0x4157d2,'request\x20sent');logger['debug'](_0xacdc('0x12'),_0x4157d2,_0xacdc('0x13'),JSON[_0xacdc('0x14')](_0x43b9f9));if(_0x43b9f9[_0xacdc('0x15')]){if(_0x43b9f9['error'][_0xacdc('0x16')]===0x1f4){logger[_0xacdc('0x15')](_0xacdc('0x11'),_0x4157d2,_0x43b9f9[_0xacdc('0x15')][_0xacdc('0x17')]);return _0x5860f2(_0x43b9f9['error'][_0xacdc('0x17')]);}logger[_0xacdc('0x15')](_0xacdc('0x11'),_0x4157d2,_0x43b9f9[_0xacdc('0x15')]['message']);return _0x37f7b3(_0x43b9f9[_0xacdc('0x15')][_0xacdc('0x17')]);}else{logger[_0xacdc('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4157d2,'request\x20sent');_0x37f7b3(_0x43b9f9['result'][_0xacdc('0x17')]);}})['catch'](function(_0x361c75){logger[_0xacdc('0x15')](_0xacdc('0x11'),_0x4157d2,_0x361c75);_0x5860f2(_0x361c75);});});}exports[_0xacdc('0x18')]=function(_0x163839){var _0x24c03e=this;return new Promise(function(_0x51c09a,_0x5c3bf7){return db[_0xacdc('0x19')][_0xacdc('0x1a')](_0x163839['body'],{'raw':_0x163839[_0xacdc('0x1b')]?_0x163839['options'][_0xacdc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163839[_0xacdc('0x1b')]?_0x163839[_0xacdc('0x1b')][_0xacdc('0x1d')]||null:null,'attributes':_0x163839[_0xacdc('0x1b')]?_0x163839['options'][_0xacdc('0x1e')]||null:null,'limit':_0x163839['options']?_0x163839[_0xacdc('0x1b')][_0xacdc('0x1f')]||null:null})[_0xacdc('0xf')](function(_0x26ad5b){logger[_0xacdc('0x10')]('UpdateWhatsappInteraction',_0x163839);logger[_0xacdc('0x20')]('UpdateWhatsappInteraction',_0x163839,JSON[_0xacdc('0x14')](_0x26ad5b));_0x51c09a(_0x26ad5b);})[_0xacdc('0x21')](function(_0x575866){logger['error']('UpdateWhatsappInteraction',_0x575866[_0xacdc('0x17')],_0x163839);_0x5c3bf7(_0x24c03e[_0xacdc('0x15')](0x1f4,_0x575866[_0xacdc('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x154314){return new Promise(function(_0x4eecfe,_0x2974d9){return db[_0xacdc('0x19')]['find']({'where':_0x154314[_0xacdc('0x1b')]?_0x154314[_0xacdc('0x1b')]['where']||null:null})[_0xacdc('0xf')](function(_0x1b9e27){if(_0x1b9e27){return _0x1b9e27[_0xacdc('0x22')](_0x154314[_0xacdc('0x23')][_0xacdc('0x24')],_[_0xacdc('0x25')](_0x154314[_0xacdc('0x23')],[_0xacdc('0x24'),'id'])||{});}})[_0xacdc('0x26')](function(_0x4f3a72){logger['info'](_0xacdc('0x27'),_0x154314);logger[_0xacdc('0x20')](_0xacdc('0x27'),_0x154314,JSON[_0xacdc('0x14')](_0x4f3a72));_0x4eecfe(_0x4f3a72);})[_0xacdc('0x21')](function(_0x41031e){logger['error'](_0xacdc('0x27'),_0x41031e[_0xacdc('0x17')],_0x154314);_0x2974d9(_this[_0xacdc('0x15')](0x1f4,_0x41031e[_0xacdc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1f6f6a9..d9d02b9 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 _0xe7b6=['update','emit','removeListener','register','length','whatsappInteraction:','save','remove'];(function(_0x1f4333,_0x4c7f3d){var _0x2b0005=function(_0x573f51){while(--_0x573f51){_0x1f4333['push'](_0x1f4333['shift']());}};_0x2b0005(++_0x4c7f3d);}(_0xe7b6,0x15e));var _0x6e7b=function(_0x2a0db9,_0x3240d1){_0x2a0db9=_0x2a0db9-0x0;var _0x42dd01=_0xe7b6[_0x2a0db9];return _0x42dd01;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x6e7b('0x0'),_0x6e7b('0x1'),_0x6e7b('0x2')];function createListener(_0x4b346e,_0x16f880){return function(_0x301b02){_0x16f880[_0x6e7b('0x3')](_0x4b346e,_0x301b02);};}function removeListener(_0x590820,_0x4c4938){return function(){WhatsappInteractionEvents[_0x6e7b('0x4')](_0x590820,_0x4c4938);};}exports[_0x6e7b('0x5')]=function(_0x1a5a56){for(var _0x4fe210=0x0,_0x270a9e=events[_0x6e7b('0x6')];_0x4fe210<_0x270a9e;_0x4fe210++){var _0x63af1=events[_0x4fe210];var _0x2570ca=createListener(_0x6e7b('0x7')+_0x63af1,_0x1a5a56);WhatsappInteractionEvents['on'](_0x63af1,_0x2570ca);}}; \ No newline at end of file +var _0xe8e7=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe8e7,0x1cb));var _0x7e8e=function(_0xe5d453,_0x4791ce){_0xe5d453=_0xe5d453-0x0;var _0xce0091=_0xe8e7[_0xe5d453];return _0xce0091;};'use strict';var WhatsappInteractionEvents=require(_0x7e8e('0x0'));var events=['save',_0x7e8e('0x1'),_0x7e8e('0x2')];function createListener(_0x3750e4,_0x32b92b){return function(_0x3b1858){_0x32b92b[_0x7e8e('0x3')](_0x3750e4,_0x3b1858);};}function removeListener(_0xd99084,_0x3b8dc6){return function(){WhatsappInteractionEvents[_0x7e8e('0x4')](_0xd99084,_0x3b8dc6);};}exports['register']=function(_0x49ac85){for(var _0x307978=0x0,_0x38c680=events[_0x7e8e('0x5')];_0x307978<_0x38c680;_0x307978++){var _0x43e110=events[_0x307978];var _0x1dfaeb=createListener(_0x7e8e('0x6')+_0x43e110,_0x49ac85);WhatsappInteractionEvents['on'](_0x43e110,_0x1dfaeb);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f913002..a509a95 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 _0x0a7a=['tracked','whatsappmessage:create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','/:id','post'];(function(_0x1d0456,_0x353c0b){var _0x1f4fbf=function(_0x21c62c){while(--_0x21c62c){_0x1d0456['push'](_0x1d0456['shift']());}};_0x1f4fbf(++_0x353c0b);}(_0x0a7a,0x1ad));var _0xa0a7=function(_0x2e5e9f,_0x17e27a){_0x2e5e9f=_0x2e5e9f-0x0;var _0x180d35=_0x0a7a[_0x2e5e9f];return _0x180d35;};'use strict';var multer=require(_0xa0a7('0x0'));var util=require(_0xa0a7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa0a7('0x2')]();var fs_extra=require(_0xa0a7('0x3'));var auth=require(_0xa0a7('0x4'));var interaction=require(_0xa0a7('0x5'));var config=require(_0xa0a7('0x6'));var controller=require(_0xa0a7('0x7'));router['get']('/',auth[_0xa0a7('0x8')](),controller['index']);router[_0xa0a7('0x9')](_0xa0a7('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa0a7('0x9')](_0xa0a7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa0a7('0xc')]('/',auth[_0xa0a7('0x8')](),interaction[_0xa0a7('0xd')]('whatsapp',_0xa0a7('0xe')),controller['create']);router[_0xa0a7('0xc')](_0xa0a7('0xf'),controller[_0xa0a7('0x10')]);router['put'](_0xa0a7('0xb'),auth['isAuthenticated'](),controller[_0xa0a7('0x11')]);router[_0xa0a7('0x12')](_0xa0a7('0x13'),auth['isAuthenticated'](),controller[_0xa0a7('0x14')]);router[_0xa0a7('0x12')](_0xa0a7('0x15'),auth[_0xa0a7('0x8')](),controller[_0xa0a7('0x16')]);router[_0xa0a7('0x17')](_0xa0a7('0xb'),auth[_0xa0a7('0x8')](),controller[_0xa0a7('0x18')]);module[_0xa0a7('0x19')]=router; \ No newline at end of file +var _0x176b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','update','/:id/accept','accept','put','destroy','exports','multer','util','path'];(function(_0xf9aa97,_0x4ecbb5){var _0x54e7e3=function(_0x11c265){while(--_0x11c265){_0xf9aa97['push'](_0xf9aa97['shift']());}};_0x54e7e3(++_0x4ecbb5);}(_0x176b,0xc1));var _0xb176=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x176b[_0x186376];return _0x2dbdd9;};'use strict';var multer=require(_0xb176('0x0'));var util=require(_0xb176('0x1'));var path=require(_0xb176('0x2'));var timeout=require(_0xb176('0x3'));var express=require(_0xb176('0x4'));var router=express[_0xb176('0x5')]();var fs_extra=require(_0xb176('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb176('0x7'));var config=require('../../config/environment');var controller=require(_0xb176('0x8'));router[_0xb176('0x9')]('/',auth[_0xb176('0xa')](),controller[_0xb176('0xb')]);router[_0xb176('0x9')](_0xb176('0xc'),auth['isAuthenticated'](),controller[_0xb176('0xd')]);router[_0xb176('0x9')](_0xb176('0xe'),auth['isAuthenticated'](),controller[_0xb176('0xf')]);router[_0xb176('0x10')]('/',auth[_0xb176('0xa')](),interaction[_0xb176('0x11')](_0xb176('0x12'),_0xb176('0x13')),controller[_0xb176('0x14')]);router['post'](_0xb176('0x15'),controller['status']);router['put'](_0xb176('0xe'),auth[_0xb176('0xa')](),controller[_0xb176('0x16')]);router['put'](_0xb176('0x17'),auth[_0xb176('0xa')](),controller[_0xb176('0x18')]);router[_0xb176('0x19')]('/:id/reject',auth[_0xb176('0xa')](),controller['reject']);router['delete'](_0xb176('0xe'),auth[_0xb176('0xa')](),controller[_0xb176('0x1a')]);module[_0xb176('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 528a83d..c751a4c 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 _0x2dee=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x5f41ac,_0x3e4c64){var _0x396554=function(_0x15861b){while(--_0x15861b){_0x5f41ac['push'](_0x5f41ac['shift']());}};_0x396554(++_0x3e4c64);}(_0x2dee,0x1c0));var _0xe2de=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x2dee[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0xe2de('0x0'));module[_0xe2de('0x1')]={'body':{'type':Sequelize[_0xe2de('0x2')](_0xe2de('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe2de('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe2de('0x5')]('in',_0xe2de('0x6')),'defaultValue':_0xe2de('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe2de('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe2de('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe2de('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7c22=['out','DATE','STRING','sequelize','exports','medium','BOOLEAN'];(function(_0x518839,_0x26dde1){var _0x518e32=function(_0x133215){while(--_0x133215){_0x518839['push'](_0x518839['shift']());}};_0x518e32(++_0x26dde1);}(_0x7c22,0x6c));var _0x27c2=function(_0x4e4ee1,_0x11cd95){_0x4e4ee1=_0x4e4ee1-0x0;var _0x3c3c0e=_0x7c22[_0x4e4ee1];return _0x3c3c0e;};'use strict';var Sequelize=require(_0x27c2('0x0'));module[_0x27c2('0x1')]={'body':{'type':Sequelize['TEXT'](_0x27c2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x27c2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x27c2('0x4')),'defaultValue':_0x27c2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x27c2('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x27c2('0x6')]},'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 b69440c..24d5476 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 _0xf946=['null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','name','send','WhatsappMessage','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','rows','show','params','include','find','create','body','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0xf946,0xae));var _0x6f94=function(_0x472619,_0x369fcc){_0x472619=_0x472619-0x0;var _0x14a669=_0xf946[_0x472619];return _0x14a669;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f94('0x0'));var jsonpatch=require(_0x6f94('0x1'));var rp=require('request-promise');var moment=require(_0x6f94('0x2'));var BPromise=require(_0x6f94('0x3'));var Mustache=require(_0x6f94('0x4'));var util=require('util');var path=require(_0x6f94('0x5'));var sox=require(_0x6f94('0x6'));var csv=require(_0x6f94('0x7'));var ejs=require(_0x6f94('0x8'));var fs=require('fs');var fs_extra=require(_0x6f94('0x9'));var _=require(_0x6f94('0xa'));var squel=require(_0x6f94('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f94('0xc'));var deskjs=require(_0x6f94('0xd'));var toCsv=require(_0x6f94('0x7'));var querystring=require('querystring');var Papa=require(_0x6f94('0xe'));var Redis=require('ioredis');var authService=require(_0x6f94('0xf'));var qs=require(_0x6f94('0x10'));var as=require(_0x6f94('0x11'));var hardwareService=require(_0x6f94('0x12'));var logger=require(_0x6f94('0x13'))(_0x6f94('0x14'));var utils=require(_0x6f94('0x15'));var config=require(_0x6f94('0x16'));var licenseUtil=require(_0x6f94('0x17'));var db=require(_0x6f94('0x18'))['db'];config[_0x6f94('0x19')]=_['defaults'](config['redis'],{'host':_0x6f94('0x1a'),'port':0x18eb});var socket=require(_0x6f94('0x1b'))(new Redis(config['redis']));require(_0x6f94('0x1c'))['register'](socket);var jayson=require(_0x6f94('0x1d'));var client=jayson[_0x6f94('0x1e')][_0x6f94('0x1f')]({'port':0x232c});var client9002=jayson[_0x6f94('0x1e')][_0x6f94('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x554c66,_0x2e918b,_0xf5ba72,_0x7049ba){return new BPromise(function(_0x5c5256,_0x4a0428){var _0x26736b=_0x7049ba||client;return _0x26736b[_0x6f94('0x20')](_0x554c66,_0xf5ba72)[_0x6f94('0x21')](function(_0xc443c){logger[_0x6f94('0x22')](_0x6f94('0x23'),_0x2e918b,'request\x20sent');logger[_0x6f94('0x24')](_0x6f94('0x25'),_0x2e918b,_0x6f94('0x26'),JSON[_0x6f94('0x27')](_0xc443c));if(_0xc443c[_0x6f94('0x28')]){if(_0xc443c[_0x6f94('0x28')][_0x6f94('0x29')]===0x1f4){logger[_0x6f94('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x2e918b,_0xc443c['error'][_0x6f94('0x2a')]);return _0x4a0428(_0xc443c[_0x6f94('0x28')][_0x6f94('0x2a')]);}logger[_0x6f94('0x28')](_0x6f94('0x23'),_0x2e918b,_0xc443c[_0x6f94('0x28')][_0x6f94('0x2a')]);return _0x5c5256(_0xc443c[_0x6f94('0x28')]['message']);}else{logger[_0x6f94('0x22')](_0x6f94('0x23'),_0x2e918b,_0x6f94('0x26'));_0x5c5256(_0xc443c[_0x6f94('0x2b')]['message']);}})[_0x6f94('0x2c')](function(_0x3c6997){logger[_0x6f94('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x2e918b,_0x3c6997);_0x4a0428(_0x3c6997);});});}function respondWithStatusCode(_0x2400f9,_0x2450e3){_0x2450e3=_0x2450e3||0xcc;return function(_0x38efcf){if(_0x38efcf){return _0x2400f9[_0x6f94('0x2d')](_0x2450e3);}return _0x2400f9[_0x6f94('0x2e')](_0x2450e3)[_0x6f94('0x2f')]();};}function respondWithResult(_0x41dd96,_0x2c3301){_0x2c3301=_0x2c3301||0xc8;return function(_0xb99dfa){if(_0xb99dfa){return _0x41dd96[_0x6f94('0x2e')](_0x2c3301)[_0x6f94('0x30')](_0xb99dfa);}};}function respondWithFilteredResult(_0x4dbb67,_0x48ad2b){return function(_0x5b61ef){if(_0x5b61ef){var _0x10d934=typeof _0x48ad2b[_0x6f94('0x31')]===_0x6f94('0x32')&&typeof _0x48ad2b[_0x6f94('0x33')]==='undefined';var _0x432073=_0x5b61ef[_0x6f94('0x34')];var _0x13514c=_0x10d934?0x0:_0x48ad2b[_0x6f94('0x31')];var _0x5eb488=_0x10d934?_0x5b61ef[_0x6f94('0x34')]:_0x48ad2b[_0x6f94('0x31')]+_0x48ad2b['limit'];var _0x3d00fd;if(_0x5eb488>=_0x432073){_0x5eb488=_0x432073;_0x3d00fd=0xc8;}else{_0x3d00fd=0xce;}_0x4dbb67[_0x6f94('0x2e')](_0x3d00fd);return _0x4dbb67[_0x6f94('0x35')](_0x6f94('0x36'),_0x13514c+'-'+_0x5eb488+'/'+_0x432073)[_0x6f94('0x30')](_0x5b61ef);}return null;};}function patchUpdates(_0x3d9db4){return function(_0x4b4e22){try{jsonpatch[_0x6f94('0x37')](_0x4b4e22,_0x3d9db4,!![]);}catch(_0x3e0659){return BPromise['reject'](_0x3e0659);}return _0x4b4e22[_0x6f94('0x38')]();};}function saveUpdates(_0x2261d0,_0x3b6427){return function(_0x23e2d1){if(_0x23e2d1){return _0x23e2d1['update'](_0x2261d0)[_0x6f94('0x21')](function(_0x56cbad){return _0x56cbad;});}return null;};}function removeEntity(_0x4a3531,_0x461dfc){return function(_0x1770b9){if(_0x1770b9){return _0x1770b9[_0x6f94('0x39')]()[_0x6f94('0x21')](function(){_0x4a3531[_0x6f94('0x2e')](0xcc)[_0x6f94('0x2f')]();});}};}function handleEntityNotFound(_0x37da11,_0x2ef7d6){return function(_0x20919e){if(!_0x20919e){_0x37da11[_0x6f94('0x2d')](0x194);}return _0x20919e;};}function handleError(_0xfe65a8,_0x237203){_0x237203=_0x237203||0x1f4;return function(_0x4d08bc){logger[_0x6f94('0x28')](_0x4d08bc['stack']);if(_0x4d08bc[_0x6f94('0x3a')]){delete _0x4d08bc[_0x6f94('0x3a')];}_0xfe65a8['status'](_0x237203)[_0x6f94('0x3b')](_0x4d08bc);};}exports['index']=function(_0x1213b8,_0x39ffa4){var _0x2c9ba9={},_0x2cf46d={},_0x2b3af0={'count':0x0,'rows':[]};var _0x1f612c=_['map'](db[_0x6f94('0x3c')][_0x6f94('0x3d')],function(_0x290d82){return{'name':_0x290d82['fieldName'],'type':_0x290d82['type']['key']};});_0x2cf46d[_0x6f94('0x3e')]=_['map'](_0x1f612c,_0x6f94('0x3a'));_0x2cf46d[_0x6f94('0x3f')]=_[_0x6f94('0x40')](_0x1213b8['query']);_0x2cf46d[_0x6f94('0x41')]=_['intersection'](_0x2cf46d['model'],_0x2cf46d[_0x6f94('0x3f')]);_0x2c9ba9[_0x6f94('0x42')]=_[_0x6f94('0x43')](_0x2cf46d['model'],qs[_0x6f94('0x44')](_0x1213b8[_0x6f94('0x3f')][_0x6f94('0x44')]));_0x2c9ba9['attributes']=_0x2c9ba9[_0x6f94('0x42')][_0x6f94('0x45')]?_0x2c9ba9['attributes']:_0x2cf46d[_0x6f94('0x3e')];if(!_0x1213b8['query'][_0x6f94('0x46')](_0x6f94('0x47'))){_0x2c9ba9['limit']=qs[_0x6f94('0x33')](_0x1213b8[_0x6f94('0x3f')]['limit']);_0x2c9ba9[_0x6f94('0x31')]=qs['offset'](_0x1213b8[_0x6f94('0x3f')]['offset']);}_0x2c9ba9[_0x6f94('0x48')]=qs[_0x6f94('0x49')](_0x1213b8[_0x6f94('0x3f')]['sort']);_0x2c9ba9[_0x6f94('0x4a')]=qs[_0x6f94('0x41')](_[_0x6f94('0x4b')](_0x1213b8[_0x6f94('0x3f')],_0x2cf46d[_0x6f94('0x41')]),_0x1f612c);if(_0x1213b8['query'][_0x6f94('0x4c')]){_0x2c9ba9[_0x6f94('0x4a')]=_['merge'](_0x2c9ba9[_0x6f94('0x4a')],{'$or':_[_0x6f94('0x4d')](_0x1f612c,function(_0x1068fc){if(_0x1068fc['type']!==_0x6f94('0x4e')){var _0x5878f7={};_0x5878f7[_0x1068fc[_0x6f94('0x3a')]]={'$like':'%'+_0x1213b8[_0x6f94('0x3f')]['filter']+'%'};return _0x5878f7;}})});}_0x2c9ba9=_['merge']({},_0x2c9ba9,_0x1213b8[_0x6f94('0x4f')]);var _0x5b7653={'where':_0x2c9ba9[_0x6f94('0x4a')]};return db[_0x6f94('0x3c')][_0x6f94('0x34')](_0x5b7653)[_0x6f94('0x21')](function(_0x4d7e0b){_0x2b3af0['count']=_0x4d7e0b;if(_0x1213b8[_0x6f94('0x3f')][_0x6f94('0x50')]){_0x2c9ba9['include']=[{'all':!![]}];}return db[_0x6f94('0x3c')]['findAll'](_0x2c9ba9);})['then'](function(_0x1acdc5){_0x2b3af0[_0x6f94('0x51')]=_0x1acdc5;return _0x2b3af0;})[_0x6f94('0x21')](respondWithFilteredResult(_0x39ffa4,_0x2c9ba9))[_0x6f94('0x2c')](handleError(_0x39ffa4,null));};exports[_0x6f94('0x52')]=function(_0x33e106,_0x5cefe7){var _0x56386f={'raw':!![],'where':{'id':_0x33e106[_0x6f94('0x53')]['id']}},_0x1ed4ca={};_0x1ed4ca[_0x6f94('0x3e')]=_[_0x6f94('0x40')](db[_0x6f94('0x3c')][_0x6f94('0x3d')]);_0x1ed4ca[_0x6f94('0x3f')]=_[_0x6f94('0x40')](_0x33e106['query']);_0x1ed4ca['filters']=_[_0x6f94('0x43')](_0x1ed4ca[_0x6f94('0x3e')],_0x1ed4ca[_0x6f94('0x3f')]);_0x56386f[_0x6f94('0x42')]=_[_0x6f94('0x43')](_0x1ed4ca[_0x6f94('0x3e')],qs[_0x6f94('0x44')](_0x33e106[_0x6f94('0x3f')][_0x6f94('0x44')]));_0x56386f[_0x6f94('0x42')]=_0x56386f[_0x6f94('0x42')][_0x6f94('0x45')]?_0x56386f['attributes']:_0x1ed4ca[_0x6f94('0x3e')];if(_0x33e106[_0x6f94('0x3f')][_0x6f94('0x50')]){_0x56386f[_0x6f94('0x54')]=[{'all':!![]}];}_0x56386f=_['merge']({},_0x56386f,_0x33e106[_0x6f94('0x4f')]);return db['WhatsappMessage'][_0x6f94('0x55')](_0x56386f)['then'](handleEntityNotFound(_0x5cefe7,null))[_0x6f94('0x21')](respondWithResult(_0x5cefe7,null))[_0x6f94('0x2c')](handleError(_0x5cefe7,null));};exports[_0x6f94('0x56')]=function(_0x4d8b04,_0xd7ae0e){return db[_0x6f94('0x3c')]['create'](_0x4d8b04[_0x6f94('0x57')],{})[_0x6f94('0x21')](respondWithResult(_0xd7ae0e,0xc9))[_0x6f94('0x2c')](handleError(_0xd7ae0e,null));};exports['update']=function(_0x5abcce,_0x55c523){if(_0x5abcce[_0x6f94('0x57')]['id']){delete _0x5abcce[_0x6f94('0x57')]['id'];}return db[_0x6f94('0x3c')][_0x6f94('0x55')]({'where':{'id':_0x5abcce['params']['id']}})[_0x6f94('0x21')](handleEntityNotFound(_0x55c523,null))['then'](saveUpdates(_0x5abcce[_0x6f94('0x57')],null))[_0x6f94('0x21')](respondWithResult(_0x55c523,null))[_0x6f94('0x2c')](handleError(_0x55c523,null));};exports[_0x6f94('0x39')]=function(_0x315112,_0x12500b){return db[_0x6f94('0x3c')][_0x6f94('0x55')]({'where':{'id':_0x315112['params']['id']}})[_0x6f94('0x21')](handleEntityNotFound(_0x12500b,null))[_0x6f94('0x21')](removeEntity(_0x12500b,null))[_0x6f94('0x2c')](handleError(_0x12500b,null));};exports[_0x6f94('0x58')]=function(_0x43ff7f,_0x116c5e){return db[_0x6f94('0x3c')][_0x6f94('0x58')]()[_0x6f94('0x21')](respondWithResult(_0x116c5e,null))[_0x6f94('0x2c')](handleError(_0x116c5e,null));};var interaction_log=require('../../config/logger')(_0x6f94('0x59'));exports['accept']=function(_0x27f9c6,_0x22dd23,_0x553030){var _0x416baf={'agent':{},'channel':_0x6f94('0x5a')};if(_0x27f9c6[_0x6f94('0x57')]['id']){delete _0x27f9c6[_0x6f94('0x57')]['id'];}_0x27f9c6['body']['read']=!![];_0x27f9c6[_0x6f94('0x57')][_0x6f94('0x5b')]=moment()[_0x6f94('0x5c')](_0x6f94('0x5d'));_0x27f9c6[_0x6f94('0x57')][_0x6f94('0x5e')]=_0x27f9c6['body'][_0x6f94('0x5e')]||_0x27f9c6[_0x6f94('0x5f')]['id'];_0x416baf[_0x6f94('0x60')]['id']=_0x27f9c6[_0x6f94('0x57')][_0x6f94('0x5e')];return db[_0x6f94('0x3c')][_0x6f94('0x55')]({'where':{'id':_0x27f9c6[_0x6f94('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22dd23,null))[_0x6f94('0x21')](saveUpdates(_0x27f9c6[_0x6f94('0x57')],null))[_0x6f94('0x21')](function(_0xc5e01){if(_0xc5e01){_0x416baf[_0x6f94('0x2a')]=_0xc5e01[_0x6f94('0x61')]({'plain':!![]});return db[_0x6f94('0x62')][_0x6f94('0x55')]({'where':{'id':_0xc5e01[_0x6f94('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x22dd23,null))[_0x6f94('0x21')](function(_0x3fbd9a){if(_0x3fbd9a){return _0x3fbd9a[_0x6f94('0x64')]({'UserId':_0x27f9c6[_0x6f94('0x57')][_0x6f94('0x5e')],'read1stAt':_[_0x6f94('0x65')](_0x3fbd9a[_0x6f94('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6f94('0x21')](function(_0x948976){if(_0x948976){_0x416baf[_0x6f94('0x67')]=_0x948976[_0x6f94('0x61')]({'plain':!![]});interaction_log[_0x6f94('0x22')](_0x6f94('0x68'),_0x27f9c6[_0x6f94('0x5f')]['id'],_0x27f9c6['user'][_0x6f94('0x3a')],_0x27f9c6['user'][_0x6f94('0x69')],_0x416baf[_0x6f94('0x67')]['id'],_0x27f9c6[_0x6f94('0x57')]?JSON[_0x6f94('0x27')](_0x27f9c6[_0x6f94('0x57')]):_0x6f94('0x6a'));return respondWithRpcPromise(_0x6f94('0x6b'),'acceptMessage',_0x416baf);}return null;})[_0x6f94('0x21')](function(_0x19a798){var _0x4b4b0d=_0x6f94('0x6c')+_0x19a798[_0x6f94('0x2a')][_0x6f94('0x6d')];return db['sequelize']['query'](_0x4b4b0d,{'type':db[_0x6f94('0x6e')][_0x6f94('0x6f')]['SELECT'],'raw':!![]})[_0x6f94('0x21')](function(_0x29a143){return _0x29a143;});})[_0x6f94('0x21')](function(_0x496df1){if(_0x496df1){_0x416baf[_0x6f94('0x2a')][_0x6f94('0x70')]=_0x496df1[0x0];if(!_0x27f9c6['body'][_0x6f94('0x5e')])return;return db[_0x6f94('0x71')]['find']({'where':{'id':_0x27f9c6[_0x6f94('0x57')][_0x6f94('0x5e')],'role':_0x6f94('0x60')},'attributes':['id',_0x6f94('0x3a'),_0x6f94('0x72'),_0x6f94('0x73'),_0x6f94('0x74')],'raw':!![]});}return null;})[_0x6f94('0x21')](function(_0x3e53e9){if(!_0x3e53e9)return null;_0x416baf[_0x6f94('0x2a')]['agent']=_0x3e53e9;return _0x416baf;})[_0x6f94('0x21')](function(_0x163879){if(_0x163879){if(_0x27f9c6[_0x6f94('0x57')][_0x6f94('0x75')]){_0x416baf['message'][_0x6f94('0x76')]=util[_0x6f94('0x5c')](_0x6f94('0x77'),_0x27f9c6[_0x6f94('0x5f')][_0x6f94('0x3a')]);_0x416baf[_0x6f94('0x2a')][_0x6f94('0x78')]=_0x416baf['channel'];_0x416baf[_0x6f94('0x2a')][_0x6f94('0x79')]=_0x416baf[_0x6f94('0x78')];_0x416baf[_0x6f94('0x2a')][_0x6f94('0x7a')]='accept';return respondWithRpcPromise(_0x6f94('0x7b'),_0x6f94('0x7b'),{'event':_0x6f94('0x7c'),'message':_0x416baf[_0x6f94('0x2a')]},client9002)[_0x6f94('0x21')](function(){return _0x416baf;});}return _0x416baf;}return null;})[_0x6f94('0x21')](respondWithResult(_0x22dd23,null))[_0x6f94('0x2c')](handleError(_0x22dd23,null));};var interaction_log=require(_0x6f94('0x13'))('whatsapp-interactions');exports['reject']=function(_0x117569,_0x36e0a0,_0x1ed770){var _0x14d6aa={'agent':{},'channel':_0x6f94('0x5a')};if(_0x117569[_0x6f94('0x57')]['id']){delete _0x117569['body']['id'];}_0x117569[_0x6f94('0x57')][_0x6f94('0x5e')]=_0x117569[_0x6f94('0x57')][_0x6f94('0x5e')]||_0x117569[_0x6f94('0x5f')]['id'];_0x14d6aa[_0x6f94('0x60')]['id']=_0x117569[_0x6f94('0x57')][_0x6f94('0x5e')];return db[_0x6f94('0x3c')][_0x6f94('0x55')]({'where':{'id':_0x117569['params']['id'],'UserId':null}})[_0x6f94('0x21')](handleEntityNotFound(_0x36e0a0,null))[_0x6f94('0x21')](function(_0x177f8){if(_0x177f8){_0x14d6aa[_0x6f94('0x2a')]=_0x177f8[_0x6f94('0x61')]({'plain':!![]});return db[_0x6f94('0x62')]['find']({'where':{'id':_0x177f8['WhatsappInteractionId']}});}return null;})[_0x6f94('0x21')](handleEntityNotFound(_0x36e0a0,null))[_0x6f94('0x21')](function(_0x3eb8f3){if(_0x3eb8f3){_0x14d6aa[_0x6f94('0x67')]=_0x3eb8f3[_0x6f94('0x61')]({'plain':!![]});interaction_log[_0x6f94('0x22')](_0x6f94('0x7d'),_0x117569[_0x6f94('0x5f')]['id'],_0x117569[_0x6f94('0x5f')]['name'],_0x117569[_0x6f94('0x5f')][_0x6f94('0x69')],_0x14d6aa['interaction']['id'],_0x117569[_0x6f94('0x57')]?JSON['stringify'](_0x117569[_0x6f94('0x57')]):_0x6f94('0x6a'));return respondWithRpcPromise('RejectMessage',_0x6f94('0x7e'),_0x14d6aa);}return null;})[_0x6f94('0x21')](function(_0x499224){var _0x45b46b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x499224[_0x6f94('0x2a')][_0x6f94('0x6d')];return db['sequelize'][_0x6f94('0x3f')](_0x45b46b,{'type':db['Sequelize']['QueryTypes'][_0x6f94('0x7f')],'raw':!![]})[_0x6f94('0x21')](function(_0x30f5ce){return _0x30f5ce;});})[_0x6f94('0x21')](function(_0x444067){if(_0x444067){_0x14d6aa[_0x6f94('0x2a')][_0x6f94('0x70')]=_0x444067[0x0];if(!_0x117569[_0x6f94('0x57')][_0x6f94('0x5e')])return;return db[_0x6f94('0x71')][_0x6f94('0x55')]({'where':{'id':_0x117569[_0x6f94('0x57')][_0x6f94('0x5e')],'role':_0x6f94('0x60')},'attributes':['id',_0x6f94('0x3a'),'fullname',_0x6f94('0x73'),_0x6f94('0x74')],'raw':!![]});}return null;})[_0x6f94('0x21')](function(_0x40d857){if(!_0x40d857)return null;_0x14d6aa[_0x6f94('0x2a')][_0x6f94('0x60')]=_0x40d857;return _0x14d6aa;})[_0x6f94('0x21')](function(_0x38eac0){if(_0x38eac0){_0x38eac0[_0x6f94('0x2a')][_0x6f94('0x76')]=util[_0x6f94('0x5c')](_0x6f94('0x77'),_0x117569['user'][_0x6f94('0x3a')]);_0x38eac0['message']['channel']=_0x14d6aa[_0x6f94('0x78')];_0x38eac0['message'][_0x6f94('0x79')]=_0x14d6aa['channel'];_0x38eac0[_0x6f94('0x2a')][_0x6f94('0x7a')]='reject';respondWithRpcPromise(_0x6f94('0x7b'),_0x6f94('0x7b'),{'event':_0x6f94('0x80'),'message':_0x38eac0[_0x6f94('0x2a')]},client9002);return _0x14d6aa;}return null;})['then'](respondWithResult(_0x36e0a0,null))[_0x6f94('0x2c')](handleError(_0x36e0a0,null));};exports[_0x6f94('0x2e')]=function(_0x15936f,_0x54cb12,_0x2cc2ae){if(_0x15936f[_0x6f94('0x57')]['id']){delete _0x15936f[_0x6f94('0x57')]['id'];}var _0x2fdd77;return db['WhatsappMessage'][_0x6f94('0x55')]({'where':{'id':_0x15936f[_0x6f94('0x53')]['id']}})[_0x6f94('0x21')](handleEntityNotFound(_0x54cb12,null))[_0x6f94('0x21')](function(_0x5c7b4a){if(_0x5c7b4a){_0x2fdd77=_0x5c7b4a;return db[_0x6f94('0x81')][_0x6f94('0x55')]({'where':{'id':_0x5c7b4a[_0x6f94('0x82')]}});}})['then'](handleEntityNotFound(_0x54cb12,null))[_0x6f94('0x21')](function(_0x34ea21){if(_0x34ea21){logger[_0x6f94('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x6f94('0x83'),_0x34ea21[_0x6f94('0x84')],util[_0x6f94('0x85')](_0x15936f[_0x6f94('0x57')],{'showHidden':![],'depth':null}));switch(_0x34ea21['type']){case _0x6f94('0x86'):if(_0x15936f[_0x6f94('0x57')][_0x6f94('0x87')]&&_0x15936f['body'][_0x6f94('0x87')]===_0x2fdd77[_0x6f94('0x88')]&&_0x15936f['body']['MessageStatus']&&_0x15936f[_0x6f94('0x57')][_0x6f94('0x89')]===_0x6f94('0x8a')){return _0x2fdd77[_0x6f94('0x64')]({'read':!![]});}else{logger[_0x6f94('0x28')](_0x6f94('0x8b'),_0x6f94('0x2e'),_0x6f94('0x86'),util[_0x6f94('0x85')](_0x15936f[_0x6f94('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x2fdd77;}})[_0x6f94('0x21')](respondWithResult(_0x54cb12,null))['catch'](handleError(_0x54cb12,null));}; \ No newline at end of file +var _0xdf70=['get','WhatsappInteraction','WhatsappInteractionId','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','SIP/%s','channel','event','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','motionChannel','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','sendStatus','stack','name','index','map','WhatsappMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','create','body','find','destroy','describe','../../config/logger','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent'];(function(_0x18cbec,_0x1f8da8){var _0x5d1909=function(_0x6c2c32){while(--_0x6c2c32){_0x18cbec['push'](_0x18cbec['shift']());}};_0x5d1909(++_0x1f8da8);}(_0xdf70,0x1c2));var _0x0df7=function(_0x31ecbe,_0x5a424f){_0x31ecbe=_0x31ecbe-0x0;var _0x62cb0d=_0xdf70[_0x31ecbe];return _0x62cb0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0df7('0x0'));var zipdir=require(_0x0df7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0df7('0x2'));var moment=require(_0x0df7('0x3'));var BPromise=require(_0x0df7('0x4'));var Mustache=require(_0x0df7('0x5'));var util=require(_0x0df7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0df7('0x7'));var ejs=require(_0x0df7('0x8'));var fs=require('fs');var fs_extra=require(_0x0df7('0x9'));var _=require('lodash');var squel=require(_0x0df7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0df7('0x7'));var querystring=require('querystring');var Papa=require(_0x0df7('0xb'));var Redis=require(_0x0df7('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x0df7('0xd'));var as=require(_0x0df7('0xe'));var hardwareService=require(_0x0df7('0xf'));var logger=require('../../config/logger')(_0x0df7('0x10'));var utils=require(_0x0df7('0x11'));var config=require(_0x0df7('0x12'));var licenseUtil=require(_0x0df7('0x13'));var db=require(_0x0df7('0x14'))['db'];config[_0x0df7('0x15')]=_[_0x0df7('0x16')](config[_0x0df7('0x15')],{'host':_0x0df7('0x17'),'port':0x18eb});var socket=require(_0x0df7('0x18'))(new Redis(config['redis']));require(_0x0df7('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0df7('0x1a')][_0x0df7('0x1b')]({'port':0x232c});var client9002=jayson[_0x0df7('0x1a')][_0x0df7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x48cc2d,_0x5c5382,_0x302cc6,_0x181b8f){return new BPromise(function(_0x3ed7c6,_0x51c779){var _0x565e80=_0x181b8f||client;return _0x565e80[_0x0df7('0x1c')](_0x48cc2d,_0x302cc6)[_0x0df7('0x1d')](function(_0x83adca){logger[_0x0df7('0x1e')](_0x0df7('0x1f'),_0x5c5382,_0x0df7('0x20'));logger[_0x0df7('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5c5382,_0x0df7('0x20'),JSON[_0x0df7('0x22')](_0x83adca));if(_0x83adca[_0x0df7('0x23')]){if(_0x83adca[_0x0df7('0x23')][_0x0df7('0x24')]===0x1f4){logger['error'](_0x0df7('0x1f'),_0x5c5382,_0x83adca[_0x0df7('0x23')][_0x0df7('0x25')]);return _0x51c779(_0x83adca[_0x0df7('0x23')][_0x0df7('0x25')]);}logger[_0x0df7('0x23')](_0x0df7('0x1f'),_0x5c5382,_0x83adca[_0x0df7('0x23')]['message']);return _0x3ed7c6(_0x83adca[_0x0df7('0x23')][_0x0df7('0x25')]);}else{logger['info'](_0x0df7('0x1f'),_0x5c5382,_0x0df7('0x20'));_0x3ed7c6(_0x83adca[_0x0df7('0x26')]['message']);}})[_0x0df7('0x27')](function(_0x1f0e35){logger[_0x0df7('0x23')](_0x0df7('0x1f'),_0x5c5382,_0x1f0e35);_0x51c779(_0x1f0e35);});});}function respondWithStatusCode(_0x2de43c,_0x127de0){_0x127de0=_0x127de0||0xcc;return function(_0x1037d7){if(_0x1037d7){return _0x2de43c['sendStatus'](_0x127de0);}return _0x2de43c['status'](_0x127de0)[_0x0df7('0x28')]();};}function respondWithResult(_0x402d62,_0x3bb88a){_0x3bb88a=_0x3bb88a||0xc8;return function(_0x7e3f11){if(_0x7e3f11){return _0x402d62['status'](_0x3bb88a)[_0x0df7('0x29')](_0x7e3f11);}};}function respondWithFilteredResult(_0x2759a1,_0x597982){return function(_0x56c36d){if(_0x56c36d){var _0x175041=typeof _0x597982[_0x0df7('0x2a')]===_0x0df7('0x2b')&&typeof _0x597982[_0x0df7('0x2c')]===_0x0df7('0x2b');var _0x4995a2=_0x56c36d[_0x0df7('0x2d')];var _0x307e74=_0x175041?0x0:_0x597982[_0x0df7('0x2a')];var _0x505138=_0x175041?_0x56c36d[_0x0df7('0x2d')]:_0x597982[_0x0df7('0x2a')]+_0x597982[_0x0df7('0x2c')];var _0x4f7a2a;if(_0x505138>=_0x4995a2){_0x505138=_0x4995a2;_0x4f7a2a=0xc8;}else{_0x4f7a2a=0xce;}_0x2759a1[_0x0df7('0x2e')](_0x4f7a2a);return _0x2759a1[_0x0df7('0x2f')](_0x0df7('0x30'),_0x307e74+'-'+_0x505138+'/'+_0x4995a2)['json'](_0x56c36d);}return null;};}function patchUpdates(_0x2c4a4d){return function(_0x2cca03){try{jsonpatch[_0x0df7('0x31')](_0x2cca03,_0x2c4a4d,!![]);}catch(_0x573474){return BPromise[_0x0df7('0x32')](_0x573474);}return _0x2cca03['save']();};}function saveUpdates(_0x1f57ff,_0x500316){return function(_0x198e05){if(_0x198e05){return _0x198e05[_0x0df7('0x33')](_0x1f57ff)['then'](function(_0x569cdf){return _0x569cdf;});}return null;};}function removeEntity(_0x498107,_0x53c205){return function(_0x47e72e){if(_0x47e72e){return _0x47e72e['destroy']()[_0x0df7('0x1d')](function(){_0x498107[_0x0df7('0x2e')](0xcc)[_0x0df7('0x28')]();});}};}function handleEntityNotFound(_0x14a544,_0x2f72e2){return function(_0x1b0c8c){if(!_0x1b0c8c){_0x14a544[_0x0df7('0x34')](0x194);}return _0x1b0c8c;};}function handleError(_0x1c65b4,_0x3e85d5){_0x3e85d5=_0x3e85d5||0x1f4;return function(_0x35e3d7){logger[_0x0df7('0x23')](_0x35e3d7[_0x0df7('0x35')]);if(_0x35e3d7['name']){delete _0x35e3d7[_0x0df7('0x36')];}_0x1c65b4[_0x0df7('0x2e')](_0x3e85d5)['send'](_0x35e3d7);};}exports[_0x0df7('0x37')]=function(_0x3d7ff4,_0x4d68d1){var _0x333e27={},_0x220963={},_0x4acb44={'count':0x0,'rows':[]};var _0x2a8091=_[_0x0df7('0x38')](db[_0x0df7('0x39')]['rawAttributes'],function(_0x30a630){return{'name':_0x30a630[_0x0df7('0x3a')],'type':_0x30a630['type'][_0x0df7('0x3b')]};});_0x220963[_0x0df7('0x3c')]=_[_0x0df7('0x38')](_0x2a8091,_0x0df7('0x36'));_0x220963[_0x0df7('0x3d')]=_[_0x0df7('0x3e')](_0x3d7ff4[_0x0df7('0x3d')]);_0x220963[_0x0df7('0x3f')]=_[_0x0df7('0x40')](_0x220963[_0x0df7('0x3c')],_0x220963['query']);_0x333e27[_0x0df7('0x41')]=_[_0x0df7('0x40')](_0x220963[_0x0df7('0x3c')],qs['fields'](_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x42')]));_0x333e27[_0x0df7('0x41')]=_0x333e27[_0x0df7('0x41')]['length']?_0x333e27[_0x0df7('0x41')]:_0x220963[_0x0df7('0x3c')];if(!_0x3d7ff4['query'][_0x0df7('0x43')](_0x0df7('0x44'))){_0x333e27[_0x0df7('0x2c')]=qs[_0x0df7('0x2c')](_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x2c')]);_0x333e27[_0x0df7('0x2a')]=qs['offset'](_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x2a')]);}_0x333e27[_0x0df7('0x45')]=qs['sort'](_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x46')]);_0x333e27[_0x0df7('0x47')]=qs[_0x0df7('0x3f')](_[_0x0df7('0x48')](_0x3d7ff4[_0x0df7('0x3d')],_0x220963[_0x0df7('0x3f')]),_0x2a8091);if(_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x49')]){_0x333e27['where']=_[_0x0df7('0x4a')](_0x333e27[_0x0df7('0x47')],{'$or':_['map'](_0x2a8091,function(_0x26ef1b){if(_0x26ef1b[_0x0df7('0x4b')]!==_0x0df7('0x4c')){var _0x101121={};_0x101121[_0x26ef1b[_0x0df7('0x36')]]={'$like':'%'+_0x3d7ff4[_0x0df7('0x3d')]['filter']+'%'};return _0x101121;}})});}_0x333e27=_['merge']({},_0x333e27,_0x3d7ff4[_0x0df7('0x4d')]);var _0x3b9fda={'where':_0x333e27[_0x0df7('0x47')]};return db[_0x0df7('0x39')][_0x0df7('0x2d')](_0x3b9fda)[_0x0df7('0x1d')](function(_0x5185fe){_0x4acb44[_0x0df7('0x2d')]=_0x5185fe;if(_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x4e')]){_0x333e27[_0x0df7('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x0df7('0x50')](_0x333e27);})[_0x0df7('0x1d')](function(_0x242eeb){_0x4acb44['rows']=_0x242eeb;return _0x4acb44;})[_0x0df7('0x1d')](respondWithFilteredResult(_0x4d68d1,_0x333e27))['catch'](handleError(_0x4d68d1,null));};exports['show']=function(_0x2000d1,_0xdccd2e){var _0x3130d4={'raw':!![],'where':{'id':_0x2000d1[_0x0df7('0x51')]['id']}},_0x13691a={};_0x13691a['model']=_['keys'](db[_0x0df7('0x39')][_0x0df7('0x52')]);_0x13691a[_0x0df7('0x3d')]=_[_0x0df7('0x3e')](_0x2000d1[_0x0df7('0x3d')]);_0x13691a['filters']=_[_0x0df7('0x40')](_0x13691a[_0x0df7('0x3c')],_0x13691a[_0x0df7('0x3d')]);_0x3130d4[_0x0df7('0x41')]=_[_0x0df7('0x40')](_0x13691a[_0x0df7('0x3c')],qs['fields'](_0x2000d1['query'][_0x0df7('0x42')]));_0x3130d4['attributes']=_0x3130d4[_0x0df7('0x41')]['length']?_0x3130d4[_0x0df7('0x41')]:_0x13691a[_0x0df7('0x3c')];if(_0x2000d1[_0x0df7('0x3d')][_0x0df7('0x4e')]){_0x3130d4[_0x0df7('0x4f')]=[{'all':!![]}];}_0x3130d4=_[_0x0df7('0x4a')]({},_0x3130d4,_0x2000d1[_0x0df7('0x4d')]);return db[_0x0df7('0x39')]['find'](_0x3130d4)['then'](handleEntityNotFound(_0xdccd2e,null))['then'](respondWithResult(_0xdccd2e,null))[_0x0df7('0x27')](handleError(_0xdccd2e,null));};exports[_0x0df7('0x53')]=function(_0x2b9bd7,_0x325fd3){return db[_0x0df7('0x39')][_0x0df7('0x53')](_0x2b9bd7[_0x0df7('0x54')],{})[_0x0df7('0x1d')](respondWithResult(_0x325fd3,0xc9))[_0x0df7('0x27')](handleError(_0x325fd3,null));};exports[_0x0df7('0x33')]=function(_0x2a6b9a,_0x30bbec){if(_0x2a6b9a['body']['id']){delete _0x2a6b9a[_0x0df7('0x54')]['id'];}return db[_0x0df7('0x39')][_0x0df7('0x55')]({'where':{'id':_0x2a6b9a[_0x0df7('0x51')]['id']}})['then'](handleEntityNotFound(_0x30bbec,null))[_0x0df7('0x1d')](saveUpdates(_0x2a6b9a['body'],null))[_0x0df7('0x1d')](respondWithResult(_0x30bbec,null))[_0x0df7('0x27')](handleError(_0x30bbec,null));};exports[_0x0df7('0x56')]=function(_0xcad2f,_0x5d4b09){return db[_0x0df7('0x39')]['find']({'where':{'id':_0xcad2f[_0x0df7('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d4b09,null))[_0x0df7('0x1d')](removeEntity(_0x5d4b09,null))[_0x0df7('0x27')](handleError(_0x5d4b09,null));};exports['describe']=function(_0xe0f42,_0x4d2874){return db[_0x0df7('0x39')][_0x0df7('0x57')]()[_0x0df7('0x1d')](respondWithResult(_0x4d2874,null))[_0x0df7('0x27')](handleError(_0x4d2874,null));};var interaction_log=require(_0x0df7('0x58'))(_0x0df7('0x59'));exports['accept']=function(_0x480d46,_0x5da60e,_0x106a52){var _0x4855d5={'agent':{},'channel':_0x0df7('0x5a')};if(_0x480d46[_0x0df7('0x54')]['id']){delete _0x480d46[_0x0df7('0x54')]['id'];}_0x480d46[_0x0df7('0x54')][_0x0df7('0x5b')]=!![];_0x480d46['body'][_0x0df7('0x5c')]=moment()[_0x0df7('0x5d')](_0x0df7('0x5e'));_0x480d46['body'][_0x0df7('0x5f')]=_0x480d46[_0x0df7('0x54')]['UserId']||_0x480d46[_0x0df7('0x60')]['id'];_0x4855d5[_0x0df7('0x61')]['id']=_0x480d46['body'][_0x0df7('0x5f')];return db[_0x0df7('0x39')][_0x0df7('0x55')]({'where':{'id':_0x480d46[_0x0df7('0x51')]['id'],'UserId':null}})[_0x0df7('0x1d')](handleEntityNotFound(_0x5da60e,null))[_0x0df7('0x1d')](saveUpdates(_0x480d46['body'],null))[_0x0df7('0x1d')](function(_0x167a8e){if(_0x167a8e){_0x4855d5['message']=_0x167a8e[_0x0df7('0x62')]({'plain':!![]});return db[_0x0df7('0x63')][_0x0df7('0x55')]({'where':{'id':_0x167a8e[_0x0df7('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x5da60e,null))[_0x0df7('0x1d')](function(_0x527c8e){if(_0x527c8e){return _0x527c8e[_0x0df7('0x33')]({'UserId':_0x480d46[_0x0df7('0x54')][_0x0df7('0x5f')],'read1stAt':_['isNil'](_0x527c8e[_0x0df7('0x65')])?moment()[_0x0df7('0x5d')](_0x0df7('0x5e')):undefined});}return null;})['then'](function(_0x435194){if(_0x435194){_0x4855d5['interaction']=_0x435194['get']({'plain':!![]});interaction_log[_0x0df7('0x1e')](_0x0df7('0x66'),_0x480d46[_0x0df7('0x60')]['id'],_0x480d46[_0x0df7('0x60')][_0x0df7('0x36')],_0x480d46[_0x0df7('0x60')][_0x0df7('0x67')],_0x4855d5[_0x0df7('0x68')]['id'],_0x480d46['body']?JSON['stringify'](_0x480d46[_0x0df7('0x54')]):_0x0df7('0x69'));return respondWithRpcPromise(_0x0df7('0x6a'),_0x0df7('0x6b'),_0x4855d5);}return null;})[_0x0df7('0x1d')](function(_0xbc6440){var _0x214351='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xbc6440[_0x0df7('0x25')][_0x0df7('0x6c')];return db[_0x0df7('0x6d')][_0x0df7('0x3d')](_0x214351,{'type':db[_0x0df7('0x6e')][_0x0df7('0x6f')][_0x0df7('0x70')],'raw':!![]})[_0x0df7('0x1d')](function(_0x3116b5){return _0x3116b5;});})['then'](function(_0x562835){if(_0x562835){_0x4855d5[_0x0df7('0x25')][_0x0df7('0x71')]=_0x562835[0x0];if(!_0x480d46['body'][_0x0df7('0x5f')])return;return db[_0x0df7('0x72')][_0x0df7('0x55')]({'where':{'id':_0x480d46[_0x0df7('0x54')][_0x0df7('0x5f')],'role':_0x0df7('0x61')},'attributes':['id',_0x0df7('0x36'),'fullname',_0x0df7('0x73'),_0x0df7('0x74')],'raw':!![]});}return null;})[_0x0df7('0x1d')](function(_0x3da5cf){if(!_0x3da5cf)return null;_0x4855d5[_0x0df7('0x25')][_0x0df7('0x61')]=_0x3da5cf;return _0x4855d5;})['then'](function(_0x45eebc){if(_0x45eebc){if(_0x480d46[_0x0df7('0x54')]['manual']){_0x4855d5[_0x0df7('0x25')]['interface']=util[_0x0df7('0x5d')](_0x0df7('0x75'),_0x480d46['user'][_0x0df7('0x36')]);_0x4855d5[_0x0df7('0x25')][_0x0df7('0x76')]=_0x4855d5['channel'];_0x4855d5[_0x0df7('0x25')]['motionChannel']=_0x4855d5[_0x0df7('0x76')];_0x4855d5['message'][_0x0df7('0x77')]=_0x0df7('0x78');return respondWithRpcPromise(_0x0df7('0x79'),_0x0df7('0x79'),{'event':_0x0df7('0x7a'),'message':_0x4855d5['message']},client9002)[_0x0df7('0x1d')](function(){return _0x4855d5;});}return _0x4855d5;}return null;})[_0x0df7('0x1d')](respondWithResult(_0x5da60e,null))[_0x0df7('0x27')](handleError(_0x5da60e,null));};var interaction_log=require(_0x0df7('0x58'))('whatsapp-interactions');exports[_0x0df7('0x32')]=function(_0x495273,_0x402b45,_0x5173f9){var _0x1e80dc={'agent':{},'channel':_0x0df7('0x5a')};if(_0x495273[_0x0df7('0x54')]['id']){delete _0x495273['body']['id'];}_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')]=_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')]||_0x495273['user']['id'];_0x1e80dc[_0x0df7('0x61')]['id']=_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')];return db[_0x0df7('0x39')]['find']({'where':{'id':_0x495273[_0x0df7('0x51')]['id'],'UserId':null}})[_0x0df7('0x1d')](handleEntityNotFound(_0x402b45,null))[_0x0df7('0x1d')](function(_0x2ed2b4){if(_0x2ed2b4){_0x1e80dc[_0x0df7('0x25')]=_0x2ed2b4[_0x0df7('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x0df7('0x55')]({'where':{'id':_0x2ed2b4[_0x0df7('0x64')]}});}return null;})[_0x0df7('0x1d')](handleEntityNotFound(_0x402b45,null))[_0x0df7('0x1d')](function(_0x3e4c87){if(_0x3e4c87){_0x1e80dc[_0x0df7('0x68')]=_0x3e4c87['get']({'plain':!![]});interaction_log[_0x0df7('0x1e')](_0x0df7('0x7b'),_0x495273[_0x0df7('0x60')]['id'],_0x495273[_0x0df7('0x60')][_0x0df7('0x36')],_0x495273['user'][_0x0df7('0x67')],_0x1e80dc[_0x0df7('0x68')]['id'],_0x495273['body']?JSON[_0x0df7('0x22')](_0x495273[_0x0df7('0x54')]):_0x0df7('0x69'));return respondWithRpcPromise(_0x0df7('0x7c'),_0x0df7('0x7d'),_0x1e80dc);}return null;})[_0x0df7('0x1d')](function(_0x4f4898){var _0x332f02=_0x0df7('0x7e')+_0x4f4898[_0x0df7('0x25')][_0x0df7('0x6c')];return db[_0x0df7('0x6d')][_0x0df7('0x3d')](_0x332f02,{'type':db[_0x0df7('0x6e')][_0x0df7('0x6f')][_0x0df7('0x70')],'raw':!![]})[_0x0df7('0x1d')](function(_0x19f02a){return _0x19f02a;});})[_0x0df7('0x1d')](function(_0x461ecc){if(_0x461ecc){_0x1e80dc[_0x0df7('0x25')][_0x0df7('0x71')]=_0x461ecc[0x0];if(!_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')])return;return db['User'][_0x0df7('0x55')]({'where':{'id':_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')],'role':_0x0df7('0x61')},'attributes':['id',_0x0df7('0x36'),'fullname',_0x0df7('0x73'),_0x0df7('0x74')],'raw':!![]});}return null;})[_0x0df7('0x1d')](function(_0x467db9){if(!_0x467db9)return null;_0x1e80dc[_0x0df7('0x25')][_0x0df7('0x61')]=_0x467db9;return _0x1e80dc;})['then'](function(_0x260217){if(_0x260217){_0x260217[_0x0df7('0x25')][_0x0df7('0x7f')]=util[_0x0df7('0x5d')](_0x0df7('0x75'),_0x495273['user'][_0x0df7('0x36')]);_0x260217['message']['channel']=_0x1e80dc[_0x0df7('0x76')];_0x260217['message'][_0x0df7('0x80')]=_0x1e80dc['channel'];_0x260217[_0x0df7('0x25')]['event']='reject';respondWithRpcPromise('EventManager',_0x0df7('0x79'),{'event':_0x0df7('0x81'),'message':_0x260217[_0x0df7('0x25')]},client9002);return _0x1e80dc;}return null;})[_0x0df7('0x1d')](respondWithResult(_0x402b45,null))[_0x0df7('0x27')](handleError(_0x402b45,null));};exports[_0x0df7('0x2e')]=function(_0x458374,_0x182638,_0x57a8ac){if(_0x458374[_0x0df7('0x54')]['id']){delete _0x458374['body']['id'];}var _0x47b70c;return db[_0x0df7('0x39')]['find']({'where':{'id':_0x458374[_0x0df7('0x51')]['id']}})[_0x0df7('0x1d')](handleEntityNotFound(_0x182638,null))[_0x0df7('0x1d')](function(_0x12a687){if(_0x12a687){_0x47b70c=_0x12a687;return db['WhatsappAccount'][_0x0df7('0x55')]({'where':{'id':_0x12a687['WhatsappAccountId']}});}})[_0x0df7('0x1d')](handleEntityNotFound(_0x182638,null))[_0x0df7('0x1d')](function(_0x59b802){if(_0x59b802){logger[_0x0df7('0x21')](_0x0df7('0x82'),_0x0df7('0x2e'),_0x0df7('0x83'),_0x59b802[_0x0df7('0x4b')],util['inspect'](_0x458374['body'],{'showHidden':![],'depth':null}));switch(_0x59b802[_0x0df7('0x4b')]){case _0x0df7('0x84'):if(_0x458374[_0x0df7('0x54')]['MessageSid']&&_0x458374[_0x0df7('0x54')][_0x0df7('0x85')]===_0x47b70c['messageId']&&_0x458374['body'][_0x0df7('0x86')]&&_0x458374[_0x0df7('0x54')]['MessageStatus']===_0x0df7('0x5b')){return _0x47b70c[_0x0df7('0x33')]({'read':!![]});}else{logger[_0x0df7('0x23')](_0x0df7('0x87'),_0x0df7('0x2e'),_0x0df7('0x84'),util[_0x0df7('0x88')](_0x458374['body'],{'showHidden':![],'depth':null}));}break;}return _0x47b70c;}})[_0x0df7('0x1d')](respondWithResult(_0x182638,null))[_0x0df7('0x27')](handleError(_0x182638,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3f11a92..c7a5154 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 _0x76dc=['emit','hasOwnProperty','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove'];(function(_0x2c84a6,_0x2bd40b){var _0x33297f=function(_0x304619){while(--_0x304619){_0x2c84a6['push'](_0x2c84a6['shift']());}};_0x33297f(++_0x2bd40b);}(_0x76dc,0x1f2));var _0xc76d=function(_0x471613,_0x3c5254){_0x471613=_0x471613-0x0;var _0x274eb9=_0x76dc[_0x471613];return _0x274eb9;};'use strict';var EventEmitter=require(_0xc76d('0x0'));var WhatsappMessage=require(_0xc76d('0x1'))['db'][_0xc76d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc76d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc76d('0x4'),'afterDestroy':_0xc76d('0x5')};function emitEvent(_0x5cff74){return function(_0x300f11,_0x50ed3a,_0x507ea7){WhatsappMessageEvents[_0xc76d('0x6')](_0x5cff74+':'+_0x300f11['id'],_0x300f11);WhatsappMessageEvents[_0xc76d('0x6')](_0x5cff74,_0x300f11);_0x507ea7(null);};}for(var e in events){if(events[_0xc76d('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x8580=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x8580,0x1c7));var _0x0858=function(_0x557e10,_0x4b2740){_0x557e10=_0x557e10-0x0;var _0x57ad32=_0x8580[_0x557e10];return _0x57ad32;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x0858('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0858('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0858('0x2')};function emitEvent(_0x22550c){return function(_0x55aab5,_0x6928ba,_0xa857b7){WhatsappMessageEvents['emit'](_0x22550c+':'+_0x55aab5['id'],_0x55aab5);WhatsappMessageEvents[_0x0858('0x3')](_0x22550c,_0x55aab5);_0xa857b7(null);};}for(var e in events){if(events[_0x0858('0x4')](e)){var event=events[e];WhatsappMessage[_0x0858('0x5')](e,emitEvent(event));}}module[_0x0858('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 4c1a13e..7f2432b 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 _0xd2d6=['/messages/','text','POST','Bearer\x20','statuses','message_id','utf8mb4','lodash','util','../../config/logger','moment','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','body','models','direction','secret','isNil','UserId','findOne','WhatsappInteractionId','update','createdAt','toLowerCase','error','out','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','then','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2d6,0xa3));var _0x6d2d=function(_0x202499,_0x17f225){_0x202499=_0x202499-0x0;var _0x21da7c=_0xd2d6[_0x202499];return _0x21da7c;};'use strict';var _=require(_0x6d2d('0x0'));var util=require(_0x6d2d('0x1'));var logger=require(_0x6d2d('0x2'))('api');var moment=require(_0x6d2d('0x3'));var BPromise=require(_0x6d2d('0x4'));var rp=require('request-promise');var fetch=require(_0x6d2d('0x5'));var fs=require('fs');var path=require(_0x6d2d('0x6'));var rimraf=require(_0x6d2d('0x7'));var config=require(_0x6d2d('0x8'));var attributes=require(_0x6d2d('0x9'));module[_0x6d2d('0xa')]=function(_0x3575eb,_0x462b1e){return _0x3575eb['define']('WhatsappMessage',attributes,{'tableName':_0x6d2d('0xb'),'paranoid':![],'indexes':[{'name':_0x6d2d('0xc'),'fields':[_0x6d2d('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x6d2d('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3be0a1,_0xe8381f,_0x44ed8f){var _0x4ee984=_0x3575eb[_0x6d2d('0xe')];var _0x1402c=_0x3be0a1['get']({'plain':!![]});if(_0x1402c['direction']['toLowerCase']()==='in'||_0x1402c[_0x6d2d('0xf')]['toLowerCase']()==='out'&&!_0x1402c[_0x6d2d('0x10')]&&!_[_0x6d2d('0x11')](_0x1402c[_0x6d2d('0x12')])){_0x4ee984['WhatsappInteraction'][_0x6d2d('0x13')]({'where':{'id':_0x1402c[_0x6d2d('0x14')]}})['then'](function(_0x192086){if(_0x192086){_0x192086[_0x6d2d('0x15')]({'lastMsgAt':_0x1402c[_0x6d2d('0x16')],'lastMsgDirection':_0x1402c[_0x6d2d('0xf')][_0x6d2d('0x17')]()});}})['catch'](function(_0x667698){console[_0x6d2d('0x18')](_0x667698);});}if(_0x1402c[_0x6d2d('0xf')]===_0x6d2d('0x19')&&!_0x1402c[_0x6d2d('0x10')]){var _0x44d4e8;_0x4ee984['WhatsappAccount']['find']({'where':{'id':_0x1402c[_0x6d2d('0x1a')]},'raw':!![]})['then'](function(_0x35886d){_0x44d4e8=_0x35886d;if(_0x44d4e8&&_0x44d4e8['type']){switch(_0x44d4e8[_0x6d2d('0x1b')]){case _0x6d2d('0x1c'):var _0x52aebc=require(_0x6d2d('0x1c'));if(_0x44d4e8[_0x6d2d('0x1d')]&&_0x44d4e8[_0x6d2d('0x1e')]&&_0x44d4e8[_0x6d2d('0x1f')]){var _0x3d8751=new _0x52aebc(_0x44d4e8['accountSid'],_0x44d4e8[_0x6d2d('0x1e')]);_0x3d8751['messages'][_0x6d2d('0x20')]({'body':_0x1402c[_0x6d2d('0xd')],'to':_0x6d2d('0x21')+_0x1402c['phone'],'from':_0x6d2d('0x21')+_0x44d4e8[_0x6d2d('0x1f')],'statusCallback':_0x44d4e8['remote']+_0x6d2d('0x22')+_0x1402c['id']+_0x6d2d('0x23')+_0x44d4e8[_0x6d2d('0x24')]})[_0x6d2d('0x25')](function(_0x173bec){if(_0x173bec['sid']){return _0x3be0a1[_0x6d2d('0x15')]({'messageId':_0x173bec['sid']});}})[_0x6d2d('0x26')](function(_0x753623){logger['error'](_0x6d2d('0x27'),_0x6d2d('0x28'),_0x6d2d('0x1c'),util[_0x6d2d('0x29')](_0x753623,{'showHidden':![],'depth':null}));});}else{logger[_0x6d2d('0x18')](_0x6d2d('0x27'),_0x6d2d('0x28'),_0x6d2d('0x1c'),_0x6d2d('0x2a'));}break;case _0x6d2d('0x2b'):var _0x1d656d=_0x44d4e8[_0x6d2d('0x1d')];var _0x3e1e7a=_0x44d4e8[_0x6d2d('0x1e')];var _0x2dd275=_0x44d4e8[_0x6d2d('0x2c')]+'/whatsapp/v1/'+_0x1d656d+_0x6d2d('0x2d');var _0x2e14b5={'to':[_0x1402c['phone']],'message':{'type':_0x6d2d('0x2e'),'text':_0x1402c[_0x6d2d('0xd')]}};var _0x559a9b={'method':_0x6d2d('0x2f'),'uri':_0x2dd275,'headers':{'Authorization':_0x6d2d('0x30')+_0x3e1e7a,'Content-Type':'application/json'},'body':_0x2e14b5,'json':!![]};rp(_0x559a9b)[_0x6d2d('0x25')](function(_0xc376dc){if(_0xc376dc[_0x6d2d('0x31')][0x0][_0x6d2d('0x32')]){return _0x3be0a1[_0x6d2d('0x15')]({'messageId':_0xc376dc[_0x6d2d('0x31')][0x0][_0x6d2d('0x32')]});}})[_0x6d2d('0x26')](function(_0x3508fb){logger['err']('WhatsappMessage,\x20%s',_0x3508fb);});break;}}})['finally'](function(){_0x44ed8f();});}else{_0x44ed8f();}}},'charset':_0x6d2d('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf878=['WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','token','sid','catch','inspect','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','utf8mb4','../../config/logger','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','then','update'];(function(_0x4018fd,_0x4c744d){var _0x2bb6c6=function(_0x21389e){while(--_0x21389e){_0x4018fd['push'](_0x4018fd['shift']());}};_0x2bb6c6(++_0x4c744d);}(_0xf878,0x88));var _0x8f87=function(_0x4bf23b,_0x30882f){_0x4bf23b=_0x4bf23b-0x0;var _0x24c961=_0xf878[_0x4bf23b];return _0x24c961;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f87('0x0'))('api');var moment=require(_0x8f87('0x1'));var BPromise=require(_0x8f87('0x2'));var rp=require(_0x8f87('0x3'));var fetch=require(_0x8f87('0x4'));var fs=require('fs');var path=require(_0x8f87('0x5'));var rimraf=require('rimraf');var config=require(_0x8f87('0x6'));var attributes=require(_0x8f87('0x7'));module[_0x8f87('0x8')]=function(_0x2f4ab5,_0x3fa6a9){return _0x2f4ab5[_0x8f87('0x9')](_0x8f87('0xa'),attributes,{'tableName':_0x8f87('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8f87('0xc')]},{'name':_0x8f87('0xd'),'fields':[_0x8f87('0xe')],'type':_0x8f87('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1048dd,_0x35f386,_0x2444e6){var _0x65cb21=_0x2f4ab5['models'];var _0x59beac=_0x1048dd[_0x8f87('0x10')]({'plain':!![]});if(_0x59beac[_0x8f87('0x11')]['toLowerCase']()==='in'||_0x59beac['direction'][_0x8f87('0x12')]()===_0x8f87('0x13')&&!_0x59beac[_0x8f87('0x14')]&&!_[_0x8f87('0x15')](_0x59beac[_0x8f87('0x16')])){_0x65cb21[_0x8f87('0x17')]['findOne']({'where':{'id':_0x59beac['WhatsappInteractionId']}})[_0x8f87('0x18')](function(_0x2afa9b){if(_0x2afa9b){_0x2afa9b[_0x8f87('0x19')]({'lastMsgAt':_0x59beac['createdAt'],'lastMsgDirection':_0x59beac['direction'][_0x8f87('0x12')]()});}})['catch'](function(_0x13f9d2){console['error'](_0x13f9d2);});}if(_0x59beac[_0x8f87('0x11')]===_0x8f87('0x13')&&!_0x59beac[_0x8f87('0x14')]){var _0x5da708;_0x65cb21[_0x8f87('0x1a')][_0x8f87('0x1b')]({'where':{'id':_0x59beac[_0x8f87('0x1c')]},'raw':!![]})[_0x8f87('0x18')](function(_0x7e63ac){_0x5da708=_0x7e63ac;if(_0x5da708&&_0x5da708[_0x8f87('0x1d')]){switch(_0x5da708[_0x8f87('0x1d')]){case'twilio':var _0x109e2b=require(_0x8f87('0x1e'));if(_0x5da708[_0x8f87('0x1f')]&&_0x5da708[_0x8f87('0x20')]&&_0x5da708['phone']){var _0x1a8153=new _0x109e2b(_0x5da708['accountSid'],_0x5da708[_0x8f87('0x20')]);_0x1a8153[_0x8f87('0x21')][_0x8f87('0x22')]({'body':_0x59beac[_0x8f87('0xe')],'to':_0x8f87('0x23')+_0x59beac[_0x8f87('0x24')],'from':_0x8f87('0x23')+_0x5da708[_0x8f87('0x24')],'statusCallback':_0x5da708[_0x8f87('0x25')]+'/api/whatsapp/messages/'+_0x59beac['id']+'/status?token='+_0x5da708[_0x8f87('0x26')]})[_0x8f87('0x18')](function(_0x4c7fe9){if(_0x4c7fe9[_0x8f87('0x27')]){return _0x1048dd['update']({'messageId':_0x4c7fe9[_0x8f87('0x27')]});}})[_0x8f87('0x28')](function(_0x25bc47){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8f87('0x1e'),util[_0x8f87('0x29')](_0x25bc47,{'showHidden':![],'depth':null}));});}else{logger[_0x8f87('0x2a')](_0x8f87('0x2b'),'afterCreate',_0x8f87('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x8f87('0x2c'):var _0x1b0f72=_0x5da708[_0x8f87('0x1f')];var _0x5a7705=_0x5da708[_0x8f87('0x20')];var _0x33b112=_0x5da708['baseUrl']+'/whatsapp/v1/'+_0x1b0f72+_0x8f87('0x2d');var _0x546d5f={'to':[_0x59beac[_0x8f87('0x24')]],'message':{'type':_0x8f87('0x2e'),'text':_0x59beac['body']}};var _0x31c9b5={'method':_0x8f87('0x2f'),'uri':_0x33b112,'headers':{'Authorization':_0x8f87('0x30')+_0x5a7705,'Content-Type':_0x8f87('0x31')},'body':_0x546d5f,'json':!![]};rp(_0x31c9b5)[_0x8f87('0x18')](function(_0xb81f17){if(_0xb81f17[_0x8f87('0x32')][0x0][_0x8f87('0x33')]){return _0x1048dd[_0x8f87('0x19')]({'messageId':_0xb81f17[_0x8f87('0x32')][0x0]['message_id']});}})[_0x8f87('0x28')](function(_0x8b55e6){logger[_0x8f87('0x34')]('WhatsappMessage,\x20%s',_0x8b55e6);});break;}}})['finally'](function(){_0x2444e6();});}else{_0x2444e6();}}},'charset':_0x8f87('0x35'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0d75705..35499e5 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 _0xcd7e=['create','body','options','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateWhatsappMessage','WhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd7e,0xcb));var _0xecd7=function(_0x2dacca,_0x3b55a5){_0x2dacca=_0x2dacca-0x0;var _0x4e8745=_0xcd7e[_0x2dacca];return _0x4e8745;};'use strict';var _=require('lodash');var util=require(_0xecd7('0x0'));var moment=require(_0xecd7('0x1'));var BPromise=require('bluebird');var rs=require(_0xecd7('0x2'));var fs=require('fs');var Redis=require(_0xecd7('0x3'));var db=require(_0xecd7('0x4'))['db'];var utils=require(_0xecd7('0x5'));var logger=require(_0xecd7('0x6'))(_0xecd7('0x7'));var config=require(_0xecd7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xecd7('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xecd7('0xa')],{'host':_0xecd7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecd7('0xa')]));require(_0xecd7('0xc'))[_0xecd7('0xd')](socket);function respondWithRpcPromise(_0x31e1a2,_0x36a803,_0x384881){return new BPromise(function(_0x3a1688,_0xf5e80a){return client[_0xecd7('0xe')](_0x31e1a2,_0x384881)[_0xecd7('0xf')](function(_0x3f5361){logger['info'](_0xecd7('0x10'),_0x36a803,_0xecd7('0x11'));logger[_0xecd7('0x12')](_0xecd7('0x13'),_0x36a803,_0xecd7('0x11'),JSON[_0xecd7('0x14')](_0x3f5361));if(_0x3f5361[_0xecd7('0x15')]){if(_0x3f5361['error'][_0xecd7('0x16')]===0x1f4){logger[_0xecd7('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x36a803,_0x3f5361[_0xecd7('0x15')][_0xecd7('0x17')]);return _0xf5e80a(_0x3f5361['error']['message']);}logger[_0xecd7('0x15')](_0xecd7('0x10'),_0x36a803,_0x3f5361[_0xecd7('0x15')][_0xecd7('0x17')]);return _0x3a1688(_0x3f5361['error'][_0xecd7('0x17')]);}else{logger[_0xecd7('0x18')](_0xecd7('0x10'),_0x36a803,_0xecd7('0x11'));_0x3a1688(_0x3f5361[_0xecd7('0x19')][_0xecd7('0x17')]);}})['catch'](function(_0x2f05fa){logger[_0xecd7('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x36a803,_0x2f05fa);_0xf5e80a(_0x2f05fa);});});}exports[_0xecd7('0x1a')]=function(_0x4fbe0d){var _0x224615=this;return new Promise(function(_0xc1d9e0,_0x3f08d1){return db[_0xecd7('0x1b')][_0xecd7('0x1c')](_0x4fbe0d[_0xecd7('0x1d')],{'raw':_0x4fbe0d[_0xecd7('0x1e')]?_0x4fbe0d[_0xecd7('0x1e')][_0xecd7('0x1f')]===undefined?!![]:![]:!![]})[_0xecd7('0xf')](function(_0x4c86f2){logger[_0xecd7('0x18')](_0xecd7('0x1a'),_0x4fbe0d);logger[_0xecd7('0x12')](_0xecd7('0x1a'),_0x4fbe0d,JSON['stringify'](_0x4c86f2));_0xc1d9e0(_0x4c86f2);})[_0xecd7('0x20')](function(_0x1e5db6){logger[_0xecd7('0x15')]('CreateWhatsappMessage',_0x1e5db6[_0xecd7('0x17')],_0x4fbe0d);_0x3f08d1(_0x224615['error'](0x1f4,_0x1e5db6[_0xecd7('0x17')]));});});}; \ No newline at end of file +var _0x234a=['code','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3d2669,_0x4bc81b){var _0x182f03=function(_0x4de18f){while(--_0x4de18f){_0x3d2669['push'](_0x3d2669['shift']());}};_0x182f03(++_0x4bc81b);}(_0x234a,0x15f));var _0xa234=function(_0x433d65,_0x5d119b){_0x433d65=_0x433d65-0x0;var _0x24799c=_0x234a[_0x433d65];return _0x24799c;};'use strict';var _=require(_0xa234('0x0'));var util=require(_0xa234('0x1'));var moment=require(_0xa234('0x2'));var BPromise=require(_0xa234('0x3'));var rs=require(_0xa234('0x4'));var fs=require('fs');var Redis=require(_0xa234('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa234('0x6'));var logger=require('../../config/logger')(_0xa234('0x7'));var config=require(_0xa234('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa234('0x9')][_0xa234('0xa')]({'port':0x232a});config['redis']=_[_0xa234('0xb')](config[_0xa234('0xc')],{'host':_0xa234('0xd'),'port':0x18eb});var socket=require(_0xa234('0xe'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xa234('0xf')](socket);function respondWithRpcPromise(_0x34907b,_0x109af6,_0x1fe0e8){return new BPromise(function(_0x2d77b4,_0x5df477){return client[_0xa234('0x10')](_0x34907b,_0x1fe0e8)[_0xa234('0x11')](function(_0x26311c){logger[_0xa234('0x12')](_0xa234('0x13'),_0x109af6,_0xa234('0x14'));logger[_0xa234('0x15')](_0xa234('0x16'),_0x109af6,'request\x20sent',JSON['stringify'](_0x26311c));if(_0x26311c['error']){if(_0x26311c['error'][_0xa234('0x17')]===0x1f4){logger[_0xa234('0x18')](_0xa234('0x13'),_0x109af6,_0x26311c[_0xa234('0x18')]['message']);return _0x5df477(_0x26311c[_0xa234('0x18')]['message']);}logger['error'](_0xa234('0x13'),_0x109af6,_0x26311c[_0xa234('0x18')][_0xa234('0x19')]);return _0x2d77b4(_0x26311c[_0xa234('0x18')][_0xa234('0x19')]);}else{logger['info'](_0xa234('0x13'),_0x109af6,_0xa234('0x14'));_0x2d77b4(_0x26311c[_0xa234('0x1a')]['message']);}})[_0xa234('0x1b')](function(_0x370226){logger['error'](_0xa234('0x13'),_0x109af6,_0x370226);_0x5df477(_0x370226);});});}exports[_0xa234('0x1c')]=function(_0x196e0b){var _0x4d3c3d=this;return new Promise(function(_0x455f2c,_0x18f6de){return db[_0xa234('0x1d')]['create'](_0x196e0b[_0xa234('0x1e')],{'raw':_0x196e0b[_0xa234('0x1f')]?_0x196e0b[_0xa234('0x1f')][_0xa234('0x20')]===undefined?!![]:![]:!![]})[_0xa234('0x11')](function(_0x5c9bfd){logger[_0xa234('0x12')](_0xa234('0x1c'),_0x196e0b);logger[_0xa234('0x15')]('CreateWhatsappMessage',_0x196e0b,JSON[_0xa234('0x21')](_0x5c9bfd));_0x455f2c(_0x5c9bfd);})[_0xa234('0x1b')](function(_0x2f4ff6){logger[_0xa234('0x18')](_0xa234('0x1c'),_0x2f4ff6[_0xa234('0x19')],_0x196e0b);_0x18f6de(_0x4d3c3d['error'](0x1f4,_0x2f4ff6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 666736e..47c2cd1 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 _0xa3e9=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0x13376c,_0x5e2168){var _0x513d72=function(_0x156b94){while(--_0x156b94){_0x13376c['push'](_0x13376c['shift']());}};_0x513d72(++_0x5e2168);}(_0xa3e9,0x8d));var _0x9a3e=function(_0x4edd45,_0x185604){_0x4edd45=_0x4edd45-0x0;var _0x3ad247=_0xa3e9[_0x4edd45];return _0x3ad247;};'use strict';var WhatsappMessageEvents=require(_0x9a3e('0x0'));var events=['save',_0x9a3e('0x1'),_0x9a3e('0x2')];function createListener(_0x383e06,_0x1aa873){return function(_0x589fd4){_0x1aa873[_0x9a3e('0x3')](_0x383e06,_0x589fd4);};}function removeListener(_0x5a055c,_0x136cd1){return function(){WhatsappMessageEvents[_0x9a3e('0x4')](_0x5a055c,_0x136cd1);};}exports[_0x9a3e('0x5')]=function(_0x271d10){for(var _0x349c03=0x0,_0x518e7d=events[_0x9a3e('0x6')];_0x349c03<_0x518e7d;_0x349c03++){var _0x5bb5cb=events[_0x349c03];var _0x193f0d=createListener(_0x9a3e('0x7')+_0x5bb5cb,_0x271d10);WhatsappMessageEvents['on'](_0x5bb5cb,_0x193f0d);}}; \ No newline at end of file +var _0xbc1d=['register','whatsappMessage:','save','update','removeListener'];(function(_0x50309e,_0x5ab9fb){var _0x4080ae=function(_0x4fa78b){while(--_0x4fa78b){_0x50309e['push'](_0x50309e['shift']());}};_0x4080ae(++_0x5ab9fb);}(_0xbc1d,0x179));var _0xdbc1=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xbc1d[_0x58fc2f];return _0x3a1312;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xdbc1('0x0'),'remove',_0xdbc1('0x1')];function createListener(_0x5d4c00,_0x5777d2){return function(_0x1edeb3){_0x5777d2['emit'](_0x5d4c00,_0x1edeb3);};}function removeListener(_0x3e9e29,_0x393b39){return function(){WhatsappMessageEvents[_0xdbc1('0x2')](_0x3e9e29,_0x393b39);};}exports[_0xdbc1('0x3')]=function(_0x253911){for(var _0x11a6b0=0x0,_0x5ae437=events['length'];_0x11a6b0<_0x5ae437;_0x11a6b0++){var _0x61079=events[_0x11a6b0];var _0x33a575=createListener(_0xdbc1('0x4')+_0x61079,_0x253911);WhatsappMessageEvents['on'](_0x61079,_0x33a575);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 93a2353..aba8dc9 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 _0xe6b3=['/:id','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents'];(function(_0x420a41,_0x18f72a){var _0x328bed=function(_0x3139d8){while(--_0x3139d8){_0x420a41['push'](_0x420a41['shift']());}};_0x328bed(++_0x18f72a);}(_0xe6b3,0x1aa));var _0x3e6b=function(_0x53a285,_0x16a64f){_0x53a285=_0x53a285-0x0;var _0x5f20e9=_0xe6b3[_0x53a285];return _0x5f20e9;};'use strict';var multer=require(_0x3e6b('0x0'));var util=require(_0x3e6b('0x1'));var path=require('path');var timeout=require(_0x3e6b('0x2'));var express=require(_0x3e6b('0x3'));var router=express[_0x3e6b('0x4')]();var fs_extra=require(_0x3e6b('0x5'));var auth=require(_0x3e6b('0x6'));var interaction=require(_0x3e6b('0x7'));var config=require(_0x3e6b('0x8'));var controller=require(_0x3e6b('0x9'));router[_0x3e6b('0xa')]('/',auth[_0x3e6b('0xb')](),controller['index']);router[_0x3e6b('0xa')]('/describe',auth[_0x3e6b('0xb')](),controller[_0x3e6b('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3e6b('0xa')](_0x3e6b('0xd'),auth[_0x3e6b('0xb')](),controller['getMembers']);router[_0x3e6b('0xa')](_0x3e6b('0xe'),auth[_0x3e6b('0xb')](),controller[_0x3e6b('0xf')]);router[_0x3e6b('0xa')](_0x3e6b('0x10'),auth['isAuthenticated'](),controller[_0x3e6b('0x11')]);router[_0x3e6b('0x12')]('/',auth[_0x3e6b('0xb')](),controller[_0x3e6b('0x13')]);router[_0x3e6b('0x12')](_0x3e6b('0xe'),auth[_0x3e6b('0xb')](),controller[_0x3e6b('0x14')]);router[_0x3e6b('0x12')](_0x3e6b('0x10'),auth[_0x3e6b('0xb')](),controller[_0x3e6b('0x15')]);router['put'](_0x3e6b('0x16'),auth[_0x3e6b('0xb')](),controller[_0x3e6b('0x17')]);router[_0x3e6b('0x18')]('/:id',auth[_0x3e6b('0xb')](),controller[_0x3e6b('0x19')]);router[_0x3e6b('0x18')]('/:id/teams',auth[_0x3e6b('0xb')](),controller[_0x3e6b('0x1a')]);router[_0x3e6b('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x3e6b('0x1b')]=router; \ No newline at end of file +var _0xa65b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router'];(function(_0x1398fe,_0x14ad26){var _0x56da90=function(_0x335565){while(--_0x335565){_0x1398fe['push'](_0x1398fe['shift']());}};_0x56da90(++_0x14ad26);}(_0xa65b,0x1e8));var _0xba65=function(_0x1e357e,_0x372e44){_0x1e357e=_0x1e357e-0x0;var _0x2635b9=_0xa65b[_0x1e357e];return _0x2635b9;};'use strict';var multer=require(_0xba65('0x0'));var util=require(_0xba65('0x1'));var path=require(_0xba65('0x2'));var timeout=require('connect-timeout');var express=require(_0xba65('0x3'));var router=express[_0xba65('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba65('0x5'));var interaction=require(_0xba65('0x6'));var config=require(_0xba65('0x7'));var controller=require(_0xba65('0x8'));router[_0xba65('0x9')]('/',auth[_0xba65('0xa')](),controller[_0xba65('0xb')]);router[_0xba65('0x9')](_0xba65('0xc'),auth[_0xba65('0xa')](),controller['describe']);router[_0xba65('0x9')](_0xba65('0xd'),auth[_0xba65('0xa')](),controller['show']);router[_0xba65('0x9')](_0xba65('0xe'),auth[_0xba65('0xa')](),controller[_0xba65('0xf')]);router[_0xba65('0x9')](_0xba65('0x10'),auth[_0xba65('0xa')](),controller[_0xba65('0x11')]);router[_0xba65('0x9')]('/:id/users',auth[_0xba65('0xa')](),controller[_0xba65('0x12')]);router[_0xba65('0x13')]('/',auth[_0xba65('0xa')](),controller['create']);router[_0xba65('0x13')](_0xba65('0x10'),auth[_0xba65('0xa')](),controller[_0xba65('0x14')]);router[_0xba65('0x13')](_0xba65('0x15'),auth['isAuthenticated'](),controller[_0xba65('0x16')]);router[_0xba65('0x17')](_0xba65('0xd'),auth[_0xba65('0xa')](),controller['update']);router[_0xba65('0x18')](_0xba65('0xd'),auth[_0xba65('0xa')](),controller[_0xba65('0x19')]);router['delete'](_0xba65('0x10'),auth['isAuthenticated'](),controller[_0xba65('0x1a')]);router[_0xba65('0x18')](_0xba65('0x15'),auth[_0xba65('0xa')](),controller[_0xba65('0x1b')]);module[_0xba65('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5bd67df..055dd80 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 _0xa902=['name','INTEGER','rrmemory','sequelize','exports','STRING'];(function(_0x364774,_0x4cc655){var _0x2541a5=function(_0x2db975){while(--_0x2db975){_0x364774['push'](_0x364774['shift']());}};_0x2541a5(++_0x4cc655);}(_0xa902,0x8d));var _0x2a90=function(_0x296ae2,_0x3fcea5){_0x296ae2=_0x296ae2-0x0;var _0x2b251b=_0xa902[_0x296ae2];return _0x2b251b;};'use strict';var Sequelize=require(_0x2a90('0x0'));module[_0x2a90('0x1')]={'name':{'type':Sequelize[_0x2a90('0x2')],'unique':_0x2a90('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2a90('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2a90('0x5'),'beepall','roundrobin')},'description':{'type':Sequelize[_0x2a90('0x2')]}}; \ No newline at end of file +var _0xcab6=['rrmemory','beepall','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x336e71,_0x1ea2ed){var _0x3baa56=function(_0x2505df){while(--_0x2505df){_0x336e71['push'](_0x336e71['shift']());}};_0x3baa56(++_0x1ea2ed);}(_0xcab6,0xd4));var _0x6cab=function(_0x4a3423,_0x17a5f9){_0x4a3423=_0x4a3423-0x0;var _0x5870ba=_0xcab6[_0x4a3423];return _0x5870ba;};'use strict';var Sequelize=require(_0x6cab('0x0'));module['exports']={'name':{'type':Sequelize[_0x6cab('0x1')],'unique':_0x6cab('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6cab('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6cab('0x4')](_0x6cab('0x5'),_0x6cab('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x6cab('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 795967c..bbf46e0 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 _0x0ca1=['set','Content-Range','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','WhatsappQueue','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','WhatsappQueueId','UserId','agent','format','%s/%s','whatsappPause','updatedAt','getTeams','addTeams','Team','User','Agents','voicePause','flatMap','each','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','from','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','count'];(function(_0x2d6d41,_0x42728d){var _0x4e36f0=function(_0x27ed30){while(--_0x27ed30){_0x2d6d41['push'](_0x2d6d41['shift']());}};_0x4e36f0(++_0x42728d);}(_0x0ca1,0x65));var _0x10ca=function(_0x14cc29,_0x18eabe){_0x14cc29=_0x14cc29-0x0;var _0x4f2cf3=_0x0ca1[_0x14cc29];return _0x4f2cf3;};'use strict';var emlformat=require(_0x10ca('0x0'));var rimraf=require(_0x10ca('0x1'));var zipdir=require(_0x10ca('0x2'));var jsonpatch=require(_0x10ca('0x3'));var rp=require(_0x10ca('0x4'));var moment=require(_0x10ca('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x10ca('0x6'));var path=require('path');var sox=require(_0x10ca('0x7'));var csv=require(_0x10ca('0x8'));var ejs=require(_0x10ca('0x9'));var fs=require('fs');var fs_extra=require(_0x10ca('0xa'));var _=require(_0x10ca('0xb'));var squel=require(_0x10ca('0xc'));var crypto=require(_0x10ca('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x10ca('0xe'));var toCsv=require(_0x10ca('0x8'));var querystring=require(_0x10ca('0xf'));var Papa=require('papaparse');var Redis=require(_0x10ca('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x10ca('0x11'));var as=require(_0x10ca('0x12'));var hardwareService=require(_0x10ca('0x13'));var logger=require('../../config/logger')(_0x10ca('0x14'));var utils=require(_0x10ca('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x10ca('0x16'));var db=require(_0x10ca('0x17'))['db'];config['redis']=_[_0x10ca('0x18')](config['redis'],{'host':_0x10ca('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x10ca('0x1a')]));require(_0x10ca('0x1b'))[_0x10ca('0x1c')](socket);function respondWithStatusCode(_0x241e32,_0x4d4449){_0x4d4449=_0x4d4449||0xcc;return function(_0x29ebcd){if(_0x29ebcd){return _0x241e32[_0x10ca('0x1d')](_0x4d4449);}return _0x241e32[_0x10ca('0x1e')](_0x4d4449)[_0x10ca('0x1f')]();};}function respondWithResult(_0x38e49e,_0x5cf328){_0x5cf328=_0x5cf328||0xc8;return function(_0x27fc78){if(_0x27fc78){return _0x38e49e[_0x10ca('0x1e')](_0x5cf328)[_0x10ca('0x20')](_0x27fc78);}};}function respondWithFilteredResult(_0x509110,_0x71142a){return function(_0x2d0b1e){if(_0x2d0b1e){var _0x39f155=typeof _0x71142a[_0x10ca('0x21')]==='undefined'&&typeof _0x71142a[_0x10ca('0x22')]==='undefined';var _0x31f749=_0x2d0b1e[_0x10ca('0x23')];var _0x5a34c7=_0x39f155?0x0:_0x71142a[_0x10ca('0x21')];var _0x383c06=_0x39f155?_0x2d0b1e[_0x10ca('0x23')]:_0x71142a[_0x10ca('0x21')]+_0x71142a['limit'];var _0x3d0cbe;if(_0x383c06>=_0x31f749){_0x383c06=_0x31f749;_0x3d0cbe=0xc8;}else{_0x3d0cbe=0xce;}_0x509110[_0x10ca('0x1e')](_0x3d0cbe);return _0x509110[_0x10ca('0x24')](_0x10ca('0x25'),_0x5a34c7+'-'+_0x383c06+'/'+_0x31f749)[_0x10ca('0x20')](_0x2d0b1e);}return null;};}function patchUpdates(_0x443d6d){return function(_0x5731cb){try{jsonpatch['apply'](_0x5731cb,_0x443d6d,!![]);}catch(_0xe07f59){return BPromise[_0x10ca('0x26')](_0xe07f59);}return _0x5731cb[_0x10ca('0x27')]();};}function saveUpdates(_0x4f7b4a,_0x3808b5){return function(_0x112cc2){if(_0x112cc2){return _0x112cc2[_0x10ca('0x28')](_0x4f7b4a)[_0x10ca('0x29')](function(_0x191a39){return _0x191a39;});}return null;};}function removeEntity(_0x2b7e44,_0x3163e2){return function(_0xa854b){if(_0xa854b){return _0xa854b[_0x10ca('0x2a')]()[_0x10ca('0x29')](function(){var _0x276dd0=_0xa854b[_0x10ca('0x2b')]({'plain':!![]});var _0x5c7818=_0x10ca('0x2c');return db[_0x10ca('0x2d')]['destroy']({'where':{'type':_0x5c7818,'resourceId':_0x276dd0['id']}})[_0x10ca('0x29')](function(){return _0xa854b;});})[_0x10ca('0x29')](function(){_0x2b7e44[_0x10ca('0x1e')](0xcc)[_0x10ca('0x1f')]();});}};}function handleEntityNotFound(_0x51fcb2,_0x85a7d0){return function(_0x213be4){if(!_0x213be4){_0x51fcb2[_0x10ca('0x1d')](0x194);}return _0x213be4;};}function handleError(_0x5669d6,_0x262826){_0x262826=_0x262826||0x1f4;return function(_0x562c13){logger['error'](_0x562c13[_0x10ca('0x2e')]);if(_0x562c13[_0x10ca('0x2f')]){delete _0x562c13[_0x10ca('0x2f')];}_0x5669d6[_0x10ca('0x1e')](_0x262826)[_0x10ca('0x30')](_0x562c13);};}exports[_0x10ca('0x31')]=function(_0x4f5e3f,_0x59a8e4){var _0x233088={},_0x46d43f={},_0x5a7e46={'count':0x0,'rows':[]};var _0x2d5184=_[_0x10ca('0x32')](db['WhatsappQueue'][_0x10ca('0x33')],function(_0x2a89a3){return{'name':_0x2a89a3['fieldName'],'type':_0x2a89a3[_0x10ca('0x34')][_0x10ca('0x35')]};});_0x46d43f[_0x10ca('0x36')]=_['map'](_0x2d5184,_0x10ca('0x2f'));_0x46d43f[_0x10ca('0x37')]=_[_0x10ca('0x38')](_0x4f5e3f[_0x10ca('0x37')]);_0x46d43f['filters']=_[_0x10ca('0x39')](_0x46d43f[_0x10ca('0x36')],_0x46d43f[_0x10ca('0x37')]);_0x233088[_0x10ca('0x3a')]=_['intersection'](_0x46d43f[_0x10ca('0x36')],qs['fields'](_0x4f5e3f[_0x10ca('0x37')]['fields']));_0x233088[_0x10ca('0x3a')]=_0x233088[_0x10ca('0x3a')][_0x10ca('0x3b')]?_0x233088[_0x10ca('0x3a')]:_0x46d43f['model'];if(!_0x4f5e3f['query'][_0x10ca('0x3c')](_0x10ca('0x3d'))){_0x233088['limit']=qs[_0x10ca('0x22')](_0x4f5e3f['query'][_0x10ca('0x22')]);_0x233088[_0x10ca('0x21')]=qs[_0x10ca('0x21')](_0x4f5e3f['query']['offset']);}_0x233088[_0x10ca('0x3e')]=qs[_0x10ca('0x3f')](_0x4f5e3f[_0x10ca('0x37')][_0x10ca('0x3f')]);_0x233088[_0x10ca('0x40')]=qs[_0x10ca('0x41')](_[_0x10ca('0x42')](_0x4f5e3f[_0x10ca('0x37')],_0x46d43f['filters']),_0x2d5184);if(_0x4f5e3f[_0x10ca('0x37')][_0x10ca('0x43')]){_0x233088[_0x10ca('0x40')]=_[_0x10ca('0x44')](_0x233088[_0x10ca('0x40')],{'$or':_[_0x10ca('0x32')](_0x2d5184,function(_0x353e46){if(_0x353e46[_0x10ca('0x34')]!=='VIRTUAL'){var _0x1a5ed4={};_0x1a5ed4[_0x353e46[_0x10ca('0x2f')]]={'$like':'%'+_0x4f5e3f[_0x10ca('0x37')][_0x10ca('0x43')]+'%'};return _0x1a5ed4;}})});}_0x233088=_[_0x10ca('0x44')]({},_0x233088,_0x4f5e3f[_0x10ca('0x45')]);var _0x24a02d={'where':_0x233088[_0x10ca('0x40')]};return db['WhatsappQueue'][_0x10ca('0x23')](_0x24a02d)[_0x10ca('0x29')](function(_0x355c89){_0x5a7e46[_0x10ca('0x23')]=_0x355c89;if(_0x4f5e3f['query'][_0x10ca('0x46')]){_0x233088['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0x10ca('0x47')](_0x233088);})[_0x10ca('0x29')](function(_0x105db5){_0x5a7e46[_0x10ca('0x48')]=_0x105db5;return _0x5a7e46;})[_0x10ca('0x29')](respondWithFilteredResult(_0x59a8e4,_0x233088))[_0x10ca('0x49')](handleError(_0x59a8e4,null));};exports[_0x10ca('0x4a')]=function(_0x2890bf,_0x5ca9bd){var _0x43e9df={'raw':!![],'where':{'id':_0x2890bf[_0x10ca('0x4b')]['id']}},_0x1524dd={};_0x1524dd[_0x10ca('0x36')]=_[_0x10ca('0x38')](db[_0x10ca('0x4c')][_0x10ca('0x33')]);_0x1524dd['query']=_['keys'](_0x2890bf['query']);_0x1524dd[_0x10ca('0x41')]=_[_0x10ca('0x39')](_0x1524dd['model'],_0x1524dd[_0x10ca('0x37')]);_0x43e9df[_0x10ca('0x3a')]=_[_0x10ca('0x39')](_0x1524dd[_0x10ca('0x36')],qs[_0x10ca('0x4d')](_0x2890bf['query'][_0x10ca('0x4d')]));_0x43e9df['attributes']=_0x43e9df[_0x10ca('0x3a')][_0x10ca('0x3b')]?_0x43e9df['attributes']:_0x1524dd[_0x10ca('0x36')];if(_0x2890bf[_0x10ca('0x37')]['includeAll']){_0x43e9df[_0x10ca('0x4e')]=[{'all':!![]}];}_0x43e9df=_[_0x10ca('0x44')]({},_0x43e9df,_0x2890bf[_0x10ca('0x45')]);return db[_0x10ca('0x4c')][_0x10ca('0x4f')](_0x43e9df)[_0x10ca('0x29')](handleEntityNotFound(_0x5ca9bd,null))[_0x10ca('0x29')](respondWithResult(_0x5ca9bd,null))['catch'](handleError(_0x5ca9bd,null));};exports[_0x10ca('0x50')]=function(_0x1dce6b,_0x1395c0){return db['WhatsappQueue']['create'](_0x1dce6b[_0x10ca('0x51')],{})['then'](function(_0x20c51f){var _0x2fe7cb=_0x1dce6b['user'][_0x10ca('0x2b')]({'plain':!![]});if(!_0x2fe7cb)throw new Error(_0x10ca('0x52'));if(_0x2fe7cb['role']==='user'){var _0xc5bacd=_0x20c51f['get']({'plain':!![]});var _0x19a156=_0x10ca('0x2c');return db[_0x10ca('0x53')][_0x10ca('0x4f')]({'where':{'name':_0x19a156,'userProfileId':_0x2fe7cb['userProfileId']},'raw':!![]})[_0x10ca('0x29')](function(_0x287f4d){if(_0x287f4d&&_0x287f4d[_0x10ca('0x54')]===0x0){return db[_0x10ca('0x2d')]['create']({'name':_0xc5bacd[_0x10ca('0x2f')],'resourceId':_0xc5bacd['id'],'type':_0x287f4d[_0x10ca('0x2f')],'sectionId':_0x287f4d['id']},{})[_0x10ca('0x29')](function(){return _0x20c51f;});}else{return _0x20c51f;}})[_0x10ca('0x49')](function(_0x30df06){logger[_0x10ca('0x55')](_0x10ca('0x56'),_0x30df06);throw _0x30df06;});}return _0x20c51f;})[_0x10ca('0x29')](respondWithResult(_0x1395c0,0xc9))[_0x10ca('0x49')](handleError(_0x1395c0,null));};exports[_0x10ca('0x28')]=function(_0x3313fe,_0x4f6531){if(_0x3313fe[_0x10ca('0x51')]['id']){delete _0x3313fe[_0x10ca('0x51')]['id'];}return db[_0x10ca('0x4c')]['find']({'where':{'id':_0x3313fe[_0x10ca('0x4b')]['id']}})[_0x10ca('0x29')](handleEntityNotFound(_0x4f6531,null))[_0x10ca('0x29')](saveUpdates(_0x3313fe[_0x10ca('0x51')],null))['then'](respondWithResult(_0x4f6531,null))[_0x10ca('0x49')](handleError(_0x4f6531,null));};exports[_0x10ca('0x2a')]=function(_0x37bad5,_0x208b3d){return db[_0x10ca('0x4c')][_0x10ca('0x4f')]({'where':{'id':_0x37bad5[_0x10ca('0x4b')]['id']}})[_0x10ca('0x29')](handleEntityNotFound(_0x208b3d,null))[_0x10ca('0x29')](removeEntity(_0x208b3d,null))['catch'](handleError(_0x208b3d,null));};exports[_0x10ca('0x57')]=function(_0xb33b1b,_0x2f0e96){return db[_0x10ca('0x4c')][_0x10ca('0x57')]()[_0x10ca('0x29')](respondWithResult(_0x2f0e96,null))[_0x10ca('0x49')](handleError(_0x2f0e96,null));};exports[_0x10ca('0x58')]=function(_0x185c25,_0x46223a,_0x26a907){var _0x4bbc4b={'raw':!![],'where':{}},_0x53ecc4={},_0x208308;return db[_0x10ca('0x4c')][_0x10ca('0x59')]({'where':{'id':_0x185c25['params']['id']}})[_0x10ca('0x29')](handleEntityNotFound(_0x46223a,null))[_0x10ca('0x29')](function(_0x56453f){if(_0x56453f){_0x208308=_0x56453f[_0x10ca('0x2b')]({'plain':!![]});_0x53ecc4[_0x10ca('0x36')]=_[_0x10ca('0x38')](db['UserWhatsappQueue'][_0x10ca('0x33')]);_0x53ecc4[_0x10ca('0x37')]=_[_0x10ca('0x38')](_0x185c25[_0x10ca('0x37')]);_0x53ecc4['filters']=_[_0x10ca('0x39')](_0x53ecc4['model'],_0x53ecc4[_0x10ca('0x37')]);_0x4bbc4b[_0x10ca('0x3a')]=_[_0x10ca('0x39')](_0x53ecc4[_0x10ca('0x36')],qs[_0x10ca('0x4d')](_0x185c25[_0x10ca('0x37')][_0x10ca('0x4d')]));_0x4bbc4b[_0x10ca('0x3a')]=_0x4bbc4b[_0x10ca('0x3a')][_0x10ca('0x3b')]?_0x4bbc4b[_0x10ca('0x3a')]:_0x53ecc4[_0x10ca('0x36')];if(!_0x185c25[_0x10ca('0x37')]['hasOwnProperty']('nolimit')){_0x4bbc4b[_0x10ca('0x22')]=qs['limit'](_0x185c25['query'][_0x10ca('0x22')]);_0x4bbc4b[_0x10ca('0x21')]=qs[_0x10ca('0x21')](_0x185c25[_0x10ca('0x37')][_0x10ca('0x21')]);}_0x4bbc4b[_0x10ca('0x3e')]=qs[_0x10ca('0x3f')](_0x185c25[_0x10ca('0x37')][_0x10ca('0x3f')]);_0x4bbc4b[_0x10ca('0x40')]=qs[_0x10ca('0x41')](_['pick'](_0x185c25[_0x10ca('0x37')],_0x53ecc4['filters']));_0x4bbc4b[_0x10ca('0x40')][_0x10ca('0x5a')]=_0x56453f['id'];if(_0x185c25[_0x10ca('0x37')][_0x10ca('0x43')]){_0x4bbc4b[_0x10ca('0x40')]=_['merge'](_0x4bbc4b[_0x10ca('0x40')],{'$or':_[_0x10ca('0x32')](_0x4bbc4b[_0x10ca('0x3a')],function(_0x959cd3){var _0x40ba46={};_0x40ba46[_0x959cd3]={'$like':'%'+_0x185c25[_0x10ca('0x37')]['filter']+'%'};return _0x40ba46;})});}_0x4bbc4b=_[_0x10ca('0x44')]({},_0x4bbc4b,_0x185c25[_0x10ca('0x45')]);return db['UserWhatsappQueue'][_0x10ca('0x47')](_0x4bbc4b);}})[_0x10ca('0x29')](function(_0x129817){if(_0x129817){return db['User']['findAndCountAll']({'where':{'id':_[_0x10ca('0x32')](_0x129817,_0x10ca('0x5b')),'role':_0x10ca('0x5c')},'attributes':['id',_0x10ca('0x2f'),'whatsappPause','updatedAt','createdAt']});}})[_0x10ca('0x29')](function(_0x551834){if(_0x551834){return{'count':_0x551834['count'],'rows':_[_0x10ca('0x32')](_0x551834[_0x10ca('0x48')],function(_0x1b9fc5){return{'membername':_0x1b9fc5['name'],'UserId':_0x1b9fc5['id'],'queue_name':_0x208308[_0x10ca('0x2f')],'WhatsappQueueId':_0x208308['id'],'interface':util[_0x10ca('0x5d')](_0x10ca('0x5e'),'SIP',_0x1b9fc5[_0x10ca('0x2f')]),'penalty':0x0,'paused':_0x1b9fc5[_0x10ca('0x5f')],'createdAt':_0x1b9fc5['createdAt'],'updatedAt':_0x1b9fc5[_0x10ca('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x10ca('0x29')](respondWithFilteredResult(_0x46223a,_0x4bbc4b))[_0x10ca('0x49')](handleError(_0x46223a,null));};exports[_0x10ca('0x61')]=function(_0x2c866e,_0x2a6ec1,_0x504f6e){var _0x22305d={};var _0x7d3a7f={};var _0x38c331;var _0x4fde95;return db[_0x10ca('0x4c')]['findOne']({'where':{'id':_0x2c866e['params']['id']}})[_0x10ca('0x29')](handleEntityNotFound(_0x2a6ec1,null))[_0x10ca('0x29')](function(_0x407fcb){if(_0x407fcb){_0x38c331=_0x407fcb;_0x7d3a7f['model']=_[_0x10ca('0x38')](db['Team'][_0x10ca('0x33')]);_0x7d3a7f[_0x10ca('0x37')]=_[_0x10ca('0x38')](_0x2c866e[_0x10ca('0x37')]);_0x7d3a7f[_0x10ca('0x41')]=_['intersection'](_0x7d3a7f[_0x10ca('0x36')],_0x7d3a7f[_0x10ca('0x37')]);_0x22305d['attributes']=_[_0x10ca('0x39')](_0x7d3a7f[_0x10ca('0x36')],qs['fields'](_0x2c866e[_0x10ca('0x37')][_0x10ca('0x4d')]));_0x22305d[_0x10ca('0x3a')]=_0x22305d['attributes'][_0x10ca('0x3b')]?_0x22305d['attributes']:_0x7d3a7f[_0x10ca('0x36')];_0x22305d['order']=qs[_0x10ca('0x3f')](_0x2c866e['query'][_0x10ca('0x3f')]);_0x22305d[_0x10ca('0x40')]=qs[_0x10ca('0x41')](_['pick'](_0x2c866e[_0x10ca('0x37')],_0x7d3a7f[_0x10ca('0x41')]));if(_0x2c866e[_0x10ca('0x37')][_0x10ca('0x43')]){_0x22305d[_0x10ca('0x40')]=_[_0x10ca('0x44')](_0x22305d['where'],{'$or':_['map'](_0x22305d[_0x10ca('0x3a')],function(_0x109ac2){var _0x1cb38a={};_0x1cb38a[_0x109ac2]={'$like':'%'+_0x2c866e[_0x10ca('0x37')]['filter']+'%'};return _0x1cb38a;})});}_0x22305d=_[_0x10ca('0x44')]({},_0x22305d,_0x2c866e['options']);return _0x38c331[_0x10ca('0x61')](_0x22305d);}})[_0x10ca('0x29')](function(_0x3bf082){if(_0x3bf082){_0x4fde95=_0x3bf082['length'];if(!_0x2c866e['query'][_0x10ca('0x3c')](_0x10ca('0x3d'))){_0x22305d['limit']=qs[_0x10ca('0x22')](_0x2c866e[_0x10ca('0x37')][_0x10ca('0x22')]);_0x22305d['offset']=qs[_0x10ca('0x21')](_0x2c866e[_0x10ca('0x37')][_0x10ca('0x21')]);}return _0x38c331[_0x10ca('0x61')](_0x22305d);}})['then'](function(_0x4354c7){if(_0x4354c7){return _0x4354c7?{'count':_0x4fde95,'rows':_0x4354c7}:null;}})[_0x10ca('0x29')](respondWithResult(_0x2a6ec1,null))[_0x10ca('0x49')](handleError(_0x2a6ec1,null));};exports[_0x10ca('0x62')]=function(_0x14b1bd,_0x5a77a1,_0x1b63e1){var _0x2e9c93=_0x14b1bd['body']['ids'];return db[_0x10ca('0x63')][_0x10ca('0x47')]({'where':{'id':_0x2e9c93},'attributes':['id'],'include':[{'model':db[_0x10ca('0x64')],'as':_0x10ca('0x65'),'attributes':['id',_0x10ca('0x2f'),'online',_0x10ca('0x66'),'interface'],'raw':!![]}]})[_0x10ca('0x29')](function(_0x2e245c){if(_0x2e245c){var _0x577cf9=_[_0x10ca('0x67')](_0x2e245c,function(_0x3bc868){var _0xfed0eb=_0x3bc868['get']({'plain':!![]});return _0xfed0eb[_0x10ca('0x65')];});return db['WhatsappQueue']['find']({'where':{'id':_0x14b1bd[_0x10ca('0x4b')]['id']}})['then'](function(_0x268a0a){return db['sequelize']['transaction'](function(_0xf1db29){return _0x268a0a['addTeams'](_0x2e9c93,{'transaction':_0xf1db29})['then'](function(){return BPromise[_0x10ca('0x68')](_0x577cf9,function(_0x245627){return db[_0x10ca('0x69')][_0x10ca('0x6a')]({'where':{'UserId':_0x245627['id'],'WhatsappQueueId':_0x14b1bd[_0x10ca('0x4b')]['id']},'transaction':_0xf1db29});});})['then'](function(){_0x577cf9[_0x10ca('0x6b')](function(_0xd6baa3){socket[_0x10ca('0x6c')](_0x10ca('0x6d'),{'UserId':_0xd6baa3['id'],'WhatsappQueueId':_0x268a0a['id']});});});});});}})['then'](respondWithStatusCode(_0x5a77a1,null))[_0x10ca('0x49')](handleError(_0x5a77a1,null));};exports[_0x10ca('0x6e')]=function(_0x590ef2,_0x190153,_0x573b5d){return db['Team'][_0x10ca('0x47')]({'where':{'id':_0x590ef2[_0x10ca('0x37')][_0x10ca('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x10ca('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x10ca('0x29')](handleEntityNotFound(_0x190153,null))[_0x10ca('0x29')](function(_0x340c5a){var _0x5366cd=_[_0x10ca('0x32')](_0x340c5a,'id');var _0x4538a1=[];var _0x355b12=[];var _0xbf764b=squel[_0x10ca('0x70')]();_0xbf764b[_0x10ca('0x71')]('tq.TeamId')[_0x10ca('0x72')](_0x10ca('0x73'),'tq')[_0x10ca('0x74')](_0x10ca('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x10ca('0x40')]('WhatsappQueueId\x20=\x20?',_0x590ef2['params']['id']);for(var _0x49d57c=0x0;_0x49d57c<_0x340c5a[_0x10ca('0x3b')];_0x49d57c+=0x1){let _0x47895d=_0x340c5a[_0x49d57c];for(var _0x1b7a01=0x0;_0x1b7a01<_0x47895d[_0x10ca('0x65')][_0x10ca('0x3b')];_0x1b7a01+=0x1){let _0x1ff0be=_0x47895d[_0x10ca('0x65')][_0x1b7a01];var _0x24bb45=_0xbf764b[_0x10ca('0x76')]();_0x24bb45[_0x10ca('0x40')](_0x10ca('0x77'),_0x1ff0be['id']);_0x355b12[_0x10ca('0x78')](db[_0x10ca('0x79')][_0x10ca('0x37')](_0x24bb45[_0x10ca('0x7a')](),{'type':db[_0x10ca('0x79')][_0x10ca('0x7b')][_0x10ca('0x7c')]})['then'](function(_0x2073b7){if(_0x2073b7[_0x10ca('0x3b')]===0x1){return _0x1ff0be['id'];}else{var _0x197b5b=_[_0x10ca('0x7d')](_[_0x10ca('0x32')](_0x2073b7,_0x10ca('0x7e')),function(_0x39038e){return _['includes'](_0x5366cd,_0x39038e);});if(_0x197b5b){return _0x1ff0be['id'];}}}));}}return BPromise[_0x10ca('0x7f')](_0x355b12)['then'](function(_0x2f4426){_0x4538a1=_(_0x4538a1)[_0x10ca('0x80')](_0x2f4426)[_0x10ca('0x81')]()[_0x10ca('0x82')]();return db['WhatsappQueue'][_0x10ca('0x4f')]({'where':{'id':_0x590ef2[_0x10ca('0x4b')]['id']}})[_0x10ca('0x29')](function(_0x85cb6c){return db[_0x10ca('0x79')]['transaction'](function(_0x552230){return _0x85cb6c[_0x10ca('0x6e')](_0x590ef2['query'][_0x10ca('0x6f')],{'transaction':_0x552230})['then'](function(){if(!_[_0x10ca('0x83')](_0x4538a1)){return _0x85cb6c[_0x10ca('0x84')](_0x4538a1,{'transaction':_0x552230});}})[_0x10ca('0x29')](function(){_0x4538a1[_0x10ca('0x6b')](function(_0x5e1a00){socket[_0x10ca('0x6c')](_0x10ca('0x85'),{'UserId':_0x5e1a00,'WhatsappQueueId':_0x85cb6c['id']});});});});});});})[_0x10ca('0x29')](respondWithStatusCode(_0x190153,null))[_0x10ca('0x49')](handleError(_0x190153,null));};exports[_0x10ca('0x86')]=function(_0x1346a6,_0x19d067,_0x96e979){return db[_0x10ca('0x4c')][_0x10ca('0x4f')]({'where':{'id':_0x1346a6['params']['id']}})[_0x10ca('0x29')](handleEntityNotFound(_0x19d067,null))['then'](function(_0x4745b4){if(_0x4745b4){return _0x4745b4[_0x10ca('0x86')](_0x1346a6['body'][_0x10ca('0x6f')],_['omit'](_0x1346a6[_0x10ca('0x51')],[_0x10ca('0x6f'),'id'])||{})['spread'](function(_0x4a5e70){for(var _0x236357=0x0;_0x236357<_0x1346a6[_0x10ca('0x51')][_0x10ca('0x6f')][_0x10ca('0x3b')];_0x236357+=0x1){socket[_0x10ca('0x6c')](_0x10ca('0x6d'),{'UserId':Number(_0x1346a6['body'][_0x10ca('0x6f')][_0x236357]),'WhatsappQueueId':Number(_0x1346a6[_0x10ca('0x4b')]['id'])});}return _0x4a5e70;});}})[_0x10ca('0x29')](respondWithResult(_0x19d067,null))[_0x10ca('0x49')](handleError(_0x19d067,null));};exports[_0x10ca('0x84')]=function(_0x2a6a6c,_0x45572e,_0xeb498b){return db[_0x10ca('0x4c')][_0x10ca('0x4f')]({'where':{'id':_0x2a6a6c[_0x10ca('0x4b')]['id']}})[_0x10ca('0x29')](handleEntityNotFound(_0x45572e,null))['then'](function(_0x3a0d44){if(_0x3a0d44){return _0x3a0d44['removeAgents'](_0x2a6a6c['query'][_0x10ca('0x6f')])[_0x10ca('0x29')](function(){if(_[_0x10ca('0x87')](_0x2a6a6c[_0x10ca('0x37')]['ids'])){for(var _0x25c49f=0x0;_0x25c49f<_0x2a6a6c[_0x10ca('0x37')][_0x10ca('0x6f')][_0x10ca('0x3b')];_0x25c49f+=0x1){socket['emit'](_0x10ca('0x85'),{'UserId':Number(_0x2a6a6c['query'][_0x10ca('0x6f')][_0x25c49f]),'WhatsappQueueId':Number(_0x2a6a6c[_0x10ca('0x4b')]['id'])});}}else{socket['emit'](_0x10ca('0x85'),{'UserId':Number(_0x2a6a6c[_0x10ca('0x37')][_0x10ca('0x6f')]),'WhatsappQueueId':Number(_0x2a6a6c[_0x10ca('0x4b')]['id'])});}});}})[_0x10ca('0x29')](respondWithStatusCode(_0x45572e,null))['catch'](handleError(_0x45572e,null));};exports['getAgents']=function(_0x23f179,_0x29601f,_0x1be80f){var _0x5db6fc={};var _0x9a0ad2={};var _0x427a73;var _0x2a7fbb;return db['WhatsappQueue'][_0x10ca('0x59')]({'where':{'id':_0x23f179[_0x10ca('0x4b')]['id']}})['then'](handleEntityNotFound(_0x29601f,null))[_0x10ca('0x29')](function(_0x563e9f){if(_0x563e9f){_0x427a73=_0x563e9f;_0x9a0ad2[_0x10ca('0x36')]=_[_0x10ca('0x38')](db[_0x10ca('0x64')][_0x10ca('0x33')]);_0x9a0ad2[_0x10ca('0x37')]=_['keys'](_0x23f179['query']);_0x9a0ad2[_0x10ca('0x41')]=_['intersection'](_0x9a0ad2[_0x10ca('0x36')],_0x9a0ad2[_0x10ca('0x37')]);_0x5db6fc[_0x10ca('0x3a')]=_[_0x10ca('0x39')](_0x9a0ad2[_0x10ca('0x36')],qs[_0x10ca('0x4d')](_0x23f179[_0x10ca('0x37')][_0x10ca('0x4d')]));_0x5db6fc[_0x10ca('0x3a')]=_0x5db6fc[_0x10ca('0x3a')][_0x10ca('0x3b')]?_0x5db6fc['attributes']:_0x9a0ad2['model'];_0x5db6fc[_0x10ca('0x3e')]=qs[_0x10ca('0x3f')](_0x23f179[_0x10ca('0x37')][_0x10ca('0x3f')]);_0x5db6fc[_0x10ca('0x40')]=qs[_0x10ca('0x41')](_[_0x10ca('0x42')](_0x23f179[_0x10ca('0x37')],_0x9a0ad2[_0x10ca('0x41')]));if(_0x23f179[_0x10ca('0x37')][_0x10ca('0x43')]){_0x5db6fc[_0x10ca('0x40')]=_[_0x10ca('0x44')](_0x5db6fc[_0x10ca('0x40')],{'$or':_['map'](_0x5db6fc[_0x10ca('0x3a')],function(_0x40f38c){var _0x3a2df8={};_0x3a2df8[_0x40f38c]={'$like':'%'+_0x23f179[_0x10ca('0x37')][_0x10ca('0x43')]+'%'};return _0x3a2df8;})});}_0x5db6fc=_['merge']({},_0x5db6fc,_0x23f179[_0x10ca('0x45')]);return _0x427a73['getAgents'](_0x5db6fc);}})[_0x10ca('0x29')](function(_0x3876b5){if(_0x3876b5){_0x2a7fbb=_0x3876b5[_0x10ca('0x3b')];if(!_0x23f179['query'][_0x10ca('0x3c')](_0x10ca('0x3d'))){_0x5db6fc[_0x10ca('0x22')]=qs[_0x10ca('0x22')](_0x23f179[_0x10ca('0x37')][_0x10ca('0x22')]);_0x5db6fc[_0x10ca('0x21')]=qs[_0x10ca('0x21')](_0x23f179[_0x10ca('0x37')][_0x10ca('0x21')]);}return _0x427a73[_0x10ca('0x88')](_0x5db6fc);}})[_0x10ca('0x29')](function(_0x3d4ffe){if(_0x3d4ffe){return _0x3d4ffe?{'count':_0x2a7fbb,'rows':_0x3d4ffe}:null;}})[_0x10ca('0x29')](respondWithResult(_0x29601f,null))[_0x10ca('0x49')](handleError(_0x29601f,null));}; \ No newline at end of file +var _0xbbe5=['error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getMembers','findOne','UserWhatsappQueue','pick','User','findAndCountAll','UserId','agent','updatedAt','rows','format','%s/%s','SIP','whatsappPause','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','register','end','status','json','offset','undefined','count','limit','set','apply','reject','then','get','WhatsappQueues','UserProfileResource','destroy','sendStatus'];(function(_0x4deff,_0x42c328){var _0x440123=function(_0x2d7dde){while(--_0x2d7dde){_0x4deff['push'](_0x4deff['shift']());}};_0x440123(++_0x42c328);}(_0xbbe5,0xf1));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5bbe('0x0'));var rimraf=require(_0x5bbe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bbe('0x2'));var rp=require(_0x5bbe('0x3'));var moment=require(_0x5bbe('0x4'));var BPromise=require(_0x5bbe('0x5'));var Mustache=require(_0x5bbe('0x6'));var util=require('util');var path=require(_0x5bbe('0x7'));var sox=require('sox');var csv=require(_0x5bbe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bbe('0x9'));var _=require(_0x5bbe('0xa'));var squel=require('squel');var crypto=require(_0x5bbe('0xb'));var jsforce=require(_0x5bbe('0xc'));var deskjs=require(_0x5bbe('0xd'));var toCsv=require(_0x5bbe('0x8'));var querystring=require('querystring');var Papa=require(_0x5bbe('0xe'));var Redis=require(_0x5bbe('0xf'));var authService=require(_0x5bbe('0x10'));var qs=require(_0x5bbe('0x11'));var as=require(_0x5bbe('0x12'));var hardwareService=require(_0x5bbe('0x13'));var logger=require('../../config/logger')(_0x5bbe('0x14'));var utils=require(_0x5bbe('0x15'));var config=require(_0x5bbe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bbe('0x17'))['db'];config['redis']=_[_0x5bbe('0x18')](config[_0x5bbe('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bbe('0x19')]));require('./whatsappQueue.socket')[_0x5bbe('0x1a')](socket);function respondWithStatusCode(_0x289252,_0x54cb4b){_0x54cb4b=_0x54cb4b||0xcc;return function(_0x3e4eaf){if(_0x3e4eaf){return _0x289252['sendStatus'](_0x54cb4b);}return _0x289252['status'](_0x54cb4b)[_0x5bbe('0x1b')]();};}function respondWithResult(_0x3d47c0,_0x2b8cdc){_0x2b8cdc=_0x2b8cdc||0xc8;return function(_0x1c1e12){if(_0x1c1e12){return _0x3d47c0[_0x5bbe('0x1c')](_0x2b8cdc)[_0x5bbe('0x1d')](_0x1c1e12);}};}function respondWithFilteredResult(_0x26fb51,_0x41cc87){return function(_0x479eb9){if(_0x479eb9){var _0x1c92b1=typeof _0x41cc87[_0x5bbe('0x1e')]==='undefined'&&typeof _0x41cc87['limit']===_0x5bbe('0x1f');var _0x317af7=_0x479eb9[_0x5bbe('0x20')];var _0x1cdc35=_0x1c92b1?0x0:_0x41cc87[_0x5bbe('0x1e')];var _0x1ffce5=_0x1c92b1?_0x479eb9['count']:_0x41cc87[_0x5bbe('0x1e')]+_0x41cc87[_0x5bbe('0x21')];var _0x46cf7d;if(_0x1ffce5>=_0x317af7){_0x1ffce5=_0x317af7;_0x46cf7d=0xc8;}else{_0x46cf7d=0xce;}_0x26fb51['status'](_0x46cf7d);return _0x26fb51[_0x5bbe('0x22')]('Content-Range',_0x1cdc35+'-'+_0x1ffce5+'/'+_0x317af7)['json'](_0x479eb9);}return null;};}function patchUpdates(_0x3d36f2){return function(_0x207b3d){try{jsonpatch[_0x5bbe('0x23')](_0x207b3d,_0x3d36f2,!![]);}catch(_0x2383d9){return BPromise[_0x5bbe('0x24')](_0x2383d9);}return _0x207b3d['save']();};}function saveUpdates(_0x27a340,_0x5b029e){return function(_0x1f7883){if(_0x1f7883){return _0x1f7883['update'](_0x27a340)['then'](function(_0x5e85d5){return _0x5e85d5;});}return null;};}function removeEntity(_0x14fdc8,_0x24e04a){return function(_0x2e54b){if(_0x2e54b){return _0x2e54b['destroy']()[_0x5bbe('0x25')](function(){var _0x497fc3=_0x2e54b[_0x5bbe('0x26')]({'plain':!![]});var _0x5bd2cc=_0x5bbe('0x27');return db[_0x5bbe('0x28')][_0x5bbe('0x29')]({'where':{'type':_0x5bd2cc,'resourceId':_0x497fc3['id']}})[_0x5bbe('0x25')](function(){return _0x2e54b;});})[_0x5bbe('0x25')](function(){_0x14fdc8[_0x5bbe('0x1c')](0xcc)[_0x5bbe('0x1b')]();});}};}function handleEntityNotFound(_0x3647cf,_0x16735c){return function(_0x2b60ea){if(!_0x2b60ea){_0x3647cf[_0x5bbe('0x2a')](0x194);}return _0x2b60ea;};}function handleError(_0x293a03,_0x3eba58){_0x3eba58=_0x3eba58||0x1f4;return function(_0x33b900){logger[_0x5bbe('0x2b')](_0x33b900[_0x5bbe('0x2c')]);if(_0x33b900[_0x5bbe('0x2d')]){delete _0x33b900[_0x5bbe('0x2d')];}_0x293a03[_0x5bbe('0x1c')](_0x3eba58)[_0x5bbe('0x2e')](_0x33b900);};}exports[_0x5bbe('0x2f')]=function(_0x5599b7,_0x4d26ba){var _0x64147b={},_0x5a94dc={},_0x4e3375={'count':0x0,'rows':[]};var _0x1b77d8=_[_0x5bbe('0x30')](db[_0x5bbe('0x31')][_0x5bbe('0x32')],function(_0x372e1a){return{'name':_0x372e1a[_0x5bbe('0x33')],'type':_0x372e1a[_0x5bbe('0x34')][_0x5bbe('0x35')]};});_0x5a94dc[_0x5bbe('0x36')]=_[_0x5bbe('0x30')](_0x1b77d8,_0x5bbe('0x2d'));_0x5a94dc[_0x5bbe('0x37')]=_[_0x5bbe('0x38')](_0x5599b7[_0x5bbe('0x37')]);_0x5a94dc[_0x5bbe('0x39')]=_[_0x5bbe('0x3a')](_0x5a94dc[_0x5bbe('0x36')],_0x5a94dc[_0x5bbe('0x37')]);_0x64147b['attributes']=_['intersection'](_0x5a94dc['model'],qs[_0x5bbe('0x3b')](_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x3b')]));_0x64147b[_0x5bbe('0x3c')]=_0x64147b[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x64147b[_0x5bbe('0x3c')]:_0x5a94dc[_0x5bbe('0x36')];if(!_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x3e')]('nolimit')){_0x64147b['limit']=qs[_0x5bbe('0x21')](_0x5599b7['query'][_0x5bbe('0x21')]);_0x64147b[_0x5bbe('0x1e')]=qs[_0x5bbe('0x1e')](_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x1e')]);}_0x64147b[_0x5bbe('0x3f')]=qs[_0x5bbe('0x40')](_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x40')]);_0x64147b['where']=qs[_0x5bbe('0x39')](_['pick'](_0x5599b7[_0x5bbe('0x37')],_0x5a94dc['filters']),_0x1b77d8);if(_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x41')]){_0x64147b[_0x5bbe('0x42')]=_['merge'](_0x64147b[_0x5bbe('0x42')],{'$or':_[_0x5bbe('0x30')](_0x1b77d8,function(_0x3fa6b7){if(_0x3fa6b7['type']!==_0x5bbe('0x43')){var _0x1866ec={};_0x1866ec[_0x3fa6b7[_0x5bbe('0x2d')]]={'$like':'%'+_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x41')]+'%'};return _0x1866ec;}})});}_0x64147b=_[_0x5bbe('0x44')]({},_0x64147b,_0x5599b7[_0x5bbe('0x45')]);var _0x3b2e5f={'where':_0x64147b[_0x5bbe('0x42')]};return db['WhatsappQueue']['count'](_0x3b2e5f)['then'](function(_0x4e96b7){_0x4e3375['count']=_0x4e96b7;if(_0x5599b7[_0x5bbe('0x37')]['includeAll']){_0x64147b[_0x5bbe('0x46')]=[{'all':!![]}];}return db[_0x5bbe('0x31')][_0x5bbe('0x47')](_0x64147b);})['then'](function(_0x30a287){_0x4e3375['rows']=_0x30a287;return _0x4e3375;})['then'](respondWithFilteredResult(_0x4d26ba,_0x64147b))['catch'](handleError(_0x4d26ba,null));};exports[_0x5bbe('0x48')]=function(_0x535aad,_0x31252b){var _0x2bae04={'raw':!![],'where':{'id':_0x535aad[_0x5bbe('0x49')]['id']}},_0x49e686={};_0x49e686[_0x5bbe('0x36')]=_['keys'](db['WhatsappQueue'][_0x5bbe('0x32')]);_0x49e686['query']=_[_0x5bbe('0x38')](_0x535aad['query']);_0x49e686[_0x5bbe('0x39')]=_['intersection'](_0x49e686[_0x5bbe('0x36')],_0x49e686['query']);_0x2bae04[_0x5bbe('0x3c')]=_['intersection'](_0x49e686[_0x5bbe('0x36')],qs[_0x5bbe('0x3b')](_0x535aad['query'][_0x5bbe('0x3b')]));_0x2bae04['attributes']=_0x2bae04[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x2bae04[_0x5bbe('0x3c')]:_0x49e686['model'];if(_0x535aad['query']['includeAll']){_0x2bae04[_0x5bbe('0x46')]=[{'all':!![]}];}_0x2bae04=_[_0x5bbe('0x44')]({},_0x2bae04,_0x535aad['options']);return db[_0x5bbe('0x31')]['find'](_0x2bae04)[_0x5bbe('0x25')](handleEntityNotFound(_0x31252b,null))[_0x5bbe('0x25')](respondWithResult(_0x31252b,null))[_0x5bbe('0x4a')](handleError(_0x31252b,null));};exports[_0x5bbe('0x4b')]=function(_0x4c1a76,_0x3c7553){return db[_0x5bbe('0x31')][_0x5bbe('0x4b')](_0x4c1a76['body'],{})['then'](function(_0x1e0aa5){var _0x1cfc45=_0x4c1a76[_0x5bbe('0x4c')]['get']({'plain':!![]});if(!_0x1cfc45)throw new Error(_0x5bbe('0x4d'));if(_0x1cfc45[_0x5bbe('0x4e')]===_0x5bbe('0x4c')){var _0x22c904=_0x1e0aa5['get']({'plain':!![]});var _0x4b7dc4=_0x5bbe('0x27');return db[_0x5bbe('0x4f')][_0x5bbe('0x50')]({'where':{'name':_0x4b7dc4,'userProfileId':_0x1cfc45['userProfileId']},'raw':!![]})[_0x5bbe('0x25')](function(_0x513657){if(_0x513657&&_0x513657['autoAssociation']===0x0){return db[_0x5bbe('0x28')]['create']({'name':_0x22c904[_0x5bbe('0x2d')],'resourceId':_0x22c904['id'],'type':_0x513657[_0x5bbe('0x2d')],'sectionId':_0x513657['id']},{})[_0x5bbe('0x25')](function(){return _0x1e0aa5;});}else{return _0x1e0aa5;}})[_0x5bbe('0x4a')](function(_0x6557c1){logger[_0x5bbe('0x2b')](_0x5bbe('0x51'),_0x6557c1);throw _0x6557c1;});}return _0x1e0aa5;})['then'](respondWithResult(_0x3c7553,0xc9))[_0x5bbe('0x4a')](handleError(_0x3c7553,null));};exports[_0x5bbe('0x52')]=function(_0x5926fc,_0x21836e){if(_0x5926fc[_0x5bbe('0x53')]['id']){delete _0x5926fc[_0x5bbe('0x53')]['id'];}return db[_0x5bbe('0x31')][_0x5bbe('0x50')]({'where':{'id':_0x5926fc[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0x21836e,null))[_0x5bbe('0x25')](saveUpdates(_0x5926fc[_0x5bbe('0x53')],null))[_0x5bbe('0x25')](respondWithResult(_0x21836e,null))[_0x5bbe('0x4a')](handleError(_0x21836e,null));};exports['destroy']=function(_0x4229f6,_0xc8ac40){return db['WhatsappQueue'][_0x5bbe('0x50')]({'where':{'id':_0x4229f6[_0x5bbe('0x49')]['id']}})['then'](handleEntityNotFound(_0xc8ac40,null))[_0x5bbe('0x25')](removeEntity(_0xc8ac40,null))['catch'](handleError(_0xc8ac40,null));};exports['describe']=function(_0x37999d,_0x23099a){return db[_0x5bbe('0x31')]['describe']()[_0x5bbe('0x25')](respondWithResult(_0x23099a,null))[_0x5bbe('0x4a')](handleError(_0x23099a,null));};exports[_0x5bbe('0x54')]=function(_0x612647,_0x902911,_0x4e78e0){var _0x2f3f94={'raw':!![],'where':{}},_0x2ae4c9={},_0xfbe2f2;return db[_0x5bbe('0x31')][_0x5bbe('0x55')]({'where':{'id':_0x612647[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0x902911,null))[_0x5bbe('0x25')](function(_0x39e846){if(_0x39e846){_0xfbe2f2=_0x39e846['get']({'plain':!![]});_0x2ae4c9[_0x5bbe('0x36')]=_[_0x5bbe('0x38')](db[_0x5bbe('0x56')]['rawAttributes']);_0x2ae4c9[_0x5bbe('0x37')]=_[_0x5bbe('0x38')](_0x612647[_0x5bbe('0x37')]);_0x2ae4c9['filters']=_['intersection'](_0x2ae4c9[_0x5bbe('0x36')],_0x2ae4c9[_0x5bbe('0x37')]);_0x2f3f94[_0x5bbe('0x3c')]=_[_0x5bbe('0x3a')](_0x2ae4c9[_0x5bbe('0x36')],qs[_0x5bbe('0x3b')](_0x612647[_0x5bbe('0x37')][_0x5bbe('0x3b')]));_0x2f3f94[_0x5bbe('0x3c')]=_0x2f3f94[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x2f3f94[_0x5bbe('0x3c')]:_0x2ae4c9['model'];if(!_0x612647[_0x5bbe('0x37')][_0x5bbe('0x3e')]('nolimit')){_0x2f3f94['limit']=qs['limit'](_0x612647[_0x5bbe('0x37')][_0x5bbe('0x21')]);_0x2f3f94[_0x5bbe('0x1e')]=qs[_0x5bbe('0x1e')](_0x612647[_0x5bbe('0x37')][_0x5bbe('0x1e')]);}_0x2f3f94[_0x5bbe('0x3f')]=qs['sort'](_0x612647['query'][_0x5bbe('0x40')]);_0x2f3f94[_0x5bbe('0x42')]=qs[_0x5bbe('0x39')](_[_0x5bbe('0x57')](_0x612647[_0x5bbe('0x37')],_0x2ae4c9[_0x5bbe('0x39')]));_0x2f3f94[_0x5bbe('0x42')]['WhatsappQueueId']=_0x39e846['id'];if(_0x612647[_0x5bbe('0x37')][_0x5bbe('0x41')]){_0x2f3f94[_0x5bbe('0x42')]=_[_0x5bbe('0x44')](_0x2f3f94[_0x5bbe('0x42')],{'$or':_[_0x5bbe('0x30')](_0x2f3f94[_0x5bbe('0x3c')],function(_0x373b10){var _0x2845a9={};_0x2845a9[_0x373b10]={'$like':'%'+_0x612647['query'][_0x5bbe('0x41')]+'%'};return _0x2845a9;})});}_0x2f3f94=_[_0x5bbe('0x44')]({},_0x2f3f94,_0x612647[_0x5bbe('0x45')]);return db[_0x5bbe('0x56')][_0x5bbe('0x47')](_0x2f3f94);}})[_0x5bbe('0x25')](function(_0x26cd49){if(_0x26cd49){return db[_0x5bbe('0x58')][_0x5bbe('0x59')]({'where':{'id':_[_0x5bbe('0x30')](_0x26cd49,_0x5bbe('0x5a')),'role':_0x5bbe('0x5b')},'attributes':['id','name','whatsappPause',_0x5bbe('0x5c'),'createdAt']});}})[_0x5bbe('0x25')](function(_0x1681f4){if(_0x1681f4){return{'count':_0x1681f4[_0x5bbe('0x20')],'rows':_['map'](_0x1681f4[_0x5bbe('0x5d')],function(_0x425938){return{'membername':_0x425938[_0x5bbe('0x2d')],'UserId':_0x425938['id'],'queue_name':_0xfbe2f2['name'],'WhatsappQueueId':_0xfbe2f2['id'],'interface':util[_0x5bbe('0x5e')](_0x5bbe('0x5f'),_0x5bbe('0x60'),_0x425938[_0x5bbe('0x2d')]),'penalty':0x0,'paused':_0x425938[_0x5bbe('0x61')],'createdAt':_0x425938[_0x5bbe('0x62')],'updatedAt':_0x425938[_0x5bbe('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5bbe('0x25')](respondWithFilteredResult(_0x902911,_0x2f3f94))[_0x5bbe('0x4a')](handleError(_0x902911,null));};exports[_0x5bbe('0x63')]=function(_0x4acca4,_0x5d9a73,_0x8e5e1b){var _0x30ba76={};var _0x5d0f01={};var _0x1744f2;var _0x4a08b6;return db[_0x5bbe('0x31')]['findOne']({'where':{'id':_0x4acca4[_0x5bbe('0x49')]['id']}})['then'](handleEntityNotFound(_0x5d9a73,null))[_0x5bbe('0x25')](function(_0x418e59){if(_0x418e59){_0x1744f2=_0x418e59;_0x5d0f01['model']=_[_0x5bbe('0x38')](db[_0x5bbe('0x64')][_0x5bbe('0x32')]);_0x5d0f01[_0x5bbe('0x37')]=_['keys'](_0x4acca4[_0x5bbe('0x37')]);_0x5d0f01[_0x5bbe('0x39')]=_['intersection'](_0x5d0f01[_0x5bbe('0x36')],_0x5d0f01['query']);_0x30ba76['attributes']=_[_0x5bbe('0x3a')](_0x5d0f01['model'],qs[_0x5bbe('0x3b')](_0x4acca4[_0x5bbe('0x37')][_0x5bbe('0x3b')]));_0x30ba76[_0x5bbe('0x3c')]=_0x30ba76[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x30ba76[_0x5bbe('0x3c')]:_0x5d0f01[_0x5bbe('0x36')];_0x30ba76[_0x5bbe('0x3f')]=qs[_0x5bbe('0x40')](_0x4acca4[_0x5bbe('0x37')]['sort']);_0x30ba76[_0x5bbe('0x42')]=qs[_0x5bbe('0x39')](_[_0x5bbe('0x57')](_0x4acca4[_0x5bbe('0x37')],_0x5d0f01[_0x5bbe('0x39')]));if(_0x4acca4['query'][_0x5bbe('0x41')]){_0x30ba76['where']=_[_0x5bbe('0x44')](_0x30ba76[_0x5bbe('0x42')],{'$or':_[_0x5bbe('0x30')](_0x30ba76['attributes'],function(_0x147ddc){var _0x55f44b={};_0x55f44b[_0x147ddc]={'$like':'%'+_0x4acca4['query']['filter']+'%'};return _0x55f44b;})});}_0x30ba76=_[_0x5bbe('0x44')]({},_0x30ba76,_0x4acca4[_0x5bbe('0x45')]);return _0x1744f2[_0x5bbe('0x63')](_0x30ba76);}})['then'](function(_0x58820f){if(_0x58820f){_0x4a08b6=_0x58820f['length'];if(!_0x4acca4[_0x5bbe('0x37')][_0x5bbe('0x3e')]('nolimit')){_0x30ba76[_0x5bbe('0x21')]=qs['limit'](_0x4acca4[_0x5bbe('0x37')][_0x5bbe('0x21')]);_0x30ba76[_0x5bbe('0x1e')]=qs[_0x5bbe('0x1e')](_0x4acca4[_0x5bbe('0x37')][_0x5bbe('0x1e')]);}return _0x1744f2[_0x5bbe('0x63')](_0x30ba76);}})[_0x5bbe('0x25')](function(_0x264ed1){if(_0x264ed1){return _0x264ed1?{'count':_0x4a08b6,'rows':_0x264ed1}:null;}})['then'](respondWithResult(_0x5d9a73,null))[_0x5bbe('0x4a')](handleError(_0x5d9a73,null));};exports[_0x5bbe('0x65')]=function(_0xb37e19,_0x1b19d7,_0x11bc86){var _0x46b9bf=_0xb37e19[_0x5bbe('0x53')]['ids'];return db[_0x5bbe('0x64')]['findAll']({'where':{'id':_0x46b9bf},'attributes':['id'],'include':[{'model':db[_0x5bbe('0x58')],'as':_0x5bbe('0x66'),'attributes':['id',_0x5bbe('0x2d'),_0x5bbe('0x67'),_0x5bbe('0x68'),_0x5bbe('0x69')],'raw':!![]}]})[_0x5bbe('0x25')](function(_0x4341e6){if(_0x4341e6){var _0x1ec67b=_[_0x5bbe('0x6a')](_0x4341e6,function(_0x689106){var _0x583720=_0x689106[_0x5bbe('0x26')]({'plain':!![]});return _0x583720[_0x5bbe('0x66')];});return db[_0x5bbe('0x31')]['find']({'where':{'id':_0xb37e19['params']['id']}})[_0x5bbe('0x25')](function(_0x5e3a69){return db[_0x5bbe('0x6b')][_0x5bbe('0x6c')](function(_0x34de06){return _0x5e3a69[_0x5bbe('0x65')](_0x46b9bf,{'transaction':_0x34de06})[_0x5bbe('0x25')](function(){return BPromise[_0x5bbe('0x6d')](_0x1ec67b,function(_0x3de8c5){return db[_0x5bbe('0x56')][_0x5bbe('0x6e')]({'where':{'UserId':_0x3de8c5['id'],'WhatsappQueueId':_0xb37e19[_0x5bbe('0x49')]['id']},'transaction':_0x34de06});});})['then'](function(){_0x1ec67b[_0x5bbe('0x6f')](function(_0x504eaa){socket[_0x5bbe('0x70')](_0x5bbe('0x71'),{'UserId':_0x504eaa['id'],'WhatsappQueueId':_0x5e3a69['id']});});});});});}})[_0x5bbe('0x25')](respondWithStatusCode(_0x1b19d7,null))[_0x5bbe('0x4a')](handleError(_0x1b19d7,null));};exports[_0x5bbe('0x72')]=function(_0x4531a7,_0x5e0645,_0x191323){return db[_0x5bbe('0x64')][_0x5bbe('0x47')]({'where':{'id':_0x4531a7[_0x5bbe('0x37')][_0x5bbe('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5bbe('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e0645,null))[_0x5bbe('0x25')](function(_0x26b246){var _0x589313=_[_0x5bbe('0x30')](_0x26b246,'id');var _0x4d653e=[];var _0x327c1d=[];var _0x542e6f=squel[_0x5bbe('0x74')]();_0x542e6f[_0x5bbe('0x75')](_0x5bbe('0x76'))[_0x5bbe('0x77')](_0x5bbe('0x78'),'tq')[_0x5bbe('0x79')]('user_has_teams','ut',_0x5bbe('0x7a'))['where'](_0x5bbe('0x7b'),_0x4531a7[_0x5bbe('0x49')]['id']);for(var _0x4c5fce=0x0;_0x4c5fce<_0x26b246[_0x5bbe('0x3d')];_0x4c5fce+=0x1){let _0x3490dd=_0x26b246[_0x4c5fce];for(var _0x194320=0x0;_0x194320<_0x3490dd[_0x5bbe('0x66')]['length'];_0x194320+=0x1){let _0x4ba924=_0x3490dd[_0x5bbe('0x66')][_0x194320];var _0x5dfa23=_0x542e6f[_0x5bbe('0x7c')]();_0x5dfa23[_0x5bbe('0x42')](_0x5bbe('0x7d'),_0x4ba924['id']);_0x327c1d[_0x5bbe('0x7e')](db['sequelize'][_0x5bbe('0x37')](_0x5dfa23[_0x5bbe('0x7f')](),{'type':db[_0x5bbe('0x6b')][_0x5bbe('0x80')][_0x5bbe('0x81')]})[_0x5bbe('0x25')](function(_0x431486){if(_0x431486[_0x5bbe('0x3d')]===0x1){return _0x4ba924['id'];}else{var _0x558a9d=_[_0x5bbe('0x82')](_[_0x5bbe('0x30')](_0x431486,'TeamId'),function(_0x251129){return _[_0x5bbe('0x83')](_0x589313,_0x251129);});if(_0x558a9d){return _0x4ba924['id'];}}}));}}return BPromise[_0x5bbe('0x84')](_0x327c1d)[_0x5bbe('0x25')](function(_0x40f3d9){_0x4d653e=_(_0x4d653e)[_0x5bbe('0x85')](_0x40f3d9)[_0x5bbe('0x86')]()[_0x5bbe('0x87')]();return db[_0x5bbe('0x31')][_0x5bbe('0x50')]({'where':{'id':_0x4531a7[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](function(_0x377937){return db['sequelize']['transaction'](function(_0x3250bb){return _0x377937['removeTeams'](_0x4531a7[_0x5bbe('0x37')]['ids'],{'transaction':_0x3250bb})[_0x5bbe('0x25')](function(){if(!_[_0x5bbe('0x88')](_0x4d653e)){return _0x377937[_0x5bbe('0x89')](_0x4d653e,{'transaction':_0x3250bb});}})[_0x5bbe('0x25')](function(){_0x4d653e[_0x5bbe('0x6f')](function(_0x2b3089){socket[_0x5bbe('0x70')]('userWhatsappQueue:remove',{'UserId':_0x2b3089,'WhatsappQueueId':_0x377937['id']});});});});});});})[_0x5bbe('0x25')](respondWithStatusCode(_0x5e0645,null))['catch'](handleError(_0x5e0645,null));};exports[_0x5bbe('0x8a')]=function(_0x1592ed,_0x242b5c,_0x2aaa7e){return db['WhatsappQueue'][_0x5bbe('0x50')]({'where':{'id':_0x1592ed[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0x242b5c,null))['then'](function(_0x510fcc){if(_0x510fcc){return _0x510fcc['addAgents'](_0x1592ed[_0x5bbe('0x53')][_0x5bbe('0x73')],_['omit'](_0x1592ed[_0x5bbe('0x53')],[_0x5bbe('0x73'),'id'])||{})['spread'](function(_0x1e79de){for(var _0x5ed3f6=0x0;_0x5ed3f6<_0x1592ed[_0x5bbe('0x53')][_0x5bbe('0x73')]['length'];_0x5ed3f6+=0x1){socket[_0x5bbe('0x70')]('userWhatsappQueue:save',{'UserId':Number(_0x1592ed['body'][_0x5bbe('0x73')][_0x5ed3f6]),'WhatsappQueueId':Number(_0x1592ed[_0x5bbe('0x49')]['id'])});}return _0x1e79de;});}})[_0x5bbe('0x25')](respondWithResult(_0x242b5c,null))[_0x5bbe('0x4a')](handleError(_0x242b5c,null));};exports[_0x5bbe('0x89')]=function(_0x1e2deb,_0x2d0fb0,_0x54cc14){return db[_0x5bbe('0x31')]['find']({'where':{'id':_0x1e2deb[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0x2d0fb0,null))[_0x5bbe('0x25')](function(_0x24b334){if(_0x24b334){return _0x24b334['removeAgents'](_0x1e2deb[_0x5bbe('0x37')]['ids'])['then'](function(){if(_[_0x5bbe('0x8b')](_0x1e2deb[_0x5bbe('0x37')]['ids'])){for(var _0x535f45=0x0;_0x535f45<_0x1e2deb[_0x5bbe('0x37')][_0x5bbe('0x73')][_0x5bbe('0x3d')];_0x535f45+=0x1){socket[_0x5bbe('0x70')](_0x5bbe('0x8c'),{'UserId':Number(_0x1e2deb[_0x5bbe('0x37')][_0x5bbe('0x73')][_0x535f45]),'WhatsappQueueId':Number(_0x1e2deb[_0x5bbe('0x49')]['id'])});}}else{socket[_0x5bbe('0x70')](_0x5bbe('0x8c'),{'UserId':Number(_0x1e2deb['query'][_0x5bbe('0x73')]),'WhatsappQueueId':Number(_0x1e2deb[_0x5bbe('0x49')]['id'])});}});}})[_0x5bbe('0x25')](respondWithStatusCode(_0x2d0fb0,null))[_0x5bbe('0x4a')](handleError(_0x2d0fb0,null));};exports[_0x5bbe('0x8d')]=function(_0x775381,_0xcaa77,_0x45b79c){var _0x4a2ecf={};var _0x2d525e={};var _0x4d0ef0;var _0x3362c6;return db[_0x5bbe('0x31')][_0x5bbe('0x55')]({'where':{'id':_0x775381['params']['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0xcaa77,null))[_0x5bbe('0x25')](function(_0xca3d78){if(_0xca3d78){_0x4d0ef0=_0xca3d78;_0x2d525e[_0x5bbe('0x36')]=_['keys'](db['User'][_0x5bbe('0x32')]);_0x2d525e['query']=_[_0x5bbe('0x38')](_0x775381[_0x5bbe('0x37')]);_0x2d525e[_0x5bbe('0x39')]=_[_0x5bbe('0x3a')](_0x2d525e[_0x5bbe('0x36')],_0x2d525e[_0x5bbe('0x37')]);_0x4a2ecf[_0x5bbe('0x3c')]=_[_0x5bbe('0x3a')](_0x2d525e[_0x5bbe('0x36')],qs[_0x5bbe('0x3b')](_0x775381[_0x5bbe('0x37')][_0x5bbe('0x3b')]));_0x4a2ecf[_0x5bbe('0x3c')]=_0x4a2ecf[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x4a2ecf[_0x5bbe('0x3c')]:_0x2d525e[_0x5bbe('0x36')];_0x4a2ecf[_0x5bbe('0x3f')]=qs[_0x5bbe('0x40')](_0x775381['query'][_0x5bbe('0x40')]);_0x4a2ecf['where']=qs[_0x5bbe('0x39')](_[_0x5bbe('0x57')](_0x775381[_0x5bbe('0x37')],_0x2d525e['filters']));if(_0x775381[_0x5bbe('0x37')][_0x5bbe('0x41')]){_0x4a2ecf[_0x5bbe('0x42')]=_[_0x5bbe('0x44')](_0x4a2ecf[_0x5bbe('0x42')],{'$or':_['map'](_0x4a2ecf['attributes'],function(_0x3acf13){var _0x4f3dfd={};_0x4f3dfd[_0x3acf13]={'$like':'%'+_0x775381[_0x5bbe('0x37')][_0x5bbe('0x41')]+'%'};return _0x4f3dfd;})});}_0x4a2ecf=_[_0x5bbe('0x44')]({},_0x4a2ecf,_0x775381[_0x5bbe('0x45')]);return _0x4d0ef0[_0x5bbe('0x8d')](_0x4a2ecf);}})[_0x5bbe('0x25')](function(_0x47d1d6){if(_0x47d1d6){_0x3362c6=_0x47d1d6[_0x5bbe('0x3d')];if(!_0x775381['query']['hasOwnProperty']('nolimit')){_0x4a2ecf[_0x5bbe('0x21')]=qs[_0x5bbe('0x21')](_0x775381['query']['limit']);_0x4a2ecf[_0x5bbe('0x1e')]=qs[_0x5bbe('0x1e')](_0x775381[_0x5bbe('0x37')][_0x5bbe('0x1e')]);}return _0x4d0ef0[_0x5bbe('0x8d')](_0x4a2ecf);}})[_0x5bbe('0x25')](function(_0x108cc9){if(_0x108cc9){return _0x108cc9?{'count':_0x3362c6,'rows':_0x108cc9}:null;}})[_0x5bbe('0x25')](respondWithResult(_0xcaa77,null))[_0x5bbe('0x4a')](handleError(_0xcaa77,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 897ce09..3afe591 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 _0x16a4=['save','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3e9499,_0x24e13d){var _0x40a138=function(_0x54292d){while(--_0x54292d){_0x3e9499['push'](_0x3e9499['shift']());}};_0x40a138(++_0x24e13d);}(_0x16a4,0x186));var _0x416a=function(_0x3aef50,_0x8914d){_0x3aef50=_0x3aef50-0x0;var _0xfa6cc7=_0x16a4[_0x3aef50];return _0xfa6cc7;};'use strict';var EventEmitter=require(_0x416a('0x0'));var WhatsappQueue=require(_0x416a('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x416a('0x2'),'afterUpdate':'update','afterDestroy':_0x416a('0x3')};function emitEvent(_0x7f369f){return function(_0x47cb4e,_0x11c705,_0x43ab20){WhatsappQueueEvents['emit'](_0x7f369f+':'+_0x47cb4e['id'],_0x47cb4e);WhatsappQueueEvents['emit'](_0x7f369f,_0x47cb4e);_0x43ab20(null);};}for(var e in events){if(events[_0x416a('0x4')](e)){var event=events[e];WhatsappQueue[_0x416a('0x5')](e,emitEvent(event));}}module[_0x416a('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x12fb=['events','../../mysqldb','WhatsappQueue','setMaxListeners','update','emit','hook','exports'];(function(_0x33eb5c,_0x4a7d98){var _0x253328=function(_0x3b23a0){while(--_0x3b23a0){_0x33eb5c['push'](_0x33eb5c['shift']());}};_0x253328(++_0x4a7d98);}(_0x12fb,0x130));var _0xb12f=function(_0x4e7abc,_0x2aeca1){_0x4e7abc=_0x4e7abc-0x0;var _0x428796=_0x12fb[_0x4e7abc];return _0x428796;};'use strict';var EventEmitter=require(_0xb12f('0x0'));var WhatsappQueue=require(_0xb12f('0x1'))['db'][_0xb12f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb12f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb12f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20e43a){return function(_0x52ee4d,_0x184f5c,_0x5a33e6){WhatsappQueueEvents['emit'](_0x20e43a+':'+_0x52ee4d['id'],_0x52ee4d);WhatsappQueueEvents[_0xb12f('0x5')](_0x20e43a,_0x52ee4d);_0x5a33e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xb12f('0x6')](e,emitEvent(event));}}module[_0xb12f('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 818a73d..3e768ff 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 _0x403a=['bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment'];(function(_0x3e72da,_0x7909e3){var _0x20a27d=function(_0x2ce453){while(--_0x2ce453){_0x3e72da['push'](_0x3e72da['shift']());}};_0x20a27d(++_0x7909e3);}(_0x403a,0xc2));var _0xa403=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0x403a[_0x1a014b];return _0x462258;};'use strict';var _=require('lodash');var util=require(_0xa403('0x0'));var logger=require(_0xa403('0x1'))(_0xa403('0x2'));var moment=require(_0xa403('0x3'));var BPromise=require(_0xa403('0x4'));var rp=require(_0xa403('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa403('0x6'));var config=require(_0xa403('0x7'));var attributes=require(_0xa403('0x8'));module['exports']=function(_0x2bd287,_0x472e91){return _0x2bd287['define'](_0xa403('0x9'),attributes,{'tableName':_0xa403('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6984=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2dd473,_0x2fa2ac){var _0x1253a8=function(_0x349d6f){while(--_0x349d6f){_0x2dd473['push'](_0x2dd473['shift']());}};_0x1253a8(++_0x2fa2ac);}(_0x6984,0xa4));var _0x4698=function(_0x252d50,_0xa3406d){_0x252d50=_0x252d50-0x0;var _0x2f49ac=_0x6984[_0x252d50];return _0x2f49ac;};'use strict';var _=require(_0x4698('0x0'));var util=require(_0x4698('0x1'));var logger=require(_0x4698('0x2'))('api');var moment=require(_0x4698('0x3'));var BPromise=require(_0x4698('0x4'));var rp=require(_0x4698('0x5'));var fs=require('fs');var path=require(_0x4698('0x6'));var rimraf=require(_0x4698('0x7'));var config=require(_0x4698('0x8'));var attributes=require(_0x4698('0x9'));module[_0x4698('0xa')]=function(_0x5cd1fe,_0x5eb806){return _0x5cd1fe['define'](_0x4698('0xb'),attributes,{'tableName':_0x4698('0xc'),'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 9a4c073..b171056 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 _0x285a=['../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowWhatsappQueue','find','moment','ioredis'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x285a,0x1ba));var _0xa285=function(_0xdcf4dd,_0x438aab){_0xdcf4dd=_0xdcf4dd-0x0;var _0x6f0c70=_0x285a[_0xdcf4dd];return _0x6f0c70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa285('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa285('0x1'));var db=require(_0xa285('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa285('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa285('0x4'));var client=jayson[_0xa285('0x5')][_0xa285('0x6')]({'port':0x232a});config['redis']=_[_0xa285('0x7')](config[_0xa285('0x8')],{'host':_0xa285('0x9'),'port':0x18eb});var socket=require(_0xa285('0xa'))(new Redis(config[_0xa285('0x8')]));require('./whatsappQueue.socket')[_0xa285('0xb')](socket);function respondWithRpcPromise(_0x225c5a,_0x33a5e6,_0x457621){return new BPromise(function(_0x3541e5,_0x38455b){return client[_0xa285('0xc')](_0x225c5a,_0x457621)[_0xa285('0xd')](function(_0x5d8df4){logger[_0xa285('0xe')](_0xa285('0xf'),_0x33a5e6,_0xa285('0x10'));logger[_0xa285('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x33a5e6,_0xa285('0x10'),JSON[_0xa285('0x12')](_0x5d8df4));if(_0x5d8df4['error']){if(_0x5d8df4[_0xa285('0x13')][_0xa285('0x14')]===0x1f4){logger[_0xa285('0x13')](_0xa285('0xf'),_0x33a5e6,_0x5d8df4[_0xa285('0x13')][_0xa285('0x15')]);return _0x38455b(_0x5d8df4['error'][_0xa285('0x15')]);}logger[_0xa285('0x13')](_0xa285('0xf'),_0x33a5e6,_0x5d8df4[_0xa285('0x13')][_0xa285('0x15')]);return _0x3541e5(_0x5d8df4['error'][_0xa285('0x15')]);}else{logger[_0xa285('0xe')](_0xa285('0xf'),_0x33a5e6,_0xa285('0x10'));_0x3541e5(_0x5d8df4[_0xa285('0x16')][_0xa285('0x15')]);}})['catch'](function(_0x18cd37){logger[_0xa285('0x13')](_0xa285('0xf'),_0x33a5e6,_0x18cd37);_0x38455b(_0x18cd37);});});}exports[_0xa285('0x17')]=function(_0x511c04){var _0xe0fcb0=this;return new Promise(function(_0x350548,_0xab0ec7){return db[_0xa285('0x18')][_0xa285('0x19')]({'raw':_0x511c04[_0xa285('0x1a')]?_0x511c04[_0xa285('0x1a')][_0xa285('0x1b')]===undefined?!![]:![]:!![],'where':_0x511c04[_0xa285('0x1a')]?_0x511c04['options'][_0xa285('0x1c')]||null:null,'attributes':_0x511c04[_0xa285('0x1a')]?_0x511c04['options']['attributes']||null:null,'limit':_0x511c04[_0xa285('0x1a')]?_0x511c04[_0xa285('0x1a')][_0xa285('0x1d')]||null:null,'include':_0x511c04['options']?_0x511c04[_0xa285('0x1a')][_0xa285('0x1e')]?_[_0xa285('0x1f')](_0x511c04[_0xa285('0x1a')][_0xa285('0x1e')],function(_0x1cad96){return{'model':db[_0x1cad96[_0xa285('0x20')]],'as':_0x1cad96['as'],'attributes':_0x1cad96[_0xa285('0x21')],'include':_0x1cad96['include']?_[_0xa285('0x1f')](_0x1cad96[_0xa285('0x1e')],function(_0x20bdd8){return{'model':db[_0x20bdd8[_0xa285('0x20')]],'as':_0x20bdd8['as'],'attributes':_0x20bdd8['attributes'],'include':_0x20bdd8[_0xa285('0x1e')]?_[_0xa285('0x1f')](_0x20bdd8[_0xa285('0x1e')],function(_0x431f8e){return{'model':db[_0x431f8e['model']],'as':_0x431f8e['as'],'attributes':_0x431f8e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa285('0xd')](function(_0xbf9525){logger['info'](_0xa285('0x17'),_0x511c04);logger[_0xa285('0x11')](_0xa285('0x17'),_0x511c04,JSON['stringify'](_0xbf9525));_0x350548(_0xbf9525);})[_0xa285('0x22')](function(_0x1b9397){logger[_0xa285('0x13')]('GetWhatsappQueue',_0x1b9397['message'],_0x511c04);_0xab0ec7(_0xe0fcb0[_0xa285('0x13')](0x1f4,_0x1b9397[_0xa285('0x15')]));});});};exports[_0xa285('0x23')]=function(_0xf87d7e){var _0xe53f62=this;return new Promise(function(_0x29066d,_0x119c1a){return db['WhatsappQueue'][_0xa285('0x24')]({'raw':_0xf87d7e[_0xa285('0x1a')]?_0xf87d7e[_0xa285('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xf87d7e['options']?_0xf87d7e[_0xa285('0x1a')]['where']||null:null,'attributes':_0xf87d7e['options']?_0xf87d7e[_0xa285('0x1a')][_0xa285('0x21')]||null:null,'include':_0xf87d7e[_0xa285('0x1a')]?_0xf87d7e[_0xa285('0x1a')][_0xa285('0x1e')]?_[_0xa285('0x1f')](_0xf87d7e[_0xa285('0x1a')]['include'],function(_0x19aefb){return{'model':db[_0x19aefb['model']],'as':_0x19aefb['as'],'attributes':_0x19aefb[_0xa285('0x21')],'include':_0x19aefb[_0xa285('0x1e')]?_['map'](_0x19aefb[_0xa285('0x1e')],function(_0x22ecd1){return{'model':db[_0x22ecd1[_0xa285('0x20')]],'as':_0x22ecd1['as'],'attributes':_0x22ecd1['attributes'],'include':_0x22ecd1[_0xa285('0x1e')]?_[_0xa285('0x1f')](_0x22ecd1[_0xa285('0x1e')],function(_0xfcd0b2){return{'model':db[_0xfcd0b2[_0xa285('0x20')]],'as':_0xfcd0b2['as'],'attributes':_0xfcd0b2[_0xa285('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa285('0xd')](function(_0x94c430){logger[_0xa285('0xe')](_0xa285('0x23'),_0xf87d7e);logger[_0xa285('0x11')]('ShowWhatsappQueue',_0xf87d7e,JSON['stringify'](_0x94c430));_0x29066d(_0x94c430);})[_0xa285('0x22')](function(_0x1e88a1){logger[_0xa285('0x13')](_0xa285('0x23'),_0x1e88a1[_0xa285('0x15')],_0xf87d7e);_0x119c1a(_0xe53f62['error'](0x1f4,_0x1e88a1['message']));});});}; \ No newline at end of file +var _0x92ca=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','include','model','map','then','GetWhatsappQueue','WhatsappQueue','find','ShowWhatsappQueue','lodash','util'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x92ca,0x1c1));var _0xa92c=function(_0x266945,_0x5c5e8c){_0x266945=_0x266945-0x0;var _0x4477d5=_0x92ca[_0x266945];return _0x4477d5;};'use strict';var _=require(_0xa92c('0x0'));var util=require(_0xa92c('0x1'));var moment=require(_0xa92c('0x2'));var BPromise=require('bluebird');var rs=require(_0xa92c('0x3'));var fs=require('fs');var Redis=require(_0xa92c('0x4'));var db=require(_0xa92c('0x5'))['db'];var utils=require(_0xa92c('0x6'));var logger=require('../../config/logger')(_0xa92c('0x7'));var config=require(_0xa92c('0x8'));var jayson=require(_0xa92c('0x9'));var client=jayson[_0xa92c('0xa')][_0xa92c('0xb')]({'port':0x232a});config[_0xa92c('0xc')]=_[_0xa92c('0xd')](config[_0xa92c('0xc')],{'host':_0xa92c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa92c('0xf'))[_0xa92c('0x10')](socket);function respondWithRpcPromise(_0x4ff2bd,_0x76a6df,_0x2ff9b8){return new BPromise(function(_0x20c801,_0x1cffff){return client[_0xa92c('0x11')](_0x4ff2bd,_0x2ff9b8)['then'](function(_0x240e5b){logger[_0xa92c('0x12')](_0xa92c('0x13'),_0x76a6df,_0xa92c('0x14'));logger[_0xa92c('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x76a6df,_0xa92c('0x14'),JSON[_0xa92c('0x16')](_0x240e5b));if(_0x240e5b['error']){if(_0x240e5b[_0xa92c('0x17')][_0xa92c('0x18')]===0x1f4){logger[_0xa92c('0x17')](_0xa92c('0x13'),_0x76a6df,_0x240e5b[_0xa92c('0x17')]['message']);return _0x1cffff(_0x240e5b['error'][_0xa92c('0x19')]);}logger[_0xa92c('0x17')](_0xa92c('0x13'),_0x76a6df,_0x240e5b['error'][_0xa92c('0x19')]);return _0x20c801(_0x240e5b[_0xa92c('0x17')]['message']);}else{logger[_0xa92c('0x12')](_0xa92c('0x13'),_0x76a6df,_0xa92c('0x14'));_0x20c801(_0x240e5b[_0xa92c('0x1a')]['message']);}})[_0xa92c('0x1b')](function(_0x1306c0){logger[_0xa92c('0x17')](_0xa92c('0x13'),_0x76a6df,_0x1306c0);_0x1cffff(_0x1306c0);});});}exports['GetWhatsappQueue']=function(_0x2c4790){var _0x450262=this;return new Promise(function(_0x4f17cd,_0x3af25f){return db['WhatsappQueue']['findAll']({'raw':_0x2c4790[_0xa92c('0x1c')]?_0x2c4790[_0xa92c('0x1c')][_0xa92c('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c4790[_0xa92c('0x1c')]?_0x2c4790['options'][_0xa92c('0x1e')]||null:null,'attributes':_0x2c4790['options']?_0x2c4790['options'][_0xa92c('0x1f')]||null:null,'limit':_0x2c4790['options']?_0x2c4790[_0xa92c('0x1c')][_0xa92c('0x20')]||null:null,'include':_0x2c4790['options']?_0x2c4790[_0xa92c('0x1c')][_0xa92c('0x21')]?_['map'](_0x2c4790['options'][_0xa92c('0x21')],function(_0x352ea3){return{'model':db[_0x352ea3[_0xa92c('0x22')]],'as':_0x352ea3['as'],'attributes':_0x352ea3[_0xa92c('0x1f')],'include':_0x352ea3['include']?_[_0xa92c('0x23')](_0x352ea3[_0xa92c('0x21')],function(_0x459b64){return{'model':db[_0x459b64[_0xa92c('0x22')]],'as':_0x459b64['as'],'attributes':_0x459b64['attributes'],'include':_0x459b64['include']?_[_0xa92c('0x23')](_0x459b64[_0xa92c('0x21')],function(_0x788979){return{'model':db[_0x788979[_0xa92c('0x22')]],'as':_0x788979['as'],'attributes':_0x788979[_0xa92c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa92c('0x24')](function(_0x4266e1){logger[_0xa92c('0x12')](_0xa92c('0x25'),_0x2c4790);logger[_0xa92c('0x15')](_0xa92c('0x25'),_0x2c4790,JSON[_0xa92c('0x16')](_0x4266e1));_0x4f17cd(_0x4266e1);})[_0xa92c('0x1b')](function(_0x317e86){logger[_0xa92c('0x17')](_0xa92c('0x25'),_0x317e86['message'],_0x2c4790);_0x3af25f(_0x450262[_0xa92c('0x17')](0x1f4,_0x317e86[_0xa92c('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x2f22e4){var _0x2a063c=this;return new Promise(function(_0x4642cb,_0x30f9a9){return db[_0xa92c('0x26')][_0xa92c('0x27')]({'raw':_0x2f22e4['options']?_0x2f22e4[_0xa92c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2f22e4[_0xa92c('0x1c')]?_0x2f22e4[_0xa92c('0x1c')][_0xa92c('0x1e')]||null:null,'attributes':_0x2f22e4[_0xa92c('0x1c')]?_0x2f22e4['options'][_0xa92c('0x1f')]||null:null,'include':_0x2f22e4[_0xa92c('0x1c')]?_0x2f22e4[_0xa92c('0x1c')][_0xa92c('0x21')]?_[_0xa92c('0x23')](_0x2f22e4['options'][_0xa92c('0x21')],function(_0x38ffe7){return{'model':db[_0x38ffe7[_0xa92c('0x22')]],'as':_0x38ffe7['as'],'attributes':_0x38ffe7[_0xa92c('0x1f')],'include':_0x38ffe7['include']?_['map'](_0x38ffe7[_0xa92c('0x21')],function(_0x5684e7){return{'model':db[_0x5684e7[_0xa92c('0x22')]],'as':_0x5684e7['as'],'attributes':_0x5684e7[_0xa92c('0x1f')],'include':_0x5684e7[_0xa92c('0x21')]?_[_0xa92c('0x23')](_0x5684e7[_0xa92c('0x21')],function(_0x2a5c9a){return{'model':db[_0x2a5c9a['model']],'as':_0x2a5c9a['as'],'attributes':_0x2a5c9a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa92c('0x24')](function(_0x1ef6f7){logger['info'](_0xa92c('0x28'),_0x2f22e4);logger['debug']('ShowWhatsappQueue',_0x2f22e4,JSON[_0xa92c('0x16')](_0x1ef6f7));_0x4642cb(_0x1ef6f7);})[_0xa92c('0x1b')](function(_0x137a36){logger[_0xa92c('0x17')]('ShowWhatsappQueue',_0x137a36[_0xa92c('0x19')],_0x2f22e4);_0x30f9a9(_0x2a063c[_0xa92c('0x17')](0x1f4,_0x137a36[_0xa92c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 15cc71a..8f93fb6 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 _0x7682=['save','remove','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0x7682,0xef));var _0x2768=function(_0x215b3a,_0x7d37cc){_0x215b3a=_0x215b3a-0x0;var _0x5fbbd=_0x7682[_0x215b3a];return _0x5fbbd;};'use strict';var WhatsappQueueEvents=require(_0x2768('0x0'));var events=[_0x2768('0x1'),_0x2768('0x2'),'update'];function createListener(_0x13427e,_0xca1302){return function(_0x2db91c){_0xca1302[_0x2768('0x3')](_0x13427e,_0x2db91c);};}function removeListener(_0x4f111d,_0x2f954b){return function(){WhatsappQueueEvents[_0x2768('0x4')](_0x4f111d,_0x2f954b);};}exports[_0x2768('0x5')]=function(_0x4b8b44){for(var _0x3f4847=0x0,_0x498a25=events[_0x2768('0x6')];_0x3f4847<_0x498a25;_0x3f4847++){var _0x21ab31=events[_0x3f4847];var _0x4426d4=createListener(_0x2768('0x7')+_0x21ab31,_0x4b8b44);WhatsappQueueEvents['on'](_0x21ab31,_0x4426d4);}}; \ No newline at end of file +var _0xe0b4=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x366fbb,_0xef9453){var _0x298c53=function(_0x20d9b6){while(--_0x20d9b6){_0x366fbb['push'](_0x366fbb['shift']());}};_0x298c53(++_0xef9453);}(_0xe0b4,0x12b));var _0x4e0b=function(_0x53d279,_0x324982){_0x53d279=_0x53d279-0x0;var _0x3a1ba4=_0xe0b4[_0x53d279];return _0x3a1ba4;};'use strict';var WhatsappQueueEvents=require(_0x4e0b('0x0'));var events=[_0x4e0b('0x1'),_0x4e0b('0x2'),_0x4e0b('0x3')];function createListener(_0x5d5023,_0x242373){return function(_0x314381){_0x242373[_0x4e0b('0x4')](_0x5d5023,_0x314381);};}function removeListener(_0x1b4f46,_0x4bb757){return function(){WhatsappQueueEvents[_0x4e0b('0x5')](_0x1b4f46,_0x4bb757);};}exports[_0x4e0b('0x6')]=function(_0xd44a37){for(var _0x22e210=0x0,_0x425475=events[_0x4e0b('0x7')];_0x22e210<_0x425475;_0x22e210++){var _0x377080=events[_0x22e210];var _0x5f3ab2=createListener(_0x4e0b('0x8')+_0x377080,_0xd44a37);WhatsappQueueEvents['on'](_0x377080,_0x5f3ab2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b295b0e..6c5ddf4 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 _0x36c5=['util','path','connect-timeout','fs-extra','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','destroy','multer'];(function(_0x19f695,_0x10e171){var _0x4307d0=function(_0x412dce){while(--_0x412dce){_0x19f695['push'](_0x19f695['shift']());}};_0x4307d0(++_0x10e171);}(_0x36c5,0xcf));var _0x536c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x536c('0x0'));var util=require(_0x536c('0x1'));var path=require(_0x536c('0x2'));var timeout=require(_0x536c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x536c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x536c('0x5'));var controller=require(_0x536c('0x6'));router[_0x536c('0x7')]('/',auth['isAuthenticated'](),controller[_0x536c('0x8')]);router['get'](_0x536c('0x9'),auth['isAuthenticated'](),controller[_0x536c('0xa')]);router[_0x536c('0x7')](_0x536c('0xb'),auth[_0x536c('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x536c('0xd')]);router[_0x536c('0xe')]('/:id',auth[_0x536c('0xc')](),controller['update']);router['delete']('/:id',auth[_0x536c('0xc')](),controller[_0x536c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x07fc=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x07fc,0x163));var _0xc07f=function(_0x3cc77d,_0xcdb0c6){_0x3cc77d=_0x3cc77d-0x0;var _0x5c73b1=_0x07fc[_0x3cc77d];return _0x5c73b1;};'use strict';var multer=require(_0xc07f('0x0'));var util=require(_0xc07f('0x1'));var path=require(_0xc07f('0x2'));var timeout=require('connect-timeout');var express=require(_0xc07f('0x3'));var router=express[_0xc07f('0x4')]();var fs_extra=require(_0xc07f('0x5'));var auth=require(_0xc07f('0x6'));var interaction=require(_0xc07f('0x7'));var config=require(_0xc07f('0x8'));var controller=require(_0xc07f('0x9'));router['get']('/',auth[_0xc07f('0xa')](),controller[_0xc07f('0xb')]);router[_0xc07f('0xc')](_0xc07f('0xd'),auth[_0xc07f('0xa')](),controller['describe']);router[_0xc07f('0xc')](_0xc07f('0xe'),auth[_0xc07f('0xa')](),controller[_0xc07f('0xf')]);router[_0xc07f('0x10')]('/',auth[_0xc07f('0xa')](),controller[_0xc07f('0x11')]);router[_0xc07f('0x12')]('/:id',auth[_0xc07f('0xa')](),controller[_0xc07f('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc07f('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 36135ce..0d7e5df 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3a3cf7,_0x2a3dbc){var _0x426054=function(_0x3e5e70){while(--_0x3e5e70){_0x3a3cf7['push'](_0x3a3cf7['shift']());}};_0x426054(++_0x2a3dbc);}(_0x7a54,0x106));var _0x47a5=function(_0xc3cf,_0x451b6e){_0xc3cf=_0xc3cf-0x0;var _0x33af03=_0x7a54[_0xc3cf];return _0x33af03;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5d8611,_0x3e8fee){var _0x5e116b=function(_0x234121){while(--_0x234121){_0x5d8611['push'](_0x5d8611['shift']());}};_0x5e116b(++_0x3e8fee);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 05ddb41..d18dd34 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 _0xd914=['util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','WhatsappQueueReport','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x174a2f,_0x34a39c){var _0xec53c1=function(_0x3e67d0){while(--_0x3e67d0){_0x174a2f['push'](_0x174a2f['shift']());}};_0xec53c1(++_0x34a39c);}(_0xd914,0x17f));var _0x4d91=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0xd914[_0xacb1e2];return _0x463815;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];function respondWithStatusCode(_0x1c15b7,_0x318e0c){_0x318e0c=_0x318e0c||0xcc;return function(_0x4ea591){if(_0x4ea591){return _0x1c15b7['sendStatus'](_0x318e0c);}return _0x1c15b7[_0x4d91('0x1b')](_0x318e0c)[_0x4d91('0x1c')]();};}function respondWithResult(_0xb6590d,_0x3c9fd6){_0x3c9fd6=_0x3c9fd6||0xc8;return function(_0x33fbd4){if(_0x33fbd4){return _0xb6590d[_0x4d91('0x1b')](_0x3c9fd6)[_0x4d91('0x1d')](_0x33fbd4);}};}function respondWithFilteredResult(_0x4f5aef,_0x3a8ec9){return function(_0x42631a){if(_0x42631a){var _0x1e2ef7=typeof _0x3a8ec9[_0x4d91('0x1e')]===_0x4d91('0x1f')&&typeof _0x3a8ec9['limit']===_0x4d91('0x1f');var _0xb75abf=_0x42631a[_0x4d91('0x20')];var _0x44b9a7=_0x1e2ef7?0x0:_0x3a8ec9['offset'];var _0x350e23=_0x1e2ef7?_0x42631a[_0x4d91('0x20')]:_0x3a8ec9[_0x4d91('0x1e')]+_0x3a8ec9['limit'];var _0x13ef2c;if(_0x350e23>=_0xb75abf){_0x350e23=_0xb75abf;_0x13ef2c=0xc8;}else{_0x13ef2c=0xce;}_0x4f5aef[_0x4d91('0x1b')](_0x13ef2c);return _0x4f5aef[_0x4d91('0x21')](_0x4d91('0x22'),_0x44b9a7+'-'+_0x350e23+'/'+_0xb75abf)[_0x4d91('0x1d')](_0x42631a);}return null;};}function patchUpdates(_0x40cde4){return function(_0xc1d44f){try{jsonpatch[_0x4d91('0x23')](_0xc1d44f,_0x40cde4,!![]);}catch(_0x30d911){return BPromise[_0x4d91('0x24')](_0x30d911);}return _0xc1d44f['save']();};}function saveUpdates(_0x4493da,_0x5f5236){return function(_0x57913e){if(_0x57913e){return _0x57913e[_0x4d91('0x25')](_0x4493da)[_0x4d91('0x26')](function(_0x341d18){return _0x341d18;});}return null;};}function removeEntity(_0x9cb864,_0x7d8cbf){return function(_0x12b722){if(_0x12b722){return _0x12b722[_0x4d91('0x27')]()[_0x4d91('0x26')](function(){_0x9cb864['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee6b3,_0x112923){return function(_0x3bed98){if(!_0x3bed98){_0x1ee6b3[_0x4d91('0x28')](0x194);}return _0x3bed98;};}function handleError(_0x472f3a,_0x2c7d7a){_0x2c7d7a=_0x2c7d7a||0x1f4;return function(_0x14bdb4){logger['error'](_0x14bdb4[_0x4d91('0x29')]);if(_0x14bdb4[_0x4d91('0x2a')]){delete _0x14bdb4[_0x4d91('0x2a')];}_0x472f3a['status'](_0x2c7d7a)['send'](_0x14bdb4);};}exports[_0x4d91('0x2b')]=function(_0x470079,_0x5ed948){var _0x50fe76={},_0x42d5a0={},_0x2d6981={'count':0x0,'rows':[]};var _0x43371e=_[_0x4d91('0x2c')](db['WhatsappQueueReport'][_0x4d91('0x2d')],function(_0x31bbf8){return{'name':_0x31bbf8[_0x4d91('0x2e')],'type':_0x31bbf8[_0x4d91('0x2f')][_0x4d91('0x30')]};});_0x42d5a0[_0x4d91('0x31')]=_[_0x4d91('0x2c')](_0x43371e,'name');_0x42d5a0[_0x4d91('0x32')]=_['keys'](_0x470079['query']);_0x42d5a0[_0x4d91('0x33')]=_[_0x4d91('0x34')](_0x42d5a0['model'],_0x42d5a0[_0x4d91('0x32')]);_0x50fe76[_0x4d91('0x35')]=_[_0x4d91('0x34')](_0x42d5a0[_0x4d91('0x31')],qs[_0x4d91('0x36')](_0x470079['query'][_0x4d91('0x36')]));_0x50fe76[_0x4d91('0x35')]=_0x50fe76[_0x4d91('0x35')][_0x4d91('0x37')]?_0x50fe76[_0x4d91('0x35')]:_0x42d5a0[_0x4d91('0x31')];if(!_0x470079['query'][_0x4d91('0x38')](_0x4d91('0x39'))){_0x50fe76['limit']=qs[_0x4d91('0x3a')](_0x470079[_0x4d91('0x32')][_0x4d91('0x3a')]);_0x50fe76['offset']=qs[_0x4d91('0x1e')](_0x470079[_0x4d91('0x32')][_0x4d91('0x1e')]);}_0x50fe76[_0x4d91('0x3b')]=qs['sort'](_0x470079[_0x4d91('0x32')][_0x4d91('0x3c')]);_0x50fe76[_0x4d91('0x3d')]=qs[_0x4d91('0x33')](_['pick'](_0x470079['query'],_0x42d5a0[_0x4d91('0x33')]),_0x43371e);if(_0x470079[_0x4d91('0x32')]['filter']){_0x50fe76[_0x4d91('0x3d')]=_[_0x4d91('0x3e')](_0x50fe76[_0x4d91('0x3d')],{'$or':_[_0x4d91('0x2c')](_0x43371e,function(_0x5d93c1){if(_0x5d93c1[_0x4d91('0x2f')]!==_0x4d91('0x3f')){var _0x571a0c={};_0x571a0c[_0x5d93c1[_0x4d91('0x2a')]]={'$like':'%'+_0x470079['query'][_0x4d91('0x40')]+'%'};return _0x571a0c;}})});}_0x50fe76=_['merge']({},_0x50fe76,_0x470079[_0x4d91('0x41')]);var _0x49742b={'where':_0x50fe76[_0x4d91('0x3d')]};return db[_0x4d91('0x42')][_0x4d91('0x20')](_0x49742b)[_0x4d91('0x26')](function(_0x4f6576){_0x2d6981['count']=_0x4f6576;if(_0x470079[_0x4d91('0x32')]['includeAll']){_0x50fe76[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x42')]['findAll'](_0x50fe76);})[_0x4d91('0x26')](function(_0x2ae356){_0x2d6981[_0x4d91('0x44')]=_0x2ae356;return _0x2d6981;})[_0x4d91('0x26')](respondWithFilteredResult(_0x5ed948,_0x50fe76))[_0x4d91('0x45')](handleError(_0x5ed948,null));};exports[_0x4d91('0x46')]=function(_0x23902f,_0x4f6254){var _0x1e4c6d={'raw':!![],'where':{'id':_0x23902f[_0x4d91('0x47')]['id']}},_0x4c70af={};_0x4c70af[_0x4d91('0x31')]=_[_0x4d91('0x48')](db[_0x4d91('0x42')][_0x4d91('0x2d')]);_0x4c70af[_0x4d91('0x32')]=_['keys'](_0x23902f['query']);_0x4c70af[_0x4d91('0x33')]=_[_0x4d91('0x34')](_0x4c70af['model'],_0x4c70af[_0x4d91('0x32')]);_0x1e4c6d[_0x4d91('0x35')]=_[_0x4d91('0x34')](_0x4c70af[_0x4d91('0x31')],qs[_0x4d91('0x36')](_0x23902f[_0x4d91('0x32')][_0x4d91('0x36')]));_0x1e4c6d[_0x4d91('0x35')]=_0x1e4c6d[_0x4d91('0x35')]['length']?_0x1e4c6d['attributes']:_0x4c70af[_0x4d91('0x31')];if(_0x23902f['query'][_0x4d91('0x49')]){_0x1e4c6d[_0x4d91('0x43')]=[{'all':!![]}];}_0x1e4c6d=_[_0x4d91('0x3e')]({},_0x1e4c6d,_0x23902f[_0x4d91('0x41')]);return db['WhatsappQueueReport'][_0x4d91('0x4a')](_0x1e4c6d)['then'](handleEntityNotFound(_0x4f6254,null))['then'](respondWithResult(_0x4f6254,null))[_0x4d91('0x45')](handleError(_0x4f6254,null));};exports[_0x4d91('0x4b')]=function(_0x18073d,_0xa03d75){return db[_0x4d91('0x42')][_0x4d91('0x4b')](_0x18073d['body'],{})[_0x4d91('0x26')](respondWithResult(_0xa03d75,0xc9))[_0x4d91('0x45')](handleError(_0xa03d75,null));};exports[_0x4d91('0x25')]=function(_0x449dd8,_0x106e5b){if(_0x449dd8[_0x4d91('0x4c')]['id']){delete _0x449dd8[_0x4d91('0x4c')]['id'];}return db[_0x4d91('0x42')][_0x4d91('0x4a')]({'where':{'id':_0x449dd8[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x106e5b,null))['then'](saveUpdates(_0x449dd8[_0x4d91('0x4c')],null))['then'](respondWithResult(_0x106e5b,null))[_0x4d91('0x45')](handleError(_0x106e5b,null));};exports[_0x4d91('0x27')]=function(_0x195e65,_0x386935){return db[_0x4d91('0x42')][_0x4d91('0x4a')]({'where':{'id':_0x195e65[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x386935,null))['then'](removeEntity(_0x386935,null))[_0x4d91('0x45')](handleError(_0x386935,null));};exports[_0x4d91('0x4d')]=function(_0x3fe9ee,_0x2bba43){return db[_0x4d91('0x42')][_0x4d91('0x4d')]()[_0x4d91('0x26')](respondWithResult(_0x2bba43,null))['catch'](handleError(_0x2bba43,null));}; \ No newline at end of file +var _0x1339=['../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','end','sendStatus','error','name','send','index','map','WhatsappQueueReport','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','update','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x8d618c,_0x95c2e){var _0x265013=function(_0x51d693){while(--_0x51d693){_0x8d618c['push'](_0x8d618c['shift']());}};_0x265013(++_0x95c2e);}(_0x1339,0x1ed));var _0x9133=function(_0x2037a7,_0x21857e){_0x2037a7=_0x2037a7-0x0;var _0x2f200=_0x1339[_0x2037a7];return _0x2f200;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x22')]();});}};}function handleEntityNotFound(_0x3f278d,_0x14c1cb){return function(_0x4483ef){if(!_0x4483ef){_0x3f278d[_0x9133('0x23')](0x194);}return _0x4483ef;};}function handleError(_0x294332,_0x313d43){_0x313d43=_0x313d43||0x1f4;return function(_0x1b6b3e){logger[_0x9133('0x24')](_0x1b6b3e['stack']);if(_0x1b6b3e['name']){delete _0x1b6b3e[_0x9133('0x25')];}_0x294332[_0x9133('0x1a')](_0x313d43)[_0x9133('0x26')](_0x1b6b3e);};}exports[_0x9133('0x27')]=function(_0x4de894,_0x4ecd9e){var _0x3e2404={},_0x45966d={},_0x188c49={'count':0x0,'rows':[]};var _0x26d351=_[_0x9133('0x28')](db[_0x9133('0x29')]['rawAttributes'],function(_0x58afe0){return{'name':_0x58afe0['fieldName'],'type':_0x58afe0[_0x9133('0x2a')]['key']};});_0x45966d[_0x9133('0x2b')]=_[_0x9133('0x28')](_0x26d351,'name');_0x45966d[_0x9133('0x2c')]=_['keys'](_0x4de894[_0x9133('0x2c')]);_0x45966d[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x45966d['model'],_0x45966d[_0x9133('0x2c')]);_0x3e2404[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x45966d['model'],qs[_0x9133('0x30')](_0x4de894[_0x9133('0x2c')][_0x9133('0x30')]));_0x3e2404['attributes']=_0x3e2404[_0x9133('0x2f')][_0x9133('0x31')]?_0x3e2404[_0x9133('0x2f')]:_0x45966d[_0x9133('0x2b')];if(!_0x4de894['query'][_0x9133('0x32')](_0x9133('0x33'))){_0x3e2404['limit']=qs[_0x9133('0x1d')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1d')]);_0x3e2404[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1e')]);}_0x3e2404[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4de894[_0x9133('0x2c')][_0x9133('0x35')]);_0x3e2404['where']=qs[_0x9133('0x2d')](_[_0x9133('0x36')](_0x4de894['query'],_0x45966d[_0x9133('0x2d')]),_0x26d351);if(_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]){_0x3e2404[_0x9133('0x38')]=_[_0x9133('0x39')](_0x3e2404[_0x9133('0x38')],{'$or':_['map'](_0x26d351,function(_0x4e16d2){if(_0x4e16d2[_0x9133('0x2a')]!==_0x9133('0x3a')){var _0x156905={};_0x156905[_0x4e16d2[_0x9133('0x25')]]={'$like':'%'+_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]+'%'};return _0x156905;}})});}_0x3e2404=_[_0x9133('0x39')]({},_0x3e2404,_0x4de894[_0x9133('0x3b')]);var _0x720048={'where':_0x3e2404['where']};return db[_0x9133('0x29')][_0x9133('0x3c')](_0x720048)[_0x9133('0x20')](function(_0x199ae9){_0x188c49[_0x9133('0x3c')]=_0x199ae9;if(_0x4de894['query'][_0x9133('0x3d')]){_0x3e2404[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x29')][_0x9133('0x3f')](_0x3e2404);})['then'](function(_0x146734){_0x188c49[_0x9133('0x40')]=_0x146734;return _0x188c49;})[_0x9133('0x20')](respondWithFilteredResult(_0x4ecd9e,_0x3e2404))[_0x9133('0x41')](handleError(_0x4ecd9e,null));};exports[_0x9133('0x42')]=function(_0x338049,_0x3b2287){var _0x4ca1a3={'raw':!![],'where':{'id':_0x338049['params']['id']}},_0x7f6cd9={};_0x7f6cd9['model']=_[_0x9133('0x43')](db[_0x9133('0x29')][_0x9133('0x44')]);_0x7f6cd9[_0x9133('0x2c')]=_[_0x9133('0x43')](_0x338049[_0x9133('0x2c')]);_0x7f6cd9[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],_0x7f6cd9['query']);_0x4ca1a3[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],qs['fields'](_0x338049['query'][_0x9133('0x30')]));_0x4ca1a3[_0x9133('0x2f')]=_0x4ca1a3['attributes'][_0x9133('0x31')]?_0x4ca1a3[_0x9133('0x2f')]:_0x7f6cd9[_0x9133('0x2b')];if(_0x338049[_0x9133('0x2c')][_0x9133('0x3d')]){_0x4ca1a3['include']=[{'all':!![]}];}_0x4ca1a3=_[_0x9133('0x39')]({},_0x4ca1a3,_0x338049[_0x9133('0x3b')]);return db[_0x9133('0x29')]['find'](_0x4ca1a3)[_0x9133('0x20')](handleEntityNotFound(_0x3b2287,null))[_0x9133('0x20')](respondWithResult(_0x3b2287,null))['catch'](handleError(_0x3b2287,null));};exports['create']=function(_0x42c188,_0x2cd935){return db[_0x9133('0x29')][_0x9133('0x45')](_0x42c188[_0x9133('0x46')],{})[_0x9133('0x20')](respondWithResult(_0x2cd935,0xc9))[_0x9133('0x41')](handleError(_0x2cd935,null));};exports[_0x9133('0x47')]=function(_0x23f134,_0xf07fbb){if(_0x23f134[_0x9133('0x46')]['id']){delete _0x23f134[_0x9133('0x46')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x23f134[_0x9133('0x48')]['id']}})['then'](handleEntityNotFound(_0xf07fbb,null))[_0x9133('0x20')](saveUpdates(_0x23f134[_0x9133('0x46')],null))[_0x9133('0x20')](respondWithResult(_0xf07fbb,null))[_0x9133('0x41')](handleError(_0xf07fbb,null));};exports['destroy']=function(_0x2a3848,_0x25750f){return db[_0x9133('0x29')]['find']({'where':{'id':_0x2a3848[_0x9133('0x48')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x25750f,null))[_0x9133('0x20')](removeEntity(_0x25750f,null))['catch'](handleError(_0x25750f,null));};exports[_0x9133('0x49')]=function(_0x4f7b1e,_0x2342f4){return db[_0x9133('0x29')][_0x9133('0x49')]()[_0x9133('0x20')](respondWithResult(_0x2342f4,null))['catch'](handleError(_0x2342f4,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 691e479..0d90cb9 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 _0x25e7=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','request-promise'];(function(_0x27fc24,_0xe3def5){var _0x361788=function(_0xcd606a){while(--_0xcd606a){_0x27fc24['push'](_0x27fc24['shift']());}};_0x361788(++_0xe3def5);}(_0x25e7,0x126));var _0x725e=function(_0x2856c6,_0x745fd1){_0x2856c6=_0x2856c6-0x0;var _0x5f23a1=_0x25e7[_0x2856c6];return _0x5f23a1;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require('../../config/logger')(_0x725e('0x2'));var moment=require(_0x725e('0x3'));var BPromise=require('bluebird');var rp=require(_0x725e('0x4'));var fs=require('fs');var path=require(_0x725e('0x5'));var rimraf=require(_0x725e('0x6'));var config=require(_0x725e('0x7'));var attributes=require(_0x725e('0x8'));module[_0x725e('0x9')]=function(_0x3f1cd3,_0xa01322){return _0x3f1cd3['define'](_0x725e('0xa'),attributes,{'tableName':_0x725e('0xb'),'paranoid':![],'indexes':[{'name':_0x725e('0xc'),'fields':[_0x725e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb98=['../../config/logger','api','request-promise','path','rimraf','exports','define','uniqueid','lodash'];(function(_0x3f7101,_0x3af08b){var _0x1a30a0=function(_0x750e5b){while(--_0x750e5b){_0x3f7101['push'](_0x3f7101['shift']());}};_0x1a30a0(++_0x3af08b);}(_0xfb98,0x131));var _0x8fb9=function(_0x4d366e,_0x1d24b1){_0x4d366e=_0x4d366e-0x0;var _0x3a3f6d=_0xfb98[_0x4d366e];return _0x3a3f6d;};'use strict';var _=require(_0x8fb9('0x0'));var util=require('util');var logger=require(_0x8fb9('0x1'))(_0x8fb9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8fb9('0x3'));var fs=require('fs');var path=require(_0x8fb9('0x4'));var rimraf=require(_0x8fb9('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x8fb9('0x6')]=function(_0x3031e6,_0x14472f){return _0x3031e6[_0x8fb9('0x7')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x8fb9('0x8'),'fields':[_0x8fb9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index de9858f..9c5a50a 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 _0x019f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','info','result','WhatsappQueueReport','body','CreateWhatsappQueueReport','catch','message','UpdateWhatsappQueueReport','update','options','raw','attributes','limit','lodash','moment','randomstring'];(function(_0x1847fd,_0x48bb28){var _0x426713=function(_0x5e3e35){while(--_0x5e3e35){_0x1847fd['push'](_0x1847fd['shift']());}};_0x426713(++_0x48bb28);}(_0x019f,0xcf));var _0xf019=function(_0x2bcc8d,_0x5691d1){_0x2bcc8d=_0x2bcc8d-0x0;var _0x123b6a=_0x019f[_0x2bcc8d];return _0x123b6a;};'use strict';var _=require(_0xf019('0x0'));var util=require('util');var moment=require(_0xf019('0x1'));var BPromise=require('bluebird');var rs=require(_0xf019('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf019('0x3'))['db'];var utils=require(_0xf019('0x4'));var logger=require(_0xf019('0x5'))(_0xf019('0x6'));var config=require(_0xf019('0x7'));var jayson=require(_0xf019('0x8'));var client=jayson['client'][_0xf019('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a6572,_0x26b3e1,_0x190632){return new BPromise(function(_0x2226ac,_0x2a6e60){return client[_0xf019('0xa')](_0x5a6572,_0x190632)[_0xf019('0xb')](function(_0x4043a3){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x26b3e1,_0xf019('0xc'));logger[_0xf019('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x26b3e1,_0xf019('0xc'),JSON[_0xf019('0xe')](_0x4043a3));if(_0x4043a3[_0xf019('0xf')]){if(_0x4043a3['error']['code']===0x1f4){logger[_0xf019('0xf')](_0xf019('0x10'),_0x26b3e1,_0x4043a3['error']['message']);return _0x2a6e60(_0x4043a3[_0xf019('0xf')]['message']);}logger[_0xf019('0xf')](_0xf019('0x10'),_0x26b3e1,_0x4043a3[_0xf019('0xf')]['message']);return _0x2226ac(_0x4043a3[_0xf019('0xf')]['message']);}else{logger[_0xf019('0x11')](_0xf019('0x10'),_0x26b3e1,_0xf019('0xc'));_0x2226ac(_0x4043a3[_0xf019('0x12')]['message']);}})['catch'](function(_0xe0d30){logger[_0xf019('0xf')](_0xf019('0x10'),_0x26b3e1,_0xe0d30);_0x2a6e60(_0xe0d30);});});}exports['CreateWhatsappQueueReport']=function(_0x12c64c){var _0x30c906=this;return new Promise(function(_0x1930c6,_0x103c0f){return db[_0xf019('0x13')]['create'](_0x12c64c[_0xf019('0x14')],{'raw':_0x12c64c['options']?_0x12c64c['options']['raw']===undefined?!![]:![]:!![]})[_0xf019('0xb')](function(_0x5b5c79){logger['info'](_0xf019('0x15'),_0x12c64c);logger[_0xf019('0xd')](_0xf019('0x15'),_0x12c64c,JSON['stringify'](_0x5b5c79));_0x1930c6(_0x5b5c79);})[_0xf019('0x16')](function(_0x50c833){logger[_0xf019('0xf')](_0xf019('0x15'),_0x50c833[_0xf019('0x17')],_0x12c64c);_0x103c0f(_0x30c906[_0xf019('0xf')](0x1f4,_0x50c833[_0xf019('0x17')]));});});};exports[_0xf019('0x18')]=function(_0x880074){var _0x3969ea=this;return new Promise(function(_0x1f9a45,_0x58ba07){return db[_0xf019('0x13')][_0xf019('0x19')](_0x880074[_0xf019('0x14')],{'raw':_0x880074[_0xf019('0x1a')]?_0x880074[_0xf019('0x1a')][_0xf019('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x880074['options']?_0x880074['options']['where']||null:null,'attributes':_0x880074['options']?_0x880074[_0xf019('0x1a')][_0xf019('0x1c')]||null:null,'limit':_0x880074[_0xf019('0x1a')]?_0x880074['options'][_0xf019('0x1d')]||null:null})[_0xf019('0xb')](function(_0x274d7d){logger['info'](_0xf019('0x18'),_0x880074);logger[_0xf019('0xd')](_0xf019('0x18'),_0x880074,JSON[_0xf019('0xe')](_0x274d7d));_0x1f9a45(_0x274d7d);})[_0xf019('0x16')](function(_0x4124d8){logger[_0xf019('0xf')]('UpdateWhatsappQueueReport',_0x4124d8['message'],_0x880074);_0x58ba07(_0x3969ea[_0xf019('0xf')](0x1f4,_0x4124d8['message']));});});}; \ No newline at end of file +var _0xc064=['client','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','WhatsappQueueReport','create','body','options','raw','stringify','CreateWhatsappQueueReport','update','where','attributes','limit','UpdateWhatsappQueueReport','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b03d6,_0x255bb0){var _0xb8c45c=function(_0x5bafc8){while(--_0x5bafc8){_0x4b03d6['push'](_0x4b03d6['shift']());}};_0xb8c45c(++_0x255bb0);}(_0xc064,0x173));var _0x4c06=function(_0x257437,_0x2f7d20){_0x257437=_0x257437-0x0;var _0xee1edf=_0xc064[_0x257437];return _0xee1edf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c06('0x0'))['db'];var utils=require(_0x4c06('0x1'));var logger=require(_0x4c06('0x2'))(_0x4c06('0x3'));var config=require(_0x4c06('0x4'));var jayson=require(_0x4c06('0x5'));var client=jayson[_0x4c06('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0d1a,_0x3d36de,_0x4d357c){return new BPromise(function(_0x1fd60f,_0xa49a0e){return client['request'](_0x3d0d1a,_0x4d357c)[_0x4c06('0x7')](function(_0x2abe08){logger[_0x4c06('0x8')](_0x4c06('0x9'),_0x3d36de,_0x4c06('0xa'));logger[_0x4c06('0xb')](_0x4c06('0xc'),_0x3d36de,'request\x20sent',JSON['stringify'](_0x2abe08));if(_0x2abe08[_0x4c06('0xd')]){if(_0x2abe08[_0x4c06('0xd')][_0x4c06('0xe')]===0x1f4){logger[_0x4c06('0xd')](_0x4c06('0x9'),_0x3d36de,_0x2abe08[_0x4c06('0xd')][_0x4c06('0xf')]);return _0xa49a0e(_0x2abe08['error'][_0x4c06('0xf')]);}logger[_0x4c06('0xd')](_0x4c06('0x9'),_0x3d36de,_0x2abe08[_0x4c06('0xd')][_0x4c06('0xf')]);return _0x1fd60f(_0x2abe08[_0x4c06('0xd')][_0x4c06('0xf')]);}else{logger[_0x4c06('0x8')](_0x4c06('0x9'),_0x3d36de,'request\x20sent');_0x1fd60f(_0x2abe08['result']['message']);}})[_0x4c06('0x10')](function(_0x5e01cb){logger[_0x4c06('0xd')](_0x4c06('0x9'),_0x3d36de,_0x5e01cb);_0xa49a0e(_0x5e01cb);});});}exports['CreateWhatsappQueueReport']=function(_0x488922){var _0x546096=this;return new Promise(function(_0x2f95b8,_0x51a3ac){return db[_0x4c06('0x11')][_0x4c06('0x12')](_0x488922[_0x4c06('0x13')],{'raw':_0x488922[_0x4c06('0x14')]?_0x488922[_0x4c06('0x14')][_0x4c06('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x567118){logger[_0x4c06('0x8')]('CreateWhatsappQueueReport',_0x488922);logger[_0x4c06('0xb')]('CreateWhatsappQueueReport',_0x488922,JSON[_0x4c06('0x16')](_0x567118));_0x2f95b8(_0x567118);})[_0x4c06('0x10')](function(_0x42c90d){logger[_0x4c06('0xd')](_0x4c06('0x17'),_0x42c90d[_0x4c06('0xf')],_0x488922);_0x51a3ac(_0x546096[_0x4c06('0xd')](0x1f4,_0x42c90d[_0x4c06('0xf')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2b651a){var _0x2d4710=this;return new Promise(function(_0x46444c,_0x227f0b){return db[_0x4c06('0x11')][_0x4c06('0x18')](_0x2b651a['body'],{'raw':_0x2b651a['options']?_0x2b651a['options'][_0x4c06('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b651a[_0x4c06('0x14')]?_0x2b651a[_0x4c06('0x14')][_0x4c06('0x19')]||null:null,'attributes':_0x2b651a['options']?_0x2b651a[_0x4c06('0x14')][_0x4c06('0x1a')]||null:null,'limit':_0x2b651a[_0x4c06('0x14')]?_0x2b651a['options'][_0x4c06('0x1b')]||null:null})[_0x4c06('0x7')](function(_0xc1811b){logger[_0x4c06('0x8')]('UpdateWhatsappQueueReport',_0x2b651a);logger['debug'](_0x4c06('0x1c'),_0x2b651a,JSON[_0x4c06('0x16')](_0xc1811b));_0x46444c(_0xc1811b);})[_0x4c06('0x10')](function(_0x2204e6){logger[_0x4c06('0xd')](_0x4c06('0x1c'),_0x2204e6['message'],_0x2b651a);_0x227f0b(_0x2d4710[_0x4c06('0xd')](0x1f4,_0x2204e6[_0x4c06('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index b8f5d66..a5409d1 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 _0x3f6d=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','describe','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x4c14c6,_0x1dfd37){var _0x4ca810=function(_0xb795f4){while(--_0xb795f4){_0x4c14c6['push'](_0x4c14c6['shift']());}};_0x4ca810(++_0x1dfd37);}(_0x3f6d,0x1b3));var _0xd3f6=function(_0x26c364,_0x4226c3){_0x26c364=_0x26c364-0x0;var _0x565bf4=_0x3f6d[_0x26c364];return _0x565bf4;};'use strict';var multer=require(_0xd3f6('0x0'));var util=require('util');var path=require(_0xd3f6('0x1'));var timeout=require(_0xd3f6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd3f6('0x3'));var auth=require(_0xd3f6('0x4'));var interaction=require(_0xd3f6('0x5'));var config=require(_0xd3f6('0x6'));var controller=require(_0xd3f6('0x7'));router[_0xd3f6('0x8')]('/',auth[_0xd3f6('0x9')](),controller['index']);router['get']('/describe',auth[_0xd3f6('0x9')](),controller[_0xd3f6('0xa')]);router[_0xd3f6('0x8')]('/:id',auth[_0xd3f6('0x9')](),controller[_0xd3f6('0xb')]);router[_0xd3f6('0xc')]('/',auth[_0xd3f6('0x9')](),controller[_0xd3f6('0xd')]);router[_0xd3f6('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd3f6('0xf')]);router[_0xd3f6('0x10')]('/:id',auth[_0xd3f6('0x9')](),controller[_0xd3f6('0x11')]);module[_0xd3f6('0x12')]=router; \ No newline at end of file +var _0xde3c=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','/:id','post','create'];(function(_0x47df9d,_0x532aed){var _0x16971a=function(_0x1894a4){while(--_0x1894a4){_0x47df9d['push'](_0x47df9d['shift']());}};_0x16971a(++_0x532aed);}(_0xde3c,0xcc));var _0xcde3=function(_0x39e4af,_0x499b6a){_0x39e4af=_0x39e4af-0x0;var _0x5b9c91=_0xde3c[_0x39e4af];return _0x5b9c91;};'use strict';var multer=require(_0xcde3('0x0'));var util=require(_0xcde3('0x1'));var path=require('path');var timeout=require(_0xcde3('0x2'));var express=require(_0xcde3('0x3'));var router=express[_0xcde3('0x4')]();var fs_extra=require(_0xcde3('0x5'));var auth=require(_0xcde3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcde3('0x7'));var controller=require(_0xcde3('0x8'));router[_0xcde3('0x9')]('/',auth['isAuthenticated'](),controller[_0xcde3('0xa')]);router[_0xcde3('0x9')]('/describe',auth[_0xcde3('0xb')](),controller[_0xcde3('0xc')]);router[_0xcde3('0x9')](_0xcde3('0xd'),auth[_0xcde3('0xb')](),controller['show']);router[_0xcde3('0xe')]('/',auth['isAuthenticated'](),controller[_0xcde3('0xf')]);router['put']('/:id',auth[_0xcde3('0xb')](),controller[_0xcde3('0x10')]);router[_0xcde3('0x11')](_0xcde3('0xd'),auth[_0xcde3('0xb')](),controller[_0xcde3('0x12')]);module[_0xcde3('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index ec02d7f..2ac0d70 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 _0x288a=['account','DATE','exports','STRING','ENUM'];(function(_0x128056,_0x4f314b){var _0x47da14=function(_0xf6f119){while(--_0xf6f119){_0x128056['push'](_0x128056['shift']());}};_0x47da14(++_0x4f314b);}(_0x288a,0x188));var _0xa288=function(_0x5e9c24,_0x404202){_0x5e9c24=_0x5e9c24-0x0;var _0x25c338=_0x288a[_0x5e9c24];return _0x25c338;};'use strict';var Sequelize=require('sequelize');module[_0xa288('0x0')]={'uniqueid':{'type':Sequelize[_0xa288('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa288('0x2')](_0xa288('0x3'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa288('0x4')]}}; \ No newline at end of file +var _0x7be1=['sequelize','exports','STRING','account','agent','queue','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7be1,0x165));var _0x17be=function(_0x3baaf2,_0x894e3d){_0x3baaf2=_0x3baaf2-0x0;var _0x50e8b0=_0x7be1[_0x3baaf2];return _0x50e8b0;};'use strict';var Sequelize=require(_0x17be('0x0'));module[_0x17be('0x1')]={'uniqueid':{'type':Sequelize[_0x17be('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x17be('0x3'),_0x17be('0x4'),_0x17be('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x17be('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f521f5c..392a535 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 _0x6017=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','keys','find','catch','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x2a1035,_0x407a8b){var _0x3713a1=function(_0x2f8e82){while(--_0x2f8e82){_0x2a1035['push'](_0x2a1035['shift']());}};_0x3713a1(++_0x407a8b);}(_0x6017,0xae));var _0x7601=function(_0xdabf39,_0xac872f){_0xdabf39=_0xdabf39-0x0;var _0x191b8f=_0x6017[_0xdabf39];return _0x191b8f;};'use strict';var emlformat=require(_0x7601('0x0'));var rimraf=require(_0x7601('0x1'));var zipdir=require(_0x7601('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7601('0x3'));var moment=require(_0x7601('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7601('0x5'));var util=require('util');var path=require(_0x7601('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7601('0x7'));var fs=require('fs');var fs_extra=require(_0x7601('0x8'));var _=require(_0x7601('0x9'));var squel=require(_0x7601('0xa'));var crypto=require(_0x7601('0xb'));var jsforce=require(_0x7601('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7601('0xd'));var querystring=require(_0x7601('0xe'));var Papa=require(_0x7601('0xf'));var Redis=require('ioredis');var authService=require(_0x7601('0x10'));var qs=require(_0x7601('0x11'));var as=require(_0x7601('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7601('0x13'))(_0x7601('0x14'));var utils=require(_0x7601('0x15'));var config=require(_0x7601('0x16'));var licenseUtil=require(_0x7601('0x17'));var db=require(_0x7601('0x18'))['db'];function respondWithStatusCode(_0x4001af,_0x1e2027){_0x1e2027=_0x1e2027||0xcc;return function(_0x2f5dbf){if(_0x2f5dbf){return _0x4001af[_0x7601('0x19')](_0x1e2027);}return _0x4001af['status'](_0x1e2027)[_0x7601('0x1a')]();};}function respondWithResult(_0x5ee63a,_0x4be36a){_0x4be36a=_0x4be36a||0xc8;return function(_0x2b8cbc){if(_0x2b8cbc){return _0x5ee63a[_0x7601('0x1b')](_0x4be36a)[_0x7601('0x1c')](_0x2b8cbc);}};}function respondWithFilteredResult(_0x33452d,_0x30b86d){return function(_0x3a1706){if(_0x3a1706){var _0xdd9b16=typeof _0x30b86d[_0x7601('0x1d')]==='undefined'&&typeof _0x30b86d[_0x7601('0x1e')]===_0x7601('0x1f');var _0x5329e6=_0x3a1706[_0x7601('0x20')];var _0x5c3fb7=_0xdd9b16?0x0:_0x30b86d['offset'];var _0x22520e=_0xdd9b16?_0x3a1706[_0x7601('0x20')]:_0x30b86d[_0x7601('0x1d')]+_0x30b86d[_0x7601('0x1e')];var _0x26f1b8;if(_0x22520e>=_0x5329e6){_0x22520e=_0x5329e6;_0x26f1b8=0xc8;}else{_0x26f1b8=0xce;}_0x33452d[_0x7601('0x1b')](_0x26f1b8);return _0x33452d[_0x7601('0x21')]('Content-Range',_0x5c3fb7+'-'+_0x22520e+'/'+_0x5329e6)[_0x7601('0x1c')](_0x3a1706);}return null;};}function patchUpdates(_0x1d58c0){return function(_0x4ed321){try{jsonpatch[_0x7601('0x22')](_0x4ed321,_0x1d58c0,!![]);}catch(_0x5169c9){return BPromise[_0x7601('0x23')](_0x5169c9);}return _0x4ed321[_0x7601('0x24')]();};}function saveUpdates(_0x99ab5b,_0x12f3f6){return function(_0x4cbf1e){if(_0x4cbf1e){return _0x4cbf1e[_0x7601('0x25')](_0x99ab5b)[_0x7601('0x26')](function(_0x140547){return _0x140547;});}return null;};}function removeEntity(_0x3a3629,_0x57e7a6){return function(_0x2b9bd){if(_0x2b9bd){return _0x2b9bd['destroy']()[_0x7601('0x26')](function(){_0x3a3629['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x326f8f,_0x1eb68c){return function(_0x5277d0){if(!_0x5277d0){_0x326f8f['sendStatus'](0x194);}return _0x5277d0;};}function handleError(_0x47644a,_0x519e47){_0x519e47=_0x519e47||0x1f4;return function(_0x57f6e9){logger[_0x7601('0x27')](_0x57f6e9[_0x7601('0x28')]);if(_0x57f6e9[_0x7601('0x29')]){delete _0x57f6e9['name'];}_0x47644a[_0x7601('0x1b')](_0x519e47)['send'](_0x57f6e9);};}exports[_0x7601('0x2a')]=function(_0xa05dda,_0x58fd92){var _0x4ab32d={},_0x44d765={},_0x13e8a7={'count':0x0,'rows':[]};var _0x1a2b2f=_[_0x7601('0x2b')](db[_0x7601('0x2c')][_0x7601('0x2d')],function(_0x5b961c){return{'name':_0x5b961c['fieldName'],'type':_0x5b961c[_0x7601('0x2e')][_0x7601('0x2f')]};});_0x44d765[_0x7601('0x30')]=_[_0x7601('0x2b')](_0x1a2b2f,_0x7601('0x29'));_0x44d765['query']=_['keys'](_0xa05dda[_0x7601('0x31')]);_0x44d765[_0x7601('0x32')]=_[_0x7601('0x33')](_0x44d765[_0x7601('0x30')],_0x44d765[_0x7601('0x31')]);_0x4ab32d['attributes']=_[_0x7601('0x33')](_0x44d765[_0x7601('0x30')],qs['fields'](_0xa05dda[_0x7601('0x31')][_0x7601('0x34')]));_0x4ab32d[_0x7601('0x35')]=_0x4ab32d[_0x7601('0x35')][_0x7601('0x36')]?_0x4ab32d['attributes']:_0x44d765[_0x7601('0x30')];if(!_0xa05dda[_0x7601('0x31')][_0x7601('0x37')](_0x7601('0x38'))){_0x4ab32d['limit']=qs[_0x7601('0x1e')](_0xa05dda['query']['limit']);_0x4ab32d[_0x7601('0x1d')]=qs[_0x7601('0x1d')](_0xa05dda[_0x7601('0x31')][_0x7601('0x1d')]);}_0x4ab32d[_0x7601('0x39')]=qs[_0x7601('0x3a')](_0xa05dda[_0x7601('0x31')][_0x7601('0x3a')]);_0x4ab32d[_0x7601('0x3b')]=qs[_0x7601('0x32')](_[_0x7601('0x3c')](_0xa05dda[_0x7601('0x31')],_0x44d765[_0x7601('0x32')]),_0x1a2b2f);if(_0xa05dda[_0x7601('0x31')]['filter']){_0x4ab32d[_0x7601('0x3b')]=_[_0x7601('0x3d')](_0x4ab32d[_0x7601('0x3b')],{'$or':_[_0x7601('0x2b')](_0x1a2b2f,function(_0x1bc502){if(_0x1bc502[_0x7601('0x2e')]!=='VIRTUAL'){var _0x3f32a2={};_0x3f32a2[_0x1bc502[_0x7601('0x29')]]={'$like':'%'+_0xa05dda['query'][_0x7601('0x3e')]+'%'};return _0x3f32a2;}})});}_0x4ab32d=_['merge']({},_0x4ab32d,_0xa05dda[_0x7601('0x3f')]);var _0x56e78b={'where':_0x4ab32d['where']};return db['WhatsappTransferReport'][_0x7601('0x20')](_0x56e78b)[_0x7601('0x26')](function(_0x434b90){_0x13e8a7[_0x7601('0x20')]=_0x434b90;if(_0xa05dda['query'][_0x7601('0x40')]){_0x4ab32d['include']=[{'all':!![]}];}return db[_0x7601('0x2c')][_0x7601('0x41')](_0x4ab32d);})[_0x7601('0x26')](function(_0xdf4ed){_0x13e8a7[_0x7601('0x42')]=_0xdf4ed;return _0x13e8a7;})[_0x7601('0x26')](respondWithFilteredResult(_0x58fd92,_0x4ab32d))['catch'](handleError(_0x58fd92,null));};exports[_0x7601('0x43')]=function(_0x5c2f8e,_0x81b852){var _0xa5fa08={'raw':!![],'where':{'id':_0x5c2f8e['params']['id']}},_0x58fd23={};_0x58fd23['model']=_['keys'](db[_0x7601('0x2c')][_0x7601('0x2d')]);_0x58fd23[_0x7601('0x31')]=_[_0x7601('0x44')](_0x5c2f8e[_0x7601('0x31')]);_0x58fd23[_0x7601('0x32')]=_[_0x7601('0x33')](_0x58fd23[_0x7601('0x30')],_0x58fd23[_0x7601('0x31')]);_0xa5fa08[_0x7601('0x35')]=_[_0x7601('0x33')](_0x58fd23[_0x7601('0x30')],qs[_0x7601('0x34')](_0x5c2f8e[_0x7601('0x31')][_0x7601('0x34')]));_0xa5fa08[_0x7601('0x35')]=_0xa5fa08['attributes'][_0x7601('0x36')]?_0xa5fa08[_0x7601('0x35')]:_0x58fd23[_0x7601('0x30')];if(_0x5c2f8e[_0x7601('0x31')][_0x7601('0x40')]){_0xa5fa08['include']=[{'all':!![]}];}_0xa5fa08=_[_0x7601('0x3d')]({},_0xa5fa08,_0x5c2f8e['options']);return db[_0x7601('0x2c')][_0x7601('0x45')](_0xa5fa08)['then'](handleEntityNotFound(_0x81b852,null))['then'](respondWithResult(_0x81b852,null))[_0x7601('0x46')](handleError(_0x81b852,null));};exports[_0x7601('0x47')]=function(_0x29aafa,_0x2b8ec1){return db[_0x7601('0x2c')][_0x7601('0x47')](_0x29aafa['body'],{})[_0x7601('0x26')](respondWithResult(_0x2b8ec1,0xc9))['catch'](handleError(_0x2b8ec1,null));};exports['update']=function(_0x2c3b10,_0x16c01c){if(_0x2c3b10[_0x7601('0x48')]['id']){delete _0x2c3b10['body']['id'];}return db[_0x7601('0x2c')][_0x7601('0x45')]({'where':{'id':_0x2c3b10['params']['id']}})[_0x7601('0x26')](handleEntityNotFound(_0x16c01c,null))[_0x7601('0x26')](saveUpdates(_0x2c3b10[_0x7601('0x48')],null))[_0x7601('0x26')](respondWithResult(_0x16c01c,null))[_0x7601('0x46')](handleError(_0x16c01c,null));};exports[_0x7601('0x49')]=function(_0x25582b,_0x5e6f25){return db[_0x7601('0x2c')][_0x7601('0x45')]({'where':{'id':_0x25582b[_0x7601('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5e6f25,null))[_0x7601('0x26')](removeEntity(_0x5e6f25,null))[_0x7601('0x46')](handleError(_0x5e6f25,null));};exports[_0x7601('0x4b')]=function(_0x8a5747,_0x3df2c2){return db['WhatsappTransferReport'][_0x7601('0x4b')]()[_0x7601('0x26')](respondWithResult(_0x3df2c2,null))[_0x7601('0x46')](handleError(_0x3df2c2,null));}; \ No newline at end of file +var _0xb426=['rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','map','WhatsappTransferReport'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0xb426,0xbc));var _0x6b42=function(_0x5161d1,_0x158f11){_0x5161d1=_0x5161d1-0x0;var _0x287fe6=_0xb426[_0x5161d1];return _0x287fe6;};'use strict';var emlformat=require(_0x6b42('0x0'));var rimraf=require(_0x6b42('0x1'));var zipdir=require(_0x6b42('0x2'));var jsonpatch=require(_0x6b42('0x3'));var rp=require(_0x6b42('0x4'));var moment=require(_0x6b42('0x5'));var BPromise=require(_0x6b42('0x6'));var Mustache=require(_0x6b42('0x7'));var util=require('util');var path=require(_0x6b42('0x8'));var sox=require(_0x6b42('0x9'));var csv=require(_0x6b42('0xa'));var ejs=require(_0x6b42('0xb'));var fs=require('fs');var fs_extra=require(_0x6b42('0xc'));var _=require(_0x6b42('0xd'));var squel=require(_0x6b42('0xe'));var crypto=require(_0x6b42('0xf'));var jsforce=require(_0x6b42('0x10'));var deskjs=require(_0x6b42('0x11'));var toCsv=require(_0x6b42('0xa'));var querystring=require(_0x6b42('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6b42('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6b42('0x14'));var hardwareService=require(_0x6b42('0x15'));var logger=require(_0x6b42('0x16'))(_0x6b42('0x17'));var utils=require('../../config/utils');var config=require(_0x6b42('0x18'));var licenseUtil=require(_0x6b42('0x19'));var db=require(_0x6b42('0x1a'))['db'];function respondWithStatusCode(_0x2f3c68,_0x52c944){_0x52c944=_0x52c944||0xcc;return function(_0x3e64c8){if(_0x3e64c8){return _0x2f3c68[_0x6b42('0x1b')](_0x52c944);}return _0x2f3c68[_0x6b42('0x1c')](_0x52c944)[_0x6b42('0x1d')]();};}function respondWithResult(_0x342332,_0x5801f7){_0x5801f7=_0x5801f7||0xc8;return function(_0x43ee76){if(_0x43ee76){return _0x342332[_0x6b42('0x1c')](_0x5801f7)[_0x6b42('0x1e')](_0x43ee76);}};}function respondWithFilteredResult(_0x5eccf7,_0x456d25){return function(_0xfa9b8){if(_0xfa9b8){var _0x42ba33=typeof _0x456d25[_0x6b42('0x1f')]===_0x6b42('0x20')&&typeof _0x456d25[_0x6b42('0x21')]===_0x6b42('0x20');var _0x217067=_0xfa9b8['count'];var _0x3132b4=_0x42ba33?0x0:_0x456d25[_0x6b42('0x1f')];var _0x2abe02=_0x42ba33?_0xfa9b8['count']:_0x456d25[_0x6b42('0x1f')]+_0x456d25['limit'];var _0x2f03e7;if(_0x2abe02>=_0x217067){_0x2abe02=_0x217067;_0x2f03e7=0xc8;}else{_0x2f03e7=0xce;}_0x5eccf7['status'](_0x2f03e7);return _0x5eccf7[_0x6b42('0x22')](_0x6b42('0x23'),_0x3132b4+'-'+_0x2abe02+'/'+_0x217067)[_0x6b42('0x1e')](_0xfa9b8);}return null;};}function patchUpdates(_0x51f246){return function(_0x4ff44e){try{jsonpatch[_0x6b42('0x24')](_0x4ff44e,_0x51f246,!![]);}catch(_0x34bc02){return BPromise['reject'](_0x34bc02);}return _0x4ff44e[_0x6b42('0x25')]();};}function saveUpdates(_0x971cef,_0x2f0298){return function(_0x4b82b4){if(_0x4b82b4){return _0x4b82b4[_0x6b42('0x26')](_0x971cef)[_0x6b42('0x27')](function(_0x2de753){return _0x2de753;});}return null;};}function removeEntity(_0x8c1a1e,_0x30c186){return function(_0x3bf6c1){if(_0x3bf6c1){return _0x3bf6c1['destroy']()[_0x6b42('0x27')](function(){_0x8c1a1e[_0x6b42('0x1c')](0xcc)[_0x6b42('0x1d')]();});}};}function handleEntityNotFound(_0x2acacf,_0x3fbb17){return function(_0x25d285){if(!_0x25d285){_0x2acacf[_0x6b42('0x1b')](0x194);}return _0x25d285;};}function handleError(_0xcca211,_0x3ea83d){_0x3ea83d=_0x3ea83d||0x1f4;return function(_0x463933){logger['error'](_0x463933[_0x6b42('0x28')]);if(_0x463933[_0x6b42('0x29')]){delete _0x463933[_0x6b42('0x29')];}_0xcca211[_0x6b42('0x1c')](_0x3ea83d)[_0x6b42('0x2a')](_0x463933);};}exports[_0x6b42('0x2b')]=function(_0x9b011e,_0x5a5c64){var _0x4f477={},_0x14f286={},_0x536ff7={'count':0x0,'rows':[]};var _0x45f417=_[_0x6b42('0x2c')](db[_0x6b42('0x2d')][_0x6b42('0x2e')],function(_0x143505){return{'name':_0x143505['fieldName'],'type':_0x143505[_0x6b42('0x2f')]['key']};});_0x14f286[_0x6b42('0x30')]=_[_0x6b42('0x2c')](_0x45f417,_0x6b42('0x29'));_0x14f286[_0x6b42('0x31')]=_[_0x6b42('0x32')](_0x9b011e[_0x6b42('0x31')]);_0x14f286[_0x6b42('0x33')]=_[_0x6b42('0x34')](_0x14f286[_0x6b42('0x30')],_0x14f286[_0x6b42('0x31')]);_0x4f477[_0x6b42('0x35')]=_['intersection'](_0x14f286['model'],qs[_0x6b42('0x36')](_0x9b011e['query'][_0x6b42('0x36')]));_0x4f477['attributes']=_0x4f477[_0x6b42('0x35')][_0x6b42('0x37')]?_0x4f477[_0x6b42('0x35')]:_0x14f286[_0x6b42('0x30')];if(!_0x9b011e[_0x6b42('0x31')]['hasOwnProperty'](_0x6b42('0x38'))){_0x4f477['limit']=qs[_0x6b42('0x21')](_0x9b011e[_0x6b42('0x31')]['limit']);_0x4f477[_0x6b42('0x1f')]=qs[_0x6b42('0x1f')](_0x9b011e['query'][_0x6b42('0x1f')]);}_0x4f477[_0x6b42('0x39')]=qs[_0x6b42('0x3a')](_0x9b011e[_0x6b42('0x31')][_0x6b42('0x3a')]);_0x4f477[_0x6b42('0x3b')]=qs[_0x6b42('0x33')](_[_0x6b42('0x3c')](_0x9b011e['query'],_0x14f286[_0x6b42('0x33')]),_0x45f417);if(_0x9b011e['query'][_0x6b42('0x3d')]){_0x4f477[_0x6b42('0x3b')]=_[_0x6b42('0x3e')](_0x4f477[_0x6b42('0x3b')],{'$or':_['map'](_0x45f417,function(_0x2b24c2){if(_0x2b24c2[_0x6b42('0x2f')]!==_0x6b42('0x3f')){var _0x20ea19={};_0x20ea19[_0x2b24c2[_0x6b42('0x29')]]={'$like':'%'+_0x9b011e['query'][_0x6b42('0x3d')]+'%'};return _0x20ea19;}})});}_0x4f477=_[_0x6b42('0x3e')]({},_0x4f477,_0x9b011e[_0x6b42('0x40')]);var _0x5586b5={'where':_0x4f477['where']};return db['WhatsappTransferReport'][_0x6b42('0x41')](_0x5586b5)['then'](function(_0x14e495){_0x536ff7[_0x6b42('0x41')]=_0x14e495;if(_0x9b011e['query'][_0x6b42('0x42')]){_0x4f477['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x6b42('0x43')](_0x4f477);})[_0x6b42('0x27')](function(_0x36ad00){_0x536ff7[_0x6b42('0x44')]=_0x36ad00;return _0x536ff7;})[_0x6b42('0x27')](respondWithFilteredResult(_0x5a5c64,_0x4f477))[_0x6b42('0x45')](handleError(_0x5a5c64,null));};exports[_0x6b42('0x46')]=function(_0x2ac08b,_0x5d6ddc){var _0x29c514={'raw':!![],'where':{'id':_0x2ac08b[_0x6b42('0x47')]['id']}},_0x49ebb1={};_0x49ebb1[_0x6b42('0x30')]=_[_0x6b42('0x32')](db[_0x6b42('0x2d')][_0x6b42('0x2e')]);_0x49ebb1['query']=_['keys'](_0x2ac08b[_0x6b42('0x31')]);_0x49ebb1['filters']=_[_0x6b42('0x34')](_0x49ebb1[_0x6b42('0x30')],_0x49ebb1[_0x6b42('0x31')]);_0x29c514[_0x6b42('0x35')]=_[_0x6b42('0x34')](_0x49ebb1[_0x6b42('0x30')],qs['fields'](_0x2ac08b[_0x6b42('0x31')]['fields']));_0x29c514['attributes']=_0x29c514[_0x6b42('0x35')][_0x6b42('0x37')]?_0x29c514[_0x6b42('0x35')]:_0x49ebb1[_0x6b42('0x30')];if(_0x2ac08b[_0x6b42('0x31')][_0x6b42('0x42')]){_0x29c514[_0x6b42('0x48')]=[{'all':!![]}];}_0x29c514=_['merge']({},_0x29c514,_0x2ac08b['options']);return db[_0x6b42('0x2d')]['find'](_0x29c514)[_0x6b42('0x27')](handleEntityNotFound(_0x5d6ddc,null))[_0x6b42('0x27')](respondWithResult(_0x5d6ddc,null))[_0x6b42('0x45')](handleError(_0x5d6ddc,null));};exports[_0x6b42('0x49')]=function(_0x3b79f3,_0x369d44){return db[_0x6b42('0x2d')][_0x6b42('0x49')](_0x3b79f3['body'],{})['then'](respondWithResult(_0x369d44,0xc9))[_0x6b42('0x45')](handleError(_0x369d44,null));};exports[_0x6b42('0x26')]=function(_0x436cda,_0xba0f20){if(_0x436cda[_0x6b42('0x4a')]['id']){delete _0x436cda[_0x6b42('0x4a')]['id'];}return db[_0x6b42('0x2d')][_0x6b42('0x4b')]({'where':{'id':_0x436cda['params']['id']}})[_0x6b42('0x27')](handleEntityNotFound(_0xba0f20,null))[_0x6b42('0x27')](saveUpdates(_0x436cda[_0x6b42('0x4a')],null))[_0x6b42('0x27')](respondWithResult(_0xba0f20,null))[_0x6b42('0x45')](handleError(_0xba0f20,null));};exports[_0x6b42('0x4c')]=function(_0x443e0e,_0x20061d){return db[_0x6b42('0x2d')][_0x6b42('0x4b')]({'where':{'id':_0x443e0e['params']['id']}})[_0x6b42('0x27')](handleEntityNotFound(_0x20061d,null))['then'](removeEntity(_0x20061d,null))[_0x6b42('0x45')](handleError(_0x20061d,null));};exports['describe']=function(_0x1c7225,_0x1122a7){return db[_0x6b42('0x2d')][_0x6b42('0x4d')]()['then'](respondWithResult(_0x1122a7,null))['catch'](handleError(_0x1122a7,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index cb0c05d..5ed16e5 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 _0xe22e=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x14d99c,_0xa1b029){var _0x2a8f65=function(_0xc51369){while(--_0xc51369){_0x14d99c['push'](_0x14d99c['shift']());}};_0x2a8f65(++_0xa1b029);}(_0xe22e,0x138));var _0xee22=function(_0x3bd2c8,_0x395b96){_0x3bd2c8=_0x3bd2c8-0x0;var _0x25374f=_0xe22e[_0x3bd2c8];return _0x25374f;};'use strict';var _=require(_0xee22('0x0'));var util=require(_0xee22('0x1'));var logger=require(_0xee22('0x2'))(_0xee22('0x3'));var moment=require(_0xee22('0x4'));var BPromise=require('bluebird');var rp=require(_0xee22('0x5'));var fs=require('fs');var path=require(_0xee22('0x6'));var rimraf=require(_0xee22('0x7'));var config=require(_0xee22('0x8'));var attributes=require(_0xee22('0x9'));module[_0xee22('0xa')]=function(_0x3a525b,_0x2e989b){return _0x3a525b[_0xee22('0xb')](_0xee22('0xc'),attributes,{'tableName':_0xee22('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xee22('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0879=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4fc776,_0xa46b8a){var _0x33e056=function(_0x1eb549){while(--_0x1eb549){_0x4fc776['push'](_0x4fc776['shift']());}};_0x33e056(++_0xa46b8a);}(_0x0879,0x143));var _0x9087=function(_0xac218e,_0x4a3a42){_0xac218e=_0xac218e-0x0;var _0x513b6d=_0x0879[_0xac218e];return _0x513b6d;};'use strict';var _=require(_0x9087('0x0'));var util=require(_0x9087('0x1'));var logger=require(_0x9087('0x2'))(_0x9087('0x3'));var moment=require(_0x9087('0x4'));var BPromise=require('bluebird');var rp=require(_0x9087('0x5'));var fs=require('fs');var path=require(_0x9087('0x6'));var rimraf=require(_0x9087('0x7'));var config=require(_0x9087('0x8'));var attributes=require(_0x9087('0x9'));module[_0x9087('0xa')]=function(_0x2dd27a,_0x1754ac){return _0x2dd27a[_0x9087('0xb')](_0x9087('0xc'),attributes,{'tableName':_0x9087('0xd'),'paranoid':![],'indexes':[{'name':_0x9087('0xe'),'fields':[_0x9087('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 8b43e3c..1c363c7 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 _0x051b=['rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x530ef4,_0x4a1d40){var _0x56e14c=function(_0x4a39b7){while(--_0x4a39b7){_0x530ef4['push'](_0x530ef4['shift']());}};_0x56e14c(++_0x4a1d40);}(_0x051b,0x15a));var _0xb051=function(_0x2a4e8c,_0x59e704){_0x2a4e8c=_0x2a4e8c-0x0;var _0x4dc512=_0x051b[_0x2a4e8c];return _0x4dc512;};'use strict';var _=require(_0xb051('0x0'));var util=require(_0xb051('0x1'));var moment=require('moment');var BPromise=require(_0xb051('0x2'));var rs=require(_0xb051('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb051('0x4'))['db'];var utils=require(_0xb051('0x5'));var logger=require('../../config/logger')(_0xb051('0x6'));var config=require(_0xb051('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb051('0x8')][_0xb051('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfbb55d,_0x1b0725,_0x37354a){return new BPromise(function(_0x3dd668,_0x3edd7f){return client[_0xb051('0xa')](_0xfbb55d,_0x37354a)[_0xb051('0xb')](function(_0x1d21cc){logger[_0xb051('0xc')](_0xb051('0xd'),_0x1b0725,_0xb051('0xe'));logger[_0xb051('0xf')](_0xb051('0x10'),_0x1b0725,_0xb051('0xe'),JSON[_0xb051('0x11')](_0x1d21cc));if(_0x1d21cc['error']){if(_0x1d21cc[_0xb051('0x12')]['code']===0x1f4){logger[_0xb051('0x12')](_0xb051('0xd'),_0x1b0725,_0x1d21cc[_0xb051('0x12')][_0xb051('0x13')]);return _0x3edd7f(_0x1d21cc[_0xb051('0x12')][_0xb051('0x13')]);}logger[_0xb051('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1b0725,_0x1d21cc[_0xb051('0x12')]['message']);return _0x3dd668(_0x1d21cc['error'][_0xb051('0x13')]);}else{logger[_0xb051('0xc')](_0xb051('0xd'),_0x1b0725,'request\x20sent');_0x3dd668(_0x1d21cc[_0xb051('0x14')][_0xb051('0x13')]);}})[_0xb051('0x15')](function(_0x514634){logger['error'](_0xb051('0xd'),_0x1b0725,_0x514634);_0x3edd7f(_0x514634);});});} \ No newline at end of file +var _0xa25d=['debug','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','lodash','util','moment','ioredis','../../mysqldb','../../config/environment','client','then','info','request\x20sent'];(function(_0x226041,_0x31e59f){var _0x326df4=function(_0x1e86b6){while(--_0x1e86b6){_0x226041['push'](_0x226041['shift']());}};_0x326df4(++_0x31e59f);}(_0xa25d,0x1c7));var _0xda25=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0xa25d[_0x1a0c59];return _0xed67c9;};'use strict';var _=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var moment=require(_0xda25('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda25('0x3'));var db=require(_0xda25('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xda25('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xda25('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7997,_0xa8636e,_0x4e73c7){return new BPromise(function(_0x578894,_0x1997c9){return client['request'](_0x1d7997,_0x4e73c7)[_0xda25('0x7')](function(_0x2f096d){logger[_0xda25('0x8')]('WhatsappTransferReport,\x20%s,\x20%s',_0xa8636e,_0xda25('0x9'));logger[_0xda25('0xa')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xa8636e,'request\x20sent',JSON[_0xda25('0xb')](_0x2f096d));if(_0x2f096d['error']){if(_0x2f096d[_0xda25('0xc')]['code']===0x1f4){logger[_0xda25('0xc')](_0xda25('0xd'),_0xa8636e,_0x2f096d['error'][_0xda25('0xe')]);return _0x1997c9(_0x2f096d[_0xda25('0xc')][_0xda25('0xe')]);}logger[_0xda25('0xc')](_0xda25('0xd'),_0xa8636e,_0x2f096d[_0xda25('0xc')]['message']);return _0x578894(_0x2f096d[_0xda25('0xc')]['message']);}else{logger[_0xda25('0x8')](_0xda25('0xd'),_0xa8636e,_0xda25('0x9'));_0x578894(_0x2f096d['result'][_0xda25('0xe')]);}})['catch'](function(_0x1047f8){logger[_0xda25('0xc')](_0xda25('0xd'),_0xa8636e,_0x1047f8);_0x1997c9(_0x1047f8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 67c858c..9891dd1 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9769=['./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','listen','info','start','Online\x20apps:','filter','join','Offline\x20apps:','map','status','online','name','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config'];(function(_0x224b23,_0x481a79){var _0x52b348=function(_0x5a76d9){while(--_0x5a76d9){_0x224b23['push'](_0x224b23['shift']());}};_0x52b348(++_0x481a79);}(_0x9769,0x143));var _0x9976=function(_0x1d7566,_0x4298a4){_0x1d7566=_0x1d7566-0x0;var _0x1c5946=_0x9769[_0x1d7566];return _0x1c5946;};'use strict';var _=require(_0x9976('0x0'));var mysqldb=require(_0x9976('0x1'));var rpc=require(_0x9976('0x2'));var config=require(_0x9976('0x3'));var logger=require(_0x9976('0x4'))(_0x9976('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x9976('0x6'));var schedule=require('./config/schedule');var chat=require(_0x9976('0x7'));var whatsapp=require(_0x9976('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x9976('0x9')][_0x9976('0xa')]()[_0x9976('0xb')](function(){return rpc[_0x9976('0xc')]();})[_0x9976('0xb')](function(_0x443ea1){logger[_0x9976('0xd')](_0x443ea1);return chat[_0x9976('0xe')]();})['then'](function(){return whatsapp[_0x9976('0xe')]();})[_0x9976('0xb')](function(){return schedule[_0x9976('0xe')]();})['then'](function(){return transcribe['start']();})[_0x9976('0xb')](function(_0x25d740){logger['info'](_0x25d740);return pm2['start'](pm2Config);})[_0x9976('0xb')](function(_0x342239){logger[_0x9976('0xd')](_0x9976('0xf'),_['map'](_[_0x9976('0x10')](_0x342239,{'status':'online'}),'name')[_0x9976('0x11')]());logger[_0x9976('0xd')](_0x9976('0x12'),_[_0x9976('0x13')](_['filter'](_0x342239,function(_0x28dedc){return _0x28dedc[_0x9976('0x14')]!==_0x9976('0x15');}),_0x9976('0x16'))[_0x9976('0x11')]()||'None');config[_0x9976('0x17')]&&require(_0x9976('0x18'))[_0x9976('0x19')]();require(_0x9976('0x1a'))['default']();})[_0x9976('0x1b')](function(_0x2ea54e){logger[_0x9976('0x1c')](_0x9976('0x1d'),_0x2ea54e);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x211d=['./config/seedDB','./config/license','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','then','listen','start','info','Online\x20apps:','map','join','Offline\x20apps:','filter','status','online','name','None','seedDB'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x211d,0x1e1));var _0xd211=function(_0x187f89,_0x8547b5){_0x187f89=_0x187f89-0x0;var _0x3e6d4c=_0x211d[_0x187f89];return _0x3e6d4c;};'use strict';var _=require('lodash');var mysqldb=require(_0xd211('0x0'));var rpc=require(_0xd211('0x1'));var config=require(_0xd211('0x2'));var logger=require(_0xd211('0x3'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xd211('0x4'));var schedule=require(_0xd211('0x5'));var chat=require(_0xd211('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xd211('0x7'));function main(){return mysqldb['db']['sequelize'][_0xd211('0x8')]()[_0xd211('0x9')](function(){return rpc[_0xd211('0xa')]();})[_0xd211('0x9')](function(_0x5df16e){logger['info'](_0x5df16e);return chat[_0xd211('0xb')]();})[_0xd211('0x9')](function(){return whatsapp[_0xd211('0xb')]();})[_0xd211('0x9')](function(){return schedule[_0xd211('0xb')]();})['then'](function(){return transcribe['start']();})[_0xd211('0x9')](function(_0x143bac){logger['info'](_0x143bac);return pm2[_0xd211('0xb')](pm2Config);})[_0xd211('0x9')](function(_0xda6046){logger[_0xd211('0xc')](_0xd211('0xd'),_[_0xd211('0xe')](_['filter'](_0xda6046,{'status':'online'}),'name')[_0xd211('0xf')]());logger[_0xd211('0xc')](_0xd211('0x10'),_[_0xd211('0xe')](_[_0xd211('0x11')](_0xda6046,function(_0x142dce){return _0x142dce[_0xd211('0x12')]!==_0xd211('0x13');}),_0xd211('0x14'))[_0xd211('0xf')]()||_0xd211('0x15'));config[_0xd211('0x16')]&&require(_0xd211('0x17'))['default']();require(_0xd211('0x18'))[_0xd211('0x19')]();})[_0xd211('0x1a')](function(_0x22a53c){logger['error'](_0xd211('0x1b'),_0x22a53c);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 577bed7..ab17422 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 _0x2d57=['unshift','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','now','HS512','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','bluebird','util','moment','secrets','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','find','name','then','authenticate','pass','status','json','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','ValidationError','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x2d57,0x17a));var _0x72d5=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x2d57[_0x256b72];return _0x2183e3;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x72d5('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x72d5('0x1'));var encryptor=require(_0x72d5('0x2'));var _=require(_0x72d5('0x3'));var jwt=require(_0x72d5('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x72d5('0x5'));var basicAuth=require(_0x72d5('0x6'));var crypto=require('crypto');var BPromise=require(_0x72d5('0x7'));var util=require(_0x72d5('0x8'));var moment=require(_0x72d5('0x9'));var validateJwt=expressJwt({'secret':config[_0x72d5('0xa')]['session']});var userAttributes=['id',_0x72d5('0xb'),_0x72d5('0xc'),'name',_0x72d5('0xd'),_0x72d5('0xe'),_0x72d5('0xf'),_0x72d5('0x10'),_0x72d5('0x11'),_0x72d5('0x12'),'chatPause','mailPause',_0x72d5('0x13'),_0x72d5('0x14'),_0x72d5('0x15'),_0x72d5('0x16'),_0x72d5('0x17'),_0x72d5('0x18'),'lastPauseAt','crudPermissions',_0x72d5('0x19'),_0x72d5('0x1a'),'alias',_0x72d5('0x1b'),'phoneBarAutoAnswerDelay',_0x72d5('0x1c'),'phoneBarEnableRecording',_0x72d5('0x1d'),_0x72d5('0x1e'),_0x72d5('0x1f'),_0x72d5('0x20'),_0x72d5('0x21'),_0x72d5('0x22'),_0x72d5('0x23'),_0x72d5('0x24'),_0x72d5('0x25'),_0x72d5('0x26'),_0x72d5('0x27'),'wssPort',_0x72d5('0x28'),_0x72d5('0x29'),_0x72d5('0x2a'),_0x72d5('0x2b'),_0x72d5('0x2c')];exports[_0x72d5('0x2d')]=function(){return this[_0x72d5('0x2e')](!![])[_0x72d5('0x2f')](function(_0x472e5a,_0x5005f4,_0x461db3){if(_0x472e5a[_0x72d5('0x30')]){_0x461db3();}else{return db['ChatInteraction'][_0x72d5('0x31')]({'where':{'id':_0x472e5a[_0x72d5('0x32')]['id']},'attributes':['id',_0x72d5('0x33'),_0x72d5('0x34')],'raw':!![]})['then'](function(_0x31f418){if(_0x31f418&&_0x31f418[_0x72d5('0x33')]){return _0x5005f4['status'](_0x31f418[_0x72d5('0x34')]==='unmanaged'?0x195:0x193)['json']({'message':_0x31f418['disposition']===_0x72d5('0x35')?_0x72d5('0x36'):_0x72d5('0x37')});}else{_0x461db3();}})[_0x72d5('0x38')](function(_0x3808e6){_0x461db3(_0x3808e6);});}});};exports[_0x72d5('0x2e')]=function isAuthenticated(_0x3d9544){return compose()['use'](function(_0x4f7337,_0x380b6b,_0x8c55e3){var _0x1d083f;if(_0x4f7337[_0x72d5('0x39')][_0x72d5('0x3a')]){if(_['startsWith'](_0x4f7337[_0x72d5('0x39')][_0x72d5('0x3a')],'Basic')){var _0x55a93f=basicAuth(_0x4f7337);db['User'][_0x72d5('0x3b')]({'where':{'name':_0x55a93f[_0x72d5('0x3c')]}})[_0x72d5('0x3d')](function(_0x103502){if(!_0x103502||!_0x103502[_0x72d5('0x3e')](_0x55a93f[_0x72d5('0x3f')])){return _0x380b6b[_0x72d5('0x40')](0x191)[_0x72d5('0x41')]({'message':_0x72d5('0x42')});}_0x4f7337[_0x72d5('0x30')]={'id':_0x103502['id']};_0x8c55e3();})[_0x72d5('0x38')](function(_0x2d2684){_0x8c55e3(_0x2d2684);});}else if(_[_0x72d5('0x43')](_0x4f7337[_0x72d5('0x39')][_0x72d5('0x3a')],_0x72d5('0x44'))){validateJwt(_0x4f7337,_0x380b6b,_0x8c55e3);}else{if(_0x3d9544){_0x8c55e3();}else{return _0x380b6b[_0x72d5('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4f7337[_0x72d5('0x45')][_0x72d5('0x46')]){try{var _0x31494d={'audience':hardwareConf[_0x72d5('0x47')](),'issuer':hardwareConf[_0x72d5('0x47')]()};verifyJwt(_0x4f7337[_0x72d5('0x45')][_0x72d5('0x46')],_0x31494d)['then'](function(_0x23d15e){return db[_0x72d5('0x48')][_0x72d5('0x3b')]({'where':{'id':_0x23d15e[_0x72d5('0x49')]}})[_0x72d5('0x3d')](function(_0x543d08){_0x1d083f=_0x543d08;return db[_0x72d5('0x4a')][_0x72d5('0x31')]({'where':{'id':0x1},'attributes':[_0x72d5('0x4b'),_0x72d5('0x4c')],'raw':!![]});})['then'](function(_0x21ee1b){if(!_0x1d083f||!_['isEqual'](_0x1d083f['apiKeyNonce'],_0x23d15e[_0x72d5('0x4d')])){return _0x380b6b[_0x72d5('0x40')](0x191)[_0x72d5('0x41')]({'message':_0x72d5('0x4e')});}if(_0x1d083f['disabled']){return _0x380b6b[_0x72d5('0x40')](0x191)['json']({'message':_0x72d5('0x4f')});}if(_0x1d083f['blocked']){if(_0x21ee1b[_0x72d5('0x4c')]>0x0){if(moment(_0x1d083f[_0x72d5('0x50')])[_0x72d5('0x51')](_0x21ee1b[_0x72d5('0x4c')],_0x72d5('0x52'))>moment()){return _0x380b6b[_0x72d5('0x40')](0x191)[_0x72d5('0x41')]({'message':_0x72d5('0x4f')});}}else{return _0x380b6b[_0x72d5('0x40')](0x191)['json']({'message':_0x72d5('0x4f')});}}_0x4f7337[_0x72d5('0x30')]={'id':_0x1d083f['id']};_0x8c55e3();});})[_0x72d5('0x38')](function(){return _0x380b6b['status'](0x191)[_0x72d5('0x41')]({'message':_0x72d5('0x4f')});});}catch(_0x209a16){_0x8c55e3(_0x209a16);}}else if(_0x3d9544){_0x8c55e3();}else{return _0x380b6b[_0x72d5('0x40')](0x193)['json']({'message':_0x72d5('0x53')});}})[_0x72d5('0x2f')](function(_0x426eae,_0x1e57ad,_0xd2a8c3){if(_0x426eae[_0x72d5('0x30')]){db[_0x72d5('0x48')][_0x72d5('0x3b')]({'where':{'id':_0x426eae[_0x72d5('0x30')]['id']},'attributes':userAttributes})['then'](function(_0x662765){if(!_0x662765){return _0x1e57ad['status'](0x194)[_0x72d5('0x41')]({'message':_0x72d5('0x54')});}_0x426eae[_0x72d5('0x30')]=_0x662765;_0xd2a8c3();})[_0x72d5('0x38')](function(_0x365903){_0xd2a8c3(_0x365903);});}else if(_0x3d9544){_0xd2a8c3();}else{return _0x1e57ad[_0x72d5('0x40')](0x194)[_0x72d5('0x41')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x72d5('0x55')]=function canUpdate(){return compose()[_0x72d5('0x2f')](function(_0x1fe88c,_0x2944e6,_0x591a0e){return licenseUtil[_0x72d5('0x56')]()[_0x72d5('0x3d')](function(_0x4bab51){if(_0x4bab51['update']){_0x591a0e();}else{return _0x2944e6[_0x72d5('0x40')](0x193)['json']({'message':_0x72d5('0x57')});}})[_0x72d5('0x38')](function(_0x134090){_0x591a0e(_0x134090);});});};exports[_0x72d5('0x58')]=function isWebrtcLicence(){return compose()[_0x72d5('0x2f')](function(_0x2706f5,_0x582a86,_0x4ac459){return licenseUtil['getLicense']()[_0x72d5('0x3d')](function(_0x514476){if(_0x514476[_0x72d5('0x59')]){_0x4ac459();}else{return _0x582a86[_0x72d5('0x40')](0x193)[_0x72d5('0x41')]({'message':_0x72d5('0x57')});}})[_0x72d5('0x38')](function(_0xe79804){_0x4ac459(_0xe79804);});});};exports[_0x72d5('0x5a')]=function(_0x42d536,_0x996a45,_0x2d02dd){_0x42d536[_0x72d5('0x5a')]=!![];return _0x2d02dd();};exports[_0x72d5('0x5b')]=function signToken(_0x2ead56){return signJwt(_0x2ead56);};exports[_0x72d5('0x5c')]=function(_0x62de0d,_0x134556){if(!_0x62de0d[_0x72d5('0x30')]){return _0x134556[_0x72d5('0x40')](0x194)['json']({'message':_0x72d5('0x5d')});}var _0x521bb1={'payload':{'id':_0x62de0d[_0x72d5('0x30')]['id'],'role':_0x62de0d[_0x72d5('0x30')][_0x72d5('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x521bb1)[_0x72d5('0x3d')](function(_0x2a5838){_0x134556['cookie'](_0x72d5('0x5e'),_0x2a5838);_0x134556[_0x72d5('0x5f')]('/dashboards/general');})[_0x72d5('0x38')](function(_0x3d08ea){return _0x134556['status'](0x1f4)['send'](_0x3d08ea);});};exports['retrieveApiKey']=function(_0x3df383){if(_[_0x72d5('0x60')](_0x3df383[_0x72d5('0x61')])||_[_0x72d5('0x60')](_0x3df383[_0x72d5('0x62')])){return null;}else{return createJwt(_0x3df383);}};exports[_0x72d5('0x63')]=function(_0x5a0e41){_0x5a0e41[_0x72d5('0x61')]=generateNonce();_0x5a0e41[_0x72d5('0x62')]=generateIssuedAt();return createJwt(_0x5a0e41);};exports[_0x72d5('0x64')]=function(_0x4e82c4,_0x16c16a){var _0x3a4a1b=_0x4e82c4[_0x72d5('0x45')]['apikey'];if(_0x3a4a1b){var _0x9f3aa={'nonce':_0x16c16a[_0x72d5('0x61')],'iat':_0x16c16a[_0x72d5('0x62')],'audience':hardwareConf[_0x72d5('0x47')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x3a4a1b,_0x9f3aa)[_0x72d5('0x3d')](function(){return generateApiKey(_0x16c16a);});}else{throw{'message':_0x72d5('0x65')};}};exports['validatePasswordPattern']=function(_0x21dbfa){var _0x25e5e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x25e5e1['test'](_0x21dbfa))throw new db[(_0x72d5('0x66'))][(_0x72d5('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x4fbce7,_0x4a3aee,_0x1820b7){var _0x398555=encryptor[_0x72d5('0x68')](_0x4a3aee)[_0x72d5('0x69')](',');for(var _0x37bd0a=0x0;_0x37bd0a<_0x1820b7;_0x37bd0a++){if(!_0x398555[_0x37bd0a])break;if(_0x4fbce7[_0x72d5('0x6a')]()===_0x398555[_0x37bd0a][_0x72d5('0x6a')]()){var _0x335bee=util[_0x72d5('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1820b7);if(_0x1820b7===0x1){_0x335bee=_0x72d5('0x6c');}throw new db[(_0x72d5('0x66'))][(_0x72d5('0x67'))](_0x335bee);}}return;};exports['updatePasswordsHistory']=function(_0xe9bfc4,_0x5d2cab){var _0x1b660d=_0x5d2cab?encryptor[_0x72d5('0x68')](_0x5d2cab)[_0x72d5('0x69')](','):[];if(_0x1b660d[_0x72d5('0x6d')]===0x5){_0x1b660d['splice'](-0x1,0x1);}_0x1b660d[_0x72d5('0x6e')](_0xe9bfc4);return encryptor['encryptString'](_0x1b660d['join'](','));};function signJwt(_0x4562e1){var _0x17b9c4=BPromise[_0x72d5('0x6f')](jwt[_0x72d5('0x70')],{'context':jwt});var _0x3e9e34=_0x4562e1[_0x72d5('0x71')]||config['secrets']['session'];return new BPromise(function(_0x43a05c,_0x4627d6){_0x17b9c4(_0x4562e1[_0x72d5('0x72')],_0x3e9e34,_0x4562e1[_0x72d5('0x73')])['then'](function(_0x25962e){_0x43a05c(_0x25962e);})[_0x72d5('0x38')](function(_0x47c738){_0x4627d6(_0x47c738);});});}function verifyJwt(_0x3a2e61,_0x2e9573,_0x34c20d){var _0x5b59b8=BPromise[_0x72d5('0x6f')](jwt[_0x72d5('0x74')],{'context':jwt});var _0x2b20b4=_0x34c20d||config[_0x72d5('0xa')]['session'];return new BPromise(function(_0x5034e7,_0x284964){_0x5b59b8(_0x3a2e61,_0x2b20b4,_0x2e9573)[_0x72d5('0x3d')](function(_0x3de33f){_0x5034e7(_0x3de33f);})[_0x72d5('0x38')](function(_0x22e89e){_0x284964(_0x22e89e);});});}function generateNonce(){return crypto[_0x72d5('0x75')](0x10)[_0x72d5('0x76')](_0x72d5('0x77'));}function generateIssuedAt(){return Math['floor'](Date[_0x72d5('0x78')]()/0x3e8)[_0x72d5('0x76')]();}function createJwt(_0x3aca5e){var _0x240a17={'payload':{'iat':_0x3aca5e[_0x72d5('0x62')],'nonce':_0x3aca5e[_0x72d5('0x61')]},'options':{'algorithm':_0x72d5('0x79'),'subject':_0x3aca5e['id']['toString'](),'issuer':hardwareConf[_0x72d5('0x47')](),'audience':hardwareConf[_0x72d5('0x47')]()}};return signJwt(_0x240a17)[_0x72d5('0x3d')](function(_0x450120){return{'iat':_0x3aca5e[_0x72d5('0x62')],'nonce':_0x3aca5e[_0x72d5('0x61')],'token':_0x450120};});} \ No newline at end of file +var _0xd931=['basic-auth','bluebird','session','role','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','Bearer','query','getUuid','apikey','User','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','secrets','randomBytes','toString','floor','now','../../mysqldb','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware'];(function(_0xddfe05,_0x57b987){var _0x42b95e=function(_0x30699b){while(--_0x30699b){_0xddfe05['push'](_0xddfe05['shift']());}};_0x42b95e(++_0x57b987);}(_0xd931,0x7c));var _0x1d93=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0xd931[_0x36b037];return _0x409194;};'use strict';var db=require(_0x1d93('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x1d93('0x1'));var encryptor=require(_0x1d93('0x2'));var _=require(_0x1d93('0x3'));var jwt=require(_0x1d93('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x1d93('0x5'));var basicAuth=require(_0x1d93('0x6'));var crypto=require('crypto');var BPromise=require(_0x1d93('0x7'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0x1d93('0x8')]});var userAttributes=['id',_0x1d93('0x9'),'fullname',_0x1d93('0xa'),_0x1d93('0xb'),_0x1d93('0xc'),_0x1d93('0xd'),_0x1d93('0xe'),_0x1d93('0xf'),_0x1d93('0x10'),_0x1d93('0x11'),_0x1d93('0x12'),'faxPause',_0x1d93('0x13'),_0x1d93('0x14'),_0x1d93('0x15'),_0x1d93('0x16'),_0x1d93('0x17'),_0x1d93('0x18'),_0x1d93('0x19'),_0x1d93('0x1a'),_0x1d93('0x1b'),_0x1d93('0x1c'),_0x1d93('0x1d'),_0x1d93('0x1e'),_0x1d93('0x1f'),_0x1d93('0x20'),_0x1d93('0x21'),_0x1d93('0x22'),_0x1d93('0x23'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x1d93('0x24'),_0x1d93('0x25'),'userProfileId',_0x1d93('0x26'),_0x1d93('0x27'),_0x1d93('0x28'),_0x1d93('0x29'),'downloadOmnichannelInteractions',_0x1d93('0x2a'),'ignorePauseForPreviewCalls','selectRecallMeCampaign'];exports[_0x1d93('0x2b')]=function(){return this[_0x1d93('0x2c')](!![])['use'](function(_0x131137,_0x57141a,_0xa4a892){if(_0x131137[_0x1d93('0x2d')]){_0xa4a892();}else{return db['ChatInteraction'][_0x1d93('0x2e')]({'where':{'id':_0x131137[_0x1d93('0x2f')]['id']},'attributes':['id',_0x1d93('0x30'),_0x1d93('0x31')],'raw':!![]})[_0x1d93('0x32')](function(_0x48d4db){if(_0x48d4db&&_0x48d4db['closed']){return _0x57141a[_0x1d93('0x33')](_0x48d4db[_0x1d93('0x31')]===_0x1d93('0x34')?0x195:0x193)[_0x1d93('0x35')]({'message':_0x48d4db['disposition']===_0x1d93('0x34')?_0x1d93('0x36'):_0x1d93('0x37')});}else{_0xa4a892();}})[_0x1d93('0x38')](function(_0x1ef5b9){_0xa4a892(_0x1ef5b9);});}});};exports[_0x1d93('0x2c')]=function isAuthenticated(_0x4b6d9b){return compose()[_0x1d93('0x39')](function(_0x2d3ab2,_0x12ff2c,_0x348509){var _0x2b9a3c;if(_0x2d3ab2[_0x1d93('0x3a')][_0x1d93('0x3b')]){if(_[_0x1d93('0x3c')](_0x2d3ab2[_0x1d93('0x3a')][_0x1d93('0x3b')],_0x1d93('0x3d'))){var _0x14f344=basicAuth(_0x2d3ab2);db['User'][_0x1d93('0x3e')]({'where':{'name':_0x14f344[_0x1d93('0xa')]}})['then'](function(_0x415194){if(!_0x415194||!_0x415194[_0x1d93('0x3f')](_0x14f344[_0x1d93('0x40')])){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x41')});}_0x2d3ab2['user']={'id':_0x415194['id']};_0x348509();})[_0x1d93('0x38')](function(_0x54611d){_0x348509(_0x54611d);});}else if(_[_0x1d93('0x3c')](_0x2d3ab2[_0x1d93('0x3a')][_0x1d93('0x3b')],_0x1d93('0x42'))){validateJwt(_0x2d3ab2,_0x12ff2c,_0x348509);}else{if(_0x4b6d9b){_0x348509();}else{return _0x12ff2c['status'](0x193)[_0x1d93('0x35')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2d3ab2[_0x1d93('0x43')]['apikey']){try{var _0x2940b7={'audience':hardwareConf[_0x1d93('0x44')](),'issuer':hardwareConf[_0x1d93('0x44')]()};verifyJwt(_0x2d3ab2['query'][_0x1d93('0x45')],_0x2940b7)['then'](function(_0x3f7843){return db[_0x1d93('0x46')]['find']({'where':{'id':_0x3f7843[_0x1d93('0x47')]}})[_0x1d93('0x32')](function(_0x208c79){_0x2b9a3c=_0x208c79;return db['Setting'][_0x1d93('0x2e')]({'where':{'id':0x1},'attributes':[_0x1d93('0x48'),_0x1d93('0x49')],'raw':!![]});})['then'](function(_0x168bbf){if(!_0x2b9a3c||!_['isEqual'](_0x2b9a3c[_0x1d93('0x4a')],_0x3f7843[_0x1d93('0x4b')])){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x4c')});}if(_0x2b9a3c[_0x1d93('0x4d')]){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x4e')});}if(_0x2b9a3c[_0x1d93('0x4f')]){if(_0x168bbf[_0x1d93('0x49')]>0x0){if(moment(_0x2b9a3c[_0x1d93('0x50')])[_0x1d93('0x51')](_0x168bbf[_0x1d93('0x49')],_0x1d93('0x52'))>moment()){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x4e')});}}_0x2d3ab2[_0x1d93('0x2d')]={'id':_0x2b9a3c['id']};_0x348509();});})[_0x1d93('0x38')](function(){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x4e')});});}catch(_0x4d905a){_0x348509(_0x4d905a);}}else if(_0x4b6d9b){_0x348509();}else{return _0x12ff2c[_0x1d93('0x33')](0x193)[_0x1d93('0x35')]({'message':_0x1d93('0x53')});}})[_0x1d93('0x39')](function(_0x2f0b3d,_0xf7f1bb,_0x3aa55d){if(_0x2f0b3d[_0x1d93('0x2d')]){db['User'][_0x1d93('0x3e')]({'where':{'id':_0x2f0b3d[_0x1d93('0x2d')]['id']},'attributes':userAttributes})[_0x1d93('0x32')](function(_0x1c065d){if(!_0x1c065d){return _0xf7f1bb['status'](0x194)['json']({'message':_0x1d93('0x54')});}_0x2f0b3d['user']=_0x1c065d;_0x3aa55d();})['catch'](function(_0x19a278){_0x3aa55d(_0x19a278);});}else if(_0x4b6d9b){_0x3aa55d();}else{return _0xf7f1bb[_0x1d93('0x33')](0x194)['json']({'message':_0x1d93('0x55')});}});};exports[_0x1d93('0x56')]=function canUpdate(){return compose()[_0x1d93('0x39')](function(_0x11f6da,_0x5d9edb,_0x3c356c){return licenseUtil['getLicense']()[_0x1d93('0x32')](function(_0x3bdd3c){if(_0x3bdd3c[_0x1d93('0x57')]){_0x3c356c();}else{return _0x5d9edb['status'](0x193)[_0x1d93('0x35')]({'message':'Forbidden'});}})[_0x1d93('0x38')](function(_0x3887a9){_0x3c356c(_0x3887a9);});});};exports[_0x1d93('0x58')]=function isWebrtcLicence(){return compose()[_0x1d93('0x39')](function(_0xe11d8a,_0x390aac,_0x257816){return licenseUtil['getLicense']()[_0x1d93('0x32')](function(_0x5244c0){if(_0x5244c0['webrtc']){_0x257816();}else{return _0x390aac[_0x1d93('0x33')](0x193)['json']({'message':_0x1d93('0x59')});}})['catch'](function(_0x38a75e){_0x257816(_0x38a75e);});});};exports['isMiddleware']=function(_0x399a2f,_0x187d90,_0x599150){_0x399a2f[_0x1d93('0x5a')]=!![];return _0x599150();};exports[_0x1d93('0x5b')]=function signToken(_0x569ebe){return signJwt(_0x569ebe);};exports[_0x1d93('0x5c')]=function(_0x43442e,_0x4944e8){if(!_0x43442e['user']){return _0x4944e8[_0x1d93('0x33')](0x194)[_0x1d93('0x35')]({'message':_0x1d93('0x5d')});}var _0x36ce55={'payload':{'id':_0x43442e[_0x1d93('0x2d')]['id'],'role':_0x43442e[_0x1d93('0x2d')][_0x1d93('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x36ce55)[_0x1d93('0x32')](function(_0x2b75df){_0x4944e8[_0x1d93('0x5e')](_0x1d93('0x5f'),_0x2b75df);_0x4944e8[_0x1d93('0x60')](_0x1d93('0x61'));})[_0x1d93('0x38')](function(_0x1d8ec5){return _0x4944e8['status'](0x1f4)[_0x1d93('0x62')](_0x1d8ec5);});};exports[_0x1d93('0x63')]=function(_0x1c50af){if(_['isNil'](_0x1c50af['apiKeyNonce'])||_[_0x1d93('0x64')](_0x1c50af[_0x1d93('0x65')])){return null;}else{return createJwt(_0x1c50af);}};exports['generateApiKey']=function(_0x246398){_0x246398[_0x1d93('0x4a')]=generateNonce();_0x246398[_0x1d93('0x65')]=generateIssuedAt();return createJwt(_0x246398);};exports['regenerateApiKey']=function(_0x16d17c,_0x23c85c){var _0x16edde=_0x16d17c[_0x1d93('0x43')]['apikey'];if(_0x16edde){var _0x1ed53a={'nonce':_0x23c85c[_0x1d93('0x4a')],'iat':_0x23c85c[_0x1d93('0x65')],'audience':hardwareConf[_0x1d93('0x44')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x16edde,_0x1ed53a)[_0x1d93('0x32')](function(){return generateApiKey(_0x23c85c);});}else{throw{'message':_0x1d93('0x66')};}};exports[_0x1d93('0x67')]=function(_0x4f1fe9){var _0x1d3ef9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1d3ef9[_0x1d93('0x68')](_0x4f1fe9))throw new db[(_0x1d93('0x69'))][(_0x1d93('0x6a'))](_0x1d93('0x6b'));return;};exports['validatePasswordHistory']=function(_0x5acec0,_0x461b77,_0x1da6c6){var _0x511dfb=encryptor[_0x1d93('0x6c')](_0x461b77)['split'](',');for(var _0x11e2e4=0x0;_0x11e2e4<_0x1da6c6;_0x11e2e4++){if(!_0x511dfb[_0x11e2e4])break;if(_0x5acec0[_0x1d93('0x6d')]()===_0x511dfb[_0x11e2e4][_0x1d93('0x6d')]()){var _0x1f2362=util[_0x1d93('0x6e')](_0x1d93('0x6f'),_0x1da6c6);if(_0x1da6c6===0x1){_0x1f2362=_0x1d93('0x70');}throw new db['Sequelize']['ValidationError'](_0x1f2362);}}return;};exports[_0x1d93('0x71')]=function(_0xb13932,_0x40afc7){var _0x3233e1=_0x40afc7?encryptor[_0x1d93('0x6c')](_0x40afc7)[_0x1d93('0x72')](','):[];if(_0x3233e1['length']===0x5){_0x3233e1[_0x1d93('0x73')](-0x1,0x1);}_0x3233e1[_0x1d93('0x74')](_0xb13932);return encryptor[_0x1d93('0x75')](_0x3233e1[_0x1d93('0x76')](','));};function signJwt(_0x269bab){var _0x1fba08=BPromise[_0x1d93('0x77')](jwt[_0x1d93('0x78')],{'context':jwt});var _0x4d7b0d=_0x269bab[_0x1d93('0x79')]||config['secrets'][_0x1d93('0x8')];return new BPromise(function(_0x2b1ee2,_0x30065f){_0x1fba08(_0x269bab[_0x1d93('0x7a')],_0x4d7b0d,_0x269bab[_0x1d93('0x7b')])[_0x1d93('0x32')](function(_0x312cdd){_0x2b1ee2(_0x312cdd);})[_0x1d93('0x38')](function(_0x7d3713){_0x30065f(_0x7d3713);});});}function verifyJwt(_0x555c5c,_0x480f62,_0x4fcc9e){var _0x1a43e4=BPromise[_0x1d93('0x77')](jwt[_0x1d93('0x7c')],{'context':jwt});var _0x52e0eb=_0x4fcc9e||config[_0x1d93('0x7d')][_0x1d93('0x8')];return new BPromise(function(_0x3541b3,_0x33a3da){_0x1a43e4(_0x555c5c,_0x52e0eb,_0x480f62)[_0x1d93('0x32')](function(_0x351d09){_0x3541b3(_0x351d09);})['catch'](function(_0x458f9d){_0x33a3da(_0x458f9d);});});}function generateNonce(){return crypto[_0x1d93('0x7e')](0x10)[_0x1d93('0x7f')]('hex');}function generateIssuedAt(){return Math[_0x1d93('0x80')](Date[_0x1d93('0x81')]()/0x3e8)['toString']();}function createJwt(_0x31786d){var _0x18a3bb={'payload':{'iat':_0x31786d[_0x1d93('0x65')],'nonce':_0x31786d[_0x1d93('0x4a')]},'options':{'algorithm':'HS512','subject':_0x31786d['id'][_0x1d93('0x7f')](),'issuer':hardwareConf[_0x1d93('0x44')](),'audience':hardwareConf[_0x1d93('0x44')]()}};return signJwt(_0x18a3bb)[_0x1d93('0x32')](function(_0x5cd477){return{'iat':_0x31786d[_0x1d93('0x65')],'nonce':_0x31786d['apiKeyNonce'],'token':_0x5cd477};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e7e6360..3fbee06 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 _0xdb68=['decryptFile','createDecipher','encryptString','base64','decryptString','secret','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','write','end','final','binary','close','unlink'];(function(_0xd99de2,_0x38b972){var _0x11a4e7=function(_0x15301a){while(--_0x15301a){_0xd99de2['push'](_0xd99de2['shift']());}};_0x11a4e7(++_0x38b972);}(_0xdb68,0x6d));var _0x8db6=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0xdb68[_0x1034ca];return _0x1a023a;};'use strict';var crypto=require(_0x8db6('0x0'));var fs=require('fs');var BPromise=require(_0x8db6('0x1'));var _=require(_0x8db6('0x2'));var config=require(_0x8db6('0x3'));var logger=require(_0x8db6('0x4'))(_0x8db6('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x8db6('0x6')};const fileOptions={'algorithm':_0x8db6('0x7')};if(config[_0x8db6('0x8')]&&config[_0x8db6('0x8')][_0x8db6('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x8db6('0x9')]);if(isSupported){fileOptions[_0x8db6('0x9')]=config[_0x8db6('0x8')][_0x8db6('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8db6('0xa')](',\x20');logger[_0x8db6('0xb')](config[_0x8db6('0x8')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x739201){return AES_SUPPORTED_RX[_0x8db6('0xc')](_0x739201);}function getSupportedCiphers(){return crypto[_0x8db6('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x32b872){return getSupportedCiphers()[_0x8db6('0xe')](_0x32b872)>-0x1;}function combineOptions(_0x49f2ba){var _0x5d4d2a={};for(var _0x290471 in fileOptions){if(fileOptions['hasOwnProperty'](_0x290471)){_0x5d4d2a[_0x290471]=fileOptions[_0x290471];}}if(_0x49f2ba){for(var _0x320f63 in _0x49f2ba){if(_0x49f2ba[_0x8db6('0xf')](_0x320f63)){_0x5d4d2a[_0x320f63]=_0x49f2ba[_0x320f63];}}}return _0x5d4d2a;}exports[_0x8db6('0x10')]=function(_0x5441e8,_0x15d4e2,_0xf7ab60,_0x1acf7c){return new BPromise(function(_0xc95b1d,_0x41bfd5){_0x1acf7c=combineOptions(_0x1acf7c);var _0x4f780e=new Buffer(_0xf7ab60);var _0x4bb44d=fs[_0x8db6('0x11')](_0x5441e8);var _0x2dd999=fs['createWriteStream'](_0x15d4e2);var _0x554cf0=crypto[_0x8db6('0x12')](_0x1acf7c[_0x8db6('0x9')],_0x4f780e);_0x4bb44d['on'](_0x8db6('0x13'),function(_0x193fd0){var _0x35bcef=new Buffer(_0x554cf0[_0x8db6('0x14')](_0x193fd0),'binary');_0x2dd999[_0x8db6('0x15')](_0x35bcef);});_0x4bb44d['on'](_0x8db6('0x16'),function(){try{var _0x5f68ee=new Buffer(_0x554cf0[_0x8db6('0x17')]('binary'),_0x8db6('0x18'));_0x2dd999['write'](_0x5f68ee);_0x2dd999['end']();_0x2dd999['on'](_0x8db6('0x19'),function(){return _0xc95b1d(_0x15d4e2);});}catch(_0x5aee09){fs[_0x8db6('0x1a')](_0x15d4e2);return _0x41bfd5(_0x5aee09);}});});};exports[_0x8db6('0x1b')]=function(_0x13fb08,_0x113247,_0x36d0c1,_0x5405dd){return new BPromise(function(_0x498371,_0x559fc4){_0x5405dd=combineOptions(_0x5405dd);var _0x44ea0a=new Buffer(_0x36d0c1);var _0x2b104d=fs[_0x8db6('0x11')](_0x13fb08);var _0x498ec0=fs['createWriteStream'](_0x113247);var _0x58ea81=crypto[_0x8db6('0x1c')](_0x5405dd['algorithm'],_0x44ea0a);_0x2b104d['on']('data',function(_0x2b9315){var _0x4fd3e3=new Buffer(_0x58ea81['update'](_0x2b9315),_0x8db6('0x18'));_0x498ec0[_0x8db6('0x15')](_0x4fd3e3);});_0x2b104d['on'](_0x8db6('0x16'),function(){try{var _0x1d2fcf=new Buffer(_0x58ea81[_0x8db6('0x17')](_0x8db6('0x18')),_0x8db6('0x18'));_0x498ec0[_0x8db6('0x15')](_0x1d2fcf);_0x498ec0[_0x8db6('0x16')]();_0x498ec0['on'](_0x8db6('0x19'),function(){return _0x498371(_0x113247);});}catch(_0x26322a){fs[_0x8db6('0x1a')](_0x113247);return _0x559fc4(_0x26322a);}});});};exports[_0x8db6('0x1d')]=function(_0x3b13ed,_0x3fdec0,_0x1f8252){var _0x26b9bc=_0x1f8252||stringOptions['algorithm'];var _0x552be1=_0x3fdec0||stringOptions['secret'];var _0x13fe7c=crypto[_0x8db6('0x12')](_0x26b9bc,_0x552be1);var _0x3ede15=_0x13fe7c['update'](_0x3b13ed,'utf8',_0x8db6('0x1e'));_0x3ede15+=_0x13fe7c[_0x8db6('0x17')](_0x8db6('0x1e'));return _0x3ede15;};exports[_0x8db6('0x1f')]=function(_0x596cdd,_0x5d20d1,_0x1f8f94){var _0xcacd4e=_0x1f8f94||stringOptions[_0x8db6('0x9')];var _0x3037bf=_0x5d20d1||stringOptions[_0x8db6('0x20')];var _0x2f6def=crypto['createDecipher'](_0xcacd4e,_0x3037bf);var _0x2c6851=_0x2f6def[_0x8db6('0x14')](_0x596cdd,_0x8db6('0x1e'),_0x8db6('0x21'));_0x2c6851+=_0x2f6def[_0x8db6('0x17')](_0x8db6('0x21'));return _0x2c6851;}; \ No newline at end of file +var _0xe8df=['write','end','final','binary','close','unlink','decryptFile','data','update','encryptString','secret','utf8','base64','decryptString','createDecipher','bluebird','lodash','../../config/environment','../../config/logger','session','aes-256-ctr','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0xe8df,0x141));var _0xfe8d=function(_0x1036bb,_0x3df1ce){_0x1036bb=_0x1036bb-0x0;var _0x5267e1=_0xe8df[_0x1036bb];return _0x5267e1;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xfe8d('0x0'));var _=require(_0xfe8d('0x1'));var config=require(_0xfe8d('0x2'));var logger=require(_0xfe8d('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xfe8d('0x4')],'algorithm':_0xfe8d('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0xfe8d('0x6')]&&config[_0xfe8d('0x6')][_0xfe8d('0x7')]){var isSupported=isAlgorithmSupported(config[_0xfe8d('0x6')][_0xfe8d('0x7')]);if(isSupported){fileOptions[_0xfe8d('0x7')]=config[_0xfe8d('0x6')][_0xfe8d('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xfe8d('0x8')](',\x20');logger['error'](config[_0xfe8d('0x6')][_0xfe8d('0x7')],_0xfe8d('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x104819){return AES_SUPPORTED_RX[_0xfe8d('0xa')](_0x104819);}function getSupportedCiphers(){return crypto[_0xfe8d('0xb')]()[_0xfe8d('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x9f4996){return getSupportedCiphers()[_0xfe8d('0xd')](_0x9f4996)>-0x1;}function combineOptions(_0x467a98){var _0x44c4e4={};for(var _0x31fa89 in fileOptions){if(fileOptions[_0xfe8d('0xe')](_0x31fa89)){_0x44c4e4[_0x31fa89]=fileOptions[_0x31fa89];}}if(_0x467a98){for(var _0x1aed31 in _0x467a98){if(_0x467a98[_0xfe8d('0xe')](_0x1aed31)){_0x44c4e4[_0x1aed31]=_0x467a98[_0x1aed31];}}}return _0x44c4e4;}exports[_0xfe8d('0xf')]=function(_0x45a43f,_0x1dd774,_0x17e497,_0xf1ea5c){return new BPromise(function(_0x5b9e79,_0x240c60){_0xf1ea5c=combineOptions(_0xf1ea5c);var _0x2ea6fd=new Buffer(_0x17e497);var _0xbedf5d=fs[_0xfe8d('0x10')](_0x45a43f);var _0x442af9=fs[_0xfe8d('0x11')](_0x1dd774);var _0x334e20=crypto[_0xfe8d('0x12')](_0xf1ea5c[_0xfe8d('0x7')],_0x2ea6fd);_0xbedf5d['on']('data',function(_0x377b42){var _0x4c356d=new Buffer(_0x334e20['update'](_0x377b42),'binary');_0x442af9[_0xfe8d('0x13')](_0x4c356d);});_0xbedf5d['on'](_0xfe8d('0x14'),function(){try{var _0x16bbcf=new Buffer(_0x334e20[_0xfe8d('0x15')]('binary'),_0xfe8d('0x16'));_0x442af9[_0xfe8d('0x13')](_0x16bbcf);_0x442af9[_0xfe8d('0x14')]();_0x442af9['on'](_0xfe8d('0x17'),function(){return _0x5b9e79(_0x1dd774);});}catch(_0x252663){fs[_0xfe8d('0x18')](_0x1dd774);return _0x240c60(_0x252663);}});});};exports[_0xfe8d('0x19')]=function(_0x14ecfc,_0x565e46,_0x24d52f,_0x304b02){return new BPromise(function(_0x3d95c1,_0x5c70e5){_0x304b02=combineOptions(_0x304b02);var _0x3e7ca2=new Buffer(_0x24d52f);var _0x11e473=fs['createReadStream'](_0x14ecfc);var _0x490429=fs['createWriteStream'](_0x565e46);var _0x132465=crypto['createDecipher'](_0x304b02[_0xfe8d('0x7')],_0x3e7ca2);_0x11e473['on'](_0xfe8d('0x1a'),function(_0x5c8398){var _0x1f204f=new Buffer(_0x132465[_0xfe8d('0x1b')](_0x5c8398),_0xfe8d('0x16'));_0x490429['write'](_0x1f204f);});_0x11e473['on']('end',function(){try{var _0x57b306=new Buffer(_0x132465[_0xfe8d('0x15')]('binary'),'binary');_0x490429[_0xfe8d('0x13')](_0x57b306);_0x490429[_0xfe8d('0x14')]();_0x490429['on']('close',function(){return _0x3d95c1(_0x565e46);});}catch(_0x37ee1a){fs[_0xfe8d('0x18')](_0x565e46);return _0x5c70e5(_0x37ee1a);}});});};exports[_0xfe8d('0x1c')]=function(_0x5ebe58,_0x2c7081,_0x5c5239){var _0x35bb0d=_0x5c5239||stringOptions[_0xfe8d('0x7')];var _0x23952d=_0x2c7081||stringOptions[_0xfe8d('0x1d')];var _0x25cc53=crypto[_0xfe8d('0x12')](_0x35bb0d,_0x23952d);var _0x4faefd=_0x25cc53[_0xfe8d('0x1b')](_0x5ebe58,_0xfe8d('0x1e'),'base64');_0x4faefd+=_0x25cc53[_0xfe8d('0x15')](_0xfe8d('0x1f'));return _0x4faefd;};exports[_0xfe8d('0x20')]=function(_0x552585,_0x44d8ae,_0x1dc001){var _0x24d1cb=_0x1dc001||stringOptions[_0xfe8d('0x7')];var _0x4683fd=_0x44d8ae||stringOptions[_0xfe8d('0x1d')];var _0xd34c17=crypto[_0xfe8d('0x21')](_0x24d1cb,_0x4683fd);var _0x3535ca=_0xd34c17[_0xfe8d('0x1b')](_0x552585,_0xfe8d('0x1f'),_0xfe8d('0x1e'));_0x3535ca+=_0xd34c17[_0xfe8d('0x15')](_0xfe8d('0x1e'));return _0x3535ca;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f1bf747..8578019 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 _0xcf90=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize'];(function(_0x28278a,_0x145796){var _0x38c6f7=function(_0x4e19e3){while(--_0x4e19e3){_0x28278a['push'](_0x28278a['shift']());}};_0x38c6f7(++_0x145796);}(_0xcf90,0x1ac));var _0x0cf9=function(_0x5b42b7,_0x293eb0){_0x5b42b7=_0x5b42b7-0x0;var _0x279239=_0xcf90[_0x5b42b7];return _0x279239;};'use strict';var util=require(_0x0cf9('0x0'));var path=require(_0x0cf9('0x1'));var _=require(_0x0cf9('0x2'));var csv=require(_0x0cf9('0x3'));var fs=require('fs');var BPromise=require(_0x0cf9('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x0cf9('0x5'))['db'];var dbH=require('../../mysqldb')[_0x0cf9('0x6')];var logger=require(_0x0cf9('0x7'))(_0x0cf9('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0cf9('0x9')][0x2]);var QUERY=process[_0x0cf9('0x9')][0x3];var PATH=process[_0x0cf9('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2966dd,_0x2f1c7a){var _0x304f79={'status':_0x2966dd};var _0x911a20={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f1c7a){_0x304f79[_0x0cf9('0xa')]=_0x2f1c7a;}return db[_0x0cf9('0xb')][_0x0cf9('0xc')](_0x304f79,_0x911a20);}function main(){var _0xf6d0d1=0x1388;var _0x23658c;logger[_0x0cf9('0xd')](util[_0x0cf9('0xe')](_0x0cf9('0xf'),EXTRACTED_REPORT_ID,_0x0cf9('0x10')));return db[_0x0cf9('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0cf9('0x12'),'splitSizeCsv']})[_0x0cf9('0x13')](function(_0x1510f9){if(_0x1510f9){_0x23658c=_0x1510f9;_0xf6d0d1=_0x23658c[_0x0cf9('0x14')]||0x1388;}})[_0x0cf9('0x13')](function(){return dbH[_0x0cf9('0x15')][_0x0cf9('0x16')](util[_0x0cf9('0xe')](_0x0cf9('0x17'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x0cf9('0x18')]});})[_0x0cf9('0x13')](function(_0x2b744a){if(!_0x2b744a[0x0][_0x0cf9('0x19')]){return analyticExtractedReport(_0x0cf9('0x1a'));}var _0x5180d6=[];var _0x6e9dd5=0x0;if(_0x23658c[_0x0cf9('0x12')]){if(_0x2b744a&&_0x2b744a[_0x0cf9('0x1b')]){var _0x4aa4c7=_[_0x0cf9('0x1c')](_0x2b744a[0x0][_0x0cf9('0x19')]/_0xf6d0d1);var _0x4283b6=Number[_0x0cf9('0x1d')](_0x2b744a[0x0]['num']/_0xf6d0d1)?_0x2b744a[0x0][_0x0cf9('0x19')]%_0xf6d0d1:0x0;_0x4aa4c7[_0x0cf9('0x1e')](function(_0x252ad2){if(_0x252ad2>0x0){_0x6e9dd5+=_0xf6d0d1;}_0x5180d6['push'](dbH['sequelize']['query'](util[_0x0cf9('0xe')](_0x0cf9('0x1f'),QUERY,_0xf6d0d1,_0x6e9dd5),{'type':dbH[_0x0cf9('0x15')][_0x0cf9('0x20')][_0x0cf9('0x18')]}));});if(_0x4283b6>0x0){_0x6e9dd5+=_0xf6d0d1;_0x5180d6['push'](dbH[_0x0cf9('0x15')][_0x0cf9('0x16')](util[_0x0cf9('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4283b6,_0x6e9dd5),{'type':dbH[_0x0cf9('0x15')]['QueryTypes'][_0x0cf9('0x18')]}));}}}else{_0x5180d6['push'](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x0cf9('0x20')][_0x0cf9('0x18')]}));}var _0x291ce4=path[_0x0cf9('0x21')](PATH);var _0x593d4=path['basename'](PATH,_0x0cf9('0x22'));var _0x47e99c=_0x23658c[_0x0cf9('0x12')]&&_0x5180d6[_0x0cf9('0x1b')]>0x1;var _0xfd19e1=[];if(!fs[_0x0cf9('0x23')](path[_0x0cf9('0x24')](_0x291ce4,_0x593d4))&&_0x47e99c){fs[_0x0cf9('0x25')](path[_0x0cf9('0x24')](_0x291ce4,_0x593d4));}return BPromise['each'](_0x5180d6,function(_0x26041b){_0xfd19e1['push'](_0x26041b);})[_0x0cf9('0x13')](function(){for(var _0x38bd7e=0x0;_0x38bd7e<_0xfd19e1[_0x0cf9('0x1b')];_0x38bd7e+=0x1){var _0x36b697;var _0x5c8992=_0xfd19e1[_0x38bd7e];if(_0x47e99c){_0x36b697=path[_0x0cf9('0x24')](_0x291ce4,_0x593d4,util[_0x0cf9('0xe')](_0x0cf9('0x26'),_0x593d4,_0x38bd7e,_0x0cf9('0x27')));}else{_0x36b697=path[_0x0cf9('0x24')](_0x291ce4,util[_0x0cf9('0xe')](_0x0cf9('0x28'),_0x593d4,_0x0cf9('0x27')));}fs[_0x0cf9('0x29')](_0x36b697,csv(_0x5c8992));}})[_0x0cf9('0x13')](function(){if(_0x47e99c){return new Promise(function(_0x542405){zipdir(path[_0x0cf9('0x24')](_0x291ce4,_0x593d4),{'saveTo':path[_0x0cf9('0x24')](_0x291ce4,util[_0x0cf9('0xe')]('%s.%s',_0x593d4,_0x0cf9('0x2a')))},function(_0x21d1c8,_0x5e59d0){rimraf(path['join'](_0x291ce4,_0x593d4),function(){});_0x542405(_0x0cf9('0x2b'));});});}})[_0x0cf9('0x13')](function(){logger['info'](util[_0x0cf9('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0cf9('0x10')));return analyticExtractedReport(_0x0cf9('0x2c'),_0x47e99c?util[_0x0cf9('0xe')](_0x0cf9('0x28'),_0x593d4,_0x47e99c?_0x0cf9('0x2a'):'csv'):null);});})[_0x0cf9('0x2d')](function(_0x4eb75c){logger['info'](util[_0x0cf9('0xe')](_0x0cf9('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0x0cf9('0x2f')](_0x4eb75c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0cf9('0x30')](function(){process[_0x0cf9('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x67f4=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize','query','QueryTypes','SELECT','num','Empty','length','isInteger','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x27c42c,_0x2ba003){var _0x1256c=function(_0x2cfeb7){while(--_0x2cfeb7){_0x27c42c['push'](_0x27c42c['shift']());}};_0x1256c(++_0x2ba003);}(_0x67f4,0x9b));var _0x467f=function(_0x441075,_0x1b2e02){_0x441075=_0x441075-0x0;var _0x32e203=_0x67f4[_0x441075];return _0x32e203;};'use strict';var util=require(_0x467f('0x0'));var path=require(_0x467f('0x1'));var _=require(_0x467f('0x2'));var csv=require(_0x467f('0x3'));var fs=require('fs');var BPromise=require(_0x467f('0x4'));var zipdir=require(_0x467f('0x5'));var rimraf=require('rimraf');var db=require(_0x467f('0x6'))['db'];var dbH=require(_0x467f('0x6'))[_0x467f('0x7')];var logger=require(_0x467f('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x467f('0x9')][0x3];var PATH=process[_0x467f('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x256c35,_0x2b1b22){var _0x3a317e={'status':_0x256c35};var _0x2e545a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b1b22){_0x3a317e[_0x467f('0xa')]=_0x2b1b22;}return db['AnalyticExtractedReport'][_0x467f('0xb')](_0x3a317e,_0x2e545a);}function main(){var _0x3007b5=0x1388;var _0x31c792;logger[_0x467f('0xc')](util['format'](_0x467f('0xd'),EXTRACTED_REPORT_ID,_0x467f('0xe')));return db[_0x467f('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x467f('0x10'),'splitSizeCsv']})[_0x467f('0x11')](function(_0x438ceb){if(_0x438ceb){_0x31c792=_0x438ceb;_0x3007b5=_0x31c792[_0x467f('0x12')]||0x1388;}})[_0x467f('0x11')](function(){return dbH[_0x467f('0x13')][_0x467f('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x467f('0x13')][_0x467f('0x15')][_0x467f('0x16')]});})['then'](function(_0x396952){if(!_0x396952[0x0][_0x467f('0x17')]){return analyticExtractedReport(_0x467f('0x18'));}var _0x316c36=[];var _0x136b5e=0x0;if(_0x31c792[_0x467f('0x10')]){if(_0x396952&&_0x396952[_0x467f('0x19')]){var _0x173793=_['range'](_0x396952[0x0][_0x467f('0x17')]/_0x3007b5);var _0x1409b5=Number[_0x467f('0x1a')](_0x396952[0x0][_0x467f('0x17')]/_0x3007b5)?_0x396952[0x0][_0x467f('0x17')]%_0x3007b5:0x0;_0x173793['forEach'](function(_0x38321d){if(_0x38321d>0x0){_0x136b5e+=_0x3007b5;}_0x316c36[_0x467f('0x1b')](dbH[_0x467f('0x13')]['query'](util[_0x467f('0x1c')](_0x467f('0x1d'),QUERY,_0x3007b5,_0x136b5e),{'type':dbH[_0x467f('0x13')][_0x467f('0x15')][_0x467f('0x16')]}));});if(_0x1409b5>0x0){_0x136b5e+=_0x3007b5;_0x316c36['push'](dbH[_0x467f('0x13')][_0x467f('0x14')](util[_0x467f('0x1c')](_0x467f('0x1d'),QUERY,_0x1409b5,_0x136b5e),{'type':dbH['sequelize']['QueryTypes'][_0x467f('0x16')]}));}}}else{_0x316c36[_0x467f('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x467f('0x13')][_0x467f('0x15')][_0x467f('0x16')]}));}var _0x44e26b=path[_0x467f('0x1e')](PATH);var _0x56b55a=path[_0x467f('0x1f')](PATH,_0x467f('0x20'));var _0x463a2b=_0x31c792[_0x467f('0x10')]&&_0x316c36['length']>0x1;var _0x29ca0e=[];if(!fs[_0x467f('0x21')](path[_0x467f('0x22')](_0x44e26b,_0x56b55a))&&_0x463a2b){fs[_0x467f('0x23')](path['join'](_0x44e26b,_0x56b55a));}return BPromise[_0x467f('0x24')](_0x316c36,function(_0xaf52b1){_0x29ca0e['push'](_0xaf52b1);})[_0x467f('0x11')](function(){for(var _0x5dce8f=0x0;_0x5dce8f<_0x29ca0e[_0x467f('0x19')];_0x5dce8f+=0x1){var _0x580281;var _0x2ee508=_0x29ca0e[_0x5dce8f];if(_0x463a2b){_0x580281=path[_0x467f('0x22')](_0x44e26b,_0x56b55a,util[_0x467f('0x1c')](_0x467f('0x25'),_0x56b55a,_0x5dce8f,'csv'));}else{_0x580281=path['join'](_0x44e26b,util[_0x467f('0x1c')](_0x467f('0x26'),_0x56b55a,_0x467f('0x27')));}fs[_0x467f('0x28')](_0x580281,csv(_0x2ee508));}})['then'](function(){if(_0x463a2b){return new Promise(function(_0x46773f){zipdir(path[_0x467f('0x22')](_0x44e26b,_0x56b55a),{'saveTo':path[_0x467f('0x22')](_0x44e26b,util['format'](_0x467f('0x26'),_0x56b55a,_0x467f('0x29')))},function(_0x471f52,_0x18c27c){rimraf(path['join'](_0x44e26b,_0x56b55a),function(){});_0x46773f(_0x467f('0x2a'));});});}})['then'](function(){logger[_0x467f('0xc')](util['format'](_0x467f('0x2b'),EXTRACTED_REPORT_ID,_0x467f('0xe')));return analyticExtractedReport(_0x467f('0x2c'),_0x463a2b?util[_0x467f('0x1c')](_0x467f('0x26'),_0x56b55a,_0x463a2b?'zip':_0x467f('0x27')):null);});})['catch'](function(_0x1462e5){logger[_0x467f('0xc')](util[_0x467f('0x1c')](_0x467f('0x2d'),EXTRACTED_REPORT_ID,_0x467f('0xe')),util[_0x467f('0x2e')](_0x1462e5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x467f('0x2f'));})[_0x467f('0x30')](function(){process[_0x467f('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 23e12b1..972cd3d 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 _0x87a5=['mkdirSync','each','createPdfKitDocument','%s%d.%s','%s.%s','pdf','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','createWriteStream','finish','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','length','auto','push','body','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','format','before','landscape','footer','Arial','black','right','num','Empty','Setting','find','then','splitSizePdf','split','range','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.pdf','existsSync','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x87a5,0x1d0));var _0x587a=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x87a5[_0x484c03];return _0x294127;};'use strict';var _=require(_0x587a('0x0'));var fs=require('fs');var util=require(_0x587a('0x1'));var path=require(_0x587a('0x2'));var moment=require(_0x587a('0x3'));var htmlToPdfmake=require(_0x587a('0x4'));var PdfPrinter=require(_0x587a('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0x587a('0x6'));var JSDOM=require(_0x587a('0x7'))[_0x587a('0x8')];var window=new JSDOM('')[_0x587a('0x9')];var BPromise=require(_0x587a('0xa'));var db=require(_0x587a('0xb'))['db'];var dbH=require(_0x587a('0xb'))[_0x587a('0xc')];var logger=require(_0x587a('0xd'))(_0x587a('0xe'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x587a('0xf')][0x4];var NAME=process[_0x587a('0xf')][0x5];var FORMAT=_0x587a('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x22f4a9,_0x3f841f){var _0x1a227a={'status':_0x22f4a9};var _0x587a20={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f841f){_0x1a227a[_0x587a('0x11')]=_0x3f841f;}return db[_0x587a('0x12')][_0x587a('0x13')](_0x1a227a,_0x587a20);}function getHeaders(_0x114a6b){return _['map'](_0x114a6b,function(_0x4b018f){return{'text':_0x4b018f,'style':_0x587a('0x14')};});}function getRows(_0xa08c8,_0x460707){return _[_0x587a('0x15')](_0x460707,function(_0x3101fd){return _(_0x3101fd)[_0x587a('0x16')](_0xa08c8)[_0x587a('0x15')](function(_0x369677){return _0x369677?_[_0x587a('0x17')](_0x369677):'';})[_0x587a('0x18')]();});}function createTable(_0x196166,_0x56dc84){var _0x231160={'widths':_['fill'](Array(_0x196166[_0x587a('0x19')]),0x91),'heights':function(_0x34ce7f){return _0x34ce7f===0x0?_0x587a('0x1a'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x156c27=getHeaders(_0x196166);_0x231160['body'][_0x587a('0x1b')](_0x156c27);var _0x323e30=getRows(_0x196166,_0x56dc84);_0x231160[_0x587a('0x1c')]=_0x231160['body']['concat'](_0x323e30);return _0x231160;}function createTables(_0x2caf76){var _0xf78dbd=[];var _0x2861aa=_[_0x587a('0x1d')](Object[_0x587a('0x1e')](_0x2caf76[0x0]),0x5);_0x2861aa[_0x587a('0x1f')](function(_0x312803){_0xf78dbd[_0x587a('0x1b')](createTable(_0x312803,_0x2caf76));});return _0xf78dbd;}function getPDFDocDefinition(_0x55ab49){var _0x1414a6=util['format'](_0x587a('0x20'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x587a('0x21')])[_0x587a('0x22')](FORMAT));var _0x24373e=[];for(var _0x430014=0x0;_0x430014<_0x55ab49['length'];_0x430014++){var _0x16a181=[];if(_0x430014===0x0){_0x16a181['push']({'text':_0x1414a6,'style':'header'});}var _0xe1bbc5={'table':_0x55ab49[_0x430014]};if(_0x430014>0x0){_0xe1bbc5['pageBreak']=_0x587a('0x23');_0xe1bbc5['margin']=[0x0,0x46,0x0,0x0];}_0x16a181[_0x587a('0x1b')](_0xe1bbc5);_0x24373e[_0x587a('0x1b')](_0x16a181);}return{'pageSize':'A4','pageOrientation':_0x587a('0x24'),'content':_0x24373e,'footer':function(_0x4f5cbb,_0x5a030a){return{'text':_0x4f5cbb[_0x587a('0x17')]()+'\x20/\x20'+_0x5a030a,'style':_0x587a('0x25')};},'defaultStyle':{'font':_0x587a('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x587a('0x27')},'footer':{'alignment':_0x587a('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x127341){var _0x22f8e8=0x1388;var _0x33e085;if(!_0x127341[0x0][_0x587a('0x29')]){return analyticExtractedReport(_0x587a('0x2a'));}return db[_0x587a('0x2b')][_0x587a('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x587a('0x2d')](function(_0x1a325a){if(_0x1a325a){_0x33e085=_0x1a325a;_0x22f8e8=_0x33e085[_0x587a('0x2e')]||0x3e8;}})['then'](function(){var _0x202067=[];var _0x45a965=0x0;if(_0x33e085[_0x587a('0x2f')]){if(_0x127341&&_0x127341['length']){var _0x5058a2=_[_0x587a('0x30')](_0x127341[0x0][_0x587a('0x29')]/_0x22f8e8);var _0x1e868d=Number['isInteger'](_0x127341[0x0][_0x587a('0x29')]/_0x22f8e8)?_0x127341[0x0][_0x587a('0x29')]%_0x22f8e8:0x0;_0x5058a2[_0x587a('0x1f')](function(_0x253f85){if(_0x253f85>0x0){_0x45a965+=_0x22f8e8;}_0x202067[_0x587a('0x1b')](dbH[_0x587a('0x31')][_0x587a('0x32')](util[_0x587a('0x22')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x22f8e8,_0x45a965),{'type':dbH[_0x587a('0x31')][_0x587a('0x33')][_0x587a('0x34')]}));});if(_0x1e868d>0x0){_0x45a965+=_0x22f8e8;_0x202067[_0x587a('0x1b')](dbH[_0x587a('0x31')][_0x587a('0x32')](util['format'](_0x587a('0x35'),QUERY,_0x1e868d,_0x45a965),{'type':dbH[_0x587a('0x31')]['QueryTypes'][_0x587a('0x34')]}));}}}else{_0x202067['push'](dbH[_0x587a('0x31')][_0x587a('0x32')](QUERY,{'type':dbH[_0x587a('0x31')][_0x587a('0x33')][_0x587a('0x34')]}));}var _0x4ed9b1=path[_0x587a('0x36')](PATH);var _0x48471f=path['basename'](PATH,_0x587a('0x37'));var _0x5aec7e=_0x33e085['split']&&_0x202067[_0x587a('0x19')]>0x1;var _0x330aeb=[];if(!fs[_0x587a('0x38')](path[_0x587a('0x39')](_0x4ed9b1,_0x48471f))&&_0x5aec7e){fs[_0x587a('0x3a')](path[_0x587a('0x39')](_0x4ed9b1,_0x48471f));}return BPromise[_0x587a('0x3b')](_0x202067,function(_0x2b7fc0){_0x330aeb[_0x587a('0x1b')](_0x2b7fc0);})[_0x587a('0x2d')](function(){var _0x5dd04c=[];for(var _0x637bbf=0x0;_0x637bbf<_0x330aeb[_0x587a('0x19')];_0x637bbf+=0x1){var _0x53375d=_0x330aeb[_0x637bbf];var _0x2e80b3=createTables(_['flatten'](_0x53375d));var _0x17847e;var _0x3c6486=getPDFDocDefinition(_0x2e80b3);var _0xdd13e7=getPDFPrinter();var _0x31fa46=_0xdd13e7[_0x587a('0x3c')](_0x3c6486);if(_0x5aec7e){_0x17847e=path[_0x587a('0x39')](_0x4ed9b1,_0x48471f,util[_0x587a('0x22')](_0x587a('0x3d'),_0x48471f,_0x637bbf,'pdf'));}else{_0x17847e=path[_0x587a('0x39')](_0x4ed9b1,util['format'](_0x587a('0x3e'),_0x48471f,_0x587a('0x3f')));}_0x5dd04c[_0x587a('0x1b')](writePDFDocument(_0x31fa46,_0x17847e));}return Promise['all'](_0x5dd04c);})[_0x587a('0x2d')](function(){if(_0x5aec7e){return new Promise(function(_0x1d528b){zipdir(path[_0x587a('0x39')](_0x4ed9b1,_0x48471f),{'saveTo':path[_0x587a('0x39')](_0x4ed9b1,util[_0x587a('0x22')](_0x587a('0x3e'),_0x48471f,_0x587a('0x40')))},function(){rimraf(path[_0x587a('0x39')](_0x4ed9b1,_0x48471f),function(){});_0x1d528b(_0x587a('0x41'));});});}})[_0x587a('0x2d')](function(){if(!_0x5aec7e)return;rimraf(path['join'](_0x4ed9b1,_0x48471f),function(){});})[_0x587a('0x2d')](function(){logger[_0x587a('0x42')](util['format'](_0x587a('0x43'),EXTRACTED_REPORT_ID,_0x587a('0x44')));return analyticExtractedReport(_0x587a('0x45'),_0x5aec7e?util[_0x587a('0x22')](_0x587a('0x3e'),_0x48471f,_0x5aec7e?'zip':_0x587a('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x587a('0x22')](_0x587a('0x46'),EXTRACTED_REPORT_ID,_0x587a('0x44')));return db[_0x587a('0x12')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x4a96e6){EXTRACTED_REPORT=_0x4a96e6;return dbH[_0x587a('0x31')][_0x587a('0x32')](util[_0x587a('0x22')](_0x587a('0x47'),QUERY),{'type':dbH[_0x587a('0x31')][_0x587a('0x33')]['SELECT']});})[_0x587a('0x2d')](extractReport)[_0x587a('0x48')](function(_0x2422d0){logger[_0x587a('0x42')](util['format'](_0x587a('0x49'),EXTRACTED_REPORT_ID,_0x587a('0x44')),util[_0x587a('0x4a')](_0x2422d0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x587a('0x4b'));})[_0x587a('0x4c')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0xdcd540=new PdfPrinter({'Arial':{'normal':__dirname+_0x587a('0x4d'),'bold':__dirname+_0x587a('0x4e'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x587a('0x4f')}});return _0xdcd540;}function getPDFDocDefinitionFromHTML(_0x1f83c3,_0x36167d){var _0x2b260e=util[_0x587a('0x22')]('%s\x20#%d',_0x36167d[_0x587a('0x50')],_0x36167d[_0x587a('0x51')]);var _0x1611e2=moment()[_0x587a('0x22')](_0x587a('0x52'))['toString']();var _0x4365d1=htmlToPdfmake(_0x1f83c3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4365d1],'defaultStyle':{'font':_0x587a('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x587a('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x587a('0x53')}},'header':function(){return[{'text':_0x587a('0x54'),'style':'header'}];},'footer':function(_0x242ce2,_0x4dec24){return[{'text':util[_0x587a('0x22')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2b260e,_0x242ce2,_0x4dec24,_0x1611e2),'style':'footer'}];}};}function writePDFDocument(_0x46c524,_0x50de59){return new Promise(function(_0x220fa5,_0x5bf4fa){var _0x2b1498=_0x46c524['pipe'](fs[_0x587a('0x55')](_0x50de59));_0x2b1498['on'](_0x587a('0x56'),function(){_0x220fa5(_0x587a('0x56'));});_0x2b1498['on']('error',function(_0x3ad5ea){_0x5bf4fa(_0x3ad5ea);});_0x46c524['end']();});}exports['createPdfFromHTML']=function(_0xbe65ae,_0x5506ec){var _0x5d1ee6=getPDFPrinter();var _0x3a178b=getPDFDocDefinitionFromHTML(_0xbe65ae,_0x5506ec);var _0x5535ef=_0x5d1ee6[_0x587a('0x3c')](_0x3a178b);return writePDFDocument(_0x5535ef,_0x5506ec[_0x587a('0x2')])[_0x587a('0x48')](function(_0x16ed33){throw _0x16ed33;});}; \ No newline at end of file +var _0x0b77=['all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','push','body','chunk','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','header','before','footer','black','right','Empty','Setting','split','then','splitSizePdf','range','num','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','each','createPdfKitDocument','%s%d.%s','%s.%s','pdf'];(function(_0x5ea88c,_0x109810){var _0x247560=function(_0x5f49c6){while(--_0x5f49c6){_0x5ea88c['push'](_0x5ea88c['shift']());}};_0x247560(++_0x109810);}(_0x0b77,0xcd));var _0x70b7=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x0b77[_0xf26d40];return _0x50b68c;};'use strict';var _=require(_0x70b7('0x0'));var fs=require('fs');var util=require(_0x70b7('0x1'));var path=require(_0x70b7('0x2'));var moment=require(_0x70b7('0x3'));var htmlToPdfmake=require(_0x70b7('0x4'));var PdfPrinter=require(_0x70b7('0x5'));var zipdir=require(_0x70b7('0x6'));var rimraf=require(_0x70b7('0x7'));var JSDOM=require(_0x70b7('0x8'))[_0x70b7('0x9')];var window=new JSDOM('')[_0x70b7('0xa')];var BPromise=require(_0x70b7('0xb'));var db=require('../../mysqldb')['db'];var dbH=require(_0x70b7('0xc'))['dbH'];var logger=require(_0x70b7('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x70b7('0xe')][0x2]);var QUERY=process[_0x70b7('0xe')][0x3];var PATH=process[_0x70b7('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x70b7('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5be269,_0x4e7998){var _0x5b9ecb={'status':_0x5be269};var _0x52d132={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e7998){_0x5b9ecb[_0x70b7('0x10')]=_0x4e7998;}return db[_0x70b7('0x11')][_0x70b7('0x12')](_0x5b9ecb,_0x52d132);}function getHeaders(_0x53ec19){return _[_0x70b7('0x13')](_0x53ec19,function(_0x449994){return{'text':_0x449994,'style':_0x70b7('0x14')};});}function getRows(_0x3cd13b,_0x2ae10c){return _[_0x70b7('0x13')](_0x2ae10c,function(_0x15dda7){return _(_0x15dda7)['pick'](_0x3cd13b)[_0x70b7('0x13')](function(_0x4ffc7c){return _0x4ffc7c?_[_0x70b7('0x15')](_0x4ffc7c):'';})[_0x70b7('0x16')]();});}function createTable(_0x3df131,_0xe92c76){var _0xd33f2d={'widths':_[_0x70b7('0x17')](Array(_0x3df131[_0x70b7('0x18')]),0x91),'heights':function(_0x31dce1){return _0x31dce1===0x0?_0x70b7('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4f94f2=getHeaders(_0x3df131);_0xd33f2d['body'][_0x70b7('0x1a')](_0x4f94f2);var _0x5cdf22=getRows(_0x3df131,_0xe92c76);_0xd33f2d[_0x70b7('0x1b')]=_0xd33f2d[_0x70b7('0x1b')]['concat'](_0x5cdf22);return _0xd33f2d;}function createTables(_0x5ca890){var _0x15427a=[];var _0x10dcee=_[_0x70b7('0x1c')](Object[_0x70b7('0x1d')](_0x5ca890[0x0]),0x5);_0x10dcee['forEach'](function(_0xf3518d){_0x15427a[_0x70b7('0x1a')](createTable(_0xf3518d,_0x5ca890));});return _0x15427a;}function getPDFDocDefinition(_0x1e69f4){var _0x448480=util['format'](_0x70b7('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x70b7('0x1f')])[_0x70b7('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0x70b7('0x21')])[_0x70b7('0x20')](FORMAT));var _0x5cd70f=[];for(var _0x3c21b5=0x0;_0x3c21b5<_0x1e69f4[_0x70b7('0x18')];_0x3c21b5++){var _0x207bb2=[];if(_0x3c21b5===0x0){_0x207bb2['push']({'text':_0x448480,'style':_0x70b7('0x22')});}var _0x337e67={'table':_0x1e69f4[_0x3c21b5]};if(_0x3c21b5>0x0){_0x337e67['pageBreak']=_0x70b7('0x23');_0x337e67['margin']=[0x0,0x46,0x0,0x0];}_0x207bb2[_0x70b7('0x1a')](_0x337e67);_0x5cd70f[_0x70b7('0x1a')](_0x207bb2);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x5cd70f,'footer':function(_0x5bcdfd,_0x57fa5b){return{'text':_0x5bcdfd[_0x70b7('0x15')]()+'\x20/\x20'+_0x57fa5b,'style':_0x70b7('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x70b7('0x25')},'footer':{'alignment':_0x70b7('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4a7c08){var _0x391784=0x1388;var _0x8af719;if(!_0x4a7c08[0x0]['num']){return analyticExtractedReport(_0x70b7('0x27'));}return db[_0x70b7('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x70b7('0x29'),'splitSizePdf']})[_0x70b7('0x2a')](function(_0x42f9e0){if(_0x42f9e0){_0x8af719=_0x42f9e0;_0x391784=_0x8af719[_0x70b7('0x2b')]||0x3e8;}})[_0x70b7('0x2a')](function(){var _0x5cd40f=[];var _0xe25e32=0x0;if(_0x8af719['split']){if(_0x4a7c08&&_0x4a7c08['length']){var _0x5f1ddd=_[_0x70b7('0x2c')](_0x4a7c08[0x0][_0x70b7('0x2d')]/_0x391784);var _0x233121=Number[_0x70b7('0x2e')](_0x4a7c08[0x0][_0x70b7('0x2d')]/_0x391784)?_0x4a7c08[0x0][_0x70b7('0x2d')]%_0x391784:0x0;_0x5f1ddd[_0x70b7('0x2f')](function(_0x388898){if(_0x388898>0x0){_0xe25e32+=_0x391784;}_0x5cd40f[_0x70b7('0x1a')](dbH[_0x70b7('0x30')][_0x70b7('0x31')](util[_0x70b7('0x20')](_0x70b7('0x32'),QUERY,_0x391784,_0xe25e32),{'type':dbH['sequelize'][_0x70b7('0x33')]['SELECT']}));});if(_0x233121>0x0){_0xe25e32+=_0x391784;_0x5cd40f['push'](dbH[_0x70b7('0x30')][_0x70b7('0x31')](util[_0x70b7('0x20')](_0x70b7('0x32'),QUERY,_0x233121,_0xe25e32),{'type':dbH[_0x70b7('0x30')][_0x70b7('0x33')][_0x70b7('0x34')]}));}}}else{_0x5cd40f['push'](dbH[_0x70b7('0x30')][_0x70b7('0x31')](QUERY,{'type':dbH[_0x70b7('0x30')][_0x70b7('0x33')]['SELECT']}));}var _0x376419=path['dirname'](PATH);var _0x5958e7=path[_0x70b7('0x35')](PATH,_0x70b7('0x36'));var _0x54a83d=_0x8af719['split']&&_0x5cd40f['length']>0x1;var _0x28c631=[];if(!fs[_0x70b7('0x37')](path[_0x70b7('0x38')](_0x376419,_0x5958e7))&&_0x54a83d){fs['mkdirSync'](path[_0x70b7('0x38')](_0x376419,_0x5958e7));}return BPromise[_0x70b7('0x39')](_0x5cd40f,function(_0x4785e0){_0x28c631[_0x70b7('0x1a')](_0x4785e0);})[_0x70b7('0x2a')](function(){var _0x226520=[];for(var _0x143bd0=0x0;_0x143bd0<_0x28c631[_0x70b7('0x18')];_0x143bd0+=0x1){var _0x29cd74=_0x28c631[_0x143bd0];var _0x2ee43b=createTables(_['flatten'](_0x29cd74));var _0x3a1ef0;var _0x2eb5ae=getPDFDocDefinition(_0x2ee43b);var _0x1cfbf4=getPDFPrinter();var _0x32d1b4=_0x1cfbf4[_0x70b7('0x3a')](_0x2eb5ae);if(_0x54a83d){_0x3a1ef0=path[_0x70b7('0x38')](_0x376419,_0x5958e7,util[_0x70b7('0x20')](_0x70b7('0x3b'),_0x5958e7,_0x143bd0,'pdf'));}else{_0x3a1ef0=path[_0x70b7('0x38')](_0x376419,util[_0x70b7('0x20')](_0x70b7('0x3c'),_0x5958e7,_0x70b7('0x3d')));}_0x226520['push'](writePDFDocument(_0x32d1b4,_0x3a1ef0));}return Promise[_0x70b7('0x3e')](_0x226520);})[_0x70b7('0x2a')](function(){if(_0x54a83d){return new Promise(function(_0x2ea2bd){zipdir(path[_0x70b7('0x38')](_0x376419,_0x5958e7),{'saveTo':path[_0x70b7('0x38')](_0x376419,util['format'](_0x70b7('0x3c'),_0x5958e7,'zip'))},function(){rimraf(path['join'](_0x376419,_0x5958e7),function(){});_0x2ea2bd('zip\x20finished');});});}})[_0x70b7('0x2a')](function(){if(!_0x54a83d)return;rimraf(path[_0x70b7('0x38')](_0x376419,_0x5958e7),function(){});})[_0x70b7('0x2a')](function(){logger[_0x70b7('0x3f')](util[_0x70b7('0x20')](_0x70b7('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x54a83d?util[_0x70b7('0x20')](_0x70b7('0x3c'),_0x5958e7,_0x54a83d?_0x70b7('0x41'):_0x70b7('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x70b7('0x20')](_0x70b7('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x70b7('0x11')][_0x70b7('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x70b7('0x2a')](function(_0x27fffe){EXTRACTED_REPORT=_0x27fffe;return dbH[_0x70b7('0x30')][_0x70b7('0x31')](util[_0x70b7('0x20')](_0x70b7('0x44'),QUERY),{'type':dbH[_0x70b7('0x30')][_0x70b7('0x33')][_0x70b7('0x34')]});})[_0x70b7('0x2a')](extractReport)[_0x70b7('0x45')](function(_0x94a31f){logger['info'](util[_0x70b7('0x20')](_0x70b7('0x46'),EXTRACTED_REPORT_ID,_0x70b7('0x47')),util['inspect'](_0x94a31f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x70b7('0x48'));})[_0x70b7('0x49')](function(){process[_0x70b7('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x7b49b7=new PdfPrinter({'Arial':{'normal':__dirname+_0x70b7('0x4b'),'bold':__dirname+_0x70b7('0x4c'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x70b7('0x4d')}});return _0x7b49b7;}function getPDFDocDefinitionFromHTML(_0x5bae28,_0x118a44){var _0x34b581=util[_0x70b7('0x20')](_0x70b7('0x4e'),_0x118a44[_0x70b7('0x4f')],_0x118a44[_0x70b7('0x50')]);var _0x1a9ce4=moment()['format']('YYYY-MM-DD')[_0x70b7('0x15')]();var _0x20fc8d=htmlToPdfmake(_0x5bae28,{'window':window,'tableAutoSize':!![]});return{'content':[_0x20fc8d],'defaultStyle':{'font':_0x70b7('0x51')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x70b7('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x70b7('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x70b7('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x70b7('0x22')}];},'footer':function(_0x5ba3d8,_0x1a6437){return[{'text':util[_0x70b7('0x20')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x34b581,_0x5ba3d8,_0x1a6437,_0x1a9ce4),'style':_0x70b7('0x24')}];}};}function writePDFDocument(_0x4fac35,_0x37c526){return new Promise(function(_0x28f6df,_0x48747d){var _0xca666a=_0x4fac35[_0x70b7('0x53')](fs[_0x70b7('0x54')](_0x37c526));_0xca666a['on'](_0x70b7('0x55'),function(){_0x28f6df(_0x70b7('0x55'));});_0xca666a['on'](_0x70b7('0x56'),function(_0x538d6b){_0x48747d(_0x538d6b);});_0x4fac35[_0x70b7('0x57')]();});}exports[_0x70b7('0x58')]=function(_0x235754,_0x448cf8){var _0x529645=getPDFPrinter();var _0x16c309=getPDFDocDefinitionFromHTML(_0x235754,_0x448cf8);var _0x540b66=_0x529645[_0x70b7('0x3a')](_0x16c309);return writePDFDocument(_0x540b66,_0x448cf8[_0x70b7('0x2')])[_0x70b7('0x45')](function(_0x3a29be){throw _0x3a29be;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 568a276..3c6769c 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 _0x4a95=['binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','finally','exit','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','info','format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','join','mkdirSync','%s%d.%s','xlsx'];(function(_0x1f1641,_0x42ad9d){var _0x9660b4=function(_0x545ff2){while(--_0x545ff2){_0x1f1641['push'](_0x1f1641['shift']());}};_0x9660b4(++_0x42ad9d);}(_0x4a95,0x91));var _0x54a9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4a95[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var path=require(_0x54a9('0x0'));var _=require(_0x54a9('0x1'));var fs=require('fs');var json2xls=require(_0x54a9('0x2'));var BPromise=require(_0x54a9('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x54a9('0x4'));var db=require(_0x54a9('0x5'))['db'];var dbH=require(_0x54a9('0x5'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x54a9('0x6')][0x2]);var QUERY=process[_0x54a9('0x6')][0x3];var PATH=process[_0x54a9('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a2d15,_0x501b01){var _0x20b903={'status':_0x3a2d15};var _0x2c9c30={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x501b01){_0x20b903[_0x54a9('0x7')]=_0x501b01;}return db[_0x54a9('0x8')]['update'](_0x20b903,_0x2c9c30);}function main(){var _0x4b5aeb=0x1388;var _0x1186fb;logger[_0x54a9('0x9')](util[_0x54a9('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x54a9('0xb')));return db[_0x54a9('0xc')][_0x54a9('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x54a9('0xe'),'splitSizeXlsx']})[_0x54a9('0xf')](function(_0x28ecf9){if(_0x28ecf9){_0x1186fb=_0x28ecf9;_0x4b5aeb=_0x1186fb[_0x54a9('0x10')]||0x1388;}})[_0x54a9('0xf')](function(){return dbH[_0x54a9('0x11')]['query'](util[_0x54a9('0xa')](_0x54a9('0x12'),QUERY),{'type':dbH['sequelize'][_0x54a9('0x13')][_0x54a9('0x14')]});})['then'](function(_0x123909){if(!_0x123909[0x0][_0x54a9('0x15')]){return analyticExtractedReport(_0x54a9('0x16'));}var _0x1723e2=[];var _0x41c843=0x0;if(_0x1186fb['split']){if(_0x123909&&_0x123909[_0x54a9('0x17')]){var _0x59fc1e=_[_0x54a9('0x18')](_0x123909[0x0]['num']/_0x4b5aeb);var _0x24036b=Number['isInteger'](_0x123909[0x0]['num']/_0x4b5aeb)?_0x123909[0x0][_0x54a9('0x15')]%_0x4b5aeb:0x0;_0x59fc1e[_0x54a9('0x19')](function(_0x21de34){if(_0x21de34>0x0){_0x41c843+=_0x4b5aeb;}_0x1723e2[_0x54a9('0x1a')](dbH[_0x54a9('0x11')][_0x54a9('0x1b')](util[_0x54a9('0xa')](_0x54a9('0x1c'),QUERY,_0x4b5aeb,_0x41c843),{'type':dbH[_0x54a9('0x11')][_0x54a9('0x13')][_0x54a9('0x14')]}));});if(_0x24036b>0x0){_0x41c843+=_0x4b5aeb;_0x1723e2[_0x54a9('0x1a')](dbH[_0x54a9('0x11')][_0x54a9('0x1b')](util[_0x54a9('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x24036b,_0x41c843),{'type':dbH['sequelize'][_0x54a9('0x13')][_0x54a9('0x14')]}));}}}else{_0x1723e2[_0x54a9('0x1a')](dbH[_0x54a9('0x11')]['query'](QUERY,{'type':dbH[_0x54a9('0x11')][_0x54a9('0x13')][_0x54a9('0x14')]}));}var _0x2723a8=path[_0x54a9('0x1d')](PATH);var _0x4d129a=path['basename'](PATH,_0x54a9('0x1e'));var _0x93c451=_0x1186fb[_0x54a9('0xe')]&&_0x1723e2['length']>0x1;var _0x4007f2=[];if(!fs['existsSync'](path[_0x54a9('0x1f')](_0x2723a8,_0x4d129a))&&_0x93c451){fs[_0x54a9('0x20')](path[_0x54a9('0x1f')](_0x2723a8,_0x4d129a));}return BPromise['each'](_0x1723e2,function(_0x36c013){_0x4007f2[_0x54a9('0x1a')](_0x36c013);})[_0x54a9('0xf')](function(){for(var _0x3c0c18=0x0;_0x3c0c18<_0x4007f2[_0x54a9('0x17')];_0x3c0c18+=0x1){var _0x4515bb;var _0xd229ac=_0x4007f2[_0x3c0c18];if(_0x93c451){_0x4515bb=path[_0x54a9('0x1f')](_0x2723a8,_0x4d129a,util['format'](_0x54a9('0x21'),_0x4d129a,_0x3c0c18,_0x54a9('0x22')));}else{_0x4515bb=path[_0x54a9('0x1f')](_0x2723a8,util[_0x54a9('0xa')]('%s.%s',_0x4d129a,'xlsx'));}fs['writeFileSync'](_0x4515bb,json2xls(_0xd229ac),_0x54a9('0x23'));}})[_0x54a9('0xf')](function(){if(_0x93c451){return new Promise(function(_0x234640){zipdir(path[_0x54a9('0x1f')](_0x2723a8,_0x4d129a),{'saveTo':path[_0x54a9('0x1f')](_0x2723a8,util[_0x54a9('0xa')](_0x54a9('0x24'),_0x4d129a,_0x54a9('0x25')))},function(_0x4e56d5,_0x1fe7d6){rimraf(path[_0x54a9('0x1f')](_0x2723a8,_0x4d129a),function(){});_0x234640(_0x54a9('0x26'));});});}})[_0x54a9('0xf')](function(){logger['info'](util[_0x54a9('0xa')](_0x54a9('0x27'),EXTRACTED_REPORT_ID,_0x54a9('0xb')));return analyticExtractedReport(_0x54a9('0x28'),_0x93c451?util[_0x54a9('0xa')](_0x54a9('0x24'),_0x4d129a,_0x93c451?'zip':_0x54a9('0x22')):null);});})[_0x54a9('0x29')](function(_0x54b1c0){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x54a9('0xb')),util[_0x54a9('0x2a')](_0x54b1c0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x54a9('0x2b')](function(){process[_0x54a9('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0df5=['length','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','join','%s%d.%s','xlsx','%s.%s','writeFileSync','zip\x20finished','Completed','zip','Failed','finally','exit','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','argv','info','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','SELECT','num','Empty'];(function(_0xc6c67d,_0x213d39){var _0x361914=function(_0x3f4c3d){while(--_0x3f4c3d){_0xc6c67d['push'](_0xc6c67d['shift']());}};_0x361914(++_0x213d39);}(_0x0df5,0x18f));var _0x50df=function(_0x208a65,_0x129f7f){_0x208a65=_0x208a65-0x0;var _0x384fad=_0x0df5[_0x208a65];return _0x384fad;};'use strict';var util=require('util');var path=require('path');var _=require(_0x50df('0x0'));var fs=require('fs');var json2xls=require(_0x50df('0x1'));var BPromise=require(_0x50df('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x50df('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x50df('0x4'))[_0x50df('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x50df('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x50df('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x14aa90,_0x51a779){var _0x5b24bc={'status':_0x14aa90};var _0x5ab23b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x51a779){_0x5b24bc['savename']=_0x51a779;}return db['AnalyticExtractedReport']['update'](_0x5b24bc,_0x5ab23b);}function main(){var _0x7f69ed=0x1388;var _0x69422d;logger[_0x50df('0x7')](util['format'](_0x50df('0x8'),EXTRACTED_REPORT_ID,_0x50df('0x9')));return db[_0x50df('0xa')][_0x50df('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x50df('0xc'),_0x50df('0xd')]})['then'](function(_0x10743a){if(_0x10743a){_0x69422d=_0x10743a;_0x7f69ed=_0x69422d['splitSizeXlsx']||0x1388;}})[_0x50df('0xe')](function(){return dbH[_0x50df('0xf')][_0x50df('0x10')](util['format'](_0x50df('0x11'),QUERY),{'type':dbH[_0x50df('0xf')]['QueryTypes'][_0x50df('0x12')]});})[_0x50df('0xe')](function(_0x2b9350){if(!_0x2b9350[0x0][_0x50df('0x13')]){return analyticExtractedReport(_0x50df('0x14'));}var _0xa05b23=[];var _0x1ce8c6=0x0;if(_0x69422d[_0x50df('0xc')]){if(_0x2b9350&&_0x2b9350[_0x50df('0x15')]){var _0x4d058f=_['range'](_0x2b9350[0x0][_0x50df('0x13')]/_0x7f69ed);var _0x109369=Number[_0x50df('0x16')](_0x2b9350[0x0][_0x50df('0x13')]/_0x7f69ed)?_0x2b9350[0x0]['num']%_0x7f69ed:0x0;_0x4d058f[_0x50df('0x17')](function(_0x1ddca0){if(_0x1ddca0>0x0){_0x1ce8c6+=_0x7f69ed;}_0xa05b23[_0x50df('0x18')](dbH['sequelize'][_0x50df('0x10')](util[_0x50df('0x19')](_0x50df('0x1a'),QUERY,_0x7f69ed,_0x1ce8c6),{'type':dbH['sequelize'][_0x50df('0x1b')][_0x50df('0x12')]}));});if(_0x109369>0x0){_0x1ce8c6+=_0x7f69ed;_0xa05b23[_0x50df('0x18')](dbH[_0x50df('0xf')]['query'](util[_0x50df('0x19')](_0x50df('0x1a'),QUERY,_0x109369,_0x1ce8c6),{'type':dbH[_0x50df('0xf')][_0x50df('0x1b')]['SELECT']}));}}}else{_0xa05b23[_0x50df('0x18')](dbH[_0x50df('0xf')][_0x50df('0x10')](QUERY,{'type':dbH[_0x50df('0xf')][_0x50df('0x1b')]['SELECT']}));}var _0x70af68=path[_0x50df('0x1c')](PATH);var _0x323247=path[_0x50df('0x1d')](PATH,_0x50df('0x1e'));var _0x3fee67=_0x69422d[_0x50df('0xc')]&&_0xa05b23[_0x50df('0x15')]>0x1;var _0x4c5e69=[];if(!fs['existsSync'](path['join'](_0x70af68,_0x323247))&&_0x3fee67){fs['mkdirSync'](path[_0x50df('0x1f')](_0x70af68,_0x323247));}return BPromise['each'](_0xa05b23,function(_0x58df37){_0x4c5e69[_0x50df('0x18')](_0x58df37);})['then'](function(){for(var _0x4c6795=0x0;_0x4c6795<_0x4c5e69[_0x50df('0x15')];_0x4c6795+=0x1){var _0x2671ac;var _0x519e4b=_0x4c5e69[_0x4c6795];if(_0x3fee67){_0x2671ac=path[_0x50df('0x1f')](_0x70af68,_0x323247,util['format'](_0x50df('0x20'),_0x323247,_0x4c6795,_0x50df('0x21')));}else{_0x2671ac=path[_0x50df('0x1f')](_0x70af68,util[_0x50df('0x19')](_0x50df('0x22'),_0x323247,_0x50df('0x21')));}fs[_0x50df('0x23')](_0x2671ac,json2xls(_0x519e4b),'binary');}})[_0x50df('0xe')](function(){if(_0x3fee67){return new Promise(function(_0x1092e9){zipdir(path[_0x50df('0x1f')](_0x70af68,_0x323247),{'saveTo':path[_0x50df('0x1f')](_0x70af68,util['format']('%s.%s',_0x323247,'zip'))},function(_0xcff277,_0x334d7a){rimraf(path[_0x50df('0x1f')](_0x70af68,_0x323247),function(){});_0x1092e9(_0x50df('0x24'));});});}})[_0x50df('0xe')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x50df('0x9')));return analyticExtractedReport(_0x50df('0x25'),_0x3fee67?util[_0x50df('0x19')](_0x50df('0x22'),_0x323247,_0x3fee67?_0x50df('0x26'):_0x50df('0x21')):null);});})['catch'](function(_0x7922b4){logger['info'](util[_0x50df('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x7922b4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x50df('0x27'));})[_0x50df('0x28')](function(){process[_0x50df('0x29')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 15d5c84..7488b06 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 _0xa24f=['VoiceExtensionId','inbound','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','*,*,*,*','IntervalId','interval','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s'];(function(_0x2e3097,_0x457ec2){var _0x5c19bb=function(_0xdc924a){while(--_0xdc924a){_0x2e3097['push'](_0x2e3097['shift']());}};_0x5c19bb(++_0x457ec2);}(_0xa24f,0xc8));var _0xfa24=function(_0x2e092e,_0x1bbef3){_0x2e092e=_0x2e092e-0x0;var _0x4d4f52=_0xa24f[_0x2e092e];return _0x4d4f52;};'use strict';var _=require(_0xfa24('0x0'));var util=require(_0xfa24('0x1'));function rewrite(_0x4cfd69,_0x5893e7){var _0x3bc07a=this;return _0x4cfd69[_0xfa24('0x2')][_0xfa24('0x3')][_0xfa24('0x4')]({'raw':!![]})['then'](function(_0x2d3cf5){_0x3bc07a[_0xfa24('0x5')]=_0x2d3cf5;return _0x4cfd69['models'][_0xfa24('0x6')][_0xfa24('0x4')]({'where':{'IntervalId':_0x5893e7['IntervalId']},'raw':!![]});})[_0xfa24('0x7')](function(_0x4044b7){return _0x4cfd69[_0xfa24('0x2')]['VoiceExtension'][_0xfa24('0x4')]({'where':{'exten':{'$in':_[_0xfa24('0x8')](_[_0xfa24('0x9')](_0x4044b7,_0xfa24('0xa')))}},'order':[{'raw':_0xfa24('0xb')}],'raw':!![]});})[_0xfa24('0x7')](function(_0x271a1b){var _0x54f310=_['filter'](_0x271a1b,{'priority':'1'});var _0x2607b2=_['filter'](_0x271a1b,{'isApp':0x1});var _0x265d1c=_[_0xfa24('0xc')](_0x2607b2,'exten');var _0x4898dd=[_0xfa24('0xd'),_0xfa24('0xe')];var _0x3d5522=[];var _0xe44d4e=[];for(var _0x52d536 in _0x265d1c){if(_0x265d1c[_0xfa24('0xf')](_0x52d536)){_0x3bc07a[_0xfa24('0x10')]=0x2;_0x3bc07a['extensions']=[];_0x3bc07a[_0xfa24('0x11')]=_[_0xfa24('0x12')](_0x54f310,{'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')]});_0x3bc07a[_0xfa24('0x13')][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':util[_0xfa24('0x17')](_0xfa24('0x18'),_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')]),'context':_0x265d1c[_0x52d536][0x0]['context'],'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'priority':_0x3bc07a['priority']++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});if(_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')]===_0xfa24('0x1a')){_0x3bc07a[_0xfa24('0x13')][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':'CDR(routeid)='+_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')],'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});}else if(_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')]===_0xfa24('0x1c')){if(_0x3bc07a[_0xfa24('0x11')]){_0x3bc07a[_0xfa24('0x13')][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':'Set','appdata':_0xfa24('0x1d')+(_0x3bc07a[_0xfa24('0x11')][_0xfa24('0x1e')]?_0xfa24('0x1f')+_0x3bc07a['extension'][_0xfa24('0x1e')]+'}':'${EXTEN}'),'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});}_0x3bc07a[_0xfa24('0x13')][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':_0xfa24('0x20')+_0x265d1c[_0x52d536][0x0]['VoiceExtensionId'],'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});var _0x261789=_0x3bc07a['priority']++;_0x3bc07a[_0xfa24('0x13')]['push']({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x21'),'appdata':_0xfa24('0x22')+(_0x261789+0x2)+_0xfa24('0x23')+(_0x261789+0x1)+')','context':_0x265d1c[_0x52d536][0x0]['context'],'exten':_0x265d1c[_0x52d536][0x0]['exten'],'priority':_0x261789,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});if(_0x3bc07a['extension']){_0x3bc07a[_0xfa24('0x13')]['push']({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':_0x3bc07a[_0xfa24('0x11')][_0xfa24('0x1e')]?'CDR(prefix)=${EXTEN:0:'+_0x3bc07a[_0xfa24('0x11')]['cutdigits']+'}':_0xfa24('0x24'),'context':_0x265d1c[_0x52d536][0x0]['context'],'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0]['VoiceExtensionId']});}_0x3bc07a[_0xfa24('0x13')][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':_0xfa24('0x25')+_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')],'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0]['exten'],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});if(_0x3bc07a['extension']&&_0x3bc07a[_0xfa24('0x11')]['hasOwnProperty']('recordingFormat')&&_0x3bc07a[_0xfa24('0x11')][_0xfa24('0x26')]!=='none'){_0x3bc07a[_0xfa24('0x13')][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0]['type'],'app':_0xfa24('0x16'),'appdata':_0xfa24('0x27'),'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0]['exten'],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0]['VoiceExtensionId']});_0x3bc07a[_0xfa24('0x13')]['push']({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':_0xfa24('0x28')+_0x3bc07a['extension'][_0xfa24('0x26')]||_0xfa24('0x29'),'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0]['exten'],'priority':_0x3bc07a['priority']++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0]['VoiceExtensionId']});}}_0x3bc07a['extensions'][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':_0xfa24('0x2a'),'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0]['VoiceExtensionId']});_0x3bc07a[_0xfa24('0x13')][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});_0x3bc07a[_0xfa24('0x13')]['push']({'type':_0x265d1c[_0x52d536][0x0]['type'],'app':_0xfa24('0x16'),'appdata':_0xfa24('0x2b'),'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'priority':_0x3bc07a[_0xfa24('0x10')]++,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0]['VoiceExtensionId']});for(var _0x9355e9=0x0,_0xa38d16=0x0;_0x9355e9<_0x265d1c[_0x52d536]['length'];_0x9355e9+=0x1,_0xa38d16=0x0){var _0x3c2641=_0x265d1c[_0x52d536][_0x9355e9];if(_0x3c2641['type']){_0x3c2641[_0xfa24('0x15')]=_0x3c2641['type']['toLowerCase']();}var _0x299147=[];var _0x3b9a35=[];delete _0x3c2641['id'];delete _0x3c2641[_0xfa24('0x2c')];delete _0x3c2641[_0xfa24('0x2d')];var _0x582a2e=_0x3c2641['interval']!==_0xfa24('0x2e')?[_0x3c2641['interval']]:_0x3c2641[_0xfa24('0x2f')]?_[_0xfa24('0x9')](_['filter'](_0x3bc07a[_0xfa24('0x5')],{'IntervalId':_0x3c2641['IntervalId']}),_0xfa24('0x30')):[];if(_0x3c2641[_0xfa24('0xf')](_0xfa24('0x31'))){if(_0x3c2641[_0xfa24('0x31')]&&_0x3c2641[_0xfa24('0x31')]!=='--'){_0x299147[_0xfa24('0x14')]({'type':_0x3c2641['type'],'app':_0xfa24('0x16'),'appdata':_0xfa24('0x32')+_0x3c2641[_0xfa24('0x31')],'context':_0x3c2641[_0xfa24('0x1b')],'exten':_0x3c2641['exten'],'priority':_0x582a2e[_0xfa24('0x33')]+_0x3bc07a[_0xfa24('0x10')]+_0xa38d16++,'VoiceExtensionId':_0x3c2641['VoiceExtensionId']});}}if(_0x3c2641[_0xfa24('0x15')]==='outbound'&&_0x3c2641[_0xfa24('0xf')](_0xfa24('0x34'))){if(_0x3c2641[_0xfa24('0x34')]){_0x299147[_0xfa24('0x14')]({'type':_0x3c2641[_0xfa24('0x15')],'app':_0xfa24('0x21'),'appdata':_0xfa24('0x35')+_0x3c2641[_0xfa24('0x34')]+')','context':_0x3c2641[_0xfa24('0x1b')],'exten':_0x3c2641[_0xfa24('0xa')],'priority':_0x582a2e[_0xfa24('0x33')]+_0x3bc07a[_0xfa24('0x10')]+_0xa38d16++,'VoiceExtensionId':_0x3c2641['VoiceExtensionId']});}else{_0x299147['push']({'type':_0x3c2641[_0xfa24('0x15')],'app':_0xfa24('0x21'),'appdata':_0xfa24('0x36'),'context':_0x3c2641['context'],'exten':_0x3c2641[_0xfa24('0xa')],'priority':_0x582a2e[_0xfa24('0x33')]+_0x3bc07a[_0xfa24('0x10')]+_0xa38d16++,'VoiceExtensionId':_0x3c2641[_0xfa24('0x19')]});}}if(_0x3c2641[_0xfa24('0xf')](_0xfa24('0x37'))){if(_0x4898dd[_0xfa24('0x38')](_0x3c2641[_0xfa24('0x39')][_0xfa24('0x3a')]())>=0x0&&_0x3c2641[_0xfa24('0x3b')]!==_0xfa24('0x3c')){if(_0x3c2641[_0xfa24('0x37')]){_0x299147[_0xfa24('0x14')]({'type':_0x3c2641[_0xfa24('0x15')],'app':_0xfa24('0x21'),'appdata':_0xfa24('0x3d'),'context':_0x3c2641['context'],'exten':_0x3c2641[_0xfa24('0xa')],'priority':_0x582a2e[_0xfa24('0x33')]+_0x3bc07a[_0xfa24('0x10')]+_0xa38d16++,'VoiceExtensionId':_0x3c2641[_0xfa24('0x19')]});_0x299147[_0xfa24('0x14')]({'type':_0x3c2641[_0xfa24('0x15')],'app':'Set','appdata':_0xfa24('0x3e'),'context':_0x3c2641[_0xfa24('0x1b')],'exten':_0x3c2641[_0xfa24('0xa')],'priority':_0x582a2e['length']+_0x3bc07a['priority']+_0xa38d16++,'VoiceExtensionId':_0x3c2641[_0xfa24('0x19')]});}else{_0x299147[_0xfa24('0x14')]({'type':_0x3c2641[_0xfa24('0x15')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3c2641[_0xfa24('0x1b')],'exten':_0x3c2641[_0xfa24('0xa')],'priority':_0x582a2e[_0xfa24('0x33')]+_0x3bc07a['priority']+_0xa38d16++,'VoiceExtensionId':_0x3c2641[_0xfa24('0x19')]});_0x299147[_0xfa24('0x14')]({'type':_0x3c2641[_0xfa24('0x15')],'app':_0xfa24('0x16'),'appdata':_0xfa24('0x3f'),'context':_0x3c2641[_0xfa24('0x1b')],'exten':_0x3c2641[_0xfa24('0xa')],'priority':_0x582a2e[_0xfa24('0x33')]+_0x3bc07a[_0xfa24('0x10')]+_0xa38d16++,'VoiceExtensionId':_0x3c2641[_0xfa24('0x19')]});}}}for(var _0x3d3866=0x0;_0x3d3866<_0x582a2e[_0xfa24('0x33')];_0x3d3866+=0x1){var _0x530ba0=_0x3bc07a[_0xfa24('0x10')]+_0x582a2e['length'];var _0x504352=_0x3d3866===_0x582a2e[_0xfa24('0x33')]-0x1?_0x3bc07a[_0xfa24('0x10')]+_0x299147[_0xfa24('0x33')]+_0x3b9a35[_0xfa24('0x33')]+0x2:_0x3bc07a[_0xfa24('0x10')]+_0x3d3866+0x1;_0x299147[_0xfa24('0x40')](_0x3d3866,0x0,{'type':_0x3c2641[_0xfa24('0x15')],'app':_0xfa24('0x41'),'appdata':_0x582a2e[_0x3d3866]+'?'+_0x3c2641[_0xfa24('0x1b')]+_0xfa24('0x42')+_0x530ba0+':'+_0x3c2641[_0xfa24('0x1b')]+_0xfa24('0x42')+_0x504352,'exten':_0x3c2641[_0xfa24('0xa')],'context':_0x3c2641[_0xfa24('0x1b')],'priority':_0x3bc07a[_0xfa24('0x10')]+_0x3d3866,'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});}_0x3c2641[_0xfa24('0x10')]=_0x299147[_0xfa24('0x33')]?_[_0xfa24('0x43')](_0x299147)['priority']+0x1:_0x3bc07a[_0xfa24('0x10')];_0x3bc07a[_0xfa24('0x10')]=(_0x3b9a35['length']?_['last'](_0x3b9a35)['priority']:_0x3c2641[_0xfa24('0x10')])+0x1;_0x3bc07a[_0xfa24('0x13')]=_[_0xfa24('0x44')](_0x3bc07a['extensions'],_0x299147,[_0x3c2641],_0x3b9a35);}_0x3bc07a[_0xfa24('0x13')][_0xfa24('0x14')]({'type':_0x265d1c[_0x52d536][0x0][_0xfa24('0x15')],'app':_0xfa24('0x45'),'exten':_0x265d1c[_0x52d536][0x0][_0xfa24('0xa')],'context':_0x265d1c[_0x52d536][0x0][_0xfa24('0x1b')],'priority':_0x3bc07a[_0xfa24('0x10')],'VoiceExtensionId':_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]});_0x3d5522['push'](_0x265d1c[_0x52d536][0x0][_0xfa24('0x19')]);_0xe44d4e=_[_0xfa24('0x44')](_0xe44d4e,_0x3bc07a['extensions']);}}return _0x4cfd69['transaction'](function(_0x2faa16){return _0x4cfd69[_0xfa24('0x2')][_0xfa24('0x6')][_0xfa24('0x46')]({'where':{'VoiceExtensionId':{'$in':_0x3d5522}},'transaction':_0x2faa16})[_0xfa24('0x7')](function(_0x1598d9){return _0x4cfd69[_0xfa24('0x2')][_0xfa24('0x6')]['bulkCreate'](_[_0xfa24('0x47')](_0xe44d4e,'priority'),{'transaction':_0x2faa16});});});})[_0xfa24('0x48')](function(_0x584d06){console[_0xfa24('0x49')](_0x584d06);});}exports[_0xfa24('0x4a')]=rewrite; \ No newline at end of file +var _0x5e60=['context','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','Set','format','CDR(type)=%s','type'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x5e60,0x15e));var _0x05e6=function(_0x305b31,_0x248af7){_0x305b31=_0x305b31-0x0;var _0x328152=_0x5e60[_0x305b31];return _0x328152;};'use strict';var _=require(_0x05e6('0x0'));var util=require('util');function rewrite(_0x24306e,_0x40bca5){var _0x395efd=this;return _0x24306e[_0x05e6('0x1')][_0x05e6('0x2')][_0x05e6('0x3')]({'raw':!![]})[_0x05e6('0x4')](function(_0x121208){_0x395efd[_0x05e6('0x5')]=_0x121208;return _0x24306e[_0x05e6('0x1')][_0x05e6('0x6')][_0x05e6('0x3')]({'where':{'IntervalId':_0x40bca5[_0x05e6('0x7')]},'raw':!![]});})[_0x05e6('0x4')](function(_0x4dc8ee){return _0x24306e[_0x05e6('0x1')][_0x05e6('0x6')][_0x05e6('0x3')]({'where':{'exten':{'$in':_[_0x05e6('0x8')](_[_0x05e6('0x9')](_0x4dc8ee,_0x05e6('0xa')))}},'order':[{'raw':_0x05e6('0xb')}],'raw':!![]});})[_0x05e6('0x4')](function(_0x35dc9d){var _0x5d3ded=_[_0x05e6('0xc')](_0x35dc9d,{'priority':'1'});var _0x15420a=_[_0x05e6('0xc')](_0x35dc9d,{'isApp':0x1});var _0x25bdeb=_[_0x05e6('0xd')](_0x15420a,_0x05e6('0xa'));var _0x2d9c33=[_0x05e6('0xe'),_0x05e6('0xf')];var _0x3c3e82=[];var _0x5880b8=[];for(var _0x50dc64 in _0x25bdeb){if(_0x25bdeb[_0x05e6('0x10')](_0x50dc64)){_0x395efd['priority']=0x2;_0x395efd[_0x05e6('0x11')]=[];_0x395efd[_0x05e6('0x12')]=_[_0x05e6('0x13')](_0x5d3ded,{'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')]});_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0]['type'],'app':_0x05e6('0x15'),'appdata':util[_0x05e6('0x16')](_0x05e6('0x17'),_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')]),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0]['exten'],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});if(_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')]===_0x05e6('0x1c')){_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x1d')+_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')],'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd['priority']++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}else if(_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')]===_0x05e6('0x1e')){if(_0x395efd[_0x05e6('0x12')]){_0x395efd[_0x05e6('0x11')]['push']({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x1f')+(_0x395efd['extension'][_0x05e6('0x20')]?_0x05e6('0x21')+_0x395efd[_0x05e6('0x12')][_0x05e6('0x20')]+'}':_0x05e6('0x22')),'context':_0x25bdeb[_0x50dc64][0x0]['context'],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd['priority']++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}_0x395efd['extensions'][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':'CDR(routeid)='+_0x25bdeb[_0x50dc64][0x0]['VoiceExtensionId'],'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});var _0x377501=_0x395efd[_0x05e6('0x1a')]++;_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x23'),'appdata':_0x05e6('0x24')+(_0x377501+0x2)+_0x05e6('0x25')+(_0x377501+0x1)+')','context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x377501,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});if(_0x395efd[_0x05e6('0x12')]){_0x395efd[_0x05e6('0x11')]['push']({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':'Set','appdata':_0x395efd['extension'][_0x05e6('0x20')]?'CDR(prefix)=${EXTEN:0:'+_0x395efd[_0x05e6('0x12')]['cutdigits']+'}':_0x05e6('0x26'),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0]['exten'],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x27')+_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')],'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0]['exten'],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});if(_0x395efd[_0x05e6('0x12')]&&_0x395efd[_0x05e6('0x12')][_0x05e6('0x10')](_0x05e6('0x28'))&&_0x395efd[_0x05e6('0x12')][_0x05e6('0x28')]!==_0x05e6('0x29')){_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x2a'),'context':_0x25bdeb[_0x50dc64][0x0]['context'],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0]['VoiceExtensionId']});_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x2b')+_0x395efd[_0x05e6('0x12')]['recordingFormat']||_0x05e6('0x2c'),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0]['exten'],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}}_0x395efd['extensions']['push']({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd['priority']++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0]['VoiceExtensionId']});_0x395efd['extensions'][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':'Set','appdata':_0x05e6('0x2d'),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd['priority']++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0]['type'],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x2e'),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});for(var _0x269023=0x0,_0xd9d1bf=0x0;_0x269023<_0x25bdeb[_0x50dc64][_0x05e6('0x2f')];_0x269023+=0x1,_0xd9d1bf=0x0){var _0x1eeaa2=_0x25bdeb[_0x50dc64][_0x269023];if(_0x1eeaa2[_0x05e6('0x18')]){_0x1eeaa2[_0x05e6('0x18')]=_0x1eeaa2[_0x05e6('0x18')][_0x05e6('0x30')]();}var _0x20d0e3=[];var _0x352850=[];delete _0x1eeaa2['id'];delete _0x1eeaa2[_0x05e6('0x31')];delete _0x1eeaa2[_0x05e6('0x32')];var _0x30bb2b=_0x1eeaa2['interval']!==_0x05e6('0x33')?[_0x1eeaa2[_0x05e6('0x34')]]:_0x1eeaa2['IntervalId']?_[_0x05e6('0x9')](_[_0x05e6('0xc')](_0x395efd[_0x05e6('0x5')],{'IntervalId':_0x1eeaa2['IntervalId']}),_0x05e6('0x34')):[];if(_0x1eeaa2['hasOwnProperty'](_0x05e6('0x35'))){if(_0x1eeaa2[_0x05e6('0x35')]&&_0x1eeaa2['tag']!=='--'){_0x20d0e3[_0x05e6('0x14')]({'type':_0x1eeaa2[_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x36')+_0x1eeaa2[_0x05e6('0x35')],'context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b['length']+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});}}if(_0x1eeaa2['type']===_0x05e6('0x1e')&&_0x1eeaa2[_0x05e6('0x10')](_0x05e6('0x37'))){if(_0x1eeaa2[_0x05e6('0x37')]){_0x20d0e3['push']({'type':_0x1eeaa2[_0x05e6('0x18')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x1eeaa2[_0x05e6('0x37')]+')','context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});}else{_0x20d0e3[_0x05e6('0x14')]({'type':_0x1eeaa2[_0x05e6('0x18')],'app':_0x05e6('0x23'),'appdata':_0x05e6('0x38'),'context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});}}if(_0x1eeaa2['hasOwnProperty']('answer')){if(_0x2d9c33[_0x05e6('0x39')](_0x1eeaa2[_0x05e6('0x3a')]['toLowerCase']())>=0x0&&_0x1eeaa2['appType']!==_0x05e6('0x3b')){if(_0x1eeaa2[_0x05e6('0x3c')]){_0x20d0e3[_0x05e6('0x14')]({'type':_0x1eeaa2['type'],'app':_0x05e6('0x23'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2['VoiceExtensionId']});_0x20d0e3['push']({'type':_0x1eeaa2[_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x3d'),'context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b['length']+_0x395efd['priority']+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});}else{_0x20d0e3['push']({'type':_0x1eeaa2['type'],'app':'ExecIf','appdata':_0x05e6('0x3e'),'context':_0x1eeaa2['context'],'exten':_0x1eeaa2['exten'],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd['priority']+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});_0x20d0e3[_0x05e6('0x14')]({'type':_0x1eeaa2[_0x05e6('0x18')],'app':'Set','appdata':_0x05e6('0x3f'),'context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2['VoiceExtensionId']});}}}for(var _0x3b372a=0x0;_0x3b372a<_0x30bb2b[_0x05e6('0x2f')];_0x3b372a+=0x1){var _0x62543a=_0x395efd[_0x05e6('0x1a')]+_0x30bb2b['length'];var _0x44df12=_0x3b372a===_0x30bb2b[_0x05e6('0x2f')]-0x1?_0x395efd[_0x05e6('0x1a')]+_0x20d0e3[_0x05e6('0x2f')]+_0x352850['length']+0x2:_0x395efd[_0x05e6('0x1a')]+_0x3b372a+0x1;_0x20d0e3[_0x05e6('0x40')](_0x3b372a,0x0,{'type':_0x1eeaa2[_0x05e6('0x18')],'app':_0x05e6('0x41'),'appdata':_0x30bb2b[_0x3b372a]+'?'+_0x1eeaa2[_0x05e6('0x19')]+_0x05e6('0x42')+_0x62543a+':'+_0x1eeaa2[_0x05e6('0x19')]+',${EXTEN},'+_0x44df12,'exten':_0x1eeaa2[_0x05e6('0xa')],'context':_0x1eeaa2[_0x05e6('0x19')],'priority':_0x395efd[_0x05e6('0x1a')]+_0x3b372a,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}_0x1eeaa2['priority']=_0x20d0e3[_0x05e6('0x2f')]?_[_0x05e6('0x43')](_0x20d0e3)['priority']+0x1:_0x395efd[_0x05e6('0x1a')];_0x395efd[_0x05e6('0x1a')]=(_0x352850[_0x05e6('0x2f')]?_[_0x05e6('0x43')](_0x352850)['priority']:_0x1eeaa2[_0x05e6('0x1a')])+0x1;_0x395efd[_0x05e6('0x11')]=_[_0x05e6('0x44')](_0x395efd[_0x05e6('0x11')],_0x20d0e3,[_0x1eeaa2],_0x352850);}_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x45'),'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'priority':_0x395efd[_0x05e6('0x1a')],'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0]['VoiceExtensionId']});_0x3c3e82[_0x05e6('0x14')](_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]);_0x5880b8=_['concat'](_0x5880b8,_0x395efd[_0x05e6('0x11')]);}}return _0x24306e['transaction'](function(_0x4d693a){return _0x24306e['models'][_0x05e6('0x6')][_0x05e6('0x46')]({'where':{'VoiceExtensionId':{'$in':_0x3c3e82}},'transaction':_0x4d693a})[_0x05e6('0x4')](function(_0x581a6a){return _0x24306e[_0x05e6('0x1')][_0x05e6('0x6')][_0x05e6('0x47')](_[_0x05e6('0x48')](_0x5880b8,_0x05e6('0x1a')),{'transaction':_0x4d693a});});});})[_0x05e6('0x49')](function(_0x4e225b){console[_0x05e6('0x4a')](_0x4e225b);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 4b12127..67ac588 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 _0xf682=['firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','push','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parse\x20error','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','join','hasOwnProperty','data'];(function(_0x251698,_0x287c70){var _0x19901f=function(_0x53ef18){while(--_0x53ef18){_0x251698['push'](_0x251698['shift']());}};_0x19901f(++_0x287c70);}(_0xf682,0x198));var _0x2f68=function(_0x59a229,_0x24f866){_0x59a229=_0x59a229-0x0;var _0x3eadcc=_0xf682[_0x59a229];return _0x3eadcc;};'use strict';var BPromise=require(_0x2f68('0x0'));var util=require(_0x2f68('0x1'));var _=require(_0x2f68('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x2f68('0x3'));var Redis=require(_0x2f68('0x4'));var db=require(_0x2f68('0x5'))['db'];var config=require(_0x2f68('0x6'));var logger=require(_0x2f68('0x7'))(_0x2f68('0x8'));config[_0x2f68('0x9')]=_[_0x2f68('0xa')](config[_0x2f68('0x9')],{'host':_0x2f68('0xb'),'port':0x18eb});var socket=require(_0x2f68('0xc'))(new Redis(config[_0x2f68('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0x2f68('0xd')](socket);try{if(!process[_0x2f68('0xe')][0x2]||process[_0x2f68('0xe')][0x2]===_0x2f68('0xf')||process[_0x2f68('0xe')][0x2]===_0x2f68('0x10')){throw new Error(_0x2f68('0x11'));}var FILEPATH=process[_0x2f68('0xe')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x2f68('0xf')||process['argv'][0x3]===_0x2f68('0x10')||!process[_0x2f68('0xe')][0x4]||process[_0x2f68('0xe')][0x4]==='undefined'||process[_0x2f68('0xe')][0x4]==='null'){throw new Error(_0x2f68('0x12'));}var FIELDS=_[_0x2f68('0x13')](process['argv'][0x3][_0x2f68('0x14')](','),process['argv'][0x4][_0x2f68('0x14')](','));if(!process[_0x2f68('0xe')][0x5]||process[_0x2f68('0xe')][0x5]===_0x2f68('0xf')||process['argv'][0x5]==='null'){throw new Error(_0x2f68('0x15'));}var LISTID=process[_0x2f68('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x2f68('0xe')][0x6]!==_0x2f68('0xf')&&process[_0x2f68('0xe')][0x6]!=='null'?process[_0x2f68('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x2f68('0xf')&&process[_0x2f68('0xe')][0x7]!==_0x2f68('0x10')?process[_0x2f68('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0x2f68('0xe')][0x8]==='undefined'||process['argv'][0x8]===_0x2f68('0x10')){throw new Error(_0x2f68('0x16'));}var SOCKET_TIMESTAMP=process[_0x2f68('0xe')][0x8];}catch(_0x319f2a){logger[_0x2f68('0x17')](_0x319f2a);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(_0x41128d,_0x470cee,_0x1250b0,_0x4d19e6){var _0x1a847={'message':_0x470cee};_0x1a847[_0x41128d]=!![];if(_0x1250b0){_0x1a847[_0x2f68('0x18')]=_0x1250b0;}if(_0x4d19e6){_0x1a847[_0x2f68('0x19')]=_0x4d19e6;}return _0x1a847;}function isEmail(_0x127140){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x127140);}function checkRow(_0x1a80bc,_0x579c63,_0x501511){return new BPromise(function(_0x5c44b4,_0x2202bd){if(_[_0x2f68('0x1a')](_0x1a80bc)){return _0x2202bd(handleCheckRowError(_0x2f68('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x501511));}if(_0x1a80bc[_0x2f68('0x1b')]&&_0x1a80bc[_0x2f68('0x1b')][_0x2f68('0x1c')]){var _0xdc95f2=_['map'](_0x1a80bc[_0x2f68('0x1b')],'message')[_0x2f68('0x1d')](';');return _0x2202bd(handleCheckRowError(_0x2f68('0x17'),_0xdc95f2,null,_0x501511));}var _0x5a3a7c={};for(var _0x15b403 in FIELDS){if(FIELDS[_0x2f68('0x1e')](_0x15b403)&&FIELDS[_0x15b403]){_0x5a3a7c[_0x15b403]=_0x1a80bc[_0x2f68('0x1f')][0x0][FIELDS[_0x15b403]]||_0x1a80bc[_0x2f68('0x1f')][0x0]['\ufeff'+FIELDS[_0x15b403]];}}if(!_0x5a3a7c[_0x2f68('0x20')]){return _0x2202bd(handleCheckRowError(_0x2f68('0x17'),_0x2f68('0x21'),null,_0x501511));}if(!_0x5a3a7c[_0x2f68('0x22')]){return _0x2202bd(handleCheckRowError('error',_0x2f68('0x23'),null,_0x501511));}if(_0x5a3a7c[_0x2f68('0x24')]){var _0x134eee=moment(_0x5a3a7c[_0x2f68('0x24')],'YYYY-MM-DD');if(!_0x134eee[_0x2f68('0x25')]()){return _0x2202bd(handleCheckRowError('error',_0x2f68('0x26'),null,_0x501511));}}if(_0x5a3a7c['email']){if(!isEmail(_0x5a3a7c[_0x2f68('0x27')])){return _0x2202bd(handleCheckRowError(_0x2f68('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x501511));}}_0x5a3a7c[_0x2f68('0x28')]=LISTID;_0x5a3a7c[_0x2f68('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x2f68('0x1c')]&&_0x579c63){var _0xf30ffe={};for(var _0x3f4ea6=0x0,_0x5c1713=DUPLICATES['length'];_0x3f4ea6<_0x5c1713;_0x3f4ea6+=0x1){_0xf30ffe[DUPLICATES[_0x3f4ea6]]=_0x5a3a7c[DUPLICATES[_0x3f4ea6]];}var _0x275b58=_['find'](_0x579c63,_0xf30ffe);if(_0x275b58){return _0x2202bd(handleCheckRowError(_0x2f68('0x2a'),_0x2f68('0x2b'),_0x275b58,_0x501511));}}return db[_0x2f68('0x2c')]['create'](_0x5a3a7c,{'raw':!![],'hooks':![],'fields':_[_0x2f68('0x2d')](_0x5a3a7c)})['then'](function(_0x1c4ca0){if(DUPLICATES&&DUPLICATES['length']&&_0x579c63){_0x579c63[_0x2f68('0x2e')](_[_0x2f68('0x2f')](_0x5a3a7c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1c4ca0['id'];return _0x5c44b4();})['catch'](function(_0x45d592){return _0x2202bd(handleCheckRowError(_0x2f68('0x17'),_0x2f68('0x30')+(_0x45d592[_0x2f68('0x31')]||JSON[_0x2f68('0x32')](_0x45d592)),null,_0x501511));});});}function checkHopper(){function _0x415651(){return function(_0xea3e84){logger[_0x2f68('0x17')]('cmContact',_0x2f68('0x33'),util['inspect'](_0xea3e84,{'showHidden':![],'depth':null}));};}var _0x9b5b09=function(_0x3c3936,_0x3b7dfa){var _0x333892=squel[_0x2f68('0x34')]()[_0x2f68('0x35')](_0x2f68('0x36'))[_0x2f68('0x37')]([_0x2f68('0x22'),_0x2f68('0x38'),_0x2f68('0x39'),_0x2f68('0x28'),_0x3b7dfa,_0x2f68('0x3a'),_0x2f68('0x3b')],squel[_0x2f68('0x3c')]()[_0x2f68('0x3d')](_0x2f68('0x22'),_0x2f68('0x22'))[_0x2f68('0x3d')](_0x2f68('0x3e'),_0x2f68('0x38'))['field']('id',_0x2f68('0x39'))['field'](LISTID[_0x2f68('0x3f')](),_0x2f68('0x28'))[_0x2f68('0x3d')](_0x3c3936['id'][_0x2f68('0x3f')](),_0x3b7dfa)[_0x2f68('0x3d')](_0x2f68('0x3e'),'createdAt')[_0x2f68('0x3d')](_0x2f68('0x3e'),_0x2f68('0x3b'))[_0x2f68('0x40')](_0x2f68('0x41'))[_0x2f68('0x42')](_0x2f68('0x43'))[_0x2f68('0x42')](_0x2f68('0x44'),LISTID['toString']())[_0x2f68('0x42')](_0x2f68('0x45'))[_0x2f68('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2f68('0x3c')]()[_0x2f68('0x3d')]('phone')[_0x2f68('0x40')](_0x2f68('0x36'))['where'](_0x3b7dfa+_0x2f68('0x46'),_0x3c3936['id']['toString']())))[_0x2f68('0x3f')]();return _0x333892;};var _0x4dc863=function(_0x1f5a1d,_0x3a0cba){var _0x1eaa1d=squel[_0x2f68('0x34')]()[_0x2f68('0x35')](_0x2f68('0x36'))[_0x2f68('0x37')]([_0x2f68('0x22'),_0x2f68('0x38'),_0x2f68('0x39'),_0x2f68('0x28'),_0x3a0cba,_0x2f68('0x3a'),_0x2f68('0x3b')],squel[_0x2f68('0x3c')]()[_0x2f68('0x3d')](_0x2f68('0x22'),_0x2f68('0x22'))['field'](_0x2f68('0x3e'),'scheduledAt')[_0x2f68('0x3d')]('id','ContactId')['field'](LISTID[_0x2f68('0x3f')](),_0x2f68('0x28'))[_0x2f68('0x3d')](_0x1f5a1d['id']['toString'](),_0x3a0cba)[_0x2f68('0x3d')]('NOW()',_0x2f68('0x3a'))['field'](_0x2f68('0x3e'),_0x2f68('0x3b'))[_0x2f68('0x40')](_0x2f68('0x41'))[_0x2f68('0x42')](_0x2f68('0x43'))[_0x2f68('0x42')](_0x2f68('0x44'),LISTID[_0x2f68('0x3f')]())[_0x2f68('0x42')]('id\x20IN\x20?',squel[_0x2f68('0x47')](hopperContacts))[_0x2f68('0x42')](_0x2f68('0x45'))[_0x2f68('0x42')](_0x2f68('0x48'),squel[_0x2f68('0x3c')]()['field'](_0x2f68('0x49'))[_0x2f68('0x40')](_0x2f68('0x4a'))[_0x2f68('0x42')](_0x3a0cba+_0x2f68('0x46'),_0x1f5a1d['id']['toString']()))['where'](_0x2f68('0x48'),squel[_0x2f68('0x3c')]()[_0x2f68('0x3d')](_0x2f68('0x22'))[_0x2f68('0x40')](_0x2f68('0x36'))[_0x2f68('0x42')](_0x3a0cba+_0x2f68('0x46'),_0x1f5a1d['id']['toString']())))[_0x2f68('0x3f')]();return _0x1eaa1d;};function _0x15ef55(_0x584de6,_0x1d0110){var _0x414bb2=squel[_0x2f68('0x34')]()[_0x2f68('0x35')](_0x2f68('0x36'))[_0x2f68('0x37')](['phone',_0x2f68('0x38'),_0x2f68('0x39'),_0x2f68('0x28'),_0x1d0110,'createdAt','updatedAt'],squel['select']()[_0x2f68('0x3d')](_0x2f68('0x22'),_0x2f68('0x22'))[_0x2f68('0x3d')]('NOW()',_0x2f68('0x38'))[_0x2f68('0x3d')]('id',_0x2f68('0x39'))['field'](LISTID[_0x2f68('0x3f')](),_0x2f68('0x28'))[_0x2f68('0x3d')](_0x584de6['id'][_0x2f68('0x3f')](),_0x1d0110)[_0x2f68('0x3d')](_0x2f68('0x3e'),_0x2f68('0x3a'))[_0x2f68('0x3d')](_0x2f68('0x3e'),'updatedAt')[_0x2f68('0x40')](_0x2f68('0x41'))[_0x2f68('0x42')](_0x2f68('0x43'))[_0x2f68('0x42')](_0x2f68('0x44'),LISTID['toString']())[_0x2f68('0x42')](_0x2f68('0x4b'),squel[_0x2f68('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x2f68('0x3f')]();return _0x414bb2;}function _0x52e43e(_0x5ae582,_0x133228){var _0x484513=squel[_0x2f68('0x34')]()['into'](_0x2f68('0x4c'))[_0x2f68('0x37')]([_0x2f68('0x22'),_0x2f68('0x39'),_0x2f68('0x28'),_0x133228,_0x2f68('0x3a'),_0x2f68('0x3b')],squel[_0x2f68('0x3c')]()[_0x2f68('0x3d')](_0x2f68('0x22'),_0x2f68('0x22'))[_0x2f68('0x3d')]('id',_0x2f68('0x39'))[_0x2f68('0x3d')](LISTID['toString'](),_0x2f68('0x28'))[_0x2f68('0x3d')](_0x5ae582['id'][_0x2f68('0x3f')](),_0x133228)[_0x2f68('0x3d')](_0x2f68('0x3e'),_0x2f68('0x3a'))[_0x2f68('0x3d')](_0x2f68('0x3e'),_0x2f68('0x3b'))[_0x2f68('0x40')](_0x2f68('0x41'))[_0x2f68('0x42')](_0x2f68('0x43'))['where']('ListId\x20=\x20?',LISTID[_0x2f68('0x3f')]())[_0x2f68('0x42')]('id\x20IN\x20?',squel[_0x2f68('0x47')](hopperContacts))[_0x2f68('0x42')](_0x2f68('0x45')))[_0x2f68('0x3f')]();return _0x484513;}return db[_0x2f68('0x4d')][_0x2f68('0x4e')]({'where':{'type':_0x2f68('0x4f')},'attributes':['id',_0x2f68('0x50')],'include':[{'model':db[_0x2f68('0x51')],'as':_0x2f68('0x52'),'where':{'id':LISTID}}]})[_0x2f68('0x53')](function(_0xff1a4e){var _0x4f088c=[];if(_0xff1a4e){var _0x1abc30;for(var _0x534179=0x0,_0x13c829;_0x534179<_0xff1a4e[_0x2f68('0x1c')];_0x534179+=0x1){_0x13c829=_0xff1a4e[_0x534179][_0x2f68('0x54')]({'plain':!![]});switch(_0x13c829[_0x2f68('0x50')]){case _0x2f68('0x55'):_0x4f088c['push'](db[_0x2f68('0x56')][_0x2f68('0x57')](_0x4dc863(_0x13c829,_0x2f68('0x58')))[_0x2f68('0x53')](function(){})['catch'](_0x415651()));break;case _0x2f68('0x59'):_0x4f088c['push'](db['sequelize'][_0x2f68('0x57')](_0x9b5b09(_0x13c829,_0x2f68('0x58')))[_0x2f68('0x53')](function(){})[_0x2f68('0x5a')](_0x415651()));break;default:_0x4f088c['push'](db['sequelize']['query'](_0x15ef55(_0x13c829,_0x2f68('0x58')))['then'](function(){})['catch'](_0x415651()));}}}return _0x4f088c;})[_0x2f68('0x5b')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x2f68('0x4f')},'attributes':['id'],'include':[{'model':db[_0x2f68('0x51')],'as':_0x2f68('0x5c'),'where':{'id':LISTID}}]})[_0x2f68('0x53')](function(_0x24164f){var _0x1022b1=[];if(_0x24164f){var _0x864515;for(var _0x165d4a=0x0,_0x28011c;_0x165d4a<_0x24164f[_0x2f68('0x1c')];_0x165d4a+=0x1){_0x28011c=_0x24164f[_0x165d4a][_0x2f68('0x54')]({'plain':!![]});_0x1022b1[_0x2f68('0x2e')](db['sequelize']['query'](_0x52e43e(_0x28011c,_0x2f68('0x58')))[_0x2f68('0x53')](function(){})[_0x2f68('0x5a')](_0x415651()));}}return _0x1022b1;})['all']();})[_0x2f68('0x53')](function(){return db['Campaign'][_0x2f68('0x4e')]({'attributes':['id',_0x2f68('0x50')],'include':[{'model':db[_0x2f68('0x51')],'as':_0x2f68('0x52'),'where':{'id':LISTID}}]})[_0x2f68('0x53')](function(_0x893533){var _0x2649ca=[];if(_0x893533){for(var _0x3bb56e=0x0,_0x5e3725;_0x3bb56e<_0x893533['length'];_0x3bb56e+=0x1){_0x5e3725=_0x893533[_0x3bb56e][_0x2f68('0x54')]({'plain':!![]});switch(_0x5e3725['dialCheckDuplicateType']){case _0x2f68('0x55'):_0x2649ca[_0x2f68('0x2e')](db[_0x2f68('0x56')][_0x2f68('0x57')](_0x4dc863(_0x5e3725,'CampaignId'))['then'](function(){})[_0x2f68('0x5a')](_0x415651()));break;case _0x2f68('0x59'):_0x2649ca[_0x2f68('0x2e')](db[_0x2f68('0x56')]['query'](_0x9b5b09(_0x5e3725,_0x2f68('0x5d')))['then'](function(){})[_0x2f68('0x5a')](_0x415651()));break;default:_0x2649ca[_0x2f68('0x2e')](db[_0x2f68('0x56')][_0x2f68('0x57')](_0x15ef55(_0x5e3725,_0x2f68('0x5d')))[_0x2f68('0x53')](function(){})[_0x2f68('0x5a')](_0x415651()));}}}return _0x2649ca;})['all']();})[_0x2f68('0x53')](function(){return db['Campaign'][_0x2f68('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x2f68('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x2f68('0x53')](function(_0x29fb99){var _0x3283b8=[];if(_0x29fb99){for(var _0x3e02ac=0x0,_0x4a9720;_0x3e02ac<_0x29fb99[_0x2f68('0x1c')];_0x3e02ac+=0x1){_0x4a9720=_0x29fb99[_0x3e02ac][_0x2f68('0x54')]({'plain':!![]});_0x3283b8[_0x2f68('0x2e')](db[_0x2f68('0x56')]['query'](_0x52e43e(_0x4a9720,'CampaignId'))[_0x2f68('0x53')](function(){})['catch'](_0x415651()));}}return _0x3283b8;})[_0x2f68('0x5b')]();})[_0x2f68('0x5a')](function(_0x58a5a4){logger['error'](_0x2f68('0x5e'),_0x2f68('0x5f'),_0x58a5a4[_0x2f68('0x31')]);});}var processPromises=function(_0x233a2a){return BPromise['all'](promises)[_0x2f68('0x53')](function(_0x2be674){})[_0x2f68('0x5a')](function(_0x130405){logger[_0x2f68('0x17')](_0x2f68('0x60'),JSON[_0x2f68('0x32')](_0x130405));})[_0x2f68('0x61')](function(){socket[_0x2f68('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x233a2a){return _0x233a2a[_0x2f68('0x63')]();}});};var endCsv=function(){return BPromise[_0x2f68('0x64')]()[_0x2f68('0x53')](function(){if(hopperContacts){return checkHopper();}})[_0x2f68('0x53')](function(){socket[_0x2f68('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2f68('0x65')](FILEPATH);}catch(_0x5b9488){logger['error'](_0x2f68('0x66'),JSON[_0x2f68('0x32')](_0x5b9488));}finally{process[_0x2f68('0x67')](0x0);}});};process['on'](_0x2f68('0x68'),function(){logger['info'](_0x2f68('0x69'));endCsv();});function main(){return BPromise[_0x2f68('0x64')]()[_0x2f68('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2f68('0x14')](',');return db['CmContact'][_0x2f68('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x2f68('0x53')](function(_0x570c3b){var _0x3c02df=fs[_0x2f68('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x2f68('0x6b')](_0x3c02df,{'header':!![],'skipEmptyLines':!![],'step':function(_0x572904,_0x55f138){total+=0x1;var _0x1cb654=total;promises[_0x2f68('0x2e')](checkRow(_0x572904,_0x570c3b,_0x1cb654)[_0x2f68('0x53')](function(){success+=0x1;})[_0x2f68('0x5a')](function(_0x1450ab){if(_0x1450ab[_0x2f68('0x17')]){errors+=0x1;delete _0x1450ab['error'];}else if(_0x1450ab[_0x2f68('0x2a')]){duplicates+=0x1;delete _0x1450ab[_0x2f68('0x2a')];}rows[_0x2f68('0x2e')](_0x1450ab);}));if(total%0xc8===0x0){_0x55f138[_0x2f68('0x6c')]();return processPromises(_0x55f138);}},'complete':function(){return processPromises()[_0x2f68('0x53')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4dded8,_0x33b0a4){logger['info'](_0x2f68('0x6d'),JSON[_0x2f68('0x32')](_0x4dded8));endCsv();}});})['catch'](function(_0x2a4aad){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x2a4aad));});}main(); \ No newline at end of file +var _0x61ad=['stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','push','query','VoiceQueueId','then','onlyIfOpen','sequelize','all','get','always','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','exit','info','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','lodash','squel','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','isNil','errors','length','map','hasOwnProperty','data','firstName','error','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','pick','catch','Error\x20while\x20creating\x20contact:\x20','message'];(function(_0x14f0e1,_0x68d4ff){var _0x1f40c9=function(_0x42d60c){while(--_0x42d60c){_0x14f0e1['push'](_0x14f0e1['shift']());}};_0x1f40c9(++_0x68d4ff);}(_0x61ad,0x1da));var _0xd61a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61ad[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xd61a('0x0'));var fs=require('fs');var squel=require(_0xd61a('0x1'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xd61a('0x2'));config[_0xd61a('0x3')]=_[_0xd61a('0x4')](config['redis'],{'host':_0xd61a('0x5'),'port':0x18eb});var socket=require(_0xd61a('0x6'))(new Redis(config['redis']));require(_0xd61a('0x7'))[_0xd61a('0x8')](socket);try{if(!process[_0xd61a('0x9')][0x2]||process[_0xd61a('0x9')][0x2]==='undefined'||process['argv'][0x2]==='null'){throw new Error(_0xd61a('0xa'));}var FILEPATH=process[_0xd61a('0x9')][0x2];if(!process[_0xd61a('0x9')][0x3]||process[_0xd61a('0x9')][0x3]===_0xd61a('0xb')||process[_0xd61a('0x9')][0x3]===_0xd61a('0xc')||!process['argv'][0x4]||process['argv'][0x4]===_0xd61a('0xb')||process[_0xd61a('0x9')][0x4]===_0xd61a('0xc')){throw new Error(_0xd61a('0xd'));}var FIELDS=_[_0xd61a('0xe')](process['argv'][0x3][_0xd61a('0xf')](','),process[_0xd61a('0x9')][0x4]['split'](','));if(!process[_0xd61a('0x9')][0x5]||process['argv'][0x5]===_0xd61a('0xb')||process[_0xd61a('0x9')][0x5]===_0xd61a('0xc')){throw new Error(_0xd61a('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xd61a('0x9')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xd61a('0x9')][0x7]!==_0xd61a('0xb')&&process[_0xd61a('0x9')][0x7]!==_0xd61a('0xc')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xd61a('0x9')][0x8]===_0xd61a('0xb')||process[_0xd61a('0x9')][0x8]===_0xd61a('0xc')){throw new Error(_0xd61a('0x11'));}var SOCKET_TIMESTAMP=process[_0xd61a('0x9')][0x8];}catch(_0x4bb9d9){logger['error'](_0x4bb9d9);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(_0x4202ed,_0x28fefa,_0x5e68ad,_0x2a6c26){var _0x1d3c84={'message':_0x28fefa};_0x1d3c84[_0x4202ed]=!![];if(_0x5e68ad){_0x1d3c84[_0xd61a('0x12')]=_0x5e68ad;}if(_0x2a6c26){_0x1d3c84[_0xd61a('0x13')]=_0x2a6c26;}return _0x1d3c84;}function isEmail(_0x180d3b){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x180d3b);}function checkRow(_0x10c3b7,_0x43340b,_0x3b3ea4){return new BPromise(function(_0x25e6a3,_0x1ffcb4){if(_[_0xd61a('0x14')](_0x10c3b7)){return _0x1ffcb4(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b3ea4));}if(_0x10c3b7[_0xd61a('0x15')]&&_0x10c3b7['errors'][_0xd61a('0x16')]){var _0x29836e=_[_0xd61a('0x17')](_0x10c3b7[_0xd61a('0x15')],'message')['join'](';');return _0x1ffcb4(handleCheckRowError('error',_0x29836e,null,_0x3b3ea4));}var _0x95f979={};for(var _0x1a3c14 in FIELDS){if(FIELDS[_0xd61a('0x18')](_0x1a3c14)&&FIELDS[_0x1a3c14]){_0x95f979[_0x1a3c14]=_0x10c3b7[_0xd61a('0x19')][0x0][FIELDS[_0x1a3c14]]||_0x10c3b7[_0xd61a('0x19')][0x0]['\ufeff'+FIELDS[_0x1a3c14]];}}if(!_0x95f979[_0xd61a('0x1a')]){return _0x1ffcb4(handleCheckRowError(_0xd61a('0x1b'),_0xd61a('0x1c'),null,_0x3b3ea4));}if(!_0x95f979[_0xd61a('0x1d')]){return _0x1ffcb4(handleCheckRowError('error',_0xd61a('0x1e'),null,_0x3b3ea4));}if(_0x95f979[_0xd61a('0x1f')]){var _0x2e1157=moment(_0x95f979[_0xd61a('0x1f')],_0xd61a('0x20'));if(!_0x2e1157['isValid']()){return _0x1ffcb4(handleCheckRowError('error',_0xd61a('0x21'),null,_0x3b3ea4));}}if(_0x95f979[_0xd61a('0x22')]){if(!isEmail(_0x95f979[_0xd61a('0x22')])){return _0x1ffcb4(handleCheckRowError(_0xd61a('0x1b'),_0xd61a('0x23'),null,_0x3b3ea4));}}_0x95f979[_0xd61a('0x24')]=LISTID;_0x95f979[_0xd61a('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xd61a('0x16')]&&_0x43340b){var _0x50b97c={};for(var _0x4d2ee1=0x0,_0x433e65=DUPLICATES[_0xd61a('0x16')];_0x4d2ee1<_0x433e65;_0x4d2ee1+=0x1){_0x50b97c[DUPLICATES[_0x4d2ee1]]=_0x95f979[DUPLICATES[_0x4d2ee1]];}var _0x5f2516=_['find'](_0x43340b,_0x50b97c);if(_0x5f2516){return _0x1ffcb4(handleCheckRowError(_0xd61a('0x26'),_0xd61a('0x27'),_0x5f2516,_0x3b3ea4));}}return db[_0xd61a('0x28')][_0xd61a('0x29')](_0x95f979,{'raw':!![],'hooks':![],'fields':_['keys'](_0x95f979)})['then'](function(_0x161886){if(DUPLICATES&&DUPLICATES[_0xd61a('0x16')]&&_0x43340b){_0x43340b['push'](_[_0xd61a('0x2a')](_0x95f979,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x161886['id'];return _0x25e6a3();})[_0xd61a('0x2b')](function(_0x239be9){return _0x1ffcb4(handleCheckRowError(_0xd61a('0x1b'),_0xd61a('0x2c')+(_0x239be9[_0xd61a('0x2d')]||JSON[_0xd61a('0x2e')](_0x239be9)),null,_0x3b3ea4));});});}function checkHopper(){function _0x5b4aae(){return function(_0x5d64ae){logger[_0xd61a('0x1b')](_0xd61a('0x2f'),_0xd61a('0x30'),util['inspect'](_0x5d64ae,{'showHidden':![],'depth':null}));};}var _0x1aebe7=function(_0x211f29,_0x3aa1fd){var _0x2d5669=squel[_0xd61a('0x31')]()[_0xd61a('0x32')](_0xd61a('0x33'))[_0xd61a('0x34')]([_0xd61a('0x1d'),_0xd61a('0x35'),'ContactId',_0xd61a('0x24'),_0x3aa1fd,_0xd61a('0x36'),_0xd61a('0x37')],squel[_0xd61a('0x38')]()[_0xd61a('0x39')](_0xd61a('0x1d'),_0xd61a('0x1d'))['field'](_0xd61a('0x3a'),'scheduledAt')['field']('id',_0xd61a('0x3b'))[_0xd61a('0x39')](LISTID[_0xd61a('0x3c')](),_0xd61a('0x24'))[_0xd61a('0x39')](_0x211f29['id'][_0xd61a('0x3c')](),_0x3aa1fd)[_0xd61a('0x39')]('NOW()',_0xd61a('0x36'))[_0xd61a('0x39')](_0xd61a('0x3a'),'updatedAt')[_0xd61a('0x3d')](_0xd61a('0x3e'))[_0xd61a('0x3f')](_0xd61a('0x40'))[_0xd61a('0x3f')]('ListId\x20=\x20?',LISTID[_0xd61a('0x3c')]())[_0xd61a('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xd61a('0x41'),squel[_0xd61a('0x38')]()['field'](_0xd61a('0x1d'))[_0xd61a('0x3d')]('cm_hopper')[_0xd61a('0x3f')](_0x3aa1fd+_0xd61a('0x42'),_0x211f29['id'][_0xd61a('0x3c')]())))[_0xd61a('0x3c')]();return _0x2d5669;};var _0x15cfc3=function(_0x54ae32,_0x52a379){var _0x3a6d21=squel['insert']()[_0xd61a('0x32')]('cm_hopper')[_0xd61a('0x34')]([_0xd61a('0x1d'),_0xd61a('0x35'),_0xd61a('0x3b'),_0xd61a('0x24'),_0x52a379,_0xd61a('0x36'),_0xd61a('0x37')],squel[_0xd61a('0x38')]()[_0xd61a('0x39')](_0xd61a('0x1d'),_0xd61a('0x1d'))[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x35'))['field']('id','ContactId')[_0xd61a('0x39')](LISTID[_0xd61a('0x3c')](),_0xd61a('0x24'))['field'](_0x54ae32['id'][_0xd61a('0x3c')](),_0x52a379)[_0xd61a('0x39')](_0xd61a('0x3a'),'createdAt')['field']('NOW()',_0xd61a('0x37'))[_0xd61a('0x3d')](_0xd61a('0x3e'))[_0xd61a('0x3f')](_0xd61a('0x40'))['where'](_0xd61a('0x43'),LISTID['toString']())[_0xd61a('0x3f')](_0xd61a('0x44'),squel[_0xd61a('0x45')](hopperContacts))[_0xd61a('0x3f')](_0xd61a('0x46'))[_0xd61a('0x3f')](_0xd61a('0x41'),squel['select']()['field'](_0xd61a('0x47'))[_0xd61a('0x3d')](_0xd61a('0x48'))[_0xd61a('0x3f')](_0x52a379+'\x20=\x20?',_0x54ae32['id'][_0xd61a('0x3c')]()))[_0xd61a('0x3f')](_0xd61a('0x41'),squel['select']()[_0xd61a('0x39')](_0xd61a('0x1d'))[_0xd61a('0x3d')](_0xd61a('0x33'))[_0xd61a('0x3f')](_0x52a379+_0xd61a('0x42'),_0x54ae32['id'][_0xd61a('0x3c')]())))[_0xd61a('0x3c')]();return _0x3a6d21;};function _0x1526b1(_0x222107,_0x4df148){var _0x37a7c2=squel['insert']()[_0xd61a('0x32')](_0xd61a('0x33'))[_0xd61a('0x34')]([_0xd61a('0x1d'),_0xd61a('0x35'),_0xd61a('0x3b'),_0xd61a('0x24'),_0x4df148,_0xd61a('0x36'),'updatedAt'],squel[_0xd61a('0x38')]()[_0xd61a('0x39')]('phone',_0xd61a('0x1d'))[_0xd61a('0x39')](_0xd61a('0x3a'),'scheduledAt')['field']('id',_0xd61a('0x3b'))[_0xd61a('0x39')](LISTID[_0xd61a('0x3c')](),'ListId')['field'](_0x222107['id']['toString'](),_0x4df148)[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x36'))[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x37'))['from'](_0xd61a('0x3e'))['where'](_0xd61a('0x40'))[_0xd61a('0x3f')](_0xd61a('0x43'),LISTID['toString']())['where'](_0xd61a('0x44'),squel[_0xd61a('0x45')](hopperContacts))[_0xd61a('0x3f')](_0xd61a('0x46')))[_0xd61a('0x3c')]();return _0x37a7c2;}function _0xfcf6e6(_0x3b81a3,_0x3088b5){var _0x3dbcfb=squel[_0xd61a('0x31')]()[_0xd61a('0x32')](_0xd61a('0x49'))[_0xd61a('0x34')]([_0xd61a('0x1d'),_0xd61a('0x3b'),_0xd61a('0x24'),_0x3088b5,'createdAt','updatedAt'],squel[_0xd61a('0x38')]()[_0xd61a('0x39')]('phone',_0xd61a('0x1d'))[_0xd61a('0x39')]('id',_0xd61a('0x3b'))[_0xd61a('0x39')](LISTID[_0xd61a('0x3c')](),_0xd61a('0x24'))[_0xd61a('0x39')](_0x3b81a3['id']['toString'](),_0x3088b5)[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x36'))[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x37'))['from']('cm_contacts')[_0xd61a('0x3f')](_0xd61a('0x40'))[_0xd61a('0x3f')](_0xd61a('0x43'),LISTID['toString']())[_0xd61a('0x3f')](_0xd61a('0x44'),squel['str'](hopperContacts))[_0xd61a('0x3f')](_0xd61a('0x46')))[_0xd61a('0x3c')]();return _0x3dbcfb;}return db[_0xd61a('0x4a')][_0xd61a('0x4b')]({'where':{'type':_0xd61a('0x4c')},'attributes':['id',_0xd61a('0x4d')],'include':[{'model':db[_0xd61a('0x4e')],'as':_0xd61a('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x27ff9a){var _0x1b1430=[];if(_0x27ff9a){var _0x44abdf;for(var _0x680f32=0x0,_0x4e5d75;_0x680f32<_0x27ff9a['length'];_0x680f32+=0x1){_0x4e5d75=_0x27ff9a[_0x680f32]['get']({'plain':!![]});switch(_0x4e5d75[_0xd61a('0x4d')]){case'always':_0x1b1430[_0xd61a('0x50')](db['sequelize'][_0xd61a('0x51')](_0x15cfc3(_0x4e5d75,_0xd61a('0x52')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));break;case _0xd61a('0x54'):_0x1b1430[_0xd61a('0x50')](db[_0xd61a('0x55')]['query'](_0x1aebe7(_0x4e5d75,'VoiceQueueId'))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));break;default:_0x1b1430['push'](db[_0xd61a('0x55')][_0xd61a('0x51')](_0x1526b1(_0x4e5d75,_0xd61a('0x52')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));}}}return _0x1b1430;})[_0xd61a('0x56')]()['then'](function(){return db[_0xd61a('0x4a')][_0xd61a('0x4b')]({'where':{'type':_0xd61a('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd61a('0x53')](function(_0x1aa295){var _0xa92fa=[];if(_0x1aa295){var _0x1c7f3e;for(var _0x2c1049=0x0,_0x1423b9;_0x2c1049<_0x1aa295[_0xd61a('0x16')];_0x2c1049+=0x1){_0x1423b9=_0x1aa295[_0x2c1049][_0xd61a('0x57')]({'plain':!![]});_0xa92fa[_0xd61a('0x50')](db['sequelize'][_0xd61a('0x51')](_0xfcf6e6(_0x1423b9,'VoiceQueueId'))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));}}return _0xa92fa;})[_0xd61a('0x56')]();})[_0xd61a('0x53')](function(){return db['Campaign'][_0xd61a('0x4b')]({'attributes':['id',_0xd61a('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xd61a('0x53')](function(_0x280c58){var _0x564d01=[];if(_0x280c58){for(var _0x4e0733=0x0,_0x6ab89d;_0x4e0733<_0x280c58[_0xd61a('0x16')];_0x4e0733+=0x1){_0x6ab89d=_0x280c58[_0x4e0733][_0xd61a('0x57')]({'plain':!![]});switch(_0x6ab89d['dialCheckDuplicateType']){case _0xd61a('0x58'):_0x564d01['push'](db[_0xd61a('0x55')]['query'](_0x15cfc3(_0x6ab89d,_0xd61a('0x59')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));break;case'onlyIfOpen':_0x564d01['push'](db['sequelize'][_0xd61a('0x51')](_0x1aebe7(_0x6ab89d,_0xd61a('0x59')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));break;default:_0x564d01['push'](db[_0xd61a('0x55')][_0xd61a('0x51')](_0x1526b1(_0x6ab89d,_0xd61a('0x59')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));}}}return _0x564d01;})[_0xd61a('0x56')]();})[_0xd61a('0x53')](function(){return db[_0xd61a('0x5a')][_0xd61a('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xd61a('0x4e')],'as':_0xd61a('0x5b'),'where':{'id':LISTID}}]})[_0xd61a('0x53')](function(_0x44a87c){var _0x16b220=[];if(_0x44a87c){for(var _0x45aa12=0x0,_0x4d2501;_0x45aa12<_0x44a87c[_0xd61a('0x16')];_0x45aa12+=0x1){_0x4d2501=_0x44a87c[_0x45aa12]['get']({'plain':!![]});_0x16b220[_0xd61a('0x50')](db[_0xd61a('0x55')][_0xd61a('0x51')](_0xfcf6e6(_0x4d2501,_0xd61a('0x59')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));}}return _0x16b220;})[_0xd61a('0x56')]();})[_0xd61a('0x2b')](function(_0x15c246){logger['error'](_0xd61a('0x5c'),_0xd61a('0x5d'),_0x15c246[_0xd61a('0x2d')]);});}var processPromises=function(_0x22ca61){return BPromise[_0xd61a('0x56')](promises)['then'](function(_0x4fe687){})[_0xd61a('0x2b')](function(_0x364471){logger[_0xd61a('0x1b')](_0xd61a('0x5e'),JSON[_0xd61a('0x2e')](_0x364471));})[_0xd61a('0x5f')](function(){socket['emit'](_0xd61a('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x22ca61){return _0x22ca61[_0xd61a('0x61')]();}});};var endCsv=function(){return BPromise[_0xd61a('0x62')]()[_0xd61a('0x53')](function(){if(hopperContacts){return checkHopper();}})[_0xd61a('0x53')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1847e1){logger[_0xd61a('0x1b')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xd61a('0x2e')](_0x1847e1));}finally{process[_0xd61a('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0xd61a('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xd61a('0x62')]()[_0xd61a('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xd61a('0x28')][_0xd61a('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x23b011){var _0x330578=fs[_0xd61a('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x330578,{'header':!![],'skipEmptyLines':!![],'step':function(_0x44df25,_0x261485){total+=0x1;var _0x35a0d7=total;promises['push'](checkRow(_0x44df25,_0x23b011,_0x35a0d7)['then'](function(){success+=0x1;})['catch'](function(_0x256518){if(_0x256518[_0xd61a('0x1b')]){errors+=0x1;delete _0x256518[_0xd61a('0x1b')];}else if(_0x256518[_0xd61a('0x26')]){duplicates+=0x1;delete _0x256518[_0xd61a('0x26')];}rows[_0xd61a('0x50')](_0x256518);}));if(total%0xc8===0x0){_0x261485['pause']();return processPromises(_0x261485);}},'complete':function(){return processPromises()['then'](function(){logger[_0xd61a('0x64')](_0xd61a('0x66'));endCsv();});},'error':function(_0x233d60,_0x31817a){logger[_0xd61a('0x64')](_0xd61a('0x67'),JSON['stringify'](_0x233d60));endCsv();}});})[_0xd61a('0x2b')](function(_0x4f1182){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xd61a('0x2e')](_0x4f1182));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a6d199f..3272d0a 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 _0xca83=['campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','error','message','exit','errors','code','sequelize','query','spread','catch','main','stringify','send','start','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','createReadStream','rows','data','hasOwnProperty','trim','replace','isValid','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','contact:import:','abort','SystemError','step','duplicates','length','cm_contacts_','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xca83,0x99));var _0x3ca8=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xca83[_0x1e4360];return _0x31e6b4;};'use strict';var fs=require('fs');var path=require(_0x3ca8('0x0'));var _=require('lodash');var Papa=require(_0x3ca8('0x1'));var util=require(_0x3ca8('0x2'));var BPromise=require(_0x3ca8('0x3'));var moment=require(_0x3ca8('0x4'));var squel=require('squel');var Redis=require(_0x3ca8('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x3ca8('0x6'));var logger=require(_0x3ca8('0x7'))('import');config[_0x3ca8('0x8')]=_[_0x3ca8('0x9')](config['redis'],{'host':_0x3ca8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ca8('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x3ca8('0xb')](_0x3ca8('0xc'));function isEmail(_0x4a0bd7){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4a0bd7);}function selectNotIn(_0x384124,_0x51fd7a,_0x15550b,_0x251089,_0x29b1e7){return squel[_0x3ca8('0xd')]()[_0x3ca8('0xe')](_0x3ca8('0xf'))[_0x3ca8('0x10')](_0x251089)[_0x3ca8('0x11')](_0x51fd7a,null,_0x51fd7a+'.id\x20=\x20'+_0x251089+'.'+_0x15550b)[_0x3ca8('0x12')](_0x251089+'.'+_0x15550b+_0x3ca8('0x13')+_0x384124+'.'+_0x15550b)[_0x3ca8('0x12')](_0x51fd7a+_0x3ca8('0x14')+_0x29b1e7[_0x3ca8('0x11')]()+')');}function insertCmHopper(_0x214a00,_0x30f53a,_0xc69de9,_0x150fc1,_0xa17e6b){var _0x4110a6=[_0x3ca8('0x15'),'cm_contacts.scheduledat',_0x3ca8('0x16'),_0x3ca8('0x17'),_0x30f53a+'.'+_0x150fc1,_0x3ca8('0x18'),_0x3ca8('0x19'),_0x3ca8('0x1a'),_0x3ca8('0x1b'),'\x22'+_0xa17e6b+'\x22'];return squel[_0x3ca8('0x1c')]()[_0x3ca8('0x1d')](_0x3ca8('0x1e'))[_0x3ca8('0x1f')]([_0x3ca8('0xf'),_0x3ca8('0x20'),_0x3ca8('0x21'),_0x3ca8('0x22'),_0x150fc1,_0x3ca8('0x23'),_0x3ca8('0x24'),_0x3ca8('0x25'),_0x3ca8('0x26'),_0x3ca8('0x27')],squel[_0x3ca8('0xd')]()[_0x3ca8('0x28')](_0x4110a6)[_0x3ca8('0x10')](_0x30f53a)[_0x3ca8('0x11')](_0x3ca8('0x29'),null,_0x3ca8('0x2a')+_0x30f53a+_0x3ca8('0x2b'))[_0x3ca8('0x11')](_0xc69de9,null,_0xc69de9+_0x3ca8('0x2c')+_0x30f53a+'.'+_0x150fc1)[_0x3ca8('0x12')](_0x30f53a+_0x3ca8('0x2d'),_0x214a00)['where'](_0x3ca8('0x2e'),NOW)['where'](_0x3ca8('0x2f'),selectNotIn(_0x30f53a,_0xc69de9,_0x150fc1,_0x3ca8('0x1e'),[_0x3ca8('0x30'),_0x3ca8('0x31')]))[_0x3ca8('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x30f53a,_0xc69de9,_0x150fc1,_0x3ca8('0x1e'),[_0x3ca8('0x30')])))[_0x3ca8('0x32')]();}function insertCmHopperBlack(_0x1d28a0,_0x4fcca3,_0x1efc1a,_0x27c12f){var _0x4d2899=[_0x3ca8('0x15'),'cm_contacts.id',_0x3ca8('0x17'),_0x4fcca3+'.'+_0x27c12f,_0x3ca8('0x18'),'cm_contacts.updatedAt'];return squel[_0x3ca8('0x1c')]()[_0x3ca8('0x1d')]('cm_hopper_black')[_0x3ca8('0x1f')]([_0x3ca8('0xf'),_0x3ca8('0x21'),'ListId',_0x27c12f,'createdAt','updatedAt'],squel[_0x3ca8('0xd')]()[_0x3ca8('0x28')](_0x4d2899)['from'](_0x4fcca3)[_0x3ca8('0x11')](_0x3ca8('0x29'),null,'cm_contacts.ListId\x20=\x20'+_0x4fcca3+_0x3ca8('0x2b'))['join'](_0x1efc1a,null,_0x1efc1a+_0x3ca8('0x2c')+_0x4fcca3+'.'+_0x27c12f)[_0x3ca8('0x12')](_0x4fcca3+_0x3ca8('0x2d'),_0x1d28a0)[_0x3ca8('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x3ca8('0x2f'),squel[_0x3ca8('0xd')]()[_0x3ca8('0xe')]('phone')['from'](_0x3ca8('0x33'))['where'](_0x3ca8('0x34'),_0x1d28a0)[_0x3ca8('0x12')](_0x27c12f+_0x3ca8('0x35'),_0x4fcca3+'.'+_0x27c12f)))[_0x3ca8('0x32')]();}function insertCmContact(_0x982241,_0x4823a4,_0x1db0ca,_0x209016){var _0x3ae88f=_[_0x3ca8('0x36')](_[_0x3ca8('0x37')](_0x209016),[_0x3ca8('0x22'),'CompanyId',_0x3ca8('0x23'),_0x3ca8('0x24')]);return squel[_0x3ca8('0x1c')]()[_0x3ca8('0x1d')](_0x3ca8('0x29'))[_0x3ca8('0x1f')](_0x3ae88f,squel[_0x3ca8('0xd')]()[_0x3ca8('0x28')](_0x3ae88f)[_0x3ca8('0x10')](_0x4823a4)[_0x3ca8('0x12')]('('+_0x1db0ca[_0x3ca8('0x11')](',')+_0x3ca8('0x38'),squel[_0x3ca8('0xd')]()[_0x3ca8('0x28')](_0x1db0ca)[_0x3ca8('0x10')](_0x3ca8('0x29'))[_0x3ca8('0x12')](_0x3ca8('0x34'),_0x982241)[_0x3ca8('0x12')]('deletedAt\x20IS\x20NULL'))['where'](_0x3ca8('0x39'),squel[_0x3ca8('0xd')]()[_0x3ca8('0xe')](_0x3ca8('0x3a'),_0x3ca8('0x3b'))[_0x3ca8('0x10')](_0x4823a4)['group'](_0x1db0ca[_0x3ca8('0x11')](','))))[_0x3ca8('0x32')]();}function handleStop(){logger[_0x3ca8('0x3c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x333afa){logger[_0x3ca8('0x3d')](_0x333afa[_0x3ca8('0x3e')]);process[_0x3ca8('0x3f')](0x1);}function handleError(_0x58f1ee,_0x445127){stats[_0x3ca8('0x40')]['push']({'name':_0x445127[_0x3ca8('0x41')],'message':_0x445127['message'],'row':_0x58f1ee});}function handleQuery(_0x3ee3b5){logger[_0x3ca8('0x3c')](_0x3ee3b5);return db[_0x3ca8('0x42')][_0x3ca8('0x43')](_0x3ee3b5)[_0x3ca8('0x44')](function(_0x4c6823){results['push'](_0x4c6823);})[_0x3ca8('0x45')](function(_0x1e6997){logger[_0x3ca8('0x3d')](_0x1e6997[_0x3ca8('0x3e')]);});}function main(_0xa67141,_0xd694f1,_0x5ec4e2,_0x156067){logger[_0x3ca8('0x3c')](_0x3ca8('0x46'),_0xa67141,JSON[_0x3ca8('0x47')](_0xd694f1));process[_0x3ca8('0x48')](_0x3ca8('0x49'));var _0x3c76e8=_0xd694f1['binding'];var _0x39c7a8=_0xd694f1[_0x3ca8('0x4a')];var _0x4e4bc0=path['join'](config[_0x3ca8('0x4b')],_0x3ca8('0x4c'),_0x39c7a8+'.csv');var _0x59caf3=_[_0x3ca8('0x37')](_0x3c76e8)[_0x3ca8('0x11')]();logger[_0x3ca8('0x3c')](_0x3ca8('0x4d'),_0x59caf3);fs[_0x3ca8('0x4e')](_0x4e4bc0,_0x59caf3+'\x0a');Papa[_0x3ca8('0x4f')](fs[_0x3ca8('0x50')](_0xa67141),{'header':!![],'skipEmptyLines':!![],'step':function(_0x352d30,_0x57159b){try{for(var _0x1cc18f=0x0,_0x5ae957=[];_0x1cc18f<_0x352d30['data']['length'];_0x1cc18f++){stats[_0x3ca8('0x51')]+=0x1;if(_0x352d30['errors'][_0x1cc18f]){handleError(_0x352d30[_0x3ca8('0x52')][_0x1cc18f],_0x352d30[_0x3ca8('0x40')][_0x1cc18f]);}else{var _0x2d59f4=[];for(var _0x3bfef6 in _0x3c76e8){if(_0x3c76e8[_0x3ca8('0x53')](_0x3bfef6)){if(_0x352d30[_0x3ca8('0x52')][_0x1cc18f][_0x3c76e8[_0x3bfef6]]){var _0x6228dd=_[_0x3ca8('0x54')](_0x352d30[_0x3ca8('0x52')][_0x1cc18f][_0x3c76e8[_0x3bfef6]][_0x3ca8('0x55')](/"/g,'\x27'));switch(_0x3bfef6){case _0x3ca8('0x20'):var _0x6a2ce2=moment(_0x6228dd,_0x3ca8('0xc'),!![]);if(_0x6a2ce2[_0x3ca8('0x56')]()){_0x5ae957[_0x3ca8('0x57')]('\x22'+_0x6228dd+'\x22');}else{_0x2d59f4['push'](_0x3ca8('0x58'));}break;case _0x3ca8('0x25'):var _0x592dac=parseInt(_0x6228dd);_0x6228dd=_[_0x3ca8('0x59')](_0x592dac)||_0x592dac<0x0||_0x592dac>0x4?_0x156067?0x3:0x2:_0x592dac;_0x5ae957[_0x3ca8('0x57')]('\x22'+_0x6228dd+'\x22');break;case _0x3ca8('0x26'):var _0x51d12e=parseInt(_0x6228dd);if(_['isNumber'](_0x51d12e)&&_['includes'](_0x5ec4e2,_0x51d12e)){_0x5ae957['push']('\x22'+_0x51d12e+'\x22');}else{_0x2d59f4[_0x3ca8('0x57')](_0x3ca8('0x5a'));}break;case'email':if(isEmail(_0x6228dd)){_0x5ae957[_0x3ca8('0x57')]('\x22'+_0x6228dd+'\x22');}else{_0x2d59f4[_0x3ca8('0x57')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x420c48=moment(_0x6228dd,_0x3ca8('0x5b'),!![]);if(_0x420c48[_0x3ca8('0x56')]()){_0x5ae957[_0x3ca8('0x57')]('\x22'+_0x6228dd+'\x22');}else{_0x2d59f4[_0x3ca8('0x57')](_0x3ca8('0x5c'));}break;default:_0x5ae957[_0x3ca8('0x57')]('\x22'+_0x6228dd+'\x22');}}else{switch(_0x3bfef6){case'firstName':case _0x3ca8('0xf'):_0x2d59f4['push'](_0x3bfef6+_0x3ca8('0x5d'));break;default:_0x5ae957[_0x3ca8('0x57')]('\x22\x22');}}}}if(_0x2d59f4['length']){handleError(_0x352d30[_0x3ca8('0x52')][_0x1cc18f],{'code':'SystemRow','message':_0x2d59f4[_0x3ca8('0x11')]()});}else{fs[_0x3ca8('0x5e')](_0x4e4bc0,_0x5ae957['join']()+'\x0a');}_0x5ae957=[];}if(!(stats[_0x3ca8('0x51')]%0xc8)){socket['emit'](_0x3ca8('0x5f')+_0x39c7a8,stats);stats[_0x3ca8('0x40')]=[];}}if(stopped){logger[_0x3ca8('0x3c')]('Abort\x20parser');_0x57159b[_0x3ca8('0x60')]();}}catch(_0x289cd7){handleError(_0x352d30['data'][_0x1cc18f],{'code':_0x3ca8('0x61'),'message':_0x289cd7[_0x3ca8('0x3e')]});logger[_0x3ca8('0x3d')](_0x3ca8('0x62'),_0x289cd7[_0x3ca8('0x3e')]);}},'complete':function(){try{var _0x484ae0=[];var _0x288ac2='cm_contacts';if(_0xd694f1['duplicates']&&_0xd694f1[_0x3ca8('0x63')][_0x3ca8('0x64')]){_0x288ac2=_0x3ca8('0x65')+_0x39c7a8;_0x484ae0[_0x3ca8('0x57')]('CREATE\x20TABLE\x20'+_0x288ac2+_0x3ca8('0x66'));}var _0x42123a=util[_0x3ca8('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4e4bc0,_0x288ac2,_0x59caf3,_0xd694f1['ListId'],_0xd694f1['CompanyId']||null,NOW,NOW);if(_[_0x3ca8('0x67')](_0x3c76e8[_0x3ca8('0x20')])){_0x42123a+=_0x3ca8('0x68');}_0x484ae0[_0x3ca8('0x57')](_0x42123a);if(_0xd694f1[_0x3ca8('0x63')]&&_0xd694f1['duplicates'][_0x3ca8('0x64')]){_0x484ae0['push'](insertCmContact(_0xd694f1[_0x3ca8('0x22')],_0x288ac2,_0xd694f1[_0x3ca8('0x63')],_0x3c76e8));_0x484ae0[_0x3ca8('0x57')](_0x3ca8('0x69')+_0x288ac2+';');}_0x484ae0['push'](insertCmHopper(_0xd694f1[_0x3ca8('0x22')],'voice_queues_has_cm_lists',_0x3ca8('0x6a'),_0x3ca8('0x6b'),_0x156067));_0x484ae0['push'](insertCmHopperBlack(_0xd694f1[_0x3ca8('0x22')],_0x3ca8('0x6c'),_0x3ca8('0x6a'),_0x3ca8('0x6b')));_0x484ae0[_0x3ca8('0x57')](insertCmHopper(_0xd694f1['ListId'],_0x3ca8('0x6d'),_0x3ca8('0x6e'),'CampaignId',_0x156067));_0x484ae0['push'](insertCmHopperBlack(_0xd694f1['ListId'],_0x3ca8('0x6f'),'campaigns','CampaignId'));BPromise[_0x3ca8('0x70')](_0x484ae0,handleQuery)[_0x3ca8('0x71')](function(_0x4088d5){stats[_0x3ca8('0x72')]=!![];stats[_0x3ca8('0x73')]=_0xd694f1[_0x3ca8('0x63')]&&_0xd694f1[_0x3ca8('0x63')]['length']?results[0x2][_0x3ca8('0x73')]:results[0x0]['affectedRows'];socket['emit'](_0x3ca8('0x5f')+_0x39c7a8,stats);fs[_0x3ca8('0x74')](_0xa67141);fs[_0x3ca8('0x74')](_0x4e4bc0);process[_0x3ca8('0x3f')](0x0);})[_0x3ca8('0x45')](function(_0x729276){logger[_0x3ca8('0x3d')](_0x729276['message']);process['exit'](0x1);});}catch(_0x4c14c7){logger[_0x3ca8('0x3d')](_0x3ca8('0x75'),_0x4c14c7[_0x3ca8('0x3e')]);process[_0x3ca8('0x3f')](0x1);}},'error':function(_0xc39542,_0x495e99,_0x27685e,_0x159bb5){throw new Error(_0x159bb5);}});}function validate(){if(process[_0x3ca8('0x76')]&&process[_0x3ca8('0x76')][_0x3ca8('0x64')]<0x4){throw new Error(_0x3ca8('0x77'));}var _0x17d475=path[_0x3ca8('0x11')](config[_0x3ca8('0x4b')],_0x3ca8('0x4c'),process[_0x3ca8('0x76')][0x2]);if(!fs[_0x3ca8('0x78')](_0x17d475)){throw new Error(_0x3ca8('0x79'));}var _0x20ad6b={};try{_0x20ad6b=JSON['parse'](process[_0x3ca8('0x76')][0x3]);if(!_0x20ad6b[_0x3ca8('0x7a')]){throw new Error(_0x3ca8('0x7b'));}if(!_0x20ad6b['binding']['phone']){throw new Error(_0x3ca8('0x7c'));}if(!_0x20ad6b[_0x3ca8('0x7a')][_0x3ca8('0x7d')]){throw new Error(_0x3ca8('0x7e'));}var _0x399d77=0x0;if(_0x20ad6b[_0x3ca8('0x7a')][_0x3ca8('0x26')]){_0x399d77=0x1;}if(!_0x20ad6b['ListId']){throw new Error(_0x3ca8('0x7f'));}}catch(_0x3fb4bf){throw new Error('body\x20id\x20mandatory');}var _0x1814b5=[];try{_0x1814b5=_[_0x3ca8('0x80')](JSON['parse'](process[_0x3ca8('0x76')][0x4]),'id');}catch(_0x31676e){logger[_0x3ca8('0x3c')](_0x3ca8('0x81'));}main(_0x17d475,_0x20ad6b,_0x1814b5,_0x399d77);}validate();process['on'](_0x3ca8('0x82'),handleStop);process['on'](_0x3ca8('0x83'),handleUncaughtException); \ No newline at end of file +var _0x5085=['unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','recallme','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','toString','cm_contacts.createdAt','cm_hopper_black','createdAt','fields','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','cm_contacts',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','sequelize','query','spread','push','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','rows','data','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','length','SystemRow','appendFileSync','contact:import:','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','emit'];(function(_0x3d95e6,_0x24d50e){var _0x1dac59=function(_0x46a2f0){while(--_0x46a2f0){_0x3d95e6['push'](_0x3d95e6['shift']());}};_0x1dac59(++_0x24d50e);}(_0x5085,0x11d));var _0x5508=function(_0x149ad0,_0x5ea550){_0x149ad0=_0x149ad0-0x0;var _0x212a10=_0x5085[_0x149ad0];return _0x212a10;};'use strict';var fs=require('fs');var path=require(_0x5508('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x5508('0x1'));var BPromise=require(_0x5508('0x2'));var moment=require(_0x5508('0x3'));var squel=require(_0x5508('0x4'));var Redis=require(_0x5508('0x5'));var db=require(_0x5508('0x6'))['db'];var config=require(_0x5508('0x7'));var logger=require('../../../config/logger')(_0x5508('0x8'));config['redis']=_[_0x5508('0x9')](config[_0x5508('0xa')],{'host':_0x5508('0xb'),'port':0x18eb});var socket=require(_0x5508('0xc'))(new Redis(config[_0x5508('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x5508('0xd')](_0x5508('0xe'));function isEmail(_0x44c6c6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x44c6c6);}function selectNotIn(_0x36284f,_0x49ad7e,_0x280d2e,_0x48e93c,_0x483fe4){return squel[_0x5508('0xf')]()[_0x5508('0x10')](_0x5508('0x11'))[_0x5508('0x12')](_0x48e93c)['join'](_0x49ad7e,null,_0x49ad7e+_0x5508('0x13')+_0x48e93c+'.'+_0x280d2e)[_0x5508('0x14')](_0x48e93c+'.'+_0x280d2e+_0x5508('0x15')+_0x36284f+'.'+_0x280d2e)[_0x5508('0x14')](_0x49ad7e+_0x5508('0x16')+_0x483fe4[_0x5508('0x17')]()+')');}function insertCmHopper(_0x820220,_0xb4707,_0x363258,_0x4f8874,_0x112cea){var _0x4093bc=[_0x5508('0x18'),'cm_contacts.scheduledat',_0x5508('0x19'),_0x5508('0x1a'),_0xb4707+'.'+_0x4f8874,'cm_contacts.createdAt',_0x5508('0x1b'),_0x5508('0x1c'),_0x5508('0x1d'),'\x22'+_0x112cea+'\x22'];return squel[_0x5508('0x1e')]()[_0x5508('0x1f')]('cm_hopper')[_0x5508('0x20')]([_0x5508('0x11'),_0x5508('0x21'),_0x5508('0x22'),_0x5508('0x23'),_0x4f8874,'createdAt',_0x5508('0x24'),_0x5508('0x25'),'UserId',_0x5508('0x26')],squel[_0x5508('0xf')]()['fields'](_0x4093bc)[_0x5508('0x12')](_0xb4707)[_0x5508('0x17')]('cm_contacts',null,_0x5508('0x27')+_0xb4707+_0x5508('0x28'))['join'](_0x363258,null,_0x363258+_0x5508('0x13')+_0xb4707+'.'+_0x4f8874)['where'](_0xb4707+_0x5508('0x29'),_0x820220)[_0x5508('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5508('0x14')](_0x5508('0x2a'),selectNotIn(_0xb4707,_0x363258,_0x4f8874,_0x5508('0x2b'),[_0x5508('0x2c'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xb4707,_0x363258,_0x4f8874,_0x5508('0x2b'),[_0x5508('0x2c')])))[_0x5508('0x2d')]();}function insertCmHopperBlack(_0x347164,_0xf09bcf,_0x2c657b,_0x458669){var _0x38eb6c=['cm_contacts.phone',_0x5508('0x19'),_0x5508('0x1a'),_0xf09bcf+'.'+_0x458669,_0x5508('0x2e'),_0x5508('0x1b')];return squel[_0x5508('0x1e')]()[_0x5508('0x1f')](_0x5508('0x2f'))[_0x5508('0x20')]([_0x5508('0x11'),'ContactId',_0x5508('0x23'),_0x458669,_0x5508('0x30'),_0x5508('0x24')],squel['select']()[_0x5508('0x31')](_0x38eb6c)[_0x5508('0x12')](_0xf09bcf)[_0x5508('0x17')]('cm_contacts',null,_0x5508('0x27')+_0xf09bcf+_0x5508('0x28'))[_0x5508('0x17')](_0x2c657b,null,_0x2c657b+'.id\x20=\x20'+_0xf09bcf+'.'+_0x458669)[_0x5508('0x14')](_0xf09bcf+_0x5508('0x29'),_0x347164)[_0x5508('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5508('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5508('0xf')]()[_0x5508('0x10')]('phone')[_0x5508('0x12')](_0x5508('0x2f'))[_0x5508('0x14')](_0x5508('0x32'),_0x347164)[_0x5508('0x14')](_0x458669+_0x5508('0x33'),_0xf09bcf+'.'+_0x458669)))[_0x5508('0x2d')]();}function insertCmContact(_0x5e6a01,_0x10bbb1,_0x4268f5,_0x33a7e5){var _0x54c840=_['concat'](_[_0x5508('0x34')](_0x33a7e5),[_0x5508('0x23'),_0x5508('0x35'),'createdAt',_0x5508('0x24')]);return squel[_0x5508('0x1e')]()[_0x5508('0x1f')](_0x5508('0x36'))['fromQuery'](_0x54c840,squel[_0x5508('0xf')]()[_0x5508('0x31')](_0x54c840)[_0x5508('0x12')](_0x10bbb1)[_0x5508('0x14')]('('+_0x4268f5['join'](',')+_0x5508('0x37'),squel['select']()[_0x5508('0x31')](_0x4268f5)[_0x5508('0x12')](_0x5508('0x36'))[_0x5508('0x14')](_0x5508('0x32'),_0x5e6a01)[_0x5508('0x14')](_0x5508('0x38')))[_0x5508('0x14')](_0x5508('0x39'),squel[_0x5508('0xf')]()[_0x5508('0x10')](_0x5508('0x3a'),_0x5508('0x3b'))[_0x5508('0x12')](_0x10bbb1)[_0x5508('0x3c')](_0x4268f5[_0x5508('0x17')](','))))[_0x5508('0x2d')]();}function handleStop(){logger[_0x5508('0x3d')](_0x5508('0x3e'));stopped=!![];}function handleUncaughtException(_0x4b9fc1){logger[_0x5508('0x3f')](_0x4b9fc1[_0x5508('0x40')]);process[_0x5508('0x41')](0x1);}function handleError(_0xe1b98c,_0xdabd0b){stats[_0x5508('0x42')]['push']({'name':_0xdabd0b['code'],'message':_0xdabd0b[_0x5508('0x40')],'row':_0xe1b98c});}function handleQuery(_0x500218){logger['info'](_0x500218);return db[_0x5508('0x43')][_0x5508('0x44')](_0x500218)[_0x5508('0x45')](function(_0x4835f2){results[_0x5508('0x46')](_0x4835f2);})[_0x5508('0x47')](function(_0x4a9dbb){logger[_0x5508('0x3f')](_0x4a9dbb[_0x5508('0x40')]);});}function main(_0xd8fdeb,_0x868260,_0x4293f1,_0x3d9606){logger[_0x5508('0x3d')](_0x5508('0x48'),_0xd8fdeb,JSON[_0x5508('0x49')](_0x868260));process[_0x5508('0x4a')](_0x5508('0x4b'));var _0x470590=_0x868260[_0x5508('0x4c')];var _0x14ec60=_0x868260[_0x5508('0x4d')];var _0x2377dc=path['join'](config[_0x5508('0x4e')],_0x5508('0x4f'),_0x14ec60+_0x5508('0x50'));var _0x2f4099=_[_0x5508('0x34')](_0x470590)[_0x5508('0x17')]();logger[_0x5508('0x3d')](_0x5508('0x51'),_0x2f4099);fs[_0x5508('0x52')](_0x2377dc,_0x2f4099+'\x0a');Papa['parse'](fs[_0x5508('0x53')](_0xd8fdeb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4d110d,_0x476891){try{for(var _0x1dd139=0x0,_0x2a46b9=[];_0x1dd139<_0x4d110d['data']['length'];_0x1dd139++){stats[_0x5508('0x54')]+=0x1;if(_0x4d110d[_0x5508('0x42')][_0x1dd139]){handleError(_0x4d110d[_0x5508('0x55')][_0x1dd139],_0x4d110d[_0x5508('0x42')][_0x1dd139]);}else{var _0x523be8=[];for(var _0x225046 in _0x470590){if(_0x470590['hasOwnProperty'](_0x225046)){if(_0x4d110d[_0x5508('0x55')][_0x1dd139][_0x470590[_0x225046]]){var _0x455548=_[_0x5508('0x56')](_0x4d110d['data'][_0x1dd139][_0x470590[_0x225046]][_0x5508('0x57')](/"/g,'\x27'));switch(_0x225046){case _0x5508('0x21'):var _0x2a60ee=moment(_0x455548,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2a60ee[_0x5508('0x58')]()){_0x2a46b9[_0x5508('0x46')]('\x22'+_0x455548+'\x22');}else{_0x523be8['push'](_0x5508('0x59'));}break;case _0x5508('0x25'):var _0xdc61b6=parseInt(_0x455548);_0x455548=_['isNaN'](_0xdc61b6)||_0xdc61b6<0x0||_0xdc61b6>0x4?_0x3d9606?0x3:0x2:_0xdc61b6;_0x2a46b9[_0x5508('0x46')]('\x22'+_0x455548+'\x22');break;case _0x5508('0x5a'):var _0x25573b=parseInt(_0x455548);if(_[_0x5508('0x5b')](_0x25573b)&&_[_0x5508('0x5c')](_0x4293f1,_0x25573b)){_0x2a46b9[_0x5508('0x46')]('\x22'+_0x25573b+'\x22');}else{_0x523be8[_0x5508('0x46')](_0x5508('0x5d'));}break;case _0x5508('0x5e'):if(isEmail(_0x455548)){_0x2a46b9[_0x5508('0x46')]('\x22'+_0x455548+'\x22');}else{_0x523be8[_0x5508('0x46')]('email\x20wrong\x20format');}break;case _0x5508('0x5f'):var _0x292e3a=moment(_0x455548,_0x5508('0x60'),!![]);if(_0x292e3a['isValid']()){_0x2a46b9[_0x5508('0x46')]('\x22'+_0x455548+'\x22');}else{_0x523be8[_0x5508('0x46')](_0x5508('0x61'));}break;default:_0x2a46b9['push']('\x22'+_0x455548+'\x22');}}else{switch(_0x225046){case _0x5508('0x62'):case _0x5508('0x11'):_0x523be8['push'](_0x225046+'\x20not\x20specified');break;default:_0x2a46b9[_0x5508('0x46')]('\x22\x22');}}}}if(_0x523be8[_0x5508('0x63')]){handleError(_0x4d110d[_0x5508('0x55')][_0x1dd139],{'code':_0x5508('0x64'),'message':_0x523be8[_0x5508('0x17')]()});}else{fs[_0x5508('0x65')](_0x2377dc,_0x2a46b9[_0x5508('0x17')]()+'\x0a');}_0x2a46b9=[];}if(!(stats[_0x5508('0x54')]%0xc8)){socket['emit'](_0x5508('0x66')+_0x14ec60,stats);stats[_0x5508('0x42')]=[];}}if(stopped){logger[_0x5508('0x3d')]('Abort\x20parser');_0x476891['abort']();}}catch(_0x88e8fa){handleError(_0x4d110d[_0x5508('0x55')][_0x1dd139],{'code':'SystemError','message':_0x88e8fa['message']});logger[_0x5508('0x3f')]('step',_0x88e8fa[_0x5508('0x40')]);}},'complete':function(){try{var _0x522e55=[];var _0x124443=_0x5508('0x36');if(_0x868260[_0x5508('0x67')]&&_0x868260[_0x5508('0x67')]['length']){_0x124443='cm_contacts_'+_0x14ec60;_0x522e55['push'](_0x5508('0x68')+_0x124443+_0x5508('0x69'));}var _0x3986d6=util[_0x5508('0xd')](_0x5508('0x6a'),_0x2377dc,_0x124443,_0x2f4099,_0x868260['ListId'],_0x868260[_0x5508('0x35')]||null,NOW,NOW);if(_[_0x5508('0x6b')](_0x470590[_0x5508('0x21')])){_0x3986d6+=_0x5508('0x6c');}_0x522e55['push'](_0x3986d6);if(_0x868260[_0x5508('0x67')]&&_0x868260[_0x5508('0x67')]['length']){_0x522e55['push'](insertCmContact(_0x868260[_0x5508('0x23')],_0x124443,_0x868260['duplicates'],_0x470590));_0x522e55['push'](_0x5508('0x6d')+_0x124443+';');}_0x522e55[_0x5508('0x46')](insertCmHopper(_0x868260[_0x5508('0x23')],_0x5508('0x6e'),_0x5508('0x6f'),_0x5508('0x70'),_0x3d9606));_0x522e55[_0x5508('0x46')](insertCmHopperBlack(_0x868260['ListId'],_0x5508('0x71'),'voice_queues',_0x5508('0x70')));_0x522e55[_0x5508('0x46')](insertCmHopper(_0x868260[_0x5508('0x23')],_0x5508('0x72'),'campaigns',_0x5508('0x73'),_0x3d9606));_0x522e55[_0x5508('0x46')](insertCmHopperBlack(_0x868260[_0x5508('0x23')],_0x5508('0x74'),_0x5508('0x75'),_0x5508('0x73')));BPromise[_0x5508('0x76')](_0x522e55,handleQuery)[_0x5508('0x77')](function(_0x1f55bd){stats[_0x5508('0x78')]=!![];stats[_0x5508('0x79')]=_0x868260[_0x5508('0x67')]&&_0x868260[_0x5508('0x67')]['length']?results[0x2][_0x5508('0x79')]:results[0x0][_0x5508('0x79')];socket[_0x5508('0x7a')](_0x5508('0x66')+_0x14ec60,stats);fs[_0x5508('0x7b')](_0xd8fdeb);fs[_0x5508('0x7b')](_0x2377dc);process[_0x5508('0x41')](0x0);})['catch'](function(_0x5e07a3){logger[_0x5508('0x3f')](_0x5e07a3[_0x5508('0x40')]);process[_0x5508('0x41')](0x1);});}catch(_0x1cb503){logger[_0x5508('0x3f')](_0x5508('0x7c'),_0x1cb503[_0x5508('0x40')]);process[_0x5508('0x41')](0x1);}},'error':function(_0x4a8cd6,_0x4d78b6,_0x4517e9,_0x628f31){throw new Error(_0x628f31);}});}function validate(){if(process[_0x5508('0x7d')]&&process[_0x5508('0x7d')][_0x5508('0x63')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x34c70c=path['join'](config[_0x5508('0x4e')],_0x5508('0x4f'),process['argv'][0x2]);if(!fs[_0x5508('0x7e')](_0x34c70c)){throw new Error(_0x5508('0x7f'));}var _0x27b414={};try{_0x27b414=JSON['parse'](process[_0x5508('0x7d')][0x3]);if(!_0x27b414[_0x5508('0x4c')]){throw new Error(_0x5508('0x80'));}if(!_0x27b414['binding']['phone']){throw new Error(_0x5508('0x81'));}if(!_0x27b414['binding']['firstName']){throw new Error(_0x5508('0x82'));}var _0x508b9b=0x0;if(_0x27b414[_0x5508('0x4c')]['UserId']){_0x508b9b=0x1;}if(!_0x27b414[_0x5508('0x23')]){throw new Error(_0x5508('0x83'));}}catch(_0x55e823){throw new Error('body\x20id\x20mandatory');}var _0x304bc3=[];try{_0x304bc3=_['map'](JSON[_0x5508('0x84')](process[_0x5508('0x7d')][0x4]),'id');}catch(_0x18fde5){logger['info'](_0x5508('0x85'));}main(_0x34c70c,_0x27b414,_0x304bc3,_0x508b9b);}validate();process['on'](_0x5508('0x86'),handleStop);process['on'](_0x5508('0x87'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index a592cc1..1af2ecd 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 _0x9250=['getDescriptions','inbound','string','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','destexten','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','uniqueid','starttime','answertime','Duration','duration','Billable\x20Time','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','push','queue','calleridnum','variable'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x9250,0x94));var _0x0925=function(_0x1699e6,_0x20af61){_0x1699e6=_0x1699e6-0x0;var _0x56cc52=_0x9250[_0x1699e6];return _0x56cc52;};'use strict';exports[_0x0925('0x0')]=function(_0x799c4c,_0xe7669c){var _0x42339a=[{'type':'string','content':_0x0925('0x1'),'variableName':null}];switch(_0x799c4c[_0x0925('0x2')]()){case _0x0925('0x3'):switch(_0xe7669c['toLowerCase']()){case'inbound':_0x42339a[_0x0925('0x4')]({'type':'variable','content':'','variableName':_0x0925('0x5')});_0x42339a[_0x0925('0x4')]({'type':'variable','content':'','variableName':_0x0925('0x6')});break;case'outbound':_0x42339a[_0x0925('0x4')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x42339a[_0x0925('0x4')]({'type':_0x0925('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x42339a;};exports[_0x0925('0x8')]=function(_0x310b4f,_0x3363d1){var _0x2dae95=[];switch(_0x310b4f[_0x0925('0x2')]()){case _0x0925('0x3'):switch(_0x3363d1['toLowerCase']()){case _0x0925('0x9'):_0x2dae95=[{'type':_0x0925('0xa'),'content':_0x0925('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x0925('0xc'),'content':'','key':'Caller\x20Number','keyType':_0x0925('0x7'),'variableName':_0x0925('0x6')},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0xd'),'keyType':_0x0925('0x7'),'variableName':_0x0925('0xe')},{'type':_0x0925('0xc'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0x0925('0xf')},{'type':'keyValue','content':'','key':_0x0925('0x10'),'keyType':_0x0925('0x7'),'variableName':_0x0925('0x5')},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x11'),'keyType':_0x0925('0x7'),'variableName':'uniqueid'},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x12'),'keyType':'variable','variableName':_0x0925('0x13')},{'type':_0x0925('0xa'),'content':_0x0925('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x0925('0xc'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':'destcalleridname'},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x15'),'keyType':_0x0925('0x7'),'variableName':_0x0925('0x16')},{'type':_0x0925('0xa'),'content':_0x0925('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x18'),'keyType':'variable','variableName':_0x0925('0x13')},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x19'),'keyType':_0x0925('0x7'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0x0925('0x1a'),'keyType':_0x0925('0x7'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x0925('0x1b'),'keyType':_0x0925('0x7'),'variableName':'holdtime'},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x1c'),'keyType':_0x0925('0x7'),'variableName':_0x0925('0x1d')}];break;case'outbound':_0x2dae95=[{'type':_0x0925('0xa'),'content':_0x0925('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0x0925('0x1e'),'keyType':_0x0925('0x7'),'keyContent':'','variableName':_0x0925('0x16')},{'type':'keyValue','content':'','key':_0x0925('0x1f'),'keyType':_0x0925('0x7'),'keyContent':'','variableName':_0x0925('0x20')},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x11'),'keyType':_0x0925('0x7'),'keyContent':'','variableName':_0x0925('0x21')},{'type':'keyValue','content':'','key':_0x0925('0x12'),'keyType':_0x0925('0x7'),'keyContent':'','variableName':_0x0925('0x22')},{'type':'string','content':_0x0925('0x17')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x0925('0x7'),'keyContent':'','variableName':_0x0925('0x23')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0x0925('0x7'),'keyContent':'','variableName':'endtime'},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x24'),'keyType':_0x0925('0x7'),'keyContent':'','variableName':_0x0925('0x25')},{'type':_0x0925('0xc'),'content':'','key':_0x0925('0x26'),'keyType':_0x0925('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x2dae95;}; \ No newline at end of file +var _0x43cb=['toLowerCase','inbound','push','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','voice'];(function(_0x40d708,_0x5f12ed){var _0x12dc20=function(_0x5ece08){while(--_0x5ece08){_0x40d708['push'](_0x40d708['shift']());}};_0x12dc20(++_0x5f12ed);}(_0x43cb,0x87));var _0xb43c=function(_0x495b11,_0x513156){_0x495b11=_0x495b11-0x0;var _0x59f4ec=_0x43cb[_0x495b11];return _0x59f4ec;};'use strict';exports[_0xb43c('0x0')]=function(_0x1bcf88,_0x3f0d2f){var _0x3c841f=[{'type':_0xb43c('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x1bcf88['toLowerCase']()){case _0xb43c('0x2'):switch(_0x3f0d2f[_0xb43c('0x3')]()){case _0xb43c('0x4'):_0x3c841f[_0xb43c('0x5')]({'type':'variable','content':'','variableName':'queue'});_0x3c841f[_0xb43c('0x5')]({'type':_0xb43c('0x6'),'content':'','variableName':_0xb43c('0x7')});break;case _0xb43c('0x8'):_0x3c841f[_0xb43c('0x5')]({'type':_0xb43c('0x1'),'content':'Outbound\x20Call','variableName':null});_0x3c841f[_0xb43c('0x5')]({'type':_0xb43c('0x6'),'content':'','variableName':_0xb43c('0x9')});break;}}return _0x3c841f;};exports[_0xb43c('0xa')]=function(_0x3bae16,_0x33bae9){var _0x4221f5=[];switch(_0x3bae16[_0xb43c('0x3')]()){case _0xb43c('0x2'):switch(_0x33bae9[_0xb43c('0x3')]()){case _0xb43c('0x4'):_0x4221f5=[{'type':_0xb43c('0x1'),'content':_0xb43c('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0xd'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x7')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0xe'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0xf')},{'type':'keyValue','content':'','key':_0xb43c('0x10'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x11')},{'type':'keyValue','content':'','key':_0xb43c('0x12'),'keyType':'variable','variableName':_0xb43c('0x13')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x14'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x15')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x16'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x17')},{'type':_0xb43c('0x1'),'content':_0xb43c('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb43c('0x19'),'keyType':_0xb43c('0x6'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0xb43c('0x1a'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x9')},{'type':_0xb43c('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x1b'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x17')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x1c'),'keyType':'variable','variableName':_0xb43c('0x1d')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x1e'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x1f'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x20')},{'type':'keyValue','content':'','key':_0xb43c('0x21'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x22')}];break;case _0xb43c('0x8'):_0x4221f5=[{'type':_0xb43c('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x23'),'keyType':'variable','keyContent':'','variableName':_0xb43c('0x9')},{'type':'keyValue','content':'','key':_0xb43c('0x24'),'keyType':'variable','keyContent':'','variableName':_0xb43c('0x25')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0xb43c('0x15')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x16'),'keyType':_0xb43c('0x6'),'keyContent':'','variableName':_0xb43c('0x26')},{'type':_0xb43c('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x27'),'keyType':_0xb43c('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x28'),'keyType':_0xb43c('0x6'),'keyContent':'','variableName':_0xb43c('0x29')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x2a'),'keyType':'variable','keyContent':'','variableName':_0xb43c('0x2b')},{'type':'keyValue','content':'','key':_0xb43c('0x2c'),'keyType':_0xb43c('0x6'),'keyContent':'','variableName':_0xb43c('0x2d')}];break;}}return _0x4221f5;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 7c20680..074b411 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 _0x4fc4=['user','query','clone','body','phone','fax','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','findOne','then','update','info','error','tracked'];(function(_0x56920e,_0x55fd10){var _0x2804ad=function(_0x472f25){while(--_0x472f25){_0x56920e['push'](_0x56920e['shift']());}};_0x2804ad(++_0x55fd10);}(_0x4fc4,0x8d));var _0x44fc=function(_0xb33d24,_0x5a7117){_0xb33d24=_0xb33d24-0x0;var _0x668c4a=_0x4fc4[_0xb33d24];return _0x668c4a;};'use strict';var _=require(_0x44fc('0x0'));var db=require(_0x44fc('0x1'))['db'];var loggers={'openchannel':require(_0x44fc('0x2'))(_0x44fc('0x3')),'mail':require(_0x44fc('0x2'))(_0x44fc('0x4')),'fax':require(_0x44fc('0x2'))(_0x44fc('0x5')),'sms':require('../../config/logger')(_0x44fc('0x6')),'chat':require(_0x44fc('0x2'))(_0x44fc('0x7')),'whatsapp':require(_0x44fc('0x2'))(_0x44fc('0x8'))};function getInteractionId(_0xa4922,_0x1d17ac,_0x378be0){if(_0xa4922&&_0xa4922[_['upperFirst'](_0x378be0)+'InteractionId']){return _0xa4922[_[_0x44fc('0x9')](_0x378be0)+_0x44fc('0xa')];}else if(_0xa4922&&_0xa4922['id']){return _0xa4922['id'];}else if(_0x1d17ac&&_0x1d17ac['id']){return _0x1d17ac['id'];}else{return'unknown';}}function log(_0x26cda9,_0xa955de,_0x522f22,_0x1fd52e,_0x278d31,_0x28bd91){loggers[_0x278d31[_0x44fc('0xb')]()][_0x26cda9](_0x44fc('0xc'),_0x28bd91['toUpperCase'](),_0xa955de?_0xa955de['id']:null,_0xa955de?_0xa955de[_0x44fc('0xd')]:null,_0xa955de?_0xa955de['role']:null,getInteractionId(_0x522f22,_0x1fd52e,_0x278d31),_0x522f22?JSON[_0x44fc('0xe')](_0x522f22):'null');}function updateUser(_0x356f84,_0x32a6d0,_0x7fc6d1,_0x1b9ce0,_0x59b7fa){db[_['upperFirst'](_0x1b9ce0)+'Interaction'][_0x44fc('0xf')]({'where':{'id':getInteractionId(_0x32a6d0,_0x7fc6d1,_0x1b9ce0)}})[_0x44fc('0x10')](function(_0x44aaa8){if(_0x44aaa8){return _0x44aaa8[_0x44fc('0x11')]({'UserId':_0x356f84?_0x356f84['id']:null});}})[_0x44fc('0x10')](function(_0xf4e321){if(_0xf4e321){log(_0x44fc('0x12'),_0x356f84,_0x32a6d0,_0x7fc6d1,_0x1b9ce0,_0x59b7fa);}})['catch'](function(){log(_0x44fc('0x13'),_0x356f84,_0x32a6d0,_0x7fc6d1,_0x1b9ce0,_0x59b7fa);});}exports[_0x44fc('0x14')]=function(_0xfa1304,_0x16aaa2){return function(_0x1ac498,_0x500223,_0x548df6){var _0x14f221=_0x1ac498[_0x44fc('0x15')];var _0x57e9c5={};var _0x3b7767=_0x1ac498[_0x44fc('0x16')];if(_0x57e9c5){_0x57e9c5=_[_0x44fc('0x17')](_0x1ac498[_0x44fc('0x18')]);_0x57e9c5=_['omit'](_0x57e9c5,[_0x44fc('0x18'),'html',_0x44fc('0x19'),_0x44fc('0x1a'),'mobile']);}updateUser(_0x14f221,_0x57e9c5,_0x3b7767,_0xfa1304,_0x16aaa2);_0x548df6(null);};}; \ No newline at end of file +var _0xb1c4=['omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','error','user','query','clone','body'];(function(_0x4506ec,_0x44543d){var _0x5edc22=function(_0x25d762){while(--_0x25d762){_0x4506ec['push'](_0x4506ec['shift']());}};_0x5edc22(++_0x44543d);}(_0xb1c4,0xf4));var _0x4b1c=function(_0x24b80d,_0x4e1204){_0x24b80d=_0x24b80d-0x0;var _0x33958d=_0xb1c4[_0x24b80d];return _0x33958d;};'use strict';var _=require(_0x4b1c('0x0'));var db=require(_0x4b1c('0x1'))['db'];var loggers={'openchannel':require(_0x4b1c('0x2'))(_0x4b1c('0x3')),'mail':require(_0x4b1c('0x2'))(_0x4b1c('0x4')),'fax':require('../../config/logger')(_0x4b1c('0x5')),'sms':require(_0x4b1c('0x2'))(_0x4b1c('0x6')),'chat':require(_0x4b1c('0x2'))('chat-interactions'),'whatsapp':require(_0x4b1c('0x2'))(_0x4b1c('0x7'))};function getInteractionId(_0x9d51d5,_0x1b21fc,_0x6992ec){if(_0x9d51d5&&_0x9d51d5[_[_0x4b1c('0x8')](_0x6992ec)+'InteractionId']){return _0x9d51d5[_[_0x4b1c('0x8')](_0x6992ec)+'InteractionId'];}else if(_0x9d51d5&&_0x9d51d5['id']){return _0x9d51d5['id'];}else if(_0x1b21fc&&_0x1b21fc['id']){return _0x1b21fc['id'];}else{return _0x4b1c('0x9');}}function log(_0x25eff7,_0xe47525,_0x46c0f9,_0x5a65a2,_0x3d5aaa,_0x413864){loggers[_0x3d5aaa['toLowerCase']()][_0x25eff7](_0x4b1c('0xa'),_0x413864[_0x4b1c('0xb')](),_0xe47525?_0xe47525['id']:null,_0xe47525?_0xe47525[_0x4b1c('0xc')]:null,_0xe47525?_0xe47525[_0x4b1c('0xd')]:null,getInteractionId(_0x46c0f9,_0x5a65a2,_0x3d5aaa),_0x46c0f9?JSON[_0x4b1c('0xe')](_0x46c0f9):_0x4b1c('0xf'));}function updateUser(_0x3d2bba,_0x4fe1d9,_0x42e92a,_0x5995ea,_0x59c008){db[_[_0x4b1c('0x8')](_0x5995ea)+_0x4b1c('0x10')][_0x4b1c('0x11')]({'where':{'id':getInteractionId(_0x4fe1d9,_0x42e92a,_0x5995ea)}})[_0x4b1c('0x12')](function(_0x5e4e0c){if(_0x5e4e0c){return _0x5e4e0c[_0x4b1c('0x13')]({'UserId':_0x3d2bba?_0x3d2bba['id']:null});}})[_0x4b1c('0x12')](function(_0xca8d47){if(_0xca8d47){log(_0x4b1c('0x14'),_0x3d2bba,_0x4fe1d9,_0x42e92a,_0x5995ea,_0x59c008);}})['catch'](function(){log(_0x4b1c('0x15'),_0x3d2bba,_0x4fe1d9,_0x42e92a,_0x5995ea,_0x59c008);});}exports['tracked']=function(_0x56e405,_0x49a532){return function(_0x4d43d6,_0x91807e,_0x29d89d){var _0x55e0aa=_0x4d43d6[_0x4b1c('0x16')];var _0x1ea2c8={};var _0x5a51aa=_0x4d43d6[_0x4b1c('0x17')];if(_0x1ea2c8){_0x1ea2c8=_[_0x4b1c('0x18')](_0x4d43d6[_0x4b1c('0x19')]);_0x1ea2c8=_[_0x4b1c('0x1a')](_0x1ea2c8,[_0x4b1c('0x19'),_0x4b1c('0x1b'),_0x4b1c('0x1c'),'fax',_0x4b1c('0x1d')]);}updateUser(_0x55e0aa,_0x1ea2c8,_0x5a51aa,_0x56e405,_0x49a532);_0x29d89d(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 669a280..b7fd2cc 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 _0x88e5=['format','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','aes-256-ctr','update','base64','utf8','final','parse','hasOwnProperty','License','then','count','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88e5,0x19e));var _0x588e=function(_0x35cb68,_0x9be5c5){_0x35cb68=_0x35cb68-0x0;var _0xee0f0e=_0x88e5[_0x35cb68];return _0xee0f0e;};'use strict';var crypto=require(_0x588e('0x0'));var util=require(_0x588e('0x1'));var compose=require(_0x588e('0x2'));var db=require(_0x588e('0x3'))['db'];var config=require(_0x588e('0x4'));function getValueFromLicense(_0x16a1f9,_0x237c36){if(_0x16a1f9&&_0x237c36){if(_0x237c36[_0x588e('0x5')]&&_0x237c36[_0x588e('0x6')]){var _0x30b92a=_0x237c36[_0x588e('0x5')];var _0x3a939f=_0x237c36[_0x588e('0x6')];var _0x5aff96=_0x30b92a['split']('-')[0x4];var _0x55fbd2=_0x30b92a['split']('-')[0x0];var _0x24de5c=crypto['createDecipher'](_0x588e('0x7'),util['format']('%s:%s:%s',_0x5aff96,_0x30b92a,_0x55fbd2));var _0x17be64=_0x24de5c[_0x588e('0x8')](_0x3a939f,_0x588e('0x9'),_0x588e('0xa'));_0x17be64+=_0x24de5c[_0x588e('0xb')](_0x588e('0xa'));var _0x27000d=JSON[_0x588e('0xc')](_0x17be64);return _0x27000d[_0x588e('0xd')](_0x16a1f9)?_0x27000d[_0x16a1f9]:null;}}return null;}function isLimit(_0x2100e6,_0x5749b1,_0x167cbe,_0x16bd51){var _0x28f71e=_0x5749b1;return compose()['use'](function(_0x1ab0e5,_0x1124fb,_0x3c525f){return db[_0x588e('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0xc2b275){var _0x3943f8=getValueFromLicense(_0x2100e6,_0xc2b275);return _0x3943f8?_0x3943f8:_0x28f71e;})[_0x588e('0xf')](function(_0x2bbf39){_0x28f71e=_0x2bbf39;return _0x167cbe[_0x588e('0x10')](_0x16bd51);})[_0x588e('0xf')](function(_0x2eee19){if(_0x2eee19>=_0x28f71e){return _0x1124fb['status'](0x193)[_0x588e('0x11')]({'message':util[_0x588e('0x12')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2100e6)});}_0x3c525f();})['catch'](function(_0x512e97){_0x3c525f(_0x512e97);});});}function isUserLimit(){return isLimit(_0x588e('0x13'),0x1,db[_0x588e('0x14')],{'where':{'$or':[{'role':_0x588e('0x15')},{'role':_0x588e('0x16')}]}});}exports[_0x588e('0x17')]=isUserLimit; \ No newline at end of file +var _0x7939=['../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','count','status','format','catch','users','user','util','composable-middleware'];(function(_0x5b20e9,_0x277807){var _0x6c4aac=function(_0xc39e42){while(--_0xc39e42){_0x5b20e9['push'](_0x5b20e9['shift']());}};_0x6c4aac(++_0x277807);}(_0x7939,0x11c));var _0x9793=function(_0x6b5a51,_0x1eb40f){_0x6b5a51=_0x6b5a51-0x0;var _0x1b607f=_0x7939[_0x6b5a51];return _0x1b607f;};'use strict';var crypto=require('crypto');var util=require(_0x9793('0x0'));var compose=require(_0x9793('0x1'));var db=require(_0x9793('0x2'))['db'];var config=require(_0x9793('0x3'));function getValueFromLicense(_0x54ad3e,_0x4eb7cf){if(_0x54ad3e&&_0x4eb7cf){if(_0x4eb7cf['data1']&&_0x4eb7cf[_0x9793('0x4')]){var _0xb32c16=_0x4eb7cf[_0x9793('0x5')];var _0x1205a2=_0x4eb7cf[_0x9793('0x4')];var _0x16d3fe=_0xb32c16[_0x9793('0x6')]('-')[0x4];var _0x508f94=_0xb32c16[_0x9793('0x6')]('-')[0x0];var _0x8ab0eb=crypto[_0x9793('0x7')](_0x9793('0x8'),util['format'](_0x9793('0x9'),_0x16d3fe,_0xb32c16,_0x508f94));var _0x59f48e=_0x8ab0eb[_0x9793('0xa')](_0x1205a2,_0x9793('0xb'),'utf8');_0x59f48e+=_0x8ab0eb[_0x9793('0xc')](_0x9793('0xd'));var _0xd68eae=JSON[_0x9793('0xe')](_0x59f48e);return _0xd68eae[_0x9793('0xf')](_0x54ad3e)?_0xd68eae[_0x54ad3e]:null;}}return null;}function isLimit(_0x53a690,_0x4d491d,_0x30ca14,_0x358345){var _0x11589f=_0x4d491d;return compose()[_0x9793('0x10')](function(_0xd31d06,_0x19694f,_0x1b7b8a){return db[_0x9793('0x11')][_0x9793('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x9793('0x13')](function(_0x2467ae){var _0x265da2=getValueFromLicense(_0x53a690,_0x2467ae);return _0x265da2?_0x265da2:_0x11589f;})['then'](function(_0x277e9b){_0x11589f=_0x277e9b;return _0x30ca14[_0x9793('0x14')](_0x358345);})['then'](function(_0x5cf237){if(_0x5cf237>=_0x11589f){return _0x19694f[_0x9793('0x15')](0x193)['json']({'message':util[_0x9793('0x16')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x53a690)});}_0x1b7b8a();})[_0x9793('0x17')](function(_0x41617c){_0x1b7b8a(_0x41617c);});});}function isUserLimit(){return isLimit(_0x9793('0x18'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x9793('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8f55077..d653f8a 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 _0x0c30=['seconds','moment','parseSearch','startsWith','[$or]','replace','[$and]','length','split','slice','shift','match','forEach','filter','indexOf','conditions','DATE','operator','$eq','$between','value','$gt','$lte','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','add','hours','minutes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0c30,0x1d5));var _0x00c3=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x0c30[_0x3cb30b];return _0x2ca717;};'use strict';var _=require('lodash');var moment=require(_0x00c3('0x0'));exports[_0x00c3('0x1')]=function(_0x1e5fd9){var _0x454529={'conditions':[]};_0x454529['sqlOperator']=_[_0x00c3('0x2')](_0x1e5fd9,_0x00c3('0x3'))?'or':'and';var _0x2d3b40=_0x1e5fd9[_0x00c3('0x4')](_0x00c3('0x5'),'')['replace']('[$or]','')['split']('||');for(var _0x5c8972=0x0;_0x5c8972<_0x2d3b40[_0x00c3('0x6')];_0x5c8972++){var _0x2a98b9=_0x2d3b40[_0x5c8972][_0x00c3('0x7')](':=');var _0x456fb2=_0x2a98b9[0x0];var _0x5cc754=_0x2a98b9[_0x00c3('0x8')](0x1);_0x5cc754['forEach'](function(_0x3910a0){var _0x213eed=_0x3910a0['split']('[')[_0x00c3('0x9')]();var _0x33981f=_0x3910a0[_0x00c3('0xa')](/\[(.*?)\]/g);_0x33981f[_0x00c3('0xb')](function(_0x37fbb7){var _0x442651=_0x37fbb7['split']('[')[_0x00c3('0xc')](function(_0x3e8e3f){return _0x3e8e3f[_0x00c3('0xd')](']')>-0x1;})['map'](function(_0xa0ec8c){return _0xa0ec8c[_0x00c3('0x7')](']')[0x0];})[0x0];_0x454529[_0x00c3('0xe')]['push']({'field':_0x456fb2,'operator':_0x213eed,'value':_0x442651});});});}return _0x454529;};exports['buildExpression']=function(_0x1adce5,_0x2be8f8,_0x3ea147){var _0x3a30aa={};if(_0x2be8f8===_0x00c3('0xf')){if(_0x3ea147[_0x00c3('0x10')]===_0x00c3('0x11')){_0x3ea147[_0x00c3('0x10')]=_0x00c3('0x12');_0x3ea147[_0x00c3('0x13')]+=','+_0x3ea147['value'];}else if(_['includes']([_0x00c3('0x14'),_0x00c3('0x15')],_0x3ea147[_0x00c3('0x10')])){_0x3ea147[_0x00c3('0x13')]=moment(_0x3ea147[_0x00c3('0x13')])['add'](0x1,_0x00c3('0x16'))[_0x00c3('0x17')]('YYYY-MM-DD');}}if(_0x3ea147['castTo']){_0x2be8f8=_0x3ea147[_0x00c3('0x18')];_0x3a30aa[_0x00c3('0x19')]=_0x00c3('0x1a')+_0x1adce5+'.'+_0x3ea147[_0x00c3('0x1b')]+_0x00c3('0x1c')+_0x3ea147[_0x00c3('0x18')]+')\x20'+parseOperator(_0x3ea147[_0x00c3('0x10')]);}else{_0x3a30aa[_0x00c3('0x19')]=_0x1adce5+'.'+_0x3ea147[_0x00c3('0x1b')]+'\x20'+parseOperator(_0x3ea147[_0x00c3('0x10')]);}if(_['includes']([_0x00c3('0x1d'),_0x00c3('0x1e')],_0x3ea147[_0x00c3('0x10')]))_0x3a30aa['text']='('+_0x3a30aa[_0x00c3('0x19')]+'\x20OR\x20'+_0x1adce5+'.'+_0x3ea147['field']+'\x20IS\x20NULL)';_0x3a30aa['value']=parseValue(_0x2be8f8,_0x3ea147['operator'],_0x3ea147['value']);return _0x3a30aa;};function parseOperator(_0x79543b){var _0x3d2673;switch(_0x79543b){case _0x00c3('0x1f'):_0x3d2673=_0x00c3('0x20');break;case'$notIn':_0x3d2673=_0x00c3('0x21');break;case _0x00c3('0x11'):_0x3d2673='=\x20?';break;case _0x00c3('0x1d'):_0x3d2673=_0x00c3('0x22');break;case _0x00c3('0x23'):case _0x00c3('0x24'):case _0x00c3('0x25'):_0x3d2673=_0x00c3('0x26');break;case _0x00c3('0x27'):_0x3d2673=_0x00c3('0x28');break;case _0x00c3('0x14'):_0x3d2673=_0x00c3('0x29');break;case _0x00c3('0x15'):_0x3d2673=_0x00c3('0x2a');break;case _0x00c3('0x2b'):_0x3d2673='>=\x20?';break;case _0x00c3('0x12'):_0x3d2673=_0x00c3('0x2c');break;}return _0x3d2673;}function parseValue(_0x5005b1,_0x43273d,_0x36bb5e){var _0x1110dd={'start':undefined,'end':undefined};switch(_0x43273d){case _0x00c3('0x1f'):case _0x00c3('0x1e'):_0x1110dd[_0x00c3('0x2d')]=_0x36bb5e[_0x00c3('0x7')](',');break;case'$substring':_0x1110dd[_0x00c3('0x2d')]='%'+_0x36bb5e+'%';break;case _0x00c3('0x24'):_0x1110dd[_0x00c3('0x2d')]=_0x36bb5e+'%';break;case _0x00c3('0x25'):_0x1110dd[_0x00c3('0x2d')]='%'+_0x36bb5e;break;case _0x00c3('0x12'):var _0x478490=_0x36bb5e[_0x00c3('0x7')](',');var _0x36bb5e=_0x478490[_0x00c3('0x9')]();var _0x348856=_0x478490[_0x00c3('0x2e')]();if(_0x5005b1===_0x00c3('0xf')){_0x36bb5e=moment(_0x36bb5e)[_0x00c3('0x2f')](0x0,!![])['format']();_0x348856=moment(_0x348856)[_0x00c3('0x2f')](0x0,!![])[_0x00c3('0x30')](0x17,_0x00c3('0x31'))[_0x00c3('0x30')](0x3b,_0x00c3('0x32'))[_0x00c3('0x30')](0x3b,_0x00c3('0x33'))[_0x00c3('0x17')]();}_0x1110dd={'start':_0x36bb5e,'end':_0x348856};break;default:_0x1110dd[_0x00c3('0x2d')]=_0x36bb5e;break;}return _0x1110dd;} \ No newline at end of file +var _0xe7d7=['buildExpression','DATE','$between','value','$gt','operator','add','days','format','YYYY-MM-DD','castTo','CAST(','field','$ne','$notIn','text','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','slice','split','match','forEach','filter','indexOf','map','conditions','push'];(function(_0x534f31,_0x37a4ff){var _0x972a94=function(_0x234c5b){while(--_0x234c5b){_0x534f31['push'](_0x534f31['shift']());}};_0x972a94(++_0x37a4ff);}(_0xe7d7,0x99));var _0x7e7d=function(_0xfd4f7e,_0x15d90a){_0xfd4f7e=_0xfd4f7e-0x0;var _0x171d9c=_0xe7d7[_0xfd4f7e];return _0x171d9c;};'use strict';var _=require(_0x7e7d('0x0'));var moment=require('moment');exports[_0x7e7d('0x1')]=function(_0x1134df){var _0x19957a={'conditions':[]};_0x19957a[_0x7e7d('0x2')]=_[_0x7e7d('0x3')](_0x1134df,_0x7e7d('0x4'))?'or':_0x7e7d('0x5');var _0x4c3474=_0x1134df[_0x7e7d('0x6')](_0x7e7d('0x7'),'')[_0x7e7d('0x6')](_0x7e7d('0x4'),'')['split']('||');for(var _0x49ed7f=0x0;_0x49ed7f<_0x4c3474[_0x7e7d('0x8')];_0x49ed7f++){var _0x5a2acd=_0x4c3474[_0x49ed7f]['split'](':=');var _0xcfd285=_0x5a2acd[0x0];var _0x319308=_0x5a2acd[_0x7e7d('0x9')](0x1);_0x319308['forEach'](function(_0x28bec2){var _0x6b358b=_0x28bec2[_0x7e7d('0xa')]('[')['shift']();var _0x10d6c5=_0x28bec2[_0x7e7d('0xb')](/\[(.*?)\]/g);_0x10d6c5[_0x7e7d('0xc')](function(_0x323217){var _0x3b8205=_0x323217[_0x7e7d('0xa')]('[')[_0x7e7d('0xd')](function(_0x367b45){return _0x367b45[_0x7e7d('0xe')](']')>-0x1;})[_0x7e7d('0xf')](function(_0x431112){return _0x431112[_0x7e7d('0xa')](']')[0x0];})[0x0];_0x19957a[_0x7e7d('0x10')][_0x7e7d('0x11')]({'field':_0xcfd285,'operator':_0x6b358b,'value':_0x3b8205});});});}return _0x19957a;};exports[_0x7e7d('0x12')]=function(_0x224c95,_0x48c2bd,_0x47d222){var _0x1dfd9c={};if(_0x48c2bd===_0x7e7d('0x13')){if(_0x47d222['operator']==='$eq'){_0x47d222['operator']=_0x7e7d('0x14');_0x47d222[_0x7e7d('0x15')]+=','+_0x47d222[_0x7e7d('0x15')];}else if(_['includes']([_0x7e7d('0x16'),'$lte'],_0x47d222[_0x7e7d('0x17')])){_0x47d222['value']=moment(_0x47d222[_0x7e7d('0x15')])[_0x7e7d('0x18')](0x1,_0x7e7d('0x19'))[_0x7e7d('0x1a')](_0x7e7d('0x1b'));}}if(_0x47d222[_0x7e7d('0x1c')]){_0x48c2bd=_0x47d222[_0x7e7d('0x1c')];_0x1dfd9c['text']=_0x7e7d('0x1d')+_0x224c95+'.'+_0x47d222[_0x7e7d('0x1e')]+'\x20AS\x20'+_0x47d222[_0x7e7d('0x1c')]+')\x20'+parseOperator(_0x47d222['operator']);}else{_0x1dfd9c['text']=_0x224c95+'.'+_0x47d222['field']+'\x20'+parseOperator(_0x47d222[_0x7e7d('0x17')]);}if(_['includes']([_0x7e7d('0x1f'),_0x7e7d('0x20')],_0x47d222[_0x7e7d('0x17')]))_0x1dfd9c[_0x7e7d('0x21')]='('+_0x1dfd9c[_0x7e7d('0x21')]+'\x20OR\x20'+_0x224c95+'.'+_0x47d222[_0x7e7d('0x1e')]+'\x20IS\x20NULL)';_0x1dfd9c['value']=parseValue(_0x48c2bd,_0x47d222[_0x7e7d('0x17')],_0x47d222['value']);return _0x1dfd9c;};function parseOperator(_0x2b9bdb){var _0x4dec4f;switch(_0x2b9bdb){case _0x7e7d('0x22'):_0x4dec4f=_0x7e7d('0x23');break;case'$notIn':_0x4dec4f=_0x7e7d('0x24');break;case _0x7e7d('0x25'):_0x4dec4f='=\x20?';break;case _0x7e7d('0x1f'):_0x4dec4f=_0x7e7d('0x26');break;case _0x7e7d('0x27'):case _0x7e7d('0x28'):case _0x7e7d('0x29'):_0x4dec4f=_0x7e7d('0x2a');break;case _0x7e7d('0x2b'):_0x4dec4f=_0x7e7d('0x2c');break;case _0x7e7d('0x16'):_0x4dec4f=_0x7e7d('0x2d');break;case'$lte':_0x4dec4f=_0x7e7d('0x2e');break;case _0x7e7d('0x2f'):_0x4dec4f=_0x7e7d('0x30');break;case _0x7e7d('0x14'):_0x4dec4f=_0x7e7d('0x31');break;}return _0x4dec4f;}function parseValue(_0x13d077,_0x18230c,_0x35ea96){var _0x27d062={'start':undefined,'end':undefined};switch(_0x18230c){case'$in':case _0x7e7d('0x20'):_0x27d062[_0x7e7d('0x32')]=_0x35ea96[_0x7e7d('0xa')](',');break;case _0x7e7d('0x27'):_0x27d062[_0x7e7d('0x32')]='%'+_0x35ea96+'%';break;case _0x7e7d('0x28'):_0x27d062[_0x7e7d('0x32')]=_0x35ea96+'%';break;case _0x7e7d('0x29'):_0x27d062[_0x7e7d('0x32')]='%'+_0x35ea96;break;case _0x7e7d('0x14'):var _0x224b5e=_0x35ea96[_0x7e7d('0xa')](',');var _0x35ea96=_0x224b5e[_0x7e7d('0x33')]();var _0x1ecdd5=_0x224b5e[_0x7e7d('0x34')]();if(_0x13d077===_0x7e7d('0x13')){_0x35ea96=moment(_0x35ea96)[_0x7e7d('0x35')](0x0,!![])['format']();_0x1ecdd5=moment(_0x1ecdd5)[_0x7e7d('0x35')](0x0,!![])[_0x7e7d('0x18')](0x17,_0x7e7d('0x36'))['add'](0x3b,_0x7e7d('0x37'))[_0x7e7d('0x18')](0x3b,_0x7e7d('0x38'))[_0x7e7d('0x1a')]();}_0x27d062={'start':_0x35ea96,'end':_0x1ecdd5};break;default:_0x27d062[_0x7e7d('0x32')]=_0x35ea96;break;}return _0x27d062;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 10eb522..93186bb 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 _0x7780=['merge','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','split','limit','offset','sort','map','priority','cast','col','substr','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','isEmail','match','forEach','replace','push','join','getOptions','query','$id','model','attributes','intersection','nolimit','order','where','pick','filter','columns','value'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7780,0xef));var _0x0778=function(_0x5dcae8,_0x14040a){_0x5dcae8=_0x5dcae8-0x0;var _0xa7a0c6=_0x7780[_0x5dcae8];return _0xa7a0c6;};'use strict';var _=require(_0x0778('0x0'));var sequelize=require(_0x0778('0x1'));var moment=require(_0x0778('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x236ead){var _0x3d8273=['ne'];try{var _0x4a2ab1=JSON[_0x0778('0x3')](_0x236ead);var _0x53e87b=Object[_0x0778('0x4')](_0x4a2ab1)[0x0];return _0x3d8273[_0x0778('0x5')](_0x53e87b);}catch(_0x5f51c3){return![];}}function getOperatorValue(_0x1544cf){var _0x31bb98=JSON[_0x0778('0x3')](_0x1544cf);var _0x1142b9=Object[_0x0778('0x4')](_0x31bb98)[0x0];var _0x2f74ae=_0x31bb98[_0x1142b9];return{['$'+_0x1142b9]:_0x2f74ae};}exports[_0x0778('0x6')]=function(_0x231d11){var _0x5c5266=null;if(_0x231d11){_0x5c5266=_0x231d11['split'](',');}return _0x5c5266;};exports[_0x0778('0x7')]=function(_0x2e9812,_0x543874){var _0x1ad8a4={};if(!_[_0x0778('0x8')](_0x2e9812)){_[_0x0778('0x9')](_0x2e9812,function(_0x1ccb86,_0x5b482b){try{if(_0x543874){var _0x50ccce=_[_0x0778('0xa')](_0x543874,{'name':_0x5b482b})||{};if(hasSequelizeOperator(_0x1ccb86)){_0x1ad8a4[_0x5b482b]=getOperatorValue(_0x1ccb86);}else if(_0x50ccce[_0x0778('0xb')]==='DATE'&&_[_0x0778('0xc')](_0x1ccb86)){var _0x1b0411=JSON[_0x0778('0x3')](_0x1ccb86);var _0x350fe2={'$gte':moment(moment(_0x1b0411[_0x0778('0xd')])['format'](_0x0778('0xe')))[_0x0778('0xf')]()[_0x0778('0x10')](),'$lte':moment(moment(_0x1b0411['$lte'])[_0x0778('0x10')](_0x0778('0xe')))['utc']()[_0x0778('0x11')](0x1,'s')[_0x0778('0x10')]()};_0x1ad8a4[_0x5b482b]=_0x350fe2;}else if(_0x50ccce[_0x0778('0x12')]===_0x0778('0x13')){_0x1ad8a4[_0x5b482b]=_0x1ccb86;}else{_0x1ad8a4[_0x5b482b]=_[_0x0778('0x14')](_0x1ccb86)?_0x1ccb86:JSON[_0x0778('0x3')](_0x1ccb86);}}else{_0x1ad8a4[_0x5b482b]=_['isArray'](_0x1ccb86)?_0x1ccb86:JSON[_0x0778('0x3')](_0x1ccb86);}}catch(_0x525955){_0x1ad8a4[_0x5b482b]=_0x1ccb86[_0x0778('0x15')](',');}});}return _0x1ad8a4;};exports[_0x0778('0x16')]=function(_0x34191a){_0x34191a=parseInt(_0x34191a,0xa);if(!_0x34191a||_0x34191a<0x0){_0x34191a=LIMIT_VALUE;}return _0x34191a;};exports[_0x0778('0x17')]=function(_0x5a0cb6){_0x5a0cb6=parseInt(_0x5a0cb6,0xa);if(!_0x5a0cb6||_0x5a0cb6<0x0){_0x5a0cb6=0x0;}return _0x5a0cb6;};exports[_0x0778('0x18')]=function(_0x5a77b5){var _0x17c817,_0x5a0d55=null;if(_0x5a77b5){_0x17c817=_0x5a77b5[_0x0778('0x15')](',');_0x5a0d55=_[_0x0778('0x19')](_0x17c817,function(_0x95cc34){if(_0x95cc34['indexOf']('-')===0x0){return[_0x95cc34===_0x0778('0x1a')?sequelize[_0x0778('0x1b')](sequelize[_0x0778('0x1c')]('priority'),'unsigned'):_0x95cc34[_0x0778('0x1d')](0x1),'DESC'];}else{return[_0x95cc34===_0x0778('0x1a')?sequelize[_0x0778('0x1b')](sequelize[_0x0778('0x1c')](_0x0778('0x1a')),'unsigned'):_0x95cc34,'ASC'];}});}return _0x5a0d55;};exports[_0x0778('0x1e')]=function(_0x2ed913,_0x2ce9b3){if(_[_0x0778('0x8')](_0x2ed913)){return _0x2ed913;}if(_[_0x0778('0x14')](_0x2ed913)){for(var _0x1079d8=0x0;_0x1079d8<_0x2ed913['length'];_0x1079d8+=0x1){_0x2ed913[_0x1079d8]=this[_0x0778('0x1e')](_0x2ed913[_0x1079d8],_0x2ce9b3);}return _0x2ed913;}if(!_[_0x0778('0x1f')](_0x2ed913)){return _0x2ed913;}if(_[_0x0778('0x20')](_0x2ce9b3)){_0x2ce9b3=[_0x2ce9b3];}if(!_[_0x0778('0x14')](_0x2ce9b3)){return _0x2ed913;}for(var _0x207031=0x0;_0x207031<_0x2ce9b3[_0x0778('0x21')];_0x207031+=0x1){_[_0x0778('0x22')](_0x2ed913,_0x2ce9b3[_0x207031]);}for(var _0x59b889 in _0x2ed913){if(_0x2ed913[_0x0778('0x23')](_0x59b889)){_0x2ed913[_0x59b889]=this['omit'](_0x2ed913[_0x59b889],_0x2ce9b3);}}return _0x2ed913;};exports[_0x0778('0x24')]=function(_0x540998){return _0x540998['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x0778('0x25')]=function(_0x2ceb6f){return _0x2ceb6f[_0x0778('0x26')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0xa7d003){var _0x15c56c=[];_0xa7d003[_0x0778('0x15')](/[ ,]+/)[_0x0778('0x27')](function(_0x1c58f2){_0x1c58f2=_0x1c58f2[_0x0778('0x28')](/([^:]")"+/g,'$1');_0x1c58f2='+'+_0x1c58f2+'*';if(_0x1c58f2[_0x0778('0x5')]('@'))_0x1c58f2='\x22'+_0x1c58f2+'\x22';_0x15c56c[_0x0778('0x29')](_0x1c58f2);});return _0x15c56c[_0x0778('0x2a')]('\x20');};exports[_0x0778('0x2b')]=function(_0x5a3048,_0x4c7688,_0x5b489b){var _0x4a09ce={},_0x67d1c4={};if(_0x4c7688[_0x0778('0x2c')][_0x0778('0x2d')]){_0x4c7688[_0x0778('0x2c')]['id']=_0x4c7688['query'][_0x0778('0x2d')];delete _0x4c7688['query']['$id'];}_0x4a09ce[_0x0778('0x2e')]=_[_0x0778('0x19')](_0x5a3048,_0x0778('0x12'));_0x4a09ce['query']=_[_0x0778('0x4')](_0x4c7688[_0x0778('0x2c')]);_0x4a09ce[_0x0778('0x7')]=_['intersection'](_0x4a09ce[_0x0778('0x2e')],_0x4a09ce['query']);_0x67d1c4[_0x0778('0x2f')]=_[_0x0778('0x30')](_0x4a09ce['model'],this[_0x0778('0x6')](_0x4c7688[_0x0778('0x2c')][_0x0778('0x6')]));_0x67d1c4['attributes']=_0x67d1c4[_0x0778('0x2f')][_0x0778('0x21')]?_0x67d1c4['attributes']:_0x4a09ce['model'];if(!_0x4c7688[_0x0778('0x2c')][_0x0778('0x23')](_0x0778('0x31'))){_0x67d1c4[_0x0778('0x16')]=this['limit'](_0x4c7688['query'][_0x0778('0x16')]);_0x67d1c4['offset']=this[_0x0778('0x17')](_0x4c7688[_0x0778('0x2c')][_0x0778('0x17')]);}_0x67d1c4[_0x0778('0x32')]=this[_0x0778('0x18')](_0x4c7688[_0x0778('0x2c')][_0x0778('0x18')]);_0x67d1c4[_0x0778('0x33')]=this[_0x0778('0x7')](_[_0x0778('0x34')](_0x4c7688[_0x0778('0x2c')],_0x4a09ce[_0x0778('0x7')]),_0x5a3048);if(_0x4c7688[_0x0778('0x2c')][_0x0778('0x35')]){var _0x495c47=_0x5a3048;var _0x4566d2=_0x4c7688[_0x0778('0x2c')]['filter'];if(typeof _0x4566d2==='object'){_0x495c47=_[_0x0778('0x35')](_0x5a3048,function(_0x12c0b5){return _[_0x0778('0x5')](_0x4566d2[_0x0778('0x36')],_0x12c0b5[_0x0778('0x12')]);});_0x4566d2=_0x4566d2[_0x0778('0x37')];}_0x67d1c4[_0x0778('0x33')]=_[_0x0778('0x38')](_0x67d1c4['where'],{'$or':_[_0x0778('0x19')](_0x495c47,function(_0x58a1b4){if(_0x58a1b4['type']!=='VIRTUAL'){if(_0x5b489b){return sequelize[_0x0778('0x33')](sequelize['fn'](_0x0778('0x39'),sequelize[_0x0778('0x1c')](_0x58a1b4[_0x0778('0x12')])),{'$like':sequelize['fn'](_0x0778('0x39'),'%'+_0x4c7688[_0x0778('0x2c')][_0x0778('0x35')]+'%')});}else{var _0x4d5a16={};_0x4d5a16[_0x58a1b4[_0x0778('0x12')]]={'$like':'%'+_0x4c7688[_0x0778('0x2c')]['filter']+'%'};return _0x4d5a16;}}})});}_0x67d1c4=_['merge']({},_0x67d1c4,_0x4c7688[_0x0778('0x3a')]);return _0x67d1c4;}; \ No newline at end of file +var _0xe6ae=['parse','keys','fields','filters','isEmpty','find','type','DATE','utc','$lte','format','YYYY-MM-DD','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','col','substr','unsigned','ASC','omit','length','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','push','join','query','$id','model','intersection','attributes','where','filter','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xe6ae,0x1e3));var _0xee6a=function(_0x5ec8ef,_0x390c91){_0x5ec8ef=_0x5ec8ef-0x0;var _0x25898a=_0xe6ae[_0x5ec8ef];return _0x25898a;};'use strict';var _=require(_0xee6a('0x0'));var sequelize=require(_0xee6a('0x1'));var moment=require(_0xee6a('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xbf9e06){var _0x313531=['ne'];try{var _0x3553f3=JSON[_0xee6a('0x3')](_0xbf9e06);var _0x3a4534=Object[_0xee6a('0x4')](_0x3553f3)[0x0];return _0x313531['includes'](_0x3a4534);}catch(_0x4c07ca){return![];}}function getOperatorValue(_0x8133b2){var _0x4ddcc0=JSON[_0xee6a('0x3')](_0x8133b2);var _0x3def71=Object['keys'](_0x4ddcc0)[0x0];var _0x3d2709=_0x4ddcc0[_0x3def71];return{['$'+_0x3def71]:_0x3d2709};}exports[_0xee6a('0x5')]=function(_0x36f4f5){var _0x5f1016=null;if(_0x36f4f5){_0x5f1016=_0x36f4f5['split'](',');}return _0x5f1016;};exports[_0xee6a('0x6')]=function(_0x3740b8,_0x23946b){var _0x4ac38a={};if(!_[_0xee6a('0x7')](_0x3740b8)){_['forOwn'](_0x3740b8,function(_0x4bdab2,_0x5e5fc6){try{if(_0x23946b){var _0x1c6dcd=_[_0xee6a('0x8')](_0x23946b,{'name':_0x5e5fc6})||{};if(hasSequelizeOperator(_0x4bdab2)){_0x4ac38a[_0x5e5fc6]=getOperatorValue(_0x4bdab2);}else if(_0x1c6dcd[_0xee6a('0x9')]===_0xee6a('0xa')&&_['isPlainObject'](_0x4bdab2)){var _0x8379a=JSON[_0xee6a('0x3')](_0x4bdab2);var _0x575296={'$gte':moment(moment(_0x8379a['$gte'])['format']('YYYY-MM-DD'))[_0xee6a('0xb')]()['format'](),'$lte':moment(moment(_0x8379a[_0xee6a('0xc')])[_0xee6a('0xd')](_0xee6a('0xe')))['utc']()['subtract'](0x1,'s')['format']()};_0x4ac38a[_0x5e5fc6]=_0x575296;}else if(_0x1c6dcd[_0xee6a('0xf')]===_0xee6a('0x10')){_0x4ac38a[_0x5e5fc6]=_0x4bdab2;}else{_0x4ac38a[_0x5e5fc6]=_[_0xee6a('0x11')](_0x4bdab2)?_0x4bdab2:JSON[_0xee6a('0x3')](_0x4bdab2);}}else{_0x4ac38a[_0x5e5fc6]=_[_0xee6a('0x11')](_0x4bdab2)?_0x4bdab2:JSON[_0xee6a('0x3')](_0x4bdab2);}}catch(_0xb3089){_0x4ac38a[_0x5e5fc6]=_0x4bdab2[_0xee6a('0x12')](',');}});}return _0x4ac38a;};exports[_0xee6a('0x13')]=function(_0x30dce2){_0x30dce2=parseInt(_0x30dce2,0xa);if(!_0x30dce2||_0x30dce2<0x0){_0x30dce2=LIMIT_VALUE;}return _0x30dce2;};exports[_0xee6a('0x14')]=function(_0x27a17e){_0x27a17e=parseInt(_0x27a17e,0xa);if(!_0x27a17e||_0x27a17e<0x0){_0x27a17e=0x0;}return _0x27a17e;};exports[_0xee6a('0x15')]=function(_0x5910e8){var _0x9e6f5,_0x41194f=null;if(_0x5910e8){_0x9e6f5=_0x5910e8[_0xee6a('0x12')](',');_0x41194f=_[_0xee6a('0x16')](_0x9e6f5,function(_0x1b7f78){if(_0x1b7f78[_0xee6a('0x17')]('-')===0x0){return[_0x1b7f78===_0xee6a('0x18')?sequelize['cast'](sequelize[_0xee6a('0x19')](_0xee6a('0x18')),'unsigned'):_0x1b7f78[_0xee6a('0x1a')](0x1),'DESC'];}else{return[_0x1b7f78===_0xee6a('0x18')?sequelize['cast'](sequelize[_0xee6a('0x19')]('priority'),_0xee6a('0x1b')):_0x1b7f78,_0xee6a('0x1c')];}});}return _0x41194f;};exports[_0xee6a('0x1d')]=function(_0x132d38,_0x3a7a79){if(_['isEmpty'](_0x132d38)){return _0x132d38;}if(_[_0xee6a('0x11')](_0x132d38)){for(var _0x2ac8c7=0x0;_0x2ac8c7<_0x132d38[_0xee6a('0x1e')];_0x2ac8c7+=0x1){_0x132d38[_0x2ac8c7]=this[_0xee6a('0x1d')](_0x132d38[_0x2ac8c7],_0x3a7a79);}return _0x132d38;}if(!_['isObject'](_0x132d38)){return _0x132d38;}if(_['isString'](_0x3a7a79)){_0x3a7a79=[_0x3a7a79];}if(!_[_0xee6a('0x11')](_0x3a7a79)){return _0x132d38;}for(var _0x225a79=0x0;_0x225a79<_0x3a7a79[_0xee6a('0x1e')];_0x225a79+=0x1){_[_0xee6a('0x1f')](_0x132d38,_0x3a7a79[_0x225a79]);}for(var _0x432b7e in _0x132d38){if(_0x132d38[_0xee6a('0x20')](_0x432b7e)){_0x132d38[_0x432b7e]=this[_0xee6a('0x1d')](_0x132d38[_0x432b7e],_0x3a7a79);}}return _0x132d38;};exports['isNumeric']=function(_0x2f0e0f){return _0x2f0e0f[_0xee6a('0x21')](RegExp(_0xee6a('0x22')))?!![]:![];};exports[_0xee6a('0x23')]=function(_0x4b4057){return _0x4b4057['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xee6a('0x24')]=function(_0xef6d5b){var _0xa411ff=[];_0xef6d5b['split'](/[ ,]+/)[_0xee6a('0x25')](function(_0xac9d74){_0xac9d74=_0xac9d74['replace'](/([^:]")"+/g,'$1');_0xac9d74='+'+_0xac9d74+'*';if(_0xac9d74[_0xee6a('0x26')]('@'))_0xac9d74='\x22'+_0xac9d74+'\x22';_0xa411ff[_0xee6a('0x27')](_0xac9d74);});return _0xa411ff[_0xee6a('0x28')]('\x20');};exports['getOptions']=function(_0x5a00c2,_0x197f2f,_0x32669e){var _0x479e23={},_0x34195a={};if(_0x197f2f[_0xee6a('0x29')][_0xee6a('0x2a')]){_0x197f2f[_0xee6a('0x29')]['id']=_0x197f2f[_0xee6a('0x29')][_0xee6a('0x2a')];delete _0x197f2f['query'][_0xee6a('0x2a')];}_0x479e23[_0xee6a('0x2b')]=_[_0xee6a('0x16')](_0x5a00c2,_0xee6a('0xf'));_0x479e23[_0xee6a('0x29')]=_[_0xee6a('0x4')](_0x197f2f[_0xee6a('0x29')]);_0x479e23['filters']=_['intersection'](_0x479e23['model'],_0x479e23['query']);_0x34195a['attributes']=_[_0xee6a('0x2c')](_0x479e23[_0xee6a('0x2b')],this[_0xee6a('0x5')](_0x197f2f[_0xee6a('0x29')]['fields']));_0x34195a[_0xee6a('0x2d')]=_0x34195a[_0xee6a('0x2d')][_0xee6a('0x1e')]?_0x34195a[_0xee6a('0x2d')]:_0x479e23[_0xee6a('0x2b')];if(!_0x197f2f[_0xee6a('0x29')][_0xee6a('0x20')]('nolimit')){_0x34195a[_0xee6a('0x13')]=this[_0xee6a('0x13')](_0x197f2f['query'][_0xee6a('0x13')]);_0x34195a[_0xee6a('0x14')]=this[_0xee6a('0x14')](_0x197f2f[_0xee6a('0x29')][_0xee6a('0x14')]);}_0x34195a['order']=this[_0xee6a('0x15')](_0x197f2f[_0xee6a('0x29')][_0xee6a('0x15')]);_0x34195a[_0xee6a('0x2e')]=this['filters'](_['pick'](_0x197f2f[_0xee6a('0x29')],_0x479e23['filters']),_0x5a00c2);if(_0x197f2f[_0xee6a('0x29')][_0xee6a('0x2f')]){var _0x44245f=_0x5a00c2;var _0x4e3ab5=_0x197f2f['query'][_0xee6a('0x2f')];if(typeof _0x4e3ab5==='object'){_0x44245f=_[_0xee6a('0x2f')](_0x5a00c2,function(_0xd2af16){return _[_0xee6a('0x26')](_0x4e3ab5[_0xee6a('0x30')],_0xd2af16['name']);});_0x4e3ab5=_0x4e3ab5[_0xee6a('0x31')];}_0x34195a[_0xee6a('0x2e')]=_[_0xee6a('0x32')](_0x34195a[_0xee6a('0x2e')],{'$or':_[_0xee6a('0x16')](_0x44245f,function(_0x494228){if(_0x494228[_0xee6a('0x9')]!==_0xee6a('0x33')){if(_0x32669e){return sequelize[_0xee6a('0x2e')](sequelize['fn'](_0xee6a('0x34'),sequelize['col'](_0x494228[_0xee6a('0xf')])),{'$like':sequelize['fn'](_0xee6a('0x34'),'%'+_0x197f2f[_0xee6a('0x29')][_0xee6a('0x2f')]+'%')});}else{var _0x4f6793={};_0x4f6793[_0x494228[_0xee6a('0xf')]]={'$like':'%'+_0x197f2f[_0xee6a('0x29')]['filter']+'%'};return _0x4f6793;}}})});}_0x34195a=_['merge']({},_0x34195a,_0x197f2f[_0xee6a('0x35')]);return _0x34195a;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 2bb2159..934c420 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28c0=['./environment','default','get','env','production','set','join','root','public','test','appPath','client','use','json\x20replacer','split','views','/server/views','engine','html','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','cors','moment'];(function(_0x4a7062,_0x244139){var _0x1b55a4=function(_0x33194c){while(--_0x33194c){_0x4a7062['push'](_0x4a7062['shift']());}};_0x1b55a4(++_0x244139);}(_0x28c0,0x178));var _0x028c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x28c0[_0x53ccf2];return _0x5a2964;};'use strict';var express=require(_0x028c('0x0'));var favicon=require(_0x028c('0x1'));var bodyParser=require(_0x028c('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x028c('0x3'));var errorHandler=require(_0x028c('0x4'));var path=require(_0x028c('0x5'));var passport=require('passport');var cors=require(_0x028c('0x6'));var moment=require(_0x028c('0x7'));var config=require(_0x028c('0x8'));var db=require('../mysqldb')['db'];exports[_0x028c('0x9')]=function(_0x493b8f){var _0x1b0e33=_0x493b8f[_0x028c('0xa')](_0x028c('0xb'));if(_0x1b0e33===_0x028c('0xc')){_0x493b8f[_0x028c('0xd')]('appPath',path[_0x028c('0xe')](config[_0x028c('0xf')],_0x028c('0x10')));}if(_0x1b0e33==='development'||_0x1b0e33===_0x028c('0x11')){_0x493b8f[_0x028c('0xd')](_0x028c('0x12'),path[_0x028c('0xe')](config['root'],_0x028c('0x13')));_0x493b8f[_0x028c('0x14')](errorHandler());}_0x493b8f[_0x028c('0xd')](_0x028c('0x15'),function(_0x4542d3,_0x1c578e){if(this[_0x4542d3]instanceof Date){_0x1c578e=this[_0x4542d3]['toISOString']()[_0x028c('0x16')]('.')[0x0]+'Z';}return _0x1c578e;});_0x493b8f[_0x028c('0x14')](express['static'](_0x493b8f[_0x028c('0xa')](_0x028c('0x12'))));_0x493b8f['set'](_0x028c('0x17'),config[_0x028c('0xf')]+_0x028c('0x18'));_0x493b8f[_0x028c('0x19')](_0x028c('0x1a'),require('ejs')['renderFile']);_0x493b8f[_0x028c('0xd')](_0x028c('0x1b'),'html');_0x493b8f[_0x028c('0x14')](bodyParser[_0x028c('0x1c')]({'limit':_0x028c('0x1d'),'extended':!![]}));_0x493b8f[_0x028c('0x14')](bodyParser[_0x028c('0x1e')]({'limit':_0x028c('0x1d')}));_0x493b8f[_0x028c('0x14')](cors());_0x493b8f[_0x028c('0x14')](methodOverride());_0x493b8f[_0x028c('0x14')](cookieParser());_0x493b8f[_0x028c('0x14')](passport[_0x028c('0x1f')]());}; \ No newline at end of file +var _0xafbf=['set','appPath','join','root','public','development','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','default','get','env'];(function(_0x23745a,_0x4180d9){var _0x5f2f2b=function(_0x25b326){while(--_0x25b326){_0x23745a['push'](_0x23745a['shift']());}};_0x5f2f2b(++_0x4180d9);}(_0xafbf,0x151));var _0xfafb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xafbf[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0xfafb('0x0'));var favicon=require(_0xfafb('0x1'));var bodyParser=require(_0xfafb('0x2'));var methodOverride=require(_0xfafb('0x3'));var cookieParser=require(_0xfafb('0x4'));var errorHandler=require(_0xfafb('0x5'));var path=require(_0xfafb('0x6'));var passport=require('passport');var cors=require(_0xfafb('0x7'));var moment=require(_0xfafb('0x8'));var config=require(_0xfafb('0x9'));var db=require('../mysqldb')['db'];exports[_0xfafb('0xa')]=function(_0x1e2d33){var _0x2963e9=_0x1e2d33[_0xfafb('0xb')](_0xfafb('0xc'));if(_0x2963e9==='production'){_0x1e2d33[_0xfafb('0xd')](_0xfafb('0xe'),path[_0xfafb('0xf')](config[_0xfafb('0x10')],_0xfafb('0x11')));}if(_0x2963e9===_0xfafb('0x12')||_0x2963e9==='test'){_0x1e2d33[_0xfafb('0xd')](_0xfafb('0xe'),path[_0xfafb('0xf')](config[_0xfafb('0x10')],_0xfafb('0x13')));_0x1e2d33[_0xfafb('0x14')](errorHandler());}_0x1e2d33[_0xfafb('0xd')](_0xfafb('0x15'),function(_0x29e819,_0x667051){if(this[_0x29e819]instanceof Date){_0x667051=this[_0x29e819][_0xfafb('0x16')]()[_0xfafb('0x17')]('.')[0x0]+'Z';}return _0x667051;});_0x1e2d33[_0xfafb('0x14')](express[_0xfafb('0x18')](_0x1e2d33['get']('appPath')));_0x1e2d33[_0xfafb('0xd')]('views',config[_0xfafb('0x10')]+_0xfafb('0x19'));_0x1e2d33[_0xfafb('0x1a')](_0xfafb('0x1b'),require(_0xfafb('0x1c'))[_0xfafb('0x1d')]);_0x1e2d33[_0xfafb('0xd')](_0xfafb('0x1e'),'html');_0x1e2d33[_0xfafb('0x14')](bodyParser[_0xfafb('0x1f')]({'limit':_0xfafb('0x20'),'extended':!![]}));_0x1e2d33[_0xfafb('0x14')](bodyParser[_0xfafb('0x21')]({'limit':_0xfafb('0x20')}));_0x1e2d33[_0xfafb('0x14')](cors());_0x1e2d33[_0xfafb('0x14')](methodOverride());_0x1e2d33[_0xfafb('0x14')](cookieParser());_0x1e2d33[_0xfafb('0x14')](passport[_0xfafb('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0dd3955..2379768 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 _0x6600=['dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','createHash','md5','update','digest','hex','platform','licenseToken'];(function(_0x5a1119,_0x4552fa){var _0x1d9835=function(_0x150e6f){while(--_0x150e6f){_0x5a1119['push'](_0x5a1119['shift']());}};_0x1d9835(++_0x4552fa);}(_0x6600,0x146));var _0x0660=function(_0x256817,_0x4f71a1){_0x256817=_0x256817-0x0;var _0x4e89f1=_0x6600[_0x256817];return _0x4e89f1;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x0660('0x0'));var exec=require(_0x0660('0x1'))[_0x0660('0x2')];var config=require(_0x0660('0x3'));function getInterfaces(){var _0x340f5d=[];var _0x5ca4f7=os[_0x0660('0x4')]();var _0x5d6199=_[_0x0660('0x5')](_['keys'](_0x5ca4f7));for(var _0x31f1e1=0x0;_0x31f1e1<_0x5d6199['length'];_0x31f1e1++){var _0x5c83ed=_0x5ca4f7[_0x5d6199[_0x31f1e1]][_0x0660('0x6')](function(_0x1c3977){return _0x1c3977[_0x0660('0x7')]===_0x0660('0x8')&&_0x1c3977[_0x0660('0x9')]===![];});_0x340f5d=_0x340f5d[_0x0660('0xa')](_0x5c83ed);}return _0x340f5d;}function getFirstInterface(){var _0x2ef192=_[_0x0660('0xb')](getInterfaces());return{'macAddress':_0x2ef192&&_0x2ef192['mac']?_0x2ef192[_0x0660('0xc')]:_0x0660('0xd'),'ipAddress':_0x2ef192&&_0x2ef192[_0x0660('0xe')]?_0x2ef192[_0x0660('0xe')]:_0x0660('0xf')};}exports[_0x0660('0x10')]=getFirstInterface;function getCPUhash(){var _0x3bf338=_[_0x0660('0x5')](os['cpus']()[_0x0660('0x11')](function(_0x8c77f9){return _0x8c77f9[_0x0660('0x12')];}))['join'](':');return crypto[_0x0660('0x13')](_0x0660('0x14'))[_0x0660('0x15')](_0x3bf338)[_0x0660('0x16')](_0x0660('0x17'));}exports['getUuid']=function(){var _0x142bb7=os[_0x0660('0x18')]();var _0x573c0e=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x573c0e['test'](config['licenseToken'])){return config[_0x0660('0x19')];}else if(_0x142bb7==='win32'){return exec(_0x0660('0x1a'),{'encoding':_0x0660('0x1b')})['replace']('\x0d\x0a','');}else{var _0x460f78=getFirstInterface();var _0x6c6c7b=getCPUhash();var _0x40acc0=_0x6c6c7b+'|'+os[_0x0660('0x1c')]()+'|'+_0x460f78[_0x0660('0x1d')]+'|'+_0x460f78[_0x0660('0x1e')];var _0x391ec0=crypto['createHash'](_0x0660('0x14'))['update'](_0x40acc0)[_0x0660('0x16')](_0x0660('0x17'));return _0x391ec0[_0x0660('0x1f')](0x0,0x8)+'-'+_0x391ec0[_0x0660('0x1f')](0x8,0xc)+'-'+_0x391ec0[_0x0660('0x1f')](0xc,0x10)+'-'+_0x391ec0[_0x0660('0x1f')](0x10,0x14)+'-'+_0x391ec0[_0x0660('0x1f')](0x14);}}; \ No newline at end of file +var _0x7ddb=['hex','substring','lodash','crypto','bimedia-machine-uuid','../environment','keys','filter','family','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','update','digest','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ddb,0x68));var _0xb7dd=function(_0xdae136,_0x256a9e){_0xdae136=_0xdae136-0x0;var _0x432764=_0x7ddb[_0xdae136];return _0x432764;};'use strict';var _=require(_0xb7dd('0x0'));var os=require('os');var crypto=require(_0xb7dd('0x1'));var machine=require(_0xb7dd('0x2'));var exec=require('child_process')['execSync'];var config=require(_0xb7dd('0x3'));function getInterfaces(){var _0xc532c2=[];var _0x10a1b7=os['networkInterfaces']();var _0x16b2a4=_['orderBy'](_[_0xb7dd('0x4')](_0x10a1b7));for(var _0x1ac8c7=0x0;_0x1ac8c7<_0x16b2a4['length'];_0x1ac8c7++){var _0x576f56=_0x10a1b7[_0x16b2a4[_0x1ac8c7]][_0xb7dd('0x5')](function(_0x103c33){return _0x103c33[_0xb7dd('0x6')]==='IPv4'&&_0x103c33['internal']===![];});_0xc532c2=_0xc532c2[_0xb7dd('0x7')](_0x576f56);}return _0xc532c2;}function getFirstInterface(){var _0x53d17a=_[_0xb7dd('0x8')](getInterfaces());return{'macAddress':_0x53d17a&&_0x53d17a['mac']?_0x53d17a['mac']:_0xb7dd('0x9'),'ipAddress':_0x53d17a&&_0x53d17a[_0xb7dd('0xa')]?_0x53d17a[_0xb7dd('0xa')]:_0xb7dd('0xb')};}exports[_0xb7dd('0xc')]=getFirstInterface;function getCPUhash(){var _0x4db127=_[_0xb7dd('0xd')](os[_0xb7dd('0xe')]()[_0xb7dd('0xf')](function(_0xdaeade){return _0xdaeade[_0xb7dd('0x10')];}))[_0xb7dd('0x11')](':');return crypto[_0xb7dd('0x12')]('md5')[_0xb7dd('0x13')](_0x4db127)[_0xb7dd('0x14')]('hex');}exports[_0xb7dd('0x15')]=function(){var _0x1aa112=os[_0xb7dd('0x16')]();var _0xedeb17=/[0-9a-f-]{36}/;if(config[_0xb7dd('0x17')]&&_0xedeb17[_0xb7dd('0x18')](config['licenseToken'])){return config[_0xb7dd('0x17')];}else if(_0x1aa112==='win32'){return exec(_0xb7dd('0x19'),{'encoding':_0xb7dd('0x1a')})[_0xb7dd('0x1b')]('\x0d\x0a','');}else{var _0x178f50=getFirstInterface();var _0x56b136=getCPUhash();var _0x5fcb0f=_0x56b136+'|'+os[_0xb7dd('0x1c')]()+'|'+_0x178f50[_0xb7dd('0x1d')]+'|'+_0x178f50[_0xb7dd('0x1e')];var _0x178ec8=crypto[_0xb7dd('0x12')](_0xb7dd('0x1f'))[_0xb7dd('0x13')](_0x5fcb0f)[_0xb7dd('0x14')](_0xb7dd('0x20'));return _0x178ec8[_0xb7dd('0x21')](0x0,0x8)+'-'+_0x178ec8[_0xb7dd('0x21')](0x8,0xc)+'-'+_0x178ec8['substring'](0xc,0x10)+'-'+_0x178ec8['substring'](0x10,0x14)+'-'+_0x178ec8[_0xb7dd('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 5c427c8..1ad67ef 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 _0xcbf2=['SERVICE\x20LICENSE\x20STARTED\x20%s','catch','default','util','moment','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','days','update','error','message','getUuid','License'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbf2,0xad));var _0x2cbf=function(_0xa0057f,_0x5b1918){_0xa0057f=_0xa0057f-0x0;var _0xfd9f8f=_0xcbf2[_0xa0057f];return _0xfd9f8f;};'use strict';var util=require(_0x2cbf('0x0'));var moment=require(_0x2cbf('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x2cbf('0x2'));var db=require(_0x2cbf('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x2cbf('0x4'));var logger=require(_0x2cbf('0x5'))(_0x2cbf('0x6'));var HOST=_0x2cbf('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x29c6c5){return new BPromise(function(_0x1b4502,_0x3e74fe){var _0x24beec=util[_0x2cbf('0x8')](_0x2cbf('0x9'),HOST,_0x29c6c5,module[_0x2cbf('0xa')][_0x2cbf('0x2')]);if(oldToken){_0x24beec=util[_0x2cbf('0x8')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x29c6c5,module['exports'][_0x2cbf('0x2')],oldToken);}var _0x439b56={'uri':_0x24beec,'method':_0x2cbf('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x439b56)[_0x2cbf('0xc')](function(_0xd5142){_0x1b4502(_0xd5142);})['catch'](function(_0x46d63b){_0x3e74fe(_0x46d63b);});});}function manageLicense(_0x14e95a,_0x34b858){var _0x1ccebf=_0x34b858[_0x2cbf('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x1ccebf[_0x2cbf('0xe')]!==_0x14e95a&&!_0x1ccebf[_0x2cbf('0xf')]){oldToken=_0x1ccebf[_0x2cbf('0xe')];}httpRequest(_0x14e95a)[_0x2cbf('0xc')](function(_0x1495de){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1495de[_0x2cbf('0x10')]){isOldTokenSent=![];if(!_0x1ccebf[_0x2cbf('0x6')]&&_0x1ccebf[_0x2cbf('0x6')]!=_0x1495de[_0x2cbf('0x6')]||_0x1ccebf[_0x2cbf('0x6')]&&_0x1ccebf[_0x2cbf('0xf')]){logger[_0x2cbf('0x11')](_0x2cbf('0x12'));}if(_0x1ccebf[_0x2cbf('0x6')]&&!_0x1ccebf['data2']&&_0x1ccebf['license']!=_0x1495de[_0x2cbf('0x6')]){logger[_0x2cbf('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x1ccebf[_0x2cbf('0x6')]&&!_0x1ccebf[_0x2cbf('0xf')]&&_0x1ccebf[_0x2cbf('0x6')]==_0x1495de['license']){return _0x34b858;}return _0x34b858['update']({'data1':_0x14e95a,'data2':null,'license':_0x1495de['license']});}else{if(_0x1495de[_0x2cbf('0x6')]||_0x1ccebf[_0x2cbf('0x6')]){if(!_0x1ccebf[_0x2cbf('0xf')]){if(_0x1ccebf[_0x2cbf('0xe')]==_0x14e95a){GRAY_PERIOD_REASON=_0x2cbf('0x13');logger['info'](_0x2cbf('0x14'));}else{GRAY_PERIOD_REASON=_0x2cbf('0x15');logger[_0x2cbf('0x11')](_0x2cbf('0x16'),_0x1ccebf[_0x2cbf('0xe')],_0x14e95a);}logger[_0x2cbf('0x11')](_0x2cbf('0x17'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2cbf('0x8')](_0x2cbf('0x18')));return _0x34b858['update']({'data2':encryptor['encryptString'](moment()[_0x2cbf('0x8')](_0x2cbf('0x18')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x1ccebf[_0x2cbf('0xf')]),_0x2cbf('0x19'))>DAYS){logger[_0x2cbf('0x11')]('DEMO\x20START\x20AT\x20%s',moment()[_0x2cbf('0x8')](_0x2cbf('0x18')));isOldTokenSent=![];return _0x34b858[_0x2cbf('0x1a')]({'data1':_0x14e95a,'data2':null,'license':null});}}}else{if(_0x1ccebf['data1']!=_0x14e95a){logger['info'](_0x2cbf('0x16'),_0x1ccebf[_0x2cbf('0xe')],_0x14e95a);return _0x34b858['update']({'data1':_0x14e95a,'data2':null,'license':null});}}}return _0x34b858;})['then'](function(_0x5278d7){_0x34b858=_0x5278d7;})['catch'](function(_0x2fbe61){logger[_0x2cbf('0x1b')](_0x2fbe61[_0x2cbf('0x1c')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x2cbf('0x1d')](),_0x34b858);},TIME);});}function defaultLicense(){var _0x3c95a6=hardware['getUuid']();if(_0x3c95a6){return db[_0x2cbf('0x1e')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x3c95a6}})['spread'](function(_0x258c5d,_0x2f5f9d){logger[_0x2cbf('0x11')](_0x2cbf('0x1f'),_0x3c95a6);manageLicense(_0x3c95a6,_0x258c5d);})[_0x2cbf('0x20')](function(_0x24416a){logger[_0x2cbf('0x1b')](_0x24416a[_0x2cbf('0x1c')]);});}}exports[_0x2cbf('0x21')]=defaultLicense; \ No newline at end of file +var _0xd507=['%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','version','license','format','%s/api/servers/%s/check?version=%s','exports'];(function(_0xb8f65,_0x5b3d4f){var _0x537221=function(_0x157d70){while(--_0x157d70){_0xb8f65['push'](_0xb8f65['shift']());}};_0x537221(++_0x5b3d4f);}(_0xd507,0xa9));var _0x7d50=function(_0xcc104e,_0x3f8d50){_0xcc104e=_0xcc104e-0x0;var _0x39978e=_0xd507[_0xcc104e];return _0x39978e;};'use strict';var util=require(_0x7d50('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x7d50('0x1'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require('../logger')(_0x7d50('0x2'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4fe915){return new BPromise(function(_0x3f6d97,_0x10f320){var _0x2e4c20=util[_0x7d50('0x3')](_0x7d50('0x4'),HOST,_0x4fe915,module[_0x7d50('0x5')]['version']);if(oldToken){_0x2e4c20=util[_0x7d50('0x3')](_0x7d50('0x6'),HOST,_0x4fe915,module[_0x7d50('0x5')][_0x7d50('0x1')],oldToken);}var _0x2e4748={'uri':_0x2e4c20,'method':_0x7d50('0x7'),'timeout':0xea60,'json':!![]};return rp(_0x2e4748)[_0x7d50('0x8')](function(_0x31f706){_0x3f6d97(_0x31f706);})[_0x7d50('0x9')](function(_0x62257){_0x10f320(_0x62257);});});}function manageLicense(_0x4be1ad,_0x56f46e){var _0x3a058f=_0x56f46e[_0x7d50('0xa')]({'plain':!![]});if(!isOldTokenSent&&_0x3a058f[_0x7d50('0xb')]!==_0x4be1ad&&!_0x3a058f['data2']){oldToken=_0x3a058f[_0x7d50('0xb')];}httpRequest(_0x4be1ad)[_0x7d50('0x8')](function(_0x13c31e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x13c31e[_0x7d50('0xc')]){isOldTokenSent=![];if(!_0x3a058f[_0x7d50('0x2')]&&_0x3a058f[_0x7d50('0x2')]!=_0x13c31e[_0x7d50('0x2')]||_0x3a058f[_0x7d50('0x2')]&&_0x3a058f[_0x7d50('0xd')]){logger[_0x7d50('0xe')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3a058f[_0x7d50('0x2')]&&!_0x3a058f[_0x7d50('0xd')]&&_0x3a058f[_0x7d50('0x2')]!=_0x13c31e[_0x7d50('0x2')]){logger[_0x7d50('0xe')](_0x7d50('0xf'));}if(_0x3a058f[_0x7d50('0x2')]&&!_0x3a058f[_0x7d50('0xd')]&&_0x3a058f[_0x7d50('0x2')]==_0x13c31e[_0x7d50('0x2')]){return _0x56f46e;}return _0x56f46e[_0x7d50('0x10')]({'data1':_0x4be1ad,'data2':null,'license':_0x13c31e['license']});}else{if(_0x13c31e[_0x7d50('0x2')]||_0x3a058f[_0x7d50('0x2')]){if(!_0x3a058f[_0x7d50('0xd')]){if(_0x3a058f['data1']==_0x4be1ad){GRAY_PERIOD_REASON=_0x7d50('0x11');logger[_0x7d50('0xe')](_0x7d50('0x12'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x7d50('0x13'),_0x3a058f[_0x7d50('0xb')],_0x4be1ad);}logger[_0x7d50('0xe')](_0x7d50('0x14'),GRAY_PERIOD_REASON[_0x7d50('0x15')](),moment()[_0x7d50('0x3')](_0x7d50('0x16')));return _0x56f46e['update']({'data2':encryptor['encryptString'](moment()[_0x7d50('0x3')](_0x7d50('0x16')))});}else{if(moment()[_0x7d50('0x17')](encryptor[_0x7d50('0x18')](_0x3a058f[_0x7d50('0xd')]),_0x7d50('0x19'))>DAYS){logger[_0x7d50('0xe')](_0x7d50('0x1a'),moment()['format'](_0x7d50('0x16')));isOldTokenSent=![];return _0x56f46e[_0x7d50('0x10')]({'data1':_0x4be1ad,'data2':null,'license':null});}}}else{if(_0x3a058f[_0x7d50('0xb')]!=_0x4be1ad){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3a058f[_0x7d50('0xb')],_0x4be1ad);return _0x56f46e[_0x7d50('0x10')]({'data1':_0x4be1ad,'data2':null,'license':null});}}}return _0x56f46e;})[_0x7d50('0x8')](function(_0x3dd189){_0x56f46e=_0x3dd189;})['catch'](function(_0x17642e){logger[_0x7d50('0x1b')](_0x17642e[_0x7d50('0x1c')]);})[_0x7d50('0x1d')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x56f46e);},TIME);});}function defaultLicense(){var _0x30ee14=hardware['getUuid']();if(_0x30ee14){return db[_0x7d50('0x1e')][_0x7d50('0x1f')]({'where':{'id':0x1},'defaults':{'data1':_0x30ee14}})[_0x7d50('0x20')](function(_0x510aa8,_0xb26b72){logger[_0x7d50('0xe')](_0x7d50('0x21'),_0x30ee14);manageLicense(_0x30ee14,_0x510aa8);})[_0x7d50('0x9')](function(_0x397441){logger[_0x7d50('0x1b')](_0x397441[_0x7d50('0x1c')]);});}}exports[_0x7d50('0x22')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f65fe6b..bd7394b 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 _0xc376=['then','catch','uuid','license','data1','data2','split','decryptString','format','%s:%s:%s','parse','deadline','grayReason','changed','disabled','message','User','findAll','sequelize','role','count','admin','user','users','telephones','forEach','telephone','License\x20limit\x20reached\x20for\x20users','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults'];(function(_0x2c9062,_0x525a88){var _0x48fa9f=function(_0x2d2731){while(--_0x2d2731){_0x2c9062['push'](_0x2c9062['shift']());}};_0x48fa9f(++_0x525a88);}(_0xc376,0x18d));var _0x6c37=function(_0x2f2cb8,_0x417d38){_0x2f2cb8=_0x2f2cb8-0x0;var _0x5a7add=_0xc376[_0x2f2cb8];return _0x5a7add;};'use strict';var util=require(_0x6c37('0x0'));var _=require(_0x6c37('0x1'));var moment=require('moment');var BPromise=require(_0x6c37('0x2'));var hardware=require(_0x6c37('0x3'));var encryptor=require(_0x6c37('0x4'));var db=require(_0x6c37('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6c37('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6c37('0x7'),'machineUuid':hardware[_0x6c37('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6c37('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6c37('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x358e5d){return new BPromise(function(_0x3160eb,_0x137692){return db[_0x6c37('0xa')][_0x6c37('0xb')](_[_0x6c37('0xc')](_0x358e5d,{'raw':!![],'where':{'id':0x1}}))[_0x6c37('0xd')](function(_0x1cf78c){return checkLicense(_0x1cf78c,null);})['then'](function(_0x1f4411){_0x3160eb(_0x1f4411);return;})[_0x6c37('0xe')](function(_0x2132af){_0x137692(_0x2132af);});});}function checkLicense(_0x5b6955,_0x211e75){if(!_0x5b6955){demoLicense[_0x6c37('0xf')]=_0x5b6955['data1'];return demoLicense;}try{var _0x37561a=_0x211e75||_0x5b6955[_0x6c37('0x10')];if(_['isEmpty'](_0x37561a)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3cbe68=_0x5b6955[_0x6c37('0x11')];var _0xf340=_0x5b6955[_0x6c37('0x12')];var _0x575c5d=_0x3cbe68[_0x6c37('0x13')]('-')[0x4];var _0x2b6c5e=_0x3cbe68[_0x6c37('0x13')]('-')[0x0];var _0x35ef9a=encryptor[_0x6c37('0x14')](_0x37561a,util[_0x6c37('0x15')](_0x6c37('0x16'),_0x575c5d,_0x3cbe68,_0x2b6c5e));var _0x40dc9c=JSON[_0x6c37('0x17')](_0x35ef9a);_0x40dc9c['demo']=![];_0x40dc9c['uuid']=_0x3cbe68;_0x40dc9c['machineUuid']=hardware[_0x6c37('0x8')]();if(_0xf340){var _0x34664b=encryptor['decryptString'](_0xf340);_0x40dc9c['gray']=_0x34664b;_0x40dc9c[_0x6c37('0x18')]=moment(_0x34664b)['add'](0x7,'days')[_0x6c37('0x15')]();_0x40dc9c[_0x6c37('0x19')]=_0x40dc9c[_0x6c37('0xf')]!=_0x40dc9c['machineUuid']?_0x6c37('0x1a'):_0x6c37('0x1b');}return _0x40dc9c;}catch(_0xe47a4c){breakingLicense[_0x6c37('0xf')]=_0x5b6955['data1'];breakingLicense[_0x6c37('0x1c')]=_0xe47a4c[_0x6c37('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x318d47,_0x3e40ca){getLicense()[_0x6c37('0xd')](function(_0xfcf59b){return db[_0x6c37('0x1d')][_0x6c37('0x1e')]({'attributes':['role',[db[_0x6c37('0x1f')]['fn']('COUNT',db['sequelize']['col'](_0x6c37('0x20'))),_0x6c37('0x21')]],'group':_0x6c37('0x20'),'where':{'role':{'$or':[_0x6c37('0x22'),_0x6c37('0x23'),'telephone']}},'raw':!![]})[_0x6c37('0xd')](function(_0x3e1643){var _0xff2e78={'user':_0xfcf59b[_0x6c37('0x24')]||0x0,'telephone':_0xfcf59b[_0x6c37('0x25')]||0x0};_0x3e1643[_0x6c37('0x26')](function(_0x1a9ea8){var _0x17ee99=_0x1a9ea8[_0x6c37('0x20')]===_0x6c37('0x22')?_0x6c37('0x23'):_0x1a9ea8[_0x6c37('0x20')];_0xff2e78[_0x17ee99]-=_0x1a9ea8[_0x6c37('0x21')];if(_0xff2e78[_0x17ee99]<0x0)_0xff2e78[_0x17ee99]=0x0;});_0x318d47(_0xff2e78);return;});})[_0x6c37('0xe')](function(_0x5df8d1){_0x3e40ca(_0x5df8d1);});});}function checkUserLimits(_0x5b068f){return new BPromise(function(_0x3d8d93,_0x321e9d){getLimits()[_0x6c37('0xd')](function(_0x16f465){var _0x26a69f=_['pick'](_['countBy'](_0x5b068f,_0x6c37('0x20')),[_0x6c37('0x22'),_0x6c37('0x23'),_0x6c37('0x27')]);var _0x4f2162=(_0x26a69f[_0x6c37('0x22')]||0x0)+(_0x26a69f[_0x6c37('0x23')]||0x0);var _0x591b43=_0x26a69f[_0x6c37('0x27')]||0x0;if(_0x4f2162>_0x16f465[_0x6c37('0x23')])return _0x321e9d(_0x6c37('0x28'));if(_0x591b43>_0x16f465['telephone'])return _0x321e9d('License\x20limit\x20reached\x20for\x20telephones');return _0x3d8d93();})['catch'](function(_0x161ab6){_0x321e9d(_0x161ab6);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xef92=['format','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','message','findAll','role','sequelize','col','count','admin','telephone','telephones','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','lodash','moment','bluebird','./hardware','../../mysqldb','Breaking\x20license','getUuid','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString'];(function(_0x36438f,_0x45a095){var _0x592832=function(_0x49bed0){while(--_0x49bed0){_0x36438f['push'](_0x36438f['shift']());}};_0x592832(++_0x45a095);}(_0xef92,0x168));var _0x2ef9=function(_0x4de956,_0x4d0251){_0x4de956=_0x4de956-0x0;var _0x78856a=_0xef92[_0x4de956];return _0x78856a;};'use strict';var util=require(_0x2ef9('0x0'));var _=require(_0x2ef9('0x1'));var moment=require(_0x2ef9('0x2'));var BPromise=require(_0x2ef9('0x3'));var hardware=require(_0x2ef9('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x2ef9('0x5'))['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':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2ef9('0x6'),'machineUuid':hardware[_0x2ef9('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x454afc){return new BPromise(function(_0x3f464d,_0x39cd89){return db['License']['find'](_[_0x2ef9('0x8')](_0x454afc,{'raw':!![],'where':{'id':0x1}}))[_0x2ef9('0x9')](function(_0x50fdda){return checkLicense(_0x50fdda,null);})[_0x2ef9('0x9')](function(_0x44950c){_0x3f464d(_0x44950c);return;})[_0x2ef9('0xa')](function(_0x3e1a9a){_0x39cd89(_0x3e1a9a);});});}function checkLicense(_0x26f772,_0x2994b0){if(!_0x26f772){demoLicense['uuid']=_0x26f772[_0x2ef9('0xb')];return demoLicense;}try{var _0x483bbb=_0x2994b0||_0x26f772[_0x2ef9('0xc')];if(_[_0x2ef9('0xd')](_0x483bbb)){throw new Error(_0x2ef9('0xe'));}var _0x128113=_0x26f772[_0x2ef9('0xb')];var _0x419742=_0x26f772[_0x2ef9('0xf')];var _0x511898=_0x128113[_0x2ef9('0x10')]('-')[0x4];var _0x1bd02e=_0x128113[_0x2ef9('0x10')]('-')[0x0];var _0x56679f=encryptor[_0x2ef9('0x11')](_0x483bbb,util[_0x2ef9('0x12')]('%s:%s:%s',_0x511898,_0x128113,_0x1bd02e));var _0xe7f3c7=JSON['parse'](_0x56679f);_0xe7f3c7[_0x2ef9('0x13')]=![];_0xe7f3c7[_0x2ef9('0x14')]=_0x128113;_0xe7f3c7[_0x2ef9('0x15')]=hardware[_0x2ef9('0x7')]();if(_0x419742){var _0x40563f=encryptor[_0x2ef9('0x11')](_0x419742);_0xe7f3c7[_0x2ef9('0x16')]=_0x40563f;_0xe7f3c7[_0x2ef9('0x17')]=moment(_0x40563f)[_0x2ef9('0x18')](0x7,_0x2ef9('0x19'))[_0x2ef9('0x12')]();_0xe7f3c7[_0x2ef9('0x1a')]=_0xe7f3c7[_0x2ef9('0x14')]!=_0xe7f3c7[_0x2ef9('0x15')]?_0x2ef9('0x1b'):'disabled';}return _0xe7f3c7;}catch(_0x4eaa58){breakingLicense[_0x2ef9('0x14')]=_0x26f772['data1'];breakingLicense['message']=_0x4eaa58[_0x2ef9('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x47985e,_0x5ca725){getLicense()[_0x2ef9('0x9')](function(_0x40604d){return db['User'][_0x2ef9('0x1d')]({'attributes':[_0x2ef9('0x1e'),[db['sequelize']['fn']('COUNT',db[_0x2ef9('0x1f')][_0x2ef9('0x20')]('role')),_0x2ef9('0x21')]],'group':'role','where':{'role':{'$or':[_0x2ef9('0x22'),'user',_0x2ef9('0x23')]}},'raw':!![]})[_0x2ef9('0x9')](function(_0x4c48bf){var _0x30ef40={'user':_0x40604d['users']||0x0,'telephone':_0x40604d[_0x2ef9('0x24')]||0x0};_0x4c48bf[_0x2ef9('0x25')](function(_0x44f398){var _0x2ec50b=_0x44f398['role']===_0x2ef9('0x22')?_0x2ef9('0x26'):_0x44f398[_0x2ef9('0x1e')];_0x30ef40[_0x2ec50b]-=_0x44f398[_0x2ef9('0x21')];if(_0x30ef40[_0x2ec50b]<0x0)_0x30ef40[_0x2ec50b]=0x0;});_0x47985e(_0x30ef40);return;});})[_0x2ef9('0xa')](function(_0xf35b8e){_0x5ca725(_0xf35b8e);});});}function checkUserLimits(_0x4984d3){return new BPromise(function(_0x3c9bea,_0x5ef601){getLimits()[_0x2ef9('0x9')](function(_0x15b2b2){var _0x442de3=_[_0x2ef9('0x27')](_[_0x2ef9('0x28')](_0x4984d3,_0x2ef9('0x1e')),['admin',_0x2ef9('0x26'),_0x2ef9('0x23')]);var _0x35ec47=(_0x442de3[_0x2ef9('0x22')]||0x0)+(_0x442de3[_0x2ef9('0x26')]||0x0);var _0x1a8f9e=_0x442de3[_0x2ef9('0x23')]||0x0;if(_0x35ec47>_0x15b2b2['user'])return _0x5ef601(_0x2ef9('0x29'));if(_0x1a8f9e>_0x15b2b2[_0x2ef9('0x23')])return _0x5ef601('License\x20limit\x20reached\x20for\x20telephones');return _0x3c9bea();})[_0x2ef9('0xa')](function(_0x27903e){_0x5ef601(_0x27903e);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 595236d..89f8dac 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 _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xfb11[_0x5608a3];return _0x1ed50a;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x5c3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0x5c3c,0x132));var _0xc5c3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5c3c[_0x4243a3];return _0x1b2a33;};'use strict';module[_0xc5c3('0x0')]={'DOMAIN':_0xc5c3('0x1'),'SESSION_SECRET':_0xc5c3('0x2'),'GOOGLE_ID':_0xc5c3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 928749c..82a8b60 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x323c=['message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','Logger','File','%s-%s','error','info','moment','winston','path','INFO','join','log','xcally','%s-%s.log'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x323c,0x1de));var _0xc323=function(_0x3d11ed,_0x47a4b8){_0x3d11ed=_0x3d11ed-0x0;var _0xbbd56c=_0x323c[_0x3d11ed];return _0xbbd56c;};'use strict';var moment=require(_0xc323('0x0'));var winston=require(_0xc323('0x1'));var util=require('util');var path=require(_0xc323('0x2'));var debugLevel=_0xc323('0x3');function filename(_0x48bbee,_0x1e1454){return path[_0xc323('0x4')]('/var',_0xc323('0x5'),_0xc323('0x6'),util['format'](_0xc323('0x7'),_0x48bbee,_0x1e1454));}function formatter(_0x1a55a7,_0x2d67f4){_0x2d67f4[_0xc323('0x8')]=_0x2d67f4[_0xc323('0x8')][_0xc323('0x9')](/@@{/g,'{{{')[_0xc323('0x9')](/}@@/g,_0xc323('0xa'))[_0xc323('0x9')](/@{/g,'{{')[_0xc323('0x9')](/}@/g,'}}');return util[_0xc323('0xb')](_0xc323('0xc'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x2d67f4['level']['toUpperCase'](),_0x1a55a7,_0x2d67f4[_0xc323('0x8')]);}module['exports']=function(_0x4df3e4){return new winston[(_0xc323('0xd'))]({'transports':[new winston['transports'][(_0xc323('0xe'))]({'name':util[_0xc323('0xb')](_0xc323('0xf'),_0x4df3e4,'error'),'filename':filename(_0x4df3e4,_0xc323('0x10')),'level':_0xc323('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x21b569){return formatter(_0x4df3e4,_0x21b569);}}),new winston['transports']['File']({'name':util[_0xc323('0xb')](_0xc323('0xf'),_0x4df3e4,'info'),'filename':filename(_0x4df3e4,_0xc323('0x11')),'level':_0xc323('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb6cb9){return formatter(_0x4df3e4,_0xb6cb9);}}),new winston['transports']['Console']({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x2f1183){return formatter(_0x4df3e4,_0x2f1183);}})]});}; \ No newline at end of file +var _0xbb1a=['%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','log','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xbb1a,0x18c));var _0xabb1=function(_0x441a42,_0x1f5385){_0x441a42=_0x441a42-0x0;var _0x5d9d93=_0xbb1a[_0x441a42];return _0x5d9d93;};'use strict';var moment=require(_0xabb1('0x0'));var winston=require(_0xabb1('0x1'));var util=require(_0xabb1('0x2'));var path=require(_0xabb1('0x3'));var debugLevel=_0xabb1('0x4');function filename(_0x5c678d,_0x30572e){return path[_0xabb1('0x5')]('/var',_0xabb1('0x6'),_0xabb1('0x7'),util[_0xabb1('0x8')](_0xabb1('0x9'),_0x5c678d,_0x30572e));}function formatter(_0x5222b7,_0x1b2c0e){_0x1b2c0e['message']=_0x1b2c0e[_0xabb1('0xa')][_0xabb1('0xb')](/@@{/g,'{{{')[_0xabb1('0xb')](/}@@/g,_0xabb1('0xc'))[_0xabb1('0xb')](/@{/g,'{{')[_0xabb1('0xb')](/}@/g,'}}');return util[_0xabb1('0x8')](_0xabb1('0xd'),moment()[_0xabb1('0x8')](_0xabb1('0xe')),_0x1b2c0e[_0xabb1('0xf')][_0xabb1('0x10')](),_0x5222b7,_0x1b2c0e['message']);}module['exports']=function(_0xc1141a){return new winston[(_0xabb1('0x11'))]({'transports':[new winston[(_0xabb1('0x12'))][(_0xabb1('0x13'))]({'name':util[_0xabb1('0x8')](_0xabb1('0x14'),_0xc1141a,_0xabb1('0x15')),'filename':filename(_0xc1141a,'error'),'level':_0xabb1('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x579e52){return formatter(_0xc1141a,_0x579e52);}}),new winston[(_0xabb1('0x12'))][(_0xabb1('0x13'))]({'name':util[_0xabb1('0x8')](_0xabb1('0x14'),_0xc1141a,_0xabb1('0x16')),'filename':filename(_0xc1141a,_0xabb1('0x16')),'level':_0xabb1('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19b4c1){return formatter(_0xc1141a,_0x19b4c1);}}),new winston[(_0xabb1('0x12'))][(_0xabb1('0x17'))]({'level':process[_0xabb1('0x18')][_0xabb1('0x19')]||debugLevel,'json':![],'formatter':function(_0xaad090){return formatter(_0xc1141a,_0xaad090);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d93f1fc..dc0be2e 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 _0x80fb=['ami','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','express','join'];(function(_0x2591a0,_0x22913e){var _0x315f2c=function(_0x3a54ac){while(--_0x3a54ac){_0x2591a0['push'](_0x2591a0['shift']());}};_0x315f2c(++_0x22913e);}(_0x80fb,0x169));var _0xb80f=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x80fb[_0x164eca];return _0x2ce562;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xb80f('0x0'),'script':path[_0xb80f('0x1')](__dirname,'../../services/express/index.js')},{'name':_0xb80f('0x2'),'script':path[_0xb80f('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0xb80f('0x3'),'script':path[_0xb80f('0x1')](__dirname,_0xb80f('0x4'))},{'name':_0xb80f('0x5'),'script':path['join'](__dirname,_0xb80f('0x6'))},{'name':_0xb80f('0x7'),'script':path['join'](__dirname,_0xb80f('0x8'))},{'name':'xdr','script':path[_0xb80f('0x1')](__dirname,_0xb80f('0x9'))}]};module[_0xb80f('0xa')]=config; \ No newline at end of file +var _0xa38d=['../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join'];(function(_0x3b4f49,_0x507f85){var _0x48d549=function(_0x46322b){while(--_0x46322b){_0x3b4f49['push'](_0x3b4f49['shift']());}};_0x48d549(++_0x507f85);}(_0xa38d,0x8c));var _0xda38=function(_0x2e7cf1,_0x28db0c){_0x2e7cf1=_0x2e7cf1-0x0;var _0x553752=_0xa38d[_0x2e7cf1];return _0x553752;};'use strict';var path=require(_0xda38('0x0'));var os=require('os');var config={'apps':[{'name':_0xda38('0x1'),'script':path[_0xda38('0x2')](__dirname,_0xda38('0x3'))},{'name':'ami','script':path[_0xda38('0x2')](__dirname,_0xda38('0x4'))},{'name':_0xda38('0x5'),'script':path[_0xda38('0x2')](__dirname,_0xda38('0x6'))},{'name':_0xda38('0x7'),'script':path['join'](__dirname,_0xda38('0x8'))},{'name':'routing','script':path[_0xda38('0x2')](__dirname,_0xda38('0x9'))},{'name':_0xda38('0xa'),'script':path['join'](__dirname,_0xda38('0xb'))}]};module[_0xda38('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6c274fc..b1eab13 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 _0x1ae3=['then','disconnect','stop','restart','describe','delete','dump','saved','pm2','bluebird','./config','connected','start'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x1ae3,0x18e));var _0x31ae=function(_0x23b3e1,_0x1e966f){_0x23b3e1=_0x23b3e1-0x0;var _0x148fef=_0x1ae3[_0x23b3e1];return _0x148fef;};'use strict';var pm2=require(_0x31ae('0x0'));var BPromise=require(_0x31ae('0x1'));var config=require(_0x31ae('0x2'));function connect(){return new BPromise(function(_0x5c1194,_0x5d4b02){return pm2['connect'](function(_0x383c72){if(_0x383c72){return _0x5d4b02(_0x383c72);}return _0x5c1194(_0x31ae('0x3'));});});};exports[_0x31ae('0x4')]=function(_0x104589){return connect()[_0x31ae('0x5')](function(){return new BPromise(function(_0x14f9b0,_0x3a989b){return pm2[_0x31ae('0x4')](_0x104589,function(_0x1c3743,_0x533e8f){if(_0x1c3743){return _0x3a989b(_0x1c3743);}pm2[_0x31ae('0x6')]();return _0x14f9b0(_0x533e8f);});});});};exports[_0x31ae('0x7')]=function(_0x4fe483){return connect()[_0x31ae('0x5')](function(){return new BPromise(function(_0x559b4b,_0x2480ec){return pm2[_0x31ae('0x7')](_0x4fe483,function(_0x123ed7,_0x4fb222){if(_0x123ed7){return _0x2480ec(_0x123ed7);}pm2[_0x31ae('0x6')]();return _0x559b4b(_0x4fb222);});});});};exports[_0x31ae('0x8')]=function(_0x1a3dc4){return connect()[_0x31ae('0x5')](function(){return new BPromise(function(_0x3a9eef,_0x391b81){return pm2[_0x31ae('0x8')](_0x1a3dc4,function(_0x36bd54,_0x138bf9){if(_0x36bd54){return _0x391b81(_0x36bd54);}pm2[_0x31ae('0x6')]();return _0x3a9eef(_0x138bf9);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x502f38,_0x42dbc7){return pm2['list'](function(_0x52f635,_0x1f4d55){if(_0x52f635){return _0x42dbc7(_0x52f635);}pm2['disconnect']();return _0x502f38(_0x1f4d55);});});});};exports['describe']=function(_0x41ab0e){return connect()['then'](function(){return new BPromise(function(_0x479c27,_0x194e5e){return pm2[_0x31ae('0x9')](_0x41ab0e,function(_0x5521ca,_0x1d105c){if(_0x5521ca){return _0x194e5e(_0x5521ca);}pm2['disconnect']();return _0x479c27(_0x1d105c);});});});};exports['delete']=function(_0x272f17){return connect()['then'](function(){return new BPromise(function(_0x5e9f5c,_0x190d5b){return pm2[_0x31ae('0xa')](_0x272f17,function(_0x2316b3,_0x1d8401){if(_0x2316b3){return _0x190d5b(_0x2316b3);}pm2[_0x31ae('0x6')]();return _0x5e9f5c(_0x1d8401);});});});};exports[_0x31ae('0xb')]=function(){return connect()[_0x31ae('0x5')](function(){return new BPromise(function(_0x1ac34c,_0x485b9c){return pm2[_0x31ae('0xb')](function(_0x324665){if(_0x324665){return _0x485b9c(_0x324665);}return _0x1ac34c(_0x31ae('0xc'));});});});}; \ No newline at end of file +var _0xea18=['./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x46943c,_0x578ca7){var _0xd038fa=function(_0x5193c3){while(--_0x5193c3){_0x46943c['push'](_0x46943c['shift']());}};_0xd038fa(++_0x578ca7);}(_0xea18,0x179));var _0x8ea1=function(_0x1ffd37,_0x5d125b){_0x1ffd37=_0x1ffd37-0x0;var _0x5d0d76=_0xea18[_0x1ffd37];return _0x5d0d76;};'use strict';var pm2=require(_0x8ea1('0x0'));var BPromise=require('bluebird');var config=require(_0x8ea1('0x1'));function connect(){return new BPromise(function(_0xf90c7f,_0x53caf0){return pm2[_0x8ea1('0x2')](function(_0x46e7c7){if(_0x46e7c7){return _0x53caf0(_0x46e7c7);}return _0xf90c7f(_0x8ea1('0x3'));});});};exports[_0x8ea1('0x4')]=function(_0x26f41d){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x155333,_0x3757d7){return pm2[_0x8ea1('0x4')](_0x26f41d,function(_0x44f198,_0x30bdfa){if(_0x44f198){return _0x3757d7(_0x44f198);}pm2[_0x8ea1('0x6')]();return _0x155333(_0x30bdfa);});});});};exports['stop']=function(_0x272ad2){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x429dc7,_0xaf115e){return pm2[_0x8ea1('0x7')](_0x272ad2,function(_0x1c14d5,_0x5e7bde){if(_0x1c14d5){return _0xaf115e(_0x1c14d5);}pm2[_0x8ea1('0x6')]();return _0x429dc7(_0x5e7bde);});});});};exports[_0x8ea1('0x8')]=function(_0x595c05){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x493498,_0x42c34c){return pm2[_0x8ea1('0x8')](_0x595c05,function(_0x2c7d2d,_0x3ee2a5){if(_0x2c7d2d){return _0x42c34c(_0x2c7d2d);}pm2[_0x8ea1('0x6')]();return _0x493498(_0x3ee2a5);});});});};exports['list']=function(){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x319b32,_0x5686ac){return pm2[_0x8ea1('0x9')](function(_0x1d36c9,_0x1a150a){if(_0x1d36c9){return _0x5686ac(_0x1d36c9);}pm2[_0x8ea1('0x6')]();return _0x319b32(_0x1a150a);});});});};exports['describe']=function(_0x2478e0){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x23826b,_0x10cc07){return pm2[_0x8ea1('0xa')](_0x2478e0,function(_0x2a9818,_0x35d5c1){if(_0x2a9818){return _0x10cc07(_0x2a9818);}pm2['disconnect']();return _0x23826b(_0x35d5c1);});});});};exports[_0x8ea1('0xb')]=function(_0x1158e9){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x472c28,_0x4626f1){return pm2[_0x8ea1('0xb')](_0x1158e9,function(_0x103e11,_0x48981d){if(_0x103e11){return _0x4626f1(_0x103e11);}pm2[_0x8ea1('0x6')]();return _0x472c28(_0x48981d);});});});};exports[_0x8ea1('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x36d16c,_0x58daa6){return pm2['dump'](function(_0x4457be){if(_0x4457be){return _0x58daa6(_0x4457be);}return _0x36d16c(_0x8ea1('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 9d15987..858f464 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 _0xbb99=['../logger','schedule','redis','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','util'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0xbb99,0x128));var _0x9bb9=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xbb99[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0x9bb9('0x0'));var moment=require(_0x9bb9('0x1'));var Redis=require(_0x9bb9('0x2'));var util=require(_0x9bb9('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x9bb9('0x4'))(_0x9bb9('0x5'));config[_0x9bb9('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9bb9('0x6')]));function closeInteractions(){var _0x4a1855=0x0;var _0x1d47aa=[];return db[_0x9bb9('0x7')][_0x9bb9('0x8')]({'raw':!![],'attributes':['id',_0x9bb9('0x9')],'where':{'id':0x1}})[_0x9bb9('0xa')](function(_0x43ab14){_0x4a1855=_0x43ab14[_0x9bb9('0x9')];if(_0x4a1855){return db[_0x9bb9('0xb')][_0x9bb9('0xc')]({'raw':!![],'attributes':['id',_0x9bb9('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x9bb9('0xe')](_0x43ab14['chatTimeout'],_0x9bb9('0xf'))}}});}else{return[];}})[_0x9bb9('0xa')](function(_0x4e989c){if(_0x4e989c&&_0x4e989c[_0x9bb9('0x10')]){_0x1d47aa=_[_0x9bb9('0x11')](_0x4e989c||[],'id');logger['info'](_0x9bb9('0x12'),_0x1d47aa[_0x9bb9('0x13')]());return db[_0x9bb9('0xb')][_0x9bb9('0x14')]({'closeReason':_0x9bb9('0x15'),'disposition':_0x9bb9('0x16'),'closed':!![],'closedAt':moment()['format'](_0x9bb9('0x17'))},{'where':{'id':_0x1d47aa}});}})['then'](function(){if(_0x1d47aa&&_0x1d47aa[_0x9bb9('0x10')]){logger['info'](_0x9bb9('0x18'),_0x1d47aa[_0x9bb9('0x13')]());for(var _0x36b4c8=0x0;_0x36b4c8<_0x1d47aa[_0x9bb9('0x10')];_0x36b4c8++){io[_0x9bb9('0x19')](_0x9bb9('0x1a'),{'id':_0x1d47aa[_0x36b4c8],'closed':!![]});}}})[_0x9bb9('0x1b')](function(_0x41e53e){logger[_0x9bb9('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x41e53e?util['inspect'](_0x41e53e,{'showHidden':![],'depth':null}):'');});}exports[_0x9bb9('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdb0b=['YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','info','join','ChatInteraction','update','system','timeout','format'];(function(_0xe33068,_0x27d876){var _0x593a19=function(_0x3bf812){while(--_0x3bf812){_0xe33068['push'](_0xe33068['shift']());}};_0x593a19(++_0x27d876);}(_0xdb0b,0x170));var _0xbdb0=function(_0x2c693f,_0x3e073c){_0x2c693f=_0x2c693f-0x0;var _0x1f9bc9=_0xdb0b[_0x2c693f];return _0x1f9bc9;};'use strict';var _=require(_0xbdb0('0x0'));var moment=require(_0xbdb0('0x1'));var Redis=require(_0xbdb0('0x2'));var util=require(_0xbdb0('0x3'));var config=require(_0xbdb0('0x4'));var db=require(_0xbdb0('0x5'))['db'];var logger=require(_0xbdb0('0x6'))('schedule');config[_0xbdb0('0x7')]=_[_0xbdb0('0x8')](config[_0xbdb0('0x7')],{'host':_0xbdb0('0x9'),'port':0x18eb});var io=require(_0xbdb0('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x11ead8=0x0;var _0x25770a=[];return db[_0xbdb0('0xb')][_0xbdb0('0xc')]({'raw':!![],'attributes':['id',_0xbdb0('0xd')],'where':{'id':0x1}})[_0xbdb0('0xe')](function(_0x92b14a){_0x11ead8=_0x92b14a['chatTimeout'];if(_0x11ead8){return db['ChatInteraction'][_0xbdb0('0xf')]({'raw':!![],'attributes':['id',_0xbdb0('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbdb0('0x11')](_0x92b14a[_0xbdb0('0xd')],_0xbdb0('0x12'))}}});}else{return[];}})['then'](function(_0x217833){if(_0x217833&&_0x217833[_0xbdb0('0x13')]){_0x25770a=_[_0xbdb0('0x14')](_0x217833||[],'id');logger[_0xbdb0('0x15')]('[CHAT]\x20Interactions\x20to\x20close:',_0x25770a[_0xbdb0('0x16')]());return db[_0xbdb0('0x17')][_0xbdb0('0x18')]({'closeReason':_0xbdb0('0x19'),'disposition':_0xbdb0('0x1a'),'closed':!![],'closedAt':moment()[_0xbdb0('0x1b')](_0xbdb0('0x1c'))},{'where':{'id':_0x25770a}});}})['then'](function(){if(_0x25770a&&_0x25770a['length']){logger[_0xbdb0('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x25770a[_0xbdb0('0x16')]());for(var _0x370f08=0x0;_0x370f08<_0x25770a[_0xbdb0('0x13')];_0x370f08++){io[_0xbdb0('0x1d')](_0xbdb0('0x1e'),{'id':_0x25770a[_0x370f08],'closed':!![]});}}})[_0xbdb0('0x1f')](function(_0x1dd376){logger[_0xbdb0('0x20')](_0xbdb0('0x21'),_0x1dd376?util[_0xbdb0('0x22')](_0x1dd376,{'showHidden':![],'depth':null}):'');});}exports[_0xbdb0('0x23')]=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 869a6e9..32dd325 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 _0xb163=['../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','format','name','email','bcc','subtractUnit','join','../../files/reports','savename','%s.%s','basename','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','attachments','sendIfEmpty','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule'];(function(_0x1496a9,_0x39186c){var _0x329342=function(_0x1329d6){while(--_0x1329d6){_0x1496a9['push'](_0x1496a9['shift']());}};_0x329342(++_0x39186c);}(_0xb163,0x1b5));var _0x3b16=function(_0x46f6a4,_0xc4e42b){_0x46f6a4=_0x46f6a4-0x0;var _0x3e64c6=_0xb163[_0x46f6a4];return _0x3e64c6;};'use strict';var fs=require('fs');var util=require(_0x3b16('0x0'));var path=require(_0x3b16('0x1'));var _=require(_0x3b16('0x2'));var moment=require(_0x3b16('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x3b16('0x4'));var BPromise=require(_0x3b16('0x5'));var logger=require(_0x3b16('0x6'))(_0x3b16('0x7'));var db=require(_0x3b16('0x8'))['db'];var analyticCustomReportController=require(_0x3b16('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x3b16('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x17b507,_0x48a85a){return function(){logger[_0x3b16('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x17b507['email']);var _0x38f8ba=!![];var _0x2a7e97={'tls':{'rejectUnauthorized':![]}};if(_0x17b507[_0x3b16('0xc')][_0x3b16('0xd')]['service']){_0x2a7e97[_0x3b16('0xe')]=_0x17b507[_0x3b16('0xc')][_0x3b16('0xd')][_0x3b16('0xe')];}else{_0x2a7e97['host']=_0x17b507[_0x3b16('0xc')]['Smtp'][_0x3b16('0xf')];_0x2a7e97[_0x3b16('0x10')]=_0x17b507[_0x3b16('0xc')]['Smtp'][_0x3b16('0x10')];_0x2a7e97[_0x3b16('0x11')]=_0x17b507['MailAccount'][_0x3b16('0xd')][_0x3b16('0x11')];}if(_0x17b507['MailAccount'][_0x3b16('0xd')][_0x3b16('0x12')]){_0x2a7e97['auth']={'user':_0x17b507['MailAccount'][_0x3b16('0xd')][_0x3b16('0x13')],'pass':_0x17b507[_0x3b16('0xc')][_0x3b16('0xd')][_0x3b16('0x14')]};}var _0x457bd6={'account':_0x2a7e97,'message':{'from':util[_0x3b16('0x15')]('\x22%s\x22\x20<%s>',_0x17b507[_0x3b16('0xc')][_0x3b16('0x16')],_0x17b507[_0x3b16('0xc')][_0x3b16('0x17')]||_0x17b507[_0x3b16('0xc')]['Smtp'][_0x3b16('0x13')]),'to':_0x17b507[_0x3b16('0x17')],'cc':_0x17b507['cc'],'bcc':_0x17b507[_0x3b16('0x18')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x48a85a[_0x3b16('0x16')],_0x17b507['subtractNumber'],_0x17b507[_0x3b16('0x19')])}};var _0x4d8c19=path[_0x3b16('0x1a')](__dirname,_0x3b16('0x1b'));var _0x54dab0=_0x48a85a[_0x3b16('0x1c')];var _0xfb6d87=util['format'](_0x3b16('0x1d'),path[_0x3b16('0x1e')](_0x48a85a[_0x3b16('0x1c')],path[_0x3b16('0x1f')](_0x48a85a[_0x3b16('0x1c')])),_0x3b16('0x20'));var _0x255076=path['join'](_0x4d8c19,_0x54dab0);var _0x5c7ca1=path[_0x3b16('0x1a')](_0x4d8c19,_0xfb6d87);if(fs['existsSync'](_0x255076)){_0x48a85a[_0x3b16('0x21')]='Sent';_0x457bd6[_0x3b16('0x22')]['attachments']=[{'filename':_0x54dab0,'path':_0x255076}];_0x457bd6['message'][_0x3b16('0x23')]=util[_0x3b16('0x15')](_0x3b16('0x24'),JSON[_0x3b16('0x25')](_0x48a85a,null,0x2));}else if(fs[_0x3b16('0x26')](_0x5c7ca1)){_0x48a85a['status']=_0x3b16('0x27');_0x457bd6[_0x3b16('0x22')][_0x3b16('0x28')]=[{'filename':_0xfb6d87,'path':_0x5c7ca1}];}else{_0x457bd6['message'][_0x3b16('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x17b507[_0x3b16('0x29')]){_0x38f8ba=![];logger[_0x3b16('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x38f8ba){return client[_0x3b16('0x2a')](_0x3b16('0x2b'),_0x457bd6)['then'](function(_0x4794ea){if(_0x4794ea[_0x3b16('0x2c')]){return logger[_0x3b16('0x2c')](_0x3b16('0x2d'),JSON[_0x3b16('0x25')](_0x4794ea));}return logger[_0x3b16('0xb')](_0x3b16('0x2e'));})[_0x3b16('0x2f')](function(_0x1aab60){return logger[_0x3b16('0x2c')](_0x3b16('0x2d'),JSON[_0x3b16('0x25')](_0x1aab60));});}};}function handleError(){return function(_0x351637){return logger[_0x3b16('0x2c')](JSON[_0x3b16('0x25')](_0x351637));};}function handleResult(_0x34f375){return function(_0xc68dd9){logger[_0x3b16('0xb')](_0x3b16('0x30'),JSON[_0x3b16('0x25')](_0xc68dd9));if(_0x34f375[_0x3b16('0xc')]&&_0x34f375['MailAccount'][_0x3b16('0xd')]&&!_[_0x3b16('0x31')](_0x34f375[_0x3b16('0x17')])){setTimeout(handleSendEmail(_0x34f375,_0xc68dd9),0x3c*0x3e8);}};}function handleJob(_0x5182b5){return function(){try{if(_[_0x3b16('0x31')](_0x5182b5['subtractNumber'])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x3b16('0x31')](_0x5182b5['subtractUnit'])){return logger[_0x3b16('0xb')](_0x3b16('0x32'));}var _0x493368={'startDate':moment()[_0x3b16('0x33')](_0x5182b5[_0x3b16('0x34')],_0x5182b5[_0x3b16('0x19')])[_0x3b16('0x15')](_0x3b16('0x35')),'endDate':moment()[_0x3b16('0x15')](_0x3b16('0x35')),'type':_0x3b16('0x36'),'output':_0x5182b5[_0x3b16('0x37')],'name':_0x5182b5[_0x3b16('0x16')]};if(!_[_0x3b16('0x31')](_0x5182b5[_0x3b16('0x38')])){logger[_0x3b16('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x5182b5[_0x3b16('0x38')]);return analyticDefaultReportController['runReport']({'id':_0x5182b5[_0x3b16('0x38')]},_0x493368)[_0x3b16('0x39')](handleResult(_0x5182b5))[_0x3b16('0x2f')](handleError());}if(!_[_0x3b16('0x31')](_0x5182b5['CustomReportId'])){logger[_0x3b16('0xb')](_0x3b16('0x3a'),_0x5182b5[_0x3b16('0x3b')]);return analyticCustomReportController['runReport']({'id':_0x5182b5['CustomReportId']},_0x493368)[_0x3b16('0x39')](handleResult(_0x5182b5))[_0x3b16('0x2f')](handleError());}}catch(_0x36a470){logger[_0x3b16('0x2c')](JSON[_0x3b16('0x25')](_0x36a470));}return logger[_0x3b16('0xb')](_0x3b16('0x3c'));};}function getJobs(_0x5b1c47){var _0x4a0cc6={};if(_0x5b1c47){_0x4a0cc6['id']=_0x5b1c47;}return db[_0x3b16('0x3d')][_0x3b16('0x3e')]({'where':_0x4a0cc6,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x3b16('0x17')],'include':[{'model':db[_0x3b16('0x3f')],'as':_0x3b16('0xd')}]}]})['then'](function(_0x23879d){var _0x8d86b3=_['keys'](manager[_0x3b16('0x40')]);var _0x3b0b7c=_[_0x3b16('0x41')](_0x23879d,function(_0x12b97b){return _0x12b97b['id'][_0x3b16('0x42')]();});var _0x1dbfe7=_[_0x3b16('0x43')](_0x23879d,function(_0x1be8df){return _0x1be8df['id'][_0x3b16('0x42')]();});var _0x3b6576=_0x5b1c47?_0x3b0b7c:_[_0x3b16('0x44')](_0x3b0b7c,_0x8d86b3);var _0x14b20b=_[_0x3b16('0x45')](_0x3b0b7c,_0x8d86b3);var _0x1a249e=_[_0x3b16('0x44')](_0x8d86b3,_0x3b0b7c);var _0x532701;var _0x41fc6e;for(_0x532701=0x0;_0x532701<_0x1a249e[_0x3b16('0x46')]&&!_0x5b1c47;_0x532701+=0x1){_0x41fc6e=_0x1a249e[_0x532701][_0x3b16('0x42')]();if(manager[_0x3b16('0x47')](_0x41fc6e)){manager[_0x3b16('0x48')](_0x41fc6e);manager[_0x3b16('0x49')](_0x41fc6e);logger[_0x3b16('0xb')](_0x3b16('0x4a'),_0x41fc6e);}}logger[_0x3b16('0xb')]('toRun',JSON[_0x3b16('0x25')](_0x3b6576));for(_0x532701=0x0;_0x532701<_0x3b6576[_0x3b16('0x46')];_0x532701+=0x1){_0x41fc6e=_0x3b6576[_0x532701][_0x3b16('0x42')]();logger[_0x3b16('0xb')]('index',_0x41fc6e);if(_0x5b1c47){logger[_0x3b16('0xb')](_0x3b16('0x4b'),_0x5b1c47);logger['info'](JSON[_0x3b16('0x25')](_0x1dbfe7[_0x41fc6e]));BPromise[_0x3b16('0x4c')]()['then'](handleJob(_0x1dbfe7[_0x41fc6e]));logger['info'](_0x3b16('0x4d'),_0x1dbfe7[_0x41fc6e][_0x3b16('0x16')],_0x1dbfe7[_0x41fc6e][_0x3b16('0x4e')]);}else if(_0x1dbfe7[_0x41fc6e]['cron']&&_0x1dbfe7[_0x41fc6e][_0x3b16('0x4f')]&&moment()[_0x3b16('0x50')](_0x1dbfe7[_0x41fc6e][_0x3b16('0x51')],_0x1dbfe7[_0x41fc6e][_0x3b16('0x52')])){manager[_0x3b16('0x53')](_0x41fc6e,_0x1dbfe7[_0x41fc6e]['cron'],handleJob(_0x1dbfe7[_0x41fc6e]));manager[_0x3b16('0x54')](_0x41fc6e);logger[_0x3b16('0xb')]('add\x20cron',_0x1dbfe7[_0x41fc6e][_0x3b16('0x16')],_0x1dbfe7[_0x41fc6e][_0x3b16('0x4e')]);}else if(manager['exists'](_0x41fc6e)){manager[_0x3b16('0x48')](_0x41fc6e);manager[_0x3b16('0x49')](_0x41fc6e);logger[_0x3b16('0xb')](_0x3b16('0x55'),_0x1dbfe7[_0x41fc6e]['name'],_0x1dbfe7[_0x41fc6e][_0x3b16('0x4e')]);}}for(_0x532701=0x0,_0x41fc6e;_0x532701<_0x14b20b['length']&&!_0x5b1c47;_0x532701+=0x1){_0x41fc6e=_0x14b20b[_0x532701][_0x3b16('0x42')]();if(manager[_0x3b16('0x47')](_0x41fc6e)){if(_0x1dbfe7[_0x41fc6e]['cron']&&_0x1dbfe7[_0x41fc6e][_0x3b16('0x4f')]&&moment()['isBetween'](_0x1dbfe7[_0x41fc6e][_0x3b16('0x51')],_0x1dbfe7[_0x41fc6e][_0x3b16('0x52')])){manager[_0x3b16('0x56')](_0x41fc6e,_0x1dbfe7[_0x41fc6e][_0x3b16('0x4e')],handleJob(_0x1dbfe7[_0x41fc6e]));logger[_0x3b16('0xb')](_0x3b16('0x57'),_0x1dbfe7[_0x41fc6e][_0x3b16('0x16')],_0x1dbfe7[_0x41fc6e][_0x3b16('0x4e')]);}else{manager[_0x3b16('0x48')](_0x41fc6e);manager[_0x3b16('0x49')](_0x41fc6e);logger[_0x3b16('0xb')](_0x3b16('0x55'),_0x1dbfe7[_0x41fc6e][_0x3b16('0x16')],_0x1dbfe7[_0x41fc6e]['cron']);}}}})['catch'](function(_0x21dad9){logger[_0x3b16('0x2c')](JSON[_0x3b16('0x25')](_0x21dad9));});}exports[_0x3b16('0x58')]=function(_0x4d6df6){return getJobs(_0x4d6df6);};exports[_0x3b16('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0816=['../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','host','port','secure','MailAccount','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','name','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','status','Sent','message','attachments','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','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','stop','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','startAt','add','start','exists','deleteJob','stop\x20cron','active','isBetween','endAt','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird'];(function(_0x51680c,_0xf70653){var _0x32bdda=function(_0x153ab2){while(--_0x153ab2){_0x51680c['push'](_0x51680c['shift']());}};_0x32bdda(++_0xf70653);}(_0x0816,0x1bc));var _0x6081=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x0816[_0x4e7d25];return _0x526fe6;};'use strict';var fs=require('fs');var util=require(_0x6081('0x0'));var path=require(_0x6081('0x1'));var _=require(_0x6081('0x2'));var moment=require(_0x6081('0x3'));var CronJobManager=require(_0x6081('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x6081('0x5'));var logger=require(_0x6081('0x6'))(_0x6081('0x7'));var db=require(_0x6081('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x6081('0x9'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5036c1,_0x5cd291){return function(){logger[_0x6081('0xa')](_0x6081('0xb'),_0x5036c1[_0x6081('0xc')]);var _0x2c2f86=!![];var _0x4179c3={'tls':{'rejectUnauthorized':![]}};if(_0x5036c1['MailAccount'][_0x6081('0xd')]['service']){_0x4179c3[_0x6081('0xe')]=_0x5036c1['MailAccount'][_0x6081('0xd')][_0x6081('0xe')];}else{_0x4179c3[_0x6081('0xf')]=_0x5036c1['MailAccount'][_0x6081('0xd')][_0x6081('0xf')];_0x4179c3[_0x6081('0x10')]=_0x5036c1['MailAccount']['Smtp'][_0x6081('0x10')];_0x4179c3[_0x6081('0x11')]=_0x5036c1[_0x6081('0x12')]['Smtp'][_0x6081('0x11')];}if(_0x5036c1[_0x6081('0x12')][_0x6081('0xd')]['authentication']){_0x4179c3[_0x6081('0x13')]={'user':_0x5036c1[_0x6081('0x12')][_0x6081('0xd')][_0x6081('0x14')],'pass':_0x5036c1['MailAccount'][_0x6081('0xd')][_0x6081('0x15')]};}var _0x511cf4={'account':_0x4179c3,'message':{'from':util[_0x6081('0x16')](_0x6081('0x17'),_0x5036c1[_0x6081('0x12')]['name'],_0x5036c1[_0x6081('0x12')][_0x6081('0xc')]||_0x5036c1[_0x6081('0x12')][_0x6081('0xd')][_0x6081('0x14')]),'to':_0x5036c1[_0x6081('0xc')],'cc':_0x5036c1['cc'],'bcc':_0x5036c1[_0x6081('0x18')],'subject':util[_0x6081('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x5cd291[_0x6081('0x19')],_0x5036c1['subtractNumber'],_0x5036c1[_0x6081('0x1a')])}};var _0x187a4a=path[_0x6081('0x1b')](__dirname,_0x6081('0x1c'));var _0x563176=_0x5cd291[_0x6081('0x1d')];var _0x5b79bf=util[_0x6081('0x16')](_0x6081('0x1e'),path[_0x6081('0x1f')](_0x5cd291[_0x6081('0x1d')],path['extname'](_0x5cd291[_0x6081('0x1d')])),_0x6081('0x20'));var _0x56fbe1=path[_0x6081('0x1b')](_0x187a4a,_0x563176);var _0x38f7c3=path['join'](_0x187a4a,_0x5b79bf);if(fs['existsSync'](_0x56fbe1)){_0x5cd291[_0x6081('0x21')]=_0x6081('0x22');_0x511cf4[_0x6081('0x23')][_0x6081('0x24')]=[{'filename':_0x563176,'path':_0x56fbe1}];_0x511cf4[_0x6081('0x23')]['text']=util[_0x6081('0x16')](_0x6081('0x25'),JSON[_0x6081('0x26')](_0x5cd291,null,0x2));}else if(fs[_0x6081('0x27')](_0x38f7c3)){_0x5cd291['status']=_0x6081('0x22');_0x511cf4[_0x6081('0x23')][_0x6081('0x24')]=[{'filename':_0x5b79bf,'path':_0x38f7c3}];}else{_0x511cf4[_0x6081('0x23')][_0x6081('0x28')]=_0x6081('0x29');if(!_0x5036c1['sendIfEmpty']){_0x2c2f86=![];logger[_0x6081('0xa')](_0x6081('0x2a'));}}if(_0x2c2f86){return client[_0x6081('0x2b')]('SendMail',_0x511cf4)['then'](function(_0x39ef23){if(_0x39ef23[_0x6081('0x2c')]){return logger[_0x6081('0x2c')](_0x6081('0x2d'),JSON[_0x6081('0x26')](_0x39ef23));}return logger[_0x6081('0xa')](_0x6081('0x2e'));})[_0x6081('0x2f')](function(_0x45189e){return logger[_0x6081('0x2c')](_0x6081('0x2d'),JSON[_0x6081('0x26')](_0x45189e));});}};}function handleError(){return function(_0x1422cc){return logger[_0x6081('0x2c')](JSON[_0x6081('0x26')](_0x1422cc));};}function handleResult(_0x2c71da){return function(_0x365a6d){logger[_0x6081('0xa')](_0x6081('0x30'),JSON[_0x6081('0x26')](_0x365a6d));if(_0x2c71da[_0x6081('0x12')]&&_0x2c71da['MailAccount'][_0x6081('0xd')]&&!_[_0x6081('0x31')](_0x2c71da['email'])){setTimeout(handleSendEmail(_0x2c71da,_0x365a6d),0x3c*0x3e8);}};}function handleJob(_0x546e18){return function(){try{if(_[_0x6081('0x31')](_0x546e18[_0x6081('0x32')])){return logger[_0x6081('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x6081('0x31')](_0x546e18['subtractUnit'])){return logger[_0x6081('0xa')](_0x6081('0x33'));}var _0x32e5c0={'startDate':moment()[_0x6081('0x34')](_0x546e18[_0x6081('0x32')],_0x546e18[_0x6081('0x1a')])[_0x6081('0x16')](_0x6081('0x35')),'endDate':moment()[_0x6081('0x16')](_0x6081('0x35')),'type':'scheduled','output':_0x546e18[_0x6081('0x36')],'name':_0x546e18[_0x6081('0x19')]};if(!_[_0x6081('0x31')](_0x546e18[_0x6081('0x37')])){logger[_0x6081('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x546e18['DefaultReportId']);return analyticDefaultReportController[_0x6081('0x38')]({'id':_0x546e18[_0x6081('0x37')]},_0x32e5c0)[_0x6081('0x39')](handleResult(_0x546e18))[_0x6081('0x2f')](handleError());}if(!_['isNil'](_0x546e18['CustomReportId'])){logger['info'](_0x6081('0x3a'),_0x546e18['CustomReportId']);return analyticCustomReportController[_0x6081('0x38')]({'id':_0x546e18[_0x6081('0x3b')]},_0x32e5c0)[_0x6081('0x39')](handleResult(_0x546e18))['catch'](handleError());}}catch(_0xd0028){logger[_0x6081('0x2c')](JSON[_0x6081('0x26')](_0xd0028));}return logger[_0x6081('0xa')](_0x6081('0x3c'));};}function getJobs(_0x4ff0fe){var _0x3768ae={};if(_0x4ff0fe){_0x3768ae['id']=_0x4ff0fe;}return db[_0x6081('0x3d')]['findAll']({'where':_0x3768ae,'include':[{'model':db[_0x6081('0x12')],'attributes':['id','name',_0x6081('0xc')],'include':[{'model':db[_0x6081('0x3e')],'as':_0x6081('0xd')}]}]})[_0x6081('0x39')](function(_0x5413cb){var _0x5049c1=_[_0x6081('0x3f')](manager[_0x6081('0x40')]);var _0x11952c=_[_0x6081('0x41')](_0x5413cb,function(_0x46451c){return _0x46451c['id'][_0x6081('0x42')]();});var _0x1c38cb=_[_0x6081('0x43')](_0x5413cb,function(_0x571a08){return _0x571a08['id'][_0x6081('0x42')]();});var _0x21f8c3=_0x4ff0fe?_0x11952c:_[_0x6081('0x44')](_0x11952c,_0x5049c1);var _0xc765ca=_[_0x6081('0x45')](_0x11952c,_0x5049c1);var _0x5eb450=_[_0x6081('0x44')](_0x5049c1,_0x11952c);var _0x118905;var _0x2b9abe;for(_0x118905=0x0;_0x118905<_0x5eb450[_0x6081('0x46')]&&!_0x4ff0fe;_0x118905+=0x1){_0x2b9abe=_0x5eb450[_0x118905]['toString']();if(manager['exists'](_0x2b9abe)){manager[_0x6081('0x47')](_0x2b9abe);manager['deleteJob'](_0x2b9abe);logger[_0x6081('0xa')](_0x6081('0x48'),_0x2b9abe);}}logger[_0x6081('0xa')](_0x6081('0x49'),JSON[_0x6081('0x26')](_0x21f8c3));for(_0x118905=0x0;_0x118905<_0x21f8c3[_0x6081('0x46')];_0x118905+=0x1){_0x2b9abe=_0x21f8c3[_0x118905][_0x6081('0x42')]();logger[_0x6081('0xa')](_0x6081('0x4a'),_0x2b9abe);if(_0x4ff0fe){logger['info'](_0x6081('0x4b'),_0x4ff0fe);logger['info'](JSON[_0x6081('0x26')](_0x1c38cb[_0x2b9abe]));BPromise['resolve']()[_0x6081('0x39')](handleJob(_0x1c38cb[_0x2b9abe]));logger['info'](_0x6081('0x4c'),_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]);}else if(_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]&&_0x1c38cb[_0x2b9abe]['active']&&moment()['isBetween'](_0x1c38cb[_0x2b9abe][_0x6081('0x4e')],_0x1c38cb[_0x2b9abe]['endAt'])){manager[_0x6081('0x4f')](_0x2b9abe,_0x1c38cb[_0x2b9abe]['cron'],handleJob(_0x1c38cb[_0x2b9abe]));manager[_0x6081('0x50')](_0x2b9abe);logger[_0x6081('0xa')]('add\x20cron',_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]);}else if(manager[_0x6081('0x51')](_0x2b9abe)){manager['stop'](_0x2b9abe);manager[_0x6081('0x52')](_0x2b9abe);logger[_0x6081('0xa')](_0x6081('0x53'),_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]);}}for(_0x118905=0x0,_0x2b9abe;_0x118905<_0xc765ca[_0x6081('0x46')]&&!_0x4ff0fe;_0x118905+=0x1){_0x2b9abe=_0xc765ca[_0x118905][_0x6081('0x42')]();if(manager[_0x6081('0x51')](_0x2b9abe)){if(_0x1c38cb[_0x2b9abe]['cron']&&_0x1c38cb[_0x2b9abe][_0x6081('0x54')]&&moment()[_0x6081('0x55')](_0x1c38cb[_0x2b9abe][_0x6081('0x4e')],_0x1c38cb[_0x2b9abe][_0x6081('0x56')])){manager[_0x6081('0x57')](_0x2b9abe,_0x1c38cb[_0x2b9abe][_0x6081('0x4d')],handleJob(_0x1c38cb[_0x2b9abe]));logger['info'](_0x6081('0x58'),_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]);}else{manager[_0x6081('0x47')](_0x2b9abe);manager[_0x6081('0x52')](_0x2b9abe);logger[_0x6081('0xa')](_0x6081('0x53'),_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe]['cron']);}}}})[_0x6081('0x2f')](function(_0x599497){logger[_0x6081('0x2c')](JSON[_0x6081('0x26')](_0x599497));});}exports[_0x6081('0x59')]=function(_0x382840){return getJobs(_0x382840);};exports[_0x6081('0x50')]=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 013e491..4ef09e0 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 _0xea28=['findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','CloudProvider'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xea28,0x13a));var _0x8ea2=function(_0x1cb185,_0xd39063){_0x1cb185=_0x1cb185-0x0;var _0x48d0cf=_0xea28[_0x1cb185];return _0x48d0cf;};var _=require(_0x8ea2('0x0'));var AWS=require(_0x8ea2('0x1'));var rp=require(_0x8ea2('0x2'));var util=require(_0x8ea2('0x3'));var BPromise=require(_0x8ea2('0x4'));var db=require(_0x8ea2('0x5'))['db'];var logger=require(_0x8ea2('0x6'))(_0x8ea2('0x7'));function getTranscriptionJob(_0x4b7cda,_0x9b45ab,_0x23aaf1,_0x1ccf12){return new Promise(function(_0x513a0d,_0x29b82b){var _0x435d78=new AWS[(_0x8ea2('0x8'))]({'accessKeyId':_0x9b45ab,'secretAccessKey':_0x4b7cda,'region':_0x23aaf1});_0x435d78[_0x8ea2('0x9')]({'TranscriptionJobName':_0x1ccf12},function(_0x28b5b8,_0x929304){if(_0x28b5b8){return _0x29b82b(_0x28b5b8);}else{return _0x513a0d(_0x929304);}});});}function sentiment(_0x19bd6c,_0x320750,_0x3de4a1,_0x3000f9,_0x3d0b35){return new Promise(function(_0x21ae3d,_0x500b82){var _0x4da3b1=new AWS[(_0x8ea2('0xa'))]({'accessKeyId':_0x320750,'secretAccessKey':_0x19bd6c,'region':_0x3de4a1});_0x4da3b1[_0x8ea2('0xb')]({'Text':_0x3000f9,'LanguageCode':_0x3d0b35[_0x8ea2('0xc')](0x0,0x2)},function(_0x59d628,_0x32b97d){if(_0x59d628){return _0x500b82(_0x59d628);}else{return _0x21ae3d(_0x32b97d);}});});}function checkTranscribeJob(_0x101a15,_0x1dfb6e,_0x10aead){var _0xe47c0e;return new BPromise(function(_0x5e662e,_0x2879d6){logger['info'](util['format'](_0x8ea2('0xd'),_0x101a15['id'],_0x101a15[_0x8ea2('0xe')]));return getTranscriptionJob(_0x10aead[_0x8ea2('0xf')],_0x10aead[_0x8ea2('0x10')],_0x1dfb6e[_0x8ea2('0x11')],_0x101a15[_0x8ea2('0xe')])[_0x8ea2('0x12')](function(_0x11f5e8){logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x15'),_0x101a15['id'],_0x101a15[_0x8ea2('0xe')],_0x11f5e8[_0x8ea2('0x16')][_0x8ea2('0x17')]));if(!_0x101a15[_0x8ea2('0x18')]){switch(_0x11f5e8[_0x8ea2('0x16')][_0x8ea2('0x17')]){case _0x8ea2('0x19'):var _0x1068b6={'transcribeStatus':_0x11f5e8[_0x8ea2('0x16')][_0x8ea2('0x17')],'fileUri':_0x11f5e8[_0x8ea2('0x16')]['Transcript']['TranscriptFileUri']};logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x1a'),_0x101a15['id']));return rp({'uri':_0x11f5e8['TranscriptionJob'][_0x8ea2('0x1b')][_0x8ea2('0x1c')],'json':!![]})['then'](function(_0x3d593b){logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x1d'),_0x101a15['id']));if(_0x3d593b&&_0x3d593b[_0x8ea2('0x1e')]&&_0x3d593b[_0x8ea2('0x1e')][_0x8ea2('0x1f')]&&_0x3d593b[_0x8ea2('0x1e')][_0x8ea2('0x1f')]['length']){_0x1068b6[_0x8ea2('0x18')]='';for(var _0x4f48bd=0x0;_0x4f48bd<_0x3d593b[_0x8ea2('0x1e')][_0x8ea2('0x1f')][_0x8ea2('0x20')];_0x4f48bd++){_0x1068b6['fileText']+=_0x3d593b['results'][_0x8ea2('0x1f')][_0x4f48bd]['transcript']+'';}}return _0x101a15[_0x8ea2('0x21')](_0x1068b6);})['then'](function(){logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x22'),_0x101a15['id']));if(!_0x101a15[_0x8ea2('0x23')]){throw new db['Sequelize']['ValidationError'](_0x8ea2('0x24'));}if(!_0x1dfb6e['sentiment']||!_0x1dfb6e[_0x8ea2('0x25')]||!_0x1dfb6e[_0x8ea2('0x26')]||!_0x1dfb6e[_0x8ea2('0x27')]||!_0x1dfb6e[_0x8ea2('0x28')]){throw new db[(_0x8ea2('0x29'))][(_0x8ea2('0x2a'))](_0x8ea2('0x2b'));}if(!_0x1068b6[_0x8ea2('0x18')]){throw new Error(_0x8ea2('0x2c'));}if(_0x1dfb6e[_0x8ea2('0x25')]===_0x10aead['id']){return _0x10aead;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x8ea2('0x25')]}});}})[_0x8ea2('0x12')](function(_0x53d71c){if(!_0x53d71c){throw new db['Sequelize'][(_0x8ea2('0x2a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x53d71c[_0x8ea2('0xf')]||!_0x53d71c[_0x8ea2('0x10')]){throw new db['Sequelize'][(_0x8ea2('0x2a'))](_0x8ea2('0x2d'));}_0xe47c0e=_0x53d71c;logger[_0x8ea2('0x13')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x101a15['id']));return sentiment(_0xe47c0e['data1'],_0xe47c0e[_0x8ea2('0x10')],_0x1dfb6e[_0x8ea2('0x26')],_0x1068b6[_0x8ea2('0x18')],_0x1dfb6e['language']);})[_0x8ea2('0x12')](function(_0x391b08){logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x2e'),_0x101a15['id']));return _0x101a15[_0x8ea2('0x21')]({'sentiment':_0x391b08[_0x8ea2('0x2f')],'sPositive':_0x391b08[_0x8ea2('0x30')]['Positive'],'sNegative':_0x391b08[_0x8ea2('0x30')][_0x8ea2('0x31')],'sMixed':_0x391b08[_0x8ea2('0x30')][_0x8ea2('0x32')],'sNeutral':_0x391b08['SentimentScore'][_0x8ea2('0x33')]});})['then'](function(){logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x22'),_0x101a15['id']));_0x5e662e();});case _0x8ea2('0x34'):return _0x101a15['update']({'transcribeStatus':_0x8ea2('0x34'),'failureReason':_0x11f5e8['TranscriptionJob']['FailureReason']})[_0x8ea2('0x12')](function(){logger['info'](util[_0x8ea2('0x14')](_0x8ea2('0x22'),_0x101a15['id']));_0x5e662e();});default:logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x35'),_0x101a15['id']));break;}}else{return BPromise['resolve']()[_0x8ea2('0x12')](function(){if(!_0x101a15['tempSentiment']){throw new db[(_0x8ea2('0x29'))][(_0x8ea2('0x2a'))](_0x8ea2('0x24'));}if(!_0x1dfb6e[_0x8ea2('0x36')]||!_0x1dfb6e['sentimentAccountId']||!_0x1dfb6e[_0x8ea2('0x26')]||!_0x1dfb6e['language']||!_0x1dfb6e[_0x8ea2('0x28')]){throw new db['Sequelize'][(_0x8ea2('0x2a'))](_0x8ea2('0x2b'));}if(!_0x101a15[_0x8ea2('0x18')]){throw new Error(_0x8ea2('0x2c'));}if(_0x1dfb6e[_0x8ea2('0x25')]===_0x10aead['id']){return _0x10aead;}else{return db[_0x8ea2('0x37')][_0x8ea2('0x38')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x1d7496){if(!_0x1d7496){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1d7496[_0x8ea2('0xf')]||!_0x1d7496['data2']){throw new db[(_0x8ea2('0x29'))][(_0x8ea2('0x2a'))](_0x8ea2('0x2d'));}_0xe47c0e=_0x1d7496;logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x39'),_0x101a15['id']));return sentiment(_0xe47c0e[_0x8ea2('0xf')],_0xe47c0e[_0x8ea2('0x10')],_0x1dfb6e['sentimentRegion'],_0x101a15[_0x8ea2('0x18')],_0x1dfb6e[_0x8ea2('0x27')]);})[_0x8ea2('0x12')](function(_0x5cb6ad){logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x2e'),_0x101a15['id']));return _0x101a15[_0x8ea2('0x21')]({'sentiment':_0x5cb6ad[_0x8ea2('0x2f')],'sPositive':_0x5cb6ad['SentimentScore'][_0x8ea2('0x3a')],'sNegative':_0x5cb6ad[_0x8ea2('0x30')][_0x8ea2('0x31')],'sMixed':_0x5cb6ad['SentimentScore'][_0x8ea2('0x32')],'sNeutral':_0x5cb6ad[_0x8ea2('0x30')][_0x8ea2('0x33')],'transcribeStatus':_0x8ea2('0x19')});})[_0x8ea2('0x12')](function(){logger[_0x8ea2('0x13')](util[_0x8ea2('0x14')](_0x8ea2('0x22'),_0x101a15['id']));_0x5e662e();});}})[_0x8ea2('0x3b')](function(_0x302eef){if(_0x302eef){if(!_0x302eef[_0x8ea2('0x3c')]||_0x302eef[_0x8ea2('0x3c')]!==_0x8ea2('0x3d')){logger[_0x8ea2('0x3e')](util['format'](_0x8ea2('0x3f'),_0x101a15['id']),util[_0x8ea2('0x40')](_0x302eef,{'showHidden':![],'depth':null}));}}_0x5e662e();});});}function checkTranscribe(){var _0x216c37;var _0x6ed85a;var _0x182a46;return db[_0x8ea2('0x41')][_0x8ea2('0x42')]({'where':{'transcribeStatus':_0x8ea2('0x43')}})['then'](function(_0x12688a){if(!_0x12688a||!_0x12688a[_0x8ea2('0x20')]){throw new db[(_0x8ea2('0x29'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x216c37=_0x12688a;return db[_0x8ea2('0x44')][_0x8ea2('0x38')]({'where':{'id':0x1}});})[_0x8ea2('0x12')](function(_0x5e5c37){if(!_0x5e5c37){throw new db[(_0x8ea2('0x29'))][(_0x8ea2('0x2a'))](_0x8ea2('0x45'));}_0x6ed85a=_0x5e5c37;if(!_0x6ed85a[_0x8ea2('0x7')]||!_0x6ed85a[_0x8ea2('0x46')]||!_0x6ed85a['transcribeRegion']||!_0x6ed85a['language']||!_0x6ed85a[_0x8ea2('0x28')]){throw new db[(_0x8ea2('0x29'))][(_0x8ea2('0x2a'))]('Transcribe\x20not\x20configured');}return db[_0x8ea2('0x37')][_0x8ea2('0x38')]({'where':{'id':_0x6ed85a[_0x8ea2('0x46')]}});})['then'](function(_0x5c6524){if(!_0x5c6524){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5c6524[_0x8ea2('0xf')]||!_0x5c6524[_0x8ea2('0x10')]){throw new db['Sequelize']['ValidationError'](_0x8ea2('0x2d'));}_0x182a46=_0x5c6524;var _0x12c0db=[];_0x216c37[_0x8ea2('0x47')](function(_0x5eea45){_0x12c0db[_0x8ea2('0x48')](checkTranscribeJob(_0x5eea45,_0x6ed85a,_0x182a46));});return BPromise[_0x8ea2('0x49')](_0x12c0db);})['catch'](function(_0x8f0598){if(_0x8f0598){if(!_0x8f0598[_0x8ea2('0x3c')]||_0x8f0598[_0x8ea2('0x3c')]!==_0x8ea2('0x3d')){logger[_0x8ea2('0x3e')](util['inspect'](_0x8f0598,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0664=['transcribeRegion','forEach','all','error','start','aws-sdk','util','bluebird','../../config/logger','transcribe','TranscribeService','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','findOne','Cloud\x20Provider\x20not\x20available','Positive','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId'];(function(_0x496e6b,_0x21f95a){var _0x3f40fc=function(_0x2bb05c){while(--_0x2bb05c){_0x496e6b['push'](_0x496e6b['shift']());}};_0x3f40fc(++_0x21f95a);}(_0x0664,0x93));var _0x4066=function(_0x5de574,_0x222336){_0x5de574=_0x5de574-0x0;var _0x50415d=_0x0664[_0x5de574];return _0x50415d;};var _=require('lodash');var AWS=require(_0x4066('0x0'));var rp=require('request-promise');var util=require(_0x4066('0x1'));var BPromise=require(_0x4066('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x4066('0x3'))(_0x4066('0x4'));function getTranscriptionJob(_0x1479a6,_0x43d301,_0x362a79,_0x325e0e){return new Promise(function(_0x2febd3,_0x1e2bf0){var _0x143de5=new AWS[(_0x4066('0x5'))]({'accessKeyId':_0x43d301,'secretAccessKey':_0x1479a6,'region':_0x362a79});_0x143de5['getTranscriptionJob']({'TranscriptionJobName':_0x325e0e},function(_0x383df4,_0x5d360d){if(_0x383df4){return _0x1e2bf0(_0x383df4);}else{return _0x2febd3(_0x5d360d);}});});}function sentiment(_0x29a147,_0x2db4e6,_0x48333f,_0x5f3d44,_0x1da4d8){return new Promise(function(_0x3ea971,_0x16a1f7){var _0x41ad8b=new AWS['Comprehend']({'accessKeyId':_0x2db4e6,'secretAccessKey':_0x29a147,'region':_0x48333f});_0x41ad8b['detectSentiment']({'Text':_0x5f3d44,'LanguageCode':_0x1da4d8['substring'](0x0,0x2)},function(_0x4cbeb6,_0x2bac58){if(_0x4cbeb6){return _0x16a1f7(_0x4cbeb6);}else{return _0x3ea971(_0x2bac58);}});});}function checkTranscribeJob(_0x1b1712,_0x10c353,_0x12d36c){var _0x425456;return new BPromise(function(_0x3a0cf2,_0x38c65d){logger[_0x4066('0x6')](util['format'](_0x4066('0x7'),_0x1b1712['id'],_0x1b1712[_0x4066('0x8')]));return getTranscriptionJob(_0x12d36c['data1'],_0x12d36c[_0x4066('0x9')],_0x10c353['transcribeRegion'],_0x1b1712[_0x4066('0x8')])['then'](function(_0x50f71d){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0xb'),_0x1b1712['id'],_0x1b1712[_0x4066('0x8')],_0x50f71d[_0x4066('0xc')][_0x4066('0xd')]));if(!_0x1b1712[_0x4066('0xe')]){switch(_0x50f71d[_0x4066('0xc')][_0x4066('0xd')]){case _0x4066('0xf'):var _0x511cfa={'transcribeStatus':_0x50f71d['TranscriptionJob'][_0x4066('0xd')],'fileUri':_0x50f71d[_0x4066('0xc')]['Transcript'][_0x4066('0x10')]};logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x11'),_0x1b1712['id']));return rp({'uri':_0x50f71d[_0x4066('0xc')][_0x4066('0x12')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x541306){logger['info'](util[_0x4066('0xa')](_0x4066('0x13'),_0x1b1712['id']));if(_0x541306&&_0x541306[_0x4066('0x14')]&&_0x541306[_0x4066('0x14')][_0x4066('0x15')]&&_0x541306['results'][_0x4066('0x15')][_0x4066('0x16')]){_0x511cfa[_0x4066('0xe')]='';for(var _0x2598c6=0x0;_0x2598c6<_0x541306[_0x4066('0x14')]['transcripts']['length'];_0x2598c6++){_0x511cfa[_0x4066('0xe')]+=_0x541306[_0x4066('0x14')][_0x4066('0x15')][_0x2598c6][_0x4066('0x17')]+'';}}return _0x1b1712[_0x4066('0x18')](_0x511cfa);})[_0x4066('0x19')](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x1a'),_0x1b1712['id']));if(!_0x1b1712[_0x4066('0x1b')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x1e'));}if(!_0x10c353[_0x4066('0x1f')]||!_0x10c353[_0x4066('0x20')]||!_0x10c353['sentimentRegion']||!_0x10c353[_0x4066('0x21')]||!_0x10c353['bucket']){throw new db['Sequelize']['ValidationError'](_0x4066('0x22'));}if(!_0x511cfa['fileText']){throw new Error(_0x4066('0x23'));}if(_0x10c353[_0x4066('0x20')]===_0x12d36c['id']){return _0x12d36c;}else{return db[_0x4066('0x24')]['findOne']({'where':{'id':_settings[_0x4066('0x20')]}});}})['then'](function(_0x2468f0){if(!_0x2468f0){throw new db[(_0x4066('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2468f0[_0x4066('0x25')]||!_0x2468f0[_0x4066('0x9')]){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x425456=_0x2468f0;logger[_0x4066('0x6')](util['format'](_0x4066('0x27'),_0x1b1712['id']));return sentiment(_0x425456['data1'],_0x425456[_0x4066('0x9')],_0x10c353[_0x4066('0x28')],_0x511cfa[_0x4066('0xe')],_0x10c353[_0x4066('0x21')]);})[_0x4066('0x19')](function(_0x255fd0){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x29'),_0x1b1712['id']));return _0x1b1712[_0x4066('0x18')]({'sentiment':_0x255fd0[_0x4066('0x2a')],'sPositive':_0x255fd0[_0x4066('0x2b')]['Positive'],'sNegative':_0x255fd0[_0x4066('0x2b')][_0x4066('0x2c')],'sMixed':_0x255fd0['SentimentScore'][_0x4066('0x2d')],'sNeutral':_0x255fd0[_0x4066('0x2b')]['Neutral']});})[_0x4066('0x19')](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x1a'),_0x1b1712['id']));_0x3a0cf2();});case _0x4066('0x2e'):return _0x1b1712[_0x4066('0x18')]({'transcribeStatus':_0x4066('0x2e'),'failureReason':_0x50f71d[_0x4066('0xc')][_0x4066('0x2f')]})['then'](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1b1712['id']));_0x3a0cf2();});default:logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x30'),_0x1b1712['id']));break;}}else{return BPromise['resolve']()[_0x4066('0x19')](function(){if(!_0x1b1712[_0x4066('0x1b')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x1e'));}if(!_0x10c353[_0x4066('0x1f')]||!_0x10c353[_0x4066('0x20')]||!_0x10c353['sentimentRegion']||!_0x10c353[_0x4066('0x21')]||!_0x10c353[_0x4066('0x31')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x22'));}if(!_0x1b1712['fileText']){throw new Error(_0x4066('0x23'));}if(_0x10c353[_0x4066('0x20')]===_0x12d36c['id']){return _0x12d36c;}else{return db['CloudProvider'][_0x4066('0x32')]({'where':{'id':_settings[_0x4066('0x20')]}});}})[_0x4066('0x19')](function(_0x1c3abb){if(!_0x1c3abb){throw new db[(_0x4066('0x1c'))]['ValidationError'](_0x4066('0x33'));}if(!_0x1c3abb[_0x4066('0x25')]||!_0x1c3abb['data2']){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x425456=_0x1c3abb;logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x27'),_0x1b1712['id']));return sentiment(_0x425456[_0x4066('0x25')],_0x425456['data2'],_0x10c353[_0x4066('0x28')],_0x1b1712[_0x4066('0xe')],_0x10c353[_0x4066('0x21')]);})[_0x4066('0x19')](function(_0x1c99a8){logger[_0x4066('0x6')](util['format'](_0x4066('0x29'),_0x1b1712['id']));return _0x1b1712['update']({'sentiment':_0x1c99a8[_0x4066('0x2a')],'sPositive':_0x1c99a8['SentimentScore'][_0x4066('0x34')],'sNegative':_0x1c99a8[_0x4066('0x2b')][_0x4066('0x2c')],'sMixed':_0x1c99a8[_0x4066('0x2b')]['Mixed'],'sNeutral':_0x1c99a8[_0x4066('0x2b')][_0x4066('0x35')],'transcribeStatus':'COMPLETED'});})[_0x4066('0x19')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1b1712['id']));_0x3a0cf2();});}})[_0x4066('0x36')](function(_0x3e7c11){if(_0x3e7c11){if(!_0x3e7c11[_0x4066('0x37')]||_0x3e7c11[_0x4066('0x37')]!==_0x4066('0x38')){logger['error'](util[_0x4066('0xa')](_0x4066('0x39'),_0x1b1712['id']),util[_0x4066('0x3a')](_0x3e7c11,{'showHidden':![],'depth':null}));}}_0x3a0cf2();});});}function checkTranscribe(){var _0x2dcad0;var _0x218d51;var _0x523396;return db[_0x4066('0x3b')][_0x4066('0x3c')]({'where':{'transcribeStatus':_0x4066('0x3d')}})[_0x4066('0x19')](function(_0x269ff0){if(!_0x269ff0||!_0x269ff0[_0x4066('0x16')]){throw new db[(_0x4066('0x1c'))]['ValidationError'](_0x4066('0x3e'));}_0x2dcad0=_0x269ff0;return db[_0x4066('0x3f')][_0x4066('0x32')]({'where':{'id':0x1}});})[_0x4066('0x19')](function(_0x3bfea2){if(!_0x3bfea2){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x40'));}_0x218d51=_0x3bfea2;if(!_0x218d51['transcribe']||!_0x218d51[_0x4066('0x41')]||!_0x218d51[_0x4066('0x42')]||!_0x218d51[_0x4066('0x21')]||!_0x218d51[_0x4066('0x31')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x4066('0x24')][_0x4066('0x32')]({'where':{'id':_0x218d51[_0x4066('0x41')]}});})['then'](function(_0xe0f43c){if(!_0xe0f43c){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x33'));}if(!_0xe0f43c['data1']||!_0xe0f43c['data2']){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x523396=_0xe0f43c;var _0x1db0be=[];_0x2dcad0[_0x4066('0x43')](function(_0x4e677c){_0x1db0be['push'](checkTranscribeJob(_0x4e677c,_0x218d51,_0x523396));});return BPromise[_0x4066('0x44')](_0x1db0be);})[_0x4066('0x36')](function(_0x5886a1){if(_0x5886a1){if(!_0x5886a1['name']||_0x5886a1[_0x4066('0x37')]!=='SequelizeValidationError'){logger[_0x4066('0x45')](util['inspect'](_0x5886a1,{'showHidden':![],'depth':null}));}}});}exports[_0x4066('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 49cde9e..dcd1913 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 _0x726f=['WhatsappInteraction','subtract','hours','then','length','map','info','join','system','timeout','format','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x442430,_0x1b3577){var _0x2440c1=function(_0x3033a6){while(--_0x3033a6){_0x442430['push'](_0x442430['shift']());}};_0x2440c1(++_0x1b3577);}(_0x726f,0x1ca));var _0xf726=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x726f[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xf726('0x0'));var moment=require(_0xf726('0x1'));var Redis=require(_0xf726('0x2'));var util=require(_0xf726('0x3'));var config=require(_0xf726('0x4'));var db=require(_0xf726('0x5'))['db'];var logger=require(_0xf726('0x6'))(_0xf726('0x7'));config[_0xf726('0x8')]=_[_0xf726('0x9')](config[_0xf726('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf726('0x8')]));function closeInteractions(){var _0x58cf39=[];return db[_0xf726('0xa')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf726('0xb')](0x18,_0xf726('0xc'))}}})[_0xf726('0xd')](function(_0x5ae23a){if(_0x5ae23a&&_0x5ae23a[_0xf726('0xe')]){_0x58cf39=_[_0xf726('0xf')](_0x5ae23a||[],'id');logger[_0xf726('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x58cf39[_0xf726('0x11')]());return db[_0xf726('0xa')]['update']({'closeReason':_0xf726('0x12'),'disposition':_0xf726('0x13'),'closed':!![],'closedAt':moment()[_0xf726('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x58cf39}});}})[_0xf726('0xd')](function(){if(_0x58cf39&&_0x58cf39[_0xf726('0xe')]){logger[_0xf726('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x58cf39[_0xf726('0x11')]());for(var _0x1c231e=0x0;_0x1c231e<_0x58cf39[_0xf726('0xe')];_0x1c231e++){io['emit'](_0xf726('0x15'),{'id':_0x58cf39[_0x1c231e],'closed':!![]});}}})[_0xf726('0x16')](function(_0x43a4e1){logger[_0xf726('0x17')](_0xf726('0x18'),_0x43a4e1?util['inspect'](_0x43a4e1,{'showHidden':![],'depth':null}):'');});}exports[_0xf726('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa036=['YYYY-MM-DD\x20HH:mm:ss','info','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','../logger','schedule','redis','localhost','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format'];(function(_0x1878a1,_0x19389b){var _0x5a3e20=function(_0x32e48d){while(--_0x32e48d){_0x1878a1['push'](_0x1878a1['shift']());}};_0x5a3e20(++_0x19389b);}(_0xa036,0x101));var _0x6a03=function(_0xc645c9,_0x5c5585){_0xc645c9=_0xc645c9-0x0;var _0x20ab28=_0xa036[_0xc645c9];return _0x20ab28;};'use strict';var _=require('lodash');var moment=require(_0x6a03('0x0'));var Redis=require(_0x6a03('0x1'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x6a03('0x2'))(_0x6a03('0x3'));config[_0x6a03('0x4')]=_['defaults'](config['redis'],{'host':_0x6a03('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a03('0x4')]));function closeInteractions(){var _0x4a11bd=[];return db[_0x6a03('0x6')]['findAll']({'raw':!![],'attributes':['id',_0x6a03('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6a03('0x8')](0x18,_0x6a03('0x9'))}}})[_0x6a03('0xa')](function(_0x304fbc){if(_0x304fbc&&_0x304fbc[_0x6a03('0xb')]){_0x4a11bd=_[_0x6a03('0xc')](_0x304fbc||[],'id');logger['info'](_0x6a03('0xd'),_0x4a11bd[_0x6a03('0xe')]());return db['WhatsappInteraction']['update']({'closeReason':_0x6a03('0xf'),'disposition':_0x6a03('0x10'),'closed':!![],'closedAt':moment()[_0x6a03('0x11')](_0x6a03('0x12'))},{'where':{'id':_0x4a11bd}});}})[_0x6a03('0xa')](function(){if(_0x4a11bd&&_0x4a11bd[_0x6a03('0xb')]){logger[_0x6a03('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4a11bd['join']());for(var _0xe53a59=0x0;_0xe53a59<_0x4a11bd[_0x6a03('0xb')];_0xe53a59++){io['emit']('whatsappInteraction:update',{'id':_0x4a11bd[_0xe53a59],'closed':!![]});}}})[_0x6a03('0x14')](function(_0x32c4f0){logger[_0x6a03('0x15')](_0x6a03('0x16'),_0x32c4f0?util[_0x6a03('0x17')](_0x32c4f0,{'showHidden':![],'depth':null}):'');});}exports[_0x6a03('0x18')]=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 a047261..c572610 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe46c=['then','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','log','contacts2','hopper2','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy'];(function(_0x27d2aa,_0x5a595c){var _0x46c5ab=function(_0x306bb1){while(--_0x306bb1){_0x27d2aa['push'](_0x27d2aa['shift']());}};_0x46c5ab(++_0x5a595c);}(_0xe46c,0xbd));var _0xce46=function(_0x1c4cef,_0x391ad0){_0x1c4cef=_0x1c4cef-0x0;var _0xe2316a=_0xe46c[_0x1c4cef];return _0xe2316a;};'use strict';var util=require('util');var db=require(_0xce46('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xce46('0x1')]({'id':i,'firstName':_0xce46('0x2')+i,'lastName':_0xce46('0x3')+i,'phone':0xf879fb460+i,'email':_0xce46('0x4')+i+_0xce46('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xce46('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xce46('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce46('0x6')](),'updatedAt':Date[_0xce46('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xce46('0x1')]({'id':i,'firstName':_0xce46('0x2')+i,'lastName':_0xce46('0x3')+i,'phone':0xf879fb460+i,'email':_0xce46('0x4')+i+_0xce46('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xce46('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce46('0x6')](),'updatedAt':Date[_0xce46('0x6')]()});}db[_0xce46('0x7')][_0xce46('0x8')]({'where':{}})[_0xce46('0x9')](function(){return db[_0xce46('0x7')]['bulkCreate'](contacts);})[_0xce46('0x9')](function(){console['log'](_0xce46('0xa'),_0xce46('0xb'));return db[_0xce46('0xc')][_0xce46('0x8')]({'where':{}});})[_0xce46('0x9')](function(){return db[_0xce46('0xc')][_0xce46('0xd')](hopper);})['then'](function(){console['log'](_0xce46('0xa'),_0xce46('0xe'));return db[_0xce46('0x7')][_0xce46('0xd')](contacts2);})[_0xce46('0x9')](function(){console[_0xce46('0xf')](_0xce46('0xa'),_0xce46('0x10'));return db[_0xce46('0xc')]['bulkCreate'](hopper2);})['then'](function(){console[_0xce46('0xf')]('finished\x20populating',_0xce46('0x11'));})['catch'](function(_0x5af582){console[_0xce46('0xf')](_0x5af582);}); \ No newline at end of file +var _0x0d7d=['catch','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2'];(function(_0x165194,_0x31a93e){var _0x2975f0=function(_0x49ae22){while(--_0x49ae22){_0x165194['push'](_0x165194['shift']());}};_0x2975f0(++_0x31a93e);}(_0x0d7d,0xe5));var _0xd0d7=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x0d7d[_0x421263];return _0x34e4b5;};'use strict';var util=require('util');var db=require(_0xd0d7('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd0d7('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xd0d7('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xd0d7('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd0d7('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xd0d7('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd0d7('0x4')](),'updatedAt':Date[_0xd0d7('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd0d7('0x1')]({'id':i,'firstName':_0xd0d7('0x5')+i,'lastName':_0xd0d7('0x2')+i,'phone':0xf879fb460+i,'email':_0xd0d7('0x6')+i+_0xd0d7('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd0d7('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xd0d7('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0xd0d7('0x7')][_0xd0d7('0x8')]({'where':{}})[_0xd0d7('0x9')](function(){return db[_0xd0d7('0x7')][_0xd0d7('0xa')](contacts);})[_0xd0d7('0x9')](function(){console[_0xd0d7('0xb')](_0xd0d7('0xc'),_0xd0d7('0xd'));return db[_0xd0d7('0xe')][_0xd0d7('0x8')]({'where':{}});})[_0xd0d7('0x9')](function(){return db[_0xd0d7('0xe')][_0xd0d7('0xa')](hopper);})['then'](function(){console[_0xd0d7('0xb')]('finished\x20populating',_0xd0d7('0xf'));return db[_0xd0d7('0x7')]['bulkCreate'](contacts2);})[_0xd0d7('0x9')](function(){console[_0xd0d7('0xb')](_0xd0d7('0xc'),_0xd0d7('0x10'));return db[_0xd0d7('0xe')][_0xd0d7('0xa')](hopper2);})[_0xd0d7('0x9')](function(){console[_0xd0d7('0xb')](_0xd0d7('0xc'),_0xd0d7('0x11'));})[_0xd0d7('0x12')](function(_0x97f8b6){console[_0xd0d7('0xb')](_0x97f8b6);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 8cb267a..dba2cdf 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa1d=['%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','util','../mysqldb','push','format','%s%s','agent'];(function(_0x58f8b5,_0x3d0aad){var _0x513d41=function(_0x4331b6){while(--_0x4331b6){_0x58f8b5['push'](_0x58f8b5['shift']());}};_0x513d41(++_0x3d0aad);}(_0xaa1d,0xcb));var _0xdaa1=function(_0x54e348,_0xc1f87f){_0x54e348=_0x54e348-0x0;var _0x21f143=_0xaa1d[_0x54e348];return _0x21f143;};'use strict';var util=require(_0xdaa1('0x0'));var db=require(_0xdaa1('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xdaa1('0x2')]({'name':util[_0xdaa1('0x3')](_0xdaa1('0x4'),_0xdaa1('0x5'),i),'fullname':util[_0xdaa1('0x3')](_0xdaa1('0x4'),_0xdaa1('0x5'),i),'email':util[_0xdaa1('0x3')](_0xdaa1('0x6'),_0xdaa1('0x5'),i),'role':_0xdaa1('0x5'),'password':_0xdaa1('0x7'),'internal':0xfa0+i,'type':_0xdaa1('0x8'),'transport':['udp','ws',_0xdaa1('0x9')],'disallow':[_0xdaa1('0xa')],'allow':[_0xdaa1('0xb')],'defaultuser':util[_0xdaa1('0x3')](_0xdaa1('0x4'),'agent',i),'encryption':_0xdaa1('0xc'),'avpf':_0xdaa1('0xc'),'force_avp':'yes','icesupport':_0xdaa1('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xdaa1('0xd'),'dtlsprivatekey':_0xdaa1('0xe'),'dtlssetup':'actpass','callerid':util['format'](_0xdaa1('0xf'),util['format'](_0xdaa1('0x4'),_0xdaa1('0x5'),i),0xfa0+i)});}db['User'][_0xdaa1('0x10')](users)['then'](function(){console[_0xdaa1('0x11')](_0xdaa1('0x12'));})['catch'](function(_0x2561ba){console[_0xdaa1('0x11')](_0x2561ba);}); \ No newline at end of file +var _0x3e34=['\x22%s\x22\x20<%s>','then','log','add\x20user','catch','util','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x3e34,0x16d));var _0x43e3=function(_0x1ef527,_0x39eb07){_0x1ef527=_0x1ef527-0x0;var _0x72665e=_0x3e34[_0x1ef527];return _0x72665e;};'use strict';var util=require(_0x43e3('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x43e3('0x1')]({'name':util[_0x43e3('0x2')](_0x43e3('0x3'),_0x43e3('0x4'),i),'fullname':util[_0x43e3('0x2')](_0x43e3('0x3'),_0x43e3('0x4'),i),'email':util[_0x43e3('0x2')]('%s%s@xcally.com','agent',i),'role':_0x43e3('0x4'),'password':_0x43e3('0x5'),'internal':0xfa0+i,'type':_0x43e3('0x6'),'transport':[_0x43e3('0x7'),'ws',_0x43e3('0x8')],'disallow':[_0x43e3('0x9')],'allow':[_0x43e3('0xa')],'defaultuser':util[_0x43e3('0x2')](_0x43e3('0x3'),'agent',i),'encryption':_0x43e3('0xb'),'avpf':'yes','force_avp':_0x43e3('0xb'),'icesupport':_0x43e3('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x43e3('0xc'),'dtlsprivatekey':_0x43e3('0xd'),'dtlssetup':_0x43e3('0xe'),'callerid':util[_0x43e3('0x2')](_0x43e3('0xf'),util[_0x43e3('0x2')]('%s%s',_0x43e3('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x43e3('0x10')](function(){console[_0x43e3('0x11')](_0x43e3('0x12'));})[_0x43e3('0x13')](function(_0x347053){console['log'](_0x347053);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b027545..3114c57 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81c6=['format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','VoiceQueue','ChatQueue','push','SmsQueue','voice:outbound','FaxQueues','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','length','voice','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','ChatInteractions','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','DISCONNECTED','CONNECTED','util','name','Agents','User','role','agent','telephone','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','Trunks','IvrCampaigns','findAll','UserProfileResource','resourceId','then','map','where','Campaign','type'];(function(_0x372412,_0x564753){var _0x392a05=function(_0x25778a){while(--_0x25778a){_0x372412['push'](_0x372412['shift']());}};_0x392a05(++_0x564753);}(_0x81c6,0x1d5));var _0x681c=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x81c6[_0x14477e];return _0x5d4a05;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x681c('0x1')],'include':[{'as':_0x681c('0x2'),'model':db[_0x681c('0x3')],'attributes':['id','name',_0x681c('0x4')],'raw':!![],'where':{'role':_0x681c('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x681c('0x1')],'where':{'role':_0x681c('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x681c('0x1')],'where':{'role':_0x681c('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x681c('0x7')}};function getAssociatedResources(_0x3fac39,_0x7f090a,_0x5de78e){return db['UserProfileSection'][_0x681c('0x8')]({'where':{'name':_0x3fac39,'userProfileId':_0x7f090a},'raw':!![]})['then'](function(_0x82b6ad){if(_0x82b6ad){if(_0x82b6ad[_0x681c('0x9')]){switch(_0x3fac39){case _0x681c('0xa'):case _0x681c('0xb'):case'FaxQueues':case'SmsQueues':case _0x681c('0xc'):case _0x681c('0xd'):case _0x681c('0xe'):return db[_0x5de78e]['findAll'](queryQueues);case _0x681c('0xf'):return db[_0x5de78e]['findAll'](queryTelephones);case _0x681c('0x10'):return db[_0x5de78e]['findAll'](queryTrunks);case _0x681c('0x11'):return db[_0x5de78e][_0x681c('0x12')](queryCampaigns);}}else{return db[_0x681c('0x13')][_0x681c('0x12')]({'attributes':[_0x681c('0x14')],'where':{'sectionId':_0x82b6ad['id']},'raw':!![]})[_0x681c('0x15')](function(_0x50a4ec){if(_0x50a4ec){var _0x2b0939={'where':{'id':_[_0x681c('0x16')](_0x50a4ec,_0x681c('0x14'))},'raw':!![]};switch(_0x5de78e){case _0x681c('0x3'):_0x2b0939[_0x681c('0x17')][_0x681c('0x4')]='telephone';break;case _0x681c('0x18'):_0x2b0939[_0x681c('0x17')][_0x681c('0x19')]=_0x681c('0x7');break;}return db[_0x5de78e]['findAll'](_0x2b0939);}else{return[];}});}}else{return[];}})[_0x681c('0x15')](function(_0x24a0ce){return _0x24a0ce;});}function joinOrLeaveQueues(_0x54d27f,_0x161948,_0x4c22c7,_0x46cafc){_0x54d27f[_0x161948](util[_0x681c('0x1a')](_0x681c('0x1b'),_0x4c22c7,_0x46cafc[_0x681c('0x1')]));if(_0x46cafc[_0x681c('0x2')]){for(var _0x51d626=0x0;_0x51d626<_0x46cafc['Agents']['length'];_0x51d626+=0x1){_0x54d27f[_0x161948](util[_0x681c('0x1a')](_0x681c('0x1c'),_0x46cafc[_0x681c('0x2')][_0x51d626][_0x681c('0x1')]));}}}function joinOrLeave(_0x2ec29f,_0x29f3fa,_0x415a0a){var _0x3d0297;if(_0x2ec29f[_0x681c('0x1d')][_0x681c('0x1e')]['id']){db[_0x681c('0x3')][_0x681c('0x1f')]({'attributes':['id',_0x681c('0x1'),_0x681c('0x4'),_0x681c('0x20')],'where':{'id':_0x2ec29f[_0x681c('0x1d')]['query']['id']},'include':[{'model':db[_0x681c('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x681c('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x681c('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x681c('0x24')],'as':_0x681c('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x681c('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x681c('0x27')],'as':_0x681c('0x28'),'attributes':['id'],'raw':!![]}]})[_0x681c('0x15')](function(_0x936fce){if(_0x936fce){_0x3d0297=_0x936fce;_0x2ec29f[_0x29f3fa](util[_0x681c('0x1a')](_0x681c('0x1c'),_0x936fce[_0x681c('0x1')]));var _0x50e6d2=[];switch(_0x936fce[_0x681c('0x4')]){case _0x681c('0x29'):_0x2ec29f[_0x29f3fa](_0x681c('0x2a'));_0x2ec29f[_0x29f3fa]('voice:outbound');if(queryQueues[_0x681c('0x2b')](_0x681c('0x2c'))){delete queryQueues[_0x681c('0x2c')];}_0x50e6d2['push'](db[_0x681c('0x2d')]['findAll'](queryQueues));_0x50e6d2['push'](db[_0x681c('0x2e')][_0x681c('0x12')](queryQueues));_0x50e6d2[_0x681c('0x2f')](db['FaxQueue'][_0x681c('0x12')](queryQueues));_0x50e6d2['push'](db[_0x681c('0x30')]['findAll'](queryQueues));_0x50e6d2['push'](db['MailQueue'][_0x681c('0x12')](queryQueues));_0x50e6d2[_0x681c('0x2f')](db['OpenchannelQueue'][_0x681c('0x12')](queryQueues));_0x50e6d2['push'](db['WhatsappQueue'][_0x681c('0x12')](queryQueues));_0x50e6d2['push'](db[_0x681c('0x3')][_0x681c('0x12')](queryTelephones));_0x50e6d2[_0x681c('0x2f')](db['Trunk']['findAll'](queryTrunks));_0x50e6d2[_0x681c('0x2f')](db[_0x681c('0x18')]['findAll'](queryCampaigns));_0x50e6d2[_0x681c('0x2f')](db[_0x681c('0x3')][_0x681c('0x12')](queryAgents));break;case'user':_0x2ec29f[_0x29f3fa](_0x681c('0x2a'));_0x2ec29f[_0x29f3fa](_0x681c('0x31'));_0x50e6d2['push'](getAssociatedResources(_0x681c('0xa'),_0x936fce[_0x681c('0x20')],_0x681c('0x2d')));_0x50e6d2[_0x681c('0x2f')](getAssociatedResources(_0x681c('0xb'),_0x936fce['userProfileId'],'ChatQueue'));_0x50e6d2[_0x681c('0x2f')](getAssociatedResources(_0x681c('0x32'),_0x936fce['userProfileId'],_0x681c('0x33')));_0x50e6d2[_0x681c('0x2f')](getAssociatedResources('SmsQueues',_0x936fce[_0x681c('0x20')],_0x681c('0x30')));_0x50e6d2[_0x681c('0x2f')](getAssociatedResources(_0x681c('0xc'),_0x936fce[_0x681c('0x20')],_0x681c('0x34')));_0x50e6d2[_0x681c('0x2f')](getAssociatedResources(_0x681c('0xd'),_0x936fce[_0x681c('0x20')],_0x681c('0x35')));_0x50e6d2['push'](getAssociatedResources(_0x681c('0xe'),_0x936fce[_0x681c('0x20')],_0x681c('0x36')));_0x50e6d2[_0x681c('0x2f')](getAssociatedResources(_0x681c('0xf'),_0x936fce[_0x681c('0x20')],_0x681c('0x3')));_0x50e6d2[_0x681c('0x2f')](getAssociatedResources(_0x681c('0x10'),_0x936fce[_0x681c('0x20')],_0x681c('0x37')));_0x50e6d2[_0x681c('0x2f')](getAssociatedResources('IvrCampaigns',_0x936fce[_0x681c('0x20')],'Campaign'));_0x50e6d2['push'](db[_0x681c('0x3')][_0x681c('0x12')](queryAgents));break;case _0x681c('0x5'):_0x2ec29f[_0x29f3fa](_0x681c('0x2a'));_0x2ec29f[_0x29f3fa]('voice:outbound');_0x50e6d2[_0x681c('0x2f')](_0x936fce['getVoiceQueues']({'attributes':['id','name']}));_0x50e6d2[_0x681c('0x2f')](_0x936fce[_0x681c('0x38')]({'attributes':['id',_0x681c('0x1')]}));_0x50e6d2[_0x681c('0x2f')](_0x936fce[_0x681c('0x39')]({'attributes':['id',_0x681c('0x1')]}));_0x50e6d2['push'](_0x936fce[_0x681c('0x3a')]({'attributes':['id',_0x681c('0x1')]}));_0x50e6d2['push'](_0x936fce['getMailQueues']({'attributes':['id',_0x681c('0x1')]}));_0x50e6d2['push'](_0x936fce[_0x681c('0x3b')]({'attributes':['id','name']}));_0x50e6d2['push'](_0x936fce['getWhatsappQueues']({'attributes':['id',_0x681c('0x1')]}));break;}return BPromise[_0x681c('0x3c')](_0x50e6d2);}})[_0x681c('0x15')](function(_0x573250){if(_0x573250&&_0x573250[_0x681c('0x3d')]){for(var _0x2e940b=0x0;_0x2e940b<_0x573250['length'];_0x2e940b+=0x1){for(var _0x449c8b=0x0;_0x449c8b<_0x573250[_0x2e940b][_0x681c('0x3d')];_0x449c8b+=0x1){switch(_0x2e940b){case 0x0:joinOrLeaveQueues(_0x2ec29f,_0x29f3fa,_0x681c('0x3e'),_0x573250[_0x2e940b][_0x449c8b]);break;case 0x1:joinOrLeaveQueues(_0x2ec29f,_0x29f3fa,_0x681c('0x3f'),_0x573250[_0x2e940b][_0x449c8b]);break;case 0x2:joinOrLeaveQueues(_0x2ec29f,_0x29f3fa,'fax',_0x573250[_0x2e940b][_0x449c8b]);break;case 0x3:joinOrLeaveQueues(_0x2ec29f,_0x29f3fa,_0x681c('0x40'),_0x573250[_0x2e940b][_0x449c8b]);break;case 0x4:joinOrLeaveQueues(_0x2ec29f,_0x29f3fa,'mail',_0x573250[_0x2e940b][_0x449c8b]);break;case 0x5:joinOrLeaveQueues(_0x2ec29f,_0x29f3fa,_0x681c('0x41'),_0x573250[_0x2e940b][_0x449c8b]);break;case 0x6:joinOrLeaveQueues(_0x2ec29f,_0x29f3fa,_0x681c('0x42'),_0x573250[_0x2e940b][_0x449c8b]);break;case 0x7:if(_0x3d0297[_0x681c('0x4')]!=='agent')_0x2ec29f[_0x29f3fa](util[_0x681c('0x1a')](_0x681c('0x43'),_0x573250[_0x2e940b][_0x449c8b][_0x681c('0x1')]));break;case 0x8:if(_0x3d0297[_0x681c('0x4')]!==_0x681c('0x5'))_0x2ec29f[_0x29f3fa](util[_0x681c('0x1a')](_0x681c('0x44'),_0x573250[_0x2e940b][_0x449c8b][_0x681c('0x1')]));break;case 0x9:if(_0x3d0297[_0x681c('0x4')]!==_0x681c('0x5'))_0x2ec29f[_0x29f3fa](util[_0x681c('0x1a')](_0x681c('0x45'),_0x573250[_0x2e940b][_0x449c8b][_0x681c('0x19')],_0x573250[_0x2e940b][_0x449c8b][_0x681c('0x1')]));break;case 0xa:_0x2ec29f[_0x29f3fa](util[_0x681c('0x1a')]('user:%s',_0x573250[_0x2e940b][_0x449c8b][_0x681c('0x1')]));break;}}}}})[_0x681c('0x15')](function(){if(_0x29f3fa==='leave'){var _0x340307=_['map'](_0x3d0297[_0x681c('0x46')],'id');return _0x3d0297[_0x681c('0x47')](_0x340307)[_0x681c('0x15')](function(){for(var _0x48ca34=0x0;_0x48ca34<_0x340307[_0x681c('0x3d')];_0x48ca34+=0x1){_0x415a0a[_0x681c('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x340307[_0x48ca34]),'UserId':Number(_0x3d0297['id'])});}});}})[_0x681c('0x15')](function(){if(_0x29f3fa==='leave'){var _0x208c91=_['map'](_0x3d0297[_0x681c('0x49')],'id');return _0x3d0297[_0x681c('0x4a')](_0x208c91)['then'](function(){for(var _0x34b6be=0x0;_0x34b6be<_0x208c91['length'];_0x34b6be+=0x1){_0x415a0a['emit'](_0x681c('0x4b'),{'MailInteractionId':Number(_0x208c91[_0x34b6be]),'UserId':Number(_0x3d0297['id'])});}});}})[_0x681c('0x15')](function(){if(_0x29f3fa===_0x681c('0x4c')){var _0x538b19=_[_0x681c('0x16')](_0x3d0297['FaxInteractions'],'id');return _0x3d0297[_0x681c('0x4d')](_0x538b19)['then'](function(){for(var _0x563b65=0x0;_0x563b65<_0x538b19[_0x681c('0x3d')];_0x563b65+=0x1){_0x415a0a[_0x681c('0x48')](_0x681c('0x4e'),{'FaxInteractionId':Number(_0x538b19[_0x563b65]),'UserId':Number(_0x3d0297['id'])});}});}})[_0x681c('0x15')](function(){if(_0x29f3fa==='leave'){var _0x2465b2=_[_0x681c('0x16')](_0x3d0297[_0x681c('0x25')],'id');return _0x3d0297[_0x681c('0x4f')](_0x2465b2)[_0x681c('0x15')](function(){for(var _0x5db1f4=0x0;_0x5db1f4<_0x2465b2[_0x681c('0x3d')];_0x5db1f4+=0x1){_0x415a0a[_0x681c('0x48')](_0x681c('0x50'),{'SmsInteractionId':Number(_0x2465b2[_0x5db1f4]),'UserId':Number(_0x3d0297['id'])});}});}})[_0x681c('0x15')](function(){if(_0x29f3fa===_0x681c('0x4c')){var _0x2d4876=_[_0x681c('0x16')](_0x3d0297[_0x681c('0x51')],'id');return _0x3d0297[_0x681c('0x52')](_0x2d4876)[_0x681c('0x15')](function(){for(var _0x67fbbd=0x0;_0x67fbbd<_0x2d4876[_0x681c('0x3d')];_0x67fbbd+=0x1){_0x415a0a['emit'](_0x681c('0x53'),{'OpenchannelInteractionId':Number(_0x2d4876[_0x67fbbd]),'UserId':Number(_0x3d0297['id'])});}});}})[_0x681c('0x15')](function(){if(_0x29f3fa===_0x681c('0x4c')){var _0x2fae66=_[_0x681c('0x16')](_0x3d0297['WhatsappInteractions'],'id');return _0x3d0297[_0x681c('0x54')](_0x2fae66)['then'](function(){for(var _0x4837e5=0x0;_0x4837e5<_0x2fae66[_0x681c('0x3d')];_0x4837e5+=0x1){_0x415a0a[_0x681c('0x48')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2fae66[_0x4837e5]),'UserId':Number(_0x3d0297['id'])});}});}})[_0x681c('0x55')](function(_0xe07d4){_0x2ec29f[_0x681c('0x56')](_0xe07d4);});}}function onDisconnect(_0x3ec7fe,_0x4904c3){joinOrLeave(_0x3ec7fe,_0x681c('0x4c'),_0x4904c3);}function onConnect(_0x1f8bb4){joinOrLeave(_0x1f8bb4,_0x681c('0x57'));}exports[_0x681c('0x58')]=function(_0x5d3b42){_0x5d3b42['on'](_0x681c('0x59'),function(_0x145441){_0x145441[_0x681c('0x5a')](0x0);_0x145441['address']=_0x145441['request'][_0x681c('0x59')][_0x681c('0x5b')]+':'+_0x145441['request'][_0x681c('0x59')][_0x681c('0x5c')];_0x145441[_0x681c('0x5d')]=new Date();_0x145441[_0x681c('0x56')]=function(_0xde562e){console['log'](_0x681c('0x5e')+_0x145441[_0x681c('0x5f')][_0x681c('0x1')]+'['+_0x145441[_0x681c('0x60')]+']',_0xde562e);};_0x145441['on']('disconnect',function(){onDisconnect(_0x145441,_0x5d3b42);_0x145441[_0x681c('0x56')](_0x681c('0x61'));});onConnect(_0x145441);_0x145441[_0x681c('0x56')](_0x681c('0x62'));});}; \ No newline at end of file +var _0x9300=['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','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','then','map','where','ivr','format','%s:queue:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:inbound','voice:outbound','SmsQueues','MailQueues','IvrCampaigns','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','leave'];(function(_0x27a3cc,_0x31e238){var _0x1df5bc=function(_0x2de180){while(--_0x2de180){_0x27a3cc['push'](_0x27a3cc['shift']());}};_0x1df5bc(++_0x31e238);}(_0x9300,0x153));var _0x0930=function(_0x2b5ee5,_0x3741bf){_0x2b5ee5=_0x2b5ee5-0x0;var _0x1c480b=_0x9300[_0x2b5ee5];return _0x1c480b;};'use strict';var _=require(_0x0930('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x0930('0x1'))['db'];var config=require(_0x0930('0x2'));var queryQueues={'attributes':['id',_0x0930('0x3')],'include':[{'as':_0x0930('0x4'),'model':db[_0x0930('0x5')],'attributes':['id','name',_0x0930('0x6')],'raw':!![],'where':{'role':_0x0930('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x0930('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0930('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x0930('0x3')],'where':{'role':_0x0930('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0930('0x3'),_0x0930('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4a7705,_0x31aaa2,_0x4b1994){return db[_0x0930('0xa')][_0x0930('0xb')]({'where':{'name':_0x4a7705,'userProfileId':_0x31aaa2},'raw':!![]})['then'](function(_0x6db8ef){if(_0x6db8ef){if(_0x6db8ef['autoAssociation']){switch(_0x4a7705){case'VoiceQueues':case _0x0930('0xc'):case _0x0930('0xd'):case'SmsQueues':case'MailQueues':case _0x0930('0xe'):case _0x0930('0xf'):return db[_0x4b1994][_0x0930('0x10')](queryQueues);case _0x0930('0x11'):return db[_0x4b1994][_0x0930('0x10')](queryTelephones);case _0x0930('0x12'):return db[_0x4b1994]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x4b1994]['findAll'](queryCampaigns);}}else{return db[_0x0930('0x13')]['findAll']({'attributes':[_0x0930('0x14')],'where':{'sectionId':_0x6db8ef['id']},'raw':!![]})[_0x0930('0x15')](function(_0x255988){if(_0x255988){var _0x3af83f={'where':{'id':_[_0x0930('0x16')](_0x255988,_0x0930('0x14'))},'raw':!![]};switch(_0x4b1994){case'User':_0x3af83f[_0x0930('0x17')][_0x0930('0x6')]='telephone';break;case'Campaign':_0x3af83f[_0x0930('0x17')][_0x0930('0x9')]=_0x0930('0x18');break;}return db[_0x4b1994][_0x0930('0x10')](_0x3af83f);}else{return[];}});}}else{return[];}})[_0x0930('0x15')](function(_0x4b1eb0){return _0x4b1eb0;});}function joinOrLeaveQueues(_0x19b4e4,_0x16c5fb,_0x4cf8ad,_0x1aa8bb){_0x19b4e4[_0x16c5fb](util[_0x0930('0x19')](_0x0930('0x1a'),_0x4cf8ad,_0x1aa8bb[_0x0930('0x3')]));if(_0x1aa8bb[_0x0930('0x4')]){for(var _0xea7c6c=0x0;_0xea7c6c<_0x1aa8bb['Agents']['length'];_0xea7c6c+=0x1){_0x19b4e4[_0x16c5fb](util[_0x0930('0x19')]('user:%s',_0x1aa8bb[_0x0930('0x4')][_0xea7c6c][_0x0930('0x3')]));}}}function joinOrLeave(_0x361264,_0x4aac18,_0x37e243){var _0x48bdf5;if(_0x361264[_0x0930('0x1b')][_0x0930('0x1c')]['id']){db['User']['find']({'attributes':['id',_0x0930('0x3'),_0x0930('0x6'),_0x0930('0x1d')],'where':{'id':_0x361264[_0x0930('0x1b')][_0x0930('0x1c')]['id']},'include':[{'model':db[_0x0930('0x1e')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x1f')],'as':_0x0930('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x21')],'as':_0x0930('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x23')],'as':_0x0930('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x25')],'as':_0x0930('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x27')],'as':_0x0930('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2a47f2){if(_0x2a47f2){_0x48bdf5=_0x2a47f2;_0x361264[_0x4aac18](util['format'](_0x0930('0x29'),_0x2a47f2[_0x0930('0x3')]));var _0x2e21c7=[];switch(_0x2a47f2['role']){case _0x0930('0x2a'):_0x361264[_0x4aac18]('voice:inbound');_0x361264[_0x4aac18]('voice:outbound');if(queryQueues[_0x0930('0x2b')]('include')){delete queryQueues[_0x0930('0x2c')];}_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x2e')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x2f')]['findAll'](queryQueues));_0x2e21c7['push'](db[_0x0930('0x30')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x31')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x32')][_0x0930('0x10')](queryQueues));_0x2e21c7['push'](db[_0x0930('0x33')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x34')]['findAll'](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryTelephones));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x35')]['findAll'](queryTrunks));_0x2e21c7['push'](db[_0x0930('0x36')][_0x0930('0x10')](queryCampaigns));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryAgents));break;case _0x0930('0x37'):_0x361264[_0x4aac18](_0x0930('0x38'));_0x361264[_0x4aac18](_0x0930('0x39'));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources('VoiceQueues',_0x2a47f2[_0x0930('0x1d')],_0x0930('0x2e')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xc'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x2f')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xd'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x30')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x3a'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x31')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x3b'),_0x2a47f2['userProfileId'],'MailQueue'));_0x2e21c7['push'](getAssociatedResources(_0x0930('0xe'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x33')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xf'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x34')));_0x2e21c7['push'](getAssociatedResources(_0x0930('0x11'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x5')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x12'),_0x2a47f2['userProfileId'],_0x0930('0x35')));_0x2e21c7['push'](getAssociatedResources(_0x0930('0x3c'),_0x2a47f2[_0x0930('0x1d')],'Campaign'));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryAgents));break;case _0x0930('0x7'):_0x361264[_0x4aac18]('voice:inbound');_0x361264[_0x4aac18](_0x0930('0x39'));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2['getVoiceQueues']({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3d')]({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3e')]({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3f')]({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2['getMailQueues']({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x40')]({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x41')]({'attributes':['id',_0x0930('0x3')]}));break;}return BPromise[_0x0930('0x42')](_0x2e21c7);}})['then'](function(_0x1b9af2){if(_0x1b9af2&&_0x1b9af2['length']){for(var _0x294e15=0x0;_0x294e15<_0x1b9af2[_0x0930('0x43')];_0x294e15+=0x1){for(var _0x2d6d40=0x0;_0x2d6d40<_0x1b9af2[_0x294e15][_0x0930('0x43')];_0x2d6d40+=0x1){switch(_0x294e15){case 0x0:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x44'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x1:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x45'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x2:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x46'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x3:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x47'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x4:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x48'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x5:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x49'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x6:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x4a'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x7:if(_0x48bdf5[_0x0930('0x6')]!==_0x0930('0x7'))_0x361264[_0x4aac18](util[_0x0930('0x19')](_0x0930('0x4b'),_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0x8:if(_0x48bdf5[_0x0930('0x6')]!=='agent')_0x361264[_0x4aac18](util[_0x0930('0x19')]('trunk:%s',_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0x9:if(_0x48bdf5['role']!==_0x0930('0x7'))_0x361264[_0x4aac18](util[_0x0930('0x19')]('campaign:%s:%s',_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x9')],_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0xa:_0x361264[_0x4aac18](util[_0x0930('0x19')](_0x0930('0x29'),_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;}}}}})['then'](function(){if(_0x4aac18==='leave'){var _0x50b47d=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x4c')],'id');return _0x48bdf5[_0x0930('0x4d')](_0x50b47d)[_0x0930('0x15')](function(){for(var _0x2ceb03=0x0;_0x2ceb03<_0x50b47d[_0x0930('0x43')];_0x2ceb03+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x4f'),{'ChatInteractionId':Number(_0x50b47d[_0x2ceb03]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x1d8124=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x20')],'id');return _0x48bdf5[_0x0930('0x51')](_0x1d8124)[_0x0930('0x15')](function(){for(var _0x58e812=0x0;_0x58e812<_0x1d8124['length'];_0x58e812+=0x1){_0x37e243['emit'](_0x0930('0x52'),{'MailInteractionId':Number(_0x1d8124[_0x58e812]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x38da03=_['map'](_0x48bdf5['FaxInteractions'],'id');return _0x48bdf5[_0x0930('0x53')](_0x38da03)[_0x0930('0x15')](function(){for(var _0x2d7ef2=0x0;_0x2d7ef2<_0x38da03[_0x0930('0x43')];_0x2d7ef2+=0x1){_0x37e243['emit'](_0x0930('0x54'),{'FaxInteractionId':Number(_0x38da03[_0x2d7ef2]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x3f47f2=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x24')],'id');return _0x48bdf5[_0x0930('0x55')](_0x3f47f2)[_0x0930('0x15')](function(){for(var _0x310199=0x0;_0x310199<_0x3f47f2[_0x0930('0x43')];_0x310199+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x56'),{'SmsInteractionId':Number(_0x3f47f2[_0x310199]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0xda8945=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x26')],'id');return _0x48bdf5[_0x0930('0x57')](_0xda8945)[_0x0930('0x15')](function(){for(var _0x1297ab=0x0;_0x1297ab<_0xda8945[_0x0930('0x43')];_0x1297ab+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x58'),{'OpenchannelInteractionId':Number(_0xda8945[_0x1297ab]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x5aa376=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x28')],'id');return _0x48bdf5[_0x0930('0x59')](_0x5aa376)[_0x0930('0x15')](function(){for(var _0x3a96c0=0x0;_0x3a96c0<_0x5aa376[_0x0930('0x43')];_0x3a96c0+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x5a'),{'WhatsappInteractionId':Number(_0x5aa376[_0x3a96c0]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x5b')](function(_0x41e35b){_0x361264[_0x0930('0x5c')](_0x41e35b);});}}function onDisconnect(_0x30ad0b,_0x2fd05d){joinOrLeave(_0x30ad0b,_0x0930('0x50'),_0x2fd05d);}function onConnect(_0x7bd12d){joinOrLeave(_0x7bd12d,_0x0930('0x5d'));}exports['default']=function(_0x37b3b2){_0x37b3b2['on'](_0x0930('0x5e'),function(_0x564008){_0x564008[_0x0930('0x5f')](0x0);_0x564008[_0x0930('0x60')]=_0x564008[_0x0930('0x61')][_0x0930('0x5e')][_0x0930('0x62')]+':'+_0x564008['request'][_0x0930('0x5e')]['remotePort'];_0x564008[_0x0930('0x63')]=new Date();_0x564008[_0x0930('0x5c')]=function(_0x35b867){console['log'](_0x0930('0x64')+_0x564008[_0x0930('0x65')][_0x0930('0x3')]+'['+_0x564008['address']+']',_0x35b867);};_0x564008['on'](_0x0930('0x66'),function(){onDisconnect(_0x564008,_0x37b3b2);_0x564008[_0x0930('0x5c')](_0x0930('0x67'));});onConnect(_0x564008);_0x564008[_0x0930('0x5c')](_0x0930('0x68'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 03bca81..7b42467 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 _0x93e9=['jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','newinteraction','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','SIP/%s','name','agent','incomingmessage','outgoingmessage','opened','resolve','format','AfterCreate','closed','changed','substatus','query','interface','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb'];(function(_0x56a1ff,_0x30af44){var _0x3c5e7e=function(_0x3004a7){while(--_0x3004a7){_0x56a1ff['push'](_0x56a1ff['shift']());}};_0x3c5e7e(++_0x30af44);}(_0x93e9,0xd6));var _0x993e=function(_0x5bd381,_0x4dc995){_0x5bd381=_0x5bd381-0x0;var _0x53f5d2=_0x93e9[_0x5bd381];return _0x53f5d2;};'use strict';var util=require(_0x993e('0x0'));var db=require(_0x993e('0x1'))['db'];var jayson=require(_0x993e('0x2'));var logger=require(_0x993e('0x3'))('triggers');var client=jayson[_0x993e('0x4')][_0x993e('0x5')]({'port':0x232a});var triggers=[{'channel':_0x993e('0x6'),'model':_0x993e('0x7'),'event':_0x993e('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x993e('0x6'),'model':_0x993e('0x7'),'event':_0x993e('0x9'),'condition':_0x993e('0xa'),'callback':afterUpdate},{'channel':_0x993e('0x6'),'model':'ChatMessage','event':_0x993e('0x8'),'condition':_0x993e('0xb'),'callback':afterCreateMessage},{'channel':_0x993e('0xc'),'model':_0x993e('0xd'),'event':_0x993e('0x8'),'condition':_0x993e('0xe'),'callback':afterCreate},{'channel':'Sms','model':_0x993e('0xd'),'event':_0x993e('0x9'),'condition':_0x993e('0xa'),'callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':'afterCreate','condition':_0x993e('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x993e('0xf'),'event':_0x993e('0x8'),'condition':_0x993e('0xe'),'callback':afterCreate},{'channel':_0x993e('0x10'),'model':_0x993e('0xf'),'event':_0x993e('0x9'),'condition':_0x993e('0xa'),'callback':afterUpdate},{'channel':_0x993e('0x10'),'model':_0x993e('0x11'),'event':_0x993e('0x8'),'condition':_0x993e('0xb'),'callback':afterCreateMessage},{'channel':_0x993e('0x12'),'model':_0x993e('0x13'),'event':_0x993e('0x8'),'condition':_0x993e('0xe'),'callback':afterCreate},{'channel':_0x993e('0x12'),'model':'FaxInteraction','event':_0x993e('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x993e('0x12'),'model':_0x993e('0x14'),'event':_0x993e('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x993e('0x15'),'model':_0x993e('0x16'),'event':_0x993e('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x993e('0x15'),'model':'MailInteraction','event':_0x993e('0x9'),'condition':_0x993e('0xa'),'callback':afterUpdate},{'channel':_0x993e('0x15'),'model':_0x993e('0x17'),'event':_0x993e('0x8'),'condition':_0x993e('0xb'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x993e('0x18'),'event':_0x993e('0x8'),'condition':_0x993e('0xe'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x993e('0xa'),'callback':afterUpdate},{'channel':_0x993e('0x19'),'model':_0x993e('0x1a'),'event':_0x993e('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x4a6a21){return client[_0x993e('0x1b')](_0x993e('0x1c'),_0x4a6a21)[_0x993e('0x1d')](function(_0x183624){logger['info'](_0x993e('0x1e'),_0x993e('0x1c'),_0x183624);if(_0x183624[_0x993e('0x1f')]){if(_0x183624[_0x993e('0x1f')][_0x993e('0x20')]===0x1f4){logger[_0x993e('0x1f')](_0x993e('0x1e'),_0x993e('0x1c'),_0x183624['error']);}}})[_0x993e('0x21')](function(_0xa1c929){logger['error'](_0x993e('0x1e'),_0x993e('0x1c'),_0xa1c929);});}function afterCreateMessage(_0x2bcb55){return function(_0x513dfe){_0x513dfe=_0x513dfe[_0x993e('0x22')]({'plain':!![]});_0x513dfe[_0x993e('0x23')]=_0x2bcb55;_0x513dfe[_0x993e('0x24')]=_0x2bcb55;_0x513dfe[_0x993e('0x25')]=_0x513dfe['direction'];Promise['resolve']()['then'](function(){if(typeof _0x513dfe[_0x993e('0x26')]===_0x993e('0x27'))return null;var _0x5cb4ba=_0x993e('0x28')+_0x513dfe[_0x993e('0x26')];return db[_0x993e('0x29')]['query'](_0x5cb4ba,{'type':db[_0x993e('0x2a')][_0x993e('0x2b')][_0x993e('0x2c')],'raw':!![]});})['then'](function(_0x4f51d3){if(_0x4f51d3){_0x513dfe[_0x993e('0x2d')]=_0x4f51d3[0x0];}if(typeof _0x513dfe[_0x993e('0x2e')]==='undefined')return;return getAgent(_0x513dfe['UserId']);})[_0x993e('0x1d')](function(_0xc3c1cd){if(_0xc3c1cd){_0x513dfe['interface']=util['format'](_0x993e('0x2f'),_0xc3c1cd[_0x993e('0x30')]);_0x513dfe[_0x993e('0x31')]=_0xc3c1cd;_0x513dfe['channel']=_0x2bcb55;return request({'event':_0x993e('0x32'),'message':_0x513dfe});}else{return request({'event':_0x993e('0x33'),'message':_0x513dfe});}})[_0x993e('0x21')](function(_0xeecf32){logger[_0x993e('0x1f')]('Trigger,\x20%s','AfterCreateMessage',_0xeecf32);});};}function afterCreate(_0x3ded37,_0xaf5f99){return function(_0x56e6a1){_0x56e6a1=_0x56e6a1[_0x993e('0x22')]({'plain':!![]});_0x56e6a1[_0x993e('0x23')]=_0x3ded37;_0x56e6a1[_0x993e('0x24')]=_0x3ded37;_0x56e6a1['event']=_0x993e('0x34');Promise[_0x993e('0x35')]()[_0x993e('0x1d')](function(){var _0x1ed7f9=_0x993e('0x28')+_0x56e6a1[_0x993e('0x26')];return db['sequelize']['query'](_0x1ed7f9,{'type':db[_0x993e('0x2a')][_0x993e('0x2b')][_0x993e('0x2c')],'raw':!![]});})[_0x993e('0x1d')](function(_0x1afd13){if(_0x1afd13){_0x56e6a1[_0x993e('0x2d')]=_0x1afd13[0x0];}if(typeof _0x56e6a1[_0x993e('0x2e')]===_0x993e('0x27'))return;return getAgent(_0x56e6a1['UserId']);})[_0x993e('0x1d')](function(_0x4a3e23){if(_0x4a3e23){_0x56e6a1['interface']=util[_0x993e('0x36')]('SIP/%s',_0x4a3e23[_0x993e('0x30')]);_0x56e6a1['agent']=_0x4a3e23;}return request({'event':_0xaf5f99,'message':_0x56e6a1});})[_0x993e('0x21')](function(_0x296ba2){logger['error'](_0x993e('0x1e'),_0x993e('0x37'),_0x296ba2);});};}function afterUpdate(_0x15c7d1){return function(_0x10b3ec){var _0xc54ade=_0x10b3ec['changed']('closed')&&_0x10b3ec[_0x993e('0x38')];var _0xbf21b7=_0x10b3ec[_0x993e('0x39')]('substatus');if(_0xc54ade||_0xbf21b7){var _0x6f0608=_0xc54ade?'closedinteraction':_0x993e('0x3a');var _0x254274=_0x10b3ec[_0x993e('0x22')]({'plain':!![]});_0x254274[_0x993e('0x23')]=_0x15c7d1;_0x254274['motionChannel']=_0x15c7d1;_0x254274[_0x993e('0x25')]=_0xc54ade?'closed':_0x993e('0x3a');var _0x49d24a=_0x993e('0x28')+_0x254274[_0x993e('0x26')];return db[_0x993e('0x29')][_0x993e('0x3b')](_0x49d24a,{'type':db[_0x993e('0x2a')][_0x993e('0x2b')]['SELECT'],'raw':!![]})[_0x993e('0x1d')](function(_0x47fe8c){if(_0x47fe8c){_0x254274['contact']=_0x47fe8c[0x0];}if(typeof _0x254274[_0x993e('0x2e')]==='undefined')return;return getAgent(_0x254274[_0x993e('0x2e')]);})[_0x993e('0x1d')](function(_0x4c6103){if(_0x4c6103){_0x254274[_0x993e('0x3c')]=util[_0x993e('0x36')](_0x993e('0x2f'),_0x4c6103[_0x993e('0x30')]);_0x254274[_0x993e('0x31')]=_0x4c6103;}return request({'event':_0x6f0608,'message':_0x254274});})[_0x993e('0x21')](function(_0xfc9484){logger['error'](_0x993e('0x1e'),'AfterUpdate',_0xfc9484);});}};}function getAgent(_0xf0504a){return db['User']['find']({'where':{'id':_0xf0504a},'attributes':['id','name',_0x993e('0x3d'),_0x993e('0x3e'),_0x993e('0x3f')],'raw':!![]})[_0x993e('0x1d')](function(_0x45016f){return _0x45016f;});}exports[_0x993e('0x40')]=function(){for(var _0x3347e4=0x0;_0x3347e4=_0x1f97be[_0x1127('0x14')]){throw Error(_0x1127('0x15'));}_0x27880e(_0x34c0d5);})[_0x1127('0x16')](function(_0x28d3ef){_0x1c7b34(_0x28d3ef);});});}; \ No newline at end of file +var _0xaf4e=['clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','../mysqldb','./license/util','voice','mail','chat','fax','whatsapp','openchannel','getChannels','toLowerCase','includes'];(function(_0x114a4c,_0x6fe14d){var _0x52b16a=function(_0x140fb4){while(--_0x140fb4){_0x114a4c['push'](_0x114a4c['shift']());}};_0x52b16a(++_0x6fe14d);}(_0xaf4e,0xdc));var _0xeaf4=function(_0x3e4371,_0x204933){_0x3e4371=_0x3e4371-0x0;var _0x545a06=_0xaf4e[_0x3e4371];return _0x545a06;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0xeaf4('0x0'))['db'];var util=require(_0xeaf4('0x1'));var channels=[_0xeaf4('0x2'),_0xeaf4('0x3'),_0xeaf4('0x4'),_0xeaf4('0x5'),'sms',_0xeaf4('0x6'),_0xeaf4('0x7')];exports[_0xeaf4('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x36686c){_0x36686c=_0x36686c[_0xeaf4('0x9')]();return _[_0xeaf4('0xa')](channels,_0x36686c);};exports[_0xeaf4('0xb')]=function(_0x2efce8,_0x1e5cab,_0x5e775a,_0x2292c2){var _0x185bf2={'loginAttempts':_0x1e5cab,'blocked':_0x5e775a};if(!_[_0xeaf4('0xc')](_0x2292c2)){_0x185bf2[_0xeaf4('0xd')]=_0x2292c2;}return _0x2efce8[_0xeaf4('0xe')](_0x185bf2);};exports['getLicense']=function(_0x1e0f4d){return new BPromise(function(_0x299828,_0x5e54c9){var _0x26b376=0x0;if(_0x1e0f4d[_0xeaf4('0xf')]!==_0xeaf4('0x10')){_0x299828(_0x1e0f4d);}db['User']['count']({'where':{'role':_0xeaf4('0x10'),'online':!![],'id':{'$ne':_0x1e0f4d['id']}}})[_0xeaf4('0x11')](function(_0x8e742a){_0x26b376=_0x8e742a;return util['getLicense']();})[_0xeaf4('0x11')](function(_0x3a4b41){if(_0x3a4b41&&_0x3a4b41[_0xeaf4('0x12')]&&_0x26b376>=_0x3a4b41[_0xeaf4('0x12')]){throw Error(_0xeaf4('0x13'));}_0x299828(_0x1e0f4d);})[_0xeaf4('0x14')](function(_0x53f727){_0x5e54c9(_0x53f727);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 6b34739..dc14c80 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc57d=['status','404'];(function(_0x21fded,_0x203183){var _0x5927de=function(_0x1e5762){while(--_0x1e5762){_0x21fded['push'](_0x21fded['shift']());}};_0x5927de(++_0x203183);}(_0xc57d,0x1c1));var _0xdc57=function(_0xc10f8a,_0x3b4864){_0xc10f8a=_0xc10f8a-0x0;var _0x236343=_0xc57d[_0xc10f8a];return _0x236343;};'use strict';module['exports'][0x194]=function pageNotFound(_0x5b66cf,_0x8753fc){var _0x251aba=_0xdc57('0x0');var _0x1ba3ac=0x194;var _0x482425={'status':_0x1ba3ac};_0x8753fc[_0xdc57('0x1')](_0x482425[_0xdc57('0x1')]);_0x8753fc['render'](_0x251aba,{},function(_0x27ffdc,_0x486019){if(_0x27ffdc){return _0x8753fc[_0xdc57('0x1')](_0x482425[_0xdc57('0x1')])['json'](_0x482425);}_0x8753fc['send'](_0x486019);});}; \ No newline at end of file +var _0xbc23=['send','exports','404','status'];(function(_0x54bb22,_0x5e210e){var _0x233652=function(_0x10e916){while(--_0x10e916){_0x54bb22['push'](_0x54bb22['shift']());}};_0x233652(++_0x5e210e);}(_0xbc23,0x1bd));var _0x3bc2=function(_0x95086b,_0x1d1dba){_0x95086b=_0x95086b-0x0;var _0x1d672b=_0xbc23[_0x95086b];return _0x1d672b;};'use strict';module[_0x3bc2('0x0')][0x194]=function pageNotFound(_0x49a2ee,_0x52abda){var _0x44ecb0=_0x3bc2('0x1');var _0x473517=0x194;var _0x44738e={'status':_0x473517};_0x52abda[_0x3bc2('0x2')](_0x44738e[_0x3bc2('0x2')]);_0x52abda['render'](_0x44ecb0,{},function(_0x4b0f26,_0x1e9c2b){if(_0x4b0f26){return _0x52abda['status'](_0x44738e['status'])['json'](_0x44738e);}_0x52abda[_0x3bc2('0x3')](_0x1e9c2b);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 914bad0..ec28f64 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa74f=['MailAccountId','Imap','hasOne','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','Team','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','IntervalId','TagId','DashboardItem','Exntensions','FaxAccountId','fax_interaction_has_tags','ThroughTags','Users','FaxInteractionId','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteraction','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','Pause','OpenchannelQueueId','OpenchannelInteractionId','Owner','openchannel_interaction_has_tags','ProactiveActions','ChatMessage','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','ParentId','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','Trigger','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','DefaultReportId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Subjects','Field','VariableId','DeskAccount','DeskField','int_desk_configuration_has_tags','ZendeskAccount','ZendeskField','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','FromId','SessionId','SmsQueueReport','ProjectId','MailQueues','ChatQueues','FaxQueues','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromUserId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappMessage','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','exports','lodash','sequelize','defaultsDeep','motion2','xC@LL1234','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','127.0.0.1','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../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','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','VoiceMail','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserMailQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId'];(function(_0x4bd611,_0x23855a){var _0x5d5606=function(_0x56b564){while(--_0x56b564){_0x4bd611['push'](_0x4bd611['shift']());}};_0x5d5606(++_0x23855a);}(_0xa74f,0x9a));var _0xfa74=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0xa74f[_0x11f226];return _0x30be77;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0xfa74('0x0'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xfa74('0x1')]=_[_0xfa74('0x2')](config[_0xfa74('0x1')],{'database':_0xfa74('0x3'),'username':'xcall','password':_0xfa74('0x4'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xfa74('0x5')},'logging':![],'timezone':timezone[_0xfa74('0x6')](),'define':{'charset':_0xfa74('0x7'),'collate':_0xfa74('0x8')}}});config[_0xfa74('0x9')]=_[_0xfa74('0x2')](config['sequelizeHistory'],{'database':_0xfa74('0x3'),'username':_0xfa74('0xa'),'password':_0xfa74('0x4'),'options':{'host':_0xfa74('0xb'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xfa74('0x5')},'logging':![],'timezone':timezone[_0xfa74('0x6')](),'define':{'charset':'utf8','collate':_0xfa74('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfa74('0x1')][_0xfa74('0xc')],config[_0xfa74('0x1')]['username'],config[_0xfa74('0x1')][_0xfa74('0xd')],config[_0xfa74('0x1')][_0xfa74('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xfa74('0xc')],config[_0xfa74('0x9')][_0xfa74('0xf')],config[_0xfa74('0x9')][_0xfa74('0xd')],config['sequelizeHistory'][_0xfa74('0xe')])};db[_0xfa74('0x10')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x12'));db[_0xfa74('0x13')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x14'));db[_0xfa74('0x15')]=db['sequelize']['import'](_0xfa74('0x16'));db[_0xfa74('0x17')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x18'));db[_0xfa74('0x19')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x1a'));db[_0xfa74('0x1b')]=db[_0xfa74('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db[_0xfa74('0x1c')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x1d'));db[_0xfa74('0x1e')]=db['sequelize']['import'](_0xfa74('0x1f'));db['VoiceMail']=db['sequelize']['import'](_0xfa74('0x20'));db[_0xfa74('0x21')]=db[_0xfa74('0x1')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0xfa74('0x22')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x23'));db['VoiceDialReport']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/voiceDialReport/voiceDialReport.model');db[_0xfa74('0x24')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x25'));db['VoiceQueueReport']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x26'));db['MemberReport']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x27'));db['Trunk']=db['sequelize'][_0xfa74('0x11')]('../api/trunk/trunk.model');db[_0xfa74('0x28')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x29'));db[_0xfa74('0x2a')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x2b'));db[_0xfa74('0x2c')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x2d'));db[_0xfa74('0x2e')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x2f'));db['UserMailQueue']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x30'));db[_0xfa74('0x31')]=db['sequelize']['import'](_0xfa74('0x32'));db[_0xfa74('0x33')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/userSmsQueue/userSmsQueue.model');db[_0xfa74('0x34')]=db[_0xfa74('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db['sequelize']['import'](_0xfa74('0x35'));db[_0xfa74('0x36')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x37'));db[_0xfa74('0x38')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x39'));db['MailAccount']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x3a'));db[_0xfa74('0x3b')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/mailQueue/mailQueue.model');db[_0xfa74('0x3c')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x3d'));db['MailInteraction']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x3e'));db[_0xfa74('0x3f')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x40'));db[_0xfa74('0x41')]=db['sequelize']['import'](_0xfa74('0x42'));db[_0xfa74('0x43')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/mailQueueReport/mailQueueReport.model');db[_0xfa74('0x44')]=db[_0xfa74('0x1')]['import']('../api/dashboard/dashboard.model');db['DashboardItem']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x45'));db[_0xfa74('0x46')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x47'));db[_0xfa74('0x48')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x49'));db[_0xfa74('0x4a')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0xfa74('0x4b')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x4c'));db[_0xfa74('0x4d')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x4e'));db[_0xfa74('0x4f')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x50'));db['SmsAccount']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x51'));db[_0xfa74('0x52')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x53'));db['SmsInteraction']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0xfa74('0x54')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x55'));db[_0xfa74('0x56')]=db['sequelize']['import'](_0xfa74('0x57'));db[_0xfa74('0x58')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x59'));db[_0xfa74('0x5a')]=db['sequelize']['import'](_0xfa74('0x5b'));db[_0xfa74('0x5c')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x5d'));db[_0xfa74('0x5e')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/openchannelMessage/openchannelMessage.model');db[_0xfa74('0x5f')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x60'));db['ChatWebsite']=db['sequelize'][_0xfa74('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0xfa74('0x61')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x62'));db[_0xfa74('0x63')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/chatApplication/chatApplication.model');db[_0xfa74('0x64')]=db['sequelize'][_0xfa74('0x11')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x65'));db[_0xfa74('0x66')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x67'));db[_0xfa74('0x68')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/chatGroup/chatGroup.model');db[_0xfa74('0x69')]=db[_0xfa74('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0xfa74('0x6a')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x6b'));db[_0xfa74('0x6c')]=db['sequelize'][_0xfa74('0x11')]('../api/cmContact/cmContact.model');db[_0xfa74('0x6d')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x6e'));db[_0xfa74('0x6f')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x70'));db['CmHopperHistory']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x71'));db[_0xfa74('0x72')]=db['sequelize'][_0xfa74('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xfa74('0x73')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x74'));db[_0xfa74('0x75')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x76'));db[_0xfa74('0x77')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x78'));db[_0xfa74('0x79')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/cannedAnswer/cannedAnswer.model');db[_0xfa74('0x7a')]=db[_0xfa74('0x1')]['import']('../api/disposition/disposition.model');db[_0xfa74('0x7b')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x7c'));db[_0xfa74('0x7d')]=db['sequelize'][_0xfa74('0x11')]('../api/interval/interval.model');db['Pause']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x7e'));db[_0xfa74('0x7f')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x80'));db[_0xfa74('0x81')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x82'));db['Schedule']=db[_0xfa74('0x1')]['import'](_0xfa74('0x83'));db[_0xfa74('0x84')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x85'));db[_0xfa74('0x86')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x87'));db[_0xfa74('0x88')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x89'));db['Trigger']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x8a'));db[_0xfa74('0x8b')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x8c'));db[_0xfa74('0x8d')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x8e'));db[_0xfa74('0x8f')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x90'));db[_0xfa74('0x91')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x92'));db[_0xfa74('0x93')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x94'));db[_0xfa74('0x95')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xfa74('0x96')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x97'));db['AnalyticFieldReport']=db[_0xfa74('0x1')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0xfa74('0x98')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x99'));db['SalesforceAccount']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x9a'));db[_0xfa74('0x9b')]=db[_0xfa74('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x9c'));db[_0xfa74('0x9d')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x9e'));db[_0xfa74('0x9f')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xa0'));db[_0xfa74('0xa1')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xa2'));db['DeskAccount']=db['sequelize']['import'](_0xfa74('0xa3'));db[_0xfa74('0xa4')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xa5'));db['DeskField']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/intDeskField/intDeskField.model');db[_0xfa74('0xa6')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xa7'));db[_0xfa74('0xa8')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xa9'));db[_0xfa74('0xaa')]=db[_0xfa74('0x1')]['import']('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xfa74('0xab')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xac'));db['ZendeskField']=db[_0xfa74('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db[_0xfa74('0xad')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xfa74('0xae')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xaf'));db['FreshdeskField']=db['sequelize']['import'](_0xfa74('0xb0'));db[_0xfa74('0xb1')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xb2'));db['VtigerConfiguration']=db['sequelize'][_0xfa74('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xfa74('0xb3')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xb4'));db[_0xfa74('0xb5')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xb6'));db[_0xfa74('0xb7')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xb8'));db[_0xfa74('0xb9')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xba'));db[_0xfa74('0xbb')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xbc'));db[_0xfa74('0xbd')]=db['sequelize']['import'](_0xfa74('0xbe'));db[_0xfa74('0xbf')]=db[_0xfa74('0x1')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xfa74('0xc0')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xc1'));db[_0xfa74('0xc2')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xfa74('0xc3')]=db['sequelize']['import'](_0xfa74('0xc4'));db[_0xfa74('0x8d')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x8e'));db['Network']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xc5'));db[_0xfa74('0xc6')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xc7'));db['ChatInternalMessage']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xfa74('0xc8')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xfa74('0xc9')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xca'));db[_0xfa74('0xcb')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xcc'));db['SmsQueueReport']=db['sequelize'][_0xfa74('0x11')]('../api/smsQueueReport/smsQueueReport.model');db[_0xfa74('0xcd')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xce'));db[_0xfa74('0xcf')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xd0'));db[_0xfa74('0xd1')]=db[_0xfa74('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xd2'));db['SquareOdbc']=db[_0xfa74('0x1')]['import'](_0xfa74('0xd3'));db[_0xfa74('0xd4')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xd5'));db[_0xfa74('0xd6')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xd7'));db[_0xfa74('0xd8')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xd9'));db['Team']=db[_0xfa74('0x1')]['import'](_0xfa74('0xda'));db[_0xfa74('0xdb')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xdc'));db[_0xfa74('0xdd')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xde'));db['Migration']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xdf'));db['Attachment']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/attachment/attachment.model');db[_0xfa74('0xe0')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xe1'));db[_0xfa74('0xe2')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xe3'));db[_0xfa74('0xe4')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xe5'));db[_0xfa74('0xe6')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/faxTransferReport/faxTransferReport.model');db[_0xfa74('0xe7')]=db['sequelize'][_0xfa74('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xfa74('0xe8')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0xfa74('0xe9')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xea'));db[_0xfa74('0xeb')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xec'));db[_0xfa74('0xed')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xee'));db[_0xfa74('0xef')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xf0'));db[_0xfa74('0xf1')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xf2'));db[_0xfa74('0xf3')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xf4'));db[_0xfa74('0xf5')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xf6'));db[_0xfa74('0xf7')]=db['sequelize']['import'](_0xfa74('0xf8'));db[_0xfa74('0xf9')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xfa'));db['WhatsappMessage']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xfb'));db[_0xfa74('0xfc')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xfd'));db[_0xfa74('0xfe')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xfa74('0xff')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x100'));db[_0xfa74('0x101')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x102'));db[_0xfa74('0x103')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x104'));db[_0xfa74('0x105')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x106'));db[_0xfa74('0x107')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x108'));db[_0xfa74('0x10')]['hasOne'](db[_0xfa74('0x109')],{'as':'VoiceMail','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x1c')],{'as':'Recordings','foreignKey':'UserId'});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x2a')],{'as':_0xfa74('0x10d'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x10e'),'onDelete':'cascade','hooks':!![]});db['User'][_0xfa74('0x10c')](db[_0xfa74('0x6f')],{'as':_0xfa74('0x10f'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db['CmHopperHistory'],{'as':_0xfa74('0x110'),'foreignKey':_0xfa74('0x10b')});db['User'][_0xfa74('0x10c')](db[_0xfa74('0x72')],{'as':_0xfa74('0x72'),'foreignKey':_0xfa74('0x10b')});db['User'][_0xfa74('0x10c')](db[_0xfa74('0x5c')],{'as':_0xfa74('0x111'),'foreignKey':'UserId'});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x64')],{'as':'ChatInteractions','foreignKey':_0xfa74('0x10b')});db['User'][_0xfa74('0x10c')](db['SmsInteraction'],{'as':_0xfa74('0x112'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x4a')],{'as':_0xfa74('0x113'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x114')],{'as':'MailInteractions','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0xf9')],{'as':_0xfa74('0x115'),'foreignKey':'UserId'});db[_0xfa74('0x10')][_0xfa74('0x10c')](db['UserNotification'],{'as':_0xfa74('0x116'),'foreignKey':_0xfa74('0x117')});db['User'][_0xfa74('0x118')](db[_0xfa74('0xed')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x68')],{'as':'Groups','through':_0xfa74('0x11a')});db[_0xfa74('0x10')][_0xfa74('0x119')](db['CmContact'],{'as':_0xfa74('0x11b'),'through':_0xfa74('0x11c')});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'as':'Lists','through':_0xfa74('0x11d')});db[_0xfa74('0x10')][_0xfa74('0x119')](db['Team'],{'through':_0xfa74('0x11e')});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x114')],{'as':_0xfa74('0x11f'),'through':_0xfa74('0x120')});db['User'][_0xfa74('0x119')](db[_0xfa74('0x64')],{'as':_0xfa74('0x121'),'through':'user_has_chat_interactions'});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x4a')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0xfa74('0x119')](db['SmsInteraction'],{'as':_0xfa74('0x112'),'through':_0xfa74('0x122')});db['User'][_0xfa74('0x119')](db[_0xfa74('0x5c')],{'as':_0xfa74('0x111'),'through':_0xfa74('0x123')});db[_0xfa74('0x10')][_0xfa74('0x119')](db['WhatsappInteraction'],{'as':_0xfa74('0x115'),'through':_0xfa74('0x124')});db['User'][_0xfa74('0x119')](db['VoiceQueue'],{'as':_0xfa74('0x125'),'through':_0xfa74('0x2c'),'required':![]});db['User'][_0xfa74('0x119')](db[_0xfa74('0xeb')],{'as':_0xfa74('0x126'),'through':_0xfa74('0x107'),'required':![]});db['User'][_0xfa74('0x119')](db[_0xfa74('0x3b')],{'as':'MailQueues','through':_0xfa74('0x127'),'required':![]});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x66')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0x4d')],{'as':'FaxQueues','through':_0xfa74('0x31'),'required':![]});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x56')],{'as':'SmsQueues','through':_0xfa74('0x33'),'required':![]});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x5f')],{'as':_0xfa74('0x128'),'through':_0xfa74('0x34'),'required':![]});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0xff')],{'as':_0xfa74('0x129'),'through':_0xfa74('0x12a'),'required':![]});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'through':_0xfa74('0x11d')});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x12c'),'through':_0xfa74('0x12d')});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0x46')],{'as':'FaxAccounts','through':_0xfa74('0x12e')});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0x12f')],{'as':_0xfa74('0x130'),'through':_0xfa74('0x131')});db['User'][_0xfa74('0x119')](db[_0xfa74('0x58')],{'as':_0xfa74('0x132'),'through':_0xfa74('0x133')});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0x134')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0xf5')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0xd4')],{'as':_0xfa74('0x135'),'through':_0xfa74('0x136')});db['VoiceChanSpy'][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':'SpiedAgents','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x137')});db['VoiceContext'][_0xfa74('0x10c')](db['VoiceExtension'],{'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x17')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x138'),'onDelete':'cascade'});db[_0xfa74('0x19')][_0xfa74('0x119')](db[_0xfa74('0x84')],{'as':_0xfa74('0x139'),'through':'moh_has_sounds'});db['VoiceQueue'][_0xfa74('0x10c')](db['UserVoiceQueueRt'],{'as':_0xfa74('0x13a'),'foreignKey':_0xfa74('0x13b')});db[_0xfa74('0x1b')][_0xfa74('0x10c')](db['CmHopper'],{'as':_0xfa74('0x13c'),'foreignKey':'VoiceQueueId'});db[_0xfa74('0x1b')][_0xfa74('0x10c')](db[_0xfa74('0x6f')],{'as':_0xfa74('0x10f'),'foreignKey':_0xfa74('0x13b')});db['VoiceQueue'][_0xfa74('0x10c')](db['CmHopperHistory'],{'as':_0xfa74('0x13d'),'foreignKey':'VoiceQueueId'});db[_0xfa74('0x1b')]['hasMany'](db[_0xfa74('0x72')],{'as':'ReportAgentPreview','foreignKey':_0xfa74('0x13b')});db['VoiceQueue'][_0xfa74('0x10c')](db[_0xfa74('0x13e')],{'as':_0xfa74('0x13f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xfa74('0x10c')](db[_0xfa74('0xcb')],{'as':_0xfa74('0x140'),'foreignKey':_0xfa74('0x13b')});db['VoiceQueue'][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x141'),'foreignKey':'TrunkId'});db[_0xfa74('0x1b')][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x142'),'foreignKey':'TrunkBackupId'});db[_0xfa74('0x1b')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'as':_0xfa74('0x7d'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0xfa74('0x118')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x143'),'through':_0xfa74('0x144')});db[_0xfa74('0x1b')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x2c')});db[_0xfa74('0x1b')][_0xfa74('0x119')](db['Team'],{'as':_0xfa74('0x146'),'through':_0xfa74('0x103')});db[_0xfa74('0x1b')]['belongsToMany'](db[_0xfa74('0xe9')],{'as':_0xfa74('0x147'),'through':_0xfa74('0x148')});db[_0xfa74('0x1c')][_0xfa74('0x118')](db['User'],{'as':'User','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x1e')]['belongsTo'](db[_0xfa74('0x10')],{'as':_0xfa74('0x10'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x109')][_0xfa74('0x10c')](db['VoiceMailMessage'],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x14a'),'sourceKey':_0xfa74('0x14b')});db[_0xfa74('0x21')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0xfa74('0x14a'),'targetKey':_0xfa74('0x14b')});db['VoiceCallReport'][_0xfa74('0x10c')](db[_0xfa74('0x14c')],{'as':_0xfa74('0x14d'),'foreignKey':_0xfa74('0x14e'),'constraints':![]});db[_0xfa74('0x22')][_0xfa74('0x10c')](db['VoiceAgentReport'],{'as':_0xfa74('0x14f'),'foreignKey':'uniqueid','constraints':![]});db[_0xfa74('0x22')]['belongsTo'](db['User'],{'as':_0xfa74('0x10'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x22')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x36')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'as':_0xfa74('0x12f'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x38')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'as':_0xfa74('0x12f'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x12f')]['hasOne'](db[_0xfa74('0x36')],{'as':_0xfa74('0x153'),'onDelete':'cascade'});db[_0xfa74('0x12f')][_0xfa74('0x154')](db[_0xfa74('0x38')],{'as':_0xfa74('0x155'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x12f')][_0xfa74('0x10c')](db[_0xfa74('0x7a')],{'as':_0xfa74('0x156'),'foreignKey':_0xfa74('0x152'),'onDelete':'cascade'});db[_0xfa74('0x12f')][_0xfa74('0x10c')](db[_0xfa74('0x79')],{'as':_0xfa74('0x157'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x12f')][_0xfa74('0x10c')](db[_0xfa74('0x3f')],{'as':_0xfa74('0x149'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x12f')][_0xfa74('0x10c')](db[_0xfa74('0x114')],{'as':_0xfa74('0x158')});db[_0xfa74('0x12f')]['hasMany'](db[_0xfa74('0x41')],{'as':_0xfa74('0x138')});db['MailAccount'][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x12f')][_0xfa74('0x118')](db[_0xfa74('0x88')],{'as':_0xfa74('0x88'),'foreignKey':_0xfa74('0x15b')});db[_0xfa74('0x12f')][_0xfa74('0x118')](db['Pause'],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db[_0xfa74('0x12f')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x131')});db[_0xfa74('0x3b')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x127')});db[_0xfa74('0x3b')][_0xfa74('0x119')](db[_0xfa74('0x15e')],{'through':_0xfa74('0x15f'),'as':_0xfa74('0x146')});db[_0xfa74('0x114')][_0xfa74('0x10c')](db['MailMessage'],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x160')});db[_0xfa74('0x114')]['belongsTo'](db[_0xfa74('0x12f')],{'as':_0xfa74('0x161'),'foreignKey':'MailAccountId'});db[_0xfa74('0x114')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x114')][_0xfa74('0x118')](db['User'],{'as':'Owner','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x114')]['belongsToMany'](db[_0xfa74('0x86')],{'through':_0xfa74('0x162'),'as':_0xfa74('0x163')});db[_0xfa74('0x114')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x162'),'as':'ThroughTags'});db['MailInteraction'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':'Users','through':_0xfa74('0x120'),'foreignKey':_0xfa74('0x160')});db[_0xfa74('0x3f')][_0xfa74('0x10c')](db['Attachment'],{'as':'Attachments','onDelete':_0xfa74('0x10a')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db['User'],{'as':_0xfa74('0x10')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x150')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x114')],{'as':_0xfa74('0x164'),'foreignKey':_0xfa74('0x160')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x12b'),'foreignKey':_0xfa74('0x165')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x166')],{'as':_0xfa74('0x166'),'foreignKey':_0xfa74('0x167')});db[_0xfa74('0x41')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db['MailApplication']['belongsTo'](db[_0xfa74('0x3b')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x41')]['belongsTo'](db[_0xfa74('0x12f')],{'onDelete':_0xfa74('0x168')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xfa74('0x169')});db[_0xfa74('0x41')]['belongsTo'](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x16a')});db[_0xfa74('0x43')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{});db[_0xfa74('0x43')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db['MailQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x43')]['belongsTo'](db[_0xfa74('0x114')],{});db[_0xfa74('0x43')][_0xfa74('0x118')](db[_0xfa74('0x3f')],{});db[_0xfa74('0x43')]['belongsTo'](db[_0xfa74('0x10')],{});db[_0xfa74('0x43')]['belongsTo'](db[_0xfa74('0x3b')],{});db[_0xfa74('0x44')][_0xfa74('0x10c')](db[_0xfa74('0x16b')],{'as':'Items','onDelete':_0xfa74('0x10a')});db[_0xfa74('0x46')]['hasMany'](db[_0xfa74('0x7a')],{'as':_0xfa74('0x156'),'foreignKey':'FaxAccountId','onDelete':_0xfa74('0x10a')});db['FaxAccount'][_0xfa74('0x10c')](db[_0xfa74('0x79')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xfa74('0x46')][_0xfa74('0x10c')](db['FaxInteraction'],{'as':_0xfa74('0x158')});db['FaxAccount']['hasMany'](db[_0xfa74('0x48')],{'as':_0xfa74('0x138')});db[_0xfa74('0x46')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x16c'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x46')]['hasMany'](db['FaxMessage'],{'as':_0xfa74('0x149')});db[_0xfa74('0x46')][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x141')});db[_0xfa74('0x46')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x46')][_0xfa74('0x118')](db['Pause'],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db[_0xfa74('0x46')][_0xfa74('0x119')](db['User'],{'as':'Agents','through':_0xfa74('0x12e')});db['FaxApplication']['belongsTo'](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x48')][_0xfa74('0x118')](db[_0xfa74('0x4d')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x48')][_0xfa74('0x118')](db[_0xfa74('0x46')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x48')][_0xfa74('0x118')](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x16a')});db['FaxInteraction'][_0xfa74('0x10c')](db[_0xfa74('0x4b')],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':'FaxInteractionId'});db[_0xfa74('0x4a')]['belongsTo'](db[_0xfa74('0x46')],{'as':'Account','foreignKey':_0xfa74('0x16d')});db[_0xfa74('0x4a')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x4a')][_0xfa74('0x118')](db['User'],{'as':'Owner','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x4a')][_0xfa74('0x119')](db['Tag'],{'through':_0xfa74('0x16e'),'as':'Tags'});db[_0xfa74('0x4a')]['belongsToMany'](db[_0xfa74('0x86')],{'through':'fax_interaction_has_tags','as':_0xfa74('0x16f')});db[_0xfa74('0x4a')]['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xfa74('0x4b')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':'cascade','as':'User'});db[_0xfa74('0x4b')][_0xfa74('0x118')](db[_0xfa74('0x4a')],{'as':_0xfa74('0x164'),'foreignKey':_0xfa74('0x171')});db['FaxMessage']['belongsTo'](db[_0xfa74('0x6c')],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x150')});db['FaxMessage'][_0xfa74('0x118')](db['Attachment'],{'as':_0xfa74('0x172'),'foreignKey':_0xfa74('0x173')});db[_0xfa74('0x4b')][_0xfa74('0x118')](db['FaxAccount'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x16d')});db['FaxQueue']['belongsToMany'](db[_0xfa74('0x10')],{'as':'Agents','through':_0xfa74('0x31')});db[_0xfa74('0x4d')][_0xfa74('0x119')](db[_0xfa74('0x15e')],{'through':_0xfa74('0x174'),'as':_0xfa74('0x146')});db[_0xfa74('0x4f')][_0xfa74('0x118')](db[_0xfa74('0x46')],{});db[_0xfa74('0x4f')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x4f')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':'ContactId'});db[_0xfa74('0x4f')][_0xfa74('0x118')](db['FaxInteraction'],{});db['FaxQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x4b')],{});db['FaxQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x10')],{});db['FaxQueueReport'][_0xfa74('0x118')](db['FaxQueue'],{});db[_0xfa74('0x134')][_0xfa74('0x10c')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xfa74('0x175'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x134')][_0xfa74('0x10c')](db['CannedAnswer'],{'as':_0xfa74('0x157'),'foreignKey':_0xfa74('0x175')});db[_0xfa74('0x134')][_0xfa74('0x10c')](db[_0xfa74('0x54')],{'as':_0xfa74('0x149'),'foreignKey':_0xfa74('0x175')});db[_0xfa74('0x134')][_0xfa74('0x10c')](db[_0xfa74('0x176')],{'as':_0xfa74('0x158')});db['SmsAccount'][_0xfa74('0x10c')](db[_0xfa74('0x52')],{'as':_0xfa74('0x138')});db['SmsAccount'][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x134')][_0xfa74('0x118')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xfa74('0x15d')});db[_0xfa74('0x134')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':'user_has_sms_accounts'});db[_0xfa74('0x52')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x52')]['belongsTo'](db[_0xfa74('0x56')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x52')]['belongsTo'](db[_0xfa74('0x134')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x52')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0x52')][_0xfa74('0x118')](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x16a')});db[_0xfa74('0x176')][_0xfa74('0x10c')](db[_0xfa74('0x54')],{'as':_0xfa74('0x149'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xfa74('0x176')][_0xfa74('0x118')](db['SmsAccount'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x175')});db[_0xfa74('0x176')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x176')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0xfa74('0x176')][_0xfa74('0x119')](db['Tag'],{'through':_0xfa74('0x177'),'as':_0xfa74('0x163')});db[_0xfa74('0x176')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'sms_interaction_has_tags','as':_0xfa74('0x16f')});db[_0xfa74('0x176')]['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x122'),'foreignKey':_0xfa74('0x178')});db[_0xfa74('0x54')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':'User'});db['SmsMessage']['belongsTo'](db[_0xfa74('0x6c')],{'onDelete':'cascade','as':'Contact'});db['SmsMessage'][_0xfa74('0x118')](db['SmsInteraction'],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x164'),'foreignKey':'SmsInteractionId'});db[_0xfa74('0x54')][_0xfa74('0x118')](db[_0xfa74('0x134')],{'as':'Account','foreignKey':_0xfa74('0x175')});db[_0xfa74('0x56')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x33'),'foreignKey':_0xfa74('0x179')});db[_0xfa74('0x56')][_0xfa74('0x119')](db[_0xfa74('0x15e')],{'through':_0xfa74('0x17a'),'as':_0xfa74('0x146')});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x7a')],{'as':'Dispositions','foreignKey':_0xfa74('0x17b'),'onDelete':'cascade'});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x79')],{'as':_0xfa74('0x157'),'foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x5c')],{'as':_0xfa74('0x158'),'foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x5e')],{'as':'Messages','foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x5a')],{'as':_0xfa74('0x138'),'foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x58')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x58')]['belongsTo'](db[_0xfa74('0x17c')],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db[_0xfa74('0x58')]['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x133')});db['OpenchannelApplication'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x5a')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x17d')});db[_0xfa74('0x5a')][_0xfa74('0x118')](db[_0xfa74('0x58')],{'onDelete':'restrict','foreignKey':_0xfa74('0x17b')});db['OpenchannelApplication']['belongsTo'](db[_0xfa74('0x7d')],{'onDelete':'restrict','foreignKey':_0xfa74('0x169')});db[_0xfa74('0x5a')][_0xfa74('0x118')](db[_0xfa74('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xfa74('0x5c')][_0xfa74('0x10c')](db['OpenchannelMessage'],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x17e')});db[_0xfa74('0x5c')][_0xfa74('0x118')](db['OpenchannelAccount'],{'as':_0xfa74('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0xfa74('0x5c')][_0xfa74('0x118')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xfa74('0x5c')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':_0xfa74('0x17f'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x5c')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x180'),'as':_0xfa74('0x163')});db[_0xfa74('0x5c')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db['OpenchannelInteraction']['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':'user_has_openchannel_interactions','foreignKey':_0xfa74('0x17e')});db[_0xfa74('0x5e')]['belongsTo'](db[_0xfa74('0x10')],{'onDelete':'cascade','as':_0xfa74('0x10')});db[_0xfa74('0x5e')][_0xfa74('0x118')](db['CmContact'],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x150')});db[_0xfa74('0x5e')][_0xfa74('0x118')](db[_0xfa74('0x5c')],{'onDelete':_0xfa74('0x10a'),'as':'Interaction','foreignKey':_0xfa74('0x17e')});db[_0xfa74('0x5e')][_0xfa74('0x118')](db[_0xfa74('0x172')],{'as':_0xfa74('0x172'),'foreignKey':_0xfa74('0x173')});db[_0xfa74('0x5e')]['belongsTo'](db[_0xfa74('0x58')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x5f')][_0xfa74('0x119')](db['User'],{'as':_0xfa74('0x145'),'through':_0xfa74('0x34'),'foreignKey':_0xfa74('0x17d')});db[_0xfa74('0x5f')][_0xfa74('0x119')](db['Team'],{'through':'team_has_openchannel_queues','as':_0xfa74('0x146')});db[_0xfa74('0x12b')][_0xfa74('0x10c')](db['Disposition'],{'as':_0xfa74('0x156'),'foreignKey':_0xfa74('0x165'),'onDelete':'cascade'});db[_0xfa74('0x12b')]['hasMany'](db[_0xfa74('0x79')],{'as':_0xfa74('0x157'),'foreignKey':_0xfa74('0x165')});db[_0xfa74('0x12b')][_0xfa74('0x10c')](db[_0xfa74('0x69')],{'as':_0xfa74('0x181')});db['ChatWebsite'][_0xfa74('0x10c')](db['ChatInteraction'],{'as':_0xfa74('0x158')});db[_0xfa74('0x12b')][_0xfa74('0x10c')](db[_0xfa74('0x63')],{'as':_0xfa74('0x138')});db[_0xfa74('0x12b')][_0xfa74('0x10c')](db[_0xfa74('0x182')],{'as':_0xfa74('0x149')});db[_0xfa74('0x12b')]['belongsTo'](db[_0xfa74('0xe9')],{'as':'List','foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x12b')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'as':_0xfa74('0x7d'),'foreignKey':'IntervalId'});db[_0xfa74('0x12b')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'as':'MailAccount','foreignKey':_0xfa74('0x152')});db[_0xfa74('0x12b')]['belongsTo'](db[_0xfa74('0x17c')],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db['ChatWebsite'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':'Agents','through':_0xfa74('0x12d')});db['OpenchannelQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x58')],{});db[_0xfa74('0x61')][_0xfa74('0x118')](db['CmList'],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x61')][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':'ContactId'});db[_0xfa74('0x61')][_0xfa74('0x118')](db[_0xfa74('0x5c')],{});db[_0xfa74('0x61')][_0xfa74('0x118')](db[_0xfa74('0x5e')],{});db['OpenchannelQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x10')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db[_0xfa74('0x63')]['belongsTo'](db[_0xfa74('0x10')],{'as':'Agent','foreignKey':'UserId','onDelete':_0xfa74('0x168')});db[_0xfa74('0x63')]['belongsTo'](db['ChatQueue'],{'as':_0xfa74('0x183'),'foreignKey':_0xfa74('0x184'),'onDelete':_0xfa74('0x168')});db['ChatApplication']['belongsTo'](db[_0xfa74('0x12b')],{'as':_0xfa74('0x185'),'foreignKey':_0xfa74('0x165'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x63')][_0xfa74('0x118')](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':'TagId'});db[_0xfa74('0x64')][_0xfa74('0x10c')](db[_0xfa74('0x182')],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x186')});db[_0xfa74('0x64')][_0xfa74('0x118')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x161'),'foreignKey':'ChatWebsiteId'});db[_0xfa74('0x64')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db['ChatInteraction'][_0xfa74('0x118')](db['User'],{'as':_0xfa74('0x17f'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x64')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x187'),'as':_0xfa74('0x163')});db[_0xfa74('0x64')][_0xfa74('0x119')](db['Tag'],{'through':_0xfa74('0x187'),'as':'ThroughTags'});db['ChatInteraction'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x188'),'foreignKey':_0xfa74('0x186')});db[_0xfa74('0x182')][_0xfa74('0x118')](db['User'],{'onDelete':'cascade','as':_0xfa74('0x10')});db['ChatMessage'][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xfa74('0x151')});db[_0xfa74('0x182')][_0xfa74('0x118')](db['ChatInteraction'],{'onDelete':'cascade','as':_0xfa74('0x164'),'foreignKey':_0xfa74('0x186')});db[_0xfa74('0x182')][_0xfa74('0x118')](db[_0xfa74('0x172')],{'as':_0xfa74('0x172'),'foreignKey':_0xfa74('0x173')});db[_0xfa74('0x182')][_0xfa74('0x118')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x161'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xfa74('0x10c')](db[_0xfa74('0x172')],{'as':_0xfa74('0x189'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xfa74('0x10a'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0xfa74('0x166')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':'UserChatQueue','hooks':!![]});db[_0xfa74('0x66')][_0xfa74('0x119')](db['Team'],{'through':_0xfa74('0x18a'),'as':'Teams'});db[_0xfa74('0x68')][_0xfa74('0x10c')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xfa74('0x18b'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x68')][_0xfa74('0x119')](db['User'],{'as':'Members','through':_0xfa74('0x11a')});db[_0xfa74('0x69')][_0xfa74('0x118')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x185'),'foreignKey':_0xfa74('0x165')});db[_0xfa74('0x6a')]['hasMany'](db[_0xfa74('0x6c')],{'as':'Contacts','foreignKey':_0xfa74('0x18c')});db[_0xfa74('0x6c')][_0xfa74('0x10c')](db['CmHopper'],{'as':_0xfa74('0x13c'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x6c')][_0xfa74('0x10c')](db['CmHopperFinal'],{'as':_0xfa74('0x10f'),'foreignKey':'ContactId'});db[_0xfa74('0x6c')]['hasMany'](db['CmHopperHistory'],{'as':_0xfa74('0x13d'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x6c')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xfa74('0x151')});db['CmContact']['hasMany'](db[_0xfa74('0xcb')],{'as':'JscriptySessions','foreignKey':_0xfa74('0x151')});db['CmContact'][_0xfa74('0x10c')](db[_0xfa74('0x5c')],{'as':_0xfa74('0x111'),'foreignKey':'ContactId','onDelete':_0xfa74('0x168')});db['CmContact'][_0xfa74('0x10c')](db['ChatInteraction'],{'as':_0xfa74('0x121'),'foreignKey':_0xfa74('0x151'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x6c')][_0xfa74('0x10c')](db[_0xfa74('0x176')],{'as':_0xfa74('0x112'),'foreignKey':_0xfa74('0x151'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x6c')]['hasMany'](db[_0xfa74('0x4a')],{'as':'FaxInteractions','foreignKey':_0xfa74('0x151'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x6c')][_0xfa74('0x10c')](db['MailInteraction'],{'as':_0xfa74('0x11f'),'foreignKey':'ContactId','onDelete':_0xfa74('0x168')});db[_0xfa74('0x6c')][_0xfa74('0x118')](db[_0xfa74('0x6a')],{'as':_0xfa74('0x18d'),'foreignKey':_0xfa74('0x18c')});db['CmContact'][_0xfa74('0x118')](db['CmList'],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x6c')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x11c')});db['CmContact'][_0xfa74('0x119')](db[_0xfa74('0x86')],{'as':_0xfa74('0x163'),'through':_0xfa74('0x18e')});db[_0xfa74('0x6c')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0xfa74('0x6d')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x6d')]['belongsTo'](db[_0xfa74('0xe9')],{'as':'List','foreignKey':_0xfa74('0x15a'),'onDelete':_0xfa74('0x10a')});db['CmHopper'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':'Agent','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x6d')][_0xfa74('0x118')](db[_0xfa74('0x1b')],{'as':_0xfa74('0x183'),'foreignKey':_0xfa74('0x13b'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x6d')][_0xfa74('0x118')](db[_0xfa74('0xdd')],{'as':_0xfa74('0xdd'),'foreignKey':_0xfa74('0x18f'),'onDelete':_0xfa74('0x10a')});db['CmHopper'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':_0xfa74('0x17f'),'foreignKey':_0xfa74('0x190')});db[_0xfa74('0x13e')]['belongsTo'](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151'),'onDelete':'cascade'});db[_0xfa74('0x13e')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x13e')][_0xfa74('0x118')](db[_0xfa74('0x1b')],{'as':_0xfa74('0x183'),'foreignKey':'VoiceQueueId','onDelete':_0xfa74('0x10a')});db[_0xfa74('0x13e')]['belongsTo'](db['Campaign'],{'as':_0xfa74('0xdd'),'foreignKey':_0xfa74('0x18f'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x77')][_0xfa74('0x10c')](db[_0xfa74('0x7b')],{'as':{'plural':_0xfa74('0x191'),'singular':_0xfa74('0x192')},'foreignKey':_0xfa74('0x193'),'onDelete':_0xfa74('0x10a'),'hooks':!![]});db['Automation'][_0xfa74('0x10c')](db[_0xfa74('0x7b')],{'as':{'plural':_0xfa74('0x194'),'singular':'OneAny'},'foreignKey':_0xfa74('0x195'),'onDelete':'cascade','hooks':!![]});db[_0xfa74('0x77')][_0xfa74('0x10c')](db[_0xfa74('0x75')],{'as':_0xfa74('0x196'),'foreignKey':'AutomationId','onDelete':_0xfa74('0x10a'),'hooks':!![]});db[_0xfa74('0x7a')][_0xfa74('0x10c')](db[_0xfa74('0x7a')],{'as':_0xfa74('0x156'),'foreignKey':_0xfa74('0x197'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db[_0xfa74('0x7d')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x10e'),'foreignKey':_0xfa74('0x169'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xfa74('0x169')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db[_0xfa74('0x63')],{'as':_0xfa74('0x198'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db['FaxApplication'],{'as':_0xfa74('0x199'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db[_0xfa74('0x52')],{'as':_0xfa74('0x19a'),'foreignKey':'IntervalId'});db[_0xfa74('0x19b')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{});db['Schedule'][_0xfa74('0x118')](db[_0xfa74('0x93')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xfa74('0x118')](db[_0xfa74('0x91')],{'foreignKey':_0xfa74('0x19c')});db[_0xfa74('0x84')][_0xfa74('0x119')](db[_0xfa74('0x19')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xfa74('0x168')});db['Tag'][_0xfa74('0x119')](db[_0xfa74('0x6c')],{'through':'cm_contact_has_tags'});db[_0xfa74('0x86')][_0xfa74('0x119')](db[_0xfa74('0x64')],{'through':_0xfa74('0x187')});db[_0xfa74('0x86')][_0xfa74('0x119')](db[_0xfa74('0x114')],{'through':_0xfa74('0x162')});db['Tag'][_0xfa74('0x119')](db[_0xfa74('0x176')],{'through':_0xfa74('0x177')});db[_0xfa74('0x86')]['belongsToMany'](db['FaxInteraction'],{'through':_0xfa74('0x16e')});db['Tag']['belongsToMany'](db[_0xfa74('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0xfa74('0x86')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xfa74('0x19d')});db['Trigger'][_0xfa74('0x10c')](db[_0xfa74('0x7b')],{'as':{'plural':_0xfa74('0x19e'),'singular':_0xfa74('0x19f')},'foreignKey':_0xfa74('0x1a0'),'onDelete':_0xfa74('0x10a'),'hooks':!![]});db[_0xfa74('0x1a1')]['hasMany'](db[_0xfa74('0x7b')],{'as':{'plural':'AnyConditions','singular':_0xfa74('0x1a2')},'foreignKey':_0xfa74('0x1a3'),'onDelete':_0xfa74('0x10a'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':_0xfa74('0x196'),'foreignKey':_0xfa74('0x1a4'),'onDelete':_0xfa74('0x10a'),'hooks':!![]});db[_0xfa74('0x91')][_0xfa74('0x10c')](db[_0xfa74('0x1a5')],{'as':'Fields','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x19c'),'hooks':!![]});db[_0xfa74('0x93')][_0xfa74('0x10c')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1a6')});db[_0xfa74('0x96')][_0xfa74('0x10c')](db['AnalyticFieldReport'],{'as':_0xfa74('0x1a7'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1a8')});db[_0xfa74('0x1a5')][_0xfa74('0x118')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0xfa74('0x1a9')][_0xfa74('0x10c')](db[_0xfa74('0x9b')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0x9b')]['hasMany'](db[_0xfa74('0x1ac')],{'as':'Subjects','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0x9b')]['hasMany'](db[_0xfa74('0x1ac')],{'as':_0xfa74('0x1ae'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1af')});db['SalesforceConfiguration'][_0xfa74('0x10c')](db['SalesforceField'],{'as':_0xfa74('0x1a7'),'onDelete':'cascade','foreignKey':_0xfa74('0x1b0')});db['SalesforceConfiguration']['belongsTo'](db[_0xfa74('0x1a9')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0x1ac')][_0xfa74('0x10c')](db[_0xfa74('0x1ac')],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0x1ac')]['hasMany'](db[_0xfa74('0x1ac')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0x1ac')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0x1ac')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':'Variable','foreignKey':'VariableId'});db[_0xfa74('0x9d')][_0xfa74('0x10c')](db[_0xfa74('0x9f')],{'as':'Configurations','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db['SugarcrmConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0xa1')],{'as':_0xfa74('0x1b3'),'onDelete':'cascade','foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0x9f')][_0xfa74('0x10c')](db[_0xfa74('0xa1')],{'as':_0xfa74('0x1ae'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0x9f')][_0xfa74('0x10c')](db[_0xfa74('0xa1')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xfa74('0x9f')][_0xfa74('0x118')](db[_0xfa74('0x9d')],{'as':_0xfa74('0x161'),'foreignKey':'AccountId'});db[_0xfa74('0xa1')][_0xfa74('0x10c')](db['SugarcrmField'],{'as':_0xfa74('0x1b1'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xa1')]['hasMany'](db['SugarcrmField'],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xa1')][_0xfa74('0x10c')](db[_0xfa74('0xa1')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xa1')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0x1b6')]['hasMany'](db[_0xfa74('0xa4')],{'as':_0xfa74('0x1aa'),'onDelete':'cascade','foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xa4')][_0xfa74('0x10c')](db['DeskField'],{'as':_0xfa74('0x1b3'),'onDelete':_0xfa74('0x10a'),'foreignKey':'SubjectId'});db[_0xfa74('0xa4')][_0xfa74('0x10c')](db[_0xfa74('0x1b7')],{'as':_0xfa74('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0x1b7')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xa4')][_0xfa74('0x118')](db[_0xfa74('0x1b6')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db['DeskConfiguration'][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x1b8')});db[_0xfa74('0x1b7')][_0xfa74('0x10c')](db[_0xfa74('0x1b7')],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0x1b7')][_0xfa74('0x10c')](db['DeskField'],{'as':'Description','foreignKey':_0xfa74('0x1af')});db['DeskField']['hasMany'](db[_0xfa74('0x1b7')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0x1b7')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':'VariableId'});db[_0xfa74('0xa6')][_0xfa74('0x10c')](db[_0xfa74('0xa8')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xa8')][_0xfa74('0x10c')](db['ZohoField'],{'as':_0xfa74('0x1b3'),'onDelete':_0xfa74('0x10a'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0xaa')],{'as':_0xfa74('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xfa74('0xa8')][_0xfa74('0x10c')](db[_0xfa74('0xaa')],{'as':_0xfa74('0x1a7'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1b0')});db['ZohoConfiguration'][_0xfa74('0x118')](db[_0xfa74('0xa6')],{'as':_0xfa74('0x161'),'foreignKey':'AccountId'});db['ZohoField']['hasMany'](db[_0xfa74('0xaa')],{'as':_0xfa74('0x1b1'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xaa')][_0xfa74('0x10c')](db['ZohoField'],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xaa')]['hasMany'](db[_0xfa74('0xaa')],{'as':'Field','foreignKey':'FieldId'});db[_0xfa74('0xaa')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0x1b9')][_0xfa74('0x10c')](db[_0xfa74('0xab')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':'AccountId'});db[_0xfa74('0xab')][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':_0xfa74('0x1b3'),'foreignKey':'SubjectId'});db[_0xfa74('0xab')][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':_0xfa74('0x1ae'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':_0xfa74('0x1a7'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xab')][_0xfa74('0x118')](db['ZendeskAccount'],{'as':_0xfa74('0x161'),'foreignKey':'AccountId'});db[_0xfa74('0xab')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0x1ba')][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0x1ba')][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':'Field','foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xfa74('0x1b5')});db['FreshdeskAccount'][_0xfa74('0x10c')](db['FreshdeskConfiguration'],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xfa74('0x10c')](db['FreshdeskField'],{'as':_0xfa74('0x1b3'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xfa74('0xae')][_0xfa74('0x10c')](db[_0xfa74('0x1bb')],{'as':_0xfa74('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xfa74('0xae')][_0xfa74('0x10c')](db[_0xfa74('0x1bb')],{'as':_0xfa74('0x1a7'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1b0')});db['FreshdeskConfiguration'][_0xfa74('0x118')](db['FreshdeskAccount'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db['FreshdeskConfiguration'][_0xfa74('0x119')](db['Tag'],{'through':_0xfa74('0x1bc')});db['FreshdeskField'][_0xfa74('0x10c')](db['FreshdeskField'],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0xfa74('0x10c')](db[_0xfa74('0x1bb')],{'as':'Description','foreignKey':_0xfa74('0x1af')});db['FreshdeskField'][_0xfa74('0x10c')](db[_0xfa74('0x1bb')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db['FreshdeskField']['belongsTo'](db[_0xfa74('0x8b')],{'as':'Variable','foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0xb1')][_0xfa74('0x10c')](db[_0xfa74('0x1bd')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0x1bd')][_0xfa74('0x10c')](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1b3'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0x1bd')][_0xfa74('0x10c')](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1ae'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0x1bd')][_0xfa74('0x10c')](db['VtigerField'],{'as':_0xfa74('0x1a7'),'foreignKey':_0xfa74('0x1b0')});db['VtigerConfiguration'][_0xfa74('0x118')](db[_0xfa74('0xb1')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xb3')]['hasMany'](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0xb3')][_0xfa74('0x10c')](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xb3')][_0xfa74('0x10c')](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xb3')][_0xfa74('0x118')](db['Variable'],{'as':'Variable','foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0xb5')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db['ServicenowConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0xb9')],{'as':_0xfa74('0x1b3'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xb7')][_0xfa74('0x10c')](db['ServicenowField'],{'as':_0xfa74('0x1ae'),'foreignKey':'DescriptionId'});db[_0xfa74('0xb7')][_0xfa74('0x10c')](db[_0xfa74('0xb9')],{'as':_0xfa74('0x1a7'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xb7')][_0xfa74('0x118')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xb9')][_0xfa74('0x10c')](db[_0xfa74('0xb9')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xfa74('0xb9')][_0xfa74('0x10c')](db[_0xfa74('0xb9')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xb9')]['hasMany'](db[_0xfa74('0xb9')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xb9')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':'Variable','foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0xbb')]['hasMany'](db[_0xfa74('0xbd')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':'AccountId'});db['Dynamics365Configuration'][_0xfa74('0x10c')](db['Dynamics365Field'],{'as':_0xfa74('0x1b3'),'onDelete':_0xfa74('0x10a'),'foreignKey':'SubjectId'});db[_0xfa74('0xbd')][_0xfa74('0x10c')](db[_0xfa74('0xbf')],{'as':_0xfa74('0x1ae'),'onDelete':'cascade','foreignKey':_0xfa74('0x1af')});db['Dynamics365Configuration'][_0xfa74('0x10c')](db[_0xfa74('0xbf')],{'as':_0xfa74('0x1a7'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1b0')});db['Dynamics365Configuration'][_0xfa74('0x118')](db['Dynamics365Account'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xbf')]['hasMany'](db[_0xfa74('0xbf')],{'as':_0xfa74('0x1b1'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xbf')][_0xfa74('0x10c')](db['Dynamics365Field'],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xbf')]['hasMany'](db[_0xfa74('0xbf')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xbf')]['belongsTo'](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0xc0')][_0xfa74('0x10c')](db['FreshsalesConfiguration'],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xc2')]['hasMany'](db['FreshsalesField'],{'as':_0xfa74('0x1b3'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xc2')][_0xfa74('0x10c')](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1ae'),'foreignKey':'DescriptionId'});db[_0xfa74('0xc2')]['hasMany'](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1a7'),'foreignKey':_0xfa74('0x1b0')});db['FreshsalesConfiguration'][_0xfa74('0x118')](db[_0xfa74('0xc0')],{'as':'Account','foreignKey':_0xfa74('0x1ab')});db['FreshsalesField'][_0xfa74('0x10c')](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0xc3')][_0xfa74('0x10c')](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xc3')][_0xfa74('0x10c')](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1b4'),'foreignKey':'FieldId'});db[_0xfa74('0xc3')]['belongsTo'](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':_0xfa74('0x1b5')});db['ChatQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x12b')],{});db['ChatQueueReport'][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xc6')]['belongsTo'](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db['ChatQueueReport'][_0xfa74('0x118')](db['ChatInteraction'],{});db[_0xfa74('0xc6')][_0xfa74('0x118')](db[_0xfa74('0x182')],{});db[_0xfa74('0xc6')]['belongsTo'](db[_0xfa74('0x10')],{});db['ChatQueueReport']['belongsTo'](db[_0xfa74('0x66')],{});db['ChatInternalMessage'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1be')});db['ChatInternalMessage'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x10a'),'foreignKey':'ToId'});db[_0xfa74('0xcb')][_0xfa74('0x10c')](db[_0xfa74('0xc9')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xfa74('0xcb')][_0xfa74('0x10c')](db[_0xfa74('0xc8')],{'foreignKey':_0xfa74('0x1bf'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x1c0')][_0xfa74('0x118')](db[_0xfa74('0x134')],{});db[_0xfa74('0x1c0')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x1c0')]['belongsTo'](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x176')],{});db[_0xfa74('0x1c0')][_0xfa74('0x118')](db['SmsMessage'],{});db[_0xfa74('0x1c0')][_0xfa74('0x118')](db['User'],{});db[_0xfa74('0x1c0')]['belongsTo'](db[_0xfa74('0x56')],{});db[_0xfa74('0xd1')][_0xfa74('0x10c')](db[_0xfa74('0xcb')],{'foreignKey':_0xfa74('0x1c1')});db[_0xfa74('0xd1')][_0xfa74('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xfa74('0xd1')]['hasMany'](db[_0xfa74('0xc8')],{'foreignKey':_0xfa74('0x1c1')});db[_0xfa74('0xd4')]['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x136')});db['Team']['belongsToMany'](db['User'],{'as':_0xfa74('0x145'),'through':_0xfa74('0x11e')});db[_0xfa74('0x15e')][_0xfa74('0x119')](db['VoiceQueue'],{'through':_0xfa74('0x103'),'as':_0xfa74('0x125')});db[_0xfa74('0x15e')]['belongsToMany'](db[_0xfa74('0x3b')],{'through':_0xfa74('0x15f'),'as':_0xfa74('0x1c2')});db[_0xfa74('0x15e')]['belongsToMany'](db[_0xfa74('0x66')],{'through':'team_has_chat_queues','as':_0xfa74('0x1c3')});db['Team']['belongsToMany'](db[_0xfa74('0x4d')],{'through':_0xfa74('0x174'),'as':_0xfa74('0x1c4')});db[_0xfa74('0x15e')][_0xfa74('0x119')](db[_0xfa74('0x56')],{'through':_0xfa74('0x17a'),'as':_0xfa74('0x1c5')});db['Team'][_0xfa74('0x119')](db['OpenchannelQueue'],{'through':_0xfa74('0x1c6'),'as':_0xfa74('0x128')});db['Team'][_0xfa74('0x119')](db[_0xfa74('0xff')],{'through':_0xfa74('0x1c7'),'as':'WhatsappQueues'});db[_0xfa74('0x15e')][_0xfa74('0x119')](db[_0xfa74('0xeb')],{'through':'TeamVoicePrefix','as':_0xfa74('0x126')});db[_0xfa74('0xdd')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xfa74('0x18f')});db[_0xfa74('0xdd')][_0xfa74('0x10c')](db[_0xfa74('0x6f')],{'as':_0xfa74('0x10f'),'foreignKey':'CampaignId'});db[_0xfa74('0xdd')][_0xfa74('0x10c')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xfa74('0xdd')][_0xfa74('0x10c')](db[_0xfa74('0x13e')],{'as':_0xfa74('0x13f'),'foreignKey':_0xfa74('0x18f')});db[_0xfa74('0xdd')][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x141'),'foreignKey':_0xfa74('0x1c8')});db['Campaign'][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x142'),'foreignKey':_0xfa74('0x1c9')});db[_0xfa74('0xdd')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'as':_0xfa74('0x7d'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0xdd')][_0xfa74('0x118')](db[_0xfa74('0xd4')],{'as':_0xfa74('0xd4'),'foreignKey':_0xfa74('0x1ca')});db[_0xfa74('0xdd')][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xfa74('0xdd')][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x147'),'through':_0xfa74('0x1cb')});db[_0xfa74('0x172')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0xfa74('0x166'),'foreignKey':_0xfa74('0x167')});db['MailTransferReport'][_0xfa74('0x118')](db[_0xfa74('0x3f')],{});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x114')],{});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'foreignKey':_0xfa74('0x1cc'),'as':_0xfa74('0x1cd')});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'foreignKey':'FromUserId','as':_0xfa74('0x1ce')});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'foreignKey':'ToUserId','as':_0xfa74('0x1cf')});db['MailTransferReport'][_0xfa74('0x118')](db[_0xfa74('0x3b')],{'foreignKey':_0xfa74('0x1d0'),'as':_0xfa74('0x1d1')});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'foreignKey':_0xfa74('0x1d2'),'as':_0xfa74('0x1d3')});db[_0xfa74('0xe4')][_0xfa74('0x118')](db[_0xfa74('0x182')],{});db[_0xfa74('0xe4')][_0xfa74('0x118')](db[_0xfa74('0x64')],{});db[_0xfa74('0xe4')]['belongsTo'](db[_0xfa74('0x12b')],{'foreignKey':_0xfa74('0x1d4'),'as':_0xfa74('0x1cd')});db[_0xfa74('0xe4')][_0xfa74('0x118')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xfa74('0xe4')]['belongsTo'](db[_0xfa74('0x10')],{'foreignKey':_0xfa74('0x1d5'),'as':'ToAgent'});db['ChatTransferReport'][_0xfa74('0x118')](db[_0xfa74('0x66')],{'foreignKey':_0xfa74('0x1d6'),'as':_0xfa74('0x1d1')});db[_0xfa74('0xe4')][_0xfa74('0x118')](db['ChatWebsite'],{'foreignKey':_0xfa74('0x1d7'),'as':_0xfa74('0x1d3')});db[_0xfa74('0xe6')]['belongsTo'](db[_0xfa74('0x4b')],{});db[_0xfa74('0xe6')][_0xfa74('0x118')](db[_0xfa74('0x4a')],{});db[_0xfa74('0xe6')][_0xfa74('0x118')](db[_0xfa74('0x46')],{'foreignKey':_0xfa74('0x1d8'),'as':_0xfa74('0x1cd')});db[_0xfa74('0xe6')][_0xfa74('0x118')](db['User'],{'foreignKey':_0xfa74('0x1d9'),'as':_0xfa74('0x1ce')});db[_0xfa74('0xe6')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'foreignKey':'ToUserId','as':_0xfa74('0x1cf')});db['FaxTransferReport'][_0xfa74('0x118')](db[_0xfa74('0x4d')],{'foreignKey':'ToFaxQueueId','as':_0xfa74('0x1d1')});db[_0xfa74('0xe6')]['belongsTo'](db[_0xfa74('0x46')],{'foreignKey':_0xfa74('0x1da'),'as':'ToAccount'});db[_0xfa74('0xe7')]['belongsTo'](db[_0xfa74('0x5e')],{});db[_0xfa74('0xe7')][_0xfa74('0x118')](db[_0xfa74('0x5c')],{});db[_0xfa74('0xe7')][_0xfa74('0x118')](db[_0xfa74('0x58')],{'foreignKey':_0xfa74('0x1db'),'as':'FromAccount'});db[_0xfa74('0xe7')][_0xfa74('0x118')](db['User'],{'foreignKey':_0xfa74('0x1d9'),'as':_0xfa74('0x1ce')});db[_0xfa74('0xe7')]['belongsTo'](db[_0xfa74('0x10')],{'foreignKey':_0xfa74('0x1d5'),'as':_0xfa74('0x1cf')});db[_0xfa74('0xe7')][_0xfa74('0x118')](db[_0xfa74('0x5f')],{'foreignKey':_0xfa74('0x1dc'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0xfa74('0x118')](db['OpenchannelAccount'],{'foreignKey':_0xfa74('0x1dd'),'as':_0xfa74('0x1d3')});db[_0xfa74('0xe8')]['belongsTo'](db[_0xfa74('0x54')],{});db[_0xfa74('0xe8')][_0xfa74('0x118')](db[_0xfa74('0x176')],{});db[_0xfa74('0xe8')][_0xfa74('0x118')](db[_0xfa74('0x134')],{'foreignKey':_0xfa74('0x1de'),'as':_0xfa74('0x1cd')});db[_0xfa74('0xe8')][_0xfa74('0x118')](db['User'],{'foreignKey':_0xfa74('0x1d9'),'as':_0xfa74('0x1ce')});db[_0xfa74('0xe8')]['belongsTo'](db[_0xfa74('0x10')],{'foreignKey':'ToUserId','as':_0xfa74('0x1cf')});db[_0xfa74('0xe8')]['belongsTo'](db[_0xfa74('0x56')],{'foreignKey':_0xfa74('0x1df'),'as':'ToQueue'});db[_0xfa74('0xe8')][_0xfa74('0x118')](db[_0xfa74('0x134')],{'foreignKey':'ToSmsAccountId','as':_0xfa74('0x1d3')});db['CmList'][_0xfa74('0x10c')](db['Disposition'],{'as':_0xfa74('0x156'),'foreignKey':_0xfa74('0x15a'),'onDelete':'cascade'});db[_0xfa74('0xe9')][_0xfa74('0x10c')](db[_0xfa74('0x73')],{'as':_0xfa74('0x1e0'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xe9')][_0xfa74('0x10c')](db['CmContact'],{'as':'Contacts','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x15a')});db['CmList'][_0xfa74('0x10c')](db[_0xfa74('0x6f')],{'as':'HopperFinals','foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xe9')][_0xfa74('0x10c')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xe9')][_0xfa74('0x10c')](db['ReportAgentPreview'],{'as':_0xfa74('0x72'),'foreignKey':_0xfa74('0x15a')});db['CmList'][_0xfa74('0x119')](db['VoiceQueue'],{'as':_0xfa74('0x1e1'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x11d')});db[_0xfa74('0xeb')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x10e'),'onDelete':'cascade'});db[_0xfa74('0xeb')][_0xfa74('0x119')](db['User'],{'as':_0xfa74('0x145'),'through':_0xfa74('0x107')});db[_0xfa74('0xeb')]['belongsToMany'](db[_0xfa74('0x15e')],{'through':_0xfa74('0x105'),'as':_0xfa74('0x146')});db[_0xfa74('0xed')][_0xfa74('0x10c')](db[_0xfa74('0x10')],{'as':'Users','foreignKey':_0xfa74('0x1e2')});db['UserProfile'][_0xfa74('0x10c')](db[_0xfa74('0xef')],{'as':_0xfa74('0x1e3'),'foreignKey':'userProfileId','onDelete':_0xfa74('0x10a')});db['UserProfileSection'][_0xfa74('0x10c')](db[_0xfa74('0xf1')],{'as':'Resources','foreignKey':_0xfa74('0x1e4'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xfa74('0x1e5'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db[_0xfa74('0x79')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db['WhatsappMessage'],{'as':_0xfa74('0x149'),'foreignKey':_0xfa74('0x1e5')});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db[_0xfa74('0xf9')],{'as':'Interactions'});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db[_0xfa74('0xf7')],{'as':'Applications'});db[_0xfa74('0xf5')][_0xfa74('0x118')](db['CmList'],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xf5')][_0xfa74('0x118')](db['Pause'],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db['WhatsappAccount'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x1e6')});db['WhatsappApplication'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0xf7')][_0xfa74('0x118')](db[_0xfa74('0xff')],{'onDelete':'restrict'});db[_0xfa74('0xf7')][_0xfa74('0x118')](db[_0xfa74('0xf5')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0xf7')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0xf7')]['belongsTo'](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x16a')});db['WhatsappInteraction'][_0xfa74('0x10c')](db[_0xfa74('0x1e7')],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1e8')});db[_0xfa74('0xf9')][_0xfa74('0x118')](db['WhatsappAccount'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1e5')});db[_0xfa74('0xf9')][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0xf9')]['belongsTo'](db[_0xfa74('0x10')],{'as':_0xfa74('0x17f'),'foreignKey':_0xfa74('0x10b')});db['WhatsappInteraction'][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x19d'),'as':_0xfa74('0x163')});db[_0xfa74('0xf9')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xfa74('0xf9')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x124'),'foreignKey':_0xfa74('0x1e8')});db[_0xfa74('0x1e7')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':_0xfa74('0x10')});db[_0xfa74('0x1e7')][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'onDelete':'cascade','as':_0xfa74('0x150')});db[_0xfa74('0x1e7')][_0xfa74('0x118')](db[_0xfa74('0xf9')],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x164'),'foreignKey':_0xfa74('0x1e8')});db['WhatsappMessage']['belongsTo'](db[_0xfa74('0xf5')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1e5')});db[_0xfa74('0xfc')][_0xfa74('0x118')](db[_0xfa74('0xf5')],{});db['WhatsappQueueReport'][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':'List','foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xfc')]['belongsTo'](db[_0xfa74('0x6c')],{'as':'Contact','foreignKey':_0xfa74('0x151')});db[_0xfa74('0xfc')][_0xfa74('0x118')](db[_0xfa74('0xf9')],{});db[_0xfa74('0xfc')][_0xfa74('0x118')](db['WhatsappQueue'],{});db[_0xfa74('0xfc')][_0xfa74('0x118')](db[_0xfa74('0x1e7')],{});db[_0xfa74('0xfc')][_0xfa74('0x118')](db[_0xfa74('0x10')],{});db[_0xfa74('0xfe')][_0xfa74('0x118')](db[_0xfa74('0x1e7')],{});db[_0xfa74('0xfe')][_0xfa74('0x118')](db[_0xfa74('0xf9')],{});db['WhatsappTransferReport'][_0xfa74('0x118')](db[_0xfa74('0xf5')],{'foreignKey':'FromWhatsappAccountId','as':_0xfa74('0x1cd')});db[_0xfa74('0xfe')][_0xfa74('0x118')](db[_0xfa74('0xf5')],{'foreignKey':_0xfa74('0x1e9'),'as':'ToAccount'});db[_0xfa74('0xfe')][_0xfa74('0x118')](db[_0xfa74('0xff')],{'foreignKey':_0xfa74('0x1ea'),'as':_0xfa74('0x1d1')});db[_0xfa74('0xfe')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0xfa74('0x1ce')});db[_0xfa74('0xfe')]['belongsTo'](db['User'],{'foreignKey':_0xfa74('0x1d5'),'as':_0xfa74('0x1cf')});db[_0xfa74('0xff')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db['WhatsappQueue']['belongsToMany'](db[_0xfa74('0x15e')],{'through':_0xfa74('0x1c7'),'as':_0xfa74('0x146')});module[_0xfa74('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3c81=['MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappQueue/whatsappQueue.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','cascade','UserId','hasMany','UserVoiceQueueRt','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','MailInteractions','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','MailQueues','UserMailQueue','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_openchannel_accounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','VoiceQueueId','Hoppers','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Agents','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','mailboxuser','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','MailServerOut','hasOne','Smtp','Dispositions','Messages','List','ListId','mandatoryDispositionPauseId','Teams','MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','FaxAccountId','CannedAnswer','Answers','Interactions','FaxMessage','FaxInteractionId','Account','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','OpenchannelQueueReport','Queue','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','Website','CompanyId','HopperHistories','FaxInteractions','Company','cm_contact_has_tags','CampaignId','OwnerId','All','AutomationAllId','Actions','AutomationId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','Mohs','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','VariableId','Descriptions','DeskConfiguration','Configurations','int_desk_configuration_has_tags','ZohoField','ZohoAccount','ZendeskField','int_freshdesk_configuration_has_tags','FreshsalesConfiguration','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','team_has_mail_queues','WhatsappQueues','HopperBlacks','Lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappMessage','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','jstz','determine','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','motion2','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model'];(function(_0x30df25,_0x125de3){var _0x4b1f18=function(_0x4a0582){while(--_0x4a0582){_0x30df25['push'](_0x30df25['shift']());}};_0x4b1f18(++_0x125de3);}(_0x3c81,0x102));var _0x13c8=function(_0x538caf,_0x8b0aee){_0x538caf=_0x538caf-0x0;var _0x33badb=_0x3c81[_0x538caf];return _0x33badb;};'use strict';var config=require(_0x13c8('0x0'));var Sequelize=require(_0x13c8('0x1'));var _=require('lodash');var jstz=require(_0x13c8('0x2'));var timezone=jstz[_0x13c8('0x3')]();config['sequelize']=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0x13c8('0x4'),'password':_0x13c8('0x5'),'options':{'host':_0x13c8('0x6'),'port':0xcea,'dialect':_0x13c8('0x7'),'dialectOptions':{'charset':_0x13c8('0x8')},'logging':![],'timezone':timezone[_0x13c8('0x9')](),'define':{'charset':_0x13c8('0xa'),'collate':'utf8_general_ci'}}});config[_0x13c8('0xb')]=_['defaultsDeep'](config[_0x13c8('0xb')],{'database':_0x13c8('0xc'),'username':_0x13c8('0x4'),'password':_0x13c8('0x5'),'options':{'host':_0x13c8('0x6'),'port':0xcea,'dialect':_0x13c8('0x7'),'dialectOptions':{'charset':_0x13c8('0x8')},'logging':![],'timezone':timezone[_0x13c8('0x9')](),'define':{'charset':_0x13c8('0xa'),'collate':_0x13c8('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x13c8('0x1')][_0x13c8('0xe')],config[_0x13c8('0x1')][_0x13c8('0xf')],config['sequelize'][_0x13c8('0x10')],config[_0x13c8('0x1')][_0x13c8('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x13c8('0xb')]['database'],config[_0x13c8('0xb')]['username'],config['sequelizeHistory']['password'],config[_0x13c8('0xb')]['options'])};db[_0x13c8('0x12')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x14'));db['VoiceChanSpy']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x15'));db[_0x13c8('0x16')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x17'));db[_0x13c8('0x18')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x19'));db['VoiceMusicOnHold']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x1a'));db[_0x13c8('0x1b')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x1c'));db[_0x13c8('0x1d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x1e'));db['ScreenRecording']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x1f'));db[_0x13c8('0x20')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x21'));db['VoiceMailMessage']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x22'));db['VoiceCallReport']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x23'));db['VoiceDialReport']=db['sequelize'][_0x13c8('0x13')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x24'));db['VoiceQueueReport']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x25'));db[_0x13c8('0x26')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x27'));db[_0x13c8('0x28')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x29'));db['VoiceTransferReport']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x2a'));db['UserVoiceQueueRt']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x13c8('0x2b')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x2c'));db[_0x13c8('0x2d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x2e'));db['UserMailQueue']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x2f'));db['UserFaxQueue']=db[_0x13c8('0x1')]['import'](_0x13c8('0x30'));db['UserSmsQueue']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x31'));db[_0x13c8('0x32')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x33'));db['UserWhatsappQueue']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x13c8('0x34')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x35'));db[_0x13c8('0x36')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x37'));db[_0x13c8('0x38')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x39'));db[_0x13c8('0x3a')]=db['sequelize'][_0x13c8('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x13c8('0x3b')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x3c'));db[_0x13c8('0x3d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x3e'));db[_0x13c8('0x3f')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x40'));db[_0x13c8('0x41')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x42'));db[_0x13c8('0x43')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x44'));db[_0x13c8('0x45')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x46'));db[_0x13c8('0x47')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x48'));db[_0x13c8('0x49')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x4a'));db['FaxQueue']=db['sequelize']['import'](_0x13c8('0x4b'));db['FaxQueueReport']=db[_0x13c8('0x1')]['import'](_0x13c8('0x4c'));db[_0x13c8('0x4d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x4e'));db[_0x13c8('0x4f')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x50'));db['SmsInteraction']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x51'));db[_0x13c8('0x52')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x53'));db[_0x13c8('0x54')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x55'));db['OpenchannelAccount']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x56'));db[_0x13c8('0x57')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x58'));db[_0x13c8('0x59')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x5a'));db['OpenchannelMessage']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x5b'));db[_0x13c8('0x5c')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x13c8('0x5d')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x13c8('0x5e')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x5f'));db['ChatInteraction']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x60'));db['ChatMessage']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/chatMessage/chatMessage.model');db[_0x13c8('0x61')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x62'));db[_0x13c8('0x63')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/chatQueue/chatQueue.model');db[_0x13c8('0x64')]=db['sequelize']['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x65'));db[_0x13c8('0x66')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x67'));db[_0x13c8('0x68')]=db['sequelize']['import'](_0x13c8('0x69'));db[_0x13c8('0x6a')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x6b'));db[_0x13c8('0x6c')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x13c8('0x6d')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x6e'));db[_0x13c8('0x6f')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x70'));db[_0x13c8('0x71')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x72'));db[_0x13c8('0x73')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x74'));db[_0x13c8('0x75')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/action/action.model');db[_0x13c8('0x76')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x77'));db['CannedAnswer']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x13c8('0x78')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x79'));db[_0x13c8('0x7a')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x7b'));db[_0x13c8('0x7c')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/interval/interval.model');db[_0x13c8('0x7d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x7e'));db[_0x13c8('0x7f')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x80'));db[_0x13c8('0x81')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x82'));db[_0x13c8('0x83')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x84'));db[_0x13c8('0x85')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x86'));db[_0x13c8('0x87')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x88'));db[_0x13c8('0x89')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x8a'));db[_0x13c8('0x8b')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x8c'));db[_0x13c8('0x8d')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x8e'));db[_0x13c8('0x8f')]=db['sequelize']['import'](_0x13c8('0x90'));db['IntegrationReport']=db[_0x13c8('0x1')]['import'](_0x13c8('0x91'));db[_0x13c8('0x92')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x93'));db['AnalyticDefaultReport']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x13c8('0x94')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x95'));db[_0x13c8('0x96')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x97'));db[_0x13c8('0x98')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x99'));db[_0x13c8('0x9a')]=db['sequelize']['import'](_0x13c8('0x9b'));db[_0x13c8('0x9c')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x9d'));db[_0x13c8('0x9e')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x9f'));db[_0x13c8('0xa0')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x13c8('0xa1')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xa2'));db[_0x13c8('0xa3')]=db['sequelize'][_0x13c8('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x13c8('0xa4')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xa5'));db[_0x13c8('0xa6')]=db['sequelize'][_0x13c8('0x13')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xa7'));db[_0x13c8('0xa8')]=db['sequelize']['import'](_0x13c8('0xa9'));db['ZohoAccount']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xaa'));db[_0x13c8('0xab')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xac'));db['ZohoField']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xad'));db[_0x13c8('0xae')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x13c8('0xaf')]=db['sequelize'][_0x13c8('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x13c8('0x1')]['import'](_0x13c8('0xb0'));db[_0x13c8('0xb1')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xb2'));db[_0x13c8('0xb3')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x13c8('0xb4')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xb5'));db[_0x13c8('0xb6')]=db['sequelize']['import'](_0x13c8('0xb7'));db[_0x13c8('0xb8')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xb9'));db[_0x13c8('0xba')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xbb'));db[_0x13c8('0xbc')]=db['sequelize']['import'](_0x13c8('0xbd'));db[_0x13c8('0xbe')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xbf'));db[_0x13c8('0xc0')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xc1'));db[_0x13c8('0xc2')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xc3'));db[_0x13c8('0xc4')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xc5'));db[_0x13c8('0xc6')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xc7'));db[_0x13c8('0xc8')]=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xc9'));db[_0x13c8('0xca')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xcb'));db[_0x13c8('0x8f')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x90'));db['Network']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xcc'));db[_0x13c8('0xcd')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xce'));db[_0x13c8('0xcf')]=db[_0x13c8('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xd0'));db[_0x13c8('0xd1')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xd2'));db[_0x13c8('0xd3')]=db['sequelize'][_0x13c8('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xd4'));db[_0x13c8('0xd5')]=db['sequelize'][_0x13c8('0x13')]('../api/squareReport/squareReport.model');db[_0x13c8('0xd6')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xd7'));db['JscriptyProject']=db[_0x13c8('0x1')]['import'](_0x13c8('0xd8'));db[_0x13c8('0xd9')]=db['sequelize']['import']('../api/setting/setting.model');db[_0x13c8('0xda')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xdb'));db[_0x13c8('0xdc')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xdd'));db['SquareRecording']=db['sequelize']['import'](_0x13c8('0xde'));db[_0x13c8('0xdf')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xe0'));db[_0x13c8('0xe1')]=db['sequelize'][_0x13c8('0x13')]('../api/team/team.model');db['License']=db[_0x13c8('0x1')]['import'](_0x13c8('0xe2'));db[_0x13c8('0xe3')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xe4'));db[_0x13c8('0xe5')]=db['sequelize'][_0x13c8('0x13')]('../api/migration/migration.model');db[_0x13c8('0xe6')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xe7'));db['Plugin']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xe8'));db[_0x13c8('0xe9')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xea'));db[_0x13c8('0xeb')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xec'));db['FaxTransferReport']=db[_0x13c8('0x1')]['import'](_0x13c8('0xed'));db[_0x13c8('0xee')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xef'));db['SmsTransferReport']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xf0'));db[_0x13c8('0xf1')]=db['sequelize']['import'](_0x13c8('0xf2'));db['VoicePrefix']=db['sequelize']['import'](_0x13c8('0xf3'));db[_0x13c8('0xf4')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xf5'));db[_0x13c8('0xf6')]=db[_0x13c8('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x13c8('0xf7')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xf8'));db[_0x13c8('0xf9')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xfa'));db[_0x13c8('0xfb')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xfc'));db[_0x13c8('0xfd')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xfe'));db['WhatsappInteraction']=db[_0x13c8('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db['sequelize'][_0x13c8('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x13c8('0xff')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x100'));db['WhatsappTransferReport']=db[_0x13c8('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x13c8('0x1')]['import'](_0x13c8('0x101'));db['CloudProvider']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0x13c8('0x102')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x103'));db[_0x13c8('0x104')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x105'));db[_0x13c8('0x106')]=db['sequelize'][_0x13c8('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['User']['hasOne'](db[_0x13c8('0x20')],{'as':'VoiceMail','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x108')});db['User'][_0x13c8('0x109')](db[_0x13c8('0x1d')],{'as':'Recordings','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')]['hasMany'](db[_0x13c8('0x10a')],{'as':_0x13c8('0x10b'),'foreignKey':'UserId'});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x18')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db['User'][_0x13c8('0x109')](db[_0x13c8('0x6d')],{'as':_0x13c8('0x10c'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x6f')],{'as':_0x13c8('0x10d'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x71')],{'as':_0x13c8('0x71'),'foreignKey':_0x13c8('0x108')});db['User']['hasMany'](db[_0x13c8('0x59')],{'as':_0x13c8('0x10e'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x10f')],{'as':_0x13c8('0x110'),'foreignKey':'UserId'});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x111')],{'as':_0x13c8('0x112'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x49')],{'as':'FaxInteractions','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x3a')],{'as':_0x13c8('0x113'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')]['hasMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0xf9')],{'as':'UserNotifications','foreignKey':'SenderId'});db['User'][_0x13c8('0x114')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x13c8('0x115')});db['User']['belongsToMany'](db['ChatGroup'],{'as':_0x13c8('0x116'),'through':_0x13c8('0x117')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x68')],{'as':_0x13c8('0x119'),'through':_0x13c8('0x11a')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0xf1')],{'as':'Lists','through':_0x13c8('0x11b')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':_0x13c8('0x11c')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x3a')],{'as':_0x13c8('0x113'),'through':_0x13c8('0x11d')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x10f')],{'as':'ChatInteractions','through':_0x13c8('0x11e')});db[_0x13c8('0x12')][_0x13c8('0x118')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x13c8('0x11f')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x111')],{'as':_0x13c8('0x112'),'through':_0x13c8('0x120')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x59')],{'as':_0x13c8('0x10e'),'through':_0x13c8('0x121')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x122')],{'as':_0x13c8('0x123'),'through':_0x13c8('0x124')});db[_0x13c8('0x12')][_0x13c8('0x118')](db['VoiceQueue'],{'as':_0x13c8('0x125'),'through':'UserVoiceQueue','required':![]});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0x126')],{'as':'VoicePrefixes','through':_0x13c8('0x106'),'required':![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db['MailQueue'],{'as':_0x13c8('0x127'),'through':_0x13c8('0x128'),'required':![]});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0x63')],{'as':_0x13c8('0x129'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x12a')],{'as':_0x13c8('0x12b'),'through':_0x13c8('0x12c'),'required':![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x54')],{'as':_0x13c8('0x12d'),'through':_0x13c8('0x12e'),'required':![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x5c')],{'as':_0x13c8('0x12f'),'through':'UserOpenchannelQueue','required':![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x130')],{'as':'WhatsappQueues','through':_0x13c8('0x131'),'required':![]});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0xf1')],{'through':_0x13c8('0x11b')});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0x5d')],{'as':'ChatWebsites','through':_0x13c8('0x132')});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0x45')],{'as':_0x13c8('0x133'),'through':_0x13c8('0x134')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x36')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x13c8('0x12')][_0x13c8('0x118')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x13c8('0x135')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x4d')],{'as':'SmsAccounts','through':_0x13c8('0x136')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0xfb')],{'as':'WhatsappAccounts','through':_0x13c8('0x137')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0xdc')],{'as':_0x13c8('0x138'),'through':_0x13c8('0x139')});db[_0x13c8('0x13a')][_0x13c8('0x109')](db[_0x13c8('0x18')],{'as':_0x13c8('0x13b'),'onDelete':'cascade','foreignKey':_0x13c8('0x13c')});db['VoiceContext'][_0x13c8('0x109')](db[_0x13c8('0x18')],{'onDelete':_0x13c8('0x107')});db[_0x13c8('0x18')][_0x13c8('0x109')](db['VoiceExtension'],{'as':_0x13c8('0x13d'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x13e')]['belongsToMany'](db[_0x13c8('0x85')],{'as':_0x13c8('0x13f'),'through':'moh_has_sounds'});db[_0x13c8('0x1b')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x13c8('0x140')});db[_0x13c8('0x1b')]['hasMany'](db[_0x13c8('0x6a')],{'as':_0x13c8('0x141'),'foreignKey':_0x13c8('0x140')});db[_0x13c8('0x1b')][_0x13c8('0x109')](db['CmHopperFinal'],{'as':_0x13c8('0x10c'),'foreignKey':_0x13c8('0x140')});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x13c8('0x140')});db[_0x13c8('0x1b')][_0x13c8('0x109')](db['ReportAgentPreview'],{'as':_0x13c8('0x71'),'foreignKey':'VoiceQueueId'});db[_0x13c8('0x1b')][_0x13c8('0x109')](db[_0x13c8('0x6c')],{'as':'HopperBlacks','foreignKey':_0x13c8('0x140')});db['VoiceQueue'][_0x13c8('0x109')](db['JscriptySessionReport'],{'as':_0x13c8('0x142'),'foreignKey':_0x13c8('0x140')});db['VoiceQueue'][_0x13c8('0x114')](db['Trunk'],{'as':_0x13c8('0x28'),'foreignKey':_0x13c8('0x143')});db[_0x13c8('0x1b')][_0x13c8('0x114')](db[_0x13c8('0x28')],{'as':_0x13c8('0x144'),'foreignKey':_0x13c8('0x145')});db[_0x13c8('0x1b')][_0x13c8('0x114')](db['Interval'],{'as':_0x13c8('0x7c'),'foreignKey':_0x13c8('0x146')});db[_0x13c8('0x1b')][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x13c8('0x1b')]['belongsToMany'](db['CmList'],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x13c8('0x1b')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x2b')});db[_0x13c8('0x1b')]['belongsToMany'](db[_0x13c8('0xe1')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x13c8('0x1b')][_0x13c8('0x118')](db[_0x13c8('0xf1')],{'as':'BlackLists','through':_0x13c8('0x149')});db[_0x13c8('0x1d')]['belongsTo'](db[_0x13c8('0x12')],{'as':_0x13c8('0x12'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x14a')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':_0x13c8('0x12'),'foreignKey':_0x13c8('0x108')});db['VoiceMail'][_0x13c8('0x109')](db[_0x13c8('0x14b')],{'as':'Messages','onDelete':_0x13c8('0x107'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x13c8('0x14b')][_0x13c8('0x114')](db[_0x13c8('0x20')],{'foreignKey':_0x13c8('0x14c'),'targetKey':_0x13c8('0x14d')});db[_0x13c8('0x14e')][_0x13c8('0x109')](db[_0x13c8('0x14f')],{'as':_0x13c8('0x150'),'foreignKey':_0x13c8('0x151'),'constraints':![]});db[_0x13c8('0x14e')][_0x13c8('0x109')](db['VoiceAgentReport'],{'as':_0x13c8('0x152'),'foreignKey':'uniqueid','constraints':![]});db[_0x13c8('0x14e')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':'User','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x14e')]['belongsTo'](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x34')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':_0x13c8('0x36'),'foreignKey':_0x13c8('0x154')});db[_0x13c8('0x155')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':_0x13c8('0x36'),'foreignKey':_0x13c8('0x154')});db[_0x13c8('0x36')][_0x13c8('0x156')](db[_0x13c8('0x34')],{'as':'Imap','onDelete':_0x13c8('0x107')});db[_0x13c8('0x36')][_0x13c8('0x156')](db[_0x13c8('0x155')],{'as':_0x13c8('0x157'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x13c8('0x78')],{'as':_0x13c8('0x158'),'foreignKey':_0x13c8('0x154'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x36')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x13c8('0x154')});db['MailAccount'][_0x13c8('0x109')](db['MailMessage'],{'as':_0x13c8('0x159'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x13c8('0x109')](db[_0x13c8('0x3a')],{'as':'Interactions'});db[_0x13c8('0x36')][_0x13c8('0x109')](db[_0x13c8('0x3d')],{'as':_0x13c8('0x13d')});db[_0x13c8('0x36')]['belongsTo'](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x36')][_0x13c8('0x114')](db['Template'],{'as':_0x13c8('0x89'),'foreignKey':'TemplateId'});db[_0x13c8('0x36')][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x13c8('0x15c')});db[_0x13c8('0x36')][_0x13c8('0x118')](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x13c8('0x38')]['belongsToMany'](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x128')});db[_0x13c8('0x38')][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':'team_has_mail_queues','as':_0x13c8('0x15d')});db[_0x13c8('0x3a')][_0x13c8('0x109')](db[_0x13c8('0x3b')],{'as':_0x13c8('0x159'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x15e')});db[_0x13c8('0x3a')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':'Account','foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x3a')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':_0x13c8('0x160'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x3a')]['belongsToMany'](db[_0x13c8('0x87')],{'through':_0x13c8('0x161'),'as':_0x13c8('0x162')});db['MailInteraction']['belongsToMany'](db[_0x13c8('0x87')],{'through':_0x13c8('0x161'),'as':_0x13c8('0x163')});db[_0x13c8('0x3a')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Users','through':_0x13c8('0x11d'),'foreignKey':'MailInteractionId'});db[_0x13c8('0x3b')][_0x13c8('0x109')](db[_0x13c8('0xe6')],{'as':'Attachments','onDelete':_0x13c8('0x107')});db['MailMessage']['belongsTo'](db[_0x13c8('0x12')],{'as':_0x13c8('0x12')});db[_0x13c8('0x3b')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x15f')});db['MailMessage'][_0x13c8('0x114')](db[_0x13c8('0x3a')],{'as':_0x13c8('0x164'),'foreignKey':_0x13c8('0x15e')});db[_0x13c8('0x3b')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':'Account','foreignKey':_0x13c8('0x154')});db[_0x13c8('0x3b')]['belongsTo'](db['ChatWebsite'],{'as':_0x13c8('0x5d'),'foreignKey':_0x13c8('0x165')});db[_0x13c8('0x3b')][_0x13c8('0x114')](db[_0x13c8('0x61')],{'as':_0x13c8('0x61'),'foreignKey':_0x13c8('0x166')});db[_0x13c8('0x3d')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x3d')][_0x13c8('0x114')](db[_0x13c8('0x38')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x3d')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x3d')]['belongsTo'](db[_0x13c8('0x7c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x146')});db[_0x13c8('0x3d')]['belongsTo'](db[_0x13c8('0x87')],{'onDelete':'restrict','foreignKey':_0x13c8('0x168')});db[_0x13c8('0x3f')][_0x13c8('0x114')](db[_0x13c8('0x36')],{});db['MailQueueReport'][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':'List','foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x3f')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x3f')][_0x13c8('0x114')](db[_0x13c8('0x3a')],{});db[_0x13c8('0x3f')][_0x13c8('0x114')](db['MailMessage'],{});db[_0x13c8('0x3f')]['belongsTo'](db[_0x13c8('0x12')],{});db['MailQueueReport'][_0x13c8('0x114')](db[_0x13c8('0x38')],{});db['Dashboard'][_0x13c8('0x109')](db[_0x13c8('0x43')],{'as':'Items','onDelete':_0x13c8('0x107')});db[_0x13c8('0x45')][_0x13c8('0x109')](db['Disposition'],{'as':_0x13c8('0x158'),'foreignKey':_0x13c8('0x169'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x45')]['hasMany'](db[_0x13c8('0x16a')],{'as':_0x13c8('0x16b'),'foreignKey':_0x13c8('0x169')});db['FaxAccount'][_0x13c8('0x109')](db[_0x13c8('0x49')],{'as':_0x13c8('0x16c')});db['FaxAccount'][_0x13c8('0x109')](db[_0x13c8('0x47')],{'as':'Applications'});db['FaxAccount']['hasMany'](db[_0x13c8('0x18')],{'as':'Exntensions','onDelete':'cascade'});db[_0x13c8('0x45')][_0x13c8('0x109')](db['FaxMessage'],{'as':_0x13c8('0x159')});db[_0x13c8('0x45')]['belongsTo'](db[_0x13c8('0x28')],{'as':_0x13c8('0x28')});db[_0x13c8('0x45')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db['FaxAccount'][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x134')});db[_0x13c8('0x47')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x47')][_0x13c8('0x114')](db[_0x13c8('0x12a')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x47')][_0x13c8('0x114')](db[_0x13c8('0x45')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x47')][_0x13c8('0x114')](db[_0x13c8('0x87')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x168')});db[_0x13c8('0x49')]['hasMany'](db[_0x13c8('0x16d')],{'as':_0x13c8('0x159'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x16e')});db[_0x13c8('0x49')][_0x13c8('0x114')](db['FaxAccount'],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x169')});db[_0x13c8('0x49')]['belongsTo'](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x49')][_0x13c8('0x114')](db['User'],{'as':_0x13c8('0x160'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x49')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':'fax_interaction_has_tags','as':_0x13c8('0x162')});db[_0x13c8('0x49')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':'fax_interaction_has_tags','as':_0x13c8('0x163')});db[_0x13c8('0x49')]['belongsToMany'](db['User'],{'as':_0x13c8('0x170'),'through':'user_has_fax_interactions','foreignKey':_0x13c8('0x16e')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x12')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0x49')],{'as':_0x13c8('0x164'),'foreignKey':_0x13c8('0x16e')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':'cascade','as':_0x13c8('0x15f')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0xe6')],{'as':_0x13c8('0xe6'),'foreignKey':_0x13c8('0x171')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0x45')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x169')});db[_0x13c8('0x12a')]['belongsToMany'](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x12c')});db[_0x13c8('0x12a')][_0x13c8('0x118')](db['Team'],{'through':_0x13c8('0x172'),'as':'Teams'});db['FaxQueueReport'][_0x13c8('0x114')](db[_0x13c8('0x45')],{});db[_0x13c8('0x173')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x173')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':'ContactId'});db[_0x13c8('0x173')][_0x13c8('0x114')](db[_0x13c8('0x49')],{});db[_0x13c8('0x173')]['belongsTo'](db[_0x13c8('0x16d')],{});db[_0x13c8('0x173')][_0x13c8('0x114')](db[_0x13c8('0x12')],{});db['FaxQueueReport']['belongsTo'](db[_0x13c8('0x12a')],{});db[_0x13c8('0x4d')]['hasMany'](db[_0x13c8('0x78')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x13c8('0x4d')]['hasMany'](db[_0x13c8('0x16a')],{'as':_0x13c8('0x16b'),'foreignKey':_0x13c8('0x174')});db['SmsAccount'][_0x13c8('0x109')](db[_0x13c8('0x52')],{'as':_0x13c8('0x159'),'foreignKey':'SmsAccountId'});db[_0x13c8('0x4d')][_0x13c8('0x109')](db[_0x13c8('0x111')],{'as':_0x13c8('0x16c')});db['SmsAccount']['hasMany'](db['SmsApplication'],{'as':'Applications'});db[_0x13c8('0x4d')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':'List','foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x4d')]['belongsTo'](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x13c8('0x4d')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x136')});db[_0x13c8('0x4f')][_0x13c8('0x114')](db['User'],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x4f')][_0x13c8('0x114')](db['SmsQueue'],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db['SmsAccount'],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x4f')][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x146')});db['SmsApplication'][_0x13c8('0x114')](db['Tag'],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x168')});db[_0x13c8('0x111')][_0x13c8('0x109')](db['SmsMessage'],{'as':_0x13c8('0x159'),'onDelete':'cascade','foreignKey':_0x13c8('0x175')});db[_0x13c8('0x111')]['belongsTo'](db[_0x13c8('0x4d')],{'as':_0x13c8('0x16f'),'foreignKey':'SmsAccountId'});db[_0x13c8('0x111')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':'ContactId'});db[_0x13c8('0x111')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':'Owner','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x111')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x176'),'as':_0x13c8('0x162')});db['SmsInteraction'][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x176'),'as':_0x13c8('0x163')});db['SmsInteraction']['belongsToMany'](db[_0x13c8('0x12')],{'as':'Users','through':_0x13c8('0x120'),'foreignKey':_0x13c8('0x175')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0x13c8('0x12')});db['SmsMessage'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x15f')});db[_0x13c8('0x52')][_0x13c8('0x114')](db[_0x13c8('0x111')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x164'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x13c8('0x114')](db[_0x13c8('0x4d')],{'as':'Account','foreignKey':_0x13c8('0x174')});db[_0x13c8('0x54')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x12e'),'foreignKey':_0x13c8('0x177')});db[_0x13c8('0x54')][_0x13c8('0x118')](db['Team'],{'through':_0x13c8('0x178'),'as':_0x13c8('0x15d')});db[_0x13c8('0x179')][_0x13c8('0x109')](db['Disposition'],{'as':_0x13c8('0x158'),'foreignKey':'OpenchannelAccountId','onDelete':_0x13c8('0x107')});db[_0x13c8('0x179')][_0x13c8('0x109')](db[_0x13c8('0x16a')],{'as':_0x13c8('0x16b'),'foreignKey':_0x13c8('0x17a')});db[_0x13c8('0x179')][_0x13c8('0x109')](db[_0x13c8('0x59')],{'as':_0x13c8('0x16c'),'foreignKey':_0x13c8('0x17a')});db[_0x13c8('0x179')]['hasMany'](db[_0x13c8('0x17b')],{'as':_0x13c8('0x159'),'foreignKey':_0x13c8('0x17a')});db['OpenchannelAccount'][_0x13c8('0x109')](db[_0x13c8('0x57')],{'as':'Applications','foreignKey':_0x13c8('0x17a')});db[_0x13c8('0x179')]['belongsTo'](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x179')][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':_0x13c8('0x15c')});db[_0x13c8('0x179')][_0x13c8('0x118')](db['User'],{'as':_0x13c8('0x148'),'through':_0x13c8('0x135')});db[_0x13c8('0x57')]['belongsTo'](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x57')][_0x13c8('0x114')](db[_0x13c8('0x5c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x17c')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x17a')});db['OpenchannelApplication'][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x146')});db['OpenchannelApplication'][_0x13c8('0x114')](db[_0x13c8('0x87')],{'onDelete':_0x13c8('0x167'),'foreignKey':'TagId'});db[_0x13c8('0x59')]['hasMany'](db[_0x13c8('0x17b')],{'as':'Messages','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x17d')});db[_0x13c8('0x59')][_0x13c8('0x114')](db[_0x13c8('0x179')],{'as':'Account','foreignKey':_0x13c8('0x17a')});db['OpenchannelInteraction'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':'ContactId'});db[_0x13c8('0x59')]['belongsTo'](db[_0x13c8('0x12')],{'as':_0x13c8('0x160'),'foreignKey':_0x13c8('0x108')});db['OpenchannelInteraction'][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x17e'),'as':'Tags'});db[_0x13c8('0x59')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x17e'),'as':'ThroughTags'});db[_0x13c8('0x59')]['belongsToMany'](db[_0x13c8('0x12')],{'as':_0x13c8('0x170'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x13c8('0x17b')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'onDelete':'cascade','as':'User'});db['OpenchannelMessage'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x15f')});db[_0x13c8('0x17b')][_0x13c8('0x114')](db[_0x13c8('0x59')],{'onDelete':_0x13c8('0x107'),'as':'Interaction','foreignKey':_0x13c8('0x17d')});db[_0x13c8('0x17b')][_0x13c8('0x114')](db['Attachment'],{'as':_0x13c8('0xe6'),'foreignKey':'AttachmentId'});db[_0x13c8('0x17b')]['belongsTo'](db[_0x13c8('0x179')],{'as':'Account','foreignKey':_0x13c8('0x17a')});db[_0x13c8('0x5c')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x32'),'foreignKey':_0x13c8('0x17c')});db['OpenchannelQueue'][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':_0x13c8('0x17f'),'as':_0x13c8('0x15d')});db[_0x13c8('0x5d')][_0x13c8('0x109')](db[_0x13c8('0x78')],{'as':_0x13c8('0x158'),'foreignKey':_0x13c8('0x165'),'onDelete':'cascade'});db[_0x13c8('0x5d')]['hasMany'](db[_0x13c8('0x16a')],{'as':_0x13c8('0x16b'),'foreignKey':_0x13c8('0x165')});db['ChatWebsite'][_0x13c8('0x109')](db[_0x13c8('0x180')],{'as':_0x13c8('0x181')});db[_0x13c8('0x5d')]['hasMany'](db['ChatInteraction'],{'as':_0x13c8('0x16c')});db['ChatWebsite'][_0x13c8('0x109')](db[_0x13c8('0x5e')],{'as':'Applications'});db['ChatWebsite']['hasMany'](db[_0x13c8('0x182')],{'as':_0x13c8('0x159')});db[_0x13c8('0x5d')]['belongsTo'](db['CmList'],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x5d')][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'as':'Interval','foreignKey':_0x13c8('0x146')});db[_0x13c8('0x5d')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':_0x13c8('0x36'),'foreignKey':_0x13c8('0x154')});db['ChatWebsite'][_0x13c8('0x114')](db['Pause'],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x13c8('0x183')][_0x13c8('0x114')](db['OpenchannelAccount'],{});db[_0x13c8('0x183')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':'ListId'});db[_0x13c8('0x183')][_0x13c8('0x114')](db['CmContact'],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db['OpenchannelQueueReport'][_0x13c8('0x114')](db[_0x13c8('0x59')],{});db[_0x13c8('0x183')][_0x13c8('0x114')](db['OpenchannelMessage'],{});db[_0x13c8('0x183')]['belongsTo'](db[_0x13c8('0x12')],{});db[_0x13c8('0x183')][_0x13c8('0x114')](db[_0x13c8('0x5c')],{});db['ChatApplication'][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':'Agent','foreignKey':'UserId','onDelete':'restrict'});db[_0x13c8('0x5e')][_0x13c8('0x114')](db[_0x13c8('0x63')],{'as':_0x13c8('0x184'),'foreignKey':_0x13c8('0x185'),'onDelete':_0x13c8('0x167')});db[_0x13c8('0x5e')][_0x13c8('0x114')](db[_0x13c8('0x5d')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x13c8('0x167')});db[_0x13c8('0x5e')][_0x13c8('0x114')](db[_0x13c8('0x87')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x168')});db['ChatInteraction'][_0x13c8('0x109')](db['ChatMessage'],{'as':_0x13c8('0x159'),'onDelete':_0x13c8('0x107'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x13c8('0x114')](db[_0x13c8('0x5d')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x165')});db[_0x13c8('0x10f')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x10f')]['belongsTo'](db['User'],{'as':_0x13c8('0x160'),'foreignKey':'UserId'});db['ChatInteraction'][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':'chat_interaction_has_tags','as':_0x13c8('0x162')});db[_0x13c8('0x10f')]['belongsToMany'](db[_0x13c8('0x87')],{'through':_0x13c8('0x186'),'as':'ThroughTags'});db['ChatInteraction'][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Users','through':_0x13c8('0x11e'),'foreignKey':_0x13c8('0x187')});db[_0x13c8('0x182')]['belongsTo'](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x12')});db['ChatMessage'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':_0x13c8('0x107'),'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x182')][_0x13c8('0x114')](db['ChatInteraction'],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x164'),'foreignKey':_0x13c8('0x187')});db[_0x13c8('0x182')][_0x13c8('0x114')](db[_0x13c8('0xe6')],{'as':'Attachment','foreignKey':_0x13c8('0x171')});db[_0x13c8('0x182')][_0x13c8('0x114')](db['ChatWebsite'],{'as':_0x13c8('0x16f'),'foreignKey':'ChatWebsiteId'});db[_0x13c8('0x61')][_0x13c8('0x109')](db['Attachment'],{'as':_0x13c8('0x188'),'foreignKey':_0x13c8('0x166'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x61')][_0x13c8('0x114')](db['CmContact'],{'onDelete':'cascade','as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x61')][_0x13c8('0x114')](db['ChatWebsite'],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x165')});db[_0x13c8('0x63')][_0x13c8('0x118')](db['User'],{'as':_0x13c8('0x148'),'through':_0x13c8('0x2d'),'hooks':!![]});db[_0x13c8('0x63')][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':_0x13c8('0x189'),'as':_0x13c8('0x15d')});db[_0x13c8('0x64')]['hasMany'](db[_0x13c8('0xcf')],{'as':'Messages','foreignKey':_0x13c8('0x18a'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x64')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Members','through':'chat_group_has_users'});db[_0x13c8('0x180')]['belongsTo'](db[_0x13c8('0x5d')],{'as':_0x13c8('0x18b'),'foreignKey':'ChatWebsiteId'});db[_0x13c8('0x66')]['hasMany'](db[_0x13c8('0x68')],{'as':'Contacts','foreignKey':_0x13c8('0x18c')});db['CmContact']['hasMany'](db[_0x13c8('0x6a')],{'as':_0x13c8('0x141'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x68')][_0x13c8('0x109')](db[_0x13c8('0x6d')],{'as':'HopperFinals','foreignKey':_0x13c8('0x153')});db['CmContact'][_0x13c8('0x109')](db[_0x13c8('0x6f')],{'as':_0x13c8('0x18d'),'foreignKey':_0x13c8('0x153')});db['CmContact'][_0x13c8('0x109')](db[_0x13c8('0x71')],{'as':'ReportAgentPreview','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x68')]['hasMany'](db['JscriptySessionReport'],{'as':_0x13c8('0x142'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x68')][_0x13c8('0x109')](db[_0x13c8('0x59')],{'as':_0x13c8('0x10e'),'foreignKey':_0x13c8('0x153'),'onDelete':'restrict'});db[_0x13c8('0x68')][_0x13c8('0x109')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0x13c8('0x167')});db['CmContact'][_0x13c8('0x109')](db[_0x13c8('0x111')],{'as':_0x13c8('0x112'),'foreignKey':_0x13c8('0x153'),'onDelete':_0x13c8('0x167')});db[_0x13c8('0x68')][_0x13c8('0x109')](db[_0x13c8('0x49')],{'as':_0x13c8('0x18e'),'foreignKey':_0x13c8('0x153'),'onDelete':'restrict'});db[_0x13c8('0x68')][_0x13c8('0x109')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x13c8('0x153'),'onDelete':_0x13c8('0x167')});db['CmContact'][_0x13c8('0x114')](db['CmCompany'],{'as':_0x13c8('0x18f'),'foreignKey':_0x13c8('0x18c')});db['CmContact']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x13c8('0x15b'),'onDelete':'cascade'});db[_0x13c8('0x68')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Users','through':_0x13c8('0x11a')});db[_0x13c8('0x68')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'as':_0x13c8('0x162'),'through':_0x13c8('0x190')});db['CmContact'][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x190'),'as':_0x13c8('0x163')});db[_0x13c8('0x6a')]['belongsTo'](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopper'][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x6a')]['belongsTo'](db[_0x13c8('0x12')],{'as':'Agent','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x6a')][_0x13c8('0x114')](db[_0x13c8('0x1b')],{'as':_0x13c8('0x184'),'foreignKey':_0x13c8('0x140'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x6a')][_0x13c8('0x114')](db['Campaign'],{'as':_0x13c8('0xe3'),'foreignKey':_0x13c8('0x191'),'onDelete':'cascade'});db[_0x13c8('0x6a')][_0x13c8('0x114')](db['User'],{'as':_0x13c8('0x160'),'foreignKey':_0x13c8('0x192')});db['CmHopperBlack'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x13c8('0x107')});db[_0x13c8('0x6c')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b'),'onDelete':_0x13c8('0x107')});db['CmHopperBlack'][_0x13c8('0x114')](db[_0x13c8('0x1b')],{'as':_0x13c8('0x184'),'foreignKey':_0x13c8('0x140'),'onDelete':'cascade'});db['CmHopperBlack'][_0x13c8('0x114')](db[_0x13c8('0xe3')],{'as':_0x13c8('0xe3'),'foreignKey':_0x13c8('0x191'),'onDelete':'cascade'});db[_0x13c8('0x76')][_0x13c8('0x109')](db[_0x13c8('0x7a')],{'as':{'plural':_0x13c8('0x193'),'singular':'OneAll'},'foreignKey':_0x13c8('0x194'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x76')][_0x13c8('0x109')](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x76')][_0x13c8('0x109')](db['Action'],{'as':_0x13c8('0x195'),'foreignKey':_0x13c8('0x196'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x78')]['hasMany'](db[_0x13c8('0x78')],{'as':_0x13c8('0x158'),'foreignKey':'ParentId','onDelete':_0x13c8('0x107')});db[_0x13c8('0x7c')][_0x13c8('0x109')](db[_0x13c8('0x7c')],{'as':_0x13c8('0x197'),'foreignKey':_0x13c8('0x146'),'onDelete':_0x13c8('0x107'),'hooks':!![],'required':![]});db[_0x13c8('0x7c')][_0x13c8('0x109')](db[_0x13c8('0x18')],{'as':_0x13c8('0x198'),'foreignKey':_0x13c8('0x146'),'onDelete':_0x13c8('0x167')});db['Interval'][_0x13c8('0x109')](db[_0x13c8('0x3d')],{'as':_0x13c8('0x199'),'foreignKey':_0x13c8('0x146')});db[_0x13c8('0x7c')][_0x13c8('0x109')](db[_0x13c8('0x5e')],{'as':'ChatApplications','foreignKey':_0x13c8('0x146')});db[_0x13c8('0x7c')][_0x13c8('0x109')](db[_0x13c8('0x47')],{'as':_0x13c8('0x19a'),'foreignKey':'IntervalId'});db[_0x13c8('0x7c')]['hasMany'](db[_0x13c8('0x4f')],{'as':_0x13c8('0x19b'),'foreignKey':'IntervalId'});db[_0x13c8('0x83')][_0x13c8('0x114')](db[_0x13c8('0x36')],{});db[_0x13c8('0x83')][_0x13c8('0x114')](db[_0x13c8('0x19c')],{'foreignKey':_0x13c8('0x19d')});db[_0x13c8('0x83')]['belongsTo'](db[_0x13c8('0x92')],{'foreignKey':'CustomReportId'});db[_0x13c8('0x85')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x13c8('0x19e'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x13c8('0x87')][_0x13c8('0x118')](db[_0x13c8('0x68')],{'through':_0x13c8('0x190')});db[_0x13c8('0x87')]['belongsToMany'](db[_0x13c8('0x10f')],{'through':_0x13c8('0x186')});db[_0x13c8('0x87')]['belongsToMany'](db['MailInteraction'],{'through':_0x13c8('0x161')});db[_0x13c8('0x87')]['belongsToMany'](db[_0x13c8('0x111')],{'through':'sms_interaction_has_tags'});db[_0x13c8('0x87')][_0x13c8('0x118')](db[_0x13c8('0x49')],{'through':_0x13c8('0x19f')});db[_0x13c8('0x87')][_0x13c8('0x118')](db[_0x13c8('0x59')],{'through':_0x13c8('0x17e')});db[_0x13c8('0x87')][_0x13c8('0x118')](db['WhatsappInteraction'],{'through':_0x13c8('0x1a0')});db['Trigger'][_0x13c8('0x109')](db[_0x13c8('0x7a')],{'as':{'plural':_0x13c8('0x1a1'),'singular':'AllCondition'},'foreignKey':_0x13c8('0x1a2'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db['Trigger'][_0x13c8('0x109')](db[_0x13c8('0x7a')],{'as':{'plural':'AnyConditions','singular':_0x13c8('0x1a3')},'foreignKey':_0x13c8('0x1a4'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x8b')][_0x13c8('0x109')](db[_0x13c8('0x75')],{'as':_0x13c8('0x195'),'foreignKey':_0x13c8('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x13c8('0x92')]['hasMany'](db[_0x13c8('0x98')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x13c8('0x19c')][_0x13c8('0x109')](db[_0x13c8('0x98')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':'DefaultReportId'});db[_0x13c8('0x96')][_0x13c8('0x109')](db[_0x13c8('0x98')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a7')});db[_0x13c8('0x98')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x13c8('0x9c')][_0x13c8('0x109')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0x9e')][_0x13c8('0x109')](db[_0x13c8('0xa0')],{'as':_0x13c8('0x1a9'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0x9e')][_0x13c8('0x109')](db[_0x13c8('0xa0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x9e')]['hasMany'](db['SalesforceField'],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ac')});db['SalesforceConfiguration'][_0x13c8('0x114')](db[_0x13c8('0x9c')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xa0')][_0x13c8('0x109')](db[_0x13c8('0xa0')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xa0')][_0x13c8('0x109')](db['SalesforceField'],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xa0')]['hasMany'](db['SalesforceField'],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db['SalesforceField']['belongsTo'](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db[_0x13c8('0xa1')][_0x13c8('0x109')](db[_0x13c8('0xa3')],{'as':'Configurations','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xa3')][_0x13c8('0x109')](db[_0x13c8('0xa4')],{'as':_0x13c8('0x1a9'),'onDelete':'cascade','foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xa3')][_0x13c8('0x109')](db[_0x13c8('0xa4')],{'as':_0x13c8('0x1b1'),'onDelete':_0x13c8('0x107'),'foreignKey':'DescriptionId'});db[_0x13c8('0xa3')][_0x13c8('0x109')](db['SugarcrmField'],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xa3')][_0x13c8('0x114')](db[_0x13c8('0xa1')],{'as':_0x13c8('0x16f'),'foreignKey':'AccountId'});db[_0x13c8('0xa4')][_0x13c8('0x109')](db[_0x13c8('0xa4')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db['SugarcrmField'][_0x13c8('0x109')](db[_0x13c8('0xa4')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db[_0x13c8('0xa4')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db['SugarcrmField'][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db[_0x13c8('0xa6')]['hasMany'](db[_0x13c8('0x1b2')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0x1b2')]['hasMany'](db[_0x13c8('0xa8')],{'as':_0x13c8('0x1a9'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0x1b2')][_0x13c8('0x109')](db[_0x13c8('0xa8')],{'as':'Descriptions','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x1b2')][_0x13c8('0x109')](db[_0x13c8('0xa8')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0x1b2')]['belongsTo'](db[_0x13c8('0xa6')],{'as':_0x13c8('0x16f'),'foreignKey':'AccountId'});db[_0x13c8('0x1b2')][_0x13c8('0x118')](db['Tag'],{'through':_0x13c8('0x1b4')});db[_0x13c8('0xa8')][_0x13c8('0x109')](db[_0x13c8('0xa8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x13c8('0xa8')][_0x13c8('0x109')](db['DeskField'],{'as':'Description','foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xa8')]['hasMany'](db[_0x13c8('0xa8')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xa8')][_0x13c8('0x114')](db['Variable'],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db['ZohoAccount'][_0x13c8('0x109')](db[_0x13c8('0xab')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':'AccountId'});db[_0x13c8('0xab')][_0x13c8('0x109')](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1a9'),'onDelete':_0x13c8('0x107'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x13c8('0x109')](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1b1'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xab')][_0x13c8('0x109')](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1a6'),'onDelete':'cascade','foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xab')][_0x13c8('0x114')](db[_0x13c8('0x1b6')],{'as':'Account','foreignKey':_0x13c8('0x1a8')});db['ZohoField'][_0x13c8('0x109')](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1ad'),'foreignKey':'SubjectId'});db[_0x13c8('0x1b5')]['hasMany'](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x1b5')]['hasMany'](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0x1b5')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':'Variable','foreignKey':_0x13c8('0x1b0')});db['ZendeskAccount'][_0x13c8('0x109')](db[_0x13c8('0xaf')],{'as':_0x13c8('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x13c8('0xaf')][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':_0x13c8('0x1a9'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xaf')][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x13c8('0xaf')][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':'Fields','foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xaf')]['belongsTo'](db['ZendeskAccount'],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db['ZendeskConfiguration']['belongsToMany'](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x13c8('0x109')](db['ZendeskField'],{'as':_0x13c8('0x1ad'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x1b7')][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0x1b7')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db['FreshdeskAccount'][_0x13c8('0x109')](db[_0x13c8('0xb3')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xb3')][_0x13c8('0x109')](db['FreshdeskField'],{'as':_0x13c8('0x1a9'),'onDelete':'cascade','foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xb3')]['hasMany'](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xb3')][_0x13c8('0x109')](db[_0x13c8('0xb4')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ac')});db['FreshdeskConfiguration'][_0x13c8('0x114')](db[_0x13c8('0xb1')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xb3')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x1b8')});db['FreshdeskField'][_0x13c8('0x109')](db[_0x13c8('0xb4')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db['FreshdeskField'][_0x13c8('0x109')](db[_0x13c8('0xb4')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xb4')][_0x13c8('0x109')](db[_0x13c8('0xb4')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db[_0x13c8('0xb6')]['hasMany'](db[_0x13c8('0xb8')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xb8')]['hasMany'](db['VtigerField'],{'as':_0x13c8('0x1a9'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xb8')][_0x13c8('0x109')](db[_0x13c8('0xba')],{'as':'Descriptions','foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xb8')][_0x13c8('0x109')](db[_0x13c8('0xba')],{'as':_0x13c8('0x1a6'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xb8')][_0x13c8('0x114')](db[_0x13c8('0xb6')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xba')][_0x13c8('0x109')](db[_0x13c8('0xba')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xba')][_0x13c8('0x109')](db[_0x13c8('0xba')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xba')]['hasMany'](db['VtigerField'],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xba')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':'Variable','foreignKey':_0x13c8('0x1b0')});db['ServicenowAccount'][_0x13c8('0x109')](db[_0x13c8('0xbe')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xbe')]['hasMany'](db['ServicenowField'],{'as':_0x13c8('0x1a9'),'foreignKey':_0x13c8('0x1aa')});db['ServicenowConfiguration'][_0x13c8('0x109')](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1b1'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xbe')]['hasMany'](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1a6'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xbe')][_0x13c8('0x114')](db[_0x13c8('0xbc')],{'as':'Account','foreignKey':_0x13c8('0x1a8')});db['ServicenowField'][_0x13c8('0x109')](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xc0')][_0x13c8('0x109')](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1ae'),'foreignKey':'DescriptionId'});db[_0x13c8('0xc0')][_0x13c8('0x109')](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xc0')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db[_0x13c8('0xc2')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xc4')][_0x13c8('0x109')](db['Dynamics365Field'],{'as':_0x13c8('0x1a9'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xc4')]['hasMany'](db[_0x13c8('0xc6')],{'as':_0x13c8('0x1b1'),'onDelete':'cascade','foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xc4')][_0x13c8('0x109')](db[_0x13c8('0xc6')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x13c8('0xc4')]['belongsTo'](db[_0x13c8('0xc2')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xc6')][_0x13c8('0x109')](db['Dynamics365Field'],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db['Dynamics365Field'][_0x13c8('0x109')](db[_0x13c8('0xc6')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xc6')][_0x13c8('0x109')](db[_0x13c8('0xc6')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xc6')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':'VariableId'});db[_0x13c8('0xc8')][_0x13c8('0x109')](db[_0x13c8('0x1b9')],{'as':_0x13c8('0x1b3'),'onDelete':'cascade','foreignKey':_0x13c8('0x1a8')});db['FreshsalesConfiguration'][_0x13c8('0x109')](db[_0x13c8('0xca')],{'as':_0x13c8('0x1a9'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db[_0x13c8('0xca')],{'as':_0x13c8('0x1b1'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x1b9')]['hasMany'](db[_0x13c8('0xca')],{'as':_0x13c8('0x1a6'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0x1b9')][_0x13c8('0x114')](db['FreshsalesAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x13c8('0xca')][_0x13c8('0x109')](db['FreshsalesField'],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xca')][_0x13c8('0x109')](db['FreshsalesField'],{'as':_0x13c8('0x1ae'),'foreignKey':'DescriptionId'});db[_0x13c8('0xca')][_0x13c8('0x109')](db[_0x13c8('0xca')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xca')]['belongsTo'](db[_0x13c8('0x8d')],{'as':'Variable','foreignKey':_0x13c8('0x1b0')});db['ChatQueueReport']['belongsTo'](db['ChatWebsite'],{});db[_0x13c8('0xcd')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':'ContactId'});db[_0x13c8('0xcd')][_0x13c8('0x114')](db['ChatInteraction'],{});db[_0x13c8('0xcd')][_0x13c8('0x114')](db[_0x13c8('0x182')],{});db[_0x13c8('0xcd')]['belongsTo'](db['User'],{});db[_0x13c8('0xcd')]['belongsTo'](db[_0x13c8('0x63')],{});db[_0x13c8('0xcf')]['belongsTo'](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x107'),'foreignKey':'FromId'});db[_0x13c8('0xcf')][_0x13c8('0x114')](db['User'],{'onDelete':'cascade','foreignKey':_0x13c8('0x1ba')});db['JscriptySessionReport']['hasMany'](db[_0x13c8('0xd1')],{'foreignKey':_0x13c8('0x1bb'),'onDelete':'cascade'});db[_0x13c8('0xd3')][_0x13c8('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0x13c8('0x1bb'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db[_0x13c8('0x4d')],{});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':'ListId'});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db['CmContact'],{'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db[_0x13c8('0x111')],{});db['SmsQueueReport']['belongsTo'](db[_0x13c8('0x52')],{});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db[_0x13c8('0x12')],{});db['SmsQueueReport'][_0x13c8('0x114')](db[_0x13c8('0x54')],{});db[_0x13c8('0x1bd')][_0x13c8('0x109')](db[_0x13c8('0xd3')],{'foreignKey':_0x13c8('0x1be')});db[_0x13c8('0x1bd')][_0x13c8('0x109')](db[_0x13c8('0xd1')],{'foreignKey':'ProjectId'});db[_0x13c8('0x1bd')][_0x13c8('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0x13c8('0x1be')});db[_0x13c8('0xdc')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x170'),'through':_0x13c8('0x139')});db['Team'][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x11c')});db[_0x13c8('0xe1')][_0x13c8('0x118')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0x13c8('0x125')});db[_0x13c8('0xe1')]['belongsToMany'](db['MailQueue'],{'through':_0x13c8('0x1bf'),'as':_0x13c8('0x127')});db[_0x13c8('0xe1')][_0x13c8('0x118')](db[_0x13c8('0x63')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x13c8('0xe1')][_0x13c8('0x118')](db['FaxQueue'],{'through':_0x13c8('0x172'),'as':'FaxQueues'});db['Team'][_0x13c8('0x118')](db[_0x13c8('0x54')],{'through':_0x13c8('0x178'),'as':_0x13c8('0x12d')});db[_0x13c8('0xe1')][_0x13c8('0x118')](db[_0x13c8('0x5c')],{'through':_0x13c8('0x17f'),'as':'OpenchannelQueues'});db[_0x13c8('0xe1')][_0x13c8('0x118')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0x13c8('0x1c0')});db[_0x13c8('0xe1')][_0x13c8('0x118')](db[_0x13c8('0x126')],{'through':_0x13c8('0x104'),'as':'VoicePrefixes'});db[_0x13c8('0xe3')][_0x13c8('0x109')](db[_0x13c8('0x6a')],{'as':_0x13c8('0x141'),'foreignKey':_0x13c8('0x191')});db[_0x13c8('0xe3')]['hasMany'](db[_0x13c8('0x6d')],{'as':'HopperFinals','foreignKey':_0x13c8('0x191')});db[_0x13c8('0xe3')]['hasMany'](db[_0x13c8('0x6f')],{'as':_0x13c8('0x18d'),'foreignKey':'CampaignId'});db[_0x13c8('0xe3')][_0x13c8('0x109')](db[_0x13c8('0x6c')],{'as':_0x13c8('0x1c1'),'foreignKey':_0x13c8('0x191')});db['Campaign'][_0x13c8('0x114')](db['Trunk'],{'as':_0x13c8('0x28'),'foreignKey':'TrunkId'});db[_0x13c8('0xe3')][_0x13c8('0x114')](db[_0x13c8('0x28')],{'as':_0x13c8('0x144'),'foreignKey':_0x13c8('0x145')});db[_0x13c8('0xe3')][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'as':'Interval','foreignKey':'IntervalId'});db['Campaign'][_0x13c8('0x114')](db[_0x13c8('0xdc')],{'as':_0x13c8('0xdc'),'foreignKey':'SquareProjectId'});db[_0x13c8('0xe3')][_0x13c8('0x118')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x1c2'),'through':'campaigns_has_cm_lists'});db[_0x13c8('0xe3')]['belongsToMany'](db[_0x13c8('0xf1')],{'as':_0x13c8('0x1c3'),'through':_0x13c8('0x1c4')});db[_0x13c8('0xe6')][_0x13c8('0x114')](db[_0x13c8('0x61')],{'as':'ChatOfflineMessage','foreignKey':_0x13c8('0x166')});db[_0x13c8('0xe9')][_0x13c8('0x114')](db['MailMessage'],{});db[_0x13c8('0xe9')][_0x13c8('0x114')](db[_0x13c8('0x3a')],{});db['MailTransferReport'][_0x13c8('0x114')](db[_0x13c8('0x36')],{'foreignKey':_0x13c8('0x1c5'),'as':_0x13c8('0x1c6')});db[_0x13c8('0xe9')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':_0x13c8('0x1c8')});db[_0x13c8('0xe9')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':_0x13c8('0x1ca')});db['MailTransferReport'][_0x13c8('0x114')](db[_0x13c8('0x38')],{'foreignKey':_0x13c8('0x1cb'),'as':_0x13c8('0x1cc')});db['MailTransferReport']['belongsTo'](db[_0x13c8('0x36')],{'foreignKey':_0x13c8('0x1cd'),'as':_0x13c8('0x1ce')});db[_0x13c8('0xeb')][_0x13c8('0x114')](db[_0x13c8('0x182')],{});db[_0x13c8('0xeb')][_0x13c8('0x114')](db[_0x13c8('0x10f')],{});db[_0x13c8('0xeb')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x13c8('0x1cf'),'as':_0x13c8('0x1c6')});db['ChatTransferReport'][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':_0x13c8('0x1c8')});db[_0x13c8('0xeb')]['belongsTo'](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':'ToAgent'});db[_0x13c8('0xeb')][_0x13c8('0x114')](db['ChatQueue'],{'foreignKey':_0x13c8('0x1d0'),'as':'ToQueue'});db[_0x13c8('0xeb')][_0x13c8('0x114')](db['ChatWebsite'],{'foreignKey':_0x13c8('0x1d1'),'as':_0x13c8('0x1ce')});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db[_0x13c8('0x16d')],{});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db[_0x13c8('0x49')],{});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x13c8('0x1c6')});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':'FromAgent'});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':_0x13c8('0x1ca')});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db['FaxQueue'],{'foreignKey':_0x13c8('0x1d3'),'as':_0x13c8('0x1cc')});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db['FaxAccount'],{'foreignKey':_0x13c8('0x1d4'),'as':_0x13c8('0x1ce')});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x17b')],{});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x59')],{});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x179')],{'foreignKey':'FromOpenchannelAccountId','as':_0x13c8('0x1c6')});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':_0x13c8('0x1c8')});db['OpenchannelTransferReport'][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':'ToAgent'});db[_0x13c8('0xee')][_0x13c8('0x114')](db['OpenchannelQueue'],{'foreignKey':_0x13c8('0x1d5'),'as':_0x13c8('0x1cc')});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x179')],{'foreignKey':_0x13c8('0x1d6'),'as':_0x13c8('0x1ce')});db[_0x13c8('0x1d7')]['belongsTo'](db[_0x13c8('0x52')],{});db[_0x13c8('0x1d7')][_0x13c8('0x114')](db['SmsInteraction'],{});db[_0x13c8('0x1d7')][_0x13c8('0x114')](db[_0x13c8('0x4d')],{'foreignKey':_0x13c8('0x1d8'),'as':_0x13c8('0x1c6')});db[_0x13c8('0x1d7')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':_0x13c8('0x1c8')});db[_0x13c8('0x1d7')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':'ToUserId','as':_0x13c8('0x1ca')});db['SmsTransferReport']['belongsTo'](db['SmsQueue'],{'foreignKey':_0x13c8('0x1d9'),'as':_0x13c8('0x1cc')});db[_0x13c8('0x1d7')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x13c8('0x1da'),'as':_0x13c8('0x1ce')});db[_0x13c8('0xf1')]['hasMany'](db[_0x13c8('0x78')],{'as':'Dispositions','foreignKey':_0x13c8('0x15b'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0xf1')][_0x13c8('0x109')](db[_0x13c8('0x73')],{'as':_0x13c8('0x1db'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xf1')][_0x13c8('0x109')](db['CmContact'],{'as':_0x13c8('0x119'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xf1')][_0x13c8('0x109')](db['CmHopperFinal'],{'as':_0x13c8('0x10c'),'foreignKey':_0x13c8('0x15b')});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':_0x13c8('0x10d'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xf1')][_0x13c8('0x109')](db['ReportAgentPreview'],{'as':_0x13c8('0x71'),'foreignKey':'ListId'});db[_0x13c8('0xf1')][_0x13c8('0x118')](db[_0x13c8('0x1b')],{'as':_0x13c8('0x1dc'),'through':_0x13c8('0x1dd')});db[_0x13c8('0xf1')]['belongsToMany'](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x11b')});db[_0x13c8('0x126')][_0x13c8('0x109')](db[_0x13c8('0x18')],{'as':'Extensions','onDelete':_0x13c8('0x107')});db[_0x13c8('0x126')][_0x13c8('0x118')](db['User'],{'as':_0x13c8('0x148'),'through':'UserVoicePrefix'});db[_0x13c8('0x126')]['belongsToMany'](db[_0x13c8('0xe1')],{'through':_0x13c8('0x104'),'as':_0x13c8('0x15d')});db[_0x13c8('0xf4')][_0x13c8('0x109')](db['User'],{'as':_0x13c8('0x170'),'foreignKey':_0x13c8('0x115')});db['UserProfile'][_0x13c8('0x109')](db['UserProfileSection'],{'as':_0x13c8('0x1de'),'foreignKey':_0x13c8('0x115'),'onDelete':_0x13c8('0x107')});db['UserProfileSection'][_0x13c8('0x109')](db[_0x13c8('0xf7')],{'as':_0x13c8('0x1df'),'foreignKey':_0x13c8('0x1e0'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0xfb')][_0x13c8('0x109')](db[_0x13c8('0x78')],{'as':'Dispositions','foreignKey':_0x13c8('0x1e1'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0xfb')][_0x13c8('0x109')](db[_0x13c8('0x16a')],{'as':'Answers','foreignKey':_0x13c8('0x1e1')});db['WhatsappAccount'][_0x13c8('0x109')](db['WhatsappMessage'],{'as':_0x13c8('0x159'),'foreignKey':_0x13c8('0x1e1')});db[_0x13c8('0xfb')]['hasMany'](db[_0x13c8('0x122')],{'as':_0x13c8('0x16c')});db[_0x13c8('0xfb')][_0x13c8('0x109')](db['WhatsappApplication'],{'as':_0x13c8('0x13d')});db[_0x13c8('0xfb')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xfb')][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x13c8('0xfb')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Agents','through':_0x13c8('0x137')});db['WhatsappApplication']['belongsTo'](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0xfd')][_0x13c8('0x114')](db[_0x13c8('0x130')],{'onDelete':'restrict'});db[_0x13c8('0xfd')]['belongsTo'](db[_0x13c8('0xfb')],{'onDelete':_0x13c8('0x167')});db['WhatsappApplication'][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x146')});db[_0x13c8('0xfd')][_0x13c8('0x114')](db[_0x13c8('0x87')],{'onDelete':_0x13c8('0x167'),'foreignKey':'TagId'});db[_0x13c8('0x122')][_0x13c8('0x109')](db['WhatsappMessage'],{'as':_0x13c8('0x159'),'onDelete':'cascade','foreignKey':_0x13c8('0x1e2')});db['WhatsappInteraction']['belongsTo'](db[_0x13c8('0xfb')],{'as':_0x13c8('0x16f'),'foreignKey':'WhatsappAccountId'});db[_0x13c8('0x122')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x122')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':_0x13c8('0x160'),'foreignKey':'UserId'});db[_0x13c8('0x122')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x1a0'),'as':_0x13c8('0x162')});db['WhatsappInteraction'][_0x13c8('0x118')](db['Tag'],{'through':_0x13c8('0x1a0'),'as':_0x13c8('0x163')});db[_0x13c8('0x122')]['belongsToMany'](db['User'],{'as':_0x13c8('0x170'),'through':_0x13c8('0x124'),'foreignKey':_0x13c8('0x1e2')});db[_0x13c8('0x1e3')][_0x13c8('0x114')](db['User'],{'as':_0x13c8('0x12')});db[_0x13c8('0x1e3')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':'cascade','as':'Contact'});db[_0x13c8('0x1e3')][_0x13c8('0x114')](db['WhatsappInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x13c8('0x1e2')});db[_0x13c8('0x1e3')][_0x13c8('0x114')](db[_0x13c8('0xfb')],{'as':'Account','foreignKey':_0x13c8('0x1e1')});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0xfb')],{});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':'List','foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xff')]['belongsTo'](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0x122')],{});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0x130')],{});db[_0x13c8('0xff')][_0x13c8('0x114')](db['WhatsappMessage'],{});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x13c8('0x1e3')],{});db[_0x13c8('0x1e4')][_0x13c8('0x114')](db[_0x13c8('0x122')],{});db[_0x13c8('0x1e4')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x13c8('0x1e5'),'as':_0x13c8('0x1c6')});db[_0x13c8('0x1e4')][_0x13c8('0x114')](db['WhatsappAccount'],{'foreignKey':_0x13c8('0x1e6'),'as':'ToAccount'});db[_0x13c8('0x1e4')][_0x13c8('0x114')](db[_0x13c8('0x130')],{'foreignKey':_0x13c8('0x1e7'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x13c8('0x1c7'),'as':'FromAgent'});db[_0x13c8('0x1e4')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':'ToAgent'});db[_0x13c8('0x130')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x131'),'foreignKey':_0x13c8('0x1e8')});db[_0x13c8('0x130')][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':_0x13c8('0x1e9'),'as':'Teams'});module[_0x13c8('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index d82fe6d..f028def 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed0b=['3.0.0','/plugins','route','get','resolve','appPath','password','phone','mobile','fax','email','clientSecret','accessKey','tenantId','token','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','pass','localstationid','secret','registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','includes','lodash','express','express-winston','util','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','headers','role','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo'];(function(_0x5ea4b9,_0x1a62b6){var _0x3d375f=function(_0x2341bd){while(--_0x2341bd){_0x5ea4b9['push'](_0x5ea4b9['shift']());}};_0x3d375f(++_0x1a62b6);}(_0xed0b,0x15f));var _0xbed0=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xed0b[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xbed0('0x0'));var path=require('path');var express=require(_0xbed0('0x1'));var ewinston=require(_0xbed0('0x2'));var util=require(_0xbed0('0x3'));var errors=require('./errors');var config=require('./config/environment');var logger=require('./config/logger')(_0xbed0('0x4'));var authLogger=require('./config/logger')(_0xbed0('0x5'));var safeTemplate=require('./safe-template')['safeTemplate'];exports[_0xbed0('0x6')]=function(_0x15508e){_0x15508e[_0xbed0('0x7')](ewinston[_0xbed0('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xf85e12,_0x4ca3a0){var _0x23398d=_0xbed0('0x9');if(!_[_0xbed0('0xa')](_0xf85e12[_0xbed0('0xb')])){_0x23398d+=_0xbed0('0xc');var _0x499b7c=_0xf85e12[_0xbed0('0xb')];maskSensitiveData(_0x499b7c);}return safeTemplate(util[_0xbed0('0xd')](_0x23398d,_0xf85e12[_0xbed0('0xe')],_0xf85e12['headers'][_0xbed0('0xf')]?_0xf85e12['headers'][_0xbed0('0xf')]:_0xf85e12[_0xbed0('0x10')][_0xbed0('0x11')]||_0xf85e12['ip'],_0xf85e12[_0xbed0('0x12')],_0x4ca3a0[_0xbed0('0x13')],_0x4ca3a0[_0xbed0('0x14')],_0xf85e12['user']?_0xf85e12[_0xbed0('0x15')]['id']:null,_0xf85e12[_0xbed0('0x15')]?_0xf85e12['user'][_0xbed0('0x16')]:null,_0xf85e12[_0xbed0('0x15')]?_0xf85e12[_0xbed0('0x15')]['role']:null,_0x499b7c?util['inspect'](_0x499b7c,![],null):''));}}));_0x15508e[_0xbed0('0x7')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x59deeb,_0x599044){var _0xf2c2a3=_0xbed0('0x17');if(_0x59deeb['body']&&_0x59deeb[_0xbed0('0xb')]['device']&&_0x59deeb[_0xbed0('0xb')][_0xbed0('0x18')]){_0xf2c2a3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xbed0('0xd')](_0xf2c2a3,_0x59deeb['method'],_0x59deeb[_0xbed0('0x19')][_0xbed0('0xf')]?_0x59deeb[_0xbed0('0x19')][_0xbed0('0xf')]:_0x59deeb[_0xbed0('0x10')][_0xbed0('0x11')]||_0x59deeb['ip'],_0x59deeb[_0xbed0('0x12')],_0x599044[_0xbed0('0x13')],_0x599044['responseTime'],_0x59deeb['user']?_0x59deeb[_0xbed0('0x15')]['id']:null,_0x59deeb[_0xbed0('0x15')]?_0x59deeb['user'][_0xbed0('0x16')]:null,_0x59deeb['user']?_0x59deeb[_0xbed0('0x15')][_0xbed0('0x1a')]:null,_0x59deeb[_0xbed0('0xb')]&&_0x59deeb['body'][_0xbed0('0x1b')]?_0x59deeb['body'][_0xbed0('0x1b')]:_0xbed0('0x1c'),_0x59deeb['body']&&_0x59deeb[_0xbed0('0xb')][_0xbed0('0x18')]?_0x59deeb[_0xbed0('0xb')][_0xbed0('0x18')]:'',_0x59deeb[_0xbed0('0xb')]&&_0x59deeb[_0xbed0('0xb')][_0xbed0('0x1d')]?_0x59deeb[_0xbed0('0xb')]['agent_name']:'');},'ignoreRoute':function(_0x5cbf6b){var _0x2cd94b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2cd94b[_0xbed0('0x1e')](_0x5cbf6b['url']);}}));_0x15508e[_0xbed0('0x7')](_0xbed0('0x1f'),require(_0xbed0('0x20')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x21'),require(_0xbed0('0x22')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x23'),require(_0xbed0('0x24')));_0x15508e['use'](_0xbed0('0x25'),require(_0xbed0('0x26')));_0x15508e[_0xbed0('0x7')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x15508e['use'](_0xbed0('0x27'),require(_0xbed0('0x28')));_0x15508e['use'](_0xbed0('0x29'),require(_0xbed0('0x2a')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x2b'),require(_0xbed0('0x2c')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x2d'),require(_0xbed0('0x2e')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x2f'),require(_0xbed0('0x30')));_0x15508e['use'](_0xbed0('0x31'),require(_0xbed0('0x32')));_0x15508e['use'](_0xbed0('0x33'),require('./api/voiceDialReport'));_0x15508e['use'](_0xbed0('0x34'),require(_0xbed0('0x35')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x36'),require(_0xbed0('0x37')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x38'),require(_0xbed0('0x39')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x3a'),require(_0xbed0('0x3b')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x3c'),require(_0xbed0('0x3d')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x3e'),require(_0xbed0('0x3f')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x40'),require('./api/mailAccount'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x41'),require(_0xbed0('0x42')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x43'),require('./api/mailSubstatus'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x44'),require('./api/mailInteraction'));_0x15508e['use'](_0xbed0('0x45'),require(_0xbed0('0x46')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x47'),require('./api/mailApplication'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x48'),require(_0xbed0('0x49')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x4a'),require('./api/dashboard'));_0x15508e[_0xbed0('0x7')]('/api/dashboards/items',require(_0xbed0('0x4b')));_0x15508e[_0xbed0('0x7')]('/api/fax/accounts',require(_0xbed0('0x4c')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x4d'),require(_0xbed0('0x4e')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x4f'),require('./api/faxInteraction'));_0x15508e[_0xbed0('0x7')]('/api/fax/messages',require(_0xbed0('0x50')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x51'),require(_0xbed0('0x52')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x53'),require(_0xbed0('0x54')));_0x15508e['use']('/api/sms/accounts',require(_0xbed0('0x55')));_0x15508e['use'](_0xbed0('0x56'),require('./api/smsApplication'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x57'),require(_0xbed0('0x58')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x59'),require(_0xbed0('0x5a')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x5b'),require(_0xbed0('0x5c')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x5d'),require(_0xbed0('0x5e')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x5f'),require(_0xbed0('0x60')));_0x15508e[_0xbed0('0x7')]('/api/openchannel/interactions',require(_0xbed0('0x61')));_0x15508e[_0xbed0('0x7')]('/api/openchannel/messages',require(_0xbed0('0x62')));_0x15508e[_0xbed0('0x7')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x63'),require(_0xbed0('0x64')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x65'),require('./api/openchannelQueueReport'));_0x15508e[_0xbed0('0x7')]('/api/chat/applications',require(_0xbed0('0x66')));_0x15508e[_0xbed0('0x7')]('/api/chat/interactions',require(_0xbed0('0x67')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x68'),require('./api/chatMessage'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x69'),require(_0xbed0('0x6a')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x6b'),require(_0xbed0('0x6c')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x6d'),require('./api/chatGroup'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x6e'),require('./api/chatProactiveAction'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x6f'),require(_0xbed0('0x70')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x71'),require('./api/cmContact'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x72'),require('./api/cmHopper'));_0x15508e['use'](_0xbed0('0x73'),require(_0xbed0('0x74')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x75'),require(_0xbed0('0x76')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x77'),require(_0xbed0('0x78')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x79'),require(_0xbed0('0x7a')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x7b'),require(_0xbed0('0x7c')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x7d'),require(_0xbed0('0x7e')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x7f'),require(_0xbed0('0x80')));_0x15508e[_0xbed0('0x7')]('/api/dispositions',require('./api/disposition'));_0x15508e[_0xbed0('0x7')]('/api/conditions',require(_0xbed0('0x81')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x82'),require('./api/interval'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x83'),require(_0xbed0('0x84')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x85'),require(_0xbed0('0x86')));_0x15508e[_0xbed0('0x7')]('/api/voiceQueuesLog',require(_0xbed0('0x87')));_0x15508e['use'](_0xbed0('0x88'),require('./api/schedule'));_0x15508e[_0xbed0('0x7')]('/api/sounds',require(_0xbed0('0x89')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x8a'),require(_0xbed0('0x8b')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x8c'),require(_0xbed0('0x8d')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x8e'),require(_0xbed0('0x8f')));_0x15508e['use'](_0xbed0('0x90'),require(_0xbed0('0x91')));_0x15508e['use']('/api/integrations',require('./api/integration'));_0x15508e['use'](_0xbed0('0x92'),require('./api/integrationReport'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x93'),require(_0xbed0('0x94')));_0x15508e['use'](_0xbed0('0x95'),require(_0xbed0('0x96')));_0x15508e['use'](_0xbed0('0x97'),require(_0xbed0('0x98')));_0x15508e['use'](_0xbed0('0x99'),require(_0xbed0('0x9a')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x9b'),require(_0xbed0('0x9c')));_0x15508e[_0xbed0('0x7')]('/api/analytics/tree_reports',require(_0xbed0('0x9d')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x9e'),require('./api/intSalesforceAccount'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x9f'),require(_0xbed0('0xa0')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xa1'),require(_0xbed0('0xa2')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xa3'),require(_0xbed0('0xa4')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xa5'),require(_0xbed0('0xa6')));_0x15508e['use'](_0xbed0('0xa7'),require(_0xbed0('0xa8')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xa9'),require(_0xbed0('0xaa')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xab'),require(_0xbed0('0xac')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xad'),require('./api/intDeskField'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xae'),require(_0xbed0('0xaf')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xb0'),require(_0xbed0('0xb1')));_0x15508e['use'](_0xbed0('0xb2'),require(_0xbed0('0xb3')));_0x15508e['use'](_0xbed0('0xb4'),require(_0xbed0('0xb5')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xb6'),require('./api/intZendeskConfiguration'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xb7'),require('./api/intZendeskField'));_0x15508e[_0xbed0('0x7')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xb8'),require(_0xbed0('0xb9')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xba'),require(_0xbed0('0xbb')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xbc'),require('./api/intVtigerAccount'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xbd'),require('./api/intVtigerConfiguration'));_0x15508e[_0xbed0('0x7')]('/api/integrations/vtiger/fields',require(_0xbed0('0xbe')));_0x15508e['use'](_0xbed0('0xbf'),require(_0xbed0('0xc0')));_0x15508e[_0xbed0('0x7')]('/api/integrations/servicenow/configurations',require(_0xbed0('0xc1')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xc2'),require(_0xbed0('0xc3')));_0x15508e['use']('/api/integrations/dynamics365/accounts',require(_0xbed0('0xc4')));_0x15508e[_0xbed0('0x7')]('/api/integrations/dynamics365/configurations',require(_0xbed0('0xc5')));_0x15508e[_0xbed0('0x7')]('/api/integrations/dynamics365/fields',require(_0xbed0('0xc6')));_0x15508e['use']('/api/integrations/freshsales/accounts',require(_0xbed0('0xc7')));_0x15508e['use'](_0xbed0('0xc8'),require('./api/intFreshsalesConfiguration'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xc9'),require('./api/intFreshsalesField'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xca'),require(_0xbed0('0xcb')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xcc'),require(_0xbed0('0xcd')));_0x15508e['use'](_0xbed0('0xce'),require('./api/chatInternalMessage'));_0x15508e[_0xbed0('0x7')]('/api/jscripty/answers/reports',require(_0xbed0('0xcf')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xd0'),require('./api/jscriptyQuestionReport'));_0x15508e[_0xbed0('0x7')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x15508e['use'](_0xbed0('0xd1'),require(_0xbed0('0xd2')));_0x15508e['use'](_0xbed0('0xd3'),require(_0xbed0('0xd4')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xd5'),require(_0xbed0('0xd6')));_0x15508e['use'](_0xbed0('0xd7'),require('./api/jscriptyProject'));_0x15508e['use']('/api/settings',require(_0xbed0('0xd8')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xd9'),require('./api/squareOdbc'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xda'),require('./api/squareProject'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xdb'),require(_0xbed0('0xdc')));_0x15508e['use'](_0xbed0('0xdd'),require(_0xbed0('0xde')));_0x15508e['use'](_0xbed0('0xdf'),require('./api/team'));_0x15508e[_0xbed0('0x7')]('/api/license',require(_0xbed0('0xe0')));_0x15508e['use'](_0xbed0('0xe1'),require(_0xbed0('0xe2')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xe3'),require(_0xbed0('0xe4')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xe5'),require('./api/attachment'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xe6'),require(_0xbed0('0xe7')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xe8'),require(_0xbed0('0xe9')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xea'),require(_0xbed0('0xeb')));_0x15508e[_0xbed0('0x7')]('/api/fax/reports/transfer',require(_0xbed0('0xec')));_0x15508e['use'](_0xbed0('0xed'),require(_0xbed0('0xee')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xef'),require('./api/smsTransferReport'));_0x15508e[_0xbed0('0x7')](_0xbed0('0xf0'),require(_0xbed0('0xf1')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xf2'),require(_0xbed0('0xf3')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xf4'),require('./api/userProfile'));_0x15508e[_0xbed0('0x7')]('/api/userProfile/sections',require(_0xbed0('0xf5')));_0x15508e[_0xbed0('0x7')]('/api/userProfile/resources',require(_0xbed0('0xf6')));_0x15508e[_0xbed0('0x7')]('/api/userNotifications',require(_0xbed0('0xf7')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xf8'),require(_0xbed0('0xf9')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xfa'),require(_0xbed0('0xfb')));_0x15508e[_0xbed0('0x7')]('/api/whatsapp/interactions',require(_0xbed0('0xfc')));_0x15508e[_0xbed0('0x7')](_0xbed0('0xfd'),require(_0xbed0('0xfe')));_0x15508e['use'](_0xbed0('0xff'),require('./api/whatsappQueueReport'));_0x15508e[_0xbed0('0x7')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x100'),require(_0xbed0('0x101')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x102'),require(_0xbed0('0x103')));_0x15508e[_0xbed0('0x7')]('/api/realtime',require(_0xbed0('0x104')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x105'),require(_0xbed0('0x106')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x107'),require('./api/authGoogle'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x108'),require('./api/authActiveDirectory'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x109'),require(_0xbed0('0x10a')));_0x15508e[_0xbed0('0x7')]('/api/rpc',require(_0xbed0('0x10b')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x10c'),require(_0xbed0('0x10d')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x10e'),require('./api/system'));_0x15508e[_0xbed0('0x7')](_0xbed0('0x10f'),require('./api/pm2'));_0x15508e['use']('/api/webbar',require(_0xbed0('0x110')));_0x15508e[_0xbed0('0x7')](_0xbed0('0x111'),express[_0xbed0('0x112')](path[_0xbed0('0x113')](config[_0xbed0('0x114')],_0xbed0('0x111'))));_0x15508e[_0xbed0('0x7')]('/www',express['static'](path[_0xbed0('0x113')](config['root'],_0xbed0('0x115'))));_0x15508e[_0xbed0('0x7')](_0xbed0('0x116'),express[_0xbed0('0x112')](path[_0xbed0('0x113')](config[_0xbed0('0x114')],_0xbed0('0x116'))));_0x15508e[_0xbed0('0x7')]('/snippet',express[_0xbed0('0x112')](path[_0xbed0('0x113')](config[_0xbed0('0x114')],'snippet',_0xbed0('0x117'))));_0x15508e[_0xbed0('0x7')](_0xbed0('0x118'),express['static'](path[_0xbed0('0x113')](config[_0xbed0('0x114')],'/server/files/plugins')));_0x15508e[_0xbed0('0x119')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xbed0('0x11a')](errors[0x194]);_0x15508e['route']('/*')[_0xbed0('0x11a')](function(_0x3e9531,_0x430311){_0x430311['sendFile'](path[_0xbed0('0x11b')](_0x15508e[_0xbed0('0x11a')](_0xbed0('0x11c'))+'/index.html'));});};var sensitiveFields=['username',_0xbed0('0x11d'),'newPassword','apiKey','firstName','lastName','street',_0xbed0('0x11e'),_0xbed0('0x11f'),_0xbed0('0x120'),_0xbed0('0x121'),'clientId',_0xbed0('0x122'),'securityToken','code',_0xbed0('0x123'),_0xbed0('0x124'),_0xbed0('0x125'),'channelSecret','accessToken',_0xbed0('0x126'),_0xbed0('0x127'),_0xbed0('0x128'),_0xbed0('0x129'),'membername','calleridname',_0xbed0('0x12a'),_0xbed0('0x12b'),_0xbed0('0x12c'),_0xbed0('0x12d'),_0xbed0('0x12e'),'accesskeyid','secretaccesskey','key',_0xbed0('0x15'),_0xbed0('0x12f'),'accountSid',_0xbed0('0x130'),'dsn',_0xbed0('0x131'),_0xbed0('0x132'),_0xbed0('0x133')];function maskSensitiveData(_0x3084a5){var _0x1b4977=/(?!^)[\s\S](?!$)/g;if(!_[_0xbed0('0x134')](_0x3084a5))return;for(var _0x548f1d in _0x3084a5){if(_['isArray'](_0x3084a5[_0x548f1d])){for(var _0x11f59e=0x0;_0x11f59e<_0x3084a5[_0x548f1d][_0xbed0('0x135')];_0x11f59e++){maskSensitiveData(_0x3084a5[_0x548f1d][_0x11f59e]);}}else if(_[_0xbed0('0x134')](_0x3084a5[_0x548f1d])){maskSensitiveData(_0x3084a5[_0x548f1d]);}else if(_[_0xbed0('0x136')](_0x3084a5[_0x548f1d])){_0x3084a5[_0x548f1d]=_0x3084a5[_0x548f1d][_0xbed0('0x137')](/{{{/g,_0xbed0('0x138'))[_0xbed0('0x137')](/}}}/g,_0xbed0('0x139'))[_0xbed0('0x137')](/{{/g,'@{')[_0xbed0('0x137')](/}}/g,'}@');if(_[_0xbed0('0x13a')](sensitiveFields,_0x548f1d)){_0x3084a5[_0x548f1d]=_0x3084a5[_0x548f1d][_0xbed0('0x137')](_0x1b4977,'*');}}}} \ No newline at end of file +var _0x6e5b=['./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/realtime','/api/auth/local','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','root','/www','static','join','/demo','snippet','3.0.0','/:url(api|auth|components|app|bower_components|assets)/*','get','/index.html','username','newPassword','apiKey','firstName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','accountSid','localstationid','secret','oldPassword','isPlainObject','isArray','length','replace','@@{','includes','lodash','express','util','./config/environment','./config/logger','auth','./safe-template','safeTemplate','default','use','logger','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','remoteAddress','role','other','agent_name','test','/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/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','./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/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0x6e5b,0x1ae));var _0xb6e5=function(_0x3d48cb,_0x1fbe1f){_0x3d48cb=_0x3d48cb-0x0;var _0x170a55=_0x6e5b[_0x3d48cb];return _0x170a55;};'use strict';var _=require(_0xb6e5('0x0'));var path=require('path');var express=require(_0xb6e5('0x1'));var ewinston=require('express-winston');var util=require(_0xb6e5('0x2'));var errors=require('./errors');var config=require(_0xb6e5('0x3'));var logger=require(_0xb6e5('0x4'))('api');var authLogger=require(_0xb6e5('0x4'))(_0xb6e5('0x5'));var safeTemplate=require(_0xb6e5('0x6'))[_0xb6e5('0x7')];exports[_0xb6e5('0x8')]=function(_0x3aea3b){_0x3aea3b[_0xb6e5('0x9')](ewinston[_0xb6e5('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x38c9b7,_0x5a05b0){var _0x6be65c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x38c9b7[_0xb6e5('0xb')])){_0x6be65c+=_0xb6e5('0xc');var _0x28b5eb=_0x38c9b7[_0xb6e5('0xb')];maskSensitiveData(_0x28b5eb);}return safeTemplate(util[_0xb6e5('0xd')](_0x6be65c,_0x38c9b7[_0xb6e5('0xe')],_0x38c9b7[_0xb6e5('0xf')][_0xb6e5('0x10')]?_0x38c9b7[_0xb6e5('0xf')][_0xb6e5('0x10')]:_0x38c9b7[_0xb6e5('0x11')]['remoteAddress']||_0x38c9b7['ip'],_0x38c9b7[_0xb6e5('0x12')],_0x5a05b0[_0xb6e5('0x13')],_0x5a05b0[_0xb6e5('0x14')],_0x38c9b7[_0xb6e5('0x15')]?_0x38c9b7['user']['id']:null,_0x38c9b7[_0xb6e5('0x15')]?_0x38c9b7[_0xb6e5('0x15')][_0xb6e5('0x16')]:null,_0x38c9b7[_0xb6e5('0x15')]?_0x38c9b7[_0xb6e5('0x15')]['role']:null,_0x28b5eb?util[_0xb6e5('0x17')](_0x28b5eb,![],null):''));}}));_0x3aea3b[_0xb6e5('0x9')](ewinston[_0xb6e5('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x283853,_0x241906){var _0x543467=_0xb6e5('0x18');if(_0x283853[_0xb6e5('0xb')]&&_0x283853['body'][_0xb6e5('0x19')]&&_0x283853['body'][_0xb6e5('0x1a')]){_0x543467='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xb6e5('0xd')](_0x543467,_0x283853[_0xb6e5('0xe')],_0x283853[_0xb6e5('0xf')][_0xb6e5('0x10')]?_0x283853[_0xb6e5('0xf')][_0xb6e5('0x10')]:_0x283853['connection'][_0xb6e5('0x1b')]||_0x283853['ip'],_0x283853['url'],_0x241906[_0xb6e5('0x13')],_0x241906[_0xb6e5('0x14')],_0x283853[_0xb6e5('0x15')]?_0x283853[_0xb6e5('0x15')]['id']:null,_0x283853['user']?_0x283853[_0xb6e5('0x15')][_0xb6e5('0x16')]:null,_0x283853['user']?_0x283853[_0xb6e5('0x15')][_0xb6e5('0x1c')]:null,_0x283853[_0xb6e5('0xb')]&&_0x283853['body'][_0xb6e5('0x19')]?_0x283853[_0xb6e5('0xb')][_0xb6e5('0x19')]:_0xb6e5('0x1d'),_0x283853[_0xb6e5('0xb')]&&_0x283853[_0xb6e5('0xb')][_0xb6e5('0x1a')]?_0x283853[_0xb6e5('0xb')][_0xb6e5('0x1a')]:'',_0x283853['body']&&_0x283853['body']['agent_name']?_0x283853[_0xb6e5('0xb')][_0xb6e5('0x1e')]:'');},'ignoreRoute':function(_0x48cdbc){var _0x3dd14c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3dd14c[_0xb6e5('0x1f')](_0x48cdbc[_0xb6e5('0x12')]);}}));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x20'),require(_0xb6e5('0x21')));_0x3aea3b['use'](_0xb6e5('0x22'),require('./api/voiceChanSpy'));_0x3aea3b['use'](_0xb6e5('0x23'),require(_0xb6e5('0x24')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x25'),require(_0xb6e5('0x26')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x27'),require(_0xb6e5('0x28')));_0x3aea3b['use'](_0xb6e5('0x29'),require('./api/voiceQueue'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x2a'),require(_0xb6e5('0x2b')));_0x3aea3b[_0xb6e5('0x9')]('/api/screen/recordings',require(_0xb6e5('0x2c')));_0x3aea3b[_0xb6e5('0x9')]('/api/voice/mails',require(_0xb6e5('0x2d')));_0x3aea3b['use'](_0xb6e5('0x2e'),require(_0xb6e5('0x2f')));_0x3aea3b[_0xb6e5('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x3aea3b['use'](_0xb6e5('0x30'),require(_0xb6e5('0x31')));_0x3aea3b[_0xb6e5('0x9')]('/api/voice/agents/reports',require(_0xb6e5('0x32')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x33'),require(_0xb6e5('0x34')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x35'),require(_0xb6e5('0x36')));_0x3aea3b[_0xb6e5('0x9')]('/api/trunks',require(_0xb6e5('0x37')));_0x3aea3b[_0xb6e5('0x9')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x38'),require(_0xb6e5('0x39')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x3a'),require('./api/mailAccount'));_0x3aea3b['use']('/api/mail/queues',require(_0xb6e5('0x3b')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x3c'),require(_0xb6e5('0x3d')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x3e'),require(_0xb6e5('0x3f')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x40'),require(_0xb6e5('0x41')));_0x3aea3b[_0xb6e5('0x9')]('/api/mail/applications',require(_0xb6e5('0x42')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x43'),require(_0xb6e5('0x44')));_0x3aea3b['use'](_0xb6e5('0x45'),require('./api/dashboard'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x46'),require(_0xb6e5('0x47')));_0x3aea3b['use']('/api/fax/accounts',require('./api/faxAccount'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x48'),require(_0xb6e5('0x49')));_0x3aea3b[_0xb6e5('0x9')]('/api/fax/interactions',require(_0xb6e5('0x4a')));_0x3aea3b[_0xb6e5('0x9')]('/api/fax/messages',require(_0xb6e5('0x4b')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x4c'),require(_0xb6e5('0x4d')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x4e'),require(_0xb6e5('0x4f')));_0x3aea3b[_0xb6e5('0x9')]('/api/sms/accounts',require(_0xb6e5('0x50')));_0x3aea3b[_0xb6e5('0x9')]('/api/sms/applications',require(_0xb6e5('0x51')));_0x3aea3b[_0xb6e5('0x9')]('/api/sms/interactions',require(_0xb6e5('0x52')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x53'),require(_0xb6e5('0x54')));_0x3aea3b['use'](_0xb6e5('0x55'),require(_0xb6e5('0x56')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x57'),require('./api/openchannelAccount'));_0x3aea3b['use'](_0xb6e5('0x58'),require(_0xb6e5('0x59')));_0x3aea3b['use'](_0xb6e5('0x5a'),require(_0xb6e5('0x5b')));_0x3aea3b['use']('/api/openchannel/messages',require('./api/openchannelMessage'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x5c'),require(_0xb6e5('0x5d')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x5e'),require('./api/chatWebsite'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x5f'),require('./api/openchannelQueueReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x60'),require('./api/chatApplication'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x61'),require('./api/chatInteraction'));_0x3aea3b[_0xb6e5('0x9')]('/api/chat/messages',require('./api/chatMessage'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x62'),require('./api/chatOfflineMessage'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x63'),require(_0xb6e5('0x64')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x65'),require('./api/chatGroup'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x66'),require(_0xb6e5('0x67')));_0x3aea3b[_0xb6e5('0x9')]('/api/cm/companies',require(_0xb6e5('0x68')));_0x3aea3b['use'](_0xb6e5('0x69'),require(_0xb6e5('0x6a')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x6b'),require('./api/cmHopper'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x6c'),require(_0xb6e5('0x6d')));_0x3aea3b[_0xb6e5('0x9')]('/api/cm/hopper_final',require(_0xb6e5('0x6e')));_0x3aea3b['use'](_0xb6e5('0x6f'),require('./api/cmHopperHistory'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x70'),require(_0xb6e5('0x71')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x72'),require(_0xb6e5('0x73')));_0x3aea3b['use']('/api/automations',require(_0xb6e5('0x74')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x75'),require(_0xb6e5('0x76')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x77'),require('./api/disposition'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x78'),require(_0xb6e5('0x79')));_0x3aea3b[_0xb6e5('0x9')]('/api/intervals',require(_0xb6e5('0x7a')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x7b'),require(_0xb6e5('0x7c')));_0x3aea3b['use']('/api/cdr',require(_0xb6e5('0x7d')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x7e'),require(_0xb6e5('0x7f')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x80'),require(_0xb6e5('0x81')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x82'),require(_0xb6e5('0x83')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x84'),require(_0xb6e5('0x85')));_0x3aea3b[_0xb6e5('0x9')]('/api/templates',require('./api/template'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x86'),require(_0xb6e5('0x87')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x88'),require(_0xb6e5('0x89')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x8a'),require('./api/integration'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x8b'),require('./api/integrationReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x8c'),require(_0xb6e5('0x8d')));_0x3aea3b['use'](_0xb6e5('0x8e'),require(_0xb6e5('0x8f')));_0x3aea3b[_0xb6e5('0x9')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x90'),require(_0xb6e5('0x91')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x92'),require('./api/analyticFieldReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x93'),require(_0xb6e5('0x94')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x95'),require(_0xb6e5('0x96')));_0x3aea3b['use'](_0xb6e5('0x97'),require(_0xb6e5('0x98')));_0x3aea3b['use'](_0xb6e5('0x99'),require('./api/intSalesforceField'));_0x3aea3b['use'](_0xb6e5('0x9a'),require(_0xb6e5('0x9b')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x9c'),require(_0xb6e5('0x9d')));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x9e'),require(_0xb6e5('0x9f')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa0'),require(_0xb6e5('0xa1')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa2'),require(_0xb6e5('0xa3')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa4'),require('./api/intZohoAccount'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa5'),require(_0xb6e5('0xa6')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa7'),require(_0xb6e5('0xa8')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa9'),require(_0xb6e5('0xaa')));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/zendesk/configurations',require(_0xb6e5('0xab')));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/zendesk/fields',require(_0xb6e5('0xac')));_0x3aea3b['use'](_0xb6e5('0xad'),require('./api/intFreshdeskAccount'));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xae'),require(_0xb6e5('0xaf')));_0x3aea3b['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xb0'),require('./api/intVtigerConfiguration'));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x3aea3b['use'](_0xb6e5('0xb1'),require(_0xb6e5('0xb2')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xb3'),require(_0xb6e5('0xb4')));_0x3aea3b['use'](_0xb6e5('0xb5'),require(_0xb6e5('0xb6')));_0x3aea3b['use'](_0xb6e5('0xb7'),require(_0xb6e5('0xb8')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xb9'),require('./api/intDynamics365Configuration'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xba'),require(_0xb6e5('0xbb')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xbc'),require('./api/intFreshsalesAccount'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xbd'),require(_0xb6e5('0xbe')));_0x3aea3b['use'](_0xb6e5('0xbf'),require(_0xb6e5('0xc0')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xc1'),require(_0xb6e5('0xc2')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xc3'),require(_0xb6e5('0xc4')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xc5'),require(_0xb6e5('0xc6')));_0x3aea3b[_0xb6e5('0x9')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xc7'),require('./api/jscriptyQuestionReport'));_0x3aea3b['use'](_0xb6e5('0xc8'),require('./api/jscriptySessionReport'));_0x3aea3b[_0xb6e5('0x9')]('/api/sms/reports/queue',require(_0xb6e5('0xc9')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xca'),require(_0xb6e5('0xcb')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xcc'),require(_0xb6e5('0xcd')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xce'),require(_0xb6e5('0xcf')));_0x3aea3b['use'](_0xb6e5('0xd0'),require('./api/setting'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xd1'),require(_0xb6e5('0xd2')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xd3'),require(_0xb6e5('0xd4')));_0x3aea3b['use'](_0xb6e5('0xd5'),require(_0xb6e5('0xd6')));_0x3aea3b[_0xb6e5('0x9')]('/api/square/messages',require(_0xb6e5('0xd7')));_0x3aea3b['use'](_0xb6e5('0xd8'),require(_0xb6e5('0xd9')));_0x3aea3b[_0xb6e5('0x9')]('/api/license',require(_0xb6e5('0xda')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xdb'),require(_0xb6e5('0xdc')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xdd'),require(_0xb6e5('0xde')));_0x3aea3b['use'](_0xb6e5('0xdf'),require(_0xb6e5('0xe0')));_0x3aea3b[_0xb6e5('0x9')]('/api/plugins',require(_0xb6e5('0xe1')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xe2'),require(_0xb6e5('0xe3')));_0x3aea3b['use'](_0xb6e5('0xe4'),require('./api/chatTransferReport'));_0x3aea3b['use'](_0xb6e5('0xe5'),require(_0xb6e5('0xe6')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xe7'),require(_0xb6e5('0xe8')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xe9'),require(_0xb6e5('0xea')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xeb'),require(_0xb6e5('0xec')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xed'),require('./api/voicePrefix'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xee'),require(_0xb6e5('0xef')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xf0'),require(_0xb6e5('0xf1')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xf2'),require('./api/userProfileResource'));_0x3aea3b['use']('/api/userNotifications',require(_0xb6e5('0xf3')));_0x3aea3b[_0xb6e5('0x9')]('/api/whatsapp/accounts',require(_0xb6e5('0xf4')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xf5'),require(_0xb6e5('0xf6')));_0x3aea3b['use']('/api/whatsapp/interactions',require(_0xb6e5('0xf7')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xf8'),require(_0xb6e5('0xf9')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xfa'),require(_0xb6e5('0xfb')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xfc'),require(_0xb6e5('0xfd')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xfe'),require(_0xb6e5('0xff')));_0x3aea3b['use'](_0xb6e5('0x100'),require('./api/cloudProvider'));_0x3aea3b[_0xb6e5('0x9')]('/api/realtime',require(_0xb6e5('0x101')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x102'),require('./api/authLocal'));_0x3aea3b['use']('/api/auth/google',require(_0xb6e5('0x103')));_0x3aea3b[_0xb6e5('0x9')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x3aea3b['use'](_0xb6e5('0x104'),require(_0xb6e5('0x105')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x106'),require(_0xb6e5('0x107')));_0x3aea3b[_0xb6e5('0x9')]('/api/version',require(_0xb6e5('0x108')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x109'),require(_0xb6e5('0x10a')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x10b'),require(_0xb6e5('0x10c')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x10d'),require('./api/webbar'));_0x3aea3b['use'](_0xb6e5('0x10e'),express['static'](path['join'](config[_0xb6e5('0x10f')],_0xb6e5('0x10e'))));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x110'),express[_0xb6e5('0x111')](path[_0xb6e5('0x112')](config[_0xb6e5('0x10f')],_0xb6e5('0x110'))));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x113'),express['static'](path[_0xb6e5('0x112')](config[_0xb6e5('0x10f')],_0xb6e5('0x113'))));_0x3aea3b[_0xb6e5('0x9')]('/snippet',express[_0xb6e5('0x111')](path[_0xb6e5('0x112')](config['root'],_0xb6e5('0x114'),_0xb6e5('0x115'))));_0x3aea3b[_0xb6e5('0x9')]('/plugins',express['static'](path['join'](config[_0xb6e5('0x10f')],'/server/files/plugins')));_0x3aea3b['route'](_0xb6e5('0x116'))[_0xb6e5('0x117')](errors[0x194]);_0x3aea3b['route']('/*')[_0xb6e5('0x117')](function(_0x3c25f5,_0xacf7b2){_0xacf7b2['sendFile'](path['resolve'](_0x3aea3b[_0xb6e5('0x117')]('appPath')+_0xb6e5('0x118')));});};var sensitiveFields=[_0xb6e5('0x119'),'password',_0xb6e5('0x11a'),_0xb6e5('0x11b'),_0xb6e5('0x11c'),'lastName',_0xb6e5('0x11d'),_0xb6e5('0x11e'),_0xb6e5('0x11f'),_0xb6e5('0x120'),_0xb6e5('0x121'),_0xb6e5('0x122'),_0xb6e5('0x123'),_0xb6e5('0x124'),_0xb6e5('0x125'),_0xb6e5('0x126'),'tenantId',_0xb6e5('0x127'),_0xb6e5('0x128'),_0xb6e5('0x129'),_0xb6e5('0x12a'),'authToken',_0xb6e5('0x12b'),_0xb6e5('0x12c'),_0xb6e5('0x12d'),_0xb6e5('0x12e'),_0xb6e5('0x12f'),_0xb6e5('0x130'),_0xb6e5('0x131'),_0xb6e5('0x132'),'privateKey',_0xb6e5('0x133'),_0xb6e5('0x134'),_0xb6e5('0x135'),'user','pass',_0xb6e5('0x136'),_0xb6e5('0x137'),'dsn',_0xb6e5('0x138'),'registry',_0xb6e5('0x139')];function maskSensitiveData(_0x28491b){var _0x52ecb7=/(?!^)[\s\S](?!$)/g;if(!_[_0xb6e5('0x13a')](_0x28491b))return;for(var _0x400538 in _0x28491b){if(_[_0xb6e5('0x13b')](_0x28491b[_0x400538])){for(var _0xfc9399=0x0;_0xfc9399<_0x28491b[_0x400538][_0xb6e5('0x13c')];_0xfc9399++){maskSensitiveData(_0x28491b[_0x400538][_0xfc9399]);}}else if(_[_0xb6e5('0x13a')](_0x28491b[_0x400538])){maskSensitiveData(_0x28491b[_0x400538]);}else if(_['isString'](_0x28491b[_0x400538])){_0x28491b[_0x400538]=_0x28491b[_0x400538][_0xb6e5('0x13d')](/{{{/g,_0xb6e5('0x13e'))[_0xb6e5('0x13d')](/}}}/g,'}@@')[_0xb6e5('0x13d')](/{{/g,'@{')[_0xb6e5('0x13d')](/}}/g,'}@');if(_[_0xb6e5('0x13f')](sensitiveFields,_0x400538)){_0x28491b[_0x400538]=_0x28491b[_0x400538][_0xb6e5('0x13d')](_0x52ecb7,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 69c65a1..3773ab3 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78d9=['../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/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc'];(function(_0x4e8f51,_0x28f135){var _0x9c8b49=function(_0x9a7cf5){while(--_0x9a7cf5){_0x4e8f51['push'](_0x4e8f51['shift']());}};_0x9c8b49(++_0x28f135);}(_0x78d9,0x1bc));var _0x978d=function(_0x435f14,_0x375eed){_0x435f14=_0x435f14-0x0;var _0x47b6b7=_0x78d9[_0x435f14];return _0x47b6b7;};'use strict';var jayson=require(_0x978d('0x0'));var BPromise=require(_0x978d('0x1'));var _=require(_0x978d('0x2'));var config=require(_0x978d('0x3'));exports[_0x978d('0x4')]=function(){return new BPromise(function(_0x12d7db,_0x3f3cfb){var _0x11fcc2={};_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x6')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x7')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x8')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x9')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0xa')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0xb')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0xc')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0xd')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0xe')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0xf')));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x10')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x11')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x12')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x13')));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x14')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x15')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/mailMessage/mailMessage.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x16')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x17')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/faxAccount/faxAccount.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x18')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x19')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/faxMessage/faxMessage.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/faxQueue/faxQueue.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x1a')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x1b')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/smsInteraction/smsInteraction.rpc'));_0x11fcc2=_['merge'](_0x11fcc2,require('../api/smsMessage/smsMessage.rpc'));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x1c')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x1d')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x1e')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x1f')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x20')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x21')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x22')));_0x11fcc2=_['merge'](_0x11fcc2,require('../api/cmContact/cmContact.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x23')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x24')));_0x11fcc2=_['merge'](_0x11fcc2,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x25')));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x26')));_0x11fcc2=_['merge'](_0x11fcc2,require('../api/interval/interval.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x27')));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x28')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x29')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/trigger/trigger.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x2a')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x2b')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x2c')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x2d')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x2e')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x2f')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x30')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x31')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x32')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x33')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x34')));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x35')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x36')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x37')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x38')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x39')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/squareProject/squareProject.rpc'));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x3a')));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x3b')));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x3c')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x3d')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x3e')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x3f')));_0x11fcc2=_[_0x978d('0x5')](_0x11fcc2,require(_0x978d('0x40')));_0x11fcc2=_['merge'](_0x11fcc2,require(_0x978d('0x41')));var _0xfde7d2=jayson[_0x978d('0x42')](_0x11fcc2)['http']();var _0x4932ae=config[_0x978d('0x43')][_0x978d('0x44')]||config['port']+0x1;var _0x5742b5=config[_0x978d('0x43')]['ip']||_0x978d('0x45');_0xfde7d2['on'](_0x978d('0x46'),function(_0x271960){return _0x3f3cfb(_0x271960);});_0xfde7d2['listen'](_0x4932ae,_0x5742b5,function(){console[_0x978d('0x47')](_0x978d('0x48'),_0x5742b5,_0x4932ae);require(_0x978d('0x49'))[_0x978d('0x4a')]();return _0x12d7db(_0x978d('0x4b')+_0x5742b5+':'+_0x4932ae);});});}; \ No newline at end of file +var _0xc009=['../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.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/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc'];(function(_0x1ece13,_0x37fafe){var _0x318167=function(_0x260802){while(--_0x260802){_0x1ece13['push'](_0x1ece13['shift']());}};_0x318167(++_0x37fafe);}(_0xc009,0x1de));var _0x9c00=function(_0x5f3d2d,_0x1e8662){_0x5f3d2d=_0x5f3d2d-0x0;var _0x2b9ef1=_0xc009[_0x5f3d2d];return _0x2b9ef1;};'use strict';var jayson=require(_0x9c00('0x0'));var BPromise=require(_0x9c00('0x1'));var _=require(_0x9c00('0x2'));var config=require('../config/environment');exports[_0x9c00('0x3')]=function(){return new BPromise(function(_0xec990e,_0x338d13){var _0x47d0cf={};_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x5')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x6')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x7')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/voiceRecording/voiceRecording.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x8')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x9')));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xa')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xb')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xc')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xd')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xe')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xf')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/mailAccount/mailAccount.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/mailQueue/mailQueue.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x10')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x11')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x12')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x13')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x14')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x15')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x16')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x17')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x18')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x19')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x1a')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x1b')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x1c')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x1d')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x1e')));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x1f')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x20')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x21')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x22')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x23')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x24')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x25')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x26')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x27')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x28')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x29')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x2a')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x2b')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/variable/variable.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x2c')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x2d')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x2e')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x2f')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x30')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x31')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x32')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x33')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x34')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x35')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x36')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x37')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x38')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x39')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x3a')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x3b')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/squareMessage/squareMessage.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x3c')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x3d')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/plugin/plugin.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x3e')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x3f')));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3f5ba9=jayson[_0x9c00('0x40')](_0x47d0cf)[_0x9c00('0x41')]();var _0x2341f1=config[_0x9c00('0x42')][_0x9c00('0x43')]||config[_0x9c00('0x43')]+0x1;var _0x13234f=config[_0x9c00('0x42')]['ip']||_0x9c00('0x44');_0x3f5ba9['on'](_0x9c00('0x45'),function(_0x3737bf){return _0x338d13(_0x3737bf);});_0x3f5ba9[_0x9c00('0x3')](_0x2341f1,_0x13234f,function(){console[_0x9c00('0x46')](_0x9c00('0x47'),_0x13234f,_0x2341f1);require(_0x9c00('0x48'))[_0x9c00('0x49')]();return _0xec990e(_0x9c00('0x4a')+_0x13234f+':'+_0x2341f1);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index b28b34b..451caaa 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x2032,0xd9));var _0x2203=function(_0xcc4b4a,_0x1185bd){_0xcc4b4a=_0xcc4b4a-0x0;var _0x9a6f1b=_0x2032[_0xcc4b4a];return _0x9a6f1b;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate; \ No newline at end of file +var _0x5eb8=['{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate'];(function(_0x236f19,_0x11dea9){var _0x3c5ea3=function(_0x2a47ad){while(--_0x2a47ad){_0x236f19['push'](_0x236f19['shift']());}};_0x3c5ea3(++_0x11dea9);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0x5eb8[_0x3653c7];return _0x58a021;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x57e9bc){return _0x57e9bc==='{{'?_0x85eb('0x0'):_0x85eb('0x1');}function safeTemplate(_0x393a8a){var _0xd2f5dc=_0x393a8a;if(typeof _0x393a8a===_0x85eb('0x2')){_0xd2f5dc=_0x393a8a[_0x85eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x85eb('0x4')](_0x393a8a)){_0xd2f5dc=_0x393a8a[_0x85eb('0x5')](function(_0x3c5798){return safeTemplate(_0x3c5798);});}else if(_[_0x85eb('0x6')](_0x393a8a)){_0xd2f5dc=Object[_0x85eb('0x7')](_0x393a8a)[_0x85eb('0x8')](function(_0x4a8814,_0x16d7b9){_0x4a8814[_0x16d7b9]=safeTemplate(_0x393a8a[_0x16d7b9]);return _0x4a8814;},{});}return _0xd2f5dc;}module[_0x85eb('0x9')][_0x85eb('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 51227bf..2feeff7 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 _0xf966=['events','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','getData','beep','noop','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash'];(function(_0x46d3ce,_0x4a195c){var _0x38518c=function(_0x2f58bb){while(--_0x2f58bb){_0x46d3ce['push'](_0x46d3ce['shift']());}};_0x38518c(++_0x4a195c);}(_0xf966,0x184));var _0x6f96=function(_0x3d08ab,_0x2521a4){_0x3d08ab=_0x3d08ab-0x0;var _0x49a605=_0xf966[_0x3d08ab];return _0x49a605;};'use strict';var util=require(_0x6f96('0x0'));var _=require(_0x6f96('0x1'));var EventEmitter=require(_0x6f96('0x2'))['EventEmitter'];var AGIReply=require(_0x6f96('0x3'));var AGIError=require(_0x6f96('0x4'));function AGIChannel(_0x22fbb3){var _0x5500f4=this,_0x1820d1=new AGIReply(),_0x33a4e6=![],_0x23019c={};EventEmitter['call'](_0x5500f4);_0x22fbb3[_0x6f96('0x5')](_0x6f96('0x6'));_0x22fbb3[_0x6f96('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1820d1[_0x6f96('0x5')](_0x6f96('0x6'));_0x1820d1['on'](_0x6f96('0x8'),function(_0x3918eb){for(var _0x16f927 in _0x3918eb){_0x5500f4[_0x16f927]=_0x3918eb[_0x16f927];}_0x5500f4[_0x6f96('0x9')](_0x6f96('0xa'));});_0x1820d1['on'](_0x6f96('0xb'),function(_0x23c22e){if(_0x23c22e[_0x6f96('0xc')]()==_0x6f96('0xd')){_0x5500f4[_0x6f96('0x9')]('hangup');return;}if(_0x23c22e[_0x6f96('0xe')](0x0,0xb)=='520-Invalid'){_0x33a4e6=!![];}if(_0x33a4e6){_0x23019c['rx']+=_0x23c22e+'\x0a';if(_0x23c22e['search'](_0x6f96('0xf'))!=-0x1){_0x33a4e6=![];}}else{_0x23019c['rx']=_0x23c22e;}if(_0x33a4e6){return;}if(typeof _0x23019c['cb']==_0x6f96('0x10')){var _0x58cc34=_0x23019c['rx'][_0x6f96('0xe')](0x0,0x3),_0x30f125=null,_0x126b6a=null;_0x58cc34=parseInt(_0x58cc34);if(isNaN(_0x58cc34)){_0x23019c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6f96('0x11')});return;}if(_0x58cc34!=0xc8){_0x23019c['cb'](null,{'code':_0x58cc34,'result':-0x1,'extra':'KO'});return;}_0x30f125=_0x23019c['rx'][_0x6f96('0xe')](0x4)[_0x6f96('0x12')](_0x6f96('0x13'),'');if(_0x30f125[_0x6f96('0x14')]('\x20')!=-0x1){_0x30f125=_0x30f125['substr'](0x0,_0x30f125[_0x6f96('0x14')]('\x20'));}if(_[_0x6f96('0x15')](_0x30f125,'-1')){_0x30f125=parseInt(_0x30f125);}_0x126b6a=_0x23019c['rx']['split']('\x20');if(_0x126b6a[_0x6f96('0x16')]==0x3){_0x126b6a=_0x126b6a[0x2][_0x6f96('0xe')](0x1,_0x126b6a[0x2]['length']-0x1);}else if(_0x126b6a['length']>0x3){var _0x2cb315=/\((.+)\)/;var _0x3eb97e=_0x23019c['rx'][_0x6f96('0x17')](_0x2cb315);if(_0x3eb97e){_0x126b6a=_0x3eb97e[0x1];}else{_0x126b6a=null;}}else{_0x126b6a=null;}_0x23019c['cb'](null,{'code':_0x58cc34,'result':_0x30f125,'extra':_0x126b6a});}});_0x22fbb3['on']('error',function(_0x421e59){_0x5500f4['emit'](_0x6f96('0x18'),new AGIError(_0x6f96('0x19'),_0x421e59['code']));});_0x22fbb3['on']('close',function(){_0x5500f4[_0x6f96('0x9')](_0x6f96('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x22fbb3['on'](_0x6f96('0x1b'),function(){_0x5500f4['emit'](_0x6f96('0x1b'),new AGIError(_0x6f96('0x1c')));_0x22fbb3[_0x6f96('0x1d')]();});_0x22fbb3[_0x6f96('0x1e')](_0x1820d1);this[_0x6f96('0x1f')]=function(_0x5dc59b,_0x1d8dc7){var _0x5dc59b=_0x5dc59b||'',_0x1d8dc7=typeof _0x1d8dc7==_0x6f96('0x10')?_0x1d8dc7:new Function();_0x23019c={'tx':_0x5dc59b,'rx':'','cb':_0x1d8dc7};_0x22fbb3['write'](_0x5dc59b+'\x0a');},this[_0x6f96('0x1a')]=function(){_0x22fbb3['destroy']();};}util[_0x6f96('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x6f96('0x21')][_0x6f96('0x22')]=function(_0x2607b9){return this[_0x6f96('0x1f')][_0x6f96('0x23')](this,_0x2607b9);};AGIChannel[_0x6f96('0x21')][_0x6f96('0x24')]=function(){return this[_0x6f96('0x22')]('ANSWER');};AGIChannel[_0x6f96('0x21')][_0x6f96('0x25')]=function(_0x38922d,_0x3f3aec,_0x1c20aa){_0x38922d=_0x38922d===undefined?_0x6f96('0x26'):_0x38922d;_0x3f3aec=_0x3f3aec===undefined?'5':_0x3f3aec;_0x1c20aa=_0x1c20aa===undefined?'1':_0x1c20aa;return this['sendRequest'](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x38922d,_0x3f3aec*0x3e8,_0x1c20aa));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x27')]=function(_0x37b404){_0x37b404=_0x37b404||'NO\x20MESSAGE';return this[_0x6f96('0x22')](util[_0x6f96('0x28')](_0x6f96('0x29'),_0x37b404));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x2a')]=function(_0x566cb1,_0x38dbba){if(_[_0x6f96('0x2b')](_0x38dbba)){return this['sendRequest'](util[_0x6f96('0x28')](_0x6f96('0x2c'),_0x566cb1,_0x38dbba[_0x6f96('0x2d')](',')));}return this[_0x6f96('0x22')](util[_0x6f96('0x28')](_0x6f96('0x2c'),_0x566cb1,_0x38dbba));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x2e')]=function(_0x4fafd4){return this[_0x6f96('0x22')](util[_0x6f96('0x28')](_0x6f96('0x2f'),_0x4fafd4));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x30')]=function(_0x2e6df8){return this['sendRequest'](util[_0x6f96('0x28')](_0x6f96('0x31'),_0x2e6df8));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x32')]=function(_0x33028d){return this[_0x6f96('0x22')](util['format'](_0x6f96('0x33'),_0x33028d));};AGIChannel['prototype'][_0x6f96('0xd')]=function(){return this[_0x6f96('0x22')]('HANGUP');};AGIChannel[_0x6f96('0x21')]['setVariable']=function(_0x333e43,_0x28624c){var _0x33fbf2=_[_0x6f96('0x34')](_0x28624c)||_[_0x6f96('0x35')](_0x28624c)?_0x28624c[_0x6f96('0x36')]():_0x28624c;return this['sendRequest'](util['format'](_0x6f96('0x37'),_0x333e43,_0x33fbf2?_0x33fbf2['toString']()[_0x6f96('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x6f96('0x38')]=function(_0x2d060f,_0x37bc1d){return this[_0x6f96('0x22')](util[_0x6f96('0x28')](_0x6f96('0x39'),_0x2d060f,_0x37bc1d));};AGIChannel['prototype'][_0x6f96('0x3a')]=function(_0x42320d,_0x9be8f5){return this[_0x6f96('0x22')](util['format'](_0x6f96('0x3b'),_0x42320d,_0x9be8f5));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x3c')]=function(_0x2fa5a1,_0x5299de){return this[_0x6f96('0x22')](util[_0x6f96('0x28')](_0x6f96('0x3d'),_0x2fa5a1,_0x5299de));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x3e')]=function(_0x4449d3,_0x32851a,_0x352bf8){_0x32851a=_0x32851a||this[_0x6f96('0x3f')];_0x352bf8=_0x352bf8||0x1;this[_0x6f96('0x2e')](_0x4449d3);this['setExtension'](_0x32851a);this[_0x6f96('0x32')](_0x352bf8);return this['noop'](util['format'](_0x6f96('0x40'),_0x4449d3,_0x32851a,_0x352bf8));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x41')]=function(_0x1d6023){return this[_0x6f96('0x22')](util['format'](_0x6f96('0x42'),_0x1d6023));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x43')]=function(_0x2e4ce6,_0x56dbe9,_0x88ae60,_0x2dd7a4,_0x89e932,_0x32958f){_0x56dbe9=_0x56dbe9||'wav';_0x88ae60=_0x88ae60||'';_0x2dd7a4=_0x2dd7a4===undefined?-0x1:_0x2dd7a4==='-1'?-0x1:_0x2dd7a4*0x3e8;_0x89e932=_0x89e932===undefined?'':'s='+_0x89e932;_0x32958f=_0x32958f?_0x6f96('0x44'):'';return this[_0x6f96('0x22')](util[_0x6f96('0x28')](_0x6f96('0x45'),_0x2e4ce6,_0x56dbe9,_0x88ae60,_0x2dd7a4,_0x32958f,_0x89e932));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x46')]=function(_0x964f97,_0x2b2c79){_0x2b2c79=_0x2b2c79||'';return this['sendRequest'](util['format'](_0x6f96('0x47'),_0x964f97,_0x2b2c79));};AGIChannel[_0x6f96('0x21')][_0x6f96('0x48')]=function(_0x2deb26){return this[_0x6f96('0x2a')]('AGI',_0x2deb26);};AGIChannel[_0x6f96('0x21')][_0x6f96('0x49')]=function(_0x376c08){return this[_0x6f96('0x2a')](_0x6f96('0x4a'),_0x376c08);};AGIChannel[_0x6f96('0x21')][_0x6f96('0x18')]=function(_0x74b112,_0x12d2f1){this[_0x6f96('0x27')](util[_0x6f96('0x28')](_0x6f96('0x4b'),_0x74b112['id'],_0x74b112[_0x6f96('0x4c')],_0x12d2f1));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6f96('0x4d')]=AGIChannel; \ No newline at end of file +var _0x4bd3=['length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','destroy','prototype','sendRequest','sync','answer','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','setVariable','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','EventEmitter','call','setEncoding','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','substring','no\x20code','replace','result=','indexOf'];(function(_0x32d83e,_0x4c9155){var _0xdc5d9=function(_0x1e0f1a){while(--_0x1e0f1a){_0x32d83e['push'](_0x32d83e['shift']());}};_0xdc5d9(++_0x4c9155);}(_0x4bd3,0x174));var _0x34bd=function(_0x22b637,_0x1b6a95){_0x22b637=_0x22b637-0x0;var _0x2b9450=_0x4bd3[_0x22b637];return _0x2b9450;};'use strict';var util=require(_0x34bd('0x0'));var _=require('lodash');var EventEmitter=require(_0x34bd('0x1'))[_0x34bd('0x2')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x4cad21){var _0x22b921=this,_0x44854a=new AGIReply(),_0x1fc8eb=![],_0x5846f3={};EventEmitter[_0x34bd('0x3')](_0x22b921);_0x4cad21[_0x34bd('0x4')]('utf8');_0x4cad21[_0x34bd('0x5')](0x8*0x3c*0x3c*0x3e8);_0x44854a[_0x34bd('0x4')]('utf8');_0x44854a['on'](_0x34bd('0x6'),function(_0x76de8d){for(var _0x3260ff in _0x76de8d){_0x22b921[_0x3260ff]=_0x76de8d[_0x3260ff];}_0x22b921[_0x34bd('0x7')](_0x34bd('0x8'));});_0x44854a['on'](_0x34bd('0x9'),function(_0x4db0ba){if(_0x4db0ba[_0x34bd('0xa')]()==_0x34bd('0xb')){_0x22b921[_0x34bd('0x7')](_0x34bd('0xb'));return;}if(_0x4db0ba['substring'](0x0,0xb)=='520-Invalid'){_0x1fc8eb=!![];}if(_0x1fc8eb){_0x5846f3['rx']+=_0x4db0ba+'\x0a';if(_0x4db0ba[_0x34bd('0xc')]('520\x20End\x20of\x20proper')!=-0x1){_0x1fc8eb=![];}}else{_0x5846f3['rx']=_0x4db0ba;}if(_0x1fc8eb){return;}if(typeof _0x5846f3['cb']=='function'){var _0x275d80=_0x5846f3['rx'][_0x34bd('0xd')](0x0,0x3),_0x1f19b9=null,_0x282af4=null;_0x275d80=parseInt(_0x275d80);if(isNaN(_0x275d80)){_0x5846f3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x34bd('0xe')});return;}if(_0x275d80!=0xc8){_0x5846f3['cb'](null,{'code':_0x275d80,'result':-0x1,'extra':'KO'});return;}_0x1f19b9=_0x5846f3['rx'][_0x34bd('0xd')](0x4)[_0x34bd('0xf')](_0x34bd('0x10'),'');if(_0x1f19b9[_0x34bd('0x11')]('\x20')!=-0x1){_0x1f19b9=_0x1f19b9['substr'](0x0,_0x1f19b9[_0x34bd('0x11')]('\x20'));}if(_['startsWith'](_0x1f19b9,'-1')){_0x1f19b9=parseInt(_0x1f19b9);}_0x282af4=_0x5846f3['rx']['split']('\x20');if(_0x282af4[_0x34bd('0x12')]==0x3){_0x282af4=_0x282af4[0x2][_0x34bd('0xd')](0x1,_0x282af4[0x2][_0x34bd('0x12')]-0x1);}else if(_0x282af4[_0x34bd('0x12')]>0x3){var _0x34b91b=/\((.+)\)/;var _0x1643af=_0x5846f3['rx'][_0x34bd('0x13')](_0x34b91b);if(_0x1643af){_0x282af4=_0x1643af[0x1];}else{_0x282af4=null;}}else{_0x282af4=null;}_0x5846f3['cb'](null,{'code':_0x275d80,'result':_0x1f19b9,'extra':_0x282af4});}});_0x4cad21['on'](_0x34bd('0x14'),function(_0x3b4bf8){_0x22b921[_0x34bd('0x7')](_0x34bd('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x3b4bf8[_0x34bd('0x15')]));});_0x4cad21['on'](_0x34bd('0x16'),function(){_0x22b921[_0x34bd('0x7')](_0x34bd('0x16'),new AGIError(_0x34bd('0x17')));});_0x4cad21['on'](_0x34bd('0x18'),function(){_0x22b921[_0x34bd('0x7')](_0x34bd('0x18'),new AGIError(_0x34bd('0x19')));_0x4cad21['destroy']();});_0x4cad21[_0x34bd('0x1a')](_0x44854a);this[_0x34bd('0x1b')]=function(_0x49f625,_0x14254b){var _0x49f625=_0x49f625||'',_0x14254b=typeof _0x14254b=='function'?_0x14254b:new Function();_0x5846f3={'tx':_0x49f625,'rx':'','cb':_0x14254b};_0x4cad21['write'](_0x49f625+'\x0a');},this['close']=function(){_0x4cad21[_0x34bd('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x34bd('0x1d')][_0x34bd('0x1e')]=function(_0x428140){return this['command'][_0x34bd('0x1f')](this,_0x428140);};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x20')]=function(){return this[_0x34bd('0x1e')]('ANSWER');};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x21')]=function(_0x264c94,_0x3e4dc3,_0x56baf7){_0x264c94=_0x264c94===undefined?_0x34bd('0x22'):_0x264c94;_0x3e4dc3=_0x3e4dc3===undefined?'5':_0x3e4dc3;_0x56baf7=_0x56baf7===undefined?'1':_0x56baf7;return this[_0x34bd('0x1e')](util['format'](_0x34bd('0x23'),_0x264c94,_0x3e4dc3*0x3e8,_0x56baf7));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x24')]=function(_0x3f675c){_0x3f675c=_0x3f675c||_0x34bd('0x25');return this[_0x34bd('0x1e')](util[_0x34bd('0x26')]('VERBOSE\x20\x22%s\x22',_0x3f675c));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x27')]=function(_0x56d3b9,_0x5d1662){if(_[_0x34bd('0x28')](_0x5d1662)){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')]('EXEC\x20%s\x20%s',_0x56d3b9,_0x5d1662['join'](',')));}return this[_0x34bd('0x1e')](util[_0x34bd('0x26')](_0x34bd('0x29'),_0x56d3b9,_0x5d1662));};AGIChannel[_0x34bd('0x1d')]['setContext']=function(_0x3a6fb2){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')](_0x34bd('0x2a'),_0x3a6fb2));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x2b')]=function(_0x4ae886){return this[_0x34bd('0x1e')](util['format'](_0x34bd('0x2c'),_0x4ae886));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x2d')]=function(_0x4e9e70){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')]('SET\x20PRIORITY\x20%s',_0x4e9e70));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0xb')]=function(){return this[_0x34bd('0x1e')]('HANGUP');};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x2e')]=function(_0x4bfb6c,_0x117188){var _0x41c377=_[_0x34bd('0x2f')](_0x117188)||_[_0x34bd('0x30')](_0x117188)?_0x117188[_0x34bd('0x31')]():_0x117188;return this[_0x34bd('0x1e')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4bfb6c,_0x41c377?_0x41c377['toString']()[_0x34bd('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x34bd('0x1d')]['sayNumber']=function(_0x5b5f86,_0x13d2f0){return this['sendRequest'](util['format'](_0x34bd('0x32'),_0x5b5f86,_0x13d2f0));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x33')]=function(_0xdc3496,_0x2af1af){return this['sendRequest'](util['format'](_0x34bd('0x34'),_0xdc3496,_0x2af1af));};AGIChannel['prototype'][_0x34bd('0x35')]=function(_0x2c9b7a,_0x3fc418){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2c9b7a,_0x3fc418));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x36')]=function(_0x16858c,_0x1b86e1,_0x551c87){_0x1b86e1=_0x1b86e1||this[_0x34bd('0x37')];_0x551c87=_0x551c87||0x1;this['setContext'](_0x16858c);this[_0x34bd('0x2b')](_0x1b86e1);this[_0x34bd('0x2d')](_0x551c87);return this['noop'](util[_0x34bd('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x16858c,_0x1b86e1,_0x551c87));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x38')]=function(_0x18e9f6){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')](_0x34bd('0x39'),_0x18e9f6));};AGIChannel[_0x34bd('0x1d')]['recordFile']=function(_0x4986bb,_0x547f97,_0xede936,_0x3e4d4d,_0x22ebf4,_0x787f74){_0x547f97=_0x547f97||'wav';_0xede936=_0xede936||'';_0x3e4d4d=_0x3e4d4d===undefined?-0x1:_0x3e4d4d==='-1'?-0x1:_0x3e4d4d*0x3e8;_0x22ebf4=_0x22ebf4===undefined?'':'s='+_0x22ebf4;_0x787f74=_0x787f74?_0x34bd('0x3a'):'';return this[_0x34bd('0x1e')](util[_0x34bd('0x26')](_0x34bd('0x3b'),_0x4986bb,_0x547f97,_0xede936,_0x3e4d4d,_0x787f74,_0x22ebf4));};AGIChannel[_0x34bd('0x1d')]['streamFile']=function(_0x3687b9,_0x557094){_0x557094=_0x557094||'';return this['sendRequest'](util[_0x34bd('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3687b9,_0x557094));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x3c')]=function(_0x18d71e){return this[_0x34bd('0x27')](_0x34bd('0x3d'),_0x18d71e);};AGIChannel['prototype']['wait']=function(_0x33e8e8){return this['exec'](_0x34bd('0x3e'),_0x33e8e8);};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x14')]=function(_0x540b04,_0x4ad00c){this['noop'](util['format'](_0x34bd('0x3f'),_0x540b04['id'],_0x540b04['label'],_0x4ad00c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x34bd('0x40')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0163091..d5cb498 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 _0xf7a4=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7a4,0x175));var _0x4f7a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xf7a4[_0x2235bf];return _0x4c3a64;};'use strict';var util=require(_0x4f7a('0x0'));var error={'E_AGI_UNDEFINED':_0x4f7a('0x1'),'E_AGI_ARGUMENT_PORT':_0x4f7a('0x2'),'E_AGI_SERVER_ERROR':_0x4f7a('0x3'),'E_AGI_SERVER_CLOSE':_0x4f7a('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x4f7a('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x4f7a('0x6'),'E_AGI_COMMAND_EMPTY':_0x4f7a('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4f7a('0x8'),'E_AGI_IVR_ENTRY':_0x4f7a('0x9')};function AGIError(_0x46b776){var _0x46b776=_0x46b776||null,_0x48d1c9=_0x48d1c9||[],_0xdd6584=0x1,_0x52adb8='';if(!error[_0x46b776]){_0x46b776=_0x4f7a('0xa');}_0x48d1c9[_0x4f7a('0xb')](error[_0x46b776]);while(arguments[_0xdd6584]){_0x48d1c9[_0x4f7a('0xb')](arguments[_0xdd6584]);_0xdd6584++;}_0x52adb8=util[_0x4f7a('0xc')][_0x4f7a('0xd')](util,_0x48d1c9);this[_0x4f7a('0xe')]=_0x52adb8;this[_0x4f7a('0xf')]=_0x46b776;}module[_0x4f7a('0x10')]=AGIError; \ No newline at end of file +var _0x0137=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x8c3feb,_0x289f9c){var _0x142488=function(_0x235983){while(--_0x235983){_0x8c3feb['push'](_0x8c3feb['shift']());}};_0x142488(++_0x289f9c);}(_0x0137,0x157));var _0x7013=function(_0x53a167,_0x4bf6c7){_0x53a167=_0x53a167-0x0;var _0x150263=_0x0137[_0x53a167];return _0x150263;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x7013('0x0'),'E_AGI_ARGUMENT_PORT':_0x7013('0x1'),'E_AGI_SERVER_ERROR':_0x7013('0x2'),'E_AGI_SERVER_CLOSE':_0x7013('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7013('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x7013('0x5'),'E_AGI_SOCKET_CLOSE':_0x7013('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7013('0x7'),'E_AGI_IVR_ENTRY':_0x7013('0x8')};function AGIError(_0x4c80aa){var _0x4c80aa=_0x4c80aa||null,_0x2bf1f4=_0x2bf1f4||[],_0x22e717=0x1,_0x2cd4af='';if(!error[_0x4c80aa]){_0x4c80aa=_0x7013('0x9');}_0x2bf1f4[_0x7013('0xa')](error[_0x4c80aa]);while(arguments[_0x22e717]){_0x2bf1f4[_0x7013('0xa')](arguments[_0x22e717]);_0x22e717++;}_0x2cd4af=util['format'][_0x7013('0xb')](util,_0x2bf1f4);this[_0x7013('0xc')]=_0x2cd4af;this[_0x7013('0xd')]=_0x4c80aa;}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 f910dcf..2794093 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 _0x7d52=['menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','no\x20vertex\x20found','info','stop\x20traverse','length','condition','target','default','invalid','traverseBFS','agicommand','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','agi'];(function(_0x1b0e66,_0x552dce){var _0x43f2a8=function(_0x3b0bae){while(--_0x3b0bae){_0x1b0e66['push'](_0x1b0e66['shift']());}};_0x43f2a8(++_0x552dce);}(_0x7d52,0x103));var _0x27d5=function(_0x294ba7,_0x3f0ec7){_0x294ba7=_0x294ba7-0x0;var _0x3606b6=_0x7d52[_0x294ba7];return _0x3606b6;};'use strict';var _=require(_0x27d5('0x0'));var logger=require('../../../config/logger')(_0x27d5('0x1'));var verticesWithRetry=[_0x27d5('0x2'),_0x27d5('0x3'),_0x27d5('0x4')];var Graph=function(){this[_0x27d5('0x5')]={};this[_0x27d5('0x6')]={};this[_0x27d5('0x7')]=0x0;};Graph[_0x27d5('0x8')][_0x27d5('0x9')]=function(_0x351ed5){this['vertices'][_0x351ed5['id']]=_0x351ed5;this[_0x27d5('0x6')][_0x351ed5['id']]=[];};Graph[_0x27d5('0x8')][_0x27d5('0xa')]=function(_0x52e559,_0x9ebf65,_0x3dadc3){this['edges'][_0x52e559]['push']({'target':_0x9ebf65,'condition':_0x3dadc3});this[_0x27d5('0x7')]+=0x1;};Graph['prototype']['size']=function(){return _[_0x27d5('0xb')](this[_0x27d5('0x5')]);};Graph['prototype'][_0x27d5('0xc')]=function(){return this[_0x27d5('0x7')];};Graph[_0x27d5('0x8')][_0x27d5('0xd')]=function(_0x14bd49){return this[_0x27d5('0x5')][_0x14bd49];};Graph[_0x27d5('0x8')]['traverseBFS']=function(_0x5bec23,_0x2e7a36){if(!this[_0x27d5('0x5')][_0x5bec23]){return logger['info'](_0x27d5('0xe'));}var _0x2596a1=_0x2e7a36(this['vertices'][_0x5bec23]);if(!_0x2596a1){return logger[_0x27d5('0xf')](_0x27d5('0x10'));}if(this[_0x27d5('0x6')][_0x5bec23][_0x27d5('0x11')]===0x0){return logger[_0x27d5('0xf')]('no\x20edge/s\x20available');}for(var _0x2376d7=0x0,_0x1a1d84=[],_0x298aee=![];_0x2376d7\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','start','debug','joinAt','mxCell','calleridname','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','xml2json','util','moment','../../config/logger','../../config/license/util','./rpc','./mailRpc','agi','defaults','127.0.0.1','nextTick','error','stack','log','port','info','format','name','message','arg_1','dnid','uniqueid','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','omit','hasOwnProperty','isArray','length','source','target','addEdge'];(function(_0x3e5d7c,_0x3f1efd){var _0x39457b=function(_0x354943){while(--_0x354943){_0x3e5d7c['push'](_0x3e5d7c['shift']());}};_0x39457b(++_0x3f1efd);}(_0x6071,0x1bc));var _0x1607=function(_0x275621,_0x524302){_0x275621=_0x275621-0x0;var _0x2ad056=_0x6071[_0x275621];return _0x2ad056;};'use strict';var parser=require(_0x1607('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0x1607('0x1'));var moment=require(_0x1607('0x2'));var config=require('../../config/environment');var logger=require(_0x1607('0x3'))('agi');var utilLicense=require(_0x1607('0x4'));var rpc=require(_0x1607('0x5'));var mailRpc=require(_0x1607('0x6'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1607('0x7')]=_[_0x1607('0x8')](config[_0x1607('0x7')],{'ip':_0x1607('0x9'),'port':0x11dd});function connectionHandler(_0x534209){process[_0x1607('0xa')](function(){syncho(function(){try{setChannelVariables(_0x534209);agiHandler(_0x534209);}catch(_0x219f03){logger[_0x1607('0xb')](_0x219f03[_0x1607('0xc')]);}});});}function listeningHandler(){console[_0x1607('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x1607('0xe')]);logger[_0x1607('0xf')](util[_0x1607('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x1607('0x7')]['ip'],config[_0x1607('0x7')]['port']));}function errorHandler(_0x5ecd05){if(_0x5ecd05&&_0x5ecd05[_0x1607('0x11')]&&_0x5ecd05[_0x1607('0x12')]){logger[_0x1607('0xb')](util[_0x1607('0x10')]('[%s]\x20%s',_0x5ecd05[_0x1607('0x11')],_0x5ecd05[_0x1607('0x12')]));}else{logger[_0x1607('0xb')](util[_0x1607('0x10')]('[ERROR]\x20%s',_0x5ecd05[_0x1607('0xc')]));}}function closeHandler(){logger[_0x1607('0xf')](util[_0x1607('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1607('0x13')],this['calleridname'],this['callerid'],this[_0x1607('0x14')],this[_0x1607('0x15')]));try{createSquareReport(this);}catch(_0x5b2ca7){logger[_0x1607('0xb')](_0x5b2ca7[_0x1607('0xc')]);}}function timeoutHandler(){logger[_0x1607('0xf')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1607('0x13')],this['calleridname'],this[_0x1607('0x16')],this[_0x1607('0x14')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x1607('0x10')](_0x1607('0x17'),this[_0x1607('0x13')],this['calleridname'],this['callerid'],this[_0x1607('0x14')],this[_0x1607('0x15')]));this[_0x1607('0x18')]=!![];}function getRoot(_0x32b8f0){return parser[_0x1607('0x19')](_0x32b8f0,{'object':!![]})[_0x1607('0x1a')][_0x1607('0x1b')];}function addVertex(_0x191f05,_0x30f4f7,_0x5247bc){_0x30f4f7[_0x1607('0x1c')]=_0x5247bc;if(_0x30f4f7['hasOwnProperty']('retry')){_0x30f4f7['maxRetry']=parseInt(_0x30f4f7['retry'],0xa);}_0x191f05['addVertex'](_[_0x1607('0x1d')](_0x30f4f7,'mxCell'));}function initGraph(_0x3d2f7b,_0x217c12){var _0x2499a2=new Graph();for(var _0x25c900 in _0x3d2f7b){if(_0x3d2f7b[_0x1607('0x1e')](_0x25c900)){if(_[_0x1607('0x1f')](_0x3d2f7b[_0x25c900])){for(var _0x2eb091=0x0;_0x2eb091<_0x3d2f7b[_0x25c900][_0x1607('0x20')];_0x2eb091+=0x1){addVertex(_0x2499a2,_0x3d2f7b[_0x25c900][_0x2eb091],_0x25c900);}}else{addVertex(_0x2499a2,_0x3d2f7b[_0x25c900],_0x25c900);}}}for(var _0x552308=0x0;_0x552308<_0x217c12[_0x1607('0x20')];_0x552308+=0x1){if(_0x217c12[_0x552308][_0x1607('0x21')]&&_0x217c12[_0x552308][_0x1607('0x22')]){_0x2499a2[_0x1607('0x23')](_0x217c12[_0x552308]['source'],_0x217c12[_0x552308][_0x1607('0x22')],_0x217c12[_0x552308][_0x1607('0x24')]);}}return _0x2499a2;}function getSquareProject(_0x4761db,_0x2e1470){rpc[_0x1607('0x25')](_0x4761db)[_0x1607('0x26')](function(_0x4f587f){_0x2e1470(null,_0x4f587f);})[_0x1607('0x27')](function(_0x11e119){_0x2e1470(null,_0x11e119);});}function createSquareReport(_0x38179d,_0x220ea8){rpc[_0x1607('0x28')](_0x38179d)[_0x1607('0x26')](function(_0x51a943){if(_0x220ea8){_0x220ea8(null,_0x51a943);}})['catch'](function(_0x5169ff){if(_0x220ea8){_0x220ea8(null,_0x5169ff);}});}function setChannelVariables(_0x3c8c60){for(var _0x4cf160 in _0x3c8c60){if(_0x3c8c60[_0x1607('0x1e')](_0x4cf160)){if(_0x4cf160['indexOf'](_0x1607('0x29'))===0x0){_0x3c8c60[_0x4cf160[_0x1607('0x2a')](0x4)]=_0x3c8c60[_0x4cf160];delete _0x3c8c60[_0x4cf160];}}}}function getLogFromObject(_0x463bf5){return util[_0x1607('0x2b')](_0x463bf5,{'showHidden':![],'depth':null});}function agiHandler(_0x5399ab){var _0xfd4f64,_0x4a9316,_0x4563eb,_0x2f1a52,_0x4c5a13;logger['debug']('variables',JSON[_0x1607('0x2c')](_0x5399ab,null,0x2));logger[_0x1607('0xf')](util[_0x1607('0x10')](_0x1607('0x2d'),_0x5399ab['arg_1'],_0x5399ab['calleridname'],_0x5399ab['callerid'],_0x5399ab[_0x1607('0x14')],_0x5399ab['uniqueid']));_0x5399ab['on'](_0x1607('0xb'),errorHandler);_0x5399ab['on'](_0x1607('0x2e'),closeHandler);_0x5399ab['on']('timeout',timeoutHandler);_0x5399ab[_0x1607('0x18')]=![];_0x5399ab['on'](_0x1607('0x2f'),hangupHandler);var _0x406cc6=getSquareProject[_0x1607('0x30')](null,_0x5399ab[_0x1607('0x13')]);if(_0x406cc6){if(_0x406cc6[_0x1607('0x31')]){_0xfd4f64=getRoot(_0x406cc6[_0x1607('0x31')]);if(_0xfd4f64&&_0xfd4f64[_0x1607('0x32')]){logger[_0x1607('0x33')](_0x1607('0x1b'),JSON[_0x1607('0x2c')](_0xfd4f64,null,0x2));_0x5399ab[_0x1607('0x34')]=moment()[_0x1607('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a9316=initGraph(_['omit'](_0xfd4f64,_0x1607('0x35')),_0xfd4f64[_0x1607('0x35')]);_0x4563eb=new Vertices(_0x5399ab,rpc,mailRpc);logger[_0x1607('0xf')](util[_0x1607('0x10')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5399ab[_0x1607('0x13')],_0x5399ab[_0x1607('0x36')],_0x5399ab[_0x1607('0x16')],_0x5399ab['dnid'],_0x5399ab[_0x1607('0x15')]));_0x4a9316[_0x1607('0x37')](_0xfd4f64[_0x1607('0x32')]['id'],function(_0x260841){try{_0x260841=_0x4563eb[_0x1607('0x38')](_0x260841);logger[_0x1607('0x33')](_0x1607('0x39'),JSON[_0x1607('0x2c')](_0x260841,null,0x2));if(_0x260841['agicommand']===_0x1607('0x3a')){logger[_0x1607('0xf')](_0x1607('0x3b'));_0x5399ab[_0x1607('0x3c')]=_0x260841[_0x1607('0x3c')]||_0x5399ab[_0x1607('0x3c')];_0x5399ab[_0x1607('0x3d')]=_0x260841[_0x1607('0x3d')];_0x5399ab[_0x1607('0x3e')]=_0x260841[_0x1607('0x3e')]?_0x260841[_0x1607('0x3e')]-0x1:0x1;return null;}else if(_0x260841&&_0x4563eb[_0x260841[_0x1607('0x1c')]]){_0x4c5a13=_0x4563eb[_0x260841[_0x1607('0x1c')]](_0x260841);logger['info']('response',JSON[_0x1607('0x2c')](_0x4c5a13,null,0x2));if(_0x4c5a13&&_0x4c5a13['code']===AGI_CODE_SUCCESS&&_0x4c5a13[_0x1607('0x3f')]!==AGI_RESULT_ERROR&&!_0x5399ab[_0x1607('0x18')]){logger[_0x1607('0x33')](_0x1607('0x40'),getLogFromObject(_0x4c5a13));return _[_0x1607('0x41')](_0x4c5a13[_0x1607('0x3f')])?null:_0x4c5a13[_0x1607('0x3f')][_0x1607('0x42')]();}else{logger[_0x1607('0xb')](_0x1607('0x40'),getLogFromObject(_0x4c5a13));return null;}}else{logger[_0x1607('0xb')](_0x1607('0x43'));return null;}}catch(_0xa0889){logger[_0x1607('0xb')](_0xa0889['stack']);return null;}});if(_0xfd4f64['finally']){logger[_0x1607('0xf')](util[_0x1607('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5399ab['arg_1'],_0x5399ab[_0x1607('0x36')],_0x5399ab['callerid'],_0x5399ab[_0x1607('0x14')],_0x5399ab[_0x1607('0x15')]));_0x4a9316[_0x1607('0x37')](_0xfd4f64[_0x1607('0x44')]['id'],function(_0x3af30c){try{_0x3af30c=_0x4563eb[_0x1607('0x38')](_0x3af30c);logger[_0x1607('0x33')]('vertex',JSON[_0x1607('0x2c')](_0x3af30c,null,0x2));if(_0x3af30c&&_0x4563eb[_0x3af30c[_0x1607('0x1c')]]){_0x4c5a13=_0x4563eb[_0x3af30c[_0x1607('0x1c')]](_0x3af30c);if(_0x4c5a13){logger[_0x1607('0x33')](_0x1607('0x40'),getLogFromObject(_0x4c5a13));return _['isUndefined'](_0x4c5a13[_0x1607('0x3f')])?null:_0x4c5a13[_0x1607('0x3f')][_0x1607('0x42')]();}else{logger[_0x1607('0xb')](_0x1607('0x40'),getLogFromObject(_0x4c5a13));return null;}}else{logger[_0x1607('0xb')](_0x1607('0x43'));return null;}}catch(_0x2dc40c){logger['error'](_0x2dc40c[_0x1607('0xc')]);return null;}});}logger[_0x1607('0xf')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5399ab[_0x1607('0x13')],_0x5399ab['calleridname'],_0x5399ab[_0x1607('0x16')],_0x5399ab[_0x1607('0x14')],_0x5399ab[_0x1607('0x15')]));logger[_0x1607('0xf')](util[_0x1607('0x10')](_0x1607('0x45'),_0x5399ab['context'],_0x5399ab[_0x1607('0x3d')],parseInt(_0x5399ab[_0x1607('0x3e')],0xa)+0x1));_0x5399ab[_0x1607('0x46')](_0x5399ab[_0x1607('0x3c')],_0x5399ab['extension'],parseInt(_0x5399ab[_0x1607('0x3e')],0xa)+0x1);_0x5399ab[_0x1607('0x2e')]();}}else{logger['error'](util[_0x1607('0x10')]('Project\x20%s\x20not\x20published',_0x5399ab[_0x1607('0x13')]));_0x5399ab[_0x1607('0x46')](_0x5399ab['context'],_0x5399ab[_0x1607('0x3d')],parseInt(_0x5399ab[_0x1607('0x3e')],0xa)+0x1);_0x5399ab['close']();}}else{logger[_0x1607('0xb')](util[_0x1607('0x10')](_0x1607('0x47'),_0x5399ab[_0x1607('0x13')]));_0x5399ab['continueAt'](_0x5399ab[_0x1607('0x3c')],_0x5399ab[_0x1607('0x3d')],parseInt(_0x5399ab[_0x1607('0x3e')],0xa)+0x1);_0x5399ab[_0x1607('0x2e')]();}}function main(){var _0x488e5b;return utilLicense[_0x1607('0x48')]()[_0x1607('0x26')](function(_0x23551d){if(_0x23551d){if(_0x23551d[_0x1607('0x49')]){if(_0x23551d[_0x1607('0x4a')]&&_0x23551d[_0x1607('0x4a')]>0x0){logger[_0x1607('0xf')](util['format'](_0x1607('0x4b'),_0x23551d[_0x1607('0x4a')]));_0x488e5b=_0x23551d[_0x1607('0x4a')];}else{logger['info'](_0x1607('0x4c'));}}else{logger['info'](_0x1607('0x4d'));_0x488e5b=-0x1;}}})['catch'](function(_0x45f4f2){logger[_0x1607('0xb')](_0x1607('0x4e'),_0x45f4f2['stack']);})[_0x1607('0x44')](function(){var _0x16a2ba=require('./server')(config[_0x1607('0x7')]['port'],config[_0x1607('0x7')]['ip'],_0x488e5b);_0x16a2ba['on'](_0x1607('0xb'),errorHandler);_0x16a2ba['on'](_0x1607('0x4f'),listeningHandler);_0x16a2ba['on']('connection',connectionHandler);_0x16a2ba['on'](_0x1607('0x2e'),closeHandler);});}main(); \ No newline at end of file +var _0x5777=['[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/license/util','./graph','./vertices','agi','defaults','nextTick','error','stack','log','info','format','port','name','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','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','agicommand','maxRetry','addVertex','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','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','sync','production','start','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','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','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare'];(function(_0x34ae9e,_0x2e0550){var _0x2df069=function(_0xcaa67d){while(--_0xcaa67d){_0x34ae9e['push'](_0x34ae9e['shift']());}};_0x2df069(++_0x2e0550);}(_0x5777,0xbf));var _0x7577=function(_0x5b004f,_0xd4d052){_0x5b004f=_0x5b004f-0x0;var _0x3b42b3=_0x5777[_0x5b004f];return _0x3b42b3;};'use strict';var parser=require(_0x7577('0x0'));var _=require(_0x7577('0x1'));var syncho=require(_0x7577('0x2'));var util=require(_0x7577('0x3'));var moment=require(_0x7577('0x4'));var config=require(_0x7577('0x5'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x7577('0x6'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x7577('0x7'));var Vertices=require(_0x7577('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7577('0x9')]=_[_0x7577('0xa')](config[_0x7577('0x9')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x48dc51){process[_0x7577('0xb')](function(){syncho(function(){try{setChannelVariables(_0x48dc51);agiHandler(_0x48dc51);}catch(_0x12f7b8){logger[_0x7577('0xc')](_0x12f7b8[_0x7577('0xd')]);}});});}function listeningHandler(){console[_0x7577('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x7577('0x9')]['port']);logger[_0x7577('0xf')](util[_0x7577('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x7577('0x9')]['ip'],config['agi'][_0x7577('0x11')]));}function errorHandler(_0x4cfd72){if(_0x4cfd72&&_0x4cfd72[_0x7577('0x12')]&&_0x4cfd72[_0x7577('0x13')]){logger[_0x7577('0xc')](util[_0x7577('0x10')]('[%s]\x20%s',_0x4cfd72[_0x7577('0x12')],_0x4cfd72[_0x7577('0x13')]));}else{logger[_0x7577('0xc')](util[_0x7577('0x10')](_0x7577('0x14'),_0x4cfd72['stack']));}}function closeHandler(){logger[_0x7577('0xf')](util[_0x7577('0x10')](_0x7577('0x15'),this[_0x7577('0x16')],this['calleridname'],this[_0x7577('0x17')],this[_0x7577('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x441e7b){logger['error'](_0x441e7b[_0x7577('0xd')]);}}function timeoutHandler(){logger[_0x7577('0xf')](util[_0x7577('0x10')](_0x7577('0x19'),this[_0x7577('0x16')],this[_0x7577('0x1a')],this[_0x7577('0x17')],this[_0x7577('0x18')],this[_0x7577('0x1b')]));}function hangupHandler(){logger[_0x7577('0xf')](util[_0x7577('0x10')](_0x7577('0x1c'),this['arg_1'],this['calleridname'],this[_0x7577('0x17')],this[_0x7577('0x18')],this['uniqueid']));this[_0x7577('0x1d')]=!![];}function getRoot(_0x3319c2){return parser['toJson'](_0x3319c2,{'object':!![]})[_0x7577('0x1e')][_0x7577('0x1f')];}function addVertex(_0x2a7092,_0x291114,_0x382f90){_0x291114[_0x7577('0x20')]=_0x382f90;if(_0x291114['hasOwnProperty']('retry')){_0x291114[_0x7577('0x21')]=parseInt(_0x291114['retry'],0xa);}_0x2a7092[_0x7577('0x22')](_['omit'](_0x291114,_0x7577('0x23')));}function initGraph(_0x1cb550,_0xa42229){var _0x1e0104=new Graph();for(var _0x4f97b3 in _0x1cb550){if(_0x1cb550[_0x7577('0x24')](_0x4f97b3)){if(_[_0x7577('0x25')](_0x1cb550[_0x4f97b3])){for(var _0x158bba=0x0;_0x158bba<_0x1cb550[_0x4f97b3][_0x7577('0x26')];_0x158bba+=0x1){addVertex(_0x1e0104,_0x1cb550[_0x4f97b3][_0x158bba],_0x4f97b3);}}else{addVertex(_0x1e0104,_0x1cb550[_0x4f97b3],_0x4f97b3);}}}for(var _0x4b6dbc=0x0;_0x4b6dbc<_0xa42229[_0x7577('0x26')];_0x4b6dbc+=0x1){if(_0xa42229[_0x4b6dbc][_0x7577('0x27')]&&_0xa42229[_0x4b6dbc][_0x7577('0x28')]){_0x1e0104[_0x7577('0x29')](_0xa42229[_0x4b6dbc][_0x7577('0x27')],_0xa42229[_0x4b6dbc][_0x7577('0x28')],_0xa42229[_0x4b6dbc][_0x7577('0x2a')]);}}return _0x1e0104;}function getSquareProject(_0xaa58fb,_0x24f4d2){rpc[_0x7577('0x2b')](_0xaa58fb)['then'](function(_0x6dc86a){_0x24f4d2(null,_0x6dc86a);})[_0x7577('0x2c')](function(_0x171ed3){_0x24f4d2(null,_0x171ed3);});}function createSquareReport(_0x225083,_0x430ef2){rpc[_0x7577('0x2d')](_0x225083)[_0x7577('0x2e')](function(_0x4459b3){if(_0x430ef2){_0x430ef2(null,_0x4459b3);}})[_0x7577('0x2c')](function(_0x216011){if(_0x430ef2){_0x430ef2(null,_0x216011);}});}function setChannelVariables(_0x2920db){for(var _0x51e4cf in _0x2920db){if(_0x2920db[_0x7577('0x24')](_0x51e4cf)){if(_0x51e4cf[_0x7577('0x2f')](_0x7577('0x30'))===0x0){_0x2920db[_0x51e4cf[_0x7577('0x31')](0x4)]=_0x2920db[_0x51e4cf];delete _0x2920db[_0x51e4cf];}}}}function getLogFromObject(_0xb9c2a3){return util[_0x7577('0x32')](_0xb9c2a3,{'showHidden':![],'depth':null});}function agiHandler(_0xed28d9){var _0x2d71f4,_0x51c03c,_0x1b0238,_0x9e2895,_0xdf4dcd;logger[_0x7577('0x33')](_0x7577('0x34'),JSON[_0x7577('0x35')](_0xed28d9,null,0x2));logger['info'](util[_0x7577('0x10')](_0x7577('0x36'),_0xed28d9[_0x7577('0x16')],_0xed28d9['calleridname'],_0xed28d9[_0x7577('0x17')],_0xed28d9[_0x7577('0x18')],_0xed28d9['uniqueid']));_0xed28d9['on'](_0x7577('0xc'),errorHandler);_0xed28d9['on'](_0x7577('0x37'),closeHandler);_0xed28d9['on'](_0x7577('0x38'),timeoutHandler);_0xed28d9['evtHangup']=![];_0xed28d9['on'](_0x7577('0x39'),hangupHandler);var _0x38f34d=getSquareProject[_0x7577('0x3a')](null,_0xed28d9['arg_1']);if(_0x38f34d){if(_0x38f34d[_0x7577('0x3b')]){_0x2d71f4=getRoot(_0x38f34d[_0x7577('0x3b')]);if(_0x2d71f4&&_0x2d71f4[_0x7577('0x3c')]){logger[_0x7577('0x33')](_0x7577('0x1f'),JSON[_0x7577('0x35')](_0x2d71f4,null,0x2));_0xed28d9['joinAt']=moment()[_0x7577('0x10')](_0x7577('0x3d'));_0x51c03c=initGraph(_[_0x7577('0x3e')](_0x2d71f4,'mxCell'),_0x2d71f4[_0x7577('0x23')]);_0x1b0238=new Vertices(_0xed28d9,rpc,mailRpc);logger['info'](util[_0x7577('0x10')](_0x7577('0x3f'),_0xed28d9[_0x7577('0x16')],_0xed28d9['calleridname'],_0xed28d9[_0x7577('0x17')],_0xed28d9['dnid'],_0xed28d9['uniqueid']));_0x51c03c[_0x7577('0x40')](_0x2d71f4['start']['id'],function(_0xa36a62){try{_0xa36a62=_0x1b0238[_0x7577('0x41')](_0xa36a62);logger[_0x7577('0x33')]('vertex',JSON[_0x7577('0x35')](_0xa36a62,null,0x2));if(_0xa36a62[_0x7577('0x20')]==='gotoc'){logger['info'](_0x7577('0x42'));_0xed28d9[_0x7577('0x43')]=_0xa36a62['context']||_0xed28d9[_0x7577('0x43')];_0xed28d9[_0x7577('0x44')]=_0xa36a62['extension'];_0xed28d9[_0x7577('0x45')]=_0xa36a62[_0x7577('0x45')]?_0xa36a62[_0x7577('0x45')]-0x1:0x1;return null;}else if(_0xa36a62&&_0x1b0238[_0xa36a62[_0x7577('0x20')]]){_0xdf4dcd=_0x1b0238[_0xa36a62[_0x7577('0x20')]](_0xa36a62);logger[_0x7577('0xf')](_0x7577('0x46'),JSON['stringify'](_0xdf4dcd,null,0x2));if(_0xdf4dcd&&_0xdf4dcd[_0x7577('0x47')]===AGI_CODE_SUCCESS&&_0xdf4dcd[_0x7577('0x48')]!==AGI_RESULT_ERROR&&!_0xed28d9[_0x7577('0x1d')]){logger[_0x7577('0x33')](_0x7577('0x46'),getLogFromObject(_0xdf4dcd));return _[_0x7577('0x49')](_0xdf4dcd[_0x7577('0x48')])?null:_0xdf4dcd[_0x7577('0x48')][_0x7577('0x4a')]();}else{logger[_0x7577('0xc')]('response',getLogFromObject(_0xdf4dcd));return null;}}else{logger['error'](_0x7577('0x4b'));return null;}}catch(_0x34c038){logger[_0x7577('0xc')](_0x34c038[_0x7577('0xd')]);return null;}});if(_0x2d71f4[_0x7577('0x4c')]){logger['info'](util[_0x7577('0x10')](_0x7577('0x4d'),_0xed28d9['arg_1'],_0xed28d9[_0x7577('0x1a')],_0xed28d9[_0x7577('0x17')],_0xed28d9[_0x7577('0x18')],_0xed28d9[_0x7577('0x1b')]));_0x51c03c[_0x7577('0x40')](_0x2d71f4[_0x7577('0x4c')]['id'],function(_0x1e243b){try{_0x1e243b=_0x1b0238[_0x7577('0x41')](_0x1e243b);logger[_0x7577('0x33')](_0x7577('0x4e'),JSON[_0x7577('0x35')](_0x1e243b,null,0x2));if(_0x1e243b&&_0x1b0238[_0x1e243b[_0x7577('0x20')]]){_0xdf4dcd=_0x1b0238[_0x1e243b[_0x7577('0x20')]](_0x1e243b);if(_0xdf4dcd){logger[_0x7577('0x33')](_0x7577('0x46'),getLogFromObject(_0xdf4dcd));return _['isUndefined'](_0xdf4dcd[_0x7577('0x48')])?null:_0xdf4dcd['result']['toString']();}else{logger['error'](_0x7577('0x46'),getLogFromObject(_0xdf4dcd));return null;}}else{logger['error'](_0x7577('0x4b'));return null;}}catch(_0x487e02){logger['error'](_0x487e02[_0x7577('0xd')]);return null;}});}logger[_0x7577('0xf')](util[_0x7577('0x10')](_0x7577('0x4f'),_0xed28d9['arg_1'],_0xed28d9[_0x7577('0x1a')],_0xed28d9[_0x7577('0x17')],_0xed28d9[_0x7577('0x18')],_0xed28d9['uniqueid']));logger[_0x7577('0xf')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xed28d9[_0x7577('0x43')],_0xed28d9['extension'],parseInt(_0xed28d9['priority'],0xa)+0x1));_0xed28d9['continueAt'](_0xed28d9[_0x7577('0x43')],_0xed28d9[_0x7577('0x44')],parseInt(_0xed28d9[_0x7577('0x45')],0xa)+0x1);_0xed28d9['close']();}}else{logger[_0x7577('0xc')](util[_0x7577('0x10')](_0x7577('0x50'),_0xed28d9[_0x7577('0x16')]));_0xed28d9[_0x7577('0x51')](_0xed28d9[_0x7577('0x43')],_0xed28d9[_0x7577('0x44')],parseInt(_0xed28d9[_0x7577('0x45')],0xa)+0x1);_0xed28d9['close']();}}else{logger[_0x7577('0xc')](util[_0x7577('0x10')](_0x7577('0x52'),_0xed28d9[_0x7577('0x16')]));_0xed28d9[_0x7577('0x51')](_0xed28d9[_0x7577('0x43')],_0xed28d9[_0x7577('0x44')],parseInt(_0xed28d9[_0x7577('0x45')],0xa)+0x1);_0xed28d9['close']();}}function main(){var _0x27a414;return utilLicense[_0x7577('0x53')]()[_0x7577('0x2e')](function(_0x397023){if(_0x397023){if(_0x397023['voice']){if(_0x397023[_0x7577('0x54')]&&_0x397023['callysquare']>0x0){logger['info'](util[_0x7577('0x10')](_0x7577('0x55'),_0x397023[_0x7577('0x54')]));_0x27a414=_0x397023['callysquare'];}else{logger[_0x7577('0xf')](_0x7577('0x56'));}}else{logger['info'](_0x7577('0x57'));_0x27a414=-0x1;}}})['catch'](function(_0x5a4493){logger[_0x7577('0xc')](_0x7577('0x58'),_0x5a4493[_0x7577('0xd')]);})[_0x7577('0x4c')](function(){var _0x56de54=require(_0x7577('0x59'))(config['agi'][_0x7577('0x11')],config[_0x7577('0x9')]['ip'],_0x27a414);_0x56de54['on'](_0x7577('0xc'),errorHandler);_0x56de54['on'](_0x7577('0x5a'),listeningHandler);_0x56de54['on'](_0x7577('0x5b'),connectionHandler);_0x56de54['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index cb6ebd6..d876130 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 _0xc0f3=['error','result','catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then'];(function(_0x422641,_0x46b4ce){var _0xd1c3af=function(_0x15d391){while(--_0x15d391){_0x422641['push'](_0x422641['shift']());}};_0xd1c3af(++_0x46b4ce);}(_0xc0f3,0x1e5));var _0x3c0f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc0f3[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x3c0f('0x0'));var client=jayson[_0x3c0f('0x1')][_0x3c0f('0x2')]({'port':0x232b});function request(_0x39e472,_0x115558){return new BPromise(function(_0x297e93,_0x4e30f0){return client[_0x3c0f('0x3')](_0x39e472,_0x115558)[_0x3c0f('0x4')](function(_0x30dfc8){if(_0x30dfc8[_0x3c0f('0x5')]){return _0x4e30f0(_0x30dfc8[_0x3c0f('0x5')]['message']);}else{return _0x297e93(_0x30dfc8[_0x3c0f('0x6')]);}})[_0x3c0f('0x7')](function(_0x2b5572){return _0x4e30f0(_0x2b5572);});});}exports[_0x3c0f('0x8')]=function(_0x3998f8,_0x32baa7){return request(_0x3c0f('0x9'),{'account':_0x3998f8,'message':_0x32baa7});}; \ No newline at end of file +var _0x429a=['bluebird','jayson/promise','http','request','error','message','result','sendMailMessage','SendMail'];(function(_0x185127,_0x55eef7){var _0xf0fbff=function(_0x55c01a){while(--_0x55c01a){_0x185127['push'](_0x185127['shift']());}};_0xf0fbff(++_0x55eef7);}(_0x429a,0xd8));var _0xa429=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0x429a[_0x349a9e];return _0x24c207;};'use strict';var BPromise=require(_0xa429('0x0'));var jayson=require(_0xa429('0x1'));var client=jayson['client'][_0xa429('0x2')]({'port':0x232b});function request(_0x22ffbe,_0x43f0c0){return new BPromise(function(_0x4290c8,_0x16f142){return client[_0xa429('0x3')](_0x22ffbe,_0x43f0c0)['then'](function(_0x2d4d42){if(_0x2d4d42['error']){return _0x16f142(_0x2d4d42[_0xa429('0x4')][_0xa429('0x5')]);}else{return _0x4290c8(_0x2d4d42[_0xa429('0x6')]);}})['catch'](function(_0x75566d){return _0x16f142(_0x75566d);});});}exports[_0xa429('0x7')]=function(_0x40f61,_0x3a5701){return request(_0xa429('0x8'),{'account':_0x40f61,'message':_0x3a5701});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index d220979..b0d3da5 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 _0xa883=['trim','length','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','slice'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0xa883,0x1f2));var _0x3a88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa883[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3a88('0x0'));var Transform=require(_0x3a88('0x1'))[_0x3a88('0x2')];function AGIReply(_0x1cc724){Transform[_0x3a88('0x3')](this,_0x1cc724);this[_0x3a88('0x4')]='';this[_0x3a88('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x3a88('0x6')]=function(_0x30e6bc,_0x5b4e04,_0x21f120){var _0x23a4c0='\x0a',_0x12d2bc=['\x0a\x0a',_0x3a88('0x7')],_0x41496b=-0x1,_0x37ca80=-0x1,_0x132a5a='',_0x51d6cb=0x0,_0xc2ff5a='',_0xc7797b='';this[_0x3a88('0x4')]+=_0x30e6bc[_0x3a88('0x8')]();_0xc2ff5a=this['_localBuffer'];if(!this[_0x3a88('0x5')]){_0x51d6cb=0x0;while(_0x12d2bc[_0x51d6cb]){while((_0x37ca80=_0xc2ff5a[_0x3a88('0x9')](_0x12d2bc[_0x51d6cb]))!=-0x1){_0x132a5a=_0x12d2bc[_0x51d6cb];_0xc7797b=_0xc2ff5a[_0x3a88('0xa')](0x0,_0x37ca80);_0xc2ff5a=_0xc2ff5a[_0x3a88('0xa')](_0x37ca80+_0x132a5a['length']);var _0x4b255f=_0xc7797b['split'](_0x23a4c0),_0x3864dd=0x0,_0x59a97c={},_0x5d142a='',_0x14a4b0='',_0x1b3b6f=-0x1;while(_0x4b255f[_0x3864dd]){_0x1b3b6f=_0x4b255f[_0x3864dd][_0x3a88('0x9')](':');if(_0x1b3b6f!=-0x1){_0x5d142a=_0x4b255f[_0x3864dd][_0x3a88('0xb')](0x0,_0x1b3b6f)[_0x3a88('0xc')]();_0x14a4b0=_0x4b255f[_0x3864dd][_0x3a88('0xb')](_0x1b3b6f+0x1)[_0x3a88('0xc')]();if(_0x5d142a[_0x3a88('0xd')]>0x0){_0x59a97c[_0x5d142a]=_0x14a4b0;}}else{}_0x3864dd++;}this[_0x3a88('0xe')]('headers',_0x59a97c);this[_0x3a88('0x5')]=!![];}_0x51d6cb++;}this[_0x3a88('0x4')]=_0xc2ff5a;}else{while((_0x41496b=_0xc2ff5a[_0x3a88('0x9')](_0x23a4c0))!=-0x1){_0xc7797b=_0xc2ff5a[_0x3a88('0xa')](0x0,_0x41496b);this['emit'](_0x3a88('0xf'),_0xc7797b);_0xc2ff5a=_0xc2ff5a[_0x3a88('0xa')](_0x41496b+_0x23a4c0[_0x3a88('0xd')]);}this[_0x3a88('0x4')]=_0xc2ff5a;}_0x21f120();};module[_0x3a88('0x10')]=AGIReply; \ No newline at end of file +var _0x1ca7=['emit','headers','line','util','stream','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim'];(function(_0x503511,_0x454c89){var _0x490877=function(_0x146974){while(--_0x146974){_0x503511['push'](_0x503511['shift']());}};_0x490877(++_0x454c89);}(_0x1ca7,0x157));var _0x71ca=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1ca7[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require(_0x71ca('0x0'));var Transform=require(_0x71ca('0x1'))['Transform'];function AGIReply(_0x53ce28){Transform['call'](this,_0x53ce28);this[_0x71ca('0x2')]='';this[_0x71ca('0x3')]=![];}util[_0x71ca('0x4')](AGIReply,Transform);AGIReply['prototype'][_0x71ca('0x5')]=function(_0x3b6cbf,_0x58f288,_0x58c4a5){var _0x3ebc2f='\x0a',_0x2d5d49=['\x0a\x0a',_0x71ca('0x6')],_0x31444d=-0x1,_0xa06a89=-0x1,_0x4f25f6='',_0x378012=0x0,_0x41ca0a='',_0x59f41c='';this[_0x71ca('0x2')]+=_0x3b6cbf[_0x71ca('0x7')]();_0x41ca0a=this['_localBuffer'];if(!this[_0x71ca('0x3')]){_0x378012=0x0;while(_0x2d5d49[_0x378012]){while((_0xa06a89=_0x41ca0a[_0x71ca('0x8')](_0x2d5d49[_0x378012]))!=-0x1){_0x4f25f6=_0x2d5d49[_0x378012];_0x59f41c=_0x41ca0a[_0x71ca('0x9')](0x0,_0xa06a89);_0x41ca0a=_0x41ca0a[_0x71ca('0x9')](_0xa06a89+_0x4f25f6[_0x71ca('0xa')]);var _0x3d5a28=_0x59f41c[_0x71ca('0xb')](_0x3ebc2f),_0x5df2cd=0x0,_0x1d92d6={},_0x1654d3='',_0x4da234='',_0x230345=-0x1;while(_0x3d5a28[_0x5df2cd]){_0x230345=_0x3d5a28[_0x5df2cd][_0x71ca('0x8')](':');if(_0x230345!=-0x1){_0x1654d3=_0x3d5a28[_0x5df2cd][_0x71ca('0xc')](0x0,_0x230345)[_0x71ca('0xd')]();_0x4da234=_0x3d5a28[_0x5df2cd][_0x71ca('0xc')](_0x230345+0x1)[_0x71ca('0xd')]();if(_0x1654d3[_0x71ca('0xa')]>0x0){_0x1d92d6[_0x1654d3]=_0x4da234;}}else{}_0x5df2cd++;}this[_0x71ca('0xe')](_0x71ca('0xf'),_0x1d92d6);this['_inBody']=!![];}_0x378012++;}this['_localBuffer']=_0x41ca0a;}else{while((_0x31444d=_0x41ca0a[_0x71ca('0x8')](_0x3ebc2f))!=-0x1){_0x59f41c=_0x41ca0a['substring'](0x0,_0x31444d);this[_0x71ca('0xe')](_0x71ca('0x10'),_0x59f41c);_0x41ca0a=_0x41ca0a['substring'](_0x31444d+_0x3ebc2f['length']);}this[_0x71ca('0x2')]=_0x41ca0a;}_0x58c4a5();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index d9c74e3..c45fd32 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 _0xd9d2=['ShowTrunk','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','util','jayson/promise','client','http','request','then','error','result','catch','getSquareProject','getMailAccountById','MailServerOut','Smtp','name','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser'];(function(_0x3789cb,_0x1c79c8){var _0x202624=function(_0x177c30){while(--_0x177c30){_0x3789cb['push'](_0x3789cb['shift']());}};_0x202624(++_0x1c79c8);}(_0xd9d2,0xf1));var _0x2d9d=function(_0x433a5c,_0x3aed4){_0x433a5c=_0x433a5c-0x0;var _0x346a70=_0xd9d2[_0x433a5c];return _0x346a70;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x2d9d('0x0'));var util=require(_0x2d9d('0x1'));var jayson=require(_0x2d9d('0x2'));var client=jayson[_0x2d9d('0x3')][_0x2d9d('0x4')]({'port':0x2329});function request(_0x53c794,_0x31d1ee){return new BPromise(function(_0xefc39f,_0xec9440){return client[_0x2d9d('0x5')](_0x53c794,_0x31d1ee)[_0x2d9d('0x6')](function(_0x26ff05){if(_0x26ff05['error']){return _0xec9440(_0x26ff05[_0x2d9d('0x7')]['message']);}else{return _0xefc39f(_0x26ff05[_0x2d9d('0x8')]);}})[_0x2d9d('0x9')](function(_0x34944e){return _0xec9440(_0x34944e);});});}exports[_0x2d9d('0xa')]=function(_0xcc0541){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xcc0541},'attributes':['production']}});};exports[_0x2d9d('0xb')]=function(_0x46056c){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x46056c},'include':[{'model':_0x2d9d('0xc'),'as':_0x2d9d('0xd')}],'attributes':['id',_0x2d9d('0xe'),'email']}});};exports['getSquareProjectById']=function(_0x3b2386){return request(_0x2d9d('0xf'),{'options':{'where':{'id':_0x3b2386},'attributes':['name']}});};exports[_0x2d9d('0x10')]=function(_0x473da3){return request(_0x2d9d('0x11'),{'options':{'where':{'id':_0x473da3},'attributes':['name']}});};exports[_0x2d9d('0x12')]=function(_0x228942){return request(_0x2d9d('0x13'),{'options':{'where':{'id':_0x228942},'attributes':[_0x2d9d('0xe')]}});};exports['getSquareOdbcById']=function(_0x47fab2){return request(_0x2d9d('0x14'),{'options':{'where':{'id':_0x47fab2},'attributes':[_0x2d9d('0x15')]}});};exports[_0x2d9d('0x16')]=function(_0x70bd53){return request(_0x2d9d('0x17'),{'options':{'where':{'id':_0x70bd53},'attributes':[_0x2d9d('0xe')]}});};exports['getTrunkById']=function(_0x5e3d36){return request(_0x2d9d('0x18'),{'options':{'where':{'id':_0x5e3d36},'attributes':[_0x2d9d('0xe')]}});};exports['getSoundById']=function(_0x54f1a6){return request('ShowSound',{'options':{'where':{'id':_0x54f1a6},'attributes':[_0x2d9d('0x19')]}});};exports[_0x2d9d('0x1a')]=function(_0x2a11ce){return request(_0x2d9d('0x1b'),{'options':{'raw':![],'where':{'id':_0x2a11ce},'include':[{'model':_0x2d9d('0x1c'),'as':'Intervals'}]}});};exports[_0x2d9d('0x1d')]=function(_0x5890d2){return request(_0x2d9d('0x1e'),{'options':{'where':{'id':_0x5890d2},'attributes':['id',_0x2d9d('0xe')]}});};exports['createSmsMessage']=function(_0x394144){return request(_0x2d9d('0x1f'),{'body':_0x394144});};exports[_0x2d9d('0x20')]=function(_0x41fda0){return request('CreateSquareDetailsReport',{'body':_0x41fda0});};exports['createSquareReport']=function(_0x4ee3ce){return request('CreateSquareReport',{'body':_[_0x2d9d('0x21')](_0x4ee3ce,{'project_name':_0x4ee3ce[_0x2d9d('0x22')],'prev_project_name':_0x4ee3ce['arg_2']||'','is_subproject':_0x4ee3ce[_0x2d9d('0x23')]?!![]:![],'leaveAt':moment()[_0x2d9d('0x24')](_0x2d9d('0x25'))})});};exports[_0x2d9d('0x26')]=function(_0x3c5491){return request(_0x2d9d('0x27'),{'body':_0x3c5491});};exports[_0x2d9d('0x28')]=function(_0x3f8314){return request('CreateSquareMessage',{'body':_0x3f8314});};exports[_0x2d9d('0x29')]=function(_0x279b38){return request(_0x2d9d('0x2a'),{'options':{'raw':![],'where':{'phone':_0x279b38[_0x2d9d('0x2b')],'ListId':_0x279b38['ListId']}}})[_0x2d9d('0x6')](function(_0x812d4c){if(_0x812d4c){return _0x812d4c;}return request(_0x2d9d('0x2c'),{'body':_0x279b38});});};exports[_0x2d9d('0x2d')]=function(_0x2557fa){return request(_0x2d9d('0x2e'),{'options':{'where':{'id':_0x2557fa},'attributes':[_0x2d9d('0xe')]}});};exports[_0x2d9d('0x2f')]=function(_0x90c02c,_0x2362b3){return request('LoginUser',{'body':{'interface':_0x2362b3},'options':{'where':_0x90c02c}});};exports[_0x2d9d('0x30')]=function(_0x3abe21,_0x42dd75,_0x5d679f){return request(_0x2d9d('0x31'),{'body':{'type':_0x42dd75,'uniqueid':_0x5d679f},'options':{'where':_0x3abe21}});};exports[_0x2d9d('0x32')]=function(_0x188f8c){return request(_0x2d9d('0x33'),{'body':{},'options':{'where':_0x188f8c}});};exports[_0x2d9d('0x34')]=function(_0x4a98a0){return request('LogoutUser',{'body':{},'options':{'where':_0x4a98a0}});}; \ No newline at end of file +var _0x2c8e=['getTrunkById','ShowTrunk','ShowSound','Intervals','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','then','error','message','result','production','getMailAccountById','ShowMailAccount','Smtp','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowSquareOdbc','ShowUser'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0x2c8e,0x97));var _0xe2c8=function(_0xf94684,_0x1411a1){_0xf94684=_0xf94684-0x0;var _0x58f7ef=_0x2c8e[_0xf94684];return _0x58f7ef;};'use strict';var BPromise=require(_0xe2c8('0x0'));var moment=require('moment');var _=require(_0xe2c8('0x1'));var util=require(_0xe2c8('0x2'));var jayson=require(_0xe2c8('0x3'));var client=jayson[_0xe2c8('0x4')][_0xe2c8('0x5')]({'port':0x2329});function request(_0x377c1d,_0x56b308){return new BPromise(function(_0x246ea3,_0x20c91b){return client['request'](_0x377c1d,_0x56b308)[_0xe2c8('0x6')](function(_0x471698){if(_0x471698[_0xe2c8('0x7')]){return _0x20c91b(_0x471698['error'][_0xe2c8('0x8')]);}else{return _0x246ea3(_0x471698[_0xe2c8('0x9')]);}})['catch'](function(_0x33af1f){return _0x20c91b(_0x33af1f);});});}exports['getSquareProject']=function(_0x312cc0){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x312cc0},'attributes':[_0xe2c8('0xa')]}});};exports[_0xe2c8('0xb')]=function(_0x111e78){return request(_0xe2c8('0xc'),{'options':{'raw':![],'where':{'id':_0x111e78},'include':[{'model':'MailServerOut','as':_0xe2c8('0xd')}],'attributes':['id',_0xe2c8('0xe'),_0xe2c8('0xf')]}});};exports['getSquareProjectById']=function(_0x137579){return request(_0xe2c8('0x10'),{'options':{'where':{'id':_0x137579},'attributes':[_0xe2c8('0xe')]}});};exports[_0xe2c8('0x11')]=function(_0x40836d){return request(_0xe2c8('0x12'),{'options':{'where':{'id':_0x40836d},'attributes':['name']}});};exports['getVariableById']=function(_0x46cb3f){return request('ShowVariable',{'options':{'where':{'id':_0x46cb3f},'attributes':[_0xe2c8('0xe')]}});};exports['getSquareOdbcById']=function(_0x4602f1){return request(_0xe2c8('0x13'),{'options':{'where':{'id':_0x4602f1},'attributes':['dsn']}});};exports['getUserById']=function(_0x1dc14e){return request(_0xe2c8('0x14'),{'options':{'where':{'id':_0x1dc14e},'attributes':['name']}});};exports[_0xe2c8('0x15')]=function(_0x20b1b7){return request(_0xe2c8('0x16'),{'options':{'where':{'id':_0x20b1b7},'attributes':[_0xe2c8('0xe')]}});};exports['getSoundById']=function(_0x195259){return request(_0xe2c8('0x17'),{'options':{'where':{'id':_0x195259},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x50422e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x50422e},'include':[{'model':'Interval','as':_0xe2c8('0x18')}]}});};exports['getSmsAccountById']=function(_0x1e2ffe){return request(_0xe2c8('0x19'),{'options':{'where':{'id':_0x1e2ffe},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x442fd2){return request('CreateSmsMessage',{'body':_0x442fd2});};exports[_0xe2c8('0x1a')]=function(_0x4f0770){return request(_0xe2c8('0x1b'),{'body':_0x4f0770});};exports[_0xe2c8('0x1c')]=function(_0x2c399a){return request(_0xe2c8('0x1d'),{'body':_[_0xe2c8('0x1e')](_0x2c399a,{'project_name':_0x2c399a['arg_1'],'prev_project_name':_0x2c399a['arg_2']||'','is_subproject':_0x2c399a['arg_2']?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x59ec32){return request('CreateSquareRecording',{'body':_0x59ec32});};exports[_0xe2c8('0x1f')]=function(_0x5a32ab){return request(_0xe2c8('0x20'),{'body':_0x5a32ab});};exports[_0xe2c8('0x21')]=function(_0x5bfe35){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5bfe35[_0xe2c8('0x22')],'ListId':_0x5bfe35[_0xe2c8('0x23')]}}})[_0xe2c8('0x6')](function(_0x2855d4){if(_0x2855d4){return _0x2855d4;}return request('CreateCmContact',{'body':_0x5bfe35});});};exports[_0xe2c8('0x24')]=function(_0x28707f){return request(_0xe2c8('0x25'),{'options':{'where':{'id':_0x28707f},'attributes':[_0xe2c8('0xe')]}});};exports[_0xe2c8('0x26')]=function(_0x18d5a6,_0x37b1f0){return request('LoginUser',{'body':{'interface':_0x37b1f0},'options':{'where':_0x18d5a6}});};exports[_0xe2c8('0x27')]=function(_0x7787f,_0x2c310c,_0x9d0fa6){return request(_0xe2c8('0x28'),{'body':{'type':_0x2c310c,'uniqueid':_0x9d0fa6},'options':{'where':_0x7787f}});};exports[_0xe2c8('0x29')]=function(_0x19edd2){return request('UnpauseUser',{'body':{},'options':{'where':_0x19edd2}});};exports['agentLogout']=function(_0x45af5a){return request(_0xe2c8('0x2a'),{'body':{},'options':{'where':_0x45af5a}});}; \ 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 e9f36f9..8347fc4 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 _0x9865=['exports','./polly','./lex'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9865,0x1ba));var _0x5986=function(_0x35a5cd,_0x497d7b){_0x35a5cd=_0x35a5cd-0x0;var _0x5e1c9c=_0x9865[_0x35a5cd];return _0x5e1c9c;};var polly=require(_0x5986('0x0'));var lex=require(_0x5986('0x1'));module[_0x5986('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xe2fe=['./polly'];(function(_0x1f6b14,_0x57183d){var _0x31aca3=function(_0x45566c){while(--_0x45566c){_0x1f6b14['push'](_0x1f6b14['shift']());}};_0x31aca3(++_0x57183d);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};var polly=require(_0xee2f('0x0'));var lex=require('./lex');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 ce4f133..1273693 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55e0=['./lib/api','exports'];(function(_0x534c57,_0x466ed9){var _0x437808=function(_0x4d2859){while(--_0x4d2859){_0x534c57['push'](_0x534c57['shift']());}};_0x437808(++_0x466ed9);}(_0x55e0,0xdc));var _0x055e=function(_0x420f5e,_0x1c2810){_0x420f5e=_0x420f5e-0x0;var _0x18d1c7=_0x55e0[_0x420f5e];return _0x18d1c7;};'use strict';var lex=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5){return lex(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 4acd689..2d66689 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(_0xde3989,_0x2115a1){var _0x1a4a2f=function(_0x329b18){while(--_0x329b18){_0xde3989['push'](_0xde3989['shift']());}};_0x1a4a2f(++_0x2115a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0xe878a9,_0x4a2563){var _0x3bff68=function(_0x1068ba){while(--_0x1068ba){_0xe878a9['push'](_0xe878a9['shift']());}};_0x3bff68(++_0x4a2563);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 60531e7..5a46811 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 _0x8e60=['./lib/api','exports'];(function(_0x3778ec,_0x447da3){var _0x59ccd8=function(_0x4a796f){while(--_0x4a796f){_0x3778ec['push'](_0x3778ec['shift']());}};_0x59ccd8(++_0x447da3);}(_0x8e60,0x176));var _0x08e6=function(_0x35f78d,_0x91ac69){_0x35f78d=_0x35f78d-0x0;var _0x2e6772=_0x8e60[_0x35f78d];return _0x2e6772;};'use strict';var polly=require(_0x08e6('0x0'));module[_0x08e6('0x1')]=function(_0x56e73b,_0x3b8fe1,_0x7ae8cf,_0x7c6ea3,_0x4356b3,_0x4b2bd0,_0x43373e){return polly(_0x56e73b,_0x3b8fe1,_0x7ae8cf,_0x7c6ea3,_0x4356b3,_0x4b2bd0,_0x43373e);}; \ No newline at end of file +var _0x1a63=['./lib/api','exports'];(function(_0x3b812b,_0xfae437){var _0x45993d=function(_0x257a2d){while(--_0x257a2d){_0x3b812b['push'](_0x3b812b['shift']());}};_0x45993d(++_0xfae437);}(_0x1a63,0x1a2));var _0x31a6=function(_0x2a8c5c,_0x570e0b){_0x2a8c5c=_0x2a8c5c-0x0;var _0x333591=_0x1a63[_0x2a8c5c];return _0x333591;};'use strict';var polly=require(_0x31a6('0x0'));module[_0x31a6('0x1')]=function(_0x26a12c,_0x182585,_0xf8fc9e,_0x3ef5ec,_0x2326ae,_0x34beba,_0x1049de){return polly(_0x26a12c,_0x182585,_0xf8fc9e,_0x3ef5ec,_0x2326ae,_0x34beba,_0x1049de);}; \ 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 cfbde48..93cabc6 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 _0x95fb=['Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x461ae5,_0xd92bcb){var _0xf28a90=function(_0x320e19){while(--_0x320e19){_0x461ae5['push'](_0x461ae5['shift']());}};_0xf28a90(++_0xd92bcb);}(_0x95fb,0x1d7));var _0xb95f=function(_0x49d010,_0x5982){_0x49d010=_0x49d010-0x0;var _0x1acbf6=_0x95fb[_0x49d010];return _0x1acbf6;};'use strict';var fs=require('fs');var path=require(_0xb95f('0x0'));var BPromise=require(_0xb95f('0x1'));var rs=require(_0xb95f('0x2'));var AWS=require(_0xb95f('0x3'));function pollyResult(_0x47a88a,_0x133eff,_0xe78b12){return new BPromise(function(_0x1dbefe,_0x3b2bea){_0x47a88a[_0xb95f('0x4')](_0x133eff,function(_0x2cc2fb,_0x5bb7fc){if(_0x2cc2fb){_0x3b2bea(_0x2cc2fb);}else if(_0x5bb7fc){if(_0x5bb7fc[_0xb95f('0x5')]instanceof Buffer){fs[_0xb95f('0x6')](_0xe78b12,_0x5bb7fc[_0xb95f('0x5')],function(_0x3d6a6b){if(_0x3d6a6b){_0x3b2bea(_0x3d6a6b);}else{_0x1dbefe();}});}else{_0x3b2bea(new Error(_0xb95f('0x7')));}}else{_0x3b2bea(new Error(_0xb95f('0x8')));}});});}module[_0xb95f('0x9')]=function(_0x3bb767,_0x1ce8bd,_0x1068f2,_0x399dfb,_0x2efc52,_0x403284,_0x439c5a){var _0x134643=new AWS[(_0xb95f('0xa'))]({'accessKeyId':_0x3bb767,'secretAccessKey':_0x1ce8bd,'region':_0x1068f2});var _0x1a9eae={'Text':_0x2efc52,'TextType':_0x403284||_0xb95f('0xb'),'OutputFormat':_0xb95f('0xc'),'VoiceId':_0x399dfb};return pollyResult(_0x134643,_0x1a9eae,_0x439c5a);}; \ No newline at end of file +var _0x76df=['exports','text','mp3','bluebird','randomstring','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x519376,_0x5f538b){var _0xd413e=function(_0x392331){while(--_0x392331){_0x519376['push'](_0x519376['shift']());}};_0xd413e(++_0x5f538b);}(_0x76df,0x11b));var _0xf76d=function(_0x45385c,_0x840419){_0x45385c=_0x45385c-0x0;var _0x523eb1=_0x76df[_0x45385c];return _0x523eb1;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xf76d('0x0'));var rs=require(_0xf76d('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x398ff5,_0xa65d08,_0x322df8){return new BPromise(function(_0xd53114,_0x7c79ff){_0x398ff5['synthesizeSpeech'](_0xa65d08,function(_0x5e3076,_0x283bcc){if(_0x5e3076){_0x7c79ff(_0x5e3076);}else if(_0x283bcc){if(_0x283bcc['AudioStream']instanceof Buffer){fs[_0xf76d('0x2')](_0x322df8,_0x283bcc[_0xf76d('0x3')],function(_0x23bd40){if(_0x23bd40){_0x7c79ff(_0x23bd40);}else{_0xd53114();}});}else{_0x7c79ff(new Error(_0xf76d('0x4')));}}else{_0x7c79ff(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xf76d('0x5')]=function(_0x32a3dd,_0x4506eb,_0x3dd2e0,_0x2b1f54,_0x31aae2,_0x40f0d6,_0xf1f95b){var _0x295e4d=new AWS['Polly']({'accessKeyId':_0x32a3dd,'secretAccessKey':_0x4506eb,'region':_0x3dd2e0});var _0x15b8d2={'Text':_0x31aae2,'TextType':_0x40f0d6||_0xf76d('0x6'),'OutputFormat':_0xf76d('0x7'),'VoiceId':_0x2b1f54};return pollyResult(_0x295e4d,_0x15b8d2,_0xf1f95b);}; \ 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 534fcd0..798e6a4 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 _0xf9cd=['exports','./lib/api'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xf9cd,0x16b));var _0xdf9c=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xf9cd[_0x1b2ff7];return _0x31656a;};'use strict';var asr=require(_0xdf9c('0x0'));module[_0xdf9c('0x1')]=function(_0x3bc854,_0x2609da,_0x2c13c1,_0x22a41c){return asr(_0x3bc854,_0x2609da,_0x2c13c1);}; \ No newline at end of file +var _0x3dc1=['./lib/api'];(function(_0x4a8e2e,_0x2dab17){var _0x419372=function(_0x1bba3f){while(--_0x1bba3f){_0x4a8e2e['push'](_0x4a8e2e['shift']());}};_0x419372(++_0x2dab17);}(_0x3dc1,0x1d5));var _0x13dc=function(_0x2ee869,_0x1817bf){_0x2ee869=_0x2ee869-0x0;var _0x3c76c2=_0x3dc1[_0x2ee869];return _0x3c76c2;};'use strict';var asr=require(_0x13dc('0x0'));module['exports']=function(_0x478c80,_0x4480d4,_0x2384bc,_0x1b8f07){return asr(_0x478c80,_0x4480d4,_0x2384bc);}; \ 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 f7c4dd3..2645b5c 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 _0x2209=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','LINEAR16','8000','url'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2209,0x95));var _0x9220=function(_0xbb5203,_0x25d527){_0xbb5203=_0xbb5203-0x0;var _0x5ef134=_0x2209[_0xbb5203];return _0x5ef134;};'use strict';var url=require(_0x9220('0x0'));var BPromise=require(_0x9220('0x1'));var fs=require('fs');var host=_0x9220('0x2');module[_0x9220('0x3')]=function(_0x29dc9b,_0x5d3fe2,_0x2b23aa){return new BPromise(function(_0x5cc72c,_0x348220){var _0x2fddae;if(typeof _0x29dc9b!==_0x9220('0x4')||_0x29dc9b[_0x9220('0x5')]===0x0){return _0x348220(_0x9220('0x6'));}if(typeof _0x5d3fe2!==_0x9220('0x4')||_0x5d3fe2[_0x9220('0x5')]===0x0){return _0x348220(_0x9220('0x7'));}if(typeof _0x2b23aa!==_0x9220('0x8')&&(typeof _0x2b23aa!=='string'||_0x2b23aa[_0x9220('0x5')]===0x0)){return _0x348220(_0x9220('0x9'));}try{_0x2fddae=fs['readFileSync'](_0x29dc9b)[_0x9220('0xa')](_0x9220('0xb'));}catch(_0x18550a){return _0x348220(_0x18550a);}return _0x5cc72c({'method':_0x9220('0xc'),'uri':host+'/v1/speech:recognize?key='+_0x5d3fe2,'body':{'config':{'encoding':_0x9220('0xd'),'sampleRateHertz':_0x9220('0xe'),'languageCode':_0x2b23aa},'audio':{'content':_0x2fddae}},'json':!![]});});}; \ No newline at end of file +var _0x16d2=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x375a25,_0x21acb3){var _0x426e40=function(_0x2c50f4){while(--_0x2c50f4){_0x375a25['push'](_0x375a25['shift']());}};_0x426e40(++_0x21acb3);}(_0x16d2,0x123));var _0x216d=function(_0x486eff,_0x5cb3b0){_0x486eff=_0x486eff-0x0;var _0x95293b=_0x16d2[_0x486eff];return _0x95293b;};'use strict';var url=require(_0x216d('0x0'));var BPromise=require(_0x216d('0x1'));var fs=require('fs');var host=_0x216d('0x2');module[_0x216d('0x3')]=function(_0x1688cc,_0x3a2589,_0x34cf5b){return new BPromise(function(_0x239b49,_0xfd7306){var _0x593bb0;if(typeof _0x1688cc!==_0x216d('0x4')||_0x1688cc[_0x216d('0x5')]===0x0){return _0xfd7306(_0x216d('0x6'));}if(typeof _0x3a2589!==_0x216d('0x4')||_0x3a2589[_0x216d('0x5')]===0x0){return _0xfd7306(_0x216d('0x7'));}if(typeof _0x34cf5b!==_0x216d('0x8')&&(typeof _0x34cf5b!==_0x216d('0x4')||_0x34cf5b['length']===0x0)){return _0xfd7306(_0x216d('0x9'));}try{_0x593bb0=fs[_0x216d('0xa')](_0x1688cc)[_0x216d('0xb')](_0x216d('0xc'));}catch(_0x301058){return _0xfd7306(_0x301058);}return _0x239b49({'method':_0x216d('0xd'),'uri':host+'/v1/speech:recognize?key='+_0x3a2589,'body':{'config':{'encoding':_0x216d('0xe'),'sampleRateHertz':'8000','languageCode':_0x34cf5b},'audio':{'content':_0x593bb0}},'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 9b357bd..60c1ebb 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 _0x0c5b=['exports','./asr'];(function(_0x3c5cc8,_0x336027){var _0x44675c=function(_0xf9543e){while(--_0xf9543e){_0x3c5cc8['push'](_0x3c5cc8['shift']());}};_0x44675c(++_0x336027);}(_0x0c5b,0x141));var _0xb0c5=function(_0x62aa7b,_0x447c94){_0x62aa7b=_0x62aa7b-0x0;var _0x13ff8b=_0x0c5b[_0x62aa7b];return _0x13ff8b;};var asr=require(_0xb0c5('0x0'));module[_0xb0c5('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbb7a=['exports'];(function(_0xb6a0a9,_0x5c50e4){var _0x3ade14=function(_0x45b3b9){while(--_0x45b3b9){_0xb6a0a9['push'](_0xb6a0a9['shift']());}};_0x3ade14(++_0x5c50e4);}(_0xbb7a,0x1d8));var _0xabb7=function(_0x16e242,_0x458eb0){_0x16e242=_0x16e242-0x0;var _0x4fc8b1=_0xbb7a[_0x16e242];return _0x4fc8b1;};var asr=require('./asr');module[_0xabb7('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index dcd9cc7..522f6c3 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 _0x1990=['googleDialogflow','textRequest','result','source','resolvedQuery','action','fulfillment','speech','score','status','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','displayName','intent','isFallback','languageCode','responseId','intentDetectionConfidence','fulfillmentText','Tilde\x20ASR\x20confidence','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','text','channelData','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./aws','./sestek','./tilde','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','data','error\x20convert','resolve','tmp','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','audioContent','writeFile','.wav','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message'];(function(_0x3ec594,_0x448834){var _0x21f286=function(_0x537497){while(--_0x537497){_0x3ec594['push'](_0x3ec594['shift']());}};_0x21f286(++_0x448834);}(_0x1990,0xb6));var _0x0199=function(_0x10bba8,_0x592e15){_0x10bba8=_0x10bba8-0x0;var _0x523408=_0x1990[_0x10bba8];return _0x523408;};'use strict';var apiai=require(_0x0199('0x0'));var BPromise=require(_0x0199('0x1'));var dialogflow=require(_0x0199('0x2'));var fs=require('fs');var http=require(_0x0199('0x3'));var https=require(_0x0199('0x4'));var md5=require(_0x0199('0x5'));var path=require(_0x0199('0x6'));var querystring=require(_0x0199('0x7'));var rp=require(_0x0199('0x8'));var rs=require(_0x0199('0x9'));var sox=require('sox');var tts=require(_0x0199('0xa'));var urlParse=require(_0x0199('0xb'))[_0x0199('0xc')];var util=require(_0x0199('0xd'));var aws=require(_0x0199('0xe'));var google=require('./google');var sestek=require(_0x0199('0xf'));var tilde=require(_0x0199('0x10'));var logger=require('../../../config/logger')(_0x0199('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x2ccad8,_0x1be117){return new BPromise(function(_0x526e27,_0x1c80a6){var _0x95444c=urlParse(_0x2ccad8);var _0x4ddbd4=_0x95444c[_0x0199('0x12')]===_0x0199('0x13')?https:http;var _0x311ec8={'host':_0x95444c[_0x0199('0x14')],'path':_0x95444c[_0x0199('0x6')],'headers':{'user-agent':_0x0199('0x15')}};_0x4ddbd4[_0x0199('0x16')](_0x311ec8,function(_0x491bc6){if(_0x491bc6[_0x0199('0x17')]!==0xc8){logger[_0x0199('0x18')](_0x0199('0x19')+_0x2ccad8+_0x0199('0x1a')+_0x491bc6[_0x0199('0x17')]+'\x20('+_0x491bc6[_0x0199('0x1b')]+')');_0x1c80a6(new Error('request\x20to\x20'+_0x2ccad8+_0x0199('0x1a')+_0x491bc6[_0x0199('0x17')]+'\x20('+_0x491bc6[_0x0199('0x1b')]+')'));return;}var _0x54c930=fs['createWriteStream'](_0x1be117);_0x54c930['on'](_0x0199('0x1c'),function(){logger[_0x0199('0x1d')](_0x0199('0x1e'));_0x54c930['close'](_0x526e27);});_0x54c930['on'](_0x0199('0x18'),function(_0x191d22){fs[_0x0199('0x1f')](_0x1be117);logger[_0x0199('0x18')](_0x0199('0x20'),_0x191d22);_0x1c80a6(_0x191d22);});_0x491bc6[_0x0199('0x21')](_0x54c930);})['on'](_0x0199('0x18'),function(_0x52cf51){logger[_0x0199('0x18')](_0x52cf51);_0x1c80a6(_0x52cf51);})[_0x0199('0x22')]();});}function uploadFile(_0xd969e6){return new BPromise(function(_0x8bea8e,_0x7e8e22){var _0x531be4=urlParse(_0xd969e6);var _0x5ecd9e=_0x531be4['protocol']===_0x0199('0x13')?https:http;var _0x43035e={'host':_0x531be4[_0x0199('0x14')],'path':_0x531be4[_0x0199('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x5ecd9e[_0x0199('0x16')](_0x43035e,function(_0x46aec3){if(_0x46aec3[_0x0199('0x17')]!==0xc8){_0x7e8e22(new Error('request\x20to\x20'+_0xd969e6+_0x0199('0x1a')+_0x46aec3[_0x0199('0x17')]+'\x20('+_0x46aec3[_0x0199('0x1b')]+')'));return;}var _0x591b40='';_0x46aec3['on'](_0x0199('0x23'),function(_0x9cd1af){_0x591b40+=_0x9cd1af;});_0x46aec3['on']('end',function(){_0x8bea8e(_0x591b40);});})['on'](_0x0199('0x18'),function(_0x2c19a1){_0x7e8e22(_0x2c19a1);})['end']();});}function convertFile(_0x315096,_0x9865c0){return new BPromise(function(_0x42a656,_0x448814){var _0x3742be=sox['transcode'](_0x315096,_0x9865c0,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3742be['on'](_0x0199('0x18'),function(_0x5dc9c7){logger[_0x0199('0x18')](_0x0199('0x24'),_0x5dc9c7);_0x448814(_0x5dc9c7);});_0x3742be['on'](_0x0199('0x22'),function(){logger[_0x0199('0x1d')]('finish\x20to\x20convert');_0x42a656();});_0x3742be['start']();});}function base64Decode(_0x4b3d81,_0x171a88){var _0x448755=path[_0x0199('0x25')](__dirname,_0x0199('0x26'),rs['generate'](0x4)+'.wav');fs[_0x0199('0x27')](_0x448755,_0x4b3d81,_0x0199('0x28'));return convertFile(_0x448755,_0x171a88)[_0x0199('0x29')](function(){try{fs['unlink'](_0x448755);fs[_0x0199('0x2a')](_0x171a88,_0x0199('0x2b'));}catch(_0x2a54eb){logger[_0x0199('0x18')](_0x2a54eb);}return _0x171a88[_0x0199('0x2c')]('.')[0x0];});}function base64Encode(_0x467ba3){var _0x24db21=fs[_0x0199('0x2d')](_0x467ba3);return new Buffer(_0x24db21)['toString'](_0x0199('0x28'));}exports[_0x0199('0x2e')]=function(_0x3c675e,_0x33dd4b,_0x48c316,_0xb807a9,_0x20039d,_0x560984){var _0x2f8cc6,_0x39ae88;var _0x3caf77=_0x0199('0x2f');var _0x31361e=_0x0199('0x30')+_0x3c675e;var _0x3e6f99={};if(_0x33dd4b===_0x0199('0x31')){_0x3e6f99[_0x0199('0x32')]={'ssml':_0x48c316};}else{_0x3e6f99['input']={'text':_0x48c316};};_0x3e6f99[_0x0199('0x33')]={'languageCode':_0xb807a9,'ssmlGender':_0x20039d};_0x3e6f99[_0x0199('0x34')]={'audioEncoding':_0x0199('0x35'),'sampleRateHertz':0x1f40};var _0x123380={'url':_0x3caf77+_0x0199('0x36')+_0x31361e,'method':_0x0199('0x37'),'json':!![],'body':_0x3e6f99};return rp(_0x123380)[_0x0199('0x29')](function(_0x42f5c6){return new BPromise(function(_0x43e23a,_0x49f2c8){_0x2f8cc6=path['resolve'](__dirname,_0x0199('0x26'),rs[_0x0199('0x38')](0x4)+_0x0199('0x39'));var _0x446162=Buffer['from'](_0x42f5c6[_0x0199('0x3a')],_0x0199('0x28'));return fs[_0x0199('0x3b')](_0x2f8cc6,_0x446162,function(_0xf7d708){_0x49f2c8(_0xf7d708);},function(_0x212ce8){fs[_0x0199('0x2a')](_0x2f8cc6,_0x0199('0x2b'));_0x43e23a(_0x212ce8);});});})['then'](function(_0x121ee2){_0x39ae88=path[_0x0199('0x25')](__dirname,_0x0199('0x26'),rs[_0x0199('0x38')](0x4)+_0x0199('0x3c'));return convertFile(_0x2f8cc6,_0x39ae88);})[_0x0199('0x29')](function(){try{fs['unlink'](_0x2f8cc6);fs[_0x0199('0x2a')](_0x39ae88,_0x0199('0x2b'));}catch(_0x23ddbc){logger[_0x0199('0x18')](_0x23ddbc);}logger[_0x0199('0x1d')]('googleCloudTTS\x20path',_0x39ae88[_0x0199('0x2c')]('.')[0x0]);return _0x39ae88[_0x0199('0x2c')]('.')[0x0];});};exports[_0x0199('0x3d')]=function(_0xb16ffa,_0x337398){var _0x3e326b=_0x0199('0x3e');var _0x1f342c,_0x4d16e8;var _0x31fa9e;var _0x42377f={'encoding':_0x0199('0x3f'),'method':_0x0199('0x37'),'timeout':0x2710,'url':_0x3e326b,'headers':{'Content-Type':_0x0199('0x40')},'body':_0x0199('0x41')+encodeURIComponent(JSON['stringify']([[[_0x0199('0x42'),JSON[_0x0199('0x43')]([_0xb16ffa,_0x337398||'en',![],_0x0199('0x44')]),null,_0x0199('0x45')]]]))};return rp(_0x42377f)[_0x0199('0x29')](function(_0x278a18){try{_0x31fa9e=eval(_0x278a18[_0x0199('0x46')](0x5))[0x0][0x2];}catch(_0x1eb707){throw new Error(_0x0199('0x47')+_0x278a18[_0x0199('0x23')]);}if(!_0x31fa9e){if(_0xb16ffa[_0x0199('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x0199('0x49')+_0x337398+_0x0199('0x4a'));}}try{_0x31fa9e=eval(_0x31fa9e)[0x0];}catch(_0x2bd80c){throw new Error(_0x0199('0x47')+res[_0x0199('0x23')]);}const _0x2f1a05=_0x31fa9e;_0x1f342c=path[_0x0199('0x25')](__dirname,_0x0199('0x26'),rs[_0x0199('0x38')](0x4)+_0x0199('0x39'));fs[_0x0199('0x27')](_0x1f342c,_0x31fa9e,{'encoding':_0x0199('0x28')});_0x4d16e8=path[_0x0199('0x25')](__dirname,_0x0199('0x26'),rs['generate'](0x4)+_0x0199('0x3c'));return convertFile(_0x1f342c,_0x4d16e8);})[_0x0199('0x29')](function(){try{fs[_0x0199('0x1f')](_0x1f342c);fs[_0x0199('0x2a')](_0x4d16e8,_0x0199('0x2b'));}catch(_0x49ffba){logger[_0x0199('0x18')](_0x49ffba);}logger[_0x0199('0x1d')](_0x0199('0x4b'),_0x4d16e8[_0x0199('0x2c')]('.')[0x0]);return _0x4d16e8[_0x0199('0x2c')]('.')[0x0];});};exports[_0x0199('0x4c')]=function(_0x369a7b,_0x401f3f,_0x3fb838){return google[_0x0199('0x4d')](_0x369a7b,_0x401f3f,_0x3fb838)[_0x0199('0x29')](function(_0x3f3870){logger[_0x0199('0x1d')](_0x3f3870[_0x0199('0x4e')]);return rp(_0x3f3870);})[_0x0199('0x29')](function(_0x32bcf9){var _0x7676d4='';var _0x41ea4f=0x0;try{fs[_0x0199('0x1f')](_0x369a7b);}catch(_0x2b5d16){logger[_0x0199('0x18')](_0x2b5d16);}if(_0x32bcf9&&_0x32bcf9[_0x0199('0x4f')]){_0x7676d4=_0x32bcf9[_0x0199('0x4f')][_0x0199('0x50')](function(_0x457403){return _0x457403&&_0x457403[_0x0199('0x51')][0x0]&&_0x457403['alternatives'][0x0][_0x0199('0x52')]?_0x457403[_0x0199('0x51')][0x0]['transcript']:'';})[_0x0199('0x53')]('\x0a');_0x41ea4f=_0x32bcf9['results'][_0x0199('0x50')](function(_0xfb1cc5){return _0xfb1cc5&&_0xfb1cc5['alternatives'][0x0]&&_0xfb1cc5[_0x0199('0x51')][0x0][_0x0199('0x54')]?_0xfb1cc5[_0x0199('0x51')][0x0][_0x0199('0x54')]:0x0;})[_0x0199('0x53')]('\x0a');}logger[_0x0199('0x1d')]('googleASR\x20transcription',_0x7676d4);logger[_0x0199('0x1d')](_0x0199('0x55'),_0x41ea4f);return{'transcript':_0x7676d4,'confidence':_0x41ea4f};})[_0x0199('0x56')](function(_0x332ba8){logger[_0x0199('0x18')](_0x0199('0x57'),_0x332ba8[_0x0199('0x17')],_0x332ba8[_0x0199('0x58')],_0x332ba8[_0x0199('0x59')]);});};exports[_0x0199('0x5a')]=function(_0x4bfd59,_0x2d8154,_0x112ad9,_0x252a67){var _0x4864e7=apiai(_0x2d8154,{'language':_0x252a67||'en'});return _0x4864e7[_0x0199('0x5b')](_0x112ad9,{'sessionId':md5(_0x4bfd59)})[_0x0199('0x29')](function(_0x3bd421){logger[_0x0199('0x1d')](JSON[_0x0199('0x43')](_0x3bd421));return{'source':_0x3bd421[_0x0199('0x5c')][_0x0199('0x5d')],'resolvedQuery':_0x3bd421['result'][_0x0199('0x5e')],'action':_0x3bd421[_0x0199('0x5c')][_0x0199('0x5f')],'actionIncomplete':_0x3bd421[_0x0199('0x5c')]['actionIncomplete'],'speech':_0x3bd421[_0x0199('0x5c')][_0x0199('0x60')][_0x0199('0x61')],'score':_0x3bd421[_0x0199('0x5c')][_0x0199('0x62')],'statusCode':_0x3bd421[_0x0199('0x63')]['code'],'endConversation':_0x3bd421[_0x0199('0x5c')][_0x0199('0x64')][_0x0199('0x65')]||![],'isFallbackIntent':_0x3bd421['result']['metadata']['isFallbackIntent']};});};exports[_0x0199('0x66')]=function(_0x60a4cb,_0x42204c,_0xc7a451,_0x4ec806,_0x197795,_0x753b98){var _0x121881=_0x4ec806[_0x0199('0x67')](/\\n/g,'\x0a');var _0x457bf2={'credentials':{'private_key':_0x121881,'client_email':_0xc7a451}};var _0x26dc3d=new dialogflow[(_0x0199('0x68'))](_0x457bf2);var _0x3ba01=_0x26dc3d[_0x0199('0x69')](_0x42204c,md5(_0x60a4cb));var _0x2eac23={'session':_0x3ba01,'queryInput':{'text':{'text':_0x197795,'languageCode':_0x753b98}}};return _0x26dc3d[_0x0199('0x6a')](_0x2eac23)[_0x0199('0x29')](function(_0x13ac65){if(_0x13ac65&&_0x13ac65[_0x0199('0x48')]){logger[_0x0199('0x1d')](_0x0199('0x6b'),JSON[_0x0199('0x43')](_0x13ac65));var _0x54700b=_0x13ac65[0x0];if(_0x54700b){var _0x43194c={'action':_0x54700b[_0x0199('0x6c')][_0x0199('0x5f')],'allRequiredParamsPresent':_0x54700b[_0x0199('0x6c')][_0x0199('0x6d')],'endConversation':_0x54700b[_0x0199('0x6c')]['diagnosticInfo']&&_0x54700b[_0x0199('0x6c')][_0x0199('0x6e')]['fields']?_0x54700b['queryResult'][_0x0199('0x6e')][_0x0199('0x6f')][_0x0199('0x70')]['boolValue']:![],'fulfillmentText':_0x54700b[_0x0199('0x6c')]['fulfillmentText'],'intentName':_0x54700b['queryResult']['intent']['name'],'intentDisplayName':_0x54700b[_0x0199('0x6c')]['intent'][_0x0199('0x71')],'isFallbackIntent':_0x54700b['queryResult'][_0x0199('0x72')][_0x0199('0x73')],'languageCode':_0x54700b[_0x0199('0x6c')][_0x0199('0x74')],'queryText':_0x54700b[_0x0199('0x6c')]['queryText'],'responseId':_0x54700b[_0x0199('0x75')],'score':_0x54700b[_0x0199('0x6c')][_0x0199('0x76')],'speech':_0x54700b[_0x0199('0x6c')][_0x0199('0x77')],'providerResponse':JSON[_0x0199('0x43')](_0x13ac65)};return _0x43194c;}}});};exports['tildeASR']=function(_0x2e24a7,_0x1e0641,_0x53ee4e,_0x36a961){return tilde['asr'](_0x2e24a7,_0x1e0641,_0x53ee4e,_0x36a961)[_0x0199('0x29')](function(_0x291bc5){try{fs[_0x0199('0x1f')](_0x2e24a7);}catch(_0x2bf8f4){logger['error'](_0x2bf8f4);}logger[_0x0199('0x1d')]('Tilde\x20ASR\x20transcription',_0x291bc5[_0x0199('0x52')]);logger[_0x0199('0x1d')](_0x0199('0x78'),_0x291bc5[_0x0199('0x54')]);return _0x291bc5;});};exports['awsPolly']=function(_0xe28edf,_0x3dd829,_0x573d45,_0x1ca6ce,_0x588394,_0x54c44d){var _0x50184a=path[_0x0199('0x25')](__dirname,_0x0199('0x26'),rs[_0x0199('0x38')](0x4)+_0x0199('0x39'));var _0x44eb4e;return aws['polly'](_0xe28edf,_0x3dd829,_0x573d45,_0x1ca6ce,_0x588394,_0x54c44d,_0x50184a)['then'](function(){_0x44eb4e=path[_0x0199('0x25')](__dirname,'tmp',rs[_0x0199('0x38')](0x4)+_0x0199('0x3c'));return convertFile(_0x50184a,_0x44eb4e);})[_0x0199('0x29')](function(){try{fs[_0x0199('0x1f')](_0x50184a);fs[_0x0199('0x2a')](_0x44eb4e,_0x0199('0x2b'));}catch(_0x2d2872){logger['error'](_0x2d2872);}return _0x44eb4e[_0x0199('0x2c')]('.')[0x0];});};exports[_0x0199('0x79')]=function(_0x1760b5,_0x3f105a,_0x20fbe1,_0x5f4fc9,_0x850516,_0x526f28){return aws[_0x0199('0x7a')](_0x1760b5,_0x3f105a,_0x20fbe1,_0x5f4fc9,_0x850516,_0x526f28)[_0x0199('0x29')](function(_0x1cfded){logger['info'](JSON[_0x0199('0x43')](_0x1cfded));return _0x1cfded;});};exports[_0x0199('0x7b')]=function(_0x3091c6,_0x23e721,_0x12c232,_0x32e19b){var _0x455eeb=util[_0x0199('0x7c')](_0x0199('0x7d'),ISPEECH_API,_0x3091c6,encodeURIComponent(_0x23e721),_0x12c232,_0x32e19b);var _0x100ad4=path[_0x0199('0x25')](__dirname,_0x0199('0x26'),rs['generate'](0x4)+'.mp3');var _0x156297;return downloadFile(_0x455eeb,_0x100ad4)[_0x0199('0x29')](function(){_0x156297=path[_0x0199('0x25')](__dirname,'tmp',rs[_0x0199('0x38')](0x4)+'.wav');return convertFile(_0x100ad4,_0x156297);})[_0x0199('0x29')](function(){try{fs[_0x0199('0x1f')](_0x100ad4);fs[_0x0199('0x2a')](_0x156297,_0x0199('0x2b'));}catch(_0x58459b){logger[_0x0199('0x18')](_0x58459b);}return _0x156297['split']('.')[0x0];});};exports[_0x0199('0x7e')]=function(_0x2ae4bd,_0x582158,_0x4fc76d,_0x560d24){var _0x1f3d81=util[_0x0199('0x7c')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x582158,_0x4fc76d,base64Encode(_0x2ae4bd),_0x560d24?util[_0x0199('0x7c')](_0x0199('0x7f'),encodeURIComponent(_0x560d24)):_0x0199('0x80'));return uploadFile(_0x1f3d81)[_0x0199('0x29')](function(_0x5ee45a){return querystring['parse'](_0x5ee45a);});};exports[_0x0199('0x81')]=function(_0x4494a3,_0x6476f8){return sestek['nda'](_0x4494a3,_0x6476f8)[_0x0199('0x29')](function(_0x3dfa37){logger[_0x0199('0x1d')](JSON['stringify'](_0x3dfa37));var _0xab84d9={'speech':_0x3dfa37[_0x0199('0x82')],'action':_0x3dfa37[_0x0199('0x83')]?_0x3dfa37[_0x0199('0x83')]['CustomAction']:undefined,'actiondata':_0x3dfa37[_0x0199('0x83')]?_0x3dfa37['channelData'][_0x0199('0x84')]:undefined};if(_0x3dfa37[_0x0199('0x83')]&&_0x3dfa37[_0x0199('0x83')][_0x0199('0x85')]){return base64Decode(_0x3dfa37[_0x0199('0x83')]['AudioFromTts'][_0x0199('0x86')],path[_0x0199('0x25')](__dirname,_0x0199('0x26'),rs[_0x0199('0x38')](0x4)+'.wav'))[_0x0199('0x29')](function(_0x1fbebe){_0xab84d9['audiofile']=_0x1fbebe;return _0xab84d9;});}return _0xab84d9;});};exports[_0x0199('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x7770=['dialogflow','http','https','md5','path','querystring','sox','google-tts-api','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','data','transcode','wav','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','speech','score','status','code','metadata','endConversation','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','model=%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird'];(function(_0x32a8b8,_0x2e2a58){var _0x38d0c4=function(_0xad321d){while(--_0xad321d){_0x32a8b8['push'](_0x32a8b8['shift']());}};_0x38d0c4(++_0x2e2a58);}(_0x7770,0x10c));var _0x0777=function(_0x56326f,_0x10a9e0){_0x56326f=_0x56326f-0x0;var _0x4edad8=_0x7770[_0x56326f];return _0x4edad8;};'use strict';var apiai=require(_0x0777('0x0'));var BPromise=require(_0x0777('0x1'));var dialogflow=require(_0x0777('0x2'));var fs=require('fs');var http=require(_0x0777('0x3'));var https=require(_0x0777('0x4'));var md5=require(_0x0777('0x5'));var path=require(_0x0777('0x6'));var querystring=require(_0x0777('0x7'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x0777('0x8'));var tts=require(_0x0777('0x9'));var urlParse=require('url')[_0x0777('0xa')];var util=require('util');var aws=require(_0x0777('0xb'));var google=require(_0x0777('0xc'));var sestek=require(_0x0777('0xd'));var tilde=require(_0x0777('0xe'));var logger=require(_0x0777('0xf'))(_0x0777('0x10'));var ISPEECH_API=_0x0777('0x11');function downloadFile(_0x38672d,_0x5eebe6){return new BPromise(function(_0x5e4f49,_0x4a36d1){var _0xb9ff25=urlParse(_0x38672d);var _0x58afe0=_0xb9ff25[_0x0777('0x12')]===_0x0777('0x13')?https:http;var _0x43a602={'host':_0xb9ff25[_0x0777('0x14')],'path':_0xb9ff25[_0x0777('0x6')],'headers':{'user-agent':_0x0777('0x15')}};_0x58afe0[_0x0777('0x16')](_0x43a602,function(_0x34b56a){if(_0x34b56a[_0x0777('0x17')]!==0xc8){logger[_0x0777('0x18')](_0x0777('0x19')+_0x38672d+_0x0777('0x1a')+_0x34b56a[_0x0777('0x17')]+'\x20('+_0x34b56a['statusMessage']+')');_0x4a36d1(new Error(_0x0777('0x19')+_0x38672d+_0x0777('0x1a')+_0x34b56a['statusCode']+'\x20('+_0x34b56a[_0x0777('0x1b')]+')'));return;}var _0x6e8d54=fs[_0x0777('0x1c')](_0x5eebe6);_0x6e8d54['on'](_0x0777('0x1d'),function(){logger[_0x0777('0x1e')](_0x0777('0x1f'));_0x6e8d54[_0x0777('0x20')](_0x5e4f49);});_0x6e8d54['on'](_0x0777('0x18'),function(_0x55ab00){fs[_0x0777('0x21')](_0x5eebe6);logger[_0x0777('0x18')](_0x0777('0x22'),_0x55ab00);_0x4a36d1(_0x55ab00);});_0x34b56a['pipe'](_0x6e8d54);})['on'](_0x0777('0x18'),function(_0x35db95){logger[_0x0777('0x18')](_0x35db95);_0x4a36d1(_0x35db95);})[_0x0777('0x23')]();});}function uploadFile(_0x54c9ac){return new BPromise(function(_0x2edcf8,_0x51d333){var _0x33a3fc=urlParse(_0x54c9ac);var _0x419bce=_0x33a3fc[_0x0777('0x12')]===_0x0777('0x13')?https:http;var _0x24ee18={'host':_0x33a3fc[_0x0777('0x14')],'path':_0x33a3fc['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x419bce[_0x0777('0x16')](_0x24ee18,function(_0x142096){if(_0x142096[_0x0777('0x17')]!==0xc8){_0x51d333(new Error(_0x0777('0x19')+_0x54c9ac+'\x20failed,\x20status\x20code\x20=\x20'+_0x142096[_0x0777('0x17')]+'\x20('+_0x142096['statusMessage']+')'));return;}var _0x2ed1dc='';_0x142096['on'](_0x0777('0x24'),function(_0x9a8fa4){_0x2ed1dc+=_0x9a8fa4;});_0x142096['on']('end',function(){_0x2edcf8(_0x2ed1dc);});})['on']('error',function(_0x3393c0){_0x51d333(_0x3393c0);})['end']();});}function convertFile(_0x1d8ea1,_0x22c117){return new BPromise(function(_0x197a43,_0x30d40b){var _0x36813e=sox[_0x0777('0x25')](_0x1d8ea1,_0x22c117,{'sampleRate':0x1f40,'format':_0x0777('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36813e['on']('error',function(_0x21ba25){logger[_0x0777('0x18')]('error\x20convert',_0x21ba25);_0x30d40b(_0x21ba25);});_0x36813e['on']('end',function(){logger[_0x0777('0x1e')]('finish\x20to\x20convert');_0x197a43();});_0x36813e[_0x0777('0x27')]();});}function base64Decode(_0x4930cb,_0x12309a){var _0x302191=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b'));fs[_0x0777('0x2c')](_0x302191,_0x4930cb,'base64');return convertFile(_0x302191,_0x12309a)[_0x0777('0x2d')](function(){try{fs[_0x0777('0x21')](_0x302191);fs[_0x0777('0x2e')](_0x12309a,_0x0777('0x2f'));}catch(_0x194306){logger[_0x0777('0x18')](_0x194306);}return _0x12309a[_0x0777('0x30')]('.')[0x0];});}function base64Encode(_0x3c93c8){var _0x393600=fs[_0x0777('0x31')](_0x3c93c8);return new Buffer(_0x393600)['toString'](_0x0777('0x32'));}exports[_0x0777('0x33')]=function(_0x335c71,_0x130cf0,_0x488a3b,_0x3d09b3,_0x63078f,_0xbade92){var _0xabed5a,_0x2dcf7a;var _0xfff037=_0x0777('0x34');var _0x14a8ec=_0x0777('0x35')+_0x335c71;var _0x4a8c0c={};if(_0x130cf0===_0x0777('0x36')){_0x4a8c0c['input']={'ssml':_0x488a3b};}else{_0x4a8c0c[_0x0777('0x37')]={'text':_0x488a3b};};_0x4a8c0c[_0x0777('0x38')]={'languageCode':_0x3d09b3,'ssmlGender':_0x63078f};_0x4a8c0c[_0x0777('0x39')]={'audioEncoding':_0x0777('0x3a'),'sampleRateHertz':0x1f40};var _0x469063={'url':_0xfff037+_0x0777('0x3b')+_0x14a8ec,'method':_0x0777('0x3c'),'json':!![],'body':_0x4a8c0c};return rp(_0x469063)['then'](function(_0x13c462){return new BPromise(function(_0x26f8aa,_0x593995){_0xabed5a=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x3d'));var _0x23f517=Buffer[_0x0777('0x3e')](_0x13c462[_0x0777('0x3f')],_0x0777('0x32'));return fs['writeFile'](_0xabed5a,_0x23f517,function(_0x2fae25){_0x593995(_0x2fae25);},function(_0x2cdc21){fs[_0x0777('0x2e')](_0xabed5a,'777');_0x26f8aa(_0x2cdc21);});});})[_0x0777('0x2d')](function(_0x9484c4){_0x2dcf7a=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+'.wav');return convertFile(_0xabed5a,_0x2dcf7a);})[_0x0777('0x2d')](function(){try{fs[_0x0777('0x21')](_0xabed5a);fs[_0x0777('0x2e')](_0x2dcf7a,_0x0777('0x2f'));}catch(_0x461b7a){logger[_0x0777('0x18')](_0x461b7a);}logger[_0x0777('0x1e')](_0x0777('0x40'),_0x2dcf7a[_0x0777('0x30')]('.')[0x0]);return _0x2dcf7a[_0x0777('0x30')]('.')[0x0];});};exports['googleTTS']=function(_0x1dfced,_0x34aca8){var _0x53b00a=_0x0777('0x41');var _0x4ad0bf,_0x1ea08d;var _0x5f17d4;var _0x922503={'encoding':_0x0777('0x42'),'method':'POST','timeout':0x2710,'url':_0x53b00a,'headers':{'Content-Type':_0x0777('0x43')},'body':_0x0777('0x44')+encodeURIComponent(JSON['stringify']([[[_0x0777('0x45'),JSON[_0x0777('0x46')]([_0x1dfced,_0x34aca8||'en',![],_0x0777('0x47')]),null,_0x0777('0x48')]]]))};return rp(_0x922503)[_0x0777('0x2d')](function(_0x38fc67){try{_0x5f17d4=eval(_0x38fc67[_0x0777('0x49')](0x5))[0x0][0x2];}catch(_0x187219){throw new Error(_0x0777('0x4a')+_0x38fc67['data']);}if(!_0x5f17d4){if(_0x1dfced[_0x0777('0x4b')]>0xc8){throw new Error(_0x0777('0x4c'));}else{throw new Error(_0x0777('0x4d')+_0x34aca8+_0x0777('0x4e'));}}try{_0x5f17d4=eval(_0x5f17d4)[0x0];}catch(_0x3725cb){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x0777('0x24')]);}const _0x856e03=_0x5f17d4;_0x4ad0bf=path['resolve'](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x3d'));fs[_0x0777('0x2c')](_0x4ad0bf,_0x5f17d4,{'encoding':_0x0777('0x32')});_0x1ea08d=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b'));return convertFile(_0x4ad0bf,_0x1ea08d);})[_0x0777('0x2d')](function(){try{fs['unlink'](_0x4ad0bf);fs[_0x0777('0x2e')](_0x1ea08d,_0x0777('0x2f'));}catch(_0x30da8f){logger['error'](_0x30da8f);}logger['info'](_0x0777('0x4f'),_0x1ea08d[_0x0777('0x30')]('.')[0x0]);return _0x1ea08d['split']('.')[0x0];});};exports['googleASR']=function(_0x385687,_0x4d2262,_0x99c2e0){return google['asr'](_0x385687,_0x4d2262,_0x99c2e0)[_0x0777('0x2d')](function(_0x51e310){logger[_0x0777('0x1e')](_0x51e310[_0x0777('0x50')]);return rp(_0x51e310);})[_0x0777('0x2d')](function(_0x105876){var _0x59bb2c='';var _0x1deb2c=0x0;try{fs[_0x0777('0x21')](_0x385687);}catch(_0x18a9c6){logger['error'](_0x18a9c6);}if(_0x105876&&_0x105876['results']){_0x59bb2c=_0x105876[_0x0777('0x51')][_0x0777('0x52')](function(_0x32c0a8){return _0x32c0a8&&_0x32c0a8['alternatives'][0x0]&&_0x32c0a8[_0x0777('0x53')][0x0]['transcript']?_0x32c0a8[_0x0777('0x53')][0x0][_0x0777('0x54')]:'';})[_0x0777('0x55')]('\x0a');_0x1deb2c=_0x105876[_0x0777('0x51')][_0x0777('0x52')](function(_0x98b235){return _0x98b235&&_0x98b235['alternatives'][0x0]&&_0x98b235[_0x0777('0x53')][0x0][_0x0777('0x56')]?_0x98b235[_0x0777('0x53')][0x0][_0x0777('0x56')]:0x0;})[_0x0777('0x55')]('\x0a');}logger[_0x0777('0x1e')]('googleASR\x20transcription',_0x59bb2c);logger[_0x0777('0x1e')](_0x0777('0x57'),_0x1deb2c);return{'transcript':_0x59bb2c,'confidence':_0x1deb2c};})[_0x0777('0x58')](function(_0x10b68c){logger[_0x0777('0x18')]('[%s]\x20%s:%s',_0x10b68c[_0x0777('0x17')],_0x10b68c[_0x0777('0x59')],_0x10b68c[_0x0777('0x5a')]);});};exports[_0x0777('0x5b')]=function(_0x478c36,_0x8e0b22,_0x20a408,_0x271c1b){var _0x93e0ae=apiai(_0x8e0b22,{'language':_0x271c1b||'en'});return _0x93e0ae[_0x0777('0x5c')](_0x20a408,{'sessionId':md5(_0x478c36)})[_0x0777('0x2d')](function(_0x2ace9f){logger[_0x0777('0x1e')](JSON[_0x0777('0x46')](_0x2ace9f));return{'source':_0x2ace9f['result'][_0x0777('0x5d')],'resolvedQuery':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x5f')],'action':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x60')],'actionIncomplete':_0x2ace9f[_0x0777('0x5e')]['actionIncomplete'],'speech':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x61')][_0x0777('0x62')],'score':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x63')],'statusCode':_0x2ace9f[_0x0777('0x64')][_0x0777('0x65')],'endConversation':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x66')][_0x0777('0x67')]||![],'isFallbackIntent':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x66')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x1827f4,_0x1ceb2d,_0x11af41,_0x150196,_0x5bdb2a,_0x56f8da){var _0x5b2c92=_0x150196['replace'](/\\n/g,'\x0a');var _0x259968={'credentials':{'private_key':_0x5b2c92,'client_email':_0x11af41}};var _0x292018=new dialogflow[(_0x0777('0x68'))](_0x259968);var _0x3dc5cd=_0x292018[_0x0777('0x69')](_0x1ceb2d,md5(_0x1827f4));var _0x1672bb={'session':_0x3dc5cd,'queryInput':{'text':{'text':_0x5bdb2a,'languageCode':_0x56f8da}}};return _0x292018['detectIntent'](_0x1672bb)['then'](function(_0x428aad){if(_0x428aad&&_0x428aad['length']){logger[_0x0777('0x1e')](_0x0777('0x6a'),JSON[_0x0777('0x46')](_0x428aad));var _0x26a76b=_0x428aad[0x0];if(_0x26a76b){var _0x16eed0={'action':_0x26a76b[_0x0777('0x6b')][_0x0777('0x60')],'allRequiredParamsPresent':_0x26a76b[_0x0777('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x26a76b[_0x0777('0x6b')][_0x0777('0x6c')]&&_0x26a76b[_0x0777('0x6b')][_0x0777('0x6c')][_0x0777('0x6d')]?_0x26a76b['queryResult'][_0x0777('0x6c')][_0x0777('0x6d')]['end_conversation'][_0x0777('0x6e')]:![],'fulfillmentText':_0x26a76b['queryResult'][_0x0777('0x6f')],'intentName':_0x26a76b[_0x0777('0x6b')][_0x0777('0x70')][_0x0777('0x59')],'intentDisplayName':_0x26a76b[_0x0777('0x6b')]['intent'][_0x0777('0x71')],'isFallbackIntent':_0x26a76b[_0x0777('0x6b')][_0x0777('0x70')][_0x0777('0x72')],'languageCode':_0x26a76b['queryResult'][_0x0777('0x73')],'queryText':_0x26a76b['queryResult'][_0x0777('0x74')],'responseId':_0x26a76b['responseId'],'score':_0x26a76b[_0x0777('0x6b')]['intentDetectionConfidence'],'speech':_0x26a76b[_0x0777('0x6b')][_0x0777('0x6f')],'providerResponse':JSON[_0x0777('0x46')](_0x428aad)};return _0x16eed0;}}});};exports[_0x0777('0x75')]=function(_0x224cbc,_0x599b0f,_0x48ede7,_0x5212fa){return tilde[_0x0777('0x76')](_0x224cbc,_0x599b0f,_0x48ede7,_0x5212fa)[_0x0777('0x2d')](function(_0x5ed4ad){try{fs[_0x0777('0x21')](_0x224cbc);}catch(_0x271815){logger[_0x0777('0x18')](_0x271815);}logger[_0x0777('0x1e')]('Tilde\x20ASR\x20transcription',_0x5ed4ad[_0x0777('0x54')]);logger['info'](_0x0777('0x77'),_0x5ed4ad[_0x0777('0x56')]);return _0x5ed4ad;});};exports[_0x0777('0x78')]=function(_0x3f9631,_0x22c54b,_0x1b7344,_0x2b7d1a,_0x2f5f45,_0x446b86){var _0x5d822e=path[_0x0777('0x28')](__dirname,'tmp',rs[_0x0777('0x2a')](0x4)+_0x0777('0x3d'));var _0x15d640;return aws[_0x0777('0x79')](_0x3f9631,_0x22c54b,_0x1b7344,_0x2b7d1a,_0x2f5f45,_0x446b86,_0x5d822e)['then'](function(){_0x15d640=path[_0x0777('0x28')](__dirname,'tmp',rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b'));return convertFile(_0x5d822e,_0x15d640);})[_0x0777('0x2d')](function(){try{fs['unlink'](_0x5d822e);fs[_0x0777('0x2e')](_0x15d640,_0x0777('0x2f'));}catch(_0x11116d){logger[_0x0777('0x18')](_0x11116d);}return _0x15d640[_0x0777('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x4b7dc3,_0x223368,_0x72cb3a,_0x3cd646,_0x4bb934,_0x5f4ba1){return aws[_0x0777('0x7a')](_0x4b7dc3,_0x223368,_0x72cb3a,_0x3cd646,_0x4bb934,_0x5f4ba1)['then'](function(_0x519c21){logger[_0x0777('0x1e')](JSON['stringify'](_0x519c21));return _0x519c21;});};exports['ispeechTTS']=function(_0x2f5f2f,_0x3e9d8b,_0x193164,_0x38b879){var _0x43805e=util['format'](_0x0777('0x7b'),ISPEECH_API,_0x2f5f2f,encodeURIComponent(_0x3e9d8b),_0x193164,_0x38b879);var _0x1c25dc=path['resolve'](__dirname,'tmp',rs[_0x0777('0x2a')](0x4)+_0x0777('0x3d'));var _0x7f1bb0;return downloadFile(_0x43805e,_0x1c25dc)['then'](function(){_0x7f1bb0=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b'));return convertFile(_0x1c25dc,_0x7f1bb0);})['then'](function(){try{fs[_0x0777('0x21')](_0x1c25dc);fs[_0x0777('0x2e')](_0x7f1bb0,_0x0777('0x2f'));}catch(_0xd8d41c){logger['error'](_0xd8d41c);}return _0x7f1bb0[_0x0777('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0x28ff6,_0x4a5827,_0x3ad317,_0x1d34fd){var _0x5372fa=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4a5827,_0x3ad317,base64Encode(_0x28ff6),_0x1d34fd?util[_0x0777('0x7c')](_0x0777('0x7d'),encodeURIComponent(_0x1d34fd)):_0x0777('0x7e'));return uploadFile(_0x5372fa)[_0x0777('0x2d')](function(_0x6491a5){return querystring['parse'](_0x6491a5);});};exports['sestekNDA']=function(_0x286e76,_0x4c2fdc){return sestek[_0x0777('0x7f')](_0x286e76,_0x4c2fdc)[_0x0777('0x2d')](function(_0x30c0c2){logger['info'](JSON[_0x0777('0x46')](_0x30c0c2));var _0x2e63e4={'speech':_0x30c0c2['text'],'action':_0x30c0c2['channelData']?_0x30c0c2[_0x0777('0x80')][_0x0777('0x81')]:undefined,'actiondata':_0x30c0c2['channelData']?_0x30c0c2[_0x0777('0x80')][_0x0777('0x82')]:undefined};if(_0x30c0c2[_0x0777('0x80')]&&_0x30c0c2[_0x0777('0x80')][_0x0777('0x83')]){return base64Decode(_0x30c0c2[_0x0777('0x80')][_0x0777('0x83')][_0x0777('0x84')],path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b')))[_0x0777('0x2d')](function(_0x479c6d){_0x2e63e4[_0x0777('0x85')]=_0x479c6d;return _0x2e63e4;});}return _0x2e63e4;});};exports[_0x0777('0x86')]=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 949a5ae..15b0505 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 _0x322d=['./nda','exports'];(function(_0x221a00,_0x22795b){var _0x12e2d6=function(_0x155118){while(--_0x155118){_0x221a00['push'](_0x221a00['shift']());}};_0x12e2d6(++_0x22795b);}(_0x322d,0xde));var _0xd322=function(_0x4cd2aa,_0x19a600){_0x4cd2aa=_0x4cd2aa-0x0;var _0x2c2c7e=_0x322d[_0x4cd2aa];return _0x2c2c7e;};var nda=require(_0xd322('0x0'));module[_0xd322('0x1')]={'nda':nda}; \ No newline at end of file +var _0x9a66=['exports','./nda'];(function(_0x389788,_0x3d305a){var _0x4357d1=function(_0x53c393){while(--_0x53c393){_0x389788['push'](_0x389788['shift']());}};_0x4357d1(++_0x3d305a);}(_0x9a66,0x117));var _0x69a6=function(_0xebaafc,_0x186ef8){_0xebaafc=_0xebaafc-0x0;var _0x2690ee=_0x9a66[_0xebaafc];return _0x2690ee;};var nda=require(_0x69a6('0x0'));module[_0x69a6('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 5f70162..8c7e1d7 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 _0x26bc=['ndauth_url','password','username','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','project','ndagenerate_audio','channelData','audio/wav','custom_action','CustomAction','custom_action_data','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x4bf2e0,_0x4eb0e5){var _0x121a8b=function(_0x1586b8){while(--_0x1586b8){_0x4bf2e0['push'](_0x4bf2e0['shift']());}};_0x121a8b(++_0x4eb0e5);}(_0x26bc,0x162));var _0xc26b=function(_0x45542a,_0xf0fe05){_0x45542a=_0x45542a-0x0;var _0x49f515=_0x26bc[_0x45542a];return _0x49f515;};'use strict';var rp=require(_0xc26b('0x0'));var url=require(_0xc26b('0x1'));var logger=require(_0xc26b('0x2'))(_0xc26b('0x3'));module[_0xc26b('0x4')]=function(_0x4eda53,_0x21c373){var _0x1bb460={'method':_0xc26b('0x5'),'uri':url['resolve'](_0x21c373[_0xc26b('0x6')],'/token'),'form':{'grant_type':_0xc26b('0x7'),'username':_0x21c373[_0xc26b('0x8')],'password':_0x21c373[_0xc26b('0x7')]},'json':!![]};return rp(_0x1bb460)['then'](function(_0x11c6f5){var _0x453491={'method':_0xc26b('0x5'),'uri':url[_0xc26b('0x9')](_0x21c373[_0xc26b('0xa')],_0xc26b('0xb')),'body':{'type':_0x21c373[_0xc26b('0xc')]||_0xc26b('0xd'),'channelId':_0xc26b('0xe'),'conversation':{'id':_0x4eda53[_0xc26b('0xf')]},'from':{'id':_0x4eda53['callerid'],'name':_0x4eda53[_0xc26b('0x10')]},'recipient':{'id':_0x4eda53[_0xc26b('0x11')],'name':_0x4eda53[_0xc26b('0x12')]},'text':_0x21c373[_0xc26b('0x13')],'channelData':{}},'headers':{'Authorization':_0xc26b('0x14')+_0x11c6f5[_0xc26b('0x15')]},'json':!![]};if(_0x21c373['project']){_0x453491[_0xc26b('0x16')]['channelData']['ProjectName']=_0x21c373[_0xc26b('0x17')];}if(_0x21c373[_0xc26b('0x18')]=='1'){_0x453491[_0xc26b('0x16')][_0xc26b('0x19')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc26b('0x1a')};}if(_0x21c373[_0xc26b('0x1b')]){_0x453491[_0xc26b('0x16')][_0xc26b('0x19')][_0xc26b('0x1c')]=_0x21c373[_0xc26b('0x1b')];if(_0x21c373['custom_action_data']){_0x453491[_0xc26b('0x16')][_0xc26b('0x19')]['CustomActionData']=_0x21c373[_0xc26b('0x1d')];}}logger['info'](JSON['stringify'](_0x453491));return rp(_0x453491);});}; \ No newline at end of file +var _0xeebe=['../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','callerid','dnid','extension','text','access_token','channelData','ProjectName','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise'];(function(_0x5775c4,_0x11631c){var _0xa2e3a1=function(_0x3c9a67){while(--_0x3c9a67){_0x5775c4['push'](_0x5775c4['shift']());}};_0xa2e3a1(++_0x11631c);}(_0xeebe,0xff));var _0xeeeb=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xeebe[_0x49ca18];return _0x145d54;};'use strict';var rp=require(_0xeeeb('0x0'));var url=require('url');var logger=require(_0xeeeb('0x1'))('agi');module[_0xeeeb('0x2')]=function(_0x1a1a35,_0xb434b3){var _0x427b94={'method':_0xeeeb('0x3'),'uri':url[_0xeeeb('0x4')](_0xb434b3[_0xeeeb('0x5')],_0xeeeb('0x6')),'form':{'grant_type':_0xeeeb('0x7'),'username':_0xb434b3[_0xeeeb('0x8')],'password':_0xb434b3[_0xeeeb('0x7')]},'json':!![]};return rp(_0x427b94)[_0xeeeb('0x9')](function(_0x41847e){var _0x1f88ea={'method':_0xeeeb('0x3'),'uri':url[_0xeeeb('0x4')](_0xb434b3[_0xeeeb('0xa')],_0xeeeb('0xb')),'body':{'type':_0xb434b3['ndaactivity_type']||'message','channelId':_0xeeeb('0xc'),'conversation':{'id':_0x1a1a35[_0xeeeb('0xd')]},'from':{'id':_0x1a1a35[_0xeeeb('0xe')],'name':_0x1a1a35['calleridname']},'recipient':{'id':_0x1a1a35[_0xeeeb('0xf')],'name':_0x1a1a35[_0xeeeb('0x10')]},'text':_0xb434b3[_0xeeeb('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x41847e[_0xeeeb('0x12')]},'json':!![]};if(_0xb434b3['project']){_0x1f88ea['body'][_0xeeeb('0x13')][_0xeeeb('0x14')]=_0xb434b3[_0xeeeb('0x15')];}if(_0xb434b3[_0xeeeb('0x16')]=='1'){_0x1f88ea[_0xeeeb('0x17')][_0xeeeb('0x13')][_0xeeeb('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xeeeb('0x19')};}if(_0xb434b3[_0xeeeb('0x1a')]){_0x1f88ea[_0xeeeb('0x17')][_0xeeeb('0x13')][_0xeeeb('0x1b')]=_0xb434b3[_0xeeeb('0x1a')];if(_0xb434b3[_0xeeeb('0x1c')]){_0x1f88ea[_0xeeeb('0x17')][_0xeeeb('0x13')][_0xeeeb('0x1d')]=_0xb434b3[_0xeeeb('0x1c')];}}logger[_0xeeeb('0x1e')](JSON[_0xeeeb('0x1f')](_0x1f88ea));return rp(_0x1f88ea);});}; \ 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 a07af0f..4a0a705 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 _0x7ba7=['exports','./lib/api'];(function(_0x326d35,_0x4f65b3){var _0xd3f8f3=function(_0x1fbbaf){while(--_0x1fbbaf){_0x326d35['push'](_0x326d35['shift']());}};_0xd3f8f3(++_0x4f65b3);}(_0x7ba7,0xf3));var _0x77ba=function(_0xce3a0b,_0x5b271b){_0xce3a0b=_0xce3a0b-0x0;var _0x1ca1b9=_0x7ba7[_0xce3a0b];return _0x1ca1b9;};'use strict';var asr=require(_0x77ba('0x0'));module[_0x77ba('0x1')]=function(_0xa47b58,_0xc83a53,_0x340e98,_0x306444){return asr(_0xa47b58,_0xc83a53,_0x340e98,_0x306444);}; \ No newline at end of file +var _0x6bc4=['./lib/api','exports'];(function(_0x5329c4,_0x2c5ea2){var _0x4c4d5a=function(_0x5d6dbf){while(--_0x5d6dbf){_0x5329c4['push'](_0x5329c4['shift']());}};_0x4c4d5a(++_0x2c5ea2);}(_0x6bc4,0x134));var _0x46bc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6bc4[_0x14add3];return _0x4a174f;};'use strict';var asr=require(_0x46bc('0x0'));module[_0x46bc('0x1')]=function(_0x563f66,_0x377fce,_0x27b510,_0x20d3c0){return asr(_0x563f66,_0x377fce,_0x27b510,_0x20d3c0);}; \ 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 7aa75d1..fecb1ab 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 _0x842c=['Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','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','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','send','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0x2429ee,_0x207a39){var _0x2851bd=function(_0x1f38d7){while(--_0x1f38d7){_0x2429ee['push'](_0x2429ee['shift']());}};_0x2851bd(++_0x207a39);}(_0x842c,0x120));var _0xc842=function(_0x328335,_0x1d68bb){_0x328335=_0x328335-0x0;var _0x95bfd=_0x842c[_0x328335];return _0x95bfd;};'use strict';var BPromise=require(_0xc842('0x0'));var _=require(_0xc842('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xc842('0x2'));var logger=require(_0xc842('0x3'))('agi');module['exports']=function(_0x3a73d0,_0x1a2c94,_0x316532,_0xd7ea1f){return new BPromise(function(_0x2af466,_0x2b3cfe){logger[_0xc842('0x4')]('Tilde\x20URI',_0xd7ea1f||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x476bf7=new WebSocket(_0xd7ea1f||_0xc842('0x5'),{'perMessageDeflate':![]});var _0x1d5961='';var _0xea7d54='0';var _0x1c86a9='1';var _0x538d1e=_0xc842('0x6');function _0x2b040c(_0xb06f6b){var _0x2f1cac=crypto[_0xc842('0x7')](_0xc842('0x8'));_0x2f1cac['update'](_0xb06f6b);return _0x2f1cac['digest'](_0xc842('0x9'));}function _0x22ad66(){try{logger['info'](_0xc842('0xa'));var _0x17b0df=moment()[_0xc842('0xb')]();var _0x5327d0=_0x2b040c(_0x17b0df+_0x1a2c94+_0x316532);_0x476bf7['send'](JSON['stringify']({'appID':_0x1a2c94,'timestamp':_0x17b0df,'appKey':_0x5327d0}));var _0x320ca7=fs[_0xc842('0xc')](_0x3a73d0);_0x320ca7['on'](_0xc842('0xd'),function(_0x2a462e){_0x476bf7[_0xc842('0xe')](_0x2a462e);});_0x320ca7['on'](_0xc842('0xf'),function(){_0x476bf7[_0xc842('0xe')](_0xc842('0x10'));});}catch(_0x5805f5){logger['error'](_0xc842('0x11'),JSON[_0xc842('0x12')](_0x5805f5));_0x476bf7[_0xc842('0x13')]();}}function _0x2b46c0(_0x43b29d){try{if(_0x43b29d){var _0x3af8c0=JSON['parse'](_0x43b29d);switch(_0x3af8c0['status']){case 0x0:if(_0x3af8c0[_0xc842('0x14')]){if(_0x3af8c0[_0xc842('0x14')][_0xc842('0x15')]){logger[_0xc842('0x4')](_0xc842('0x16'),JSON[_0xc842('0x12')](_0x3af8c0['result'][_0xc842('0x17')]));_0x1d5961=_0x3af8c0[_0xc842('0x14')][_0xc842('0x17')][0x0][_0xc842('0x18')];_0xea7d54=_0x3af8c0[_0xc842('0x14')][_0xc842('0x17')][0x0]['likelihood'];_0x1c86a9='0';_0x538d1e='Success.';_0x476bf7[_0xc842('0x13')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1c86a9='1';_0x538d1e=_0xc842('0x6');break;case 0x2:logger[_0xc842('0x4')](_0xc842('0x19'));_0x1c86a9='2';_0x538d1e=_0xc842('0x19');break;case 0x9:logger[_0xc842('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x1c86a9='9';_0x538d1e=_0xc842('0x1a');break;case 0xa:logger['info'](_0xc842('0x1b'));_0x1c86a9='10';_0x538d1e='Authentication\x20failed.';break;case 0xb:logger[_0xc842('0x4')](_0xc842('0x1c'));_0x1c86a9='11';_0x538d1e=_0xc842('0x1c');}}}catch(_0x34ec81){logger[_0xc842('0x1d')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xc842('0x12')](_0x34ec81));_0x476bf7[_0xc842('0x13')]();}}function _0x815f8(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x2af466({'transcript':_0x1d5961,'confidence':_0xea7d54,'status':_0x1c86a9,'status_message':_0x538d1e});}function _0x12acb1(_0x39bea1){logger[_0xc842('0x1d')](_0xc842('0x1e'));if(!_[_0xc842('0x1f')](_0x39bea1)){logger[_0xc842('0x1d')](_[_0xc842('0x20')](_0x39bea1)?JSON[_0xc842('0x12')](_0x39bea1):_0x39bea1);}}_0x476bf7['on'](_0xc842('0x21'),_0x22ad66);_0x476bf7['on'](_0xc842('0x22'),_0x2b46c0);_0x476bf7['on'](_0xc842('0xf'),_0x815f8);_0x476bf7['on'](_0xc842('0x1d'),_0x12acb1);});}; \ No newline at end of file +var _0x0c09=['Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','hex'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x0c09,0xbd));var _0x90c0=function(_0x5f207c,_0x3325f4){_0x5f207c=_0x5f207c-0x0;var _0x4a8a9c=_0x0c09[_0x5f207c];return _0x4a8a9c;};'use strict';var BPromise=require(_0x90c0('0x0'));var _=require(_0x90c0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x90c0('0x2'));var logger=require(_0x90c0('0x3'))(_0x90c0('0x4'));module[_0x90c0('0x5')]=function(_0x374f93,_0x31fc02,_0x1b2753,_0x3bf4a4){return new BPromise(function(_0x2a1d5f,_0x49c704){logger['info'](_0x90c0('0x6'),_0x3bf4a4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1fdb9a=new WebSocket(_0x3bf4a4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x50a004='';var _0x48f759='0';var _0x42f0bd='1';var _0x2fe724=_0x90c0('0x7');function _0x441150(_0x555b4f){var _0xa21190=crypto[_0x90c0('0x8')]('sha1');_0xa21190['update'](_0x555b4f);return _0xa21190[_0x90c0('0x9')](_0x90c0('0xa'));}function _0x28e6d9(){try{logger['info'](_0x90c0('0xb'));var _0x2312d5=moment()[_0x90c0('0xc')]();var _0x2a893c=_0x441150(_0x2312d5+_0x31fc02+_0x1b2753);_0x1fdb9a[_0x90c0('0xd')](JSON[_0x90c0('0xe')]({'appID':_0x31fc02,'timestamp':_0x2312d5,'appKey':_0x2a893c}));var _0x448510=fs['createReadStream'](_0x374f93);_0x448510['on'](_0x90c0('0xf'),function(_0x1c3d69){_0x1fdb9a[_0x90c0('0xd')](_0x1c3d69);});_0x448510['on'](_0x90c0('0x10'),function(){_0x1fdb9a[_0x90c0('0xd')](_0x90c0('0x11'));});}catch(_0x1f35a9){logger[_0x90c0('0x12')](_0x90c0('0x13'),JSON['stringify'](_0x1f35a9));_0x1fdb9a['terminate']();}}function _0x10d091(_0x2aaa29){try{if(_0x2aaa29){var _0x313e34=JSON[_0x90c0('0x14')](_0x2aaa29);switch(_0x313e34[_0x90c0('0x15')]){case 0x0:if(_0x313e34[_0x90c0('0x16')]){if(_0x313e34[_0x90c0('0x16')][_0x90c0('0x17')]){logger[_0x90c0('0x18')](_0x90c0('0x19'),JSON['stringify'](_0x313e34[_0x90c0('0x16')][_0x90c0('0x1a')]));_0x50a004=_0x313e34['result']['hypotheses'][0x0]['transcript'];_0x48f759=_0x313e34['result'][_0x90c0('0x1a')][0x0][_0x90c0('0x1b')];_0x42f0bd='0';_0x2fe724=_0x90c0('0x1c');_0x1fdb9a['terminate']();}}break;case 0x1:logger[_0x90c0('0x18')](_0x90c0('0x7'));_0x42f0bd='1';_0x2fe724='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x90c0('0x18')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x42f0bd='2';_0x2fe724=_0x90c0('0x1d');break;case 0x9:logger[_0x90c0('0x18')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x42f0bd='9';_0x2fe724=_0x90c0('0x1e');break;case 0xa:logger[_0x90c0('0x18')](_0x90c0('0x1f'));_0x42f0bd='10';_0x2fe724=_0x90c0('0x1f');break;case 0xb:logger[_0x90c0('0x18')](_0x90c0('0x20'));_0x42f0bd='11';_0x2fe724=_0x90c0('0x20');}}}catch(_0x41912f){logger['error'](_0x90c0('0x21'),JSON[_0x90c0('0xe')](_0x41912f));_0x1fdb9a[_0x90c0('0x22')]();}}function _0x49a085(){logger[_0x90c0('0x18')](_0x90c0('0x23'));_0x2a1d5f({'transcript':_0x50a004,'confidence':_0x48f759,'status':_0x42f0bd,'status_message':_0x2fe724});}function _0x27264f(_0x505054){logger[_0x90c0('0x12')](_0x90c0('0x24'));if(!_[_0x90c0('0x25')](_0x505054)){logger[_0x90c0('0x12')](_[_0x90c0('0x26')](_0x505054)?JSON['stringify'](_0x505054):_0x505054);}}_0x1fdb9a['on'](_0x90c0('0x27'),_0x28e6d9);_0x1fdb9a['on']('message',_0x10d091);_0x1fdb9a['on']('close',_0x49a085);_0x1fdb9a['on'](_0x90c0('0x12'),_0x27264f);});}; \ 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 8ffc9ce..e40c52d 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 _0x56ca=['exports','./asr'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x56ca,0xff));var _0xa56c=function(_0x1a4b85,_0x15495a){_0x1a4b85=_0x1a4b85-0x0;var _0x549c6b=_0x56ca[_0x1a4b85];return _0x549c6b;};var asr=require(_0xa56c('0x0'));module[_0xa56c('0x1')]={'asr':asr}; \ No newline at end of file +var _0x47cd=['./asr','exports'];(function(_0x56c93c,_0x3cfe76){var _0x2796e7=function(_0x1d3c3a){while(--_0x1d3c3a){_0x56c93c['push'](_0x56c93c['shift']());}};_0x2796e7(++_0x3cfe76);}(_0x47cd,0x11e));var _0xd47c=function(_0xa0469e,_0x316873){_0xa0469e=_0xa0469e-0x0;var _0x1093c1=_0x47cd[_0xa0469e];return _0x1093c1;};var asr=require(_0xd47c('0x0'));module[_0xd47c('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e7c7428..e4346c2 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 _0xf3d7=['listen','listening','emit','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','inherits','exports','net','EventEmitter','./error','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT'];(function(_0x2534ba,_0x4792a4){var _0x456ce6=function(_0x2234ce){while(--_0x2234ce){_0x2534ba['push'](_0x2534ba['shift']());}};_0x456ce6(++_0x4792a4);}(_0xf3d7,0x19d));var _0x7f3d=function(_0xd06a8b,_0x3ce43e){_0xd06a8b=_0xd06a8b-0x0;var _0xe9b203=_0xf3d7[_0xd06a8b];return _0xe9b203;};'use strict';var util=require('util');var net=require(_0x7f3d('0x0'));var EventEmitter=require('events')[_0x7f3d('0x1')];var AGIError=require(_0x7f3d('0x2'));var AGIChannel=require(_0x7f3d('0x3'));var AGIServer=function(_0x2993dc,_0x3f7e65,_0x3ab912){var _0x3f76ad=this,_0x2993dc=_0x2993dc||0x11dd,_0x3f7e65=_0x3f7e65||_0x7f3d('0x4'),_0x4c2f84=null,_0x214ece=0x0;EventEmitter[_0x7f3d('0x5')](_0x3f76ad);function _0x5c4a24(){if(!_0x2993dc){_0x3f76ad['emit']('error',new AGIError(_0x7f3d('0x6')));return![];}_0x4c2f84=net['createServer']();_0x4c2f84[_0x7f3d('0x7')](_0x2993dc,_0x3f7e65);_0x4c2f84['on'](_0x7f3d('0x8'),function(){_0x3f76ad[_0x7f3d('0x9')](_0x7f3d('0x8'));});_0x4c2f84['on']('connection',function(_0x365791){_0x4c2f84[_0x7f3d('0xa')](function(_0x38b03a,_0x1499e8){if(_0x38b03a){_0x3f76ad[_0x7f3d('0x9')](_0x7f3d('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x38b03a));}else if(_0x3ab912&&_0x3ab912<0x0){_0x3f76ad['emit'](_0x7f3d('0xb'),new AGIError(_0x7f3d('0xc')));_0x365791['destroy']();}else if(_0x3ab912&&_0x3ab912>0x0&&_0x3ab912<_0x1499e8){_0x214ece+=0x1;_0x3f76ad[_0x7f3d('0x9')](_0x7f3d('0xb'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x214ece));_0x365791[_0x7f3d('0xd')]();}else{var _0x23ee52=new AGIChannel(_0x365791);_0x23ee52['on']('ready',function(){_0x3f76ad[_0x7f3d('0x9')]('connection',_0x23ee52);});}});});_0x4c2f84['on'](_0x7f3d('0xb'),function(_0x59b113){_0x3f76ad[_0x7f3d('0x9')]('error',new AGIError(_0x7f3d('0xe'),_0x59b113[_0x7f3d('0xf')]));});_0x4c2f84['on'](_0x7f3d('0x10'),function(){_0x3f76ad[_0x7f3d('0x9')](_0x7f3d('0x10'),new AGIError(_0x7f3d('0x11')));});}process['nextTick'](function(){_0x5c4a24();});};util[_0x7f3d('0x12')](AGIServer,EventEmitter);module[_0x7f3d('0x13')]=function(_0x2e7b3d,_0x124746,_0x14e392){return new AGIServer(_0x2e7b3d,_0x124746,_0x14e392);}; \ No newline at end of file +var _0x3050=['close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','ready','code'];(function(_0x56236c,_0x57cce8){var _0x140a7=function(_0x2dc810){while(--_0x2dc810){_0x56236c['push'](_0x56236c['shift']());}};_0x140a7(++_0x57cce8);}(_0x3050,0x1ae));var _0x0305=function(_0x1dc3b2,_0x2b2a3b){_0x1dc3b2=_0x1dc3b2-0x0;var _0x298d84=_0x3050[_0x1dc3b2];return _0x298d84;};'use strict';var util=require(_0x0305('0x0'));var net=require('net');var EventEmitter=require(_0x0305('0x1'))[_0x0305('0x2')];var AGIError=require(_0x0305('0x3'));var AGIChannel=require(_0x0305('0x4'));var AGIServer=function(_0x4aa790,_0x2ce843,_0x196e1f){var _0x41e2a4=this,_0x4aa790=_0x4aa790||0x11dd,_0x2ce843=_0x2ce843||_0x0305('0x5'),_0x489a2e=null,_0x362618=0x0;EventEmitter[_0x0305('0x6')](_0x41e2a4);function _0xc2cf42(){if(!_0x4aa790){_0x41e2a4[_0x0305('0x7')](_0x0305('0x8'),new AGIError(_0x0305('0x9')));return![];}_0x489a2e=net[_0x0305('0xa')]();_0x489a2e[_0x0305('0xb')](_0x4aa790,_0x2ce843);_0x489a2e['on'](_0x0305('0xc'),function(){_0x41e2a4[_0x0305('0x7')](_0x0305('0xc'));});_0x489a2e['on'](_0x0305('0xd'),function(_0x3c0ec5){_0x489a2e[_0x0305('0xe')](function(_0x144e39,_0x338502){if(_0x144e39){_0x41e2a4[_0x0305('0x7')](_0x0305('0x8'),new AGIError(_0x0305('0xf'),_0x144e39));}else if(_0x196e1f&&_0x196e1f<0x0){_0x41e2a4[_0x0305('0x7')](_0x0305('0x8'),new AGIError(_0x0305('0x10')));_0x3c0ec5['destroy']();}else if(_0x196e1f&&_0x196e1f>0x0&&_0x196e1f<_0x338502){_0x362618+=0x1;_0x41e2a4[_0x0305('0x7')]('error',new AGIError(_0x0305('0x11'),_0x362618));_0x3c0ec5['destroy']();}else{var _0x5b9c49=new AGIChannel(_0x3c0ec5);_0x5b9c49['on'](_0x0305('0x12'),function(){_0x41e2a4[_0x0305('0x7')](_0x0305('0xd'),_0x5b9c49);});}});});_0x489a2e['on'](_0x0305('0x8'),function(_0x19af9a){_0x41e2a4[_0x0305('0x7')](_0x0305('0x8'),new AGIError(_0x0305('0xf'),_0x19af9a[_0x0305('0x13')]));});_0x489a2e['on'](_0x0305('0x14'),function(){_0x41e2a4[_0x0305('0x7')](_0x0305('0x14'),new AGIError(_0x0305('0x15')));});}process[_0x0305('0x16')](function(){_0xc2cf42();});};util[_0x0305('0x17')](AGIServer,EventEmitter);module[_0x0305('0x18')]=function(_0x4b1e06,_0x17ab29,_0x144aa0){return new AGIServer(_0x4b1e06,_0x17ab29,_0x144aa0);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4be8a8e..899631b 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 _0x5924=['no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','recordFile','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','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','failure','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueueById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','isConfigured','exec','MRCPSynth','result','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','out','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','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'];(function(_0x2ffd40,_0x66e6e){var _0x2d13b2=function(_0x4db30b){while(--_0x4db30b){_0x2ffd40['push'](_0x2ffd40['shift']());}};_0x2d13b2(++_0x66e6e);}(_0x5924,0xa2));var _0x4592=function(_0x3dc6f4,_0x362e2a){_0x3dc6f4=_0x3dc6f4-0x0;var _0x3b18e9=_0x5924[_0x3dc6f4];return _0x3b18e9;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x4592('0x0'));var _=require(_0x4592('0x1'));var sh=require(_0x4592('0x2'));var odbc=require('odbc')();var rs=require(_0x4592('0x3'));var moment=require(_0x4592('0x4'));var Mustache=require(_0x4592('0x5'));var rp=require(_0x4592('0x6'));var logger=require(_0x4592('0x7'))(_0x4592('0x8'));var config=require(_0x4592('0x9'));var scripts=require(_0x4592('0xa'));var FILES_PATH=_0x4592('0xb');var recursiveMapAttributes=[_0x4592('0xc'),_0x4592('0xd')];var verticesWithRetry=[_0x4592('0xe'),_0x4592('0xf'),_0x4592('0x10')];var AGIVertices=function(_0x5da366,_0x2e58e6,_0x1a7300){this[_0x4592('0x11')]=_0x5da366;this[_0x4592('0x12')]=_0x2e58e6;this[_0x4592('0x13')]=_0x1a7300;};AGIVertices[_0x4592('0x14')][_0x4592('0x15')]=function(_0x1d3455,_0x3cebdd){this[_0x4592('0x12')]['getVariableById'](_0x1d3455)[_0x4592('0x16')](function(_0x2bab91){_0x3cebdd(null,_0x2bab91?_0x2bab91[_0x4592('0x17')]:![]);})[_0x4592('0x18')](function(_0x250fe9){_0x3cebdd(_0x250fe9);});};AGIVertices[_0x4592('0x14')]['getVoiceQueue']=function(_0x407edf,_0x20f04f){this[_0x4592('0x12')][_0x4592('0x19')](_0x407edf)[_0x4592('0x16')](function(_0x324b1d){_0x20f04f(null,_0x324b1d?_0x324b1d[_0x4592('0x17')]:![]);})[_0x4592('0x18')](function(_0x1c67b5){_0x20f04f(_0x1c67b5);});};AGIVertices[_0x4592('0x14')]['getSquareProject']=function(_0x457fe7,_0x2fef18){this[_0x4592('0x12')]['getSquareProjectById'](_0x457fe7)[_0x4592('0x16')](function(_0x450b4b){_0x2fef18(null,_0x450b4b?_0x450b4b[_0x4592('0x17')]:![]);})['catch'](function(_0x4a0fa7){_0x2fef18(_0x4a0fa7);});};AGIVertices[_0x4592('0x14')]['getSquareOdbc']=function(_0xc8ab70,_0xe8a31b){this['rpc']['getSquareOdbcById'](_0xc8ab70)[_0x4592('0x16')](function(_0x11c0b7){_0xe8a31b(null,_0x11c0b7?_0x11c0b7[_0x4592('0x1a')]:![]);})[_0x4592('0x18')](function(_0x5262e9){_0xe8a31b(_0x5262e9);});};AGIVertices[_0x4592('0x14')][_0x4592('0x1b')]=function(_0x50ee5d,_0x4cac48){this[_0x4592('0x12')][_0x4592('0x1c')](_0x50ee5d)[_0x4592('0x16')](function(_0x404ec6){_0x4cac48(null,_0x404ec6?_0x404ec6[_0x4592('0x17')]:![]);})[_0x4592('0x18')](function(_0x33521b){_0x4cac48(_0x33521b);});};AGIVertices['prototype'][_0x4592('0x1d')]=function(_0x201d6e,_0x2e6296){this[_0x4592('0x12')][_0x4592('0x1e')](_0x201d6e)['then'](function(_0x4180c5){_0x2e6296(null,_0x4180c5?_0x4180c5[_0x4592('0x17')]:![]);})[_0x4592('0x18')](function(_0x5ab7fe){_0x2e6296(_0x5ab7fe);});};AGIVertices[_0x4592('0x14')][_0x4592('0x1f')]=function(_0x35719e,_0x36c8fa){var _0x187222=this;this[_0x4592('0x12')][_0x4592('0x20')](_0x35719e)[_0x4592('0x16')](function(_0x5a4d80){_0x36c8fa(null,_0x5a4d80?_0x187222[_0x4592('0x21')](_0x5a4d80['save_name']):![]);})['catch'](function(_0x4ecbcc){_0x36c8fa(_0x4ecbcc);});};AGIVertices['prototype'][_0x4592('0x22')]=function(_0x140fdf,_0x10eda7){this['rpc'][_0x4592('0x23')](_0x140fdf)[_0x4592('0x16')](function(_0x3013b5){_0x10eda7(null,_0x3013b5?_0x3013b5:![]);})[_0x4592('0x18')](function(_0x59cb0a){_0x10eda7(_0x59cb0a);});};AGIVertices[_0x4592('0x14')][_0x4592('0x24')]=function(_0x224264,_0x8d483b,_0x4c8042){this[_0x4592('0x13')]['sendMailMessage'](_0x224264,_0x8d483b)[_0x4592('0x16')](function(){_0x4c8042(null);})[_0x4592('0x18')](function(_0x11a7c4){_0x4c8042(_0x11a7c4);});};AGIVertices[_0x4592('0x14')][_0x4592('0x25')]=function(_0xb1f98e,_0x25b969){this[_0x4592('0x12')][_0x4592('0x26')](_0xb1f98e)['then'](function(_0x3947ca){if(_0x3947ca){if(_0x3947ca[_0x4592('0x27')]){_0x25b969(null,[_0x3947ca[_0x4592('0x28')]]);}else{_0x25b969(null,_[_0x4592('0x29')](_0x3947ca[_0x4592('0x2a')],_0x4592('0x28')));}}else{_0x25b969(null,![]);}})[_0x4592('0x18')](function(_0x2cfeff){_0x25b969(_0x2cfeff);});};AGIVertices[_0x4592('0x14')]['getSoundPath']=function(_0x353aad){return util[_0x4592('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x353aad);};AGIVertices[_0x4592('0x14')][_0x4592('0x2c')]=function(_0x2e5a6b,_0x1f318a,_0x439c67){odbc[_0x4592('0x2d')](_0x2e5a6b,function(_0x717000){if(_0x717000){logger['error'](_0x4592('0x2e'),_0x717000);_0x439c67(_0x717000);}else{logger['info'](_0x4592('0x2f'));odbc[_0x4592('0x30')](_0x1f318a,function(_0x396a6b,_0xcff94a){if(_0x396a6b){logger[_0x4592('0x31')](_0x4592('0x32'),_0x1f318a);_0x439c67(_0x396a6b);}else{logger[_0x4592('0x31')](_0x4592('0x33'),_0x1f318a);odbc['close'](function(_0x21fff3){if(_0x21fff3){logger[_0x4592('0x34')](_0x4592('0x35'),_0x21fff3);}_0x439c67(null,_0xcff94a);});}});}});};AGIVertices[_0x4592('0x14')][_0x4592('0x36')]=function(_0x492adc,_0x493452){this[_0x4592('0x12')][_0x4592('0x37')](_0x492adc)[_0x4592('0x16')](function(_0x438987){_0x493452(null,_0x438987?_0x438987:![]);})[_0x4592('0x18')](function(_0x10baf0){_0x493452(_0x10baf0);});};AGIVertices[_0x4592('0x14')]['createSmsMessage']=function(_0x4571e1,_0x55f3b4){this[_0x4592('0x12')][_0x4592('0x38')](_0x4571e1)[_0x4592('0x16')](function(_0x2e2e9f){_0x55f3b4(null,_0x2e2e9f);})[_0x4592('0x18')](function(_0x1cf8ce){_0x55f3b4(_0x1cf8ce);});};AGIVertices[_0x4592('0x14')][_0x4592('0x39')]=function(_0x3da1d0,_0x4db3c4,_0x41b864){this[_0x4592('0x12')][_0x4592('0x39')]({'uniqueid':this['channel'][_0x4592('0x3a')],'node':_0x3da1d0[_0x4592('0x3b')],'application':_0x3da1d0[_0x4592('0x3c')],'data':_0x4db3c4||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0x4592('0x3d')]})[_0x4592('0x16')](function(_0x7eac1b){if(_0x41b864){_0x41b864(null,_0x7eac1b);}})[_0x4592('0x18')](function(_0x2ffb81){if(_0x41b864){_0x41b864(_0x2ffb81);}});};AGIVertices[_0x4592('0x14')]['createSquareRecording']=function(_0x4ddd87,_0xac7b10,_0x3afd78,_0x5999a0){this['rpc'][_0x4592('0x3e')]({'uniqueid':this[_0x4592('0x11')]['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this[_0x4592('0x11')][_0x4592('0x3f')],'context':this[_0x4592('0x11')][_0x4592('0x40')],'extension':this[_0x4592('0x11')][_0x4592('0x41')],'priority':this[_0x4592('0x11')][_0x4592('0x42')],'accountcode':this[_0x4592('0x11')][_0x4592('0x43')],'dnid':this['channel'][_0x4592('0x44')],'projectName':this['channel'][_0x4592('0x45')],'saveName':_0xac7b10,'filename':_0x4ddd87[_0x4592('0x46')]||_0xac7b10,'savePath':_0x3afd78})['then'](function(_0xf01410){_0x5999a0(null,_0xf01410);})['catch'](function(_0x5ed9f5){_0x5999a0(_0x5ed9f5);});};AGIVertices['prototype']['createSquareMessage']=function(_0xea49e0,_0x563a7f,_0x44ad7a,_0x418364,_0xffd6b8){this[_0x4592('0x12')][_0x4592('0x47')]({'uniqueid':this[_0x4592('0x11')]['uniqueid'],'body':_0xea49e0,'direction':_0x563a7f,'providerName':_0x44ad7a,'providerResponse':_0x418364})[_0x4592('0x16')](function(_0x4f7382){if(_0xffd6b8){_0xffd6b8(null,_0x4f7382);}})[_0x4592('0x18')](function(_0x89ec6a){if(_0xffd6b8){_0xffd6b8(_0x89ec6a);}});};AGIVertices[_0x4592('0x14')][_0x4592('0x48')]=function(_0x28d500,_0x302a18){this[_0x4592('0x12')][_0x4592('0x48')]({'firstName':_[_0x4592('0x49')](_0x28d500[_0x4592('0x17')])||_[_0x4592('0x4a')](_0x28d500[_0x4592('0x17')])?_0x4592('0x4b')+Math[_0x4592('0x4c')]():_0x28d500[_0x4592('0x17')],'lastName':_[_0x4592('0x49')](_0x28d500[_0x4592('0x4d')])||_[_0x4592('0x4a')](_0x28d500[_0x4592('0x4d')])?null:_0x28d500[_0x4592('0x4d')],'phone':_0x28d500[_0x4592('0x4e')],'ListId':_0x28d500[_0x4592('0x4f')],'scheduledat':_0x28d500['scheduledAt'],'callbackUniqueid':this[_0x4592('0x11')][_0x4592('0x3a')],'tags':'callback','description':_0x4592('0x50')+_0x28d500[_0x4592('0x51')][_0x4592('0x52')](),'priority':_0x28d500[_0x4592('0x53')]})['then'](function(_0x35f82b){_0x302a18(null,_0x35f82b);})['catch'](function(_0x4ddadf){_0x302a18(_0x4ddadf);});};AGIVertices[_0x4592('0x14')][_0x4592('0x54')]=function(_0x587aa9,_0xec8f7f){this[_0x4592('0x12')][_0x4592('0x55')](_0x587aa9)[_0x4592('0x16')](function(_0x2e082c){_0xec8f7f(null,_0x2e082c?_0x2e082c['name']:![]);})[_0x4592('0x18')](function(_0x48dead){_0xec8f7f(_0x48dead);});};AGIVertices['prototype'][_0x4592('0x56')]=function(_0x218d3a,_0x157c65,_0x2fd2dd){var _0x48f66a={'role':_0x4592('0x57')};_0x48f66a[_0x218d3a]=this[_0x4592('0x11')][_0x4592('0x3d')];this[_0x4592('0x12')][_0x4592('0x56')](_0x48f66a,_0x157c65,this[_0x4592('0x11')]['uniqueid'])[_0x4592('0x16')](function(_0x38bac7){_0x2fd2dd(null,_[_0x4592('0x4a')](_0x38bac7)?![]:!![]);})[_0x4592('0x18')](function(_0x158331){logger[_0x4592('0x34')](_0x158331);_0x2fd2dd(null,![]);});};AGIVertices[_0x4592('0x14')][_0x4592('0x58')]=function(_0x4e4821,_0x436be0){var _0x105080={'role':_0x4592('0x57')};_0x105080[_0x4e4821]=this['channel'][_0x4592('0x3d')];this[_0x4592('0x12')][_0x4592('0x58')](_0x105080)['then'](function(_0x17c746){_0x436be0(null,_[_0x4592('0x4a')](_0x17c746)?![]:!![]);})[_0x4592('0x18')](function(_0x154c0f){logger['error'](_0x154c0f);_0x436be0(null,![]);});};AGIVertices['prototype'][_0x4592('0x59')]=function(_0x3f9a0d,_0x2f08d9){var _0x5a77cf={'role':_0x4592('0x57')};_0x5a77cf[_0x3f9a0d]=this['channel']['callerid'];this[_0x4592('0x12')][_0x4592('0x59')](_0x5a77cf)['then'](function(_0x494e55){_0x2f08d9(null,_[_0x4592('0x4a')](_0x494e55)?![]:!![]);})['catch'](function(_0x17e90f){logger[_0x4592('0x34')](_0x17e90f);_0x2f08d9(null,![]);});};AGIVertices[_0x4592('0x14')][_0x4592('0x5a')]=function(_0x195ad3,_0x2178c8){var _0x4f927d={'role':_0x4592('0x57')};_0x4f927d[_0x195ad3]=this[_0x4592('0x11')][_0x4592('0x3d')];var _0xc6141=_0x195ad3!=_0x4592('0x5b')?util[_0x4592('0x2b')]('%s/%s@from-sip/n','LOCAL',this[_0x4592('0x11')][_0x4592('0x3d')]):undefined;this[_0x4592('0x12')][_0x4592('0x5a')](_0x4f927d,_0xc6141)[_0x4592('0x16')](function(_0xef3f30){_0x2178c8(null,_[_0x4592('0x4a')](_0xef3f30)?![]:!![]);})['catch'](function(_0x378f58){logger['error'](_0x378f58);_0x2178c8(null,![]);});};AGIVertices[_0x4592('0x14')][_0x4592('0x5c')]=function(_0x20220b,_0x448e81){sh['exec'](_[_0x4592('0x5d')](_0x20220b),function(_0x58b226,_0x5ac09b){var _0x12fb8f=_0x5ac09b['replace'](/(\r\n|\n|\r)/gm,'');_0x448e81(null,_0x12fb8f);});};AGIVertices[_0x4592('0x14')][_0x4592('0x5e')]=function(_0x52fff3,_0x2e2970){scripts[_0x4592('0x5e')](_0x52fff3[_0x4592('0x5f')],_0x52fff3[_0x4592('0x60')]||'text',_0x52fff3[_0x4592('0x61')],_0x52fff3[_0x4592('0x62')]||'en-US',_0x52fff3[_0x4592('0x63')]||'MALE',_0x52fff3[_0x4592('0x64')]||_0x4592('0x65'))[_0x4592('0x16')](function(_0x38aa7d){_0x2e2970(null,_0x38aa7d);})[_0x4592('0x18')](function(_0x5db34d){_0x2e2970(_0x5db34d);});};AGIVertices[_0x4592('0x14')][_0x4592('0x66')]=function(_0x1b6eee,_0x16e35c){scripts['googleTTS'](_0x1b6eee[_0x4592('0x61')],_0x1b6eee[_0x4592('0x67')]||'en',0x1)[_0x4592('0x16')](function(_0x5c2271){_0x16e35c(null,_0x5c2271);})[_0x4592('0x18')](function(_0x2da330){_0x16e35c(_0x2da330);});};AGIVertices[_0x4592('0x14')]['restAPI']=function(_0x43e74d,_0x4e59bc){var _0x47d4b2={'uri':_0x43e74d[_0x4592('0x68')],'method':_0x43e74d[_0x4592('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x43e74d[_0x4592('0x6a')])===_0x4592('0x6b')&&parseInt(_0x43e74d['timeout'])>=0x1?parseInt(_0x43e74d['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x4592('0x6c')]([_0x4592('0x6d'),_0x4592('0x6e')],_0x47d4b2[_0x4592('0x69')]['toUpperCase']())){try{_0x47d4b2[_0x4592('0x6f')]=_0x43e74d[_0x4592('0xd')]?JSON[_0x4592('0x70')](_0x43e74d[_0x4592('0xd')]):{};}catch(_0x14ae0c){logger[_0x4592('0x34')](_0x4592('0x71'),_0x14ae0c);}}try{_0x47d4b2[_0x4592('0x72')]=_0x43e74d[_0x4592('0xc')]?JSON[_0x4592('0x70')](_0x43e74d['rawHeaders']):{};}catch(_0x1e7f97){logger['error'](_0x4592('0x73'),_0x1e7f97);}if(_0x43e74d[_0x4592('0x74')]){try{var _0x2efc76=require(_0x43e74d[_0x4592('0x74')])[_0x4592('0x75')](this,_0x47d4b2);_0x47d4b2[_0x4592('0x76')]=Mustache['render'](_0x43e74d['url'],_0x2efc76,{},['$$','$$']);if(_0x47d4b2[_0x4592('0x72')]){_0x47d4b2[_0x4592('0x72')]=JSON[_0x4592('0x70')](Mustache[_0x4592('0x77')](JSON[_0x4592('0x78')](_0x47d4b2['headers']),_0x2efc76,{},['$$','$$']));}if(_0x47d4b2['body']){_0x47d4b2[_0x4592('0x6f')]=JSON[_0x4592('0x70')](Mustache['render'](JSON[_0x4592('0x78')](_0x47d4b2[_0x4592('0x6f')]),_0x2efc76,{},['$$','$$']));}}catch(_0x473c41){logger[_0x4592('0x34')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x473c41);}}rp(_0x47d4b2)[_0x4592('0x16')](function(_0x110f55){var _0x57c12d={'statusCode':_0x110f55['statusCode']||0xc8,'statusMessage':_0x110f55['statusMessage']||'OK','headers':_0x110f55['headers']||{},'body':_0x110f55[_0x4592('0x6f')]||{}};_0x4e59bc(null,_0x57c12d);})['catch'](function(_0x2299f3){var _0x1e6ae4={'statusCode':_0x2299f3[_0x4592('0x79')]||0x1f4,'statusMessage':_0x2299f3[_0x4592('0x7a')]||_0x4592('0x7b'),'headers':_0x2299f3[_0x4592('0x7c')][_0x4592('0x72')]||{},'body':_0x2299f3[_0x4592('0x7c')][_0x4592('0x6f')]||{}};_0x4e59bc(null,_0x1e6ae4);});};AGIVertices[_0x4592('0x14')][_0x4592('0x7d')]=function(_0x4700bf,_0x37dd52){scripts[_0x4592('0x7d')](this[_0x4592('0x11')][_0x4592('0x3a')],_0x4700bf[_0x4592('0x7e')],_0x4700bf[_0x4592('0x61')],_0x4700bf[_0x4592('0x7f')]||'en')[_0x4592('0x16')](function(_0x3837e7){_0x37dd52(null,_0x3837e7);})[_0x4592('0x18')](function(_0x494483){_0x37dd52(_0x494483);});};AGIVertices['prototype'][_0x4592('0x80')]=function(_0xdf2c87,_0xa38565){scripts[_0x4592('0x80')](this[_0x4592('0x11')][_0x4592('0x3a')],_0xdf2c87[_0x4592('0x81')],_0xdf2c87['client_email'],_0xdf2c87[_0x4592('0x82')],_0xdf2c87['text'],_0xdf2c87[_0x4592('0x83')]||'en')[_0x4592('0x16')](function(_0xfdd19c){_0xa38565(null,_0xfdd19c);})['catch'](function(_0x24f217){_0xa38565(_0x24f217);});};AGIVertices[_0x4592('0x14')][_0x4592('0x84')]=function(_0x236775,_0x5771e4){scripts[_0x4592('0x84')](this[_0x4592('0x11')],_0x236775)[_0x4592('0x16')](function(_0x3645c9){_0x5771e4(null,_0x3645c9);})['catch'](function(_0x5f4eed){_0x5771e4(_0x5f4eed);});};AGIVertices[_0x4592('0x14')][_0x4592('0x85')]=function(_0x27e163,_0x3596eb){scripts[_0x4592('0x85')](_0x27e163[_0x4592('0x7e')],_0x27e163[_0x4592('0x61')],_0x27e163[_0x4592('0x86')]||'en-US',_0x27e163[_0x4592('0x87')])[_0x4592('0x16')](function(_0x1080b6){_0x3596eb(null,_0x1080b6);})[_0x4592('0x18')](function(_0x34b6c6){_0x3596eb(_0x34b6c6);});};AGIVertices[_0x4592('0x14')][_0x4592('0x88')]=function(_0x24f600,_0x3d205a,_0x2509c4){scripts['ispeechASR'](_0x3d205a,_0x24f600[_0x4592('0x7e')],_0x24f600[_0x4592('0x89')]||_0x4592('0x8a'),this['isConfigured'](_0x24f600[_0x4592('0x8b')])?_0x24f600[_0x4592('0x8b')]:undefined)['then'](function(_0x39afae){_0x2509c4(null,_0x39afae);})['catch'](function(_0x32afcb){_0x2509c4(_0x32afcb);});};AGIVertices[_0x4592('0x14')][_0x4592('0x8c')]=function(_0x3ea03a,_0x3da05b){scripts[_0x4592('0x8c')](_0x3ea03a[_0x4592('0x8d')],_0x3ea03a['aws_secret_access_key'],_0x3ea03a[_0x4592('0x8e')],_0x3ea03a[_0x4592('0x8f')]||_0x4592('0x90'),_0x3ea03a[_0x4592('0x61')],_0x3ea03a[_0x4592('0x91')]||_0x4592('0x61'))[_0x4592('0x16')](function(_0x5d3806){_0x3da05b(null,_0x5d3806);})['catch'](function(_0x301dcc){_0x3da05b(_0x301dcc);});};AGIVertices['prototype'][_0x4592('0x92')]=function(_0x374f87,_0x875338){scripts[_0x4592('0x92')](this[_0x4592('0x11')][_0x4592('0x3a')],_0x374f87['aws_access_key_id'],_0x374f87[_0x4592('0x93')],_0x374f87[_0x4592('0x94')],_0x374f87[_0x4592('0x61')],_0x374f87[_0x4592('0x95')])[_0x4592('0x16')](function(_0x2c8fd0){_0x875338(null,_0x2c8fd0);})[_0x4592('0x18')](function(_0x21a35a){_0x875338(_0x21a35a);});};AGIVertices[_0x4592('0x14')]['googleASR']=function(_0x3a0864,_0x4756c4,_0x1b980d){scripts['googleASR'](_0x4756c4,_0x3a0864[_0x4592('0x7e')],_0x3a0864[_0x4592('0x96')]||_0x4592('0x8a'))[_0x4592('0x16')](function(_0x324673){_0x1b980d(null,_0x324673);})[_0x4592('0x18')](function(_0x15e2a6){_0x1b980d(_0x15e2a6);});};AGIVertices[_0x4592('0x14')]['tildeASR']=function(_0x236eee,_0x22656f,_0x219e2a){scripts[_0x4592('0x97')](_0x22656f,_0x236eee[_0x4592('0x98')],_0x236eee[_0x4592('0x99')],_0x236eee[_0x4592('0x76')])[_0x4592('0x16')](function(_0x3f2eb9){_0x219e2a(null,_0x3f2eb9);})['catch'](function(_0x2d7f43){_0x219e2a(_0x2d7f43);});};AGIVertices[_0x4592('0x14')]['clear']=function(_0x3dff5c){var _0x303c51=_[_0x4592('0x6c')](verticesWithRetry,_0x3dff5c[_0x4592('0x3c')])?_0x3dff5c:_[_0x4592('0x9a')](_0x3dff5c);for(var _0x431a4b in _0x303c51){if(_0x303c51[_0x4592('0x9b')](_0x431a4b)){if(_0x303c51[_0x431a4b]&&_[_0x4592('0x9c')](_0x303c51[_0x431a4b])){if(_['includes'](recursiveMapAttributes,_0x431a4b)){_0x303c51[_0x431a4b]=this[_0x4592('0x9d')](_0x303c51[_0x431a4b]);}else{_0x303c51[_0x431a4b]=this['replaceAllVariables'](_0x303c51[_0x431a4b]);}}}}return _0x303c51;};AGIVertices['prototype'][_0x4592('0x9e')]=function(_0x49637b){for(var _0x5966f1 in _0x49637b){if(_0x49637b['hasOwnProperty'](_0x5966f1)){if(_[_0x4592('0x9f')](_0x49637b[_0x5966f1])){this[_0x4592('0x9e')](_0x49637b[_0x5966f1]);}else if(_[_0x4592('0xa0')](_0x49637b[_0x5966f1])){for(var _0x69622e=0x0;_0x69622e<_0x49637b[_0x5966f1][_0x4592('0xa1')];_0x69622e++){this[_0x4592('0x9e')](_0x49637b[_0x5966f1][_0x69622e]);}}else if(_[_0x4592('0x9c')](_0x49637b[_0x5966f1])){_0x49637b[_0x5966f1]=this[_0x4592('0xa2')](_0x49637b[_0x5966f1]);}}}};AGIVertices[_0x4592('0x14')][_0x4592('0xa3')]=function(_0xfc2ffc,_0x207eae){for(var _0x4870f8 in _0xfc2ffc){if(_0xfc2ffc[_0x4592('0x9b')](_0x4870f8)){if(_[_0x4592('0x9f')](_0xfc2ffc[_0x4870f8])){if(!_['isEmpty'](_0xfc2ffc[_0x4870f8])){this[_0x4592('0xa3')](_0xfc2ffc[_0x4870f8],util['format']('%s.%s',_0x207eae,_0x4870f8));}}else if(_[_0x4592('0xa0')](_0xfc2ffc[_0x4870f8])){for(var _0x29fffb=0x0;_0x29fffb<_0xfc2ffc[_0x4870f8]['length'];_0x29fffb++){this['saveRestApiResult'](_0xfc2ffc[_0x4870f8][_0x29fffb],util['format'](_0x4592('0xa4'),_0x207eae,_0x4870f8+'['+_0x29fffb+']'));}}else{if(!_['isNil'](_0xfc2ffc[_0x4870f8])){this[_0x4592('0x11')][_0x4592('0xa5')](util[_0x4592('0x2b')](_0x4592('0xa4'),_0x207eae,_0x4870f8),_0xfc2ffc[_0x4870f8]);}}}}};AGIVertices[_0x4592('0x14')][_0x4592('0x9d')]=function(_0x3d2421){try{var _0x592c81=JSON[_0x4592('0x70')](_0x3d2421);this['recursiveNodeIndex'](_0x592c81);return JSON[_0x4592('0x78')](_0x592c81);}catch(_0x5d0ddb){return this[_0x4592('0xa2')](_0x3d2421);}};AGIVertices[_0x4592('0x14')][_0x4592('0xa2')]=function(_0x5845b3){var _0x26d5b=_0x5845b3[_0x4592('0xa6')]('{');for(var _0x3db068=0x1;_0x3db068<_0x26d5b['length'];_0x3db068+=0x1){var _0x106905=_0x26d5b[_0x3db068][_0x4592('0xa6')]('}');if(_0x106905['length']>0x1){_0x5845b3=_0x5845b3['replaceAll']('{'+_0x106905[0x0]+'}',this['channel'][_0x4592('0x15')](_0x106905[0x0])[_0x4592('0xa7')]||_0x106905[0x0]);}}if(_0x26d5b['length']===0x1){return _0x5845b3['toString']();}return this[_0x4592('0xa2')](_0x5845b3);};AGIVertices[_0x4592('0x14')]['getAndSetVariable']=function(_0x46ce65,_0x5b6414){var _0x36dc79=this[_0x4592('0x11')][_0x4592('0x15')](_0x46ce65);if(_0x36dc79['result']===-0x1){return _0x36dc79;}logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0xa8'),_0x5b6414,_0x36dc79[_0x4592('0xa7')]));return this['channel'][_0x4592('0xa5')](_0x5b6414,_0x36dc79[_0x4592('0xa7')]);};AGIVertices[_0x4592('0x14')]['isConfigured']=function(_0x1d4417){return _0x1d4417&&_0x1d4417!=='0'&&_0x1d4417!=='-1'&&_0x1d4417!=='';};AGIVertices[_0x4592('0x14')][_0x4592('0xa9')]=function(_0x1a970b){this[_0x4592('0x39')][_0x4592('0x75')](this,_0x1a970b,'-');_0x1a970b[_0x4592('0xaa')]=_0x1a970b[_0x4592('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4592('0x14')]['mrcpsynth']=function(_0x1b44a2){logger[_0x4592('0x31')](util['format'](_0x4592('0xab'),_0x1b44a2[_0x4592('0x3b')]));if(!this['isConfigured'](_0x1b44a2[_0x4592('0x61')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20text\x20configured');}var _0x57a32d='\x22'+_0x1b44a2[_0x4592('0x61')]+'\x22';if(this[_0x4592('0xad')](_0x1b44a2[_0x4592('0x7c')])){_0x57a32d+=','+_0x1b44a2['options'];}var _0x21f8a8=this[_0x4592('0x11')][_0x4592('0xae')](_0x4592('0xaf'),_0x57a32d);if(_0x21f8a8[_0x4592('0xb0')]===-0x1){return _0x21f8a8;}return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x57a32d));};AGIVertices[_0x4592('0x14')]['mrcprecog']=function(_0x2cd823){logger[_0x4592('0x31')](util['format'](_0x4592('0xb1'),_0x2cd823[_0x4592('0x3b')]));if(!this['isConfigured'](_0x2cd823['grammar'])){return this[_0x4592('0x11')]['noop']('no\x20grammar\x20configured');}var _0x3e59c3=_0x2cd823[_0x4592('0xb2')];if(this['isConfigured'](_0x2cd823[_0x4592('0x7c')])){_0x3e59c3+=','+_0x2cd823[_0x4592('0x7c')];}var _0x2c4c46=this['channel'][_0x4592('0xae')]('MRCPRecog',_0x3e59c3);if(_0x2c4c46[_0x4592('0xb0')]===-0x1){return _0x2c4c46;}var _0x5bce9a=this[_0x4592('0xb3')](_0x4592('0xb4'),_0x4592('0xb5'));if(_0x5bce9a['result']===-0x1){return _0x5bce9a;}var _0x21f3ed=this[_0x4592('0xb3')](_0x4592('0xb6'),_0x4592('0xb7'));if(_0x21f3ed[_0x4592('0xb0')]===-0x1){return _0x21f3ed;}var _0x18ab35=this[_0x4592('0xb3')](_0x4592('0xb8'),_0x4592('0xb9'));if(_0x18ab35['result']===-0x1){return _0x18ab35;}return this[_0x4592('0x11')]['noop'](util[_0x4592('0x2b')](_0x4592('0xba'),_0x3e59c3));};AGIVertices[_0x4592('0x14')][_0x4592('0x8')]=function(_0x4cae0c){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0xbb'),_0x4cae0c[_0x4592('0x3b')]));return this['channel']['agi']([_0x4cae0c['command'],_0x4cae0c[_0x4592('0xbc')]]);};AGIVertices['prototype'][_0x4592('0xbd')]=function(_0x4e06ff){logger[_0x4592('0x31')](util['format'](_0x4592('0xbe'),_0x4e06ff['label']));if(this[_0x4592('0xad')](_0x4e06ff[_0x4592('0x6a')])){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0xbf'),_0x4e06ff[_0x4592('0x6a')]));var _0x41df76=this[_0x4592('0x11')][_0x4592('0xc0')](_0x4e06ff[_0x4592('0x6a')]);if(_0x41df76['result']===-0x1){return _0x41df76;}}return this[_0x4592('0x11')]['answer']();};AGIVertices[_0x4592('0x14')][_0x4592('0xc1')]=function(_0x8a09a8){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0xc2'),_0x8a09a8[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x8a09a8['list_id'])){return this['channel'][_0x4592('0x34')](_0x8a09a8,_0x4592('0xc3'));}_0x8a09a8[_0x4592('0x51')]=moment();if(this[_0x4592('0xad')](_0x8a09a8[_0x4592('0xc4')])){_0x8a09a8[_0x4592('0x51')]=moment()[_0x4592('0xc5')](_0x8a09a8[_0x4592('0xc4')],_0x4592('0xc6'));}if(!this[_0x4592('0xad')](_0x8a09a8['callback_priority'])){_0x8a09a8['callback_priority']=0x2;}this[_0x4592('0x48')][_0x4592('0x75')](this,_0x8a09a8);return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xc7'),_0x8a09a8['phone'],_0x8a09a8[_0x4592('0x4f')],_0x8a09a8['scheduledAt']));};AGIVertices['prototype'][_0x4592('0xc8')]=function(_0x1f5c89){logger[_0x4592('0x31')](util['format'](_0x4592('0xc9'),_0x1f5c89[_0x4592('0x3b')]));var _0x237dc3=this[_0x4592('0x11')]['exec'](_0x1f5c89[_0x4592('0xca')],_0x1f5c89[_0x4592('0x7c')]);if(_0x237dc3[_0x4592('0xb0')]===-0x1){return _0x237dc3;}return this['channel']['noop'](util[_0x4592('0x2b')](_0x4592('0xcb'),_0x1f5c89[_0x4592('0xca')],_0x1f5c89[_0x4592('0x7c')]));};AGIVertices[_0x4592('0x14')]['lumenvoxtts']=function(_0x425904){logger['info'](util[_0x4592('0x2b')](_0x4592('0xcc'),_0x425904[_0x4592('0x3b')]));if(!this['isConfigured'](_0x425904[_0x4592('0x61')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xcd'));}var _0x55238c='\x22'+_0x425904[_0x4592('0x61')]+'\x22';if(this[_0x4592('0xad')](_0x425904['options'])){_0x55238c+=','+_0x425904[_0x4592('0x7c')];}var _0x46aeb0=this['channel'][_0x4592('0xae')](_0x4592('0xaf'),_0x55238c);if(_0x46aeb0[_0x4592('0xb0')]===-0x1){return _0x46aeb0;}return this['channel']['noop'](util['format'](_0x4592('0xce'),_0x55238c));};AGIVertices['prototype'][_0x4592('0xcf')]=function(_0xdef876){logger['info'](util[_0x4592('0x2b')](_0x4592('0xd0'),_0xdef876[_0x4592('0x3b')]));if(!this['isConfigured'](_0xdef876[_0x4592('0x61')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xcd'));}var _0x3eca0e='\x22'+_0xdef876[_0x4592('0x61')]+'\x22';if(this[_0x4592('0xad')](_0xdef876[_0x4592('0x7c')])){_0x3eca0e+=','+_0xdef876[_0x4592('0x7c')];}var _0x43796c=this[_0x4592('0x11')]['exec'](_0x4592('0xaf'),_0x3eca0e);if(_0x43796c[_0x4592('0xb0')]===-0x1){return _0x43796c;}return this['channel'][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xce'),_0x3eca0e));};AGIVertices[_0x4592('0x14')]['lumenvoxasr']=function(_0x299fe4){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0xd1'),_0x299fe4[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x299fe4[_0x4592('0xb2')])){return this['channel'][_0x4592('0xac')](_0x4592('0xd2'));}var _0x2769f2=_0x299fe4[_0x4592('0xb2')];if(this[_0x4592('0xad')](_0x299fe4[_0x4592('0x7c')])){_0x2769f2+=','+_0x299fe4['options'];}var _0x45650d=this[_0x4592('0x11')]['exec'](_0x4592('0xd3'),_0x2769f2);if(_0x45650d[_0x4592('0xb0')]===-0x1){return _0x45650d;}var _0x4f2cbe=this[_0x4592('0xb3')](_0x4592('0xb4'),'LUMENVOX_ASR_CONFIDENCE');if(_0x4f2cbe['result']===-0x1){return _0x4f2cbe;}var _0x1d44d2=this[_0x4592('0xb3')](_0x4592('0xb6'),_0x4592('0xd4'));if(_0x1d44d2[_0x4592('0xb0')]===-0x1){return _0x1d44d2;}var _0x322563=this['getAndSetVariable'](_0x4592('0xb8'),_0x4592('0xd5'));if(_0x322563['result']===-0x1){return _0x322563;}return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xba'),_0x2769f2));};AGIVertices[_0x4592('0x14')][_0x4592('0xd6')]=function(_0x176400){logger['info'](util['format'](_0x4592('0xd7'),_0x176400[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x176400[_0x4592('0xb2')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20grammar\x20configured');}var _0x1bb269=_0x176400[_0x4592('0xb2')];if(this[_0x4592('0xad')](_0x176400[_0x4592('0x7c')])){_0x1bb269+=','+_0x176400[_0x4592('0x7c')];}var _0x452775=this['channel'][_0x4592('0xae')]('MRCPRecog',_0x1bb269);if(_0x452775[_0x4592('0xb0')]===-0x1){return _0x452775;}var _0x31cf72=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x4592('0xd8'));if(_0x31cf72[_0x4592('0xb0')]===-0x1){return _0x31cf72;}var _0x45a9d3=this[_0x4592('0xb3')](_0x4592('0xb6'),_0x4592('0xd9'));if(_0x45a9d3[_0x4592('0xb0')]===-0x1){return _0x45a9d3;}var _0x283a51=this['getAndSetVariable'](_0x4592('0xb8'),_0x4592('0xda'));if(_0x283a51[_0x4592('0xb0')]===-0x1){return _0x283a51;}return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xba'),_0x1bb269));};AGIVertices[_0x4592('0x14')]['database']=function(_0x51fb07){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0xdb'),_0x51fb07[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x51fb07[_0x4592('0xdc')])){return this[_0x4592('0x11')]['error'](_0x51fb07,'no\x20database\x20selected');}var _0x5d8aaa=this['getSquareOdbc']['sync'](this,_0x51fb07['odbc_id']);if(!_0x5d8aaa){return this[_0x4592('0x11')][_0x4592('0x34')](_0x51fb07,_0x4592('0xdd'));}if(!this[_0x4592('0xad')](_0x51fb07[_0x4592('0x30')])){return this['channel'][_0x4592('0x34')](_0x51fb07,'no\x20query\x20configured');}var _0x232f53=_0x51fb07[_0x4592('0x30')][_0x4592('0xde')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4592('0x11')][_0x4592('0xac')](util['format'](_0x4592('0xdf'),_0x232f53));var _0x10e787=this[_0x4592('0x2c')][_0x4592('0x75')](this,_0x5d8aaa,_0x232f53);this[_0x4592('0x39')][_0x4592('0x75')](this,_0x51fb07,_0x232f53);if(!this[_0x4592('0xad')](_0x51fb07[_0x4592('0xe0')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xe1'));}var _0x1be7e8=this[_0x4592('0x15')][_0x4592('0x75')](this,_0x51fb07[_0x4592('0xe0')]);if(!_0x1be7e8){return this['channel'][_0x4592('0x34')](_0x51fb07,_0x4592('0xe2'));}var _0x2bfa49=this;_0x10e787[_0x4592('0xe3')](function(_0x24b9fc,_0x385d45){Object[_0x4592('0xe4')](_0x24b9fc)['forEach'](function(_0x161ba6){_0x2bfa49[_0x4592('0x11')][_0x4592('0xa5')](util[_0x4592('0x2b')]('%s[%s][%s]',_0x1be7e8,_0x385d45,_0x161ba6),_0x24b9fc[_0x161ba6]);});});this['channel'][_0x4592('0xa5')](util[_0x4592('0x2b')](_0x4592('0xe5'),_0x1be7e8),_0x10e787[_0x4592('0xa1')]);return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xe6'),_0x1be7e8));};AGIVertices[_0x4592('0x14')][_0x4592('0xe7')]=function(_0x6d6b3a){logger[_0x4592('0xe8')](util[_0x4592('0x2b')](_0x4592('0xe9'),_0x6d6b3a[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x6d6b3a[_0x4592('0xea')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x6d6b3a,'no\x20user\x20selected');}var _0x5123bd=this[_0x4592('0x1b')]['sync'](this,_0x6d6b3a[_0x4592('0xea')]);if(!_0x5123bd){return this[_0x4592('0x11')][_0x4592('0x34')](_0x6d6b3a,_0x4592('0xeb'));}var _0x575d76=this[_0x4592('0x11')][_0x4592('0xae')]('DIAL',[util[_0x4592('0x2b')](_0x4592('0xec'),_0x5123bd),_0x6d6b3a[_0x4592('0x6a')],_0x6d6b3a[_0x4592('0xed')],_0x6d6b3a['url']]);if(_0x575d76[_0x4592('0xb0')]===-0x1){return _0x575d76;}return this['channel'][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xee'),_0x4592('0xef')));};AGIVertices['prototype']['dialogflow']=function(_0x541671){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0xf0'),_0x541671[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x541671[_0x4592('0x7e')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20key\x20configured');}if(!this[_0x4592('0xad')](_0x541671[_0x4592('0x61')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xcd'));}this[_0x4592('0x11')]['bot']=!![];this[_0x4592('0x39')](_0x541671);this[_0x4592('0x47')](_0x541671[_0x4592('0x61')],'in','','');this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')]('Trying\x20Dialogflow:\x20%s',_0x541671['text']));var _0x4bfa5e=this['googleDialogflow'][_0x4592('0x75')](this,_0x541671);if(_0x4bfa5e){for(var _0x4128ca in _0x4bfa5e){if(_0x4bfa5e['hasOwnProperty'](_0x4128ca)){this[_0x4592('0x11')]['setVariable'](util[_0x4592('0x2b')](_0x4592('0xf1'),_0x4128ca[_0x4592('0xf2')]()),_0x4bfa5e[_0x4128ca]);}}this['createSquareMessage'](_0x4bfa5e[_0x4592('0xf3')],'out','dialogflow','');return this['channel']['noop'](util['format'](_0x4592('0xf4'),_0x4bfa5e['speech']));}return this['channel'][_0x4592('0x34')](_0x541671,_0x4592('0xf5'));};AGIVertices[_0x4592('0x14')]['dialogflowV2']=function(_0x5601f4){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0xf6'),_0x5601f4[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x5601f4[_0x4592('0x81')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xf7'));}if(!this['isConfigured'](_0x5601f4[_0x4592('0xf8')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xf9'));}if(!this[_0x4592('0xad')](_0x5601f4[_0x4592('0x82')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xfa'));}if(!this[_0x4592('0xad')](_0x5601f4[_0x4592('0x83')])){return this[_0x4592('0x11')]['noop'](_0x4592('0xfb'));}if(!this['isConfigured'](_0x5601f4[_0x4592('0x61')])){return this['channel'][_0x4592('0xac')](_0x4592('0xcd'));}this[_0x4592('0x11')]['bot']=!![];this[_0x4592('0x39')](_0x5601f4);this[_0x4592('0x47')](_0x5601f4['text'],'in','','');this[_0x4592('0x11')][_0x4592('0xac')](util['format'](_0x4592('0xfc'),_0x5601f4[_0x4592('0x61')]));var _0x3a123b=this[_0x4592('0x80')][_0x4592('0x75')](this,_0x5601f4);if(_0x3a123b){for(var _0x53dee9 in _0x3a123b){if(_0x3a123b[_0x4592('0x9b')](_0x53dee9)){if(_0x53dee9!=='providerResponse'){this['channel']['setVariable'](util[_0x4592('0x2b')](_0x4592('0xf1'),_0x53dee9[_0x4592('0xf2')]()),_0x3a123b[_0x53dee9]);}}}this[_0x4592('0x47')](_0x3a123b[_0x4592('0xf3')],_0x4592('0xfd'),_0x4592('0xfe'),_0x3a123b['providerResponse']);return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xff'),_0x3a123b[_0x4592('0xf3')]));}return this[_0x4592('0x11')][_0x4592('0x34')](_0x5601f4,_0x4592('0x100'));};AGIVertices[_0x4592('0x14')][_0x4592('0x101')]=function(_0x149b03){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x102'),_0x149b03[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x149b03[_0x4592('0x103')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x104'));}if(!this[_0x4592('0xad')](_0x149b03[_0x4592('0x105')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20username\x20configured');}if(!this[_0x4592('0xad')](_0x149b03[_0x4592('0x106')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x107'));}if(!this['isConfigured'](_0x149b03[_0x4592('0x108')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xcd'));}this[_0x4592('0x11')][_0x4592('0x109')]=!![];this[_0x4592('0x39')](_0x149b03);this[_0x4592('0x47')](_0x149b03[_0x4592('0x61')],'in','','');this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x10a'),_0x149b03[_0x4592('0x61')]));var _0x1a5b6a=this[_0x4592('0x84')][_0x4592('0x75')](this,_0x149b03);if(_0x1a5b6a){for(var _0x247721 in _0x1a5b6a){if(_0x1a5b6a[_0x4592('0x9b')](_0x247721)){this['channel'][_0x4592('0xa5')](util[_0x4592('0x2b')]('SESTEK_NDA_%s',_0x247721[_0x4592('0xf2')]()),_0x1a5b6a[_0x247721]);}}this[_0x4592('0x47')](_0x1a5b6a[_0x4592('0xf3')],_0x4592('0xfd'),_0x4592('0x101'),'');if(_0x1a5b6a[_0x4592('0x10b')]){this['channel'][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x10c'),_0x1a5b6a[_0x4592('0x10b')]));var _0x2afb9a=this[_0x4592('0x11')][_0x4592('0x10d')](_0x1a5b6a[_0x4592('0x10b')]);try{fs[_0x4592('0x10e')](_0x1a5b6a[_0x4592('0x10b')]+_0x4592('0x10f'));}catch(_0x1cda0a){logger[_0x4592('0x34')](_0x1cda0a);}return _0x2afb9a;}else{return this['channel']['noop'](util[_0x4592('0x2b')](_0x4592('0x110'),_0x1a5b6a[_0x4592('0xf3')]));}}return this[_0x4592('0x11')][_0x4592('0x34')](_0x149b03,_0x4592('0x111'));};AGIVertices[_0x4592('0x14')]['end']=function(_0x9516c7){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x112'),_0x9516c7[_0x4592('0x3b')]));return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x113'));};AGIVertices[_0x4592('0x14')][_0x4592('0x114')]=function(_0x23083f){logger[_0x4592('0x31')](util['format'](_0x4592('0x115'),_0x23083f[_0x4592('0x3b')]));var _0x18d64a='';if(_0x23083f[_0x4592('0x116')]){if(!this[_0x4592('0xad')](_0x23083f[_0x4592('0x116')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x23083f,'no\x20trunk\x20selected');}else{var _0x441876=parseInt(_0x23083f[_0x4592('0x116')],0xa);if(isNaN(_0x441876)){_0x18d64a=_0x23083f[_0x4592('0x116')];}else{_0x18d64a=this['getTrunk'][_0x4592('0x75')](this,_0x23083f[_0x4592('0x116')]);if(!_0x18d64a){return this[_0x4592('0x11')][_0x4592('0x34')](_0x23083f,_0x4592('0x117'));}}}}else if(_0x23083f[_0x4592('0x118')]){_0x18d64a=_0x23083f[_0x4592('0x118')];}else{return this[_0x4592('0x11')][_0x4592('0x34')](_0x23083f,_0x4592('0x119'));}var _0x4f9832=this[_0x4592('0x11')][_0x4592('0xae')](_0x4592('0xef'),[util[_0x4592('0x2b')](_0x4592('0x11a'),_0x18d64a,_0x23083f[_0x4592('0x4e')]),_0x23083f['timeout'],_0x23083f[_0x4592('0xed')],_0x23083f[_0x4592('0x68')]]);if(_0x4f9832[_0x4592('0xb0')]===-0x1){return _0x4f9832;}return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xee'),_0x4592('0xef')));};AGIVertices['prototype']['finally']=function(_0x5b27e2){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x11b'),_0x5b27e2[_0x4592('0x3b')]));return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x11c'));};AGIVertices[_0x4592('0x14')][_0x4592('0xf')]=function(_0x1abbb0){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x11d'),_0x1abbb0[_0x4592('0x3b')]));if(_0x1abbb0[_0x4592('0xaa')]===0x0){return this[_0x4592('0xa9')](_0x1abbb0);}_0x1abbb0[_0x4592('0xaa')]-=0x1;if(!this[_0x4592('0xad')](_0x1abbb0[_0x4592('0x11e')])){return this['channel']['error'](_0x1abbb0,_0x4592('0x11f'));}var _0x54be65=this[_0x4592('0x1f')][_0x4592('0x75')](this,_0x1abbb0[_0x4592('0x11e')]);if(!_0x54be65){return this[_0x4592('0x11')][_0x4592('0x34')](_0x1abbb0,_0x4592('0x120'));}if(!this[_0x4592('0xad')](_0x1abbb0['variable_id'])){return this[_0x4592('0x11')][_0x4592('0x34')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x24d71b=this['channel'][_0x4592('0x121')](_0x54be65,_0x1abbb0[_0x4592('0x122')],_0x1abbb0[_0x4592('0x123')]);var _0x2f6443=_0x24d71b['result']?_0x24d71b[_0x4592('0xb0')][_0x4592('0x52')]():'';logger['info'](_0x4592('0x124'),JSON[_0x4592('0x78')](_0x24d71b));if(_0x24d71b['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x1abbb0,_0x2f6443);return _0x24d71b;}else if(_0x24d71b[_0x4592('0xa7')]==='timeout'){_0x24d71b['result']=_0x2f6443[_0x4592('0xa1')]>=parseInt(_0x1abbb0[_0x4592('0x125')])?'x':'i';}else{_0x24d71b[_0x4592('0xb0')]=_0x2f6443[_0x4592('0xa1')]>=parseInt(_0x1abbb0[_0x4592('0x125')])&&_0x2f6443[_0x4592('0xa1')]<=parseInt(_0x1abbb0[_0x4592('0x123')])?'x':'i';}var _0x171d5d=this[_0x4592('0x15')]['sync'](this,_0x1abbb0[_0x4592('0xe0')]);if(!_0x171d5d){return this[_0x4592('0x11')][_0x4592('0x34')](_0x1abbb0,_0x4592('0xe2'));}this[_0x4592('0x11')][_0x4592('0xa5')](_0x171d5d,_0x2f6443);if(this[_0x4592('0xad')](_0x1abbb0[_0x4592('0x126')])){var _0x3e3220=parseInt(_0x1abbb0[_0x4592('0x126')],0xa);var _0x24cd9d=rs[_0x4592('0x127')]({'charset':'*','length':_0x3e3220});var _0x1b86af=_0x2f6443[_0x4592('0xa1')];if(_0x1b86af>0x0){if(_0x1b86af>_0x3e3220){this['createSquareDetailsReport'][_0x4592('0x75')](this,_0x1abbb0,_0x1abbb0[_0x4592('0x128')]===_0x4592('0x129')?_0x24cd9d+_0x2f6443[_0x4592('0x12a')](_0x3e3220):_0x2f6443['substr'](0x0,_0x1b86af-_0x3e3220)+_0x24cd9d);}else{this[_0x4592('0x39')][_0x4592('0x75')](this,_0x1abbb0,rs[_0x4592('0x127')]({'charset':'*','length':_0x1b86af}));}}else{this[_0x4592('0x39')][_0x4592('0x75')](this,_0x1abbb0,'');}}else{this[_0x4592('0x39')]['sync'](this,_0x1abbb0,_0x2f6443);}return _0x24d71b;};AGIVertices[_0x4592('0x14')][_0x4592('0x10')]=function(_0x1398d5){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x12b'),_0x1398d5[_0x4592('0x3b')]));return this[_0x4592('0xf')](_0x1398d5);};AGIVertices[_0x4592('0x14')][_0x4592('0x12c')]=function(_0x1bb1c8){logger[_0x4592('0x31')](util[_0x4592('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1bb1c8[_0x4592('0x3b')]));this[_0x4592('0x39')][_0x4592('0x75')](this,_0x1bb1c8,_0x1bb1c8[_0x4592('0x12d')]);return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')]('GOAL\x20%s',_0x1bb1c8[_0x4592('0x12d')]));};AGIVertices['prototype'][_0x4592('0x12e')]=function(_0x4d3b9a){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x12f'),_0x4d3b9a['label']));if(!this[_0x4592('0xad')](_0x4d3b9a[_0x4592('0x8d')])||!this[_0x4592('0xad')](_0x4d3b9a[_0x4592('0x93')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x4592('0xad')](_0x4d3b9a[_0x4592('0x61')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xcd'));}this['channel'][_0x4592('0xac')](util['format'](_0x4592('0x130'),_0x4d3b9a[_0x4592('0x61')]));var _0x38880e=this[_0x4592('0x8c')]['sync'](this,_0x4d3b9a);if(_0x38880e){this['channel'][_0x4592('0xac')](util['format'](_0x4592('0x131'),_0x38880e));var _0x590ddd=this[_0x4592('0x11')]['streamFile'](_0x38880e);try{fs[_0x4592('0x10e')](_0x38880e+_0x4592('0x10f'));}catch(_0x490f9b){logger['error'](_0x490f9b);}return _0x590ddd;}return this[_0x4592('0x11')]['error'](_0x4d3b9a,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x4592('0x132')]=function(_0x35cd06){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x133'),_0x35cd06[_0x4592('0x3b')]));if(!this['isConfigured'](_0x35cd06[_0x4592('0x8d')])||!this[_0x4592('0xad')](_0x35cd06[_0x4592('0x93')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x4592('0xad')](_0x35cd06[_0x4592('0x95')])){return this['channel'][_0x4592('0xac')](_0x4592('0x134'));}if(!this['isConfigured'](_0x35cd06[_0x4592('0x61')])){return this[_0x4592('0x11')]['noop'](_0x4592('0xcd'));}this[_0x4592('0x11')][_0x4592('0x109')]=!![];this['createSquareDetailsReport'](_0x35cd06);this[_0x4592('0x47')](_0x35cd06[_0x4592('0x61')],'in','','');this[_0x4592('0x11')]['noop'](util[_0x4592('0x2b')](_0x4592('0x135'),_0x35cd06[_0x4592('0x61')]));var _0x27a463=this[_0x4592('0x92')][_0x4592('0x75')](this,_0x35cd06);if(_0x27a463){for(var _0x1b7c28 in _0x27a463){if(_0x27a463[_0x4592('0x9b')](_0x1b7c28)&&_[_0x4592('0x9c')](_0x27a463[_0x1b7c28])){this['channel'][_0x4592('0xa5')](util[_0x4592('0x2b')](_0x4592('0x136'),_0x1b7c28['toUpperCase']()),_0x27a463[_0x1b7c28]);}}if(_[_0x4592('0x4a')](_0x27a463[_0x4592('0x7a')])){return this[_0x4592('0x11')][_0x4592('0xac')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x4592('0x47')](_0x27a463[_0x4592('0x7a')],_0x4592('0xfd'),_0x4592('0x137'),'');return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x138'),_0x27a463[_0x4592('0x7a')]));}}return this[_0x4592('0x11')][_0x4592('0x34')](_0x35cd06,_0x4592('0x139'));};AGIVertices[_0x4592('0x14')][_0x4592('0x13a')]=function(_0x482935){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x13b'),_0x482935[_0x4592('0x3b')],_0x482935[_0x4592('0x6a')]));if(!this[_0x4592('0xad')](_0x482935[_0x4592('0x7e')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x13c'));}var _0x5f2e55=_0x4592('0x13d');var _0x4e4ad4=util[_0x4592('0x2b')](_0x4592('0x13e'),FILES_PATH,rs[_0x4592('0x127')](0x4));var _0x1b5b4f=util[_0x4592('0x2b')](_0x4592('0xa4'),_0x4e4ad4,_0x5f2e55);var _0x188724=!![];if(_0x482935[_0x4592('0x13f')]===_0x4592('0x140')){_0x188724=![];}var _0x34a92a=this['channel']['recordFile'](_0x4e4ad4,_0x5f2e55,_0x482935['intKey'],_0x482935[_0x4592('0x6a')],undefined,_0x188724);if(_0x34a92a[_0x4592('0xb0')]!==-0x1){this[_0x4592('0x11')][_0x4592('0xac')](util['format']('google\x20%s\x20file\x20created',_0x1b5b4f));var _0x51e0bc=this['googleASR'][_0x4592('0x75')](this,_0x482935,_0x1b5b4f);if(_0x51e0bc){for(var _0x59f53e in _0x51e0bc){if(_0x51e0bc['hasOwnProperty'](_0x59f53e)){this[_0x4592('0x11')]['setVariable'](util[_0x4592('0x2b')](_0x4592('0x141'),_0x59f53e[_0x4592('0xf2')]()),_0x51e0bc[_0x59f53e]);}}return this['channel'][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x142'),JSON[_0x4592('0x78')](_0x51e0bc)));}}return _0x34a92a;};AGIVertices[_0x4592('0x14')][_0x4592('0x143')]=function(_0x30a30f){logger[_0x4592('0x31')](util['format'](_0x4592('0x144'),_0x30a30f['label']));if(!this[_0x4592('0xad')](_0x30a30f[_0x4592('0x98')])){return this['channel'][_0x4592('0xac')](_0x4592('0x145'));}if(!this[_0x4592('0xad')](_0x30a30f['appsecret'])){return this[_0x4592('0x11')]['noop'](_0x4592('0x146'));}var _0x5491d2=_0x4592('0x13d');var _0xffd336=util[_0x4592('0x2b')](_0x4592('0x13e'),FILES_PATH,rs[_0x4592('0x127')](0x4));var _0x56c680=util[_0x4592('0x2b')](_0x4592('0xa4'),_0xffd336,_0x5491d2);var _0x47366d=!![];if(_0x30a30f[_0x4592('0x13f')]===_0x4592('0x140')){_0x47366d=![];}var _0x8c3854=this['channel']['recordFile'](_0xffd336,_0x5491d2,_0x30a30f[_0x4592('0x147')],_0x30a30f[_0x4592('0x6a')],undefined,_0x47366d);if(_0x8c3854[_0x4592('0xb0')]!==-0x1){this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x148'),_0x56c680));var _0x47c4e2=this[_0x4592('0x97')][_0x4592('0x75')](this,_0x30a30f,_0x56c680);if(_0x47c4e2){for(var _0x1d58b7 in _0x47c4e2){if(_0x47c4e2[_0x4592('0x9b')](_0x1d58b7)){this['channel'][_0x4592('0xa5')](util['format']('TILDE_ASR_%s',_0x1d58b7[_0x4592('0xf2')]()),_0x47c4e2[_0x1d58b7]);}}return this[_0x4592('0x11')]['noop'](util[_0x4592('0x2b')](_0x4592('0x149'),JSON[_0x4592('0x78')](_0x47c4e2)));}}return _0x8c3854;};AGIVertices[_0x4592('0x14')][_0x4592('0x14a')]=function(_0x5b7506){logger[_0x4592('0x31')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5b7506[_0x4592('0x3b')]));return this['channel'][_0x4592('0x14b')](_0x5b7506[_0x4592('0x40')],_0x5b7506[_0x4592('0x41')],_0x5b7506[_0x4592('0x42')]);};AGIVertices[_0x4592('0x14')]['gotoif']=function(_0x31c286){logger[_0x4592('0x31')](util['format'](_0x4592('0x14c'),_0x31c286[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x31c286['condition'])){return this['channel'][_0x4592('0x34')](_0x31c286,_0x4592('0x14d'));}try{var _0xed6ac=eval(_0x31c286['condition'])?_0x4592('0x14e'):_0x4592('0x14f');this['channel'][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x150'),_0x31c286['condition'],_0xed6ac));return{'code':0xc8,'result':_0xed6ac};}catch(_0x235933){return{'code':0xc8,'result':_0x4592('0x14f')};}};AGIVertices[_0x4592('0x14')][_0x4592('0x151')]=function(_0x38ef81){logger[_0x4592('0x31')](util[_0x4592('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x38ef81[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x38ef81[_0x4592('0x152')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x38ef81,_0x4592('0x153'));}var _0x5376e6=this[_0x4592('0x25')]['sync'](this,_0x38ef81[_0x4592('0x152')]);if(!_0x5376e6){return this['channel'][_0x4592('0x34')](_0x38ef81,_0x4592('0x154'));}for(var _0x313369=0x0;_0x313369<_0x5376e6[_0x4592('0xa1')];_0x313369+=0x1){var _0x1ac8cf=this[_0x4592('0x11')][_0x4592('0x15')](util['format'](_0x4592('0x155'),_0x5376e6[_0x313369]));if(_0x1ac8cf[_0x4592('0xb0')]===-0x1){return _0x1ac8cf;}logger['info'](util['format'](_0x4592('0x156'),_0x5376e6[_0x313369],_0x1ac8cf[_0x4592('0xa7')]));if(_0x1ac8cf[_0x4592('0xa7')]==='true'){logger[_0x4592('0x31')](util['format'](_0x4592('0x156'),_0x5376e6[_0x313369],_0x4592('0x14e')));this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x156'),_0x5376e6[_0x313369],'true'));return{'code':0xc8,'result':_0x4592('0x14e')};}else{logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x156'),_0x5376e6[_0x313369],'false'));this['channel']['noop'](util[_0x4592('0x2b')](_0x4592('0x156'),_0x5376e6[_0x313369],_0x4592('0x14f')));}}return{'code':0xc8,'result':_0x4592('0x14f')};};AGIVertices['prototype'][_0x4592('0x157')]=function(_0x37b7f6){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x158'),_0x37b7f6[_0x4592('0x3b')]));return this[_0x4592('0x11')][_0x4592('0x157')]();};AGIVertices[_0x4592('0x14')][_0x4592('0x159')]=function(_0xedc1a3){logger[_0x4592('0x31')](util[_0x4592('0x2b')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0xedc1a3[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0xedc1a3[_0x4592('0x7e')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x13c'));}var _0x2750b4='wav';var _0x1b97ae=util['format'](_0x4592('0x13e'),FILES_PATH,rs['generate'](0x4));var _0x413f1b=util['format'](_0x4592('0xa4'),_0x1b97ae,_0x2750b4);var _0x322c00=!![];if(_0xedc1a3['beep']===_0x4592('0x140')){_0x322c00=![];}var _0x4f668e=this[_0x4592('0x11')][_0x4592('0x15a')](_0x1b97ae,_0x2750b4,_0xedc1a3['intKey'],_0xedc1a3[_0x4592('0x6a')],undefined,_0x322c00);if(_0x4f668e[_0x4592('0xb0')]!==-0x1){this[_0x4592('0x11')]['noop'](util[_0x4592('0x2b')](_0x4592('0x15b'),_0x413f1b));var _0x42bbb8=this[_0x4592('0x88')]['sync'](this,_0xedc1a3,_0x413f1b);if(_0x42bbb8){for(var _0x44ec7b in _0x42bbb8){if(_0x42bbb8[_0x4592('0x9b')](_0x44ec7b)){this[_0x4592('0x11')][_0x4592('0xa5')](util[_0x4592('0x2b')](_0x4592('0x15c'),_0x44ec7b['toUpperCase']()),_0x42bbb8[_0x44ec7b]);}}return this[_0x4592('0x11')][_0x4592('0xac')](util['format'](_0x4592('0x15d'),JSON[_0x4592('0x78')](_0x42bbb8)));}}return _0x4f668e;};AGIVertices['prototype'][_0x4592('0x15e')]=function(_0x3a4bf1){logger['info'](util[_0x4592('0x2b')](_0x4592('0x15f'),_0x3a4bf1[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x3a4bf1[_0x4592('0x7e')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x13c'));}if(!this['isConfigured'](_0x3a4bf1[_0x4592('0x61')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20text\x20configured');}this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x160'),_0x3a4bf1[_0x4592('0x61')]));var _0x4faeae=this['ispeechTTS'][_0x4592('0x75')](this,_0x3a4bf1);if(_0x4faeae){this['channel'][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x15b'),_0x4faeae));var _0x20903e=this['channel'][_0x4592('0x10d')](_0x4faeae,_0x3a4bf1[_0x4592('0x147')]);try{fs[_0x4592('0x10e')](_0x4faeae+_0x4592('0x10f'));}catch(_0x42bc30){logger[_0x4592('0x34')](_0x42bc30);}return _0x20903e;}return this[_0x4592('0x11')]['error'](_0x3a4bf1,_0x4592('0x161'));};AGIVertices[_0x4592('0x14')][_0x4592('0x162')]=function(_0x3db4e8){logger[_0x4592('0x31')](util[_0x4592('0x2b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x3db4e8['label']));if(!this['isConfigured'](_0x3db4e8[_0x4592('0x163')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x3db4e8,_0x4592('0x164'));}logger[_0x4592('0x31')](util['format'](_0x4592('0x165'),this['channel']['callerid'],_0x3db4e8[_0x4592('0x163')]));var _0x33119c=this[_0x4592('0x5a')][_0x4592('0x75')](this,_0x3db4e8[_0x4592('0x163')]);if(_0x33119c){logger[_0x4592('0x31')](util[_0x4592('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4592('0x11')]['callerid'],_0x3db4e8['findBy']));this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4592('0x11')]['callerid'],_0x3db4e8[_0x4592('0x163')]));return{'code':0xc8,'result':_0x4592('0x166')};}else{logger['info'](util[_0x4592('0x2b')](_0x4592('0x167'),this[_0x4592('0x11')][_0x4592('0x3d')],_0x3db4e8['findBy']));this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x167'),this[_0x4592('0x11')][_0x4592('0x3d')],_0x3db4e8[_0x4592('0x163')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x4592('0x168')]=function(_0x4a616c){logger['info'](util[_0x4592('0x2b')](_0x4592('0x169'),_0x4a616c[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x4a616c[_0x4592('0x163')])){return this['channel'][_0x4592('0x34')](_0x4a616c,_0x4592('0x164'));}logger['info'](util[_0x4592('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4592('0x11')][_0x4592('0x3d')],_0x4a616c[_0x4592('0x163')]));var _0x8e72f4=this[_0x4592('0x59')][_0x4592('0x75')](this,_0x4a616c[_0x4592('0x163')]);if(_0x8e72f4){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x16a'),this[_0x4592('0x11')][_0x4592('0x3d')],_0x4a616c[_0x4592('0x163')]));this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x16a'),this[_0x4592('0x11')][_0x4592('0x3d')],_0x4a616c['findBy']));return{'code':0xc8,'result':_0x4592('0x166')};}else{logger[_0x4592('0x31')](util[_0x4592('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4592('0x3d')],_0x4a616c['findBy']));this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x167'),this[_0x4592('0x11')][_0x4592('0x3d')],_0x4a616c[_0x4592('0x163')]));return{'code':0xc8,'result':_0x4592('0x16b')};}};AGIVertices[_0x4592('0x14')]['math']=function(_0x127e66){logger[_0x4592('0x31')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x127e66[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x127e66[_0x4592('0x16c')])){return this[_0x4592('0x11')]['error'](_0x127e66,_0x4592('0x16d'));}this[_0x4592('0x11')][_0x4592('0xac')](util['format'](_0x4592('0x16e'),_0x127e66['operation']));var _0x5253ae=eval(_0x127e66[_0x4592('0x16c')]);if(!this['isConfigured'](_0x127e66[_0x4592('0xe0')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0xe1'));}var _0x32f7a9=this[_0x4592('0x15')][_0x4592('0x75')](this,_0x127e66['variable_id']);if(!_0x32f7a9){return this[_0x4592('0x11')][_0x4592('0x34')](_0x127e66,'no\x20variable\x20found');}if(_[_0x4592('0xa0')](_0x5253ae)){var _0x141706=this;_0x5253ae[_0x4592('0xe3')](function(_0x8c0cbb,_0x4df937){_0x141706[_0x4592('0x11')][_0x4592('0xa5')](util[_0x4592('0x2b')](_0x4592('0x16f'),_0x32f7a9,_0x4df937),_0x8c0cbb);});return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')]('variable\x20%s[key]\x20set',_0x32f7a9));}else{return this[_0x4592('0x11')][_0x4592('0xa5')](_0x32f7a9,_0x5253ae);}};AGIVertices['prototype'][_0x4592('0xe')]=function(_0x18170a){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x170'),_0x18170a[_0x4592('0x3b')]));if(_0x18170a[_0x4592('0xaa')]===0x0){return this[_0x4592('0xa9')](_0x18170a);}_0x18170a[_0x4592('0xaa')]-=0x1;if(!this[_0x4592('0xad')](_0x18170a[_0x4592('0x11e')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x18170a,_0x4592('0x11f'));}var _0x2cd402=this[_0x4592('0x1f')][_0x4592('0x75')](this,_0x18170a['file_id']);if(!_0x2cd402){return this[_0x4592('0x11')][_0x4592('0x34')](_0x18170a,_0x4592('0x120'));}var _0x20d3bb=this['channel']['getData'](_0x2cd402,_0x18170a[_0x4592('0x122')],_0x18170a[_0x4592('0x171')]);var _0x1aada9=_0x20d3bb['result'];if(_0x20d3bb[_0x4592('0xb0')]===-0x1){this[_0x4592('0x39')][_0x4592('0x75')](this,_0x18170a,'-1');return _0x20d3bb;}else if(_0x20d3bb[_0x4592('0xa7')]===_0x4592('0x6a')){_0x20d3bb['result']=_0x20d3bb['result'][_0x4592('0xa1')]>0x0?_0x20d3bb[_0x4592('0xb0')]:'t';}else if(_[_0x4592('0x49')](_0x20d3bb[_0x4592('0xb0')])){_0x20d3bb[_0x4592('0xb0')]='#';_0x1aada9='#';}if(!this['isConfigured'](_0x18170a[_0x4592('0xe0')])){this[_0x4592('0x11')]['noop'](_0x4592('0xe1'));}else{var _0x10b73d=this[_0x4592('0x15')][_0x4592('0x75')](this,_0x18170a[_0x4592('0xe0')]);if(!_0x10b73d){return this['channel'][_0x4592('0x34')](_0x18170a,'no\x20variable\x20found');}this[_0x4592('0x11')][_0x4592('0xa5')](_0x10b73d,_0x1aada9);}this[_0x4592('0x39')][_0x4592('0x75')](this,_0x18170a,_0x1aada9);return _0x20d3bb;};AGIVertices[_0x4592('0x14')][_0x4592('0xac')]=function(_0x3bf6a7){logger['info'](util['format'](_0x4592('0x172'),_0x3bf6a7[_0x4592('0x3b')]));return this[_0x4592('0x11')][_0x4592('0xac')](_0x3bf6a7[_0x4592('0x173')]||_0x3bf6a7[_0x4592('0x3b')]);};AGIVertices[_0x4592('0x14')][_0x4592('0x174')]=function(_0x9d0684){logger['info'](util[_0x4592('0x2b')](_0x4592('0x175'),_0x9d0684['label']));if(!this['isConfigured'](_0x9d0684[_0x4592('0x163')])){return this['channel'][_0x4592('0x34')](_0x9d0684,_0x4592('0x164'));}logger['info'](util[_0x4592('0x2b')](_0x4592('0x165'),this['channel']['callerid'],_0x9d0684[_0x4592('0x163')]));var _0x3cd38e=this[_0x4592('0x54')][_0x4592('0x75')](this,_0x9d0684['pause_id']);var _0x31c67d=this[_0x4592('0x56')][_0x4592('0x75')](this,_0x9d0684[_0x4592('0x163')],_0x3cd38e);if(_0x31c67d){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4592('0x11')][_0x4592('0x3d')],_0x9d0684[_0x4592('0x163')]));this[_0x4592('0x11')][_0x4592('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4592('0x11')]['callerid'],_0x9d0684['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x167'),this['channel'][_0x4592('0x3d')],_0x9d0684['findBy']));this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x16a'),this['channel'][_0x4592('0x3d')],_0x9d0684[_0x4592('0x163')]));return{'code':0xc8,'result':_0x4592('0x16b')};}};AGIVertices[_0x4592('0x14')][_0x4592('0x176')]=function(_0x4c0948){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x177'),_0x4c0948['label']));if(!this[_0x4592('0xad')](_0x4c0948[_0x4592('0x11e')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x4c0948,_0x4592('0x11f'));}var _0x9dcb=this[_0x4592('0x1f')][_0x4592('0x75')](this,_0x4c0948['file_id']);if(!_0x9dcb){return this[_0x4592('0x11')][_0x4592('0x34')](_0x4c0948,'no\x20file\x20audio\x20found');}var _0x3944e7=this[_0x4592('0x11')][_0x4592('0xae')](_0x4592('0x178'),[_0x9dcb,_0x4c0948[_0x4592('0xed')]]);if(_0x3944e7[_0x4592('0xb0')]===-0x1){return _0x3944e7;}return this[_0x4592('0x11')][_0x4592('0xac')](util['format'](_0x4592('0xcb'),_0x4592('0x178'),_0x9dcb));};AGIVertices['prototype'][_0x4592('0x179')]=function(_0x4f67ff){logger['info'](util[_0x4592('0x2b')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x4f67ff[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x4f67ff[_0x4592('0x17a')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x4f67ff,'no\x20queue\x20selected');}var _0x1c7cdd='';var _0xfa4b41=parseInt(_0x4f67ff['queue_id'],0xa);if(isNaN(_0xfa4b41)){_0x1c7cdd=_0x4f67ff[_0x4592('0x17a')];}else{_0x1c7cdd=this[_0x4592('0x17b')][_0x4592('0x75')](this,_0x4f67ff[_0x4592('0x17a')]);if(!_0x1c7cdd){return this[_0x4592('0x11')][_0x4592('0x34')](_0x4f67ff,_0x4592('0x17c'));}}var _0x593689='';if(this[_0x4592('0xad')](_0x4f67ff[_0x4592('0x11e')])){var _0x5d5b26=this[_0x4592('0x1f')]['sync'](this,_0x4f67ff[_0x4592('0x11e')]);if(_0x5d5b26){_0x593689=_0x5d5b26;}}this[_0x4592('0x39')][_0x4592('0x75')](this,_0x4f67ff,_0x1c7cdd);if(_0x4f67ff[_0x4592('0xed')][_0x4592('0x17d')]('x')<0x0){_0x4f67ff[_0x4592('0xed')]+='x';}if(_0x4f67ff[_0x4592('0xed')]['indexOf']('X')<0x0){_0x4f67ff['opts']+='X';}this[_0x4592('0x11')][_0x4592('0xa5')](_0x4592('0x17e'),_0x1c7cdd?_0x1c7cdd[_0x4592('0x17f')]():'');var _0x3eab8a=this[_0x4592('0x11')]['exec'](_0x4592('0x180'),[_0x1c7cdd,_0x4f67ff[_0x4592('0xed')],_0x4f67ff['url'],_0x593689,_0x4f67ff[_0x4592('0x6a')],_0x4f67ff['agi'],_0x4f67ff[_0x4592('0x181')],_0x4f67ff[_0x4592('0x182')],'',_0x4f67ff[_0x4592('0x183')]]);if(_0x3eab8a[_0x4592('0xb0')]===-0x1){return _0x3eab8a;}return this[_0x4592('0x11')][_0x4592('0xac')](util['format'](_0x4592('0xcb'),_0x4592('0x180'),_0x1c7cdd));};AGIVertices[_0x4592('0x14')][_0x4592('0x184')]=function(_0x5adc50){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x185'),_0x5adc50[_0x4592('0x3b')]));var _0x39d498=_0x5adc50[_0x4592('0x186')]||_0x4592('0x13d');var _0x34a492=util[_0x4592('0x2b')](_0x4592('0x187'),this[_0x4592('0x11')][_0x4592('0x3a')],rs['generate'](0x5));var _0x3496a9=util['format'](_0x4592('0x188'),FILES_PATH,_0x34a492,_0x39d498);var _0x4941cf=util[_0x4592('0x2b')](_0x4592('0x13e'),FILES_PATH,_0x34a492);this['createSquareRecording'][_0x4592('0x75')](this,_0x5adc50,_0x34a492,_0x3496a9);this[_0x4592('0x11')][_0x4592('0xa5')](_0x4592('0x189'),_0x34a492);logger[_0x4592('0x31')](_0x4592('0x18a'),_0x4941cf,_0x39d498,_0x5adc50[_0x4592('0x18b')],_0x5adc50[_0x4592('0x6a')]);return this[_0x4592('0x11')][_0x4592('0x15a')](_0x4941cf,_0x39d498,_0x5adc50[_0x4592('0x18b')],_0x5adc50[_0x4592('0x6a')],undefined,!![]);};AGIVertices[_0x4592('0x14')][_0x4592('0x18c')]=function(_0x19772a){logger[_0x4592('0x31')](util[_0x4592('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x19772a['label']));if(!this[_0x4592('0xad')](_0x19772a[_0x4592('0x68')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20url\x20configured');}var _0x488709=this[_0x4592('0x18d')][_0x4592('0x75')](this,_0x19772a);logger['info'](util[_0x4592('0x2b')](_0x4592('0x18e'),util[_0x4592('0x18f')](_0x488709,{'showHidden':![],'depth':null})));if(!this[_0x4592('0xad')](_0x19772a[_0x4592('0xe0')])){return this[_0x4592('0x11')]['noop'](_0x4592('0x190'));}var _0x2f1337=this['getVariable']['sync'](this,_0x19772a['variable_id']);if(!_0x2f1337){return this[_0x4592('0x11')]['error'](_0x19772a,'no\x20variable\x20found');}this['channel'][_0x4592('0xa5')](util[_0x4592('0x2b')](_0x4592('0x191'),_0x2f1337),_0x488709[_0x4592('0x79')]?_0x488709[_0x4592('0x79')]:_0x4592('0x192'));this[_0x4592('0x11')][_0x4592('0xa5')](util[_0x4592('0x2b')](_0x4592('0x193'),_0x2f1337),_0x488709[_0x4592('0x194')]?_0x488709[_0x4592('0x194')]:'OK');if(_0x488709[_0x4592('0x6f')]){try{this[_0x4592('0xa3')](_0x488709['body'],_0x2f1337);}catch(_0x326bc1){logger[_0x4592('0x34')](util[_0x4592('0x2b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2f1337));}}return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xe6'),_0x2f1337));};AGIVertices['prototype'][_0x4592('0x195')]=function(_0x188553){logger['info'](util[_0x4592('0x2b')](_0x4592('0x196'),_0x188553[_0x4592('0x3b')]));return this[_0x4592('0x11')][_0x4592('0x197')](_0x188553[_0x4592('0x198')][_0x4592('0xde')](/\s+/g,''),_0x188553[_0x4592('0x18b')]);};AGIVertices['prototype'][_0x4592('0x199')]=function(_0x1d77c3){logger[_0x4592('0x31')](util['format'](_0x4592('0x19a'),_0x1d77c3['label']));return this[_0x4592('0x11')][_0x4592('0x19b')](_0x1d77c3[_0x4592('0x6b')][_0x4592('0xde')](/\s+/g,''),_0x1d77c3[_0x4592('0x18b')]);};AGIVertices[_0x4592('0x14')][_0x4592('0x19c')]=function(_0x4233b3){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x19d'),_0x4233b3[_0x4592('0x3b')]));return this[_0x4592('0x11')][_0x4592('0x19e')](_0x4233b3[_0x4592('0x61')],_0x4233b3[_0x4592('0x18b')]);};AGIVertices[_0x4592('0x14')][_0x4592('0x19f')]=function(_0x4eb7a4){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x1a0'),_0x4eb7a4[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x4eb7a4[_0x4592('0x1a1')])){return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x1a2'));}var _0x841407=this[_0x4592('0x22')][_0x4592('0x75')](this,_0x4eb7a4[_0x4592('0x1a1')]);if(!_0x841407||!_0x841407[_0x4592('0x1a3')]){return this[_0x4592('0x11')]['error'](_0x4eb7a4,_0x4592('0x1a4'));}var _0x35ab0b={'from':util[_0x4592('0x2b')](_0x4592('0x1a5'),_0x841407[_0x4592('0x17')],_0x841407[_0x4592('0x1a6')]||_0x841407['Smtp'][_0x4592('0x1a7')]),'to':_0x4eb7a4['to']||'','cc':_0x4eb7a4['cc']||'','bcc':_0x4eb7a4[_0x4592('0x1a8')]||'','subject':_0x4eb7a4[_0x4592('0x1a9')],'html':_0x4eb7a4[_0x4592('0x61')],'text':_0x4eb7a4[_0x4592('0x61')]};var _0x185516={'tls':{'rejectUnauthorized':![]}};if(_0x841407[_0x4592('0x1a3')][_0x4592('0x1aa')]){_0x185516['service']=_0x841407['Smtp'][_0x4592('0x1aa')];}else{_0x185516[_0x4592('0x1ab')]=_0x841407[_0x4592('0x1a3')]['host'];_0x185516[_0x4592('0x1ac')]=_0x841407['Smtp'][_0x4592('0x1ac')];_0x185516[_0x4592('0x1ad')]=_0x841407[_0x4592('0x1a3')][_0x4592('0x1ad')];}if(_0x841407['Smtp']['authentication']){_0x185516[_0x4592('0x1ae')]={'user':_0x841407[_0x4592('0x1a3')][_0x4592('0x1a7')],'pass':_0x841407['Smtp'][_0x4592('0x1af')]};}if(this[_0x4592('0xad')](_0x4eb7a4[_0x4592('0x1b0')])){}logger[_0x4592('0xe8')]('sendMail\x20message',JSON[_0x4592('0x78')](_0x35ab0b));this[_0x4592('0x39')]['sync'](this,_0x4eb7a4,_0x4eb7a4[_0x4592('0x1a1')]);this[_0x4592('0x11')]['noop'](util['format'](_0x4592('0x1b1'),_0x841407[_0x4592('0x17')]));this[_0x4592('0x24')][_0x4592('0x75')](this,_0x185516,_0x35ab0b);return this[_0x4592('0x11')][_0x4592('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4592('0x14')][_0x4592('0x1b2')]=function(_0x549bd3){logger['info'](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x549bd3[_0x4592('0x3b')]));return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x1b3'));};AGIVertices['prototype'][_0x4592('0x1b4')]=function(_0xd1086b){logger['info'](util[_0x4592('0x2b')](_0x4592('0x1b5'),_0xd1086b[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0xd1086b[_0x4592('0x1b6')])){return this['channel'][_0x4592('0xac')]('no\x20sms\x20account\x20configured');}var _0xe061c8=this[_0x4592('0x36')]['sync'](this,_0xd1086b['sms_account_id']);if(!_0xe061c8){return this[_0x4592('0x11')][_0x4592('0x34')](_0xd1086b,_0x4592('0x1b7'));}var _0x27ce31={'body':_0xd1086b[_0x4592('0x1b8')],'phone':_0xd1086b['to']||'','SmsAccountId':_0xe061c8['id']};logger[_0x4592('0xe8')](_0x4592('0x1b9'),JSON[_0x4592('0x78')](_0x27ce31));this[_0x4592('0x39')][_0x4592('0x75')](this,_0xd1086b,_0xd1086b[_0x4592('0x1b6')]);this[_0x4592('0x11')]['noop'](util[_0x4592('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xe061c8[_0x4592('0x17')]));this[_0x4592('0x38')]['sync'](this,_0x27ce31);return this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x1ba'));};AGIVertices[_0x4592('0x14')][_0x4592('0x1bb')]=function(_0x224fda){logger['info'](util[_0x4592('0x2b')](_0x4592('0x1bc'),_0x224fda[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x224fda[_0x4592('0xe0')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x224fda,'no\x20variable\x20selected');}var _0x15020a=this[_0x4592('0x15')]['sync'](this,_0x224fda[_0x4592('0xe0')]);if(!_0x15020a){return this[_0x4592('0x11')][_0x4592('0x34')](_0x224fda,_0x4592('0xe2'));}return this['channel'][_0x4592('0xa5')](_0x15020a,_0x224fda[_0x4592('0x1bd')]);};AGIVertices[_0x4592('0x14')]['start']=function(_0x4c61f6){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x1be'),_0x4c61f6['label']));this[_0x4592('0x11')][_0x4592('0xac')](_0x4592('0x1bf'));if(_0x4c61f6[_0x4592('0xbd')]===_0x4592('0x1c0')){this['channel'][_0x4592('0xac')]('Answer');return this['channel'][_0x4592('0xbd')]();}return this[_0x4592('0x11')][_0x4592('0xac')]('Skipped\x20Answer');};AGIVertices[_0x4592('0x14')][_0x4592('0x1c1')]=function(_0x58907a){logger[_0x4592('0x31')](util[_0x4592('0x2b')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x58907a[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x58907a[_0x4592('0x1c2')])){return this['channel'][_0x4592('0x34')](_0x58907a,_0x4592('0x1c3'));}var _0x4b4814=this['getSquareProject'][_0x4592('0x75')](this,_0x58907a['project_id']);if(!this[_0x4592('0xad')](_0x4b4814)){return this[_0x4592('0x11')][_0x4592('0x34')](_0x58907a,util[_0x4592('0x2b')](_0x4592('0x1c4'),_0x58907a[_0x4592('0x1c2')]));}if(_0x4b4814===this[_0x4592('0x11')][_0x4592('0x45')]){return this['channel'][_0x4592('0x34')](_0x58907a,_0x4592('0x1c5'));}this[_0x4592('0x39')]['sync'](this,_0x58907a,_0x4b4814);var _0x38e5bf=this[_0x4592('0x11')][_0x4592('0xae')](_0x4592('0x1c6'),util[_0x4592('0x2b')](_0x4592('0x1c7'),config[_0x4592('0x8')][_0x4592('0x1ab')]||_0x4592('0x1c8'),_0x4b4814,this['channel']['arg_1']));if(_0x38e5bf[_0x4592('0xb0')]===-0x1){return _0x38e5bf;}return this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0xcb'),_0x4592('0x1c6'),_0x4b4814));};AGIVertices[_0x4592('0x14')]['system']=function(_0x255da6){logger[_0x4592('0x31')](util['format'](_0x4592('0x1c9'),_0x255da6[_0x4592('0x3b')]));var _0x350013=this[_0x4592('0x5c')][_0x4592('0x75')](this,_0x255da6[_0x4592('0x1ca')]);this['createSquareDetailsReport'][_0x4592('0x75')](this,_0x255da6,_0x255da6['command']);if(this[_0x4592('0xad')](_0x255da6[_0x4592('0xe0')])){var _0x2d9edf=this[_0x4592('0x15')][_0x4592('0x75')](this,_0x255da6[_0x4592('0xe0')]);if(_0x2d9edf){this[_0x4592('0x11')][_0x4592('0xa5')](_0x2d9edf,_0x350013);return this[_0x4592('0x11')][_0x4592('0xac')](util['format'](_0x4592('0x1cb'),_0x255da6['command'],_0x2d9edf));}}return this[_0x4592('0x11')]['noop'](util[_0x4592('0x2b')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x255da6[_0x4592('0x1ca')]));};AGIVertices[_0x4592('0x14')][_0x4592('0x1cc')]=function(_0x323cb8){logger['info'](util[_0x4592('0x2b')](_0x4592('0x1cd'),_0x323cb8[_0x4592('0x3b')]));_0x323cb8['text']=_0x323cb8[_0x4592('0x61')][_0x4592('0xde')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4592('0xad')](_0x323cb8[_0x4592('0x5f')])){return this[_0x4592('0x11')]['noop'](_0x4592('0x1ce'));}if(!this['isConfigured'](_0x323cb8[_0x4592('0x61')])){return this[_0x4592('0x11')][_0x4592('0xac')]('no\x20text\x20configured');}this['channel'][_0x4592('0xac')](util['format'](_0x4592('0x1cf'),_0x323cb8[_0x4592('0x61')]));var _0x47ff7d=this[_0x4592('0x5e')][_0x4592('0x75')](this,_0x323cb8);if(_0x47ff7d){this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x1d0'),_0x47ff7d));var _0x491b72=this[_0x4592('0x11')]['streamFile'](_0x47ff7d);try{fs[_0x4592('0x10e')](_0x47ff7d+'.wav');}catch(_0x475660){logger[_0x4592('0x34')](_0x475660);}return _0x491b72;}return this['channel'][_0x4592('0x34')](_0x323cb8,_0x4592('0x1d1'));};AGIVertices[_0x4592('0x14')][_0x4592('0x1d2')]=function(_0x2a5db5){logger[_0x4592('0x31')](util['format'](_0x4592('0x1d3'),_0x2a5db5[_0x4592('0x3b')]));_0x2a5db5[_0x4592('0x61')]=_0x2a5db5[_0x4592('0x61')][_0x4592('0xde')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4592('0xad')](_0x2a5db5[_0x4592('0x61')])){return this['channel'][_0x4592('0xac')]('no\x20text\x20configured');}this[_0x4592('0x11')][_0x4592('0xac')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x2a5db5[_0x4592('0x61')]));var _0x1e7dc8=this[_0x4592('0x66')]['sync'](this,_0x2a5db5);if(_0x1e7dc8){this[_0x4592('0x11')][_0x4592('0xac')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x1e7dc8));var _0x30b44e=this[_0x4592('0x11')][_0x4592('0x10d')](_0x1e7dc8);try{fs['unlink'](_0x1e7dc8+_0x4592('0x10f'));}catch(_0x5e3d61){logger[_0x4592('0x34')](_0x5e3d61);}return _0x30b44e;}return this['channel'][_0x4592('0x34')](_0x2a5db5,_0x4592('0x1d4'));};AGIVertices['prototype'][_0x4592('0x1d5')]=function(_0x57c863){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x1d6'),_0x57c863[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x57c863[_0x4592('0x163')])){return this[_0x4592('0x11')][_0x4592('0x34')](_0x57c863,'no\x20find\x20by\x20configured');}logger[_0x4592('0x31')](util['format'](_0x4592('0x165'),this[_0x4592('0x11')][_0x4592('0x3d')],_0x57c863[_0x4592('0x163')]));var _0x4e6b81=this['agentUnpause']['sync'](this,_0x57c863['findBy']);if(_0x4e6b81){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x16a'),this[_0x4592('0x11')][_0x4592('0x3d')],_0x57c863[_0x4592('0x163')]));this['channel'][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x16a'),this['channel'][_0x4592('0x3d')],_0x57c863[_0x4592('0x163')]));return{'code':0xc8,'result':_0x4592('0x166')};}else{logger['info'](util[_0x4592('0x2b')](_0x4592('0x167'),this['channel']['callerid'],_0x57c863[_0x4592('0x163')]));this[_0x4592('0x11')][_0x4592('0xac')](util[_0x4592('0x2b')](_0x4592('0x167'),this[_0x4592('0x11')]['callerid'],_0x57c863[_0x4592('0x163')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x4592('0x1d7')]=function(_0x3e363e){logger[_0x4592('0x31')](util[_0x4592('0x2b')](_0x4592('0x1d8'),_0x3e363e[_0x4592('0x3b')]));var _0x5771d5=this['channel']['exec'](_0x4592('0x1d9'),[_0x3e363e[_0x4592('0x1da')],_0x3e363e[_0x4592('0x7c')]]);if(_0x5771d5['result']===-0x1){return _0x5771d5;}return this['channel']['noop'](util[_0x4592('0x2b')](_0x4592('0xcb'),_0x4592('0x1d9'),_0x3e363e[_0x4592('0x1da')]));};AGIVertices['prototype'][_0x4592('0x1db')]=function(_0x2482e1){logger[_0x4592('0x31')](util['format'](_0x4592('0x1dc'),_0x2482e1[_0x4592('0x3b')]));if(!this[_0x4592('0xad')](_0x2482e1[_0x4592('0xe0')])){return this['channel'][_0x4592('0x34')](_0x2482e1,_0x4592('0x1dd'));}var _0x401e21=this[_0x4592('0x15')]['sync'](this,_0x2482e1[_0x4592('0xe0')]);if(!_0x401e21){return this[_0x4592('0x11')][_0x4592('0x34')](_0x2482e1,_0x4592('0xe2'));}var _0x4d4e27=this[_0x4592('0x11')]['getVariable'](_0x401e21);return{'code':0xc8,'result':_0x4d4e27[_0x4592('0xa7')]?_0x4d4e27['extra']:'-'};};String['prototype']['replaceAll']=function(_0x4fcfe6,_0x1fcdd3){return this['split'](_0x4fcfe6)['join'](_0x1fcdd3);};module['exports']=AGIVertices; \ No newline at end of file +var _0xb3f9=['result','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','getSquareOdbc','replace','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','SIP/%s','opts','url','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','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','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20valid\x20credentials\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','generate','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','context','extension','gotoif','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','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','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','no\x20file\x20audio\x20found','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%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','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','.wav','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','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback_priority','getPause','getPauseById','agentPause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','toString','isConfigured','maxRetry','retry','mrcpsynth','MRCPSynth'];(function(_0x1d5352,_0x4f7974){var _0x3395c2=function(_0x1f062a){while(--_0x1f062a){_0x1d5352['push'](_0x1d5352['shift']());}};_0x3395c2(++_0x4f7974);}(_0xb3f9,0x122));var _0x9b3f=function(_0x23dc4b,_0x232451){_0x23dc4b=_0x23dc4b-0x0;var _0x5ee516=_0xb3f9[_0x23dc4b];return _0x5ee516;};'use strict';var fs=require('fs');var path=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var _=require(_0x9b3f('0x2'));var sh=require(_0x9b3f('0x3'));var odbc=require(_0x9b3f('0x4'))();var rs=require('randomstring');var moment=require(_0x9b3f('0x5'));var Mustache=require(_0x9b3f('0x6'));var rp=require(_0x9b3f('0x7'));var logger=require(_0x9b3f('0x8'))('agi');var config=require(_0x9b3f('0x9'));var scripts=require('./scripts');var FILES_PATH=_0x9b3f('0xa');var recursiveMapAttributes=[_0x9b3f('0xb'),_0x9b3f('0xc')];var verticesWithRetry=[_0x9b3f('0xd'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x251a6e,_0x2ff7cf,_0x41a78c){this[_0x9b3f('0xe')]=_0x251a6e;this[_0x9b3f('0xf')]=_0x2ff7cf;this[_0x9b3f('0x10')]=_0x41a78c;};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x12')]=function(_0x4779db,_0x9e421e){this[_0x9b3f('0xf')][_0x9b3f('0x13')](_0x4779db)[_0x9b3f('0x14')](function(_0x56a7b2){_0x9e421e(null,_0x56a7b2?_0x56a7b2[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x39931d){_0x9e421e(_0x39931d);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x17')]=function(_0x1fec63,_0x6b1d57){this[_0x9b3f('0xf')][_0x9b3f('0x18')](_0x1fec63)[_0x9b3f('0x14')](function(_0x21fef5){_0x6b1d57(null,_0x21fef5?_0x21fef5[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x495554){_0x6b1d57(_0x495554);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x19')]=function(_0x1a4567,_0x23c726){this['rpc'][_0x9b3f('0x1a')](_0x1a4567)[_0x9b3f('0x14')](function(_0x295eed){_0x23c726(null,_0x295eed?_0x295eed[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x4e159c){_0x23c726(_0x4e159c);});};AGIVertices[_0x9b3f('0x11')]['getSquareOdbc']=function(_0x3addd7,_0x406631){this[_0x9b3f('0xf')][_0x9b3f('0x1b')](_0x3addd7)[_0x9b3f('0x14')](function(_0x4b1ce2){_0x406631(null,_0x4b1ce2?_0x4b1ce2[_0x9b3f('0x1c')]:![]);})[_0x9b3f('0x16')](function(_0x4f0e55){_0x406631(_0x4f0e55);});};AGIVertices[_0x9b3f('0x11')]['getUser']=function(_0x599b4a,_0x18a8ce){this['rpc'][_0x9b3f('0x1d')](_0x599b4a)[_0x9b3f('0x14')](function(_0x409840){_0x18a8ce(null,_0x409840?_0x409840['name']:![]);})['catch'](function(_0x486349){_0x18a8ce(_0x486349);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1e')]=function(_0x58b464,_0x5644e4){this[_0x9b3f('0xf')]['getTrunkById'](_0x58b464)[_0x9b3f('0x14')](function(_0x401eef){_0x5644e4(null,_0x401eef?_0x401eef[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x40e84b){_0x5644e4(_0x40e84b);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1f')]=function(_0x2b64eb,_0x108ec8){var _0x295013=this;this[_0x9b3f('0xf')]['getSoundById'](_0x2b64eb)['then'](function(_0x54ed85){_0x108ec8(null,_0x54ed85?_0x295013[_0x9b3f('0x20')](_0x54ed85[_0x9b3f('0x21')]):![]);})[_0x9b3f('0x16')](function(_0x4ccdd9){_0x108ec8(_0x4ccdd9);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x22')]=function(_0x30855f,_0x5ea8d1){this['rpc']['getMailAccountById'](_0x30855f)[_0x9b3f('0x14')](function(_0x87dcdb){_0x5ea8d1(null,_0x87dcdb?_0x87dcdb:![]);})['catch'](function(_0x588d4b){_0x5ea8d1(_0x588d4b);});};AGIVertices['prototype'][_0x9b3f('0x23')]=function(_0x432532,_0x5617d9,_0x1d9faa){this[_0x9b3f('0x10')]['sendMailMessage'](_0x432532,_0x5617d9)[_0x9b3f('0x14')](function(){_0x1d9faa(null);})[_0x9b3f('0x16')](function(_0x175554){_0x1d9faa(_0x175554);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x24')]=function(_0x1414a1,_0x23680c){this[_0x9b3f('0xf')]['getIntervalById'](_0x1414a1)[_0x9b3f('0x14')](function(_0x17e41c){if(_0x17e41c){if(_0x17e41c[_0x9b3f('0x25')]){_0x23680c(null,[_0x17e41c['interval']]);}else{_0x23680c(null,_[_0x9b3f('0x26')](_0x17e41c[_0x9b3f('0x27')],_0x9b3f('0x28')));}}else{_0x23680c(null,![]);}})[_0x9b3f('0x16')](function(_0x8c8a34){_0x23680c(_0x8c8a34);});};AGIVertices[_0x9b3f('0x11')]['getSoundPath']=function(_0x590553){return util[_0x9b3f('0x29')](_0x9b3f('0x2a'),FILES_PATH,_0x590553);};AGIVertices['prototype']['getQueryOdbc']=function(_0x44bea4,_0x37962a,_0x13949b){odbc[_0x9b3f('0x2b')](_0x44bea4,function(_0x181707){if(_0x181707){logger['error'](_0x9b3f('0x2c'),_0x181707);_0x13949b(_0x181707);}else{logger[_0x9b3f('0x2d')](_0x9b3f('0x2e'));odbc[_0x9b3f('0x2f')](_0x37962a,function(_0x16ecdf,_0xfe29c8){if(_0x16ecdf){logger['info']('Error\x20executing\x20query\x20%s',_0x37962a);_0x13949b(_0x16ecdf);}else{logger['info'](_0x9b3f('0x30'),_0x37962a);odbc[_0x9b3f('0x31')](function(_0x52d696){if(_0x52d696){logger[_0x9b3f('0x32')](_0x9b3f('0x33'),_0x52d696);}_0x13949b(null,_0xfe29c8);});}});}});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x34')]=function(_0x5be3fd,_0x3c336e){this[_0x9b3f('0xf')][_0x9b3f('0x35')](_0x5be3fd)[_0x9b3f('0x14')](function(_0x4c9508){_0x3c336e(null,_0x4c9508?_0x4c9508:![]);})[_0x9b3f('0x16')](function(_0x4c7cb9){_0x3c336e(_0x4c7cb9);});};AGIVertices['prototype']['createSmsMessage']=function(_0x1b5735,_0x49305c){this['rpc'][_0x9b3f('0x36')](_0x1b5735)['then'](function(_0x410ae2){_0x49305c(null,_0x410ae2);})[_0x9b3f('0x16')](function(_0x4e101d){_0x49305c(_0x4e101d);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x37')]=function(_0x2b71f6,_0x2d6197,_0x398fda){this[_0x9b3f('0xf')][_0x9b3f('0x37')]({'uniqueid':this['channel'][_0x9b3f('0x38')],'node':_0x2b71f6[_0x9b3f('0x39')],'application':_0x2b71f6['agicommand'],'data':_0x2d6197||null,'project_name':this['channel'][_0x9b3f('0x3a')],'callerid':this[_0x9b3f('0xe')][_0x9b3f('0x3b')]})[_0x9b3f('0x14')](function(_0x1a7b0f){if(_0x398fda){_0x398fda(null,_0x1a7b0f);}})[_0x9b3f('0x16')](function(_0x8ff5f0){if(_0x398fda){_0x398fda(_0x8ff5f0);}});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x3c')]=function(_0x56953d,_0x46d286,_0x288ff8,_0x3c574d){this[_0x9b3f('0xf')][_0x9b3f('0x3c')]({'uniqueid':this[_0x9b3f('0xe')][_0x9b3f('0x38')],'callerid':this[_0x9b3f('0xe')][_0x9b3f('0x3b')],'calleridname':this[_0x9b3f('0xe')][_0x9b3f('0x3d')],'context':this['channel']['context'],'extension':this['channel']['extension'],'priority':this[_0x9b3f('0xe')][_0x9b3f('0x3e')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x9b3f('0xe')][_0x9b3f('0x3f')],'projectName':this['channel']['arg_1'],'saveName':_0x46d286,'filename':_0x56953d[_0x9b3f('0x40')]||_0x46d286,'savePath':_0x288ff8})['then'](function(_0x562577){_0x3c574d(null,_0x562577);})['catch'](function(_0x212f3c){_0x3c574d(_0x212f3c);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x41')]=function(_0x3b5131,_0x290253,_0x103ae2,_0x2dd478,_0x3f100f){this[_0x9b3f('0xf')]['createSquareMessage']({'uniqueid':this[_0x9b3f('0xe')][_0x9b3f('0x38')],'body':_0x3b5131,'direction':_0x290253,'providerName':_0x103ae2,'providerResponse':_0x2dd478})['then'](function(_0x584b5f){if(_0x3f100f){_0x3f100f(null,_0x584b5f);}})[_0x9b3f('0x16')](function(_0x253f2d){if(_0x3f100f){_0x3f100f(_0x253f2d);}});};AGIVertices[_0x9b3f('0x11')]['createCmContact']=function(_0x2742e7,_0x491eae){this['rpc'][_0x9b3f('0x42')]({'firstName':_[_0x9b3f('0x43')](_0x2742e7['name'])||_[_0x9b3f('0x44')](_0x2742e7['name'])?_0x9b3f('0x45')+Math[_0x9b3f('0x46')]():_0x2742e7['name'],'lastName':_[_0x9b3f('0x43')](_0x2742e7[_0x9b3f('0x47')])||_['isNil'](_0x2742e7['lastName'])?null:_0x2742e7['lastName'],'phone':_0x2742e7[_0x9b3f('0x48')],'ListId':_0x2742e7[_0x9b3f('0x49')],'scheduledat':_0x2742e7[_0x9b3f('0x4a')],'callbackUniqueid':this[_0x9b3f('0xe')][_0x9b3f('0x38')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x2742e7['scheduledAt']['toString'](),'priority':_0x2742e7[_0x9b3f('0x4b')]})['then'](function(_0x35cd0d){_0x491eae(null,_0x35cd0d);})[_0x9b3f('0x16')](function(_0x47c96b){_0x491eae(_0x47c96b);});};AGIVertices['prototype'][_0x9b3f('0x4c')]=function(_0x2c0f0c,_0x215c3d){this[_0x9b3f('0xf')][_0x9b3f('0x4d')](_0x2c0f0c)[_0x9b3f('0x14')](function(_0x1d2376){_0x215c3d(null,_0x1d2376?_0x1d2376[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x39c04a){_0x215c3d(_0x39c04a);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x4e')]=function(_0x2ee2c7,_0x1f7489,_0x15075f){var _0x289bc2={'role':_0x9b3f('0x4f')};_0x289bc2[_0x2ee2c7]=this[_0x9b3f('0xe')]['callerid'];this[_0x9b3f('0xf')]['agentPause'](_0x289bc2,_0x1f7489,this[_0x9b3f('0xe')][_0x9b3f('0x38')])['then'](function(_0xb7249b){_0x15075f(null,_[_0x9b3f('0x44')](_0xb7249b)?![]:!![]);})['catch'](function(_0x5ec7dc){logger[_0x9b3f('0x32')](_0x5ec7dc);_0x15075f(null,![]);});};AGIVertices[_0x9b3f('0x11')]['agentUnpause']=function(_0x4ef0a4,_0xe8108b){var _0x44368c={'role':_0x9b3f('0x4f')};_0x44368c[_0x4ef0a4]=this[_0x9b3f('0xe')][_0x9b3f('0x3b')];this[_0x9b3f('0xf')]['agentUnpause'](_0x44368c)[_0x9b3f('0x14')](function(_0x240287){_0xe8108b(null,_['isNil'](_0x240287)?![]:!![]);})[_0x9b3f('0x16')](function(_0x43c97b){logger[_0x9b3f('0x32')](_0x43c97b);_0xe8108b(null,![]);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x50')]=function(_0x5a83df,_0x6d506d){var _0x428e85={'role':_0x9b3f('0x4f')};_0x428e85[_0x5a83df]=this['channel'][_0x9b3f('0x3b')];this[_0x9b3f('0xf')][_0x9b3f('0x50')](_0x428e85)[_0x9b3f('0x14')](function(_0x1a26cd){_0x6d506d(null,_[_0x9b3f('0x44')](_0x1a26cd)?![]:!![]);})[_0x9b3f('0x16')](function(_0x30bfb7){logger['error'](_0x30bfb7);_0x6d506d(null,![]);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x51')]=function(_0x232f1a,_0x1e252c){var _0x32b703={'role':_0x9b3f('0x4f')};_0x32b703[_0x232f1a]=this['channel']['callerid'];var _0x4a3a59=_0x232f1a!=_0x9b3f('0x52')?util[_0x9b3f('0x29')](_0x9b3f('0x53'),_0x9b3f('0x54'),this['channel']['callerid']):undefined;this[_0x9b3f('0xf')]['agentLogin'](_0x32b703,_0x4a3a59)['then'](function(_0x28dbbc){_0x1e252c(null,_['isNil'](_0x28dbbc)?![]:!![]);})[_0x9b3f('0x16')](function(_0x56aa84){logger[_0x9b3f('0x32')](_0x56aa84);_0x1e252c(null,![]);});};AGIVertices['prototype'][_0x9b3f('0x55')]=function(_0x4d7b58,_0x394239){sh[_0x9b3f('0x56')](_[_0x9b3f('0x57')](_0x4d7b58),function(_0x3f146d,_0x29fa0c){var _0x3815e0=_0x29fa0c['replace'](/(\r\n|\n|\r)/gm,'');_0x394239(null,_0x3815e0);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x58')]=function(_0x4e4559,_0x220f7c){scripts[_0x9b3f('0x58')](_0x4e4559[_0x9b3f('0x59')],_0x4e4559[_0x9b3f('0x5a')]||_0x9b3f('0x5b'),_0x4e4559[_0x9b3f('0x5b')],_0x4e4559[_0x9b3f('0x5c')]||_0x9b3f('0x5d'),_0x4e4559['ssmlGender']||'MALE',_0x4e4559[_0x9b3f('0x5e')]||_0x9b3f('0x5f'))[_0x9b3f('0x14')](function(_0x2dbc3a){_0x220f7c(null,_0x2dbc3a);})[_0x9b3f('0x16')](function(_0xfe23a5){_0x220f7c(_0xfe23a5);});};AGIVertices['prototype'][_0x9b3f('0x60')]=function(_0x551a01,_0x205225){scripts['googleTTS'](_0x551a01[_0x9b3f('0x5b')],_0x551a01[_0x9b3f('0x61')]||'en',0x1)[_0x9b3f('0x14')](function(_0x19f514){_0x205225(null,_0x19f514);})[_0x9b3f('0x16')](function(_0x5d712e){_0x205225(_0x5d712e);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x62')]=function(_0x439733,_0x2688b9){var _0x130616={'uri':_0x439733['url'],'method':_0x439733[_0x9b3f('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x439733[_0x9b3f('0x64')])===_0x9b3f('0x65')&&parseInt(_0x439733[_0x9b3f('0x64')])>=0x1?parseInt(_0x439733[_0x9b3f('0x64')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9b3f('0x66'),_0x9b3f('0x67')],_0x130616['method'][_0x9b3f('0x68')]())){try{_0x130616['body']=_0x439733[_0x9b3f('0xc')]?JSON[_0x9b3f('0x69')](_0x439733[_0x9b3f('0xc')]):{};}catch(_0x233ae0){logger[_0x9b3f('0x32')](_0x9b3f('0x6a'),_0x233ae0);}}try{_0x130616[_0x9b3f('0x6b')]=_0x439733[_0x9b3f('0xb')]?JSON[_0x9b3f('0x69')](_0x439733[_0x9b3f('0xb')]):{};}catch(_0x6823a3){logger['error'](_0x9b3f('0x6c'),_0x6823a3);}if(_0x439733['computedVariables']){try{var _0x3dd3a5=require(_0x439733[_0x9b3f('0x6d')])[_0x9b3f('0x6e')](this,_0x130616);_0x130616['uri']=Mustache[_0x9b3f('0x6f')](_0x439733['url'],_0x3dd3a5,{},['$$','$$']);if(_0x130616['headers']){_0x130616[_0x9b3f('0x6b')]=JSON[_0x9b3f('0x69')](Mustache[_0x9b3f('0x6f')](JSON[_0x9b3f('0x70')](_0x130616[_0x9b3f('0x6b')]),_0x3dd3a5,{},['$$','$$']));}if(_0x130616[_0x9b3f('0x71')]){_0x130616['body']=JSON['parse'](Mustache[_0x9b3f('0x6f')](JSON['stringify'](_0x130616[_0x9b3f('0x71')]),_0x3dd3a5,{},['$$','$$']));}}catch(_0x5e1c48){logger[_0x9b3f('0x32')](_0x9b3f('0x72'),_0x5e1c48);}}rp(_0x130616)[_0x9b3f('0x14')](function(_0x525a85){var _0x14894e={'statusCode':_0x525a85[_0x9b3f('0x73')]||0xc8,'statusMessage':_0x525a85[_0x9b3f('0x74')]||'OK','headers':_0x525a85[_0x9b3f('0x6b')]||{},'body':_0x525a85['body']||{}};_0x2688b9(null,_0x14894e);})[_0x9b3f('0x16')](function(_0x254094){var _0xef6d9b={'statusCode':_0x254094['statusCode']||0x1f4,'statusMessage':_0x254094['message']||_0x9b3f('0x75'),'headers':_0x254094[_0x9b3f('0x76')]['headers']||{},'body':_0x254094['options'][_0x9b3f('0x71')]||{}};_0x2688b9(null,_0xef6d9b);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x77')]=function(_0x52083b,_0x17d462){scripts['googleDialogflow'](this[_0x9b3f('0xe')][_0x9b3f('0x38')],_0x52083b[_0x9b3f('0x78')],_0x52083b[_0x9b3f('0x5b')],_0x52083b[_0x9b3f('0x79')]||'en')[_0x9b3f('0x14')](function(_0x39fae2){_0x17d462(null,_0x39fae2);})[_0x9b3f('0x16')](function(_0x5c27e8){_0x17d462(_0x5c27e8);});};AGIVertices[_0x9b3f('0x11')]['googleDialogflowV2']=function(_0x2063ac,_0x282ef6){scripts[_0x9b3f('0x7a')](this[_0x9b3f('0xe')][_0x9b3f('0x38')],_0x2063ac['dialogflowV2_project_id'],_0x2063ac[_0x9b3f('0x7b')],_0x2063ac[_0x9b3f('0x7c')],_0x2063ac[_0x9b3f('0x5b')],_0x2063ac[_0x9b3f('0x7d')]||'en')[_0x9b3f('0x14')](function(_0x54612d){_0x282ef6(null,_0x54612d);})['catch'](function(_0x2dce43){_0x282ef6(_0x2dce43);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x7e')]=function(_0x29a949,_0x305579){scripts[_0x9b3f('0x7e')](this[_0x9b3f('0xe')],_0x29a949)[_0x9b3f('0x14')](function(_0x175caf){_0x305579(null,_0x175caf);})['catch'](function(_0x4aba4b){_0x305579(_0x4aba4b);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x7f')]=function(_0x62ccc,_0x54c39b){scripts['ispeechTTS'](_0x62ccc[_0x9b3f('0x78')],_0x62ccc[_0x9b3f('0x5b')],_0x62ccc[_0x9b3f('0x80')]||_0x9b3f('0x5d'),_0x62ccc[_0x9b3f('0x81')])['then'](function(_0x51cc0b){_0x54c39b(null,_0x51cc0b);})[_0x9b3f('0x16')](function(_0x4d906a){_0x54c39b(_0x4d906a);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x82')]=function(_0x1a7d1b,_0x4e828a,_0x33a436){scripts[_0x9b3f('0x82')](_0x4e828a,_0x1a7d1b[_0x9b3f('0x78')],_0x1a7d1b[_0x9b3f('0x83')]||_0x9b3f('0x5d'),this['isConfigured'](_0x1a7d1b[_0x9b3f('0x84')])?_0x1a7d1b['model']:undefined)[_0x9b3f('0x14')](function(_0x1b7fc0){_0x33a436(null,_0x1b7fc0);})['catch'](function(_0x32399e){_0x33a436(_0x32399e);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x85')]=function(_0x554c26,_0x1afb99){scripts[_0x9b3f('0x85')](_0x554c26[_0x9b3f('0x86')],_0x554c26[_0x9b3f('0x87')],_0x554c26['aws_polly_region'],_0x554c26[_0x9b3f('0x88')]||_0x9b3f('0x89'),_0x554c26['text'],_0x554c26[_0x9b3f('0x8a')]||'text')[_0x9b3f('0x14')](function(_0x1f135e){_0x1afb99(null,_0x1f135e);})['catch'](function(_0x345dc3){_0x1afb99(_0x345dc3);});};AGIVertices[_0x9b3f('0x11')]['awsLex']=function(_0x514d9d,_0x599f0e){scripts[_0x9b3f('0x8b')](this[_0x9b3f('0xe')][_0x9b3f('0x38')],_0x514d9d[_0x9b3f('0x86')],_0x514d9d['aws_secret_access_key'],_0x514d9d[_0x9b3f('0x8c')],_0x514d9d[_0x9b3f('0x5b')],_0x514d9d[_0x9b3f('0x8d')])[_0x9b3f('0x14')](function(_0x1a733a){_0x599f0e(null,_0x1a733a);})[_0x9b3f('0x16')](function(_0x5afec4){_0x599f0e(_0x5afec4);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x8e')]=function(_0x637c86,_0x147712,_0x23670c){scripts[_0x9b3f('0x8e')](_0x147712,_0x637c86[_0x9b3f('0x78')],_0x637c86[_0x9b3f('0x8f')]||_0x9b3f('0x5d'))[_0x9b3f('0x14')](function(_0x4ecb56){_0x23670c(null,_0x4ecb56);})[_0x9b3f('0x16')](function(_0x124e68){_0x23670c(_0x124e68);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x90')]=function(_0xd0a2ce,_0xcec828,_0x249323){scripts[_0x9b3f('0x90')](_0xcec828,_0xd0a2ce[_0x9b3f('0x91')],_0xd0a2ce[_0x9b3f('0x92')],_0xd0a2ce[_0x9b3f('0x93')])[_0x9b3f('0x14')](function(_0xe188ab){_0x249323(null,_0xe188ab);})[_0x9b3f('0x16')](function(_0xc41741){_0x249323(_0xc41741);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x94')]=function(_0x5d5ef4){var _0x5737d9=_['includes'](verticesWithRetry,_0x5d5ef4[_0x9b3f('0x95')])?_0x5d5ef4:_[_0x9b3f('0x96')](_0x5d5ef4);for(var _0xc2cfa9 in _0x5737d9){if(_0x5737d9[_0x9b3f('0x97')](_0xc2cfa9)){if(_0x5737d9[_0xc2cfa9]&&_[_0x9b3f('0x98')](_0x5737d9[_0xc2cfa9])){if(_['includes'](recursiveMapAttributes,_0xc2cfa9)){_0x5737d9[_0xc2cfa9]=this[_0x9b3f('0x99')](_0x5737d9[_0xc2cfa9]);}else{_0x5737d9[_0xc2cfa9]=this[_0x9b3f('0x9a')](_0x5737d9[_0xc2cfa9]);}}}}return _0x5737d9;};AGIVertices['prototype'][_0x9b3f('0x9b')]=function(_0x4ca8f6){for(var _0x1c3c53 in _0x4ca8f6){if(_0x4ca8f6[_0x9b3f('0x97')](_0x1c3c53)){if(_[_0x9b3f('0x9c')](_0x4ca8f6[_0x1c3c53])){this[_0x9b3f('0x9b')](_0x4ca8f6[_0x1c3c53]);}else if(_[_0x9b3f('0x9d')](_0x4ca8f6[_0x1c3c53])){for(var _0x50e3f3=0x0;_0x50e3f3<_0x4ca8f6[_0x1c3c53][_0x9b3f('0x9e')];_0x50e3f3++){this[_0x9b3f('0x9b')](_0x4ca8f6[_0x1c3c53][_0x50e3f3]);}}else if(_[_0x9b3f('0x98')](_0x4ca8f6[_0x1c3c53])){_0x4ca8f6[_0x1c3c53]=this[_0x9b3f('0x9a')](_0x4ca8f6[_0x1c3c53]);}}}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x9f')]=function(_0x194055,_0x77d7f8){for(var _0x23c665 in _0x194055){if(_0x194055[_0x9b3f('0x97')](_0x23c665)){if(_[_0x9b3f('0x9c')](_0x194055[_0x23c665])){if(!_[_0x9b3f('0x43')](_0x194055[_0x23c665])){this[_0x9b3f('0x9f')](_0x194055[_0x23c665],util[_0x9b3f('0x29')](_0x9b3f('0xa0'),_0x77d7f8,_0x23c665));}}else if(_[_0x9b3f('0x9d')](_0x194055[_0x23c665])){for(var _0x3cd602=0x0;_0x3cd602<_0x194055[_0x23c665][_0x9b3f('0x9e')];_0x3cd602++){this[_0x9b3f('0x9f')](_0x194055[_0x23c665][_0x3cd602],util['format'](_0x9b3f('0xa0'),_0x77d7f8,_0x23c665+'['+_0x3cd602+']'));}}else{if(!_[_0x9b3f('0x44')](_0x194055[_0x23c665])){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util['format'](_0x9b3f('0xa0'),_0x77d7f8,_0x23c665),_0x194055[_0x23c665]);}}}}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x99')]=function(_0x2c9c07){try{var _0x35c67f=JSON[_0x9b3f('0x69')](_0x2c9c07);this[_0x9b3f('0x9b')](_0x35c67f);return JSON[_0x9b3f('0x70')](_0x35c67f);}catch(_0x4ed679){return this[_0x9b3f('0x9a')](_0x2c9c07);}};AGIVertices[_0x9b3f('0x11')]['replaceAllVariables']=function(_0x2bb67b){var _0x27d8b5=_0x2bb67b['split']('{');for(var _0xc375b8=0x1;_0xc375b8<_0x27d8b5[_0x9b3f('0x9e')];_0xc375b8+=0x1){var _0x358291=_0x27d8b5[_0xc375b8]['split']('}');if(_0x358291[_0x9b3f('0x9e')]>0x1){_0x2bb67b=_0x2bb67b[_0x9b3f('0xa2')]('{'+_0x358291[0x0]+'}',this['channel'][_0x9b3f('0x12')](_0x358291[0x0])[_0x9b3f('0xa3')]||_0x358291[0x0]);}}if(_0x27d8b5['length']===0x1){return _0x2bb67b[_0x9b3f('0xa4')]();}return this[_0x9b3f('0x9a')](_0x2bb67b);};AGIVertices[_0x9b3f('0x11')]['getAndSetVariable']=function(_0x5c9aa2,_0x281e10){var _0x1ba562=this[_0x9b3f('0xe')][_0x9b3f('0x12')](_0x5c9aa2);if(_0x1ba562['result']===-0x1){return _0x1ba562;}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x281e10,_0x1ba562[_0x9b3f('0xa3')]));return this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x281e10,_0x1ba562[_0x9b3f('0xa3')]);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xa5')]=function(_0x40b876){return _0x40b876&&_0x40b876!=='0'&&_0x40b876!=='-1'&&_0x40b876!=='';};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xa6')]=function(_0x452f4c){this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x452f4c,'-');_0x452f4c[_0x9b3f('0xa7')]=_0x452f4c[_0x9b3f('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xa8')]=function(_0x23358e){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x23358e[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x23358e['text'])){return this[_0x9b3f('0xe')]['noop']('no\x20text\x20configured');}var _0x38a7de='\x22'+_0x23358e[_0x9b3f('0x5b')]+'\x22';if(this[_0x9b3f('0xa5')](_0x23358e['options'])){_0x38a7de+=','+_0x23358e[_0x9b3f('0x76')];}var _0xb2aefa=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0xa9'),_0x38a7de);if(_0xb2aefa[_0x9b3f('0xaa')]===-0x1){return _0xb2aefa;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x38a7de));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xac')]=function(_0x463be4){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0xad'),_0x463be4[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x463be4[_0x9b3f('0xae')])){return this[_0x9b3f('0xe')]['noop'](_0x9b3f('0xaf'));}var _0x37fa14=_0x463be4[_0x9b3f('0xae')];if(this[_0x9b3f('0xa5')](_0x463be4[_0x9b3f('0x76')])){_0x37fa14+=','+_0x463be4[_0x9b3f('0x76')];}var _0x5a90f9=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0xb0'),_0x37fa14);if(_0x5a90f9[_0x9b3f('0xaa')]===-0x1){return _0x5a90f9;}var _0x213564=this[_0x9b3f('0xb1')](_0x9b3f('0xb2'),_0x9b3f('0xb3'));if(_0x213564[_0x9b3f('0xaa')]===-0x1){return _0x213564;}var _0x393a92=this[_0x9b3f('0xb1')](_0x9b3f('0xb4'),_0x9b3f('0xb5'));if(_0x393a92[_0x9b3f('0xaa')]===-0x1){return _0x393a92;}var _0x3ccf99=this[_0x9b3f('0xb1')](_0x9b3f('0xb6'),_0x9b3f('0xb7'));if(_0x3ccf99[_0x9b3f('0xaa')]===-0x1){return _0x3ccf99;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x37fa14));};AGIVertices['prototype'][_0x9b3f('0xb8')]=function(_0x2d82f5){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0xb9'),_0x2d82f5[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')]['agi']([_0x2d82f5[_0x9b3f('0xba')],_0x2d82f5['args']]);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xbb')]=function(_0x417011){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x417011['label']));if(this[_0x9b3f('0xa5')](_0x417011[_0x9b3f('0x64')])){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xbc'),_0x417011['timeout']));var _0x17f751=this['channel']['wait'](_0x417011['timeout']);if(_0x17f751[_0x9b3f('0xaa')]===-0x1){return _0x17f751;}}return this[_0x9b3f('0xe')][_0x9b3f('0xbb')]();};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xbd')]=function(_0x5122d5){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xbe'),_0x5122d5['label']));if(!this[_0x9b3f('0xa5')](_0x5122d5[_0x9b3f('0x49')])){return this[_0x9b3f('0xe')]['error'](_0x5122d5,'no\x20list\x20selected');}_0x5122d5['scheduledAt']=moment();if(this[_0x9b3f('0xa5')](_0x5122d5[_0x9b3f('0xbf')])){_0x5122d5['scheduledAt']=moment()[_0x9b3f('0xc0')](_0x5122d5[_0x9b3f('0xbf')],_0x9b3f('0xc1'));}if(!this['isConfigured'](_0x5122d5[_0x9b3f('0x4b')])){_0x5122d5[_0x9b3f('0x4b')]=0x2;}this[_0x9b3f('0x42')][_0x9b3f('0x6e')](this,_0x5122d5);return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xc2'),_0x5122d5[_0x9b3f('0x48')],_0x5122d5[_0x9b3f('0x49')],_0x5122d5[_0x9b3f('0x4a')]));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xc3')]=function(_0x208fc8){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xc4'),_0x208fc8['label']));var _0x53a8c5=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x208fc8['application'],_0x208fc8[_0x9b3f('0x76')]);if(_0x53a8c5[_0x9b3f('0xaa')]===-0x1){return _0x53a8c5;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20%s\x20%s',_0x208fc8[_0x9b3f('0xc5')],_0x208fc8['options']));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xc6')]=function(_0x1198cf){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1198cf[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x1198cf[_0x9b3f('0x5b')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}var _0x4eb412='\x22'+_0x1198cf[_0x9b3f('0x5b')]+'\x22';if(this[_0x9b3f('0xa5')](_0x1198cf[_0x9b3f('0x76')])){_0x4eb412+=','+_0x1198cf[_0x9b3f('0x76')];}var _0x2cf612=this[_0x9b3f('0xe')][_0x9b3f('0x56')]('MRCPSynth',_0x4eb412);if(_0x2cf612[_0x9b3f('0xaa')]===-0x1){return _0x2cf612;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xc8'),_0x4eb412));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xc9')]=function(_0x4c2e46){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xca'),_0x4c2e46[_0x9b3f('0x39')]));if(!this['isConfigured'](_0x4c2e46['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}var _0x318347='\x22'+_0x4c2e46[_0x9b3f('0x5b')]+'\x22';if(this[_0x9b3f('0xa5')](_0x4c2e46[_0x9b3f('0x76')])){_0x318347+=','+_0x4c2e46[_0x9b3f('0x76')];}var _0x53aaf8=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0xa9'),_0x318347);if(_0x53aaf8[_0x9b3f('0xaa')]===-0x1){return _0x53aaf8;}return this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0xc8'),_0x318347));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xcb')]=function(_0x57948c){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xcc'),_0x57948c[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x57948c['grammar'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xaf'));}var _0x3a2a81=_0x57948c['grammar'];if(this[_0x9b3f('0xa5')](_0x57948c[_0x9b3f('0x76')])){_0x3a2a81+=','+_0x57948c[_0x9b3f('0x76')];}var _0x347cd1=this['channel'][_0x9b3f('0x56')](_0x9b3f('0xb0'),_0x3a2a81);if(_0x347cd1[_0x9b3f('0xaa')]===-0x1){return _0x347cd1;}var _0x462b7b=this['getAndSetVariable'](_0x9b3f('0xb2'),_0x9b3f('0xcd'));if(_0x462b7b[_0x9b3f('0xaa')]===-0x1){return _0x462b7b;}var _0x23b58d=this[_0x9b3f('0xb1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x23b58d['result']===-0x1){return _0x23b58d;}var _0x1ef881=this[_0x9b3f('0xb1')](_0x9b3f('0xb6'),'LUMENVOX_ASR_INSTANCE');if(_0x1ef881[_0x9b3f('0xaa')]===-0x1){return _0x1ef881;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3a2a81));};AGIVertices['prototype'][_0x9b3f('0xce')]=function(_0x3cee1d){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xcf'),_0x3cee1d[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x3cee1d['grammar'])){return this[_0x9b3f('0xe')]['noop'](_0x9b3f('0xaf'));}var _0x205f9b=_0x3cee1d[_0x9b3f('0xae')];if(this['isConfigured'](_0x3cee1d[_0x9b3f('0x76')])){_0x205f9b+=','+_0x3cee1d[_0x9b3f('0x76')];}var _0xc4ee11=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0xb0'),_0x205f9b);if(_0xc4ee11[_0x9b3f('0xaa')]===-0x1){return _0xc4ee11;}var _0x36bac2=this['getAndSetVariable'](_0x9b3f('0xb2'),'SESTEK_ASR_CONFIDENCE');if(_0x36bac2['result']===-0x1){return _0x36bac2;}var _0x473ab8=this[_0x9b3f('0xb1')](_0x9b3f('0xb4'),'SESTEK_ASR_TRANSCRIPT');if(_0x473ab8['result']===-0x1){return _0x473ab8;}var _0x16ec87=this[_0x9b3f('0xb1')](_0x9b3f('0xb6'),_0x9b3f('0xd0'));if(_0x16ec87[_0x9b3f('0xaa')]===-0x1){return _0x16ec87;}return this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x205f9b));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xd1')]=function(_0x2f1ca){logger[_0x9b3f('0x2d')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2f1ca[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x2f1ca[_0x9b3f('0xd2')])){return this[_0x9b3f('0xe')]['error'](_0x2f1ca,_0x9b3f('0xd3'));}var _0x45fbae=this[_0x9b3f('0xd4')][_0x9b3f('0x6e')](this,_0x2f1ca[_0x9b3f('0xd2')]);if(!_0x45fbae){return this[_0x9b3f('0xe')]['error'](_0x2f1ca,'no\x20odbc\x20database\x20found');}if(!this[_0x9b3f('0xa5')](_0x2f1ca['query'])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x2f1ca,'no\x20query\x20configured');}var _0x2d6210=_0x2f1ca[_0x9b3f('0x2f')][_0x9b3f('0xd5')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xd6'),_0x2d6210));var _0xd0a0a0=this[_0x9b3f('0xd7')][_0x9b3f('0x6e')](this,_0x45fbae,_0x2d6210);this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x2f1ca,_0x2d6210);if(!this['isConfigured'](_0x2f1ca[_0x9b3f('0xd8')])){return this[_0x9b3f('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5b8dcf=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x2f1ca['variable_id']);if(!_0x5b8dcf){return this['channel'][_0x9b3f('0x32')](_0x2f1ca,_0x9b3f('0xd9'));}var _0x1b0681=this;_0xd0a0a0[_0x9b3f('0xda')](function(_0x39b943,_0x340b33){Object[_0x9b3f('0xdb')](_0x39b943)[_0x9b3f('0xda')](function(_0x3c3a55){_0x1b0681[_0x9b3f('0xe')]['setVariable'](util['format']('%s[%s][%s]',_0x5b8dcf,_0x340b33,_0x3c3a55),_0x39b943[_0x3c3a55]);});});this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0xdc'),_0x5b8dcf),_0xd0a0a0[_0x9b3f('0x9e')]);return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0xdd'),_0x5b8dcf));};AGIVertices['prototype'][_0x9b3f('0xde')]=function(_0x2bc6ac){logger[_0x9b3f('0xdf')](util[_0x9b3f('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2bc6ac[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x2bc6ac[_0x9b3f('0xe0')])){return this[_0x9b3f('0xe')]['error'](_0x2bc6ac,'no\x20user\x20selected');}var _0x1e11be=this['getUser'][_0x9b3f('0x6e')](this,_0x2bc6ac['sip_id']);if(!_0x1e11be){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x2bc6ac,_0x9b3f('0xe1'));}var _0x1577e7=this[_0x9b3f('0xe')]['exec']('DIAL',[util['format'](_0x9b3f('0xe2'),_0x1e11be),_0x2bc6ac[_0x9b3f('0x64')],_0x2bc6ac[_0x9b3f('0xe3')],_0x2bc6ac[_0x9b3f('0xe4')]]);if(_0x1577e7[_0x9b3f('0xaa')]===-0x1){return _0x1577e7;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xe5'),_0x9b3f('0xe6')));};AGIVertices['prototype'][_0x9b3f('0xe7')]=function(_0x4940aa){logger['info'](util['format'](_0x9b3f('0xe8'),_0x4940aa[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x4940aa[_0x9b3f('0x78')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xe9'));}if(!this[_0x9b3f('0xa5')](_0x4940aa['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')][_0x9b3f('0xea')]=!![];this[_0x9b3f('0x37')](_0x4940aa);this[_0x9b3f('0x41')](_0x4940aa['text'],'in','','');this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xeb'),_0x4940aa[_0x9b3f('0x5b')]));var _0x116955=this[_0x9b3f('0x77')][_0x9b3f('0x6e')](this,_0x4940aa);if(_0x116955){for(var _0x39dfaf in _0x116955){if(_0x116955[_0x9b3f('0x97')](_0x39dfaf)){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0xec'),_0x39dfaf['toUpperCase']()),_0x116955[_0x39dfaf]);}}this[_0x9b3f('0x41')](_0x116955[_0x9b3f('0xed')],_0x9b3f('0xee'),_0x9b3f('0xe7'),'');return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xef'),_0x116955[_0x9b3f('0xed')]));}return this['channel'][_0x9b3f('0x32')](_0x4940aa,_0x9b3f('0xf0'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xf1')]=function(_0x24aebf){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0xf2'),_0x24aebf[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0xf3')])){return this['channel'][_0x9b3f('0xab')](_0x9b3f('0xf4'));}if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0x7b')])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0x7c')])){return this['channel'][_0x9b3f('0xab')]('no\x20private_key\x20configured');}if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0x7d')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20anguage\x20configured');}if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0x5b')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x9b3f('0x37')](_0x24aebf);this['createSquareMessage'](_0x24aebf[_0x9b3f('0x5b')],'in','','');this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xf5'),_0x24aebf[_0x9b3f('0x5b')]));var _0x556851=this[_0x9b3f('0x7a')]['sync'](this,_0x24aebf);if(_0x556851){for(var _0x26fb1c in _0x556851){if(_0x556851[_0x9b3f('0x97')](_0x26fb1c)){if(_0x26fb1c!==_0x9b3f('0xf6')){this['channel'][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0xec'),_0x26fb1c[_0x9b3f('0x68')]()),_0x556851[_0x26fb1c]);}}}this[_0x9b3f('0x41')](_0x556851[_0x9b3f('0xed')],_0x9b3f('0xee'),_0x9b3f('0xf1'),_0x556851[_0x9b3f('0xf6')]);return this['channel']['noop'](util[_0x9b3f('0x29')](_0x9b3f('0xf7'),_0x556851['speech']));}return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x24aebf,_0x9b3f('0xf8'));};AGIVertices[_0x9b3f('0x11')]['sesteknda']=function(_0x547a4d){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xf9'),_0x547a4d['label']));if(!this[_0x9b3f('0xa5')](_0x547a4d['ndauth_url'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x547a4d[_0x9b3f('0xfa')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xfb'));}if(!this[_0x9b3f('0xa5')](_0x547a4d[_0x9b3f('0xfc')])){return this['channel'][_0x9b3f('0xab')](_0x9b3f('0xfd'));}if(!this[_0x9b3f('0xa5')](_0x547a4d[_0x9b3f('0xfe')])){return this['channel'][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')]['bot']=!![];this[_0x9b3f('0x37')](_0x547a4d);this[_0x9b3f('0x41')](_0x547a4d['text'],'in','','');this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Trying\x20SestekNDA:\x20%s',_0x547a4d['text']));var _0x9fc04e=this['sestekNDA'][_0x9b3f('0x6e')](this,_0x547a4d);if(_0x9fc04e){for(var _0x2f6a98 in _0x9fc04e){if(_0x9fc04e['hasOwnProperty'](_0x2f6a98)){this[_0x9b3f('0xe')]['setVariable'](util[_0x9b3f('0x29')](_0x9b3f('0xff'),_0x2f6a98[_0x9b3f('0x68')]()),_0x9fc04e[_0x2f6a98]);}}this[_0x9b3f('0x41')](_0x9fc04e[_0x9b3f('0xed')],_0x9b3f('0xee'),'sesteknda','');if(_0x9fc04e[_0x9b3f('0x100')]){this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x101'),_0x9fc04e[_0x9b3f('0x100')]));var _0x109e1b=this[_0x9b3f('0xe')][_0x9b3f('0x102')](_0x9fc04e[_0x9b3f('0x100')]);try{fs[_0x9b3f('0x103')](_0x9fc04e['audiofile']+'.wav');}catch(_0x381c96){logger['error'](_0x381c96);}return _0x109e1b;}else{return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x104'),_0x9fc04e['speech']));}}return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x547a4d,_0x9b3f('0x105'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x106')]=function(_0x52fdd6){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x107'),_0x52fdd6[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x106'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x108')]=function(_0x32cdc0){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x109'),_0x32cdc0[_0x9b3f('0x39')]));var _0x3ed5e5='';if(_0x32cdc0[_0x9b3f('0x10a')]){if(!this[_0x9b3f('0xa5')](_0x32cdc0[_0x9b3f('0x10a')])){return this['channel'][_0x9b3f('0x32')](_0x32cdc0,_0x9b3f('0x10b'));}else{var _0x33af50=parseInt(_0x32cdc0[_0x9b3f('0x10a')],0xa);if(isNaN(_0x33af50)){_0x3ed5e5=_0x32cdc0['trunk_id'];}else{_0x3ed5e5=this[_0x9b3f('0x1e')][_0x9b3f('0x6e')](this,_0x32cdc0[_0x9b3f('0x10a')]);if(!_0x3ed5e5){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x32cdc0,_0x9b3f('0x10c'));}}}}else if(_0x32cdc0[_0x9b3f('0x10d')]){_0x3ed5e5=_0x32cdc0[_0x9b3f('0x10d')];}else{return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x32cdc0,_0x9b3f('0x10b'));}var _0x424080=this['channel'][_0x9b3f('0x56')](_0x9b3f('0xe6'),[util[_0x9b3f('0x29')](_0x9b3f('0x10e'),_0x3ed5e5,_0x32cdc0[_0x9b3f('0x48')]),_0x32cdc0[_0x9b3f('0x64')],_0x32cdc0[_0x9b3f('0xe3')],_0x32cdc0['url']]);if(_0x424080[_0x9b3f('0xaa')]===-0x1){return _0x424080;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0x9b3f('0x10f')]=function(_0x15537e){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x110'),_0x15537e[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x10f'));};AGIVertices['prototype']['getdigits']=function(_0x311627){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x111'),_0x311627['label']));if(_0x311627[_0x9b3f('0xa7')]===0x0){return this[_0x9b3f('0xa6')](_0x311627);}_0x311627[_0x9b3f('0xa7')]-=0x1;if(!this['isConfigured'](_0x311627[_0x9b3f('0x112')])){return this['channel']['error'](_0x311627,_0x9b3f('0x113'));}var _0x1ee772=this[_0x9b3f('0x1f')][_0x9b3f('0x6e')](this,_0x311627[_0x9b3f('0x112')]);if(!_0x1ee772){return this['channel']['error'](_0x311627,'no\x20file\x20audio\x20found');}if(!this[_0x9b3f('0xa5')](_0x311627['variable_id'])){return this[_0x9b3f('0xe')]['error'](_0x9b3f('0x114'));}var _0x32b727=this[_0x9b3f('0xe')]['getData'](_0x1ee772,_0x311627[_0x9b3f('0x115')],_0x311627[_0x9b3f('0x116')]);var _0x18772b=_0x32b727['result']?_0x32b727[_0x9b3f('0xaa')][_0x9b3f('0xa4')]():'';logger['info'](_0x9b3f('0x117'),JSON[_0x9b3f('0x70')](_0x32b727));if(_0x32b727[_0x9b3f('0xaa')]===-0x1){this[_0x9b3f('0x37')]['sync'](this,_0x311627,_0x18772b);return _0x32b727;}else if(_0x32b727[_0x9b3f('0xa3')]===_0x9b3f('0x64')){_0x32b727[_0x9b3f('0xaa')]=_0x18772b[_0x9b3f('0x9e')]>=parseInt(_0x311627['mindigit'])?'x':'i';}else{_0x32b727['result']=_0x18772b[_0x9b3f('0x9e')]>=parseInt(_0x311627[_0x9b3f('0x118')])&&_0x18772b[_0x9b3f('0x9e')]<=parseInt(_0x311627[_0x9b3f('0x116')])?'x':'i';}var _0x458194=this['getVariable'][_0x9b3f('0x6e')](this,_0x311627[_0x9b3f('0xd8')]);if(!_0x458194){return this['channel'][_0x9b3f('0x32')](_0x311627,_0x9b3f('0xd9'));}this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x458194,_0x18772b);if(this[_0x9b3f('0xa5')](_0x311627['hiddendigitsnum'])){var _0x5c4dc6=parseInt(_0x311627[_0x9b3f('0x119')],0xa);var _0x31a33c=rs['generate']({'charset':'*','length':_0x5c4dc6});var _0x3afabc=_0x18772b[_0x9b3f('0x9e')];if(_0x3afabc>0x0){if(_0x3afabc>_0x5c4dc6){this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x311627,_0x311627[_0x9b3f('0x11a')]===_0x9b3f('0x11b')?_0x31a33c+_0x18772b['substr'](_0x5c4dc6):_0x18772b[_0x9b3f('0x11c')](0x0,_0x3afabc-_0x5c4dc6)+_0x31a33c);}else{this['createSquareDetailsReport']['sync'](this,_0x311627,rs['generate']({'charset':'*','length':_0x3afabc}));}}else{this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x311627,'');}}else{this[_0x9b3f('0x37')]['sync'](this,_0x311627,_0x18772b);}return _0x32b727;};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x11d')]=function(_0x4dd2dc){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x11e'),_0x4dd2dc[_0x9b3f('0x39')]));return this['getdigits'](_0x4dd2dc);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x11f')]=function(_0x1a8076){logger['info'](util['format'](_0x9b3f('0x120'),_0x1a8076['label']));this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x1a8076,_0x1a8076[_0x9b3f('0x121')]);return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('GOAL\x20%s',_0x1a8076[_0x9b3f('0x121')]));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x122')]=function(_0x3a1fd1){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x123'),_0x3a1fd1['label']));if(!this['isConfigured'](_0x3a1fd1[_0x9b3f('0x86')])||!this['isConfigured'](_0x3a1fd1['aws_secret_access_key'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x3a1fd1['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x124'),_0x3a1fd1[_0x9b3f('0x5b')]));var _0x130fca=this[_0x9b3f('0x85')][_0x9b3f('0x6e')](this,_0x3a1fd1);if(_0x130fca){this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x125'),_0x130fca));var _0x4d20cb=this[_0x9b3f('0xe')]['streamFile'](_0x130fca);try{fs[_0x9b3f('0x103')](_0x130fca+'.wav');}catch(_0x7bb515){logger[_0x9b3f('0x32')](_0x7bb515);}return _0x4d20cb;}return this['channel'][_0x9b3f('0x32')](_0x3a1fd1,_0x9b3f('0x126'));};AGIVertices['prototype']['awslex']=function(_0x10daa1){logger['info'](util[_0x9b3f('0x29')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x10daa1['label']));if(!this[_0x9b3f('0xa5')](_0x10daa1[_0x9b3f('0x86')])||!this[_0x9b3f('0xa5')](_0x10daa1[_0x9b3f('0x87')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x127'));}if(!this[_0x9b3f('0xa5')](_0x10daa1['aws_bot_name'])){return this[_0x9b3f('0xe')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x9b3f('0xa5')](_0x10daa1[_0x9b3f('0x5b')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this['channel'][_0x9b3f('0xea')]=!![];this[_0x9b3f('0x37')](_0x10daa1);this['createSquareMessage'](_0x10daa1[_0x9b3f('0x5b')],'in','','');this[_0x9b3f('0xe')]['noop'](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x10daa1[_0x9b3f('0x5b')]));var _0x1ec1a3=this[_0x9b3f('0x8b')][_0x9b3f('0x6e')](this,_0x10daa1);if(_0x1ec1a3){for(var _0xbd270e in _0x1ec1a3){if(_0x1ec1a3[_0x9b3f('0x97')](_0xbd270e)&&_[_0x9b3f('0x98')](_0x1ec1a3[_0xbd270e])){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0x128'),_0xbd270e['toUpperCase']()),_0x1ec1a3[_0xbd270e]);}}if(_['isNil'](_0x1ec1a3[_0x9b3f('0x129')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x12a'));}else{this[_0x9b3f('0x41')](_0x1ec1a3[_0x9b3f('0x129')],'out',_0x9b3f('0x12b'),'');return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x1ec1a3[_0x9b3f('0x129')]));}}return this[_0x9b3f('0xe')]['error'](_0x10daa1,_0x9b3f('0x12c'));};AGIVertices[_0x9b3f('0x11')]['googleasr']=function(_0x2abb80){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x12d'),_0x2abb80[_0x9b3f('0x39')],_0x2abb80[_0x9b3f('0x64')]));if(!this[_0x9b3f('0xa5')](_0x2abb80[_0x9b3f('0x78')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20key\x20configured');}var _0x453bd7=_0x9b3f('0x12e');var _0x565042=util[_0x9b3f('0x29')](_0x9b3f('0x12f'),FILES_PATH,rs['generate'](0x4));var _0x1b236e=util['format'](_0x9b3f('0xa0'),_0x565042,_0x453bd7);var _0x135f62=!![];if(_0x2abb80[_0x9b3f('0x130')]===_0x9b3f('0x131')){_0x135f62=![];}var _0x37563d=this['channel'][_0x9b3f('0x132')](_0x565042,_0x453bd7,_0x2abb80['intKey'],_0x2abb80['timeout'],undefined,_0x135f62);if(_0x37563d[_0x9b3f('0xaa')]!==-0x1){this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x133'),_0x1b236e));var _0x1d7806=this[_0x9b3f('0x8e')][_0x9b3f('0x6e')](this,_0x2abb80,_0x1b236e);if(_0x1d7806){for(var _0xb02244 in _0x1d7806){if(_0x1d7806[_0x9b3f('0x97')](_0xb02244)){this['channel'][_0x9b3f('0xa1')](util['format'](_0x9b3f('0x134'),_0xb02244[_0x9b3f('0x68')]()),_0x1d7806[_0xb02244]);}}return this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x135'),JSON['stringify'](_0x1d7806)));}}return _0x37563d;};AGIVertices[_0x9b3f('0x11')]['tildeasr']=function(_0x3f1b6b){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x136'),_0x3f1b6b['label']));if(!this[_0x9b3f('0xa5')](_0x3f1b6b[_0x9b3f('0x91')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x3f1b6b['appsecret'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20appsecret\x20configured');}var _0x4a7450='wav';var _0x47ad5f=util[_0x9b3f('0x29')](_0x9b3f('0x12f'),FILES_PATH,rs[_0x9b3f('0x137')](0x4));var _0x3df2be=util['format'](_0x9b3f('0xa0'),_0x47ad5f,_0x4a7450);var _0x271ad8=!![];if(_0x3f1b6b[_0x9b3f('0x130')]===_0x9b3f('0x131')){_0x271ad8=![];}var _0x19bfc9=this[_0x9b3f('0xe')][_0x9b3f('0x132')](_0x47ad5f,_0x4a7450,_0x3f1b6b[_0x9b3f('0x138')],_0x3f1b6b[_0x9b3f('0x64')],undefined,_0x271ad8);if(_0x19bfc9[_0x9b3f('0xaa')]!==-0x1){this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x139'),_0x3df2be));var _0x1948cb=this[_0x9b3f('0x90')]['sync'](this,_0x3f1b6b,_0x3df2be);if(_0x1948cb){for(var _0x46e872 in _0x1948cb){if(_0x1948cb[_0x9b3f('0x97')](_0x46e872)){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0x13a'),_0x46e872['toUpperCase']()),_0x1948cb[_0x46e872]);}}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x13b'),JSON[_0x9b3f('0x70')](_0x1948cb)));}}return _0x19bfc9;};AGIVertices[_0x9b3f('0x11')]['gotoc']=function(_0x3ffe9e){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3ffe9e[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')]['continueAt'](_0x3ffe9e[_0x9b3f('0x13c')],_0x3ffe9e[_0x9b3f('0x13d')],_0x3ffe9e['priority']);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x13e')]=function(_0x86726b){logger[_0x9b3f('0x2d')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x86726b['label']));if(!this['isConfigured'](_0x86726b['condition'])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x86726b,_0x9b3f('0x13f'));}try{var _0x436de0=eval(_0x86726b[_0x9b3f('0x140')])?_0x9b3f('0x141'):_0x9b3f('0x142');this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x143'),_0x86726b['condition'],_0x436de0));return{'code':0xc8,'result':_0x436de0};}catch(_0x4233ca){return{'code':0xc8,'result':_0x9b3f('0x142')};}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x144')]=function(_0x276f5d){logger['info'](util[_0x9b3f('0x29')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x276f5d['label']));if(!this[_0x9b3f('0xa5')](_0x276f5d[_0x9b3f('0x145')])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x276f5d,'no\x20interval\x20configured');}var _0x53616a=this['getIntervals'][_0x9b3f('0x6e')](this,_0x276f5d[_0x9b3f('0x145')]);if(!_0x53616a){return this['channel'][_0x9b3f('0x32')](_0x276f5d,'no\x20intervals\x20found');}for(var _0x2415ae=0x0;_0x2415ae<_0x53616a[_0x9b3f('0x9e')];_0x2415ae+=0x1){var _0x72407c=this[_0x9b3f('0xe')][_0x9b3f('0x12')](util[_0x9b3f('0x29')](_0x9b3f('0x146'),_0x53616a[_0x2415ae]));if(_0x72407c[_0x9b3f('0xaa')]===-0x1){return _0x72407c;}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x147'),_0x53616a[_0x2415ae],_0x72407c['extra']));if(_0x72407c[_0x9b3f('0xa3')]===_0x9b3f('0x141')){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('IFTIME\x20%s\x20%s',_0x53616a[_0x2415ae],'true'));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x147'),_0x53616a[_0x2415ae],_0x9b3f('0x141')));return{'code':0xc8,'result':_0x9b3f('0x141')};}else{logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('IFTIME\x20%s\x20%s',_0x53616a[_0x2415ae],_0x9b3f('0x142')));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x147'),_0x53616a[_0x2415ae],_0x9b3f('0x142')));}}return{'code':0xc8,'result':_0x9b3f('0x142')};};AGIVertices['prototype'][_0x9b3f('0x148')]=function(_0x36d767){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x36d767[_0x9b3f('0x39')]));return this['channel'][_0x9b3f('0x148')]();};AGIVertices['prototype'][_0x9b3f('0x149')]=function(_0x39151a){logger['info'](util[_0x9b3f('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x39151a[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x39151a[_0x9b3f('0x78')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xe9'));}var _0x29cae0=_0x9b3f('0x12e');var _0x10bce2=util[_0x9b3f('0x29')](_0x9b3f('0x12f'),FILES_PATH,rs[_0x9b3f('0x137')](0x4));var _0x51f475=util['format'](_0x9b3f('0xa0'),_0x10bce2,_0x29cae0);var _0x2b455f=!![];if(_0x39151a['beep']==='NOBEEP'){_0x2b455f=![];}var _0x4a97fb=this[_0x9b3f('0xe')][_0x9b3f('0x132')](_0x10bce2,_0x29cae0,_0x39151a[_0x9b3f('0x138')],_0x39151a[_0x9b3f('0x64')],undefined,_0x2b455f);if(_0x4a97fb['result']!==-0x1){this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('ispeech\x20%s\x20file\x20created',_0x51f475));var _0x4d0fae=this[_0x9b3f('0x82')]['sync'](this,_0x39151a,_0x51f475);if(_0x4d0fae){for(var _0x14716b in _0x4d0fae){if(_0x4d0fae[_0x9b3f('0x97')](_0x14716b)){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0x14a'),_0x14716b[_0x9b3f('0x68')]()),_0x4d0fae[_0x14716b]);}}return this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x14b'),JSON[_0x9b3f('0x70')](_0x4d0fae)));}}return _0x4a97fb;};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x14c')]=function(_0x23f80f){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x14d'),_0x23f80f[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x23f80f[_0x9b3f('0x78')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20key\x20configured');}if(!this[_0x9b3f('0xa5')](_0x23f80f[_0x9b3f('0x5b')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x14e'),_0x23f80f['text']));var _0x12eda7=this[_0x9b3f('0x7f')][_0x9b3f('0x6e')](this,_0x23f80f);if(_0x12eda7){this[_0x9b3f('0xe')]['noop'](util['format'](_0x9b3f('0x14f'),_0x12eda7));var _0x4d9f59=this[_0x9b3f('0xe')][_0x9b3f('0x102')](_0x12eda7,_0x23f80f['intKey']);try{fs[_0x9b3f('0x103')](_0x12eda7+'.wav');}catch(_0x1f26a6){logger[_0x9b3f('0x32')](_0x1f26a6);}return _0x4d9f59;}return this['channel'][_0x9b3f('0x32')](_0x23f80f,_0x9b3f('0x150'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x151')]=function(_0x10b547){logger['info'](util['format'](_0x9b3f('0x152'),_0x10b547[_0x9b3f('0x39')]));if(!this['isConfigured'](_0x10b547[_0x9b3f('0x153')])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x10b547,_0x9b3f('0x154'));}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x10b547['findBy']));var _0x5bde7b=this['agentLogin'][_0x9b3f('0x6e')](this,_0x10b547[_0x9b3f('0x153')]);if(_0x5bde7b){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x10b547[_0x9b3f('0x153')]));this['channel']['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x10b547[_0x9b3f('0x153')]));return{'code':0xc8,'result':_0x9b3f('0x156')};}else{logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x157'),this['channel'][_0x9b3f('0x3b')],_0x10b547[_0x9b3f('0x153')]));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x10b547['findBy']));return{'code':0xc8,'result':_0x9b3f('0x158')};}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x159')]=function(_0x1ec9f1){logger['info'](util['format'](_0x9b3f('0x15a'),_0x1ec9f1['label']));if(!this[_0x9b3f('0xa5')](_0x1ec9f1[_0x9b3f('0x153')])){return this[_0x9b3f('0xe')]['error'](_0x1ec9f1,_0x9b3f('0x154'));}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x15b'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x1ec9f1[_0x9b3f('0x153')]));var _0x40d048=this['agentLogout']['sync'](this,_0x1ec9f1[_0x9b3f('0x153')]);if(_0x40d048){logger['info'](util[_0x9b3f('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1ec9f1[_0x9b3f('0x153')]));this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this['channel'][_0x9b3f('0x3b')],_0x1ec9f1[_0x9b3f('0x153')]));return{'code':0xc8,'result':_0x9b3f('0x156')};}else{logger['info'](util['format'](_0x9b3f('0x157'),this[_0x9b3f('0xe')]['callerid'],_0x1ec9f1[_0x9b3f('0x153')]));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x157'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x1ec9f1[_0x9b3f('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x15c')]=function(_0x479faf){logger['info'](util['format'](_0x9b3f('0x15d'),_0x479faf[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x479faf['operation'])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x479faf,'no\x20operation\x20configured');}this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x15e'),_0x479faf[_0x9b3f('0x15f')]));var _0x31f4b7=eval(_0x479faf[_0x9b3f('0x15f')]);if(!this[_0x9b3f('0xa5')](_0x479faf[_0x9b3f('0xd8')])){return this['channel'][_0x9b3f('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x58be43=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x479faf[_0x9b3f('0xd8')]);if(!_0x58be43){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x479faf,_0x9b3f('0xd9'));}if(_[_0x9b3f('0x9d')](_0x31f4b7)){var _0x255043=this;_0x31f4b7[_0x9b3f('0xda')](function(_0x144eff,_0x50a5d1){_0x255043[_0x9b3f('0xe')]['setVariable'](util[_0x9b3f('0x29')](_0x9b3f('0x160'),_0x58be43,_0x50a5d1),_0x144eff);});return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('variable\x20%s[key]\x20set',_0x58be43));}else{return this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x58be43,_0x31f4b7);}};AGIVertices[_0x9b3f('0x11')]['menu']=function(_0x252adb){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x161'),_0x252adb[_0x9b3f('0x39')]));if(_0x252adb[_0x9b3f('0xa7')]===0x0){return this['maxRetry'](_0x252adb);}_0x252adb[_0x9b3f('0xa7')]-=0x1;if(!this['isConfigured'](_0x252adb[_0x9b3f('0x112')])){return this['channel']['error'](_0x252adb,_0x9b3f('0x113'));}var _0x249527=this[_0x9b3f('0x1f')][_0x9b3f('0x6e')](this,_0x252adb[_0x9b3f('0x112')]);if(!_0x249527){return this[_0x9b3f('0xe')]['error'](_0x252adb,'no\x20file\x20audio\x20found');}var _0x296393=this[_0x9b3f('0xe')][_0x9b3f('0x162')](_0x249527,_0x252adb['response'],_0x252adb[_0x9b3f('0x163')]);var _0x4980cb=_0x296393[_0x9b3f('0xaa')];if(_0x296393[_0x9b3f('0xaa')]===-0x1){this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x252adb,'-1');return _0x296393;}else if(_0x296393[_0x9b3f('0xa3')]==='timeout'){_0x296393['result']=_0x296393[_0x9b3f('0xaa')]['length']>0x0?_0x296393['result']:'t';}else if(_[_0x9b3f('0x43')](_0x296393[_0x9b3f('0xaa')])){_0x296393[_0x9b3f('0xaa')]='#';_0x4980cb='#';}if(!this[_0x9b3f('0xa5')](_0x252adb[_0x9b3f('0xd8')])){this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x272033=this[_0x9b3f('0x12')]['sync'](this,_0x252adb['variable_id']);if(!_0x272033){return this['channel']['error'](_0x252adb,'no\x20variable\x20found');}this['channel'][_0x9b3f('0xa1')](_0x272033,_0x4980cb);}this['createSquareDetailsReport'][_0x9b3f('0x6e')](this,_0x252adb,_0x4980cb);return _0x296393;};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xab')]=function(_0x36601b){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x164'),_0x36601b[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x36601b[_0x9b3f('0x165')]||_0x36601b['label']);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x166')]=function(_0x594cce){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x167'),_0x594cce[_0x9b3f('0x39')]));if(!this['isConfigured'](_0x594cce[_0x9b3f('0x153')])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x594cce,_0x9b3f('0x154'));}logger['info'](util[_0x9b3f('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9b3f('0x3b')],_0x594cce[_0x9b3f('0x153')]));var _0x306d64=this[_0x9b3f('0x4c')][_0x9b3f('0x6e')](this,_0x594cce[_0x9b3f('0x168')]);var _0x186721=this[_0x9b3f('0x4e')][_0x9b3f('0x6e')](this,_0x594cce[_0x9b3f('0x153')],_0x306d64);if(_0x186721){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x594cce['findBy']));this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x594cce[_0x9b3f('0x153')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x9b3f('0x157'),this['channel']['callerid'],_0x594cce['findBy']));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x594cce['findBy']));return{'code':0xc8,'result':_0x9b3f('0x158')};}};AGIVertices['prototype'][_0x9b3f('0x169')]=function(_0x40fe9f){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x40fe9f[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x40fe9f[_0x9b3f('0x112')])){return this[_0x9b3f('0xe')]['error'](_0x40fe9f,_0x9b3f('0x113'));}var _0x33dfc9=this[_0x9b3f('0x1f')]['sync'](this,_0x40fe9f[_0x9b3f('0x112')]);if(!_0x33dfc9){return this[_0x9b3f('0xe')]['error'](_0x40fe9f,_0x9b3f('0x16a'));}var _0x5677b0=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0x16b'),[_0x33dfc9,_0x40fe9f[_0x9b3f('0xe3')]]);if(_0x5677b0['result']===-0x1){return _0x5677b0;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format']('Executed\x20command\x20%s\x20%s',_0x9b3f('0x16b'),_0x33dfc9));};AGIVertices['prototype']['queue']=function(_0x4c1857){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x16c'),_0x4c1857[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x4c1857[_0x9b3f('0x16d')])){return this[_0x9b3f('0xe')]['error'](_0x4c1857,_0x9b3f('0x16e'));}var _0x1dd2c9='';var _0x57d72e=parseInt(_0x4c1857['queue_id'],0xa);if(isNaN(_0x57d72e)){_0x1dd2c9=_0x4c1857['queue_id'];}else{_0x1dd2c9=this[_0x9b3f('0x17')][_0x9b3f('0x6e')](this,_0x4c1857[_0x9b3f('0x16d')]);if(!_0x1dd2c9){return this[_0x9b3f('0xe')]['error'](_0x4c1857,_0x9b3f('0x16f'));}}var _0x476152='';if(this[_0x9b3f('0xa5')](_0x4c1857['file_id'])){var _0x1138b3=this[_0x9b3f('0x1f')][_0x9b3f('0x6e')](this,_0x4c1857['file_id']);if(_0x1138b3){_0x476152=_0x1138b3;}}this[_0x9b3f('0x37')]['sync'](this,_0x4c1857,_0x1dd2c9);if(_0x4c1857['opts'][_0x9b3f('0x170')]('x')<0x0){_0x4c1857[_0x9b3f('0xe3')]+='x';}if(_0x4c1857[_0x9b3f('0xe3')]['indexOf']('X')<0x0){_0x4c1857[_0x9b3f('0xe3')]+='X';}this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x9b3f('0x171'),_0x1dd2c9?_0x1dd2c9[_0x9b3f('0x172')]():'');var _0x1dce13=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0x173'),[_0x1dd2c9,_0x4c1857[_0x9b3f('0xe3')],_0x4c1857[_0x9b3f('0xe4')],_0x476152,_0x4c1857[_0x9b3f('0x64')],_0x4c1857[_0x9b3f('0xb8')],_0x4c1857[_0x9b3f('0x174')],_0x4c1857['gosub'],'',_0x4c1857[_0x9b3f('0x175')]]);if(_0x1dce13[_0x9b3f('0xaa')]===-0x1){return _0x1dce13;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x176'),'QUEUE',_0x1dd2c9));};AGIVertices['prototype'][_0x9b3f('0x177')]=function(_0x39bbdf){logger['info'](util['format'](_0x9b3f('0x178'),_0x39bbdf[_0x9b3f('0x39')]));var _0x38b5cc=_0x39bbdf['recordingFormat']||_0x9b3f('0x12e');var _0x275e4d=util[_0x9b3f('0x29')](_0x9b3f('0x179'),this['channel'][_0x9b3f('0x38')],rs[_0x9b3f('0x137')](0x5));var _0x39b7f0=util[_0x9b3f('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x275e4d,_0x38b5cc);var _0x43a3c0=util[_0x9b3f('0x29')](_0x9b3f('0x12f'),FILES_PATH,_0x275e4d);this[_0x9b3f('0x3c')]['sync'](this,_0x39bbdf,_0x275e4d,_0x39b7f0);this[_0x9b3f('0xe')][_0x9b3f('0xa1')]('RECORDING_SAVENAME',_0x275e4d);logger[_0x9b3f('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x43a3c0,_0x38b5cc,_0x39bbdf[_0x9b3f('0x17a')],_0x39bbdf[_0x9b3f('0x64')]);return this[_0x9b3f('0xe')][_0x9b3f('0x132')](_0x43a3c0,_0x38b5cc,_0x39bbdf[_0x9b3f('0x17a')],_0x39bbdf[_0x9b3f('0x64')],undefined,!![]);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x17b')]=function(_0x220b19){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x17c'),_0x220b19['label']));if(!this[_0x9b3f('0xa5')](_0x220b19[_0x9b3f('0xe4')])){return this[_0x9b3f('0xe')]['noop'](_0x9b3f('0x17d'));}var _0xce9a63=this['restAPI'][_0x9b3f('0x6e')](this,_0x220b19);logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x17e'),util[_0x9b3f('0x17f')](_0xce9a63,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x220b19['variable_id'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x180'));}var _0x3b8db5=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x220b19[_0x9b3f('0xd8')]);if(!_0x3b8db5){return this[_0x9b3f('0xe')]['error'](_0x220b19,_0x9b3f('0xd9'));}this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util['format']('%s_STATUS_CODE',_0x3b8db5),_0xce9a63[_0x9b3f('0x73')]?_0xce9a63[_0x9b3f('0x73')]:_0x9b3f('0x181'));this[_0x9b3f('0xe')]['setVariable'](util[_0x9b3f('0x29')](_0x9b3f('0x182'),_0x3b8db5),_0xce9a63[_0x9b3f('0x74')]?_0xce9a63['statusMessage']:'OK');if(_0xce9a63[_0x9b3f('0x71')]){try{this[_0x9b3f('0x9f')](_0xce9a63[_0x9b3f('0x71')],_0x3b8db5);}catch(_0x165298){logger[_0x9b3f('0x32')](util[_0x9b3f('0x29')](_0x9b3f('0x183'),_0x3b8db5));}}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('variable\x20%s\x20set',_0x3b8db5));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x184')]=function(_0xa51bea){logger['info'](util[_0x9b3f('0x29')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xa51bea[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0x185')](_0xa51bea[_0x9b3f('0x186')][_0x9b3f('0xd5')](/\s+/g,''),_0xa51bea[_0x9b3f('0x17a')]);};AGIVertices['prototype'][_0x9b3f('0x187')]=function(_0x5875c7){logger['info'](util['format'](_0x9b3f('0x188'),_0x5875c7[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0x189')](_0x5875c7[_0x9b3f('0x65')]['replace'](/\s+/g,''),_0x5875c7['escape_digits']);};AGIVertices['prototype'][_0x9b3f('0x18a')]=function(_0x57363a){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x18b'),_0x57363a['label']));return this['channel'][_0x9b3f('0x18c')](_0x57363a[_0x9b3f('0x5b')],_0x57363a[_0x9b3f('0x17a')]);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x18d')]=function(_0x56f581){logger[_0x9b3f('0x2d')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x56f581[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x56f581[_0x9b3f('0x18e')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x18f'));}var _0x26474c=this['getMailAccount'][_0x9b3f('0x6e')](this,_0x56f581['account_id']);if(!_0x26474c||!_0x26474c[_0x9b3f('0x190')]){return this['channel'][_0x9b3f('0x32')](_0x56f581,_0x9b3f('0x191'));}var _0x4e83e8={'from':util[_0x9b3f('0x29')](_0x9b3f('0x192'),_0x26474c[_0x9b3f('0x15')],_0x26474c[_0x9b3f('0x193')]||_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x194')]),'to':_0x56f581['to']||'','cc':_0x56f581['cc']||'','bcc':_0x56f581[_0x9b3f('0x195')]||'','subject':_0x56f581['subject'],'html':_0x56f581[_0x9b3f('0x5b')],'text':_0x56f581[_0x9b3f('0x5b')]};var _0x7942a2={'tls':{'rejectUnauthorized':![]}};if(_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x196')]){_0x7942a2[_0x9b3f('0x196')]=_0x26474c[_0x9b3f('0x190')]['service'];}else{_0x7942a2[_0x9b3f('0x197')]=_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x197')];_0x7942a2[_0x9b3f('0x198')]=_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x198')];_0x7942a2['secure']=_0x26474c[_0x9b3f('0x190')]['secure'];}if(_0x26474c[_0x9b3f('0x190')]['authentication']){_0x7942a2[_0x9b3f('0x199')]={'user':_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x194')],'pass':_0x26474c['Smtp'][_0x9b3f('0x19a')]};}if(this['isConfigured'](_0x56f581['template_id'])){}logger[_0x9b3f('0xdf')](_0x9b3f('0x19b'),JSON[_0x9b3f('0x70')](_0x4e83e8));this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x56f581,_0x56f581['account_id']);this[_0x9b3f('0xe')]['noop'](util['format'](_0x9b3f('0x19c'),_0x26474c[_0x9b3f('0x15')]));this['sendMailMessage'][_0x9b3f('0x6e')](this,_0x7942a2,_0x4e83e8);return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x9b3f('0x19d')]=function(_0x552689){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x19e'),_0x552689[_0x9b3f('0x39')]));return this['channel'][_0x9b3f('0xab')](_0x9b3f('0x19f'));};AGIVertices['prototype'][_0x9b3f('0x1a0')]=function(_0x941be1){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0x1a1'),_0x941be1[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x941be1[_0x9b3f('0x1a2')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20sms\x20account\x20configured');}var _0x4c0d56=this['getSmsAccount'][_0x9b3f('0x6e')](this,_0x941be1[_0x9b3f('0x1a2')]);if(!_0x4c0d56){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x941be1,_0x9b3f('0x1a3'));}var _0x3057d6={'body':_0x941be1['sms_text'],'phone':_0x941be1['to']||'','SmsAccountId':_0x4c0d56['id']};logger[_0x9b3f('0xdf')](_0x9b3f('0x1a4'),JSON['stringify'](_0x3057d6));this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x941be1,_0x941be1['sms_account_id']);this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x1a5'),_0x4c0d56['name']));this[_0x9b3f('0x36')][_0x9b3f('0x6e')](this,_0x3057d6);return this[_0x9b3f('0xe')]['noop'](_0x9b3f('0x1a6'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1a7')]=function(_0x5507dc){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0x1a8'),_0x5507dc[_0x9b3f('0x39')]));if(!this['isConfigured'](_0x5507dc[_0x9b3f('0xd8')])){return this['channel'][_0x9b3f('0x32')](_0x5507dc,_0x9b3f('0x1a9'));}var _0x55bf2d=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x5507dc[_0x9b3f('0xd8')]);if(!_0x55bf2d){return this[_0x9b3f('0xe')]['error'](_0x5507dc,_0x9b3f('0xd9'));}return this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x55bf2d,_0x5507dc['variable_value']);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1aa')]=function(_0x2f9945){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1ab'),_0x2f9945[_0x9b3f('0x39')]));this['channel'][_0x9b3f('0xab')](_0x9b3f('0x1ac'));if(_0x2f9945[_0x9b3f('0xbb')]===_0x9b3f('0x1ad')){this[_0x9b3f('0xe')][_0x9b3f('0xab')]('Answer');return this[_0x9b3f('0xe')][_0x9b3f('0xbb')]();}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x1ae'));};AGIVertices[_0x9b3f('0x11')]['subproject']=function(_0x54853e){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x1af'),_0x54853e[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x54853e[_0x9b3f('0x1b0')])){return this[_0x9b3f('0xe')]['error'](_0x54853e,_0x9b3f('0x1b1'));}var _0xa297ca=this[_0x9b3f('0x19')][_0x9b3f('0x6e')](this,_0x54853e[_0x9b3f('0x1b0')]);if(!this[_0x9b3f('0xa5')](_0xa297ca)){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x54853e,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x54853e['project_id']));}if(_0xa297ca===this[_0x9b3f('0xe')][_0x9b3f('0x3a')]){return this['channel'][_0x9b3f('0x32')](_0x54853e,_0x9b3f('0x1b2'));}this[_0x9b3f('0x37')]['sync'](this,_0x54853e,_0xa297ca);var _0xc9bd51=this[_0x9b3f('0xe')]['exec'](_0x9b3f('0x1b3'),util[_0x9b3f('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x9b3f('0xb8')][_0x9b3f('0x197')]||_0x9b3f('0x1b4'),_0xa297ca,this['channel'][_0x9b3f('0x3a')]));if(_0xc9bd51[_0x9b3f('0xaa')]===-0x1){return _0xc9bd51;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x176'),'AGI',_0xa297ca));};AGIVertices['prototype'][_0x9b3f('0x1b5')]=function(_0x4f71d5){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1b6'),_0x4f71d5[_0x9b3f('0x39')]));var _0x5ce609=this[_0x9b3f('0x55')][_0x9b3f('0x6e')](this,_0x4f71d5['command']);this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x4f71d5,_0x4f71d5['command']);if(this['isConfigured'](_0x4f71d5[_0x9b3f('0xd8')])){var _0x57d237=this[_0x9b3f('0x12')]['sync'](this,_0x4f71d5[_0x9b3f('0xd8')]);if(_0x57d237){this['channel'][_0x9b3f('0xa1')](_0x57d237,_0x5ce609);return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4f71d5['command'],_0x57d237));}}return this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4f71d5[_0x9b3f('0xba')]));};AGIVertices['prototype'][_0x9b3f('0x1b7')]=function(_0x13ac86){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0x1b8'),_0x13ac86['label']));_0x13ac86['text']=_0x13ac86[_0x9b3f('0x5b')][_0x9b3f('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9b3f('0xa5')](_0x13ac86[_0x9b3f('0x59')])){return this['channel'][_0x9b3f('0xab')](_0x9b3f('0x1b9'));}if(!this[_0x9b3f('0xa5')](_0x13ac86['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')]['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x13ac86[_0x9b3f('0x5b')]));var _0x14209e=this['googleCloudTTS']['sync'](this,_0x13ac86);if(_0x14209e){this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x14209e));var _0x4879e7=this[_0x9b3f('0xe')][_0x9b3f('0x102')](_0x14209e);try{fs[_0x9b3f('0x103')](_0x14209e+_0x9b3f('0x1ba'));}catch(_0x3b43eb){logger['error'](_0x3b43eb);}return _0x4879e7;}return this['channel'][_0x9b3f('0x32')](_0x13ac86,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1bb')]=function(_0x59af1f){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0x1bc'),_0x59af1f[_0x9b3f('0x39')]));_0x59af1f[_0x9b3f('0x5b')]=_0x59af1f['text'][_0x9b3f('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9b3f('0xa5')](_0x59af1f['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20text\x20configured');}this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x1bd'),_0x59af1f[_0x9b3f('0x5b')]));var _0x771b1b=this[_0x9b3f('0x60')][_0x9b3f('0x6e')](this,_0x59af1f);if(_0x771b1b){this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x1be'),_0x771b1b));var _0x18907a=this[_0x9b3f('0xe')][_0x9b3f('0x102')](_0x771b1b);try{fs[_0x9b3f('0x103')](_0x771b1b+'.wav');}catch(_0x53e65d){logger[_0x9b3f('0x32')](_0x53e65d);}return _0x18907a;}return this[_0x9b3f('0xe')]['error'](_0x59af1f,_0x9b3f('0x1bf'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1c0')]=function(_0x1fb147){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1c1'),_0x1fb147['label']));if(!this[_0x9b3f('0xa5')](_0x1fb147[_0x9b3f('0x153')])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x1fb147,_0x9b3f('0x154'));}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x15b'),this[_0x9b3f('0xe')]['callerid'],_0x1fb147[_0x9b3f('0x153')]));var _0x50a5d5=this[_0x9b3f('0x1c2')][_0x9b3f('0x6e')](this,_0x1fb147[_0x9b3f('0x153')]);if(_0x50a5d5){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x1fb147[_0x9b3f('0x153')]));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')]['callerid'],_0x1fb147[_0x9b3f('0x153')]));return{'code':0xc8,'result':_0x9b3f('0x156')};}else{logger['info'](util[_0x9b3f('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9b3f('0xe')]['callerid'],_0x1fb147[_0x9b3f('0x153')]));this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x157'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x1fb147['findBy']));return{'code':0xc8,'result':_0x9b3f('0x158')};}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1c3')]=function(_0x2e4db9){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1c4'),_0x2e4db9['label']));var _0x1703d8=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0x1c5'),[_0x2e4db9['mailbox'],_0x2e4db9['options']]);if(_0x1703d8[_0x9b3f('0xaa')]===-0x1){return _0x1703d8;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x176'),_0x9b3f('0x1c5'),_0x2e4db9[_0x9b3f('0x1c6')]));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1c7')]=function(_0x4bd714){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1c8'),_0x4bd714[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x4bd714[_0x9b3f('0xd8')])){return this['channel'][_0x9b3f('0x32')](_0x4bd714,_0x9b3f('0x1a9'));}var _0x29c087=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x4bd714['variable_id']);if(!_0x29c087){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x4bd714,_0x9b3f('0xd9'));}var _0x49c3a7=this[_0x9b3f('0xe')]['getVariable'](_0x29c087);return{'code':0xc8,'result':_0x49c3a7[_0x9b3f('0xa3')]?_0x49c3a7['extra']:'-'};};String[_0x9b3f('0x11')][_0x9b3f('0xa2')]=function(_0x31c8ca,_0x47851a){return this[_0x9b3f('0x1c9')](_0x31c8ca)[_0x9b3f('0x1ca')](_0x47851a);};module[_0x9b3f('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3152fef..96a3be5 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 _0x6d0f=['origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','channels','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x3dc7c2,_0x59abef){var _0x34d166=function(_0x4e9978){while(--_0x4e9978){_0x3dc7c2['push'](_0x3dc7c2['shift']());}};_0x34d166(++_0x59abef);}(_0x6d0f,0x169));var _0xf6d0=function(_0x3fe225,_0x235b34){_0x3fe225=_0x3fe225-0x0;var _0x951873=_0x6d0f[_0x3fe225];return _0x951873;};'use strict';var util=require('util');var _=require(_0xf6d0('0x0'));var moment=require(_0xf6d0('0x1'));var ami=require(_0xf6d0('0x2'));var logger=require(_0xf6d0('0x3'))('acw');var RpcUser=require(_0xf6d0('0x4'));var RpcVoiceAgentReport=require(_0xf6d0('0x5'));function Acw(_0x3ab8b1){this[_0xf6d0('0x6')]=_0x3ab8b1['voiceQueues'];this[_0xf6d0('0x7')]=_0x3ab8b1[_0xf6d0('0x7')];this[_0xf6d0('0x8')]=_0x3ab8b1['timers'];this['channels']={};ami['on'](_0xf6d0('0x9'),this[_0xf6d0('0xa')][_0xf6d0('0xb')](this));ami['on'](_0xf6d0('0xc'),this[_0xf6d0('0xd')][_0xf6d0('0xb')](this));ami['on'](_0xf6d0('0xe'),this[_0xf6d0('0xf')][_0xf6d0('0xb')](this));ami['on'](_0xf6d0('0x10'),this[_0xf6d0('0x11')][_0xf6d0('0xb')](this));ami['on']('attendedtransfer',this[_0xf6d0('0x12')]['bind'](this));ami['on'](_0xf6d0('0x13'),this[_0xf6d0('0x14')][_0xf6d0('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0xf6d0('0x15')][_0xf6d0('0xb')](this));}function getDiff(_0x40ae14){var _0x39973b=moment()['milliseconds'](0x0);var _0x103f22=moment(_0x40ae14)[_0xf6d0('0x16')](0x0);return _0x39973b[_0xf6d0('0x17')](_0x103f22,'seconds');}Acw[_0xf6d0('0x18')][_0xf6d0('0x19')]=function(_0x447123){try{var _0x25fdda=this;var _0x5ed461=this[_0xf6d0('0x1a')][_0x447123][_0xf6d0('0x1b')];var _0x4ade57=this['channels'][_0x447123]['queue'];var _0x3927c1=this['voiceQueues'][_0x4ade57];var _0xc00a95=![];var _0x2429ce=_0xf6d0('0x1c');if(_0x3927c1[_0xf6d0('0x1d')]){if(_0x3927c1[_0xf6d0('0x1e')][_0xf6d0('0x1f')]){_0xc00a95=!![];_0x2429ce=_0x3927c1[_0xf6d0('0x1e')]['name'];}}ami[_0xf6d0('0x20')]({'action':'QueuePause','interface':_0x5ed461,'paused':!![],'reason':_0x2429ce})[_0xf6d0('0x21')](function(_0x2154a5){if(_0x25fdda['agents'][_0x5ed461]){return RpcUser[_0xf6d0('0x22')](_0x25fdda[_0xf6d0('0x7')][_0x5ed461]['id'])['then'](function(_0x131d12){if(_0x131d12&&!_0x131d12[_0xf6d0('0x23')]){logger[_0xf6d0('0x24')](_0xf6d0('0x25'),_0x447123,_0x5ed461,_0x4ade57);var _0x2f41fe=_0x25fdda[_0xf6d0('0x1a')][_0x447123][_0xf6d0('0x26')]&&_0x25fdda[_0xf6d0('0x1a')][_0x447123][_0xf6d0('0x27')]?_0x25fdda[_0xf6d0('0x1a')][_0x447123][_0xf6d0('0x27')]:_0x447123;return RpcUser[_0xf6d0('0x28')](_0x25fdda[_0xf6d0('0x7')][_0x5ed461],_0x2429ce,_0x2f41fe)[_0xf6d0('0x21')](function(_0xcc09f6){if(!_0xc00a95){_0x25fdda[_0xf6d0('0x8')][_0x5ed461]={};logger[_0xf6d0('0x24')](_0xf6d0('0x29'),_0x447123,_0x25fdda['voiceQueues'][_0x4ade57][_0xf6d0('0x2a')],_0x5ed461,_0x4ade57);_0x25fdda[_0xf6d0('0x8')][_0x5ed461][_0xf6d0('0x2b')]=setTimeout(_0x25fdda[_0xf6d0('0x2c')][_0xf6d0('0xb')](_0x25fdda,_0x5ed461),_0x25fdda[_0xf6d0('0x6')][_0x4ade57][_0xf6d0('0x2a')]*0x3e8);_0x25fdda[_0xf6d0('0x8')][_0x5ed461][_0xf6d0('0x2d')]=moment()[_0xf6d0('0x2e')](_0xf6d0('0x2f'));_0x25fdda[_0xf6d0('0x8')][_0x5ed461][_0xf6d0('0x30')]=_0x447123;_0x25fdda[_0xf6d0('0x8')][_0x5ed461][_0xf6d0('0x31')]=_0x4ade57;_0x25fdda['timers'][_0x5ed461][_0xf6d0('0x32')]=function(){var _0x5316ba=getDiff(_0x25fdda[_0xf6d0('0x8')][_0x5ed461][_0xf6d0('0x2d')]);clearTimeout(_0x25fdda[_0xf6d0('0x8')][_0x5ed461][_0xf6d0('0x2b')]);_0x25fdda[_0xf6d0('0x8')][_0x5ed461][_0xf6d0('0x2b')]=![];RpcVoiceAgentReport[_0xf6d0('0x33')]({'acwtime':_0x5316ba},_0x25fdda[_0xf6d0('0x8')][_0x5ed461][_0xf6d0('0x30')],_0x5ed461)[_0xf6d0('0x21')](function(_0x53ee05){logger['info'](_0xf6d0('0x34'),_0x447123,_0x5316ba,_0x53ee05);})[_0xf6d0('0x35')](function(_0x33125d){logger['error'](_0xf6d0('0x36'),_0x447123,_0x33125d);});delete _0x25fdda[_0xf6d0('0x8')][_0x5ed461];};}});}else{logger[_0xf6d0('0x24')](_0xf6d0('0x37'),_0x447123,_0x5ed461,_0x4ade57);}});}})['catch'](function(_0x3f0d7f){logger[_0xf6d0('0x38')](_0xf6d0('0x29'),_0x447123,_0x25fdda[_0xf6d0('0x6')][_0x4ade57][_0xf6d0('0x2a')],_0x5ed461,_0x4ade57);})['finally'](function(){delete _0x25fdda['channels'][_0x447123];});}catch(_0x4c2d5e){logger[_0xf6d0('0x38')]('[ACW][START]\x20%s',_0x4c2d5e[_0xf6d0('0x39')]);}};Acw[_0xf6d0('0x18')][_0xf6d0('0x2c')]=function(_0x13da72){try{var _0x58036f=this;if(_0x58036f[_0xf6d0('0x8')][_0x13da72]){_0x58036f[_0xf6d0('0x8')][_0x13da72][_0xf6d0('0x2b')]=![];var _0x53dfe6=_0x58036f['timers'][_0x13da72][_0xf6d0('0x30')];var _0x21daa1=_0x58036f[_0xf6d0('0x8')][_0x13da72][_0xf6d0('0x31')];var _0x35e969=_0x58036f[_0xf6d0('0x6')][_0x21daa1][_0xf6d0('0x2a')];logger[_0xf6d0('0x24')](_0xf6d0('0x3a'),_0x53dfe6,_0x13da72);RpcUser[_0xf6d0('0x3b')](this[_0xf6d0('0x7')][_0x13da72]);RpcVoiceAgentReport[_0xf6d0('0x33')]({'acwtime':_0x35e969,'agentacw':!![]},_0x53dfe6,_0x13da72)[_0xf6d0('0x21')](function(_0x4def91){logger[_0xf6d0('0x24')](_0xf6d0('0x34'),_0x53dfe6,_0x35e969,_0x4def91);})['catch'](function(_0x3b84cf){logger[_0xf6d0('0x38')](_0xf6d0('0x36'),_0x53dfe6,_0x3b84cf);});}else{logger[_0xf6d0('0x38')](_0xf6d0('0x3c'),_0x13da72);if(_0x58036f[_0xf6d0('0x8')]){logger[_0xf6d0('0x24')](_0xf6d0('0x3d'),JSON[_0xf6d0('0x3e')](_0x58036f[_0xf6d0('0x8')]));}}}catch(_0x777a87){logger[_0xf6d0('0x38')]('[ACW][STOP]\x20%s',_0x777a87[_0xf6d0('0x39')]);}};Acw[_0xf6d0('0x18')][_0xf6d0('0xa')]=function(_0x4da77e){try{if(this[_0xf6d0('0x6')][_0x4da77e['queue']]&&(this['voiceQueues'][_0x4da77e[_0xf6d0('0x31')]]['acw']||this['voiceQueues'][_0x4da77e[_0xf6d0('0x31')]][_0xf6d0('0x1d')])){if(this[_0xf6d0('0x7')][_0x4da77e[_0xf6d0('0x1b')]]){this[_0xf6d0('0x1a')][_0x4da77e[_0xf6d0('0x30')]]={'queue':_0x4da77e['queue'],'interface':_0x4da77e[_0xf6d0('0x1b')],'destlinkedid':_0x4da77e[_0xf6d0('0x27')]};}}}catch(_0x70f896){logger[_0xf6d0('0x38')]('[ACW][syncAgentConnect]\x20%s',_0x70f896[_0xf6d0('0x39')]);}};Acw[_0xf6d0('0x18')]['syncAgentConnectPreview']=function(_0x434f3e){try{if(this[_0xf6d0('0x6')][_0x434f3e['queue']]&&(this[_0xf6d0('0x6')][_0x434f3e[_0xf6d0('0x31')]][_0xf6d0('0x3f')]||this[_0xf6d0('0x6')][_0x434f3e[_0xf6d0('0x31')]]['mandatoryDisposition'])){if(this[_0xf6d0('0x7')][_0x434f3e['interface']]){this[_0xf6d0('0x1a')][_0x434f3e[_0xf6d0('0x30')]]={'queue':_0x434f3e[_0xf6d0('0x31')],'interface':_0x434f3e[_0xf6d0('0x1b')]};}}}catch(_0x2b393d){logger['error'](_0xf6d0('0x40'),_0x2b393d['message']);}};Acw[_0xf6d0('0x18')]['syncHangupRequest']=function(_0x38dcc7){try{if(this[_0xf6d0('0x1a')][_0x38dcc7[_0xf6d0('0x30')]]&&_[_0xf6d0('0x41')](this[_0xf6d0('0x1a')][_0x38dcc7[_0xf6d0('0x30')]][_0xf6d0('0x26')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x38dcc7[_0xf6d0('0x30')]);this['startAcw'](_0x38dcc7['uniqueid']);}else if(this['channels'][_0x38dcc7[_0xf6d0('0x42')]]&&_['isUndefined'](this['channels'][_0x38dcc7[_0xf6d0('0x42')]][_0xf6d0('0x26')])){logger[_0xf6d0('0x24')](_0xf6d0('0x43'),_0x38dcc7[_0xf6d0('0x42')]);this['startAcw'](_0x38dcc7[_0xf6d0('0x42')]);}}catch(_0x1b11d0){logger[_0xf6d0('0x38')](_0xf6d0('0x44'),_0x1b11d0['message']);}};Acw[_0xf6d0('0x18')][_0xf6d0('0xf')]=function(_0xf48027){try{if(this[_0xf6d0('0x1a')][_0xf48027['uniqueid']]&&this[_0xf6d0('0x1a')][_0xf48027['uniqueid']][_0xf6d0('0x26')]){logger[_0xf6d0('0x24')](_0xf6d0('0x45'),_0xf48027[_0xf6d0('0x30')]);this[_0xf6d0('0x19')](_0xf48027['uniqueid']);}else if(this[_0xf6d0('0x1a')][_0xf48027[_0xf6d0('0x42')]]&&this[_0xf6d0('0x1a')][_0xf48027['linkedid']][_0xf6d0('0x26')]){logger[_0xf6d0('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xf48027[_0xf6d0('0x42')]);this[_0xf6d0('0x19')](_0xf48027[_0xf6d0('0x42')]);}}catch(_0x52a2ed){logger[_0xf6d0('0x38')]('[ACW][syncHangup]\x20%s',_0x52a2ed[_0xf6d0('0x39')]);}};Acw['prototype'][_0xf6d0('0x12')]=function(_0x25b032){try{if(!_[_0xf6d0('0x46')](this[_0xf6d0('0x1a')][_0x25b032[_0xf6d0('0x47')]])){this[_0xf6d0('0x19')](_0x25b032[_0xf6d0('0x47')]);if(this[_0xf6d0('0x1a')][_0x25b032[_0xf6d0('0x48')]]){this[_0xf6d0('0x1a')][_0x25b032[_0xf6d0('0x48')]][_0xf6d0('0x26')]=!![];this[_0xf6d0('0x1a')][_0x25b032[_0xf6d0('0x49')]]=this[_0xf6d0('0x1a')][_0x25b032[_0xf6d0('0x48')]];delete this[_0xf6d0('0x1a')][_0x25b032[_0xf6d0('0x48')]];}}else if(!_['isNil'](this['channels'][_0x25b032[_0xf6d0('0x49')]])){this[_0xf6d0('0x19')](_0x25b032[_0xf6d0('0x49')]);if(this['channels'][_0x25b032[_0xf6d0('0x4a')]]){this[_0xf6d0('0x1a')][_0x25b032[_0xf6d0('0x4a')]][_0xf6d0('0x26')]=!![];this['channels'][_0x25b032[_0xf6d0('0x47')]]=this[_0xf6d0('0x1a')][_0x25b032['origtransfereruniqueid']];delete this[_0xf6d0('0x1a')][_0x25b032['origtransfereruniqueid']];}}}catch(_0x45dad7){logger[_0xf6d0('0x38')](_0xf6d0('0x4b'),_0x45dad7['message']);}};Acw[_0xf6d0('0x18')][_0xf6d0('0x14')]=function(_0x79052f){try{if(this[_0xf6d0('0x1a')][_0x79052f[_0xf6d0('0x4c')]]){logger[_0xf6d0('0x24')](_0xf6d0('0x4d'),JSON['stringify'](_0x79052f[_0xf6d0('0x4c')]));this[_0xf6d0('0x19')](_0x79052f[_0xf6d0('0x4c')]);}else if(this[_0xf6d0('0x1a')][_0x79052f[_0xf6d0('0x4e')]]){logger[_0xf6d0('0x24')](_0xf6d0('0x4f'),JSON[_0xf6d0('0x3e')](_0x79052f[_0xf6d0('0x4e')]));this[_0xf6d0('0x19')](_0x79052f[_0xf6d0('0x4e')]);}}catch(_0x50936e){logger['error'](_0xf6d0('0x50'),_0x50936e[_0xf6d0('0x39')]);}};Acw[_0xf6d0('0x18')][_0xf6d0('0x11')]=function(_0x28eed4){try{if(this[_0xf6d0('0x6')][_0x28eed4['queue']]&&this['voiceQueues'][_0x28eed4['queue']][_0xf6d0('0x51')]===_0xf6d0('0x52')){if(this[_0xf6d0('0x7')][_0x28eed4['interface']]){logger['info'](_0xf6d0('0x53'),_0x28eed4[_0xf6d0('0x30')],_0x28eed4['interface'],_0x28eed4[_0xf6d0('0x31')]);return RpcUser[_0xf6d0('0x28')](this[_0xf6d0('0x7')][_0x28eed4[_0xf6d0('0x1b')]],_0xf6d0('0x54'),_0x28eed4[_0xf6d0('0x30')]);}}}catch(_0x5ae468){logger[_0xf6d0('0x38')](_0xf6d0('0x55'),_0x5ae468[_0xf6d0('0x39')]);}};module[_0xf6d0('0x56')]=Acw; \ No newline at end of file +var _0xc07c=['transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','catch','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x3f0b15,_0xb88473){var _0x38f95f=function(_0x3ee319){while(--_0x3ee319){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x38f95f(++_0xb88473);}(_0xc07c,0x1ca));var _0xcc07=function(_0x30a133,_0x567187){_0x30a133=_0x30a133-0x0;var _0x2b3d79=_0xc07c[_0x30a133];return _0x2b3d79;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xcc07('0x0'));var ami=require(_0xcc07('0x1'));var logger=require(_0xcc07('0x2'))('acw');var RpcUser=require(_0xcc07('0x3'));var RpcVoiceAgentReport=require(_0xcc07('0x4'));function Acw(_0x45eb9d){this[_0xcc07('0x5')]=_0x45eb9d[_0xcc07('0x5')];this[_0xcc07('0x6')]=_0x45eb9d[_0xcc07('0x6')];this[_0xcc07('0x7')]=_0x45eb9d[_0xcc07('0x7')];this[_0xcc07('0x8')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xcc07('0x9')](this));ami['on'](_0xcc07('0xa'),this[_0xcc07('0xb')]['bind'](this));ami['on'](_0xcc07('0xc'),this[_0xcc07('0xd')]['bind'](this));ami['on'](_0xcc07('0xe'),this[_0xcc07('0xf')][_0xcc07('0x9')](this));ami['on']('attendedtransfer',this[_0xcc07('0x10')]['bind'](this));ami['on'](_0xcc07('0x11'),this['syncBlindTransfer'][_0xcc07('0x9')](this));ami['on'](_0xcc07('0x12'),this[_0xcc07('0x13')]['bind'](this));}function getDiff(_0x5d92ff){var _0xb1e66d=moment()[_0xcc07('0x14')](0x0);var _0x7d6bb2=moment(_0x5d92ff)['milliseconds'](0x0);return _0xb1e66d[_0xcc07('0x15')](_0x7d6bb2,_0xcc07('0x16'));}Acw[_0xcc07('0x17')][_0xcc07('0x18')]=function(_0x195055){try{var _0x2b8034=this;var _0x2f215f=this['channels'][_0x195055]['interface'];var _0x29254c=this['channels'][_0x195055][_0xcc07('0x19')];var _0x3dc621=this[_0xcc07('0x5')][_0x29254c];var _0x23e529=![];var _0x34cba1=_0xcc07('0x1a');if(_0x3dc621[_0xcc07('0x1b')]){if(_0x3dc621[_0xcc07('0x1c')]['name']){_0x23e529=!![];_0x34cba1=_0x3dc621[_0xcc07('0x1c')][_0xcc07('0x1d')];}}ami[_0xcc07('0x1e')]({'action':_0xcc07('0x1f'),'interface':_0x2f215f,'paused':!![],'reason':_0x34cba1})[_0xcc07('0x20')](function(_0xe6ef33){if(_0x2b8034['agents'][_0x2f215f]){return RpcUser[_0xcc07('0x21')](_0x2b8034[_0xcc07('0x6')][_0x2f215f]['id'])[_0xcc07('0x20')](function(_0x2d2e3c){if(_0x2d2e3c&&!_0x2d2e3c[_0xcc07('0x22')]){logger['info'](_0xcc07('0x23'),_0x195055,_0x2f215f,_0x29254c);var _0x2291ad=_0x2b8034[_0xcc07('0x8')][_0x195055][_0xcc07('0x24')]&&_0x2b8034[_0xcc07('0x8')][_0x195055][_0xcc07('0x25')]?_0x2b8034[_0xcc07('0x8')][_0x195055][_0xcc07('0x25')]:_0x195055;return RpcUser[_0xcc07('0x26')](_0x2b8034[_0xcc07('0x6')][_0x2f215f],_0x34cba1,_0x2291ad)[_0xcc07('0x20')](function(_0x2b5dff){if(!_0x23e529){_0x2b8034['timers'][_0x2f215f]={};logger[_0xcc07('0x27')](_0xcc07('0x28'),_0x195055,_0x2b8034[_0xcc07('0x5')][_0x29254c][_0xcc07('0x29')],_0x2f215f,_0x29254c);_0x2b8034['timers'][_0x2f215f][_0xcc07('0x2a')]=setTimeout(_0x2b8034[_0xcc07('0x2b')][_0xcc07('0x9')](_0x2b8034,_0x2f215f),_0x2b8034[_0xcc07('0x5')][_0x29254c][_0xcc07('0x29')]*0x3e8);_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x2c')]=moment()[_0xcc07('0x2d')](_0xcc07('0x2e'));_0x2b8034[_0xcc07('0x7')][_0x2f215f]['uniqueid']=_0x195055;_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x19')]=_0x29254c;_0x2b8034['timers'][_0x2f215f][_0xcc07('0x2f')]=function(){var _0x2e63ea=getDiff(_0x2b8034['timers'][_0x2f215f][_0xcc07('0x2c')]);clearTimeout(_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x2a')]);_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x2a')]=![];RpcVoiceAgentReport[_0xcc07('0x30')]({'acwtime':_0x2e63ea},_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x31')],_0x2f215f)[_0xcc07('0x20')](function(_0x516959){logger[_0xcc07('0x27')](_0xcc07('0x32'),_0x195055,_0x2e63ea,_0x516959);})['catch'](function(_0x4092a0){logger[_0xcc07('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x195055,_0x4092a0);});delete _0x2b8034[_0xcc07('0x7')][_0x2f215f];};}});}else{logger[_0xcc07('0x27')](_0xcc07('0x34'),_0x195055,_0x2f215f,_0x29254c);}});}})['catch'](function(_0x535167){logger[_0xcc07('0x33')](_0xcc07('0x28'),_0x195055,_0x2b8034[_0xcc07('0x5')][_0x29254c][_0xcc07('0x29')],_0x2f215f,_0x29254c);})[_0xcc07('0x35')](function(){delete _0x2b8034[_0xcc07('0x8')][_0x195055];});}catch(_0x3be37a){logger[_0xcc07('0x33')](_0xcc07('0x36'),_0x3be37a['message']);}};Acw[_0xcc07('0x17')][_0xcc07('0x2b')]=function(_0x1c7e9c){try{var _0x39e22f=this;if(_0x39e22f[_0xcc07('0x7')][_0x1c7e9c]){_0x39e22f[_0xcc07('0x7')][_0x1c7e9c][_0xcc07('0x2a')]=![];var _0x2f681d=_0x39e22f[_0xcc07('0x7')][_0x1c7e9c]['uniqueid'];var _0x51e8ad=_0x39e22f[_0xcc07('0x7')][_0x1c7e9c][_0xcc07('0x19')];var _0x1bdd70=_0x39e22f[_0xcc07('0x5')][_0x51e8ad]['acwTimeout'];logger['info'](_0xcc07('0x37'),_0x2f681d,_0x1c7e9c);RpcUser[_0xcc07('0x38')](this[_0xcc07('0x6')][_0x1c7e9c]);RpcVoiceAgentReport[_0xcc07('0x30')]({'acwtime':_0x1bdd70,'agentacw':!![]},_0x2f681d,_0x1c7e9c)[_0xcc07('0x20')](function(_0x54b2a4){logger[_0xcc07('0x27')](_0xcc07('0x32'),_0x2f681d,_0x1bdd70,_0x54b2a4);})[_0xcc07('0x39')](function(_0x2a94ba){logger[_0xcc07('0x33')](_0xcc07('0x3a'),_0x2f681d,_0x2a94ba);});}else{logger[_0xcc07('0x33')](_0xcc07('0x3b'),_0x1c7e9c);if(_0x39e22f[_0xcc07('0x7')]){logger[_0xcc07('0x27')](_0xcc07('0x3c'),JSON[_0xcc07('0x3d')](_0x39e22f['timers']));}}}catch(_0x5b28b9){logger[_0xcc07('0x33')]('[ACW][STOP]\x20%s',_0x5b28b9[_0xcc07('0x3e')]);}};Acw[_0xcc07('0x17')]['syncAgentConnect']=function(_0x3d2dbb){try{if(this[_0xcc07('0x5')][_0x3d2dbb['queue']]&&(this['voiceQueues'][_0x3d2dbb[_0xcc07('0x19')]][_0xcc07('0x3f')]||this[_0xcc07('0x5')][_0x3d2dbb[_0xcc07('0x19')]][_0xcc07('0x1b')])){if(this['agents'][_0x3d2dbb[_0xcc07('0x40')]]){this[_0xcc07('0x8')][_0x3d2dbb[_0xcc07('0x31')]]={'queue':_0x3d2dbb[_0xcc07('0x19')],'interface':_0x3d2dbb[_0xcc07('0x40')],'destlinkedid':_0x3d2dbb[_0xcc07('0x25')]};}}}catch(_0x32e73){logger[_0xcc07('0x33')](_0xcc07('0x41'),_0x32e73[_0xcc07('0x3e')]);}};Acw[_0xcc07('0x17')]['syncAgentConnectPreview']=function(_0x398faf){try{if(this[_0xcc07('0x5')][_0x398faf['queue']]&&(this[_0xcc07('0x5')][_0x398faf[_0xcc07('0x19')]][_0xcc07('0x3f')]||this[_0xcc07('0x5')][_0x398faf[_0xcc07('0x19')]]['mandatoryDisposition'])){if(this[_0xcc07('0x6')][_0x398faf[_0xcc07('0x40')]]){this['channels'][_0x398faf['uniqueid']]={'queue':_0x398faf[_0xcc07('0x19')],'interface':_0x398faf[_0xcc07('0x40')]};}}}catch(_0x52851e){logger[_0xcc07('0x33')](_0xcc07('0x42'),_0x52851e[_0xcc07('0x3e')]);}};Acw['prototype'][_0xcc07('0xb')]=function(_0x30ae07){try{if(this[_0xcc07('0x8')][_0x30ae07['uniqueid']]&&_['isUndefined'](this[_0xcc07('0x8')][_0x30ae07[_0xcc07('0x31')]][_0xcc07('0x24')])){logger[_0xcc07('0x27')](_0xcc07('0x43'),_0x30ae07[_0xcc07('0x31')]);this['startAcw'](_0x30ae07[_0xcc07('0x31')]);}else if(this[_0xcc07('0x8')][_0x30ae07['linkedid']]&&_[_0xcc07('0x44')](this[_0xcc07('0x8')][_0x30ae07[_0xcc07('0x45')]][_0xcc07('0x24')])){logger[_0xcc07('0x27')](_0xcc07('0x46'),_0x30ae07[_0xcc07('0x45')]);this['startAcw'](_0x30ae07[_0xcc07('0x45')]);}}catch(_0x53dbff){logger[_0xcc07('0x33')](_0xcc07('0x47'),_0x53dbff[_0xcc07('0x3e')]);}};Acw[_0xcc07('0x17')][_0xcc07('0xd')]=function(_0x13ffa6){try{if(this[_0xcc07('0x8')][_0x13ffa6[_0xcc07('0x31')]]&&this['channels'][_0x13ffa6[_0xcc07('0x31')]][_0xcc07('0x24')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x13ffa6['uniqueid']);this[_0xcc07('0x18')](_0x13ffa6[_0xcc07('0x31')]);}else if(this[_0xcc07('0x8')][_0x13ffa6[_0xcc07('0x45')]]&&this[_0xcc07('0x8')][_0x13ffa6[_0xcc07('0x45')]][_0xcc07('0x24')]){logger[_0xcc07('0x27')](_0xcc07('0x48'),_0x13ffa6[_0xcc07('0x45')]);this[_0xcc07('0x18')](_0x13ffa6[_0xcc07('0x45')]);}}catch(_0x5736db){logger[_0xcc07('0x33')](_0xcc07('0x49'),_0x5736db[_0xcc07('0x3e')]);}};Acw[_0xcc07('0x17')][_0xcc07('0x10')]=function(_0xd6e80e){try{if(!_['isNil'](this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4a')]])){this[_0xcc07('0x18')](_0xd6e80e['transfereeuniqueid']);if(this['channels'][_0xd6e80e[_0xcc07('0x4b')]]){this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4b')]][_0xcc07('0x24')]=!![];this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4c')]]=this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4b')]];delete this[_0xcc07('0x8')][_0xd6e80e['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4c')]])){this[_0xcc07('0x18')](_0xd6e80e['transfertargetuniqueid']);if(this['channels'][_0xd6e80e[_0xcc07('0x4d')]]){this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4d')]][_0xcc07('0x24')]=!![];this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4a')]]=this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4d')]];delete this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4d')]];}}}catch(_0x2c6abb){logger[_0xcc07('0x33')](_0xcc07('0x4e'),_0x2c6abb[_0xcc07('0x3e')]);}};Acw['prototype'][_0xcc07('0x4f')]=function(_0x5cf9e7){try{if(this[_0xcc07('0x8')][_0x5cf9e7[_0xcc07('0x50')]]){logger[_0xcc07('0x27')](_0xcc07('0x51'),JSON[_0xcc07('0x3d')](_0x5cf9e7[_0xcc07('0x50')]));this[_0xcc07('0x18')](_0x5cf9e7[_0xcc07('0x50')]);}else if(this['channels'][_0x5cf9e7[_0xcc07('0x52')]]){logger[_0xcc07('0x27')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xcc07('0x3d')](_0x5cf9e7[_0xcc07('0x52')]));this['startAcw'](_0x5cf9e7[_0xcc07('0x52')]);}}catch(_0x1f64f1){logger[_0xcc07('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x1f64f1[_0xcc07('0x3e')]);}};Acw['prototype'][_0xcc07('0xf')]=function(_0x2fee14){try{if(this[_0xcc07('0x5')][_0x2fee14['queue']]&&this[_0xcc07('0x5')][_0x2fee14[_0xcc07('0x19')]][_0xcc07('0x53')]===_0xcc07('0x54')){if(this['agents'][_0x2fee14[_0xcc07('0x40')]]){logger[_0xcc07('0x27')](_0xcc07('0x55'),_0x2fee14[_0xcc07('0x31')],_0x2fee14[_0xcc07('0x40')],_0x2fee14[_0xcc07('0x19')]);return RpcUser[_0xcc07('0x26')](this[_0xcc07('0x6')][_0x2fee14['interface']],_0xcc07('0x56'),_0x2fee14[_0xcc07('0x31')]);}}}catch(_0x3f2c69){logger[_0xcc07('0x33')](_0xcc07('0x57'),_0x3f2c69[_0xcc07('0x3e')]);}};module[_0xcc07('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 18482cf..51defeb 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 _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x42c54f,_0x40023a){var _0x4c5e40=function(_0xc3b704){while(--_0xc3b704){_0x42c54f['push'](_0x42c54f['shift']());}};_0x4c5e40(++_0x40023a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x0b0e[_0x2aa48b];return _0x48caf8;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x3b4411,_0x5b1b3f){var _0x271e00=function(_0x3c0ee5){while(--_0x3c0ee5){_0x3b4411['push'](_0x3b4411['shift']());}};_0x271e00(++_0x5b1b3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0xb10b[_0x3585fb];return _0x48fb79;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),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 80b3ab6..7e3e060 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 _0x9c44=['ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x342af3,_0x25396f){var _0x4ac2b8=function(_0x58a3ad){while(--_0x58a3ad){_0x342af3['push'](_0x342af3['shift']());}};_0x4ac2b8(++_0x25396f);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var client=jayson[_0x49c4('0x2')][_0x49c4('0x3')]({'port':0x2329});client[_0x49c4('0x4')]=function(_0x2ad237,_0x4e0313){return new BPromise(function(_0x4941f1,_0x41a183){return client['request'](_0x2ad237,_0x4e0313)[_0x49c4('0x5')](function(_0x6030ae){logger[_0x49c4('0x6')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x4e0313,_0x6030ae);if(_0x6030ae['error']){logger[_0x49c4('0x9')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x6030ae[_0x49c4('0x9')]['message'],_0x4e0313);return _0x41a183(_0x6030ae['error'][_0x49c4('0xa')]);}else{return _0x4941f1(_0x6030ae[_0x49c4('0xb')]);}})['catch'](function(_0xb611a1){logger[_0x49c4('0x9')]('rpc','memberReport',_0x2ad237,_0xb611a1,_0x4e0313);return _0x41a183(_0xb611a1);});});};module[_0x49c4('0xc')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x9bde,0xe1));var _0xe9bd=function(_0x263df5,_0x3d8533){_0x263df5=_0x263df5-0x0;var _0xd6fae9=_0x9bde[_0x263df5];return _0xd6fae9;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index a39c5f6..228e9dc 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 _0xaa0e=['idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3d1397,_0x57b729){var _0x5a5015=function(_0x301802){while(--_0x301802){_0x3d1397['push'](_0x3d1397['shift']());}};_0x5a5015(++_0x57b729);}(_0xaa0e,0x66));var _0xeaa0=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0xaa0e[_0x55daf2];return _0x1c8500;};'use strict';var util=require(_0xeaa0('0x0'));var _=require(_0xeaa0('0x1'));var moment=require(_0xeaa0('0x2'));function checkNameSurname(_0x156369,_0x379b6c,_0x207cb9){var _0x2bbb28='';if(!_[_0xeaa0('0x3')](_0x379b6c)&&_0xeaa0('0x4')===typeof _0x379b6c){_0x2bbb28+=_0x379b6c;}if(!_[_0xeaa0('0x3')](_0x207cb9)&&'string'===typeof _0x207cb9){_0x2bbb28+='\x20'+_0x207cb9;}if(_0x2bbb28!==''){return _0x2bbb28;}return _0x156369;}function Action(_0x4d058f,_0x48d8ec,_0x2a1f97){this[_0xeaa0('0x5')]=_0x4d058f;this[_0xeaa0('0x6')]=_0x2a1f97||undefined;this[_0xeaa0('0x7')]=checkNameSurname(_0x48d8ec['Contact'][_0xeaa0('0x8')],_0x48d8ec['Contact']['firstName'],_0x48d8ec[_0xeaa0('0x9')][_0xeaa0('0xa')]);this[_0xeaa0('0xb')]=_0x48d8ec[_0xeaa0('0x9')][_0xeaa0('0x8')];this[_0xeaa0('0xc')]=_0x4d058f[_0xeaa0('0x7')];this[_0xeaa0('0xd')]=_0x48d8ec[_0xeaa0('0xd')]||![];this['type']=_0x4d058f[_0xeaa0('0xe')];this['dialQueueTimeout']=_0x4d058f[_0xeaa0('0xf')]||0x3;this[_0xeaa0('0x10')]=_0x48d8ec[_0xeaa0('0x10')];this['countbusyretry']=_0x48d8ec[_0xeaa0('0x11')];this['countcongestionretry']=_0x48d8ec[_0xeaa0('0x12')];this['countnoanswerretry']=_0x48d8ec[_0xeaa0('0x13')];this[_0xeaa0('0x14')]=_0x48d8ec[_0xeaa0('0x14')];this[_0xeaa0('0x15')]=_0x48d8ec[_0xeaa0('0x15')];this[_0xeaa0('0x16')]=_0x48d8ec[_0xeaa0('0x16')];this[_0xeaa0('0x17')]=_0x48d8ec[_0xeaa0('0x17')];this['countagentrejectretry']=_0x48d8ec[_0xeaa0('0x18')];this[_0xeaa0('0x19')]=_0x48d8ec[_0xeaa0('0x19')];this[_0xeaa0('0x1a')]=_0x48d8ec[_0xeaa0('0x1a')];this[_0xeaa0('0x1b')]=_0x48d8ec['UserId'];this[_0xeaa0('0x1c')]=_0x48d8ec[_0xeaa0('0x1c')];this[_0xeaa0('0x1d')]=_0x48d8ec[_0xeaa0('0x1d')];this[_0xeaa0('0x1e')]=_0x48d8ec['id'];this['ContactFirstName']=_0x48d8ec['Contact']['firstName']||'';this[_0xeaa0('0x1f')]=moment()[_0xeaa0('0x20')](_0xeaa0('0x21'));this['callback']=_0x48d8ec[_0xeaa0('0x22')];this[_0xeaa0('0x23')]=_0x48d8ec[_0xeaa0('0x23')];this[_0xeaa0('0x24')]=_0x48d8ec[_0xeaa0('0x24')];this['recallme']=_0x48d8ec['recallme'];this[_0xeaa0('0x25')]='';this[_0xeaa0('0x26')]='';}Action[_0xeaa0('0x27')][_0xeaa0('0x28')]=function(){return util['format'](_0xeaa0('0x29'),this['name'],this[_0xeaa0('0x5')][_0xeaa0('0x2a')]>0x0?this['number'][_0xeaa0('0x2b')](this[_0xeaa0('0x5')]['dialCutDigit']):this[_0xeaa0('0xb')]);};Action[_0xeaa0('0x27')]['getQueue']=function(){return this[_0xeaa0('0xc')];};module['exports']=Action; \ No newline at end of file +var _0x1ca3=['ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','lodash','moment','string','isNil','voiceQueue','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x4b0167,_0x154254){var _0x635b82=function(_0x3ecb62){while(--_0x3ecb62){_0x4b0167['push'](_0x4b0167['shift']());}};_0x635b82(++_0x154254);}(_0x1ca3,0x117));var _0x31ca=function(_0x270988,_0x4f80f0){_0x270988=_0x270988-0x0;var _0xa9f73=_0x1ca3[_0x270988];return _0xa9f73;};'use strict';var util=require('util');var _=require(_0x31ca('0x0'));var moment=require(_0x31ca('0x1'));function checkNameSurname(_0x3815c7,_0x4140ee,_0x20bd8b){var _0x258634='';if(!_['isNil'](_0x4140ee)&&_0x31ca('0x2')===typeof _0x4140ee){_0x258634+=_0x4140ee;}if(!_[_0x31ca('0x3')](_0x20bd8b)&&'string'===typeof _0x20bd8b){_0x258634+='\x20'+_0x20bd8b;}if(_0x258634!==''){return _0x258634;}return _0x3815c7;}function Action(_0x736f9c,_0x5e2d71,_0x420470){this[_0x31ca('0x4')]=_0x736f9c;this['uniqueid']=_0x420470||undefined;this[_0x31ca('0x5')]=checkNameSurname(_0x5e2d71[_0x31ca('0x6')][_0x31ca('0x7')],_0x5e2d71['Contact'][_0x31ca('0x8')],_0x5e2d71[_0x31ca('0x6')][_0x31ca('0x9')]);this[_0x31ca('0xa')]=_0x5e2d71[_0x31ca('0x6')]['phone'];this['queue']=_0x736f9c[_0x31ca('0x5')];this[_0x31ca('0xb')]=_0x5e2d71[_0x31ca('0xb')]||![];this[_0x31ca('0xc')]=_0x736f9c[_0x31ca('0xc')];this['dialQueueTimeout']=_0x736f9c[_0x31ca('0xd')]||0x3;this['scheduledat']=_0x5e2d71[_0x31ca('0xe')];this[_0x31ca('0xf')]=_0x5e2d71[_0x31ca('0xf')];this[_0x31ca('0x10')]=_0x5e2d71[_0x31ca('0x10')];this[_0x31ca('0x11')]=_0x5e2d71[_0x31ca('0x11')];this['countnosuchnumberretry']=_0x5e2d71[_0x31ca('0x12')];this[_0x31ca('0x13')]=_0x5e2d71[_0x31ca('0x13')];this[_0x31ca('0x14')]=_0x5e2d71[_0x31ca('0x14')];this[_0x31ca('0x15')]=_0x5e2d71['countmachineretry'];this[_0x31ca('0x16')]=_0x5e2d71['countagentrejectretry'];this[_0x31ca('0x17')]=_0x5e2d71[_0x31ca('0x17')];this[_0x31ca('0x18')]=_0x5e2d71[_0x31ca('0x18')];this[_0x31ca('0x19')]=_0x5e2d71[_0x31ca('0x19')];this[_0x31ca('0x1a')]=_0x5e2d71['VoiceQueueId'];this[_0x31ca('0x1b')]=_0x5e2d71[_0x31ca('0x1b')];this[_0x31ca('0x1c')]=_0x5e2d71['id'];this[_0x31ca('0x1d')]=_0x5e2d71[_0x31ca('0x6')]['firstName']||'';this[_0x31ca('0x1e')]=moment()[_0x31ca('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x31ca('0x20')]=_0x5e2d71[_0x31ca('0x20')];this[_0x31ca('0x21')]=_0x5e2d71[_0x31ca('0x21')];this[_0x31ca('0x22')]=_0x5e2d71['callbackat'];this[_0x31ca('0x23')]=_0x5e2d71['recallme'];this[_0x31ca('0x24')]='';this[_0x31ca('0x25')]='';}Action[_0x31ca('0x26')][_0x31ca('0x27')]=function(){return util[_0x31ca('0x1f')]('\x22%s\x22\x20<%s>',this[_0x31ca('0x5')],this['voiceQueue'][_0x31ca('0x28')]>0x0?this[_0x31ca('0xa')][_0x31ca('0x29')](this[_0x31ca('0x4')][_0x31ca('0x28')]):this['number']);};Action['prototype'][_0x31ca('0x2a')]=function(){return this['queue'];};module[_0x31ca('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index b3b82c5..2c1d702 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 _0xd487=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','number','starttime','responsetime','answertime','format','ringtime','holdtime','talktime','endtime','membername','reason','callback'];(function(_0x505895,_0x1cc8e6){var _0xb85fe7=function(_0xa301fe){while(--_0xa301fe){_0x505895['push'](_0x505895['shift']());}};_0xb85fe7(++_0x1cc8e6);}(_0xd487,0xec));var _0x7d48=function(_0x4f1af9,_0xc95c63){_0x4f1af9=_0x4f1af9-0x0;var _0x11a60e=_0xd487[_0x4f1af9];return _0x11a60e;};'use strict';var util=require(_0x7d48('0x0'));var _=require(_0x7d48('0x1'));var moment=require(_0x7d48('0x2'));function getSeconds(_0x512944,_0x4ca873){var _0x1a96d4=moment(_0x512944)['milliseconds'](0x0);var _0x2c6b36=moment(_0x4ca873)[_0x7d48('0x3')](0x0);return _0x1a96d4[_0x7d48('0x4')](_0x2c6b36,_0x7d48('0x5'));}function AgentComplete(_0x1cc003,_0x55e90d){this[_0x7d48('0x6')]=0x4;this[_0x7d48('0x7')]='Answer';this['scheduledat']=_0x1cc003[_0x7d48('0x8')];this[_0x7d48('0x9')]=_0x1cc003[_0x7d48('0x9')];this[_0x7d48('0xa')]=_0x1cc003['type']==='outbound'?_0x7d48('0xb'):_0x1cc003[_0x7d48('0x9')];this[_0x7d48('0xc')]=_0x1cc003[_0x7d48('0xc')];this[_0x7d48('0xd')]=_0x1cc003['countcongestionretry'];this[_0x7d48('0xe')]=_0x1cc003[_0x7d48('0xe')];this['countglobal']=_0x1cc003['countbusyretry']+_0x1cc003['countcongestionretry']+_0x1cc003['countnoanswerretry']+_0x1cc003[_0x7d48('0xf')]+_0x1cc003[_0x7d48('0x10')]+_0x1cc003['countabandonedretry']+_0x1cc003[_0x7d48('0x11')]+_0x1cc003[_0x7d48('0x12')];this[_0x7d48('0xf')]=_0x1cc003['countnosuchnumberretry'];this['countdropretry']=_0x1cc003[_0x7d48('0x10')];this[_0x7d48('0x13')]=_0x1cc003['countabandonedretry'];this[_0x7d48('0x11')]=_0x1cc003[_0x7d48('0x11')];this[_0x7d48('0x12')]=_0x1cc003[_0x7d48('0x12')];this[_0x7d48('0x14')]=_0x55e90d[_0x7d48('0x14')];this['calleridname']=_0x1cc003[_0x7d48('0x15')];this['calleridnum']=_0x1cc003[_0x7d48('0x16')];this[_0x7d48('0x17')]=_0x1cc003[_0x7d48('0x17')];this[_0x7d48('0x18')]=_0x1cc003[_0x7d48('0x18')];this['answertime']=_0x1cc003[_0x7d48('0x19')];this['endtime']=moment()[_0x7d48('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7d48('0x1b')]=getSeconds(_0x1cc003['responsetime'],_0x1cc003['starttime']);this[_0x7d48('0x1c')]=getSeconds(_0x1cc003[_0x7d48('0x19')],_0x1cc003[_0x7d48('0x18')]);this[_0x7d48('0x1d')]=getSeconds(this[_0x7d48('0x1e')],_0x1cc003[_0x7d48('0x19')]);this[_0x7d48('0xb')]=_0x55e90d[_0x7d48('0xb')];this['membername']=_0x55e90d[_0x7d48('0x1f')];this[_0x7d48('0x20')]=_0x55e90d[_0x7d48('0x20')];this[_0x7d48('0x21')]=_0x1cc003['callback'];this[_0x7d48('0x22')]=_0x1cc003[_0x7d48('0x22')];this['callbackat']=_0x1cc003[_0x7d48('0x23')];this['recallme']=_0x1cc003[_0x7d48('0x24')];this[_0x7d48('0x25')]=_0x1cc003['ContactId'];this[_0x7d48('0x26')]=_0x1cc003[_0x7d48('0x26')];this[_0x7d48('0x27')]=_0x1cc003['UserId'];this[_0x7d48('0x28')]=_0x1cc003[_0x7d48('0x28')];this[_0x7d48('0x29')]=_0x1cc003['CampaignId'];this[_0x7d48('0x2a')]=_0x1cc003[_0x7d48('0x2a')]||'';this[_0x7d48('0x2b')]=_0x1cc003[_0x7d48('0x2b')]||'';}module[_0x7d48('0x2c')]=AgentComplete; \ No newline at end of file +var _0xb455=['holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime'];(function(_0x23a62f,_0x1166df){var _0x35a97a=function(_0x5ea529){while(--_0x5ea529){_0x23a62f['push'](_0x23a62f['shift']());}};_0x35a97a(++_0x1166df);}(_0xb455,0x142));var _0x5b45=function(_0xba908c,_0xe7a057){_0xba908c=_0xba908c-0x0;var _0x3627c8=_0xb455[_0xba908c];return _0x3627c8;};'use strict';var util=require(_0x5b45('0x0'));var _=require(_0x5b45('0x1'));var moment=require(_0x5b45('0x2'));function getSeconds(_0x3cb29e,_0x5de933){var _0x4aaabf=moment(_0x3cb29e)[_0x5b45('0x3')](0x0);var _0x5d6627=moment(_0x5de933)[_0x5b45('0x3')](0x0);return _0x4aaabf[_0x5b45('0x4')](_0x5d6627,'seconds');}function AgentComplete(_0x347632,_0x1042e6){this[_0x5b45('0x5')]=0x4;this['statedesc']=_0x5b45('0x6');this['scheduledat']=_0x347632['scheduledat'];this[_0x5b45('0x7')]=_0x347632[_0x5b45('0x7')];this['campaigntype']=_0x347632[_0x5b45('0x7')]===_0x5b45('0x8')?_0x5b45('0x9'):_0x347632[_0x5b45('0x7')];this[_0x5b45('0xa')]=_0x347632[_0x5b45('0xa')];this[_0x5b45('0xb')]=_0x347632['countcongestionretry'];this[_0x5b45('0xc')]=_0x347632[_0x5b45('0xc')];this[_0x5b45('0xd')]=_0x347632[_0x5b45('0xa')]+_0x347632['countcongestionretry']+_0x347632[_0x5b45('0xc')]+_0x347632[_0x5b45('0xe')]+_0x347632[_0x5b45('0xf')]+_0x347632[_0x5b45('0x10')]+_0x347632[_0x5b45('0x11')]+_0x347632[_0x5b45('0x12')];this[_0x5b45('0xe')]=_0x347632[_0x5b45('0xe')];this['countdropretry']=_0x347632[_0x5b45('0xf')];this[_0x5b45('0x10')]=_0x347632[_0x5b45('0x10')];this['countmachineretry']=_0x347632[_0x5b45('0x11')];this[_0x5b45('0x12')]=_0x347632['countagentrejectretry'];this[_0x5b45('0x13')]=_0x1042e6[_0x5b45('0x13')];this[_0x5b45('0x14')]=_0x347632[_0x5b45('0x15')];this[_0x5b45('0x16')]=_0x347632[_0x5b45('0x17')];this[_0x5b45('0x18')]=_0x347632['starttime'];this[_0x5b45('0x19')]=_0x347632[_0x5b45('0x19')];this['answertime']=_0x347632[_0x5b45('0x1a')];this[_0x5b45('0x1b')]=moment()[_0x5b45('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5b45('0x1d')]=getSeconds(_0x347632[_0x5b45('0x19')],_0x347632[_0x5b45('0x18')]);this[_0x5b45('0x1e')]=getSeconds(_0x347632['answertime'],_0x347632['responsetime']);this['talktime']=getSeconds(this[_0x5b45('0x1b')],_0x347632['answertime']);this[_0x5b45('0x9')]=_0x1042e6[_0x5b45('0x9')];this[_0x5b45('0x1f')]=_0x1042e6['membername'];this[_0x5b45('0x20')]=_0x1042e6[_0x5b45('0x20')];this[_0x5b45('0x21')]=_0x347632[_0x5b45('0x21')];this[_0x5b45('0x22')]=_0x347632['callbackuniqueid'];this[_0x5b45('0x23')]=_0x347632['callbackat'];this[_0x5b45('0x24')]=_0x347632[_0x5b45('0x24')];this[_0x5b45('0x25')]=_0x347632[_0x5b45('0x25')];this[_0x5b45('0x26')]=_0x347632[_0x5b45('0x26')];this['UserId']=_0x347632['UserId'];this['VoiceQueueId']=_0x347632[_0x5b45('0x27')];this[_0x5b45('0x28')]=_0x347632[_0x5b45('0x28')];this[_0x5b45('0x29')]=_0x347632[_0x5b45('0x29')]||'';this[_0x5b45('0x2a')]=_0x347632[_0x5b45('0x2a')]||'';}module[_0x5b45('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 8f822df..63e05d7 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 _0x5178=['queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0x5178,0x171));var _0x8517=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5178[_0x1ac595];return _0x455fff;};'use strict';var util=require('util');var _=require(_0x8517('0x0'));var moment=require(_0x8517('0x1'));function getSeconds(_0x27662b,_0x2dc28f){var _0x38d5b3=moment(_0x27662b)['milliseconds'](0x0);var _0x483381=moment(_0x2dc28f)[_0x8517('0x2')](0x0);return _0x38d5b3[_0x8517('0x3')](_0x483381,'seconds');}function Final(_0xd4b0){this['uniqueid']=_0xd4b0[_0x8517('0x4')];this[_0x8517('0x5')]=_0xd4b0[_0x8517('0x5')];this[_0x8517('0x6')]=_0xd4b0[_0x8517('0x6')];this['campaigntype']=_0xd4b0[_0x8517('0x6')]==='outbound'?'queue':_0xd4b0[_0x8517('0x6')];this[_0x8517('0x7')]=_0xd4b0['countbusyretry'];this[_0x8517('0x8')]=_0xd4b0[_0x8517('0x8')];this[_0x8517('0x9')]=_0xd4b0[_0x8517('0x9')];this[_0x8517('0xa')]=_0xd4b0[_0x8517('0x7')]+_0xd4b0[_0x8517('0x8')]+_0xd4b0[_0x8517('0x9')]+_0xd4b0['countnosuchnumberretry']+_0xd4b0[_0x8517('0xb')]+_0xd4b0[_0x8517('0xc')]+_0xd4b0[_0x8517('0xd')]+_0xd4b0[_0x8517('0xe')];this[_0x8517('0xf')]=_0xd4b0['countnosuchnumberretry'];this[_0x8517('0xb')]=_0xd4b0[_0x8517('0xb')];this[_0x8517('0xc')]=_0xd4b0[_0x8517('0xc')];this[_0x8517('0xd')]=_0xd4b0[_0x8517('0xd')];this[_0x8517('0xe')]=_0xd4b0[_0x8517('0xe')];this[_0x8517('0x10')]=_0xd4b0[_0x8517('0x10')];this[_0x8517('0x11')]=_0xd4b0[_0x8517('0x11')];this['calleridnum']=_0xd4b0[_0x8517('0x12')];this[_0x8517('0x13')]=_0xd4b0[_0x8517('0x13')];this[_0x8517('0x14')]=_0xd4b0[_0x8517('0x14')];this[_0x8517('0x15')]=_0xd4b0[_0x8517('0x14')];this['ringtime']=_0xd4b0[_0x8517('0x16')]||0x0;this['holdtime']=_0xd4b0['holdtime']||0x0;this[_0x8517('0x17')]=_0xd4b0[_0x8517('0x17')]||0x0;this[_0x8517('0x18')]=_0xd4b0[_0x8517('0x18')];this[_0x8517('0x19')]=_0xd4b0[_0x8517('0x19')];this['callbackat']=_0xd4b0['callbackat'];this[_0x8517('0x1a')]=_0xd4b0[_0x8517('0x1a')];this[_0x8517('0x1b')]=_0xd4b0[_0x8517('0x1b')];this[_0x8517('0x1c')]=_0xd4b0[_0x8517('0x1c')];this['UserId']=_0xd4b0[_0x8517('0x1d')];this[_0x8517('0x1e')]=_0xd4b0['VoiceQueueId'];this[_0x8517('0x1f')]=_0xd4b0[_0x8517('0x1f')];this[_0x8517('0x20')]=_0xd4b0['originatecalleridnum']||'';this[_0x8517('0x21')]=_0xd4b0['originatecalleridname']||'';}module[_0x8517('0x22')]=Final; \ No newline at end of file +var _0xcb66=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds'];(function(_0x28c3ea,_0x517740){var _0x1bea20=function(_0x39e90e){while(--_0x39e90e){_0x28c3ea['push'](_0x28c3ea['shift']());}};_0x1bea20(++_0x517740);}(_0xcb66,0x19f));var _0x6cb6=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xcb66[_0x2bbc07];return _0x6879e4;};'use strict';var util=require('util');var _=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));function getSeconds(_0x1066ea,_0x3f607b){var _0x205243=moment(_0x1066ea)['milliseconds'](0x0);var _0xe996ed=moment(_0x3f607b)[_0x6cb6('0x2')](0x0);return _0x205243[_0x6cb6('0x3')](_0xe996ed,_0x6cb6('0x4'));}function Final(_0x16bb9d){this['uniqueid']=_0x16bb9d['uniqueid'];this[_0x6cb6('0x5')]=_0x16bb9d[_0x6cb6('0x5')];this[_0x6cb6('0x6')]=_0x16bb9d[_0x6cb6('0x6')];this[_0x6cb6('0x7')]=_0x16bb9d[_0x6cb6('0x6')]===_0x6cb6('0x8')?_0x6cb6('0x9'):_0x16bb9d[_0x6cb6('0x6')];this[_0x6cb6('0xa')]=_0x16bb9d[_0x6cb6('0xa')];this[_0x6cb6('0xb')]=_0x16bb9d[_0x6cb6('0xb')];this['countnoanswerretry']=_0x16bb9d['countnoanswerretry'];this['countglobal']=_0x16bb9d['countbusyretry']+_0x16bb9d[_0x6cb6('0xb')]+_0x16bb9d[_0x6cb6('0xc')]+_0x16bb9d[_0x6cb6('0xd')]+_0x16bb9d[_0x6cb6('0xe')]+_0x16bb9d['countabandonedretry']+_0x16bb9d[_0x6cb6('0xf')]+_0x16bb9d[_0x6cb6('0x10')];this['countnosuchnumberretry']=_0x16bb9d[_0x6cb6('0xd')];this[_0x6cb6('0xe')]=_0x16bb9d['countdropretry'];this[_0x6cb6('0x11')]=_0x16bb9d[_0x6cb6('0x11')];this['countmachineretry']=_0x16bb9d['countmachineretry'];this['countagentrejectretry']=_0x16bb9d['countagentrejectretry'];this[_0x6cb6('0x9')]=_0x16bb9d[_0x6cb6('0x9')];this[_0x6cb6('0x12')]=_0x16bb9d[_0x6cb6('0x12')];this[_0x6cb6('0x13')]=_0x16bb9d[_0x6cb6('0x13')];this['starttime']=_0x16bb9d[_0x6cb6('0x14')];this[_0x6cb6('0x15')]=_0x16bb9d['responsetime'];this['endtime']=_0x16bb9d['responsetime'];this['ringtime']=_0x16bb9d['ringtime']||0x0;this['holdtime']=_0x16bb9d[_0x6cb6('0x16')]||0x0;this[_0x6cb6('0x17')]=_0x16bb9d[_0x6cb6('0x17')]||0x0;this[_0x6cb6('0x18')]=_0x16bb9d[_0x6cb6('0x18')];this['callbackuniqueid']=_0x16bb9d['callbackuniqueid'];this[_0x6cb6('0x19')]=_0x16bb9d[_0x6cb6('0x19')];this[_0x6cb6('0x1a')]=_0x16bb9d[_0x6cb6('0x1a')];this['ContactId']=_0x16bb9d[_0x6cb6('0x1b')];this[_0x6cb6('0x1c')]=_0x16bb9d['ListId'];this['UserId']=_0x16bb9d[_0x6cb6('0x1d')];this['VoiceQueueId']=_0x16bb9d[_0x6cb6('0x1e')];this[_0x6cb6('0x1f')]=_0x16bb9d[_0x6cb6('0x1f')];this[_0x6cb6('0x20')]=_0x16bb9d[_0x6cb6('0x20')]||'';this[_0x6cb6('0x21')]=_0x16bb9d[_0x6cb6('0x21')]||'';}module[_0x6cb6('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 025f154..a7af842 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 _0x096d=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry'];(function(_0x12e1a4,_0x381f75){var _0x185c62=function(_0x149b96){while(--_0x149b96){_0x12e1a4['push'](_0x12e1a4['shift']());}};_0x185c62(++_0x381f75);}(_0x096d,0x191));var _0xd096=function(_0xc465f5,_0xa9c358){_0xc465f5=_0xc465f5-0x0;var _0x3dd839=_0x096d[_0xc465f5];return _0x3dd839;};'use strict';var util=require(_0xd096('0x0'));var _=require(_0xd096('0x1'));var moment=require('moment');function getSeconds(_0x57379d,_0x580518){var _0x42432e=moment(_0x57379d)['milliseconds'](0x0);var _0x69b36b=moment(_0x580518)['milliseconds'](0x0);return _0x42432e['diff'](_0x69b36b,'seconds');}function Hangup(_0x3d8244,_0x23e1cd){this[_0xd096('0x2')]=0x4;this[_0xd096('0x3')]='Answer';this[_0xd096('0x4')]=_0x3d8244[_0xd096('0x4')];this[_0xd096('0x5')]=_0x3d8244[_0xd096('0x5')];this[_0xd096('0x6')]=_0x3d8244[_0xd096('0x5')]===_0xd096('0x7')?'queue':_0x3d8244[_0xd096('0x5')];this[_0xd096('0x8')]=_0x3d8244['countbusyretry'];this['countcongestionretry']=_0x3d8244[_0xd096('0x9')];this[_0xd096('0xa')]=_0x3d8244['countnoanswerretry'];this['countglobal']=_0x3d8244[_0xd096('0x8')]+_0x3d8244['countcongestionretry']+_0x3d8244['countnoanswerretry']+_0x3d8244[_0xd096('0xb')]+_0x3d8244[_0xd096('0xc')]+_0x3d8244[_0xd096('0xd')]+_0x3d8244[_0xd096('0xe')]+_0x3d8244['countagentrejectretry'];this[_0xd096('0xb')]=_0x3d8244['countnosuchnumberretry'];this[_0xd096('0xc')]=_0x3d8244[_0xd096('0xc')];this[_0xd096('0xd')]=_0x3d8244[_0xd096('0xd')];this[_0xd096('0xe')]=_0x3d8244['countmachineretry'];this[_0xd096('0xf')]=_0x3d8244[_0xd096('0xf')];this[_0xd096('0x10')]=_0x23e1cd[_0xd096('0x10')];this[_0xd096('0x11')]=_0x3d8244[_0xd096('0x12')];this[_0xd096('0x13')]=_0x3d8244['number'];this['starttime']=_0x3d8244[_0xd096('0x14')];this[_0xd096('0x15')]=_0x3d8244[_0xd096('0x15')];this[_0xd096('0x16')]=moment()[_0xd096('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd096('0x18')]=getSeconds(_0x3d8244[_0xd096('0x15')],_0x3d8244[_0xd096('0x14')]);this[_0xd096('0x19')]=0x0;this[_0xd096('0x1a')]=getSeconds(this[_0xd096('0x16')],_0x3d8244['responsetime']);this['queue']=_0x3d8244[_0xd096('0x1b')];this['membername']=_0xd096('0x1c');this[_0xd096('0x1d')]=_0x23e1cd[_0xd096('0x1e')];this[_0xd096('0x1f')]=_0x3d8244[_0xd096('0x1f')];this[_0xd096('0x20')]=_0x3d8244['callbackuniqueid'];this[_0xd096('0x21')]=_0x3d8244[_0xd096('0x21')];this[_0xd096('0x22')]=_0x3d8244['recallme'];this[_0xd096('0x23')]=_0x3d8244[_0xd096('0x23')];this[_0xd096('0x24')]=_0x3d8244[_0xd096('0x24')];this['UserId']=_0x3d8244[_0xd096('0x25')];this['VoiceQueueId']=_0x3d8244[_0xd096('0x26')];this[_0xd096('0x27')]=_0x3d8244[_0xd096('0x27')];}module[_0xd096('0x28')]=Hangup; \ No newline at end of file +var _0x9a8f=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','starttime','talktime','IVR','reason','cause-txt','callback'];(function(_0x250da5,_0x4f7286){var _0x26d80a=function(_0x137534){while(--_0x137534){_0x250da5['push'](_0x250da5['shift']());}};_0x26d80a(++_0x4f7286);}(_0x9a8f,0xb9));var _0xf9a8=function(_0x2d5771,_0x298eb0){_0x2d5771=_0x2d5771-0x0;var _0x4e7fff=_0x9a8f[_0x2d5771];return _0x4e7fff;};'use strict';var util=require(_0xf9a8('0x0'));var _=require(_0xf9a8('0x1'));var moment=require(_0xf9a8('0x2'));function getSeconds(_0x58a04d,_0x518b22){var _0x40b2bf=moment(_0x58a04d)[_0xf9a8('0x3')](0x0);var _0x193c89=moment(_0x518b22)['milliseconds'](0x0);return _0x40b2bf[_0xf9a8('0x4')](_0x193c89,_0xf9a8('0x5'));}function Hangup(_0x408a37,_0x32c822){this['state']=0x4;this[_0xf9a8('0x6')]=_0xf9a8('0x7');this[_0xf9a8('0x8')]=_0x408a37['scheduledat'];this[_0xf9a8('0x9')]=_0x408a37['type'];this[_0xf9a8('0xa')]=_0x408a37['type']===_0xf9a8('0xb')?_0xf9a8('0xc'):_0x408a37[_0xf9a8('0x9')];this[_0xf9a8('0xd')]=_0x408a37['countbusyretry'];this['countcongestionretry']=_0x408a37[_0xf9a8('0xe')];this[_0xf9a8('0xf')]=_0x408a37[_0xf9a8('0xf')];this[_0xf9a8('0x10')]=_0x408a37[_0xf9a8('0xd')]+_0x408a37[_0xf9a8('0xe')]+_0x408a37[_0xf9a8('0xf')]+_0x408a37[_0xf9a8('0x11')]+_0x408a37[_0xf9a8('0x12')]+_0x408a37[_0xf9a8('0x13')]+_0x408a37['countmachineretry']+_0x408a37[_0xf9a8('0x14')];this[_0xf9a8('0x11')]=_0x408a37['countnosuchnumberretry'];this[_0xf9a8('0x12')]=_0x408a37['countdropretry'];this['countabandonedretry']=_0x408a37['countabandonedretry'];this[_0xf9a8('0x15')]=_0x408a37[_0xf9a8('0x15')];this[_0xf9a8('0x14')]=_0x408a37[_0xf9a8('0x14')];this[_0xf9a8('0x16')]=_0x32c822[_0xf9a8('0x16')];this[_0xf9a8('0x17')]=_0x408a37[_0xf9a8('0x18')];this['calleridnum']=_0x408a37[_0xf9a8('0x19')];this['starttime']=_0x408a37['starttime'];this[_0xf9a8('0x1a')]=_0x408a37['responsetime'];this[_0xf9a8('0x1b')]=moment()['format'](_0xf9a8('0x1c'));this['ringtime']=getSeconds(_0x408a37['responsetime'],_0x408a37[_0xf9a8('0x1d')]);this['holdtime']=0x0;this[_0xf9a8('0x1e')]=getSeconds(this[_0xf9a8('0x1b')],_0x408a37[_0xf9a8('0x1a')]);this[_0xf9a8('0xc')]=_0x408a37[_0xf9a8('0xc')];this['membername']=_0xf9a8('0x1f');this[_0xf9a8('0x20')]=_0x32c822[_0xf9a8('0x21')];this[_0xf9a8('0x22')]=_0x408a37[_0xf9a8('0x22')];this[_0xf9a8('0x23')]=_0x408a37[_0xf9a8('0x23')];this[_0xf9a8('0x24')]=_0x408a37['callbackat'];this[_0xf9a8('0x25')]=_0x408a37[_0xf9a8('0x25')];this[_0xf9a8('0x26')]=_0x408a37[_0xf9a8('0x26')];this[_0xf9a8('0x27')]=_0x408a37['ListId'];this[_0xf9a8('0x28')]=_0x408a37[_0xf9a8('0x28')];this['VoiceQueueId']=_0x408a37[_0xf9a8('0x29')];this[_0xf9a8('0x2a')]=_0x408a37['CampaignId'];}module[_0xf9a8('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index dc66861..b2ecbb3 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 _0x42d5=['moment','milliseconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x42d5,0x1c5));var _0x542d=function(_0x53353c,_0x1dd8f3){_0x53353c=_0x53353c-0x0;var _0x232a1d=_0x42d5[_0x53353c];return _0x232a1d;};'use strict';var util=require(_0x542d('0x0'));var _=require(_0x542d('0x1'));var moment=require(_0x542d('0x2'));function getSeconds(_0x140ed9,_0x1f0cec){var _0x11dcc9=moment(_0x140ed9)[_0x542d('0x3')](0x0);var _0x534aeb=moment(_0x1f0cec)[_0x542d('0x3')](0x0);return _0x11dcc9['diff'](_0x534aeb,'seconds');}function History(_0x101720){this[_0x542d('0x4')]=_0x101720[_0x542d('0x4')];this[_0x542d('0x5')]=_0x101720['scheduledat']||undefined;this[_0x542d('0x6')]=_0x101720[_0x542d('0x6')];this['campaigntype']=_0x101720[_0x542d('0x6')]===_0x542d('0x7')?_0x542d('0x8'):_0x101720[_0x542d('0x6')];this[_0x542d('0x9')]=_0x101720['countbusyretry'];this[_0x542d('0xa')]=_0x101720[_0x542d('0xa')];this[_0x542d('0xb')]=_0x101720['countnoanswerretry'];this[_0x542d('0xc')]=_0x101720[_0x542d('0x9')]+_0x101720[_0x542d('0xa')]+_0x101720[_0x542d('0xb')]+_0x101720[_0x542d('0xd')]+_0x101720[_0x542d('0xe')]+_0x101720[_0x542d('0xf')]+_0x101720[_0x542d('0x10')]+_0x101720['countagentrejectretry'];this['countnosuchnumberretry']=_0x101720[_0x542d('0xd')];this[_0x542d('0xe')]=_0x101720[_0x542d('0xe')];this[_0x542d('0xf')]=_0x101720['countabandonedretry'];this[_0x542d('0x10')]=_0x101720[_0x542d('0x10')];this[_0x542d('0x11')]=_0x101720['countagentrejectretry'];this[_0x542d('0x8')]=_0x101720[_0x542d('0x8')];this['calleridname']=_0x101720['name'];this['calleridnum']=_0x101720[_0x542d('0x12')];this['starttime']=_0x101720[_0x542d('0x13')];this['responsetime']=_0x101720[_0x542d('0x14')];this['endtime']=_0x101720[_0x542d('0x14')];this[_0x542d('0x15')]=getSeconds(_0x101720[_0x542d('0x14')],_0x101720['starttime']);this[_0x542d('0x16')]=0x0;this[_0x542d('0x17')]=0x0;this['callback']=_0x101720[_0x542d('0x18')];this[_0x542d('0x19')]=_0x101720[_0x542d('0x19')];this[_0x542d('0x1a')]=_0x101720[_0x542d('0x1a')];this[_0x542d('0x1b')]=_0x101720[_0x542d('0x1b')];this['ContactId']=_0x101720['ContactId'];this[_0x542d('0x1c')]=_0x101720['ListId'];this['UserId']=_0x101720[_0x542d('0x1d')];this[_0x542d('0x1e')]=_0x101720[_0x542d('0x1e')];this[_0x542d('0x1f')]=_0x101720[_0x542d('0x1f')];this[_0x542d('0x20')]=_0x101720[_0x542d('0x20')]||'';this[_0x542d('0x21')]=_0x101720[_0x542d('0x21')]||'';}module[_0x542d('0x22')]=History; \ No newline at end of file +var _0x4ac8=['milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment'];(function(_0x1e5044,_0x6e8c05){var _0x44181e=function(_0x4bb976){while(--_0x4bb976){_0x1e5044['push'](_0x1e5044['shift']());}};_0x44181e(++_0x6e8c05);}(_0x4ac8,0x108));var _0x84ac=function(_0x2b7ce8,_0x392eb0){_0x2b7ce8=_0x2b7ce8-0x0;var _0xea0dad=_0x4ac8[_0x2b7ce8];return _0xea0dad;};'use strict';var util=require(_0x84ac('0x0'));var _=require('lodash');var moment=require(_0x84ac('0x1'));function getSeconds(_0x261586,_0x1659a7){var _0x2bcf0f=moment(_0x261586)[_0x84ac('0x2')](0x0);var _0x7e5d14=moment(_0x1659a7)['milliseconds'](0x0);return _0x2bcf0f[_0x84ac('0x3')](_0x7e5d14,_0x84ac('0x4'));}function History(_0x501e88){this[_0x84ac('0x5')]=_0x501e88[_0x84ac('0x5')];this[_0x84ac('0x6')]=_0x501e88[_0x84ac('0x6')]||undefined;this[_0x84ac('0x7')]=_0x501e88['type'];this[_0x84ac('0x8')]=_0x501e88[_0x84ac('0x7')]===_0x84ac('0x9')?_0x84ac('0xa'):_0x501e88[_0x84ac('0x7')];this[_0x84ac('0xb')]=_0x501e88[_0x84ac('0xb')];this['countcongestionretry']=_0x501e88[_0x84ac('0xc')];this[_0x84ac('0xd')]=_0x501e88[_0x84ac('0xd')];this[_0x84ac('0xe')]=_0x501e88[_0x84ac('0xb')]+_0x501e88[_0x84ac('0xc')]+_0x501e88[_0x84ac('0xd')]+_0x501e88[_0x84ac('0xf')]+_0x501e88[_0x84ac('0x10')]+_0x501e88[_0x84ac('0x11')]+_0x501e88[_0x84ac('0x12')]+_0x501e88[_0x84ac('0x13')];this[_0x84ac('0xf')]=_0x501e88['countnosuchnumberretry'];this['countdropretry']=_0x501e88[_0x84ac('0x10')];this['countabandonedretry']=_0x501e88[_0x84ac('0x11')];this['countmachineretry']=_0x501e88['countmachineretry'];this[_0x84ac('0x13')]=_0x501e88[_0x84ac('0x13')];this[_0x84ac('0xa')]=_0x501e88['queue'];this['calleridname']=_0x501e88[_0x84ac('0x14')];this['calleridnum']=_0x501e88[_0x84ac('0x15')];this[_0x84ac('0x16')]=_0x501e88[_0x84ac('0x16')];this[_0x84ac('0x17')]=_0x501e88['responsetime'];this[_0x84ac('0x18')]=_0x501e88[_0x84ac('0x17')];this['ringtime']=getSeconds(_0x501e88[_0x84ac('0x17')],_0x501e88[_0x84ac('0x16')]);this['holdtime']=0x0;this[_0x84ac('0x19')]=0x0;this[_0x84ac('0x1a')]=_0x501e88[_0x84ac('0x1a')];this[_0x84ac('0x1b')]=_0x501e88[_0x84ac('0x1b')];this[_0x84ac('0x1c')]=_0x501e88[_0x84ac('0x1c')];this['recallme']=_0x501e88[_0x84ac('0x1d')];this[_0x84ac('0x1e')]=_0x501e88[_0x84ac('0x1e')];this['ListId']=_0x501e88[_0x84ac('0x1f')];this[_0x84ac('0x20')]=_0x501e88[_0x84ac('0x20')];this[_0x84ac('0x21')]=_0x501e88['VoiceQueueId'];this[_0x84ac('0x22')]=_0x501e88[_0x84ac('0x22')];this[_0x84ac('0x23')]=_0x501e88[_0x84ac('0x23')]||'';this[_0x84ac('0x24')]=_0x501e88[_0x84ac('0x24')]||'';}module[_0x84ac('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 83cb642..7b07e08 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 _0x9c8f=['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','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','erlangAbandonmentRate','merge','startProgressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','clearZombieChannels','[uniqueid]','enqueue','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','buildObj','amd','[syncHangupInAMD]','MACHINE','AMD','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','add','[rescheduleContact][Machine]','custom:amd','Machine','countglobal','[syncAgentComplete][createHistory][0]','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','stateinterface','locked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','paused','[booked][RR]','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','timezones','content','indexOf','true','command','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','handleIvr','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialer','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','ACTIVE','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','not_inuse','reachable','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/logger','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','uniqueId','optionPredictive','startPredictive','queueBooked','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangBusyFactor','Trunk','format','voice:queue:%s','ivr','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c8f,0x199));var _0xf9c8=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x9c8f[_0x367336];return _0x3423a7;};'use strict';var util=require('util');var _=require(_0xf9c8('0x0'));var BPromise=require(_0xf9c8('0x1'));var uuid=require(_0xf9c8('0x2'));var moment=require(_0xf9c8('0x3'));var rr=require('rr');var md5=require(_0xf9c8('0x4'));var Redis=require('ioredis');var ut=require(_0xf9c8('0x5'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xf9c8('0x6'))('booked');var loggerPredictive=require(_0xf9c8('0x6'))(_0xf9c8('0x7'));var loggerPredictiveCalls=require(_0xf9c8('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0xf9c8('0x8'));var ami=require(_0xf9c8('0x9'));config[_0xf9c8('0xa')]=_[_0xf9c8('0xb')](config[_0xf9c8('0xa')],{'host':_0xf9c8('0xc'),'port':0x18eb});var io=require(_0xf9c8('0xd'))(new Redis(config[_0xf9c8('0xa')]));var cmHopper=require(_0xf9c8('0xe'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xf9c8('0xf'));var voiceQueueRt=require(_0xf9c8('0x10'));var Action=require(_0xf9c8('0x11'));var History=require(_0xf9c8('0x12'));var Final=require(_0xf9c8('0x13'));var AgentComplete=require(_0xf9c8('0x14'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0xf9c8('0x15');var strategy={'rrmemory':_0xf9c8('0x16'),'roundrobin':_0xf9c8('0x17')};var Sequence=function(){};Sequence[_0xf9c8('0x18')]['enqueue']=function(_0x1a51c0){this['tail']=this[_0xf9c8('0x19')]?this[_0xf9c8('0x19')][_0xf9c8('0x1a')](_0x1a51c0):_0x1a51c0();};function Dialer(_0x589b23,_0x3cb182){this[_0xf9c8('0x1b')]=new Sequence();this[_0xf9c8('0x1c')]=_0x3cb182;this[_0xf9c8('0x1d')]=_0x589b23[_0xf9c8('0x1d')];this[_0xf9c8('0x1e')]=_0x589b23['campaigns'];this[_0xf9c8('0x1f')]=_0x589b23[_0xf9c8('0x1f')];this[_0xf9c8('0x20')]=_0x589b23[_0xf9c8('0x20')];this[_0xf9c8('0x21')]=config[_0xf9c8('0x21')]||0x2;this['channels']={};this[_0xf9c8('0x22')]={};this['contactsId']={};this[_0xf9c8('0x23')]={};this[_0xf9c8('0x24')]={};this[_0xf9c8('0x25')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xf9c8('0x26')]={};this['queueBookedRR']={};ami['on'](_0xf9c8('0x27'),this[_0xf9c8('0x28')]['bind'](this));ami['on'](_0xf9c8('0x29'),this[_0xf9c8('0x2a')][_0xf9c8('0x2b')](this));ami['on'](_0xf9c8('0x2c'),this[_0xf9c8('0x2d')][_0xf9c8('0x2b')](this));ami['on']('agentcomplete',this[_0xf9c8('0x2e')][_0xf9c8('0x2b')](this));ami['on'](_0xf9c8('0x2f'),this[_0xf9c8('0x8')]['bind'](this));ami['on'](_0xf9c8('0x30'),this[_0xf9c8('0x31')][_0xf9c8('0x2b')](this));ami['on']('newexten',this[_0xf9c8('0x32')][_0xf9c8('0x2b')](this));ami['on'](_0xf9c8('0x33'),this[_0xf9c8('0x34')][_0xf9c8('0x2b')](this));ami['on'](_0xf9c8('0x35'),this[_0xf9c8('0x36')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xf9c8('0x37')][_0xf9c8('0x2b')](this));this['loopCampaigns']();this[_0xf9c8('0x38')]();}function isNotNull(_0x6d2039){return _0x6d2039!==null&&!_['isUndefined'](_0x6d2039);}function checkIsLoggedIn(_0x2eab0b,_0x556cb4){return function(){if(_0x556cb4<=0x0){_0x2eab0b[_0xf9c8('0x39')]=_0xf9c8('0x3a');throw _0x2eab0b[_0xf9c8('0x3b')]+_0xf9c8('0x3c');}};}function isActive(_0x5cebb6){return _0x5cebb6;}function checkIsActive(_0x12f5c1,_0x38f7ae){return function(){if(!isActive(_0x38f7ae)){_0x12f5c1[_0xf9c8('0x39')]=_0xf9c8('0x3d');throw _0x12f5c1[_0xf9c8('0x3b')]+_0xf9c8('0x3e');}};}function checkInterval(_0x4d4f38){return function(){if(!isNotNull(_0x4d4f38['Interval'])){_0x4d4f38[_0xf9c8('0x39')]=_0xf9c8('0x3f');throw _0x4d4f38[_0xf9c8('0x3b')]+_0xf9c8('0x40');}if(!isNotNull(_0x4d4f38[_0xf9c8('0x41')][_0xf9c8('0x42')])){_0x4d4f38['message']=_0xf9c8('0x3f');throw _0x4d4f38[_0xf9c8('0x3b')]+_0xf9c8('0x40');}if(!isNotNull(_['isEmpty'](_0x4d4f38[_0xf9c8('0x41')][_0xf9c8('0x42')]))){_0x4d4f38[_0xf9c8('0x39')]=_0xf9c8('0x3f');throw _0x4d4f38[_0xf9c8('0x3b')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x248f80,_0x485e87,_0x5e578f){return{'action':_0x248f80,'response':_0x485e87,'message':_0x5e578f,'stack':_0x5e578f};}function myreject(_0x2f0e89){return function(_0x19b17a){return _0x2f0e89(msgResponse(_0xf9c8('0x43'),_0xf9c8('0x44'),JSON[_0xf9c8('0x45')](_0x19b17a)));};}function getSeconds(_0x2d37b4,_0x116149){var _0x2c9654=moment(_0x2d37b4)[_0xf9c8('0x46')](0x0);var _0x479d21=moment(_0x116149)[_0xf9c8('0x46')](0x0);return _0x2c9654[_0xf9c8('0x47')](_0x479d21,_0xf9c8('0x48'));}function emit(_0x2ee2dd,_0x57d674,_0x3a1993){io['to'](_0x2ee2dd)[_0xf9c8('0x49')](_0x57d674,_0x3a1993);}function emitVoiceQueueSummary(_0x37c8c3){if(_0x37c8c3[_0xf9c8('0x4a')]===_0xf9c8('0x4b')){var _0x59f974={'id':_0x37c8c3['id'],'name':_0x37c8c3[_0xf9c8('0x3b')],'strategy':_0x37c8c3['strategy'],'answered':_0x37c8c3['answered'],'available':_0x37c8c3['available'],'loggedIn':_0x37c8c3[_0xf9c8('0x4c')],'pTalking':_0x37c8c3[_0xf9c8('0x4d')],'sumBillable':_0x37c8c3[_0xf9c8('0x4e')],'sumDuration':_0x37c8c3[_0xf9c8('0x4f')],'sumHoldTime':_0x37c8c3[_0xf9c8('0x50')]||0x0,'talking':_0x37c8c3[_0xf9c8('0x51')],'total':_0x37c8c3[_0xf9c8('0x52')],'type':_0x37c8c3['type'],'unmanaged':_0x37c8c3[_0xf9c8('0x53')],'abandoned':_0x37c8c3[_0xf9c8('0x54')],'waiting':_0x37c8c3[_0xf9c8('0x55')],'loggedInDb':_0x37c8c3[_0xf9c8('0x56')],'dialActive':_0x37c8c3['dialActive'],'dialMethod':_0x37c8c3[_0xf9c8('0x57')],'dialOriginateCallerIdName':_0x37c8c3['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x37c8c3[_0xf9c8('0x58')],'dialOriginateTimeout':_0x37c8c3[_0xf9c8('0x59')],'dialPrefix':_0x37c8c3[_0xf9c8('0x5a')],'outboundAnswerAgiCallsDay':_0x37c8c3[_0xf9c8('0x5b')],'outboundAnswerCallsDay':_0x37c8c3[_0xf9c8('0x5c')],'outboundBlacklistCallsDay':_0x37c8c3[_0xf9c8('0x5d')],'outboundBusyCallsDay':_0x37c8c3[_0xf9c8('0x5e')],'outboundCongestionCallsDay':_0x37c8c3[_0xf9c8('0x5f')],'outboundDropCallsDayACS':_0x37c8c3['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x37c8c3[_0xf9c8('0x60')],'outboundDropCallsDayTimeout':_0x37c8c3[_0xf9c8('0x61')],'outboundNoAnswerCallsDay':_0x37c8c3[_0xf9c8('0x62')],'outboundNoSuchCallsDay':_0x37c8c3[_0xf9c8('0x63')],'outboundOriginateFailureCallsDay':_0x37c8c3[_0xf9c8('0x64')],'outboundReCallsDay':_0x37c8c3['outboundReCallsDay'],'outboundRejectCallsDay':_0x37c8c3[_0xf9c8('0x65')],'outboundUnknownCallsDay':_0x37c8c3[_0xf9c8('0x66')],'predictiveIntervalAnsweredCalls':_0x37c8c3[_0xf9c8('0x67')],'predictiveIntervalAvgHoldtime':_0x37c8c3[_0xf9c8('0x68')],'predictiveIntervalAvgTalktime':_0x37c8c3[_0xf9c8('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x37c8c3[_0xf9c8('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x37c8c3[_0xf9c8('0x6b')],'predictiveIntervalErlangCalls':_0x37c8c3['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x37c8c3['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x37c8c3['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x37c8c3['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x37c8c3['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x37c8c3[_0xf9c8('0x6c')],'predictiveIntervalTotalCalls':_0x37c8c3[_0xf9c8('0x6d')],'message':_0x37c8c3[_0xf9c8('0x39')],'originated':_0x37c8c3[_0xf9c8('0x6e')],'erlangCalls':_0x37c8c3['erlangCalls'],'erlangCallToSecond':_0x37c8c3['erlangCallToSecond'],'erlangAbandonmentRate':_0x37c8c3['erlangAbandonmentRate'],'erlangBusyFactor':_0x37c8c3[_0xf9c8('0x6f')],'startPredictive':_0x37c8c3[_0xf9c8('0x25')],'startProgressive':_0x37c8c3['startProgressive']};if(_0x37c8c3[_0xf9c8('0x70')]){_0x59f974[_0xf9c8('0x70')]={'id':_0x37c8c3[_0xf9c8('0x70')]['id'],'name':_0x37c8c3['Trunk'][_0xf9c8('0x3b')],'active':_0x37c8c3[_0xf9c8('0x70')]['active'],'callerid':_0x37c8c3[_0xf9c8('0x70')]['callerid']};}if(_0x37c8c3['Interval']){_0x59f974['Interval']={'id':_0x37c8c3[_0xf9c8('0x41')]['id'],'name':_0x37c8c3[_0xf9c8('0x41')]['name']};}var _0x53dbee=md5(JSON[_0xf9c8('0x45')](_0x59f974));if(_0x37c8c3['md5']!==_0x53dbee){_0x37c8c3['md5']=_0x53dbee;emit(util[_0xf9c8('0x71')](_0xf9c8('0x72'),_0x59f974[_0xf9c8('0x3b')]),'voice_queue:save',_0x59f974);}}}function emitCampaignSummary(_0x339501){if(_0x339501[_0xf9c8('0x4a')]===_0xf9c8('0x73')){emit(util[_0xf9c8('0x71')]('campaign:ivr:%s',_0x339501[_0xf9c8('0x3b')]),_0xf9c8('0x74'),_0x339501);}}function checkGetDataPredictive(_0x13552a){if(isNotNull(_0x13552a)&&!_[_0xf9c8('0x75')](_0x13552a)){loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x77'));loggerPredictive[_0xf9c8('0x76')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13552a['predictiveIntervalTotalCalls']);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x78'),_0x13552a[_0xf9c8('0x67')]);loggerPredictive['info'](_0xf9c8('0x79'),_0x13552a[_0xf9c8('0x6b')]);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x7a'),_0x13552a[_0xf9c8('0x6a')]);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x7b'),_0x13552a[_0xf9c8('0x68')]);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x7c'),_0x13552a[_0xf9c8('0x69')]);loggerPredictive['info'](_0xf9c8('0x7d'));if(_0x13552a[_0xf9c8('0x6d')]>0x0){if(!_['isUndefined'](_0x13552a[_0xf9c8('0x69')])&&_0x13552a[_0xf9c8('0x69')]>0x0){return!![];}loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x7e'));if(!_[_0xf9c8('0x7f')](_0x13552a[_0xf9c8('0x68')])&&_0x13552a[_0xf9c8('0x68')]>0x0){return!![];}loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x80'));}else{loggerPredictive['info'](_0xf9c8('0x81'));}}else{loggerPredictive['info'](_0xf9c8('0x82'));}return![];}function mergeDataErlangB(_0x27a79b){return function(_0x44bf28){loggerPredictive['info'](_0xf9c8('0x83'));loggerPredictive['info'](_0xf9c8('0x84'),_0x44bf28['erlangCalls']);loggerPredictive[_0xf9c8('0x76')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44bf28[_0xf9c8('0x85')]);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x86'),_0x44bf28['erlangAbandonmentRate']);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x87'),_0x44bf28[_0xf9c8('0x6f')]);loggerPredictive[_0xf9c8('0x76')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44bf28[_0xf9c8('0x88')]);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x7d'));_[_0xf9c8('0x89')](_0x27a79b,_0x44bf28);};}function getDiff(_0x2a1f62){var _0x36a1f6=moment()['milliseconds'](0x0);var _0x4f4b7e=moment(_0x2a1f62)[_0xf9c8('0x46')](0x0);return _0x36a1f6[_0xf9c8('0x47')](_0x4f4b7e,_0xf9c8('0x48'));}function ifInterval(_0x3e266e,_0x54ac59){if(_[_0xf9c8('0x7f')](_0x54ac59)){return![];}return getDiff(_0x54ac59)<_0x3e266e*0x3c;}function freeVariablesPredictive(_0x1327f7){if(isNotNull(_0x1327f7)){if(!_[_0xf9c8('0x7f')](_0x1327f7[_0xf9c8('0x8a')])){_0x1327f7[_0xf9c8('0x8a')]=undefined;loggerPredictive[_0xf9c8('0x76')](_0x1327f7[_0xf9c8('0x3b')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xf9c8('0x7f')](_0x1327f7[_0xf9c8('0x25')])){_0x1327f7['startPredictive']=undefined;loggerPredictive['info'](_0x1327f7[_0xf9c8('0x3b')],_0xf9c8('0x8b'));}if(!_['isUndefined'](_0x1327f7[_0xf9c8('0x8c')])){clearInterval(_0x1327f7[_0xf9c8('0x8c')]);_0x1327f7[_0xf9c8('0x8c')]=undefined;loggerPredictive[_0xf9c8('0x76')](_0x1327f7[_0xf9c8('0x3b')],_0xf9c8('0x8d'));}}}function erlangb(_0x3c7f75,_0x541789){if(_0x541789===0x0){return 0x0;}var _0x244175=0x1;for(var _0x261247=0x1;_0x261247<=_0x541789;_0x261247+=0x1){_0x244175=0x1+_0x244175*_0x261247/_0x3c7f75;}return 0x1/_0x244175;}function isVoiceQueueOutbound(_0x69072){return _0x69072===_0xf9c8('0x4b');}function isNotPreview(_0x163194){return _0x163194!==_0xf9c8('0x1c');}function isCampaignIvr(_0x419ed6){return _0x419ed6===_0xf9c8('0x73');}function getCallerId(_0x2787ec,_0x15aa9c,_0x271313){if(!_[_0xf9c8('0x7f')](_0x271313)&&typeof _0x271313===_0xf9c8('0x8e')&&!_[_0xf9c8('0x75')](_0x271313)){if(!_[_0xf9c8('0x7f')](_0x15aa9c)&&typeof _0x15aa9c==='string'&&!_[_0xf9c8('0x75')](_0x15aa9c)){return util[_0xf9c8('0x71')]('\x22%s\x22\x20<%s>',_0x15aa9c,_0x271313);}return util['format'](_0xf9c8('0x8f'),_0x271313,_0x271313);}if(!_[_0xf9c8('0x7f')](_0x2787ec)&&typeof _0x2787ec===_0xf9c8('0x8e')&&!_['isEmpty'](_0x2787ec)){return _0x2787ec;}return _0xf9c8('0x90');}function loggerCatchQueueSummary(_0x2dcff8,_0x4dca87){return function(_0x2892ba){freeVariablesPredictive(_0x4dca87);emitVoiceQueueSummary(_0x4dca87);emitCampaignSummary(_0x4dca87);loggerSyncQueueSummary[_0xf9c8('0x91')](_0x2dcff8,util[_0xf9c8('0x92')](_0x2892ba,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x52593a,_0x10f577){return function(_0x3797ad){loggerPredictive['error'](_0x10f577[_0xf9c8('0x3b')],_0x52593a);loggerPredictive[_0xf9c8('0x91')](_0x3797ad[_0xf9c8('0x93')]);freeVariablesPredictive(_0x10f577);};}function loggerCatch(_0x18984e){return function(_0x4d773a){logger[_0xf9c8('0x91')](_0x18984e,util[_0xf9c8('0x92')](_0x4d773a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1dc468){return _0x1dc468&&!_['isUndefined'](_0x1dc468)&&_0x1dc468[_0xf9c8('0x94')]>0x0;}function decremetOriginate(_0x1ddaad){if(!_[_0xf9c8('0x7f')](_0x1ddaad)&&_0x1ddaad!==null){if(typeof _0x1ddaad[_0xf9c8('0x6e')]!==_0xf9c8('0x95')){if(_0x1ddaad[_0xf9c8('0x6e')]>0x0){_0x1ddaad['originated']-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf9c8('0x91')](_0xf9c8('0x96'));}}function checkContactLowerLimitOriginate(_0x21e32a,_0x1a0175,_0x2e0336){if(_0x1a0175>_0x2e0336){for(var _0x461b4b=0x0;_0x461b4b<_0x1a0175-_0x2e0336;_0x461b4b+=0x1){decremetOriginate(_0x21e32a);}}}function loggerGetContactDialer(_0x47d61c,_0x2d84ef,_0x14aace){return function(_0x4c192a){checkContactLowerLimitOriginate(_0x2d84ef,_0x14aace,0x0);logger[_0xf9c8('0x91')](_0x47d61c,util['inspect'](_0x4c192a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x123737){return function(_0x184f0f){if(isNotNull(_0x184f0f)&&isNotNull(_0x184f0f[0x0])){if(_0x184f0f[0x0][_0xf9c8('0x97')]>0x0){_0x123737[_0xf9c8('0x39')]=_0xf9c8('0x98');logger[_0xf9c8('0x76')]('[getContactDialer2][ReScheduled]'+_0x123737[_0xf9c8('0x3b')],_0x184f0f[0x0][_0xf9c8('0x97')],'contacts');}else{_0x123737[_0xf9c8('0x39')]=_0xf9c8('0x99');logger['info'](_0xf9c8('0x9a')+_0x123737['name']);}}};}function notSendMessagesQueue(_0x5dfb39){if(_0x5dfb39['sendMessageOneNotActive']){freeVariablesPredictive(_0x5dfb39);if(_0x5dfb39[_0xf9c8('0x6e')]===0x0&&_0x5dfb39[_0xf9c8('0x51')]===0x0&&_0x5dfb39[_0xf9c8('0x55')]===0x0&&(_0x5dfb39[_0xf9c8('0x4d')]||0x0)===0x0){_0x5dfb39[_0xf9c8('0x9b')]=![];_0x5dfb39[_0xf9c8('0x9c')]=0x0;_0x5dfb39[_0xf9c8('0x39')]=_0xf9c8('0x3d');loggerSyncQueueSummary[_0xf9c8('0x91')](_0xf9c8('0x9d'),_0x5dfb39[_0xf9c8('0x3b')],_0xf9c8('0x9e'));}else{_0x5dfb39[_0xf9c8('0x39')]=_0xf9c8('0x9f');loggerSyncQueueSummary[_0xf9c8('0x91')](_0xf9c8('0x9d'),_0x5dfb39[_0xf9c8('0x3b')],_0xf9c8('0xa0'));}emitVoiceQueueSummary(_0x5dfb39);}}function notSendMessagesCampaign(_0x58f809){if(_0x58f809[_0xf9c8('0x9b')]){if(_0x58f809[_0xf9c8('0x6e')]===0x0){_0x58f809[_0xf9c8('0x9b')]=![];_0x58f809[_0xf9c8('0x39')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xf9c8('0x91')](_0xf9c8('0xa1'),_0x58f809[_0xf9c8('0x3b')],'is\x20not\x20active');}else{_0x58f809[_0xf9c8('0x39')]=_0xf9c8('0x9f');loggerSyncQueueSummary['error'](_0xf9c8('0xa1'),_0x58f809[_0xf9c8('0x3b')],'is\x20disactive');}emitCampaignSummary(_0x58f809);}}function createObjHistory(_0x5e8658,_0x3779cf,_0x2089a2,_0x45b1b0,_0x3c90b8){_0x5e8658[_0xf9c8('0x39')]=_0x2089a2;var _0x52ace4=new Action(_0x5e8658,_0x3779cf);var _0x2d03e7=new History(_0x52ace4);_0x2d03e7[_0xf9c8('0xa2')]=_0x45b1b0;_0x2d03e7['statedesc']=_0x3c90b8;_0x2d03e7[_0xf9c8('0xa3')]=_0x52ace4['starttime'];return _0x2d03e7;}Dialer['prototype'][_0xf9c8('0x38')]=function(){var _0x34c62f=this;setInterval(function(){_0x34c62f[_0xf9c8('0xa4')](_0x34c62f[_0xf9c8('0x23')],_0xf9c8('0xa5'));_0x34c62f[_0xf9c8('0xa4')](_0x34c62f[_0xf9c8('0x22')],'[actions]');},0x32c8);};Dialer[_0xf9c8('0x18')]['clearZombieChannels']=function(_0x17cdf8,_0x5cf501){var _0x67cf76=this;for(var _0xe1de03 in _0x17cdf8){if(typeof _0x17cdf8[_0xe1de03]!=='undefined'){this[_0xf9c8('0x1b')][_0xf9c8('0xa6')](function(){if(!_[_0xf9c8('0xa7')](_0x17cdf8[_0xe1de03])){return ami[_0xf9c8('0xa8')]({'action':_0xf9c8('0xa9'),'channel':_0x17cdf8[_0xe1de03]['channel']})[_0xf9c8('0xaa')](function(_0x513f51){if(_0x513f51[_0xf9c8('0x39')]===_0xf9c8('0xab')){setTimeout(function(){if(_0x17cdf8[_0xe1de03]&&_0x17cdf8[_0xe1de03]['type']!==_0xf9c8('0x73')){_0x67cf76[_0xf9c8('0xac')](_0x67cf76[_0xf9c8('0x1d')][_0x17cdf8[_0xe1de03][_0xf9c8('0xad')]]);logger['error'](_0xf9c8('0xae'),_0x5cf501,_0xe1de03,_0x17cdf8[_0xe1de03][_0xf9c8('0xad')]);delete _0x17cdf8[_0xe1de03];}if(_0x17cdf8[_0xe1de03]&&_0x17cdf8[_0xe1de03]['type']===_0xf9c8('0x73')){_0x67cf76[_0xf9c8('0xac')](_0x67cf76[_0xf9c8('0x1e')][_0x17cdf8[_0xe1de03][_0xf9c8('0xad')]]);logger[_0xf9c8('0x91')](_0xf9c8('0xaf'),_0x5cf501,_0xe1de03,_0x17cdf8[_0xe1de03][_0xf9c8('0xad')]);delete _0x17cdf8[_0xe1de03];}},0x2328);}});}});}}};Dialer[_0xf9c8('0x18')][_0xf9c8('0xb0')]=function(_0x232fb5){return BPromise[_0xf9c8('0xb1')]()['then'](cmHopper['countReScheduled'](_0x232fb5))[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xb2')));};Dialer['prototype'][_0xf9c8('0xb3')]=function(_0x58ffc7){return BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](cmHopperBlack[_0xf9c8('0xb3')](_0x58ffc7))[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xb5')));};Dialer['prototype'][_0xf9c8('0xb6')]=function(_0x43382b){return BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](cmHopperBlack[_0xf9c8('0xb6')](_0x43382b))[_0xf9c8('0xaa')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xf9c8('0x18')][_0xf9c8('0xb7')]=function(_0x48015f){return BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](cmHopperHistory[_0xf9c8('0xb8')](_0x48015f))[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xb9')));};Dialer[_0xf9c8('0x18')][_0xf9c8('0xba')]=function(_0x5d950f){return BPromise[_0xf9c8('0xb1')]()['then'](cmHopper[_0xf9c8('0xba')](_0x5d950f))[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xbb')));};Dialer['prototype'][_0xf9c8('0xbc')]=function(_0x411984,_0x281c92,_0x167df8){return BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](cmHopper['unlockContact'](_0x411984,_0x281c92,_0x167df8))[_0xf9c8('0xaa')](loggerCatch('[unlockContact]\x20'));};Dialer['prototype'][_0xf9c8('0xbd')]=function(_0x2dd5df,_0x43e0fe,_0x226201,_0x23f819,_0x2f2797){return BPromise['resolve']()[_0xf9c8('0xb4')](cmHopper[_0xf9c8('0xbd')](_0x2dd5df,_0x43e0fe,_0x226201,_0x23f819))[_0xf9c8('0xaa')](function(_0x577680){_0x2f2797[_0xf9c8('0xbe')]-=_0x226201;_0x2f2797[_0xf9c8('0xbe')]=_0x2f2797[_0xf9c8('0xbe')]>0x0?_0x2f2797[_0xf9c8('0xbe')]:0x0;loggerCatch(_0xf9c8('0xbf'))(_0x577680);});};Dialer[_0xf9c8('0x18')][_0xf9c8('0xc0')]=function(_0x4a144b,_0x72ec14,_0x4da04c,_0x567065){return BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](cmHopper[_0xf9c8('0xc0')](_0x4a144b,_0x72ec14,_0x4da04c))['catch'](function(_0x108f3d){_0x567065[_0xf9c8('0xbe')]-=_0x72ec14;_0x567065[_0xf9c8('0xbe')]=_0x567065[_0xf9c8('0xbe')]>0x0?_0x567065[_0xf9c8('0xbe')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x108f3d);});};Dialer[_0xf9c8('0x18')][_0xf9c8('0xc1')]=function(_0x2e1a6a){return BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](voiceQueueRt[_0xf9c8('0xc1')](_0x2e1a6a))['catch'](loggerCatch(_0xf9c8('0xc2')));};Dialer[_0xf9c8('0x18')][_0xf9c8('0xc3')]=function(_0x4b589f){return BPromise[_0xf9c8('0xb1')]()['then'](cmHopper[_0xf9c8('0xc3')](_0x4b589f))[_0xf9c8('0xaa')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xf9c8('0xc4')]=function(_0x29d4c7){return BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](cmHopperHistory[_0xf9c8('0xc4')](_0x29d4c7))[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xc5')));};Dialer[_0xf9c8('0x18')][_0xf9c8('0xac')]=function(_0x24cfe3){if(!_[_0xf9c8('0x7f')](_0x24cfe3)&&_0x24cfe3!==null){if(typeof _0x24cfe3[_0xf9c8('0x6e')]!==_0xf9c8('0x95')){if(_0x24cfe3[_0xf9c8('0x6e')]>0x0){_0x24cfe3[_0xf9c8('0x6e')]-=0x1;}else{logger[_0xf9c8('0x91')](_0xf9c8('0xc6'));}}}else{logger[_0xf9c8('0x91')](_0xf9c8('0xc7'));}};Dialer[_0xf9c8('0x18')][_0xf9c8('0xc8')]=function(_0x15fb65,_0x492990){var _0x1e90a1=this;return function(_0x10ba23){_0x1e90a1[_0xf9c8('0xac')](_0x492990);logger[_0xf9c8('0x91')](_0x15fb65,util[_0xf9c8('0x92')](_0x10ba23,{'showHidden':![],'depth':null}));};};Dialer[_0xf9c8('0x18')][_0xf9c8('0xc9')]=function(_0x168305,_0x36ce85,_0x569796){var _0x29678a={'state':0x19,'statedesc':_0xf9c8('0xca')};this[_0xf9c8('0xac')](_0x36ce85);this[_0xf9c8('0xcb')](_[_0xf9c8('0x89')](_0x29678a,_[_0xf9c8('0xcc')](_0x569796,[_0xf9c8('0xcd'),_0xf9c8('0xce'),_0xf9c8('0xcf'),_0xf9c8('0xd0'),_0xf9c8('0xd1')])),_0xf9c8('0xd2'),_0xf9c8('0xd3'));logger[_0xf9c8('0x91')](_0x168305);};Dialer[_0xf9c8('0x18')][_0xf9c8('0xd4')]=function(_0x32d860){return _0x32d860===_0xf9c8('0xd5');};Dialer[_0xf9c8('0x18')][_0xf9c8('0xd6')]=function(_0x444e18){return!_[_0xf9c8('0x7f')](_0x444e18)&&_0x444e18&&!_[_0xf9c8('0x7f')](_0x444e18[_0xf9c8('0x3b')])&&!_[_0xf9c8('0x7f')](_0x444e18['active'])&&_0x444e18[_0xf9c8('0xd7')]&&(this[_0xf9c8('0x20')][util[_0xf9c8('0x71')]('SIP/%s',_0x444e18['name'])][_0xf9c8('0xa9')]==='reachable'||this[_0xf9c8('0x20')][util[_0xf9c8('0x71')](_0xf9c8('0xd8'),_0x444e18['name'])][_0xf9c8('0xa9')]===_0xf9c8('0xd9'));};Dialer[_0xf9c8('0x18')][_0xf9c8('0xcb')]=function(_0x147eec,_0x3440b3,_0x267cd1){this['createHistory'](_0x147eec)['catch'](loggerCatch(_0x3440b3));this['moveContactManagedDialer'](_0x147eec)[_0xf9c8('0xaa')](loggerCatch(_0x267cd1));};Dialer[_0xf9c8('0x18')][_0xf9c8('0x34')]=function(_0x5180e4){var _0x46f6f6=this[_0xf9c8('0x23')][_0x5180e4[_0xf9c8('0xda')]];var _0x37ac98;if(!_[_0xf9c8('0xa7')](_0x5180e4)&&!_[_0xf9c8('0xa7')](_0x5180e4[_0xf9c8('0xdb')])&&!_[_0xf9c8('0xa7')](_0x5180e4[_0xf9c8('0xdb')][_0xf9c8('0xdc')])&&_0x5180e4[_0xf9c8('0xdd')]==='xcally-motion-dialer'&&_0x46f6f6){if(_0x46f6f6[_0xf9c8('0x4a')]!==_0xf9c8('0x73')&&this[_0xf9c8('0x1d')][_0x46f6f6[_0xf9c8('0xad')]][_0xf9c8('0xde')]&&_0x5180e4[_0xf9c8('0xdf')]===_0xf9c8('0xe0')){delete this[_0xf9c8('0x23')][_0x5180e4[_0xf9c8('0xda')]];this['updateOriginated'](this['voiceQueues'][_0x46f6f6[_0xf9c8('0xad')]]);this[_0xf9c8('0x1d')][_0x46f6f6['queue']][_0xf9c8('0x5c')]+=0x1;this['voiceQueues'][_0x46f6f6[_0xf9c8('0xad')]][_0xf9c8('0x5b')]+=0x1;_0x37ac98=new Hangup(_0x46f6f6,_0x5180e4);_0x37ac98[_0xf9c8('0xa2')]=0x12;_0x37ac98[_0xf9c8('0xe1')]=_0xf9c8('0xe2');_0x37ac98[_0xf9c8('0xe3')]='AMD';ami[_0xf9c8('0x49')]('custom:amd',ut[_0xf9c8('0xe4')](_0x37ac98,_0xf9c8('0xe5')));this[_0xf9c8('0xcb')](_0x37ac98,'[syncHangupInAMD][createHistory]',_0xf9c8('0xe6'));}if(_0x46f6f6[_0xf9c8('0x4a')]!==_0xf9c8('0x73')&&this[_0xf9c8('0x1d')][_0x46f6f6[_0xf9c8('0xad')]][_0xf9c8('0xde')]&&_0x5180e4[_0xf9c8('0xdf')]===_0xf9c8('0xe7')){var _0x5e84eb=this;return new BPromise(function(_0x2404bf,_0x35a73e){delete _0x5e84eb[_0xf9c8('0x23')][_0x5180e4[_0xf9c8('0xda')]];_0x5e84eb[_0xf9c8('0xac')](_0x5e84eb[_0xf9c8('0x1d')][_0x46f6f6[_0xf9c8('0xad')]]);_0x5e84eb[_0xf9c8('0x1d')][_0x46f6f6['queue']][_0xf9c8('0x5c')]+=0x1;_0x5e84eb[_0xf9c8('0x1d')][_0x46f6f6[_0xf9c8('0xad')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1c2f26=_0x5e84eb['voiceQueues'][_0x46f6f6[_0xf9c8('0xad')]];var _0x4e00a1=new Hangup(_0x46f6f6,_0x5180e4);_0x4e00a1[_0xf9c8('0xa2')]=0x13;_0x4e00a1[_0xf9c8('0xe1')]='Machine';_0x4e00a1['membername']=_0xf9c8('0xe8');_0x4e00a1['countmachineretry']+=0x1;_0x4e00a1['countglobal']+=0x1;_0x4e00a1[_0xf9c8('0xe5')]=!![];ami['emit']('custom:amd',ut['buildObj'](_0x4e00a1,'amd'));_0x5e84eb[_0xf9c8('0xc4')](_0x4e00a1)[_0xf9c8('0xaa')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4e00a1[_0xf9c8('0xe9')]+_0x4e00a1[_0xf9c8('0xea')]+_0x4e00a1[_0xf9c8('0xeb')]+_0x4e00a1[_0xf9c8('0xec')]+_0x4e00a1[_0xf9c8('0xed')]+_0x4e00a1[_0xf9c8('0xee')]+_0x4e00a1[_0xf9c8('0xef')]+_0x4e00a1[_0xf9c8('0xf0')]>=_0x1c2f26[_0xf9c8('0xf1')]){_0x5e84eb[_0xf9c8('0xf2')](_0x4e00a1,_0x2404bf,_0x35a73e,_0xf9c8('0xf3'));}else{if(_0x4e00a1[_0xf9c8('0xef')]>=_0x1c2f26[_0xf9c8('0xf4')]){_0x5e84eb['createStateFinal'](_0x4e00a1,_0x2404bf,_0x35a73e,'reason\x2019\x20machine....');}else{_0x5e84eb[_0xf9c8('0xba')]({'active':![],'countmachineretry':_0x4e00a1[_0xf9c8('0xef')],'scheduledat':moment()[_0xf9c8('0xf5')](_0x1c2f26['dialMachineRetryFrequency'],'minutes')[_0xf9c8('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e00a1[_0xf9c8('0xcd')],'ListId':_0x4e00a1[_0xf9c8('0xce')],'VoiceQueueId':_0x4e00a1[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x4e00a1[_0xf9c8('0xd1')]||undefined})['catch'](loggerCatch(_0xf9c8('0xf6')));_0x2404bf({'reschedule':0x1});}}});}if(_0x46f6f6['type']===_0xf9c8('0x73')&&this['campaigns'][_0x46f6f6[_0xf9c8('0xad')]][_0xf9c8('0xde')]&&_0x5180e4[_0xf9c8('0xdf')]==='HANGUP'){delete this['uniqueId'][_0x5180e4[_0xf9c8('0xda')]];this[_0xf9c8('0xac')](this[_0xf9c8('0x1e')][_0x46f6f6[_0xf9c8('0xad')]]);_0x37ac98=new Hangup(_0x46f6f6,_0x5180e4);_0x37ac98[_0xf9c8('0xa2')]=0x12;_0x37ac98[_0xf9c8('0xe1')]=_0xf9c8('0xe2');_0x37ac98[_0xf9c8('0xe3')]='AMD';ami['emit'](_0xf9c8('0xf7'),ut[_0xf9c8('0xe4')](_0x37ac98,_0xf9c8('0xe5')));this[_0xf9c8('0xcb')](_0x37ac98,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x46f6f6[_0xf9c8('0x4a')]===_0xf9c8('0x73')&&this[_0xf9c8('0x1e')][_0x46f6f6[_0xf9c8('0xad')]][_0xf9c8('0xde')]&&_0x5180e4[_0xf9c8('0xdf')]===_0xf9c8('0xe7')){var _0x5e84eb=this;return new BPromise(function(_0x204265,_0x5f069e){delete _0x5e84eb['uniqueId'][_0x5180e4[_0xf9c8('0xda')]];_0x5e84eb[_0xf9c8('0xac')](_0x5e84eb[_0xf9c8('0x1e')][_0x46f6f6[_0xf9c8('0xad')]]);_0x5e84eb[_0xf9c8('0x1e')][_0x46f6f6[_0xf9c8('0xad')]]['outboundAnswerCallsDay']+=0x1;_0x5e84eb[_0xf9c8('0x1e')][_0x46f6f6[_0xf9c8('0xad')]][_0xf9c8('0x5b')]+=0x1;var _0x237058=_0x5e84eb['campaigns'][_0x46f6f6[_0xf9c8('0xad')]];var _0x3f4f9a=new Hangup(_0x46f6f6,_0x5180e4);_0x3f4f9a[_0xf9c8('0xa2')]=0x13;_0x3f4f9a[_0xf9c8('0xe1')]=_0xf9c8('0xf8');_0x3f4f9a[_0xf9c8('0xe3')]=_0xf9c8('0xe8');_0x3f4f9a['countmachineretry']+=0x1;_0x3f4f9a[_0xf9c8('0xf9')]+=0x1;_0x3f4f9a[_0xf9c8('0xe5')]=!![];ami[_0xf9c8('0x49')]('custom:amd',ut[_0xf9c8('0xe4')](_0x3f4f9a,_0xf9c8('0xe5')));_0x5e84eb[_0xf9c8('0xc4')](_0x3f4f9a)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xfa')));if(_0x3f4f9a[_0xf9c8('0xe9')]+_0x3f4f9a[_0xf9c8('0xea')]+_0x3f4f9a[_0xf9c8('0xeb')]+_0x3f4f9a['countnosuchnumberretry']+_0x3f4f9a[_0xf9c8('0xed')]+_0x3f4f9a[_0xf9c8('0xee')]+_0x3f4f9a[_0xf9c8('0xef')]+_0x3f4f9a[_0xf9c8('0xf0')]>=_0x237058[_0xf9c8('0xf1')]){_0x5e84eb[_0xf9c8('0xf2')](_0x3f4f9a,_0x204265,_0x5f069e,_0xf9c8('0xf3'));}else{if(_0x3f4f9a['countmachineretry']>=_0x237058[_0xf9c8('0xf4')]){_0x5e84eb['createStateFinal'](_0x3f4f9a,_0x204265,_0x5f069e,_0xf9c8('0xfb'));}else{_0x5e84eb[_0xf9c8('0xba')]({'active':![],'countmachineretry':_0x3f4f9a[_0xf9c8('0xef')],'scheduledat':moment()['add'](_0x237058[_0xf9c8('0xfc')],_0xf9c8('0xfd'))[_0xf9c8('0x71')](_0xf9c8('0xfe')),'ContactId':_0x3f4f9a[_0xf9c8('0xcd')],'ListId':_0x3f4f9a[_0xf9c8('0xce')],'VoiceQueueId':_0x3f4f9a[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x3f4f9a[_0xf9c8('0xd1')]||undefined})['catch'](loggerCatch(_0xf9c8('0xf6')));_0x204265({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xf9c8('0x31')]=function(_0x42ceed){var _0x412d4d=this[_0xf9c8('0x23')][_0x42ceed['uniqueid']];var _0x5aebc2=this;var _0x27ed3d;if(_0x412d4d&&_0x412d4d['type']===_0xf9c8('0x73')){delete this[_0xf9c8('0x23')][_0x42ceed[_0xf9c8('0xda')]];this['updateOriginated'](this[_0xf9c8('0x1e')][_0x412d4d[_0xf9c8('0xad')]]);this[_0xf9c8('0x1e')][_0x412d4d[_0xf9c8('0xad')]][_0xf9c8('0xff')]+=0x1;_0x27ed3d=new Hangup(_0x412d4d,_0x42ceed);this[_0xf9c8('0xc4')](_0x27ed3d)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x27ed3d)[_0xf9c8('0xaa')](loggerCatch('[syncHangupIvr]'));}if(_0x412d4d&&_0x412d4d['type']!==_0xf9c8('0x73')&&isNotNull(this[_0xf9c8('0x1d')][_0x412d4d[_0xf9c8('0xad')]][_0xf9c8('0x100')])){delete this[_0xf9c8('0x23')][_0x42ceed[_0xf9c8('0xda')]];this[_0xf9c8('0xac')](this['voiceQueues'][_0x412d4d[_0xf9c8('0xad')]]);this[_0xf9c8('0x1d')][_0x412d4d['queue']][_0xf9c8('0x5c')]+=0x1;this[_0xf9c8('0x1d')][_0x412d4d[_0xf9c8('0xad')]][_0xf9c8('0x5b')]+=0x1;_0x27ed3d=new Hangup(_0x412d4d,_0x42ceed);_0x27ed3d['state']=0x10;_0x27ed3d['statedesc']=_0xf9c8('0x101');_0x27ed3d[_0xf9c8('0xe3')]=_0xf9c8('0x102');this[_0xf9c8('0xc4')](_0x27ed3d)[_0xf9c8('0xaa')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf9c8('0xc3')](_0x27ed3d)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x103')));}if(_0x412d4d&&_0x412d4d[_0xf9c8('0x4a')]!==_0xf9c8('0x73')&&!isNotNull(this[_0xf9c8('0x1d')][_0x412d4d[_0xf9c8('0xad')]][_0xf9c8('0x100')])){delete this['uniqueId'][_0x42ceed['uniqueid']];this[_0xf9c8('0xac')](this[_0xf9c8('0x1d')][_0x412d4d[_0xf9c8('0xad')]]);this['voiceQueues'][_0x412d4d[_0xf9c8('0xad')]][_0xf9c8('0x66')]+=0x1;_0x27ed3d=new Hangup(_0x412d4d,_0x42ceed);_0x27ed3d[_0xf9c8('0xa2')]=0xc;_0x27ed3d['statedesc']=_0x42ceed[_0xf9c8('0x104')];_0x27ed3d[_0xf9c8('0xe3')]='Unknow';this[_0xf9c8('0xc4')](_0x27ed3d)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf9c8('0xc3')](_0x27ed3d)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xf9c8('0x18')]['syncAgentComplete']=function(_0x4dc652){var _0x2bcc25=this['uniqueId'][_0x4dc652[_0xf9c8('0xda')]];var _0x48ab7f=this;if(this['voiceQueues'][_0x4dc652[_0xf9c8('0xad')]]){if(_0x2bcc25&&_0x2bcc25['type']!==_0xf9c8('0x73')){delete this[_0xf9c8('0x23')][_0x4dc652[_0xf9c8('0xda')]];this[_0xf9c8('0x1d')][_0x4dc652[_0xf9c8('0xad')]][_0xf9c8('0x5c')]+=0x1;var _0x3b36dd=new AgentComplete(_0x2bcc25,_0x4dc652);if(_0x4dc652[_0xf9c8('0x105')]===_0xf9c8('0x106')){_0x3b36dd[_0xf9c8('0x107')]=this[_0xf9c8('0x1d')][_0x4dc652['queue']][_0xf9c8('0x108')]&&this[_0xf9c8('0x1d')][_0x4dc652[_0xf9c8('0xad')]][_0xf9c8('0x109')]?moment()[_0xf9c8('0x71')](_0xf9c8('0xfe')):undefined;}this[_0xf9c8('0xc4')](_0x3b36dd)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x10a')));this[_0xf9c8('0xc3')](_0x3b36dd)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x10b')));}}};Dialer[_0xf9c8('0x18')][_0xf9c8('0x28')]=function(_0x55c2b5){if(this['voiceQueues'][_0x55c2b5[_0xf9c8('0xad')]]){if(this[_0xf9c8('0x23')][_0x55c2b5[_0xf9c8('0xda')]]&&this['uniqueId'][_0x55c2b5[_0xf9c8('0xda')]][_0xf9c8('0x4a')]!=='ivr'){this[_0xf9c8('0xac')](this[_0xf9c8('0x1d')][_0x55c2b5[_0xf9c8('0xad')]]);this[_0xf9c8('0x23')][_0x55c2b5['uniqueid']]['answertime']=moment()[_0xf9c8('0x71')](_0xf9c8('0xfe'));}}};Dialer[_0xf9c8('0x18')][_0xf9c8('0x10c')]=function(_0x3cfecd){this[_0xf9c8('0xc4')](_0x3cfecd)[_0xf9c8('0xaa')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xf9c8('0xc3')](_0x3cfecd)['catch'](loggerCatch(_0xf9c8('0x10d')));};Dialer[_0xf9c8('0x18')]['syncQueueCallerAbandon']=function(_0x1f0a1e){var _0x20f8e8=this['uniqueId'][_0x1f0a1e[_0xf9c8('0xda')]];var _0x2762b4=this;if(this[_0xf9c8('0x1d')][_0x1f0a1e[_0xf9c8('0xad')]]){if(_0x20f8e8&&_0x20f8e8[_0xf9c8('0x4a')]!==_0xf9c8('0x73')){delete this[_0xf9c8('0x23')][_0x1f0a1e[_0xf9c8('0xda')]];this['updateOriginated'](this['voiceQueues'][_0x1f0a1e[_0xf9c8('0xad')]]);_0x20f8e8['droptime']=moment()[_0xf9c8('0x71')](_0xf9c8('0xfe'));var _0x587d12=new QueueCallerAbandon(_0x20f8e8,_0x1f0a1e);if(getSeconds(_0x20f8e8[_0xf9c8('0x10e')],_0x20f8e8[_0xf9c8('0x10f')])>=_0x20f8e8['dialQueueTimeout']){this['voiceQueues'][_0x1f0a1e[_0xf9c8('0xad')]][_0xf9c8('0x6b')]+=0x1;this[_0xf9c8('0x1d')][_0x1f0a1e[_0xf9c8('0xad')]][_0xf9c8('0x61')]+=0x1;this[_0xf9c8('0x1d')][_0x1f0a1e[_0xf9c8('0xad')]][_0xf9c8('0x110')]+=0x1;_0x587d12['state']=0xa;_0x587d12[_0xf9c8('0xe1')]=_0xf9c8('0x111');_0x587d12[_0xf9c8('0x112')]=_0xf9c8('0x113');_0x587d12[_0xf9c8('0x107')]=this[_0xf9c8('0x1d')][_0x1f0a1e[_0xf9c8('0xad')]]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x587d12[_0xf9c8('0xed')]+=0x1;_0x587d12[_0xf9c8('0xf9')]+=0x1;if(_0x587d12[_0xf9c8('0xed')]>=this[_0xf9c8('0x1d')][_0x1f0a1e[_0xf9c8('0xad')]][_0xf9c8('0x114')]){this[_0xf9c8('0x10c')](_0x587d12);}else{this[_0xf9c8('0xba')]({'active':![],'countdropretry':_0x587d12[_0xf9c8('0xed')],'scheduledat':moment()['add'](this['voiceQueues'][_0x1f0a1e[_0xf9c8('0xad')]][_0xf9c8('0x115')],_0xf9c8('0xfd'))[_0xf9c8('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20f8e8['ContactId'],'ListId':_0x20f8e8[_0xf9c8('0xce')],'VoiceQueueId':_0x20f8e8[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x20f8e8[_0xf9c8('0xd1')]||undefined})['catch'](loggerCatch(_0xf9c8('0x116')));var _0x51fc47=new History(_0x587d12);_0x51fc47[_0xf9c8('0xa2')]=0xa;_0x51fc47['statedesc']='Drop';_0x51fc47[_0xf9c8('0x117')]=moment()[_0xf9c8('0x71')]('YYYY-MM-DD\x20HH:mm:ss');_0x51fc47['endtime']=_0x51fc47[_0xf9c8('0x117')];_0x51fc47[_0xf9c8('0x118')]=_0x587d12[_0xf9c8('0x118')];_0x51fc47[_0xf9c8('0x119')]=_0x587d12[_0xf9c8('0x119')];this['createHistory'](_0x51fc47)['catch'](loggerCatch(_0xf9c8('0x11a')));}}else{this[_0xf9c8('0x1d')][_0x1f0a1e[_0xf9c8('0xad')]][_0xf9c8('0x6a')]+=0x1;this[_0xf9c8('0x1d')][_0x1f0a1e[_0xf9c8('0xad')]][_0xf9c8('0x60')]+=0x1;_0x587d12[_0xf9c8('0xa2')]=0xb;_0x587d12[_0xf9c8('0xe1')]=_0xf9c8('0x11b');_0x587d12[_0xf9c8('0x112')]='CALLEREXIT';_0x587d12[_0xf9c8('0xee')]+=0x1;_0x587d12[_0xf9c8('0xf9')]+=0x1;if(_0x587d12[_0xf9c8('0xee')]>=this['voiceQueues'][_0x1f0a1e['queue']]['dialAbandonedMaxRetry']){this[_0xf9c8('0x10c')](_0x587d12);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x587d12[_0xf9c8('0xee')],'scheduledat':moment()[_0xf9c8('0xf5')](this['voiceQueues'][_0x1f0a1e['queue']][_0xf9c8('0x11c')],_0xf9c8('0xfd'))[_0xf9c8('0x71')](_0xf9c8('0xfe')),'ContactId':_0x20f8e8[_0xf9c8('0xcd')],'ListId':_0x20f8e8[_0xf9c8('0xce')],'VoiceQueueId':_0x20f8e8[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x20f8e8[_0xf9c8('0xd1')]||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x11d')));var _0x51fc47=new History(_0x587d12);_0x51fc47[_0xf9c8('0xa2')]=0xb;_0x51fc47[_0xf9c8('0xe1')]=_0xf9c8('0x11b');_0x51fc47[_0xf9c8('0x117')]=moment()[_0xf9c8('0x71')](_0xf9c8('0xfe'));_0x51fc47[_0xf9c8('0xa3')]=_0x51fc47['starttime'];_0x51fc47['calleridname']=_0x587d12['calleridname'];_0x51fc47[_0xf9c8('0x119')]=_0x587d12['calleridnum'];this[_0xf9c8('0xc4')](_0x51fc47)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x11e')));}}}}};Dialer[_0xf9c8('0x18')][_0xf9c8('0x32')]=function(_0x135c82){if(this['actions'][_0x135c82[_0xf9c8('0xda')]]){this['actions'][_0x135c82[_0xf9c8('0xda')]]['channel']=_0x135c82['channel'];}if(this[_0xf9c8('0x23')][_0x135c82[_0xf9c8('0xda')]]){this['uniqueId'][_0x135c82[_0xf9c8('0xda')]]['channel']=_0x135c82['channel'];}};Dialer[_0xf9c8('0x18')]['syncQueueMember']=function(_0x380e00){if(strategy[this[_0xf9c8('0x1d')][this[_0xf9c8('0x22')][_0x380e00[_0xf9c8('0x11f')]][_0xf9c8('0xad')]][_0xf9c8('0x120')]]==='roundrobin'){if(this[_0xf9c8('0x22')][_0x380e00[_0xf9c8('0x11f')]]&&_['isNil'](this[_0xf9c8('0x22')][_0x380e00['actionid']]['locked'])&&_0x380e00[_0xf9c8('0xa9')]==='1'&&_0x380e00['paused']==='0'){if(this[_0xf9c8('0x1f')][_0x380e00[_0xf9c8('0x121')]]){if(!this['agents'][_0x380e00[_0xf9c8('0x121')]][_0xf9c8('0x122')]){this[_0xf9c8('0x1f')][_0x380e00['stateinterface']][_0xf9c8('0x122')]=!![];this[_0xf9c8('0x22')][_0x380e00[_0xf9c8('0x11f')]][_0xf9c8('0x122')]=!![];this[_0xf9c8('0x22')][_0x380e00['actionid']]['stateinterface']=_0x380e00[_0xf9c8('0x121')];}}}}else if((strategy[this[_0xf9c8('0x1d')][this[_0xf9c8('0x22')][_0x380e00[_0xf9c8('0x11f')]]['queue']]['strategy']]||_0xf9c8('0x16'))==='rrmemory'){if(this[_0xf9c8('0x22')][_0x380e00[_0xf9c8('0x11f')]]){if(this[_0xf9c8('0x1f')][_0x380e00['stateinterface']]){this[_0xf9c8('0x22')][_0x380e00[_0xf9c8('0x11f')]][_0xf9c8('0x121')]=_0x380e00[_0xf9c8('0x121')];if(_['isNil'](this['queueBooked'][this[_0xf9c8('0x22')][_0x380e00[_0xf9c8('0x11f')]]['queue']])){this[_0xf9c8('0x26')][this['actions'][_0x380e00[_0xf9c8('0x11f')]][_0xf9c8('0xad')]]=[];}this['queueBooked'][this['actions'][_0x380e00[_0xf9c8('0x11f')]][_0xf9c8('0xad')]][_0xf9c8('0x123')](_[_0xf9c8('0x89')](_[_0xf9c8('0xcc')](this[_0xf9c8('0x22')][_0x380e00[_0xf9c8('0x11f')]],[_0xf9c8('0x124'),_0xf9c8('0x121')]),{'status':_0x380e00[_0xf9c8('0xa9')],'paused':_0x380e00['paused']}));}}}};function unlockQueueStatus(_0x4f1680,_0xfc517b){setTimeout(function(){if(_[_0xf9c8('0x7f')](_0x4f1680[_0xf9c8('0x125')])){loggerBooked[_0xf9c8('0x91')](_0xf9c8('0x126'),_0xfc517b);}_0x4f1680[_0xf9c8('0x125')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0xfc517b,JSON['stringify'](_[_0xf9c8('0xcc')](_0x4f1680,['name',_0xf9c8('0x125')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x498d98){var _0x2146d2=this;var _0x57ddee=_0x2146d2[_0xf9c8('0x1d')][_0x2146d2['actions'][_0x498d98[_0xf9c8('0x11f')]]['queue']];if(strategy[this[_0xf9c8('0x1d')][this['actions'][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xad')]][_0xf9c8('0x120')]]===_0xf9c8('0x17')){if(this[_0xf9c8('0x22')][_0x498d98['actionid']]&&this[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0x121')]){this['preview'][_0xf9c8('0x127')](this[_0xf9c8('0x22')][_0x498d98['actionid']]['idHopper'],this[_0xf9c8('0x22')][_0x498d98['actionid']][_0xf9c8('0x121')])[_0xf9c8('0xaa')](function(_0xdd4ff5){logger[_0xf9c8('0x91')](_0xf9c8('0x128'),util[_0xf9c8('0x92')](_0xdd4ff5,{'showHidden':![],'depth':null}));})[_0xf9c8('0x1a')](function(){_0x2146d2['updateOriginated'](_0x2146d2['voiceQueues'][_0x2146d2['actions'][_0x498d98['actionid']][_0xf9c8('0xad')]]);_0x2146d2[_0xf9c8('0x1f')][_0x2146d2[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0x121')]]['locked']=![];delete _0x2146d2['actions'][_0x498d98['actionid']];unlockQueueStatus(_0x57ddee);});}else{this[_0xf9c8('0xac')](this[_0xf9c8('0x1d')][this[_0xf9c8('0x22')][_0x498d98['actionid']][_0xf9c8('0xad')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x498d98['actionid']][_0xf9c8('0xcd')],'ListId':this[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xce')],'VoiceQueueId':this['actions'][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xd0')]||undefined,'CampaignId':this['actions'][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xd1')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x498d98[_0xf9c8('0x11f')]];unlockQueueStatus(_0x57ddee);}}else if((strategy[this[_0xf9c8('0x1d')][this[_0xf9c8('0x22')][_0x498d98['actionid']][_0xf9c8('0xad')]]['strategy']]||_0xf9c8('0x16'))===_0xf9c8('0x16')){var _0x4e5c0a;if(this[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]]&&!_[_0xf9c8('0x75')](this[_0xf9c8('0x26')][this[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xad')]])){if(this[_0xf9c8('0x129')][_0x2146d2[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xad')]]){this[_0xf9c8('0x129')][_0x2146d2[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xad')]]=this[_0xf9c8('0x129')][this['actions'][_0x498d98['actionid']]['queue']]?this[_0xf9c8('0x129')][this['actions'][_0x498d98['actionid']]['queue']]:this[_0xf9c8('0x26')][this['actions'][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xad')]]?this[_0xf9c8('0x26')][this[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]][_0xf9c8('0xad')]][_0xf9c8('0x12a')]||0x0:0x0;}this[_0xf9c8('0x26')][this[_0xf9c8('0x22')][_0x498d98['actionid']][_0xf9c8('0xad')]][_0xf9c8('0x12a')]=this['queueBookedRR'][this[_0xf9c8('0x22')][_0x498d98[_0xf9c8('0x11f')]]['queue']];for(var _0x481ab2=0x0;_0x481ab2=0x0;})[_0xf9c8('0xaa')](myreject(_0x38f3b5)));}}else{_0x892778[_0xf9c8('0x123')](ami[_0xf9c8('0xa8')]({'action':_0xf9c8('0x149'),'command':util['format'](_0xf9c8('0x143'),_0x1d5788,!_[_0xf9c8('0x7f')](config[_0xf9c8('0x145')][_0x199f3c])?_0x199f3c:'')})[_0xf9c8('0xb4')](function(_0x187d0c){return _0x187d0c[_0xf9c8('0x146')]['indexOf'](_0xf9c8('0x148'))>=0x0;})['catch'](myreject(_0x38f3b5)));}BPromise[_0xf9c8('0x14a')](_0x892778)[_0xf9c8('0xb4')](function(_0x2264e3){var _0x586fcf=_['some'](_0x2264e3);if(_0x586fcf){return _0x15a2bd(_0x586fcf);}else{_0x262b43[_0xf9c8('0x39')]=_0x5eecf3?_0xf9c8('0x14b'):_0xf9c8('0x14c');return _0x38f3b5(msgResponse(_0xf9c8('0x14d'),_0xf9c8('0x13d'),_0xf9c8('0x14e')+_0x5eecf3+'\x20'+_0x25543c+_0xf9c8('0x14f')+util[_0xf9c8('0x92')](_0x1d5788,{'showHidden':![],'depth':null})+_0xf9c8('0x150')+_0x199f3c));}})['catch'](function(_0x5ebe14){return _0x38f3b5(msgResponse(_0xf9c8('0x13b'),_0xf9c8('0x13d'),JSON[_0xf9c8('0x45')](_0x5ebe14)));});});};Dialer[_0xf9c8('0x18')][_0xf9c8('0x151')]=function(_0x569c7a){var _0x3c1292=this;return function(){switch(_0x569c7a[_0xf9c8('0x57')]){case _0xf9c8('0x152'):freeVariablesPredictive(_0x569c7a);_0x3c1292['handlePower'](_0x569c7a,0x1);break;case _0xf9c8('0x153'):freeVariablesPredictive(_0x569c7a);_0x3c1292[_0xf9c8('0x154')](_0x569c7a,_0x569c7a[_0xf9c8('0x155')]);break;case _0xf9c8('0x7'):_0x3c1292[_0xf9c8('0x7')](_0x569c7a);break;case'booked':freeVariablesPredictive(_0x569c7a);_0x3c1292[_0xf9c8('0x154')](_0x569c7a,0x1);break;default:freeVariablesPredictive(_0x569c7a);logger['error']('Queue',_0x569c7a['name'],'method\x20not\x20recognized');}};};Dialer[_0xf9c8('0x18')]['launchHandleIvr']=function(_0x5229cf){var _0x51ebf0=this;return function(){_0x51ebf0[_0xf9c8('0x156')](_0x5229cf);};};Dialer['prototype']['syncQueueSummary']=function(_0x4c1972){var _0xb5d8f7=this;if(isNotPreview(_0x4c1972[_0xf9c8('0x57')])){if(isVoiceQueueOutbound(_0x4c1972[_0xf9c8('0x4a')])&&isActive(_0x4c1972['dialActive'])){_0x4c1972[_0xf9c8('0x9b')]=!![];BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](checkIsLoggedIn(_0x4c1972,_0x4c1972[_0xf9c8('0x4c')]))[_0xf9c8('0xb4')](checkIsActive(_0x4c1972,_0x4c1972[_0xf9c8('0x157')]))[_0xf9c8('0xb4')](checkInterval(_0x4c1972))[_0xf9c8('0xb4')](_0xb5d8f7[_0xf9c8('0x158')](_0x4c1972))[_0xf9c8('0xb4')](_0xb5d8f7[_0xf9c8('0x13a')](_0x4c1972[_0xf9c8('0x159')],_0x4c1972[_0xf9c8('0x15a')],_0x4c1972[_0xf9c8('0x3b')],_0x4c1972))[_0xf9c8('0xb4')](_0xb5d8f7['checkIfTimeIntervals'](_0x4c1972[_0xf9c8('0x41')],_0x4c1972[_0xf9c8('0x15a')],_0x4c1972[_0xf9c8('0x3b')],_0x4c1972))[_0xf9c8('0xb4')](_0xb5d8f7[_0xf9c8('0x151')](_0x4c1972))[_0xf9c8('0xaa')](loggerCatchQueueSummary(_0xf9c8('0x15b'),_0x4c1972));}else{notSendMessagesQueue(_0x4c1972);}}else{freeVariablesPredictive(_0x4c1972);}};Dialer[_0xf9c8('0x18')][_0xf9c8('0x137')]=function(){var _0x14f0d5=this;var _0xb65ed9;for(var _0x1e1828 in this[_0xf9c8('0x1e')]){if(typeof this[_0xf9c8('0x1e')][_0x1e1828]!=='undefined'){_0xb65ed9=this[_0xf9c8('0x1e')][_0x1e1828];if(isCampaignIvr(_0xb65ed9[_0xf9c8('0x4a')])&&isActive(_0xb65ed9[_0xf9c8('0xd7')])){_0xb65ed9[_0xf9c8('0x9b')]=!![];BPromise[_0xf9c8('0xb1')]()[_0xf9c8('0xb4')](checkIsActive(_0xb65ed9,_0xb65ed9[_0xf9c8('0xd7')]))[_0xf9c8('0xb4')](checkInterval(_0xb65ed9))[_0xf9c8('0xb4')](_0x14f0d5[_0xf9c8('0x158')](_0xb65ed9))[_0xf9c8('0xb4')](_0x14f0d5['checkIfTime'](_0xb65ed9['dialGlobalInterval'],_0xb65ed9[_0xf9c8('0x15a')],_0xb65ed9[_0xf9c8('0x3b')],_0xb65ed9))[_0xf9c8('0xb4')](_0x14f0d5['checkIfTimeIntervals'](_0xb65ed9[_0xf9c8('0x41')],_0xb65ed9[_0xf9c8('0x15a')],_0xb65ed9[_0xf9c8('0x3b')],_0xb65ed9))[_0xf9c8('0xb4')](_0x14f0d5['launchHandleIvr'](_0xb65ed9))[_0xf9c8('0xaa')](loggerCatchQueueSummary('[syncCampaigns]',_0xb65ed9));}else{notSendMessagesCampaign(_0xb65ed9);}}}};function getCallerIdRandom(_0x33102f,_0x15c77e){var _0x361496;var _0x50e948;var _0x56712f;if(_0x15c77e<=0x0){_0x15c77e=0x1;}_0x361496=new RegExp(_0xf9c8('0x15c')+_0x15c77e+'}$');_0x50e948=Math[_0xf9c8('0x15d')](0xa,_0x15c77e-0x1);_0x56712f=Math[_0xf9c8('0x15d')](0xa,_0x15c77e)-0x1;return util[_0xf9c8('0x71')]('%s',_[_0xf9c8('0x15e')](_0x33102f,_0x361496,_[_0xf9c8('0x15f')](_0x50e948,_0x56712f)));}function extractCalleridName(_0x73f7f2){var _0x133260=_0x73f7f2['match'](/"(.*?)"/);return _0x133260?_0x133260[0x1]:_0x73f7f2;}function extractCalleridNumber(_0x34cf04){var _0x1fd17a=_0x34cf04['match'](/<(.*?)>/);return _0x1fd17a?_0x1fd17a[0x1]:_0x34cf04;}Dialer[_0xf9c8('0x18')][_0xf9c8('0x160')]=function(_0x1a98df,_0x1ed0c4){var _0x5d402c=this;var _0x4625e9=uuid['v4']();this['actions'][_0x4625e9]=new Action(_0x1a98df,_0x1ed0c4,_0x4625e9);return new BPromise(function(_0x31fdee,_0xb506bc){if(_['isUndefined'](_0x1a98df)&&typeof _0x1a98df!==_0xf9c8('0x161')){return _0xb506bc(msgResponse(_0xf9c8('0x162'),'Failure',_0xf9c8('0x163')));}if(_[_0xf9c8('0x7f')](_0x1ed0c4[_0xf9c8('0x164')]['phone'])||_0x1ed0c4['Contact'][_0xf9c8('0x165')]===null){return _0xb506bc(msgResponse(_0xf9c8('0x162'),_0xf9c8('0x13d'),'contact\x20is\x20undefine'));}var _0x35973a={'XMD-CALLERID':_0x5d402c[_0xf9c8('0x22')][_0x4625e9]['getCaller'](),'XMD-AGI':_0x1a98df[_0xf9c8('0x100')]?util[_0xf9c8('0x71')](_0xf9c8('0x166'),ipAgi,_0x1a98df[_0xf9c8('0x100')]):_0xf9c8('0x167'),'XMD-AGIAFTER':_0x1a98df['dialQueueProject2']?util[_0xf9c8('0x71')](_0xf9c8('0x166'),ipAgi,_0x1a98df[_0xf9c8('0x108')]):_0xf9c8('0x167'),'XMD-QUEUE':_0x1a98df[_0xf9c8('0x4a')]==='outbound'?util[_0xf9c8('0x71')](_0xf9c8('0x168'),_0x1a98df[_0xf9c8('0x3b')],_0x1a98df[_0xf9c8('0x169')]||'',_0x1a98df[_0xf9c8('0x109')]?'c':'',_0x1a98df[_0xf9c8('0x16a')]||0x3):_0xf9c8('0x167'),'XMD-CONTACTID':_0x1ed0c4[_0xf9c8('0xcd')],'XMD-CDRTYPE':_0xf9c8('0x16b'),'CALLERID(all)':_0x5d402c[_0xf9c8('0x22')][_0x4625e9][_0xf9c8('0x16c')](),'XMD-AMD':_0x1a98df['dialAMDActive']?'ACTIVE':_0xf9c8('0x167'),'XMD-DESTINATION':_0xf9c8('0x16d')};if(_0x1a98df['dialAMDActive']){_0x35973a[_0xf9c8('0x16e')]=_0x1a98df[_0xf9c8('0x16f')]||0x9c4;_0x35973a[_0xf9c8('0x170')]=_0x1a98df['dialAMDGreeting']||0x5dc;_0x35973a[_0xf9c8('0x171')]=_0x1a98df[_0xf9c8('0x172')]||0x320;_0x35973a[_0xf9c8('0x173')]=_0x1a98df[_0xf9c8('0x174')]||0x1388;_0x35973a['XMD-AMDMINWORDLENGTH']=_0x1a98df[_0xf9c8('0x175')]||0x64;_0x35973a['XMD-AMDBETWEENWORDSSILENCE']=_0x1a98df['dialAMDBetweenWordsSilence']||0x32;_0x35973a[_0xf9c8('0x176')]=_0x1a98df[_0xf9c8('0x177')]||0x3;_0x35973a[_0xf9c8('0x178')]=_0x1a98df[_0xf9c8('0x179')]||0x100;_0x35973a[_0xf9c8('0x17a')]=_0x1a98df[_0xf9c8('0x17b')]||0x1388;}if(_0x1a98df[_0xf9c8('0x4a')]==='outbound'){_0x35973a[_0xf9c8('0x17c')]=_0x1ed0c4[_0xf9c8('0xd0')];}else{_0x35973a[_0xf9c8('0x17d')]=_0x1ed0c4['CampaignId'];}for(var _0x5e5bba in _0x1ed0c4[_0xf9c8('0x164')]){if(typeof _0x1ed0c4[_0xf9c8('0x164')][_0x5e5bba]!==_0xf9c8('0x95')){if(isNotNull(_0x1ed0c4[_0xf9c8('0x164')][_0x5e5bba])&&_0x5e5bba!=='id'&&_0x5e5bba!==_0xf9c8('0x17e')&&_0x5e5bba!==_0xf9c8('0x17f')&&_0x5e5bba!=='updatedAt'){_0x35973a[util[_0xf9c8('0x71')](_0xf9c8('0x180'),_0xf9c8('0x181'),_[_0xf9c8('0x182')](_0x5e5bba))]=_0x1ed0c4[_0xf9c8('0x164')][_0x5e5bba];}}}var _0x5a8162=_0x5d402c[_0xf9c8('0xd6')](_0x1a98df[_0xf9c8('0x70')])?getCallerId(_0x1a98df['Trunk'][_0xf9c8('0x183')],_0x1a98df['dialOriginateCallerIdName'],_0x1a98df[_0xf9c8('0x184')]>0x0?getCallerIdRandom(_0x1a98df[_0xf9c8('0x58')],_0x1a98df['dialRandomLastDigitCallerIdNumber']):_0x1a98df['dialOriginateCallerIdNumber']):getCallerId(_[_0xf9c8('0xa7')](_0x1a98df['TrunkBackup'])?_0x1a98df['Trunk'][_0xf9c8('0x183')]:_0x1a98df[_0xf9c8('0x138')][_0xf9c8('0x183')],_0x1a98df['dialOriginateCallerIdName'],_0x1a98df[_0xf9c8('0x184')]>0x0?getCallerIdRandom(_0x1a98df[_0xf9c8('0x58')],_0x1a98df[_0xf9c8('0x184')]):_0x1a98df[_0xf9c8('0x58')]);if(_0x5a8162){_0x35973a['XMD-ORIGINATECALLERIDNAME']=_0x5d402c[_0xf9c8('0x22')][_0x4625e9][_0xf9c8('0x185')]=extractCalleridName(_0x5a8162);_0x35973a[_0xf9c8('0x186')]=_0x5d402c['actions'][_0x4625e9][_0xf9c8('0x187')]=extractCalleridNumber(_0x5a8162);}return ami[_0xf9c8('0xa8')]({'actionid':_0x4625e9,'action':'originate','channel':_0x5d402c['isTrunkReachable'](_0x1a98df[_0xf9c8('0x70')])?util[_0xf9c8('0x71')](_0xf9c8('0x188'),_0x1a98df[_0xf9c8('0x70')][_0xf9c8('0x3b')],isNotNull(_0x1a98df[_0xf9c8('0x5a')])?_0x1a98df['dialPrefix'][_0xf9c8('0x189')]()||'':'',_0x1a98df['dialCutDigit']>0x0?_0x1ed0c4[_0xf9c8('0x164')][_0xf9c8('0x165')][_0xf9c8('0x18a')](_0x1a98df[_0xf9c8('0x18b')]):_0x1ed0c4[_0xf9c8('0x164')]['phone']):util[_0xf9c8('0x71')]('SIP/%s/%s%s',_['isNil'](_0x1a98df['TrunkBackup'])?_0x1a98df[_0xf9c8('0x70')][_0xf9c8('0x3b')]:_0x1a98df[_0xf9c8('0x138')]['name'],isNotNull(_0x1a98df[_0xf9c8('0x5a')])?_0x1a98df[_0xf9c8('0x5a')][_0xf9c8('0x189')]()||'':'',_0x1a98df['dialCutDigit']>0x0?_0x1ed0c4['Contact'][_0xf9c8('0x165')][_0xf9c8('0x18a')](_0x1a98df[_0xf9c8('0x18b')]):_0x1ed0c4[_0xf9c8('0x164')][_0xf9c8('0x165')]),'callerid':_0x5a8162,'Exten':'xcally-motion-dialer','Context':_0xf9c8('0x18c'),'Priority':'1','variable':_0x35973a,'timeout':(_0x1a98df[_0xf9c8('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4625e9})[_0xf9c8('0xb4')](function(_0x3c3edf){return _0x31fdee(_0x3c3edf);})['catch'](function(_0x3e70b0){_0x1a98df[_0xf9c8('0x64')]+=0x1;var _0x5be02b=new History(_0x5d402c[_0xf9c8('0x22')][_0x4625e9]);logger['error'](util[_0xf9c8('0x71')](_0xf9c8('0x18d'),JSON[_0xf9c8('0x45')](_0x3e70b0)));_0x5be02b[_0xf9c8('0xa2')]=0xe;_0x5be02b['statedesc']=_0xf9c8('0x18e');_0x5be02b[_0xf9c8('0x117')]=moment()[_0xf9c8('0x71')](_0xf9c8('0xfe'));_0x5be02b['endtime']=_0x5be02b['starttime'];_0x5d402c[_0xf9c8('0xc4')](_0x5be02b)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x18f')));_0x5d402c[_0xf9c8('0xc3')](_0x5be02b)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x18f')))[_0xf9c8('0x1a')](function(){delete _0x5d402c[_0xf9c8('0x22')][_0x4625e9];return _0xb506bc(msgResponse(_0xf9c8('0x162'),'Error',_0xf9c8('0x190')));});});});};Dialer[_0xf9c8('0x18')][_0xf9c8('0x2d')]=function(_0x56aefc){var _0x2c65aa=this[_0xf9c8('0x22')][_0x56aefc[_0xf9c8('0x11f')]];if(_0x2c65aa){delete this[_0xf9c8('0x22')][_0x56aefc[_0xf9c8('0x11f')]];_0x2c65aa[_0xf9c8('0x10f')]=moment()['format'](_0xf9c8('0xfe'));var _0x4503f8=_0x2c65aa[_0xf9c8('0x4a')]===_0xf9c8('0x73')?this[_0xf9c8('0x1e')][_0x2c65aa[_0xf9c8('0xad')]]:this[_0xf9c8('0x1d')][_0x2c65aa[_0xf9c8('0x191')]()];if(!this[_0xf9c8('0xd4')](_0x56aefc['response'])){this[_0xf9c8('0xac')](_0x4503f8);return this[_0xf9c8('0x192')](_0x2c65aa,_0x4503f8,_0x56aefc)['catch'](loggerCatch(_0xf9c8('0x193')));}this[_0xf9c8('0x23')][_0x56aefc[_0xf9c8('0xda')]]=_0x2c65aa;}};Dialer['prototype'][_0xf9c8('0x194')]=function(_0x470ca9,_0x2f63ce,_0x16efb5){var _0x28554b=new History(_0x2f63ce);if(_0x28554b[_0xf9c8('0xe9')]+_0x28554b[_0xf9c8('0xea')]+_0x28554b[_0xf9c8('0xeb')]+_0x28554b[_0xf9c8('0xec')]+_0x28554b['countdropretry']+_0x28554b[_0xf9c8('0xee')]+_0x28554b[_0xf9c8('0xef')]+_0x28554b[_0xf9c8('0xf0')]>=_0x16efb5[_0xf9c8('0xf1')]-0x1){return!![];}switch(_0x470ca9){case 0x3:if(_0x28554b['countnoanswerretry']>=_0x16efb5[_0xf9c8('0x195')]-0x1){return!![];}this[_0xf9c8('0xba')]({'active':![],'countnoanswerretry':_0x28554b[_0xf9c8('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x16efb5[_0xf9c8('0x196')],_0xf9c8('0xfd'))[_0xf9c8('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28554b[_0xf9c8('0xcd')],'ListId':_0x28554b[_0xf9c8('0xce')],'VoiceQueueId':_0x28554b[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x28554b[_0xf9c8('0xd1')]||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x197')));break;case 0x5:if(_0x28554b[_0xf9c8('0xe9')]>=_0x16efb5[_0xf9c8('0x198')]-0x1){return!![];}this[_0xf9c8('0xba')]({'active':![],'countbusyretry':_0x28554b[_0xf9c8('0xe9')]+=0x1,'scheduledat':moment()[_0xf9c8('0xf5')](_0x16efb5[_0xf9c8('0x199')],_0xf9c8('0xfd'))[_0xf9c8('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28554b[_0xf9c8('0xcd')],'ListId':_0x28554b[_0xf9c8('0xce')],'VoiceQueueId':_0x28554b[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x28554b[_0xf9c8('0xd1')]||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x19a')));break;case 0x8:if(_0x28554b['countcongestionretry']>=_0x16efb5['dialCongestionMaxRetry']-0x1){return!![];}this[_0xf9c8('0xba')]({'active':![],'countcongestionretry':_0x28554b['countcongestionretry']+=0x1,'scheduledat':moment()[_0xf9c8('0xf5')](_0x16efb5['dialCongestionRetryFrequency'],_0xf9c8('0xfd'))[_0xf9c8('0x71')](_0xf9c8('0xfe')),'ContactId':_0x28554b[_0xf9c8('0xcd')],'ListId':_0x28554b['ListId'],'VoiceQueueId':_0x28554b['VoiceQueueId']||undefined,'CampaignId':_0x28554b['CampaignId']||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x19b')));break;case 0x0:if(_0x28554b[_0xf9c8('0xec')]>=_0x16efb5['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xf9c8('0xba')]({'active':![],'countnosuchnumberretry':_0x28554b[_0xf9c8('0xec')]+=0x1,'scheduledat':moment()['add'](_0x16efb5['dialNoSuchNumberRetryFrequency'],_0xf9c8('0xfd'))[_0xf9c8('0x71')](_0xf9c8('0xfe')),'ContactId':_0x28554b[_0xf9c8('0xcd')],'ListId':_0x28554b['ListId'],'VoiceQueueId':_0x28554b[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x28554b[_0xf9c8('0xd1')]||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x19c')));}break;case 0xa:if(_0x28554b[_0xf9c8('0xed')]>=_0x16efb5[_0xf9c8('0x114')]-0x1){return!![];}this[_0xf9c8('0xba')]({'active':![],'countdropretry':_0x28554b[_0xf9c8('0xed')]+=0x1,'scheduledat':moment()[_0xf9c8('0xf5')](_0x16efb5['dialDropRetryFrequency'],_0xf9c8('0xfd'))['format'](_0xf9c8('0xfe')),'ContactId':_0x28554b[_0xf9c8('0xcd')],'ListId':_0x28554b[_0xf9c8('0xce')],'VoiceQueueId':_0x28554b[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x28554b['CampaignId']||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x116')));break;case 0xb:if(_0x28554b[_0xf9c8('0xee')]>=_0x16efb5[_0xf9c8('0x19d')]-0x1){return!![];}this[_0xf9c8('0xba')]({'active':![],'countabandonedretry':_0x28554b['countabandonedretry']+=0x1,'scheduledat':moment()[_0xf9c8('0xf5')](_0x16efb5['dialAbandonedRetryFrequency'],_0xf9c8('0xfd'))[_0xf9c8('0x71')](_0xf9c8('0xfe')),'ContactId':_0x28554b['ContactId'],'ListId':_0x28554b[_0xf9c8('0xce')],'VoiceQueueId':_0x28554b['VoiceQueueId']||undefined,'CampaignId':_0x28554b[_0xf9c8('0xd1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x28554b[_0xf9c8('0xef')]>=_0x16efb5[_0xf9c8('0xf4')]-0x1){return!![];}this[_0xf9c8('0xba')]({'active':![],'countmachineretry':_0x28554b['countmachineretry']+=0x1,'scheduledat':moment()[_0xf9c8('0xf5')](_0x16efb5[_0xf9c8('0xfc')],'minutes')[_0xf9c8('0x71')](_0xf9c8('0xfe')),'ContactId':_0x28554b[_0xf9c8('0xcd')],'ListId':_0x28554b['ListId'],'VoiceQueueId':_0x28554b[_0xf9c8('0xd0')]||undefined,'CampaignId':_0x28554b[_0xf9c8('0xd1')]||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xf6')));break;case 0x14:if(_0x28554b['countagentrejectretry']>=_0x16efb5[_0xf9c8('0x19e')]-0x1){return!![];}this[_0xf9c8('0xba')]({'active':![],'countagentrejectretry':_0x28554b[_0xf9c8('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x16efb5[_0xf9c8('0x19f')],_0xf9c8('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28554b[_0xf9c8('0xcd')],'ListId':_0x28554b[_0xf9c8('0xce')],'VoiceQueueId':_0x28554b['VoiceQueueId']||undefined,'CampaignId':_0x28554b['CampaignId']||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x1a0')));break;default:return!![];}};Dialer['prototype'][_0xf9c8('0x192')]=function(_0x17567e,_0x277c9e,_0x407807){var _0x6aa739=this;var _0x46f63c=new History(_0x17567e);return new BPromise(function(_0x762669,_0x17d210){if(_[_0xf9c8('0x7f')](_0x277c9e)&&typeof _0x277c9e!==_0xf9c8('0x161')){return _0x17d210(msgResponse(_0xf9c8('0x1a1'),_0xf9c8('0x13d'),'entity\x20is\x20undefine'));}if(_[_0xf9c8('0x7f')](_0x407807)&&typeof _0x407807!==_0xf9c8('0x161')){return _0x17d210(msgResponse(_0xf9c8('0x1a1'),_0xf9c8('0x13d'),_0xf9c8('0x1a2')));}switch(_0x407807[_0xf9c8('0x105')]){case'0':_0x277c9e[_0xf9c8('0x63')]+=0x1;_0x46f63c[_0xf9c8('0xa2')]=0x0;_0x46f63c['statedesc']='NoSuchNumber';_0x46f63c[_0xf9c8('0xec')]+=0x1;_0x46f63c[_0xf9c8('0xf9')]+=0x1;ami['emit'](_0xf9c8('0x1a3'),ut[_0xf9c8('0xe4')](_0x17567e,_0xf9c8('0x1a4')));_0x6aa739[_0xf9c8('0xc4')](_0x46f63c)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xfa')));if(_0x6aa739[_0xf9c8('0x194')](0x0,_0x17567e,_0x277c9e)){if(_0x46f63c['countnosuchnumberretry']>=_0x277c9e[_0xf9c8('0x1a5')]){_0x6aa739[_0xf9c8('0x1a6')](_0x46f63c,_0x762669,_0x17d210,'reason\x200\x20no\x20such\x20number....');}else{_0x6aa739[_0xf9c8('0xf2')](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1a7'));}}break;case'3':_0x277c9e[_0xf9c8('0x62')]+=0x1;_0x46f63c['state']=0x3;_0x46f63c[_0xf9c8('0xe1')]=_0xf9c8('0x1a8');_0x46f63c['countnoanswerretry']+=0x1;_0x46f63c[_0xf9c8('0xf9')]+=0x1;ami[_0xf9c8('0x49')](_0xf9c8('0x1a9'),ut[_0xf9c8('0xe4')](_0x17567e,_0xf9c8('0x1aa')));_0x6aa739[_0xf9c8('0xc4')](_0x46f63c)['catch'](loggerCatch(_0xf9c8('0x1ab')));if(_0x6aa739[_0xf9c8('0x194')](0x3,_0x17567e,_0x277c9e)){if(_0x46f63c[_0xf9c8('0xeb')]>=_0x277c9e[_0xf9c8('0x195')]){_0x6aa739[_0xf9c8('0x1a6')](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1ac'));}else{_0x6aa739[_0xf9c8('0xf2')](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1ac'));}}break;case'5':_0x277c9e[_0xf9c8('0x5e')]+=0x1;_0x46f63c[_0xf9c8('0xa2')]=0x5;_0x46f63c[_0xf9c8('0xe1')]=_0xf9c8('0x1ad');_0x46f63c[_0xf9c8('0xe9')]+=0x1;_0x46f63c[_0xf9c8('0xf9')]+=0x1;ami['emit'](_0xf9c8('0x1ae'),ut['buildObj'](_0x17567e,_0xf9c8('0x1af')));_0x6aa739[_0xf9c8('0xc4')](_0x46f63c)[_0xf9c8('0xaa')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x6aa739[_0xf9c8('0x194')](0x5,_0x17567e,_0x277c9e)){if(_0x46f63c[_0xf9c8('0xe9')]>=_0x277c9e[_0xf9c8('0x198')]){_0x6aa739[_0xf9c8('0x1a6')](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1b0'));}else{_0x6aa739[_0xf9c8('0xf2')](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1b0'));}}break;case'8':_0x277c9e['outboundCongestionCallsDay']+=0x1;_0x46f63c[_0xf9c8('0xa2')]=0x8;_0x46f63c[_0xf9c8('0xe1')]=_0xf9c8('0x1b1');_0x46f63c[_0xf9c8('0xea')]+=0x1;_0x46f63c[_0xf9c8('0xf9')]+=0x1;ami[_0xf9c8('0x49')](_0xf9c8('0x1b2'),ut['buildObj'](_0x17567e,'congestion'));_0x6aa739['createHistory'](_0x46f63c)['catch'](loggerCatch(_0xf9c8('0x1b3')));if(_0x6aa739[_0xf9c8('0x194')](0x8,_0x17567e,_0x277c9e)){if(_0x46f63c['countcongestionretry']>=_0x277c9e['dialCongestionMaxRetry']){_0x6aa739['createStateFinal'](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1b4'));}else{_0x6aa739[_0xf9c8('0xf2')](_0x46f63c,_0x762669,_0x17d210,'reason\x208\x20congestion');}}break;case'11':_0x277c9e[_0xf9c8('0x1b5')]+=0x1;_0x46f63c['state']=0xb;_0x46f63c[_0xf9c8('0xe1')]=_0xf9c8('0x11b');_0x46f63c[_0xf9c8('0xee')]+=0x1;_0x46f63c[_0xf9c8('0xf9')]+=0x1;_0x6aa739[_0xf9c8('0xc4')](_0x46f63c)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x11e')));if(_0x6aa739['checkRetriveMax'](0xb,_0x17567e,_0x277c9e)){if(_0x46f63c[_0xf9c8('0xee')]>=_0x277c9e[_0xf9c8('0x19d')]){_0x6aa739[_0xf9c8('0x1a6')](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1b6'));}else{_0x6aa739[_0xf9c8('0xf2')](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1b6'));}}break;case'20':_0x277c9e[_0xf9c8('0x65')]+=0x1;_0x46f63c[_0xf9c8('0xa2')]=0x14;_0x46f63c['statedesc']=_0xf9c8('0x1b7');_0x46f63c[_0xf9c8('0xf0')]+=0x1;_0x46f63c[_0xf9c8('0xf9')]+=0x1;ami[_0xf9c8('0x49')]('custom:agentreject',ut['buildObj'](_0x17567e,'agentreject'));_0x6aa739[_0xf9c8('0xc4')](_0x46f63c)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x1b8')));if(_0x6aa739[_0xf9c8('0x194')](0x14,_0x17567e,_0x277c9e)){if(_0x46f63c[_0xf9c8('0xf0')]>=_0x277c9e['dialAgentRejectMaxRetry']){_0x6aa739[_0xf9c8('0x1a6')](_0x46f63c,_0x762669,_0x17d210,_0xf9c8('0x1b9'));}else{_0x6aa739[_0xf9c8('0xf2')](_0x46f63c,_0x762669,_0x17d210,'reason\x2020\x20agentreject');}}break;default:_0x277c9e[_0xf9c8('0x66')]+=0x1;_0x46f63c[_0xf9c8('0xa2')]=0xc;_0x46f63c[_0xf9c8('0xe1')]=_0x407807[_0xf9c8('0x105')];_0x6aa739['createHistory'](_0x46f63c)[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x1ba')));if(_0x6aa739[_0xf9c8('0x194')](_0x407807['reason'],_0x17567e,_0x277c9e)){if(_0x46f63c[_0xf9c8('0xe9')]+_0x46f63c[_0xf9c8('0xea')]+_0x46f63c['countnoanswerretry']+_0x46f63c[_0xf9c8('0xec')]+_0x46f63c[_0xf9c8('0xed')]+_0x46f63c[_0xf9c8('0xee')]+_0x46f63c[_0xf9c8('0xef')]+_0x46f63c[_0xf9c8('0xf0')]>=_0x277c9e['dialGlobalMaxRetry']){_0x6aa739[_0xf9c8('0xf2')](_0x46f63c,_0x762669,_0x17d210,_0x407807[_0xf9c8('0x105')]);}else{_0x6aa739['createStateFinal'](_0x46f63c,_0x762669,_0x17d210,_0x407807[_0xf9c8('0x105')]);}}}});};Dialer[_0xf9c8('0x18')][_0xf9c8('0xf2')]=function(_0x3ed689,_0x525132,_0x4ac804,_0x56f30b){var _0x560436=new Final(_0x3ed689);_0x560436[_0xf9c8('0xa2')]=0xf;_0x560436[_0xf9c8('0xe1')]=_0xf9c8('0x1bb');this[_0xf9c8('0x1a6')](_0x560436,_0x525132,_0x4ac804,_0x56f30b);};Dialer[_0xf9c8('0x18')][_0xf9c8('0x1a6')]=function(_0x341cb9,_0x2a1b09,_0x307071,_0x3b372){this['moveContactManagedDialer'](_0x341cb9)['then'](function(){return _0x2a1b09(msgResponse(_0xf9c8('0x1a1'),_0xf9c8('0xd5'),_0x3b372));})[_0xf9c8('0xaa')](function(){return _0x307071(msgResponse(_0xf9c8('0x1bc'),_0xf9c8('0x13d'),_0xf9c8('0x1bd')));});};Dialer[_0xf9c8('0x18')][_0xf9c8('0x7')]=function(_0x47ccf2){var _0x38cb7c=_0x47ccf2[_0xf9c8('0x1be')]/0x64;var _0x81d84a=_0x47ccf2['outboundDropCallsDayTimeout']/(_0x47ccf2[_0xf9c8('0x61')]+_0x47ccf2[_0xf9c8('0x5c')]);var _0x4cd71b=Math['round'](_0x47ccf2[_0xf9c8('0x6c')]*(_0x47ccf2[_0xf9c8('0x1bf')]/0x64));var _0x5ae2c2=Math[_0xf9c8('0x1c0')](_0x47ccf2[_0xf9c8('0x6c')]*(_0x47ccf2['predictiveIntervalMinThreshold']/0x64));var _0x1a44ee=_0x47ccf2[_0xf9c8('0x9c')]+_0x47ccf2[_0xf9c8('0x51')];var _0xdb431e=Math['floor'](_0x47ccf2['erlangCalls']*_0x47ccf2[_0xf9c8('0x88')]*_0x47ccf2[_0xf9c8('0x1c1')]*_0x47ccf2['predictiveIntervalMultiplicativeFactor']);if(_[_0xf9c8('0x7f')](_0x47ccf2[_0xf9c8('0x8a')])){if(!_[_0xf9c8('0x7f')](_0x47ccf2[_0xf9c8('0x25')])){_0x47ccf2[_0xf9c8('0x25')]=undefined;loggerPredictive['error'](_0xf9c8('0x1c2'),_0xf9c8('0x1c3'));}if(!_['isUndefined'](_0x47ccf2['handlePredictive'])){loggerPredictive[_0xf9c8('0x91')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x47ccf2[_0xf9c8('0x8c')]);_0x47ccf2[_0xf9c8('0x8c')]=undefined;}_0x47ccf2[_0xf9c8('0x8a')]=moment()[_0xf9c8('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf9c8('0x76')](_0x47ccf2[_0xf9c8('0x3b')],_0xf9c8('0x1c4'),_0x47ccf2[_0xf9c8('0x8a')]);this['handlePower'](_0x47ccf2,0x1);}else if(ifInterval(_0x47ccf2['dialPredictiveInterval'],_0x47ccf2[_0xf9c8('0x8a')])){this[_0xf9c8('0x154')](_0x47ccf2,0x1);loggerPredictiveCalls[_0xf9c8('0x76')](_0xf9c8('0x1c5'),_0x47ccf2[_0xf9c8('0x8a')],_0x47ccf2['name']);_0x47ccf2[_0xf9c8('0x1c6')]=0x0;_0x47ccf2['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x38cb7c<_0x81d84a&&_0x47ccf2[_0xf9c8('0x1c7')]===_0xf9c8('0x1c8')){freeVariablesPredictive(_0x47ccf2);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x1c9'),_0xf9c8('0x1ca'),_0x81d84a,_0xf9c8('0x8a'),_0x47ccf2[_0xf9c8('0x3b')]);}else if(_0xdb431e<_0x47ccf2[_0xf9c8('0x110')]&&_0x47ccf2['dialPredictiveOptimization']===_0xf9c8('0x1c8')){freeVariablesPredictive(_0x47ccf2);loggerPredictive['info'](_0xf9c8('0x1cb'),'Max\x20Drop\x20',_0xdb431e,'Drop\x20in\x20this\x20interval',_0x47ccf2[_0xf9c8('0x110')],_0xf9c8('0x8a'),_0x47ccf2[_0xf9c8('0x3b')]);}else if(!ifInterval(_0x47ccf2[_0xf9c8('0x1cc')],_0x47ccf2[_0xf9c8('0x8a')])&&_['isUndefined'](_0x47ccf2['startPredictive'])&&!_[_0xf9c8('0x7f')](_0x47ccf2[_0xf9c8('0x8a')])){_0x47ccf2[_0xf9c8('0x25')]=moment()[_0xf9c8('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x47ccf2[_0xf9c8('0x3b')],_0xf9c8('0x1cd'),_0x47ccf2['startPredictive']);this[_0xf9c8('0xb7')](_0x47ccf2[_0xf9c8('0x1cc')])[_0xf9c8('0xb4')](this['getDataPredictive'](_0x47ccf2))['then'](mergeDataErlangB(_0x47ccf2))[_0xf9c8('0xb4')](this[_0xf9c8('0x1ce')](_0x47ccf2))['catch'](loggerCatchPredictive(_0xf9c8('0x1cf'),_0x47ccf2));}else if(!ifInterval(_0x47ccf2[_0xf9c8('0x1cc')],_0x47ccf2[_0xf9c8('0x25')])){_0x47ccf2[_0xf9c8('0x110')]=0x0;_0x47ccf2[_0xf9c8('0x25')]=moment()[_0xf9c8('0x71')](_0xf9c8('0xfe'));loggerPredictive[_0xf9c8('0x76')](_0x47ccf2[_0xf9c8('0x3b')],_0xf9c8('0x1d0'),_0x47ccf2[_0xf9c8('0x25')]);clearInterval(_0x47ccf2['handlePredictive']);_0x47ccf2[_0xf9c8('0x8c')]=undefined;this[_0xf9c8('0xb7')](_0x47ccf2['dialPredictiveInterval'])[_0xf9c8('0xb4')](this['getDataPredictive'](_0x47ccf2))[_0xf9c8('0xb4')](mergeDataErlangB(_0x47ccf2))[_0xf9c8('0xb4')](this[_0xf9c8('0x1ce')](_0x47ccf2))[_0xf9c8('0xaa')](loggerCatchPredictive(_0xf9c8('0x1d1'),_0x47ccf2));}else if(_0x47ccf2[_0xf9c8('0x6c')]&&_0x1a44ee<_0x47ccf2[_0xf9c8('0x6c')]-_0x5ae2c2){freeVariablesPredictive(_0x47ccf2);loggerPredictive[_0xf9c8('0x76')](_0x47ccf2[_0xf9c8('0x3b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1a44ee,_0xf9c8('0x1d2'),_0x47ccf2[_0xf9c8('0x6c')],'-',_0x5ae2c2,'=',_0x47ccf2['predictiveIntervalAvailable']-_0x5ae2c2,')');}else if(_0x47ccf2['predictiveIntervalAvailable']&&_0x1a44ee>_0x47ccf2[_0xf9c8('0x6c')]+_0x4cd71b){freeVariablesPredictive(_0x47ccf2);loggerPredictive[_0xf9c8('0x76')](_0x47ccf2['name'],_0xf9c8('0x1d3'),_0x1a44ee,')\x20are\x20more\x20than\x20threshold\x20(',_0x47ccf2['predictiveIntervalAvailable'],'+',_0x4cd71b,'=',_0x47ccf2[_0xf9c8('0x6c')]+_0x4cd71b,')');}};Dialer[_0xf9c8('0x18')][_0xf9c8('0x1d4')]=function(_0x220edf){var _0x2c1656=this;return function(_0x6d9d49){return new BPromise(function(_0x394268,_0x5de3dd){_['merge'](_0x220edf,_0x6d9d49[0x0]);if(checkGetDataPredictive(_0x6d9d49[0x0])){var _0x205e72=_0x220edf['predictiveIntervalAvailable']=_0x220edf[_0xf9c8('0x51')]+_0x220edf[_0xf9c8('0x9c')];var _0x4012b9=_0x220edf[_0xf9c8('0x1cc')]*0x3c;var _0x5e00f6=_0x6d9d49[0x0][_0xf9c8('0x69')]+_0x6d9d49[0x0]['predictiveIntervalAvgHoldtime'];var _0x2a0db2=(_0x6d9d49[0x0]['predictiveIntervalAnsweredCalls']+_0x6d9d49[0x0][_0xf9c8('0x6b')]+_0x6d9d49[0x0][_0xf9c8('0x6a')])/_0x6d9d49[0x0]['predictiveIntervalTotalCalls'];_0x220edf['predictiveIntervalHitRate']=_0x2a0db2>0x0?_0x2a0db2:0x1;switch(_0x220edf[_0xf9c8('0x1c7')]){case'dropRate':var _0x2150c4=_0x220edf['dialPredictiveOptimizationPercentage']/0x64;return _0x2c1656[_0xf9c8('0x1d5')](_0x205e72,_0x4012b9,_0x5e00f6,_0x2a0db2,_0x2150c4)[_0xf9c8('0xb4')](function(_0x1f82e6){return _0x394268(_0x1f82e6);});case _0xf9c8('0x1d6'):var _0x1dd619=_0x220edf[_0xf9c8('0x1be')]/0x64;return _0x2c1656[_0xf9c8('0x1d7')](_0x205e72,_0x4012b9,_0x5e00f6,_0x2a0db2,_0x1dd619)['then'](function(_0x280fca){return _0x394268(_0x280fca);});default:return _0x5de3dd(msgResponse('[getDataPredictive]',_0xf9c8('0x13d'),_0xf9c8('0x1d8')));}}else{return _0x5de3dd(msgResponse(_0xf9c8('0x1d9'),'Failure',_0xf9c8('0x1da')));}});};};Dialer[_0xf9c8('0x18')][_0xf9c8('0x1db')]=function(_0x574b4c){var _0x2ed1a7=this;return function(_0x59168a){return new BPromise(function(_0x21af7d,_0x55bfee){_[_0xf9c8('0x89')](_0x574b4c,_0x59168a[0x0]);if(checkGetDataPredictive(_0x59168a[0x0])){loggerPredictive[_0xf9c8('0x76')](JSON[_0xf9c8('0x45')](_0x59168a[0x0]));if(_0x574b4c['dialPredictiveOptimization']===_0xf9c8('0x1c8')){return _0x2ed1a7[_0xf9c8('0xc1')](_0x574b4c['id'])[_0xf9c8('0xb4')](function(_0x38a6a3){var _0x3696e4=_0x574b4c[_0xf9c8('0x4c')]-_0x38a6a3[0x0][_0xf9c8('0x1dc')];var _0x51ca5f=_0x574b4c[_0xf9c8('0x1cc')]*0x3c;var _0xb0a06=_0x59168a[0x0][_0xf9c8('0x69')]+_0x59168a[0x0][_0xf9c8('0x68')];var _0x10301a=(_0x59168a[0x0][_0xf9c8('0x67')]+_0x59168a[0x0][_0xf9c8('0x6b')]+_0x59168a[0x0][_0xf9c8('0x6a')])/_0x59168a[0x0][_0xf9c8('0x6d')];var _0x13a616=_0x574b4c[_0xf9c8('0x1be')]/0x64;_0x574b4c[_0xf9c8('0x1dd')]=_0x38a6a3[0x0][_0xf9c8('0x1dc')]||0x0;_0x574b4c[_0xf9c8('0x1c1')]=_0x10301a>0x0?_0x10301a:0x1;return _0x2ed1a7[_0xf9c8('0x1d5')](_0x3696e4,_0x51ca5f,_0xb0a06,_0x10301a,_0x13a616);})[_0xf9c8('0xb4')](function(_0x47a7ae){return _0x21af7d(_0x47a7ae);})[_0xf9c8('0xaa')](function(_0x1c44e2){return _0x55bfee(msgResponse(_0xf9c8('0x1de'),_0xf9c8('0x13d'),JSON[_0xf9c8('0x45')](_0x1c44e2)));});}if(_0x574b4c['dialPredictiveOptimization']===_0xf9c8('0x1d6')){return _0x2ed1a7[_0xf9c8('0xc1')](_0x574b4c['id'])[_0xf9c8('0xb4')](function(_0x20e9a0){var _0x2e1b71=_0x574b4c[_0xf9c8('0x4c')]-_0x20e9a0[0x0]['outboundQueuePauses'];var _0x3e60fb=_0x574b4c[_0xf9c8('0x1cc')]*0x3c;var _0x174dc4=_0x59168a[0x0][_0xf9c8('0x69')]+_0x59168a[0x0][_0xf9c8('0x68')];var _0x3f8d65=(_0x59168a[0x0][_0xf9c8('0x67')]+_0x59168a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x59168a[0x0][_0xf9c8('0x6a')])/_0x59168a[0x0]['predictiveIntervalTotalCalls'];var _0x238648=_0x574b4c['dialPredictiveOptimizationPercentage']/0x64;_0x574b4c[_0xf9c8('0x1dd')]=_0x20e9a0[0x0][_0xf9c8('0x1dc')]||0x0;_0x574b4c[_0xf9c8('0x1c1')]=_0x3f8d65>0x0?_0x3f8d65:0x1;return _0x2ed1a7[_0xf9c8('0x1d7')](_0x2e1b71,_0x3e60fb,_0x174dc4,_0x3f8d65,_0x238648);})[_0xf9c8('0xb4')](function(_0x1a6f11){return _0x21af7d(_0x1a6f11);})[_0xf9c8('0xaa')](function(_0x16ce7f){return _0x55bfee(msgResponse(_0xf9c8('0x1de'),_0xf9c8('0x13d'),JSON[_0xf9c8('0x45')](_0x16ce7f)));});}}else{return _0x55bfee(msgResponse(_0xf9c8('0x1d9'),_0xf9c8('0x13d'),'check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x21d32f){var _0x549fe5=this;return function(){var _0x208c6f=0x0;var _0x3124e9=Math[_0xf9c8('0x1df')](_0x21d32f[_0xf9c8('0x85')]*0x3e8);if(_0x3124e9>0x0){_0x3124e9=_0x3124e9<0x64?0x64:_0x3124e9;loggerPredictive[_0xf9c8('0x76')](_0x21d32f[_0xf9c8('0x3b')],_0xf9c8('0x1e0'),_0x3124e9,_0xf9c8('0x46'));_0x21d32f[_0xf9c8('0x8c')]=setInterval(function(){_0x549fe5[_0xf9c8('0x8c')](_0x21d32f);loggerPredictiveCalls[_0xf9c8('0x76')](_0xf9c8('0x1e1'),_0x208c6f+=0x1);},_0x3124e9);}else{loggerPredictive[_0xf9c8('0x76')](_0x21d32f[_0xf9c8('0x3b')],_0xf9c8('0x1e2'));}};};Dialer[_0xf9c8('0x18')][_0xf9c8('0x1e3')]=function(_0x3226f0,_0x1c8024){var _0x157997=this;return function(_0x4ff847){if(_[_0xf9c8('0x75')](_0x4ff847)){if(_['isNil'](_0x1c8024[_0xf9c8('0xcf')])||!_0x1c8024[_0xf9c8('0x1e4')]){if(_0x3226f0['dialMethod']===_0xf9c8('0x1e5')){_0x3226f0[_0xf9c8('0x125')]=_[_0xf9c8('0x7f')](_0x3226f0[_0xf9c8('0x125')])?!![]:_0x3226f0[_0xf9c8('0x125')];var _0x1cfebd=uuid['v4']();_0x157997[_0xf9c8('0x22')][_0x1cfebd]=new Action(_0x3226f0,_0x1c8024,_0x1cfebd);loggerBooked['info'](_0xf9c8('0x1e6'),_0x1cfebd,_0xf9c8('0x1e7'),JSON[_0xf9c8('0x45')](_0x3226f0['queueStatusComplete']),'Queue:\x20',_0x3226f0[_0xf9c8('0x3b')]);if(_0x3226f0[_0xf9c8('0x125')]){_0x3226f0['queueStatusComplete']=![];_0x157997[_0xf9c8('0x26')][_0x157997[_0xf9c8('0x22')][_0x1cfebd][_0xf9c8('0xad')]]=[];ami[_0xf9c8('0xa8')]({'actionid':_0x1cfebd,'action':_0xf9c8('0x1e8'),'queue':_0x3226f0['name']})['catch'](function(){_0x157997['updateOriginated'](_0x3226f0);_0x157997['rescheduleContact']({'active':![],'ContactId':_0x157997['actions'][_0x1cfebd][_0xf9c8('0xcd')],'ListId':_0x157997[_0xf9c8('0x22')][_0x1cfebd]['ListId'],'VoiceQueueId':_0x157997[_0xf9c8('0x22')][_0x1cfebd]['VoiceQueueId']||undefined,'CampaignId':_0x157997['actions'][_0x1cfebd][_0xf9c8('0xd1')]||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x1e9')));delete _0x157997['actions'][_0x1cfebd];});}else{loggerBooked[_0xf9c8('0x76')]('[booked][checkContactBlack][else]',JSON[_0xf9c8('0x45')](_0x3226f0[_0xf9c8('0x125')]),_0xf9c8('0x1ea'),_0x3226f0['name']);_0x157997[_0xf9c8('0xac')](_0x3226f0);_0x157997[_0xf9c8('0xba')]({'active':![],'ContactId':_0x157997[_0xf9c8('0x22')][_0x1cfebd]['ContactId'],'ListId':_0x157997[_0xf9c8('0x22')][_0x1cfebd][_0xf9c8('0xce')],'VoiceQueueId':_0x157997[_0xf9c8('0x22')][_0x1cfebd][_0xf9c8('0xd0')]||undefined,'CampaignId':_0x157997[_0xf9c8('0x22')][_0x1cfebd][_0xf9c8('0xd1')]||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x1e9')));delete _0x157997[_0xf9c8('0x22')][_0x1cfebd];}}else{return _0x157997[_0xf9c8('0x160')](_0x3226f0,_0x1c8024);}}else{if(getDiff(_0x1c8024[_0xf9c8('0x1eb')])<_0x3226f0[_0xf9c8('0x1ec')]*0x3c){if(_0x1c8024[_0xf9c8('0x1ed')]&&!_0x1c8024['Agent'][_0xf9c8('0x1ee')]){_0x157997[_0xf9c8('0x1c')][_0xf9c8('0x127')](_0x1c8024['id'])[_0xf9c8('0x1a')](function(){_0x157997['updateOriginated'](_0x3226f0);});}else{_0x157997[_0xf9c8('0xbc')]({'active':![]},_0x1c8024['id'],0x1)[_0xf9c8('0x1a')](function(){_0x157997['updateOriginated'](_0x3226f0);});}}else{_0x3226f0[_0xf9c8('0x1ef')]+=0x1;_0x157997[_0xf9c8('0xac')](_0x3226f0);if(_0x3226f0['dialRecallInQueue']){_0x157997['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c8024[_0xf9c8('0xcd')],'ListId':_0x1c8024[_0xf9c8('0xce')],'VoiceQueueId':_0x1c8024['VoiceQueueId']||undefined,'CampaignId':_0x1c8024[_0xf9c8('0xd1')]||undefined})[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x1f0')));_0x157997['createHistory'](createObjHistory(_0x3226f0,_0x1c8024,_0xf9c8('0x1f1'),0x17,'RecallInQueue'))[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0x1f2')));}else{_0x157997[_0xf9c8('0xcb')](createObjHistory(_0x3226f0,_0x1c8024,_0xf9c8('0x1f3'),0x16,_0xf9c8('0x1f4')),_0xf9c8('0x1f5'),_0xf9c8('0x1f6'));}}}}else{_0x3226f0[_0xf9c8('0x5d')]+=0x1;_0x157997[_0xf9c8('0xcb')](createObjHistory(_0x3226f0,_0x1c8024,'BLACKLIST',0xd,_0xf9c8('0x1f7')),'[Originate][historyBlacklist]',_0xf9c8('0x1f8'));throw _0xf9c8('0x1f9');}};};Dialer[_0xf9c8('0x18')][_0xf9c8('0x156')]=function(_0x5c3201){var _0x440dbc=this;var _0x5b0bd8=_0x5c3201[_0xf9c8('0x1fa')]-_0x5c3201[_0xf9c8('0x6e')]-_0x5c3201[_0xf9c8('0xbe')];emitCampaignSummary(_0x5c3201);if(_0x5b0bd8>0x0){if(_0x5b0bd8>this[_0xf9c8('0x21')]){_0x5b0bd8=this[_0xf9c8('0x21')];}_0x5c3201['temp']+=_0x5b0bd8;this[_0xf9c8('0xc0')](_0x5c3201['id'],_0x5b0bd8,_0x5c3201[_0xf9c8('0x1fb')],_0x5c3201)['then'](function(_0x53ef72){_0x5c3201[_0xf9c8('0xbe')]-=_0x5b0bd8;_0x5c3201[_0xf9c8('0xbe')]=_0x5c3201[_0xf9c8('0xbe')]>0x0?_0x5c3201[_0xf9c8('0xbe')]:0x0;if(!checkContactEmpty(_0x53ef72)){_0x5c3201[_0xf9c8('0x39')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xf9c8('0x1fc')+_0x5c3201[_0xf9c8('0x3b')]);}else{_0x5c3201[_0xf9c8('0x6e')]+=_0x53ef72['length'];_0x5c3201[_0xf9c8('0x39')]=_0xf9c8('0x1fd');for(var _0x32eae9=0x0;_0x32eae9<_0x53ef72[_0xf9c8('0x94')];_0x32eae9+=0x1){_0x5c3201[_0xf9c8('0x1fe')]+=0x1;if(_[_0xf9c8('0xa7')](_0x53ef72[_0x32eae9])||_[_0xf9c8('0xa7')](_0x53ef72[_0x32eae9][_0xf9c8('0x164')])||_['isNil'](_0x53ef72[_0x32eae9][_0xf9c8('0x164')][_0xf9c8('0x165')])){_0x440dbc[_0xf9c8('0xc9')](_0xf9c8('0x1ff'),_0x5c3201,_0x53ef72[_0x32eae9]);}else{_0x440dbc['checkIsBlackListIvr'](_[_0xf9c8('0xcc')](_0x53ef72[_0x32eae9],['CampaignId',_0xf9c8('0x200')]))[_0xf9c8('0xb4')](_0x440dbc['checkContactBlack'](_0x5c3201,_0x53ef72[_0x32eae9]))[_0xf9c8('0xaa')](_0x440dbc[_0xf9c8('0xc8')](_0xf9c8('0x201'),_0x5c3201));}}}})[_0xf9c8('0xaa')](loggerGetContactDialer(_0xf9c8('0x202'),_0x5c3201,_0x5b0bd8));}};Dialer[_0xf9c8('0x18')][_0xf9c8('0x154')]=function(_0xd4ac72,_0x3c0a59){var _0x4fa2e0=this;var _0xcf1bbe=[];var _0x420c3e=_0x3c0a59>=0x1?_0x3c0a59:0x1;if(_0xd4ac72[_0xf9c8('0x57')]===_0xf9c8('0x1e5')){_0x420c3e=0x1;}var _0x167d9b=Math[_0xf9c8('0x1df')](_0xd4ac72[_0xf9c8('0x9c')]*_0x420c3e)-_0xd4ac72[_0xf9c8('0x6e')]-_0xd4ac72[_0xf9c8('0xbe')];emitVoiceQueueSummary(_0xd4ac72);if(_0xd4ac72['dialLimitQueue']>0x0){var _0x3f7d48=_0xd4ac72['dialLimitQueue']-_0xd4ac72[_0xf9c8('0x6e')]-_0xd4ac72[_0xf9c8('0x51')]-_0xd4ac72['temp']-_0xd4ac72[_0xf9c8('0x4d')];if(_0x167d9b>_0x3f7d48){_0x167d9b=_0x3f7d48;}}if(_0x167d9b>0x0){if(_0xd4ac72[_0xf9c8('0x57')]===_0xf9c8('0x1e5')){_0x167d9b=0x1;}if(_0x167d9b>this[_0xf9c8('0x21')]){_0x167d9b=this['maxNumberOriginate'];}_0xd4ac72[_0xf9c8('0xbe')]+=_0x167d9b;for(var _0x540d62 in this['agents']){if(typeof this['agents'][_0x540d62]!==_0xf9c8('0x95')){if(this[_0xf9c8('0x1f')][_0x540d62][_0xf9c8('0xa2')]==='not_inuse'&&this[_0xf9c8('0x1f')][_0x540d62][_0xf9c8('0xa9')]==='reachable'){_0xcf1bbe['push'](this['agents'][_0x540d62]['id']);}}}this[_0xf9c8('0xbd')](_0xd4ac72['id'],_0xcf1bbe,_0x167d9b,_0xd4ac72[_0xf9c8('0x1fb')],_0xd4ac72)['then'](function(_0x4c97d5){_0xd4ac72['temp']-=_0x167d9b;_0xd4ac72[_0xf9c8('0xbe')]=_0xd4ac72['temp']>0x0?_0xd4ac72[_0xf9c8('0xbe')]:0x0;if(!checkContactEmpty(_0x4c97d5)){_0x4fa2e0[_0xf9c8('0xb0')](_0xd4ac72)[_0xf9c8('0xb4')](sendMessageReschedule(_0xd4ac72))[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xb2')));}else{_0xd4ac72['originated']+=_0x4c97d5[_0xf9c8('0x94')];_0xd4ac72['message']=_0xd4ac72[_0xf9c8('0x57')]===_0xf9c8('0x1e5')?_0xf9c8('0x203'):'RUNNING';for(var _0x92c5d7=0x0;_0x92c5d7<_0x4c97d5[_0xf9c8('0x94')];_0x92c5d7+=0x1){if(_[_0xf9c8('0xa7')](_0x4c97d5[_0x92c5d7])||_[_0xf9c8('0xa7')](_0x4c97d5[_0x92c5d7][_0xf9c8('0x164')])||_[_0xf9c8('0xa7')](_0x4c97d5[_0x92c5d7]['Contact'][_0xf9c8('0x165')])){_0x4fa2e0[_0xf9c8('0xc9')]('[actionOriginate]\x20',_0xd4ac72,_0x4c97d5[_0x92c5d7]);}else{_0x4fa2e0[_0xf9c8('0xb3')](_[_0xf9c8('0xcc')](_0x4c97d5[_0x92c5d7],[_0xf9c8('0xd0'),_0xf9c8('0x200')]))[_0xf9c8('0xb4')](_0x4fa2e0['checkContactBlack'](_0xd4ac72,_0x4c97d5[_0x92c5d7]))[_0xf9c8('0xaa')](_0x4fa2e0[_0xf9c8('0xc8')](_0xf9c8('0x1ff'),_0xd4ac72));}}}})[_0xf9c8('0xaa')](loggerGetContactDialer(_0xf9c8('0x204'),_0xd4ac72,_0x167d9b));}};Dialer[_0xf9c8('0x18')]['handlePredictive']=function(_0x5157bf){if(_0x5157bf[_0xf9c8('0x205')]>0x0){var _0x4bf32e=_0x5157bf[_0xf9c8('0x205')]-_0x5157bf[_0xf9c8('0x6e')]-_0x5157bf['talking'];if(_0x4bf32e>0x0){this[_0xf9c8('0x206')](_0x5157bf);}else{loggerPredictiveCalls[_0xf9c8('0x76')]('[handlePredictive][limitChannel]');}}else{this[_0xf9c8('0x206')](_0x5157bf);}};Dialer[_0xf9c8('0x18')][_0xf9c8('0x206')]=function(_0x56af9f){var _0x19295f=this;var _0x3cd08b=[];_0x56af9f[_0xf9c8('0x6e')]+=0x1;for(var _0x361f03 in this[_0xf9c8('0x1f')]){if(typeof this['agents'][_0x361f03]!==_0xf9c8('0x95')){if(this[_0xf9c8('0x1f')][_0x361f03]['state']===_0xf9c8('0x207')&&this[_0xf9c8('0x1f')][_0x361f03][_0xf9c8('0xa9')]===_0xf9c8('0x208')){_0x3cd08b['push'](this['agents'][_0x361f03]['id']);}}}this[_0xf9c8('0xbd')](_0x56af9f['id'],_0x3cd08b,0x1,_0x56af9f[_0xf9c8('0x1fb')],_0x56af9f)['then'](function(_0x10bdd3){if(!checkContactEmpty(_0x10bdd3)){checkContactLowerLimitOriginate(_0x56af9f,0x1,0x0);_0x19295f['countReScheduled'](_0x56af9f)[_0xf9c8('0xb4')](sendMessageReschedule(_0x56af9f))[_0xf9c8('0xaa')](loggerCatch(_0xf9c8('0xb2')));}else{_0x56af9f['message']=_0xf9c8('0x1fd');if(_[_0xf9c8('0xa7')](_0x10bdd3[0x0])||_[_0xf9c8('0xa7')](_0x10bdd3[0x0][_0xf9c8('0x164')])||_[_0xf9c8('0xa7')](_0x10bdd3[0x0]['Contact'][_0xf9c8('0x165')])){_0x19295f[_0xf9c8('0xc9')](_0xf9c8('0x1ff'),_0x56af9f,_0x10bdd3[0x0]);}else{_0x19295f[_0xf9c8('0xb3')](_[_0xf9c8('0xcc')](_0x10bdd3[0x0],[_0xf9c8('0xd0'),_0xf9c8('0x200')]))[_0xf9c8('0xb4')](_0x19295f[_0xf9c8('0x1e3')](_0x56af9f,_0x10bdd3[0x0]))[_0xf9c8('0xaa')](_0x19295f[_0xf9c8('0xc8')](_0xf9c8('0x209'),_0x56af9f));}}})[_0xf9c8('0xaa')](loggerGetContactDialer('[getContactDialerPredictive]',_0x56af9f,0x1));emitVoiceQueueSummary(_0x56af9f);};Dialer['prototype'][_0xf9c8('0x1d5')]=function(_0xfd59d8,_0x59374d,_0x1b472a,_0x12c1dc,_0x324fe2,_0x3d0f3a){loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x20a'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfd59d8);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x20b'),_0x59374d);loggerPredictive['info'](_0xf9c8('0x20c'),_0x1b472a);loggerPredictive['info'](_0xf9c8('0x20d'),_0x12c1dc);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x20e'),_0x324fe2);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x7d'));return new BPromise(function(_0x4d0f8f,_0x33b75e){if(_0xfd59d8<=0x0||isNaN(_0xfd59d8)){return _0x33b75e(msgResponse(_0xf9c8('0x20f'),'Error',_0xf9c8('0x210')+_0xfd59d8));}if(_0x1b472a<=0x0||isNaN(_0x1b472a)){return _0x33b75e(msgResponse(_0xf9c8('0x20f'),'Error',_0xf9c8('0x211')+_0x1b472a));}if(_0x12c1dc<=0x0||isNaN(_0x12c1dc)){return _0x33b75e(msgResponse('[abandonmentRate]',_0xf9c8('0x44'),_0xf9c8('0x212')+_0x12c1dc));}if(_0x59374d<=0x0||isNaN(_0x59374d)){return _0x33b75e(msgResponse(_0xf9c8('0x20f'),_0xf9c8('0x44'),_0xf9c8('0x213')+_0x59374d));}if(_0x324fe2<=0x0||isNaN(_0x324fe2)){return _0x33b75e(msgResponse(_0xf9c8('0x20f'),_0xf9c8('0x44'),_0xf9c8('0x214')+_0x324fe2));}_0x3d0f3a=_0x3d0f3a||0x0;var _0x13dd61=0x1/_0x1b472a;var _0x18bc6e=0x0;var _0xba65c8=0x0;var _0x4b6604=0x0;var _0x526e9b=0x0;for(var _0x300068=0x0;_0x4b6604<_0x324fe2;_0x300068+=0x1){_0xba65c8=_0x300068/_0x59374d;_0x18bc6e=(_0x12c1dc*_0xba65c8+_0x3d0f3a)/_0x13dd61;_0x4b6604=erlangb(_0x18bc6e,_0xfd59d8);_0x526e9b=_0x18bc6e/_0xfd59d8*(0x1-erlangb(_0x18bc6e,_0xfd59d8));}return _0x4d0f8f({'erlangCalls':_0x300068,'erlangCallToSecond':_0x59374d/_0x300068,'erlangAbandonmentRate':_0x4b6604,'erlangBusyFactor':_0x526e9b});});};Dialer['prototype'][_0xf9c8('0x1d7')]=function(_0x48cd6b,_0x440a9d,_0x5c28ee,_0x566543,_0x304989,_0x12a095){loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x215'));loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x216'),_0x48cd6b);loggerPredictive[_0xf9c8('0x76')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x440a9d);loggerPredictive[_0xf9c8('0x76')]('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',_0x5c28ee);loggerPredictive[_0xf9c8('0x76')](_0xf9c8('0x20d'),_0x566543);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x304989);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x2515cb,_0x43a5ff){if(_0x48cd6b<=0x0||isNaN(_0x48cd6b)){return _0x43a5ff(msgResponse(_0xf9c8('0x217'),'Error',_0xf9c8('0x210')+_0x48cd6b));}if(_0x5c28ee<=0x0||isNaN(_0x5c28ee)){return _0x43a5ff(msgResponse(_0xf9c8('0x217'),'Error',_0xf9c8('0x211')+_0x5c28ee));}if(_0x566543<=0x0||isNaN(_0x566543)){return _0x43a5ff(msgResponse('[busyFactor]',_0xf9c8('0x44'),_0xf9c8('0x212')+_0x566543));}if(_0x440a9d<=0x0||isNaN(_0x440a9d)){return _0x43a5ff(msgResponse('[busyFactor]','Error',_0xf9c8('0x213')+_0x440a9d));}if(_0x304989<=0x0||isNaN(_0x304989)){return _0x43a5ff(msgResponse('[busyFactor]',_0xf9c8('0x44'),_0xf9c8('0x218')+_0x304989));}_0x12a095=_0x12a095||0x0;var _0xc96aff=0x1/_0x5c28ee;var _0x23c46d=0x0;var _0x56c85a=0x0;var _0x171334=0x0;var _0x4589b3=0x0;for(var _0x5045c8=0x0;_0x4589b3<_0x304989;_0x5045c8+=0x1){_0x56c85a=_0x5045c8/_0x440a9d;_0x23c46d=(_0x566543*_0x56c85a+_0x12a095)/_0xc96aff;_0x171334=erlangb(_0x23c46d,_0x48cd6b);_0x4589b3=_0x23c46d/_0x48cd6b*(0x1-erlangb(_0x23c46d,_0x48cd6b));}return _0x2515cb({'erlangCalls':_0x5045c8,'erlangCallToSecond':_0x440a9d/_0x5045c8,'erlangAbandonmentRate':_0x171334,'erlangBusyFactor':_0x4589b3});});};module[_0xf9c8('0x219')]=Dialer; \ No newline at end of file +var _0x3c40=['voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','busy','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','getVoiceQueueRtPauses','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','dialLimitQueue','[countReScheduled]\x20','checkIsBlackList','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginate]\x20','[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]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','milliseconds','diff','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','stringify','md5','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','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','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','History\x20information\x20are\x20empty','---------\x20ErlangB\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','merge','startPredictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','isTrunkReachable','active','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countbusyretry','dialGlobalMaxRetry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','strategy','roundrobin','locked','agents','stateinterface','idHopper','paused','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','TIMEZONE_UNKNOW','isArray','iftime\x20%s,%s','interval','timezones','indexOf','true','push','command','content','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','power','dialPowerLevel','handlePower','Queue','method\x20not\x20recognized','handleIvr','syncQueueSummary','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','launchHandleIvr','\x5cw{0,','pow','replace','random','match','actionOriginate','originate'];(function(_0x418d65,_0x69d05c){var _0x3bb5e4=function(_0x43b92b){while(--_0x43b92b){_0x418d65['push'](_0x418d65['shift']());}};_0x3bb5e4(++_0x69d05c);}(_0x3c40,0xbc));var _0x03c4=function(_0x338338,_0x782573){_0x338338=_0x338338-0x0;var _0x3cf852=_0x3c40[_0x338338];return _0x3cf852;};'use strict';var util=require(_0x03c4('0x0'));var _=require(_0x03c4('0x1'));var BPromise=require(_0x03c4('0x2'));var uuid=require(_0x03c4('0x3'));var moment=require(_0x03c4('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x03c4('0x5'));var ut=require(_0x03c4('0x6'));var config=require(_0x03c4('0x7'));var logger=require(_0x03c4('0x8'))('dialer');var loggerBooked=require(_0x03c4('0x8'))(_0x03c4('0x9'));var loggerPredictive=require(_0x03c4('0x8'))(_0x03c4('0xa'));var loggerPredictiveCalls=require(_0x03c4('0x8'))(_0x03c4('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config[_0x03c4('0xc')]=_[_0x03c4('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x03c4('0xc')]));var cmHopper=require(_0x03c4('0xe'));var cmHopperHistory=require(_0x03c4('0xf'));var cmHopperBlack=require(_0x03c4('0x10'));var voiceQueueRt=require(_0x03c4('0x11'));var Action=require(_0x03c4('0x12'));var History=require(_0x03c4('0x13'));var Final=require(_0x03c4('0x14'));var AgentComplete=require(_0x03c4('0x15'));var QueueCallerAbandon=require(_0x03c4('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0x03c4('0x17')][_0x03c4('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0x03c4('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x03c4('0x1a')][_0x03c4('0x1b')]=function(_0x10288c){this[_0x03c4('0x1c')]=this[_0x03c4('0x1c')]?this['tail'][_0x03c4('0x1d')](_0x10288c):_0x10288c();};function Dialer(_0x36e3de,_0x2173fa){this[_0x03c4('0x1e')]=new Sequence();this[_0x03c4('0x1f')]=_0x2173fa;this[_0x03c4('0x20')]=_0x36e3de['voiceQueues'];this[_0x03c4('0x21')]=_0x36e3de[_0x03c4('0x21')];this['agents']=_0x36e3de['agents'];this[_0x03c4('0x22')]=_0x36e3de[_0x03c4('0x22')];this[_0x03c4('0x23')]=config['maxNumberOriginate']||0x2;this[_0x03c4('0x24')]={};this[_0x03c4('0x25')]={};this[_0x03c4('0x26')]={};this[_0x03c4('0x27')]={};this[_0x03c4('0x28')]={};this['startPredictive']={};this['startProgressive']={};this[_0x03c4('0x29')]={};this[_0x03c4('0x2a')]={};this['queueBookedRR']={};ami['on'](_0x03c4('0x2b'),this[_0x03c4('0x2c')][_0x03c4('0x2d')](this));ami['on'](_0x03c4('0x2e'),this[_0x03c4('0x2f')]['bind'](this));ami['on'](_0x03c4('0x30'),this[_0x03c4('0x31')]['bind'](this));ami['on'](_0x03c4('0x32'),this['syncAgentComplete']['bind'](this));ami['on'](_0x03c4('0x33'),this['syncQueueSummary'][_0x03c4('0x2d')](this));ami['on'](_0x03c4('0x34'),this[_0x03c4('0x35')][_0x03c4('0x2d')](this));ami['on'](_0x03c4('0x36'),this[_0x03c4('0x37')][_0x03c4('0x2d')](this));ami['on']('varset',this[_0x03c4('0x38')]['bind'](this));ami['on'](_0x03c4('0x39'),this['syncQueueMember'][_0x03c4('0x2d')](this));ami['on'](_0x03c4('0x3a'),this[_0x03c4('0x3b')][_0x03c4('0x2d')](this));this['loopCampaigns']();this[_0x03c4('0x3c')]();}function isNotNull(_0x2279a5){return _0x2279a5!==null&&!_[_0x03c4('0x3d')](_0x2279a5);}function checkIsLoggedIn(_0xc96891,_0x4f2a99){return function(){if(_0x4f2a99<=0x0){_0xc96891[_0x03c4('0x3e')]='AGENTS_NOT_LOGGED';throw _0xc96891[_0x03c4('0x3f')]+_0x03c4('0x40');}};}function isActive(_0x519243){return _0x519243;}function checkIsActive(_0x5dbaff,_0x57c581){return function(){if(!isActive(_0x57c581)){_0x5dbaff[_0x03c4('0x3e')]=_0x03c4('0x41');throw _0x5dbaff[_0x03c4('0x3f')]+'\x20NOT\x20Active';}};}function checkInterval(_0x1a7b6f){return function(){if(!isNotNull(_0x1a7b6f[_0x03c4('0x42')])){_0x1a7b6f[_0x03c4('0x3e')]=_0x03c4('0x43');throw _0x1a7b6f['name']+_0x03c4('0x44');}if(!isNotNull(_0x1a7b6f[_0x03c4('0x42')]['Intervals'])){_0x1a7b6f[_0x03c4('0x3e')]='INTERVAL_IS_NULL';throw _0x1a7b6f[_0x03c4('0x3f')]+_0x03c4('0x44');}if(!isNotNull(_[_0x03c4('0x45')](_0x1a7b6f[_0x03c4('0x42')][_0x03c4('0x46')]))){_0x1a7b6f[_0x03c4('0x3e')]=_0x03c4('0x43');throw _0x1a7b6f[_0x03c4('0x3f')]+_0x03c4('0x44');}};}function msgResponse(_0x33a5a5,_0x1f8b02,_0x198602){return{'action':_0x33a5a5,'response':_0x1f8b02,'message':_0x198602,'stack':_0x198602};}function myreject(_0x1929b9){return function(_0x56f68b){return _0x1929b9(msgResponse(_0x03c4('0x47'),_0x03c4('0x48'),JSON['stringify'](_0x56f68b)));};}function getSeconds(_0x63e28f,_0x6fdcc6){var _0x1341e7=moment(_0x63e28f)[_0x03c4('0x49')](0x0);var _0x1e8b0f=moment(_0x6fdcc6)[_0x03c4('0x49')](0x0);return _0x1341e7[_0x03c4('0x4a')](_0x1e8b0f,'seconds');}function emit(_0x2d26b3,_0x32de1e,_0x1d11b1){io['to'](_0x2d26b3)[_0x03c4('0x4b')](_0x32de1e,_0x1d11b1);}function emitVoiceQueueSummary(_0x42c772){if(_0x42c772[_0x03c4('0x4c')]===_0x03c4('0x4d')){var _0x251ac1={'id':_0x42c772['id'],'name':_0x42c772[_0x03c4('0x3f')],'strategy':_0x42c772['strategy'],'answered':_0x42c772[_0x03c4('0x4e')],'available':_0x42c772[_0x03c4('0x4f')],'loggedIn':_0x42c772[_0x03c4('0x50')],'pTalking':_0x42c772[_0x03c4('0x51')],'sumBillable':_0x42c772[_0x03c4('0x52')],'sumDuration':_0x42c772[_0x03c4('0x53')],'sumHoldTime':_0x42c772[_0x03c4('0x54')]||0x0,'talking':_0x42c772[_0x03c4('0x55')],'total':_0x42c772[_0x03c4('0x56')],'type':_0x42c772[_0x03c4('0x4c')],'unmanaged':_0x42c772[_0x03c4('0x57')],'abandoned':_0x42c772['abandoned'],'waiting':_0x42c772[_0x03c4('0x58')],'loggedInDb':_0x42c772[_0x03c4('0x59')],'dialActive':_0x42c772['dialActive'],'dialMethod':_0x42c772[_0x03c4('0x5a')],'dialOriginateCallerIdName':_0x42c772['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x42c772[_0x03c4('0x5b')],'dialOriginateTimeout':_0x42c772[_0x03c4('0x5c')],'dialPrefix':_0x42c772[_0x03c4('0x5d')],'outboundAnswerAgiCallsDay':_0x42c772[_0x03c4('0x5e')],'outboundAnswerCallsDay':_0x42c772[_0x03c4('0x5f')],'outboundBlacklistCallsDay':_0x42c772['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x42c772[_0x03c4('0x60')],'outboundCongestionCallsDay':_0x42c772[_0x03c4('0x61')],'outboundDropCallsDayACS':_0x42c772['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x42c772[_0x03c4('0x62')],'outboundDropCallsDayTimeout':_0x42c772[_0x03c4('0x63')],'outboundNoAnswerCallsDay':_0x42c772[_0x03c4('0x64')],'outboundNoSuchCallsDay':_0x42c772[_0x03c4('0x65')],'outboundOriginateFailureCallsDay':_0x42c772['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x42c772[_0x03c4('0x66')],'outboundRejectCallsDay':_0x42c772[_0x03c4('0x67')],'outboundUnknownCallsDay':_0x42c772[_0x03c4('0x68')],'predictiveIntervalAnsweredCalls':_0x42c772[_0x03c4('0x69')],'predictiveIntervalAvgHoldtime':_0x42c772[_0x03c4('0x6a')],'predictiveIntervalAvgTalktime':_0x42c772[_0x03c4('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x42c772[_0x03c4('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x42c772[_0x03c4('0x6d')],'predictiveIntervalErlangCalls':_0x42c772[_0x03c4('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x42c772[_0x03c4('0x6f')],'predictiveIntervalHitRate':_0x42c772[_0x03c4('0x70')],'predictiveIntervalMultiplicativeFactor':_0x42c772[_0x03c4('0x71')],'predictiveIntervalPauses':_0x42c772[_0x03c4('0x72')],'predictiveIntervalAvailable':_0x42c772['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x42c772[_0x03c4('0x73')],'message':_0x42c772[_0x03c4('0x3e')],'originated':_0x42c772[_0x03c4('0x74')],'erlangCalls':_0x42c772[_0x03c4('0x75')],'erlangCallToSecond':_0x42c772['erlangCallToSecond'],'erlangAbandonmentRate':_0x42c772[_0x03c4('0x76')],'erlangBusyFactor':_0x42c772[_0x03c4('0x77')],'startPredictive':_0x42c772['startPredictive'],'startProgressive':_0x42c772[_0x03c4('0x78')]};if(_0x42c772['Trunk']){_0x251ac1[_0x03c4('0x79')]={'id':_0x42c772[_0x03c4('0x79')]['id'],'name':_0x42c772['Trunk']['name'],'active':_0x42c772[_0x03c4('0x79')]['active'],'callerid':_0x42c772[_0x03c4('0x79')][_0x03c4('0x7a')]};}if(_0x42c772[_0x03c4('0x42')]){_0x251ac1[_0x03c4('0x42')]={'id':_0x42c772['Interval']['id'],'name':_0x42c772[_0x03c4('0x42')]['name']};}var _0x13300b=md5(JSON[_0x03c4('0x7b')](_0x251ac1));if(_0x42c772['md5']!==_0x13300b){_0x42c772[_0x03c4('0x7c')]=_0x13300b;emit(util[_0x03c4('0x7d')](_0x03c4('0x7e'),_0x251ac1['name']),_0x03c4('0x7f'),_0x251ac1);}}}function emitCampaignSummary(_0xc19adf){if(_0xc19adf[_0x03c4('0x4c')]==='ivr'){emit(util[_0x03c4('0x7d')](_0x03c4('0x80'),_0xc19adf['name']),_0x03c4('0x81'),_0xc19adf);}}function checkGetDataPredictive(_0x14f257){if(isNotNull(_0x14f257)&&!_['isEmpty'](_0x14f257)){loggerPredictive[_0x03c4('0x82')](_0x03c4('0x83'));loggerPredictive[_0x03c4('0x82')](_0x03c4('0x84'),_0x14f257[_0x03c4('0x73')]);loggerPredictive[_0x03c4('0x82')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14f257[_0x03c4('0x69')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x85'),_0x14f257[_0x03c4('0x6d')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x86'),_0x14f257[_0x03c4('0x6c')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x87'),_0x14f257[_0x03c4('0x6a')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x88'),_0x14f257[_0x03c4('0x6b')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x89'));if(_0x14f257[_0x03c4('0x73')]>0x0){if(!_[_0x03c4('0x3d')](_0x14f257[_0x03c4('0x6b')])&&_0x14f257[_0x03c4('0x6b')]>0x0){return!![];}loggerPredictive[_0x03c4('0x82')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x14f257[_0x03c4('0x6a')])&&_0x14f257['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x03c4('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x03c4('0x82')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x03c4('0x82')](_0x03c4('0x8a'));}return![];}function mergeDataErlangB(_0x772371){return function(_0x149ba7){loggerPredictive[_0x03c4('0x82')](_0x03c4('0x8b'));loggerPredictive[_0x03c4('0x82')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x149ba7[_0x03c4('0x75')]);loggerPredictive['info'](_0x03c4('0x8c'),_0x149ba7[_0x03c4('0x8d')]);loggerPredictive[_0x03c4('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x149ba7['erlangAbandonmentRate']);loggerPredictive[_0x03c4('0x82')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x149ba7['erlangBusyFactor']);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x8e'),_0x149ba7['erlangAbandonmentRate']);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x89'));_[_0x03c4('0x8f')](_0x772371,_0x149ba7);};}function getDiff(_0x4335f7){var _0x18326f=moment()[_0x03c4('0x49')](0x0);var _0x42767a=moment(_0x4335f7)[_0x03c4('0x49')](0x0);return _0x18326f['diff'](_0x42767a,'seconds');}function ifInterval(_0x180736,_0x228c5b){if(_[_0x03c4('0x3d')](_0x228c5b)){return![];}return getDiff(_0x228c5b)<_0x180736*0x3c;}function freeVariablesPredictive(_0x5811f5){if(isNotNull(_0x5811f5)){if(!_[_0x03c4('0x3d')](_0x5811f5['startProgressive'])){_0x5811f5[_0x03c4('0x78')]=undefined;loggerPredictive[_0x03c4('0x82')](_0x5811f5[_0x03c4('0x3f')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x03c4('0x3d')](_0x5811f5[_0x03c4('0x90')])){_0x5811f5[_0x03c4('0x90')]=undefined;loggerPredictive[_0x03c4('0x82')](_0x5811f5[_0x03c4('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x5811f5[_0x03c4('0x91')])){clearInterval(_0x5811f5[_0x03c4('0x91')]);_0x5811f5[_0x03c4('0x91')]=undefined;loggerPredictive[_0x03c4('0x82')](_0x5811f5['name'],_0x03c4('0x92'));}}}function erlangb(_0x535987,_0x7b3a84){if(_0x7b3a84===0x0){return 0x0;}var _0x19a97d=0x1;for(var _0x10a86c=0x1;_0x10a86c<=_0x7b3a84;_0x10a86c+=0x1){_0x19a97d=0x1+_0x19a97d*_0x10a86c/_0x535987;}return 0x1/_0x19a97d;}function isVoiceQueueOutbound(_0x5c98e2){return _0x5c98e2==='outbound';}function isNotPreview(_0x57220f){return _0x57220f!==_0x03c4('0x1f');}function isCampaignIvr(_0x563ee4){return _0x563ee4===_0x03c4('0x93');}function getCallerId(_0x44fad6,_0x2d5640,_0x5bc243){if(!_[_0x03c4('0x3d')](_0x5bc243)&&typeof _0x5bc243===_0x03c4('0x94')&&!_[_0x03c4('0x45')](_0x5bc243)){if(!_['isUndefined'](_0x2d5640)&&typeof _0x2d5640===_0x03c4('0x94')&&!_[_0x03c4('0x45')](_0x2d5640)){return util[_0x03c4('0x7d')](_0x03c4('0x95'),_0x2d5640,_0x5bc243);}return util[_0x03c4('0x7d')](_0x03c4('0x95'),_0x5bc243,_0x5bc243);}if(!_[_0x03c4('0x3d')](_0x44fad6)&&typeof _0x44fad6===_0x03c4('0x94')&&!_['isEmpty'](_0x44fad6)){return _0x44fad6;}return _0x03c4('0x96');}function loggerCatchQueueSummary(_0x4bf561,_0x2d0dee){return function(_0x3580e4){freeVariablesPredictive(_0x2d0dee);emitVoiceQueueSummary(_0x2d0dee);emitCampaignSummary(_0x2d0dee);loggerSyncQueueSummary[_0x03c4('0x97')](_0x4bf561,util[_0x03c4('0x98')](_0x3580e4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x10e7f2,_0x4e7796){return function(_0x295ec2){loggerPredictive['error'](_0x4e7796[_0x03c4('0x3f')],_0x10e7f2);loggerPredictive[_0x03c4('0x97')](_0x295ec2[_0x03c4('0x99')]);freeVariablesPredictive(_0x4e7796);};}function loggerCatch(_0x5b3675){return function(_0x456eb9){logger[_0x03c4('0x97')](_0x5b3675,util[_0x03c4('0x98')](_0x456eb9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2cf849){return _0x2cf849&&!_[_0x03c4('0x3d')](_0x2cf849)&&_0x2cf849['length']>0x0;}function decremetOriginate(_0x2bc56f){if(!_['isUndefined'](_0x2bc56f)&&_0x2bc56f!==null){if(typeof _0x2bc56f[_0x03c4('0x74')]!==_0x03c4('0x9a')){if(_0x2bc56f[_0x03c4('0x74')]>0x0){_0x2bc56f['originated']-=0x1;}else{logger[_0x03c4('0x97')](_0x03c4('0x9b'));}}}else{logger[_0x03c4('0x97')](_0x03c4('0x9c'));}}function checkContactLowerLimitOriginate(_0x74782e,_0x31b3fc,_0x53def7){if(_0x31b3fc>_0x53def7){for(var _0x41f86d=0x0;_0x41f86d<_0x31b3fc-_0x53def7;_0x41f86d+=0x1){decremetOriginate(_0x74782e);}}}function loggerGetContactDialer(_0x1ad3ae,_0x11a3ac,_0x1b05be){return function(_0x27e2ac){checkContactLowerLimitOriginate(_0x11a3ac,_0x1b05be,0x0);logger['error'](_0x1ad3ae,util[_0x03c4('0x98')](_0x27e2ac,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x568785){return function(_0x4db8f5){if(isNotNull(_0x4db8f5)&&isNotNull(_0x4db8f5[0x0])){if(_0x4db8f5[0x0]['contactsRescheduled']>0x0){_0x568785[_0x03c4('0x3e')]='RESCHEDULED_CONTACTS';logger[_0x03c4('0x82')](_0x03c4('0x9d')+_0x568785[_0x03c4('0x3f')],_0x4db8f5[0x0][_0x03c4('0x9e')],_0x03c4('0x9f'));}else{_0x568785[_0x03c4('0x3e')]=_0x03c4('0xa0');logger['info']('[getContactDialer2][Empty]'+_0x568785['name']);}}};}function notSendMessagesQueue(_0x189154){if(_0x189154['sendMessageOneNotActive']){freeVariablesPredictive(_0x189154);if(_0x189154[_0x03c4('0x74')]===0x0&&_0x189154['talking']===0x0&&_0x189154[_0x03c4('0x58')]===0x0&&(_0x189154[_0x03c4('0x51')]||0x0)===0x0){_0x189154[_0x03c4('0xa1')]=![];_0x189154[_0x03c4('0x4f')]=0x0;_0x189154[_0x03c4('0x3e')]=_0x03c4('0x41');loggerSyncQueueSummary[_0x03c4('0x97')](_0x03c4('0xa2'),_0x189154[_0x03c4('0x3f')],_0x03c4('0xa3'));}else{_0x189154[_0x03c4('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x03c4('0x97')](_0x03c4('0xa2'),_0x189154[_0x03c4('0x3f')],_0x03c4('0xa4'));}emitVoiceQueueSummary(_0x189154);}}function notSendMessagesCampaign(_0x3c38ca){if(_0x3c38ca['sendMessageOneNotActive']){if(_0x3c38ca[_0x03c4('0x74')]===0x0){_0x3c38ca[_0x03c4('0xa1')]=![];_0x3c38ca[_0x03c4('0x3e')]=_0x03c4('0x41');loggerSyncQueueSummary[_0x03c4('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3c38ca[_0x03c4('0x3f')],_0x03c4('0xa3'));}else{_0x3c38ca[_0x03c4('0x3e')]=_0x03c4('0xa5');loggerSyncQueueSummary[_0x03c4('0x97')](_0x03c4('0xa6'),_0x3c38ca[_0x03c4('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x3c38ca);}}function createObjHistory(_0x109bb8,_0x384438,_0x1b1fae,_0x41ccf0,_0x42a890){_0x109bb8[_0x03c4('0x3e')]=_0x1b1fae;var _0x5e083a=new Action(_0x109bb8,_0x384438);var _0x5c254c=new History(_0x5e083a);_0x5c254c[_0x03c4('0xa7')]=_0x41ccf0;_0x5c254c[_0x03c4('0xa8')]=_0x42a890;_0x5c254c[_0x03c4('0xa9')]=_0x5e083a[_0x03c4('0xaa')];return _0x5c254c;}Dialer[_0x03c4('0x1a')][_0x03c4('0x3c')]=function(){var _0x5efbed=this;setInterval(function(){_0x5efbed[_0x03c4('0xab')](_0x5efbed[_0x03c4('0x27')],_0x03c4('0xac'));_0x5efbed['clearZombieChannels'](_0x5efbed[_0x03c4('0x25')],'[actions]');},0x32c8);};Dialer[_0x03c4('0x1a')][_0x03c4('0xab')]=function(_0x27dc73,_0x3e36a0){var _0x179aad=this;for(var _0xb4f821 in _0x27dc73){if(typeof _0x27dc73[_0xb4f821]!==_0x03c4('0x9a')){this[_0x03c4('0x1e')][_0x03c4('0x1b')](function(){if(!_[_0x03c4('0xad')](_0x27dc73[_0xb4f821])){return ami[_0x03c4('0xae')]({'action':_0x03c4('0xaf'),'channel':_0x27dc73[_0xb4f821][_0x03c4('0xb0')]})['catch'](function(_0x3c161c){if(_0x3c161c[_0x03c4('0x3e')]===_0x03c4('0xb1')){setTimeout(function(){if(_0x27dc73[_0xb4f821]&&_0x27dc73[_0xb4f821][_0x03c4('0x4c')]!==_0x03c4('0x93')){_0x179aad[_0x03c4('0xb2')](_0x179aad[_0x03c4('0x20')][_0x27dc73[_0xb4f821][_0x03c4('0xb3')]]);logger[_0x03c4('0x97')](_0x03c4('0xb4'),_0x3e36a0,_0xb4f821,_0x27dc73[_0xb4f821][_0x03c4('0xb3')]);delete _0x27dc73[_0xb4f821];}if(_0x27dc73[_0xb4f821]&&_0x27dc73[_0xb4f821][_0x03c4('0x4c')]===_0x03c4('0x93')){_0x179aad[_0x03c4('0xb2')](_0x179aad[_0x03c4('0x21')][_0x27dc73[_0xb4f821][_0x03c4('0xb3')]]);logger[_0x03c4('0x97')](_0x03c4('0xb5'),_0x3e36a0,_0xb4f821,_0x27dc73[_0xb4f821][_0x03c4('0xb3')]);delete _0x27dc73[_0xb4f821];}},0x2328);}});}});}}};Dialer[_0x03c4('0x1a')][_0x03c4('0xb6')]=function(_0x3d09f1){return BPromise['resolve']()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xb6')](_0x3d09f1))[_0x03c4('0xb8')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype']['checkIsBlackList']=function(_0x59e14a){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopperBlack['checkIsBlackList'](_0x59e14a))['catch'](loggerCatch(_0x03c4('0xba')));};Dialer['prototype'][_0x03c4('0xbb')]=function(_0x5b7cbe){return BPromise[_0x03c4('0xb9')]()['then'](cmHopperBlack[_0x03c4('0xbb')](_0x5b7cbe))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xbc')));};Dialer[_0x03c4('0x1a')][_0x03c4('0xbd')]=function(_0x33f1b9){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopperHistory[_0x03c4('0xbe')](_0x33f1b9))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xbf')));};Dialer[_0x03c4('0x1a')][_0x03c4('0xc0')]=function(_0x4e94fc){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc0')](_0x4e94fc))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xc1')));};Dialer[_0x03c4('0x1a')][_0x03c4('0xc2')]=function(_0x321baa,_0x114a7b,_0x512167){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc2')](_0x321baa,_0x114a7b,_0x512167))[_0x03c4('0xb8')](loggerCatch('[unlockContact]\x20'));};Dialer['prototype']['getContactDialer']=function(_0x190810,_0x5ca885,_0x305f93,_0x36d9f2,_0xe7c713){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc3')](_0x190810,_0x5ca885,_0x305f93,_0x36d9f2))[_0x03c4('0xb8')](function(_0x44703e){_0xe7c713[_0x03c4('0xc4')]-=_0x305f93;_0xe7c713[_0x03c4('0xc4')]=_0xe7c713['temp']>0x0?_0xe7c713[_0x03c4('0xc4')]:0x0;loggerCatch(_0x03c4('0xc5'))(_0x44703e);});};Dialer[_0x03c4('0x1a')][_0x03c4('0xc6')]=function(_0x5b2b86,_0x55c9b8,_0x3c7abc,_0x285e3c){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc6')](_0x5b2b86,_0x55c9b8,_0x3c7abc))[_0x03c4('0xb8')](function(_0x184cc9){_0x285e3c[_0x03c4('0xc4')]-=_0x55c9b8;_0x285e3c[_0x03c4('0xc4')]=_0x285e3c['temp']>0x0?_0x285e3c[_0x03c4('0xc4')]:0x0;loggerCatch(_0x03c4('0xc7'))(_0x184cc9);});};Dialer[_0x03c4('0x1a')]['getVoiceQueueRtPauses']=function(_0x6597cd){return BPromise[_0x03c4('0xb9')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x6597cd))[_0x03c4('0xb8')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x03c4('0x1a')][_0x03c4('0xc8')]=function(_0x11b854){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc8')](_0x11b854))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xc9')));};Dialer[_0x03c4('0x1a')][_0x03c4('0xca')]=function(_0x37368f){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopperHistory[_0x03c4('0xca')](_0x37368f))['catch'](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x03c4('0xb2')]=function(_0x57ce23){if(!_[_0x03c4('0x3d')](_0x57ce23)&&_0x57ce23!==null){if(typeof _0x57ce23[_0x03c4('0x74')]!=='undefined'){if(_0x57ce23[_0x03c4('0x74')]>0x0){_0x57ce23[_0x03c4('0x74')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x03c4('0x97')](_0x03c4('0xcb'));}};Dialer[_0x03c4('0x1a')][_0x03c4('0xcc')]=function(_0x4308ec,_0x42cb24){var _0x494a53=this;return function(_0x44f2de){_0x494a53[_0x03c4('0xb2')](_0x42cb24);logger[_0x03c4('0x97')](_0x4308ec,util[_0x03c4('0x98')](_0x44f2de,{'showHidden':![],'depth':null}));};};Dialer[_0x03c4('0x1a')][_0x03c4('0xcd')]=function(_0x37e0cc,_0x3b7784,_0x4a3c1c){var _0x539c3f={'state':0x19,'statedesc':_0x03c4('0xce')};this[_0x03c4('0xb2')](_0x3b7784);this[_0x03c4('0xcf')](_[_0x03c4('0x8f')](_0x539c3f,_[_0x03c4('0xd0')](_0x4a3c1c,[_0x03c4('0xd1'),_0x03c4('0xd2'),_0x03c4('0xd3'),_0x03c4('0xd4'),_0x03c4('0xd5')])),'[emptyContact][createHistory]',_0x03c4('0xd6'));logger['error'](_0x37e0cc);};Dialer[_0x03c4('0x1a')][_0x03c4('0xd7')]=function(_0x2daddd){return _0x2daddd==='Success';};Dialer['prototype'][_0x03c4('0xd8')]=function(_0x60ba23){return!_[_0x03c4('0x3d')](_0x60ba23)&&_0x60ba23&&!_['isUndefined'](_0x60ba23['name'])&&!_[_0x03c4('0x3d')](_0x60ba23['active'])&&_0x60ba23[_0x03c4('0xd9')]&&(this[_0x03c4('0x22')][util[_0x03c4('0x7d')]('SIP/%s',_0x60ba23[_0x03c4('0x3f')])][_0x03c4('0xaf')]===_0x03c4('0xda')||this[_0x03c4('0x22')][util[_0x03c4('0x7d')](_0x03c4('0xdb'),_0x60ba23[_0x03c4('0x3f')])][_0x03c4('0xaf')]===_0x03c4('0xdc'));};Dialer[_0x03c4('0x1a')][_0x03c4('0xcf')]=function(_0x4cb5c0,_0x195624,_0x2808fb){this[_0x03c4('0xca')](_0x4cb5c0)[_0x03c4('0xb8')](loggerCatch(_0x195624));this[_0x03c4('0xc8')](_0x4cb5c0)[_0x03c4('0xb8')](loggerCatch(_0x2808fb));};Dialer[_0x03c4('0x1a')][_0x03c4('0x38')]=function(_0x3ac7d0){var _0x48a074=this[_0x03c4('0x27')][_0x3ac7d0[_0x03c4('0xdd')]];var _0x232385;if(!_[_0x03c4('0xad')](_0x3ac7d0)&&!_[_0x03c4('0xad')](_0x3ac7d0['variable'])&&!_[_0x03c4('0xad')](_0x3ac7d0[_0x03c4('0xde')][_0x03c4('0xdf')])&&_0x3ac7d0[_0x03c4('0xe0')]===_0x03c4('0xe1')&&_0x48a074){if(_0x48a074[_0x03c4('0x4c')]!==_0x03c4('0x93')&&this[_0x03c4('0x20')][_0x48a074['queue']][_0x03c4('0xe2')]&&_0x3ac7d0[_0x03c4('0xe3')]===_0x03c4('0xe4')){delete this[_0x03c4('0x27')][_0x3ac7d0['uniqueid']];this['updateOriginated'](this[_0x03c4('0x20')][_0x48a074[_0x03c4('0xb3')]]);this[_0x03c4('0x20')][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5f')]+=0x1;this[_0x03c4('0x20')][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5e')]+=0x1;_0x232385=new Hangup(_0x48a074,_0x3ac7d0);_0x232385[_0x03c4('0xa7')]=0x12;_0x232385[_0x03c4('0xa8')]=_0x03c4('0xe5');_0x232385[_0x03c4('0xe6')]='AMD';ami['emit'](_0x03c4('0xe7'),ut[_0x03c4('0xe8')](_0x232385,_0x03c4('0xe9')));this[_0x03c4('0xcf')](_0x232385,'[syncHangupInAMD][createHistory]',_0x03c4('0xea'));}if(_0x48a074['type']!==_0x03c4('0x93')&&this[_0x03c4('0x20')][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0xe2')]&&_0x3ac7d0['value']===_0x03c4('0xeb')){var _0x1df846=this;return new BPromise(function(_0x93d75f,_0x53b9b6){delete _0x1df846['uniqueId'][_0x3ac7d0['uniqueid']];_0x1df846[_0x03c4('0xb2')](_0x1df846[_0x03c4('0x20')][_0x48a074['queue']]);_0x1df846['voiceQueues'][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5f')]+=0x1;_0x1df846[_0x03c4('0x20')][_0x48a074['queue']][_0x03c4('0x5e')]+=0x1;var _0x184fff=_0x1df846[_0x03c4('0x20')][_0x48a074['queue']];var _0x2cc71f=new Hangup(_0x48a074,_0x3ac7d0);_0x2cc71f[_0x03c4('0xa7')]=0x13;_0x2cc71f[_0x03c4('0xa8')]=_0x03c4('0xec');_0x2cc71f['membername']=_0x03c4('0xed');_0x2cc71f[_0x03c4('0xee')]+=0x1;_0x2cc71f[_0x03c4('0xef')]+=0x1;_0x2cc71f[_0x03c4('0xe9')]=!![];ami['emit'](_0x03c4('0xe7'),ut[_0x03c4('0xe8')](_0x2cc71f,_0x03c4('0xe9')));_0x1df846[_0x03c4('0xca')](_0x2cc71f)[_0x03c4('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2cc71f['countbusyretry']+_0x2cc71f[_0x03c4('0xf0')]+_0x2cc71f[_0x03c4('0xf1')]+_0x2cc71f[_0x03c4('0xf2')]+_0x2cc71f[_0x03c4('0xf3')]+_0x2cc71f[_0x03c4('0xf4')]+_0x2cc71f[_0x03c4('0xee')]+_0x2cc71f[_0x03c4('0xf5')]>=_0x184fff['dialGlobalMaxRetry']){_0x1df846['stateGlobal'](_0x2cc71f,_0x93d75f,_0x53b9b6,_0x03c4('0xf6'));}else{if(_0x2cc71f['countmachineretry']>=_0x184fff[_0x03c4('0xf7')]){_0x1df846['createStateFinal'](_0x2cc71f,_0x93d75f,_0x53b9b6,_0x03c4('0xf8'));}else{_0x1df846[_0x03c4('0xc0')]({'active':![],'countmachineretry':_0x2cc71f[_0x03c4('0xee')],'scheduledat':moment()[_0x03c4('0xf9')](_0x184fff[_0x03c4('0xfa')],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x2cc71f[_0x03c4('0xd1')],'ListId':_0x2cc71f['ListId'],'VoiceQueueId':_0x2cc71f['VoiceQueueId']||undefined,'CampaignId':_0x2cc71f[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][Machine]'));_0x93d75f({'reschedule':0x1});}}});}if(_0x48a074['type']===_0x03c4('0x93')&&this['campaigns'][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0xe2')]&&_0x3ac7d0[_0x03c4('0xe3')]===_0x03c4('0xe4')){delete this[_0x03c4('0x27')][_0x3ac7d0['uniqueid']];this[_0x03c4('0xb2')](this[_0x03c4('0x21')][_0x48a074['queue']]);_0x232385=new Hangup(_0x48a074,_0x3ac7d0);_0x232385[_0x03c4('0xa7')]=0x12;_0x232385[_0x03c4('0xa8')]=_0x03c4('0xe5');_0x232385[_0x03c4('0xe6')]=_0x03c4('0xed');ami[_0x03c4('0x4b')]('custom:amd',ut[_0x03c4('0xe8')](_0x232385,'amd'));this['saveInDb'](_0x232385,_0x03c4('0xfd'),_0x03c4('0xfe'));}if(_0x48a074[_0x03c4('0x4c')]===_0x03c4('0x93')&&this['campaigns'][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0xe2')]&&_0x3ac7d0[_0x03c4('0xe3')]===_0x03c4('0xeb')){var _0x1df846=this;return new BPromise(function(_0x1ba59a,_0xa38014){delete _0x1df846[_0x03c4('0x27')][_0x3ac7d0[_0x03c4('0xdd')]];_0x1df846[_0x03c4('0xb2')](_0x1df846[_0x03c4('0x21')][_0x48a074[_0x03c4('0xb3')]]);_0x1df846['campaigns'][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5f')]+=0x1;_0x1df846[_0x03c4('0x21')][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5e')]+=0x1;var _0x1a8658=_0x1df846[_0x03c4('0x21')][_0x48a074[_0x03c4('0xb3')]];var _0x36c694=new Hangup(_0x48a074,_0x3ac7d0);_0x36c694['state']=0x13;_0x36c694[_0x03c4('0xa8')]='Machine';_0x36c694[_0x03c4('0xe6')]='AMD';_0x36c694[_0x03c4('0xee')]+=0x1;_0x36c694['countglobal']+=0x1;_0x36c694['amd']=!![];ami[_0x03c4('0x4b')](_0x03c4('0xe7'),ut['buildObj'](_0x36c694,'amd'));_0x1df846[_0x03c4('0xca')](_0x36c694)['catch'](loggerCatch(_0x03c4('0xff')));if(_0x36c694[_0x03c4('0x100')]+_0x36c694[_0x03c4('0xf0')]+_0x36c694['countnoanswerretry']+_0x36c694[_0x03c4('0xf2')]+_0x36c694['countdropretry']+_0x36c694['countabandonedretry']+_0x36c694[_0x03c4('0xee')]+_0x36c694[_0x03c4('0xf5')]>=_0x1a8658[_0x03c4('0x101')]){_0x1df846[_0x03c4('0x102')](_0x36c694,_0x1ba59a,_0xa38014,_0x03c4('0xf6'));}else{if(_0x36c694[_0x03c4('0xee')]>=_0x1a8658[_0x03c4('0xf7')]){_0x1df846['createStateFinal'](_0x36c694,_0x1ba59a,_0xa38014,'reason\x2019\x20machine....');}else{_0x1df846[_0x03c4('0xc0')]({'active':![],'countmachineretry':_0x36c694[_0x03c4('0xee')],'scheduledat':moment()[_0x03c4('0xf9')](_0x1a8658[_0x03c4('0xfa')],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36c694['ContactId'],'ListId':_0x36c694[_0x03c4('0xd2')],'VoiceQueueId':_0x36c694[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36c694[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][Machine]'));_0x1ba59a({'reschedule':0x1});}}});}}};Dialer[_0x03c4('0x1a')][_0x03c4('0x35')]=function(_0x36d913){var _0x545a99=this[_0x03c4('0x27')][_0x36d913[_0x03c4('0xdd')]];var _0x38d8dd=this;var _0x1cf890;if(_0x545a99&&_0x545a99[_0x03c4('0x4c')]===_0x03c4('0x93')){delete this[_0x03c4('0x27')][_0x36d913[_0x03c4('0xdd')]];this[_0x03c4('0xb2')](this['campaigns'][_0x545a99['queue']]);this[_0x03c4('0x21')][_0x545a99[_0x03c4('0xb3')]][_0x03c4('0x103')]+=0x1;_0x1cf890=new Hangup(_0x545a99,_0x36d913);this[_0x03c4('0xca')](_0x1cf890)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x104')));this[_0x03c4('0xc8')](_0x1cf890)['catch'](loggerCatch(_0x03c4('0x105')));}if(_0x545a99&&_0x545a99[_0x03c4('0x4c')]!==_0x03c4('0x93')&&isNotNull(this['voiceQueues'][_0x545a99[_0x03c4('0xb3')]][_0x03c4('0x106')])){delete this[_0x03c4('0x27')][_0x36d913['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x545a99[_0x03c4('0xb3')]]);this[_0x03c4('0x20')][_0x545a99[_0x03c4('0xb3')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x545a99['queue']][_0x03c4('0x5e')]+=0x1;_0x1cf890=new Hangup(_0x545a99,_0x36d913);_0x1cf890[_0x03c4('0xa7')]=0x10;_0x1cf890[_0x03c4('0xa8')]=_0x03c4('0x107');_0x1cf890[_0x03c4('0xe6')]=_0x03c4('0x108');this['createHistory'](_0x1cf890)['catch'](loggerCatch(_0x03c4('0x104')));this['moveContactManagedDialer'](_0x1cf890)['catch'](loggerCatch(_0x03c4('0x105')));}if(_0x545a99&&_0x545a99[_0x03c4('0x4c')]!==_0x03c4('0x93')&&!isNotNull(this[_0x03c4('0x20')][_0x545a99['queue']][_0x03c4('0x106')])){delete this['uniqueId'][_0x36d913['uniqueid']];this[_0x03c4('0xb2')](this['voiceQueues'][_0x545a99[_0x03c4('0xb3')]]);this[_0x03c4('0x20')][_0x545a99[_0x03c4('0xb3')]][_0x03c4('0x68')]+=0x1;_0x1cf890=new Hangup(_0x545a99,_0x36d913);_0x1cf890[_0x03c4('0xa7')]=0xc;_0x1cf890[_0x03c4('0xa8')]=_0x36d913['cause-txt'];_0x1cf890[_0x03c4('0xe6')]=_0x03c4('0x109');this[_0x03c4('0xca')](_0x1cf890)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x104')));this['moveContactManagedDialer'](_0x1cf890)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x105')));}};Dialer[_0x03c4('0x1a')][_0x03c4('0x10a')]=function(_0xa9b15b){var _0x4f9c1e=this[_0x03c4('0x27')][_0xa9b15b[_0x03c4('0xdd')]];var _0x7b92a4=this;if(this['voiceQueues'][_0xa9b15b[_0x03c4('0xb3')]]){if(_0x4f9c1e&&_0x4f9c1e[_0x03c4('0x4c')]!==_0x03c4('0x93')){delete this[_0x03c4('0x27')][_0xa9b15b[_0x03c4('0xdd')]];this[_0x03c4('0x20')][_0xa9b15b[_0x03c4('0xb3')]][_0x03c4('0x5f')]+=0x1;var _0x104db7=new AgentComplete(_0x4f9c1e,_0xa9b15b);if(_0xa9b15b[_0x03c4('0x10b')]===_0x03c4('0x10c')){_0x104db7[_0x03c4('0x10d')]=this[_0x03c4('0x20')][_0xa9b15b['queue']][_0x03c4('0x10e')]&&this['voiceQueues'][_0xa9b15b[_0x03c4('0xb3')]][_0x03c4('0x10f')]?moment()[_0x03c4('0x7d')](_0x03c4('0xfc')):undefined;}this[_0x03c4('0xca')](_0x104db7)[_0x03c4('0xb8')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x104db7)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x110')));}}};Dialer[_0x03c4('0x1a')][_0x03c4('0x2c')]=function(_0x4d206e){if(this[_0x03c4('0x20')][_0x4d206e[_0x03c4('0xb3')]]){if(this[_0x03c4('0x27')][_0x4d206e[_0x03c4('0xdd')]]&&this[_0x03c4('0x27')][_0x4d206e[_0x03c4('0xdd')]]['type']!==_0x03c4('0x93')){this[_0x03c4('0xb2')](this[_0x03c4('0x20')][_0x4d206e[_0x03c4('0xb3')]]);this[_0x03c4('0x27')][_0x4d206e[_0x03c4('0xdd')]][_0x03c4('0x111')]=moment()['format'](_0x03c4('0xfc'));}}};Dialer[_0x03c4('0x1a')][_0x03c4('0x112')]=function(_0x2f6de8){this[_0x03c4('0xca')](_0x2f6de8)['catch'](loggerCatch(_0x03c4('0x113')));this['moveContactManagedDialer'](_0x2f6de8)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x114')));};Dialer['prototype'][_0x03c4('0x2f')]=function(_0xd7374){var _0x21f507=this[_0x03c4('0x27')][_0xd7374[_0x03c4('0xdd')]];var _0x3541a1=this;if(this[_0x03c4('0x20')][_0xd7374['queue']]){if(_0x21f507&&_0x21f507[_0x03c4('0x4c')]!==_0x03c4('0x93')){delete this[_0x03c4('0x27')][_0xd7374[_0x03c4('0xdd')]];this[_0x03c4('0xb2')](this['voiceQueues'][_0xd7374['queue']]);_0x21f507[_0x03c4('0x115')]=moment()['format'](_0x03c4('0xfc'));var _0x1ab8f4=new QueueCallerAbandon(_0x21f507,_0xd7374);if(getSeconds(_0x21f507[_0x03c4('0x115')],_0x21f507[_0x03c4('0x116')])>=_0x21f507['dialQueueTimeout']){this['voiceQueues'][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x6d')]+=0x1;this['voiceQueues'][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x63')]+=0x1;this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x6f')]+=0x1;_0x1ab8f4[_0x03c4('0xa7')]=0xa;_0x1ab8f4[_0x03c4('0xa8')]=_0x03c4('0x117');_0x1ab8f4[_0x03c4('0x118')]=_0x03c4('0x119');_0x1ab8f4[_0x03c4('0x10d')]=this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x10e')]?moment()[_0x03c4('0x7d')](_0x03c4('0xfc')):undefined;_0x1ab8f4['countdropretry']+=0x1;_0x1ab8f4['countglobal']+=0x1;if(_0x1ab8f4['countdropretry']>=this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x11a')]){this[_0x03c4('0x112')](_0x1ab8f4);}else{this[_0x03c4('0xc0')]({'active':![],'countdropretry':_0x1ab8f4[_0x03c4('0xf3')],'scheduledat':moment()[_0x03c4('0xf9')](this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x11b')],_0x03c4('0xfb'))[_0x03c4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21f507['ContactId'],'ListId':_0x21f507[_0x03c4('0xd2')],'VoiceQueueId':_0x21f507[_0x03c4('0xd4')]||undefined,'CampaignId':_0x21f507['CampaignId']||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][Drop]'));var _0xde4d51=new History(_0x1ab8f4);_0xde4d51[_0x03c4('0xa7')]=0xa;_0xde4d51[_0x03c4('0xa8')]=_0x03c4('0x117');_0xde4d51[_0x03c4('0xaa')]=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));_0xde4d51[_0x03c4('0xa9')]=_0xde4d51[_0x03c4('0xaa')];_0xde4d51[_0x03c4('0x11c')]=_0x1ab8f4[_0x03c4('0x11c')];_0xde4d51[_0x03c4('0x11d')]=_0x1ab8f4[_0x03c4('0x11d')];this[_0x03c4('0xca')](_0xde4d51)[_0x03c4('0xb8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x6c')]+=0x1;this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x62')]+=0x1;_0x1ab8f4['state']=0xb;_0x1ab8f4[_0x03c4('0xa8')]=_0x03c4('0x11e');_0x1ab8f4[_0x03c4('0x118')]=_0x03c4('0x11f');_0x1ab8f4[_0x03c4('0xf4')]+=0x1;_0x1ab8f4[_0x03c4('0xef')]+=0x1;if(_0x1ab8f4['countabandonedretry']>=this['voiceQueues'][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x120')]){this[_0x03c4('0x112')](_0x1ab8f4);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1ab8f4[_0x03c4('0xf4')],'scheduledat':moment()[_0x03c4('0xf9')](this[_0x03c4('0x20')][_0xd7374['queue']]['dialAbandonedRetryFrequency'],_0x03c4('0xfb'))['format'](_0x03c4('0xfc')),'ContactId':_0x21f507[_0x03c4('0xd1')],'ListId':_0x21f507[_0x03c4('0xd2')],'VoiceQueueId':_0x21f507[_0x03c4('0xd4')]||undefined,'CampaignId':_0x21f507[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));var _0xde4d51=new History(_0x1ab8f4);_0xde4d51['state']=0xb;_0xde4d51['statedesc']=_0x03c4('0x11e');_0xde4d51[_0x03c4('0xaa')]=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));_0xde4d51[_0x03c4('0xa9')]=_0xde4d51['starttime'];_0xde4d51[_0x03c4('0x11c')]=_0x1ab8f4['calleridname'];_0xde4d51['calleridnum']=_0x1ab8f4[_0x03c4('0x11d')];this['createHistory'](_0xde4d51)['catch'](loggerCatch(_0x03c4('0x121')));}}}}};Dialer[_0x03c4('0x1a')][_0x03c4('0x37')]=function(_0x2e98f4){if(this[_0x03c4('0x25')][_0x2e98f4['uniqueid']]){this[_0x03c4('0x25')][_0x2e98f4[_0x03c4('0xdd')]]['channel']=_0x2e98f4[_0x03c4('0xb0')];}if(this[_0x03c4('0x27')][_0x2e98f4[_0x03c4('0xdd')]]){this[_0x03c4('0x27')][_0x2e98f4[_0x03c4('0xdd')]][_0x03c4('0xb0')]=_0x2e98f4['channel'];}};Dialer[_0x03c4('0x1a')][_0x03c4('0x122')]=function(_0x2edebd){if(strategy[this[_0x03c4('0x20')][this[_0x03c4('0x25')][_0x2edebd[_0x03c4('0x123')]][_0x03c4('0xb3')]][_0x03c4('0x124')]]===_0x03c4('0x125')){if(this['actions'][_0x2edebd[_0x03c4('0x123')]]&&_[_0x03c4('0xad')](this['actions'][_0x2edebd[_0x03c4('0x123')]][_0x03c4('0x126')])&&_0x2edebd['status']==='1'&&_0x2edebd['paused']==='0'){if(this[_0x03c4('0x127')][_0x2edebd[_0x03c4('0x128')]]){if(!this[_0x03c4('0x127')][_0x2edebd[_0x03c4('0x128')]][_0x03c4('0x126')]){this['agents'][_0x2edebd['stateinterface']][_0x03c4('0x126')]=!![];this['actions'][_0x2edebd['actionid']]['locked']=!![];this['actions'][_0x2edebd[_0x03c4('0x123')]][_0x03c4('0x128')]=_0x2edebd[_0x03c4('0x128')];}}}}else if((strategy[this['voiceQueues'][this[_0x03c4('0x25')][_0x2edebd['actionid']]['queue']][_0x03c4('0x124')]]||_0x03c4('0x19'))===_0x03c4('0x19')){if(this['actions'][_0x2edebd[_0x03c4('0x123')]]){if(this[_0x03c4('0x127')][_0x2edebd[_0x03c4('0x128')]]){this['actions'][_0x2edebd[_0x03c4('0x123')]]['stateinterface']=_0x2edebd[_0x03c4('0x128')];if(_[_0x03c4('0xad')](this['queueBooked'][this[_0x03c4('0x25')][_0x2edebd[_0x03c4('0x123')]][_0x03c4('0xb3')]])){this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x2edebd['actionid']][_0x03c4('0xb3')]]=[];}this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x2edebd[_0x03c4('0x123')]]['queue']]['push'](_[_0x03c4('0x8f')](_['pick'](this['actions'][_0x2edebd[_0x03c4('0x123')]],[_0x03c4('0x129'),'stateinterface']),{'status':_0x2edebd[_0x03c4('0xaf')],'paused':_0x2edebd[_0x03c4('0x12a')]}));}}}};function unlockQueueStatus(_0x366c0b,_0xa3ca79){setTimeout(function(){if(_['isUndefined'](_0x366c0b['queueStatusComplete'])){loggerBooked['error'](_0x03c4('0x12b'),_0xa3ca79);}_0x366c0b[_0x03c4('0x12c')]=!![];loggerBooked['info'](_0x03c4('0x12d'),_0xa3ca79,JSON[_0x03c4('0x7b')](_[_0x03c4('0xd0')](_0x366c0b,[_0x03c4('0x3f'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x03c4('0x1a')][_0x03c4('0x3b')]=function(_0x517fb5){var _0x47c894=this;var _0x3eba91=_0x47c894[_0x03c4('0x20')][_0x47c894[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]];if(strategy[this[_0x03c4('0x20')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]][_0x03c4('0x124')]]===_0x03c4('0x125')){if(this[_0x03c4('0x25')][_0x517fb5['actionid']]&&this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]]['stateinterface']){this[_0x03c4('0x1f')][_0x03c4('0x12e')](this[_0x03c4('0x25')][_0x517fb5['actionid']][_0x03c4('0x129')],this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0x128')])[_0x03c4('0xb8')](function(_0x4f0d83){logger[_0x03c4('0x97')](_0x03c4('0x12f'),util[_0x03c4('0x98')](_0x4f0d83,{'showHidden':![],'depth':null}));})[_0x03c4('0x1d')](function(){_0x47c894[_0x03c4('0xb2')](_0x47c894[_0x03c4('0x20')][_0x47c894['actions'][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]);_0x47c894[_0x03c4('0x127')][_0x47c894[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0x128')]][_0x03c4('0x126')]=![];delete _0x47c894[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]];unlockQueueStatus(_0x3eba91);});}else{this[_0x03c4('0xb2')](this['voiceQueues'][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]);this[_0x03c4('0xc0')]({'active':![],'ContactId':this['actions'][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xd1')],'ListId':this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xd2')],'VoiceQueueId':this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xd4')]||undefined,'CampaignId':this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x130')));delete this['actions'][_0x517fb5[_0x03c4('0x123')]];unlockQueueStatus(_0x3eba91);}}else if((strategy[this[_0x03c4('0x20')][this[_0x03c4('0x25')][_0x517fb5['actionid']]['queue']][_0x03c4('0x124')]]||_0x03c4('0x19'))===_0x03c4('0x19')){var _0x26af2a;if(this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]]&&!_[_0x03c4('0x45')](this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]])){if(this[_0x03c4('0x131')][_0x47c894[_0x03c4('0x25')][_0x517fb5['actionid']][_0x03c4('0xb3')]]){this['queueBookedRR'][_0x47c894[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]=this[_0x03c4('0x131')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]?this[_0x03c4('0x131')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]]['queue']]:this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]?this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]][_0x03c4('0x132')]||0x0:0x0;}this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x517fb5['actionid']][_0x03c4('0xb3')]][_0x03c4('0x132')]=this[_0x03c4('0x131')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]];for(var _0xdca335=0x0;_0xdca335=0x0;})['catch'](myreject(_0x17c87e)));}}else{_0x4e3869[_0x03c4('0x150')](ami[_0x03c4('0xae')]({'action':_0x03c4('0x151'),'command':util['format'](_0x03c4('0x14b'),_0xbfc9c0,!_['isUndefined'](config[_0x03c4('0x14d')][_0x558f54])?_0x558f54:'')})['then'](function(_0x2d1df6){return _0x2d1df6[_0x03c4('0x152')]['indexOf']('true')>=0x0;})[_0x03c4('0xb8')](myreject(_0x17c87e)));}BPromise['all'](_0x4e3869)[_0x03c4('0xb7')](function(_0x1c306e){var _0x2081e3=_[_0x03c4('0x153')](_0x1c306e);if(_0x2081e3){return _0x585ae9(_0x2081e3);}else{_0x5dae3d[_0x03c4('0x3e')]=_0x32b7a5?_0x03c4('0x154'):'INTERVAL_IS_OVERTIME';return _0x17c87e(msgResponse(_0x03c4('0x155'),'Failure',_0x03c4('0x156')+_0x32b7a5+'\x20'+_0x5488e9+_0x03c4('0x157')+util[_0x03c4('0x98')](_0xbfc9c0,{'showHidden':![],'depth':null})+_0x03c4('0x158')+_0x558f54));}})[_0x03c4('0xb8')](function(_0x202575){return _0x17c87e(msgResponse(_0x03c4('0x145'),_0x03c4('0x146'),JSON['stringify'](_0x202575)));});});};Dialer['prototype']['checkDialMethod']=function(_0x38e0eb){var _0x440882=this;return function(){switch(_0x38e0eb['dialMethod']){case'progressive':freeVariablesPredictive(_0x38e0eb);_0x440882['handlePower'](_0x38e0eb,0x1);break;case _0x03c4('0x159'):freeVariablesPredictive(_0x38e0eb);_0x440882['handlePower'](_0x38e0eb,_0x38e0eb[_0x03c4('0x15a')]);break;case _0x03c4('0xa'):_0x440882['predictive'](_0x38e0eb);break;case _0x03c4('0x9'):freeVariablesPredictive(_0x38e0eb);_0x440882[_0x03c4('0x15b')](_0x38e0eb,0x1);break;default:freeVariablesPredictive(_0x38e0eb);logger['error'](_0x03c4('0x15c'),_0x38e0eb['name'],_0x03c4('0x15d'));}};};Dialer[_0x03c4('0x1a')]['launchHandleIvr']=function(_0x2de6f1){var _0x22c634=this;return function(){_0x22c634[_0x03c4('0x15e')](_0x2de6f1);};};Dialer[_0x03c4('0x1a')][_0x03c4('0x15f')]=function(_0x1f70a8){var _0x5a1175=this;if(isNotPreview(_0x1f70a8[_0x03c4('0x5a')])){if(isVoiceQueueOutbound(_0x1f70a8[_0x03c4('0x4c')])&&isActive(_0x1f70a8[_0x03c4('0x160')])){_0x1f70a8[_0x03c4('0xa1')]=!![];BPromise[_0x03c4('0xb9')]()['then'](checkIsLoggedIn(_0x1f70a8,_0x1f70a8[_0x03c4('0x50')]))[_0x03c4('0xb7')](checkIsActive(_0x1f70a8,_0x1f70a8['dialActive']))[_0x03c4('0xb7')](checkInterval(_0x1f70a8))[_0x03c4('0xb7')](_0x5a1175[_0x03c4('0x161')](_0x1f70a8))['then'](_0x5a1175['checkIfTime'](_0x1f70a8[_0x03c4('0x162')],_0x1f70a8[_0x03c4('0x163')],_0x1f70a8[_0x03c4('0x3f')],_0x1f70a8))[_0x03c4('0xb7')](_0x5a1175[_0x03c4('0x144')](_0x1f70a8[_0x03c4('0x42')],_0x1f70a8[_0x03c4('0x163')],_0x1f70a8['name'],_0x1f70a8))[_0x03c4('0xb7')](_0x5a1175[_0x03c4('0x164')](_0x1f70a8))[_0x03c4('0xb8')](loggerCatchQueueSummary(_0x03c4('0x165'),_0x1f70a8));}else{notSendMessagesQueue(_0x1f70a8);}}else{freeVariablesPredictive(_0x1f70a8);}};Dialer['prototype'][_0x03c4('0x13f')]=function(){var _0x1e7c11=this;var _0x1abf70;for(var _0x1b2c00 in this[_0x03c4('0x21')]){if(typeof this['campaigns'][_0x1b2c00]!=='undefined'){_0x1abf70=this[_0x03c4('0x21')][_0x1b2c00];if(isCampaignIvr(_0x1abf70[_0x03c4('0x4c')])&&isActive(_0x1abf70[_0x03c4('0xd9')])){_0x1abf70[_0x03c4('0xa1')]=!![];BPromise['resolve']()[_0x03c4('0xb7')](checkIsActive(_0x1abf70,_0x1abf70[_0x03c4('0xd9')]))[_0x03c4('0xb7')](checkInterval(_0x1abf70))[_0x03c4('0xb7')](_0x1e7c11[_0x03c4('0x161')](_0x1abf70))[_0x03c4('0xb7')](_0x1e7c11[_0x03c4('0x143')](_0x1abf70[_0x03c4('0x162')],_0x1abf70[_0x03c4('0x163')],_0x1abf70['name'],_0x1abf70))[_0x03c4('0xb7')](_0x1e7c11[_0x03c4('0x144')](_0x1abf70[_0x03c4('0x42')],_0x1abf70[_0x03c4('0x163')],_0x1abf70['name'],_0x1abf70))['then'](_0x1e7c11[_0x03c4('0x166')](_0x1abf70))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x1abf70));}else{notSendMessagesCampaign(_0x1abf70);}}}};function getCallerIdRandom(_0x1cf91d,_0x5cb56e){var _0x1c5037;var _0x5db48d;var _0x2a4c38;if(_0x5cb56e<=0x0){_0x5cb56e=0x1;}_0x1c5037=new RegExp(_0x03c4('0x167')+_0x5cb56e+'}$');_0x5db48d=Math[_0x03c4('0x168')](0xa,_0x5cb56e-0x1);_0x2a4c38=Math['pow'](0xa,_0x5cb56e)-0x1;return util['format']('%s',_[_0x03c4('0x169')](_0x1cf91d,_0x1c5037,_[_0x03c4('0x16a')](_0x5db48d,_0x2a4c38)));}function extractCalleridName(_0x2fe859){var _0x1c1258=_0x2fe859[_0x03c4('0x16b')](/"(.*?)"/);return _0x1c1258?_0x1c1258[0x1]:_0x2fe859;}function extractCalleridNumber(_0x7804c){var _0x29bfdc=_0x7804c[_0x03c4('0x16b')](/<(.*?)>/);return _0x29bfdc?_0x29bfdc[0x1]:_0x7804c;}Dialer['prototype'][_0x03c4('0x16c')]=function(_0xc23a4e,_0x5748c7){var _0x329d3c=this;var _0x214e9e=uuid['v4']();this[_0x03c4('0x25')][_0x214e9e]=new Action(_0xc23a4e,_0x5748c7,_0x214e9e);return new BPromise(function(_0x12ebbf,_0x650b46){if(_[_0x03c4('0x3d')](_0xc23a4e)&&typeof _0xc23a4e!=='object'){return _0x650b46(msgResponse(_0x03c4('0x16d'),'Failure',_0x03c4('0x16e')));}if(_[_0x03c4('0x3d')](_0x5748c7[_0x03c4('0x16f')][_0x03c4('0x170')])||_0x5748c7[_0x03c4('0x16f')][_0x03c4('0x170')]===null){return _0x650b46(msgResponse(_0x03c4('0x16d'),_0x03c4('0x146'),_0x03c4('0x171')));}var _0x32db58={'XMD-CALLERID':_0x329d3c[_0x03c4('0x25')][_0x214e9e][_0x03c4('0x172')](),'XMD-AGI':_0xc23a4e[_0x03c4('0x106')]?util['format'](_0x03c4('0x173'),ipAgi,_0xc23a4e[_0x03c4('0x106')]):'NONE','XMD-AGIAFTER':_0xc23a4e[_0x03c4('0x10e')]?util[_0x03c4('0x7d')](_0x03c4('0x173'),ipAgi,_0xc23a4e[_0x03c4('0x10e')]):_0x03c4('0x174'),'XMD-QUEUE':_0xc23a4e[_0x03c4('0x4c')]===_0x03c4('0x4d')?util[_0x03c4('0x7d')](_0x03c4('0x175'),_0xc23a4e['name'],_0xc23a4e[_0x03c4('0x176')]||'',_0xc23a4e['dialAgiAfterHangupAgent']?'c':'',_0xc23a4e[_0x03c4('0x177')]||0x3):_0x03c4('0x174'),'XMD-CONTACTID':_0x5748c7[_0x03c4('0xd1')],'XMD-CDRTYPE':_0x03c4('0x178'),'CALLERID(all)':_0x329d3c[_0x03c4('0x25')][_0x214e9e]['getCaller'](),'XMD-AMD':_0xc23a4e[_0x03c4('0xe2')]?_0x03c4('0x179'):_0x03c4('0x174'),'XMD-DESTINATION':_0x03c4('0xe1')};if(_0xc23a4e[_0x03c4('0xe2')]){_0x32db58[_0x03c4('0x17a')]=_0xc23a4e[_0x03c4('0x17b')]||0x9c4;_0x32db58['XMD-AMDGREETING']=_0xc23a4e[_0x03c4('0x17c')]||0x5dc;_0x32db58[_0x03c4('0x17d')]=_0xc23a4e[_0x03c4('0x17e')]||0x320;_0x32db58[_0x03c4('0x17f')]=_0xc23a4e['dialAMDTotalAnalysisTime']||0x1388;_0x32db58[_0x03c4('0x180')]=_0xc23a4e[_0x03c4('0x181')]||0x64;_0x32db58[_0x03c4('0x182')]=_0xc23a4e[_0x03c4('0x183')]||0x32;_0x32db58[_0x03c4('0x184')]=_0xc23a4e[_0x03c4('0x185')]||0x3;_0x32db58[_0x03c4('0x186')]=_0xc23a4e['dialAMDSilenceThreshold']||0x100;_0x32db58[_0x03c4('0x187')]=_0xc23a4e[_0x03c4('0x188')]||0x1388;}if(_0xc23a4e[_0x03c4('0x4c')]===_0x03c4('0x4d')){_0x32db58[_0x03c4('0x189')]=_0x5748c7[_0x03c4('0xd4')];}else{_0x32db58['XMD-CAMPAIGNID']=_0x5748c7[_0x03c4('0xd5')];}for(var _0x4e5324 in _0x5748c7[_0x03c4('0x16f')]){if(typeof _0x5748c7['Contact'][_0x4e5324]!=='undefined'){if(isNotNull(_0x5748c7[_0x03c4('0x16f')][_0x4e5324])&&_0x4e5324!=='id'&&_0x4e5324!==_0x03c4('0x18a')&&_0x4e5324!==_0x03c4('0x18b')&&_0x4e5324!==_0x03c4('0x18c')){_0x32db58[util[_0x03c4('0x7d')](_0x03c4('0x18d'),_0x03c4('0x18e'),_[_0x03c4('0x18f')](_0x4e5324))]=_0x5748c7['Contact'][_0x4e5324];}}}var _0x251ac4=_0x329d3c[_0x03c4('0xd8')](_0xc23a4e['Trunk'])?getCallerId(_0xc23a4e['Trunk'][_0x03c4('0x7a')],_0xc23a4e['dialOriginateCallerIdName'],_0xc23a4e[_0x03c4('0x190')]>0x0?getCallerIdRandom(_0xc23a4e['dialOriginateCallerIdNumber'],_0xc23a4e[_0x03c4('0x190')]):_0xc23a4e['dialOriginateCallerIdNumber']):getCallerId(_[_0x03c4('0xad')](_0xc23a4e['TrunkBackup'])?_0xc23a4e[_0x03c4('0x79')][_0x03c4('0x7a')]:_0xc23a4e['TrunkBackup']['callerid'],_0xc23a4e['dialOriginateCallerIdName'],_0xc23a4e[_0x03c4('0x190')]>0x0?getCallerIdRandom(_0xc23a4e[_0x03c4('0x5b')],_0xc23a4e['dialRandomLastDigitCallerIdNumber']):_0xc23a4e[_0x03c4('0x5b')]);if(_0x251ac4){_0x32db58[_0x03c4('0x191')]=_0x329d3c['actions'][_0x214e9e][_0x03c4('0x192')]=extractCalleridName(_0x251ac4);_0x32db58[_0x03c4('0x193')]=_0x329d3c['actions'][_0x214e9e]['originatecalleridnum']=extractCalleridNumber(_0x251ac4);}return ami[_0x03c4('0xae')]({'actionid':_0x214e9e,'action':_0x03c4('0x16d'),'channel':_0x329d3c[_0x03c4('0xd8')](_0xc23a4e[_0x03c4('0x79')])?util[_0x03c4('0x7d')](_0x03c4('0x194'),_0xc23a4e[_0x03c4('0x79')][_0x03c4('0x3f')],isNotNull(_0xc23a4e[_0x03c4('0x5d')])?_0xc23a4e['dialPrefix'][_0x03c4('0x195')]()||'':'',_0xc23a4e[_0x03c4('0x196')]>0x0?_0x5748c7[_0x03c4('0x16f')][_0x03c4('0x170')][_0x03c4('0x197')](_0xc23a4e[_0x03c4('0x196')]):_0x5748c7['Contact']['phone']):util[_0x03c4('0x7d')](_0x03c4('0x194'),_[_0x03c4('0xad')](_0xc23a4e[_0x03c4('0x140')])?_0xc23a4e['Trunk'][_0x03c4('0x3f')]:_0xc23a4e[_0x03c4('0x140')][_0x03c4('0x3f')],isNotNull(_0xc23a4e[_0x03c4('0x5d')])?_0xc23a4e[_0x03c4('0x5d')][_0x03c4('0x195')]()||'':'',_0xc23a4e['dialCutDigit']>0x0?_0x5748c7[_0x03c4('0x16f')][_0x03c4('0x170')][_0x03c4('0x197')](_0xc23a4e[_0x03c4('0x196')]):_0x5748c7[_0x03c4('0x16f')]['phone']),'callerid':_0x251ac4,'Exten':'xcally-motion-dialer','Context':_0x03c4('0x198'),'Priority':'1','variable':_0x32db58,'timeout':(_0xc23a4e[_0x03c4('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x214e9e})[_0x03c4('0xb7')](function(_0x2c4da9){return _0x12ebbf(_0x2c4da9);})[_0x03c4('0xb8')](function(_0x344b76){_0xc23a4e[_0x03c4('0x199')]+=0x1;var _0x5c526e=new History(_0x329d3c[_0x03c4('0x25')][_0x214e9e]);logger['error'](util[_0x03c4('0x7d')](_0x03c4('0x19a'),JSON[_0x03c4('0x7b')](_0x344b76)));_0x5c526e[_0x03c4('0xa7')]=0xe;_0x5c526e[_0x03c4('0xa8')]=_0x03c4('0x19b');_0x5c526e['starttime']=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));_0x5c526e[_0x03c4('0xa9')]=_0x5c526e[_0x03c4('0xaa')];_0x329d3c[_0x03c4('0xca')](_0x5c526e)['catch'](loggerCatch(_0x03c4('0x19c')));_0x329d3c[_0x03c4('0xc8')](_0x5c526e)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x19c')))[_0x03c4('0x1d')](function(){delete _0x329d3c[_0x03c4('0x25')][_0x214e9e];return _0x650b46(msgResponse(_0x03c4('0x16d'),_0x03c4('0x48'),_0x03c4('0x19d')));});});});};Dialer['prototype'][_0x03c4('0x31')]=function(_0x3728cb){var _0x1cf0d7=this['actions'][_0x3728cb[_0x03c4('0x123')]];if(_0x1cf0d7){delete this[_0x03c4('0x25')][_0x3728cb[_0x03c4('0x123')]];_0x1cf0d7[_0x03c4('0x116')]=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));var _0xdaa1d7=_0x1cf0d7['type']===_0x03c4('0x93')?this[_0x03c4('0x21')][_0x1cf0d7[_0x03c4('0xb3')]]:this[_0x03c4('0x20')][_0x1cf0d7[_0x03c4('0x19e')]()];if(!this[_0x03c4('0xd7')](_0x3728cb['response'])){this['updateOriginated'](_0xdaa1d7);return this['callProgressDetecting'](_0x1cf0d7,_0xdaa1d7,_0x3728cb)['catch'](loggerCatch(_0x03c4('0x19f')));}this[_0x03c4('0x27')][_0x3728cb[_0x03c4('0xdd')]]=_0x1cf0d7;}};Dialer[_0x03c4('0x1a')][_0x03c4('0x1a0')]=function(_0x5a5248,_0x3a5584,_0x249b23){var _0x36cf4a=new History(_0x3a5584);if(_0x36cf4a[_0x03c4('0x100')]+_0x36cf4a[_0x03c4('0xf0')]+_0x36cf4a['countnoanswerretry']+_0x36cf4a[_0x03c4('0xf2')]+_0x36cf4a[_0x03c4('0xf3')]+_0x36cf4a['countabandonedretry']+_0x36cf4a['countmachineretry']+_0x36cf4a[_0x03c4('0xf5')]>=_0x249b23['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5a5248){case 0x3:if(_0x36cf4a['countnoanswerretry']>=_0x249b23['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countnoanswerretry':_0x36cf4a[_0x03c4('0xf1')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x1a1')],_0x03c4('0xfb'))['format'](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})['catch'](loggerCatch(_0x03c4('0x1a2')));break;case 0x5:if(_0x36cf4a[_0x03c4('0x100')]>=_0x249b23[_0x03c4('0x1a3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x36cf4a['countbusyretry']+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23['dialBusyRetryFrequency'],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a['ContactId'],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a['VoiceQueueId']||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x36cf4a[_0x03c4('0xf0')]>=_0x249b23['dialCongestionMaxRetry']-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countcongestionretry':_0x36cf4a[_0x03c4('0xf0')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x1a4')],_0x03c4('0xfb'))['format'](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1a5')));break;case 0x0:if(_0x36cf4a[_0x03c4('0xf2')]>=_0x249b23[_0x03c4('0x1a6')]-0x1){return!![];}else{this[_0x03c4('0xc0')]({'active':![],'countnosuchnumberretry':_0x36cf4a[_0x03c4('0xf2')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x1a7')],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1a8')));}break;case 0xa:if(_0x36cf4a[_0x03c4('0xf3')]>=_0x249b23[_0x03c4('0x11a')]-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countdropretry':_0x36cf4a[_0x03c4('0xf3')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x11b')],_0x03c4('0xfb'))[_0x03c4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a['CampaignId']||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1a9')));break;case 0xb:if(_0x36cf4a[_0x03c4('0xf4')]>=_0x249b23[_0x03c4('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x36cf4a[_0x03c4('0xf4')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23['dialAbandonedRetryFrequency'],'minutes')[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x36cf4a[_0x03c4('0xee')]>=_0x249b23[_0x03c4('0xf7')]-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countmachineretry':_0x36cf4a['countmachineretry']+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0xfa')],'minutes')[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a['ListId'],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1aa')));break;case 0x14:if(_0x36cf4a[_0x03c4('0xf5')]>=_0x249b23[_0x03c4('0x1ab')]-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countagentrejectretry':_0x36cf4a[_0x03c4('0xf5')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x1ac')],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a['ContactId'],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a['CampaignId']||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x03c4('0x1ad')]=function(_0x351502,_0xf3f7e6,_0x49bf7a){var _0x405b6a=this;var _0x554492=new History(_0x351502);return new BPromise(function(_0x8124c2,_0xa81d82){if(_[_0x03c4('0x3d')](_0xf3f7e6)&&typeof _0xf3f7e6!==_0x03c4('0x1ae')){return _0xa81d82(msgResponse(_0x03c4('0x1af'),_0x03c4('0x146'),_0x03c4('0x1b0')));}if(_[_0x03c4('0x3d')](_0x49bf7a)&&typeof _0x49bf7a!==_0x03c4('0x1ae')){return _0xa81d82(msgResponse('[callProgressDetecting]',_0x03c4('0x146'),_0x03c4('0x1b1')));}switch(_0x49bf7a[_0x03c4('0x10b')]){case'0':_0xf3f7e6['outboundNoSuchCallsDay']+=0x1;_0x554492[_0x03c4('0xa7')]=0x0;_0x554492[_0x03c4('0xa8')]=_0x03c4('0x1b2');_0x554492[_0x03c4('0xf2')]+=0x1;_0x554492['countglobal']+=0x1;ami[_0x03c4('0x4b')](_0x03c4('0x1b3'),ut[_0x03c4('0xe8')](_0x351502,_0x03c4('0x1b4')));_0x405b6a[_0x03c4('0xca')](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xff')));if(_0x405b6a[_0x03c4('0x1a0')](0x0,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0xf2')]>=_0xf3f7e6[_0x03c4('0x1a6')]){_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1b6'));}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1b6'));}}break;case'3':_0xf3f7e6[_0x03c4('0x64')]+=0x1;_0x554492[_0x03c4('0xa7')]=0x3;_0x554492[_0x03c4('0xa8')]=_0x03c4('0x1b7');_0x554492[_0x03c4('0xf1')]+=0x1;_0x554492[_0x03c4('0xef')]+=0x1;ami[_0x03c4('0x4b')](_0x03c4('0x1b8'),ut['buildObj'](_0x351502,'noanswer'));_0x405b6a['createHistory'](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1b9')));if(_0x405b6a[_0x03c4('0x1a0')](0x3,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0xf1')]>=_0xf3f7e6[_0x03c4('0x1ba')]){_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1bb'));}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1bb'));}}break;case'5':_0xf3f7e6['outboundBusyCallsDay']+=0x1;_0x554492[_0x03c4('0xa7')]=0x5;_0x554492[_0x03c4('0xa8')]='Busy';_0x554492['countbusyretry']+=0x1;_0x554492[_0x03c4('0xef')]+=0x1;ami[_0x03c4('0x4b')]('custom:agentbusy',ut[_0x03c4('0xe8')](_0x351502,_0x03c4('0x1bc')));_0x405b6a[_0x03c4('0xca')](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1bd')));if(_0x405b6a[_0x03c4('0x1a0')](0x5,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0x100')]>=_0xf3f7e6['dialBusyMaxRetry']){_0x405b6a['createStateFinal'](_0x554492,_0x8124c2,_0xa81d82,'reason\x205\x20busy');}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,'reason\x205\x20busy');}}break;case'8':_0xf3f7e6[_0x03c4('0x61')]+=0x1;_0x554492[_0x03c4('0xa7')]=0x8;_0x554492[_0x03c4('0xa8')]=_0x03c4('0x1be');_0x554492[_0x03c4('0xf0')]+=0x1;_0x554492[_0x03c4('0xef')]+=0x1;ami[_0x03c4('0x4b')](_0x03c4('0x1bf'),ut[_0x03c4('0xe8')](_0x351502,_0x03c4('0x1c0')));_0x405b6a['createHistory'](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1c1')));if(_0x405b6a[_0x03c4('0x1a0')](0x8,_0x351502,_0xf3f7e6)){if(_0x554492['countcongestionretry']>=_0xf3f7e6[_0x03c4('0x1c2')]){_0x405b6a['createStateFinal'](_0x554492,_0x8124c2,_0xa81d82,'reason\x208\x20congestion');}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c3'));}}break;case'11':_0xf3f7e6[_0x03c4('0x1c4')]+=0x1;_0x554492[_0x03c4('0xa7')]=0xb;_0x554492['statedesc']='Abandoned';_0x554492[_0x03c4('0xf4')]+=0x1;_0x554492['countglobal']+=0x1;_0x405b6a['createHistory'](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x121')));if(_0x405b6a[_0x03c4('0x1a0')](0xb,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0xf4')]>=_0xf3f7e6[_0x03c4('0x120')]){_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c5'));}else{_0x405b6a['stateGlobal'](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c5'));}}break;case'20':_0xf3f7e6['outboundRejectCallsDay']+=0x1;_0x554492[_0x03c4('0xa7')]=0x14;_0x554492[_0x03c4('0xa8')]='AgentReject';_0x554492[_0x03c4('0xf5')]+=0x1;_0x554492[_0x03c4('0xef')]+=0x1;ami[_0x03c4('0x4b')](_0x03c4('0x1c6'),ut[_0x03c4('0xe8')](_0x351502,'agentreject'));_0x405b6a[_0x03c4('0xca')](_0x554492)['catch'](loggerCatch(_0x03c4('0x1c7')));if(_0x405b6a[_0x03c4('0x1a0')](0x14,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0xf5')]>=_0xf3f7e6[_0x03c4('0x1ab')]){_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c8'));}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c8'));}}break;default:_0xf3f7e6['outboundUnknownCallsDay']+=0x1;_0x554492[_0x03c4('0xa7')]=0xc;_0x554492[_0x03c4('0xa8')]=_0x49bf7a[_0x03c4('0x10b')];_0x405b6a['createHistory'](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1c9')));if(_0x405b6a[_0x03c4('0x1a0')](_0x49bf7a[_0x03c4('0x10b')],_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0x100')]+_0x554492[_0x03c4('0xf0')]+_0x554492[_0x03c4('0xf1')]+_0x554492['countnosuchnumberretry']+_0x554492[_0x03c4('0xf3')]+_0x554492['countabandonedretry']+_0x554492[_0x03c4('0xee')]+_0x554492['countagentrejectretry']>=_0xf3f7e6['dialGlobalMaxRetry']){_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x49bf7a[_0x03c4('0x10b')]);}else{_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x49bf7a[_0x03c4('0x10b')]);}}}});};Dialer[_0x03c4('0x1a')][_0x03c4('0x102')]=function(_0x485ed9,_0x521d20,_0x364582,_0xa6f84c){var _0x23822c=new Final(_0x485ed9);_0x23822c[_0x03c4('0xa7')]=0xf;_0x23822c[_0x03c4('0xa8')]=_0x03c4('0x1ca');this[_0x03c4('0x1b5')](_0x23822c,_0x521d20,_0x364582,_0xa6f84c);};Dialer[_0x03c4('0x1a')][_0x03c4('0x1b5')]=function(_0x4eb2bf,_0x2519c4,_0x362b04,_0x49066c){this['moveContactManagedDialer'](_0x4eb2bf)[_0x03c4('0xb7')](function(){return _0x2519c4(msgResponse('[callProgressDetecting]',_0x03c4('0x1cb'),_0x49066c));})['catch'](function(){return _0x362b04(msgResponse('[moveContactManagedDialer][0]',_0x03c4('0x146'),_0x03c4('0x1cc')));});};Dialer[_0x03c4('0x1a')][_0x03c4('0xa')]=function(_0xdafedc){var _0x867995=_0xdafedc[_0x03c4('0x1cd')]/0x64;var _0x5428b4=_0xdafedc['outboundDropCallsDayTimeout']/(_0xdafedc[_0x03c4('0x63')]+_0xdafedc[_0x03c4('0x5f')]);var _0x119614=Math[_0x03c4('0x1ce')](_0xdafedc[_0x03c4('0x1cf')]*(_0xdafedc[_0x03c4('0x1d0')]/0x64));var _0x4fe918=Math['round'](_0xdafedc[_0x03c4('0x1cf')]*(_0xdafedc[_0x03c4('0x1d1')]/0x64));var _0x53421c=_0xdafedc['available']+_0xdafedc[_0x03c4('0x55')];var _0x509a46=Math[_0x03c4('0x1d2')](_0xdafedc['erlangCalls']*_0xdafedc[_0x03c4('0x76')]*_0xdafedc[_0x03c4('0x70')]*_0xdafedc[_0x03c4('0x71')]);if(_[_0x03c4('0x3d')](_0xdafedc['startProgressive'])){if(!_[_0x03c4('0x3d')](_0xdafedc[_0x03c4('0x90')])){_0xdafedc['startPredictive']=undefined;loggerPredictive[_0x03c4('0x97')](_0x03c4('0x1d3'),_0x03c4('0x1d4'));}if(!_['isUndefined'](_0xdafedc[_0x03c4('0x91')])){loggerPredictive[_0x03c4('0x97')](_0x03c4('0x1d3'),_0x03c4('0x1d5'));clearInterval(_0xdafedc['handlePredictive']);_0xdafedc['handlePredictive']=undefined;}_0xdafedc['startProgressive']=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));loggerPredictive[_0x03c4('0x82')](_0xdafedc['name'],'collection\x20data\x20in\x20progressive\x20at',_0xdafedc[_0x03c4('0x78')]);this['handlePower'](_0xdafedc,0x1);}else if(ifInterval(_0xdafedc[_0x03c4('0x1d6')],_0xdafedc[_0x03c4('0x78')])){this[_0x03c4('0x15b')](_0xdafedc,0x1);loggerPredictiveCalls['info'](_0x03c4('0x1d7'),_0xdafedc[_0x03c4('0x78')],_0xdafedc[_0x03c4('0x3f')]);_0xdafedc[_0x03c4('0x75')]=0x0;_0xdafedc[_0x03c4('0x6f')]=0x0;}else if(_0x867995<_0x5428b4&&_0xdafedc[_0x03c4('0x1d8')]===_0x03c4('0x1d9')){freeVariablesPredictive(_0xdafedc);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x1da'),_0x03c4('0x1db'),_0x5428b4,'startProgressive',_0xdafedc['name']);}else if(_0x509a46<_0xdafedc[_0x03c4('0x6f')]&&_0xdafedc[_0x03c4('0x1d8')]===_0x03c4('0x1d9')){freeVariablesPredictive(_0xdafedc);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x1dc'),_0x03c4('0x1dd'),_0x509a46,'Drop\x20in\x20this\x20interval',_0xdafedc[_0x03c4('0x6f')],_0x03c4('0x78'),_0xdafedc[_0x03c4('0x3f')]);}else if(!ifInterval(_0xdafedc[_0x03c4('0x1d6')],_0xdafedc[_0x03c4('0x78')])&&_['isUndefined'](_0xdafedc[_0x03c4('0x90')])&&!_[_0x03c4('0x3d')](_0xdafedc[_0x03c4('0x78')])){_0xdafedc[_0x03c4('0x90')]=moment()['format'](_0x03c4('0xfc'));loggerPredictive[_0x03c4('0x82')](_0xdafedc['name'],_0x03c4('0x1de'),_0xdafedc['startPredictive']);this[_0x03c4('0xbd')](_0xdafedc['dialPredictiveInterval'])[_0x03c4('0xb7')](this[_0x03c4('0x1df')](_0xdafedc))[_0x03c4('0xb7')](mergeDataErlangB(_0xdafedc))[_0x03c4('0xb7')](this[_0x03c4('0x1e0')](_0xdafedc))[_0x03c4('0xb8')](loggerCatchPredictive(_0x03c4('0x1e1'),_0xdafedc));}else if(!ifInterval(_0xdafedc[_0x03c4('0x1d6')],_0xdafedc[_0x03c4('0x90')])){_0xdafedc[_0x03c4('0x6f')]=0x0;_0xdafedc['startPredictive']=moment()['format'](_0x03c4('0xfc'));loggerPredictive[_0x03c4('0x82')](_0xdafedc[_0x03c4('0x3f')],'recalculate\x20predictive\x20at',_0xdafedc[_0x03c4('0x90')]);clearInterval(_0xdafedc[_0x03c4('0x91')]);_0xdafedc[_0x03c4('0x91')]=undefined;this[_0x03c4('0xbd')](_0xdafedc[_0x03c4('0x1d6')])['then'](this[_0x03c4('0x1df')](_0xdafedc))['then'](mergeDataErlangB(_0xdafedc))[_0x03c4('0xb7')](this[_0x03c4('0x1e0')](_0xdafedc))[_0x03c4('0xb8')](loggerCatchPredictive(_0x03c4('0x1e2'),_0xdafedc));}else if(_0xdafedc['predictiveIntervalAvailable']&&_0x53421c<_0xdafedc[_0x03c4('0x1cf')]-_0x4fe918){freeVariablesPredictive(_0xdafedc);loggerPredictive['info'](_0xdafedc[_0x03c4('0x3f')],_0x03c4('0x1e3'),_0x53421c,')\x20are\x20less\x20than\x20threshold\x20(',_0xdafedc[_0x03c4('0x1cf')],'-',_0x4fe918,'=',_0xdafedc['predictiveIntervalAvailable']-_0x4fe918,')');}else if(_0xdafedc[_0x03c4('0x1cf')]&&_0x53421c>_0xdafedc[_0x03c4('0x1cf')]+_0x119614){freeVariablesPredictive(_0xdafedc);loggerPredictive[_0x03c4('0x82')](_0xdafedc['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x53421c,_0x03c4('0x1e4'),_0xdafedc[_0x03c4('0x1cf')],'+',_0x119614,'=',_0xdafedc[_0x03c4('0x1cf')]+_0x119614,')');}};Dialer['prototype'][_0x03c4('0x1df')]=function(_0xe50e21){var _0x235fab=this;return function(_0x2c0439){return new BPromise(function(_0x29c5ad,_0x102fef){_[_0x03c4('0x8f')](_0xe50e21,_0x2c0439[0x0]);if(checkGetDataPredictive(_0x2c0439[0x0])){var _0x5d55b3=_0xe50e21['predictiveIntervalAvailable']=_0xe50e21['talking']+_0xe50e21[_0x03c4('0x4f')];var _0x500549=_0xe50e21[_0x03c4('0x1d6')]*0x3c;var _0x18a1ec=_0x2c0439[0x0][_0x03c4('0x6b')]+_0x2c0439[0x0]['predictiveIntervalAvgHoldtime'];var _0x477ebf=(_0x2c0439[0x0]['predictiveIntervalAnsweredCalls']+_0x2c0439[0x0][_0x03c4('0x6d')]+_0x2c0439[0x0][_0x03c4('0x6c')])/_0x2c0439[0x0][_0x03c4('0x73')];_0xe50e21['predictiveIntervalHitRate']=_0x477ebf>0x0?_0x477ebf:0x1;switch(_0xe50e21['dialPredictiveOptimization']){case'dropRate':var _0x2531e0=_0xe50e21[_0x03c4('0x1cd')]/0x64;return _0x235fab[_0x03c4('0x1e5')](_0x5d55b3,_0x500549,_0x18a1ec,_0x477ebf,_0x2531e0)[_0x03c4('0xb7')](function(_0x471b88){return _0x29c5ad(_0x471b88);});case'agentBusyFactor':var _0x3d645d=_0xe50e21[_0x03c4('0x1cd')]/0x64;return _0x235fab[_0x03c4('0x1e6')](_0x5d55b3,_0x500549,_0x18a1ec,_0x477ebf,_0x3d645d)[_0x03c4('0xb7')](function(_0x6869d8){return _0x29c5ad(_0x6869d8);});default:return _0x102fef(msgResponse(_0x03c4('0x1e7'),'Failure',_0x03c4('0x1e8')));}}else{return _0x102fef(msgResponse(_0x03c4('0x1e7'),'Failure',_0x03c4('0x1e9')));}});};};Dialer[_0x03c4('0x1a')][_0x03c4('0x1ea')]=function(_0x1661e5){var _0x3c7a6d=this;return function(_0x5ac5ea){return new BPromise(function(_0x4c7220,_0x3a2759){_[_0x03c4('0x8f')](_0x1661e5,_0x5ac5ea[0x0]);if(checkGetDataPredictive(_0x5ac5ea[0x0])){loggerPredictive[_0x03c4('0x82')](JSON[_0x03c4('0x7b')](_0x5ac5ea[0x0]));if(_0x1661e5[_0x03c4('0x1d8')]===_0x03c4('0x1d9')){return _0x3c7a6d[_0x03c4('0x1eb')](_0x1661e5['id'])[_0x03c4('0xb7')](function(_0x3b9482){var _0x273e49=_0x1661e5[_0x03c4('0x50')]-_0x3b9482[0x0]['outboundQueuePauses'];var _0x301604=_0x1661e5['dialPredictiveInterval']*0x3c;var _0x24fc65=_0x5ac5ea[0x0][_0x03c4('0x6b')]+_0x5ac5ea[0x0]['predictiveIntervalAvgHoldtime'];var _0x33a490=(_0x5ac5ea[0x0]['predictiveIntervalAnsweredCalls']+_0x5ac5ea[0x0][_0x03c4('0x6d')]+_0x5ac5ea[0x0][_0x03c4('0x6c')])/_0x5ac5ea[0x0][_0x03c4('0x73')];var _0x11d18d=_0x1661e5[_0x03c4('0x1cd')]/0x64;_0x1661e5[_0x03c4('0x72')]=_0x3b9482[0x0][_0x03c4('0x1ec')]||0x0;_0x1661e5['predictiveIntervalHitRate']=_0x33a490>0x0?_0x33a490:0x1;return _0x3c7a6d[_0x03c4('0x1e5')](_0x273e49,_0x301604,_0x24fc65,_0x33a490,_0x11d18d);})['then'](function(_0x4ad81a){return _0x4c7220(_0x4ad81a);})[_0x03c4('0xb8')](function(_0x5f1f90){return _0x3a2759(msgResponse(_0x03c4('0x1ed'),'Failure',JSON[_0x03c4('0x7b')](_0x5f1f90)));});}if(_0x1661e5[_0x03c4('0x1d8')]===_0x03c4('0x1ee')){return _0x3c7a6d['getVoiceQueueRtPauses'](_0x1661e5['id'])[_0x03c4('0xb7')](function(_0xa934b9){var _0x441f24=_0x1661e5[_0x03c4('0x50')]-_0xa934b9[0x0][_0x03c4('0x1ec')];var _0x694377=_0x1661e5[_0x03c4('0x1d6')]*0x3c;var _0x5380d9=_0x5ac5ea[0x0][_0x03c4('0x6b')]+_0x5ac5ea[0x0]['predictiveIntervalAvgHoldtime'];var _0x3e4676=(_0x5ac5ea[0x0][_0x03c4('0x69')]+_0x5ac5ea[0x0][_0x03c4('0x6d')]+_0x5ac5ea[0x0][_0x03c4('0x6c')])/_0x5ac5ea[0x0]['predictiveIntervalTotalCalls'];var _0x5ae7d8=_0x1661e5[_0x03c4('0x1cd')]/0x64;_0x1661e5[_0x03c4('0x72')]=_0xa934b9[0x0][_0x03c4('0x1ec')]||0x0;_0x1661e5[_0x03c4('0x70')]=_0x3e4676>0x0?_0x3e4676:0x1;return _0x3c7a6d[_0x03c4('0x1e6')](_0x441f24,_0x694377,_0x5380d9,_0x3e4676,_0x5ae7d8);})[_0x03c4('0xb7')](function(_0x5e86c0){return _0x4c7220(_0x5e86c0);})[_0x03c4('0xb8')](function(_0x4d6c27){return _0x3a2759(msgResponse(_0x03c4('0x1ed'),_0x03c4('0x146'),JSON[_0x03c4('0x7b')](_0x4d6c27)));});}}else{return _0x3a2759(msgResponse(_0x03c4('0x1e7'),_0x03c4('0x146'),_0x03c4('0x1e9')));}});};};Dialer['prototype'][_0x03c4('0x1e0')]=function(_0x1040f5){var _0x3d85b0=this;return function(){var _0x5a14a6=0x0;var _0x9a6c45=Math[_0x03c4('0x1d2')](_0x1040f5[_0x03c4('0x8d')]*0x3e8);if(_0x9a6c45>0x0){_0x9a6c45=_0x9a6c45<0x64?0x64:_0x9a6c45;loggerPredictive['info'](_0x1040f5[_0x03c4('0x3f')],_0x03c4('0x1ef'),_0x9a6c45,_0x03c4('0x49'));_0x1040f5['handlePredictive']=setInterval(function(){_0x3d85b0[_0x03c4('0x91')](_0x1040f5);loggerPredictiveCalls[_0x03c4('0x82')](_0x03c4('0x1f0'),_0x5a14a6+=0x1);},_0x9a6c45);}else{loggerPredictive['info'](_0x1040f5['name'],_0x03c4('0x1f1'));}};};Dialer[_0x03c4('0x1a')][_0x03c4('0x1f2')]=function(_0xa2901b,_0x41bf3e){var _0x17dcc8=this;return function(_0x34e2d6){if(_[_0x03c4('0x45')](_0x34e2d6)){if(_[_0x03c4('0xad')](_0x41bf3e[_0x03c4('0xd3')])||!_0x41bf3e['recallme']){if(_0xa2901b['dialMethod']===_0x03c4('0x9')){_0xa2901b['queueStatusComplete']=_['isUndefined'](_0xa2901b[_0x03c4('0x12c')])?!![]:_0xa2901b[_0x03c4('0x12c')];var _0x3924fd=uuid['v4']();_0x17dcc8[_0x03c4('0x25')][_0x3924fd]=new Action(_0xa2901b,_0x41bf3e,_0x3924fd);loggerBooked[_0x03c4('0x82')]('[booked][checkContactBlack]',_0x3924fd,_0x03c4('0x1f3'),JSON[_0x03c4('0x7b')](_0xa2901b[_0x03c4('0x12c')]),_0x03c4('0x1f4'),_0xa2901b[_0x03c4('0x3f')]);if(_0xa2901b[_0x03c4('0x12c')]){_0xa2901b[_0x03c4('0x12c')]=![];_0x17dcc8[_0x03c4('0x2a')][_0x17dcc8[_0x03c4('0x25')][_0x3924fd]['queue']]=[];ami[_0x03c4('0xae')]({'actionid':_0x3924fd,'action':_0x03c4('0x1f5'),'queue':_0xa2901b[_0x03c4('0x3f')]})[_0x03c4('0xb8')](function(){_0x17dcc8[_0x03c4('0xb2')](_0xa2901b);_0x17dcc8[_0x03c4('0xc0')]({'active':![],'ContactId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd1')],'ListId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd2')],'VoiceQueueId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd4')]||undefined,'CampaignId':_0x17dcc8['actions'][_0x3924fd]['CampaignId']||undefined})[_0x03c4('0xb8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x17dcc8['actions'][_0x3924fd];});}else{loggerBooked[_0x03c4('0x82')](_0x03c4('0x1f6'),JSON[_0x03c4('0x7b')](_0xa2901b['queueStatusComplete']),'Queue:\x20',_0xa2901b['name']);_0x17dcc8['updateOriginated'](_0xa2901b);_0x17dcc8[_0x03c4('0xc0')]({'active':![],'ContactId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd1')],'ListId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd]['ListId'],'VoiceQueueId':_0x17dcc8['actions'][_0x3924fd][_0x03c4('0xd4')]||undefined,'CampaignId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1f7')));delete _0x17dcc8[_0x03c4('0x25')][_0x3924fd];}}else{return _0x17dcc8[_0x03c4('0x16c')](_0xa2901b,_0x41bf3e);}}else{if(getDiff(_0x41bf3e[_0x03c4('0x1f8')])<_0xa2901b[_0x03c4('0x1f9')]*0x3c){if(_0x41bf3e[_0x03c4('0x1fa')]&&!_0x41bf3e[_0x03c4('0x1fa')][_0x03c4('0x1fb')]){_0x17dcc8[_0x03c4('0x1f')]['run'](_0x41bf3e['id'])[_0x03c4('0x1d')](function(){_0x17dcc8[_0x03c4('0xb2')](_0xa2901b);});}else{_0x17dcc8[_0x03c4('0xc2')]({'active':![]},_0x41bf3e['id'],0x1)[_0x03c4('0x1d')](function(){_0x17dcc8['updateOriginated'](_0xa2901b);});}}else{_0xa2901b['outboundReCallsDay']+=0x1;_0x17dcc8[_0x03c4('0xb2')](_0xa2901b);if(_0xa2901b[_0x03c4('0x1fc')]){_0x17dcc8[_0x03c4('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x41bf3e[_0x03c4('0xd1')],'ListId':_0x41bf3e[_0x03c4('0xd2')],'VoiceQueueId':_0x41bf3e['VoiceQueueId']||undefined,'CampaignId':_0x41bf3e['CampaignId']||undefined})['catch'](loggerCatch(_0x03c4('0x1fd')));_0x17dcc8[_0x03c4('0xca')](createObjHistory(_0xa2901b,_0x41bf3e,_0x03c4('0x1fe'),0x17,_0x03c4('0x1ff')))[_0x03c4('0xb8')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x17dcc8[_0x03c4('0xcf')](createObjHistory(_0xa2901b,_0x41bf3e,_0x03c4('0x200'),0x16,_0x03c4('0x201')),_0x03c4('0x202'),_0x03c4('0x203'));}}}}else{_0xa2901b[_0x03c4('0x204')]+=0x1;_0x17dcc8[_0x03c4('0xcf')](createObjHistory(_0xa2901b,_0x41bf3e,_0x03c4('0x205'),0xd,_0x03c4('0x206')),_0x03c4('0x207'),_0x03c4('0x208'));throw _0x03c4('0x209');}};};Dialer[_0x03c4('0x1a')][_0x03c4('0x15e')]=function(_0x505cb0){var _0xb502bf=this;var _0x4cb1fb=_0x505cb0[_0x03c4('0x20a')]-_0x505cb0[_0x03c4('0x74')]-_0x505cb0[_0x03c4('0xc4')];emitCampaignSummary(_0x505cb0);if(_0x4cb1fb>0x0){if(_0x4cb1fb>this[_0x03c4('0x23')]){_0x4cb1fb=this['maxNumberOriginate'];}_0x505cb0[_0x03c4('0xc4')]+=_0x4cb1fb;this[_0x03c4('0xc6')](_0x505cb0['id'],_0x4cb1fb,_0x505cb0[_0x03c4('0x20b')],_0x505cb0)[_0x03c4('0xb7')](function(_0x58e26b){_0x505cb0[_0x03c4('0xc4')]-=_0x4cb1fb;_0x505cb0[_0x03c4('0xc4')]=_0x505cb0[_0x03c4('0xc4')]>0x0?_0x505cb0[_0x03c4('0xc4')]:0x0;if(!checkContactEmpty(_0x58e26b)){_0x505cb0[_0x03c4('0x3e')]=_0x03c4('0xa0');logger[_0x03c4('0x82')](_0x03c4('0x20c')+_0x505cb0['name']);}else{_0x505cb0['originated']+=_0x58e26b[_0x03c4('0x133')];_0x505cb0[_0x03c4('0x3e')]=_0x03c4('0x20d');for(var _0x397fe5=0x0;_0x397fe5<_0x58e26b[_0x03c4('0x133')];_0x397fe5+=0x1){_0x505cb0[_0x03c4('0x20e')]+=0x1;if(_[_0x03c4('0xad')](_0x58e26b[_0x397fe5])||_[_0x03c4('0xad')](_0x58e26b[_0x397fe5][_0x03c4('0x16f')])||_['isNil'](_0x58e26b[_0x397fe5]['Contact']['phone'])){_0xb502bf[_0x03c4('0xcd')]('[actionOriginate]\x20',_0x505cb0,_0x58e26b[_0x397fe5]);}else{_0xb502bf['checkIsBlackListIvr'](_['pick'](_0x58e26b[_0x397fe5],['CampaignId','Contact.phone']))[_0x03c4('0xb7')](_0xb502bf[_0x03c4('0x1f2')](_0x505cb0,_0x58e26b[_0x397fe5]))['catch'](_0xb502bf['loggerHandler']('[actionOriginateIvr]\x20',_0x505cb0));}}}})[_0x03c4('0xb8')](loggerGetContactDialer('[getContactCampaign2]',_0x505cb0,_0x4cb1fb));}};Dialer[_0x03c4('0x1a')][_0x03c4('0x15b')]=function(_0x2ed4a8,_0x1aa817){var _0x3d1019=this;var _0x4d0273=[];var _0x14c0fd=_0x1aa817>=0x1?_0x1aa817:0x1;if(_0x2ed4a8[_0x03c4('0x5a')]===_0x03c4('0x9')){_0x14c0fd=0x1;}var _0x307420=Math[_0x03c4('0x1d2')](_0x2ed4a8[_0x03c4('0x4f')]*_0x14c0fd)-_0x2ed4a8[_0x03c4('0x74')]-_0x2ed4a8[_0x03c4('0xc4')];emitVoiceQueueSummary(_0x2ed4a8);if(_0x2ed4a8[_0x03c4('0x20f')]>0x0){var _0x13f8da=_0x2ed4a8[_0x03c4('0x20f')]-_0x2ed4a8[_0x03c4('0x74')]-_0x2ed4a8['talking']-_0x2ed4a8[_0x03c4('0xc4')]-_0x2ed4a8[_0x03c4('0x51')];if(_0x307420>_0x13f8da){_0x307420=_0x13f8da;}}if(_0x307420>0x0){if(_0x2ed4a8[_0x03c4('0x5a')]===_0x03c4('0x9')){_0x307420=0x1;}if(_0x307420>this[_0x03c4('0x23')]){_0x307420=this[_0x03c4('0x23')];}_0x2ed4a8[_0x03c4('0xc4')]+=_0x307420;for(var _0x4f0ec1 in this[_0x03c4('0x127')]){if(typeof this[_0x03c4('0x127')][_0x4f0ec1]!=='undefined'){if(this['agents'][_0x4f0ec1][_0x03c4('0xa7')]==='not_inuse'&&this[_0x03c4('0x127')][_0x4f0ec1]['status']===_0x03c4('0xda')){_0x4d0273[_0x03c4('0x150')](this[_0x03c4('0x127')][_0x4f0ec1]['id']);}}}this[_0x03c4('0xc3')](_0x2ed4a8['id'],_0x4d0273,_0x307420,_0x2ed4a8['dialOrderByScheduledAt'],_0x2ed4a8)[_0x03c4('0xb7')](function(_0x275ef5){_0x2ed4a8[_0x03c4('0xc4')]-=_0x307420;_0x2ed4a8[_0x03c4('0xc4')]=_0x2ed4a8[_0x03c4('0xc4')]>0x0?_0x2ed4a8['temp']:0x0;if(!checkContactEmpty(_0x275ef5)){_0x3d1019[_0x03c4('0xb6')](_0x2ed4a8)[_0x03c4('0xb7')](sendMessageReschedule(_0x2ed4a8))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x210')));}else{_0x2ed4a8[_0x03c4('0x74')]+=_0x275ef5[_0x03c4('0x133')];_0x2ed4a8[_0x03c4('0x3e')]=_0x2ed4a8[_0x03c4('0x5a')]==='booked'?_0x03c4('0x179'):_0x03c4('0x20d');for(var _0x322c23=0x0;_0x322c23<_0x275ef5['length'];_0x322c23+=0x1){if(_[_0x03c4('0xad')](_0x275ef5[_0x322c23])||_[_0x03c4('0xad')](_0x275ef5[_0x322c23][_0x03c4('0x16f')])||_[_0x03c4('0xad')](_0x275ef5[_0x322c23][_0x03c4('0x16f')][_0x03c4('0x170')])){_0x3d1019['emptyContact']('[actionOriginate]\x20',_0x2ed4a8,_0x275ef5[_0x322c23]);}else{_0x3d1019[_0x03c4('0x211')](_[_0x03c4('0xd0')](_0x275ef5[_0x322c23],[_0x03c4('0xd4'),_0x03c4('0x212')]))[_0x03c4('0xb7')](_0x3d1019[_0x03c4('0x1f2')](_0x2ed4a8,_0x275ef5[_0x322c23]))[_0x03c4('0xb8')](_0x3d1019[_0x03c4('0xcc')]('[actionOriginate]\x20',_0x2ed4a8));}}}})['catch'](loggerGetContactDialer(_0x03c4('0x213'),_0x2ed4a8,_0x307420));}};Dialer[_0x03c4('0x1a')][_0x03c4('0x91')]=function(_0x552107){if(_0x552107['dialLimitQueue']>0x0){var _0x29cec9=_0x552107['dialLimitQueue']-_0x552107[_0x03c4('0x74')]-_0x552107[_0x03c4('0x55')];if(_0x29cec9>0x0){this[_0x03c4('0x214')](_0x552107);}else{loggerPredictiveCalls['info'](_0x03c4('0x215'));}}else{this['tryOriginatePredictive'](_0x552107);}};Dialer[_0x03c4('0x1a')][_0x03c4('0x214')]=function(_0x102f47){var _0xa21afc=this;var _0x2ec903=[];_0x102f47[_0x03c4('0x74')]+=0x1;for(var _0x56cbbb in this[_0x03c4('0x127')]){if(typeof this[_0x03c4('0x127')][_0x56cbbb]!==_0x03c4('0x9a')){if(this[_0x03c4('0x127')][_0x56cbbb][_0x03c4('0xa7')]===_0x03c4('0x216')&&this[_0x03c4('0x127')][_0x56cbbb][_0x03c4('0xaf')]===_0x03c4('0xda')){_0x2ec903[_0x03c4('0x150')](this[_0x03c4('0x127')][_0x56cbbb]['id']);}}}this['getContactDialer'](_0x102f47['id'],_0x2ec903,0x1,_0x102f47['dialOrderByScheduledAt'],_0x102f47)[_0x03c4('0xb7')](function(_0x5e7a94){if(!checkContactEmpty(_0x5e7a94)){checkContactLowerLimitOriginate(_0x102f47,0x1,0x0);_0xa21afc[_0x03c4('0xb6')](_0x102f47)[_0x03c4('0xb7')](sendMessageReschedule(_0x102f47))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x210')));}else{_0x102f47[_0x03c4('0x3e')]='RUNNING';if(_[_0x03c4('0xad')](_0x5e7a94[0x0])||_[_0x03c4('0xad')](_0x5e7a94[0x0][_0x03c4('0x16f')])||_[_0x03c4('0xad')](_0x5e7a94[0x0][_0x03c4('0x16f')][_0x03c4('0x170')])){_0xa21afc[_0x03c4('0xcd')](_0x03c4('0x217'),_0x102f47,_0x5e7a94[0x0]);}else{_0xa21afc[_0x03c4('0x211')](_[_0x03c4('0xd0')](_0x5e7a94[0x0],['VoiceQueueId',_0x03c4('0x212')]))[_0x03c4('0xb7')](_0xa21afc['checkContactBlack'](_0x102f47,_0x5e7a94[0x0]))[_0x03c4('0xb8')](_0xa21afc[_0x03c4('0xcc')](_0x03c4('0x218'),_0x102f47));}}})[_0x03c4('0xb8')](loggerGetContactDialer(_0x03c4('0x219'),_0x102f47,0x1));emitVoiceQueueSummary(_0x102f47);};Dialer[_0x03c4('0x1a')][_0x03c4('0x1e5')]=function(_0x12f1d3,_0x45c6ee,_0x14a4bb,_0x827bf,_0x337a57,_0x1fb91f){loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21a'));loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21b'),_0x12f1d3);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21c'),_0x45c6ee);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21d'),_0x14a4bb);loggerPredictive['info'](_0x03c4('0x21e'),_0x827bf);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21f'),_0x337a57);loggerPredictive['info'](_0x03c4('0x89'));return new BPromise(function(_0x524774,_0x323fe4){if(_0x12f1d3<=0x0||isNaN(_0x12f1d3)){return _0x323fe4(msgResponse(_0x03c4('0x220'),_0x03c4('0x48'),'m\x20=\x20'+_0x12f1d3));}if(_0x14a4bb<=0x0||isNaN(_0x14a4bb)){return _0x323fe4(msgResponse(_0x03c4('0x220'),_0x03c4('0x48'),_0x03c4('0x221')+_0x14a4bb));}if(_0x827bf<=0x0||isNaN(_0x827bf)){return _0x323fe4(msgResponse('[abandonmentRate]',_0x03c4('0x48'),_0x03c4('0x222')+_0x827bf));}if(_0x45c6ee<=0x0||isNaN(_0x45c6ee)){return _0x323fe4(msgResponse(_0x03c4('0x220'),_0x03c4('0x48'),_0x03c4('0x223')+_0x45c6ee));}if(_0x337a57<=0x0||isNaN(_0x337a57)){return _0x323fe4(msgResponse(_0x03c4('0x220'),_0x03c4('0x48'),_0x03c4('0x224')+_0x337a57));}_0x1fb91f=_0x1fb91f||0x0;var _0x100cfd=0x1/_0x14a4bb;var _0x11b441=0x0;var _0x4f5232=0x0;var _0x3ec8c9=0x0;var _0x5e4237=0x0;for(var _0x59161f=0x0;_0x3ec8c9<_0x337a57;_0x59161f+=0x1){_0x4f5232=_0x59161f/_0x45c6ee;_0x11b441=(_0x827bf*_0x4f5232+_0x1fb91f)/_0x100cfd;_0x3ec8c9=erlangb(_0x11b441,_0x12f1d3);_0x5e4237=_0x11b441/_0x12f1d3*(0x1-erlangb(_0x11b441,_0x12f1d3));}return _0x524774({'erlangCalls':_0x59161f,'erlangCallToSecond':_0x45c6ee/_0x59161f,'erlangAbandonmentRate':_0x3ec8c9,'erlangBusyFactor':_0x5e4237});});};Dialer['prototype'][_0x03c4('0x1e6')]=function(_0x36fda7,_0x8135b,_0x3f787e,_0x143271,_0x4a2a0f,_0x592e9c){loggerPredictive['info'](_0x03c4('0x225'));loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21b'),_0x36fda7);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21c'),_0x8135b);loggerPredictive['info'](_0x03c4('0x21d'),_0x3f787e);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21e'),_0x143271);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x226'),_0x4a2a0f);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x89'));return new BPromise(function(_0x14f4c8,_0x169ed6){if(_0x36fda7<=0x0||isNaN(_0x36fda7)){return _0x169ed6(msgResponse(_0x03c4('0x227'),'Error','m\x20=\x20'+_0x36fda7));}if(_0x3f787e<=0x0||isNaN(_0x3f787e)){return _0x169ed6(msgResponse(_0x03c4('0x227'),_0x03c4('0x48'),_0x03c4('0x221')+_0x3f787e));}if(_0x143271<=0x0||isNaN(_0x143271)){return _0x169ed6(msgResponse('[busyFactor]',_0x03c4('0x48'),_0x03c4('0x222')+_0x143271));}if(_0x8135b<=0x0||isNaN(_0x8135b)){return _0x169ed6(msgResponse('[busyFactor]',_0x03c4('0x48'),_0x03c4('0x223')+_0x8135b));}if(_0x4a2a0f<=0x0||isNaN(_0x4a2a0f)){return _0x169ed6(msgResponse(_0x03c4('0x227'),_0x03c4('0x48'),_0x03c4('0x228')+_0x4a2a0f));}_0x592e9c=_0x592e9c||0x0;var _0x12c9eb=0x1/_0x3f787e;var _0x4c0972=0x0;var _0x504bb9=0x0;var _0x186667=0x0;var _0x1d2b40=0x0;for(var _0x537b37=0x0;_0x1d2b40<_0x4a2a0f;_0x537b37+=0x1){_0x504bb9=_0x537b37/_0x8135b;_0x4c0972=(_0x143271*_0x504bb9+_0x592e9c)/_0x12c9eb;_0x186667=erlangb(_0x4c0972,_0x36fda7);_0x1d2b40=_0x4c0972/_0x36fda7*(0x1-erlangb(_0x4c0972,_0x36fda7));}return _0x14f4c8({'erlangCalls':_0x537b37,'erlangCallToSecond':_0x8135b/_0x537b37,'erlangAbandonmentRate':_0x186667,'erlangBusyFactor':_0x1d2b40});});};module[_0x03c4('0x229')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 041f38d..465e750 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 _0x45c6=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','scheduledat','type'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x45c6,0x74));var _0x645c=function(_0x204403,_0x2ca01a){_0x204403=_0x204403-0x0;var _0x265470=_0x45c6[_0x204403];return _0x265470;};'use strict';var util=require('util');var _=require(_0x645c('0x0'));var moment=require(_0x645c('0x1'));function getSeconds(_0x13d41d,_0x5e072c){var _0x16cd2b=moment(_0x13d41d)[_0x645c('0x2')](0x0);var _0x5dc6ea=moment(_0x5e072c)[_0x645c('0x2')](0x0);return _0x16cd2b[_0x645c('0x3')](_0x5dc6ea,_0x645c('0x4'));}function QueueCallerAbandon(_0x3a8962,_0x5b028e){this[_0x645c('0x5')]=_0x3a8962['scheduledat'];this['type']=_0x3a8962[_0x645c('0x6')];this[_0x645c('0x7')]=_0x3a8962[_0x645c('0x6')]===_0x645c('0x8')?_0x645c('0x9'):_0x3a8962[_0x645c('0x6')];this[_0x645c('0xa')]=_0x3a8962['countbusyretry'];this[_0x645c('0xb')]=_0x3a8962[_0x645c('0xb')];this[_0x645c('0xc')]=_0x3a8962['countnoanswerretry'];this[_0x645c('0xd')]=_0x3a8962[_0x645c('0xa')]+_0x3a8962[_0x645c('0xb')]+_0x3a8962[_0x645c('0xc')]+_0x3a8962[_0x645c('0xe')]+_0x3a8962['countdropretry']+_0x3a8962[_0x645c('0xf')]+_0x3a8962[_0x645c('0x10')]+_0x3a8962[_0x645c('0x11')];this[_0x645c('0xe')]=_0x3a8962[_0x645c('0xe')];this['countdropretry']=_0x3a8962['countdropretry'];this['countabandonedretry']=_0x3a8962[_0x645c('0xf')];this[_0x645c('0x10')]=_0x3a8962[_0x645c('0x10')];this[_0x645c('0x11')]=_0x3a8962[_0x645c('0x11')];this[_0x645c('0x12')]=_0x5b028e[_0x645c('0x12')];this[_0x645c('0x13')]=_0x3a8962[_0x645c('0x14')];this[_0x645c('0x15')]=_0x3a8962[_0x645c('0x16')];this[_0x645c('0x17')]=_0x3a8962[_0x645c('0x17')];this[_0x645c('0x18')]=_0x3a8962[_0x645c('0x18')];this[_0x645c('0x19')]=_0x3a8962['droptime'];this['endtime']=this[_0x645c('0x19')];this[_0x645c('0x1a')]=getSeconds(_0x3a8962[_0x645c('0x18')],_0x3a8962[_0x645c('0x17')]);this[_0x645c('0x1b')]=getSeconds(this[_0x645c('0x19')],_0x3a8962[_0x645c('0x18')]);this[_0x645c('0x1c')]=0x0;this['queue']=_0x5b028e[_0x645c('0x9')];this['membername']=_0x5b028e[_0x645c('0x1d')];this[_0x645c('0x1e')]=_0x5b028e[_0x645c('0x1e')];this[_0x645c('0x1f')]=_0x3a8962[_0x645c('0x1f')];this[_0x645c('0x20')]=_0x3a8962[_0x645c('0x20')];this[_0x645c('0x21')]=_0x3a8962['callbackat'];this[_0x645c('0x22')]=_0x3a8962[_0x645c('0x22')];this[_0x645c('0x23')]=_0x3a8962['ContactId'];this[_0x645c('0x24')]=_0x3a8962[_0x645c('0x24')];this['UserId']=_0x3a8962['UserId'];this[_0x645c('0x25')]=_0x3a8962[_0x645c('0x25')];this[_0x645c('0x26')]=_0x3a8962['CampaignId'];this[_0x645c('0x27')]=_0x3a8962[_0x645c('0x27')]||'';this[_0x645c('0x28')]=_0x3a8962['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xbb19=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','queue','membername','connectedlinename','reason'];(function(_0x344ef9,_0x38f8a3){var _0xa088ce=function(_0x884e2b){while(--_0x884e2b){_0x344ef9['push'](_0x344ef9['shift']());}};_0xa088ce(++_0x38f8a3);}(_0xbb19,0xf4));var _0x9bb1=function(_0x390d38,_0x54d08f){_0x390d38=_0x390d38-0x0;var _0x414bee=_0xbb19[_0x390d38];return _0x414bee;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x382405,_0x54757d){var _0x2dac13=moment(_0x382405)['milliseconds'](0x0);var _0x195cd4=moment(_0x54757d)[_0x9bb1('0x0')](0x0);return _0x2dac13['diff'](_0x195cd4,_0x9bb1('0x1'));}function QueueCallerAbandon(_0x2f5e80,_0x70af17){this[_0x9bb1('0x2')]=_0x2f5e80['scheduledat'];this[_0x9bb1('0x3')]=_0x2f5e80['type'];this[_0x9bb1('0x4')]=_0x2f5e80[_0x9bb1('0x3')]===_0x9bb1('0x5')?'queue':_0x2f5e80['type'];this[_0x9bb1('0x6')]=_0x2f5e80[_0x9bb1('0x6')];this[_0x9bb1('0x7')]=_0x2f5e80[_0x9bb1('0x7')];this[_0x9bb1('0x8')]=_0x2f5e80[_0x9bb1('0x8')];this[_0x9bb1('0x9')]=_0x2f5e80[_0x9bb1('0x6')]+_0x2f5e80[_0x9bb1('0x7')]+_0x2f5e80[_0x9bb1('0x8')]+_0x2f5e80[_0x9bb1('0xa')]+_0x2f5e80['countdropretry']+_0x2f5e80['countabandonedretry']+_0x2f5e80['countmachineretry']+_0x2f5e80[_0x9bb1('0xb')];this['countnosuchnumberretry']=_0x2f5e80[_0x9bb1('0xa')];this[_0x9bb1('0xc')]=_0x2f5e80[_0x9bb1('0xc')];this[_0x9bb1('0xd')]=_0x2f5e80[_0x9bb1('0xd')];this['countmachineretry']=_0x2f5e80[_0x9bb1('0xe')];this[_0x9bb1('0xb')]=_0x2f5e80[_0x9bb1('0xb')];this[_0x9bb1('0xf')]=_0x70af17[_0x9bb1('0xf')];this['calleridname']=_0x2f5e80[_0x9bb1('0x10')];this[_0x9bb1('0x11')]=_0x2f5e80[_0x9bb1('0x12')];this[_0x9bb1('0x13')]=_0x2f5e80[_0x9bb1('0x13')];this[_0x9bb1('0x14')]=_0x2f5e80[_0x9bb1('0x14')];this[_0x9bb1('0x15')]=_0x2f5e80[_0x9bb1('0x15')];this[_0x9bb1('0x16')]=this[_0x9bb1('0x15')];this['ringtime']=getSeconds(_0x2f5e80[_0x9bb1('0x14')],_0x2f5e80['starttime']);this[_0x9bb1('0x17')]=getSeconds(this[_0x9bb1('0x15')],_0x2f5e80[_0x9bb1('0x14')]);this[_0x9bb1('0x18')]=0x0;this[_0x9bb1('0x19')]=_0x70af17[_0x9bb1('0x19')];this[_0x9bb1('0x1a')]=_0x70af17[_0x9bb1('0x1b')];this['reason']=_0x70af17[_0x9bb1('0x1c')];this['callback']=_0x2f5e80['callback'];this[_0x9bb1('0x1d')]=_0x2f5e80[_0x9bb1('0x1d')];this['callbackat']=_0x2f5e80[_0x9bb1('0x1e')];this[_0x9bb1('0x1f')]=_0x2f5e80[_0x9bb1('0x1f')];this[_0x9bb1('0x20')]=_0x2f5e80[_0x9bb1('0x20')];this['ListId']=_0x2f5e80[_0x9bb1('0x21')];this[_0x9bb1('0x22')]=_0x2f5e80[_0x9bb1('0x22')];this['VoiceQueueId']=_0x2f5e80[_0x9bb1('0x23')];this[_0x9bb1('0x24')]=_0x2f5e80['CampaignId'];this[_0x9bb1('0x25')]=_0x2f5e80[_0x9bb1('0x25')]||'';this[_0x9bb1('0x26')]=_0x2f5e80[_0x9bb1('0x26')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 48d7d28..1f2f531 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(_0x7f6d73,_0x50ba11){var _0x5bfb43=function(_0x31ad2f){while(--_0x31ad2f){_0x7f6d73['push'](_0x7f6d73['shift']());}};_0x5bfb43(++_0x50ba11);}(_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(_0x4a71dc,_0x3ba07c){var _0x5b3317=function(_0x27c3bc){while(--_0x27c3bc){_0x4a71dc['push'](_0x4a71dc['shift']());}};_0x5b3317(++_0x3ba07c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 bf19f9b..8e7939d 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 _0xbc9d=['notify','error','\x20notify\x20','stringify','catch','merge','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channels','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','syncNewExten','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','then'];(function(_0x2f44f5,_0x4553df){var _0x239a8c=function(_0x2794b4){while(--_0x2794b4){_0x2f44f5['push'](_0x2f44f5['shift']());}};_0x239a8c(++_0x4553df);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x2a362a,_0x3c9015){_0x2a362a=_0x2a362a-0x0;var _0x3a77d9=_0xbc9d[_0x2a362a];return _0x3a77d9;};'use strict';var util=require(_0xdbc9('0x0'));var _=require(_0xdbc9('0x1'));var BPromise=require(_0xdbc9('0x2'));var uuid=require(_0xdbc9('0x3'));var moment=require(_0xdbc9('0x4'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0xdbc9('0x5'))(_0xdbc9('0x6'));var ami=require(_0xdbc9('0x7'));var rpcDb=require(_0xdbc9('0x8'));var Channel=require(_0xdbc9('0x9'));var ut=require(_0xdbc9('0xa'));var Action=require(_0xdbc9('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xdbc9('0xc'));var faxMessage=require(_0xdbc9('0xd'));function Fax(_0x3d4918){this['channels']={};this[_0xdbc9('0xe')]=_0x3d4918['faxAccounts'];this['trunks']=_0x3d4918[_0xdbc9('0xf')];this[_0xdbc9('0x10')]={};ami['on'](_0xdbc9('0x11'),this[_0xdbc9('0x12')]['bind'](this));ami['on'](_0xdbc9('0x13'),this[_0xdbc9('0x14')][_0xdbc9('0x15')](this));ami['on'](_0xdbc9('0x16'),this[_0xdbc9('0x17')][_0xdbc9('0x15')](this));ami['on']('newexten',this['syncNewExten'][_0xdbc9('0x15')](this));ami['on'](_0xdbc9('0x18'),this[_0xdbc9('0x19')][_0xdbc9('0x15')](this));ami['on'](_0xdbc9('0x1a'),this['syncReceiveFax'][_0xdbc9('0x15')](this));ami['on'](_0xdbc9('0x1b'),this[_0xdbc9('0x1c')]['bind'](this));ami['on'](_0xdbc9('0x1d'),this[_0xdbc9('0x1e')]['bind'](this));}Fax[_0xdbc9('0x1f')][_0xdbc9('0x12')]=function(_0x2a2bd2){if(_0x2a2bd2[_0xdbc9('0x20')]===_0xdbc9('0x21')){for(var _0x33f1bd in this[_0xdbc9('0xe')]){if(this[_0xdbc9('0xe')][_0xdbc9('0x22')](_0x33f1bd)){if(_0x2a2bd2[_0xdbc9('0x23')]===this['faxAccounts'][_0x33f1bd][_0xdbc9('0x24')]){this['channels'][_0x2a2bd2[_0xdbc9('0x25')]]={};this[_0xdbc9('0x26')][_0x2a2bd2['uniqueid']][_0xdbc9('0x27')]=_0x2a2bd2['channel'];this['channels'][_0x2a2bd2['uniqueid']]['id']=this['faxAccounts'][_0x33f1bd]['id'];this[_0xdbc9('0x26')][_0x2a2bd2[_0xdbc9('0x25')]]['name']=this[_0xdbc9('0xe')][_0x33f1bd][_0xdbc9('0x28')];logger['info'](_0x2a2bd2[_0xdbc9('0x25')],_0xdbc9('0x29'));}}}}if(this[_0xdbc9('0x10')][_0x2a2bd2[_0xdbc9('0x25')]]){this[_0xdbc9('0x26')][_0x2a2bd2[_0xdbc9('0x25')]]={};this[_0xdbc9('0x26')][_0x2a2bd2[_0xdbc9('0x25')]][_0xdbc9('0x27')]=_0x2a2bd2['channel'];logger[_0xdbc9('0x2a')](_0x2a2bd2[_0xdbc9('0x25')],_0xdbc9('0x29'));}};Fax[_0xdbc9('0x1f')][_0xdbc9('0x14')]=function(_0x50c3ee){if(this[_0xdbc9('0x26')][_0x50c3ee[_0xdbc9('0x25')]]){for(var _0x5300bd in _0x50c3ee['variable']){if(_0x50c3ee[_0xdbc9('0x2b')][_0xdbc9('0x22')](_0x5300bd)){this[_0xdbc9('0x26')][_0x50c3ee['uniqueid']][_0x5300bd]=_0x50c3ee[_0xdbc9('0x2c')];}}}};Fax['prototype']['syncNewState']=function(_0x210a40){if(this['channels'][_0x210a40['uniqueid']]){this[_0xdbc9('0x26')][_0x210a40[_0xdbc9('0x25')]][_0xdbc9('0x2d')]=_0x210a40['channelstate'];this[_0xdbc9('0x26')][_0x210a40[_0xdbc9('0x25')]]['channelstatedesc']=_0x210a40['channelstatedesc'];}};Fax[_0xdbc9('0x1f')][_0xdbc9('0x2e')]=function(_0x1e0fec){if(this[_0xdbc9('0x26')][_0x1e0fec[_0xdbc9('0x25')]]){for(var _0x16c9db in _0x1e0fec[_0xdbc9('0x2b')]){if(_0x1e0fec['variable'][_0xdbc9('0x22')](_0x16c9db)){this[_0xdbc9('0x26')][_0x1e0fec[_0xdbc9('0x25')]][_0x16c9db]=_0x1e0fec[_0xdbc9('0x2c')];}}}};Fax[_0xdbc9('0x1f')][_0xdbc9('0x19')]=function(_0x537af2){if(this[_0xdbc9('0x26')][_0x537af2['uniqueid']]){this['channels'][_0x537af2['uniqueid']]['operation']=_0x537af2['operation'];this[_0xdbc9('0x26')][_0x537af2[_0xdbc9('0x25')]][_0xdbc9('0x2f')]=_0x537af2['status'];this[_0xdbc9('0x26')][_0x537af2[_0xdbc9('0x25')]][_0xdbc9('0x24')]=_0x537af2[_0xdbc9('0x24')];this[_0xdbc9('0x26')][_0x537af2[_0xdbc9('0x25')]]['filename']=_0x537af2[_0xdbc9('0x30')];logger[_0xdbc9('0x2a')](_0x537af2[_0xdbc9('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0xdbc9('0x1f')][_0xdbc9('0x31')]=function(_0x30fa5c){var _0x1767bd=this;if(this['channels'][_0x30fa5c['uniqueid']]){var _0x115ef4=this[_0xdbc9('0x26')][_0x30fa5c[_0xdbc9('0x25')]]['id'];this[_0xdbc9('0x26')][_0x30fa5c['uniqueid']][_0xdbc9('0x32')]=_0x30fa5c[_0xdbc9('0x32')];this[_0xdbc9('0x26')][_0x30fa5c['uniqueid']][_0xdbc9('0x33')]=_0x30fa5c[_0xdbc9('0x33')];this[_0xdbc9('0x26')][_0x30fa5c['uniqueid']][_0xdbc9('0x24')]=_0x30fa5c[_0xdbc9('0x24')];this['channels'][_0x30fa5c['uniqueid']][_0xdbc9('0x34')]=_0x30fa5c[_0xdbc9('0x34')];this[_0xdbc9('0x26')][_0x30fa5c[_0xdbc9('0x25')]]['transferrate']=_0x30fa5c[_0xdbc9('0x35')];this[_0xdbc9('0x26')][_0x30fa5c['uniqueid']][_0xdbc9('0x30')]=_0x30fa5c[_0xdbc9('0x30')];this['channels'][_0x30fa5c[_0xdbc9('0x25')]][_0xdbc9('0x36')]=_0x30fa5c[_0xdbc9('0x36')];if(this[_0xdbc9('0x26')][_0x30fa5c[_0xdbc9('0x25')]][_0xdbc9('0x33')]>0x0){tiff2pdf(_0x30fa5c[_0xdbc9('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x5bf8af){logger[_0xdbc9('0x2a')](_0x30fa5c[_0xdbc9('0x25')],_0xdbc9('0x37'),_0x5bf8af[_0xdbc9('0x38')]);attachment[_0xdbc9('0x39')]({'name':path[_0xdbc9('0x3a')](_0x30fa5c[_0xdbc9('0x30')])[_0xdbc9('0x28')],'basename':path[_0xdbc9('0x3a')](_0x30fa5c[_0xdbc9('0x30')])[_0xdbc9('0x28')]+'.pdf','type':'application/pdf'})[_0xdbc9('0x3b')](function(_0xecaed6){faxAccount[_0xdbc9('0x3c')](_0x115ef4,{'from':_0x30fa5c[_0xdbc9('0x36')],'mapKey':_0xdbc9('0x6'),'body':path[_0xdbc9('0x3a')](_0x30fa5c[_0xdbc9('0x30')])[_0xdbc9('0x28')]+'.pdf','AttachmentId':_0xecaed6['id']})['catch'](function(_0xf24b3f){logger[_0xdbc9('0x3d')](_0x30fa5c[_0xdbc9('0x25')],_0xdbc9('0x3e'),JSON[_0xdbc9('0x3f')](_0xf24b3f));});})[_0xdbc9('0x40')](function(_0x1a5825){logger[_0xdbc9('0x3d')](_0x30fa5c[_0xdbc9('0x25')],'\x20receiveFax\x20',JSON[_0xdbc9('0x3f')](_0x1a5825));});});}logger[_0xdbc9('0x2a')](_0x30fa5c['uniqueid'],'\x20receiveFax\x20');}};Fax[_0xdbc9('0x1f')][_0xdbc9('0x1e')]=function(_0x133a13){if(this['actions'][_0x133a13[_0xdbc9('0x25')]]){_[_0xdbc9('0x41')](this[_0xdbc9('0x26')][_0x133a13[_0xdbc9('0x25')]],_['pick'](_0x133a13,[_0xdbc9('0x42'),_0xdbc9('0x43')]));}};function updateStatus(_0x468b58){if(_0x468b58[_0xdbc9('0x44')]){faxMessage['update'](_0x468b58[_0xdbc9('0x44')],{'failMessage':_0xdbc9('0x45')})[_0xdbc9('0x3b')](function(_0x2897ec){ut[_0xdbc9('0x46')](_0xdbc9('0x47'),_0x2897ec);})[_0xdbc9('0x40')](function(_0xa31276){ut['logger'](_0xdbc9('0x48'),_0xa31276);});}else{ut['logger'](_0xdbc9('0x49'));}}Fax[_0xdbc9('0x1f')]['updateStatus']=function(_0x561737,_0xc7335d,_0x4b55df){var _0x1f96f0=this;var _0x3c5f0a={};if(_0xc7335d){_0x3c5f0a={'read':_0xc7335d};}else{_0x3c5f0a={'failMessage':_0x4b55df};}if(this[_0xdbc9('0x10')][_0x561737]['AttachmentId']){faxMessage[_0xdbc9('0x4a')](this[_0xdbc9('0x10')][_0x561737][_0xdbc9('0x44')],_0x3c5f0a)[_0xdbc9('0x3b')](function(_0x1cddde){ut[_0xdbc9('0x46')](_0xdbc9('0x4b'),_0x1cddde);})[_0xdbc9('0x40')](function(_0x551681){ut['logger']('[Fax][Message][NoUpdate1]',_0x551681);})[_0xdbc9('0x4c')](function(){delete _0x1f96f0[_0xdbc9('0x26')][_0x561737];delete _0x1f96f0[_0xdbc9('0x10')][_0x561737];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0xdbc9('0x26')][_0x561737];delete this[_0xdbc9('0x10')][_0x561737];}};Fax['prototype']['syncHangup']=function(_0x7b0e49){var _0x3e9f8f=this;if(this[_0xdbc9('0x26')][_0x7b0e49[_0xdbc9('0x25')]]){if(this[_0xdbc9('0x10')][_0x7b0e49[_0xdbc9('0x25')]]){this['channels'][_0x7b0e49[_0xdbc9('0x25')]]['id']=this[_0xdbc9('0x10')][_0x7b0e49[_0xdbc9('0x25')]]['id'];this['channels'][_0x7b0e49[_0xdbc9('0x25')]][_0xdbc9('0x28')]=this[_0xdbc9('0x10')][_0x7b0e49['uniqueid']][_0xdbc9('0x28')];}logger['info'](_0x7b0e49[_0xdbc9('0x25')],this[_0xdbc9('0x10')][_0x7b0e49[_0xdbc9('0x25')]]?_0xdbc9('0x4d'):_0xdbc9('0x4e'),JSON[_0xdbc9('0x3f')](this['channels'][_0x7b0e49[_0xdbc9('0x25')]]));if(this['actions'][_0x7b0e49[_0xdbc9('0x25')]]){if(this[_0xdbc9('0x26')][_0x7b0e49['uniqueid']][_0xdbc9('0x4f')]>0x0&&this[_0xdbc9('0x26')][_0x7b0e49['uniqueid']]['faxstatus']===_0xdbc9('0x50')){this[_0xdbc9('0x51')](_0x7b0e49[_0xdbc9('0x25')],!![]);}else{this['updateStatus'](_0x7b0e49[_0xdbc9('0x25')],![],this[_0xdbc9('0x26')][_0x7b0e49['uniqueid']][_0xdbc9('0x52')]?_0xdbc9('0x53')+this['channels'][_0x7b0e49['uniqueid']][_0xdbc9('0x52')]:_0xdbc9('0x54'));}}}};Fax[_0xdbc9('0x1f')][_0xdbc9('0x55')]=function(_0x3e93d3){var _0x14cbf4=this;return new BPromise(function(_0x35903a,_0x26c599){_0x14cbf4['execOriginate'](_0x3e93d3,_0x14cbf4[_0xdbc9('0xe')][_0x3e93d3[_0xdbc9('0x56')]])[_0xdbc9('0x3b')](function(_0x555f3b){ut[_0xdbc9('0x46')](_0xdbc9('0x57'),_0x555f3b);_0x35903a(ut[_0xdbc9('0x38')](_0xdbc9('0x58')));})['catch'](function(_0x2062c3){ut['logger'](_0xdbc9('0x59'),_0x2062c3);updateStatus(_0x3e93d3);_0x26c599(ut['message'](_0xdbc9('0x5a')));});});};Fax[_0xdbc9('0x1f')]['checkAfterSend']=function(_0x517e24){var _0x5bf1a8=this;return new BPromise(function(_0x408e8f,_0x378962){var _0x1ce4fc=_0x5bf1a8['checkTrunk'](_0x5bf1a8[_0xdbc9('0xe')][_0x517e24[_0xdbc9('0x56')]][_0xdbc9('0x5b')],_0x517e24);if(_0x1ce4fc[_0xdbc9('0x5c')]){_0x408e8f(ut[_0xdbc9('0x38')](_0xdbc9('0x5d')));}else{_0x378962(ut[_0xdbc9('0x38')](_0x1ce4fc[_0xdbc9('0x38')]));}});};function originate(_0xfdfb20,_0x5e6522,_0x2787d9){return new BPromise(function(_0x2c3223,_0x511778){if(_0x2787d9){var _0x5980ac=util[_0xdbc9('0x5e')](_0xdbc9('0x5f'),path[_0xdbc9('0x3a')](_0xfdfb20[_0xdbc9('0x60')])[_0xdbc9('0x28')],_0xfdfb20[_0xdbc9('0x60')]);gs[_0xdbc9('0x61')](_0x5980ac)['then'](function(){_0xfdfb20[_0xdbc9('0x60')]=util[_0xdbc9('0x5e')](_0xdbc9('0x62'),path['parse'](_0xfdfb20[_0xdbc9('0x60')])[_0xdbc9('0x63')],path[_0xdbc9('0x3a')](_0xfdfb20[_0xdbc9('0x60')])[_0xdbc9('0x28')]);_0x5e6522[_0xdbc9('0x64')]=_0xfdfb20[_0xdbc9('0x60')];ut[_0xdbc9('0x46')](_0xdbc9('0x65'),'');ami[_0xdbc9('0x66')](ut[_0xdbc9('0x67')](_0xfdfb20,_0x5e6522))[_0xdbc9('0x3b')](function(_0x5197eb){_0x2c3223(_0x5197eb);})['catch'](function(_0x4586fc){_0x511778(_0x4586fc);});})['catch'](function(_0x5257a3){_0x511778(_0x5257a3);});}else{ami[_0xdbc9('0x66')](ut[_0xdbc9('0x67')](_0xfdfb20,_0x5e6522))[_0xdbc9('0x3b')](function(_0x4c7022){_0x2c3223(_0x4c7022);})[_0xdbc9('0x40')](function(_0x7a534a){_0x511778(_0x7a534a);});}});}Fax[_0xdbc9('0x1f')]['execOriginate']=function(_0x1d1da4,_0x2572c1){var _0x54643f=this;return new BPromise(function(_0x12c44a,_0x24a851){var _0x285ae7=uuid['v4']();var _0x188596=ut[_0xdbc9('0x68')](_0x1d1da4,_0x2572c1);_0x54643f['actions'][_0x285ae7]=new Action(_0x285ae7,_0x2572c1,_0x1d1da4);var _0x4f984b=_0x54643f[_0xdbc9('0x10')][_0x285ae7];if(path[_0xdbc9('0x3a')](_0x1d1da4['path'])[_0xdbc9('0x69')]===_0xdbc9('0x6a')){originate(_0x4f984b,_0x188596,!![])[_0xdbc9('0x3b')](function(_0x5802fc){_0x12c44a(_0x5802fc);})[_0xdbc9('0x40')](function(_0x3d3fc3){_0x24a851(_0x3d3fc3);});}else{originate(_0x4f984b,_0x188596,![])[_0xdbc9('0x3b')](function(_0x43d6ff){_0x12c44a(_0x43d6ff);})[_0xdbc9('0x40')](function(_0x42516a){_0x24a851(_0x42516a);});}});};Fax[_0xdbc9('0x1f')][_0xdbc9('0x6b')]=function(_0x49bf6f){return!_[_0xdbc9('0x6c')](_0x49bf6f)&&!_[_0xdbc9('0x6c')](_0x49bf6f[_0xdbc9('0x28')])&&!_[_0xdbc9('0x6c')](_0x49bf6f['active'])&&_0x49bf6f[_0xdbc9('0x6d')]&&!_['isNil'](this['trunks'][util[_0xdbc9('0x5e')](_0xdbc9('0x6e'),_0x49bf6f['name'])])&&!_[_0xdbc9('0x6c')](this[_0xdbc9('0xf')][util[_0xdbc9('0x5e')](_0xdbc9('0x6e'),_0x49bf6f[_0xdbc9('0x28')])][_0xdbc9('0x2f')])&&(this[_0xdbc9('0xf')][util['format']('SIP/%s',_0x49bf6f[_0xdbc9('0x28')])][_0xdbc9('0x2f')]===_0xdbc9('0x6f')||this['trunks'][util[_0xdbc9('0x5e')](_0xdbc9('0x6e'),_0x49bf6f[_0xdbc9('0x28')])][_0xdbc9('0x2f')]===_0xdbc9('0x70'));};Fax[_0xdbc9('0x1f')][_0xdbc9('0x71')]=function(_0x1a4d5b,_0x330d44){if(!this[_0xdbc9('0x6b')](_0x1a4d5b)){ut[_0xdbc9('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xdbc9('0x6c')](_0x1a4d5b)?'':_0x1a4d5b['name']+_0xdbc9('0x72'));return{'isValid':![],'message':_0xdbc9('0x73')};}if(_[_0xdbc9('0x6c')](_0x330d44[_0xdbc9('0x6')])){ut[_0xdbc9('0x46')](_0xdbc9('0x74'),JSON[_0xdbc9('0x3f')](_0x330d44));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xdbc9('0x6c')](_0x330d44[_0xdbc9('0x60')])){ut[_0xdbc9('0x46')](_0xdbc9('0x75'),JSON['stringify'](_0x330d44));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xdbc9('0x76')};};module[_0xdbc9('0x77')]=Fax; \ No newline at end of file +var _0xe605=['XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','syncNewState','channelstate','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','AttachmentId','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','%s/%s.tif'];(function(_0x40a67a,_0x5c100e){var _0xb0dc9a=function(_0x13d9a7){while(--_0x13d9a7){_0x40a67a['push'](_0x40a67a['shift']());}};_0xb0dc9a(++_0x5c100e);}(_0xe605,0x92));var _0x5e60=function(_0x32a8fd,_0x517a62){_0x32a8fd=_0x32a8fd-0x0;var _0x55df00=_0xe605[_0x32a8fd];return _0x55df00;};'use strict';var util=require(_0x5e60('0x0'));var _=require(_0x5e60('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var path=require(_0x5e60('0x4'));var tiff2pdf=require(_0x5e60('0x5'));var gs=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var ami=require(_0x5e60('0x9'));var rpcDb=require(_0x5e60('0xa'));var Channel=require(_0x5e60('0xb'));var ut=require(_0x5e60('0xc'));var Action=require(_0x5e60('0xd'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x5e60('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x593118){this['channels']={};this[_0x5e60('0xf')]=_0x593118[_0x5e60('0xf')];this[_0x5e60('0x10')]=_0x593118[_0x5e60('0x10')];this[_0x5e60('0x11')]={};ami['on'](_0x5e60('0x12'),this['syncNewchannel'][_0x5e60('0x13')](this));ami['on']('varset',this[_0x5e60('0x14')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x15'),this['syncNewState'][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x16'),this[_0x5e60('0x17')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x18'),this[_0x5e60('0x19')]['bind'](this));ami['on'](_0x5e60('0x1a'),this[_0x5e60('0x1b')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x1c'),this['syncHangup'][_0x5e60('0x13')](this));ami['on']('originateresponse',this[_0x5e60('0x1d')][_0x5e60('0x13')](this));}Fax['prototype'][_0x5e60('0x1e')]=function(_0x3e1a44){if(_0x3e1a44[_0x5e60('0x1f')]===_0x5e60('0x20')){for(var _0x5c485d in this[_0x5e60('0xf')]){if(this[_0x5e60('0xf')]['hasOwnProperty'](_0x5c485d)){if(_0x3e1a44[_0x5e60('0x21')]===this[_0x5e60('0xf')][_0x5c485d][_0x5e60('0x22')]){this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]={};this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]][_0x5e60('0x25')]=_0x3e1a44[_0x5e60('0x25')];this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]['id']=this['faxAccounts'][_0x5c485d]['id'];this[_0x5e60('0x23')][_0x3e1a44['uniqueid']][_0x5e60('0x26')]=this[_0x5e60('0xf')][_0x5c485d][_0x5e60('0x26')];logger[_0x5e60('0x27')](_0x3e1a44[_0x5e60('0x24')],_0x5e60('0x28'));}}}}if(this[_0x5e60('0x11')][_0x3e1a44['uniqueid']]){this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]={};this[_0x5e60('0x23')][_0x3e1a44['uniqueid']][_0x5e60('0x25')]=_0x3e1a44[_0x5e60('0x25')];logger[_0x5e60('0x27')](_0x3e1a44[_0x5e60('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x5e60('0x29')]['syncVarSet']=function(_0x23d187){if(this[_0x5e60('0x23')][_0x23d187['uniqueid']]){for(var _0x46691f in _0x23d187[_0x5e60('0x2a')]){if(_0x23d187['variable'][_0x5e60('0x2b')](_0x46691f)){this[_0x5e60('0x23')][_0x23d187['uniqueid']][_0x46691f]=_0x23d187['value'];}}}};Fax['prototype'][_0x5e60('0x2c')]=function(_0x235cc7){if(this[_0x5e60('0x23')][_0x235cc7[_0x5e60('0x24')]]){this[_0x5e60('0x23')][_0x235cc7['uniqueid']][_0x5e60('0x2d')]=_0x235cc7[_0x5e60('0x2d')];this['channels'][_0x235cc7[_0x5e60('0x24')]]['channelstatedesc']=_0x235cc7['channelstatedesc'];}};Fax[_0x5e60('0x29')][_0x5e60('0x17')]=function(_0x1f474b){if(this[_0x5e60('0x23')][_0x1f474b[_0x5e60('0x24')]]){for(var _0xbf5b7a in _0x1f474b[_0x5e60('0x2a')]){if(_0x1f474b[_0x5e60('0x2a')][_0x5e60('0x2b')](_0xbf5b7a)){this[_0x5e60('0x23')][_0x1f474b['uniqueid']][_0xbf5b7a]=_0x1f474b[_0x5e60('0x2e')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x478415){if(this[_0x5e60('0x23')][_0x478415['uniqueid']]){this[_0x5e60('0x23')][_0x478415['uniqueid']][_0x5e60('0x2f')]=_0x478415[_0x5e60('0x2f')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]][_0x5e60('0x30')]=_0x478415[_0x5e60('0x30')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]]['localstationid']=_0x478415[_0x5e60('0x22')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]][_0x5e60('0x31')]=_0x478415[_0x5e60('0x31')];logger[_0x5e60('0x27')](_0x478415[_0x5e60('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x5e60('0x29')][_0x5e60('0x1b')]=function(_0x4cba18){var _0x532ab2=this;if(this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]){var _0x1ae294=this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]['id'];this['channels'][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x32')]=_0x4cba18[_0x5e60('0x32')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x33')]=_0x4cba18[_0x5e60('0x33')];this['channels'][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x22')]=_0x4cba18['localstationid'];this['channels'][_0x4cba18['uniqueid']][_0x5e60('0x34')]=_0x4cba18[_0x5e60('0x34')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]['transferrate']=_0x4cba18[_0x5e60('0x35')];this[_0x5e60('0x23')][_0x4cba18['uniqueid']]['filename']=_0x4cba18[_0x5e60('0x31')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x36')]=_0x4cba18[_0x5e60('0x36')];if(this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x33')]>0x0){tiff2pdf(_0x4cba18[_0x5e60('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x284e66){logger[_0x5e60('0x27')](_0x4cba18['uniqueid'],_0x5e60('0x37'),_0x284e66[_0x5e60('0x38')]);attachment[_0x5e60('0x39')]({'name':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])['name'],'basename':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])[_0x5e60('0x26')]+_0x5e60('0x3b'),'type':'application/pdf'})['then'](function(_0x5b9f5a){faxAccount[_0x5e60('0x3c')](_0x1ae294,{'from':_0x4cba18[_0x5e60('0x36')],'mapKey':_0x5e60('0x8'),'body':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])[_0x5e60('0x26')]+'.pdf','AttachmentId':_0x5b9f5a['id']})[_0x5e60('0x3d')](function(_0x1c48d0){logger[_0x5e60('0x3e')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x3f'),JSON[_0x5e60('0x40')](_0x1c48d0));});})[_0x5e60('0x3d')](function(_0x4acd96){logger[_0x5e60('0x3e')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x41'),JSON[_0x5e60('0x40')](_0x4acd96));});});}logger[_0x5e60('0x27')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x41'));}};Fax[_0x5e60('0x29')][_0x5e60('0x1d')]=function(_0x350d6d){if(this[_0x5e60('0x11')][_0x350d6d[_0x5e60('0x24')]]){_[_0x5e60('0x42')](this[_0x5e60('0x23')][_0x350d6d[_0x5e60('0x24')]],_[_0x5e60('0x43')](_0x350d6d,[_0x5e60('0x44'),_0x5e60('0x45')]));}};function updateStatus(_0x54479d){if(_0x54479d['AttachmentId']){faxMessage[_0x5e60('0x46')](_0x54479d['AttachmentId'],{'failMessage':_0x5e60('0x47')})[_0x5e60('0x48')](function(_0x20d6e6){ut[_0x5e60('0x49')](_0x5e60('0x4a'),_0x20d6e6);})[_0x5e60('0x3d')](function(_0x4b72a4){ut['logger'](_0x5e60('0x4b'),_0x4b72a4);});}else{ut[_0x5e60('0x49')](_0x5e60('0x4c'));}}Fax['prototype']['updateStatus']=function(_0x31ced8,_0x46f3ba,_0x179cc6){var _0x501b87=this;var _0x1a3ed9={};if(_0x46f3ba){_0x1a3ed9={'read':_0x46f3ba};}else{_0x1a3ed9={'failMessage':_0x179cc6};}if(this[_0x5e60('0x11')][_0x31ced8][_0x5e60('0x4d')]){faxMessage[_0x5e60('0x46')](this[_0x5e60('0x11')][_0x31ced8][_0x5e60('0x4d')],_0x1a3ed9)['then'](function(_0x412be1){ut[_0x5e60('0x49')]('[Fax][Message][Updated]',_0x412be1);})[_0x5e60('0x3d')](function(_0x3f6a1e){ut[_0x5e60('0x49')]('[Fax][Message][NoUpdate1]',_0x3f6a1e);})[_0x5e60('0x4e')](function(){delete _0x501b87[_0x5e60('0x23')][_0x31ced8];delete _0x501b87['actions'][_0x31ced8];});}else{ut[_0x5e60('0x49')](_0x5e60('0x4f'));delete this[_0x5e60('0x23')][_0x31ced8];delete this[_0x5e60('0x11')][_0x31ced8];}};Fax['prototype'][_0x5e60('0x50')]=function(_0x1abc43){var _0x4ded96=this;if(this[_0x5e60('0x23')][_0x1abc43['uniqueid']]){if(this[_0x5e60('0x11')][_0x1abc43['uniqueid']]){this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]['id']=this['actions'][_0x1abc43[_0x5e60('0x24')]]['id'];this['channels'][_0x1abc43[_0x5e60('0x24')]]['name']=this[_0x5e60('0x11')][_0x1abc43['uniqueid']][_0x5e60('0x26')];}logger[_0x5e60('0x27')](_0x1abc43[_0x5e60('0x24')],this[_0x5e60('0x11')][_0x1abc43[_0x5e60('0x24')]]?_0x5e60('0x51'):_0x5e60('0x52'),JSON['stringify'](this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]));if(this[_0x5e60('0x11')][_0x1abc43[_0x5e60('0x24')]]){if(this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]['faxpages']>0x0&&this['channels'][_0x1abc43['uniqueid']][_0x5e60('0x18')]===_0x5e60('0x53')){this['updateStatus'](_0x1abc43[_0x5e60('0x24')],!![]);}else{this[_0x5e60('0x54')](_0x1abc43['uniqueid'],![],this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]][_0x5e60('0x55')]?_0x5e60('0x56')+this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]][_0x5e60('0x55')]:_0x5e60('0x57'));}}}};Fax[_0x5e60('0x29')][_0x5e60('0x58')]=function(_0x157aad){var _0x15921d=this;return new BPromise(function(_0xc5f45,_0x2826f7){_0x15921d[_0x5e60('0x59')](_0x157aad,_0x15921d[_0x5e60('0xf')][_0x157aad[_0x5e60('0x5a')]])['then'](function(_0x922817){ut[_0x5e60('0x49')](_0x5e60('0x5b'),_0x922817);_0xc5f45(ut['message'](_0x5e60('0x5c')));})[_0x5e60('0x3d')](function(_0x58376d){ut[_0x5e60('0x49')](_0x5e60('0x5d'),_0x58376d);updateStatus(_0x157aad);_0x2826f7(ut['message'](_0x5e60('0x5e')));});});};Fax[_0x5e60('0x29')][_0x5e60('0x5f')]=function(_0xd9a0db){var _0x1db659=this;return new BPromise(function(_0x711888,_0x221f35){var _0x3b5493=_0x1db659[_0x5e60('0x60')](_0x1db659['faxAccounts'][_0xd9a0db[_0x5e60('0x5a')]][_0x5e60('0x61')],_0xd9a0db);if(_0x3b5493[_0x5e60('0x62')]){_0x711888(ut['message'](_0x5e60('0x63')));}else{_0x221f35(ut[_0x5e60('0x38')](_0x3b5493[_0x5e60('0x38')]));}});};function originate(_0x15d975,_0x3e85fe,_0x559f8c){return new BPromise(function(_0x4560e1,_0x213c7e){if(_0x559f8c){var _0x3463a7=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x5e60('0x3a')](_0x15d975[_0x5e60('0x4')])[_0x5e60('0x26')],_0x15d975[_0x5e60('0x4')]);gs[_0x5e60('0x64')](_0x3463a7)[_0x5e60('0x48')](function(){_0x15d975[_0x5e60('0x4')]=util['format'](_0x5e60('0x65'),path[_0x5e60('0x3a')](_0x15d975[_0x5e60('0x4')])['dir'],path['parse'](_0x15d975[_0x5e60('0x4')])[_0x5e60('0x26')]);_0x3e85fe[_0x5e60('0x66')]=_0x15d975['path'];ut['logger'](_0x5e60('0x67'),'');ami[_0x5e60('0x68')](ut[_0x5e60('0x69')](_0x15d975,_0x3e85fe))[_0x5e60('0x48')](function(_0x42c62d){_0x4560e1(_0x42c62d);})[_0x5e60('0x3d')](function(_0x4a1e15){_0x213c7e(_0x4a1e15);});})[_0x5e60('0x3d')](function(_0x406a74){_0x213c7e(_0x406a74);});}else{ami[_0x5e60('0x68')](ut[_0x5e60('0x69')](_0x15d975,_0x3e85fe))[_0x5e60('0x48')](function(_0x1750b5){_0x4560e1(_0x1750b5);})[_0x5e60('0x3d')](function(_0x92d9c5){_0x213c7e(_0x92d9c5);});}});}Fax[_0x5e60('0x29')]['execOriginate']=function(_0x34cfa7,_0x136464){var _0x48570a=this;return new BPromise(function(_0x306e7c,_0x26508b){var _0x530a21=uuid['v4']();var _0x312ae3=ut[_0x5e60('0x6a')](_0x34cfa7,_0x136464);_0x48570a[_0x5e60('0x11')][_0x530a21]=new Action(_0x530a21,_0x136464,_0x34cfa7);var _0x1b4aee=_0x48570a[_0x5e60('0x11')][_0x530a21];if(path[_0x5e60('0x3a')](_0x34cfa7['path'])[_0x5e60('0x6b')]===_0x5e60('0x3b')){originate(_0x1b4aee,_0x312ae3,!![])[_0x5e60('0x48')](function(_0x222d94){_0x306e7c(_0x222d94);})[_0x5e60('0x3d')](function(_0xd70e8f){_0x26508b(_0xd70e8f);});}else{originate(_0x1b4aee,_0x312ae3,![])[_0x5e60('0x48')](function(_0x3f6bb2){_0x306e7c(_0x3f6bb2);})[_0x5e60('0x3d')](function(_0x58e900){_0x26508b(_0x58e900);});}});};Fax[_0x5e60('0x29')][_0x5e60('0x6c')]=function(_0x71d909){return!_[_0x5e60('0x6d')](_0x71d909)&&!_[_0x5e60('0x6d')](_0x71d909[_0x5e60('0x26')])&&!_[_0x5e60('0x6d')](_0x71d909[_0x5e60('0x6e')])&&_0x71d909[_0x5e60('0x6e')]&&!_[_0x5e60('0x6d')](this['trunks'][util['format']('SIP/%s',_0x71d909[_0x5e60('0x26')])])&&!_[_0x5e60('0x6d')](this[_0x5e60('0x10')][util[_0x5e60('0x6f')](_0x5e60('0x70'),_0x71d909[_0x5e60('0x26')])][_0x5e60('0x30')])&&(this[_0x5e60('0x10')][util[_0x5e60('0x6f')]('SIP/%s',_0x71d909[_0x5e60('0x26')])][_0x5e60('0x30')]===_0x5e60('0x71')||this['trunks'][util[_0x5e60('0x6f')]('SIP/%s',_0x71d909['name'])]['status']===_0x5e60('0x72'));};Fax[_0x5e60('0x29')][_0x5e60('0x60')]=function(_0x148c53,_0x445e6a){if(!this[_0x5e60('0x6c')](_0x148c53)){ut[_0x5e60('0x49')](_0x5e60('0x73'),_[_0x5e60('0x6d')](_0x148c53)?'':_0x148c53['name']+_0x5e60('0x74'));return{'isValid':![],'message':_0x5e60('0x75')};}if(_[_0x5e60('0x6d')](_0x445e6a[_0x5e60('0x8')])){ut[_0x5e60('0x49')](_0x5e60('0x76'),JSON[_0x5e60('0x40')](_0x445e6a));return{'isValid':![],'message':_0x5e60('0x77')};}if(_[_0x5e60('0x6d')](_0x445e6a[_0x5e60('0x4')])){ut[_0x5e60('0x49')](_0x5e60('0x78'),JSON['stringify'](_0x445e6a));return{'isValid':![],'message':_0x5e60('0x79')};}return{'isValid':!![],'message':_0x5e60('0x7a')};};module[_0x5e60('0x7b')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index e1ce462..795d24f 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 _0x9a60=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','bluebird'];(function(_0x37a4f1,_0x3893f6){var _0x5ad34f=function(_0x2cafed){while(--_0x2cafed){_0x37a4f1['push'](_0x37a4f1['shift']());}};_0x5ad34f(++_0x3893f6);}(_0x9a60,0xf1));var _0x09a6=function(_0x50c621,_0xfc25a6){_0x50c621=_0x50c621-0x0;var _0x1e7438=_0x9a60[_0x50c621];return _0x1e7438;};'use strict';var util=require('util');var BPromise=require(_0x09a6('0x0'));var logger=require(_0x09a6('0x1'))(_0x09a6('0x2'));var _=require(_0x09a6('0x3'));var faxAccount=require(_0x09a6('0x4'));function loggerCatch(_0x3995ee){return function(_0x68d9fb){logger[_0x09a6('0x5')](_0x3995ee,util[_0x09a6('0x6')](_0x68d9fb,{'showHidden':![],'depth':null}));};}exports[_0x09a6('0x7')]=function(_0xcbe332,_0x30c655){return BPromise['resolve']()[_0x09a6('0x8')](faxAccount[_0x09a6('0x7')](_0xcbe332,_0x30c655))[_0x09a6('0x9')](loggerCatch(_0x09a6('0xa')));}; \ No newline at end of file +var _0x7017=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x56e541,_0x390e40){var _0x459cff=function(_0x1b0700){while(--_0x1b0700){_0x56e541['push'](_0x56e541['shift']());}};_0x459cff(++_0x390e40);}(_0x7017,0x128));var _0x7701=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7017[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0x7701('0x0'));var BPromise=require(_0x7701('0x1'));var logger=require(_0x7701('0x2'))(_0x7701('0x3'));var _=require(_0x7701('0x4'));var faxAccount=require(_0x7701('0x5'));function loggerCatch(_0x432d0d){return function(_0x2b9875){logger[_0x7701('0x6')](_0x432d0d,util[_0x7701('0x7')](_0x2b9875,{'showHidden':![],'depth':null}));};}exports[_0x7701('0x8')]=function(_0x58f9d7,_0x3bd967){return BPromise[_0x7701('0x9')]()[_0x7701('0xa')](faxAccount[_0x7701('0x8')](_0x58f9d7,_0x3bd967))['catch'](loggerCatch(_0x7701('0xb')));}; \ 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 87a5eef..7096a73 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 _0x288e=['info','Exec\x20gs','inspect','util','../../../../config/logger','bluebird','child_process','exec','execute'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0x288e,0xc9));var _0xe288=function(_0x205941,_0x410eb2){_0x205941=_0x205941-0x0;var _0x32478e=_0x288e[_0x205941];return _0x32478e;};'use strict';var util=require(_0xe288('0x0'));var logger=require(_0xe288('0x1'))('fax');var BPromise=require(_0xe288('0x2'));var exec=require(_0xe288('0x3'))[_0xe288('0x4')];exports[_0xe288('0x5')]=function(_0x52f588){return new BPromise(function(_0x19faa8,_0x517913){exec(_0x52f588,function(_0x198e94,_0xb456d,_0x254a50){logger[_0xe288('0x6')]('Exec\x20gs',_0xb456d);if(_0x198e94){logger[_0xe288('0x6')](_0xe288('0x7'),'\x20Error\x20:',util[_0xe288('0x8')](_0x198e94,{'showHidden':![],'depth':null}),_0xb456d,_0x254a50);_0x517913(_0x198e94);}_0x19faa8(_0xb456d);});});}; \ No newline at end of file +var _0x918d=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird'];(function(_0x5427c6,_0x1240a1){var _0x5144ff=function(_0x426797){while(--_0x426797){_0x5427c6['push'](_0x5427c6['shift']());}};_0x5144ff(++_0x1240a1);}(_0x918d,0x6a));var _0xd918=function(_0x4b76d1,_0x46aa8f){_0x4b76d1=_0x4b76d1-0x0;var _0xa09f73=_0x918d[_0x4b76d1];return _0xa09f73;};'use strict';var util=require(_0xd918('0x0'));var logger=require(_0xd918('0x1'))(_0xd918('0x2'));var BPromise=require(_0xd918('0x3'));var exec=require(_0xd918('0x4'))[_0xd918('0x5')];exports[_0xd918('0x6')]=function(_0x22a95e){return new BPromise(function(_0x2f0fc0,_0x1a9900){exec(_0x22a95e,function(_0x3bfef3,_0x52ff33,_0x159a91){logger[_0xd918('0x7')](_0xd918('0x8'),_0x52ff33);if(_0x3bfef3){logger[_0xd918('0x7')](_0xd918('0x8'),_0xd918('0x9'),util['inspect'](_0x3bfef3,{'showHidden':![],'depth':null}),_0x52ff33,_0x159a91);_0x1a9900(_0x3bfef3);}_0x2f0fc0(_0x52ff33);});});}; \ 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 9f8134d..1dfc0e0 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 _0x8086=['ecm','minrate','format','\x22%s\x22','faxdetect','t38timeout','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','localstationid','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x8086,0xd4));var _0x6808=function(_0x3cf2f5,_0xd015b2){_0x3cf2f5=_0x3cf2f5-0x0;var _0x3c5a1a=_0x8086[_0x3cf2f5];return _0x3c5a1a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x6808('0x0'));var logger=require(_0x6808('0x1'))(_0x6808('0x2'));exports[_0x6808('0x3')]=function(_0x1f466a){return{'message':_0x1f466a};};exports[_0x6808('0x4')]=function(_0x3d8ac2,_0x2cd27c){logger[_0x6808('0x5')](_0x3d8ac2,util[_0x6808('0x6')](_0x2cd27c,{'showHidden':![],'depth':null}));};exports[_0x6808('0x7')]=function(_0x3c2dfa,_0xf8536f){var _0x2484a9={'XMF-ECM':_0xf8536f[_0x6808('0x8')],'XMF-HEADERINFO':_0xf8536f['headerinfo'],'XMF-MINRATE':_0xf8536f[_0x6808('0x9')],'XMF-MAXRATE':_0xf8536f['maxrate'],'XMF-MODEM':util[_0x6808('0xa')](_0x6808('0xb'),_0xf8536f['modem']),'XMF-GATEWAY':_0xf8536f['gateway'],'XMF-FAXDETECT':_0xf8536f[_0x6808('0xc')],'XMF-T38TIMEOUT':_0xf8536f[_0x6808('0xd')],'XMF-LOCALSTATIONID':_0xf8536f['localstationid'],'XMF-PATH':_0x3c2dfa['path']};return _0x2484a9;};exports[_0x6808('0xe')]=function(_0x403a67,_0xed25ef){return{'actionid':_0x403a67[_0x6808('0xf')],'action':_0x6808('0x10'),'channel':_0x403a67[_0x6808('0x11')],'Exten':_0x6808('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0x6808('0xa')](_0x6808('0x13'),_0x403a67[_0x6808('0x14')]?_0x403a67[_0x6808('0x14')]:'',_0x403a67[_0x6808('0x15')]),'variable':_0xed25ef,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x403a67['uniqueid']};}; \ No newline at end of file +var _0xa5a1=['modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip','lodash','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa5a1,0x196));var _0x1a5a=function(_0x340fdf,_0x48ad2b){_0x340fdf=_0x340fdf-0x0;var _0x1a04c2=_0xa5a1[_0x340fdf];return _0x1a04c2;};'use strict';var util=require('util');var _=require(_0x1a5a('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x1a5a('0x1'));exports[_0x1a5a('0x2')]=function(_0x48edd2){return{'message':_0x48edd2};};exports[_0x1a5a('0x3')]=function(_0x1b64b1,_0x29a3b6){logger[_0x1a5a('0x4')](_0x1b64b1,util[_0x1a5a('0x5')](_0x29a3b6,{'showHidden':![],'depth':null}));};exports[_0x1a5a('0x6')]=function(_0x63d57e,_0x2f1bbd){var _0x4350f1={'XMF-ECM':_0x2f1bbd['ecm'],'XMF-HEADERINFO':_0x2f1bbd[_0x1a5a('0x7')],'XMF-MINRATE':_0x2f1bbd[_0x1a5a('0x8')],'XMF-MAXRATE':_0x2f1bbd[_0x1a5a('0x9')],'XMF-MODEM':util[_0x1a5a('0xa')](_0x1a5a('0xb'),_0x2f1bbd[_0x1a5a('0xc')]),'XMF-GATEWAY':_0x2f1bbd[_0x1a5a('0xd')],'XMF-FAXDETECT':_0x2f1bbd[_0x1a5a('0xe')],'XMF-T38TIMEOUT':_0x2f1bbd[_0x1a5a('0xf')],'XMF-LOCALSTATIONID':_0x2f1bbd[_0x1a5a('0x10')],'XMF-PATH':_0x63d57e[_0x1a5a('0x11')]};return _0x4350f1;};exports['variablesAction']=function(_0x5fe707,_0x1c8f2c){return{'actionid':_0x5fe707[_0x1a5a('0x12')],'action':'originate','channel':_0x5fe707[_0x1a5a('0x13')],'Exten':_0x1a5a('0x14'),'Context':_0x1a5a('0x15'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x5fe707[_0x1a5a('0x7')]?_0x5fe707[_0x1a5a('0x7')]:'',_0x5fe707[_0x1a5a('0x10')]),'variable':_0x1c8f2c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5fe707[_0x1a5a('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index c79fd84..9f9f3b2 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 _0xf691=['getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','./server','./realtime','./acw','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts'];(function(_0x432fb3,_0x48cd6c){var _0x5cbf50=function(_0x55a585){while(--_0x55a585){_0x432fb3['push'](_0x432fb3['shift']());}};_0x5cbf50(++_0x48cd6c);}(_0xf691,0x1ce));var _0x1f69=function(_0x4466b8,_0x1fd0da){_0x4466b8=_0x4466b8-0x0;var _0x29c18a=_0xf691[_0x4466b8];return _0x29c18a;};'use strict';var BPromise=require(_0x1f69('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x1f69('0x1'));var Realtime=require(_0x1f69('0x2'));var Report=require('./report');var Acw=require(_0x1f69('0x3'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x1f69('0x4'));var Fax=require(_0x1f69('0x5'));var user=require('./rpc/user');var voiceQueue=require(_0x1f69('0x6'));var voiceQueueReport=require(_0x1f69('0x7'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x1f69('0x8'));var cmHopperHistory=require(_0x1f69('0x9'));var campaign=require(_0x1f69('0xa'));var voiceExtension=require(_0x1f69('0xb'));var faxAccount=require(_0x1f69('0xc'));var zendesk=require(_0x1f69('0xd'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x1f69('0xe'));var freshdesk=require(_0x1f69('0xf'));var desk=require(_0x1f69('0x10'));var zoho=require(_0x1f69('0x11'));var vtiger=require(_0x1f69('0x12'));var freshsales=require(_0x1f69('0x13'));var servicenow=require(_0x1f69('0x14'));var dynamics365=require(_0x1f69('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 logger=require(_0x1f69('0x16'))(_0x1f69('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1f69('0x18')](_0x1f69('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1f69('0x1a')]()[_0x1f69('0x1b')](user[_0x1f69('0x1c')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x1d')]())[_0x1f69('0x1b')](user[_0x1f69('0x1e')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x1f')]())[_0x1f69('0x1b')](trunk[_0x1f69('0x20')]())['then'](realtime['initTrunks']())[_0x1f69('0x1b')](voiceQueue[_0x1f69('0x21')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x22')]())[_0x1f69('0x1b')](trigger[_0x1f69('0x23')]())['then'](realtime[_0x1f69('0x24')]())[_0x1f69('0x1b')](template[_0x1f69('0x25')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x26')]())[_0x1f69('0x1b')](zendesk[_0x1f69('0x27')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x28')]())[_0x1f69('0x1b')](salesforce['getSalesforceAccounts']())[_0x1f69('0x1b')](realtime[_0x1f69('0x29')]())[_0x1f69('0x1b')](sugarcrm[_0x1f69('0x2a')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x2b')]())[_0x1f69('0x1b')](freshdesk[_0x1f69('0x2c')]())[_0x1f69('0x1b')](realtime['initFreshdeskAccounts']())[_0x1f69('0x1b')](desk[_0x1f69('0x2d')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x2e')]())[_0x1f69('0x1b')](zoho[_0x1f69('0x2f')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x30')]())[_0x1f69('0x1b')](vtiger[_0x1f69('0x31')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x32')]())[_0x1f69('0x1b')](freshsales[_0x1f69('0x33')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x34')]())[_0x1f69('0x1b')](servicenow[_0x1f69('0x35')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x36')]())[_0x1f69('0x1b')](dynamics365[_0x1f69('0x37')]())[_0x1f69('0x1b')](realtime['initDynamics365Accounts']())[_0x1f69('0x1b')](campaign[_0x1f69('0x38')]())[_0x1f69('0x1b')](realtime['initCampaigns']())[_0x1f69('0x1b')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x1f69('0x39')]())['then'](faxAccount[_0x1f69('0x3a')]())[_0x1f69('0x1b')](realtime['initFaxAccounts']())[_0x1f69('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x1f69('0x1a')]()['then'](voiceQueueReport[_0x1f69('0x3b')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x3c')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x1f69('0x1b')](realtime[_0x1f69('0x3d')]())[_0x1f69('0x1b')](cmHopperHistory[_0x1f69('0x3e')]())['then'](realtime[_0x1f69('0x3f')]())['then'](voiceCallReport[_0x1f69('0x40')]())[_0x1f69('0x1b')](realtime[_0x1f69('0x41')]())[_0x1f69('0x42')](function(_0x1b1630){logger[_0x1f69('0x43')](_0x1f69('0x44'),util[_0x1f69('0x45')](_0x1b1630,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1f69('0x46')](realtime,preview,fax)[_0x1f69('0x1b')](function(_0x4f3f43){return initRealtime();})[_0x1f69('0x1b')](function(){return initParams();})[_0x1f69('0x1b')](function(){report[_0x1f69('0x47')]();setInterval(initRealtime,0x1388);})[_0x1f69('0x42')](function(_0x728458){logger[_0x1f69('0x43')](_0x1f69('0x48'),util[_0x1f69('0x45')](_0x728458,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xcc49=['./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','inspect','listen','sync','bluebird','util','moment','./server'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcc49,0x155));var _0x9cc4=function(_0xb18b17,_0x121eb1){_0xb18b17=_0xb18b17-0x0;var _0xd1ff7c=_0xcc49[_0xb18b17];return _0xd1ff7c;};'use strict';var BPromise=require(_0x9cc4('0x0'));var util=require(_0x9cc4('0x1'));var moment=require(_0x9cc4('0x2'));var server=require(_0x9cc4('0x3'));var Realtime=require(_0x9cc4('0x4'));var Report=require(_0x9cc4('0x5'));var Acw=require('./acw');var Trigger=require(_0x9cc4('0x6'));var Dialer=require(_0x9cc4('0x7'));var Preview=require(_0x9cc4('0x8'));var Fax=require('./fax');var user=require(_0x9cc4('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x9cc4('0xa'));var voiceCallReport=require(_0x9cc4('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x9cc4('0xc'));var cmHopperHistory=require(_0x9cc4('0xd'));var campaign=require(_0x9cc4('0xe'));var voiceExtension=require(_0x9cc4('0xf'));var faxAccount=require(_0x9cc4('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x9cc4('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x9cc4('0x12'));var desk=require(_0x9cc4('0x13'));var zoho=require(_0x9cc4('0x14'));var vtiger=require(_0x9cc4('0x15'));var freshsales=require(_0x9cc4('0x16'));var servicenow=require(_0x9cc4('0x17'));var dynamics365=require(_0x9cc4('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x9cc4('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x9cc4('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9cc4('0x1a')](_0x9cc4('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9cc4('0x1c')]()[_0x9cc4('0x1d')](user[_0x9cc4('0x1e')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x1f')]())[_0x9cc4('0x1d')](user['getTelephones']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x20')]())[_0x9cc4('0x1d')](trunk[_0x9cc4('0x21')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x22')]())[_0x9cc4('0x1d')](voiceQueue['getVoiceQueues']())[_0x9cc4('0x1d')](realtime['initVoiceQueues']())[_0x9cc4('0x1d')](trigger[_0x9cc4('0x23')]())['then'](realtime[_0x9cc4('0x24')]())['then'](template[_0x9cc4('0x25')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x26')]())[_0x9cc4('0x1d')](zendesk[_0x9cc4('0x27')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x28')]())[_0x9cc4('0x1d')](salesforce[_0x9cc4('0x29')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x2a')]())[_0x9cc4('0x1d')](sugarcrm[_0x9cc4('0x2b')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x2c')]())[_0x9cc4('0x1d')](freshdesk[_0x9cc4('0x2d')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x2e')]())[_0x9cc4('0x1d')](desk[_0x9cc4('0x2f')]())['then'](realtime[_0x9cc4('0x30')]())[_0x9cc4('0x1d')](zoho['getZohoAccounts']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x31')]())['then'](vtiger['getVtigerAccounts']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x32')]())[_0x9cc4('0x1d')](freshsales['getFreshsalesAccounts']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x33')]())[_0x9cc4('0x1d')](servicenow[_0x9cc4('0x34')]())['then'](realtime[_0x9cc4('0x35')]())[_0x9cc4('0x1d')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x9cc4('0x36')]())[_0x9cc4('0x1d')](campaign['getCampaigns']())[_0x9cc4('0x1d')](realtime['initCampaigns']())['then'](voiceExtension[_0x9cc4('0x37')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x38')]())[_0x9cc4('0x1d')](faxAccount['getFaxAccounts']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x39')]())[_0x9cc4('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x9cc4('0x1c')]()[_0x9cc4('0x1d')](voiceQueueReport[_0x9cc4('0x3a')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x3b')]())[_0x9cc4('0x1d')](cmHopperHistory[_0x9cc4('0x3c')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x3d')]())['then'](cmHopperHistory[_0x9cc4('0x3e')]())[_0x9cc4('0x1d')](realtime['initCampaignHopperHistory']())[_0x9cc4('0x1d')](voiceCallReport[_0x9cc4('0x3f')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x40')]())[_0x9cc4('0x41')](function(_0x1bb76a){logger['error']('[index.js][initParams]',util[_0x9cc4('0x42')](_0x1bb76a,{'showHidden':![],'depth':null}));});}function main(){return server[_0x9cc4('0x43')](realtime,preview,fax)[_0x9cc4('0x1d')](function(_0x25bf80){return initRealtime();})[_0x9cc4('0x1d')](function(){return initParams();})[_0x9cc4('0x1d')](function(){report[_0x9cc4('0x44')]();setInterval(initRealtime,0x1388);})[_0x9cc4('0x41')](function(_0xfbe0ab){logger['error']('[index.js][main]',util[_0x9cc4('0x42')](_0xfbe0ab,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 366d0e9..dcbff52 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 _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(_0x566458,_0x2e4161){var _0x2fa342=function(_0x5bca98){while(--_0x5bca98){_0x566458['push'](_0x566458['shift']());}};_0x2fa342(++_0x2e4161);}(_0x70e0,0x17b));var _0x070e=function(_0x221383,_0x1a6219){_0x221383=_0x221383-0x0;var _0x4e28a0=_0x70e0[_0x221383];return _0x4e28a0;};'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 +var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x4819e1,_0x44d88e){var _0xca4f58=function(_0x494088){while(--_0x494088){_0x4819e1['push'](_0x4819e1['shift']());}};_0xca4f58(++_0x44d88e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index bee7ada..f56a800 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 _0x24ba=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x24ba,0x8d));var _0xa24b=function(_0x525181,_0x52f2ca){_0x525181=_0x525181-0x0;var _0x13672b=_0x24ba[_0x525181];return _0x13672b;};'use strict';function Campaign(_0xc097e){this['id']=_0xc097e['id']||0x0;this['name']=_0xc097e['name']||'';this['type']=_0xc097e[_0xa24b('0x0')]||_0xa24b('0x1');this[_0xa24b('0x2')]=0x0;this[_0xa24b('0x3')]=0x0;this[_0xa24b('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xa24b('0x5')]='';this[_0xa24b('0x6')]=!![];this[_0xa24b('0x7')]=_0xc097e[_0xa24b('0x7')];this[_0xa24b('0x8')]=_0xc097e['limitCalls'];this[_0xa24b('0x9')]=_0xc097e[_0xa24b('0x9')]||null;this[_0xa24b('0xa')]=_0xc097e[_0xa24b('0xa')]?_0xc097e[_0xa24b('0xa')]:null;this['dialOriginateCallerIdName']=_0xc097e[_0xa24b('0xb')];this[_0xa24b('0xc')]=_0xc097e[_0xa24b('0xc')];this['dialOriginateTimeout']=_0xc097e[_0xa24b('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0xc097e['dialCongestionMaxRetry'];this[_0xa24b('0xe')]=_0xc097e[_0xa24b('0xe')];this[_0xa24b('0xf')]=_0xc097e['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0xc097e[_0xa24b('0x10')];this['dialNoAnswerMaxRetry']=_0xc097e[_0xa24b('0x11')];this[_0xa24b('0x12')]=_0xc097e[_0xa24b('0x12')];this['dialGlobalMaxRetry']=_0xc097e[_0xa24b('0x13')];this[_0xa24b('0x14')]=_0xc097e[_0xa24b('0x14')]||0x3;this[_0xa24b('0x15')]=_0xc097e[_0xa24b('0x15')]||0x96;this[_0xa24b('0x16')]=_0xc097e['dialDropMaxRetry']||0x3;this[_0xa24b('0x17')]=_0xc097e[_0xa24b('0x17')]||0x96;this[_0xa24b('0x18')]=_0xc097e[_0xa24b('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0xc097e[_0xa24b('0x19')]||0x96;this[_0xa24b('0x1a')]=_0xc097e['dialMachineMaxRetry']||0x3;this[_0xa24b('0x1b')]=_0xc097e[_0xa24b('0x1b')]||0x96;this[_0xa24b('0x1c')]=_0xc097e[_0xa24b('0x1c')]||0x3;this[_0xa24b('0x1d')]=_0xc097e[_0xa24b('0x1d')]||0x96;this[_0xa24b('0x1e')]=_0xc097e[_0xa24b('0x1e')]||_0xa24b('0x1f');this[_0xa24b('0x20')]=_0xc097e[_0xa24b('0x20')]||undefined;this[_0xa24b('0x21')]=_0xc097e[_0xa24b('0x21')]||undefined;this['dialCutDigit']=_0xc097e[_0xa24b('0x22')]||undefined;this['TrunkBackup']=_0xc097e[_0xa24b('0x23')]?_0xc097e['TrunkBackup']:undefined;this[_0xa24b('0x24')]=_0xc097e['Trunk']?_0xc097e[_0xa24b('0x24')]:undefined;this[_0xa24b('0x25')]=_0xc097e[_0xa24b('0x25')]?_0xc097e[_0xa24b('0x25')]:undefined;this['SquareProject']=_0xc097e['SquareProject']?_0xc097e[_0xa24b('0x26')]:undefined;this[_0xa24b('0x27')]=_0xc097e[_0xa24b('0x26')]?_0xc097e[_0xa24b('0x26')]['name']:undefined;this[_0xa24b('0x28')]=_0xc097e[_0xa24b('0x28')]||![];this[_0xa24b('0x29')]=_0xc097e[_0xa24b('0x29')];this[_0xa24b('0x2a')]=_0xc097e['dialAMDGreeting'];this[_0xa24b('0x2b')]=_0xc097e[_0xa24b('0x2b')];this[_0xa24b('0x2c')]=_0xc097e['dialAMDTotalAnalysisTime'];this[_0xa24b('0x2d')]=_0xc097e['dialAMDMinWordLength'];this[_0xa24b('0x2e')]=_0xc097e[_0xa24b('0x2e')];this[_0xa24b('0x2f')]=_0xc097e[_0xa24b('0x2f')];this[_0xa24b('0x30')]=_0xc097e[_0xa24b('0x30')];this[_0xa24b('0x31')]=_0xc097e['dialAMDMaximumWordLength'];}module[_0xa24b('0x32')]=Campaign; \ No newline at end of file +var _0x542d=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x261158,_0x2665a2){var _0x469dfa=function(_0x4262fe){while(--_0x4262fe){_0x261158['push'](_0x261158['shift']());}};_0x469dfa(++_0x2665a2);}(_0x542d,0x1ad));var _0xd542=function(_0x58567a,_0x126680){_0x58567a=_0x58567a-0x0;var _0x559791=_0x542d[_0x58567a];return _0x559791;};'use strict';function Campaign(_0x566e73){this['id']=_0x566e73['id']||0x0;this[_0xd542('0x0')]=_0x566e73[_0xd542('0x0')]||'';this[_0xd542('0x1')]=_0x566e73[_0xd542('0x1')]||_0xd542('0x2');this[_0xd542('0x3')]=0x0;this[_0xd542('0x4')]=0x0;this[_0xd542('0x5')]=0x0;this[_0xd542('0x6')]=0x0;this[_0xd542('0x7')]='';this[_0xd542('0x8')]=!![];this[_0xd542('0x9')]=_0x566e73[_0xd542('0x9')];this[_0xd542('0xa')]=_0x566e73[_0xd542('0xa')];this['dialTimezone']=_0x566e73[_0xd542('0xb')]||null;this['dialGlobalInterval']=_0x566e73['dialGlobalInterval']?_0x566e73[_0xd542('0xc')]:null;this[_0xd542('0xd')]=_0x566e73['dialOriginateCallerIdName'];this[_0xd542('0xe')]=_0x566e73[_0xd542('0xe')];this[_0xd542('0xf')]=_0x566e73[_0xd542('0xf')]||0x1e;this[_0xd542('0x10')]=_0x566e73[_0xd542('0x10')];this['dialCongestionRetryFrequency']=_0x566e73[_0xd542('0x11')];this['dialBusyMaxRetry']=_0x566e73[_0xd542('0x12')];this['dialBusyRetryFrequency']=_0x566e73[_0xd542('0x13')];this['dialNoAnswerMaxRetry']=_0x566e73[_0xd542('0x14')];this['dialNoAnswerRetryFrequency']=_0x566e73[_0xd542('0x15')];this['dialGlobalMaxRetry']=_0x566e73[_0xd542('0x16')];this[_0xd542('0x17')]=_0x566e73[_0xd542('0x17')]||0x3;this[_0xd542('0x18')]=_0x566e73[_0xd542('0x18')]||0x96;this['dialDropMaxRetry']=_0x566e73[_0xd542('0x19')]||0x3;this[_0xd542('0x1a')]=_0x566e73['dialDropRetryFrequency']||0x96;this[_0xd542('0x1b')]=_0x566e73[_0xd542('0x1b')]||0x3;this[_0xd542('0x1c')]=_0x566e73[_0xd542('0x1c')]||0x96;this[_0xd542('0x1d')]=_0x566e73[_0xd542('0x1d')]||0x3;this[_0xd542('0x1e')]=_0x566e73['dialMachineRetryFrequency']||0x96;this[_0xd542('0x1f')]=_0x566e73[_0xd542('0x1f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x566e73['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x566e73[_0xd542('0x20')]||_0xd542('0x21');this['dialPrefix']=_0x566e73['dialPrefix']||undefined;this[_0xd542('0x22')]=_0x566e73['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd542('0x23')]=_0x566e73['dialCutDigit']||undefined;this[_0xd542('0x24')]=_0x566e73[_0xd542('0x24')]?_0x566e73['TrunkBackup']:undefined;this[_0xd542('0x25')]=_0x566e73[_0xd542('0x25')]?_0x566e73[_0xd542('0x25')]:undefined;this[_0xd542('0x26')]=_0x566e73[_0xd542('0x26')]?_0x566e73['Interval']:undefined;this[_0xd542('0x27')]=_0x566e73[_0xd542('0x27')]?_0x566e73[_0xd542('0x27')]:undefined;this['dialQueueProject']=_0x566e73[_0xd542('0x27')]?_0x566e73[_0xd542('0x27')]['name']:undefined;this['dialAMDActive']=_0x566e73[_0xd542('0x28')]||![];this[_0xd542('0x29')]=_0x566e73[_0xd542('0x29')];this['dialAMDGreeting']=_0x566e73[_0xd542('0x2a')];this['dialAMDAfterGreetingSilence']=_0x566e73[_0xd542('0x2b')];this['dialAMDTotalAnalysisTime']=_0x566e73[_0xd542('0x2c')];this[_0xd542('0x2d')]=_0x566e73[_0xd542('0x2d')];this[_0xd542('0x2e')]=_0x566e73['dialAMDBetweenWordsSilence'];this[_0xd542('0x2f')]=_0x566e73[_0xd542('0x2f')];this[_0xd542('0x30')]=_0x566e73[_0xd542('0x30')];this[_0xd542('0x31')]=_0x566e73['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 54873c0..d8045eb 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 _0xb19a=['disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','calleridnum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','lastapplication','duration','billableseconds','holdtime','type','tag'];(function(_0x4fdc81,_0x3c1170){var _0x3ec57b=function(_0x362738){while(--_0x362738){_0x4fdc81['push'](_0x4fdc81['shift']());}};_0x3ec57b(++_0x3c1170);}(_0xb19a,0xd0));var _0xab19=function(_0x55aaac,_0x3c96dc){_0x55aaac=_0x55aaac-0x0;var _0x343103=_0xb19a[_0x55aaac];return _0x343103;};'use strict';function Channel(){this[_0xab19('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xab19('0x1')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xab19('0x2')]=undefined;this[_0xab19('0x3')]=0x0;this[_0xab19('0x4')]='';this[_0xab19('0x5')]=0x0;this[_0xab19('0x6')]=0x0;this[_0xab19('0x7')]=0x0;this[_0xab19('0x8')]=![];this['answertime']=null;this[_0xab19('0x9')]=null;this[_0xab19('0xa')]=![];this['abandoned']=![];this[_0xab19('0xb')]='';this['lastdata']='';this[_0xab19('0xc')]=0x0;this[_0xab19('0xd')]=0x0;this[_0xab19('0xe')]=0x0;this[_0xab19('0xf')]=null;this[_0xab19('0x10')]=null;this[_0xab19('0x11')]=null;this[_0xab19('0x12')]=![];this[_0xab19('0x13')]=null;this[_0xab19('0x14')]=null;this[_0xab19('0x15')]=[];this[_0xab19('0x16')]=undefined;this[_0xab19('0x17')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xab19('0x18')]=Channel; \ No newline at end of file +var _0xcabe=['exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x47ecba,_0x1732f4){var _0x53b516=function(_0x5301d6){while(--_0x5301d6){_0x47ecba['push'](_0x47ecba['shift']());}};_0x53b516(++_0x1732f4);}(_0xcabe,0x1ef));var _0xecab=function(_0xda7a5a,_0x42981b){_0xda7a5a=_0xda7a5a-0x0;var _0x478daa=_0xcabe[_0xda7a5a];return _0x478daa;};'use strict';function Channel(){this[_0xecab('0x0')]=null;this['channel']='';this[_0xecab('0x1')]='';this[_0xecab('0x2')]=0x0;this['calleridname']='';this[_0xecab('0x3')]=undefined;this[_0xecab('0x4')]=undefined;this['accountcode']=0x0;this[_0xecab('0x5')]='';this[_0xecab('0x6')]=0x0;this[_0xecab('0x7')]=0x0;this['exten']=0x0;this[_0xecab('0x8')]=![];this[_0xecab('0x9')]=null;this[_0xecab('0xa')]=null;this[_0xecab('0xb')]=![];this[_0xecab('0xc')]=![];this[_0xecab('0xd')]='';this[_0xecab('0xe')]='';this[_0xecab('0xf')]=0x0;this[_0xecab('0x10')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xecab('0x11')]=null;this[_0xecab('0x12')]=null;this['monitor']=![];this[_0xecab('0x13')]=null;this[_0xecab('0x14')]=null;this[_0xecab('0x15')]=[];this[_0xecab('0x16')]=undefined;this[_0xecab('0x17')]=undefined;this[_0xecab('0x18')]=undefined;this['mohtime']=0x0;}module[_0xecab('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 5022c9f..0706639 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 _0xa8fe=['token','tokenSecret','serverUrl','Configurations','exports','name','username','authType','password','consumerKey','consumerSecret'];(function(_0xe4874b,_0x46b032){var _0x3a8850=function(_0x56a2fb){while(--_0x56a2fb){_0xe4874b['push'](_0xe4874b['shift']());}};_0x3a8850(++_0x46b032);}(_0xa8fe,0x89));var _0xea8f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa8fe[_0x4a9fb1];return _0x348672;};'use strict';function DeskAccount(_0x42937a){this['id']=_0x42937a['id']||0x0;this['name']=_0x42937a[_0xea8f('0x0')]||'';this[_0xea8f('0x1')]=_0x42937a['username']||'';this['remoteUri']=_0x42937a['remoteUri']||'';this['authType']=_0x42937a[_0xea8f('0x2')]||'';this[_0xea8f('0x3')]=_0x42937a[_0xea8f('0x3')]||'';this[_0xea8f('0x4')]=_0x42937a[_0xea8f('0x4')]||'';this[_0xea8f('0x5')]=_0x42937a[_0xea8f('0x5')]||'';this[_0xea8f('0x6')]=_0x42937a[_0xea8f('0x6')]||'';this[_0xea8f('0x7')]=_0x42937a[_0xea8f('0x7')]||'';this['type']=_0x42937a['type']||'';this[_0xea8f('0x8')]=_0x42937a[_0xea8f('0x8')]||'';this['Configurations']=_0x42937a[_0xea8f('0x9')]||{};}module[_0xea8f('0xa')]=DeskAccount; \ No newline at end of file +var _0xc517=['exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x2429be,_0x3bce78){var _0x19e346=function(_0x21693e){while(--_0x21693e){_0x2429be['push'](_0x2429be['shift']());}};_0x19e346(++_0x3bce78);}(_0xc517,0x85));var _0x7c51=function(_0x52116b,_0x535e60){_0x52116b=_0x52116b-0x0;var _0x32e732=_0xc517[_0x52116b];return _0x32e732;};'use strict';function DeskAccount(_0x4a6861){this['id']=_0x4a6861['id']||0x0;this[_0x7c51('0x0')]=_0x4a6861['name']||'';this[_0x7c51('0x1')]=_0x4a6861['username']||'';this['remoteUri']=_0x4a6861[_0x7c51('0x2')]||'';this[_0x7c51('0x3')]=_0x4a6861[_0x7c51('0x3')]||'';this[_0x7c51('0x4')]=_0x4a6861[_0x7c51('0x4')]||'';this['consumerKey']=_0x4a6861[_0x7c51('0x5')]||'';this['consumerSecret']=_0x4a6861['consumerSecret']||'';this[_0x7c51('0x6')]=_0x4a6861['token']||'';this[_0x7c51('0x7')]=_0x4a6861[_0x7c51('0x7')]||'';this[_0x7c51('0x8')]=_0x4a6861[_0x7c51('0x8')]||'';this['serverUrl']=_0x4a6861[_0x7c51('0x9')]||'';this[_0x7c51('0xa')]=_0x4a6861[_0x7c51('0xa')]||{};}module[_0x7c51('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 70c9fd4..a0449e7 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 _0xe706=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x4c3afd,_0x3e7a45){var _0x4e2ef3=function(_0x426053){while(--_0x426053){_0x4c3afd['push'](_0x4c3afd['shift']());}};_0x4e2ef3(++_0x3e7a45);}(_0xe706,0xa3));var _0x6e70=function(_0x18e0d1,_0xbca4cb){_0x18e0d1=_0x18e0d1-0x0;var _0x58db41=_0xe706[_0x18e0d1];return _0x58db41;};'use strict';function Dynamics365Account(_0x454c8f){this['id']=_0x454c8f['id']||0x0;this[_0x6e70('0x0')]=_0x454c8f[_0x6e70('0x0')]||'';this['username']=_0x454c8f[_0x6e70('0x1')]||'';this[_0x6e70('0x2')]=_0x454c8f[_0x6e70('0x2')]||'';this[_0x6e70('0x3')]=_0x454c8f[_0x6e70('0x3')]||'';this[_0x6e70('0x4')]=_0x454c8f[_0x6e70('0x4')]||'';this[_0x6e70('0x5')]=_0x454c8f[_0x6e70('0x5')]||'';this[_0x6e70('0x6')]=_0x454c8f[_0x6e70('0x6')]||{};this[_0x6e70('0x7')]=_0x454c8f[_0x6e70('0x7')]||'';this[_0x6e70('0x8')]=_0x454c8f[_0x6e70('0x8')]||{};}module[_0x6e70('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x80ed=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0xd9ac06,_0x5c76a8){var _0x1c57b7=function(_0x32143c){while(--_0x32143c){_0xd9ac06['push'](_0xd9ac06['shift']());}};_0x1c57b7(++_0x5c76a8);}(_0x80ed,0x11c));var _0xd80e=function(_0x2aee57,_0x502082){_0x2aee57=_0x2aee57-0x0;var _0x8ca238=_0x80ed[_0x2aee57];return _0x8ca238;};'use strict';function Dynamics365Account(_0x4a9e0a){this['id']=_0x4a9e0a['id']||0x0;this['name']=_0x4a9e0a[_0xd80e('0x0')]||'';this[_0xd80e('0x1')]=_0x4a9e0a[_0xd80e('0x1')]||'';this['password']=_0x4a9e0a[_0xd80e('0x2')]||'';this[_0xd80e('0x3')]=_0x4a9e0a[_0xd80e('0x3')]||'';this[_0xd80e('0x4')]=_0x4a9e0a['tenantId']||'';this[_0xd80e('0x5')]=_0x4a9e0a[_0xd80e('0x5')]||'';this[_0xd80e('0x6')]=_0x4a9e0a['clientSecret']||{};this[_0xd80e('0x7')]=_0x4a9e0a[_0xd80e('0x7')]||'';this[_0xd80e('0x8')]=_0x4a9e0a[_0xd80e('0x8')]||{};}module[_0xd80e('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2b674c8..f952b70 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 _0x37a5=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x37a5,0x100));var _0x537a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x37a5[_0x32f7d7];return _0x133d09;};'use strict';function FaxAccount(_0x5e3a1e){this['id']=_0x5e3a1e['id']||0x0;this[_0x537a('0x0')]=_0x5e3a1e['name']||'';this['description']=_0x5e3a1e[_0x537a('0x1')];this[_0x537a('0x2')]=_0x5e3a1e[_0x537a('0x2')];this[_0x537a('0x3')]=_0x5e3a1e[_0x537a('0x3')];this[_0x537a('0x4')]=_0x5e3a1e[_0x537a('0x4')];this[_0x537a('0x5')]=_0x5e3a1e[_0x537a('0x5')]||0x960;this[_0x537a('0x6')]=_0x5e3a1e[_0x537a('0x6')]||0x3840;this[_0x537a('0x7')]=_0x5e3a1e[_0x537a('0x7')]||'v17,v27,v29';this[_0x537a('0x8')]=_0x5e3a1e['gateway']||'no';this[_0x537a('0x9')]=_0x5e3a1e[_0x537a('0x9')]||'no';this[_0x537a('0xa')]=_0x5e3a1e[_0x537a('0xa')]||0x1388;this['tech']=_0x5e3a1e[_0x537a('0xb')]||_0x537a('0xc');this['Trunk']=_0x5e3a1e[_0x537a('0xd')]?_0x5e3a1e['Trunk']:undefined;this[_0x537a('0xe')]=_0x5e3a1e[_0x537a('0xe')];this[_0x537a('0xf')]=_0x5e3a1e[_0x537a('0xf')];}module[_0x537a('0x10')]=FaxAccount; \ No newline at end of file +var _0xf9ca=['name','description','ecm','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0xf9ca,0xff));var _0xaf9c=function(_0x4dff66,_0x5ccef9){_0x4dff66=_0x4dff66-0x0;var _0xd686f4=_0xf9ca[_0x4dff66];return _0xd686f4;};'use strict';function FaxAccount(_0x43d935){this['id']=_0x43d935['id']||0x0;this[_0xaf9c('0x0')]=_0x43d935[_0xaf9c('0x0')]||'';this[_0xaf9c('0x1')]=_0x43d935['description'];this['ecm']=_0x43d935[_0xaf9c('0x2')];this['headerinfo']=_0x43d935['headerinfo'];this[_0xaf9c('0x3')]=_0x43d935['localstationid'];this[_0xaf9c('0x4')]=_0x43d935[_0xaf9c('0x4')]||0x960;this[_0xaf9c('0x5')]=_0x43d935[_0xaf9c('0x5')]||0x3840;this['modem']=_0x43d935['modem']||_0xaf9c('0x6');this[_0xaf9c('0x7')]=_0x43d935['gateway']||'no';this[_0xaf9c('0x8')]=_0x43d935[_0xaf9c('0x8')]||'no';this[_0xaf9c('0x9')]=_0x43d935['t38timeout']||0x1388;this[_0xaf9c('0xa')]=_0x43d935[_0xaf9c('0xa')]||'SIP';this[_0xaf9c('0xb')]=_0x43d935[_0xaf9c('0xb')]?_0x43d935[_0xaf9c('0xb')]:undefined;this[_0xaf9c('0xc')]=_0x43d935['ListId'];this['key']=_0x43d935[_0xaf9c('0xd')];}module[_0xaf9c('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index e22ebd2..105d51d 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 _0x6257=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2bbc95,_0x49d1ed){var _0x104479=function(_0x57710a){while(--_0x57710a){_0x2bbc95['push'](_0x2bbc95['shift']());}};_0x104479(++_0x49d1ed);}(_0x6257,0x18f));var _0x7625=function(_0x7a0c53,_0x1f9ef8){_0x7a0c53=_0x7a0c53-0x0;var _0x1eabaa=_0x6257[_0x7a0c53];return _0x1eabaa;};'use strict';function FreshdeskAccount(_0x58cadc){this['id']=_0x58cadc['id']||0x0;this[_0x7625('0x0')]=_0x58cadc[_0x7625('0x0')]||'';this[_0x7625('0x1')]=_0x58cadc[_0x7625('0x1')]||'';this['apiKey']=_0x58cadc[_0x7625('0x2')]||'';this['remoteUri']=_0x58cadc[_0x7625('0x3')]||'';this[_0x7625('0x4')]=_0x58cadc[_0x7625('0x4')]||'';this[_0x7625('0x5')]=_0x58cadc[_0x7625('0x5')]||{};}module[_0x7625('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xede7=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0xf1226a,_0x29a250){var _0x1b8fe7=function(_0x7178a5){while(--_0x7178a5){_0xf1226a['push'](_0xf1226a['shift']());}};_0x1b8fe7(++_0x29a250);}(_0xede7,0x154));var _0x7ede=function(_0x563c56,_0x5226fe){_0x563c56=_0x563c56-0x0;var _0xd18f4=_0xede7[_0x563c56];return _0xd18f4;};'use strict';function FreshdeskAccount(_0x523b5c){this['id']=_0x523b5c['id']||0x0;this[_0x7ede('0x0')]=_0x523b5c['name']||'';this[_0x7ede('0x1')]=_0x523b5c[_0x7ede('0x1')]||'';this[_0x7ede('0x2')]=_0x523b5c['token']||'';this[_0x7ede('0x3')]=_0x523b5c[_0x7ede('0x3')]||'';this[_0x7ede('0x4')]=_0x523b5c['serverUrl']||'';this[_0x7ede('0x5')]=_0x523b5c[_0x7ede('0x5')]||{};}module[_0x7ede('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 0193bbb..6880978 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 _0x6363=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x455583,_0x55ce2d){var _0xb50059=function(_0x3ce1c3){while(--_0x3ce1c3){_0x455583['push'](_0x455583['shift']());}};_0xb50059(++_0x55ce2d);}(_0x6363,0x13a));var _0x3636=function(_0x2f048d,_0x4d9394){_0x2f048d=_0x2f048d-0x0;var _0x5c3757=_0x6363[_0x2f048d];return _0x5c3757;};'use strict';function FreshsalesAccount(_0x2181e6){this['id']=_0x2181e6['id']||0x0;this['name']=_0x2181e6[_0x3636('0x0')]||'';this[_0x3636('0x1')]=_0x2181e6[_0x3636('0x1')]||'';this[_0x3636('0x2')]=_0x2181e6[_0x3636('0x3')]||'';this[_0x3636('0x4')]=_0x2181e6[_0x3636('0x4')]||'';this[_0x3636('0x5')]=_0x2181e6[_0x3636('0x5')]||'';this[_0x3636('0x6')]=_0x2181e6[_0x3636('0x6')]||{};}module[_0x3636('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x4279=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x2967ae,_0x4b5f1a){var _0x43e251=function(_0x5966e6){while(--_0x5966e6){_0x2967ae['push'](_0x2967ae['shift']());}};_0x43e251(++_0x4b5f1a);}(_0x4279,0x8d));var _0x9427=function(_0x24cb0d,_0x55c4f8){_0x24cb0d=_0x24cb0d-0x0;var _0xda4e66=_0x4279[_0x24cb0d];return _0xda4e66;};'use strict';function FreshsalesAccount(_0x1a6a23){this['id']=_0x1a6a23['id']||0x0;this[_0x9427('0x0')]=_0x1a6a23[_0x9427('0x0')]||'';this['username']=_0x1a6a23[_0x9427('0x1')]||'';this[_0x9427('0x2')]=_0x1a6a23[_0x9427('0x3')]||'';this[_0x9427('0x4')]=_0x1a6a23['remoteUri']||'';this[_0x9427('0x5')]=_0x1a6a23['serverUrl']||'';this[_0x9427('0x6')]=_0x1a6a23[_0x9427('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 4b6e893..fefa1a4 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 _0xbb74=['motionChannel','mohtime','variables','type','inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten','priority','lastAssignedTo'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xbb74,0x1e6));var _0x4bb7=function(_0x5665b0,_0x59fde7){_0x5665b0=_0x5665b0-0x0;var _0x35dbe3=_0xbb74[_0x5665b0];return _0x35dbe3;};'use strict';function QueueReport(){this[_0x4bb7('0x0')]=_0x4bb7('0x1');this['uniqueid']='';this['calleridnum']='';this[_0x4bb7('0x2')]='';this[_0x4bb7('0x3')]='';this[_0x4bb7('0x4')]=null;this[_0x4bb7('0x5')]=null;this[_0x4bb7('0x6')]=0x1;this['count']=0x1;this[_0x4bb7('0x7')]=![];this[_0x4bb7('0x8')]=null;this[_0x4bb7('0x9')]=![];this[_0x4bb7('0xa')]=null;this[_0x4bb7('0xb')]=![];this[_0x4bb7('0xc')]=null;this[_0x4bb7('0xd')]=0x1;this[_0x4bb7('0xe')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x4bb7('0xf')]='';this[_0x4bb7('0x10')]='';this[_0x4bb7('0x11')]='';this[_0x4bb7('0x12')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x4bb7('0x13')]='';this[_0x4bb7('0x14')]='voice';this[_0x4bb7('0x15')]=0x0;this[_0x4bb7('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xefb3=['exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','exports','type','inbound','calleridnum','calleridname','queue','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','connectedlinenum','connectedlinename','accountcode','context'];(function(_0x402718,_0x22529c){var _0x3e6afb=function(_0x456b60){while(--_0x456b60){_0x402718['push'](_0x402718['shift']());}};_0x3e6afb(++_0x22529c);}(_0xefb3,0xa9));var _0x3efb=function(_0x13a50f,_0x420ef7){_0x13a50f=_0x13a50f-0x0;var _0x2d17f0=_0xefb3[_0x13a50f];return _0x2d17f0;};'use strict';function QueueReport(){this[_0x3efb('0x0')]=_0x3efb('0x1');this['uniqueid']='';this[_0x3efb('0x2')]='';this[_0x3efb('0x3')]='';this[_0x3efb('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x3efb('0x5')]=0x1;this[_0x3efb('0x6')]=![];this[_0x3efb('0x7')]=null;this[_0x3efb('0x8')]=![];this[_0x3efb('0x9')]=null;this[_0x3efb('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0x3efb('0xb')]='';this[_0x3efb('0xc')]='';this[_0x3efb('0xd')]='';this[_0x3efb('0xe')]='';this[_0x3efb('0xf')]='';this[_0x3efb('0x10')]='';this[_0x3efb('0x11')]=0x0;this[_0x3efb('0x12')]=![];this[_0x3efb('0x13')]='';this['motionChannel']=_0x3efb('0x14');this[_0x3efb('0x15')]=0x0;this['variables']={};}module[_0x3efb('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1305a28..166ba43 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 _0xed62=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x2cc27a,_0x1e2a4a){var _0x2863f3=function(_0x5ed4d2){while(--_0x5ed4d2){_0x2cc27a['push'](_0x2cc27a['shift']());}};_0x2863f3(++_0x1e2a4a);}(_0xed62,0x139));var _0x2ed6=function(_0x44f29f,_0x550482){_0x44f29f=_0x44f29f-0x0;var _0x113b2d=_0xed62[_0x44f29f];return _0x113b2d;};'use strict';function SalesforceAccount(_0x15bedc){this['id']=_0x15bedc['id']||0x0;this[_0x2ed6('0x0')]=_0x15bedc[_0x2ed6('0x0')]||'';this[_0x2ed6('0x1')]=_0x15bedc['username']||'';this[_0x2ed6('0x2')]=_0x15bedc[_0x2ed6('0x2')]||'';this[_0x2ed6('0x3')]=_0x15bedc['password']||'';this[_0x2ed6('0x4')]=_0x15bedc[_0x2ed6('0x4')]||'';this['clientSecret']=_0x15bedc[_0x2ed6('0x5')]||'';this[_0x2ed6('0x6')]=_0x15bedc[_0x2ed6('0x6')]||'';this['type']=_0x15bedc[_0x2ed6('0x7')]||_0x2ed6('0x8');this[_0x2ed6('0x9')]=_0x15bedc[_0x2ed6('0x9')]||'';this[_0x2ed6('0xa')]=_0x15bedc[_0x2ed6('0xa')]||{};}module[_0x2ed6('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x3a26=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x543708,_0x517aec){var _0x348543=function(_0x50b805){while(--_0x50b805){_0x543708['push'](_0x543708['shift']());}};_0x348543(++_0x517aec);}(_0x3a26,0x129));var _0x63a2=function(_0x2e368c,_0x232676){_0x2e368c=_0x2e368c-0x0;var _0x23562c=_0x3a26[_0x2e368c];return _0x23562c;};'use strict';function SalesforceAccount(_0x17a510){this['id']=_0x17a510['id']||0x0;this['name']=_0x17a510['name']||'';this[_0x63a2('0x0')]=_0x17a510[_0x63a2('0x0')]||'';this[_0x63a2('0x1')]=_0x17a510[_0x63a2('0x1')]||'';this[_0x63a2('0x2')]=_0x17a510['password']||'';this[_0x63a2('0x3')]=_0x17a510[_0x63a2('0x3')]||'';this[_0x63a2('0x4')]=_0x17a510['clientSecret']||'';this[_0x63a2('0x5')]=_0x17a510[_0x63a2('0x5')]||'';this[_0x63a2('0x6')]=_0x17a510['type']||_0x63a2('0x7');this[_0x63a2('0x8')]=_0x17a510[_0x63a2('0x8')]||'';this[_0x63a2('0x9')]=_0x17a510[_0x63a2('0x9')]||{};}module[_0x63a2('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a1eaa55..341a740 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 _0x8d86=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5a46d7,_0x2c8f00){var _0x2c3875=function(_0x420656){while(--_0x420656){_0x5a46d7['push'](_0x5a46d7['shift']());}};_0x2c3875(++_0x2c8f00);}(_0x8d86,0x1e8));var _0x68d8=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x8d86[_0x75f869];return _0x10af8b;};'use strict';function ServicenowAccount(_0x53e929){this['id']=_0x53e929['id']||0x0;this[_0x68d8('0x0')]=_0x53e929[_0x68d8('0x0')]||'';this[_0x68d8('0x1')]=_0x53e929[_0x68d8('0x1')]||'';this['password']=_0x53e929[_0x68d8('0x2')]||'';this[_0x68d8('0x3')]=_0x53e929[_0x68d8('0x3')]||'';this['serverUrl']=_0x53e929[_0x68d8('0x4')]||'';this[_0x68d8('0x5')]=_0x53e929[_0x68d8('0x5')]||{};}module[_0x68d8('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x8ea4=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x36301f,_0x37a90d){var _0x10da6d=function(_0x9cbce1){while(--_0x9cbce1){_0x36301f['push'](_0x36301f['shift']());}};_0x10da6d(++_0x37a90d);}(_0x8ea4,0x190));var _0x48ea=function(_0x3dd991,_0x4bef12){_0x3dd991=_0x3dd991-0x0;var _0x251609=_0x8ea4[_0x3dd991];return _0x251609;};'use strict';function ServicenowAccount(_0x45b439){this['id']=_0x45b439['id']||0x0;this[_0x48ea('0x0')]=_0x45b439[_0x48ea('0x0')]||'';this[_0x48ea('0x1')]=_0x45b439[_0x48ea('0x1')]||'';this['password']=_0x45b439[_0x48ea('0x2')]||'';this[_0x48ea('0x3')]=_0x45b439[_0x48ea('0x3')]||'';this['serverUrl']=_0x45b439[_0x48ea('0x4')]||'';this[_0x48ea('0x5')]=_0x45b439[_0x48ea('0x5')]||{};}module[_0x48ea('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 28a520c..1b41ff9 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 _0x1432=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x126567,_0x235fcc){var _0x26905a=function(_0x494cd8){while(--_0x494cd8){_0x126567['push'](_0x126567['shift']());}};_0x26905a(++_0x235fcc);}(_0x1432,0x1bd));var _0x2143=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x1432[_0x45f951];return _0x24756c;};'use strict';function SugarcrmAccount(_0x54af41){this['id']=_0x54af41['id']||0x0;this[_0x2143('0x0')]=_0x54af41[_0x2143('0x0')]||'';this[_0x2143('0x1')]=_0x54af41[_0x2143('0x1')]||'';this[_0x2143('0x2')]=_0x54af41[_0x2143('0x2')]||'';this[_0x2143('0x3')]=_0x54af41['remoteUri']||'';this[_0x2143('0x4')]=_0x54af41[_0x2143('0x4')]||'';this[_0x2143('0x5')]=_0x54af41[_0x2143('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xef40=['exports','username','password','remoteUri','serverUrl','Configurations'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0xef40,0x8b));var _0x0ef4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xef40[_0x1facfa];return _0x9ec701;};'use strict';function SugarcrmAccount(_0x12e78a){this['id']=_0x12e78a['id']||0x0;this['name']=_0x12e78a['name']||'';this[_0x0ef4('0x0')]=_0x12e78a[_0x0ef4('0x0')]||'';this['password']=_0x12e78a[_0x0ef4('0x1')]||'';this['remoteUri']=_0x12e78a[_0x0ef4('0x2')]||'';this['serverUrl']=_0x12e78a[_0x0ef4('0x3')]||'';this[_0x0ef4('0x4')]=_0x12e78a[_0x0ef4('0x4')]||{};}module[_0x0ef4('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3034669..6215692 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 _0x180d=['exports','name','accountcode','state','stateTime','status','unknown','address'];(function(_0xe8cc42,_0x12565c){var _0x524e20=function(_0x2d5d48){while(--_0x2d5d48){_0xe8cc42['push'](_0xe8cc42['shift']());}};_0x524e20(++_0x12565c);}(_0x180d,0xf9));var _0xd180=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x180d[_0x36eaaa];return _0x461349;};'use strict';function Telephone(_0x3c1f50){this['id']=_0x3c1f50['id']||0x0;this[_0xd180('0x0')]=_0x3c1f50[_0xd180('0x0')]||'';this[_0xd180('0x1')]=_0x3c1f50[_0xd180('0x1')]||'';this[_0xd180('0x2')]='unknown';this[_0xd180('0x3')]=0x0;this[_0xd180('0x4')]=_0xd180('0x5');this[_0xd180('0x6')]='';}module[_0xd180('0x7')]=Telephone; \ No newline at end of file +var _0x9d62=['address','name','accountcode','unknown','stateTime','status'];(function(_0x29466e,_0x48f04a){var _0x348d5a=function(_0x26105b){while(--_0x26105b){_0x29466e['push'](_0x29466e['shift']());}};_0x348d5a(++_0x48f04a);}(_0x9d62,0xaf));var _0x29d6=function(_0x19e52c,_0x55db35){_0x19e52c=_0x19e52c-0x0;var _0x1e4a2c=_0x9d62[_0x19e52c];return _0x1e4a2c;};'use strict';function Telephone(_0x5bd4a){this['id']=_0x5bd4a['id']||0x0;this[_0x29d6('0x0')]=_0x5bd4a[_0x29d6('0x0')]||'';this[_0x29d6('0x1')]=_0x5bd4a[_0x29d6('0x1')]||'';this['state']=_0x29d6('0x2');this[_0x29d6('0x3')]=0x0;this[_0x29d6('0x4')]=_0x29d6('0x2');this[_0x29d6('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 1489c97..a100bcb 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(_0x1cdb05,_0x421794){var _0x369a17=function(_0x17efe7){while(--_0x17efe7){_0x1cdb05['push'](_0x1cdb05['shift']());}};_0x369a17(++_0x421794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x28c495,_0x47136a){var _0x58596d=function(_0x1e88f7){while(--_0x1e88f7){_0x28c495['push'](_0x28c495['shift']());}};_0x58596d(++_0x47136a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 e5d3469..d7968a7 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x0b0e[_0x5c3ae9];return _0x3f5950;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5862f5f..525345d 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 _0x46a6=['unknown','stateTime','status','registry','indexOf','split','port','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state'];(function(_0x4225f6,_0x51e304){var _0x298580=function(_0x4f8201){while(--_0x4f8201){_0x4225f6['push'](_0x4225f6['shift']());}};_0x298580(++_0x51e304);}(_0x46a6,0x1cd));var _0x646a=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0x46a6[_0x34e752];return _0x7c6347;};'use strict';function Trunk(_0x4320f4){this['id']=_0x4320f4['id']||0x0;this[_0x646a('0x0')]=_0x4320f4[_0x646a('0x0')]||![];this[_0x646a('0x1')]=_0x4320f4['name']||'';this[_0x646a('0x2')]=_0x646a('0x3');this[_0x646a('0x4')]=0x0;this[_0x646a('0x5')]='unknown';this['registry']=_0x4320f4[_0x646a('0x6')]&&_0x4320f4[_0x646a('0x6')][_0x646a('0x7')](':')?_0x4320f4[_0x646a('0x6')][_0x646a('0x8')](':')[0x0]:'';this['host']='';this[_0x646a('0x9')]='';this['domain']='';this[_0x646a('0xa')]='';this[_0x646a('0xb')]='';this[_0x646a('0xc')]=_0x646a('0x3');this['registrationtime']='';this[_0x646a('0xd')]='';this['defaultuser']=_0x4320f4[_0x646a('0xe')]||'';}module[_0x646a('0xf')]=Trunk; \ No newline at end of file +var _0xe7e7=['domain','domainport','refresh','stateRegistry','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','host','port'];(function(_0x3c76fc,_0x39e116){var _0x4755f5=function(_0x493e01){while(--_0x493e01){_0x3c76fc['push'](_0x3c76fc['shift']());}};_0x4755f5(++_0x39e116);}(_0xe7e7,0x1d7));var _0x7e7e=function(_0x8bc61a,_0x431b12){_0x8bc61a=_0x8bc61a-0x0;var _0x564f59=_0xe7e7[_0x8bc61a];return _0x564f59;};'use strict';function Trunk(_0x45d6af){this['id']=_0x45d6af['id']||0x0;this[_0x7e7e('0x0')]=_0x45d6af['active']||![];this[_0x7e7e('0x1')]=_0x45d6af[_0x7e7e('0x1')]||'';this[_0x7e7e('0x2')]=_0x7e7e('0x3');this[_0x7e7e('0x4')]=0x0;this[_0x7e7e('0x5')]=_0x7e7e('0x3');this[_0x7e7e('0x6')]=_0x45d6af[_0x7e7e('0x6')]&&_0x45d6af['registry']['indexOf'](':')?_0x45d6af[_0x7e7e('0x6')]['split'](':')[0x0]:'';this[_0x7e7e('0x7')]='';this[_0x7e7e('0x8')]='';this[_0x7e7e('0x9')]='';this[_0x7e7e('0xa')]='';this[_0x7e7e('0xb')]='';this[_0x7e7e('0xc')]=_0x7e7e('0x3');this['registrationtime']='';this['address']='';this[_0x7e7e('0xd')]=_0x45d6af[_0x7e7e('0xd')]||'';}module[_0x7e7e('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0908a1b..308b061 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 _0x4345=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x513540,_0x136a76){var _0x20e5a2=function(_0x5aee64){while(--_0x5aee64){_0x513540['push'](_0x513540['shift']());}};_0x20e5a2(++_0x136a76);}(_0x4345,0xe3));var _0x5434=function(_0x4208ab,_0x9f8899){_0x4208ab=_0x4208ab-0x0;var _0x56ddfe=_0x4345[_0x4208ab];return _0x56ddfe;};'use strict';function voiceExtension(_0x11e3f1){this['id']=_0x11e3f1['id']||0x0;this[_0x5434('0x0')]=_0x11e3f1[_0x5434('0x0')]||'';this[_0x5434('0x1')]=_0x11e3f1[_0x5434('0x1')]||_0x5434('0x2');this[_0x5434('0x3')]=_0x11e3f1['mandatoryDisposition']||![];}module[_0x5434('0x4')]=voiceExtension; \ No newline at end of file +var _0x428e=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x428e,0x13f));var _0xe428=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x428e[_0x540133];return _0x26b6e9;};'use strict';function voiceExtension(_0x582f0e){this['id']=_0x582f0e['id']||0x0;this[_0xe428('0x0')]=_0x582f0e[_0xe428('0x0')]||'';this[_0xe428('0x1')]=_0x582f0e[_0xe428('0x1')]||_0xe428('0x2');this['mandatoryDisposition']=_0x582f0e[_0xe428('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e927f63..6e00842 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 _0xa4e4=['dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','invalid','unavailable','ringing','wav49','gsm','rrmemory','roundrobin','name','monitor_format','inbound','waiting','talking','total','sumHoldTime','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xa4e4,0x1b2));var _0x4a4e=function(_0x2679b0,_0x2a1a6f){_0x2679b0=_0x2679b0-0x0;var _0x192302=_0xa4e4[_0x2679b0];return _0x192302;};'use strict';var statusDesc=['unknown','not_inuse',_0x4a4e('0x0'),'busy',_0x4a4e('0x1'),_0x4a4e('0x2'),_0x4a4e('0x3'),'ringinuse','onhold'];var monitorFormat={'wav':'wav','wav49':_0x4a4e('0x4'),'gsm':_0x4a4e('0x5')};var strategy={'rrmemory':_0x4a4e('0x6'),'roundrobin':_0x4a4e('0x7')};function VoiceQueue(_0x19034e){this['id']=_0x19034e['id']||0x0;this[_0x4a4e('0x8')]=_0x19034e[_0x4a4e('0x8')]||'';this[_0x4a4e('0x9')]=_0x19034e[_0x4a4e('0x9')]||'';this['type']=_0x19034e['type']||_0x4a4e('0xa');this[_0x4a4e('0xb')]=0x0;this[_0x4a4e('0xc')]=0x0;this[_0x4a4e('0xd')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x4a4e('0xe')]=0x0;this['sumBillable']=0x0;this[_0x4a4e('0xf')]=0x0;this['abandoned']=0x0;this[_0x4a4e('0x10')]=0x0;this[_0x4a4e('0x11')]=0x0;this[_0x4a4e('0x12')]=_0x19034e[_0x4a4e('0x12')]||![];this[_0x4a4e('0x13')]=_0x19034e[_0x4a4e('0x13')]||0xa;this[_0x4a4e('0x14')]=_0x19034e[_0x4a4e('0x14')]||'no';this[_0x4a4e('0x15')]=!![];this['message']='';this[_0x4a4e('0x16')]=0x0;this[_0x4a4e('0x17')]=0x0;this[_0x4a4e('0x18')]=_0x19034e['dialTimezone']||null;this[_0x4a4e('0x19')]=_0x19034e['dialGlobalInterval']?_0x19034e['dialGlobalInterval']:null;this[_0x4a4e('0x1a')]=_0x19034e[_0x4a4e('0x1a')];this[_0x4a4e('0x1b')]=_0x19034e[_0x4a4e('0x1b')]||_0x4a4e('0x1c');this['dialLimitChannel']=_0x19034e[_0x4a4e('0x1d')]||0x0;this[_0x4a4e('0x1e')]=_0x19034e[_0x4a4e('0x1e')]||0x0;this[_0x4a4e('0x1f')]=_0x19034e[_0x4a4e('0x1f')]||0x1;this[_0x4a4e('0x20')]=_0x19034e[_0x4a4e('0x20')]||_0x4a4e('0x21');this[_0x4a4e('0x22')]=_0x19034e[_0x4a4e('0x22')]||0.03;this[_0x4a4e('0x23')]=_0x19034e[_0x4a4e('0x23')]||0x258;this['dialOriginateCallerIdName']=_0x19034e[_0x4a4e('0x24')]||_0x4a4e('0x25');this[_0x4a4e('0x26')]=_0x19034e[_0x4a4e('0x26')]||'anonymous';this['dialOriginateTimeout']=_0x19034e[_0x4a4e('0x27')]||0x1e;this[_0x4a4e('0x28')]=_0x19034e[_0x4a4e('0x28')]||_0x4a4e('0x29');this[_0x4a4e('0x2a')]=_0x19034e[_0x4a4e('0x2a')]||0x3;this['dialQueueProject']=_0x19034e['dialQueueProject']||undefined;this[_0x4a4e('0x2b')]=_0x19034e[_0x4a4e('0x2b')]||0x3;this[_0x4a4e('0x2c')]=_0x19034e['dialCongestionRetryFrequency']||0x96;this[_0x4a4e('0x2d')]=_0x19034e[_0x4a4e('0x2d')]||0x3;this[_0x4a4e('0x2e')]=_0x19034e[_0x4a4e('0x2e')]||0x96;this[_0x4a4e('0x2f')]=_0x19034e[_0x4a4e('0x2f')]||0x3;this[_0x4a4e('0x30')]=_0x19034e[_0x4a4e('0x30')]||0x96;this[_0x4a4e('0x31')]=_0x19034e[_0x4a4e('0x31')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x19034e[_0x4a4e('0x32')]||0x96;this[_0x4a4e('0x33')]=_0x19034e[_0x4a4e('0x33')]||0x3;this[_0x4a4e('0x34')]=_0x19034e['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x19034e[_0x4a4e('0x35')]||0x3;this[_0x4a4e('0x36')]=_0x19034e[_0x4a4e('0x36')]||0x96;this[_0x4a4e('0x37')]=_0x19034e[_0x4a4e('0x37')]||0x3;this[_0x4a4e('0x38')]=_0x19034e['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x19034e[_0x4a4e('0x39')]||0x3;this[_0x4a4e('0x3a')]=_0x19034e[_0x4a4e('0x3a')]||0x96;this[_0x4a4e('0x3b')]=_0x19034e[_0x4a4e('0x3b')]||0x4;this['Trunk']=_0x19034e[_0x4a4e('0x3c')]?_0x19034e[_0x4a4e('0x3c')]:undefined;this[_0x4a4e('0x3d')]=_0x19034e['TrunkBackup']?_0x19034e[_0x4a4e('0x3d')]:undefined;this[_0x4a4e('0x3e')]=_0x19034e[_0x4a4e('0x3e')]||undefined;this[_0x4a4e('0x3f')]=_0x19034e['Interval']?_0x19034e[_0x4a4e('0x3f')]:undefined;this[_0x4a4e('0x40')]=_0x19034e['dialOrderByScheduledAt']||'DESC';this[_0x4a4e('0x41')]=_0x19034e['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x4a4e('0x42')]=_0x19034e[_0x4a4e('0x42')]||undefined;this['strategy']=strategy[_0x19034e[_0x4a4e('0x43')]]||_0x4a4e('0x6');this[_0x4a4e('0x44')]=!![];this[_0x4a4e('0x45')]=_0x19034e[_0x4a4e('0x45')]||![];this[_0x4a4e('0x46')]=_0x19034e[_0x4a4e('0x46')];this[_0x4a4e('0x47')]=_0x19034e[_0x4a4e('0x47')];this[_0x4a4e('0x48')]=_0x19034e[_0x4a4e('0x48')];this[_0x4a4e('0x49')]=_0x19034e[_0x4a4e('0x49')];this[_0x4a4e('0x4a')]=_0x19034e['dialAMDMinWordLength'];this[_0x4a4e('0x4b')]=_0x19034e[_0x4a4e('0x4b')];this[_0x4a4e('0x4c')]=_0x19034e[_0x4a4e('0x4c')];this['dialAMDSilenceThreshold']=_0x19034e[_0x4a4e('0x4d')];this[_0x4a4e('0x4e')]=_0x19034e[_0x4a4e('0x4e')];this[_0x4a4e('0x4f')]=0x0;this[_0x4a4e('0x50')]=0x0;this[_0x4a4e('0x51')]=_0x19034e[_0x4a4e('0x51')];this[_0x4a4e('0x52')]=0x0;this[_0x4a4e('0x53')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x4a4e('0x54')]=0x0;this[_0x4a4e('0x55')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x4a4e('0x56')]=0x0;this[_0x4a4e('0x57')]=0x0;this[_0x4a4e('0x58')]=0x0;this[_0x4a4e('0x59')]=0x0;this[_0x4a4e('0x5a')]=0x0;this[_0x4a4e('0x5b')]=0x0;this[_0x4a4e('0x5c')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x4a4e('0x5d')]=undefined;this['startPredictive']=undefined;this[_0x4a4e('0x5e')]=undefined;this[_0x4a4e('0x5f')]=1.05;this[_0x4a4e('0x60')]=0x0;this[_0x4a4e('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x4a4e('0x62')]=0x0;this[_0x4a4e('0x63')]=0x0;this[_0x4a4e('0x64')]=0x0;this[_0x4a4e('0x65')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x19034e[_0x4a4e('0x66')]||0x14;this[_0x4a4e('0x67')]=_0x19034e[_0x4a4e('0x66')]||0xa;this[_0x4a4e('0x68')]=0x0;this[_0x4a4e('0x69')]=0x0;this[_0x4a4e('0x6a')]=0x1;this['erlangCalls']=0x0;this[_0x4a4e('0x6b')]=0x0;this[_0x4a4e('0x6c')]=0x0;this[_0x4a4e('0x6d')]=0x0;this[_0x4a4e('0x6e')]=_0x19034e[_0x4a4e('0x6e')]||0x1e;this['dialRecallInQueue']=_0x19034e[_0x4a4e('0x6f')]||![];this['dialPreviewAutoRecallMe']=!!_0x19034e[_0x4a4e('0x70')]||![];this[_0x4a4e('0x71')]=_0x19034e[_0x4a4e('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x19034e[_0x4a4e('0x72')]||![];this['dialAgiAfterHangupAgent']=_0x19034e[_0x4a4e('0x73')]||![];this[_0x4a4e('0x9')]=monitorFormat[_0x19034e['monitor_format']]?monitorFormat[_0x19034e[_0x4a4e('0x9')]]:undefined;this['mandatoryDisposition']=_0x19034e[_0x4a4e('0x74')]||![];this['mandatoryDispositionPause']=_0x19034e[_0x4a4e('0x75')]?_0x19034e[_0x4a4e('0x75')]:undefined;}module[_0x4a4e('0x76')]=VoiceQueue; \ No newline at end of file +var _0x82c3=['tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x4d7c80,_0x483ef5){var _0x37912b=function(_0x1fa623){while(--_0x1fa623){_0x4d7c80['push'](_0x4d7c80['shift']());}};_0x37912b(++_0x483ef5);}(_0x82c3,0xcb));var _0x382c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x82c3[_0x491a7f];return _0x3d8f44;};'use strict';var statusDesc=[_0x382c('0x0'),_0x382c('0x1'),_0x382c('0x2'),_0x382c('0x3'),_0x382c('0x4'),_0x382c('0x5'),_0x382c('0x6'),_0x382c('0x7'),_0x382c('0x8')];var monitorFormat={'wav':_0x382c('0x9'),'wav49':_0x382c('0xa'),'gsm':_0x382c('0xb')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x382c('0xc')};function VoiceQueue(_0x13fa11){this['id']=_0x13fa11['id']||0x0;this[_0x382c('0xd')]=_0x13fa11['name']||'';this['monitor_format']=_0x13fa11[_0x382c('0xe')]||'';this['type']=_0x13fa11['type']||_0x382c('0xf');this[_0x382c('0x10')]=0x0;this[_0x382c('0x11')]=0x0;this[_0x382c('0x12')]=0x0;this['answered']=0x0;this[_0x382c('0x13')]=0x0;this[_0x382c('0x14')]=0x0;this[_0x382c('0x15')]=0x0;this[_0x382c('0x16')]=0x0;this[_0x382c('0x17')]=0x0;this['loggedIn']=0x0;this[_0x382c('0x18')]=0x0;this[_0x382c('0x19')]=_0x13fa11[_0x382c('0x19')]||![];this[_0x382c('0x1a')]=_0x13fa11[_0x382c('0x1a')]||0xa;this[_0x382c('0x1b')]=_0x13fa11['autopause']||'no';this[_0x382c('0x1c')]=!![];this[_0x382c('0x1d')]='';this[_0x382c('0x1e')]=0x0;this[_0x382c('0x1f')]=0x0;this['dialTimezone']=_0x13fa11['dialTimezone']||null;this[_0x382c('0x20')]=_0x13fa11[_0x382c('0x20')]?_0x13fa11['dialGlobalInterval']:null;this[_0x382c('0x21')]=_0x13fa11[_0x382c('0x21')];this[_0x382c('0x22')]=_0x13fa11[_0x382c('0x22')]||'progressive';this[_0x382c('0x23')]=_0x13fa11[_0x382c('0x23')]||0x0;this[_0x382c('0x24')]=_0x13fa11['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x13fa11[_0x382c('0x25')]||0x1;this[_0x382c('0x26')]=_0x13fa11[_0x382c('0x26')]||_0x382c('0x27');this['dialPredictiveOptimizationPercentage']=_0x13fa11[_0x382c('0x28')]||0.03;this[_0x382c('0x29')]=_0x13fa11[_0x382c('0x29')]||0x258;this[_0x382c('0x2a')]=_0x13fa11[_0x382c('0x2a')]||_0x382c('0x2b');this[_0x382c('0x2c')]=_0x13fa11[_0x382c('0x2c')]||_0x382c('0x2b');this[_0x382c('0x2d')]=_0x13fa11[_0x382c('0x2d')]||0x1e;this[_0x382c('0x2e')]=_0x13fa11[_0x382c('0x2e')]||_0x382c('0x2f');this[_0x382c('0x30')]=_0x13fa11['dialQueueTimeout']||0x3;this[_0x382c('0x31')]=_0x13fa11[_0x382c('0x31')]||undefined;this[_0x382c('0x32')]=_0x13fa11[_0x382c('0x32')]||0x3;this[_0x382c('0x33')]=_0x13fa11['dialCongestionRetryFrequency']||0x96;this[_0x382c('0x34')]=_0x13fa11['dialBusyMaxRetry']||0x3;this[_0x382c('0x35')]=_0x13fa11[_0x382c('0x35')]||0x96;this[_0x382c('0x36')]=_0x13fa11[_0x382c('0x36')]||0x3;this[_0x382c('0x37')]=_0x13fa11['dialNoAnswerRetryFrequency']||0x96;this[_0x382c('0x38')]=_0x13fa11['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x13fa11['dialNoSuchNumberRetryFrequency']||0x96;this[_0x382c('0x39')]=_0x13fa11[_0x382c('0x39')]||0x3;this[_0x382c('0x3a')]=_0x13fa11[_0x382c('0x3a')]||0x96;this[_0x382c('0x3b')]=_0x13fa11[_0x382c('0x3b')]||0x3;this[_0x382c('0x3c')]=_0x13fa11['dialAbandonedRetryFrequency']||0x96;this[_0x382c('0x3d')]=_0x13fa11[_0x382c('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x13fa11[_0x382c('0x3e')]||0x96;this[_0x382c('0x3f')]=_0x13fa11[_0x382c('0x3f')]||0x3;this[_0x382c('0x40')]=_0x13fa11[_0x382c('0x40')]||0x96;this['dialGlobalMaxRetry']=_0x13fa11[_0x382c('0x41')]||0x4;this['Trunk']=_0x13fa11[_0x382c('0x42')]?_0x13fa11[_0x382c('0x42')]:undefined;this[_0x382c('0x43')]=_0x13fa11[_0x382c('0x43')]?_0x13fa11['TrunkBackup']:undefined;this[_0x382c('0x44')]=_0x13fa11[_0x382c('0x44')]||undefined;this[_0x382c('0x45')]=_0x13fa11[_0x382c('0x45')]?_0x13fa11[_0x382c('0x45')]:undefined;this[_0x382c('0x46')]=_0x13fa11[_0x382c('0x46')]||_0x382c('0x47');this[_0x382c('0x48')]=_0x13fa11[_0x382c('0x48')]||undefined;this[_0x382c('0x49')]=_0x13fa11['dialCutDigit']||undefined;this[_0x382c('0x4a')]=strategy[_0x13fa11['strategy']]||_0x382c('0x4b');this[_0x382c('0x4c')]=!![];this[_0x382c('0x4d')]=_0x13fa11[_0x382c('0x4d')]||![];this[_0x382c('0x4e')]=_0x13fa11['dialAMDInitialSilence'];this[_0x382c('0x4f')]=_0x13fa11[_0x382c('0x4f')];this[_0x382c('0x50')]=_0x13fa11[_0x382c('0x50')];this['dialAMDTotalAnalysisTime']=_0x13fa11[_0x382c('0x51')];this[_0x382c('0x52')]=_0x13fa11[_0x382c('0x52')];this[_0x382c('0x53')]=_0x13fa11[_0x382c('0x53')];this[_0x382c('0x54')]=_0x13fa11['dialAMDMaximumNumberOfWords'];this[_0x382c('0x55')]=_0x13fa11[_0x382c('0x55')];this[_0x382c('0x56')]=_0x13fa11['dialAMDMaximumWordLength'];this[_0x382c('0x57')]=0x0;this['pTalking']=0x0;this[_0x382c('0x58')]=_0x13fa11[_0x382c('0x58')];this['outboundAnswerCallsDay']=0x0;this[_0x382c('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x382c('0x5a')]=0x0;this[_0x382c('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x382c('0x5c')]=0x0;this[_0x382c('0x5d')]=0x0;this[_0x382c('0x5e')]=0x0;this[_0x382c('0x5f')]=0x0;this[_0x382c('0x60')]=0x0;this[_0x382c('0x61')]=0x0;this[_0x382c('0x62')]=0x0;this[_0x382c('0x63')]=0x0;this[_0x382c('0x64')]=undefined;this[_0x382c('0x65')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x382c('0x66')]=0x0;this[_0x382c('0x67')]=0x0;this[_0x382c('0x68')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x382c('0x69')]=0x0;this[_0x382c('0x6a')]=0x0;this[_0x382c('0x6b')]=0x0;this[_0x382c('0x6c')]=0x0;this[_0x382c('0x6d')]=_0x13fa11[_0x382c('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x13fa11[_0x382c('0x6e')]||0xa;this[_0x382c('0x6f')]=0x0;this[_0x382c('0x70')]=0x0;this[_0x382c('0x71')]=0x1;this[_0x382c('0x72')]=0x0;this[_0x382c('0x73')]=0x0;this[_0x382c('0x74')]=0x0;this[_0x382c('0x75')]=0x0;this[_0x382c('0x76')]=_0x13fa11[_0x382c('0x76')]||0x1e;this['dialRecallInQueue']=_0x13fa11[_0x382c('0x77')]||![];this[_0x382c('0x78')]=!!_0x13fa11[_0x382c('0x78')]||![];this['dialQueueProject2']=_0x13fa11['dialQueueProject2']||undefined;this[_0x382c('0x79')]=_0x13fa11[_0x382c('0x79')]||![];this[_0x382c('0x7a')]=_0x13fa11[_0x382c('0x7a')]||![];this[_0x382c('0xe')]=monitorFormat[_0x13fa11[_0x382c('0xe')]]?monitorFormat[_0x13fa11['monitor_format']]:undefined;this[_0x382c('0x7b')]=_0x13fa11[_0x382c('0x7b')]||![];this[_0x382c('0x7c')]=_0x13fa11['mandatoryDispositionPause']?_0x13fa11['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 7ae5b55..10018f1 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 _0xd9c8=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x14fd97,_0x148ca4){var _0x1e4211=function(_0x3c186f){while(--_0x3c186f){_0x14fd97['push'](_0x14fd97['shift']());}};_0x1e4211(++_0x148ca4);}(_0xd9c8,0x7a));var _0x8d9c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd9c8[_0x465028];return _0xb783d4;};'use strict';function VtigerAccount(_0x938118){this['id']=_0x938118['id']||0x0;this[_0x8d9c('0x0')]=_0x938118[_0x8d9c('0x0')]||'';this[_0x8d9c('0x1')]=_0x938118['username']||'';this[_0x8d9c('0x2')]=_0x938118[_0x8d9c('0x2')]||'';this['remoteUri']=_0x938118[_0x8d9c('0x3')]||'';this[_0x8d9c('0x4')]=_0x938118[_0x8d9c('0x4')]||'';this['Configurations']=_0x938118[_0x8d9c('0x5')]||{};}module[_0x8d9c('0x6')]=VtigerAccount; \ No newline at end of file +var _0x4a9a=['remoteUri','Configurations','exports','name','username','accessKey'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x4a9a,0x123));var _0xa4a9=function(_0x1049a5,_0x15a34b){_0x1049a5=_0x1049a5-0x0;var _0x5c048f=_0x4a9a[_0x1049a5];return _0x5c048f;};'use strict';function VtigerAccount(_0x4dab9a){this['id']=_0x4dab9a['id']||0x0;this[_0xa4a9('0x0')]=_0x4dab9a[_0xa4a9('0x0')]||'';this['username']=_0x4dab9a[_0xa4a9('0x1')]||'';this[_0xa4a9('0x2')]=_0x4dab9a['accessKey']||'';this[_0xa4a9('0x3')]=_0x4dab9a[_0xa4a9('0x3')]||'';this['serverUrl']=_0x4dab9a['serverUrl']||'';this[_0xa4a9('0x4')]=_0x4dab9a[_0xa4a9('0x4')]||{};}module[_0xa4a9('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 1d51cc5..72f03cc 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 _0x824b=['token','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x2b6a99,_0x422b0e){var _0x22c41f=function(_0xce2fe6){while(--_0xce2fe6){_0x2b6a99['push'](_0x2b6a99['shift']());}};_0x22c41f(++_0x422b0e);}(_0x824b,0xc5));var _0xb824=function(_0x403ae0,_0x3918e2){_0x403ae0=_0x403ae0-0x0;var _0x144237=_0x824b[_0x403ae0];return _0x144237;};'use strict';function ZendeskAccount(_0x27bae3){this['id']=_0x27bae3['id']||0x0;this[_0xb824('0x0')]=_0x27bae3['name']||'';this['username']=_0x27bae3[_0xb824('0x1')]||'';this[_0xb824('0x2')]=_0x27bae3[_0xb824('0x2')]||'';this[_0xb824('0x3')]=_0x27bae3[_0xb824('0x3')]||'';this['remoteUri']=_0x27bae3['remoteUri']||'';this[_0xb824('0x4')]=_0x27bae3[_0xb824('0x4')]||'';this[_0xb824('0x5')]=_0x27bae3[_0xb824('0x5')]||_0xb824('0x6');this[_0xb824('0x7')]=_0x27bae3[_0xb824('0x7')]||'';this[_0xb824('0x8')]=_0x27bae3[_0xb824('0x8')]||{};}module[_0xb824('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x7686=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','username','password'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7686,0xf8));var _0x6768=function(_0x242950,_0x4124d4){_0x242950=_0x242950-0x0;var _0xcd6f5f=_0x7686[_0x242950];return _0xcd6f5f;};'use strict';function ZendeskAccount(_0x14be26){this['id']=_0x14be26['id']||0x0;this['name']=_0x14be26['name']||'';this[_0x6768('0x0')]=_0x14be26['username']||'';this[_0x6768('0x1')]=_0x14be26[_0x6768('0x1')]||'';this[_0x6768('0x2')]=_0x14be26[_0x6768('0x2')]||'';this['remoteUri']=_0x14be26[_0x6768('0x3')]||'';this[_0x6768('0x4')]=_0x14be26[_0x6768('0x4')]||'';this[_0x6768('0x5')]=_0x14be26[_0x6768('0x5')]||_0x6768('0x6');this[_0x6768('0x7')]=_0x14be26[_0x6768('0x7')]||'';this[_0x6768('0x8')]=_0x14be26[_0x6768('0x8')]||{};}module[_0x6768('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 c07d128..2860502 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 _0xe70c=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x2d1b07,_0x34e335){var _0x512a21=function(_0x23d374){while(--_0x23d374){_0x2d1b07['push'](_0x2d1b07['shift']());}};_0x512a21(++_0x34e335);}(_0xe70c,0x121));var _0xce70=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xe70c[_0x5c351c];return _0x26f3b3;};'use strict';function ZohoAccount(_0x15f138){this['id']=_0x15f138['id']||0x0;this['name']=_0x15f138[_0xce70('0x0')]||'';this[_0xce70('0x1')]=_0x15f138[_0xce70('0x1')]||'';this['host']=_0x15f138[_0xce70('0x2')]||'';this[_0xce70('0x3')]=_0x15f138[_0xce70('0x3')]||'';this[_0xce70('0x4')]=_0x15f138[_0xce70('0x4')]||'';this[_0xce70('0x5')]=_0x15f138[_0xce70('0x5')]||'';this[_0xce70('0x6')]=_0x15f138[_0xce70('0x6')]||'';this[_0xce70('0x7')]=_0x15f138[_0xce70('0x7')]||'';this[_0xce70('0x8')]=_0x15f138[_0xce70('0x8')]||'';this['Configurations']=_0x15f138[_0xce70('0x9')]||{};}module[_0xce70('0xa')]=ZohoAccount; \ No newline at end of file +var _0x2c49=['serverUrl','code','Configurations','name','description','host','zone','clientId','clientSecret'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0x2c49,0x12c));var _0x92c4=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x2c49[_0x2112d4];return _0x434972;};'use strict';function ZohoAccount(_0x3c9042){this['id']=_0x3c9042['id']||0x0;this[_0x92c4('0x0')]=_0x3c9042[_0x92c4('0x0')]||'';this[_0x92c4('0x1')]=_0x3c9042[_0x92c4('0x1')]||'';this[_0x92c4('0x2')]=_0x3c9042['host']||'';this[_0x92c4('0x3')]=_0x3c9042[_0x92c4('0x3')]||'';this[_0x92c4('0x4')]=_0x3c9042[_0x92c4('0x4')]||'';this[_0x92c4('0x5')]=_0x3c9042['clientSecret']||'';this[_0x92c4('0x6')]=_0x3c9042[_0x92c4('0x6')]||'';this[_0x92c4('0x7')]=_0x3c9042[_0x92c4('0x7')]||'';this['refreshToken']=_0x3c9042['refreshToken']||'';this['Configurations']=_0x3c9042[_0x92c4('0x8')]||{};}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 910f243..7b3619b 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 _0x71f1=['isNil','string','name','type','campaigntype','queue','Agent','channelAgent','membername','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x71f1,0x9c));var _0x171f=function(_0x5794c4,_0x309b7a){_0x5794c4=_0x5794c4-0x0;var _0x537506=_0x71f1[_0x5794c4];return _0x537506;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x2c8dfb,_0x484265,_0x5d81ac){var _0x35839c='';if(!_[_0x171f('0x0')](_0x484265)&&_0x171f('0x1')===typeof _0x484265){_0x35839c+=_0x484265;}if(!_[_0x171f('0x0')](_0x5d81ac)&&_0x171f('0x1')===typeof _0x5d81ac){_0x35839c+='\x20'+_0x5d81ac;}if(_0x35839c!==''){return _0x35839c;}return _0x2c8dfb;}function Action(_0x3bbfb2,_0xecef6b,_0x13fa1b,_0x4d09be,_0x2a79f1){this['uniqueid']=_0x13fa1b||undefined;this['idContact']=_0x3bbfb2['id'];this['queue']=_0xecef6b[_0x171f('0x2')];this[_0x171f('0x3')]=_0xecef6b['type'];this[_0x171f('0x4')]=_0x171f('0x5');this['dialAnswer']=![];this['membername']=_[_0x171f('0x0')](_0x3bbfb2[_0x171f('0x6')])?undefined:_0x3bbfb2[_0x171f('0x6')]['name'];this[_0x171f('0x7')]=this[_0x171f('0x8')]?util['format']('SIP/%s',this[_0x171f('0x8')]):_0x4d09be||undefined;this[_0x171f('0x9')]=checkNameSurname(_0x3bbfb2['Contact'][_0x171f('0xa')],_0x3bbfb2[_0x171f('0xb')][_0x171f('0xc')],_0x3bbfb2['Contact'][_0x171f('0xd')]);this[_0x171f('0xe')]=_0x3bbfb2[_0x171f('0xe')]||![];this[_0x171f('0xf')]=_0x3bbfb2[_0x171f('0xb')][_0x171f('0xa')];this[_0x171f('0x10')]=_0x3bbfb2[_0x171f('0x10')];this[_0x171f('0x11')]=_0x3bbfb2['countbusyretry']||0x0;this[_0x171f('0x12')]=_0x3bbfb2[_0x171f('0x12')]||0x0;this[_0x171f('0x13')]=_0x3bbfb2[_0x171f('0x13')]||0x0;this['countglobal']=(_0x3bbfb2['countbusyretry']||0x0)+(_0x3bbfb2['countcongestionretry']||0x0)+(_0x3bbfb2[_0x171f('0x13')]||0x0)+(_0x3bbfb2['countnosuchnumberretry']||0x0)+(_0x3bbfb2[_0x171f('0x14')]||0x0)+(_0x3bbfb2[_0x171f('0x15')]||0x0)+(_0x3bbfb2[_0x171f('0x16')]||0x0)+(_0x3bbfb2[_0x171f('0x17')]||0x0);this[_0x171f('0x18')]=_0x3bbfb2[_0x171f('0x18')]||0x0;this[_0x171f('0x14')]=_0x3bbfb2['countdropretry']||0x0;this['countabandonedretry']=_0x3bbfb2[_0x171f('0x15')]||0x0;this[_0x171f('0x16')]=_0x3bbfb2['countmachineretry']||0x0;this['countagentrejectretry']=_0x3bbfb2[_0x171f('0x17')]||0x0;this['callback']=_0x3bbfb2[_0x171f('0x19')];this[_0x171f('0x1a')]=_0x3bbfb2['callbackuniqueid'];this[_0x171f('0x1b')]=_0x3bbfb2[_0x171f('0x1b')];this[_0x171f('0x1c')]=_0x3bbfb2[_0x171f('0x1c')];this[_0x171f('0x1d')]=_0x3bbfb2['ContactId'];this[_0x171f('0x1e')]=_0x3bbfb2['ListId'];this['UserId']=_[_0x171f('0x0')](_0x3bbfb2[_0x171f('0x6')])?_0x3bbfb2[_0x171f('0x1f')]:_0x3bbfb2[_0x171f('0x6')]['id'];this[_0x171f('0x20')]=_0x3bbfb2[_0x171f('0x20')];this['originatecalleridnum']='';this[_0x171f('0x21')]='';}Action[_0x171f('0x22')][_0x171f('0x23')]=function(){return util[_0x171f('0x24')](_0x171f('0x25'),this[_0x171f('0x9')],this[_0x171f('0x26')]);};module['exports']=Action; \ No newline at end of file +var _0x85e8=['queue','name','type','dialAnswer','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85e8,0xd6));var _0x885e=function(_0x472b43,_0x542745){_0x472b43=_0x472b43-0x0;var _0x483774=_0x85e8[_0x472b43];return _0x483774;};'use strict';var util=require(_0x885e('0x0'));var _=require('lodash');var moment=require(_0x885e('0x1'));function checkNameSurname(_0x19d308,_0x476a19,_0x3e3636){var _0x36ef1a='';if(!_[_0x885e('0x2')](_0x476a19)&&_0x885e('0x3')===typeof _0x476a19){_0x36ef1a+=_0x476a19;}if(!_[_0x885e('0x2')](_0x3e3636)&&_0x885e('0x3')===typeof _0x3e3636){_0x36ef1a+='\x20'+_0x3e3636;}if(_0x36ef1a!==''){return _0x36ef1a;}return _0x19d308;}function Action(_0xdbb06f,_0x2b5b94,_0x5994fc,_0x18cfc2,_0x166b45){this[_0x885e('0x4')]=_0x5994fc||undefined;this[_0x885e('0x5')]=_0xdbb06f['id'];this[_0x885e('0x6')]=_0x2b5b94[_0x885e('0x7')];this[_0x885e('0x8')]=_0x2b5b94[_0x885e('0x8')];this['campaigntype']=_0x885e('0x6');this[_0x885e('0x9')]=![];this['membername']=_[_0x885e('0x2')](_0xdbb06f[_0x885e('0xa')])?undefined:_0xdbb06f[_0x885e('0xa')][_0x885e('0x7')];this[_0x885e('0xb')]=this['membername']?util[_0x885e('0xc')](_0x885e('0xd'),this['membername']):_0x18cfc2||undefined;this[_0x885e('0xe')]=checkNameSurname(_0xdbb06f[_0x885e('0xf')]['phone'],_0xdbb06f['Contact'][_0x885e('0x10')],_0xdbb06f['Contact'][_0x885e('0x11')]);this[_0x885e('0x12')]=_0xdbb06f['active']||![];this['calleridnum']=_0xdbb06f[_0x885e('0xf')][_0x885e('0x13')];this[_0x885e('0x14')]=_0xdbb06f['scheduledat'];this[_0x885e('0x15')]=_0xdbb06f[_0x885e('0x15')]||0x0;this[_0x885e('0x16')]=_0xdbb06f['countcongestionretry']||0x0;this[_0x885e('0x17')]=_0xdbb06f[_0x885e('0x17')]||0x0;this[_0x885e('0x18')]=(_0xdbb06f[_0x885e('0x15')]||0x0)+(_0xdbb06f[_0x885e('0x16')]||0x0)+(_0xdbb06f[_0x885e('0x17')]||0x0)+(_0xdbb06f[_0x885e('0x19')]||0x0)+(_0xdbb06f[_0x885e('0x1a')]||0x0)+(_0xdbb06f['countabandonedretry']||0x0)+(_0xdbb06f['countmachineretry']||0x0)+(_0xdbb06f[_0x885e('0x1b')]||0x0);this[_0x885e('0x19')]=_0xdbb06f[_0x885e('0x19')]||0x0;this[_0x885e('0x1a')]=_0xdbb06f[_0x885e('0x1a')]||0x0;this['countabandonedretry']=_0xdbb06f[_0x885e('0x1c')]||0x0;this[_0x885e('0x1d')]=_0xdbb06f[_0x885e('0x1d')]||0x0;this[_0x885e('0x1b')]=_0xdbb06f['countagentrejectretry']||0x0;this[_0x885e('0x1e')]=_0xdbb06f['callback'];this[_0x885e('0x1f')]=_0xdbb06f[_0x885e('0x1f')];this[_0x885e('0x20')]=_0xdbb06f[_0x885e('0x20')];this[_0x885e('0x21')]=_0xdbb06f[_0x885e('0x21')];this[_0x885e('0x22')]=_0xdbb06f[_0x885e('0x22')];this[_0x885e('0x23')]=_0xdbb06f[_0x885e('0x23')];this['UserId']=_['isNil'](_0xdbb06f[_0x885e('0xa')])?_0xdbb06f[_0x885e('0x24')]:_0xdbb06f['Agent']['id'];this[_0x885e('0x25')]=_0xdbb06f[_0x885e('0x25')];this[_0x885e('0x26')]='';this[_0x885e('0x27')]='';}Action['prototype'][_0x885e('0x28')]=function(){return util['format'](_0x885e('0x29'),this[_0x885e('0xe')],this[_0x885e('0x2a')]);};module[_0x885e('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 39cd655..ec8689b 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 _0x5ad3=['Busy','custom:agentbusy','busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','checkInBlack','Contact','phone','lookAgent','then','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','validateContact','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','merge','toLowerVariables','Action','variablesAction','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','disableContact','[syncHangup][talking][transfer]','variables','filterKey','keys','variable','addVariable','value','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','socket.io-emitter','enqueue','tail','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundReCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','stringify','pick','UserId','VoiceQueueId','ListId','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','countbusyretry'];(function(_0x510eec,_0xbac291){var _0x35d729=function(_0x5526d4){while(--_0x5526d4){_0x510eec['push'](_0x510eec['shift']());}};_0x35d729(++_0xbac291);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0x5ad3[_0x4c80d7];return _0x3c5095;};'use strict';var util=require(_0x35ad('0x0'));var _=require(_0x35ad('0x1'));var BPromise=require(_0x35ad('0x2'));var uuid=require(_0x35ad('0x3'));var moment=require('moment');var md5=require(_0x35ad('0x4'));var Redis=require(_0x35ad('0x5'));var config=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var loggerAction=require(_0x35ad('0x7'))(_0x35ad('0x9'));var ami=require(_0x35ad('0xa'));var rpcDb=require(_0x35ad('0xb'));var Action=require(_0x35ad('0xc'));var ut=require('./util/util');config[_0x35ad('0xd')]=_[_0x35ad('0xe')](config[_0x35ad('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x35ad('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x35ad('0x10')]=function(_0x3e9830){this['tail']=this[_0x35ad('0x11')]?this[_0x35ad('0x11')]['finally'](_0x3e9830):_0x3e9830();};function Preview(_0x4b31a1){this[_0x35ad('0x12')]=new Sequence();this[_0x35ad('0x13')]=_0x4b31a1['voiceQueues'];this[_0x35ad('0x14')]=_0x4b31a1[_0x35ad('0x14')];this['actions']={};this['agents']=_0x4b31a1[_0x35ad('0x15')];this[_0x35ad('0x16')]=0x0;ami['on'](_0x35ad('0x17'),this['syncOriginateResponse'][_0x35ad('0x18')](this));ami['on'](_0x35ad('0x19'),this['syncHangup'][_0x35ad('0x18')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x35ad('0x18')](this));ami['on'](_0x35ad('0x1a'),this[_0x35ad('0x1b')]['bind'](this));ami['on'](_0x35ad('0x1c'),this[_0x35ad('0x1d')][_0x35ad('0x18')](this));ami['on'](_0x35ad('0x1e'),this[_0x35ad('0x1f')][_0x35ad('0x18')](this));ami['on']('attendedtransfer',this[_0x35ad('0x20')][_0x35ad('0x18')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x35ad('0x18')](this));this[_0x35ad('0x21')](this['campaignsPreview']);}function emit(_0x21f611,_0x32735e,_0x496620){io['to'](_0x21f611)[_0x35ad('0x22')](_0x32735e,_0x496620);}function emitCampaignPreview(_0x40e5e8){if(_0x40e5e8[_0x35ad('0x23')]===_0x35ad('0x24')){var _0x1be6d2={'id':_0x40e5e8['id'],'name':_0x40e5e8[_0x35ad('0x25')],'strategy':_0x40e5e8[_0x35ad('0x26')],'answered':_0x40e5e8[_0x35ad('0x27')],'available':_0x40e5e8[_0x35ad('0x28')],'loggedIn':_0x40e5e8[_0x35ad('0x29')],'pTalking':_0x40e5e8['pTalking'],'sumBillable':_0x40e5e8[_0x35ad('0x2a')],'sumDuration':_0x40e5e8[_0x35ad('0x2b')],'sumHoldTime':_0x40e5e8['sumHoldTime']||0x0,'talking':_0x40e5e8[_0x35ad('0x2c')],'total':_0x40e5e8[_0x35ad('0x2d')],'type':_0x40e5e8[_0x35ad('0x23')],'unmanaged':_0x40e5e8[_0x35ad('0x2e')],'abandoned':_0x40e5e8[_0x35ad('0x2f')],'waiting':_0x40e5e8['waiting'],'loggedInDb':_0x40e5e8[_0x35ad('0x30')],'dialActive':_0x40e5e8[_0x35ad('0x31')],'dialMethod':_0x40e5e8[_0x35ad('0x32')],'dialOriginateCallerIdName':_0x40e5e8[_0x35ad('0x33')],'dialOriginateCallerIdNumber':_0x40e5e8[_0x35ad('0x34')],'dialOriginateTimeout':_0x40e5e8[_0x35ad('0x35')],'dialPrefix':_0x40e5e8[_0x35ad('0x36')],'outboundAnswerAgiCallsDay':_0x40e5e8[_0x35ad('0x37')],'outboundAnswerCallsDay':_0x40e5e8['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x40e5e8[_0x35ad('0x38')],'outboundBusyCallsDay':_0x40e5e8[_0x35ad('0x39')],'outboundCongestionCallsDay':_0x40e5e8[_0x35ad('0x3a')],'outboundDropCallsDayACS':_0x40e5e8[_0x35ad('0x3b')],'outboundDropCallsDayCallersExit':_0x40e5e8[_0x35ad('0x3c')],'outboundDropCallsDayTimeout':_0x40e5e8['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x40e5e8['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x40e5e8[_0x35ad('0x3d')],'outboundOriginateFailureCallsDay':_0x40e5e8['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x40e5e8[_0x35ad('0x3e')],'outboundRejectCallsDay':_0x40e5e8['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x40e5e8['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x40e5e8['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x40e5e8['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x40e5e8[_0x35ad('0x3f')],'predictiveIntervalAvgTalktime':_0x40e5e8['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x40e5e8['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x40e5e8[_0x35ad('0x40')],'predictiveIntervalErlangCalls':_0x40e5e8['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x40e5e8[_0x35ad('0x41')],'predictiveIntervalHitRate':_0x40e5e8['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x40e5e8[_0x35ad('0x42')],'predictiveIntervalPauses':_0x40e5e8['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x40e5e8[_0x35ad('0x43')],'predictiveIntervalTotalCalls':_0x40e5e8['predictiveIntervalTotalCalls'],'message':_0x40e5e8[_0x35ad('0x44')],'originated':_0x40e5e8[_0x35ad('0x45')],'erlangCalls':_0x40e5e8[_0x35ad('0x46')],'erlangCallToSecond':_0x40e5e8['erlangCallToSecond'],'erlangAbandonmentRate':_0x40e5e8[_0x35ad('0x47')],'erlangBusyFactor':_0x40e5e8[_0x35ad('0x48')],'startPredictive':_0x40e5e8[_0x35ad('0x49')],'startProgressive':_0x40e5e8[_0x35ad('0x4a')]};if(_0x40e5e8[_0x35ad('0x4b')]){_0x1be6d2['Trunk']={'id':_0x40e5e8['Trunk']['id'],'name':_0x40e5e8[_0x35ad('0x4b')][_0x35ad('0x25')],'active':_0x40e5e8[_0x35ad('0x4b')][_0x35ad('0x4c')],'callerid':_0x40e5e8['Trunk'][_0x35ad('0x4d')]};}if(_0x40e5e8[_0x35ad('0x4e')]){_0x1be6d2[_0x35ad('0x4e')]={'id':_0x40e5e8[_0x35ad('0x4e')]['id'],'name':_0x40e5e8[_0x35ad('0x4e')][_0x35ad('0x25')]};}var _0x49c33d=md5(JSON['stringify'](_0x1be6d2));if(_0x40e5e8[_0x35ad('0x4')]!==_0x49c33d){_0x40e5e8[_0x35ad('0x4')]=_0x49c33d;emit(util[_0x35ad('0x4f')](_0x35ad('0x50'),_0x1be6d2[_0x35ad('0x25')]),_0x35ad('0x51'),_0x1be6d2);}}}function emitVoiceQueueChannelRemove(_0x11e7e2){logger[_0x35ad('0x52')](_0x35ad('0x53'),JSON['stringify'](_0x11e7e2));emit(util[_0x35ad('0x4f')]('voice:queue:%s',_0x11e7e2[_0x35ad('0x25')]),_0x35ad('0x54'),_0x11e7e2);io[_0x35ad('0x22')](_0x35ad('0x55'),_0x11e7e2);}function notSendMessagesQueue(_0x1ad7e6){if(_0x1ad7e6[_0x35ad('0x56')]){if(_0x1ad7e6[_0x35ad('0x45')]===0x0&&_0x1ad7e6[_0x35ad('0x57')]===0x0){_0x1ad7e6[_0x35ad('0x56')]=![];_0x1ad7e6['available']=0x0;_0x1ad7e6[_0x35ad('0x58')]=0x0;_0x1ad7e6[_0x35ad('0x44')]=_0x35ad('0x59');ut['logger'](_0x35ad('0x5a'),_0x1ad7e6[_0x35ad('0x25')]+_0x35ad('0x5b'));}else{_0x1ad7e6[_0x35ad('0x44')]=_0x35ad('0x5c');ut[_0x35ad('0x5d')](_0x35ad('0x5a'),_0x1ad7e6[_0x35ad('0x25')]+_0x35ad('0x5e'));}emitCampaignPreview(_0x1ad7e6);}}Preview[_0x35ad('0x5f')][_0x35ad('0x21')]=function(){var _0x557bf4=this;setInterval(function(){_0x557bf4[_0x35ad('0x60')]();},0x7cf);};Preview['prototype'][_0x35ad('0x60')]=function(){var _0x3b80c0=this[_0x35ad('0x13')];this[_0x35ad('0x16')]+=0x1;for(var _0x1785b5 in _0x3b80c0){if(_0x3b80c0[_0x35ad('0x61')](_0x1785b5)&&(_0x3b80c0[_0x1785b5][_0x35ad('0x32')]===_0x35ad('0x8')||_0x3b80c0[_0x1785b5][_0x35ad('0x32')]==='booked')&&_0x3b80c0[_0x1785b5][_0x35ad('0x23')]===_0x35ad('0x24')){if(this[_0x35ad('0x16')]>0x7){this[_0x35ad('0x16')]=0x0;this[_0x35ad('0x62')]();}}if(_0x3b80c0['hasOwnProperty'](_0x1785b5)&&_0x3b80c0[_0x1785b5][_0x35ad('0x32')]===_0x35ad('0x8')&&_0x3b80c0[_0x1785b5]['type']==='outbound'){if(_0x3b80c0[_0x1785b5][_0x35ad('0x31')]){this[_0x35ad('0x63')](_0x3b80c0[_0x1785b5]);if(_0x3b80c0[_0x1785b5][_0x35ad('0x64')])this[_0x35ad('0x65')](_0x3b80c0[_0x1785b5]);}else{notSendMessagesQueue(_0x3b80c0[_0x1785b5]);}}}};Preview['prototype'][_0x35ad('0x66')]=function(_0x1e3794){var _0x3c148a=this;this[_0x35ad('0x12')][_0x35ad('0x10')](function(){if(!_[_0x35ad('0x67')](_0x3c148a[_0x35ad('0x68')][_0x1e3794])){loggerAction['info'](_0x35ad('0x69'),_0x1e3794,_0x35ad('0x6a'),_0x3c148a[_0x35ad('0x68')][_0x1e3794]['queue'],'originated:\x20',JSON['stringify'](_0x3c148a[_0x35ad('0x13')][_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x6b')]][_0x35ad('0x45')]),'pTalking:\x20',JSON[_0x35ad('0x6c')](_0x3c148a[_0x35ad('0x13')][_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x6b')]][_0x35ad('0x57')]),JSON[_0x35ad('0x6c')](_0x3c148a['actions'][_0x1e3794]['dialAnswer']),JSON[_0x35ad('0x6c')](_[_0x35ad('0x6d')](_0x3c148a['actions'][_0x1e3794],['contactId',_0x35ad('0x6e'),_0x35ad('0x6f'),_0x35ad('0x70')])));return ami['Action']({'action':'status','channel':_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x71')]})[_0x35ad('0x72')](function(_0x5a8155){if(_0x5a8155[_0x35ad('0x44')]===_0x35ad('0x73')){setTimeout(function(){if(_0x3c148a[_0x35ad('0x68')][_0x1e3794]){ut[_0x35ad('0x74')](_0x3c148a[_0x35ad('0x13')][_0x3c148a[_0x35ad('0x68')][_0x1e3794]['queue']],_0x35ad('0x75'));if(_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x76')]===!![]){ut['decrementTalkink'](_0x3c148a[_0x35ad('0x13')][_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x6b')]],_0x35ad('0x75'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x1e3794,_0x3c148a[_0x35ad('0x68')][_0x1e3794][_0x35ad('0x6b')]);}ut[_0x35ad('0x77')](_0x35ad('0x78')+_0x1e3794,_0x3c148a[_0x35ad('0x68')][_0x1e3794]['queue']);delete _0x3c148a[_0x35ad('0x68')][_0x1e3794];}},0x2328);}});}});};Preview[_0x35ad('0x5f')][_0x35ad('0x62')]=function(){var _0xae2c85=this;loggerAction[_0x35ad('0x52')](_0x35ad('0x79'),_['size'](this['actions']));for(var _0x33da9c in this[_0x35ad('0x68')]){if(_0xae2c85[_0x35ad('0x68')][_0x35ad('0x61')](_0x33da9c)){_0xae2c85[_0x35ad('0x66')](_0x33da9c);}}};Preview[_0x35ad('0x5f')][_0x35ad('0x65')]=function(_0x5cef35){var _0x1da9a7=this;rpcDb[_0x35ad('0x7a')](_0x5cef35['id'],ut[_0x35ad('0x7b')](this[_0x35ad('0x15')]))['then'](function(_0x12735e){if(!_[_0x35ad('0x67')](_0x12735e)){for(var _0x4baa80=0x0;_0x4baa80<_0x12735e[_0x35ad('0x7c')];_0x4baa80+=0x1){if(ut[_0x35ad('0x7d')](_0x12735e[_0x4baa80][_0x35ad('0x7e')])<_0x5cef35[_0x35ad('0x7f')]*0x3c){if(_0x12735e[_0x4baa80][_0x35ad('0x80')]&&!_0x12735e[_0x4baa80][_0x35ad('0x80')][_0x35ad('0x81')]){_0x1da9a7[_0x35ad('0x82')](_0x12735e[_0x4baa80]['id'])['then'](ut[_0x35ad('0x83')](_0x35ad('0x84')))[_0x35ad('0x72')](ut['logger2'](_0x35ad('0x84')));}else{rpcDb['disableContact'](_0x12735e[_0x4baa80]['id']);}}else{var _0x24cfdc=new Action(_0x12735e[_0x4baa80],_0x5cef35);_0x24cfdc[_0x35ad('0x85')]=moment()[_0x35ad('0x4f')](_0x35ad('0x86'));_0x5cef35['outboundReCallsDay']+=0x1;ut[_0x35ad('0x87')](_0x24cfdc,0x17,_0x35ad('0x88'));if(_0x5cef35[_0x35ad('0x89')]){rpcDb[_0x35ad('0x8a')](ut[_0x35ad('0x8b')](_0x12735e[_0x4baa80]));rpcDb['createCustomerHistory'](_0x24cfdc,_0x35ad('0x8c'));}else{ut['logCustomer'](_0x24cfdc,0x16,_0x35ad('0x8d'));rpcDb[_0x35ad('0x8e')](_0x24cfdc,'[HistoryRecallClose]');rpcDb[_0x35ad('0x8f')](_0x24cfdc,'[HistoryRecallClose]');}}}}})[_0x35ad('0x72')](ut[_0x35ad('0x83')]('[getContactRecallMe]'));};Preview[_0x35ad('0x5f')][_0x35ad('0x63')]=function(_0x39f642){_0x39f642[_0x35ad('0x56')]=!![];if(ut[_0x35ad('0x90')](_0x39f642[_0x35ad('0x29')])){_0x39f642[_0x35ad('0x44')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x35ad('0x91')](_0x39f642[_0x35ad('0x31')])){_0x39f642[_0x35ad('0x44')]=_0x35ad('0x59');}else if(!this[_0x35ad('0x92')](_0x39f642[_0x35ad('0x4b')])){if(!this[_0x35ad('0x92')](_0x39f642['TrunkBackup'])){_0x39f642[_0x35ad('0x44')]=_0x35ad('0x93');}else{_0x39f642[_0x35ad('0x44')]=_0x35ad('0x94');}}else{_0x39f642[_0x35ad('0x44')]='ACTIVE';}emitCampaignPreview(_0x39f642);};Preview[_0x35ad('0x5f')][_0x35ad('0x95')]=function(_0x5b8b1d,_0x139a89,_0x2265f7){var _0x891ab4=this;var _0x286543=this['actions'][_0x139a89];var _0x351f14=this['campaignsPreview'][_0x286543[_0x35ad('0x6b')]];var _0x468331;if(_0x351f14){switch(_0x2265f7){case'1':_0x351f14[_0x35ad('0x3d')]+=0x1;_0x286543['countnosuchnumberretry']+=0x1;_0x286543[_0x35ad('0x96')]=ut['totalGlobal'](_0x286543);ut[_0x35ad('0x87')](_0x286543,0x0,'NoSuchNumber');ami['emit'](_0x35ad('0x97'),ut[_0x35ad('0x98')](_0x286543,'nosuchnumber'));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0x99'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14['dialGlobalMaxRetry']){_0x468331=ut['cloneAction'](_0x286543,0xf,'Global');rpcDb['createCustomerFinal'](_0x468331,_0x35ad('0x9b'));}else{if(_0x286543[_0x35ad('0x9c')]>=_0x351f14[_0x35ad('0x9d')]){rpcDb[_0x35ad('0x8f')](_0x286543,_0x35ad('0x9b'));}else{rpcDb[_0x35ad('0x9e')](ut['scheduledAt'](_0x286543,_0x35ad('0x9c'),_0x351f14[_0x35ad('0x9f')]),_0x286543['unlockAgent'],_0x286543[_0x35ad('0xa0')]);}}delete this[_0x35ad('0x68')][_0x5b8b1d['linkedid']];break;case _0x35ad('0xa1'):var _0x31f8bb=moment()[_0x35ad('0x4f')](_0x35ad('0x86'));_0x286543['responsetime']=_0x31f8bb;_0x286543[_0x35ad('0xa2')]=_0x31f8bb;_0x286543[_0x35ad('0x76')]=!![];_0x351f14[_0x35ad('0x57')]+=0x1;logger[_0x35ad('0x52')](_0x35ad('0xa3'),_0x286543[_0x35ad('0xa4')],_0x35ad('0xa5'),_0x351f14[_0x35ad('0x25')],_0x35ad('0xa6'),_0x351f14[_0x35ad('0x57')]);ami['emit']('custom:agentconnect',ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xa7'),this['campaignsPreview'][_0x286543[_0x35ad('0x6b')]]));if(_0x351f14[_0x35ad('0xa8')]){ami[_0x35ad('0x22')](_0x35ad('0xa9'),ut[_0x35ad('0xaa')](_0x286543));}break;case'16':ami[_0x35ad('0x22')]('custom:agentcomplete',ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xab'),this[_0x35ad('0x13')][_0x286543[_0x35ad('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xab')));_0x351f14[_0x35ad('0xac')]+=0x1;_0x351f14[_0x35ad('0x2d')]+=0x1;_0x351f14['answered']+=0x1;ut[_0x35ad('0xad')](_0x351f14,_0x35ad('0xae'));_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut['logCustomer'](_0x286543,0x4,_0x35ad('0xaf'));rpcDb['createCustomerHistory'](_0x286543,_0x35ad('0xb0'));rpcDb['createCustomerFinal'](_0x286543,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x35ad('0xb1')](_0x286543);_0x351f14[_0x35ad('0x2b')]+=_0x286543[_0x35ad('0xb2')];_0x351f14['sumBillable']+=_0x286543[_0x35ad('0xb2')];logger['info'](_0x35ad('0xb3'),_0x286543[_0x35ad('0xa4')],_0x35ad('0xa5'),_0x351f14[_0x35ad('0x25')],'pTalking:\x20',_0x351f14[_0x35ad('0x57')]);delete this['actions'][_0x5b8b1d[_0x35ad('0xb4')]];break;case'BUSY':_0x351f14[_0x35ad('0x39')]+=0x1;_0x286543[_0x35ad('0xb5')]+=0x1;_0x286543['countglobal']=ut['totalGlobal'](_0x286543);ut['logCustomer'](_0x286543,0x5,_0x35ad('0xb6'));ami[_0x35ad('0x22')](_0x35ad('0xb7'),ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xb8')));rpcDb['createCustomerHistory'](_0x286543,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14['dialGlobalMaxRetry']){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,'Global');rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xba'));}else{if(_0x286543[_0x35ad('0xb5')]>=_0x351f14[_0x35ad('0xbb')]){rpcDb['createCustomerFinal'](_0x286543,_0x35ad('0xbc'));}else{rpcDb[_0x35ad('0x9e')](ut[_0x35ad('0xbd')](_0x286543,_0x35ad('0xb5'),_0x351f14[_0x35ad('0xbe')]),_0x286543[_0x35ad('0xbf')],_0x286543[_0x35ad('0xa0')]);}}break;case _0x35ad('0xc0'):_0x351f14['outboundNoAnswerCallsDay']+=0x1;_0x286543[_0x35ad('0xc1')]+=0x1;_0x286543[_0x35ad('0x96')]=ut['totalGlobal'](_0x286543);ut['logCustomer'](_0x286543,0x3,'NoAnswer');ami[_0x35ad('0x22')](_0x35ad('0xc2'),ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xc3')));rpcDb['createCustomerHistory'](_0x286543,_0x35ad('0xc4'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xc7'));}else{if(_0x286543[_0x35ad('0xc1')]>=_0x351f14[_0x35ad('0xc8')]){rpcDb[_0x35ad('0x8f')](_0x286543,_0x35ad('0xc4'));}else{rpcDb['rescheduleContact'](ut[_0x35ad('0xbd')](_0x286543,_0x35ad('0xc1'),_0x351f14[_0x35ad('0xc9')]),_0x286543[_0x35ad('0xbf')],_0x286543[_0x35ad('0xa0')]);}}break;case'CONGESTION':_0x351f14['outboundCongestionCallsDay']+=0x1;_0x286543[_0x35ad('0xca')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut[_0x35ad('0x87')](_0x286543,0x8,_0x35ad('0xcb'));ami[_0x35ad('0x22')](_0x35ad('0xcc'),ut[_0x35ad('0x98')](_0x286543,_0x35ad('0xcd')));rpcDb[_0x35ad('0x8e')](_0x286543,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x286543[_0x35ad('0xca')]>=_0x351f14[_0x35ad('0xce')]){rpcDb[_0x35ad('0x8f')](_0x286543,_0x35ad('0xcf'));}else{rpcDb['rescheduleContact'](ut[_0x35ad('0xbd')](_0x286543,_0x35ad('0xca'),_0x351f14['dialBusyRetryFrequency']),_0x286543['unlockAgent'],_0x286543[_0x35ad('0xa0')]);}}break;case _0x35ad('0xd0'):_0x351f14['outboundRejectCallsDay']+=0x1;_0x286543[_0x35ad('0xd1')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut['logCustomer'](_0x286543,0x14,_0x35ad('0xd2'));ami['emit'](_0x35ad('0xd3'),ut['buildObj'](_0x286543,_0x35ad('0xd4')));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xd5'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut['cloneAction'](_0x286543,0x14,_0x35ad('0xd2'));rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xd6'));}else{if(_0x286543[_0x35ad('0xd1')]>=_0x351f14['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x286543,_0x35ad('0xd6'));}else{rpcDb['rescheduleContact'](ut[_0x35ad('0xbd')](_0x286543,'countagentrejectretry',_0x351f14[_0x35ad('0xd7')]),_0x286543['unlockAgent'],_0x286543['activeContact']);}}break;case _0x35ad('0xd8'):_0x351f14['outboundAbandonedCallsDay']+=0x1;_0x286543[_0x35ad('0xd9')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut[_0x35ad('0x87')](_0x286543,0xb,_0x35ad('0xda'));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xdb'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14['dialGlobalMaxRetry']){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xdb'));}else{if(_0x286543['countabandonedetry']>=_0x351f14[_0x35ad('0xdc')]){rpcDb[_0x35ad('0x8f')](_0x286543,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x35ad('0xbd')](_0x286543,_0x35ad('0xd9'),_0x351f14[_0x35ad('0xdd')]),_0x286543['unlockAgent'],_0x286543[_0x35ad('0xa0')]);}}break;case'18':_0x351f14['outboundUnknownCallsDay']+=0x1;_0x286543[_0x35ad('0xde')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut[_0x35ad('0x87')](_0x286543,0x12,_0x5b8b1d[_0x35ad('0xdf')]||_0x5b8b1d[_0x35ad('0xe0')]);ami[_0x35ad('0x22')](_0x35ad('0xe1'),ut[_0x35ad('0x98')](_0x286543,'amd'));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xe2'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14['dialGlobalMaxRetry']){_0x468331=ut['cloneAction'](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xe2'));}else{rpcDb[_0x35ad('0x8f')](_0x286543,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x35ad('0x68')][_0x5b8b1d[_0x35ad('0xb4')]];break;case'19':_0x351f14[_0x35ad('0xe3')]+=0x1;_0x286543[_0x35ad('0x96')]=ut[_0x35ad('0x9a')](_0x286543);ut[_0x35ad('0x87')](_0x286543,0x13,_0x5b8b1d[_0x35ad('0xdf')]||_0x5b8b1d[_0x35ad('0xe0')]);ami[_0x35ad('0x22')](_0x35ad('0xe1'),ut['buildObj'](_0x286543,'amd'));rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xe4'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,_0x35ad('0xc6'));rpcDb[_0x35ad('0x8f')](_0x468331,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x286543,_0x35ad('0xe4'));}delete this[_0x35ad('0x68')][_0x5b8b1d['linkedid']];break;default:if(_0x286543['dialAnswer']){ut[_0x35ad('0xad')](_0x351f14,'[default]');ut[_0x35ad('0x77')](_0x35ad('0xe5')+_0x351f14[_0x35ad('0x25')],_0x5b8b1d);}_0x351f14['outboundUnknownCallsDay']+=0x1;_0x286543['countglobal']=ut['totalGlobal'](_0x286543);ut[_0x35ad('0x87')](_0x286543,0xc,_0x5b8b1d[_0x35ad('0xdf')]||_0x5b8b1d[_0x35ad('0xe0')]);rpcDb[_0x35ad('0x8e')](_0x286543,_0x35ad('0xe6'));if(ut[_0x35ad('0x9a')](_0x286543)>=_0x351f14[_0x35ad('0xc5')]){_0x468331=ut[_0x35ad('0xb9')](_0x286543,0xf,'Global');rpcDb[_0x35ad('0x8f')](_0x468331,_0x35ad('0xe7'));}else{rpcDb[_0x35ad('0x8f')](_0x286543,_0x35ad('0xe7'));}delete this['actions'][_0x5b8b1d[_0x35ad('0xb4')]];}if(!(_0x286543['dialAnswer']&&_0x2265f7==='16')){ut[_0x35ad('0x74')](_0x351f14,_0x35ad('0xe8'));logger[_0x35ad('0x52')](_0x35ad('0xe9'),_0x286543['uniqueid'],_0x35ad('0xa5'),_0x351f14[_0x35ad('0x25')],_0x35ad('0xea'),_0x351f14['originated']);}if(_0x2265f7!==_0x35ad('0xa1')){delete this[_0x35ad('0x68')][_0x5b8b1d[_0x35ad('0xb4')]];delete this[_0x35ad('0x68')][_0x5b8b1d[_0x35ad('0xeb')]];}}};Preview[_0x35ad('0x5f')]['callProgressDetectingAgent']=function(_0x333369,_0x22d76b,_0x1c2af7){if(_[_0x35ad('0xec')](_0x22d76b)&&_0x35ad('0xed')!==typeof _0x22d76b){return;}if(_[_0x35ad('0xec')](_0x1c2af7)&&_0x35ad('0xed')!==typeof _0x1c2af7){return;}switch(_0x1c2af7[_0x35ad('0xee')]){case'0':ut[_0x35ad('0xef')](_0x333369,0x0,_0x35ad('0xf0'));rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf2'));break;case'3':ut[_0x35ad('0xef')](_0x333369,0x3,_0x35ad('0xf3'));rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf4'));break;case'5':ut[_0x35ad('0xef')](_0x333369,0x5,'Busy');rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf5'));break;case'8':ut[_0x35ad('0xef')](_0x333369,0x8,_0x35ad('0xcb'));rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf6'));break;case'22':ut[_0x35ad('0xef')](_0x333369,0x16,_0x35ad('0xf7'));rpcDb[_0x35ad('0xf1')](_0x333369,_0x35ad('0xf8'));break;default:ut[_0x35ad('0xef')](_0x333369,0xc,_0x1c2af7['reason']);rpcDb[_0x35ad('0xf1')](_0x333369,'[callProgressDetectingAgent][logCongestion]');}ut[_0x35ad('0x74')](_0x22d76b,'[callProgressDetectingAgent]');logger[_0x35ad('0x52')]('[originated][decrement][callProgressDetectingAgent]',_0x333369[_0x35ad('0xa4')],_0x35ad('0xa5'),_0x22d76b[_0x35ad('0x25')],_0x35ad('0xea'),_0x22d76b[_0x35ad('0x45')]);delete this['actions'][_0x333369[_0x35ad('0xa4')]];};Preview[_0x35ad('0x5f')][_0x35ad('0xf9')]=function(_0xa95c70,_0x5b5c8f,_0x30c05e,_0x18aeb0,_0x35dbbe){var _0x502cba=this;return new BPromise(function(_0x4fa7df,_0x2cceb9){if(_[_0x35ad('0x67')](_0x5b5c8f)||_[_0x35ad('0x67')](_0x5b5c8f[_0x35ad('0xfa')])||_[_0x35ad('0x67')](_0x5b5c8f[_0x35ad('0xfa')][_0x35ad('0xfb')])||_[_0x35ad('0x67')](_0x5b5c8f['VoiceQueueId'])){_0x2cceb9(ut[_0x35ad('0x44')]('Contact\x20is\x20undefined',_0x18aeb0,_0x35dbbe));return;}var _0x420701=uuid['v4']();var _0x3a82bc=_0x502cba['campaignsPreview'][_0x5b5c8f['Queue'][_0x35ad('0x25')]];var _0x46ddb3=_0x30c05e?_0x502cba[_0x35ad('0x15')][_0x30c05e]['id']:undefined;_0x502cba['actions'][_0x420701]=new Action(_0x5b5c8f,_0x3a82bc,_0x420701,_0x30c05e,_0x46ddb3);var _0x23fe9b=_0x502cba['actions'][_0x420701];_0x23fe9b[_0x35ad('0xbf')]=_0x18aeb0;_0x23fe9b[_0x35ad('0xa0')]=_0x35dbbe;_0x23fe9b[_0x35ad('0xfc')]=_0x30c05e;if(_['isEmpty'](_0xa95c70)){_0x502cba['execCall'](_0x23fe9b,_0x3a82bc,_0x5b5c8f,_0x30c05e)[_0x35ad('0xfd')](function(_0x515b71){logger[_0x35ad('0x52')](_0x35ad('0xfe'),_0x35ad('0xff')+_0x23fe9b[_0x35ad('0x6b')]+_0x35ad('0x100')+_0x23fe9b[_0x35ad('0x101')],JSON[_0x35ad('0x6c')](_0x515b71));ami[_0x35ad('0x22')](_0x35ad('0x102'),ut[_0x35ad('0x98')](_0x23fe9b,_0x35ad('0x103'),_0x502cba[_0x35ad('0x13')][_0x23fe9b['queue']]));_0x4fa7df(ut[_0x35ad('0x44')](_0x35ad('0x104')));})[_0x35ad('0x72')](function(_0x181e1a){ut[_0x35ad('0x5d')](_0x35ad('0x105'),_0x181e1a);_0x2cceb9(ut[_0x35ad('0x44')](_0x35ad('0x106'),_0x18aeb0,_0x35dbbe));});}else{_0x3a82bc['outboundBlacklistCallsDay']+=0x1;ut[_0x35ad('0x107')](_0x23fe9b);rpcDb[_0x35ad('0x108')](_0x23fe9b,_0x35ad('0x109'));delete _0x502cba[_0x35ad('0x68')][_0x420701];_0x2cceb9(ut[_0x35ad('0x44')]('Contact\x20in\x20black\x20List',_0x18aeb0,_0x35dbbe));}});};Preview['prototype'][_0x35ad('0x92')]=function(_0x4e8ca9){return!_['isNil'](_0x4e8ca9)&&!_['isNil'](_0x4e8ca9[_0x35ad('0x25')])&&!_[_0x35ad('0x67')](_0x4e8ca9[_0x35ad('0x4c')])&&_0x4e8ca9[_0x35ad('0x4c')]&&!_[_0x35ad('0x67')](this[_0x35ad('0x14')][util[_0x35ad('0x4f')](_0x35ad('0x10a'),_0x4e8ca9[_0x35ad('0x25')])])&&!_[_0x35ad('0x67')](this[_0x35ad('0x14')][util['format'](_0x35ad('0x10a'),_0x4e8ca9[_0x35ad('0x25')])]['status'])&&(this['trunks'][util[_0x35ad('0x4f')](_0x35ad('0x10a'),_0x4e8ca9[_0x35ad('0x25')])][_0x35ad('0x10b')]===_0x35ad('0x10c')||this[_0x35ad('0x14')][util[_0x35ad('0x4f')](_0x35ad('0x10a'),_0x4e8ca9[_0x35ad('0x25')])][_0x35ad('0x10b')]===_0x35ad('0x10d'));};Preview[_0x35ad('0x5f')]['run']=function(_0x3f6b5d,_0x215096){var _0xdfc473=this;return new BPromise(function(_0x12f28e,_0x299c73){_0xdfc473[_0x35ad('0x10e')](_0x3f6b5d,_0x215096)[_0x35ad('0xfd')](function(_0x2af5ba){_0x12f28e(_['pick'](_0x2af5ba,[_0x35ad('0x44')]));})[_0x35ad('0x72')](function(_0x50cacb){if(_0x50cacb[_0x35ad('0x10f')]){rpcDb[_0x35ad('0x110')](_0x3f6b5d);}if(_0x50cacb[_0x35ad('0x4c')]){rpcDb['disableContact'](_0x3f6b5d);}_0x299c73(_['pick'](_0x50cacb,[_0x35ad('0x44')]));});});};Preview[_0x35ad('0x5f')][_0x35ad('0x10e')]=function(_0x21949f,_0x156de8){var _0x5038a5=this;return new BPromise(function(_0x1257da,_0x9d1163){var _0x1b8bc8,_0xba3bc8;rpcDb[_0x35ad('0x111')](_0x21949f)[_0x35ad('0xfd')](function(_0x39a1db){if(!_[_0x35ad('0x67')](_0x39a1db[0x0])){_0xba3bc8=_0x39a1db[0x0]['recallme']?![]:!![];_0x1b8bc8=_0x39a1db[0x0]['recallme']?!![]:![];_0x1b8bc8=_0x156de8?!![]:_0x1b8bc8;}var _0x9db0c8=_0x5038a5[_0x35ad('0x112')](_0x39a1db);if(_0x9db0c8['isValid']){rpcDb[_0x35ad('0x113')](_['pick'](_0x39a1db[0x0],[_0x35ad('0x6f'),_0x35ad('0x114')]))[_0x35ad('0xfd')](function(_0xbf8aea){_0x5038a5[_0x35ad('0xf9')](_0xbf8aea,_0x39a1db[0x0],_0x156de8,_0xba3bc8,_0x1b8bc8)[_0x35ad('0xfd')](function(_0x370db0){_0x1257da(_0x370db0);})[_0x35ad('0x72')](function(_0x1f0fcb){_0x9d1163(_0x1f0fcb);});})[_0x35ad('0x72')](function(_0x52f291){ut[_0x35ad('0x5d')]('[Preview][checkIsBlackList]',_0x52f291);_0x9d1163(ut['message']('Call\x20unsuccessful',_0xba3bc8,_0x1b8bc8));});}else{_0x9d1163(ut['message'](_0x9db0c8[_0x35ad('0x44')],_0xba3bc8,_0x1b8bc8));}})[_0x35ad('0x72')](function(_0x42929e){ut['logger'](_0x35ad('0x115'),_0x42929e);_0x9d1163(ut[_0x35ad('0x44')](_0x35ad('0x116'),![],!![]));});});};Preview[_0x35ad('0x5f')][_0x35ad('0x112')]=function(_0x5547a7){if(_[_0x35ad('0x67')](_0x5547a7)||_[_0x35ad('0x117')](_0x5547a7)||!_[_0x35ad('0x67')](_0x5547a7[0x0][_0x35ad('0x80')])&&_[_0x35ad('0x67')](_0x5547a7[0x0][_0x35ad('0x80')][_0x35ad('0x25')])){ut[_0x35ad('0x5d')](_0x35ad('0x118'),_0x5547a7);return{'isValid':![],'message':_0x35ad('0x119')};}var _0x17ed92=this[_0x35ad('0x13')][_0x5547a7[0x0][_0x35ad('0x6a')]['name']];_0x17ed92[_0x35ad('0x44')]='ACTIVE';if(_[_0x35ad('0x67')](_0x17ed92)){ut['logger'](_0x35ad('0x11a'),_0x17ed92);return{'isValid':![],'message':_0x35ad('0x11b')};}if(!this[_0x35ad('0x92')](_0x17ed92['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x35ad('0x11c')+_0x17ed92['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x35ad('0x92')](_0x17ed92[_0x35ad('0x11d')])){ut[_0x35ad('0x5d')](_0x35ad('0x11e'),_0x17ed92[_0x35ad('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x35ad('0x11f')};}}if(!ut[_0x35ad('0x91')](_0x17ed92[_0x35ad('0x31')])){ut[_0x35ad('0x5d')](_0x35ad('0x120'),_0x17ed92[_0x35ad('0x25')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x35ad('0x11c')+_0x17ed92[_0x35ad('0x25')]+_0x35ad('0x121')};}return{'isValid':!![],'message':_0x35ad('0x122')};};Preview[_0x35ad('0x5f')][_0x35ad('0x123')]=function(_0x5dc83e,_0xc77534,_0x2a59e3,_0x42a01){var _0x357f2d=this;return new BPromise(function(_0x30d3d6,_0x2e9350){var _0x47b122=_0x5dc83e['uniqueid'];var _0x44a6da=_0x357f2d[_0x35ad('0x92')](_0xc77534[_0x35ad('0x4b')])?util['format'](_0x35ad('0x124'),_0xc77534[_0x35ad('0x4b')][_0x35ad('0x25')],_[_0x35ad('0x67')](_0xc77534[_0x35ad('0x36')])?'':_0xc77534[_0x35ad('0x36')][_0x35ad('0x125')]()||'',_0xc77534['dialCutDigit']>0x0?_0x2a59e3['Contact']['phone']['substring'](_0xc77534[_0x35ad('0x126')]):_0x2a59e3[_0x35ad('0xfa')][_0x35ad('0xfb')]):util[_0x35ad('0x4f')]('SIP/%s/%s%s',_[_0x35ad('0x67')](_0xc77534[_0x35ad('0x11d')])?_0xc77534[_0x35ad('0x4b')][_0x35ad('0x25')]:_0xc77534[_0x35ad('0x11d')]['name'],_[_0x35ad('0x67')](_0xc77534[_0x35ad('0x36')])?'':_0xc77534[_0x35ad('0x36')]['trim']()||'',_0xc77534[_0x35ad('0x126')]>0x0?_0x2a59e3[_0x35ad('0xfa')][_0x35ad('0xfb')]['substring'](_0xc77534[_0x35ad('0x126')]):_0x2a59e3['Contact'][_0x35ad('0xfb')]);var _0xe23530=_0x357f2d[_0x35ad('0x92')](_0xc77534[_0x35ad('0x4b')])?ut[_0x35ad('0x127')](_0xc77534[_0x35ad('0x4b')]['callerid'],_0xc77534[_0x35ad('0x33')],_0xc77534[_0x35ad('0x128')]>0x0?ut[_0x35ad('0x129')](_0xc77534['dialOriginateCallerIdNumber'],_0xc77534['dialRandomLastDigitCallerIdNumber']):_0xc77534[_0x35ad('0x34')]):ut[_0x35ad('0x127')](_[_0x35ad('0x67')](_0xc77534[_0x35ad('0x11d')])?_0xc77534[_0x35ad('0x4b')][_0x35ad('0x4d')]:_0xc77534['TrunkBackup']['callerid'],_0xc77534['dialOriginateCallerIdName'],_0xc77534[_0x35ad('0x128')]>0x0?ut[_0x35ad('0x129')](_0xc77534[_0x35ad('0x34')],_0xc77534['dialRandomLastDigitCallerIdNumber']):_0xc77534['dialOriginateCallerIdNumber']);if(_0xe23530){_0x5dc83e['originatecalleridname']=ut[_0x35ad('0x12a')](_0xe23530);_0x5dc83e[_0x35ad('0x12b')]=ut['extractCalleridNumber'](_0xe23530);}var _0x2adf3b=ut['addVariables'](_0xc77534,_0x2a59e3,_0x44a6da,_0xe23530,_0x47b122,_0x5dc83e);_[_0x35ad('0x12c')](_0x5dc83e,ut[_0x35ad('0x12d')](_0x2adf3b));_0x5dc83e['starttime']=moment()[_0x35ad('0x4f')](_0x35ad('0x86'));ami[_0x35ad('0x12e')](ut[_0x35ad('0x12f')](_0x5dc83e,_0xc77534,_0x2adf3b,_0x5dc83e[_0x35ad('0xa0')],_0x42a01))[_0x35ad('0xfd')](function(_0x1cdbd5){_0xc77534[_0x35ad('0x45')]+=0x1;logger[_0x35ad('0x52')]('[originated][increment]',_0x47b122,_0x35ad('0xa5'),_0xc77534[_0x35ad('0x25')],_0x35ad('0xea'),_0xc77534[_0x35ad('0x45')]);_0x30d3d6(_0x1cdbd5);})['catch'](function(_0x42e7ae){ut['logAgent'](_0x5dc83e,0xe,'OriginateError');rpcDb[_0x35ad('0xf1')](_0x5dc83e,_0x35ad('0x130'));_0x2e9350(_0x42e7ae);});});};Preview['prototype']['syncNewExten']=function(_0x10f1cb){if(this[_0x35ad('0x68')][_0x10f1cb['linkedid']]){this[_0x35ad('0x68')][_0x10f1cb[_0x35ad('0xb4')]]['channel']=_0x10f1cb[_0x35ad('0x71')];}};Preview[_0x35ad('0x5f')][_0x35ad('0x131')]=function(_0x28252c){var _0x3d15b5=this;var _0xc67ff1=this[_0x35ad('0x68')][_0x28252c[_0x35ad('0x132')]];if(_0xc67ff1){if(_0xc67ff1[_0x35ad('0xfc')]&&this['agents'][_0xc67ff1[_0x35ad('0xfc')]]){ut[_0x35ad('0x133')](_0xc67ff1,this['agents'][_0xc67ff1[_0x35ad('0xfc')]][_0x35ad('0x25')],this[_0x35ad('0x15')][_0xc67ff1[_0x35ad('0xfc')]]['id']);}var _0x55aabf=_['clone'](_0xc67ff1);_0x55aabf['responsetime']=moment()['format'](_0x35ad('0x86'));var _0x521f45=_0x3d15b5[_0x35ad('0x13')][_0xc67ff1['queue']];if(ut[_0x35ad('0x134')](_0x28252c[_0x35ad('0x135')])){if(_0xc67ff1[_0x35ad('0xbf')]){rpcDb[_0x35ad('0x110')](_0xc67ff1['idContact']);}if(_0xc67ff1[_0x35ad('0xa0')]){rpcDb['disableContact'](_0xc67ff1[_0x35ad('0x101')]);}ami[_0x35ad('0x22')](_0x35ad('0x136'),ut[_0x35ad('0x98')](_0xc67ff1,_0x35ad('0x137'),this[_0x35ad('0x13')][_0xc67ff1[_0x35ad('0x6b')]]));this[_0x35ad('0x138')](_0x55aabf,_0x521f45,_0x28252c);}else{_0xc67ff1[_0x35ad('0x85')]=moment()[_0x35ad('0x4f')](_0x35ad('0x86'));ut[_0x35ad('0xef')](_0x55aabf,0x4,_0x35ad('0xaf'));rpcDb['createAgentHistory'](_0x55aabf,_0x35ad('0x139'));}}};Preview[_0x35ad('0x5f')][_0x35ad('0x13a')]=function(_0xd241e8){var _0x50efb3=this;var _0x5a1de6=this[_0x35ad('0x68')][_0xd241e8[_0x35ad('0xb4')]];var _0x4419a8;if(_0x5a1de6){_0x4419a8=this[_0x35ad('0x13')][_0x5a1de6['queue']];logger[_0x35ad('0x52')](_0x35ad('0x13b'),_0xd241e8['linkedid'],_0x35ad('0xa5'),_0x4419a8[_0x35ad('0x25')],_0x35ad('0xa6'),_0x4419a8[_0x35ad('0x57')]);}if(this['actions'][_0xd241e8[_0x35ad('0xb4')]]&&_0xd241e8[_0x35ad('0xb4')]!==_0xd241e8[_0x35ad('0xa4')]){if(_0xd241e8[_0x35ad('0x13c')]==='16'&&this[_0x35ad('0x68')][_0xd241e8[_0x35ad('0xb4')]]['dialAnswer']){this[_0x35ad('0x95')](_0xd241e8,_0xd241e8[_0x35ad('0xb4')],_0xd241e8[_0x35ad('0x13c')]);}else if(this[_0x35ad('0x68')][_0xd241e8[_0x35ad('0xb4')]][_0x35ad('0x76')]){logger[_0x35ad('0x52')]('[syncHangup][talking][cause]',_0xd241e8['linkedid'],_0xd241e8[_0x35ad('0x13c')],_0x35ad('0xa5'),_0x4419a8[_0x35ad('0x25')],_0x35ad('0xa6'),_0x4419a8[_0x35ad('0x57')]);this[_0x35ad('0x95')](_0xd241e8,_0xd241e8['linkedid'],_0xd241e8[_0x35ad('0x13c')]);}}else if(_0x5a1de6&&_[_0x35ad('0x67')](_0x5a1de6['statedesc'])&&_0x4419a8[_0x35ad('0x13d')]&&_0xd241e8[_0x35ad('0xb4')]===_0xd241e8[_0x35ad('0xa4')]&&_['isNil'](_0xd241e8['reason'])&&_0xd241e8[_0x35ad('0x13c')]==='16'&&_0xd241e8[_0x35ad('0x13e')]==='6'&&_['isUndefined'](_0x5a1de6[_0x35ad('0x13f')])){if(_0x5a1de6[_0x35ad('0xbf')]){rpcDb[_0x35ad('0x110')](_0x5a1de6[_0x35ad('0x101')]);}if(_0x5a1de6[_0x35ad('0xa0')]){rpcDb[_0x35ad('0x140')](_0x5a1de6['idContact']);}_0xd241e8[_0x35ad('0xee')]='22';this['callProgressDetectingAgent'](_0x5a1de6,_0x4419a8,_0xd241e8);}else if(_0x5a1de6&&_0x5a1de6[_0x35ad('0x13f')]){if(_0xd241e8[_0x35ad('0x13c')]==='16'&&this['actions'][_0xd241e8[_0x35ad('0xb4')]][_0x35ad('0x76')]){logger[_0x35ad('0x52')](_0x35ad('0x141'),_0xd241e8['linkedid'],_0xd241e8['cause'],_0x35ad('0xa5'),_0x4419a8[_0x35ad('0x25')],_0x35ad('0xa6'),_0x4419a8[_0x35ad('0x57')]);this['callProgressDetectingCustomer'](_0xd241e8,_0xd241e8[_0x35ad('0xb4')],_0xd241e8['cause']);}else if(this[_0x35ad('0x68')][_0xd241e8[_0x35ad('0xb4')]][_0x35ad('0x76')]){logger[_0x35ad('0x52')]('[syncHangup][talking][cause]',_0xd241e8[_0x35ad('0xb4')],_0xd241e8[_0x35ad('0x13c')],_0x35ad('0xa5'),_0x4419a8[_0x35ad('0x25')],_0x35ad('0xa6'),_0x4419a8[_0x35ad('0x57')]);this[_0x35ad('0x95')](_0xd241e8,_0xd241e8[_0x35ad('0xb4')],_0xd241e8[_0x35ad('0x13c')]);}}};Preview['prototype'][_0x35ad('0x1b')]=function(_0x3ec9ed){if(this['actions'][_0x3ec9ed[_0x35ad('0xeb')]]&&_0x3ec9ed['destlinkedid']!==_0x3ec9ed['destuniqueid']){this[_0x35ad('0x95')](_0x3ec9ed,_0x3ec9ed[_0x35ad('0xeb')],_0x3ec9ed[_0x35ad('0xe0')]);}};Preview[_0x35ad('0x5f')]['syncHangupRequest']=function(_0x2691e2){if(this[_0x35ad('0x68')][_0x2691e2[_0x35ad('0xb4')]]&&_0x2691e2[_0x35ad('0xb4')]!==_0x2691e2['uniqueid']&&!this['actions'][_0x2691e2[_0x35ad('0xb4')]]['dialAnswer']){if(_0x2691e2[_0x35ad('0x13c')]==='1'){this[_0x35ad('0x95')](_0x2691e2,_0x2691e2[_0x35ad('0xb4')],_0x2691e2['cause']);}}};Preview[_0x35ad('0x5f')]['addVariable']=function(_0x3171e0,_0x425732,_0x499fcf){if(this[_0x35ad('0x68')][_0x3171e0]){if(_[_0x35ad('0x67')](this['actions'][_0x3171e0][_0x35ad('0x142')])){this[_0x35ad('0x68')][_0x3171e0]['variables']={};}this[_0x35ad('0x68')][_0x3171e0][_0x35ad('0x142')][_0x425732]=_0x499fcf;}};Preview[_0x35ad('0x5f')]['syncVarSet']=function(_0x432863){try{if(!_['isNil'](_0x432863)){if(ut[_0x35ad('0x143')](_[_0x35ad('0x144')](_0x432863[_0x35ad('0x145')])[0x0])){this[_0x35ad('0x146')](_0x432863[_0x35ad('0xa4')],_[_0x35ad('0x144')](_0x432863[_0x35ad('0x145')])[0x0],_0x432863[_0x35ad('0x147')]);}}}catch(_0x33b595){logger['error']('[syncVarSet][Preview]',util[_0x35ad('0x148')](_0x33b595,{'showHidden':![],'depth':null}));}};Preview[_0x35ad('0x5f')]['syncAttendedTransfer']=function(_0x58b9e8){if(_0x58b9e8){if(this[_0x35ad('0x68')][_0x58b9e8[_0x35ad('0x149')]]){this[_0x35ad('0x68')][_0x58b9e8[_0x35ad('0x149')]][_0x35ad('0x13f')]=!![];}}};Preview[_0x35ad('0x5f')][_0x35ad('0x14a')]=function(_0x3e97ca){if(_0x3e97ca){if(this[_0x35ad('0x68')][_0x3e97ca[_0x35ad('0x14b')]]){this[_0x35ad('0x68')][_0x3e97ca[_0x35ad('0x14b')]][_0x35ad('0x13f')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xd13e=['SIP/%s','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','logLookAgent','clone','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','../../../config/environment','preview','../../../config/logger','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','type','outbound','name','strategy','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','isNil','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','responsetime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','custom:agentcomplete','complete','answered','decrementTalkink','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','cause-txt','amd','[callProgressDetectingCustomer][hangupInAMD]','Global','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List'];(function(_0x356cf9,_0x22e533){var _0x58ba1d=function(_0x4793fd){while(--_0x4793fd){_0x356cf9['push'](_0x356cf9['shift']());}};_0x58ba1d(++_0x22e533);}(_0xd13e,0x193));var _0xed13=function(_0xf8d461,_0xa0eb1e){_0xf8d461=_0xf8d461-0x0;var _0x1253cc=_0xd13e[_0xf8d461];return _0x1253cc;};'use strict';var util=require(_0xed13('0x0'));var _=require(_0xed13('0x1'));var BPromise=require(_0xed13('0x2'));var uuid=require(_0xed13('0x3'));var moment=require('moment');var md5=require(_0xed13('0x4'));var Redis=require('ioredis');var config=require(_0xed13('0x5'));var logger=require('../../../config/logger')(_0xed13('0x6'));var loggerAction=require(_0xed13('0x7'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xed13('0x8'));var ut=require(_0xed13('0x9'));config[_0xed13('0xa')]=_[_0xed13('0xb')](config[_0xed13('0xa')],{'host':_0xed13('0xc'),'port':0x18eb});var io=require(_0xed13('0xd'))(new Redis(config[_0xed13('0xa')]));var Sequence=function(){};Sequence[_0xed13('0xe')]['enqueue']=function(_0x26442d){this[_0xed13('0xf')]=this[_0xed13('0xf')]?this[_0xed13('0xf')][_0xed13('0x10')](_0x26442d):_0x26442d();};function Preview(_0x57f4d4){this[_0xed13('0x11')]=new Sequence();this[_0xed13('0x12')]=_0x57f4d4[_0xed13('0x13')];this[_0xed13('0x14')]=_0x57f4d4[_0xed13('0x14')];this[_0xed13('0x15')]={};this['agents']=_0x57f4d4[_0xed13('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0xed13('0x17'),this['syncOriginateResponse'][_0xed13('0x18')](this));ami['on']('hangup',this[_0xed13('0x19')]['bind'](this));ami['on'](_0xed13('0x1a'),this[_0xed13('0x1b')][_0xed13('0x18')](this));ami['on'](_0xed13('0x1c'),this[_0xed13('0x1d')][_0xed13('0x18')](this));ami['on'](_0xed13('0x1e'),this[_0xed13('0x1f')][_0xed13('0x18')](this));ami['on'](_0xed13('0x20'),this[_0xed13('0x21')][_0xed13('0x18')](this));ami['on'](_0xed13('0x22'),this[_0xed13('0x23')][_0xed13('0x18')](this));ami['on'](_0xed13('0x24'),this['syncBlindTransfer']['bind'](this));this[_0xed13('0x25')](this[_0xed13('0x12')]);}function emit(_0x4f455b,_0x40dd86,_0x4a85a3){io['to'](_0x4f455b)['emit'](_0x40dd86,_0x4a85a3);}function emitCampaignPreview(_0x3b5b1e){if(_0x3b5b1e[_0xed13('0x26')]===_0xed13('0x27')){var _0x192d12={'id':_0x3b5b1e['id'],'name':_0x3b5b1e[_0xed13('0x28')],'strategy':_0x3b5b1e[_0xed13('0x29')],'answered':_0x3b5b1e['answered'],'available':_0x3b5b1e['available'],'loggedIn':_0x3b5b1e['loggedIn'],'pTalking':_0x3b5b1e[_0xed13('0x2a')],'sumBillable':_0x3b5b1e[_0xed13('0x2b')],'sumDuration':_0x3b5b1e[_0xed13('0x2c')],'sumHoldTime':_0x3b5b1e[_0xed13('0x2d')]||0x0,'talking':_0x3b5b1e[_0xed13('0x2e')],'total':_0x3b5b1e[_0xed13('0x2f')],'type':_0x3b5b1e[_0xed13('0x26')],'unmanaged':_0x3b5b1e[_0xed13('0x30')],'abandoned':_0x3b5b1e[_0xed13('0x31')],'waiting':_0x3b5b1e[_0xed13('0x32')],'loggedInDb':_0x3b5b1e[_0xed13('0x33')],'dialActive':_0x3b5b1e[_0xed13('0x34')],'dialMethod':_0x3b5b1e[_0xed13('0x35')],'dialOriginateCallerIdName':_0x3b5b1e[_0xed13('0x36')],'dialOriginateCallerIdNumber':_0x3b5b1e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3b5b1e['dialOriginateTimeout'],'dialPrefix':_0x3b5b1e[_0xed13('0x37')],'outboundAnswerAgiCallsDay':_0x3b5b1e[_0xed13('0x38')],'outboundAnswerCallsDay':_0x3b5b1e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3b5b1e[_0xed13('0x39')],'outboundBusyCallsDay':_0x3b5b1e[_0xed13('0x3a')],'outboundCongestionCallsDay':_0x3b5b1e['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3b5b1e[_0xed13('0x3b')],'outboundDropCallsDayCallersExit':_0x3b5b1e[_0xed13('0x3c')],'outboundDropCallsDayTimeout':_0x3b5b1e[_0xed13('0x3d')],'outboundNoAnswerCallsDay':_0x3b5b1e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3b5b1e[_0xed13('0x3e')],'outboundOriginateFailureCallsDay':_0x3b5b1e[_0xed13('0x3f')],'outboundReCallsDay':_0x3b5b1e['outboundReCallsDay'],'outboundRejectCallsDay':_0x3b5b1e[_0xed13('0x40')],'outboundUnknownCallsDay':_0x3b5b1e[_0xed13('0x41')],'outboundAbandonedCallsDay':_0x3b5b1e['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3b5b1e[_0xed13('0x42')],'predictiveIntervalAvgHoldtime':_0x3b5b1e[_0xed13('0x43')],'predictiveIntervalAvgTalktime':_0x3b5b1e[_0xed13('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x3b5b1e[_0xed13('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x3b5b1e[_0xed13('0x46')],'predictiveIntervalErlangCalls':_0x3b5b1e[_0xed13('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x3b5b1e[_0xed13('0x48')],'predictiveIntervalHitRate':_0x3b5b1e['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3b5b1e[_0xed13('0x49')],'predictiveIntervalPauses':_0x3b5b1e['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3b5b1e['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3b5b1e[_0xed13('0x4a')],'message':_0x3b5b1e[_0xed13('0x4b')],'originated':_0x3b5b1e[_0xed13('0x4c')],'erlangCalls':_0x3b5b1e['erlangCalls'],'erlangCallToSecond':_0x3b5b1e[_0xed13('0x4d')],'erlangAbandonmentRate':_0x3b5b1e[_0xed13('0x4e')],'erlangBusyFactor':_0x3b5b1e[_0xed13('0x4f')],'startPredictive':_0x3b5b1e['startPredictive'],'startProgressive':_0x3b5b1e[_0xed13('0x50')]};if(_0x3b5b1e[_0xed13('0x51')]){_0x192d12[_0xed13('0x51')]={'id':_0x3b5b1e[_0xed13('0x51')]['id'],'name':_0x3b5b1e['Trunk'][_0xed13('0x28')],'active':_0x3b5b1e[_0xed13('0x51')][_0xed13('0x52')],'callerid':_0x3b5b1e[_0xed13('0x51')][_0xed13('0x53')]};}if(_0x3b5b1e[_0xed13('0x54')]){_0x192d12[_0xed13('0x54')]={'id':_0x3b5b1e[_0xed13('0x54')]['id'],'name':_0x3b5b1e[_0xed13('0x54')][_0xed13('0x28')]};}var _0x5a09e4=md5(JSON[_0xed13('0x55')](_0x192d12));if(_0x3b5b1e[_0xed13('0x4')]!==_0x5a09e4){_0x3b5b1e['md5']=_0x5a09e4;emit(util['format']('voice:queue:%s',_0x192d12[_0xed13('0x28')]),_0xed13('0x56'),_0x192d12);}}}function emitVoiceQueueChannelRemove(_0x53df17){logger['info'](_0xed13('0x57'),JSON[_0xed13('0x55')](_0x53df17));emit(util[_0xed13('0x58')](_0xed13('0x59'),_0x53df17[_0xed13('0x28')]),'voice_queue_channel:remove',_0x53df17);io['emit'](_0xed13('0x5a'),_0x53df17);}function notSendMessagesQueue(_0x487cd0){if(_0x487cd0[_0xed13('0x5b')]){if(_0x487cd0['originated']===0x0&&_0x487cd0[_0xed13('0x2a')]===0x0){_0x487cd0['sendMessageOneNotActive']=![];_0x487cd0['available']=0x0;_0x487cd0['paused']=0x0;_0x487cd0[_0xed13('0x4b')]=_0xed13('0x5c');ut[_0xed13('0x5d')](_0xed13('0x5e'),_0x487cd0[_0xed13('0x28')]+'\x20is\x20not\x20active');}else{_0x487cd0[_0xed13('0x4b')]=_0xed13('0x5f');ut[_0xed13('0x5d')](_0xed13('0x5e'),_0x487cd0[_0xed13('0x28')]+'\x20is\x20disactive');}emitCampaignPreview(_0x487cd0);}}Preview[_0xed13('0xe')][_0xed13('0x25')]=function(){var _0x24f4ba=this;setInterval(function(){_0x24f4ba[_0xed13('0x60')]();},0x7cf);};Preview[_0xed13('0xe')][_0xed13('0x60')]=function(){var _0x535de7=this[_0xed13('0x12')];this[_0xed13('0x61')]+=0x1;for(var _0x4686f1 in _0x535de7){if(_0x535de7[_0xed13('0x62')](_0x4686f1)&&(_0x535de7[_0x4686f1][_0xed13('0x35')]===_0xed13('0x6')||_0x535de7[_0x4686f1][_0xed13('0x35')]===_0xed13('0x63'))&&_0x535de7[_0x4686f1][_0xed13('0x26')]===_0xed13('0x27')){if(this[_0xed13('0x61')]>0x7){this[_0xed13('0x61')]=0x0;this[_0xed13('0x64')]();}}if(_0x535de7[_0xed13('0x62')](_0x4686f1)&&_0x535de7[_0x4686f1]['dialMethod']===_0xed13('0x6')&&_0x535de7[_0x4686f1][_0xed13('0x26')]==='outbound'){if(_0x535de7[_0x4686f1][_0xed13('0x34')]){this[_0xed13('0x65')](_0x535de7[_0x4686f1]);if(_0x535de7[_0x4686f1][_0xed13('0x66')])this['recallMe'](_0x535de7[_0x4686f1]);}else{notSendMessagesQueue(_0x535de7[_0x4686f1]);}}}};Preview[_0xed13('0xe')][_0xed13('0x67')]=function(_0x3ba48c){var _0x5c8c1a=this;this['sequence'][_0xed13('0x68')](function(){if(!_[_0xed13('0x69')](_0x5c8c1a['actions'][_0x3ba48c])){loggerAction[_0xed13('0x6a')](_0xed13('0x6b'),_0x3ba48c,_0xed13('0x6c'),_0x5c8c1a[_0xed13('0x15')][_0x3ba48c]['queue'],_0xed13('0x6d'),JSON[_0xed13('0x55')](_0x5c8c1a[_0xed13('0x12')][_0x5c8c1a[_0xed13('0x15')][_0x3ba48c]['queue']][_0xed13('0x4c')]),'pTalking:\x20',JSON[_0xed13('0x55')](_0x5c8c1a['campaignsPreview'][_0x5c8c1a['actions'][_0x3ba48c][_0xed13('0x6e')]][_0xed13('0x2a')]),JSON['stringify'](_0x5c8c1a[_0xed13('0x15')][_0x3ba48c][_0xed13('0x6f')]),JSON[_0xed13('0x55')](_[_0xed13('0x70')](_0x5c8c1a['actions'][_0x3ba48c],[_0xed13('0x71'),'UserId',_0xed13('0x72'),_0xed13('0x73')])));return ami[_0xed13('0x74')]({'action':_0xed13('0x75'),'channel':_0x5c8c1a[_0xed13('0x15')][_0x3ba48c][_0xed13('0x76')]})[_0xed13('0x77')](function(_0x35c934){if(_0x35c934['message']===_0xed13('0x78')){setTimeout(function(){if(_0x5c8c1a[_0xed13('0x15')][_0x3ba48c]){ut[_0xed13('0x79')](_0x5c8c1a[_0xed13('0x12')][_0x5c8c1a['actions'][_0x3ba48c][_0xed13('0x6e')]],'[clearZombieChannel]');if(_0x5c8c1a[_0xed13('0x15')][_0x3ba48c]['dialAnswer']===!![]){ut['decrementTalkink'](_0x5c8c1a['campaignsPreview'][_0x5c8c1a[_0xed13('0x15')][_0x3ba48c][_0xed13('0x6e')]],_0xed13('0x7a'));ut['loggerError'](_0xed13('0x7b')+_0x3ba48c,_0x5c8c1a[_0xed13('0x15')][_0x3ba48c][_0xed13('0x6e')]);}ut[_0xed13('0x7c')](_0xed13('0x7d')+_0x3ba48c,_0x5c8c1a['actions'][_0x3ba48c][_0xed13('0x6e')]);delete _0x5c8c1a[_0xed13('0x15')][_0x3ba48c];}},0x2328);}});}});};Preview[_0xed13('0xe')][_0xed13('0x64')]=function(){var _0x5eff1b=this;loggerAction[_0xed13('0x6a')](_0xed13('0x7e'),_[_0xed13('0x7f')](this[_0xed13('0x15')]));for(var _0x170752 in this[_0xed13('0x15')]){if(_0x5eff1b[_0xed13('0x15')]['hasOwnProperty'](_0x170752)){_0x5eff1b[_0xed13('0x67')](_0x170752);}}};Preview['prototype'][_0xed13('0x80')]=function(_0x5c83f3){var _0x1b736f=this;rpcDb[_0xed13('0x81')](_0x5c83f3['id'],ut[_0xed13('0x82')](this[_0xed13('0x16')]))[_0xed13('0x83')](function(_0x50d211){if(!_['isNil'](_0x50d211)){for(var _0x31907c=0x0;_0x31907c<_0x50d211[_0xed13('0x84')];_0x31907c+=0x1){if(ut[_0xed13('0x85')](_0x50d211[_0x31907c][_0xed13('0x86')])<_0x5c83f3[_0xed13('0x87')]*0x3c){if(_0x50d211[_0x31907c][_0xed13('0x88')]&&!_0x50d211[_0x31907c][_0xed13('0x88')][_0xed13('0x89')]){_0x1b736f[_0xed13('0x8a')](_0x50d211[_0x31907c]['id'])['then'](ut['logger2']('[RecallMe]'))[_0xed13('0x77')](ut[_0xed13('0x8b')](_0xed13('0x8c')));}else{rpcDb['disableContact'](_0x50d211[_0x31907c]['id']);}}else{var _0x4ac5d4=new Action(_0x50d211[_0x31907c],_0x5c83f3);_0x4ac5d4[_0xed13('0x8d')]=moment()[_0xed13('0x58')](_0xed13('0x8e'));_0x5c83f3['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x4ac5d4,0x17,'RecallInQueue');if(_0x5c83f3['dialRecallInQueue']){rpcDb[_0xed13('0x8f')](ut[_0xed13('0x90')](_0x50d211[_0x31907c]));rpcDb[_0xed13('0x91')](_0x4ac5d4,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xed13('0x92')](_0x4ac5d4,0x16,_0xed13('0x93'));rpcDb['createCustomerHistory'](_0x4ac5d4,_0xed13('0x94'));rpcDb[_0xed13('0x95')](_0x4ac5d4,_0xed13('0x94'));}}}}})[_0xed13('0x77')](ut[_0xed13('0x8b')](_0xed13('0x96')));};Preview[_0xed13('0xe')][_0xed13('0x65')]=function(_0x418419){_0x418419['sendMessageOneNotActive']=!![];if(ut[_0xed13('0x97')](_0x418419[_0xed13('0x98')])){_0x418419[_0xed13('0x4b')]=_0xed13('0x99');}else if(!ut['isActive'](_0x418419['dialActive'])){_0x418419['message']=_0xed13('0x5c');}else if(!this[_0xed13('0x9a')](_0x418419[_0xed13('0x51')])){if(!this[_0xed13('0x9a')](_0x418419[_0xed13('0x9b')])){_0x418419[_0xed13('0x4b')]=_0xed13('0x9c');}else{_0x418419[_0xed13('0x4b')]=_0xed13('0x9d');}}else{_0x418419[_0xed13('0x4b')]=_0xed13('0x9d');}emitCampaignPreview(_0x418419);};Preview[_0xed13('0xe')][_0xed13('0x9e')]=function(_0x2e3307,_0x451995,_0x2aac1c){var _0x520c94=this;var _0x90b96c=this[_0xed13('0x15')][_0x451995];var _0x46b854=this[_0xed13('0x12')][_0x90b96c[_0xed13('0x6e')]];var _0x1fb178;if(_0x46b854){switch(_0x2aac1c){case'1':_0x46b854[_0xed13('0x3e')]+=0x1;_0x90b96c['countnosuchnumberretry']+=0x1;_0x90b96c['countglobal']=ut[_0xed13('0x9f')](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0x0,_0xed13('0xa0'));ami[_0xed13('0xa1')](_0xed13('0xa2'),ut['buildObj'](_0x90b96c,'nosuchnumber'));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xa3'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,'Global');rpcDb[_0xed13('0x95')](_0x1fb178,_0xed13('0xa6'));}else{if(_0x90b96c[_0xed13('0xa7')]>=_0x46b854[_0xed13('0xa8')]){rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xa6'));}else{rpcDb[_0xed13('0xa9')](ut[_0xed13('0xaa')](_0x90b96c,_0xed13('0xa7'),_0x46b854[_0xed13('0xab')]),_0x90b96c[_0xed13('0xac')],_0x90b96c[_0xed13('0xad')]);}}delete this[_0xed13('0x15')][_0x2e3307[_0xed13('0xae')]];break;case'ANSWER':var _0x134463=moment()[_0xed13('0x58')](_0xed13('0x8e'));_0x90b96c[_0xed13('0xaf')]=_0x134463;_0x90b96c['answertime']=_0x134463;_0x90b96c['dialAnswer']=!![];_0x46b854[_0xed13('0x2a')]+=0x1;logger['info'](_0xed13('0xb0'),_0x90b96c[_0xed13('0xb1')],'\x20Queue',_0x46b854['name'],_0xed13('0xb2'),_0x46b854[_0xed13('0x2a')]);ami[_0xed13('0xa1')](_0xed13('0xb3'),ut[_0xed13('0xb4')](_0x90b96c,'connect',this[_0xed13('0x12')][_0x90b96c[_0xed13('0x6e')]]));if(_0x46b854[_0xed13('0xb5')]){ami[_0xed13('0xa1')](_0xed13('0xb6'),ut['buildAcw'](_0x90b96c));}break;case'16':ami[_0xed13('0xa1')](_0xed13('0xb7'),ut[_0xed13('0xb4')](_0x90b96c,'complete',this[_0xed13('0x12')][_0x90b96c[_0xed13('0x6e')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x90b96c,_0xed13('0xb8')));_0x46b854['outboundAnswerCallsDay']+=0x1;_0x46b854['total']+=0x1;_0x46b854[_0xed13('0xb9')]+=0x1;ut[_0xed13('0xba')](_0x46b854,'[16]');_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0x4,_0xed13('0xbc'));rpcDb[_0xed13('0x91')](_0x90b96c,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xbd'));rpcDb[_0xed13('0xbe')](_0x90b96c);_0x46b854[_0xed13('0x2c')]+=_0x90b96c['talktime'];_0x46b854[_0xed13('0x2b')]+=_0x90b96c[_0xed13('0xbf')];logger[_0xed13('0x6a')](_0xed13('0xc0'),_0x90b96c[_0xed13('0xb1')],_0xed13('0xc1'),_0x46b854['name'],_0xed13('0xb2'),_0x46b854[_0xed13('0x2a')]);delete this['actions'][_0x2e3307['linkedid']];break;case _0xed13('0xc2'):_0x46b854[_0xed13('0x3a')]+=0x1;_0x90b96c[_0xed13('0xc3')]+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0x5,_0xed13('0xc4'));ami['emit'](_0xed13('0xc5'),ut['buildObj'](_0x90b96c,'busy'));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xc6'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,'Global');rpcDb[_0xed13('0x95')](_0x1fb178,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x90b96c['countbusyretry']>=_0x46b854[_0xed13('0xc7')]){rpcDb['createCustomerFinal'](_0x90b96c,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xed13('0xa9')](ut[_0xed13('0xaa')](_0x90b96c,_0xed13('0xc3'),_0x46b854[_0xed13('0xc8')]),_0x90b96c[_0xed13('0xac')],_0x90b96c[_0xed13('0xad')]);}}break;case _0xed13('0xc9'):_0x46b854[_0xed13('0xca')]+=0x1;_0x90b96c[_0xed13('0xcb')]+=0x1;_0x90b96c[_0xed13('0xbb')]=ut['totalGlobal'](_0x90b96c);ut['logCustomer'](_0x90b96c,0x3,'NoAnswer');ami[_0xed13('0xa1')]('custom:agentnoanswer',ut['buildObj'](_0x90b96c,_0xed13('0xcc')));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xcd'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854['dialGlobalMaxRetry']){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,'Global');rpcDb[_0xed13('0x95')](_0x1fb178,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x90b96c[_0xed13('0xcb')]>=_0x46b854[_0xed13('0xce')]){rpcDb['createCustomerFinal'](_0x90b96c,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xed13('0xaa')](_0x90b96c,_0xed13('0xcb'),_0x46b854[_0xed13('0xcf')]),_0x90b96c[_0xed13('0xac')],_0x90b96c['activeContact']);}}break;case'CONGESTION':_0x46b854['outboundCongestionCallsDay']+=0x1;_0x90b96c['countcongestionretry']+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut['logCustomer'](_0x90b96c,0x8,_0xed13('0xd0'));ami[_0xed13('0xa1')](_0xed13('0xd1'),ut['buildObj'](_0x90b96c,'congestion'));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xd2'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut['cloneAction'](_0x90b96c,0xf,'Global');rpcDb['createCustomerFinal'](_0x1fb178,_0xed13('0xd3'));}else{if(_0x90b96c[_0xed13('0xd4')]>=_0x46b854[_0xed13('0xd5')]){rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xd2'));}else{rpcDb[_0xed13('0xa9')](ut[_0xed13('0xaa')](_0x90b96c,_0xed13('0xd4'),_0x46b854['dialBusyRetryFrequency']),_0x90b96c[_0xed13('0xac')],_0x90b96c[_0xed13('0xad')]);}}break;case _0xed13('0xd6'):_0x46b854[_0xed13('0x40')]+=0x1;_0x90b96c['countagentrejectretry']+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut['logCustomer'](_0x90b96c,0x14,_0xed13('0xd7'));ami[_0xed13('0xa1')](_0xed13('0xd8'),ut[_0xed13('0xb4')](_0x90b96c,_0xed13('0xd9')));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xda'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0x14,_0xed13('0xd7'));rpcDb['createCustomerFinal'](_0x1fb178,_0xed13('0xdb'));}else{if(_0x90b96c['countagentrejectretry']>=_0x46b854[_0xed13('0xdc')]){rpcDb[_0xed13('0x95')](_0x90b96c,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xed13('0xa9')](ut[_0xed13('0xaa')](_0x90b96c,'countagentrejectretry',_0x46b854[_0xed13('0xdd')]),_0x90b96c[_0xed13('0xac')],_0x90b96c[_0xed13('0xad')]);}}break;case _0xed13('0xde'):_0x46b854[_0xed13('0xdf')]+=0x1;_0x90b96c['countabandonedretry']+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut['logCustomer'](_0x90b96c,0xb,_0xed13('0xe0'));rpcDb[_0xed13('0x91')](_0x90b96c,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854['dialGlobalMaxRetry']){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,'Global');rpcDb['createCustomerFinal'](_0x1fb178,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x90b96c[_0xed13('0xe1')]>=_0x46b854[_0xed13('0xe2')]){rpcDb['createCustomerFinal'](_0x90b96c,_0xed13('0xe3'));}else{rpcDb[_0xed13('0xa9')](ut['scheduledAt'](_0x90b96c,'countabandonedretry',_0x46b854['dialAbandonedRetryFrequency']),_0x90b96c['unlockAgent'],_0x90b96c[_0xed13('0xad')]);}}break;case'18':_0x46b854[_0xed13('0x41')]+=0x1;_0x90b96c['countmachineretry']+=0x1;_0x90b96c['countglobal']=ut['totalGlobal'](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0x12,_0x2e3307[_0xed13('0xe4')]||_0x2e3307['dialstatus']);ami['emit']('custom:amd',ut[_0xed13('0xb4')](_0x90b96c,_0xed13('0xe5')));rpcDb['createCustomerHistory'](_0x90b96c,_0xed13('0xe6'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,_0xed13('0xe7'));rpcDb[_0xed13('0x95')](_0x1fb178,_0xed13('0xe6'));}else{rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xe6'));}delete this[_0xed13('0x15')][_0x2e3307[_0xed13('0xae')]];break;case'19':_0x46b854[_0xed13('0x41')]+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut['logCustomer'](_0x90b96c,0x13,_0x2e3307[_0xed13('0xe4')]||_0x2e3307[_0xed13('0xe8')]);ami[_0xed13('0xa1')](_0xed13('0xe9'),ut[_0xed13('0xb4')](_0x90b96c,_0xed13('0xe5')));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xea'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,_0xed13('0xe7'));rpcDb[_0xed13('0x95')](_0x1fb178,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xea'));}delete this[_0xed13('0x15')][_0x2e3307['linkedid']];break;default:if(_0x90b96c['dialAnswer']){ut['decrementTalkink'](_0x46b854,'[default]');ut[_0xed13('0x7c')](_0xed13('0xeb')+_0x46b854[_0xed13('0x28')],_0x2e3307);}_0x46b854[_0xed13('0x41')]+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0xc,_0x2e3307[_0xed13('0xe4')]||_0x2e3307[_0xed13('0xe8')]);rpcDb['createCustomerHistory'](_0x90b96c,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut['cloneAction'](_0x90b96c,0xf,_0xed13('0xe7'));rpcDb[_0xed13('0x95')](_0x1fb178,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x90b96c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x2e3307[_0xed13('0xae')]];}if(!(_0x90b96c[_0xed13('0x6f')]&&_0x2aac1c==='16')){ut[_0xed13('0x79')](_0x46b854,_0xed13('0xec'));logger[_0xed13('0x6a')](_0xed13('0xed'),_0x90b96c[_0xed13('0xb1')],_0xed13('0xc1'),_0x46b854[_0xed13('0x28')],_0xed13('0x6d'),_0x46b854[_0xed13('0x4c')]);}if(_0x2aac1c!=='ANSWER'){delete this[_0xed13('0x15')][_0x2e3307[_0xed13('0xae')]];delete this[_0xed13('0x15')][_0x2e3307[_0xed13('0xee')]];}}};Preview[_0xed13('0xe')][_0xed13('0xef')]=function(_0x29e4b7,_0x2bd62a,_0x5ed910){if(_['isUndefined'](_0x2bd62a)&&_0xed13('0xf0')!==typeof _0x2bd62a){return;}if(_['isUndefined'](_0x5ed910)&&_0xed13('0xf0')!==typeof _0x5ed910){return;}switch(_0x5ed910[_0xed13('0xf1')]){case'0':ut['logAgent'](_0x29e4b7,0x0,'NoSuchNumber');rpcDb[_0xed13('0xf2')](_0x29e4b7,_0xed13('0xf3'));break;case'3':ut[_0xed13('0xf4')](_0x29e4b7,0x3,_0xed13('0xf5'));rpcDb[_0xed13('0xf2')](_0x29e4b7,_0xed13('0xf6'));break;case'5':ut[_0xed13('0xf4')](_0x29e4b7,0x5,_0xed13('0xc4'));rpcDb[_0xed13('0xf2')](_0x29e4b7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x29e4b7,0x8,_0xed13('0xd0'));rpcDb[_0xed13('0xf2')](_0x29e4b7,_0xed13('0xf7'));break;case'22':ut[_0xed13('0xf4')](_0x29e4b7,0x16,_0xed13('0xf8'));rpcDb['createAgentHistory'](_0x29e4b7,_0xed13('0xf9'));break;default:ut['logAgent'](_0x29e4b7,0xc,_0x5ed910[_0xed13('0xf1')]);rpcDb[_0xed13('0xf2')](_0x29e4b7,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x2bd62a,_0xed13('0xfa'));logger[_0xed13('0x6a')](_0xed13('0xfb'),_0x29e4b7[_0xed13('0xb1')],_0xed13('0xc1'),_0x2bd62a[_0xed13('0x28')],'originated:\x20',_0x2bd62a[_0xed13('0x4c')]);delete this[_0xed13('0x15')][_0x29e4b7[_0xed13('0xb1')]];};Preview[_0xed13('0xe')][_0xed13('0xfc')]=function(_0xf587df,_0xc51ccb,_0x4bcc5f,_0x3723fa,_0x255a46){var _0x307e9b=this;return new BPromise(function(_0x3e117e,_0x2642de){if(_[_0xed13('0x69')](_0xc51ccb)||_[_0xed13('0x69')](_0xc51ccb['Contact'])||_['isNil'](_0xc51ccb[_0xed13('0xfd')]['phone'])||_[_0xed13('0x69')](_0xc51ccb['VoiceQueueId'])){_0x2642de(ut['message'](_0xed13('0xfe'),_0x3723fa,_0x255a46));return;}var _0x328f93=uuid['v4']();var _0x14b95d=_0x307e9b[_0xed13('0x12')][_0xc51ccb[_0xed13('0x6c')][_0xed13('0x28')]];var _0x3c3046=_0x4bcc5f?_0x307e9b[_0xed13('0x16')][_0x4bcc5f]['id']:undefined;_0x307e9b['actions'][_0x328f93]=new Action(_0xc51ccb,_0x14b95d,_0x328f93,_0x4bcc5f,_0x3c3046);var _0x29ab59=_0x307e9b[_0xed13('0x15')][_0x328f93];_0x29ab59['unlockAgent']=_0x3723fa;_0x29ab59[_0xed13('0xad')]=_0x255a46;_0x29ab59[_0xed13('0xff')]=_0x4bcc5f;if(_[_0xed13('0x100')](_0xf587df)){_0x307e9b['execCall'](_0x29ab59,_0x14b95d,_0xc51ccb,_0x4bcc5f)[_0xed13('0x83')](function(_0x4a44cb){logger[_0xed13('0x6a')](_0xed13('0x101'),_0xed13('0x102')+_0x29ab59[_0xed13('0x6e')]+_0xed13('0x103')+_0x29ab59[_0xed13('0x104')],JSON[_0xed13('0x55')](_0x4a44cb));ami['emit']('custom:agentcalled',ut[_0xed13('0xb4')](_0x29ab59,_0xed13('0x105'),_0x307e9b[_0xed13('0x12')][_0x29ab59[_0xed13('0x6e')]]));_0x3e117e(ut['message'](_0xed13('0x106')));})[_0xed13('0x77')](function(_0x59c9d5){ut[_0xed13('0x5d')](_0xed13('0x107'),_0x59c9d5);_0x2642de(ut[_0xed13('0x4b')](_0xed13('0x108'),_0x3723fa,_0x255a46));});}else{_0x14b95d[_0xed13('0x39')]+=0x1;ut[_0xed13('0x109')](_0x29ab59);rpcDb[_0xed13('0x10a')](_0x29ab59,_0xed13('0x10b'));delete _0x307e9b[_0xed13('0x15')][_0x328f93];_0x2642de(ut[_0xed13('0x4b')](_0xed13('0x10c'),_0x3723fa,_0x255a46));}});};Preview['prototype'][_0xed13('0x9a')]=function(_0x5981e5){return!_[_0xed13('0x69')](_0x5981e5)&&!_['isNil'](_0x5981e5[_0xed13('0x28')])&&!_['isNil'](_0x5981e5[_0xed13('0x52')])&&_0x5981e5[_0xed13('0x52')]&&!_['isNil'](this['trunks'][util[_0xed13('0x58')](_0xed13('0x10d'),_0x5981e5[_0xed13('0x28')])])&&!_['isNil'](this[_0xed13('0x14')][util[_0xed13('0x58')](_0xed13('0x10d'),_0x5981e5[_0xed13('0x28')])][_0xed13('0x75')])&&(this[_0xed13('0x14')][util[_0xed13('0x58')](_0xed13('0x10d'),_0x5981e5[_0xed13('0x28')])][_0xed13('0x75')]==='reachable'||this[_0xed13('0x14')][util[_0xed13('0x58')]('SIP/%s',_0x5981e5[_0xed13('0x28')])][_0xed13('0x75')]===_0xed13('0x10e'));};Preview[_0xed13('0xe')][_0xed13('0x8a')]=function(_0x401bba,_0x35c903){var _0xc32f66=this;return new BPromise(function(_0x517382,_0x1a3ef3){_0xc32f66[_0xed13('0x10f')](_0x401bba,_0x35c903)[_0xed13('0x83')](function(_0x2a6b68){_0x517382(_[_0xed13('0x70')](_0x2a6b68,['message']));})[_0xed13('0x77')](function(_0x3384fe){if(_0x3384fe[_0xed13('0x110')]){rpcDb[_0xed13('0x111')](_0x401bba);}if(_0x3384fe[_0xed13('0x52')]){rpcDb[_0xed13('0x112')](_0x401bba);}_0x1a3ef3(_[_0xed13('0x70')](_0x3384fe,['message']));});});};Preview[_0xed13('0xe')]['execRun']=function(_0x2b7085,_0x19d704){var _0x4d0a00=this;return new BPromise(function(_0x2917ec,_0x44321d){var _0x483b4e,_0x1c41e2;rpcDb[_0xed13('0x113')](_0x2b7085)[_0xed13('0x83')](function(_0x3785d1){if(!_[_0xed13('0x69')](_0x3785d1[0x0])){_0x1c41e2=_0x3785d1[0x0][_0xed13('0x114')]?![]:!![];_0x483b4e=_0x3785d1[0x0][_0xed13('0x114')]?!![]:![];_0x483b4e=_0x19d704?!![]:_0x483b4e;}var _0x185dab=_0x4d0a00[_0xed13('0x115')](_0x3785d1);if(_0x185dab['isValid']){rpcDb[_0xed13('0x116')](_[_0xed13('0x70')](_0x3785d1[0x0],[_0xed13('0x72'),_0xed13('0x117')]))['then'](function(_0x2d0f4d){_0x4d0a00['checkInBlack'](_0x2d0f4d,_0x3785d1[0x0],_0x19d704,_0x1c41e2,_0x483b4e)['then'](function(_0x2a602b){_0x2917ec(_0x2a602b);})[_0xed13('0x77')](function(_0x137ec1){_0x44321d(_0x137ec1);});})['catch'](function(_0x1ccd75){ut[_0xed13('0x5d')](_0xed13('0x118'),_0x1ccd75);_0x44321d(ut[_0xed13('0x4b')](_0xed13('0x119'),_0x1c41e2,_0x483b4e));});}else{_0x44321d(ut[_0xed13('0x4b')](_0x185dab[_0xed13('0x4b')],_0x1c41e2,_0x483b4e));}})[_0xed13('0x77')](function(_0x10fc83){ut[_0xed13('0x5d')](_0xed13('0x11a'),_0x10fc83);_0x44321d(ut[_0xed13('0x4b')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xed13('0xe')][_0xed13('0x115')]=function(_0x27c055){if(_[_0xed13('0x69')](_0x27c055)||_[_0xed13('0x100')](_0x27c055)||!_[_0xed13('0x69')](_0x27c055[0x0][_0xed13('0x88')])&&_['isNil'](_0x27c055[0x0][_0xed13('0x88')]['name'])){ut['logger'](_0xed13('0x11b'),_0x27c055);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x56a48b=this[_0xed13('0x12')][_0x27c055[0x0][_0xed13('0x6c')][_0xed13('0x28')]];_0x56a48b[_0xed13('0x4b')]=_0xed13('0x9d');if(_[_0xed13('0x69')](_0x56a48b)){ut['logger'](_0xed13('0x11c'),_0x56a48b);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xed13('0x9a')](_0x56a48b[_0xed13('0x51')])){ut['logger'](_0xed13('0x11d'),_0xed13('0x11e')+_0x56a48b[_0xed13('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xed13('0x9a')](_0x56a48b[_0xed13('0x9b')])){ut[_0xed13('0x5d')](_0xed13('0x11d'),_0x56a48b['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xed13('0x11f')};}}if(!ut[_0xed13('0x120')](_0x56a48b['dialActive'])){ut['logger'](_0xed13('0x121'),_0x56a48b[_0xed13('0x28')]+_0xed13('0x122'));return{'isValid':![],'message':_0xed13('0x11e')+_0x56a48b[_0xed13('0x28')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xed13('0x123')};};Preview[_0xed13('0xe')][_0xed13('0x124')]=function(_0x29d30a,_0x424af3,_0x522ffd,_0x21474c){var _0x513b90=this;return new BPromise(function(_0x2266e2,_0x2298d5){var _0x4c36bf=_0x29d30a['uniqueid'];var _0x2dbf39=_0x513b90[_0xed13('0x9a')](_0x424af3[_0xed13('0x51')])?util[_0xed13('0x58')](_0xed13('0x125'),_0x424af3[_0xed13('0x51')][_0xed13('0x28')],_[_0xed13('0x69')](_0x424af3[_0xed13('0x37')])?'':_0x424af3['dialPrefix']['trim']()||'',_0x424af3[_0xed13('0x126')]>0x0?_0x522ffd[_0xed13('0xfd')][_0xed13('0x127')][_0xed13('0x128')](_0x424af3[_0xed13('0x126')]):_0x522ffd['Contact'][_0xed13('0x127')]):util['format'](_0xed13('0x125'),_[_0xed13('0x69')](_0x424af3[_0xed13('0x9b')])?_0x424af3['Trunk'][_0xed13('0x28')]:_0x424af3[_0xed13('0x9b')][_0xed13('0x28')],_[_0xed13('0x69')](_0x424af3[_0xed13('0x37')])?'':_0x424af3[_0xed13('0x37')][_0xed13('0x129')]()||'',_0x424af3[_0xed13('0x126')]>0x0?_0x522ffd[_0xed13('0xfd')]['phone'][_0xed13('0x128')](_0x424af3['dialCutDigit']):_0x522ffd[_0xed13('0xfd')][_0xed13('0x127')]);var _0x43dfc9=_0x513b90[_0xed13('0x9a')](_0x424af3[_0xed13('0x51')])?ut[_0xed13('0x12a')](_0x424af3[_0xed13('0x51')][_0xed13('0x53')],_0x424af3[_0xed13('0x36')],_0x424af3[_0xed13('0x12b')]>0x0?ut['getCallerIdRandom'](_0x424af3[_0xed13('0x12c')],_0x424af3[_0xed13('0x12b')]):_0x424af3[_0xed13('0x12c')]):ut[_0xed13('0x12a')](_[_0xed13('0x69')](_0x424af3['TrunkBackup'])?_0x424af3[_0xed13('0x51')][_0xed13('0x53')]:_0x424af3[_0xed13('0x9b')][_0xed13('0x53')],_0x424af3[_0xed13('0x36')],_0x424af3[_0xed13('0x12b')]>0x0?ut[_0xed13('0x12d')](_0x424af3[_0xed13('0x12c')],_0x424af3[_0xed13('0x12b')]):_0x424af3[_0xed13('0x12c')]);if(_0x43dfc9){_0x29d30a[_0xed13('0x12e')]=ut['extractCalleridName'](_0x43dfc9);_0x29d30a[_0xed13('0x12f')]=ut[_0xed13('0x130')](_0x43dfc9);}var _0x2584fc=ut[_0xed13('0x131')](_0x424af3,_0x522ffd,_0x2dbf39,_0x43dfc9,_0x4c36bf,_0x29d30a);_['merge'](_0x29d30a,ut[_0xed13('0x132')](_0x2584fc));_0x29d30a[_0xed13('0x8d')]=moment()[_0xed13('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xed13('0x74')](ut[_0xed13('0x133')](_0x29d30a,_0x424af3,_0x2584fc,_0x29d30a[_0xed13('0xad')],_0x21474c))[_0xed13('0x83')](function(_0x345ffa){_0x424af3[_0xed13('0x4c')]+=0x1;logger[_0xed13('0x6a')]('[originated][increment]',_0x4c36bf,'\x20Queue',_0x424af3[_0xed13('0x28')],_0xed13('0x6d'),_0x424af3[_0xed13('0x4c')]);_0x2266e2(_0x345ffa);})[_0xed13('0x77')](function(_0x1a74ed){ut[_0xed13('0xf4')](_0x29d30a,0xe,_0xed13('0x134'));rpcDb['createAgentHistory'](_0x29d30a,_0xed13('0x135'));_0x2298d5(_0x1a74ed);});});};Preview['prototype']['syncNewExten']=function(_0x1498e5){if(this[_0xed13('0x15')][_0x1498e5[_0xed13('0xae')]]){this[_0xed13('0x15')][_0x1498e5['linkedid']]['channel']=_0x1498e5[_0xed13('0x76')];}};Preview[_0xed13('0xe')][_0xed13('0x136')]=function(_0x327e00){var _0x398347=this;var _0x31ec41=this['actions'][_0x327e00['actionid']];if(_0x31ec41){if(_0x31ec41[_0xed13('0xff')]&&this[_0xed13('0x16')][_0x31ec41[_0xed13('0xff')]]){ut[_0xed13('0x137')](_0x31ec41,this['agents'][_0x31ec41[_0xed13('0xff')]]['name'],this[_0xed13('0x16')][_0x31ec41[_0xed13('0xff')]]['id']);}var _0x5833e1=_[_0xed13('0x138')](_0x31ec41);_0x5833e1[_0xed13('0xaf')]=moment()[_0xed13('0x58')]('YYYY-MM-DD\x20HH:mm:ss');var _0x12deae=_0x398347[_0xed13('0x12')][_0x31ec41[_0xed13('0x6e')]];if(ut['isFailure'](_0x327e00[_0xed13('0x139')])){if(_0x31ec41[_0xed13('0xac')]){rpcDb['unlockContact'](_0x31ec41['idContact']);}if(_0x31ec41[_0xed13('0xad')]){rpcDb['disableContact'](_0x31ec41['idContact']);}ami[_0xed13('0xa1')](_0xed13('0x13a'),ut['buildObj'](_0x31ec41,'rejected',this['campaignsPreview'][_0x31ec41['queue']]));this[_0xed13('0xef')](_0x5833e1,_0x12deae,_0x327e00);}else{_0x31ec41[_0xed13('0x8d')]=moment()['format'](_0xed13('0x8e'));ut[_0xed13('0xf4')](_0x5833e1,0x4,_0xed13('0xbc'));rpcDb[_0xed13('0xf2')](_0x5833e1,_0xed13('0x13b'));}}};Preview[_0xed13('0xe')][_0xed13('0x19')]=function(_0x2a31a2){var _0x54b583=this;var _0x579ad0=this[_0xed13('0x15')][_0x2a31a2[_0xed13('0xae')]];var _0x500c85;if(_0x579ad0){_0x500c85=this[_0xed13('0x12')][_0x579ad0[_0xed13('0x6e')]];logger[_0xed13('0x6a')](_0xed13('0x13c'),_0x2a31a2['linkedid'],_0xed13('0xc1'),_0x500c85[_0xed13('0x28')],_0xed13('0xb2'),_0x500c85[_0xed13('0x2a')]);}if(this[_0xed13('0x15')][_0x2a31a2[_0xed13('0xae')]]&&_0x2a31a2[_0xed13('0xae')]!==_0x2a31a2[_0xed13('0xb1')]){if(_0x2a31a2['cause']==='16'&&this[_0xed13('0x15')][_0x2a31a2['linkedid']]['dialAnswer']){this[_0xed13('0x9e')](_0x2a31a2,_0x2a31a2['linkedid'],_0x2a31a2[_0xed13('0x13d')]);}else if(this[_0xed13('0x15')][_0x2a31a2['linkedid']][_0xed13('0x6f')]){logger[_0xed13('0x6a')](_0xed13('0x13e'),_0x2a31a2[_0xed13('0xae')],_0x2a31a2[_0xed13('0x13d')],_0xed13('0xc1'),_0x500c85[_0xed13('0x28')],_0xed13('0xb2'),_0x500c85[_0xed13('0x2a')]);this[_0xed13('0x9e')](_0x2a31a2,_0x2a31a2[_0xed13('0xae')],_0x2a31a2[_0xed13('0x13d')]);}}else if(_0x579ad0&&_[_0xed13('0x69')](_0x579ad0[_0xed13('0x13f')])&&_0x500c85[_0xed13('0x140')]&&_0x2a31a2[_0xed13('0xae')]===_0x2a31a2[_0xed13('0xb1')]&&_[_0xed13('0x69')](_0x2a31a2[_0xed13('0xf1')])&&_0x2a31a2['cause']==='16'&&_0x2a31a2[_0xed13('0x141')]==='6'&&_[_0xed13('0x142')](_0x579ad0[_0xed13('0x143')])){if(_0x579ad0[_0xed13('0xac')]){rpcDb['unlockContact'](_0x579ad0[_0xed13('0x104')]);}if(_0x579ad0[_0xed13('0xad')]){rpcDb['disableContact'](_0x579ad0[_0xed13('0x104')]);}_0x2a31a2[_0xed13('0xf1')]='22';this[_0xed13('0xef')](_0x579ad0,_0x500c85,_0x2a31a2);}else if(_0x579ad0&&_0x579ad0[_0xed13('0x143')]){if(_0x2a31a2[_0xed13('0x13d')]==='16'&&this[_0xed13('0x15')][_0x2a31a2[_0xed13('0xae')]]['dialAnswer']){logger[_0xed13('0x6a')]('[syncHangup][talking][transfer]',_0x2a31a2['linkedid'],_0x2a31a2[_0xed13('0x13d')],'\x20Queue',_0x500c85[_0xed13('0x28')],_0xed13('0xb2'),_0x500c85[_0xed13('0x2a')]);this[_0xed13('0x9e')](_0x2a31a2,_0x2a31a2['linkedid'],_0x2a31a2[_0xed13('0x13d')]);}else if(this[_0xed13('0x15')][_0x2a31a2[_0xed13('0xae')]][_0xed13('0x6f')]){logger['info'](_0xed13('0x13e'),_0x2a31a2[_0xed13('0xae')],_0x2a31a2[_0xed13('0x13d')],_0xed13('0xc1'),_0x500c85[_0xed13('0x28')],_0xed13('0xb2'),_0x500c85[_0xed13('0x2a')]);this['callProgressDetectingCustomer'](_0x2a31a2,_0x2a31a2[_0xed13('0xae')],_0x2a31a2[_0xed13('0x13d')]);}}};Preview[_0xed13('0xe')][_0xed13('0x1d')]=function(_0x441a2d){if(this[_0xed13('0x15')][_0x441a2d[_0xed13('0xee')]]&&_0x441a2d['destlinkedid']!==_0x441a2d[_0xed13('0x144')]){this[_0xed13('0x9e')](_0x441a2d,_0x441a2d[_0xed13('0xee')],_0x441a2d['dialstatus']);}};Preview['prototype'][_0xed13('0x1b')]=function(_0x145f35){if(this[_0xed13('0x15')][_0x145f35[_0xed13('0xae')]]&&_0x145f35[_0xed13('0xae')]!==_0x145f35['uniqueid']&&!this[_0xed13('0x15')][_0x145f35['linkedid']][_0xed13('0x6f')]){if(_0x145f35['cause']==='1'){this[_0xed13('0x9e')](_0x145f35,_0x145f35[_0xed13('0xae')],_0x145f35[_0xed13('0x13d')]);}}};Preview[_0xed13('0xe')][_0xed13('0x145')]=function(_0x42dd30,_0x171311,_0x5311a5){if(this[_0xed13('0x15')][_0x42dd30]){if(_['isNil'](this[_0xed13('0x15')][_0x42dd30][_0xed13('0x146')])){this[_0xed13('0x15')][_0x42dd30][_0xed13('0x146')]={};}this[_0xed13('0x15')][_0x42dd30][_0xed13('0x146')][_0x171311]=_0x5311a5;}};Preview['prototype']['syncVarSet']=function(_0x4c1105){try{if(!_[_0xed13('0x69')](_0x4c1105)){if(ut[_0xed13('0x147')](_[_0xed13('0x148')](_0x4c1105[_0xed13('0x149')])[0x0])){this['addVariable'](_0x4c1105[_0xed13('0xb1')],_[_0xed13('0x148')](_0x4c1105[_0xed13('0x149')])[0x0],_0x4c1105[_0xed13('0x14a')]);}}}catch(_0x3f7493){logger[_0xed13('0x14b')]('[syncVarSet][Preview]',util[_0xed13('0x14c')](_0x3f7493,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xed13('0x23')]=function(_0x602446){if(_0x602446){if(this[_0xed13('0x15')][_0x602446['transfertargetlinkedid']]){this[_0xed13('0x15')][_0x602446[_0xed13('0x14d')]][_0xed13('0x143')]=!![];}}};Preview[_0xed13('0xe')]['syncBlindTransfer']=function(_0x1c5250){if(_0x1c5250){if(this['actions'][_0x1c5250[_0xed13('0x14e')]]){this[_0xed13('0x15')][_0x1c5250[_0xed13('0x14e')]][_0xed13('0x143')]=!![];}}};module[_0xed13('0x14f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index dc59884..c1be6ba 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 _0x0c16=['bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','holdtime','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util'];(function(_0x79702,_0x34931c){var _0x417e6b=function(_0x55294a){while(--_0x55294a){_0x79702['push'](_0x79702['shift']());}};_0x417e6b(++_0x34931c);}(_0x0c16,0x149));var _0x60c1=function(_0x26158a,_0x35e5ab){_0x26158a=_0x26158a-0x0;var _0x1cf4ac=_0x0c16[_0x26158a];return _0x1cf4ac;};'use strict';var util=require(_0x60c1('0x0'));var BPromise=require(_0x60c1('0x1'));var logger=require(_0x60c1('0x2'))(_0x60c1('0x3'));var _=require(_0x60c1('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x60c1('0x5'));var cmHopperHistory=require(_0x60c1('0x6'));var cmHopperBlack=require(_0x60c1('0x7'));var voiceQueueRt=require(_0x60c1('0x8'));var agentReportPreview=require(_0x60c1('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1874d8){return function(_0x277c93){logger[_0x60c1('0xa')](_0x1874d8,util[_0x60c1('0xb')](_0x277c93,{'showHidden':![],'depth':null}));};}function create(_0x4b72ad){return BPromise[_0x60c1('0xc')]()['then'](cmHopperHistory[_0x60c1('0xd')](_0x4b72ad))[_0x60c1('0xe')](loggerCatch(_0x60c1('0xf')));}function createAgent(_0x1a80a9){return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](agentReportPreview[_0x60c1('0xd')](_0x1a80a9))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x254d15){return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](cmHopper[_0x60c1('0x11')](_0x254d15,!![]))[_0x60c1('0xe')](loggerCatch(_0x60c1('0x12')));}exports[_0x60c1('0x13')]=function(_0x5db03c){return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](cmHopperBlack['checkIsBlackList'](_0x5db03c))['catch'](loggerCatch(_0x60c1('0x14')));};exports[_0x60c1('0x15')]=function(_0x950e50){return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](cmHopper['getContactPreview'](_0x950e50))[_0x60c1('0xe')](loggerCatch(_0x60c1('0x16')));};exports[_0x60c1('0xd')]=function(_0x2131d7,_0x21bfc0){create(_0x2131d7)[_0x60c1('0xe')](loggerCatch(_0x21bfc0));moveContact(_0x2131d7)['catch'](loggerCatch(_0x21bfc0));};exports[_0x60c1('0x17')]=function(_0x2001d0,_0x4ca840){createAgent(_0x2001d0)[_0x60c1('0xe')](loggerCatch(_0x4ca840));};exports['createCustomerHistory']=function(_0x590ad2,_0x443e0b){create(_0x590ad2)[_0x60c1('0xe')](loggerCatch(_0x443e0b));};exports[_0x60c1('0x18')]=function(_0xb04295,_0x7f7395){moveContact(_0xb04295)[_0x60c1('0xe')](loggerCatch(_0x7f7395));};exports[_0x60c1('0x19')]=function(_0x372e26,_0x2ac4a5,_0x1009e2){if(_0x2ac4a5){_0x372e26[_0x60c1('0x1a')]=null;}if(_0x1009e2){_0x372e26[_0x60c1('0x1b')]=![];}return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](cmHopper[_0x60c1('0x19')](_0x372e26))[_0x60c1('0xe')](loggerCatch(_0x60c1('0x1c')));};exports[_0x60c1('0x1d')]=function(_0x56dade){return BPromise[_0x60c1('0xc')]()['then'](cmHopper[_0x60c1('0x1d')](_0x56dade))['catch'](loggerCatch(_0x60c1('0x1e')));};exports[_0x60c1('0x1f')]=function(_0x457760){return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](cmHopper[_0x60c1('0x1f')]({'UserId':null},_0x457760,0x1))['catch'](loggerCatch(_0x60c1('0x20')));};exports['disableContact']=function(_0x13a953){return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](cmHopper[_0x60c1('0x1f')]({'active':![]},_0x13a953,0x1))['catch'](loggerCatch(_0x60c1('0x21')));};exports['crateCustomerReportQueue']=function(_0x583b2f){var _0x2da04b={};_0x2da04b[_0x60c1('0x22')]=_0x583b2f[_0x60c1('0x22')];_0x2da04b[_0x60c1('0x23')]=_0x583b2f[_0x60c1('0x23')];_0x2da04b[_0x60c1('0x24')]=_0x583b2f[_0x60c1('0x24')];_0x2da04b['calleridname']=_0x583b2f['calleridname'];_0x2da04b['queue']=_0x583b2f[_0x60c1('0x25')];_0x2da04b[_0x60c1('0x26')]=_0x583b2f['answertime'];_0x2da04b[_0x60c1('0x27')]=_0x583b2f[_0x60c1('0x28')];_0x2da04b[_0x60c1('0x29')]=0x1;_0x2da04b[_0x60c1('0x2a')]=_0x583b2f['endtime'];_0x2da04b[_0x60c1('0x2b')]=_0x583b2f[_0x60c1('0x2c')];_0x2da04b[_0x60c1('0x2d')]=_0x60c1('0x2e');_0x2da04b['exten']='xcally-motion-preview';_0x2da04b[_0x60c1('0x2f')]=0x0;_0x2da04b['assigned']=0x1;_0x2da04b['lastAssignedTo']=_0x583b2f[_0x60c1('0x2c')];_0x2da04b[_0x60c1('0x30')]=_0x60c1('0x31');return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](voiceQueueReport['create'](_0x2da04b))[_0x60c1('0xe')](loggerCatch(_0x60c1('0x32')));};exports[_0x60c1('0x33')]=function(_0x198e90,_0x54f12b){return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](cmHopper[_0x60c1('0x33')](_0x198e90,_0x54f12b))[_0x60c1('0xe')](loggerCatch(_0x60c1('0x34')));};exports[_0x60c1('0x35')]=function(_0xd5a95c){return BPromise[_0x60c1('0xc')]()[_0x60c1('0x10')](cmHopper[_0x60c1('0x19')](_0xd5a95c,!![],!![]))[_0x60c1('0xe')](loggerCatch(_0x60c1('0x36')));}; \ No newline at end of file +var _0x484b=['queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','[createHistory]\x20','then','createHistory','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x484b,0x139));var _0xb484=function(_0x30d2ce,_0x199640){_0x30d2ce=_0x30d2ce-0x0;var _0x4820cc=_0x484b[_0x30d2ce];return _0x4820cc;};'use strict';var util=require(_0xb484('0x0'));var BPromise=require(_0xb484('0x1'));var logger=require(_0xb484('0x2'))(_0xb484('0x3'));var _=require(_0xb484('0x4'));var cmHopper=require(_0xb484('0x5'));var cmHopperFinal=require(_0xb484('0x6'));var cmHopperHistory=require(_0xb484('0x7'));var cmHopperBlack=require(_0xb484('0x8'));var voiceQueueRt=require(_0xb484('0x9'));var agentReportPreview=require(_0xb484('0xa'));var voiceQueueReport=require(_0xb484('0xb'));function loggerCatch(_0x26f44b){return function(_0x22b519){logger[_0xb484('0xc')](_0x26f44b,util[_0xb484('0xd')](_0x22b519,{'showHidden':![],'depth':null}));};}function create(_0x57b646){return BPromise[_0xb484('0xe')]()['then'](cmHopperHistory['createHistory'](_0x57b646))['catch'](loggerCatch(_0xb484('0xf')));}function createAgent(_0x305fa0){return BPromise['resolve']()[_0xb484('0x10')](agentReportPreview[_0xb484('0x11')](_0x305fa0))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x48735c){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x12')](_0x48735c,!![]))[_0xb484('0x13')](loggerCatch(_0xb484('0x14')));}exports['checkIsBlackList']=function(_0x7fbc7e){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopperBlack[_0xb484('0x15')](_0x7fbc7e))['catch'](loggerCatch(_0xb484('0x16')));};exports['getContactPreview']=function(_0x571ae9){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x17')](_0x571ae9))[_0xb484('0x13')](loggerCatch(_0xb484('0x18')));};exports[_0xb484('0x11')]=function(_0x5edcb8,_0xce9338){create(_0x5edcb8)['catch'](loggerCatch(_0xce9338));moveContact(_0x5edcb8)[_0xb484('0x13')](loggerCatch(_0xce9338));};exports[_0xb484('0x19')]=function(_0x57c854,_0x377c32){createAgent(_0x57c854)[_0xb484('0x13')](loggerCatch(_0x377c32));};exports[_0xb484('0x1a')]=function(_0xc5de1e,_0x4717d5){create(_0xc5de1e)[_0xb484('0x13')](loggerCatch(_0x4717d5));};exports[_0xb484('0x1b')]=function(_0x264dae,_0x4192dc){moveContact(_0x264dae)[_0xb484('0x13')](loggerCatch(_0x4192dc));};exports[_0xb484('0x1c')]=function(_0xff0526,_0x1acb29,_0x2ca10d){if(_0x1acb29){_0xff0526['UserId']=null;}if(_0x2ca10d){_0xff0526[_0xb484('0x1d')]=![];}return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x1c')](_0xff0526))[_0xb484('0x13')](loggerCatch(_0xb484('0x1e')));};exports[_0xb484('0x1f')]=function(_0x2bd22e){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x1f')](_0x2bd22e))[_0xb484('0x13')](loggerCatch('[countReScheduled]\x20'));};exports[_0xb484('0x20')]=function(_0x37cab7){return BPromise[_0xb484('0xe')]()['then'](cmHopper[_0xb484('0x20')]({'UserId':null},_0x37cab7,0x1))[_0xb484('0x13')](loggerCatch(_0xb484('0x21')));};exports[_0xb484('0x22')]=function(_0x6ad318){return BPromise['resolve']()[_0xb484('0x10')](cmHopper[_0xb484('0x20')]({'active':![]},_0x6ad318,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xb484('0x23')]=function(_0x423d5c){var _0x11ac48={};_0x11ac48[_0xb484('0x24')]=_0x423d5c[_0xb484('0x24')];_0x11ac48[_0xb484('0x25')]=_0x423d5c[_0xb484('0x25')];_0x11ac48[_0xb484('0x26')]=_0x423d5c['calleridnum'];_0x11ac48[_0xb484('0x27')]=_0x423d5c[_0xb484('0x27')];_0x11ac48[_0xb484('0x28')]=_0x423d5c[_0xb484('0x28')];_0x11ac48[_0xb484('0x29')]=_0x423d5c['answertime'];_0x11ac48[_0xb484('0x2a')]=_0x423d5c['answertime'];_0x11ac48['queuecallercomplete']=0x1;_0x11ac48[_0xb484('0x2b')]=_0x423d5c[_0xb484('0x2c')];_0x11ac48[_0xb484('0x2d')]=_0x423d5c[_0xb484('0x2e')];_0x11ac48[_0xb484('0x2f')]=_0xb484('0x30');_0x11ac48[_0xb484('0x31')]=_0xb484('0x32');_0x11ac48[_0xb484('0x33')]=0x0;_0x11ac48[_0xb484('0x34')]=0x1;_0x11ac48[_0xb484('0x35')]=_0x423d5c[_0xb484('0x2e')];_0x11ac48[_0xb484('0x36')]='COMPLETED';return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](voiceQueueReport[_0xb484('0x37')](_0x11ac48))['catch'](loggerCatch(_0xb484('0x38')));};exports[_0xb484('0x39')]=function(_0x478f49,_0x557513){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x39')](_0x478f49,_0x557513))[_0xb484('0x13')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xb484('0x3a')]=function(_0x5444f5){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper['rescheduleContact'](_0x5444f5,!![],!![]))[_0xb484('0x13')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index cf6424c..92b4e47 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 _0x85af=['minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','channelAgent','agentReadyId','not_inuse','status','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','UserId','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','error','logger','info','loggerError','inspect','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','name','format','calleridname','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','membername','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','xcally-motion-preview','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','statedesc','Global','active','scheduledat','add'];(function(_0x22e77d,_0x2a6f25){var _0x3939b4=function(_0x4e2496){while(--_0x4e2496){_0x22e77d['push'](_0x22e77d['shift']());}};_0x3939b4(++_0x2a6f25);}(_0x85af,0xc7));var _0xf85a=function(_0xf6455b,_0x55ce97){_0xf6455b=_0xf6455b-0x0;var _0x348cfa=_0x85af[_0xf6455b];return _0x348cfa;};'use strict';var util=require(_0xf85a('0x0'));var _=require(_0xf85a('0x1'));var moment=require(_0xf85a('0x2'));var logger=require(_0xf85a('0x3'))(_0xf85a('0x4'));var ipAgi=process[_0xf85a('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x3ba1ce,_0x570220){var _0xd05a6c=moment(_0x3ba1ce)[_0xf85a('0x6')](0x0);var _0x4844cd=moment(_0x570220)['milliseconds'](0x0);return _0xd05a6c[_0xf85a('0x7')](_0x4844cd,_0xf85a('0x8'));}exports['loggerCatch']=function(_0x53c885){return function(_0x3193fb){logger[_0xf85a('0x9')](_0x53c885,util['inspect'](_0x3193fb,{'showHidden':![],'depth':null}));};};exports[_0xf85a('0xa')]=function(_0x1438d4,_0x1b4468){logger[_0xf85a('0xb')](_0x1438d4,util['inspect'](_0x1b4468,{'showHidden':![],'depth':null}));};exports[_0xf85a('0xc')]=function(_0x24f185,_0x11ab87){logger[_0xf85a('0x9')](_0x24f185,util[_0xf85a('0xd')](_0x11ab87,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x17b845){return function(_0x190172){logger[_0xf85a('0xb')](_0x17b845,util[_0xf85a('0xd')](_0x190172,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x525b19,_0x46da80,_0x25a4eb){return{'message':_0x525b19,'unlock':_0x46da80,'active':_0x25a4eb};};exports[_0xf85a('0xe')]=function(_0x3074ac,_0x56029d,_0xc3d51b){if(!_[_0xf85a('0xf')](_0xc3d51b)&&_0xf85a('0x10')===typeof _0xc3d51b&&!_[_0xf85a('0x11')](_0xc3d51b)){if(!_[_0xf85a('0xf')](_0x56029d)&&_0xf85a('0x10')===typeof _0x56029d&&!_['isEmpty'](_0x56029d)){return util['format'](_0xf85a('0x12'),_0x56029d,_0xc3d51b);}return util['format'](_0xf85a('0x12'),_0xc3d51b,_0xc3d51b);}if(!_['isUndefined'](_0x3074ac)&&_0xf85a('0x10')===typeof _0x3074ac&&!_[_0xf85a('0x11')](_0x3074ac)){return _0x3074ac;}return _0xf85a('0x13');};exports[_0xf85a('0x14')]=function(_0x2ecd40){if(_[_0xf85a('0x15')](_0x2ecd40)){return![];}return _0x2ecd40;};exports[_0xf85a('0x16')]=function(_0x5f53f8,_0x337518,_0x164d3d,_0x5c9cb2,_0x440846,_0x384f16){var _0x37ac4b={'XMD-QUEUE':_0x337518['Queue']?_0x337518['Queue'][_0xf85a('0x17')]:'','XMD-CALLERID':_0x5c9cb2,'XMD-CALLERID-PREVIEW':_0x384f16?util[_0xf85a('0x18')]('\x22%s\x22\x20<%s>',_0x384f16[_0xf85a('0x19')],_0x384f16[_0xf85a('0x1a')]):_0x5c9cb2,'XMD-DIALID':_0x440846,'XMD-CONTACTID':_0x337518[_0xf85a('0x1b')],'XMD-CDRTYPE':_0xf85a('0x1c'),'CALLERID(all)':_0x5c9cb2,'XMD-VOICEQUEUEID':_0x337518['VoiceQueueId'],'XMD-DIALCHANNEL':_0x164d3d,'XMD-DIALTIMEOUT':_0x5f53f8['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xf85a('0x18')](_0xf85a('0x1d'),_0x5f53f8[_0xf85a('0x1e')]?'g':'',_[_0xf85a('0x11')](_0x5f53f8[_0xf85a('0x1f')])?'':_0xf85a('0x20')),'XMD-DIALURL':_0x5f53f8[_0xf85a('0x21')]||'','XMD-AGI':_0x5f53f8[_0xf85a('0x22')]?util[_0xf85a('0x18')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5f53f8[_0xf85a('0x22')]):_0xf85a('0x23'),'XMD-AGIAFTER':_0x5f53f8[_0xf85a('0x1e')]?util[_0xf85a('0x18')](_0xf85a('0x24'),ipAgi,_0x5f53f8[_0xf85a('0x1e')]):_0xf85a('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x384f16?_0x384f16['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x384f16?_0x384f16[_0xf85a('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xf85a('0x11')](_0x5f53f8['monitor_format'])){_0x37ac4b[util[_0xf85a('0x18')]('%s',_0xf85a('0x26'))]=_0x5f53f8[_0xf85a('0x1f')];_0x37ac4b[util[_0xf85a('0x18')]('%s',_0xf85a('0x27'))]=_0x440846;}if(_0x337518&&_0x337518[_0xf85a('0x28')]){for(var _0x1d207e in _0x337518['Contact']){if(_0x337518[_0xf85a('0x28')]['hasOwnProperty'](_0x1d207e)){if(!_[_0xf85a('0x15')](_0x337518['Contact'][_0x1d207e])&&_0x1d207e!=='id'&&_0x1d207e!==_0xf85a('0x29')&&_0x1d207e!==_0xf85a('0x2a')&&_0x1d207e!=='updatedAt'){_0x37ac4b[util['format'](_0xf85a('0x2b'),_0xf85a('0x2c'),_[_0xf85a('0x2d')](_0x1d207e))]=_0x337518[_0xf85a('0x28')][_0x1d207e];}}}}return _0x37ac4b;};exports[_0xf85a('0x2e')]=function(_0x312b26){var _0xb00c95={};for(var _0x10e07b in _0x312b26){if(_0x312b26[_0xf85a('0x2f')](_0x10e07b)){_0xb00c95[util[_0xf85a('0x18')]('%s',_[_0xf85a('0x30')](_0x10e07b))]=_0x312b26[_0x10e07b];}}return{'variables':_0xb00c95};};exports[_0xf85a('0x31')]=function(_0x24fe56,_0x167fee){if(!_['isNil'](_0x24fe56)){if(_0x24fe56[_0xf85a('0x2f')](_0xf85a('0x32'))){if(_0x24fe56['originated']>0x0){_0x24fe56[_0xf85a('0x32')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x167fee);}}}else{logger[_0xf85a('0x9')](_0xf85a('0x33'),_0x167fee);}};exports[_0xf85a('0x34')]=function(_0x54d812){var _0x1ba864=moment()[_0xf85a('0x18')]('YYYY-MM-DD\x20HH:mm:ss');_0x54d812[_0xf85a('0x35')]=0xd;_0x54d812['statedesc']=_0xf85a('0x36');_0x54d812['starttime']=_0x1ba864;_0x54d812[_0xf85a('0x37')]=_0x1ba864;_0x54d812[_0xf85a('0x38')]=_0x1ba864;};exports[_0xf85a('0x39')]=function(_0x5271d7,_0x4101a1,_0x7c192a){var _0xe335f2=moment()[_0xf85a('0x18')](_0xf85a('0x3a'));_0x5271d7[_0xf85a('0x35')]=_0x4101a1;_0x5271d7['statedesc']=_0x7c192a;_0x5271d7['responsetime']=_0xe335f2;_0x5271d7[_0xf85a('0x3b')]=getSeconds(_0x5271d7[_0xf85a('0x37')],_0x5271d7[_0xf85a('0x3c')]);};exports['logLookAgent']=function(_0x5e6147,_0x23ca8c,_0x470cab){_0x5e6147[_0xf85a('0x3d')]=_0x23ca8c;_0x5e6147['UserId']=_0x470cab;};exports[_0xf85a('0x3e')]=function(_0x52b774,_0x35adde,_0x575951){var _0x4fa4e8=moment()[_0xf85a('0x18')](_0xf85a('0x3a'));_0x52b774[_0xf85a('0x35')]=_0x35adde;_0x52b774['statedesc']=_0x575951;_0x52b774[_0xf85a('0x37')]=_0x52b774[_0xf85a('0x37')]?_0x52b774['responsetime']:_0x4fa4e8;_0x52b774[_0xf85a('0x38')]=_0x52b774['endtime']?_0x52b774[_0xf85a('0x38')]:_0x4fa4e8;_0x52b774[_0xf85a('0x3b')]=getSeconds(_0x52b774[_0xf85a('0x37')]||0x0,_0x52b774[_0xf85a('0x3c')]||0x0);_0x52b774[_0xf85a('0x3f')]=_0x52b774[_0xf85a('0x40')]?getSeconds(_0x52b774[_0xf85a('0x38')],_0x52b774['answertime']):0x0;};exports['isFailure']=function(_0x3ec43a){return _0x3ec43a===_0xf85a('0x41');};exports[_0xf85a('0x42')]=function(_0x5cd195,_0x3744c7,_0x2c1c26,_0x39991a,_0x2ec1d1){var _0x327230=_0x39991a?_0xf85a('0x43'):_0x5cd195['calleridname'];_0x327230=_0x2ec1d1?_0xf85a('0x44'):_0x327230;return{'actionid':_0x5cd195[_0xf85a('0x45')],'action':_0xf85a('0x46'),'channel':_0x5cd195['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x327230,_0x5cd195['calleridnum']),'Exten':_0xf85a('0x47'),'Context':_0xf85a('0x48'),'Priority':'1','variable':_0x2c1c26,'timeout':(_0x3744c7['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5cd195[_0xf85a('0x45')]};};exports['totalGlobal']=function(_0xed731d){return _0xed731d[_0xf85a('0x49')]+_0xed731d[_0xf85a('0x4a')]+_0xed731d[_0xf85a('0x4b')]+_0xed731d[_0xf85a('0x4c')]+_0xed731d[_0xf85a('0x4d')];};exports[_0xf85a('0x4e')]=function(_0x45d09a){var _0xab5bad=_[_0xf85a('0x4f')](_0x45d09a);_0xab5bad[_0xf85a('0x35')]=0xf;_0xab5bad[_0xf85a('0x50')]=_0xf85a('0x51');return _0xab5bad;};exports['scheduledAt']=function(_0xd99151,_0x1428a2,_0x3f3538){var _0x345d7e={};_0x345d7e[_0x1428a2]=_0xd99151[_0x1428a2];_0x345d7e[_0xf85a('0x52')]=![];_0x345d7e[_0xf85a('0x53')]=moment()[_0xf85a('0x54')](_0x3f3538,_0xf85a('0x55'))[_0xf85a('0x18')](_0xf85a('0x3a'));_0x345d7e['ContactId']=_0xd99151[_0xf85a('0x1b')];_0x345d7e[_0xf85a('0x56')]=_0xd99151[_0xf85a('0x56')];_0x345d7e[_0xf85a('0x57')]=_0xd99151[_0xf85a('0x57')]||undefined;return _0x345d7e;};exports[_0xf85a('0x58')]=function(_0x26ce64,_0xcbcbd1){if(!_[_0xf85a('0x15')](_0x26ce64)){if(_0x26ce64[_0xf85a('0x59')]>0x0){_0x26ce64[_0xf85a('0x59')]-=0x1;}else{logger['error'](_0xcbcbd1,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0xcbcbd1,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x76dba0){if(_0x76dba0<=0x0){return!![];}return![];};exports[_0xf85a('0x5a')]=function(_0x25f05f,_0x4a025f,_0x3aca23){_0x25f05f[_0xf85a('0x5b')]=_0x4a025f;_0x25f05f[_0xf85a('0x17')]=_0x25f05f[_0xf85a('0x5c')];_0x25f05f[_0xf85a('0x5d')]=_0x25f05f['channelAgent'];_0x25f05f[_0xf85a('0x5e')]=_0xf85a('0x5f');if(_0x3aca23){_0x25f05f[_0xf85a('0x60')]=_0x3aca23['mandatoryDisposition'];}return _0x25f05f;};exports[_0xf85a('0x61')]=function(_0x34268e){var _0x24195f={};_0x24195f[_0xf85a('0x5c')]=_0x34268e[_0xf85a('0x5c')];_0x24195f[_0xf85a('0x5d')]=_0x34268e[_0xf85a('0x62')];_0x24195f[_0xf85a('0x45')]=_0x34268e[_0xf85a('0x45')];return _0x24195f;};exports[_0xf85a('0x63')]=function(_0x509c1e){var _0x1b2cc6=[];for(var _0x56489e in _0x509c1e){if(_0x509c1e[_0xf85a('0x2f')](_0x56489e)){if(!_[_0xf85a('0x15')](_0x509c1e[_0x56489e])&&_0x509c1e[_0x56489e][_0xf85a('0x35')]===_0xf85a('0x64')&&_0x509c1e[_0x56489e][_0xf85a('0x65')]==='reachable'){_0x1b2cc6['push'](_0x509c1e[_0x56489e]['id']);}}}return _0x1b2cc6;};exports[_0xf85a('0x66')]=function(_0x3c6499){var _0x5d4e71=moment()[_0xf85a('0x6')](0x0);var _0x4af5fe=moment(_0x3c6499)[_0xf85a('0x6')](0x0);return _0x5d4e71[_0xf85a('0x7')](_0x4af5fe,_0xf85a('0x8'));};exports[_0xf85a('0x67')]=function(_0x3c7e04){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c7e04['ContactId'],'ListId':_0x3c7e04['ListId'],'VoiceQueueId':_0x3c7e04[_0xf85a('0x57')]||undefined,'CampaignId':_0x3c7e04[_0xf85a('0x68')]||undefined};};exports[_0xf85a('0x69')]=function(_0x51cd2e){if(_0x51cd2e===_0xf85a('0x45')||_0x51cd2e===_0xf85a('0x6a')||_0x51cd2e===_0xf85a('0x5c')||_0x51cd2e==='type'||_0x51cd2e===_0xf85a('0x6b')||_0x51cd2e===_0xf85a('0x6c')||_0x51cd2e===_0xf85a('0x3d')||_0x51cd2e===_0xf85a('0x62')||_0x51cd2e===_0xf85a('0x19')||_0x51cd2e===_0xf85a('0x52')||_0x51cd2e===_0xf85a('0x1a')||_0x51cd2e===_0xf85a('0x53')||_0x51cd2e===_0xf85a('0x49')||_0x51cd2e===_0xf85a('0x4a')||_0x51cd2e===_0xf85a('0x4b')||_0x51cd2e===_0xf85a('0x6d')||_0x51cd2e===_0xf85a('0x6e')||_0x51cd2e===_0xf85a('0x6f')||_0x51cd2e===_0xf85a('0x70')||_0x51cd2e==='recallme'||_0x51cd2e===_0xf85a('0x1b')||_0x51cd2e===_0xf85a('0x56')||_0x51cd2e===_0xf85a('0x71')||_0x51cd2e===_0xf85a('0x57')||_0x51cd2e===_0xf85a('0x72')||_0x51cd2e==='xmd-voicequeueid'||_0x51cd2e==='xmd-queue'||_0x51cd2e===_0xf85a('0x73')||_0x51cd2e===_0xf85a('0x74')||_0x51cd2e===_0xf85a('0x75')||_0x51cd2e===_0xf85a('0x76')||_0x51cd2e===_0xf85a('0x77')||_0x51cd2e===_0xf85a('0x78')||_0x51cd2e===_0xf85a('0x79')||_0x51cd2e===_0xf85a('0x7a')||_0x51cd2e===_0xf85a('0x7b')||_0x51cd2e==='xmd-callerid'||_0x51cd2e===_0xf85a('0x7c')||_0x51cd2e===_0xf85a('0x7d')||_0x51cd2e==='rtpaudioqos'||_0x51cd2e===_0xf85a('0x7e')||_0x51cd2e===_0xf85a('0x7f')||_0x51cd2e===_0xf85a('0x80')||_0x51cd2e===_0xf85a('0x81')||_0x51cd2e===_0xf85a('0x82')||_0x51cd2e==='rtpaudioqosrtt'||_0x51cd2e===_0xf85a('0x83')||_0x51cd2e===_0xf85a('0x84')||_0x51cd2e==='rtpaudioqosbridged'||_0x51cd2e===_0xf85a('0x7f')||_0x51cd2e===_0xf85a('0x80')||_0x51cd2e===_0xf85a('0x81')||_0x51cd2e===_0xf85a('0x82')||_0x51cd2e==='rtpaudioqosrtt'||_0x51cd2e===_0xf85a('0x83')||_0x51cd2e===_0xf85a('0x85')||_0x51cd2e===_0xf85a('0x86')||_0x51cd2e==='state'||_0x51cd2e===_0xf85a('0x50')){return![];}return!![];};exports[_0xf85a('0x87')]=function(_0x328043,_0x582867){var _0x599782,_0x94c761,_0x2c82bf;if(_0x582867<=0x0){_0x582867=0x1;}_0x599782=new RegExp(_0xf85a('0x88')+_0x582867+'}$');_0x94c761=Math[_0xf85a('0x89')](0xa,_0x582867-0x1);_0x2c82bf=Math[_0xf85a('0x89')](0xa,_0x582867)-0x1;return util[_0xf85a('0x18')]('%s',_[_0xf85a('0x8a')](_0x328043,_0x599782,_[_0xf85a('0x8b')](_0x94c761,_0x2c82bf)));};exports['extractCalleridName']=function(_0x5e22bd){var _0x437c80=_0x5e22bd[_0xf85a('0x8c')](/"(.*?)"/);return _0x437c80?_0x437c80[0x1]:_0x5e22bd;};exports[_0xf85a('0x8d')]=function(_0x2ab603){var _0x498a95=_0x2ab603[_0xf85a('0x8c')](/<(.*?)>/);return _0x498a95?_0x498a95[0x1]:_0x2ab603;}; \ No newline at end of file +var _0x202c=['Failure','variablesAction','calleridname','BOOKED','originate','timeout','uniqueid','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countbusyretry','countcongestionretry','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','error','logger2','info','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','format','isUndefined','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','logAgent','state','ringtime','logLookAgent','membername','logCustomer','endtime','talktime','answertime','isFailure'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x202c,0x1ef));var _0xc202=function(_0x1af5a8,_0x1b1723){_0x1af5a8=_0x1af5a8-0x0;var _0xba9f46=_0x202c[_0x1af5a8];return _0xba9f46;};'use strict';var util=require(_0xc202('0x0'));var _=require(_0xc202('0x1'));var moment=require('moment');var logger=require(_0xc202('0x2'))(_0xc202('0x3'));var ipAgi=process[_0xc202('0x4')][_0xc202('0x5')]||_0xc202('0x6');function getSeconds(_0x22aa0b,_0x493029){var _0x398ab0=moment(_0x22aa0b)['milliseconds'](0x0);var _0x3ea23d=moment(_0x493029)[_0xc202('0x7')](0x0);return _0x398ab0[_0xc202('0x8')](_0x3ea23d,_0xc202('0x9'));}exports[_0xc202('0xa')]=function(_0x373532){return function(_0x34ffc6){logger['error'](_0x373532,util[_0xc202('0xb')](_0x34ffc6,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x41990e,_0x51d009){logger['info'](_0x41990e,util['inspect'](_0x51d009,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x446885,_0x34e64c){logger[_0xc202('0xc')](_0x446885,util[_0xc202('0xb')](_0x34e64c,{'showHidden':![],'depth':null}));};exports[_0xc202('0xd')]=function(_0x291437){return function(_0x5056d9){logger[_0xc202('0xe')](_0x291437,util[_0xc202('0xb')](_0x5056d9,{'showHidden':![],'depth':null}));};};exports[_0xc202('0xf')]=function(_0x4e3f32,_0x28a2fd,_0x535ba3){return{'message':_0x4e3f32,'unlock':_0x28a2fd,'active':_0x535ba3};};exports[_0xc202('0x10')]=function(_0x330945,_0x505173,_0x2982c5){if(!_['isUndefined'](_0x2982c5)&&_0xc202('0x11')===typeof _0x2982c5&&!_[_0xc202('0x12')](_0x2982c5)){if(!_['isUndefined'](_0x505173)&&_0xc202('0x11')===typeof _0x505173&&!_[_0xc202('0x12')](_0x505173)){return util['format'](_0xc202('0x13'),_0x505173,_0x2982c5);}return util[_0xc202('0x14')]('\x22%s\x22\x20<%s>',_0x2982c5,_0x2982c5);}if(!_[_0xc202('0x15')](_0x330945)&&_0xc202('0x11')===typeof _0x330945&&!_[_0xc202('0x12')](_0x330945)){return _0x330945;}return _0xc202('0x16');};exports[_0xc202('0x17')]=function(_0x1088ca){if(_[_0xc202('0x18')](_0x1088ca)){return![];}return _0x1088ca;};exports['addVariables']=function(_0x19ad2a,_0xf72cfd,_0x22b62f,_0x2651c2,_0x3696df,_0x52859c){var _0x485ebf={'XMD-QUEUE':_0xf72cfd[_0xc202('0x19')]?_0xf72cfd[_0xc202('0x19')][_0xc202('0x1a')]:'','XMD-CALLERID':_0x2651c2,'XMD-CALLERID-PREVIEW':_0x52859c?util[_0xc202('0x14')](_0xc202('0x13'),_0x52859c['calleridname'],_0x52859c[_0xc202('0x1b')]):_0x2651c2,'XMD-DIALID':_0x3696df,'XMD-CONTACTID':_0xf72cfd[_0xc202('0x1c')],'XMD-CDRTYPE':_0xc202('0x1d'),'CALLERID(all)':_0x2651c2,'XMD-VOICEQUEUEID':_0xf72cfd[_0xc202('0x1e')],'XMD-DIALCHANNEL':_0x22b62f,'XMD-DIALTIMEOUT':_0x19ad2a[_0xc202('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xc202('0x14')]('\x22rtTxX%s%s\x22',_0x19ad2a['dialQueueProject2']?'g':'',_['isEmpty'](_0x19ad2a[_0xc202('0x20')])?'':_0xc202('0x21')),'XMD-DIALURL':_0x19ad2a['dialPreviewUrl']||'','XMD-AGI':_0x19ad2a[_0xc202('0x22')]?util['format'](_0xc202('0x23'),ipAgi,_0x19ad2a[_0xc202('0x22')]):_0xc202('0x24'),'XMD-AGIAFTER':_0x19ad2a[_0xc202('0x25')]?util[_0xc202('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x19ad2a[_0xc202('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x52859c?_0x52859c['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x52859c?_0x52859c['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xc202('0x12')](_0x19ad2a[_0xc202('0x20')])){_0x485ebf[util[_0xc202('0x14')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x19ad2a['monitor_format'];_0x485ebf[util[_0xc202('0x14')]('%s',_0xc202('0x26'))]=_0x3696df;}if(_0xf72cfd&&_0xf72cfd['Contact']){for(var _0x5efc67 in _0xf72cfd['Contact']){if(_0xf72cfd[_0xc202('0x27')][_0xc202('0x28')](_0x5efc67)){if(!_[_0xc202('0x18')](_0xf72cfd[_0xc202('0x27')][_0x5efc67])&&_0x5efc67!=='id'&&_0x5efc67!=='tags'&&_0x5efc67!==_0xc202('0x29')&&_0x5efc67!==_0xc202('0x2a')){_0x485ebf[util[_0xc202('0x14')](_0xc202('0x2b'),_0xc202('0x2c'),_[_0xc202('0x2d')](_0x5efc67))]=_0xf72cfd[_0xc202('0x27')][_0x5efc67];}}}}return _0x485ebf;};exports[_0xc202('0x2e')]=function(_0x5c6d9b){var _0x4d6d61={};for(var _0x156b1c in _0x5c6d9b){if(_0x5c6d9b['hasOwnProperty'](_0x156b1c)){_0x4d6d61[util[_0xc202('0x14')]('%s',_['toLower'](_0x156b1c))]=_0x5c6d9b[_0x156b1c];}}return{'variables':_0x4d6d61};};exports['updateOriginated']=function(_0x3690a5,_0x44b05b){if(!_[_0xc202('0x18')](_0x3690a5)){if(_0x3690a5[_0xc202('0x28')](_0xc202('0x2f'))){if(_0x3690a5['originated']>0x0){_0x3690a5[_0xc202('0x2f')]-=0x1;}else{logger[_0xc202('0xc')](_0xc202('0x30'),_0x44b05b);}}}else{logger[_0xc202('0xc')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x44b05b);}};exports[_0xc202('0x31')]=function(_0x467dfc){var _0x4b6337=moment()[_0xc202('0x14')](_0xc202('0x32'));_0x467dfc['state']=0xd;_0x467dfc[_0xc202('0x33')]=_0xc202('0x34');_0x467dfc[_0xc202('0x35')]=_0x4b6337;_0x467dfc[_0xc202('0x36')]=_0x4b6337;_0x467dfc['endtime']=_0x4b6337;};exports[_0xc202('0x37')]=function(_0x5157e6,_0x3fadce,_0x5ba04b){var _0x357baa=moment()[_0xc202('0x14')](_0xc202('0x32'));_0x5157e6[_0xc202('0x38')]=_0x3fadce;_0x5157e6[_0xc202('0x33')]=_0x5ba04b;_0x5157e6[_0xc202('0x36')]=_0x357baa;_0x5157e6[_0xc202('0x39')]=getSeconds(_0x5157e6[_0xc202('0x36')],_0x5157e6['starttime']);};exports[_0xc202('0x3a')]=function(_0x25be89,_0x32c089,_0x4c5d86){_0x25be89[_0xc202('0x3b')]=_0x32c089;_0x25be89['UserId']=_0x4c5d86;};exports[_0xc202('0x3c')]=function(_0x586f7a,_0x2707ec,_0x3e6aea){var _0x4eb635=moment()[_0xc202('0x14')](_0xc202('0x32'));_0x586f7a[_0xc202('0x38')]=_0x2707ec;_0x586f7a[_0xc202('0x33')]=_0x3e6aea;_0x586f7a[_0xc202('0x36')]=_0x586f7a[_0xc202('0x36')]?_0x586f7a['responsetime']:_0x4eb635;_0x586f7a[_0xc202('0x3d')]=_0x586f7a[_0xc202('0x3d')]?_0x586f7a[_0xc202('0x3d')]:_0x4eb635;_0x586f7a['ringtime']=getSeconds(_0x586f7a['responsetime']||0x0,_0x586f7a[_0xc202('0x35')]||0x0);_0x586f7a[_0xc202('0x3e')]=_0x586f7a[_0xc202('0x3f')]?getSeconds(_0x586f7a[_0xc202('0x3d')],_0x586f7a[_0xc202('0x3f')]):0x0;};exports[_0xc202('0x40')]=function(_0x28d71b){return _0x28d71b===_0xc202('0x41');};exports[_0xc202('0x42')]=function(_0x2e6e44,_0x10022b,_0x5a2d48,_0x47c989,_0x20aca9){var _0x373ebd=_0x47c989?'RECALL':_0x2e6e44[_0xc202('0x43')];_0x373ebd=_0x20aca9?_0xc202('0x44'):_0x373ebd;return{'actionid':_0x2e6e44['uniqueid'],'action':_0xc202('0x45'),'channel':_0x2e6e44['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x373ebd,_0x2e6e44[_0xc202('0x1b')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x5a2d48,'timeout':(_0x10022b[_0xc202('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2e6e44[_0xc202('0x47')]};};exports['totalGlobal']=function(_0x132784){return _0x132784['countbusyretry']+_0x132784['countcongestionretry']+_0x132784[_0xc202('0x48')]+_0x132784['countagentrejectretry']+_0x132784[_0xc202('0x49')];};exports[_0xc202('0x4a')]=function(_0x4d3c3c){var _0x16bfac=_[_0xc202('0x4b')](_0x4d3c3c);_0x16bfac['state']=0xf;_0x16bfac[_0xc202('0x33')]=_0xc202('0x4c');return _0x16bfac;};exports[_0xc202('0x4d')]=function(_0xda612f,_0x57339b,_0x59b7cb){var _0xc4a891={};_0xc4a891[_0x57339b]=_0xda612f[_0x57339b];_0xc4a891[_0xc202('0x4e')]=![];_0xc4a891['scheduledat']=moment()[_0xc202('0x4f')](_0x59b7cb,_0xc202('0x50'))[_0xc202('0x14')](_0xc202('0x32'));_0xc4a891[_0xc202('0x1c')]=_0xda612f[_0xc202('0x1c')];_0xc4a891['ListId']=_0xda612f[_0xc202('0x51')];_0xc4a891[_0xc202('0x1e')]=_0xda612f[_0xc202('0x1e')]||undefined;return _0xc4a891;};exports[_0xc202('0x52')]=function(_0x45558f,_0x3c7d5c){if(!_[_0xc202('0x18')](_0x45558f)){if(_0x45558f[_0xc202('0x53')]>0x0){_0x45558f['pTalking']-=0x1;}else{logger[_0xc202('0xc')](_0x3c7d5c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc202('0xc')](_0x3c7d5c,_0xc202('0x54'));}};exports['IsNotLoggedIn']=function(_0x5b0bae){if(_0x5b0bae<=0x0){return!![];}return![];};exports[_0xc202('0x55')]=function(_0x2df054,_0x23a9f5,_0x2bf6a8){_0x2df054['lastevent']=_0x23a9f5;_0x2df054['name']=_0x2df054[_0xc202('0x56')];_0x2df054[_0xc202('0x57')]=_0x2df054[_0xc202('0x58')];_0x2df054[_0xc202('0x59')]=_0xc202('0x5a');if(_0x2bf6a8){_0x2df054[_0xc202('0x5b')]=_0x2bf6a8[_0xc202('0x5b')];}return _0x2df054;};exports[_0xc202('0x5c')]=function(_0x1568cd){var _0x558640={};_0x558640[_0xc202('0x56')]=_0x1568cd['queue'];_0x558640[_0xc202('0x57')]=_0x1568cd['channelAgent'];_0x558640[_0xc202('0x47')]=_0x1568cd[_0xc202('0x47')];return _0x558640;};exports[_0xc202('0x5d')]=function(_0x164e4c){var _0x31cba7=[];for(var _0x5c6ef3 in _0x164e4c){if(_0x164e4c['hasOwnProperty'](_0x5c6ef3)){if(!_[_0xc202('0x18')](_0x164e4c[_0x5c6ef3])&&_0x164e4c[_0x5c6ef3][_0xc202('0x38')]===_0xc202('0x5e')&&_0x164e4c[_0x5c6ef3]['status']===_0xc202('0x5f')){_0x31cba7[_0xc202('0x60')](_0x164e4c[_0x5c6ef3]['id']);}}}return _0x31cba7;};exports[_0xc202('0x61')]=function(_0x5f5020){var _0x382767=moment()[_0xc202('0x7')](0x0);var _0x57289e=moment(_0x5f5020)[_0xc202('0x7')](0x0);return _0x382767[_0xc202('0x8')](_0x57289e,_0xc202('0x9'));};exports[_0xc202('0x62')]=function(_0x58ca8f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58ca8f['ContactId'],'ListId':_0x58ca8f[_0xc202('0x51')],'VoiceQueueId':_0x58ca8f[_0xc202('0x1e')]||undefined,'CampaignId':_0x58ca8f[_0xc202('0x63')]||undefined};};exports[_0xc202('0x64')]=function(_0x270e4d){if(_0x270e4d===_0xc202('0x47')||_0x270e4d===_0xc202('0x65')||_0x270e4d===_0xc202('0x56')||_0x270e4d===_0xc202('0x66')||_0x270e4d===_0xc202('0x67')||_0x270e4d===_0xc202('0x68')||_0x270e4d===_0xc202('0x3b')||_0x270e4d==='channelAgent'||_0x270e4d==='calleridname'||_0x270e4d===_0xc202('0x4e')||_0x270e4d===_0xc202('0x1b')||_0x270e4d===_0xc202('0x69')||_0x270e4d===_0xc202('0x6a')||_0x270e4d===_0xc202('0x6b')||_0x270e4d===_0xc202('0x48')||_0x270e4d===_0xc202('0x6c')||_0x270e4d===_0xc202('0x6d')||_0x270e4d==='callbackuniqueid'||_0x270e4d===_0xc202('0x6e')||_0x270e4d===_0xc202('0x6f')||_0x270e4d==='ContactId'||_0x270e4d===_0xc202('0x51')||_0x270e4d===_0xc202('0x70')||_0x270e4d===_0xc202('0x1e')||_0x270e4d===_0xc202('0x71')||_0x270e4d===_0xc202('0x72')||_0x270e4d===_0xc202('0x73')||_0x270e4d===_0xc202('0x74')||_0x270e4d===_0xc202('0x75')||_0x270e4d==='xmd-dialurl'||_0x270e4d==='xmd-dialtimeout'||_0x270e4d===_0xc202('0x76')||_0x270e4d===_0xc202('0x77')||_0x270e4d==='xmd-dialchannel'||_0x270e4d===_0xc202('0x78')||_0x270e4d===_0xc202('0x79')||_0x270e4d===_0xc202('0x7a')||_0x270e4d==='xmd-agiafter'||_0x270e4d===_0xc202('0x7b')||_0x270e4d===_0xc202('0x7c')||_0x270e4d===_0xc202('0x7d')||_0x270e4d===_0xc202('0x7e')||_0x270e4d==='rtpaudioqosjitterbridged'||_0x270e4d==='rtpaudioqosloss'||_0x270e4d===_0xc202('0x7f')||_0x270e4d===_0xc202('0x80')||_0x270e4d===_0xc202('0x81')||_0x270e4d===_0xc202('0x7c')||_0x270e4d===_0xc202('0x7d')||_0x270e4d===_0xc202('0x7e')||_0x270e4d===_0xc202('0x82')||_0x270e4d===_0xc202('0x83')||_0x270e4d===_0xc202('0x7f')||_0x270e4d==='rtpaudioqosrtt'||_0x270e4d==='rtpaudioqosrttbridged'||_0x270e4d===_0xc202('0x84')||_0x270e4d===_0xc202('0x85')||_0x270e4d===_0xc202('0x38')||_0x270e4d===_0xc202('0x33')){return![];}return!![];};exports[_0xc202('0x86')]=function(_0x1b97c1,_0x2b4818){var _0xebf712,_0x2732ef,_0x3962fc;if(_0x2b4818<=0x0){_0x2b4818=0x1;}_0xebf712=new RegExp(_0xc202('0x87')+_0x2b4818+'}$');_0x2732ef=Math[_0xc202('0x88')](0xa,_0x2b4818-0x1);_0x3962fc=Math['pow'](0xa,_0x2b4818)-0x1;return util[_0xc202('0x14')]('%s',_['replace'](_0x1b97c1,_0xebf712,_[_0xc202('0x89')](_0x2732ef,_0x3962fc)));};exports[_0xc202('0x8a')]=function(_0x400788){var _0x406026=_0x400788[_0xc202('0x8b')](/"(.*?)"/);return _0x406026?_0x406026[0x1]:_0x400788;};exports['extractCalleridNumber']=function(_0x3e1280){var _0x1066c3=_0x3e1280[_0xc202('0x8b')](/<(.*?)>/);return _0x1066c3?_0x1066c3[0x1]:_0x3e1280;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a513695..0bcd4ef 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 _0x1a9d=['queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','boolean'];(function(_0x5c8533,_0x312262){var _0x4e439a=function(_0x387c5b){while(--_0x387c5b){_0x5c8533['push'](_0x5c8533['shift']());}};_0x4e439a(++_0x312262);}(_0x1a9d,0x75));var _0xd1a9=function(_0x4b593a,_0x1b3d43){_0x4b593a=_0x4b593a-0x0;var _0x2a9274=_0x1a9d[_0x4b593a];return _0x2a9274;};'use strict';exports[_0xd1a9('0x0')]={'queue':{'type':_0xd1a9('0x1'),'required':!![]},'interface':{'type':_0xd1a9('0x1'),'required':!![]},'membername':{'type':_0xd1a9('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xd1a9('0x2'),'required':![]}};exports[_0xd1a9('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0xd1a9('0x2')},'reason':{'type':_0xd1a9('0x1'),'required':![]}};exports[_0xd1a9('0x4')]={'module':{'type':_0xd1a9('0x1'),'required':![]}};exports[_0xd1a9('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xd1a9('0x6')]={'uniqueid':{'type':_0xd1a9('0x1'),'required':!![]},'filename':{'type':_0xd1a9('0x1')},'format':{'type':_0xd1a9('0x1')},'mixmonitorid':{'type':_0xd1a9('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xd1a9('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xd1a9('0x1'),'required':!![]},'context':{'type':_0xd1a9('0x1')}}; \ No newline at end of file +var _0x3b51=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','voicequeuechannel','voicechannel'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x3b51,0x192));var _0x13b5=function(_0x57c601,_0x3293a2){_0x57c601=_0x57c601-0x0;var _0x10d301=_0x3b51[_0x57c601];return _0x10d301;};'use strict';exports[_0x13b5('0x0')]={'queue':{'type':_0x13b5('0x1'),'required':!![]},'interface':{'type':_0x13b5('0x1'),'required':!![]},'membername':{'type':_0x13b5('0x1'),'required':!![]},'penalty':{'type':_0x13b5('0x2'),'required':![]},'paused':{'type':_0x13b5('0x3'),'required':![]}};exports[_0x13b5('0x4')]={'queue':{'type':_0x13b5('0x1'),'required':!![]},'interface':{'type':_0x13b5('0x1'),'required':!![]}};exports[_0x13b5('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x13b5('0x1'),'required':![]}};exports[_0x13b5('0x6')]={'uniqueid':{'type':_0x13b5('0x1'),'required':!![]}};exports[_0x13b5('0x7')]={'uniqueid':{'type':_0x13b5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x13b5('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x13b5('0x8')]={'uniqueid':{'type':_0x13b5('0x1'),'required':!![]}};exports[_0x13b5('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x13b5('0x1'),'required':!![]},'context':{'type':_0x13b5('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 296f923..c7dc116 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 _0x71f2=['settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initVoiceQueues','initTriggers','initTemplates','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','abandoned','diff','queuecallerjoinAt','seconds','sumDuration','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','disposition','ANSWERED','duration','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','lodash','moment','../model/agent','../model/trunk','../model/trigger','../model/campaign','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','channels'];(function(_0x4d6aec,_0x3643d8){var _0x25ca03=function(_0x3fbd42){while(--_0x3fbd42){_0x4d6aec['push'](_0x4d6aec['shift']());}};_0x25ca03(++_0x3643d8);}(_0x71f2,0x1ca));var _0x271f=function(_0x5073ff,_0xb286d9){_0x5073ff=_0x5073ff-0x0;var _0x499d38=_0x71f2[_0x5073ff];return _0x499d38;};'use strict';var BPromise=require(_0x271f('0x0'));var util=require('util');var _=require(_0x271f('0x1'));var moment=require(_0x271f('0x2'));var Agent=require(_0x271f('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x271f('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x271f('0x5'));var Template=require('../model/template');var Campaign=require(_0x271f('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x271f('0x7'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x271f('0x8'));var DeskAccount=require(_0x271f('0x9'));var VtigerAccount=require(_0x271f('0xa'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x271f('0xb'));var FaxAccount=require(_0x271f('0xc'));var Realtime=function(){this[_0x271f('0xd')]={};this[_0x271f('0xe')]={};this[_0x271f('0xf')]={};this[_0x271f('0x10')]={};this[_0x271f('0x11')]={};this['campaigns']={};this[_0x271f('0x12')]={};this[_0x271f('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x271f('0x14')]={};this[_0x271f('0x15')]={};this['queueChannels']={};this['outboundChannels']={};this['timers']={};this[_0x271f('0x16')]={};this[_0x271f('0x17')]={};this[_0x271f('0x18')]={};this[_0x271f('0x19')]={};this[_0x271f('0x1a')]={};this[_0x271f('0x1b')]={};this[_0x271f('0x1c')]={};this['vtigerAccounts']={};this[_0x271f('0x1d')]={};this[_0x271f('0x1e')]={};this['freshsalesAccounts']={};this[_0x271f('0x1f')]={};};function freeIsNotKey(_0x53d979,_0x69a3ce,_0x3354d7){var _0x3c9ca6=_[_0x271f('0x20')](_0x53d979,function(_0x180faa,_0x1ab874){return _0x180faa[_0x3354d7];});for(var _0x356602 in _0x69a3ce){if(_0x69a3ce['hasOwnProperty'](_0x356602)){if(!_0x3c9ca6[_0x356602]){delete _0x69a3ce[_0x356602];}}}}function freeIsNotKeySip(_0x4df1d3,_0x93174b){var _0x177082=_[_0x271f('0x20')](_0x4df1d3,function(_0x25928c,_0x3c31e0){return util[_0x271f('0x21')](_0x271f('0x22'),_0x25928c[_0x271f('0x23')]);});for(var _0x59eb4c in _0x93174b){if(_0x93174b[_0x271f('0x24')](_0x59eb4c)){if(!_0x177082[_0x59eb4c]){delete _0x93174b[_0x59eb4c];}}}}function freeIsNotKeyAgent(_0x40caf4,_0x3fb60){var _0x149554=_[_0x271f('0x20')](_0x40caf4,function(_0x54850d,_0x3f57df){var _0x444a77=_[_0x271f('0x25')](_0x54850d[_0x271f('0x26')])?util[_0x271f('0x21')](_0x271f('0x22'),_0x54850d['name']):_0x54850d[_0x271f('0x26')];return _0x444a77;});for(var _0x5d72ee in _0x3fb60){if(_0x3fb60[_0x271f('0x24')](_0x5d72ee)){if(!_0x149554[_0x5d72ee]){delete _0x3fb60[_0x5d72ee];}}}}function clearVoiceCallReports(_0x3d7c99){_0x3d7c99[_0x271f('0x27')]=0x0;_0x3d7c99[_0x271f('0x28')]=0x0;_0x3d7c99[_0x271f('0x29')]=0x0;_0x3d7c99['sumDuration']=0x0;_0x3d7c99[_0x271f('0x2a')]=0x0;}function clearCampaigns(_0x2e3665){if(!_[_0x271f('0x2b')](_0x2e3665)){for(var _0x129c18 in _0x2e3665){if(_0x2e3665['hasOwnProperty'](_0x129c18)){_0x2e3665[_0x129c18]['ivrTotalCallsDays']=0x0;_0x2e3665[_0x129c18]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x43c121){if(!_[_0x271f('0x2b')](_0x43c121)){for(var _0x2b6030 in _0x43c121){if(_0x43c121['hasOwnProperty'](_0x2b6030)){_0x43c121[_0x2b6030][_0x271f('0x27')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x28')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x2c')]=0x0;_0x43c121[_0x2b6030]['abandoned']=0x0;_0x43c121[_0x2b6030][_0x271f('0x29')]=0x0;_0x43c121[_0x2b6030]['sumDuration']=0x0;_0x43c121[_0x2b6030][_0x271f('0x2a')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x2d')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x2e')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x2f')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x30')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x31')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x32')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x33')]=0x0;_0x43c121[_0x2b6030]['outboundDropCallsDayCallersExit']=0x0;_0x43c121[_0x2b6030]['outboundBlacklistCallsDay']=0x0;_0x43c121[_0x2b6030][_0x271f('0x34')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x35')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x36')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x2d')]=0x0;_0x43c121[_0x2b6030][_0x271f('0x37')]=0x0;_0x43c121[_0x2b6030]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0x271f('0x38')]=function(_0x342980,_0x5f9dfc){for(var _0x4cd038 in _0x5f9dfc){if(_0x342980['hasOwnProperty'](_0x4cd038)){_0x342980[_0x4cd038]=_0x5f9dfc[_0x4cd038];}}};Realtime[_0x271f('0x39')][_0x271f('0x3a')]=function(){var _0x3e098b=this;return function(_0x10a70a){if(_0x10a70a){freeIsNotKeyAgent(_0x10a70a,_0x3e098b['agents']);for(var _0x3f3f55=0x0,_0x2d6032={},_0x4e3a8b={};_0x3f3f55<_0x10a70a[_0x271f('0x3b')];_0x3f3f55+=0x1){_0x2d6032=_0x10a70a[_0x3f3f55];var _0x294459=_[_0x271f('0x25')](_0x2d6032[_0x271f('0x26')])?util['format'](_0x271f('0x22'),_0x2d6032[_0x271f('0x23')]):_0x2d6032['interface'];if(_[_0x271f('0x3c')](_0x3e098b[_0x271f('0xd')][_0x294459])){_0x3e098b[_0x271f('0xd')][_0x294459]=new Agent(_0x2d6032);}else{_0x3e098b[_0x271f('0x38')](_0x3e098b[_0x271f('0xd')][_0x294459],_0x2d6032);}}}return _0x3e098b[_0x271f('0xd')];};};Realtime[_0x271f('0x39')][_0x271f('0x3d')]=function(){var _0x4dd5e9=this;return function(_0x57b4c2){if(_0x57b4c2){freeIsNotKeySip(_0x57b4c2,_0x4dd5e9[_0x271f('0xe')]);for(var _0x20eedc=0x0,_0x158974={},_0x41151e={};_0x20eedc<_0x57b4c2[_0x271f('0x3b')];_0x20eedc+=0x1){_0x158974=_0x57b4c2[_0x20eedc];if(_[_0x271f('0x3c')](_0x4dd5e9[_0x271f('0xe')][util[_0x271f('0x21')](_0x271f('0x22'),_0x158974[_0x271f('0x23')])])){_0x4dd5e9[_0x271f('0xe')][util[_0x271f('0x21')](_0x271f('0x22'),_0x158974[_0x271f('0x23')])]=new Telephone(_0x158974);}else{_0x4dd5e9[_0x271f('0x38')](_0x4dd5e9['telephones'][util[_0x271f('0x21')](_0x271f('0x22'),_0x158974[_0x271f('0x23')])],_0x158974);}}}return _0x4dd5e9[_0x271f('0xe')];};};Realtime[_0x271f('0x39')]['initTrunks']=function(){var _0x1777d9=this;return function(_0x579cd6){if(_0x579cd6){freeIsNotKeySip(_0x579cd6,_0x1777d9[_0x271f('0xf')]);for(var _0x560bbb=0x0,_0x16e9ba={},_0x4d52a9={};_0x560bbb<_0x579cd6[_0x271f('0x3b')];_0x560bbb+=0x1){_0x16e9ba=_0x579cd6[_0x560bbb];if(_[_0x271f('0x3c')](_0x1777d9[_0x271f('0xf')][util[_0x271f('0x21')](_0x271f('0x22'),_0x16e9ba[_0x271f('0x23')])])){_0x1777d9[_0x271f('0xf')][util[_0x271f('0x21')](_0x271f('0x22'),_0x16e9ba[_0x271f('0x23')])]=new Trunk(_0x16e9ba);}else{_0x1777d9['mergeFromDatabase'](_0x1777d9[_0x271f('0xf')][util[_0x271f('0x21')]('SIP/%s',_0x16e9ba[_0x271f('0x23')])],_0x16e9ba);}}}return _0x1777d9[_0x271f('0xf')];};};Realtime[_0x271f('0x39')][_0x271f('0x3e')]=function(){var _0x2ad3f2=this;return function(_0x19858a){if(_0x19858a){freeIsNotKey(_0x19858a,_0x2ad3f2[_0x271f('0x10')],'name');for(var _0x3cfe13=0x0,_0x2e1599={},_0x258136={};_0x3cfe13<_0x19858a['length'];_0x3cfe13+=0x1){_0x2e1599=_0x19858a[_0x3cfe13];if(_[_0x271f('0x3c')](_0x2ad3f2[_0x271f('0x10')][_0x2e1599[_0x271f('0x23')]])){_0x2ad3f2[_0x271f('0x10')][_0x2e1599[_0x271f('0x23')]]=new VoiceQueue(_0x2e1599);}else{_0x2ad3f2[_0x271f('0x38')](_0x2ad3f2[_0x271f('0x10')][_0x2e1599[_0x271f('0x23')]],_0x2e1599);}}}return _0x2ad3f2[_0x271f('0x10')];};};Realtime['prototype'][_0x271f('0x3f')]=function(){var _0x470142=this;return function(_0x19cf5d){if(_0x19cf5d){freeIsNotKey(_0x19cf5d,_0x470142[_0x271f('0x11')],'id');for(var _0x5bc9e4=0x0,_0x2748e4={},_0x33a06b={};_0x5bc9e4<_0x19cf5d[_0x271f('0x3b')];_0x5bc9e4+=0x1){_0x2748e4=_0x19cf5d[_0x5bc9e4];if(_[_0x271f('0x3c')](_0x470142[_0x271f('0x11')][_0x2748e4['id']])){_0x470142['triggers'][_0x2748e4['id']]=new Trigger(_0x2748e4);}else{_0x470142['mergeFromDatabase'](_0x470142[_0x271f('0x11')][_0x2748e4['id']],_0x2748e4);}}}return _0x470142[_0x271f('0x11')];};};Realtime[_0x271f('0x39')][_0x271f('0x40')]=function(){var _0x1e1703=this;return function(_0x5f0477){if(_0x5f0477){freeIsNotKey(_0x5f0477,_0x1e1703['templates'],'id');for(var _0x1871b0=0x0,_0x21ba27={},_0x219dc0={};_0x1871b0<_0x5f0477[_0x271f('0x3b')];_0x1871b0+=0x1){_0x21ba27=_0x5f0477[_0x1871b0];if(_[_0x271f('0x3c')](_0x1e1703[_0x271f('0x12')][_0x21ba27['id']])){_0x1e1703[_0x271f('0x12')][_0x21ba27['id']]=new Template(_0x21ba27);}else{_0x1e1703[_0x271f('0x38')](_0x1e1703[_0x271f('0x12')][_0x21ba27['id']],_0x21ba27);}}}return _0x1e1703[_0x271f('0x12')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x460af=this;return function(_0xab8bc9){if(_0xab8bc9){freeIsNotKey(_0xab8bc9,_0x460af[_0x271f('0x17')],'id');for(var _0x2b5805=0x0,_0x530481={},_0x47424d={};_0x2b5805<_0xab8bc9[_0x271f('0x3b')];_0x2b5805+=0x1){_0x530481=_0xab8bc9[_0x2b5805];if(_['isUndefined'](_0x460af[_0x271f('0x17')][_0x530481['id']])){_0x460af['zendeskAccounts'][_0x530481['id']]=new ZendeskAccount(_0x530481);}else{_0x460af[_0x271f('0x38')](_0x460af[_0x271f('0x17')][_0x530481['id']],_0x530481);}}}return _0x460af[_0x271f('0x17')];};};Realtime[_0x271f('0x39')]['initSalesforceAccounts']=function(){var _0x58e15c=this;return function(_0xd33c91){if(_0xd33c91){freeIsNotKey(_0xd33c91,_0x58e15c['salesforceAccounts'],'id');for(var _0x1e0ecb=0x0,_0x139500={},_0x591fd6={};_0x1e0ecb<_0xd33c91[_0x271f('0x3b')];_0x1e0ecb+=0x1){_0x139500=_0xd33c91[_0x1e0ecb];if(_[_0x271f('0x3c')](_0x58e15c[_0x271f('0x18')][_0x139500['id']])){_0x58e15c[_0x271f('0x18')][_0x139500['id']]=new SalesforceAccount(_0x139500);}else{_0x58e15c['mergeFromDatabase'](_0x58e15c['salesforceAccounts'][_0x139500['id']],_0x139500);}}}return _0x58e15c['salesforceAccounts'];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x1acbc5=this;return function(_0x388c94){if(_0x388c94){freeIsNotKey(_0x388c94,_0x1acbc5['freshdeskAccounts'],'id');for(var _0x5e4df5=0x0,_0x5a0e1b={},_0x2642bc={};_0x5e4df5<_0x388c94[_0x271f('0x3b')];_0x5e4df5+=0x1){_0x5a0e1b=_0x388c94[_0x5e4df5];if(_['isUndefined'](_0x1acbc5['freshdeskAccounts'][_0x5a0e1b['id']])){_0x1acbc5['freshdeskAccounts'][_0x5a0e1b['id']]=new FreshdeskAccount(_0x5a0e1b);}else{_0x1acbc5[_0x271f('0x38')](_0x1acbc5[_0x271f('0x1a')][_0x5a0e1b['id']],_0x5a0e1b);}}}return _0x1acbc5['freshdeskAccounts'];};};Realtime[_0x271f('0x39')]['initZohoAccounts']=function(){var _0x440f89=this;return function(_0x98ffdb){if(_0x98ffdb){freeIsNotKey(_0x98ffdb,_0x440f89['zohoAccounts'],'id');for(var _0x5e4227=0x0,_0x4e7b17={},_0xbf085={};_0x5e4227<_0x98ffdb['length'];_0x5e4227+=0x1){_0x4e7b17=_0x98ffdb[_0x5e4227];if(_[_0x271f('0x3c')](_0x440f89[_0x271f('0x1b')][_0x4e7b17['id']])){_0x440f89['zohoAccounts'][_0x4e7b17['id']]=new ZohoAccount(_0x4e7b17);}else{_0x440f89[_0x271f('0x38')](_0x440f89[_0x271f('0x1b')][_0x4e7b17['id']],_0x4e7b17);}}}return _0x440f89[_0x271f('0x1b')];};};Realtime[_0x271f('0x39')]['initDeskAccounts']=function(){var _0x297fc1=this;return function(_0xe10dbb){if(_0xe10dbb){freeIsNotKey(_0xe10dbb,_0x297fc1[_0x271f('0x1c')],'id');for(var _0x3157cd=0x0,_0x404fe4={},_0x29fa61={};_0x3157cd<_0xe10dbb[_0x271f('0x3b')];_0x3157cd+=0x1){_0x404fe4=_0xe10dbb[_0x3157cd];if(_[_0x271f('0x3c')](_0x297fc1[_0x271f('0x1c')][_0x404fe4['id']])){_0x297fc1[_0x271f('0x1c')][_0x404fe4['id']]=new DeskAccount(_0x404fe4);}else{_0x297fc1[_0x271f('0x38')](_0x297fc1[_0x271f('0x1c')][_0x404fe4['id']],_0x404fe4);}}}return _0x297fc1[_0x271f('0x1c')];};};Realtime[_0x271f('0x39')][_0x271f('0x41')]=function(){var _0x2453c4=this;return function(_0xbf8f4b){if(_0xbf8f4b){freeIsNotKey(_0xbf8f4b,_0x2453c4[_0x271f('0x19')],'id');for(var _0x33ae4d=0x0,_0x3c18d9={},_0x1038ba={};_0x33ae4d<_0xbf8f4b[_0x271f('0x3b')];_0x33ae4d+=0x1){_0x3c18d9=_0xbf8f4b[_0x33ae4d];if(_[_0x271f('0x3c')](_0x2453c4[_0x271f('0x19')][_0x3c18d9['id']])){_0x2453c4[_0x271f('0x19')][_0x3c18d9['id']]=new SugarcrmAccount(_0x3c18d9);}else{_0x2453c4[_0x271f('0x38')](_0x2453c4[_0x271f('0x19')][_0x3c18d9['id']],_0x3c18d9);}}}return _0x2453c4[_0x271f('0x19')];};};Realtime['prototype'][_0x271f('0x42')]=function(){var _0x37d150=this;return function(_0x323e2a){if(_0x323e2a){freeIsNotKey(_0x323e2a,_0x37d150[_0x271f('0x43')],'id');for(var _0x75139=0x0,_0x5aa95b={},_0x20a3b5={};_0x75139<_0x323e2a['length'];_0x75139+=0x1){_0x5aa95b=_0x323e2a[_0x75139];if(_[_0x271f('0x3c')](_0x37d150[_0x271f('0x43')][_0x5aa95b['id']])){_0x37d150[_0x271f('0x43')][_0x5aa95b['id']]=new VtigerAccount(_0x5aa95b);}else{_0x37d150[_0x271f('0x38')](_0x37d150['vtigerAccounts'][_0x5aa95b['id']],_0x5aa95b);}}}return _0x37d150[_0x271f('0x43')];};};Realtime[_0x271f('0x39')][_0x271f('0x44')]=function(){var _0x545e23=this;return function(_0x472a23){if(_0x472a23){freeIsNotKey(_0x472a23,_0x545e23[_0x271f('0x1d')],'id');for(var _0x49be53=0x0,_0x3d7c0e={},_0x473794={};_0x49be53<_0x472a23['length'];_0x49be53+=0x1){_0x3d7c0e=_0x472a23[_0x49be53];if(_[_0x271f('0x3c')](_0x545e23['servicenowAccounts'][_0x3d7c0e['id']])){_0x545e23[_0x271f('0x1d')][_0x3d7c0e['id']]=new ServicenowAccount(_0x3d7c0e);}else{_0x545e23[_0x271f('0x38')](_0x545e23[_0x271f('0x1d')][_0x3d7c0e['id']],_0x3d7c0e);}}}return _0x545e23[_0x271f('0x1d')];};};Realtime[_0x271f('0x39')][_0x271f('0x45')]=function(){var _0xdd5500=this;return function(_0x4f8e9c){if(_0x4f8e9c){freeIsNotKey(_0x4f8e9c,_0xdd5500['dynamics365Accounts'],'id');for(var _0x25ba4e=0x0,_0x2cb31b={},_0x2f577c={};_0x25ba4e<_0x4f8e9c[_0x271f('0x3b')];_0x25ba4e+=0x1){_0x2cb31b=_0x4f8e9c[_0x25ba4e];if(_[_0x271f('0x3c')](_0xdd5500['dynamics365Accounts'][_0x2cb31b['id']])){_0xdd5500['dynamics365Accounts'][_0x2cb31b['id']]=new Dynamics365Account(_0x2cb31b);}else{_0xdd5500[_0x271f('0x38')](_0xdd5500['dynamics365Accounts'][_0x2cb31b['id']],_0x2cb31b);}}}return _0xdd5500[_0x271f('0x1e')];};};Realtime[_0x271f('0x39')][_0x271f('0x46')]=function(){var _0x2b52e5=this;return function(_0xc05b6b){if(_0xc05b6b){freeIsNotKey(_0xc05b6b,_0x2b52e5[_0x271f('0x47')],'id');for(var _0x57b086=0x0,_0x4772ed={},_0x3b8d9a={};_0x57b086<_0xc05b6b[_0x271f('0x3b')];_0x57b086+=0x1){_0x4772ed=_0xc05b6b[_0x57b086];if(_[_0x271f('0x3c')](_0x2b52e5[_0x271f('0x47')][_0x4772ed['id']])){_0x2b52e5[_0x271f('0x47')][_0x4772ed['id']]=new FreshsalesAccount(_0x4772ed);}else{_0x2b52e5[_0x271f('0x38')](_0x2b52e5[_0x271f('0x47')][_0x4772ed['id']],_0x4772ed);}}}return _0x2b52e5[_0x271f('0x47')];};};Realtime['prototype'][_0x271f('0x48')]=function(){var _0x34c854=this;return function(_0xbd0d05){for(var _0x183606=0x0;_0x183606<_0xbd0d05[_0x271f('0x3b')];_0x183606+=0x1){_['merge'](_0x34c854[_0x271f('0x10')][_0xbd0d05[_0x183606][_0x271f('0x23')]],_0xbd0d05[_0x183606]);}return _0x34c854[_0x271f('0x10')];};};Realtime[_0x271f('0x39')]['initVoiceQueueReports']=function(){var _0x2a2275=this;return function(_0x4e74ac){clearVoiceQueues(_0x2a2275[_0x271f('0x10')]);if(_0x4e74ac){_0x4e74ac=_[_0x271f('0x49')](_0x4e74ac,_0x271f('0x4a'));for(var _0x2643e4 in _0x4e74ac){if(_0x4e74ac[_0x271f('0x24')](_0x2643e4)){var _0x178e66={};for(var _0x58b968=0x0;_0x58b968<_0x4e74ac[_0x2643e4][_0x271f('0x3b')];_0x58b968+=0x1){var _0x336f91=_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x4b')];if(_0x2a2275[_0x271f('0x10')][_0x336f91]){if(_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x4c')]){_0x2a2275[_0x271f('0x10')][_0x336f91]['unmanaged']+=0x1;}if(_0x4e74ac[_0x2643e4][_0x58b968]['queuecallerabandon']){_0x2a2275[_0x271f('0x10')][_0x336f91][_0x271f('0x4d')]+=0x1;}_0x2a2275['voiceQueues'][_0x336f91][_0x271f('0x29')]+=moment(_0x4e74ac[_0x2643e4][_0x58b968]['queuecallerleaveAt'])[_0x271f('0x4e')](moment(_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x4f')]),_0x271f('0x50'))||0x0;if(_0x58b968===_0x4e74ac[_0x2643e4][_0x271f('0x3b')]-0x1){_0x2a2275[_0x271f('0x10')][_0x336f91][_0x271f('0x51')]+=moment(_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x52')]||_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x53')]||_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x54')])[_0x271f('0x4e')](moment(_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x4f')]),_0x271f('0x50'))||0x0;_0x2a2275['voiceQueues'][_0x336f91][_0x271f('0x27')]+=0x1;if(_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x55')]){_0x2a2275[_0x271f('0x10')][_0x336f91][_0x271f('0x28')]+=0x1;_0x2a2275['voiceQueues'][_0x336f91][_0x271f('0x2a')]+=moment(_0x4e74ac[_0x2643e4][_0x58b968][_0x271f('0x52')])[_0x271f('0x4e')](moment(_0x4e74ac[_0x2643e4][_0x58b968]['queuecallerleaveAt']),_0x271f('0x50'))||0x0;}}else{_0x2a2275[_0x271f('0x10')][_0x336f91][_0x271f('0x51')]+=_0x2a2275['voiceQueues'][_0x336f91][_0x271f('0x29')]||0x0;}}}}}}return _0x2a2275[_0x271f('0x10')];};};Realtime[_0x271f('0x39')]['initVoiceCallReports']=function(){var _0x3f4ce0=this;return function(_0x15edfe){clearVoiceCallReports(_0x3f4ce0[_0x271f('0x13')]);if(_0x15edfe){for(var _0x4e1255=0x0;_0x4e1255<_0x15edfe['length'];_0x4e1255+=0x1){_0x3f4ce0[_0x271f('0x13')][_0x271f('0x27')]+=0x1;_0x3f4ce0[_0x271f('0x13')][_0x271f('0x51')]+=_0x15edfe[_0x4e1255]['duration'];if(_0x15edfe[_0x4e1255][_0x271f('0x56')]===_0x271f('0x57')){_0x3f4ce0[_0x271f('0x13')][_0x271f('0x28')]+=0x1;_0x3f4ce0[_0x271f('0x13')][_0x271f('0x29')]+=_0x15edfe[_0x4e1255][_0x271f('0x58')]-_0x15edfe[_0x4e1255][_0x271f('0x59')]||0x0;_0x3f4ce0[_0x271f('0x13')][_0x271f('0x2a')]+=_0x15edfe[_0x4e1255][_0x271f('0x59')];}}}return _0x3f4ce0['outbound'];};};Realtime[_0x271f('0x39')]['initCampaigns']=function(){var _0x3f1549=this;return function(_0x515356){if(_0x515356){freeIsNotKey(_0x515356,_0x3f1549['campaigns'],_0x271f('0x23'));for(var _0x4f9fb0=0x0,_0x2c3ea7={};_0x4f9fb0<_0x515356[_0x271f('0x3b')];_0x4f9fb0+=0x1){_0x2c3ea7=_0x515356[_0x4f9fb0];if(_['isUndefined'](_0x3f1549[_0x271f('0x5a')][_0x2c3ea7[_0x271f('0x23')]])){_0x3f1549[_0x271f('0x5a')][_0x2c3ea7[_0x271f('0x23')]]=new Campaign(_0x2c3ea7);}else{_0x3f1549[_0x271f('0x38')](_0x3f1549['campaigns'][_0x2c3ea7['name']],_0x2c3ea7);_0x3f1549['campaigns'][_0x2c3ea7[_0x271f('0x23')]][_0x271f('0x5b')]=_0x2c3ea7[_0x271f('0x5c')]?_0x2c3ea7['SquareProject'][_0x271f('0x23')]:undefined;}}}return _0x3f1549[_0x271f('0x5a')];};};Realtime[_0x271f('0x39')][_0x271f('0x5d')]=function(){var _0x526fc9=this;return function(_0x2c27fe){if(_0x2c27fe){freeIsNotKey(_0x2c27fe,_0x526fc9['voiceExtensions'],'id');for(var _0x3416cf=0x0,_0x24a011={};_0x3416cf<_0x2c27fe['length'];_0x3416cf+=0x1){_0x24a011=_0x2c27fe[_0x3416cf];if(_[_0x271f('0x3c')](_0x526fc9[_0x271f('0x14')][_0x24a011['id']])){_0x526fc9[_0x271f('0x14')][_0x24a011['id']]=new VoiceExtension(_0x24a011);}else{_0x526fc9['mergeFromDatabase'](_0x526fc9['voiceExtensions'][_0x24a011['id']],_0x24a011);}}}return _0x526fc9[_0x271f('0x14')];};};Realtime[_0x271f('0x39')][_0x271f('0x5e')]=function(){var _0xe8248a=this;return function(_0x4c7e7a){clearCampaigns(_0xe8248a[_0x271f('0x5a')]);for(var _0x58c270=0x0;_0x58c270<_0x4c7e7a['length'];_0x58c270+=0x1){_['merge'](_0xe8248a[_0x271f('0x5a')][_0x4c7e7a[_0x58c270]['name']],_0x4c7e7a[_0x58c270]);}return _0xe8248a['campaigns'];};};Realtime[_0x271f('0x39')][_0x271f('0x5f')]=function(){var _0x218a8e=this;return function(_0x4e3e72){if(_0x4e3e72){freeIsNotKey(_0x4e3e72,_0x218a8e[_0x271f('0x1f')],'id');for(var _0xa3a718=0x0,_0x5273e6={},_0xe83f8e={};_0xa3a718<_0x4e3e72[_0x271f('0x3b')];_0xa3a718+=0x1){_0x5273e6=_0x4e3e72[_0xa3a718];if(_[_0x271f('0x3c')](_0x218a8e['faxAccounts'][_0x5273e6['id']])){_0x218a8e[_0x271f('0x1f')][_0x5273e6['id']]=new FaxAccount(_0x5273e6);}else{_0x218a8e[_0x271f('0x38')](_0x218a8e[_0x271f('0x1f')][_0x5273e6['id']],_0x5273e6);}}}return _0x218a8e['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x2a0d=['deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','mapKeys','isNil','interface','name','answered','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initAgents','isUndefined','initTelephones','initTrunks','length','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','total','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','exports','bluebird','util','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts'];(function(_0x1ec181,_0x38eebc){var _0x396655=function(_0x192b19){while(--_0x192b19){_0x1ec181['push'](_0x1ec181['shift']());}};_0x396655(++_0x38eebc);}(_0x2a0d,0x187));var _0xd2a0=function(_0x106e66,_0x2fed6a){_0x106e66=_0x106e66-0x0;var _0x4c98ba=_0x2a0d[_0x106e66];return _0x4c98ba;};'use strict';var BPromise=require(_0xd2a0('0x0'));var util=require(_0xd2a0('0x1'));var _=require('lodash');var moment=require(_0xd2a0('0x2'));var Agent=require(_0xd2a0('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xd2a0('0x4'));var Trigger=require(_0xd2a0('0x5'));var Template=require(_0xd2a0('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xd2a0('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xd2a0('0x8'));var FreshdeskAccount=require(_0xd2a0('0x9'));var SugarcrmAccount=require(_0xd2a0('0xa'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xd2a0('0xb'));var VtigerAccount=require(_0xd2a0('0xc'));var ServicenowAccount=require(_0xd2a0('0xd'));var Dynamics365Account=require(_0xd2a0('0xe'));var FreshsalesAccount=require(_0xd2a0('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xd2a0('0x10')]={};this[_0xd2a0('0x11')]={};this[_0xd2a0('0x12')]={};this[_0xd2a0('0x13')]={};this[_0xd2a0('0x14')]={};this[_0xd2a0('0x15')]={};this[_0xd2a0('0x16')]={};this[_0xd2a0('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd2a0('0x18')]={};this[_0xd2a0('0x19')]={};this['queueChannels']={};this[_0xd2a0('0x1a')]={};this['timers']={};this[_0xd2a0('0x1b')]={};this[_0xd2a0('0x1c')]={};this[_0xd2a0('0x1d')]={};this[_0xd2a0('0x1e')]={};this[_0xd2a0('0x1f')]={};this[_0xd2a0('0x20')]={};this[_0xd2a0('0x21')]={};this['vtigerAccounts']={};this[_0xd2a0('0x22')]={};this[_0xd2a0('0x23')]={};this[_0xd2a0('0x24')]={};this[_0xd2a0('0x25')]={};};function freeIsNotKey(_0x513876,_0x43dac2,_0x2e9e12){var _0x513dd5=_['mapKeys'](_0x513876,function(_0x4f5e64,_0x822b3b){return _0x4f5e64[_0x2e9e12];});for(var _0x8e83cc in _0x43dac2){if(_0x43dac2[_0xd2a0('0x26')](_0x8e83cc)){if(!_0x513dd5[_0x8e83cc]){delete _0x43dac2[_0x8e83cc];}}}}function freeIsNotKeySip(_0x565599,_0x4e941f){var _0x52054c=_['mapKeys'](_0x565599,function(_0x4e3f94,_0xba2e1e){return util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x4e3f94['name']);});for(var _0x54dd25 in _0x4e941f){if(_0x4e941f[_0xd2a0('0x26')](_0x54dd25)){if(!_0x52054c[_0x54dd25]){delete _0x4e941f[_0x54dd25];}}}}function freeIsNotKeyAgent(_0x120007,_0x2f8019){var _0xd1dc41=_[_0xd2a0('0x29')](_0x120007,function(_0x1a6721,_0x4e5775){var _0x2c5020=_[_0xd2a0('0x2a')](_0x1a6721[_0xd2a0('0x2b')])?util['format'](_0xd2a0('0x28'),_0x1a6721[_0xd2a0('0x2c')]):_0x1a6721[_0xd2a0('0x2b')];return _0x2c5020;});for(var _0x5c587d in _0x2f8019){if(_0x2f8019[_0xd2a0('0x26')](_0x5c587d)){if(!_0xd1dc41[_0x5c587d]){delete _0x2f8019[_0x5c587d];}}}}function clearVoiceCallReports(_0x3264f7){_0x3264f7['total']=0x0;_0x3264f7[_0xd2a0('0x2d')]=0x0;_0x3264f7[_0xd2a0('0x2e')]=0x0;_0x3264f7[_0xd2a0('0x2f')]=0x0;_0x3264f7['sumBillable']=0x0;}function clearCampaigns(_0xc9e069){if(!_[_0xd2a0('0x30')](_0xc9e069)){for(var _0x1be2d3 in _0xc9e069){if(_0xc9e069[_0xd2a0('0x26')](_0x1be2d3)){_0xc9e069[_0x1be2d3]['ivrTotalCallsDays']=0x0;_0xc9e069[_0x1be2d3][_0xd2a0('0x31')]=0x0;}}}}function clearVoiceQueues(_0xb30fc9){if(!_[_0xd2a0('0x30')](_0xb30fc9)){for(var _0x51c164 in _0xb30fc9){if(_0xb30fc9[_0xd2a0('0x26')](_0x51c164)){_0xb30fc9[_0x51c164]['total']=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x2d')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x32')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x33')]=0x0;_0xb30fc9[_0x51c164]['sumHoldTime']=0x0;_0xb30fc9[_0x51c164]['sumDuration']=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x34')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x35')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x36')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x37')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x38')]=0x0;_0xb30fc9[_0x51c164]['outboundNoSuchCallsDay']=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x39')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3a')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3b')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3c')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3d')]=0x0;_0xb30fc9[_0x51c164]['outboundRejectCallsDay']=0x0;_0xb30fc9[_0x51c164]['outboundReCallsDay']=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x35')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3e')]=0x0;_0xb30fc9[_0x51c164]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0xd2a0('0x3f')]=function(_0x3def7f,_0x236063){for(var _0x4c0f6c in _0x236063){if(_0x3def7f[_0xd2a0('0x26')](_0x4c0f6c)){_0x3def7f[_0x4c0f6c]=_0x236063[_0x4c0f6c];}}};Realtime[_0xd2a0('0x40')][_0xd2a0('0x41')]=function(){var _0x867d56=this;return function(_0x1bc44d){if(_0x1bc44d){freeIsNotKeyAgent(_0x1bc44d,_0x867d56[_0xd2a0('0x10')]);for(var _0x3f3d2e=0x0,_0x336426={},_0xfcc324={};_0x3f3d2e<_0x1bc44d['length'];_0x3f3d2e+=0x1){_0x336426=_0x1bc44d[_0x3f3d2e];var _0x24500b=_[_0xd2a0('0x2a')](_0x336426[_0xd2a0('0x2b')])?util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x336426['name']):_0x336426['interface'];if(_[_0xd2a0('0x42')](_0x867d56[_0xd2a0('0x10')][_0x24500b])){_0x867d56['agents'][_0x24500b]=new Agent(_0x336426);}else{_0x867d56['mergeFromDatabase'](_0x867d56[_0xd2a0('0x10')][_0x24500b],_0x336426);}}}return _0x867d56[_0xd2a0('0x10')];};};Realtime['prototype'][_0xd2a0('0x43')]=function(){var _0x3aa186=this;return function(_0x18a519){if(_0x18a519){freeIsNotKeySip(_0x18a519,_0x3aa186[_0xd2a0('0x11')]);for(var _0x5bda34=0x0,_0x35aa29={},_0x3b3eed={};_0x5bda34<_0x18a519['length'];_0x5bda34+=0x1){_0x35aa29=_0x18a519[_0x5bda34];if(_['isUndefined'](_0x3aa186[_0xd2a0('0x11')][util[_0xd2a0('0x27')]('SIP/%s',_0x35aa29[_0xd2a0('0x2c')])])){_0x3aa186[_0xd2a0('0x11')][util[_0xd2a0('0x27')]('SIP/%s',_0x35aa29[_0xd2a0('0x2c')])]=new Telephone(_0x35aa29);}else{_0x3aa186[_0xd2a0('0x3f')](_0x3aa186[_0xd2a0('0x11')][util[_0xd2a0('0x27')]('SIP/%s',_0x35aa29['name'])],_0x35aa29);}}}return _0x3aa186['telephones'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x44')]=function(){var _0x25e0bb=this;return function(_0x19980c){if(_0x19980c){freeIsNotKeySip(_0x19980c,_0x25e0bb[_0xd2a0('0x12')]);for(var _0x19ea03=0x0,_0x4511a1={},_0x430045={};_0x19ea03<_0x19980c[_0xd2a0('0x45')];_0x19ea03+=0x1){_0x4511a1=_0x19980c[_0x19ea03];if(_[_0xd2a0('0x42')](_0x25e0bb['trunks'][util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x4511a1['name'])])){_0x25e0bb[_0xd2a0('0x12')][util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x4511a1[_0xd2a0('0x2c')])]=new Trunk(_0x4511a1);}else{_0x25e0bb[_0xd2a0('0x3f')](_0x25e0bb[_0xd2a0('0x12')][util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x4511a1[_0xd2a0('0x2c')])],_0x4511a1);}}}return _0x25e0bb[_0xd2a0('0x12')];};};Realtime[_0xd2a0('0x40')]['initVoiceQueues']=function(){var _0x4b86c2=this;return function(_0x247ac0){if(_0x247ac0){freeIsNotKey(_0x247ac0,_0x4b86c2[_0xd2a0('0x13')],'name');for(var _0x11b8a9=0x0,_0x74bdaf={},_0x793769={};_0x11b8a9<_0x247ac0[_0xd2a0('0x45')];_0x11b8a9+=0x1){_0x74bdaf=_0x247ac0[_0x11b8a9];if(_[_0xd2a0('0x42')](_0x4b86c2[_0xd2a0('0x13')][_0x74bdaf[_0xd2a0('0x2c')]])){_0x4b86c2[_0xd2a0('0x13')][_0x74bdaf[_0xd2a0('0x2c')]]=new VoiceQueue(_0x74bdaf);}else{_0x4b86c2[_0xd2a0('0x3f')](_0x4b86c2['voiceQueues'][_0x74bdaf['name']],_0x74bdaf);}}}return _0x4b86c2[_0xd2a0('0x13')];};};Realtime['prototype'][_0xd2a0('0x46')]=function(){var _0x31b7f3=this;return function(_0x50f12d){if(_0x50f12d){freeIsNotKey(_0x50f12d,_0x31b7f3['triggers'],'id');for(var _0x270ba6=0x0,_0x21e240={},_0x21c97a={};_0x270ba6<_0x50f12d['length'];_0x270ba6+=0x1){_0x21e240=_0x50f12d[_0x270ba6];if(_[_0xd2a0('0x42')](_0x31b7f3[_0xd2a0('0x14')][_0x21e240['id']])){_0x31b7f3['triggers'][_0x21e240['id']]=new Trigger(_0x21e240);}else{_0x31b7f3[_0xd2a0('0x3f')](_0x31b7f3[_0xd2a0('0x14')][_0x21e240['id']],_0x21e240);}}}return _0x31b7f3['triggers'];};};Realtime['prototype'][_0xd2a0('0x47')]=function(){var _0xda1387=this;return function(_0xdd8358){if(_0xdd8358){freeIsNotKey(_0xdd8358,_0xda1387[_0xd2a0('0x16')],'id');for(var _0x1b9802=0x0,_0x342160={},_0xb1df23={};_0x1b9802<_0xdd8358[_0xd2a0('0x45')];_0x1b9802+=0x1){_0x342160=_0xdd8358[_0x1b9802];if(_[_0xd2a0('0x42')](_0xda1387[_0xd2a0('0x16')][_0x342160['id']])){_0xda1387[_0xd2a0('0x16')][_0x342160['id']]=new Template(_0x342160);}else{_0xda1387[_0xd2a0('0x3f')](_0xda1387['templates'][_0x342160['id']],_0x342160);}}}return _0xda1387[_0xd2a0('0x16')];};};Realtime['prototype'][_0xd2a0('0x48')]=function(){var _0x144de7=this;return function(_0x33b4f7){if(_0x33b4f7){freeIsNotKey(_0x33b4f7,_0x144de7['zendeskAccounts'],'id');for(var _0x5af954=0x0,_0x1c8505={},_0x49fb7a={};_0x5af954<_0x33b4f7[_0xd2a0('0x45')];_0x5af954+=0x1){_0x1c8505=_0x33b4f7[_0x5af954];if(_[_0xd2a0('0x42')](_0x144de7[_0xd2a0('0x1c')][_0x1c8505['id']])){_0x144de7[_0xd2a0('0x1c')][_0x1c8505['id']]=new ZendeskAccount(_0x1c8505);}else{_0x144de7['mergeFromDatabase'](_0x144de7[_0xd2a0('0x1c')][_0x1c8505['id']],_0x1c8505);}}}return _0x144de7[_0xd2a0('0x1c')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x49')]=function(){var _0x233f2b=this;return function(_0xbdc281){if(_0xbdc281){freeIsNotKey(_0xbdc281,_0x233f2b[_0xd2a0('0x1d')],'id');for(var _0x1bb8ae=0x0,_0x3fa584={},_0x57f4e3={};_0x1bb8ae<_0xbdc281['length'];_0x1bb8ae+=0x1){_0x3fa584=_0xbdc281[_0x1bb8ae];if(_[_0xd2a0('0x42')](_0x233f2b[_0xd2a0('0x1d')][_0x3fa584['id']])){_0x233f2b[_0xd2a0('0x1d')][_0x3fa584['id']]=new SalesforceAccount(_0x3fa584);}else{_0x233f2b[_0xd2a0('0x3f')](_0x233f2b['salesforceAccounts'][_0x3fa584['id']],_0x3fa584);}}}return _0x233f2b[_0xd2a0('0x1d')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4a')]=function(){var _0x163cd2=this;return function(_0x226336){if(_0x226336){freeIsNotKey(_0x226336,_0x163cd2['freshdeskAccounts'],'id');for(var _0x24da85=0x0,_0x396e4d={},_0x126782={};_0x24da85<_0x226336[_0xd2a0('0x45')];_0x24da85+=0x1){_0x396e4d=_0x226336[_0x24da85];if(_['isUndefined'](_0x163cd2['freshdeskAccounts'][_0x396e4d['id']])){_0x163cd2[_0xd2a0('0x1f')][_0x396e4d['id']]=new FreshdeskAccount(_0x396e4d);}else{_0x163cd2['mergeFromDatabase'](_0x163cd2['freshdeskAccounts'][_0x396e4d['id']],_0x396e4d);}}}return _0x163cd2[_0xd2a0('0x1f')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4b')]=function(){var _0x17de85=this;return function(_0x2afdd4){if(_0x2afdd4){freeIsNotKey(_0x2afdd4,_0x17de85[_0xd2a0('0x20')],'id');for(var _0x362ed0=0x0,_0x34348e={},_0x324412={};_0x362ed0<_0x2afdd4[_0xd2a0('0x45')];_0x362ed0+=0x1){_0x34348e=_0x2afdd4[_0x362ed0];if(_[_0xd2a0('0x42')](_0x17de85[_0xd2a0('0x20')][_0x34348e['id']])){_0x17de85[_0xd2a0('0x20')][_0x34348e['id']]=new ZohoAccount(_0x34348e);}else{_0x17de85[_0xd2a0('0x3f')](_0x17de85[_0xd2a0('0x20')][_0x34348e['id']],_0x34348e);}}}return _0x17de85[_0xd2a0('0x20')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4c')]=function(){var _0x49c7eb=this;return function(_0x4b1421){if(_0x4b1421){freeIsNotKey(_0x4b1421,_0x49c7eb['deskAccounts'],'id');for(var _0x112370=0x0,_0x5eac07={},_0x14f915={};_0x112370<_0x4b1421['length'];_0x112370+=0x1){_0x5eac07=_0x4b1421[_0x112370];if(_[_0xd2a0('0x42')](_0x49c7eb[_0xd2a0('0x21')][_0x5eac07['id']])){_0x49c7eb[_0xd2a0('0x21')][_0x5eac07['id']]=new DeskAccount(_0x5eac07);}else{_0x49c7eb[_0xd2a0('0x3f')](_0x49c7eb['deskAccounts'][_0x5eac07['id']],_0x5eac07);}}}return _0x49c7eb['deskAccounts'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4d')]=function(){var _0x406e36=this;return function(_0x3dc61e){if(_0x3dc61e){freeIsNotKey(_0x3dc61e,_0x406e36['sugarcrmAccounts'],'id');for(var _0x335d1a=0x0,_0x1bb20d={},_0x4c1798={};_0x335d1a<_0x3dc61e[_0xd2a0('0x45')];_0x335d1a+=0x1){_0x1bb20d=_0x3dc61e[_0x335d1a];if(_['isUndefined'](_0x406e36['sugarcrmAccounts'][_0x1bb20d['id']])){_0x406e36['sugarcrmAccounts'][_0x1bb20d['id']]=new SugarcrmAccount(_0x1bb20d);}else{_0x406e36[_0xd2a0('0x3f')](_0x406e36[_0xd2a0('0x1e')][_0x1bb20d['id']],_0x1bb20d);}}}return _0x406e36[_0xd2a0('0x1e')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4e')]=function(){var _0x272384=this;return function(_0x5cad1b){if(_0x5cad1b){freeIsNotKey(_0x5cad1b,_0x272384[_0xd2a0('0x4f')],'id');for(var _0x32ed38=0x0,_0x3862af={},_0x16ad86={};_0x32ed38<_0x5cad1b[_0xd2a0('0x45')];_0x32ed38+=0x1){_0x3862af=_0x5cad1b[_0x32ed38];if(_[_0xd2a0('0x42')](_0x272384['vtigerAccounts'][_0x3862af['id']])){_0x272384[_0xd2a0('0x4f')][_0x3862af['id']]=new VtigerAccount(_0x3862af);}else{_0x272384[_0xd2a0('0x3f')](_0x272384['vtigerAccounts'][_0x3862af['id']],_0x3862af);}}}return _0x272384[_0xd2a0('0x4f')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x50')]=function(){var _0x5d4862=this;return function(_0x18f512){if(_0x18f512){freeIsNotKey(_0x18f512,_0x5d4862[_0xd2a0('0x22')],'id');for(var _0x2d0ca6=0x0,_0x179cc5={},_0x6e361f={};_0x2d0ca6<_0x18f512[_0xd2a0('0x45')];_0x2d0ca6+=0x1){_0x179cc5=_0x18f512[_0x2d0ca6];if(_[_0xd2a0('0x42')](_0x5d4862[_0xd2a0('0x22')][_0x179cc5['id']])){_0x5d4862['servicenowAccounts'][_0x179cc5['id']]=new ServicenowAccount(_0x179cc5);}else{_0x5d4862[_0xd2a0('0x3f')](_0x5d4862[_0xd2a0('0x22')][_0x179cc5['id']],_0x179cc5);}}}return _0x5d4862[_0xd2a0('0x22')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x3dd196=this;return function(_0x33f47b){if(_0x33f47b){freeIsNotKey(_0x33f47b,_0x3dd196[_0xd2a0('0x23')],'id');for(var _0xcb5ddf=0x0,_0x309ad2={},_0x3bfe2c={};_0xcb5ddf<_0x33f47b[_0xd2a0('0x45')];_0xcb5ddf+=0x1){_0x309ad2=_0x33f47b[_0xcb5ddf];if(_[_0xd2a0('0x42')](_0x3dd196['dynamics365Accounts'][_0x309ad2['id']])){_0x3dd196[_0xd2a0('0x23')][_0x309ad2['id']]=new Dynamics365Account(_0x309ad2);}else{_0x3dd196[_0xd2a0('0x3f')](_0x3dd196['dynamics365Accounts'][_0x309ad2['id']],_0x309ad2);}}}return _0x3dd196['dynamics365Accounts'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x51')]=function(){var _0xe6966f=this;return function(_0xd8e13b){if(_0xd8e13b){freeIsNotKey(_0xd8e13b,_0xe6966f['freshsalesAccounts'],'id');for(var _0x80cc34=0x0,_0x3d3921={},_0x4704c6={};_0x80cc34<_0xd8e13b[_0xd2a0('0x45')];_0x80cc34+=0x1){_0x3d3921=_0xd8e13b[_0x80cc34];if(_['isUndefined'](_0xe6966f[_0xd2a0('0x24')][_0x3d3921['id']])){_0xe6966f[_0xd2a0('0x24')][_0x3d3921['id']]=new FreshsalesAccount(_0x3d3921);}else{_0xe6966f[_0xd2a0('0x3f')](_0xe6966f['freshsalesAccounts'][_0x3d3921['id']],_0x3d3921);}}}return _0xe6966f[_0xd2a0('0x24')];};};Realtime[_0xd2a0('0x40')]['initVoiceQueueHopperHistory']=function(){var _0x49d3b3=this;return function(_0x2a8f3a){for(var _0x59989c=0x0;_0x59989c<_0x2a8f3a[_0xd2a0('0x45')];_0x59989c+=0x1){_[_0xd2a0('0x52')](_0x49d3b3[_0xd2a0('0x13')][_0x2a8f3a[_0x59989c][_0xd2a0('0x2c')]],_0x2a8f3a[_0x59989c]);}return _0x49d3b3['voiceQueues'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x53')]=function(){var _0x4fc7a6=this;return function(_0x11a340){clearVoiceQueues(_0x4fc7a6['voiceQueues']);if(_0x11a340){_0x11a340=_[_0xd2a0('0x54')](_0x11a340,_0xd2a0('0x55'));for(var _0x2a73df in _0x11a340){if(_0x11a340['hasOwnProperty'](_0x2a73df)){var _0x1a8a61={};for(var _0x2cba3a=0x0;_0x2cba3a<_0x11a340[_0x2a73df][_0xd2a0('0x45')];_0x2cba3a+=0x1){var _0x5dbbbc=_0x11a340[_0x2a73df][_0x2cba3a]['queue'];if(_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]){if(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x56')]){_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x32')]+=0x1;}if(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x57')]){_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x33')]+=0x1;}_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]['sumHoldTime']+=moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x58')])[_0xd2a0('0x59')](moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5a')]),_0xd2a0('0x5b'))||0x0;if(_0x2cba3a===_0x11a340[_0x2a73df][_0xd2a0('0x45')]-0x1){_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x2f')]+=moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5c')]||_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5d')]||_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5e')])['diff'](moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5a')]),'seconds')||0x0;_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]['total']+=0x1;if(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5f')]){_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x2d')]+=0x1;_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x34')]+=moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5c')])[_0xd2a0('0x59')](moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x58')]),'seconds')||0x0;}}else{_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]['sumDuration']+=_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]['sumHoldTime']||0x0;}}}}}}return _0x4fc7a6[_0xd2a0('0x13')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x60')]=function(){var _0x19468e=this;return function(_0x34cbc2){clearVoiceCallReports(_0x19468e[_0xd2a0('0x17')]);if(_0x34cbc2){for(var _0xebec09=0x0;_0xebec09<_0x34cbc2['length'];_0xebec09+=0x1){_0x19468e[_0xd2a0('0x17')][_0xd2a0('0x61')]+=0x1;_0x19468e[_0xd2a0('0x17')][_0xd2a0('0x2f')]+=_0x34cbc2[_0xebec09][_0xd2a0('0x62')];if(_0x34cbc2[_0xebec09][_0xd2a0('0x63')]===_0xd2a0('0x64')){_0x19468e[_0xd2a0('0x17')][_0xd2a0('0x2d')]+=0x1;_0x19468e[_0xd2a0('0x17')][_0xd2a0('0x2e')]+=_0x34cbc2[_0xebec09][_0xd2a0('0x62')]-_0x34cbc2[_0xebec09]['billableseconds']||0x0;_0x19468e[_0xd2a0('0x17')]['sumBillable']+=_0x34cbc2[_0xebec09]['billableseconds'];}}}return _0x19468e[_0xd2a0('0x17')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x65')]=function(){var _0x240966=this;return function(_0x1bda9e){if(_0x1bda9e){freeIsNotKey(_0x1bda9e,_0x240966[_0xd2a0('0x15')],_0xd2a0('0x2c'));for(var _0x47ae96=0x0,_0x4ccd9a={};_0x47ae96<_0x1bda9e[_0xd2a0('0x45')];_0x47ae96+=0x1){_0x4ccd9a=_0x1bda9e[_0x47ae96];if(_['isUndefined'](_0x240966[_0xd2a0('0x15')][_0x4ccd9a[_0xd2a0('0x2c')]])){_0x240966[_0xd2a0('0x15')][_0x4ccd9a[_0xd2a0('0x2c')]]=new Campaign(_0x4ccd9a);}else{_0x240966[_0xd2a0('0x3f')](_0x240966[_0xd2a0('0x15')][_0x4ccd9a[_0xd2a0('0x2c')]],_0x4ccd9a);_0x240966[_0xd2a0('0x15')][_0x4ccd9a[_0xd2a0('0x2c')]][_0xd2a0('0x66')]=_0x4ccd9a[_0xd2a0('0x67')]?_0x4ccd9a[_0xd2a0('0x67')][_0xd2a0('0x2c')]:undefined;}}}return _0x240966['campaigns'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x68')]=function(){var _0x5c49a9=this;return function(_0x4cd748){if(_0x4cd748){freeIsNotKey(_0x4cd748,_0x5c49a9[_0xd2a0('0x18')],'id');for(var _0x4088f1=0x0,_0x464cc0={};_0x4088f1<_0x4cd748[_0xd2a0('0x45')];_0x4088f1+=0x1){_0x464cc0=_0x4cd748[_0x4088f1];if(_['isUndefined'](_0x5c49a9[_0xd2a0('0x18')][_0x464cc0['id']])){_0x5c49a9[_0xd2a0('0x18')][_0x464cc0['id']]=new VoiceExtension(_0x464cc0);}else{_0x5c49a9['mergeFromDatabase'](_0x5c49a9[_0xd2a0('0x18')][_0x464cc0['id']],_0x464cc0);}}}return _0x5c49a9[_0xd2a0('0x18')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x325763=this;return function(_0x5daadc){clearCampaigns(_0x325763[_0xd2a0('0x15')]);for(var _0x6e2f2f=0x0;_0x6e2f2f<_0x5daadc[_0xd2a0('0x45')];_0x6e2f2f+=0x1){_[_0xd2a0('0x52')](_0x325763[_0xd2a0('0x15')][_0x5daadc[_0x6e2f2f][_0xd2a0('0x2c')]],_0x5daadc[_0x6e2f2f]);}return _0x325763[_0xd2a0('0x15')];};};Realtime[_0xd2a0('0x40')]['initFaxAccounts']=function(){var _0x3bdd4a=this;return function(_0x13e66b){if(_0x13e66b){freeIsNotKey(_0x13e66b,_0x3bdd4a[_0xd2a0('0x25')],'id');for(var _0x26514f=0x0,_0x528f08={},_0x1578d4={};_0x26514f<_0x13e66b[_0xd2a0('0x45')];_0x26514f+=0x1){_0x528f08=_0x13e66b[_0x26514f];if(_[_0xd2a0('0x42')](_0x3bdd4a['faxAccounts'][_0x528f08['id']])){_0x3bdd4a[_0xd2a0('0x25')][_0x528f08['id']]=new FaxAccount(_0x528f08);}else{_0x3bdd4a[_0xd2a0('0x3f')](_0x3bdd4a['faxAccounts'][_0x528f08['id']],_0x528f08);}}}return _0x3bdd4a[_0xd2a0('0x25')];};};module[_0xd2a0('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f148ff6..1c4cea2 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 _0x3f68=['custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','format','voiceQueueReport','length','lastAssignedTo','interface','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','channel','split','calleridnum','internal','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','monitors','filename','createdAt','connectedlinenum','connectedlinename','isArray','startsWith','Local','substring','mobile','indexOf','lastIndexOf','transfererlinkedid','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','custom:voiceQueueReport','bind'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3f68,0x157));var _0x83f6=function(_0x75713c,_0x1266ae){_0x75713c=_0x75713c-0x0;var _0x4e668c=_0x3f68[_0x75713c];return _0x4e668c;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x83f6('0x0'));var config=require(_0x83f6('0x1'));var ami=require(_0x83f6('0x2'));var RpcVoiceAgentReport=require(_0x83f6('0x3'));var RpcVoiceCallReport=require(_0x83f6('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x83f6('0x5'));var RpcVoiceQueueReport=require(_0x83f6('0x6'));var RpcVoiceRecording=require(_0x83f6('0x7'));var RpcVoiceTransferReport=require(_0x83f6('0x8'));var VoiceQueueReport=require(_0x83f6('0x9'));var VoiceCallReport=require(_0x83f6('0xa'));var VoiceAgentReport=require(_0x83f6('0xb'));var VoiceDialReport=require(_0x83f6('0xc'));var UserReport=require(_0x83f6('0xd'));function Report(_0x30572f){this[_0x83f6('0xe')]=_0x30572f;this[_0x83f6('0xf')]=_0x30572f[_0x83f6('0xf')];this[_0x83f6('0x10')]=_0x30572f['telephones'];}Report[_0x83f6('0x11')]['sync']=function(_0x2c74d2){var _0xfb4f63=new VoiceQueueReport(this['realtime']);var _0x416d8b=new VoiceAgentReport(this[_0x83f6('0xe')]);var _0x38309b=new VoiceDialReport(this[_0x83f6('0xe')]);var _0x5e563e=new VoiceCallReport(this['realtime']);var _0xde4f58=new UserReport(this[_0x83f6('0xe')]);if(config[_0x83f6('0x12')]&&config['xdr']['disabled']){ami['on'](_0x83f6('0x13'),this['voiceQueueReport'][_0x83f6('0x14')](this));ami['on'](_0x83f6('0x15'),this['voiceCallReport'][_0x83f6('0x14')](this));ami['on'](_0x83f6('0x16'),this[_0x83f6('0x17')][_0x83f6('0x14')](this));ami['on'](_0x83f6('0x18'),this[_0x83f6('0x19')][_0x83f6('0x14')](this));ami['on'](_0x83f6('0x1a'),this[_0x83f6('0x1b')][_0x83f6('0x14')](this));ami['on']('attendedtransfer',this[_0x83f6('0x1c')]['bind'](this));}};Report[_0x83f6('0x11')][_0x83f6('0x1d')]=function(_0x5d9566){var _0x5c18c;_0x5c18c=_[_0x83f6('0x1e')](this[_0x83f6('0xf')],function(_0x4ac612){return _0x4ac612[_0x83f6('0x1f')]==_0x5d9566||_0x4ac612['name']==_0x5d9566;});if(_[_0x83f6('0x20')](_0x5c18c)){var _0x1b3f86=_[_0x83f6('0x1e')](this['telephones'],function(_0x46af10){return _0x46af10[_0x83f6('0x1f')]==_0x5d9566||_0x46af10[_0x83f6('0x21')]==_0x5d9566;});if(_0x1b3f86){_0x5c18c=_['find'](this['agents'],function(_0x1662d0){return _0x1662d0['interface']==util[_0x83f6('0x22')]('SIP/%s',_0x1b3f86['name']);});}}return _0x5c18c;};Report[_0x83f6('0x11')][_0x83f6('0x23')]=function(_0x1fb480){for(var _0xd1b32c=0x0;_0xd1b32c<_0x1fb480[_0x83f6('0x24')];_0xd1b32c+=0x1){var _0x58dfaa=this[_0x83f6('0x1d')](_0x1fb480[_0xd1b32c]['connectedlinenum']);if(_0x58dfaa){_0x1fb480[_0xd1b32c][_0x83f6('0x1f')]=_0x58dfaa[_0x83f6('0x1f')];_0x1fb480[_0xd1b32c]['assigned']=!![];_0x1fb480[_0xd1b32c][_0x83f6('0x25')]=_0x58dfaa[_0x83f6('0x21')];_0x1fb480[_0xd1b32c][_0x83f6('0x26')]=_[_0x83f6('0x20')](_0x58dfaa['interface'])?util[_0x83f6('0x22')](_0x83f6('0x27'),_0x58dfaa[_0x83f6('0x21')]):_0x58dfaa[_0x83f6('0x26')];if(_0x1fb480[_0xd1b32c][_0x83f6('0x28')]){_0x1fb480[_0xd1b32c][_0x83f6('0x29')]=moment()[_0x83f6('0x22')](_0x83f6('0x2a'));}if(_0x1fb480[_0xd1b32c][_0x83f6('0x2b')]){_0x1fb480[_0xd1b32c][_0x83f6('0x2c')]=moment()[_0x83f6('0x22')](_0x83f6('0x2a'));}RpcMemberReport[_0x83f6('0x23')](_0x1fb480[_0xd1b32c]);}RpcVoiceQueueReport[_0x83f6('0x2d')](_0x1fb480[_0xd1b32c]);}};function extractCalleridNumber(_0x5eb09e){var _0x3f9940=_0x5eb09e['match'](/<(.*?)>/);return _0x3f9940?_0x3f9940[0x1]:_0x5eb09e;}Report[_0x83f6('0x11')][_0x83f6('0x2e')]=function(_0x259043){for(var _0x46db8b=0x0;_0x46db8b/);return _0x2a2725?_0x2a2725[0x1]:_0x1264b6;}Report[_0x904c('0x10')][_0x904c('0x2d')]=function(_0x37e99f){for(var _0x1de335=0x0;_0x1de335',_0xf0c0f8['calleridname'],_0xf0c0f8[_0x904c('0x3d')]);}if(RpcVoiceTransferReport['transfers'][_0xf0c0f8[_0x904c('0x42')]]){var _0x3a1824=RpcVoiceTransferReport[_0x904c('0x43')][_0xf0c0f8[_0x904c('0x42')]];_0x3a1824[_0x904c('0x44')]=_0xf0c0f8[_0x904c('0x45')];RpcVoiceTransferReport[_0x904c('0x46')](_0x3a1824);delete RpcVoiceTransferReport['transfers'][_0xf0c0f8[_0x904c('0x42')]];}if(_[_0x904c('0x47')](_0xf0c0f8[_0x904c('0x48')])){_0xf0c0f8[_0x904c('0x48')]=this['getCallType'](_0xf0c0f8);}if(_[_0x904c('0x47')](_0xf0c0f8[_0x904c('0x49')])){var _0x1d763c=_0xf0c0f8[_0x904c('0x40')][_0x904c('0x4a')]('-')[0x0];var _0x1aefca=this[_0x904c('0xe')][_0x1d763c];if(!_0x1aefca)_0x1aefca=this[_0x904c('0x2d')](_0xf0c0f8[_0x904c('0x1c')]);if(_0x1aefca){_0xf0c0f8[_0x904c('0x49')]=_0x1aefca['id'];_0xf0c0f8[_0x904c('0x4b')]=_0x1aefca[_0x904c('0x1d')];}}RpcVoiceCallReport[_0x904c('0x2b')](_0xf0c0f8);if(_0xf0c0f8[_0x904c('0x4c')]){for(var _0xa844e6=0x0;_0xa844e6<_0xf0c0f8[_0x904c('0x4d')][_0x904c('0x21')];_0xa844e6+=0x1){_0xf0c0f8['monitorFilename']=_0xf0c0f8[_0x904c('0x4d')][_0xa844e6][_0x904c('0x4e')];_0xf0c0f8[_0x904c('0x4f')]=_0xf0c0f8['monitors'][_0xa844e6]['createdAt'];if(_0xf0c0f8[_0x904c('0x34')]==_0x904c('0x3b')){_0xf0c0f8[_0x904c('0x3d')]=_0xf0c0f8[_0x904c('0x22')];_0xf0c0f8[_0x904c('0x50')]=_0xf0c0f8[_0x904c('0x51')];_0xf0c0f8['connectedlinenum']=_0xf0c0f8[_0x904c('0x1c')];_0xf0c0f8[_0x904c('0x51')]=_0xf0c0f8[_0x904c('0x4b')];_0xf0c0f8[_0x904c('0x34')]=_0xf0c0f8[_0x904c('0x3e')];}else if(_0xf0c0f8[_0x904c('0x34')]=='xcally-motion-dialer'){_0xf0c0f8[_0x904c('0x3d')]=_0xf0c0f8[_0x904c('0x33')];_0xf0c0f8[_0x904c('0x34')]=_0xf0c0f8[_0x904c('0x3e')];}RpcVoiceRecording[_0x904c('0x2b')](_0xf0c0f8);}}};Report[_0x904c('0x10')]['voiceAgentReport']=function(_0x5bd46c){if(_[_0x904c('0x52')](_0x5bd46c)){_0x5bd46c[_0x904c('0x53')](function(_0x4bbf5d){RpcVoiceAgentReport[_0x904c('0x2b')](_0x4bbf5d);});}else{RpcVoiceAgentReport[_0x904c('0x2b')](_0x5bd46c);}};Report['prototype'][_0x904c('0x54')]=function(_0x193928){RpcVoiceDialReport[_0x904c('0x2b')](_0x193928);var _0x23e7c9;var _0x4f4b8d;var _0x57dda7=_0x193928['channel'];if(_['startsWith'](_0x57dda7,_0x904c('0x55'))){_0x4f4b8d=_0x57dda7[_0x904c('0x56')](_0x57dda7['indexOf']('/')+0x1,_0x57dda7[_0x904c('0x57')]('@'));_0x23e7c9=_[_0x904c('0x1e')](this['agents'],function(_0x56e3af){return _0x56e3af[_0x904c('0x58')]==_0x4f4b8d||_0x56e3af[_0x904c('0x59')]==_0x4f4b8d||_0x56e3af[_0x904c('0x1c')]==_0x4f4b8d;});}else{_0x4f4b8d=_0x57dda7[_0x904c('0x56')](_0x57dda7[_0x904c('0x57')]('/')+0x1,_0x57dda7[_0x904c('0x5a')]('-'));_0x23e7c9=this[_0x904c('0x1b')](_0x4f4b8d);}if(_0x23e7c9){_0x193928[_0x904c('0x25')]=_[_0x904c('0x47')](_0x23e7c9[_0x904c('0x25')])?util[_0x904c('0x1f')](_0x904c('0x20'),_0x23e7c9[_0x904c('0x1d')]):_0x23e7c9['interface'];_0x193928[_0x904c('0x4b')]=_0x23e7c9['name'];_0x193928['accountcode']=_0x23e7c9[_0x904c('0x1c')];RpcMemberReport['voiceDialReport'](_0x193928);}};Report['prototype'][_0x904c('0x46')]=function(_0xd1e320){RpcVoiceTransferReport['transfers'][_0xd1e320[_0x904c('0x5b')]]=_0xd1e320;};Report[_0x904c('0x10')][_0x904c('0x1a')]=function(_0x5c99cf){RpcVoiceTransferReport[_0x904c('0x1a')](_0x5c99cf);};module[_0x904c('0x5c')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 88e9b16..1322e96 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 _0xbd65=['ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','bind','syncRegistry','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','then','[userReport][sippeerstatus]','prototype','emit','isNotNull','info','debug','[userReport][registry]','find','username','stateRegistry','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','inuse','toLowerCase','stateTime','format','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger'];(function(_0x37c81a,_0x1bc5be){var _0x2d21c5=function(_0x3bd021){while(--_0x3bd021){_0x37c81a['push'](_0x37c81a['shift']());}};_0x2d21c5(++_0x1bc5be);}(_0xbd65,0x1b5));var _0x5bd6=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xbd65[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x5bd6('0x0'));var moment=require(_0x5bd6('0x1'));var util=require(_0x5bd6('0x2'));var Redis=require(_0x5bd6('0x3'));var BPromise=require(_0x5bd6('0x4'));var config=require(_0x5bd6('0x5'));var logger=require(_0x5bd6('0x6'))(_0x5bd6('0x7'));var ami=require(_0x5bd6('0x8'));config[_0x5bd6('0x9')]=_[_0x5bd6('0xa')](config[_0x5bd6('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x5bd6('0xb'))(new Redis(config[_0x5bd6('0x9')]));function UserReport(_0x26f3cc){this[_0x5bd6('0xc')]=_0x26f3cc['trunks'];this['agents']=_0x26f3cc[_0x5bd6('0xd')];this[_0x5bd6('0xe')]=_0x26f3cc['telephones'];ami['on'](_0x5bd6('0xf'),this['syncRegistry'][_0x5bd6('0x10')](this));ami['on']('registry',this[_0x5bd6('0x11')]['bind'](this));ami['on'](_0x5bd6('0x12'),this['syncDeviceState'][_0x5bd6('0x10')](this));ami['on'](_0x5bd6('0x13'),this[_0x5bd6('0x14')][_0x5bd6('0x10')](this));return this[_0x5bd6('0x15')]();}function showSipRegistrations(){Promise[_0x5bd6('0x16')]()['then'](ami[_0x5bd6('0x17')]())[_0x5bd6('0x18')](function(_0x35ceb4){logger[_0x5bd6('0x19')](_0x5bd6('0x1a'),util[_0x5bd6('0x1b')](_0x35ceb4,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5bd6('0x16')]()['then'](ami[_0x5bd6('0x1c')]())[_0x5bd6('0x18')](function(_0x507793){logger['error'](_0x5bd6('0x1d'),util[_0x5bd6('0x1b')](_0x507793,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x5bd6('0x16')]()[_0x5bd6('0x1e')](ami['actionSipPeerStatus']())[_0x5bd6('0x18')](function(_0xac6cd6){logger[_0x5bd6('0x19')](_0x5bd6('0x1f'),util['inspect'](_0xac6cd6,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x5bd6('0x15')]=function(){setInterval(function(){BPromise[_0x5bd6('0x16')]()['then'](showSipRegistrations())[_0x5bd6('0x1e')](listDeviceStates())[_0x5bd6('0x1e')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x451eb6){return _0x451eb6!==null&&!_['isUndefined'](_0x451eb6);};UserReport[_0x5bd6('0x20')][_0x5bd6('0x21')]=function(_0x2e98a8,_0xd9fa8a,_0x33f833){io['to'](_0x2e98a8)[_0x5bd6('0x21')](_0xd9fa8a,_0x33f833);};UserReport[_0x5bd6('0x20')][_0x5bd6('0x11')]=function(_0x21836c){try{if(this[_0x5bd6('0x22')](_0x21836c)){logger[_0x5bd6('0x23')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x21836c['username'],_0x21836c['state']);logger[_0x5bd6('0x24')](_0x5bd6('0x25'),util['inspect'](_0x21836c,{'showHidden':![],'depth':null}));var _0x5751d7=_[_0x5bd6('0x26')](this[_0x5bd6('0xc')],{'defaultuser':_0x21836c[_0x5bd6('0x27')]});if(_0x5751d7){_0x21836c[_0x5bd6('0x28')]=_0x21836c[_0x5bd6('0x29')];_[_0x5bd6('0x2a')](_0x5751d7,_[_0x5bd6('0x2b')](_0x21836c,[_0x5bd6('0x2c'),_0x5bd6('0x2d'),'username',_0x5bd6('0x29')]));logger[_0x5bd6('0x24')](_0x5bd6('0x2e'),util[_0x5bd6('0x1b')](_0x5751d7,{'showHidden':![],'depth':null}));this[_0x5bd6('0x21')](util['format']('trunk:%s',_0x5751d7[_0x5bd6('0x2f')]),_0x5bd6('0x30'),_0x5751d7);}}}catch(_0x40f8e1){logger[_0x5bd6('0x19')](_0x5bd6('0x25'),util[_0x5bd6('0x1b')](_0x40f8e1,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x5bd6('0x31')]=function(_0x2568e6){try{if(this[_0x5bd6('0x22')](_0x2568e6)){logger['info'](_0x5bd6('0x32'),_0x2568e6['device'],_0x2568e6[_0x5bd6('0x29')]);logger[_0x5bd6('0x24')](_0x5bd6('0x33'),util[_0x5bd6('0x1b')](_0x2568e6,{'showHidden':![],'depth':null}));if(this[_0x5bd6('0xd')][_0x2568e6[_0x5bd6('0x34')]]){if(!this['agents'][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x35')]||_0x2568e6[_0x5bd6('0x29')]['toLowerCase']()==_0x5bd6('0x36')){this[_0x5bd6('0xd')][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x35')]=![];if(this[_0x5bd6('0xd')][_0x2568e6[_0x5bd6('0x34')]]['state']!==_0x2568e6['state'][_0x5bd6('0x37')]()){this[_0x5bd6('0xd')][_0x2568e6['device']][_0x5bd6('0x38')]=_['toNumber'](moment()[_0x5bd6('0x39')]('x'));}this[_0x5bd6('0xd')][_0x2568e6[_0x5bd6('0x34')]]['state']=_0x2568e6[_0x5bd6('0x29')][_0x5bd6('0x37')]();this['agents'][_0x2568e6['device']]['updateStatusRealtime'](_0x2568e6);}}else if(this[_0x5bd6('0xe')][_0x2568e6[_0x5bd6('0x34')]]){if(this[_0x5bd6('0xe')][_0x2568e6['device']][_0x5bd6('0x29')]!==_0x2568e6[_0x5bd6('0x29')][_0x5bd6('0x37')]()){this[_0x5bd6('0xe')][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x38')]=_[_0x5bd6('0x3a')](moment()['format']('x'));}this[_0x5bd6('0xe')][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x29')]=_0x2568e6[_0x5bd6('0x29')][_0x5bd6('0x37')]();logger[_0x5bd6('0x24')](_0x5bd6('0x3b'),util[_0x5bd6('0x1b')](this[_0x5bd6('0xe')][_0x2568e6['device']],{'showHidden':![],'depth':null}));this[_0x5bd6('0x21')](util[_0x5bd6('0x39')](_0x5bd6('0x3c'),this[_0x5bd6('0xe')][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x2f')]),_0x5bd6('0x3d'),this['telephones'][_0x2568e6[_0x5bd6('0x34')]]);}else if(this['trunks'][_0x2568e6['device']]){if(this[_0x5bd6('0xc')][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x29')]!==_0x2568e6[_0x5bd6('0x29')][_0x5bd6('0x37')]()){this[_0x5bd6('0xc')][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x38')]=_['toNumber'](moment()[_0x5bd6('0x39')]('x'));}this[_0x5bd6('0xc')][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x29')]=_0x2568e6[_0x5bd6('0x29')][_0x5bd6('0x37')]();logger['debug'](_0x5bd6('0x3e'),util['inspect'](this['trunks'][_0x2568e6[_0x5bd6('0x34')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x5bd6('0x39')]('trunk:%s',this['trunks'][_0x2568e6[_0x5bd6('0x34')]][_0x5bd6('0x2f')]),'trunk:save',this['trunks'][_0x2568e6['device']]);}else if(_[_0x5bd6('0x3f')](_0x2568e6[_0x5bd6('0x34')],'Local')){var _0x5e6dff=_0x2568e6[_0x5bd6('0x34')];var _0x33d47c=_0x5e6dff[_0x5bd6('0x40')](_0x5e6dff[_0x5bd6('0x41')]('/')+0x1,_0x5e6dff['indexOf']('@'));var _0x182475=_[_0x5bd6('0x26')](this[_0x5bd6('0xd')],function(_0x584e63){return _0x584e63[_0x5bd6('0x42')]==_0x33d47c||_0x584e63[_0x5bd6('0x43')]==_0x33d47c||_0x584e63[_0x5bd6('0x44')]==_0x33d47c;});if(_0x182475){if(_0x182475['state']!==_0x2568e6[_0x5bd6('0x29')][_0x5bd6('0x37')]()){_0x182475['stateTime']=_[_0x5bd6('0x3a')](moment()[_0x5bd6('0x39')]('x'));}_0x182475[_0x5bd6('0x29')]=_0x2568e6[_0x5bd6('0x29')][_0x5bd6('0x37')]();_0x182475[_0x5bd6('0x35')]=!![];_0x182475['updateStatusRealtime'](_0x2568e6);}}}}catch(_0x12b405){logger[_0x5bd6('0x19')]('[userReport][devicestatechange]',util[_0x5bd6('0x1b')](_0x12b405,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x8c43af){try{if(this[_0x5bd6('0x22')](_0x8c43af)&&this[_0x5bd6('0x22')](_0x8c43af['peerstatus'])){logger[_0x5bd6('0x23')](_0x5bd6('0x45'),_0x8c43af[_0x5bd6('0x46')],_0x8c43af[_0x5bd6('0x47')],_0x8c43af[_0x5bd6('0x13')]);logger[_0x5bd6('0x24')]('[userReport][peerstatus]',util['inspect'](_0x8c43af,{'showHidden':![],'depth':null}));if(this[_0x5bd6('0xd')][_0x8c43af[_0x5bd6('0x46')]]){if(!this['agents'][_0x8c43af['peer']][_0x5bd6('0x35')]||_0x8c43af['peerstatus'][_0x5bd6('0x37')]()==_0x5bd6('0x48')){this['agents'][_0x8c43af['peer']]['local']=![];this[_0x5bd6('0xd')][_0x8c43af[_0x5bd6('0x46')]]['status']=_0x8c43af[_0x5bd6('0x13')][_0x5bd6('0x37')]();this[_0x5bd6('0xd')][_0x8c43af[_0x5bd6('0x46')]]['address']=_0x8c43af['address'];this['agents'][_0x8c43af['peer']]['updateStatusRealtime'](_0x8c43af);}}else if(this[_0x5bd6('0xe')][_0x8c43af[_0x5bd6('0x46')]]){this[_0x5bd6('0xe')][_0x8c43af[_0x5bd6('0x46')]][_0x5bd6('0x49')]=_0x8c43af['peerstatus'][_0x5bd6('0x37')]();this[_0x5bd6('0xe')][_0x8c43af['peer']][_0x5bd6('0x47')]=_0x8c43af[_0x5bd6('0x47')];logger[_0x5bd6('0x24')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x5bd6('0x1b')](this[_0x5bd6('0xe')][_0x8c43af['peer']],{'showHidden':![],'depth':null}));this[_0x5bd6('0x21')](util[_0x5bd6('0x39')](_0x5bd6('0x3c'),this[_0x5bd6('0xe')][_0x8c43af[_0x5bd6('0x46')]][_0x5bd6('0x2f')]),_0x5bd6('0x3d'),this[_0x5bd6('0xe')][_0x8c43af[_0x5bd6('0x46')]]);}else if(this[_0x5bd6('0xc')][_0x8c43af[_0x5bd6('0x46')]]){this[_0x5bd6('0xc')][_0x8c43af[_0x5bd6('0x46')]][_0x5bd6('0x49')]=_0x8c43af['peerstatus'][_0x5bd6('0x37')]();this[_0x5bd6('0xc')][_0x8c43af[_0x5bd6('0x46')]]['address']=_0x8c43af[_0x5bd6('0x47')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x5bd6('0x1b')](this['trunks'][_0x8c43af[_0x5bd6('0x46')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',this[_0x5bd6('0xc')][_0x8c43af[_0x5bd6('0x46')]][_0x5bd6('0x2f')]),_0x5bd6('0x30'),this[_0x5bd6('0xc')][_0x8c43af[_0x5bd6('0x46')]]);}}}catch(_0x40ad3b){logger['error']('[userReport][peerstatus]',util[_0x5bd6('0x1b')](_0x40ad3b,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x153b=['[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','username','state','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','updateStatusRealtime','toNumber','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','find','mobile','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x153b,0x9a));var _0xb153=function(_0x344397,_0x362498){_0x344397=_0x344397-0x0;var _0x3f7ee8=_0x153b[_0x344397];return _0x3f7ee8;};'use strict';var _=require(_0xb153('0x0'));var moment=require(_0xb153('0x1'));var util=require(_0xb153('0x2'));var Redis=require(_0xb153('0x3'));var BPromise=require(_0xb153('0x4'));var config=require(_0xb153('0x5'));var logger=require('../../../config/logger')(_0xb153('0x6'));var ami=require(_0xb153('0x7'));config[_0xb153('0x8')]=_['defaults'](config[_0xb153('0x8')],{'host':_0xb153('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb153('0x8')]));function UserReport(_0x2db896){this[_0xb153('0xa')]=_0x2db896[_0xb153('0xa')];this['agents']=_0x2db896[_0xb153('0xb')];this[_0xb153('0xc')]=_0x2db896[_0xb153('0xc')];ami['on'](_0xb153('0xd'),this[_0xb153('0xe')][_0xb153('0xf')](this));ami['on'](_0xb153('0x10'),this[_0xb153('0xe')][_0xb153('0xf')](this));ami['on'](_0xb153('0x11'),this[_0xb153('0x12')][_0xb153('0xf')](this));ami['on'](_0xb153('0x13'),this['syncPeerStatus'][_0xb153('0xf')](this));return this[_0xb153('0x14')]();}function showSipRegistrations(){Promise[_0xb153('0x15')]()[_0xb153('0x16')](ami['actionSipShowRegistry']())['catch'](function(_0x157162){logger['error'](_0xb153('0x17'),util[_0xb153('0x18')](_0x157162,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xb153('0x16')](ami[_0xb153('0x19')]())['catch'](function(_0x3db7b6){logger[_0xb153('0x1a')](_0xb153('0x1b'),util[_0xb153('0x18')](_0x3db7b6,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb153('0x15')]()['then'](ami[_0xb153('0x1c')]())[_0xb153('0x1d')](function(_0x5a9d2b){logger[_0xb153('0x1a')](_0xb153('0x1e'),util[_0xb153('0x18')](_0x5a9d2b,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xb153('0x15')]()['then'](showSipRegistrations())[_0xb153('0x16')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xb153('0x1f')][_0xb153('0x20')]=function(_0x5128e1){return _0x5128e1!==null&&!_[_0xb153('0x21')](_0x5128e1);};UserReport[_0xb153('0x1f')]['emit']=function(_0x50bc98,_0xbc574e,_0x3f88c1){io['to'](_0x50bc98)[_0xb153('0x22')](_0xbc574e,_0x3f88c1);};UserReport[_0xb153('0x1f')][_0xb153('0xe')]=function(_0x14d5a4){try{if(this['isNotNull'](_0x14d5a4)){logger[_0xb153('0x23')](_0xb153('0x24'),_0x14d5a4['username'],_0x14d5a4['state']);logger[_0xb153('0x25')]('[userReport][registry]',util[_0xb153('0x18')](_0x14d5a4,{'showHidden':![],'depth':null}));var _0x2beea3=_['find'](this[_0xb153('0xa')],{'defaultuser':_0x14d5a4[_0xb153('0x26')]});if(_0x2beea3){_0x14d5a4['stateRegistry']=_0x14d5a4[_0xb153('0x27')];_['merge'](_0x2beea3,_['omit'](_0x14d5a4,[_0xb153('0x28'),'actionid',_0xb153('0x26'),_0xb153('0x27')]));logger[_0xb153('0x25')](_0xb153('0x29'),util[_0xb153('0x18')](_0x2beea3,{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util[_0xb153('0x2a')](_0xb153('0x2b'),_0x2beea3[_0xb153('0x2c')]),_0xb153('0x2d'),_0x2beea3);}}}catch(_0x4d79d0){logger[_0xb153('0x1a')](_0xb153('0x2e'),util[_0xb153('0x18')](_0x4d79d0,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xb153('0x12')]=function(_0x558d00){try{if(this['isNotNull'](_0x558d00)){logger['info'](_0xb153('0x2f'),_0x558d00[_0xb153('0x30')],_0x558d00['state']);logger[_0xb153('0x25')](_0xb153('0x31'),util['inspect'](_0x558d00,{'showHidden':![],'depth':null}));if(this['agents'][_0x558d00[_0xb153('0x30')]]){if(!this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]]['local']||_0x558d00[_0xb153('0x27')][_0xb153('0x32')]()==_0xb153('0x33')){this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]][_0xb153('0x34')]=![];if(this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]][_0xb153('0x27')]!==_0x558d00['state'][_0xb153('0x32')]()){this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]][_0xb153('0x35')]=_['toNumber'](moment()[_0xb153('0x2a')]('x'));}this['agents'][_0x558d00[_0xb153('0x30')]]['state']=_0x558d00[_0xb153('0x27')][_0xb153('0x32')]();this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]][_0xb153('0x36')](_0x558d00);}}else if(this[_0xb153('0xc')][_0x558d00[_0xb153('0x30')]]){if(this[_0xb153('0xc')][_0x558d00[_0xb153('0x30')]][_0xb153('0x27')]!==_0x558d00['state'][_0xb153('0x32')]()){this[_0xb153('0xc')][_0x558d00[_0xb153('0x30')]]['stateTime']=_[_0xb153('0x37')](moment()[_0xb153('0x2a')]('x'));}this['telephones'][_0x558d00[_0xb153('0x30')]][_0xb153('0x27')]=_0x558d00[_0xb153('0x27')][_0xb153('0x32')]();logger[_0xb153('0x25')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0xb153('0xc')][_0x558d00[_0xb153('0x30')]],{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util[_0xb153('0x2a')]('telephone:%s',this['telephones'][_0x558d00[_0xb153('0x30')]][_0xb153('0x2c')]),_0xb153('0x38'),this[_0xb153('0xc')][_0x558d00['device']]);}else if(this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]]){if(this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]]['state']!==_0x558d00[_0xb153('0x27')]['toLowerCase']()){this[_0xb153('0xa')][_0x558d00['device']]['stateTime']=_[_0xb153('0x37')](moment()[_0xb153('0x2a')]('x'));}this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]][_0xb153('0x27')]=_0x558d00[_0xb153('0x27')][_0xb153('0x32')]();logger[_0xb153('0x25')](_0xb153('0x39'),util['inspect'](this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]],{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util[_0xb153('0x2a')](_0xb153('0x2b'),this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]][_0xb153('0x2c')]),_0xb153('0x2d'),this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]]);}else if(_[_0xb153('0x3a')](_0x558d00[_0xb153('0x30')],_0xb153('0x3b'))){var _0x173e24=_0x558d00[_0xb153('0x30')];var _0x12658e=_0x173e24['substring'](_0x173e24[_0xb153('0x3c')]('/')+0x1,_0x173e24[_0xb153('0x3c')]('@'));var _0x30193f=_[_0xb153('0x3d')](this[_0xb153('0xb')],function(_0x45caa9){return _0x45caa9[_0xb153('0x3e')]==_0x12658e||_0x45caa9['phone']==_0x12658e||_0x45caa9[_0xb153('0x3f')]==_0x12658e;});if(_0x30193f){if(_0x30193f[_0xb153('0x27')]!==_0x558d00['state'][_0xb153('0x32')]()){_0x30193f[_0xb153('0x35')]=_[_0xb153('0x37')](moment()[_0xb153('0x2a')]('x'));}_0x30193f[_0xb153('0x27')]=_0x558d00[_0xb153('0x27')][_0xb153('0x32')]();_0x30193f[_0xb153('0x34')]=!![];_0x30193f[_0xb153('0x36')](_0x558d00);}}}}catch(_0x30472e){logger[_0xb153('0x1a')](_0xb153('0x31'),util[_0xb153('0x18')](_0x30472e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xb153('0x40')]=function(_0x4b3f4f){try{if(this[_0xb153('0x20')](_0x4b3f4f)&&this[_0xb153('0x20')](_0x4b3f4f['peerstatus'])){logger[_0xb153('0x23')](_0xb153('0x41'),_0x4b3f4f[_0xb153('0x42')],_0x4b3f4f[_0xb153('0x43')],_0x4b3f4f[_0xb153('0x13')]);logger[_0xb153('0x25')](_0xb153('0x44'),util['inspect'](_0x4b3f4f,{'showHidden':![],'depth':null}));if(this[_0xb153('0xb')][_0x4b3f4f[_0xb153('0x42')]]){if(!this[_0xb153('0xb')][_0x4b3f4f['peer']][_0xb153('0x34')]||_0x4b3f4f[_0xb153('0x13')][_0xb153('0x32')]()==_0xb153('0x45')){this[_0xb153('0xb')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x34')]=![];this[_0xb153('0xb')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x46')]=_0x4b3f4f[_0xb153('0x13')][_0xb153('0x32')]();this[_0xb153('0xb')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x43')]=_0x4b3f4f[_0xb153('0x43')];this[_0xb153('0xb')][_0x4b3f4f['peer']][_0xb153('0x36')](_0x4b3f4f);}}else if(this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]]){this[_0xb153('0xc')][_0x4b3f4f['peer']]['status']=_0x4b3f4f[_0xb153('0x13')][_0xb153('0x32')]();this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x43')]=_0x4b3f4f[_0xb153('0x43')];logger['debug'](_0xb153('0x47'),util[_0xb153('0x18')](this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]],{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util['format'](_0xb153('0x48'),this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]]['name']),_0xb153('0x38'),this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]]);}else if(this[_0xb153('0xa')][_0x4b3f4f[_0xb153('0x42')]]){this['trunks'][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x46')]=_0x4b3f4f['peerstatus'][_0xb153('0x32')]();this['trunks'][_0x4b3f4f['peer']]['address']=_0x4b3f4f[_0xb153('0x43')];logger[_0xb153('0x25')](_0xb153('0x49'),util[_0xb153('0x18')](this['trunks'][_0x4b3f4f[_0xb153('0x42')]],{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util[_0xb153('0x2a')](_0xb153('0x2b'),this[_0xb153('0xa')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x2c')]),_0xb153('0x2d'),this[_0xb153('0xa')][_0x4b3f4f[_0xb153('0x42')]]);}}}catch(_0x382245){logger['error'](_0xb153('0x44'),util[_0xb153('0x18')](_0x382245,{'showHidden':![],'depth':null}));}};module[_0xb153('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 9212d95..ed6a4f0 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x2de130,_0x220588){var _0x5c656a=function(_0x48c399){while(--_0x48c399){_0x2de130['push'](_0x2de130['shift']());}};_0x5c656a(++_0x220588);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x1fa3a0,_0x59907e){var _0x58e941=function(_0x3655dc){while(--_0x3655dc){_0x1fa3a0['push'](_0x1fa3a0['shift']());}};_0x58e941(++_0x59907e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 63029b1..7c39490 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 _0x5953=['exten','xcally-motion-preview','channel','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','inspect','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','merge','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','CDR(routeAlias)','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','set','startsWith','cdr(','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','toNumber','UserId','membername','context','routealias','syncMixMonitorFilename','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','undefined','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','StopMixMonitor','catch','webbar:stopmonitors','BlindTransfer','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','moment','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','keys','from-sip','split'];(function(_0x503ce2,_0x164539){var _0x290df5=function(_0x5c6cd8){while(--_0x5c6cd8){_0x503ce2['push'](_0x503ce2['shift']());}};_0x290df5(++_0x164539);}(_0x5953,0x8e));var _0x3595=function(_0x4d81b4,_0xaf4f9b){_0x4d81b4=_0x4d81b4-0x0;var _0x2e2fe0=_0x5953[_0x4d81b4];return _0x2e2fe0;};'use strict';var _=require('lodash');var moment=require(_0x3595('0x0'));var util=require('util');var path=require(_0x3595('0x1'));var Redis=require(_0x3595('0x2'));var config=require(_0x3595('0x3'));var logger=require(_0x3595('0x4'))('ami');var ami=require('../ami');var Channel=require(_0x3595('0x5'));var RpcSetting=require('../rpc/setting');var applications=['set',_0x3595('0x6'),_0x3595('0x7'),_0x3595('0x8'),_0x3595('0x9'),_0x3595('0xa')];var dispositions=[_0x3595('0xb'),_0x3595('0xc'),_0x3595('0xc'),_0x3595('0xb'),_0x3595('0xb'),_0x3595('0xb'),_0x3595('0xd'),'BUSY',_0x3595('0xc'),'FAILED',_0x3595('0xc')];config['redis']=_[_0x3595('0xe')](config[_0x3595('0xf')],{'host':_0x3595('0x10'),'port':0x18eb});var io=require(_0x3595('0x11'))(new Redis(config[_0x3595('0xf')]));function VoiceCallReport(_0x4b6836){this[_0x3595('0x12')]=_0x4b6836[_0x3595('0x12')];this[_0x3595('0x13')]=_0x4b6836['agents'];this[_0x3595('0x14')]={};ami['on'](_0x3595('0x15'),this[_0x3595('0x16')][_0x3595('0x17')](this));ami['on'](_0x3595('0x18'),this[_0x3595('0x16')][_0x3595('0x17')](this));ami['on'](_0x3595('0x19'),this['syncNewChannel'][_0x3595('0x17')](this));ami['on'](_0x3595('0x1a'),this[_0x3595('0x1b')][_0x3595('0x17')](this));ami['on'](_0x3595('0x1c'),this[_0x3595('0x1d')][_0x3595('0x17')](this));ami['on'](_0x3595('0x1e'),this[_0x3595('0x1f')][_0x3595('0x17')](this));ami['on'](_0x3595('0x20'),this['syncNewCallerId'][_0x3595('0x17')](this));ami['on'](_0x3595('0x21'),this[_0x3595('0x22')][_0x3595('0x17')](this));ami['on']('blindtransfer',this[_0x3595('0x23')]['bind'](this));ami['on'](_0x3595('0x24'),this['syncMusicOnHoldStart'][_0x3595('0x17')](this));ami['on']('musiconholdstop',this[_0x3595('0x25')]['bind'](this));try{logger[_0x3595('0x26')](_0x3595('0x27'));ami[_0x3595('0x28')]();}catch(_0x4d460d){logger[_0x3595('0x29')](_0x3595('0x2a'),util['inspect'](_0x4d460d,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3595('0x2b')][_0x3595('0x2c')]=function(_0x46501e){return _0x46501e!==null&&!_[_0x3595('0x2d')](_0x46501e);};VoiceCallReport['prototype'][_0x3595('0x2e')]=function(_0x57addb,_0x20969a,_0x568dca){io['to'](_0x57addb)[_0x3595('0x2e')](_0x20969a,_0x568dca);};VoiceCallReport[_0x3595('0x2b')][_0x3595('0x2f')]=function(_0x247452){try{if(this[_0x3595('0x2c')](_0x247452)){logger[_0x3595('0x26')](_0x3595('0x30'),_0x247452[_0x3595('0x31')],_0x247452[_0x3595('0x32')],_0x247452[_0x3595('0x33')]);logger[_0x3595('0x34')](_0x3595('0x35'),_0x247452['uniqueid'],util['inspect'](_0x247452,{'showHidden':![],'depth':null}));if(_0x247452[_0x3595('0x31')]===_0x247452[_0x3595('0x36')]){if(!_['isUndefined'](this[_0x3595('0x12')][_0x247452[_0x3595('0x31')]])){_['merge'](this['channels'][_0x247452[_0x3595('0x31')]],_[_0x3595('0x37')](_0x247452,_[_0x3595('0x38')](this[_0x3595('0x12')][_0x247452[_0x3595('0x31')]])));}}if(_0x247452['context']===_0x3595('0x39')){if(this[_0x3595('0x13')][_0x247452['channel'][_0x3595('0x3a')]('-')[0x0]]){if(_0x247452[_0x3595('0x3b')]==_0x3595('0x3c')){this['agents'][_0x247452[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]][_0x3595('0x3e')]=_0x247452[_0x3595('0x3f')];this[_0x3595('0x2e')](util[_0x3595('0x40')](_0x3595('0x41'),this['agents'][_0x247452[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]][_0x3595('0x42')]),_0x3595('0x43'),{'destaccountcode':this[_0x3595('0x13')][_0x247452[_0x3595('0x3d')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x247452[_0x3595('0x3f')]});}}}}}catch(_0x1c0698){logger[_0x3595('0x29')](_0x3595('0x44'),_0x247452[_0x3595('0x31')],util[_0x3595('0x45')](_0x1c0698,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3595('0x2b')]['syncNewChannel']=function(_0x22cfe3){try{if(this[_0x3595('0x2c')](_0x22cfe3)){logger[_0x3595('0x34')]('[%s][voiceCallReport][newchannel]\x20event:',_0x22cfe3['uniqueid'],util['inspect'](_0x22cfe3,{'showHidden':![],'depth':null}));if(this[_0x3595('0x12')][_0x22cfe3[_0x3595('0x31')]])return;if(_0x22cfe3[_0x3595('0x3d')]===_0x3595('0x46'))return;if(_0x22cfe3[_0x3595('0x31')]!==_0x22cfe3['linkedid']&&!this[_0x3595('0x14')][_0x22cfe3[_0x3595('0x36')]])return;logger[_0x3595('0x26')](_0x3595('0x47'),_0x22cfe3[_0x3595('0x31')],_0x22cfe3['context'],_0x22cfe3['exten']);this[_0x3595('0x12')][_0x22cfe3[_0x3595('0x31')]]=new Channel();this[_0x3595('0x12')][_0x22cfe3[_0x3595('0x31')]][_0x3595('0x48')]=moment()[_0x3595('0x40')](_0x3595('0x49'));this[_0x3595('0x12')][_0x22cfe3[_0x3595('0x31')]][_0x3595('0x4a')]=dispositions[_['toNumber'](_0x22cfe3[_0x3595('0x4b')])];_[_0x3595('0x4c')](this['channels'][_0x22cfe3[_0x3595('0x31')]],_[_0x3595('0x37')](_0x22cfe3,_[_0x3595('0x38')](this[_0x3595('0x12')][_0x22cfe3['uniqueid']])));if(_0x22cfe3['context']==='from-sip'){if(this[_0x3595('0x13')][_0x22cfe3[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]){if(_[_0x3595('0x2d')](this[_0x3595('0x13')][_0x22cfe3[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]][_0x3595('0x3e')])){this['agents'][_0x22cfe3[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]][_0x3595('0x3e')]=_0x22cfe3[_0x3595('0x3b')];logger[_0x3595('0x34')](_0x3595('0x4d'),_0x22cfe3[_0x3595('0x31')],util[_0x3595('0x45')]({'id':this[_0x3595('0x13')][_0x22cfe3[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x3595('0x13')][_0x22cfe3[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x22cfe3[_0x3595('0x3b')]},{'showHidden':![],'depth':null}));this[_0x3595('0x2e')](util[_0x3595('0x40')](_0x3595('0x41'),this['agents'][_0x22cfe3[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['name']),_0x3595('0x43'),{'id':this[_0x3595('0x13')][_0x22cfe3[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x3595('0x13')][_0x22cfe3[_0x3595('0x3d')]['split']('-')[0x0]][_0x3595('0x4e')],'destconnectedlinenum':_0x22cfe3['exten']});}}}}}catch(_0x29ae76){logger[_0x3595('0x29')](_0x3595('0x4f'),_0x22cfe3['uniqueid'],util['inspect'](_0x29ae76,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3595('0x2b')][_0x3595('0x16')]=function(_0x48d166){try{if(this[_0x3595('0x2c')](_0x48d166)){logger[_0x3595('0x34')](_0x3595('0x50'),_0x48d166[_0x3595('0x31')],util['inspect'](_0x48d166,{'showHidden':![],'depth':null}));if(_0x48d166['channel']===_0x3595('0x46')||_0x48d166[_0x3595('0x3b')]==='h')return;if(_0x48d166[_0x3595('0x31')]===_0x48d166['linkedid']||this[_0x3595('0x14')][_0x48d166[_0x3595('0x36')]]){_0x48d166[_0x3595('0x51')]=_0x48d166['application'][_0x3595('0x52')]();_0x48d166[_0x3595('0x53')]=_0x48d166['appdata']&&_0x48d166['appdata']['startsWith'](_0x3595('0x54'))?_0x48d166[_0x3595('0x55')]:(_0x48d166[_0x3595('0x55')]||_0x48d166[_0x3595('0x53')])['toLowerCase']();logger['info'](_0x3595('0x56'),_0x48d166[_0x3595('0x31')],_0x48d166[_0x3595('0x51')],_0x48d166[_0x3595('0x53')]);if(_['isUndefined'](this['channels'][_0x48d166[_0x3595('0x31')]])){this[_0x3595('0x12')][_0x48d166['uniqueid']]=new Channel();this[_0x3595('0x12')][_0x48d166[_0x3595('0x31')]][_0x3595('0x48')]=_0x48d166[_0x3595('0x57')]?moment()['subtract'](moment['duration'](_0x48d166[_0x3595('0x57')])['seconds'](),_0x3595('0x58'))[_0x3595('0x40')](_0x3595('0x49')):moment()['format'](_0x3595('0x49'));this['channels'][_0x48d166['uniqueid']]['disposition']='NO\x20ANSWER';}_['merge'](this[_0x3595('0x12')][_0x48d166[_0x3595('0x31')]],_[_0x3595('0x37')](_0x48d166,_[_0x3595('0x38')](this[_0x3595('0x12')][_0x48d166[_0x3595('0x31')]])));if(_[_0x3595('0x59')](applications,_0x48d166[_0x3595('0x51')])){this['channels'][_0x48d166[_0x3595('0x31')]][_0x3595('0x5a')]=_0x48d166[_0x3595('0x51')];this[_0x3595('0x12')][_0x48d166[_0x3595('0x31')]][_0x3595('0x5b')]=_0x48d166['applicationdata'];if(_0x48d166[_0x3595('0x51')]===_0x3595('0x5c')&&_[_0x3595('0x5d')](_0x48d166['applicationdata'][_0x3595('0x52')](),_0x3595('0x5e'))){var _0x1b4e79=_0x48d166[_0x3595('0x53')][_0x3595('0x3a')]('=');var _0x2f9cbc=_0x1b4e79[0x0][_0x3595('0x52')]()['match'](/cdr\((.*)\)/);if(_0x2f9cbc){if(_0x2f9cbc[0x1]===_0x3595('0x5f')&&!_[_0x3595('0x60')](this[_0x3595('0x12')][_0x48d166[_0x3595('0x31')]][_0x2f9cbc[0x1]]))return;this['channels'][_0x48d166['uniqueid']][_0x2f9cbc[0x1]]=_0x1b4e79[0x1];}}else if(_0x48d166[_0x3595('0x51')]==='queue'){this['channels'][_0x48d166[_0x3595('0x31')]][_0x3595('0x6')]=_0x48d166[_0x3595('0x53')]['split'](',')[0x0];}}}}}catch(_0x318d98){logger[_0x3595('0x29')](_0x3595('0x61'),_0x48d166['uniqueid'],util[_0x3595('0x45')](_0x318d98,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3595('0x2b')]['syncNewState']=function(_0xe6d3e9){try{if(this[_0x3595('0x2c')](_0xe6d3e9)){logger[_0x3595('0x26')](_0x3595('0x62'),_0xe6d3e9[_0x3595('0x31')],_0xe6d3e9[_0x3595('0x36')],_0xe6d3e9[_0x3595('0x32')],_0xe6d3e9[_0x3595('0x33')]);logger['debug'](_0x3595('0x63'),_0xe6d3e9[_0x3595('0x31')],util['inspect'](_0xe6d3e9,{'showHidden':![],'depth':null}));if(_0xe6d3e9['channelstate']!=='6')return;if(_0xe6d3e9[_0x3595('0x31')]!==_0xe6d3e9['linkedid']){var _0x1ae981=moment();if(this[_0x3595('0x12')][_0xe6d3e9['linkedid']]){if(!this[_0x3595('0x12')][_0xe6d3e9['linkedid']]['answered']){this['channels'][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x64')]=!![];this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x65')]=_0x1ae981['format'](_0x3595('0x49'));if(this['channels'][_0xe6d3e9[_0x3595('0x36')]]['starttime']){this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x66')]=_0x1ae981[_0x3595('0x67')](this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]]['starttime'],'seconds');}}this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x36')]=_0xe6d3e9[_0x3595('0x31')];if(_0xe6d3e9[_0x3595('0x33')]!=='xcally-motion-preview'){this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]]['connectedlinenum']=_0xe6d3e9['calleridnum'];}this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x68')]=_0xe6d3e9[_0x3595('0x32')];this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x69')]=_0xe6d3e9[_0x3595('0x3d')];this['channels'][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x4a')]=dispositions[_[_0x3595('0x6a')](_0xe6d3e9[_0x3595('0x4b')])];if(this[_0x3595('0x13')][_0xe6d3e9['channel']['split']('-')[0x0]]){this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x6b')]=this[_0x3595('0x13')][_0xe6d3e9[_0x3595('0x3d')]['split']('-')[0x0]]['id'];this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]]['membername']=this[_0x3595('0x13')][_0xe6d3e9[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]][_0x3595('0x42')];}}if(this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]]){if(!this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x64')]){this['channels'][_0xe6d3e9['uniqueid']][_0x3595('0x64')]=!![];this[_0x3595('0x12')][_0xe6d3e9['uniqueid']]['answertime']=_0x1ae981[_0x3595('0x40')](_0x3595('0x49'));if(this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x48')]){this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x66')]=_0x1ae981['diff'](this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x48')],_0x3595('0x58'));}}if(_0xe6d3e9[_0x3595('0x33')]!==_0x3595('0x3c')){this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x3f')]=_0xe6d3e9['calleridnum'];}this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x68')]=_0xe6d3e9['calleridname'];this[_0x3595('0x12')][_0xe6d3e9['uniqueid']]['destinationchannel']=_0xe6d3e9[_0x3595('0x3d')];this['channels'][_0xe6d3e9[_0x3595('0x31')]]['disposition']=dispositions[_[_0x3595('0x6a')](_0xe6d3e9[_0x3595('0x4b')])];}}else{if(this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]]){if(this[_0x3595('0x13')][_0xe6d3e9[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]){this[_0x3595('0x12')][_0xe6d3e9['uniqueid']]['UserId']=this['agents'][_0xe6d3e9[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['id'];this['channels'][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x6c')]=this[_0x3595('0x13')][_0xe6d3e9['channel'][_0x3595('0x3a')]('-')[0x0]]['name'];}}}if(_0xe6d3e9[_0x3595('0x6d')]===_0x3595('0x39')){if(this['agents'][_0xe6d3e9[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]){this[_0x3595('0x13')][_0xe6d3e9[_0x3595('0x3d')]['split']('-')[0x0]][_0x3595('0x3e')]=_0xe6d3e9[_0x3595('0x3b')];var _0x368a34,_0x510b24;if(this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]]){_0x368a34=this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x6e')];_0x510b24=this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x31')]][_0x3595('0x6')];}else if(this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]]){_0x368a34=this[_0x3595('0x12')][_0xe6d3e9['linkedid']][_0x3595('0x6e')];_0x510b24=this[_0x3595('0x12')][_0xe6d3e9[_0x3595('0x36')]][_0x3595('0x6')];}logger[_0x3595('0x34')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0xe6d3e9[_0x3595('0x31')],util[_0x3595('0x45')]({'id':this['agents'][_0xe6d3e9[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x3595('0x13')][_0xe6d3e9['channel']['split']('-')[0x0]][_0x3595('0x4e')],'destconnectedlinenum':_0xe6d3e9[_0x3595('0x3b')],'routealias':_0x368a34,'queue':_0x510b24||undefined},{'showHidden':![],'depth':null}));this[_0x3595('0x2e')](util[_0x3595('0x40')](_0x3595('0x41'),this[_0x3595('0x13')][_0xe6d3e9[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['name']),_0x3595('0x43'),{'id':this[_0x3595('0x13')][_0xe6d3e9[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this['agents'][_0xe6d3e9['channel']['split']('-')[0x0]][_0x3595('0x4e')],'destconnectedlinenum':_0xe6d3e9[_0x3595('0x3b')],'routealias':_0x368a34,'queue':_0x510b24||undefined});}}}}catch(_0x5eb8bb){logger['error']('[%s][voiceCallReport][newstate]',_0xe6d3e9[_0x3595('0x31')],util['inspect'](_0x5eb8bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3595('0x2b')][_0x3595('0x6f')]=function(_0xc800fb,_0x551e56){try{if(this['channels'][_0xc800fb]){logger[_0x3595('0x26')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0xc800fb,_0x551e56);this[_0x3595('0x12')][_0xc800fb]['monitor']=!![];if(_['endsWith'](_0x551e56,_0x3595('0x70'))){_0x551e56=_0x551e56[_0x3595('0x71')](_0x3595('0x70'),_0x3595('0x72'));}this[_0x3595('0x12')][_0xc800fb][_0x3595('0x73')]=_0x551e56;var _0x4695ea=_[_0x3595('0x74')](this[_0x3595('0x12')][_0xc800fb][_0x3595('0x75')],{'filename':_0x551e56});if(_[_0x3595('0x60')](_0x4695ea)){this[_0x3595('0x12')][_0xc800fb][_0x3595('0x75')][_0x3595('0x76')]({'filename':_0x551e56,'createdAt':moment()[_0x3595('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x3595('0x77')});}}}catch(_0x28e467){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0xc800fb,util[_0x3595('0x45')](_0x28e467,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x4dea0e){try{if(this['isNotNull'](_0x4dea0e)){logger[_0x3595('0x34')](_0x3595('0x78'),_0x4dea0e[_0x3595('0x31')],util[_0x3595('0x45')](_0x4dea0e,{'showHidden':![],'depth':null}));if(this['channels'][_0x4dea0e['uniqueid']]&&_0x4dea0e[_0x3595('0x3d')]!=_0x3595('0x46')){if(this[_0x3595('0x2c')](_0x4dea0e[_0x3595('0x79')])){if(this['isNotNull'](_0x4dea0e[_0x3595('0x79')][_0x3595('0x7a')])){logger[_0x3595('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4dea0e[_0x3595('0x31')],_0x4dea0e['value']);this[_0x3595('0x6f')](_0x4dea0e['uniqueid'],_0x4dea0e[_0x3595('0x7b')]);}else if(this[_0x3595('0x2c')](_0x4dea0e[_0x3595('0x79')][_0x3595('0x7c')])){logger['info'](_0x3595('0x7d'),_0x4dea0e[_0x3595('0x31')],_0x4dea0e['value']);this[_0x3595('0x12')][_0x4dea0e['uniqueid']][_0x3595('0x33')]=_0x4dea0e[_0x3595('0x7b')];}else if(this['isNotNull'](_0x4dea0e[_0x3595('0x79')][_0x3595('0x7e')])){logger['info'](_0x3595('0x7f'),_0x4dea0e['uniqueid'],_0x4dea0e[_0x3595('0x7b')]);this[_0x3595('0x12')][_0x4dea0e['uniqueid']]['callerid']=_0x4dea0e[_0x3595('0x7b')];}else if(this[_0x3595('0x2c')](_0x4dea0e['variable'][_0x3595('0x80')])){logger[_0x3595('0x26')](_0x3595('0x81'),_0x4dea0e['uniqueid'],_0x4dea0e[_0x3595('0x7b')]);this['channels'][_0x4dea0e[_0x3595('0x31')]][_0x3595('0x5f')]=_0x4dea0e[_0x3595('0x7b')];}else if(this[_0x3595('0x2c')](_0x4dea0e[_0x3595('0x79')][_0x3595('0x82')])){logger[_0x3595('0x26')](_0x3595('0x83'),_0x4dea0e[_0x3595('0x31')],_0x4dea0e[_0x3595('0x7b')][_0x3595('0x3a')](',')[0x0]);this[_0x3595('0x12')][_0x4dea0e[_0x3595('0x31')]][_0x3595('0x6')]=_0x4dea0e[_0x3595('0x7b')][_0x3595('0x3a')](',')[0x0];}else if(this[_0x3595('0x2c')](_0x4dea0e[_0x3595('0x79')][_0x3595('0x84')])){logger[_0x3595('0x26')](_0x3595('0x85'),_0x4dea0e['uniqueid'],_0x4dea0e['value']);this[_0x3595('0x12')][_0x4dea0e[_0x3595('0x31')]][_0x3595('0x86')]=_0x4dea0e[_0x3595('0x7b')];}else if(this[_0x3595('0x2c')](_0x4dea0e[_0x3595('0x79')]['xmd-destination'])){logger[_0x3595('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x4dea0e[_0x3595('0x31')],_0x4dea0e[_0x3595('0x7b')]);this[_0x3595('0x12')][_0x4dea0e[_0x3595('0x31')]][_0x3595('0x87')]=_0x4dea0e['value'];}else if(this[_0x3595('0x2c')](_0x4dea0e[_0x3595('0x79')][_0x3595('0x88')])){logger['info'](_0x3595('0x89'),_0x4dea0e[_0x3595('0x31')],_0x4dea0e[_0x3595('0x7b')]);this[_0x3595('0x12')][_0x4dea0e[_0x3595('0x31')]][_0x3595('0x8a')]=_0x4dea0e['value'];}else if(this['isNotNull'](_0x4dea0e[_0x3595('0x79')]['xmcs-queue'])){logger[_0x3595('0x26')](_0x3595('0x8b'),_0x4dea0e['uniqueid'],_0x4dea0e[_0x3595('0x7b')]);this['channels'][_0x4dea0e[_0x3595('0x31')]][_0x3595('0x6')]=_0x4dea0e[_0x3595('0x7b')];}else if(this['isNotNull'](_0x4dea0e['variable']['sipcallid'])){logger[_0x3595('0x26')](_0x3595('0x8c'),_0x4dea0e[_0x3595('0x31')],_0x4dea0e['value']);this[_0x3595('0x12')][_0x4dea0e[_0x3595('0x31')]][_0x3595('0x8d')]=_0x4dea0e[_0x3595('0x7b')];}}}else if(this['isNotNull'](_0x4dea0e['variable'][_0x3595('0x7a')])){if(_0x4dea0e[_0x3595('0x7b')]){var _0x50327f=path['parse'](_0x4dea0e['value'])[_0x3595('0x42')];logger['info'](_0x3595('0x8e'),_0x50327f,_0x4dea0e[_0x3595('0x7b')]);this['syncMixMonitorFilename'](_0x50327f,_0x4dea0e[_0x3595('0x7b')]);}}else if(this[_0x3595('0x12')][_0x4dea0e[_0x3595('0x36')]]){if(this['isNotNull'](_0x4dea0e['variable'])){if(this[_0x3595('0x2c')](_0x4dea0e[_0x3595('0x79')][_0x3595('0x8f')])){logger[_0x3595('0x26')](_0x3595('0x8c'),_0x4dea0e['linkedid'],_0x4dea0e[_0x3595('0x7b')]);this[_0x3595('0x12')][_0x4dea0e[_0x3595('0x36')]][_0x3595('0x90')]=_0x4dea0e['value'];}}}}}catch(_0x5491f6){logger['error'](_0x3595('0x91'),_0x4dea0e[_0x3595('0x31')],util['inspect'](_0x5491f6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3595('0x2b')]['syncHangup']=function(_0xaffd64){try{if(this[_0x3595('0x2c')](_0xaffd64)){logger[_0x3595('0x34')](_0x3595('0x92'),_0xaffd64[_0x3595('0x31')],util[_0x3595('0x45')](_0xaffd64,{'showHidden':![],'depth':null}));if(this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]]){if(this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x36')]]){this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x36')]]['uniqueid']=_0xaffd64[_0x3595('0x31')];this[_0x3595('0x12')][this['blindTransfers'][_0xaffd64[_0x3595('0x36')]][_0x3595('0x36')]][_0x3595('0x64')]=this[_0x3595('0x12')][_0xaffd64['uniqueid']][_0x3595('0x64')];this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x36')]]['answertime']=this[_0x3595('0x12')][_0xaffd64['uniqueid']][_0x3595('0x65')];this['channels'][this['blindTransfers'][_0xaffd64['linkedid']][_0x3595('0x36')]][_0x3595('0x69')]=this['channels'][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x36')]]['channel'];this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]]['linkedid']]['disposition']=this['channels'][_0xaffd64['uniqueid']][_0x3595('0x4a')];this[_0x3595('0x12')][_0xaffd64[_0x3595('0x31')]]=this['channels'][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x36')]];delete this[_0x3595('0x12')][this['blindTransfers'][_0xaffd64['linkedid']][_0x3595('0x36')]];}else if(this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]]['uniqueid']]){this['channels'][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x31')]][_0x3595('0x31')]=[this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64['linkedid']][_0x3595('0x31')]][_0x3595('0x36')],this['channels'][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x31')]]['linkedid']=this['channels'][this['blindTransfers'][_0xaffd64['linkedid']]['uniqueid']]['uniqueid']][0x0];this[_0x3595('0x12')][this['blindTransfers'][_0xaffd64[_0x3595('0x36')]][_0x3595('0x31')]]['answered']=this[_0x3595('0x12')][_0xaffd64[_0x3595('0x31')]][_0x3595('0x64')];this['channels'][this['blindTransfers'][_0xaffd64[_0x3595('0x36')]][_0x3595('0x31')]]['answertime']=this[_0x3595('0x12')][_0xaffd64[_0x3595('0x31')]]['answertime'];this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64['linkedid']][_0x3595('0x31')]][_0x3595('0x69')]=this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64['linkedid']][_0x3595('0x31')]][_0x3595('0x3d')];this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x31')]][_0x3595('0x4a')]=this[_0x3595('0x12')][_0xaffd64['uniqueid']][_0x3595('0x4a')];this['channels'][_0xaffd64['uniqueid']]=this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]][_0x3595('0x31')]];delete this[_0x3595('0x12')][this[_0x3595('0x14')][_0xaffd64[_0x3595('0x36')]]['uniqueid']];}}if(this[_0x3595('0x12')][_0xaffd64[_0x3595('0x31')]]){logger[_0x3595('0x26')](_0x3595('0x93'),_0xaffd64[_0x3595('0x31')],_0xaffd64[_0x3595('0x94')]);var _0x282d19=moment();this[_0x3595('0x12')][_0xaffd64['uniqueid']][_0x3595('0x95')]=_0x282d19[_0x3595('0x40')](_0x3595('0x49'));this['channels'][_0xaffd64[_0x3595('0x31')]][_0x3595('0x57')]=_0x282d19[_0x3595('0x67')](this[_0x3595('0x12')][_0xaffd64[_0x3595('0x31')]]['starttime'],_0x3595('0x58'));if(this[_0x3595('0x12')][_0xaffd64['uniqueid']][_0x3595('0x64')]){this['channels'][_0xaffd64['uniqueid']][_0x3595('0x96')]=_0x282d19[_0x3595('0x67')](this[_0x3595('0x12')][_0xaffd64['uniqueid']][_0x3595('0x65')],_0x3595('0x58'));this['channels'][_0xaffd64[_0x3595('0x31')]][_0x3595('0x66')]=this[_0x3595('0x12')][_0xaffd64[_0x3595('0x31')]]['duration']-this[_0x3595('0x12')][_0xaffd64[_0x3595('0x31')]][_0x3595('0x96')];}if(_0xaffd64['context']===_0x3595('0x39')){if(this[_0x3595('0x13')][_0xaffd64[_0x3595('0x3d')]['split']('-')[0x0]]){this['agents'][_0xaffd64[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]=_[_0x3595('0x97')](this[_0x3595('0x13')][_0xaffd64[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]],['destconnectedlinenum']);logger[_0x3595('0x34')](_0x3595('0x98'),_0xaffd64['uniqueid'],util[_0x3595('0x45')]({'id':this[_0x3595('0x13')][_0xaffd64[_0x3595('0x3d')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xaffd64[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]][_0x3595('0x4e')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x3595('0x41'),this[_0x3595('0x13')][_0xaffd64[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['name']),_0x3595('0x99'),{'id':this['agents'][_0xaffd64[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x3595('0x13')][_0xaffd64[_0x3595('0x3d')][_0x3595('0x3a')]('-')[0x0]]['accountcode']});for(var _0x5c0b40=0x0;_0x5c0b400x0?_0x17edb0:0x0;this['voiceQueues'][_0x47be99[_0x5b80('0x67')]][_0x5b80('0x56')]=this[_0x5b80('0x13')][_0x47be99[_0x5b80('0x67')]][_0x5b80('0x56')]>_[_0x5b80('0x6b')](_0x47be99['loggedin'])?_[_0x5b80('0x6b')](_0x47be99[_0x5b80('0x6d')]):this[_0x5b80('0x13')][_0x47be99[_0x5b80('0x67')]][_0x5b80('0x56')];this['emitVoiceQueueSummary'](this[_0x5b80('0x13')][_0x47be99[_0x5b80('0x67')]],_0x5b80('0x64'));}logger[_0x5b80('0x4b')](_0x5b80('0x6e'),util[_0x5b80('0x3c')](this[_0x5b80('0x13')][_0x47be99[_0x5b80('0x67')]],{'showHidden':![],'depth':null}));ami[_0x5b80('0x44')](_0x5b80('0x6f'),this[_0x5b80('0x13')][_0x47be99[_0x5b80('0x67')]]);}}}catch(_0xaf5224){logger[_0x5b80('0x3a')]('[voiceQueueReport][queuesummary]',util[_0x5b80('0x3c')](_0xaf5224,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5b80('0xd')][_0x5b80('0x18')]=function(_0x61af49){logger[_0x5b80('0x4b')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x5b80('0x3c')](_0x61af49,{'showHidden':![],'depth':null}));this[_0x5b80('0x14')]=!![];};VoiceQueueReport[_0x5b80('0xd')][_0x5b80('0x19')]=function(_0x535398){try{if(this[_0x5b80('0x60')](_0x535398)){logger[_0x5b80('0x4b')](_0x5b80('0x70'),_0x535398[_0x5b80('0x4d')],util[_0x5b80('0x3c')](_0x535398,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x5b80('0x3d')][_0x535398[_0x5b80('0x4d')]]))this[_0x5b80('0x3d')][_0x535398[_0x5b80('0x4d')]]=[];if(_['isUndefined'](this[_0x5b80('0x11')][_0x535398[_0x5b80('0x4d')]]))this['channels'][_0x535398[_0x5b80('0x4d')]]={};var _0x187806=new QueueReport();_0x187806[_0x5b80('0x49')]=_0x535398[_0x5b80('0x67')];_0x187806[_0x5b80('0x50')]=this[_0x5b80('0x13')][_0x187806[_0x5b80('0x49')]]&&this[_0x5b80('0x13')][_0x187806[_0x5b80('0x49')]][_0x5b80('0x50')]?this['voiceQueues'][_0x187806[_0x5b80('0x49')]][_0x5b80('0x50')]||_0x5b80('0x51'):'inbound';_0x187806[_0x5b80('0x67')]=_0x535398[_0x5b80('0x67')];_0x187806['queuecallerjoinAt']=moment()[_0x5b80('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x187806[_0x5b80('0x71')]=_0x535398[_0x5b80('0x71')];_0x187806[_0x5b80('0x72')]=_0x535398['count'];_0x187806[_0x5b80('0x4d')]=_0x535398[_0x5b80('0x4d')];_0x187806[_0x5b80('0x73')]=this['channels'][_0x535398[_0x5b80('0x4d')]][_0x5b80('0x73')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x187806['name'],_0x187806[_0x5b80('0x50')]);_['merge'](_0x187806,_[_0x5b80('0x74')](_0x535398,_['keys'](_0x187806)));this[_0x5b80('0x3d')][_0x535398[_0x5b80('0x4d')]][_0x5b80('0x75')](_0x187806);this[_0x5b80('0x11')][_0x535398[_0x5b80('0x4d')]]=_0x187806;this[_0x5b80('0x45')](_0x187806,'queuecallerjoin');}}catch(_0xf376cb){logger['error'](_0x5b80('0x70'),_0x535398[_0x5b80('0x4d')],util['inspect'](_0xf376cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5b80('0xd')][_0x5b80('0x1b')]=function(_0x5e7a56){try{if(this[_0x5b80('0x60')](_0x5e7a56)){logger['debug'](_0x5b80('0x76'),_0x5e7a56[_0x5b80('0x4d')],util['inspect'](_0x5e7a56,{'showHidden':![],'depth':null}));if(this[_0x5b80('0x3d')][_0x5e7a56[_0x5b80('0x4d')]]){var _0x4f07d3=_['last'](this['queueReports'][_0x5e7a56[_0x5b80('0x4d')]]);_0x4f07d3['queuecallercomplete']=![];_0x4f07d3[_0x5b80('0x77')]=null;_0x4f07d3[_0x5b80('0x78')]=_0x5e7a56['holdtime'];_0x4f07d3['originalposition']=_0x5e7a56[_0x5b80('0x79')];_0x4f07d3['queuecallerabandon']=!![];_0x4f07d3['queuecallerabandonAt']=moment()[_0x5b80('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f07d3[_0x5b80('0x7a')]=_0x5b80('0x7b');_0x4f07d3[_0x5b80('0x7c')]=null;logger['info'](_0x5b80('0x7d'),_0x4f07d3[_0x5b80('0x49')],_0x4f07d3[_0x5b80('0x50')]);this[_0x5b80('0x11')][_0x5e7a56['uniqueid']]=_0x4f07d3;this[_0x5b80('0x42')](_0x4f07d3,_0x5b80('0x1a'));}}}catch(_0xf59ea8){logger[_0x5b80('0x3a')](_0x5b80('0x76'),_0x5e7a56[_0x5b80('0x4d')],util['inspect'](_0xf59ea8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5b80('0xd')][_0x5b80('0x7e')]=function(_0x4ba35c){try{if(this[_0x5b80('0x60')](_0x4ba35c)){logger[_0x5b80('0x4b')](_0x5b80('0x7f'),_0x4ba35c[_0x5b80('0x4d')],util['inspect'](_0x4ba35c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4ba35c[_0x5b80('0x4d')]]){var _0x27b86c=_[_0x5b80('0x80')](this[_0x5b80('0x3d')][_0x4ba35c['uniqueid']]);_0x27b86c[_0x5b80('0x81')]=moment()[_0x5b80('0x5e')](_0x5b80('0x82'));_0x27b86c[_0x5b80('0x83')]=_0x4ba35c[_0x5b80('0x83')];_0x27b86c[_0x5b80('0x84')]=_0x4ba35c[_0x5b80('0x84')];logger[_0x5b80('0x69')](_0x5b80('0x85'),_0x27b86c['name'],_0x27b86c['type'],_0x4ba35c[_0x5b80('0x83')],_0x4ba35c['connectedlinename']);this[_0x5b80('0x11')][_0x4ba35c[_0x5b80('0x4d')]]=_0x27b86c;this['emitVoiceQueueChannelSave'](_0x27b86c,_0x5b80('0x86'));}}}catch(_0x3b2364){logger[_0x5b80('0x3a')]('[%s][voiceQueueReport][queuecallerleave]',_0x4ba35c[_0x5b80('0x4d')],util[_0x5b80('0x3c')](_0x3b2364,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5b80('0x1e')]=function(_0x20c8a6){try{if(this['isNotNull'](_0x20c8a6)){logger[_0x5b80('0x4b')]('[%s][voiceQueueReport][agentconnect]',_0x20c8a6[_0x5b80('0x4d')],util[_0x5b80('0x3c')](_0x20c8a6,{'showHidden':![],'depth':null}));if(this[_0x5b80('0x3d')][_0x20c8a6[_0x5b80('0x4d')]]){var _0x48d0c0=_[_0x5b80('0x80')](this[_0x5b80('0x3d')][_0x20c8a6[_0x5b80('0x4d')]]);_0x48d0c0[_0x5b80('0x87')]=!![];_0x48d0c0[_0x5b80('0x7a')]=_0x5b80('0x88');logger[_0x5b80('0x69')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x48d0c0[_0x5b80('0x49')],_0x48d0c0[_0x5b80('0x50')]);}}}catch(_0x2fae7a){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x20c8a6[_0x5b80('0x4d')],util[_0x5b80('0x3c')](_0x2fae7a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x2cc1c4){try{if(this[_0x5b80('0x60')](_0x2cc1c4)){logger[_0x5b80('0x4b')](_0x5b80('0x89'),_0x2cc1c4['uniqueid'],util[_0x5b80('0x3c')](_0x2cc1c4,{'showHidden':![],'depth':null}));if(this[_0x5b80('0x3d')][_0x2cc1c4[_0x5b80('0x4d')]]){var _0x455c94=_[_0x5b80('0x80')](this[_0x5b80('0x3d')][_0x2cc1c4[_0x5b80('0x4d')]]);_0x455c94[_0x5b80('0x1a')]=![];_0x455c94[_0x5b80('0x8a')]=null;_0x455c94[_0x5b80('0x8b')]=!![];_0x455c94[_0x5b80('0x7c')]=_0x2cc1c4[_0x5b80('0x8c')];_0x455c94[_0x5b80('0x78')]=_0x2cc1c4['holdtime'];_0x455c94[_0x5b80('0x87')]=!![];_0x455c94['queuecallerexit']=![];_0x455c94[_0x5b80('0x8d')]=null;if(!_0x455c94[_0x5b80('0x8e')]){if(_0x2cc1c4['reason']==_0x5b80('0x8e')){_0x455c94[_0x5b80('0x7a')]='COMPLETED';logger[_0x5b80('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x455c94[_0x5b80('0x49')],_0x455c94[_0x5b80('0x50')]);}else{if(_[_0x5b80('0x8f')](_0x2cc1c4[_0x5b80('0x36')]['toLowerCase'](),'local/')){if(this['queueReports'][_0x2cc1c4[_0x5b80('0x90')]]){var _0x354bb7=_[_0x5b80('0x80')](this['queueReports'][_0x2cc1c4[_0x5b80('0x90')]]);_0x354bb7[_0x5b80('0x87')]=![];_0x354bb7['queuecallerexit']=!![];_0x354bb7[_0x5b80('0x8d')]=moment(_0x455c94[_0x5b80('0x91')])['add'](_0x2cc1c4[_0x5b80('0x78')],_0x5b80('0x92'))[_0x5b80('0x5e')](_0x5b80('0x82'));_0x354bb7[_0x5b80('0x7a')]='FORWARDTRANSFER';_0x354bb7[_0x5b80('0x8e')]=!![];_0x354bb7[_0x5b80('0x93')]='FORWARD';_0x354bb7[_0x5b80('0x94')]=_0x2cc1c4[_0x5b80('0x95')];_0x354bb7['transferuniqueid']=_0x2cc1c4[_0x5b80('0x4d')];logger[_0x5b80('0x69')](_0x5b80('0x96'),_0x354bb7['name'],_0x354bb7[_0x5b80('0x50')]);var _0x3c1e4b=this[_0x5b80('0x3d')][_0x2cc1c4['linkedid']];this[_0x5b80('0x3d')][_0x2cc1c4['linkedid']]=this['queueReports'][_0x2cc1c4[_0x5b80('0x4d')]];this[_0x5b80('0x3d')][_0x2cc1c4[_0x5b80('0x4d')]]=_0x3c1e4b;}}else{_0x455c94[_0x5b80('0x7a')]='COMPLETEDBY'+_0x2cc1c4[_0x5b80('0x97')]['toUpperCase']();logger['info'](_0x5b80('0x98'),_0x455c94[_0x5b80('0x49')],_0x455c94[_0x5b80('0x50')],_0x455c94[_0x5b80('0x7a')]);}}}this[_0x5b80('0x11')][_0x2cc1c4['uniqueid']]=_0x455c94;this[_0x5b80('0x42')](_0x455c94,_0x5b80('0x99'));}}}catch(_0x171e15){logger[_0x5b80('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x2cc1c4[_0x5b80('0x4d')],util[_0x5b80('0x3c')](_0x171e15,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5b80('0x9a')]=function(_0x403311){try{if(this[_0x5b80('0x60')](_0x403311)){logger[_0x5b80('0x4b')](_0x5b80('0x9b'),_0x403311[_0x5b80('0x4d')],util[_0x5b80('0x3c')](_0x403311,{'showHidden':![],'depth':null}));this['addVariable'](_0x403311[_0x5b80('0x4d')],_[_0x5b80('0x9c')](_0x403311['variable'])[0x0],_0x403311[_0x5b80('0x9d')]);if(this['queueReports'][_0x403311[_0x5b80('0x4d')]]){var _0x79ee56=_[_0x5b80('0x80')](this['queueReports'][_0x403311['uniqueid']]);if(_0x79ee56){if(this[_0x5b80('0x60')](_0x403311[_0x5b80('0x9e')])&&this['isNotNull'](_0x403311[_0x5b80('0x9e')][_0x5b80('0x9f')])){switch(_0x403311[_0x5b80('0x9d')]){case _0x5b80('0xa0'):_0x79ee56['queuecallerexit']=![];_0x79ee56[_0x5b80('0x8d')]=null;break;case _0x5b80('0xa1'):_0x79ee56[_0x5b80('0xa2')]=_0x5b80('0xa3');_0x79ee56[_0x5b80('0xa4')]=!![];_0x79ee56[_0x5b80('0x8d')]=moment()[_0x5b80('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x79ee56[_0x5b80('0x81')]=moment()['format'](_0x5b80('0x82'));logger[_0x5b80('0x4b')](_0x5b80('0xa5'),_0x403311['uniqueid'],util['inspect'](_0x79ee56,{'showHidden':![],'depth':null}));ami[_0x5b80('0x44')](_0x5b80('0xa6'),_0x79ee56);break;default:_0x79ee56[_0x5b80('0xa4')]=!![];_0x79ee56['queuecallerexitAt']=moment()['format'](_0x5b80('0x82'));_0x79ee56['queuecallerleaveAt']=moment()[_0x5b80('0x5e')](_0x5b80('0x82'));}_0x79ee56[_0x5b80('0x1a')]=![];_0x79ee56[_0x5b80('0x8a')]=null;_0x79ee56[_0x5b80('0x7a')]=_0x403311[_0x5b80('0x9d')];this[_0x5b80('0x11')][_0x403311['uniqueid']]=_0x79ee56;this[_0x5b80('0x42')](_0x79ee56,'varset');}else if(this[_0x5b80('0x60')](_0x403311[_0x5b80('0x9e')])&&this[_0x5b80('0x60')](_0x403311[_0x5b80('0x9e')][_0x5b80('0xa7')])){if(!_0x79ee56[_0x5b80('0x1a')]){_0x79ee56[_0x5b80('0xa4')]=!![];_0x79ee56[_0x5b80('0x8d')]=moment()[_0x5b80('0x5e')](_0x5b80('0x82'));_0x79ee56[_0x5b80('0x7a')]='EXITWITHKEY';_0x79ee56[_0x5b80('0x81')]=moment()[_0x5b80('0x5e')](_0x5b80('0x82'));this[_0x5b80('0x11')][_0x403311[_0x5b80('0x4d')]]=_0x79ee56;}}logger[_0x5b80('0x69')](_0x5b80('0xa8'),_0x403311[_0x5b80('0x4d')],_0x79ee56['name'],_0x79ee56[_0x5b80('0x50')],_[_0x5b80('0x9c')](_0x403311['variable'])[0x0],_0x403311[_0x5b80('0x9d')]);_0x79ee56[_0x5b80('0x16')]=this['variables'][_0x403311[_0x5b80('0x4d')]];}}}}catch(_0x3d6a29){logger[_0x5b80('0x3a')](_0x5b80('0x9b'),_0x403311[_0x5b80('0x4d')],util['inspect'](_0x3d6a29,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5b80('0xd')]['addVariable']=function(_0x15c415,_0x48e5ec,_0x564349){var _0x2738b9=[_0x5b80('0xa9'),_0x5b80('0xaa'),'rtpaudioqosjitter',_0x5b80('0xab'),_0x5b80('0xac'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x5b80('0xad'),_0x5b80('0xae'),_0x5b80('0xaf'),_0x5b80('0xb0'),'bridgepvtcallid','membercalls',_0x5b80('0xb1'),'memberinterface','memberlastcall',_0x5b80('0x8c'),'memberpenalty',_0x5b80('0xb2')];if(!_[_0x5b80('0x33')](_0x48e5ec)&&!_[_0x5b80('0xb3')](_0x2738b9,_0x48e5ec)){if(_[_0x5b80('0x61')](this[_0x5b80('0x16')][_0x15c415])){this[_0x5b80('0x16')][_0x15c415]={};}this['variables'][_0x15c415][_0x48e5ec]=_0x564349;}};VoiceQueueReport[_0x5b80('0xd')][_0x5b80('0x20')]=function(_0x1b647d){try{if(this['isNotNull'](_0x1b647d)){logger['debug']('[%s][voiceQueueReport][hangup]',_0x1b647d['uniqueid'],util[_0x5b80('0x3c')](_0x1b647d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1b647d[_0x5b80('0x4d')]]){for(var _0x4a997d=0x0,_0x209222={};_0x4a997d0x0?_0x2283c3:0x0;this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]][_0x3f92('0x34')]=this[_0x3f92('0x15')][_0x43950c['queue']][_0x3f92('0x34')]>_[_0x3f92('0x6a')](_0x43950c[_0x3f92('0x6d')])?_[_0x3f92('0x6a')](_0x43950c[_0x3f92('0x6d')]):this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]][_0x3f92('0x34')];this[_0x3f92('0x6f')](this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]],_0x3f92('0x19'));}logger[_0x3f92('0x51')](_0x3f92('0x70'),util[_0x3f92('0x43')](this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]],{'showHidden':![],'depth':null}));ami[_0x3f92('0x48')](_0x3f92('0x71'),this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]]);}}}catch(_0x5748ab){logger[_0x3f92('0x40')](_0x3f92('0x65'),util['inspect'](_0x5748ab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f92('0xd')][_0x3f92('0x72')]=function(_0x5f28c0){logger[_0x3f92('0x51')](_0x3f92('0x73'),util['inspect'](_0x5f28c0,{'showHidden':![],'depth':null}));this[_0x3f92('0x16')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x51311a){try{if(this['isNotNull'](_0x51311a)){logger[_0x3f92('0x51')](_0x3f92('0x74'),_0x51311a[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x51311a,{'showHidden':![],'depth':null}));if(_[_0x3f92('0x63')](this[_0x3f92('0x12')][_0x51311a[_0x3f92('0x4b')]]))this[_0x3f92('0x12')][_0x51311a['uniqueid']]=[];if(_[_0x3f92('0x63')](this[_0x3f92('0x38')][_0x51311a[_0x3f92('0x4b')]]))this[_0x3f92('0x38')][_0x51311a['uniqueid']]={};var _0x8c5c56=new QueueReport();_0x8c5c56['name']=_0x51311a[_0x3f92('0x66')];_0x8c5c56[_0x3f92('0x55')]=this['voiceQueues'][_0x8c5c56[_0x3f92('0x4d')]]&&this[_0x3f92('0x15')][_0x8c5c56['name']]['type']?this[_0x3f92('0x15')][_0x8c5c56[_0x3f92('0x4d')]][_0x3f92('0x55')]||'inbound':'inbound';_0x8c5c56['queue']=_0x51311a[_0x3f92('0x66')];_0x8c5c56[_0x3f92('0x75')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));_0x8c5c56[_0x3f92('0x77')]=_0x51311a['position'];_0x8c5c56[_0x3f92('0x78')]=_0x51311a[_0x3f92('0x78')];_0x8c5c56[_0x3f92('0x4b')]=_0x51311a[_0x3f92('0x4b')];_0x8c5c56[_0x3f92('0x79')]=this['channels'][_0x51311a[_0x3f92('0x4b')]][_0x3f92('0x79')];logger[_0x3f92('0x67')](_0x3f92('0x7a'),_0x8c5c56[_0x3f92('0x4d')],_0x8c5c56[_0x3f92('0x55')]);_[_0x3f92('0x7b')](_0x8c5c56,_[_0x3f92('0x7c')](_0x51311a,_[_0x3f92('0x7d')](_0x8c5c56)));this[_0x3f92('0x12')][_0x51311a[_0x3f92('0x4b')]]['push'](_0x8c5c56);this[_0x3f92('0x38')][_0x51311a[_0x3f92('0x4b')]]=_0x8c5c56;this[_0x3f92('0x49')](_0x8c5c56,_0x3f92('0x1c'));}}catch(_0xf3c886){logger[_0x3f92('0x40')](_0x3f92('0x74'),_0x51311a[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0xf3c886,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3f92('0x20')]=function(_0x11c483){try{if(this[_0x3f92('0x62')](_0x11c483)){logger[_0x3f92('0x51')](_0x3f92('0x7e'),_0x11c483[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x11c483,{'showHidden':![],'depth':null}));if(this[_0x3f92('0x12')][_0x11c483['uniqueid']]){var _0x21dfae=_[_0x3f92('0x7f')](this['queueReports'][_0x11c483[_0x3f92('0x4b')]]);_0x21dfae[_0x3f92('0x80')]=![];_0x21dfae[_0x3f92('0x81')]=null;_0x21dfae[_0x3f92('0x82')]=_0x11c483['holdtime'];_0x21dfae[_0x3f92('0x83')]=_0x11c483['originalposition'];_0x21dfae[_0x3f92('0x1f')]=!![];_0x21dfae[_0x3f92('0x84')]=moment()[_0x3f92('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x21dfae['queuecallerexitreason']=_0x3f92('0x85');_0x21dfae[_0x3f92('0x86')]=null;logger[_0x3f92('0x67')](_0x3f92('0x87'),_0x21dfae[_0x3f92('0x4d')],_0x21dfae[_0x3f92('0x55')]);this[_0x3f92('0x38')][_0x11c483[_0x3f92('0x4b')]]=_0x21dfae;this[_0x3f92('0x50')](_0x21dfae,_0x3f92('0x1f'));}}}catch(_0xd07df0){logger[_0x3f92('0x40')](_0x3f92('0x7e'),_0x11c483[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0xd07df0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f92('0xd')]['syncQueueCallerLeave']=function(_0x171e5f){try{if(this[_0x3f92('0x62')](_0x171e5f)){logger[_0x3f92('0x51')]('[%s][voiceQueueReport][queuecallerleave]',_0x171e5f[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x171e5f,{'showHidden':![],'depth':null}));if(this[_0x3f92('0x12')][_0x171e5f[_0x3f92('0x4b')]]){var _0x525886=_[_0x3f92('0x7f')](this['queueReports'][_0x171e5f['uniqueid']]);_0x525886[_0x3f92('0x88')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));_0x525886[_0x3f92('0x89')]=_0x171e5f[_0x3f92('0x89')];_0x525886['connectedlinename']=_0x171e5f['connectedlinename'];logger[_0x3f92('0x67')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x525886[_0x3f92('0x4d')],_0x525886[_0x3f92('0x55')],_0x171e5f[_0x3f92('0x89')],_0x171e5f[_0x3f92('0x8a')]);this[_0x3f92('0x38')][_0x171e5f[_0x3f92('0x4b')]]=_0x525886;this[_0x3f92('0x49')](_0x525886,'queuecallerleave');}}}catch(_0x5df6d9){logger['error'](_0x3f92('0x8b'),_0x171e5f[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x5df6d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3f92('0x24')]=function(_0x139d7d){try{if(this[_0x3f92('0x62')](_0x139d7d)){logger[_0x3f92('0x51')](_0x3f92('0x8c'),_0x139d7d[_0x3f92('0x4b')],util['inspect'](_0x139d7d,{'showHidden':![],'depth':null}));if(this[_0x3f92('0x12')][_0x139d7d[_0x3f92('0x4b')]]){var _0x8a15d7=_[_0x3f92('0x7f')](this[_0x3f92('0x12')][_0x139d7d['uniqueid']]);_0x8a15d7[_0x3f92('0x80')]=!![];_0x8a15d7[_0x3f92('0x8d')]=_0x3f92('0x8e');logger[_0x3f92('0x67')](_0x3f92('0x8f'),_0x8a15d7['name'],_0x8a15d7[_0x3f92('0x55')]);}}}catch(_0x33c476){logger['error'](_0x3f92('0x8c'),_0x139d7d[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x33c476,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f92('0xd')][_0x3f92('0x22')]=function(_0x51c401){try{if(this[_0x3f92('0x62')](_0x51c401)){logger[_0x3f92('0x51')]('[%s][voiceQueueReport][agentcomplete]',_0x51c401[_0x3f92('0x4b')],util['inspect'](_0x51c401,{'showHidden':![],'depth':null}));if(this[_0x3f92('0x12')][_0x51c401[_0x3f92('0x4b')]]){var _0x1e1e5a=_[_0x3f92('0x7f')](this[_0x3f92('0x12')][_0x51c401[_0x3f92('0x4b')]]);_0x1e1e5a[_0x3f92('0x1f')]=![];_0x1e1e5a[_0x3f92('0x84')]=null;_0x1e1e5a[_0x3f92('0x90')]=!![];_0x1e1e5a[_0x3f92('0x86')]=_0x51c401[_0x3f92('0x91')];_0x1e1e5a[_0x3f92('0x82')]=_0x51c401['holdtime'];_0x1e1e5a[_0x3f92('0x80')]=!![];_0x1e1e5a[_0x3f92('0x92')]=![];_0x1e1e5a[_0x3f92('0x93')]=null;if(!_0x1e1e5a[_0x3f92('0x94')]){if(_0x51c401['reason']==_0x3f92('0x94')){_0x1e1e5a[_0x3f92('0x8d')]=_0x3f92('0x95');logger[_0x3f92('0x67')](_0x3f92('0x96'),_0x1e1e5a[_0x3f92('0x4d')],_0x1e1e5a[_0x3f92('0x55')]);}else{if(_[_0x3f92('0x97')](_0x51c401['channel'][_0x3f92('0x98')](),'local/')){if(this[_0x3f92('0x12')][_0x51c401['linkedid']]){var _0x5baa1a=_[_0x3f92('0x7f')](this[_0x3f92('0x12')][_0x51c401[_0x3f92('0x99')]]);_0x5baa1a[_0x3f92('0x80')]=![];_0x5baa1a[_0x3f92('0x92')]=!![];_0x5baa1a[_0x3f92('0x93')]=moment(_0x1e1e5a['queuecallerjoinAt'])[_0x3f92('0x9a')](_0x51c401['holdtime'],_0x3f92('0x9b'))['format'](_0x3f92('0x76'));_0x5baa1a[_0x3f92('0x8d')]=_0x3f92('0x9c');_0x5baa1a[_0x3f92('0x94')]=!![];_0x5baa1a[_0x3f92('0x9d')]=_0x3f92('0x9e');_0x5baa1a[_0x3f92('0x9f')]=_0x51c401['destexten'];_0x5baa1a[_0x3f92('0xa0')]=_0x51c401['uniqueid'];logger[_0x3f92('0x67')](_0x3f92('0xa1'),_0x5baa1a[_0x3f92('0x4d')],_0x5baa1a[_0x3f92('0x55')]);var _0x56ae73=this['queueReports'][_0x51c401['linkedid']];this['queueReports'][_0x51c401[_0x3f92('0x99')]]=this[_0x3f92('0x12')][_0x51c401['uniqueid']];this[_0x3f92('0x12')][_0x51c401['uniqueid']]=_0x56ae73;}}else{_0x1e1e5a[_0x3f92('0x8d')]=_0x3f92('0xa2')+_0x51c401[_0x3f92('0xa3')][_0x3f92('0xa4')]();logger[_0x3f92('0x67')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1e1e5a[_0x3f92('0x4d')],_0x1e1e5a['type'],_0x1e1e5a[_0x3f92('0x8d')]);}}}this[_0x3f92('0x38')][_0x51c401[_0x3f92('0x4b')]]=_0x1e1e5a;this[_0x3f92('0x50')](_0x1e1e5a,_0x3f92('0xa5'));}}}catch(_0x2ad40a){logger[_0x3f92('0x40')](_0x3f92('0xa6'),_0x51c401[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x2ad40a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x5d3399){try{if(this[_0x3f92('0x62')](_0x5d3399)){logger[_0x3f92('0x51')](_0x3f92('0xa7'),_0x5d3399['uniqueid'],util[_0x3f92('0x43')](_0x5d3399,{'showHidden':![],'depth':null}));this[_0x3f92('0xa8')](_0x5d3399['uniqueid'],_[_0x3f92('0x7d')](_0x5d3399[_0x3f92('0xa9')])[0x0],_0x5d3399[_0x3f92('0xaa')]);if(this[_0x3f92('0x12')][_0x5d3399['uniqueid']]){var _0xe99b1e=_[_0x3f92('0x7f')](this[_0x3f92('0x12')][_0x5d3399['uniqueid']]);if(_0xe99b1e){if(this['isNotNull'](_0x5d3399[_0x3f92('0xa9')])&&this[_0x3f92('0x62')](_0x5d3399[_0x3f92('0xa9')][_0x3f92('0xab')])){switch(_0x5d3399['value']){case _0x3f92('0xac'):_0xe99b1e[_0x3f92('0x92')]=![];_0xe99b1e[_0x3f92('0x93')]=null;break;case _0x3f92('0xad'):_0xe99b1e[_0x3f92('0xae')]=_0x3f92('0xaf');_0xe99b1e[_0x3f92('0x92')]=!![];_0xe99b1e['queuecallerexitAt']=moment()[_0x3f92('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0xe99b1e[_0x3f92('0x88')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));logger[_0x3f92('0x51')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5d3399['uniqueid'],util['inspect'](_0xe99b1e,{'showHidden':![],'depth':null}));ami[_0x3f92('0x48')](_0x3f92('0xb0'),_0xe99b1e);break;default:_0xe99b1e[_0x3f92('0x92')]=!![];_0xe99b1e[_0x3f92('0x93')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));_0xe99b1e[_0x3f92('0x88')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));}_0xe99b1e[_0x3f92('0x1f')]=![];_0xe99b1e['queuecallerabandonAt']=null;_0xe99b1e[_0x3f92('0x8d')]=_0x5d3399['value'];this['channels'][_0x5d3399['uniqueid']]=_0xe99b1e;this[_0x3f92('0x50')](_0xe99b1e,_0x3f92('0x25'));}else if(this[_0x3f92('0x62')](_0x5d3399[_0x3f92('0xa9')])&&this[_0x3f92('0x62')](_0x5d3399[_0x3f92('0xa9')]['queueposition'])){if(!_0xe99b1e[_0x3f92('0x1f')]){_0xe99b1e['queuecallerexit']=!![];_0xe99b1e[_0x3f92('0x93')]=moment()[_0x3f92('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0xe99b1e[_0x3f92('0x8d')]=_0x3f92('0xb1');_0xe99b1e[_0x3f92('0x88')]=moment()['format'](_0x3f92('0x76'));this[_0x3f92('0x38')][_0x5d3399[_0x3f92('0x4b')]]=_0xe99b1e;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x5d3399[_0x3f92('0x4b')],_0xe99b1e[_0x3f92('0x4d')],_0xe99b1e[_0x3f92('0x55')],_[_0x3f92('0x7d')](_0x5d3399[_0x3f92('0xa9')])[0x0],_0x5d3399['value']);_0xe99b1e[_0x3f92('0x18')]=this['variables'][_0x5d3399[_0x3f92('0x4b')]];}}}}catch(_0x4cee91){logger['error'](_0x3f92('0xa7'),_0x5d3399[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x4cee91,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f92('0xd')][_0x3f92('0xa8')]=function(_0x2d508c,_0x531cab,_0x1d879a){var _0x447180=[_0x3f92('0xb2'),'rtpaudioqosbridged',_0x3f92('0xb3'),_0x3f92('0xb4'),'rtpaudioqosloss',_0x3f92('0xb5'),_0x3f92('0xb6'),_0x3f92('0xb7'),'sipcallid',_0x3f92('0xb8'),_0x3f92('0xb9'),'bridgepvtcallid',_0x3f92('0xba'),'memberdynamic',_0x3f92('0xbb'),_0x3f92('0xbc'),_0x3f92('0x91'),_0x3f92('0xbd'),'memberrealtime'];if(!_[_0x3f92('0x3a')](_0x531cab)&&!_['includes'](_0x447180,_0x531cab)){if(_[_0x3f92('0x63')](this['variables'][_0x2d508c])){this['variables'][_0x2d508c]={};}this['variables'][_0x2d508c][_0x531cab]=_0x1d879a;}};VoiceQueueReport['prototype'][_0x3f92('0xbe')]=function(_0x3d3d10){try{if(this[_0x3f92('0x62')](_0x3d3d10)){logger[_0x3f92('0x51')](_0x3f92('0xbf'),_0x3d3d10[_0x3f92('0x4b')],util['inspect'](_0x3d3d10,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3d3d10[_0x3f92('0x4b')]]){for(var _0x30642e=0x0,_0x1bcfe4={};_0x30642e=0x0?moment(_0x539e22[_0xe9b4('0x1a')])[_0xe9b4('0x1b')](_0x539e22[_0xe9b4('0x19')],'seconds'):null,'data1':_0xe9b4('0x1c'),'data2':_0x539e22[_0xe9b4('0x13')],'data3':_0x539e22['exten'],'data4':_0x539e22['dialstring']||null,'role':_0xe9b4('0x12'),'internal':_0x539e22[_0xe9b4('0x13')]?_[_0xe9b4('0x14')](_0x539e22[_0xe9b4('0x13')]):undefined,'uniqueid':_0x539e22[_0xe9b4('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x50a9=['membername','starttime','endtime','outbound','dialstring','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport'];(function(_0x2f84d2,_0x2a4d43){var _0xecb68b=function(_0x2eba7c){while(--_0x2eba7c){_0x2f84d2['push'](_0x2f84d2['shift']());}};_0xecb68b(++_0x2a4d43);}(_0x50a9,0x65));var _0x950a=function(_0x38b27f,_0x4ed24f){_0x38b27f=_0x38b27f-0x0;var _0x1b58f1=_0x50a9[_0x38b27f];return _0x1b58f1;};'use strict';var moment=require(_0x950a('0x0'));var _=require(_0x950a('0x1'));var util=require(_0x950a('0x2'));var client=require('../client');exports[_0x950a('0x3')]=function(_0x585ac5){var _0x11f8ab=_0x585ac5[_0x950a('0x4')]||_0x585ac5[_0x950a('0x5')];return client[_0x950a('0x6')]('CreateMemberReport',{'body':{'channel':_0x950a('0x7'),'membername':_0x585ac5[_0x950a('0x8')],'interface':_[_0x950a('0x9')](_0x585ac5[_0x950a('0xa')])?util[_0x950a('0xb')](_0x950a('0xc'),_0x585ac5[_0x950a('0x8')]):_0x585ac5[_0x950a('0xa')],'type':_0x950a('0xd'),'enterAt':_0x585ac5[_0x950a('0xe')],'exitAt':_0x11f8ab,'duration':moment(_0x11f8ab)[_0x950a('0xf')](_0x585ac5[_0x950a('0xe')],_0x950a('0x10')),'data1':_0x950a('0x11'),'data2':_0x585ac5[_0x950a('0x12')],'data3':_0x585ac5[_0x950a('0x13')],'data4':null,'data5':_0x585ac5[_0x950a('0x14')],'role':_0x950a('0x15'),'internal':_0x585ac5[_0x950a('0x16')]?_[_0x950a('0x17')](_0x585ac5[_0x950a('0x16')]):undefined,'uniqueid':_0x585ac5[_0x950a('0x18')]},'log':_0x950a('0x19')});};exports[_0x950a('0x1a')]=function(_0x2ee916){return client['Request'](_0x950a('0x19'),{'body':{'channel':'voice','membername':_0x2ee916[_0x950a('0x1b')],'interface':_0x2ee916[_0x950a('0xa')],'type':_0x950a('0xd'),'enterAt':_0x2ee916[_0x950a('0x1c')],'exitAt':_0x2ee916['endtime'],'duration':moment(_0x2ee916[_0x950a('0x1d')])['diff'](_0x2ee916[_0x950a('0x1c')],_0x950a('0x10'))>=0x0?moment(_0x2ee916[_0x950a('0x1d')])[_0x950a('0xf')](_0x2ee916['starttime'],_0x950a('0x10')):null,'data1':_0x950a('0x1e'),'data2':_0x2ee916[_0x950a('0x16')],'data3':_0x2ee916[_0x950a('0x13')],'data4':_0x2ee916[_0x950a('0x1f')]||null,'role':_0x950a('0x15'),'internal':_0x2ee916['accountcode']?_['toNumber'](_0x2ee916[_0x950a('0x16')]):undefined,'uniqueid':_0x2ee916[_0x950a('0x18')]},'log':_0x950a('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 7bbc4f0..912bf75 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 _0x1e1a=['ShowSetting','stopRecordingOnTransfer','GetSettings','getSettings','Request'];(function(_0x4aa736,_0x424f1a){var _0x4349e6=function(_0x3c8cef){while(--_0x3c8cef){_0x4aa736['push'](_0x4aa736['shift']());}};_0x4349e6(++_0x424f1a);}(_0x1e1a,0x175));var _0xa1e1=function(_0x57055e,_0x5e41f8){_0x57055e=_0x57055e-0x0;var _0x434c43=_0x1e1a[_0x57055e];return _0x434c43;};'use strict';var client=require('../client');exports[_0xa1e1('0x0')]=function(){return client[_0xa1e1('0x1')](_0xa1e1('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa1e1('0x3')]},'log':_0xa1e1('0x4')});}; \ No newline at end of file +var _0x3657=['stopRecordingOnTransfer','GetSettings','../client','getSettings','Request'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x3657,0x183));var _0x7365=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x3657[_0x513047];return _0x15b779;};'use strict';var client=require(_0x7365('0x0'));exports[_0x7365('0x1')]=function(){return client[_0x7365('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7365('0x3')]},'log':_0x7365('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 712a157..6ed6f5a 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 _0xda27=['Request','GetTemplate','name','../client','getTemplates'];(function(_0x1d1310,_0x378afc){var _0x2cbf2e=function(_0x73741c){while(--_0x73741c){_0x1d1310['push'](_0x1d1310['shift']());}};_0x2cbf2e(++_0x378afc);}(_0xda27,0x1cf));var _0x7da2=function(_0x4e8dfc,_0x448b97){_0x4e8dfc=_0x4e8dfc-0x0;var _0x3c47e0=_0xda27[_0x4e8dfc];return _0x3c47e0;};'use strict';var client=require(_0x7da2('0x0'));exports[_0x7da2('0x1')]=function(_0x1a848e){return function(_0x1873a8){return client[_0x7da2('0x2')](_0x7da2('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7da2('0x4'),'html']},'log':_0x7da2('0x3')});};}; \ No newline at end of file +var _0xdf7f=['getTemplates','GetTemplate','../client'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0xdf7f,0xe3));var _0xfdf7=function(_0x38fefe,_0x1236e3){_0x38fefe=_0x38fefe-0x0;var _0x1601d0=_0xdf7f[_0x38fefe];return _0x1601d0;};'use strict';var client=require(_0xfdf7('0x0'));exports[_0xfdf7('0x1')]=function(_0x3cf267){return function(_0x354a02){return client['Request'](_0xfdf7('0x2'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0xfdf7('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2a30373..d65f301 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 _0x20bf=['operator','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','Request','GetTrigger','name','channel','status','AllConditions','field','value','Condition','AnyConditions'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x20bf,0x11c));var _0xf20b=function(_0x475526,_0x4418f9){_0x475526=_0x475526-0x0;var _0x4ab9cb=_0x20bf[_0x475526];return _0x4ab9cb;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x1d9262){return function(_0x4338e3){return client[_0xf20b('0x0')](_0xf20b('0x1'),{'options':{'raw':![],'attributes':['id',_0xf20b('0x2'),_0xf20b('0x3'),_0xf20b('0x4')],'include':[{'model':'Condition','as':_0xf20b('0x5'),'attributes':['id',_0xf20b('0x6'),'operator',_0xf20b('0x7')]},{'model':_0xf20b('0x8'),'as':_0xf20b('0x9'),'attributes':['id','field',_0xf20b('0xa'),'value']},{'model':_0xf20b('0xb'),'as':_0xf20b('0xc'),'attributes':['id',_0xf20b('0xd'),_0xf20b('0xe'),_0xf20b('0xf'),_0xf20b('0x10'),_0xf20b('0x11'),_0xf20b('0x12'),_0xf20b('0x13'),_0xf20b('0x14')]}]},'log':_0xf20b('0x1')});};}; \ No newline at end of file +var _0x57c2=['name','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Actions','action','data2','data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger'];(function(_0x962de1,_0x361057){var _0x14085a=function(_0x220dae){while(--_0x220dae){_0x962de1['push'](_0x962de1['shift']());}};_0x14085a(++_0x361057);}(_0x57c2,0x100));var _0x257c=function(_0x5018bb,_0x2abfa3){_0x5018bb=_0x5018bb-0x0;var _0xea2f50=_0x57c2[_0x5018bb];return _0xea2f50;};'use strict';var client=require(_0x257c('0x0'));exports[_0x257c('0x1')]=function(_0x1b57cc){return function(_0x2ccd30){return client[_0x257c('0x2')](_0x257c('0x3'),{'options':{'raw':![],'attributes':['id',_0x257c('0x4'),_0x257c('0x5'),_0x257c('0x6')],'include':[{'model':'Condition','as':_0x257c('0x7'),'attributes':['id',_0x257c('0x8'),_0x257c('0x9'),_0x257c('0xa')]},{'model':_0x257c('0xb'),'as':_0x257c('0xc'),'attributes':['id',_0x257c('0x8'),_0x257c('0x9'),'value']},{'model':'Action','as':_0x257c('0xd'),'attributes':['id',_0x257c('0xe'),'data1',_0x257c('0xf'),_0x257c('0x10'),'data4',_0x257c('0x11'),_0x257c('0x12'),_0x257c('0x13')]}]},'log':_0x257c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 3629e1a..8e18be2 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 _0x655e=['GetTrunk','../client','getTrunks','Request','name','defaultuser'];(function(_0x292d27,_0x12842c){var _0x223821=function(_0x4c5e3e){while(--_0x4c5e3e){_0x292d27['push'](_0x292d27['shift']());}};_0x223821(++_0x12842c);}(_0x655e,0x19f));var _0xe655=function(_0x55c93b,_0x24b1a8){_0x55c93b=_0x55c93b-0x0;var _0x411435=_0x655e[_0x55c93b];return _0x411435;};'use strict';var client=require(_0xe655('0x0'));exports[_0xe655('0x1')]=function(_0x47a855){return function(_0xb8e7a8){return client[_0xe655('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe655('0x3'),'registry',_0xe655('0x4')]},'log':_0xe655('0x5')});};}; \ No newline at end of file +var _0x7c5d=['defaultuser','../client','GetTrunk','name','registry'];(function(_0x1a9b87,_0x4b9987){var _0x3e5a50=function(_0x488ffa){while(--_0x488ffa){_0x1a9b87['push'](_0x1a9b87['shift']());}};_0x3e5a50(++_0x4b9987);}(_0x7c5d,0x1aa));var _0xd7c5=function(_0x57c603,_0x1fd777){_0x57c603=_0x57c603-0x0;var _0x307094=_0x7c5d[_0x57c603];return _0x307094;};'use strict';var client=require(_0xd7c5('0x0'));exports['getTrunks']=function(_0x12c820){return function(_0x554051){return client['Request'](_0xd7c5('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd7c5('0x2'),_0xd7c5('0x3'),_0xd7c5('0x4')]},'log':_0xd7c5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7023499..1b6b7cf 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x2844c3,_0x25b977){var _0x384a72=function(_0xfaad4e){while(--_0xfaad4e){_0x2844c3['push'](_0x2844c3['shift']());}};_0x384a72(++_0x25b977);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x3d65aa,_0x1bd0a5){var _0x4ed3a5=function(_0x254c08){while(--_0x254c08){_0x3d65aa['push'](_0x3d65aa['shift']());}};_0x4ed3a5(++_0x1bd0a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0be2a2f..be44985 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 _0xe9ba=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x4359a5,_0x53fe11){var _0x133281=function(_0x15a48a){while(--_0x15a48a){_0x4359a5['push'](_0x4359a5['shift']());}};_0x133281(++_0x53fe11);}(_0xe9ba,0xaa));var _0xae9b=function(_0xdd9a5f,_0x3ced93){_0xdd9a5f=_0xdd9a5f-0x0;var _0x3464b7=_0xe9ba[_0xdd9a5f];return _0x3464b7;};'use strict';var client=require(_0xae9b('0x0'));exports[_0xae9b('0x1')]=function(_0x2d9039){return client[_0xae9b('0x2')](_0xae9b('0x3'),{'body':_0x2d9039,'log':'CreateVoiceAgentReport'});};exports[_0xae9b('0x4')]=function(_0x5598fd,_0x593345,_0x504d46){return client[_0xae9b('0x2')](_0xae9b('0x5'),{'body':_0x5598fd,'options':{'where':{'uniqueid':_0x593345,'interface':_0x504d46,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x11bd=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x11bd,0xea));var _0xd11b=function(_0x529f95,_0x47b583){_0x529f95=_0x529f95-0x0;var _0x59f48d=_0x11bd[_0x529f95];return _0x59f48d;};'use strict';var client=require(_0xd11b('0x0'));exports[_0xd11b('0x1')]=function(_0x27e71c){return client[_0xd11b('0x2')]('CreateVoiceAgentReport',{'body':_0x27e71c,'log':_0xd11b('0x3')});};exports[_0xd11b('0x4')]=function(_0x1f15ba,_0x1c6c42,_0x8e7def){return client[_0xd11b('0x2')](_0xd11b('0x5'),{'body':_0x1f15ba,'options':{'where':{'uniqueid':_0x1c6c42,'interface':_0x8e7def,'agentcomplete':!![]}},'log':_0xd11b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 45bbbdc..d779fd6 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 _0xff5e=['Request','CreateVoiceCallReport','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','GetVoiceCallReports','moment','util','create'];(function(_0x2f9438,_0x712092){var _0x39287a=function(_0x4ef976){while(--_0x4ef976){_0x2f9438['push'](_0x2f9438['shift']());}};_0x39287a(++_0x712092);}(_0xff5e,0x6f));var _0xeff5=function(_0x258bee,_0x14f9e4){_0x258bee=_0x258bee-0x0;var _0x106d03=_0xff5e[_0x258bee];return _0x106d03;};'use strict';var moment=require(_0xeff5('0x0'));var util=require(_0xeff5('0x1'));var _=require('lodash');var client=require('../client');exports[_0xeff5('0x2')]=function(_0xf4fe45){return client[_0xeff5('0x3')](_0xeff5('0x4'),{'body':_['merge'](_0xf4fe45,{'source':_0xf4fe45[_0xeff5('0x5')],'destinationcontext':_0xf4fe45[_0xeff5('0x6')],'callerid':_0xf4fe45[_0xeff5('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0xeff5('0x4')});};exports[_0xeff5('0x8')]=function(){return function(){return client['Request'](_0xeff5('0x9'),{'options':{'where':{'type':[_0xeff5('0xa')],'createdAt':{'$between':[moment()['startOf'](_0xeff5('0xb'))['format'](_0xeff5('0xc')),moment()[_0xeff5('0xd')](_0xeff5('0xb'))[_0xeff5('0xe')](_0xeff5('0xc'))]}},'attributes':[_0xeff5('0xf'),_0xeff5('0x10'),_0xeff5('0x11'),'billableseconds']},'log':_0xeff5('0x12')});};}; \ No newline at end of file +var _0xb01f=['calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','CreateVoiceCallReport','merge'];(function(_0x209566,_0x305cf9){var _0x393c0a=function(_0x5b0447){while(--_0x5b0447){_0x209566['push'](_0x209566['shift']());}};_0x393c0a(++_0x305cf9);}(_0xb01f,0x1c6));var _0xfb01=function(_0x35fa92,_0x3cf8c6){_0x35fa92=_0x35fa92-0x0;var _0x4150cf=_0xb01f[_0x35fa92];return _0x4150cf;};'use strict';var moment=require('moment');var util=require(_0xfb01('0x0'));var _=require(_0xfb01('0x1'));var client=require(_0xfb01('0x2'));exports[_0xfb01('0x3')]=function(_0x162beb){return client['Request'](_0xfb01('0x4'),{'body':_[_0xfb01('0x5')](_0x162beb,{'source':_0x162beb[_0xfb01('0x6')],'destinationcontext':_0x162beb[_0xfb01('0x7')],'callerid':_0x162beb[_0xfb01('0x8')],'amaflags':_0xfb01('0x9')}),'log':_0xfb01('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xfb01('0xa'),{'options':{'where':{'type':[_0xfb01('0xb')],'createdAt':{'$between':[moment()[_0xfb01('0xc')]('day')[_0xfb01('0xd')](_0xfb01('0xe')),moment()[_0xfb01('0xf')]('day')[_0xfb01('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xfb01('0x10'),'disposition',_0xfb01('0x11'),_0xfb01('0x12')]},'log':_0xfb01('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 611a4db..43300d6 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 _0x74f0=['create','Request','../client'];(function(_0x44ab2f,_0x5838be){var _0xbcf44c=function(_0x50674a){while(--_0x50674a){_0x44ab2f['push'](_0x44ab2f['shift']());}};_0xbcf44c(++_0x5838be);}(_0x74f0,0x155));var _0x074f=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0x74f0[_0x2be240];return _0x123543;};'use strict';var client=require(_0x074f('0x0'));exports[_0x074f('0x1')]=function(_0xd10b47){return client[_0x074f('0x2')]('CreateVoiceDialReport',{'body':_0xd10b47,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xfa35=['../client','create','Request','CreateVoiceDialReport'];(function(_0x947a45,_0x4de4f1){var _0x225866=function(_0x3b401c){while(--_0x3b401c){_0x947a45['push'](_0x947a45['shift']());}};_0x225866(++_0x4de4f1);}(_0xfa35,0x10c));var _0x5fa3=function(_0x1ce3fa,_0x2a15c2){_0x1ce3fa=_0x1ce3fa-0x0;var _0x27a3b5=_0xfa35[_0x1ce3fa];return _0x27a3b5;};'use strict';var client=require(_0x5fa3('0x0'));exports[_0x5fa3('0x1')]=function(_0x55f453){return client[_0x5fa3('0x2')](_0x5fa3('0x3'),{'body':_0x55f453,'log':_0x5fa3('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f16f90c..8fa645c 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 _0x195e=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x1bb580,_0x4b3948){var _0x54fbf0=function(_0x537c47){while(--_0x537c47){_0x1bb580['push'](_0x1bb580['shift']());}};_0x54fbf0(++_0x4b3948);}(_0x195e,0xfb));var _0xe195=function(_0x6c61c9,_0x3e0bf8){_0x6c61c9=_0x6c61c9-0x0;var _0x297f6b=_0x195e[_0x6c61c9];return _0x297f6b;};'use strict';var client=require(_0xe195('0x0'));exports[_0xe195('0x1')]=function(){return function(){return client[_0xe195('0x2')](_0xe195('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe195('0x4'),_0xe195('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xe195('0x1')});};}; \ No newline at end of file +var _0xa45c=['exten','../client','getVoiceExtensions'];(function(_0x1cf8d1,_0xe6cd99){var _0x227863=function(_0x2236fc){while(--_0x2236fc){_0x1cf8d1['push'](_0x1cf8d1['shift']());}};_0x227863(++_0xe6cd99);}(_0xa45c,0x6d));var _0xca45=function(_0x33a072,_0x36e177){_0x33a072=_0x33a072-0x0;var _0x14fda9=_0xa45c[_0x33a072];return _0x14fda9;};'use strict';var client=require(_0xca45('0x0'));exports[_0xca45('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xca45('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xca45('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 88b73ff..f188b78 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 _0x8ba0=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x1df768,_0x42e7ab){_0x1df768=_0x1df768-0x0;var _0x46ca4c=_0x8ba0[_0x1df768];return _0x46ca4c;};'use strict';var client=require(_0x08ba('0x0'));exports[_0x08ba('0x1')]=function(){return function(){return client[_0x08ba('0x2')](_0x08ba('0x3'),{'options':{'raw':![],'attributes':['id',_0x08ba('0x4'),'acw','acwTimeout',_0x08ba('0x5'),_0x08ba('0x6'),_0x08ba('0x7'),_0x08ba('0x8'),_0x08ba('0x9'),_0x08ba('0xa'),'dialLimitQueue',_0x08ba('0xb'),_0x08ba('0xc'),_0x08ba('0xd'),_0x08ba('0xe'),_0x08ba('0xf'),'dialOriginateCallerIdNumber',_0x08ba('0x10'),'dialQueueOptions',_0x08ba('0x11'),'dialQueueProject',_0x08ba('0x12'),_0x08ba('0x13'),_0x08ba('0x14'),_0x08ba('0x15'),_0x08ba('0x16'),_0x08ba('0x17'),_0x08ba('0x18'),_0x08ba('0x19'),_0x08ba('0x1a'),_0x08ba('0x1b'),_0x08ba('0x1c'),_0x08ba('0x1d'),'dialAMDInitialSilence',_0x08ba('0x1e'),_0x08ba('0x1f'),_0x08ba('0x20'),_0x08ba('0x21'),_0x08ba('0x22'),_0x08ba('0x23'),'dialAMDSilenceThreshold',_0x08ba('0x24'),_0x08ba('0x25'),_0x08ba('0x26'),_0x08ba('0x27'),_0x08ba('0x28'),'dialAgiAfterHangupAgent',_0x08ba('0x29'),_0x08ba('0x2a'),'monitor_format',_0x08ba('0x2b'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x08ba('0x2c'),_0x08ba('0x2d'),_0x08ba('0x2e'),_0x08ba('0x2f'),_0x08ba('0x30'),_0x08ba('0x31'),_0x08ba('0x32'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x08ba('0x33'),'mandatoryDisposition',_0x08ba('0x34'),_0x08ba('0x35'),'dialPreviewAutoRecallMe'],'include':[{'model':_0x08ba('0x36'),'as':_0x08ba('0x36'),'attributes':['id',_0x08ba('0x4'),_0x08ba('0x37'),_0x08ba('0x38')]},{'model':_0x08ba('0x39'),'as':_0x08ba('0x3a'),'attributes':['id',_0x08ba('0x4')]},{'model':_0x08ba('0x36'),'as':_0x08ba('0x3b'),'attributes':['id',_0x08ba('0x4'),_0x08ba('0x37'),'active']},{'model':_0x08ba('0x3c'),'as':_0x08ba('0x3c'),'attributes':['id',_0x08ba('0x4')],'include':[{'model':_0x08ba('0x3c'),'as':_0x08ba('0x3d'),'attributes':['id',_0x08ba('0x4'),_0x08ba('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x5785=['dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','active','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout'];(function(_0x31f5b4,_0x31a5ec){var _0x509f55=function(_0x71f66c){while(--_0x71f66c){_0x31f5b4['push'](_0x31f5b4['shift']());}};_0x509f55(++_0x31a5ec);}(_0x5785,0x119));var _0x5578=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5785[_0x27af45];return _0x18df21;};'use strict';var client=require(_0x5578('0x0'));exports[_0x5578('0x1')]=function(){return function(){return client[_0x5578('0x2')](_0x5578('0x3'),{'options':{'raw':![],'attributes':['id',_0x5578('0x4'),'acw',_0x5578('0x5'),_0x5578('0x6'),_0x5578('0x7'),_0x5578('0x8'),_0x5578('0x9'),_0x5578('0xa'),_0x5578('0xb'),_0x5578('0xc'),_0x5578('0xd'),_0x5578('0xe'),'dialPredictiveOptimizationPercentage',_0x5578('0xf'),_0x5578('0x10'),_0x5578('0x11'),'dialOriginateTimeout',_0x5578('0x12'),'dialQueueTimeout',_0x5578('0x13'),'dialCongestionMaxRetry',_0x5578('0x14'),_0x5578('0x15'),_0x5578('0x16'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x5578('0x17'),_0x5578('0x18'),_0x5578('0x19'),_0x5578('0x1a'),_0x5578('0x1b'),_0x5578('0x1c'),_0x5578('0x1d'),_0x5578('0x1e'),_0x5578('0x1f'),_0x5578('0x20'),'dialAMDMinWordLength',_0x5578('0x21'),_0x5578('0x22'),_0x5578('0x23'),_0x5578('0x24'),_0x5578('0x25'),_0x5578('0x26'),_0x5578('0x27'),_0x5578('0x28'),_0x5578('0x29'),_0x5578('0x2a'),'dialQueueProject2',_0x5578('0x7'),_0x5578('0x2b'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x5578('0x2c'),_0x5578('0x2d'),'dialDropMaxRetry',_0x5578('0x2e'),_0x5578('0x2f'),_0x5578('0x30'),_0x5578('0x31'),_0x5578('0x32'),_0x5578('0x33'),_0x5578('0x34'),_0x5578('0x35'),_0x5578('0x36'),_0x5578('0x37'),_0x5578('0x38')],'include':[{'model':_0x5578('0x39'),'as':_0x5578('0x39'),'attributes':['id',_0x5578('0x4'),'callerid',_0x5578('0x3a')]},{'model':'Pause','as':_0x5578('0x3b'),'attributes':['id',_0x5578('0x4')]},{'model':_0x5578('0x39'),'as':_0x5578('0x3c'),'attributes':['id',_0x5578('0x4'),_0x5578('0x3d'),'active']},{'model':_0x5578('0x3e'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x5578('0x3e'),'as':'Intervals','attributes':['id',_0x5578('0x4'),_0x5578('0x3f')]}]}]},'log':_0x5578('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f23ad2f..8021f5e 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(_0x40b40a,_0x3d08a9){var _0x41a776=function(_0x47e923){while(--_0x47e923){_0x40b40a['push'](_0x40b40a['shift']());}};_0x41a776(++_0x3d08a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x3e54d3,_0xa1c603){var _0x57c0ef=function(_0xef6a02){while(--_0xef6a02){_0x3e54d3['push'](_0x3e54d3['shift']());}};_0x57c0ef(++_0xa1c603);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 b7a5975..b18716e 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 _0x8b7c=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x342544,_0x391d8f){var _0x389266=function(_0x4a088e){while(--_0x4a088e){_0x342544['push'](_0x342544['shift']());}};_0x389266(++_0x391d8f);}(_0x8b7c,0x111));var _0xc8b7=function(_0x118d61,_0x2410d8){_0x118d61=_0x118d61-0x0;var _0x45c03c=_0x8b7c[_0x118d61];return _0x45c03c;};'use strict';var client=require(_0xc8b7('0x0'));exports[_0xc8b7('0x1')]=function(_0x4b9b7){return function(){return client[_0xc8b7('0x2')](_0xc8b7('0x3'),{'options':{'where':{'VoiceQueueId':_0x4b9b7,'paused':!![]},'raw':!![]},'log':_0xc8b7('0x1')});};}; \ No newline at end of file +var _0x9976=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x52d05e,_0x340f51){var _0x3db1a2=function(_0x59802c){while(--_0x59802c){_0x52d05e['push'](_0x52d05e['shift']());}};_0x3db1a2(++_0x340f51);}(_0x9976,0xf1));var _0x6997=function(_0x22a9dd,_0x496dde){_0x22a9dd=_0x22a9dd-0x0;var _0xa13677=_0x9976[_0x22a9dd];return _0xa13677;};'use strict';var client=require(_0x6997('0x0'));exports[_0x6997('0x1')]=function(_0xe55e55){return function(){return client['Request'](_0x6997('0x2'),{'options':{'where':{'VoiceQueueId':_0xe55e55,'paused':!![]},'raw':!![]},'log':_0x6997('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index cb724e4..810c073 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(_0x56b3b8,_0x11192){var _0xa9ba80=function(_0x846772){while(--_0x846772){_0x56b3b8['push'](_0x56b3b8['shift']());}};_0xa9ba80(++_0x11192);}(_0x7a54,0x106));var _0x47a5=function(_0x22fcf0,_0x5eefd9){_0x22fcf0=_0x22fcf0-0x0;var _0x11dec7=_0x7a54[_0x22fcf0];return _0x11dec7;};'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(_0x3f8ac9,_0x67d34f){var _0x1285f4=function(_0x3cbc1a){while(--_0x3cbc1a){_0x3f8ac9['push'](_0x3f8ac9['shift']());}};_0x1285f4(++_0x67d34f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 b870bde..f201ff7 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 _0x4efc=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum'];(function(_0x2e8a64,_0x609d87){var _0x2131ae=function(_0x5d4f8a){while(--_0x5d4f8a){_0x2e8a64['push'](_0x2e8a64['shift']());}};_0x2131ae(++_0x609d87);}(_0x4efc,0x1bc));var _0xc4ef=function(_0x106ee2,_0x30284a){_0x106ee2=_0x106ee2-0x0;var _0xfd26da=_0x4efc[_0x106ee2];return _0xfd26da;};'use strict';var client=require(_0xc4ef('0x0'));exports[_0xc4ef('0x1')]={};exports[_0xc4ef('0x2')]=function(_0x2ae067){return client[_0xc4ef('0x3')](_0xc4ef('0x4'),{'body':{'result':_0x2ae067[_0xc4ef('0x5')],'transfererchannel':_0x2ae067[_0xc4ef('0x6')],'transferercalleridnum':_0x2ae067['transferercalleridnum'],'transferercalleridname':_0x2ae067['transferercalleridname'],'transfererconnectedlinenum':_0x2ae067[_0xc4ef('0x7')],'transfererconnectedlinename':_0x2ae067['transfererconnectedlinename'],'transfereraccountcode':_0x2ae067['transfereraccountcode'],'transferercontext':_0x2ae067[_0xc4ef('0x8')],'transfererexten':_0x2ae067[_0xc4ef('0x9')],'transfererlinkedid':_0x2ae067[_0xc4ef('0xa')],'transfereechannel':_0x2ae067[_0xc4ef('0xb')],'transfereecalleridnum':_0x2ae067[_0xc4ef('0xc')],'transfereecalleridname':_0x2ae067[_0xc4ef('0xd')],'transfereeconnectedlinenum':_0x2ae067['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2ae067[_0xc4ef('0xe')],'transfereeaccountcode':_0x2ae067[_0xc4ef('0xf')],'transfereecontext':_0x2ae067[_0xc4ef('0x10')],'transfereeexten':_0x2ae067['transfereeexten'],'transfereelinkedid':_0x2ae067[_0xc4ef('0x11')],'isexternal':_0x2ae067[_0xc4ef('0x12')],'context':_0x2ae067[_0xc4ef('0x13')],'extension':_0x2ae067['extension'],'type':_0xc4ef('0x14')},'log':_0xc4ef('0x4')});};exports[_0xc4ef('0x15')]=function(_0x347044){return client[_0xc4ef('0x3')](_0xc4ef('0x4'),{'body':{'result':_0x347044[_0xc4ef('0x5')],'transfererchannel':_0x347044[_0xc4ef('0x16')],'transferercalleridnum':_0x347044[_0xc4ef('0x17')],'transferercalleridname':_0x347044[_0xc4ef('0x18')],'transfererconnectedlinenum':_0x347044[_0xc4ef('0x19')],'transfererconnectedlinename':_0x347044[_0xc4ef('0x1a')],'transfereraccountcode':_0x347044[_0xc4ef('0x1b')],'transferercontext':_0x347044[_0xc4ef('0x1c')],'transfererexten':_0x347044[_0xc4ef('0x1d')],'transfererlinkedid':_0x347044['origtransfererlinkedid'],'transfereechannel':_0x347044['transfertargetchannel'],'transfereecalleridnum':_0x347044[_0xc4ef('0x1e')],'transfereecalleridname':_0x347044[_0xc4ef('0x1f')],'transfereeconnectedlinenum':_0x347044[_0xc4ef('0x20')],'transfereeconnectedlinename':_0x347044[_0xc4ef('0x21')],'transfereeaccountcode':_0x347044[_0xc4ef('0x22')],'transfereecontext':_0x347044['transfertargetcontext'],'transfereeexten':_0x347044[_0xc4ef('0x23')],'transfereelinkedid':_0x347044[_0xc4ef('0x24')],'isexternal':_0x347044[_0xc4ef('0x12')],'context':_0x347044['origtransferercontext'],'extension':_0x347044[_0xc4ef('0x25')],'type':_0xc4ef('0x26')},'log':_0xc4ef('0x4')});}; \ No newline at end of file +var _0xf76a=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','../client','transfers','blindTransfer','CreateVoiceTransferReport'];(function(_0x528373,_0x4595d3){var _0x3bac7c=function(_0x4c08da){while(--_0x4c08da){_0x528373['push'](_0x528373['shift']());}};_0x3bac7c(++_0x4595d3);}(_0xf76a,0xe6));var _0xaf76=function(_0x221936,_0x48fd5b){_0x221936=_0x221936-0x0;var _0x447c26=_0xf76a[_0x221936];return _0x447c26;};'use strict';var client=require(_0xaf76('0x0'));exports[_0xaf76('0x1')]={};exports[_0xaf76('0x2')]=function(_0x574051){return client['Request'](_0xaf76('0x3'),{'body':{'result':_0x574051['result'],'transfererchannel':_0x574051['transfererchannel'],'transferercalleridnum':_0x574051[_0xaf76('0x4')],'transferercalleridname':_0x574051[_0xaf76('0x5')],'transfererconnectedlinenum':_0x574051[_0xaf76('0x6')],'transfererconnectedlinename':_0x574051[_0xaf76('0x7')],'transfereraccountcode':_0x574051['transfereraccountcode'],'transferercontext':_0x574051[_0xaf76('0x8')],'transfererexten':_0x574051[_0xaf76('0x9')],'transfererlinkedid':_0x574051[_0xaf76('0xa')],'transfereechannel':_0x574051[_0xaf76('0xb')],'transfereecalleridnum':_0x574051[_0xaf76('0xc')],'transfereecalleridname':_0x574051[_0xaf76('0xd')],'transfereeconnectedlinenum':_0x574051['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x574051[_0xaf76('0xe')],'transfereeaccountcode':_0x574051['transfereeaccountcode'],'transfereecontext':_0x574051[_0xaf76('0xf')],'transfereeexten':_0x574051[_0xaf76('0x10')],'transfereelinkedid':_0x574051[_0xaf76('0x11')],'isexternal':_0x574051[_0xaf76('0x12')],'context':_0x574051['context'],'extension':_0x574051[_0xaf76('0x13')],'type':_0xaf76('0x14')},'log':_0xaf76('0x3')});};exports[_0xaf76('0x15')]=function(_0x529637){return client[_0xaf76('0x16')]('CreateVoiceTransferReport',{'body':{'result':_0x529637[_0xaf76('0x17')],'transfererchannel':_0x529637[_0xaf76('0x18')],'transferercalleridnum':_0x529637[_0xaf76('0x19')],'transferercalleridname':_0x529637[_0xaf76('0x1a')],'transfererconnectedlinenum':_0x529637[_0xaf76('0x1b')],'transfererconnectedlinename':_0x529637[_0xaf76('0x1c')],'transfereraccountcode':_0x529637[_0xaf76('0x1d')],'transferercontext':_0x529637['secondtransferercontext'],'transfererexten':_0x529637[_0xaf76('0x1e')],'transfererlinkedid':_0x529637['origtransfererlinkedid'],'transfereechannel':_0x529637[_0xaf76('0x1f')],'transfereecalleridnum':_0x529637[_0xaf76('0x20')],'transfereecalleridname':_0x529637[_0xaf76('0x21')],'transfereeconnectedlinenum':_0x529637[_0xaf76('0x22')],'transfereeconnectedlinename':_0x529637[_0xaf76('0x23')],'transfereeaccountcode':_0x529637[_0xaf76('0x24')],'transfereecontext':_0x529637['transfertargetcontext'],'transfereeexten':_0x529637['transfertargetexten'],'transfereelinkedid':_0x529637[_0xaf76('0x25')],'isexternal':_0x529637[_0xaf76('0x12')],'context':_0x529637[_0xaf76('0x26')],'extension':_0x529637['origtransfererexten'],'type':'attended'},'log':_0xaf76('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5210439..11a5316 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 _0x0f4d=['telephones','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','validate','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','keys','module','action','Reload','Action','then','message','catch','error','ami\x20disconnected','join','pick','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','omit','undefined','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','ai(mixmonitorid)','find','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context'];(function(_0x1f29a8,_0x15ee9b){var _0xc62ab7=function(_0x276fce){while(--_0x276fce){_0x1f29a8['push'](_0x1f29a8['shift']());}};_0xc62ab7(++_0x15ee9b);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x56a52c,_0x4adc35){_0x56a52c=_0x56a52c-0x0;var _0x10ba36=_0x0f4d[_0x56a52c];return _0x10ba36;};'use strict';var _=require('lodash');var util=require('util');var jayson=require('jayson/promise');var schema=require(_0xd0f4('0x0'));var BPromise=require('bluebird');var moment=require(_0xd0f4('0x1'));var config=require(_0xd0f4('0x2'));var properties=require(_0xd0f4('0x3'));var ami=require(_0xd0f4('0x4'));exports[_0xd0f4('0x5')]=function(_0x2a0efc,_0x37c481,_0x1d9a9d){return new BPromise(function(_0x531f85,_0x1164da){var _0x27acb8={'QueuePause':function(_0x4d0ab0){return new Promise(function(_0x3992be,_0x2a0057){var _0x4c826e=util[_0xd0f4('0x6')](_0xd0f4('0x7'),'SIP',_0x4d0ab0[_0xd0f4('0x8')]);if(_0x2a0efc[_0xd0f4('0x9')]&&_0x2a0efc[_0xd0f4('0x9')][_0x4c826e]&&_0x2a0efc['timers'][_0x4c826e]['timer']){_0x2a0efc[_0xd0f4('0x9')][_0x4c826e][_0xd0f4('0xa')]();}if(_0x2a0efc[_0xd0f4('0xb')][_0x4c826e]){_0x2a0efc[_0xd0f4('0xb')][_0x4c826e][_0xd0f4('0xc')]({'statePause':_0x4d0ab0[_0xd0f4('0xd')]?!![]:![]});}_0x3992be({'code':0xc8,'message':_0xd0f4('0xe')});});},'Reload':function(_0x5679a7){var _0x2eac6f=this;return new Promise(function(_0x30c904,_0x51656c){if(ami[_0xd0f4('0xf')]()==![]){return _0x51656c(_0x2eac6f['error'](0x1f4,[config[_0xd0f4('0x10')]['ip'],config['asterisk'][_0xd0f4('0x11')],'ami\x20disconnected']['join']('\x20')));}_0x5679a7=_['pick'](_0x5679a7,_[_0xd0f4('0x12')](properties[_0xd0f4('0x13')]));_0x5679a7[_0xd0f4('0x14')]=_0xd0f4('0x15');return ami[_0xd0f4('0x16')](_0x5679a7)[_0xd0f4('0x17')](function(_0xe8cefc){_0x30c904({'code':0xc8,'message':_0xe8cefc[_0xd0f4('0x18')]});})[_0xd0f4('0x19')](function(_0x5de07b){_0x51656c(_0x2eac6f[_0xd0f4('0x1a')](0x1f5,_0x5de07b[_0xd0f4('0x18')]));});});},'Command':function(_0x32605d){var _0xa0662=this;return new Promise(function(_0x5cb3cb,_0x11d9ba){if(ami[_0xd0f4('0xf')]()==![]){return _0x11d9ba(_0xa0662[_0xd0f4('0x1a')](0x1f4,[config[_0xd0f4('0x10')]['ip'],config['asterisk'][_0xd0f4('0x11')],_0xd0f4('0x1b')][_0xd0f4('0x1c')]('\x20')));}_0x32605d=_[_0xd0f4('0x1d')](_0x32605d,_0xd0f4('0x1e'));_0x32605d[_0xd0f4('0x14')]=_0xd0f4('0x1f');return ami['Action'](_0x32605d)[_0xd0f4('0x17')](function(_0x327696){_0x5cb3cb({'code':0xc8,'message':_0x327696[_0xd0f4('0x20')]});})[_0xd0f4('0x19')](function(_0x4d49c0){_0x11d9ba(_0xa0662[_0xd0f4('0x1a')](0x1f5,_0x4d49c0['message']));});});},'VoiceQueues':function(_0x32585c){return new Promise(function(_0xbdfcf1,_0x1cf493){var _0x567eb4=[];for(var _0x42d944 in _0x2a0efc[_0xd0f4('0x21')]){if(_0x2a0efc[_0xd0f4('0x21')][_0xd0f4('0x22')](_0x42d944)){var _0x366af6=_0x2a0efc['voiceQueues'][_0x42d944];var _0x3860e8={'id':_0x366af6['id'],'name':_0x366af6[_0xd0f4('0x8')],'strategy':_0x366af6[_0xd0f4('0x23')],'answered':_0x366af6[_0xd0f4('0x24')],'available':_0x366af6[_0xd0f4('0x25')],'loggedIn':_0x366af6[_0xd0f4('0x26')],'pTalking':_0x366af6[_0xd0f4('0x27')],'sumBillable':_0x366af6[_0xd0f4('0x28')],'sumDuration':_0x366af6[_0xd0f4('0x29')],'sumHoldTime':_0x366af6['sumHoldTime']||0x0,'talking':_0x366af6[_0xd0f4('0x2a')],'total':_0x366af6[_0xd0f4('0x2b')],'type':_0x366af6[_0xd0f4('0x2c')],'unmanaged':_0x366af6[_0xd0f4('0x2d')],'abandoned':_0x366af6['abandoned'],'waiting':_0x366af6[_0xd0f4('0x2e')],'loggedInDb':_0x366af6['loggedInDb']};if(_0x366af6['type']==='outbound'){_0x3860e8[_0xd0f4('0x2f')]=_0x366af6[_0xd0f4('0x2f')];_0x3860e8[_0xd0f4('0x30')]=_0x366af6[_0xd0f4('0x30')];_0x3860e8[_0xd0f4('0x31')]=_0x366af6[_0xd0f4('0x31')];_0x3860e8[_0xd0f4('0x32')]=_0x366af6[_0xd0f4('0x32')];_0x3860e8['dialOriginateTimeout']=_0x366af6[_0xd0f4('0x33')];_0x3860e8['dialPrefix']=_0x366af6[_0xd0f4('0x34')];_0x3860e8[_0xd0f4('0x35')]=_0x366af6['temp'];_0x3860e8['outboundAnswerAgiCallsDay']=_0x366af6[_0xd0f4('0x36')];_0x3860e8['outboundAnswerCallsDay']=_0x366af6[_0xd0f4('0x37')];_0x3860e8[_0xd0f4('0x38')]=_0x366af6['outboundBlacklistCallsDay'];_0x3860e8[_0xd0f4('0x39')]=_0x366af6[_0xd0f4('0x39')];_0x3860e8['outboundCongestionCallsDay']=_0x366af6['outboundCongestionCallsDay'];_0x3860e8[_0xd0f4('0x3a')]=_0x366af6[_0xd0f4('0x3a')];_0x3860e8['outboundDropCallsDayCallersExit']=_0x366af6[_0xd0f4('0x3b')];_0x3860e8['outboundDropCallsDayTimeout']=_0x366af6[_0xd0f4('0x3c')];_0x3860e8[_0xd0f4('0x3d')]=_0x366af6['outboundNoAnswerCallsDay'];_0x3860e8[_0xd0f4('0x3e')]=_0x366af6[_0xd0f4('0x3e')];_0x3860e8[_0xd0f4('0x3f')]=_0x366af6[_0xd0f4('0x3f')];_0x3860e8[_0xd0f4('0x40')]=_0x366af6['outboundReCallsDay'];_0x3860e8[_0xd0f4('0x41')]=_0x366af6[_0xd0f4('0x41')];_0x3860e8[_0xd0f4('0x42')]=_0x366af6[_0xd0f4('0x42')];_0x3860e8['predictiveIntervalAnsweredCalls']=_0x366af6[_0xd0f4('0x43')];_0x3860e8[_0xd0f4('0x44')]=_0x366af6[_0xd0f4('0x44')];_0x3860e8[_0xd0f4('0x45')]=_0x366af6[_0xd0f4('0x45')];_0x3860e8[_0xd0f4('0x46')]=_0x366af6['predictiveIntervalDroppedCallsCallersExit'];_0x3860e8[_0xd0f4('0x47')]=_0x366af6[_0xd0f4('0x47')];_0x3860e8[_0xd0f4('0x48')]=_0x366af6['predictiveIntervalErlangCalls'];_0x3860e8[_0xd0f4('0x49')]=_0x366af6[_0xd0f4('0x49')];_0x3860e8['predictiveIntervalHitRate']=_0x366af6[_0xd0f4('0x4a')];_0x3860e8[_0xd0f4('0x4b')]=_0x366af6['predictiveIntervalMultiplicativeFactor'];_0x3860e8['predictiveIntervalPauses']=_0x366af6[_0xd0f4('0x4c')];_0x3860e8[_0xd0f4('0x4d')]=_0x366af6[_0xd0f4('0x4d')];_0x3860e8['predictiveIntervalTotalCalls']=_0x366af6[_0xd0f4('0x4e')];_0x3860e8['message']=_0x366af6[_0xd0f4('0x18')];_0x3860e8['originated']=_0x366af6[_0xd0f4('0x4f')];_0x3860e8[_0xd0f4('0x50')]=_0x366af6[_0xd0f4('0x50')];_0x3860e8[_0xd0f4('0x51')]=_0x366af6['erlangCallToSecond'];_0x3860e8[_0xd0f4('0x52')]=_0x366af6[_0xd0f4('0x52')];_0x3860e8[_0xd0f4('0x53')]=_0x366af6['erlangBusyFactor'];_0x3860e8['startPredictive']=_0x366af6[_0xd0f4('0x54')];_0x3860e8[_0xd0f4('0x55')]=_0x366af6[_0xd0f4('0x55')];}if(_0x366af6[_0xd0f4('0x56')]){_0x3860e8[_0xd0f4('0x56')]={'id':_0x366af6[_0xd0f4('0x56')]['id'],'name':_0x366af6[_0xd0f4('0x56')][_0xd0f4('0x8')],'active':_0x366af6[_0xd0f4('0x56')][_0xd0f4('0x57')],'callerid':_0x366af6[_0xd0f4('0x56')][_0xd0f4('0x58')]};}if(_0x366af6['Interval']){_0x3860e8[_0xd0f4('0x59')]={'id':_0x366af6[_0xd0f4('0x59')]['id'],'name':_0x366af6['Interval'][_0xd0f4('0x8')]};}_0x567eb4[_0xd0f4('0x5a')](_0x3860e8);}}_0xbdfcf1({'count':_0x567eb4[_0xd0f4('0x5b')],'rows':_0x567eb4});});},'UpdateVoiceQueue':function(_0x2d4df6){return new Promise(function(_0x209da0,_0x44c49d){var _0x286f92=_['find'](_0x2a0efc[_0xd0f4('0x21')],{'id':parseInt(_0x2d4df6['id'])});var _0x17ea48=_[_0xd0f4('0x5c')](_0x2d4df6,['id']);if(_0x286f92){for(var _0x4835de in _0x17ea48){if(typeof _0x17ea48[_0x4835de]!==_0xd0f4('0x5d')&&typeof _0x286f92[_0x4835de]!==_0xd0f4('0x5d')){_0x286f92[_0x4835de]=_0x17ea48[_0x4835de];}}_0x209da0(_0x286f92);}else{_0x44c49d();}});},'VoiceChannels':function(_0x1d7b59){return new Promise(function(_0x39594c,_0x1ff891){var _0x563759=_['values'](_0x2a0efc['channels']);_0x39594c({'count':_0x563759[_0xd0f4('0x5b')],'rows':_0x563759});});},'VoiceChannelMixMonitor':function(_0x16b676){var _0x401613=this;return new Promise(function(_0x2efc1d,_0x5da831){if(ami[_0xd0f4('0xf')]()==![]){return _0x5da831(_0x401613[_0xd0f4('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0xd0f4('0x10')][_0xd0f4('0x11')],_0xd0f4('0x1b')][_0xd0f4('0x1c')]('\x20')));}var _0x431977=schema(properties[_0xd0f4('0x5e')])[_0xd0f4('0x0')](_0x16b676);if(_0x431977[_0xd0f4('0x5b')]>0x0){return _0x5da831(_0x401613[_0xd0f4('0x1a')](0x1f4,_[_0xd0f4('0x5f')](_0x431977,_0xd0f4('0x18'))[_0xd0f4('0x1c')](',\x20')));}var _0x3c7389=_['find'](_0x2a0efc[_0xd0f4('0x60')],{'uniqueid':_0x16b676[_0xd0f4('0x61')]});if(_0x3c7389&&_0x3c7389[_0xd0f4('0x62')]){var _0x52fb3d=util[_0xd0f4('0x6')](_0xd0f4('0x63'),_0x16b676[_0xd0f4('0x64')]||_0x16b676['uniqueid'],_0x16b676[_0xd0f4('0x6')]||'wav');return ami[_0xd0f4('0x16')]({'action':'MixMonitor','channel':_0x3c7389['channel'],'file':_0x52fb3d,'options':_0xd0f4('0x65')})[_0xd0f4('0x17')](function(_0xcf50d3){var _0x1f033d=_[_0xd0f4('0x66')](_0x3c7389[_0xd0f4('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x52fb3d[_0xd0f4('0x68')]()});if(_[_0xd0f4('0x69')](_0x1f033d)){_0x3c7389[_0xd0f4('0x67')][_0xd0f4('0x5a')]({'filename':_0xd0f4('0x6a')+_0x52fb3d[_0xd0f4('0x68')](),'createdAt':moment()['format'](_0xd0f4('0x6b')),'mixmonitorid':_0xcf50d3['mixmonitorid'],'status':'rec'});}else{_0x1f033d[_0xd0f4('0x6c')]=_0xcf50d3[_0xd0f4('0x6c')];_0x1f033d[_0xd0f4('0x6d')]='rec';}_0x2efc1d({'code':0xc8,'message':[_0x16b676[_0xd0f4('0x61')],_0xd0f4('0x6e'),_0xcf50d3[_0xd0f4('0x6c')]][_0xd0f4('0x1c')]('\x20'),'mixmonitorid':_0xcf50d3[_0xd0f4('0x6c')]});})[_0xd0f4('0x19')](function(_0x1248a2){_0x5da831(_0x401613[_0xd0f4('0x1a')](0x1f5,[_0x16b676[_0xd0f4('0x61')],_0x1248a2[_0xd0f4('0x18')]['toLowerCase']()][_0xd0f4('0x1c')]('\x20')));});}else{return _0x5da831(_0x401613[_0xd0f4('0x1a')](0x1f5,_0xd0f4('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x13180b){var _0x4c33e1=this;return new Promise(function(_0xb83d39,_0x14218f){if(ami[_0xd0f4('0xf')]()==![]){return _0x14218f(_0x4c33e1[_0xd0f4('0x1a')](0x1f4,[config[_0xd0f4('0x10')]['ip'],config[_0xd0f4('0x10')]['username'],'ami\x20disconnected'][_0xd0f4('0x1c')]('\x20')));}var _0x1fede8=schema(properties[_0xd0f4('0x5e')])[_0xd0f4('0x0')](_0x13180b);if(_0x1fede8[_0xd0f4('0x5b')]>0x0){return _0x14218f(_0x4c33e1[_0xd0f4('0x1a')](0x1f4,_['map'](_0x1fede8,_0xd0f4('0x18'))[_0xd0f4('0x1c')](',\x20')));}var _0x383d99=_['find'](_0x2a0efc[_0xd0f4('0x60')],{'uniqueid':_0x13180b[_0xd0f4('0x61')]});if(_0x383d99){return BPromise['resolve']()['then'](function(){if(_0x383d99[_0xd0f4('0x62')]){return ami['Action']({'action':_0xd0f4('0x70'),'channel':_0x383d99[_0xd0f4('0x62')],'mixmonitorid':_0x13180b['mixmonitorid']})[_0xd0f4('0x19')](function(_0x264ca6){});}})['then'](function(){if(_0x383d99[_0xd0f4('0x71')]){return ami[_0xd0f4('0x16')]({'action':_0xd0f4('0x70'),'channel':_0x383d99['destinationchannel'],'mixmonitorid':_0x13180b['mixmonitorid']})[_0xd0f4('0x19')](function(_0x31a1b7){});}})['then'](function(_0x351461){var _0x4202ae=_['find'](_0x383d99[_0xd0f4('0x67')],{'mixmonitorid':_0x13180b[_0xd0f4('0x6c')]});if(_0x4202ae){_0x4202ae[_0xd0f4('0x6d')]=_0xd0f4('0x72');}})[_0xd0f4('0x17')](function(){var _0x5dcf78=util[_0xd0f4('0x6')]('%s.%s',_0x13180b[_0xd0f4('0x64')]||_0x13180b[_0xd0f4('0x61')],_0x13180b[_0xd0f4('0x6')]||_0xd0f4('0x73'));var _0x2a45da=_['find'](_0x383d99['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x5dcf78[_0xd0f4('0x68')]()});if(_0x2a45da){_0x2a45da[_0xd0f4('0x6d')]=_0xd0f4('0x72');}})[_0xd0f4('0x17')](function(){_0xb83d39({'code':0xc8,'message':[_0x13180b[_0xd0f4('0x61')],_0xd0f4('0x74')][_0xd0f4('0x1c')]('\x20')});})[_0xd0f4('0x19')](function(_0x34d989){_0x14218f(_0x4c33e1[_0xd0f4('0x1a')](0x1f5,[_0x13180b[_0xd0f4('0x61')],_0x34d989[_0xd0f4('0x18')]['toLowerCase']()]['join']('\x20')));});}else{return _0x14218f(_0x4c33e1[_0xd0f4('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0xecbf13){return new Promise(function(_0x57aa73,_0xa4a234){var _0x4ec015=_[_0xd0f4('0x75')](_0x2a0efc[_0xd0f4('0x76')]);_0x57aa73({'count':_0x4ec015[_0xd0f4('0x5b')],'rows':_0x4ec015});});},'VoiceQueuesChannel':function(_0x3344ea){var _0x4b9892=this;return new Promise(function(_0xca7aa7,_0x4a822a){var _0x1f751b=schema(properties[_0xd0f4('0x77')])[_0xd0f4('0x0')](_0x3344ea);if(_0x1f751b[_0xd0f4('0x5b')]>0x0){return _0x4a822a(_0x4b9892[_0xd0f4('0x1a')](0x1f4,_[_0xd0f4('0x5f')](_0x1f751b,_0xd0f4('0x18'))[_0xd0f4('0x1c')](',\x20')));}var _0x3698e7=_[_0xd0f4('0x66')](_0x2a0efc[_0xd0f4('0x76')],{'uniqueid':_0x3344ea[_0xd0f4('0x61')]});if(_0x3698e7){_0xca7aa7(_0x3698e7);}else{return _0x4a822a(_0x4b9892['error'](0x1f5,_0xd0f4('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x3d0f40){var _0x5eed6a=this;return new Promise(function(_0x5cd6c4,_0x4c4fa7){if(ami[_0xd0f4('0xf')]()==![]){return _0x4c4fa7(_0x5eed6a[_0xd0f4('0x1a')](0x1f4,[config[_0xd0f4('0x10')]['ip'],config['asterisk'][_0xd0f4('0x11')],_0xd0f4('0x1b')][_0xd0f4('0x1c')]('\x20')));}var _0x29838a=schema(properties[_0xd0f4('0x78')])['validate'](_0x3d0f40);if(_0x29838a[_0xd0f4('0x5b')]>0x0){return _0x4c4fa7(_0x5eed6a[_0xd0f4('0x1a')](0x1f4,_['map'](_0x29838a,_0xd0f4('0x18'))[_0xd0f4('0x1c')](',\x20')));}var _0x4871af=_['find'](_0x2a0efc['queueChannels'],{'uniqueid':_0x3d0f40[_0xd0f4('0x61')]});if(_0x4871af&&_0x4871af[_0xd0f4('0x62')]){return ami[_0xd0f4('0x16')]({'action':_0xd0f4('0x79'),'channel':_0x4871af[_0xd0f4('0x62')]})[_0xd0f4('0x17')](function(_0x1bc3e9){_0x5cd6c4({'code':0xc8,'message':[_0x3d0f40[_0xd0f4('0x61')],_0x1bc3e9[_0xd0f4('0x18')][_0xd0f4('0x68')]()][_0xd0f4('0x1c')]('\x20')});})[_0xd0f4('0x19')](function(_0x4a9707){_0x4c4fa7(_0x5eed6a[_0xd0f4('0x1a')](0x1f5,[_0x3d0f40[_0xd0f4('0x61')],_0x4a9707[_0xd0f4('0x18')][_0xd0f4('0x68')]()]['join']('\x20')));});}else{return _0x4c4fa7(_0x5eed6a[_0xd0f4('0x1a')](0x1f5,_0xd0f4('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x1772eb){var _0x3ee9a2=this;return new Promise(function(_0x5cd6db,_0x5a43d4){if(ami[_0xd0f4('0xf')]()==![]){return _0x5a43d4(_0x3ee9a2['error'](0x1f4,[config[_0xd0f4('0x10')]['ip'],config[_0xd0f4('0x10')][_0xd0f4('0x11')],'ami\x20disconnected'][_0xd0f4('0x1c')]('\x20')));}var _0x1f67c9=schema(properties[_0xd0f4('0x7a')])[_0xd0f4('0x0')](_0x1772eb);if(_0x1f67c9[_0xd0f4('0x5b')]>0x0){return _0x5a43d4(_0x3ee9a2[_0xd0f4('0x1a')](0x1f4,_[_0xd0f4('0x5f')](_0x1f67c9,_0xd0f4('0x18'))[_0xd0f4('0x1c')](',\x20')));}var _0x2b6ab5=_[_0xd0f4('0x66')](_0x2a0efc[_0xd0f4('0x76')],{'uniqueid':_0x1772eb[_0xd0f4('0x61')]});if(_0x2b6ab5&&_0x2b6ab5[_0xd0f4('0x62')]){return ami[_0xd0f4('0x16')]({'action':_0xd0f4('0x7b'),'channel':_0x2b6ab5[_0xd0f4('0x62')],'exten':_0x1772eb[_0xd0f4('0x7c')],'context':_0x1772eb[_0xd0f4('0x7d')]||_0x2b6ab5[_0xd0f4('0x7d')],'priority':0x1})[_0xd0f4('0x17')](function(_0xd3d4c1){_0x5cd6db({'code':0xc8,'message':[_0x1772eb[_0xd0f4('0x61')],_0xd3d4c1[_0xd0f4('0x18')][_0xd0f4('0x68')]()][_0xd0f4('0x1c')]('\x20')});})[_0xd0f4('0x19')](function(_0x554fa0){_0x5a43d4(_0x3ee9a2['error'](0x1f5,[_0x1772eb['uniqueid'],_0x554fa0[_0xd0f4('0x18')]['toLowerCase']()][_0xd0f4('0x1c')]('\x20')));});}else{return _0x5a43d4(_0x3ee9a2['error'](0x1f5,_0xd0f4('0x6f')));}});},'Agents':function(_0x52e1bd){return new Promise(function(_0x4744a2,_0x306536){var _0x3047ea=_[_0xd0f4('0x75')](_0x2a0efc[_0xd0f4('0xb')]);_0x4744a2({'count':_0x3047ea[_0xd0f4('0x5b')],'rows':_0x3047ea});});},'Telephones':function(_0x448230){return new Promise(function(_0x5c739d,_0x4084be){var _0x46fc20=_[_0xd0f4('0x75')](_0x2a0efc[_0xd0f4('0x7e')]);_0x5c739d({'count':_0x46fc20[_0xd0f4('0x5b')],'rows':_0x46fc20});});},'Trunks':function(_0x33c184){return new Promise(function(_0x3b2806,_0x5387b9){var _0x3abb01=_['values'](_0x2a0efc['trunks']);_0x3b2806({'count':_0x3abb01[_0xd0f4('0x5b')],'rows':_0x3abb01});});},'OutboundChannels':function(_0x4a933d){return new Promise(function(_0x29bb5d,_0x3a1082){var _0x98daba=_[_0xd0f4('0x75')](_0x2a0efc[_0xd0f4('0x7f')]);_0x29bb5d({'count':_0x98daba[_0xd0f4('0x5b')],'rows':_0x98daba});});},'Outbound':function(_0x304e1b){return new Promise(function(_0x39d496,_0x36347d){_0x39d496(_0x2a0efc[_0xd0f4('0x80')]);});},'Campaigns':function(_0x2eba1e){return new Promise(function(_0x1f9fe0,_0xf07e9d){var _0x458517=_[_0xd0f4('0x75')](_0x2a0efc['campaigns']);_0x1f9fe0({'count':_0x458517['length'],'rows':_0x458517});});},'VoiceQueuesPreview':function(_0xaa8a15){var _0x96b70a=this;return new Promise(function(_0x4cfd35,_0x3420a7){_0x37c481[_0xd0f4('0x81')](_0xaa8a15['id'])[_0xd0f4('0x17')](function(_0x37ffcf){_0x4cfd35({'code':0xc8,'message':_0x37ffcf[_0xd0f4('0x18')]});})[_0xd0f4('0x19')](function(_0x3fd476){_0x3420a7(_0x96b70a[_0xd0f4('0x1a')](0x1f4,_0x3fd476[_0xd0f4('0x18')]));});});},'EventManager':function(_0x449571){var _0x3ebeb0=this;return new Promise(function(_0x23a765,_0x50b5cc){if(!_0x449571[_0xd0f4('0x82')]){return _0x50b5cc(_0x3ebeb0[_0xd0f4('0x1a')](0x1f4,_0xd0f4('0x83')));}ami[_0xd0f4('0x84')]('custom:'+_0x449571['event'],_0x449571[_0xd0f4('0x18')]);_0x23a765({'code':0xc8,'message':_0x449571});});},'FaxAccounts':function(_0x1c6fa2){return new Promise(function(_0x1e4a88,_0x3721a1){var _0x20a2ac=_['values'](_0x2a0efc[_0xd0f4('0x85')]);_0x1e4a88({'count':_0x20a2ac[_0xd0f4('0x5b')],'rows':_0x20a2ac});});},'SendFax':function(_0x2895c7){var _0x3935b8=this;return new Promise(function(_0x872301,_0x442976){_0x1d9a9d[_0xd0f4('0x86')](_0x2895c7)[_0xd0f4('0x17')](function(_0x5e3890){_0x872301({'code':0xc8,'message':_0x5e3890[_0xd0f4('0x18')]});})[_0xd0f4('0x19')](function(_0x38958d){_0x442976(_0x3935b8[_0xd0f4('0x1a')](0x1f4,_0x38958d[_0xd0f4('0x18')]));});});},'CheckAfterSend':function(_0x2e8887){var _0x3c4379=this;return new Promise(function(_0xa43103,_0x3607b1){_0x1d9a9d[_0xd0f4('0x87')](_0x2e8887)[_0xd0f4('0x17')](function(_0x3e0b37){_0xa43103({'code':0xc8,'message':_0x3e0b37[_0xd0f4('0x18')]});})[_0xd0f4('0x19')](function(_0x2a5142){_0x3607b1(_0x3c4379[_0xd0f4('0x1a')](0x1f4,_0x2a5142['message']));});});}};var _0x2d5b00=jayson[_0xd0f4('0x88')](_0x27acb8)[_0xd0f4('0x89')]();_0x2d5b00['on'](_0xd0f4('0x1a'),function(_0x2bb6ec){return _0x1164da(_0x2bb6ec);});_0x2d5b00[_0xd0f4('0x5')](0x232a,_0xd0f4('0x8a'),function(){console[_0xd0f4('0x8b')](_0xd0f4('0x8c'),0x232a);return _0x531f85(_0xd0f4('0x8d')+0x232a);});});}; \ No newline at end of file +var _0xfdbd=['sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','omit','undefined','values','isConnected','voicechannel','length','map','uniqueid','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','faxAccounts','checkAfterSend','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','module','Action','then','catch','error','message','action','Command','voiceQueues','strategy','available','loggedIn','pTalking'];(function(_0x347412,_0x56166b){var _0x4995b5=function(_0x4480d2){while(--_0x4480d2){_0x347412['push'](_0x347412['shift']());}};_0x4995b5(++_0x56166b);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xdc66e7,_0x13a216){_0xdc66e7=_0xdc66e7-0x0;var _0x1a46af=_0xfdbd[_0xdc66e7];return _0x1a46af;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var jayson=require(_0xdfdb('0x2'));var schema=require(_0xdfdb('0x3'));var BPromise=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var config=require(_0xdfdb('0x6'));var properties=require(_0xdfdb('0x7'));var ami=require(_0xdfdb('0x8'));exports['listen']=function(_0x3f5b2d,_0x4a4a3f,_0x453ef6){return new BPromise(function(_0x41bd5e,_0x489f19){var _0x556dc0={'QueuePause':function(_0x590b5d){return new Promise(function(_0x188508,_0xf72a24){var _0x47c629=util[_0xdfdb('0x9')](_0xdfdb('0xa'),_0xdfdb('0xb'),_0x590b5d[_0xdfdb('0xc')]);if(_0x3f5b2d[_0xdfdb('0xd')]&&_0x3f5b2d[_0xdfdb('0xd')][_0x47c629]&&_0x3f5b2d[_0xdfdb('0xd')][_0x47c629]['timer']){_0x3f5b2d[_0xdfdb('0xd')][_0x47c629][_0xdfdb('0xe')]();}if(_0x3f5b2d['agents'][_0x47c629]){_0x3f5b2d[_0xdfdb('0xf')][_0x47c629][_0xdfdb('0x10')]({'statePause':_0x590b5d[_0xdfdb('0x11')]?!![]:![]});}_0x188508({'code':0xc8,'message':_0xdfdb('0x12')});});},'Reload':function(_0x2a95f1){var _0x13ada2=this;return new Promise(function(_0xf5d903,_0x16017d){if(ami['isConnected']()==![]){return _0x16017d(_0x13ada2['error'](0x1f4,[config[_0xdfdb('0x13')]['ip'],config['asterisk'][_0xdfdb('0x14')],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}_0x2a95f1=_[_0xdfdb('0x17')](_0x2a95f1,_[_0xdfdb('0x18')](properties[_0xdfdb('0x19')]));_0x2a95f1['action']='Reload';return ami[_0xdfdb('0x1a')](_0x2a95f1)[_0xdfdb('0x1b')](function(_0x2c1070){_0xf5d903({'code':0xc8,'message':_0x2c1070['message']});})[_0xdfdb('0x1c')](function(_0xb677b1){_0x16017d(_0x13ada2[_0xdfdb('0x1d')](0x1f5,_0xb677b1[_0xdfdb('0x1e')]));});});},'Command':function(_0x306a33){var _0x2294de=this;return new Promise(function(_0x693a2c,_0x29a639){if(ami['isConnected']()==![]){return _0x29a639(_0x2294de[_0xdfdb('0x1d')](0x1f4,[config[_0xdfdb('0x13')]['ip'],config[_0xdfdb('0x13')]['username'],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}_0x306a33=_[_0xdfdb('0x17')](_0x306a33,'command');_0x306a33[_0xdfdb('0x1f')]=_0xdfdb('0x20');return ami[_0xdfdb('0x1a')](_0x306a33)['then'](function(_0x2a80c1){_0x693a2c({'code':0xc8,'message':_0x2a80c1['content']});})[_0xdfdb('0x1c')](function(_0x145350){_0x29a639(_0x2294de[_0xdfdb('0x1d')](0x1f5,_0x145350[_0xdfdb('0x1e')]));});});},'VoiceQueues':function(_0x4f69cf){return new Promise(function(_0x4c253e,_0x4363d8){var _0x956843=[];for(var _0x400663 in _0x3f5b2d[_0xdfdb('0x21')]){if(_0x3f5b2d[_0xdfdb('0x21')]['hasOwnProperty'](_0x400663)){var _0xec4d22=_0x3f5b2d[_0xdfdb('0x21')][_0x400663];var _0xdf3a5c={'id':_0xec4d22['id'],'name':_0xec4d22['name'],'strategy':_0xec4d22[_0xdfdb('0x22')],'answered':_0xec4d22['answered'],'available':_0xec4d22[_0xdfdb('0x23')],'loggedIn':_0xec4d22[_0xdfdb('0x24')],'pTalking':_0xec4d22[_0xdfdb('0x25')],'sumBillable':_0xec4d22['sumBillable'],'sumDuration':_0xec4d22['sumDuration'],'sumHoldTime':_0xec4d22[_0xdfdb('0x26')]||0x0,'talking':_0xec4d22[_0xdfdb('0x27')],'total':_0xec4d22[_0xdfdb('0x28')],'type':_0xec4d22[_0xdfdb('0x29')],'unmanaged':_0xec4d22[_0xdfdb('0x2a')],'abandoned':_0xec4d22[_0xdfdb('0x2b')],'waiting':_0xec4d22['waiting'],'loggedInDb':_0xec4d22[_0xdfdb('0x2c')]};if(_0xec4d22[_0xdfdb('0x29')]===_0xdfdb('0x2d')){_0xdf3a5c[_0xdfdb('0x2e')]=_0xec4d22[_0xdfdb('0x2e')];_0xdf3a5c[_0xdfdb('0x2f')]=_0xec4d22[_0xdfdb('0x2f')];_0xdf3a5c[_0xdfdb('0x30')]=_0xec4d22[_0xdfdb('0x30')];_0xdf3a5c[_0xdfdb('0x31')]=_0xec4d22[_0xdfdb('0x31')];_0xdf3a5c['dialOriginateTimeout']=_0xec4d22['dialOriginateTimeout'];_0xdf3a5c[_0xdfdb('0x32')]=_0xec4d22['dialPrefix'];_0xdf3a5c[_0xdfdb('0x33')]=_0xec4d22[_0xdfdb('0x33')];_0xdf3a5c[_0xdfdb('0x34')]=_0xec4d22[_0xdfdb('0x34')];_0xdf3a5c['outboundAnswerCallsDay']=_0xec4d22[_0xdfdb('0x35')];_0xdf3a5c['outboundBlacklistCallsDay']=_0xec4d22[_0xdfdb('0x36')];_0xdf3a5c[_0xdfdb('0x37')]=_0xec4d22[_0xdfdb('0x37')];_0xdf3a5c[_0xdfdb('0x38')]=_0xec4d22[_0xdfdb('0x38')];_0xdf3a5c[_0xdfdb('0x39')]=_0xec4d22['outboundDropCallsDayACS'];_0xdf3a5c[_0xdfdb('0x3a')]=_0xec4d22[_0xdfdb('0x3a')];_0xdf3a5c['outboundDropCallsDayTimeout']=_0xec4d22[_0xdfdb('0x3b')];_0xdf3a5c[_0xdfdb('0x3c')]=_0xec4d22[_0xdfdb('0x3c')];_0xdf3a5c[_0xdfdb('0x3d')]=_0xec4d22[_0xdfdb('0x3d')];_0xdf3a5c[_0xdfdb('0x3e')]=_0xec4d22[_0xdfdb('0x3e')];_0xdf3a5c[_0xdfdb('0x3f')]=_0xec4d22[_0xdfdb('0x3f')];_0xdf3a5c[_0xdfdb('0x40')]=_0xec4d22[_0xdfdb('0x40')];_0xdf3a5c['outboundUnknownCallsDay']=_0xec4d22[_0xdfdb('0x41')];_0xdf3a5c[_0xdfdb('0x42')]=_0xec4d22[_0xdfdb('0x42')];_0xdf3a5c[_0xdfdb('0x43')]=_0xec4d22[_0xdfdb('0x43')];_0xdf3a5c[_0xdfdb('0x44')]=_0xec4d22[_0xdfdb('0x44')];_0xdf3a5c[_0xdfdb('0x45')]=_0xec4d22['predictiveIntervalDroppedCallsCallersExit'];_0xdf3a5c['predictiveIntervalDroppedCallsTimeout']=_0xec4d22[_0xdfdb('0x46')];_0xdf3a5c[_0xdfdb('0x47')]=_0xec4d22[_0xdfdb('0x47')];_0xdf3a5c[_0xdfdb('0x48')]=_0xec4d22[_0xdfdb('0x48')];_0xdf3a5c[_0xdfdb('0x49')]=_0xec4d22[_0xdfdb('0x49')];_0xdf3a5c[_0xdfdb('0x4a')]=_0xec4d22[_0xdfdb('0x4a')];_0xdf3a5c['predictiveIntervalPauses']=_0xec4d22[_0xdfdb('0x4b')];_0xdf3a5c[_0xdfdb('0x4c')]=_0xec4d22[_0xdfdb('0x4c')];_0xdf3a5c[_0xdfdb('0x4d')]=_0xec4d22[_0xdfdb('0x4d')];_0xdf3a5c['message']=_0xec4d22[_0xdfdb('0x1e')];_0xdf3a5c[_0xdfdb('0x4e')]=_0xec4d22[_0xdfdb('0x4e')];_0xdf3a5c[_0xdfdb('0x4f')]=_0xec4d22[_0xdfdb('0x4f')];_0xdf3a5c['erlangCallToSecond']=_0xec4d22[_0xdfdb('0x50')];_0xdf3a5c[_0xdfdb('0x51')]=_0xec4d22[_0xdfdb('0x51')];_0xdf3a5c['erlangBusyFactor']=_0xec4d22[_0xdfdb('0x52')];_0xdf3a5c['startPredictive']=_0xec4d22[_0xdfdb('0x53')];_0xdf3a5c['startProgressive']=_0xec4d22[_0xdfdb('0x54')];}if(_0xec4d22[_0xdfdb('0x55')]){_0xdf3a5c['Trunk']={'id':_0xec4d22[_0xdfdb('0x55')]['id'],'name':_0xec4d22['Trunk'][_0xdfdb('0xc')],'active':_0xec4d22[_0xdfdb('0x55')][_0xdfdb('0x56')],'callerid':_0xec4d22[_0xdfdb('0x55')][_0xdfdb('0x57')]};}if(_0xec4d22['Interval']){_0xdf3a5c['Interval']={'id':_0xec4d22[_0xdfdb('0x58')]['id'],'name':_0xec4d22[_0xdfdb('0x58')]['name']};}_0x956843[_0xdfdb('0x59')](_0xdf3a5c);}}_0x4c253e({'count':_0x956843['length'],'rows':_0x956843});});},'UpdateVoiceQueue':function(_0xa7be4b){return new Promise(function(_0x158407,_0x8b1db1){var _0x103166=_[_0xdfdb('0x5a')](_0x3f5b2d[_0xdfdb('0x21')],{'id':parseInt(_0xa7be4b['id'])});var _0x41701c=_[_0xdfdb('0x5b')](_0xa7be4b,['id']);if(_0x103166){for(var _0x2ac36e in _0x41701c){if(typeof _0x41701c[_0x2ac36e]!==_0xdfdb('0x5c')&&typeof _0x103166[_0x2ac36e]!==_0xdfdb('0x5c')){_0x103166[_0x2ac36e]=_0x41701c[_0x2ac36e];}}_0x158407(_0x103166);}else{_0x8b1db1();}});},'VoiceChannels':function(_0x3c8460){return new Promise(function(_0x2d58f4,_0x202c25){var _0x1c08fb=_[_0xdfdb('0x5d')](_0x3f5b2d['channels']);_0x2d58f4({'count':_0x1c08fb['length'],'rows':_0x1c08fb});});},'VoiceChannelMixMonitor':function(_0x6b03a3){var _0x1aff71=this;return new Promise(function(_0x2f1d06,_0x4bbb88){if(ami[_0xdfdb('0x5e')]()==![]){return _0x4bbb88(_0x1aff71[_0xdfdb('0x1d')](0x1f4,[config[_0xdfdb('0x13')]['ip'],config[_0xdfdb('0x13')]['username'],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}var _0x5446f6=schema(properties[_0xdfdb('0x5f')])[_0xdfdb('0x3')](_0x6b03a3);if(_0x5446f6[_0xdfdb('0x60')]>0x0){return _0x4bbb88(_0x1aff71[_0xdfdb('0x1d')](0x1f4,_[_0xdfdb('0x61')](_0x5446f6,_0xdfdb('0x1e'))[_0xdfdb('0x16')](',\x20')));}var _0x1f5b88=_[_0xdfdb('0x5a')](_0x3f5b2d['channels'],{'uniqueid':_0x6b03a3[_0xdfdb('0x62')]});if(_0x1f5b88&&_0x1f5b88['channel']){var _0x15185c=util[_0xdfdb('0x9')](_0xdfdb('0x63'),_0x6b03a3[_0xdfdb('0x64')]||_0x6b03a3[_0xdfdb('0x62')],_0x6b03a3[_0xdfdb('0x9')]||_0xdfdb('0x65'));return ami['Action']({'action':_0xdfdb('0x66'),'channel':_0x1f5b88[_0xdfdb('0x67')],'file':_0x15185c,'options':_0xdfdb('0x68')})[_0xdfdb('0x1b')](function(_0xd2b334){var _0x5018a0=_[_0xdfdb('0x5a')](_0x1f5b88['monitors'],{'filename':_0xdfdb('0x69')+_0x15185c[_0xdfdb('0x6a')]()});if(_[_0xdfdb('0x6b')](_0x5018a0)){_0x1f5b88[_0xdfdb('0x6c')][_0xdfdb('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x15185c[_0xdfdb('0x6a')](),'createdAt':moment()[_0xdfdb('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0xd2b334[_0xdfdb('0x6d')],'status':_0xdfdb('0x6e')});}else{_0x5018a0[_0xdfdb('0x6d')]=_0xd2b334['mixmonitorid'];_0x5018a0[_0xdfdb('0x6f')]=_0xdfdb('0x6e');}_0x2f1d06({'code':0xc8,'message':[_0x6b03a3[_0xdfdb('0x62')],_0xdfdb('0x70'),_0xd2b334[_0xdfdb('0x6d')]][_0xdfdb('0x16')]('\x20'),'mixmonitorid':_0xd2b334['mixmonitorid']});})['catch'](function(_0x21b486){_0x4bbb88(_0x1aff71['error'](0x1f5,[_0x6b03a3['uniqueid'],_0x21b486['message'][_0xdfdb('0x6a')]()][_0xdfdb('0x16')]('\x20')));});}else{return _0x4bbb88(_0x1aff71[_0xdfdb('0x1d')](0x1f5,_0xdfdb('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x8bd5c0){var _0x17834e=this;return new Promise(function(_0xa1d520,_0x1132ca){if(ami[_0xdfdb('0x5e')]()==![]){return _0x1132ca(_0x17834e['error'](0x1f4,[config['asterisk']['ip'],config[_0xdfdb('0x13')]['username'],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}var _0x3ec0c6=schema(properties['voicechannel'])[_0xdfdb('0x3')](_0x8bd5c0);if(_0x3ec0c6[_0xdfdb('0x60')]>0x0){return _0x1132ca(_0x17834e[_0xdfdb('0x1d')](0x1f4,_[_0xdfdb('0x61')](_0x3ec0c6,_0xdfdb('0x1e'))[_0xdfdb('0x16')](',\x20')));}var _0x7e6cd1=_[_0xdfdb('0x5a')](_0x3f5b2d['channels'],{'uniqueid':_0x8bd5c0[_0xdfdb('0x62')]});if(_0x7e6cd1){return BPromise[_0xdfdb('0x72')]()['then'](function(){if(_0x7e6cd1[_0xdfdb('0x67')]){return ami[_0xdfdb('0x1a')]({'action':_0xdfdb('0x73'),'channel':_0x7e6cd1[_0xdfdb('0x67')],'mixmonitorid':_0x8bd5c0['mixmonitorid']})['catch'](function(_0x140467){});}})[_0xdfdb('0x1b')](function(){if(_0x7e6cd1['destinationchannel']){return ami[_0xdfdb('0x1a')]({'action':_0xdfdb('0x73'),'channel':_0x7e6cd1[_0xdfdb('0x74')],'mixmonitorid':_0x8bd5c0['mixmonitorid']})['catch'](function(_0x42ad97){});}})[_0xdfdb('0x1b')](function(_0x5cfade){var _0x57ac74=_[_0xdfdb('0x5a')](_0x7e6cd1['monitors'],{'mixmonitorid':_0x8bd5c0['mixmonitorid']});if(_0x57ac74){_0x57ac74[_0xdfdb('0x6f')]='stop';}})[_0xdfdb('0x1b')](function(){var _0x1f0727=util['format']('%s.%s',_0x8bd5c0[_0xdfdb('0x64')]||_0x8bd5c0[_0xdfdb('0x62')],_0x8bd5c0['format']||_0xdfdb('0x65'));var _0xe7a000=_[_0xdfdb('0x5a')](_0x7e6cd1[_0xdfdb('0x6c')],{'filename':_0xdfdb('0x69')+_0x1f0727['toLowerCase']()});if(_0xe7a000){_0xe7a000['status']=_0xdfdb('0x75');}})[_0xdfdb('0x1b')](function(){_0xa1d520({'code':0xc8,'message':[_0x8bd5c0[_0xdfdb('0x62')],_0xdfdb('0x76')][_0xdfdb('0x16')]('\x20')});})[_0xdfdb('0x1c')](function(_0x505073){_0x1132ca(_0x17834e[_0xdfdb('0x1d')](0x1f5,[_0x8bd5c0[_0xdfdb('0x62')],_0x505073[_0xdfdb('0x1e')][_0xdfdb('0x6a')]()][_0xdfdb('0x16')]('\x20')));});}else{return _0x1132ca(_0x17834e[_0xdfdb('0x1d')](0x1f5,_0xdfdb('0x71')));}});},'VoiceQueuesChannels':function(_0x4cdcdc){return new Promise(function(_0x38fa9c,_0x3eca7f){var _0x5ae367=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0x77')]);_0x38fa9c({'count':_0x5ae367[_0xdfdb('0x60')],'rows':_0x5ae367});});},'VoiceQueuesChannel':function(_0x45bfc0){var _0x2c9405=this;return new Promise(function(_0x590a16,_0x2df838){var _0x2b9971=schema(properties[_0xdfdb('0x78')])[_0xdfdb('0x3')](_0x45bfc0);if(_0x2b9971['length']>0x0){return _0x2df838(_0x2c9405[_0xdfdb('0x1d')](0x1f4,_[_0xdfdb('0x61')](_0x2b9971,_0xdfdb('0x1e'))[_0xdfdb('0x16')](',\x20')));}var _0x2edd45=_[_0xdfdb('0x5a')](_0x3f5b2d[_0xdfdb('0x77')],{'uniqueid':_0x45bfc0[_0xdfdb('0x62')]});if(_0x2edd45){_0x590a16(_0x2edd45);}else{return _0x2df838(_0x2c9405[_0xdfdb('0x1d')](0x1f5,_0xdfdb('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x4eacf){var _0x5ea604=this;return new Promise(function(_0x1bf0d2,_0x616d29){if(ami['isConnected']()==![]){return _0x616d29(_0x5ea604[_0xdfdb('0x1d')](0x1f4,[config[_0xdfdb('0x13')]['ip'],config[_0xdfdb('0x13')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x9f2170=schema(properties[_0xdfdb('0x79')])[_0xdfdb('0x3')](_0x4eacf);if(_0x9f2170[_0xdfdb('0x60')]>0x0){return _0x616d29(_0x5ea604[_0xdfdb('0x1d')](0x1f4,_[_0xdfdb('0x61')](_0x9f2170,_0xdfdb('0x1e'))['join'](',\x20')));}var _0x7f85ce=_[_0xdfdb('0x5a')](_0x3f5b2d[_0xdfdb('0x77')],{'uniqueid':_0x4eacf[_0xdfdb('0x62')]});if(_0x7f85ce&&_0x7f85ce[_0xdfdb('0x67')]){return ami[_0xdfdb('0x1a')]({'action':_0xdfdb('0x7a'),'channel':_0x7f85ce['channel']})[_0xdfdb('0x1b')](function(_0x117cd7){_0x1bf0d2({'code':0xc8,'message':[_0x4eacf[_0xdfdb('0x62')],_0x117cd7[_0xdfdb('0x1e')][_0xdfdb('0x6a')]()]['join']('\x20')});})[_0xdfdb('0x1c')](function(_0x56a633){_0x616d29(_0x5ea604[_0xdfdb('0x1d')](0x1f5,[_0x4eacf[_0xdfdb('0x62')],_0x56a633[_0xdfdb('0x1e')][_0xdfdb('0x6a')]()][_0xdfdb('0x16')]('\x20')));});}else{return _0x616d29(_0x5ea604['error'](0x1f5,_0xdfdb('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x1f8e13){var _0x55cf4d=this;return new Promise(function(_0x5f32f7,_0x284439){if(ami['isConnected']()==![]){return _0x284439(_0x55cf4d['error'](0x1f4,[config[_0xdfdb('0x13')]['ip'],config[_0xdfdb('0x13')][_0xdfdb('0x14')],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}var _0x4669c2=schema(properties[_0xdfdb('0x7b')])[_0xdfdb('0x3')](_0x1f8e13);if(_0x4669c2['length']>0x0){return _0x284439(_0x55cf4d[_0xdfdb('0x1d')](0x1f4,_['map'](_0x4669c2,_0xdfdb('0x1e'))[_0xdfdb('0x16')](',\x20')));}var _0xffc426=_[_0xdfdb('0x5a')](_0x3f5b2d[_0xdfdb('0x77')],{'uniqueid':_0x1f8e13['uniqueid']});if(_0xffc426&&_0xffc426[_0xdfdb('0x67')]){return ami[_0xdfdb('0x1a')]({'action':_0xdfdb('0x7c'),'channel':_0xffc426[_0xdfdb('0x67')],'exten':_0x1f8e13[_0xdfdb('0x7d')],'context':_0x1f8e13['context']||_0xffc426['context'],'priority':0x1})[_0xdfdb('0x1b')](function(_0x68fad5){_0x5f32f7({'code':0xc8,'message':[_0x1f8e13['uniqueid'],_0x68fad5[_0xdfdb('0x1e')]['toLowerCase']()][_0xdfdb('0x16')]('\x20')});})[_0xdfdb('0x1c')](function(_0xeadf25){_0x284439(_0x55cf4d['error'](0x1f5,[_0x1f8e13[_0xdfdb('0x62')],_0xeadf25['message']['toLowerCase']()][_0xdfdb('0x16')]('\x20')));});}else{return _0x284439(_0x55cf4d['error'](0x1f5,_0xdfdb('0x71')));}});},'Agents':function(_0x3a16e2){return new Promise(function(_0x162eeb,_0x24bd3c){var _0x191d45=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0xf')]);_0x162eeb({'count':_0x191d45[_0xdfdb('0x60')],'rows':_0x191d45});});},'Telephones':function(_0x1fb331){return new Promise(function(_0x40cfba,_0x5ed460){var _0x5d2dc1=_[_0xdfdb('0x5d')](_0x3f5b2d['telephones']);_0x40cfba({'count':_0x5d2dc1['length'],'rows':_0x5d2dc1});});},'Trunks':function(_0x5542da){return new Promise(function(_0x4dcfbd,_0x197f51){var _0x2caabb=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0x7e')]);_0x4dcfbd({'count':_0x2caabb[_0xdfdb('0x60')],'rows':_0x2caabb});});},'OutboundChannels':function(_0x12f4f7){return new Promise(function(_0x479488,_0x114373){var _0x258738=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0x7f')]);_0x479488({'count':_0x258738[_0xdfdb('0x60')],'rows':_0x258738});});},'Outbound':function(_0x309be3){return new Promise(function(_0x561ced,_0x5979fa){_0x561ced(_0x3f5b2d[_0xdfdb('0x2d')]);});},'Campaigns':function(_0x45fcae){return new Promise(function(_0x5837da,_0x82e712){var _0x44d944=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0x80')]);_0x5837da({'count':_0x44d944[_0xdfdb('0x60')],'rows':_0x44d944});});},'VoiceQueuesPreview':function(_0xd72296){var _0x5bc5a9=this;return new Promise(function(_0x306e18,_0x3a2d02){_0x4a4a3f[_0xdfdb('0x81')](_0xd72296['id'])[_0xdfdb('0x1b')](function(_0x23cbd0){_0x306e18({'code':0xc8,'message':_0x23cbd0[_0xdfdb('0x1e')]});})['catch'](function(_0x156da8){_0x3a2d02(_0x5bc5a9[_0xdfdb('0x1d')](0x1f4,_0x156da8[_0xdfdb('0x1e')]));});});},'EventManager':function(_0x3c09ec){var _0x370c7b=this;return new Promise(function(_0x2bd06f,_0x5e67bd){if(!_0x3c09ec[_0xdfdb('0x82')]){return _0x5e67bd(_0x370c7b[_0xdfdb('0x1d')](0x1f4,_0xdfdb('0x83')));}ami['emit']('custom:'+_0x3c09ec[_0xdfdb('0x82')],_0x3c09ec['message']);_0x2bd06f({'code':0xc8,'message':_0x3c09ec});});},'FaxAccounts':function(_0x5c7601){return new Promise(function(_0x276efc,_0x27c72c){var _0x57d5e3=_['values'](_0x3f5b2d[_0xdfdb('0x84')]);_0x276efc({'count':_0x57d5e3[_0xdfdb('0x60')],'rows':_0x57d5e3});});},'SendFax':function(_0x1f87d3){var _0x1bc293=this;return new Promise(function(_0x36b01e,_0x5b883b){_0x453ef6['send'](_0x1f87d3)[_0xdfdb('0x1b')](function(_0x576570){_0x36b01e({'code':0xc8,'message':_0x576570[_0xdfdb('0x1e')]});})[_0xdfdb('0x1c')](function(_0x3c9465){_0x5b883b(_0x1bc293['error'](0x1f4,_0x3c9465[_0xdfdb('0x1e')]));});});},'CheckAfterSend':function(_0x38a439){var _0x3e0208=this;return new Promise(function(_0x14293d,_0x4c08d0){_0x453ef6[_0xdfdb('0x85')](_0x38a439)[_0xdfdb('0x1b')](function(_0x3fe95d){_0x14293d({'code':0xc8,'message':_0x3fe95d[_0xdfdb('0x1e')]});})['catch'](function(_0xa31219){_0x4c08d0(_0x3e0208['error'](0x1f4,_0xa31219['message']));});});}};var _0x55a7d2=jayson['server'](_0x556dc0)['http']();_0x55a7d2['on'](_0xdfdb('0x1d'),function(_0xe8ac6c){return _0x489f19(_0xe8ac6c);});_0x55a7d2[_0xdfdb('0x86')](0x232a,_0xdfdb('0x87'),function(){console[_0xdfdb('0x88')](_0xdfdb('0x89'),0x232a);return _0x41bd5e(_0xdfdb('0x8a')+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 fb1c090..d47483a 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 _0xd0bb=['format','user:%s','name','trigger:%s','merge','lodash','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','redis','info','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','fax','ListId','createdAt','scheduledAt','union','resolve','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','destcalleridname','Unknown','then','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xd12233,_0x19c37e){_0xd12233=_0xd12233-0x0;var _0x89aefd=_0xd0bb[_0xd12233];return _0x89aefd;};'use strict';var _=require(_0xbd0b('0x0'));var BPromise=require(_0xbd0b('0x1'));var Redis=require(_0xbd0b('0x2'));var util=require('util');var config=require(_0xbd0b('0x3'));var logger=require('../../../../config/logger')(_0xbd0b('0x4'));var cmContactRpc=require(_0xbd0b('0x5'));config['redis']=_[_0xbd0b('0x6')](config['redis'],{'host':_0xbd0b('0x7'),'port':0x18eb});var io=require(_0xbd0b('0x8'))(new Redis(config[_0xbd0b('0x9')]));function emit(_0x37c205,_0x809599,_0x5eb975,_0x2a4075,_0x4533ff){logger[_0xbd0b('0xa')](_0xbd0b('0xb'),_0x37c205,_0x809599['id'],_0x5eb975,_0x2a4075,JSON[_0xbd0b('0xc')](_0x4533ff));io['to'](_0x5eb975)['emit'](_0x2a4075,_0x4533ff);}exports['exec']=function(_0x14bc5b,_0x110cf1,_0x4a69ff,_0x26b834){var _0x196beb,_0x526258;var _0x1e3173={};var _0x15919b=Number(_0x4a69ff[_0xbd0b('0xd')]);var _0x315ed9=_0x4a69ff[_0xbd0b('0xe')]?Boolean(Number(_0x4a69ff[_0xbd0b('0xe')])):![];var _0x420f96;var _0x1f25b6=![];if(!_[_0xbd0b('0xf')](_0x4a69ff[_0xbd0b('0x10')])){if(_0x4a69ff[_0xbd0b('0x10')]=='1')_0x1f25b6=!![];}if(!_0x1f25b6){if(_0x26b834['xmd-contactid']){_0x1e3173['id']=_0x26b834[_0xbd0b('0x11')];}}if(!_0x1e3173['id']){_0x1e3173['ListId']=_0x15919b;_0x420f96=_0x4a69ff['data3']&&_0x4a69ff[_0xbd0b('0x12')]!=='0'?_0x4a69ff[_0xbd0b('0x12')][_0xbd0b('0x13')](','):[_0xbd0b('0x14')];_0x1e3173[_0xbd0b('0x15')]=_['map'](_0x420f96,function(_0x55e0a1){var _0x2136ef={};_0x2136ef[_0x55e0a1]=_0x26b834[_0xbd0b('0x16')]?_0x26b834[_0xbd0b('0x17')]:_0x26b834[_0xbd0b('0x18')];return _0x2136ef;});}var _0x1c0a7c=['id',_0xbd0b('0x19'),'lastName',_0xbd0b('0x14'),'mobile',_0xbd0b('0x1a'),_0xbd0b('0x1b'),_0xbd0b('0x1c'),_0xbd0b('0x1d'),'updatedAt'];var _0x403c91=_[_0xbd0b('0x1e')](_0x1c0a7c,_0x420f96);BPromise[_0xbd0b('0x1f')]()['then'](cmContactRpc[_0xbd0b('0x20')]({'attributes':_0x403c91,'where':_0x1e3173}))['then'](function(_0xc66b8){_0x526258=_0xc66b8;if(!_[_0xbd0b('0x21')](_0x526258)){if(_0x526258[_0xbd0b('0x22')]===0x1){_0x196beb=_0x526258[0x0];logger[_0xbd0b('0xa')](_0xbd0b('0x23'),_0x26b834['uniqueid'],_0x110cf1['id'],_0x196beb['id']);}else{logger[_0xbd0b('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x26b834[_0xbd0b('0x24')],_0x110cf1['id'],_[_0xbd0b('0x25')](_0x526258,'id')[_0xbd0b('0x26')](','));}return;}else{logger[_0xbd0b('0xa')](_0xbd0b('0x27'),_0x26b834[_0xbd0b('0x24')],_0x110cf1['id']);var _0x4fe9ed={'ListId':_0x15919b};var _0x382f76=_0x4a69ff[_0xbd0b('0x28')]&&_0x4a69ff[_0xbd0b('0x28')]!=='0'?_0x4a69ff[_0xbd0b('0x28')]:_0xbd0b('0x14');if(_0x315ed9){logger[_0xbd0b('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x26b834[_0xbd0b('0x24')],_0x110cf1['id']);_0x4fe9ed[_0x382f76]=_[_0xbd0b('0xf')](_0x26b834[_0xbd0b('0x16')])?_0x26b834['calleridnum']:_0x26b834['destcalleridnum'];if(_[_0xbd0b('0xf')](_0x26b834[_0xbd0b('0x16')])){_0x4fe9ed[_0xbd0b('0x19')]=_0x26b834[_0xbd0b('0x29')]&&_0x26b834[_0xbd0b('0x29')]!==_0xbd0b('0x2a')?_0x26b834[_0xbd0b('0x29')]:'Unknown';}else{_0x4fe9ed[_0xbd0b('0x19')]=_0x26b834[_0xbd0b('0x2b')]&&_0x26b834['destcalleridname']!==''?_0x26b834[_0xbd0b('0x2b')]:_0xbd0b('0x2c');}return BPromise['resolve']()[_0xbd0b('0x2d')](cmContactRpc[_0xbd0b('0x2e')](_0x4fe9ed))[_0xbd0b('0x2d')](function(_0x417e25){_0x196beb=_0x417e25;_0x526258[_0xbd0b('0x2f')](_0x417e25);if(_0x196beb){logger[_0xbd0b('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x26b834[_0xbd0b('0x24')],_0x110cf1['id'],_0x196beb['id']);}return;});}else{logger[_0xbd0b('0xa')](_0xbd0b('0x30'),_0x26b834[_0xbd0b('0x24')],_0x110cf1['id']);_0x4fe9ed[_0x382f76]=_[_0xbd0b('0xf')](_0x26b834[_0xbd0b('0x16')])?_0x26b834[_0xbd0b('0x18')]:_0x26b834[_0xbd0b('0x17')];if(_[_0xbd0b('0xf')](_0x26b834[_0xbd0b('0x16')])){_0x4fe9ed[_0xbd0b('0x19')]=_0x26b834[_0xbd0b('0x29')]&&_0x26b834[_0xbd0b('0x29')]!==_0xbd0b('0x2a')?_0x26b834['calleridname']:_0xbd0b('0x2c');}else{_0x4fe9ed[_0xbd0b('0x19')]=_0x26b834['destcalleridname']&&_0x26b834[_0xbd0b('0x2b')]!==_0xbd0b('0x2a')?_0x26b834[_0xbd0b('0x2b')]:_0xbd0b('0x2c');}_0x196beb=_0x4fe9ed;_0x526258[_0xbd0b('0x2f')](_0x4fe9ed);return;}}})[_0xbd0b('0x2d')](function(){if(_0x14bc5b){emit(_0x26b834['uniqueid'],_0x110cf1,util[_0xbd0b('0x31')](_0xbd0b('0x32'),_0x14bc5b[_0xbd0b('0x33')]),util[_0xbd0b('0x31')](_0xbd0b('0x34'),_0x4a69ff['action']['toLowerCase']()),{'evt':_[_0xbd0b('0x35')](_0x26b834,{'autoCreate':_0x315ed9}),'contact':_0x196beb===undefined?{}:_0x196beb,'contacts':_0x526258[_0xbd0b('0x22')]===0x0?undefined:_0x526258});}});}; \ No newline at end of file +var _0x207c=['defaults','redis','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact'];(function(_0x5c9f92,_0x43117d){var _0x27ee28=function(_0x4ae8f8){while(--_0x4ae8f8){_0x5c9f92['push'](_0x5c9f92['shift']());}};_0x27ee28(++_0x43117d);}(_0x207c,0x1e8));var _0xc207=function(_0x29fc2c,_0x4ff86a){_0x29fc2c=_0x29fc2c-0x0;var _0x1adbc8=_0x207c[_0x29fc2c];return _0x1adbc8;};'use strict';var _=require('lodash');var BPromise=require(_0xc207('0x0'));var Redis=require(_0xc207('0x1'));var util=require(_0xc207('0x2'));var config=require(_0xc207('0x3'));var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var cmContactRpc=require(_0xc207('0x6'));config['redis']=_[_0xc207('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc207('0x8')]));function emit(_0x314561,_0x3395e4,_0x59ff6f,_0x25cb97,_0xad159b){logger[_0xc207('0x9')]('[CM][%s][%s]',_0x314561,_0x3395e4['id'],_0x59ff6f,_0x25cb97,JSON[_0xc207('0xa')](_0xad159b));io['to'](_0x59ff6f)[_0xc207('0xb')](_0x25cb97,_0xad159b);}exports[_0xc207('0xc')]=function(_0x13ec41,_0x201162,_0x347549,_0x487d95){var _0x574425,_0x5b556f;var _0x19b297={};var _0x491062=Number(_0x347549[_0xc207('0xd')]);var _0x2782ce=_0x347549['data2']?Boolean(Number(_0x347549[_0xc207('0xe')])):![];var _0xb86b06;var _0x3062f5=![];if(!_[_0xc207('0xf')](_0x347549[_0xc207('0x10')])){if(_0x347549['data5']=='1')_0x3062f5=!![];}if(!_0x3062f5){if(_0x487d95[_0xc207('0x11')]){_0x19b297['id']=_0x487d95[_0xc207('0x11')];}}if(!_0x19b297['id']){_0x19b297[_0xc207('0x12')]=_0x491062;_0xb86b06=_0x347549[_0xc207('0x13')]&&_0x347549['data3']!=='0'?_0x347549['data3']['split'](','):[_0xc207('0x14')];_0x19b297[_0xc207('0x15')]=_[_0xc207('0x16')](_0xb86b06,function(_0x65f539){var _0x4b8f44={};_0x4b8f44[_0x65f539]=_0x487d95[_0xc207('0x17')]?_0x487d95[_0xc207('0x18')]:_0x487d95[_0xc207('0x19')];return _0x4b8f44;});}var _0x5f288e=['id',_0xc207('0x1a'),'lastName',_0xc207('0x14'),_0xc207('0x1b'),_0xc207('0x1c'),_0xc207('0x12'),_0xc207('0x1d'),_0xc207('0x1e'),_0xc207('0x1f')];var _0x464dea=_[_0xc207('0x20')](_0x5f288e,_0xb86b06);BPromise[_0xc207('0x21')]()[_0xc207('0x22')](cmContactRpc[_0xc207('0x23')]({'attributes':_0x464dea,'where':_0x19b297}))[_0xc207('0x22')](function(_0x4b52a7){_0x5b556f=_0x4b52a7;if(!_[_0xc207('0x24')](_0x5b556f)){if(_0x5b556f['length']===0x1){_0x574425=_0x5b556f[0x0];logger[_0xc207('0x9')](_0xc207('0x25'),_0x487d95[_0xc207('0x26')],_0x201162['id'],_0x574425['id']);}else{logger[_0xc207('0x9')](_0xc207('0x27'),_0x487d95[_0xc207('0x26')],_0x201162['id'],_[_0xc207('0x16')](_0x5b556f,'id')[_0xc207('0x28')](','));}return;}else{logger[_0xc207('0x9')](_0xc207('0x29'),_0x487d95[_0xc207('0x26')],_0x201162['id']);var _0x27df03={'ListId':_0x491062};var _0x3f738e=_0x347549[_0xc207('0x2a')]&&_0x347549[_0xc207('0x2a')]!=='0'?_0x347549['data4']:_0xc207('0x14');if(_0x2782ce){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x487d95[_0xc207('0x26')],_0x201162['id']);_0x27df03[_0x3f738e]=_[_0xc207('0xf')](_0x487d95[_0xc207('0x17')])?_0x487d95[_0xc207('0x19')]:_0x487d95[_0xc207('0x18')];if(_['isNil'](_0x487d95[_0xc207('0x17')])){_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2b')]&&_0x487d95[_0xc207('0x2b')]!==_0xc207('0x2c')?_0x487d95[_0xc207('0x2b')]:_0xc207('0x2d');}else{_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2e')]&&_0x487d95[_0xc207('0x2e')]!==_0xc207('0x2c')?_0x487d95[_0xc207('0x2e')]:_0xc207('0x2d');}return BPromise['resolve']()[_0xc207('0x22')](cmContactRpc[_0xc207('0x2f')](_0x27df03))[_0xc207('0x22')](function(_0x448df1){_0x574425=_0x448df1;_0x5b556f[_0xc207('0x30')](_0x448df1);if(_0x574425){logger[_0xc207('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x487d95[_0xc207('0x26')],_0x201162['id'],_0x574425['id']);}return;});}else{logger[_0xc207('0x9')](_0xc207('0x31'),_0x487d95[_0xc207('0x26')],_0x201162['id']);_0x27df03[_0x3f738e]=_['isNil'](_0x487d95[_0xc207('0x17')])?_0x487d95[_0xc207('0x19')]:_0x487d95[_0xc207('0x18')];if(_[_0xc207('0xf')](_0x487d95[_0xc207('0x17')])){_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2b')]&&_0x487d95[_0xc207('0x2b')]!==_0xc207('0x2c')?_0x487d95['calleridname']:'Unknown';}else{_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2e')]&&_0x487d95[_0xc207('0x2e')]!==_0xc207('0x2c')?_0x487d95['destcalleridname']:_0xc207('0x2d');}_0x574425=_0x27df03;_0x5b556f[_0xc207('0x30')](_0x27df03);return;}}})[_0xc207('0x22')](function(){if(_0x13ec41){emit(_0x487d95[_0xc207('0x26')],_0x201162,util[_0xc207('0x32')]('user:%s',_0x13ec41[_0xc207('0x33')]),util[_0xc207('0x32')]('trigger:%s',_0x347549[_0xc207('0x34')]['toLowerCase']()),{'evt':_[_0xc207('0x35')](_0x487d95,{'autoCreate':_0x2782ce}),'contact':_0x574425===undefined?{}:_0x574425,'contacts':_0x5b556f[_0xc207('0x36')]===0x0?undefined:_0x5b556f});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 589388b..79b94b3 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 _0x547f=['operator','ChatWebsiteId','upperFirst','value','AccountId','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','prototype','clone','motionChannel','undefined','voice','interface','checkTriggers','hasOwnProperty','checkTrigger','variables','Actions','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','winApplication','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','contactmanager','integration','exec','queue','routeId','urlforward','script','buildUri','parse','query','search','replace','length','every','AllConditions','checkConditions','channel','field','account'];(function(_0x298ecc,_0x37ec6a){var _0x43d670=function(_0xfe7875){while(--_0xfe7875){_0x298ecc['push'](_0x298ecc['shift']());}};_0x43d670(++_0x37ec6a);}(_0x547f,0x17e));var _0xf547=function(_0x45bd06,_0x521086){_0x45bd06=_0x45bd06-0x0;var _0x357586=_0x547f[_0x45bd06];return _0x357586;};'use strict';var util=require('util');var _=require(_0xf547('0x0'));var url=require(_0xf547('0x1'));var Mustache=require(_0xf547('0x2'));var Redis=require('ioredis');var urlforward=require(_0xf547('0x3'));var integration=require(_0xf547('0x4'));var cmContact=require(_0xf547('0x5'));var script=require(_0xf547('0x6'));var config=require(_0xf547('0x7'));var logger=require(_0xf547('0x8'))('trigger');var ami=require(_0xf547('0x9'));config[_0xf547('0xa')]=_[_0xf547('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf547('0xc'))(new Redis(config[_0xf547('0xa')]));var operators={'equals':function(_0x5d5ca6,_0x3cb667){return _0x5d5ca6==_0x3cb667;},'not_equals':function(_0x45d66c,_0x1fd6c6){return _0x45d66c!=_0x1fd6c6;}};var barAndWebActions=[_0xf547('0xd'),_0xf547('0x1'),_0xf547('0xe')];function Trigger(_0x2814be){this[_0xf547('0xf')]=_0x2814be[_0xf547('0xf')];this[_0xf547('0x10')]=_0x2814be[_0xf547('0x10')];this[_0xf547('0x11')]=_0x2814be[_0xf547('0x11')];this[_0xf547('0x12')]=_0x2814be['templates'];this[_0xf547('0x13')]=_0x2814be['voiceExtensions'];this[_0xf547('0x14')]=_0x2814be[_0xf547('0x14')];this[_0xf547('0x15')]=_0x2814be[_0xf547('0x15')];this[_0xf547('0x16')]=_0x2814be[_0xf547('0x16')];this[_0xf547('0x17')]=_0x2814be['sugarcrmAccounts'];this['zohoAccounts']=_0x2814be[_0xf547('0x18')];this[_0xf547('0x19')]=_0x2814be[_0xf547('0x19')];this[_0xf547('0x1a')]=_0x2814be['vtigerAccounts'];this['servicenowAccounts']=_0x2814be[_0xf547('0x1b')];this[_0xf547('0x1c')]=_0x2814be[_0xf547('0x1c')];this[_0xf547('0x1d')]=_0x2814be[_0xf547('0x1d')];this[_0xf547('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xf547('0x15')],'sugarcrm':this[_0xf547('0x17')],'zoho':this[_0xf547('0x18')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xf547('0x1c')],'freshsales':this[_0xf547('0x1d')],'servicenow':this[_0xf547('0x1b')]};ami['on'](_0xf547('0x1f'),this['syncCustomEvent'][_0xf547('0x20')](this));ami['on'](_0xf547('0x21'),this[_0xf547('0x22')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on'](_0xf547('0x23'),this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on'](_0xf547('0x24'),this[_0xf547('0x22')]['bind'](this));ami['on'](_0xf547('0x25'),this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on']('custom:agentbusy',this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on']('custom:agentcongestion',this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on'](_0xf547('0x26'),this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on'](_0xf547('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0xf547('0x28'),this[_0xf547('0x22')]['bind'](this));ami['on'](_0xf547('0x29'),this[_0xf547('0x22')]['bind'](this));ami['on'](_0xf547('0x2a'),this[_0xf547('0x2b')][_0xf547('0x20')](this));ami['on']('custom:dialconnect',this[_0xf547('0x2b')][_0xf547('0x20')](this));ami['on']('custom:dialend',this['syncAgentDial'][_0xf547('0x20')](this));ami['on'](_0xf547('0x2c'),this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on'](_0xf547('0x2d'),this[_0xf547('0x22')]['bind'](this));ami['on'](_0xf547('0x2e'),this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on']('custom:incomingmessage',this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on'](_0xf547('0x2f'),this['syncCustomEvent'][_0xf547('0x20')](this));ami['on'](_0xf547('0x30'),this[_0xf547('0x22')][_0xf547('0x20')](this));ami['on'](_0xf547('0x31'),this[_0xf547('0x22')][_0xf547('0x20')](this));}Trigger['prototype'][_0xf547('0x32')]=function(_0x196341,_0x42695a,_0x40bc5c){logger[_0xf547('0x33')](_0x196341,_0x42695a,JSON['stringify'](_0x40bc5c));io['to'](_0x196341)[_0xf547('0x32')](_0x42695a,_0x40bc5c);};Trigger[_0xf547('0x34')][_0xf547('0x22')]=function(_0x4e2287){var _0xde63bf=_[_0xf547('0x35')](_0x4e2287);if(typeof _0xde63bf[_0xf547('0x36')]===_0xf547('0x37')){_0xde63bf['motionChannel']=_0xf547('0x38');}this['checkTriggers'](_0xde63bf);};Trigger[_0xf547('0x34')][_0xf547('0x2b')]=function(_0x195c02){if(this[_0xf547('0x10')][_0x195c02[_0xf547('0x39')]]){this['syncCustomEvent'](_0x195c02);}};Trigger['prototype'][_0xf547('0x3a')]=function(_0x42a239){var _0x2fcc26;for(var _0x548e86 in this[_0xf547('0xf')]){if(this['triggers'][_0xf547('0x3b')](_0x548e86)){if(this['triggers'][_0x548e86]['status']){_0x2fcc26=this[_0xf547('0x3c')](this['triggers'][_0x548e86],_0x42a239);if(_0x2fcc26){_['merge'](_0x42a239,_0x42a239[_0xf547('0x3d')]);for(var _0x116b57=0x0,_0x4f373c,_0x270feb,_0x258464;_0x116b570x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x17ff81,_0x1e567b){var _0x5f39ff=function(_0x20f1c9){while(--_0x20f1c9){_0x17ff81['push'](_0x17ff81['shift']());}};_0x5f39ff(++_0x1e567b);}(_0x55ca,0x126));var _0xa55c=function(_0x7a68b,_0x964789){_0x7a68b=_0x7a68b-0x0;var _0x110d37=_0x55ca[_0x7a68b];return _0x110d37;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index ef17331..30bc739 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 _0x61c6=['toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','replace','%2b','Bearer\x20','value','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','type','customField','idField','indexOf','content','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','lastIndexOf','ticketId','format','user:%s','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','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error','inspect','lodash','bluebird','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','then','access_token','catch',']\x20Wrong\x20credentials!','GET','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message'];(function(_0x545e86,_0x46a2ed){var _0xa98055=function(_0x41aa23){while(--_0x41aa23){_0x545e86['push'](_0x545e86['shift']());}};_0xa98055(++_0x46a2ed);}(_0x61c6,0x9b));var _0x661c=function(_0x34dbaa,_0xc4c565){_0x34dbaa=_0x34dbaa-0x0;var _0x2ea643=_0x61c6[_0x34dbaa];return _0x2ea643;};'use strict';var _=require(_0x661c('0x0'));var BPromise=require(_0x661c('0x1'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x661c('0x2'));var md5=require(_0x661c('0x3'));var Redis=require(_0x661c('0x4'));var logger=require(_0x661c('0x5'))(_0x661c('0x6'));var config=require(_0x661c('0x7'));config[_0x661c('0x8')]=_['defaults'](config[_0x661c('0x8')],{'host':_0x661c('0x9'),'port':0x18eb});var io=require(_0x661c('0xa'))(new Redis(config['redis']));function getAuthToken(_0x3ab338,_0x29031d,_0x2cdc3a){var _0x4f7f75={'method':_0x661c('0xb'),'uri':_0x29031d,'form':{'client_id':_0x3ab338[_0x661c('0xc')],'resource':_0x3ab338[_0x661c('0xd')],'username':_0x3ab338[_0x661c('0xe')],'password':_0x3ab338['password'],'grant_type':_0x661c('0xf'),'client_secret':_0x3ab338['clientSecret']},'json':!![]};return rp(_0x4f7f75)[_0x661c('0x10')](function(_0xa30997){return _0xa30997[_0x661c('0x11')];})[_0x661c('0x12')](function(_0x5f50eb){logger['error']('['+[_0x2cdc3a['toUpperCase']()]+_0x661c('0x13'));return _0x5f50eb['message'];});}function getUser(_0x2abf31,_0x4d0582,_0x2f1aa8,_0x546ad6,_0x7641eb,_0xd92464){return new BPromise(function(_0x3977f2,_0x1175fc){return getAuthToken(_0x4d0582,_0x546ad6,_0xd92464)[_0x661c('0x10')](function(_0x280413){var _0x376a77={'method':_0x661c('0x14'),'uri':_0x7641eb+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x280413,'OData-Version':_0x661c('0x15')},'json':!![]};return rp(_0x376a77);})[_0x661c('0x10')](function(_0x1278bd){var _0x30434a=_0x1278bd['value'];var _0x8f7a2e=![];var _0x2ac455=null;if(!_[_0x661c('0x16')](_0x2f1aa8)){if(intUtil[_0x661c('0x17')](_0x2f1aa8[_0x661c('0x18')])){_0x2abf31[_0x661c('0x19')]=_0x2f1aa8['email'];for(_0x2ac455=0x0;_0x2ac455<_0x30434a[_0x661c('0x1a')];_0x2ac455++){if(_0x30434a[_0x2ac455][_0x661c('0x1b')]===_0x2f1aa8[_0x661c('0x18')]&&!_0x30434a[_0x2ac455]['isdisabled']){_0x8f7a2e=!![];logger[_0x661c('0x1c')]('['+[_0xd92464[_0x661c('0x1d')]()]+_0x661c('0x1e')+_0x30434a[_0x2ac455][_0x661c('0x1f')]+'!');_0x2abf31[_0x661c('0x20')]=_0x30434a[_0x2ac455]['systemuserid'];}}}}if(!_0x8f7a2e){logger[_0x661c('0x1c')]('['+[_0xd92464[_0x661c('0x1d')]()]+_0x661c('0x21'));_0x2abf31['userEmail']=_0x4d0582[_0x661c('0xe')];for(_0x2ac455=0x0;_0x2ac455<_0x30434a[_0x661c('0x1a')];_0x2ac455++){if(_0x30434a[_0x2ac455][_0x661c('0x1b')]===_0x4d0582[_0x661c('0xe')]){_0x2abf31['userId']=_0x30434a[_0x2ac455]['systemuserid'];}}}_0x3977f2(_0x2abf31);})[_0x661c('0x12')](function(_0x3dd49c){_0x1175fc(_0x3dd49c[_0x661c('0x22')]);});});}function createEndUser(_0x13ce28,_0x2fc875,_0x3fdf6e,_0x18bfe2,_0x38e244,_0x5810d0){return new BPromise(function(_0x1d438a,_0x175319){return getAuthToken(_0x2fc875,_0x3fdf6e,_0x5810d0)[_0x661c('0x10')](function(_0x399617){var _0xf359b7=_0x5810d0[_0x661c('0x23')]()===_0x661c('0x24')?_0x38e244[_0x661c('0x25')]:_0x38e244[_0x661c('0x26')];var _0xc5a31b={'method':_0x661c('0xb'),'uri':_0x18bfe2+_0x661c('0x27'),'body':{'telephone1':_0xf359b7,'fullname':_0xf359b7,'firstname':_0xf359b7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x661c('0x28')+_0x13ce28['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x399617,'OData-Version':_0x661c('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xc5a31b);})[_0x661c('0x10')](function(_0x47bff2){var _0x3cc5a9=_0x47bff2[_0x661c('0x29')][_0x661c('0x2a')];var _0x51aa75=_0x3cc5a9[_0x661c('0x2b')](_0x3cc5a9['lastIndexOf']('(')+0x1,_0x3cc5a9['lastIndexOf'](')'));_0x13ce28['enduserId']=_0x51aa75;_0x1d438a(_0x13ce28);})[_0x661c('0x12')](function(_0x41115a){_0x175319(_0x41115a['message']);});});}function getEndUser(_0x51aea4,_0x1f9a10,_0x2aa248,_0x3ac0be,_0xaa5006,_0x181e88){return new BPromise(function(_0x11e769,_0x31d48b){var _0x44591c=_0x181e88[_0x661c('0x23')]()===_0x661c('0x24')?_0xaa5006[_0x661c('0x25')]:_0xaa5006['calleridnum'];return getAuthToken(_0x1f9a10,_0x2aa248,_0x181e88)[_0x661c('0x10')](function(_0x119de7){var _0x4d398={'method':_0x661c('0x14'),'uri':_0x3ac0be+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x44591c[_0x661c('0x2c')]('+',_0x661c('0x2d'))+'\x27','headers':{'Authorization':_0x661c('0x2e')+_0x119de7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4d398);})[_0x661c('0x10')](function(_0xe0ea26){var _0x4c325b=null;if(_0xe0ea26){var _0x4fab8c=_0xe0ea26[_0x661c('0x2f')];var _0x946165=![];for(_0x4c325b=0x0;_0x4c325b<_0x4fab8c[_0x661c('0x1a')];_0x4c325b++){if(_0x4fab8c[_0x4c325b][_0x661c('0x30')]===_0x44591c){_0x946165=!![];_0x51aea4[_0x661c('0x31')]=_0x4fab8c[_0x4c325b][_0x661c('0x32')];}}if(_0x946165){_0x11e769(_0x51aea4);}else{return createEndUser(_0x51aea4,_0x1f9a10,_0x2aa248,_0x3ac0be,_0xaa5006,_0x181e88)[_0x661c('0x10')](function(_0x13d085){logger[_0x661c('0x1c')]('['+[_0x181e88['toUpperCase']()]+_0x661c('0x33'),_0x13d085['enduserId']);_0x11e769(_0x13d085);});}}else{return createEndUser(_0x51aea4,_0x1f9a10,_0x2aa248,_0x3ac0be,_0xaa5006,_0x181e88)['then'](function(_0x527dbd){logger['info']('['+[_0x181e88[_0x661c('0x1d')]()]+_0x661c('0x34'),_0x527dbd['enduserId']);_0x11e769(_0x527dbd);});}});});}function getCustomFields(_0x5863de,_0x3acd9b,_0x50c5c6){var _0xa91b2e={};if(_0x5863de[_0x661c('0x1a')]>0x0){_[_0x661c('0x35')](_0x5863de,function(_0x293d59){if(_[_0x661c('0x36')]([_0x661c('0x37'),'picklist'],_0x293d59[_0x661c('0x38')])&&_0x293d59['nameField']&&!_0x293d59[_0x661c('0x39')]){var _0x2ba20a=_0x293d59[_0x661c('0x3a')][_0x661c('0x23')]();var _0x3bbf6e=_0x2ba20a[_0x661c('0x2b')](0x0,_0x2ba20a[_0x661c('0x3b')]('_'));var _0x66cc6f=_0x2ba20a[_0x661c('0x2b')](_0x2ba20a['indexOf']('_')+0x1);if(_0x3bbf6e===_0x50c5c6){_0xa91b2e[_0x66cc6f]=_0x293d59[_0x661c('0x3c')];}}});}return _0xa91b2e;}function getTicket(_0x14916d,_0x64e278,_0x2dc7e8,_0x42f2c7,_0x12e227,_0x345144,_0xe59cb0){return new BPromise(function(_0x1bb97b,_0x5c5df8){var _0x47985a;return getAuthToken(_0x64e278,_0x2dc7e8,_0xe59cb0)[_0x661c('0x10')](function(_0x37a68e){if(_0x345144['ticketType']==='incident'){_0x47985a={'method':_0x661c('0xb'),'uri':_0x42f2c7+_0x661c('0x3d'),'body':Object[_0x661c('0x3e')]({},{'title':intUtil[_0x661c('0x3f')](_0x345144[_0x661c('0x40')],_0x12e227,'\x20'),'description':intUtil['getString'](_0x345144[_0x661c('0x41')],_0x12e227,'\x0a'),'customerid_contact@odata.bind':_0x661c('0x42')+_0x14916d[_0x661c('0x31')]+')','ownerid@odata.bind':'/systemusers('+_0x14916d[_0x661c('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x345144[_0x661c('0x43')],_0x12e227,_0x345144[_0x661c('0x44')])),'headers':{'Authorization':_0x661c('0x2e')+_0x37a68e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x345144[_0x661c('0x44')]===_0x661c('0x45')){_0x47985a={'method':'POST','uri':_0x42f2c7+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x661c('0x3f')](_0x345144[_0x661c('0x40')],_0x12e227,'\x20'),'phonenumber':String(_0x12e227[_0x661c('0x26')]),'description':intUtil['getString'](_0x345144[_0x661c('0x41')],_0x12e227,'\x0a'),'regardingobjectid_contact@odata.bind':_0x661c('0x42')+_0x14916d[_0x661c('0x31')]+')','ownerid@odata.bind':_0x661c('0x28')+_0x14916d[_0x661c('0x20')]+')','directioncode':_0x14916d[_0x661c('0x46')]===_0x661c('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x14916d['userId']+')','participationtypemask':_0x14916d[_0x661c('0x46')]===_0x661c('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x661c('0x42')+_0x14916d[_0x661c('0x31')]+')','participationtypemask':_0x14916d['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x345144[_0x661c('0x43')],_0x12e227,_0x345144['ticketType'])),'headers':{'Authorization':_0x661c('0x2e')+_0x37a68e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x47985a);})[_0x661c('0x10')](function(_0x37171e){var _0x441528=_0x37171e[_0x661c('0x29')][_0x661c('0x2a')];var _0x31b4f3=_0x441528['substring'](_0x441528[_0x661c('0x48')]('(')+0x1,_0x441528[_0x661c('0x48')](')'));_0x14916d[_0x661c('0x49')]=_0x31b4f3;_0x1bb97b(_0x14916d);})['catch'](function(_0x1a295d){_0x5c5df8(_0x1a295d[_0x661c('0x22')]);});});}function emit(_0x292832,_0x2c39cf,_0x475605,_0x49829c){var _0x402986={'uri':util[_0x661c('0x4a')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x292832,_0x475605,_0x49829c)};io['to'](util[_0x661c('0x4a')](_0x661c('0x4b'),_0x2c39cf))['emit']('trigger:browser:url',_0x402986);}exports['cs']=function(_0x567495,_0x55a95e,_0x5aad81,_0x44914f,_0x44f447,_0x261933,_0x155cfa,_0x2db258){var _0x46c73c={};_0x261933[_0x661c('0xd')]=intUtil[_0x661c('0x4c')](_0x261933[_0x661c('0xd')]);_0x261933['serverUrl']=intUtil[_0x661c('0x4c')](_0x261933[_0x661c('0x4d')]);_0x46c73c[_0x661c('0x46')]=_0x2db258===_0x661c('0x47')||_0x2db258===_0x661c('0x4e')?'queue':_0x661c('0x24');var _0x5d3ccd=util[_0x661c('0x4a')](_0x661c('0x4f'),_0x261933[_0x661c('0xd')]);var _0x3e95a0=util['format'](_0x661c('0x50'),_0x261933['tenantId']);var _0x210694=util[_0x661c('0x4a')](_0x661c('0x51'),_0x261933['serverUrl'],_0x55a95e[_0x661c('0x52')],md5(_0x55a95e['uniqueid']));if(_0x44f447&&_0x44f447[_0x661c('0x53')]){logger[_0x661c('0x1c')](_0x661c('0x54'),_0x661c('0x55'));_0x55a95e['recordingURL']=_0x210694;}else if(_0x155cfa&&_0x155cfa[_0x661c('0x56')]&&_0x155cfa[_0x661c('0x56')]!=='none'){logger[_0x661c('0x1c')](_0x661c('0x57'),_0x661c('0x55'));_0x55a95e[_0x661c('0x58')]=_0x210694;}else{_0x55a95e[_0x661c('0x58')]='';}return getUser(_0x46c73c,_0x261933,_0x44914f,_0x3e95a0,_0x5d3ccd,_0x2db258)[_0x661c('0x10')](function(_0x24b06f){logger['info']('['+_0x2db258[_0x661c('0x1d')]()+']\x20The\x20User\x20ID\x20is:',_0x24b06f[_0x661c('0x20')]);logger['info']('['+_0x2db258['toUpperCase']()+_0x661c('0x59'),_0x24b06f[_0x661c('0x19')]);return getEndUser(_0x24b06f,_0x261933,_0x3e95a0,_0x5d3ccd,_0x55a95e,_0x2db258);})[_0x661c('0x10')](function(_0x184a24){logger[_0x661c('0x1c')]('['+_0x2db258[_0x661c('0x1d')]()+_0x661c('0x5a'),_0x184a24[_0x661c('0x31')]);logger['info']('['+_0x2db258[_0x661c('0x1d')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x55a95e['calleridnum']);return getTicket(_0x184a24,_0x261933,_0x3e95a0,_0x5d3ccd,_0x55a95e,_0x5aad81,_0x2db258);})['then'](function(_0x4b96ff){logger[_0x661c('0x1c')](util[_0x661c('0x4a')]('['+_0x2db258['toUpperCase']()+_0x661c('0x5b'),_0x5aad81[_0x661c('0x44')],_0x4b96ff[_0x661c('0x49')]));logger[_0x661c('0x1c')](util['format']('['+_0x2db258[_0x661c('0x1d')]()+']\x20Call\x20direction:\x20%s',_0x2db258));if(_0x2db258!==_0x661c('0x4e')){logger[_0x661c('0x1c')]('['+_0x2db258[_0x661c('0x1d')]()+']',_0x661c('0x5c'));emit(_0x261933[_0x661c('0xd')],_0x44914f['name'],_0x5aad81[_0x661c('0x44')],_0x4b96ff['ticketId']);}})[_0x661c('0x12')](function(_0x5dbefb){logger[_0x661c('0x5d')]('['+_0x2db258[_0x661c('0x1d')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x661c('0x5e')](_0x5dbefb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2ce0=['toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','Bearer\x20','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','telephone1','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','indexOf','content','incidents','assign','getString','Subjects','Descriptions','userId','Fields','ticketType','phonecall','/contacts(','callDirection','queue','odata-entityid','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\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...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','POST','remoteUri','username','password','then','access_token','catch','error'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x2ce0,0x10d));var _0x02ce=function(_0x25bfe2,_0xe73273){_0x25bfe2=_0x25bfe2-0x0;var _0x45ef49=_0x2ce0[_0x25bfe2];return _0x45ef49;};'use strict';var _=require(_0x02ce('0x0'));var BPromise=require(_0x02ce('0x1'));var rp=require(_0x02ce('0x2'));var util=require(_0x02ce('0x3'));var intUtil=require('./util');var md5=require(_0x02ce('0x4'));var Redis=require(_0x02ce('0x5'));var logger=require(_0x02ce('0x6'))('dynamics365');var config=require('../../../../config/environment');config['redis']=_[_0x02ce('0x7')](config[_0x02ce('0x8')],{'host':_0x02ce('0x9'),'port':0x18eb});var io=require(_0x02ce('0xa'))(new Redis(config[_0x02ce('0x8')]));function getAuthToken(_0x3e7f76,_0x28944e,_0x3f0b86){var _0x2e6e35={'method':_0x02ce('0xb'),'uri':_0x28944e,'form':{'client_id':_0x3e7f76['clientId'],'resource':_0x3e7f76[_0x02ce('0xc')],'username':_0x3e7f76[_0x02ce('0xd')],'password':_0x3e7f76['password'],'grant_type':_0x02ce('0xe'),'client_secret':_0x3e7f76['clientSecret']},'json':!![]};return rp(_0x2e6e35)[_0x02ce('0xf')](function(_0x393652){return _0x393652[_0x02ce('0x10')];})[_0x02ce('0x11')](function(_0x585ae1){logger[_0x02ce('0x12')]('['+[_0x3f0b86[_0x02ce('0x13')]()]+_0x02ce('0x14'));return _0x585ae1[_0x02ce('0x15')];});}function getUser(_0x217f60,_0x1e10d7,_0x45c018,_0x362b1c,_0x11edb4,_0x26d083){return new BPromise(function(_0x2a4307,_0x1d4662){return getAuthToken(_0x1e10d7,_0x362b1c,_0x26d083)['then'](function(_0x5e6518){var _0xa12fe1={'method':_0x02ce('0x16'),'uri':_0x11edb4+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x5e6518,'OData-Version':_0x02ce('0x17')},'json':!![]};return rp(_0xa12fe1);})[_0x02ce('0xf')](function(_0x450e6f){var _0x4b6dfd=_0x450e6f[_0x02ce('0x18')];var _0x46e95f=![];var _0x23c776=null;if(!_[_0x02ce('0x19')](_0x45c018)){if(intUtil[_0x02ce('0x1a')](_0x45c018[_0x02ce('0x1b')])){_0x217f60[_0x02ce('0x1c')]=_0x45c018['email'];for(_0x23c776=0x0;_0x23c776<_0x4b6dfd[_0x02ce('0x1d')];_0x23c776++){if(_0x4b6dfd[_0x23c776][_0x02ce('0x1e')]===_0x45c018[_0x02ce('0x1b')]&&!_0x4b6dfd[_0x23c776][_0x02ce('0x1f')]){_0x46e95f=!![];logger[_0x02ce('0x20')]('['+[_0x26d083['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x4b6dfd[_0x23c776][_0x02ce('0x21')]+'!');_0x217f60['userId']=_0x4b6dfd[_0x23c776][_0x02ce('0x21')];}}}}if(!_0x46e95f){logger[_0x02ce('0x20')]('['+[_0x26d083[_0x02ce('0x13')]()]+_0x02ce('0x22'));_0x217f60[_0x02ce('0x1c')]=_0x1e10d7['username'];for(_0x23c776=0x0;_0x23c776<_0x4b6dfd[_0x02ce('0x1d')];_0x23c776++){if(_0x4b6dfd[_0x23c776]['internalemailaddress']===_0x1e10d7['username']){_0x217f60['userId']=_0x4b6dfd[_0x23c776][_0x02ce('0x21')];}}}_0x2a4307(_0x217f60);})[_0x02ce('0x11')](function(_0x1e7e90){_0x1d4662(_0x1e7e90[_0x02ce('0x15')]);});});}function createEndUser(_0x441a83,_0x297f0a,_0x390a6b,_0x22a6f4,_0x286546,_0x4c04e0){return new BPromise(function(_0x43c59a,_0x216905){return getAuthToken(_0x297f0a,_0x390a6b,_0x4c04e0)[_0x02ce('0xf')](function(_0x39a3a4){var _0x588702=_0x4c04e0[_0x02ce('0x23')]()===_0x02ce('0x24')?_0x286546[_0x02ce('0x25')]:_0x286546[_0x02ce('0x26')];var _0x5cbd2c={'method':_0x02ce('0xb'),'uri':_0x22a6f4+'contacts','body':{'telephone1':_0x588702,'fullname':_0x588702,'firstname':_0x588702,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x02ce('0x27')+_0x441a83['userId']+')'},'headers':{'Authorization':_0x02ce('0x28')+_0x39a3a4,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5cbd2c);})['then'](function(_0x4a674f){var _0x5f5a91=_0x4a674f[_0x02ce('0x29')]['odata-entityid'];var _0x584966=_0x5f5a91[_0x02ce('0x2a')](_0x5f5a91[_0x02ce('0x2b')]('(')+0x1,_0x5f5a91[_0x02ce('0x2b')](')'));_0x441a83[_0x02ce('0x2c')]=_0x584966;_0x43c59a(_0x441a83);})[_0x02ce('0x11')](function(_0x368368){_0x216905(_0x368368[_0x02ce('0x15')]);});});}function getEndUser(_0x5f0192,_0x161e0c,_0x391673,_0x495893,_0x3721b5,_0x59146f){return new BPromise(function(_0x5a8a60,_0x1a8fb1){var _0x2acb99=_0x59146f['toLowerCase']()==='outbound'?_0x3721b5[_0x02ce('0x25')]:_0x3721b5['calleridnum'];return getAuthToken(_0x161e0c,_0x391673,_0x59146f)['then'](function(_0x1fc04f){var _0x1cb44f={'method':_0x02ce('0x16'),'uri':_0x495893+_0x02ce('0x2d')+_0x2acb99['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x02ce('0x28')+_0x1fc04f,'If-None-Match':null,'OData-Version':_0x02ce('0x17')},'json':!![]};return rp(_0x1cb44f);})[_0x02ce('0xf')](function(_0x3d002f){var _0x4d2d9c=null;if(_0x3d002f){var _0x4b43c3=_0x3d002f['value'];var _0x31e74d=![];for(_0x4d2d9c=0x0;_0x4d2d9c<_0x4b43c3['length'];_0x4d2d9c++){if(_0x4b43c3[_0x4d2d9c][_0x02ce('0x2e')]===_0x2acb99){_0x31e74d=!![];_0x5f0192[_0x02ce('0x2c')]=_0x4b43c3[_0x4d2d9c][_0x02ce('0x2f')];}}if(_0x31e74d){_0x5a8a60(_0x5f0192);}else{return createEndUser(_0x5f0192,_0x161e0c,_0x391673,_0x495893,_0x3721b5,_0x59146f)['then'](function(_0x51a663){logger['info']('['+[_0x59146f[_0x02ce('0x13')]()]+_0x02ce('0x30'),_0x51a663[_0x02ce('0x2c')]);_0x5a8a60(_0x51a663);});}}else{return createEndUser(_0x5f0192,_0x161e0c,_0x391673,_0x495893,_0x3721b5,_0x59146f)['then'](function(_0x1ee83f){logger[_0x02ce('0x20')]('['+[_0x59146f[_0x02ce('0x13')]()]+']\x20Enduser\x20Created!',_0x1ee83f[_0x02ce('0x2c')]);_0x5a8a60(_0x1ee83f);});}});});}function getCustomFields(_0xbf8ce7,_0x364341,_0x2cedb6){var _0x95dd0e={};if(_0xbf8ce7[_0x02ce('0x1d')]>0x0){_[_0x02ce('0x31')](_0xbf8ce7,function(_0x3a2678){if(_[_0x02ce('0x32')]([_0x02ce('0x33'),_0x02ce('0x34')],_0x3a2678['type'])&&_0x3a2678[_0x02ce('0x35')]&&!_0x3a2678[_0x02ce('0x36')]){var _0x322491=_0x3a2678['idField'][_0x02ce('0x23')]();var _0x3b83a8=_0x322491[_0x02ce('0x2a')](0x0,_0x322491[_0x02ce('0x37')]('_'));var _0x227152=_0x322491[_0x02ce('0x2a')](_0x322491['indexOf']('_')+0x1);if(_0x3b83a8===_0x2cedb6){_0x95dd0e[_0x227152]=_0x3a2678[_0x02ce('0x38')];}}});}return _0x95dd0e;}function getTicket(_0x338594,_0x5dec41,_0x16376e,_0x299351,_0x56f9d3,_0xe19b9b,_0x132f93){return new BPromise(function(_0x26e3c2,_0x43ab00){var _0x5d7372;return getAuthToken(_0x5dec41,_0x16376e,_0x132f93)[_0x02ce('0xf')](function(_0x119551){if(_0xe19b9b['ticketType']==='incident'){_0x5d7372={'method':_0x02ce('0xb'),'uri':_0x299351+_0x02ce('0x39'),'body':Object[_0x02ce('0x3a')]({},{'title':intUtil[_0x02ce('0x3b')](_0xe19b9b[_0x02ce('0x3c')],_0x56f9d3,'\x20'),'description':intUtil[_0x02ce('0x3b')](_0xe19b9b[_0x02ce('0x3d')],_0x56f9d3,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x338594[_0x02ce('0x2c')]+')','ownerid@odata.bind':_0x02ce('0x27')+_0x338594[_0x02ce('0x3e')]+')','caseorigincode':'1'},getCustomFields(_0xe19b9b[_0x02ce('0x3f')],_0x56f9d3,_0xe19b9b[_0x02ce('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x119551,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xe19b9b[_0x02ce('0x40')]===_0x02ce('0x41')){_0x5d7372={'method':_0x02ce('0xb'),'uri':_0x299351+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x02ce('0x3b')](_0xe19b9b[_0x02ce('0x3c')],_0x56f9d3,'\x20'),'phonenumber':String(_0x56f9d3[_0x02ce('0x26')]),'description':intUtil[_0x02ce('0x3b')](_0xe19b9b[_0x02ce('0x3d')],_0x56f9d3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x02ce('0x42')+_0x338594['enduserId']+')','ownerid@odata.bind':_0x02ce('0x27')+_0x338594[_0x02ce('0x3e')]+')','directioncode':_0x338594[_0x02ce('0x43')]===_0x02ce('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x02ce('0x27')+_0x338594[_0x02ce('0x3e')]+')','participationtypemask':_0x338594[_0x02ce('0x43')]===_0x02ce('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x02ce('0x42')+_0x338594[_0x02ce('0x2c')]+')','participationtypemask':_0x338594[_0x02ce('0x43')]===_0x02ce('0x44')?0x1:0x2}]},getCustomFields(_0xe19b9b['Fields'],_0x56f9d3,_0xe19b9b[_0x02ce('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x119551,'OData-Version':_0x02ce('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5d7372);})[_0x02ce('0xf')](function(_0x1ce85d){var _0x39670f=_0x1ce85d['headers'][_0x02ce('0x45')];var _0x337e68=_0x39670f[_0x02ce('0x2a')](_0x39670f[_0x02ce('0x2b')]('(')+0x1,_0x39670f[_0x02ce('0x2b')](')'));_0x338594['ticketId']=_0x337e68;_0x26e3c2(_0x338594);})[_0x02ce('0x11')](function(_0x53a34a){_0x43ab00(_0x53a34a[_0x02ce('0x15')]);});});}function emit(_0x3f7efb,_0x4c1d71,_0x12fd85,_0x19487d){var _0xd6433e={'uri':util[_0x02ce('0x46')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3f7efb,_0x12fd85,_0x19487d)};io['to'](util[_0x02ce('0x46')](_0x02ce('0x47'),_0x4c1d71))[_0x02ce('0x48')]('trigger:browser:url',_0xd6433e);}exports['cs']=function(_0x3d2af4,_0x196c05,_0xaa85df,_0xc7cfeb,_0x3da8dd,_0xbdca4f,_0x1f0424,_0x25725e){var _0x3fa44b={};_0xbdca4f[_0x02ce('0xc')]=intUtil[_0x02ce('0x49')](_0xbdca4f['remoteUri']);_0xbdca4f[_0x02ce('0x4a')]=intUtil[_0x02ce('0x49')](_0xbdca4f[_0x02ce('0x4a')]);_0x3fa44b[_0x02ce('0x43')]=_0x25725e===_0x02ce('0x44')||_0x25725e===_0x02ce('0x4b')?_0x02ce('0x44'):_0x02ce('0x24');var _0x72db85=util[_0x02ce('0x46')](_0x02ce('0x4c'),_0xbdca4f[_0x02ce('0xc')]);var _0x1ff3ae=util[_0x02ce('0x46')](_0x02ce('0x4d'),_0xbdca4f[_0x02ce('0x4e')]);var _0x35426a=util[_0x02ce('0x46')](_0x02ce('0x4f'),_0xbdca4f[_0x02ce('0x4a')],_0x196c05[_0x02ce('0x50')],md5(_0x196c05[_0x02ce('0x50')]));if(_0x3da8dd&&_0x3da8dd[_0x02ce('0x51')]){logger[_0x02ce('0x20')](_0x02ce('0x52'),'Recording\x20is\x20enabled!');_0x196c05[_0x02ce('0x53')]=_0x35426a;}else if(_0x1f0424&&_0x1f0424[_0x02ce('0x54')]&&_0x1f0424['recordingFormat']!==_0x02ce('0x55')){logger[_0x02ce('0x20')](_0x02ce('0x56'),_0x02ce('0x57'));_0x196c05[_0x02ce('0x53')]=_0x35426a;}else{_0x196c05['recordingURL']='';}return getUser(_0x3fa44b,_0xbdca4f,_0xc7cfeb,_0x1ff3ae,_0x72db85,_0x25725e)[_0x02ce('0xf')](function(_0x4ba825){logger['info']('['+_0x25725e[_0x02ce('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x4ba825[_0x02ce('0x3e')]);logger['info']('['+_0x25725e[_0x02ce('0x13')]()+_0x02ce('0x58'),_0x4ba825['userEmail']);return getEndUser(_0x4ba825,_0xbdca4f,_0x1ff3ae,_0x72db85,_0x196c05,_0x25725e);})[_0x02ce('0xf')](function(_0x246437){logger[_0x02ce('0x20')]('['+_0x25725e[_0x02ce('0x13')]()+_0x02ce('0x59'),_0x246437[_0x02ce('0x2c')]);logger[_0x02ce('0x20')]('['+_0x25725e[_0x02ce('0x13')]()+_0x02ce('0x5a'),_0x196c05['calleridnum']);return getTicket(_0x246437,_0xbdca4f,_0x1ff3ae,_0x72db85,_0x196c05,_0xaa85df,_0x25725e);})[_0x02ce('0xf')](function(_0x565b1f){logger[_0x02ce('0x20')](util['format']('['+_0x25725e['toUpperCase']()+_0x02ce('0x5b'),_0xaa85df['ticketType'],_0x565b1f[_0x02ce('0x5c')]));logger['info'](util[_0x02ce('0x46')]('['+_0x25725e[_0x02ce('0x13')]()+_0x02ce('0x5d'),_0x25725e));if(_0x25725e!=='unmanaged'){logger[_0x02ce('0x20')]('['+_0x25725e[_0x02ce('0x13')]()+']',_0x02ce('0x5e'));emit(_0xbdca4f['remoteUri'],_0xc7cfeb['name'],_0xaa85df['ticketType'],_0x565b1f[_0x02ce('0x5c')]);}})['catch'](function(_0x428547){logger['error']('['+_0x25725e[_0x02ce('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x02ce('0x5f')](_0x428547,{'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 5767778..900dfc6 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 _0x8857=['Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','nameField','toLowerCase','includes','type','idField','customField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','recordingURL','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!'];(function(_0x559b21,_0x1d2330){var _0x537de5=function(_0x1b3988){while(--_0x1b3988){_0x559b21['push'](_0x559b21['shift']());}};_0x537de5(++_0x1d2330);}(_0x8857,0x161));var _0x7885=function(_0x327e8c,_0x491fb2){_0x327e8c=_0x327e8c-0x0;var _0xf071ba=_0x8857[_0x327e8c];return _0xf071ba;};'use strict';var _=require(_0x7885('0x0'));var rp=require(_0x7885('0x1'));var md5=require('md5');var util=require(_0x7885('0x2'));var Redis=require(_0x7885('0x3'));var intUtil=require(_0x7885('0x4'));var config=require(_0x7885('0x5'));var logger=require(_0x7885('0x6'))(_0x7885('0x7'));config[_0x7885('0x8')]=_[_0x7885('0x9')](config[_0x7885('0x8')],{'host':_0x7885('0xa'),'port':0x18eb});var io=require(_0x7885('0xb'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x7885('0xc')};function emit(_0x3be935,_0x5d89e6,_0x20ba35){io['to'](_0x3be935)[_0x7885('0xd')](_0x5d89e6,_0x20ba35);}function getTicket(_0x2d58d9,_0x3b61dd,_0x7aa3ee,_0x2238a1,_0x436a2e){logger[_0x7885('0xe')](_0x7885('0xf'));var _0x492408=_[_0x7885('0x10')]({'responder_id':_0x3b61dd['id'],'requester_id':_0x7aa3ee['id'],'name':util[_0x7885('0x11')](_0x7885('0x12'),_0x436a2e[_0x7885('0x13')]),'phone':_0x436a2e[_0x7885('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2238a1['Subjects'],_0x436a2e,'\x20'),'description':intUtil[_0x7885('0x15')](_0x2238a1[_0x7885('0x16')],_0x436a2e,_0x7885('0x17')),'tags':getTags(_0x2238a1['Tags'],_0x7885('0x18'))},getCustomFields(_0x2238a1[_0x7885('0x19')],_0x436a2e));_0x492408[_0x7885('0x1a')]=_[_0x7885('0x1b')](_['keyBy'](_0x492408[_0x7885('0x1a')],'id'),'value');return request({'uri':util[_0x7885('0x11')](_0x7885('0x1c'),_0x2d58d9[_0x7885('0x1d')]),'method':'POST','body':_0x492408})[_0x7885('0x1e')](function(_0x43a1b4){logger[_0x7885('0xe')](_0x7885('0x1f'));return _0x43a1b4;});}function getUser(_0x593ade,_0x4693b1){if(intUtil[_0x7885('0x20')](_0x4693b1)){return request({'uri':util['format'](_0x7885('0x21'),_0x593ade[_0x7885('0x1d')]),'qs':{'email':_0x4693b1}})[_0x7885('0x1e')](function(_0x5a5eb1){if(_0x5a5eb1[_0x7885('0x22')]){logger[_0x7885('0xe')](_0x7885('0x23'));return _[_0x7885('0x24')](_0x5a5eb1,function(_0x44cac4){return _0x44cac4[_0x7885('0x25')][_0x7885('0x26')]===_0x4693b1;});}else{logger[_0x7885('0xe')](_0x7885('0x27'));return request({'uri':util[_0x7885('0x11')](_0x7885('0x28'),_0x593ade['remoteUri'])})[_0x7885('0x1e')](function(_0x18683f){logger[_0x7885('0xe')](_0x7885('0x29'));return _0x18683f;});}});}else{logger['info'](_0x7885('0x2a'));return request({'uri':util['format'](_0x7885('0x28'),_0x593ade[_0x7885('0x1d')])})[_0x7885('0x1e')](function(_0x37a22b){logger[_0x7885('0xe')](_0x7885('0x29'));return _0x37a22b;});}}function getEndUser(_0x118510,_0x2a8831,_0x41458a){logger[_0x7885('0xe')](_0x7885('0x2b'),_0x41458a);return request({'uri':util[_0x7885('0x11')]('%s/api/v2/contacts',_0x118510[_0x7885('0x1d')]),'qs':{'phone':_0x41458a}})[_0x7885('0x1e')](function(_0x178cf5){if(_0x178cf5['length']){logger['info'](_0x7885('0x2c'));return _[_0x7885('0x24')](_0x178cf5,{'phone':_0x41458a});}else{logger[_0x7885('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7885('0x11')](_0x7885('0x2d'),_0x118510['remoteUri']),'method':'POST','body':{'name':_0x2a8831,'phone':_0x41458a}})['then'](function(_0x57490e){logger['info'](_0x7885('0x2e'));return _0x57490e;});}});}function getAuth(_0x11216c){return util['format'](_0x7885('0x2f'),new Buffer(_0x11216c[_0x7885('0x30')]+':X')[_0x7885('0x31')](_0x7885('0x32')));}function request(_0x564a16){logger[_0x7885('0x33')](_0x7885('0x34'),JSON[_0x7885('0x35')](_0x564a16));return rp(_[_0x7885('0x9')](_0x564a16,{'method':_0x7885('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4bda49,_0x3ed310){var _0x28497f=[];if(_0x4bda49&&_0x4bda49[_0x7885('0x22')]>0x0){_0x28497f=_[_0x7885('0x37')](_0x4bda49,_0x3ed310);}return _0x28497f;}function getCustomFields(_0xbaf135,_0x219d89){var _0x355d00=[];var _0x2f11fe={'custom_fields':[]};if(_0xbaf135[_0x7885('0x22')]>0x0){_[_0x7885('0x38')](_0xbaf135,function(_0xa9c457){if(_['includes']([_0x7885('0x39'),_0x7885('0x3a')],_0xa9c457['type'])&&_0xa9c457['nameField']&&!_0xa9c457['customField']){_0x2f11fe[_0xa9c457[_0x7885('0x3b')][_0x7885('0x3c')]()]=_0xa9c457['content']['toString']();}else if(_[_0x7885('0x3d')]([_0x7885('0x39'),_0x7885('0x3a')],_0xa9c457[_0x7885('0x3e')])&&_0xa9c457[_0x7885('0x3f')]&&_0xa9c457[_0x7885('0x40')]){_0x2f11fe[_0x7885('0x1a')][_0x7885('0x41')]({'id':_0xa9c457[_0x7885('0x3f')],'value':_0xa9c457[_0x7885('0x42')]['toString']()});}else if(_0xa9c457[_0x7885('0x3e')]===_0x7885('0x43')&&_0xa9c457[_0x7885('0x44')]&&_0xa9c457[_0x7885('0x3f')]&&_0xa9c457[_0x7885('0x40')]){_0x219d89[_0xa9c457[_0x7885('0x44')]]&&_0x2f11fe[_0x7885('0x1a')][_0x7885('0x41')]({'id':_0xa9c457[_0x7885('0x3f')],'value':_0x219d89[_0xa9c457['variableName']][_0x7885('0x31')]()});}else if(_0xa9c457[_0x7885('0x3e')]===_0x7885('0x45')&&_0xa9c457[_0x7885('0x46')]&&_0xa9c457[_0x7885('0x46')][_0x7885('0x18')]&&_0xa9c457[_0x7885('0x3f')]&&_0xa9c457[_0x7885('0x40')]){_0x219d89[_0xa9c457[_0x7885('0x46')]['name']['toLowerCase']()]&&_0x2f11fe['custom_fields']['push']({'id':_0xa9c457[_0x7885('0x3f')],'value':_0x219d89[_0xa9c457[_0x7885('0x46')][_0x7885('0x18')][_0x7885('0x3c')]()][_0x7885('0x31')]()});}});}return _0x2f11fe;}exports[_0x7885('0x47')]=function(_0x4bdf2b,_0x4a5275,_0x2dd606,_0x18d53a,_0x5e2008,_0x26df7c){var _0x21ac8c,_0x315362;_0x26df7c[_0x7885('0x1d')]=intUtil['stripTrailingSlash'](_0x26df7c[_0x7885('0x1d')]);_0x26df7c['serverUrl']=intUtil[_0x7885('0x48')](_0x26df7c[_0x7885('0x49')]);if(_0x5e2008&&_0x5e2008['monitor_format']){logger['info']('[QUEUE]',_0x7885('0x4a'));_0x4a5275['recordingURL']=util[_0x7885('0x11')](_0x7885('0x4b'),_0x26df7c[_0x7885('0x49')],_0x4a5275['uniqueid'],md5(_0x4a5275[_0x7885('0x4c')]));}else{_0x4a5275['recordingURL']='';}headers[_0x7885('0x4d')]=getAuth(_0x26df7c);return getUser(_0x26df7c,_0x18d53a[_0x7885('0x26')])[_0x7885('0x1e')](function(_0x354017){_0x21ac8c=_0x354017;logger['info'](_0x7885('0x4e'),_0x21ac8c['id']);return getEndUser(_0x26df7c,_0x4a5275['calleridname'],_0x4a5275['calleridnum']);})[_0x7885('0x1e')](function(_0x1bd91b){_0x315362=_0x1bd91b;logger['info'](_0x7885('0x4f'),_0x315362['id']);return getTicket(_0x26df7c,_0x21ac8c,_0x315362,_0x2dd606,_0x4a5275);})[_0x7885('0x1e')](function(_0x4a5351){if(_0x4a5351&&_0x4a5351['id']){logger[_0x7885('0xe')](_0x7885('0x1f'));logger[_0x7885('0xe')](_0x7885('0x50'),_0x4a5351['id']);logger[_0x7885('0xe')](_0x7885('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7885('0x52'),_0x18d53a['name']),_0x7885('0x53'),{'uri':util[_0x7885('0x11')]('%s/helpdesk/tickets/%d',_0x26df7c[_0x7885('0x1d')],_0x4a5351['id'])});}})[_0x7885('0x54')](function(_0x521e8b){logger[_0x7885('0x55')](_0x7885('0x51'),JSON[_0x7885('0x35')](_0x521e8b));});};exports[_0x7885('0x56')]=function(_0xd4396,_0x4a2235,_0x5bd798,_0x4cf040,_0x35d0d7,_0x210d50,_0x38d82b){var _0x2a5e37,_0x50baaf;_0x210d50[_0x7885('0x1d')]=intUtil[_0x7885('0x48')](_0x210d50[_0x7885('0x1d')]);_0x210d50[_0x7885('0x49')]=intUtil['stripTrailingSlash'](_0x210d50[_0x7885('0x49')]);if(_0x38d82b&&_0x38d82b[_0x7885('0x57')]&&_0x38d82b[_0x7885('0x57')]!==_0x7885('0x58')){logger[_0x7885('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a2235[_0x7885('0x59')]=util[_0x7885('0x11')](_0x7885('0x4b'),_0x210d50[_0x7885('0x49')],_0x4a2235[_0x7885('0x4c')],md5(_0x4a2235[_0x7885('0x4c')]));}headers[_0x7885('0x4d')]=getAuth(_0x210d50);return getUser(_0x210d50,_0x4cf040[_0x7885('0x26')])['then'](function(_0x538160){_0x2a5e37=_0x538160;logger[_0x7885('0xe')]('The\x20User\x20ID\x20is:',_0x2a5e37['id']);return getEndUser(_0x210d50,_0x4a2235[_0x7885('0x5a')],_0x4a2235[_0x7885('0x5b')]);})[_0x7885('0x1e')](function(_0x1672fe){_0x50baaf=_0x1672fe;logger[_0x7885('0xe')](_0x7885('0x4f'),_0x50baaf['id']);return getTicket(_0x210d50,_0x2a5e37,_0x50baaf,_0x5bd798,_0x4a2235);})[_0x7885('0x1e')](function(_0x1322b6){if(_0x1322b6&&_0x1322b6['id']){logger['info']('Ticket\x20created!');logger[_0x7885('0xe')](_0x7885('0x50'),_0x1322b6['id']);logger[_0x7885('0xe')](_0x7885('0x5c'),_0x7885('0x5d'));emit(util[_0x7885('0x11')](_0x7885('0x52'),_0x4cf040[_0x7885('0x18')]),_0x7885('0x53'),{'uri':util[_0x7885('0x11')](_0x7885('0x5e'),_0x210d50['remoteUri'],_0x1322b6['id'])});}})[_0x7885('0x54')](function(_0x28d0bc){logger[_0x7885('0x55')]('[OUTBOUND]',JSON[_0x7885('0x35')](_0x28d0bc));});};exports[_0x7885('0x5f')]=function(_0x354ada,_0x506b80,_0x31cbf0,_0x10a0a7,_0x2d7233,_0x26eba2){var _0x3ca841,_0xf93dbc;_0x26eba2['remoteUri']=intUtil[_0x7885('0x48')](_0x26eba2[_0x7885('0x1d')]);_0x26eba2[_0x7885('0x49')]=intUtil[_0x7885('0x48')](_0x26eba2['serverUrl']);if(_0x2d7233&&_0x2d7233[_0x7885('0x60')]){logger[_0x7885('0xe')]('['+_0x506b80[_0x7885('0x61')][_0x7885('0x62')]()+']',_0x7885('0x4a'));_0x506b80[_0x7885('0x59')]=util['format'](_0x7885('0x4b'),_0x26eba2[_0x7885('0x49')],_0x506b80[_0x7885('0x4c')],md5(_0x506b80[_0x7885('0x4c')]));}else{_0x506b80[_0x7885('0x59')]='';}headers[_0x7885('0x4d')]=getAuth(_0x26eba2);return getUser(_0x26eba2,'')[_0x7885('0x1e')](function(_0x1b1084){_0x3ca841=_0x1b1084;logger[_0x7885('0xe')](_0x7885('0x4e'),_0x3ca841['id']);return getEndUser(_0x26eba2,_0x506b80['calleridname'],_0x506b80[_0x7885('0x14')]);})[_0x7885('0x1e')](function(_0x181209){_0xf93dbc=_0x181209;logger[_0x7885('0xe')](_0x7885('0x4f'),_0xf93dbc['id']);return getTicket(_0x26eba2,_0x3ca841,_0xf93dbc,_0x31cbf0,_0x506b80);})['then'](function(_0x16d0a1){if(_0x16d0a1){logger['info']('Ticket\x20created!');logger[_0x7885('0xe')](_0x7885('0x50'),_0x16d0a1['id']);}})[_0x7885('0x54')](function(_0x5eebad){logger['error']('['+_0x506b80[_0x7885('0x61')]['toUpperCase']()+']',JSON['stringify'](_0x5eebad));});}; \ No newline at end of file +var _0x99d6=['name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','format','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','includes','push','idField','content','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','error','[OUTBOUND]','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x99d6,0x105));var _0x699d=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x99d6[_0x149ca0];return _0x56b6b9;};'use strict';var _=require('lodash');var rp=require(_0x699d('0x0'));var md5=require(_0x699d('0x1'));var util=require(_0x699d('0x2'));var Redis=require(_0x699d('0x3'));var intUtil=require(_0x699d('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x699d('0x5'));config[_0x699d('0x6')]=_[_0x699d('0x7')](config['redis'],{'host':_0x699d('0x8'),'port':0x18eb});var io=require(_0x699d('0x9'))(new Redis(config[_0x699d('0x6')]));var headers={'Content-Type':_0x699d('0xa'),'Accept':'application/json'};function emit(_0x2bbb92,_0x394901,_0x13e3f4){io['to'](_0x2bbb92)['emit'](_0x394901,_0x13e3f4);}function getTicket(_0x4a02de,_0x51b4c7,_0x5531c7,_0x4d8f5b,_0x2a5f10){logger[_0x699d('0xb')](_0x699d('0xc'));var _0x481dcc=_[_0x699d('0xd')]({'responder_id':_0x51b4c7['id'],'requester_id':_0x5531c7['id'],'name':util['format'](_0x699d('0xe'),_0x2a5f10['calleridname']),'phone':_0x2a5f10[_0x699d('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x699d('0x10')](_0x4d8f5b[_0x699d('0x11')],_0x2a5f10,'\x20'),'description':intUtil[_0x699d('0x10')](_0x4d8f5b[_0x699d('0x12')],_0x2a5f10,_0x699d('0x13')),'tags':getTags(_0x4d8f5b[_0x699d('0x14')],_0x699d('0x15'))},getCustomFields(_0x4d8f5b[_0x699d('0x16')],_0x2a5f10));_0x481dcc['custom_fields']=_[_0x699d('0x17')](_[_0x699d('0x18')](_0x481dcc[_0x699d('0x19')],'id'),_0x699d('0x1a'));return request({'uri':util['format'](_0x699d('0x1b'),_0x4a02de[_0x699d('0x1c')]),'method':'POST','body':_0x481dcc})[_0x699d('0x1d')](function(_0x3682bd){logger['info'](_0x699d('0x1e'));return _0x3682bd;});}function getUser(_0x35e469,_0x3f72cd){if(intUtil[_0x699d('0x1f')](_0x3f72cd)){return request({'uri':util[_0x699d('0x20')]('%s/api/v2/agents',_0x35e469[_0x699d('0x1c')]),'qs':{'email':_0x3f72cd}})['then'](function(_0x3f83dc){if(_0x3f83dc[_0x699d('0x21')]){logger[_0x699d('0xb')](_0x699d('0x22'));return _[_0x699d('0x23')](_0x3f83dc,function(_0x34b083){return _0x34b083[_0x699d('0x24')][_0x699d('0x25')]===_0x3f72cd;});}else{logger[_0x699d('0xb')](_0x699d('0x26'));return request({'uri':util[_0x699d('0x20')](_0x699d('0x27'),_0x35e469['remoteUri'])})[_0x699d('0x1d')](function(_0x52e7b2){logger[_0x699d('0xb')](_0x699d('0x28'));return _0x52e7b2;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x699d('0x20')]('%s/api/v2/agents/me',_0x35e469[_0x699d('0x1c')])})['then'](function(_0x1bb0f5){logger[_0x699d('0xb')](_0x699d('0x28'));return _0x1bb0f5;});}}function getEndUser(_0x5aeee3,_0x52d285,_0xda0018){logger[_0x699d('0xb')](_0x699d('0x29'),_0xda0018);return request({'uri':util[_0x699d('0x20')](_0x699d('0x2a'),_0x5aeee3['remoteUri']),'qs':{'phone':_0xda0018}})[_0x699d('0x1d')](function(_0x1736c6){if(_0x1736c6[_0x699d('0x21')]){logger[_0x699d('0xb')](_0x699d('0x2b'));return _[_0x699d('0x23')](_0x1736c6,{'phone':_0xda0018});}else{logger[_0x699d('0xb')](_0x699d('0x2c'));return request({'uri':util[_0x699d('0x20')](_0x699d('0x2a'),_0x5aeee3['remoteUri']),'method':'POST','body':{'name':_0x52d285,'phone':_0xda0018}})['then'](function(_0x1b3a86){logger[_0x699d('0xb')](_0x699d('0x2d'));return _0x1b3a86;});}});}function getAuth(_0x595c7a){return util[_0x699d('0x20')](_0x699d('0x2e'),new Buffer(_0x595c7a[_0x699d('0x2f')]+':X')[_0x699d('0x30')](_0x699d('0x31')));}function request(_0x1db660){logger['debug'](_0x699d('0x32'),JSON[_0x699d('0x33')](_0x1db660));return rp(_['defaults'](_0x1db660,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2abf48,_0x18566a){var _0x3b724f=[];if(_0x2abf48&&_0x2abf48['length']>0x0){_0x3b724f=_[_0x699d('0x34')](_0x2abf48,_0x18566a);}return _0x3b724f;}function getCustomFields(_0x54435c,_0x234fcc){var _0x1b9f0a=[];var _0x357508={'custom_fields':[]};if(_0x54435c[_0x699d('0x21')]>0x0){_[_0x699d('0x35')](_0x54435c,function(_0x946f69){if(_['includes']([_0x699d('0x36'),_0x699d('0x37')],_0x946f69[_0x699d('0x38')])&&_0x946f69[_0x699d('0x39')]&&!_0x946f69[_0x699d('0x3a')]){_0x357508[_0x946f69[_0x699d('0x39')]['toLowerCase']()]=_0x946f69['content'][_0x699d('0x30')]();}else if(_[_0x699d('0x3b')]([_0x699d('0x36'),'picklist'],_0x946f69[_0x699d('0x38')])&&_0x946f69['idField']&&_0x946f69[_0x699d('0x3a')]){_0x357508['custom_fields'][_0x699d('0x3c')]({'id':_0x946f69[_0x699d('0x3d')],'value':_0x946f69[_0x699d('0x3e')]['toString']()});}else if(_0x946f69[_0x699d('0x38')]===_0x699d('0x3f')&&_0x946f69['variableName']&&_0x946f69[_0x699d('0x3d')]&&_0x946f69[_0x699d('0x3a')]){_0x234fcc[_0x946f69[_0x699d('0x40')]]&&_0x357508[_0x699d('0x19')][_0x699d('0x3c')]({'id':_0x946f69[_0x699d('0x3d')],'value':_0x234fcc[_0x946f69[_0x699d('0x40')]][_0x699d('0x30')]()});}else if(_0x946f69[_0x699d('0x38')]==='customVariable'&&_0x946f69['Variable']&&_0x946f69[_0x699d('0x41')][_0x699d('0x15')]&&_0x946f69[_0x699d('0x3d')]&&_0x946f69[_0x699d('0x3a')]){_0x234fcc[_0x946f69['Variable'][_0x699d('0x15')]['toLowerCase']()]&&_0x357508[_0x699d('0x19')][_0x699d('0x3c')]({'id':_0x946f69[_0x699d('0x3d')],'value':_0x234fcc[_0x946f69[_0x699d('0x41')][_0x699d('0x15')][_0x699d('0x42')]()][_0x699d('0x30')]()});}});}return _0x357508;}exports[_0x699d('0x43')]=function(_0x5ea49c,_0x5ae18a,_0x2e7f47,_0x55aa18,_0x4a695b,_0xd255c3){var _0x4b2180,_0x2b14de;_0xd255c3[_0x699d('0x1c')]=intUtil[_0x699d('0x44')](_0xd255c3[_0x699d('0x1c')]);_0xd255c3[_0x699d('0x45')]=intUtil['stripTrailingSlash'](_0xd255c3[_0x699d('0x45')]);if(_0x4a695b&&_0x4a695b[_0x699d('0x46')]){logger['info']('[QUEUE]',_0x699d('0x47'));_0x5ae18a[_0x699d('0x48')]=util[_0x699d('0x20')](_0x699d('0x49'),_0xd255c3[_0x699d('0x45')],_0x5ae18a[_0x699d('0x4a')],md5(_0x5ae18a['uniqueid']));}else{_0x5ae18a[_0x699d('0x48')]='';}headers['Authorization']=getAuth(_0xd255c3);return getUser(_0xd255c3,_0x55aa18[_0x699d('0x25')])[_0x699d('0x1d')](function(_0x4ba427){_0x4b2180=_0x4ba427;logger['info'](_0x699d('0x4b'),_0x4b2180['id']);return getEndUser(_0xd255c3,_0x5ae18a['calleridname'],_0x5ae18a[_0x699d('0xf')]);})[_0x699d('0x1d')](function(_0x157d43){_0x2b14de=_0x157d43;logger[_0x699d('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2b14de['id']);return getTicket(_0xd255c3,_0x4b2180,_0x2b14de,_0x2e7f47,_0x5ae18a);})[_0x699d('0x1d')](function(_0x319e99){if(_0x319e99&&_0x319e99['id']){logger['info'](_0x699d('0x1e'));logger[_0x699d('0xb')](_0x699d('0x4c'),_0x319e99['id']);logger['info'](_0x699d('0x4d'),_0x699d('0x4e'));emit(util[_0x699d('0x20')](_0x699d('0x4f'),_0x55aa18['name']),_0x699d('0x50'),{'uri':util[_0x699d('0x20')](_0x699d('0x51'),_0xd255c3[_0x699d('0x1c')],_0x319e99['id'])});}})[_0x699d('0x52')](function(_0x18930b){logger['error']('[QUEUE]',JSON[_0x699d('0x33')](_0x18930b));});};exports[_0x699d('0x53')]=function(_0x4b4926,_0x410afc,_0x309949,_0x37bdb0,_0x3faf89,_0x2877ce,_0xeb8a97){var _0x51f7d5,_0x3a8733;_0x2877ce[_0x699d('0x1c')]=intUtil['stripTrailingSlash'](_0x2877ce[_0x699d('0x1c')]);_0x2877ce[_0x699d('0x45')]=intUtil[_0x699d('0x44')](_0x2877ce[_0x699d('0x45')]);if(_0xeb8a97&&_0xeb8a97[_0x699d('0x54')]&&_0xeb8a97[_0x699d('0x54')]!==_0x699d('0x55')){logger['info']('[OUTBOUND]',_0x699d('0x47'));_0x410afc['recordingURL']=util[_0x699d('0x20')](_0x699d('0x49'),_0x2877ce[_0x699d('0x45')],_0x410afc[_0x699d('0x4a')],md5(_0x410afc['uniqueid']));}headers[_0x699d('0x56')]=getAuth(_0x2877ce);return getUser(_0x2877ce,_0x37bdb0[_0x699d('0x25')])[_0x699d('0x1d')](function(_0x424b2d){_0x51f7d5=_0x424b2d;logger[_0x699d('0xb')]('The\x20User\x20ID\x20is:',_0x51f7d5['id']);return getEndUser(_0x2877ce,_0x410afc[_0x699d('0x57')],_0x410afc[_0x699d('0x58')]);})[_0x699d('0x1d')](function(_0x2747f6){_0x3a8733=_0x2747f6;logger[_0x699d('0xb')](_0x699d('0x59'),_0x3a8733['id']);return getTicket(_0x2877ce,_0x51f7d5,_0x3a8733,_0x309949,_0x410afc);})[_0x699d('0x1d')](function(_0x3d8d11){if(_0x3d8d11&&_0x3d8d11['id']){logger['info'](_0x699d('0x1e'));logger[_0x699d('0xb')](_0x699d('0x4c'),_0x3d8d11['id']);logger[_0x699d('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x699d('0x20')](_0x699d('0x4f'),_0x37bdb0[_0x699d('0x15')]),_0x699d('0x50'),{'uri':util[_0x699d('0x20')](_0x699d('0x51'),_0x2877ce[_0x699d('0x1c')],_0x3d8d11['id'])});}})['catch'](function(_0x54f4c2){logger[_0x699d('0x5a')](_0x699d('0x5b'),JSON['stringify'](_0x54f4c2));});};exports['unmanaged']=function(_0x3f3afc,_0x31bd10,_0x1c3d56,_0x590d0f,_0x424fbc,_0x583013){var _0x50924b,_0x35917c;_0x583013[_0x699d('0x1c')]=intUtil[_0x699d('0x44')](_0x583013[_0x699d('0x1c')]);_0x583013[_0x699d('0x45')]=intUtil[_0x699d('0x44')](_0x583013[_0x699d('0x45')]);if(_0x424fbc&&_0x424fbc[_0x699d('0x46')]){logger[_0x699d('0xb')]('['+_0x31bd10[_0x699d('0x5c')][_0x699d('0x5d')]()+']',_0x699d('0x47'));_0x31bd10[_0x699d('0x48')]=util[_0x699d('0x20')](_0x699d('0x49'),_0x583013['serverUrl'],_0x31bd10[_0x699d('0x4a')],md5(_0x31bd10['uniqueid']));}else{_0x31bd10['recordingURL']='';}headers[_0x699d('0x56')]=getAuth(_0x583013);return getUser(_0x583013,'')[_0x699d('0x1d')](function(_0x12bd9b){_0x50924b=_0x12bd9b;logger[_0x699d('0xb')](_0x699d('0x4b'),_0x50924b['id']);return getEndUser(_0x583013,_0x31bd10['calleridname'],_0x31bd10[_0x699d('0xf')]);})[_0x699d('0x1d')](function(_0x2a7ea2){_0x35917c=_0x2a7ea2;logger[_0x699d('0xb')](_0x699d('0x59'),_0x35917c['id']);return getTicket(_0x583013,_0x50924b,_0x35917c,_0x1c3d56,_0x31bd10);})['then'](function(_0x5dd162){if(_0x5dd162){logger[_0x699d('0xb')]('Ticket\x20created!');logger['info'](_0x699d('0x4c'),_0x5dd162['id']);}})[_0x699d('0x52')](function(_0x35be29){logger['error']('['+_0x31bd10[_0x699d('0x5c')]['toUpperCase']()+']',JSON[_0x699d('0x33')](_0x35be29));});}; \ 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 5a9a80b..55c7be7 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 _0xd8c9=['[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','adminEmail','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','Admin\x20selected','adminId','catch','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','destcalleridnum','unmanaged','queue','outbound','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat'];(function(_0x4f6c3c,_0x167865){var _0x24ebdd=function(_0x23852f){while(--_0x23852f){_0x4f6c3c['push'](_0x4f6c3c['shift']());}};_0x24ebdd(++_0x167865);}(_0xd8c9,0x155));var _0x9d8c=function(_0x58833e,_0x426eea){_0x58833e=_0x58833e-0x0;var _0x534169=_0xd8c9[_0x58833e];return _0x534169;};'use strict';var _=require('lodash');var rp=require(_0x9d8c('0x0'));var md5=require('md5');var util=require(_0x9d8c('0x1'));var moment=require(_0x9d8c('0x2'));var Promise=require(_0x9d8c('0x3'));var Redis=require(_0x9d8c('0x4'));var intUtil=require(_0x9d8c('0x5'));var config=require(_0x9d8c('0x6'));var logger=require(_0x9d8c('0x7'))(_0x9d8c('0x8'));config[_0x9d8c('0x9')]=_[_0x9d8c('0xa')](config[_0x9d8c('0x9')],{'host':_0x9d8c('0xb'),'port':0x18eb});var io=require(_0x9d8c('0xc'))(new Redis(config[_0x9d8c('0x9')]));function getAdminId(_0x5c3992,_0x1c92d8,_0x3a0a33,_0x585b76){return new Promise(function(_0xfc3b41,_0x530b14){var _0x20d1ac=![];var _0x183992={'method':_0x9d8c('0xd'),'uri':_0x585b76+_0x9d8c('0xe'),'json':!![]};_0x183992[_0x9d8c('0xf')]=_0x3a0a33;logger['info'](_0x9d8c('0x10'));return rp(_0x183992)[_0x9d8c('0x11')](function(_0x415e92){if(_0x415e92){var _0x31e046=_0x415e92[_0x9d8c('0x12')];var _0x35e76f=null;for(_0x35e76f=0x0;_0x35e76f<_0x31e046[_0x9d8c('0x13')];_0x35e76f++){if(_0x31e046[_0x35e76f]['email']===_0x5c3992[_0x9d8c('0x14')]){_0x5c3992['adminId']=_0x31e046[_0x35e76f]['id'];_0x20d1ac=!![];}}if(_0x20d1ac){logger[_0x9d8c('0x15')](_0x9d8c('0x16'),_0x5c3992['adminId']);_0xfc3b41(_0x5c3992);}else{_0x530b14({'statusCode':0x194,'message':_0x9d8c('0x17')});}}else{_0x530b14({'statusCode':0x194,'message':_0x9d8c('0x17')});}})['catch'](function(_0x47e66a){logger[_0x9d8c('0x18')]('['+[_0x1c92d8[_0x9d8c('0x19')]()]+']',_0x47e66a[_0x9d8c('0x1a')]);_0x530b14(_0x47e66a);});});}function getUser(_0x3dd815,_0x2a159c,_0x117d55){return function(_0x745d51){return new Promise(function(_0x5c3718,_0x233345){var _0x20e172={'method':_0x9d8c('0xd'),'uri':_0x117d55+_0x9d8c('0xe'),'json':!![]};_0x20e172[_0x9d8c('0xf')]=_0x2a159c;logger[_0x9d8c('0x15')](_0x9d8c('0x1b'));return rp(_0x20e172)[_0x9d8c('0x11')](function(_0x2248df){if(_0x2248df){var _0x4be3cc=_0x2248df[_0x9d8c('0x12')];var _0x389036=![];var _0x4ec90d=null;if(_0x745d51[_0x9d8c('0x1c')]!==null){logger[_0x9d8c('0x15')](_0x9d8c('0x1d'),_0x745d51[_0x9d8c('0x1c')]);_0x745d51[_0x9d8c('0x1e')]=_0x745d51[_0x9d8c('0x1c')];for(_0x4ec90d=0x0;_0x4ec90d<_0x4be3cc['length'];_0x4ec90d++){if(_0x4be3cc[_0x4ec90d][_0x9d8c('0x1f')]===_0x745d51[_0x9d8c('0x1c')]){_0x389036=!![];_0x745d51[_0x9d8c('0x20')]=_0x4be3cc[_0x4ec90d]['id'];logger[_0x9d8c('0x15')]('User\x20found:',_0x745d51[_0x9d8c('0x20')]);}}}if(!_0x389036){logger[_0x9d8c('0x15')](_0x9d8c('0x21'));_0x745d51[_0x9d8c('0x1e')]=_0x745d51[_0x9d8c('0x14')];_0x745d51[_0x9d8c('0x20')]=_0x745d51[_0x9d8c('0x22')];_0x389036=!![];}if(_0x389036){_0x5c3718(_0x745d51);}else{_0x233345({'statusCode':0x194,'message':_0x9d8c('0x17')});}}else{_0x233345({'statusCode':0x194,'message':_0x9d8c('0x17')});}})[_0x9d8c('0x23')](function(_0xc12646){logger[_0x9d8c('0x18')]('['+[_0x3dd815['toUpperCase']()]+']',_0xc12646['message']);_0x233345(_0xc12646);});});};}function searchContact(_0x442708,_0x1bc5d4,_0x35cbbb,_0x4c15a1){return new Promise(function(_0x1b4a58,_0x1fb168){var _0x2a8ff4={'method':'GET','headers':_0x1bc5d4,'uri':_0x442708+_0x9d8c('0x24')+_0x4c15a1+_0x9d8c('0x25')+_0x35cbbb+'&entities=contact','json':!![]};rp(_0x2a8ff4)[_0x9d8c('0x11')](function(_0x41cc61){var _0x3d3693=_[_0x9d8c('0x26')](_0x41cc61['contacts'][_0x9d8c('0x27')],[_0x35cbbb,_0x4c15a1]);_0x1b4a58(_0x3d3693);})[_0x9d8c('0x23')](function(_0x979c5e){_0x1fb168(_0x979c5e);});});}function getEndUser(_0x84f89,_0x3c528d,_0x50bbd5){return function(_0x1080e1){return new Promise(function(_0x63385b,_0x1e2097){logger[_0x9d8c('0x15')](util[_0x9d8c('0x28')](_0x9d8c('0x29'),_0x1080e1[_0x9d8c('0x2a')]));searchContact(_0x50bbd5,_0x3c528d,_0x9d8c('0x2b'),_0x1080e1[_0x9d8c('0x2a')])[_0x9d8c('0x11')](function(_0xf7df2){if(_0xf7df2){_0x1080e1[_0x9d8c('0x2c')]=_0xf7df2['id'];logger[_0x9d8c('0x15')](_0x9d8c('0x2d'),_0x1080e1['endUserId']);return _0x63385b(_0x1080e1);}searchContact(_0x50bbd5,_0x3c528d,'work_number',_0x1080e1['contactNumber'])['then'](function(_0x40c7d1){if(_0x40c7d1){_0x1080e1[_0x9d8c('0x2c')]=_0x40c7d1['id'];logger[_0x9d8c('0x15')]('Contact\x20found\x20work_number:',_0x1080e1[_0x9d8c('0x2c')]);return _0x63385b(_0x1080e1);}createEndUser(_0x1080e1,_0x84f89,_0x3c528d,_0x50bbd5)[_0x9d8c('0x11')](function(_0x2979e8){logger[_0x9d8c('0x15')](_0x9d8c('0x2e'),_0x2979e8[_0x9d8c('0x2c')]);return _0x63385b(_0x2979e8);});});})['catch'](function(_0x28aaee){_0x1e2097(_0x28aaee);});});};}function createEndUser(_0x1f0faa,_0x43b6be,_0x56b652,_0x61761e){return new Promise(function(_0x57e211,_0x54e1b2){var _0x3f102b=moment();var _0x2c8ad4={'method':_0x9d8c('0x2f'),'uri':_0x61761e+_0x9d8c('0x30'),'body':{'contact':{'last_name':_0x1f0faa['contactNumber'],'work_number':_0x1f0faa[_0x9d8c('0x2a')],'mobile_number':_0x1f0faa[_0x9d8c('0x2a')],'owner_id':_0x1f0faa[_0x9d8c('0x20')],'created_at':_0x3f102b[_0x9d8c('0x28')](_0x9d8c('0x31'))}},'json':!![]};_0x2c8ad4[_0x9d8c('0xf')]=_0x56b652;logger[_0x9d8c('0x15')](_0x9d8c('0x32'));return rp(_0x2c8ad4)[_0x9d8c('0x11')](function(_0x2ae346){_0x1f0faa[_0x9d8c('0x2c')]=_0x2ae346[_0x9d8c('0x33')]['id'];_0x57e211(_0x1f0faa);})[_0x9d8c('0x23')](function(_0x1ba4e1){logger[_0x9d8c('0x18')]('['+[_0x43b6be[_0x9d8c('0x19')]()]+']',_0x1ba4e1[_0x9d8c('0x1a')]);_0x54e1b2(_0x1ba4e1[_0x9d8c('0x1a')]);});});}function getTicket(_0x1c7e71,_0x606d0c,_0x39f0fc,_0xe42dbf,_0x361151){return function(_0x1532f2){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x67e00a,_0x379847){var _0x525d31=moment();var _0x227192={'method':_0x9d8c('0x2f'),'uri':_0x39f0fc+_0x9d8c('0x34'),'body':{'title':intUtil[_0x9d8c('0x35')](_0xe42dbf[_0x9d8c('0x36')],_0x361151,'\x20'),'description':intUtil['getString'](_0xe42dbf[_0x9d8c('0x37')],_0x361151,'\x0a'),'owner_id':_0x1532f2[_0x9d8c('0x20')],'creater_id':_0x1532f2[_0x9d8c('0x22')],'targetable_id':_0x1532f2[_0x9d8c('0x2c')],'targetable_type':_0x9d8c('0x38'),'created_at':_0x525d31['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x525d31[_0x9d8c('0x39')](0x1e,'m')[_0x9d8c('0x28')](_0x9d8c('0x31'))},'json':!![]};_0x227192[_0x9d8c('0xf')]=_0x606d0c;return rp(_0x227192)[_0x9d8c('0x11')](function(_0x32b776){_0x1532f2[_0x9d8c('0x3a')]=_0x32b776[_0x9d8c('0x3b')]['id'];logger[_0x9d8c('0x15')](_0x9d8c('0x3c'),_0x1532f2[_0x9d8c('0x3a')]);_0x67e00a(_0x1532f2);})['catch'](function(_0x586f04){logger['error']('['+[_0x1c7e71[_0x9d8c('0x19')]()]+']',_0x586f04[_0x9d8c('0x1a')]);_0x379847(_0x586f04[_0x9d8c('0x1a')]);});});};}function emit(_0x316ba6,_0xc2a7a6,_0x8b66f2){var _0x3ecfbc={'uri':_0x316ba6+_0x9d8c('0x3d')+_0x8b66f2};io['to'](util['format']('user:%s',_0xc2a7a6))[_0x9d8c('0x3e')](_0x9d8c('0x3f'),_0x3ecfbc);}exports['cs']=function(_0x4a341d,_0x183862,_0x43de02,_0x73d800,_0x4eafc0,_0x1519c5,_0x5038fb,_0x116cd4){var _0x5cf3d8={};var _0x2dd6b2={'Authorization':_0x9d8c('0x40')+_0x1519c5[_0x9d8c('0x41')]};_0x1519c5['remoteUri']=intUtil['stripTrailingSlash'](_0x1519c5[_0x9d8c('0x42')]);_0x1519c5[_0x9d8c('0x43')]=intUtil[_0x9d8c('0x44')](_0x1519c5[_0x9d8c('0x43')]);var _0x58c45d=_0x1519c5[_0x9d8c('0x42')];_0x5cf3d8[_0x9d8c('0x14')]=_0x1519c5[_0x9d8c('0x45')];_0x5cf3d8['contactNumber']=_0x116cd4['toLowerCase']()==='outbound'?_0x183862[_0x9d8c('0x46')]:_0x183862['calleridnum'];_0x5cf3d8['callDirection']=_0x116cd4==='queue'||_0x116cd4===_0x9d8c('0x47')?_0x9d8c('0x48'):_0x9d8c('0x49');if(_0x73d800){_0x5cf3d8['agentEmail']=_0x73d800[_0x9d8c('0x1f')];}var _0x20253b=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1519c5['serverUrl'],_0x183862['uniqueid'],md5(_0x183862['uniqueid']));if(_0x4eafc0&&_0x4eafc0[_0x9d8c('0x4a')]){logger[_0x9d8c('0x15')](_0x9d8c('0x4b'),_0x9d8c('0x4c'));_0x183862[_0x9d8c('0x4d')]=_0x20253b;}else if(_0x5038fb&&_0x5038fb[_0x9d8c('0x4e')]&&_0x5038fb[_0x9d8c('0x4e')]!=='none'){logger['info'](_0x9d8c('0x4f'),'Recording\x20is\x20enabled!');_0x183862[_0x9d8c('0x4d')]=_0x20253b;}else{_0x183862[_0x9d8c('0x4d')]='';}return getAdminId(_0x5cf3d8,_0x116cd4,_0x2dd6b2,_0x58c45d)[_0x9d8c('0x11')](getUser(_0x116cd4,_0x2dd6b2,_0x58c45d))[_0x9d8c('0x11')](getEndUser(_0x116cd4,_0x2dd6b2,_0x58c45d))[_0x9d8c('0x11')](getTicket(_0x116cd4,_0x2dd6b2,_0x58c45d,_0x43de02,_0x183862))[_0x9d8c('0x11')](function(_0x3126fe){logger[_0x9d8c('0x15')](util[_0x9d8c('0x28')](_0x9d8c('0x50'),_0x3126fe[_0x9d8c('0x3a')]));if(_0x116cd4!==_0x9d8c('0x47')){logger[_0x9d8c('0x15')]('['+[_0x116cd4['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x58c45d,_0x73d800[_0x9d8c('0x51')],_0x3126fe[_0x9d8c('0x2c')]);}})[_0x9d8c('0x23')](function(_0x44ae31){logger['error']('['+[_0x116cd4[_0x9d8c('0x19')]()]+_0x9d8c('0x52'),util[_0x9d8c('0x53')](_0x44ae31,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5c1f=['redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','then','users','agentEmail','userEmail','userId','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales'];(function(_0xcdba38,_0xcdd9b1){var _0x47c6bd=function(_0x566a86){while(--_0x566a86){_0xcdba38['push'](_0xcdba38['shift']());}};_0x47c6bd(++_0xcdd9b1);}(_0x5c1f,0x1d7));var _0xf5c1=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x5c1f[_0x58a4fe];return _0x697de2;};'use strict';var _=require(_0xf5c1('0x0'));var rp=require(_0xf5c1('0x1'));var md5=require(_0xf5c1('0x2'));var util=require('util');var moment=require(_0xf5c1('0x3'));var Promise=require('bluebird');var Redis=require(_0xf5c1('0x4'));var intUtil=require(_0xf5c1('0x5'));var config=require(_0xf5c1('0x6'));var logger=require(_0xf5c1('0x7'))(_0xf5c1('0x8'));config[_0xf5c1('0x9')]=_[_0xf5c1('0xa')](config['redis'],{'host':_0xf5c1('0xb'),'port':0x18eb});var io=require(_0xf5c1('0xc'))(new Redis(config['redis']));function getAdminId(_0x1ab62a,_0x234796,_0x131514,_0x4c4fc0){return new Promise(function(_0x5d48b1,_0x370b27){var _0x476a74=![];var _0x3ff42a={'method':_0xf5c1('0xd'),'uri':_0x4c4fc0+_0xf5c1('0xe'),'json':!![]};_0x3ff42a['headers']=_0x131514;logger[_0xf5c1('0xf')](_0xf5c1('0x10'));return rp(_0x3ff42a)['then'](function(_0x34cccc){if(_0x34cccc){var _0x465e49=_0x34cccc['users'];var _0x2c96d5=null;for(_0x2c96d5=0x0;_0x2c96d5<_0x465e49[_0xf5c1('0x11')];_0x2c96d5++){if(_0x465e49[_0x2c96d5]['email']===_0x1ab62a[_0xf5c1('0x12')]){_0x1ab62a[_0xf5c1('0x13')]=_0x465e49[_0x2c96d5]['id'];_0x476a74=!![];}}if(_0x476a74){logger[_0xf5c1('0xf')]('Admin\x20found:',_0x1ab62a[_0xf5c1('0x13')]);_0x5d48b1(_0x1ab62a);}else{_0x370b27({'statusCode':0x194,'message':_0xf5c1('0x14')});}}else{_0x370b27({'statusCode':0x194,'message':_0xf5c1('0x14')});}})[_0xf5c1('0x15')](function(_0x12e4a2){logger['error']('['+[_0x234796[_0xf5c1('0x16')]()]+']',_0x12e4a2[_0xf5c1('0x17')]);_0x370b27(_0x12e4a2);});});}function getUser(_0x4c263b,_0x3f6b81,_0x29f18a){return function(_0x27f6b5){return new Promise(function(_0xecaa1b,_0x599690){var _0x58b17f={'method':'GET','uri':_0x29f18a+_0xf5c1('0xe'),'json':!![]};_0x58b17f['headers']=_0x3f6b81;logger[_0xf5c1('0xf')](_0xf5c1('0x18'));return rp(_0x58b17f)[_0xf5c1('0x19')](function(_0x32d3f6){if(_0x32d3f6){var _0x2266d0=_0x32d3f6[_0xf5c1('0x1a')];var _0x5e36fa=![];var _0x593c7a=null;if(_0x27f6b5[_0xf5c1('0x1b')]!==null){logger[_0xf5c1('0xf')]('Getting\x20user\x20with\x20email',_0x27f6b5[_0xf5c1('0x1b')]);_0x27f6b5[_0xf5c1('0x1c')]=_0x27f6b5[_0xf5c1('0x1b')];for(_0x593c7a=0x0;_0x593c7a<_0x2266d0[_0xf5c1('0x11')];_0x593c7a++){if(_0x2266d0[_0x593c7a]['email']===_0x27f6b5['agentEmail']){_0x5e36fa=!![];_0x27f6b5[_0xf5c1('0x1d')]=_0x2266d0[_0x593c7a]['id'];logger[_0xf5c1('0xf')]('User\x20found:',_0x27f6b5[_0xf5c1('0x1d')]);}}}if(!_0x5e36fa){logger['info']('Admin\x20selected');_0x27f6b5[_0xf5c1('0x1c')]=_0x27f6b5['adminEmail'];_0x27f6b5['userId']=_0x27f6b5[_0xf5c1('0x13')];_0x5e36fa=!![];}if(_0x5e36fa){_0xecaa1b(_0x27f6b5);}else{_0x599690({'statusCode':0x194,'message':_0xf5c1('0x14')});}}else{_0x599690({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf5c1('0x15')](function(_0x58b678){logger[_0xf5c1('0x1e')]('['+[_0x4c263b[_0xf5c1('0x16')]()]+']',_0x58b678[_0xf5c1('0x17')]);_0x599690(_0x58b678);});});};}function searchContact(_0x1d79f0,_0x5b0cad,_0x547401,_0x23783a){return new Promise(function(_0x3604b3,_0x1cc68d){var _0x13df7e={'method':_0xf5c1('0xd'),'headers':_0x5b0cad,'uri':_0x1d79f0+_0xf5c1('0x1f')+_0x23783a+_0xf5c1('0x20')+_0x547401+_0xf5c1('0x21'),'json':!![]};rp(_0x13df7e)[_0xf5c1('0x19')](function(_0x3d0067){var _0x1a3cf1=_[_0xf5c1('0x22')](_0x3d0067[_0xf5c1('0x23')][_0xf5c1('0x23')],[_0x547401,_0x23783a]);_0x3604b3(_0x1a3cf1);})[_0xf5c1('0x15')](function(_0x4a28fe){_0x1cc68d(_0x4a28fe);});});}function getEndUser(_0x5e7312,_0x51ebe5,_0x4a096e){return function(_0x912f07){return new Promise(function(_0x3d128d,_0x1a0a65){logger[_0xf5c1('0xf')](util[_0xf5c1('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0x912f07[_0xf5c1('0x25')]));searchContact(_0x4a096e,_0x51ebe5,_0xf5c1('0x26'),_0x912f07[_0xf5c1('0x25')])['then'](function(_0x40eae0){if(_0x40eae0){_0x912f07[_0xf5c1('0x27')]=_0x40eae0['id'];logger[_0xf5c1('0xf')](_0xf5c1('0x28'),_0x912f07['endUserId']);return _0x3d128d(_0x912f07);}searchContact(_0x4a096e,_0x51ebe5,_0xf5c1('0x29'),_0x912f07['contactNumber'])[_0xf5c1('0x19')](function(_0x59b898){if(_0x59b898){_0x912f07[_0xf5c1('0x27')]=_0x59b898['id'];logger[_0xf5c1('0xf')](_0xf5c1('0x2a'),_0x912f07['endUserId']);return _0x3d128d(_0x912f07);}createEndUser(_0x912f07,_0x5e7312,_0x51ebe5,_0x4a096e)[_0xf5c1('0x19')](function(_0x56ac94){logger[_0xf5c1('0xf')]('Contact\x20created:',_0x56ac94[_0xf5c1('0x27')]);return _0x3d128d(_0x56ac94);});});})[_0xf5c1('0x15')](function(_0x362638){_0x1a0a65(_0x362638);});});};}function createEndUser(_0x2861ac,_0x90d3ab,_0x214da9,_0x42e834){return new Promise(function(_0x2d3a2a,_0x2b3f0c){var _0x43eb49=moment();var _0x119fb7={'method':_0xf5c1('0x2b'),'uri':_0x42e834+'/api/contacts','body':{'contact':{'last_name':_0x2861ac[_0xf5c1('0x25')],'work_number':_0x2861ac[_0xf5c1('0x25')],'mobile_number':_0x2861ac[_0xf5c1('0x25')],'owner_id':_0x2861ac['userId'],'created_at':_0x43eb49[_0xf5c1('0x24')](_0xf5c1('0x2c'))}},'json':!![]};_0x119fb7[_0xf5c1('0x2d')]=_0x214da9;logger[_0xf5c1('0xf')](_0xf5c1('0x2e'));return rp(_0x119fb7)[_0xf5c1('0x19')](function(_0x4980e3){_0x2861ac[_0xf5c1('0x27')]=_0x4980e3[_0xf5c1('0x2f')]['id'];_0x2d3a2a(_0x2861ac);})['catch'](function(_0x984dc8){logger[_0xf5c1('0x1e')]('['+[_0x90d3ab['toUpperCase']()]+']',_0x984dc8[_0xf5c1('0x17')]);_0x2b3f0c(_0x984dc8[_0xf5c1('0x17')]);});});}function getTicket(_0x7a38e6,_0x97f3de,_0x3549a1,_0x39047c,_0x4bd9df){return function(_0x4d46cb){logger[_0xf5c1('0xf')](_0xf5c1('0x30'));return new Promise(function(_0x26f3de,_0x1c0df5){var _0x13282e=moment();var _0x21a78c={'method':'POST','uri':_0x3549a1+_0xf5c1('0x31'),'body':{'title':intUtil[_0xf5c1('0x32')](_0x39047c[_0xf5c1('0x33')],_0x4bd9df,'\x20'),'description':intUtil[_0xf5c1('0x32')](_0x39047c[_0xf5c1('0x34')],_0x4bd9df,'\x0a'),'owner_id':_0x4d46cb[_0xf5c1('0x1d')],'creater_id':_0x4d46cb[_0xf5c1('0x13')],'targetable_id':_0x4d46cb[_0xf5c1('0x27')],'targetable_type':_0xf5c1('0x35'),'created_at':_0x13282e[_0xf5c1('0x24')](_0xf5c1('0x2c')),'due_date':_0x13282e[_0xf5c1('0x36')](0x1e,'m')[_0xf5c1('0x24')](_0xf5c1('0x2c'))},'json':!![]};_0x21a78c[_0xf5c1('0x2d')]=_0x97f3de;return rp(_0x21a78c)[_0xf5c1('0x19')](function(_0x3575d8){_0x4d46cb['ticketId']=_0x3575d8['task']['id'];logger[_0xf5c1('0xf')]('Task\x20created:',_0x4d46cb[_0xf5c1('0x37')]);_0x26f3de(_0x4d46cb);})[_0xf5c1('0x15')](function(_0x5eba2e){logger[_0xf5c1('0x1e')]('['+[_0x7a38e6[_0xf5c1('0x16')]()]+']',_0x5eba2e[_0xf5c1('0x17')]);_0x1c0df5(_0x5eba2e[_0xf5c1('0x17')]);});});};}function emit(_0xf19726,_0x330deb,_0x2cd1b8){var _0x16964={'uri':_0xf19726+'/contacts/'+_0x2cd1b8};io['to'](util[_0xf5c1('0x24')](_0xf5c1('0x38'),_0x330deb))['emit']('trigger:browser:url',_0x16964);}exports['cs']=function(_0x9d7615,_0x1bac63,_0x2eae50,_0x24d12d,_0x1934ff,_0x2c739c,_0x20256b,_0x2e882e){var _0x4619e7={};var _0xb457e1={'Authorization':_0xf5c1('0x39')+_0x2c739c[_0xf5c1('0x3a')]};_0x2c739c[_0xf5c1('0x3b')]=intUtil[_0xf5c1('0x3c')](_0x2c739c[_0xf5c1('0x3b')]);_0x2c739c[_0xf5c1('0x3d')]=intUtil['stripTrailingSlash'](_0x2c739c['serverUrl']);var _0x527c12=_0x2c739c[_0xf5c1('0x3b')];_0x4619e7['adminEmail']=_0x2c739c[_0xf5c1('0x3e')];_0x4619e7['contactNumber']=_0x2e882e['toLowerCase']()===_0xf5c1('0x3f')?_0x1bac63[_0xf5c1('0x40')]:_0x1bac63['calleridnum'];_0x4619e7['callDirection']=_0x2e882e===_0xf5c1('0x41')||_0x2e882e===_0xf5c1('0x42')?_0xf5c1('0x41'):'outbound';if(_0x24d12d){_0x4619e7[_0xf5c1('0x1b')]=_0x24d12d[_0xf5c1('0x43')];}var _0xe75abc=util[_0xf5c1('0x24')](_0xf5c1('0x44'),_0x2c739c['serverUrl'],_0x1bac63['uniqueid'],md5(_0x1bac63[_0xf5c1('0x45')]));if(_0x1934ff&&_0x1934ff['monitor_format']){logger['info'](_0xf5c1('0x46'),_0xf5c1('0x47'));_0x1bac63[_0xf5c1('0x48')]=_0xe75abc;}else if(_0x20256b&&_0x20256b[_0xf5c1('0x49')]&&_0x20256b[_0xf5c1('0x49')]!=='none'){logger[_0xf5c1('0xf')](_0xf5c1('0x4a'),_0xf5c1('0x47'));_0x1bac63['recordingURL']=_0xe75abc;}else{_0x1bac63['recordingURL']='';}return getAdminId(_0x4619e7,_0x2e882e,_0xb457e1,_0x527c12)[_0xf5c1('0x19')](getUser(_0x2e882e,_0xb457e1,_0x527c12))['then'](getEndUser(_0x2e882e,_0xb457e1,_0x527c12))[_0xf5c1('0x19')](getTicket(_0x2e882e,_0xb457e1,_0x527c12,_0x2eae50,_0x1bac63))[_0xf5c1('0x19')](function(_0x5b9128){logger[_0xf5c1('0xf')](util[_0xf5c1('0x24')](_0xf5c1('0x4b'),_0x5b9128[_0xf5c1('0x37')]));if(_0x2e882e!==_0xf5c1('0x42')){logger[_0xf5c1('0xf')]('['+[_0x2e882e[_0xf5c1('0x16')]()]+']',_0xf5c1('0x4c'));emit(_0x527c12,_0x24d12d[_0xf5c1('0x4d')],_0x5b9128[_0xf5c1('0x27')]);}})[_0xf5c1('0x15')](function(_0x1c20f6){logger[_0xf5c1('0x1e')]('['+[_0x2e882e[_0xf5c1('0x16')]()]+_0xf5c1('0x4e'),util[_0xf5c1('0x4f')](_0x1c20f6,{'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 76fcb97..5ffa776 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 _0x84eb=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','desk','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','util','./sugarcrm','./zoho'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x84eb,0x107));var _0xb84e=function(_0xe7785a,_0x199def){_0xe7785a=_0xe7785a-0x0;var _0x124d7a=_0x84eb[_0xe7785a];return _0x124d7a;};'use strict';var _=require('lodash');var util=require(_0xb84e('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xb84e('0x1'));var freshdesk=require('./freshdesk');var zoho=require(_0xb84e('0x2'));var desk=require(_0xb84e('0x3'));var vtiger=require(_0xb84e('0x4'));var servicenow=require(_0xb84e('0x5'));var dynamics365=require(_0xb84e('0x6'));var freshsales=require(_0xb84e('0x7'));var integrations=[_0xb84e('0x8'),'salesforce',_0xb84e('0x9'),_0xb84e('0xa'),_0xb84e('0xb'),'desk',_0xb84e('0xc'),_0xb84e('0xd'),'freshsales',_0xb84e('0xe')];exports[_0xb84e('0xf')]=function(_0x29d514,_0x1916f0,_0x35895d,_0x77001b,_0x254d90,_0x7e933f){if(_0x35895d){if(_[_0xb84e('0x10')](integrations,_0x29d514[_0xb84e('0x11')][_0xb84e('0x12')]())){try{var _0x4241c9=null;var _0x3fafce='';var _0x16595e=_0x35895d[_0x29d514[_0xb84e('0x11')][_0xb84e('0x12')]()];if(_0x16595e){var _0x2c7e06=_0x16595e[_0x29d514[_0xb84e('0x13')]];if(_0x2c7e06){var _0x134d87=_[_0xb84e('0x14')](_0x2c7e06[_0xb84e('0x15')],{'id':parseInt(_0x29d514[_0xb84e('0x16')],0xa)});if(_0x134d87){if(_0x77001b){if(_0x254d90&&_0x1916f0[_0xb84e('0x17')]){_0x3fafce=_0xb84e('0x17');}else if(_0x1916f0[_0xb84e('0x18')]){_0x3fafce=_0xb84e('0x19');}else{console[_0xb84e('0x1a')](_0xb84e('0x1b'),_0x1916f0);}}else{_0x3fafce=_0xb84e('0x1c');}switch(_0x29d514[_0xb84e('0x11')][_0xb84e('0x12')]()){case _0xb84e('0x8'):zendesk[_0x3fafce](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f);break;case _0xb84e('0x1d'):salesforce[_0x3fafce](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f);break;case _0xb84e('0x9'):sugarcrm[_0x3fafce](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f);break;case'freshdesk':freshdesk[_0x3fafce](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f);break;case _0xb84e('0xb'):zoho[_0x3fafce](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f);break;case _0xb84e('0x1e'):desk[_0x3fafce](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f);break;case _0xb84e('0xc'):vtiger[_0x3fafce](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f);break;case'freshsales':freshsales['cs'](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f,_0x3fafce);break;case _0xb84e('0xe'):servicenow['cs'](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f,_0x3fafce);break;case _0xb84e('0xd'):dynamics365['cs'](_0x29d514,_0x1916f0,_0x134d87,_0x77001b,_0x254d90,_0x2c7e06,_0x7e933f,_0x3fafce);break;default:console['log'](_0xb84e('0x1f'));}}else{_0x4241c9=require('../../../../config/logger')(_0x29d514[_0xb84e('0x11')][_0xb84e('0x12')]());_0x4241c9[_0xb84e('0x20')](_0xb84e('0x21'),util[_0xb84e('0x22')](_0xb84e('0x23'),_0x29d514[_0xb84e('0x11')]['toLowerCase'](),_0x29d514[_0xb84e('0x16')]));}}else{_0x4241c9=require(_0xb84e('0x24'))(_0x29d514[_0xb84e('0x11')][_0xb84e('0x12')]());_0x4241c9[_0xb84e('0x20')](_0xb84e('0x21'),util[_0xb84e('0x22')](_0xb84e('0x25'),_0x29d514[_0xb84e('0x11')]['toLowerCase'](),_0x29d514[_0xb84e('0x13')]));}}else{}}catch(_0x4a4d91){console['error'](_0x4a4d91);}}}}; \ No newline at end of file +var _0x9c05=['./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','log','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./servicenow'];(function(_0x3fcc4f,_0xa384ce){var _0x2f4b7c=function(_0x2bbf5f){while(--_0x2bbf5f){_0x3fcc4f['push'](_0x3fcc4f['shift']());}};_0x2f4b7c(++_0xa384ce);}(_0x9c05,0xdc));var _0x59c0=function(_0x51ff0f,_0x2da3d5){_0x51ff0f=_0x51ff0f-0x0;var _0x56aeb1=_0x9c05[_0x51ff0f];return _0x56aeb1;};'use strict';var _=require(_0x59c0('0x0'));var util=require(_0x59c0('0x1'));var zendesk=require(_0x59c0('0x2'));var salesforce=require(_0x59c0('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x59c0('0x4'));var zoho=require(_0x59c0('0x5'));var desk=require(_0x59c0('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x59c0('0x7'));var dynamics365=require(_0x59c0('0x8'));var freshsales=require(_0x59c0('0x9'));var integrations=[_0x59c0('0xa'),_0x59c0('0xb'),_0x59c0('0xc'),_0x59c0('0xd'),_0x59c0('0xe'),_0x59c0('0xf'),_0x59c0('0x10'),_0x59c0('0x11'),_0x59c0('0x12'),_0x59c0('0x13')];exports[_0x59c0('0x14')]=function(_0x12c56a,_0x2439d7,_0x4fdb4a,_0x29e925,_0x11319e,_0x5a5700){if(_0x4fdb4a){if(_['includes'](integrations,_0x12c56a['data1'][_0x59c0('0x15')]())){try{var _0x3c7b95=null;var _0x5564c7='';var _0x4504f9=_0x4fdb4a[_0x12c56a[_0x59c0('0x16')][_0x59c0('0x15')]()];if(_0x4504f9){var _0x5dc903=_0x4504f9[_0x12c56a[_0x59c0('0x17')]];if(_0x5dc903){var _0x846396=_[_0x59c0('0x18')](_0x5dc903[_0x59c0('0x19')],{'id':parseInt(_0x12c56a[_0x59c0('0x1a')],0xa)});if(_0x846396){if(_0x29e925){if(_0x11319e&&_0x2439d7[_0x59c0('0x1b')]){_0x5564c7='queue';}else if(_0x2439d7[_0x59c0('0x1c')]){_0x5564c7='outbound';}else{console['log'](_0x59c0('0x1d'),_0x2439d7);}}else{_0x5564c7=_0x59c0('0x1e');}switch(_0x12c56a[_0x59c0('0x16')]['toLowerCase']()){case _0x59c0('0xa'):zendesk[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0xb'):salesforce[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case'sugarcrm':sugarcrm[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0xd'):freshdesk[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0xe'):zoho[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0xf'):desk[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0x10'):vtiger[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case'freshsales':freshsales['cs'](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700,_0x5564c7);break;case _0x59c0('0x13'):servicenow['cs'](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700,_0x5564c7);break;case _0x59c0('0x11'):dynamics365['cs'](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700,_0x5564c7);break;default:console[_0x59c0('0x1f')]('unknown\x20integration');}}else{_0x3c7b95=require('../../../../config/logger')(_0x12c56a['data1']['toLowerCase']());_0x3c7b95[_0x59c0('0x20')](_0x59c0('0x21'),util[_0x59c0('0x22')](_0x59c0('0x23'),_0x12c56a[_0x59c0('0x16')]['toLowerCase'](),_0x12c56a[_0x59c0('0x1a')]));}}else{_0x3c7b95=require(_0x59c0('0x24'))(_0x12c56a['data1'][_0x59c0('0x15')]());_0x3c7b95[_0x59c0('0x20')](_0x59c0('0x21'),util['format'](_0x59c0('0x25'),_0x12c56a['data1']['toLowerCase'](),_0x12c56a[_0x59c0('0x17')]));}}else{}}catch(_0x510cdb){console[_0x59c0('0x20')](_0x510cdb);}}}}; \ 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 0f8a567..1d0bd6e 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 _0xfc62=['Descriptions','ticketType','utc','IsReminderSet','endUserType','contact','WhoId','WhatId','Case','ContactId','account','AccountId','lead','info','sobject','isNil','validateEmail','execute','then','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','find','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','Account','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','No\x20Company','format','upperFirst','create','forEach','string','picklist','type','idField','content','variable','variableName','toString','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','queue','integrationTab','user:%s','trigger:salesforce:display','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','newTab','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','getString'];(function(_0x374b41,_0x2434b4){var _0x394a22=function(_0x59fb3e){while(--_0x59fb3e){_0x374b41['push'](_0x374b41['shift']());}};_0x394a22(++_0x2434b4);}(_0xfc62,0xe8));var _0x2fc6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xfc62[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var rp=require(_0x2fc6('0x0'));var moment=require(_0x2fc6('0x1'));var BPromise=require(_0x2fc6('0x2'));var md5=require(_0x2fc6('0x3'));var jsforce=require(_0x2fc6('0x4'));var util=require(_0x2fc6('0x5'));var Redis=require('ioredis');var intUtil=require(_0x2fc6('0x6'));var config=require(_0x2fc6('0x7'));var logger=require(_0x2fc6('0x8'))(_0x2fc6('0x9'));config[_0x2fc6('0xa')]=_[_0x2fc6('0xb')](config[_0x2fc6('0xa')],{'host':_0x2fc6('0xc'),'port':0x18eb});var io=require(_0x2fc6('0xd'))(new Redis(config[_0x2fc6('0xa')]));function emit(_0xed7da9,_0x54930b,_0x18a943){io['to'](_0xed7da9)[_0x2fc6('0xe')](_0x54930b,_0x18a943);}function getTicket(_0x1f1c2e,_0x53cbf6,_0x3bc6b6,_0x44149a,_0x559513,_0x154b9d,_0x5911a9,_0x2c9198){var _0x32eb79=Object[_0x2fc6('0xf')]({},{'OwnerId':_0x53cbf6['id'],'Subject':intUtil['getString'](_0x44149a[_0x2fc6('0x10')],_0x559513,'\x20'),'Description':intUtil[_0x2fc6('0x11')](_0x44149a[_0x2fc6('0x12')],_0x559513,'\x0a')},getCustomFields(_0x154b9d,_0x559513));if(_0x3bc6b6){if(_0x44149a[_0x2fc6('0x13')]==='Task'){_0x32eb79['ActivityDate']=moment[_0x2fc6('0x14')]();_0x32eb79[_0x2fc6('0x15')]=![];_0x32eb79['IsRecurrence']=![];if(_0x3bc6b6[_0x2fc6('0x16')]===_0x2fc6('0x17')||_0x3bc6b6[_0x2fc6('0x16')]==='lead'){_0x32eb79[_0x2fc6('0x18')]=_0x3bc6b6['id'];}else if(_0x3bc6b6[_0x2fc6('0x16')]==='account'){_0x32eb79[_0x2fc6('0x19')]=_0x3bc6b6['id'];}}else if(_0x44149a[_0x2fc6('0x13')]===_0x2fc6('0x1a')){if(_0x3bc6b6[_0x2fc6('0x16')]===_0x2fc6('0x17')){_0x32eb79[_0x2fc6('0x1b')]=_0x3bc6b6['id'];}else if(_0x3bc6b6[_0x2fc6('0x16')]===_0x2fc6('0x1c')){_0x32eb79[_0x2fc6('0x1d')]=_0x3bc6b6['id'];}else if(_0x3bc6b6[_0x2fc6('0x16')]===_0x2fc6('0x1e')&&_0x44149a['leadId']){_0x32eb79[_0x44149a['leadId']]=_0x3bc6b6['id'];}else{logger[_0x2fc6('0x1f')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x5911a9[_0x2fc6('0x20')](_0x44149a['ticketType'])['create'](_0x32eb79);}function getUser(_0x5ecf9f,_0x4ce0ae,_0x5bed5e){if(!_[_0x2fc6('0x21')](_0x4ce0ae)&&intUtil[_0x2fc6('0x22')](_0x4ce0ae)){var _0x3728ee={'Email':_0x4ce0ae};var _0x365e5e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5bed5e[_0x2fc6('0x20')]('User')['find'](_0x3728ee,_0x365e5e)[_0x2fc6('0x23')]()[_0x2fc6('0x24')](function(_0x3b5e1d){if(_0x3b5e1d[_0x2fc6('0x25')]){var _0x111522=_['find'](_0x3b5e1d,function(_0x425a1a){return _0x425a1a[_0x2fc6('0x26')]===_0x4ce0ae;});if(_0x111522){logger[_0x2fc6('0x1f')]('Agent\x20%s\x20found.',_0x4ce0ae);return BPromise['resolve']({'id':_0x111522['Id'],'name':_0x111522[_0x2fc6('0x27')]});}}else{logger['info'](_0x2fc6('0x28'),_0x4ce0ae);return _0x5bed5e[_0x2fc6('0x29')]()[_0x2fc6('0x24')](function(_0x29d218){return BPromise['resolve']({'id':_0x29d218[_0x2fc6('0x2a')],'name':_0x29d218[_0x2fc6('0x2b')]});});}});}else{logger[_0x2fc6('0x1f')](_0x2fc6('0x28'),_0x4ce0ae);return _0x5bed5e[_0x2fc6('0x29')]()[_0x2fc6('0x24')](function(_0x589101){return BPromise['resolve']({'id':_0x589101[_0x2fc6('0x2a')],'name':_0x589101[_0x2fc6('0x2b')]});});}}function getEndUser(_0x56622d,_0x50dd40,_0x562631,_0x3854ee,_0x41111){var _0x4b1db5={'$or':{'Phone':_0x3854ee}};var _0x5b3e9a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2fc6('0x2c')]()['then'](function(){logger['info'](_0x2fc6('0x2d'),_0x3854ee,_0x50dd40[_0x2fc6('0x2e')]);switch(_0x50dd40['moduleSearch']){case _0x2fc6('0x2f'):var _0x302df6=_['cloneDeep'](_0x4b1db5);if(_0x50dd40['additionalSearchContact']){var _0x166b77={};_0x166b77[_0x50dd40[_0x2fc6('0x30')]]=_0x3854ee;_[_0x2fc6('0x31')](_0x302df6[_0x2fc6('0x32')],_0x166b77);}return _0x41111['sobject'](_0x2fc6('0x33'))[_0x2fc6('0x34')](_0x302df6,_0x5b3e9a)[_0x2fc6('0x23')]()[_0x2fc6('0x24')](function(_0x21c50f){if(_0x21c50f&&_0x21c50f[_0x2fc6('0x25')]){return _0x21c50f;}else{var _0x491fe3=_[_0x2fc6('0x35')](_0x4b1db5);if(_0x50dd40[_0x2fc6('0x36')]){var _0x4f6d43={};_0x4f6d43[_0x50dd40[_0x2fc6('0x36')]]=_0x3854ee;_['merge'](_0x491fe3[_0x2fc6('0x32')],_0x4f6d43);}return _0x41111[_0x2fc6('0x20')](_0x2fc6('0x37'))[_0x2fc6('0x34')](_0x491fe3,_0x5b3e9a);}});case'account_contact_lead':var _0x24df6d=_[_0x2fc6('0x35')](_0x4b1db5);if(_0x50dd40[_0x2fc6('0x38')]){var _0x166b77={};_0x166b77[_0x50dd40[_0x2fc6('0x38')]]=_0x3854ee;_[_0x2fc6('0x31')](_0x24df6d[_0x2fc6('0x32')],_0x166b77);}return _0x41111[_0x2fc6('0x20')](_0x2fc6('0x39'))['find'](_0x24df6d,_0x5b3e9a)[_0x2fc6('0x23')]()[_0x2fc6('0x24')](function(_0x578466){if(_0x578466&&_0x578466['length']){return _0x578466;}else{var _0x1dd032=_[_0x2fc6('0x35')](_0x4b1db5);if(_0x50dd40['additionalSearchContact']){var _0x2c3241={};_0x2c3241[_0x50dd40[_0x2fc6('0x30')]]=_0x3854ee;_[_0x2fc6('0x31')](_0x1dd032[_0x2fc6('0x32')],_0x2c3241);}return _0x41111[_0x2fc6('0x20')](_0x2fc6('0x33'))[_0x2fc6('0x34')](_0x1dd032,_0x5b3e9a)[_0x2fc6('0x24')](function(_0x22c938){if(_0x22c938&&_0x22c938[_0x2fc6('0x25')]){return _0x22c938;}else{var _0x2707c3=_[_0x2fc6('0x35')](_0x4b1db5);if(_0x50dd40['additionalSearchLead']){var _0x2539a9={};_0x2539a9[_0x50dd40['additionalSearchLead']]=_0x3854ee;_[_0x2fc6('0x31')](_0x2707c3['$or'],_0x2539a9);}return _0x41111[_0x2fc6('0x20')](_0x2fc6('0x37'))[_0x2fc6('0x34')](_0x2707c3,_0x5b3e9a);}});}});case _0x2fc6('0x17'):var _0x302df6=_[_0x2fc6('0x35')](_0x4b1db5);if(_0x50dd40[_0x2fc6('0x30')]){var _0x166b77={};_0x166b77[_0x50dd40[_0x2fc6('0x30')]]=_0x3854ee;_[_0x2fc6('0x31')](_0x302df6[_0x2fc6('0x32')],_0x166b77);}return _0x41111[_0x2fc6('0x20')]('Contact')[_0x2fc6('0x34')](_0x302df6,_0x5b3e9a)[_0x2fc6('0x23')]();case _0x2fc6('0x1e'):var _0x498ce8=_[_0x2fc6('0x35')](_0x4b1db5);if(_0x50dd40[_0x2fc6('0x36')]){var _0x166b77={};_0x166b77[_0x50dd40[_0x2fc6('0x36')]]=_0x3854ee;_['merge'](_0x498ce8[_0x2fc6('0x32')],_0x166b77);}return _0x41111[_0x2fc6('0x20')](_0x2fc6('0x37'))[_0x2fc6('0x34')](_0x498ce8,_0x5b3e9a);case _0x2fc6('0x1c'):var _0x24df6d=_['cloneDeep'](_0x4b1db5);if(_0x50dd40[_0x2fc6('0x38')]){var _0x166b77={};_0x166b77[_0x50dd40[_0x2fc6('0x38')]]=_0x3854ee;_[_0x2fc6('0x31')](_0x24df6d[_0x2fc6('0x32')],_0x166b77);}return _0x41111[_0x2fc6('0x20')](_0x2fc6('0x39'))['find'](_0x24df6d,_0x5b3e9a);default:return null;}})[_0x2fc6('0x24')](function(_0x1c50a4){if(_0x1c50a4&&_0x1c50a4[_0x2fc6('0x25')]){var _0xc2bf54=_['first'](_0x1c50a4);if(_0xc2bf54){return BPromise[_0x2fc6('0x2c')]({'id':_0xc2bf54['Id'],'name':_0xc2bf54[_0x2fc6('0x27')],'phone':_0xc2bf54[_0x2fc6('0x3a')],'endUserType':_0xc2bf54[_0x2fc6('0x3b')]['type'][_0x2fc6('0x3c')]()});}}})['then'](function(_0x58c2cf){if(_0x58c2cf){logger[_0x2fc6('0x1f')](_0x2fc6('0x3d'),_0x58c2cf['endUserType'],_0x3854ee);return BPromise['resolve'](_0x58c2cf);}else{logger['info'](_0x2fc6('0x3e'),_0x3854ee);var _0x145d6a={'Phone':_0x3854ee};if(_0x50dd40[_0x2fc6('0x3f')]){if(_0x50dd40[_0x2fc6('0x3f')]===_0x2fc6('0x17')){logger[_0x2fc6('0x1f')](_0x2fc6('0x40'),_0x3854ee,_0x50dd40[_0x2fc6('0x3f')]);_0x145d6a[_0x2fc6('0x41')]=_0x562631!==_0x2fc6('0x42')?_0x562631:util['format'](_0x2fc6('0x43'),_0x3854ee);}else if(_0x50dd40['moduleCreate']===_0x2fc6('0x1e')){logger['info'](_0x2fc6('0x40'),_0x3854ee,_0x50dd40[_0x2fc6('0x3f')]);_0x145d6a[_0x2fc6('0x41')]=_0x562631!==''?_0x562631:util['format']('Caller\x20-\x20%s',_0x3854ee);_0x145d6a[_0x2fc6('0x44')]=_0x2fc6('0x45');}else if(_0x50dd40[_0x2fc6('0x3f')]===_0x2fc6('0x1c')){logger['info'](_0x2fc6('0x40'),_0x3854ee,_0x50dd40[_0x2fc6('0x3f')]);_0x145d6a[_0x2fc6('0x27')]=_0x562631!==_0x2fc6('0x42')?_0x562631:util[_0x2fc6('0x46')](_0x2fc6('0x43'),_0x3854ee);}else{return null;}}return _0x41111[_0x2fc6('0x20')](_[_0x2fc6('0x47')](_0x50dd40['moduleCreate']))[_0x2fc6('0x48')](_0x145d6a)[_0x2fc6('0x24')](function(_0x450ea6){return BPromise[_0x2fc6('0x2c')]({'id':_0x450ea6['id'],'endUserType':_0x50dd40['moduleCreate']});});}});}function getCustomFields(_0x20c6cd,_0x3924af){var _0x1635d5={};if(_0x20c6cd[_0x2fc6('0x25')]>0x0){_[_0x2fc6('0x49')](_0x20c6cd,function(_0x21572c){if(_['includes']([_0x2fc6('0x4a'),_0x2fc6('0x4b')],_0x21572c[_0x2fc6('0x4c')])&&_0x21572c[_0x2fc6('0x4d')]){_0x1635d5[_0x21572c[_0x2fc6('0x4d')]]=_0x21572c[_0x2fc6('0x4e')]['toString']();}else if(_0x21572c[_0x2fc6('0x4c')]===_0x2fc6('0x4f')&&_0x21572c[_0x2fc6('0x50')]&&_0x21572c[_0x2fc6('0x4d')]){_0x3924af[_0x21572c['variableName']]&&(_0x1635d5[_0x21572c[_0x2fc6('0x4d')]]=_0x3924af[_0x21572c[_0x2fc6('0x50')]][_0x2fc6('0x51')]());}else if(_0x21572c[_0x2fc6('0x4c')]==='customVariable'&&_0x21572c[_0x2fc6('0x52')]&&_0x21572c[_0x2fc6('0x52')]['name']&&_0x21572c[_0x2fc6('0x4d')]){_0x3924af[_0x21572c['Variable'][_0x2fc6('0x53')][_0x2fc6('0x3c')]()]&&(_0x1635d5[_0x21572c[_0x2fc6('0x4d')]]=_0x3924af[_0x21572c['Variable']['name'][_0x2fc6('0x3c')]()][_0x2fc6('0x51')]());}});}return _0x1635d5;}function getConnection(_0xb39399){var _0x8ad446=_0xb39399[_0x2fc6('0x54')]['concat'](_0xb39399[_0x2fc6('0x55')]);var _0x1b55b8=new jsforce[(_0x2fc6('0x56'))]({'oauth2':{'loginUrl':_0xb39399[_0x2fc6('0x57')]||_0x2fc6('0x58'),'clientId':_0xb39399['clientId'],'clientSecret':_0xb39399[_0x2fc6('0x59')]}});return _0x1b55b8[_0x2fc6('0x5a')](_0xb39399[_0x2fc6('0x5b')],_0x8ad446)[_0x2fc6('0x24')](function(){logger[_0x2fc6('0x1f')]('Connection\x20established.');return _0x1b55b8;});}exports['queue']=function(_0xe7c936,_0x25ad4c,_0x2c7181,_0x296e0f,_0x34cf49,_0x5000ca){var _0x42c65d,_0x36c837,_0x2303d8,_0x997df2;_0x5000ca[_0x2fc6('0x5c')]=intUtil[_0x2fc6('0x5d')](_0x5000ca[_0x2fc6('0x5c')]);_0x5000ca['remoteUri']=intUtil['stripTrailingSlash'](_0x5000ca[_0x2fc6('0x57')]);if(_0x34cf49&&_0x34cf49[_0x2fc6('0x5e')]){logger[_0x2fc6('0x1f')](_0x2fc6('0x5f'),_0x2fc6('0x60'));_0x25ad4c[_0x2fc6('0x61')]=util[_0x2fc6('0x46')](_0x2fc6('0x62'),_0x5000ca['serverUrl'],_0x25ad4c[_0x2fc6('0x63')],md5(_0x25ad4c[_0x2fc6('0x63')]));}else{_0x25ad4c[_0x2fc6('0x61')]='';}return getConnection(_0x5000ca)[_0x2fc6('0x24')](function(_0x2d211f){_0x997df2=_0x2d211f;return getUser(_0x5000ca,_0x296e0f[_0x2fc6('0x64')],_0x997df2);})[_0x2fc6('0x24')](function(_0x322b1c){_0x42c65d=_0x322b1c;return getEndUser(_0x5000ca,_0x2c7181,_0x25ad4c['calleridname'],_0x25ad4c[_0x2fc6('0x65')],_0x997df2);})['then'](function(_0x380958){_0x36c837=_0x380958;return getTicket(_0x5000ca,_0x42c65d,_0x36c837,_0x2c7181,_0x25ad4c,_0x2c7181[_0x2fc6('0x66')],_0x997df2,_0x2fc6('0x67'));})[_0x2fc6('0x24')](function(_0x4074b7){_0x2303d8=_0x4074b7;logger[_0x2fc6('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x2303d8['id']);logger[_0x2fc6('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2303d8['id'],_0x296e0f[_0x2fc6('0x53')],_0x5000ca[_0x2fc6('0x4c')]);switch(_0x5000ca[_0x2fc6('0x4c')]){case _0x2fc6('0x68'):emit(util[_0x2fc6('0x46')](_0x2fc6('0x69'),_0x296e0f[_0x2fc6('0x53')]),_0x2fc6('0x6a'),{'recordId':_0x2303d8['id']});break;case'newTab':emit(util[_0x2fc6('0x46')](_0x2fc6('0x69'),_0x296e0f['name']),'trigger:browser:url',{'uri':util[_0x2fc6('0x46')]('%s/%s/e',_0x997df2[_0x2fc6('0x6b')],_0x2303d8['id'])});break;default:logger[_0x2fc6('0x6c')](_0x2fc6('0x6d'));}})[_0x2fc6('0x6e')](function(_0x1b9f3a){logger[_0x2fc6('0x6c')]('[QUEUE]',_0x1b9f3a);});};exports[_0x2fc6('0x6f')]=function(_0xae581,_0x465568,_0x3f70ad,_0x30e463,_0x550df1,_0x8ab784,_0x5df198){var _0x58ced5,_0x4b3366,_0x134d5a,_0x2590b3;_0x8ab784[_0x2fc6('0x5c')]=intUtil[_0x2fc6('0x5d')](_0x8ab784[_0x2fc6('0x5c')]);_0x8ab784[_0x2fc6('0x57')]=intUtil[_0x2fc6('0x5d')](_0x8ab784[_0x2fc6('0x57')]);if(_0x5df198&&_0x5df198[_0x2fc6('0x70')]&&_0x5df198[_0x2fc6('0x70')]!==_0x2fc6('0x71')){logger[_0x2fc6('0x1f')](_0x2fc6('0x72'),_0x2fc6('0x60'));_0x465568['recordingURL']=util[_0x2fc6('0x46')](_0x2fc6('0x62'),_0x8ab784[_0x2fc6('0x5c')],_0x465568[_0x2fc6('0x63')],md5(_0x465568[_0x2fc6('0x63')]));}return getConnection(_0x8ab784)[_0x2fc6('0x24')](function(_0x44cbda){_0x2590b3=_0x44cbda;return getUser(_0x8ab784,_0x30e463[_0x2fc6('0x64')],_0x2590b3);})[_0x2fc6('0x24')](function(_0x4db23a){_0x58ced5=_0x4db23a;return getEndUser(_0x8ab784,_0x3f70ad,_0x465568['destcalleridname'],_0x465568[_0x2fc6('0x73')],_0x2590b3);})[_0x2fc6('0x24')](function(_0x258c49){_0x4b3366=_0x258c49;return getTicket(_0x8ab784,_0x58ced5,_0x4b3366,_0x3f70ad,_0x465568,_0x3f70ad['Fields'],_0x2590b3,_0x2fc6('0x6f'));})[_0x2fc6('0x24')](function(_0x54cd83){_0x134d5a=_0x54cd83;logger[_0x2fc6('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x134d5a['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x134d5a['id'],_0x30e463[_0x2fc6('0x53')],_0x8ab784['type']);switch(_0x8ab784[_0x2fc6('0x4c')]){case'integrationTab':emit(util[_0x2fc6('0x46')](_0x2fc6('0x69'),_0x30e463[_0x2fc6('0x53')]),_0x2fc6('0x6a'),{'recordId':_0x134d5a['id']});break;case _0x2fc6('0x74'):emit(util[_0x2fc6('0x46')](_0x2fc6('0x69'),_0x30e463[_0x2fc6('0x53')]),_0x2fc6('0x75'),{'uri':util[_0x2fc6('0x46')](_0x2fc6('0x76'),_0x2590b3[_0x2fc6('0x6b')],_0x134d5a['id'])});break;default:logger['error'](_0x2fc6('0x72'),_0x2fc6('0x77'));}})[_0x2fc6('0x6e')](function(_0x4d456c){logger[_0x2fc6('0x6c')](_0x2fc6('0x72'),_0x4d456c);});};exports[_0x2fc6('0x78')]=function(_0x20b76d,_0x493863,_0x3c8445,_0x2b9541,_0x3f7ec1,_0x2540e0){var _0x5dc5bc,_0x5c06a3,_0x353455,_0x3e3464;_0x2540e0['serverUrl']=intUtil[_0x2fc6('0x5d')](_0x2540e0['serverUrl']);_0x2540e0['remoteUri']=intUtil[_0x2fc6('0x5d')](_0x2540e0[_0x2fc6('0x57')]);if(_0x3f7ec1&&_0x3f7ec1[_0x2fc6('0x5e')]){logger[_0x2fc6('0x1f')]('['+_0x493863[_0x2fc6('0x79')][_0x2fc6('0x7a')]()+']',_0x2fc6('0x60'));_0x493863[_0x2fc6('0x61')]=util['format'](_0x2fc6('0x62'),_0x2540e0['serverUrl'],_0x493863[_0x2fc6('0x63')],md5(_0x493863[_0x2fc6('0x63')]));}else{_0x493863[_0x2fc6('0x61')]='';}return getConnection(_0x2540e0)[_0x2fc6('0x24')](function(_0xf8c7e4){_0x3e3464=_0xf8c7e4;if(!_['isNil'](_0x2b9541)){return getUser(_0x2540e0,_0x2b9541[_0x2fc6('0x53')],_0x3e3464);}else{return getUser(_0x2540e0,null,_0x3e3464);}})[_0x2fc6('0x24')](function(_0x495000){_0x5dc5bc=_0x495000;return getEndUser(_0x2540e0,_0x3c8445,_0x493863['calleridname'],_0x493863[_0x2fc6('0x65')],_0x3e3464);})['then'](function(_0xfd8ac5){_0x5c06a3=_0xfd8ac5;return getTicket(_0x2540e0,_0x5dc5bc,_0x5c06a3,_0x3c8445,_0x493863,_0x3c8445[_0x2fc6('0x66')],_0x3e3464);})[_0x2fc6('0x24')](function(_0x5e4cc2){_0x353455=_0x5e4cc2;logger[_0x2fc6('0x1f')]('['+_0x493863[_0x2fc6('0x79')][_0x2fc6('0x7a')]()+_0x2fc6('0x7b'),_0x353455['id']);logger[_0x2fc6('0x1f')]('['+_0x493863[_0x2fc6('0x79')][_0x2fc6('0x7a')]()+_0x2fc6('0x7c'),_0x2540e0[_0x2fc6('0x4c')]);})[_0x2fc6('0x6e')](function(_0x466cd4){logger[_0x2fc6('0x6c')]('['+_0x493863['lastevent'][_0x2fc6('0x7a')]()+']',_0x466cd4);});}; \ No newline at end of file +var _0xb0fb=['attributes','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','format','Company','No\x20Company','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','name','Variable','password','securityToken','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','outbound','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','../../../../config/logger','redis','defaults','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','lead','WhoId','endUserType','WhatId','Case','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','execute','find','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','Contact','first','Phone'];(function(_0x1a376e,_0x284e92){var _0x479f58=function(_0x47707d){while(--_0x47707d){_0x1a376e['push'](_0x1a376e['shift']());}};_0x479f58(++_0x284e92);}(_0xb0fb,0xb8));var _0xbb0f=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xb0fb[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xbb0f('0x0'));var rp=require(_0xbb0f('0x1'));var moment=require('moment');var BPromise=require(_0xbb0f('0x2'));var md5=require(_0xbb0f('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xbb0f('0x4'))('salesforce');config[_0xbb0f('0x5')]=_[_0xbb0f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbb0f('0x7'))(new Redis(config[_0xbb0f('0x5')]));function emit(_0x591e1f,_0x4beafd,_0x1698f1){io['to'](_0x591e1f)['emit'](_0x4beafd,_0x1698f1);}function getTicket(_0x575b6f,_0x39ba35,_0x4cc55f,_0x38c567,_0x227e64,_0x21c4dc,_0x365a38,_0x5c58f1){var _0x11dfda=Object[_0xbb0f('0x8')]({},{'OwnerId':_0x39ba35['id'],'Subject':intUtil[_0xbb0f('0x9')](_0x38c567[_0xbb0f('0xa')],_0x227e64,'\x20'),'Description':intUtil[_0xbb0f('0x9')](_0x38c567[_0xbb0f('0xb')],_0x227e64,'\x0a')},getCustomFields(_0x21c4dc,_0x227e64));if(_0x4cc55f){if(_0x38c567[_0xbb0f('0xc')]===_0xbb0f('0xd')){_0x11dfda[_0xbb0f('0xe')]=moment[_0xbb0f('0xf')]();_0x11dfda['IsReminderSet']=![];_0x11dfda[_0xbb0f('0x10')]=![];if(_0x4cc55f['endUserType']==='contact'||_0x4cc55f['endUserType']===_0xbb0f('0x11')){_0x11dfda[_0xbb0f('0x12')]=_0x4cc55f['id'];}else if(_0x4cc55f[_0xbb0f('0x13')]==='account'){_0x11dfda[_0xbb0f('0x14')]=_0x4cc55f['id'];}}else if(_0x38c567[_0xbb0f('0xc')]===_0xbb0f('0x15')){if(_0x4cc55f[_0xbb0f('0x13')]==='contact'){_0x11dfda['ContactId']=_0x4cc55f['id'];}else if(_0x4cc55f[_0xbb0f('0x13')]===_0xbb0f('0x16')){_0x11dfda[_0xbb0f('0x17')]=_0x4cc55f['id'];}else if(_0x4cc55f[_0xbb0f('0x13')]==='lead'&&_0x38c567['leadId']){_0x11dfda[_0x38c567[_0xbb0f('0x18')]]=_0x4cc55f['id'];}else{logger[_0xbb0f('0x19')](_0xbb0f('0x1a'));}}}return _0x365a38[_0xbb0f('0x1b')](_0x38c567[_0xbb0f('0xc')])['create'](_0x11dfda);}function getUser(_0x30fbcd,_0x3bbae9,_0x156c4a){if(!_[_0xbb0f('0x1c')](_0x3bbae9)&&intUtil[_0xbb0f('0x1d')](_0x3bbae9)){var _0x16e260={'Email':_0x3bbae9};var _0x361dbb={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x156c4a['sobject']('User')['find'](_0x16e260,_0x361dbb)[_0xbb0f('0x1e')]()['then'](function(_0x5b47c5){if(_0x5b47c5['length']){var _0x3431b5=_[_0xbb0f('0x1f')](_0x5b47c5,function(_0x5b1764){return _0x5b1764['Email']===_0x3bbae9;});if(_0x3431b5){logger['info'](_0xbb0f('0x20'),_0x3bbae9);return BPromise[_0xbb0f('0x21')]({'id':_0x3431b5['Id'],'name':_0x3431b5[_0xbb0f('0x22')]});}}else{logger[_0xbb0f('0x19')](_0xbb0f('0x23'),_0x3bbae9);return _0x156c4a[_0xbb0f('0x24')]()[_0xbb0f('0x25')](function(_0x4634f3){return BPromise[_0xbb0f('0x21')]({'id':_0x4634f3[_0xbb0f('0x26')],'name':_0x4634f3[_0xbb0f('0x27')]});});}});}else{logger['info'](_0xbb0f('0x23'),_0x3bbae9);return _0x156c4a[_0xbb0f('0x24')]()[_0xbb0f('0x25')](function(_0x287de5){return BPromise['resolve']({'id':_0x287de5['user_id'],'name':_0x287de5[_0xbb0f('0x27')]});});}}function getEndUser(_0x26f6b7,_0x350a4d,_0x1b9f3e,_0x3cad20,_0x2aed6e){var _0x401bb5={'$or':{'Phone':_0x3cad20}};var _0x186910={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbb0f('0x21')]()[_0xbb0f('0x25')](function(){logger['info'](_0xbb0f('0x28'),_0x3cad20,_0x350a4d[_0xbb0f('0x29')]);switch(_0x350a4d[_0xbb0f('0x29')]){case _0xbb0f('0x2a'):var _0x260002=_[_0xbb0f('0x2b')](_0x401bb5);if(_0x350a4d[_0xbb0f('0x2c')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d[_0xbb0f('0x2c')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x260002[_0xbb0f('0x2e')],_0x2f79f1);}return _0x2aed6e['sobject']('Contact')[_0xbb0f('0x1f')](_0x260002,_0x186910)[_0xbb0f('0x1e')]()[_0xbb0f('0x25')](function(_0x583761){if(_0x583761&&_0x583761[_0xbb0f('0x2f')]){return _0x583761;}else{var _0x1c48e7=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x30')]){var _0x570f6d={};_0x570f6d[_0x350a4d['additionalSearchLead']]=_0x3cad20;_[_0xbb0f('0x2d')](_0x1c48e7['$or'],_0x570f6d);}return _0x2aed6e[_0xbb0f('0x1b')]('Lead')[_0xbb0f('0x1f')](_0x1c48e7,_0x186910);}});case _0xbb0f('0x31'):var _0x45257f=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x32')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d['additionalSearchAccount']]=_0x3cad20;_[_0xbb0f('0x2d')](_0x45257f['$or'],_0x2f79f1);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x33'))['find'](_0x45257f,_0x186910)[_0xbb0f('0x1e')]()['then'](function(_0x270dac){if(_0x270dac&&_0x270dac['length']){return _0x270dac;}else{var _0x4052bf=_[_0xbb0f('0x2b')](_0x401bb5);if(_0x350a4d[_0xbb0f('0x2c')]){var _0x4aafa2={};_0x4aafa2[_0x350a4d[_0xbb0f('0x2c')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x4052bf[_0xbb0f('0x2e')],_0x4aafa2);}return _0x2aed6e[_0xbb0f('0x1b')]('Contact')[_0xbb0f('0x1f')](_0x4052bf,_0x186910)[_0xbb0f('0x25')](function(_0x6825d2){if(_0x6825d2&&_0x6825d2[_0xbb0f('0x2f')]){return _0x6825d2;}else{var _0x399c85=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x30')]){var _0x363204={};_0x363204[_0x350a4d[_0xbb0f('0x30')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x399c85[_0xbb0f('0x2e')],_0x363204);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x34'))[_0xbb0f('0x1f')](_0x399c85,_0x186910);}});}});case'contact':var _0x260002=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x2c')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d[_0xbb0f('0x2c')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x260002[_0xbb0f('0x2e')],_0x2f79f1);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x35'))[_0xbb0f('0x1f')](_0x260002,_0x186910)[_0xbb0f('0x1e')]();case _0xbb0f('0x11'):var _0x5cddb5=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x30')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d[_0xbb0f('0x30')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x5cddb5['$or'],_0x2f79f1);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x34'))[_0xbb0f('0x1f')](_0x5cddb5,_0x186910);case _0xbb0f('0x16'):var _0x45257f=_[_0xbb0f('0x2b')](_0x401bb5);if(_0x350a4d[_0xbb0f('0x32')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d[_0xbb0f('0x32')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x45257f[_0xbb0f('0x2e')],_0x2f79f1);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x33'))[_0xbb0f('0x1f')](_0x45257f,_0x186910);default:return null;}})[_0xbb0f('0x25')](function(_0xb9d44b){if(_0xb9d44b&&_0xb9d44b[_0xbb0f('0x2f')]){var _0x14a8dd=_[_0xbb0f('0x36')](_0xb9d44b);if(_0x14a8dd){return BPromise[_0xbb0f('0x21')]({'id':_0x14a8dd['Id'],'name':_0x14a8dd[_0xbb0f('0x22')],'phone':_0x14a8dd[_0xbb0f('0x37')],'endUserType':_0x14a8dd[_0xbb0f('0x38')]['type'][_0xbb0f('0x39')]()});}}})[_0xbb0f('0x25')](function(_0x351698){if(_0x351698){logger[_0xbb0f('0x19')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x351698[_0xbb0f('0x13')],_0x3cad20);return BPromise['resolve'](_0x351698);}else{logger[_0xbb0f('0x19')](_0xbb0f('0x3a'),_0x3cad20);var _0x167e6f={'Phone':_0x3cad20};if(_0x350a4d[_0xbb0f('0x3b')]){if(_0x350a4d['moduleCreate']===_0xbb0f('0x3c')){logger['info'](_0xbb0f('0x3d'),_0x3cad20,_0x350a4d['moduleCreate']);_0x167e6f['LastName']=_0x1b9f3e!==_0xbb0f('0x3e')?_0x1b9f3e:util['format'](_0xbb0f('0x3f'),_0x3cad20);}else if(_0x350a4d[_0xbb0f('0x3b')]===_0xbb0f('0x11')){logger[_0xbb0f('0x19')](_0xbb0f('0x3d'),_0x3cad20,_0x350a4d[_0xbb0f('0x3b')]);_0x167e6f[_0xbb0f('0x40')]=_0x1b9f3e!==_0xbb0f('0x3e')?_0x1b9f3e:util[_0xbb0f('0x41')](_0xbb0f('0x3f'),_0x3cad20);_0x167e6f[_0xbb0f('0x42')]=_0xbb0f('0x43');}else if(_0x350a4d['moduleCreate']==='account'){logger[_0xbb0f('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3cad20,_0x350a4d['moduleCreate']);_0x167e6f[_0xbb0f('0x22')]=_0x1b9f3e!==_0xbb0f('0x3e')?_0x1b9f3e:util[_0xbb0f('0x41')](_0xbb0f('0x3f'),_0x3cad20);}else{return null;}}return _0x2aed6e[_0xbb0f('0x1b')](_['upperFirst'](_0x350a4d[_0xbb0f('0x3b')]))['create'](_0x167e6f)['then'](function(_0x54b5e9){return BPromise['resolve']({'id':_0x54b5e9['id'],'endUserType':_0x350a4d[_0xbb0f('0x3b')]});});}});}function getCustomFields(_0xe3fd7f,_0x406e39){var _0x1fa10c={};if(_0xe3fd7f[_0xbb0f('0x2f')]>0x0){_[_0xbb0f('0x44')](_0xe3fd7f,function(_0x4194f8){if(_[_0xbb0f('0x45')]([_0xbb0f('0x46'),'picklist'],_0x4194f8[_0xbb0f('0x47')])&&_0x4194f8[_0xbb0f('0x48')]){_0x1fa10c[_0x4194f8[_0xbb0f('0x48')]]=_0x4194f8[_0xbb0f('0x49')][_0xbb0f('0x4a')]();}else if(_0x4194f8[_0xbb0f('0x47')]===_0xbb0f('0x4b')&&_0x4194f8[_0xbb0f('0x4c')]&&_0x4194f8['idField']){_0x406e39[_0x4194f8[_0xbb0f('0x4c')]]&&(_0x1fa10c[_0x4194f8[_0xbb0f('0x48')]]=_0x406e39[_0x4194f8[_0xbb0f('0x4c')]][_0xbb0f('0x4a')]());}else if(_0x4194f8[_0xbb0f('0x47')]===_0xbb0f('0x4d')&&_0x4194f8['Variable']&&_0x4194f8['Variable']['name']&&_0x4194f8[_0xbb0f('0x48')]){_0x406e39[_0x4194f8['Variable'][_0xbb0f('0x4e')][_0xbb0f('0x39')]()]&&(_0x1fa10c[_0x4194f8[_0xbb0f('0x48')]]=_0x406e39[_0x4194f8[_0xbb0f('0x4f')]['name'][_0xbb0f('0x39')]()]['toString']());}});}return _0x1fa10c;}function getConnection(_0x1fb321){var _0x38699e=_0x1fb321[_0xbb0f('0x50')]['concat'](_0x1fb321[_0xbb0f('0x51')]);var _0x384494=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1fb321[_0xbb0f('0x52')]||_0xbb0f('0x53'),'clientId':_0x1fb321[_0xbb0f('0x54')],'clientSecret':_0x1fb321['clientSecret']}});return _0x384494[_0xbb0f('0x55')](_0x1fb321['username'],_0x38699e)[_0xbb0f('0x25')](function(){logger['info'](_0xbb0f('0x56'));return _0x384494;});}exports[_0xbb0f('0x57')]=function(_0x40537c,_0x44c9e3,_0x4f074c,_0x2c94d5,_0x1296bc,_0x2697fd){var _0x3a670e,_0x50c9f6,_0x55bb09,_0x10cbea;_0x2697fd[_0xbb0f('0x58')]=intUtil['stripTrailingSlash'](_0x2697fd['serverUrl']);_0x2697fd[_0xbb0f('0x52')]=intUtil['stripTrailingSlash'](_0x2697fd[_0xbb0f('0x52')]);if(_0x1296bc&&_0x1296bc[_0xbb0f('0x59')]){logger[_0xbb0f('0x19')](_0xbb0f('0x5a'),_0xbb0f('0x5b'));_0x44c9e3[_0xbb0f('0x5c')]=util['format'](_0xbb0f('0x5d'),_0x2697fd[_0xbb0f('0x58')],_0x44c9e3[_0xbb0f('0x5e')],md5(_0x44c9e3[_0xbb0f('0x5e')]));}else{_0x44c9e3[_0xbb0f('0x5c')]='';}return getConnection(_0x2697fd)[_0xbb0f('0x25')](function(_0x5def8f){_0x10cbea=_0x5def8f;return getUser(_0x2697fd,_0x2c94d5[_0xbb0f('0x5f')],_0x10cbea);})[_0xbb0f('0x25')](function(_0x1bdd55){_0x3a670e=_0x1bdd55;return getEndUser(_0x2697fd,_0x4f074c,_0x44c9e3[_0xbb0f('0x60')],_0x44c9e3[_0xbb0f('0x61')],_0x10cbea);})[_0xbb0f('0x25')](function(_0x89dc35){_0x50c9f6=_0x89dc35;return getTicket(_0x2697fd,_0x3a670e,_0x50c9f6,_0x4f074c,_0x44c9e3,_0x4f074c[_0xbb0f('0x62')],_0x10cbea,_0xbb0f('0x57'));})[_0xbb0f('0x25')](function(_0x2d0a49){_0x55bb09=_0x2d0a49;logger[_0xbb0f('0x19')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x55bb09['id']);logger[_0xbb0f('0x19')](_0xbb0f('0x63'),_0x55bb09['id'],_0x2c94d5[_0xbb0f('0x4e')],_0x2697fd['type']);switch(_0x2697fd['type']){case'integrationTab':emit(util[_0xbb0f('0x41')](_0xbb0f('0x64'),_0x2c94d5['name']),_0xbb0f('0x65'),{'recordId':_0x55bb09['id']});break;case _0xbb0f('0x66'):emit(util[_0xbb0f('0x41')](_0xbb0f('0x64'),_0x2c94d5[_0xbb0f('0x4e')]),_0xbb0f('0x67'),{'uri':util['format'](_0xbb0f('0x68'),_0x10cbea[_0xbb0f('0x69')],_0x55bb09['id'])});break;default:logger[_0xbb0f('0x6a')](_0xbb0f('0x6b'));}})[_0xbb0f('0x6c')](function(_0x2d9a4c){logger[_0xbb0f('0x6a')](_0xbb0f('0x5a'),_0x2d9a4c);});};exports['outbound']=function(_0x5c6901,_0x5d3ecd,_0x1ee51b,_0x186565,_0x17e8b6,_0x270c9e,_0x18c368){var _0x1ca2bd,_0x57e749,_0x2ae072,_0x372ff1;_0x270c9e[_0xbb0f('0x58')]=intUtil[_0xbb0f('0x6d')](_0x270c9e[_0xbb0f('0x58')]);_0x270c9e[_0xbb0f('0x52')]=intUtil[_0xbb0f('0x6d')](_0x270c9e['remoteUri']);if(_0x18c368&&_0x18c368[_0xbb0f('0x6e')]&&_0x18c368[_0xbb0f('0x6e')]!==_0xbb0f('0x6f')){logger['info'](_0xbb0f('0x70'),_0xbb0f('0x5b'));_0x5d3ecd[_0xbb0f('0x5c')]=util[_0xbb0f('0x41')](_0xbb0f('0x5d'),_0x270c9e['serverUrl'],_0x5d3ecd[_0xbb0f('0x5e')],md5(_0x5d3ecd[_0xbb0f('0x5e')]));}return getConnection(_0x270c9e)['then'](function(_0x38b473){_0x372ff1=_0x38b473;return getUser(_0x270c9e,_0x186565['email'],_0x372ff1);})[_0xbb0f('0x25')](function(_0x403ed8){_0x1ca2bd=_0x403ed8;return getEndUser(_0x270c9e,_0x1ee51b,_0x5d3ecd[_0xbb0f('0x71')],_0x5d3ecd['destcalleridnum'],_0x372ff1);})[_0xbb0f('0x25')](function(_0x1ce5da){_0x57e749=_0x1ce5da;return getTicket(_0x270c9e,_0x1ca2bd,_0x57e749,_0x1ee51b,_0x5d3ecd,_0x1ee51b[_0xbb0f('0x62')],_0x372ff1,_0xbb0f('0x72'));})[_0xbb0f('0x25')](function(_0x55bec0){_0x2ae072=_0x55bec0;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2ae072['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2ae072['id'],_0x186565[_0xbb0f('0x4e')],_0x270c9e['type']);switch(_0x270c9e[_0xbb0f('0x47')]){case _0xbb0f('0x73'):emit(util[_0xbb0f('0x41')](_0xbb0f('0x64'),_0x186565[_0xbb0f('0x4e')]),_0xbb0f('0x65'),{'recordId':_0x2ae072['id']});break;case _0xbb0f('0x66'):emit(util[_0xbb0f('0x41')](_0xbb0f('0x64'),_0x186565[_0xbb0f('0x4e')]),_0xbb0f('0x67'),{'uri':util[_0xbb0f('0x41')]('%s/%s/e',_0x372ff1[_0xbb0f('0x69')],_0x2ae072['id'])});break;default:logger[_0xbb0f('0x6a')](_0xbb0f('0x70'),_0xbb0f('0x74'));}})['catch'](function(_0x431a50){logger[_0xbb0f('0x6a')](_0xbb0f('0x70'),_0x431a50);});};exports['unmanaged']=function(_0x1008a8,_0x2f77fc,_0x5e7eb8,_0x2afd45,_0x1a9bad,_0x19db11){var _0xffd0ab,_0x39d0d5,_0x1f7769,_0xdd3ed1;_0x19db11[_0xbb0f('0x58')]=intUtil[_0xbb0f('0x6d')](_0x19db11[_0xbb0f('0x58')]);_0x19db11[_0xbb0f('0x52')]=intUtil[_0xbb0f('0x6d')](_0x19db11['remoteUri']);if(_0x1a9bad&&_0x1a9bad[_0xbb0f('0x59')]){logger[_0xbb0f('0x19')]('['+_0x2f77fc['lastevent']['toUpperCase']()+']',_0xbb0f('0x5b'));_0x2f77fc['recordingURL']=util['format'](_0xbb0f('0x5d'),_0x19db11[_0xbb0f('0x58')],_0x2f77fc[_0xbb0f('0x5e')],md5(_0x2f77fc[_0xbb0f('0x5e')]));}else{_0x2f77fc[_0xbb0f('0x5c')]='';}return getConnection(_0x19db11)[_0xbb0f('0x25')](function(_0x8b3d43){_0xdd3ed1=_0x8b3d43;if(!_[_0xbb0f('0x1c')](_0x2afd45)){return getUser(_0x19db11,_0x2afd45[_0xbb0f('0x4e')],_0xdd3ed1);}else{return getUser(_0x19db11,null,_0xdd3ed1);}})[_0xbb0f('0x25')](function(_0x8860fd){_0xffd0ab=_0x8860fd;return getEndUser(_0x19db11,_0x5e7eb8,_0x2f77fc[_0xbb0f('0x60')],_0x2f77fc[_0xbb0f('0x61')],_0xdd3ed1);})[_0xbb0f('0x25')](function(_0x2f7e5d){_0x39d0d5=_0x2f7e5d;return getTicket(_0x19db11,_0xffd0ab,_0x39d0d5,_0x5e7eb8,_0x2f77fc,_0x5e7eb8[_0xbb0f('0x62')],_0xdd3ed1);})['then'](function(_0x47cd98){_0x1f7769=_0x47cd98;logger[_0xbb0f('0x19')]('['+_0x2f77fc[_0xbb0f('0x75')][_0xbb0f('0x76')]()+']\x20Ticket\x20%s\x20created.',_0x1f7769['id']);logger[_0xbb0f('0x19')]('['+_0x2f77fc[_0xbb0f('0x75')]['toUpperCase']()+_0xbb0f('0x77'),_0x19db11[_0xbb0f('0x47')]);})[_0xbb0f('0x6c')](function(_0x1360d5){logger[_0xbb0f('0x6a')]('['+_0x2f77fc[_0xbb0f('0x75')][_0xbb0f('0x76')]()+']',_0x1360d5);});}; \ 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 5fa3926..9f2e072 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 _0x72ea=['Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','md5','ioredis','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','catch',']\x20using\x20admin\x20profile','POST','endUserNumber','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','includes','string','type','nameField','toLowerCase','content','picklist','idField','toString','variable','customField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','ticketNumber','label','label_entry','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label'];(function(_0xc0e19a,_0x51dd6c){var _0x53b3d1=function(_0x535b3f){while(--_0x535b3f){_0xc0e19a['push'](_0xc0e19a['shift']());}};_0x53b3d1(++_0x51dd6c);}(_0x72ea,0x152));var _0xa72e=function(_0x59d463,_0x15a828){_0x59d463=_0x59d463-0x0;var _0x30edc2=_0x72ea[_0x59d463];return _0x30edc2;};'use strict';var _=require(_0xa72e('0x0'));var Promise=require('bluebird');var rp=require(_0xa72e('0x1'));var util=require(_0xa72e('0x2'));var md5=require(_0xa72e('0x3'));var Redis=require(_0xa72e('0x4'));var intUtil=require('./util');var config=require(_0xa72e('0x5'));var logger=require('../../../../config/logger')(_0xa72e('0x6'));config[_0xa72e('0x7')]=_[_0xa72e('0x8')](config['redis'],{'host':_0xa72e('0x9'),'port':0x18eb});var io=require(_0xa72e('0xa'))(new Redis(config['redis']));function getAdminUser(_0x4155e9,_0x5002fd,_0x2b79f3,_0x153991,_0x32185f,_0x52fb8e){return new Promise(function(_0x47bdf2,_0x9828ea){var _0x45cf41={'method':_0xa72e('0xb'),'uri':_0x153991+_0xa72e('0xc')+'&'+_0x32185f+'&'+_0x52fb8e,'auth':_0x5002fd,'json':!![]};return rp(_0x45cf41)[_0xa72e('0xd')](function(_0x5a5656){if(_0x5a5656[_0xa72e('0xe')][_0xa72e('0xf')]>0x0){_0x2b79f3[_0xa72e('0x10')]=_0x5a5656[_0xa72e('0xe')][0x0][_0xa72e('0x11')];}logger[_0xa72e('0x12')]('['+[_0x4155e9[_0xa72e('0x13')]()]+_0xa72e('0x14'),_0x2b79f3);_0x47bdf2(_0x2b79f3);})['catch'](function(_0x1845a5){logger[_0xa72e('0x15')]('['+[_0x4155e9[_0xa72e('0x13')]()]+']',_0x1845a5['message']);_0x9828ea(_0x1845a5[_0xa72e('0x16')]);});});}function getUser(_0x360394,_0x4c38a2,_0x51f7fc,_0x4bf0c1,_0x5027b7){return function(_0x2a5ec){logger[_0xa72e('0x12')]('['+[_0x360394[_0xa72e('0x13')]()]+_0xa72e('0x17'),_0x2a5ec);return new Promise(function(_0x1b4a62,_0x52f84d){if(intUtil[_0xa72e('0x18')](_0x2a5ec[_0xa72e('0x19')])){var _0x2436bb={'method':_0xa72e('0xb'),'uri':_0x51f7fc+_0xa72e('0x1a')+_0x2a5ec['userEmail']+'&'+_0x4bf0c1+'&'+_0x5027b7,'auth':_0x4c38a2,'json':!![]};logger[_0xa72e('0x12')]('['+[_0x360394['toUpperCase']()]+_0xa72e('0x1b'),_0x2436bb);return rp(_0x2436bb)[_0xa72e('0xd')](function(_0x44fa4b){logger[_0xa72e('0x12')]('['+[_0x360394[_0xa72e('0x13')]()]+_0xa72e('0x1c'),_0x44fa4b);if(_0x44fa4b[_0xa72e('0xe')]['length']>0x0&&String(_0x44fa4b[_0xa72e('0xe')][0x0]['active'])===_0xa72e('0x1d')){_0x2a5ec[_0xa72e('0x1e')]=_0x44fa4b['result'][0x0]['sys_id'];}else{_0x2a5ec[_0xa72e('0x1e')]=_0x2a5ec['adminId'];_0x2a5ec[_0xa72e('0x19')]=_0x2a5ec[_0xa72e('0x1f')];}logger[_0xa72e('0x12')]('['+[_0x360394[_0xa72e('0x13')]()]+'],\x20getUser\x20crm',_0x2a5ec);_0x1b4a62(_0x2a5ec);})[_0xa72e('0x20')](function(_0x216684){logger['error']('['+[_0x360394[_0xa72e('0x13')]()]+']',_0x216684[_0xa72e('0x16')]);_0x52f84d(_0x216684[_0xa72e('0x16')]);});}else{logger['info']('['+[_0x360394[_0xa72e('0x13')]()]+_0xa72e('0x21'));_0x2a5ec['userId']=_0x2a5ec[_0xa72e('0x10')];_0x2a5ec[_0xa72e('0x19')]=_0x2a5ec[_0xa72e('0x1f')];_0x1b4a62(_0x2a5ec);}});};}function createEndUser(_0x4f2b26,_0x3cd6e6,_0x2adf4b,_0x2cb845,_0x377e20){logger[_0xa72e('0x12')]('['+[_0x4f2b26[_0xa72e('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x2adf4b);return new Promise(function(_0x4d6c8d,_0x234968){var _0x24a44f={'method':_0xa72e('0x22'),'uri':_0x2cb845+'sys_user?'+_0x377e20,'body':{'user_name':_0x2adf4b[_0xa72e('0x23')],'roles':'user','first_name':_0x2adf4b[_0xa72e('0x23')],'active':_0xa72e('0x1d'),'date_format':'System','phone':_0x2adf4b[_0xa72e('0x23')]},'auth':_0x3cd6e6,'json':!![]};return rp(_0x24a44f)['then'](function(_0x167c3d){logger[_0xa72e('0x12')]('['+[_0x4f2b26[_0xa72e('0x13')]()]+'],\x20EndUser\x20schema',_0x167c3d[_0xa72e('0xe')]);_0x2adf4b['endUserId']=_0x167c3d[_0xa72e('0xe')][_0xa72e('0x11')];_0x4d6c8d(_0x2adf4b);})['catch'](function(_0x57fd11){logger[_0xa72e('0x15')]('['+[_0x4f2b26[_0xa72e('0x13')]()]+']',_0x57fd11[_0xa72e('0x16')]);_0x234968(_0x57fd11[_0xa72e('0x16')]);});});}function getEndUser(_0x20a0f2,_0x260582,_0x150beb,_0x17162f,_0x110534){return function(_0x2f6359){logger[_0xa72e('0x12')]('['+[_0x20a0f2[_0xa72e('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x2f6359);return new Promise(function(_0x1e1ec2,_0xd6c451){var _0x5f1f4e={'method':_0xa72e('0xb'),'uri':_0x150beb+_0xa72e('0x24')+_0x2f6359[_0xa72e('0x23')]+'&'+_0x17162f+'&'+_0x110534,'auth':_0x260582,'json':!![]};return rp(_0x5f1f4e)['then'](function(_0x3f39d4){if(_0x3f39d4[_0xa72e('0xe')][_0xa72e('0xf')]>0x0){_0x2f6359[_0xa72e('0x25')]=_0x3f39d4[_0xa72e('0xe')][0x0]['sys_id'];logger[_0xa72e('0x12')]('['+[_0x20a0f2['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x2f6359);_0x1e1ec2(_0x2f6359);}else{return createEndUser(_0x20a0f2,_0x260582,_0x2f6359,_0x150beb,_0x17162f)[_0xa72e('0xd')](function(_0x5253f0){logger[_0xa72e('0x12')]('['+[_0x20a0f2['toUpperCase']()]+_0xa72e('0x26'),_0x5253f0);_0x1e1ec2(_0x5253f0);});}})[_0xa72e('0x20')](function(_0x8cc8a1){logger[_0xa72e('0x15')]('['+[_0x20a0f2[_0xa72e('0x13')]()]+']',_0x8cc8a1[_0xa72e('0x16')]);_0xd6c451(_0x8cc8a1[_0xa72e('0x16')]);});});};}function getCustomFields(_0x49f94b,_0x98ec28){var _0x39e259={};if(_0x49f94b['length']>0x0){_['forEach'](_0x49f94b,function(_0xa815f0){if(_[_0xa72e('0x27')]([_0xa72e('0x28'),'picklist'],_0xa815f0[_0xa72e('0x29')])&&_0xa815f0[_0xa72e('0x2a')]&&!_0xa815f0['customField']){_0x39e259[_0xa815f0[_0xa72e('0x2a')][_0xa72e('0x2b')]()]=_0xa815f0[_0xa72e('0x2c')]['toString']();}else if(_[_0xa72e('0x27')]([_0xa72e('0x28'),_0xa72e('0x2d')],_0xa815f0[_0xa72e('0x29')])&&_0xa815f0[_0xa72e('0x2e')]&&_0xa815f0['customField']){_0x39e259[_0xa815f0['idField']['toLowerCase']()]=_0xa815f0['content'][_0xa72e('0x2f')]();}else if(_0xa815f0['type']===_0xa72e('0x30')&&_0xa815f0['variableName']&&_0xa815f0[_0xa72e('0x2e')]&&_0xa815f0[_0xa72e('0x31')]){_0x39e259[_0xa815f0[_0xa72e('0x2e')][_0xa72e('0x2b')]()]=_0x98ec28[_0xa815f0[_0xa72e('0x32')]][_0xa72e('0x2f')]();}else if(_0xa815f0[_0xa72e('0x29')]===_0xa72e('0x33')&&_0xa815f0['Variable']&&_0xa815f0[_0xa72e('0x34')][_0xa72e('0x35')]&&_0xa815f0[_0xa72e('0x2e')]&&_0xa815f0[_0xa72e('0x31')]){_0x39e259[_0xa815f0[_0xa72e('0x2e')][_0xa72e('0x2b')]()]=_0x98ec28[_0xa815f0[_0xa72e('0x34')][_0xa72e('0x35')][_0xa72e('0x2b')]()]['toString']();}});}return _0x39e259;}function getTicket(_0x3986fe,_0x5c69ff,_0x5ce253,_0x4fde0e,_0x130ad3,_0x3ca056){return function(_0x4ba2b1){logger[_0xa72e('0x12')]('['+[_0x3986fe[_0xa72e('0x13')]()]+_0xa72e('0x36'),_0x4ba2b1);return new Promise(function(_0x18a981,_0x442df4){var _0x559fc1=_0x3986fe[_0xa72e('0x2b')]()==='outbound'?_0x4ba2b1[_0xa72e('0x1e')]:_0x4ba2b1[_0xa72e('0x25')];var _0x415a8c={'method':_0xa72e('0x22'),'uri':_0x5ce253+_0xa72e('0x37')+'?'+_0x3ca056,'body':Object[_0xa72e('0x38')]({},{'active':'true','caller_id':_0x559fc1,'assigned_to':_0x4ba2b1['userId'],'short_description':intUtil[_0xa72e('0x39')](_0x4fde0e[_0xa72e('0x3a')],_0x130ad3,'\x20'),'description':intUtil['getString'](_0x4fde0e['Descriptions'],_0x130ad3,'\x0a')},getCustomFields(_0x4fde0e['Fields'],_0x130ad3)),'auth':_0x5c69ff,'json':!![]};return rp(_0x415a8c)['then'](function(_0x239c38){logger[_0xa72e('0x12')]('['+[_0x3986fe[_0xa72e('0x13')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x239c38['result']);_0x4ba2b1['ticketId']=_0x239c38[_0xa72e('0xe')][_0xa72e('0x11')];_0x4ba2b1[_0xa72e('0x3b')]=_0x239c38[_0xa72e('0xe')]['number'];logger[_0xa72e('0x12')]('['+[_0x3986fe[_0xa72e('0x13')]()]+']\x20getTicket\x20crm',_0x4ba2b1);_0x18a981(_0x4ba2b1);})[_0xa72e('0x20')](function(_0x2cc1c6){logger[_0xa72e('0x15')]('['+[_0x3986fe['toUpperCase']()]+']',_0x2cc1c6['message']);_0x442df4(_0x2cc1c6[_0xa72e('0x16')]);});});};}function createRemoteTag(_0x3508b0,_0x156af4,_0x3bc48e,_0x2ae912){return new Promise(function(_0x163102,_0x385615){var _0x54f853={'method':_0xa72e('0x22'),'uri':_0x3bc48e+_0xa72e('0x3c')+'?'+_0x2ae912,'body':{'short_description':_0x3508b0,'global':!![],'active':!![],'name':_0x3508b0},'auth':_0x156af4,'json':!![]};return rp(_0x54f853)['then'](function(_0x38cdf0){var _0x3ad90b=_0x38cdf0['result'][_0xa72e('0x11')];_0x163102(_0x3ad90b);});});}function getRemoteTag(_0x3a315d,_0x45c4b3,_0x154a91,_0x5393c9,_0x3aaff5){return new Promise(function(_0xadf79e,_0x1423c7){var _0x497d75={'method':_0xa72e('0xb'),'uri':_0x154a91+'label'+'?sysparm_query=name%3D'+_0x3a315d+'&'+_0x5393c9,'auth':_0x45c4b3,'json':!![]};return rp(_0x497d75)[_0xa72e('0xd')](function(_0xa0f35){if(_0xa0f35['result'][_0xa72e('0xf')]>0x0){var _0x5d9776=_0xa0f35['result'][0x0][_0xa72e('0x11')];_0xadf79e(_0x5d9776);}else{return createRemoteTag(_0x3a315d,_0x45c4b3,_0x154a91,_0x5393c9)[_0xa72e('0xd')](function(_0xb947ab){_0xadf79e(_0xb947ab);});}});});}function assignTagToIncident(_0x107eda,_0x506286,_0x93c3e,_0x10f636,_0x3e7a93){return new Promise(function(_0x5dd523,_0x32ba30){var _0x213960={'method':'POST','uri':_0x93c3e+_0xa72e('0x3d')+'?'+_0x3e7a93,'body':{'label':_0x107eda,'table':_0xa72e('0x37'),'id_type':'Incident','table_key':_0x10f636['ticketId'],'title':'Incident\x20-\x20'+_0x10f636['ticketNumber'],'id_display':_0x10f636[_0xa72e('0x3b')]},'auth':_0x506286,'json':!![]};return rp(_0x213960)[_0xa72e('0xd')](function(_0x97e919){_0x5dd523();})['catch'](function(){_0x5dd523();});});}function manageTags(_0x26294b,_0x21b19e,_0x17fca3,_0xa707ec,_0x3d0abc,_0x2f9b0c,_0x4e5e93){return new Promise(function(_0x3355fc,_0x4622d0){var _0x5a2afa=[];_0x21b19e[_0xa72e('0x3e')](function(_0x4f8af0){_0x5a2afa[_0xa72e('0x3f')](getRemoteTag(_0x4f8af0,_0x17fca3,_0xa707ec,_0x2f9b0c,_0x4e5e93));});return Promise[_0xa72e('0x40')](_0x5a2afa)[_0xa72e('0xd')](function(_0x2bf6f3){if(_0x2bf6f3[_0xa72e('0xf')]){logger[_0xa72e('0x12')]('['+[_0x26294b[_0xa72e('0x13')]()]+_0xa72e('0x41'),_0x2bf6f3);var _0x1f4d85=[];_0x2bf6f3['forEach'](function(_0x35d2c0){_0x1f4d85[_0xa72e('0x3f')](assignTagToIncident(_0x35d2c0,_0x17fca3,_0xa707ec,_0x3d0abc,_0x2f9b0c));});return Promise[_0xa72e('0x40')](_0x1f4d85)['then'](function(){_0x3355fc();})[_0xa72e('0x20')](function(){_0x3355fc();});}else{_0x3355fc();}});});}function getTags(_0x10d617,_0x381746,_0x1e068e,_0x49eff9,_0x7265cd,_0x407212){return function(_0x5e4f50){return new Promise(function(_0xa3cf8f,_0x592f5a){var _0x453521=[];var _0x47bff7=_0x49eff9[_0xa72e('0x42')];if(_0x47bff7&&_0x47bff7[_0xa72e('0xf')]>0x0){_0x453521=_[_0xa72e('0x43')](_0x47bff7,_0xa72e('0x35'));}if(_0x453521[_0xa72e('0xf')]>0x0){return manageTags(_0x10d617,_0x453521,_0x381746,_0x1e068e,_0x5e4f50,_0x7265cd,_0x407212)[_0xa72e('0xd')](function(){_0xa3cf8f(_0x5e4f50);});}else{_0xa3cf8f(_0x5e4f50);}});};}function emit(_0x5a08b2,_0x3c8ceb,_0x2917bd){var _0x556ab7=_0xa72e('0x44')+_0xa72e('0x45')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xa72e('0x46');var _0x2afc0e={'uri':_0x5a08b2+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2917bd+_0x556ab7};io['to'](util[_0xa72e('0x47')](_0xa72e('0x48'),_0x3c8ceb))[_0xa72e('0x49')]('trigger:browser:url',_0x2afc0e);}exports['cs']=function(_0x4c5b6d,_0x2b1218,_0x58c81d,_0x181b7e,_0x26ebaf,_0x31b112,_0x4f6f0b,_0x25b714){var _0x412424={};var _0x1d4d18={'user':_0x31b112[_0xa72e('0x4a')],'pass':_0x31b112[_0xa72e('0x4b')]};var _0x31a391=_0xa72e('0x4c');var _0xfc9ee3=_0xa72e('0x4d');_0x31b112['remoteUri']=intUtil[_0xa72e('0x4e')](_0x31b112[_0xa72e('0x4f')]);_0x31b112[_0xa72e('0x50')]=intUtil[_0xa72e('0x4e')](_0x31b112[_0xa72e('0x50')]);var _0x36b77a=util[_0xa72e('0x47')](_0xa72e('0x51'),_0x31b112[_0xa72e('0x4f')]);_0x412424['userEmail']=!_[_0xa72e('0x52')](_0x181b7e)?_0x181b7e[_0xa72e('0x53')]:null;_0x412424['adminEmail']=_0x31b112[_0xa72e('0x53')];_0x412424[_0xa72e('0x23')]=_0x25b714[_0xa72e('0x2b')]()===_0xa72e('0x54')?_0x2b1218[_0xa72e('0x55')]:_0x2b1218[_0xa72e('0x56')];_0x412424['callDirection']=_0x25b714===_0xa72e('0x57')||_0x25b714===_0xa72e('0x58')?_0xa72e('0x57'):_0xa72e('0x54');var _0x1e395d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31b112[_0xa72e('0x50')],_0x2b1218[_0xa72e('0x59')],md5(_0x2b1218['uniqueid']));if(_0x26ebaf&&_0x26ebaf['monitor_format']){logger[_0xa72e('0x12')](_0xa72e('0x5a'),_0xa72e('0x5b'));_0x2b1218[_0xa72e('0x5c')]=_0x1e395d;}else if(_0x4f6f0b&&_0x4f6f0b[_0xa72e('0x5d')]&&_0x4f6f0b[_0xa72e('0x5d')]!==_0xa72e('0x5e')){logger[_0xa72e('0x12')](_0xa72e('0x5f'),_0xa72e('0x5b'));_0x2b1218[_0xa72e('0x5c')]=_0x1e395d;}else{_0x2b1218[_0xa72e('0x5c')]='';}return getAdminUser(_0x25b714,_0x1d4d18,_0x412424,_0x36b77a,_0xfc9ee3,_0x31a391)[_0xa72e('0xd')](getUser(_0x25b714,_0x1d4d18,_0x36b77a,_0xfc9ee3,_0x31a391))[_0xa72e('0xd')](getEndUser(_0x25b714,_0x1d4d18,_0x36b77a,_0xfc9ee3,_0x31a391))['then'](getTicket(_0x25b714,_0x1d4d18,_0x36b77a,_0x58c81d,_0x2b1218,_0xfc9ee3))[_0xa72e('0xd')](function(_0x1dca6b){logger[_0xa72e('0x12')](util['format'](_0xa72e('0x60'),_0x1dca6b[_0xa72e('0x61')]));logger[_0xa72e('0x12')](util['format'](_0xa72e('0x62'),_0x25b714));if(_0x25b714!=='unmanaged'){logger['info']('['+[_0x25b714['toUpperCase']()]+']',_0xa72e('0x63'));emit(_0x31b112[_0xa72e('0x4f')],_0x181b7e[_0xa72e('0x35')],_0x1dca6b[_0xa72e('0x61')]);}})[_0xa72e('0x20')](function(_0x282462){logger[_0xa72e('0x15')]('['+[_0x25b714['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xa72e('0x64')](_0x282462,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0f90=['label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','outbound','calleridnum','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','sys_id','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','endUserId','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0f90,0xfc));var _0x00f9=function(_0x7966b2,_0xc46ea3){_0x7966b2=_0x7966b2-0x0;var _0x24bec4=_0x0f90[_0x7966b2];return _0x24bec4;};'use strict';var _=require(_0x00f9('0x0'));var Promise=require(_0x00f9('0x1'));var rp=require(_0x00f9('0x2'));var util=require(_0x00f9('0x3'));var md5=require('md5');var Redis=require(_0x00f9('0x4'));var intUtil=require(_0x00f9('0x5'));var config=require('../../../../config/environment');var logger=require(_0x00f9('0x6'))(_0x00f9('0x7'));config[_0x00f9('0x8')]=_[_0x00f9('0x9')](config[_0x00f9('0x8')],{'host':_0x00f9('0xa'),'port':0x18eb});var io=require(_0x00f9('0xb'))(new Redis(config[_0x00f9('0x8')]));function getAdminUser(_0x18b611,_0x469d3d,_0x2d7876,_0x2a10aa,_0x8ab806,_0x505ef0){return new Promise(function(_0x2445f5,_0x2332c5){var _0x364bfd={'method':_0x00f9('0xc'),'uri':_0x2a10aa+_0x00f9('0xd')+'&'+_0x8ab806+'&'+_0x505ef0,'auth':_0x469d3d,'json':!![]};return rp(_0x364bfd)['then'](function(_0x5f1df7){if(_0x5f1df7[_0x00f9('0xe')][_0x00f9('0xf')]>0x0){_0x2d7876[_0x00f9('0x10')]=_0x5f1df7[_0x00f9('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x18b611[_0x00f9('0x11')]()]+_0x00f9('0x12'),_0x2d7876);_0x2445f5(_0x2d7876);})[_0x00f9('0x13')](function(_0xe0c1bd){logger[_0x00f9('0x14')]('['+[_0x18b611[_0x00f9('0x11')]()]+']',_0xe0c1bd[_0x00f9('0x15')]);_0x2332c5(_0xe0c1bd['message']);});});}function getUser(_0x438596,_0x2a7fad,_0x13dd49,_0x6fc85f,_0xdc9aee){return function(_0xc61349){logger[_0x00f9('0x16')]('['+[_0x438596[_0x00f9('0x11')]()]+_0x00f9('0x17'),_0xc61349);return new Promise(function(_0x5b19cb,_0xb5b53){if(intUtil[_0x00f9('0x18')](_0xc61349['userEmail'])){var _0x24e8ce={'method':_0x00f9('0xc'),'uri':_0x13dd49+_0x00f9('0x19')+_0xc61349['userEmail']+'&'+_0x6fc85f+'&'+_0xdc9aee,'auth':_0x2a7fad,'json':!![]};logger[_0x00f9('0x16')]('['+[_0x438596[_0x00f9('0x11')]()]+_0x00f9('0x1a'),_0x24e8ce);return rp(_0x24e8ce)[_0x00f9('0x1b')](function(_0x5c8290){logger['info']('['+[_0x438596['toUpperCase']()]+'],\x20getUser\x20entity',_0x5c8290);if(_0x5c8290[_0x00f9('0xe')]['length']>0x0&&String(_0x5c8290[_0x00f9('0xe')][0x0]['active'])===_0x00f9('0x1c')){_0xc61349[_0x00f9('0x1d')]=_0x5c8290[_0x00f9('0xe')][0x0]['sys_id'];}else{_0xc61349[_0x00f9('0x1d')]=_0xc61349[_0x00f9('0x10')];_0xc61349['userEmail']=_0xc61349[_0x00f9('0x1e')];}logger[_0x00f9('0x16')]('['+[_0x438596[_0x00f9('0x11')]()]+'],\x20getUser\x20crm',_0xc61349);_0x5b19cb(_0xc61349);})[_0x00f9('0x13')](function(_0x3dfe3b){logger[_0x00f9('0x14')]('['+[_0x438596['toUpperCase']()]+']',_0x3dfe3b['message']);_0xb5b53(_0x3dfe3b[_0x00f9('0x15')]);});}else{logger['info']('['+[_0x438596[_0x00f9('0x11')]()]+_0x00f9('0x1f'));_0xc61349[_0x00f9('0x1d')]=_0xc61349[_0x00f9('0x10')];_0xc61349['userEmail']=_0xc61349[_0x00f9('0x1e')];_0x5b19cb(_0xc61349);}});};}function createEndUser(_0x3fa6c8,_0x565700,_0x49cd4f,_0x3178fd,_0xc2bba5){logger[_0x00f9('0x16')]('['+[_0x3fa6c8[_0x00f9('0x11')]()]+_0x00f9('0x20'),_0x49cd4f);return new Promise(function(_0x27c79f,_0x52a7a4){var _0x2eb2be={'method':_0x00f9('0x21'),'uri':_0x3178fd+'sys_user?'+_0xc2bba5,'body':{'user_name':_0x49cd4f[_0x00f9('0x22')],'roles':'user','first_name':_0x49cd4f['endUserNumber'],'active':_0x00f9('0x1c'),'date_format':_0x00f9('0x23'),'phone':_0x49cd4f[_0x00f9('0x22')]},'auth':_0x565700,'json':!![]};return rp(_0x2eb2be)['then'](function(_0x21c0bb){logger[_0x00f9('0x16')]('['+[_0x3fa6c8['toUpperCase']()]+'],\x20EndUser\x20schema',_0x21c0bb[_0x00f9('0xe')]);_0x49cd4f['endUserId']=_0x21c0bb[_0x00f9('0xe')][_0x00f9('0x24')];_0x27c79f(_0x49cd4f);})[_0x00f9('0x13')](function(_0x36af1f){logger[_0x00f9('0x14')]('['+[_0x3fa6c8['toUpperCase']()]+']',_0x36af1f[_0x00f9('0x15')]);_0x52a7a4(_0x36af1f['message']);});});}function getEndUser(_0x34f02e,_0x33321b,_0x2df396,_0x3cf9d4,_0x164a01){return function(_0x3b54ad){logger[_0x00f9('0x16')]('['+[_0x34f02e[_0x00f9('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x3b54ad);return new Promise(function(_0x58d78a,_0x5da3f5){var _0x5bac59={'method':'GET','uri':_0x2df396+_0x00f9('0x25')+_0x3b54ad['endUserNumber']+'&'+_0x3cf9d4+'&'+_0x164a01,'auth':_0x33321b,'json':!![]};return rp(_0x5bac59)[_0x00f9('0x1b')](function(_0x50319f){if(_0x50319f['result']['length']>0x0){_0x3b54ad['endUserId']=_0x50319f[_0x00f9('0xe')][0x0][_0x00f9('0x24')];logger[_0x00f9('0x16')]('['+[_0x34f02e[_0x00f9('0x11')]()]+_0x00f9('0x26'),_0x3b54ad);_0x58d78a(_0x3b54ad);}else{return createEndUser(_0x34f02e,_0x33321b,_0x3b54ad,_0x2df396,_0x3cf9d4)[_0x00f9('0x1b')](function(_0x1ea901){logger[_0x00f9('0x16')]('['+[_0x34f02e[_0x00f9('0x11')]()]+_0x00f9('0x27'),_0x1ea901);_0x58d78a(_0x1ea901);});}})[_0x00f9('0x13')](function(_0x49d583){logger['error']('['+[_0x34f02e[_0x00f9('0x11')]()]+']',_0x49d583[_0x00f9('0x15')]);_0x5da3f5(_0x49d583[_0x00f9('0x15')]);});});};}function getCustomFields(_0x1c946d,_0x3e0516){var _0x2e7231={};if(_0x1c946d[_0x00f9('0xf')]>0x0){_[_0x00f9('0x28')](_0x1c946d,function(_0x532995){if(_[_0x00f9('0x29')]([_0x00f9('0x2a'),_0x00f9('0x2b')],_0x532995[_0x00f9('0x2c')])&&_0x532995[_0x00f9('0x2d')]&&!_0x532995[_0x00f9('0x2e')]){_0x2e7231[_0x532995[_0x00f9('0x2d')][_0x00f9('0x2f')]()]=_0x532995['content']['toString']();}else if(_[_0x00f9('0x29')]([_0x00f9('0x2a'),_0x00f9('0x2b')],_0x532995[_0x00f9('0x2c')])&&_0x532995[_0x00f9('0x30')]&&_0x532995[_0x00f9('0x2e')]){_0x2e7231[_0x532995[_0x00f9('0x30')]['toLowerCase']()]=_0x532995[_0x00f9('0x31')][_0x00f9('0x32')]();}else if(_0x532995['type']===_0x00f9('0x33')&&_0x532995[_0x00f9('0x34')]&&_0x532995['idField']&&_0x532995[_0x00f9('0x2e')]){_0x2e7231[_0x532995[_0x00f9('0x30')]['toLowerCase']()]=_0x3e0516[_0x532995[_0x00f9('0x34')]][_0x00f9('0x32')]();}else if(_0x532995['type']===_0x00f9('0x35')&&_0x532995[_0x00f9('0x36')]&&_0x532995[_0x00f9('0x36')][_0x00f9('0x37')]&&_0x532995[_0x00f9('0x30')]&&_0x532995['customField']){_0x2e7231[_0x532995[_0x00f9('0x30')][_0x00f9('0x2f')]()]=_0x3e0516[_0x532995['Variable'][_0x00f9('0x37')][_0x00f9('0x2f')]()][_0x00f9('0x32')]();}});}return _0x2e7231;}function getTicket(_0x3dc1e5,_0x119bf4,_0x397f02,_0x18026e,_0x51f6bd,_0x611467){return function(_0x558017){logger['info']('['+[_0x3dc1e5[_0x00f9('0x11')]()]+_0x00f9('0x38'),_0x558017);return new Promise(function(_0x4a0e33,_0x24a972){var _0x16ac72=_0x3dc1e5[_0x00f9('0x2f')]()==='outbound'?_0x558017[_0x00f9('0x1d')]:_0x558017[_0x00f9('0x39')];var _0x21501d={'method':_0x00f9('0x21'),'uri':_0x397f02+_0x00f9('0x3a')+'?'+_0x611467,'body':Object[_0x00f9('0x3b')]({},{'active':_0x00f9('0x1c'),'caller_id':_0x16ac72,'assigned_to':_0x558017['userId'],'short_description':intUtil[_0x00f9('0x3c')](_0x18026e[_0x00f9('0x3d')],_0x51f6bd,'\x20'),'description':intUtil[_0x00f9('0x3c')](_0x18026e[_0x00f9('0x3e')],_0x51f6bd,'\x0a')},getCustomFields(_0x18026e[_0x00f9('0x3f')],_0x51f6bd)),'auth':_0x119bf4,'json':!![]};return rp(_0x21501d)[_0x00f9('0x1b')](function(_0x5ecb5f){logger[_0x00f9('0x16')]('['+[_0x3dc1e5[_0x00f9('0x11')]()]+_0x00f9('0x40'),_0x5ecb5f[_0x00f9('0xe')]);_0x558017[_0x00f9('0x41')]=_0x5ecb5f[_0x00f9('0xe')][_0x00f9('0x24')];_0x558017[_0x00f9('0x42')]=_0x5ecb5f[_0x00f9('0xe')][_0x00f9('0x43')];logger[_0x00f9('0x16')]('['+[_0x3dc1e5[_0x00f9('0x11')]()]+_0x00f9('0x44'),_0x558017);_0x4a0e33(_0x558017);})[_0x00f9('0x13')](function(_0x3ef6d9){logger['error']('['+[_0x3dc1e5[_0x00f9('0x11')]()]+']',_0x3ef6d9[_0x00f9('0x15')]);_0x24a972(_0x3ef6d9[_0x00f9('0x15')]);});});};}function createRemoteTag(_0x55d37a,_0x9fde72,_0x1ddfd8,_0x56894b){return new Promise(function(_0x2d1699,_0x25e949){var _0x424425={'method':_0x00f9('0x21'),'uri':_0x1ddfd8+_0x00f9('0x45')+'?'+_0x56894b,'body':{'short_description':_0x55d37a,'global':!![],'active':!![],'name':_0x55d37a},'auth':_0x9fde72,'json':!![]};return rp(_0x424425)[_0x00f9('0x1b')](function(_0x5b8f59){var _0x1dbbdc=_0x5b8f59[_0x00f9('0xe')][_0x00f9('0x24')];_0x2d1699(_0x1dbbdc);});});}function getRemoteTag(_0x1a1285,_0x89097f,_0xf08763,_0x1832f3,_0x34159a){return new Promise(function(_0x3893c2,_0x1b0f4c){var _0x2adc0d={'method':_0x00f9('0xc'),'uri':_0xf08763+_0x00f9('0x45')+_0x00f9('0x46')+_0x1a1285+'&'+_0x1832f3,'auth':_0x89097f,'json':!![]};return rp(_0x2adc0d)[_0x00f9('0x1b')](function(_0x2c0d3f){if(_0x2c0d3f[_0x00f9('0xe')][_0x00f9('0xf')]>0x0){var _0x46061b=_0x2c0d3f[_0x00f9('0xe')][0x0][_0x00f9('0x24')];_0x3893c2(_0x46061b);}else{return createRemoteTag(_0x1a1285,_0x89097f,_0xf08763,_0x1832f3)['then'](function(_0x2e48b6){_0x3893c2(_0x2e48b6);});}});});}function assignTagToIncident(_0x32b521,_0x5ef064,_0x75ccfe,_0x46110c,_0x4d4154){return new Promise(function(_0x57a2e9,_0x312345){var _0x11b687={'method':_0x00f9('0x21'),'uri':_0x75ccfe+'label_entry'+'?'+_0x4d4154,'body':{'label':_0x32b521,'table':'incident','id_type':_0x00f9('0x47'),'table_key':_0x46110c[_0x00f9('0x41')],'title':_0x00f9('0x48')+_0x46110c[_0x00f9('0x42')],'id_display':_0x46110c[_0x00f9('0x42')]},'auth':_0x5ef064,'json':!![]};return rp(_0x11b687)[_0x00f9('0x1b')](function(_0x19f1f5){_0x57a2e9();})[_0x00f9('0x13')](function(){_0x57a2e9();});});}function manageTags(_0x3a4d93,_0x3a6544,_0x70969f,_0x5da783,_0x384d52,_0xb0ed26,_0x25035b){return new Promise(function(_0x2ee84c,_0x450670){var _0x23ff37=[];_0x3a6544[_0x00f9('0x28')](function(_0x531230){_0x23ff37[_0x00f9('0x49')](getRemoteTag(_0x531230,_0x70969f,_0x5da783,_0xb0ed26,_0x25035b));});return Promise[_0x00f9('0x4a')](_0x23ff37)['then'](function(_0x2725dd){if(_0x2725dd[_0x00f9('0xf')]){logger[_0x00f9('0x16')]('['+[_0x3a4d93[_0x00f9('0x11')]()]+_0x00f9('0x4b'),_0x2725dd);var _0x2c5e32=[];_0x2725dd[_0x00f9('0x28')](function(_0x536c9c){_0x2c5e32[_0x00f9('0x49')](assignTagToIncident(_0x536c9c,_0x70969f,_0x5da783,_0x384d52,_0xb0ed26));});return Promise[_0x00f9('0x4a')](_0x2c5e32)[_0x00f9('0x1b')](function(){_0x2ee84c();})[_0x00f9('0x13')](function(){_0x2ee84c();});}else{_0x2ee84c();}});});}function getTags(_0x4c435d,_0x200d80,_0x509c85,_0x9b2094,_0x52a5ed,_0x45d139){return function(_0x611b06){return new Promise(function(_0x1dc42e,_0x58a639){var _0x15cd61=[];var _0x2467c9=_0x9b2094[_0x00f9('0x4c')];if(_0x2467c9&&_0x2467c9[_0x00f9('0xf')]>0x0){_0x15cd61=_[_0x00f9('0x4d')](_0x2467c9,'name');}if(_0x15cd61[_0x00f9('0xf')]>0x0){return manageTags(_0x4c435d,_0x15cd61,_0x200d80,_0x509c85,_0x611b06,_0x52a5ed,_0x45d139)[_0x00f9('0x1b')](function(){_0x1dc42e(_0x611b06);});}else{_0x1dc42e(_0x611b06);}});};}function emit(_0x13c241,_0x135a26,_0x3d11e3){var _0x371b2b=_0x00f9('0x4e')+_0x00f9('0x4f')+_0x00f9('0x50')+'%255EORDERBYDESCnumber';var _0xc21dd6={'uri':_0x13c241+_0x00f9('0x51')+_0x3d11e3+_0x371b2b};io['to'](util[_0x00f9('0x52')](_0x00f9('0x53'),_0x135a26))[_0x00f9('0x54')]('trigger:browser:url',_0xc21dd6);}exports['cs']=function(_0x4dba37,_0x3c31c3,_0x390270,_0x5c1761,_0x365f79,_0x3253bf,_0x17bc31,_0x255350){var _0x2c997f={};var _0x54430f={'user':_0x3253bf['username'],'pass':_0x3253bf[_0x00f9('0x55')]};var _0x6dfa41=_0x00f9('0x56');var _0x14ccc6=_0x00f9('0x57');_0x3253bf[_0x00f9('0x58')]=intUtil[_0x00f9('0x59')](_0x3253bf[_0x00f9('0x58')]);_0x3253bf['serverUrl']=intUtil[_0x00f9('0x59')](_0x3253bf[_0x00f9('0x5a')]);var _0x5ec7bd=util['format'](_0x00f9('0x5b'),_0x3253bf[_0x00f9('0x58')]);_0x2c997f['userEmail']=!_['isNil'](_0x5c1761)?_0x5c1761[_0x00f9('0x5c')]:null;_0x2c997f[_0x00f9('0x1e')]=_0x3253bf[_0x00f9('0x5c')];_0x2c997f[_0x00f9('0x22')]=_0x255350[_0x00f9('0x2f')]()===_0x00f9('0x5d')?_0x3c31c3['destcalleridnum']:_0x3c31c3[_0x00f9('0x5e')];_0x2c997f['callDirection']=_0x255350===_0x00f9('0x5f')||_0x255350===_0x00f9('0x60')?_0x00f9('0x5f'):_0x00f9('0x5d');var _0x18a9f7=util[_0x00f9('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3253bf[_0x00f9('0x5a')],_0x3c31c3[_0x00f9('0x61')],md5(_0x3c31c3[_0x00f9('0x61')]));if(_0x365f79&&_0x365f79[_0x00f9('0x62')]){logger[_0x00f9('0x16')]('[QUEUE]',_0x00f9('0x63'));_0x3c31c3[_0x00f9('0x64')]=_0x18a9f7;}else if(_0x17bc31&&_0x17bc31[_0x00f9('0x65')]&&_0x17bc31[_0x00f9('0x65')]!==_0x00f9('0x66')){logger[_0x00f9('0x16')]('[OUTBOUND]',_0x00f9('0x63'));_0x3c31c3['recordingURL']=_0x18a9f7;}else{_0x3c31c3['recordingURL']='';}return getAdminUser(_0x255350,_0x54430f,_0x2c997f,_0x5ec7bd,_0x14ccc6,_0x6dfa41)['then'](getUser(_0x255350,_0x54430f,_0x5ec7bd,_0x14ccc6,_0x6dfa41))[_0x00f9('0x1b')](getEndUser(_0x255350,_0x54430f,_0x5ec7bd,_0x14ccc6,_0x6dfa41))[_0x00f9('0x1b')](getTicket(_0x255350,_0x54430f,_0x5ec7bd,_0x390270,_0x3c31c3,_0x14ccc6))[_0x00f9('0x1b')](function(_0x42524e){logger[_0x00f9('0x16')](util[_0x00f9('0x52')]('The\x20ticket\x20ID\x20is:\x20%s',_0x42524e[_0x00f9('0x41')]));logger['info'](util['format'](_0x00f9('0x67'),_0x255350));if(_0x255350!=='unmanaged'){logger[_0x00f9('0x16')]('['+[_0x255350[_0x00f9('0x11')]()]+']',_0x00f9('0x68'));emit(_0x3253bf[_0x00f9('0x58')],_0x5c1761[_0x00f9('0x37')],_0x42524e[_0x00f9('0x41')]);}})['catch'](function(_0x3dea47){logger[_0x00f9('0x14')]('['+[_0x255350['toUpperCase']()]+_0x00f9('0x69'),util[_0x00f9('0x6a')](_0x3dea47,{'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 91fafc7..ee2523c 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 _0x8763=['Inbound','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','stripTrailingSlash','none','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','user:%s','lastevent','toUpperCase','lodash','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','length','forEach','variableName','push','idField','JSON','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','format','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','Variable','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields'];(function(_0x4d785f,_0xf8868f){var _0x6ab99e=function(_0x286447){while(--_0x286447){_0x4d785f['push'](_0x4d785f['shift']());}};_0x6ab99e(++_0xf8868f);}(_0x8763,0x89));var _0x3876=function(_0x559cfc,_0x89480e){_0x559cfc=_0x559cfc-0x0;var _0x22734f=_0x8763[_0x559cfc];return _0x22734f;};'use strict';var _=require(_0x3876('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x3876('0x1'));var Redis=require('ioredis');var intUtil=require(_0x3876('0x2'));var config=require(_0x3876('0x3'));var logger=require(_0x3876('0x4'))(_0x3876('0x5'));config[_0x3876('0x6')]=_[_0x3876('0x7')](config[_0x3876('0x6')],{'host':_0x3876('0x8'),'port':0x18eb});var io=require(_0x3876('0x9'))(new Redis(config[_0x3876('0x6')]));var def={'method':_0x3876('0xa'),'json':!![]};function emit(_0x23cc22,_0x47b711,_0x3f14b5){io['to'](_0x23cc22)[_0x3876('0xb')](_0x47b711,_0x3f14b5);}function getTicket(_0x1efe70,_0x140bbb,_0x117d23,_0x48c82b,_0x4d37c0,_0x25f160,_0x396691,_0x1eed83){logger[_0x3876('0xc')](_0x3876('0xd'));var _0x4463f7=new Date();var _0xf9036d=[{'name':_0x3876('0xe'),'value':intUtil[_0x3876('0xf')](_0x48c82b[_0x3876('0x10')],_0x4d37c0,'\x20')},{'name':_0x3876('0x11'),'value':_0x140bbb['id']},{'name':_0x3876('0x12'),'value':_0x140bbb['id']},{'name':_0x3876('0x13'),'value':intUtil[_0x3876('0xf')](_0x48c82b[_0x3876('0x14')],_0x4d37c0,'\x0a')},{'name':'date_start','value':_0x4463f7[_0x3876('0x15')]()[_0x3876('0x16')](0x0,0x13)[_0x3876('0x17')]('T','\x20')},{'name':_0x3876('0x18'),'value':'0'},{'name':_0x3876('0x19'),'value':'15'},{'name':_0x3876('0x1a'),'value':_0x117d23['id']},{'name':'parent_type','value':_0x3876('0x1b')},{'name':'parent_name','value':_0x117d23[_0x3876('0xe')]},{'name':'direction','value':_0x1eed83}];if(_0x25f160[_0x3876('0x1c')]){_[_0x3876('0x1d')](_0x25f160,function(_0x1f1e90){if(_0x4d37c0[_0x1f1e90[_0x3876('0x1e')]]){_0xf9036d[_0x3876('0x1f')]({'name':_0x1f1e90[_0x3876('0x20')],'value':_0x4d37c0[_0x1f1e90[_0x3876('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x3876('0x21'),'response_type':_0x3876('0x21'),'rest_data':JSON['stringify']({'session':_0x396691['id'],'module_name':'Calls','name_value_list':_0xf9036d})}});}function getAuth(_0x237654){return util['format']('Basic\x20%s',new Buffer(_0x237654[_0x3876('0x22')]+':X')[_0x3876('0x23')](_0x3876('0x24')));}function getServerInfo(_0x5a73ba){return request({'form':{'method':_0x3876('0x25'),'input_type':_0x3876('0x21'),'response_type':_0x3876('0x21'),'rest_data':JSON['stringify']({'session':_0x5a73ba['id']})}});}function getUser(_0x39d908,_0x45f06c,_0x5af75b){if(!_[_0x3876('0x26')](_0x45f06c)){logger[_0x3876('0xc')](_0x3876('0x27'),_0x45f06c);return request({'form':{'method':_0x3876('0x28'),'input_type':'JSON','response_type':_0x3876('0x21'),'rest_data':JSON[_0x3876('0x29')]({'session':_0x5af75b['id'],'module_name':_0x3876('0x2a'),'query':util['format'](_0x3876('0x2b'),_0x45f06c),'order_by':'','offset':'0','select_fields':['id','name',_0x3876('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3876('0x2d')](function(_0x276f17){if(_0x276f17[_0x3876('0x2e')][_0x3876('0x1c')]){var _0x2de532=_[_0x3876('0x2f')](_0x276f17['entry_list'],function(_0xa96226){return _0xa96226[_0x3876('0x30')][_0x3876('0x2c')][_0x3876('0x31')]===_0x45f06c;});if(_0x2de532){logger['info'](_0x3876('0x32'));return BPromise[_0x3876('0x33')]({'id':_0x2de532[_0x3876('0x30')]['id'][_0x3876('0x31')],'name':_0x2de532['name_value_list'][_0x3876('0xe')][_0x3876('0x31')]});}}logger[_0x3876('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3876('0x33')]({'id':_0x5af75b[_0x3876('0x30')][_0x3876('0x34')][_0x3876('0x31')],'name':_0x5af75b[_0x3876('0x30')][_0x3876('0x2c')][_0x3876('0x31')]});});}else{logger[_0x3876('0xc')](_0x3876('0x35'));return BPromise['resolve']({'id':_0x5af75b[_0x3876('0x30')][_0x3876('0x34')]['value'],'name':_0x5af75b[_0x3876('0x30')][_0x3876('0x2c')]['value']});}}function getEndUser(_0x413367,_0x538c53,_0x5bb692,_0x3f3ff3){logger['info']('Searching\x20enduser\x20with\x20phone',_0x5bb692);return request({'form':{'method':_0x3876('0x28'),'input_type':'JSON','response_type':_0x3876('0x21'),'rest_data':JSON['stringify']({'session':_0x3f3ff3['id'],'module_name':'Contacts','query':util[_0x3876('0x36')](_0x3876('0x37'),_0x5bb692),'order_by':'','offset':'0','select_fields':['id',_0x3876('0xe'),_0x3876('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3876('0x2d')](function(_0x10d199){if(_0x10d199[_0x3876('0x2e')]['length']){var _0x4004a1=_['find'](_0x10d199['entry_list'],function(_0x37aa43){return _0x37aa43[_0x3876('0x30')][_0x3876('0x38')][_0x3876('0x31')]===_0x5bb692;});if(_0x4004a1){logger[_0x3876('0xc')](_0x3876('0x39'));return BPromise['resolve']({'id':_0x4004a1[_0x3876('0x30')]['id'][_0x3876('0x31')],'name':_0x4004a1[_0x3876('0x30')][_0x3876('0xe')][_0x3876('0x31')],'phone':_0x4004a1[_0x3876('0x30')][_0x3876('0x38')][_0x3876('0x31')]});}}else{logger['info'](_0x3876('0x3a'));return request({'form':{'method':_0x3876('0x3b'),'input_type':'JSON','response_type':_0x3876('0x21'),'rest_data':JSON[_0x3876('0x29')]({'session':_0x3f3ff3['id'],'module_name':_0x3876('0x1b'),'name_value_list':[{'name':_0x3876('0x3c'),'value':_0x538c53!==_0x3876('0x3d')?_0x538c53:util[_0x3876('0x36')](_0x3876('0x3e'),_0x5bb692)},{'name':_0x3876('0x38'),'value':_0x5bb692}]})}})[_0x3876('0x2d')](function(_0x2f20dc){logger[_0x3876('0xc')](_0x3876('0x3f'));return BPromise[_0x3876('0x33')]({'id':_0x2f20dc['id'],'name':_0x2f20dc[_0x3876('0x2e')]['first_name']['value'],'phone':_0x2f20dc['entry_list'][_0x3876('0x38')][_0x3876('0x31')]});});}});}function request(_0x3340b2){logger[_0x3876('0x40')](_0x3876('0x41'),JSON[_0x3876('0x29')](_0x3340b2));return rp(_['merge'](def,_0x3340b2));}function getTags(_0x38aaa7,_0x391e2e){var _0x100915=[];if(_0x38aaa7&&_0x38aaa7[_0x3876('0x1c')]>0x0){_0x100915=_['map'](_0x38aaa7,_0x391e2e);}return _0x100915;}function getCustomFields(_0x3a7c94,_0x2a106d){var _0x3a93d2=[];var _0x19713e={'custom_fields':[]};if(_0x3a7c94[_0x3876('0x1c')]>0x0){_[_0x3876('0x1d')](_0x3a7c94,function(_0x5dc1a3){if(_0x5dc1a3[_0x3876('0x42')]===_0x3876('0x43')&&_0x5dc1a3[_0x3876('0x44')]&&!_0x5dc1a3[_0x3876('0x45')]){_0x19713e[_0x5dc1a3[_0x3876('0x44')][_0x3876('0x46')]()]=_0x5dc1a3[_0x3876('0x47')][_0x3876('0x23')]();}else if(_0x5dc1a3[_0x3876('0x42')]==='string'&&_0x5dc1a3[_0x3876('0x20')]&&_0x5dc1a3['customField']){_0x19713e[_0x3876('0x48')][_0x3876('0x1f')]({'id':_0x5dc1a3[_0x3876('0x20')],'value':_0x5dc1a3[_0x3876('0x47')][_0x3876('0x23')]()});}else if(_0x5dc1a3['type']===_0x3876('0x49')&&_0x5dc1a3[_0x3876('0x1e')]&&_0x5dc1a3[_0x3876('0x20')]&&_0x5dc1a3['customField']){_0x2a106d[_0x5dc1a3['variableName']]&&_0x19713e[_0x3876('0x48')]['push']({'id':_0x5dc1a3[_0x3876('0x20')],'value':_0x2a106d[_0x5dc1a3['variableName']][_0x3876('0x23')]()});}else if(_0x5dc1a3[_0x3876('0x42')]==='customVariable'&&_0x5dc1a3[_0x3876('0x4a')]&&_0x5dc1a3[_0x3876('0x4a')][_0x3876('0xe')]&&_0x5dc1a3[_0x3876('0x20')]&&_0x5dc1a3['customField']){_0x2a106d[_0x5dc1a3[_0x3876('0x4a')]['name']['toLowerCase']()]&&_0x19713e['custom_fields'][_0x3876('0x1f')]({'id':_0x5dc1a3[_0x3876('0x20')],'value':_0x2a106d[_0x5dc1a3[_0x3876('0x4a')][_0x3876('0xe')]['toLowerCase']()][_0x3876('0x23')]()});}});}return _0x19713e;}function getConnection(_0x46e89d){return request({'method':_0x3876('0xa'),'form':{'method':'login','input_type':_0x3876('0x21'),'response_type':_0x3876('0x21'),'rest_data':JSON[_0x3876('0x29')]({'user_auth':{'user_name':_0x46e89d[_0x3876('0x4b')],'password':_0x46e89d[_0x3876('0x4c')],'encryption':_0x3876('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x3876('0x2d')](function(_0x12e388){var _0x496056=_0x12e388;if(_0x496056['id']){def['sessionID']=_0x496056['id'];return BPromise['resolve'](_0x496056);}else{throw new Error(util['format'](_0x3876('0x4e'),_0x46e89d['id']));}});}function setRelationship(_0x402e32,_0x365885,_0x47de2c,_0x1abbf2){return request({'form':{'method':_0x3876('0x4f'),'input_type':_0x3876('0x21'),'response_type':_0x3876('0x21'),'rest_data':JSON[_0x3876('0x29')]({'session':_0x402e32['id'],'module_name':_0x3876('0x50'),'module_id':_0x47de2c['id'],'link_field_name':_0x1abbf2,'related_ids':[_0x365885['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3876('0x51')]=function(_0x20183d,_0x2536e4,_0x3f5138,_0x5391b9,_0x1caa99,_0x24449c){var _0x2f83d3,_0x19ef19,_0x488d2b,_0x37ad8e;_0x24449c['remoteUri']=intUtil['stripTrailingSlash'](_0x24449c[_0x3876('0x52')]);_0x24449c[_0x3876('0x53')]=intUtil['stripTrailingSlash'](_0x24449c[_0x3876('0x53')]);def[_0x3876('0x54')]=util[_0x3876('0x36')](_0x3876('0x55'),_0x24449c['remoteUri']);if(_0x1caa99&&_0x1caa99[_0x3876('0x56')]){logger[_0x3876('0xc')](_0x3876('0x57'),_0x3876('0x58'));_0x2536e4[_0x3876('0x59')]=util[_0x3876('0x36')](_0x3876('0x5a'),_0x24449c[_0x3876('0x53')],_0x2536e4[_0x3876('0x5b')],md5(_0x2536e4['uniqueid']));}else{_0x2536e4[_0x3876('0x59')]='';}return getConnection(_0x24449c)['then'](function(_0x34944b){_0x37ad8e=_0x34944b;return getUser(_0x24449c,_0x5391b9[_0x3876('0xe')],_0x37ad8e);})[_0x3876('0x2d')](function(_0xdacdd0){_0x2f83d3=_0xdacdd0;logger[_0x3876('0xc')](_0x3876('0x5c'),_0x2f83d3['id']);return getEndUser(_0x24449c,_0x2536e4[_0x3876('0x5d')],_0x2536e4[_0x3876('0x5e')],_0x37ad8e);})[_0x3876('0x2d')](function(_0x12e9ae){_0x19ef19=_0x12e9ae;logger['info'](_0x3876('0x5f'),_0x19ef19['id']);return getTicket(_0x24449c,_0x2f83d3,_0x19ef19,_0x3f5138,_0x2536e4,_0x3f5138[_0x3876('0x60')],_0x37ad8e,_0x3876('0x61'));})[_0x3876('0x2d')](function(_0x19121d){_0x488d2b=_0x19121d;logger[_0x3876('0xc')]('Ticket\x20created!');logger[_0x3876('0xc')]('The\x20Ticket\x20ID\x20is:',_0x488d2b['id']);return setRelationship(_0x37ad8e,_0x2f83d3,_0x488d2b,'users');})[_0x3876('0x2d')](function(){return setRelationship(_0x37ad8e,_0x19ef19,_0x488d2b,_0x3876('0x62'));})[_0x3876('0x2d')](function(){return getServerInfo(_0x37ad8e);})[_0x3876('0x2d')](function(_0x53715f){var _0x5ce1a9=parseInt(_0x53715f[_0x3876('0x63')][_0x3876('0x64')](0x0));var _0x101735=util[_0x3876('0x36')](_0x3876('0x65'),_0x24449c[_0x3876('0x52')],_0x488d2b['id']);if(_0x5ce1a9>0x6){_0x101735=util[_0x3876('0x36')](_0x3876('0x66'),_0x24449c[_0x3876('0x52')],_0x488d2b['id']);}logger[_0x3876('0xc')](_0x3876('0x57'),_0x3876('0x67'));emit(util[_0x3876('0x36')]('user:%s',_0x5391b9[_0x3876('0xe')]),_0x3876('0x68'),{'uri':_0x101735});})[_0x3876('0x69')](function(_0x4d7bcb){logger[_0x3876('0x6a')](_0x3876('0x57'),JSON[_0x3876('0x29')](_0x4d7bcb));});};exports[_0x3876('0x6b')]=function(_0xd9c98b,_0x1f55e9,_0x4484ef,_0x26b75e,_0x6c2c22,_0x34eb6c,_0x55187e){var _0xacb4d8,_0x35533d,_0x38a308,_0xac9320;_0x34eb6c[_0x3876('0x52')]=intUtil[_0x3876('0x6c')](_0x34eb6c['remoteUri']);_0x34eb6c['serverUrl']=intUtil[_0x3876('0x6c')](_0x34eb6c[_0x3876('0x53')]);def[_0x3876('0x54')]=util[_0x3876('0x36')](_0x3876('0x55'),_0x34eb6c['remoteUri']);if(_0x55187e&&_0x55187e['recordingFormat']&&_0x55187e['recordingFormat']!==_0x3876('0x6d')){logger[_0x3876('0xc')]('[OUTBOUND]',_0x3876('0x58'));_0x1f55e9['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34eb6c[_0x3876('0x53')],_0x1f55e9[_0x3876('0x5b')],md5(_0x1f55e9['uniqueid']));}return getConnection(_0x34eb6c)[_0x3876('0x2d')](function(_0x5f1f14){_0xac9320=_0x5f1f14;return getUser(_0x34eb6c,_0x26b75e[_0x3876('0xe')],_0xac9320);})[_0x3876('0x2d')](function(_0x3777a1){_0xacb4d8=_0x3777a1;logger[_0x3876('0xc')](_0x3876('0x5c'),_0xacb4d8['id']);return getEndUser(_0x34eb6c,_0x1f55e9['destcalleridname'],_0x1f55e9['destcalleridnum'],_0xac9320);})['then'](function(_0x2a83bf){_0x35533d=_0x2a83bf;logger[_0x3876('0xc')](_0x3876('0x5f'),_0x35533d['id']);return getTicket(_0x34eb6c,_0xacb4d8,_0x35533d,_0x4484ef,_0x1f55e9,_0x4484ef[_0x3876('0x60')],_0xac9320,_0x3876('0x6e'));})[_0x3876('0x2d')](function(_0x52ddcf){_0x38a308=_0x52ddcf;logger['info'](_0x3876('0x6f'));logger['info'](_0x3876('0x70'),_0x38a308['id']);return setRelationship(_0xac9320,_0xacb4d8,_0x38a308,_0x3876('0x71'));})['then'](function(){return setRelationship(_0xac9320,_0x35533d,_0x38a308,'contacts');})[_0x3876('0x2d')](function(){return getServerInfo(_0xac9320);})[_0x3876('0x2d')](function(_0x5663d0){var _0x1bb5be=parseInt(_0x5663d0[_0x3876('0x63')][_0x3876('0x64')](0x0));var _0x5d934c=util[_0x3876('0x36')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x34eb6c['remoteUri'],_0x38a308['id']);if(_0x1bb5be>0x6){_0x5d934c=util[_0x3876('0x36')](_0x3876('0x66'),_0x34eb6c[_0x3876('0x52')],_0x38a308['id']);}logger[_0x3876('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3876('0x36')](_0x3876('0x72'),_0x26b75e[_0x3876('0xe')]),'trigger:browser:url',{'uri':_0x5d934c});})['catch'](function(_0xf950b2){logger['error']('[OUTBOUND]',JSON[_0x3876('0x29')](_0xf950b2));});};exports['unmanaged']=function(_0x5d2c0e,_0x2ec309,_0x16323e,_0x14aafe,_0x2eb2dd,_0x35726c){var _0x157586,_0x4715b6,_0x54bd94,_0x1db34c;_0x35726c[_0x3876('0x52')]=intUtil['stripTrailingSlash'](_0x35726c[_0x3876('0x52')]);_0x35726c[_0x3876('0x53')]=intUtil[_0x3876('0x6c')](_0x35726c[_0x3876('0x53')]);def[_0x3876('0x54')]=util[_0x3876('0x36')]('%s/service/v4_1/rest.php',_0x35726c[_0x3876('0x52')]);if(_0x2eb2dd&&_0x2eb2dd[_0x3876('0x56')]){logger['info']('['+_0x2ec309[_0x3876('0x73')][_0x3876('0x74')]()+']',_0x3876('0x58'));_0x2ec309['recordingURL']=util['format'](_0x3876('0x5a'),_0x35726c[_0x3876('0x53')],_0x2ec309[_0x3876('0x5b')],md5(_0x2ec309[_0x3876('0x5b')]));}else{_0x2ec309[_0x3876('0x59')]='';}return getConnection(_0x35726c)[_0x3876('0x2d')](function(_0x2fe0e9){_0x1db34c=_0x2fe0e9;if(!_['isNil'](_0x14aafe)){return getUser(_0x35726c,_0x14aafe[_0x3876('0xe')],_0x1db34c);}else{return getUser(_0x35726c,null,_0x1db34c);}})[_0x3876('0x2d')](function(_0x125d2d){_0x157586=_0x125d2d;logger[_0x3876('0xc')]('The\x20User\x20ID\x20is:',_0x157586['id']);return getEndUser(_0x35726c,_0x2ec309[_0x3876('0x5d')],_0x2ec309['calleridnum'],_0x1db34c);})[_0x3876('0x2d')](function(_0x39c63a){_0x4715b6=_0x39c63a;logger[_0x3876('0xc')](_0x3876('0x5f'),_0x4715b6['id']);return getTicket(_0x35726c,_0x157586,_0x4715b6,_0x16323e,_0x2ec309,_0x16323e[_0x3876('0x60')],_0x1db34c,_0x3876('0x61'));})[_0x3876('0x2d')](function(_0x5ecfc5){_0x54bd94=_0x5ecfc5;logger['info'](_0x3876('0x6f'));logger['info'](_0x3876('0x70'),_0x54bd94['id']);return setRelationship(_0x1db34c,_0x157586,_0x54bd94,_0x3876('0x71'));})[_0x3876('0x2d')](function(){return setRelationship(_0x1db34c,_0x4715b6,_0x54bd94,_0x3876('0x62'));})[_0x3876('0x2d')](function(){return getServerInfo(_0x1db34c);})[_0x3876('0x69')](function(_0x7c9183){logger[_0x3876('0x6a')]('['+_0x2ec309[_0x3876('0x73')][_0x3876('0x74')]()+']',JSON[_0x3876('0x29')](_0x7c9183));});}; \ No newline at end of file +var _0xd8d9=['created_by','description','date_start','toISOString','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','forEach','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','user_name','then','entry_list','length','resolve','name_value_list','user_id','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Enduser\x20created.','first_name','[HTTP]','merge','map','type','string','nameField','customField','custom_fields','content','variable','customVariable','Variable','toLowerCase','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Outbound','users','catch','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','getString','Subjects'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xd8d9,0xda));var _0x9d8d=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xd8d9[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x9d8d('0x0'));var rp=require(_0x9d8d('0x1'));var BPromise=require('bluebird');var md5=require(_0x9d8d('0x2'));var util=require(_0x9d8d('0x3'));var Redis=require(_0x9d8d('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x9d8d('0x5'));config[_0x9d8d('0x6')]=_[_0x9d8d('0x7')](config['redis'],{'host':_0x9d8d('0x8'),'port':0x18eb});var io=require(_0x9d8d('0x9'))(new Redis(config['redis']));var def={'method':_0x9d8d('0xa'),'json':!![]};function emit(_0x53c732,_0x216bcb,_0x559bfe){io['to'](_0x53c732)['emit'](_0x216bcb,_0x559bfe);}function getTicket(_0x31e032,_0x4d6b05,_0x13b3c3,_0x3a93f7,_0x2752a6,_0xdc55be,_0x4567e3,_0x31a520){logger[_0x9d8d('0xb')]('Creating\x20new\x20ticket...');var _0xe9e6d8=new Date();var _0xf82446=[{'name':'name','value':intUtil[_0x9d8d('0xc')](_0x3a93f7[_0x9d8d('0xd')],_0x2752a6,'\x20')},{'name':'assigned_user_id','value':_0x4d6b05['id']},{'name':_0x9d8d('0xe'),'value':_0x4d6b05['id']},{'name':_0x9d8d('0xf'),'value':intUtil[_0x9d8d('0xc')](_0x3a93f7['Descriptions'],_0x2752a6,'\x0a')},{'name':_0x9d8d('0x10'),'value':_0xe9e6d8[_0x9d8d('0x11')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x9d8d('0x12'),'value':'0'},{'name':_0x9d8d('0x13'),'value':'15'},{'name':_0x9d8d('0x14'),'value':_0x13b3c3['id']},{'name':'parent_type','value':_0x9d8d('0x15')},{'name':_0x9d8d('0x16'),'value':_0x13b3c3[_0x9d8d('0x17')]},{'name':_0x9d8d('0x18'),'value':_0x31a520}];if(_0xdc55be['length']){_[_0x9d8d('0x19')](_0xdc55be,function(_0x1d2def){if(_0x2752a6[_0x1d2def[_0x9d8d('0x1a')]]){_0xf82446[_0x9d8d('0x1b')]({'name':_0x1d2def[_0x9d8d('0x1c')],'value':_0x2752a6[_0x1d2def[_0x9d8d('0x1a')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x4567e3['id'],'module_name':'Calls','name_value_list':_0xf82446})}});}function getAuth(_0x2cba30){return util[_0x9d8d('0x1f')](_0x9d8d('0x20'),new Buffer(_0x2cba30[_0x9d8d('0x21')]+':X')[_0x9d8d('0x22')]('base64'));}function getServerInfo(_0x4af2d9){return request({'form':{'method':_0x9d8d('0x23'),'input_type':_0x9d8d('0x1d'),'response_type':'JSON','rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x4af2d9['id']})}});}function getUser(_0xe0ec87,_0x257873,_0xf2865e){if(!_[_0x9d8d('0x24')](_0x257873)){logger[_0x9d8d('0xb')](_0x9d8d('0x25'),_0x257873);return request({'form':{'method':_0x9d8d('0x26'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9d8d('0x1e')]({'session':_0xf2865e['id'],'module_name':'Employees','query':util[_0x9d8d('0x1f')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x257873),'order_by':'','offset':'0','select_fields':['id',_0x9d8d('0x17'),_0x9d8d('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9d8d('0x28')](function(_0x3cc118){if(_0x3cc118[_0x9d8d('0x29')][_0x9d8d('0x2a')]){var _0x12d255=_['find'](_0x3cc118['entry_list'],function(_0x48f378){return _0x48f378['name_value_list'][_0x9d8d('0x27')]['value']===_0x257873;});if(_0x12d255){logger[_0x9d8d('0xb')]('Agent\x20found!');return BPromise[_0x9d8d('0x2b')]({'id':_0x12d255[_0x9d8d('0x2c')]['id']['value'],'name':_0x12d255[_0x9d8d('0x2c')][_0x9d8d('0x17')]['value']});}}logger[_0x9d8d('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x9d8d('0x2b')]({'id':_0xf2865e[_0x9d8d('0x2c')][_0x9d8d('0x2d')][_0x9d8d('0x2e')],'name':_0xf2865e[_0x9d8d('0x2c')][_0x9d8d('0x27')][_0x9d8d('0x2e')]});});}else{logger[_0x9d8d('0xb')](_0x9d8d('0x2f'));return BPromise[_0x9d8d('0x2b')]({'id':_0xf2865e[_0x9d8d('0x2c')]['user_id'][_0x9d8d('0x2e')],'name':_0xf2865e[_0x9d8d('0x2c')][_0x9d8d('0x27')][_0x9d8d('0x2e')]});}}function getEndUser(_0x50332a,_0x2b298e,_0x476588,_0x4ba6de){logger['info']('Searching\x20enduser\x20with\x20phone',_0x476588);return request({'form':{'method':_0x9d8d('0x26'),'input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x4ba6de['id'],'module_name':_0x9d8d('0x15'),'query':util['format'](_0x9d8d('0x30'),_0x476588),'order_by':'','offset':'0','select_fields':['id','name',_0x9d8d('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9d8d('0x28')](function(_0xfd919d){if(_0xfd919d['entry_list'][_0x9d8d('0x2a')]){var _0x40edea=_[_0x9d8d('0x32')](_0xfd919d[_0x9d8d('0x29')],function(_0x2c6eb2){return _0x2c6eb2[_0x9d8d('0x2c')]['phone_home'][_0x9d8d('0x2e')]===_0x476588;});if(_0x40edea){logger[_0x9d8d('0xb')](_0x9d8d('0x33'));return BPromise[_0x9d8d('0x2b')]({'id':_0x40edea[_0x9d8d('0x2c')]['id'][_0x9d8d('0x2e')],'name':_0x40edea[_0x9d8d('0x2c')]['name'][_0x9d8d('0x2e')],'phone':_0x40edea[_0x9d8d('0x2c')][_0x9d8d('0x31')]['value']});}}else{logger[_0x9d8d('0xb')](_0x9d8d('0x34'));return request({'form':{'method':_0x9d8d('0x35'),'input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x4ba6de['id'],'module_name':_0x9d8d('0x15'),'name_value_list':[{'name':'first_name','value':_0x2b298e!==_0x9d8d('0x36')?_0x2b298e:util[_0x9d8d('0x1f')]('Caller\x20-\x20%s',_0x476588)},{'name':'phone_home','value':_0x476588}]})}})[_0x9d8d('0x28')](function(_0x12c729){logger['info'](_0x9d8d('0x37'));return BPromise[_0x9d8d('0x2b')]({'id':_0x12c729['id'],'name':_0x12c729[_0x9d8d('0x29')][_0x9d8d('0x38')][_0x9d8d('0x2e')],'phone':_0x12c729[_0x9d8d('0x29')]['phone_home'][_0x9d8d('0x2e')]});});}});}function request(_0x4c362e){logger['debug'](_0x9d8d('0x39'),JSON['stringify'](_0x4c362e));return rp(_[_0x9d8d('0x3a')](def,_0x4c362e));}function getTags(_0x34e52a,_0x595cbb){var _0x5d15a3=[];if(_0x34e52a&&_0x34e52a[_0x9d8d('0x2a')]>0x0){_0x5d15a3=_[_0x9d8d('0x3b')](_0x34e52a,_0x595cbb);}return _0x5d15a3;}function getCustomFields(_0x32dc1e,_0x571cd1){var _0x3be2bc=[];var _0x1d0bf3={'custom_fields':[]};if(_0x32dc1e[_0x9d8d('0x2a')]>0x0){_['forEach'](_0x32dc1e,function(_0x46740a){if(_0x46740a[_0x9d8d('0x3c')]===_0x9d8d('0x3d')&&_0x46740a[_0x9d8d('0x3e')]&&!_0x46740a['customField']){_0x1d0bf3[_0x46740a[_0x9d8d('0x3e')]['toLowerCase']()]=_0x46740a['content'][_0x9d8d('0x22')]();}else if(_0x46740a['type']===_0x9d8d('0x3d')&&_0x46740a[_0x9d8d('0x1c')]&&_0x46740a[_0x9d8d('0x3f')]){_0x1d0bf3[_0x9d8d('0x40')][_0x9d8d('0x1b')]({'id':_0x46740a['idField'],'value':_0x46740a[_0x9d8d('0x41')][_0x9d8d('0x22')]()});}else if(_0x46740a['type']===_0x9d8d('0x42')&&_0x46740a[_0x9d8d('0x1a')]&&_0x46740a['idField']&&_0x46740a[_0x9d8d('0x3f')]){_0x571cd1[_0x46740a[_0x9d8d('0x1a')]]&&_0x1d0bf3[_0x9d8d('0x40')][_0x9d8d('0x1b')]({'id':_0x46740a[_0x9d8d('0x1c')],'value':_0x571cd1[_0x46740a[_0x9d8d('0x1a')]][_0x9d8d('0x22')]()});}else if(_0x46740a[_0x9d8d('0x3c')]===_0x9d8d('0x43')&&_0x46740a[_0x9d8d('0x44')]&&_0x46740a[_0x9d8d('0x44')][_0x9d8d('0x17')]&&_0x46740a[_0x9d8d('0x1c')]&&_0x46740a[_0x9d8d('0x3f')]){_0x571cd1[_0x46740a[_0x9d8d('0x44')]['name'][_0x9d8d('0x45')]()]&&_0x1d0bf3['custom_fields']['push']({'id':_0x46740a['idField'],'value':_0x571cd1[_0x46740a[_0x9d8d('0x44')][_0x9d8d('0x17')][_0x9d8d('0x45')]()][_0x9d8d('0x22')]()});}});}return _0x1d0bf3;}function getConnection(_0x317a09){return request({'method':_0x9d8d('0xa'),'form':{'method':_0x9d8d('0x46'),'input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x317a09[_0x9d8d('0x47')],'password':_0x317a09['password'],'encryption':_0x9d8d('0x48')},'application':_0x9d8d('0x49')})}})[_0x9d8d('0x28')](function(_0x2b9a33){var _0x11de26=_0x2b9a33;if(_0x11de26['id']){def[_0x9d8d('0x4a')]=_0x11de26['id'];return BPromise[_0x9d8d('0x2b')](_0x11de26);}else{throw new Error(util[_0x9d8d('0x1f')](_0x9d8d('0x4b'),_0x317a09['id']));}});}function setRelationship(_0x102bb9,_0x2b67dd,_0x28d0d2,_0x203aef){return request({'form':{'method':'set_relationship','input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x102bb9['id'],'module_name':_0x9d8d('0x4c'),'module_id':_0x28d0d2['id'],'link_field_name':_0x203aef,'related_ids':[_0x2b67dd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9d8d('0x4d')]=function(_0x1c84df,_0x428b3a,_0x142a37,_0x3c51f6,_0x43d166,_0x24979c){var _0x44e349,_0x26c56d,_0x27d89f,_0x456294;_0x24979c['remoteUri']=intUtil[_0x9d8d('0x4e')](_0x24979c[_0x9d8d('0x4f')]);_0x24979c[_0x9d8d('0x50')]=intUtil[_0x9d8d('0x4e')](_0x24979c['serverUrl']);def[_0x9d8d('0x51')]=util['format'](_0x9d8d('0x52'),_0x24979c[_0x9d8d('0x4f')]);if(_0x43d166&&_0x43d166[_0x9d8d('0x53')]){logger[_0x9d8d('0xb')](_0x9d8d('0x54'),_0x9d8d('0x55'));_0x428b3a['recordingURL']=util['format'](_0x9d8d('0x56'),_0x24979c[_0x9d8d('0x50')],_0x428b3a[_0x9d8d('0x57')],md5(_0x428b3a[_0x9d8d('0x57')]));}else{_0x428b3a['recordingURL']='';}return getConnection(_0x24979c)[_0x9d8d('0x28')](function(_0x50a3fc){_0x456294=_0x50a3fc;return getUser(_0x24979c,_0x3c51f6[_0x9d8d('0x17')],_0x456294);})['then'](function(_0x52dcfd){_0x44e349=_0x52dcfd;logger[_0x9d8d('0xb')](_0x9d8d('0x58'),_0x44e349['id']);return getEndUser(_0x24979c,_0x428b3a[_0x9d8d('0x59')],_0x428b3a[_0x9d8d('0x5a')],_0x456294);})[_0x9d8d('0x28')](function(_0x3a86e8){_0x26c56d=_0x3a86e8;logger[_0x9d8d('0xb')](_0x9d8d('0x5b'),_0x26c56d['id']);return getTicket(_0x24979c,_0x44e349,_0x26c56d,_0x142a37,_0x428b3a,_0x142a37[_0x9d8d('0x5c')],_0x456294,_0x9d8d('0x5d'));})['then'](function(_0x5719c6){_0x27d89f=_0x5719c6;logger[_0x9d8d('0xb')](_0x9d8d('0x5e'));logger['info'](_0x9d8d('0x5f'),_0x27d89f['id']);return setRelationship(_0x456294,_0x44e349,_0x27d89f,'users');})[_0x9d8d('0x28')](function(){return setRelationship(_0x456294,_0x26c56d,_0x27d89f,_0x9d8d('0x60'));})[_0x9d8d('0x28')](function(){return getServerInfo(_0x456294);})[_0x9d8d('0x28')](function(_0x212374){var _0x4aba4b=parseInt(_0x212374[_0x9d8d('0x61')][_0x9d8d('0x62')](0x0));var _0x508fa0=util[_0x9d8d('0x1f')](_0x9d8d('0x63'),_0x24979c[_0x9d8d('0x4f')],_0x27d89f['id']);if(_0x4aba4b>0x6){_0x508fa0=util[_0x9d8d('0x1f')](_0x9d8d('0x64'),_0x24979c[_0x9d8d('0x4f')],_0x27d89f['id']);}logger['info'](_0x9d8d('0x54'),_0x9d8d('0x65'));emit(util['format'](_0x9d8d('0x66'),_0x3c51f6['name']),'trigger:browser:url',{'uri':_0x508fa0});})['catch'](function(_0x37cf51){logger[_0x9d8d('0x67')](_0x9d8d('0x54'),JSON[_0x9d8d('0x1e')](_0x37cf51));});};exports[_0x9d8d('0x68')]=function(_0x2200c7,_0x371cc4,_0x56764c,_0x4e135b,_0x416432,_0x3f629a,_0x26481c){var _0x3b9989,_0x5a4d06,_0xc6e44f,_0x5f771b;_0x3f629a[_0x9d8d('0x4f')]=intUtil[_0x9d8d('0x4e')](_0x3f629a[_0x9d8d('0x4f')]);_0x3f629a[_0x9d8d('0x50')]=intUtil[_0x9d8d('0x4e')](_0x3f629a[_0x9d8d('0x50')]);def[_0x9d8d('0x51')]=util[_0x9d8d('0x1f')](_0x9d8d('0x52'),_0x3f629a[_0x9d8d('0x4f')]);if(_0x26481c&&_0x26481c[_0x9d8d('0x69')]&&_0x26481c['recordingFormat']!==_0x9d8d('0x6a')){logger[_0x9d8d('0xb')](_0x9d8d('0x6b'),'Recording\x20is\x20enabled!');_0x371cc4[_0x9d8d('0x6c')]=util[_0x9d8d('0x1f')](_0x9d8d('0x56'),_0x3f629a[_0x9d8d('0x50')],_0x371cc4[_0x9d8d('0x57')],md5(_0x371cc4['uniqueid']));}return getConnection(_0x3f629a)[_0x9d8d('0x28')](function(_0x14b563){_0x5f771b=_0x14b563;return getUser(_0x3f629a,_0x4e135b[_0x9d8d('0x17')],_0x5f771b);})['then'](function(_0xacc53a){_0x3b9989=_0xacc53a;logger[_0x9d8d('0xb')]('The\x20User\x20ID\x20is:',_0x3b9989['id']);return getEndUser(_0x3f629a,_0x371cc4[_0x9d8d('0x6d')],_0x371cc4[_0x9d8d('0x6e')],_0x5f771b);})[_0x9d8d('0x28')](function(_0x263514){_0x5a4d06=_0x263514;logger[_0x9d8d('0xb')](_0x9d8d('0x5b'),_0x5a4d06['id']);return getTicket(_0x3f629a,_0x3b9989,_0x5a4d06,_0x56764c,_0x371cc4,_0x56764c['Fields'],_0x5f771b,_0x9d8d('0x6f'));})['then'](function(_0x39e43c){_0xc6e44f=_0x39e43c;logger[_0x9d8d('0xb')](_0x9d8d('0x5e'));logger['info'](_0x9d8d('0x5f'),_0xc6e44f['id']);return setRelationship(_0x5f771b,_0x3b9989,_0xc6e44f,_0x9d8d('0x70'));})[_0x9d8d('0x28')](function(){return setRelationship(_0x5f771b,_0x5a4d06,_0xc6e44f,'contacts');})[_0x9d8d('0x28')](function(){return getServerInfo(_0x5f771b);})[_0x9d8d('0x28')](function(_0x1cedb9){var _0x9ebaef=parseInt(_0x1cedb9[_0x9d8d('0x61')][_0x9d8d('0x62')](0x0));var _0x19b5c7=util[_0x9d8d('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3f629a['remoteUri'],_0xc6e44f['id']);if(_0x9ebaef>0x6){_0x19b5c7=util['format'](_0x9d8d('0x64'),_0x3f629a[_0x9d8d('0x4f')],_0xc6e44f['id']);}logger[_0x9d8d('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9d8d('0x1f')](_0x9d8d('0x66'),_0x4e135b[_0x9d8d('0x17')]),'trigger:browser:url',{'uri':_0x19b5c7});})[_0x9d8d('0x71')](function(_0x26ad5c){logger[_0x9d8d('0x67')](_0x9d8d('0x6b'),JSON[_0x9d8d('0x1e')](_0x26ad5c));});};exports[_0x9d8d('0x72')]=function(_0x5a3157,_0x48c789,_0x76e4b,_0x3a0cb7,_0x58fb14,_0x575183){var _0xeffea1,_0x1a0e64,_0x5bbdf2,_0x281c00;_0x575183['remoteUri']=intUtil[_0x9d8d('0x4e')](_0x575183[_0x9d8d('0x4f')]);_0x575183[_0x9d8d('0x50')]=intUtil['stripTrailingSlash'](_0x575183['serverUrl']);def[_0x9d8d('0x51')]=util[_0x9d8d('0x1f')]('%s/service/v4_1/rest.php',_0x575183[_0x9d8d('0x4f')]);if(_0x58fb14&&_0x58fb14[_0x9d8d('0x53')]){logger[_0x9d8d('0xb')]('['+_0x48c789[_0x9d8d('0x73')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x48c789[_0x9d8d('0x6c')]=util['format'](_0x9d8d('0x56'),_0x575183[_0x9d8d('0x50')],_0x48c789[_0x9d8d('0x57')],md5(_0x48c789[_0x9d8d('0x57')]));}else{_0x48c789['recordingURL']='';}return getConnection(_0x575183)[_0x9d8d('0x28')](function(_0x4456cc){_0x281c00=_0x4456cc;if(!_[_0x9d8d('0x24')](_0x3a0cb7)){return getUser(_0x575183,_0x3a0cb7[_0x9d8d('0x17')],_0x281c00);}else{return getUser(_0x575183,null,_0x281c00);}})[_0x9d8d('0x28')](function(_0xcc3e55){_0xeffea1=_0xcc3e55;logger[_0x9d8d('0xb')](_0x9d8d('0x58'),_0xeffea1['id']);return getEndUser(_0x575183,_0x48c789['calleridname'],_0x48c789[_0x9d8d('0x5a')],_0x281c00);})[_0x9d8d('0x28')](function(_0x5c33cf){_0x1a0e64=_0x5c33cf;logger['info'](_0x9d8d('0x5b'),_0x1a0e64['id']);return getTicket(_0x575183,_0xeffea1,_0x1a0e64,_0x76e4b,_0x48c789,_0x76e4b[_0x9d8d('0x5c')],_0x281c00,_0x9d8d('0x5d'));})['then'](function(_0x1bd6f8){_0x5bbdf2=_0x1bd6f8;logger[_0x9d8d('0xb')](_0x9d8d('0x5e'));logger[_0x9d8d('0xb')](_0x9d8d('0x5f'),_0x5bbdf2['id']);return setRelationship(_0x281c00,_0xeffea1,_0x5bbdf2,_0x9d8d('0x70'));})[_0x9d8d('0x28')](function(){return setRelationship(_0x281c00,_0x1a0e64,_0x5bbdf2,_0x9d8d('0x60'));})['then'](function(){return getServerInfo(_0x281c00);})[_0x9d8d('0x71')](function(_0x32c5d8){logger[_0x9d8d('0x67')]('['+_0x48c789[_0x9d8d('0x73')]['toUpperCase']()+']',JSON[_0x9d8d('0x1e')](_0x32c5d8));});}; \ 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 1dd2a18..1ebc708 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 _0xd9c9=['type','string','content','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','slice','substring','lastIndexOf','isNil','test','lodash','util','getString','length'];(function(_0x795fcc,_0x57d6ba){var _0x5d634e=function(_0x417344){while(--_0x417344){_0x795fcc['push'](_0x795fcc['shift']());}};_0x5d634e(++_0x57d6ba);}(_0xd9c9,0x1be));var _0x9d9c=function(_0x59e903,_0x303626){_0x59e903=_0x59e903-0x0;var _0x21e3f6=_0xd9c9[_0x59e903];return _0x21e3f6;};'use strict';var _=require(_0x9d9c('0x0'));var util=require(_0x9d9c('0x1'));exports[_0x9d9c('0x2')]=function(_0x95dc7e,_0x1ed1cf,_0x14f20c){var _0x8fd703=[];if(_0x95dc7e['length']>0x0){var _0x19b931=_['sortBy'](_0x95dc7e,['id']);for(var _0x9c2eaa=0x0;_0x9c2eaa<_0x19b931[_0x9d9c('0x3')];_0x9c2eaa++){var _0x388913=_0x19b931[_0x9c2eaa];if(_0x388913[_0x9d9c('0x4')]===_0x9d9c('0x5')){_0x8fd703['push'](_0x388913[_0x9d9c('0x6')]);}else if(_0x388913[_0x9d9c('0x4')]===_0x9d9c('0x7')&&_0x388913[_0x9d9c('0x8')]){_0x1ed1cf[_0x388913[_0x9d9c('0x8')]]&&_0x8fd703[_0x9d9c('0x9')](_0x1ed1cf[_0x388913[_0x9d9c('0x8')]][_0x9d9c('0xa')]());}else if(_0x388913['type']==='customVariable'&&_0x388913['Variable']&&_0x388913[_0x9d9c('0xb')][_0x9d9c('0xc')]){_0x1ed1cf[_0x388913[_0x9d9c('0xb')][_0x9d9c('0xc')][_0x9d9c('0xd')]()]&&_0x8fd703[_0x9d9c('0x9')](_0x1ed1cf[_0x388913[_0x9d9c('0xb')][_0x9d9c('0xc')][_0x9d9c('0xd')]()][_0x9d9c('0xa')]());}else if(_0x388913[_0x9d9c('0x4')]===_0x9d9c('0xe')){if(_0x388913[_0x9d9c('0xf')]===_0x9d9c('0x5')&&_0x388913['key']){_0x8fd703[_0x9d9c('0x9')](util[_0x9d9c('0x10')](_0x9d9c('0x11'),_0x388913[_0x9d9c('0x12')],_0x388913[_0x9d9c('0x13')]));}else if(_0x388913[_0x9d9c('0xf')]==='variable'&&_0x388913[_0x9d9c('0x8')]&&_0x388913[_0x9d9c('0x12')]){_0x1ed1cf[_0x388913[_0x9d9c('0x8')]]&&_0x8fd703['push'](util[_0x9d9c('0x10')](_0x9d9c('0x11'),_0x388913['key'],_0x1ed1cf[_0x388913[_0x9d9c('0x8')]]));}else if(_0x388913['keyType']==='customVariable'&&_0x388913['Variable']&&_0x388913[_0x9d9c('0xb')][_0x9d9c('0xc')]&&_0x388913[_0x9d9c('0x12')]){_0x1ed1cf[_0x388913[_0x9d9c('0xb')][_0x9d9c('0xc')][_0x9d9c('0xd')]()]&&_0x8fd703[_0x9d9c('0x9')](util[_0x9d9c('0x10')](_0x9d9c('0x11'),_0x388913['key'],_0x1ed1cf[_0x388913['Variable'][_0x9d9c('0xc')][_0x9d9c('0xd')]()]));}}}}return _0x8fd703['join'](_0x14f20c);};exports['stripTrailingSlash']=function(_0x4caadf){var _0x215b4b=_0x4caadf[_0x9d9c('0x14')](-0x1);if(_0x215b4b==='/'){_0x4caadf=_0x4caadf[_0x9d9c('0x15')](0x0,_0x4caadf[_0x9d9c('0x16')](_0x215b4b));}return _0x4caadf;};exports['validateEmail']=function(_0x3155e2){if(!_[_0x9d9c('0x17')](_0x3155e2)&&_0x3155e2!==''){var _0x1c0ca0=/^(([^<>()\[\]\\.,;:\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 _0x1c0ca0[_0x9d9c('0x18')](String(_0x3155e2)[_0x9d9c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x70fe=['lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','substring','lastIndexOf','isNil','test'];(function(_0x110dc0,_0x3a6615){var _0x39aeb1=function(_0x46fa33){while(--_0x46fa33){_0x110dc0['push'](_0x110dc0['shift']());}};_0x39aeb1(++_0x3a6615);}(_0x70fe,0xd0));var _0xe70f=function(_0x39fc77,_0x5d1690){_0x39fc77=_0x39fc77-0x0;var _0x4f7478=_0x70fe[_0x39fc77];return _0x4f7478;};'use strict';var _=require(_0xe70f('0x0'));var util=require(_0xe70f('0x1'));exports[_0xe70f('0x2')]=function(_0x2605ab,_0x32a8d1,_0x2f9375){var _0x4b1214=[];if(_0x2605ab[_0xe70f('0x3')]>0x0){var _0x167629=_[_0xe70f('0x4')](_0x2605ab,['id']);for(var _0xb1c238=0x0;_0xb1c238<_0x167629['length'];_0xb1c238++){var _0x40d26a=_0x167629[_0xb1c238];if(_0x40d26a['type']===_0xe70f('0x5')){_0x4b1214[_0xe70f('0x6')](_0x40d26a[_0xe70f('0x7')]);}else if(_0x40d26a[_0xe70f('0x8')]===_0xe70f('0x9')&&_0x40d26a[_0xe70f('0xa')]){_0x32a8d1[_0x40d26a[_0xe70f('0xa')]]&&_0x4b1214['push'](_0x32a8d1[_0x40d26a['variableName']][_0xe70f('0xb')]());}else if(_0x40d26a['type']===_0xe70f('0xc')&&_0x40d26a[_0xe70f('0xd')]&&_0x40d26a[_0xe70f('0xd')][_0xe70f('0xe')]){_0x32a8d1[_0x40d26a[_0xe70f('0xd')]['name']['toLowerCase']()]&&_0x4b1214[_0xe70f('0x6')](_0x32a8d1[_0x40d26a[_0xe70f('0xd')][_0xe70f('0xe')][_0xe70f('0xf')]()][_0xe70f('0xb')]());}else if(_0x40d26a['type']===_0xe70f('0x10')){if(_0x40d26a[_0xe70f('0x11')]===_0xe70f('0x5')&&_0x40d26a[_0xe70f('0x12')]){_0x4b1214[_0xe70f('0x6')](util[_0xe70f('0x13')](_0xe70f('0x14'),_0x40d26a[_0xe70f('0x12')],_0x40d26a['keyContent']));}else if(_0x40d26a[_0xe70f('0x11')]===_0xe70f('0x9')&&_0x40d26a[_0xe70f('0xa')]&&_0x40d26a[_0xe70f('0x12')]){_0x32a8d1[_0x40d26a['variableName']]&&_0x4b1214[_0xe70f('0x6')](util[_0xe70f('0x13')]('%s:\x20%s',_0x40d26a[_0xe70f('0x12')],_0x32a8d1[_0x40d26a[_0xe70f('0xa')]]));}else if(_0x40d26a[_0xe70f('0x11')]==='customVariable'&&_0x40d26a['Variable']&&_0x40d26a[_0xe70f('0xd')][_0xe70f('0xe')]&&_0x40d26a[_0xe70f('0x12')]){_0x32a8d1[_0x40d26a['Variable'][_0xe70f('0xe')][_0xe70f('0xf')]()]&&_0x4b1214[_0xe70f('0x6')](util[_0xe70f('0x13')](_0xe70f('0x14'),_0x40d26a['key'],_0x32a8d1[_0x40d26a[_0xe70f('0xd')][_0xe70f('0xe')][_0xe70f('0xf')]()]));}}}}return _0x4b1214[_0xe70f('0x15')](_0x2f9375);};exports['stripTrailingSlash']=function(_0x15b6b1){var _0x2683a9=_0x15b6b1['slice'](-0x1);if(_0x2683a9==='/'){_0x15b6b1=_0x15b6b1[_0xe70f('0x16')](0x0,_0x15b6b1[_0xe70f('0x17')](_0x2683a9));}return _0x15b6b1;};exports['validateEmail']=function(_0x44780e){if(!_[_0xe70f('0x18')](_0x44780e)&&_0x44780e!==''){var _0x574db6=/^(([^<>()\[\]\\.,;:\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 _0x574db6[_0xe70f('0x19')](String(_0x44780e)[_0xe70f('0xf')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 36254c5..1da7dd8 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x2fe11a,_0x8848c6){var _0xe60e7b=function(_0x23f6d2){while(--_0x23f6d2){_0x2fe11a['push'](_0x2fe11a['shift']());}};_0xe60e7b(++_0x8848c6);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x5eb095,_0x1e27a8){var _0x198e3c=function(_0x5110ae){while(--_0x5110ae){_0x5eb095['push'](_0x5eb095['shift']());}};_0x198e3c(++_0x1e27a8);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index e94faf5..45b5e2f 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 _0x421d=['custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','The\x20Ticket\x20ID\x20is:','integrationTab','[OUTBOUND]','%s/agent/tickets/%s','replace','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','customField','nameField','content','toString','picklist','idField'];(function(_0x3dce5d,_0x2657d7){var _0x303d00=function(_0x2f0175){while(--_0x2f0175){_0x3dce5d['push'](_0x3dce5d['shift']());}};_0x303d00(++_0x2657d7);}(_0x421d,0x16d));var _0xd421=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x421d[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xd421('0x0'));var rp=require('request-promise');var md5=require(_0xd421('0x1'));var util=require(_0xd421('0x2'));var Redis=require(_0xd421('0x3'));var intUtil=require(_0xd421('0x4'));var config=require(_0xd421('0x5'));var logger=require('../../../../config/logger')(_0xd421('0x6'));config['redis']=_[_0xd421('0x7')](config[_0xd421('0x8')],{'host':_0xd421('0x9'),'port':0x18eb});var io=require(_0xd421('0xa'))(new Redis(config['redis']));function emit(_0x4add72,_0xb2430d,_0x40afef){io['to'](_0x4add72)[_0xd421('0xb')](_0xb2430d,_0x40afef);}var headers={'Content-Type':_0xd421('0xc'),'Accept':_0xd421('0xc')};function getTicket(_0x46fa2b,_0x5a045f,_0x38739f,_0x1cc442,_0x29a318){logger[_0xd421('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xd421('0xe')](_0xd421('0xf'),_0x46fa2b[_0xd421('0x10')]),'method':_0xd421('0x11'),'body':{'ticket':_[_0xd421('0x12')]({'requester_id':_0x38739f['id'],'submitter_id':_0x5a045f?_0x5a045f['id']:undefined,'assignee_id':_0x5a045f?_0x5a045f['id']:undefined,'tags':getTags(_0x1cc442[_0xd421('0x13')],_0xd421('0x14')),'subject':intUtil[_0xd421('0x15')](_0x1cc442[_0xd421('0x16')],_0x29a318,'\x20'),'description':intUtil[_0xd421('0x15')](_0x1cc442[_0xd421('0x17')],_0x29a318,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd421('0x15')](_0x1cc442[_0xd421('0x17')],_0x29a318,'\x0a')}},getCustomFields(_0x1cc442[_0xd421('0x18')],_0x29a318))}})['then'](function(_0x2a0e70){logger[_0xd421('0xd')]('Ticket\x20created!');return _0x2a0e70[_0xd421('0x19')];});}function getUser(_0x56cdd4,_0x3c4749){if(intUtil[_0xd421('0x1a')](_0x3c4749)){logger[_0xd421('0xd')](_0xd421('0x1b'),_0x3c4749);return request({'uri':util['format'](_0xd421('0x1c'),_0x56cdd4[_0xd421('0x10')]),'qs':{'query':util[_0xd421('0xe')]('type:user\x20role:agent\x20email:%s',_0x3c4749)}})[_0xd421('0x1d')](function(_0x1622d9){if(_0x1622d9[_0xd421('0x1e')]){logger[_0xd421('0xd')]('Agent\x20found!');return _[_0xd421('0x1f')](_0x1622d9[_0xd421('0x20')],{'email':_0x3c4749,'role':_0xd421('0x21')});}else{logger[_0xd421('0xd')](_0xd421('0x22'));return request({'uri':util[_0xd421('0xe')](_0xd421('0x23'),_0x56cdd4[_0xd421('0x10')])})[_0xd421('0x1d')](function(_0x4b7fc3){logger[_0xd421('0xd')](_0xd421('0x24'));return _0x4b7fc3[_0xd421('0x25')];});}});}else{logger[_0xd421('0xd')](_0xd421('0x22'));return request({'uri':util[_0xd421('0xe')]('%s/users/me.json',_0x56cdd4[_0xd421('0x10')])})[_0xd421('0x1d')](function(_0x18ba68){logger[_0xd421('0xd')](_0xd421('0x24'));return _0x18ba68['user'];});}}function getEndUser(_0x5da4cf,_0x4630c2,_0x4c911c){logger[_0xd421('0xd')]('Searching\x20enduser\x20with\x20phone',_0x4c911c);return request({'uri':util['format'](_0xd421('0x1c'),_0x5da4cf['remoteUri']),'qs':{'query':util['format'](_0xd421('0x26'),_0x4c911c)}})['then'](function(_0x5aa5ac){var _0x2a4630;if(_0x5aa5ac[_0xd421('0x20')][_0xd421('0x27')]){_0x5aa5ac[_0xd421('0x20')]=_[_0xd421('0x28')](_0x5aa5ac[_0xd421('0x20')],{'suspended':![],'role':_0xd421('0x29')});if(_0x5aa5ac['results'][_0xd421('0x27')]){_0x2a4630=_[_0xd421('0x2a')](_0x5aa5ac[_0xd421('0x20')]);}}if(_0x2a4630){logger[_0xd421('0xd')]('Enduser\x20found!');return _0x2a4630;}else{logger[_0xd421('0xd')](_0xd421('0x2b'));return request({'uri':util[_0xd421('0xe')]('%s/users.json',_0x5da4cf[_0xd421('0x10')]),'method':_0xd421('0x11'),'body':{'user':{'role':_0xd421('0x29'),'name':util[_0xd421('0xe')](_0xd421('0x2c'),_0x4630c2||_0x4c911c),'phone':_0x4c911c}}})[_0xd421('0x1d')](function(_0x5ad336){logger[_0xd421('0xd')]('Enduser\x20created.');return _0x5ad336[_0xd421('0x25')];});}});}function getAuth(_0x25f1ea){var _0x41138d;if(_0x25f1ea[_0xd421('0x2d')]===_0xd421('0x2e')){_0x41138d=util['format'](_0xd421('0x2f'),_0x25f1ea[_0xd421('0x30')],_0x25f1ea[_0xd421('0x2e')]);}else if(_0x25f1ea[_0xd421('0x2d')]===_0xd421('0x31')){_0x41138d=util[_0xd421('0xe')](_0xd421('0x32'),_0x25f1ea[_0xd421('0x30')],_0x25f1ea[_0xd421('0x31')]);}return util[_0xd421('0xe')]('Basic\x20%s',new Buffer(_0x41138d)['toString'](_0xd421('0x33')));}function request(_0x2d30a4){logger[_0xd421('0x34')](_0xd421('0x35'),JSON[_0xd421('0x36')](_0x2d30a4));return rp(_[_0xd421('0x7')](_0x2d30a4,{'method':_0xd421('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x5a73c7,_0x17cd47){var _0x14611b=[];if(_0x5a73c7&&_0x5a73c7['length']>0x0){_0x14611b=_[_0xd421('0x38')](_0x5a73c7,_0x17cd47);}return _0x14611b;}function getCustomFields(_0x5b679e,_0x1244a7){var _0x2c4708=[];var _0x1f7a25={'custom_fields':[]};if(_0x5b679e[_0xd421('0x27')]>0x0){_[_0xd421('0x39')](_0x5b679e,function(_0x5c293c){if(_[_0xd421('0x3a')]([_0xd421('0x3b'),'picklist'],_0x5c293c[_0xd421('0x3c')])&&_0x5c293c['nameField']&&!_0x5c293c[_0xd421('0x3d')]){_0x1f7a25[_0x5c293c[_0xd421('0x3e')]['toLowerCase']()]=_0x5c293c[_0xd421('0x3f')][_0xd421('0x40')]();}else if(_[_0xd421('0x3a')](['string',_0xd421('0x41')],_0x5c293c[_0xd421('0x3c')])&&_0x5c293c[_0xd421('0x42')]&&_0x5c293c[_0xd421('0x3d')]){_0x1f7a25[_0xd421('0x43')][_0xd421('0x44')]({'id':_0x5c293c[_0xd421('0x42')],'value':_0x5c293c[_0xd421('0x3f')]['toString']()});}else if(_0x5c293c[_0xd421('0x3c')]===_0xd421('0x45')&&_0x5c293c[_0xd421('0x46')]&&_0x5c293c[_0xd421('0x42')]&&_0x5c293c[_0xd421('0x3d')]){_0x1244a7[_0x5c293c[_0xd421('0x46')]]&&_0x1f7a25[_0xd421('0x43')][_0xd421('0x44')]({'id':_0x5c293c[_0xd421('0x42')],'value':_0x1244a7[_0x5c293c[_0xd421('0x46')]]['toString']()});}else if(_0x5c293c[_0xd421('0x3c')]===_0xd421('0x47')&&_0x5c293c['Variable']&&_0x5c293c['Variable'][_0xd421('0x14')]&&_0x5c293c[_0xd421('0x42')]&&_0x5c293c['customField']){_0x1244a7[_0x5c293c[_0xd421('0x48')]['name'][_0xd421('0x49')]()]&&_0x1f7a25[_0xd421('0x43')]['push']({'id':_0x5c293c[_0xd421('0x42')],'value':_0x1244a7[_0x5c293c[_0xd421('0x48')]['name']['toLowerCase']()][_0xd421('0x40')]()});}});}return _0x1f7a25;}exports[_0xd421('0x4a')]=function(_0x2abafa,_0x476c90,_0x465740,_0xa5492e,_0x4c6c1a,_0x59f60c){var _0x27c1e5,_0x243edf;_0x59f60c['remoteUri']=intUtil[_0xd421('0x4b')](_0x59f60c['remoteUri']);_0x59f60c[_0xd421('0x4c')]=intUtil[_0xd421('0x4b')](_0x59f60c[_0xd421('0x4c')]);if(_0x4c6c1a&&_0x4c6c1a['monitor_format']){logger[_0xd421('0xd')](_0xd421('0x4d'),_0xd421('0x4e'));_0x476c90[_0xd421('0x4f')]=util[_0xd421('0xe')](_0xd421('0x50'),_0x59f60c[_0xd421('0x4c')],_0x476c90[_0xd421('0x51')],md5(_0x476c90['uniqueid']));}else{_0x476c90[_0xd421('0x4f')]='';}headers[_0xd421('0x52')]=getAuth(_0x59f60c);return getUser(_0x59f60c,_0xa5492e['email'])[_0xd421('0x1d')](function(_0x4ea10f){_0x27c1e5=_0x4ea10f;logger[_0xd421('0xd')](_0xd421('0x53'),_0x27c1e5['id']);return getEndUser(_0x59f60c,_0x476c90[_0xd421('0x54')],_0x476c90[_0xd421('0x55')]);})[_0xd421('0x1d')](function(_0x55d5ce){_0x243edf=_0x55d5ce;logger[_0xd421('0xd')](_0xd421('0x56'),_0x243edf['id']);return getTicket(_0x59f60c,_0x27c1e5,_0x243edf,_0x465740,_0x476c90);})[_0xd421('0x1d')](function(_0x33378d){if(_0x33378d){logger[_0xd421('0xd')]('The\x20Ticket\x20ID\x20is:',_0x33378d['id']);switch(_0x59f60c[_0xd421('0x3c')]){case'integrationTab':logger[_0xd421('0xd')](_0xd421('0x4d'),_0xd421('0x57'));return request({'uri':util[_0xd421('0xe')](_0xd421('0x58'),_0x59f60c[_0xd421('0x10')],_0x27c1e5['id'],_0x33378d['id']),'method':_0xd421('0x11')});case _0xd421('0x59'):logger[_0xd421('0xd')](_0xd421('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd421('0xe')](_0xd421('0x5a'),_0xa5492e[_0xd421('0x14')]),_0xd421('0x5b'),{'uri':util[_0xd421('0xe')]('%s/agent/tickets/%s',_0x59f60c[_0xd421('0x10')]['replace'](_0xd421('0x5c'),''),_0x33378d['id'])});break;default:logger[_0xd421('0x5d')](_0xd421('0x4d'),_0xd421('0x5e'));}}})[_0xd421('0x5f')](function(_0xe31a2e){logger[_0xd421('0x5d')](_0xd421('0x60'),util[_0xd421('0x61')](_0xe31a2e,{'showHidden':!![],'depth':null}));});};exports[_0xd421('0x62')]=function(_0x246de5,_0xe29e43,_0x3e97e7,_0x443ada,_0x3284c2,_0x4f8522,_0x2b404e){var _0x20f75c,_0x245182;_0x4f8522['remoteUri']=intUtil[_0xd421('0x4b')](_0x4f8522[_0xd421('0x10')]);_0x4f8522['serverUrl']=intUtil[_0xd421('0x4b')](_0x4f8522[_0xd421('0x4c')]);if(_0x2b404e&&_0x2b404e[_0xd421('0x63')]&&_0x2b404e['recordingFormat']!==_0xd421('0x64')){logger[_0xd421('0xd')]('[OUTBOUND]',_0xd421('0x4e'));_0xe29e43[_0xd421('0x4f')]=util[_0xd421('0xe')](_0xd421('0x50'),_0x4f8522[_0xd421('0x4c')],_0xe29e43[_0xd421('0x51')],md5(_0xe29e43[_0xd421('0x51')]));}headers[_0xd421('0x52')]=getAuth(_0x4f8522);return getUser(_0x4f8522,_0x443ada['email'])[_0xd421('0x1d')](function(_0x278ad4){_0x20f75c=_0x278ad4;logger[_0xd421('0xd')]('The\x20User\x20ID\x20is:',_0x20f75c['id']);return getEndUser(_0x4f8522,_0xe29e43['destcalleridname'],_0xe29e43['destcalleridnum']);})['then'](function(_0x258704){_0x245182=_0x258704;logger[_0xd421('0xd')](_0xd421('0x56'),_0x245182['id']);return getTicket(_0x4f8522,_0x20f75c,_0x245182,_0x3e97e7,_0xe29e43);})['then'](function(_0x89246f){if(_0x89246f){logger[_0xd421('0xd')](_0xd421('0x65'),_0x89246f['id']);switch(_0x4f8522[_0xd421('0x3c')]){case _0xd421('0x66'):logger[_0xd421('0xd')](_0xd421('0x67'),_0xd421('0x57'));return request({'uri':util[_0xd421('0xe')](_0xd421('0x58'),_0x4f8522[_0xd421('0x10')],_0x20f75c['id'],_0x89246f['id']),'method':_0xd421('0x11')});case _0xd421('0x59'):logger[_0xd421('0xd')](_0xd421('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd421('0xe')]('user:%s',_0x443ada[_0xd421('0x14')]),_0xd421('0x5b'),{'uri':util['format'](_0xd421('0x68'),_0x4f8522[_0xd421('0x10')][_0xd421('0x69')](_0xd421('0x5c'),''),_0x89246f['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd421('0x5f')](function(_0x28ab08){logger[_0xd421('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x28ab08,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3359b3,_0x332f0b,_0xaf18f0,_0x5de9ea,_0x277196,_0x1a4dc1){var _0x807b00,_0x2a7948;_0x1a4dc1['remoteUri']=intUtil[_0xd421('0x4b')](_0x1a4dc1[_0xd421('0x10')]);_0x1a4dc1[_0xd421('0x4c')]=intUtil[_0xd421('0x4b')](_0x1a4dc1['serverUrl']);if(_0x277196&&_0x277196['monitor_format']){logger[_0xd421('0xd')]('['+_0x332f0b[_0xd421('0x6a')][_0xd421('0x6b')]()+']',_0xd421('0x4e'));_0x332f0b[_0xd421('0x4f')]=util[_0xd421('0xe')](_0xd421('0x50'),_0x1a4dc1[_0xd421('0x4c')],_0x332f0b[_0xd421('0x51')],md5(_0x332f0b[_0xd421('0x51')]));}else{_0x332f0b[_0xd421('0x4f')]='';}headers['Authorization']=getAuth(_0x1a4dc1);return getUser(_0x1a4dc1)[_0xd421('0x1d')](function(_0x4dcc57){_0x807b00=_0x4dcc57;logger[_0xd421('0xd')]('The\x20User\x20ID\x20is:',_0x807b00['id']);return getEndUser(_0x1a4dc1,_0x332f0b[_0xd421('0x54')],_0x332f0b[_0xd421('0x55')]);})['then'](function(_0x27300e){_0x2a7948=_0x27300e;logger[_0xd421('0xd')](_0xd421('0x56'),_0x2a7948['id']);return getTicket(_0x1a4dc1,_0x807b00,_0x2a7948,_0xaf18f0,_0x332f0b);})[_0xd421('0x1d')](function(_0x16cf09){if(_0x16cf09){logger['info']('The\x20Ticket\x20ID\x20is:',_0x16cf09['id']);}})[_0xd421('0x5f')](function(_0x5ede68){logger[_0xd421('0x5d')]('['+_0x332f0b[_0xd421('0x6a')][_0xd421('0x6b')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x5ede68,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x389f=['stringify','GET','map','forEach','includes','string','picklist','nameField','content','type','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','%s/agent/tickets/%s','inspect','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','filter','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','toString','base64','debug','[HTTP]'];(function(_0x1891c4,_0x190b1f){var _0x1aab80=function(_0x3162a3){while(--_0x3162a3){_0x1891c4['push'](_0x1891c4['shift']());}};_0x1aab80(++_0x190b1f);}(_0x389f,0x118));var _0xf389=function(_0x3c12e0,_0x4d6975){_0x3c12e0=_0x3c12e0-0x0;var _0x558fdd=_0x389f[_0x3c12e0];return _0x558fdd;};'use strict';var _=require(_0xf389('0x0'));var rp=require(_0xf389('0x1'));var md5=require(_0xf389('0x2'));var util=require('util');var Redis=require(_0xf389('0x3'));var intUtil=require(_0xf389('0x4'));var config=require('../../../../config/environment');var logger=require(_0xf389('0x5'))(_0xf389('0x6'));config['redis']=_[_0xf389('0x7')](config[_0xf389('0x8')],{'host':_0xf389('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf389('0x8')]));function emit(_0x328aa9,_0x78ad21,_0x27ec5d){io['to'](_0x328aa9)[_0xf389('0xa')](_0x78ad21,_0x27ec5d);}var headers={'Content-Type':_0xf389('0xb'),'Accept':_0xf389('0xb')};function getTicket(_0x568105,_0x5a62e6,_0x505658,_0x2aea92,_0x84aca2){logger[_0xf389('0xc')](_0xf389('0xd'));return request({'uri':util['format'](_0xf389('0xe'),_0x568105[_0xf389('0xf')]),'method':_0xf389('0x10'),'body':{'ticket':_[_0xf389('0x11')]({'requester_id':_0x505658['id'],'submitter_id':_0x5a62e6?_0x5a62e6['id']:undefined,'assignee_id':_0x5a62e6?_0x5a62e6['id']:undefined,'tags':getTags(_0x2aea92[_0xf389('0x12')],'name'),'subject':intUtil['getString'](_0x2aea92['Subjects'],_0x84aca2,'\x20'),'description':intUtil[_0xf389('0x13')](_0x2aea92[_0xf389('0x14')],_0x84aca2,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf389('0x13')](_0x2aea92[_0xf389('0x14')],_0x84aca2,'\x0a')}},getCustomFields(_0x2aea92[_0xf389('0x15')],_0x84aca2))}})[_0xf389('0x16')](function(_0x436283){logger[_0xf389('0xc')](_0xf389('0x17'));return _0x436283[_0xf389('0x18')];});}function getUser(_0x33f9cc,_0x71ffbb){if(intUtil[_0xf389('0x19')](_0x71ffbb)){logger[_0xf389('0xc')](_0xf389('0x1a'),_0x71ffbb);return request({'uri':util[_0xf389('0x1b')](_0xf389('0x1c'),_0x33f9cc[_0xf389('0xf')]),'qs':{'query':util[_0xf389('0x1b')](_0xf389('0x1d'),_0x71ffbb)}})[_0xf389('0x16')](function(_0xc8e783){if(_0xc8e783['count']){logger[_0xf389('0xc')](_0xf389('0x1e'));return _[_0xf389('0x1f')](_0xc8e783[_0xf389('0x20')],{'email':_0x71ffbb,'role':_0xf389('0x21')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf389('0x1b')]('%s/users/me.json',_0x33f9cc['remoteUri'])})['then'](function(_0x26ea4f){logger[_0xf389('0xc')]('Admin\x20account\x20selected.');return _0x26ea4f['user'];});}});}else{logger[_0xf389('0xc')](_0xf389('0x22'));return request({'uri':util[_0xf389('0x1b')](_0xf389('0x23'),_0x33f9cc[_0xf389('0xf')])})[_0xf389('0x16')](function(_0x4fe25a){logger[_0xf389('0xc')]('Admin\x20account\x20selected.');return _0x4fe25a[_0xf389('0x24')];});}}function getEndUser(_0x1362a0,_0x16540b,_0x5bc5ae){logger[_0xf389('0xc')](_0xf389('0x25'),_0x5bc5ae);return request({'uri':util[_0xf389('0x1b')](_0xf389('0x1c'),_0x1362a0[_0xf389('0xf')]),'qs':{'query':util[_0xf389('0x1b')]('type:user\x20role:end-user\x20phone:%s',_0x5bc5ae)}})[_0xf389('0x16')](function(_0x27da2b){var _0x1d892c;if(_0x27da2b['results']['length']){_0x27da2b[_0xf389('0x20')]=_[_0xf389('0x26')](_0x27da2b[_0xf389('0x20')],{'suspended':![],'role':'end-user'});if(_0x27da2b[_0xf389('0x20')][_0xf389('0x27')]){_0x1d892c=_[_0xf389('0x28')](_0x27da2b[_0xf389('0x20')]);}}if(_0x1d892c){logger[_0xf389('0xc')](_0xf389('0x29'));return _0x1d892c;}else{logger[_0xf389('0xc')](_0xf389('0x2a'));return request({'uri':util[_0xf389('0x1b')]('%s/users.json',_0x1362a0['remoteUri']),'method':_0xf389('0x10'),'body':{'user':{'role':_0xf389('0x2b'),'name':util[_0xf389('0x1b')](_0xf389('0x2c'),_0x16540b||_0x5bc5ae),'phone':_0x5bc5ae}}})[_0xf389('0x16')](function(_0x30c13e){logger[_0xf389('0xc')](_0xf389('0x2d'));return _0x30c13e[_0xf389('0x24')];});}});}function getAuth(_0x2a76b2){var _0x2d196f;if(_0x2a76b2['authType']===_0xf389('0x2e')){_0x2d196f=util[_0xf389('0x1b')](_0xf389('0x2f'),_0x2a76b2[_0xf389('0x30')],_0x2a76b2[_0xf389('0x2e')]);}else if(_0x2a76b2[_0xf389('0x31')]===_0xf389('0x32')){_0x2d196f=util[_0xf389('0x1b')](_0xf389('0x33'),_0x2a76b2[_0xf389('0x30')],_0x2a76b2[_0xf389('0x32')]);}return util[_0xf389('0x1b')]('Basic\x20%s',new Buffer(_0x2d196f)[_0xf389('0x34')](_0xf389('0x35')));}function request(_0x1bf239){logger[_0xf389('0x36')](_0xf389('0x37'),JSON[_0xf389('0x38')](_0x1bf239));return rp(_[_0xf389('0x7')](_0x1bf239,{'method':_0xf389('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x488763,_0x48c5e4){var _0x26e46e=[];if(_0x488763&&_0x488763[_0xf389('0x27')]>0x0){_0x26e46e=_[_0xf389('0x3a')](_0x488763,_0x48c5e4);}return _0x26e46e;}function getCustomFields(_0x472fea,_0x4501bb){var _0xa20d70=[];var _0x393505={'custom_fields':[]};if(_0x472fea[_0xf389('0x27')]>0x0){_[_0xf389('0x3b')](_0x472fea,function(_0x61cccf){if(_[_0xf389('0x3c')]([_0xf389('0x3d'),_0xf389('0x3e')],_0x61cccf['type'])&&_0x61cccf[_0xf389('0x3f')]&&!_0x61cccf['customField']){_0x393505[_0x61cccf[_0xf389('0x3f')]['toLowerCase']()]=_0x61cccf[_0xf389('0x40')][_0xf389('0x34')]();}else if(_[_0xf389('0x3c')]([_0xf389('0x3d'),_0xf389('0x3e')],_0x61cccf[_0xf389('0x41')])&&_0x61cccf[_0xf389('0x42')]&&_0x61cccf[_0xf389('0x43')]){_0x393505[_0xf389('0x44')][_0xf389('0x45')]({'id':_0x61cccf[_0xf389('0x42')],'value':_0x61cccf[_0xf389('0x40')][_0xf389('0x34')]()});}else if(_0x61cccf[_0xf389('0x41')]===_0xf389('0x46')&&_0x61cccf[_0xf389('0x47')]&&_0x61cccf[_0xf389('0x42')]&&_0x61cccf[_0xf389('0x43')]){_0x4501bb[_0x61cccf[_0xf389('0x47')]]&&_0x393505[_0xf389('0x44')]['push']({'id':_0x61cccf['idField'],'value':_0x4501bb[_0x61cccf[_0xf389('0x47')]][_0xf389('0x34')]()});}else if(_0x61cccf[_0xf389('0x41')]===_0xf389('0x48')&&_0x61cccf[_0xf389('0x49')]&&_0x61cccf['Variable'][_0xf389('0x4a')]&&_0x61cccf[_0xf389('0x42')]&&_0x61cccf[_0xf389('0x43')]){_0x4501bb[_0x61cccf[_0xf389('0x49')][_0xf389('0x4a')][_0xf389('0x4b')]()]&&_0x393505[_0xf389('0x44')]['push']({'id':_0x61cccf[_0xf389('0x42')],'value':_0x4501bb[_0x61cccf[_0xf389('0x49')][_0xf389('0x4a')][_0xf389('0x4b')]()][_0xf389('0x34')]()});}});}return _0x393505;}exports[_0xf389('0x4c')]=function(_0x11161f,_0x4805ed,_0xe430c9,_0x306bb9,_0x98befd,_0x1bb314){var _0xb95264,_0x5c6694;_0x1bb314['remoteUri']=intUtil[_0xf389('0x4d')](_0x1bb314[_0xf389('0xf')]);_0x1bb314[_0xf389('0x4e')]=intUtil[_0xf389('0x4d')](_0x1bb314['serverUrl']);if(_0x98befd&&_0x98befd[_0xf389('0x4f')]){logger[_0xf389('0xc')]('[QUEUE]',_0xf389('0x50'));_0x4805ed[_0xf389('0x51')]=util[_0xf389('0x1b')](_0xf389('0x52'),_0x1bb314[_0xf389('0x4e')],_0x4805ed[_0xf389('0x53')],md5(_0x4805ed[_0xf389('0x53')]));}else{_0x4805ed['recordingURL']='';}headers['Authorization']=getAuth(_0x1bb314);return getUser(_0x1bb314,_0x306bb9['email'])[_0xf389('0x16')](function(_0x5242d3){_0xb95264=_0x5242d3;logger[_0xf389('0xc')](_0xf389('0x54'),_0xb95264['id']);return getEndUser(_0x1bb314,_0x4805ed[_0xf389('0x55')],_0x4805ed[_0xf389('0x56')]);})[_0xf389('0x16')](function(_0x42bb9b){_0x5c6694=_0x42bb9b;logger['info'](_0xf389('0x57'),_0x5c6694['id']);return getTicket(_0x1bb314,_0xb95264,_0x5c6694,_0xe430c9,_0x4805ed);})[_0xf389('0x16')](function(_0x3a5cea){if(_0x3a5cea){logger[_0xf389('0xc')](_0xf389('0x58'),_0x3a5cea['id']);switch(_0x1bb314['type']){case _0xf389('0x59'):logger[_0xf389('0xc')](_0xf389('0x5a'),_0xf389('0x5b'));return request({'uri':util['format'](_0xf389('0x5c'),_0x1bb314['remoteUri'],_0xb95264['id'],_0x3a5cea['id']),'method':_0xf389('0x10')});case _0xf389('0x5d'):logger[_0xf389('0xc')]('[QUEUE]',_0xf389('0x5e'));emit(util['format'](_0xf389('0x5f'),_0x306bb9['name']),'trigger:browser:url',{'uri':util[_0xf389('0x1b')]('%s/agent/tickets/%s',_0x1bb314['remoteUri']['replace'](_0xf389('0x60'),''),_0x3a5cea['id'])});break;default:logger[_0xf389('0x61')](_0xf389('0x5a'),_0xf389('0x62'));}}})[_0xf389('0x63')](function(_0x5b2714){logger[_0xf389('0x61')](_0xf389('0x64'),util['inspect'](_0x5b2714,{'showHidden':!![],'depth':null}));});};exports[_0xf389('0x65')]=function(_0x1ac7bc,_0x414420,_0x354950,_0x47195a,_0x23f93c,_0x13259d,_0x1d9bc8){var _0x5f0f38,_0x5263eb;_0x13259d[_0xf389('0xf')]=intUtil[_0xf389('0x4d')](_0x13259d[_0xf389('0xf')]);_0x13259d[_0xf389('0x4e')]=intUtil[_0xf389('0x4d')](_0x13259d['serverUrl']);if(_0x1d9bc8&&_0x1d9bc8['recordingFormat']&&_0x1d9bc8[_0xf389('0x66')]!==_0xf389('0x67')){logger[_0xf389('0xc')](_0xf389('0x68'),_0xf389('0x50'));_0x414420[_0xf389('0x51')]=util[_0xf389('0x1b')](_0xf389('0x52'),_0x13259d[_0xf389('0x4e')],_0x414420[_0xf389('0x53')],md5(_0x414420[_0xf389('0x53')]));}headers[_0xf389('0x69')]=getAuth(_0x13259d);return getUser(_0x13259d,_0x47195a[_0xf389('0x6a')])[_0xf389('0x16')](function(_0x30b3c3){_0x5f0f38=_0x30b3c3;logger['info'](_0xf389('0x54'),_0x5f0f38['id']);return getEndUser(_0x13259d,_0x414420['destcalleridname'],_0x414420['destcalleridnum']);})[_0xf389('0x16')](function(_0x3f1500){_0x5263eb=_0x3f1500;logger[_0xf389('0xc')](_0xf389('0x57'),_0x5263eb['id']);return getTicket(_0x13259d,_0x5f0f38,_0x5263eb,_0x354950,_0x414420);})[_0xf389('0x16')](function(_0x214014){if(_0x214014){logger['info'](_0xf389('0x58'),_0x214014['id']);switch(_0x13259d[_0xf389('0x41')]){case'integrationTab':logger[_0xf389('0xc')](_0xf389('0x68'),_0xf389('0x5b'));return request({'uri':util[_0xf389('0x1b')](_0xf389('0x5c'),_0x13259d[_0xf389('0xf')],_0x5f0f38['id'],_0x214014['id']),'method':_0xf389('0x10')});case _0xf389('0x5d'):logger[_0xf389('0xc')](_0xf389('0x68'),_0xf389('0x5e'));emit(util['format'](_0xf389('0x5f'),_0x47195a[_0xf389('0x4a')]),'trigger:browser:url',{'uri':util[_0xf389('0x1b')](_0xf389('0x6b'),_0x13259d[_0xf389('0xf')]['replace'](_0xf389('0x60'),''),_0x214014['id'])});break;default:logger[_0xf389('0x61')](_0xf389('0x68'),_0xf389('0x62'));}}})['catch'](function(_0x1459e9){logger[_0xf389('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xf389('0x6c')](_0x1459e9,{'showHidden':!![],'depth':null}));});};exports[_0xf389('0x6d')]=function(_0x2341a7,_0x54d629,_0x7b2a8d,_0x471b7b,_0x5384cd,_0x2d4aa7){var _0x3dc5ff,_0x25e62b;_0x2d4aa7[_0xf389('0xf')]=intUtil[_0xf389('0x4d')](_0x2d4aa7['remoteUri']);_0x2d4aa7[_0xf389('0x4e')]=intUtil['stripTrailingSlash'](_0x2d4aa7[_0xf389('0x4e')]);if(_0x5384cd&&_0x5384cd[_0xf389('0x4f')]){logger[_0xf389('0xc')]('['+_0x54d629[_0xf389('0x6e')][_0xf389('0x6f')]()+']','Recording\x20is\x20enabled!');_0x54d629[_0xf389('0x51')]=util[_0xf389('0x1b')](_0xf389('0x52'),_0x2d4aa7['serverUrl'],_0x54d629[_0xf389('0x53')],md5(_0x54d629[_0xf389('0x53')]));}else{_0x54d629[_0xf389('0x51')]='';}headers[_0xf389('0x69')]=getAuth(_0x2d4aa7);return getUser(_0x2d4aa7)[_0xf389('0x16')](function(_0x4bde8b){_0x3dc5ff=_0x4bde8b;logger['info'](_0xf389('0x54'),_0x3dc5ff['id']);return getEndUser(_0x2d4aa7,_0x54d629[_0xf389('0x55')],_0x54d629[_0xf389('0x56')]);})[_0xf389('0x16')](function(_0x2e3950){_0x25e62b=_0x2e3950;logger[_0xf389('0xc')](_0xf389('0x57'),_0x25e62b['id']);return getTicket(_0x2d4aa7,_0x3dc5ff,_0x25e62b,_0x7b2a8d,_0x54d629);})['then'](function(_0x4bb935){if(_0x4bb935){logger[_0xf389('0xc')](_0xf389('0x58'),_0x4bb935['id']);}})['catch'](function(_0x470338){logger[_0xf389('0x61')]('['+_0x54d629[_0xf389('0x6e')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xf389('0x6c')](_0x470338,{'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 22af8f2..93aca74 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 _0x5718=['complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','Outbound','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','[HTTP]','forEach','string','picklist','idField','content','toString','type','variable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','profile','user','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','enduserType','POST','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','https://www.zohoapis.','Leads','Creating\x20new\x20call...','Owner','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','Called'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x5718,0xb9));var _0x8571=function(_0x38c8ea,_0x1191b3){_0x38c8ea=_0x38c8ea-0x0;var _0x3ded68=_0x5718[_0x38c8ea];return _0x3ded68;};'use strict';var _=require(_0x8571('0x0'));var rp=require(_0x8571('0x1'));var md5=require(_0x8571('0x2'));var util=require(_0x8571('0x3'));var intUtil=require(_0x8571('0x4'));var moment=require(_0x8571('0x5'));var Redis=require(_0x8571('0x6'));var BPromise=require(_0x8571('0x7'));var config=require(_0x8571('0x8'));var logger=require(_0x8571('0x9'))('zoho');config['redis']=_['defaults'](config[_0x8571('0xa')],{'host':_0x8571('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8571('0xa')]));function emit(_0x424a95,_0x21cafd,_0x8cc9d6){io['to'](_0x424a95)['emit'](_0x21cafd,_0x8cc9d6);}function request(_0x26d338){logger['debug'](_0x8571('0xc'),JSON['stringify'](_0x26d338));return rp(_0x26d338);}function getCustomFields(_0x706b9b,_0x2d6e8e){var _0x40d400={};if(_0x706b9b['length']>0x0){_[_0x8571('0xd')](_0x706b9b,function(_0x45e477){if(_['includes']([_0x8571('0xe'),_0x8571('0xf')],_0x45e477['type'])&&_0x45e477[_0x8571('0x10')]){_0x40d400[_0x45e477[_0x8571('0x10')]]=_0x45e477[_0x8571('0x11')][_0x8571('0x12')]();}else if(_0x45e477[_0x8571('0x13')]===_0x8571('0x14')&&_0x45e477['variableName']&&_0x45e477[_0x8571('0x10')]&&_0x2d6e8e[_0x45e477['variableName']]){_0x40d400[_0x45e477['idField']]=_0x2d6e8e[_0x45e477['variableName']][_0x8571('0x12')]();}else if(_0x45e477[_0x8571('0x13')]==='customVariable'&&_0x45e477[_0x8571('0x15')]&&_0x45e477[_0x8571('0x15')][_0x8571('0x16')]&&_0x45e477[_0x8571('0x10')]&&_0x2d6e8e[_0x45e477['Variable']['name'][_0x8571('0x17')]()]){_0x40d400[_0x45e477[_0x8571('0x10')]]=_0x2d6e8e[_0x45e477['Variable']['name'][_0x8571('0x17')]()][_0x8571('0x12')]();}});}return _0x40d400;}function getName(_0x243da7){if(_0x243da7[_0x8571('0x18')]('\x20')>0x0){var _0x220010=_0x243da7[_0x8571('0x19')](/ (.+)/);if(_0x220010[0x1]){return _0x220010;}}return[_0x243da7,_0x243da7];}var accountsTokens={};function getAccessToken(_0x325240){return new Promise(function(_0x285437,_0x4bb1cf){if(!_[_0x8571('0x1a')](accountsTokens[_0x325240['id']])&&!_[_0x8571('0x1a')](accountsTokens[_0x325240['id']][_0x8571('0x1b')])){if(moment()[_0x8571('0x1c')](accountsTokens[_0x325240['id']][_0x8571('0x1d')])){_0x285437(accountsTokens[_0x325240['id']][_0x8571('0x1b')]);}}var _0xeaa8e9;switch(_0x325240['zone']){case'US':_0xeaa8e9=_0x8571('0x1e');break;case'AU':_0xeaa8e9=_0x8571('0x1f');break;case'EU':_0xeaa8e9='https://accounts.zoho.eu';break;case'IN':_0xeaa8e9=_0x8571('0x20');break;case'CN':_0xeaa8e9=_0x8571('0x21');break;default:_0xeaa8e9='https://accounts.zoho.eu';break;}var _0x2ccc01={'method':'POST','uri':_0xeaa8e9+'/oauth/v2/token','qs':{'refresh_token':_0x325240[_0x8571('0x22')],'client_id':_0x325240['clientId'],'client_secret':_0x325240[_0x8571('0x23')],'grant_type':_0x8571('0x24')},'json':!![]};return rp(_0x2ccc01)[_0x8571('0x25')](function(_0x1edf03){accountsTokens[_0x325240['id']]={'access_token':_0x1edf03[_0x8571('0x1b')],'expires_in':moment()['add'](_0x1edf03['expires_in'],_0x8571('0x26'))};_0x285437(_0x1edf03[_0x8571('0x1b')]);})[_0x8571('0x27')](function(_0x11a6e5){logger[_0x8571('0x28')](_0x8571('0x29'),_0x11a6e5[_0x8571('0x2a')]);_0x4bb1cf(_0x11a6e5);});});}function getUser(_0x13adf8,_0x448d52,_0x21e04a,_0x5e9712){logger['info'](_0x8571('0x2b'));return request({'method':'GET','uri':util[_0x8571('0x2c')]('https://www.zohoapis.%s/crm/v2/users',_0x448d52),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x8571('0x2d')+_0x13adf8},'json':!![]})[_0x8571('0x25')](function(_0x526a7a){if(_0x526a7a[_0x8571('0x2e')]){var _0xd1261c=-0x1;if(_[_0x8571('0x2f')](_0x526a7a['users'])){if(!_[_0x8571('0x1a')](_0x5e9712)){_0xd1261c=_[_0x8571('0x30')](_0x526a7a['users'],function(_0x2c27fd){return _0x2c27fd[_0x8571('0x31')]===_0x5e9712;});}if(_0xd1261c>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x8571('0x32')]('Using\x20the\x20admin\x20account!');_0xd1261c=_['findIndex'](_0x526a7a['users'],function(_0x5ca44e){return _0x5ca44e[_0x8571('0x33')]['name']==='Administrator';});}return _0x526a7a[_0x8571('0x2e')][_0xd1261c];}else{if(_0x526a7a[_0x8571('0x34')]['profile']['name']===_0x8571('0x35')){logger[_0x8571('0x32')](_0x8571('0x36'));user=_0x526a7a[_0x8571('0x34')];return user;}else{logger[_0x8571('0x28')](_0x8571('0x37'),JSON['stringify'](_0x526a7a));throw new Error(_0x8571('0x38')+JSON[_0x8571('0x39')](_0x526a7a));}}}else{logger[_0x8571('0x28')](_0x8571('0x37'),JSON[_0x8571('0x39')](_0x526a7a));throw new Error(_0x8571('0x38')+JSON[_0x8571('0x39')](_0x526a7a));}})[_0x8571('0x27')](function(_0x2dd582){console['error'](_0x2dd582);});}function getZohoUser(_0xc76b9f,_0x16f376){return new BPromise(function(_0x56cc1e,_0x267e47){request(_0xc76b9f)[_0x8571('0x25')](function(_0x341dc9){var _0x6a8bc=null;if(_0x341dc9){_0x6a8bc=_0x341dc9[_0x8571('0x3a')][0x0];_0x6a8bc[_0x8571('0x3b')]=_0x16f376;}_0x56cc1e(_0x6a8bc);})[_0x8571('0x27')](function(_0x19163a){_0x267e47(_0x19163a);});});}function createEndUser(_0x2dfb6f,_0x59dd8d,_0xf4a316,_0x5bf7bc,_0x38d625,_0x4a2207){var _0xf4a316=getName(_0xf4a316);return request({'method':_0x8571('0x3c'),'uri':'https://www.zohoapis.'+_0x59dd8d+_0x8571('0x3d')+_['startCase'](_0x4a2207[_0x8571('0x3e')])+'s','body':{'data':[{'Last_Name':_0xf4a316[0x1],'First_Name':_0xf4a316[0x0],'Phone':_0x5bf7bc,'Owner':{'name':!_[_0x8571('0x1a')](_0x38d625[_0x8571('0x3f')][_0x8571('0x16')])?_0x38d625[_0x8571('0x3f')][_0x8571('0x16')]:!_[_0x8571('0x1a')](_0x38d625[_0x8571('0x40')])?_0x38d625[_0x8571('0x40')]+'\x20'+_0x38d625[_0x8571('0x41')]:_0x38d625[_0x8571('0x41')],'id':_0x38d625['id']}}]},'headers':{'Authorization':_0x8571('0x2d')+_0x2dfb6f},'json':!![]})[_0x8571('0x25')](function(_0x375891){if(_0x375891&&_0x375891[_0x8571('0x3a')][0x0][_0x8571('0x42')]===_0x8571('0x43')){var _0x159741=_0x375891[_0x8571('0x3a')][0x0][_0x8571('0x44')];_0x159741[_0x8571('0x3b')]=_[_0x8571('0x45')](_0x4a2207[_0x8571('0x3e')])+'s';return _0x159741;}logger['error'](_0x8571('0x37'),JSON[_0x8571('0x39')](data));throw new Error(_0x8571('0x46')+JSON[_0x8571('0x39')](data));})[_0x8571('0x27')](function(_0x534ec5){console['log']('CREATE\x20ERROR',_0x534ec5);});}function getEndUser(_0x5142f,_0x54b876,_0x1649a3,_0x2bfafb,_0xbee778,_0x2ff40a,_0x419311){var _0x4b1214={'method':'GET','uri':'','headers':{'Authorization':_0x8571('0x2d')+_0x5142f},'json':!![]};switch(_0x419311[_0x8571('0x47')]){case _0x8571('0x48'):_0x4b1214[_0x8571('0x49')]='https://www.zohoapis.'+_0x54b876+_0x8571('0x4a')+_0xbee778+'))';return getZohoUser(_0x4b1214,_0x8571('0x4b'))[_0x8571('0x25')](function(_0x563fa1){if(_0x563fa1)return _0x563fa1;_0x4b1214[_0x8571('0x49')]='https://www.zohoapis.'+_0x54b876+_0x8571('0x4c')+_0xbee778+'))';return getZohoUser(_0x4b1214,'Leads')[_0x8571('0x25')](function(_0xd3af57){if(_0xd3af57)return _0xd3af57;if(_0x419311[_0x8571('0x3e')]!=_0x8571('0x4d')){return createEndUser(_0x5142f,_0x54b876,_0x2bfafb,_0xbee778,_0x2ff40a,_0x419311);}else{return{};}});});break;case _0x8571('0x4e'):_0x4b1214[_0x8571('0x49')]='https://www.zohoapis.'+_0x54b876+_0x8571('0x4a')+_0xbee778+'))';return getZohoUser(_0x4b1214,_0x8571('0x4b'))[_0x8571('0x25')](function(_0x22232c){if(_0x22232c)return _0x22232c;if(_0x419311[_0x8571('0x3e')]!=_0x8571('0x4d')){return createEndUser(_0x5142f,_0x54b876,_0x2bfafb,_0xbee778,_0x2ff40a,_0x419311);}else{return{};}});break;case _0x8571('0x4f'):_0x4b1214[_0x8571('0x49')]=_0x8571('0x50')+_0x54b876+_0x8571('0x4c')+_0xbee778+'))';return getZohoUser(_0x4b1214,_0x8571('0x51'))[_0x8571('0x25')](function(_0x389615){if(_0x389615)return _0x389615;if(_0x419311[_0x8571('0x3e')]!='nothing'){return createEndUser(_0x5142f,_0x54b876,_0x2bfafb,_0xbee778,_0x2ff40a,_0x419311);}else{return{};}});break;}}function getCall(_0x331dd7,_0x20208d,_0x3b3aae,_0x164302,_0x8cde5f,_0x59e0b4,_0x5bcba8,_0x219faa){logger[_0x8571('0x32')](_0x8571('0x52'));var _0x137658={};_0x137658[_0x8571('0x53')]={'name':!_[_0x8571('0x1a')](_0x164302[_0x8571('0x3f')][_0x8571('0x16')])&&!_['isNil'](_0x164302[_0x8571('0x33')][_0x8571('0x16')])&&_0x164302['profile']['name']==='administrator'?_0x164302[_0x8571('0x3f')][_0x8571('0x16')]:!_['isNil'](_0x164302[_0x8571('0x40')])?_0x164302[_0x8571('0x40')]+'\x20'+_0x164302[_0x8571('0x41')]:_0x164302[_0x8571('0x41')],'id':_0x164302['id']};_0x137658['Subject']=intUtil[_0x8571('0x54')](_0x59e0b4[_0x8571('0x55')],_0x5bcba8,'\x20');_0x137658[_0x8571('0x56')]=intUtil['getString'](_0x59e0b4['Descriptions'],_0x5bcba8,'\x0a');if(_0x8cde5f[_0x8571('0x3b')]===_0x8571('0x4b')){_0x137658[_0x8571('0x57')]={'name':!_[_0x8571('0x1a')](_0x8cde5f[_0x8571('0x58')])?_0x8cde5f[_0x8571('0x58')]:!_['isNil'](_0x8cde5f[_0x8571('0x59')])?_0x8cde5f[_0x8571('0x59')]+'\x20'+_0x8cde5f[_0x8571('0x5a')]:_0x8cde5f[_0x8571('0x5a')],'id':_0x8cde5f['id']};}if(_0x8cde5f[_0x8571('0x3b')]===_0x8571('0x51')){_0x137658[_0x8571('0x5b')]={'name':!_[_0x8571('0x1a')](_0x8cde5f[_0x8571('0x58')])?_0x8cde5f[_0x8571('0x58')]:!_['isNil'](_0x8cde5f[_0x8571('0x59')])?_0x8cde5f['First_Name']+'\x20'+_0x8cde5f[_0x8571('0x5a')]:_0x8cde5f[_0x8571('0x5a')],'id':_0x8cde5f['id']};_0x137658[_0x8571('0x5c')]=_[_0x8571('0x45')](_0x8cde5f[_0x8571('0x3b')]);}if(_0x5bcba8['talktime']){_0x137658[_0x8571('0x5d')]=moment[_0x8571('0x5e')](parseInt(_0x5bcba8[_0x8571('0x5f')])*0x3e8)[_0x8571('0x2c')](_0x8571('0x60'));}else if(_0x5bcba8['answertime']&&_0x5bcba8[_0x8571('0x61')]){_0x137658[_0x8571('0x5d')]=moment[_0x8571('0x5e')](moment(_0x5bcba8['endtime'],_0x8571('0x62'))[_0x8571('0x63')](moment(_0x5bcba8[_0x8571('0x64')],_0x8571('0x62'))))[_0x8571('0x2c')](_0x8571('0x60'));}switch(_0x5bcba8['lastevent']){case'called':_0x137658[_0x8571('0x65')]=_0x8571('0x66');break;case _0x8571('0x67'):case _0x8571('0x68'):_0x137658['Call_Result']='Answered';break;case _0x8571('0x69'):_0x137658[_0x8571('0x65')]=_0x8571('0x6a');break;case _0x8571('0x6b'):_0x137658[_0x8571('0x65')]=_0x8571('0x6c');break;case _0x8571('0x6d'):_0x137658[_0x8571('0x65')]='Timeout';default:}_0x137658[_0x8571('0x6e')]=(_0x219faa===_0x8571('0x6f')?moment(_0x5bcba8[_0x8571('0x64')])[_0x8571('0x2c')](_0x8571('0x62')):moment(_0x5bcba8['agentcalledAt'])[_0x8571('0x2c')](_0x8571('0x62')))||moment()[_0x8571('0x2c')](_0x8571('0x62'));_0x137658[_0x8571('0x70')]=_0x219faa||_0x8571('0x71');_0x137658=_['merge'](_0x137658,getCustomFields(_0x59e0b4['Fields'],_0x5bcba8));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x20208d+_0x8571('0x72'),'headers':{'Authorization':_0x8571('0x2d')+_0x331dd7},'body':{'data':[_0x137658]},'json':!![]})['then'](function(_0x258f91){if(_0x258f91&&_0x258f91[_0x8571('0x3a')][0x0][_0x8571('0x42')]===_0x8571('0x43')){logger[_0x8571('0x32')](_0x8571('0x73'));return{'id':_0x258f91[_0x8571('0x3a')][0x0][_0x8571('0x44')]['id']};}})[_0x8571('0x27')](function(_0x24a4a8){logger[_0x8571('0x32')](_0x8571('0x74'),_0x24a4a8[_0x8571('0x2a')]);console['log'](_0x8571('0x74'),_0x24a4a8);});}exports[_0x8571('0x75')]=function(_0x4190bc,_0x1163ad,_0x96acc0,_0x4cbe29,_0x1334aa,_0x45dfa2){var _0x4dab99,_0x13c487,_0x197aa8;_0x45dfa2['host']=intUtil[_0x8571('0x76')](_0x45dfa2[_0x8571('0x77')]);_0x45dfa2[_0x8571('0x78')]=intUtil['stripTrailingSlash'](_0x45dfa2[_0x8571('0x78')]);if(_0x1334aa&&_0x1334aa[_0x8571('0x79')]){logger['info'](_0x8571('0x7a'),_0x8571('0x7b'));_0x1163ad[_0x8571('0x7c')]=_0x45dfa2[_0x8571('0x78')]+_0x8571('0x7d')+_0x1163ad[_0x8571('0x7e')]+_0x8571('0x7f')+md5(_0x1163ad[_0x8571('0x7e')]);}else{_0x1163ad['recordingURL']='';}var _0x545f25=_0x45dfa2[_0x8571('0x77')]===_0x8571('0x80')?'eu':_0x8571('0x81');return getAccessToken(_0x45dfa2)[_0x8571('0x25')](function(_0x2436ca){_0x197aa8=_0x2436ca;return getUser(_0x197aa8,_0x545f25,_0x45dfa2,_0x4cbe29[_0x8571('0x31')]);})[_0x8571('0x25')](function(_0x48017f){_0x4dab99=_0x48017f;logger[_0x8571('0x32')]('The\x20User\x20ID\x20is:',_0x4dab99['id']);return getEndUser(_0x197aa8,_0x545f25,_0x45dfa2,_0x1163ad['calleridname'],_0x1163ad[_0x8571('0x82')],_0x4dab99,_0x96acc0);})[_0x8571('0x25')](function(_0x35b476){_0x13c487=_0x35b476;return getCall(_0x197aa8,_0x545f25,_0x45dfa2,_0x4dab99,_0x13c487,_0x96acc0,_0x1163ad,_0x8571('0x71'));})['then'](function(_0x429318){if(_0x429318){logger['info'](_0x8571('0x83'),_0x429318['id']);logger[_0x8571('0x32')](_0x8571('0x7a'),_0x8571('0x84'));emit(util[_0x8571('0x2c')](_0x8571('0x85'),_0x4cbe29[_0x8571('0x16')]),'trigger:browser:url',{'uri':_0x8571('0x86')+_0x45dfa2['host']+_0x8571('0x87')+_0x429318['id']});}})[_0x8571('0x27')](function(_0x541fd1){logger[_0x8571('0x28')]('[QUEUE]',JSON['stringify'](_0x541fd1));});};exports['outbound']=function(_0x20bb41,_0x318e7d,_0x448643,_0x4b45b3,_0x38f47f,_0x5c93a5,_0x1f1fdc){var _0x550aca,_0x216a5d,_0x38b3a2;_0x5c93a5[_0x8571('0x77')]=intUtil['stripTrailingSlash'](_0x5c93a5[_0x8571('0x77')]);_0x5c93a5[_0x8571('0x78')]=intUtil[_0x8571('0x76')](_0x5c93a5[_0x8571('0x78')]);if(_0x1f1fdc&&_0x1f1fdc[_0x8571('0x88')]&&_0x1f1fdc[_0x8571('0x88')]!==_0x8571('0x89')){logger['info'](_0x8571('0x8a'),'Recording\x20is\x20enabled!');_0x318e7d['recordingURL']=_0x5c93a5[_0x8571('0x78')]+'/api/voice/recordings/'+_0x318e7d[_0x8571('0x7e')]+_0x8571('0x7f')+md5(_0x318e7d[_0x8571('0x7e')]);}var _0x48bf22=_0x5c93a5[_0x8571('0x77')]===_0x8571('0x80')?'eu':_0x8571('0x81');return getAccessToken(_0x5c93a5)[_0x8571('0x25')](function(_0x57437d){_0x38b3a2=_0x57437d;return getUser(_0x38b3a2,_0x48bf22,_0x5c93a5,_0x4b45b3[_0x8571('0x31')]);})[_0x8571('0x25')](function(_0x3c31c4){_0x550aca=_0x3c31c4;logger['info'](_0x8571('0x8b'),_0x550aca['id']);return getEndUser(_0x38b3a2,_0x48bf22,_0x5c93a5,_0x318e7d['destcalleridname'],_0x318e7d['destcalleridnum'],_0x550aca,_0x448643);})[_0x8571('0x25')](function(_0x243c31){_0x216a5d=_0x243c31;return getCall(_0x38b3a2,_0x48bf22,_0x5c93a5,_0x550aca,_0x216a5d,_0x448643,_0x318e7d,_0x8571('0x8c'));})[_0x8571('0x25')](function(_0x33dbea){if(_0x33dbea){logger[_0x8571('0x32')](_0x8571('0x83'),_0x33dbea['id']);logger[_0x8571('0x32')]('[OUTBOUND]',_0x8571('0x84'));emit(util[_0x8571('0x2c')](_0x8571('0x85'),_0x4b45b3[_0x8571('0x16')]),'trigger:browser:url',{'uri':_0x8571('0x86')+_0x5c93a5['host']+_0x8571('0x87')+_0x33dbea['id']});}})[_0x8571('0x27')](function(_0x1144d9){logger[_0x8571('0x28')](_0x8571('0x8a'),JSON['stringify'](_0x1144d9));});};exports[_0x8571('0x8d')]=function(_0x32553,_0x5e60f7,_0x153475,_0x50034d,_0x54d851,_0x4219bf){var _0x3b75d7,_0x26ed4a,_0x4355b8;_0x4219bf['host']=intUtil[_0x8571('0x76')](_0x4219bf['host']);_0x4219bf[_0x8571('0x78')]=intUtil['stripTrailingSlash'](_0x4219bf[_0x8571('0x78')]);if(_0x54d851&&_0x54d851[_0x8571('0x79')]){logger[_0x8571('0x32')]('['+_0x5e60f7[_0x8571('0x8e')][_0x8571('0x8f')]()+']',_0x8571('0x7b'));_0x5e60f7[_0x8571('0x7c')]=_0x4219bf[_0x8571('0x78')]+_0x8571('0x7d')+_0x5e60f7[_0x8571('0x7e')]+_0x8571('0x7f')+md5(_0x5e60f7['uniqueid']);}else{_0x5e60f7[_0x8571('0x7c')]='';}var _0x458ba5=_0x4219bf[_0x8571('0x77')]==='zoho.eu'?'eu':_0x8571('0x81');return getAccessToken(_0x4219bf)[_0x8571('0x25')](function(_0x54481c){_0x4355b8=_0x54481c;return getUser(_0x4355b8,_0x458ba5,_0x4219bf);})[_0x8571('0x25')](function(_0x456389){_0x3b75d7=_0x456389;logger[_0x8571('0x32')]('The\x20User\x20ID\x20is:',_0x3b75d7['id']);return getEndUser(_0x4355b8,_0x458ba5,_0x4219bf,_0x5e60f7['calleridname'],_0x5e60f7[_0x8571('0x82')],_0x3b75d7,_0x153475);})[_0x8571('0x25')](function(_0x5782d8){_0x26ed4a=_0x5782d8;return getCall(_0x4355b8,_0x458ba5,_0x4219bf,_0x3b75d7,_0x26ed4a,_0x153475,_0x5e60f7,_0x8571('0x71'));})[_0x8571('0x25')](function(_0x36fbab){if(_0x36fbab){logger[_0x8571('0x32')](_0x8571('0x83'),_0x36fbab['id']);}})[_0x8571('0x27')](function(_0x4e9ea2){logger['error']('['+_0x5e60f7[_0x8571('0x8e')]['toUpperCase']()+']',JSON['stringify'](_0x4e9ea2));});}; \ No newline at end of file +var _0x4f9d=['seconds','catch','error','Failing\x20creating\x20the\x20access_token','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','Full_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','unmanaged','toUpperCase','Inbound','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','type','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','add','expires_in'];(function(_0xacce08,_0x52f0f5){var _0x214bfe=function(_0x430b6e){while(--_0x430b6e){_0xacce08['push'](_0xacce08['shift']());}};_0x214bfe(++_0x52f0f5);}(_0x4f9d,0x1b3));var _0xd4f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4f9('0x0'));var rp=require(_0xd4f9('0x1'));var md5=require(_0xd4f9('0x2'));var util=require('util');var intUtil=require(_0xd4f9('0x3'));var moment=require(_0xd4f9('0x4'));var Redis=require(_0xd4f9('0x5'));var BPromise=require(_0xd4f9('0x6'));var config=require(_0xd4f9('0x7'));var logger=require('../../../../config/logger')('zoho');config[_0xd4f9('0x8')]=_[_0xd4f9('0x9')](config['redis'],{'host':_0xd4f9('0xa'),'port':0x18eb});var io=require(_0xd4f9('0xb'))(new Redis(config[_0xd4f9('0x8')]));function emit(_0x151221,_0x50beca,_0x448522){io['to'](_0x151221)[_0xd4f9('0xc')](_0x50beca,_0x448522);}function request(_0x419183){logger[_0xd4f9('0xd')]('[HTTP]',JSON[_0xd4f9('0xe')](_0x419183));return rp(_0x419183);}function getCustomFields(_0x2f9635,_0x280c18){var _0xe665a2={};if(_0x2f9635[_0xd4f9('0xf')]>0x0){_[_0xd4f9('0x10')](_0x2f9635,function(_0x4fc909){if(_[_0xd4f9('0x11')]([_0xd4f9('0x12'),'picklist'],_0x4fc909[_0xd4f9('0x13')])&&_0x4fc909[_0xd4f9('0x14')]){_0xe665a2[_0x4fc909[_0xd4f9('0x14')]]=_0x4fc909[_0xd4f9('0x15')]['toString']();}else if(_0x4fc909[_0xd4f9('0x13')]===_0xd4f9('0x16')&&_0x4fc909['variableName']&&_0x4fc909['idField']&&_0x280c18[_0x4fc909[_0xd4f9('0x17')]]){_0xe665a2[_0x4fc909[_0xd4f9('0x14')]]=_0x280c18[_0x4fc909[_0xd4f9('0x17')]]['toString']();}else if(_0x4fc909[_0xd4f9('0x13')]===_0xd4f9('0x18')&&_0x4fc909[_0xd4f9('0x19')]&&_0x4fc909[_0xd4f9('0x19')][_0xd4f9('0x1a')]&&_0x4fc909[_0xd4f9('0x14')]&&_0x280c18[_0x4fc909[_0xd4f9('0x19')]['name'][_0xd4f9('0x1b')]()]){_0xe665a2[_0x4fc909[_0xd4f9('0x14')]]=_0x280c18[_0x4fc909[_0xd4f9('0x19')][_0xd4f9('0x1a')][_0xd4f9('0x1b')]()][_0xd4f9('0x1c')]();}});}return _0xe665a2;}function getName(_0x59efe3){if(_0x59efe3[_0xd4f9('0x1d')]('\x20')>0x0){var _0x52cbf5=_0x59efe3[_0xd4f9('0x1e')](/ (.+)/);if(_0x52cbf5[0x1]){return _0x52cbf5;}}return[_0x59efe3,_0x59efe3];}var accountsTokens={};function getAccessToken(_0x3d26e6){return new Promise(function(_0x37ff63,_0x13af7f){if(!_['isNil'](accountsTokens[_0x3d26e6['id']])&&!_[_0xd4f9('0x1f')](accountsTokens[_0x3d26e6['id']][_0xd4f9('0x20')])){if(moment()[_0xd4f9('0x21')](accountsTokens[_0x3d26e6['id']]['expires_in'])){_0x37ff63(accountsTokens[_0x3d26e6['id']][_0xd4f9('0x20')]);}}var _0x295cce;switch(_0x3d26e6['zone']){case'US':_0x295cce=_0xd4f9('0x22');break;case'AU':_0x295cce='https://accounts.zoho.com.au';break;case'EU':_0x295cce=_0xd4f9('0x23');break;case'IN':_0x295cce=_0xd4f9('0x24');break;case'CN':_0x295cce=_0xd4f9('0x25');break;default:_0x295cce=_0xd4f9('0x23');break;}var _0x385aef={'method':_0xd4f9('0x26'),'uri':_0x295cce+_0xd4f9('0x27'),'qs':{'refresh_token':_0x3d26e6[_0xd4f9('0x28')],'client_id':_0x3d26e6[_0xd4f9('0x29')],'client_secret':_0x3d26e6[_0xd4f9('0x2a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x385aef)['then'](function(_0x43b705){accountsTokens[_0x3d26e6['id']]={'access_token':_0x43b705[_0xd4f9('0x20')],'expires_in':moment()[_0xd4f9('0x2b')](_0x43b705[_0xd4f9('0x2c')],_0xd4f9('0x2d'))};_0x37ff63(_0x43b705[_0xd4f9('0x20')]);})[_0xd4f9('0x2e')](function(_0x42321f){logger[_0xd4f9('0x2f')](_0xd4f9('0x30'),_0x42321f['stack']);_0x13af7f(_0x42321f);});});}function getUser(_0x3b9676,_0x5937b2,_0x13d2c1,_0x350295){logger['info']('Search\x20user');return request({'method':_0xd4f9('0x31'),'uri':util[_0xd4f9('0x32')](_0xd4f9('0x33'),_0x5937b2),'qs':{'type':_0xd4f9('0x34')},'headers':{'Authorization':_0xd4f9('0x35')+_0x3b9676},'json':!![]})[_0xd4f9('0x36')](function(_0x348ee6){if(_0x348ee6[_0xd4f9('0x37')]){var _0x555f6e=-0x1;if(_[_0xd4f9('0x38')](_0x348ee6[_0xd4f9('0x37')])){if(!_[_0xd4f9('0x1f')](_0x350295)){_0x555f6e=_[_0xd4f9('0x39')](_0x348ee6[_0xd4f9('0x37')],function(_0x38f903){return _0x38f903[_0xd4f9('0x3a')]===_0x350295;});}if(_0x555f6e>=0x0){logger[_0xd4f9('0x3b')](_0xd4f9('0x3c'));}else{logger['info'](_0xd4f9('0x3d'));_0x555f6e=_[_0xd4f9('0x39')](_0x348ee6[_0xd4f9('0x37')],function(_0x44e33b){return _0x44e33b[_0xd4f9('0x3e')][_0xd4f9('0x1a')]===_0xd4f9('0x3f');});}return _0x348ee6['users'][_0x555f6e];}else{if(_0x348ee6[_0xd4f9('0x40')][_0xd4f9('0x3e')][_0xd4f9('0x1a')]===_0xd4f9('0x3f')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x348ee6[_0xd4f9('0x40')];return user;}else{logger[_0xd4f9('0x2f')](_0xd4f9('0x41'),JSON[_0xd4f9('0xe')](_0x348ee6));throw new Error(_0xd4f9('0x42')+JSON[_0xd4f9('0xe')](_0x348ee6));}}}else{logger[_0xd4f9('0x2f')](_0xd4f9('0x41'),JSON['stringify'](_0x348ee6));throw new Error(_0xd4f9('0x42')+JSON['stringify'](_0x348ee6));}})[_0xd4f9('0x2e')](function(_0x28f2ee){console[_0xd4f9('0x2f')](_0x28f2ee);});}function getZohoUser(_0x44230c,_0x20648c){return new BPromise(function(_0x1baab4,_0x1429ea){request(_0x44230c)[_0xd4f9('0x36')](function(_0x5cc18d){var _0xaabd8f=null;if(_0x5cc18d){_0xaabd8f=_0x5cc18d[_0xd4f9('0x43')][0x0];_0xaabd8f[_0xd4f9('0x44')]=_0x20648c;}_0x1baab4(_0xaabd8f);})['catch'](function(_0x50761d){_0x1429ea(_0x50761d);});});}function createEndUser(_0x32bd8b,_0x9268a,_0x3eb62f,_0x1d4ff8,_0x3c5499,_0x41ad65){var _0x3eb62f=getName(_0x3eb62f);return request({'method':_0xd4f9('0x26'),'uri':_0xd4f9('0x45')+_0x9268a+_0xd4f9('0x46')+_[_0xd4f9('0x47')](_0x41ad65['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x3eb62f[0x1],'First_Name':_0x3eb62f[0x0],'Phone':_0x1d4ff8,'Owner':{'name':!_[_0xd4f9('0x1f')](_0x3c5499[_0xd4f9('0x48')][_0xd4f9('0x1a')])?_0x3c5499['role']['name']:!_[_0xd4f9('0x1f')](_0x3c5499[_0xd4f9('0x49')])?_0x3c5499[_0xd4f9('0x49')]+'\x20'+_0x3c5499[_0xd4f9('0x4a')]:_0x3c5499[_0xd4f9('0x4a')],'id':_0x3c5499['id']}}]},'headers':{'Authorization':_0xd4f9('0x35')+_0x32bd8b},'json':!![]})[_0xd4f9('0x36')](function(_0x2df27e){if(_0x2df27e&&_0x2df27e[_0xd4f9('0x43')][0x0][_0xd4f9('0x4b')]===_0xd4f9('0x4c')){var _0x3650dc=_0x2df27e[_0xd4f9('0x43')][0x0][_0xd4f9('0x4d')];_0x3650dc[_0xd4f9('0x44')]=_[_0xd4f9('0x47')](_0x41ad65[_0xd4f9('0x4e')])+'s';return _0x3650dc;}logger['error'](_0xd4f9('0x41'),JSON[_0xd4f9('0xe')](data));throw new Error(_0xd4f9('0x4f')+JSON['stringify'](data));})[_0xd4f9('0x2e')](function(_0x2d1243){console[_0xd4f9('0x50')]('CREATE\x20ERROR',_0x2d1243);});}function getEndUser(_0x34ea4e,_0x43574c,_0x380433,_0x224db3,_0x22d941,_0x39ad48,_0x3d6f4d){var _0x182394={'method':_0xd4f9('0x31'),'uri':'','headers':{'Authorization':_0xd4f9('0x35')+_0x34ea4e},'json':!![]};switch(_0x3d6f4d[_0xd4f9('0x51')]){case'contact_lead':_0x182394[_0xd4f9('0x52')]='https://www.zohoapis.'+_0x43574c+_0xd4f9('0x53')+_0x22d941+'))';return getZohoUser(_0x182394,_0xd4f9('0x54'))['then'](function(_0xfe929){if(_0xfe929)return _0xfe929;_0x182394['uri']='https://www.zohoapis.'+_0x43574c+_0xd4f9('0x55')+_0x22d941+'))';return getZohoUser(_0x182394,'Leads')[_0xd4f9('0x36')](function(_0x23034b){if(_0x23034b)return _0x23034b;if(_0x3d6f4d[_0xd4f9('0x4e')]!='nothing'){return createEndUser(_0x34ea4e,_0x43574c,_0x224db3,_0x22d941,_0x39ad48,_0x3d6f4d);}else{return{};}});});break;case'contact':_0x182394['uri']=_0xd4f9('0x45')+_0x43574c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x22d941+'))';return getZohoUser(_0x182394,'Contacts')[_0xd4f9('0x36')](function(_0x32c89f){if(_0x32c89f)return _0x32c89f;if(_0x3d6f4d['moduleCreate']!=_0xd4f9('0x56')){return createEndUser(_0x34ea4e,_0x43574c,_0x224db3,_0x22d941,_0x39ad48,_0x3d6f4d);}else{return{};}});break;case _0xd4f9('0x57'):_0x182394['uri']=_0xd4f9('0x45')+_0x43574c+_0xd4f9('0x55')+_0x22d941+'))';return getZohoUser(_0x182394,_0xd4f9('0x58'))[_0xd4f9('0x36')](function(_0x4eb65c){if(_0x4eb65c)return _0x4eb65c;if(_0x3d6f4d[_0xd4f9('0x4e')]!=_0xd4f9('0x56')){return createEndUser(_0x34ea4e,_0x43574c,_0x224db3,_0x22d941,_0x39ad48,_0x3d6f4d);}else{return{};}});break;}}function getCall(_0x43ab8c,_0x13e80,_0x24a5da,_0x5eb246,_0x5b5998,_0x9f3ca6,_0x5ba300,_0x388f99){logger[_0xd4f9('0x3b')](_0xd4f9('0x59'));var _0x110ba0={};_0x110ba0[_0xd4f9('0x5a')]={'name':!_[_0xd4f9('0x1f')](_0x5eb246[_0xd4f9('0x48')][_0xd4f9('0x1a')])&&!_['isNil'](_0x5eb246[_0xd4f9('0x3e')][_0xd4f9('0x1a')])&&_0x5eb246[_0xd4f9('0x3e')][_0xd4f9('0x1a')]===_0xd4f9('0x5b')?_0x5eb246[_0xd4f9('0x48')][_0xd4f9('0x1a')]:!_['isNil'](_0x5eb246[_0xd4f9('0x49')])?_0x5eb246['first_name']+'\x20'+_0x5eb246[_0xd4f9('0x4a')]:_0x5eb246['last_name'],'id':_0x5eb246['id']};_0x110ba0[_0xd4f9('0x5c')]=intUtil[_0xd4f9('0x5d')](_0x9f3ca6[_0xd4f9('0x5e')],_0x5ba300,'\x20');_0x110ba0[_0xd4f9('0x5f')]=intUtil[_0xd4f9('0x5d')](_0x9f3ca6[_0xd4f9('0x60')],_0x5ba300,'\x0a');if(_0x5b5998[_0xd4f9('0x44')]===_0xd4f9('0x54')){_0x110ba0[_0xd4f9('0x61')]={'name':!_[_0xd4f9('0x1f')](_0x5b5998['Full_Name'])?_0x5b5998['Full_Name']:!_[_0xd4f9('0x1f')](_0x5b5998[_0xd4f9('0x62')])?_0x5b5998[_0xd4f9('0x62')]+'\x20'+_0x5b5998[_0xd4f9('0x63')]:_0x5b5998[_0xd4f9('0x63')],'id':_0x5b5998['id']};}if(_0x5b5998[_0xd4f9('0x44')]===_0xd4f9('0x58')){_0x110ba0['What_Id']={'name':!_[_0xd4f9('0x1f')](_0x5b5998['Full_Name'])?_0x5b5998[_0xd4f9('0x64')]:!_['isNil'](_0x5b5998['First_Name'])?_0x5b5998[_0xd4f9('0x62')]+'\x20'+_0x5b5998[_0xd4f9('0x63')]:_0x5b5998[_0xd4f9('0x63')],'id':_0x5b5998['id']};_0x110ba0[_0xd4f9('0x65')]=_[_0xd4f9('0x47')](_0x5b5998[_0xd4f9('0x44')]);}if(_0x5ba300[_0xd4f9('0x66')]){_0x110ba0[_0xd4f9('0x67')]=moment['utc'](parseInt(_0x5ba300[_0xd4f9('0x66')])*0x3e8)[_0xd4f9('0x32')](_0xd4f9('0x68'));}else if(_0x5ba300[_0xd4f9('0x69')]&&_0x5ba300[_0xd4f9('0x6a')]){_0x110ba0[_0xd4f9('0x67')]=moment['utc'](moment(_0x5ba300[_0xd4f9('0x6a')],'YYYY-MM-DDTHH:mm:ss')[_0xd4f9('0x6b')](moment(_0x5ba300[_0xd4f9('0x6c')],_0xd4f9('0x6d'))))[_0xd4f9('0x32')](_0xd4f9('0x68'));}switch(_0x5ba300[_0xd4f9('0x6e')]){case _0xd4f9('0x6f'):_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x71');break;case _0xd4f9('0x72'):case'connect':_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x73');break;case _0xd4f9('0x74'):_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x75');break;case _0xd4f9('0x76'):_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x77');break;case _0xd4f9('0x78'):_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x79');default:}_0x110ba0[_0xd4f9('0x7a')]=(_0x388f99===_0xd4f9('0x7b')?moment(_0x5ba300[_0xd4f9('0x6c')])[_0xd4f9('0x32')](_0xd4f9('0x6d')):moment(_0x5ba300[_0xd4f9('0x7c')])['format'](_0xd4f9('0x6d')))||moment()[_0xd4f9('0x32')](_0xd4f9('0x6d'));_0x110ba0[_0xd4f9('0x7d')]=_0x388f99||'Inbound';_0x110ba0=_[_0xd4f9('0x7e')](_0x110ba0,getCustomFields(_0x9f3ca6[_0xd4f9('0x7f')],_0x5ba300));return request({'method':'POST','uri':_0xd4f9('0x45')+_0x13e80+_0xd4f9('0x80'),'headers':{'Authorization':_0xd4f9('0x35')+_0x43ab8c},'body':{'data':[_0x110ba0]},'json':!![]})[_0xd4f9('0x36')](function(_0x2e388d){if(_0x2e388d&&_0x2e388d[_0xd4f9('0x43')][0x0][_0xd4f9('0x4b')]===_0xd4f9('0x4c')){logger[_0xd4f9('0x3b')](_0xd4f9('0x81'));return{'id':_0x2e388d[_0xd4f9('0x43')][0x0][_0xd4f9('0x4d')]['id']};}})['catch'](function(_0x470ce5){logger['info'](_0xd4f9('0x82'),_0x470ce5['stack']);console['log'](_0xd4f9('0x82'),_0x470ce5);});}exports['queue']=function(_0x2a5974,_0x3b1102,_0x68434,_0x434b79,_0x18f826,_0x432119){var _0x42ad97,_0x30b229,_0x2b9a99;_0x432119[_0xd4f9('0x83')]=intUtil[_0xd4f9('0x84')](_0x432119[_0xd4f9('0x83')]);_0x432119[_0xd4f9('0x85')]=intUtil['stripTrailingSlash'](_0x432119['serverUrl']);if(_0x18f826&&_0x18f826[_0xd4f9('0x86')]){logger[_0xd4f9('0x3b')](_0xd4f9('0x87'),'Recording\x20is\x20enabled!');_0x3b1102[_0xd4f9('0x88')]=_0x432119[_0xd4f9('0x85')]+_0xd4f9('0x89')+_0x3b1102['uniqueid']+_0xd4f9('0x8a')+md5(_0x3b1102[_0xd4f9('0x8b')]);}else{_0x3b1102[_0xd4f9('0x88')]='';}var _0x418ec9=_0x432119['host']===_0xd4f9('0x8c')?'eu':_0xd4f9('0x8d');return getAccessToken(_0x432119)[_0xd4f9('0x36')](function(_0x347a75){_0x2b9a99=_0x347a75;return getUser(_0x2b9a99,_0x418ec9,_0x432119,_0x434b79[_0xd4f9('0x3a')]);})[_0xd4f9('0x36')](function(_0x5e3ea3){_0x42ad97=_0x5e3ea3;logger['info'](_0xd4f9('0x8e'),_0x42ad97['id']);return getEndUser(_0x2b9a99,_0x418ec9,_0x432119,_0x3b1102[_0xd4f9('0x8f')],_0x3b1102[_0xd4f9('0x90')],_0x42ad97,_0x68434);})[_0xd4f9('0x36')](function(_0x1aef96){_0x30b229=_0x1aef96;return getCall(_0x2b9a99,_0x418ec9,_0x432119,_0x42ad97,_0x30b229,_0x68434,_0x3b1102,'Inbound');})[_0xd4f9('0x36')](function(_0xead88a){if(_0xead88a){logger['info'](_0xd4f9('0x91'),_0xead88a['id']);logger['info'](_0xd4f9('0x87'),_0xd4f9('0x92'));emit(util['format'](_0xd4f9('0x93'),_0x434b79[_0xd4f9('0x1a')]),_0xd4f9('0x94'),{'uri':_0xd4f9('0x95')+_0x432119['host']+_0xd4f9('0x96')+_0xead88a['id']});}})[_0xd4f9('0x2e')](function(_0x36165c){logger[_0xd4f9('0x2f')](_0xd4f9('0x87'),JSON[_0xd4f9('0xe')](_0x36165c));});};exports[_0xd4f9('0x7b')]=function(_0x44f8c4,_0x26a158,_0xf46a5b,_0x175c6f,_0x2099dc,_0x392fd2,_0x21c078){var _0x4a704d,_0x424462,_0x27071d;_0x392fd2[_0xd4f9('0x83')]=intUtil[_0xd4f9('0x84')](_0x392fd2['host']);_0x392fd2[_0xd4f9('0x85')]=intUtil[_0xd4f9('0x84')](_0x392fd2[_0xd4f9('0x85')]);if(_0x21c078&&_0x21c078[_0xd4f9('0x97')]&&_0x21c078[_0xd4f9('0x97')]!==_0xd4f9('0x98')){logger[_0xd4f9('0x3b')](_0xd4f9('0x99'),_0xd4f9('0x9a'));_0x26a158[_0xd4f9('0x88')]=_0x392fd2[_0xd4f9('0x85')]+'/api/voice/recordings/'+_0x26a158['uniqueid']+_0xd4f9('0x8a')+md5(_0x26a158[_0xd4f9('0x8b')]);}var _0x5286a0=_0x392fd2[_0xd4f9('0x83')]===_0xd4f9('0x8c')?'eu':'com';return getAccessToken(_0x392fd2)[_0xd4f9('0x36')](function(_0x1d3590){_0x27071d=_0x1d3590;return getUser(_0x27071d,_0x5286a0,_0x392fd2,_0x175c6f[_0xd4f9('0x3a')]);})[_0xd4f9('0x36')](function(_0x18d568){_0x4a704d=_0x18d568;logger[_0xd4f9('0x3b')](_0xd4f9('0x8e'),_0x4a704d['id']);return getEndUser(_0x27071d,_0x5286a0,_0x392fd2,_0x26a158['destcalleridname'],_0x26a158[_0xd4f9('0x9b')],_0x4a704d,_0xf46a5b);})[_0xd4f9('0x36')](function(_0x1fbd1f){_0x424462=_0x1fbd1f;return getCall(_0x27071d,_0x5286a0,_0x392fd2,_0x4a704d,_0x424462,_0xf46a5b,_0x26a158,_0xd4f9('0x9c'));})[_0xd4f9('0x36')](function(_0x142898){if(_0x142898){logger[_0xd4f9('0x3b')](_0xd4f9('0x91'),_0x142898['id']);logger[_0xd4f9('0x3b')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd4f9('0x32')](_0xd4f9('0x93'),_0x175c6f[_0xd4f9('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x392fd2[_0xd4f9('0x83')]+'/crm/EntityInfo.do?module=Calls&id='+_0x142898['id']});}})['catch'](function(_0x215f0b){logger[_0xd4f9('0x2f')](_0xd4f9('0x99'),JSON['stringify'](_0x215f0b));});};exports[_0xd4f9('0x9d')]=function(_0xc115b9,_0x147656,_0x1c1fa5,_0x5a3273,_0x9a01cd,_0x4a099c){var _0x3e53f1,_0x523c87,_0x214a9f;_0x4a099c[_0xd4f9('0x83')]=intUtil[_0xd4f9('0x84')](_0x4a099c[_0xd4f9('0x83')]);_0x4a099c[_0xd4f9('0x85')]=intUtil[_0xd4f9('0x84')](_0x4a099c[_0xd4f9('0x85')]);if(_0x9a01cd&&_0x9a01cd['monitor_format']){logger[_0xd4f9('0x3b')]('['+_0x147656['lastevent'][_0xd4f9('0x9e')]()+']','Recording\x20is\x20enabled!');_0x147656[_0xd4f9('0x88')]=_0x4a099c[_0xd4f9('0x85')]+_0xd4f9('0x89')+_0x147656[_0xd4f9('0x8b')]+_0xd4f9('0x8a')+md5(_0x147656['uniqueid']);}else{_0x147656[_0xd4f9('0x88')]='';}var _0x42b965=_0x4a099c[_0xd4f9('0x83')]===_0xd4f9('0x8c')?'eu':_0xd4f9('0x8d');return getAccessToken(_0x4a099c)[_0xd4f9('0x36')](function(_0xc1b7cb){_0x214a9f=_0xc1b7cb;return getUser(_0x214a9f,_0x42b965,_0x4a099c);})[_0xd4f9('0x36')](function(_0x58c3af){_0x3e53f1=_0x58c3af;logger[_0xd4f9('0x3b')]('The\x20User\x20ID\x20is:',_0x3e53f1['id']);return getEndUser(_0x214a9f,_0x42b965,_0x4a099c,_0x147656['calleridname'],_0x147656[_0xd4f9('0x90')],_0x3e53f1,_0x1c1fa5);})[_0xd4f9('0x36')](function(_0x39e3a3){_0x523c87=_0x39e3a3;return getCall(_0x214a9f,_0x42b965,_0x4a099c,_0x3e53f1,_0x523c87,_0x1c1fa5,_0x147656,_0xd4f9('0x9f'));})[_0xd4f9('0x36')](function(_0x15f70f){if(_0x15f70f){logger[_0xd4f9('0x3b')]('The\x20Call\x20ID\x20is:',_0x15f70f['id']);}})[_0xd4f9('0x2e')](function(_0x38ebd6){logger[_0xd4f9('0x2f')]('['+_0x147656['lastevent']['toUpperCase']()+']',JSON[_0xd4f9('0xe')](_0x38ebd6));});}; \ 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 b3129af..22f83f9 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 _0x1f53=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','../../../../config/logger','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x35c243,_0x5ace82){var _0x29a1f7=function(_0x188cc3){while(--_0x188cc3){_0x35c243['push'](_0x35c243['shift']());}};_0x29a1f7(++_0x5ace82);}(_0x1f53,0x7a));var _0x31f5=function(_0x2531fb,_0x1075f6){_0x2531fb=_0x2531fb-0x0;var _0x3afcc2=_0x1f53[_0x2531fb];return _0x3afcc2;};'use strict';var util=require(_0x31f5('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x31f5('0x1'))(_0x31f5('0x2'));exports[_0x31f5('0x3')]=function(_0x509d3e,_0x26b9a5){var _0x103a70=_0x509d3e[_0x31f5('0x4')]?_0x509d3e['data2']:_0x31f5('0x5');var _0x259dbd=_0x509d3e['data3']?Mustache['render'](_0x509d3e[_0x31f5('0x6')],_0x26b9a5):_0x26b9a5;sh[_0x31f5('0x3')](_0x259dbd,function(_0x22e260,_0x118011,_0x26c667){if(_0x22e260!==0x0){logger[_0x31f5('0x7')](util[_0x31f5('0x8')](_0x31f5('0x9'),_0x103a70,_0x259dbd,_0x22e260,_0x26c667));}else{logger['info'](util[_0x31f5('0x8')](_0x31f5('0xa'),_0x103a70,_0x259dbd,_0x118011));}});}; \ No newline at end of file +var _0x3e52=['util','shelljs','mustache','../../../../config/logger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x52fc98,_0x5aac29){var _0x1a70b4=function(_0x3d7578){while(--_0x3d7578){_0x52fc98['push'](_0x52fc98['shift']());}};_0x1a70b4(++_0x5aac29);}(_0x3e52,0x134));var _0x23e5=function(_0x2db845,_0x38d794){_0x2db845=_0x2db845-0x0;var _0x247735=_0x3e52[_0x2db845];return _0x247735;};'use strict';var util=require(_0x23e5('0x0'));var sh=require(_0x23e5('0x1'));var Mustache=require(_0x23e5('0x2'));var logger=require(_0x23e5('0x3'))('trigger');exports[_0x23e5('0x4')]=function(_0x119d49,_0x2e41be){var _0x3e93e2=_0x119d49['data2']?_0x119d49[_0x23e5('0x5')]:_0x23e5('0x6');var _0x2a67e9=_0x119d49[_0x23e5('0x7')]?Mustache[_0x23e5('0x8')](_0x119d49[_0x23e5('0x7')],_0x2e41be):_0x2e41be;sh[_0x23e5('0x4')](_0x2a67e9,function(_0x33fc9e,_0xa0287a,_0x3ca441){if(_0x33fc9e!==0x0){logger[_0x23e5('0x9')](util[_0x23e5('0xa')](_0x23e5('0xb'),_0x3e93e2,_0x2a67e9,_0x33fc9e,_0x3ca441));}else{logger[_0x23e5('0xc')](util[_0x23e5('0xa')](_0x23e5('0xd'),_0x3e93e2,_0x2a67e9,_0xa0287a));}});}; \ 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 93b657c..2ed9dd6 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 _0x1e43=['request-promise','lodash','../../../../config/logger','trigger','exec','render','data2','data5','headers','data6','parse','error','stack','data1','toUpperCase','GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','info','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message'];(function(_0x4ddd0c,_0x286347){var _0x1bb998=function(_0x18c844){while(--_0x18c844){_0x4ddd0c['push'](_0x4ddd0c['shift']());}};_0x1bb998(++_0x286347);}(_0x1e43,0x1ba));var _0x31e4=function(_0x3f4568,_0x9eb0ee){_0x3f4568=_0x3f4568-0x0;var _0xee2340=_0x1e43[_0x3f4568];return _0xee2340;};'use strict';var rp=require(_0x31e4('0x0'));var util=require('util');var _=require(_0x31e4('0x1'));var Mustache=require('mustache');var logger=require(_0x31e4('0x2'))(_0x31e4('0x3'));exports[_0x31e4('0x4')]=function(_0x1eae83,_0x1fda10){var _0x2ef30c,_0x316721;var _0x3266e0={'method':_0x1eae83['data1']['toUpperCase'](),'uri':Mustache[_0x31e4('0x5')](_0x1eae83[_0x31e4('0x6')],_0x1fda10),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1eae83[_0x31e4('0x7')])==='number'&&parseInt(_0x1eae83[_0x31e4('0x7')])>=0x1&&parseInt(_0x1eae83[_0x31e4('0x7')])<=0xa?parseInt(_0x1eae83['data5'])*0x3e8:0x5*0x3e8};try{_0x3266e0[_0x31e4('0x8')]=_0x1eae83[_0x31e4('0x9')]?JSON[_0x31e4('0xa')](Mustache[_0x31e4('0x5')](_0x1eae83[_0x31e4('0x9')],_0x1fda10)):{};}catch(_0x49ff6d){logger[_0x31e4('0xb')](_0x49ff6d[_0x31e4('0xc')]);}switch(_0x1eae83[_0x31e4('0xd')][_0x31e4('0xe')]()){case _0x31e4('0xf'):case _0x31e4('0x10'):_0x2ef30c=null;_0x3266e0['qs']=_0x1fda10;break;case'POST':case _0x31e4('0x11'):if(_0x1eae83['data7']){try{_0x2ef30c=JSON[_0x31e4('0xa')](Mustache[_0x31e4('0x5')](_0x1eae83[_0x31e4('0x12')],_0x1fda10));_0x3266e0[_0x31e4('0x13')]=_0x2ef30c;}catch(_0x5b9aad){logger[_0x31e4('0xb')](_0x5b9aad[_0x31e4('0xc')]);logger[_0x31e4('0xb')](_0x31e4('0x14'));}}else{_0x2ef30c=_0x1fda10;_0x3266e0[_0x31e4('0x13')]=_0x2ef30c;}break;}logger['info'](util[_0x31e4('0x15')](_0x31e4('0x16'),_0x1eae83['data1'],_0x1eae83[_0x31e4('0x6')],JSON[_0x31e4('0x17')](_0x3266e0)));rp(_0x3266e0)[_0x31e4('0x18')](function(_0x269d7f){_0x2ef30c=!_[_0x31e4('0x19')](_0x2ef30c)?_0x31e4('0x1a')+_0x2ef30c:'';_0x316721=typeof _0x269d7f[_0x31e4('0x13')]===_0x31e4('0x1b')?JSON[_0x31e4('0x17')](_0x269d7f['body']):_0x269d7f[_0x31e4('0x13')];logger[_0x31e4('0x1c')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x1eae83['data1'],_0x1eae83[_0x31e4('0x6')],_0x269d7f[_0x31e4('0x1d')],_0x316721));})[_0x31e4('0x1e')](function(_0x46c57e){logger[_0x31e4('0xb')](util[_0x31e4('0x15')](_0x31e4('0x1f'),_0x1eae83[_0x31e4('0xd')],_0x1eae83[_0x31e4('0x6')],_0x46c57e[_0x31e4('0x1d')],_0x46c57e[_0x31e4('0x20')],_0x46c57e[_0x31e4('0x21')]));});}; \ No newline at end of file +var _0x8f95=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','../../../../config/logger','trigger','exec','toUpperCase','render','data2','data5','number','headers','data6','parse','data1','GET','DELETE','POST','PUT','data7','body','error','stack'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x8f95,0xc1));var _0x58f9=function(_0x10d9a7,_0xfe57bc){_0x10d9a7=_0x10d9a7-0x0;var _0xaca2bd=_0x8f95[_0x10d9a7];return _0xaca2bd;};'use strict';var rp=require(_0x58f9('0x0'));var util=require(_0x58f9('0x1'));var _=require(_0x58f9('0x2'));var Mustache=require('mustache');var logger=require(_0x58f9('0x3'))(_0x58f9('0x4'));exports[_0x58f9('0x5')]=function(_0x121cbd,_0x444afd){var _0x6e1589,_0x5f22da;var _0x51d82b={'method':_0x121cbd['data1'][_0x58f9('0x6')](),'uri':Mustache[_0x58f9('0x7')](_0x121cbd[_0x58f9('0x8')],_0x444afd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x121cbd[_0x58f9('0x9')])===_0x58f9('0xa')&&parseInt(_0x121cbd[_0x58f9('0x9')])>=0x1&&parseInt(_0x121cbd[_0x58f9('0x9')])<=0xa?parseInt(_0x121cbd['data5'])*0x3e8:0x5*0x3e8};try{_0x51d82b[_0x58f9('0xb')]=_0x121cbd[_0x58f9('0xc')]?JSON[_0x58f9('0xd')](Mustache[_0x58f9('0x7')](_0x121cbd[_0x58f9('0xc')],_0x444afd)):{};}catch(_0x125e01){logger['error'](_0x125e01['stack']);}switch(_0x121cbd[_0x58f9('0xe')]['toUpperCase']()){case _0x58f9('0xf'):case _0x58f9('0x10'):_0x6e1589=null;_0x51d82b['qs']=_0x444afd;break;case _0x58f9('0x11'):case _0x58f9('0x12'):if(_0x121cbd[_0x58f9('0x13')]){try{_0x6e1589=JSON[_0x58f9('0xd')](Mustache[_0x58f9('0x7')](_0x121cbd[_0x58f9('0x13')],_0x444afd));_0x51d82b[_0x58f9('0x14')]=_0x6e1589;}catch(_0x5a278a){logger[_0x58f9('0x15')](_0x5a278a[_0x58f9('0x16')]);logger[_0x58f9('0x15')](_0x58f9('0x17'));}}else{_0x6e1589=_0x444afd;_0x51d82b[_0x58f9('0x14')]=_0x6e1589;}break;}logger[_0x58f9('0x18')](util[_0x58f9('0x19')](_0x58f9('0x1a'),_0x121cbd[_0x58f9('0xe')],_0x121cbd[_0x58f9('0x8')],JSON[_0x58f9('0x1b')](_0x51d82b)));rp(_0x51d82b)[_0x58f9('0x1c')](function(_0x4caacb){_0x6e1589=!_['isNil'](_0x6e1589)?_0x58f9('0x1d')+_0x6e1589:'';_0x5f22da=typeof _0x4caacb[_0x58f9('0x14')]===_0x58f9('0x1e')?JSON['stringify'](_0x4caacb[_0x58f9('0x14')]):_0x4caacb['body'];logger[_0x58f9('0x18')](util[_0x58f9('0x19')](_0x58f9('0x1f'),_0x121cbd[_0x58f9('0xe')],_0x121cbd[_0x58f9('0x8')],_0x4caacb[_0x58f9('0x20')],_0x5f22da));})[_0x58f9('0x21')](function(_0x371272){logger['error'](util['format'](_0x58f9('0x22'),_0x121cbd[_0x58f9('0xe')],_0x121cbd['data2'],_0x371272[_0x58f9('0x20')],_0x371272['name'],_0x371272[_0x58f9('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 666f121..bca6560 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 _0x2121=['rpc','routing','error','message','result','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','debug'];(function(_0x100d98,_0x1eecea){var _0x28617b=function(_0x473b8b){while(--_0x473b8b){_0x100d98['push'](_0x100d98['shift']());}};_0x28617b(++_0x1eecea);}(_0x2121,0x1cd));var _0x1212=function(_0x3a8b95,_0x4e0cc5){_0x3a8b95=_0x3a8b95-0x0;var _0x4adc23=_0x2121[_0x3a8b95];return _0x4adc23;};'use strict';var jayson=require(_0x1212('0x0'));var BPromise=require(_0x1212('0x1'));var logger=require(_0x1212('0x2'))('routing');var client=jayson[_0x1212('0x3')][_0x1212('0x4')]({'port':0x2329});client[_0x1212('0x5')]=function(_0x3312d0,_0x2e020a){return new BPromise(function(_0x15c80c,_0x26e3cd){return client['request'](_0x3312d0,_0x2e020a)['then'](function(_0x414359){logger[_0x1212('0x6')](_0x1212('0x7'),_0x1212('0x8'),_0x3312d0,_0x2e020a,_0x414359);if(_0x414359[_0x1212('0x9')]){logger[_0x1212('0x9')]('rpc',_0x1212('0x8'),_0x3312d0,_0x414359['error'][_0x1212('0xa')],_0x2e020a);return _0x26e3cd(_0x414359[_0x1212('0x9')][_0x1212('0xa')]);}else{return _0x15c80c(_0x414359[_0x1212('0xb')]);}})['catch'](function(_0x5addb9){logger[_0x1212('0x9')](_0x1212('0x7'),_0x1212('0x8'),_0x3312d0,_0x5addb9,_0x2e020a);return _0x26e3cd(_0x5addb9);});});};module[_0x1212('0xc')]=client; \ No newline at end of file +var _0xddf5=['exports','jayson/promise','../../config/logger','routing','client','Request','then','debug','error','message','result','catch','rpc'];(function(_0x4ea224,_0x463318){var _0x4e363e=function(_0x19be03){while(--_0x19be03){_0x4ea224['push'](_0x4ea224['shift']());}};_0x4e363e(++_0x463318);}(_0xddf5,0x146));var _0x5ddf=function(_0x2a2ac6,_0x355926){_0x2a2ac6=_0x2a2ac6-0x0;var _0x3f1cc4=_0xddf5[_0x2a2ac6];return _0x3f1cc4;};'use strict';var jayson=require(_0x5ddf('0x0'));var BPromise=require('bluebird');var logger=require(_0x5ddf('0x1'))(_0x5ddf('0x2'));var client=jayson[_0x5ddf('0x3')]['http']({'port':0x2329});client[_0x5ddf('0x4')]=function(_0x2135a6,_0x1b5b57){return new BPromise(function(_0x2a4224,_0xe3c2d1){return client['request'](_0x2135a6,_0x1b5b57)[_0x5ddf('0x5')](function(_0x36b7e1){logger[_0x5ddf('0x6')]('rpc',_0x5ddf('0x2'),_0x2135a6,_0x1b5b57,_0x36b7e1);if(_0x36b7e1[_0x5ddf('0x7')]){logger['error']('rpc',_0x5ddf('0x2'),_0x2135a6,_0x36b7e1[_0x5ddf('0x7')]['message'],_0x1b5b57);return _0xe3c2d1(_0x36b7e1[_0x5ddf('0x7')][_0x5ddf('0x8')]);}else{return _0x2a4224(_0x36b7e1[_0x5ddf('0x9')]);}})[_0x5ddf('0xa')](function(_0x424614){logger[_0x5ddf('0x7')](_0x5ddf('0xb'),_0x5ddf('0x2'),_0x2135a6,_0x424614,_0x1b5b57);return _0xe3c2d1(_0x424614);});});};module[_0x5ddf('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0a58276..410a6ba 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 _0xd6bc=['bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','getMailAccounts','then','refresh','mailAccounts','listen','getSettings','log'];(function(_0x576540,_0x246be7){var _0x4f3124=function(_0x4ee38a){while(--_0x4ee38a){_0x576540['push'](_0x576540['shift']());}};_0x4f3124(++_0x246be7);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd6bc[_0x2be8c2];return _0x97f531;};'use strict';var BPromise=require(_0xcd6b('0x0'));var server=require(_0xcd6b('0x1'));var Realtime=require(_0xcd6b('0x2'));var EmailChannel=require(_0xcd6b('0x3'));var mailAccount=require(_0xcd6b('0x4'));var setting=require(_0xcd6b('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0xcd6b('0x6')]())['then'](realtime['initMailAccounts']())[_0xcd6b('0x7')](function(){email[_0xcd6b('0x8')](realtime[_0xcd6b('0x9')]);return realtime;});}function main(){return server[_0xcd6b('0xa')](realtime,email)[_0xcd6b('0x7')](function(){return initRealtime();})[_0xcd6b('0x7')](function(){return setting[_0xcd6b('0xb')]();})[_0xcd6b('0x7')](function(_0x2ff2e4){return setInterval(initRealtime,_0x2ff2e4['loginMailFrequency']*0x3e8);})['catch'](function(_0x49b431){console[_0xcd6b('0xc')](_0x49b431);});}main(); \ No newline at end of file +var _0xed48=['listen','getSettings','loginMailFrequency','log','./server','./lib/email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0xed48,0x90));var _0x8ed4=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0xed48[_0x503cd5];return _0x1fdf1e;};'use strict';var BPromise=require('bluebird');var server=require(_0x8ed4('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x8ed4('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x8ed4('0x2')]()[_0x8ed4('0x3')](mailAccount[_0x8ed4('0x4')]())[_0x8ed4('0x3')](realtime[_0x8ed4('0x5')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x8ed4('0x6')](realtime,email)[_0x8ed4('0x3')](function(){return initRealtime();})[_0x8ed4('0x3')](function(){return setting[_0x8ed4('0x7')]();})['then'](function(_0x3ad89e){return setInterval(initRealtime,_0x3ad89e[_0x8ed4('0x8')]*0x3e8);})['catch'](function(_0x27b35f){console[_0x8ed4('0x9')](_0x27b35f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index aeb1a9a..26119d0 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 _0xd62a=['defaults','localhost','socket.io-emitter','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','isNil','md5','mailAccount:update','hasOwnProperty','email','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','disabled','connected','name','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','sendMail','verifySmtp','Smtp','then','verified','verify','exports','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','redis'];(function(_0x3220bb,_0x342a03){var _0x23415c=function(_0x56cc05){while(--_0x56cc05){_0x3220bb['push'](_0x3220bb['shift']());}};_0x23415c(++_0x342a03);}(_0xd62a,0x138));var _0xad62=function(_0x15600f,_0xd8daf6){_0x15600f=_0x15600f-0x0;var _0x2c4b0d=_0xd62a[_0x15600f];return _0x2c4b0d;};'use strict';var _=require('lodash');var moment=require(_0xad62('0x0'));var BPromise=require(_0xad62('0x1'));var md5=require('md5');var Redis=require(_0xad62('0x2'));var config=require(_0xad62('0x3'));var logger=require(_0xad62('0x4'))('email');config[_0xad62('0x5')]=_[_0xad62('0x6')](config[_0xad62('0x5')],{'host':_0xad62('0x7'),'port':0x18eb});var io=require(_0xad62('0x8'))(new Redis(config[_0xad62('0x5')]));var EmailImap=require(_0xad62('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x32b98b){logger[_0xad62('0xa')](_0xad62('0xb'));this['mailAccounts']=_0x32b98b[_0xad62('0xc')];this[_0xad62('0xd')]={};this[_0xad62('0xe')]=new EmailSmtp();}EmailChannel[_0xad62('0xf')][_0xad62('0x10')]=function(_0x17288e){var _0x4bab5d=this[_0xad62('0xc')][_0x17288e];var _0x24a931={'id':_0x4bab5d['id'],'name':_0x4bab5d['name'],'key':_0x4bab5d[_0xad62('0x11')],'active':_0x4bab5d[_0xad62('0x12')],'Imap':{'status':_0x4bab5d[_0xad62('0x13')][_0xad62('0x14')],'messageStatus':_0x4bab5d[_0xad62('0x13')][_0xad62('0x15')],'total':_0x4bab5d[_0xad62('0x13')]['total']}};if(_[_0xad62('0x16')](md5Accounts[_0x17288e])){md5Accounts[_0x17288e]={};}var _0x10ffdb=md5(JSON['stringify'](_0x24a931));if(md5Accounts[_0x17288e][_0xad62('0x17')]!==_0x10ffdb){md5Accounts[_0x17288e][_0xad62('0x17')]=_0x10ffdb;io[_0xad62('0x10')](_0xad62('0x18'),_0x24a931);}};EmailChannel[_0xad62('0xf')]['refresh']=function(_0x54f044){for(var _0x13c06e in _0x54f044){if(_0x54f044[_0xad62('0x19')](_0x13c06e)){if(_0x54f044[_0x13c06e][_0xad62('0x13')]&&_0x54f044[_0x13c06e][_0xad62('0x12')]){var _0x289ae3=_0x54f044[_0x13c06e][_0xad62('0x13')];if(!this['imapAccounts'][_0xad62('0x19')](_0x289ae3['id'])){this[_0xad62('0xd')][_0x289ae3['id']]=new EmailImap(_0x289ae3,_0x54f044[_0x13c06e][_0xad62('0x1a')]);this[_0xad62('0xd')][_0x289ae3['id']]['on'](_0xad62('0x1b'),this[_0xad62('0x1c')]['bind'](this,_0x13c06e));this[_0xad62('0xd')][_0x289ae3['id']]['on']('email',this[_0xad62('0x1d')][_0xad62('0x1e')](this,_0x13c06e));this[_0xad62('0xd')][_0x289ae3['id']]['on'](_0xad62('0x1f'),this[_0xad62('0x20')][_0xad62('0x1e')](this,_0x13c06e));this[_0xad62('0xd')][_0x289ae3['id']]['on'](_0xad62('0x21'),this['handleImapError']['bind'](this,_0x13c06e));}}else{if(_[_0xad62('0x16')](this[_0xad62('0xc')][_0x13c06e]['Imap'])){this[_0xad62('0xc')][_0x13c06e][_0xad62('0x13')]={};}this[_0xad62('0xc')][_0x13c06e]['Imap'][_0xad62('0x14')]=_0xad62('0x22');this[_0xad62('0xc')][_0x13c06e]['Imap'][_0xad62('0x15')]='';this['emit'](_0x13c06e);}}}};EmailChannel['prototype'][_0xad62('0x1c')]=function(_0x59887f,_0x2c7c2d){if(this[_0xad62('0xc')][_0x59887f]){this[_0xad62('0xc')][_0x59887f]['Imap']['status']=_0xad62('0x23');this[_0xad62('0xc')][_0x59887f][_0xad62('0x13')][_0xad62('0x15')]=_0x2c7c2d[_0xad62('0x24')];if(_0x2c7c2d['messages']){this[_0xad62('0xc')][_0x59887f][_0xad62('0x13')][_0xad62('0x25')]=_0x2c7c2d['messages']['total'];}return this['emit'](_0x59887f);}};EmailChannel['prototype'][_0xad62('0x1d')]=function(_0x23043b,_0xf4b7e){logger['info'](_0xad62('0x26'),_0xf4b7e[_0xad62('0x27')],_0xf4b7e[_0xad62('0x28')],_0xf4b7e['from'],_0x23043b);if(this['mailAccounts'][_0x23043b]){return mailAccount['notify'](_0x23043b,_0xf4b7e)['then'](function(_0x1d9a75){if(_0x1d9a75){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0xad62('0x29')](function(_0x1a08b4){logger[_0xad62('0x21')](_0xad62('0x2a'),JSON[_0xad62('0x2b')](_0x1a08b4));});}};EmailChannel[_0xad62('0xf')][_0xad62('0x20')]=function(_0x29417c){if(this['mailAccounts'][_0x29417c]&&this[_0xad62('0xc')][_0x29417c]['Imap']){if(this[_0xad62('0xd')][this['mailAccounts'][_0x29417c]['Imap']['id']]){delete this[_0xad62('0xd')][this[_0xad62('0xc')][_0x29417c]['Imap']['id']];}this[_0xad62('0xc')][_0x29417c][_0xad62('0x13')][_0xad62('0x2c')]=moment();this[_0xad62('0x10')](_0x29417c);}};EmailChannel[_0xad62('0xf')][_0xad62('0x2d')]=function(_0x539aa6,_0xa79fc8){if(this[_0xad62('0xc')][_0x539aa6]){this[_0xad62('0xc')][_0x539aa6][_0xad62('0x13')]['status']=_0xad62('0x21');this[_0xad62('0xc')][_0x539aa6][_0xad62('0x13')][_0xad62('0x15')]=_0xa79fc8;return this[_0xad62('0x10')](_0x539aa6);}};EmailChannel[_0xad62('0xf')][_0xad62('0x2e')]=function(_0x14991b,_0x3ea3f3){return this[_0xad62('0xe')]['send'](_0x14991b,_0x3ea3f3);};EmailChannel[_0xad62('0xf')][_0xad62('0x2f')]=function(_0x5565d8){var _0x5a3cbc=this;if(this[_0xad62('0xc')][_0x5565d8['id']]){if(_[_0xad62('0x16')](this[_0xad62('0xc')][_0x5565d8['id']][_0xad62('0x30')])){this[_0xad62('0xc')][_0x5565d8['id']]['Smtp']={};}this[_0xad62('0xc')][_0x5565d8['id']][_0xad62('0x30')][_0xad62('0x2c')]=moment();return new BPromise(function(_0x3d0751,_0x565190){return _0x5a3cbc[_0xad62('0xe')]['verify'](_0x5565d8)[_0xad62('0x31')](function(_0x2854d4){_0x5a3cbc[_0xad62('0xc')][_0x5565d8['id']]['Smtp'][_0xad62('0x14')]=_0xad62('0x32');_0x5a3cbc[_0xad62('0xc')][_0x5565d8['id']][_0xad62('0x30')]['messageStatus']='';_0x5a3cbc[_0xad62('0x10')](_0x5565d8['id']);_0x3d0751(_0x2854d4);})['catch'](function(_0x244cc5){_0x5a3cbc[_0xad62('0xc')][_0x5565d8['id']]['Smtp']['status']=_0xad62('0x21');_0x5a3cbc[_0xad62('0xc')][_0x5565d8['id']][_0xad62('0x30')][_0xad62('0x15')]=_0x244cc5;_0x5a3cbc[_0xad62('0x10')](_0x5565d8['id']);_0x565190(_0x244cc5);});});}return this['smtp'][_0xad62('0x33')](_0x5565d8);};module[_0xad62('0x34')]=EmailChannel; \ No newline at end of file +var _0x19f2=['Smtp','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','Imap','status','messageStatus','total','isNil','stringify','md5','refresh','hasOwnProperty','active','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','connected','name','messages','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','verifySmtp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19f2,0x176));var _0x219f=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x19f2[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x219f('0x0'));var moment=require(_0x219f('0x1'));var BPromise=require(_0x219f('0x2'));var md5=require('md5');var Redis=require(_0x219f('0x3'));var config=require(_0x219f('0x4'));var logger=require(_0x219f('0x5'))(_0x219f('0x6'));config[_0x219f('0x7')]=_[_0x219f('0x8')](config[_0x219f('0x7')],{'host':_0x219f('0x9'),'port':0x18eb});var io=require(_0x219f('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x219f('0xb'));var EmailSmtp=require(_0x219f('0xc'));var mailAccount=require(_0x219f('0xd'));var md5Accounts={};function EmailChannel(_0x1a3271){logger[_0x219f('0xe')]('start\x20email\x20channel');this[_0x219f('0xf')]=_0x1a3271[_0x219f('0xf')];this['imapAccounts']={};this[_0x219f('0x10')]=new EmailSmtp();}EmailChannel[_0x219f('0x11')][_0x219f('0x12')]=function(_0x3b1294){var _0x236d1d=this[_0x219f('0xf')][_0x3b1294];var _0x3b094b={'id':_0x236d1d['id'],'name':_0x236d1d['name'],'key':_0x236d1d['key'],'active':_0x236d1d['active'],'Imap':{'status':_0x236d1d[_0x219f('0x13')][_0x219f('0x14')],'messageStatus':_0x236d1d[_0x219f('0x13')][_0x219f('0x15')],'total':_0x236d1d[_0x219f('0x13')][_0x219f('0x16')]}};if(_[_0x219f('0x17')](md5Accounts[_0x3b1294])){md5Accounts[_0x3b1294]={};}var _0x41f08f=md5(JSON[_0x219f('0x18')](_0x3b094b));if(md5Accounts[_0x3b1294][_0x219f('0x19')]!==_0x41f08f){md5Accounts[_0x3b1294][_0x219f('0x19')]=_0x41f08f;io[_0x219f('0x12')]('mailAccount:update',_0x3b094b);}};EmailChannel[_0x219f('0x11')][_0x219f('0x1a')]=function(_0xfc55aa){for(var _0x4e04f3 in _0xfc55aa){if(_0xfc55aa[_0x219f('0x1b')](_0x4e04f3)){if(_0xfc55aa[_0x4e04f3][_0x219f('0x13')]&&_0xfc55aa[_0x4e04f3][_0x219f('0x1c')]){var _0x2316ad=_0xfc55aa[_0x4e04f3][_0x219f('0x13')];if(!this[_0x219f('0x1d')][_0x219f('0x1b')](_0x2316ad['id'])){this[_0x219f('0x1d')][_0x2316ad['id']]=new EmailImap(_0x2316ad,_0xfc55aa[_0x4e04f3]['email']);this[_0x219f('0x1d')][_0x2316ad['id']]['on'](_0x219f('0x1e'),this[_0x219f('0x1f')][_0x219f('0x20')](this,_0x4e04f3));this[_0x219f('0x1d')][_0x2316ad['id']]['on']('email',this[_0x219f('0x21')]['bind'](this,_0x4e04f3));this[_0x219f('0x1d')][_0x2316ad['id']]['on'](_0x219f('0x22'),this[_0x219f('0x23')][_0x219f('0x20')](this,_0x4e04f3));this['imapAccounts'][_0x2316ad['id']]['on'](_0x219f('0x24'),this[_0x219f('0x25')]['bind'](this,_0x4e04f3));}}else{if(_[_0x219f('0x17')](this['mailAccounts'][_0x4e04f3][_0x219f('0x13')])){this[_0x219f('0xf')][_0x4e04f3][_0x219f('0x13')]={};}this[_0x219f('0xf')][_0x4e04f3][_0x219f('0x13')][_0x219f('0x14')]='disabled';this['mailAccounts'][_0x4e04f3][_0x219f('0x13')][_0x219f('0x15')]='';this[_0x219f('0x12')](_0x4e04f3);}}}};EmailChannel[_0x219f('0x11')][_0x219f('0x1f')]=function(_0x20bf0f,_0x58ca67){if(this[_0x219f('0xf')][_0x20bf0f]){this['mailAccounts'][_0x20bf0f][_0x219f('0x13')]['status']=_0x219f('0x26');this[_0x219f('0xf')][_0x20bf0f][_0x219f('0x13')][_0x219f('0x15')]=_0x58ca67[_0x219f('0x27')];if(_0x58ca67['messages']){this[_0x219f('0xf')][_0x20bf0f][_0x219f('0x13')][_0x219f('0x16')]=_0x58ca67[_0x219f('0x28')][_0x219f('0x16')];}return this[_0x219f('0x12')](_0x20bf0f);}};EmailChannel['prototype'][_0x219f('0x21')]=function(_0x3fe26a,_0x51802e){logger[_0x219f('0xe')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x51802e[_0x219f('0x29')],_0x51802e[_0x219f('0x2a')],_0x51802e[_0x219f('0x2b')],_0x3fe26a);if(this['mailAccounts'][_0x3fe26a]){return mailAccount[_0x219f('0x2c')](_0x3fe26a,_0x51802e)[_0x219f('0x2d')](function(_0x28a84c){if(_0x28a84c){logger[_0x219f('0xe')]('Mail\x20accepted\x20from\x20routing');}})[_0x219f('0x2e')](function(_0x50f2fc){logger[_0x219f('0x24')](_0x219f('0x2f'),JSON[_0x219f('0x18')](_0x50f2fc));});}};EmailChannel[_0x219f('0x11')][_0x219f('0x23')]=function(_0x4de993){if(this[_0x219f('0xf')][_0x4de993]&&this[_0x219f('0xf')][_0x4de993][_0x219f('0x13')]){if(this[_0x219f('0x1d')][this[_0x219f('0xf')][_0x4de993][_0x219f('0x13')]['id']]){delete this[_0x219f('0x1d')][this[_0x219f('0xf')][_0x4de993][_0x219f('0x13')]['id']];}this[_0x219f('0xf')][_0x4de993][_0x219f('0x13')][_0x219f('0x30')]=moment();this[_0x219f('0x12')](_0x4de993);}};EmailChannel['prototype'][_0x219f('0x25')]=function(_0x42ff99,_0x755e05){if(this[_0x219f('0xf')][_0x42ff99]){this[_0x219f('0xf')][_0x42ff99][_0x219f('0x13')][_0x219f('0x14')]=_0x219f('0x24');this[_0x219f('0xf')][_0x42ff99][_0x219f('0x13')][_0x219f('0x15')]=_0x755e05;return this[_0x219f('0x12')](_0x42ff99);}};EmailChannel[_0x219f('0x11')]['sendMail']=function(_0x3d45ec,_0x7c17af){return this[_0x219f('0x10')]['send'](_0x3d45ec,_0x7c17af);};EmailChannel[_0x219f('0x11')][_0x219f('0x31')]=function(_0x48f017){var _0x58e58f=this;if(this[_0x219f('0xf')][_0x48f017['id']]){if(_[_0x219f('0x17')](this[_0x219f('0xf')][_0x48f017['id']]['Smtp'])){this[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')]={};}this[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')][_0x219f('0x30')]=moment();return new BPromise(function(_0x74c229,_0x124ae1){return _0x58e58f[_0x219f('0x10')][_0x219f('0x33')](_0x48f017)['then'](function(_0x471296){_0x58e58f['mailAccounts'][_0x48f017['id']][_0x219f('0x32')][_0x219f('0x14')]='verified';_0x58e58f[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')][_0x219f('0x15')]='';_0x58e58f[_0x219f('0x12')](_0x48f017['id']);_0x74c229(_0x471296);})[_0x219f('0x2e')](function(_0x5bdff0){_0x58e58f[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')]['status']=_0x219f('0x24');_0x58e58f[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')][_0x219f('0x15')]=_0x5bdff0;_0x58e58f[_0x219f('0x12')](_0x48f017['id']);_0x124ae1(_0x5bdff0);});});}return this[_0x219f('0x10')][_0x219f('0x33')](_0x48f017);};module[_0x219f('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index cd4035e..afe2659 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 _0x07a5=['path','util','imap','randomstring','mailparser','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','ready','bind','once','end','handleEnd','error','connect','inherits','connTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','prototype','handleReady','openBox','handleOpenBox','handleError','box','handleCloseBox','search','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','textCode','upperFirst','exports'];(function(_0xe7ac98,_0x276438){var _0x45b7df=function(_0x184218){while(--_0x184218){_0xe7ac98['push'](_0xe7ac98['shift']());}};_0x45b7df(++_0x276438);}(_0x07a5,0x1e8));var _0x507a=function(_0x2de41e,_0x12a7dc){_0x2de41e=_0x2de41e-0x0;var _0x2e70d1=_0x07a5[_0x2de41e];return _0x2e70d1;};'use strict';var fs=require('fs');var path=require(_0x507a('0x0'));var util=require(_0x507a('0x1'));var Imap=require(_0x507a('0x2'));var _=require('lodash');var rs=require(_0x507a('0x3'));var simpleParser=require(_0x507a('0x4'))[_0x507a('0x5')];var Iconv=require('iconv')[_0x507a('0x6')];var EventEmitter=require('events')[_0x507a('0x7')];var utils=require(_0x507a('0x8'));var logger=require(_0x507a('0x9'))(_0x507a('0xa'));function EmailImap(_0x2ee80a,_0x5b14d5){this['mailbox']=_0x507a('0xb');this[_0x507a('0xc')]=this[_0x507a('0xd')](_0x2ee80a,_0x5b14d5);this['imap']=new Imap(this['account']);this['imap']['once'](_0x507a('0xe'),this['handleReady'][_0x507a('0xf')](this));this['imap'][_0x507a('0x10')](_0x507a('0x11'),this[_0x507a('0x12')][_0x507a('0xf')](this));this[_0x507a('0x2')]['on'](_0x507a('0x13'),this['handleError'][_0x507a('0xf')](this));this['imap'][_0x507a('0x14')]();}util[_0x507a('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x507a('0xd')]=function(_0x43fc17,_0x5bb8da){var _0x14e7c8={'connTimeout':_0x43fc17[_0x507a('0x16')]?_0x43fc17[_0x507a('0x16')]*0x3e8:0x2710,'authTimeout':_0x43fc17['authTimeout']?_0x43fc17['authTimeout']*0x3e8:0x1388};if(_[_0x507a('0x17')](_0x43fc17[_0x507a('0x18')])){if(_0x43fc17[_0x507a('0x19')]){_0x14e7c8[_0x507a('0x1a')]=_0x43fc17['user'];_0x14e7c8['password']=_0x43fc17[_0x507a('0x1b')];}_0x14e7c8[_0x507a('0x1c')]=_0x43fc17[_0x507a('0x1c')];_0x14e7c8[_0x507a('0x1d')]=_0x43fc17[_0x507a('0x1d')]||0x3e1;if(_0x43fc17[_0x507a('0x1e')]){_0x14e7c8[_0x507a('0x1e')]=!![];}else{_0x14e7c8['tls']=![];_0x14e7c8[_0x507a('0x1f')]=_0x507a('0x20');}}else{_0x14e7c8['user']=_0x43fc17[_0x507a('0x1a')];_0x14e7c8['password']=_0x43fc17['password'];_0x14e7c8['host']=utils[_0x507a('0x21')](_0x43fc17[_0x507a('0x18')]);_0x14e7c8[_0x507a('0x1d')]=0x3e1;_0x14e7c8[_0x507a('0x1e')]=!![];}_0x14e7c8[_0x507a('0xa')]=_0x5bb8da||_0x43fc17[_0x507a('0x1a')]||_0x507a('0x22');return _0x14e7c8;};EmailImap[_0x507a('0x23')][_0x507a('0x24')]=function(){this[_0x507a('0x2')][_0x507a('0x25')](this['mailbox'],![],this[_0x507a('0x26')][_0x507a('0xf')](this));};EmailImap[_0x507a('0x23')][_0x507a('0x26')]=function(_0x1bb330,_0x506076){if(_0x1bb330){this[_0x507a('0x27')](_0x1bb330,!![]);}else{this['emit'](_0x507a('0x28'),_0x506076);this['readUnseen']();}};EmailImap[_0x507a('0x23')][_0x507a('0x29')]=function(_0x4db07d){if(_0x4db07d){this['handleError'](_0x4db07d,!![]);}else{this[_0x507a('0x2')][_0x507a('0x11')]();}};EmailImap[_0x507a('0x23')]['readUnseen']=function(){this[_0x507a('0x2')][_0x507a('0x2a')](['UNSEEN'],this[_0x507a('0x2b')][_0x507a('0xf')](this));};EmailImap['prototype'][_0x507a('0x2b')]=function(_0x3d2f91,_0xb4110e){if(_0x3d2f91){this[_0x507a('0x27')](_0x3d2f91,!![]);}else{if(_0xb4110e[_0x507a('0x2c')]){try{var _0x7fb260=this[_0x507a('0x2')]['fetch'](_0xb4110e,{'bodies':'','markSeen':!![]});_0x7fb260['on'](_0x507a('0x2d'),this[_0x507a('0x2e')][_0x507a('0xf')](this));_0x7fb260[_0x507a('0x10')](_0x507a('0x13'),this[_0x507a('0x2f')][_0x507a('0xf')](this));_0x7fb260[_0x507a('0x10')]('end',this[_0x507a('0x30')][_0x507a('0xf')](this));}catch(_0x1625d7){logger['error'](_0x1625d7);}}else{this['imap'][_0x507a('0x31')](!![],this[_0x507a('0x29')][_0x507a('0xf')](this));}}};EmailImap[_0x507a('0x23')][_0x507a('0x2e')]=function(_0x10b68a,_0x1810d0){_0x10b68a['on'](_0x507a('0x32'),this[_0x507a('0x33')]['bind'](this));_0x10b68a[_0x507a('0x10')](_0x507a('0x34'),this[_0x507a('0x35')][_0x507a('0xf')](this));_0x10b68a['once'](_0x507a('0x11'),this[_0x507a('0x36')][_0x507a('0xf')](this));};EmailImap[_0x507a('0x23')][_0x507a('0x33')]=function(_0x2f498f,_0x17af81){simpleParser(_0x2f498f,{'Iconv':Iconv},this[_0x507a('0x37')][_0x507a('0xf')](this));};EmailImap[_0x507a('0x23')]['handleMessageAttributes']=function(_0x153861){};EmailImap[_0x507a('0x23')][_0x507a('0x36')]=function(){};EmailImap[_0x507a('0x23')][_0x507a('0x37')]=function(_0x455eaf,_0x426fba){if(_0x455eaf){logger[_0x507a('0x13')](_0x455eaf);}else{var _0x588d87=this;utils[_0x507a('0x38')](this[_0x507a('0xc')],_0x426fba,function(_0x195e36){_0x588d87[_0x507a('0x39')](_0x507a('0xa'),_0x195e36);});}};EmailImap[_0x507a('0x23')][_0x507a('0x30')]=function(){this[_0x507a('0x2')]['closeBox'](!![],this[_0x507a('0x29')]['bind'](this));};EmailImap[_0x507a('0x23')][_0x507a('0x2f')]=function(_0x19d0e9){this[_0x507a('0x27')](_0x19d0e9);this[_0x507a('0x2')][_0x507a('0x31')](!![],this['handleCloseBox'][_0x507a('0xf')](this));};EmailImap['prototype'][_0x507a('0x12')]=function(){this[_0x507a('0x39')](_0x507a('0x11'));};EmailImap[_0x507a('0x23')][_0x507a('0x27')]=function(_0x3eb5f4,_0x395384){logger[_0x507a('0x13')](_0x507a('0x27'),this[_0x507a('0xc')]['email'],JSON['stringify'](_0x3eb5f4));var _0x430d8f='';if(_0x3eb5f4){if(_0x3eb5f4[_0x507a('0x3a')]){_0x430d8f=_0x3eb5f4[_0x507a('0x3a')];}else{for(var _0x36b8e7 in _0x3eb5f4){if(_0x3eb5f4['hasOwnProperty'](_0x36b8e7)){_0x430d8f+=_[_0x507a('0x3b')](_0x36b8e7)+':\x20'+_0x3eb5f4[_0x36b8e7]+'\x0a';}}}}if(_0x395384){this[_0x507a('0x2')][_0x507a('0x11')]();}else{this[_0x507a('0x39')](_0x507a('0x13'),_0x430d8f);this['emit'](_0x507a('0x11'));}};module[_0x507a('0x3c')]=EmailImap; \ No newline at end of file +var _0x2a1f=['upperFirst','exports','path','imap','randomstring','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','getHost','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','handleCloseBox','body','handleMessageBody','once','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','handleFetchError','stringify','textCode','hasOwnProperty'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x2a1f,0x12e));var _0xf2a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a1f[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xf2a1('0x0'));var util=require('util');var Imap=require(_0xf2a1('0x1'));var _=require('lodash');var rs=require(_0xf2a1('0x2'));var simpleParser=require('mailparser')[_0xf2a1('0x3')];var Iconv=require(_0xf2a1('0x4'))[_0xf2a1('0x5')];var EventEmitter=require(_0xf2a1('0x6'))[_0xf2a1('0x7')];var utils=require(_0xf2a1('0x8'));var logger=require('../../../config/logger')(_0xf2a1('0x9'));function EmailImap(_0x41b7a0,_0x1d6153){this[_0xf2a1('0xa')]=_0xf2a1('0xb');this[_0xf2a1('0xc')]=this['getAccount'](_0x41b7a0,_0x1d6153);this[_0xf2a1('0x1')]=new Imap(this[_0xf2a1('0xc')]);this[_0xf2a1('0x1')]['once'](_0xf2a1('0xd'),this[_0xf2a1('0xe')][_0xf2a1('0xf')](this));this['imap']['once'](_0xf2a1('0x10'),this[_0xf2a1('0x11')]['bind'](this));this[_0xf2a1('0x1')]['on'](_0xf2a1('0x12'),this[_0xf2a1('0x13')][_0xf2a1('0xf')](this));this['imap'][_0xf2a1('0x14')]();}util[_0xf2a1('0x15')](EmailImap,EventEmitter);EmailImap[_0xf2a1('0x16')][_0xf2a1('0x17')]=function(_0x2fa41c,_0x417254){var _0x63cb51={'connTimeout':_0x2fa41c[_0xf2a1('0x18')]?_0x2fa41c[_0xf2a1('0x18')]*0x3e8:0x2710,'authTimeout':_0x2fa41c[_0xf2a1('0x19')]?_0x2fa41c[_0xf2a1('0x19')]*0x3e8:0x1388};if(_[_0xf2a1('0x1a')](_0x2fa41c['service'])){if(_0x2fa41c[_0xf2a1('0x1b')]){_0x63cb51[_0xf2a1('0x1c')]=_0x2fa41c['user'];_0x63cb51['password']=_0x2fa41c[_0xf2a1('0x1d')];}_0x63cb51[_0xf2a1('0x1e')]=_0x2fa41c['host'];_0x63cb51[_0xf2a1('0x1f')]=_0x2fa41c[_0xf2a1('0x1f')]||0x3e1;if(_0x2fa41c[_0xf2a1('0x20')]){_0x63cb51[_0xf2a1('0x20')]=!![];}else{_0x63cb51[_0xf2a1('0x20')]=![];_0x63cb51['autotls']=_0xf2a1('0x21');}}else{_0x63cb51[_0xf2a1('0x1c')]=_0x2fa41c[_0xf2a1('0x1c')];_0x63cb51[_0xf2a1('0x1d')]=_0x2fa41c[_0xf2a1('0x1d')];_0x63cb51[_0xf2a1('0x1e')]=utils[_0xf2a1('0x22')](_0x2fa41c['service']);_0x63cb51[_0xf2a1('0x1f')]=0x3e1;_0x63cb51[_0xf2a1('0x20')]=!![];}_0x63cb51[_0xf2a1('0x9')]=_0x417254||_0x2fa41c[_0xf2a1('0x1c')]||_0xf2a1('0x23');return _0x63cb51;};EmailImap['prototype'][_0xf2a1('0xe')]=function(){this[_0xf2a1('0x1')]['openBox'](this[_0xf2a1('0xa')],![],this[_0xf2a1('0x24')][_0xf2a1('0xf')](this));};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x24')]=function(_0x1da551,_0x1cb0c7){if(_0x1da551){this['handleError'](_0x1da551,!![]);}else{this[_0xf2a1('0x25')](_0xf2a1('0x26'),_0x1cb0c7);this[_0xf2a1('0x27')]();}};EmailImap[_0xf2a1('0x16')]['handleCloseBox']=function(_0x453e3f){if(_0x453e3f){this[_0xf2a1('0x13')](_0x453e3f,!![]);}else{this[_0xf2a1('0x1')][_0xf2a1('0x10')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xf2a1('0x1')]['search'](['UNSEEN'],this['handleReadUnseen'][_0xf2a1('0xf')](this));};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x28')]=function(_0x4d9c3b,_0x49d7aa){if(_0x4d9c3b){this['handleError'](_0x4d9c3b,!![]);}else{if(_0x49d7aa[_0xf2a1('0x29')]){try{var _0x181bb8=this['imap'][_0xf2a1('0x2a')](_0x49d7aa,{'bodies':'','markSeen':!![]});_0x181bb8['on']('message',this[_0xf2a1('0x2b')]['bind'](this));_0x181bb8['once'](_0xf2a1('0x12'),this['handleFetchError'][_0xf2a1('0xf')](this));_0x181bb8['once'](_0xf2a1('0x10'),this[_0xf2a1('0x2c')][_0xf2a1('0xf')](this));}catch(_0xba7637){logger[_0xf2a1('0x12')](_0xba7637);}}else{this[_0xf2a1('0x1')]['closeBox'](!![],this[_0xf2a1('0x2d')][_0xf2a1('0xf')](this));}}};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x2b')]=function(_0x1f6d46,_0x5b3b8f){_0x1f6d46['on'](_0xf2a1('0x2e'),this[_0xf2a1('0x2f')][_0xf2a1('0xf')](this));_0x1f6d46[_0xf2a1('0x30')](_0xf2a1('0x31'),this[_0xf2a1('0x32')][_0xf2a1('0xf')](this));_0x1f6d46['once'](_0xf2a1('0x10'),this[_0xf2a1('0x33')][_0xf2a1('0xf')](this));};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x2f')]=function(_0x2375f4,_0x4b15ce){simpleParser(_0x2375f4,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x191fa6){};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x33')]=function(){};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x34')]=function(_0x21bec3,_0x3e5357){if(_0x21bec3){logger[_0xf2a1('0x12')](_0x21bec3);}else{var _0x43b419=this;utils['parser'](this[_0xf2a1('0xc')],_0x3e5357,function(_0x4f9552){_0x43b419[_0xf2a1('0x25')](_0xf2a1('0x9'),_0x4f9552);});}};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x2c')]=function(){this['imap'][_0xf2a1('0x35')](!![],this[_0xf2a1('0x2d')][_0xf2a1('0xf')](this));};EmailImap['prototype'][_0xf2a1('0x36')]=function(_0x396695){this[_0xf2a1('0x13')](_0x396695);this[_0xf2a1('0x1')]['closeBox'](!![],this[_0xf2a1('0x2d')]['bind'](this));};EmailImap[_0xf2a1('0x16')]['handleEnd']=function(){this['emit'](_0xf2a1('0x10'));};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x13')]=function(_0x31a181,_0x200adc){logger[_0xf2a1('0x12')](_0xf2a1('0x13'),this[_0xf2a1('0xc')][_0xf2a1('0x9')],JSON[_0xf2a1('0x37')](_0x31a181));var _0x47a3f9='';if(_0x31a181){if(_0x31a181[_0xf2a1('0x38')]){_0x47a3f9=_0x31a181[_0xf2a1('0x38')];}else{for(var _0xf8f13 in _0x31a181){if(_0x31a181[_0xf2a1('0x39')](_0xf8f13)){_0x47a3f9+=_[_0xf2a1('0x3a')](_0xf8f13)+':\x20'+_0x31a181[_0xf8f13]+'\x0a';}}}}if(_0x200adc){this[_0xf2a1('0x1')][_0xf2a1('0x10')]();}else{this[_0xf2a1('0x25')](_0xf2a1('0x12'),_0x47a3f9);this[_0xf2a1('0x25')](_0xf2a1('0x10'));}};module[_0xf2a1('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c18fa3d..9ac1155 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 _0xfc9f=['send','use','compile','sendMail','toString','createTransport','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x537c37,_0x536e74){var _0x241f84=function(_0x3fe709){while(--_0x3fe709){_0x537c37['push'](_0x537c37['shift']());}};_0x241f84(++_0x536e74);}(_0xfc9f,0x11d));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0xffc9('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xffc9('0x1'));function EmailSmtp(){}EmailSmtp[_0xffc9('0x2')][_0xffc9('0x3')]=function(_0x29b17a,_0x2b7aea){return new BPromise(function(_0x4c43c6,_0x5ac73d){var _0x5c26fb=nodemailer['createTransport'](_0x29b17a);_0x5c26fb[_0xffc9('0x4')](_0xffc9('0x5'),inlineBase64());_0x5c26fb[_0xffc9('0x6')](_0x2b7aea,function(_0x5a52c6,_0x33c03e){if(_0x5a52c6){_0x5ac73d(_0x5a52c6[_0xffc9('0x7')]());}else{_0x4c43c6(_0x33c03e);}});});};EmailSmtp[_0xffc9('0x2')]['verify']=function(_0x19cbaa){return new BPromise(function(_0x5e59a2,_0x39642b){var _0x5c14d5=nodemailer[_0xffc9('0x8')](_0x19cbaa);_0x5c14d5[_0xffc9('0x9')](function(_0x2bd814,_0x431a46){if(_0x2bd814){_0x39642b(_0x2bd814[_0xffc9('0x7')]());}else{if(_0x431a46){_0x5e59a2(_0x431a46);}else{_0x39642b(_0xffc9('0xa'));}}});});};module[_0xffc9('0xb')]=EmailSmtp; \ No newline at end of file +var _0x709a=['exports','nodemailer','prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired'];(function(_0x1c0f8d,_0x1adacb){var _0x108dd2=function(_0x14964f){while(--_0x14964f){_0x1c0f8d['push'](_0x1c0f8d['shift']());}};_0x108dd2(++_0x1adacb);}(_0x709a,0x83));var _0xa709=function(_0x4eb447,_0x1b67b5){_0x4eb447=_0x4eb447-0x0;var _0x50542e=_0x709a[_0x4eb447];return _0x50542e;};'use strict';var nodemailer=require(_0xa709('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xa709('0x1')][_0xa709('0x2')]=function(_0x437fe3,_0x310c50){return new BPromise(function(_0x2cd540,_0x1672f9){var _0xa81917=nodemailer[_0xa709('0x3')](_0x437fe3);_0xa81917[_0xa709('0x4')](_0xa709('0x5'),inlineBase64());_0xa81917['sendMail'](_0x310c50,function(_0x5cd5c9,_0x3f7526){if(_0x5cd5c9){_0x1672f9(_0x5cd5c9[_0xa709('0x6')]());}else{_0x2cd540(_0x3f7526);}});});};EmailSmtp[_0xa709('0x1')][_0xa709('0x7')]=function(_0x612f32){return new BPromise(function(_0x5c595e,_0xce705e){var _0xcdc09f=nodemailer['createTransport'](_0x612f32);_0xcdc09f[_0xa709('0x7')](function(_0x1183bc,_0x133cf1){if(_0x1183bc){_0xce705e(_0x1183bc[_0xa709('0x6')]());}else{if(_0x133cf1){_0x5c595e(_0x133cf1);}else{_0xce705e(_0xa709('0x8'));}}});});};module[_0xa709('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 0f16056..f3e881d 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 _0x1867=['content','push','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','isAutoreply','parser','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','Attachments','Data','

Empty\x20message

','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','name','substring','split','length','join','Anonymous','pop','isEmpty','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x5dad55['slice'](0x0,-0x1)[_0x7186('0x10')]('\x20'):_0x1ccbd[_0x7186('0xc')];}return _0x7186('0x11');}function getLastName(_0x33110a){var _0x489e35=_['head'](_0x33110a['value']);if(_0x489e35&&_0x489e35[_0x7186('0xc')]){var _0x1aa34c=_0x489e35[_0x7186('0xc')][_0x7186('0xe')](/\s+/);return _0x1aa34c['length']>0x1?_0x1aa34c[_0x7186('0x12')]():'';}return'';}function getMails(_0x1cc347,_0x915126){var _0x396e13='';for(var _0x6508f5=0x0;_0x6508f5<_0x915126[_0x7186('0x8')][_0x7186('0xf')];_0x6508f5+=0x1){if(_0x915126[_0x7186('0x8')][_0x6508f5]['address']!==_0x1cc347){if(!_[_0x7186('0x13')](_0x396e13)){_0x396e13+=',';}_0x396e13+=_0x915126[_0x7186('0x8')][_0x6508f5]['name']||_0x915126[_0x7186('0x8')][_0x6508f5][_0x7186('0x9')]||'';_0x396e13+='\x20<';_0x396e13+=_0x915126[_0x7186('0x8')][_0x6508f5]['address']?_0x915126['value'][_0x6508f5][_0x7186('0x9')]:'anonymous'+random[_0x7186('0xb')](0x6)+'@xcally.com';_0x396e13+='>';}}return _0x396e13;}function parseEmail(_0x599116,_0x54ca4e,_0x3f932b){if(_0x54ca4e[_0x7186('0x14')]){var _0x48bfaf=/)<[^<]*)*<\/script>/gi;while(_0x48bfaf['test'](_0x54ca4e['html'])){_0x54ca4e['html']=_0x54ca4e[_0x7186('0x14')][_0x7186('0x15')](_0x48bfaf,'');}if(_0x54ca4e[_0x7186('0x14')]['includes'](_0x7186('0x16'))){var _0x182338=[];_0x54ca4e[_0x7186('0x17')][_0x7186('0x18')](_0x1baf5b=>{_0x182338['push'](_0x1baf5b[_0x7186('0x19')]);});var _0x207b9e=/]+>/g;var _0x4782ca=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x142bde=_0x54ca4e[_0x7186('0x14')][_0x7186('0x15')](_0x4782ca,_0x7186('0x1a'));var _0xf2db43=_0x142bde['replace'](_0x207b9e,_0x7186('0x1b'));for(let _0x463f1e=0x0;_0x463f1e<_0x182338['length'];_0x463f1e++){var _0x40356a=_0xf2db43['replace'](_0x7186('0x1b'),_0x7186('0x1c')+_0x182338[_0x463f1e]+_0x7186('0x1d'));_0xf2db43=_0x40356a;}_0x54ca4e[_0x7186('0x14')]=_0xf2db43;}_0x3f932b[_0x7186('0x1e')]=_0x54ca4e['html'];}else{_0x3f932b[_0x7186('0x1e')]=_0x54ca4e[_0x7186('0x1f')];}if(_0x3f932b[_0x7186('0x1e')]){_0x3f932b[_0x7186('0x1e')]=_0x3f932b[_0x7186('0x1e')]['replace'](/0x0){var _0x375dec=[_0x7186('0x2f'),_0x7186('0x30'),_0x7186('0x31')];for(var _0x3c63c1=0x0;_0x3c63c1<_0x54ca4e[_0x7186('0x2e')][_0x7186('0xf')];_0x3c63c1++){var _0x41081e=_[_0x7186('0x32')](_0x375dec,_0x54ca4e[_0x7186('0x2e')][_0x3c63c1]['line']);if(_0x41081e>=0x0){_0x3f932b[_0x7186('0x33')]=!![];}}}return _0x3f932b;}exports[_0x7186('0x34')]=function(_0x496d81,_0x3eae46,_0x11a524){var _0x494ddf={'from':getAddress(_0x3eae46[_0x7186('0x35')]),'firstName':getFirstName(_0x3eae46[_0x7186('0x35')]),'lastName':getLastName(_0x3eae46[_0x7186('0x35')]),'mapKey':_0x7186('0x5'),'message':{'from':getMails(_0x496d81['email'],_0x3eae46[_0x7186('0x35')]),'to':_0x496d81[_0x7186('0x5')],'cc':'','subject':_0x3eae46[_0x7186('0x36')]||'','messageId':_0x3eae46[_0x7186('0x37')],'inReplyTo':_0x3eae46[_0x7186('0x38')],'sentAt':moment(_0x3eae46[_0x7186('0x39')])[_0x7186('0x3a')](_0x7186('0x3b')),'attach':![],'attachments':[]}};if(!_0x3eae46[_0x7186('0x14')]&&!_0x3eae46[_0x7186('0x1f')]){var _0x26bf48=_[_0x7186('0x3c')](_0x3eae46[_0x7186('0x17')],{'contentType':_0x7186('0x3d')});if(_0x26bf48['length']){logger['info'](util[_0x7186('0x3a')](_0x7186('0x3e'),_0x3eae46['messageId']));tnef[_0x7186('0x3f')](_['first'](_0x26bf48)[_0x7186('0x2c')],function(_0x101c58,_0x556aab){if(_0x556aab){_0x3eae46[_0x7186('0x14')]=_0x556aab['BodyHTML']||'

Empty\x20message

';if(_0x556aab[_0x7186('0x40')]){for(var _0x214686=0x0;_0x214686<_0x556aab['Attachments'][_0x7186('0xf')];_0x214686++){var _0x2daf8b=_0x556aab[_0x7186('0x40')][_0x214686];_0x494ddf[_0x7186('0x21')][_0x7186('0x17')][_0x7186('0x2d')]({'filename':_0x2daf8b['Title'],'content':Buffer[_0x7186('0x35')](_0x2daf8b[_0x7186('0x41')])});}}}_0x11a524(parseEmail(_0x496d81,_0x3eae46,_0x494ddf));});}else{_0x3eae46[_0x7186('0x14')]=_0x7186('0x42');_0x11a524(parseEmail(_0x496d81,_0x3eae46,_0x494ddf));}}else{_0x11a524(parseEmail(_0x496d81,_0x3eae46,_0x494ddf));}};exports[_0x7186('0x43')]=function(_0x5ab66a){switch(_0x5ab66a){case _0x7186('0x44'):return _0x7186('0x45');case'yahoo':return _0x7186('0x46');case'hotmail':return _0x7186('0x47');case _0x7186('0x48'):return _0x7186('0x49');}return _0x7186('0x4a');}; \ No newline at end of file +var _0xc029=['hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','slice','join','Anonymous','pop','length','isEmpty','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc029,0x1df));var _0x9c02=function(_0x3d9557,_0x5d09d2){_0x3d9557=_0x3d9557-0x0;var _0x359ff8=_0xc029[_0x3d9557];return _0x359ff8;};'use strict';var _=require(_0x9c02('0x0'));var moment=require(_0x9c02('0x1'));var random=require(_0x9c02('0x2'));var fs=require('fs');var path=require(_0x9c02('0x3'));var util=require(_0x9c02('0x4'));var tnef=require(_0x9c02('0x5'));var logger=require(_0x9c02('0x6'))(_0x9c02('0x7'));var config=require(_0x9c02('0x8'));function getAddress(_0x2a96cd){var _0x283c37=_[_0x9c02('0x9')](_0x2a96cd[_0x9c02('0xa')]);return _0x283c37&&_0x283c37[_0x9c02('0xb')]?_0x283c37[_0x9c02('0xb')]:_0x9c02('0xc')+random[_0x9c02('0xd')](0x6)+_0x9c02('0xe');}function getFirstName(_0x4a8202){var _0x30fc9c=_['head'](_0x4a8202[_0x9c02('0xa')]);if(_0x30fc9c&&_0x30fc9c[_0x9c02('0xf')]){if(_0x30fc9c[_0x9c02('0xf')]==_0x30fc9c[_0x9c02('0xb')]){return _0x30fc9c['name'][_0x9c02('0x10')](0x0,_0x30fc9c['name'][_0x9c02('0x11')]('@'));}var _0x54221d=_0x30fc9c[_0x9c02('0xf')][_0x9c02('0x12')](/\s+/);return _0x54221d['length']>0x1?_0x54221d[_0x9c02('0x13')](0x0,-0x1)[_0x9c02('0x14')]('\x20'):_0x30fc9c['name'];}return _0x9c02('0x15');}function getLastName(_0x2d7d32){var _0x30677e=_['head'](_0x2d7d32['value']);if(_0x30677e&&_0x30677e[_0x9c02('0xf')]){var _0x26735e=_0x30677e[_0x9c02('0xf')][_0x9c02('0x12')](/\s+/);return _0x26735e['length']>0x1?_0x26735e[_0x9c02('0x16')]():'';}return'';}function getMails(_0x38602c,_0xa6f21e){var _0x729f45='';for(var _0x134cab=0x0;_0x134cab<_0xa6f21e['value'][_0x9c02('0x17')];_0x134cab+=0x1){if(_0xa6f21e[_0x9c02('0xa')][_0x134cab][_0x9c02('0xb')]!==_0x38602c){if(!_[_0x9c02('0x18')](_0x729f45)){_0x729f45+=',';}_0x729f45+=_0xa6f21e[_0x9c02('0xa')][_0x134cab][_0x9c02('0xf')]||_0xa6f21e['value'][_0x134cab][_0x9c02('0xb')]||'';_0x729f45+='\x20<';_0x729f45+=_0xa6f21e[_0x9c02('0xa')][_0x134cab][_0x9c02('0xb')]?_0xa6f21e[_0x9c02('0xa')][_0x134cab][_0x9c02('0xb')]:_0x9c02('0xc')+random[_0x9c02('0xd')](0x6)+_0x9c02('0xe');_0x729f45+='>';}}return _0x729f45;}function parseEmail(_0x314275,_0x5a2097,_0x54fdf4){if(_0x5a2097['html']){var _0x2c5a9c=/)<[^<]*)*<\/script>/gi;while(_0x2c5a9c['test'](_0x5a2097[_0x9c02('0x19')])){_0x5a2097[_0x9c02('0x19')]=_0x5a2097[_0x9c02('0x19')][_0x9c02('0x1a')](_0x2c5a9c,'');}if(_0x5a2097[_0x9c02('0x19')][_0x9c02('0x1b')](_0x9c02('0x1c'))){var _0x42f5db=[];_0x5a2097['attachments'][_0x9c02('0x1d')](_0x3e3da7=>{_0x42f5db[_0x9c02('0x1e')](_0x3e3da7['filename']);});var _0x5509a3=/]+>/g;var _0x50938e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5a9976=_0x5a2097[_0x9c02('0x19')][_0x9c02('0x1a')](_0x50938e,_0x9c02('0x1f'));var _0x1b6a72=_0x5a9976[_0x9c02('0x1a')](_0x5509a3,_0x9c02('0x20'));for(let _0x169416=0x0;_0x169416<_0x42f5db[_0x9c02('0x17')];_0x169416++){var _0xf549df=_0x1b6a72[_0x9c02('0x1a')]('_IMG',_0x9c02('0x21')+_0x42f5db[_0x169416]+'\x20]');_0x1b6a72=_0xf549df;}_0x5a2097['html']=_0x1b6a72;}_0x54fdf4[_0x9c02('0x22')]=_0x5a2097['html'];}else{_0x54fdf4[_0x9c02('0x22')]=_0x5a2097[_0x9c02('0x23')];}if(_0x54fdf4[_0x9c02('0x22')]){_0x54fdf4[_0x9c02('0x22')]=_0x54fdf4[_0x9c02('0x22')]['replace'](/0x0){var _0x350e81=[_0x9c02('0x36'),_0x9c02('0x37'),_0x9c02('0x38')];for(var _0x24212e=0x0;_0x24212e<_0x5a2097[_0x9c02('0x35')][_0x9c02('0x17')];_0x24212e++){var _0x2bde7d=_[_0x9c02('0x11')](_0x350e81,_0x5a2097[_0x9c02('0x35')][_0x24212e][_0x9c02('0x39')]);if(_0x2bde7d>=0x0){_0x54fdf4[_0x9c02('0x3a')]=!![];}}}return _0x54fdf4;}exports['parser']=function(_0x4f0d85,_0x10356b,_0xf4cb00){var _0x4d48b3={'from':getAddress(_0x10356b['from']),'firstName':getFirstName(_0x10356b[_0x9c02('0x3b')]),'lastName':getLastName(_0x10356b[_0x9c02('0x3b')]),'mapKey':'email','message':{'from':getMails(_0x4f0d85['email'],_0x10356b[_0x9c02('0x3b')]),'to':_0x4f0d85[_0x9c02('0x7')],'cc':'','subject':_0x10356b['subject']||'','messageId':_0x10356b['messageId'],'inReplyTo':_0x10356b['inReplyTo'],'sentAt':moment(_0x10356b[_0x9c02('0x3c')])[_0x9c02('0x2e')](_0x9c02('0x3d')),'attach':![],'attachments':[]}};if(!_0x10356b['html']&&!_0x10356b[_0x9c02('0x23')]){var _0x29485e=_['filter'](_0x10356b[_0x9c02('0x29')],{'contentType':'application/ms-tnef'});if(_0x29485e[_0x9c02('0x17')]){logger[_0x9c02('0x3e')](util[_0x9c02('0x2e')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x10356b[_0x9c02('0x3f')]));tnef['parseBuffer'](_[_0x9c02('0x40')](_0x29485e)['content'],function(_0x520289,_0x47221f){if(_0x47221f){_0x10356b[_0x9c02('0x19')]=_0x47221f[_0x9c02('0x41')]||_0x9c02('0x42');if(_0x47221f[_0x9c02('0x43')]){for(var _0x4185d7=0x0;_0x4185d7<_0x47221f['Attachments']['length'];_0x4185d7++){var _0x1a99f8=_0x47221f[_0x9c02('0x43')][_0x4185d7];_0x4d48b3['message'][_0x9c02('0x29')]['push']({'filename':_0x1a99f8[_0x9c02('0x44')],'content':Buffer[_0x9c02('0x3b')](_0x1a99f8['Data'])});}}}_0xf4cb00(parseEmail(_0x4f0d85,_0x10356b,_0x4d48b3));});}else{_0x10356b[_0x9c02('0x19')]='

Empty\x20message

';_0xf4cb00(parseEmail(_0x4f0d85,_0x10356b,_0x4d48b3));}}else{_0xf4cb00(parseEmail(_0x4f0d85,_0x10356b,_0x4d48b3));}};exports[_0x9c02('0x45')]=function(_0x5cc626){switch(_0x5cc626){case _0x9c02('0x46'):return _0x9c02('0x47');case _0x9c02('0x48'):return _0x9c02('0x49');case _0x9c02('0x4a'):return _0x9c02('0x4b');case _0x9c02('0x4c'):return _0x9c02('0x4d');}return _0x9c02('0x4e');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index eadfc2e..d9acb3d 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 _0x3b13=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x530309,_0x14376a){var _0x4a657c=function(_0x1c543b){while(--_0x1c543b){_0x530309['push'](_0x530309['shift']());}};_0x4a657c(++_0x14376a);}(_0x3b13,0x158));var _0x33b1=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x3b13[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0x33b1('0x0'));function MailAccount(_0x4a13d6){this['id']=_0x4a13d6['id']||0x0;this[_0x33b1('0x1')]=_0x4a13d6[_0x33b1('0x1')]||_0x33b1('0x2');this[_0x33b1('0x3')]=_0x4a13d6[_0x33b1('0x3')]||_0x33b1('0x4');this[_0x33b1('0x5')]=_0x4a13d6['active']||![];this[_0x33b1('0x6')]=_0x4a13d6['Imap']||[];this[_0x33b1('0x7')]=_0x4a13d6[_0x33b1('0x7')]||[];}module[_0x33b1('0x8')]=MailAccount; \ No newline at end of file +var _0x2629=['Smtp','exports','lodash','Service','key','active','Imap'];(function(_0x366ae5,_0x2aebf3){var _0x546e69=function(_0x407684){while(--_0x407684){_0x366ae5['push'](_0x366ae5['shift']());}};_0x546e69(++_0x2aebf3);}(_0x2629,0xc6));var _0x9262=function(_0x2af47e,_0x1d2a86){_0x2af47e=_0x2af47e-0x0;var _0x5bca26=_0x2629[_0x2af47e];return _0x5bca26;};'use strict';var _=require(_0x9262('0x0'));function MailAccount(_0x2a95f5){this['id']=_0x2a95f5['id']||0x0;this['name']=_0x2a95f5['name']||_0x9262('0x1');this[_0x9262('0x2')]=_0x2a95f5['key']||'SERV';this[_0x9262('0x3')]=_0x2a95f5[_0x9262('0x3')]||![];this['Imap']=_0x2a95f5[_0x9262('0x4')]||[];this[_0x9262('0x5')]=_0x2a95f5[_0x9262('0x5')]||[];}module[_0x9262('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index b1f1ac2..3259df5 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 _0xe48a=['length','isUndefined','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0xe48a,0xf5));var _0xae48=function(_0x49dd98,_0x8dc77f){_0x49dd98=_0x49dd98-0x0;var _0x590ce3=_0xe48a[_0x49dd98];return _0x590ce3;};'use strict';var _=require(_0xae48('0x0'));var MailAccount=require(_0xae48('0x1'));var Realtime=function(){this[_0xae48('0x2')]={};};function freeIsNotKey(_0x3f5cd8,_0x2516bf,_0x3fe6fa){var _0x25a591=_[_0xae48('0x3')](_0x3f5cd8,function(_0x321839,_0x457bbd){return _0x321839[_0x3fe6fa];});for(var _0x599a35 in _0x2516bf){if(_0x2516bf[_0xae48('0x4')](_0x599a35)){if(!_0x25a591[_0x599a35]){delete _0x2516bf[_0x599a35];}}}}Realtime[_0xae48('0x5')][_0xae48('0x6')]=function(_0x20e7c6,_0x3d2502){for(var _0x18bb71 in _0x3d2502){if(_0x20e7c6['hasOwnProperty'](_0x18bb71)){_0x20e7c6[_0x18bb71]=_0x3d2502[_0x18bb71];}}};Realtime[_0xae48('0x5')]['initMailAccounts']=function(){var _0x455523=this;return function(_0x2aec60){if(_0x2aec60){freeIsNotKey(_0x2aec60,_0x455523['mailAccounts'],'id');for(var _0x3a5aec=0x0,_0x47b500={},_0x258817={};_0x3a5aec<_0x2aec60[_0xae48('0x7')];_0x3a5aec+=0x1){_0x47b500=_0x2aec60[_0x3a5aec];if(_[_0xae48('0x8')](_0x455523[_0xae48('0x2')][_0x47b500['id']])){_0x455523['mailAccounts'][_0x47b500['id']]=new MailAccount(_0x47b500);}else{_['merge'](_0x455523[_0xae48('0x2')][_0x47b500['id']],_0x47b500);}}}return _0x455523[_0xae48('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x7b36=['exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length','isUndefined','merge'];(function(_0x330a51,_0x42c33b){var _0x55aa63=function(_0x5ddc09){while(--_0x5ddc09){_0x330a51['push'](_0x330a51['shift']());}};_0x55aa63(++_0x42c33b);}(_0x7b36,0x161));var _0x67b3=function(_0x415c0e,_0xde4a07){_0x415c0e=_0x415c0e-0x0;var _0x4fa26c=_0x7b36[_0x415c0e];return _0x4fa26c;};'use strict';var _=require(_0x67b3('0x0'));var MailAccount=require(_0x67b3('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2155b8,_0x5353d3,_0x4b6d5c){var _0x5981b9=_[_0x67b3('0x2')](_0x2155b8,function(_0x55af13,_0x4ffc9f){return _0x55af13[_0x4b6d5c];});for(var _0x467c0b in _0x5353d3){if(_0x5353d3[_0x67b3('0x3')](_0x467c0b)){if(!_0x5981b9[_0x467c0b]){delete _0x5353d3[_0x467c0b];}}}}Realtime[_0x67b3('0x4')][_0x67b3('0x5')]=function(_0x4a2c55,_0x31e2cf){for(var _0x153a1b in _0x31e2cf){if(_0x4a2c55['hasOwnProperty'](_0x153a1b)){_0x4a2c55[_0x153a1b]=_0x31e2cf[_0x153a1b];}}};Realtime[_0x67b3('0x4')]['initMailAccounts']=function(){var _0x4eec0c=this;return function(_0x2e7a99){if(_0x2e7a99){freeIsNotKey(_0x2e7a99,_0x4eec0c[_0x67b3('0x6')],'id');for(var _0xa6d067=0x0,_0x4f6bd6={},_0x5e948c={};_0xa6d067<_0x2e7a99[_0x67b3('0x7')];_0xa6d067+=0x1){_0x4f6bd6=_0x2e7a99[_0xa6d067];if(_[_0x67b3('0x8')](_0x4eec0c[_0x67b3('0x6')][_0x4f6bd6['id']])){_0x4eec0c[_0x67b3('0x6')][_0x4f6bd6['id']]=new MailAccount(_0x4f6bd6);}else{_[_0x67b3('0x9')](_0x4eec0c['mailAccounts'][_0x4f6bd6['id']],_0x4f6bd6);}}}return _0x4eec0c['mailAccounts'];};};module[_0x67b3('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 1a90797..04e1e21 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 _0x908d=['service','email','active','key','ListId','MailServerIn','Imap','MailServerOut','getMailAccount','NotifyMailAccount','../client','Request','GetMailAccount'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x908d,0x176));var _0xd908=function(_0x56d551,_0x18845c){_0x56d551=_0x56d551-0x0;var _0x220843=_0x908d[_0x56d551];return _0x220843;};'use strict';var client=require(_0xd908('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xd908('0x1')](_0xd908('0x2'),{'options':{'attributes':['id','name',_0xd908('0x3'),_0xd908('0x4'),_0xd908('0x5'),_0xd908('0x6'),_0xd908('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xd908('0x8'),'as':_0xd908('0x9')},{'model':_0xd908('0xa'),'as':'Smtp'}]},'log':_0xd908('0xb')});};};exports['notify']=function(_0x362fb3,_0x2f82dc){return client[_0xd908('0x1')](_0xd908('0xc'),{'account':{'id':_0x362fb3},'body':_0x2f82dc,'log':_0xd908('0xc')});}; \ No newline at end of file +var _0x4351=['service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x4351,0x1b5));var _0x1435=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x4351[_0x2b5eae];return _0x5f3ac9;};'use strict';var client=require(_0x1435('0x0'));exports[_0x1435('0x1')]=function(){return function(){return client[_0x1435('0x2')](_0x1435('0x3'),{'options':{'attributes':['id',_0x1435('0x4'),_0x1435('0x5'),_0x1435('0x6'),_0x1435('0x7'),_0x1435('0x8'),_0x1435('0x9'),_0x1435('0xa')],'raw':![],'include':[{'model':_0x1435('0xb'),'as':_0x1435('0xc')},{'model':_0x1435('0xd'),'as':_0x1435('0xe')}]},'log':'getMailAccount'});};};exports[_0x1435('0xf')]=function(_0x5de4b0,_0x4d04c7){return client[_0x1435('0x2')](_0x1435('0x10'),{'account':{'id':_0x5de4b0},'body':_0x4d04c7,'log':_0x1435('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 8fa22de..93ac731 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 _0x5e95=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x3f7f98,_0x4a83c8){var _0xaa12b9=function(_0x2d5d43){while(--_0x2d5d43){_0x3f7f98['push'](_0x3f7f98['shift']());}};_0xaa12b9(++_0x4a83c8);}(_0x5e95,0xe9));var _0x55e9=function(_0x209417,_0x229b93){_0x209417=_0x209417-0x0;var _0x5acf23=_0x5e95[_0x209417];return _0x5acf23;};'use strict';var client=require(_0x55e9('0x0'));exports[_0x55e9('0x1')]=function(){return client['Request'](_0x55e9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x55e9('0x3')]},'log':_0x55e9('0x4')});}; \ No newline at end of file +var _0xf66a=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf66a,0xa8));var _0xaf66=function(_0x95f412,_0x32bac6){_0x95f412=_0x95f412-0x0;var _0x4d1548=_0xf66a[_0x95f412];return _0x4d1548;};'use strict';var client=require(_0xaf66('0x0'));exports[_0xaf66('0x1')]=function(){return client['Request'](_0xaf66('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xaf66('0x3')]},'log':_0xaf66('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index b3539cd..a5af290 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 399e613..4360827 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 _0x252e=['ioredis','../../config/environment','timeout','listen','port','websocket','polling','redis','defaults','localhost','adapter','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0x252e,0x15a));var _0xe252=function(_0x21971f,_0x2ded6e){_0x21971f=_0x21971f-0x0;var _0x35b83e=_0x252e[_0x21971f];return _0x35b83e;};'use strict';var _=require(_0xe252('0x0'));var http=require(_0xe252('0x1'));var express=require(_0xe252('0x2'));var sticky=require(_0xe252('0x3'));var Redis=require(_0xe252('0x4'));var config=require(_0xe252('0x5'));var app=express();var server=http['createServer'](app);server[_0xe252('0x6')]=0xdbba0;if(sticky[_0xe252('0x7')](server,config[_0xe252('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xe252('0x9'),_0xe252('0xa')]});config[_0xe252('0xb')]=_[_0xe252('0xc')](config[_0xe252('0xb')],{'host':_0xe252('0xd'),'port':0x18eb});socketio[_0xe252('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0xe252('0xb')]),'subClient':new Redis(config[_0xe252('0xb')])}));require(_0xe252('0xf'))['default']();require(_0xe252('0x10'))[_0xe252('0x11')](socketio);require(_0xe252('0x12'))[_0xe252('0x11')](app);require(_0xe252('0x13'))[_0xe252('0x11')](app);}else{server[_0xe252('0x14')](_0xe252('0x15'),function(){console[_0xe252('0x16')](_0xe252('0x17'),config['port']);});}exports=module[_0xe252('0x18')]=app; \ No newline at end of file +var _0xd98f=['sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http'];(function(_0x446af2,_0x428c0f){var _0x3e291a=function(_0x2f1aaa){while(--_0x2f1aaa){_0x446af2['push'](_0x446af2['shift']());}};_0x3e291a(++_0x428c0f);}(_0xd98f,0x15c));var _0xfd98=function(_0x93d013,_0x5df091){_0x93d013=_0x93d013-0x0;var _0x3f5189=_0xd98f[_0x93d013];return _0x3f5189;};'use strict';var _=require(_0xfd98('0x0'));var http=require(_0xfd98('0x1'));var express=require('express');var sticky=require(_0xfd98('0x2'));var Redis=require(_0xfd98('0x3'));var config=require(_0xfd98('0x4'));var app=express();var server=http[_0xfd98('0x5')](app);server[_0xfd98('0x6')]=0xdbba0;if(sticky[_0xfd98('0x7')](server,config[_0xfd98('0x8')])){var socketio=require(_0xfd98('0x9'))(server,{'transports':[_0xfd98('0xa'),'polling']});config[_0xfd98('0xb')]=_[_0xfd98('0xc')](config[_0xfd98('0xb')],{'host':_0xfd98('0xd'),'port':0x18eb});socketio[_0xfd98('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0xfd98('0xb')]),'subClient':new Redis(config['redis'])}));require(_0xfd98('0xf'))[_0xfd98('0x10')]();require(_0xfd98('0x11'))['default'](socketio);require(_0xfd98('0x12'))[_0xfd98('0x10')](app);require(_0xfd98('0x13'))[_0xfd98('0x10')](app);}else{server[_0xfd98('0x14')](_0xfd98('0x15'),function(){console[_0xfd98('0x16')](_0xfd98('0x17'),config['port']);});}exports=module[_0xfd98('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index a35d60b..63258c9 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 _0x49af=['jayson/promise','bluebird','client','http','Request','request','then','debug','rpc','error','message','result','catch','routing','exports'];(function(_0x41e588,_0x1af274){var _0x269ca5=function(_0x10c381){while(--_0x10c381){_0x41e588['push'](_0x41e588['shift']());}};_0x269ca5(++_0x1af274);}(_0x49af,0x14a));var _0xf49a=function(_0x429ab6,_0x55eaf1){_0x429ab6=_0x429ab6-0x0;var _0x56a2a3=_0x49af[_0x429ab6];return _0x56a2a3;};'use strict';var jayson=require(_0xf49a('0x0'));var BPromise=require(_0xf49a('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xf49a('0x2')][_0xf49a('0x3')]({'port':0x2329});client[_0xf49a('0x4')]=function(_0x3fe339,_0x13c085){return new BPromise(function(_0x3f9cd7,_0xc18291){return client[_0xf49a('0x5')](_0x3fe339,_0x13c085)[_0xf49a('0x6')](function(_0x990985){logger[_0xf49a('0x7')](_0xf49a('0x8'),'routing',_0x3fe339,_0x13c085,_0x990985);if(_0x990985[_0xf49a('0x9')]){logger[_0xf49a('0x9')](_0xf49a('0x8'),'routing',_0x3fe339,_0x990985['error'][_0xf49a('0xa')],_0x13c085);return _0xc18291(_0x990985[_0xf49a('0x9')]['message']);}else{return _0x3f9cd7(_0x990985[_0xf49a('0xb')]);}})[_0xf49a('0xc')](function(_0x5cf9e2){logger[_0xf49a('0x9')](_0xf49a('0x8'),_0xf49a('0xd'),_0x3fe339,_0x5cf9e2,_0x13c085);return _0xc18291(_0x5cf9e2);});});};module[_0xf49a('0xe')]=client; \ No newline at end of file +var _0x04be=['request','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http'];(function(_0x5bfea3,_0x4e7db7){var _0x36dc95=function(_0x15bb34){while(--_0x15bb34){_0x5bfea3['push'](_0x5bfea3['shift']());}};_0x36dc95(++_0x4e7db7);}(_0x04be,0x187));var _0xe04b=function(_0x34d54c,_0x455dac){_0x34d54c=_0x34d54c-0x0;var _0xae18da=_0x04be[_0x34d54c];return _0xae18da;};'use strict';var jayson=require(_0xe04b('0x0'));var BPromise=require(_0xe04b('0x1'));var logger=require(_0xe04b('0x2'))(_0xe04b('0x3'));var client=jayson['client'][_0xe04b('0x4')]({'port':0x2329});client['Request']=function(_0x5b694e,_0x166c4a){return new BPromise(function(_0x57d9b5,_0x10499a){return client[_0xe04b('0x5')](_0x5b694e,_0x166c4a)['then'](function(_0x2c08bc){logger['debug'](_0xe04b('0x6'),'routing',_0x5b694e,_0x166c4a,_0x2c08bc);if(_0x2c08bc[_0xe04b('0x7')]){logger[_0xe04b('0x7')]('rpc',_0xe04b('0x3'),_0x5b694e,_0x2c08bc[_0xe04b('0x7')]['message'],_0x166c4a);return _0x10499a(_0x2c08bc['error'][_0xe04b('0x8')]);}else{return _0x57d9b5(_0x2c08bc[_0xe04b('0x9')]);}})[_0xe04b('0xa')](function(_0x41de32){logger[_0xe04b('0x7')](_0xe04b('0x6'),'routing',_0x5b694e,_0x41de32,_0x166c4a);return _0x10499a(_0x41de32);});});};module[_0xe04b('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ddba0a8..d2791ab 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 _0x0e89=['initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0x0e89,0x100));var _0x90e8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0e89[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x90e8('0x0'));var server=require(_0x90e8('0x1'));var Realtime=require(_0x90e8('0x2'));var user=require(_0x90e8('0x3'));var interval=require(_0x90e8('0x4'));var openchannelQueue=require(_0x90e8('0x5'));var chatQueue=require(_0x90e8('0x6'));var smsQueue=require(_0x90e8('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x90e8('0x8'));var whatsappQueue=require(_0x90e8('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x90e8('0xa')](user[_0x90e8('0xb')]())[_0x90e8('0xa')](realtime[_0x90e8('0xc')]())[_0x90e8('0xa')](interval['getIntervals']())[_0x90e8('0xa')](realtime[_0x90e8('0xd')]())[_0x90e8('0xa')](openchannelQueue[_0x90e8('0xe')]())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x90e8('0xf')]())[_0x90e8('0xa')](realtime[_0x90e8('0x10')]())['then'](smsQueue[_0x90e8('0x11')]())[_0x90e8('0xa')](realtime[_0x90e8('0x12')]())['then'](mailQueue['getMailQueues']())[_0x90e8('0xa')](realtime[_0x90e8('0x13')]())['then'](faxQueue[_0x90e8('0x14')]())[_0x90e8('0xa')](realtime[_0x90e8('0x15')]())[_0x90e8('0xa')](whatsappQueue[_0x90e8('0x16')]())[_0x90e8('0xa')](realtime[_0x90e8('0x17')]())[_0x90e8('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x90e8('0xa')](function(_0x479af9){return initRealtime();})[_0x90e8('0xa')](function(_0x214ee8){return setInterval(initRealtime,0x1388);})['catch'](function(_0x5aa135){console[_0x90e8('0x18')](_0x5aa135);});}main(); \ No newline at end of file +var _0x5f08=['./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue'];(function(_0x4f41c4,_0x30b3bf){var _0x5966d9=function(_0x21c4bc){while(--_0x21c4bc){_0x4f41c4['push'](_0x4f41c4['shift']());}};_0x5966d9(++_0x30b3bf);}(_0x5f08,0x132));var _0x85f0=function(_0x105ffc,_0x4fc8cd){_0x105ffc=_0x105ffc-0x0;var _0xc3905f=_0x5f08[_0x105ffc];return _0xc3905f;};'use strict';var BPromise=require(_0x85f0('0x0'));var server=require(_0x85f0('0x1'));var Realtime=require(_0x85f0('0x2'));var user=require(_0x85f0('0x3'));var interval=require(_0x85f0('0x4'));var openchannelQueue=require(_0x85f0('0x5'));var chatQueue=require(_0x85f0('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x85f0('0x7'));var whatsappQueue=require(_0x85f0('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x85f0('0x9')]()[_0x85f0('0xa')](user['getAgents']())[_0x85f0('0xa')](realtime['initAgents']())[_0x85f0('0xa')](interval[_0x85f0('0xb')]())[_0x85f0('0xa')](realtime[_0x85f0('0xc')]())[_0x85f0('0xa')](openchannelQueue[_0x85f0('0xd')]())['then'](realtime['initOpenchannelQueues']())[_0x85f0('0xa')](chatQueue[_0x85f0('0xe')]())[_0x85f0('0xa')](realtime[_0x85f0('0xf')]())['then'](smsQueue[_0x85f0('0x10')]())[_0x85f0('0xa')](realtime[_0x85f0('0x11')]())[_0x85f0('0xa')](mailQueue[_0x85f0('0x12')]())['then'](realtime[_0x85f0('0x13')]())['then'](faxQueue[_0x85f0('0x14')]())[_0x85f0('0xa')](realtime[_0x85f0('0x15')]())[_0x85f0('0xa')](whatsappQueue[_0x85f0('0x16')]())[_0x85f0('0xa')](realtime[_0x85f0('0x17')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x85f0('0xa')](function(_0x1cda49){return initRealtime();})[_0x85f0('0xa')](function(_0x4ce208){return setInterval(initRealtime,0x1388);})[_0x85f0('0x18')](function(_0x4c0618){console[_0x85f0('0x19')](_0x4c0618);});}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 86f06bc..f039274 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x275f4a,_0x2077d4){var _0x4b4a21=function(_0x391bab){while(--_0x391bab){_0x275f4a['push'](_0x275f4a['shift']());}};_0x4b4a21(++_0x2077d4);}(_0x326f,0xd1));var _0xf326=function(_0x16859e,_0x4c61d0){_0x16859e=_0x16859e-0x0;var _0x49021f=_0x326f[_0x16859e];return _0x49021f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x30b4e7,_0x648241){var _0xcf90cd=function(_0x3fbca0){while(--_0x3fbca0){_0x30b4e7['push'](_0x30b4e7['shift']());}};_0xcf90cd(++_0x648241);}(_0x7a54,0x106));var _0x47a5=function(_0x593ff1,_0x20c716){_0x593ff1=_0x593ff1-0x0;var _0xf74e0c=_0x7a54[_0x593ff1];return _0xf74e0c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 0bd9925..c2892bc 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 _0x3b21=['jayson/promise','then','error','catch','SendMail'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x3b21,0x73));var _0x13b2=function(_0x2e578e,_0x2f7d47){_0x2e578e=_0x2e578e-0x0;var _0x351206=_0x3b21[_0x2e578e];return _0x351206;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x13b2('0x0'));var client=jayson['client']['http']({'port':0x232b});function request(_0x10b6a5,_0x5ec4c5){return new BPromise(function(_0x31e6ed,_0x770ae0){return client['request'](_0x10b6a5,_0x5ec4c5)[_0x13b2('0x1')](function(_0x27a6dd){if(_0x27a6dd[_0x13b2('0x2')]){return _0x770ae0(_0x27a6dd[_0x13b2('0x2')]['message']);}else{return _0x31e6ed(_0x27a6dd['result']);}})[_0x13b2('0x3')](function(_0x23e190){return _0x770ae0(_0x23e190);});});}exports['sendMailMessage']=function(_0x33071e,_0x3d0c00){return request(_0x13b2('0x4'),{'account':_0x33071e,'message':_0x3d0c00});}; \ No newline at end of file +var _0x9a22=['sendMailMessage','jayson/promise','client','http','then','error','message','result','catch'];(function(_0x53749d,_0x2feb71){var _0x55819b=function(_0x58fdcb){while(--_0x58fdcb){_0x53749d['push'](_0x53749d['shift']());}};_0x55819b(++_0x2feb71);}(_0x9a22,0x1ba));var _0x29a2=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x9a22[_0x513aa5];return _0x1a1a7c;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x29a2('0x0'));var client=jayson[_0x29a2('0x1')][_0x29a2('0x2')]({'port':0x232b});function request(_0x291274,_0xd413b4){return new BPromise(function(_0x2b408b,_0x45e29b){return client['request'](_0x291274,_0xd413b4)[_0x29a2('0x3')](function(_0xd0e6b0){if(_0xd0e6b0[_0x29a2('0x4')]){return _0x45e29b(_0xd0e6b0[_0x29a2('0x4')][_0x29a2('0x5')]);}else{return _0x2b408b(_0xd0e6b0[_0x29a2('0x6')]);}})[_0x29a2('0x7')](function(_0xc32895){return _0x45e29b(_0xc32895);});});}exports[_0x29a2('0x8')]=function(_0x4b0dfc,_0x355cd1){return request('SendMail',{'account':_0x4b0dfc,'message':_0x355cd1});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3fb88bf..4dbf452 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 _0x8d33=['idle','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','mailStatus','faxCurrentCapacity','smsStatus','emit','user:save','lodash','moment','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working'];(function(_0x23f58d,_0x22b11c){var _0x515d10=function(_0x18fe4a){while(--_0x18fe4a){_0x23f58d['push'](_0x23f58d['shift']());}};_0x515d10(++_0x22b11c);}(_0x8d33,0x144));var _0x38d3=function(_0x1b37ce,_0x5c38fe){_0x1b37ce=_0x1b37ce-0x0;var _0x2b2123=_0x8d33[_0x1b37ce];return _0x2b2123;};'use strict';var _=require(_0x38d3('0x0'));var moment=require(_0x38d3('0x1'));var md5=require('md5');var Redis=require(_0x38d3('0x2'));var config=require(_0x38d3('0x3'));config[_0x38d3('0x4')]=_['defaults'](config[_0x38d3('0x4')],{'host':_0x38d3('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x38d3('0x4')]));function Agent(_0x2c4538){this['id']=_0x2c4538['id']||0x0;this[_0x38d3('0x6')]=_0x2c4538[_0x38d3('0x6')]||'';this[_0x38d3('0x7')]=_0x2c4538[_0x38d3('0x7')]||!![];this[_0x38d3('0x8')]=_0x2c4538[_0x38d3('0x8')]||![];this['chatPause']=_0x2c4538[_0x38d3('0x9')]||![];this[_0x38d3('0xa')]=_0x2c4538[_0x38d3('0xa')]||![];this['faxPause']=_0x2c4538[_0x38d3('0xb')]||![];this[_0x38d3('0xc')]=_0x2c4538['smsPause']||![];this[_0x38d3('0xd')]=_0x2c4538[_0x38d3('0xd')]||![];this['chatStatus']=_0x38d3('0xe');this['chatStatusTime']=0x0;this['chatCapacity']=_0x2c4538[_0x38d3('0xf')]||0x0;this[_0x38d3('0x10')]=0x0;this['mailStatus']=_0x38d3('0xe');this[_0x38d3('0x11')]=0x0;this['mailCapacity']=_0x2c4538['mailCapacity']||0x0;this[_0x38d3('0x12')]=0x0;this[_0x38d3('0x13')]=_0x38d3('0xe');this[_0x38d3('0x14')]=0x0;this[_0x38d3('0x15')]=_0x2c4538['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x38d3('0xe');this[_0x38d3('0x16')]=0x0;this[_0x38d3('0x17')]=_0x2c4538[_0x38d3('0x17')]||0x0;this[_0x38d3('0x18')]=0x0;this[_0x38d3('0x19')]='unknown';this[_0x38d3('0x1a')]=0x0;this[_0x38d3('0x1b')]=_0x2c4538['whatsappCapacity']||0x0;this[_0x38d3('0x1c')]=0x0;this[_0x38d3('0x1d')]='unknown';this[_0x38d3('0x1e')]=0x0;this[_0x38d3('0x1f')]=_0x2c4538[_0x38d3('0x1f')]||0x0;this[_0x38d3('0x20')]=0x0;this[_0x38d3('0x21')]=![];this[_0x38d3('0x22')]=undefined;this[_0x38d3('0x23')]='';this['updateRealtime']();}Agent[_0x38d3('0x24')][_0x38d3('0x25')]=function(_0x1cab3c){if(this[_0x1cab3c+'CurrentCapacity']>0x0){if(this[_0x1cab3c+_0x38d3('0x26')]>0x0&&this[_0x1cab3c+_0x38d3('0x27')]>=this[_0x1cab3c+_0x38d3('0x26')]){return _0x38d3('0x28');}else{return _0x38d3('0x29');}}else{return _0x38d3('0x2a');}};Agent[_0x38d3('0x24')][_0x38d3('0x2b')]=function(){var _0x2709e5=[_0x38d3('0x2c'),_0x38d3('0x2d'),_0x38d3('0x2e'),_0x38d3('0x2f'),_0x38d3('0x30'),_0x38d3('0x31')];for(var _0x3d756f=0x0;_0x3d756f<_0x2709e5[_0x38d3('0x32')];_0x3d756f+=0x1){var _0x2b06cd=this[_0x38d3('0x25')](_0x2709e5[_0x3d756f]);if(this[_0x2709e5[_0x3d756f]+_0x38d3('0x33')]!==_0x2b06cd){this[_0x2709e5[_0x3d756f]+_0x38d3('0x34')]=_[_0x38d3('0x35')](moment()[_0x38d3('0x36')]('x'));}this[_0x2709e5[_0x3d756f]+'Status']=_0x2b06cd;}var _0x5cfe5f={'id':this['id'],'name':this[_0x38d3('0x6')],'online':this[_0x38d3('0x7')],'voicePause':this[_0x38d3('0x8')],'chatPause':this[_0x38d3('0x9')],'mailPause':this[_0x38d3('0xa')],'smsPause':this[_0x38d3('0xc')],'faxPause':this[_0x38d3('0xb')],'openchannelPause':this[_0x38d3('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x38d3('0x37')],'chatCapacity':this[_0x38d3('0xf')],'chatCurrentCapacity':this[_0x38d3('0x10')],'mailStatus':this[_0x38d3('0x38')],'mailStatusTime':this[_0x38d3('0x11')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x38d3('0x15')],'faxCurrentCapacity':this[_0x38d3('0x39')],'smsStatus':this[_0x38d3('0x3a')],'smsStatusTime':this[_0x38d3('0x16')],'smsCapacity':this[_0x38d3('0x17')],'smsCurrentCapacity':this[_0x38d3('0x18')],'whatsappStatus':this[_0x38d3('0x19')],'whatsappStatusTime':this[_0x38d3('0x1a')],'whatsappCapacity':this[_0x38d3('0x1b')],'whatsappCurrentCapacity':this[_0x38d3('0x1c')],'openchannelStatus':this[_0x38d3('0x1d')],'openchannelStatusTime':this[_0x38d3('0x1e')],'openchannelCapacity':this[_0x38d3('0x1f')],'openchannelCurrentCapacity':this[_0x38d3('0x20')],'busy':this[_0x38d3('0x21')],'busyQueue':this[_0x38d3('0x22')]};var _0x693061=md5(JSON['stringify'](_0x5cfe5f));if(this[_0x38d3('0x23')]!==_0x693061){this['md5']=_0x693061;io[_0x38d3('0x3b')](_0x38d3('0x3c'),_0x5cfe5f);}};module['exports']=Agent; \ No newline at end of file +var _0x996f=['openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','faxStatus','smsCurrentCapacity','busyQueue','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity'];(function(_0x5b4d32,_0x33f188){var _0x8d3ff5=function(_0x146154){while(--_0x146154){_0x5b4d32['push'](_0x5b4d32['shift']());}};_0x8d3ff5(++_0x33f188);}(_0x996f,0x97));var _0xf996=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x996f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf996('0x0'));var moment=require(_0xf996('0x1'));var md5=require(_0xf996('0x2'));var Redis=require('ioredis');var config=require(_0xf996('0x3'));config[_0xf996('0x4')]=_[_0xf996('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf996('0x6'))(new Redis(config['redis']));function Agent(_0x3f1ab3){this['id']=_0x3f1ab3['id']||0x0;this[_0xf996('0x7')]=_0x3f1ab3[_0xf996('0x7')]||'';this['online']=_0x3f1ab3[_0xf996('0x8')]||!![];this['voicePause']=_0x3f1ab3[_0xf996('0x9')]||![];this[_0xf996('0xa')]=_0x3f1ab3[_0xf996('0xa')]||![];this[_0xf996('0xb')]=_0x3f1ab3[_0xf996('0xb')]||![];this[_0xf996('0xc')]=_0x3f1ab3[_0xf996('0xc')]||![];this[_0xf996('0xd')]=_0x3f1ab3[_0xf996('0xd')]||![];this[_0xf996('0xe')]=_0x3f1ab3[_0xf996('0xe')]||![];this[_0xf996('0xf')]=_0xf996('0x10');this[_0xf996('0x11')]=0x0;this[_0xf996('0x12')]=_0x3f1ab3[_0xf996('0x12')]||0x0;this[_0xf996('0x13')]=0x0;this[_0xf996('0x14')]='unknown';this[_0xf996('0x15')]=0x0;this[_0xf996('0x16')]=_0x3f1ab3[_0xf996('0x16')]||0x0;this[_0xf996('0x17')]=0x0;this['faxStatus']=_0xf996('0x10');this[_0xf996('0x18')]=0x0;this[_0xf996('0x19')]=_0x3f1ab3[_0xf996('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xf996('0x1a')]=_0xf996('0x10');this[_0xf996('0x1b')]=0x0;this['smsCapacity']=_0x3f1ab3['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0xf996('0x1c')]=_0xf996('0x10');this[_0xf996('0x1d')]=0x0;this[_0xf996('0x1e')]=_0x3f1ab3[_0xf996('0x1e')]||0x0;this[_0xf996('0x1f')]=0x0;this[_0xf996('0x20')]=_0xf996('0x10');this[_0xf996('0x21')]=0x0;this[_0xf996('0x22')]=_0x3f1ab3[_0xf996('0x22')]||0x0;this[_0xf996('0x23')]=0x0;this[_0xf996('0x24')]=![];this['busyQueue']=undefined;this[_0xf996('0x2')]='';this[_0xf996('0x25')]();}Agent[_0xf996('0x26')][_0xf996('0x27')]=function(_0x15f05b){if(this[_0x15f05b+_0xf996('0x28')]>0x0){if(this[_0x15f05b+_0xf996('0x29')]>0x0&&this[_0x15f05b+_0xf996('0x28')]>=this[_0x15f05b+_0xf996('0x29')]){return _0xf996('0x2a');}else{return _0xf996('0x2b');}}else{return _0xf996('0x2c');}};Agent[_0xf996('0x26')]['updateRealtime']=function(){var _0x49a763=[_0xf996('0x2d'),_0xf996('0x2e'),_0xf996('0x2f'),_0xf996('0x30'),_0xf996('0x31'),_0xf996('0x32')];for(var _0x18ab1f=0x0;_0x18ab1f<_0x49a763[_0xf996('0x33')];_0x18ab1f+=0x1){var _0x45d5eb=this[_0xf996('0x27')](_0x49a763[_0x18ab1f]);if(this[_0x49a763[_0x18ab1f]+_0xf996('0x34')]!==_0x45d5eb){this[_0x49a763[_0x18ab1f]+'StatusTime']=_[_0xf996('0x35')](moment()[_0xf996('0x36')]('x'));}this[_0x49a763[_0x18ab1f]+_0xf996('0x34')]=_0x45d5eb;}var _0xb3429d={'id':this['id'],'name':this[_0xf996('0x7')],'online':this[_0xf996('0x8')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xf996('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xf996('0xf')],'chatStatusTime':this[_0xf996('0x11')],'chatCapacity':this[_0xf996('0x12')],'chatCurrentCapacity':this[_0xf996('0x13')],'mailStatus':this[_0xf996('0x14')],'mailStatusTime':this[_0xf996('0x15')],'mailCapacity':this[_0xf996('0x16')],'mailCurrentCapacity':this[_0xf996('0x17')],'faxStatus':this[_0xf996('0x37')],'faxStatusTime':this[_0xf996('0x18')],'faxCapacity':this[_0xf996('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xf996('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xf996('0x38')],'whatsappStatus':this[_0xf996('0x1c')],'whatsappStatusTime':this[_0xf996('0x1d')],'whatsappCapacity':this[_0xf996('0x1e')],'whatsappCurrentCapacity':this[_0xf996('0x1f')],'openchannelStatus':this[_0xf996('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xf996('0x22')],'openchannelCurrentCapacity':this[_0xf996('0x23')],'busy':this['busy'],'busyQueue':this[_0xf996('0x39')]};var _0x496dc6=md5(JSON['stringify'](_0xb3429d));if(this['md5']!==_0x496dc6){this['md5']=_0x496dc6;io[_0xf996('0x3a')](_0xf996('0x3b'),_0xb3429d);}};module[_0xf996('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index dc124ff..fe6afd2 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 _0xf177=['format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','redis','defaults','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','chatPause','available','loggedIn','stringify'];(function(_0x30ef67,_0xae5198){var _0x499344=function(_0x2e30e3){while(--_0x2e30e3){_0x30ef67['push'](_0x30ef67['shift']());}};_0x499344(++_0xae5198);}(_0xf177,0x19b));var _0x7f17=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf177[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7f17('0x0'));var md5=require('md5');var util=require(_0x7f17('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x7f17('0x2')]=_[_0x7f17('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7f17('0x4'))(new Redis(config['redis']));function ChatQueue(_0x492eaf){this['id']=_0x492eaf['id']||0x0;this[_0x7f17('0x5')]=_0x492eaf[_0x7f17('0x5')]||'';this['timeout']=_0x492eaf['timeout']||0xa;this[_0x7f17('0x6')]=_0x492eaf[_0x7f17('0x6')]||_0x7f17('0x7');this[_0x7f17('0x8')]=_0x492eaf[_0x7f17('0x8')];this[_0x7f17('0x9')]={};this[_0x7f17('0xa')]=0x0;this[_0x7f17('0xb')]='';this[_0x7f17('0xc')]();this[_0x7f17('0xd')]();}ChatQueue[_0x7f17('0xe')]['updateRouting']=function(){var _0x176734=this[_0x7f17('0x9')][_0x7f17('0xf')];this['mapAgentsId']=_[_0x7f17('0x10')](this['Agents'],'id');this[_0x7f17('0x9')][_0x7f17('0xf')]=_0x176734;};ChatQueue['prototype'][_0x7f17('0xd')]=function(){this['loggedIn']=0x0;this[_0x7f17('0x11')]=0x0;for(var _0x172005=0x0;_0x172005=0x0?this[_0x7f17('0x15')]:0x0;var _0x4db6bc={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7f17('0x16')],'name':this[_0x7f17('0x5')],'paused':this[_0x7f17('0x11')],'waiting':this['waiting']};var _0x3ce14d=md5(JSON[_0x7f17('0x17')](_0x4db6bc));if(this[_0x7f17('0xb')]!==_0x3ce14d){this[_0x7f17('0xb')]=_0x3ce14d;io['to'](util[_0x7f17('0x18')](_0x7f17('0x19'),_0x4db6bc[_0x7f17('0x5')]))[_0x7f17('0x1a')](_0x7f17('0x1b'),_0x4db6bc);}};module[_0x7f17('0x1c')]=ChatQueue; \ No newline at end of file +var _0x7cb9=['available','waiting','stringify','chat:queue:%s','name','emit','exports','lodash','md5','util','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x7cb9,0x1d2));var _0x97cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7cb9[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x97cb('0x0'));var md5=require(_0x97cb('0x1'));var util=require(_0x97cb('0x2'));var Redis=require('ioredis');var config=require(_0x97cb('0x3'));config[_0x97cb('0x4')]=_['defaults'](config[_0x97cb('0x4')],{'host':_0x97cb('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x47018d){this['id']=_0x47018d['id']||0x0;this['name']=_0x47018d['name']||'';this[_0x97cb('0x6')]=_0x47018d[_0x97cb('0x6')]||0xa;this['strategy']=_0x47018d[_0x97cb('0x7')]||_0x97cb('0x8');this[_0x97cb('0x9')]=_0x47018d[_0x97cb('0x9')];this[_0x97cb('0xa')]={};this['waiting']=0x0;this[_0x97cb('0x1')]='';this['updateRouting']();this[_0x97cb('0xb')]();}ChatQueue[_0x97cb('0xc')][_0x97cb('0xd')]=function(){var _0x2d41af=this[_0x97cb('0xa')][_0x97cb('0xe')];this[_0x97cb('0xa')]=_[_0x97cb('0xf')](this[_0x97cb('0x9')],'id');this[_0x97cb('0xa')][_0x97cb('0xe')]=_0x2d41af;};ChatQueue['prototype'][_0x97cb('0xb')]=function(){this[_0x97cb('0x10')]=0x0;this[_0x97cb('0x11')]=0x0;for(var _0x1616e6=0x0;_0x1616e6=0x0?this[_0x97cb('0x14')]:0x0;var _0x2a7a00={'id':this['id'],'available':this[_0x97cb('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x97cb('0x11')],'waiting':this[_0x97cb('0x15')]};var _0x307272=md5(JSON[_0x97cb('0x16')](_0x2a7a00));if(this['md5']!==_0x307272){this['md5']=_0x307272;io['to'](util['format'](_0x97cb('0x17'),_0x2a7a00[_0x97cb('0x18')]))[_0x97cb('0x19')]('chat_queue:save',_0x2a7a00);}};module[_0x97cb('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 26d0c69..fb062da 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 _0xeef3=['length','faxPause','paused','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn'];(function(_0xa9235d,_0x13a12d){var _0x141e89=function(_0x336ecd){while(--_0x336ecd){_0xa9235d['push'](_0xa9235d['shift']());}};_0x141e89(++_0x13a12d);}(_0xeef3,0x175));var _0x3eef=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xeef3[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0x3eef('0x0'));var md5=require(_0x3eef('0x1'));var util=require(_0x3eef('0x2'));var Redis=require(_0x3eef('0x3'));var config=require(_0x3eef('0x4'));config[_0x3eef('0x5')]=_['defaults'](config['redis'],{'host':_0x3eef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3eef('0x5')]));function FaxQueue(_0x14bdaf){this['id']=_0x14bdaf['id']||0x0;this[_0x3eef('0x7')]=_0x14bdaf['name']||'';this['timeout']=_0x14bdaf[_0x3eef('0x8')]||0xa;this['strategy']=_0x14bdaf[_0x3eef('0x9')]||_0x3eef('0xa');this['Agents']=_0x14bdaf[_0x3eef('0xb')];this[_0x3eef('0xc')]={};this[_0x3eef('0xd')]=0x0;this[_0x3eef('0x1')]='';this[_0x3eef('0xe')]();this[_0x3eef('0xf')]();}FaxQueue['prototype'][_0x3eef('0xe')]=function(){var _0xf0972e=this[_0x3eef('0xc')]['_rr'];this[_0x3eef('0xc')]=_['map'](this[_0x3eef('0xb')],'id');this[_0x3eef('0xc')][_0x3eef('0x10')]=_0xf0972e;};FaxQueue[_0x3eef('0x11')][_0x3eef('0xf')]=function(){this[_0x3eef('0x12')]=0x0;this['paused']=0x0;for(var _0x40c938=0x0;_0x40c938=0x0?this[_0x3eef('0x16')]:0x0;var _0x564ab3={'id':this['id'],'available':this[_0x3eef('0x16')],'loggedIn':this[_0x3eef('0x12')],'name':this['name'],'paused':this[_0x3eef('0x15')],'waiting':this[_0x3eef('0xd')]};var _0x9f4a9=md5(JSON[_0x3eef('0x17')](_0x564ab3));if(this[_0x3eef('0x1')]!==_0x9f4a9){this[_0x3eef('0x1')]=_0x9f4a9;io['to'](util['format'](_0x3eef('0x18'),_0x564ab3[_0x3eef('0x7')]))[_0x3eef('0x19')](_0x3eef('0x1a'),_0x564ab3);}};module[_0x3eef('0x1b')]=FaxQueue; \ No newline at end of file +var _0x3bc7=['map','Agents','loggedIn','paused','length','faxPause','available','format','fax:queue:%s','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','prototype','_rr'];(function(_0x393dfd,_0x40dd83){var _0x2cd9c5=function(_0xc5b5b8){while(--_0xc5b5b8){_0x393dfd['push'](_0x393dfd['shift']());}};_0x2cd9c5(++_0x40dd83);}(_0x3bc7,0x1de));var _0x73bc=function(_0x432aef,_0x5a2632){_0x432aef=_0x432aef-0x0;var _0x1f1880=_0x3bc7[_0x432aef];return _0x1f1880;};'use strict';var _=require(_0x73bc('0x0'));var md5=require(_0x73bc('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x73bc('0x2'));config['redis']=_[_0x73bc('0x3')](config[_0x73bc('0x4')],{'host':_0x73bc('0x5'),'port':0x18eb});var io=require(_0x73bc('0x6'))(new Redis(config[_0x73bc('0x4')]));function FaxQueue(_0x3e0dd8){this['id']=_0x3e0dd8['id']||0x0;this[_0x73bc('0x7')]=_0x3e0dd8[_0x73bc('0x7')]||'';this['timeout']=_0x3e0dd8[_0x73bc('0x8')]||0xa;this[_0x73bc('0x9')]=_0x3e0dd8['strategy']||_0x73bc('0xa');this['Agents']=_0x3e0dd8['Agents'];this[_0x73bc('0xb')]={};this[_0x73bc('0xc')]=0x0;this[_0x73bc('0x1')]='';this[_0x73bc('0xd')]();this['updateRealtime']();}FaxQueue[_0x73bc('0xe')]['updateRouting']=function(){var _0x179524=this['mapAgentsId'][_0x73bc('0xf')];this[_0x73bc('0xb')]=_[_0x73bc('0x10')](this[_0x73bc('0x11')],'id');this[_0x73bc('0xb')][_0x73bc('0xf')]=_0x179524;};FaxQueue[_0x73bc('0xe')]['updateRealtime']=function(){this[_0x73bc('0x12')]=0x0;this[_0x73bc('0x13')]=0x0;for(var _0x4a7546=0x0;_0x4a7546=0x0?this[_0x73bc('0x16')]:0x0;var _0x330395={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x73bc('0xc')]};var _0x258dbf=md5(JSON['stringify'](_0x330395));if(this['md5']!==_0x258dbf){this['md5']=_0x258dbf;io['to'](util[_0x73bc('0x17')](_0x73bc('0x18'),_0x330395[_0x73bc('0x7')]))['emit']('fax_queue:save',_0x330395);}};module[_0x73bc('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b9d6037..c0ebcf4 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 _0x7fac=['Intervals','exports','name'];(function(_0xb06307,_0x4fb583){var _0x524811=function(_0x308516){while(--_0x308516){_0xb06307['push'](_0xb06307['shift']());}};_0x524811(++_0x4fb583);}(_0x7fac,0x19a));var _0xc7fa=function(_0x16bb0e,_0x343132){_0x16bb0e=_0x16bb0e-0x0;var _0x102b8b=_0x7fac[_0x16bb0e];return _0x102b8b;};'use strict';function Interval(_0x5d36bc){this['id']=_0x5d36bc['id']||0x0;this[_0xc7fa('0x0')]=_0x5d36bc['name']||'';this[_0xc7fa('0x1')]=_0x5d36bc[_0xc7fa('0x1')]||{};}module[_0xc7fa('0x2')]=Interval; \ No newline at end of file +var _0x7792=['name','Intervals','exports'];(function(_0x5ad07b,_0x83231e){var _0x5c0912=function(_0x112d7f){while(--_0x112d7f){_0x5ad07b['push'](_0x5ad07b['shift']());}};_0x5c0912(++_0x83231e);}(_0x7792,0x81));var _0x2779=function(_0x45fcb3,_0x1381c4){_0x45fcb3=_0x45fcb3-0x0;var _0x506991=_0x7792[_0x45fcb3];return _0x506991;};'use strict';function Interval(_0x312e6c){this['id']=_0x312e6c['id']||0x0;this[_0x2779('0x0')]=_0x312e6c[_0x2779('0x0')]||'';this['Intervals']=_0x312e6c[_0x2779('0x1')]||{};}module[_0x2779('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index a98094e..2412ddf 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 _0xa661=['defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','map','_rr','loggedIn','paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','redis'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0xa661,0xd5));var _0x1a66=function(_0x3973da,_0x3e8345){_0x3973da=_0x3973da-0x0;var _0x455279=_0xa661[_0x3973da];return _0x455279;};'use strict';var _=require(_0x1a66('0x0'));var md5=require('md5');var util=require(_0x1a66('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1a66('0x2')]=_[_0x1a66('0x3')](config[_0x1a66('0x2')],{'host':_0x1a66('0x4'),'port':0x18eb});var io=require(_0x1a66('0x5'))(new Redis(config[_0x1a66('0x2')]));function MailQueue(_0x1f309c){this['id']=_0x1f309c['id']||0x0;this[_0x1a66('0x6')]=_0x1f309c[_0x1a66('0x6')]||'';this['timeout']=_0x1f309c['timeout']||0xa;this[_0x1a66('0x7')]=_0x1f309c[_0x1a66('0x7')]||'beepall';this[_0x1a66('0x8')]=_0x1f309c[_0x1a66('0x8')];this[_0x1a66('0x9')]={};this[_0x1a66('0xa')]=0x0;this[_0x1a66('0xb')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x1a66('0xc')][_0x1a66('0xd')]=function(){var _0x2221dd=this['mapAgentsId']['_rr'];this[_0x1a66('0x9')]=_[_0x1a66('0xe')](this[_0x1a66('0x8')],'id');this['mapAgentsId'][_0x1a66('0xf')]=_0x2221dd;};MailQueue[_0x1a66('0xc')]['updateRealtime']=function(){this[_0x1a66('0x10')]=0x0;this[_0x1a66('0x11')]=0x0;for(var _0x45e65f=0x0;_0x45e65f=0x0?this[_0x1a66('0x14')]:0x0;var _0x409e4d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1a66('0x10')],'name':this[_0x1a66('0x6')],'paused':this[_0x1a66('0x11')],'waiting':this[_0x1a66('0xa')]};var _0x18147d=md5(JSON[_0x1a66('0x15')](_0x409e4d));if(this[_0x1a66('0xb')]!==_0x18147d){this[_0x1a66('0xb')]=_0x18147d;io['to'](util[_0x1a66('0x16')](_0x1a66('0x17'),_0x409e4d[_0x1a66('0x6')]))[_0x1a66('0x18')](_0x1a66('0x19'),_0x409e4d);}};module[_0x1a66('0x1a')]=MailQueue; \ No newline at end of file +var _0xc632=['mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xc632,0x15c));var _0x2c63=function(_0x2cf5eb,_0x299a69){_0x2cf5eb=_0x2cf5eb-0x0;var _0x297e8a=_0xc632[_0x2cf5eb];return _0x297e8a;};'use strict';var _=require(_0x2c63('0x0'));var md5=require(_0x2c63('0x1'));var util=require('util');var Redis=require(_0x2c63('0x2'));var config=require(_0x2c63('0x3'));config[_0x2c63('0x4')]=_['defaults'](config['redis'],{'host':_0x2c63('0x5'),'port':0x18eb});var io=require(_0x2c63('0x6'))(new Redis(config['redis']));function MailQueue(_0x220d7d){this['id']=_0x220d7d['id']||0x0;this[_0x2c63('0x7')]=_0x220d7d[_0x2c63('0x7')]||'';this[_0x2c63('0x8')]=_0x220d7d[_0x2c63('0x8')]||0xa;this[_0x2c63('0x9')]=_0x220d7d[_0x2c63('0x9')]||_0x2c63('0xa');this[_0x2c63('0xb')]=_0x220d7d[_0x2c63('0xb')];this[_0x2c63('0xc')]={};this[_0x2c63('0xd')]=0x0;this[_0x2c63('0x1')]='';this[_0x2c63('0xe')]();this['updateRealtime']();}MailQueue[_0x2c63('0xf')][_0x2c63('0xe')]=function(){var _0x29ad3f=this[_0x2c63('0xc')][_0x2c63('0x10')];this['mapAgentsId']=_[_0x2c63('0x11')](this[_0x2c63('0xb')],'id');this[_0x2c63('0xc')]['_rr']=_0x29ad3f;};MailQueue['prototype'][_0x2c63('0x12')]=function(){this[_0x2c63('0x13')]=0x0;this[_0x2c63('0x14')]=0x0;for(var _0x12c6b4=0x0;_0x12c6b4=0x0?this[_0x2c63('0x18')]:0x0;var _0x2a8c39={'id':this['id'],'available':this[_0x2c63('0x18')],'loggedIn':this[_0x2c63('0x13')],'name':this[_0x2c63('0x7')],'paused':this['paused'],'waiting':this[_0x2c63('0xd')]};var _0x3a8d46=md5(JSON[_0x2c63('0x19')](_0x2a8c39));if(this[_0x2c63('0x1')]!==_0x3a8d46){this[_0x2c63('0x1')]=_0x3a8d46;io['to'](util['format'](_0x2c63('0x1a'),_0x2a8c39[_0x2c63('0x7')]))[_0x2c63('0x1b')](_0x2c63('0x1c'),_0x2a8c39);}};module[_0x2c63('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 22cfeef..5b78c42 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x469f53,_0x246087){var _0x15784c=function(_0x4b842c){while(--_0x4b842c){_0x469f53['push'](_0x469f53['shift']());}};_0x15784c(++_0x246087);}(_0x814b,0x1a2));var _0xb814=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0x814b[_0x11ba46];return _0x1c8c6f;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3ddb58,_0x1cf8b6){var _0x4aaa6e=function(_0x3c3753){while(--_0x3c3753){_0x3ddb58['push'](_0x3ddb58['shift']());}};_0x4aaa6e(++_0x1cf8b6);}(_0x814b,0x1a2));var _0xb814=function(_0x5106c1,_0x13233a){_0x5106c1=_0x5106c1-0x0;var _0x5bcaac=_0x814b[_0x5106c1];return _0x5bcaac;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 40ed55b..9291907 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 _0x6fad=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis'];(function(_0x4787a0,_0x53bfb0){var _0x117c9e=function(_0x48802c){while(--_0x48802c){_0x4787a0['push'](_0x4787a0['shift']());}};_0x117c9e(++_0x53bfb0);}(_0x6fad,0x174));var _0xd6fa=function(_0x182f71,_0x2a9c96){_0x182f71=_0x182f71-0x0;var _0x18b7e6=_0x6fad[_0x182f71];return _0x18b7e6;};'use strict';var _=require(_0xd6fa('0x0'));var md5=require(_0xd6fa('0x1'));var util=require(_0xd6fa('0x2'));var Redis=require(_0xd6fa('0x3'));var config=require('../../../config/environment');config[_0xd6fa('0x4')]=_['defaults'](config[_0xd6fa('0x4')],{'host':_0xd6fa('0x5'),'port':0x18eb});var io=require(_0xd6fa('0x6'))(new Redis(config[_0xd6fa('0x4')]));function SmsQueue(_0x58325c){this['id']=_0x58325c['id']||0x0;this[_0xd6fa('0x7')]=_0x58325c[_0xd6fa('0x7')]||'';this[_0xd6fa('0x8')]=_0x58325c[_0xd6fa('0x8')]||0xa;this['strategy']=_0x58325c[_0xd6fa('0x9')]||'beepall';this[_0xd6fa('0xa')]=_0x58325c[_0xd6fa('0xa')];this[_0xd6fa('0xb')]={};this[_0xd6fa('0xc')]=0x0;this[_0xd6fa('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xd6fa('0xd')][_0xd6fa('0xe')]=function(){var _0x4e91f4=this[_0xd6fa('0xb')][_0xd6fa('0xf')];this['mapAgentsId']=_['map'](this[_0xd6fa('0xa')],'id');this['mapAgentsId']['_rr']=_0x4e91f4;};SmsQueue[_0xd6fa('0xd')][_0xd6fa('0x10')]=function(){this[_0xd6fa('0x11')]=0x0;this[_0xd6fa('0x12')]=0x0;for(var _0x3cd6fa=0x0;_0x3cd6fa=0x0?this['available']:0x0;var _0xe458aa={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd6fa('0x11')],'name':this['name'],'paused':this[_0xd6fa('0x12')],'waiting':this[_0xd6fa('0xc')]};var _0x2ee97a=md5(JSON[_0xd6fa('0x17')](_0xe458aa));if(this[_0xd6fa('0x1')]!==_0x2ee97a){this[_0xd6fa('0x1')]=_0x2ee97a;io['to'](util[_0xd6fa('0x18')](_0xd6fa('0x19'),_0xe458aa[_0xd6fa('0x7')]))[_0xd6fa('0x1a')](_0xd6fa('0x1b'),_0xe458aa);}};module[_0xd6fa('0x1c')]=SmsQueue; \ No newline at end of file +var _0xe94a=['timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x37e586,_0x2b2ddc){var _0x30bce2=function(_0x40a9fc){while(--_0x40a9fc){_0x37e586['push'](_0x37e586['shift']());}};_0x30bce2(++_0x2b2ddc);}(_0xe94a,0x1c7));var _0xae94=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xe94a[_0x4cc492];return _0x1f36b9;};'use strict';var _=require(_0xae94('0x0'));var md5=require(_0xae94('0x1'));var util=require(_0xae94('0x2'));var Redis=require('ioredis');var config=require(_0xae94('0x3'));config[_0xae94('0x4')]=_[_0xae94('0x5')](config[_0xae94('0x4')],{'host':_0xae94('0x6'),'port':0x18eb});var io=require(_0xae94('0x7'))(new Redis(config['redis']));function SmsQueue(_0x429d6d){this['id']=_0x429d6d['id']||0x0;this[_0xae94('0x8')]=_0x429d6d[_0xae94('0x8')]||'';this[_0xae94('0x9')]=_0x429d6d[_0xae94('0x9')]||0xa;this['strategy']=_0x429d6d['strategy']||_0xae94('0xa');this[_0xae94('0xb')]=_0x429d6d['Agents'];this[_0xae94('0xc')]={};this[_0xae94('0xd')]=0x0;this[_0xae94('0x1')]='';this[_0xae94('0xe')]();this[_0xae94('0xf')]();}SmsQueue[_0xae94('0x10')][_0xae94('0xe')]=function(){var _0x3e24c6=this['mapAgentsId']['_rr'];this[_0xae94('0xc')]=_[_0xae94('0x11')](this['Agents'],'id');this[_0xae94('0xc')]['_rr']=_0x3e24c6;};SmsQueue[_0xae94('0x10')][_0xae94('0xf')]=function(){this[_0xae94('0x12')]=0x0;this[_0xae94('0x13')]=0x0;for(var _0x223e35=0x0;_0x223e35=0x0?this[_0xae94('0x16')]:0x0;var _0x382b4a={'id':this['id'],'available':this[_0xae94('0x16')],'loggedIn':this[_0xae94('0x12')],'name':this['name'],'paused':this[_0xae94('0x13')],'waiting':this[_0xae94('0xd')]};var _0x5a0cdd=md5(JSON[_0xae94('0x17')](_0x382b4a));if(this[_0xae94('0x1')]!==_0x5a0cdd){this['md5']=_0x5a0cdd;io['to'](util[_0xae94('0x18')](_0xae94('0x19'),_0x382b4a[_0xae94('0x8')]))[_0xae94('0x1a')](_0xae94('0x1b'),_0x382b4a);}};module[_0xae94('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 11bc5b5..4401333 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 _0xfa28=['defaults','localhost','name','timeout','beepall','Agents','waiting','updateRouting','_rr','mapAgentsId','map','prototype','loggedIn','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x3e5000,_0x21d585){var _0x301a98=function(_0x4f5cdd){while(--_0x4f5cdd){_0x3e5000['push'](_0x3e5000['shift']());}};_0x301a98(++_0x21d585);}(_0xfa28,0xff));var _0x8fa2=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xfa28[_0x1ebce2];return _0x4a330c;};'use strict';var _=require(_0x8fa2('0x0'));var md5=require(_0x8fa2('0x1'));var util=require(_0x8fa2('0x2'));var Redis=require(_0x8fa2('0x3'));var config=require(_0x8fa2('0x4'));config[_0x8fa2('0x5')]=_[_0x8fa2('0x6')](config['redis'],{'host':_0x8fa2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8fa2('0x5')]));function WhatsappQueue(_0x2663de){this['id']=_0x2663de['id']||0x0;this[_0x8fa2('0x8')]=_0x2663de[_0x8fa2('0x8')]||'';this[_0x8fa2('0x9')]=_0x2663de['timeout']||0xa;this['strategy']=_0x2663de['strategy']||_0x8fa2('0xa');this[_0x8fa2('0xb')]=_0x2663de['Agents'];this['mapAgentsId']={};this[_0x8fa2('0xc')]=0x0;this[_0x8fa2('0x1')]='';this[_0x8fa2('0xd')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x8fa2('0xd')]=function(){var _0x172d5c=this['mapAgentsId'][_0x8fa2('0xe')];this[_0x8fa2('0xf')]=_[_0x8fa2('0x10')](this[_0x8fa2('0xb')],'id');this['mapAgentsId']['_rr']=_0x172d5c;};WhatsappQueue[_0x8fa2('0x11')]['updateRealtime']=function(){this[_0x8fa2('0x12')]=0x0;this['paused']=0x0;for(var _0x49a2fd=0x0;_0x49a2fd=0x0?this[_0x8fa2('0x16')]:0x0;var _0x5a5c98={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8fa2('0x12')],'name':this[_0x8fa2('0x8')],'paused':this[_0x8fa2('0x15')],'waiting':this[_0x8fa2('0xc')]};var _0x3f128d=md5(JSON[_0x8fa2('0x17')](_0x5a5c98));if(this[_0x8fa2('0x1')]!==_0x3f128d){this[_0x8fa2('0x1')]=_0x3f128d;io['to'](util[_0x8fa2('0x18')](_0x8fa2('0x19'),_0x5a5c98['name']))[_0x8fa2('0x1a')](_0x8fa2('0x1b'),_0x5a5c98);}};module[_0x8fa2('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x0d2d=['defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','whatsappPause','paused','available','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis'];(function(_0x22d7b8,_0x37a86f){var _0x49eba7=function(_0x76aeb2){while(--_0x76aeb2){_0x22d7b8['push'](_0x22d7b8['shift']());}};_0x49eba7(++_0x37a86f);}(_0x0d2d,0x19c));var _0xd0d2=function(_0x2ffb97,_0x3141e9){_0x2ffb97=_0x2ffb97-0x0;var _0x474336=_0x0d2d[_0x2ffb97];return _0x474336;};'use strict';var _=require(_0xd0d2('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xd0d2('0x1'));var config=require(_0xd0d2('0x2'));config[_0xd0d2('0x3')]=_[_0xd0d2('0x4')](config[_0xd0d2('0x3')],{'host':_0xd0d2('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd0d2('0x3')]));function WhatsappQueue(_0x1feaef){this['id']=_0x1feaef['id']||0x0;this[_0xd0d2('0x6')]=_0x1feaef[_0xd0d2('0x6')]||'';this[_0xd0d2('0x7')]=_0x1feaef[_0xd0d2('0x7')]||0xa;this['strategy']=_0x1feaef[_0xd0d2('0x8')]||_0xd0d2('0x9');this[_0xd0d2('0xa')]=_0x1feaef['Agents'];this[_0xd0d2('0xb')]={};this[_0xd0d2('0xc')]=0x0;this[_0xd0d2('0xd')]='';this[_0xd0d2('0xe')]();this[_0xd0d2('0xf')]();}WhatsappQueue[_0xd0d2('0x10')][_0xd0d2('0xe')]=function(){var _0x2af160=this[_0xd0d2('0xb')][_0xd0d2('0x11')];this[_0xd0d2('0xb')]=_['map'](this[_0xd0d2('0xa')],'id');this[_0xd0d2('0xb')][_0xd0d2('0x11')]=_0x2af160;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xd0d2('0x12')]=0x0;this['paused']=0x0;for(var _0x33a99b=0x0;_0x33a99b=0x0?this[_0xd0d2('0x16')]:0x0;var _0x509a01={'id':this['id'],'available':this[_0xd0d2('0x16')],'loggedIn':this[_0xd0d2('0x12')],'name':this[_0xd0d2('0x6')],'paused':this[_0xd0d2('0x15')],'waiting':this[_0xd0d2('0xc')]};var _0x1a290d=md5(JSON['stringify'](_0x509a01));if(this[_0xd0d2('0xd')]!==_0x1a290d){this[_0xd0d2('0xd')]=_0x1a290d;io['to'](util['format'](_0xd0d2('0x17'),_0x509a01['name']))['emit'](_0xd0d2('0x18'),_0x509a01);}};module[_0xd0d2('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 75969bd..4695ccf 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(_0x371686,_0xf0a80b){var _0x3f9219=function(_0x563598){while(--_0x563598){_0x371686['push'](_0x371686['shift']());}};_0x3f9219(++_0xf0a80b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2040dd,_0x156a63){_0x2040dd=_0x2040dd-0x0;var _0x27688f=_0xb10b[_0x2040dd];return _0x27688f;};'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(_0x1a76b7,_0x3fa19d){var _0x2a72a8=function(_0x28cd2e){while(--_0x28cd2e){_0x1a76b7['push'](_0x1a76b7['shift']());}};_0x2a72a8(++_0x3fa19d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xb10b[_0x3de873];return _0x380b8c;};'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 398d9c4..d25b1cc 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 _0x7c76=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','addTags'];(function(_0x60e43a,_0x2a2b01){var _0x32bbda=function(_0x3b8b73){while(--_0x3b8b73){_0x60e43a['push'](_0x60e43a['shift']());}};_0x32bbda(++_0x2a2b01);}(_0x7c76,0x1ce));var _0x67c7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7c76[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x67c7('0x0')]=function(_0x1b0139,_0x57732e){return client[_0x67c7('0x1')]('UpdateChatInteraction',{'body':_0x57732e,'options':{'where':{'id':_0x1b0139}},'log':'updateChatInteraction'});};exports[_0x67c7('0x2')]=function(_0xde6cab,_0x5a854f){return client[_0x67c7('0x1')](_0x67c7('0x3'),{'body':_0x5a854f,'options':{'where':{'id':_0xde6cab}},'log':_0x67c7('0x4')});}; \ No newline at end of file +var _0x932b=['UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x5a1ead,_0x461d29){var _0x547b03=function(_0x197a58){while(--_0x197a58){_0x5a1ead['push'](_0x5a1ead['shift']());}};_0x547b03(++_0x461d29);}(_0x932b,0x16c));var _0xb932=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x932b[_0x5caf7e];return _0x5c3435;};'use strict';var client=require(_0xb932('0x0'));exports[_0xb932('0x1')]=function(_0x2df290,_0x47750c){return client['Request'](_0xb932('0x2'),{'body':_0x47750c,'options':{'where':{'id':_0x2df290}},'log':_0xb932('0x3')});};exports[_0xb932('0x4')]=function(_0x4fe329,_0x346ab8){return client['Request']('AddTagsToChatInteraction',{'body':_0x346ab8,'options':{'where':{'id':_0x4fe329}},'log':_0xb932('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7218326..e65c36c 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 _0xcdee=['CreateChatMessage','create','Request'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xcdee,0x64));var _0xecde=function(_0x41cd90,_0x36f0fb){_0x41cd90=_0x41cd90-0x0;var _0x186856=_0xcdee[_0x41cd90];return _0x186856;};'use strict';var client=require('../client');exports[_0xecde('0x0')]=function(_0x15d1d8){return client[_0xecde('0x1')](_0xecde('0x2'),{'body':_0x15d1d8,'log':'createChatMessage'});}; \ No newline at end of file +var _0x69cf=['CreateChatMessage','createChatMessage','Request'];(function(_0xfd3603,_0x193b47){var _0xadf282=function(_0x24386e){while(--_0x24386e){_0xfd3603['push'](_0xfd3603['shift']());}};_0xadf282(++_0x193b47);}(_0x69cf,0xb9));var _0xf69c=function(_0x3ad06e,_0x2cc9af){_0x3ad06e=_0x3ad06e-0x0;var _0xa97338=_0x69cf[_0x3ad06e];return _0xa97338;};'use strict';var client=require('../client');exports['create']=function(_0x2f2bf0){return client[_0xf69c('0x0')](_0xf69c('0x1'),{'body':_0x2f2bf0,'log':_0xf69c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index cd723d1..980d100 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 _0x6b8f=['name','online','chatPause','getChatQueues','GetChatQueue','strategy','User'];(function(_0x1e2e30,_0x48b693){var _0x49169c=function(_0x220462){while(--_0x220462){_0x1e2e30['push'](_0x1e2e30['shift']());}};_0x49169c(++_0x48b693);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x46c42b,_0x38a505){_0x46c42b=_0x46c42b-0x0;var _0x8af215=_0x6b8f[_0x46c42b];return _0x8af215;};'use strict';var client=require('../client');exports[_0xf6b8('0x0')]=function(){return function(){return client['Request'](_0xf6b8('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf6b8('0x2')],'include':[{'model':_0xf6b8('0x3'),'as':'Agents','attributes':['id',_0xf6b8('0x4'),_0xf6b8('0x5'),_0xf6b8('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xc18a=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents','name','online'];(function(_0x5e909d,_0xcb0787){var _0x4cf7b5=function(_0x4581c6){while(--_0x4581c6){_0x5e909d['push'](_0x5e909d['shift']());}};_0x4cf7b5(++_0xcb0787);}(_0xc18a,0x1cf));var _0xac18=function(_0x5c8150,_0x5c9d2b){_0x5c8150=_0x5c8150-0x0;var _0x1ad0a9=_0xc18a[_0x5c8150];return _0x1ad0a9;};'use strict';var client=require(_0xac18('0x0'));exports[_0xac18('0x1')]=function(){return function(){return client[_0xac18('0x2')](_0xac18('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xac18('0x4'),_0xac18('0x5')],'include':[{'model':_0xac18('0x6'),'as':_0xac18('0x7'),'attributes':['id',_0xac18('0x8'),_0xac18('0x9'),_0xac18('0xa')]}]},'log':_0xac18('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3e55d4b..fee4de4 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 _0x43b1=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x1f2c15,_0x202189){var _0x16a8bf=function(_0x2dbdca){while(--_0x2dbdca){_0x1f2c15['push'](_0x1f2c15['shift']());}};_0x16a8bf(++_0x202189);}(_0x43b1,0x7d));var _0x143b=function(_0x39d630,_0x113ea5){_0x39d630=_0x39d630-0x0;var _0x4ef7aa=_0x43b1[_0x39d630];return _0x4ef7aa;};'use strict';var client=require(_0x143b('0x0'));exports[_0x143b('0x1')]=function(_0x426f2c){return client['Request'](_0x143b('0x2'),{'body':_0x426f2c,'log':'CreateChatQueueReport'});};exports[_0x143b('0x3')]=function(_0x4388c5,_0x223e86){return client[_0x143b('0x4')](_0x143b('0x5'),{'body':_0x223e86,'options':{'where':{'uniqueid':_0x4388c5},'order':[['id',_0x143b('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xe799=['../client','CreateChatQueueReport','Request','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe799,0x170));var _0x9e79=function(_0x2898bd,_0x4504b4){_0x2898bd=_0x2898bd-0x0;var _0x448a16=_0xe799[_0x2898bd];return _0x448a16;};'use strict';var client=require(_0x9e79('0x0'));exports['create']=function(_0x3308ba){return client['Request'](_0x9e79('0x1'),{'body':_0x3308ba,'log':_0x9e79('0x1')});};exports['update']=function(_0x34a40e,_0x3f0a4f){return client[_0x9e79('0x2')]('UpdateChatQueueReport',{'body':_0x3f0a4f,'options':{'where':{'uniqueid':_0x34a40e},'order':[['id',_0x9e79('0x3')]],'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 96dcd5e..788533e 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(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0x7a54,0x106));var _0x47a5=function(_0x2eac0c,_0x2cf8a8){_0x2eac0c=_0x2eac0c-0x0;var _0x21fd28=_0x7a54[_0x2eac0c];return _0x21fd28;};'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(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x7a54,0x106));var _0x47a5=function(_0x5e090d,_0x21bfab){_0x5e090d=_0x5e090d-0x0;var _0x4ba8e5=_0x7a54[_0x5e090d];return _0x4ba8e5;};'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 73674f2..ffcc030 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 _0x5db6=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x1d48af,_0x294079){var _0x181c5b=function(_0x4abd16){while(--_0x4abd16){_0x1d48af['push'](_0x1d48af['shift']());}};_0x181c5b(++_0x294079);}(_0x5db6,0xac));var _0x65db=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0x5db6[_0x38080e];return _0x4e4c87;};'use strict';var client=require(_0x65db('0x0'));exports[_0x65db('0x1')]=function(_0x2d86f6){return client[_0x65db('0x2')](_0x65db('0x3'),{'body':_0x2d86f6,'log':_0x65db('0x4')});}; \ No newline at end of file +var _0xd4ef=['../client','create','Request'];(function(_0x504a16,_0x193ecd){var _0x4c2e54=function(_0x547457){while(--_0x547457){_0x504a16['push'](_0x504a16['shift']());}};_0x4c2e54(++_0x193ecd);}(_0xd4ef,0x171));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xfd4e('0x0'));exports[_0xfd4e('0x1')]=function(_0x1d7501){return client[_0xfd4e('0x2')]('CreateFaxMessage',{'body':_0x1d7501,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 3b2ec41..f2e22f7 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 _0x52a6=['getFaxQueues','timeout','strategy','User','Agents','name','online','faxPause','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x52a6,0x8f));var _0x652a=function(_0x262f36,_0x54bd2d){_0x262f36=_0x262f36-0x0;var _0x355624=_0x52a6[_0x262f36];return _0x355624;};'use strict';var client=require(_0x652a('0x0'));exports[_0x652a('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x652a('0x2'),_0x652a('0x3')],'include':[{'model':_0x652a('0x4'),'as':_0x652a('0x5'),'attributes':['id',_0x652a('0x6'),_0x652a('0x7'),_0x652a('0x8')]}]},'log':_0x652a('0x1')});};}; \ No newline at end of file +var _0x3364=['../client','Request','GetFaxQueue','name','timeout','strategy','User','faxPause'];(function(_0xc1b70b,_0x3ccbb4){var _0x21852d=function(_0x22e1a8){while(--_0x22e1a8){_0xc1b70b['push'](_0xc1b70b['shift']());}};_0x21852d(++_0x3ccbb4);}(_0x3364,0xd8));var _0x4336=function(_0x52e1dd,_0x4b6b24){_0x52e1dd=_0x52e1dd-0x0;var _0x136ea1=_0x3364[_0x52e1dd];return _0x136ea1;};'use strict';var client=require(_0x4336('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x4336('0x1')](_0x4336('0x2'),{'options':{'raw':![],'attributes':['id',_0x4336('0x3'),_0x4336('0x4'),_0x4336('0x5')],'include':[{'model':_0x4336('0x6'),'as':'Agents','attributes':['id',_0x4336('0x3'),'online',_0x4336('0x7')]}]},'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 e8d7616..0e7643c 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 _0x7d13=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x2eaee9,_0x2ee388){var _0xd81ab5=function(_0x54b5b6){while(--_0x54b5b6){_0x2eaee9['push'](_0x2eaee9['shift']());}};_0xd81ab5(++_0x2ee388);}(_0x7d13,0x1de));var _0x37d1=function(_0x11da1e,_0x597cc5){_0x11da1e=_0x11da1e-0x0;var _0x404daa=_0x7d13[_0x11da1e];return _0x404daa;};'use strict';var client=require(_0x37d1('0x0'));exports[_0x37d1('0x1')]=function(_0x51c159){return client[_0x37d1('0x2')](_0x37d1('0x3'),{'body':_0x51c159,'log':_0x37d1('0x3')});};exports[_0x37d1('0x4')]=function(_0x24b2c2,_0x49c42f){return client[_0x37d1('0x2')](_0x37d1('0x5'),{'body':_0x49c42f,'options':{'where':{'uniqueid':_0x24b2c2},'order':[['id',_0x37d1('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xe185=['update','Request','UpdateFaxQueueReport','create','CreateFaxQueueReport'];(function(_0x2bb089,_0x1d87d8){var _0x1471a9=function(_0x4a02a0){while(--_0x4a02a0){_0x2bb089['push'](_0x2bb089['shift']());}};_0x1471a9(++_0x1d87d8);}(_0xe185,0xa3));var _0x5e18=function(_0x2e5fb2,_0x2b4be0){_0x2e5fb2=_0x2e5fb2-0x0;var _0x3be9dc=_0xe185[_0x2e5fb2];return _0x3be9dc;};'use strict';var client=require('../client');exports[_0x5e18('0x0')]=function(_0x13312e){return client['Request']('CreateFaxQueueReport',{'body':_0x13312e,'log':_0x5e18('0x1')});};exports[_0x5e18('0x2')]=function(_0x282602,_0x40a065){return client[_0x5e18('0x3')](_0x5e18('0x4'),{'body':_0x40a065,'options':{'where':{'uniqueid':_0x282602},'order':[['id','DESC']],'limit':0x1},'log':_0x5e18('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e50c4cf..5222100 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 _0x185e=['interval','../client','Request','name','Interval'];(function(_0x1e1d5d,_0x213f5b){var _0x1830ac=function(_0x55efb0){while(--_0x55efb0){_0x1e1d5d['push'](_0x1e1d5d['shift']());}};_0x1830ac(++_0x213f5b);}(_0x185e,0xab));var _0xe185=function(_0x586cab,_0x5b0d02){_0x586cab=_0x586cab-0x0;var _0x15a859=_0x185e[_0x586cab];return _0x15a859;};'use strict';var client=require(_0xe185('0x0'));exports['getIntervals']=function(){return function(){return client[_0xe185('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe185('0x2')],'include':[{'model':_0xe185('0x3'),'as':'Intervals','attributes':['id',_0xe185('0x2'),_0xe185('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xe8d8=['Intervals','../client','getIntervals','Request','GetInterval','name'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe8d8,0x163));var _0x8e8d=function(_0x2e7c0c,_0x3d0ff3){_0x2e7c0c=_0x2e7c0c-0x0;var _0x23be6f=_0xe8d8[_0x2e7c0c];return _0x23be6f;};'use strict';var client=require(_0x8e8d('0x0'));exports[_0x8e8d('0x1')]=function(){return function(){return client[_0x8e8d('0x2')](_0x8e8d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8e8d('0x4')],'include':[{'model':'Interval','as':_0x8e8d('0x5'),'attributes':['id',_0x8e8d('0x4'),'interval']}]},'log':_0x8e8d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 3e0d0ad..cfce9cf 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 _0x57ca=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request'];(function(_0x24fd0d,_0x341be2){var _0x18ef2e=function(_0x2ad6e4){while(--_0x2ad6e4){_0x24fd0d['push'](_0x24fd0d['shift']());}};_0x18ef2e(++_0x341be2);}(_0x57ca,0x108));var _0xa57c=function(_0x2a5afa,_0x51510c){_0x2a5afa=_0x2a5afa-0x0;var _0x6874ca=_0x57ca[_0x2a5afa];return _0x6874ca;};'use strict';var client=require('../client');exports[_0xa57c('0x0')]=function(_0x4ad696,_0x4b1712){return client[_0xa57c('0x1')](_0xa57c('0x2'),{'body':_0x4b1712,'options':{'where':{'id':_0x4ad696}},'log':_0xa57c('0x3')});};exports[_0xa57c('0x4')]=function(_0x1da469,_0x48be2d){return client[_0xa57c('0x1')](_0xa57c('0x5'),{'body':_0x48be2d,'options':{'where':{'id':_0x1da469}},'log':_0xa57c('0x6')});}; \ No newline at end of file +var _0xd943=['addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x2f079a,_0x1d08b7){var _0x46d238=function(_0x4689bf){while(--_0x4689bf){_0x2f079a['push'](_0x2f079a['shift']());}};_0x46d238(++_0x1d08b7);}(_0xd943,0x15d));var _0x3d94=function(_0x11e614,_0x23d523){_0x11e614=_0x11e614-0x0;var _0x5a1e39=_0xd943[_0x11e614];return _0x5a1e39;};'use strict';var client=require(_0x3d94('0x0'));exports[_0x3d94('0x1')]=function(_0x55353d,_0x440dd8){return client['Request'](_0x3d94('0x2'),{'body':_0x440dd8,'options':{'where':{'id':_0x55353d}},'log':_0x3d94('0x3')});};exports[_0x3d94('0x4')]=function(_0xc13b61,_0xaf8962){return client['Request']('AddTagsToMailInteraction',{'body':_0xaf8962,'options':{'where':{'id':_0xc13b61}},'log':_0x3d94('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 380c053..b4d56d0 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 _0xb12f=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xb12f,0xd8));var _0xfb12=function(_0x2e666f,_0x1bc5f3){_0x2e666f=_0x2e666f-0x0;var _0x455047=_0xb12f[_0x2e666f];return _0x455047;};'use strict';var client=require(_0xfb12('0x0'));exports[_0xfb12('0x1')]=function(_0x3958eb){return client['Request'](_0xfb12('0x2'),{'body':_0x3958eb,'log':_0xfb12('0x3')});}; \ No newline at end of file +var _0x87e0=['CreateMailMessage','../client'];(function(_0x366961,_0x3a976d){var _0x24d566=function(_0x46be04){while(--_0x46be04){_0x366961['push'](_0x366961['shift']());}};_0x24d566(++_0x3a976d);}(_0x87e0,0x11d));var _0x087e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x87e0[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x087e('0x0'));exports['create']=function(_0x439cbb){return client['Request'](_0x087e('0x1'),{'body':_0x439cbb,'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 d4a5587..a4529c3 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 _0xc4b3=['GetMailQueue','name','timeout','strategy','Agents','online','mailPause','getMailQueues','../client'];(function(_0x4c4e18,_0x130b42){var _0x43fbc3=function(_0x2e6821){while(--_0x2e6821){_0x4c4e18['push'](_0x4c4e18['shift']());}};_0x43fbc3(++_0x130b42);}(_0xc4b3,0x179));var _0x3c4b=function(_0x5b08ae,_0x15acb3){_0x5b08ae=_0x5b08ae-0x0;var _0x2f8f1d=_0xc4b3[_0x5b08ae];return _0x2f8f1d;};'use strict';var client=require(_0x3c4b('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x3c4b('0x1'),{'options':{'raw':![],'attributes':['id',_0x3c4b('0x2'),_0x3c4b('0x3'),_0x3c4b('0x4')],'include':[{'model':'User','as':_0x3c4b('0x5'),'attributes':['id','name',_0x3c4b('0x6'),_0x3c4b('0x7')]}]},'log':_0x3c4b('0x8')});};}; \ No newline at end of file +var _0x13c2=['name','strategy','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x2d7fbe,_0x44b669){var _0x3a93ac=function(_0x101520){while(--_0x101520){_0x2d7fbe['push'](_0x2d7fbe['shift']());}};_0x3a93ac(++_0x44b669);}(_0x13c2,0x180));var _0x213c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13c2[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x213c('0x0'));exports[_0x213c('0x1')]=function(){return function(){return client['Request'](_0x213c('0x2'),{'options':{'raw':![],'attributes':['id',_0x213c('0x3'),'timeout',_0x213c('0x4')],'include':[{'model':_0x213c('0x5'),'as':_0x213c('0x6'),'attributes':['id',_0x213c('0x3'),_0x213c('0x7'),_0x213c('0x8')]}]},'log':_0x213c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index d9b2d81..27c67da 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 _0x3caa=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x3caa,0x112));var _0xa3ca=function(_0x169644,_0x15c0a0){_0x169644=_0x169644-0x0;var _0xa36241=_0x3caa[_0x169644];return _0xa36241;};'use strict';var client=require(_0xa3ca('0x0'));exports[_0xa3ca('0x1')]=function(_0x37a130){return client[_0xa3ca('0x2')](_0xa3ca('0x3'),{'body':_0x37a130,'log':'CreateMailQueueReport'});};exports[_0xa3ca('0x4')]=function(_0x148d27,_0x1d0c58){return client[_0xa3ca('0x2')](_0xa3ca('0x5'),{'body':_0x1d0c58,'options':{'where':{'uniqueid':_0x148d27},'order':[['id',_0xa3ca('0x6')]],'limit':0x1},'log':_0xa3ca('0x5')});}; \ No newline at end of file +var _0x6812=['../client','create','Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6812,0x165));var _0x2681=function(_0x76cb31,_0x5bf128){_0x76cb31=_0x76cb31-0x0;var _0x27cdd1=_0x6812[_0x76cb31];return _0x27cdd1;};'use strict';var client=require(_0x2681('0x0'));exports[_0x2681('0x1')]=function(_0x173d59){return client[_0x2681('0x2')](_0x2681('0x3'),{'body':_0x173d59,'log':_0x2681('0x3')});};exports[_0x2681('0x4')]=function(_0x27046c,_0x44784f){return client['Request']('UpdateMailQueueReport',{'body':_0x44784f,'options':{'where':{'uniqueid':_0x27046c},'order':[['id',_0x2681('0x5')]],'limit':0x1},'log':_0x2681('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 8a9ea52..192922c 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 _0x6a94=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x422749,_0x18f5ab){var _0x1a3d11=function(_0x34e1e1){while(--_0x34e1e1){_0x422749['push'](_0x422749['shift']());}};_0x1a3d11(++_0x18f5ab);}(_0x6a94,0x1e9));var _0x46a9=function(_0x28b0fc,_0x432bfe){_0x28b0fc=_0x28b0fc-0x0;var _0x2b23f4=_0x6a94[_0x28b0fc];return _0x2b23f4;};'use strict';var client=require('../client');exports[_0x46a9('0x0')]=function(_0x7eabd,_0x781b36){return client['Request'](_0x46a9('0x1'),{'body':_0x781b36,'options':{'where':{'id':_0x7eabd}},'log':_0x46a9('0x2')});};exports[_0x46a9('0x3')]=function(_0x47b364,_0x53f11d){return client[_0x46a9('0x4')](_0x46a9('0x5'),{'body':_0x53f11d,'options':{'where':{'id':_0x47b364}},'log':_0x46a9('0x6')});}; \ No newline at end of file +var _0x003b=['addTags','AddTagsToOpenchannelInteraction','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x5b7257,_0x3e79ac){var _0x32bc7a=function(_0x1c794d){while(--_0x1c794d){_0x5b7257['push'](_0x5b7257['shift']());}};_0x32bc7a(++_0x3e79ac);}(_0x003b,0x1dd));var _0xb003=function(_0x4e9007,_0x4d4a5a){_0x4e9007=_0x4e9007-0x0;var _0x1d3025=_0x003b[_0x4e9007];return _0x1d3025;};'use strict';var client=require('../client');exports['update']=function(_0x548638,_0x4bc82b){return client[_0xb003('0x0')](_0xb003('0x1'),{'body':_0x4bc82b,'options':{'where':{'id':_0x548638}},'log':_0xb003('0x2')});};exports[_0xb003('0x3')]=function(_0x2cef60,_0x1a28cc){return client[_0xb003('0x0')](_0xb003('0x4'),{'body':_0x1a28cc,'options':{'where':{'id':_0x2cef60}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 93abc6e..9c41d86 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 _0xfbe0=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x5f47bb,_0x3ea650){var _0x5da984=function(_0xc8dca3){while(--_0xc8dca3){_0x5f47bb['push'](_0x5f47bb['shift']());}};_0x5da984(++_0x3ea650);}(_0xfbe0,0xd1));var _0x0fbe=function(_0x16a7d7,_0x5bcd19){_0x16a7d7=_0x16a7d7-0x0;var _0xda03e3=_0xfbe0[_0x16a7d7];return _0xda03e3;};'use strict';var client=require(_0x0fbe('0x0'));exports[_0x0fbe('0x1')]=function(_0x14c268){return client[_0x0fbe('0x2')](_0x0fbe('0x3'),{'body':_0x14c268,'log':_0x0fbe('0x4')});}; \ No newline at end of file +var _0x4435=['createOpenchannelMessage','../client','create','CreateOpenchannelMessage'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x4435,0x16d));var _0x5443=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4435[_0x1694f5];return _0x5b4321;};'use strict';var client=require(_0x5443('0x0'));exports[_0x5443('0x1')]=function(_0x3cb06c){return client['Request'](_0x5443('0x2'),{'body':_0x3cb06c,'log':_0x5443('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 3fe1c7a..7c601e4 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 _0x86f5=['Agents','name','online','openchannelPause','../client','Request','GetOpenchannelQueue','timeout'];(function(_0x5434e8,_0x59a3be){var _0x32df09=function(_0x1afa96){while(--_0x1afa96){_0x5434e8['push'](_0x5434e8['shift']());}};_0x32df09(++_0x59a3be);}(_0x86f5,0x74));var _0x586f=function(_0x1df3e5,_0x2d37f1){_0x1df3e5=_0x1df3e5-0x0;var _0x422d0c=_0x86f5[_0x1df3e5];return _0x422d0c;};'use strict';var client=require(_0x586f('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x586f('0x1')](_0x586f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x586f('0x3'),'strategy'],'include':[{'model':'User','as':_0x586f('0x4'),'attributes':['id',_0x586f('0x5'),_0x586f('0x6'),_0x586f('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xe53c=['strategy','User','Agents','online','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout'];(function(_0x9489f0,_0x23eb38){var _0x845027=function(_0x57fbd2){while(--_0x57fbd2){_0x9489f0['push'](_0x9489f0['shift']());}};_0x845027(++_0x23eb38);}(_0xe53c,0x14c));var _0xce53=function(_0x5a9397,_0x2e444c){_0x5a9397=_0x5a9397-0x0;var _0x5b89be=_0xe53c[_0x5a9397];return _0x5b89be;};'use strict';var client=require('../client');exports[_0xce53('0x0')]=function(){return function(){return client[_0xce53('0x1')](_0xce53('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xce53('0x3'),_0xce53('0x4')],'include':[{'model':_0xce53('0x5'),'as':_0xce53('0x6'),'attributes':['id','name',_0xce53('0x7'),'openchannelPause']}]},'log':_0xce53('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 627cd2b..1e95758 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 _0xb40a=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x2bba02,_0x1c0443){var _0x310a95=function(_0x1bfb01){while(--_0x1bfb01){_0x2bba02['push'](_0x2bba02['shift']());}};_0x310a95(++_0x1c0443);}(_0xb40a,0x117));var _0xab40=function(_0x10763a,_0xb6da1b){_0x10763a=_0x10763a-0x0;var _0x4c2617=_0xb40a[_0x10763a];return _0x4c2617;};'use strict';var client=require(_0xab40('0x0'));exports[_0xab40('0x1')]=function(_0x29518e){return client[_0xab40('0x2')](_0xab40('0x3'),{'body':_0x29518e,'log':_0xab40('0x3')});};exports[_0xab40('0x4')]=function(_0xf3fc07,_0x38de04){return client[_0xab40('0x2')](_0xab40('0x5'),{'body':_0x38de04,'options':{'where':{'uniqueid':_0xf3fc07},'order':[['id',_0xab40('0x6')]],'limit':0x1},'log':_0xab40('0x5')});}; \ No newline at end of file +var _0x25c1=['UpdateOpenchannelQueueReport','../client','create','Request','update'];(function(_0x341b7d,_0x250911){var _0x4517a1=function(_0x3abc5c){while(--_0x3abc5c){_0x341b7d['push'](_0x341b7d['shift']());}};_0x4517a1(++_0x250911);}(_0x25c1,0x8d));var _0x125c=function(_0x3e5fb1,_0x137d57){_0x3e5fb1=_0x3e5fb1-0x0;var _0x13bd6a=_0x25c1[_0x3e5fb1];return _0x13bd6a;};'use strict';var client=require(_0x125c('0x0'));exports[_0x125c('0x1')]=function(_0x42c134){return client[_0x125c('0x2')]('CreateOpenchannelQueueReport',{'body':_0x42c134,'log':'CreateOpenchannelQueueReport'});};exports[_0x125c('0x3')]=function(_0x321c82,_0x116ad2){return client[_0x125c('0x2')](_0x125c('0x4'),{'body':_0x116ad2,'options':{'where':{'uniqueid':_0x321c82},'order':[['id','DESC']],'limit':0x1},'log':_0x125c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bdbb4d0..c79eff3 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 _0xfd7b=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x23171d,_0x5ce28f){var _0x2cf63b=function(_0x447b51){while(--_0x447b51){_0x23171d['push'](_0x23171d['shift']());}};_0x2cf63b(++_0x5ce28f);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfd7b[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require('../client');exports[_0xbfd7('0x0')]=function(_0x381d71,_0x3138e8){return client[_0xbfd7('0x1')](_0xbfd7('0x2'),{'body':_0x3138e8,'options':{'where':{'id':_0x381d71}},'log':_0xbfd7('0x3')});};exports[_0xbfd7('0x4')]=function(_0x221ad1,_0x249e59){return client[_0xbfd7('0x1')](_0xbfd7('0x5'),{'body':_0x249e59,'options':{'where':{'id':_0x221ad1}},'log':_0xbfd7('0x6')});}; \ No newline at end of file +var _0xf483=['addTags','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x353ab6,_0x2d9b5a){var _0x2991aa=function(_0x3b53c1){while(--_0x3b53c1){_0x353ab6['push'](_0x353ab6['shift']());}};_0x2991aa(++_0x2d9b5a);}(_0xf483,0xf2));var _0x3f48=function(_0x536a34,_0x2f63ee){_0x536a34=_0x536a34-0x0;var _0x48aaf6=_0xf483[_0x536a34];return _0x48aaf6;};'use strict';var client=require('../client');exports[_0x3f48('0x0')]=function(_0x4fa0f8,_0x37d0f3){return client[_0x3f48('0x1')](_0x3f48('0x2'),{'body':_0x37d0f3,'options':{'where':{'id':_0x4fa0f8}},'log':_0x3f48('0x3')});};exports[_0x3f48('0x4')]=function(_0x312d9c,_0x5deb61){return client['Request']('AddTagsToSmsInteraction',{'body':_0x5deb61,'options':{'where':{'id':_0x312d9c}},'log':_0x3f48('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 450d834..4e13fb7 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 _0xf731=['CreateSmsMessage','../client','create'];(function(_0x3b91ad,_0x4feee7){var _0x36f0cc=function(_0x59dbc4){while(--_0x59dbc4){_0x3b91ad['push'](_0x3b91ad['shift']());}};_0x36f0cc(++_0x4feee7);}(_0xf731,0x1b1));var _0x1f73=function(_0x1182e1,_0x10535e){_0x1182e1=_0x1182e1-0x0;var _0x13e4c1=_0xf731[_0x1182e1];return _0x13e4c1;};'use strict';var client=require(_0x1f73('0x0'));exports[_0x1f73('0x1')]=function(_0x1c458d){return client['Request'](_0x1f73('0x2'),{'body':_0x1c458d,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x3d3e=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x28c6cf,_0x31f179){var _0x2c72e4=function(_0xee20e){while(--_0xee20e){_0x28c6cf['push'](_0x28c6cf['shift']());}};_0x2c72e4(++_0x31f179);}(_0x3d3e,0x18a));var _0xe3d3=function(_0x4e0d7c,_0x8129fd){_0x4e0d7c=_0x4e0d7c-0x0;var _0x1a2f6d=_0x3d3e[_0x4e0d7c];return _0x1a2f6d;};'use strict';var client=require(_0xe3d3('0x0'));exports[_0xe3d3('0x1')]=function(_0x160c6d){return client[_0xe3d3('0x2')](_0xe3d3('0x3'),{'body':_0x160c6d,'log':_0xe3d3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 973d0da..c15f716 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x3714d4,_0x303533){var _0x47fad9=function(_0x575403){while(--_0x575403){_0x3714d4['push'](_0x3714d4['shift']());}};_0x47fad9(++_0x303533);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7481473..f8443c1 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x164df2,_0x4083ee){var _0x4abfa1=function(_0x226c9b){while(--_0x226c9b){_0x164df2['push'](_0x164df2['shift']());}};_0x4abfa1(++_0x4083ee);}(_0x008c,0x188));var _0xc008=function(_0x53b398,_0x39bfd8){_0x53b398=_0x53b398-0x0;var _0x32c9ed=_0x008c[_0x53b398];return _0x32c9ed;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x3b37e0,_0x542705){var _0x1cb6b6=function(_0x4bc3bd){while(--_0x4bc3bd){_0x3b37e0['push'](_0x3b37e0['shift']());}};_0x1cb6b6(++_0x542705);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index f34b543..585ec28 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(_0x1d062b,_0x851ac3){var _0x3b487b=function(_0x2dae2c){while(--_0x2dae2c){_0x1d062b['push'](_0x1d062b['shift']());}};_0x3b487b(++_0x851ac3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x541765,_0xfb2d04){var _0x33372c=function(_0x10a197){while(--_0x10a197){_0x541765['push'](_0x541765['shift']());}};_0x33372c(++_0xfb2d04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 4ba13a2..57798ab 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 _0x8921=['../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x3b77e7,_0xf3b904){var _0x44615b=function(_0x4f933f){while(--_0x4f933f){_0x3b77e7['push'](_0x3b77e7['shift']());}};_0x44615b(++_0xf3b904);}(_0x8921,0x9a));var _0x1892=function(_0x4e679b,_0xa34259){_0x4e679b=_0x4e679b-0x0;var _0x119de3=_0x8921[_0x4e679b];return _0x119de3;};'use strict';var client=require(_0x1892('0x0'));exports['update']=function(_0x2fa8a8,_0x37e629){return client[_0x1892('0x1')](_0x1892('0x2'),{'body':_0x37e629,'options':{'where':{'id':_0x2fa8a8}},'log':_0x1892('0x3')});};exports[_0x1892('0x4')]=function(_0x28a89b,_0x15aa1b){return client[_0x1892('0x1')](_0x1892('0x5'),{'body':_0x15aa1b,'options':{'where':{'id':_0x28a89b}},'log':_0x1892('0x6')});}; \ No newline at end of file +var _0x49fe=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x4cef8e,_0x1d06e2){var _0x28fc91=function(_0x4159ec){while(--_0x4159ec){_0x4cef8e['push'](_0x4cef8e['shift']());}};_0x28fc91(++_0x1d06e2);}(_0x49fe,0x75));var _0xe49f=function(_0x11ac83,_0x10a2c5){_0x11ac83=_0x11ac83-0x0;var _0x1911e1=_0x49fe[_0x11ac83];return _0x1911e1;};'use strict';var client=require(_0xe49f('0x0'));exports['update']=function(_0x540832,_0x556c1d){return client[_0xe49f('0x1')](_0xe49f('0x2'),{'body':_0x556c1d,'options':{'where':{'id':_0x540832}},'log':_0xe49f('0x3')});};exports[_0xe49f('0x4')]=function(_0x1cac40,_0x2db0ec){return client[_0xe49f('0x1')](_0xe49f('0x5'),{'body':_0x2db0ec,'options':{'where':{'id':_0x1cac40}},'log':_0xe49f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2322e72..6a580ce 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 _0x02cd=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02cd,0x93));var _0xd02c=function(_0x34d533,_0x161449){_0x34d533=_0x34d533-0x0;var _0x4731f5=_0x02cd[_0x34d533];return _0x4731f5;};'use strict';var client=require('../client');exports[_0xd02c('0x0')]=function(_0xf274d7){return client[_0xd02c('0x1')](_0xd02c('0x2'),{'body':_0xf274d7,'log':_0xd02c('0x3')});}; \ No newline at end of file +var _0x81ae=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x2a8001,_0x4f309e){var _0x3388bf=function(_0x57d2c2){while(--_0x57d2c2){_0x2a8001['push'](_0x2a8001['shift']());}};_0x3388bf(++_0x4f309e);}(_0x81ae,0x1dd));var _0xe81a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x81ae[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xe81a('0x0'));exports['create']=function(_0x220e22){return client['Request'](_0xe81a('0x1'),{'body':_0x220e22,'log':_0xe81a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 51201dd..31e8d2a 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 _0xb46d=['whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xb46d,0xb5));var _0xdb46=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0xb46d[_0x509273];return _0x38ef40;};'use strict';var client=require(_0xdb46('0x0'));exports[_0xdb46('0x1')]=function(){return function(){return client[_0xdb46('0x2')](_0xdb46('0x3'),{'options':{'raw':![],'attributes':['id',_0xdb46('0x4'),_0xdb46('0x5'),_0xdb46('0x6')],'include':[{'model':_0xdb46('0x7'),'as':'Agents','attributes':['id',_0xdb46('0x4'),'online',_0xdb46('0x8')]}]},'log':_0xdb46('0x1')});};}; \ No newline at end of file +var _0x693d=['strategy','Agents','online','../client','getWhatsappQueues','Request','name','timeout'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x693d,0xbb));var _0xd693=function(_0x585bae,_0x2fb782){_0x585bae=_0x585bae-0x0;var _0x1d45bf=_0x693d[_0x585bae];return _0x1d45bf;};'use strict';var client=require(_0xd693('0x0'));exports[_0xd693('0x1')]=function(){return function(){return client[_0xd693('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xd693('0x3'),_0xd693('0x4'),_0xd693('0x5')],'include':[{'model':'User','as':_0xd693('0x6'),'attributes':['id',_0xd693('0x3'),_0xd693('0x7'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 827a468..44c21a8 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 _0x1633=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1633,0x6b));var _0x3163=function(_0x4a5888,_0x5c3fde){_0x4a5888=_0x4a5888-0x0;var _0x117a90=_0x1633[_0x4a5888];return _0x117a90;};'use strict';var client=require(_0x3163('0x0'));exports[_0x3163('0x1')]=function(_0x11caef){return client[_0x3163('0x2')](_0x3163('0x3'),{'body':_0x11caef,'log':'CreateWhatsappQueueReport'});};exports[_0x3163('0x4')]=function(_0x187ac0,_0xc22c9e){return client['Request'](_0x3163('0x5'),{'body':_0xc22c9e,'options':{'where':{'uniqueid':_0x187ac0},'order':[['id',_0x3163('0x6')]],'limit':0x1},'log':_0x3163('0x5')});}; \ No newline at end of file +var _0x440b=['update','Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport'];(function(_0x37ac04,_0x599c7c){var _0x35f374=function(_0xb63ae5){while(--_0xb63ae5){_0x37ac04['push'](_0x37ac04['shift']());}};_0x35f374(++_0x599c7c);}(_0x440b,0xdd));var _0xb440=function(_0x564eec,_0x2174aa){_0x564eec=_0x564eec-0x0;var _0xb25d75=_0x440b[_0x564eec];return _0xb25d75;};'use strict';var client=require(_0xb440('0x0'));exports[_0xb440('0x1')]=function(_0x105eaa){return client['Request'](_0xb440('0x2'),{'body':_0x105eaa,'log':'CreateWhatsappQueueReport'});};exports[_0xb440('0x3')]=function(_0x3ddcc4,_0x8870b7){return client[_0xb440('0x4')](_0xb440('0x5'),{'body':_0x8870b7,'options':{'where':{'uniqueid':_0x3ddcc4},'order':[['id',_0xb440('0x6')]],'limit':0x1},'log':_0xb440('0x5')});}; \ 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 8ac0e59..cc99400 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 _0xf008=['seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][QUEUE]\x20%s','stack','validate','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf008,0x152));var _0x8f00=function(_0xa11493,_0x4683cc){_0xa11493=_0xa11493-0x0;var _0x4f46d9=_0xf008[_0xa11493];return _0x4f46d9;};'use strict';var schema=require(_0x8f00('0x0'));var _=require('lodash');var util=require(_0x8f00('0x1'));var seqqueue=require(_0x8f00('0x2'));var logger=require('../../../../config/logger')(_0x8f00('0x3'));var strategy=require(_0x8f00('0x4'));var queue=schema({'name':{'type':_0x8f00('0x5'),'required':!![],'message':_0x8f00('0x6')},'timeout':{'type':_0x8f00('0x7'),'message':_0x8f00('0x8')}});function writeLog(_0xc52384,_0x20a401,_0x118b45){return logger[_0x8f00('0x9')](util['format'](_0x8f00('0xa'),_0xc52384,_0x20a401[_0x8f00('0xb')],_0x118b45));}function handleFindAgent(_0x156fc5){return function(_0x25e986){return _0x25e986['name'][_0x8f00('0xc')]()===_0x156fc5['toLowerCase']();};}exports[_0x8f00('0xd')]=function(_0x2088ec,_0x28307c,_0x29b362,_0x5627a3){return function(_0x3c124f){try{var _0x178978={'name':_0x28307c[0x0],'timeout':_0x28307c[0x1]};var _0x44e6f9=queue[_0x8f00('0x0')](_0x178978,{'typecast':!![]});if(_0x44e6f9['length']){logger['error'](_0x8f00('0xe'),_0x2088ec,_[_0x8f00('0xf')](_0x44e6f9,_0x8f00('0x10'))[_0x8f00('0x11')](',\x20'));_0x3c124f[_0x8f00('0x12')]();}else{var _0x44bfcd=_['find'](_0x29b362[_0x8f00('0x13')],handleFindAgent(_0x178978[_0x8f00('0xb')]));if(_0x44bfcd){var _0x15be9c=(_0x178978[_0x8f00('0x14')]||0xa)*0x3e8;var _0x69364f,_0x55412a;var _0x5ddd4c=seqqueue[_0x8f00('0x15')](_0x15be9c);_0x5ddd4c['id']=_0x2088ec;_0x5ddd4c['atimeout']=_0x15be9c;_0x5ddd4c[_0x8f00('0x16')]=_0x5627a3['channel'];writeLog(_0x2088ec,_0x44bfcd,util['format'](_0x8f00('0x17'),_0x15be9c));_0x29b362['rules'][_0x2088ec]['on'](_0x8f00('0x18'),function(){logger[_0x8f00('0x9')](_0x8f00('0x19'),_0x2088ec);clearTimeout(_0x55412a);_0x55412a=undefined;_0x5ddd4c[_0x8f00('0x1a')]();if(_0x29b362[_0x8f00('0x1b')][_0x2088ec]){delete _0x29b362[_0x8f00('0x1b')][_0x2088ec];}_0x3c124f[_0x8f00('0x12')]();});_0x29b362[_0x8f00('0x1b')][_0x2088ec]['on'](_0x8f00('0x1c'),function(){if(_0x29b362[_0x8f00('0x1b')][_0x2088ec]){delete _0x29b362['rules'][_0x2088ec];}});_0x55412a=setTimeout(function(){logger[_0x8f00('0x9')](_0x8f00('0x1d'),_0x2088ec);clearTimeout(_0x55412a);_0x5ddd4c[_0x8f00('0x1a')]();_0x3c124f['next']();},_0x15be9c);strategy[_0x8f00('0x1e')](_0x5ddd4c,_0x44bfcd,_0x29b362,_0x5627a3);}else{logger[_0x8f00('0x1f')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x2088ec,_0x178978[_0x8f00('0xb')]);_0x3c124f[_0x8f00('0x12')]();}}}catch(_0x173b41){console['log'](_0x173b41);logger[_0x8f00('0x1f')](_0x8f00('0x20'),_0x2088ec,_0x173b41[_0x8f00('0x21')]);_0x3c124f[_0x8f00('0x12')]();}};}; \ No newline at end of file +var _0xc153=['info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','validate','length','error','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','name','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc153,0x191));var _0x3c15=function(_0xc0ca57,_0x2b8778){_0xc0ca57=_0xc0ca57-0x0;var _0x3954b0=_0xc153[_0xc0ca57];return _0x3954b0;};'use strict';var schema=require('validate');var _=require(_0x3c15('0x0'));var util=require(_0x3c15('0x1'));var seqqueue=require(_0x3c15('0x2'));var logger=require(_0x3c15('0x3'))(_0x3c15('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x3c15('0x5')},'timeout':{'type':_0x3c15('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x349438,_0x27ae0f,_0x42a714){return logger[_0x3c15('0x7')](util[_0x3c15('0x8')](_0x3c15('0x9'),_0x349438,_0x27ae0f['name'],_0x42a714));}function handleFindAgent(_0x2285ab){return function(_0x41a24e){return _0x41a24e['name'][_0x3c15('0xa')]()===_0x2285ab['toLowerCase']();};}exports[_0x3c15('0xb')]=function(_0x266840,_0x37d8de,_0xb7bdcd,_0x457f51){return function(_0x27f8b1){try{var _0x2e5d01={'name':_0x37d8de[0x0],'timeout':_0x37d8de[0x1]};var _0x17323d=queue[_0x3c15('0xc')](_0x2e5d01,{'typecast':!![]});if(_0x17323d[_0x3c15('0xd')]){logger[_0x3c15('0xe')]('[%s][AGENT]\x20%s',_0x266840,_[_0x3c15('0xf')](_0x17323d,_0x3c15('0x10'))[_0x3c15('0x11')](',\x20'));_0x27f8b1[_0x3c15('0x12')]();}else{var _0x5b981b=_[_0x3c15('0x13')](_0xb7bdcd[_0x3c15('0x14')],handleFindAgent(_0x2e5d01['name']));if(_0x5b981b){var _0x2164df=(_0x2e5d01[_0x3c15('0x15')]||0xa)*0x3e8;var _0x1900b5,_0xdd88f4;var _0x2208ad=seqqueue[_0x3c15('0x16')](_0x2164df);_0x2208ad['id']=_0x266840;_0x2208ad[_0x3c15('0x17')]=_0x2164df;_0x2208ad['channel']=_0x457f51[_0x3c15('0x18')];writeLog(_0x266840,_0x5b981b,util[_0x3c15('0x8')]('START:%s',_0x2164df));_0xb7bdcd[_0x3c15('0x19')][_0x266840]['on'](_0x3c15('0x1a'),function(){logger['info'](_0x3c15('0x1b'),_0x266840);clearTimeout(_0xdd88f4);_0xdd88f4=undefined;_0x2208ad['close']();if(_0xb7bdcd[_0x3c15('0x19')][_0x266840]){delete _0xb7bdcd[_0x3c15('0x19')][_0x266840];}_0x27f8b1['stop']();});_0xb7bdcd[_0x3c15('0x19')][_0x266840]['on']('complete',function(){if(_0xb7bdcd[_0x3c15('0x19')][_0x266840]){delete _0xb7bdcd[_0x3c15('0x19')][_0x266840];}});_0xdd88f4=setTimeout(function(){logger[_0x3c15('0x7')](_0x3c15('0x1c'),_0x266840);clearTimeout(_0xdd88f4);_0x2208ad['close']();_0x27f8b1[_0x3c15('0x1d')]();},_0x2164df);strategy['agent'](_0x2208ad,_0x5b981b,_0xb7bdcd,_0x457f51);}else{logger[_0x3c15('0xe')](_0x3c15('0x1e'),_0x266840,_0x2e5d01[_0x3c15('0x1f')]);_0x27f8b1[_0x3c15('0x12')]();}}}catch(_0x59dc94){console['log'](_0x59dc94);logger[_0x3c15('0xe')](_0x3c15('0x20'),_0x266840,_0x59dc94[_0x3c15('0x21')]);_0x27f8b1[_0x3c15('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 231049a..b4db928 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 _0x2802=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','AccountId','upperFirst','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','providerResponse','stringify','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0xce3a0b,_0x5b271b){var _0x1ca1b9=function(_0x1acd40){while(--_0x1acd40){_0xce3a0b['push'](_0xce3a0b['shift']());}};_0x1ca1b9(++_0x5b271b);}(_0x2802,0x1aa));var _0x2280=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x2802[_0x55fa03];return _0x2cd7cd;};'use strict';var _=require(_0x2280('0x0'));var moment=require(_0x2280('0x1'));var AWS=require('aws-sdk');var utils=require(_0x2280('0x2'));var logger=require(_0x2280('0x3'))(_0x2280('0x4'));var rpc={'chatMessage':require(_0x2280('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2280('0x6')),'whatsappMessage':require(_0x2280('0x7'))};exports[_0x2280('0x8')]=function(_0xeedcb0,_0x5a990e){return function(_0x5f0355){try{if(!_['isNil'](this['interaction'][_0x2280('0x9')])){logger['info'](_0x2280('0xa'),_0xeedcb0,_0x2280('0xb'));return _0x5f0355[_0x2280('0xc')]();}var _0x42a9f5={'ContactId':this[_0x2280('0xd')]['id'],'sentAt':moment()[_0x2280('0xe')](_0x2280('0xf')),'direction':_0x2280('0x10')};if(this[_0x2280('0x11')]==='sms'||this[_0x2280('0x11')]===_0x2280('0x12')){_0x42a9f5[_0x2280('0x13')]=this['interaction'][_0x2280('0x13')];}var _0x51c125=this['channel'];if(_0x51c125===_0x2280('0x14')){_0x42a9f5['ChatWebsiteId']=this[_0x2280('0x15')]['id'];}else{_0x42a9f5[_['upperFirst'](_0x51c125)+_0x2280('0x16')]=this[_0x2280('0x15')]['id'];}_0x42a9f5[_[_0x2280('0x17')](_0x51c125)+_0x2280('0x18')]=this[_0x2280('0x19')]['id'];if(this[_0x2280('0x19')][_0x2280('0x1a')]){var _0x54e2b4=_0x5a990e[0x4];if(!_[_0x2280('0x1b')](_0x54e2b4)){_0x42a9f5[_0x2280('0x1c')]=utils[_0x2280('0x1d')](_0x54e2b4,this);return rpc[_0x51c125+_0x2280('0x1e')][_0x2280('0x1f')](_0x42a9f5)[_0x2280('0x20')](function(_0x1c88eb){logger[_0x2280('0x21')](_0x2280('0xa'),_0xeedcb0,_0x42a9f5[_0x2280('0x1c')]);})[_0x2280('0x22')](function(_0x4edd05){logger[_0x2280('0x23')](_0x2280('0xa'),_0xeedcb0,JSON['stringify'](_0x4edd05));})['finally'](function(){logger[_0x2280('0x21')](_0x2280('0x24'),_0xeedcb0);_0x5f0355[_0x2280('0x25')]();});}else{logger[_0x2280('0x21')](_0x2280('0x26'),_0xeedcb0);_0x5f0355[_0x2280('0x25')]();}}else{var _0x33a78c=this;var _0x54b13a=new AWS['LexRuntime']({'accessKeyId':_0x5a990e[0x0],'secretAccessKey':_0x5a990e[0x1],'region':_0x5a990e[0x2]});var _0x5afaf4={'botAlias':_0x2280('0x27'),'botName':_0x5a990e[0x3],'inputText':this[_0x2280('0x28')][_0x2280('0x1c')],'userId':this[_0x2280('0x11')]+':'+this[_0x2280('0x19')]['id'][_0x2280('0x29')]()};_0x54b13a[_0x2280('0x2a')](_0x5afaf4,function(_0x1559ca,_0x1af1bb){if(_0x1559ca){logger['error']('[%s][AMAZONLEX]\x20%s',_0xeedcb0,_0x1559ca[_0x2280('0x28')]);_0x5f0355[_0x2280('0xc')]();}else if(_0x1af1bb&&_0x1af1bb[_0x2280('0x28')]){_0x33a78c[_0x2280('0x1c')][_0x2280('0x2b')]=_0x1af1bb;_0x42a9f5[_0x2280('0x1c')]=_0x1af1bb[_0x2280('0x28')];_0x42a9f5['providerName']=_0x2280('0x2b');_0x42a9f5[_0x2280('0x2c')]=JSON[_0x2280('0x2d')](_0x1af1bb);return rpc[_0x51c125+_0x2280('0x1e')]['create'](_0x42a9f5)[_0x2280('0x20')](function(_0x5e3981){logger[_0x2280('0x21')](_0x2280('0xa'),_0xeedcb0,_0x42a9f5[_0x2280('0x1c')]);if(_0x1af1bb[_0x2280('0x2e')]==_0x2280('0x2f')){_0x5f0355[_0x2280('0xc')]();}else{_0x5f0355['stop']();}})[_0x2280('0x22')](function(_0x53d452){logger['error']('[%s][AMAZONLEX]\x20%s',_0xeedcb0,JSON['stringify'](_0x53d452));_0x5f0355[_0x2280('0xc')]();});}else{_0x5f0355[_0x2280('0xc')]();}});}}catch(_0x4f08eb){logger['error'](_0x2280('0xa'),_0xeedcb0,JSON['stringify'](_0x4f08eb));_0x5f0355['stop']();}};}; \ No newline at end of file +var _0x62af=['[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','toString','message','next','amazonlex','providerName','stringify','dialogState','Failed','catch','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x62af,0x1c5));var _0xf62a=function(_0xa75db,_0x97eeb8){_0xa75db=_0xa75db-0x0;var _0x988497=_0x62af[_0xa75db];return _0x988497;};'use strict';var _=require(_0xf62a('0x0'));var moment=require(_0xf62a('0x1'));var AWS=require(_0xf62a('0x2'));var utils=require('./utils');var logger=require(_0xf62a('0x3'))(_0xf62a('0x4'));var rpc={'chatMessage':require(_0xf62a('0x5')),'openchannelMessage':require(_0xf62a('0x6')),'mailMessage':require(_0xf62a('0x7')),'smsMessage':require(_0xf62a('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf62a('0x9'))};exports[_0xf62a('0xa')]=function(_0x5edc1e,_0x491d6b){return function(_0x4efd){try{if(!_[_0xf62a('0xb')](this[_0xf62a('0xc')][_0xf62a('0xd')])){logger[_0xf62a('0xe')](_0xf62a('0xf'),_0x5edc1e,_0xf62a('0x10'));return _0x4efd['next']();}var _0x5eb8d4={'ContactId':this[_0xf62a('0x11')]['id'],'sentAt':moment()[_0xf62a('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf62a('0x13')};if(this['channel']===_0xf62a('0x14')||this['channel']===_0xf62a('0x15')){_0x5eb8d4['phone']=this[_0xf62a('0xc')][_0xf62a('0x16')];}var _0x44a05=this[_0xf62a('0x17')];if(_0x44a05===_0xf62a('0x18')){_0x5eb8d4[_0xf62a('0x19')]=this['account']['id'];}else{_0x5eb8d4[_[_0xf62a('0x1a')](_0x44a05)+_0xf62a('0x1b')]=this[_0xf62a('0x1c')]['id'];}_0x5eb8d4[_[_0xf62a('0x1a')](_0x44a05)+_0xf62a('0x1d')]=this['interaction']['id'];if(this[_0xf62a('0xc')][_0xf62a('0x1e')]){var _0x5a1d64=_0x491d6b[0x4];if(!_[_0xf62a('0x1f')](_0x5a1d64)){_0x5eb8d4[_0xf62a('0x20')]=utils[_0xf62a('0x21')](_0x5a1d64,this);return rpc[_0x44a05+_0xf62a('0x22')][_0xf62a('0x23')](_0x5eb8d4)['then'](function(_0x540ee8){logger[_0xf62a('0xe')](_0xf62a('0xf'),_0x5edc1e,_0x5eb8d4[_0xf62a('0x20')]);})['catch'](function(_0x5ecfea){logger[_0xf62a('0x24')](_0xf62a('0xf'),_0x5edc1e,JSON['stringify'](_0x5ecfea));})[_0xf62a('0x25')](function(){logger[_0xf62a('0xe')](_0xf62a('0x26'),_0x5edc1e);_0x4efd['stop']();});}else{logger[_0xf62a('0xe')](_0xf62a('0x27'),_0x5edc1e);_0x4efd[_0xf62a('0x28')]();}}else{var _0x6603ca=this;var _0x5226e6=new AWS[(_0xf62a('0x29'))]({'accessKeyId':_0x491d6b[0x0],'secretAccessKey':_0x491d6b[0x1],'region':_0x491d6b[0x2]});var _0x9abf05={'botAlias':_0xf62a('0x2a'),'botName':_0x491d6b[0x3],'inputText':this['message'][_0xf62a('0x20')],'userId':this[_0xf62a('0x17')]+':'+this[_0xf62a('0xc')]['id'][_0xf62a('0x2b')]()};_0x5226e6['postText'](_0x9abf05,function(_0x365a03,_0x3aabee){if(_0x365a03){logger[_0xf62a('0x24')](_0xf62a('0xf'),_0x5edc1e,_0x365a03[_0xf62a('0x2c')]);_0x4efd[_0xf62a('0x2d')]();}else if(_0x3aabee&&_0x3aabee[_0xf62a('0x2c')]){_0x6603ca[_0xf62a('0x20')][_0xf62a('0x2e')]=_0x3aabee;_0x5eb8d4[_0xf62a('0x20')]=_0x3aabee[_0xf62a('0x2c')];_0x5eb8d4[_0xf62a('0x2f')]=_0xf62a('0x2e');_0x5eb8d4['providerResponse']=JSON[_0xf62a('0x30')](_0x3aabee);return rpc[_0x44a05+_0xf62a('0x22')][_0xf62a('0x23')](_0x5eb8d4)['then'](function(_0x12a031){logger[_0xf62a('0xe')](_0xf62a('0xf'),_0x5edc1e,_0x5eb8d4[_0xf62a('0x20')]);if(_0x3aabee[_0xf62a('0x31')]==_0xf62a('0x32')){_0x4efd['next']();}else{_0x4efd['stop']();}})[_0xf62a('0x33')](function(_0x1816a7){logger[_0xf62a('0x24')](_0xf62a('0xf'),_0x5edc1e,JSON[_0xf62a('0x30')](_0x1816a7));_0x4efd[_0xf62a('0x2d')]();});}else{_0x4efd['next']();}});}}catch(_0x537ba9){logger[_0xf62a('0x24')](_0xf62a('0xf'),_0x5edc1e,JSON[_0xf62a('0x30')](_0x537ba9));_0x4efd[_0xf62a('0x28')]();}};}; \ 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 55802ab..2be676b 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 _0x026a=['pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','then','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','auth','user'];(function(_0x26c19d,_0x3f7b9b){var _0x37d676=function(_0x4d091e){while(--_0x4d091e){_0x26c19d['push'](_0x26c19d['shift']());}};_0x37d676(++_0x3f7b9b);}(_0x026a,0x14f));var _0xa026=function(_0x13b07a,_0x49cfc3){_0x13b07a=_0x13b07a-0x0;var _0xdcbe0=_0x026a[_0x13b07a];return _0xdcbe0;};'use strict';var _=require(_0xa026('0x0'));var moment=require(_0xa026('0x1'));var utils=require(_0xa026('0x2'));var logger=require(_0xa026('0x3'))(_0xa026('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa026('0x5')),'smsMessage':require(_0xa026('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa026('0x7')),'chatInteraction':require(_0xa026('0x8')),'openchannelInteraction':require(_0xa026('0x9')),'mailInteraction':require(_0xa026('0xa')),'smsInteraction':require(_0xa026('0xb')),'faxInteraction':require(_0xa026('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xa026('0xd'));exports[_0xa026('0xe')]=function(_0x462d82,_0x4a29c8,_0x43f5b1,_0x4ed04e){return function(_0x373c13){try{var _0xf23448=this[_0xa026('0xf')];if(_0xf23448===_0xa026('0x10')&&_0x4ed04e[_0xa026('0x11')][_0xa026('0x12')]){logger[_0xa026('0x13')](_0xa026('0x14'),_0x462d82,_0xa026('0x15'));return _0x373c13[_0xa026('0x16')]();}if(_0x4a29c8[0x0]==='1'&&(_[_0xa026('0x17')](this[_0xa026('0x18')]['created'])||!this[_0xa026('0x18')][_0xa026('0x19')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x462d82,_0xa026('0x1a'));return _0x373c13[_0xa026('0x16')]();}if(_0x4a29c8[0x0]==='2'&&this[_0xa026('0x18')][_0xa026('0x1b')]){logger[_0xa026('0x13')](_0xa026('0x1c'),_0x462d82,_0xa026('0x1d'));return _0x373c13[_0xa026('0x16')]();}var _0x324c21={'ContactId':this[_0xa026('0x1e')]['id'],'sentAt':moment()[_0xa026('0x1f')](_0xa026('0x20')),'direction':_0xa026('0x21')};if(this[_0xa026('0xf')]===_0xa026('0x10')){_0x324c21[_0xa026('0x11')]=utils[_0xa026('0x22')](_0x4a29c8[0x2],this);}else{_0x324c21[_0xa026('0x11')]=utils['getMustacheRender'](_0x4a29c8[0x1],this);}if(this[_0xa026('0x23')]){_0x324c21['to']=this[_0xa026('0x23')][_0xa026('0x24')]||'';if(this['channel']===_0xa026('0x10')&&_0x4a29c8[0x1]==='1'){_0x324c21['cc']=this[_0xa026('0x23')]['cc']||'';}_0x324c21['from']=this['message']['to']||'';_0x324c21[_0xa026('0x25')]=this['message']['phone']||'';_0x324c21['read']=!![];if(this[_0xa026('0x23')][_0xa026('0x26')]){_0x324c21[_0xa026('0x26')]='';_0x324c21['subject']+=_[_0xa026('0x27')](this[_0xa026('0x23')][_0xa026('0x26')],_0xa026('0x28'))?'':_0xa026('0x29');_0x324c21[_0xa026('0x26')]+=this[_0xa026('0x23')][_0xa026('0x26')];}}if(this[_0xa026('0xf')]===_0xa026('0x2a')){_0x324c21['ChatWebsiteId']=this[_0xa026('0x2b')]['id'];}else{_0x324c21[_[_0xa026('0x2c')](this[_0xa026('0xf')])+_0xa026('0x2d')]=this[_0xa026('0x2b')]['id'];}_0x324c21[_[_0xa026('0x2c')](this[_0xa026('0xf')])+_0xa026('0x2e')]=this[_0xa026('0x18')]['id'];var _0x34c99d=this[_0xa026('0x18')];if(rpc[this['channel']+_0xa026('0x2f')]){if(this[_0xa026('0xf')]===_0xa026('0x10')){var _0x344c29={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xa026('0x30')][_0xa026('0x31')]){_0x344c29[_0xa026('0x31')]=this[_0xa026('0x2b')][_0xa026('0x30')]['service'];}else{_0x344c29[_0xa026('0x32')]=this[_0xa026('0x2b')][_0xa026('0x30')]['host'];_0x344c29['port']=this['account'][_0xa026('0x30')][_0xa026('0x33')];_0x344c29['secure']=this['account'][_0xa026('0x30')][_0xa026('0x34')];}if(this[_0xa026('0x2b')][_0xa026('0x30')]['authentication']){_0x344c29[_0xa026('0x35')]={'user':this[_0xa026('0x2b')][_0xa026('0x30')][_0xa026('0x36')],'pass':this['account'][_0xa026('0x30')][_0xa026('0x37')]};}_0x324c21[_0xa026('0x38')]=this['message'][_0xa026('0x39')];_0x324c21[_0xa026('0x3a')]=_0xa026('0x3b')+_[_0xa026('0x3c')](_0x324c21[_0xa026('0x11')],_0xa026('0x3d'),_0xa026('0x3e'))+_0xa026('0x3f');_0x324c21[_0xa026('0x40')]={'Auto-Submitted':_0xa026('0x41'),'X-Auto-Response-Suppress':_0xa026('0x42'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x344c29,_0x324c21)[_0xa026('0x43')](function(_0x1f1ac4){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x462d82);_0x324c21[_0xa026('0x39')]=_0x1f1ac4[_0xa026('0x23')][_0xa026('0x39')];return rpc[_0xf23448+_0xa026('0x2f')][_0xa026('0x44')](_0x324c21);})[_0xa026('0x43')](function(_0x537948){logger['info'](_0xa026('0x14'),_0x462d82,JSON[_0xa026('0x45')](_0x537948));})['catch'](function(_0x1d9289){logger[_0xa026('0x46')](_0xa026('0x47'),_0x462d82,JSON[_0xa026('0x45')](_0x1d9289));})[_0xa026('0x48')](function(){Promise[_0xa026('0x49')]()[_0xa026('0x43')](function(){if(_0x4a29c8[0x0]!=='2'||_0x34c99d[_0xa026('0x1b')])return;return rpc[_0xf23448+_0xa026('0x4a')]['update'](_0x34c99d['id'],{'autoreplyExecuted':!![]})[_0xa026('0x43')](function(_0x29f224){logger['info'](_0xa026('0x1c'),_0x462d82,JSON[_0xa026('0x45')](_0x29f224));})['catch'](function(_0x17098f){logger[_0xa026('0x46')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x462d82,JSON[_0xa026('0x45')](_0x17098f));});})[_0xa026('0x43')](function(){_0x373c13[_0xa026('0x16')]();});});}else{return rpc[this[_0xa026('0xf')]+'Message'][_0xa026('0x44')](_0x324c21)[_0xa026('0x43')](function(_0x290c1e){logger[_0xa026('0x13')](_0xa026('0x14'),_0x462d82,_0x324c21['body']);})['catch'](function(_0xdf4181){logger[_0xa026('0x46')](_0xa026('0x14'),_0x462d82,JSON[_0xa026('0x45')](_0xdf4181));})[_0xa026('0x48')](function(){Promise['resolve']()['then'](function(){if(_0x4a29c8[0x0]!=='2'||_0x34c99d[_0xa026('0x1b')])return;return rpc[_0xf23448+'Interaction']['update'](_0x34c99d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4200d3){logger[_0xa026('0x13')](_0xa026('0x1c'),_0x462d82,JSON['stringify'](_0x4200d3));})[_0xa026('0x4b')](function(_0x132f06){logger[_0xa026('0x46')](_0xa026('0x4c'),_0x462d82,JSON[_0xa026('0x45')](_0x132f06));});})['then'](function(){_0x373c13[_0xa026('0x16')]();});});}}}catch(_0x4c1992){logger[_0xa026('0x46')](_0xa026('0x14'),_0x462d82,JSON[_0xa026('0x45')](_0x4c1992));_0x373c13[_0xa026('0x4d')]();}};}; \ No newline at end of file +var _0x5e53=['update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','service','Smtp','host','port','secure','auth','user','inReplyTo','html','','','auto-replied','All','sendMailMessage','then','messageId','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve'];(function(_0x4e1e19,_0x565eca){var _0x42723e=function(_0x35ef78){while(--_0x35ef78){_0x4e1e19['push'](_0x4e1e19['shift']());}};_0x42723e(++_0x565eca);}(_0x5e53,0x94));var _0x35e5=function(_0x3f7526,_0x3fa99c){_0x3f7526=_0x3f7526-0x0;var _0x5ecc43=_0x5e53[_0x3f7526];return _0x5ecc43;};'use strict';var _=require('lodash');var moment=require(_0x35e5('0x0'));var utils=require('./utils');var logger=require(_0x35e5('0x1'))(_0x35e5('0x2'));var rpc={'chatMessage':require(_0x35e5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x35e5('0x4')),'smsMessage':require(_0x35e5('0x5')),'faxMessage':require(_0x35e5('0x6')),'whatsappMessage':require(_0x35e5('0x7')),'chatInteraction':require(_0x35e5('0x8')),'openchannelInteraction':require(_0x35e5('0x9')),'mailInteraction':require(_0x35e5('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x35e5('0xb'))};var mailRpc=require(_0x35e5('0xc'));exports[_0x35e5('0xd')]=function(_0x187b1c,_0x3f156b,_0x4df68b,_0x1c9d30){return function(_0x2ed23e){try{var _0x148d98=this[_0x35e5('0xe')];if(_0x148d98===_0x35e5('0xf')&&_0x1c9d30[_0x35e5('0x10')]['isAutoreply']){logger[_0x35e5('0x11')](_0x35e5('0x12'),_0x187b1c,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2ed23e['next']();}if(_0x3f156b[0x0]==='1'&&(_['isNil'](this[_0x35e5('0x13')][_0x35e5('0x14')])||!this[_0x35e5('0x13')][_0x35e5('0x14')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x187b1c,_0x35e5('0x15'));return _0x2ed23e[_0x35e5('0x16')]();}if(_0x3f156b[0x0]==='2'&&this[_0x35e5('0x13')][_0x35e5('0x17')]){logger[_0x35e5('0x11')](_0x35e5('0x18'),_0x187b1c,_0x35e5('0x19'));return _0x2ed23e[_0x35e5('0x16')]();}var _0x2dce1d={'ContactId':this[_0x35e5('0x1a')]['id'],'sentAt':moment()[_0x35e5('0x1b')](_0x35e5('0x1c')),'direction':_0x35e5('0x1d')};if(this['channel']==='mail'){_0x2dce1d[_0x35e5('0x10')]=utils[_0x35e5('0x1e')](_0x3f156b[0x2],this);}else{_0x2dce1d['body']=utils[_0x35e5('0x1e')](_0x3f156b[0x1],this);}if(this[_0x35e5('0x1f')]){_0x2dce1d['to']=this['message']['from']||'';if(this[_0x35e5('0xe')]===_0x35e5('0xf')&&_0x3f156b[0x1]==='1'){_0x2dce1d['cc']=this[_0x35e5('0x1f')]['cc']||'';}_0x2dce1d['from']=this['message']['to']||'';_0x2dce1d[_0x35e5('0x20')]=this[_0x35e5('0x1f')][_0x35e5('0x20')]||'';_0x2dce1d[_0x35e5('0x21')]=!![];if(this['message'][_0x35e5('0x22')]){_0x2dce1d[_0x35e5('0x22')]='';_0x2dce1d[_0x35e5('0x22')]+=_[_0x35e5('0x23')](this[_0x35e5('0x1f')][_0x35e5('0x22')],_0x35e5('0x24'))?'':_0x35e5('0x25');_0x2dce1d['subject']+=this[_0x35e5('0x1f')][_0x35e5('0x22')];}}if(this[_0x35e5('0xe')]===_0x35e5('0x26')){_0x2dce1d[_0x35e5('0x27')]=this[_0x35e5('0x28')]['id'];}else{_0x2dce1d[_['upperFirst'](this['channel'])+_0x35e5('0x29')]=this[_0x35e5('0x28')]['id'];}_0x2dce1d[_[_0x35e5('0x2a')](this['channel'])+'InteractionId']=this[_0x35e5('0x13')]['id'];var _0x5ea246=this[_0x35e5('0x13')];if(rpc[this[_0x35e5('0xe')]+_0x35e5('0x2b')]){if(this['channel']==='mail'){var _0x4f3676={'tls':{'rejectUnauthorized':![]}};if(this[_0x35e5('0x28')]['Smtp'][_0x35e5('0x2c')]){_0x4f3676[_0x35e5('0x2c')]=this['account'][_0x35e5('0x2d')][_0x35e5('0x2c')];}else{_0x4f3676[_0x35e5('0x2e')]=this[_0x35e5('0x28')][_0x35e5('0x2d')][_0x35e5('0x2e')];_0x4f3676[_0x35e5('0x2f')]=this[_0x35e5('0x28')][_0x35e5('0x2d')][_0x35e5('0x2f')];_0x4f3676[_0x35e5('0x30')]=this['account'][_0x35e5('0x2d')][_0x35e5('0x30')];}if(this[_0x35e5('0x28')][_0x35e5('0x2d')]['authentication']){_0x4f3676[_0x35e5('0x31')]={'user':this['account']['Smtp'][_0x35e5('0x32')],'pass':this['account'][_0x35e5('0x2d')]['pass']};}_0x2dce1d[_0x35e5('0x33')]=this[_0x35e5('0x1f')]['messageId'];_0x2dce1d[_0x35e5('0x34')]=_0x35e5('0x35')+_['replace'](_0x2dce1d['body'],_0x35e5('0x36'),']+(>|$)/g,''),'priorityTrue':_0x4696c7[0x1],'priorityFalse':_0x4696c7[0x2]};var _0x4dea7e=gotoif[_0x4b26('0x0')](_0x483aa1,{'typecast':!![]});if(_0x4dea7e[_0x4b26('0x9')]){logger[_0x4b26('0xa')](_0x4b26('0xb'),_0xc71555,_['map'](_0x4dea7e,_0x4b26('0xc'))[_0x4b26('0xd')](',\x20'));_0x34e50a[_0x4b26('0xe')]();}else{try{var _0x2a975d=eval('('+_0x483aa1[_0x4b26('0xf')]+')');var _0x19c31e=_0x2a975d?_0x483aa1[_0x4b26('0x10')]:_0x483aa1[_0x4b26('0x11')];logger[_0x4b26('0x12')](_0x4b26('0x13'),_0xc71555,_0x483aa1[_0x4b26('0xf')],_0x2a975d,_0x19c31e||'next');if(_0x19c31e){var _0x322ebd=_[_0x4b26('0x14')](_0x34e50a[_0x4b26('0x15')](),{'p':_0x19c31e});if(_0x322ebd>=0x0){logger[_0x4b26('0x12')](_0x4b26('0x16'),_0xc71555,_0x19c31e||'next',_0x322ebd);_0x34e50a[_0x4b26('0x17')](_0x322ebd);}else{logger['info'](_0x4b26('0x18'),_0xc71555,_0x19c31e||_0x4b26('0x17'));_0x34e50a[_0x4b26('0xe')]();}}else{_0x34e50a[_0x4b26('0x17')]();}}catch(_0x489072){logger[_0x4b26('0xa')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0xc71555,_0x489072['message']);_0x34e50a[_0x4b26('0xe')]();}}}catch(_0x32d7b3){logger['error'](_0x4b26('0xb'),_0xc71555,JSON[_0x4b26('0x19')](_0x32d7b3));_0x34e50a[_0x4b26('0xe')]();}};}; \ No newline at end of file +var _0x254a=['stop','condition','priorityFalse','info','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','consequence','fromString','getMustacheRender','length','error','map','message','join'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0x254a,0x167));var _0xa254=function(_0x7d6eca,_0x59d54a){_0x7d6eca=_0x7d6eca-0x0;var _0x128263=_0x254a[_0x7d6eca];return _0x128263;};'use strict';var schema=require(_0xa254('0x0'));var _=require('lodash');var htmlToText=require(_0xa254('0x1'));var utils=require(_0xa254('0x2'));var logger=require('../../../../config/logger')(_0xa254('0x3'));var gotoif=schema({'condition':{'type':_0xa254('0x4'),'required':!![],'message':_0xa254('0x5')},'priorityTrue':{'type':'number','message':_0xa254('0x6')},'priorityFalse':{'type':_0xa254('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xa254('0x8')]=function(_0x5ddf66,_0x3c06d0){return function(_0x3f1f82){try{var _0x5ecc30={'condition':htmlToText[_0xa254('0x9')](utils[_0xa254('0xa')](_0x3c06d0[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3c06d0[0x1],'priorityFalse':_0x3c06d0[0x2]};var _0x1e61d7=gotoif[_0xa254('0x0')](_0x5ecc30,{'typecast':!![]});if(_0x1e61d7[_0xa254('0xb')]){logger[_0xa254('0xc')]('[%s][GOTOIF]\x20%s',_0x5ddf66,_[_0xa254('0xd')](_0x1e61d7,_0xa254('0xe'))[_0xa254('0xf')](',\x20'));_0x3f1f82[_0xa254('0x10')]();}else{try{var _0x25fc39=eval('('+_0x5ecc30[_0xa254('0x11')]+')');var _0x2e668f=_0x25fc39?_0x5ecc30['priorityTrue']:_0x5ecc30[_0xa254('0x12')];logger[_0xa254('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x5ddf66,_0x5ecc30[_0xa254('0x11')],_0x25fc39,_0x2e668f||'next');if(_0x2e668f){var _0x5df6b9=_[_0xa254('0x14')](_0x3f1f82['rules'](),{'p':_0x2e668f});if(_0x5df6b9>=0x0){logger[_0xa254('0x13')](_0xa254('0x15'),_0x5ddf66,_0x2e668f||'next',_0x5df6b9);_0x3f1f82['next'](_0x5df6b9);}else{logger[_0xa254('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x5ddf66,_0x2e668f||_0xa254('0x16'));_0x3f1f82['stop']();}}else{_0x3f1f82['next']();}}catch(_0x43ebf1){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x5ddf66,_0x43ebf1[_0xa254('0xe')]);_0x3f1f82[_0xa254('0x10')]();}}}catch(_0x31b2dd){logger[_0xa254('0xc')](_0xa254('0x17'),_0x5ddf66,JSON[_0xa254('0x18')](_0x31b2dd));_0x3f1f82['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index eb59588..beb3686 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 _0xd01b=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','stop','info'];(function(_0x47fd42,_0x4f7d3a){var _0x11ba79=function(_0x4f4996){while(--_0x4f4996){_0x47fd42['push'](_0x47fd42['shift']());}};_0x11ba79(++_0x4f7d3a);}(_0xd01b,0xf4));var _0xbd01=function(_0x2a65f9,_0x2cf7af){_0x2a65f9=_0x2a65f9-0x0;var _0x2502f0=_0xd01b[_0x2a65f9];return _0x2502f0;};'use strict';var schema=require(_0xbd01('0x0'));var _=require(_0xbd01('0x1'));var logger=require(_0xbd01('0x2'))('routing');var gotop=schema({'priority':{'type':_0xbd01('0x3'),'required':!![],'message':_0xbd01('0x4')}});exports['consequence']=function(_0x44028e,_0x1bbdb8){return function(_0x2bcd50){try{var _0x1778bb={'priority':_0x1bbdb8[0x0]};var _0x29c07a=gotop[_0xbd01('0x0')](_0x1778bb,{'typecast':!![]});if(_0x29c07a[_0xbd01('0x5')]){logger[_0xbd01('0x6')](_0xbd01('0x7'),_0x44028e,_[_0xbd01('0x8')](_0x29c07a,'message')['join'](',\x20'));_0x2bcd50[_0xbd01('0x9')]();}else{logger[_0xbd01('0xa')](_0xbd01('0xb'),_0x44028e,_0x1778bb[_0xbd01('0xc')]);if(_0x1778bb[_0xbd01('0xc')]){var _0xaf8b66=_[_0xbd01('0xd')](_0x2bcd50['rules'](),{'p':_0x1778bb[_0xbd01('0xc')]});if(_0xaf8b66>=0x0){logger[_0xbd01('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x44028e,_0x1778bb[_0xbd01('0xc')]||_0xbd01('0xe'),_0xaf8b66);_0x2bcd50[_0xbd01('0xe')](_0xaf8b66);}else{logger[_0xbd01('0xa')](_0xbd01('0xf'),_0x44028e,_0x1778bb['priority']||_0xbd01('0xe'));_0x2bcd50[_0xbd01('0x9')]();}}else{_0x2bcd50['next']();}}}catch(_0x4fa1dc){logger[_0xbd01('0x6')]('[%s][GOTOP]\x20%s',_0x44028e,JSON[_0xbd01('0x10')](_0x4fa1dc));_0x2bcd50[_0xbd01('0x9')]();}};}; \ No newline at end of file +var _0x9ef5=['map','message','join','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','../../../../config/logger','routing','consequence','validate','length','error','[%s][GOTOP]\x20%s'];(function(_0x2b790c,_0x40c30d){var _0xa48960=function(_0x51b757){while(--_0x51b757){_0x2b790c['push'](_0x2b790c['shift']());}};_0xa48960(++_0x40c30d);}(_0x9ef5,0x14f));var _0x59ef=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x9ef5[_0x50e593];return _0x3821d0;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x59ef('0x0'))(_0x59ef('0x1'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x59ef('0x2')]=function(_0x1b2130,_0x4bdd9f){return function(_0x4e465d){try{var _0x3bd4fb={'priority':_0x4bdd9f[0x0]};var _0x489f7c=gotop[_0x59ef('0x3')](_0x3bd4fb,{'typecast':!![]});if(_0x489f7c[_0x59ef('0x4')]){logger[_0x59ef('0x5')](_0x59ef('0x6'),_0x1b2130,_[_0x59ef('0x7')](_0x489f7c,_0x59ef('0x8'))[_0x59ef('0x9')](',\x20'));_0x4e465d[_0x59ef('0xa')]();}else{logger[_0x59ef('0xb')](_0x59ef('0xc'),_0x1b2130,_0x3bd4fb[_0x59ef('0xd')]);if(_0x3bd4fb[_0x59ef('0xd')]){var _0x438358=_[_0x59ef('0xe')](_0x4e465d['rules'](),{'p':_0x3bd4fb[_0x59ef('0xd')]});if(_0x438358>=0x0){logger[_0x59ef('0xb')](_0x59ef('0xf'),_0x1b2130,_0x3bd4fb['priority']||_0x59ef('0x10'),_0x438358);_0x4e465d[_0x59ef('0x10')](_0x438358);}else{logger[_0x59ef('0xb')](_0x59ef('0x11'),_0x1b2130,_0x3bd4fb[_0x59ef('0xd')]||'next');_0x4e465d[_0x59ef('0xa')]();}}else{_0x4e465d[_0x59ef('0x10')]();}}}catch(_0x5230ff){logger[_0x59ef('0x5')](_0x59ef('0x6'),_0x1b2130,JSON[_0x59ef('0x12')](_0x5230ff));_0x4e465d[_0x59ef('0xa')]();}};}; \ 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 3c4586e..2dd6f3d 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 _0x7d4b=['account','upperFirst','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x7d4b,0x12d));var _0xb7d4=function(_0x3c459b,_0x9301b9){_0x3c459b=_0x3c459b-0x0;var _0x4be591=_0x7d4b[_0x3c459b];return _0x4be591;};'use strict';var _=require(_0xb7d4('0x0'));var utils=require(_0xb7d4('0x1'));var logger=require('../../../../config/logger')(_0xb7d4('0x2'));var rpc={'chatMessage':require(_0xb7d4('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb7d4('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb7d4('0x5')),'whatsappMessage':require(_0xb7d4('0x6'))};exports['consequence']=function(_0x429bb5,_0x54c387){return function(_0x54d5b3){try{var _0x368487={'body':utils[_0xb7d4('0x7')](_0x54c387[0x0],this),'ContactId':this[_0xb7d4('0x8')]['id']};if(this[_0xb7d4('0x9')]===_0xb7d4('0xa')){_0x368487['ChatWebsiteId']=this[_0xb7d4('0xb')]['id'];}else{_0x368487[_[_0xb7d4('0xc')](this['channel'])+_0xb7d4('0xd')]=this[_0xb7d4('0xb')]['id'];}_0x368487[_[_0xb7d4('0xc')](this['channel'])+_0xb7d4('0xe')]=this['interaction']['id'];if(rpc[this['channel']+_0xb7d4('0xf')]){return rpc[this[_0xb7d4('0x9')]+_0xb7d4('0xf')][_0xb7d4('0x10')](_0x368487)[_0xb7d4('0x11')](function(_0x345749){logger[_0xb7d4('0x12')](_0xb7d4('0x13'),_0x429bb5,_0x368487[_0xb7d4('0x14')]);_0x54d5b3[_0xb7d4('0x15')]();})[_0xb7d4('0x16')](function(_0x20d91f){logger[_0xb7d4('0x17')](_0xb7d4('0x13'),_0x429bb5,JSON[_0xb7d4('0x18')](_0x20d91f));_0x54d5b3[_0xb7d4('0x19')]();});}}catch(_0x4a777a){logger[_0xb7d4('0x17')]('[%s][MESSAGE]\x20%s',_0x429bb5,JSON[_0xb7d4('0x18')](_0x4a777a));_0x54d5b3[_0xb7d4('0x19')]();}};}; \ No newline at end of file +var _0x28e8=['consequence','getMustacheRender','contact','channel','chat','AccountId','account','upperFirst','interaction','Message','then','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x39610d,_0x4158d9){var _0x3dfcbb=function(_0x2bc092){while(--_0x2bc092){_0x39610d['push'](_0x39610d['shift']());}};_0x3dfcbb(++_0x4158d9);}(_0x28e8,0x17e));var _0x828e=function(_0x45fa4a,_0x237f31){_0x45fa4a=_0x45fa4a-0x0;var _0xa967ca=_0x28e8[_0x45fa4a];return _0xa967ca;};'use strict';var _=require(_0x828e('0x0'));var utils=require(_0x828e('0x1'));var logger=require(_0x828e('0x2'))(_0x828e('0x3'));var rpc={'chatMessage':require(_0x828e('0x4')),'openchannelMessage':require(_0x828e('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x828e('0x6')),'whatsappMessage':require(_0x828e('0x7'))};exports[_0x828e('0x8')]=function(_0x69c9d9,_0x3b0d2d){return function(_0x56105f){try{var _0x44de07={'body':utils[_0x828e('0x9')](_0x3b0d2d[0x0],this),'ContactId':this[_0x828e('0xa')]['id']};if(this[_0x828e('0xb')]===_0x828e('0xc')){_0x44de07['ChatWebsiteId']=this['account']['id'];}else{_0x44de07[_['upperFirst'](this[_0x828e('0xb')])+_0x828e('0xd')]=this[_0x828e('0xe')]['id'];}_0x44de07[_[_0x828e('0xf')](this['channel'])+'InteractionId']=this[_0x828e('0x10')]['id'];if(rpc[this['channel']+_0x828e('0x11')]){return rpc[this[_0x828e('0xb')]+_0x828e('0x11')]['create'](_0x44de07)[_0x828e('0x12')](function(_0x657f18){logger[_0x828e('0x13')]('[%s][MESSAGE]\x20%s',_0x69c9d9,_0x44de07[_0x828e('0x14')]);_0x56105f[_0x828e('0x15')]();})[_0x828e('0x16')](function(_0x1ab031){logger['error'](_0x828e('0x17'),_0x69c9d9,JSON[_0x828e('0x18')](_0x1ab031));_0x56105f['stop']();});}}catch(_0x4e94c1){logger['error'](_0x828e('0x17'),_0x69c9d9,JSON[_0x828e('0x18')](_0x4e94c1));_0x56105f[_0x828e('0x19')]();}};}; \ 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 fe90f39..86b3cda 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 _0x5a36=['info','[%s][NOOP]\x20%s','error','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x169590,_0x57ed1d){var _0x3df381=function(_0x54c46d){while(--_0x54c46d){_0x169590['push'](_0x169590['shift']());}};_0x3df381(++_0x57ed1d);}(_0x5a36,0x1eb));var _0x65a3=function(_0x57c972,_0x510be5){_0x57c972=_0x57c972-0x0;var _0x2c5861=_0x5a36[_0x57c972];return _0x2c5861;};'use strict';var utils=require(_0x65a3('0x0'));var logger=require(_0x65a3('0x1'))(_0x65a3('0x2'));exports[_0x65a3('0x3')]=function(_0x2a056a,_0x1d8443){return function(_0x5a95f9){try{logger[_0x65a3('0x4')](_0x65a3('0x5'),_0x2a056a,utils['getMustacheRender'](_0x1d8443[0x0],this));_0x5a95f9['next']();}catch(_0x2ab716){logger[_0x65a3('0x6')](_0x65a3('0x5'),_0x2a056a,JSON[_0x65a3('0x7')](_0x2ab716));_0x5a95f9[_0x65a3('0x8')]();}};}; \ No newline at end of file +var _0x2097=['[%s][NOOP]\x20%s','stringify','stop','./utils','routing','info','getMustacheRender','error'];(function(_0x179194,_0x8fca3){var _0x1b3ac7=function(_0x321450){while(--_0x321450){_0x179194['push'](_0x179194['shift']());}};_0x1b3ac7(++_0x8fca3);}(_0x2097,0x1ab));var _0x7209=function(_0x22632a,_0x5ad920){_0x22632a=_0x22632a-0x0;var _0x356781=_0x2097[_0x22632a];return _0x356781;};'use strict';var utils=require(_0x7209('0x0'));var logger=require('../../../../config/logger')(_0x7209('0x1'));exports['consequence']=function(_0x1ec9de,_0x630b31){return function(_0x91d6a){try{logger[_0x7209('0x2')]('[%s][NOOP]\x20%s',_0x1ec9de,utils[_0x7209('0x3')](_0x630b31[0x0],this));_0x91d6a['next']();}catch(_0x3a8300){logger[_0x7209('0x4')](_0x7209('0x5'),_0x1ec9de,JSON[_0x7209('0x6')](_0x3a8300));_0x91d6a[_0x7209('0x7')]();}};}; \ 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 e668b7b..3d1d962 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 _0x3e70=['QueueId','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','timeout','createQueue','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','queue_id','account','from','emit','clone','queue','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst'];(function(_0x15eb76,_0x1946fb){var _0x104569=function(_0x43d6a4){while(--_0x43d6a4){_0x15eb76['push'](_0x15eb76['shift']());}};_0x104569(++_0x1946fb);}(_0x3e70,0x71));var _0x03e7=function(_0xb018e,_0x36c28a){_0xb018e=_0xb018e-0x0;var _0x4401=_0x3e70[_0xb018e];return _0x4401;};'use strict';var schema=require(_0x03e7('0x0'));var _=require(_0x03e7('0x1'));var util=require(_0x03e7('0x2'));var seqqueue=require(_0x03e7('0x3'));var moment=require(_0x03e7('0x4'));var Redis=require(_0x03e7('0x5'));var config=require(_0x03e7('0x6'));var logger=require(_0x03e7('0x7'))(_0x03e7('0x8'));var strategy=require('./strategy');config[_0x03e7('0x9')]=_[_0x03e7('0xa')](config[_0x03e7('0x9')],{'host':_0x03e7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x03e7('0x9')]));var attributes=['id',_0x03e7('0xc'),_0x03e7('0xd'),'queue',_0x03e7('0xe'),'joinAt'];function emit(_0x10fd37,_0x74ff5a,_0x297e0a){io['to'](_0x10fd37)[_0x03e7('0xf')](_0x74ff5a,_0x297e0a);}function emitChannelQueueInteraction(_0x20e3f1,_0xde6fb7,_0x27cf82,_0x4c0e95,_0x3b18ad,_0xdbe9a3,_0x16498a,_0x10dcbc){var _0x2ac848=_[_0x03e7('0x10')](_0x27cf82);_0x2ac848[_0x03e7('0xc')]=_0x10dcbc;_0x2ac848[_0x03e7('0x11')]=_0xde6fb7;_0x2ac848[_0x03e7('0xd')]=_0x4c0e95;_0x2ac848['id']=_0x3b18ad;if(_0xdbe9a3){_0x16498a[util[_0x03e7('0x12')](_0x03e7('0x13'),_0x20e3f1)][_0x3b18ad]=_[_0x03e7('0x14')](_0x2ac848,attributes);}else{delete _0x16498a[util[_0x03e7('0x12')](_0x03e7('0x13'),_0x20e3f1)][_0x3b18ad];}emit(util[_0x03e7('0x12')](_0x03e7('0x15'),_0x20e3f1,_0xde6fb7),util[_0x03e7('0x12')](_0x03e7('0x16'),_0x20e3f1,_0xdbe9a3?_0x03e7('0x17'):_0x03e7('0x18')),_[_0x03e7('0x14')](_0x2ac848,attributes));}var rpc={'openchannelQueueReport':require(_0x03e7('0x19')),'mailQueueReport':require(_0x03e7('0x1a')),'chatQueueReport':require(_0x03e7('0x1b')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x03e7('0x1c')),'whatsappQueueReport':require(_0x03e7('0x1d'))};var queue=schema({'name':{'type':_0x03e7('0x1e'),'required':!![],'message':_0x03e7('0x1f')},'timeout':{'type':'number','message':_0x03e7('0x20')}});function startRouting(_0x255c49,_0x1b96ba,_0x4ea22c,_0x4c526d){if(_0x255c49&&_0x1b96ba&&_0x4ea22c){_0x1b96ba[_0x03e7('0x21')]+=0x1;var _0x570368={'uniqueid':_0x255c49,'from':_0x4ea22c[_0x03e7('0x22')]?_0x4ea22c[_0x03e7('0x22')][_0x03e7('0xe')]:'','joinAt':moment()['format'](_0x03e7('0x23')),'ContactId':_0x4ea22c[_0x03e7('0x24')]?_0x4ea22c[_0x03e7('0x24')]['id']:null,'ListId':_0x4ea22c[_0x03e7('0x25')]?_0x4ea22c[_0x03e7('0x25')]['id']:null};_0x570368[_[_0x03e7('0x26')](_0x4ea22c['channel'])+_0x03e7('0x27')]=_0x1b96ba['id']||null;_0x570368[_[_0x03e7('0x26')](_0x4ea22c[_0x03e7('0x28')])+'InteractionId']=_0x4ea22c[_0x03e7('0x29')]?_0x4ea22c['interaction']['id']:null;_0x570368[_[_0x03e7('0x26')](_0x4ea22c[_0x03e7('0x28')])+_0x03e7('0x2a')]=_0x4ea22c[_0x03e7('0x2b')]?_0x4ea22c[_0x03e7('0x2b')]['id']:null;_0x570368[_[_0x03e7('0x26')](_0x4ea22c[_0x03e7('0x28')])+(_0x4ea22c[_0x03e7('0x28')]!==_0x03e7('0x2c')?_0x03e7('0x2d'):_0x03e7('0x2e'))]=_0x4ea22c[_0x03e7('0xd')]?_0x4ea22c[_0x03e7('0xd')]['id']:null;logger[_0x03e7('0x2f')](util[_0x03e7('0x12')](_0x03e7('0x30'),_0x255c49,_0x1b96ba[_0x03e7('0x31')]));emitChannelQueueInteraction(_0x4ea22c[_0x03e7('0x28')],_0x1b96ba[_0x03e7('0x31')],_0x570368,_0x4ea22c[_0x03e7('0xd')][_0x03e7('0x31')],_0x4ea22c['message']['id'],!![],_0x4c526d,_0x1b96ba['id']);if(rpc[_0x4ea22c['channel']+'QueueReport']){return rpc[_0x4ea22c[_0x03e7('0x28')]+_0x03e7('0x32')][_0x03e7('0x33')](_0x570368)[_0x03e7('0x34')](function(_0x1daf42){logger[_0x03e7('0x35')](_0x03e7('0x36'));});}}}function stopRouting(_0x595adc,_0x5e164c,_0x4e404f,_0x45efcf){if(_0x595adc&&_0x5e164c){_0x5e164c[_0x03e7('0x21')]-=0x1;var _0x330ae0={'leaveAt':moment()[_0x03e7('0x12')](_0x03e7('0x23')),'acceptAt':moment()[_0x03e7('0x12')](_0x03e7('0x23')),'reason':'accepted'};logger['info'](util[_0x03e7('0x12')](_0x03e7('0x37'),_0x595adc,_0x5e164c[_0x03e7('0x31')]));emitChannelQueueInteraction(_0x4e404f[_0x03e7('0x28')],_0x5e164c[_0x03e7('0x31')],_0x4e404f['body'],_0x4e404f['account'][_0x03e7('0x31')],_0x4e404f['message']['id'],![],_0x45efcf,_0x5e164c['id']);if(rpc[_0x4e404f[_0x03e7('0x28')]+'QueueReport']){return rpc[_0x4e404f[_0x03e7('0x28')]+'QueueReport']['update'](_0x595adc,_0x330ae0)[_0x03e7('0x34')](function(_0x82edda){logger['error'](_0x03e7('0x38'));});}}}function endRouting(_0x467063,_0x8c77d1,_0x11adc4,_0x4c0b2b){if(_0x467063&&_0x8c77d1){_0x8c77d1[_0x03e7('0x21')]-=0x1;var _0x452a99={'leaveAt':moment()[_0x03e7('0x12')](_0x03e7('0x23')),'exitAt':moment()[_0x03e7('0x12')](_0x03e7('0x23')),'reason':'timeout'};logger[_0x03e7('0x2f')](util['format'](_0x03e7('0x39'),_0x467063,_0x8c77d1[_0x03e7('0x31')]));emitChannelQueueInteraction(_0x11adc4[_0x03e7('0x28')],_0x8c77d1['name'],_0x11adc4[_0x03e7('0x22')],_0x11adc4[_0x03e7('0xd')]['name'],_0x11adc4[_0x03e7('0x2b')]['id'],![],_0x4c0b2b);if(rpc[_0x11adc4[_0x03e7('0x28')]+_0x03e7('0x32')]){return rpc[_0x11adc4['channel']+_0x03e7('0x32')]['update'](_0x467063,_0x452a99)[_0x03e7('0x34')](function(_0x1c5a1a){logger['error'](_0x03e7('0x38'));});}}}function handleFindQueue(_0x505e24){return function(_0x48d04e){return _0x48d04e[_0x03e7('0x31')][_0x03e7('0x3a')]()===_0x505e24[_0x03e7('0x3a')]();};}exports[_0x03e7('0x3b')]=function(_0x486a4c,_0x3f8f43,_0x355323,_0x3884a7){return function(_0x2d2889){try{var _0x34e498={'name':_0x3f8f43[0x0],'timeout':_0x3f8f43[0x1]};var _0x48e61b=queue[_0x03e7('0x0')](_0x34e498,{'typecast':!![]});if(_0x48e61b[_0x03e7('0x3c')]){logger['error'](_0x03e7('0x3d'),_0x486a4c,_[_0x03e7('0x3e')](_0x48e61b,_0x03e7('0x2b'))[_0x03e7('0x3f')](',\x20'));_0x2d2889[_0x03e7('0x40')]();}else{var _0x43b055=_[_0x03e7('0x41')](_0x355323[_0x3884a7[_0x03e7('0x28')]+'Queues'],handleFindQueue(_0x34e498[_0x03e7('0x31')]));if(_0x43b055){startRouting(_0x486a4c,_0x43b055,_0x3884a7,_0x355323);var _0x383be0=(_0x43b055[_0x03e7('0x42')]||0xa)*0x3e8;var _0x3d4b96=(_0x34e498[_0x03e7('0x42')]||0x14)*0x3e8;var _0x2a3502,_0x3d2af5;if(_0x383be0>_0x3d4b96){_0x3d4b96=_0x383be0;}var _0x546079=seqqueue[_0x03e7('0x43')](_0x383be0);_0x546079['id']=_0x486a4c;_0x546079['atimeout']=_0x383be0;_0x546079['qtimeout']=_0x3d4b96;_0x546079[_0x03e7('0x28')]=_0x3884a7[_0x03e7('0x28')];_0x355323[_0x03e7('0x44')][_0x486a4c]['on']('end',function(){logger[_0x03e7('0x2f')](_0x03e7('0x45'),_0x486a4c);stopRouting(_0x486a4c,_0x43b055,_0x3884a7,_0x355323);clearTimeout(_0x2a3502);_0x2a3502=undefined;_0x546079[_0x03e7('0x46')](!![]);if(_0x355323['rules'][_0x486a4c]){delete _0x355323[_0x03e7('0x44')][_0x486a4c];}_0x2d2889[_0x03e7('0x40')]();});_0x355323['rules'][_0x486a4c]['on']('complete',function(){if(_0x355323['rules'][_0x486a4c]){delete _0x355323[_0x03e7('0x44')][_0x486a4c];}});_0x2a3502=setTimeout(function(){logger[_0x03e7('0x2f')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x486a4c);endRouting(_0x486a4c,_0x43b055,_0x3884a7,_0x355323);clearTimeout(_0x2a3502);_0x546079['close'](!![]);_0x2d2889[_0x03e7('0x47')]();},_0x3d4b96);switch(_0x43b055['strategy']){case _0x03e7('0x48'):strategy['rrmemory'](_0x546079,_0x43b055,_0x355323,_0x3884a7);break;default:strategy['beepall'](_0x546079,_0x43b055,_0x355323,_0x3884a7);}}else{logger['error'](_0x03e7('0x49'),_0x486a4c,_0x34e498[_0x03e7('0x31')]);_0x2d2889[_0x03e7('0x40')]();}}}catch(_0xac5595){console[_0x03e7('0x4a')](_0xac5595);logger['error']('[%s][QUEUE]\x20%s',_0x486a4c,_0xac5595[_0x03e7('0x4b')]);_0x2d2889['stop']();}};}; \ No newline at end of file +var _0x283d=['log','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x283d,0x9f));var _0xd283=function(_0x44478c,_0x518bb8){_0x44478c=_0x44478c-0x0;var _0x801221=_0x283d[_0x44478c];return _0x801221;};'use strict';var schema=require(_0xd283('0x0'));var _=require(_0xd283('0x1'));var util=require('util');var seqqueue=require(_0xd283('0x2'));var moment=require(_0xd283('0x3'));var Redis=require(_0xd283('0x4'));var config=require(_0xd283('0x5'));var logger=require(_0xd283('0x6'))(_0xd283('0x7'));var strategy=require('./strategy');config['redis']=_['defaults'](config[_0xd283('0x8')],{'host':_0xd283('0x9'),'port':0x18eb});var io=require(_0xd283('0xa'))(new Redis(config[_0xd283('0x8')]));var attributes=['id',_0xd283('0xb'),_0xd283('0xc'),_0xd283('0xd'),_0xd283('0xe'),_0xd283('0xf')];function emit(_0x37a341,_0x28ab56,_0x10bfa1){io['to'](_0x37a341)[_0xd283('0x10')](_0x28ab56,_0x10bfa1);}function emitChannelQueueInteraction(_0x24c703,_0x5e1c74,_0x47a6ad,_0x3b799e,_0x1c04a4,_0x14802a,_0x14f896,_0x17b484){var _0xf4fcab=_[_0xd283('0x11')](_0x47a6ad);_0xf4fcab['queue_id']=_0x17b484;_0xf4fcab[_0xd283('0xd')]=_0x5e1c74;_0xf4fcab[_0xd283('0xc')]=_0x3b799e;_0xf4fcab['id']=_0x1c04a4;if(_0x14802a){_0x14f896[util[_0xd283('0x12')]('%sQueuesWaitingInteractions',_0x24c703)][_0x1c04a4]=_[_0xd283('0x13')](_0xf4fcab,attributes);}else{delete _0x14f896[util[_0xd283('0x12')](_0xd283('0x14'),_0x24c703)][_0x1c04a4];}emit(util[_0xd283('0x12')](_0xd283('0x15'),_0x24c703,_0x5e1c74),util['format'](_0xd283('0x16'),_0x24c703,_0x14802a?_0xd283('0x17'):'remove'),_[_0xd283('0x13')](_0xf4fcab,attributes));}var rpc={'openchannelQueueReport':require(_0xd283('0x18')),'mailQueueReport':require(_0xd283('0x19')),'chatQueueReport':require(_0xd283('0x1a')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xd283('0x1b')),'whatsappQueueReport':require(_0xd283('0x1c'))};var queue=schema({'name':{'type':_0xd283('0x1d'),'required':!![],'message':_0xd283('0x1e')},'timeout':{'type':_0xd283('0x1f'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x361b57,_0x3a8904,_0x1d8737,_0x208ca1){if(_0x361b57&&_0x3a8904&&_0x1d8737){_0x3a8904[_0xd283('0x20')]+=0x1;var _0x2e2813={'uniqueid':_0x361b57,'from':_0x1d8737[_0xd283('0x21')]?_0x1d8737['body'][_0xd283('0xe')]:'','joinAt':moment()[_0xd283('0x12')](_0xd283('0x22')),'ContactId':_0x1d8737[_0xd283('0x23')]?_0x1d8737[_0xd283('0x23')]['id']:null,'ListId':_0x1d8737[_0xd283('0x24')]?_0x1d8737[_0xd283('0x24')]['id']:null};_0x2e2813[_[_0xd283('0x25')](_0x1d8737[_0xd283('0x26')])+'QueueId']=_0x3a8904['id']||null;_0x2e2813[_[_0xd283('0x25')](_0x1d8737[_0xd283('0x26')])+_0xd283('0x27')]=_0x1d8737[_0xd283('0x28')]?_0x1d8737[_0xd283('0x28')]['id']:null;_0x2e2813[_['upperFirst'](_0x1d8737[_0xd283('0x26')])+_0xd283('0x29')]=_0x1d8737[_0xd283('0x2a')]?_0x1d8737[_0xd283('0x2a')]['id']:null;_0x2e2813[_[_0xd283('0x25')](_0x1d8737[_0xd283('0x26')])+(_0x1d8737['channel']!==_0xd283('0x2b')?_0xd283('0x2c'):_0xd283('0x2d'))]=_0x1d8737[_0xd283('0xc')]?_0x1d8737[_0xd283('0xc')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x361b57,_0x3a8904[_0xd283('0x2e')]));emitChannelQueueInteraction(_0x1d8737[_0xd283('0x26')],_0x3a8904[_0xd283('0x2e')],_0x2e2813,_0x1d8737[_0xd283('0xc')]['name'],_0x1d8737[_0xd283('0x2a')]['id'],!![],_0x208ca1,_0x3a8904['id']);if(rpc[_0x1d8737[_0xd283('0x26')]+_0xd283('0x2f')]){return rpc[_0x1d8737[_0xd283('0x26')]+_0xd283('0x2f')][_0xd283('0x30')](_0x2e2813)[_0xd283('0x31')](function(_0x26d9eb){logger[_0xd283('0x32')]('create\x20queue\x20report');});}}}function stopRouting(_0x26a9d0,_0x1e3b89,_0x144d99,_0x501af3){if(_0x26a9d0&&_0x1e3b89){_0x1e3b89[_0xd283('0x20')]-=0x1;var _0x4c91f7={'leaveAt':moment()[_0xd283('0x12')](_0xd283('0x22')),'acceptAt':moment()[_0xd283('0x12')](_0xd283('0x22')),'reason':_0xd283('0x33')};logger[_0xd283('0x34')](util['format'](_0xd283('0x35'),_0x26a9d0,_0x1e3b89[_0xd283('0x2e')]));emitChannelQueueInteraction(_0x144d99[_0xd283('0x26')],_0x1e3b89['name'],_0x144d99[_0xd283('0x21')],_0x144d99[_0xd283('0xc')][_0xd283('0x2e')],_0x144d99[_0xd283('0x2a')]['id'],![],_0x501af3,_0x1e3b89['id']);if(rpc[_0x144d99[_0xd283('0x26')]+_0xd283('0x2f')]){return rpc[_0x144d99[_0xd283('0x26')]+'QueueReport'][_0xd283('0x36')](_0x26a9d0,_0x4c91f7)[_0xd283('0x31')](function(_0x4220ff){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x5b2e5e,_0x2bea1f,_0x4f5a50,_0x19047e){if(_0x5b2e5e&&_0x2bea1f){_0x2bea1f[_0xd283('0x20')]-=0x1;var _0x28f3f0={'leaveAt':moment()[_0xd283('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd283('0x37')};logger[_0xd283('0x34')](util[_0xd283('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x5b2e5e,_0x2bea1f['name']));emitChannelQueueInteraction(_0x4f5a50[_0xd283('0x26')],_0x2bea1f[_0xd283('0x2e')],_0x4f5a50[_0xd283('0x21')],_0x4f5a50[_0xd283('0xc')][_0xd283('0x2e')],_0x4f5a50[_0xd283('0x2a')]['id'],![],_0x19047e);if(rpc[_0x4f5a50[_0xd283('0x26')]+_0xd283('0x2f')]){return rpc[_0x4f5a50['channel']+_0xd283('0x2f')][_0xd283('0x36')](_0x5b2e5e,_0x28f3f0)[_0xd283('0x31')](function(_0x74a5f3){logger[_0xd283('0x32')](_0xd283('0x38'));});}}}function handleFindQueue(_0x36b88e){return function(_0x463cdd){return _0x463cdd['name']['toLowerCase']()===_0x36b88e[_0xd283('0x39')]();};}exports[_0xd283('0x3a')]=function(_0xe53e9f,_0x304896,_0x44c050,_0x3a0c38){return function(_0x25ac59){try{var _0x5792be={'name':_0x304896[0x0],'timeout':_0x304896[0x1]};var _0x52e634=queue['validate'](_0x5792be,{'typecast':!![]});if(_0x52e634[_0xd283('0x3b')]){logger[_0xd283('0x32')]('[%s][QUEUE]\x20%s',_0xe53e9f,_[_0xd283('0x3c')](_0x52e634,_0xd283('0x2a'))[_0xd283('0x3d')](',\x20'));_0x25ac59[_0xd283('0x3e')]();}else{var _0x4620c2=_[_0xd283('0x3f')](_0x44c050[_0x3a0c38[_0xd283('0x26')]+_0xd283('0x40')],handleFindQueue(_0x5792be[_0xd283('0x2e')]));if(_0x4620c2){startRouting(_0xe53e9f,_0x4620c2,_0x3a0c38,_0x44c050);var _0x33efc6=(_0x4620c2[_0xd283('0x37')]||0xa)*0x3e8;var _0xb285e=(_0x5792be['timeout']||0x14)*0x3e8;var _0x33a785,_0x4682de;if(_0x33efc6>_0xb285e){_0xb285e=_0x33efc6;}var _0x2f03f1=seqqueue[_0xd283('0x41')](_0x33efc6);_0x2f03f1['id']=_0xe53e9f;_0x2f03f1[_0xd283('0x42')]=_0x33efc6;_0x2f03f1[_0xd283('0x43')]=_0xb285e;_0x2f03f1[_0xd283('0x26')]=_0x3a0c38['channel'];_0x44c050[_0xd283('0x44')][_0xe53e9f]['on'](_0xd283('0x45'),function(){logger[_0xd283('0x34')](_0xd283('0x46'),_0xe53e9f);stopRouting(_0xe53e9f,_0x4620c2,_0x3a0c38,_0x44c050);clearTimeout(_0x33a785);_0x33a785=undefined;_0x2f03f1['close'](!![]);if(_0x44c050[_0xd283('0x44')][_0xe53e9f]){delete _0x44c050['rules'][_0xe53e9f];}_0x25ac59[_0xd283('0x3e')]();});_0x44c050[_0xd283('0x44')][_0xe53e9f]['on'](_0xd283('0x47'),function(){if(_0x44c050[_0xd283('0x44')][_0xe53e9f]){delete _0x44c050[_0xd283('0x44')][_0xe53e9f];}});_0x33a785=setTimeout(function(){logger[_0xd283('0x34')](_0xd283('0x48'),_0xe53e9f);endRouting(_0xe53e9f,_0x4620c2,_0x3a0c38,_0x44c050);clearTimeout(_0x33a785);_0x2f03f1[_0xd283('0x49')](!![]);_0x25ac59[_0xd283('0x4a')]();},_0xb285e);switch(_0x4620c2['strategy']){case _0xd283('0x4b'):strategy[_0xd283('0x4b')](_0x2f03f1,_0x4620c2,_0x44c050,_0x3a0c38);break;default:strategy[_0xd283('0x4c')](_0x2f03f1,_0x4620c2,_0x44c050,_0x3a0c38);}}else{logger[_0xd283('0x32')](_0xd283('0x4d'),_0xe53e9f,_0x5792be[_0xd283('0x2e')]);_0x25ac59[_0xd283('0x3e')]();}}}catch(_0x2b94ec){console[_0xd283('0x4e')](_0x2b94ec);logger[_0xd283('0x32')]('[%s][QUEUE]\x20%s',_0xe53e9f,_0x2b94ec['stack']);_0x25ac59[_0xd283('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 766ef54..0e97dcd 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 _0xe1ec=['info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','busy','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','push','handleRun','handleTimeout','timeout','bind','prototype'];(function(_0xeff2c3,_0x3a5a82){var _0x2cade6=function(_0x5a26a1){while(--_0x5a26a1){_0xeff2c3['push'](_0xeff2c3['shift']());}};_0x2cade6(++_0x3a5a82);}(_0xe1ec,0x1d3));var _0xce1e=function(_0x2d72a8,_0x1496b4){_0x2d72a8=_0x2d72a8-0x0;var _0x549561=_0xe1ec[_0x2d72a8];return _0x549561;};'use strict';var _=require(_0xce1e('0x0'));var uuid=require(_0xce1e('0x1'));var util=require(_0xce1e('0x2'));var logger=require('../../../../../config/logger')(_0xce1e('0x3'));var Agent=function(_0x58c3dc,_0x53790b,_0x189e1f,_0x1feccc){this[_0xce1e('0x4')]=uuid['v4']();this[_0xce1e('0x5')]=_0x58c3dc;this[_0xce1e('0x6')]=_0x53790b;this['realtime']=_0x189e1f;this[_0xce1e('0x3')]=_0x1feccc;this[_0xce1e('0x5')][_0xce1e('0x7')](this[_0xce1e('0x8')]['bind'](this),this[_0xce1e('0x9')]['bind'](this));this[_0xce1e('0x5')]['on'](_0xce1e('0xa'),this['handleTimeout'][_0xce1e('0xb')](this));this[_0xce1e('0x5')]['on']('drained',this['handleDrained'][_0xce1e('0xb')](this));};Agent[_0xce1e('0xc')][_0xce1e('0x7')]=function(){this[_0xce1e('0x5')][_0xce1e('0x7')](this[_0xce1e('0x8')][_0xce1e('0xb')](this),this[_0xce1e('0x9')][_0xce1e('0xb')](this));};Agent[_0xce1e('0xc')]['handleDrained']=function(){this[_0xce1e('0x9')](!![]);};Agent[_0xce1e('0xc')][_0xce1e('0x8')]=function(_0x373bf6){logger[_0xce1e('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xce1e('0x5')]['id'],this[_0xce1e('0x6')]['id']);if(_['isNil'](this['realtime'][_0xce1e('0xe')][this[_0xce1e('0x6')]['id']])){logger[_0xce1e('0xd')](_0xce1e('0xf'),this[_0xce1e('0x5')]['id'],this[_0xce1e('0x6')]['id']);setTimeout(this[_0xce1e('0x7')][_0xce1e('0xb')](this),0x3e8);}else{if(this[_0xce1e('0x3')][_0xce1e('0x10')]||util[_0xce1e('0x11')](this[_0xce1e('0x5')]['id'],this[_0xce1e('0x12')]['agents'][this[_0xce1e('0x6')]['id']],this[_0xce1e('0x5')]['channel'],![])){this[_0xce1e('0x12')][_0xce1e('0xe')][this[_0xce1e('0x6')]['id']][_0xce1e('0x13')]=!![];this[_0xce1e('0x12')]['agents'][this['agent']['id']]['busyQueue']=undefined;util['showNotification'](this[_0xce1e('0x4')],this['squeue']['id'],this[_0xce1e('0x12')]['agents'][this[_0xce1e('0x6')]['id']],null,this['routing']);util[_0xce1e('0x14')](this['squeue']['id'],this[_0xce1e('0x12')][_0xce1e('0xe')][this[_0xce1e('0x6')]['id']],_0xce1e('0x15')+(this[_0xce1e('0x3')][_0xce1e('0x10')]?_0xce1e('0x16'):''));}else{logger[_0xce1e('0xd')](_0xce1e('0x17'),this[_0xce1e('0x5')]['id'],this[_0xce1e('0x6')]['id']);setTimeout(this[_0xce1e('0x7')][_0xce1e('0xb')](this),0x3e8);}}};Agent['prototype'][_0xce1e('0x9')]=function(_0x1daf54){if(_[_0xce1e('0x18')](this[_0xce1e('0x12')]['agents'][this[_0xce1e('0x6')]['id']])){return logger[_0xce1e('0xd')](_0xce1e('0xf'),this[_0xce1e('0x5')]['id'],this[_0xce1e('0x6')]['id']);}else{logger[_0xce1e('0xd')](_0xce1e('0x19'),this['squeue']['id'],this[_0xce1e('0x6')]['id']);util['hideNotification'](this[_0xce1e('0x4')],this['squeue']['id'],this['realtime'][_0xce1e('0xe')][this[_0xce1e('0x6')]['id']],null,this['routing']);this['realtime'][_0xce1e('0xe')][this[_0xce1e('0x6')]['id']]['busy']=![];this['realtime'][_0xce1e('0xe')][this[_0xce1e('0x6')]['id']][_0xce1e('0x1a')]=undefined;util[_0xce1e('0x14')](this[_0xce1e('0x5')]['id'],this[_0xce1e('0x12')][_0xce1e('0xe')][this[_0xce1e('0x6')]['id']],_0x1daf54?_0xce1e('0x1b'):_0xce1e('0x1c'));}if(!_0x1daf54){setTimeout(this[_0xce1e('0x7')][_0xce1e('0xb')](this),0x3e8);}};function agent(_0x235846,_0x3f91e1,_0x18f64f,_0x30f97d){return new Agent(_0x235846,_0x3f91e1,_0x18f64f,_0x30f97d);}module[_0xce1e('0x1d')]=agent; \ No newline at end of file +var _0xb34e=['bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','agents','channel','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun'];(function(_0x5a0876,_0x1e363e){var _0x55969f=function(_0x3e12ce){while(--_0x3e12ce){_0x5a0876['push'](_0x5a0876['shift']());}};_0x55969f(++_0x1e363e);}(_0xb34e,0x129));var _0xeb34=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xb34e[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xeb34('0x0'));var uuid=require(_0xeb34('0x1'));var util=require(_0xeb34('0x2'));var logger=require(_0xeb34('0x3'))(_0xeb34('0x4'));var Agent=function(_0x1c30ec,_0x2e7b95,_0x10b975,_0x29a130){this[_0xeb34('0x5')]=uuid['v4']();this[_0xeb34('0x6')]=_0x1c30ec;this['agent']=_0x2e7b95;this['realtime']=_0x10b975;this['routing']=_0x29a130;this[_0xeb34('0x6')][_0xeb34('0x7')](this[_0xeb34('0x8')][_0xeb34('0x9')](this),this[_0xeb34('0xa')][_0xeb34('0x9')](this));this['squeue']['on'](_0xeb34('0xb'),this[_0xeb34('0xa')][_0xeb34('0x9')](this));this[_0xeb34('0x6')]['on'](_0xeb34('0xc'),this[_0xeb34('0xd')]['bind'](this));};Agent[_0xeb34('0xe')][_0xeb34('0x7')]=function(){this[_0xeb34('0x6')][_0xeb34('0x7')](this[_0xeb34('0x8')][_0xeb34('0x9')](this),this[_0xeb34('0xa')][_0xeb34('0x9')](this));};Agent['prototype'][_0xeb34('0xd')]=function(){this[_0xeb34('0xa')](!![]);};Agent[_0xeb34('0xe')][_0xeb34('0x8')]=function(_0x55c916){logger[_0xeb34('0xf')](_0xeb34('0x10'),this[_0xeb34('0x6')]['id'],this[_0xeb34('0x11')]['id']);if(_[_0xeb34('0x12')](this['realtime']['agents'][this['agent']['id']])){logger['info'](_0xeb34('0x13'),this[_0xeb34('0x6')]['id'],this[_0xeb34('0x11')]['id']);setTimeout(this['push'][_0xeb34('0x9')](this),0x3e8);}else{if(this[_0xeb34('0x4')]['forcedOwnership']||util[_0xeb34('0x14')](this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']],this[_0xeb34('0x6')][_0xeb34('0x17')],![])){this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']]['busy']=!![];this[_0xeb34('0x15')][_0xeb34('0x16')][this['agent']['id']][_0xeb34('0x18')]=undefined;util['showNotification'](this['notificationId'],this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']],null,this['routing']);util['writeLog'](this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']],_0xeb34('0x19')+(this[_0xeb34('0x4')]['forcedOwnership']?_0xeb34('0x1a'):''));}else{logger[_0xeb34('0xf')](_0xeb34('0x1b'),this[_0xeb34('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xeb34('0x7')]['bind'](this),0x3e8);}}};Agent[_0xeb34('0xe')]['handleTimeout']=function(_0x4b92ec){if(_[_0xeb34('0x12')](this['realtime'][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']])){return logger[_0xeb34('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xeb34('0x6')]['id'],this['agent']['id']);}else{logger[_0xeb34('0xf')](_0xeb34('0x1c'),this[_0xeb34('0x6')]['id'],this[_0xeb34('0x11')]['id']);util['hideNotification'](this[_0xeb34('0x5')],this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')][_0xeb34('0x16')][this['agent']['id']],null,this[_0xeb34('0x4')]);this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']][_0xeb34('0x1d')]=![];this['realtime']['agents'][this[_0xeb34('0x11')]['id']][_0xeb34('0x18')]=undefined;util[_0xeb34('0x1e')](this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')]['agents'][this[_0xeb34('0x11')]['id']],_0x4b92ec?_0xeb34('0x1f'):_0xeb34('0x20'));}if(!_0x4b92ec){setTimeout(this['push'][_0xeb34('0x9')](this),0x3e8);}};function agent(_0x9e4d5c,_0x35e309,_0x4848d5,_0x23c283){return new Agent(_0x9e4d5c,_0x35e309,_0x4848d5,_0x23c283);}module[_0xeb34('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 18bd67a..2e79158 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 _0xa049=['isAgentAvailable','agents','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','info','[%s][QUEUE]\x20EMPTY','hideNotification','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','isNil','Agents','length','realtime','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xa049,0x1db));var _0x9a04=function(_0x8cea57,_0x290172){_0x8cea57=_0x8cea57-0x0;var _0x25ce1d=_0xa049[_0x8cea57];return _0x25ce1d;};'use strict';var _=require(_0x9a04('0x0'));var uuid=require(_0x9a04('0x1'));var util=require('./util');var logger=require(_0x9a04('0x2'))(_0x9a04('0x3'));var Beepall=function(_0x444fdc,_0x3c975d,_0x3d2f24,_0x2ced45){this[_0x9a04('0x4')]=uuid['v4']();this[_0x9a04('0x5')]=_0x444fdc;this[_0x9a04('0x6')]=_0x3c975d;this['realtime']=_0x3d2f24;this[_0x9a04('0x3')]=_0x2ced45;this[_0x9a04('0x5')]['push'](this[_0x9a04('0x7')][_0x9a04('0x8')](this),this[_0x9a04('0x9')][_0x9a04('0x8')](this));this[_0x9a04('0x5')]['on'](_0x9a04('0xa'),this['handleTimeout'][_0x9a04('0x8')](this));this[_0x9a04('0x5')]['on'](_0x9a04('0xb'),this[_0x9a04('0xc')][_0x9a04('0x8')](this));};Beepall[_0x9a04('0xd')]['push']=function(){this[_0x9a04('0x5')][_0x9a04('0xe')](this[_0x9a04('0x7')]['bind'](this),this[_0x9a04('0x9')][_0x9a04('0x8')](this));};Beepall[_0x9a04('0xd')][_0x9a04('0xc')]=function(_0x7b3cc6){this['handleTimeout'](!![]);};Beepall[_0x9a04('0xd')]['handleRun']=function(_0xef2ada){var _0x83b9ff=!![];if(!_['isNil'](this[_0x9a04('0x6')])&&!_[_0x9a04('0xf')](this['queue'][_0x9a04('0x10')])&&this[_0x9a04('0x6')][_0x9a04('0x10')][_0x9a04('0x11')]>0x0){for(var _0xd86cdb=0x0,_0x54d0c8;_0xd86cdb0x0){for(var _0x190c8c=0x0,_0x395159;_0x190c8c0x0&&_0x41c4c8[_0x3a081e+'CurrentCapacity']>=_0x41c4c8[_0x3a081e+_0xcc6a('0x28')]){writeLog(_0x51be9a,_0x41c4c8,_0x3a081e[_0xcc6a('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xcc6a('0x2a')]=function(_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab){return sendNotification(!![],_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab);};exports[_0xcc6a('0x2b')]=function(_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3){return sendNotification(![],_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3);};exports[_0xcc6a('0x2c')]=writeLog; \ No newline at end of file +var _0x2542=['writeLog','lodash','util','../utils','mustache','../../../../../config/environment','routing','redis','defaults','localhost','emit','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','notification:%s','save','isAgentAvailable','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x2542,0x169));var _0x2254=function(_0x20d5a9,_0x1e0773){_0x20d5a9=_0x20d5a9-0x0;var _0x3e1e25=_0x2542[_0x20d5a9];return _0x3e1e25;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var utils=require(_0x2254('0x2'));var Mustache=require(_0x2254('0x3'));var Redis=require('ioredis');var config=require(_0x2254('0x4'));var logger=require('../../../../../config/logger')(_0x2254('0x5'));config[_0x2254('0x6')]=_[_0x2254('0x7')](config[_0x2254('0x6')],{'host':_0x2254('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2254('0x6')]));function emit(_0xe8ca50,_0x2ee7ee,_0x3c45ec){io['to'](_0xe8ca50)[_0x2254('0x9')](_0x2ee7ee,_0x3c45ec);}function sendNotification(_0x477b47,_0x263459,_0xbf1c18,_0xb395da,_0x1ae415,_0x38fb2b){io['to'](util['format'](_0x2254('0xa'),_0xb395da[_0x2254('0xb')]))[_0x2254('0x9')](_0x2254('0xc'),_0xb395da);var _0x575d58=_0x38fb2b||{};var _0x524fad=_0xbf1c18[_0x2254('0xd')]('.');var _0x3e4213={'uniqueid':_0x263459,'channel':_0x524fad[0x0],'id':_0x524fad[0x1],'title':_0x524fad[0x0]+_0x2254('0xe'),'interactionId':_0x524fad[0x2],'queue':_0x1ae415?_0x1ae415[_0x2254('0xb')]:null,'sound':_0x575d58[_0x2254('0xf')][_0x2254('0x10')],'shake':_0x575d58['account'][_0x2254('0x11')]};try{if(!_0x575d58[_0x2254('0x12')]){_0x575d58['body']={};}if(_0x1ae415){_0x575d58[_0x2254('0x12')][_0x2254('0x13')]=_0x1ae415;}else if(_0x575d58[_0x2254('0x12')][_0x2254('0x13')]){delete _0x575d58[_0x2254('0x12')][_0x2254('0x13')];}_0x3e4213['msg']=utils[_0x2254('0x14')](_0x575d58['account'][_0x2254('0x15')],_0x575d58);}catch(_0x2a2470){_0x3e4213[_0x2254('0x16')]=_0x2254('0x17');logger[_0x2254('0x18')](util[_0x2254('0x19')]('[%s][QUEUE]\x20%s',_0x263459,_0x2a2470['message']));}io['to'](util['format'](_0x2254('0xa'),_0xb395da[_0x2254('0xb')]))[_0x2254('0x9')](util[_0x2254('0x19')](_0x2254('0x1a'),_0x477b47?_0x2254('0x1b'):'remove'),_0x3e4213);}function writeLog(_0x28381e,_0x16148d,_0x906cde){return logger['info'](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x28381e,_0x16148d[_0x2254('0xb')],_0x906cde));}exports[_0x2254('0x1c')]=function(_0xf88b56,_0x56b91e,_0x5713e4,_0x4d8faf){if(_0x56b91e['busy']){writeLog(_0xf88b56,_0x56b91e,'BUSY');return![];}if(!_0x56b91e['online']){writeLog(_0xf88b56,_0x56b91e,_0x2254('0x1d'));return![];}if(_0x56b91e[_0x5713e4+_0x2254('0x1e')]){writeLog(_0xf88b56,_0x56b91e,_0x2254('0x1f'));return![];}if(_0x4d8faf&&_0x56b91e[_0x2254('0x20')](_0x5713e4+_0x2254('0x21'))&&_0x56b91e[_0x2254('0x20')](_0x5713e4+'CurrentCapacity')){if(_0x56b91e[_0x5713e4+'Capacity']>0x0&&_0x56b91e[_0x5713e4+_0x2254('0x22')]>=_0x56b91e[_0x5713e4+'Capacity']){writeLog(_0xf88b56,_0x56b91e,_0x5713e4[_0x2254('0x23')]()+_0x2254('0x24'));return![];}}return!![];};exports[_0x2254('0x25')]=function(_0x3aa0bd,_0x19043b,_0x482688,_0x1a8a0d,_0x2a789b){return sendNotification(!![],_0x3aa0bd,_0x19043b,_0x482688,_0x1a8a0d,_0x2a789b);};exports[_0x2254('0x26')]=function(_0x37af8b,_0x13366a,_0x377c41,_0x3214a7,_0x22e791){return sendNotification(![],_0x37af8b,_0x13366a,_0x377c41,_0x3214a7,_0x22e791);};exports[_0x2254('0x27')]=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 0db3304..7da4617 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 _0xb6b1=['error','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x5005ba,_0x423ed1){var _0x21278c=function(_0x49799b){while(--_0x49799b){_0x5005ba['push'](_0x5005ba['shift']());}};_0x21278c(++_0x423ed1);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xb6b1[_0x4b73a2];return _0x383c66;};'use strict';var schema=require(_0x1b6b('0x0'));var sh=require('shelljs');var _=require(_0x1b6b('0x1'));var utils=require('./utils');var logger=require(_0x1b6b('0x2'))(_0x1b6b('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x1b6b('0x4')}});exports['consequence']=function(_0x2a2c45,_0xb1a61e){return function(_0x2c4040){try{var _0xdbbe22={'command':_0xb1a61e[0x0]};var _0x5870ca=system[_0x1b6b('0x0')](_0xdbbe22,{'typecast':!![]});if(_0x5870ca['length']){logger[_0x1b6b('0x5')]('[%s][SYSTEM]\x20%s',_0x2a2c45,_[_0x1b6b('0x6')](_0x5870ca,_0x1b6b('0x7'))[_0x1b6b('0x8')](',\x20'));logger[_0x1b6b('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2a2c45);_0x2c4040['next']();}else{var _0x475423=this;var _0x43d9f0=utils[_0x1b6b('0xa')](_0xb1a61e[0x0],this);logger[_0x1b6b('0x9')](_0x1b6b('0xb'),_0x2a2c45,_0x43d9f0);sh[_0x1b6b('0xc')](_[_0x1b6b('0xd')](_0x43d9f0),function(_0x5d45dd,_0x360a8b){logger[_0x1b6b('0x9')](_0x1b6b('0xe'),_0x2a2c45,_0x5d45dd);if(_0x5d45dd==0x0){var _0x5abe44=_0x360a8b[_0x1b6b('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xb1a61e[0x1])||_['isEmpty'](_0xb1a61e[0x1])){logger[_0x1b6b('0x9')](_0x1b6b('0x10'),_0x2a2c45);_0x475423[_0x1b6b('0x11')][_0xb1a61e[0x1]]=_0x5abe44;}else{logger[_0x1b6b('0x9')](_0x1b6b('0x12'),_0x2a2c45,_0xb1a61e[0x1],_0x5abe44);_0x475423[_0x1b6b('0x11')][_0xb1a61e[0x1]]=_0x5abe44;}}_0x2c4040[_0x1b6b('0x13')]();});}}catch(_0x553a6d){logger[_0x1b6b('0x5')](_0x1b6b('0x14'),_0x2a2c45,_[_0x1b6b('0x15')](_0x553a6d)?JSON[_0x1b6b('0x16')](_0x553a6d):_0x553a6d);logger['info'](_0x1b6b('0x17'),_0x2a2c45);_0x2c4040[_0x1b6b('0x13')]();}};}; \ No newline at end of file +var _0xf24a=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body'];(function(_0xaf1037,_0x4b5016){var _0x33c39f=function(_0x2cbed7){while(--_0x2cbed7){_0xaf1037['push'](_0xaf1037['shift']());}};_0x33c39f(++_0x4b5016);}(_0xf24a,0x17d));var _0xaf24=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf24a[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xaf24('0x0'));var sh=require(_0xaf24('0x1'));var _=require(_0xaf24('0x2'));var utils=require(_0xaf24('0x3'));var logger=require(_0xaf24('0x4'))(_0xaf24('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0xaf24('0x6')}});exports[_0xaf24('0x7')]=function(_0x162c99,_0x33aa5b){return function(_0x8f121e){try{var _0x49d418={'command':_0x33aa5b[0x0]};var _0x905b93=system[_0xaf24('0x0')](_0x49d418,{'typecast':!![]});if(_0x905b93[_0xaf24('0x8')]){logger[_0xaf24('0x9')](_0xaf24('0xa'),_0x162c99,_[_0xaf24('0xb')](_0x905b93,'message')[_0xaf24('0xc')](',\x20'));logger[_0xaf24('0xd')](_0xaf24('0xe'),_0x162c99);_0x8f121e[_0xaf24('0xf')]();}else{var _0x5c981d=this;var _0x4302d4=utils[_0xaf24('0x10')](_0x33aa5b[0x0],this);logger[_0xaf24('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x162c99,_0x4302d4);sh[_0xaf24('0x11')](_[_0xaf24('0x12')](_0x4302d4),function(_0x237dfa,_0x51958a){logger[_0xaf24('0xd')](_0xaf24('0x13'),_0x162c99,_0x237dfa);if(_0x237dfa==0x0){var _0x5da6da=_0x51958a[_0xaf24('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xaf24('0x15')](_0x33aa5b[0x1])||_[_0xaf24('0x16')](_0x33aa5b[0x1])){logger[_0xaf24('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x162c99);_0x5c981d[_0xaf24('0x17')][_0x33aa5b[0x1]]=_0x5da6da;}else{logger[_0xaf24('0xd')](_0xaf24('0x18'),_0x162c99,_0x33aa5b[0x1],_0x5da6da);_0x5c981d[_0xaf24('0x17')][_0x33aa5b[0x1]]=_0x5da6da;}}_0x8f121e[_0xaf24('0xf')]();});}}catch(_0x225d5f){logger[_0xaf24('0x9')]('[%s][SYSTEM]\x20%s',_0x162c99,_[_0xaf24('0x19')](_0x225d5f)?JSON[_0xaf24('0x1a')](_0x225d5f):_0x225d5f);logger[_0xaf24('0xd')](_0xaf24('0xe'),_0x162c99);_0x8f121e[_0xaf24('0xf')]();}};}; \ 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 8fd44da..2ec0038 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 _0x8b02=['catch','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x13a7a2,_0x4b625c){var _0x3c6964=function(_0x1d6145){while(--_0x1d6145){_0x13a7a2['push'](_0x13a7a2['shift']());}};_0x3c6964(++_0x4b625c);}(_0x8b02,0x1cf));var _0x28b0=function(_0x5e2020,_0xda7587){_0x5e2020=_0x5e2020-0x0;var _0xdd6f0=_0x8b02[_0x5e2020];return _0xdd6f0;};'use strict';var schema=require('validate');var _=require(_0x28b0('0x0'));var rpc={'chatInteraction':require(_0x28b0('0x1')),'openchannelInteraction':require(_0x28b0('0x2')),'smsInteraction':require(_0x28b0('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x28b0('0x4')),'whatsappInteraction':require(_0x28b0('0x5'))};var logger=require('../../../../config/logger')(_0x28b0('0x6'));var tag=schema({'tag':{'type':_0x28b0('0x7'),'required':!![],'message':_0x28b0('0x8')}});exports['consequence']=function(_0x530e67,_0x8bbf24,_0x464d43,_0x51ac42){return function(_0x2d0797){try{var _0xba524f={'tag':_0x8bbf24[0x0]};var _0x5ee760=tag[_0x28b0('0x9')](_0xba524f,{'typecast':!![]});if(_0x5ee760[_0x28b0('0xa')]){logger[_0x28b0('0xb')](_0x28b0('0xc'),_0x530e67,_[_0x28b0('0xd')](_0x5ee760,'message')[_0x28b0('0xe')](',\x20'));logger[_0x28b0('0xf')](_0x28b0('0x10'),_0x530e67);_0x2d0797[_0x28b0('0x11')]();}else{var _0x3d4e72={'ids':[_0x8bbf24[0x0]]};if(rpc[_0x51ac42[_0x28b0('0x12')]+_0x28b0('0x13')]){rpc[_0x51ac42[_0x28b0('0x12')]+'Interaction'][_0x28b0('0x14')](_0x51ac42[_0x28b0('0x15')]['id'],_0x3d4e72)['then'](function(_0x1e2b1e){logger['info'](_0x28b0('0x16'),_0x530e67,_0x8bbf24[0x1],_0x51ac42[_0x28b0('0x12')],_0x51ac42[_0x28b0('0x15')]['id']);})[_0x28b0('0x17')](function(_0x208530){logger[_0x28b0('0xb')]('[%s][TAG]\x20%s',_0x530e67,JSON[_0x28b0('0x18')](_0x208530));logger[_0x28b0('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x530e67);})[_0x28b0('0x19')](function(){_0x2d0797[_0x28b0('0x11')]();});}}}catch(_0x95c738){logger[_0x28b0('0xb')]('[%s][TAG]\x20%s',_0x530e67,_[_0x28b0('0x1a')](_0x95c738)?JSON[_0x28b0('0x18')](_0x95c738):_0x95c738);logger[_0x28b0('0xf')](_0x28b0('0x10'),_0x530e67);_0x2d0797[_0x28b0('0x11')]();}};}; \ No newline at end of file +var _0x07f4=['message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','info','finally','next','isObject','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][TAG]\x20%s','map'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x07f4,0xd6));var _0x407f=function(_0x408b33,_0x26be88){_0x408b33=_0x408b33-0x0;var _0x47357e=_0x07f4[_0x408b33];return _0x47357e;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x407f('0x0')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x407f('0x1')),'mailInteraction':require(_0x407f('0x2')),'faxInteraction':require(_0x407f('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x407f('0x4'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x407f('0x5')}});exports[_0x407f('0x6')]=function(_0x4bb479,_0x18fb3b,_0x711c7b,_0x3aee99){return function(_0x13d600){try{var _0x20667c={'tag':_0x18fb3b[0x0]};var _0x12a1fc=tag[_0x407f('0x7')](_0x20667c,{'typecast':!![]});if(_0x12a1fc[_0x407f('0x8')]){logger['error'](_0x407f('0x9'),_0x4bb479,_[_0x407f('0xa')](_0x12a1fc,_0x407f('0xb'))['join'](',\x20'));logger['info'](_0x407f('0xc'),_0x4bb479);_0x13d600['next']();}else{var _0x51a7d2={'ids':[_0x18fb3b[0x0]]};if(rpc[_0x3aee99[_0x407f('0xd')]+_0x407f('0xe')]){rpc[_0x3aee99[_0x407f('0xd')]+'Interaction'][_0x407f('0xf')](_0x3aee99[_0x407f('0x10')]['id'],_0x51a7d2)['then'](function(_0x5c052e){logger['info'](_0x407f('0x11'),_0x4bb479,_0x18fb3b[0x1],_0x3aee99[_0x407f('0xd')],_0x3aee99[_0x407f('0x10')]['id']);})[_0x407f('0x12')](function(_0x3db99d){logger[_0x407f('0x13')]('[%s][TAG]\x20%s',_0x4bb479,JSON[_0x407f('0x14')](_0x3db99d));logger[_0x407f('0x15')](_0x407f('0xc'),_0x4bb479);})[_0x407f('0x16')](function(){_0x13d600[_0x407f('0x17')]();});}}}catch(_0x11539f){logger[_0x407f('0x13')](_0x407f('0x9'),_0x4bb479,_[_0x407f('0x18')](_0x11539f)?JSON[_0x407f('0x14')](_0x11539f):_0x11539f);logger[_0x407f('0x15')](_0x407f('0xc'),_0x4bb479);_0x13d600[_0x407f('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 2767002..6aec64f 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4639=['params','utf8','POST','then','parse','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s','isObject','stringify','stop','next','request-promise','../../../../config/logger','routing','lodash','replace','includes','urlOnAnswer','?params=','title','jsonrpc','method','login'];(function(_0xc3aae7,_0x3bfa91){var _0x1f365a=function(_0x465838){while(--_0x465838){_0xc3aae7['push'](_0xc3aae7['shift']());}};_0x1f365a(++_0x3bfa91);}(_0x4639,0x153));var _0x9463=function(_0x2483f6,_0x70bc75){_0x2483f6=_0x2483f6-0x0;var _0x44f7b9=_0x4639[_0x2483f6];return _0x44f7b9;};'use strict';var rp=require(_0x9463('0x0'));var logger=require(_0x9463('0x1'))(_0x9463('0x2'));var _=require(_0x9463('0x3'));var arr=[];exports['consequence']=function(_0x48ed44,_0xfab252){return function(_0x567577){var _0x387fe3=_0xfab252[0xa];var _0x29f000=_0xfab252[0xb];var _0x5a7a42=_0xfab252[0xc];var _0x3cd905=_0xfab252[0xd];var _0x341c9c=_0xfab252[0xe];var _0x2b3a8a=_0xfab252[0xf][_0x9463('0x4')](/\n/g,'\x20-\x20');var _0x5926b5=_0xfab252[0x10][_0x9463('0x4')](/\n/g,'\x20');if(!arr[_0x9463('0x5')](_0x29f000)){arr['push'](_0x29f000);var _0x2a2d76=_0xfab252[0x3];var _0x64ea3e=_0xfab252[0x4];var _0x4b9317=_0xfab252[0x1];var _0x57d7c5=_0xfab252[0x0];var _0x2cfbf1={};_0x2cfbf1[_0x9463('0x6')]=_0xfab252[0x8]+_0x9463('0x7')+_0x5a7a42+'|'+_0x387fe3+'|'+_0x3cd905+'|'+_0x29f000+'|'+_0x341c9c;_0x2cfbf1['urlOnRing']=_0xfab252[0x7]+_0x9463('0x7')+_0x5a7a42+'|'+_0x387fe3+'|'+_0x3cd905+'|'+_0x29f000+'|'+_0x341c9c+'|'+_0x2b3a8a+'|'+_0x5926b5;_0x2cfbf1[_0x9463('0x8')]=_0xfab252[0x9];var _0x2837ee={};_0x2837ee[_0x9463('0x9')]='2.0';_0x2837ee[_0x9463('0xa')]=_0x9463('0xb');var _0x457d7c=[];_0x457d7c['push'](_0xfab252[0x2]);_0x457d7c['push'](_0xfab252[0x5]);_0x457d7c['push'](_0xfab252[0x6]);_0x2837ee[_0x9463('0xc')]=_0x457d7c;_0x2837ee['id']=0x1;var _0x50acc8=JSON['stringify'](_0x2837ee);var _0x373eca={'encoding':_0x9463('0xd'),'method':_0x9463('0xe'),'timeout':0x2710,'url':_0x2a2d76,'headers':{'Content-Type':'application/json-rpc'},'body':_0x50acc8};return rp(_0x373eca)[_0x9463('0xf')](function(_0x473812){const _0x1781dd=JSON[_0x9463('0x10')](_0x473812);if(!_0x1781dd['result']['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x98a976=_0x29f000;var _0xc9b488='channelId='+_0x4b9317+_0x9463('0x11')+_0x57d7c5+_0x9463('0x12')+_0x98a976+'&data='+JSON['stringify'](_0x2cfbf1);var _0x5ee08c=_0x64ea3e+'?'+_0xc9b488;return rp(_0x5ee08c);})[_0x9463('0xf')](function(_0x48b43b){logger[_0x9463('0x13')](_0x9463('0x14'),_0x48ed44,_0x48b43b);_0x567577['stop']();})['catch'](function(_0x26bac1){logger[_0x9463('0x15')](_0x9463('0x16'),_0x48ed44,_[_0x9463('0x17')](_0x26bac1)?JSON[_0x9463('0x18')](_0x26bac1):_0x26bac1);_0x567577[_0x9463('0x19')]();});}else{logger[_0x9463('0x13')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x48ed44);_0x567577[_0x9463('0x1a')]();}};}; \ No newline at end of file +var _0xb918=['result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','push','stringify','then','parse'];(function(_0x23af31,_0x8a1add){var _0x49b82f=function(_0x5d08d5){while(--_0x5d08d5){_0x23af31['push'](_0x23af31['shift']());}};_0x49b82f(++_0x8a1add);}(_0xb918,0x84));var _0x8b91=function(_0x2a9051,_0x2f0b1d){_0x2a9051=_0x2a9051-0x0;var _0x3eb69f=_0xb918[_0x2a9051];return _0x3eb69f;};'use strict';var rp=require(_0x8b91('0x0'));var logger=require(_0x8b91('0x1'))(_0x8b91('0x2'));var _=require('lodash');var arr=[];exports[_0x8b91('0x3')]=function(_0xbdf290,_0x16b336){return function(_0x963eaa){var _0x5f2c94=_0x16b336[0xa];var _0x1299e0=_0x16b336[0xb];var _0x4c0312=_0x16b336[0xc];var _0x2a66ac=_0x16b336[0xd];var _0x15aac1=_0x16b336[0xe];var _0x5ac9b8=_0x16b336[0xf][_0x8b91('0x4')](/\n/g,_0x8b91('0x5'));var _0x5d8c50=_0x16b336[0x10][_0x8b91('0x4')](/\n/g,'\x20');if(!arr[_0x8b91('0x6')](_0x1299e0)){arr['push'](_0x1299e0);var _0x384400=_0x16b336[0x3];var _0x51726e=_0x16b336[0x4];var _0x4ad64e=_0x16b336[0x1];var _0x295652=_0x16b336[0x0];var _0x41d7ab={};_0x41d7ab[_0x8b91('0x7')]=_0x16b336[0x8]+'?params='+_0x4c0312+'|'+_0x5f2c94+'|'+_0x2a66ac+'|'+_0x1299e0+'|'+_0x15aac1;_0x41d7ab['urlOnRing']=_0x16b336[0x7]+_0x8b91('0x8')+_0x4c0312+'|'+_0x5f2c94+'|'+_0x2a66ac+'|'+_0x1299e0+'|'+_0x15aac1+'|'+_0x5ac9b8+'|'+_0x5d8c50;_0x41d7ab[_0x8b91('0x9')]=_0x16b336[0x9];var _0xd9d92={};_0xd9d92[_0x8b91('0xa')]=_0x8b91('0xb');_0xd9d92[_0x8b91('0xc')]=_0x8b91('0xd');var _0x360fcb=[];_0x360fcb[_0x8b91('0xe')](_0x16b336[0x2]);_0x360fcb['push'](_0x16b336[0x5]);_0x360fcb[_0x8b91('0xe')](_0x16b336[0x6]);_0xd9d92['params']=_0x360fcb;_0xd9d92['id']=0x1;var _0x45b179=JSON[_0x8b91('0xf')](_0xd9d92);var _0x5f1b85={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x384400,'headers':{'Content-Type':'application/json-rpc'},'body':_0x45b179};return rp(_0x5f1b85)[_0x8b91('0x10')](function(_0x40e081){const _0x36e409=JSON[_0x8b91('0x11')](_0x40e081);if(!_0x36e409[_0x8b91('0x12')][_0x8b91('0x13')]){throw new Error(_0x8b91('0x14'));}var _0x9229e4=_0x1299e0;var _0x15bb78='channelId='+_0x4ad64e+_0x8b91('0x15')+_0x295652+_0x8b91('0x16')+_0x9229e4+'&data='+JSON[_0x8b91('0xf')](_0x41d7ab);var _0x506de1=_0x51726e+'?'+_0x15bb78;return rp(_0x506de1);})[_0x8b91('0x10')](function(_0xa36ae3){logger[_0x8b91('0x17')](_0x8b91('0x18'),_0xbdf290,_0xa36ae3);_0x963eaa[_0x8b91('0x19')]();})[_0x8b91('0x1a')](function(_0x3b73f2){logger[_0x8b91('0x1b')](_0x8b91('0x1c'),_0xbdf290,_['isObject'](_0x3b73f2)?JSON['stringify'](_0x3b73f2):_0x3b73f2);_0x963eaa['stop']();});}else{logger[_0x8b91('0x17')](_0x8b91('0x1d'),_0xbdf290);_0x963eaa['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 ce8bb15..4367395 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x17882d,_0x273e6e){var _0x114475=function(_0x625a6c){while(--_0x625a6c){_0x17882d['push'](_0x17882d['shift']());}};_0x114475(++_0x273e6e);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x53e01d,_0x34354b){var _0x2daf42=function(_0x57b3d5){while(--_0x57b3d5){_0x53e01d['push'](_0x53e01d['shift']());}};_0x2daf42(++_0x34354b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 48651e7..dc88c58 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 _0xcf14=['amazonlex','tag','TagId','tvox','getMustacheRender','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','agents','busyQueue','end','QueueReport','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','lodash','path','jayson/promise','uuid','./applications/utils','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','push','slice','dialogflow','split','dialogflowv2'];(function(_0x9ccf99,_0x5381b8){var _0x4e5882=function(_0x4b6cb5){while(--_0x4b6cb5){_0x9ccf99['push'](_0x9ccf99['shift']());}};_0x4e5882(++_0x5381b8);}(_0xcf14,0xa1));var _0x4cf1=function(_0x4ee023,_0x2c7078){_0x4ee023=_0x4ee023-0x0;var _0x153223=_0xcf14[_0x4ee023];return _0x153223;};'use strict';var _=require(_0x4cf1('0x0'));var util=require('util');var path=require(_0x4cf1('0x1'));var fs=require('fs');var jayson=require(_0x4cf1('0x2'));var BPromise=require('bluebird');var uuid=require(_0x4cf1('0x3'));var utils=require(_0x4cf1('0x4'));var config=require(_0x4cf1('0x5'));var logger=require(_0x4cf1('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x4cf1('0x7')),'mailQueueReport':require(_0x4cf1('0x8')),'chatQueueReport':require(_0x4cf1('0x9')),'smsQueueReport':require(_0x4cf1('0xa')),'faxQueueReport':require(_0x4cf1('0xb')),'whatsappQueueReport':require(_0x4cf1('0xc'))};var RuleEngine=require(_0x4cf1('0xd'));function getId(_0x50273f,_0x4094d4,_0x208cdd){return util[_0x4cf1('0xe')](_0x4cf1('0xf'),_0x50273f,_0x4094d4||0x0,_0x208cdd||0x0);}function getIntervals(_0x2736c7,_0x3722fa){var _0x207aea=[];if(!_[_0x4cf1('0x10')](_0x3722fa[_0x4cf1('0x11')])&&!_[_0x4cf1('0x10')](_0x2736c7[_0x3722fa[_0x4cf1('0x11')]])&&!_[_0x4cf1('0x10')](_0x2736c7[_0x3722fa[_0x4cf1('0x11')]][_0x4cf1('0x12')])){_0x207aea=_['map'](_0x2736c7[_0x3722fa[_0x4cf1('0x11')]][_0x4cf1('0x12')],_0x4cf1('0x13'));}else if(!_[_0x4cf1('0x10')](_0x3722fa[_0x4cf1('0x13')])){_0x207aea=[_0x3722fa[_0x4cf1('0x13')]];}return _0x207aea;}exports[_0x4cf1('0x14')]=function(_0x3f365c){_0x3f365c[_0x4cf1('0x15')]={};return new BPromise(function(_0x6c10f9,_0x3e320f){var _0xec2510={'Start':function(_0xcfa115){var _0x2a8cf7=this;return new Promise(function(_0xe257a5,_0x4fa520){if(_0xcfa115){try{var _0x3e3cd8=[];var _0x527dca=getId(_0xcfa115[_0x4cf1('0x16')],_0xcfa115[_0x4cf1('0x17')]?_0xcfa115[_0x4cf1('0x17')]['id']:0x0,_0xcfa115[_0x4cf1('0x18')]?_0xcfa115[_0x4cf1('0x18')]['id']:0x0);if(_0xcfa115['applications']&&_[_0x4cf1('0x19')](_0xcfa115[_0x4cf1('0x1a')])&&_0xcfa115[_0x4cf1('0x1a')][_0x4cf1('0x1b')]){for(var _0x52b5a2=0x0;_0x52b5a2<_0xcfa115['applications'][_0x4cf1('0x1b')];_0x52b5a2+=0x1){var _0x83ad6a=_0xcfa115['applications'][_0x52b5a2];if(fs[_0x4cf1('0x1c')](path[_0x4cf1('0x1d')](__dirname,_0x4cf1('0x1a'),_0x83ad6a[_0x4cf1('0x1e')]+'.js'))){var _0x3469ac=[];switch(_0x83ad6a[_0x4cf1('0x1e')][_0x4cf1('0x1f')]()){case _0x4cf1('0x20'):var _0x21eb0c=_0x83ad6a[_0x4cf1('0x21')]['split'](',');if(_0xcfa115[_0x4cf1('0x16')]==='mail'){_0x3469ac[_0x4cf1('0x22')](_0x21eb0c[0x0]);_0x3469ac[_0x4cf1('0x22')](_0x21eb0c[0x1]);_0x3469ac[_0x4cf1('0x22')](_0x21eb0c[_0x4cf1('0x23')](0x2,_0x21eb0c[_0x4cf1('0x1b')])[_0x4cf1('0x1d')](','));}else{_0x3469ac[_0x4cf1('0x22')](_0x21eb0c[0x0]);_0x3469ac[_0x4cf1('0x22')](_0x21eb0c[_0x4cf1('0x23')](0x1,_0x21eb0c[_0x4cf1('0x1b')])[_0x4cf1('0x1d')](','));}break;case _0x4cf1('0x24'):var _0x2a17ce=_0x83ad6a['appdata'][_0x4cf1('0x25')](',');_0x3469ac[_0x4cf1('0x22')](_0x2a17ce[0x0]);_0x3469ac[_0x4cf1('0x22')](_0x2a17ce[0x1]);_0x3469ac[_0x4cf1('0x22')](_0x2a17ce[_0x4cf1('0x23')](0x2,_0x2a17ce[_0x4cf1('0x1b')])[_0x4cf1('0x1d')](','));break;case _0x4cf1('0x26'):var _0x2c0803=_0x83ad6a[_0x4cf1('0x21')][_0x4cf1('0x25')](',');_0x3469ac['push'](_0x2c0803[0x0]);_0x3469ac[_0x4cf1('0x22')](_0x2c0803[0x1]);_0x3469ac[_0x4cf1('0x22')](_0x2c0803[0x2]);_0x3469ac['push'](_0x2c0803[0x3]);_0x3469ac[_0x4cf1('0x22')](_0x2c0803[_0x4cf1('0x23')](0x4,_0x2c0803[_0x4cf1('0x1b')])[_0x4cf1('0x1d')](','));break;case _0x4cf1('0x27'):var _0x2f4b60=_0x83ad6a['appdata'][_0x4cf1('0x25')](',');_0x3469ac['push'](_0x2f4b60[0x0]);_0x3469ac[_0x4cf1('0x22')](_0x2f4b60[0x1]);_0x3469ac[_0x4cf1('0x22')](_0x2f4b60[0x2]);_0x3469ac[_0x4cf1('0x22')](_0x2f4b60[0x3]);_0x3469ac[_0x4cf1('0x22')](_0x2f4b60[_0x4cf1('0x23')](0x4,_0x2f4b60['length'])[_0x4cf1('0x1d')](','));break;case'message':_0x3469ac['push'](_0x83ad6a['appdata']);break;case _0x4cf1('0x28'):_0x3469ac[_0x4cf1('0x22')](_0x83ad6a[_0x4cf1('0x29')]);_0x3469ac[_0x4cf1('0x22')](_0x83ad6a[_0x4cf1('0x21')]);break;case _0x4cf1('0x2a'):var _0x37f6a2=utils[_0x4cf1('0x2b')](_0xcfa115['account']['notificationTemplate'],_0xcfa115);var _0x48d93a=_0x83ad6a[_0x4cf1('0x21')][_0x4cf1('0x25')](',');_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x0]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x1]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x2]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x3]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x4]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x5]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x6]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x7]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x8]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0x9]);_0x3469ac[_0x4cf1('0x22')](_0x48d93a[0xa]);_0x3469ac['push'](_0xcfa115['interaction']['id']);_0x3469ac[_0x4cf1('0x22')](_0xcfa115[_0x4cf1('0x17')]['id']);_0x3469ac[_0x4cf1('0x22')](_0x83ad6a[_0x4cf1('0x2c')]);_0x3469ac[_0x4cf1('0x22')](_0xcfa115[_0x4cf1('0x18')][_0x4cf1('0x2d')]);_0x3469ac['push'](_0xcfa115[_0x4cf1('0x2e')][_0x4cf1('0x2e')]);_0x3469ac[_0x4cf1('0x22')](_0x37f6a2);break;default:_0x3469ac=_[_0x4cf1('0x10')](_0x83ad6a[_0x4cf1('0x21')])?[]:_0x83ad6a[_0x4cf1('0x21')]['split'](',');}var _0x5348f5={'id':util[_0x4cf1('0xe')](_0x4cf1('0x2f'),_0x527dca,_0x83ad6a['id'],_0x83ad6a[_0x4cf1('0x1e')]),'condition':require(_0x4cf1('0x30'))[_0x4cf1('0x31')](_0x527dca,getIntervals(_0x3f365c[_0x4cf1('0x32')],_0x83ad6a),_0x3f365c),'consequence':require(_0x4cf1('0x33')+_0x83ad6a[_0x4cf1('0x1e')])[_0x4cf1('0x34')](_0x527dca,_0x3469ac,_0x3f365c,_0xcfa115),'p':_0x83ad6a[_0x4cf1('0x35')]||0x0};logger[_0x4cf1('0x36')]('Push\x20new\x20rule',_0x5348f5['id'],_0x4cf1('0x37'),getIntervals(_0x3f365c[_0x4cf1('0x32')],_0x83ad6a)['join'](_0x4cf1('0x38')));_0x3e3cd8[_0x4cf1('0x22')](_0x5348f5);}else{logger[_0x4cf1('0x39')](_0x4cf1('0x3a'),path[_0x4cf1('0x1d')](__dirname,'applications',_0x83ad6a[_0x4cf1('0x1e')]+'.js'));}}_0x3f365c['rules'][_0x527dca]=new RuleEngine(_0x3e3cd8);_0x3f365c[_0x4cf1('0x15')][_0x527dca][_0x4cf1('0x3b')](_0xcfa115,function(_0x17f59e){logger[_0x4cf1('0x36')](_0x4cf1('0x3c'),JSON[_0x4cf1('0x3d')](_0x17f59e[_0x4cf1('0x3e')]));if(_0x3f365c[_0x4cf1('0x15')][_0x527dca]){_0x3f365c[_0x4cf1('0x15')][_0x527dca][_0x4cf1('0x3f')](_0x4cf1('0x40'));}});return _0xe257a5({'code':0xc8,'message':_0xcfa115});}else{logger[_0x4cf1('0x36')](_0x4cf1('0x41'));return _0xe257a5({'code':0xc8,'message':_0xcfa115});}}catch(_0x2133fe){logger[_0x4cf1('0x39')](_0x2133fe[_0x4cf1('0x42')]);return _0x4fa520(_0x2a8cf7['error'](0x1f4,_0x2133fe));}}return _0x4fa520(_0x4cf1('0x43'));});},'AcceptMessage':function(_0x2aa51e){var _0x1dbabe=this;return new Promise(function(_0x1ecde5,_0x38d584){if(_0x2aa51e[_0x4cf1('0x44')]&&_0x2aa51e[_0x4cf1('0x44')]['id']){if(_0x3f365c['agents'][_0x2aa51e[_0x4cf1('0x44')]['id']]){_0x3f365c['agents'][_0x2aa51e[_0x4cf1('0x44')]['id']][_0x4cf1('0x45')]=![];_0x3f365c[_0x4cf1('0x46')][_0x2aa51e[_0x4cf1('0x44')]['id']][_0x4cf1('0x47')]=undefined;}}if(_0x2aa51e[_0x4cf1('0x17')]&&_0x2aa51e['message']['id']){try{var _0x4fb90b=getId(_0x2aa51e['channel'],_0x2aa51e[_0x4cf1('0x17')]?_0x2aa51e[_0x4cf1('0x17')]['id']:0x0,_0x2aa51e[_0x4cf1('0x18')]?_0x2aa51e['interaction']['id']:0x0);if(_0x3f365c[_0x4cf1('0x15')][_0x4fb90b]){_0x3f365c[_0x4cf1('0x15')][_0x4fb90b]['emit'](_0x4cf1('0x48'));if(rpc[_0x2aa51e[_0x4cf1('0x16')]+_0x4cf1('0x49')]){rpc[_0x2aa51e[_0x4cf1('0x16')]+_0x4cf1('0x49')]['update'](_0x4fb90b,{'UserId':_0x2aa51e[_0x4cf1('0x17')][_0x4cf1('0x4a')]})[_0x4cf1('0x4b')](function(_0x77418c){logger[_0x4cf1('0x39')]('error\x20update\x20queue\x20report');});}}return _0x1ecde5({'code':0xc8,'message':_0x2aa51e});}catch(_0x3a4723){logger[_0x4cf1('0x39')](_0x3a4723['stack']);return _0x38d584(_0x1dbabe['error'](0x1f4,_0x3a4723));}}logger['error'](_0x4cf1('0x4c'));return _0x38d584(_0x1dbabe[_0x4cf1('0x39')](0x1f4,_0x4cf1('0x4c')));});},'RejectMessage':function(_0x5c26ba){var _0x35049a=this;return new Promise(function(_0x31e3db,_0x296065){if(_0x5c26ba['agent']&&_0x5c26ba[_0x4cf1('0x44')]['id']){try{if(_0x3f365c[_0x4cf1('0x46')][_0x5c26ba[_0x4cf1('0x44')]['id']]){_0x3f365c[_0x4cf1('0x46')][_0x5c26ba['agent']['id']][_0x4cf1('0x45')]=![];_0x3f365c[_0x4cf1('0x46')][_0x5c26ba['agent']['id']][_0x4cf1('0x47')]=undefined;}return _0x31e3db({'code':0xc8,'message':_0x5c26ba});}catch(_0x3e3218){logger[_0x4cf1('0x39')](_0x3e3218['stack']);return _0x296065(_0x35049a[_0x4cf1('0x39')](0x1f4,_0x3e3218));}}logger[_0x4cf1('0x39')](_0x4cf1('0x4c'));return _0x296065(_0x35049a[_0x4cf1('0x39')](0x1f4,_0x4cf1('0x4c')));});},'AbandonInteraction':function(_0x2e93cc){var _0x2d161f=this;return new Promise(function(_0x574411,_0x5bc4c9){if(_0x2e93cc[_0x4cf1('0x16')]&&_0x2e93cc['interaction']&&_0x2e93cc[_0x4cf1('0x18')]['id']){try{var _0x39b15a=getId(_0x2e93cc[_0x4cf1('0x16')],_0x2e93cc[_0x4cf1('0x17')]?_0x2e93cc[_0x4cf1('0x17')]['id']:0x0,_0x2e93cc[_0x4cf1('0x18')]?_0x2e93cc[_0x4cf1('0x18')]['id']:0x0);if(_0x3f365c['rules'][_0x39b15a]){_0x3f365c[_0x4cf1('0x15')][_0x39b15a][_0x4cf1('0x3f')]('end');}return _0x574411({'code':0xc8,'message':_0x2e93cc});}catch(_0x38aa06){logger[_0x4cf1('0x39')](_0x38aa06[_0x4cf1('0x42')]);return _0x5bc4c9(_0x2d161f['error'](0x1f4,_0x38aa06));}}logger[_0x4cf1('0x39')](_0x4cf1('0x4c'));return _0x5bc4c9(_0x2d161f[_0x4cf1('0x39')](0x1f4,_0x4cf1('0x4c')));});},'AgentCapacity':function(_0x4a31cd){var _0x4900a6=this;return new Promise(function(_0x3fe67f,_0x304ca7){if(_0x3f365c['agents'][_0x4cf1('0x4d')](_0x4a31cd['id'])){for(var _0xf04cd1 in _0x4a31cd[_0x4cf1('0x4e')]){if(_0x4a31cd['capacity'][_0x4cf1('0x4d')](_0xf04cd1)){if(_0x3f365c[_0x4cf1('0x46')][_0x4a31cd['id']][_0x4cf1('0x4d')](_0xf04cd1+'CurrentCapacity')){_0x3f365c[_0x4cf1('0x46')][_0x4a31cd['id']][_0xf04cd1+_0x4cf1('0x4f')]=parseInt(_0x4a31cd[_0x4cf1('0x4e')][_0xf04cd1],0xa);}}}_0x3f365c[_0x4cf1('0x46')][_0x4a31cd['id']]['updateRealtime']();return _0x3fe67f({'code':0xc8,'message':_0x3f365c[_0x4cf1('0x46')][_0x4a31cd['id']]});}else{return _0x304ca7(_0x4900a6['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xc97376){return new Promise(function(_0x32a71a,_0x18cc9f){var _0x1bf6a9=_['values'](_0x3f365c[_0x4cf1('0x46')]);_0x32a71a({'count':_0x1bf6a9[_0x4cf1('0x1b')],'rows':_0x1bf6a9});});},'ChatQueues':function(_0x35001f){return new Promise(function(_0x4ca89f,_0x5ce4da){var _0x7feee=[];for(var _0x3cbab0 in _0x3f365c['chatQueues']){if(_0x3f365c[_0x4cf1('0x50')]['hasOwnProperty'](_0x3cbab0)){var _0x2f8d03=_0x3f365c[_0x4cf1('0x50')][_0x3cbab0];var _0x5138b4={'id':_0x2f8d03['id'],'available':_0x2f8d03[_0x4cf1('0x51')],'loggedIn':_0x2f8d03[_0x4cf1('0x52')],'name':_0x2f8d03['name'],'paused':_0x2f8d03[_0x4cf1('0x53')],'waiting':_0x2f8d03[_0x4cf1('0x54')]};_0x7feee[_0x4cf1('0x22')](_0x5138b4);}}_0x4ca89f({'count':_0x7feee[_0x4cf1('0x1b')],'rows':_0x7feee});});},'MailQueues':function(_0x332886){return new Promise(function(_0x5cebfc,_0x3989ff){var _0x4d2977=[];for(var _0x49603d in _0x3f365c[_0x4cf1('0x55')]){if(_0x3f365c[_0x4cf1('0x55')][_0x4cf1('0x4d')](_0x49603d)){var _0x531898=_0x3f365c[_0x4cf1('0x55')][_0x49603d];var _0x427da1={'id':_0x531898['id'],'available':_0x531898[_0x4cf1('0x51')],'loggedIn':_0x531898[_0x4cf1('0x52')],'name':_0x531898[_0x4cf1('0x56')],'paused':_0x531898[_0x4cf1('0x53')],'waiting':_0x531898[_0x4cf1('0x54')]};_0x4d2977['push'](_0x427da1);}}_0x5cebfc({'count':_0x4d2977[_0x4cf1('0x1b')],'rows':_0x4d2977});});},'OpenchannelQueues':function(_0x1f840b){return new Promise(function(_0x38ab3a,_0x5b19ec){var _0x1e831f=[];for(var _0x40bee0 in _0x3f365c[_0x4cf1('0x57')]){if(_0x3f365c[_0x4cf1('0x57')]['hasOwnProperty'](_0x40bee0)){var _0x3d3c4f=_0x3f365c[_0x4cf1('0x57')][_0x40bee0];var _0x4b0304={'id':_0x3d3c4f['id'],'available':_0x3d3c4f['available'],'loggedIn':_0x3d3c4f['loggedIn'],'name':_0x3d3c4f[_0x4cf1('0x56')],'paused':_0x3d3c4f[_0x4cf1('0x53')],'waiting':_0x3d3c4f[_0x4cf1('0x54')]};_0x1e831f['push'](_0x4b0304);}}_0x38ab3a({'count':_0x1e831f['length'],'rows':_0x1e831f});});},'SmsQueues':function(_0x4dff1c){return new Promise(function(_0x387781,_0x2cee5f){var _0xcfa9b8=[];for(var _0x21a26b in _0x3f365c[_0x4cf1('0x58')]){if(_0x3f365c[_0x4cf1('0x58')]['hasOwnProperty'](_0x21a26b)){var _0x123d5a=_0x3f365c['smsQueues'][_0x21a26b];var _0x4987e2={'id':_0x123d5a['id'],'available':_0x123d5a[_0x4cf1('0x51')],'loggedIn':_0x123d5a[_0x4cf1('0x52')],'name':_0x123d5a[_0x4cf1('0x56')],'paused':_0x123d5a[_0x4cf1('0x53')],'waiting':_0x123d5a['waiting']};_0xcfa9b8['push'](_0x4987e2);}}_0x387781({'count':_0xcfa9b8['length'],'rows':_0xcfa9b8});});},'FaxQueues':function(_0x5df18e){return new Promise(function(_0xcf5d72,_0x3e816d){var _0x472086=[];for(var _0x38f101 in _0x3f365c['faxQueues']){if(_0x3f365c[_0x4cf1('0x59')][_0x4cf1('0x4d')](_0x38f101)){var _0x4ac9b6=_0x3f365c['faxQueues'][_0x38f101];var _0x31345a={'id':_0x4ac9b6['id'],'available':_0x4ac9b6[_0x4cf1('0x51')],'loggedIn':_0x4ac9b6[_0x4cf1('0x52')],'name':_0x4ac9b6[_0x4cf1('0x56')],'paused':_0x4ac9b6[_0x4cf1('0x53')],'waiting':_0x4ac9b6[_0x4cf1('0x54')]};_0x472086[_0x4cf1('0x22')](_0x31345a);}}_0xcf5d72({'count':_0x472086['length'],'rows':_0x472086});});},'WhatsappQueues':function(_0x5323c4){return new Promise(function(_0x3689cc,_0x3a0ed6){var _0x3e4a03=[];for(var _0x19be88 in _0x3f365c[_0x4cf1('0x5a')]){if(_0x3f365c['whatsappQueues'][_0x4cf1('0x4d')](_0x19be88)){var _0x233293=_0x3f365c['whatsappQueues'][_0x19be88];var _0x2f58d4={'id':_0x233293['id'],'available':_0x233293[_0x4cf1('0x51')],'loggedIn':_0x233293[_0x4cf1('0x52')],'name':_0x233293[_0x4cf1('0x56')],'paused':_0x233293['paused'],'waiting':_0x233293[_0x4cf1('0x54')]};_0x3e4a03[_0x4cf1('0x22')](_0x2f58d4);}}_0x3689cc({'count':_0x3e4a03[_0x4cf1('0x1b')],'rows':_0x3e4a03});});},'ChatQueuesWaitingInteractions':function(_0x276913){return new Promise(function(_0x830af9,_0x52cb5c){var _0x2ed0e5=_[_0x4cf1('0x5b')](_0x3f365c[_0x4cf1('0x5c')]);_0x830af9({'count':_0x2ed0e5[_0x4cf1('0x1b')],'rows':_0x2ed0e5});});},'MailQueuesWaitingInteractions':function(_0x13d24a){return new Promise(function(_0x21c13d,_0x2587f5){var _0x2a93d6=_['values'](_0x3f365c['mailQueuesWaitingInteractions']);_0x21c13d({'count':_0x2a93d6[_0x4cf1('0x1b')],'rows':_0x2a93d6});});},'OpenchannelQueuesWaitingInteractions':function(_0x5076e8){return new Promise(function(_0x1fce14,_0x278d2f){var _0x4d1ce3=_[_0x4cf1('0x5b')](_0x3f365c[_0x4cf1('0x5d')]);_0x1fce14({'count':_0x4d1ce3[_0x4cf1('0x1b')],'rows':_0x4d1ce3});});},'SmsQueuesWaitingInteractions':function(_0x250d1e){return new Promise(function(_0x5b6053,_0x171faf){var _0x3d8a82=_['values'](_0x3f365c[_0x4cf1('0x5e')]);_0x5b6053({'count':_0x3d8a82['length'],'rows':_0x3d8a82});});},'FaxQueuesWaitingInteractions':function(_0x24bfbe){return new Promise(function(_0x312dc2,_0x593074){var _0x33a0d4=_[_0x4cf1('0x5b')](_0x3f365c[_0x4cf1('0x5f')]);_0x312dc2({'count':_0x33a0d4['length'],'rows':_0x33a0d4});});},'WhatsappQueuesWaitingInteractions':function(_0x5922b3){return new Promise(function(_0x20d6c2,_0x3d68b7){var _0x5a5327=_[_0x4cf1('0x5b')](_0x3f365c[_0x4cf1('0x60')]);_0x20d6c2({'count':_0x5a5327[_0x4cf1('0x1b')],'rows':_0x5a5327});});}};var _0x12d7b1=jayson[_0x4cf1('0x61')](_0xec2510)[_0x4cf1('0x62')]();_0x12d7b1['on'](_0x4cf1('0x39'),function(_0x24b665){logger[_0x4cf1('0x39')](JSON[_0x4cf1('0x3d')](_0x24b665));return _0x3e320f(_0x24b665);});_0x12d7b1[_0x4cf1('0x14')](0x232c,_0x4cf1('0x63'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x6c10f9('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x13c0=['agents','busyQueue','emit','end','QueueReport','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','length','existsSync','app','appdata','split','mail','push','join','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','info','\x20|\x20','error','.js','execute','complete','stack','routing\x20is\x20empty','agent'];(function(_0x537eeb,_0x2bc2d7){var _0x19625d=function(_0x13c118){while(--_0x13c118){_0x537eeb['push'](_0x537eeb['shift']());}};_0x19625d(++_0x2bc2d7);}(_0x13c0,0x79));var _0x013c=function(_0x65a0db,_0x55c5a0){_0x65a0db=_0x65a0db-0x0;var _0x987620=_0x13c0[_0x65a0db];return _0x987620;};'use strict';var _=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var path=require(_0x013c('0x2'));var fs=require('fs');var jayson=require(_0x013c('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0x013c('0x4'));var logger=require(_0x013c('0x5'))(_0x013c('0x6'));var rpc={'openchannelQueueReport':require(_0x013c('0x7')),'mailQueueReport':require(_0x013c('0x8')),'chatQueueReport':require(_0x013c('0x9')),'smsQueueReport':require(_0x013c('0xa')),'faxQueueReport':require(_0x013c('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x593053,_0x27c830,_0x164605){return util['format'](_0x013c('0xc'),_0x593053,_0x27c830||0x0,_0x164605||0x0);}function getIntervals(_0xa99b50,_0x371681){var _0x3fa7ff=[];if(!_[_0x013c('0xd')](_0x371681[_0x013c('0xe')])&&!_[_0x013c('0xd')](_0xa99b50[_0x371681[_0x013c('0xe')]])&&!_[_0x013c('0xd')](_0xa99b50[_0x371681[_0x013c('0xe')]]['Intervals'])){_0x3fa7ff=_['map'](_0xa99b50[_0x371681[_0x013c('0xe')]][_0x013c('0xf')],_0x013c('0x10'));}else if(!_[_0x013c('0xd')](_0x371681['interval'])){_0x3fa7ff=[_0x371681[_0x013c('0x10')]];}return _0x3fa7ff;}exports[_0x013c('0x11')]=function(_0xcfe81a){_0xcfe81a[_0x013c('0x12')]={};return new BPromise(function(_0x424437,_0x57f017){var _0x307f34={'Start':function(_0x1c2e11){var _0x84244=this;return new Promise(function(_0x92c3ca,_0x1a5e16){if(_0x1c2e11){try{var _0x1038d6=[];var _0x6b8b5=getId(_0x1c2e11[_0x013c('0x13')],_0x1c2e11[_0x013c('0x14')]?_0x1c2e11[_0x013c('0x14')]['id']:0x0,_0x1c2e11[_0x013c('0x15')]?_0x1c2e11[_0x013c('0x15')]['id']:0x0);if(_0x1c2e11[_0x013c('0x16')]&&_['isArray'](_0x1c2e11['applications'])&&_0x1c2e11[_0x013c('0x16')][_0x013c('0x17')]){for(var _0x5752bd=0x0;_0x5752bd<_0x1c2e11[_0x013c('0x16')][_0x013c('0x17')];_0x5752bd+=0x1){var _0x29c141=_0x1c2e11[_0x013c('0x16')][_0x5752bd];if(fs[_0x013c('0x18')](path['join'](__dirname,_0x013c('0x16'),_0x29c141[_0x013c('0x19')]+'.js'))){var _0x1df9d2=[];switch(_0x29c141[_0x013c('0x19')]['toLowerCase']()){case'autoreply':var _0x20f8e7=_0x29c141[_0x013c('0x1a')][_0x013c('0x1b')](',');if(_0x1c2e11[_0x013c('0x13')]===_0x013c('0x1c')){_0x1df9d2[_0x013c('0x1d')](_0x20f8e7[0x0]);_0x1df9d2[_0x013c('0x1d')](_0x20f8e7[0x1]);_0x1df9d2[_0x013c('0x1d')](_0x20f8e7['slice'](0x2,_0x20f8e7[_0x013c('0x17')])[_0x013c('0x1e')](','));}else{_0x1df9d2[_0x013c('0x1d')](_0x20f8e7[0x0]);_0x1df9d2[_0x013c('0x1d')](_0x20f8e7[_0x013c('0x1f')](0x1,_0x20f8e7[_0x013c('0x17')])['join'](','));}break;case _0x013c('0x20'):var _0xd85349=_0x29c141[_0x013c('0x1a')]['split'](',');_0x1df9d2[_0x013c('0x1d')](_0xd85349[0x0]);_0x1df9d2['push'](_0xd85349[0x1]);_0x1df9d2[_0x013c('0x1d')](_0xd85349[_0x013c('0x1f')](0x2,_0xd85349['length'])[_0x013c('0x1e')](','));break;case _0x013c('0x21'):var _0x16cdad=_0x29c141[_0x013c('0x1a')][_0x013c('0x1b')](',');_0x1df9d2[_0x013c('0x1d')](_0x16cdad[0x0]);_0x1df9d2[_0x013c('0x1d')](_0x16cdad[0x1]);_0x1df9d2[_0x013c('0x1d')](_0x16cdad[0x2]);_0x1df9d2[_0x013c('0x1d')](_0x16cdad[0x3]);_0x1df9d2[_0x013c('0x1d')](_0x16cdad['slice'](0x4,_0x16cdad[_0x013c('0x17')])[_0x013c('0x1e')](','));break;case _0x013c('0x22'):var _0x24617f=_0x29c141[_0x013c('0x1a')]['split'](',');_0x1df9d2[_0x013c('0x1d')](_0x24617f[0x0]);_0x1df9d2[_0x013c('0x1d')](_0x24617f[0x1]);_0x1df9d2[_0x013c('0x1d')](_0x24617f[0x2]);_0x1df9d2[_0x013c('0x1d')](_0x24617f[0x3]);_0x1df9d2['push'](_0x24617f['slice'](0x4,_0x24617f['length'])[_0x013c('0x1e')](','));break;case _0x013c('0x14'):_0x1df9d2[_0x013c('0x1d')](_0x29c141[_0x013c('0x1a')]);break;case _0x013c('0x23'):_0x1df9d2[_0x013c('0x1d')](_0x29c141[_0x013c('0x24')]);_0x1df9d2[_0x013c('0x1d')](_0x29c141[_0x013c('0x1a')]);break;case _0x013c('0x25'):var _0xc69c3f=utils[_0x013c('0x26')](_0x1c2e11['account']['notificationTemplate'],_0x1c2e11);var _0x42aa8a=_0x29c141[_0x013c('0x1a')][_0x013c('0x1b')](',');_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x0]);_0x1df9d2['push'](_0x42aa8a[0x1]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x2]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x3]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x4]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x5]);_0x1df9d2['push'](_0x42aa8a[0x6]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x7]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x8]);_0x1df9d2['push'](_0x42aa8a[0x9]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0xa]);_0x1df9d2['push'](_0x1c2e11[_0x013c('0x15')]['id']);_0x1df9d2[_0x013c('0x1d')](_0x1c2e11[_0x013c('0x14')]['id']);_0x1df9d2[_0x013c('0x1d')](_0x29c141['ChatWebsiteId']);_0x1df9d2[_0x013c('0x1d')](_0x1c2e11[_0x013c('0x15')][_0x013c('0x27')]);_0x1df9d2[_0x013c('0x1d')](_0x1c2e11[_0x013c('0x28')][_0x013c('0x28')]);_0x1df9d2[_0x013c('0x1d')](_0xc69c3f);break;default:_0x1df9d2=_[_0x013c('0xd')](_0x29c141[_0x013c('0x1a')])?[]:_0x29c141['appdata'][_0x013c('0x1b')](',');}var _0x3e5e50={'id':util['format'](_0x013c('0x29'),_0x6b8b5,_0x29c141['id'],_0x29c141[_0x013c('0x19')]),'condition':require('./interval')[_0x013c('0x2a')](_0x6b8b5,getIntervals(_0xcfe81a[_0x013c('0x2b')],_0x29c141),_0xcfe81a),'consequence':require(_0x013c('0x2c')+_0x29c141[_0x013c('0x19')])[_0x013c('0x2d')](_0x6b8b5,_0x1df9d2,_0xcfe81a,_0x1c2e11),'p':_0x29c141['priority']||0x0};logger[_0x013c('0x2e')]('Push\x20new\x20rule',_0x3e5e50['id'],'on\x20interval',getIntervals(_0xcfe81a['intervals'],_0x29c141)['join'](_0x013c('0x2f')));_0x1038d6[_0x013c('0x1d')](_0x3e5e50);}else{logger[_0x013c('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x013c('0x1e')](__dirname,_0x013c('0x16'),_0x29c141[_0x013c('0x19')]+_0x013c('0x31')));}}_0xcfe81a[_0x013c('0x12')][_0x6b8b5]=new RuleEngine(_0x1038d6);_0xcfe81a['rules'][_0x6b8b5][_0x013c('0x32')](_0x1c2e11,function(_0x3bfcd4){logger['info']('Applications\x20executed',JSON['stringify'](_0x3bfcd4['matchPath']));if(_0xcfe81a[_0x013c('0x12')][_0x6b8b5]){_0xcfe81a[_0x013c('0x12')][_0x6b8b5]['emit'](_0x013c('0x33'));}});return _0x92c3ca({'code':0xc8,'message':_0x1c2e11});}else{logger[_0x013c('0x2e')]('No\x20applications\x20to\x20execute');return _0x92c3ca({'code':0xc8,'message':_0x1c2e11});}}catch(_0x268a3b){logger[_0x013c('0x30')](_0x268a3b[_0x013c('0x34')]);return _0x1a5e16(_0x84244[_0x013c('0x30')](0x1f4,_0x268a3b));}}return _0x1a5e16(_0x013c('0x35'));});},'AcceptMessage':function(_0x2cb393){var _0x1f289f=this;return new Promise(function(_0x7e44ac,_0x5780e7){if(_0x2cb393[_0x013c('0x36')]&&_0x2cb393['agent']['id']){if(_0xcfe81a[_0x013c('0x37')][_0x2cb393['agent']['id']]){_0xcfe81a['agents'][_0x2cb393[_0x013c('0x36')]['id']]['busy']=![];_0xcfe81a[_0x013c('0x37')][_0x2cb393[_0x013c('0x36')]['id']][_0x013c('0x38')]=undefined;}}if(_0x2cb393[_0x013c('0x14')]&&_0x2cb393['message']['id']){try{var _0x5185a3=getId(_0x2cb393['channel'],_0x2cb393['message']?_0x2cb393[_0x013c('0x14')]['id']:0x0,_0x2cb393['interaction']?_0x2cb393[_0x013c('0x15')]['id']:0x0);if(_0xcfe81a[_0x013c('0x12')][_0x5185a3]){_0xcfe81a[_0x013c('0x12')][_0x5185a3][_0x013c('0x39')](_0x013c('0x3a'));if(rpc[_0x2cb393[_0x013c('0x13')]+_0x013c('0x3b')]){rpc[_0x2cb393[_0x013c('0x13')]+_0x013c('0x3b')]['update'](_0x5185a3,{'UserId':_0x2cb393[_0x013c('0x14')]['UserId']})['catch'](function(_0x12236a){logger['error']('error\x20update\x20queue\x20report');});}}return _0x7e44ac({'code':0xc8,'message':_0x2cb393});}catch(_0x38d0de){logger[_0x013c('0x30')](_0x38d0de['stack']);return _0x5780e7(_0x1f289f[_0x013c('0x30')](0x1f4,_0x38d0de));}}logger[_0x013c('0x30')](_0x013c('0x3c'));return _0x5780e7(_0x1f289f['error'](0x1f4,_0x013c('0x3c')));});},'RejectMessage':function(_0x419c6b){var _0x21b5f1=this;return new Promise(function(_0x82e15a,_0x2a64a1){if(_0x419c6b['agent']&&_0x419c6b[_0x013c('0x36')]['id']){try{if(_0xcfe81a[_0x013c('0x37')][_0x419c6b[_0x013c('0x36')]['id']]){_0xcfe81a[_0x013c('0x37')][_0x419c6b['agent']['id']][_0x013c('0x3d')]=![];_0xcfe81a[_0x013c('0x37')][_0x419c6b[_0x013c('0x36')]['id']][_0x013c('0x38')]=undefined;}return _0x82e15a({'code':0xc8,'message':_0x419c6b});}catch(_0x17f162){logger[_0x013c('0x30')](_0x17f162[_0x013c('0x34')]);return _0x2a64a1(_0x21b5f1[_0x013c('0x30')](0x1f4,_0x17f162));}}logger[_0x013c('0x30')]('message\x20is\x20empty');return _0x2a64a1(_0x21b5f1[_0x013c('0x30')](0x1f4,_0x013c('0x3c')));});},'AbandonInteraction':function(_0x5c8cc9){var _0x55bf4a=this;return new Promise(function(_0x37d8b7,_0x5539db){if(_0x5c8cc9[_0x013c('0x13')]&&_0x5c8cc9[_0x013c('0x15')]&&_0x5c8cc9[_0x013c('0x15')]['id']){try{var _0x1e36bb=getId(_0x5c8cc9['channel'],_0x5c8cc9[_0x013c('0x14')]?_0x5c8cc9[_0x013c('0x14')]['id']:0x0,_0x5c8cc9[_0x013c('0x15')]?_0x5c8cc9['interaction']['id']:0x0);if(_0xcfe81a[_0x013c('0x12')][_0x1e36bb]){_0xcfe81a['rules'][_0x1e36bb][_0x013c('0x39')]('end');}return _0x37d8b7({'code':0xc8,'message':_0x5c8cc9});}catch(_0x2ed53a){logger[_0x013c('0x30')](_0x2ed53a[_0x013c('0x34')]);return _0x5539db(_0x55bf4a['error'](0x1f4,_0x2ed53a));}}logger['error'](_0x013c('0x3c'));return _0x5539db(_0x55bf4a[_0x013c('0x30')](0x1f4,_0x013c('0x3c')));});},'AgentCapacity':function(_0x6467d7){var _0x1e52f0=this;return new Promise(function(_0x59f9e6,_0x2bd9aa){if(_0xcfe81a[_0x013c('0x37')][_0x013c('0x3e')](_0x6467d7['id'])){for(var _0x5d0325 in _0x6467d7['capacity']){if(_0x6467d7[_0x013c('0x3f')][_0x013c('0x3e')](_0x5d0325)){if(_0xcfe81a['agents'][_0x6467d7['id']][_0x013c('0x3e')](_0x5d0325+_0x013c('0x40'))){_0xcfe81a[_0x013c('0x37')][_0x6467d7['id']][_0x5d0325+_0x013c('0x40')]=parseInt(_0x6467d7['capacity'][_0x5d0325],0xa);}}}_0xcfe81a[_0x013c('0x37')][_0x6467d7['id']][_0x013c('0x41')]();return _0x59f9e6({'code':0xc8,'message':_0xcfe81a[_0x013c('0x37')][_0x6467d7['id']]});}else{return _0x2bd9aa(_0x1e52f0[_0x013c('0x30')](0x1f4,_0x013c('0x42')));}});},'Agents':function(_0x49d3ae){return new Promise(function(_0x5848e6,_0x9c77a9){var _0x54de46=_['values'](_0xcfe81a['agents']);_0x5848e6({'count':_0x54de46[_0x013c('0x17')],'rows':_0x54de46});});},'ChatQueues':function(_0x1f0017){return new Promise(function(_0x7d2a4f,_0x512e23){var _0x56c54a=[];for(var _0x37acc2 in _0xcfe81a[_0x013c('0x43')]){if(_0xcfe81a[_0x013c('0x43')][_0x013c('0x3e')](_0x37acc2)){var _0x5e2f1d=_0xcfe81a['chatQueues'][_0x37acc2];var _0x280fab={'id':_0x5e2f1d['id'],'available':_0x5e2f1d[_0x013c('0x44')],'loggedIn':_0x5e2f1d[_0x013c('0x45')],'name':_0x5e2f1d[_0x013c('0x46')],'paused':_0x5e2f1d[_0x013c('0x47')],'waiting':_0x5e2f1d[_0x013c('0x48')]};_0x56c54a[_0x013c('0x1d')](_0x280fab);}}_0x7d2a4f({'count':_0x56c54a[_0x013c('0x17')],'rows':_0x56c54a});});},'MailQueues':function(_0x126d20){return new Promise(function(_0x5569b4,_0x20e93f){var _0x136a35=[];for(var _0x25dec4 in _0xcfe81a['mailQueues']){if(_0xcfe81a[_0x013c('0x49')][_0x013c('0x3e')](_0x25dec4)){var _0x1ebed6=_0xcfe81a[_0x013c('0x49')][_0x25dec4];var _0xd4357c={'id':_0x1ebed6['id'],'available':_0x1ebed6[_0x013c('0x44')],'loggedIn':_0x1ebed6[_0x013c('0x45')],'name':_0x1ebed6['name'],'paused':_0x1ebed6['paused'],'waiting':_0x1ebed6[_0x013c('0x48')]};_0x136a35[_0x013c('0x1d')](_0xd4357c);}}_0x5569b4({'count':_0x136a35[_0x013c('0x17')],'rows':_0x136a35});});},'OpenchannelQueues':function(_0x15a550){return new Promise(function(_0x31d1e2,_0x1ca0c5){var _0x41b201=[];for(var _0x45512c in _0xcfe81a[_0x013c('0x4a')]){if(_0xcfe81a['openchannelQueues']['hasOwnProperty'](_0x45512c)){var _0x571782=_0xcfe81a[_0x013c('0x4a')][_0x45512c];var _0x4d412c={'id':_0x571782['id'],'available':_0x571782[_0x013c('0x44')],'loggedIn':_0x571782[_0x013c('0x45')],'name':_0x571782['name'],'paused':_0x571782[_0x013c('0x47')],'waiting':_0x571782[_0x013c('0x48')]};_0x41b201[_0x013c('0x1d')](_0x4d412c);}}_0x31d1e2({'count':_0x41b201[_0x013c('0x17')],'rows':_0x41b201});});},'SmsQueues':function(_0x10ad0c){return new Promise(function(_0xed88fd,_0x9d6377){var _0x4383be=[];for(var _0x4c76c6 in _0xcfe81a['smsQueues']){if(_0xcfe81a[_0x013c('0x4b')][_0x013c('0x3e')](_0x4c76c6)){var _0x1d3839=_0xcfe81a['smsQueues'][_0x4c76c6];var _0x57950f={'id':_0x1d3839['id'],'available':_0x1d3839[_0x013c('0x44')],'loggedIn':_0x1d3839[_0x013c('0x45')],'name':_0x1d3839[_0x013c('0x46')],'paused':_0x1d3839['paused'],'waiting':_0x1d3839[_0x013c('0x48')]};_0x4383be[_0x013c('0x1d')](_0x57950f);}}_0xed88fd({'count':_0x4383be['length'],'rows':_0x4383be});});},'FaxQueues':function(_0x45a01c){return new Promise(function(_0x465c53,_0x310841){var _0x3dea3b=[];for(var _0x5613e0 in _0xcfe81a[_0x013c('0x4c')]){if(_0xcfe81a['faxQueues'][_0x013c('0x3e')](_0x5613e0)){var _0x4e872b=_0xcfe81a[_0x013c('0x4c')][_0x5613e0];var _0x50deb5={'id':_0x4e872b['id'],'available':_0x4e872b['available'],'loggedIn':_0x4e872b['loggedIn'],'name':_0x4e872b[_0x013c('0x46')],'paused':_0x4e872b[_0x013c('0x47')],'waiting':_0x4e872b[_0x013c('0x48')]};_0x3dea3b[_0x013c('0x1d')](_0x50deb5);}}_0x465c53({'count':_0x3dea3b[_0x013c('0x17')],'rows':_0x3dea3b});});},'WhatsappQueues':function(_0x1924f2){return new Promise(function(_0xb8298c,_0x5a86b6){var _0x1bf7b5=[];for(var _0x1a3442 in _0xcfe81a[_0x013c('0x4d')]){if(_0xcfe81a['whatsappQueues'][_0x013c('0x3e')](_0x1a3442)){var _0x24ecf2=_0xcfe81a[_0x013c('0x4d')][_0x1a3442];var _0x38b53f={'id':_0x24ecf2['id'],'available':_0x24ecf2[_0x013c('0x44')],'loggedIn':_0x24ecf2[_0x013c('0x45')],'name':_0x24ecf2[_0x013c('0x46')],'paused':_0x24ecf2[_0x013c('0x47')],'waiting':_0x24ecf2[_0x013c('0x48')]};_0x1bf7b5[_0x013c('0x1d')](_0x38b53f);}}_0xb8298c({'count':_0x1bf7b5[_0x013c('0x17')],'rows':_0x1bf7b5});});},'ChatQueuesWaitingInteractions':function(_0x26406c){return new Promise(function(_0x468c73,_0x198c06){var _0x3a10c0=_[_0x013c('0x4e')](_0xcfe81a[_0x013c('0x4f')]);_0x468c73({'count':_0x3a10c0[_0x013c('0x17')],'rows':_0x3a10c0});});},'MailQueuesWaitingInteractions':function(_0x20d569){return new Promise(function(_0x45f7ac,_0x1a23e9){var _0x2b6064=_[_0x013c('0x4e')](_0xcfe81a[_0x013c('0x50')]);_0x45f7ac({'count':_0x2b6064[_0x013c('0x17')],'rows':_0x2b6064});});},'OpenchannelQueuesWaitingInteractions':function(_0x52b563){return new Promise(function(_0x3bed3d,_0x539488){var _0x6cf90e=_['values'](_0xcfe81a[_0x013c('0x51')]);_0x3bed3d({'count':_0x6cf90e[_0x013c('0x17')],'rows':_0x6cf90e});});},'SmsQueuesWaitingInteractions':function(_0x56bbcf){return new Promise(function(_0x3bd59c,_0x277219){var _0x2a316d=_[_0x013c('0x4e')](_0xcfe81a['smsQueuesWaitingInteractions']);_0x3bd59c({'count':_0x2a316d['length'],'rows':_0x2a316d});});},'FaxQueuesWaitingInteractions':function(_0x530f42){return new Promise(function(_0x1a35dd,_0x1f290b){var _0x257eb8=_[_0x013c('0x4e')](_0xcfe81a[_0x013c('0x52')]);_0x1a35dd({'count':_0x257eb8['length'],'rows':_0x257eb8});});},'WhatsappQueuesWaitingInteractions':function(_0x5b795d){return new Promise(function(_0x3a23b2,_0x4f0c95){var _0x367d4f=_[_0x013c('0x4e')](_0xcfe81a[_0x013c('0x53')]);_0x3a23b2({'count':_0x367d4f[_0x013c('0x17')],'rows':_0x367d4f});});}};var _0x50aece=jayson[_0x013c('0x54')](_0x307f34)[_0x013c('0x55')]();_0x50aece['on'](_0x013c('0x30'),function(_0x1bcc6c){logger[_0x013c('0x30')](JSON['stringify'](_0x1bcc6c));return _0x57f017(_0x1bcc6c);});_0x50aece[_0x013c('0x11')](0x232c,'127.0.0.1',function(){console['log'](_0x013c('0x56'),0x232c);return _0x424437(_0x013c('0x57')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index cf00d5f..6a512f7 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 _0x5e64=['lodash','../../../config/logger','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5e64,0x1cd));var _0x45e6=function(_0x5cc908,_0x307fe5){_0x5cc908=_0x5cc908-0x0;var _0x4078d6=_0x5e64[_0x5cc908];return _0x4078d6;};'use strict';var util=require(_0x45e6('0x0'));var BPromise=require(_0x45e6('0x1'));var jayson=require(_0x45e6('0x2'));var _=require(_0x45e6('0x3'));var logger=require(_0x45e6('0x4'))('routing');var client=jayson['client'][_0x45e6('0x5')]({'port':0x232a});function request(_0x182b0d,_0x3ef53f){return new BPromise(function(_0x5d25e2,_0x5bb9d7){return client[_0x45e6('0x6')](_0x182b0d,_0x3ef53f)[_0x45e6('0x7')](function(_0x5b0e2e){if(_0x5b0e2e[_0x45e6('0x8')]){return _0x5bb9d7(_0x5b0e2e['error'][_0x45e6('0x9')]);}else{return _0x5d25e2(_0x5b0e2e[_0x45e6('0xa')]);}})[_0x45e6('0xb')](function(_0x13cc5a){return _0x5bb9d7(_0x13cc5a);});});}exports[_0x45e6('0xc')]=function(_0x2e1a05,_0x19b8ea,_0x1749e9){return function(_0x150e44){if(_0x1749e9[_0x45e6('0xd')]&&!_0x1749e9['rules'][_0x2e1a05]){logger[_0x45e6('0xe')](_0x45e6('0xf'),_0x2e1a05);return _0x150e44[_0x45e6('0x10')]();}var _0x456d01=[];for(var _0x5e49df=0x0;_0x5e49df<_0x19b8ea[_0x45e6('0x11')];_0x5e49df+=0x1){_0x456d01['push'](request('Command',{'command':util[_0x45e6('0x12')](_0x45e6('0x13'),_0x19b8ea[_0x5e49df])})[_0x45e6('0x7')](function(_0x435f85){return _0x435f85&&_0x435f85[_0x45e6('0x9')]&&_0x435f85[_0x45e6('0x9')]['indexOf'](_0x45e6('0x14'))>=0x0?!![]:![];})['catch'](function(_0x584b33){logger[_0x45e6('0x8')](_0x45e6('0x15'),_0x2e1a05,_0x19b8ea[_0x5e49df]);}));}BPromise[_0x45e6('0x16')](_0x456d01)['then'](function(_0x3dd14c){var _0x4b2903=_[_0x45e6('0x17')](_0x3dd14c);logger[_0x45e6('0xe')](_0x45e6('0x18'),_0x2e1a05,_0x19b8ea[_0x45e6('0x19')](_0x45e6('0x1a')),_0x4b2903);_0x150e44['when'](_0x4b2903);})[_0x45e6('0xb')](function(_0x22e481){console[_0x45e6('0x1b')](_0x22e481);logger[_0x45e6('0x8')](_0x45e6('0x18'),_0x2e1a05,_0x19b8ea[_0x45e6('0x19')](_0x45e6('0x1a')),_0x22e481[_0x45e6('0x1c')]);_0x150e44[_0x45e6('0x10')]();});};}; \ No newline at end of file +var _0xa81f=['http','request','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','message','true','catch','error','[%s][INTERVAL]\x20%s','all','then','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client'];(function(_0x53b780,_0x863743){var _0x5160a3=function(_0xedab95){while(--_0xedab95){_0x53b780['push'](_0x53b780['shift']());}};_0x5160a3(++_0x863743);}(_0xa81f,0x16d));var _0xfa81=function(_0x1ae7b0,_0x2301a2){_0x1ae7b0=_0x1ae7b0-0x0;var _0x2d83dc=_0xa81f[_0x1ae7b0];return _0x2d83dc;};'use strict';var util=require(_0xfa81('0x0'));var BPromise=require(_0xfa81('0x1'));var jayson=require(_0xfa81('0x2'));var _=require(_0xfa81('0x3'));var logger=require(_0xfa81('0x4'))(_0xfa81('0x5'));var client=jayson[_0xfa81('0x6')][_0xfa81('0x7')]({'port':0x232a});function request(_0x2cb79e,_0x3bd3ad){return new BPromise(function(_0x33e9cd,_0x5addbb){return client[_0xfa81('0x8')](_0x2cb79e,_0x3bd3ad)['then'](function(_0x36616f){if(_0x36616f['error']){return _0x5addbb(_0x36616f['error']['message']);}else{return _0x33e9cd(_0x36616f['result']);}})['catch'](function(_0x4f967){return _0x5addbb(_0x4f967);});});}exports['condition']=function(_0xd49329,_0x16d93f,_0x52861a){return function(_0x40f5e8){if(_0x52861a[_0xfa81('0x9')]&&!_0x52861a[_0xfa81('0x9')][_0xd49329]){logger[_0xfa81('0xa')](_0xfa81('0xb'),_0xd49329);return _0x40f5e8[_0xfa81('0xc')]();}var _0x518b57=[];for(var _0x299aa6=0x0;_0x299aa6<_0x16d93f['length'];_0x299aa6+=0x1){_0x518b57[_0xfa81('0xd')](request(_0xfa81('0xe'),{'command':util[_0xfa81('0xf')](_0xfa81('0x10'),_0x16d93f[_0x299aa6])})['then'](function(_0x825103){return _0x825103&&_0x825103[_0xfa81('0x11')]&&_0x825103[_0xfa81('0x11')]['indexOf'](_0xfa81('0x12'))>=0x0?!![]:![];})[_0xfa81('0x13')](function(_0x21ffdc){logger[_0xfa81('0x14')](_0xfa81('0x15'),_0xd49329,_0x16d93f[_0x299aa6]);}));}BPromise[_0xfa81('0x16')](_0x518b57)[_0xfa81('0x17')](function(_0x52ec89){var _0x4569ae=_[_0xfa81('0x18')](_0x52ec89);logger[_0xfa81('0xa')](_0xfa81('0x19'),_0xd49329,_0x16d93f[_0xfa81('0x1a')]('\x20|\x20'),_0x4569ae);_0x40f5e8[_0xfa81('0x1b')](_0x4569ae);})[_0xfa81('0x13')](function(_0x487e97){console[_0xfa81('0x1c')](_0x487e97);logger['error'](_0xfa81('0x19'),_0xd49329,_0x16d93f[_0xfa81('0x1a')](_0xfa81('0x1d')),_0x487e97[_0xfa81('0x1e')]);_0x40f5e8[_0xfa81('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 1e55a59..34d750f 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 _0x96cc=['rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','./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','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause'];(function(_0x29183c,_0x8eed2d){var _0x487e7b=function(_0x2a799c){while(--_0x2a799c){_0x29183c['push'](_0x29183c['shift']());}};_0x487e7b(++_0x8eed2d);}(_0x96cc,0x16c));var _0xc96c=function(_0x33541d,_0xaee09e){_0x33541d=_0x33541d-0x0;var _0x52d9a5=_0x96cc[_0x33541d];return _0x52d9a5;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var utils=require(_0xc96c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f11f2,_0x30bf8a){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x4'),_0x5f11f2[_0xc96c('0x5')],_0x5f11f2[_0xc96c('0x6')],_0x5f11f2[_0xc96c('0x7')],_0x5f11f2[_0xc96c('0x8')],_0x5f11f2[_0xc96c('0x9')],_0x5f11f2['calleridnum'],_0x5f11f2[_0xc96c('0xa')],_0x5f11f2[_0xc96c('0xb')]));if(_0x5f11f2[_0xc96c('0x7')]){utils[_0xc96c('0xc')](_0x5f11f2[_0xc96c('0x7')])[_0xc96c('0xd')](function(_0x36b2b4){if(_0x36b2b4){_0x5f11f2['type']=_0x36b2b4[_0xc96c('0xe')];_0x5f11f2[_0xc96c('0xf')]=_0x5f11f2[_0xc96c('0x10')]?_0x36b2b4['acw']:![];_0x5f11f2[_0xc96c('0x11')]=_0x5f11f2['agentacw']?_0x36b2b4[_0xc96c('0x12')]:0x0;}utils['request'](_0xc96c('0x13'),_0x5f11f2);});}else{utils[_0xc96c('0x14')](_0xc96c('0x13'),_0x5f11f2);}if(_0x30bf8a){delete transfers[_0x5f11f2[_0xc96c('0x5')]];}else{delete agents[_0x5f11f2['destuniqueid']];}}exports[_0xc96c('0x15')]=function(_0x43fcaa){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')]('[%s][agents][agentcalled]',_0x43fcaa[_0xc96c('0x5')]),_0x43fcaa);agents[_0x43fcaa[_0xc96c('0x17')]]=_0x43fcaa;agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0x18')]=utils[_0xc96c('0x19')]();agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x1a');agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xa')]=null;agents[_0x43fcaa[_0xc96c('0x17')]]['connectedlinename']=null;utils['info'](util[_0xc96c('0x3')](_0xc96c('0x1b'),_0x43fcaa[_0xc96c('0x5')],agents[_0x43fcaa[_0xc96c('0x17')]]['membername'],_0x43fcaa[_0xc96c('0x17')]));}catch(_0x100fdb){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x1d'),_0x43fcaa[_0xc96c('0x5')]),_0x100fdb);}};exports[_0xc96c('0x1e')]=function(_0x41daba){try{if(!_[_0xc96c('0x1f')](agents[_0x41daba[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x41daba);utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x21'),_0x41daba['uniqueid'],agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x8')],_0x41daba[_0xc96c('0x17')]));agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x1e')]=!![];agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x22')]=utils[_0xc96c('0x19')]();agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0xb')]='timeout';agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x23')]=_0xc96c('0x24');agents[_0x41daba[_0xc96c('0x17')]]['holdtime']=_0x41daba['ringtime']?parseInt(_0x41daba[_0xc96c('0x25')])/0x3e8:0x0;agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x26')]=0x0;unanswered[_0xc96c('0x27')](_0x41daba[_0xc96c('0x17')]);}}catch(_0x5e1727){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x5e1727);}};exports[_0xc96c('0x28')]=function(_0x40c72b){try{_[_0xc96c('0x29')](agents,function(_0x328ee4,_0x556108){if(_0x328ee4[_0xc96c('0x5')]==_0x40c72b['uniqueid']&&!_[_0xc96c('0x2a')](unanswered,_0x328ee4[_0xc96c('0x17')])){utils[_0xc96c('0x16')](util['format'](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x40c72b);utils[_0xc96c('0x2')](util[_0xc96c('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x40c72b['uniqueid'],_0x328ee4[_0xc96c('0x8')],_0x328ee4[_0xc96c('0x17')]));_0x328ee4[_0xc96c('0x1e')]=!![];_0x328ee4['agentringnoanswerAt']=utils[_0xc96c('0x19')]();_0x328ee4[_0xc96c('0xb')]=_0xc96c('0x2c');_0x328ee4[_0xc96c('0x23')]='abandoned';_0x328ee4[_0xc96c('0x2d')]=_0x40c72b[_0xc96c('0x2d')];_0x328ee4['talktime']=0x0;writeDB(_0x328ee4);}});}catch(_0x2b1dec){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x2b1dec);}};exports[_0xc96c('0x2e')]=function(_0x4e8241){try{if(agents[_0x4e8241[_0xc96c('0x17')]]){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4e8241);utils[_0xc96c('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4e8241[_0xc96c('0x5')],agents[_0x4e8241[_0xc96c('0x17')]]['membername'],_0x4e8241['destuniqueid']));agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xa')]=_0x4e8241[_0xc96c('0xa')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x31')]=_0x4e8241[_0xc96c('0x31')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x2d')]=_0x4e8241['ringtime'];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x32');_[_0xc96c('0x29')](agents,function(_0x4eb180,_0x167671){if(_0x4eb180[_0xc96c('0x17')]!=_0x4e8241[_0xc96c('0x17')]&&_0x4eb180['uniqueid']==_0x4e8241['uniqueid']){_0x4eb180[_0xc96c('0x26')]=0x0;_0x4eb180[_0xc96c('0x2d')]=_0x4e8241[_0xc96c('0x25')];_0x4eb180['agentringnoanswer']=!![];_0x4eb180[_0xc96c('0x22')]=utils[_0xc96c('0x19')]();_0x4eb180[_0xc96c('0xb')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x23')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x34')]=_0x4e8241[_0xc96c('0x17')];_0x4eb180[_0xc96c('0x35')]=_0x4e8241['membername'];writeDB(_0x4eb180);}});}}catch(_0x4c3088){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4c3088);}};exports['agentcomplete']=function(_0x5ee6ac){try{if(!_[_0xc96c('0x1f')](agents[_0x5ee6ac[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x5ee6ac);utils[_0xc96c('0x2')](util['format'](_0xc96c('0x37'),_0x5ee6ac[_0xc96c('0x5')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x8')],_0x5ee6ac['destuniqueid']));agents[_0x5ee6ac['destuniqueid']][_0xc96c('0x10')]=!![];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x30')]);agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x23')]=_0x5ee6ac['reason'];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x3a');writeDB(agents[_0x5ee6ac[_0xc96c('0x17')]]);}}catch(_0x56bce1){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x56bce1);}};exports['blindtransfer']=function(_0x2581ae){try{if(!_[_0xc96c('0x1f')](agents[_0x2581ae[_0xc96c('0x3b')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x3c'),_0x2581ae['uniqueid']),_0x2581ae);utils['info'](util['format'](_0xc96c('0x3d'),_0x2581ae['uniqueid'],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x8')],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')]));agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3e')]=!![];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3f')]=_0xc96c('0x40');agents[_0x2581ae[_0xc96c('0x3b')]]['transferexten']=_0x2581ae[_0xc96c('0x41')];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x42')]=agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')];}}catch(_0xcde9){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][blindtransfer]',_0x2581ae['uniqueid']),_0xcde9);}};exports['attendedtransfer']=function(_0x5c3d95){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0x5c3d95);if(_0x5c3d95[_0xc96c('0x44')]==_0x5c3d95[_0xc96c('0x45')]){if(!_[_0xc96c('0x1f')](agents[_0x5c3d95['secondtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x8')]));agents[_0x5c3d95[_0xc96c('0x47')]]['transfer']=!![];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x3f')]=_0xc96c('0x48');agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x4a')];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x42')]=_0x5c3d95[_0xc96c('0x44')];}if(_0x5c3d95[_0xc96c('0x4b')]&&agents[_0x5c3d95[_0xc96c('0x4b')]]){agents[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x4b')]]=_['clone'](agents[_0x5c3d95[_0xc96c('0x4b')]]);transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4d')];transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x4e')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4e')];transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentcalledAt']=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x2;}}else if(_0x5c3d95[_0xc96c('0x47')]==_0x5c3d95[_0xc96c('0x4f')]){if(!_['isNil'](agents[_0x5c3d95['origtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x44')]]['membername']));agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3e')]=!![];agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3f')]='ATTENDED';agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x50')];agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x42')]=_0x5c3d95['secondtransfereruniqueid'];}if(_0x5c3d95[_0xc96c('0x51')]&&agents[_0x5c3d95[_0xc96c('0x51')]]){agents[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x51')]]=_[_0xc96c('0x52')](agents[_0x5c3d95[_0xc96c('0x51')]]);transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x44')]]['calleridnum'];transfers[_0x5c3d95[_0xc96c('0x51')]]['calleridname']=agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x4e')];transfers[_0x5c3d95['transfertargetuniqueid']][_0xc96c('0x18')]=utils['now']();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x2;}}}catch(_0xbd6525){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0xbd6525);}};exports[_0xc96c('0x53')]=function(_0x43f94e){try{utils['debug'](util[_0xc96c('0x3')](_0xc96c('0x54'),_0x43f94e['uniqueid']),_0x43f94e);if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]]['reason']===_0xc96c('0x24')){if(_0x43f94e[_0xc96c('0x55')]==='21'){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')]=_0xc96c('0x56');agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]=_0xc96c('0x56');}utils[_0xc96c('0x2')](util['format'](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e[_0xc96c('0x5')]]['membername'],agents[_0x43f94e['uniqueid']][_0xc96c('0x23')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);var _0x1efa88=unanswered[_0xc96c('0x58')](_0x43f94e[_0xc96c('0x5')]);if(_0x1efa88>-0x1){unanswered['splice'](_0x1efa88,0x1);}}if(transfers[_0x43f94e[_0xc96c('0x5')]]){transfers[_0x43f94e[_0xc96c('0x5')]]['agentcomplete']=!![];transfers[_0x43f94e[_0xc96c('0x5')]]['agentcompleteAt']=utils[_0xc96c('0x19')]();transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);transfers[_0x43f94e[_0xc96c('0x5')]]['reason']=_0xc96c('0x59');transfers[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils['info'](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],transfers[_0x43f94e['uniqueid']][_0xc96c('0x8')],transfers[_0x43f94e[_0xc96c('0x5')]]['reason'],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(transfers[_0x43f94e[_0xc96c('0x5')]],!![]);}if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x10')]=!![];agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);agents[_0x43f94e[_0xc96c('0x5')]]['reason']=agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x3e')]?_0xc96c('0x3e'):_0xc96c('0x59');agents[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e['uniqueid']]['membername'],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')],agents[_0x43f94e['uniqueid']][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);}}catch(_0x563449){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][hangup]',_0x43f94e[_0xc96c('0x5')]),_0x563449);}}; \ No newline at end of file +var _0x5423=['info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentcomplete','acw','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5423,0xe3));var _0x3542=function(_0xc1a094,_0x9b609f){_0xc1a094=_0xc1a094-0x0;var _0x5c17d4=_0x5423[_0xc1a094];return _0x5c17d4;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x331a98,_0x457909){utils['info'](util[_0x3542('0x2')](_0x3542('0x3'),_0x331a98[_0x3542('0x4')],_0x331a98[_0x3542('0x5')],_0x331a98['queue'],_0x331a98[_0x3542('0x6')],_0x331a98[_0x3542('0x7')],_0x331a98[_0x3542('0x8')],_0x331a98[_0x3542('0x9')],_0x331a98[_0x3542('0xa')]));if(_0x331a98['queue']){utils['getVoiceQueueByName'](_0x331a98[_0x3542('0xb')])[_0x3542('0xc')](function(_0x53ece9){if(_0x53ece9){_0x331a98[_0x3542('0xd')]=_0x53ece9[_0x3542('0xd')];_0x331a98['agentacw']=_0x331a98[_0x3542('0xe')]?_0x53ece9[_0x3542('0xf')]:![];_0x331a98['acwtime']=_0x331a98[_0x3542('0x10')]?_0x53ece9[_0x3542('0x11')]:0x0;}utils[_0x3542('0x12')](_0x3542('0x13'),_0x331a98);});}else{utils[_0x3542('0x12')](_0x3542('0x13'),_0x331a98);}if(_0x457909){delete transfers[_0x331a98[_0x3542('0x4')]];}else{delete agents[_0x331a98[_0x3542('0x14')]];}}exports[_0x3542('0x15')]=function(_0x1a9062){try{utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x17'),_0x1a9062['uniqueid']),_0x1a9062);agents[_0x1a9062[_0x3542('0x14')]]=_0x1a9062;agents[_0x1a9062['destuniqueid']][_0x3542('0x18')]=utils[_0x3542('0x19')]();agents[_0x1a9062[_0x3542('0x14')]]['lastevent']=_0x3542('0x1a');agents[_0x1a9062[_0x3542('0x14')]][_0x3542('0x9')]=null;agents[_0x1a9062['destuniqueid']][_0x3542('0x1b')]=null;utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x1d'),_0x1a9062['uniqueid'],agents[_0x1a9062[_0x3542('0x14')]]['membername'],_0x1a9062[_0x3542('0x14')]));}catch(_0x369e0c){utils['error'](util[_0x3542('0x2')](_0x3542('0x17'),_0x1a9062[_0x3542('0x4')]),_0x369e0c);}};exports[_0x3542('0x1e')]=function(_0x212950){try{if(!_['isNil'](agents[_0x212950['destuniqueid']])){utils['debug'](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]',_0x212950[_0x3542('0x4')]),_0x212950);utils['info'](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x212950['uniqueid'],agents[_0x212950[_0x3542('0x14')]][_0x3542('0x6')],_0x212950['destuniqueid']));agents[_0x212950['destuniqueid']][_0x3542('0x1e')]=!![];agents[_0x212950['destuniqueid']][_0x3542('0x1f')]=utils[_0x3542('0x19')]();agents[_0x212950[_0x3542('0x14')]][_0x3542('0xa')]=_0x3542('0x20');agents[_0x212950[_0x3542('0x14')]][_0x3542('0x21')]=_0x3542('0x20');agents[_0x212950[_0x3542('0x14')]][_0x3542('0x22')]=_0x212950[_0x3542('0x23')]?parseInt(_0x212950[_0x3542('0x23')])/0x3e8:0x0;agents[_0x212950[_0x3542('0x14')]][_0x3542('0x24')]=0x0;unanswered[_0x3542('0x25')](_0x212950[_0x3542('0x14')]);}}catch(_0x303412){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]',_0x212950[_0x3542('0x4')]),_0x303412);}};exports[_0x3542('0x27')]=function(_0x2aec76){try{_['forIn'](agents,function(_0x402c97,_0xc6f23b){if(_0x402c97[_0x3542('0x4')]==_0x2aec76[_0x3542('0x4')]&&!_['includes'](unanswered,_0x402c97['destuniqueid'])){utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x28'),_0x2aec76[_0x3542('0x4')]),_0x2aec76);utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x29'),_0x2aec76['uniqueid'],_0x402c97['membername'],_0x402c97[_0x3542('0x14')]));_0x402c97['agentringnoanswer']=!![];_0x402c97['agentringnoanswerAt']=utils[_0x3542('0x19')]();_0x402c97['lastevent']='abandoned';_0x402c97[_0x3542('0x21')]=_0x3542('0x2a');_0x402c97[_0x3542('0x22')]=_0x2aec76['holdtime'];_0x402c97[_0x3542('0x24')]=0x0;writeDB(_0x402c97);}});}catch(_0x49b523){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][queuecallerabandon]',_0x2aec76[_0x3542('0x4')]),_0x49b523);}};exports['agentconnect']=function(_0x204e5e){try{if(agents[_0x204e5e[_0x3542('0x14')]]){utils[_0x3542('0x16')](util['format'](_0x3542('0x2b'),_0x204e5e['uniqueid']),_0x204e5e);utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x2c'),_0x204e5e[_0x3542('0x4')],agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x6')],_0x204e5e[_0x3542('0x14')]));agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x2d')]=utils[_0x3542('0x19')]();agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x9')]=_0x204e5e[_0x3542('0x9')];agents[_0x204e5e['destuniqueid']][_0x3542('0x1b')]=_0x204e5e['connectedlinename'];agents[_0x204e5e['destuniqueid']][_0x3542('0x22')]=_0x204e5e[_0x3542('0x23')];agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0xa')]=_0x3542('0x2e');_[_0x3542('0x2f')](agents,function(_0xc7f13c,_0x42e87a){if(_0xc7f13c['destuniqueid']!=_0x204e5e[_0x3542('0x14')]&&_0xc7f13c['uniqueid']==_0x204e5e[_0x3542('0x4')]){_0xc7f13c[_0x3542('0x24')]=0x0;_0xc7f13c['holdtime']=_0x204e5e[_0x3542('0x23')];_0xc7f13c[_0x3542('0x1e')]=!![];_0xc7f13c['agentringnoanswerAt']=utils[_0x3542('0x19')]();_0xc7f13c[_0x3542('0xa')]='answered_elsewhere';_0xc7f13c[_0x3542('0x21')]=_0x3542('0x30');_0xc7f13c[_0x3542('0x31')]=_0x204e5e[_0x3542('0x14')];_0xc7f13c[_0x3542('0x32')]=_0x204e5e[_0x3542('0x6')];writeDB(_0xc7f13c);}});}}catch(_0x2b54b9){utils['error'](util['format'](_0x3542('0x2b'),_0x204e5e[_0x3542('0x4')]),_0x2b54b9);}};exports[_0x3542('0xe')]=function(_0xdeebd3){try{if(!_[_0x3542('0x33')](agents[_0xdeebd3['destuniqueid']])){utils[_0x3542('0x16')](util['format'](_0x3542('0x34'),_0xdeebd3[_0x3542('0x4')]),_0xdeebd3);utils[_0x3542('0x1c')](util['format'](_0x3542('0x35'),_0xdeebd3[_0x3542('0x4')],agents[_0xdeebd3['destuniqueid']][_0x3542('0x6')],_0xdeebd3[_0x3542('0x14')]));agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0xe')]=!![];agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x36')]=utils[_0x3542('0x19')]();agents[_0xdeebd3[_0x3542('0x14')]]['talktime']=utils['diffTime'](agents[_0xdeebd3['destuniqueid']][_0x3542('0x36')],agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x2d')]);agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x21')]=_0xdeebd3[_0x3542('0x21')];agents[_0xdeebd3[_0x3542('0x14')]]['lastevent']=_0x3542('0x37');writeDB(agents[_0xdeebd3[_0x3542('0x14')]]);}}catch(_0x3da43e){utils[_0x3542('0x26')](util['format'](_0x3542('0x34'),_0xdeebd3[_0x3542('0x4')]),_0x3da43e);}};exports['blindtransfer']=function(_0x528f8c){try{if(!_[_0x3542('0x33')](agents[_0x528f8c[_0x3542('0x38')]])){utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x39'),_0x528f8c[_0x3542('0x4')]),_0x528f8c);utils[_0x3542('0x1c')](util['format'](_0x3542('0x3a'),_0x528f8c[_0x3542('0x4')],agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x6')],agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x4')]));agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x3b')]=!![];agents[_0x528f8c[_0x3542('0x38')]]['transfertype']='blind';agents[_0x528f8c[_0x3542('0x38')]]['transferexten']=_0x528f8c['extension'];agents[_0x528f8c['transfereruniqueid']][_0x3542('0x3c')]=agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x4')];}}catch(_0x48cfc4){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][blindtransfer]',_0x528f8c[_0x3542('0x4')]),_0x48cfc4);}};exports[_0x3542('0x3d')]=function(_0x442000){try{utils[_0x3542('0x16')](util[_0x3542('0x2')]('[%s][agents][attendedtransfer]',_0x442000[_0x3542('0x3e')]),_0x442000);if(_0x442000[_0x3542('0x3e')]==_0x442000[_0x3542('0x3f')]){if(!_[_0x3542('0x33')](agents[_0x442000[_0x3542('0x40')]])){utils['info'](util['format'](_0x3542('0x41'),_0x442000[_0x3542('0x3e')],agents[_0x442000[_0x3542('0x40')]]['membername']));agents[_0x442000[_0x3542('0x40')]][_0x3542('0x3b')]=!![];agents[_0x442000[_0x3542('0x40')]][_0x3542('0x42')]=_0x3542('0x43');agents[_0x442000['secondtransfereruniqueid']]['transferexten']=_0x442000[_0x3542('0x44')];agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x3c')]=_0x442000[_0x3542('0x3e')];}if(_0x442000['transfereeuniqueid']&&agents[_0x442000[_0x3542('0x45')]]){agents[_0x442000[_0x3542('0x45')]][_0x3542('0x46')]=0x1;transfers[_0x442000[_0x3542('0x45')]]=_[_0x3542('0x47')](agents[_0x442000['transfereeuniqueid']]);transfers[_0x442000['transfereeuniqueid']][_0x3542('0x8')]=agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x8')];transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x48')]=agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x48')];transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x18')]=utils[_0x3542('0x19')]();transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x2d')]=utils['now']();transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x22')]=0x0;transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x46')]=0x2;}}else if(_0x442000[_0x3542('0x40')]==_0x442000[_0x3542('0x49')]){if(!_['isNil'](agents[_0x442000[_0x3542('0x3e')]])){utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x41'),_0x442000['origtransfereruniqueid'],agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x6')]));agents[_0x442000['origtransfereruniqueid']]['transfer']=!![];agents[_0x442000[_0x3542('0x3e')]]['transfertype']=_0x3542('0x43');agents[_0x442000['origtransfereruniqueid']]['transferexten']=_0x442000[_0x3542('0x4a')];agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x3c')]=_0x442000[_0x3542('0x40')];}if(_0x442000[_0x3542('0x4b')]&&agents[_0x442000[_0x3542('0x4b')]]){agents[_0x442000[_0x3542('0x4b')]]['agententerreason']=0x1;transfers[_0x442000[_0x3542('0x4b')]]=_[_0x3542('0x47')](agents[_0x442000[_0x3542('0x4b')]]);transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x8')]=agents[_0x442000['origtransfereruniqueid']][_0x3542('0x8')];transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x48')]=agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x48')];transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x18')]=utils['now']();transfers[_0x442000[_0x3542('0x4b')]]['agentconnectAt']=utils[_0x3542('0x19')]();transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x22')]=0x0;transfers[_0x442000[_0x3542('0x4b')]]['agententerreason']=0x2;}}}catch(_0x47c624){utils['error'](util[_0x3542('0x2')](_0x3542('0x4c'),_0x442000[_0x3542('0x3e')]),_0x47c624);}};exports[_0x3542('0x4d')]=function(_0x1ebe3a){try{utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x4e'),_0x1ebe3a[_0x3542('0x4')]),_0x1ebe3a);if(agents[_0x1ebe3a['uniqueid']]&&agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]===_0x3542('0x20')){if(_0x1ebe3a[_0x3542('0x4f')]==='21'){agents[_0x1ebe3a[_0x3542('0x4')]]['reason']='rejected';agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xa')]='rejected';}utils[_0x3542('0x1c')](util['format'](_0x3542('0x50'),_0x1ebe3a['uniqueid'],agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x6')],agents[_0x1ebe3a['uniqueid']]['reason'],agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]));writeDB(agents[_0x1ebe3a['uniqueid']]);var _0x16159f=unanswered[_0x3542('0x51')](_0x1ebe3a['uniqueid']);if(_0x16159f>-0x1){unanswered[_0x3542('0x52')](_0x16159f,0x1);}}if(transfers[_0x1ebe3a[_0x3542('0x4')]]){transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcomplete']=!![];transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcompleteAt']=utils[_0x3542('0x19')]();transfers[_0x1ebe3a['uniqueid']][_0x3542('0x24')]=utils[_0x3542('0x53')](transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcompleteAt'],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x2d')]);transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]='agent';transfers[_0x1ebe3a['uniqueid']][_0x3542('0xa')]=_0x3542('0x37');utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x50'),_0x1ebe3a[_0x3542('0x4')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x6')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xa')]));writeDB(transfers[_0x1ebe3a[_0x3542('0x4')]],!![]);}if(agents[_0x1ebe3a[_0x3542('0x4')]]&&agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x2d')]){agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xe')]=!![];agents[_0x1ebe3a['uniqueid']][_0x3542('0x36')]=utils[_0x3542('0x19')]();agents[_0x1ebe3a['uniqueid']]['talktime']=utils[_0x3542('0x53')](agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x36')],agents[_0x1ebe3a[_0x3542('0x4')]]['agentconnectAt']);agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]=agents[_0x1ebe3a['uniqueid']][_0x3542('0x3b')]?'transfer':_0x3542('0x54');agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]=_0x3542('0x37');utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x50'),_0x1ebe3a[_0x3542('0x4')],agents[_0x1ebe3a[_0x3542('0x4')]]['membername'],agents[_0x1ebe3a[_0x3542('0x4')]]['reason'],agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]));writeDB(agents[_0x1ebe3a[_0x3542('0x4')]]);}}catch(_0x2c6f2b){utils[_0x3542('0x26')](util['format'](_0x3542('0x4e'),_0x1ebe3a[_0x3542('0x4')]),_0x2c6f2b);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 249262e..38bab57 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 _0x0c23=['./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','isNil','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','gotoif','application','lodash','util','./utils'];(function(_0x29c10d,_0x174049){var _0x2d2d12=function(_0x32780d){while(--_0x32780d){_0x29c10d['push'](_0x29c10d['shift']());}};_0x2d2d12(++_0x174049);}(_0x0c23,0x13e));var _0x30c2=function(_0x91ce25,_0x53ff1b){_0x91ce25=_0x91ce25-0x0;var _0x38baaa=_0x0c23[_0x91ce25];return _0x38baaa;};'use strict';var _=require(_0x30c2('0x0'));var util=require(_0x30c2('0x1'));var utils=require(_0x30c2('0x2'));var transfers=require(_0x30c2('0x3'));var dispositions=[_0x30c2('0x4'),_0x30c2('0x5'),_0x30c2('0x5'),'NO\x20ANSWER',_0x30c2('0x4'),_0x30c2('0x4'),_0x30c2('0x6'),_0x30c2('0x7'),_0x30c2('0x5'),_0x30c2('0x5'),'FAILED'];var channels={};function writeDB(_0x406fd0){var _0x41b74d;if(transfers[_0x30c2('0x8')][_0x406fd0[_0x30c2('0x9')]]){_0x41b74d=_0x406fd0[_0x30c2('0x9')];_0x406fd0['uniqueid']=transfers[_0x30c2('0x8')][_0x406fd0[_0x30c2('0x9')]]['transfereeuniqueid'];}utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0xc'),_0x406fd0[_0x30c2('0x9')],_0x406fd0[_0x30c2('0xd')],_0x406fd0[_0x30c2('0xe')],_0x406fd0['membername'],_0x406fd0['interface'],_0x406fd0['calleridnum'],_0x406fd0[_0x30c2('0xf')],_0x406fd0[_0x30c2('0x10')]));if(_0x406fd0[_0x30c2('0x11')]){utils[_0x30c2('0x12')](_0x406fd0[_0x30c2('0x11')])[_0x30c2('0x13')](function(_0x2712dc){if(_0x2712dc){_0x406fd0['UserId']=_0x2712dc['id'];}utils[_0x30c2('0x14')](_0x30c2('0x15'),_0x406fd0);});}else{utils['request'](_0x30c2('0x15'),_0x406fd0);}if(channels[_0x406fd0[_0x30c2('0x9')]]){delete channels[_0x406fd0[_0x30c2('0x9')]];}else if(_0x41b74d&&channels[_0x41b74d]){if(!transfers[_0x30c2('0x8')][_0x41b74d][_0x30c2('0x16')])delete transfers[_0x30c2('0x8')][_0x41b74d];delete channels[_0x41b74d];}}exports[_0x30c2('0x17')]=function(_0x271d10){try{utils[_0x30c2('0x18')](util[_0x30c2('0xb')](_0x30c2('0x19'),_0x271d10[_0x30c2('0x9')]),_0x271d10);if(_0x271d10['uniqueid']==_0x271d10[_0x30c2('0x1a')]&&_0x271d10['channel']!='OutgoingSpoolFailed'){utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x1b'),_0x271d10['uniqueid'],_0x271d10[_0x30c2('0x1c')],_0x271d10[_0x30c2('0x1d')]));channels[_0x271d10[_0x30c2('0x9')]]={'uniqueid':_0x271d10[_0x30c2('0x9')],'accountcode':_0x271d10[_0x30c2('0x11')],'source':_0x271d10[_0x30c2('0x1e')],'destination':_0x271d10[_0x30c2('0x1d')],'destinationcontext':_0x271d10[_0x30c2('0x1c')],'channel':_0x271d10['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x30c2('0x4'),'amaflags':_0x30c2('0x1f')};}}catch(_0x55d4e1){utils[_0x30c2('0x20')](util[_0x30c2('0xb')]('[%s][calls][newchannel]',_0x271d10[_0x30c2('0x9')]),_0x55d4e1);}};exports[_0x30c2('0x21')]=function(_0x1a11b1){try{utils['debug'](util[_0x30c2('0xb')](_0x30c2('0x22'),_0x1a11b1[_0x30c2('0x9')]),_0x1a11b1);if(!_['isNil'](channels[_0x1a11b1[_0x30c2('0x9')]])&&_0x1a11b1[_0x30c2('0x23')]==0x6){utils[_0x30c2('0xa')](util['format'](_0x30c2('0x24'),_0x1a11b1[_0x30c2('0x9')],_0x1a11b1[_0x30c2('0x1c')],_0x1a11b1[_0x30c2('0xd')]));if(_['isNil'](channels[_0x1a11b1['uniqueid']][_0x30c2('0x25')])){channels[_0x1a11b1['uniqueid']][_0x30c2('0x25')]=utils[_0x30c2('0x26')]();}}else if(!_[_0x30c2('0x27')](channels[_0x1a11b1['linkedid']])&&_0x1a11b1[_0x30c2('0x23')]==0x6&&_0x1a11b1[_0x30c2('0x1c')]!='transfer'){utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x28'),_0x1a11b1[_0x30c2('0x9')],_0x1a11b1[_0x30c2('0x1a')],_0x1a11b1[_0x30c2('0x1c')],_0x1a11b1[_0x30c2('0xd')]));channels[_0x1a11b1[_0x30c2('0x1a')]][_0x30c2('0x11')]=_0x1a11b1[_0x30c2('0x11')];channels[_0x1a11b1[_0x30c2('0x1a')]][_0x30c2('0x29')]=_0x1a11b1[_0x30c2('0xd')];if(_[_0x30c2('0x27')](channels[_0x1a11b1[_0x30c2('0x1a')]][_0x30c2('0x2a')])){channels[_0x1a11b1[_0x30c2('0x1a')]]['answertime']=utils['now']();}channels[_0x1a11b1[_0x30c2('0x1a')]]['disposition']=dispositions[_['toNumber'](_0x1a11b1[_0x30c2('0x23')])]||_0x30c2('0x6');}}catch(_0x4f9ee4){utils['error'](util[_0x30c2('0xb')](_0x30c2('0x22'),_0x1a11b1[_0x30c2('0x9')]),_0x4f9ee4);}};exports[_0x30c2('0x2b')]=function(_0x3aa7af){try{if(!_[_0x30c2('0x27')](channels[_0x3aa7af[_0x30c2('0x9')]])){utils['debug'](util[_0x30c2('0xb')](_0x30c2('0x2c'),_0x3aa7af[_0x30c2('0x9')]),_0x3aa7af);if(_['isNil'](channels[_0x3aa7af['uniqueid']][_0x30c2('0x2d')])){channels[_0x3aa7af[_0x30c2('0x9')]][_0x30c2('0x2d')]=_0x3aa7af[_0x30c2('0x2e')]+'\x20<'+_0x3aa7af[_0x30c2('0x1e')]+'>';}utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x2f'),_0x3aa7af[_0x30c2('0x9')],channels[_0x3aa7af[_0x30c2('0x9')]]['callerid'],_0x3aa7af[_0x30c2('0x30')]));channels[_0x3aa7af[_0x30c2('0x9')]][_0x30c2('0x31')]=utils[_0x30c2('0x26')]();channels[_0x3aa7af[_0x30c2('0x9')]][_0x30c2('0x32')]=utils[_0x30c2('0x33')](channels[_0x3aa7af[_0x30c2('0x9')]][_0x30c2('0x31')],channels[_0x3aa7af[_0x30c2('0x9')]][_0x30c2('0x34')]);channels[_0x3aa7af['uniqueid']][_0x30c2('0x35')]=channels[_0x3aa7af[_0x30c2('0x9')]][_0x30c2('0x2a')]?utils[_0x30c2('0x33')](channels[_0x3aa7af[_0x30c2('0x9')]][_0x30c2('0x31')],channels[_0x3aa7af['uniqueid']][_0x30c2('0x2a')]):0x0;writeDB(channels[_0x3aa7af[_0x30c2('0x9')]]);}}catch(_0x2d2af6){utils[_0x30c2('0x20')](util[_0x30c2('0xb')]('[%s][calls][hangup]',_0x3aa7af[_0x30c2('0x9')]),_0x2d2af6);}};exports[_0x30c2('0x36')]=function(_0x5388c7){try{if(!_[_0x30c2('0x27')](channels[_0x5388c7[_0x30c2('0x37')]])){utils['debug'](util[_0x30c2('0xb')]('[%s][calls][attendedtransfer]',_0x5388c7[_0x30c2('0x38')]),_0x5388c7);if(channels[_0x5388c7[_0x30c2('0x37')]][_0x30c2('0xd')]==_0x5388c7[_0x30c2('0x39')]){utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x3a'),_0x5388c7[_0x30c2('0x38')],_0x5388c7[_0x30c2('0x37')],_0x5388c7[_0x30c2('0x3b')]));channels[_0x5388c7[_0x30c2('0x37')]][_0x30c2('0x29')]=_0x5388c7[_0x30c2('0x3b')];channels[_0x5388c7['localtwolinkedid']][_0x30c2('0x3c')]=_0x30c2('0x3d');}else if(channels[_0x5388c7[_0x30c2('0x37')]][_0x30c2('0xd')]=_0x5388c7[_0x30c2('0x3e')]){utils[_0x30c2('0xa')](util[_0x30c2('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5388c7[_0x30c2('0x38')],_0x5388c7[_0x30c2('0x37')],_0x5388c7[_0x30c2('0x3f')]));channels[_0x5388c7[_0x30c2('0x37')]][_0x30c2('0x29')]=_0x5388c7['origtransfererchannel'];channels[_0x5388c7[_0x30c2('0x37')]][_0x30c2('0x3c')]=_0x30c2('0x3d');}}}catch(_0x240918){utils[_0x30c2('0x20')](util[_0x30c2('0xb')](_0x30c2('0x40'),_0x5388c7['origtransfereruniqueid']),_0x240918);}};exports[_0x30c2('0x41')]=function(_0x3fa210){try{if(!_['isNil'](channels[_0x3fa210[_0x30c2('0x9')]])){utils[_0x30c2('0x18')](util[_0x30c2('0xb')](_0x30c2('0x42'),_0x3fa210[_0x30c2('0x9')]),_0x3fa210);channels[_0x3fa210[_0x30c2('0x9')]][_0x30c2('0x43')]=utils[_0x30c2('0x26')]();utils[_0x30c2('0xa')](util[_0x30c2('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3fa210['uniqueid'],channels[_0x3fa210['uniqueid']][_0x30c2('0x43')]));}}catch(_0xc8efc5){utils[_0x30c2('0x20')](util[_0x30c2('0xb')](_0x30c2('0x42'),_0x3fa210['uniqueid']),_0xc8efc5);}};exports['musiconholdstop']=function(_0x38212e){try{if(!_[_0x30c2('0x27')](channels[_0x38212e['uniqueid']])){utils[_0x30c2('0x18')](util['format'](_0x30c2('0x44'),_0x38212e[_0x30c2('0x9')]),_0x38212e);if(!_[_0x30c2('0x27')](channels[_0x38212e[_0x30c2('0x9')]][_0x30c2('0x43')])){channels[_0x38212e[_0x30c2('0x9')]][_0x30c2('0x45')]+=utils[_0x30c2('0x33')](utils['now'](),channels[_0x38212e[_0x30c2('0x9')]][_0x30c2('0x43')]);utils[_0x30c2('0xa')](util['format'](_0x30c2('0x46'),_0x38212e['uniqueid'],channels[_0x38212e[_0x30c2('0x9')]][_0x30c2('0x45')]));delete channels[_0x38212e[_0x30c2('0x9')]][_0x30c2('0x43')];}}}catch(_0x5f1d52){utils['error'](util[_0x30c2('0xb')](_0x30c2('0x44'),_0x38212e[_0x30c2('0x9')]),_0x5f1d52);}};exports[_0x30c2('0x47')]=function(_0x449c29){try{if(!_[_0x30c2('0x27')](channels[_0x449c29[_0x30c2('0x9')]])){utils[_0x30c2('0x18')](util['format'](_0x30c2('0x48'),_0x449c29[_0x30c2('0x9')]),_0x449c29);if(!_['isNil'](_0x449c29[_0x30c2('0x49')]['xmd-originatecalleridnum'])){utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x4a'),_0x449c29[_0x30c2('0x9')],_0x449c29['value']));channels[_0x449c29['uniqueid']]['source']=_0x449c29[_0x30c2('0x4b')];}if(!_[_0x30c2('0x27')](_0x449c29[_0x30c2('0x49')][_0x30c2('0x4c')])){utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x4d'),_0x449c29['uniqueid'],_0x449c29[_0x30c2('0x4b')]));channels[_0x449c29[_0x30c2('0x9')]]['destination']=_0x449c29[_0x30c2('0x4b')];channels[_0x449c29[_0x30c2('0x9')]][_0x30c2('0x2d')]='\x22'+_0x449c29[_0x30c2('0x4b')]+_0x30c2('0x4e')+_0x449c29[_0x30c2('0x4b')]+'>';}if(!_['isNil'](_0x449c29[_0x30c2('0x49')][_0x30c2('0x4f')])||!_['isNil'](_0x449c29[_0x30c2('0x49')]['xmd-callerid'])){utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x50'),_0x449c29['uniqueid'],!_['isNil'](_0x449c29[_0x30c2('0x49')]['xmd-callerid-preview'])?'xmd-callerid-preview':'xmd-callerid',_0x449c29['value']));channels[_0x449c29[_0x30c2('0x9')]][_0x30c2('0x2d')]=_0x449c29[_0x30c2('0x4b')];}if(!_[_0x30c2('0x27')](_0x449c29['variable'][_0x30c2('0x51')])||!_[_0x30c2('0x27')](_0x449c29[_0x30c2('0x49')]['xmcs-queue'])){utils[_0x30c2('0xa')](util[_0x30c2('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x449c29[_0x30c2('0x9')],!_['isNil'](_0x449c29[_0x30c2('0x49')][_0x30c2('0x51')])?_0x30c2('0x51'):_0x30c2('0x52'),_0x449c29[_0x30c2('0x4b')]));channels[_0x449c29[_0x30c2('0x9')]][_0x30c2('0x53')]=_0x30c2('0x54');channels[_0x449c29['uniqueid']][_0x30c2('0x55')]=_0x449c29[_0x30c2('0x4b')];channels[_0x449c29['uniqueid']]['queue']=!![];}if(!_[_0x30c2('0x27')](_0x449c29[_0x30c2('0x49')]['xmd-contactid'])){utils['info'](util['format'](_0x30c2('0x56'),_0x449c29[_0x30c2('0x9')],_0x449c29[_0x30c2('0x4b')]));channels[_0x449c29[_0x30c2('0x9')]]['ContactId']=_0x449c29['value'];}if(!_[_0x30c2('0x27')](_0x449c29[_0x30c2('0x49')]['xmd-cdrtype'])){utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x57'),_0x449c29[_0x30c2('0x9')],_0x449c29[_0x30c2('0x4b')]));channels[_0x449c29['uniqueid']][_0x30c2('0x58')]=_0x449c29[_0x30c2('0x4b')];}if(!_[_0x30c2('0x27')](_0x449c29[_0x30c2('0x49')][_0x30c2('0x59')])){utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x5a'),_0x449c29[_0x30c2('0x9')],_0x449c29[_0x30c2('0x4b')]));channels[_0x449c29[_0x30c2('0x9')]][_0x30c2('0x5b')]=_0x449c29['value'];}if(!_['isNil'](_0x449c29[_0x30c2('0x49')][_0x30c2('0x5c')])){utils[_0x30c2('0xa')](util['format'](_0x30c2('0x5d'),_0x449c29['uniqueid'],_0x449c29[_0x30c2('0x4b')]));channels[_0x449c29[_0x30c2('0x9')]][_0x30c2('0x5c')]=_0x449c29[_0x30c2('0x4b')];}}}catch(_0x254354){utils[_0x30c2('0x20')](util['format']('[%s][calls][varset]',_0x449c29[_0x30c2('0x9')]),_0x254354);}};exports[_0x30c2('0x5e')]=function(_0x13f444){try{if(!_[_0x30c2('0x27')](channels[_0x13f444[_0x30c2('0x9')]])){utils[_0x30c2('0x18')](util[_0x30c2('0xb')](_0x30c2('0x5f'),_0x13f444[_0x30c2('0x9')]),_0x13f444);utils[_0x30c2('0xa')](util[_0x30c2('0xb')](_0x30c2('0x60'),_0x13f444['uniqueid'],_0x13f444['application'],_0x13f444[_0x30c2('0x61')]));if(_0x13f444['application'][_0x30c2('0x62')]()==_0x30c2('0x63')&&_[_0x30c2('0x64')](_0x13f444[_0x30c2('0x61')][_0x30c2('0x62')](),_0x30c2('0x65'))){var _0x1de6f4=_0x13f444[_0x30c2('0x61')]['split']('=');var _0x233c89=_0x1de6f4[0x0][_0x30c2('0x66')](_0x1de6f4[0x0]['lastIndexOf']('(')+0x1,_0x1de6f4[0x0][_0x30c2('0x67')](')'));var _0x19eec2=_0x1de6f4[0x1];channels[_0x13f444['uniqueid']][_0x233c89]=_0x19eec2;}if(!_[_0x30c2('0x68')]([_0x30c2('0x2b'),'noop','execif',_0x30c2('0x63'),_0x30c2('0x69')],_0x13f444[_0x30c2('0x6a')][_0x30c2('0x62')]())){channels[_0x13f444['uniqueid']]['lastapplication']=_0x13f444[_0x30c2('0x6a')];channels[_0x13f444[_0x30c2('0x9')]][_0x30c2('0x55')]=_0x13f444[_0x30c2('0x61')];}}}catch(_0xa81df3){utils[_0x30c2('0x20')](util['format'](_0x30c2('0x5f'),_0x13f444['uniqueid']),_0xa81df3);}}; \ No newline at end of file +var _0x4d4e=['callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','billableseconds','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','cdr','split','includes','hangup','noop','execif','gotoif','lastdata','lodash','./utils','./transfers.controller','FAILED','NO\x20ANSWER','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','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','now','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][hangup]'];(function(_0x3cdf85,_0x448272){var _0x10262a=function(_0x44541f){while(--_0x44541f){_0x3cdf85['push'](_0x3cdf85['shift']());}};_0x10262a(++_0x448272);}(_0x4d4e,0xa4));var _0xe4d4=function(_0x109df9,_0x506331){_0x109df9=_0x109df9-0x0;var _0x47b297=_0x4d4e[_0x109df9];return _0x47b297;};'use strict';var _=require(_0xe4d4('0x0'));var util=require('util');var utils=require(_0xe4d4('0x1'));var transfers=require(_0xe4d4('0x2'));var dispositions=['NO\x20ANSWER',_0xe4d4('0x3'),_0xe4d4('0x3'),_0xe4d4('0x4'),_0xe4d4('0x4'),_0xe4d4('0x4'),'ANSWERED','BUSY',_0xe4d4('0x3'),'FAILED','FAILED'];var channels={};function writeDB(_0x4e9d70){var _0xf010c6;if(transfers[_0xe4d4('0x5')][_0x4e9d70[_0xe4d4('0x6')]]){_0xf010c6=_0x4e9d70[_0xe4d4('0x6')];_0x4e9d70[_0xe4d4('0x6')]=transfers['blinds'][_0x4e9d70['uniqueid']][_0xe4d4('0x7')];}utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0xa'),_0x4e9d70[_0xe4d4('0x6')],_0x4e9d70[_0xe4d4('0xb')],_0x4e9d70[_0xe4d4('0xc')],_0x4e9d70[_0xe4d4('0xd')],_0x4e9d70['interface'],_0x4e9d70[_0xe4d4('0xe')],_0x4e9d70[_0xe4d4('0xf')],_0x4e9d70[_0xe4d4('0x10')]));if(_0x4e9d70['accountcode']){utils[_0xe4d4('0x11')](_0x4e9d70[_0xe4d4('0x12')])[_0xe4d4('0x13')](function(_0x1adc63){if(_0x1adc63){_0x4e9d70['UserId']=_0x1adc63['id'];}utils['request'](_0xe4d4('0x14'),_0x4e9d70);});}else{utils['request'](_0xe4d4('0x14'),_0x4e9d70);}if(channels[_0x4e9d70[_0xe4d4('0x6')]]){delete channels[_0x4e9d70['uniqueid']];}else if(_0xf010c6&&channels[_0xf010c6]){if(!transfers[_0xe4d4('0x5')][_0xf010c6][_0xe4d4('0x15')])delete transfers[_0xe4d4('0x5')][_0xf010c6];delete channels[_0xf010c6];}}exports[_0xe4d4('0x16')]=function(_0x389b84){try{utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x18'),_0x389b84[_0xe4d4('0x6')]),_0x389b84);if(_0x389b84[_0xe4d4('0x6')]==_0x389b84['linkedid']&&_0x389b84[_0xe4d4('0xb')]!=_0xe4d4('0x19')){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x1a'),_0x389b84[_0xe4d4('0x6')],_0x389b84[_0xe4d4('0x1b')],_0x389b84[_0xe4d4('0x1c')]));channels[_0x389b84[_0xe4d4('0x6')]]={'uniqueid':_0x389b84[_0xe4d4('0x6')],'accountcode':_0x389b84[_0xe4d4('0x12')],'source':_0x389b84[_0xe4d4('0xe')],'destination':_0x389b84[_0xe4d4('0x1c')],'destinationcontext':_0x389b84[_0xe4d4('0x1b')],'channel':_0x389b84[_0xe4d4('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe4d4('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x5a93f8){utils['error'](util[_0xe4d4('0x9')](_0xe4d4('0x18'),_0x389b84['uniqueid']),_0x5a93f8);}};exports[_0xe4d4('0x1d')]=function(_0x5b8905){try{utils[_0xe4d4('0x17')](util['format'](_0xe4d4('0x1e'),_0x5b8905['uniqueid']),_0x5b8905);if(!_[_0xe4d4('0x1f')](channels[_0x5b8905[_0xe4d4('0x6')]])&&_0x5b8905['channelstate']==0x6){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x20'),_0x5b8905['uniqueid'],_0x5b8905[_0xe4d4('0x1b')],_0x5b8905[_0xe4d4('0xb')]));if(_['isNil'](channels[_0x5b8905[_0xe4d4('0x6')]]['systemanswertime'])){channels[_0x5b8905[_0xe4d4('0x6')]]['systemanswertime']=utils[_0xe4d4('0x21')]();}}else if(!_['isNil'](channels[_0x5b8905[_0xe4d4('0x22')]])&&_0x5b8905[_0xe4d4('0x23')]==0x6&&_0x5b8905[_0xe4d4('0x1b')]!=_0xe4d4('0x24')){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x25'),_0x5b8905[_0xe4d4('0x6')],_0x5b8905[_0xe4d4('0x22')],_0x5b8905['context'],_0x5b8905[_0xe4d4('0xb')]));channels[_0x5b8905[_0xe4d4('0x22')]][_0xe4d4('0x12')]=_0x5b8905[_0xe4d4('0x12')];channels[_0x5b8905['linkedid']][_0xe4d4('0x26')]=_0x5b8905[_0xe4d4('0xb')];if(_['isNil'](channels[_0x5b8905[_0xe4d4('0x22')]][_0xe4d4('0x27')])){channels[_0x5b8905[_0xe4d4('0x22')]][_0xe4d4('0x27')]=utils['now']();}channels[_0x5b8905['linkedid']][_0xe4d4('0x28')]=dispositions[_[_0xe4d4('0x29')](_0x5b8905[_0xe4d4('0x23')])]||'ANSWERED';}}catch(_0xee583f){utils[_0xe4d4('0x2a')](util[_0xe4d4('0x9')]('[%s][calls][newstate]',_0x5b8905[_0xe4d4('0x6')]),_0xee583f);}};exports['hangup']=function(_0x168e44){try{if(!_[_0xe4d4('0x1f')](channels[_0x168e44[_0xe4d4('0x6')]])){utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x2b'),_0x168e44[_0xe4d4('0x6')]),_0x168e44);if(_[_0xe4d4('0x1f')](channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x2c')])){channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x2c')]=_0x168e44[_0xe4d4('0x2d')]+'\x20<'+_0x168e44[_0xe4d4('0xe')]+'>';}utils['info'](util['format'](_0xe4d4('0x2e'),_0x168e44[_0xe4d4('0x6')],channels[_0x168e44['uniqueid']][_0xe4d4('0x2c')],_0x168e44[_0xe4d4('0x2f')]));channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x30')]=utils['now']();channels[_0x168e44[_0xe4d4('0x6')]]['duration']=utils['diffTime'](channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x30')],channels[_0x168e44[_0xe4d4('0x6')]]['starttime']);channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x31')]=channels[_0x168e44[_0xe4d4('0x6')]]['answertime']?utils[_0xe4d4('0x32')](channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x30')],channels[_0x168e44['uniqueid']][_0xe4d4('0x27')]):0x0;writeDB(channels[_0x168e44[_0xe4d4('0x6')]]);}}catch(_0x733f2e){utils['error'](util[_0xe4d4('0x9')](_0xe4d4('0x2b'),_0x168e44[_0xe4d4('0x6')]),_0x733f2e);}};exports['attendedtransfer']=function(_0xab5bcd){try{if(!_['isNil'](channels[_0xab5bcd[_0xe4d4('0x33')]])){utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x34'),_0xab5bcd[_0xe4d4('0x35')]),_0xab5bcd);if(channels[_0xab5bcd[_0xe4d4('0x33')]][_0xe4d4('0xb')]==_0xab5bcd[_0xe4d4('0x36')]){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x37'),_0xab5bcd[_0xe4d4('0x35')],_0xab5bcd[_0xe4d4('0x33')],_0xab5bcd[_0xe4d4('0x38')]));channels[_0xab5bcd['localtwolinkedid']][_0xe4d4('0x26')]=_0xab5bcd[_0xe4d4('0x38')];channels[_0xab5bcd['localtwolinkedid']][_0xe4d4('0x39')]=_0xe4d4('0x3a');}else if(channels[_0xab5bcd[_0xe4d4('0x33')]][_0xe4d4('0xb')]=_0xab5bcd[_0xe4d4('0x3b')]){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x37'),_0xab5bcd[_0xe4d4('0x35')],_0xab5bcd[_0xe4d4('0x33')],_0xab5bcd[_0xe4d4('0x3c')]));channels[_0xab5bcd[_0xe4d4('0x33')]][_0xe4d4('0x26')]=_0xab5bcd[_0xe4d4('0x3c')];channels[_0xab5bcd[_0xe4d4('0x33')]][_0xe4d4('0x39')]='_attended';}}}catch(_0x307308){utils[_0xe4d4('0x2a')](util[_0xe4d4('0x9')](_0xe4d4('0x34'),_0xab5bcd[_0xe4d4('0x35')]),_0x307308);}};exports[_0xe4d4('0x3d')]=function(_0x4e0571){try{if(!_[_0xe4d4('0x1f')](channels[_0x4e0571[_0xe4d4('0x6')]])){utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x3e'),_0x4e0571[_0xe4d4('0x6')]),_0x4e0571);channels[_0x4e0571[_0xe4d4('0x6')]][_0xe4d4('0x3f')]=utils['now']();utils['info'](util[_0xe4d4('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4e0571[_0xe4d4('0x6')],channels[_0x4e0571[_0xe4d4('0x6')]][_0xe4d4('0x3f')]));}}catch(_0x2ac6b8){utils[_0xe4d4('0x2a')](util[_0xe4d4('0x9')](_0xe4d4('0x3e'),_0x4e0571[_0xe4d4('0x6')]),_0x2ac6b8);}};exports[_0xe4d4('0x40')]=function(_0x159399){try{if(!_[_0xe4d4('0x1f')](channels[_0x159399[_0xe4d4('0x6')]])){utils[_0xe4d4('0x17')](util['format'](_0xe4d4('0x41'),_0x159399[_0xe4d4('0x6')]),_0x159399);if(!_['isNil'](channels[_0x159399[_0xe4d4('0x6')]][_0xe4d4('0x3f')])){channels[_0x159399[_0xe4d4('0x6')]][_0xe4d4('0x42')]+=utils[_0xe4d4('0x32')](utils['now'](),channels[_0x159399[_0xe4d4('0x6')]][_0xe4d4('0x3f')]);utils['info'](util['format'](_0xe4d4('0x43'),_0x159399[_0xe4d4('0x6')],channels[_0x159399[_0xe4d4('0x6')]][_0xe4d4('0x42')]));delete channels[_0x159399['uniqueid']][_0xe4d4('0x3f')];}}}catch(_0x5624a5){utils[_0xe4d4('0x2a')](util[_0xe4d4('0x9')](_0xe4d4('0x41'),_0x159399[_0xe4d4('0x6')]),_0x5624a5);}};exports['varset']=function(_0x1c11ad){try{if(!_[_0xe4d4('0x1f')](channels[_0x1c11ad[_0xe4d4('0x6')]])){utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x44'),_0x1c11ad[_0xe4d4('0x6')]),_0x1c11ad);if(!_[_0xe4d4('0x1f')](_0x1c11ad['variable'][_0xe4d4('0x45')])){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x47')]=_0x1c11ad['value'];}if(!_[_0xe4d4('0x1f')](_0x1c11ad['variable'][_0xe4d4('0x48')])){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x49'),_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x4a')]=_0x1c11ad[_0xe4d4('0x46')];channels[_0x1c11ad[_0xe4d4('0x6')]]['callerid']='\x22'+_0x1c11ad[_0xe4d4('0x46')]+'\x22\x20<'+_0x1c11ad[_0xe4d4('0x46')]+'>';}if(!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x4c')])||!_['isNil'](_0x1c11ad[_0xe4d4('0x4b')]['xmd-callerid'])){utils['info'](util[_0xe4d4('0x9')](_0xe4d4('0x4d'),_0x1c11ad['uniqueid'],!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x4c')])?_0xe4d4('0x4c'):'xmd-callerid',_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x2c')]=_0x1c11ad[_0xe4d4('0x46')];}if(!_[_0xe4d4('0x1f')](_0x1c11ad['variable'][_0xe4d4('0x4e')])||!_['isNil'](_0x1c11ad['variable'][_0xe4d4('0x4f')])){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x4d'),_0x1c11ad['uniqueid'],!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x4e')])?_0xe4d4('0x4e'):_0xe4d4('0x4f'),_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x50')]='Queue';channels[_0x1c11ad[_0xe4d4('0x6')]]['lastdata']=_0x1c11ad[_0xe4d4('0x46')];channels[_0x1c11ad['uniqueid']][_0xe4d4('0xc')]=!![];}if(!_['isNil'](_0x1c11ad['variable'][_0xe4d4('0x51')])){utils['info'](util[_0xe4d4('0x9')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]]['ContactId']=_0x1c11ad['value'];}if(!_[_0xe4d4('0x1f')](_0x1c11ad['variable'][_0xe4d4('0x52')])){utils['info'](util[_0xe4d4('0x9')](_0xe4d4('0x53'),_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x54')]=_0x1c11ad[_0xe4d4('0x46')];}if(!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x55')])){utils[_0xe4d4('0x8')](util['format'](_0xe4d4('0x56'),_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad['value']));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x57')]=_0x1c11ad['value'];}if(!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x58')])){utils[_0xe4d4('0x8')](util['format'](_0xe4d4('0x59'),_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad['uniqueid']][_0xe4d4('0x58')]=_0x1c11ad[_0xe4d4('0x46')];}}}catch(_0x8dcd12){utils[_0xe4d4('0x2a')](util['format']('[%s][calls][varset]',_0x1c11ad[_0xe4d4('0x6')]),_0x8dcd12);}};exports[_0xe4d4('0x5a')]=function(_0x1caa1e){try{if(!_[_0xe4d4('0x1f')](channels[_0x1caa1e[_0xe4d4('0x6')]])){utils['debug'](util[_0xe4d4('0x9')](_0xe4d4('0x5b'),_0x1caa1e[_0xe4d4('0x6')]),_0x1caa1e);utils['info'](util[_0xe4d4('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1caa1e[_0xe4d4('0x6')],_0x1caa1e[_0xe4d4('0x5c')],_0x1caa1e[_0xe4d4('0x5d')]));if(_0x1caa1e[_0xe4d4('0x5c')][_0xe4d4('0x5e')]()==_0xe4d4('0x5f')&&_['startsWith'](_0x1caa1e[_0xe4d4('0x5d')][_0xe4d4('0x5e')](),_0xe4d4('0x60'))){var _0x5015f7=_0x1caa1e[_0xe4d4('0x5d')][_0xe4d4('0x61')]('=');var _0x580c0d=_0x5015f7[0x0]['substring'](_0x5015f7[0x0]['lastIndexOf']('(')+0x1,_0x5015f7[0x0]['lastIndexOf'](')'));var _0x30aab5=_0x5015f7[0x1];channels[_0x1caa1e[_0xe4d4('0x6')]][_0x580c0d]=_0x30aab5;}if(!_[_0xe4d4('0x62')]([_0xe4d4('0x63'),_0xe4d4('0x64'),_0xe4d4('0x65'),_0xe4d4('0x5f'),_0xe4d4('0x66')],_0x1caa1e['application'][_0xe4d4('0x5e')]())){channels[_0x1caa1e[_0xe4d4('0x6')]][_0xe4d4('0x50')]=_0x1caa1e[_0xe4d4('0x5c')];channels[_0x1caa1e[_0xe4d4('0x6')]][_0xe4d4('0x67')]=_0x1caa1e[_0xe4d4('0x5d')];}}}catch(_0x5598dc){utils['error'](util[_0xe4d4('0x9')](_0xe4d4('0x5b'),_0x1caa1e[_0xe4d4('0x6')]),_0x5598dc);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b3db02e..364cff6 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 _0x0999=['error','[core]\x20error','close','./utils','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x44939b,_0x219c50){var _0x800f0=function(_0x1821be){while(--_0x1821be){_0x44939b['push'](_0x44939b['shift']());}};_0x800f0(++_0x219c50);}(_0x0999,0xa5));var _0x9099=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0999[_0x3947c9];return _0x2e7871;};'use strict';var utils=require(_0x9099('0x0'));exports['connect']=function(){utils[_0x9099('0x1')]('[core]\x20connected');};exports[_0x9099('0x2')]=function(){utils['info'](_0x9099('0x3'));};exports[_0x9099('0x4')]=function(){utils[_0x9099('0x1')](_0x9099('0x5'));};exports[_0x9099('0x6')]=function(_0xc90c83){utils[_0x9099('0x6')](_0x9099('0x7'),_0xc90c83);};exports[_0x9099('0x8')]=function(){utils[_0x9099('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x441c99){}; \ No newline at end of file +var _0xa644=['[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x5c9b38,_0xc2867){var _0x59516b=function(_0x5457ec){while(--_0x5457ec){_0x5c9b38['push'](_0x5c9b38['shift']());}};_0x59516b(++_0xc2867);}(_0xa644,0x15b));var _0x4a64=function(_0x24def2,_0x36557c){_0x24def2=_0x24def2-0x0;var _0x1ab2d8=_0xa644[_0x24def2];return _0x1ab2d8;};'use strict';var utils=require(_0x4a64('0x0'));exports[_0x4a64('0x1')]=function(){utils[_0x4a64('0x2')](_0x4a64('0x3'));};exports[_0x4a64('0x4')]=function(){utils['info'](_0x4a64('0x5'));};exports[_0x4a64('0x6')]=function(){utils[_0x4a64('0x2')]('[core]\x20fullybooted');};exports[_0x4a64('0x7')]=function(_0x75be77){utils['error'](_0x4a64('0x8'),_0x75be77);};exports[_0x4a64('0x9')]=function(){utils[_0x4a64('0x2')](_0x4a64('0xa'));};exports['managerevent']=function(_0x5a9571){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 6c560eb..fdb42e4 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 _0x4083=['assign','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER'];(function(_0x19936d,_0x2e9787){var _0x2725e3=function(_0x7aee5b){while(--_0x7aee5b){_0x19936d['push'](_0x19936d['shift']());}};_0x2725e3(++_0x2e9787);}(_0x4083,0x1d9));var _0x3408=function(_0x21de1e,_0x304b33){_0x21de1e=_0x21de1e-0x0;var _0xa0eb39=_0x4083[_0x21de1e];return _0xa0eb39;};'use strict';var _=require(_0x3408('0x0'));var util=require(_0x3408('0x1'));var utils=require(_0x3408('0x2'));var dials={};function writeDB(_0x127514){utils[_0x3408('0x3')](util[_0x3408('0x4')](_0x3408('0x5'),_0x127514['uniqueid'],_0x127514[_0x3408('0x6')],_0x127514[_0x3408('0x7')],_0x127514[_0x3408('0x8')],_0x127514[_0x3408('0x9')],_0x127514[_0x3408('0xa')]));utils[_0x3408('0xb')]('CreateVoiceDialReport',_0x127514);delete dials[_0x127514['uniqueid']];}exports['newexten']=function(_0x583319){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x583319[_0x3408('0xc')]),_0x583319);utils[_0x3408('0x3')](util[_0x3408('0x4')](_0x3408('0xd'),_0x583319['uniqueid'],_0x583319[_0x3408('0xe')],_0x583319[_0x3408('0xf')]));if(_0x583319[_0x3408('0xe')][_0x3408('0x10')]()==_0x3408('0x11')&&_[_0x3408('0x12')](_0x583319[_0x3408('0xf')][_0x3408('0x10')](),'cdr(routeid)')){var _0x29748a=_0x583319['appdata'][_0x3408('0x13')]('=');dials[_0x583319[_0x3408('0xc')]]={'routeId':_0x29748a[0x1]};}}catch(_0x3fffe8){utils[_0x3408('0x14')](util[_0x3408('0x4')]('[%s][dials][newexten]',_0x583319['uniqueid']),_0x3fffe8);}};exports['varset']=function(_0xdd8008){try{utils[_0x3408('0x15')](util[_0x3408('0x4')](_0x3408('0x16'),_0xdd8008[_0x3408('0xc')]),_0xdd8008);if(!_[_0x3408('0x17')](_0xdd8008[_0x3408('0x18')][_0x3408('0x19')])){utils[_0x3408('0x3')](util[_0x3408('0x4')](_0x3408('0x1a'),_0xdd8008[_0x3408('0xc')],_0xdd8008[_0x3408('0x1b')]));dials[_0xdd8008['uniqueid']]={'routeId':_0xdd8008['value']};}}catch(_0x51c082){utils['error'](util[_0x3408('0x4')]('[%s][dials][varset]',_0xdd8008[_0x3408('0xc')]),_0x51c082);}};exports[_0x3408('0x1c')]=function(_0x9551e7){try{if(!_['isNil'](dials[_0x9551e7[_0x3408('0xc')]])){utils[_0x3408('0x15')](util[_0x3408('0x4')]('[%s][dials][dialbegin]',_0x9551e7[_0x3408('0xc')]),_0x9551e7);dials[_0x9551e7[_0x3408('0xc')]]=_['assign'](dials[_0x9551e7[_0x3408('0xc')]],_0x9551e7);dials[_0x9551e7[_0x3408('0xc')]][_0x3408('0x1d')]=utils[_0x3408('0x1e')]();dials[_0x9551e7[_0x3408('0xc')]][_0x3408('0x1f')]=_0x3408('0x20');utils['info'](util[_0x3408('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x9551e7[_0x3408('0xc')],dials[_0x9551e7[_0x3408('0xc')]][_0x3408('0x1d')]));}}catch(_0x39d038){utils[_0x3408('0x14')](util[_0x3408('0x4')](_0x3408('0x21'),_0x9551e7['uniqueid']),_0x39d038);}};exports[_0x3408('0x22')]=function(_0xd7aa5a){try{if(!_['isNil'](dials[_0xd7aa5a[_0x3408('0xc')]])){utils[_0x3408('0x15')](util[_0x3408('0x4')](_0x3408('0x23'),_0xd7aa5a[_0x3408('0xc')]),_0xd7aa5a);dials[_0xd7aa5a['uniqueid']]['dialstatus']=_0xd7aa5a[_0x3408('0xa')];if(_0xd7aa5a[_0x3408('0xa')]==_0x3408('0x24')){dials[_0xd7aa5a[_0x3408('0xc')]]=_[_0x3408('0x25')](dials[_0xd7aa5a[_0x3408('0xc')]],_0xd7aa5a);dials[_0xd7aa5a[_0x3408('0xc')]]['answertime']=utils[_0x3408('0x1e')]();dials[_0xd7aa5a['uniqueid']]['lastevent']=_0x3408('0x26');utils[_0x3408('0x3')](util['format'](_0x3408('0x27'),_0xd7aa5a[_0x3408('0xc')],_0xd7aa5a[_0x3408('0xa')],dials[_0xd7aa5a[_0x3408('0xc')]][_0x3408('0x28')]));}else{utils[_0x3408('0x3')](util['format'](_0x3408('0x29'),_0xd7aa5a['uniqueid'],_0xd7aa5a[_0x3408('0xa')]));}}}catch(_0x581b1d){utils['error'](util[_0x3408('0x4')](_0x3408('0x23'),_0xd7aa5a['uniqueid']),_0x581b1d);}};exports[_0x3408('0x2a')]=function(_0x531bba){try{if(!_[_0x3408('0x17')](dials[_0x531bba[_0x3408('0xc')]])){utils[_0x3408('0x15')](util['format'](_0x3408('0x2b'),_0x531bba[_0x3408('0xc')]),_0x531bba);utils[_0x3408('0x3')](util[_0x3408('0x4')](_0x3408('0x2c'),_0x531bba[_0x3408('0xc')],_0x531bba[_0x3408('0x8')],_0x531bba[_0x3408('0x2d')],_0x531bba['cause-txt']));dials[_0x531bba[_0x3408('0xc')]]=_[_0x3408('0x25')](dials[_0x531bba[_0x3408('0xc')]],{'endtime':utils[_0x3408('0x1e')](),'lastevent':'complete'});dials[_0x531bba[_0x3408('0xc')]][_0x3408('0x2e')]=utils['diffTime'](dials[_0x531bba[_0x3408('0xc')]][_0x3408('0x2f')],dials[_0x531bba['uniqueid']][_0x3408('0x1d')]);dials[_0x531bba[_0x3408('0xc')]][_0x3408('0x30')]=utils[_0x3408('0x31')](dials[_0x531bba[_0x3408('0xc')]]['answertime']||dials[_0x531bba[_0x3408('0xc')]][_0x3408('0x2f')],dials[_0x531bba['uniqueid']][_0x3408('0x1d')]);dials[_0x531bba[_0x3408('0xc')]][_0x3408('0x32')]=dials[_0x531bba['uniqueid']][_0x3408('0x28')]?utils[_0x3408('0x31')](dials[_0x531bba[_0x3408('0xc')]][_0x3408('0x2f')],dials[_0x531bba[_0x3408('0xc')]][_0x3408('0x28')]):0x0;writeDB(dials[_0x531bba[_0x3408('0xc')]]);}}catch(_0xed33cf){utils['error'](util[_0x3408('0x4')]('[%s][dials][hangup]',_0x531bba[_0x3408('0xc')]),_0xed33cf);}}; \ No newline at end of file +var _0x9486=['diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration'];(function(_0x508c0a,_0x1bcd5e){var _0x1c19b7=function(_0x21300d){while(--_0x21300d){_0x508c0a['push'](_0x508c0a['shift']());}};_0x1c19b7(++_0x1bcd5e);}(_0x9486,0xd8));var _0x6948=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9486[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x6948('0x0'));var util=require(_0x6948('0x1'));var utils=require(_0x6948('0x2'));var dials={};function writeDB(_0x3d69e6){utils['info'](util[_0x6948('0x3')](_0x6948('0x4'),_0x3d69e6['uniqueid'],_0x3d69e6[_0x6948('0x5')],_0x3d69e6[_0x6948('0x6')],_0x3d69e6['calleridnum'],_0x3d69e6[_0x6948('0x7')],_0x3d69e6[_0x6948('0x8')]));utils[_0x6948('0x9')](_0x6948('0xa'),_0x3d69e6);delete dials[_0x3d69e6[_0x6948('0xb')]];}exports[_0x6948('0xc')]=function(_0x5340d5){try{utils['debug'](util[_0x6948('0x3')]('[%s][dials][newexten]',_0x5340d5['uniqueid']),_0x5340d5);utils[_0x6948('0xd')](util['format'](_0x6948('0xe'),_0x5340d5[_0x6948('0xb')],_0x5340d5[_0x6948('0xf')],_0x5340d5[_0x6948('0x10')]));if(_0x5340d5[_0x6948('0xf')]['toLowerCase']()==_0x6948('0x11')&&_['startsWith'](_0x5340d5['appdata'][_0x6948('0x12')](),_0x6948('0x13'))){var _0x590f73=_0x5340d5[_0x6948('0x10')][_0x6948('0x14')]('=');dials[_0x5340d5['uniqueid']]={'routeId':_0x590f73[0x1]};}}catch(_0xab9e28){utils[_0x6948('0x15')](util['format'](_0x6948('0x16'),_0x5340d5[_0x6948('0xb')]),_0xab9e28);}};exports[_0x6948('0x17')]=function(_0x2d7f02){try{utils[_0x6948('0x18')](util[_0x6948('0x3')](_0x6948('0x19'),_0x2d7f02['uniqueid']),_0x2d7f02);if(!_['isNil'](_0x2d7f02['variable'][_0x6948('0x1a')])){utils[_0x6948('0xd')](util[_0x6948('0x3')](_0x6948('0x1b'),_0x2d7f02[_0x6948('0xb')],_0x2d7f02[_0x6948('0x1c')]));dials[_0x2d7f02[_0x6948('0xb')]]={'routeId':_0x2d7f02[_0x6948('0x1c')]};}}catch(_0x4f873b){utils['error'](util[_0x6948('0x3')]('[%s][dials][varset]',_0x2d7f02[_0x6948('0xb')]),_0x4f873b);}};exports[_0x6948('0x1d')]=function(_0x61169f){try{if(!_['isNil'](dials[_0x61169f[_0x6948('0xb')]])){utils[_0x6948('0x18')](util[_0x6948('0x3')](_0x6948('0x1e'),_0x61169f[_0x6948('0xb')]),_0x61169f);dials[_0x61169f[_0x6948('0xb')]]=_[_0x6948('0x1f')](dials[_0x61169f[_0x6948('0xb')]],_0x61169f);dials[_0x61169f['uniqueid']][_0x6948('0x20')]=utils[_0x6948('0x21')]();dials[_0x61169f[_0x6948('0xb')]]['lastevent']=_0x6948('0x22');utils[_0x6948('0xd')](util['format'](_0x6948('0x23'),_0x61169f[_0x6948('0xb')],dials[_0x61169f[_0x6948('0xb')]][_0x6948('0x20')]));}}catch(_0x35ad9a){utils[_0x6948('0x15')](util[_0x6948('0x3')](_0x6948('0x1e'),_0x61169f[_0x6948('0xb')]),_0x35ad9a);}};exports[_0x6948('0x24')]=function(_0x788d5){try{if(!_['isNil'](dials[_0x788d5['uniqueid']])){utils[_0x6948('0x18')](util['format'](_0x6948('0x25'),_0x788d5[_0x6948('0xb')]),_0x788d5);dials[_0x788d5[_0x6948('0xb')]][_0x6948('0x8')]=_0x788d5['dialstatus'];if(_0x788d5[_0x6948('0x8')]==_0x6948('0x26')){dials[_0x788d5['uniqueid']]=_[_0x6948('0x1f')](dials[_0x788d5[_0x6948('0xb')]],_0x788d5);dials[_0x788d5[_0x6948('0xb')]][_0x6948('0x27')]=utils['now']();dials[_0x788d5[_0x6948('0xb')]]['lastevent']=_0x6948('0x28');utils[_0x6948('0xd')](util[_0x6948('0x3')](_0x6948('0x29'),_0x788d5[_0x6948('0xb')],_0x788d5[_0x6948('0x8')],dials[_0x788d5[_0x6948('0xb')]]['answertime']));}else{utils[_0x6948('0xd')](util[_0x6948('0x3')](_0x6948('0x2a'),_0x788d5[_0x6948('0xb')],_0x788d5[_0x6948('0x8')]));}}}catch(_0x27d59d){utils[_0x6948('0x15')](util[_0x6948('0x3')](_0x6948('0x25'),_0x788d5[_0x6948('0xb')]),_0x27d59d);}};exports[_0x6948('0x2b')]=function(_0x3b675f){try{if(!_['isNil'](dials[_0x3b675f[_0x6948('0xb')]])){utils[_0x6948('0x18')](util[_0x6948('0x3')](_0x6948('0x2c'),_0x3b675f['uniqueid']),_0x3b675f);utils[_0x6948('0xd')](util['format'](_0x6948('0x2d'),_0x3b675f[_0x6948('0xb')],_0x3b675f['calleridnum'],_0x3b675f['calleridname'],_0x3b675f[_0x6948('0x2e')]));dials[_0x3b675f[_0x6948('0xb')]]=_['assign'](dials[_0x3b675f[_0x6948('0xb')]],{'endtime':utils['now'](),'lastevent':_0x6948('0x2f')});dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x30')]=utils[_0x6948('0x31')](dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x32')],dials[_0x3b675f['uniqueid']][_0x6948('0x20')]);dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x33')]=utils['diffTime'](dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x27')]||dials[_0x3b675f['uniqueid']]['endtime'],dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x20')]);dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x34')]=dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x27')]?utils[_0x6948('0x31')](dials[_0x3b675f['uniqueid']][_0x6948('0x32')],dials[_0x3b675f['uniqueid']][_0x6948('0x27')]):0x0;writeDB(dials[_0x3b675f[_0x6948('0xb')]]);}}catch(_0x2bc9a4){utils[_0x6948('0x15')](util[_0x6948('0x3')](_0x6948('0x2c'),_0x3b675f[_0x6948('0xb')]),_0x2bc9a4);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 541aff6..0187776 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 _0x1bb5=['[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','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]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','agentringnoanswer','debug'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1bb5,0xe9));var _0x51bb=function(_0x436849,_0x430b00){_0x436849=_0x436849-0x0;var _0x5c5f73=_0x1bb5[_0x436849];return _0x5c5f73;};var AsteriskManager=require(_0x51bb('0x0'));var config=require('../../config/environment');var utils=require(_0x51bb('0x1'));var util=require(_0x51bb('0x2'));var ami=new AsteriskManager(config['asterisk']['port'],config['asterisk']['ip'],config[_0x51bb('0x3')][_0x51bb('0x4')],config[_0x51bb('0x3')][_0x51bb('0x5')],!![]);ami[_0x51bb('0x6')]();if(config[_0x51bb('0x7')]&&config[_0x51bb('0x7')][_0x51bb('0x8')]){utils[_0x51bb('0x9')](_0x51bb('0xa'));}else{var agents=require(_0x51bb('0xb'));var calls=require(_0x51bb('0xc'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x51bb('0xd'));var dials=require(_0x51bb('0xe'));var transfers=require(_0x51bb('0xf'));var core=require(_0x51bb('0x10'));ami['on'](_0x51bb('0x11'),core[_0x51bb('0x11')]);ami['on'](_0x51bb('0x12'),core[_0x51bb('0x12')]);ami['on']('fullybooted',core[_0x51bb('0x13')]);ami['on'](_0x51bb('0x14'),core['error']);ami['on']('close',core[_0x51bb('0x15')]);ami['on'](_0x51bb('0x16'),core[_0x51bb('0x16')]);ami['on'](_0x51bb('0x17'),function(_0x508cfe){try{utils['debug'](util['format'](_0x51bb('0x18'),_0x508cfe[_0x51bb('0x19')]),_0x508cfe);members['devicestatechange'](_0x508cfe);}catch(_0x62b21e){utils['error'](util[_0x51bb('0x1a')](_0x51bb('0x18'),_0x508cfe[_0x51bb('0x19')]),_0x62b21e);}});ami['on'](_0x51bb('0x1b'),function(_0x23bbb2){try{utils['debug'](util[_0x51bb('0x1a')](_0x51bb('0x1c'),_0x23bbb2['uniqueid']),_0x23bbb2);agents[_0x51bb('0x1b')](_0x23bbb2);}catch(_0x505910){utils['error'](util[_0x51bb('0x1a')](_0x51bb('0x1c'),_0x23bbb2['uniqueid']),_0x505910);}});ami['on'](_0x51bb('0x1d'),function(_0x21440e){try{utils[_0x51bb('0x1e')](util[_0x51bb('0x1a')](_0x51bb('0x1f'),_0x21440e['uniqueid']),_0x21440e);agents[_0x51bb('0x1d')](_0x21440e);}catch(_0x14d16d){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x1f'),_0x21440e[_0x51bb('0x20')]),_0x14d16d);}});ami['on'](_0x51bb('0x21'),function(_0x912e09){try{utils['debug'](util['format'](_0x51bb('0x22'),_0x912e09['uniqueid']),_0x912e09);agents[_0x51bb('0x21')](_0x912e09);queues[_0x51bb('0x21')](_0x912e09);}catch(_0x771e93){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')]('[%s][index][agentconnect]',_0x912e09[_0x51bb('0x20')]),_0x771e93);}});ami['on']('agentcomplete',function(_0x1effd1){try{utils[_0x51bb('0x1e')](util['format'](_0x51bb('0x23'),_0x1effd1[_0x51bb('0x20')]),_0x1effd1);agents[_0x51bb('0x24')](_0x1effd1);queues['agentcomplete'](_0x1effd1);members[_0x51bb('0x24')](_0x1effd1);}catch(_0x42ae34){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x23'),_0x1effd1[_0x51bb('0x20')]),_0x42ae34);}});ami['on'](_0x51bb('0x25'),function(_0x178de7){try{utils[_0x51bb('0x1e')](util[_0x51bb('0x1a')](_0x51bb('0x26'),_0x178de7['uniqueid']),_0x178de7);agents[_0x51bb('0x25')](_0x178de7);queues[_0x51bb('0x25')](_0x178de7);}catch(_0x23b21c){utils[_0x51bb('0x14')](util['format'](_0x51bb('0x26'),_0x178de7[_0x51bb('0x20')]),_0x23b21c);}});ami['on'](_0x51bb('0x27'),function(_0x35943e){try{utils['debug'](util['format']('[%s][index][queuecallerjoin]',_0x35943e[_0x51bb('0x20')]),_0x35943e);queues[_0x51bb('0x27')](_0x35943e);recordings['queuecallerjoin'](_0x35943e);}catch(_0x5a0c5f){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x28'),_0x35943e[_0x51bb('0x20')]),_0x5a0c5f);}});ami['on'](_0x51bb('0x29'),function(_0xc4202a){try{utils['debug'](util['format'](_0x51bb('0x2a'),_0xc4202a[_0x51bb('0x20')]),_0xc4202a);queues[_0x51bb('0x29')](_0xc4202a);}catch(_0x1e7462){utils[_0x51bb('0x14')](util['format']('[%s][index][queuecallerleave]',_0xc4202a[_0x51bb('0x20')]),_0x1e7462);}});ami['on'](_0x51bb('0x2b'),function(_0x16b1ca){try{utils['debug'](util[_0x51bb('0x1a')](_0x51bb('0x2c'),_0x16b1ca[_0x51bb('0x20')]),_0x16b1ca);queues['musiconholdstart'](_0x16b1ca);calls['musiconholdstart'](_0x16b1ca);}catch(_0x2f2ae4){utils['error'](util['format']('[%s][index][musiconholdstart]',_0x16b1ca[_0x51bb('0x20')]),_0x2f2ae4);}});ami['on'](_0x51bb('0x2d'),function(_0x131112){try{utils['debug'](util[_0x51bb('0x1a')](_0x51bb('0x2e'),_0x131112['uniqueid']),_0x131112);queues[_0x51bb('0x2d')](_0x131112);calls[_0x51bb('0x2d')](_0x131112);}catch(_0x3cac1f){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x2e'),_0x131112[_0x51bb('0x20')]),_0x3cac1f);}});ami['on'](_0x51bb('0x2f'),function(_0x499482){try{utils[_0x51bb('0x1e')](util[_0x51bb('0x1a')]('[%s][index][newstate]',_0x499482['uniqueid']),_0x499482);calls[_0x51bb('0x2f')](_0x499482);recordings[_0x51bb('0x2f')](_0x499482);}catch(_0x3c03f9){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x30'),_0x499482['uniqueid']),_0x3c03f9);}});ami['on']('hangup',function(_0x45fa01){try{utils[_0x51bb('0x1e')](util['format'](_0x51bb('0x31'),_0x45fa01[_0x51bb('0x20')]),_0x45fa01);calls['hangup'](_0x45fa01);recordings['hangup'](_0x45fa01);dials[_0x51bb('0x32')](_0x45fa01);agents[_0x51bb('0x32')](_0x45fa01);queues[_0x51bb('0x32')](_0x45fa01);}catch(_0x138ae1){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x31'),_0x45fa01['uniqueid']),_0x138ae1);}});ami['on'](_0x51bb('0x33'),function(_0xad6a5e){try{utils['debug'](util[_0x51bb('0x1a')](_0x51bb('0x34'),_0xad6a5e[_0x51bb('0x20')]),_0xad6a5e);members[_0x51bb('0x33')](_0xad6a5e);}catch(_0x26cb45){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')]('[%s][index][cdr]',_0xad6a5e[_0x51bb('0x20')]),_0x26cb45);}});ami['on'](_0x51bb('0x35'),function(_0x4745e9){try{utils['debug'](util['format'](_0x51bb('0x36'),_0x4745e9['uniqueid']),_0x4745e9);queues['blindtransfer'](_0x4745e9);agents[_0x51bb('0x35')](_0x4745e9);transfers[_0x51bb('0x35')](_0x4745e9);recordings[_0x51bb('0x35')](_0x4745e9);}catch(_0x204767){utils['error'](util[_0x51bb('0x1a')](_0x51bb('0x36'),_0x4745e9[_0x51bb('0x20')]),_0x204767);}});ami['on'](_0x51bb('0x37'),function(_0x41a5d5){try{utils[_0x51bb('0x1e')](util[_0x51bb('0x1a')](_0x51bb('0x38'),_0x41a5d5['origtransfereruniqueid']),_0x41a5d5);queues[_0x51bb('0x37')](_0x41a5d5);transfers[_0x51bb('0x37')](_0x41a5d5);agents[_0x51bb('0x37')](_0x41a5d5);calls[_0x51bb('0x37')](_0x41a5d5);}catch(_0x3a6ba9){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x38'),_0x41a5d5['origtransfereruniqueid']),_0x3a6ba9);}});ami['on'](_0x51bb('0x39'),function(_0x52e92f){try{utils[_0x51bb('0x1e')](util[_0x51bb('0x1a')](_0x51bb('0x3a'),_0x52e92f[_0x51bb('0x20')]),_0x52e92f);queues['varset'](_0x52e92f);recordings[_0x51bb('0x39')](_0x52e92f);calls[_0x51bb('0x39')](_0x52e92f);dials[_0x51bb('0x39')](_0x52e92f);}catch(_0x2eca1){utils['error'](util[_0x51bb('0x1a')]('[%s][index][varset]',_0x52e92f[_0x51bb('0x20')]),_0x2eca1);}});ami['on']('newexten',function(_0x4cf79c){try{utils[_0x51bb('0x1e')](util[_0x51bb('0x1a')](_0x51bb('0x3b'),_0x4cf79c[_0x51bb('0x20')]),_0x4cf79c);calls[_0x51bb('0x3c')](_0x4cf79c);recordings[_0x51bb('0x3c')](_0x4cf79c);dials[_0x51bb('0x3c')](_0x4cf79c);}catch(_0x36e48d){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x3b'),_0x4cf79c['uniqueid']),_0x36e48d);}});ami['on']('newchannel',function(_0x5c1729){try{utils[_0x51bb('0x1e')](util[_0x51bb('0x1a')]('[%s][index][newchannel]',_0x5c1729[_0x51bb('0x20')]),_0x5c1729);calls[_0x51bb('0x3d')](_0x5c1729);recordings['newchannel'](_0x5c1729);}catch(_0xb39d73){utils['error'](util[_0x51bb('0x1a')]('[%s][index][newchannel]',_0x5c1729[_0x51bb('0x20')]),_0xb39d73);}});ami['on'](_0x51bb('0x3e'),function(_0x28231c){try{utils[_0x51bb('0x1e')](util[_0x51bb('0x1a')](_0x51bb('0x3f'),_0x28231c[_0x51bb('0x20')]),_0x28231c);dials[_0x51bb('0x3e')](_0x28231c);}catch(_0x1ee82a){utils[_0x51bb('0x14')](util['format']('[%s]dialbegin',_0x28231c[_0x51bb('0x20')]),_0x1ee82a);}});ami['on'](_0x51bb('0x40'),function(_0x2f6f73){try{utils['debug'](util[_0x51bb('0x1a')](_0x51bb('0x41'),_0x2f6f73[_0x51bb('0x20')]),_0x2f6f73);dials[_0x51bb('0x40')](_0x2f6f73);}catch(_0x570f22){utils[_0x51bb('0x14')](util[_0x51bb('0x1a')](_0x51bb('0x41'),_0x2f6f73[_0x51bb('0x20')]),_0x570f22);}});} \ No newline at end of file +var _0x10b9=['dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','port','asterisk','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x10b9,0xc8));var _0x910b=function(_0x48d178,_0x31506c){_0x48d178=_0x48d178-0x0;var _0x165d95=_0x10b9[_0x48d178];return _0x165d95;};var AsteriskManager=require(_0x910b('0x0'));var config=require(_0x910b('0x1'));var utils=require('./utils');var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0x910b('0x2')],config['asterisk']['ip'],config[_0x910b('0x3')]['username'],config[_0x910b('0x3')][_0x910b('0x4')],!![]);ami[_0x910b('0x5')]();if(config['xdr']&&config[_0x910b('0x6')][_0x910b('0x7')]){utils[_0x910b('0x8')](_0x910b('0x9'));}else{var agents=require(_0x910b('0xa'));var calls=require(_0x910b('0xb'));var queues=require('./queues.controller');var recordings=require(_0x910b('0xc'));var members=require('./members.controller');var dials=require(_0x910b('0xd'));var transfers=require(_0x910b('0xe'));var core=require(_0x910b('0xf'));ami['on'](_0x910b('0x10'),core[_0x910b('0x10')]);ami['on'](_0x910b('0x11'),core[_0x910b('0x11')]);ami['on'](_0x910b('0x12'),core[_0x910b('0x12')]);ami['on'](_0x910b('0x13'),core[_0x910b('0x13')]);ami['on'](_0x910b('0x14'),core[_0x910b('0x14')]);ami['on'](_0x910b('0x15'),core[_0x910b('0x15')]);ami['on'](_0x910b('0x16'),function(_0x1c8403){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x19'),_0x1c8403[_0x910b('0x1a')]),_0x1c8403);members['devicestatechange'](_0x1c8403);}catch(_0x3de1cc){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x19'),_0x1c8403[_0x910b('0x1a')]),_0x3de1cc);}});ami['on'](_0x910b('0x1b'),function(_0x341530){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x1c'),_0x341530[_0x910b('0x1d')]),_0x341530);agents[_0x910b('0x1b')](_0x341530);}catch(_0x1a450b){utils[_0x910b('0x13')](util['format'](_0x910b('0x1c'),_0x341530[_0x910b('0x1d')]),_0x1a450b);}});ami['on'](_0x910b('0x1e'),function(_0x470c27){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x1f'),_0x470c27[_0x910b('0x1d')]),_0x470c27);agents[_0x910b('0x1e')](_0x470c27);}catch(_0x2cc92e){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x1f'),_0x470c27[_0x910b('0x1d')]),_0x2cc92e);}});ami['on']('agentconnect',function(_0x1756d7){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x20'),_0x1756d7[_0x910b('0x1d')]),_0x1756d7);agents['agentconnect'](_0x1756d7);queues['agentconnect'](_0x1756d7);}catch(_0x5cd151){utils[_0x910b('0x13')](util['format'](_0x910b('0x20'),_0x1756d7[_0x910b('0x1d')]),_0x5cd151);}});ami['on'](_0x910b('0x21'),function(_0x47f1a0){try{utils['debug'](util[_0x910b('0x18')](_0x910b('0x22'),_0x47f1a0[_0x910b('0x1d')]),_0x47f1a0);agents[_0x910b('0x21')](_0x47f1a0);queues['agentcomplete'](_0x47f1a0);members['agentcomplete'](_0x47f1a0);}catch(_0x49814d){utils['error'](util['format'](_0x910b('0x22'),_0x47f1a0[_0x910b('0x1d')]),_0x49814d);}});ami['on'](_0x910b('0x23'),function(_0x183144){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x24'),_0x183144['uniqueid']),_0x183144);agents['queuecallerabandon'](_0x183144);queues[_0x910b('0x23')](_0x183144);}catch(_0xbe42e6){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x24'),_0x183144['uniqueid']),_0xbe42e6);}});ami['on'](_0x910b('0x25'),function(_0x14c6e8){try{utils[_0x910b('0x17')](util[_0x910b('0x18')]('[%s][index][queuecallerjoin]',_0x14c6e8['uniqueid']),_0x14c6e8);queues[_0x910b('0x25')](_0x14c6e8);recordings[_0x910b('0x25')](_0x14c6e8);}catch(_0x55b0d4){utils['error'](util['format'](_0x910b('0x26'),_0x14c6e8[_0x910b('0x1d')]),_0x55b0d4);}});ami['on'](_0x910b('0x27'),function(_0x52a2ea){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x28'),_0x52a2ea[_0x910b('0x1d')]),_0x52a2ea);queues['queuecallerleave'](_0x52a2ea);}catch(_0x229383){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x28'),_0x52a2ea[_0x910b('0x1d')]),_0x229383);}});ami['on'](_0x910b('0x29'),function(_0xa863ed){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x2a'),_0xa863ed[_0x910b('0x1d')]),_0xa863ed);queues[_0x910b('0x29')](_0xa863ed);calls[_0x910b('0x29')](_0xa863ed);}catch(_0xf6051c){utils[_0x910b('0x13')](util['format'](_0x910b('0x2a'),_0xa863ed[_0x910b('0x1d')]),_0xf6051c);}});ami['on']('musiconholdstop',function(_0x3f648d){try{utils['debug'](util[_0x910b('0x18')](_0x910b('0x2b'),_0x3f648d[_0x910b('0x1d')]),_0x3f648d);queues['musiconholdstop'](_0x3f648d);calls[_0x910b('0x2c')](_0x3f648d);}catch(_0x4219a4){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x2b'),_0x3f648d[_0x910b('0x1d')]),_0x4219a4);}});ami['on']('newstate',function(_0x3a2609){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x2d'),_0x3a2609[_0x910b('0x1d')]),_0x3a2609);calls[_0x910b('0x2e')](_0x3a2609);recordings[_0x910b('0x2e')](_0x3a2609);}catch(_0x36de4c){utils['error'](util[_0x910b('0x18')]('[%s][index][newstate]',_0x3a2609[_0x910b('0x1d')]),_0x36de4c);}});ami['on'](_0x910b('0x2f'),function(_0x585e9d){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x30'),_0x585e9d[_0x910b('0x1d')]),_0x585e9d);calls[_0x910b('0x2f')](_0x585e9d);recordings[_0x910b('0x2f')](_0x585e9d);dials[_0x910b('0x2f')](_0x585e9d);agents[_0x910b('0x2f')](_0x585e9d);queues[_0x910b('0x2f')](_0x585e9d);}catch(_0x596b1c){utils[_0x910b('0x13')](util['format'](_0x910b('0x30'),_0x585e9d[_0x910b('0x1d')]),_0x596b1c);}});ami['on'](_0x910b('0x31'),function(_0x1798d4){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x32'),_0x1798d4[_0x910b('0x1d')]),_0x1798d4);members[_0x910b('0x31')](_0x1798d4);}catch(_0xd0ad72){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x32'),_0x1798d4[_0x910b('0x1d')]),_0xd0ad72);}});ami['on'](_0x910b('0x33'),function(_0x1887d3){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x34'),_0x1887d3[_0x910b('0x1d')]),_0x1887d3);queues[_0x910b('0x33')](_0x1887d3);agents[_0x910b('0x33')](_0x1887d3);transfers[_0x910b('0x33')](_0x1887d3);recordings[_0x910b('0x33')](_0x1887d3);}catch(_0x47fbb9){utils['error'](util[_0x910b('0x18')](_0x910b('0x34'),_0x1887d3[_0x910b('0x1d')]),_0x47fbb9);}});ami['on'](_0x910b('0x35'),function(_0x50599a){try{utils[_0x910b('0x17')](util[_0x910b('0x18')]('[%s][index][attendedtransfer]',_0x50599a['origtransfereruniqueid']),_0x50599a);queues[_0x910b('0x35')](_0x50599a);transfers[_0x910b('0x35')](_0x50599a);agents['attendedtransfer'](_0x50599a);calls[_0x910b('0x35')](_0x50599a);}catch(_0x1c0f87){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x36'),_0x50599a[_0x910b('0x37')]),_0x1c0f87);}});ami['on'](_0x910b('0x38'),function(_0x2a1294){try{utils['debug'](util['format']('[%s][index][varset]',_0x2a1294[_0x910b('0x1d')]),_0x2a1294);queues['varset'](_0x2a1294);recordings[_0x910b('0x38')](_0x2a1294);calls['varset'](_0x2a1294);dials[_0x910b('0x38')](_0x2a1294);}catch(_0x2f9e83){utils['error'](util[_0x910b('0x18')](_0x910b('0x39'),_0x2a1294[_0x910b('0x1d')]),_0x2f9e83);}});ami['on']('newexten',function(_0x1ace9a){try{utils[_0x910b('0x17')](util['format']('[%s][index][newexten]',_0x1ace9a[_0x910b('0x1d')]),_0x1ace9a);calls[_0x910b('0x3a')](_0x1ace9a);recordings[_0x910b('0x3a')](_0x1ace9a);dials[_0x910b('0x3a')](_0x1ace9a);}catch(_0x5c119f){utils['error'](util[_0x910b('0x18')]('[%s][index][newexten]',_0x1ace9a[_0x910b('0x1d')]),_0x5c119f);}});ami['on']('newchannel',function(_0x51d706){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x51d706['uniqueid']),_0x51d706);calls[_0x910b('0x3b')](_0x51d706);recordings['newchannel'](_0x51d706);}catch(_0x59d910){utils[_0x910b('0x13')](util['format'](_0x910b('0x3c'),_0x51d706[_0x910b('0x1d')]),_0x59d910);}});ami['on'](_0x910b('0x3d'),function(_0x575d07){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x3e'),_0x575d07[_0x910b('0x1d')]),_0x575d07);dials[_0x910b('0x3d')](_0x575d07);}catch(_0x2d867d){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x3f'),_0x575d07[_0x910b('0x1d')]),_0x2d867d);}});ami['on'](_0x910b('0x40'),function(_0x1b94d2){try{utils[_0x910b('0x17')](util['format']('[%s][index][dialend]',_0x1b94d2['uniqueid']),_0x1b94d2);dials[_0x910b('0x40')](_0x1b94d2);}catch(_0x324c70){utils[_0x910b('0x13')](util['format'](_0x910b('0x41'),_0x1b94d2[_0x910b('0x1d')]),_0x324c70);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4856929..fd98e6a 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 _0xc551=['getUserByInterface','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','isNil','duration','exitAt','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data3','lodash','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type'];(function(_0x27c4ac,_0x5b33ab){var _0x488be5=function(_0x42018c){while(--_0x42018c){_0x27c4ac['push'](_0x27c4ac['shift']());}};_0x488be5(++_0x5b33ab);}(_0xc551,0xbd));var _0x1c55=function(_0x43c14b,_0x1c838f){_0x43c14b=_0x43c14b-0x0;var _0x1f2502=_0xc551[_0x43c14b];return _0x1f2502;};'use strict';var _=require(_0x1c55('0x0'));var util=require('util');var utils=require(_0x1c55('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x1c55('0x2')];function writeDB(_0x5d76e3){utils[_0x1c55('0x3')](util[_0x1c55('0x4')](_0x1c55('0x5'),_0x5d76e3[_0x1c55('0x6')],_0x5d76e3[_0x1c55('0x7')],_0x5d76e3[_0x1c55('0x8')],_0x5d76e3[_0x1c55('0x9')],_0x5d76e3['membername'],_0x5d76e3[_0x1c55('0xa')]));if(_0x5d76e3['interface']){utils[_0x1c55('0xb')](_0x5d76e3[_0x1c55('0x7')])['then'](function(_0x5905ed){if(_0x5905ed){_0x5d76e3[_0x1c55('0xc')]=_0x5905ed[_0x1c55('0xd')];_0x5d76e3[_0x1c55('0xe')]=_0x5905ed['internal'];utils[_0x1c55('0xf')](_0x1c55('0x10'),_0x5d76e3);}else{utils[_0x1c55('0x11')](_0x5d76e3['interface'][_0x1c55('0x12')]('/')[0x1])['then'](function(_0x478120){if(_0x478120){_0x5d76e3[_0x1c55('0xc')]=_0x478120[_0x1c55('0xd')];_0x5d76e3['internal']=_0x478120[_0x1c55('0xe')];utils[_0x1c55('0xf')]('CreateMemberReport',_0x5d76e3);}});}})[_0x1c55('0x13')](function(_0x42a5c4){utils[_0x1c55('0x14')](util[_0x1c55('0x4')](_0x1c55('0x15'),_0x5d76e3[_0x1c55('0x6')]),_0x42a5c4);});}delete members[_0x5d76e3['interface']];}function startsWith(_0x3fb108,_0x2904c6){return _[_0x1c55('0x16')](_0x3fb108,function(_0xca1824){return _[_0x1c55('0x17')](_0x2904c6,_0xca1824);});}exports[_0x1c55('0x18')]=function(_0x2ffca0){try{utils[_0x1c55('0x19')](util[_0x1c55('0x4')]('[%s][members][devicestatechange]',members[_0x2ffca0[_0x1c55('0x1a')]]?members[_0x2ffca0['device']][_0x1c55('0x6')]:_0x2ffca0['device']),_0x2ffca0);utils[_0x1c55('0x3')](util[_0x1c55('0x4')](_0x1c55('0x1b'),members[_0x2ffca0[_0x1c55('0x1a')]]?members[_0x2ffca0[_0x1c55('0x1a')]][_0x1c55('0x6')]:_0x2ffca0[_0x1c55('0x1a')],_0x2ffca0[_0x1c55('0x1c')],_0x2ffca0[_0x1c55('0x1a')]));switch(_0x2ffca0[_0x1c55('0x1c')]){case'INUSE':case _0x1c55('0x1d'):if(!startsWith(exclude,_0x2ffca0[_0x1c55('0x1a')])){members[_0x2ffca0['device']]={'channel':_0x1c55('0x1e'),'interface':_0x2ffca0[_0x1c55('0x1a')],'type':_0x1c55('0x1f'),'enterAt':utils[_0x1c55('0x20')](),'role':_0x1c55('0x21')};}break;case'NOT_INUSE':if(!_[_0x1c55('0x22')](members[_0x2ffca0[_0x1c55('0x1a')]])){members[_0x2ffca0[_0x1c55('0x1a')]]['exitAt']=utils[_0x1c55('0x20')]();members[_0x2ffca0[_0x1c55('0x1a')]][_0x1c55('0x23')]=utils['diffTime'](members[_0x2ffca0['device']][_0x1c55('0x24')],members[_0x2ffca0['device']][_0x1c55('0x25')]);if(members[_0x2ffca0[_0x1c55('0x1a')]][_0x1c55('0x6')]){writeDB(members[_0x2ffca0[_0x1c55('0x1a')]]);}}break;default:break;}}catch(_0x5976fb){utils[_0x1c55('0x14')](util[_0x1c55('0x4')](_0x1c55('0x26'),members[_0x2ffca0['device']]?members[_0x2ffca0[_0x1c55('0x1a')]][_0x1c55('0x6')]:_0x2ffca0[_0x1c55('0x1a')]),_0x5976fb);}};exports[_0x1c55('0x27')]=function(_0x3cdb7b){try{if(!_[_0x1c55('0x22')](members[_0x3cdb7b[_0x1c55('0x7')]])){utils[_0x1c55('0x19')](util[_0x1c55('0x4')]('[%s][members][agentcomplete]',_0x3cdb7b[_0x1c55('0x6')]),_0x3cdb7b);utils['info'](util[_0x1c55('0x4')](_0x1c55('0x28'),_0x3cdb7b[_0x1c55('0x6')],_0x3cdb7b[_0x1c55('0x7')],_0x3cdb7b['queue']));members[_0x3cdb7b[_0x1c55('0x7')]]=_[_0x1c55('0x29')](members[_0x3cdb7b[_0x1c55('0x7')]],{'data4':_0x3cdb7b[_0x1c55('0x2a')],'uniqueid':_0x3cdb7b[_0x1c55('0x6')]});}}catch(_0x40cc87){utils['error'](util[_0x1c55('0x4')]('[%s][members][agentcomplete]',_0x3cdb7b[_0x1c55('0x6')]),_0x40cc87);}};exports[_0x1c55('0x2b')]=function(_0x5c09aa){try{utils[_0x1c55('0x19')](util[_0x1c55('0x4')](_0x1c55('0x2c'),_0x5c09aa[_0x1c55('0x6')]),_0x5c09aa);if(_0x5c09aa['channel']){var _0x4975fc=_0x5c09aa['channel'][_0x1c55('0x12')]('-')[0x0];if(!_[_0x1c55('0x22')](members[_0x4975fc])){members[_0x4975fc]=_[_0x1c55('0x29')](members[_0x4975fc],{'data1':members[_0x4975fc][_0x1c55('0x2d')]||_0x5c09aa['type'],'data2':members[_0x4975fc][_0x1c55('0x9')]||_0x5c09aa['source'],'data3':members[_0x4975fc]['data3']||_0x5c09aa[_0x1c55('0x2e')],'uniqueid':members[_0x4975fc][_0x1c55('0x6')]||_0x5c09aa[_0x1c55('0x6')]});utils['info'](util[_0x1c55('0x4')](_0x1c55('0x2f'),_0x5c09aa[_0x1c55('0x6')],members[_0x4975fc][_0x1c55('0x2d')],members[_0x4975fc][_0x1c55('0x9')],members[_0x4975fc]['data3']));if(members[_0x4975fc][_0x1c55('0x24')]){writeDB(members[_0x4975fc]);}}}if(_0x5c09aa[_0x1c55('0x30')]){var _0x77f33d=_0x5c09aa[_0x1c55('0x30')]['split']('-')[0x0];if(!_['isNil'](members[_0x77f33d])){members[_0x77f33d]=_[_0x1c55('0x29')](members[_0x77f33d],{'data1':members[_0x77f33d][_0x1c55('0x2d')]||_0x5c09aa[_0x1c55('0xa')],'data2':members[_0x77f33d][_0x1c55('0x9')]||_0x5c09aa['source'],'data3':members[_0x77f33d][_0x1c55('0x31')]||_0x5c09aa[_0x1c55('0x2e')],'uniqueid':members[_0x77f33d][_0x1c55('0x6')]||_0x5c09aa['uniqueid']});utils['info'](util[_0x1c55('0x4')](_0x1c55('0x2f'),_0x5c09aa[_0x1c55('0x6')],members[_0x77f33d][_0x1c55('0x2d')],members[_0x77f33d][_0x1c55('0x9')],members[_0x77f33d][_0x1c55('0x31')]));if(members[_0x77f33d][_0x1c55('0x24')]){writeDB(members[_0x77f33d]);}}}}catch(_0x1dac2b){utils[_0x1c55('0x14')](util[_0x1c55('0x4')](_0x1c55('0x2c'),_0x5c09aa[_0x1c55('0x6')]),_0x1dac2b);}}; \ No newline at end of file +var _0xc9d9=['[%s][members][devicestatechange]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','debug','[%s][members][cdr]','channel','data1','data2','destination','data3','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','format','some','startsWith','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt'];(function(_0x4e46dd,_0xa549bc){var _0x2d050d=function(_0x40cc68){while(--_0x40cc68){_0x4e46dd['push'](_0x4e46dd['shift']());}};_0x2d050d(++_0xa549bc);}(_0xc9d9,0x141));var _0x9c9d=function(_0x46772c,_0x5f0cfe){_0x46772c=_0x46772c-0x0;var _0x58f8af=_0xc9d9[_0x46772c];return _0x58f8af;};'use strict';var _=require(_0x9c9d('0x0'));var util=require(_0x9c9d('0x1'));var utils=require(_0x9c9d('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x9c9d('0x3')];function writeDB(_0x31b092){utils[_0x9c9d('0x4')](util['format'](_0x9c9d('0x5'),_0x31b092[_0x9c9d('0x6')],_0x31b092[_0x9c9d('0x7')],_0x31b092['channel'],_0x31b092['data2'],_0x31b092[_0x9c9d('0x8')],_0x31b092[_0x9c9d('0x9')]));if(_0x31b092[_0x9c9d('0x7')]){utils[_0x9c9d('0xa')](_0x31b092[_0x9c9d('0x7')])['then'](function(_0x15efd9){if(_0x15efd9){_0x31b092[_0x9c9d('0x8')]=_0x15efd9[_0x9c9d('0xb')];_0x31b092[_0x9c9d('0xc')]=_0x15efd9[_0x9c9d('0xc')];utils[_0x9c9d('0xd')](_0x9c9d('0xe'),_0x31b092);}else{utils[_0x9c9d('0xf')](_0x31b092[_0x9c9d('0x7')][_0x9c9d('0x10')]('/')[0x1])[_0x9c9d('0x11')](function(_0x12ace5){if(_0x12ace5){_0x31b092['membername']=_0x12ace5[_0x9c9d('0xb')];_0x31b092['internal']=_0x12ace5['internal'];utils[_0x9c9d('0xd')]('CreateMemberReport',_0x31b092);}});}})[_0x9c9d('0x12')](function(_0x3c0650){utils[_0x9c9d('0x13')](util[_0x9c9d('0x14')]('[%s][members][writeDB]',_0x31b092[_0x9c9d('0x6')]),_0x3c0650);});}delete members[_0x31b092[_0x9c9d('0x7')]];}function startsWith(_0x18b8cf,_0x45581b){return _[_0x9c9d('0x15')](_0x18b8cf,function(_0x1268f7){return _[_0x9c9d('0x16')](_0x45581b,_0x1268f7);});}exports['devicestatechange']=function(_0x5f221e){try{utils['debug'](util[_0x9c9d('0x14')]('[%s][members][devicestatechange]',members[_0x5f221e[_0x9c9d('0x17')]]?members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x6')]:_0x5f221e[_0x9c9d('0x17')]),_0x5f221e);utils[_0x9c9d('0x4')](util[_0x9c9d('0x14')](_0x9c9d('0x18'),members[_0x5f221e['device']]?members[_0x5f221e[_0x9c9d('0x17')]]['uniqueid']:_0x5f221e[_0x9c9d('0x17')],_0x5f221e[_0x9c9d('0x19')],_0x5f221e[_0x9c9d('0x17')]));switch(_0x5f221e[_0x9c9d('0x19')]){case'INUSE':case _0x9c9d('0x1a'):if(!startsWith(exclude,_0x5f221e[_0x9c9d('0x17')])){members[_0x5f221e[_0x9c9d('0x17')]]={'channel':_0x9c9d('0x1b'),'interface':_0x5f221e[_0x9c9d('0x17')],'type':_0x9c9d('0x1c'),'enterAt':utils[_0x9c9d('0x1d')](),'role':_0x9c9d('0x1e')};}break;case _0x9c9d('0x1f'):if(!_[_0x9c9d('0x20')](members[_0x5f221e[_0x9c9d('0x17')]])){members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x21')]=utils[_0x9c9d('0x1d')]();members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x22')]=utils['diffTime'](members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x21')],members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x23')]);if(members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x6')]){writeDB(members[_0x5f221e[_0x9c9d('0x17')]]);}}break;default:break;}}catch(_0xa9561a){utils[_0x9c9d('0x13')](util[_0x9c9d('0x14')](_0x9c9d('0x24'),members[_0x5f221e[_0x9c9d('0x17')]]?members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x6')]:_0x5f221e['device']),_0xa9561a);}};exports['agentcomplete']=function(_0x4e5724){try{if(!_[_0x9c9d('0x20')](members[_0x4e5724[_0x9c9d('0x7')]])){utils['debug'](util[_0x9c9d('0x14')]('[%s][members][agentcomplete]',_0x4e5724['uniqueid']),_0x4e5724);utils[_0x9c9d('0x4')](util['format'](_0x9c9d('0x25'),_0x4e5724[_0x9c9d('0x6')],_0x4e5724[_0x9c9d('0x7')],_0x4e5724[_0x9c9d('0x26')]));members[_0x4e5724[_0x9c9d('0x7')]]=_[_0x9c9d('0x27')](members[_0x4e5724[_0x9c9d('0x7')]],{'data4':_0x4e5724[_0x9c9d('0x26')],'uniqueid':_0x4e5724[_0x9c9d('0x6')]});}}catch(_0x10cc94){utils[_0x9c9d('0x13')](util[_0x9c9d('0x14')]('[%s][members][agentcomplete]',_0x4e5724[_0x9c9d('0x6')]),_0x10cc94);}};exports[_0x9c9d('0x28')]=function(_0xf5f108){try{utils[_0x9c9d('0x29')](util[_0x9c9d('0x14')](_0x9c9d('0x2a'),_0xf5f108[_0x9c9d('0x6')]),_0xf5f108);if(_0xf5f108[_0x9c9d('0x2b')]){var _0x4d4fed=_0xf5f108[_0x9c9d('0x2b')]['split']('-')[0x0];if(!_[_0x9c9d('0x20')](members[_0x4d4fed])){members[_0x4d4fed]=_['assign'](members[_0x4d4fed],{'data1':members[_0x4d4fed][_0x9c9d('0x2c')]||_0xf5f108['type'],'data2':members[_0x4d4fed][_0x9c9d('0x2d')]||_0xf5f108['source'],'data3':members[_0x4d4fed]['data3']||_0xf5f108[_0x9c9d('0x2e')],'uniqueid':members[_0x4d4fed]['uniqueid']||_0xf5f108[_0x9c9d('0x6')]});utils[_0x9c9d('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xf5f108[_0x9c9d('0x6')],members[_0x4d4fed][_0x9c9d('0x2c')],members[_0x4d4fed][_0x9c9d('0x2d')],members[_0x4d4fed][_0x9c9d('0x2f')]));if(members[_0x4d4fed][_0x9c9d('0x21')]){writeDB(members[_0x4d4fed]);}}}if(_0xf5f108[_0x9c9d('0x30')]){var _0x3fe670=_0xf5f108['destinationchannel'][_0x9c9d('0x10')]('-')[0x0];if(!_['isNil'](members[_0x3fe670])){members[_0x3fe670]=_[_0x9c9d('0x27')](members[_0x3fe670],{'data1':members[_0x3fe670]['data1']||_0xf5f108['type'],'data2':members[_0x3fe670][_0x9c9d('0x2d')]||_0xf5f108[_0x9c9d('0x31')],'data3':members[_0x3fe670][_0x9c9d('0x2f')]||_0xf5f108[_0x9c9d('0x2e')],'uniqueid':members[_0x3fe670][_0x9c9d('0x6')]||_0xf5f108[_0x9c9d('0x6')]});utils[_0x9c9d('0x4')](util[_0x9c9d('0x14')](_0x9c9d('0x32'),_0xf5f108[_0x9c9d('0x6')],members[_0x3fe670][_0x9c9d('0x2c')],members[_0x3fe670][_0x9c9d('0x2d')],members[_0x3fe670]['data3']));if(members[_0x3fe670][_0x9c9d('0x21')]){writeDB(members[_0x3fe670]);}}}}catch(_0x3273bc){utils[_0x9c9d('0x13')](util[_0x9c9d('0x14')](_0x9c9d('0x2a'),_0xf5f108[_0x9c9d('0x6')]),_0x3273bc);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 57b874e..508b60c 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 _0xb517=['uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitreason','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerexit','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','format'];(function(_0x23dcde,_0x2b3d14){var _0x345a6f=function(_0x5a38a3){while(--_0x5a38a3){_0x23dcde['push'](_0x23dcde['shift']());}};_0x345a6f(++_0x2b3d14);}(_0xb517,0x13e));var _0x7b51=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0xb517[_0x59162a];return _0x35e50d;};'use strict';var _=require(_0x7b51('0x0'));var util=require(_0x7b51('0x1'));var utils=require('./utils');var queues={};function writeDB(_0xbdb8a6){utils['info'](util[_0x7b51('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0xbdb8a6[_0x7b51('0x3')],_0xbdb8a6[_0x7b51('0x4')],_0xbdb8a6[_0x7b51('0x5')],_0xbdb8a6[_0x7b51('0x6')],_0xbdb8a6[_0x7b51('0x7')],_0xbdb8a6[_0x7b51('0x8')],_0xbdb8a6['queuecallerexitreason']));if(_0xbdb8a6['queue']){utils[_0x7b51('0x9')](_0xbdb8a6['queue'])[_0x7b51('0xa')](function(_0x49b63b){if(_0x49b63b){_0xbdb8a6[_0x7b51('0xb')]=_0x49b63b[_0x7b51('0xb')];}utils['request']('CreateVoiceQueueReport',_0xbdb8a6);});}else{utils[_0x7b51('0xc')]('CreateVoiceQueueReport',_0xbdb8a6);}if(_0xbdb8a6[_0x7b51('0xd')]){delete queues[_0xbdb8a6['transfereduniqueid']];}else{delete queues[_0xbdb8a6[_0x7b51('0x3')]];}}exports[_0x7b51('0xe')]=function(_0x3835a6){try{utils[_0x7b51('0xf')](util[_0x7b51('0x2')](_0x7b51('0x10'),_0x3835a6[_0x7b51('0x3')]),_0x3835a6);utils[_0x7b51('0x11')](util[_0x7b51('0x2')](_0x7b51('0x12'),_0x3835a6[_0x7b51('0x3')],_0x3835a6[_0x7b51('0x5')],_0x3835a6[_0x7b51('0x13')]));queues[_0x3835a6[_0x7b51('0x3')]]=_[_0x7b51('0x14')](_0x3835a6,{'originalposition':_0x3835a6[_0x7b51('0x13')],'queuecallerjoinAt':utils[_0x7b51('0x15')](),'mohtime':0x0});}catch(_0x4fa346){utils[_0x7b51('0x16')](util[_0x7b51('0x2')]('[%s][queues][queuecallerjoin]',_0x3835a6[_0x7b51('0x3')]),_0x4fa346);}};exports[_0x7b51('0x17')]=function(_0x36510a){try{if(!_[_0x7b51('0x18')](queues[_0x36510a[_0x7b51('0x3')]])){utils['debug'](util[_0x7b51('0x2')](_0x7b51('0x19'),_0x36510a[_0x7b51('0x3')]),_0x36510a);if(queues[_0x36510a[_0x7b51('0x3')]]['queuecallerleaveAt']){if(!queues[_0x36510a['uniqueid']][_0x7b51('0x1a')]&&!queues[_0x36510a['uniqueid']]['queuecallerexit']){queues[_0x36510a[_0x7b51('0x3')]][_0x7b51('0x1b')]=!![];queues[_0x36510a[_0x7b51('0x3')]][_0x7b51('0x1c')]=utils[_0x7b51('0x15')]();queues[_0x36510a[_0x7b51('0x3')]]['queuecallerexitreason']=_0x7b51('0x1d');}utils[_0x7b51('0x11')](util[_0x7b51('0x2')](_0x7b51('0x1e'),_0x36510a[_0x7b51('0x3')],queues[_0x36510a[_0x7b51('0x3')]][_0x7b51('0x1f')],queues[_0x36510a['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x36510a[_0x7b51('0x3')]]);}else if(queues[_0x36510a[_0x7b51('0x3')]][_0x7b51('0xd')]){utils[_0x7b51('0x11')](util[_0x7b51('0x2')](_0x7b51('0x20'),_0x36510a[_0x7b51('0x3')],queues[_0x36510a['uniqueid']][_0x7b51('0x1f')],queues[_0x36510a['uniqueid']][_0x7b51('0xd')]));queues[queues[_0x36510a[_0x7b51('0x3')]]['transfereduniqueid']]=queues[_0x36510a[_0x7b51('0x3')]];queues[queues[_0x36510a['uniqueid']][_0x7b51('0xd')]][_0x7b51('0x21')]=0x2;delete queues[_0x36510a[_0x7b51('0x3')]];}}}catch(_0x21594d){utils[_0x7b51('0x16')](util[_0x7b51('0x2')](_0x7b51('0x19'),_0x36510a[_0x7b51('0x3')]),_0x21594d);}};exports[_0x7b51('0x22')]=function(_0x4b05ba){try{utils[_0x7b51('0xf')](util[_0x7b51('0x2')]('[%s][queues][varset]',_0x4b05ba[_0x7b51('0x3')]),_0x4b05ba);if(!_['isNil'](_0x4b05ba[_0x7b51('0x23')][_0x7b51('0x24')])&&_0x4b05ba['value'][_0x7b51('0x25')]()!==_0x7b51('0x26')){if(!_[_0x7b51('0x18')](queues[_0x4b05ba['uniqueid']])){queues[_0x4b05ba['uniqueid']][_0x7b51('0x1a')]=![];queues[_0x4b05ba[_0x7b51('0x3')]][_0x7b51('0x27')]=null;queues[_0x4b05ba[_0x7b51('0x3')]]['queuecallerexit']=!![];queues[_0x4b05ba[_0x7b51('0x3')]]['queuecallerexitAt']=utils[_0x7b51('0x15')]();queues[_0x4b05ba['uniqueid']]['queuecallerexitreason']=_0x4b05ba[_0x7b51('0x28')][_0x7b51('0x25')]();utils['info'](util[_0x7b51('0x2')](_0x7b51('0x29'),_0x4b05ba[_0x7b51('0x3')],queues[_0x4b05ba['uniqueid']][_0x7b51('0x1f')],_0x4b05ba[_0x7b51('0x28')],queues[_0x4b05ba[_0x7b51('0x3')]][_0x7b51('0x2a')]));writeDB(queues[_0x4b05ba[_0x7b51('0x3')]]);}}else if(!_['isNil'](_0x4b05ba[_0x7b51('0x23')]['queueposition'])){if(!_[_0x7b51('0x18')](queues[_0x4b05ba['uniqueid']])&&!queues[_0x4b05ba[_0x7b51('0x3')]][_0x7b51('0x1a')]){queues[_0x4b05ba['uniqueid']][_0x7b51('0x1a')]=![];queues[_0x4b05ba[_0x7b51('0x3')]][_0x7b51('0x27')]=null;queues[_0x4b05ba[_0x7b51('0x3')]]['queuecallerexit']=!![];queues[_0x4b05ba[_0x7b51('0x3')]]['queuecallerexitAt']=utils[_0x7b51('0x15')]();queues[_0x4b05ba[_0x7b51('0x3')]][_0x7b51('0x2a')]=_0x7b51('0x2b');utils[_0x7b51('0x11')](util[_0x7b51('0x2')](_0x7b51('0x2c'),_0x4b05ba['uniqueid'],queues[_0x4b05ba[_0x7b51('0x3')]]['name'],_0x4b05ba[_0x7b51('0x28')],queues[_0x4b05ba[_0x7b51('0x3')]][_0x7b51('0x2a')]));}}}catch(_0x3bd22c){utils[_0x7b51('0x16')](util[_0x7b51('0x2')](_0x7b51('0x2d'),_0x4b05ba[_0x7b51('0x3')]),_0x3bd22c);}};exports[_0x7b51('0x1a')]=function(_0x131aa8){try{if(!_['isNil'](queues[_0x131aa8[_0x7b51('0x3')]])){utils[_0x7b51('0xf')](util[_0x7b51('0x2')](_0x7b51('0x2e'),_0x131aa8[_0x7b51('0x3')]),_0x131aa8);queues[_0x131aa8['uniqueid']][_0x7b51('0x2f')]=![];queues[_0x131aa8[_0x7b51('0x3')]]['queuecallerexitAt']=null;queues[_0x131aa8[_0x7b51('0x3')]][_0x7b51('0x1a')]=!![];queues[_0x131aa8[_0x7b51('0x3')]]['queuecallerabandonAt']=utils[_0x7b51('0x15')]();queues[_0x131aa8[_0x7b51('0x3')]][_0x7b51('0x2a')]=_0x7b51('0x30');utils['info'](util[_0x7b51('0x2')](_0x7b51('0x31'),_0x131aa8[_0x7b51('0x3')],queues[_0x131aa8[_0x7b51('0x3')]][_0x7b51('0x1f')],queues[_0x131aa8[_0x7b51('0x3')]][_0x7b51('0x2a')]));}}catch(_0x44745d){utils[_0x7b51('0x16')](util[_0x7b51('0x2')](_0x7b51('0x2e'),_0x131aa8[_0x7b51('0x3')]),_0x44745d);}};exports[_0x7b51('0x32')]=function(_0x1ae7ac){try{if(!_[_0x7b51('0x18')](queues[_0x1ae7ac[_0x7b51('0x3')]])){utils['debug'](util[_0x7b51('0x2')](_0x7b51('0x33'),_0x1ae7ac['uniqueid']),_0x1ae7ac);utils[_0x7b51('0x11')](util['format'](_0x7b51('0x34'),_0x1ae7ac[_0x7b51('0x3')],queues[_0x1ae7ac[_0x7b51('0x3')]][_0x7b51('0x1f')],_0x1ae7ac[_0x7b51('0x35')],_0x1ae7ac[_0x7b51('0x36')]));queues[_0x1ae7ac[_0x7b51('0x3')]][_0x7b51('0x32')]=!![];queues[_0x1ae7ac[_0x7b51('0x3')]][_0x7b51('0x37')]=utils[_0x7b51('0x15')]();queues[_0x1ae7ac[_0x7b51('0x3')]][_0x7b51('0x38')]=utils[_0x7b51('0x39')](queues[_0x1ae7ac[_0x7b51('0x3')]][_0x7b51('0x37')],queues[_0x1ae7ac['uniqueid']]['queuecallerjoinAt']);queues[_0x1ae7ac[_0x7b51('0x3')]]['position']=_0x1ae7ac[_0x7b51('0x13')];queues[_0x1ae7ac[_0x7b51('0x3')]][_0x7b51('0x3a')]=_0x1ae7ac[_0x7b51('0x3a')];queues[_0x1ae7ac[_0x7b51('0x3')]][_0x7b51('0x35')]=_0x1ae7ac[_0x7b51('0x35')];queues[_0x1ae7ac[_0x7b51('0x3')]][_0x7b51('0x36')]=_0x1ae7ac[_0x7b51('0x36')];}}catch(_0x380b46){utils[_0x7b51('0x16')](util[_0x7b51('0x2')]('[%s][queues][queuecallerleave]',_0x1ae7ac['uniqueid']),_0x380b46);}};exports['agentconnect']=function(_0x4e2c5f){try{if(!_[_0x7b51('0x18')](queues[_0x4e2c5f[_0x7b51('0x3')]])){utils[_0x7b51('0xf')](util['format'](_0x7b51('0x3b'),_0x4e2c5f['uniqueid']),_0x4e2c5f);utils[_0x7b51('0x11')](util['format'](_0x7b51('0x3c'),_0x4e2c5f['uniqueid'],queues[_0x4e2c5f[_0x7b51('0x3')]][_0x7b51('0x1f')],_0x4e2c5f[_0x7b51('0x3d')],_0x4e2c5f[_0x7b51('0x3e')]));queues[_0x4e2c5f[_0x7b51('0x3')]][_0x7b51('0x1a')]=![];queues[_0x4e2c5f[_0x7b51('0x3')]][_0x7b51('0x1a')]=![];queues[_0x4e2c5f[_0x7b51('0x3')]]['queuecallerabandonAt']=null;queues[_0x4e2c5f['uniqueid']][_0x7b51('0x2f')]=![];queues[_0x4e2c5f[_0x7b51('0x3')]]['queuecallerexitreason']=null;queues[_0x4e2c5f[_0x7b51('0x3')]]['queuecallerexitAt']=null;queues[_0x4e2c5f[_0x7b51('0x3')]][_0x7b51('0x3f')]=!![];queues[_0x4e2c5f[_0x7b51('0x3')]][_0x7b51('0x8')]=_0x4e2c5f[_0x7b51('0x3e')];queues[_0x4e2c5f['uniqueid']][_0x7b51('0x6')]=_0x4e2c5f[_0x7b51('0x3d')];}}catch(_0x537b8d){utils[_0x7b51('0x16')](util[_0x7b51('0x2')]('[%s][queues][agentconnect]',_0x4e2c5f[_0x7b51('0x3')]),_0x537b8d);}};exports[_0x7b51('0x40')]=function(_0x162403){try{if(!_[_0x7b51('0x18')](queues[_0x162403[_0x7b51('0x3')]])){if(queues[_0x162403['uniqueid']]['queuecallerleaveAt']){utils[_0x7b51('0xf')](util[_0x7b51('0x2')](_0x7b51('0x41'),_0x162403['uniqueid']),_0x162403);queues[_0x162403['uniqueid']]['queuecallerabandon']=![];queues[_0x162403[_0x7b51('0x3')]]['queuecallerabandon']=![];queues[_0x162403[_0x7b51('0x3')]][_0x7b51('0x27')]=null;queues[_0x162403[_0x7b51('0x3')]][_0x7b51('0x2f')]=![];queues[_0x162403['uniqueid']]['queuecallerexitAt']=null;queues[_0x162403['uniqueid']][_0x7b51('0x3f')]=!![];queues[_0x162403[_0x7b51('0x3')]][_0x7b51('0x6')]=_0x162403[_0x7b51('0x3d')];queues[_0x162403[_0x7b51('0x3')]][_0x7b51('0x1b')]=!![];queues[_0x162403[_0x7b51('0x3')]][_0x7b51('0x1c')]=utils['now']();if(_0x162403[_0x7b51('0x42')]==_0x7b51('0x43')){if(!queues[_0x162403[_0x7b51('0x3')]][_0x7b51('0x43')]){queues[_0x162403['uniqueid']][_0x7b51('0x2a')]=_0x7b51('0x44');}}else{queues[_0x162403['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x162403[_0x7b51('0x42')][_0x7b51('0x25')]();}utils[_0x7b51('0x11')](util[_0x7b51('0x2')](_0x7b51('0x45'),_0x162403[_0x7b51('0x3')],queues[_0x162403[_0x7b51('0x3')]][_0x7b51('0x1f')],_0x162403[_0x7b51('0x3d')],queues[_0x162403[_0x7b51('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x162403[_0x7b51('0x3')]]);}}}catch(_0x3c9cf1){utils[_0x7b51('0x16')](util['format'](_0x7b51('0x41'),_0x162403[_0x7b51('0x3')]),_0x3c9cf1);}};exports[_0x7b51('0x46')]=function(_0x556ce0){try{if(!_[_0x7b51('0x18')](queues[_0x556ce0[_0x7b51('0x47')]])){utils[_0x7b51('0xf')](util['format'](_0x7b51('0x48'),_0x556ce0[_0x7b51('0x3')]),_0x556ce0);queues[_0x556ce0['transfereeuniqueid']][_0x7b51('0x43')]=!![];queues[_0x556ce0[_0x7b51('0x47')]][_0x7b51('0x49')]=_0x7b51('0x4a');queues[_0x556ce0[_0x7b51('0x47')]]['transferexten']=_0x556ce0[_0x7b51('0x4b')];queues[_0x556ce0[_0x7b51('0x47')]]['transferuniqueid']=_0x556ce0['transfereeuniqueid'];queues[_0x556ce0['transfereeuniqueid']][_0x7b51('0x2a')]=_0x7b51('0x4c');utils['info'](util[_0x7b51('0x2')](_0x7b51('0x4d'),_0x556ce0[_0x7b51('0x3')],queues[_0x556ce0['transfereeuniqueid']][_0x7b51('0x1f')],_0x556ce0['transfereeuniqueid'],_0x556ce0['extension']));}}catch(_0x1a36b0){utils[_0x7b51('0x16')](util[_0x7b51('0x2')](_0x7b51('0x48'),_0x556ce0[_0x7b51('0x3')]),_0x1a36b0);}};exports[_0x7b51('0x4e')]=function(_0x3b9b44){try{utils[_0x7b51('0xf')](util[_0x7b51('0x2')](_0x7b51('0x4f'),_0x3b9b44[_0x7b51('0x50')]),_0x3b9b44);if(_0x3b9b44[_0x7b51('0x50')]==_0x3b9b44[_0x7b51('0x51')]){if(!_[_0x7b51('0x18')](queues[_0x3b9b44[_0x7b51('0x52')]])){utils[_0x7b51('0x11')](util[_0x7b51('0x2')](_0x7b51('0x53'),_0x3b9b44[_0x7b51('0x50')],queues[_0x3b9b44[_0x7b51('0x52')]][_0x7b51('0x1f')],_0x3b9b44['origtransfererexten']));queues[_0x3b9b44['secondtransfererlinkedid']][_0x7b51('0x43')]=!![];queues[_0x3b9b44[_0x7b51('0x52')]][_0x7b51('0x49')]=_0x7b51('0x54');queues[_0x3b9b44[_0x7b51('0x52')]][_0x7b51('0x55')]=_0x3b9b44[_0x7b51('0x56')];queues[_0x3b9b44[_0x7b51('0x52')]][_0x7b51('0x57')]=_0x3b9b44[_0x7b51('0x50')];queues[_0x3b9b44[_0x7b51('0x52')]][_0x7b51('0x2a')]=_0x7b51('0x58');}if(!_[_0x7b51('0x18')](queues[_0x3b9b44[_0x7b51('0x51')]])){if(_0x3b9b44[_0x7b51('0x59')]&&queues[_0x3b9b44[_0x7b51('0x59')]]){queues[_0x3b9b44[_0x7b51('0x59')]][_0x7b51('0x21')]=0x1;queues[_0x3b9b44[_0x7b51('0x47')]]=_[_0x7b51('0x5a')](queues[_0x3b9b44[_0x7b51('0x59')]]);queues[_0x3b9b44[_0x7b51('0x47')]]['transfereduniqueid']=_0x3b9b44[_0x7b51('0x5b')];queues[_0x3b9b44[_0x7b51('0x47')]][_0x7b51('0x21')]=0x2;queues[_0x3b9b44['transfereeuniqueid']]['calleridnum']=queues[_0x3b9b44['secondtransfererlinkedid']][_0x7b51('0x7')];queues[_0x3b9b44[_0x7b51('0x47')]][_0x7b51('0x5c')]=queues[_0x3b9b44['secondtransfererlinkedid']][_0x7b51('0x5c')];queues[_0x3b9b44[_0x7b51('0x47')]][_0x7b51('0x5d')]=utils[_0x7b51('0x15')]();queues[_0x3b9b44['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x7b51('0x15')]();queues[_0x3b9b44[_0x7b51('0x47')]]['holdtime']=0x0;queues[_0x3b9b44['transfereeuniqueid']]['mohtime']=0x0;utils[_0x7b51('0x11')](util[_0x7b51('0x2')](_0x7b51('0x5e'),_0x3b9b44[_0x7b51('0x50')],queues[_0x3b9b44[_0x7b51('0x47')]]['name'],queues[_0x3b9b44[_0x7b51('0x47')]][_0x7b51('0x7')],queues[_0x3b9b44['transfereeuniqueid']][_0x7b51('0x5c')]));}else{utils[_0x7b51('0x11')](util['format'](_0x7b51('0x5f'),_0x3b9b44[_0x7b51('0x50')],queues[_0x3b9b44[_0x7b51('0x51')]]['name'],_0x3b9b44[_0x7b51('0x52')]));queues[_0x3b9b44[_0x7b51('0x51')]][_0x7b51('0xd')]=_0x3b9b44['secondtransfererlinkedid'];}}}else if(_0x3b9b44[_0x7b51('0x60')]==_0x3b9b44[_0x7b51('0x52')]){if(!_[_0x7b51('0x18')](queues[_0x3b9b44[_0x7b51('0x51')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3b9b44[_0x7b51('0x50')],queues[_0x3b9b44[_0x7b51('0x51')]][_0x7b51('0x1f')],_0x3b9b44[_0x7b51('0x60')],_0x3b9b44[_0x7b51('0x61')]));queues[_0x3b9b44[_0x7b51('0x51')]][_0x7b51('0x43')]=!![];queues[_0x3b9b44['origtransfererlinkedid']][_0x7b51('0x49')]=_0x7b51('0x54');queues[_0x3b9b44[_0x7b51('0x51')]][_0x7b51('0x55')]=_0x3b9b44[_0x7b51('0x61')];queues[_0x3b9b44['origtransfererlinkedid']][_0x7b51('0x57')]=_0x3b9b44[_0x7b51('0x60')];queues[_0x3b9b44[_0x7b51('0x51')]][_0x7b51('0x2a')]=_0x7b51('0x58');}if(!_['isNil'](queues[_0x3b9b44[_0x7b51('0x52')]])){if(_0x3b9b44[_0x7b51('0x62')]&&queues[_0x3b9b44['transfertargetlinkedid']]){queues[_0x3b9b44['transfertargetlinkedid']][_0x7b51('0x21')]=0x1;queues[_0x3b9b44[_0x7b51('0x5b')]]=_['clone'](queues[_0x3b9b44[_0x7b51('0x62')]]);queues[_0x3b9b44[_0x7b51('0x5b')]][_0x7b51('0xd')]=_0x3b9b44[_0x7b51('0x5b')];queues[_0x3b9b44[_0x7b51('0x5b')]][_0x7b51('0x21')]=0x2;queues[_0x3b9b44['transfertargetuniqueid']]['calleridnum']=queues[_0x3b9b44[_0x7b51('0x51')]]['calleridnum'];queues[_0x3b9b44[_0x7b51('0x5b')]][_0x7b51('0x5c')]=queues[_0x3b9b44[_0x7b51('0x51')]][_0x7b51('0x5c')];queues[_0x3b9b44[_0x7b51('0x5b')]][_0x7b51('0x5d')]=utils[_0x7b51('0x15')]();queues[_0x3b9b44[_0x7b51('0x5b')]][_0x7b51('0x37')]=utils['now']();queues[_0x3b9b44[_0x7b51('0x5b')]][_0x7b51('0x38')]=0x0;queues[_0x3b9b44['transfertargetuniqueid']][_0x7b51('0x63')]=0x0;utils[_0x7b51('0x11')](util['format'](_0x7b51('0x64'),_0x3b9b44[_0x7b51('0x50')],queues[_0x3b9b44[_0x7b51('0x5b')]][_0x7b51('0x1f')],queues[_0x3b9b44[_0x7b51('0x5b')]]['transfereduniqueid'],queues[_0x3b9b44[_0x7b51('0x5b')]]['calleridnum'],queues[_0x3b9b44[_0x7b51('0x5b')]][_0x7b51('0x5c')]));}else{utils['info'](util[_0x7b51('0x2')](_0x7b51('0x5f'),_0x3b9b44[_0x7b51('0x50')],queues[_0x3b9b44['secondtransfererlinkedid']][_0x7b51('0x1f')],_0x3b9b44[_0x7b51('0x51')]));queues[_0x3b9b44[_0x7b51('0x52')]][_0x7b51('0xd')]=_0x3b9b44[_0x7b51('0x51')];}}}}catch(_0x589506){utils[_0x7b51('0x16')](util['format']('[%s][queues][attendedtransfer]',_0x3b9b44['origtransfereruniqueid']),_0x589506);}};exports[_0x7b51('0x65')]=function(_0x34e44e){try{if(!_[_0x7b51('0x18')](queues[_0x34e44e[_0x7b51('0x3')]])){utils['debug'](util[_0x7b51('0x2')](_0x7b51('0x66'),_0x34e44e['uniqueid']),_0x34e44e);queues[_0x34e44e['uniqueid']]['musiconholdstartAt']=utils[_0x7b51('0x15')]();utils[_0x7b51('0x11')](util['format'](_0x7b51('0x67'),_0x34e44e[_0x7b51('0x3')],queues[_0x34e44e['uniqueid']][_0x7b51('0x1f')],queues[_0x34e44e[_0x7b51('0x3')]][_0x7b51('0x68')]));}}catch(_0x3e1b6d){utils['error'](util[_0x7b51('0x2')]('[%s][queues][musiconholdstart]',_0x34e44e[_0x7b51('0x3')]),_0x3e1b6d);}};exports[_0x7b51('0x69')]=function(_0xa4d44a){try{if(!_[_0x7b51('0x18')](queues[_0xa4d44a['uniqueid']])){if(!_[_0x7b51('0x18')](queues[_0xa4d44a[_0x7b51('0x3')]]['musiconholdstartAt'])){utils['debug'](util[_0x7b51('0x2')]('[%s][queues][musiconholdstop]',_0xa4d44a['uniqueid']),_0xa4d44a);queues[_0xa4d44a['uniqueid']][_0x7b51('0x63')]+=utils[_0x7b51('0x39')](utils[_0x7b51('0x15')](),queues[_0xa4d44a[_0x7b51('0x3')]][_0x7b51('0x68')]);utils['info'](util[_0x7b51('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xa4d44a[_0x7b51('0x3')],queues[_0xa4d44a[_0x7b51('0x3')]][_0x7b51('0x1f')],queues[_0xa4d44a['uniqueid']][_0x7b51('0x63')]));delete queues[_0xa4d44a[_0x7b51('0x3')]][_0x7b51('0x68')];}}}catch(_0x726670){utils['error'](util[_0x7b51('0x2')](_0x7b51('0x6a'),_0xa4d44a[_0x7b51('0x3')]),_0x726670);}}; \ No newline at end of file +var _0x8b68=['info','position','assign','now','error','hangup','debug','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','isNil','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','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','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]'];(function(_0x3b660b,_0x1430a9){var _0x4dcd4b=function(_0x1577c3){while(--_0x1577c3){_0x3b660b['push'](_0x3b660b['shift']());}};_0x4dcd4b(++_0x1430a9);}(_0x8b68,0xc2));var _0x88b6=function(_0x4c7726,_0x5cdb85){_0x4c7726=_0x4c7726-0x0;var _0x1056cd=_0x8b68[_0x4c7726];return _0x1056cd;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x1a30cc){utils['info'](util[_0x88b6('0x0')](_0x88b6('0x1'),_0x1a30cc[_0x88b6('0x2')],_0x1a30cc[_0x88b6('0x3')],_0x1a30cc[_0x88b6('0x4')],_0x1a30cc['lastAssignedTo'],_0x1a30cc[_0x88b6('0x5')],_0x1a30cc[_0x88b6('0x6')],_0x1a30cc['queuecallerexitreason']));if(_0x1a30cc[_0x88b6('0x4')]){utils[_0x88b6('0x7')](_0x1a30cc[_0x88b6('0x4')])[_0x88b6('0x8')](function(_0x500291){if(_0x500291){_0x1a30cc[_0x88b6('0x9')]=_0x500291[_0x88b6('0x9')];}utils[_0x88b6('0xa')](_0x88b6('0xb'),_0x1a30cc);});}else{utils['request'](_0x88b6('0xb'),_0x1a30cc);}if(_0x1a30cc[_0x88b6('0xc')]){delete queues[_0x1a30cc[_0x88b6('0xc')]];}else{delete queues[_0x1a30cc[_0x88b6('0x2')]];}}exports['queuecallerjoin']=function(_0x32461f){try{utils['debug'](util['format'](_0x88b6('0xd'),_0x32461f[_0x88b6('0x2')]),_0x32461f);utils[_0x88b6('0xe')](util[_0x88b6('0x0')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x32461f[_0x88b6('0x2')],_0x32461f[_0x88b6('0x4')],_0x32461f[_0x88b6('0xf')]));queues[_0x32461f[_0x88b6('0x2')]]=_[_0x88b6('0x10')](_0x32461f,{'originalposition':_0x32461f[_0x88b6('0xf')],'queuecallerjoinAt':utils[_0x88b6('0x11')](),'mohtime':0x0});}catch(_0x48ef90){utils[_0x88b6('0x12')](util[_0x88b6('0x0')](_0x88b6('0xd'),_0x32461f['uniqueid']),_0x48ef90);}};exports[_0x88b6('0x13')]=function(_0x3acc8d){try{if(!_['isNil'](queues[_0x3acc8d[_0x88b6('0x2')]])){utils[_0x88b6('0x14')](util[_0x88b6('0x0')]('[%s][queues][hangup]',_0x3acc8d[_0x88b6('0x2')]),_0x3acc8d);if(queues[_0x3acc8d['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0x15')]&&!queues[_0x3acc8d['uniqueid']][_0x88b6('0x16')]){queues[_0x3acc8d['uniqueid']][_0x88b6('0x17')]=!![];queues[_0x3acc8d[_0x88b6('0x2')]]['queuecallercompleteAt']=utils[_0x88b6('0x11')]();queues[_0x3acc8d['uniqueid']][_0x88b6('0x18')]=_0x88b6('0x19');}utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x1a'),_0x3acc8d[_0x88b6('0x2')],queues[_0x3acc8d['uniqueid']][_0x88b6('0x1b')],queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0x18')]));writeDB(queues[_0x3acc8d[_0x88b6('0x2')]]);}else if(queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0xc')]){utils[_0x88b6('0xe')](util[_0x88b6('0x0')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3acc8d[_0x88b6('0x2')],queues[_0x3acc8d['uniqueid']]['name'],queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0xc')]));queues[queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0xc')]]=queues[_0x3acc8d[_0x88b6('0x2')]];queues[queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0xc')]][_0x88b6('0x1c')]=0x2;delete queues[_0x3acc8d[_0x88b6('0x2')]];}}}catch(_0x1021bf){utils[_0x88b6('0x12')](util['format']('[%s][queues][hangup]',_0x3acc8d[_0x88b6('0x2')]),_0x1021bf);}};exports[_0x88b6('0x1d')]=function(_0x183a0b){try{utils[_0x88b6('0x14')](util[_0x88b6('0x0')](_0x88b6('0x1e'),_0x183a0b['uniqueid']),_0x183a0b);if(!_['isNil'](_0x183a0b[_0x88b6('0x1f')][_0x88b6('0x20')])&&_0x183a0b[_0x88b6('0x21')][_0x88b6('0x22')]()!==_0x88b6('0x23')){if(!_[_0x88b6('0x24')](queues[_0x183a0b[_0x88b6('0x2')]])){queues[_0x183a0b[_0x88b6('0x2')]]['queuecallerabandon']=![];queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x25')]=null;queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x16')]=!![];queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x26')]=utils[_0x88b6('0x11')]();queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x18')]=_0x183a0b['value']['toUpperCase']();utils[_0x88b6('0xe')](util['format'](_0x88b6('0x27'),_0x183a0b['uniqueid'],queues[_0x183a0b['uniqueid']][_0x88b6('0x1b')],_0x183a0b['value'],queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x18')]));writeDB(queues[_0x183a0b[_0x88b6('0x2')]]);}}else if(!_['isNil'](_0x183a0b['variable'][_0x88b6('0x28')])){if(!_[_0x88b6('0x24')](queues[_0x183a0b[_0x88b6('0x2')]])&&!queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x15')]){queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x183a0b['uniqueid']][_0x88b6('0x25')]=null;queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x16')]=!![];queues[_0x183a0b['uniqueid']][_0x88b6('0x26')]=utils['now']();queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x18')]=_0x88b6('0x29');utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x2a'),_0x183a0b[_0x88b6('0x2')],queues[_0x183a0b['uniqueid']]['name'],_0x183a0b[_0x88b6('0x21')],queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x18')]));}}}catch(_0x3b8cb6){utils[_0x88b6('0x12')](util['format'](_0x88b6('0x1e'),_0x183a0b[_0x88b6('0x2')]),_0x3b8cb6);}};exports['queuecallerabandon']=function(_0x4e4c1e){try{if(!_['isNil'](queues[_0x4e4c1e['uniqueid']])){utils['debug'](util['format'](_0x88b6('0x2b'),_0x4e4c1e[_0x88b6('0x2')]),_0x4e4c1e);queues[_0x4e4c1e[_0x88b6('0x2')]][_0x88b6('0x16')]=![];queues[_0x4e4c1e[_0x88b6('0x2')]][_0x88b6('0x26')]=null;queues[_0x4e4c1e[_0x88b6('0x2')]][_0x88b6('0x15')]=!![];queues[_0x4e4c1e[_0x88b6('0x2')]]['queuecallerabandonAt']=utils[_0x88b6('0x11')]();queues[_0x4e4c1e['uniqueid']][_0x88b6('0x18')]=_0x88b6('0x2c');utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x2d'),_0x4e4c1e[_0x88b6('0x2')],queues[_0x4e4c1e[_0x88b6('0x2')]]['name'],queues[_0x4e4c1e['uniqueid']][_0x88b6('0x18')]));}}catch(_0x30b3e9){utils[_0x88b6('0x12')](util['format']('[%s][queues][queuecallerabandon]',_0x4e4c1e['uniqueid']),_0x30b3e9);}};exports['queuecallerleave']=function(_0x181d45){try{if(!_['isNil'](queues[_0x181d45['uniqueid']])){utils[_0x88b6('0x14')](util[_0x88b6('0x0')]('[%s][queues][queuecallerleave]',_0x181d45['uniqueid']),_0x181d45);utils[_0x88b6('0xe')](util['format'](_0x88b6('0x2e'),_0x181d45['uniqueid'],queues[_0x181d45['uniqueid']]['name'],_0x181d45['connectedlinenum'],_0x181d45[_0x88b6('0x2f')]));queues[_0x181d45['uniqueid']]['queuecallerleave']=!![];queues[_0x181d45[_0x88b6('0x2')]][_0x88b6('0x30')]=utils[_0x88b6('0x11')]();queues[_0x181d45[_0x88b6('0x2')]]['holdtime']=utils[_0x88b6('0x31')](queues[_0x181d45[_0x88b6('0x2')]][_0x88b6('0x30')],queues[_0x181d45[_0x88b6('0x2')]][_0x88b6('0x32')]);queues[_0x181d45[_0x88b6('0x2')]]['position']=_0x181d45[_0x88b6('0xf')];queues[_0x181d45[_0x88b6('0x2')]]['count']=_0x181d45[_0x88b6('0x33')];queues[_0x181d45[_0x88b6('0x2')]][_0x88b6('0x34')]=_0x181d45['connectedlinenum'];queues[_0x181d45['uniqueid']][_0x88b6('0x2f')]=_0x181d45[_0x88b6('0x2f')];}}catch(_0x1a5e76){utils[_0x88b6('0x12')](util['format'](_0x88b6('0x35'),_0x181d45[_0x88b6('0x2')]),_0x1a5e76);}};exports[_0x88b6('0x36')]=function(_0x47568d){try{if(!_['isNil'](queues[_0x47568d[_0x88b6('0x2')]])){utils[_0x88b6('0x14')](util['format'](_0x88b6('0x37'),_0x47568d[_0x88b6('0x2')]),_0x47568d);utils['info'](util[_0x88b6('0x0')](_0x88b6('0x38'),_0x47568d['uniqueid'],queues[_0x47568d['uniqueid']]['name'],_0x47568d[_0x88b6('0x39')],_0x47568d[_0x88b6('0x3a')]));queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x47568d['uniqueid']][_0x88b6('0x25')]=null;queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x16')]=![];queues[_0x47568d['uniqueid']]['queuecallerexitreason']=null;queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x26')]=null;queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x3b')]=!![];queues[_0x47568d[_0x88b6('0x2')]]['accountcode']=_0x47568d[_0x88b6('0x3a')];queues[_0x47568d['uniqueid']][_0x88b6('0x3c')]=_0x47568d[_0x88b6('0x39')];}}catch(_0x393364){utils[_0x88b6('0x12')](util[_0x88b6('0x0')](_0x88b6('0x37'),_0x47568d[_0x88b6('0x2')]),_0x393364);}};exports[_0x88b6('0x3d')]=function(_0x1465fa){try{if(!_[_0x88b6('0x24')](queues[_0x1465fa['uniqueid']])){if(queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x30')]){utils[_0x88b6('0x14')](util[_0x88b6('0x0')](_0x88b6('0x3e'),_0x1465fa[_0x88b6('0x2')]),_0x1465fa);queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x25')]=null;queues[_0x1465fa['uniqueid']][_0x88b6('0x16')]=![];queues[_0x1465fa['uniqueid']][_0x88b6('0x26')]=null;queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x3b')]=!![];queues[_0x1465fa[_0x88b6('0x2')]]['lastAssignedTo']=_0x1465fa['membername'];queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x17')]=!![];queues[_0x1465fa[_0x88b6('0x2')]]['queuecallercompleteAt']=utils['now']();if(_0x1465fa[_0x88b6('0x3f')]==_0x88b6('0x40')){if(!queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x40')]){queues[_0x1465fa['uniqueid']]['queuecallerexitreason']=_0x88b6('0x41');}}else{queues[_0x1465fa['uniqueid']][_0x88b6('0x18')]='COMPLETEDBY'+_0x1465fa[_0x88b6('0x3f')]['toUpperCase']();}utils['info'](util[_0x88b6('0x0')](_0x88b6('0x42'),_0x1465fa[_0x88b6('0x2')],queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x1b')],_0x1465fa[_0x88b6('0x39')],queues[_0x1465fa[_0x88b6('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x1465fa[_0x88b6('0x2')]]);}}}catch(_0x2afcba){utils[_0x88b6('0x12')](util['format']('[%s][queues][agentcomplete]',_0x1465fa[_0x88b6('0x2')]),_0x2afcba);}};exports[_0x88b6('0x43')]=function(_0x42598d){try{if(!_[_0x88b6('0x24')](queues[_0x42598d[_0x88b6('0x44')]])){utils[_0x88b6('0x14')](util[_0x88b6('0x0')]('[%s][queues][blindtransfer]',_0x42598d[_0x88b6('0x2')]),_0x42598d);queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x40')]=!![];queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x45')]=_0x88b6('0x46');queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x47')]=_0x42598d[_0x88b6('0x48')];queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x49')]=_0x42598d[_0x88b6('0x44')];queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x18')]=_0x88b6('0x4a');utils[_0x88b6('0xe')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x42598d[_0x88b6('0x2')],queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x1b')],_0x42598d[_0x88b6('0x44')],_0x42598d[_0x88b6('0x48')]));}}catch(_0xfd0dd5){utils[_0x88b6('0x12')](util[_0x88b6('0x0')](_0x88b6('0x4b'),_0x42598d['uniqueid']),_0xfd0dd5);}};exports[_0x88b6('0x4c')]=function(_0x33da44){try{utils['debug'](util[_0x88b6('0x0')](_0x88b6('0x4d'),_0x33da44[_0x88b6('0x4e')]),_0x33da44);if(_0x33da44[_0x88b6('0x4e')]==_0x33da44[_0x88b6('0x4f')]){if(!_[_0x88b6('0x24')](queues[_0x33da44[_0x88b6('0x50')]])){utils[_0x88b6('0xe')](util['format'](_0x88b6('0x51'),_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x1b')],_0x33da44[_0x88b6('0x52')]));queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x40')]=!![];queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x45')]='ATTENDED';queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x47')]=_0x33da44[_0x88b6('0x52')];queues[_0x33da44[_0x88b6('0x50')]]['transferuniqueid']=_0x33da44['origtransfereruniqueid'];queues[_0x33da44[_0x88b6('0x50')]]['queuecallerexitreason']=_0x88b6('0x53');}if(!_['isNil'](queues[_0x33da44[_0x88b6('0x4f')]])){if(_0x33da44[_0x88b6('0x54')]&&queues[_0x33da44[_0x88b6('0x54')]]){queues[_0x33da44[_0x88b6('0x54')]][_0x88b6('0x1c')]=0x1;queues[_0x33da44[_0x88b6('0x44')]]=_[_0x88b6('0x55')](queues[_0x33da44[_0x88b6('0x54')]]);queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0xc')]=_0x33da44['transfertargetuniqueid'];queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x1c')]=0x2;queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x5')]=queues[_0x33da44['secondtransfererlinkedid']]['calleridnum'];queues[_0x33da44['transfereeuniqueid']][_0x88b6('0x56')]=queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x56')];queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x32')]=utils['now']();queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x30')]=utils['now']();queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x57')]=0x0;queues[_0x33da44['transfereeuniqueid']][_0x88b6('0x58')]=0x0;utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x59'),_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x1b')],queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x5')],queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x56')]));}else{utils[_0x88b6('0xe')](util['format'](_0x88b6('0x5a'),_0x33da44['origtransfereruniqueid'],queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x1b')],_0x33da44[_0x88b6('0x50')]));queues[_0x33da44['origtransfererlinkedid']]['transfereduniqueid']=_0x33da44['secondtransfererlinkedid'];}}}else if(_0x33da44[_0x88b6('0x5b')]==_0x33da44[_0x88b6('0x50')]){if(!_[_0x88b6('0x24')](queues[_0x33da44[_0x88b6('0x4f')]])){utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x5c'),_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x1b')],_0x33da44[_0x88b6('0x5b')],_0x33da44[_0x88b6('0x5d')]));queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x40')]=!![];queues[_0x33da44[_0x88b6('0x4f')]]['transfertype']=_0x88b6('0x5e');queues[_0x33da44['origtransfererlinkedid']]['transferexten']=_0x33da44[_0x88b6('0x5d')];queues[_0x33da44[_0x88b6('0x4f')]]['transferuniqueid']=_0x33da44['secondtransfereruniqueid'];queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x18')]='ATTENDEDTRANSFER';}if(!_[_0x88b6('0x24')](queues[_0x33da44[_0x88b6('0x50')]])){if(_0x33da44['transfertargetlinkedid']&&queues[_0x33da44[_0x88b6('0x5f')]]){queues[_0x33da44[_0x88b6('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x33da44[_0x88b6('0x60')]]=_[_0x88b6('0x55')](queues[_0x33da44[_0x88b6('0x5f')]]);queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0xc')]=_0x33da44[_0x88b6('0x60')];queues[_0x33da44[_0x88b6('0x60')]]['queuecallerenterreason']=0x2;queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x5')]=queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x5')];queues[_0x33da44['transfertargetuniqueid']][_0x88b6('0x56')]=queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x56')];queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x32')]=utils[_0x88b6('0x11')]();queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x30')]=utils[_0x88b6('0x11')]();queues[_0x33da44[_0x88b6('0x60')]]['holdtime']=0x0;queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x58')]=0x0;utils['info'](util['format'](_0x88b6('0x61'),_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x1b')],queues[_0x33da44[_0x88b6('0x60')]]['transfereduniqueid'],queues[_0x33da44['transfertargetuniqueid']]['calleridnum'],queues[_0x33da44[_0x88b6('0x60')]]['calleridname']));}else{utils[_0x88b6('0xe')](util[_0x88b6('0x0')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x1b')],_0x33da44[_0x88b6('0x4f')]));queues[_0x33da44[_0x88b6('0x50')]]['transfereduniqueid']=_0x33da44[_0x88b6('0x4f')];}}}}catch(_0x17aa69){utils['error'](util['format'](_0x88b6('0x4d'),_0x33da44[_0x88b6('0x4e')]),_0x17aa69);}};exports['musiconholdstart']=function(_0x3a8786){try{if(!_[_0x88b6('0x24')](queues[_0x3a8786[_0x88b6('0x2')]])){utils[_0x88b6('0x14')](util['format'](_0x88b6('0x62'),_0x3a8786[_0x88b6('0x2')]),_0x3a8786);queues[_0x3a8786[_0x88b6('0x2')]]['musiconholdstartAt']=utils[_0x88b6('0x11')]();utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x63'),_0x3a8786['uniqueid'],queues[_0x3a8786[_0x88b6('0x2')]]['name'],queues[_0x3a8786[_0x88b6('0x2')]]['musiconholdstartAt']));}}catch(_0x20c243){utils[_0x88b6('0x12')](util[_0x88b6('0x0')](_0x88b6('0x62'),_0x3a8786[_0x88b6('0x2')]),_0x20c243);}};exports[_0x88b6('0x64')]=function(_0x534c10){try{if(!_['isNil'](queues[_0x534c10['uniqueid']])){if(!_['isNil'](queues[_0x534c10[_0x88b6('0x2')]][_0x88b6('0x65')])){utils[_0x88b6('0x14')](util[_0x88b6('0x0')](_0x88b6('0x66'),_0x534c10[_0x88b6('0x2')]),_0x534c10);queues[_0x534c10[_0x88b6('0x2')]]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x534c10[_0x88b6('0x2')]][_0x88b6('0x65')]);utils['info'](util[_0x88b6('0x0')](_0x88b6('0x67'),_0x534c10[_0x88b6('0x2')],queues[_0x534c10['uniqueid']][_0x88b6('0x1b')],queues[_0x534c10['uniqueid']][_0x88b6('0x58')]));delete queues[_0x534c10['uniqueid']]['musiconholdstartAt'];}}}catch(_0x1bf7ca){utils['error'](util['format']('[%s][queues][musiconholdstop]',_0x534c10[_0x88b6('0x2')]),_0x1bf7ca);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 70a2b97..f74c1e4 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 _0x9431=['lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','calleridnum','calleridname','cause-txt','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring'];(function(_0x5a6720,_0x31a329){var _0x4065c9=function(_0x273874){while(--_0x273874){_0x5a6720['push'](_0x5a6720['shift']());}};_0x4065c9(++_0x31a329);}(_0x9431,0x16a));var _0x1943=function(_0x1a3c47,_0x1af5bd){_0x1a3c47=_0x1a3c47-0x0;var _0x4bb467=_0x9431[_0x1a3c47];return _0x4bb467;};'use strict';var _=require('lodash');var util=require(_0x1943('0x0'));var utils=require('./utils');var transfers=require(_0x1943('0x1'));var recordings={};function writeDB(_0x152c44){var _0x5975ae;utils[_0x1943('0x2')](util[_0x1943('0x3')](_0x1943('0x4'),_0x152c44[_0x1943('0x5')]));if(transfers[_0x1943('0x6')][_0x152c44['uniqueid']]){_0x5975ae=_0x152c44[_0x1943('0x5')];_0x152c44['uniqueid']=transfers[_0x1943('0x6')][_0x152c44[_0x1943('0x5')]][_0x1943('0x7')];}if(_0x152c44[_0x1943('0x8')]){utils[_0x1943('0x9')](_0x152c44['accountcode'])[_0x1943('0xa')](function(_0x3611ab){if(_0x3611ab){_0x152c44['membername']=_0x3611ab[_0x1943('0xb')];_0x152c44[_0x1943('0xc')]=_0x3611ab['id'];}utils[_0x1943('0xd')](_0x1943('0xe'),_0x152c44);});}else{utils['request']('CreateVoiceRecording',_0x152c44);}if(_0x5975ae)delete transfers[_0x1943('0x6')][_0x5975ae];}exports['newchannel']=function(_0x368b04){try{utils['debug'](util['format'](_0x1943('0xf'),_0x368b04[_0x1943('0x5')]),_0x368b04);if(_0x368b04[_0x1943('0x5')]==_0x368b04[_0x1943('0x10')]){utils[_0x1943('0x2')](util[_0x1943('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x368b04[_0x1943('0x5')],_0x368b04[_0x1943('0x11')],_0x368b04['exten']));recordings[_0x368b04['uniqueid']]={'uniqueid':_0x368b04[_0x1943('0x5')],'accountcode':_0x368b04['accountcode'],'exten':_0x368b04[_0x1943('0x12')],'context':_0x368b04['context'],'channel':_0x368b04[_0x1943('0x13')],'monitors':[]};}}catch(_0x772dfe){utils[_0x1943('0x14')](util[_0x1943('0x3')](_0x1943('0xf'),_0x368b04[_0x1943('0x5')]),_0x772dfe);}};exports[_0x1943('0x15')]=function(_0x2c74c1){try{utils[_0x1943('0x16')](util[_0x1943('0x3')](_0x1943('0x17'),_0x2c74c1[_0x1943('0x5')]),_0x2c74c1);if(!_[_0x1943('0x18')](recordings[_0x2c74c1['uniqueid']])&&_0x2c74c1['channelstate']==0x6){utils[_0x1943('0x2')](util[_0x1943('0x3')](_0x1943('0x19'),_0x2c74c1['uniqueid'],_0x2c74c1[_0x1943('0x11')],_0x2c74c1['channel']));}else if(!_['isNil'](recordings[_0x2c74c1[_0x1943('0x10')]])&&_0x2c74c1['channelstate']==0x6&&_0x2c74c1['context']!=_0x1943('0x1a')){utils['info'](util[_0x1943('0x3')](_0x1943('0x1b'),_0x2c74c1[_0x1943('0x5')],_0x2c74c1[_0x1943('0x10')],_0x2c74c1['context'],_0x2c74c1[_0x1943('0x13')]));recordings[_0x2c74c1['linkedid']][_0x1943('0x8')]=_0x2c74c1[_0x1943('0x8')];}}catch(_0x2f853c){utils[_0x1943('0x14')](util[_0x1943('0x3')](_0x1943('0x17'),_0x2c74c1[_0x1943('0x5')]),_0x2f853c);}};exports['varset']=function(_0x3f36dc){try{if(!_[_0x1943('0x18')](_0x3f36dc['variable'])&&!_[_0x1943('0x18')](_0x3f36dc[_0x1943('0x1c')][_0x1943('0x1d')])){utils['debug'](util[_0x1943('0x3')]('[%s][recordings][varset]',_0x3f36dc['uniqueid']),_0x3f36dc);utils[_0x1943('0x2')](util['format'](_0x1943('0x1e'),_0x3f36dc[_0x1943('0x5')],_0x3f36dc[_0x1943('0x1c')],_0x3f36dc[_0x1943('0x1f')]));if(_[_0x1943('0x20')](_0x3f36dc[_0x1943('0x1f')],'.wav49')){_0x3f36dc[_0x1943('0x1f')]=_0x3f36dc[_0x1943('0x1f')][_0x1943('0x21')]('.wav49',_0x1943('0x22'));}if(recordings[_0x3f36dc[_0x1943('0x10')]]){var _0x13a279=_[_0x1943('0x23')](recordings[_0x3f36dc[_0x1943('0x10')]]['monitors'],{'value':_0x3f36dc[_0x1943('0x1f')]});if(_['isNil'](_0x13a279)){recordings[_0x3f36dc['linkedid']][_0x1943('0x24')][_0x1943('0x25')]({'value':_0x3f36dc[_0x1943('0x1f')]});}}}}catch(_0xdbf0b4){utils['error'](util['format'](_0x1943('0x26'),_0x3f36dc[_0x1943('0x5')]),_0xdbf0b4);}};exports[_0x1943('0x27')]=function(_0x4e8422){try{if(!_[_0x1943('0x18')](recordings[_0x4e8422[_0x1943('0x5')]])){utils[_0x1943('0x16')](util[_0x1943('0x3')]('[%s][recordings][hangup]',_0x4e8422[_0x1943('0x5')]),_0x4e8422);utils['info'](util[_0x1943('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4e8422['uniqueid'],_0x4e8422[_0x1943('0x28')],_0x4e8422[_0x1943('0x29')],_0x4e8422[_0x1943('0x2a')]));recordings[_0x4e8422[_0x1943('0x5')]][_0x1943('0x28')]=_0x4e8422['calleridnum'];recordings[_0x4e8422[_0x1943('0x5')]][_0x1943('0x29')]=_0x4e8422[_0x1943('0x29')];recordings[_0x4e8422[_0x1943('0x5')]]['connectedlinenum']=_0x4e8422['connectedlinenum'];recordings[_0x4e8422[_0x1943('0x5')]][_0x1943('0x2b')]=_0x4e8422[_0x1943('0x2b')];if(recordings[_0x4e8422[_0x1943('0x5')]][_0x1943('0x2c')]==_0x1943('0x2d')&&recordings[_0x4e8422['uniqueid']][_0x1943('0x8')]){recordings[_0x4e8422[_0x1943('0x5')]]['connectedlinenum']=recordings[_0x4e8422[_0x1943('0x5')]][_0x1943('0x8')];recordings[_0x4e8422[_0x1943('0x5')]]['connectedlinename']='';}recordings[_0x4e8422[_0x1943('0x5')]][_0x1943('0x24')][_0x1943('0x2e')](function(_0xa9108a){var _0x7e2fe4=_['clone'](recordings[_0x4e8422['uniqueid']]);_0x7e2fe4[_0x1943('0x1f')]=_0xa9108a[_0x1943('0x1f')];writeDB(_0x7e2fe4);});delete recordings[_0x4e8422[_0x1943('0x5')]];}}catch(_0x20c590){utils['error'](util[_0x1943('0x3')](_0x1943('0x2f'),_0x4e8422[_0x1943('0x5')]),_0x20c590);}};exports['newexten']=function(_0x920cfb){try{if(!_[_0x1943('0x18')](recordings[_0x920cfb[_0x1943('0x5')]])){utils[_0x1943('0x16')](util[_0x1943('0x3')](_0x1943('0x30'),_0x920cfb[_0x1943('0x5')]),_0x920cfb);utils['info'](util[_0x1943('0x3')](_0x1943('0x31'),_0x920cfb[_0x1943('0x5')],_0x920cfb[_0x1943('0x32')],_0x920cfb['appdata']));if(_0x920cfb[_0x1943('0x32')][_0x1943('0x33')]()==_0x1943('0x34')&&_[_0x1943('0x35')](_0x920cfb[_0x1943('0x36')][_0x1943('0x33')](),_0x1943('0x37'))){var _0x84a5c=_0x920cfb[_0x1943('0x36')][_0x1943('0x38')]('=');var _0x4db834=_0x84a5c[0x0][_0x1943('0x39')](_0x84a5c[0x0][_0x1943('0x3a')]('(')+0x1,_0x84a5c[0x0]['lastIndexOf'](')'));var _0xd0f4c3=_0x84a5c[0x1];recordings[_0x920cfb['uniqueid']][_0x4db834]=_0xd0f4c3;}}}catch(_0x5bc3ca){utils[_0x1943('0x14')](util[_0x1943('0x3')](_0x1943('0x30'),_0x920cfb[_0x1943('0x5')]),_0x5bc3ca);}};exports[_0x1943('0x3b')]=function(_0x4c7304){try{if(!_['isNil'](recordings[_0x4c7304[_0x1943('0x5')]])){utils[_0x1943('0x16')](util[_0x1943('0x3')](_0x1943('0x3c'),_0x4c7304['uniqueid']),_0x4c7304);utils[_0x1943('0x2')](util[_0x1943('0x3')](_0x1943('0x3d'),_0x4c7304[_0x1943('0x5')],_0x4c7304['queue']));recordings[_0x4c7304[_0x1943('0x5')]][_0x1943('0x3e')]=_0x4c7304['queue'];}}catch(_0xf4f61f){utils['error'](util[_0x1943('0x3')](_0x1943('0x3c'),_0x4c7304[_0x1943('0x5')]),_0xf4f61f);}};exports['blindtransfer']=function(_0xaac72f){try{utils[_0x1943('0x16')](util[_0x1943('0x3')](_0x1943('0x3f'),_0xaac72f[_0x1943('0x5')]),_0xaac72f);utils[_0x1943('0x2')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xaac72f[_0x1943('0x5')],_0xaac72f[_0x1943('0x40')],_0xaac72f[_0x1943('0x41')],_0xaac72f[_0x1943('0x42')],_0xaac72f[_0x1943('0x43')]));if(recordings[_0xaac72f[_0x1943('0x44')]]&&transfers['blinds'][_0xaac72f[_0x1943('0x44')]]){transfers['blinds'][_0xaac72f[_0x1943('0x44')]][_0x1943('0x45')]=!![];}}catch(_0x2ff4cb){utils[_0x1943('0x14')](util[_0x1943('0x3')](_0x1943('0x3f'),_0xaac72f[_0x1943('0x5')]),_0x2ff4cb);}}; \ No newline at end of file +var _0xfd46=['uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xfd46,0x129));var _0x6fd4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xfd46[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x6fd4('0x0'));var util=require(_0x6fd4('0x1'));var utils=require(_0x6fd4('0x2'));var transfers=require(_0x6fd4('0x3'));var recordings={};function writeDB(_0x2055c7){var _0x187050;utils[_0x6fd4('0x4')](util[_0x6fd4('0x5')](_0x6fd4('0x6'),_0x2055c7[_0x6fd4('0x7')]));if(transfers['blinds'][_0x2055c7[_0x6fd4('0x7')]]){_0x187050=_0x2055c7[_0x6fd4('0x7')];_0x2055c7[_0x6fd4('0x7')]=transfers[_0x6fd4('0x8')][_0x2055c7[_0x6fd4('0x7')]][_0x6fd4('0x9')];}if(_0x2055c7[_0x6fd4('0xa')]){utils[_0x6fd4('0xb')](_0x2055c7['accountcode'])['then'](function(_0x36adad){if(_0x36adad){_0x2055c7[_0x6fd4('0xc')]=_0x36adad[_0x6fd4('0xd')];_0x2055c7[_0x6fd4('0xe')]=_0x36adad['id'];}utils[_0x6fd4('0xf')]('CreateVoiceRecording',_0x2055c7);});}else{utils[_0x6fd4('0xf')]('CreateVoiceRecording',_0x2055c7);}if(_0x187050)delete transfers[_0x6fd4('0x8')][_0x187050];}exports[_0x6fd4('0x10')]=function(_0x5c5282){try{utils[_0x6fd4('0x11')](util['format']('[%s][recordings][newchannel]',_0x5c5282[_0x6fd4('0x7')]),_0x5c5282);if(_0x5c5282[_0x6fd4('0x7')]==_0x5c5282[_0x6fd4('0x12')]){utils[_0x6fd4('0x4')](util[_0x6fd4('0x5')](_0x6fd4('0x13'),_0x5c5282[_0x6fd4('0x7')],_0x5c5282[_0x6fd4('0x14')],_0x5c5282[_0x6fd4('0x15')]));recordings[_0x5c5282[_0x6fd4('0x7')]]={'uniqueid':_0x5c5282['uniqueid'],'accountcode':_0x5c5282['accountcode'],'exten':_0x5c5282[_0x6fd4('0x15')],'context':_0x5c5282[_0x6fd4('0x14')],'channel':_0x5c5282[_0x6fd4('0x16')],'monitors':[]};}}catch(_0x4427da){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x18'),_0x5c5282['uniqueid']),_0x4427da);}};exports[_0x6fd4('0x19')]=function(_0x1d8b22){try{utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')](_0x6fd4('0x1a'),_0x1d8b22[_0x6fd4('0x7')]),_0x1d8b22);if(!_[_0x6fd4('0x1b')](recordings[_0x1d8b22[_0x6fd4('0x7')]])&&_0x1d8b22[_0x6fd4('0x1c')]==0x6){utils[_0x6fd4('0x4')](util['format'](_0x6fd4('0x1d'),_0x1d8b22[_0x6fd4('0x7')],_0x1d8b22['context'],_0x1d8b22['channel']));}else if(!_[_0x6fd4('0x1b')](recordings[_0x1d8b22[_0x6fd4('0x12')]])&&_0x1d8b22[_0x6fd4('0x1c')]==0x6&&_0x1d8b22['context']!=_0x6fd4('0x1e')){utils[_0x6fd4('0x4')](util[_0x6fd4('0x5')](_0x6fd4('0x1f'),_0x1d8b22[_0x6fd4('0x7')],_0x1d8b22['linkedid'],_0x1d8b22[_0x6fd4('0x14')],_0x1d8b22[_0x6fd4('0x16')]));recordings[_0x1d8b22[_0x6fd4('0x12')]][_0x6fd4('0xa')]=_0x1d8b22[_0x6fd4('0xa')];}}catch(_0x157a85){utils['error'](util['format'](_0x6fd4('0x1a'),_0x1d8b22[_0x6fd4('0x7')]),_0x157a85);}};exports['varset']=function(_0x23050a){try{if(!_[_0x6fd4('0x1b')](_0x23050a[_0x6fd4('0x20')])&&!_[_0x6fd4('0x1b')](_0x23050a['variable'][_0x6fd4('0x21')])){utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')]('[%s][recordings][varset]',_0x23050a[_0x6fd4('0x7')]),_0x23050a);utils[_0x6fd4('0x4')](util[_0x6fd4('0x5')](_0x6fd4('0x22'),_0x23050a[_0x6fd4('0x7')],_0x23050a[_0x6fd4('0x20')],_0x23050a[_0x6fd4('0x23')]));if(_[_0x6fd4('0x24')](_0x23050a[_0x6fd4('0x23')],'.wav49')){_0x23050a[_0x6fd4('0x23')]=_0x23050a[_0x6fd4('0x23')][_0x6fd4('0x25')]('.wav49',_0x6fd4('0x26'));}if(recordings[_0x23050a[_0x6fd4('0x12')]]){var _0x352fc4=_[_0x6fd4('0x27')](recordings[_0x23050a[_0x6fd4('0x12')]][_0x6fd4('0x28')],{'value':_0x23050a[_0x6fd4('0x23')]});if(_[_0x6fd4('0x1b')](_0x352fc4)){recordings[_0x23050a[_0x6fd4('0x12')]][_0x6fd4('0x28')][_0x6fd4('0x29')]({'value':_0x23050a[_0x6fd4('0x23')]});}}}}catch(_0x526a7e){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x2a'),_0x23050a[_0x6fd4('0x7')]),_0x526a7e);}};exports[_0x6fd4('0x2b')]=function(_0x74138d){try{if(!_[_0x6fd4('0x1b')](recordings[_0x74138d['uniqueid']])){utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')]('[%s][recordings][hangup]',_0x74138d[_0x6fd4('0x7')]),_0x74138d);utils[_0x6fd4('0x4')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x74138d[_0x6fd4('0x7')],_0x74138d[_0x6fd4('0x2c')],_0x74138d[_0x6fd4('0x2d')],_0x74138d[_0x6fd4('0x2e')]));recordings[_0x74138d['uniqueid']][_0x6fd4('0x2c')]=_0x74138d[_0x6fd4('0x2c')];recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x2d')]=_0x74138d[_0x6fd4('0x2d')];recordings[_0x74138d['uniqueid']][_0x6fd4('0x2f')]=_0x74138d[_0x6fd4('0x2f')];recordings[_0x74138d[_0x6fd4('0x7')]]['connectedlinename']=_0x74138d[_0x6fd4('0x30')];if(recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x31')]=='outbound'&&recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0xa')]){recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x2f')]=recordings[_0x74138d['uniqueid']][_0x6fd4('0xa')];recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x30')]='';}recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x28')][_0x6fd4('0x32')](function(_0x410c9b){var _0x1c8d5a=_[_0x6fd4('0x33')](recordings[_0x74138d[_0x6fd4('0x7')]]);_0x1c8d5a[_0x6fd4('0x23')]=_0x410c9b['value'];writeDB(_0x1c8d5a);});delete recordings[_0x74138d[_0x6fd4('0x7')]];}}catch(_0x593f7d){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x34'),_0x74138d[_0x6fd4('0x7')]),_0x593f7d);}};exports[_0x6fd4('0x35')]=function(_0x3d303f){try{if(!_[_0x6fd4('0x1b')](recordings[_0x3d303f[_0x6fd4('0x7')]])){utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')](_0x6fd4('0x36'),_0x3d303f[_0x6fd4('0x7')]),_0x3d303f);utils['info'](util[_0x6fd4('0x5')](_0x6fd4('0x37'),_0x3d303f['uniqueid'],_0x3d303f[_0x6fd4('0x38')],_0x3d303f[_0x6fd4('0x39')]));if(_0x3d303f[_0x6fd4('0x38')][_0x6fd4('0x3a')]()==_0x6fd4('0x3b')&&_[_0x6fd4('0x3c')](_0x3d303f[_0x6fd4('0x39')][_0x6fd4('0x3a')](),_0x6fd4('0x3d'))){var _0x5e7710=_0x3d303f['appdata'][_0x6fd4('0x3e')]('=');var _0x548b4e=_0x5e7710[0x0][_0x6fd4('0x3f')](_0x5e7710[0x0][_0x6fd4('0x40')]('(')+0x1,_0x5e7710[0x0]['lastIndexOf'](')'));var _0x1f60f4=_0x5e7710[0x1];recordings[_0x3d303f[_0x6fd4('0x7')]][_0x548b4e]=_0x1f60f4;}}}catch(_0x47659f){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x36'),_0x3d303f[_0x6fd4('0x7')]),_0x47659f);}};exports[_0x6fd4('0x41')]=function(_0x585367){try{if(!_['isNil'](recordings[_0x585367['uniqueid']])){utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')]('[%s][recordings][queuecallerjoin]',_0x585367[_0x6fd4('0x7')]),_0x585367);utils[_0x6fd4('0x4')](util['format'](_0x6fd4('0x42'),_0x585367[_0x6fd4('0x7')],_0x585367['queue']));recordings[_0x585367['uniqueid']]['queue']=_0x585367[_0x6fd4('0x43')];}}catch(_0x264b4e){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x44'),_0x585367['uniqueid']),_0x264b4e);}};exports[_0x6fd4('0x45')]=function(_0xad012a){try{utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')](_0x6fd4('0x46'),_0xad012a['uniqueid']),_0xad012a);utils[_0x6fd4('0x4')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xad012a[_0x6fd4('0x7')],_0xad012a['transferercalleridnum'],_0xad012a[_0x6fd4('0x47')],_0xad012a[_0x6fd4('0x48')],_0xad012a[_0x6fd4('0x49')]));if(recordings[_0xad012a[_0x6fd4('0x4a')]]&&transfers[_0x6fd4('0x8')][_0xad012a[_0x6fd4('0x4a')]]){transfers[_0x6fd4('0x8')][_0xad012a[_0x6fd4('0x4a')]][_0x6fd4('0x4b')]=!![];}}catch(_0x25e22a){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x46'),_0xad012a[_0x6fd4('0x7')]),_0x25e22a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 571c2a5..105f55c 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 _0xbf3d=['origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x39e85a,_0x1cd71c){var _0x5a7457=function(_0x4a9ba4){while(--_0x4a9ba4){_0x39e85a['push'](_0x39e85a['shift']());}};_0x5a7457(++_0x1cd71c);}(_0xbf3d,0xfa));var _0xdbf3=function(_0x330634,_0x51c09c){_0x330634=_0x330634-0x0;var _0x479f3e=_0xbf3d[_0x330634];return _0x479f3e;};'use strict';var _=require(_0xdbf3('0x0'));var util=require(_0xdbf3('0x1'));var utils=require(_0xdbf3('0x2'));function writeDB(_0x9d3f23){utils[_0xdbf3('0x3')](util[_0xdbf3('0x4')](_0xdbf3('0x5'),_0x9d3f23[_0xdbf3('0x6')]===_0xdbf3('0x7')?_0x9d3f23[_0xdbf3('0x8')]:_0x9d3f23['uniqueid'],_0x9d3f23[_0xdbf3('0x6')]));utils[_0xdbf3('0x9')](_0xdbf3('0xa'),_0x9d3f23);}exports[_0xdbf3('0xb')]={};exports[_0xdbf3('0xc')]=function(_0x24f9c5){try{utils[_0xdbf3('0xd')](util[_0xdbf3('0x4')]('[%s][transfers][blindtransfer]',_0x24f9c5[_0xdbf3('0xe')]),_0x24f9c5);utils[_0xdbf3('0x3')](util[_0xdbf3('0x4')](_0xdbf3('0xf'),_0x24f9c5[_0xdbf3('0xe')],_0x24f9c5[_0xdbf3('0x10')],_0x24f9c5[_0xdbf3('0x11')],_0x24f9c5['transfereecalleridnum'],_0x24f9c5[_0xdbf3('0x12')]));_0x24f9c5[_0xdbf3('0x6')]=_0xdbf3('0x13');exports[_0xdbf3('0xb')][_0x24f9c5[_0xdbf3('0x14')]]=_0x24f9c5;writeDB(_0x24f9c5);}catch(_0x368549){utils[_0xdbf3('0x15')](util['format'](_0xdbf3('0x16'),_0x24f9c5[_0xdbf3('0xe')]),_0x368549);}};exports[_0xdbf3('0x17')]=function(_0xa584fd){try{utils[_0xdbf3('0xd')](util[_0xdbf3('0x4')](_0xdbf3('0x18'),_0xa584fd[_0xdbf3('0x8')]),_0xa584fd);utils[_0xdbf3('0x3')](util[_0xdbf3('0x4')](_0xdbf3('0x19'),_0xa584fd[_0xdbf3('0x8')],_0xa584fd[_0xdbf3('0x1a')],_0xa584fd[_0xdbf3('0x1b')],_0xa584fd[_0xdbf3('0x1c')],_0xa584fd[_0xdbf3('0x1d')]));_0xa584fd=_['assign'](_0xa584fd,{'transfererchannel':_0xa584fd[_0xdbf3('0x1e')],'transferercalleridnum':_0xa584fd[_0xdbf3('0x1a')],'transferercalleridname':_0xa584fd[_0xdbf3('0x1b')],'transfererconnectedlinenum':_0xa584fd[_0xdbf3('0x1f')],'transfererconnectedlinename':_0xa584fd[_0xdbf3('0x20')],'transfereraccountcode':_0xa584fd[_0xdbf3('0x21')],'transferercontext':_0xa584fd[_0xdbf3('0x22')],'transfererexten':_0xa584fd[_0xdbf3('0x23')],'transfererlinkedid':_0xa584fd[_0xdbf3('0x24')],'context':_0xa584fd[_0xdbf3('0x25')],'extension':_0xa584fd[_0xdbf3('0x26')],'type':_0xdbf3('0x7')});if(_[_0xdbf3('0x27')](_0xa584fd[_0xdbf3('0x28')])){_0xa584fd=_['assign'](_0xa584fd,{'transfereechannel':_0xa584fd['transfertargetchannel'],'transfereecalleridnum':_0xa584fd[_0xdbf3('0x1c')],'transfereecalleridname':_0xa584fd[_0xdbf3('0x1d')],'transfereeconnectedlinenum':_0xa584fd[_0xdbf3('0x29')],'transfereeconnectedlinename':_0xa584fd['transfertargetconnectedlinename'],'transfereeaccountcode':_0xa584fd[_0xdbf3('0x2a')],'transfereecontext':_0xa584fd[_0xdbf3('0x2b')],'transfereeexten':_0xa584fd[_0xdbf3('0x2c')],'transfereelinkedid':_0xa584fd[_0xdbf3('0x2d')]});}writeDB(_0xa584fd);}catch(_0x5eb1ae){utils[_0xdbf3('0x15')](util['format'](_0xdbf3('0x18'),_0xa584fd['origtransfereruniqueid']),_0x5eb1ae);}}; \ No newline at end of file +var _0xbb81=['transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','format','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','transfereruniqueid','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x506c35,_0x3bb47a){var _0x43d6ca=function(_0x1cfcd1){while(--_0x1cfcd1){_0x506c35['push'](_0x506c35['shift']());}};_0x43d6ca(++_0x3bb47a);}(_0xbb81,0x163));var _0x1bb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb81[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1bb8('0x0'));var util=require('util');var utils=require(_0x1bb8('0x1'));function writeDB(_0x557a24){utils[_0x1bb8('0x2')](util[_0x1bb8('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x557a24['type']==='attended'?_0x557a24[_0x1bb8('0x4')]:_0x557a24[_0x1bb8('0x5')],_0x557a24['type']));utils['request'](_0x1bb8('0x6'),_0x557a24);}exports[_0x1bb8('0x7')]={};exports[_0x1bb8('0x8')]=function(_0x591098){try{utils[_0x1bb8('0x9')](util['format']('[%s][transfers][blindtransfer]',_0x591098[_0x1bb8('0x5')]),_0x591098);utils[_0x1bb8('0x2')](util[_0x1bb8('0x3')](_0x1bb8('0xa'),_0x591098[_0x1bb8('0x5')],_0x591098[_0x1bb8('0xb')],_0x591098[_0x1bb8('0xc')],_0x591098[_0x1bb8('0xd')],_0x591098[_0x1bb8('0xe')]));_0x591098[_0x1bb8('0xf')]='blind';exports[_0x1bb8('0x7')][_0x591098[_0x1bb8('0x10')]]=_0x591098;writeDB(_0x591098);}catch(_0x13b48e){utils['error'](util['format'](_0x1bb8('0x11'),_0x591098[_0x1bb8('0x5')]),_0x13b48e);}};exports['attendedtransfer']=function(_0x3eeefd){try{utils[_0x1bb8('0x9')](util[_0x1bb8('0x3')](_0x1bb8('0x12'),_0x3eeefd[_0x1bb8('0x4')]),_0x3eeefd);utils[_0x1bb8('0x2')](util[_0x1bb8('0x3')](_0x1bb8('0x13'),_0x3eeefd[_0x1bb8('0x4')],_0x3eeefd[_0x1bb8('0x14')],_0x3eeefd[_0x1bb8('0x15')],_0x3eeefd[_0x1bb8('0x16')],_0x3eeefd['transfertargetcalleridname']));_0x3eeefd=_[_0x1bb8('0x17')](_0x3eeefd,{'transfererchannel':_0x3eeefd[_0x1bb8('0x18')],'transferercalleridnum':_0x3eeefd[_0x1bb8('0x14')],'transferercalleridname':_0x3eeefd[_0x1bb8('0x15')],'transfererconnectedlinenum':_0x3eeefd[_0x1bb8('0x19')],'transfererconnectedlinename':_0x3eeefd[_0x1bb8('0x1a')],'transfereraccountcode':_0x3eeefd[_0x1bb8('0x1b')],'transferercontext':_0x3eeefd[_0x1bb8('0x1c')],'transfererexten':_0x3eeefd[_0x1bb8('0x1d')],'transfererlinkedid':_0x3eeefd[_0x1bb8('0x1e')],'context':_0x3eeefd[_0x1bb8('0x1f')],'extension':_0x3eeefd['origtransfererexten'],'type':_0x1bb8('0x20')});if(_[_0x1bb8('0x21')](_0x3eeefd[_0x1bb8('0x22')])){_0x3eeefd=_[_0x1bb8('0x17')](_0x3eeefd,{'transfereechannel':_0x3eeefd[_0x1bb8('0x23')],'transfereecalleridnum':_0x3eeefd[_0x1bb8('0x16')],'transfereecalleridname':_0x3eeefd[_0x1bb8('0x24')],'transfereeconnectedlinenum':_0x3eeefd[_0x1bb8('0x25')],'transfereeconnectedlinename':_0x3eeefd[_0x1bb8('0x26')],'transfereeaccountcode':_0x3eeefd[_0x1bb8('0x27')],'transfereecontext':_0x3eeefd[_0x1bb8('0x28')],'transfereeexten':_0x3eeefd[_0x1bb8('0x29')],'transfereelinkedid':_0x3eeefd[_0x1bb8('0x2a')]});}writeDB(_0x3eeefd);}catch(_0x2b6c84){utils[_0x1bb8('0x2b')](util['format'](_0x1bb8('0x12'),_0x3eeefd[_0x1bb8('0x4')]),_0x2b6c84);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9bca9c9..5944a65 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 _0xcfbf=['diffTime','diff','seconds','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','found','length','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract'];(function(_0x620627,_0x1e3682){var _0x4ca056=function(_0x47d7a1){while(--_0x47d7a1){_0x620627['push'](_0x620627['shift']());}};_0x4ca056(++_0x1e3682);}(_0xcfbf,0x1f1));var _0xfcfb=function(_0xef284a,_0xf6fe93){_0xef284a=_0xef284a-0x0;var _0x20ced3=_0xcfbf[_0xef284a];return _0x20ced3;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xfcfb('0x0'));var moment=require(_0xfcfb('0x1'));var util=require(_0xfcfb('0x2'));var client=jayson[_0xfcfb('0x3')][_0xfcfb('0x4')]({'port':0x2329});var logger=require(_0xfcfb('0x5'))(_0xfcfb('0x6'));exports[_0xfcfb('0x7')]=function(_0x4c56ff,_0xf2ed04){logger['info'](_0x4c56ff,_0xf2ed04?util['inspect'](_0xf2ed04,{'showHidden':![],'depth':null}):'');};exports[_0xfcfb('0x8')]=function(_0x311d4d,_0x4159a6){logger['debug'](_0x311d4d,_0x4159a6?util[_0xfcfb('0x9')](_0x4159a6,{'showHidden':![],'depth':null}):'');};exports[_0xfcfb('0xa')]=function(_0x268336,_0x38b9a5){logger[_0xfcfb('0xa')](_0x268336,_0x38b9a5?util[_0xfcfb('0x9')](_0x38b9a5,{'showHidden':![],'depth':null}):'');};exports[_0xfcfb('0xb')]=function(_0x2aa931,_0x2c277a){return client[_0xfcfb('0xb')](_0x2aa931,{'body':_0x2c277a})[_0xfcfb('0xc')](function(_0x43ba25){logger[_0xfcfb('0x8')](_0xfcfb('0xd'),_0x2aa931,_0x43ba25?util[_0xfcfb('0x9')](_0x43ba25,{'showHidden':![],'depth':null}):'');})[_0xfcfb('0xe')](function(_0x2619dd){logger[_0xfcfb('0xa')]('[utils][request]\x20name:%s',_0x2aa931,_0x2619dd?util[_0xfcfb('0x9')](_0x2619dd,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4f096d){return client[_0xfcfb('0xb')](_0xfcfb('0xf'),{'options':{'raw':!![],'attributes':['id',_0xfcfb('0x10'),_0xfcfb('0x11'),_0xfcfb('0x12')],'where':_0x4f096d,'limit':0x1}})[_0xfcfb('0xc')](function(_0x5e5d27){logger[_0xfcfb('0x8')](_0xfcfb('0x13'),JSON[_0xfcfb('0x14')](_0x4f096d),_0x5e5d27?util[_0xfcfb('0x9')](_0x5e5d27,{'showHidden':![],'depth':null}):'');return _0x5e5d27[_0xfcfb('0x15')]['length']?_0x5e5d27[_0xfcfb('0x15')][0x0]:null;});}exports[_0xfcfb('0x16')]=function(_0x2119e3){return new BPromise(function(_0x12c50d,_0x318b03){if(_0x2119e3){return getUser({'internal':_0x2119e3})[_0xfcfb('0xc')](function(_0x10e68e){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2119e3,_0x10e68e?'found':_0xfcfb('0x17'));return _0x12c50d(_0x10e68e);})[_0xfcfb('0xe')](function(_0x12023d){logger[_0xfcfb('0xa')](_0xfcfb('0x18'),_0x12023d?util[_0xfcfb('0x9')](_0x12023d,{'showHidden':![],'depth':null}):'');return _0x12c50d(null);});}return _0x12c50d(null);});};exports['getUserByInterface']=function(_0x568d36){return new BPromise(function(_0x1d94eb,_0xfe2da6){if(_0x568d36){return getUser({'interface':_0x568d36})[_0xfcfb('0xc')](function(_0x9e62f9){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x568d36,_0x9e62f9?'found':_0xfcfb('0x17'));return _0x1d94eb(_0x9e62f9);})[_0xfcfb('0xe')](function(_0x3b4c88){logger['error'](_0xfcfb('0x19'),_0x3b4c88?util['inspect'](_0x3b4c88,{'showHidden':![],'depth':null}):'');return _0x1d94eb(null);});}return _0x1d94eb(null);});};exports[_0xfcfb('0x1a')]=function(_0x119c78){return new BPromise(function(_0x2bc43b,_0x3bdd88){if(_0x119c78){return getUser({'name':_0x119c78})['then'](function(_0x38aae4){logger['info'](_0xfcfb('0x1b'),_0x119c78,_0x38aae4?'found':_0xfcfb('0x17'));return _0x2bc43b(_0x38aae4);})['catch'](function(_0x3fdfde){logger[_0xfcfb('0xa')](_0xfcfb('0x1c'),_0x3fdfde?util[_0xfcfb('0x9')](_0x3fdfde,{'showHidden':![],'depth':null}):'');return _0x2bc43b(null);});}return _0x2bc43b(null);});};exports[_0xfcfb('0x1d')]=function(_0x13302b){return new BPromise(function(_0x5ff1eb,_0x23ea59){if(_0x13302b){return client[_0xfcfb('0xb')](_0xfcfb('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xfcfb('0x11'),_0xfcfb('0x1f'),_0xfcfb('0x20'),_0xfcfb('0x21')],'where':{'name':_0x13302b},'limit':0x1}})['then'](function(_0x4012c3){logger['debug'](_0xfcfb('0x22'),_0x13302b,_0x4012c3?util[_0xfcfb('0x9')](_0x4012c3,{'showHidden':![],'depth':null}):'');logger[_0xfcfb('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x13302b,_0x4012c3?_0xfcfb('0x23'):_0xfcfb('0x17'));return _0x5ff1eb(_0x4012c3[_0xfcfb('0x15')][_0xfcfb('0x24')]?_0x4012c3[_0xfcfb('0x15')][0x0]:null);})[_0xfcfb('0xe')](function(_0x4e5a44){logger['error']('[utils][getVoiceQueueByName]',_0x4e5a44?util[_0xfcfb('0x9')](_0x4e5a44,{'showHidden':![],'depth':null}):'');return _0x5ff1eb(null);});}return _0x5ff1eb(null);});};exports[_0xfcfb('0x25')]=function(_0x289a08,_0x4f1a92){return moment(_0x289a08)['add'](_0x4f1a92,'seconds')[_0xfcfb('0x26')](_0xfcfb('0x27'));};exports[_0xfcfb('0x28')]=function(_0xcf9789,_0x2d6d11){return moment(_0xcf9789)[_0xfcfb('0x29')](_0x2d6d11,'seconds')['format'](_0xfcfb('0x27'));};exports[_0xfcfb('0x2a')]=function(_0x159c5d,_0x560da4){return moment(_0x159c5d)[_0xfcfb('0x2b')](moment(_0x560da4),_0xfcfb('0x2c'));};exports[_0xfcfb('0x2d')]=function(_0x2594a5,_0x2bfe98){return parseInt(_0x2594a5,0xa)+parseInt(_0x2bfe98,0xa);};exports[_0xfcfb('0x2e')]=function(){return moment()[_0xfcfb('0x26')](_0xfcfb('0x27'));};exports[_0xfcfb('0x2f')]=function(_0x56526b,_0x5be88b){if(_0x5be88b){return moment(_0x56526b)[_0xfcfb('0x2f')](_0x5be88b);}return!![];};exports['isBefore']=function(_0xd4ecb7,_0x451215){if(_0x451215){return moment(_0xd4ecb7)[_0xfcfb('0x30')](_0x451215);}else if(_0xd4ecb7){return!![];}return![];}; \ No newline at end of file +var _0x9ff0=['[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','error','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','request','then','[utils][request]\x20name:%s','catch','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal'];(function(_0xe39f34,_0xabdbf5){var _0x538cbc=function(_0x28c328){while(--_0x28c328){_0xe39f34['push'](_0xe39f34['shift']());}};_0x538cbc(++_0xabdbf5);}(_0x9ff0,0x1c1));var _0x09ff=function(_0x12003b,_0x510441){_0x12003b=_0x12003b-0x0;var _0x4a9126=_0x9ff0[_0x12003b];return _0x4a9126;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x09ff('0x0'));var moment=require(_0x09ff('0x1'));var util=require(_0x09ff('0x2'));var client=jayson[_0x09ff('0x3')][_0x09ff('0x4')]({'port':0x2329});var logger=require(_0x09ff('0x5'))(_0x09ff('0x6'));exports[_0x09ff('0x7')]=function(_0x34fc78,_0x197d74){logger[_0x09ff('0x7')](_0x34fc78,_0x197d74?util[_0x09ff('0x8')](_0x197d74,{'showHidden':![],'depth':null}):'');};exports[_0x09ff('0x9')]=function(_0x1a01c4,_0xbda2f0){logger['debug'](_0x1a01c4,_0xbda2f0?util[_0x09ff('0x8')](_0xbda2f0,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x59f81d,_0x34fae0){logger['error'](_0x59f81d,_0x34fae0?util[_0x09ff('0x8')](_0x34fae0,{'showHidden':![],'depth':null}):'');};exports[_0x09ff('0xa')]=function(_0x3e9de6,_0x3711ff){return client['request'](_0x3e9de6,{'body':_0x3711ff})[_0x09ff('0xb')](function(_0x5f1863){logger[_0x09ff('0x9')](_0x09ff('0xc'),_0x3e9de6,_0x5f1863?util[_0x09ff('0x8')](_0x5f1863,{'showHidden':![],'depth':null}):'');})[_0x09ff('0xd')](function(_0xe46cd9){logger['error']('[utils][request]\x20name:%s',_0x3e9de6,_0xe46cd9?util[_0x09ff('0x8')](_0xe46cd9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4b5438){return client[_0x09ff('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x09ff('0xe'),'name',_0x09ff('0xf')],'where':_0x4b5438,'limit':0x1}})['then'](function(_0x3ea016){logger[_0x09ff('0x9')](_0x09ff('0x10'),JSON[_0x09ff('0x11')](_0x4b5438),_0x3ea016?util[_0x09ff('0x8')](_0x3ea016,{'showHidden':![],'depth':null}):'');return _0x3ea016[_0x09ff('0x12')][_0x09ff('0x13')]?_0x3ea016[_0x09ff('0x12')][0x0]:null;});}exports[_0x09ff('0x14')]=function(_0x30ccb8){return new BPromise(function(_0x3e63c3,_0x526816){if(_0x30ccb8){return getUser({'internal':_0x30ccb8})[_0x09ff('0xb')](function(_0x47475f){logger[_0x09ff('0x7')](_0x09ff('0x15'),_0x30ccb8,_0x47475f?_0x09ff('0x16'):_0x09ff('0x17'));return _0x3e63c3(_0x47475f);})[_0x09ff('0xd')](function(_0x3c72f2){logger[_0x09ff('0x18')](_0x09ff('0x19'),_0x3c72f2?util[_0x09ff('0x8')](_0x3c72f2,{'showHidden':![],'depth':null}):'');return _0x3e63c3(null);});}return _0x3e63c3(null);});};exports['getUserByInterface']=function(_0x53a227){return new BPromise(function(_0x1dbbf6,_0x755952){if(_0x53a227){return getUser({'interface':_0x53a227})[_0x09ff('0xb')](function(_0x5beba5){logger[_0x09ff('0x7')](_0x09ff('0x1a'),_0x53a227,_0x5beba5?_0x09ff('0x16'):_0x09ff('0x17'));return _0x1dbbf6(_0x5beba5);})[_0x09ff('0xd')](function(_0x9b5064){logger[_0x09ff('0x18')](_0x09ff('0x1b'),_0x9b5064?util['inspect'](_0x9b5064,{'showHidden':![],'depth':null}):'');return _0x1dbbf6(null);});}return _0x1dbbf6(null);});};exports[_0x09ff('0x1c')]=function(_0x58a25a){return new BPromise(function(_0x2a5de6,_0x3d9531){if(_0x58a25a){return getUser({'name':_0x58a25a})['then'](function(_0x311020){logger[_0x09ff('0x7')](_0x09ff('0x1d'),_0x58a25a,_0x311020?_0x09ff('0x16'):'notfound');return _0x2a5de6(_0x311020);})['catch'](function(_0x47f38a){logger[_0x09ff('0x18')](_0x09ff('0x1e'),_0x47f38a?util[_0x09ff('0x8')](_0x47f38a,{'showHidden':![],'depth':null}):'');return _0x2a5de6(null);});}return _0x2a5de6(null);});};exports['getVoiceQueueByName']=function(_0x196966){return new BPromise(function(_0xe78c5f,_0x39b8f2){if(_0x196966){return client[_0x09ff('0xa')](_0x09ff('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x09ff('0x20'),_0x09ff('0x21'),_0x09ff('0x22'),_0x09ff('0x23')],'where':{'name':_0x196966},'limit':0x1}})[_0x09ff('0xb')](function(_0x49d2ed){logger[_0x09ff('0x9')](_0x09ff('0x24'),_0x196966,_0x49d2ed?util[_0x09ff('0x8')](_0x49d2ed,{'showHidden':![],'depth':null}):'');logger[_0x09ff('0x7')](_0x09ff('0x25'),_0x196966,_0x49d2ed?'found':_0x09ff('0x17'));return _0xe78c5f(_0x49d2ed['result'][_0x09ff('0x13')]?_0x49d2ed['result'][0x0]:null);})[_0x09ff('0xd')](function(_0x2c4066){logger[_0x09ff('0x18')](_0x09ff('0x26'),_0x2c4066?util[_0x09ff('0x8')](_0x2c4066,{'showHidden':![],'depth':null}):'');return _0xe78c5f(null);});}return _0xe78c5f(null);});};exports['addTime']=function(_0x5f083b,_0x208785){return moment(_0x5f083b)['add'](_0x208785,_0x09ff('0x27'))[_0x09ff('0x28')](_0x09ff('0x29'));};exports[_0x09ff('0x2a')]=function(_0xc8e245,_0x17ca52){return moment(_0xc8e245)['subtract'](_0x17ca52,_0x09ff('0x27'))[_0x09ff('0x28')](_0x09ff('0x29'));};exports[_0x09ff('0x2b')]=function(_0x4b8c4b,_0x1e4152){return moment(_0x4b8c4b)[_0x09ff('0x2c')](moment(_0x1e4152),_0x09ff('0x27'));};exports['sumTime']=function(_0x4b854c,_0x344f1c){return parseInt(_0x4b854c,0xa)+parseInt(_0x344f1c,0xa);};exports['now']=function(){return moment()[_0x09ff('0x28')](_0x09ff('0x29'));};exports[_0x09ff('0x2d')]=function(_0x281d6e,_0x102c6e){if(_0x102c6e){return moment(_0x281d6e)['isAfter'](_0x102c6e);}return!![];};exports[_0x09ff('0x2e')]=function(_0x93c295,_0x507899){if(_0x507899){return moment(_0x93c295)['isBefore'](_0x507899);}else if(_0x93c295){return!![];}return![];}; \ No newline at end of file -- 1.7.1